pristine-charts 0.1.0

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 (84) hide show
  1. package/README.md +154 -0
  2. package/dist/area-chart/index.cjs +1736 -0
  3. package/dist/area-chart/index.cjs.map +1 -0
  4. package/dist/area-chart/index.d.cts +75 -0
  5. package/dist/area-chart/index.d.ts +75 -0
  6. package/dist/area-chart/index.js +1730 -0
  7. package/dist/area-chart/index.js.map +1 -0
  8. package/dist/bar-chart/index.cjs +1808 -0
  9. package/dist/bar-chart/index.cjs.map +1 -0
  10. package/dist/bar-chart/index.d.cts +72 -0
  11. package/dist/bar-chart/index.d.ts +72 -0
  12. package/dist/bar-chart/index.js +1802 -0
  13. package/dist/bar-chart/index.js.map +1 -0
  14. package/dist/box-plot/index.cjs +1858 -0
  15. package/dist/box-plot/index.cjs.map +1 -0
  16. package/dist/box-plot/index.d.cts +58 -0
  17. package/dist/box-plot/index.d.ts +58 -0
  18. package/dist/box-plot/index.js +1852 -0
  19. package/dist/box-plot/index.js.map +1 -0
  20. package/dist/bullet-chart/index.cjs +1707 -0
  21. package/dist/bullet-chart/index.cjs.map +1 -0
  22. package/dist/bullet-chart/index.d.cts +68 -0
  23. package/dist/bullet-chart/index.d.ts +68 -0
  24. package/dist/bullet-chart/index.js +1701 -0
  25. package/dist/bullet-chart/index.js.map +1 -0
  26. package/dist/histogram-chart/index.cjs +1876 -0
  27. package/dist/histogram-chart/index.cjs.map +1 -0
  28. package/dist/histogram-chart/index.d.cts +76 -0
  29. package/dist/histogram-chart/index.d.ts +76 -0
  30. package/dist/histogram-chart/index.js +1870 -0
  31. package/dist/histogram-chart/index.js.map +1 -0
  32. package/dist/index.cjs +6940 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +19 -0
  35. package/dist/index.d.ts +19 -0
  36. package/dist/index.js +6860 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/kpi-card/index.cjs +1315 -0
  39. package/dist/kpi-card/index.cjs.map +1 -0
  40. package/dist/kpi-card/index.d.cts +79 -0
  41. package/dist/kpi-card/index.d.ts +79 -0
  42. package/dist/kpi-card/index.js +1304 -0
  43. package/dist/kpi-card/index.js.map +1 -0
  44. package/dist/line-chart/index.cjs +1742 -0
  45. package/dist/line-chart/index.cjs.map +1 -0
  46. package/dist/line-chart/index.d.cts +54 -0
  47. package/dist/line-chart/index.d.ts +54 -0
  48. package/dist/line-chart/index.js +1736 -0
  49. package/dist/line-chart/index.js.map +1 -0
  50. package/dist/linearSeries-BQL4Ud3w.d.cts +14 -0
  51. package/dist/linearSeries-BQL4Ud3w.d.ts +14 -0
  52. package/dist/pie-donut-chart/index.cjs +1663 -0
  53. package/dist/pie-donut-chart/index.cjs.map +1 -0
  54. package/dist/pie-donut-chart/index.d.cts +83 -0
  55. package/dist/pie-donut-chart/index.d.ts +83 -0
  56. package/dist/pie-donut-chart/index.js +1655 -0
  57. package/dist/pie-donut-chart/index.js.map +1 -0
  58. package/dist/progress-bar/index.cjs +1336 -0
  59. package/dist/progress-bar/index.cjs.map +1 -0
  60. package/dist/progress-bar/index.d.cts +54 -0
  61. package/dist/progress-bar/index.d.ts +54 -0
  62. package/dist/progress-bar/index.js +1329 -0
  63. package/dist/progress-bar/index.js.map +1 -0
  64. package/dist/ranked-list/index.cjs +1584 -0
  65. package/dist/ranked-list/index.cjs.map +1 -0
  66. package/dist/ranked-list/index.d.cts +70 -0
  67. package/dist/ranked-list/index.d.ts +70 -0
  68. package/dist/ranked-list/index.js +1576 -0
  69. package/dist/ranked-list/index.js.map +1 -0
  70. package/dist/result-C2epnG6V.d.cts +33 -0
  71. package/dist/result-C2epnG6V.d.ts +33 -0
  72. package/dist/scatter-plot/index.cjs +1618 -0
  73. package/dist/scatter-plot/index.cjs.map +1 -0
  74. package/dist/scatter-plot/index.d.cts +55 -0
  75. package/dist/scatter-plot/index.d.ts +55 -0
  76. package/dist/scatter-plot/index.js +1612 -0
  77. package/dist/scatter-plot/index.js.map +1 -0
  78. package/dist/sparkline/index.cjs +1456 -0
  79. package/dist/sparkline/index.cjs.map +1 -0
  80. package/dist/sparkline/index.d.cts +47 -0
  81. package/dist/sparkline/index.d.ts +47 -0
  82. package/dist/sparkline/index.js +1451 -0
  83. package/dist/sparkline/index.js.map +1 -0
  84. package/package.json +126 -0
