@inf-monkeys-tech/monkeys-design 0.4.55 → 0.4.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +29 -5
  2. package/dist/{LandingPage-CR5KyIwR.d.mts → LandingPage-D7FF9gnM.d.mts} +3 -3
  3. package/dist/{LandingPage-CR5KyIwR.d.ts → LandingPage-D7FF9gnM.d.ts} +3 -3
  4. package/dist/components/base/index.d.mts +3 -3
  5. package/dist/components/base/index.d.ts +3 -3
  6. package/dist/components/base/index.js +7229 -2042
  7. package/dist/components/base/index.js.map +1 -1
  8. package/dist/components/base/index.mjs +7215 -2052
  9. package/dist/components/base/index.mjs.map +1 -1
  10. package/dist/components/data-explorer/index.d.mts +1 -1
  11. package/dist/components/data-explorer/index.d.ts +1 -1
  12. package/dist/components/data-explorer/index.js +166 -10
  13. package/dist/components/data-explorer/index.js.map +1 -1
  14. package/dist/components/data-explorer/index.mjs +167 -11
  15. package/dist/components/data-explorer/index.mjs.map +1 -1
  16. package/dist/components/layout/index.d.mts +1 -1
  17. package/dist/components/layout/index.d.ts +1 -1
  18. package/dist/components/layout/index.js +769 -1603
  19. package/dist/components/layout/index.js.map +1 -1
  20. package/dist/components/layout/index.mjs +772 -1607
  21. package/dist/components/layout/index.mjs.map +1 -1
  22. package/dist/components/login/index.d.mts +29 -29
  23. package/dist/components/login/index.d.ts +29 -29
  24. package/dist/components/toast/index.d.mts +2 -6
  25. package/dist/components/toast/index.d.ts +2 -6
  26. package/dist/components/toast/index.js +173 -11
  27. package/dist/components/toast/index.js.map +1 -1
  28. package/dist/components/toast/index.mjs +174 -12
  29. package/dist/components/toast/index.mjs.map +1 -1
  30. package/dist/components/toolbar/index.js +231 -21
  31. package/dist/components/toolbar/index.js.map +1 -1
  32. package/dist/components/toolbar/index.mjs +231 -21
  33. package/dist/components/toolbar/index.mjs.map +1 -1
  34. package/dist/components/workbench/index.d.mts +6 -6
  35. package/dist/components/workbench/index.d.ts +6 -6
  36. package/dist/components/workbench/index.js +2281 -1030
  37. package/dist/components/workbench/index.js.map +1 -1
  38. package/dist/components/workbench/index.mjs +2282 -1031
  39. package/dist/components/workbench/index.mjs.map +1 -1
  40. package/dist/icons/oauth/index.d.mts +5 -5
  41. package/dist/icons/oauth/index.d.ts +5 -5
  42. package/dist/index.d.mts +12 -8
  43. package/dist/index.d.ts +12 -8
  44. package/dist/index.js +7911 -4772
  45. package/dist/index.js.map +1 -1
  46. package/dist/index.mjs +7874 -4773
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/locale/index.d.mts +236 -0
  49. package/dist/locale/index.d.ts +236 -0
  50. package/dist/locale/index.js +338 -0
  51. package/dist/locale/index.js.map +1 -0
  52. package/dist/locale/index.mjs +332 -0
  53. package/dist/locale/index.mjs.map +1 -0
  54. package/dist/palette/index.js +259 -2748
  55. package/dist/palette/index.js.map +1 -1
  56. package/dist/palette/index.mjs +255 -2748
  57. package/dist/palette/index.mjs.map +1 -1
  58. package/dist/provider/index.d.mts +51 -0
  59. package/dist/provider/index.d.ts +51 -0
  60. package/dist/provider/index.js +2688 -0
  61. package/dist/provider/index.js.map +1 -0
  62. package/dist/provider/index.mjs +2677 -0
  63. package/dist/provider/index.mjs.map +1 -0
  64. package/dist/styles.css +1 -0
  65. package/dist/theme-CJlW1TtA.d.mts +142 -0
  66. package/dist/{theme-CUATVszl.d.mts → theme-CplaoMqT.d.mts} +2 -2
  67. package/dist/{theme-BuvXrHFY.d.ts → theme-DPVX8CfK.d.ts} +2 -2
  68. package/dist/theme-r7GYhlCk.d.ts +142 -0
  69. package/dist/theme-system/index.d.mts +5 -92
  70. package/dist/theme-system/index.d.ts +5 -92
  71. package/dist/theme-system/index.js +295 -4329
  72. package/dist/theme-system/index.js.map +1 -1
  73. package/dist/theme-system/index.mjs +183 -4221
  74. package/dist/theme-system/index.mjs.map +1 -1
  75. package/dist/themes/artist/index.d.mts +3 -3
  76. package/dist/themes/artist/index.d.ts +3 -3
  77. package/dist/themes/bsd/index.d.mts +3 -3
  78. package/dist/themes/bsd/index.d.ts +3 -3
  79. package/dist/themes/concept/index.d.mts +2 -2
  80. package/dist/themes/concept/index.d.ts +2 -2
  81. package/dist/themes/default/index.d.mts +3 -3
  82. package/dist/themes/default/index.d.ts +3 -3
  83. package/dist/types-BkWanMMW.d.mts +159 -0
  84. package/dist/types-BkWanMMW.d.ts +159 -0
  85. package/dist/types-DpRjPpxY.d.mts +93 -0
  86. package/dist/{types-CL6yBAmi.d.mts → types-DvHvN4RJ.d.mts} +514 -10
  87. package/dist/{types-CL6yBAmi.d.ts → types-DvHvN4RJ.d.ts} +514 -10
  88. package/dist/types-vkJZUngT.d.ts +93 -0
  89. package/package.json +52 -4
  90. package/dist/theme-CPXLKeLc.d.mts +0 -101
  91. package/dist/theme-Chdxsqt1.d.ts +0 -101
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
4
- var jsxRuntime = require('react/jsx-runtime');
5
- require('@radix-ui/react-context-menu');
6
- require('react-dom');
7
- require('@radix-ui/react-dropdown-menu');
8
- require('@dnd-kit/core');
9
- require('@dnd-kit/sortable');
10
- require('@dnd-kit/utilities');
3
+ var chroma2 = require('chroma-js');
4
+ var tailwindMerge = require('tailwind-merge');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var chroma2__default = /*#__PURE__*/_interopDefault(chroma2);
11
9
 
12
10
  var __create = Object.create;
13
11
  var __defProp = Object.defineProperty;
