UNPKG

@terrazzo/plugin-css

Version:

Convert DTCG design tokens JSON into CSS variables for use in any web application or native app with webview.

1,703 lines (1,634 loc) 145 kB
//#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseNumber.js const parseNumber = (color, len) => { if (typeof color !== "number") return; if (len === 3) return { mode: "rgb", r: (color >> 8 & 15 | color >> 4 & 240) / 255, g: (color >> 4 & 15 | color & 240) / 255, b: (color & 15 | color << 4 & 240) / 255 }; if (len === 4) return { mode: "rgb", r: (color >> 12 & 15 | color >> 8 & 240) / 255, g: (color >> 8 & 15 | color >> 4 & 240) / 255, b: (color >> 4 & 15 | color & 240) / 255, alpha: (color & 15 | color << 4 & 240) / 255 }; if (len === 6) return { mode: "rgb", r: (color >> 16 & 255) / 255, g: (color >> 8 & 255) / 255, b: (color & 255) / 255 }; if (len === 8) return { mode: "rgb", r: (color >> 24 & 255) / 255, g: (color >> 16 & 255) / 255, b: (color >> 8 & 255) / 255, alpha: (color & 255) / 255 }; }; var parseNumber_default = parseNumber; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/colors/named.js const named = { aliceblue: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }; var named_default = named; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseNamed.js const parseNamed = (color) => { return parseNumber_default(named_default[color.toLowerCase()], 6); }; var parseNamed_default = parseNamed; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseHex.js const hex = /^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i; const parseHex = (color) => { let match; return (match = color.match(hex)) ? parseNumber_default(parseInt(match[1], 16), match[1].length) : void 0; }; var parseHex_default = parseHex; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/util/regex.js const num$1 = "([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)"; const num_none = `(?:${num$1}|none)`; const per = `${num$1}%`; const per_none = `(?:${num$1}%|none)`; const num_per = `(?:${num$1}%|${num$1})`; const num_per_none = `(?:${num$1}%|${num$1}|none)`; const hue$1 = `(?:${num$1}(deg|grad|rad|turn)|${num$1})`; const hue_none = `(?:${num$1}(deg|grad|rad|turn)|${num$1}|none)`; const c = `\\s*,\\s*`; const rx_num_per_none = /* @__PURE__ */ new RegExp("^" + num_per_none + "$"); //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseRgbLegacy.js const rgb_num_old = /* @__PURE__ */ new RegExp(`^rgba?\\(\\s*${num$1}${c}${num$1}${c}${num$1}\\s*(?:,\\s*${num_per}\\s*)?\\)$`); const rgb_per_old = /* @__PURE__ */ new RegExp(`^rgba?\\(\\s*${per}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`); const parseRgbLegacy = (color) => { let res = { mode: "rgb" }; let match; if (match = color.match(rgb_num_old)) { if (match[1] !== void 0) res.r = match[1] / 255; if (match[2] !== void 0) res.g = match[2] / 255; if (match[3] !== void 0) res.b = match[3] / 255; } else if (match = color.match(rgb_per_old)) { if (match[1] !== void 0) res.r = match[1] / 100; if (match[2] !== void 0) res.g = match[2] / 100; if (match[3] !== void 0) res.b = match[3] / 100; } else return void 0; if (match[4] !== void 0) res.alpha = Math.max(0, Math.min(1, match[4] / 100)); else if (match[5] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[5])); return res; }; var parseRgbLegacy_default = parseRgbLegacy; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/_prepare.js const prepare = (color, mode) => color === void 0 ? void 0 : typeof color !== "object" ? parse_default(color) : color.mode !== void 0 ? color : mode ? { ...color, mode } : void 0; var _prepare_default = prepare; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/converter.js const converter = (target_mode = "rgb") => (color) => (color = _prepare_default(color, target_mode)) !== void 0 ? color.mode === target_mode ? color : converters$1[color.mode][target_mode] ? converters$1[color.mode][target_mode](color) : target_mode === "rgb" ? converters$1[color.mode].rgb(color) : converters$1.rgb[target_mode](converters$1[color.mode].rgb(color)) : void 0; var converter_default = converter; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/modes.js const converters$1 = {}; const modes = {}; const parsers = []; const colorProfiles = {}; const identity = (v) => v; const useMode = (definition$28) => { converters$1[definition$28.mode] = { ...converters$1[definition$28.mode], ...definition$28.toMode }; Object.keys(definition$28.fromMode || {}).forEach((k$3) => { if (!converters$1[k$3]) converters$1[k$3] = {}; converters$1[k$3][definition$28.mode] = definition$28.fromMode[k$3]; }); if (!definition$28.ranges) definition$28.ranges = {}; if (!definition$28.difference) definition$28.difference = {}; definition$28.channels.forEach((channel) => { if (definition$28.ranges[channel] === void 0) definition$28.ranges[channel] = [0, 1]; if (!definition$28.interpolate[channel]) throw new Error(`Missing interpolator for: ${channel}`); if (typeof definition$28.interpolate[channel] === "function") definition$28.interpolate[channel] = { use: definition$28.interpolate[channel] }; if (!definition$28.interpolate[channel].fixup) definition$28.interpolate[channel].fixup = identity; }); modes[definition$28.mode] = definition$28; (definition$28.parse || []).forEach((parser) => { useParser(parser, definition$28.mode); }); return converter_default(definition$28.mode); }; const getMode = (mode) => modes[mode]; const useParser = (parser, mode) => { if (typeof parser === "string") { if (!mode) throw new Error(`'mode' required when 'parser' is a string`); colorProfiles[parser] = mode; } else if (typeof parser === "function") { if (parsers.indexOf(parser) < 0) parsers.push(parser); } }; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/parse.js const IdentStartCodePoint = /[^\x00-\x7F]|[a-zA-Z_]/; const IdentCodePoint = /[^\x00-\x7F]|[-\w]/; const Tok = { Function: "function", Ident: "ident", Number: "number", Percentage: "percentage", ParenClose: ")", None: "none", Hue: "hue", Alpha: "alpha" }; let _i = 0; function is_num(chars) { let ch = chars[_i]; let ch1 = chars[_i + 1]; if (ch === "-" || ch === "+") return /\d/.test(ch1) || ch1 === "." && /\d/.test(chars[_i + 2]); if (ch === ".") return /\d/.test(ch1); return /\d/.test(ch); } function is_ident(chars) { if (_i >= chars.length) return false; let ch = chars[_i]; if (IdentStartCodePoint.test(ch)) return true; if (ch === "-") { if (chars.length - _i < 2) return false; let ch1 = chars[_i + 1]; if (ch1 === "-" || IdentStartCodePoint.test(ch1)) return true; return false; } return false; } const huenits = { deg: 1, rad: 180 / Math.PI, grad: 9 / 10, turn: 360 }; function num(chars) { let value = ""; if (chars[_i] === "-" || chars[_i] === "+") value += chars[_i++]; value += digits(chars); if (chars[_i] === "." && /\d/.test(chars[_i + 1])) value += chars[_i++] + digits(chars); if (chars[_i] === "e" || chars[_i] === "E") { if ((chars[_i + 1] === "-" || chars[_i + 1] === "+") && /\d/.test(chars[_i + 2])) value += chars[_i++] + chars[_i++] + digits(chars); else if (/\d/.test(chars[_i + 1])) value += chars[_i++] + digits(chars); } if (is_ident(chars)) { let id = ident(chars); if (id === "deg" || id === "rad" || id === "turn" || id === "grad") return { type: Tok.Hue, value: value * huenits[id] }; return void 0; } if (chars[_i] === "%") { _i++; return { type: Tok.Percentage, value: +value }; } return { type: Tok.Number, value: +value }; } function digits(chars) { let v = ""; while (/\d/.test(chars[_i])) v += chars[_i++]; return v; } function ident(chars) { let v = ""; while (_i < chars.length && IdentCodePoint.test(chars[_i])) v += chars[_i++]; return v; } function identlike(chars) { let v = ident(chars); if (chars[_i] === "(") { _i++; return { type: Tok.Function, value: v }; } if (v === "none") return { type: Tok.None, value: void 0 }; return { type: Tok.Ident, value: v }; } function tokenize(str = "") { let chars = str.trim(); let tokens = []; let ch; _i = 0; while (_i < chars.length) { ch = chars[_i++]; if (ch === "\n" || ch === " " || ch === " ") { while (_i < chars.length && (chars[_i] === "\n" || chars[_i] === " " || chars[_i] === " ")) _i++; continue; } if (ch === ",") return void 0; if (ch === ")") { tokens.push({ type: Tok.ParenClose }); continue; } if (ch === "+") { _i--; if (is_num(chars)) { tokens.push(num(chars)); continue; } return void 0; } if (ch === "-") { _i--; if (is_num(chars)) { tokens.push(num(chars)); continue; } if (is_ident(chars)) { tokens.push({ type: Tok.Ident, value: ident(chars) }); continue; } return void 0; } if (ch === ".") { _i--; if (is_num(chars)) { tokens.push(num(chars)); continue; } return void 0; } if (ch === "/") { while (_i < chars.length && (chars[_i] === "\n" || chars[_i] === " " || chars[_i] === " ")) _i++; let alpha; if (is_num(chars)) { alpha = num(chars); if (alpha.type !== Tok.Hue) { tokens.push({ type: Tok.Alpha, value: alpha }); continue; } } if (is_ident(chars)) { if (ident(chars) === "none") { tokens.push({ type: Tok.Alpha, value: { type: Tok.None, value: void 0 } }); continue; } } return void 0; } if (/\d/.test(ch)) { _i--; tokens.push(num(chars)); continue; } if (IdentStartCodePoint.test(ch)) { _i--; tokens.push(identlike(chars)); continue; } return void 0; } return tokens; } function parseColorSyntax(tokens) { tokens._i = 0; let token = tokens[tokens._i++]; if (!token || token.type !== Tok.Function || token.value !== "color") return void 0; token = tokens[tokens._i++]; if (token.type !== Tok.Ident) return void 0; const mode = colorProfiles[token.value]; if (!mode) return void 0; const res = { mode }; const coords = consumeCoords(tokens, false); if (!coords) return void 0; const channels = getMode(mode).channels; for (let ii = 0, c$1, ch; ii < channels.length; ii++) { c$1 = coords[ii]; ch = channels[ii]; if (c$1.type !== Tok.None) { res[ch] = c$1.type === Tok.Number ? c$1.value : c$1.value / 100; if (ch === "alpha") res[ch] = Math.max(0, Math.min(1, res[ch])); } } return res; } function consumeCoords(tokens, includeHue) { const coords = []; let token; while (tokens._i < tokens.length) { token = tokens[tokens._i++]; if (token.type === Tok.None || token.type === Tok.Number || token.type === Tok.Alpha || token.type === Tok.Percentage || includeHue && token.type === Tok.Hue) { coords.push(token); continue; } if (token.type === Tok.ParenClose) { if (tokens._i < tokens.length) return void 0; continue; } return void 0; } if (coords.length < 3 || coords.length > 4) return void 0; if (coords.length === 4) { if (coords[3].type !== Tok.Alpha) return void 0; coords[3] = coords[3].value; } if (coords.length === 3) coords.push({ type: Tok.None, value: void 0 }); return coords.every((c$1) => c$1.type !== Tok.Alpha) ? coords : void 0; } function parseModernSyntax(tokens, includeHue) { tokens._i = 0; let token = tokens[tokens._i++]; if (!token || token.type !== Tok.Function) return void 0; let coords = consumeCoords(tokens, includeHue); if (!coords) return void 0; coords.unshift(token.value); return coords; } const parse = (color) => { if (typeof color !== "string") return void 0; const tokens = tokenize(color); const parsed = tokens ? parseModernSyntax(tokens, true) : void 0; let result = void 0; let i = 0; let len = parsers.length; while (i < len) if ((result = parsers[i++](color, parsed)) !== void 0) return result; return tokens ? parseColorSyntax(tokens) : void 0; }; var parse_default = parse; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseRgb.js function parseRgb(color, parsed) { if (!parsed || parsed[0] !== "rgb" && parsed[0] !== "rgba") return void 0; const res = { mode: "rgb" }; const [, r$1, g, b, alpha] = parsed; if (r$1.type === Tok.Hue || g.type === Tok.Hue || b.type === Tok.Hue) return void 0; if (r$1.type !== Tok.None) res.r = r$1.type === Tok.Number ? r$1.value / 255 : r$1.value / 100; if (g.type !== Tok.None) res.g = g.type === Tok.Number ? g.value / 255 : g.value / 100; if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value / 255 : b.value / 100; if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100)); return res; } var parseRgb_default = parseRgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseTransparent.js const parseTransparent = (c$1) => c$1 === "transparent" ? { mode: "rgb", r: 0, g: 0, b: 0, alpha: 0 } : void 0; var parseTransparent_default = parseTransparent; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/interpolate/lerp.js const lerp = (a, b, t) => a + t * (b - a); //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/interpolate/piecewise.js const get_classes = (arr) => { let classes = []; for (let i = 0; i < arr.length - 1; i++) { let a = arr[i]; let b = arr[i + 1]; if (a === void 0 && b === void 0) classes.push(void 0); else if (a !== void 0 && b !== void 0) classes.push([a, b]); else classes.push(a !== void 0 ? [a, a] : [b, b]); } return classes; }; const interpolatorPiecewise = (interpolator) => (arr) => { let classes = get_classes(arr); return (t) => { let cls = t * classes.length; let idx = t >= 1 ? classes.length - 1 : Math.max(Math.floor(cls), 0); let pair = classes[idx]; return pair === void 0 ? void 0 : interpolator(pair[0], pair[1], cls - idx); }; }; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/interpolate/linear.js const interpolatorLinear = interpolatorPiecewise(lerp); //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/fixup/alpha.js const fixupAlpha = (arr) => { let some_defined = false; let res = arr.map((v) => { if (v !== void 0) { some_defined = true; return v; } return 1; }); return some_defined ? res : arr; }; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/definition.js const definition$27 = { mode: "rgb", channels: [ "r", "g", "b", "alpha" ], parse: [ parseRgb_default, parseHex_default, parseRgbLegacy_default, parseNamed_default, parseTransparent_default, "srgb" ], serialize: "srgb", interpolate: { r: interpolatorLinear, g: interpolatorLinear, b: interpolatorLinear, alpha: { use: interpolatorLinear, fixup: fixupAlpha } }, gamut: true, white: { r: 1, g: 1, b: 1 }, black: { r: 0, g: 0, b: 0 } }; var definition_default$12 = definition$27; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/a98/convertA98ToXyz65.js const linearize$2 = (v = 0) => Math.pow(Math.abs(v), 563 / 256) * Math.sign(v); const convertA98ToXyz65 = (a98$2) => { let r$1 = linearize$2(a98$2.r); let g = linearize$2(a98$2.g); let b = linearize$2(a98$2.b); let res = { mode: "xyz65", x: .5766690429101305 * r$1 + .1855582379065463 * g + .1882286462349947 * b, y: .297344975250536 * r$1 + .6273635662554661 * g + .0752914584939979 * b, z: .0270313613864123 * r$1 + .0706888525358272 * g + .9913375368376386 * b }; if (a98$2.alpha !== void 0) res.alpha = a98$2.alpha; return res; }; var convertA98ToXyz65_default = convertA98ToXyz65; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/a98/convertXyz65ToA98.js const gamma$2 = (v) => Math.pow(Math.abs(v), 256 / 563) * Math.sign(v); const convertXyz65ToA98 = ({ x, y, z, alpha }) => { if (x === void 0) x = 0; if (y === void 0) y = 0; if (z === void 0) z = 0; let res = { mode: "a98", r: gamma$2(x * 2.0415879038107465 - y * .5650069742788597 - .3447313507783297 * z), g: gamma$2(x * -.9692436362808798 + y * 1.8759675015077206 + .0415550574071756 * z), b: gamma$2(x * .0134442806320312 - y * .1183623922310184 + 1.0151749943912058 * z) }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertXyz65ToA98_default = convertXyz65ToA98; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lrgb/convertRgbToLrgb.js const fn$3 = (c$1 = 0) => { const abs$1 = Math.abs(c$1); if (abs$1 <= .04045) return c$1 / 12.92; return (Math.sign(c$1) || 1) * Math.pow((abs$1 + .055) / 1.055, 2.4); }; const convertRgbToLrgb = ({ r: r$1, g, b, alpha }) => { let res = { mode: "lrgb", r: fn$3(r$1), g: fn$3(g), b: fn$3(b) }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertRgbToLrgb_default = convertRgbToLrgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/convertRgbToXyz65.js const convertRgbToXyz65 = (rgb$4) => { let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$4); let res = { mode: "xyz65", x: .4123907992659593 * r$1 + .357584339383878 * g + .1804807884018343 * b, y: .2126390058715102 * r$1 + .715168678767756 * g + .0721923153607337 * b, z: .0193308187155918 * r$1 + .119194779794626 * g + .9505321522496607 * b }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertRgbToXyz65_default = convertRgbToXyz65; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lrgb/convertLrgbToRgb.js const fn$2 = (c$1 = 0) => { const abs$1 = Math.abs(c$1); if (abs$1 > .0031308) return (Math.sign(c$1) || 1) * (1.055 * Math.pow(abs$1, 1 / 2.4) - .055); return c$1 * 12.92; }; const convertLrgbToRgb = ({ r: r$1, g, b, alpha }, mode = "rgb") => { let res = { mode, r: fn$2(r$1), g: fn$2(g), b: fn$2(b) }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertLrgbToRgb_default = convertLrgbToRgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/convertXyz65ToRgb.js const convertXyz65ToRgb = ({ x, y, z, alpha }) => { if (x === void 0) x = 0; if (y === void 0) y = 0; if (z === void 0) z = 0; let res = convertLrgbToRgb_default({ r: x * 3.2409699419045226 - y * 1.537383177570094 - .4986107602930034 * z, g: x * -.9692436362808796 + y * 1.8759675015077204 + .0415550574071756 * z, b: x * .0556300796969936 - y * .2039769588889765 + 1.0569715142428784 * z }); if (alpha !== void 0) res.alpha = alpha; return res; }; var convertXyz65ToRgb_default = convertXyz65ToRgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/a98/definition.js const definition$26 = { ...definition_default$12, mode: "a98", parse: ["a98-rgb"], serialize: "a98-rgb", fromMode: { rgb: (color) => convertXyz65ToA98_default(convertRgbToXyz65_default(color)), xyz65: convertXyz65ToA98_default }, toMode: { rgb: (color) => convertXyz65ToRgb_default(convertA98ToXyz65_default(color)), xyz65: convertA98ToXyz65_default } }; var definition_default = definition$26; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/util/normalizeHue.js const normalizeHue = (hue$2) => (hue$2 = hue$2 % 360) < 0 ? hue$2 + 360 : hue$2; var normalizeHue_default = normalizeHue; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/convertHslToRgb.js function convertHslToRgb({ h, s, l, alpha }) { h = normalizeHue_default(h !== void 0 ? h : 0); if (s === void 0) s = 0; if (l === void 0) l = 0; let m1 = l + s * (l < .5 ? l : 1 - l); let m2 = m1 - (m1 - l) * 2 * Math.abs(h / 60 % 2 - 1); let res; switch (Math.floor(h / 60)) { case 0: res = { r: m1, g: m2, b: 2 * l - m1 }; break; case 1: res = { r: m2, g: m1, b: 2 * l - m1 }; break; case 2: res = { r: 2 * l - m1, g: m1, b: m2 }; break; case 3: res = { r: 2 * l - m1, g: m2, b: m1 }; break; case 4: res = { r: m2, g: 2 * l - m1, b: m1 }; break; case 5: res = { r: m1, g: 2 * l - m1, b: m2 }; break; default: res = { r: 2 * l - m1, g: 2 * l - m1, b: 2 * l - m1 }; } res.mode = "rgb"; if (alpha !== void 0) res.alpha = alpha; return res; } //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/convertRgbToHsl.js function convertRgbToHsl({ r: r$1, g, b, alpha }) { if (r$1 === void 0) r$1 = 0; if (g === void 0) g = 0; if (b === void 0) b = 0; let M$1 = Math.max(r$1, g, b), m = Math.min(r$1, g, b); let res = { mode: "hsl", s: M$1 === m ? 0 : (M$1 - m) / (1 - Math.abs(M$1 + m - 1)), l: .5 * (M$1 + m) }; if (M$1 - m !== 0) res.h = (M$1 === r$1 ? (g - b) / (M$1 - m) + (g < b) * 6 : M$1 === g ? (b - r$1) / (M$1 - m) + 2 : (r$1 - g) / (M$1 - m) + 4) * 60; if (alpha !== void 0) res.alpha = alpha; return res; } //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/util/hue.js const hueToDeg = (val, unit) => { switch (unit) { case "deg": return +val; case "rad": return val / Math.PI * 180; case "grad": return val / 10 * 9; case "turn": return val * 360; } }; var hue_default = hueToDeg; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/parseHslLegacy.js const hsl_old = /* @__PURE__ */ new RegExp(`^hsla?\\(\\s*${hue$1}${c}${per}${c}${per}\\s*(?:,\\s*${num_per}\\s*)?\\)$`); const parseHslLegacy = (color) => { let match = color.match(hsl_old); if (!match) return; let res = { mode: "hsl" }; if (match[3] !== void 0) res.h = +match[3]; else if (match[1] !== void 0 && match[2] !== void 0) res.h = hue_default(match[1], match[2]); if (match[4] !== void 0) res.s = Math.min(Math.max(0, match[4] / 100), 1); if (match[5] !== void 0) res.l = Math.min(Math.max(0, match[5] / 100), 1); if (match[6] !== void 0) res.alpha = Math.max(0, Math.min(1, match[6] / 100)); else if (match[7] !== void 0) res.alpha = Math.max(0, Math.min(1, +match[7])); return res; }; var parseHslLegacy_default = parseHslLegacy; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/parseHsl.js function parseHsl(color, parsed) { if (!parsed || parsed[0] !== "hsl" && parsed[0] !== "hsla") return void 0; const res = { mode: "hsl" }; const [, h, s, l, alpha] = parsed; if (h.type !== Tok.None) { if (h.type === Tok.Percentage) return void 0; res.h = h.value; } if (s.type !== Tok.None) { if (s.type === Tok.Hue) return void 0; res.s = s.value / 100; } if (l.type !== Tok.None) { if (l.type === Tok.Hue) return void 0; res.l = l.value / 100; } if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100)); return res; } var parseHsl_default = parseHsl; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/fixup/hue.js const hue = (hues, fn$4) => { return hues.map((hue$2, idx, arr) => { if (hue$2 === void 0) return hue$2; let normalized = normalizeHue_default(hue$2); if (idx === 0 || hues[idx - 1] === void 0) return normalized; return fn$4(normalized - normalizeHue_default(arr[idx - 1])); }).reduce((acc, curr) => { if (!acc.length || curr === void 0 || acc[acc.length - 1] === void 0) { acc.push(curr); return acc; } acc.push(curr + acc[acc.length - 1]); return acc; }, []); }; const fixupHueShorter = (arr) => hue(arr, (d) => Math.abs(d) <= 180 ? d : d - 360 * Math.sign(d)); //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/difference.js const differenceHueSaturation = (std, smp) => { if (std.h === void 0 || smp.h === void 0 || !std.s || !smp.s) return 0; let std_h = normalizeHue_default(std.h); let smp_h = normalizeHue_default(smp.h); let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180); return 2 * Math.sqrt(std.s * smp.s) * dH; }; const differenceHueNaive = (std, smp) => { if (std.h === void 0 || smp.h === void 0) return 0; let std_h = normalizeHue_default(std.h); let smp_h = normalizeHue_default(smp.h); if (Math.abs(smp_h - std_h) > 180) return std_h - (smp_h - 360 * Math.sign(smp_h - std_h)); return smp_h - std_h; }; const differenceHueChroma = (std, smp) => { if (std.h === void 0 || smp.h === void 0 || !std.c || !smp.c) return 0; let std_h = normalizeHue_default(std.h); let smp_h = normalizeHue_default(smp.h); let dH = Math.sin((smp_h - std_h + 360) / 2 * Math.PI / 180); return 2 * Math.sqrt(std.c * smp.c) * dH; }; const differenceEuclidean = (mode = "rgb", weights = [ 1, 1, 1, 0 ]) => { let def = getMode(mode); let channels = def.channels; let diffs = def.difference; let conv = converter_default(mode); return (std, smp) => { let ConvStd = conv(std); let ConvSmp = conv(smp); return Math.sqrt(channels.reduce((sum, k$3, idx) => { let delta = diffs[k$3] ? diffs[k$3](ConvStd, ConvSmp) : ConvStd[k$3] - ConvSmp[k$3]; return sum + (weights[idx] || 0) * Math.pow(isNaN(delta) ? 0 : delta, 2); }, 0)); }; }; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/average.js const averageAngle = (val) => { let sum = val.reduce((sum$1, val$1) => { if (val$1 !== void 0) { let rad = val$1 * Math.PI / 180; sum$1.sin += Math.sin(rad); sum$1.cos += Math.cos(rad); } return sum$1; }, { sin: 0, cos: 0 }); let angle = Math.atan2(sum.sin, sum.cos) * 180 / Math.PI; return angle < 0 ? 360 + angle : angle; }; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsl/definition.js const definition$25 = { mode: "hsl", toMode: { rgb: convertHslToRgb }, fromMode: { rgb: convertRgbToHsl }, channels: [ "h", "s", "l", "alpha" ], ranges: { h: [0, 360] }, gamut: "rgb", parse: [parseHsl_default, parseHslLegacy_default], serialize: (c$1) => `hsl(${c$1.h !== void 0 ? c$1.h : "none"} ${c$1.s !== void 0 ? c$1.s * 100 + "%" : "none"} ${c$1.l !== void 0 ? c$1.l * 100 + "%" : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`, interpolate: { h: { use: interpolatorLinear, fixup: fixupHueShorter }, s: interpolatorLinear, l: interpolatorLinear, alpha: { use: interpolatorLinear, fixup: fixupAlpha } }, difference: { h: differenceHueSaturation }, average: { h: averageAngle } }; var definition_default$1 = definition$25; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsv/convertHsvToRgb.js function convertHsvToRgb({ h, s, v, alpha }) { h = normalizeHue_default(h !== void 0 ? h : 0); if (s === void 0) s = 0; if (v === void 0) v = 0; let f$2 = Math.abs(h / 60 % 2 - 1); let res; switch (Math.floor(h / 60)) { case 0: res = { r: v, g: v * (1 - s * f$2), b: v * (1 - s) }; break; case 1: res = { r: v * (1 - s * f$2), g: v, b: v * (1 - s) }; break; case 2: res = { r: v * (1 - s), g: v, b: v * (1 - s * f$2) }; break; case 3: res = { r: v * (1 - s), g: v * (1 - s * f$2), b: v }; break; case 4: res = { r: v * (1 - s * f$2), g: v * (1 - s), b: v }; break; case 5: res = { r: v, g: v * (1 - s), b: v * (1 - s * f$2) }; break; default: res = { r: v * (1 - s), g: v * (1 - s), b: v * (1 - s) }; } res.mode = "rgb"; if (alpha !== void 0) res.alpha = alpha; return res; } //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsv/convertRgbToHsv.js function convertRgbToHsv({ r: r$1, g, b, alpha }) { if (r$1 === void 0) r$1 = 0; if (g === void 0) g = 0; if (b === void 0) b = 0; let M$1 = Math.max(r$1, g, b), m = Math.min(r$1, g, b); let res = { mode: "hsv", s: M$1 === 0 ? 0 : 1 - m / M$1, v: M$1 }; if (M$1 - m !== 0) res.h = (M$1 === r$1 ? (g - b) / (M$1 - m) + (g < b) * 6 : M$1 === g ? (b - r$1) / (M$1 - m) + 2 : (r$1 - g) / (M$1 - m) + 4) * 60; if (alpha !== void 0) res.alpha = alpha; return res; } //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hsv/definition.js const definition$24 = { mode: "hsv", toMode: { rgb: convertHsvToRgb }, parse: ["--hsv"], serialize: "--hsv", fromMode: { rgb: convertRgbToHsv }, channels: [ "h", "s", "v", "alpha" ], ranges: { h: [0, 360] }, gamut: "rgb", interpolate: { h: { use: interpolatorLinear, fixup: fixupHueShorter }, s: interpolatorLinear, v: interpolatorLinear, alpha: { use: interpolatorLinear, fixup: fixupAlpha } }, difference: { h: differenceHueSaturation }, average: { h: averageAngle } }; var definition_default$19 = definition$24; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/convertHwbToRgb.js function convertHwbToRgb({ h, w, b, alpha }) { if (w === void 0) w = 0; if (b === void 0) b = 0; if (w + b > 1) { let s = w + b; w /= s; b /= s; } return convertHsvToRgb({ h, s: b === 1 ? 1 : 1 - w / (1 - b), v: 1 - b, alpha }); } //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/convertRgbToHwb.js function convertRgbToHwb(rgba) { let hsv$2 = convertRgbToHsv(rgba); if (hsv$2 === void 0) return void 0; let s = hsv$2.s !== void 0 ? hsv$2.s : 0; let v = hsv$2.v !== void 0 ? hsv$2.v : 0; let res = { mode: "hwb", w: (1 - s) * v, b: 1 - v }; if (hsv$2.h !== void 0) res.h = hsv$2.h; if (hsv$2.alpha !== void 0) res.alpha = hsv$2.alpha; return res; } //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/parseHwb.js function ParseHwb(color, parsed) { if (!parsed || parsed[0] !== "hwb") return void 0; const res = { mode: "hwb" }; const [, h, w, b, alpha] = parsed; if (h.type !== Tok.None) { if (h.type === Tok.Percentage) return void 0; res.h = h.value; } if (w.type !== Tok.None) { if (w.type === Tok.Hue) return void 0; res.w = w.value / 100; } if (b.type !== Tok.None) { if (b.type === Tok.Hue) return void 0; res.b = b.value / 100; } if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100)); return res; } var parseHwb_default = ParseHwb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/hwb/definition.js const definition$23 = { mode: "hwb", toMode: { rgb: convertHwbToRgb }, fromMode: { rgb: convertRgbToHwb }, channels: [ "h", "w", "b", "alpha" ], ranges: { h: [0, 360] }, gamut: "rgb", parse: [parseHwb_default], serialize: (c$1) => `hwb(${c$1.h !== void 0 ? c$1.h : "none"} ${c$1.w !== void 0 ? c$1.w * 100 + "%" : "none"} ${c$1.b !== void 0 ? c$1.b * 100 + "%" : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`, interpolate: { h: { use: interpolatorLinear, fixup: fixupHueShorter }, w: interpolatorLinear, b: interpolatorLinear, alpha: { use: interpolatorLinear, fixup: fixupAlpha } }, difference: { h: differenceHueNaive }, average: { h: averageAngle } }; var definition_default$2 = definition$23; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz50/constants.js const k = Math.pow(29, 3) / Math.pow(3, 3); const e = Math.pow(6, 3) / Math.pow(29, 3); //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/constants.js const D50 = { X: .3457 / .3585, Y: 1, Z: .2958 / .3585 }; const D65 = { X: .3127 / .329, Y: 1, Z: .3583 / .329 }; const k$2 = Math.pow(29, 3) / Math.pow(3, 3); const e$2 = Math.pow(6, 3) / Math.pow(29, 3); //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertLabToXyz50.js let fn$1 = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k; const convertLabToXyz50 = ({ l, a, b, alpha }) => { if (l === void 0) l = 0; if (a === void 0) a = 0; if (b === void 0) b = 0; let fy = (l + 16) / 116; let fx = a / 500 + fy; let fz = fy - b / 200; let res = { mode: "xyz50", x: fn$1(fx) * D50.X, y: fn$1(fy) * D50.Y, z: fn$1(fz) * D50.Z }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertLabToXyz50_default = convertLabToXyz50; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz50/convertXyz50ToRgb.js const convertXyz50ToRgb = ({ x, y, z, alpha }) => { if (x === void 0) x = 0; if (y === void 0) y = 0; if (z === void 0) z = 0; let res = convertLrgbToRgb_default({ r: x * 3.1341359569958707 - y * 1.6173863321612538 - .4906619460083532 * z, g: x * -.978795502912089 + y * 1.916254567259524 + .03344273116131949 * z, b: x * .07195537988411677 - y * .2289768264158322 + 1.405386058324125 * z }); if (alpha !== void 0) res.alpha = alpha; return res; }; var convertXyz50ToRgb_default = convertXyz50ToRgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertLabToRgb.js const convertLabToRgb = (lab$2) => convertXyz50ToRgb_default(convertLabToXyz50_default(lab$2)); var convertLabToRgb_default = convertLabToRgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz50/convertRgbToXyz50.js const convertRgbToXyz50 = (rgb$4) => { let { r: r$1, g, b, alpha } = convertRgbToLrgb_default(rgb$4); let res = { mode: "xyz50", x: .436065742824811 * r$1 + .3851514688337912 * g + .14307845442264197 * b, y: .22249319175623702 * r$1 + .7168870538238823 * g + .06061979053616537 * b, z: .013923904500943465 * r$1 + .09708128566574634 * g + .7140993584005155 * b }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertRgbToXyz50_default = convertRgbToXyz50; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertXyz50ToLab.js const f$1 = (value) => value > e ? Math.cbrt(value) : (k * value + 16) / 116; const convertXyz50ToLab = ({ x, y, z, alpha }) => { if (x === void 0) x = 0; if (y === void 0) y = 0; if (z === void 0) z = 0; let f0 = f$1(x / D50.X); let f1 = f$1(y / D50.Y); let f2 = f$1(z / D50.Z); let res = { mode: "lab", l: 116 * f1 - 16, a: 500 * (f0 - f1), b: 200 * (f1 - f2) }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertXyz50ToLab_default = convertXyz50ToLab; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/convertRgbToLab.js const convertRgbToLab = (rgb$4) => { let res = convertXyz50ToLab_default(convertRgbToXyz50_default(rgb$4)); if (rgb$4.r === rgb$4.b && rgb$4.b === rgb$4.g) res.a = res.b = 0; return res; }; var convertRgbToLab_default = convertRgbToLab; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/parseLab.js function parseLab(color, parsed) { if (!parsed || parsed[0] !== "lab") return void 0; const res = { mode: "lab" }; const [, l, a, b, alpha] = parsed; if (l.type === Tok.Hue || a.type === Tok.Hue || b.type === Tok.Hue) return void 0; if (l.type !== Tok.None) res.l = Math.min(Math.max(0, l.value), 100); if (a.type !== Tok.None) res.a = a.type === Tok.Number ? a.value : a.value * 125 / 100; if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value : b.value * 125 / 100; if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100)); return res; } var parseLab_default = parseLab; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab/definition.js const definition$22 = { mode: "lab", toMode: { xyz50: convertLabToXyz50_default, rgb: convertLabToRgb_default }, fromMode: { xyz50: convertXyz50ToLab_default, rgb: convertRgbToLab_default }, channels: [ "l", "a", "b", "alpha" ], ranges: { l: [0, 100], a: [-125, 125], b: [-125, 125] }, parse: [parseLab_default], serialize: (c$1) => `lab(${c$1.l !== void 0 ? c$1.l : "none"} ${c$1.a !== void 0 ? c$1.a : "none"} ${c$1.b !== void 0 ? c$1.b : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`, interpolate: { l: interpolatorLinear, a: interpolatorLinear, b: interpolatorLinear, alpha: { use: interpolatorLinear, fixup: fixupAlpha } } }; var definition_default$3 = definition$22; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/xyz65/constants.js const k$1 = Math.pow(29, 3) / Math.pow(3, 3); const e$1 = Math.pow(6, 3) / Math.pow(29, 3); //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertLab65ToXyz65.js let fn = (v) => Math.pow(v, 3) > e$1 ? Math.pow(v, 3) : (116 * v - 16) / k$1; const convertLab65ToXyz65 = ({ l, a, b, alpha }) => { if (l === void 0) l = 0; if (a === void 0) a = 0; if (b === void 0) b = 0; let fy = (l + 16) / 116; let fx = a / 500 + fy; let fz = fy - b / 200; let res = { mode: "xyz65", x: fn(fx) * D65.X, y: fn(fy) * D65.Y, z: fn(fz) * D65.Z }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertLab65ToXyz65_default = convertLab65ToXyz65; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertLab65ToRgb.js const convertLab65ToRgb = (lab$2) => convertXyz65ToRgb_default(convertLab65ToXyz65_default(lab$2)); var convertLab65ToRgb_default = convertLab65ToRgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertXyz65ToLab65.js const f = (value) => value > e$1 ? Math.cbrt(value) : (k$1 * value + 16) / 116; const convertXyz65ToLab65 = ({ x, y, z, alpha }) => { if (x === void 0) x = 0; if (y === void 0) y = 0; if (z === void 0) z = 0; let f0 = f(x / D65.X); let f1 = f(y / D65.Y); let f2 = f(z / D65.Z); let res = { mode: "lab65", l: 116 * f1 - 16, a: 500 * (f0 - f1), b: 200 * (f1 - f2) }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertXyz65ToLab65_default = convertXyz65ToLab65; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/convertRgbToLab65.js const convertRgbToLab65 = (rgb$4) => { let res = convertXyz65ToLab65_default(convertRgbToXyz65_default(rgb$4)); if (rgb$4.r === rgb$4.b && rgb$4.b === rgb$4.g) res.a = res.b = 0; return res; }; var convertRgbToLab65_default = convertRgbToLab65; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lab65/definition.js const definition$21 = { ...definition_default$3, mode: "lab65", parse: ["--lab-d65"], serialize: "--lab-d65", toMode: { xyz65: convertLab65ToXyz65_default, rgb: convertLab65ToRgb_default }, fromMode: { xyz65: convertXyz65ToLab65_default, rgb: convertRgbToLab65_default }, ranges: { l: [0, 100], a: [-125, 125], b: [-125, 125] } }; var definition_default$4 = definition$21; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/convertLabToLch.js const convertLabToLch = ({ l, a, b, alpha }, mode = "lch") => { if (a === void 0) a = 0; if (b === void 0) b = 0; let c$1 = Math.sqrt(a * a + b * b); let res = { mode, l, c: c$1 }; if (c$1) res.h = normalizeHue_default(Math.atan2(b, a) * 180 / Math.PI); if (alpha !== void 0) res.alpha = alpha; return res; }; var convertLabToLch_default = convertLabToLch; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/convertLchToLab.js const convertLchToLab = ({ l, c: c$1, h, alpha }, mode = "lab") => { if (h === void 0) h = 0; let res = { mode, l, a: c$1 ? c$1 * Math.cos(h / 180 * Math.PI) : 0, b: c$1 ? c$1 * Math.sin(h / 180 * Math.PI) : 0 }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertLchToLab_default = convertLchToLab; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/parseLch.js function parseLch(color, parsed) { if (!parsed || parsed[0] !== "lch") return void 0; const res = { mode: "lch" }; const [, l, c$1, h, alpha] = parsed; if (l.type !== Tok.None) { if (l.type === Tok.Hue) return void 0; res.l = Math.min(Math.max(0, l.value), 100); } if (c$1.type !== Tok.None) res.c = Math.max(0, c$1.type === Tok.Number ? c$1.value : c$1.value * 150 / 100); if (h.type !== Tok.None) { if (h.type === Tok.Percentage) return void 0; res.h = h.value; } if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100)); return res; } var parseLch_default = parseLch; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch/definition.js const definition$20 = { mode: "lch", toMode: { lab: convertLchToLab_default, rgb: (c$1) => convertLabToRgb_default(convertLchToLab_default(c$1)) }, fromMode: { rgb: (c$1) => convertLabToLch_default(convertRgbToLab_default(c$1)), lab: convertLabToLch_default }, channels: [ "l", "c", "h", "alpha" ], ranges: { l: [0, 100], c: [0, 150], h: [0, 360] }, parse: [parseLch_default], serialize: (c$1) => `lch(${c$1.l !== void 0 ? c$1.l : "none"} ${c$1.c !== void 0 ? c$1.c : "none"} ${c$1.h !== void 0 ? c$1.h : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})`, interpolate: { h: { use: interpolatorLinear, fixup: fixupHueShorter }, c: interpolatorLinear, l: interpolatorLinear, alpha: { use: interpolatorLinear, fixup: fixupAlpha } }, difference: { h: differenceHueChroma }, average: { h: averageAngle } }; var definition_default$5 = definition$20; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lch65/definition.js const definition$19 = { ...definition_default$5, mode: "lch65", parse: ["--lch-d65"], serialize: "--lch-d65", toMode: { lab65: (c$1) => convertLchToLab_default(c$1, "lab65"), rgb: (c$1) => convertLab65ToRgb_default(convertLchToLab_default(c$1, "lab65")) }, fromMode: { rgb: (c$1) => convertLabToLch_default(convertRgbToLab65_default(c$1), "lch65"), lab65: (c$1) => convertLabToLch_default(c$1, "lch65") }, ranges: { l: [0, 100], c: [0, 150], h: [0, 360] } }; var definition_default$23 = definition$19; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/lrgb/definition.js const definition$18 = { ...definition_default$12, mode: "lrgb", toMode: { rgb: convertLrgbToRgb_default }, fromMode: { rgb: convertRgbToLrgb_default }, parse: ["srgb-linear"], serialize: "srgb-linear" }; var definition_default$6 = definition$18; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertOklabToLrgb.js const convertOklabToLrgb = ({ l, a, b, alpha }) => { if (l === void 0) l = 0; if (a === void 0) a = 0; if (b === void 0) b = 0; let L = Math.pow(l + .3963377773761749 * a + .2158037573099136 * b, 3); let M$1 = Math.pow(l - .1055613458156586 * a - .0638541728258133 * b, 3); let S = Math.pow(l - .0894841775298119 * a - 1.2914855480194092 * b, 3); let res = { mode: "lrgb", r: 4.076741636075957 * L - 3.3077115392580616 * M$1 + .2309699031821044 * S, g: -1.2684379732850317 * L + 2.6097573492876887 * M$1 - .3413193760026573 * S, b: -.0041960761386756 * L - .7034186179359362 * M$1 + 1.7076146940746117 * S }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertOklabToLrgb_default = convertOklabToLrgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertLrgbToOklab.js const convertLrgbToOklab = ({ r: r$1, g, b, alpha }) => { if (r$1 === void 0) r$1 = 0; if (g === void 0) g = 0; if (b === void 0) b = 0; let L = Math.cbrt(.412221469470763 * r$1 + .5363325372617348 * g + .0514459932675022 * b); let M$1 = Math.cbrt(.2119034958178252 * r$1 + .6806995506452344 * g + .1073969535369406 * b); let S = Math.cbrt(.0883024591900564 * r$1 + .2817188391361215 * g + .6299787016738222 * b); let res = { mode: "oklab", l: .210454268309314 * L + .7936177747023054 * M$1 - .0040720430116193 * S, a: 1.9779985324311684 * L - 2.42859224204858 * M$1 + .450593709617411 * S, b: .0259040424655478 * L + .7827717124575296 * M$1 - .8086757549230774 * S }; if (alpha !== void 0) res.alpha = alpha; return res; }; var convertLrgbToOklab_default = convertLrgbToOklab; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertRgbToOklab.js const convertRgbToOklab = (rgb$4) => { let res = convertLrgbToOklab_default(convertRgbToLrgb_default(rgb$4)); if (rgb$4.r === rgb$4.b && rgb$4.b === rgb$4.g) res.a = res.b = 0; return res; }; var convertRgbToOklab_default = convertRgbToOklab; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/convertOklabToRgb.js const convertOklabToRgb = (c$1) => convertLrgbToRgb_default(convertOklabToLrgb_default(c$1)); var convertOklabToRgb_default = convertOklabToRgb; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/parseOklab.js function parseOklab(color, parsed) { if (!parsed || parsed[0] !== "oklab") return void 0; const res = { mode: "oklab" }; const [, l, a, b, alpha] = parsed; if (l.type === Tok.Hue || a.type === Tok.Hue || b.type === Tok.Hue) return void 0; if (l.type !== Tok.None) res.l = Math.min(Math.max(0, l.type === Tok.Number ? l.value : l.value / 100), 1); if (a.type !== Tok.None) res.a = a.type === Tok.Number ? a.value : a.value * .4 / 100; if (b.type !== Tok.None) res.b = b.type === Tok.Number ? b.value : b.value * .4 / 100; if (alpha.type !== Tok.None) res.alpha = Math.min(1, Math.max(0, alpha.type === Tok.Number ? alpha.value : alpha.value / 100)); return res; } var parseOklab_default = parseOklab; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklab/definition.js const definition$17 = { ...definition_default$3, mode: "oklab", toMode: { lrgb: convertOklabToLrgb_default, rgb: convertOklabToRgb_default }, fromMode: { lrgb: convertLrgbToOklab_default, rgb: convertRgbToOklab_default }, ranges: { l: [0, 1], a: [-.4, .4], b: [-.4, .4] }, parse: [parseOklab_default], serialize: (c$1) => `oklab(${c$1.l !== void 0 ? c$1.l : "none"} ${c$1.a !== void 0 ? c$1.a : "none"} ${c$1.b !== void 0 ? c$1.b : "none"}${c$1.alpha < 1 ? ` / ${c$1.alpha}` : ""})` }; var definition_default$7 = definition$17; //#endregion //#region ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/oklch/parseOklch.js function parseOklch(color, parsed) { if (!parsed || parsed[0] !== "oklch") return void 0; const res = { mode: "oklch" }; const [, l, c$1, h, alpha