@@ -0,0 +1,1304 @@
1
+ import { useMemo } from 'react';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+
4
+ // src/kpi-card/KPICard.tsx
5
+
6
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isPlaceholder.js
7
+ function _isPlaceholder(a) {
8
+ return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
9
+ }
10
+
11
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry1.js
12
+ function _curry1(fn) {
13
+ return function f1(a) {
14
+ if (arguments.length === 0 || _isPlaceholder(a)) {
15
+ return f1;
16
+ } else {
17
+ return fn.apply(this, arguments);
18
+ }
19
+ };
20
+ }
21
+
22
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry2.js
23
+ function _curry2(fn) {
24
+ return function f2(a, b) {
25
+ switch (arguments.length) {
26
+ case 0:
27
+ return f2;
28
+ case 1:
29
+ return _isPlaceholder(a) ? f2 : _curry1(function(_b) {
30
+ return fn(a, _b);
31
+ });
32
+ default:
33
+ return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function(_a) {
34
+ return fn(_a, b);
35
+ }) : _isPlaceholder(b) ? _curry1(function(_b) {
36
+ return fn(a, _b);
37
+ }) : fn(a, b);
38
+ }
39
+ };
40
+ }
41
+
42
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isArray.js
43
+ var isArray_default = Array.isArray || function _isArray(val) {
44
+ return val != null && val.length >= 0 && Object.prototype.toString.call(val) === "[object Array]";
45
+ };
46
+
47
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isTransformer.js
48
+ function _isTransformer(obj) {
49
+ return obj != null && typeof obj["@@transducer/step"] === "function";
50
+ }
51
+
52
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_dispatchable.js
53
+ function _dispatchable(methodNames, transducerCreator, fn) {
54
+ return function() {
55
+ if (arguments.length === 0) {
56
+ return fn();
57
+ }
58
+ var obj = arguments[arguments.length - 1];
59
+ if (!isArray_default(obj)) {
60
+ var idx = 0;
61
+ while (idx < methodNames.length) {
62
+ if (typeof obj[methodNames[idx]] === "function") {
63
+ return obj[methodNames[idx]].apply(obj, Array.prototype.slice.call(arguments, 0, -1));
64
+ }
65
+ idx += 1;
66
+ }
67
+ if (_isTransformer(obj)) {
68
+ var transducer = transducerCreator.apply(null, Array.prototype.slice.call(arguments, 0, -1));
69
+ return transducer(obj);
70
+ }
71
+ }
72
+ return fn.apply(this, arguments);
73
+ };
74
+ }
75
+
76
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_xfBase.js
77
+ var xfBase_default = {
78
+ init: function() {
79
+ return this.xf["@@transducer/init"]();
80
+ },
81
+ result: function(result) {
82
+ return this.xf["@@transducer/result"](result);
83
+ }
84
+ };
85
+
86
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_arity.js
87
+ function _arity(n, fn) {
88
+ switch (n) {
89
+ case 0:
90
+ return function() {
91
+ return fn.apply(this, arguments);
92
+ };
93
+ case 1:
94
+ return function(a0) {
95
+ return fn.apply(this, arguments);
96
+ };
97
+ case 2:
98
+ return function(a0, a1) {
99
+ return fn.apply(this, arguments);
100
+ };
101
+ case 3:
102
+ return function(a0, a1, a2) {
103
+ return fn.apply(this, arguments);
104
+ };
105
+ case 4:
106
+ return function(a0, a1, a2, a3) {
107
+ return fn.apply(this, arguments);
108
+ };
109
+ case 5:
110
+ return function(a0, a1, a2, a3, a4) {
111
+ return fn.apply(this, arguments);
112
+ };
113
+ case 6:
114
+ return function(a0, a1, a2, a3, a4, a5) {
115
+ return fn.apply(this, arguments);
116
+ };
117
+ case 7:
118
+ return function(a0, a1, a2, a3, a4, a5, a6) {
119
+ return fn.apply(this, arguments);
120
+ };
121
+ case 8:
122
+ return function(a0, a1, a2, a3, a4, a5, a6, a7) {
123
+ return fn.apply(this, arguments);
124
+ };
125
+ case 9:
126
+ return function(a0, a1, a2, a3, a4, a5, a6, a7, a8) {
127
+ return fn.apply(this, arguments);
128
+ };
129
+ case 10:
130
+ return function(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
131
+ return fn.apply(this, arguments);
132
+ };
133
+ default:
134
+ throw new Error("First argument to _arity must be a non-negative integer no greater than ten");
135
+ }
136
+ }
137
+
138
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curryN.js
139
+ function _curryN(length, received, fn) {
140
+ return function() {
141
+ var combined = [];
142
+ var argsIdx = 0;
143
+ var left = length;
144
+ var combinedIdx = 0;
145
+ var hasPlaceholder = false;
146
+ while (combinedIdx < received.length || argsIdx < arguments.length) {
147
+ var result;
148
+ if (combinedIdx < received.length && (!_isPlaceholder(received[combinedIdx]) || argsIdx >= arguments.length)) {
149
+ result = received[combinedIdx];
150
+ } else {
151
+ result = arguments[argsIdx];
152
+ argsIdx += 1;
153
+ }
154
+ combined[combinedIdx] = result;
155
+ if (!_isPlaceholder(result)) {
156
+ left -= 1;
157
+ } else {
158
+ hasPlaceholder = true;
159
+ }
160
+ combinedIdx += 1;
161
+ }
162
+ return !hasPlaceholder && left <= 0 ? fn.apply(this, combined) : _arity(Math.max(0, left), _curryN(length, combined, fn));
163
+ };
164
+ }
165
+
166
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/curryN.js
167
+ var curryN = /* @__PURE__ */ _curry2(function curryN2(length, fn) {
168
+ if (length === 1) {
169
+ return _curry1(fn);
170
+ }
171
+ return _arity(length, _curryN(length, [], fn));
172
+ });
173
+ var curryN_default = curryN;
174
+
175
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_arrayFromIterator.js
176
+ function _arrayFromIterator(iter) {
177
+ var list = [];
178
+ var next;
179
+ while (!(next = iter.next()).done) {
180
+ list.push(next.value);
181
+ }
182
+ return list;
183
+ }
184
+
185
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_includesWith.js
186
+ function _includesWith(pred, x, list) {
187
+ var idx = 0;
188
+ var len = list.length;
189
+ while (idx < len) {
190
+ if (pred(x, list[idx])) {
191
+ return true;
192
+ }
193
+ idx += 1;
194
+ }
195
+ return false;
196
+ }
197
+
198
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_functionName.js
199
+ function _functionName(f) {
200
+ var match = String(f).match(/^function (\w*)/);
201
+ return match == null ? "" : match[1];
202
+ }
203
+
204
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_has.js
205
+ function _has(prop3, obj) {
206
+ return Object.prototype.hasOwnProperty.call(obj, prop3);
207
+ }
208
+
209
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_objectIs.js
210
+ function _objectIs(a, b) {
211
+ if (a === b) {
212
+ return a !== 0 || 1 / a === 1 / b;
213
+ } else {
214
+ return a !== a && b !== b;
215
+ }
216
+ }
217
+ var objectIs_default = typeof Object.is === "function" ? Object.is : _objectIs;
218
+
219
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isArguments.js
220
+ var toString = Object.prototype.toString;
221
+ var _isArguments = /* @__PURE__ */ (function() {
222
+ return toString.call(arguments) === "[object Arguments]" ? function _isArguments2(x) {
223
+ return toString.call(x) === "[object Arguments]";
224
+ } : function _isArguments2(x) {
225
+ return _has("callee", x);
226
+ };
227
+ })();
228
+ var isArguments_default = _isArguments;
229
+
230
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/keys.js
231
+ var hasEnumBug = !/* @__PURE__ */ {
232
+ toString: null
233
+ }.propertyIsEnumerable("toString");
234
+ var nonEnumerableProps = ["constructor", "valueOf", "isPrototypeOf", "toString", "propertyIsEnumerable", "hasOwnProperty", "toLocaleString"];
235
+ var hasArgsEnumBug = /* @__PURE__ */ (function() {
236
+ return arguments.propertyIsEnumerable("length");
237
+ })();
238
+ var contains = function contains2(list, item) {
239
+ var idx = 0;
240
+ while (idx < list.length) {
241
+ if (list[idx] === item) {
242
+ return true;
243
+ }
244
+ idx += 1;
245
+ }
246
+ return false;
247
+ };
248
+ var keys = typeof Object.keys === "function" && !hasArgsEnumBug ? /* @__PURE__ */ _curry1(function keys2(obj) {
249
+ return Object(obj) !== obj ? [] : Object.keys(obj);
250
+ }) : /* @__PURE__ */ _curry1(function keys3(obj) {
251
+ if (Object(obj) !== obj) {
252
+ return [];
253
+ }
254
+ var prop3, nIdx;
255
+ var ks = [];
256
+ var checkArgsLength = hasArgsEnumBug && isArguments_default(obj);
257
+ for (prop3 in obj) {
258
+ if (_has(prop3, obj) && (!checkArgsLength || prop3 !== "length")) {
259
+ ks[ks.length] = prop3;
260
+ }
261
+ }
262
+ if (hasEnumBug) {
263
+ nIdx = nonEnumerableProps.length - 1;
264
+ while (nIdx >= 0) {
265
+ prop3 = nonEnumerableProps[nIdx];
266
+ if (_has(prop3, obj) && !contains(ks, prop3)) {
267
+ ks[ks.length] = prop3;
268
+ }
269
+ nIdx -= 1;
270
+ }
271
+ }
272
+ return ks;
273
+ });
274
+ var keys_default = keys;
275
+
276
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/type.js
277
+ var type = /* @__PURE__ */ _curry1(function type2(val) {
278
+ return val === null ? "Null" : val === void 0 ? "Undefined" : Object.prototype.toString.call(val).slice(8, -1);
279
+ });
280
+ var type_default = type;
281
+
282
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_equals.js
283
+ function _uniqContentEquals(aIterator, bIterator, stackA, stackB) {
284
+ var a = _arrayFromIterator(aIterator);
285
+ var b = _arrayFromIterator(bIterator);
286
+ function eq(_a, _b) {
287
+ return _equals(_a, _b, stackA.slice(), stackB.slice());
288
+ }
289
+ return !_includesWith(function(b2, aItem) {
290
+ return !_includesWith(eq, aItem, b2);
291
+ }, b, a);
292
+ }
293
+ function _equals(a, b, stackA, stackB) {
294
+ if (objectIs_default(a, b)) {
295
+ return true;
296
+ }
297
+ var typeA = type_default(a);
298
+ if (typeA !== type_default(b)) {
299
+ return false;
300
+ }
301
+ if (typeof a["fantasy-land/equals"] === "function" || typeof b["fantasy-land/equals"] === "function") {
302
+ return typeof a["fantasy-land/equals"] === "function" && a["fantasy-land/equals"](b) && typeof b["fantasy-land/equals"] === "function" && b["fantasy-land/equals"](a);
303
+ }
304
+ if (typeof a.equals === "function" || typeof b.equals === "function") {
305
+ return typeof a.equals === "function" && a.equals(b) && typeof b.equals === "function" && b.equals(a);
306
+ }
307
+ switch (typeA) {
308
+ case "Arguments":
309
+ case "Array":
310
+ case "Object":
311
+ if (typeof a.constructor === "function" && _functionName(a.constructor) === "Promise") {
312
+ return a === b;
313
+ }
314
+ break;
315
+ case "Boolean":
316
+ case "Number":
317
+ case "String":
318
+ if (!(typeof a === typeof b && objectIs_default(a.valueOf(), b.valueOf()))) {
319
+ return false;
320
+ }
321
+ break;
322
+ case "Date":
323
+ if (!objectIs_default(a.valueOf(), b.valueOf())) {
324
+ return false;
325
+ }
326
+ break;
327
+ case "Error":
328
+ return a.name === b.name && a.message === b.message;
329
+ case "RegExp":
330
+ if (!(a.source === b.source && a.global === b.global && a.ignoreCase === b.ignoreCase && a.multiline === b.multiline && a.sticky === b.sticky && a.unicode === b.unicode)) {
331
+ return false;
332
+ }
333
+ break;
334
+ }
335
+ var idx = stackA.length - 1;
336
+ while (idx >= 0) {
337
+ if (stackA[idx] === a) {
338
+ return stackB[idx] === b;
339
+ }
340
+ idx -= 1;
341
+ }
342
+ switch (typeA) {
343
+ case "Map":
344
+ if (a.size !== b.size) {
345
+ return false;
346
+ }
347
+ return _uniqContentEquals(a.entries(), b.entries(), stackA.concat([a]), stackB.concat([b]));
348
+ case "Set":
349
+ if (a.size !== b.size) {
350
+ return false;
351
+ }
352
+ return _uniqContentEquals(a.values(), b.values(), stackA.concat([a]), stackB.concat([b]));
353
+ case "Arguments":
354
+ case "Array":
355
+ case "Object":
356
+ case "Boolean":
357
+ case "Number":
358
+ case "String":
359
+ case "Date":
360
+ case "Error":
361
+ case "RegExp":
362
+ case "Int8Array":
363
+ case "Uint8Array":
364
+ case "Uint8ClampedArray":
365
+ case "Int16Array":
366
+ case "Uint16Array":
367
+ case "Int32Array":
368
+ case "Uint32Array":
369
+ case "Float32Array":
370
+ case "Float64Array":
371
+ case "ArrayBuffer":
372
+ break;
373
+ default:
374
+ return false;
375
+ }
376
+ var keysA = keys_default(a);
377
+ if (keysA.length !== keys_default(b).length) {
378
+ return false;
379
+ }
380
+ var extendedStackA = stackA.concat([a]);
381
+ var extendedStackB = stackB.concat([b]);
382
+ idx = keysA.length - 1;
383
+ while (idx >= 0) {
384
+ var key = keysA[idx];
385
+ if (!(_has(key, b) && _equals(b[key], a[key], extendedStackA, extendedStackB))) {
386
+ return false;
387
+ }
388
+ idx -= 1;
389
+ }
390
+ return true;
391
+ }
392
+
393
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/equals.js
394
+ var equals = /* @__PURE__ */ _curry2(function equals2(a, b) {
395
+ return _equals(a, b, [], []);
396
+ });
397
+ var equals_default = equals;
398
+
399
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_indexOf.js
400
+ function _indexOf(list, a, idx) {
401
+ var inf, item;
402
+ if (typeof list.indexOf === "function") {
403
+ switch (typeof a) {
404
+ case "number":
405
+ if (a === 0) {
406
+ inf = 1 / a;
407
+ while (idx < list.length) {
408
+ item = list[idx];
409
+ if (item === 0 && 1 / item === inf) {
410
+ return idx;
411
+ }
412
+ idx += 1;
413
+ }
414
+ return -1;
415
+ } else if (a !== a) {
416
+ while (idx < list.length) {
417
+ item = list[idx];
418
+ if (typeof item === "number" && item !== item) {
419
+ return idx;
420
+ }
421
+ idx += 1;
422
+ }
423
+ return -1;
424
+ }
425
+ return list.indexOf(a, idx);
426
+ // all these types can utilise Set
427
+ case "string":
428
+ case "boolean":
429
+ case "function":
430
+ case "undefined":
431
+ return list.indexOf(a, idx);
432
+ case "object":
433
+ if (a === null) {
434
+ return list.indexOf(a, idx);
435
+ }
436
+ }
437
+ }
438
+ while (idx < list.length) {
439
+ if (equals_default(list[idx], a)) {
440
+ return idx;
441
+ }
442
+ idx += 1;
443
+ }
444
+ return -1;
445
+ }
446
+
447
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_includes.js
448
+ function _includes(a, list) {
449
+ return _indexOf(list, a, 0) >= 0;
450
+ }
451
+
452
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_map.js
453
+ function _map(fn, functor) {
454
+ var idx = 0;
455
+ var len = functor.length;
456
+ var result = Array(len);
457
+ while (idx < len) {
458
+ result[idx] = fn(functor[idx]);
459
+ idx += 1;
460
+ }
461
+ return result;
462
+ }
463
+
464
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_quote.js
465
+ function _quote(s) {
466
+ var escaped = s.replace(/\\/g, "\\\\").replace(/[\b]/g, "\\b").replace(/\f/g, "\\f").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t").replace(/\v/g, "\\v").replace(/\0/g, "\\0");
467
+ return '"' + escaped.replace(/"/g, '\\"') + '"';
468
+ }
469
+
470
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_toISOString.js
471
+ var pad = function pad2(n) {
472
+ return (n < 10 ? "0" : "") + n;
473
+ };
474
+ var _toISOString = typeof Date.prototype.toISOString === "function" ? function _toISOString2(d) {
475
+ return d.toISOString();
476
+ } : function _toISOString3(d) {
477
+ return d.getUTCFullYear() + "-" + pad(d.getUTCMonth() + 1) + "-" + pad(d.getUTCDate()) + "T" + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()) + ":" + pad(d.getUTCSeconds()) + "." + (d.getUTCMilliseconds() / 1e3).toFixed(3).slice(2, 5) + "Z";
478
+ };
479
+ var toISOString_default = _toISOString;
480
+
481
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_complement.js
482
+ function _complement(f) {
483
+ return function() {
484
+ return !f.apply(this, arguments);
485
+ };
486
+ }
487
+
488
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_arrayReduce.js
489
+ function _arrayReduce(reducer, acc, list) {
490
+ var index = 0;
491
+ var length = list.length;
492
+ while (index < length) {
493
+ acc = reducer(acc, list[index]);
494
+ index += 1;
495
+ }
496
+ return acc;
497
+ }
498
+
499
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_filter.js
500
+ function _filter(fn, list) {
501
+ var idx = 0;
502
+ var len = list.length;
503
+ var result = [];
504
+ while (idx < len) {
505
+ if (fn(list[idx])) {
506
+ result[result.length] = list[idx];
507
+ }
508
+ idx += 1;
509
+ }
510
+ return result;
511
+ }
512
+
513
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isObject.js
514
+ function _isObject(x) {
515
+ return Object.prototype.toString.call(x) === "[object Object]";
516
+ }
517
+
518
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_xfilter.js
519
+ var XFilter = /* @__PURE__ */ (function() {
520
+ function XFilter2(f, xf) {
521
+ this.xf = xf;
522
+ this.f = f;
523
+ }
524
+ XFilter2.prototype["@@transducer/init"] = xfBase_default.init;
525
+ XFilter2.prototype["@@transducer/result"] = xfBase_default.result;
526
+ XFilter2.prototype["@@transducer/step"] = function(result, input) {
527
+ return this.f(input) ? this.xf["@@transducer/step"](result, input) : result;
528
+ };
529
+ return XFilter2;
530
+ })();
531
+ function _xfilter(f) {
532
+ return function(xf) {
533
+ return new XFilter(f, xf);
534
+ };
535
+ }
536
+
537
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/filter.js
538
+ var filter = /* @__PURE__ */ _curry2(/* @__PURE__ */ _dispatchable(["fantasy-land/filter", "filter"], _xfilter, function(pred, filterable) {
539
+ return _isObject(filterable) ? _arrayReduce(function(acc, key) {
540
+ if (pred(filterable[key])) {
541
+ acc[key] = filterable[key];
542
+ }
543
+ return acc;
544
+ }, {}, keys_default(filterable)) : (
545
+ // else
546
+ _filter(pred, filterable)
547
+ );
548
+ }));
549
+ var filter_default = filter;
550
+
551
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/reject.js
552
+ var reject = /* @__PURE__ */ _curry2(function reject2(pred, filterable) {
553
+ return filter_default(_complement(pred), filterable);
554
+ });
555
+ var reject_default = reject;
556
+
557
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_toString.js
558
+ function _toString(x, seen) {
559
+ var recur = function recur2(y) {
560
+ var xs = seen.concat([x]);
561
+ return _includes(y, xs) ? "<Circular>" : _toString(y, xs);
562
+ };
563
+ var mapPairs = function(obj, keys4) {
564
+ return _map(function(k) {
565
+ return _quote(k) + ": " + recur(obj[k]);
566
+ }, keys4.slice().sort());
567
+ };
568
+ switch (Object.prototype.toString.call(x)) {
569
+ case "[object Arguments]":
570
+ return "(function() { return arguments; }(" + _map(recur, x).join(", ") + "))";
571
+ case "[object Array]":
572
+ return "[" + _map(recur, x).concat(mapPairs(x, reject_default(function(k) {
573
+ return /^\d+$/.test(k);
574
+ }, keys_default(x)))).join(", ") + "]";
575
+ case "[object Boolean]":
576
+ return typeof x === "object" ? "new Boolean(" + recur(x.valueOf()) + ")" : x.toString();
577
+ case "[object Date]":
578
+ return "new Date(" + (isNaN(x.valueOf()) ? recur(NaN) : _quote(toISOString_default(x))) + ")";
579
+ case "[object Map]":
580
+ return "new Map(" + recur(Array.from(x)) + ")";
581
+ case "[object Null]":
582
+ return "null";
583
+ case "[object Number]":
584
+ return typeof x === "object" ? "new Number(" + recur(x.valueOf()) + ")" : 1 / x === -Infinity ? "-0" : x.toString(10);
585
+ case "[object Set]":
586
+ return "new Set(" + recur(Array.from(x).sort()) + ")";
587
+ case "[object String]":
588
+ return typeof x === "object" ? "new String(" + recur(x.valueOf()) + ")" : _quote(x);
589
+ case "[object Undefined]":
590
+ return "undefined";
591
+ default:
592
+ if (typeof x.toString === "function") {
593
+ var repr = x.toString();
594
+ if (repr !== "[object Object]") {
595
+ return repr;
596
+ }
597
+ }
598
+ return "{" + mapPairs(x, keys_default(x)).join(", ") + "}";
599
+ }
600
+ }
601
+
602
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/toString.js
603
+ var toString2 = /* @__PURE__ */ _curry1(function toString3(val) {
604
+ return _toString(val, []);
605
+ });
606
+ var toString_default = toString2;
607
+
608
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/max.js
609
+ var max = /* @__PURE__ */ _curry2(function max2(a, b) {
610
+ if (a === b) {
611
+ return b;
612
+ }
613
+ function safeMax(x, y) {
614
+ if (x > y !== y > x) {
615
+ return y > x ? y : x;
616
+ }
617
+ return void 0;
618
+ }
619
+ var maxByValue = safeMax(a, b);
620
+ if (maxByValue !== void 0) {
621
+ return maxByValue;
622
+ }
623
+ var maxByType = safeMax(typeof a, typeof b);
624
+ if (maxByType !== void 0) {
625
+ return maxByType === typeof a ? a : b;
626
+ }
627
+ var stringA = toString_default(a);
628
+ var maxByStringValue = safeMax(stringA, toString_default(b));
629
+ if (maxByStringValue !== void 0) {
630
+ return maxByStringValue === stringA ? a : b;
631
+ }
632
+ return b;
633
+ });
634
+ var max_default = max;
635
+
636
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_xmap.js
637
+ var XMap = /* @__PURE__ */ (function() {
638
+ function XMap2(f, xf) {
639
+ this.xf = xf;
640
+ this.f = f;
641
+ }
642
+ XMap2.prototype["@@transducer/init"] = xfBase_default.init;
643
+ XMap2.prototype["@@transducer/result"] = xfBase_default.result;
644
+ XMap2.prototype["@@transducer/step"] = function(result, input) {
645
+ return this.xf["@@transducer/step"](result, this.f(input));
646
+ };
647
+ return XMap2;
648
+ })();
649
+ var _xmap = function _xmap2(f) {
650
+ return function(xf) {
651
+ return new XMap(f, xf);
652
+ };
653
+ };
654
+ var xmap_default = _xmap;
655
+
656
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/map.js
657
+ var map = /* @__PURE__ */ _curry2(/* @__PURE__ */ _dispatchable(["fantasy-land/map", "map"], xmap_default, function map2(fn, functor) {
658
+ switch (Object.prototype.toString.call(functor)) {
659
+ case "[object Function]":
660
+ return curryN_default(functor.length, function() {
661
+ return fn.call(this, functor.apply(this, arguments));
662
+ });
663
+ case "[object Object]":
664
+ return _arrayReduce(function(acc, key) {
665
+ acc[key] = fn(functor[key]);
666
+ return acc;
667
+ }, {}, keys_default(functor));
668
+ default:
669
+ return _map(fn, functor);
670
+ }
671
+ }));
672
+ var map_default = map;
673
+
674
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isInteger.js
675
+ var isInteger_default = Number.isInteger || function _isInteger(n) {
676
+ return n << 0 === n;
677
+ };
678
+
679
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isString.js
680
+ function _isString(x) {
681
+ return Object.prototype.toString.call(x) === "[object String]";
682
+ }
683
+
684
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_nth.js
685
+ function _nth(offset, list) {
686
+ var idx = offset < 0 ? list.length + offset : offset;
687
+ return _isString(list) ? list.charAt(idx) : list[idx];
688
+ }
689
+
690
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/prop.js
691
+ var prop = /* @__PURE__ */ _curry2(function prop2(p, obj) {
692
+ if (obj == null) {
693
+ return;
694
+ }
695
+ return isInteger_default(p) ? _nth(p, obj) : obj[p];
696
+ });
697
+ var prop_default = prop;
698
+
699
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/pluck.js
700
+ var pluck = /* @__PURE__ */ _curry2(function pluck2(p, list) {
701
+ return map_default(prop_default(p), list);
702
+ });
703
+ var pluck_default = pluck;
704
+
705
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_curry3.js
706
+ function _curry3(fn) {
707
+ return function f3(a, b, c) {
708
+ switch (arguments.length) {
709
+ case 0:
710
+ return f3;
711
+ case 1:
712
+ return _isPlaceholder(a) ? f3 : _curry2(function(_b, _c) {
713
+ return fn(a, _b, _c);
714
+ });
715
+ case 2:
716
+ return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function(_a, _c) {
717
+ return fn(_a, b, _c);
718
+ }) : _isPlaceholder(b) ? _curry2(function(_b, _c) {
719
+ return fn(a, _b, _c);
720
+ }) : _curry1(function(_c) {
721
+ return fn(a, b, _c);
722
+ });
723
+ default:
724
+ return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function(_a, _b) {
725
+ return fn(_a, _b, c);
726
+ }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function(_a, _c) {
727
+ return fn(_a, b, _c);
728
+ }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function(_b, _c) {
729
+ return fn(a, _b, _c);
730
+ }) : _isPlaceholder(a) ? _curry1(function(_a) {
731
+ return fn(_a, b, c);
732
+ }) : _isPlaceholder(b) ? _curry1(function(_b) {
733
+ return fn(a, _b, c);
734
+ }) : _isPlaceholder(c) ? _curry1(function(_c) {
735
+ return fn(a, b, _c);
736
+ }) : fn(a, b, c);
737
+ }
738
+ };
739
+ }
740
+
741
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_isArrayLike.js
742
+ var _isArrayLike = /* @__PURE__ */ _curry1(function isArrayLike(x) {
743
+ if (isArray_default(x)) {
744
+ return true;
745
+ }
746
+ if (!x) {
747
+ return false;
748
+ }
749
+ if (typeof x !== "object") {
750
+ return false;
751
+ }
752
+ if (_isString(x)) {
753
+ return false;
754
+ }
755
+ if (x.length === 0) {
756
+ return true;
757
+ }
758
+ if (x.length > 0) {
759
+ return x.hasOwnProperty(0) && x.hasOwnProperty(x.length - 1);
760
+ }
761
+ return false;
762
+ });
763
+ var isArrayLike_default = _isArrayLike;
764
+
765
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_createReduce.js
766
+ var symIterator = typeof Symbol !== "undefined" ? Symbol.iterator : "@@iterator";
767
+ function _createReduce(arrayReduce, methodReduce, iterableReduce) {
768
+ return function _reduce2(xf, acc, list) {
769
+ if (isArrayLike_default(list)) {
770
+ return arrayReduce(xf, acc, list);
771
+ }
772
+ if (list == null) {
773
+ return acc;
774
+ }
775
+ if (typeof list["fantasy-land/reduce"] === "function") {
776
+ return methodReduce(xf, acc, list, "fantasy-land/reduce");
777
+ }
778
+ if (list[symIterator] != null) {
779
+ return iterableReduce(xf, acc, list[symIterator]());
780
+ }
781
+ if (typeof list.next === "function") {
782
+ return iterableReduce(xf, acc, list);
783
+ }
784
+ if (typeof list.reduce === "function") {
785
+ return methodReduce(xf, acc, list, "reduce");
786
+ }
787
+ throw new TypeError("reduce: list must be array or iterable");
788
+ };
789
+ }
790
+
791
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_xArrayReduce.js
792
+ function _xArrayReduce(xf, acc, list) {
793
+ var idx = 0;
794
+ var len = list.length;
795
+ while (idx < len) {
796
+ acc = xf["@@transducer/step"](acc, list[idx]);
797
+ if (acc && acc["@@transducer/reduced"]) {
798
+ acc = acc["@@transducer/value"];
799
+ break;
800
+ }
801
+ idx += 1;
802
+ }
803
+ return xf["@@transducer/result"](acc);
804
+ }
805
+
806
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/bind.js
807
+ var bind = /* @__PURE__ */ _curry2(function bind2(fn, thisObj) {
808
+ return _arity(fn.length, function() {
809
+ return fn.apply(thisObj, arguments);
810
+ });
811
+ });
812
+ var bind_default = bind;
813
+
814
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_xReduce.js
815
+ function _xIterableReduce(xf, acc, iter) {
816
+ var step = iter.next();
817
+ while (!step.done) {
818
+ acc = xf["@@transducer/step"](acc, step.value);
819
+ if (acc && acc["@@transducer/reduced"]) {
820
+ acc = acc["@@transducer/value"];
821
+ break;
822
+ }
823
+ step = iter.next();
824
+ }
825
+ return xf["@@transducer/result"](acc);
826
+ }
827
+ function _xMethodReduce(xf, acc, obj, methodName) {
828
+ return xf["@@transducer/result"](obj[methodName](bind_default(xf["@@transducer/step"], xf), acc));
829
+ }
830
+ var _xReduce = /* @__PURE__ */ _createReduce(_xArrayReduce, _xMethodReduce, _xIterableReduce);
831
+ var xReduce_default = _xReduce;
832
+
833
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_xwrap.js
834
+ var XWrap = /* @__PURE__ */ (function() {
835
+ function XWrap2(fn) {
836
+ this.f = fn;
837
+ }
838
+ XWrap2.prototype["@@transducer/init"] = function() {
839
+ throw new Error("init not implemented on XWrap");
840
+ };
841
+ XWrap2.prototype["@@transducer/result"] = function(acc) {
842
+ return acc;
843
+ };
844
+ XWrap2.prototype["@@transducer/step"] = function(acc, x) {
845
+ return this.f(acc, x);
846
+ };
847
+ return XWrap2;
848
+ })();
849
+ function _xwrap(fn) {
850
+ return new XWrap(fn);
851
+ }
852
+
853
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/reduce.js
854
+ var reduce = /* @__PURE__ */ _curry3(function(xf, acc, list) {
855
+ return xReduce_default(typeof xf === "function" ? _xwrap(xf) : xf, acc, list);
856
+ });
857
+ var reduce_default = reduce;
858
+
859
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/allPass.js
860
+ var allPass = /* @__PURE__ */ _curry1(function allPass2(preds) {
861
+ return curryN_default(reduce_default(max_default, 0, pluck_default("length", preds)), function() {
862
+ var idx = 0;
863
+ var len = preds.length;
864
+ while (idx < len) {
865
+ if (!preds[idx].apply(this, arguments)) {
866
+ return false;
867
+ }
868
+ idx += 1;
869
+ }
870
+ return true;
871
+ });
872
+ });
873
+ var allPass_default = allPass;
874
+
875
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/always.js
876
+ var always = /* @__PURE__ */ _curry1(function always2(val) {
877
+ return function() {
878
+ return val;
879
+ };
880
+ });
881
+ var always_default = always;
882
+
883
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_concat.js
884
+ function _concat(set1, set2) {
885
+ set1 = set1 || [];
886
+ set2 = set2 || [];
887
+ var idx;
888
+ var len1 = set1.length;
889
+ var len2 = set2.length;
890
+ var result = [];
891
+ idx = 0;
892
+ while (idx < len1) {
893
+ result[result.length] = set1[idx];
894
+ idx += 1;
895
+ }
896
+ idx = 0;
897
+ while (idx < len2) {
898
+ result[result.length] = set2[idx];
899
+ idx += 1;
900
+ }
901
+ return result;
902
+ }
903
+
904
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/internal/_reduce.js
905
+ function _iterableReduce(reducer, acc, iter) {
906
+ var step = iter.next();
907
+ while (!step.done) {
908
+ acc = reducer(acc, step.value);
909
+ step = iter.next();
910
+ }
911
+ return acc;
912
+ }
913
+ function _methodReduce(reducer, acc, obj, methodName) {
914
+ return obj[methodName](reducer, acc);
915
+ }
916
+ var _reduce = /* @__PURE__ */ _createReduce(_arrayReduce, _methodReduce, _iterableReduce);
917
+ var reduce_default2 = _reduce;
918
+
919
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/ap.js
920
+ var ap = /* @__PURE__ */ _curry2(function ap2(applyF, applyX) {
921
+ return typeof applyX["fantasy-land/ap"] === "function" ? applyX["fantasy-land/ap"](applyF) : typeof applyF.ap === "function" ? applyF.ap(applyX) : typeof applyF === "function" ? function(x) {
922
+ return applyF(x)(applyX(x));
923
+ } : reduce_default2(function(acc, f) {
924
+ return _concat(acc, map_default(f, applyX));
925
+ }, [], applyF);
926
+ });
927
+ var ap_default = ap;
928
+
929
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/liftN.js
930
+ var liftN = /* @__PURE__ */ _curry2(function liftN2(arity, fn) {
931
+ var lifted = curryN_default(arity, fn);
932
+ return curryN_default(arity, function() {
933
+ return _arrayReduce(ap_default, map_default(lifted, arguments[0]), Array.prototype.slice.call(arguments, 1));
934
+ });
935
+ });
936
+ var liftN_default = liftN;
937
+
938
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/lift.js
939
+ var lift = /* @__PURE__ */ _curry1(function lift2(fn) {
940
+ return liftN_default(fn.length, fn);
941
+ });
942
+ var lift_default = lift;
943
+
944
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/not.js
945
+ var not = /* @__PURE__ */ _curry1(function not2(a) {
946
+ return !a;
947
+ });
948
+ var not_default = not;
949
+
950
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/complement.js
951
+ var complement = /* @__PURE__ */ lift_default(not_default);
952
+ var complement_default = complement;
953
+
954
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/cond.js
955
+ var cond = /* @__PURE__ */ _curry1(function cond2(pairs) {
956
+ var arity = reduce_default(max_default, 0, map_default(function(pair) {
957
+ return pair[0].length;
958
+ }, pairs));
959
+ return _arity(arity, function() {
960
+ var idx = 0;
961
+ while (idx < pairs.length) {
962
+ if (pairs[idx][0].apply(this, arguments)) {
963
+ return pairs[idx][1].apply(this, arguments);
964
+ }
965
+ idx += 1;
966
+ }
967
+ });
968
+ });
969
+ var cond_default = cond;
970
+
971
+ // node_modules/.pnpm/ramda@0.30.1/node_modules/ramda/es/ifElse.js
972
+ var ifElse = /* @__PURE__ */ _curry3(function ifElse2(condition, onTrue, onFalse) {
973
+ return curryN_default(Math.max(condition.length, onTrue.length, onFalse.length), function _ifElse() {
974
+ return condition.apply(this, arguments) ? onTrue.apply(this, arguments) : onFalse.apply(this, arguments);
975
+ });
976
+ });
977
+ var ifElse_default = ifElse;
978
+
979
+ // src/shared/className.ts
980
+ var isPresentClassName = (value) => value.trim().length > 0;
981
+ var classNames = (values) => filter_default(isPresentClassName, [...values]).join(" ");
982
+
983
+ // src/shared/option.ts
984
+ var none = { status: "none" };
985
+ function some(value) {
986
+ return { status: "some", value };
987
+ }
988
+ var isSome = (option) => option.status === "some";
989
+ var getOrElse = (fallback) => (option) => ifElse_default(
990
+ isSome,
991
+ (someOption) => someOption.value,
992
+ always_default(fallback)
993
+ )(option);
994
+ function matchOption(option, matcher) {
995
+ return ifElse_default(
996
+ isSome,
997
+ (someOption) => matcher.some(someOption.value),
998
+ matcher.none
999
+ )(option);
1000
+ }
1001
+
1002
+ // src/shared/result.ts
1003
+ function ok(value) {
1004
+ return { status: "ok", value };
1005
+ }
1006
+ function err(error) {
1007
+ return { status: "error", error };
1008
+ }
1009
+ var isOk = (result) => result.status === "ok";
1010
+ var andThenResult = (transform) => (result) => matchResult(result, {
1011
+ error: err,
1012
+ ok: transform
1013
+ });
1014
+ var mapResult = (transform) => (result) => andThenResult((value) => ok(transform(value)))(result);
1015
+ function matchResult(result, matcher) {
1016
+ return ifElse_default(
1017
+ isOk,
1018
+ (okResult) => matcher.ok(okResult.value),
1019
+ (errorResult) => matcher.error(errorResult.error)
1020
+ )(result);
1021
+ }
1022
+ var renderDetails = (details) => matchOption(details, {
1023
+ none: () => null,
1024
+ some: (value) => /* @__PURE__ */ jsx("p", { className: "pristine-chart-error__details", children: value })
1025
+ });
1026
+ function ChartError({
1027
+ title,
1028
+ message,
1029
+ details,
1030
+ className,
1031
+ role
1032
+ }) {
1033
+ return /* @__PURE__ */ jsxs("div", { className: classNames(["pristine-chart-error", className]), role, children: [
1034
+ /* @__PURE__ */ jsx("p", { className: "pristine-chart-error__title", children: title }),
1035
+ /* @__PURE__ */ jsx("p", { className: "pristine-chart-error__message", children: message }),
1036
+ renderDetails(details)
1037
+ ] });
1038
+ }
1039
+
1040
+ // src/kpi-card/KPICard.domain.ts
1041
+ var HIGHER_IS_BETTER = "HigherIsBetter";
1042
+ var LOWER_IS_BETTER = "LowerIsBetter";
1043
+ var DEFAULT_KPI_CARD_POLARITY = HIGHER_IS_BETTER;
1044
+ var kpiCardRules = {
1045
+ emptyMetricName: () => ({
1046
+ type: "EmptyMetricName",
1047
+ message: "A KPI card needs a non-empty metric name.",
1048
+ details: none
1049
+ }),
1050
+ invalidCurrentValue: (currentValue) => ({
1051
+ type: "InvalidCurrentValue",
1052
+ message: "KPI card current value must be a finite number.",
1053
+ details: some(`Invalid current value: ${String(currentValue)}.`)
1054
+ }),
1055
+ invalidReferenceValue: (referenceValue) => ({
1056
+ type: "InvalidReferenceValue",
1057
+ message: "KPI card reference value must be a non-zero finite number.",
1058
+ details: some(`Invalid reference value: ${String(referenceValue)}.`)
1059
+ })
1060
+ };
1061
+ var isFiniteNumber = (value) => allPass_default([
1062
+ (candidate) => typeof candidate === "number",
1063
+ (candidate) => Number.isFinite(candidate)
1064
+ ])(value);
1065
+ var isNonZeroFiniteNumber = (value) => allPass_default([
1066
+ isFiniteNumber,
1067
+ (candidate) => Number(candidate) !== 0
1068
+ ])(value);
1069
+ var isNonEmptyString = (value) => allPass_default([
1070
+ (candidate) => typeof candidate === "string",
1071
+ (candidate) => String(candidate).trim().length > 0
1072
+ ])(value);
1073
+ var hasValidMetricName = (input) => isNonEmptyString(input.metricName);
1074
+ var hasValidCurrentValue = (input) => isFiniteNumber(input.currentValue);
1075
+ var hasValidReferenceValue = (input) => isNonZeroFiniteNumber(input.referenceValue);
1076
+ var toValidatedInput = (input) => ({
1077
+ metricName: String(input.metricName).trim(),
1078
+ currentValue: Number(input.currentValue),
1079
+ referenceValue: Number(input.referenceValue),
1080
+ polarity: getOrElse(DEFAULT_KPI_CARD_POLARITY)(input.polarity)
1081
+ });
1082
+ var inputValidators = [
1083
+ [
1084
+ complement_default(hasValidMetricName),
1085
+ () => err(kpiCardRules.emptyMetricName())
1086
+ ],
1087
+ [
1088
+ complement_default(hasValidCurrentValue),
1089
+ (input) => err(kpiCardRules.invalidCurrentValue(input.currentValue))
1090
+ ],
1091
+ [
1092
+ complement_default(hasValidReferenceValue),
1093
+ (input) => err(kpiCardRules.invalidReferenceValue(input.referenceValue))
1094
+ ],
1095
+ [always_default(true), (input) => ok(toValidatedInput(input))]
1096
+ ];
1097
+ var validateKPICardInput = cond_default(inputValidators);
1098
+ var isHigherIsBetter = (polarity) => polarity === HIGHER_IS_BETTER;
1099
+ var isLowerIsBetter = (polarity) => polarity === LOWER_IS_BETTER;
1100
+ var isUnchanged = (context) => context.changeAmount === 0;
1101
+ var isImprovedForHigherIsBetter = (context) => allPass_default([
1102
+ (candidate) => isHigherIsBetter(candidate.polarity),
1103
+ (candidate) => candidate.changeAmount > 0
1104
+ ])(context);
1105
+ var isImprovedForLowerIsBetter = (context) => allPass_default([
1106
+ (candidate) => isLowerIsBetter(candidate.polarity),
1107
+ (candidate) => candidate.changeAmount < 0
1108
+ ])(context);
1109
+ var changeDirectionRules = [
1110
+ [isUnchanged, always_default("Unchanged")],
1111
+ [isImprovedForHigherIsBetter, always_default("Improved")],
1112
+ [isImprovedForLowerIsBetter, always_default("Improved")],
1113
+ [always_default(true), always_default("Declined")]
1114
+ ];
1115
+ var deriveChangeDirection = cond_default(changeDirectionRules);
1116
+ var computeChangeAmount = (input) => input.currentValue - input.referenceValue;
1117
+ var computeChangePercentage = (changeAmount, input) => changeAmount / input.referenceValue * 100;
1118
+ var toKPISummary = (input) => {
1119
+ const changeAmount = computeChangeAmount(input);
1120
+ const changePercentage = computeChangePercentage(changeAmount, input);
1121
+ return {
1122
+ metricName: input.metricName,
1123
+ currentValue: input.currentValue,
1124
+ referenceValue: input.referenceValue,
1125
+ changeAmount,
1126
+ changePercentage,
1127
+ changeDirection: deriveChangeDirection({ changeAmount, polarity: input.polarity })
1128
+ };
1129
+ };
1130
+ function computeKPICard(input) {
1131
+ return mapResult(toKPISummary)(
1132
+ validateKPICardInput(input)
1133
+ );
1134
+ }
1135
+
1136
+ // src/kpi-card/KPICard.model.ts
1137
+ var getChangeDirectionClassName = (direction) => direction.toLowerCase();
1138
+ var getComparisonParts = (comparisonLabel) => ifElse_default(
1139
+ (candidate) => candidate.trim().length > 0,
1140
+ (candidate) => [candidate.trim()],
1141
+ () => []
1142
+ )(comparisonLabel);
1143
+ var joinLabels = (parts) => parts.join(" ");
1144
+ var buildKPICardModel = (summary, comparisonLabel, formatValue, formatChangeAmount, formatChangePercentage) => {
1145
+ const currentValueLabel = formatValue(summary.currentValue);
1146
+ const referenceValueLabel = formatValue(summary.referenceValue);
1147
+ const changeAmountLabel = formatChangeAmount(summary.changeAmount);
1148
+ const changePercentageLabel = formatChangePercentage(summary.changePercentage);
1149
+ const normalizedComparisonLabel = comparisonLabel.trim();
1150
+ const changeDirectionLabel = summary.changeDirection;
1151
+ const changeLabel = joinLabels([
1152
+ changeDirectionLabel,
1153
+ changePercentageLabel,
1154
+ `(${changeAmountLabel})`,
1155
+ ...getComparisonParts(normalizedComparisonLabel)
1156
+ ]);
1157
+ return {
1158
+ metricName: summary.metricName,
1159
+ currentValueLabel,
1160
+ referenceValueLabel,
1161
+ changeAmountLabel,
1162
+ changePercentageLabel,
1163
+ changeDirection: summary.changeDirection,
1164
+ changeDirectionLabel,
1165
+ changeDirectionClassName: getChangeDirectionClassName(summary.changeDirection),
1166
+ comparisonLabel: normalizedComparisonLabel,
1167
+ changeLabel,
1168
+ summaryLabel: joinLabels([
1169
+ `${summary.metricName}:`,
1170
+ `${currentValueLabel}.`,
1171
+ `${changeLabel}.`,
1172
+ `Reference value ${referenceValueLabel}.`
1173
+ ])
1174
+ };
1175
+ };
1176
+ function KPICardCaption({ caption }) {
1177
+ return matchOption(caption, {
1178
+ none: () => null,
1179
+ some: (content) => /* @__PURE__ */ jsx("figcaption", { className: "pristine-kpi-card__caption", children: content })
1180
+ });
1181
+ }
1182
+ var toCardStyle = (width, height) => ({
1183
+ "--pristine-kpi-card-width": `${String(width)}px`,
1184
+ "--pristine-kpi-card-min-height": `${String(height)}px`
1185
+ });
1186
+ function KPICardFigure({
1187
+ ariaLabel,
1188
+ caption,
1189
+ className,
1190
+ height,
1191
+ kpi,
1192
+ width
1193
+ }) {
1194
+ const changeClassName = classNames([
1195
+ "pristine-kpi-card__change",
1196
+ `pristine-kpi-card__change--${kpi.changeDirectionClassName}`
1197
+ ]);
1198
+ return /* @__PURE__ */ jsxs(
1199
+ "figure",
1200
+ {
1201
+ className: classNames(["pristine-kpi-card", className]),
1202
+ "aria-label": ariaLabel,
1203
+ style: toCardStyle(width, height),
1204
+ children: [
1205
+ /* @__PURE__ */ jsxs("div", { className: "pristine-kpi-card__body", role: "group", "aria-label": kpi.summaryLabel, children: [
1206
+ /* @__PURE__ */ jsx("p", { className: "pristine-kpi-card__metric", children: kpi.metricName }),
1207
+ /* @__PURE__ */ jsx("p", { className: "pristine-kpi-card__value", children: kpi.currentValueLabel }),
1208
+ /* @__PURE__ */ jsxs("p", { className: changeClassName, "aria-label": kpi.changeLabel, children: [
1209
+ /* @__PURE__ */ jsx("span", { className: "pristine-kpi-card__direction", children: kpi.changeDirectionLabel }),
1210
+ /* @__PURE__ */ jsx("span", { className: "pristine-kpi-card__percentage", children: kpi.changePercentageLabel }),
1211
+ /* @__PURE__ */ jsxs("span", { className: "pristine-kpi-card__amount", children: [
1212
+ "(",
1213
+ kpi.changeAmountLabel,
1214
+ ")"
1215
+ ] }),
1216
+ /* @__PURE__ */ jsx("span", { className: "pristine-kpi-card__comparison", children: kpi.comparisonLabel })
1217
+ ] })
1218
+ ] }),
1219
+ /* @__PURE__ */ jsx(KPICardCaption, { caption })
1220
+ ]
1221
+ }
1222
+ );
1223
+ }
1224
+ function KPICard({
1225
+ metricName,
1226
+ currentValue,
1227
+ referenceValue,
1228
+ polarity,
1229
+ width,
1230
+ height,
1231
+ ariaLabel,
1232
+ className,
1233
+ caption,
1234
+ comparisonLabel,
1235
+ formatValue,
1236
+ formatChangeAmount,
1237
+ formatChangePercentage
1238
+ }) {
1239
+ const result = useMemo(
1240
+ () => computeKPICard({ metricName, currentValue, referenceValue, polarity }),
1241
+ [currentValue, metricName, polarity, referenceValue]
1242
+ );
1243
+ return matchResult(result, {
1244
+ error: (error) => /* @__PURE__ */ jsx(
1245
+ ChartError,
1246
+ {
1247
+ className: classNames(["pristine-kpi-card__error", className]),
1248
+ title: "KPI unavailable",
1249
+ message: error.message,
1250
+ details: error.details,
1251
+ role: "alert"
1252
+ }
1253
+ ),
1254
+ ok: (summary) => {
1255
+ const kpi = buildKPICardModel(
1256
+ summary,
1257
+ comparisonLabel,
1258
+ formatValue,
1259
+ formatChangeAmount,
1260
+ formatChangePercentage
1261
+ );
1262
+ return /* @__PURE__ */ jsx(
1263
+ KPICardFigure,
1264
+ {
1265
+ ariaLabel,
1266
+ caption,
1267
+ className,
1268
+ height,
1269
+ kpi,
1270
+ width
1271
+ }
1272
+ );
1273
+ }
1274
+ });
1275
+ }
1276
+
1277
+ // src/kpi-card/KPICard.defaults.ts
1278
+ var formatKPICardNumber = ifElse_default(
1279
+ Number.isInteger,
1280
+ String,
1281
+ (value) => value.toFixed(2).replace(/\.?0+$/, "")
1282
+ );
1283
+ var formatKPICardSignedNumber = (value) => ifElse_default(
1284
+ (candidate) => candidate > 0,
1285
+ (candidate) => `+${formatKPICardNumber(candidate)}`,
1286
+ formatKPICardNumber
1287
+ )(value);
1288
+ var formatKPICardPercentage = (percentage) => `${formatKPICardSignedNumber(percentage)}%`;
1289
+ var DEFAULT_KPI_CARD_VIEW_PROPS = {
1290
+ width: 360,
1291
+ height: 140,
1292
+ ariaLabel: "KPI card",
1293
+ className: "",
1294
+ caption: none,
1295
+ polarity: none,
1296
+ comparisonLabel: "vs reference",
1297
+ formatValue: formatKPICardNumber,
1298
+ formatChangeAmount: formatKPICardSignedNumber,
1299
+ formatChangePercentage: formatKPICardPercentage
1300
+ };
1301
+
1302
+ export { DEFAULT_KPI_CARD_POLARITY, DEFAULT_KPI_CARD_VIEW_PROPS, HIGHER_IS_BETTER, KPICard, LOWER_IS_BETTER, computeKPICard, formatKPICardNumber, formatKPICardPercentage, formatKPICardSignedNumber, validateKPICardInput };
1303
+ //# sourceMappingURL=index.js.map
1304
+ //# sourceMappingURL=index.js.map