@@ -726,7 +724,7 @@ var require_lodash = __commonJS({
726
724
  }
727
725
  var runInContext = (function runInContext2(context) {
728
726
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
729
- var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
727
+ var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String = context.String, TypeError2 = context.TypeError;
730
728
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
731
729
  var coreJsData = context["__core-js_shared__"];
732
730
  var funcToString = funcProto.toString;
@@ -753,10 +751,10 @@ var require_lodash = __commonJS({
753
751
  })();
754
752
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
755
753
  var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
756
- var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
754
+ var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
757
755
  var metaMap = WeakMap && new WeakMap();
758
756
  var realNames = {};
759
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
757
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap);
760
758
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
761
759
  function lodash(value) {
762
760
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -1001,7 +999,7 @@ var require_lodash = __commonJS({
1001
999
  this.size = 0;
1002
1000
  this.__data__ = {
1003
1001
  "hash": new Hash(),
1004
- "map": new (Map2 || ListCache)(),
1002
+ "map": new (Map || ListCache)(),
1005
1003
  "string": new Hash()
1006
1004
  };
1007
1005
  }
@@ -1066,7 +1064,7 @@ var require_lodash = __commonJS({
1066
1064
  var data = this.__data__;
1067
1065
  if (data instanceof ListCache) {
1068
1066
  var pairs = data.__data__;
1069
- if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1067
+ if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
1070
1068
  pairs.push([key, value]);
1071
1069
  this.size = ++data.size;
1072
1070
  return this;
@@ -1083,7 +1081,7 @@ var require_lodash = __commonJS({
1083
1081
  Stack.prototype.has = stackHas;
1084
1082
  Stack.prototype.set = stackSet;
1085
1083
  function arrayLikeKeys(value, inherited) {
1086
- var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length;
1084
+ var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String) : [], length = result2.length;
1087
1085
  for (var key in value) {
1088
1086
  if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
1089
1087
  (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
@@ -2830,7 +2828,7 @@ var require_lodash = __commonJS({
2830
2828
  return result2;
2831
2829
  };
2832
2830
  var getTag = baseGetTag;
2833
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
2831
+ if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
2834
2832
  getTag = function(value) {
2835
2833
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
2836
2834
  if (ctorString) {
@@ -4184,7 +4182,7 @@ var require_lodash = __commonJS({
4184
4182
  customizer = typeof customizer == "function" ? customizer : undefined2;
4185
4183
  return baseIsMatch(object, source, getMatchData(source), customizer);
4186
4184
  }
4187
- function isNaN2(value) {
4185
+ function isNaN(value) {
4188
4186
  return isNumber(value) && value != +value;
4189
4187
  }
4190
4188
  function isNative(value) {
@@ -4257,8 +4255,8 @@ var require_lodash = __commonJS({
4257
4255
  }
4258
4256
  value = toNumber(value);
4259
4257
  if (value === INFINITY || value === -INFINITY) {
4260
- var sign3 = value < 0 ? -1 : 1;
4261
- return sign3 * MAX_INTEGER;
4258
+ var sign = value < 0 ? -1 : 1;
4259
+ return sign * MAX_INTEGER;
4262
4260
  }
4263
4261
  return value === value ? value : 0;
4264
4262
  }
@@ -4552,7 +4550,7 @@ var require_lodash = __commonJS({
4552
4550
  number = toNumber(number);
4553
4551
  return baseInRange(number, start, end);
4554
4552
  }
4555
- function random2(lower, upper, floating) {
4553
+ function random(lower, upper, floating) {
4556
4554
  if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
4557
4555
  upper = floating = undefined2;
4558
4556
  }
@@ -5012,8 +5010,8 @@ var require_lodash = __commonJS({
5012
5010
  var divide = createMathOperation(function(dividend, divisor) {
5013
5011
  return dividend / divisor;
5014
5012
  }, 1);
5015
- var floor5 = createRound("floor");
5016
- function max5(array) {
5013
+ var floor = createRound("floor");
5014
+ function max(array) {
5017
5015
  return array && array.length ? baseExtremum(array, identity, baseGt) : undefined2;
5018
5016
  }
5019
5017
  function maxBy(array, iteratee2) {
@@ -5025,16 +5023,16 @@ var require_lodash = __commonJS({
5025
5023
  function meanBy(array, iteratee2) {
5026
5024
  return baseMean(array, getIteratee(iteratee2, 2));
5027
5025
  }
5028
- function min5(array) {
5026
+ function min(array) {
5029
5027
  return array && array.length ? baseExtremum(array, identity, baseLt) : undefined2;
5030
5028
  }
5031
5029
  function minBy(array, iteratee2) {
5032
5030
  return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined2;
5033
5031
  }
5034
- var multiply2 = createMathOperation(function(multiplier, multiplicand) {
5032
+ var multiply = createMathOperation(function(multiplier, multiplicand) {
5035
5033
  return multiplier * multiplicand;
5036
5034
  }, 1);
5037
- var round8 = createRound("round");
5035
+ var round = createRound("round");
5038
5036
  var subtract = createMathOperation(function(minuend, subtrahend) {
5039
5037
  return minuend - subtrahend;
5040
5038
  }, 0);
@@ -5223,7 +5221,7 @@ var require_lodash = __commonJS({
5223
5221
  lodash.findLast = findLast;
5224
5222
  lodash.findLastIndex = findLastIndex;
5225
5223
  lodash.findLastKey = findLastKey;
5226
- lodash.floor = floor5;
5224
+ lodash.floor = floor;
5227
5225
  lodash.forEach = forEach;
5228
5226
  lodash.forEachRight = forEachRight;
5229
5227
  lodash.forIn = forIn;
@@ -5261,7 +5259,7 @@ var require_lodash = __commonJS({
5261
5259
  lodash.isMap = isMap;
5262
5260
  lodash.isMatch = isMatch;
5263
5261
  lodash.isMatchWith = isMatchWith;
5264
- lodash.isNaN = isNaN2;
5262
+ lodash.isNaN = isNaN;
5265
5263
  lodash.isNative = isNative;
5266
5264
  lodash.isNil = isNil;
5267
5265
  lodash.isNull = isNull;
@@ -5286,18 +5284,18 @@ var require_lodash = __commonJS({
5286
5284
  lodash.lowerFirst = lowerFirst;
5287
5285
  lodash.lt = lt;
5288
5286
  lodash.lte = lte;
5289
- lodash.max = max5;
5287
+ lodash.max = max;
5290
5288
  lodash.maxBy = maxBy;
5291
5289
  lodash.mean = mean;
5292
5290
  lodash.meanBy = meanBy;
5293
- lodash.min = min5;
5291
+ lodash.min = min;
5294
5292
  lodash.minBy = minBy;
5295
5293
  lodash.stubArray = stubArray;
5296
5294
  lodash.stubFalse = stubFalse;
5297
5295
  lodash.stubObject = stubObject;
5298
5296
  lodash.stubString = stubString;
5299
5297
  lodash.stubTrue = stubTrue;
5300
- lodash.multiply = multiply2;
5298
+ lodash.multiply = multiply;
5301
5299
  lodash.nth = nth;
5302
5300
  lodash.noConflict = noConflict;
5303
5301
  lodash.noop = noop;
@@ -5306,13 +5304,13 @@ var require_lodash = __commonJS({
5306
5304
  lodash.padEnd = padEnd;
5307
5305
  lodash.padStart = padStart;
5308
5306
  lodash.parseInt = parseInt2;
5309
- lodash.random = random2;
5307
+ lodash.random = random;
5310
5308
  lodash.reduce = reduce;
5311
5309
  lodash.reduceRight = reduceRight;
5312
5310
  lodash.repeat = repeat;
5313
5311
  lodash.replace = replace;
5314
5312
  lodash.result = result;
5315
- lodash.round = round8;
5313
+ lodash.round = round;
5316
5314
  lodash.runInContext = runInContext2;
5317
5315
  lodash.sample = sample;
5318
5316
  lodash.size = size;
@@ -5535,2671 +5533,173 @@ var require_lodash = __commonJS({
5535
5533
  }
5536
5534
  });
5537
5535
 
5538
- // node_modules/chroma-js/src/utils/limit.js
5539
- var limit_default = (x, low = 0, high = 1) => {
5540
- return min(max(low, x), high);
5541
- };
5542
-
5543
- // node_modules/chroma-js/src/utils/clip_rgb.js
5544
- var clip_rgb_default = (rgb2) => {
5545
- rgb2._clipped = false;
5546
- rgb2._unclipped = rgb2.slice(0);
5547
- for (let i = 0; i <= 3; i++) {
5548
- if (i < 3) {
5549
- if (rgb2[i] < 0 || rgb2[i] > 255) rgb2._clipped = true;
5550
- rgb2[i] = limit_default(rgb2[i], 0, 255);
5551
- } else if (i === 3) {
5552
- rgb2[i] = limit_default(rgb2[i], 0, 1);
5553
- }
5554
- }
5555
- return rgb2;
5556
- };
5557
-
5558
- // node_modules/chroma-js/src/utils/type.js
5559
- var classToType = {};
5560
- for (let name of [
5561
- "Boolean",
5562
- "Number",
5563
- "String",
5564
- "Function",
5565
- "Array",
5566
- "Date",
5567
- "RegExp",
5568
- "Undefined",
5569
- "Null"
5570
- ]) {
5571
- classToType[`[object ${name}]`] = name.toLowerCase();
5572
- }
5573
- function type_default(obj) {
5574
- return classToType[Object.prototype.toString.call(obj)] || "object";
5575
- }
5576
-
5577
- // node_modules/chroma-js/src/utils/unpack.js
5578
- var unpack_default = (args, keyOrder = null) => {
5579
- if (args.length >= 3) return Array.prototype.slice.call(args);
5580
- if (type_default(args[0]) == "object" && keyOrder) {
5581
- return keyOrder.split("").filter((k) => args[0][k] !== void 0).map((k) => args[0][k]);
5582
- }
5583
- return args[0];
5584
- };
5585
-
5586
- // node_modules/chroma-js/src/utils/last.js
5587
- var last_default = (args) => {
5588
- if (args.length < 2) return null;
5589
- const l = args.length - 1;
5590
- if (type_default(args[l]) == "string") return args[l].toLowerCase();
5591
- return null;
5592
- };
5593
-
5594
- // node_modules/chroma-js/src/utils/index.js
5595
- var { PI, min, max } = Math;
5596
- var TWOPI = PI * 2;
5597
- var PITHIRD = PI / 3;
5598
- var DEG2RAD = PI / 180;
5599
- var RAD2DEG = 180 / PI;
5600
-
5601
- // node_modules/chroma-js/src/io/input.js
5602
- var input_default = {
5603
- format: {},
5604
- autodetect: []
5536
+ // src/palette/use-palette.ts
5537
+ var import_lodash = __toESM(require_lodash());
5538
+ var delta = { xs: 0.01, sm: 0.02, md: 0.03, lg: 0.08, xl: 0.14 };
5539
+ var normalizeHue = (input, range) => (input % range + range) % range;
5540
+ var markDarkColor = (color) => {
5541
+ const hsv = chroma2__default.default(color).hsv();
5542
+ return chroma2__default.default(hsv[0], hsv[1] * 0.92, Math.min(hsv[2] + 0.01, 1), "hsv").hex();
5605
5543
  };
5606
-
5607
- // node_modules/chroma-js/src/Color.js
5608
- var Color = class {
5609
- constructor(...args) {
5610
- const me = this;
5611
- if (type_default(args[0]) === "object" && args[0].constructor && args[0].constructor === this.constructor) {
5612
- return args[0];
5613
- }
5614
- let mode = last_default(args);
5615
- let autodetect = false;
5616
- if (!mode) {
5617
- autodetect = true;
5618
- if (!input_default.sorted) {
5619
- input_default.autodetect = input_default.autodetect.sort((a, b) => b.p - a.p);
5620
- input_default.sorted = true;
5621
- }
5622
- for (let chk of input_default.autodetect) {
5623
- mode = chk.test(...args);
5624
- if (mode) break;
5625
- }
5626
- }
5627
- if (input_default.format[mode]) {
5628
- const rgb2 = input_default.format[mode].apply(
5629
- null,
5630
- autodetect ? args : args.slice(0, -1)
5631
- );
5632
- me._rgb = clip_rgb_default(rgb2);
5544
+ var calculateHue = (color, end, defaultValue) => {
5545
+ const interval = end - defaultValue;
5546
+ let offset;
5547
+ if (end <= defaultValue) {
5548
+ if (color[0] > 80 && color[0] < 260) {
5549
+ offset = interval * delta.xs;
5633
5550
  } else {
5634
- throw new Error("unknown format: " + args);
5635
- }
5636
- if (me._rgb.length === 3) me._rgb.push(1);
5637
- }
5638
- toString() {
5639
- if (type_default(this.hex) == "function") return this.hex();
5640
- return `[${this._rgb.join(",")}]`;
5641
- }
5642
- };
5643
- var Color_default = Color;
5644
-
5645
- // node_modules/chroma-js/src/version.js
5646
- var version = "2.6.0";
5647
-
5648
- // node_modules/chroma-js/src/chroma.js
5649
- var chroma = (...args) => {
5650
- return new chroma.Color(...args);
5651
- };
5652
- chroma.Color = Color_default;
5653
- chroma.version = version;
5654
- var chroma_default = chroma;
5655
-
5656
- // node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js
5657
- var cmyk2rgb = (...args) => {
5658
- args = unpack_default(args, "cmyk");
5659
- const [c, m, y, k] = args;
5660
- const alpha = args.length > 4 ? args[4] : 1;
5661
- if (k === 1) return [0, 0, 0, alpha];
5662
- return [
5663
- c >= 1 ? 0 : 255 * (1 - c) * (1 - k),
5664
- // r
5665
- m >= 1 ? 0 : 255 * (1 - m) * (1 - k),
5666
- // g
5667
- y >= 1 ? 0 : 255 * (1 - y) * (1 - k),
5668
- // b
5669
- alpha
5670
- ];
5671
- };
5672
- var cmyk2rgb_default = cmyk2rgb;
5673
-
5674
- // node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js
5675
- var { max: max2 } = Math;
5676
- var rgb2cmyk = (...args) => {
5677
- let [r, g, b] = unpack_default(args, "rgb");
5678
- r = r / 255;
5679
- g = g / 255;
5680
- b = b / 255;
5681
- const k = 1 - max2(r, max2(g, b));
5682
- const f = k < 1 ? 1 / (1 - k) : 0;
5683
- const c = (1 - r - k) * f;
5684
- const m = (1 - g - k) * f;
5685
- const y = (1 - b - k) * f;
5686
- return [c, m, y, k];
5687
- };
5688
- var rgb2cmyk_default = rgb2cmyk;
5689
-
5690
- // node_modules/chroma-js/src/io/cmyk/index.js
5691
- Color_default.prototype.cmyk = function() {
5692
- return rgb2cmyk_default(this._rgb);
5693
- };
5694
- chroma_default.cmyk = (...args) => new Color_default(...args, "cmyk");
5695
- input_default.format.cmyk = cmyk2rgb_default;
5696
- input_default.autodetect.push({
5697
- p: 2,
5698
- test: (...args) => {
5699
- args = unpack_default(args, "cmyk");
5700
- if (type_default(args) === "array" && args.length === 4) {
5701
- return "cmyk";
5551
+ offset = -interval * delta.sm;
5702
5552
  }
5703
- }
5704
- });
5705
-
5706
- // node_modules/chroma-js/src/io/css/hsl2css.js
5707
- var rnd = (a) => Math.round(a * 100) / 100;
5708
- var hsl2css = (...args) => {
5709
- const hsla = unpack_default(args, "hsla");
5710
- let mode = last_default(args) || "lsa";
5711
- hsla[0] = rnd(hsla[0] || 0);
5712
- hsla[1] = rnd(hsla[1] * 100) + "%";
5713
- hsla[2] = rnd(hsla[2] * 100) + "%";
5714
- if (mode === "hsla" || hsla.length > 3 && hsla[3] < 1) {
5715
- hsla[3] = hsla.length > 3 ? hsla[3] : 1;
5716
- mode = "hsla";
5717
- } else {
5718
- hsla.length = 3;
5719
- }
5720
- return `${mode}(${hsla.join(",")})`;
5721
- };
5722
- var hsl2css_default = hsl2css;
5723
-
5724
- // node_modules/chroma-js/src/io/hsl/rgb2hsl.js
5725
- var rgb2hsl = (...args) => {
5726
- args = unpack_default(args, "rgba");
5727
- let [r, g, b] = args;
5728
- r /= 255;
5729
- g /= 255;
5730
- b /= 255;
5731
- const minRgb = min(r, g, b);
5732
- const maxRgb = max(r, g, b);
5733
- const l = (maxRgb + minRgb) / 2;
5734
- let s, h;
5735
- if (maxRgb === minRgb) {
5736
- s = 0;
5737
- h = Number.NaN;
5738
- } else {
5739
- s = l < 0.5 ? (maxRgb - minRgb) / (maxRgb + minRgb) : (maxRgb - minRgb) / (2 - maxRgb - minRgb);
5740
- }
5741
- if (r == maxRgb) h = (g - b) / (maxRgb - minRgb);
5742
- else if (g == maxRgb) h = 2 + (b - r) / (maxRgb - minRgb);
5743
- else if (b == maxRgb) h = 4 + (r - g) / (maxRgb - minRgb);
5744
- h *= 60;
5745
- if (h < 0) h += 360;
5746
- if (args.length > 3 && args[3] !== void 0) return [h, s, l, args[3]];
5747
- return [h, s, l];
5748
- };
5749
- var rgb2hsl_default = rgb2hsl;
5750
-
5751
- // node_modules/chroma-js/src/io/css/rgb2css.js
5752
- var { round } = Math;
5753
- var rgb2css = (...args) => {
5754
- const rgba = unpack_default(args, "rgba");
5755
- let mode = last_default(args) || "rgb";
5756
- if (mode.substr(0, 3) == "hsl") {
5757
- return hsl2css_default(rgb2hsl_default(rgba), mode);
5758
- }
5759
- rgba[0] = round(rgba[0]);
5760
- rgba[1] = round(rgba[1]);
5761
- rgba[2] = round(rgba[2]);
5762
- if (mode === "rgba" || rgba.length > 3 && rgba[3] < 1) {
5763
- rgba[3] = rgba.length > 3 ? rgba[3] : 1;
5764
- mode = "rgba";
5765
- }
5766
- return `${mode}(${rgba.slice(0, mode === "rgb" ? 3 : 4).join(",")})`;
5767
- };
5768
- var rgb2css_default = rgb2css;
5769
-
5770
- // node_modules/chroma-js/src/io/hsl/hsl2rgb.js
5771
- var { round: round2 } = Math;
5772
- var hsl2rgb = (...args) => {
5773
- args = unpack_default(args, "hsl");
5774
- const [h, s, l] = args;
5775
- let r, g, b;
5776
- if (s === 0) {
5777
- r = g = b = l * 255;
5553
+ } else if (color[0] > 20 && color[0] < 48) {
5554
+ offset = -interval * delta.md;
5555
+ } else if (color[0] >= 48 && color[0] < 260) {
5556
+ offset = interval * delta.xs;
5778
5557
  } else {
5779
- const t3 = [0, 0, 0];
5780
- const c = [0, 0, 0];
5781
- const t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
5782
- const t1 = 2 * l - t2;
5783
- const h_ = h / 360;
5784
- t3[0] = h_ + 1 / 3;
5785
- t3[1] = h_;
5786
- t3[2] = h_ - 1 / 3;
5787
- for (let i = 0; i < 3; i++) {
5788
- if (t3[i] < 0) t3[i] += 1;
5789
- if (t3[i] > 1) t3[i] -= 1;
5790
- if (6 * t3[i] < 1) c[i] = t1 + (t2 - t1) * 6 * t3[i];
5791
- else if (2 * t3[i] < 1) c[i] = t2;
5792
- else if (3 * t3[i] < 2) c[i] = t1 + (t2 - t1) * (2 / 3 - t3[i]) * 6;
5793
- else c[i] = t1;
5794
- }
5795
- [r, g, b] = [round2(c[0] * 255), round2(c[1] * 255), round2(c[2] * 255)];
5796
- }
5797
- if (args.length > 3) {
5798
- return [r, g, b, args[3]];
5558
+ offset = -interval * delta.sm;
5799
5559
  }
5800
- return [r, g, b, 1];
5560
+ return normalizeHue(color[0] + offset, 360);
5801
5561
  };
5802
- var hsl2rgb_default = hsl2rgb;
5803
-
5804
- // node_modules/chroma-js/src/io/css/css2rgb.js
5805
- var RE_RGB = /^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/;
5806
- var RE_RGBA = /^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/;
5807
- var RE_RGB_PCT = /^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
5808
- var RE_RGBA_PCT = /^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
5809
- var RE_HSL = /^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
5810
- var RE_HSLA = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
5811
- var { round: round3 } = Math;
5812
- var css2rgb = (css) => {
5813
- css = css.toLowerCase().trim();
5814
- let m;
5815
- if (input_default.format.named) {
5816
- try {
5817
- return input_default.format.named(css);
5818
- } catch (e) {
5819
- }
5820
- }
5821
- if (m = css.match(RE_RGB)) {
5822
- const rgb2 = m.slice(1, 4);
5823
- for (let i = 0; i < 3; i++) {
5824
- rgb2[i] = +rgb2[i];
5825
- }
5826
- rgb2[3] = 1;
5827
- return rgb2;
5828
- }
5829
- if (m = css.match(RE_RGBA)) {
5830
- const rgb2 = m.slice(1, 5);
5831
- for (let i = 0; i < 4; i++) {
5832
- rgb2[i] = +rgb2[i];
5562
+ var calculateSaturation = (hsv, range, max) => {
5563
+ const interval = (range - max) / 100;
5564
+ let offset = 0;
5565
+ if (range < max) {
5566
+ offset = interval * hsv[1] / 5;
5567
+ if (range < 100) {
5568
+ offset -= delta.sm;
5833
5569
  }
5834
- return rgb2;
5835
- }
5836
- if (m = css.match(RE_RGB_PCT)) {
5837
- const rgb2 = m.slice(1, 4);
5838
- for (let i = 0; i < 3; i++) {
5839
- rgb2[i] = round3(rgb2[i] * 2.55);
5570
+ } else if (range > max) {
5571
+ if (hsv[0] < 30 || hsv[0] > 200) {
5572
+ offset = interval * delta.md;
5573
+ } else {
5574
+ offset = interval * delta.xs;
5840
5575
  }
5841
- rgb2[3] = 1;
5842
- return rgb2;
5843
- }
5844
- if (m = css.match(RE_RGBA_PCT)) {
5845
- const rgb2 = m.slice(1, 5);
5846
- for (let i = 0; i < 3; i++) {
5847
- rgb2[i] = round3(rgb2[i] * 2.55);
5576
+ if (hsv[1] === 0) {
5577
+ offset = 0;
5848
5578
  }
5849
- rgb2[3] = +rgb2[3];
5850
- return rgb2;
5851
- }
5852
- if (m = css.match(RE_HSL)) {
5853
- const hsl2 = m.slice(1, 4);
5854
- hsl2[1] *= 0.01;
5855
- hsl2[2] *= 0.01;
5856
- const rgb2 = hsl2rgb_default(hsl2);
5857
- rgb2[3] = 1;
5858
- return rgb2;
5859
5579
  }
5860
- if (m = css.match(RE_HSLA)) {
5861
- const hsl2 = m.slice(1, 4);
5862
- hsl2[1] *= 0.01;
5863
- hsl2[2] *= 0.01;
5864
- const rgb2 = hsl2rgb_default(hsl2);
5865
- rgb2[3] = +m[4];
5866
- return rgb2;
5867
- }
5868
- };
5869
- css2rgb.test = (s) => {
5870
- return RE_RGB.test(s) || RE_RGBA.test(s) || RE_RGB_PCT.test(s) || RE_RGBA_PCT.test(s) || RE_HSL.test(s) || RE_HSLA.test(s);
5871
- };
5872
- var css2rgb_default = css2rgb;
5873
-
5874
- // node_modules/chroma-js/src/io/css/index.js
5875
- Color_default.prototype.css = function(mode) {
5876
- return rgb2css_default(this._rgb, mode);
5580
+ const newSaturation = hsv[1] + offset;
5581
+ return newSaturation > 1 ? 1 : newSaturation < 0 ? 0 : newSaturation;
5877
5582
  };
5878
- chroma_default.css = (...args) => new Color_default(...args, "css");
5879
- input_default.format.css = css2rgb_default;
5880
- input_default.autodetect.push({
5881
- p: 5,
5882
- test: (h, ...rest) => {
5883
- if (!rest.length && type_default(h) === "string" && css2rgb_default.test(h)) {
5884
- return "css";
5583
+ var calculateLightness = (hsv, range, max) => {
5584
+ const interval = (range - max) / 100;
5585
+ let offset = 0;
5586
+ if (range < max) {
5587
+ if (hsv[1] < 0.1) {
5588
+ offset = interval * (1 - hsv[2]) / 5 * 1.06;
5589
+ } else {
5590
+ offset = interval * (1 - hsv[2]) / 5;
5885
5591
  }
5886
- }
5887
- });
5888
-
5889
- // node_modules/chroma-js/src/io/gl/index.js
5890
- input_default.format.gl = (...args) => {
5891
- const rgb2 = unpack_default(args, "rgba");
5892
- rgb2[0] *= 255;
5893
- rgb2[1] *= 255;
5894
- rgb2[2] *= 255;
5895
- return rgb2;
5896
- };
5897
- chroma_default.gl = (...args) => new Color_default(...args, "gl");
5898
- Color_default.prototype.gl = function() {
5899
- const rgb2 = this._rgb;
5900
- return [rgb2[0] / 255, rgb2[1] / 255, rgb2[2] / 255, rgb2[3]];
5901
- };
5902
-
5903
- // node_modules/chroma-js/src/io/hcg/hcg2rgb.js
5904
- var { floor } = Math;
5905
- var hcg2rgb = (...args) => {
5906
- args = unpack_default(args, "hcg");
5907
- let [h, c, _g] = args;
5908
- let r, g, b;
5909
- _g = _g * 255;
5910
- const _c = c * 255;
5911
- if (c === 0) {
5912
- r = g = b = _g;
5913
- } else {
5914
- if (h === 360) h = 0;
5915
- if (h > 360) h -= 360;
5916
- if (h < 0) h += 360;
5917
- h /= 60;
5918
- const i = floor(h);
5919
- const f = h - i;
5920
- const p = _g * (1 - c);
5921
- const q = p + _c * (1 - f);
5922
- const t = p + _c * f;
5923
- const v = p + _c;
5924
- switch (i) {
5925
- case 0:
5926
- [r, g, b] = [v, t, p];
5927
- break;
5928
- case 1:
5929
- [r, g, b] = [q, v, p];
5930
- break;
5931
- case 2:
5932
- [r, g, b] = [p, v, t];
5933
- break;
5934
- case 3:
5935
- [r, g, b] = [p, q, v];
5936
- break;
5937
- case 4:
5938
- [r, g, b] = [t, p, v];
5939
- break;
5940
- case 5:
5941
- [r, g, b] = [v, p, q];
5942
- break;
5592
+ } else if (range > max) {
5593
+ if ((hsv[0] < 30 || hsv[0] > 200) && hsv[0] > 0) {
5594
+ offset = interval * delta.lg;
5595
+ if (hsv[2] > 0.8) {
5596
+ offset = interval * delta.xl;
5597
+ }
5598
+ } else {
5599
+ offset = interval * hsv[2] / 6;
5943
5600
  }
5944
5601
  }
5945
- return [r, g, b, args.length > 3 ? args[3] : 1];
5602
+ const newLightness = hsv[2] - offset;
5603
+ return newLightness > 1 ? 1 : newLightness < 0 ? 0 : newLightness;
5946
5604
  };
5947
- var hcg2rgb_default = hcg2rgb;
5948
5605
 
5949
- // node_modules/chroma-js/src/io/hcg/rgb2hcg.js
5950
- var rgb2hcg = (...args) => {
5951
- const [r, g, b] = unpack_default(args, "rgb");
5952
- const minRgb = min(r, g, b);
5953
- const maxRgb = max(r, g, b);
5954
- const delta2 = maxRgb - minRgb;
5955
- const c = delta2 * 100 / 255;
5956
- const _g = minRgb / (255 - delta2) * 100;
5957
- let h;
5958
- if (delta2 === 0) {
5959
- h = Number.NaN;
5960
- } else {
5961
- if (r === maxRgb) h = (g - b) / delta2;
5962
- if (g === maxRgb) h = 2 + (b - r) / delta2;
5963
- if (b === maxRgb) h = 4 + (r - g) / delta2;
5964
- h *= 60;
5965
- if (h < 0) h += 360;
5606
+ // src/palette/use-palette.ts
5607
+ var COLOR_STOPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
5608
+ var createSolidColorScale = (color, mode = "light") => {
5609
+ const isDark = mode === "dark";
5610
+ let baseColor = isDark ? markDarkColor(color) : color;
5611
+ const luminance = chroma2__default.default(baseColor).luminance();
5612
+ if (luminance < 0.1) {
5613
+ baseColor = chroma2__default.default(baseColor).set("hsl.l", 0.4).hex();
5614
+ } else if (luminance > 0.9) {
5615
+ baseColor = chroma2__default.default(baseColor).set("hsl.l", 0.6).hex();
5966
5616
  }
5967
- return [h, c, _g];
5968
- };
5969
- var rgb2hcg_default = rgb2hcg;
5970
-
5971
- // node_modules/chroma-js/src/io/hcg/index.js
5972
- Color_default.prototype.hcg = function() {
5973
- return rgb2hcg_default(this._rgb);
5617
+ const hsv = chroma2__default.default(baseColor).hsv();
5618
+ const colors = COLOR_STOPS.map((stop) => {
5619
+ const h = calculateHue(hsv, stop, 500);
5620
+ const s = calculateSaturation(hsv, stop, 500);
5621
+ const v = calculateLightness(hsv, stop, 500);
5622
+ return chroma2__default.default(h, s, v, "hsv");
5623
+ });
5624
+ return isDark ? colors.reverse() : colors;
5974
5625
  };
5975
- chroma_default.hcg = (...args) => new Color_default(...args, "hcg");
5976
- input_default.format.hcg = hcg2rgb_default;
5977
- input_default.autodetect.push({
5978
- p: 1,
5979
- test: (...args) => {
5980
- args = unpack_default(args, "hcg");
5981
- if (type_default(args) === "array" && args.length === 3) {
5982
- return "hcg";
5983
- }
5984
- }
5985
- });
5986
-
5987
- // node_modules/chroma-js/src/io/hex/hex2rgb.js
5988
- var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
5989
- var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;
5990
- var hex2rgb = (hex) => {
5991
- if (hex.match(RE_HEX)) {
5992
- if (hex.length === 4 || hex.length === 7) {
5993
- hex = hex.substr(1);
5994
- }
5995
- if (hex.length === 3) {
5996
- hex = hex.split("");
5997
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
5998
- }
5999
- const u = parseInt(hex, 16);
6000
- const r = u >> 16;
6001
- const g = u >> 8 & 255;
6002
- const b = u & 255;
6003
- return [r, g, b, 1];
6004
- }
6005
- if (hex.match(RE_HEXA)) {
6006
- if (hex.length === 5 || hex.length === 9) {
6007
- hex = hex.substr(1);
6008
- }
6009
- if (hex.length === 4) {
6010
- hex = hex.split("");
6011
- hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
5626
+ var genTailwindTheme = (color) => {
5627
+ const lightColors = createSolidColorScale(color, "light");
5628
+ const darkColors = createSolidColorScale(color, "dark");
5629
+ const twColors = {};
5630
+ ["monkeys", "monkeys-dark"].forEach((name, i) => {
5631
+ const colors = {};
5632
+ if (!i) {
5633
+ lightColors.map(
5634
+ (it, stopIndex) => Object.assign(colors, {
5635
+ [COLOR_STOPS[stopIndex]]: it.rgb().join(" ")
5636
+ })
5637
+ );
5638
+ } else {
5639
+ darkColors.map(
5640
+ (it, stopIndex) => Object.assign(colors, {
5641
+ [COLOR_STOPS[stopIndex]]: it.rgb().join(" ")
5642
+ })
5643
+ );
6012
5644
  }
6013
- const u = parseInt(hex, 16);
6014
- const r = u >> 24 & 255;
6015
- const g = u >> 16 & 255;
6016
- const b = u >> 8 & 255;
6017
- const a = Math.round((u & 255) / 255 * 100) / 100;
6018
- return [r, g, b, a];
6019
- }
6020
- throw new Error(`unknown hex color: ${hex}`);
6021
- };
6022
- var hex2rgb_default = hex2rgb;
6023
-
6024
- // node_modules/chroma-js/src/io/hex/rgb2hex.js
6025
- var { round: round4 } = Math;
6026
- var rgb2hex = (...args) => {
6027
- let [r, g, b, a] = unpack_default(args, "rgba");
6028
- let mode = last_default(args) || "auto";
6029
- if (a === void 0) a = 1;
6030
- if (mode === "auto") {
6031
- mode = a < 1 ? "rgba" : "rgb";
6032
- }
6033
- r = round4(r);
6034
- g = round4(g);
6035
- b = round4(b);
6036
- const u = r << 16 | g << 8 | b;
6037
- let str = "000000" + u.toString(16);
6038
- str = str.substr(str.length - 6);
6039
- let hxa = "0" + round4(a * 255).toString(16);
6040
- hxa = hxa.substr(hxa.length - 2);
6041
- switch (mode.toLowerCase()) {
6042
- case "rgba":
6043
- return `#${str}${hxa}`;
6044
- case "argb":
6045
- return `#${hxa}${str}`;
6046
- default:
6047
- return `#${str}`;
6048
- }
6049
- };
6050
- var rgb2hex_default = rgb2hex;
6051
-
6052
- // node_modules/chroma-js/src/io/hex/index.js
6053
- Color_default.prototype.hex = function(mode) {
6054
- return rgb2hex_default(this._rgb, mode);
5645
+ Object.assign(twColors, { [name]: colors });
5646
+ });
5647
+ return twColors;
6055
5648
  };
6056
- chroma_default.hex = (...args) => new Color_default(...args, "hex");
6057
- input_default.format.hex = hex2rgb_default;
6058
- input_default.autodetect.push({
6059
- p: 4,
6060
- test: (h, ...rest) => {
6061
- if (!rest.length && type_default(h) === "string" && [3, 4, 5, 6, 7, 8, 9].indexOf(h.length) >= 0) {
6062
- return "hex";
6063
- }
6064
- }
6065
- });
6066
-
6067
- // node_modules/chroma-js/src/io/hsi/hsi2rgb.js
6068
- var { cos } = Math;
6069
- var hsi2rgb = (...args) => {
6070
- args = unpack_default(args, "hsi");
6071
- let [h, s, i] = args;
6072
- let r, g, b;
6073
- if (isNaN(h)) h = 0;
6074
- if (isNaN(s)) s = 0;
6075
- if (h > 360) h -= 360;
6076
- if (h < 0) h += 360;
6077
- h /= 360;
6078
- if (h < 1 / 3) {
6079
- b = (1 - s) / 3;
6080
- r = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
6081
- g = 1 - (b + r);
6082
- } else if (h < 2 / 3) {
6083
- h -= 1 / 3;
6084
- r = (1 - s) / 3;
6085
- g = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
6086
- b = 1 - (r + g);
5649
+ var setTailwindTheme = (0, import_lodash.debounce)((color) => {
5650
+ const twColors = genTailwindTheme(color);
5651
+ let styles = "";
5652
+ Object.entries(twColors).forEach(([colorName, colorValues]) => {
5653
+ styles += (colorName === "monkeys-dark" ? ".dark" : ":root,::selection") + "{";
5654
+ Object.entries(colorValues).forEach(([stop, color2]) => {
5655
+ styles += `--monkeys-${stop}:${color2};`;
5656
+ });
5657
+ styles += "}";
5658
+ });
5659
+ const themeDOM = document.getElementById("monkeys-theme");
5660
+ if (!themeDOM) {
5661
+ const newThemeDOM = document.createElement("style");
5662
+ newThemeDOM.id = "monkeys-theme";
5663
+ document.head.appendChild(newThemeDOM);
5664
+ newThemeDOM.innerHTML = styles;
6087
5665
  } else {
6088
- h -= 2 / 3;
6089
- g = (1 - s) / 3;
6090
- b = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
6091
- r = 1 - (g + b);
5666
+ themeDOM.innerHTML = styles;
6092
5667
  }
6093
- r = limit_default(i * r * 3);
6094
- g = limit_default(i * g * 3);
6095
- b = limit_default(i * b * 3);
6096
- return [r * 255, g * 255, b * 255, args.length > 3 ? args[3] : 1];
6097
- };
6098
- var hsi2rgb_default = hsi2rgb;
5668
+ }, 64);
6099
5669
 
6100
- // node_modules/chroma-js/src/io/hsi/rgb2hsi.js
6101
- var { min: min2, sqrt, acos } = Math;
6102
- var rgb2hsi = (...args) => {
6103
- let [r, g, b] = unpack_default(args, "rgb");
6104
- r /= 255;
6105
- g /= 255;
6106
- b /= 255;
6107
- let h;
6108
- const min_ = min2(r, g, b);
6109
- const i = (r + g + b) / 3;
6110
- const s = i > 0 ? 1 - min_ / i : 0;
6111
- if (s === 0) {
6112
- h = NaN;
5670
+ // src/palette/use-neocard-palette.ts
5671
+ var import_lodash2 = __toESM(require_lodash());
5672
+ var setNeocardTheme = (0, import_lodash2.debounce)((colors) => {
5673
+ let lightColor;
5674
+ let darkColor;
5675
+ if (typeof colors === "string") {
5676
+ lightColor = colors;
5677
+ darkColor = colors;
6113
5678
  } else {
6114
- h = (r - g + (r - b)) / 2;
6115
- h /= sqrt((r - g) * (r - g) + (r - b) * (g - b));
6116
- h = acos(h);
6117
- if (b > g) {
6118
- h = TWOPI - h;
6119
- }
6120
- h /= TWOPI;
6121
- }
6122
- return [h * 360, s, i];
6123
- };
6124
- var rgb2hsi_default = rgb2hsi;
6125
-
6126
- // node_modules/chroma-js/src/io/hsi/index.js
6127
- Color_default.prototype.hsi = function() {
6128
- return rgb2hsi_default(this._rgb);
6129
- };
6130
- chroma_default.hsi = (...args) => new Color_default(...args, "hsi");
6131
- input_default.format.hsi = hsi2rgb_default;
6132
- input_default.autodetect.push({
6133
- p: 2,
6134
- test: (...args) => {
6135
- args = unpack_default(args, "hsi");
6136
- if (type_default(args) === "array" && args.length === 3) {
6137
- return "hsi";
6138
- }
5679
+ lightColor = colors.light;
5680
+ darkColor = colors.dark;
6139
5681
  }
6140
- });
6141
-
6142
- // node_modules/chroma-js/src/io/hsl/index.js
6143
- Color_default.prototype.hsl = function() {
6144
- return rgb2hsl_default(this._rgb);
6145
- };
6146
- chroma_default.hsl = (...args) => new Color_default(...args, "hsl");
6147
- input_default.format.hsl = hsl2rgb_default;
6148
- input_default.autodetect.push({
6149
- p: 2,
6150
- test: (...args) => {
6151
- args = unpack_default(args, "hsl");
6152
- if (type_default(args) === "array" && args.length === 3) {
6153
- return "hsl";
5682
+ const styles = `
5683
+ :root {
5684
+ --neocard: ${lightColor};
6154
5685
  }
6155
- }
6156
- });
6157
-
6158
- // node_modules/chroma-js/src/io/hsv/hsv2rgb.js
6159
- var { floor: floor2 } = Math;
6160
- var hsv2rgb = (...args) => {
6161
- args = unpack_default(args, "hsv");
6162
- let [h, s, v] = args;
6163
- let r, g, b;
6164
- v *= 255;
6165
- if (s === 0) {
6166
- r = g = b = v;
6167
- } else {
6168
- if (h === 360) h = 0;
6169
- if (h > 360) h -= 360;
6170
- if (h < 0) h += 360;
6171
- h /= 60;
6172
- const i = floor2(h);
6173
- const f = h - i;
6174
- const p = v * (1 - s);
6175
- const q = v * (1 - s * f);
6176
- const t = v * (1 - s * (1 - f));
6177
- switch (i) {
6178
- case 0:
6179
- [r, g, b] = [v, t, p];
6180
- break;
6181
- case 1:
6182
- [r, g, b] = [q, v, p];
6183
- break;
6184
- case 2:
6185
- [r, g, b] = [p, v, t];
6186
- break;
6187
- case 3:
6188
- [r, g, b] = [p, q, v];
6189
- break;
6190
- case 4:
6191
- [r, g, b] = [t, p, v];
6192
- break;
6193
- case 5:
6194
- [r, g, b] = [v, p, q];
6195
- break;
5686
+ .dark {
5687
+ --neocard: ${darkColor};
6196
5688
  }
6197
- }
6198
- return [r, g, b, args.length > 3 ? args[3] : 1];
6199
- };
6200
- var hsv2rgb_default = hsv2rgb;
6201
-
6202
- // node_modules/chroma-js/src/io/hsv/rgb2hsv.js
6203
- var { min: min3, max: max3 } = Math;
6204
- var rgb2hsl2 = (...args) => {
6205
- args = unpack_default(args, "rgb");
6206
- let [r, g, b] = args;
6207
- const min_ = min3(r, g, b);
6208
- const max_ = max3(r, g, b);
6209
- const delta2 = max_ - min_;
6210
- let h, s, v;
6211
- v = max_ / 255;
6212
- if (max_ === 0) {
6213
- h = Number.NaN;
6214
- s = 0;
5689
+ `;
5690
+ const themeDOM = document.getElementById("monkeys-neocard-theme");
5691
+ if (!themeDOM) {
5692
+ const newThemeDOM = document.createElement("style");
5693
+ newThemeDOM.id = "monkeys-neocard-theme";
5694
+ document.head.appendChild(newThemeDOM);
5695
+ newThemeDOM.innerHTML = styles;
6215
5696
  } else {
6216
- s = delta2 / max_;
6217
- if (r === max_) h = (g - b) / delta2;
6218
- if (g === max_) h = 2 + (b - r) / delta2;
6219
- if (b === max_) h = 4 + (r - g) / delta2;
6220
- h *= 60;
6221
- if (h < 0) h += 360;
6222
- }
6223
- return [h, s, v];
6224
- };
6225
- var rgb2hsv_default = rgb2hsl2;
6226
-
6227
- // node_modules/chroma-js/src/io/hsv/index.js
6228
- Color_default.prototype.hsv = function() {
6229
- return rgb2hsv_default(this._rgb);
6230
- };
6231
- chroma_default.hsv = (...args) => new Color_default(...args, "hsv");
6232
- input_default.format.hsv = hsv2rgb_default;
6233
- input_default.autodetect.push({
6234
- p: 2,
6235
- test: (...args) => {
6236
- args = unpack_default(args, "hsv");
6237
- if (type_default(args) === "array" && args.length === 3) {
6238
- return "hsv";
6239
- }
6240
- }
6241
- });
6242
-
6243
- // node_modules/chroma-js/src/io/lab/lab-constants.js
6244
- var lab_constants_default = {
6245
- // Corresponds roughly to RGB brighter/darker
6246
- Kn: 18,
6247
- // D65 standard referent
6248
- Xn: 0.95047,
6249
- Yn: 1,
6250
- Zn: 1.08883,
6251
- t0: 0.137931034,
6252
- // 4 / 29
6253
- t1: 0.206896552,
6254
- // 6 / 29
6255
- t2: 0.12841855,
6256
- // 3 * t1 * t1
6257
- t3: 8856452e-9
6258
- // t1 * t1 * t1
6259
- };
6260
-
6261
- // node_modules/chroma-js/src/io/lab/lab2rgb.js
6262
- var { pow } = Math;
6263
- var lab2rgb = (...args) => {
6264
- args = unpack_default(args, "lab");
6265
- const [l, a, b] = args;
6266
- let x, y, z, r, g, b_;
6267
- y = (l + 16) / 116;
6268
- x = isNaN(a) ? y : y + a / 500;
6269
- z = isNaN(b) ? y : y - b / 200;
6270
- y = lab_constants_default.Yn * lab_xyz(y);
6271
- x = lab_constants_default.Xn * lab_xyz(x);
6272
- z = lab_constants_default.Zn * lab_xyz(z);
6273
- r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z);
6274
- g = xyz_rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z);
6275
- b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);
6276
- return [r, g, b_, args.length > 3 ? args[3] : 1];
6277
- };
6278
- var xyz_rgb = (r) => {
6279
- return 255 * (r <= 304e-5 ? 12.92 * r : 1.055 * pow(r, 1 / 2.4) - 0.055);
6280
- };
6281
- var lab_xyz = (t) => {
6282
- return t > lab_constants_default.t1 ? t * t * t : lab_constants_default.t2 * (t - lab_constants_default.t0);
6283
- };
6284
- var lab2rgb_default = lab2rgb;
6285
-
6286
- // node_modules/chroma-js/src/io/lab/rgb2lab.js
6287
- var { pow: pow2 } = Math;
6288
- var rgb2lab = (...args) => {
6289
- const [r, g, b] = unpack_default(args, "rgb");
6290
- const [x, y, z] = rgb2xyz(r, g, b);
6291
- const l = 116 * y - 16;
6292
- return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)];
6293
- };
6294
- var rgb_xyz = (r) => {
6295
- if ((r /= 255) <= 0.04045) return r / 12.92;
6296
- return pow2((r + 0.055) / 1.055, 2.4);
6297
- };
6298
- var xyz_lab = (t) => {
6299
- if (t > lab_constants_default.t3) return pow2(t, 1 / 3);
6300
- return t / lab_constants_default.t2 + lab_constants_default.t0;
6301
- };
6302
- var rgb2xyz = (r, g, b) => {
6303
- r = rgb_xyz(r);
6304
- g = rgb_xyz(g);
6305
- b = rgb_xyz(b);
6306
- const x = xyz_lab(
6307
- (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / lab_constants_default.Xn
6308
- );
6309
- const y = xyz_lab(
6310
- (0.2126729 * r + 0.7151522 * g + 0.072175 * b) / lab_constants_default.Yn
6311
- );
6312
- const z = xyz_lab(
6313
- (0.0193339 * r + 0.119192 * g + 0.9503041 * b) / lab_constants_default.Zn
6314
- );
6315
- return [x, y, z];
6316
- };
6317
- var rgb2lab_default = rgb2lab;
6318
-
6319
- // node_modules/chroma-js/src/io/lab/index.js
6320
- Color_default.prototype.lab = function() {
6321
- return rgb2lab_default(this._rgb);
6322
- };
6323
- chroma_default.lab = (...args) => new Color_default(...args, "lab");
6324
- input_default.format.lab = lab2rgb_default;
6325
- input_default.autodetect.push({
6326
- p: 2,
6327
- test: (...args) => {
6328
- args = unpack_default(args, "lab");
6329
- if (type_default(args) === "array" && args.length === 3) {
6330
- return "lab";
6331
- }
5697
+ themeDOM.innerHTML = styles;
6332
5698
  }
6333
- });
6334
-
6335
- // node_modules/chroma-js/src/io/lch/lch2lab.js
6336
- var { sin, cos: cos2 } = Math;
6337
- var lch2lab = (...args) => {
6338
- let [l, c, h] = unpack_default(args, "lch");
6339
- if (isNaN(h)) h = 0;
6340
- h = h * DEG2RAD;
6341
- return [l, cos2(h) * c, sin(h) * c];
6342
- };
6343
- var lch2lab_default = lch2lab;
6344
-
6345
- // node_modules/chroma-js/src/io/lch/lch2rgb.js
6346
- var lch2rgb = (...args) => {
6347
- args = unpack_default(args, "lch");
6348
- const [l, c, h] = args;
6349
- const [L, a, b_] = lch2lab_default(l, c, h);
6350
- const [r, g, b] = lab2rgb_default(L, a, b_);
6351
- return [r, g, b, args.length > 3 ? args[3] : 1];
6352
- };
6353
- var lch2rgb_default = lch2rgb;
6354
-
6355
- // node_modules/chroma-js/src/io/lch/hcl2rgb.js
6356
- var hcl2rgb = (...args) => {
6357
- const hcl = unpack_default(args, "hcl").reverse();
6358
- return lch2rgb_default(...hcl);
6359
- };
6360
- var hcl2rgb_default = hcl2rgb;
6361
-
6362
- // node_modules/chroma-js/src/io/lch/lab2lch.js
6363
- var { sqrt: sqrt2, atan2, round: round5 } = Math;
6364
- var lab2lch = (...args) => {
6365
- const [l, a, b] = unpack_default(args, "lab");
6366
- const c = sqrt2(a * a + b * b);
6367
- let h = (atan2(b, a) * RAD2DEG + 360) % 360;
6368
- if (round5(c * 1e4) === 0) h = Number.NaN;
6369
- return [l, c, h];
6370
- };
6371
- var lab2lch_default = lab2lch;
6372
-
6373
- // node_modules/chroma-js/src/io/lch/rgb2lch.js
6374
- var rgb2lch = (...args) => {
6375
- const [r, g, b] = unpack_default(args, "rgb");
6376
- const [l, a, b_] = rgb2lab_default(r, g, b);
6377
- return lab2lch_default(l, a, b_);
6378
- };
6379
- var rgb2lch_default = rgb2lch;
6380
-
6381
- // node_modules/chroma-js/src/io/lch/index.js
6382
- Color_default.prototype.lch = function() {
6383
- return rgb2lch_default(this._rgb);
6384
- };
6385
- Color_default.prototype.hcl = function() {
6386
- return rgb2lch_default(this._rgb).reverse();
6387
- };
6388
- chroma_default.lch = (...args) => new Color_default(...args, "lch");
6389
- chroma_default.hcl = (...args) => new Color_default(...args, "hcl");
6390
- input_default.format.lch = lch2rgb_default;
6391
- input_default.format.hcl = hcl2rgb_default;
6392
- ["lch", "hcl"].forEach(
6393
- (m) => input_default.autodetect.push({
6394
- p: 2,
6395
- test: (...args) => {
6396
- args = unpack_default(args, m);
6397
- if (type_default(args) === "array" && args.length === 3) {
6398
- return m;
6399
- }
6400
- }
6401
- })
6402
- );
6403
-
6404
- // node_modules/chroma-js/src/colors/w3cx11.js
6405
- var w3cx11 = {
6406
- aliceblue: "#f0f8ff",
6407
- antiquewhite: "#faebd7",
6408
- aqua: "#00ffff",
6409
- aquamarine: "#7fffd4",
6410
- azure: "#f0ffff",
6411
- beige: "#f5f5dc",
6412
- bisque: "#ffe4c4",
6413
- black: "#000000",
6414
- blanchedalmond: "#ffebcd",
6415
- blue: "#0000ff",
6416
- blueviolet: "#8a2be2",
6417
- brown: "#a52a2a",
6418
- burlywood: "#deb887",
6419
- cadetblue: "#5f9ea0",
6420
- chartreuse: "#7fff00",
6421
- chocolate: "#d2691e",
6422
- coral: "#ff7f50",
6423
- cornflowerblue: "#6495ed",
6424
- cornsilk: "#fff8dc",
6425
- crimson: "#dc143c",
6426
- cyan: "#00ffff",
6427
- darkblue: "#00008b",
6428
- darkcyan: "#008b8b",
6429
- darkgoldenrod: "#b8860b",
6430
- darkgray: "#a9a9a9",
6431
- darkgreen: "#006400",
6432
- darkgrey: "#a9a9a9",
6433
- darkkhaki: "#bdb76b",
6434
- darkmagenta: "#8b008b",
6435
- darkolivegreen: "#556b2f",
6436
- darkorange: "#ff8c00",
6437
- darkorchid: "#9932cc",
6438
- darkred: "#8b0000",
6439
- darksalmon: "#e9967a",
6440
- darkseagreen: "#8fbc8f",
6441
- darkslateblue: "#483d8b",
6442
- darkslategray: "#2f4f4f",
6443
- darkslategrey: "#2f4f4f",
6444
- darkturquoise: "#00ced1",
6445
- darkviolet: "#9400d3",
6446
- deeppink: "#ff1493",
6447
- deepskyblue: "#00bfff",
6448
- dimgray: "#696969",
6449
- dimgrey: "#696969",
6450
- dodgerblue: "#1e90ff",
6451
- firebrick: "#b22222",
6452
- floralwhite: "#fffaf0",
6453
- forestgreen: "#228b22",
6454
- fuchsia: "#ff00ff",
6455
- gainsboro: "#dcdcdc",
6456
- ghostwhite: "#f8f8ff",
6457
- gold: "#ffd700",
6458
- goldenrod: "#daa520",
6459
- gray: "#808080",
6460
- green: "#008000",
6461
- greenyellow: "#adff2f",
6462
- grey: "#808080",
6463
- honeydew: "#f0fff0",
6464
- hotpink: "#ff69b4",
6465
- indianred: "#cd5c5c",
6466
- indigo: "#4b0082",
6467
- ivory: "#fffff0",
6468
- khaki: "#f0e68c",
6469
- laserlemon: "#ffff54",
6470
- lavender: "#e6e6fa",
6471
- lavenderblush: "#fff0f5",
6472
- lawngreen: "#7cfc00",
6473
- lemonchiffon: "#fffacd",
6474
- lightblue: "#add8e6",
6475
- lightcoral: "#f08080",
6476
- lightcyan: "#e0ffff",
6477
- lightgoldenrod: "#fafad2",
6478
- lightgoldenrodyellow: "#fafad2",
6479
- lightgray: "#d3d3d3",
6480
- lightgreen: "#90ee90",
6481
- lightgrey: "#d3d3d3",
6482
- lightpink: "#ffb6c1",
6483
- lightsalmon: "#ffa07a",
6484
- lightseagreen: "#20b2aa",
6485
- lightskyblue: "#87cefa",
6486
- lightslategray: "#778899",
6487
- lightslategrey: "#778899",
6488
- lightsteelblue: "#b0c4de",
6489
- lightyellow: "#ffffe0",
6490
- lime: "#00ff00",
6491
- limegreen: "#32cd32",
6492
- linen: "#faf0e6",
6493
- magenta: "#ff00ff",
6494
- maroon: "#800000",
6495
- maroon2: "#7f0000",
6496
- maroon3: "#b03060",
6497
- mediumaquamarine: "#66cdaa",
6498
- mediumblue: "#0000cd",
6499
- mediumorchid: "#ba55d3",
6500
- mediumpurple: "#9370db",
6501
- mediumseagreen: "#3cb371",
6502
- mediumslateblue: "#7b68ee",
6503
- mediumspringgreen: "#00fa9a",
6504
- mediumturquoise: "#48d1cc",
6505
- mediumvioletred: "#c71585",
6506
- midnightblue: "#191970",
6507
- mintcream: "#f5fffa",
6508
- mistyrose: "#ffe4e1",
6509
- moccasin: "#ffe4b5",
6510
- navajowhite: "#ffdead",
6511
- navy: "#000080",
6512
- oldlace: "#fdf5e6",
6513
- olive: "#808000",
6514
- olivedrab: "#6b8e23",
6515
- orange: "#ffa500",
6516
- orangered: "#ff4500",
6517
- orchid: "#da70d6",
6518
- palegoldenrod: "#eee8aa",
6519
- palegreen: "#98fb98",
6520
- paleturquoise: "#afeeee",
6521
- palevioletred: "#db7093",
6522
- papayawhip: "#ffefd5",
6523
- peachpuff: "#ffdab9",
6524
- peru: "#cd853f",
6525
- pink: "#ffc0cb",
6526
- plum: "#dda0dd",
6527
- powderblue: "#b0e0e6",
6528
- purple: "#800080",
6529
- purple2: "#7f007f",
6530
- purple3: "#a020f0",
6531
- rebeccapurple: "#663399",
6532
- red: "#ff0000",
6533
- rosybrown: "#bc8f8f",
6534
- royalblue: "#4169e1",
6535
- saddlebrown: "#8b4513",
6536
- salmon: "#fa8072",
6537
- sandybrown: "#f4a460",
6538
- seagreen: "#2e8b57",
6539
- seashell: "#fff5ee",
6540
- sienna: "#a0522d",
6541
- silver: "#c0c0c0",
6542
- skyblue: "#87ceeb",
6543
- slateblue: "#6a5acd",
6544
- slategray: "#708090",
6545
- slategrey: "#708090",
6546
- snow: "#fffafa",
6547
- springgreen: "#00ff7f",
6548
- steelblue: "#4682b4",
6549
- tan: "#d2b48c",
6550
- teal: "#008080",
6551
- thistle: "#d8bfd8",
6552
- tomato: "#ff6347",
6553
- turquoise: "#40e0d0",
6554
- violet: "#ee82ee",
6555
- wheat: "#f5deb3",
6556
- white: "#ffffff",
6557
- whitesmoke: "#f5f5f5",
6558
- yellow: "#ffff00",
6559
- yellowgreen: "#9acd32"
6560
- };
6561
- var w3cx11_default = w3cx11;
6562
-
6563
- // node_modules/chroma-js/src/io/named/index.js
6564
- Color_default.prototype.name = function() {
6565
- const hex = rgb2hex_default(this._rgb, "rgb");
6566
- for (let n of Object.keys(w3cx11_default)) {
6567
- if (w3cx11_default[n] === hex) return n.toLowerCase();
6568
- }
6569
- return hex;
6570
- };
6571
- input_default.format.named = (name) => {
6572
- name = name.toLowerCase();
6573
- if (w3cx11_default[name]) return hex2rgb_default(w3cx11_default[name]);
6574
- throw new Error("unknown color name: " + name);
6575
- };
6576
- input_default.autodetect.push({
6577
- p: 5,
6578
- test: (h, ...rest) => {
6579
- if (!rest.length && type_default(h) === "string" && w3cx11_default[h.toLowerCase()]) {
6580
- return "named";
6581
- }
6582
- }
6583
- });
6584
-
6585
- // node_modules/chroma-js/src/io/num/num2rgb.js
6586
- var num2rgb = (num2) => {
6587
- if (type_default(num2) == "number" && num2 >= 0 && num2 <= 16777215) {
6588
- const r = num2 >> 16;
6589
- const g = num2 >> 8 & 255;
6590
- const b = num2 & 255;
6591
- return [r, g, b, 1];
6592
- }
6593
- throw new Error("unknown num color: " + num2);
6594
- };
6595
- var num2rgb_default = num2rgb;
6596
-
6597
- // node_modules/chroma-js/src/io/num/rgb2num.js
6598
- var rgb2num = (...args) => {
6599
- const [r, g, b] = unpack_default(args, "rgb");
6600
- return (r << 16) + (g << 8) + b;
6601
- };
6602
- var rgb2num_default = rgb2num;
6603
-
6604
- // node_modules/chroma-js/src/io/num/index.js
6605
- Color_default.prototype.num = function() {
6606
- return rgb2num_default(this._rgb);
6607
- };
6608
- chroma_default.num = (...args) => new Color_default(...args, "num");
6609
- input_default.format.num = num2rgb_default;
6610
- input_default.autodetect.push({
6611
- p: 5,
6612
- test: (...args) => {
6613
- if (args.length === 1 && type_default(args[0]) === "number" && args[0] >= 0 && args[0] <= 16777215) {
6614
- return "num";
6615
- }
6616
- }
6617
- });
6618
-
6619
- // node_modules/chroma-js/src/io/rgb/index.js
6620
- var { round: round6 } = Math;
6621
- Color_default.prototype.rgb = function(rnd2 = true) {
6622
- if (rnd2 === false) return this._rgb.slice(0, 3);
6623
- return this._rgb.slice(0, 3).map(round6);
6624
- };
6625
- Color_default.prototype.rgba = function(rnd2 = true) {
6626
- return this._rgb.slice(0, 4).map((v, i) => {
6627
- return i < 3 ? rnd2 === false ? v : round6(v) : v;
6628
- });
6629
- };
6630
- chroma_default.rgb = (...args) => new Color_default(...args, "rgb");
6631
- input_default.format.rgb = (...args) => {
6632
- const rgba = unpack_default(args, "rgba");
6633
- if (rgba[3] === void 0) rgba[3] = 1;
6634
- return rgba;
6635
- };
6636
- input_default.autodetect.push({
6637
- p: 3,
6638
- test: (...args) => {
6639
- args = unpack_default(args, "rgba");
6640
- if (type_default(args) === "array" && (args.length === 3 || args.length === 4 && type_default(args[3]) == "number" && args[3] >= 0 && args[3] <= 1)) {
6641
- return "rgb";
6642
- }
6643
- }
6644
- });
6645
-
6646
- // node_modules/chroma-js/src/io/temp/temperature2rgb.js
6647
- var { log } = Math;
6648
- var temperature2rgb = (kelvin) => {
6649
- const temp = kelvin / 100;
6650
- let r, g, b;
6651
- if (temp < 66) {
6652
- r = 255;
6653
- g = temp < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (g = temp - 2) + 104.49216199393888 * log(g);
6654
- b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp - 10) + 115.67994401066147 * log(b);
6655
- } else {
6656
- r = 351.97690566805693 + 0.114206453784165 * (r = temp - 55) - 40.25366309332127 * log(r);
6657
- g = 325.4494125711974 + 0.07943456536662342 * (g = temp - 50) - 28.0852963507957 * log(g);
6658
- b = 255;
6659
- }
6660
- return [r, g, b, 1];
6661
- };
6662
- var temperature2rgb_default = temperature2rgb;
6663
-
6664
- // node_modules/chroma-js/src/io/temp/rgb2temperature.js
6665
- var { round: round7 } = Math;
6666
- var rgb2temperature = (...args) => {
6667
- const rgb2 = unpack_default(args, "rgb");
6668
- const r = rgb2[0], b = rgb2[2];
6669
- let minTemp = 1e3;
6670
- let maxTemp = 4e4;
6671
- const eps = 0.4;
6672
- let temp;
6673
- while (maxTemp - minTemp > eps) {
6674
- temp = (maxTemp + minTemp) * 0.5;
6675
- const rgb3 = temperature2rgb_default(temp);
6676
- if (rgb3[2] / rgb3[0] >= b / r) {
6677
- maxTemp = temp;
6678
- } else {
6679
- minTemp = temp;
6680
- }
6681
- }
6682
- return round7(temp);
6683
- };
6684
- var rgb2temperature_default = rgb2temperature;
6685
-
6686
- // node_modules/chroma-js/src/io/temp/index.js
6687
- Color_default.prototype.temp = Color_default.prototype.kelvin = Color_default.prototype.temperature = function() {
6688
- return rgb2temperature_default(this._rgb);
6689
- };
6690
- chroma_default.temp = chroma_default.kelvin = chroma_default.temperature = (...args) => new Color_default(...args, "temp");
6691
- input_default.format.temp = input_default.format.kelvin = input_default.format.temperature = temperature2rgb_default;
6692
-
6693
- // node_modules/chroma-js/src/io/oklab/oklab2rgb.js
6694
- var { pow: pow3, sign } = Math;
6695
- var oklab2rgb = (...args) => {
6696
- args = unpack_default(args, "lab");
6697
- const [L, a, b] = args;
6698
- const l = pow3(L + 0.3963377774 * a + 0.2158037573 * b, 3);
6699
- const m = pow3(L - 0.1055613458 * a - 0.0638541728 * b, 3);
6700
- const s = pow3(L - 0.0894841775 * a - 1.291485548 * b, 3);
6701
- return [
6702
- 255 * lrgb2rgb(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
6703
- 255 * lrgb2rgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
6704
- 255 * lrgb2rgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
6705
- args.length > 3 ? args[3] : 1
6706
- ];
6707
- };
6708
- var oklab2rgb_default = oklab2rgb;
6709
- function lrgb2rgb(c) {
6710
- const abs3 = Math.abs(c);
6711
- if (abs3 > 31308e-7) {
6712
- return (sign(c) || 1) * (1.055 * pow3(abs3, 1 / 2.4) - 0.055);
6713
- }
6714
- return c * 12.92;
6715
- }
6716
-
6717
- // node_modules/chroma-js/src/io/oklab/rgb2oklab.js
6718
- var { cbrt, pow: pow4, sign: sign2 } = Math;
6719
- var rgb2oklab = (...args) => {
6720
- const [r, g, b] = unpack_default(args, "rgb");
6721
- const [lr, lg, lb] = [
6722
- rgb2lrgb(r / 255),
6723
- rgb2lrgb(g / 255),
6724
- rgb2lrgb(b / 255)
6725
- ];
6726
- const l = cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
6727
- const m = cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
6728
- const s = cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
6729
- return [
6730
- 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
6731
- 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
6732
- 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s
6733
- ];
6734
- };
6735
- var rgb2oklab_default = rgb2oklab;
6736
- function rgb2lrgb(c) {
6737
- const abs3 = Math.abs(c);
6738
- if (abs3 < 0.04045) {
6739
- return c / 12.92;
6740
- }
6741
- return (sign2(c) || 1) * pow4((abs3 + 0.055) / 1.055, 2.4);
6742
- }
6743
-
6744
- // node_modules/chroma-js/src/io/oklab/index.js
6745
- Color_default.prototype.oklab = function() {
6746
- return rgb2oklab_default(this._rgb);
6747
- };
6748
- chroma_default.oklab = (...args) => new Color_default(...args, "oklab");
6749
- input_default.format.oklab = oklab2rgb_default;
6750
- input_default.autodetect.push({
6751
- p: 3,
6752
- test: (...args) => {
6753
- args = unpack_default(args, "oklab");
6754
- if (type_default(args) === "array" && args.length === 3) {
6755
- return "oklab";
6756
- }
6757
- }
6758
- });
6759
-
6760
- // node_modules/chroma-js/src/io/oklch/oklch2rgb.js
6761
- var oklch2rgb = (...args) => {
6762
- args = unpack_default(args, "lch");
6763
- const [l, c, h] = args;
6764
- const [L, a, b_] = lch2lab_default(l, c, h);
6765
- const [r, g, b] = oklab2rgb_default(L, a, b_);
6766
- return [r, g, b, args.length > 3 ? args[3] : 1];
6767
- };
6768
- var oklch2rgb_default = oklch2rgb;
6769
-
6770
- // node_modules/chroma-js/src/io/oklch/rgb2oklch.js
6771
- var rgb2oklch = (...args) => {
6772
- const [r, g, b] = unpack_default(args, "rgb");
6773
- const [l, a, b_] = rgb2oklab_default(r, g, b);
6774
- return lab2lch_default(l, a, b_);
6775
- };
6776
- var rgb2oklch_default = rgb2oklch;
6777
-
6778
- // node_modules/chroma-js/src/io/oklch/index.js
6779
- Color_default.prototype.oklch = function() {
6780
- return rgb2oklch_default(this._rgb);
6781
- };
6782
- chroma_default.oklch = (...args) => new Color_default(...args, "oklch");
6783
- input_default.format.oklch = oklch2rgb_default;
6784
- input_default.autodetect.push({
6785
- p: 3,
6786
- test: (...args) => {
6787
- args = unpack_default(args, "oklch");
6788
- if (type_default(args) === "array" && args.length === 3) {
6789
- return "oklch";
6790
- }
6791
- }
6792
- });
6793
-
6794
- // node_modules/chroma-js/src/ops/alpha.js
6795
- Color_default.prototype.alpha = function(a, mutate = false) {
6796
- if (a !== void 0 && type_default(a) === "number") {
6797
- if (mutate) {
6798
- this._rgb[3] = a;
6799
- return this;
6800
- }
6801
- return new Color_default([this._rgb[0], this._rgb[1], this._rgb[2], a], "rgb");
6802
- }
6803
- return this._rgb[3];
6804
- };
6805
-
6806
- // node_modules/chroma-js/src/ops/clipped.js
6807
- Color_default.prototype.clipped = function() {
6808
- return this._rgb._clipped || false;
6809
- };
6810
-
6811
- // node_modules/chroma-js/src/ops/darken.js
6812
- Color_default.prototype.darken = function(amount = 1) {
6813
- const me = this;
6814
- const lab2 = me.lab();
6815
- lab2[0] -= lab_constants_default.Kn * amount;
6816
- return new Color_default(lab2, "lab").alpha(me.alpha(), true);
6817
- };
6818
- Color_default.prototype.brighten = function(amount = 1) {
6819
- return this.darken(-amount);
6820
- };
6821
- Color_default.prototype.darker = Color_default.prototype.darken;
6822
- Color_default.prototype.brighter = Color_default.prototype.brighten;
6823
-
6824
- // node_modules/chroma-js/src/ops/get.js
6825
- Color_default.prototype.get = function(mc) {
6826
- const [mode, channel] = mc.split(".");
6827
- const src = this[mode]();
6828
- if (channel) {
6829
- const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
6830
- if (i > -1) return src[i];
6831
- throw new Error(`unknown channel ${channel} in mode ${mode}`);
6832
- } else {
6833
- return src;
6834
- }
6835
- };
6836
-
6837
- // node_modules/chroma-js/src/ops/luminance.js
6838
- var { pow: pow5 } = Math;
6839
- var EPS = 1e-7;
6840
- var MAX_ITER = 20;
6841
- Color_default.prototype.luminance = function(lum, mode = "rgb") {
6842
- if (lum !== void 0 && type_default(lum) === "number") {
6843
- if (lum === 0) {
6844
- return new Color_default([0, 0, 0, this._rgb[3]], "rgb");
6845
- }
6846
- if (lum === 1) {
6847
- return new Color_default([255, 255, 255, this._rgb[3]], "rgb");
6848
- }
6849
- let cur_lum = this.luminance();
6850
- let max_iter = MAX_ITER;
6851
- const test = (low, high) => {
6852
- const mid = low.interpolate(high, 0.5, mode);
6853
- const lm = mid.luminance();
6854
- if (Math.abs(lum - lm) < EPS || !max_iter--) {
6855
- return mid;
6856
- }
6857
- return lm > lum ? test(low, mid) : test(mid, high);
6858
- };
6859
- const rgb2 = (cur_lum > lum ? test(new Color_default([0, 0, 0]), this) : test(this, new Color_default([255, 255, 255]))).rgb();
6860
- return new Color_default([...rgb2, this._rgb[3]]);
6861
- }
6862
- return rgb2luminance(...this._rgb.slice(0, 3));
6863
- };
6864
- var rgb2luminance = (r, g, b) => {
6865
- r = luminance_x(r);
6866
- g = luminance_x(g);
6867
- b = luminance_x(b);
6868
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
6869
- };
6870
- var luminance_x = (x) => {
6871
- x /= 255;
6872
- return x <= 0.03928 ? x / 12.92 : pow5((x + 0.055) / 1.055, 2.4);
6873
- };
6874
-
6875
- // node_modules/chroma-js/src/interpolator/index.js
6876
- var interpolator_default = {};
6877
-
6878
- // node_modules/chroma-js/src/generator/mix.js
6879
- var mix_default = (col1, col2, f = 0.5, ...rest) => {
6880
- let mode = rest[0] || "lrgb";
6881
- if (!interpolator_default[mode] && !rest.length) {
6882
- mode = Object.keys(interpolator_default)[0];
6883
- }
6884
- if (!interpolator_default[mode]) {
6885
- throw new Error(`interpolation mode ${mode} is not defined`);
6886
- }
6887
- if (type_default(col1) !== "object") col1 = new Color_default(col1);
6888
- if (type_default(col2) !== "object") col2 = new Color_default(col2);
6889
- return interpolator_default[mode](col1, col2, f).alpha(
6890
- col1.alpha() + f * (col2.alpha() - col1.alpha())
6891
- );
6892
- };
6893
-
6894
- // node_modules/chroma-js/src/ops/mix.js
6895
- Color_default.prototype.mix = Color_default.prototype.interpolate = function(col2, f = 0.5, ...rest) {
6896
- return mix_default(this, col2, f, ...rest);
6897
- };
6898
-
6899
- // node_modules/chroma-js/src/ops/premultiply.js
6900
- Color_default.prototype.premultiply = function(mutate = false) {
6901
- const rgb2 = this._rgb;
6902
- const a = rgb2[3];
6903
- if (mutate) {
6904
- this._rgb = [rgb2[0] * a, rgb2[1] * a, rgb2[2] * a, a];
6905
- return this;
6906
- } else {
6907
- return new Color_default([rgb2[0] * a, rgb2[1] * a, rgb2[2] * a, a], "rgb");
6908
- }
6909
- };
6910
-
6911
- // node_modules/chroma-js/src/ops/saturate.js
6912
- Color_default.prototype.saturate = function(amount = 1) {
6913
- const me = this;
6914
- const lch2 = me.lch();
6915
- lch2[1] += lab_constants_default.Kn * amount;
6916
- if (lch2[1] < 0) lch2[1] = 0;
6917
- return new Color_default(lch2, "lch").alpha(me.alpha(), true);
6918
- };
6919
- Color_default.prototype.desaturate = function(amount = 1) {
6920
- return this.saturate(-amount);
6921
- };
6922
-
6923
- // node_modules/chroma-js/src/ops/set.js
6924
- Color_default.prototype.set = function(mc, value, mutate = false) {
6925
- const [mode, channel] = mc.split(".");
6926
- const src = this[mode]();
6927
- if (channel) {
6928
- const i = mode.indexOf(channel) - (mode.substr(0, 2) === "ok" ? 2 : 0);
6929
- if (i > -1) {
6930
- if (type_default(value) == "string") {
6931
- switch (value.charAt(0)) {
6932
- case "+":
6933
- src[i] += +value;
6934
- break;
6935
- case "-":
6936
- src[i] += +value;
6937
- break;
6938
- case "*":
6939
- src[i] *= +value.substr(1);
6940
- break;
6941
- case "/":
6942
- src[i] /= +value.substr(1);
6943
- break;
6944
- default:
6945
- src[i] = +value;
6946
- }
6947
- } else if (type_default(value) === "number") {
6948
- src[i] = value;
6949
- } else {
6950
- throw new Error(`unsupported value for Color.set`);
6951
- }
6952
- const out = new Color_default(src, mode);
6953
- if (mutate) {
6954
- this._rgb = out._rgb;
6955
- return this;
6956
- }
6957
- return out;
6958
- }
6959
- throw new Error(`unknown channel ${channel} in mode ${mode}`);
6960
- } else {
6961
- return src;
6962
- }
6963
- };
6964
-
6965
- // node_modules/chroma-js/src/ops/shade.js
6966
- Color_default.prototype.tint = function(f = 0.5, ...rest) {
6967
- return mix_default(this, "white", f, ...rest);
6968
- };
6969
- Color_default.prototype.shade = function(f = 0.5, ...rest) {
6970
- return mix_default(this, "black", f, ...rest);
6971
- };
6972
-
6973
- // node_modules/chroma-js/src/interpolator/rgb.js
6974
- var rgb = (col1, col2, f) => {
6975
- const xyz0 = col1._rgb;
6976
- const xyz1 = col2._rgb;
6977
- return new Color_default(
6978
- xyz0[0] + f * (xyz1[0] - xyz0[0]),
6979
- xyz0[1] + f * (xyz1[1] - xyz0[1]),
6980
- xyz0[2] + f * (xyz1[2] - xyz0[2]),
6981
- "rgb"
6982
- );
6983
- };
6984
- interpolator_default.rgb = rgb;
6985
-
6986
- // node_modules/chroma-js/src/interpolator/lrgb.js
6987
- var { sqrt: sqrt3, pow: pow6 } = Math;
6988
- var lrgb = (col1, col2, f) => {
6989
- const [x1, y1, z1] = col1._rgb;
6990
- const [x2, y2, z2] = col2._rgb;
6991
- return new Color_default(
6992
- sqrt3(pow6(x1, 2) * (1 - f) + pow6(x2, 2) * f),
6993
- sqrt3(pow6(y1, 2) * (1 - f) + pow6(y2, 2) * f),
6994
- sqrt3(pow6(z1, 2) * (1 - f) + pow6(z2, 2) * f),
6995
- "rgb"
6996
- );
6997
- };
6998
- interpolator_default.lrgb = lrgb;
6999
-
7000
- // node_modules/chroma-js/src/interpolator/lab.js
7001
- var lab = (col1, col2, f) => {
7002
- const xyz0 = col1.lab();
7003
- const xyz1 = col2.lab();
7004
- return new Color_default(
7005
- xyz0[0] + f * (xyz1[0] - xyz0[0]),
7006
- xyz0[1] + f * (xyz1[1] - xyz0[1]),
7007
- xyz0[2] + f * (xyz1[2] - xyz0[2]),
7008
- "lab"
7009
- );
7010
- };
7011
- interpolator_default.lab = lab;
7012
-
7013
- // node_modules/chroma-js/src/interpolator/_hsx.js
7014
- var hsx_default = (col1, col2, f, m) => {
7015
- let xyz0, xyz1;
7016
- if (m === "hsl") {
7017
- xyz0 = col1.hsl();
7018
- xyz1 = col2.hsl();
7019
- } else if (m === "hsv") {
7020
- xyz0 = col1.hsv();
7021
- xyz1 = col2.hsv();
7022
- } else if (m === "hcg") {
7023
- xyz0 = col1.hcg();
7024
- xyz1 = col2.hcg();
7025
- } else if (m === "hsi") {
7026
- xyz0 = col1.hsi();
7027
- xyz1 = col2.hsi();
7028
- } else if (m === "lch" || m === "hcl") {
7029
- m = "hcl";
7030
- xyz0 = col1.hcl();
7031
- xyz1 = col2.hcl();
7032
- } else if (m === "oklch") {
7033
- xyz0 = col1.oklch().reverse();
7034
- xyz1 = col2.oklch().reverse();
7035
- }
7036
- let hue0, hue1, sat0, sat1, lbv0, lbv1;
7037
- if (m.substr(0, 1) === "h" || m === "oklch") {
7038
- [hue0, sat0, lbv0] = xyz0;
7039
- [hue1, sat1, lbv1] = xyz1;
7040
- }
7041
- let sat, hue, lbv, dh;
7042
- if (!isNaN(hue0) && !isNaN(hue1)) {
7043
- if (hue1 > hue0 && hue1 - hue0 > 180) {
7044
- dh = hue1 - (hue0 + 360);
7045
- } else if (hue1 < hue0 && hue0 - hue1 > 180) {
7046
- dh = hue1 + 360 - hue0;
7047
- } else {
7048
- dh = hue1 - hue0;
7049
- }
7050
- hue = hue0 + f * dh;
7051
- } else if (!isNaN(hue0)) {
7052
- hue = hue0;
7053
- if ((lbv1 == 1 || lbv1 == 0) && m != "hsv") sat = sat0;
7054
- } else if (!isNaN(hue1)) {
7055
- hue = hue1;
7056
- if ((lbv0 == 1 || lbv0 == 0) && m != "hsv") sat = sat1;
7057
- } else {
7058
- hue = Number.NaN;
7059
- }
7060
- if (sat === void 0) sat = sat0 + f * (sat1 - sat0);
7061
- lbv = lbv0 + f * (lbv1 - lbv0);
7062
- return m === "oklch" ? new Color_default([lbv, sat, hue], m) : new Color_default([hue, sat, lbv], m);
7063
- };
7064
-
7065
- // node_modules/chroma-js/src/interpolator/lch.js
7066
- var lch = (col1, col2, f) => {
7067
- return hsx_default(col1, col2, f, "lch");
7068
- };
7069
- interpolator_default.lch = lch;
7070
- interpolator_default.hcl = lch;
7071
-
7072
- // node_modules/chroma-js/src/interpolator/num.js
7073
- var num = (col1, col2, f) => {
7074
- const c1 = col1.num();
7075
- const c2 = col2.num();
7076
- return new Color_default(c1 + f * (c2 - c1), "num");
7077
- };
7078
- interpolator_default.num = num;
7079
-
7080
- // node_modules/chroma-js/src/interpolator/hcg.js
7081
- var hcg = (col1, col2, f) => {
7082
- return hsx_default(col1, col2, f, "hcg");
7083
- };
7084
- interpolator_default.hcg = hcg;
7085
-
7086
- // node_modules/chroma-js/src/interpolator/hsi.js
7087
- var hsi = (col1, col2, f) => {
7088
- return hsx_default(col1, col2, f, "hsi");
7089
- };
7090
- interpolator_default.hsi = hsi;
7091
-
7092
- // node_modules/chroma-js/src/interpolator/hsl.js
7093
- var hsl = (col1, col2, f) => {
7094
- return hsx_default(col1, col2, f, "hsl");
7095
- };
7096
- interpolator_default.hsl = hsl;
7097
-
7098
- // node_modules/chroma-js/src/interpolator/hsv.js
7099
- var hsv = (col1, col2, f) => {
7100
- return hsx_default(col1, col2, f, "hsv");
7101
- };
7102
- interpolator_default.hsv = hsv;
7103
-
7104
- // node_modules/chroma-js/src/interpolator/oklab.js
7105
- var oklab = (col1, col2, f) => {
7106
- const xyz0 = col1.oklab();
7107
- const xyz1 = col2.oklab();
7108
- return new Color_default(
7109
- xyz0[0] + f * (xyz1[0] - xyz0[0]),
7110
- xyz0[1] + f * (xyz1[1] - xyz0[1]),
7111
- xyz0[2] + f * (xyz1[2] - xyz0[2]),
7112
- "oklab"
7113
- );
7114
- };
7115
- interpolator_default.oklab = oklab;
7116
-
7117
- // node_modules/chroma-js/src/interpolator/oklch.js
7118
- var oklch = (col1, col2, f) => {
7119
- return hsx_default(col1, col2, f, "oklch");
7120
- };
7121
- interpolator_default.oklch = oklch;
7122
-
7123
- // node_modules/chroma-js/src/generator/average.js
7124
- var { pow: pow7, sqrt: sqrt4, PI: PI2, cos: cos3, sin: sin2, atan2: atan22 } = Math;
7125
- var average_default = (colors, mode = "lrgb", weights = null) => {
7126
- const l = colors.length;
7127
- if (!weights) weights = Array.from(new Array(l)).map(() => 1);
7128
- const k = l / weights.reduce(function(a, b) {
7129
- return a + b;
7130
- });
7131
- weights.forEach((w, i) => {
7132
- weights[i] *= k;
7133
- });
7134
- colors = colors.map((c) => new Color_default(c));
7135
- if (mode === "lrgb") {
7136
- return _average_lrgb(colors, weights);
7137
- }
7138
- const first = colors.shift();
7139
- const xyz = first.get(mode);
7140
- const cnt = [];
7141
- let dx = 0;
7142
- let dy = 0;
7143
- for (let i = 0; i < xyz.length; i++) {
7144
- xyz[i] = (xyz[i] || 0) * weights[0];
7145
- cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);
7146
- if (mode.charAt(i) === "h" && !isNaN(xyz[i])) {
7147
- const A = xyz[i] / 180 * PI2;
7148
- dx += cos3(A) * weights[0];
7149
- dy += sin2(A) * weights[0];
7150
- }
7151
- }
7152
- let alpha = first.alpha() * weights[0];
7153
- colors.forEach((c, ci) => {
7154
- const xyz2 = c.get(mode);
7155
- alpha += c.alpha() * weights[ci + 1];
7156
- for (let i = 0; i < xyz.length; i++) {
7157
- if (!isNaN(xyz2[i])) {
7158
- cnt[i] += weights[ci + 1];
7159
- if (mode.charAt(i) === "h") {
7160
- const A = xyz2[i] / 180 * PI2;
7161
- dx += cos3(A) * weights[ci + 1];
7162
- dy += sin2(A) * weights[ci + 1];
7163
- } else {
7164
- xyz[i] += xyz2[i] * weights[ci + 1];
7165
- }
7166
- }
7167
- }
7168
- });
7169
- for (let i = 0; i < xyz.length; i++) {
7170
- if (mode.charAt(i) === "h") {
7171
- let A = atan22(dy / cnt[i], dx / cnt[i]) / PI2 * 180;
7172
- while (A < 0) A += 360;
7173
- while (A >= 360) A -= 360;
7174
- xyz[i] = A;
7175
- } else {
7176
- xyz[i] = xyz[i] / cnt[i];
7177
- }
7178
- }
7179
- alpha /= l;
7180
- return new Color_default(xyz, mode).alpha(alpha > 0.99999 ? 1 : alpha, true);
7181
- };
7182
- var _average_lrgb = (colors, weights) => {
7183
- const l = colors.length;
7184
- const xyz = [0, 0, 0, 0];
7185
- for (let i = 0; i < colors.length; i++) {
7186
- const col = colors[i];
7187
- const f = weights[i] / l;
7188
- const rgb2 = col._rgb;
7189
- xyz[0] += pow7(rgb2[0], 2) * f;
7190
- xyz[1] += pow7(rgb2[1], 2) * f;
7191
- xyz[2] += pow7(rgb2[2], 2) * f;
7192
- xyz[3] += rgb2[3] * f;
7193
- }
7194
- xyz[0] = sqrt4(xyz[0]);
7195
- xyz[1] = sqrt4(xyz[1]);
7196
- xyz[2] = sqrt4(xyz[2]);
7197
- if (xyz[3] > 0.9999999) xyz[3] = 1;
7198
- return new Color_default(clip_rgb_default(xyz));
7199
- };
7200
-
7201
- // node_modules/chroma-js/src/generator/scale.js
7202
- var { pow: pow8 } = Math;
7203
- function scale_default(colors) {
7204
- let _mode = "rgb";
7205
- let _nacol = chroma_default("#ccc");
7206
- let _spread = 0;
7207
- let _domain = [0, 1];
7208
- let _pos = [];
7209
- let _padding = [0, 0];
7210
- let _classes = false;
7211
- let _colors = [];
7212
- let _out = false;
7213
- let _min = 0;
7214
- let _max = 1;
7215
- let _correctLightness = false;
7216
- let _colorCache = {};
7217
- let _useCache = true;
7218
- let _gamma = 1;
7219
- const setColors = function(colors2) {
7220
- colors2 = colors2 || ["#fff", "#000"];
7221
- if (colors2 && type_default(colors2) === "string" && chroma_default.brewer && chroma_default.brewer[colors2.toLowerCase()]) {
7222
- colors2 = chroma_default.brewer[colors2.toLowerCase()];
7223
- }
7224
- if (type_default(colors2) === "array") {
7225
- if (colors2.length === 1) {
7226
- colors2 = [colors2[0], colors2[0]];
7227
- }
7228
- colors2 = colors2.slice(0);
7229
- for (let c = 0; c < colors2.length; c++) {
7230
- colors2[c] = chroma_default(colors2[c]);
7231
- }
7232
- _pos.length = 0;
7233
- for (let c = 0; c < colors2.length; c++) {
7234
- _pos.push(c / (colors2.length - 1));
7235
- }
7236
- }
7237
- resetCache();
7238
- return _colors = colors2;
7239
- };
7240
- const getClass = function(value) {
7241
- if (_classes != null) {
7242
- const n = _classes.length - 1;
7243
- let i = 0;
7244
- while (i < n && value >= _classes[i]) {
7245
- i++;
7246
- }
7247
- return i - 1;
7248
- }
7249
- return 0;
7250
- };
7251
- let tMapLightness = (t) => t;
7252
- let tMapDomain = (t) => t;
7253
- const getColor = function(val, bypassMap) {
7254
- let col, t;
7255
- if (bypassMap == null) {
7256
- bypassMap = false;
7257
- }
7258
- if (isNaN(val) || val === null) {
7259
- return _nacol;
7260
- }
7261
- if (!bypassMap) {
7262
- if (_classes && _classes.length > 2) {
7263
- const c = getClass(val);
7264
- t = c / (_classes.length - 2);
7265
- } else if (_max !== _min) {
7266
- t = (val - _min) / (_max - _min);
7267
- } else {
7268
- t = 1;
7269
- }
7270
- } else {
7271
- t = val;
7272
- }
7273
- t = tMapDomain(t);
7274
- if (!bypassMap) {
7275
- t = tMapLightness(t);
7276
- }
7277
- if (_gamma !== 1) {
7278
- t = pow8(t, _gamma);
7279
- }
7280
- t = _padding[0] + t * (1 - _padding[0] - _padding[1]);
7281
- t = limit_default(t, 0, 1);
7282
- const k = Math.floor(t * 1e4);
7283
- if (_useCache && _colorCache[k]) {
7284
- col = _colorCache[k];
7285
- } else {
7286
- if (type_default(_colors) === "array") {
7287
- for (let i = 0; i < _pos.length; i++) {
7288
- const p = _pos[i];
7289
- if (t <= p) {
7290
- col = _colors[i];
7291
- break;
7292
- }
7293
- if (t >= p && i === _pos.length - 1) {
7294
- col = _colors[i];
7295
- break;
7296
- }
7297
- if (t > p && t < _pos[i + 1]) {
7298
- t = (t - p) / (_pos[i + 1] - p);
7299
- col = chroma_default.interpolate(
7300
- _colors[i],
7301
- _colors[i + 1],
7302
- t,
7303
- _mode
7304
- );
7305
- break;
7306
- }
7307
- }
7308
- } else if (type_default(_colors) === "function") {
7309
- col = _colors(t);
7310
- }
7311
- if (_useCache) {
7312
- _colorCache[k] = col;
7313
- }
7314
- }
7315
- return col;
7316
- };
7317
- var resetCache = () => _colorCache = {};
7318
- setColors(colors);
7319
- const f = function(v) {
7320
- const c = chroma_default(getColor(v));
7321
- if (_out && c[_out]) {
7322
- return c[_out]();
7323
- } else {
7324
- return c;
7325
- }
7326
- };
7327
- f.classes = function(classes) {
7328
- if (classes != null) {
7329
- if (type_default(classes) === "array") {
7330
- _classes = classes;
7331
- _domain = [classes[0], classes[classes.length - 1]];
7332
- } else {
7333
- const d = chroma_default.analyze(_domain);
7334
- if (classes === 0) {
7335
- _classes = [d.min, d.max];
7336
- } else {
7337
- _classes = chroma_default.limits(d, "e", classes);
7338
- }
7339
- }
7340
- return f;
7341
- }
7342
- return _classes;
7343
- };
7344
- f.domain = function(domain) {
7345
- if (!arguments.length) {
7346
- return _domain;
7347
- }
7348
- _min = domain[0];
7349
- _max = domain[domain.length - 1];
7350
- _pos = [];
7351
- const k = _colors.length;
7352
- if (domain.length === k && _min !== _max) {
7353
- for (let d of Array.from(domain)) {
7354
- _pos.push((d - _min) / (_max - _min));
7355
- }
7356
- } else {
7357
- for (let c = 0; c < k; c++) {
7358
- _pos.push(c / (k - 1));
7359
- }
7360
- if (domain.length > 2) {
7361
- const tOut = domain.map((d, i) => i / (domain.length - 1));
7362
- const tBreaks = domain.map((d) => (d - _min) / (_max - _min));
7363
- if (!tBreaks.every((val, i) => tOut[i] === val)) {
7364
- tMapDomain = (t) => {
7365
- if (t <= 0 || t >= 1) return t;
7366
- let i = 0;
7367
- while (t >= tBreaks[i + 1]) i++;
7368
- const f2 = (t - tBreaks[i]) / (tBreaks[i + 1] - tBreaks[i]);
7369
- const out = tOut[i] + f2 * (tOut[i + 1] - tOut[i]);
7370
- return out;
7371
- };
7372
- }
7373
- }
7374
- }
7375
- _domain = [_min, _max];
7376
- return f;
7377
- };
7378
- f.mode = function(_m) {
7379
- if (!arguments.length) {
7380
- return _mode;
7381
- }
7382
- _mode = _m;
7383
- resetCache();
7384
- return f;
7385
- };
7386
- f.range = function(colors2, _pos2) {
7387
- setColors(colors2);
7388
- return f;
7389
- };
7390
- f.out = function(_o) {
7391
- _out = _o;
7392
- return f;
7393
- };
7394
- f.spread = function(val) {
7395
- if (!arguments.length) {
7396
- return _spread;
7397
- }
7398
- _spread = val;
7399
- return f;
7400
- };
7401
- f.correctLightness = function(v) {
7402
- if (v == null) {
7403
- v = true;
7404
- }
7405
- _correctLightness = v;
7406
- resetCache();
7407
- if (_correctLightness) {
7408
- tMapLightness = function(t) {
7409
- const L0 = getColor(0, true).lab()[0];
7410
- const L1 = getColor(1, true).lab()[0];
7411
- const pol = L0 > L1;
7412
- let L_actual = getColor(t, true).lab()[0];
7413
- const L_ideal = L0 + (L1 - L0) * t;
7414
- let L_diff = L_actual - L_ideal;
7415
- let t0 = 0;
7416
- let t1 = 1;
7417
- let max_iter = 20;
7418
- while (Math.abs(L_diff) > 0.01 && max_iter-- > 0) {
7419
- (function() {
7420
- if (pol) {
7421
- L_diff *= -1;
7422
- }
7423
- if (L_diff < 0) {
7424
- t0 = t;
7425
- t += (t1 - t) * 0.5;
7426
- } else {
7427
- t1 = t;
7428
- t += (t0 - t) * 0.5;
7429
- }
7430
- L_actual = getColor(t, true).lab()[0];
7431
- return L_diff = L_actual - L_ideal;
7432
- })();
7433
- }
7434
- return t;
7435
- };
7436
- } else {
7437
- tMapLightness = (t) => t;
7438
- }
7439
- return f;
7440
- };
7441
- f.padding = function(p) {
7442
- if (p != null) {
7443
- if (type_default(p) === "number") {
7444
- p = [p, p];
7445
- }
7446
- _padding = p;
7447
- return f;
7448
- } else {
7449
- return _padding;
7450
- }
7451
- };
7452
- f.colors = function(numColors, out) {
7453
- if (arguments.length < 2) {
7454
- out = "hex";
7455
- }
7456
- let result = [];
7457
- if (arguments.length === 0) {
7458
- result = _colors.slice(0);
7459
- } else if (numColors === 1) {
7460
- result = [f(0.5)];
7461
- } else if (numColors > 1) {
7462
- const dm = _domain[0];
7463
- const dd = _domain[1] - dm;
7464
- result = __range__(0, numColors).map(
7465
- (i) => f(dm + i / (numColors - 1) * dd)
7466
- );
7467
- } else {
7468
- colors = [];
7469
- let samples = [];
7470
- if (_classes && _classes.length > 2) {
7471
- for (let i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
7472
- samples.push((_classes[i - 1] + _classes[i]) * 0.5);
7473
- }
7474
- } else {
7475
- samples = _domain;
7476
- }
7477
- result = samples.map((v) => f(v));
7478
- }
7479
- if (chroma_default[out]) {
7480
- result = result.map((c) => c[out]());
7481
- }
7482
- return result;
7483
- };
7484
- f.cache = function(c) {
7485
- if (c != null) {
7486
- _useCache = c;
7487
- return f;
7488
- } else {
7489
- return _useCache;
7490
- }
7491
- };
7492
- f.gamma = function(g) {
7493
- if (g != null) {
7494
- _gamma = g;
7495
- return f;
7496
- } else {
7497
- return _gamma;
7498
- }
7499
- };
7500
- f.nodata = function(d) {
7501
- if (d != null) {
7502
- _nacol = chroma_default(d);
7503
- return f;
7504
- } else {
7505
- return _nacol;
7506
- }
7507
- };
7508
- return f;
7509
- }
7510
- function __range__(left, right, inclusive) {
7511
- let range = [];
7512
- let ascending = left < right;
7513
- let end = right ;
7514
- for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
7515
- range.push(i);
7516
- }
7517
- return range;
7518
- }
7519
-
7520
- // node_modules/chroma-js/src/generator/bezier.js
7521
- var binom_row = function(n) {
7522
- let row = [1, 1];
7523
- for (let i = 1; i < n; i++) {
7524
- let newrow = [1];
7525
- for (let j = 1; j <= row.length; j++) {
7526
- newrow[j] = (row[j] || 0) + row[j - 1];
7527
- }
7528
- row = newrow;
7529
- }
7530
- return row;
7531
- };
7532
- var bezier = function(colors) {
7533
- let I, lab0, lab1, lab2;
7534
- colors = colors.map((c) => new Color_default(c));
7535
- if (colors.length === 2) {
7536
- [lab0, lab1] = colors.map((c) => c.lab());
7537
- I = function(t) {
7538
- const lab3 = [0, 1, 2].map((i) => lab0[i] + t * (lab1[i] - lab0[i]));
7539
- return new Color_default(lab3, "lab");
7540
- };
7541
- } else if (colors.length === 3) {
7542
- [lab0, lab1, lab2] = colors.map((c) => c.lab());
7543
- I = function(t) {
7544
- const lab3 = [0, 1, 2].map(
7545
- (i) => (1 - t) * (1 - t) * lab0[i] + 2 * (1 - t) * t * lab1[i] + t * t * lab2[i]
7546
- );
7547
- return new Color_default(lab3, "lab");
7548
- };
7549
- } else if (colors.length === 4) {
7550
- let lab3;
7551
- [lab0, lab1, lab2, lab3] = colors.map((c) => c.lab());
7552
- I = function(t) {
7553
- const lab4 = [0, 1, 2].map(
7554
- (i) => (1 - t) * (1 - t) * (1 - t) * lab0[i] + 3 * (1 - t) * (1 - t) * t * lab1[i] + 3 * (1 - t) * t * t * lab2[i] + t * t * t * lab3[i]
7555
- );
7556
- return new Color_default(lab4, "lab");
7557
- };
7558
- } else if (colors.length >= 5) {
7559
- let labs, row, n;
7560
- labs = colors.map((c) => c.lab());
7561
- n = colors.length - 1;
7562
- row = binom_row(n);
7563
- I = function(t) {
7564
- const u = 1 - t;
7565
- const lab3 = [0, 1, 2].map(
7566
- (i) => labs.reduce(
7567
- (sum, el, j) => sum + row[j] * u ** (n - j) * t ** j * el[i],
7568
- 0
7569
- )
7570
- );
7571
- return new Color_default(lab3, "lab");
7572
- };
7573
- } else {
7574
- throw new RangeError("No point in running bezier with only one color.");
7575
- }
7576
- return I;
7577
- };
7578
- var bezier_default = (colors) => {
7579
- const f = bezier(colors);
7580
- f.scale = () => scale_default(f);
7581
- return f;
7582
- };
7583
-
7584
- // node_modules/chroma-js/src/generator/blend.js
7585
- var blend = (bottom, top, mode) => {
7586
- if (!blend[mode]) {
7587
- throw new Error("unknown blend mode " + mode);
7588
- }
7589
- return blend[mode](bottom, top);
7590
- };
7591
- var blend_f = (f) => (bottom, top) => {
7592
- const c0 = chroma_default(top).rgb();
7593
- const c1 = chroma_default(bottom).rgb();
7594
- return chroma_default.rgb(f(c0, c1));
7595
- };
7596
- var each = (f) => (c0, c1) => {
7597
- const out = [];
7598
- out[0] = f(c0[0], c1[0]);
7599
- out[1] = f(c0[1], c1[1]);
7600
- out[2] = f(c0[2], c1[2]);
7601
- return out;
7602
- };
7603
- var normal = (a) => a;
7604
- var multiply = (a, b) => a * b / 255;
7605
- var darken = (a, b) => a > b ? b : a;
7606
- var lighten = (a, b) => a > b ? a : b;
7607
- var screen = (a, b) => 255 * (1 - (1 - a / 255) * (1 - b / 255));
7608
- var overlay = (a, b) => b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255) * (1 - b / 255));
7609
- var burn = (a, b) => 255 * (1 - (1 - b / 255) / (a / 255));
7610
- var dodge = (a, b) => {
7611
- if (a === 255) return 255;
7612
- a = 255 * (b / 255) / (1 - a / 255);
7613
- return a > 255 ? 255 : a;
7614
- };
7615
- blend.normal = blend_f(each(normal));
7616
- blend.multiply = blend_f(each(multiply));
7617
- blend.screen = blend_f(each(screen));
7618
- blend.overlay = blend_f(each(overlay));
7619
- blend.darken = blend_f(each(darken));
7620
- blend.lighten = blend_f(each(lighten));
7621
- blend.dodge = blend_f(each(dodge));
7622
- blend.burn = blend_f(each(burn));
7623
- var blend_default = blend;
7624
-
7625
- // node_modules/chroma-js/src/generator/cubehelix.js
7626
- var { pow: pow9, sin: sin3, cos: cos4 } = Math;
7627
- function cubehelix_default(start = 300, rotations = -1.5, hue = 1, gamma = 1, lightness = [0, 1]) {
7628
- let dh = 0, dl;
7629
- if (type_default(lightness) === "array") {
7630
- dl = lightness[1] - lightness[0];
7631
- } else {
7632
- dl = 0;
7633
- lightness = [lightness, lightness];
7634
- }
7635
- const f = function(fract) {
7636
- const a = TWOPI * ((start + 120) / 360 + rotations * fract);
7637
- const l = pow9(lightness[0] + dl * fract, gamma);
7638
- const h = dh !== 0 ? hue[0] + fract * dh : hue;
7639
- const amp = h * l * (1 - l) / 2;
7640
- const cos_a = cos4(a);
7641
- const sin_a = sin3(a);
7642
- const r = l + amp * (-0.14861 * cos_a + 1.78277 * sin_a);
7643
- const g = l + amp * (-0.29227 * cos_a - 0.90649 * sin_a);
7644
- const b = l + amp * (1.97294 * cos_a);
7645
- return chroma_default(clip_rgb_default([r * 255, g * 255, b * 255, 1]));
7646
- };
7647
- f.start = function(s) {
7648
- if (s == null) {
7649
- return start;
7650
- }
7651
- start = s;
7652
- return f;
7653
- };
7654
- f.rotations = function(r) {
7655
- if (r == null) {
7656
- return rotations;
7657
- }
7658
- rotations = r;
7659
- return f;
7660
- };
7661
- f.gamma = function(g) {
7662
- if (g == null) {
7663
- return gamma;
7664
- }
7665
- gamma = g;
7666
- return f;
7667
- };
7668
- f.hue = function(h) {
7669
- if (h == null) {
7670
- return hue;
7671
- }
7672
- hue = h;
7673
- if (type_default(hue) === "array") {
7674
- dh = hue[1] - hue[0];
7675
- if (dh === 0) {
7676
- hue = hue[1];
7677
- }
7678
- } else {
7679
- dh = 0;
7680
- }
7681
- return f;
7682
- };
7683
- f.lightness = function(h) {
7684
- if (h == null) {
7685
- return lightness;
7686
- }
7687
- if (type_default(h) === "array") {
7688
- lightness = h;
7689
- dl = h[1] - h[0];
7690
- } else {
7691
- lightness = [h, h];
7692
- dl = 0;
7693
- }
7694
- return f;
7695
- };
7696
- f.scale = () => chroma_default.scale(f);
7697
- f.hue(hue);
7698
- return f;
7699
- }
7700
-
7701
- // node_modules/chroma-js/src/generator/random.js
7702
- var digits = "0123456789abcdef";
7703
- var { floor: floor3, random } = Math;
7704
- var random_default = () => {
7705
- let code = "#";
7706
- for (let i = 0; i < 6; i++) {
7707
- code += digits.charAt(floor3(random() * 16));
7708
- }
7709
- return new Color_default(code, "hex");
7710
- };
7711
-
7712
- // node_modules/chroma-js/src/utils/analyze.js
7713
- var { log: log2, pow: pow10, floor: floor4, abs } = Math;
7714
- function analyze(data, key = null) {
7715
- const r = {
7716
- min: Number.MAX_VALUE,
7717
- max: Number.MAX_VALUE * -1,
7718
- sum: 0,
7719
- values: [],
7720
- count: 0
7721
- };
7722
- if (type_default(data) === "object") {
7723
- data = Object.values(data);
7724
- }
7725
- data.forEach((val) => {
7726
- if (key && type_default(val) === "object") val = val[key];
7727
- if (val !== void 0 && val !== null && !isNaN(val)) {
7728
- r.values.push(val);
7729
- r.sum += val;
7730
- if (val < r.min) r.min = val;
7731
- if (val > r.max) r.max = val;
7732
- r.count += 1;
7733
- }
7734
- });
7735
- r.domain = [r.min, r.max];
7736
- r.limits = (mode, num2) => limits(r, mode, num2);
7737
- return r;
7738
- }
7739
- function limits(data, mode = "equal", num2 = 7) {
7740
- if (type_default(data) == "array") {
7741
- data = analyze(data);
7742
- }
7743
- const { min: min5, max: max5 } = data;
7744
- const values = data.values.sort((a, b) => a - b);
7745
- if (num2 === 1) {
7746
- return [min5, max5];
7747
- }
7748
- const limits2 = [];
7749
- if (mode.substr(0, 1) === "c") {
7750
- limits2.push(min5);
7751
- limits2.push(max5);
7752
- }
7753
- if (mode.substr(0, 1) === "e") {
7754
- limits2.push(min5);
7755
- for (let i = 1; i < num2; i++) {
7756
- limits2.push(min5 + i / num2 * (max5 - min5));
7757
- }
7758
- limits2.push(max5);
7759
- } else if (mode.substr(0, 1) === "l") {
7760
- if (min5 <= 0) {
7761
- throw new Error(
7762
- "Logarithmic scales are only possible for values > 0"
7763
- );
7764
- }
7765
- const min_log = Math.LOG10E * log2(min5);
7766
- const max_log = Math.LOG10E * log2(max5);
7767
- limits2.push(min5);
7768
- for (let i = 1; i < num2; i++) {
7769
- limits2.push(pow10(10, min_log + i / num2 * (max_log - min_log)));
7770
- }
7771
- limits2.push(max5);
7772
- } else if (mode.substr(0, 1) === "q") {
7773
- limits2.push(min5);
7774
- for (let i = 1; i < num2; i++) {
7775
- const p = (values.length - 1) * i / num2;
7776
- const pb = floor4(p);
7777
- if (pb === p) {
7778
- limits2.push(values[pb]);
7779
- } else {
7780
- const pr = p - pb;
7781
- limits2.push(values[pb] * (1 - pr) + values[pb + 1] * pr);
7782
- }
7783
- }
7784
- limits2.push(max5);
7785
- } else if (mode.substr(0, 1) === "k") {
7786
- let cluster;
7787
- const n = values.length;
7788
- const assignments = new Array(n);
7789
- const clusterSizes = new Array(num2);
7790
- let repeat = true;
7791
- let nb_iters = 0;
7792
- let centroids = null;
7793
- centroids = [];
7794
- centroids.push(min5);
7795
- for (let i = 1; i < num2; i++) {
7796
- centroids.push(min5 + i / num2 * (max5 - min5));
7797
- }
7798
- centroids.push(max5);
7799
- while (repeat) {
7800
- for (let j = 0; j < num2; j++) {
7801
- clusterSizes[j] = 0;
7802
- }
7803
- for (let i = 0; i < n; i++) {
7804
- const value = values[i];
7805
- let mindist = Number.MAX_VALUE;
7806
- let best;
7807
- for (let j = 0; j < num2; j++) {
7808
- const dist = abs(centroids[j] - value);
7809
- if (dist < mindist) {
7810
- mindist = dist;
7811
- best = j;
7812
- }
7813
- clusterSizes[best]++;
7814
- assignments[i] = best;
7815
- }
7816
- }
7817
- const newCentroids = new Array(num2);
7818
- for (let j = 0; j < num2; j++) {
7819
- newCentroids[j] = null;
7820
- }
7821
- for (let i = 0; i < n; i++) {
7822
- cluster = assignments[i];
7823
- if (newCentroids[cluster] === null) {
7824
- newCentroids[cluster] = values[i];
7825
- } else {
7826
- newCentroids[cluster] += values[i];
7827
- }
7828
- }
7829
- for (let j = 0; j < num2; j++) {
7830
- newCentroids[j] *= 1 / clusterSizes[j];
7831
- }
7832
- repeat = false;
7833
- for (let j = 0; j < num2; j++) {
7834
- if (newCentroids[j] !== centroids[j]) {
7835
- repeat = true;
7836
- break;
7837
- }
7838
- }
7839
- centroids = newCentroids;
7840
- nb_iters++;
7841
- if (nb_iters > 200) {
7842
- repeat = false;
7843
- }
7844
- }
7845
- const kClusters = {};
7846
- for (let j = 0; j < num2; j++) {
7847
- kClusters[j] = [];
7848
- }
7849
- for (let i = 0; i < n; i++) {
7850
- cluster = assignments[i];
7851
- kClusters[cluster].push(values[i]);
7852
- }
7853
- let tmpKMeansBreaks = [];
7854
- for (let j = 0; j < num2; j++) {
7855
- tmpKMeansBreaks.push(kClusters[j][0]);
7856
- tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);
7857
- }
7858
- tmpKMeansBreaks = tmpKMeansBreaks.sort((a, b) => a - b);
7859
- limits2.push(tmpKMeansBreaks[0]);
7860
- for (let i = 1; i < tmpKMeansBreaks.length; i += 2) {
7861
- const v = tmpKMeansBreaks[i];
7862
- if (!isNaN(v) && limits2.indexOf(v) === -1) {
7863
- limits2.push(v);
7864
- }
7865
- }
7866
- }
7867
- return limits2;
7868
- }
7869
-
7870
- // node_modules/chroma-js/src/utils/contrast.js
7871
- var contrast_default = (a, b) => {
7872
- a = new Color_default(a);
7873
- b = new Color_default(b);
7874
- const l1 = a.luminance();
7875
- const l2 = b.luminance();
7876
- return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
7877
- };
7878
-
7879
- // node_modules/chroma-js/src/utils/delta-e.js
7880
- var { sqrt: sqrt5, pow: pow11, min: min4, max: max4, atan2: atan23, abs: abs2, cos: cos5, sin: sin4, exp, PI: PI3 } = Math;
7881
- function delta_e_default(a, b, Kl = 1, Kc = 1, Kh = 1) {
7882
- var rad2deg = function(rad) {
7883
- return 360 * rad / (2 * PI3);
7884
- };
7885
- var deg2rad = function(deg) {
7886
- return 2 * PI3 * deg / 360;
7887
- };
7888
- a = new Color_default(a);
7889
- b = new Color_default(b);
7890
- const [L1, a1, b1] = Array.from(a.lab());
7891
- const [L2, a2, b2] = Array.from(b.lab());
7892
- const avgL = (L1 + L2) / 2;
7893
- const C1 = sqrt5(pow11(a1, 2) + pow11(b1, 2));
7894
- const C2 = sqrt5(pow11(a2, 2) + pow11(b2, 2));
7895
- const avgC = (C1 + C2) / 2;
7896
- const G = 0.5 * (1 - sqrt5(pow11(avgC, 7) / (pow11(avgC, 7) + pow11(25, 7))));
7897
- const a1p = a1 * (1 + G);
7898
- const a2p = a2 * (1 + G);
7899
- const C1p = sqrt5(pow11(a1p, 2) + pow11(b1, 2));
7900
- const C2p = sqrt5(pow11(a2p, 2) + pow11(b2, 2));
7901
- const avgCp = (C1p + C2p) / 2;
7902
- const arctan1 = rad2deg(atan23(b1, a1p));
7903
- const arctan2 = rad2deg(atan23(b2, a2p));
7904
- const h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360;
7905
- const h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360;
7906
- const avgHp = abs2(h1p - h2p) > 180 ? (h1p + h2p + 360) / 2 : (h1p + h2p) / 2;
7907
- const T = 1 - 0.17 * cos5(deg2rad(avgHp - 30)) + 0.24 * cos5(deg2rad(2 * avgHp)) + 0.32 * cos5(deg2rad(3 * avgHp + 6)) - 0.2 * cos5(deg2rad(4 * avgHp - 63));
7908
- let deltaHp = h2p - h1p;
7909
- deltaHp = abs2(deltaHp) <= 180 ? deltaHp : h2p <= h1p ? deltaHp + 360 : deltaHp - 360;
7910
- deltaHp = 2 * sqrt5(C1p * C2p) * sin4(deg2rad(deltaHp) / 2);
7911
- const deltaL = L2 - L1;
7912
- const deltaCp = C2p - C1p;
7913
- const sl = 1 + 0.015 * pow11(avgL - 50, 2) / sqrt5(20 + pow11(avgL - 50, 2));
7914
- const sc = 1 + 0.045 * avgCp;
7915
- const sh = 1 + 0.015 * avgCp * T;
7916
- const deltaTheta = 30 * exp(-pow11((avgHp - 275) / 25, 2));
7917
- const Rc = 2 * sqrt5(pow11(avgCp, 7) / (pow11(avgCp, 7) + pow11(25, 7)));
7918
- const Rt = -Rc * sin4(2 * deg2rad(deltaTheta));
7919
- const result = sqrt5(
7920
- pow11(deltaL / (Kl * sl), 2) + pow11(deltaCp / (Kc * sc), 2) + pow11(deltaHp / (Kh * sh), 2) + Rt * (deltaCp / (Kc * sc)) * (deltaHp / (Kh * sh))
7921
- );
7922
- return max4(0, min4(100, result));
7923
- }
7924
-
7925
- // node_modules/chroma-js/src/utils/distance.js
7926
- function distance_default(a, b, mode = "lab") {
7927
- a = new Color_default(a);
7928
- b = new Color_default(b);
7929
- const l1 = a.get(mode);
7930
- const l2 = b.get(mode);
7931
- let sum_sq = 0;
7932
- for (let i in l1) {
7933
- const d = (l1[i] || 0) - (l2[i] || 0);
7934
- sum_sq += d * d;
7935
- }
7936
- return Math.sqrt(sum_sq);
7937
- }
7938
-
7939
- // node_modules/chroma-js/src/utils/valid.js
7940
- var valid_default = (...args) => {
7941
- try {
7942
- new Color_default(...args);
7943
- return true;
7944
- } catch (e) {
7945
- return false;
7946
- }
7947
- };
7948
-
7949
- // node_modules/chroma-js/src/utils/scales.js
7950
- var scales_default = {
7951
- cool() {
7952
- return scale_default([chroma_default.hsl(180, 1, 0.9), chroma_default.hsl(250, 0.7, 0.4)]);
7953
- },
7954
- hot() {
7955
- return scale_default(["#000", "#f00", "#ff0", "#fff"]).mode(
7956
- "rgb"
7957
- );
7958
- }
7959
- };
7960
-
7961
- // node_modules/chroma-js/src/colors/colorbrewer.js
7962
- var colorbrewer = {
7963
- // sequential
7964
- OrRd: ["#fff7ec", "#fee8c8", "#fdd49e", "#fdbb84", "#fc8d59", "#ef6548", "#d7301f", "#b30000", "#7f0000"],
7965
- PuBu: ["#fff7fb", "#ece7f2", "#d0d1e6", "#a6bddb", "#74a9cf", "#3690c0", "#0570b0", "#045a8d", "#023858"],
7966
- BuPu: ["#f7fcfd", "#e0ecf4", "#bfd3e6", "#9ebcda", "#8c96c6", "#8c6bb1", "#88419d", "#810f7c", "#4d004b"],
7967
- Oranges: ["#fff5eb", "#fee6ce", "#fdd0a2", "#fdae6b", "#fd8d3c", "#f16913", "#d94801", "#a63603", "#7f2704"],
7968
- BuGn: ["#f7fcfd", "#e5f5f9", "#ccece6", "#99d8c9", "#66c2a4", "#41ae76", "#238b45", "#006d2c", "#00441b"],
7969
- YlOrBr: ["#ffffe5", "#fff7bc", "#fee391", "#fec44f", "#fe9929", "#ec7014", "#cc4c02", "#993404", "#662506"],
7970
- YlGn: ["#ffffe5", "#f7fcb9", "#d9f0a3", "#addd8e", "#78c679", "#41ab5d", "#238443", "#006837", "#004529"],
7971
- Reds: ["#fff5f0", "#fee0d2", "#fcbba1", "#fc9272", "#fb6a4a", "#ef3b2c", "#cb181d", "#a50f15", "#67000d"],
7972
- RdPu: ["#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a"],
7973
- Greens: ["#f7fcf5", "#e5f5e0", "#c7e9c0", "#a1d99b", "#74c476", "#41ab5d", "#238b45", "#006d2c", "#00441b"],
7974
- YlGnBu: ["#ffffd9", "#edf8b1", "#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494", "#081d58"],
7975
- Purples: ["#fcfbfd", "#efedf5", "#dadaeb", "#bcbddc", "#9e9ac8", "#807dba", "#6a51a3", "#54278f", "#3f007d"],
7976
- GnBu: ["#f7fcf0", "#e0f3db", "#ccebc5", "#a8ddb5", "#7bccc4", "#4eb3d3", "#2b8cbe", "#0868ac", "#084081"],
7977
- Greys: ["#ffffff", "#f0f0f0", "#d9d9d9", "#bdbdbd", "#969696", "#737373", "#525252", "#252525", "#000000"],
7978
- YlOrRd: ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#fc4e2a", "#e31a1c", "#bd0026", "#800026"],
7979
- PuRd: ["#f7f4f9", "#e7e1ef", "#d4b9da", "#c994c7", "#df65b0", "#e7298a", "#ce1256", "#980043", "#67001f"],
7980
- Blues: ["#f7fbff", "#deebf7", "#c6dbef", "#9ecae1", "#6baed6", "#4292c6", "#2171b5", "#08519c", "#08306b"],
7981
- PuBuGn: ["#fff7fb", "#ece2f0", "#d0d1e6", "#a6bddb", "#67a9cf", "#3690c0", "#02818a", "#016c59", "#014636"],
7982
- Viridis: ["#440154", "#482777", "#3f4a8a", "#31678e", "#26838f", "#1f9d8a", "#6cce5a", "#b6de2b", "#fee825"],
7983
- // diverging
7984
- Spectral: ["#9e0142", "#d53e4f", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#e6f598", "#abdda4", "#66c2a5", "#3288bd", "#5e4fa2"],
7985
- RdYlGn: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"],
7986
- RdBu: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#f7f7f7", "#d1e5f0", "#92c5de", "#4393c3", "#2166ac", "#053061"],
7987
- PiYG: ["#8e0152", "#c51b7d", "#de77ae", "#f1b6da", "#fde0ef", "#f7f7f7", "#e6f5d0", "#b8e186", "#7fbc41", "#4d9221", "#276419"],
7988
- PRGn: ["#40004b", "#762a83", "#9970ab", "#c2a5cf", "#e7d4e8", "#f7f7f7", "#d9f0d3", "#a6dba0", "#5aae61", "#1b7837", "#00441b"],
7989
- RdYlBu: ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee090", "#ffffbf", "#e0f3f8", "#abd9e9", "#74add1", "#4575b4", "#313695"],
7990
- BrBG: ["#543005", "#8c510a", "#bf812d", "#dfc27d", "#f6e8c3", "#f5f5f5", "#c7eae5", "#80cdc1", "#35978f", "#01665e", "#003c30"],
7991
- RdGy: ["#67001f", "#b2182b", "#d6604d", "#f4a582", "#fddbc7", "#ffffff", "#e0e0e0", "#bababa", "#878787", "#4d4d4d", "#1a1a1a"],
7992
- PuOr: ["#7f3b08", "#b35806", "#e08214", "#fdb863", "#fee0b6", "#f7f7f7", "#d8daeb", "#b2abd2", "#8073ac", "#542788", "#2d004b"],
7993
- // qualitative
7994
- Set2: ["#66c2a5", "#fc8d62", "#8da0cb", "#e78ac3", "#a6d854", "#ffd92f", "#e5c494", "#b3b3b3"],
7995
- Accent: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"],
7996
- Set1: ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3", "#ff7f00", "#ffff33", "#a65628", "#f781bf", "#999999"],
7997
- Set3: ["#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69", "#fccde5", "#d9d9d9", "#bc80bd", "#ccebc5", "#ffed6f"],
7998
- Dark2: ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"],
7999
- Paired: ["#a6cee3", "#1f78b4", "#b2df8a", "#33a02c", "#fb9a99", "#e31a1c", "#fdbf6f", "#ff7f00", "#cab2d6", "#6a3d9a", "#ffff99", "#b15928"],
8000
- Pastel2: ["#b3e2cd", "#fdcdac", "#cbd5e8", "#f4cae4", "#e6f5c9", "#fff2ae", "#f1e2cc", "#cccccc"],
8001
- Pastel1: ["#fbb4ae", "#b3cde3", "#ccebc5", "#decbe4", "#fed9a6", "#ffffcc", "#e5d8bd", "#fddaec", "#f2f2f2"]
8002
- };
8003
- for (let key of Object.keys(colorbrewer)) {
8004
- colorbrewer[key.toLowerCase()] = colorbrewer[key];
8005
- }
8006
- var colorbrewer_default = colorbrewer;
8007
-
8008
- // node_modules/chroma-js/index.js
8009
- Object.assign(chroma_default, {
8010
- average: average_default,
8011
- bezier: bezier_default,
8012
- blend: blend_default,
8013
- cubehelix: cubehelix_default,
8014
- mix: mix_default,
8015
- interpolate: mix_default,
8016
- random: random_default,
8017
- scale: scale_default,
8018
- analyze,
8019
- contrast: contrast_default,
8020
- deltaE: delta_e_default,
8021
- distance: distance_default,
8022
- limits,
8023
- valid: valid_default,
8024
- scales: scales_default,
8025
- input: input_default,
8026
- colors: w3cx11_default,
8027
- brewer: colorbrewer_default
8028
- });
8029
- var chroma_js_default = chroma_default;
8030
-
8031
- // src/palette/use-palette.ts
8032
- var import_lodash = __toESM(require_lodash());
8033
- var delta = { xs: 0.01, sm: 0.02, md: 0.03, lg: 0.08, xl: 0.14 };
8034
- var normalizeHue = (input, range) => (input % range + range) % range;
8035
- var markDarkColor = (color) => {
8036
- const hsv2 = chroma_js_default(color).hsv();
8037
- return chroma_js_default(hsv2[0], hsv2[1] * 0.92, Math.min(hsv2[2] + 0.01, 1), "hsv").hex();
8038
- };
8039
- var calculateHue = (color, end, defaultValue) => {
8040
- const interval = end - defaultValue;
8041
- let offset;
8042
- if (end <= defaultValue) {
8043
- if (color[0] > 80 && color[0] < 260) {
8044
- offset = interval * delta.xs;
8045
- } else {
8046
- offset = -interval * delta.sm;
8047
- }
8048
- } else if (color[0] > 20 && color[0] < 48) {
8049
- offset = -interval * delta.md;
8050
- } else if (color[0] >= 48 && color[0] < 260) {
8051
- offset = interval * delta.xs;
8052
- } else {
8053
- offset = -interval * delta.sm;
8054
- }
8055
- return normalizeHue(color[0] + offset, 360);
8056
- };
8057
- var calculateSaturation = (hsv2, range, max5) => {
8058
- const interval = (range - max5) / 100;
8059
- let offset = 0;
8060
- if (range < max5) {
8061
- offset = interval * hsv2[1] / 5;
8062
- if (range < 100) {
8063
- offset -= delta.sm;
8064
- }
8065
- } else if (range > max5) {
8066
- if (hsv2[0] < 30 || hsv2[0] > 200) {
8067
- offset = interval * delta.md;
8068
- } else {
8069
- offset = interval * delta.xs;
8070
- }
8071
- if (hsv2[1] === 0) {
8072
- offset = 0;
8073
- }
8074
- }
8075
- const newSaturation = hsv2[1] + offset;
8076
- return newSaturation > 1 ? 1 : newSaturation < 0 ? 0 : newSaturation;
8077
- };
8078
- var calculateLightness = (hsv2, range, max5) => {
8079
- const interval = (range - max5) / 100;
8080
- let offset = 0;
8081
- if (range < max5) {
8082
- if (hsv2[1] < 0.1) {
8083
- offset = interval * (1 - hsv2[2]) / 5 * 1.06;
8084
- } else {
8085
- offset = interval * (1 - hsv2[2]) / 5;
8086
- }
8087
- } else if (range > max5) {
8088
- if ((hsv2[0] < 30 || hsv2[0] > 200) && hsv2[0] > 0) {
8089
- offset = interval * delta.lg;
8090
- if (hsv2[2] > 0.8) {
8091
- offset = interval * delta.xl;
8092
- }
8093
- } else {
8094
- offset = interval * hsv2[2] / 6;
8095
- }
8096
- }
8097
- const newLightness = hsv2[2] - offset;
8098
- return newLightness > 1 ? 1 : newLightness < 0 ? 0 : newLightness;
8099
- };
8100
-
8101
- // src/palette/use-palette.ts
8102
- var COLOR_STOPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
8103
- var createSolidColorScale = (color, mode = "light") => {
8104
- const isDark = mode === "dark";
8105
- let baseColor = isDark ? markDarkColor(color) : color;
8106
- const luminance = chroma_js_default(baseColor).luminance();
8107
- if (luminance < 0.1) {
8108
- baseColor = chroma_js_default(baseColor).set("hsl.l", 0.4).hex();
8109
- } else if (luminance > 0.9) {
8110
- baseColor = chroma_js_default(baseColor).set("hsl.l", 0.6).hex();
8111
- }
8112
- const hsv2 = chroma_js_default(baseColor).hsv();
8113
- const colors = COLOR_STOPS.map((stop) => {
8114
- const h = calculateHue(hsv2, stop, 500);
8115
- const s = calculateSaturation(hsv2, stop, 500);
8116
- const v = calculateLightness(hsv2, stop, 500);
8117
- return chroma_js_default(h, s, v, "hsv");
8118
- });
8119
- return isDark ? colors.reverse() : colors;
8120
- };
8121
- var genTailwindTheme = (color) => {
8122
- const lightColors = createSolidColorScale(color, "light");
8123
- const darkColors = createSolidColorScale(color, "dark");
8124
- const twColors = {};
8125
- ["monkeys", "monkeys-dark"].forEach((name, i) => {
8126
- const colors = {};
8127
- if (!i) {
8128
- lightColors.map(
8129
- (it, stopIndex) => Object.assign(colors, {
8130
- [COLOR_STOPS[stopIndex]]: it.rgb().join(" ")
8131
- })
8132
- );
8133
- } else {
8134
- darkColors.map(
8135
- (it, stopIndex) => Object.assign(colors, {
8136
- [COLOR_STOPS[stopIndex]]: it.rgb().join(" ")
8137
- })
8138
- );
8139
- }
8140
- Object.assign(twColors, { [name]: colors });
8141
- });
8142
- return twColors;
8143
- };
8144
- var setTailwindTheme = (0, import_lodash.debounce)((color) => {
8145
- const twColors = genTailwindTheme(color);
8146
- let styles = "";
8147
- Object.entries(twColors).forEach(([colorName, colorValues]) => {
8148
- styles += (colorName === "monkeys-dark" ? ".dark" : ":root,::selection") + "{";
8149
- Object.entries(colorValues).forEach(([stop, color2]) => {
8150
- styles += `--monkeys-${stop}:${color2};`;
8151
- });
8152
- styles += "}";
8153
- });
8154
- const themeDOM = document.getElementById("monkeys-theme");
8155
- if (!themeDOM) {
8156
- const newThemeDOM = document.createElement("style");
8157
- newThemeDOM.id = "monkeys-theme";
8158
- document.head.appendChild(newThemeDOM);
8159
- newThemeDOM.innerHTML = styles;
8160
- } else {
8161
- themeDOM.innerHTML = styles;
8162
- }
8163
- }, 64);
8164
-
8165
- // src/palette/use-neocard-palette.ts
8166
- var import_lodash2 = __toESM(require_lodash());
8167
- var setNeocardTheme = (0, import_lodash2.debounce)((colors) => {
8168
- let lightColor;
8169
- let darkColor;
8170
- if (typeof colors === "string") {
8171
- lightColor = colors;
8172
- darkColor = colors;
8173
- } else {
8174
- lightColor = colors.light;
8175
- darkColor = colors.dark;
8176
- }
8177
- const styles = `
8178
- :root {
8179
- --neocard: ${lightColor};
8180
- }
8181
- .dark {
8182
- --neocard: ${darkColor};
8183
- }
8184
- `;
8185
- const themeDOM = document.getElementById("monkeys-neocard-theme");
8186
- if (!themeDOM) {
8187
- const newThemeDOM = document.createElement("style");
8188
- newThemeDOM.id = "monkeys-neocard-theme";
8189
- document.head.appendChild(newThemeDOM);
8190
- newThemeDOM.innerHTML = styles;
8191
- } else {
8192
- themeDOM.innerHTML = styles;
8193
- }
8194
- }, 64);
8195
-
8196
- // src/components/base/utils.ts
8197
- function cn(...parts) {
8198
- return parts.filter(Boolean).join(" ");
8199
- }
8200
- function hasRenderableNode(node) {
8201
- return node !== void 0 && node !== null && typeof node !== "boolean";
8202
- }
5699
+ }, 64);
5700
+ function cn(...parts) {
5701
+ return tailwindMerge.twMerge(parts.filter(Boolean).join(" "));
5702
+ }
8203
5703
 
8204
5704
  // src/components/base/theme.ts
8205
5705
  var emptyStyles = {};
@@ -8232,9 +5732,9 @@ var baseSlots = {
8232
5732
  ),
8233
5733
  buttonDefault: "border-border bg-background text-foreground hover:bg-accent/60",
8234
5734
  buttonPrimary: "border-primary/20 bg-primary/10 text-primary hover:bg-primary/15",
8235
- buttonSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 hover:bg-emerald-500/15",
5735
+ buttonSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-400 hover:bg-emerald-500/15",
8236
5736
  buttonWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700 hover:bg-amber-500/15",
8237
- buttonDanger: "border-destructive/20 bg-destructive/10 text-destructive hover:bg-destructive/15",
5737
+ buttonDanger: "border-destructive/20 bg-destructive/10 text-destructive-text hover:bg-destructive/15",
8238
5738
  buttonMuted: "border-border/60 bg-muted/45 text-muted-foreground hover:bg-muted/70 hover:text-foreground",
8239
5739
  buttonActive: "border-primary/35 bg-primary/10 text-primary",
8240
5740
  buttonDisabled: "!cursor-not-allowed opacity-60",
@@ -8249,10 +5749,101 @@ var baseSlots = {
8249
5749
  badgePrimary: "border-primary/30 bg-primary/10 text-primary",
8250
5750
  badgeSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700",
8251
5751
  badgeWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700",
8252
- badgeDanger: "border-destructive/30 bg-destructive/10 text-destructive",
5752
+ badgeDanger: "border-destructive/30 bg-destructive/10 text-destructive-text",
8253
5753
  badgeMuted: "border-border/60 bg-muted text-muted-foreground",
8254
5754
  badgeIcon: "inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",
8255
5755
  badgeLabel: "min-w-0 truncate",
5756
+ textRoot: "min-w-0 break-words leading-6",
5757
+ textSizeXs: "text-xs",
5758
+ textSizeSm: "text-sm",
5759
+ textSizeMd: "text-base",
5760
+ textSizeLg: "text-lg",
5761
+ textSizeXl: "text-xl",
5762
+ typographyToneDefault: "text-foreground",
5763
+ typographyToneMuted: "text-muted-foreground",
5764
+ typographyTonePrimary: "text-primary",
5765
+ typographyToneSuccess: "text-emerald-700 dark:text-emerald-400",
5766
+ typographyToneWarning: "text-amber-700 dark:text-amber-400",
5767
+ typographyToneDanger: "text-destructive-text",
5768
+ typographyToneInherit: "text-inherit",
5769
+ headingRoot: "min-w-0 break-words font-semibold tracking-tight",
5770
+ headingSizeXs: "text-sm leading-5",
5771
+ headingSizeSm: "text-base leading-6",
5772
+ headingSizeMd: "text-lg leading-7",
5773
+ headingSizeLg: "text-xl leading-7",
5774
+ headingSizeXl: "text-2xl leading-8",
5775
+ headingSize2xl: "text-3xl leading-9",
5776
+ linkRoot: "inline break-words underline decoration-current/40 underline-offset-4 hover:decoration-current focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
5777
+ codeInline: "rounded border border-border/70 bg-muted/60 px-1.5 py-0.5 font-mono text-[0.875em] leading-[1.45] text-foreground",
5778
+ codeBlock: "m-0 max-w-full overflow-x-auto rounded-md border border-border/70 bg-muted/60 p-4 text-foreground",
5779
+ codeContent: "font-mono text-sm leading-6",
5780
+ kbdRoot: "inline-flex min-h-5 items-center rounded border border-border bg-muted/70 px-1.5 font-mono text-[0.75em] font-medium leading-5 text-foreground shadow-[inset_0_-1px_0_hsl(var(--monkeys-color-border))]",
5781
+ listRoot: "m-0 min-w-0 list-outside break-words ps-5 text-foreground",
5782
+ listSpacingCompact: "[&>li+li]:mt-1",
5783
+ listSpacingDefault: "[&>li+li]:mt-2",
5784
+ listSpacingRelaxed: "[&>li+li]:mt-3",
5785
+ listMarkerNone: "list-none ps-0",
5786
+ listMarkerDisc: "list-disc",
5787
+ listMarkerCircle: "list-[circle]",
5788
+ listMarkerSquare: "list-[square]",
5789
+ listMarkerDecimal: "list-decimal",
5790
+ listMarkerLowerAlpha: "list-[lower-alpha]",
5791
+ listMarkerUpperAlpha: "list-[upper-alpha]",
5792
+ listItem: "min-w-0 ps-1 leading-6 marker:text-muted-foreground",
5793
+ stackRoot: "flex min-w-0 flex-col",
5794
+ inlineRoot: "flex min-w-0 flex-row",
5795
+ gridRoot: "grid min-w-0",
5796
+ containerRoot: "mx-auto w-full min-w-0",
5797
+ aspectRatioRoot: "relative min-w-0 overflow-hidden [&>*]:h-full [&>*]:w-full",
5798
+ spinnerRoot: "inline-flex shrink-0 items-center justify-center text-current align-middle",
5799
+ spinnerIndicator: "h-5 w-5 rounded-full border-2 border-current border-r-transparent motion-safe:animate-spin motion-reduce:animate-none",
5800
+ visuallyHiddenRoot: "sr-only",
5801
+ visuallyHiddenFocusable: "focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[1000] focus:rounded-md focus:bg-background focus:px-4 focus:py-2 focus:text-foreground focus:shadow-lg focus:outline-none focus:ring-2 focus:ring-ring focus-within:not-sr-only focus-within:fixed focus-within:left-4 focus-within:top-4 focus-within:z-[1000] focus-within:rounded-md focus-within:bg-background focus-within:px-4 focus-within:py-2 focus-within:text-foreground focus-within:shadow-lg focus-within:ring-2 focus-within:ring-ring",
5802
+ fieldsetRoot: "min-w-0 border-0 p-0 text-foreground",
5803
+ fieldsetLegend: "min-w-0 text-sm font-semibold leading-6 text-foreground",
5804
+ fieldsetDescription: "mt-1 text-sm leading-5 text-muted-foreground",
5805
+ fieldsetError: "mt-1 text-sm leading-5 text-destructive-text",
5806
+ fieldsetContent: "mt-3 grid min-w-0 gap-3",
5807
+ stepsRoot: "m-0 min-w-0 list-none p-0 text-foreground",
5808
+ stepsHorizontal: "flex w-full max-w-full items-start overflow-x-auto pb-2",
5809
+ stepsVertical: "grid",
5810
+ stepsItem: "relative min-w-0",
5811
+ stepsItemHorizontal: "flex min-w-52 flex-1 items-start",
5812
+ stepsItemVertical: "pb-6 last:pb-0",
5813
+ stepsTrigger: "flex min-w-0 flex-1 items-start gap-3 rounded-md border-0 bg-transparent p-1 text-start text-inherit",
5814
+ stepsTriggerInteractive: "cursor-pointer hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
5815
+ stepsTriggerDisabled: "!cursor-not-allowed opacity-60",
5816
+ stepsIndicator: "relative z-[1] inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold",
5817
+ stepsIndicatorPending: "border-border bg-background text-muted-foreground",
5818
+ stepsIndicatorCurrent: "border-primary/50 bg-primary/10 text-primary",
5819
+ stepsIndicatorCompleted: "border-primary bg-primary text-primary-foreground",
5820
+ stepsIndicatorError: "border-destructive bg-destructive text-destructive-foreground",
5821
+ stepsContent: "grid min-w-0 gap-1 pt-0.5",
5822
+ stepsLabel: "min-w-0 break-words text-sm font-medium leading-5",
5823
+ stepsDescription: "min-w-0 break-words text-sm leading-5 text-muted-foreground",
5824
+ stepsStatus: "sr-only",
5825
+ stepsConnector: "shrink-0 bg-border",
5826
+ stepsConnectorHorizontal: "mt-3.5 h-px w-8",
5827
+ stepsConnectorVertical: "absolute bottom-0 top-8 start-3.5 w-px -translate-x-1/2",
5828
+ stepsConnectorCompleted: "bg-primary/60",
5829
+ stepsConnectorError: "bg-destructive/60",
5830
+ scrollAreaViewport: "min-h-0 min-w-0",
5831
+ numberInputControl: "tabular-nums",
5832
+ numberInputStepControls: "me-1 flex shrink-0 self-stretch overflow-hidden border-s border-border",
5833
+ numberInputStepButton: "flex min-h-6 w-7 cursor-pointer items-center justify-center border-0 bg-transparent px-1 text-xs leading-none text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:z-[1] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:!cursor-not-allowed disabled:opacity-40",
5834
+ passwordInputControl: "pe-2",
5835
+ passwordInputToggle: "me-1 inline-flex min-h-7 shrink-0 cursor-pointer items-center justify-center rounded px-2 text-xs font-medium text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:!cursor-not-allowed disabled:opacity-40",
5836
+ inputGroupRoot: cn(
5837
+ "relative flex min-w-0 items-stretch overflow-hidden rounded-md border border-border bg-background text-foreground focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-ring/30",
5838
+ motionBase
5839
+ ),
5840
+ inputGroupInvalid: "border-destructive/55 focus-within:border-destructive/70 focus-within:ring-destructive/25",
5841
+ inputGroupDisabled: "!cursor-not-allowed bg-muted/35",
5842
+ inputGroupContent: "flex min-w-0 flex-1 items-stretch [&>*]:min-w-0",
5843
+ inputGroupStartElement: "inline-flex shrink-0 items-center justify-center ps-3 pe-1 text-foreground/75",
5844
+ inputGroupEndElement: "inline-flex shrink-0 items-center justify-center ps-1 pe-3 text-foreground/75",
5845
+ inputGroupStartAddon: "inline-flex max-w-[min(40%,16rem)] shrink-0 items-center overflow-hidden border-e border-border bg-muted/60 px-3 text-sm text-foreground/75 text-ellipsis whitespace-nowrap [&>*]:min-w-0",
5846
+ inputGroupEndAddon: "inline-flex max-w-[min(40%,16rem)] shrink-0 items-center overflow-hidden border-s border-border bg-muted/60 px-3 text-sm text-foreground/75 text-ellipsis whitespace-nowrap [&>*]:min-w-0",
8256
5847
  panelRoot: cn(
8257
5848
  "group relative flex min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background",
8258
5849
  motionInteractive
@@ -8275,11 +5866,11 @@ var baseSlots = {
8275
5866
  stateTitle: "text-sm font-semibold text-foreground",
8276
5867
  stateDescription: "mt-2 max-w-md text-sm leading-6 text-muted-foreground",
8277
5868
  stateActions: "mt-5 flex flex-wrap items-center justify-center gap-2",
8278
- loadingSpinner: "h-5 w-5 animate-spin",
5869
+ loadingSpinner: "h-5 w-5 motion-safe:animate-spin motion-reduce:animate-none",
8279
5870
  fieldRoot: "grid min-w-0 gap-2",
8280
5871
  fieldLabelRow: "flex min-w-0 items-center justify-between gap-3",
8281
5872
  fieldLabel: "min-w-0 text-sm font-medium leading-none text-foreground",
8282
- fieldRequired: "text-destructive",
5873
+ fieldRequired: "text-destructive-text",
8283
5874
  fieldDescription: "text-sm leading-5 text-muted-foreground",
8284
5875
  fieldMessage: "text-sm leading-5 text-muted-foreground",
8285
5876
  fieldControl: "min-w-0",
@@ -8359,9 +5950,9 @@ var baseSlots = {
8359
5950
  dialogTrigger: "",
8360
5951
  dialogTriggerDisabled: "!cursor-not-allowed opacity-60",
8361
5952
  dialogOverlay: "fixed inset-0 z-50 bg-background/70 backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
8362
- dialogContent: "fixed inset-0 z-50 flex min-h-0 items-center justify-center p-4",
5953
+ dialogContent: "pointer-events-none fixed inset-0 z-50 flex min-h-0 items-center justify-center p-4",
8363
5954
  dialogPanel: cn(
8364
- "relative flex max-h-[min(85vh,720px)] w-full max-w-lg min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background text-foreground shadow-xl",
5955
+ "pointer-events-auto relative flex max-h-[min(85vh,720px)] w-full max-w-lg min-w-0 flex-col overflow-hidden rounded-lg border border-border/70 bg-background text-foreground shadow-xl",
8365
5956
  "motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95 motion-safe:duration-300 motion-safe:ease-out"
8366
5957
  ),
8367
5958
  dialogHeader: "grid min-w-0 gap-1 border-b border-border/60 px-5 py-4",
@@ -8376,17 +5967,17 @@ var baseSlots = {
8376
5967
  dropdownRoot: "relative inline-flex min-w-0",
8377
5968
  dropdownTrigger: "",
8378
5969
  dropdownTriggerDisabled: "!cursor-not-allowed opacity-60",
8379
- dropdownMenu: "absolute left-0 top-[calc(100%+0.375rem)] z-50 min-w-48 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
5970
+ dropdownMenu: "z-50 min-w-48 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
8380
5971
  dropdownMenuTop: "bottom-[calc(100%+0.375rem)] top-auto",
8381
5972
  dropdownMenuEnd: "left-auto right-0",
8382
5973
  dropdownLabel: "px-2.5 py-1.5 text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",
8383
5974
  dropdownSeparator: "my-1 h-px bg-border/70",
8384
5975
  dropdownItem: cn(
8385
- "flex min-w-0 cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2 text-left text-sm text-foreground hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
5976
+ "flex min-w-0 cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2 text-left text-sm text-foreground hover:bg-accent/60 focus:bg-accent/60 data-[highlighted]:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",
8386
5977
  motionInteractive
8387
5978
  ),
8388
- dropdownItemDanger: "text-destructive hover:bg-destructive/10",
8389
- dropdownItemDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent",
5979
+ dropdownItemDanger: "text-destructive-text hover:bg-destructive/10 focus:bg-destructive/10 data-[highlighted]:bg-destructive/10",
5980
+ dropdownItemDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent focus:bg-transparent data-[highlighted]:bg-transparent",
8390
5981
  dropdownItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
8391
5982
  dropdownItemContent: "grid min-w-0 flex-1 gap-0.5",
8392
5983
  dropdownItemLabel: "min-w-0 truncate",
@@ -8394,7 +5985,7 @@ var baseSlots = {
8394
5985
  dropdownItemShortcut: "ml-3 shrink-0 text-xs font-medium text-muted-foreground",
8395
5986
  tooltipRoot: "relative inline-flex min-w-0",
8396
5987
  tooltipTrigger: "inline-flex min-w-0",
8397
- tooltipContent: "pointer-events-none absolute z-50 max-w-xs rounded-md border border-border bg-popover px-2.5 py-1.5 text-xs leading-5 text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
5988
+ tooltipContent: "pointer-events-none z-50 max-w-xs rounded-md border border-border bg-popover px-2.5 py-1.5 text-xs leading-5 text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
8398
5989
  noticeBase: cn(
8399
5990
  "flex min-w-0 gap-3 rounded-lg border px-4 py-3 text-sm",
8400
5991
  motionBase,
@@ -8404,7 +5995,7 @@ var baseSlots = {
8404
5995
  noticePrimary: "border-primary/25 bg-primary/10 text-primary",
8405
5996
  noticeSuccess: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700",
8406
5997
  noticeWarning: "border-amber-500/30 bg-amber-500/10 text-amber-700",
8407
- noticeDanger: "border-destructive/30 bg-destructive/10 text-destructive",
5998
+ noticeDanger: "border-destructive/30 bg-destructive/10 text-destructive-text",
8408
5999
  noticeMuted: "border-border/60 bg-muted/35 text-muted-foreground",
8409
6000
  noticeIcon: "mt-0.5 inline-flex h-4 w-4 shrink-0 items-center justify-center motion-safe:animate-in motion-safe:fade-in",
8410
6001
  noticeTitle: "font-semibold leading-5",
@@ -8424,12 +6015,12 @@ var baseSlots = {
8424
6015
  motionBase
8425
6016
  ),
8426
6017
  tabsTrigger: cn(
8427
- "inline-flex min-w-0 cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground hover:bg-background/70 hover:text-foreground focus-visible:outline-none",
6018
+ "inline-flex min-w-0 cursor-pointer items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium text-muted-foreground hover:bg-background/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 focus-visible:ring-offset-1 motion-reduce:transition-none",
8428
6019
  motionInteractive
8429
6020
  ),
8430
6021
  tabsTriggerActive: "bg-background text-foreground shadow-sm",
8431
6022
  tabsTriggerDisabled: "!cursor-not-allowed opacity-50 hover:bg-transparent",
8432
- tabsPanel: "min-w-0 rounded-lg border border-border/70 bg-background p-4 text-sm text-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
6023
+ tabsPanel: "min-w-0 rounded-lg border border-border/70 bg-background p-4 text-sm text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out motion-reduce:transition-none",
8433
6024
  segmentedRoot: cn(
8434
6025
  "inline-flex min-w-0 items-center gap-1 rounded-lg border border-border/70 bg-muted/30 p-1",
8435
6026
  motionBase
@@ -8449,7 +6040,7 @@ var baseSlots = {
8449
6040
  skeletonRoot: "relative overflow-hidden rounded-md bg-muted/70",
8450
6041
  avatarRoot: "relative inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-muted text-sm font-semibold text-muted-foreground motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
8451
6042
  avatarImage: "h-full w-full object-cover",
8452
- avatarFallback: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground",
6043
+ avatarFallback: "flex h-full w-full items-center justify-center bg-muted text-foreground",
8453
6044
  avatarStatus: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-muted-foreground motion-safe:animate-pulse",
8454
6045
  avatarText: "min-w-0 truncate text-sm font-medium text-foreground",
8455
6046
  toolbarRoot: cn(
@@ -8469,22 +6060,24 @@ var baseSlots = {
8469
6060
  breadcrumbSeparator: "shrink-0 text-muted-foreground/70",
8470
6061
  paginationRoot: "flex min-w-0 flex-wrap items-center justify-between gap-3 text-sm",
8471
6062
  paginationInfo: "min-w-0 text-muted-foreground",
8472
- paginationControls: "flex shrink-0 items-center gap-1.5",
8473
- paginationButton: "inline-flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background px-2.5 text-sm font-medium text-foreground hover:bg-accent/60 disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
6063
+ paginationControls: "flex min-w-0 flex-wrap items-center justify-end gap-1.5",
6064
+ paginationButton: "inline-flex h-8 min-w-8 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-border bg-background px-2.5 text-sm font-medium text-foreground hover:bg-accent/60 disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
8474
6065
  paginationButtonDisabled: "!cursor-not-allowed opacity-50",
8475
- paginationPage: "inline-flex h-8 min-w-8 items-center justify-center rounded-md bg-muted/50 px-2.5 text-sm font-medium text-foreground",
6066
+ paginationPage: "inline-flex h-8 min-w-8 cursor-default items-center justify-center rounded-md bg-muted/50 px-2.5 text-sm font-medium text-foreground hover:bg-muted/50",
6067
+ paginationEllipsis: "inline-flex h-8 min-w-6 items-center justify-center px-1 text-sm text-muted-foreground",
8476
6068
  descriptionListRoot: "grid min-w-0 gap-3 text-sm",
8477
6069
  descriptionListItem: "grid min-w-0 gap-1 rounded-md border border-border/60 bg-background px-3 py-2 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out hover:shadow-sm",
8478
6070
  descriptionListTerm: "min-w-0 truncate text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",
8479
6071
  descriptionListValue: "min-w-0 text-sm leading-6 text-foreground",
8480
6072
  accordionRoot: "grid min-w-0 gap-2",
8481
- accordionItem: "overflow-hidden rounded-lg border border-border/70 bg-background motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
8482
- accordionTrigger: "flex w-full min-w-0 cursor-pointer items-center justify-between gap-3 px-4 py-3 text-left text-sm font-medium text-foreground hover:bg-muted/40 disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out",
6073
+ accordionItem: "overflow-hidden rounded-lg border border-border/70 bg-background motion-safe:transition motion-safe:duration-300 motion-safe:ease-out motion-reduce:transition-none",
6074
+ accordionTrigger: "flex w-full min-w-0 cursor-pointer items-center justify-between gap-3 px-4 py-3 text-start text-sm font-medium text-foreground hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring disabled:!cursor-not-allowed disabled:opacity-50 motion-safe:transition motion-safe:duration-300 motion-safe:ease-out motion-reduce:transition-none",
8483
6075
  accordionTriggerIcon: cn(
8484
6076
  "h-2 w-2 shrink-0 rotate-45 border-b border-r border-current text-muted-foreground",
8485
- motionTransform
6077
+ motionTransform,
6078
+ "motion-reduce:transition-none"
8486
6079
  ),
8487
- accordionPanel: "border-t border-border/60 px-4 py-3 text-sm leading-6 text-muted-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out",
6080
+ accordionPanel: "border-t border-border/60 px-4 py-3 text-sm leading-6 text-muted-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:duration-300 motion-safe:ease-out motion-reduce:animate-none",
8488
6081
  menuTrigger: "inline-flex min-w-0",
8489
6082
  menuContent: "z-50 min-w-44 overflow-hidden rounded-md border border-border bg-background p-1 text-sm text-foreground shadow-lg outline-none motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95 motion-safe:duration-300 motion-safe:ease-out",
8490
6083
  menuLabel: "px-2 py-1.5 text-xs font-medium text-muted-foreground",
@@ -8497,7 +6090,7 @@ var baseSlots = {
8497
6090
  menuItemPrimary: "text-primary focus:text-primary data-[highlighted]:text-primary",
8498
6091
  menuItemSuccess: "text-emerald-700 focus:text-emerald-700 data-[highlighted]:text-emerald-700",
8499
6092
  menuItemWarning: "text-amber-700 focus:text-amber-700 data-[highlighted]:text-amber-700",
8500
- menuItemDanger: "text-destructive focus:text-destructive data-[highlighted]:text-destructive",
6093
+ menuItemDanger: "text-destructive-text focus:text-destructive-text data-[highlighted]:text-destructive-text",
8501
6094
  menuItemMuted: "text-muted-foreground focus:text-foreground data-[highlighted]:text-foreground",
8502
6095
  menuItemDisabled: "!cursor-not-allowed opacity-50 data-[disabled]:pointer-events-none",
8503
6096
  menuItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
@@ -8528,13 +6121,13 @@ var baseSlots = {
8528
6121
  tableBody: "[&_tr:last-child>*]:border-b-0",
8529
6122
  tableFooter: "bg-muted/30 font-medium [&_tr>*]:border-t [&_tr>*]:border-border/70",
8530
6123
  tableFooterBar: cn(
8531
- "flex min-w-0 flex-wrap items-center justify-between gap-3 rounded-lg border border-border/70 bg-muted/20 px-4 py-3 text-sm text-muted-foreground shadow-none",
6124
+ "flex min-w-0 flex-wrap items-center justify-between gap-3 rounded-lg border border-border/70 bg-muted/20 px-4 py-3 text-sm text-foreground shadow-none",
8532
6125
  motionBase
8533
6126
  ),
8534
6127
  tableFooterBarAttached: "-mt-px rounded-t-none border-t border-border/70 shadow-none",
8535
6128
  tableFooterBarLeading: "flex min-w-0 items-center gap-2",
8536
6129
  tableFooterBarContent: "min-w-0 flex-1",
8537
- tableFooterBarActions: "ml-auto flex shrink-0 flex-wrap items-center gap-2",
6130
+ tableFooterBarActions: "ms-auto flex shrink-0 flex-wrap items-center gap-2",
8538
6131
  tableSplitRoot: "grid w-full min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)_auto] caption-bottom border-separate border-spacing-0 text-sm text-foreground",
8539
6132
  tableSplitHeader: "block w-full min-w-0 shrink-0 overflow-x-hidden overflow-y-hidden bg-transparent",
8540
6133
  tableSplitBody: cn(
@@ -8544,7 +6137,7 @@ var baseSlots = {
8544
6137
  tableSplitFooter: "block w-full min-w-0 shrink-0 overflow-x-hidden overflow-y-hidden",
8545
6138
  tableSplitRow: "grid w-max min-w-full [grid-template-columns:var(--base-table-column-template)]",
8546
6139
  tableSplitHead: "flex min-w-0 overflow-hidden",
8547
- tableSplitCell: "block min-w-0 overflow-hidden",
6140
+ tableSplitCell: "block min-w-0 overflow-hidden [overflow-wrap:anywhere]",
8548
6141
  tableRow: cn(
8549
6142
  "[&>*]:border-b [&>*]:border-border/60 data-[state=selected]:bg-primary/5 data-[state=selected]:[&>*]:bg-primary/5",
8550
6143
  motionBase
@@ -8573,8 +6166,11 @@ var baseSlots = {
8573
6166
  "inline-flex h-5 w-4 shrink-0 cursor-grab items-center justify-center rounded-sm text-muted-foreground hover:bg-muted active:cursor-grabbing focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-50",
8574
6167
  motionBase
8575
6168
  ),
8576
- tableHeadResizeHandle: "absolute right-0 top-1/2 h-7 w-2 -translate-y-1/2 cursor-col-resize rounded-sm after:absolute after:left-1/2 after:top-1/2 after:h-5 after:w-px after:-translate-x-1/2 after:-translate-y-1/2 after:bg-border hover:after:bg-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-50",
8577
- tableCell: "px-3 py-2 align-middle text-sm text-foreground",
6169
+ tableHeadResizeHandle: cn(
6170
+ "absolute end-0 top-1/2 h-7 w-2 -translate-y-1/2 cursor-col-resize touch-none rounded-sm after:absolute after:start-1/2 after:top-1/2 after:h-5 after:w-px after:-translate-x-1/2 after:-translate-y-1/2 after:bg-border hover:after:bg-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed disabled:opacity-50",
6171
+ motionBase
6172
+ ),
6173
+ tableCell: "min-w-0 px-3 py-2 align-middle text-sm text-foreground [overflow-wrap:anywhere]",
8578
6174
  tableCellAlignCenter: "text-center",
8579
6175
  tableCellAlignRight: "text-right",
8580
6176
  tableEmptyRow: "[&>*]:border-b [&>*]:border-border/60",
@@ -9528,1532 +7124,6 @@ function resolveBaseAppearance(appearance) {
9528
7124
  )
9529
7125
  };
9530
7126
  }
9531
- function getBaseButtonToneClassName(theme, tone = "default", active = false) {
9532
- return cn(
9533
- tone === "default" && theme.slots.buttonDefault,
9534
- tone === "primary" && theme.slots.buttonPrimary,
9535
- tone === "success" && theme.slots.buttonSuccess,
9536
- tone === "warning" && theme.slots.buttonWarning,
9537
- tone === "danger" && theme.slots.buttonDanger,
9538
- tone === "muted" && theme.slots.buttonMuted,
9539
- active && theme.slots.buttonActive
9540
- );
9541
- }
9542
- function LoadingIcon() {
9543
- return /* @__PURE__ */ jsxRuntime.jsxs(
9544
- "svg",
9545
- {
9546
- "aria-hidden": "true",
9547
- viewBox: "0 0 24 24",
9548
- className: "h-4 w-4 animate-spin",
9549
- fill: "none",
9550
- children: [
9551
- /* @__PURE__ */ jsxRuntime.jsx(
9552
- "circle",
9553
- {
9554
- cx: "12",
9555
- cy: "12",
9556
- r: "9",
9557
- className: "opacity-25",
9558
- stroke: "currentColor",
9559
- strokeWidth: "3"
9560
- }
9561
- ),
9562
- /* @__PURE__ */ jsxRuntime.jsx(
9563
- "path",
9564
- {
9565
- className: "opacity-75",
9566
- fill: "currentColor",
9567
- d: "M12 3a9 9 0 0 1 9 9h-3a6 6 0 0 0-6-6V3Z"
9568
- }
9569
- )
9570
- ]
9571
- }
9572
- );
9573
- }
9574
- react.forwardRef(
9575
- function BaseButton2({
9576
- children,
9577
- label,
9578
- icon,
9579
- endIcon,
9580
- type = "button",
9581
- title,
9582
- ariaLabel,
9583
- tone,
9584
- active = false,
9585
- iconOnly = false,
9586
- disabled = false,
9587
- loading = false,
9588
- stopPropagation = false,
9589
- appearance,
9590
- className,
9591
- classNames,
9592
- style,
9593
- onClick,
9594
- "aria-label": nativeAriaLabel,
9595
- ...buttonProps
9596
- }, ref) {
9597
- const theme = resolveBaseAppearance(appearance);
9598
- const resolvedLabel = children ?? label;
9599
- const labelText = typeof resolvedLabel === "string" ? resolvedLabel : void 0;
9600
- const resolvedAriaLabel = ariaLabel ?? nativeAriaLabel ?? labelText ?? title ?? (iconOnly ? "Action" : void 0);
9601
- const resolvedDisabled = disabled || loading;
9602
- const handleClick = (event) => {
9603
- if (stopPropagation) {
9604
- event.stopPropagation();
9605
- }
9606
- if (resolvedDisabled) return;
9607
- onClick?.(event);
9608
- };
9609
- return /* @__PURE__ */ jsxRuntime.jsxs(
9610
- "button",
9611
- {
9612
- ...buttonProps,
9613
- ref,
9614
- type,
9615
- title,
9616
- "aria-label": resolvedAriaLabel,
9617
- "aria-pressed": active || void 0,
9618
- "aria-busy": loading || void 0,
9619
- disabled: resolvedDisabled,
9620
- className: cn(
9621
- theme.slots.buttonBase,
9622
- iconOnly && theme.slots.buttonIconOnly,
9623
- getBaseButtonToneClassName(theme, tone, active),
9624
- resolvedDisabled && theme.slots.buttonDisabled,
9625
- classNames?.root,
9626
- className
9627
- ),
9628
- style: {
9629
- ...theme.styles.button,
9630
- ...active ? theme.styles.buttonActive : void 0,
9631
- ...resolvedDisabled ? theme.styles.buttonDisabled : void 0,
9632
- ...style
9633
- },
9634
- onClick: handleClick,
9635
- children: [
9636
- loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: /* @__PURE__ */ jsxRuntime.jsx(LoadingIcon, {}) }) : icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: icon }) : null,
9637
- iconOnly ? hasRenderableNode(resolvedLabel) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: resolvedLabel }) : null : hasRenderableNode(resolvedLabel) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.buttonLabel, classNames?.label), children: resolvedLabel }) : null,
9638
- !loading && endIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.buttonIcon, classNames?.icon), children: endIcon }) : null
9639
- ]
9640
- }
9641
- );
9642
- }
9643
- );
9644
- function setRefs(element, ...refs) {
9645
- refs.forEach((ref) => {
9646
- if (!ref) return;
9647
- if (typeof ref === "function") {
9648
- ref(element);
9649
- return;
9650
- }
9651
- ref.current = element;
9652
- });
9653
- }
9654
- react.forwardRef(
9655
- function BaseCheckbox2({
9656
- label,
9657
- description,
9658
- indeterminate = false,
9659
- invalid = false,
9660
- disabled = false,
9661
- appearance,
9662
- className,
9663
- classNames,
9664
- style,
9665
- checked,
9666
- defaultChecked,
9667
- onChange,
9668
- "aria-invalid": nativeAriaInvalid,
9669
- ...checkboxProps
9670
- }, forwardedRef) {
9671
- const theme = resolveBaseAppearance(appearance);
9672
- const inputRef = react.useRef(null);
9673
- const [uncontrolledChecked, setUncontrolledChecked] = react.useState(
9674
- defaultChecked ?? false
9675
- );
9676
- const isControlled = checked !== void 0;
9677
- const resolvedChecked = Boolean(isControlled ? checked : uncontrolledChecked);
9678
- const active = indeterminate || resolvedChecked;
9679
- react.useEffect(() => {
9680
- if (inputRef.current) {
9681
- inputRef.current.indeterminate = indeterminate;
9682
- }
9683
- }, [indeterminate]);
9684
- const handleChange = (event) => {
9685
- if (disabled) return;
9686
- if (!isControlled) {
9687
- setUncontrolledChecked(event.currentTarget.checked);
9688
- }
9689
- onChange?.(event);
9690
- };
9691
- return /* @__PURE__ */ jsxRuntime.jsxs(
9692
- "label",
9693
- {
9694
- className: cn(
9695
- theme.slots.checkboxRoot,
9696
- disabled && theme.slots.checkboxDisabled,
9697
- classNames?.root,
9698
- className
9699
- ),
9700
- style: {
9701
- ...theme.styles.checkboxRoot,
9702
- ...style
9703
- },
9704
- children: [
9705
- /* @__PURE__ */ jsxRuntime.jsxs(
9706
- "span",
9707
- {
9708
- className: cn(
9709
- theme.slots.checkboxBox,
9710
- active && theme.slots.checkboxBoxChecked,
9711
- invalid && theme.slots.checkboxBoxInvalid,
9712
- classNames?.box
9713
- ),
9714
- style: {
9715
- ...theme.styles.checkboxBox
9716
- },
9717
- children: [
9718
- /* @__PURE__ */ jsxRuntime.jsx(
9719
- "input",
9720
- {
9721
- ...checkboxProps,
9722
- ref: (element) => setRefs(element, inputRef, forwardedRef),
9723
- type: "checkbox",
9724
- disabled,
9725
- checked,
9726
- defaultChecked,
9727
- "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
9728
- "aria-checked": indeterminate ? "mixed" : resolvedChecked,
9729
- className: cn(theme.slots.checkboxInput, classNames?.input),
9730
- onChange: handleChange
9731
- }
9732
- ),
9733
- active ? /* @__PURE__ */ jsxRuntime.jsx(
9734
- "span",
9735
- {
9736
- "aria-hidden": "true",
9737
- className: cn(theme.slots.checkboxIndicator, classNames?.indicator),
9738
- children: indeterminate ? "\u2013" : "\u2713"
9739
- }
9740
- ) : null
9741
- ]
9742
- }
9743
- ),
9744
- hasRenderableNode(label) || hasRenderableNode(description) ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(theme.slots.checkboxContent, classNames?.content), children: [
9745
- hasRenderableNode(label) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.checkboxLabel, classNames?.label), children: label }) : null,
9746
- hasRenderableNode(description) ? /* @__PURE__ */ jsxRuntime.jsx(
9747
- "span",
9748
- {
9749
- className: cn(
9750
- theme.slots.checkboxDescription,
9751
- classNames?.description
9752
- ),
9753
- children: description
9754
- }
9755
- ) : null
9756
- ] }) : null
9757
- ]
9758
- }
9759
- );
9760
- }
9761
- );
9762
- react.forwardRef(
9763
- function BaseInput2({
9764
- icon,
9765
- trailing,
9766
- invalid = false,
9767
- disabled = false,
9768
- readOnly = false,
9769
- appearance,
9770
- className,
9771
- classNames,
9772
- style,
9773
- "aria-invalid": nativeAriaInvalid,
9774
- ...inputProps
9775
- }, ref) {
9776
- const theme = resolveBaseAppearance(appearance);
9777
- return /* @__PURE__ */ jsxRuntime.jsxs(
9778
- "div",
9779
- {
9780
- className: cn(
9781
- theme.slots.controlWrapper,
9782
- invalid && theme.slots.controlInvalid,
9783
- disabled && theme.slots.controlDisabled,
9784
- readOnly && theme.slots.controlReadOnly,
9785
- classNames?.root,
9786
- className
9787
- ),
9788
- style: {
9789
- ...theme.styles.control,
9790
- ...invalid ? theme.styles.controlInvalid : void 0,
9791
- ...disabled ? theme.styles.controlDisabled : void 0,
9792
- ...style
9793
- },
9794
- children: [
9795
- hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
9796
- /* @__PURE__ */ jsxRuntime.jsx(
9797
- "input",
9798
- {
9799
- ...inputProps,
9800
- ref,
9801
- disabled,
9802
- readOnly,
9803
- "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
9804
- className: cn(
9805
- theme.slots.controlBase,
9806
- theme.slots.controlInput,
9807
- classNames?.control
9808
- )
9809
- }
9810
- ),
9811
- hasRenderableNode(trailing) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlTrailing, classNames?.trailing), children: trailing }) : null
9812
- ]
9813
- }
9814
- );
9815
- }
9816
- );
9817
- function normalizeValues(values) {
9818
- const nextValues = [];
9819
- const seen = /* @__PURE__ */ new Set();
9820
- values?.forEach((value) => {
9821
- if (seen.has(value)) return;
9822
- seen.add(value);
9823
- nextValues.push(value);
9824
- });
9825
- return nextValues;
9826
- }
9827
- function getNextEnabledIndex(options, currentIndex, direction) {
9828
- if (!options.length) return -1;
9829
- const startIndex = currentIndex >= 0 ? currentIndex : 0;
9830
- for (let offset = 1; offset <= options.length; offset += 1) {
9831
- const nextIndex = (startIndex + offset * direction + options.length) % options.length;
9832
- if (!options[nextIndex]?.disabled) {
9833
- return nextIndex;
9834
- }
9835
- }
9836
- return -1;
9837
- }
9838
- function getFirstEnabledIndex(options) {
9839
- return options.findIndex((option) => !option.disabled);
9840
- }
9841
- function getSafeTagCount(maxTagCount, total) {
9842
- if (maxTagCount === void 0) return total;
9843
- if (!Number.isFinite(maxTagCount)) return total;
9844
- return Math.max(0, Math.min(total, Math.floor(maxTagCount)));
9845
- }
9846
- function getDefaultRemoveLabel(option) {
9847
- return `Remove ${option.value}`;
9848
- }
9849
- react.forwardRef(
9850
- function BaseMultiSelect2({
9851
- options,
9852
- value,
9853
- defaultValue,
9854
- name,
9855
- placeholder = "Select options",
9856
- icon,
9857
- invalid = false,
9858
- disabled = false,
9859
- required = false,
9860
- openForPreview = false,
9861
- maxTagCount,
9862
- removeLabel = getDefaultRemoveLabel,
9863
- emptyLabel = "No options",
9864
- appearance,
9865
- className,
9866
- classNames,
9867
- style,
9868
- id,
9869
- "aria-invalid": nativeAriaInvalid,
9870
- "aria-label": nativeAriaLabel,
9871
- "aria-labelledby": nativeAriaLabelledBy,
9872
- onValueChange,
9873
- ...rootProps
9874
- }, ref) {
9875
- const theme = resolveBaseAppearance(appearance);
9876
- const generatedId = react.useId();
9877
- const multiSelectId = id ?? generatedId;
9878
- const controlId = `${multiSelectId}-control`;
9879
- const listboxId = `${multiSelectId}-listbox`;
9880
- const rootRef = react.useRef(null);
9881
- const optionList = options ?? [];
9882
- const forceOpen = openForPreview;
9883
- const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
9884
- const open = forceOpen || uncontrolledOpen;
9885
- const [uncontrolledValue, setUncontrolledValue] = react.useState(
9886
- () => normalizeValues(defaultValue)
9887
- );
9888
- const [activeIndex, setActiveIndex] = react.useState(
9889
- () => getFirstEnabledIndex(optionList)
9890
- );
9891
- const isControlled = value !== void 0;
9892
- const selectedValues = react.useMemo(
9893
- () => normalizeValues(isControlled ? value : uncontrolledValue),
9894
- [isControlled, uncontrolledValue, value]
9895
- );
9896
- const selectedValueSet = react.useMemo(
9897
- () => new Set(selectedValues),
9898
- [selectedValues]
9899
- );
9900
- const optionByValue = react.useMemo(() => {
9901
- const map = /* @__PURE__ */ new Map();
9902
- optionList.forEach((option) => {
9903
- if (!map.has(option.value)) {
9904
- map.set(option.value, option);
9905
- }
9906
- });
9907
- return map;
9908
- }, [optionList]);
9909
- const selectedOptions = react.useMemo(
9910
- () => selectedValues.map((selectedValue) => optionByValue.get(selectedValue)).filter(
9911
- (option) => option !== void 0
9912
- ),
9913
- [optionByValue, selectedValues]
9914
- );
9915
- const firstEnabledIndex = react.useMemo(
9916
- () => getFirstEnabledIndex(optionList),
9917
- [optionList]
9918
- );
9919
- const resolvedActiveIndex = activeIndex >= 0 && !optionList[activeIndex]?.disabled ? activeIndex : firstEnabledIndex;
9920
- const visibleTagCount = getSafeTagCount(
9921
- maxTagCount,
9922
- selectedOptions.length
9923
- );
9924
- const visibleOptions = selectedOptions.slice(0, visibleTagCount);
9925
- const overflowCount = selectedOptions.length - visibleOptions.length;
9926
- const isPlaceholder = selectedOptions.length === 0;
9927
- const setRootRef = (node) => {
9928
- rootRef.current = node;
9929
- if (typeof ref === "function") {
9930
- ref(node);
9931
- } else if (ref) {
9932
- ref.current = node;
9933
- }
9934
- };
9935
- const setOpen = (nextOpen) => {
9936
- if (disabled || forceOpen) return;
9937
- setUncontrolledOpen(nextOpen);
9938
- if (nextOpen) {
9939
- setActiveIndex(resolvedActiveIndex);
9940
- }
9941
- };
9942
- react.useEffect(() => {
9943
- if (!open || forceOpen) return void 0;
9944
- const handlePointerDown = (event) => {
9945
- if (!rootRef.current?.contains(event.target)) {
9946
- setUncontrolledOpen(false);
9947
- }
9948
- };
9949
- document.addEventListener("pointerdown", handlePointerDown);
9950
- return () => {
9951
- document.removeEventListener("pointerdown", handlePointerDown);
9952
- };
9953
- }, [forceOpen, open]);
9954
- react.useEffect(() => {
9955
- if (resolvedActiveIndex >= 0 && resolvedActiveIndex !== activeIndex) {
9956
- setActiveIndex(resolvedActiveIndex);
9957
- }
9958
- }, [activeIndex, resolvedActiveIndex]);
9959
- const commitValues = (nextValues) => {
9960
- const normalizedValues = normalizeValues(nextValues);
9961
- if (!isControlled) {
9962
- setUncontrolledValue(normalizedValues);
9963
- }
9964
- onValueChange?.(normalizedValues);
9965
- };
9966
- const toggleOption = (option) => {
9967
- if (!option || option.disabled || disabled) return;
9968
- const nextValues = selectedValueSet.has(option.value) ? selectedValues.filter((selectedValue) => selectedValue !== option.value) : [...selectedValues, option.value];
9969
- commitValues(nextValues);
9970
- };
9971
- const removeOption = (option) => {
9972
- if (disabled) return;
9973
- commitValues(
9974
- selectedValues.filter((selectedValue) => selectedValue !== option.value)
9975
- );
9976
- };
9977
- const focusOption = (direction) => {
9978
- const nextIndex = getNextEnabledIndex(
9979
- optionList,
9980
- resolvedActiveIndex,
9981
- direction
9982
- );
9983
- if (nextIndex >= 0) {
9984
- setActiveIndex(nextIndex);
9985
- }
9986
- };
9987
- const handleKeyDown = (event) => {
9988
- if (disabled) return;
9989
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
9990
- event.preventDefault();
9991
- if (!open) {
9992
- setOpen(true);
9993
- setActiveIndex(firstEnabledIndex);
9994
- return;
9995
- }
9996
- focusOption(event.key === "ArrowDown" ? 1 : -1);
9997
- return;
9998
- }
9999
- if (event.key === "Home") {
10000
- event.preventDefault();
10001
- setOpen(true);
10002
- setActiveIndex(firstEnabledIndex);
10003
- return;
10004
- }
10005
- if (event.key === "End") {
10006
- event.preventDefault();
10007
- setOpen(true);
10008
- for (let index = optionList.length - 1; index >= 0; index -= 1) {
10009
- if (!optionList[index]?.disabled) {
10010
- setActiveIndex(index);
10011
- break;
10012
- }
10013
- }
10014
- return;
10015
- }
10016
- if (event.key === "Enter" || event.key === " ") {
10017
- event.preventDefault();
10018
- if (!open) {
10019
- setOpen(true);
10020
- return;
10021
- }
10022
- toggleOption(optionList[resolvedActiveIndex]);
10023
- return;
10024
- }
10025
- if (event.key === "Escape") {
10026
- setOpen(false);
10027
- }
10028
- };
10029
- return /* @__PURE__ */ jsxRuntime.jsxs(
10030
- "div",
10031
- {
10032
- ...rootProps,
10033
- id,
10034
- ref: setRootRef,
10035
- className: cn(
10036
- theme.slots.controlWrapper,
10037
- "overflow-visible",
10038
- open && "z-50",
10039
- invalid && theme.slots.controlInvalid,
10040
- disabled && theme.slots.controlDisabled,
10041
- classNames?.root,
10042
- className
10043
- ),
10044
- style: {
10045
- ...theme.styles.control,
10046
- ...invalid ? theme.styles.controlInvalid : void 0,
10047
- ...disabled ? theme.styles.controlDisabled : void 0,
10048
- ...style
10049
- },
10050
- children: [
10051
- hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
10052
- /* @__PURE__ */ jsxRuntime.jsx(
10053
- "div",
10054
- {
10055
- id: controlId,
10056
- role: "combobox",
10057
- tabIndex: disabled ? -1 : 0,
10058
- "aria-haspopup": "listbox",
10059
- "aria-expanded": open,
10060
- "aria-controls": listboxId,
10061
- "aria-disabled": disabled || void 0,
10062
- "aria-required": required || void 0,
10063
- "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
10064
- "aria-label": nativeAriaLabel,
10065
- "aria-labelledby": nativeAriaLabelledBy,
10066
- className: cn(
10067
- theme.slots.controlBase,
10068
- "flex min-h-9 cursor-pointer flex-wrap items-center gap-1.5 py-1.5 pr-9 text-left",
10069
- disabled && "!cursor-not-allowed",
10070
- classNames?.control
10071
- ),
10072
- onClick: () => setOpen(!open),
10073
- onKeyDown: handleKeyDown,
10074
- children: /* @__PURE__ */ jsxRuntime.jsxs(
10075
- "span",
10076
- {
10077
- className: cn(
10078
- "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
10079
- classNames?.tagList
10080
- ),
10081
- children: [
10082
- visibleOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
10083
- "span",
10084
- {
10085
- className: cn(
10086
- "inline-flex max-w-full items-center gap-1 rounded-full border border-border/70 bg-muted/65 px-2 py-0.5 text-xs font-medium text-foreground",
10087
- classNames?.tag
10088
- ),
10089
- children: [
10090
- /* @__PURE__ */ jsxRuntime.jsx(
10091
- "span",
10092
- {
10093
- className: cn(
10094
- "max-w-40 truncate",
10095
- classNames?.tagLabel
10096
- ),
10097
- children: option.label
10098
- }
10099
- ),
10100
- /* @__PURE__ */ jsxRuntime.jsx(
10101
- "button",
10102
- {
10103
- type: "button",
10104
- "aria-label": removeLabel(option),
10105
- disabled,
10106
- className: cn(
10107
- "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-background/80 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:!cursor-not-allowed",
10108
- classNames?.tagRemove
10109
- ),
10110
- onClick: (event) => {
10111
- event.preventDefault();
10112
- event.stopPropagation();
10113
- removeOption(option);
10114
- },
10115
- onMouseDown: (event) => {
10116
- event.preventDefault();
10117
- event.stopPropagation();
10118
- },
10119
- onKeyDown: (event) => event.stopPropagation(),
10120
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "x" })
10121
- }
10122
- )
10123
- ]
10124
- },
10125
- option.value
10126
- )),
10127
- overflowCount > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
10128
- "span",
10129
- {
10130
- className: cn(
10131
- "inline-flex max-w-full items-center rounded-full border border-border/70 bg-muted/45 px-2 py-0.5 text-xs font-medium text-muted-foreground",
10132
- classNames?.tag
10133
- ),
10134
- children: [
10135
- "+",
10136
- overflowCount
10137
- ]
10138
- }
10139
- ) : null,
10140
- isPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
10141
- "span",
10142
- {
10143
- className: cn(
10144
- "min-w-0 truncate",
10145
- theme.slots.selectPlaceholder,
10146
- classNames?.placeholder
10147
- ),
10148
- children: placeholder
10149
- }
10150
- ) : null
10151
- ]
10152
- }
10153
- )
10154
- }
10155
- ),
10156
- /* @__PURE__ */ jsxRuntime.jsx(
10157
- "span",
10158
- {
10159
- className: cn(
10160
- theme.slots.selectChevron,
10161
- open && "rotate-[225deg]",
10162
- classNames?.chevron
10163
- )
10164
- }
10165
- ),
10166
- name ? selectedValues.map((selectedValue) => /* @__PURE__ */ jsxRuntime.jsx(
10167
- "input",
10168
- {
10169
- type: "hidden",
10170
- name,
10171
- value: selectedValue,
10172
- className: classNames?.hiddenInput
10173
- },
10174
- selectedValue
10175
- )) : null,
10176
- open ? /* @__PURE__ */ jsxRuntime.jsx(
10177
- "div",
10178
- {
10179
- id: listboxId,
10180
- role: "listbox",
10181
- "aria-multiselectable": "true",
10182
- "aria-labelledby": controlId,
10183
- className: cn(theme.slots.selectMenu, classNames?.menu),
10184
- style: theme.styles.selectMenu,
10185
- children: optionList.length > 0 ? optionList.map((option, index) => {
10186
- const selected = selectedValueSet.has(option.value);
10187
- const active = index === resolvedActiveIndex;
10188
- return /* @__PURE__ */ jsxRuntime.jsxs(
10189
- "button",
10190
- {
10191
- type: "button",
10192
- role: "option",
10193
- "aria-selected": selected,
10194
- disabled: option.disabled,
10195
- className: cn(
10196
- theme.slots.selectOption,
10197
- "gap-2",
10198
- active && theme.slots.selectOptionActive,
10199
- selected && theme.slots.selectOptionSelected,
10200
- option.disabled && theme.slots.selectOptionDisabled,
10201
- classNames?.option
10202
- ),
10203
- style: {
10204
- ...theme.styles.selectOption,
10205
- ...active ? theme.styles.selectOptionActive : void 0,
10206
- ...selected ? theme.styles.selectOptionSelected : void 0
10207
- },
10208
- onMouseEnter: () => {
10209
- if (!option.disabled) {
10210
- setActiveIndex(index);
10211
- }
10212
- },
10213
- onMouseDown: (event) => event.preventDefault(),
10214
- onClick: () => toggleOption(option),
10215
- children: [
10216
- /* @__PURE__ */ jsxRuntime.jsx(
10217
- "span",
10218
- {
10219
- "aria-hidden": "true",
10220
- className: cn(
10221
- "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-border/70 text-[10px]",
10222
- selected && "border-primary/40 bg-primary text-primary-foreground",
10223
- classNames?.optionIndicator
10224
- ),
10225
- children: selected ? "\u2713" : null
10226
- }
10227
- ),
10228
- /* @__PURE__ */ jsxRuntime.jsx(
10229
- "span",
10230
- {
10231
- className: cn(
10232
- "min-w-0 flex-1 truncate",
10233
- classNames?.optionLabel
10234
- ),
10235
- children: option.label
10236
- }
10237
- )
10238
- ]
10239
- },
10240
- option.value
10241
- );
10242
- }) : /* @__PURE__ */ jsxRuntime.jsx(
10243
- "div",
10244
- {
10245
- className: cn(
10246
- "px-2.5 py-2 text-sm text-muted-foreground",
10247
- classNames?.empty
10248
- ),
10249
- children: emptyLabel
10250
- }
10251
- )
10252
- }
10253
- ) : null
10254
- ]
10255
- }
10256
- );
10257
- }
10258
- );
10259
- function findOption(options, value) {
10260
- if (value === void 0) return void 0;
10261
- return options.find((option) => option.value === value);
10262
- }
10263
- function getInitialValue(options, defaultValue) {
10264
- if (typeof defaultValue === "string") {
10265
- return defaultValue;
10266
- }
10267
- return "";
10268
- }
10269
- function getNextEnabledIndex2(options, currentIndex, direction) {
10270
- if (!options.length) return -1;
10271
- for (let offset = 1; offset <= options.length; offset += 1) {
10272
- const nextIndex = (currentIndex + offset * direction + options.length) % options.length;
10273
- if (!options[nextIndex]?.disabled) {
10274
- return nextIndex;
10275
- }
10276
- }
10277
- return -1;
10278
- }
10279
- react.forwardRef(
10280
- function BaseSelect2({
10281
- options,
10282
- placeholder,
10283
- icon,
10284
- invalid = false,
10285
- disabled = false,
10286
- openForPreview = false,
10287
- appearance,
10288
- className,
10289
- classNames,
10290
- style,
10291
- children,
10292
- value,
10293
- defaultValue,
10294
- onChange,
10295
- name,
10296
- id,
10297
- required,
10298
- "aria-invalid": nativeAriaInvalid,
10299
- "aria-label": nativeAriaLabel,
10300
- "aria-labelledby": nativeAriaLabelledBy,
10301
- ...selectProps
10302
- }, ref) {
10303
- const theme = resolveBaseAppearance(appearance);
10304
- const generatedId = react.useId();
10305
- const selectId = id ?? generatedId;
10306
- const listboxId = `${selectId}-listbox`;
10307
- const rootRef = react.useRef(null);
10308
- const selectRef = react.useRef(null);
10309
- const optionList = options ?? [];
10310
- const isCustomSelect = optionList.length > 0;
10311
- const forceOpen = openForPreview;
10312
- const [uncontrolledOpen, setUncontrolledOpen] = react.useState(false);
10313
- const open = forceOpen || uncontrolledOpen;
10314
- const [uncontrolledValue, setUncontrolledValue] = react.useState(
10315
- () => getInitialValue(optionList, defaultValue)
10316
- );
10317
- const isControlled = value !== void 0;
10318
- const selectedValue = String(isControlled ? value : uncontrolledValue);
10319
- const selectedOption = findOption(optionList, selectedValue);
10320
- const activeIndex = react.useMemo(() => {
10321
- const selectedIndex = optionList.findIndex(
10322
- (option) => option.value === selectedValue && !option.disabled
10323
- );
10324
- if (selectedIndex >= 0) return selectedIndex;
10325
- return optionList.findIndex((option) => !option.disabled);
10326
- }, [optionList, selectedValue]);
10327
- const visibleLabel = selectedOption?.label ?? placeholder;
10328
- const isPlaceholder = !selectedOption;
10329
- const setSelectRef = (node) => {
10330
- selectRef.current = node;
10331
- if (typeof ref === "function") {
10332
- ref(node);
10333
- } else if (ref) {
10334
- ref.current = node;
10335
- }
10336
- };
10337
- react.useEffect(() => {
10338
- if (!open || forceOpen) return void 0;
10339
- const handlePointerDown = (event) => {
10340
- if (!rootRef.current?.contains(event.target)) {
10341
- setUncontrolledOpen(false);
10342
- }
10343
- };
10344
- document.addEventListener("pointerdown", handlePointerDown);
10345
- return () => {
10346
- document.removeEventListener("pointerdown", handlePointerDown);
10347
- };
10348
- }, [forceOpen, open]);
10349
- const notifyChange = (nextValue) => {
10350
- const selectElement = selectRef.current;
10351
- if (!selectElement) return;
10352
- const valueSetter = Object.getOwnPropertyDescriptor(
10353
- HTMLSelectElement.prototype,
10354
- "value"
10355
- )?.set;
10356
- valueSetter?.call(selectElement, nextValue);
10357
- selectElement.dispatchEvent(new Event("change", { bubbles: true }));
10358
- };
10359
- const commitValue = (nextValue, optionDisabled) => {
10360
- if (optionDisabled || disabled) return;
10361
- if (!isControlled) {
10362
- setUncontrolledValue(nextValue);
10363
- }
10364
- notifyChange(nextValue);
10365
- if (!forceOpen) {
10366
- setUncontrolledOpen(false);
10367
- }
10368
- };
10369
- const focusOption = (direction) => {
10370
- const currentIndex = activeIndex >= 0 ? activeIndex : 0;
10371
- const nextIndex = getNextEnabledIndex2(optionList, currentIndex, direction);
10372
- if (nextIndex >= 0) {
10373
- commitValue(optionList[nextIndex].value, optionList[nextIndex].disabled);
10374
- }
10375
- };
10376
- const handleKeyDown = (event) => {
10377
- if (disabled) return;
10378
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
10379
- event.preventDefault();
10380
- if (!open) {
10381
- setUncontrolledOpen(true);
10382
- return;
10383
- }
10384
- focusOption(event.key === "ArrowDown" ? 1 : -1);
10385
- return;
10386
- }
10387
- if (event.key === "Enter" || event.key === " ") {
10388
- event.preventDefault();
10389
- if (!forceOpen) {
10390
- setUncontrolledOpen((current) => !current);
10391
- }
10392
- return;
10393
- }
10394
- if (event.key === "Escape") {
10395
- setUncontrolledOpen(false);
10396
- }
10397
- };
10398
- if (!isCustomSelect) {
10399
- return /* @__PURE__ */ jsxRuntime.jsxs(
10400
- "div",
10401
- {
10402
- className: cn(
10403
- theme.slots.controlWrapper,
10404
- invalid && theme.slots.controlInvalid,
10405
- disabled && theme.slots.controlDisabled,
10406
- classNames?.root,
10407
- className
10408
- ),
10409
- style: {
10410
- ...theme.styles.control,
10411
- ...invalid ? theme.styles.controlInvalid : void 0,
10412
- ...disabled ? theme.styles.controlDisabled : void 0,
10413
- ...style
10414
- },
10415
- children: [
10416
- hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
10417
- /* @__PURE__ */ jsxRuntime.jsxs(
10418
- "select",
10419
- {
10420
- ...selectProps,
10421
- id,
10422
- ref,
10423
- name,
10424
- value,
10425
- defaultValue,
10426
- required,
10427
- disabled,
10428
- "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
10429
- "aria-label": nativeAriaLabel,
10430
- "aria-labelledby": nativeAriaLabelledBy,
10431
- onChange,
10432
- className: cn(
10433
- theme.slots.controlBase,
10434
- theme.slots.controlSelect,
10435
- classNames?.control
10436
- ),
10437
- children: [
10438
- hasRenderableNode(placeholder) ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: placeholder }) : null,
10439
- children
10440
- ]
10441
- }
10442
- ),
10443
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: theme.slots.selectChevron })
10444
- ]
10445
- }
10446
- );
10447
- }
10448
- return /* @__PURE__ */ jsxRuntime.jsxs(
10449
- "div",
10450
- {
10451
- ref: rootRef,
10452
- className: cn(
10453
- theme.slots.controlWrapper,
10454
- "overflow-visible",
10455
- open && "z-50",
10456
- invalid && theme.slots.controlInvalid,
10457
- disabled && theme.slots.controlDisabled,
10458
- classNames?.root,
10459
- className
10460
- ),
10461
- style: {
10462
- ...theme.styles.control,
10463
- ...invalid ? theme.styles.controlInvalid : void 0,
10464
- ...disabled ? theme.styles.controlDisabled : void 0,
10465
- ...style
10466
- },
10467
- children: [
10468
- hasRenderableNode(icon) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.controlIcon, classNames?.icon), children: icon }) : null,
10469
- /* @__PURE__ */ jsxRuntime.jsx(
10470
- "button",
10471
- {
10472
- type: "button",
10473
- id: `${selectId}-button`,
10474
- disabled,
10475
- "aria-haspopup": "listbox",
10476
- "aria-expanded": open,
10477
- "aria-controls": listboxId,
10478
- "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
10479
- "aria-label": nativeAriaLabel,
10480
- "aria-labelledby": nativeAriaLabelledBy,
10481
- className: cn(
10482
- theme.slots.controlBase,
10483
- theme.slots.controlSelect,
10484
- "flex items-center text-left",
10485
- classNames?.control
10486
- ),
10487
- onClick: () => {
10488
- if (!forceOpen) {
10489
- setUncontrolledOpen((current) => !current);
10490
- }
10491
- },
10492
- onKeyDown: handleKeyDown,
10493
- children: /* @__PURE__ */ jsxRuntime.jsx(
10494
- "span",
10495
- {
10496
- className: cn(
10497
- "min-w-0 flex-1 truncate",
10498
- isPlaceholder && theme.slots.selectPlaceholder,
10499
- isPlaceholder && classNames?.placeholder
10500
- ),
10501
- children: visibleLabel
10502
- }
10503
- )
10504
- }
10505
- ),
10506
- /* @__PURE__ */ jsxRuntime.jsx(
10507
- "span",
10508
- {
10509
- className: cn(
10510
- theme.slots.selectChevron,
10511
- open && "rotate-[225deg]"
10512
- )
10513
- }
10514
- ),
10515
- /* @__PURE__ */ jsxRuntime.jsxs(
10516
- "select",
10517
- {
10518
- ...selectProps,
10519
- ref: setSelectRef,
10520
- id,
10521
- name,
10522
- value: selectedValue,
10523
- required,
10524
- disabled,
10525
- "aria-hidden": "true",
10526
- tabIndex: -1,
10527
- className: theme.slots.selectNative,
10528
- onChange,
10529
- children: [
10530
- hasRenderableNode(placeholder) ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: placeholder }) : null,
10531
- optionList.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
10532
- "option",
10533
- {
10534
- value: option.value,
10535
- disabled: option.disabled,
10536
- children: typeof option.label === "string" ? option.label : option.value
10537
- },
10538
- option.value
10539
- ))
10540
- ]
10541
- }
10542
- ),
10543
- open ? /* @__PURE__ */ jsxRuntime.jsx(
10544
- "div",
10545
- {
10546
- id: listboxId,
10547
- role: "listbox",
10548
- "aria-labelledby": `${selectId}-button`,
10549
- className: cn(theme.slots.selectMenu, classNames?.menu),
10550
- style: theme.styles.selectMenu,
10551
- children: optionList.map((option, index) => {
10552
- const selected = option.value === selectedValue;
10553
- const active = index === activeIndex;
10554
- return /* @__PURE__ */ jsxRuntime.jsx(
10555
- "button",
10556
- {
10557
- type: "button",
10558
- role: "option",
10559
- "aria-selected": selected,
10560
- disabled: option.disabled,
10561
- className: cn(
10562
- theme.slots.selectOption,
10563
- active && theme.slots.selectOptionActive,
10564
- selected && theme.slots.selectOptionSelected,
10565
- option.disabled && theme.slots.selectOptionDisabled,
10566
- classNames?.option
10567
- ),
10568
- style: {
10569
- ...theme.styles.selectOption,
10570
- ...active ? theme.styles.selectOptionActive : void 0,
10571
- ...selected ? theme.styles.selectOptionSelected : void 0
10572
- },
10573
- onMouseDown: (event) => event.preventDefault(),
10574
- onClick: () => commitValue(option.value, option.disabled),
10575
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", children: option.label })
10576
- },
10577
- option.value
10578
- );
10579
- })
10580
- }
10581
- ) : null
10582
- ]
10583
- }
10584
- );
10585
- }
10586
- );
10587
- react.forwardRef(
10588
- function BaseSwitch2({
10589
- label,
10590
- description,
10591
- disabled = false,
10592
- appearance,
10593
- className,
10594
- classNames,
10595
- style,
10596
- checked,
10597
- defaultChecked,
10598
- onChange,
10599
- ...switchProps
10600
- }, ref) {
10601
- const theme = resolveBaseAppearance(appearance);
10602
- const [uncontrolledChecked, setUncontrolledChecked] = react.useState(
10603
- defaultChecked ?? false
10604
- );
10605
- const isControlled = checked !== void 0;
10606
- const resolvedChecked = isControlled ? checked : uncontrolledChecked;
10607
- const handleChange = (event) => {
10608
- if (!isControlled) {
10609
- setUncontrolledChecked(event.currentTarget.checked);
10610
- }
10611
- onChange?.(event);
10612
- };
10613
- return /* @__PURE__ */ jsxRuntime.jsxs(
10614
- "label",
10615
- {
10616
- className: cn(
10617
- theme.slots.switchRoot,
10618
- disabled && theme.slots.switchDisabled,
10619
- classNames?.root,
10620
- className
10621
- ),
10622
- style: {
10623
- ...theme.styles.switchRoot,
10624
- ...style
10625
- },
10626
- children: [
10627
- /* @__PURE__ */ jsxRuntime.jsxs(
10628
- "span",
10629
- {
10630
- className: cn(
10631
- theme.slots.switchTrack,
10632
- resolvedChecked && theme.slots.switchChecked,
10633
- classNames?.track
10634
- ),
10635
- style: theme.styles.switchTrack,
10636
- children: [
10637
- /* @__PURE__ */ jsxRuntime.jsx(
10638
- "input",
10639
- {
10640
- ...switchProps,
10641
- ref,
10642
- type: "checkbox",
10643
- disabled,
10644
- checked,
10645
- defaultChecked,
10646
- onChange: handleChange,
10647
- className: cn(theme.slots.switchInput, classNames?.input)
10648
- }
10649
- ),
10650
- /* @__PURE__ */ jsxRuntime.jsx(
10651
- "span",
10652
- {
10653
- className: cn(
10654
- theme.slots.switchThumb,
10655
- resolvedChecked && "translate-x-5",
10656
- classNames?.thumb
10657
- ),
10658
- style: theme.styles.switchThumb
10659
- }
10660
- )
10661
- ]
10662
- }
10663
- ),
10664
- hasRenderableNode(label) || hasRenderableNode(description) ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(theme.slots.switchContent, classNames?.content), children: [
10665
- hasRenderableNode(label) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.switchLabel, classNames?.label), children: label }) : null,
10666
- hasRenderableNode(description) ? /* @__PURE__ */ jsxRuntime.jsx(
10667
- "span",
10668
- {
10669
- className: cn(
10670
- theme.slots.switchDescription,
10671
- classNames?.description
10672
- ),
10673
- children: description
10674
- }
10675
- ) : null
10676
- ] }) : null
10677
- ]
10678
- }
10679
- );
10680
- }
10681
- );
10682
- var DATA_TRANSFER_COLUMN_TYPE = "application/x-monkeys-base-table-column";
10683
- var BaseTableContext = react.createContext(null);
10684
- function useBaseTableContext(appearance) {
10685
- const context = react.useContext(BaseTableContext);
10686
- if (context) {
10687
- return {
10688
- ...context,
10689
- theme: appearance ? resolveBaseAppearance(appearance) : context.theme,
10690
- appearance: appearance ?? context.appearance
10691
- };
10692
- }
10693
- const theme = resolveBaseAppearance(appearance);
10694
- return {
10695
- appearance,
10696
- theme,
10697
- layout: "native",
10698
- setDraggingColumnId: () => {
10699
- }
10700
- };
10701
- }
10702
- function toCssSize(value) {
10703
- if (value === void 0) return void 0;
10704
- return typeof value === "number" ? `${value}px` : value;
10705
- }
10706
- function clampWidth(value, minWidth, maxWidth) {
10707
- const min5 = minWidth ?? 48;
10708
- const max5 = maxWidth ?? Number.POSITIVE_INFINITY;
10709
- return Math.min(Math.max(value, min5), max5);
10710
- }
10711
- function getNextColumnOrder(order, columnId, targetColumnId) {
10712
- if (!order || columnId === targetColumnId) return void 0;
10713
- const fromIndex = order.indexOf(columnId);
10714
- const toIndex = order.indexOf(targetColumnId);
10715
- if (fromIndex < 0 || toIndex < 0) return void 0;
10716
- const next = [...order];
10717
- const [moved] = next.splice(fromIndex, 1);
10718
- next.splice(toIndex, 0, moved);
10719
- return next;
10720
- }
10721
- function sortAriaValue(direction) {
10722
- switch (direction) {
10723
- case "asc":
10724
- return "ascending";
10725
- case "desc":
10726
- return "descending";
10727
- default:
10728
- return void 0;
10729
- }
10730
- }
10731
- function getSplitHeadJustifyContent(align) {
10732
- switch (align) {
10733
- case "center":
10734
- return "center";
10735
- case "right":
10736
- return "flex-end";
10737
- default:
10738
- return "flex-start";
10739
- }
10740
- }
10741
- function getSplitHeadAlignItems(verticalAlign) {
10742
- switch (verticalAlign) {
10743
- case "top":
10744
- return "flex-start";
10745
- case "bottom":
10746
- return "flex-end";
10747
- default:
10748
- return "center";
10749
- }
10750
- }
10751
- function SortIndicator({
10752
- direction,
10753
- className
10754
- }) {
10755
- return /* @__PURE__ */ jsxRuntime.jsx(
10756
- "span",
10757
- {
10758
- "aria-hidden": "true",
10759
- className: cn(
10760
- className,
10761
- direction === "desc" && "rotate-180",
10762
- (!direction || direction === "none") && "opacity-45"
10763
- ),
10764
- children: "\u25B2"
10765
- }
10766
- );
10767
- }
10768
- function DragHandleIcon() {
10769
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { "aria-hidden": "true", className: "grid gap-0.5", children: [
10770
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
10771
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" }),
10772
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-current" })
10773
- ] });
10774
- }
10775
- react.forwardRef(function BaseTableHead2({
10776
- columnId,
10777
- align,
10778
- verticalAlign,
10779
- icon,
10780
- label,
10781
- description,
10782
- meta,
10783
- actions,
10784
- trailing,
10785
- sortable,
10786
- sortDirection = "none",
10787
- sortLabel,
10788
- onSort,
10789
- draggable,
10790
- dragLabel,
10791
- resizable,
10792
- resizeLabel,
10793
- width,
10794
- minWidth,
10795
- maxWidth,
10796
- appearance,
10797
- className,
10798
- classNames,
10799
- style,
10800
- children,
10801
- onDragOver,
10802
- onDrop,
10803
- ...headProps
10804
- }, forwardedRef) {
10805
- const tableContext = useBaseTableContext(appearance);
10806
- const { theme } = tableContext;
10807
- const isSplitScroll = tableContext.layout === "split-scroll";
10808
- const resolvedAlign = align ?? (isSplitScroll ? "center" : "left");
10809
- const resolvedVerticalAlign = verticalAlign ?? "middle";
10810
- const headRef = react.useRef(null);
10811
- const setHeadRef = (node) => {
10812
- headRef.current = node;
10813
- if (typeof forwardedRef === "function") {
10814
- forwardedRef(node);
10815
- } else if (forwardedRef) {
10816
- forwardedRef.current = node;
10817
- }
10818
- };
10819
- const controlledWidth = columnId && tableContext.columnSizes?.[columnId] !== void 0 ? tableContext.columnSizes[columnId] : width;
10820
- const canDrag = Boolean(
10821
- columnId && draggable !== false && (draggable || tableContext.columnDragEnabled) && tableContext.columnOrder && tableContext.onColumnOrderChange
10822
- );
10823
- const canResize = Boolean(
10824
- columnId && resizable !== false && (resizable || tableContext.columnResizeEnabled) && tableContext.onColumnSizeChange
10825
- );
10826
- const interactiveSort = Boolean(sortable || onSort);
10827
- const ariaSort = sortAriaValue(sortDirection);
10828
- const content = hasRenderableNode(label) ? label : children;
10829
- const usesRichHeader = canDrag || hasRenderableNode(icon) || hasRenderableNode(label) || hasRenderableNode(description) || hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) || interactiveSort;
10830
- const renderedContent = usesRichHeader ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(theme.slots.tableHeadContent, classNames?.content), children: [
10831
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(theme.slots.tableHeadMain, classNames?.main), children: [
10832
- canDrag ? /* @__PURE__ */ jsxRuntime.jsx(
10833
- "button",
10834
- {
10835
- type: "button",
10836
- draggable: true,
10837
- title: dragLabel,
10838
- "aria-label": dragLabel ?? `Drag column ${columnId}`,
10839
- className: cn(theme.slots.tableHeadDragHandle, classNames?.dragHandle),
10840
- onClick: (event) => event.stopPropagation(),
10841
- onDragStart: (event) => {
10842
- event.stopPropagation();
10843
- tableContext.setDraggingColumnId(columnId);
10844
- event.dataTransfer.effectAllowed = "move";
10845
- event.dataTransfer.setData(DATA_TRANSFER_COLUMN_TYPE, columnId);
10846
- },
10847
- onDragEnd: (event) => {
10848
- event.stopPropagation();
10849
- tableContext.setDraggingColumnId(void 0);
10850
- },
10851
- children: /* @__PURE__ */ jsxRuntime.jsx(DragHandleIcon, {})
10852
- }
10853
- ) : null,
10854
- icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.tableHeadIcon, classNames?.icon), children: icon }) : null,
10855
- interactiveSort ? /* @__PURE__ */ jsxRuntime.jsxs(
10856
- "button",
10857
- {
10858
- type: "button",
10859
- disabled: !onSort,
10860
- title: sortLabel,
10861
- className: cn(theme.slots.tableHeadSortButton, classNames?.sortButton),
10862
- onClick: (event) => {
10863
- event.stopPropagation();
10864
- onSort?.(columnId);
10865
- },
10866
- children: [
10867
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
10868
- hasRenderableNode(content) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
10869
- hasRenderableNode(description) ? /* @__PURE__ */ jsxRuntime.jsx(
10870
- "span",
10871
- {
10872
- className: cn(
10873
- theme.slots.tableHeadDescription,
10874
- classNames?.description
10875
- ),
10876
- children: description
10877
- }
10878
- ) : null
10879
- ] }),
10880
- /* @__PURE__ */ jsxRuntime.jsx(
10881
- SortIndicator,
10882
- {
10883
- direction: sortDirection,
10884
- className: cn(theme.slots.tableHeadSortIcon, classNames?.sortIcon)
10885
- }
10886
- )
10887
- ]
10888
- }
10889
- ) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(theme.slots.tableHeadText, classNames?.text), children: [
10890
- hasRenderableNode(content) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.tableHeadLabel, classNames?.label), children: content }) : null,
10891
- hasRenderableNode(description) ? /* @__PURE__ */ jsxRuntime.jsx(
10892
- "span",
10893
- {
10894
- className: cn(
10895
- theme.slots.tableHeadDescription,
10896
- classNames?.description
10897
- ),
10898
- children: description
10899
- }
10900
- ) : null
10901
- ] })
10902
- ] }),
10903
- hasRenderableNode(meta) || hasRenderableNode(actions) || hasRenderableNode(trailing) ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(theme.slots.tableHeadActions, classNames?.actions), children: [
10904
- hasRenderableNode(meta) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.tableHeadMeta, classNames?.meta), children: meta }) : null,
10905
- actions,
10906
- trailing
10907
- ] }) : null
10908
- ] }) : children;
10909
- const handleDragOver = (event) => {
10910
- onDragOver?.(event);
10911
- if (!canDrag || !tableContext.draggingColumnId || tableContext.draggingColumnId === columnId) {
10912
- return;
10913
- }
10914
- event.preventDefault();
10915
- event.dataTransfer.dropEffect = "move";
10916
- };
10917
- const handleDrop = (event) => {
10918
- onDrop?.(event);
10919
- if (!canDrag || !columnId) return;
10920
- const sourceColumnId = tableContext.draggingColumnId || event.dataTransfer.getData(DATA_TRANSFER_COLUMN_TYPE);
10921
- if (!sourceColumnId || sourceColumnId === columnId) return;
10922
- const nextOrder = getNextColumnOrder(
10923
- tableContext.columnOrder,
10924
- sourceColumnId,
10925
- columnId
10926
- );
10927
- if (nextOrder) {
10928
- event.preventDefault();
10929
- tableContext.onColumnOrderChange?.(nextOrder, {
10930
- columnId: sourceColumnId,
10931
- targetColumnId: columnId
10932
- });
10933
- }
10934
- tableContext.setDraggingColumnId(void 0);
10935
- };
10936
- const handleResizePointerDown = (event) => {
10937
- if (!canResize || !columnId || !tableContext.onColumnSizeChange) return;
10938
- event.preventDefault();
10939
- event.stopPropagation();
10940
- const startX = event.clientX;
10941
- const currentWidth = typeof controlledWidth === "number" ? controlledWidth : headRef.current?.offsetWidth ?? minWidth ?? 96;
10942
- const previousWidth = clampWidth(currentWidth, minWidth, maxWidth);
10943
- const pointerId = event.pointerId;
10944
- const target = event.currentTarget;
10945
- target.setPointerCapture?.(pointerId);
10946
- const handlePointerMove = (moveEvent) => {
10947
- const nextWidth = clampWidth(
10948
- previousWidth + moveEvent.clientX - startX,
10949
- minWidth,
10950
- maxWidth
10951
- );
10952
- tableContext.onColumnSizeChange?.(columnId, nextWidth, {
10953
- columnId,
10954
- previousWidth,
10955
- minWidth,
10956
- maxWidth
10957
- });
10958
- };
10959
- const cleanup = () => {
10960
- target.releasePointerCapture?.(pointerId);
10961
- window.removeEventListener("pointermove", handlePointerMove);
10962
- window.removeEventListener("pointerup", cleanup);
10963
- window.removeEventListener("pointercancel", cleanup);
10964
- };
10965
- window.addEventListener("pointermove", handlePointerMove);
10966
- window.addEventListener("pointerup", cleanup);
10967
- window.addEventListener("pointercancel", cleanup);
10968
- };
10969
- return /* @__PURE__ */ jsxRuntime.jsxs(
10970
- "th",
10971
- {
10972
- ...headProps,
10973
- ref: setHeadRef,
10974
- scope: headProps.scope ?? "col",
10975
- "aria-sort": ariaSort,
10976
- className: cn(
10977
- theme.slots.tableHead,
10978
- isSplitScroll && theme.slots.tableSplitHead,
10979
- resolvedAlign === "center" && theme.slots.tableCellAlignCenter,
10980
- resolvedAlign === "right" && theme.slots.tableCellAlignRight,
10981
- classNames?.root,
10982
- className
10983
- ),
10984
- style: {
10985
- ...theme.styles.tableHead,
10986
- ...isSplitScroll ? theme.styles.tableSplitHead : void 0,
10987
- width: isSplitScroll ? void 0 : toCssSize(controlledWidth),
10988
- minWidth: isSplitScroll ? void 0 : toCssSize(minWidth),
10989
- maxWidth: isSplitScroll ? void 0 : toCssSize(maxWidth),
10990
- ...isSplitScroll ? {
10991
- alignItems: getSplitHeadAlignItems(resolvedVerticalAlign),
10992
- justifyContent: getSplitHeadJustifyContent(resolvedAlign),
10993
- textAlign: resolvedAlign
10994
- } : verticalAlign ? { verticalAlign } : void 0,
10995
- ...style
10996
- },
10997
- onDragOver: handleDragOver,
10998
- onDrop: handleDrop,
10999
- children: [
11000
- renderedContent,
11001
- canResize ? /* @__PURE__ */ jsxRuntime.jsx(
11002
- "button",
11003
- {
11004
- type: "button",
11005
- title: resizeLabel,
11006
- "aria-label": resizeLabel ?? `Resize column ${columnId}`,
11007
- className: cn(theme.slots.tableHeadResizeHandle, classNames?.resizeHandle),
11008
- onClick: (event) => event.stopPropagation(),
11009
- onPointerDown: handleResizePointerDown
11010
- }
11011
- ) : null
11012
- ]
11013
- }
11014
- );
11015
- });
11016
- react.forwardRef(
11017
- function BaseTextarea2({
11018
- invalid = false,
11019
- disabled = false,
11020
- readOnly = false,
11021
- appearance,
11022
- className,
11023
- classNames,
11024
- style,
11025
- "aria-invalid": nativeAriaInvalid,
11026
- ...textareaProps
11027
- }, ref) {
11028
- const theme = resolveBaseAppearance(appearance);
11029
- return /* @__PURE__ */ jsxRuntime.jsx(
11030
- "textarea",
11031
- {
11032
- ...textareaProps,
11033
- ref,
11034
- disabled,
11035
- readOnly,
11036
- "aria-invalid": nativeAriaInvalid ?? (invalid || void 0),
11037
- className: cn(
11038
- theme.slots.controlWrapper,
11039
- theme.slots.controlBase,
11040
- theme.slots.controlTextarea,
11041
- invalid && theme.slots.controlInvalid,
11042
- disabled && theme.slots.controlDisabled,
11043
- readOnly && theme.slots.controlReadOnly,
11044
- classNames?.control,
11045
- className
11046
- ),
11047
- style: {
11048
- ...theme.styles.control,
11049
- ...invalid ? theme.styles.controlInvalid : void 0,
11050
- ...disabled ? theme.styles.controlDisabled : void 0,
11051
- ...style
11052
- }
11053
- }
11054
- );
11055
- }
11056
- );
11057
7127
 
11058
7128
  // src/components/data-explorer/utils.ts
11059
7129
  function cn2(...parts) {
@@ -11079,7 +7149,7 @@ var baseSlots2 = {
11079
7149
  actionButtonBase: "inline-flex h-9 items-center justify-center gap-2 rounded-md border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
11080
7150
  actionButtonDefault: "border-border bg-background text-foreground hover:bg-accent/60",
11081
7151
  actionButtonPrimary: "border-primary/20 bg-primary/10 text-primary hover:bg-primary/15",
11082
- actionButtonDanger: "border-destructive/20 bg-destructive/10 text-destructive hover:bg-destructive/15",
7152
+ actionButtonDanger: "border-destructive/20 bg-destructive/10 text-destructive-text hover:bg-destructive/15",
11083
7153
  actionButtonMuted: "border-border/60 bg-muted/45 text-muted-foreground hover:bg-muted/70 hover:text-foreground",
11084
7154
  actionButtonActive: "ring-1 ring-primary/30",
11085
7155
  actionButtonDisabled: "cursor-not-allowed opacity-60",
@@ -11099,7 +7169,7 @@ var baseSlots2 = {
11099
7169
  menuSeparator: "-mx-1 my-1 h-px bg-border",
11100
7170
  menuItem: "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
11101
7171
  menuItemPrimary: "text-primary focus:text-primary",
11102
- menuItemDanger: "text-destructive focus:text-destructive",
7172
+ menuItemDanger: "text-destructive-text focus:text-destructive-text",
11103
7173
  menuItemMuted: "text-muted-foreground",
11104
7174
  menuItemIcon: "inline-flex h-4 w-4 shrink-0 items-center justify-center",
11105
7175
  menuItemLabel: "truncate",
@@ -11154,7 +7224,7 @@ var baseSlots2 = {
11154
7224
  treeNodeChildren: "mt-0.5 min-w-0 space-y-0.5",
11155
7225
  treeNodeDragHandle: "inline-flex h-5 w-5 shrink-0 cursor-grab items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground active:cursor-grabbing group-hover/tree-node:opacity-100",
11156
7226
  treeEmpty: "px-3 py-2 text-xs text-muted-foreground",
11157
- treeError: "px-3 py-2 text-xs text-destructive",
7227
+ treeError: "px-3 py-2 text-xs text-destructive-text",
11158
7228
  treeLoading: "px-3 py-2 text-xs text-muted-foreground"
11159
7229
  };
11160
7230
  var densitySlots2 = {
@@ -11548,110 +7618,6 @@ function resolveDataExplorerAppearance(appearance) {
11548
7618
  )
11549
7619
  };
11550
7620
  }
11551
- function getDataExplorerActionToneClassName(theme, tone, active) {
11552
- return cn2(
11553
- tone === "primary" ? theme.slots.actionButtonPrimary : tone === "danger" ? theme.slots.actionButtonDanger : tone === "muted" ? theme.slots.actionButtonMuted : theme.slots.actionButtonDefault,
11554
- active && theme.slots.actionButtonActive
11555
- );
11556
- }
11557
- function LoadingIcon2() {
11558
- return /* @__PURE__ */ jsxRuntime.jsxs(
11559
- "svg",
11560
- {
11561
- "aria-hidden": "true",
11562
- viewBox: "0 0 24 24",
11563
- className: "h-4 w-4 animate-spin",
11564
- fill: "none",
11565
- children: [
11566
- /* @__PURE__ */ jsxRuntime.jsx(
11567
- "circle",
11568
- {
11569
- cx: "12",
11570
- cy: "12",
11571
- r: "9",
11572
- className: "opacity-25",
11573
- stroke: "currentColor",
11574
- strokeWidth: "3"
11575
- }
11576
- ),
11577
- /* @__PURE__ */ jsxRuntime.jsx(
11578
- "path",
11579
- {
11580
- className: "opacity-75",
11581
- fill: "currentColor",
11582
- d: "M12 3a9 9 0 0 1 9 9h-3a6 6 0 0 0-6-6V3Z"
11583
- }
11584
- )
11585
- ]
11586
- }
11587
- );
11588
- }
11589
- react.forwardRef(function DataExplorerButton2({
11590
- children,
11591
- label,
11592
- icon,
11593
- endIcon,
11594
- type = "button",
11595
- title,
11596
- ariaLabel,
11597
- tone,
11598
- active = false,
11599
- iconOnly = false,
11600
- disabled = false,
11601
- loading = false,
11602
- stopPropagation = false,
11603
- appearance,
11604
- className,
11605
- classNames,
11606
- style,
11607
- onClick,
11608
- "aria-label": nativeAriaLabel,
11609
- ...buttonProps
11610
- }, ref) {
11611
- const theme = resolveDataExplorerAppearance(appearance);
11612
- const resolvedLabel = children ?? label;
11613
- const resolvedDisabled = disabled || loading;
11614
- const handleClick = (event) => {
11615
- if (stopPropagation) {
11616
- event.stopPropagation();
11617
- }
11618
- if (resolvedDisabled) return;
11619
- onClick?.(event);
11620
- };
11621
- return /* @__PURE__ */ jsxRuntime.jsxs(
11622
- "button",
11623
- {
11624
- ...buttonProps,
11625
- ref,
11626
- type,
11627
- title,
11628
- "aria-label": ariaLabel ?? nativeAriaLabel,
11629
- "aria-pressed": active || void 0,
11630
- "aria-busy": loading || void 0,
11631
- disabled: resolvedDisabled,
11632
- className: cn2(
11633
- theme.slots.controlButton,
11634
- iconOnly && theme.slots.actionIconButton,
11635
- getDataExplorerActionToneClassName(theme, tone, active),
11636
- resolvedDisabled && theme.slots.actionButtonDisabled,
11637
- classNames?.root,
11638
- className
11639
- ),
11640
- style: {
11641
- ...theme.styles.control,
11642
- ...active ? theme.styles.controlActive : void 0,
11643
- ...resolvedDisabled ? theme.styles.controlDisabled : void 0,
11644
- ...style
11645
- },
11646
- onClick: handleClick,
11647
- children: [
11648
- loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn2(theme.slots.controlButtonIcon, classNames?.icon), children: /* @__PURE__ */ jsxRuntime.jsx(LoadingIcon2, {}) }) : icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn2(theme.slots.controlButtonIcon, classNames?.icon), children: icon }) : null,
11649
- iconOnly ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: resolvedLabel }) : resolvedLabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn2(theme.slots.controlButtonLabel, classNames?.label), children: resolvedLabel }) : null,
11650
- endIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn2(theme.slots.controlButtonIcon, classNames?.icon), children: endIcon }) : null
11651
- ]
11652
- }
11653
- );
11654
- });
11655
7621
 
11656
7622
  // src/theme-system/resolve-theme.ts
11657
7623
  var DEFAULT_THEME_ID = "default";