@tectra-ng/charts 0.0.1 → 0.1.9

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.
@@ -0,0 +1,2394 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, Directive, ElementRef, Injector, PLATFORM_ID, TemplateRef, ViewContainerRef, afterNextRender, booleanAttribute, computed, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
4
+ import { formatMessage, injectTranslations } from "@tectra-ng/core/i18n";
5
+ import { TxAnnouncer, uniqueId } from "@tectra-ng/core/a11y";
6
+ import { TxOverlay, parsePlacement, txArrowOffset } from "@tectra-ng/core/overlay";
7
+ import { TxIcon } from "@tectra-ng/icons";
8
+ import { TxSkeleton } from "@tectra-ng/ui/skeleton";
9
+ const E10 = Math.sqrt(50);
10
+ const E5 = Math.sqrt(10);
11
+ const E2 = Math.sqrt(2);
12
+ function tickStep(start, stop, count) {
13
+ const span = Math.abs(stop - start);
14
+ if (!span || count <= 0 || !Number.isFinite(span)) return 0;
15
+ const raw = span / count;
16
+ const base = 10 ** Math.floor(Math.log10(raw));
17
+ const error = raw / base;
18
+ return (error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1) * base;
19
+ }
20
+ function decimalsOf(step) {
21
+ if (!step || !Number.isFinite(step)) return 0;
22
+ return Math.max(0, -Math.floor(Math.log10(step) + 1e-9));
23
+ }
24
+ function clean(value, decimals) {
25
+ const rounded = Number(value.toFixed(Math.min(20, decimals + 2)));
26
+ return Object.is(rounded, -0) ? 0 : rounded;
27
+ }
28
+ function niceDomain(min, max, count = 5) {
29
+ if (!Number.isFinite(min) || !Number.isFinite(max)) return [0, 1];
30
+ if (min === max) {
31
+ if (min === 0) return [0, 1];
32
+ const pad = Math.abs(min) * .1 || 1;
33
+ return niceDomain(min > 0 ? 0 : min - pad, max < 0 ? 0 : max + pad, count);
34
+ }
35
+ let start = Math.min(min, max);
36
+ let stop = Math.max(min, max);
37
+ for (let round = 0; round < 3; round++) {
38
+ const step = tickStep(start, stop, count);
39
+ const nextStart = Math.floor(start / step) * step;
40
+ const nextStop = Math.ceil(stop / step) * step;
41
+ if (nextStart === start && nextStop === stop) break;
42
+ start = clean(nextStart, decimalsOf(step));
43
+ stop = clean(nextStop, decimalsOf(step));
44
+ }
45
+ return [start, stop];
46
+ }
47
+ function linearTicks(min, max, count = 5) {
48
+ const step = tickStep(min, max, count);
49
+ if (!step) return Number.isFinite(min) ? [min] : [];
50
+ const decimals = decimalsOf(step);
51
+ const first = Math.ceil(min / step - 1e-9);
52
+ const last = Math.floor(max / step + 1e-9);
53
+ const ticks = [];
54
+ for (let index = first; index <= last; index++) ticks.push(clean(index * step, decimals));
55
+ return ticks;
56
+ }
57
+ function linearScale(domain, range) {
58
+ const [d0, d1] = domain;
59
+ const [r0, r1] = range;
60
+ const span = d1 - d0 || 1;
61
+ const map = (value) => r0 + (value - d0) / span * (r1 - r0);
62
+ return {
63
+ kind: "linear",
64
+ domain,
65
+ range,
66
+ map,
67
+ invert: (position) => d0 + (position - r0) / (r1 - r0 || 1) * span,
68
+ ticks: (count = 5) => linearTicks(d0, d1, count)
69
+ };
70
+ }
71
+ function logDomain(min, max) {
72
+ const low = Math.max(min, Number.MIN_VALUE);
73
+ const lowPower = Math.floor(Math.log10(low));
74
+ const highPower = Math.ceil(Math.log10(Math.max(max, low)));
75
+ return [10 ** lowPower, 10 ** Math.max(highPower, lowPower + 1)];
76
+ }
77
+ function logTicks(min, max, count = 5) {
78
+ const low = Math.floor(Math.log10(min));
79
+ const high = Math.ceil(Math.log10(max));
80
+ const decades = high - low;
81
+ const steps = decades * 3 <= count ? [
82
+ 1,
83
+ 2,
84
+ 5
85
+ ] : [1];
86
+ const every = Math.max(1, Math.ceil(decades / Math.max(1, count)));
87
+ const ticks = [];
88
+ for (let power = low; power <= high; power++) {
89
+ if ((power - low) % every) continue;
90
+ for (const step of steps) {
91
+ const value = step * 10 ** power;
92
+ if (value >= min * (1 - 1e-9) && value <= max * (1 + 1e-9)) ticks.push(Number(value.toPrecision(12)));
93
+ }
94
+ }
95
+ return ticks;
96
+ }
97
+ function logScale(domain, range) {
98
+ const [d0, d1] = domain.map((value) => Math.max(value, Number.MIN_VALUE));
99
+ const [r0, r1] = range;
100
+ const l0 = Math.log10(d0);
101
+ const span = Math.log10(d1) - l0 || 1;
102
+ return {
103
+ kind: "log",
104
+ domain: [d0, d1],
105
+ range,
106
+ map: (value) => r0 + (Math.log10(Math.max(value, d0 / 10)) - l0) / span * (r1 - r0),
107
+ invert: (position) => 10 ** (l0 + (position - r0) / (r1 - r0 || 1) * span),
108
+ ticks: (count = 5) => logTicks(d0, d1, count)
109
+ };
110
+ }
111
+ function bandScale(count, range, paddingInner = 0, paddingOuter = 0) {
112
+ const [r0, r1] = range;
113
+ const slots = Math.max(1, count - paddingInner + paddingOuter * 2);
114
+ const step = (r1 - r0) / slots;
115
+ const bandwidth = step * (1 - paddingInner);
116
+ const start = r0 + step * paddingOuter;
117
+ return {
118
+ kind: "band",
119
+ count,
120
+ range,
121
+ step,
122
+ bandwidth,
123
+ start: (index) => start + step * index,
124
+ center: (index) => start + step * index + bandwidth / 2,
125
+ indexAt: (position) => Math.min(count - 1, Math.max(0, Math.floor((position - r0) / ((r1 - r0) / Math.max(1, count)))))
126
+ };
127
+ }
128
+ function pointScale(count, range) {
129
+ const [r0, r1] = range;
130
+ const step = count > 1 ? (r1 - r0) / (count - 1) : 0;
131
+ const at = (index) => count > 1 ? r0 + step * index : (r0 + r1) / 2;
132
+ return {
133
+ kind: "point",
134
+ count,
135
+ range,
136
+ step,
137
+ at,
138
+ indexAt: (position) => count > 1 ? Math.min(count - 1, Math.max(0, Math.round((position - r0) / step))) : 0
139
+ };
140
+ }
141
+ const SECOND = 1e3;
142
+ const MINUTE = 60 * SECOND;
143
+ const HOUR = 60 * MINUTE;
144
+ const DAY = 24 * HOUR;
145
+ const TX_TIME_INTERVALS = [
146
+ {
147
+ unit: "second",
148
+ step: 1,
149
+ duration: SECOND
150
+ },
151
+ {
152
+ unit: "second",
153
+ step: 5,
154
+ duration: 5 * SECOND
155
+ },
156
+ {
157
+ unit: "second",
158
+ step: 15,
159
+ duration: 15 * SECOND
160
+ },
161
+ {
162
+ unit: "second",
163
+ step: 30,
164
+ duration: 30 * SECOND
165
+ },
166
+ {
167
+ unit: "minute",
168
+ step: 1,
169
+ duration: MINUTE
170
+ },
171
+ {
172
+ unit: "minute",
173
+ step: 5,
174
+ duration: 5 * MINUTE
175
+ },
176
+ {
177
+ unit: "minute",
178
+ step: 15,
179
+ duration: 15 * MINUTE
180
+ },
181
+ {
182
+ unit: "minute",
183
+ step: 30,
184
+ duration: 30 * MINUTE
185
+ },
186
+ {
187
+ unit: "hour",
188
+ step: 1,
189
+ duration: HOUR
190
+ },
191
+ {
192
+ unit: "hour",
193
+ step: 3,
194
+ duration: 3 * HOUR
195
+ },
196
+ {
197
+ unit: "hour",
198
+ step: 6,
199
+ duration: 6 * HOUR
200
+ },
201
+ {
202
+ unit: "hour",
203
+ step: 12,
204
+ duration: 12 * HOUR
205
+ },
206
+ {
207
+ unit: "day",
208
+ step: 1,
209
+ duration: DAY
210
+ },
211
+ {
212
+ unit: "day",
213
+ step: 2,
214
+ duration: 2 * DAY
215
+ },
216
+ {
217
+ unit: "week",
218
+ step: 1,
219
+ duration: 7 * DAY
220
+ },
221
+ {
222
+ unit: "month",
223
+ step: 1,
224
+ duration: 30 * DAY
225
+ },
226
+ {
227
+ unit: "month",
228
+ step: 2,
229
+ duration: 61 * DAY
230
+ },
231
+ {
232
+ unit: "month",
233
+ step: 3,
234
+ duration: 91 * DAY
235
+ },
236
+ {
237
+ unit: "month",
238
+ step: 6,
239
+ duration: 182 * DAY
240
+ },
241
+ {
242
+ unit: "year",
243
+ step: 1,
244
+ duration: 365 * DAY
245
+ }
246
+ ];
247
+ function timeInterval(start, stop, count = 6) {
248
+ const span = Math.abs(stop - start);
249
+ const target = span / Math.max(1, count);
250
+ const found = TX_TIME_INTERVALS.find((interval) => interval.duration >= target);
251
+ if (found) return found;
252
+ const years = tickStep(0, span / (365 * DAY), count) || 1;
253
+ return {
254
+ unit: "year",
255
+ step: Math.max(1, Math.round(years)),
256
+ duration: Math.max(1, Math.round(years)) * 365 * DAY
257
+ };
258
+ }
259
+ function floorTime(time, interval) {
260
+ const date = new Date(time);
261
+ const { unit, step } = interval;
262
+ if (unit === "year") return new Date(Math.floor(date.getFullYear() / step) * step, 0, 1);
263
+ if (unit === "month") return new Date(date.getFullYear(), Math.floor(date.getMonth() / step) * step, 1);
264
+ if (unit === "week") return new Date(date.getFullYear(), date.getMonth(), date.getDate() - date.getDay());
265
+ if (unit === "day") {
266
+ const day = new Date(date.getFullYear(), date.getMonth(), date.getDate());
267
+ return step > 1 ? new Date(day.getFullYear(), day.getMonth(), day.getDate() - (day.getDate() - 1) % step) : day;
268
+ }
269
+ if (unit === "hour") return new Date(date.getFullYear(), date.getMonth(), date.getDate(), Math.floor(date.getHours() / step) * step);
270
+ if (unit === "minute") return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), Math.floor(date.getMinutes() / step) * step);
271
+ return /* @__PURE__ */ new Date(Math.floor(time / (step * SECOND)) * step * SECOND);
272
+ }
273
+ function addTime(date, interval) {
274
+ const { unit, step } = interval;
275
+ const next = new Date(date.getTime());
276
+ if (unit === "year") next.setFullYear(next.getFullYear() + step);
277
+ else if (unit === "month") next.setMonth(next.getMonth() + step);
278
+ else if (unit === "week") next.setDate(next.getDate() + 7 * step);
279
+ else if (unit === "day") next.setDate(next.getDate() + step);
280
+ else if (unit === "hour") next.setHours(next.getHours() + step);
281
+ else if (unit === "minute") next.setMinutes(next.getMinutes() + step);
282
+ else next.setSeconds(next.getSeconds() + step);
283
+ return next;
284
+ }
285
+ function timeTicks(start, stop, count = 6) {
286
+ const interval = timeInterval(start, stop, count);
287
+ const ticks = [];
288
+ let tick = floorTime(start, interval);
289
+ if (tick.getTime() < start) tick = addTime(tick, interval);
290
+ while (tick.getTime() <= stop && ticks.length < 1e3) {
291
+ ticks.push(tick.getTime());
292
+ tick = addTime(tick, interval);
293
+ }
294
+ return {
295
+ ticks,
296
+ interval
297
+ };
298
+ }
299
+ function timeScale(domain, range) {
300
+ return {
301
+ ...linearScale(domain, range),
302
+ kind: "time",
303
+ ticks: (count = 6) => timeTicks(domain[0], domain[1], count).ticks,
304
+ interval: (count = 6) => timeInterval(domain[0], domain[1], count)
305
+ };
306
+ }
307
+ function toTime(value) {
308
+ if (value === null || value === void 0 || value === "") return null;
309
+ if (value instanceof Date) return Number.isNaN(value.getTime()) ? null : value.getTime();
310
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
311
+ const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
312
+ const time = dateOnly ? new Date(Number(dateOnly[1]), Number(dateOnly[2]) - 1, Number(dateOnly[3])).getTime() : Date.parse(value);
313
+ return Number.isNaN(time) ? null : time;
314
+ }
315
+ function extent(values) {
316
+ let min = Infinity;
317
+ let max = -Infinity;
318
+ for (const value of values) {
319
+ if (value === null || value === void 0 || !Number.isFinite(value)) continue;
320
+ if (value < min) min = value;
321
+ if (value > max) max = value;
322
+ }
323
+ return min === Infinity ? null : [min, max];
324
+ }
325
+ const NUMBER_CACHE = /* @__PURE__ */ new Map();
326
+ const DATE_CACHE = /* @__PURE__ */ new Map();
327
+ function numberFormat(intl, options = {}) {
328
+ const key = `${intl}|${JSON.stringify(options)}`;
329
+ let format = NUMBER_CACHE.get(key);
330
+ if (!format) {
331
+ format = new Intl.NumberFormat(intl, options);
332
+ NUMBER_CACHE.set(key, format);
333
+ }
334
+ return format;
335
+ }
336
+ function dateFormat(intl, options) {
337
+ const key = `${intl}|${JSON.stringify(options)}`;
338
+ let format = DATE_CACHE.get(key);
339
+ if (!format) {
340
+ format = new Intl.DateTimeFormat(intl, options);
341
+ DATE_CACHE.set(key, format);
342
+ }
343
+ return format;
344
+ }
345
+ function chartNumberFormatter(intl, format = "number") {
346
+ if (typeof format === "function") return format;
347
+ const formatter = numberFormat(intl, format === "integer" ? { maximumFractionDigits: 0 } : format === "compact" ? {
348
+ notation: "compact",
349
+ maximumFractionDigits: 1
350
+ } : format === "percent" ? {
351
+ style: "percent",
352
+ maximumFractionDigits: 1
353
+ } : { maximumFractionDigits: 2 });
354
+ return (value) => Number.isFinite(value) ? formatter.format(format === "percent" ? value / 100 : value) : "";
355
+ }
356
+ function tickFormatter(intl, ticks, format = "number") {
357
+ if (typeof format === "function" || format === "compact" || format === "percent") return chartNumberFormatter(intl, format);
358
+ const step = ticks.length > 1 ? Math.abs(ticks[1] - ticks[0]) : 0;
359
+ const decimals = Math.min(2, decimalsOf(step));
360
+ const formatter = numberFormat(intl, {
361
+ minimumFractionDigits: format === "integer" ? 0 : decimals,
362
+ maximumFractionDigits: format === "integer" ? 0 : decimals
363
+ });
364
+ return (value) => formatter.format(value);
365
+ }
366
+ function compactNumber(value, intl = "en-US") {
367
+ return chartNumberFormatter(intl, "compact")(value);
368
+ }
369
+ function timeTickOptions(interval, span) {
370
+ const multiYear = span > 316224e5;
371
+ switch (interval.unit) {
372
+ case "year": return { year: "numeric" };
373
+ case "month": return multiYear ? {
374
+ month: "short",
375
+ year: "numeric"
376
+ } : { month: "short" };
377
+ case "week":
378
+ case "day": return {
379
+ day: "numeric",
380
+ month: "short"
381
+ };
382
+ case "hour":
383
+ case "minute": return {
384
+ hour: "2-digit",
385
+ minute: "2-digit"
386
+ };
387
+ default: return {
388
+ hour: "2-digit",
389
+ minute: "2-digit",
390
+ second: "2-digit"
391
+ };
392
+ }
393
+ }
394
+ function timeTickFormatter(intl, interval, span) {
395
+ const formatter = dateFormat(intl, timeTickOptions(interval, span));
396
+ return (time) => formatter.format(time);
397
+ }
398
+ function timeTooltipFormatter(intl, interval) {
399
+ const formatter = dateFormat(intl, interval.unit === "year" || interval.unit === "month" ? {
400
+ day: "numeric",
401
+ month: "short",
402
+ year: "numeric"
403
+ } : interval.unit === "week" || interval.unit === "day" ? {
404
+ day: "numeric",
405
+ month: "short",
406
+ year: "numeric"
407
+ } : {
408
+ day: "numeric",
409
+ month: "short",
410
+ hour: "2-digit",
411
+ minute: "2-digit"
412
+ });
413
+ return (time) => formatter.format(time);
414
+ }
415
+ function chartMonthNames(intl, month = "long") {
416
+ const formatter = dateFormat(intl, { month });
417
+ return Array.from({ length: 12 }, (_, index) => {
418
+ const name = formatter.format(new Date(2024, index, 15));
419
+ return name.charAt(0).toLocaleUpperCase(intl) + name.slice(1);
420
+ });
421
+ }
422
+ const NARROW = /[.,:;!|il'`ijIft ]/;
423
+ const WIDE = /[MWmw@%]/;
424
+ const UPPER = /[A-ZА-ЯЁЇІЄҐ]/;
425
+ function textWidth(text, fontSize = 12) {
426
+ let width = 0;
427
+ for (const char of text) width += NARROW.test(char) ? .3 : WIDE.test(char) ? .86 : UPPER.test(char) ? .66 : /\d/.test(char) ? .62 : .56;
428
+ return width * fontSize;
429
+ }
430
+ function truncateText(text, maxWidth, fontSize = 12) {
431
+ if (textWidth(text, fontSize) <= maxWidth) return text;
432
+ const chars = [...text];
433
+ while (chars.length > 1 && textWidth(`${chars.join("")}…`, fontSize) > maxWidth) chars.pop();
434
+ return `${chars.join("").trimEnd()}…`;
435
+ }
436
+ const round = (value) => Math.round(value * 100) / 100;
437
+ const pair = (point) => `${round(point.x)},${round(point.y)}`;
438
+ function slope(a, b) {
439
+ const dx = b.x - a.x;
440
+ return dx ? (b.y - a.y) / dx : 0;
441
+ }
442
+ function sign(value) {
443
+ return value < 0 ? -1 : 1;
444
+ }
445
+ function monotoneTangents(points) {
446
+ const count = points.length;
447
+ if (count < 2) return points.map(() => 0);
448
+ const slopes = points.slice(1).map((point, index) => slope(points[index], point));
449
+ const tangents = new Array(count);
450
+ tangents[0] = slopes[0];
451
+ tangents[count - 1] = slopes[count - 2];
452
+ for (let index = 1; index < count - 1; index++) {
453
+ const before = slopes[index - 1];
454
+ const after = slopes[index];
455
+ if (before * after <= 0) {
456
+ tangents[index] = 0;
457
+ continue;
458
+ }
459
+ const h0 = points[index].x - points[index - 1].x;
460
+ const h1 = points[index + 1].x - points[index].x;
461
+ const weighted = (before * h1 + after * h0) / (h0 + h1);
462
+ tangents[index] = (sign(before) + sign(after)) * Math.min(Math.abs(before), Math.abs(after), .5 * Math.abs(weighted));
463
+ }
464
+ return tangents;
465
+ }
466
+ function segment(points, curve, move) {
467
+ if (!points.length) return "";
468
+ const start = `${move ? "M" : "L"}${pair(points[0])}`;
469
+ if (points.length === 1) return start;
470
+ if (curve === "straight") return start + points.slice(1).map((point) => `L${pair(point)}`).join("");
471
+ if (curve === "step") return start + points.slice(1).map((point, index) => {
472
+ const middle = (points[index].x + point.x) / 2;
473
+ return `H${round(middle)}V${round(point.y)}H${round(point.x)}`;
474
+ }).join("");
475
+ const tangents = monotoneTangents(points);
476
+ return start + points.slice(1).map((point, index) => {
477
+ const previous = points[index];
478
+ const third = (point.x - previous.x) / 3;
479
+ const c1 = {
480
+ x: previous.x + third,
481
+ y: previous.y + third * tangents[index]
482
+ };
483
+ const c2 = {
484
+ x: point.x - third,
485
+ y: point.y - third * tangents[index + 1]
486
+ };
487
+ return `C${pair(c1)} ${pair(c2)} ${pair(point)}`;
488
+ }).join("");
489
+ }
490
+ function splitGaps(points) {
491
+ const runs = [];
492
+ let run = [];
493
+ for (const point of points) if (point) run.push(point);
494
+ else if (run.length) {
495
+ runs.push(run);
496
+ run = [];
497
+ }
498
+ if (run.length) runs.push(run);
499
+ return runs;
500
+ }
501
+ function linePath(points, curve = "smooth") {
502
+ return splitGaps(points).map((run) => segment(run, curve, true)).join("");
503
+ }
504
+ function areaPath(top, bottom, curve = "smooth") {
505
+ const runs = [];
506
+ let current = null;
507
+ top.forEach((point, index) => {
508
+ const base = bottom[index];
509
+ if (point && base) {
510
+ current ??= {
511
+ top: [],
512
+ bottom: []
513
+ };
514
+ current.top.push(point);
515
+ current.bottom.push(base);
516
+ } else if (current) {
517
+ runs.push(current);
518
+ current = null;
519
+ }
520
+ });
521
+ if (current) runs.push(current);
522
+ return runs.filter((run) => run.top.length > 1).map((run) => `${segment(run.top, curve, true)}${segment([...run.bottom].reverse(), curve, false)}Z`).join("");
523
+ }
524
+ function stackValues(series, type = "normal") {
525
+ const length = Math.max(0, ...series.map((values) => values.length));
526
+ const totals = Array.from({ length }, (_, index) => series.reduce((sum, values) => sum + Math.abs(values[index] ?? 0), 0));
527
+ const positive = new Array(length).fill(0);
528
+ const negative = new Array(length).fill(0);
529
+ return series.map((values) => Array.from({ length }, (_, index) => {
530
+ const raw = values[index];
531
+ if (raw === null || raw === void 0 || !Number.isFinite(raw)) return null;
532
+ const value = type === "100%" ? totals[index] ? raw / totals[index] * 100 : 0 : raw;
533
+ if (value >= 0) {
534
+ const start = positive[index];
535
+ positive[index] += value;
536
+ return [start, positive[index]];
537
+ }
538
+ const start = negative[index];
539
+ negative[index] += value;
540
+ return [start, negative[index]];
541
+ }));
542
+ }
543
+ function stackExtent(stacked) {
544
+ let min = 0;
545
+ let max = 0;
546
+ for (const values of stacked) for (const value of values) if (value) {
547
+ min = Math.min(min, value[0], value[1]);
548
+ max = Math.max(max, value[0], value[1]);
549
+ }
550
+ return [min, max];
551
+ }
552
+ function topOfStack(stacked, index, sign) {
553
+ let found = -1;
554
+ stacked.forEach((values, seriesIndex) => {
555
+ const value = values[index];
556
+ if (value && value[1] !== value[0] && Math.sign(value[1] - value[0]) === sign) found = seriesIndex;
557
+ });
558
+ return found;
559
+ }
560
+ function largestTriangleThreeBuckets(points, threshold) {
561
+ const count = points.length;
562
+ if (threshold >= count || threshold < 3) return [...points];
563
+ const sampled = [points[0]];
564
+ const every = (count - 2) / (threshold - 2);
565
+ let anchor = 0;
566
+ for (let bucket = 0; bucket < threshold - 2; bucket++) {
567
+ const nextStart = Math.floor((bucket + 1) * every) + 1;
568
+ const nextEnd = Math.min(count, Math.floor((bucket + 2) * every) + 1);
569
+ let averageX = 0;
570
+ let averageY = 0;
571
+ const nextLength = Math.max(1, nextEnd - nextStart);
572
+ for (let index = nextStart; index < nextEnd; index++) {
573
+ averageX += points[index].x;
574
+ averageY += points[index].y;
575
+ }
576
+ averageX /= nextLength;
577
+ averageY /= nextLength;
578
+ const start = Math.floor(bucket * every) + 1;
579
+ const end = Math.floor((bucket + 1) * every) + 1;
580
+ const a = points[anchor];
581
+ let largest = -1;
582
+ let chosen = start;
583
+ for (let index = start; index < end; index++) {
584
+ const area = Math.abs((a.x - averageX) * (points[index].y - a.y) - (a.x - points[index].x) * (averageY - a.y));
585
+ if (area > largest) {
586
+ largest = area;
587
+ chosen = index;
588
+ }
589
+ }
590
+ sampled.push(points[chosen]);
591
+ anchor = chosen;
592
+ }
593
+ sampled.push(points[count - 1]);
594
+ return sampled;
595
+ }
596
+ function decimateSeries(points, threshold) {
597
+ if (points.length <= threshold) return points.map((point, index) => point ? {
598
+ ...point,
599
+ index
600
+ } : null);
601
+ const result = [];
602
+ let run = [];
603
+ const share = threshold / points.length;
604
+ const flush = () => {
605
+ if (run.length) {
606
+ result.push(...largestTriangleThreeBuckets(run, Math.max(3, Math.round(run.length * share))));
607
+ run = [];
608
+ }
609
+ };
610
+ points.forEach((point, index) => {
611
+ if (point) run.push({
612
+ ...point,
613
+ index
614
+ });
615
+ else {
616
+ flush();
617
+ result.push(null);
618
+ }
619
+ });
620
+ flush();
621
+ return result;
622
+ }
623
+ const TX_CHART_PALETTE_SIZE = 7;
624
+ function chartColor(index) {
625
+ return `var(--tx-chart-series-color${(index % 7 + 7) % 7 + 1})`;
626
+ }
627
+ function chartPalette(count = 7) {
628
+ return Array.from({ length: count }, (_, index) => chartColor(index));
629
+ }
630
+ function seriesColor(color, index) {
631
+ return color || chartColor(index);
632
+ }
633
+ const GAP = 8;
634
+ const LABEL_PAD = 10;
635
+ const ROTATE = -45;
636
+ function valueDomain(options, count) {
637
+ const [rawMin, rawMax] = options.extent ?? [0, 1];
638
+ if (options.scale === "log") {
639
+ const positiveMin = rawMin > 0 ? rawMin : 1;
640
+ return logDomain(options.min ?? positiveMin, options.max ?? Math.max(rawMax, positiveMin));
641
+ }
642
+ const includeZero = options.includeZero ?? true;
643
+ const nice = niceDomain(options.min ?? (includeZero ? Math.min(0, rawMin) : rawMin), options.max ?? (includeZero ? Math.max(0, rawMax) : rawMax), count);
644
+ return [options.min ?? nice[0], options.max ?? nice[1]];
645
+ }
646
+ function pickEvery(ticks, every) {
647
+ if (every <= 1) return [...ticks];
648
+ return ticks.filter((_, position) => position % every === 0);
649
+ }
650
+ function cartesianLayout(options) {
651
+ const fontSize = options.fontSize ?? 12;
652
+ const horizontal = options.horizontal ?? false;
653
+ const width = Math.max(1, options.width);
654
+ const height = Math.max(1, options.height);
655
+ const showCategoryAxis = options.showCategoryAxis ?? true;
656
+ const showValueAxis = options.showValueAxis ?? true;
657
+ const valueLength = horizontal ? width * .75 : height - fontSize * 3;
658
+ const tickCount = options.value.tickCount ?? Math.max(2, Math.min(horizontal ? 8 : 6, Math.round(valueLength / (horizontal ? 90 : 62))));
659
+ const domain = valueDomain(options.value, tickCount);
660
+ const valueTicks = (options.value.scale === "log" ? logScale(domain, [0, 1]) : linearScale(domain, [0, 1])).ticks(tickCount);
661
+ const valueFormat = tickFormatter(options.intl, valueTicks, options.value.format);
662
+ const valueLabels = valueTicks.map((tick) => valueFormat(tick));
663
+ const valueLabelWidth = showValueAxis ? Math.max(0, ...valueLabels.map((label) => textWidth(label, fontSize))) : 0;
664
+ const cat = options.category;
665
+ const count = cat.count ?? cat.labels?.length ?? 0;
666
+ const maxLabelWidth = cat.maxLabelWidth ?? 220;
667
+ const lineHeight = fontSize * 1.25;
668
+ const xTop = options.xAxisPosition === "top";
669
+ const yRight = options.yAxisPosition === "right";
670
+ const categoryLabelTexts = cat.kind === "band" || cat.kind === "point" ? [...cat.labels ?? []] : [];
671
+ const titleSpace = lineHeight + 4;
672
+ let ySpace;
673
+ let xSpace;
674
+ let edgeX;
675
+ if (horizontal) {
676
+ const labelWidth = showCategoryAxis ? Math.min(maxLabelWidth, Math.max(0, ...categoryLabelTexts.map((label) => textWidth(label, fontSize)))) : 0;
677
+ ySpace = showCategoryAxis ? labelWidth + LABEL_PAD + 2 : 4;
678
+ xSpace = showValueAxis ? lineHeight + GAP : GAP;
679
+ edgeX = Math.max(12, (showValueAxis ? textWidth(valueLabels[valueLabels.length - 1] ?? "", fontSize) / 2 : 0) + 2);
680
+ if (cat.title && showCategoryAxis) ySpace += titleSpace;
681
+ if (options.value.title && showValueAxis) xSpace += titleSpace;
682
+ } else {
683
+ ySpace = showValueAxis ? valueLabelWidth + LABEL_PAD + 4 : 4;
684
+ xSpace = showCategoryAxis ? lineHeight + GAP : GAP;
685
+ edgeX = 12;
686
+ if (cat.title && showCategoryAxis) xSpace += titleSpace;
687
+ if (options.value.title && showValueAxis) ySpace += titleSpace;
688
+ }
689
+ const edgeY = horizontal ? 4 : fontSize / 2 + 4;
690
+ let left = yRight ? horizontal ? edgeX : 4 : ySpace;
691
+ let right = yRight ? ySpace : edgeX;
692
+ let top = xTop ? xSpace : edgeY;
693
+ let bottom = xTop ? edgeY : xSpace;
694
+ const plotFor = (b, l, r) => ({
695
+ left: l,
696
+ top,
697
+ width: Math.max(1, width - l - r),
698
+ height: Math.max(1, height - top - b)
699
+ });
700
+ let plot = plotFor(bottom, left, right);
701
+ let rotate = 0;
702
+ let categoryTicks = [];
703
+ const buildScale = (area) => {
704
+ const range = horizontal ? [area.top, area.top + area.height] : [area.left, area.left + area.width];
705
+ if (cat.kind === "band") return bandScale(count, range, cat.paddingInner ?? 0, 0);
706
+ if (cat.kind === "point") return pointScale(count, range);
707
+ if (cat.kind === "time") return timeScale(cat.domain ?? [0, 1], range);
708
+ return linearScale(cat.domain ?? [0, 1], range);
709
+ };
710
+ const ticksFor = (scale, area) => {
711
+ if (scale.kind === "band" || scale.kind === "point") return categoryLabelTexts.map((label, index) => ({
712
+ index,
713
+ value: index,
714
+ label
715
+ }));
716
+ const span = horizontal ? area.height : area.width;
717
+ const wanted = Math.max(2, Math.min(12, Math.floor(span / 80)));
718
+ const ticks = scale.kind === "time" ? scale.ticks(wanted) : scale.ticks(wanted);
719
+ const format = cat.format ?? (scale.kind === "time" ? timeTickFormatter(options.intl, scale.interval(wanted), scale.domain[1] - scale.domain[0]) : tickFormatter(options.intl, ticks));
720
+ return ticks.map((value, index) => ({
721
+ index,
722
+ value,
723
+ label: format(value)
724
+ }));
725
+ };
726
+ const position = (scale, tick) => scale.kind === "band" ? scale.center(tick.index) : scale.kind === "point" ? scale.at(tick.index) : scale.map(tick.value);
727
+ let scale = buildScale(plot);
728
+ if (showCategoryAxis && !horizontal) {
729
+ const all = ticksFor(scale, plot);
730
+ const mode = cat.labelMode ?? "auto";
731
+ const widest = Math.max(0, ...all.map((tick) => textWidth(tick.label, fontSize)));
732
+ const spacing = all.length > 1 ? Math.abs(position(scale, all[1]) - position(scale, all[0])) : plot.width;
733
+ const limit = cat.maxLabels && all.length > cat.maxLabels ? Math.ceil(all.length / cat.maxLabels) : 1;
734
+ const fitsFlat = widest + GAP <= spacing * limit;
735
+ const rotatedStep = lineHeight * 1.2;
736
+ const canRotate = mode !== "skip" && (mode === "rotate" || all.length <= 40 && spacing * limit >= rotatedStep);
737
+ if (fitsFlat && mode !== "rotate") categoryTicks = pickEvery(all, limit);
738
+ else if (canRotate) {
739
+ rotate = ROTATE;
740
+ const capped = Math.min(widest, maxLabelWidth, height * .35 / Math.SQRT1_2);
741
+ const rotatedSpace = (capped + lineHeight) * Math.SQRT1_2 + GAP + (cat.title ? titleSpace : 0);
742
+ if (xTop) {
743
+ top = rotatedSpace;
744
+ right = Math.max(right, capped * Math.SQRT1_2 - 4);
745
+ } else {
746
+ bottom = rotatedSpace;
747
+ left = Math.max(left, capped * Math.SQRT1_2 - 4);
748
+ }
749
+ plot = plotFor(bottom, left, right);
750
+ scale = buildScale(plot);
751
+ const nextSpacing = all.length > 1 ? Math.abs(position(scale, all[1]) - position(scale, all[0])) : plot.width;
752
+ categoryTicks = pickEvery(all, Math.max(limit, Math.ceil(rotatedStep / Math.max(1, nextSpacing))));
753
+ } else categoryTicks = pickEvery(all, Math.max(limit, Math.ceil((widest + GAP) / Math.max(1, spacing))));
754
+ if (!rotate && categoryTicks.length && scale.kind !== "band") {
755
+ const first = textWidth(categoryTicks[0].label, fontSize) / 2;
756
+ const last = textWidth(categoryTicks[categoryTicks.length - 1].label, fontSize) / 2;
757
+ const firstOverflow = first - (position(scale, categoryTicks[0]) - 0);
758
+ const lastOverflow = position(scale, categoryTicks[categoryTicks.length - 1]) + last - width;
759
+ if (firstOverflow > 0 || lastOverflow > 0) {
760
+ plot = plotFor(bottom, left + Math.max(0, firstOverflow), right + Math.max(0, lastOverflow + 2));
761
+ scale = buildScale(plot);
762
+ }
763
+ }
764
+ } else if (showCategoryAxis) {
765
+ const all = ticksFor(scale, plot);
766
+ const spacing = all.length > 1 ? Math.abs(position(scale, all[1]) - position(scale, all[0])) : plot.height;
767
+ categoryTicks = pickEvery(all, Math.max(1, Math.ceil(lineHeight / Math.max(1, spacing))));
768
+ }
769
+ const valueRange = horizontal ? [plot.left, plot.left + plot.width] : [plot.top + plot.height, plot.top];
770
+ const value = options.value.scale === "log" ? logScale(domain, valueRange) : linearScale(domain, valueRange);
771
+ const grid = [];
772
+ const gridMode = options.grid ?? "value";
773
+ const axes = [];
774
+ const right2 = plot.left + plot.width;
775
+ const bottom2 = plot.top + plot.height;
776
+ const valueAxisLabels = valueTicks.map((tick, index) => {
777
+ const at = value.map(tick);
778
+ return horizontal ? {
779
+ text: valueLabels[index],
780
+ x: at,
781
+ y: xTop ? plot.top - GAP : bottom2 + GAP,
782
+ anchor: "middle",
783
+ baseline: xTop ? "auto" : "hanging",
784
+ rotate: 0
785
+ } : {
786
+ text: valueLabels[index],
787
+ x: yRight ? right2 + LABEL_PAD : plot.left - LABEL_PAD,
788
+ y: at,
789
+ anchor: yRight ? "start" : "end",
790
+ baseline: "middle",
791
+ rotate: 0
792
+ };
793
+ });
794
+ if (gridMode === "value" || gridMode === "both") valueTicks.forEach((tick) => {
795
+ const at = value.map(tick);
796
+ grid.push(horizontal ? {
797
+ x1: at,
798
+ y1: plot.top,
799
+ x2: at,
800
+ y2: bottom2
801
+ } : {
802
+ x1: plot.left,
803
+ y1: at,
804
+ x2: right2,
805
+ y2: at
806
+ });
807
+ });
808
+ if (gridMode === "category" || gridMode === "both") categoryTicks.forEach((tick) => {
809
+ const at = position(scale, tick);
810
+ grid.push(horizontal ? {
811
+ x1: plot.left,
812
+ y1: at,
813
+ x2: right2,
814
+ y2: at
815
+ } : {
816
+ x1: at,
817
+ y1: plot.top,
818
+ x2: at,
819
+ y2: bottom2
820
+ });
821
+ });
822
+ const xTitle = (text) => ({
823
+ text,
824
+ x: plot.left + plot.width / 2,
825
+ y: xTop ? lineHeight - 2 : height - 4,
826
+ rotate: 0
827
+ });
828
+ const yTitle = (text) => ({
829
+ text,
830
+ x: yRight ? width - lineHeight / 2 - 2 : lineHeight / 2 + 2,
831
+ y: plot.top + plot.height / 2,
832
+ rotate: yRight ? 90 : -90
833
+ });
834
+ if (showValueAxis) axes.push({
835
+ position: horizontal ? xTop ? "top" : "bottom" : yRight ? "right" : "left",
836
+ labels: valueAxisLabels,
837
+ line: null,
838
+ title: options.value.title ? horizontal ? xTitle(options.value.title) : yTitle(options.value.title) : void 0
839
+ });
840
+ if (showCategoryAxis) {
841
+ const labels = categoryTicks.map((tick) => {
842
+ const at = position(scale, tick);
843
+ if (horizontal) {
844
+ const text = truncateText(tick.label, maxLabelWidth, fontSize);
845
+ return {
846
+ text,
847
+ x: yRight ? right2 + LABEL_PAD : plot.left - LABEL_PAD,
848
+ y: at,
849
+ anchor: yRight ? "start" : "end",
850
+ baseline: "middle",
851
+ rotate: 0,
852
+ title: text !== tick.label ? tick.label : void 0
853
+ };
854
+ }
855
+ const y = xTop ? plot.top - GAP : bottom2 + GAP;
856
+ const baseline = xTop ? "auto" : "hanging";
857
+ if (rotate) {
858
+ const text = truncateText(tick.label, Math.min(maxLabelWidth, height * .35 / Math.SQRT1_2), fontSize);
859
+ return {
860
+ text,
861
+ x: at,
862
+ y,
863
+ anchor: xTop ? "start" : "end",
864
+ baseline,
865
+ rotate,
866
+ title: text !== tick.label ? tick.label : void 0
867
+ };
868
+ }
869
+ return {
870
+ text: tick.label,
871
+ x: at,
872
+ y,
873
+ anchor: "middle",
874
+ baseline,
875
+ rotate: 0
876
+ };
877
+ });
878
+ axes.push({
879
+ position: horizontal ? yRight ? "right" : "left" : xTop ? "top" : "bottom",
880
+ labels,
881
+ line: null,
882
+ title: cat.title ? horizontal ? yTitle(cat.title) : xTitle(cat.title) : void 0
883
+ });
884
+ }
885
+ const zeroAt = domain[0] < 0 && domain[1] > 0 && options.value.scale !== "log" ? value.map(0) : null;
886
+ const zero = zeroAt === null ? null : horizontal ? {
887
+ x1: zeroAt,
888
+ y1: plot.top,
889
+ x2: zeroAt,
890
+ y2: bottom2,
891
+ zero: true
892
+ } : {
893
+ x1: plot.left,
894
+ y1: zeroAt,
895
+ x2: right2,
896
+ y2: zeroAt,
897
+ zero: true
898
+ };
899
+ const categoryPosition = (index, x) => {
900
+ if (scale.kind === "band") return scale.center(index);
901
+ if (scale.kind === "point") return scale.at(index);
902
+ return scale.map(x ?? index);
903
+ };
904
+ const categoryIndexAt = (at, xs) => {
905
+ if (scale.kind === "band" || scale.kind === "point") return scale.indexAt(at);
906
+ const target = scale.invert(at);
907
+ const values = xs ?? [];
908
+ let best = -1;
909
+ let distance = Infinity;
910
+ values.forEach((x, index) => {
911
+ const next = Math.abs(x - target);
912
+ if (next < distance) {
913
+ distance = next;
914
+ best = index;
915
+ }
916
+ });
917
+ return best;
918
+ };
919
+ return {
920
+ plot,
921
+ value,
922
+ category: scale,
923
+ valueTicks,
924
+ axes: {
925
+ axes,
926
+ grid,
927
+ zero
928
+ },
929
+ horizontal,
930
+ categoryPosition,
931
+ categoryIndexAt
932
+ };
933
+ }
934
+ const TX_CHART_FALLBACK_WIDTH = 640;
935
+ const TX_CHART_FALLBACK_HEIGHT = 350;
936
+ const TX_CHART_LEGEND_ROW = 31;
937
+ const TX_CHART_LEGEND_SIDE = 175;
938
+ function chartHeightValue(height, fallback = 350) {
939
+ if (typeof height === "number") return Number.isFinite(height) && height > 0 ? height : fallback;
940
+ const pixels = /^(\d+(?:\.\d+)?)px$/.exec(height.trim());
941
+ return pixels ? Number(pixels[1]) : fallback;
942
+ }
943
+ function chartBoxHeight(height, legend) {
944
+ const total = chartHeightValue(height);
945
+ return legend === "top" || legend === "bottom" ? Math.max(1, total - 31) : total;
946
+ }
947
+ function initialChartSize(height, legend, width = 640) {
948
+ return {
949
+ width: legend === "left" || legend === "right" ? width - 175 : width,
950
+ height: chartBoxHeight(height, legend)
951
+ };
952
+ }
953
+ const TX_CHART_ENTER_MS = 1100;
954
+ function prefersReducedMotion(document) {
955
+ return document.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
956
+ }
957
+ function injectChartEntrance() {
958
+ const host = inject(ElementRef).nativeElement;
959
+ const document = inject(DOCUMENT);
960
+ const browser = isPlatformBrowser(inject(PLATFORM_ID));
961
+ const active = signal(false, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
962
+ let timer;
963
+ inject(DestroyRef).onDestroy(() => clearTimeout(timer));
964
+ const play = () => {
965
+ if (!browser || prefersReducedMotion(document)) return;
966
+ clearTimeout(timer);
967
+ active.set(true);
968
+ timer = setTimeout(() => active.set(false), TX_CHART_ENTER_MS);
969
+ };
970
+ if (browser && !host.hasChildNodes()) play();
971
+ return {
972
+ active: active.asReadonly(),
973
+ play
974
+ };
975
+ }
976
+ var TxChartLegendTemplate = class TxChartLegendTemplate {
977
+ template = inject(TemplateRef);
978
+ static ngTemplateContextGuard(_directive, context) {
979
+ return !!context;
980
+ }
981
+ static ɵfac = i0.ɵɵngDeclareFactory({
982
+ minVersion: "12.0.0",
983
+ version: "22.2.3",
984
+ ngImport: i0,
985
+ type: TxChartLegendTemplate,
986
+ deps: [],
987
+ target: i0.ɵɵFactoryTarget.Directive
988
+ });
989
+ static ɵdir = i0.ɵɵngDeclareDirective({
990
+ minVersion: "14.0.0",
991
+ version: "22.2.3",
992
+ type: TxChartLegendTemplate,
993
+ isStandalone: true,
994
+ selector: "ng-template[txChartLegend]",
995
+ ngImport: i0
996
+ });
997
+ };
998
+ i0.ɵɵngDeclareClassMetadata({
999
+ minVersion: "12.0.0",
1000
+ version: "22.2.3",
1001
+ ngImport: i0,
1002
+ type: TxChartLegendTemplate,
1003
+ decorators: [{
1004
+ type: Directive,
1005
+ args: [{ selector: "ng-template[txChartLegend]" }]
1006
+ }]
1007
+ });
1008
+ var TxChartTooltipTemplate = class TxChartTooltipTemplate {
1009
+ template = inject(TemplateRef);
1010
+ static ngTemplateContextGuard(_directive, context) {
1011
+ return !!context;
1012
+ }
1013
+ static ɵfac = i0.ɵɵngDeclareFactory({
1014
+ minVersion: "12.0.0",
1015
+ version: "22.2.3",
1016
+ ngImport: i0,
1017
+ type: TxChartTooltipTemplate,
1018
+ deps: [],
1019
+ target: i0.ɵɵFactoryTarget.Directive
1020
+ });
1021
+ static ɵdir = i0.ɵɵngDeclareDirective({
1022
+ minVersion: "14.0.0",
1023
+ version: "22.2.3",
1024
+ type: TxChartTooltipTemplate,
1025
+ isStandalone: true,
1026
+ selector: "ng-template[txChartTooltip]",
1027
+ ngImport: i0
1028
+ });
1029
+ };
1030
+ i0.ɵɵngDeclareClassMetadata({
1031
+ minVersion: "12.0.0",
1032
+ version: "22.2.3",
1033
+ ngImport: i0,
1034
+ type: TxChartTooltipTemplate,
1035
+ decorators: [{
1036
+ type: Directive,
1037
+ args: [{ selector: "ng-template[txChartTooltip]" }]
1038
+ }]
1039
+ });
1040
+ var TxChartLegend = class TxChartLegend {
1041
+ host = inject(ElementRef);
1042
+ translations = injectTranslations();
1043
+ items = input([], ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
1044
+ position = input("top", ...ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []);
1045
+ align = input("start", ...ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []);
1046
+ variant = input("dot", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
1047
+ toggle = input(true, {
1048
+ ...ngDevMode ? { debugName: "toggle" } : /* istanbul ignore next */ {},
1049
+ transform: booleanAttribute
1050
+ });
1051
+ template = input(null, ...ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []);
1052
+ itemPart = input(void 0, ...ngDevMode ? [{ debugName: "itemPart" }] : /* istanbul ignore next */ []);
1053
+ toggled = output();
1054
+ hovered = output();
1055
+ hasValues = computed(() => this.variant() !== "stat" && this.items().some((item) => item.value !== void 0 || item.percent !== void 0), ...ngDevMode ? [{ debugName: "hasValues" }] : /* istanbul ignore next */ []);
1056
+ onKeydown(event, index) {
1057
+ const count = this.items().length;
1058
+ const vertical = this.position() === "left" || this.position() === "right" || this.hasValues();
1059
+ const forward = vertical ? ["ArrowDown", "ArrowRight"] : ["ArrowRight", "ArrowDown"];
1060
+ const back = vertical ? ["ArrowUp", "ArrowLeft"] : ["ArrowLeft", "ArrowUp"];
1061
+ const next = forward.includes(event.key) ? (index + 1) % count : back.includes(event.key) ? (index - 1 + count) % count : event.key === "Home" ? 0 : event.key === "End" ? count - 1 : -1;
1062
+ if (next < 0) return;
1063
+ event.preventDefault();
1064
+ const buttons = this.host.nativeElement.querySelectorAll(".tx-chart-legend__item");
1065
+ buttons.forEach((button, position) => button.tabIndex = position === next ? 0 : -1);
1066
+ buttons[next]?.focus();
1067
+ }
1068
+ static ɵfac = i0.ɵɵngDeclareFactory({
1069
+ minVersion: "12.0.0",
1070
+ version: "22.2.3",
1071
+ ngImport: i0,
1072
+ type: TxChartLegend,
1073
+ deps: [],
1074
+ target: i0.ɵɵFactoryTarget.Component
1075
+ });
1076
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1077
+ minVersion: "17.0.0",
1078
+ version: "22.2.3",
1079
+ type: TxChartLegend,
1080
+ isStandalone: true,
1081
+ selector: "tx-chart-legend",
1082
+ inputs: {
1083
+ items: {
1084
+ classPropertyName: "items",
1085
+ publicName: "items",
1086
+ isSignal: true,
1087
+ isRequired: false,
1088
+ transformFunction: null
1089
+ },
1090
+ position: {
1091
+ classPropertyName: "position",
1092
+ publicName: "position",
1093
+ isSignal: true,
1094
+ isRequired: false,
1095
+ transformFunction: null
1096
+ },
1097
+ align: {
1098
+ classPropertyName: "align",
1099
+ publicName: "align",
1100
+ isSignal: true,
1101
+ isRequired: false,
1102
+ transformFunction: null
1103
+ },
1104
+ variant: {
1105
+ classPropertyName: "variant",
1106
+ publicName: "variant",
1107
+ isSignal: true,
1108
+ isRequired: false,
1109
+ transformFunction: null
1110
+ },
1111
+ toggle: {
1112
+ classPropertyName: "toggle",
1113
+ publicName: "toggle",
1114
+ isSignal: true,
1115
+ isRequired: false,
1116
+ transformFunction: null
1117
+ },
1118
+ template: {
1119
+ classPropertyName: "template",
1120
+ publicName: "template",
1121
+ isSignal: true,
1122
+ isRequired: false,
1123
+ transformFunction: null
1124
+ },
1125
+ itemPart: {
1126
+ classPropertyName: "itemPart",
1127
+ publicName: "itemPart",
1128
+ isSignal: true,
1129
+ isRequired: false,
1130
+ transformFunction: null
1131
+ }
1132
+ },
1133
+ outputs: {
1134
+ toggled: "toggled",
1135
+ hovered: "hovered"
1136
+ },
1137
+ host: {
1138
+ properties: {
1139
+ "attr.role": "toggle() ? \"group\" : \"list\"",
1140
+ "attr.aria-label": "translations().chartLegend",
1141
+ "attr.data-position": "position()",
1142
+ "attr.data-align": "align()",
1143
+ "attr.data-variant": "variant()",
1144
+ "class.tx-chart-legend--values": "hasValues()"
1145
+ },
1146
+ classAttribute: "tx-chart-legend"
1147
+ },
1148
+ ngImport: i0,
1149
+ template: `
1150
+ @for (item of items(); track item.key; let index = $index) {
1151
+ @if (toggle()) {
1152
+ <button
1153
+ type="button"
1154
+ class="tx-chart-legend__item"
1155
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1156
+ [class]="itemPart()?.class"
1157
+ [style]="itemPart()?.style"
1158
+ [style.--tx-chart-legend-item-color]="item.color"
1159
+ [attr.aria-pressed]="!item.hidden"
1160
+ [attr.data-key]="item.key"
1161
+ [tabindex]="index === 0 ? 0 : -1"
1162
+ (click)="toggled.emit(item.key)"
1163
+ (pointerenter)="hovered.emit(item.key)"
1164
+ (pointerleave)="hovered.emit(null)"
1165
+ (focus)="hovered.emit(item.key)"
1166
+ (blur)="hovered.emit(null)"
1167
+ (keydown)="onKeydown($event, index)"
1168
+ >
1169
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1170
+ </button>
1171
+ } @else {
1172
+ <span
1173
+ class="tx-chart-legend__item"
1174
+ role="listitem"
1175
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1176
+ [class]="itemPart()?.class"
1177
+ [style]="itemPart()?.style"
1178
+ [style.--tx-chart-legend-item-color]="item.color"
1179
+ [attr.data-key]="item.key"
1180
+ (pointerenter)="hovered.emit(item.key)"
1181
+ (pointerleave)="hovered.emit(null)"
1182
+ >
1183
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1184
+ </span>
1185
+ }
1186
+ }
1187
+ <ng-template #plain let-item>
1188
+ @if (variant() === 'stat') {
1189
+ <span class="tx-chart-legend__head">
1190
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1191
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1192
+ </span>
1193
+ <span class="tx-chart-legend__stat">{{ item.value ?? '—' }}</span>
1194
+ @if (item.caption) {
1195
+ <span class="tx-chart-legend__caption">{{ item.caption }}</span>
1196
+ }
1197
+ } @else {
1198
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1199
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1200
+ @if (item.value !== undefined) {
1201
+ <span class="tx-chart-legend__value">{{ item.value }}</span>
1202
+ }
1203
+ @if (item.percent !== undefined) {
1204
+ <span class="tx-chart-legend__percent">{{ item.percent }}</span>
1205
+ }
1206
+ }
1207
+ </ng-template>
1208
+ `,
1209
+ isInline: true,
1210
+ styles: [":host{display:flex;flex-wrap:wrap;align-items:center;min-width:0}:host([data-align=center]){justify-content:center}:host([data-align=end]){justify-content:flex-end}:host([data-position=left]),:host([data-position=right]),:host(.tx-chart-legend--values){flex-direction:column;flex-wrap:nowrap;align-items:stretch}.tx-chart-legend__item{display:inline-flex;align-items:center;min-width:0;margin:0;border:0;background:none;color:inherit;font:inherit;text-align:start;text-transform:inherit;letter-spacing:inherit}button.tx-chart-legend__item{cursor:pointer}.tx-chart-legend__marker{flex-shrink:0;background:var(--tx-chart-legend-item-color)}.tx-chart-legend__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.tx-chart-legend--values) .tx-chart-legend__item{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto}.tx-chart-legend__value,.tx-chart-legend__percent,.tx-chart-legend__stat{font-variant-numeric:tabular-nums;white-space:nowrap}.tx-chart-legend__value,.tx-chart-legend__percent{text-align:end}:host([data-variant=stat]) .tx-chart-legend__item{flex-direction:column;align-items:flex-start}.tx-chart-legend__head{display:inline-flex;align-items:center;max-width:100%}:host([data-styled]){gap:var(--tx-chart-legend-item-gap);color:var(--tx-chart-legend-color);font-size:var(--tx-chart-legend-font-size);font-weight:var(--tx-chart-legend-font-weight);line-height:1.35}:host([data-styled]) .tx-chart-legend__item{gap:var(--tx-chart-legend-marker-gap);padding:var(--tx-chart-legend-padding-y) var(--tx-chart-legend-padding-x);border-radius:var(--tx-chart-legend-border-radius);transition:color var(--tx-chart-motion-hover-duration) ease,opacity var(--tx-chart-motion-hover-duration) ease,background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) button.tx-chart-legend__item:hover{background:var(--tx-chart-legend-hover-background)}:host([data-styled]) button.tx-chart-legend__item:focus-visible{outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:0}:host([data-styled]) .tx-chart-legend__marker{width:var(--tx-chart-legend-marker-size);height:var(--tx-chart-legend-marker-size);border-radius:var(--tx-chart-legend-marker-radius);transition:background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-chart-legend__item--hidden{color:var(--tx-chart-legend-muted-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__marker{background:transparent;box-shadow:inset 0 0 0 1.5px var(--tx-chart-legend-item-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:line-through;text-decoration-color:color-mix(in srgb,currentColor 45%,transparent)}:host([data-styled]) .tx-chart-legend__value,:host([data-styled]) .tx-chart-legend__percent{color:var(--tx-chart-legend-value-color);font-weight:var(--tx-font-weight-regular)}:host([data-styled]) .tx-chart-legend__value{padding-inline-start:var(--tx-chart-legend-value-gap);color:inherit;font-weight:var(--tx-chart-legend-font-weight)}:host([data-styled]) .tx-chart-legend__percent{min-width:4.5ch;padding-inline-start:var(--tx-chart-legend-percent-gap)}:host([data-styled].tx-chart-legend--values),:host([data-styled][data-position=left]),:host([data-styled][data-position=right]){gap:var(--tx-chart-legend-list-gap)}:host([data-styled][data-variant=line]) .tx-chart-legend__marker{width:var(--tx-chart-legend-line-width);height:var(--tx-chart-legend-line-height);border-radius:var(--tx-radius-full)}:host([data-styled][data-variant=line]) .tx-chart-legend__item--hidden .tx-chart-legend__marker{background:repeating-linear-gradient(90deg,var(--tx-chart-legend-item-color) 0 3px,transparent 3px 5px);box-shadow:none}:host([data-styled][data-variant=pill]){gap:calc(var(--tx-chart-legend-item-gap) + 2px)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item{padding:var(--tx-chart-legend-pill-padding-y) var(--tx-chart-legend-pill-padding-x);border-radius:var(--tx-chart-legend-pill-radius);background:color-mix(in srgb,var(--tx-chart-legend-item-color) var(--tx-chart-legend-pill-tint),transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--tx-chart-legend-item-color) 28%,transparent)}:host([data-styled][data-variant=pill]) button.tx-chart-legend__item:hover{background:color-mix(in srgb,var(--tx-chart-legend-item-color) calc(var(--tx-chart-legend-pill-tint) + 8%),transparent)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item--hidden,:host([data-styled][data-variant=pill]) button.tx-chart-legend__item--hidden:hover{background:transparent;box-shadow:inset 0 0 0 1px var(--tx-chart-legend-pill-border-color)}:host([data-styled][data-variant=stat]){gap:var(--tx-chart-legend-item-gap);align-items:stretch}:host([data-styled][data-variant=stat]) .tx-chart-legend__item{gap:2px;min-width:var(--tx-chart-legend-stat-min-width);padding:var(--tx-chart-legend-stat-padding-y) var(--tx-chart-legend-stat-padding-x);border-radius:var(--tx-chart-legend-stat-radius)}:host([data-styled][data-variant=stat]) .tx-chart-legend__head{gap:var(--tx-chart-legend-marker-gap);color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size)}:host([data-styled][data-variant=stat]) .tx-chart-legend__stat{font-size:var(--tx-chart-legend-stat-value-font-size);font-weight:var(--tx-chart-legend-stat-value-font-weight);line-height:1.2}:host([data-styled][data-variant=stat]) .tx-chart-legend__caption{color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size);font-weight:var(--tx-font-weight-regular)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden{opacity:var(--tx-chart-legend-hidden-opacity)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-chart-legend__item,:host([data-styled]) .tx-chart-legend__marker{transition:none}}\n"],
1211
+ dependencies: [{
1212
+ kind: "directive",
1213
+ type: NgTemplateOutlet,
1214
+ selector: "[ngTemplateOutlet]",
1215
+ inputs: [
1216
+ "ngTemplateOutletContext",
1217
+ "ngTemplateOutlet",
1218
+ "ngTemplateOutletInjector"
1219
+ ]
1220
+ }],
1221
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1222
+ });
1223
+ };
1224
+ i0.ɵɵngDeclareClassMetadata({
1225
+ minVersion: "12.0.0",
1226
+ version: "22.2.3",
1227
+ ngImport: i0,
1228
+ type: TxChartLegend,
1229
+ decorators: [{
1230
+ type: Component,
1231
+ args: [{
1232
+ selector: "tx-chart-legend",
1233
+ imports: [NgTemplateOutlet],
1234
+ template: `
1235
+ @for (item of items(); track item.key; let index = $index) {
1236
+ @if (toggle()) {
1237
+ <button
1238
+ type="button"
1239
+ class="tx-chart-legend__item"
1240
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1241
+ [class]="itemPart()?.class"
1242
+ [style]="itemPart()?.style"
1243
+ [style.--tx-chart-legend-item-color]="item.color"
1244
+ [attr.aria-pressed]="!item.hidden"
1245
+ [attr.data-key]="item.key"
1246
+ [tabindex]="index === 0 ? 0 : -1"
1247
+ (click)="toggled.emit(item.key)"
1248
+ (pointerenter)="hovered.emit(item.key)"
1249
+ (pointerleave)="hovered.emit(null)"
1250
+ (focus)="hovered.emit(item.key)"
1251
+ (blur)="hovered.emit(null)"
1252
+ (keydown)="onKeydown($event, index)"
1253
+ >
1254
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1255
+ </button>
1256
+ } @else {
1257
+ <span
1258
+ class="tx-chart-legend__item"
1259
+ role="listitem"
1260
+ [class.tx-chart-legend__item--hidden]="item.hidden"
1261
+ [class]="itemPart()?.class"
1262
+ [style]="itemPart()?.style"
1263
+ [style.--tx-chart-legend-item-color]="item.color"
1264
+ [attr.data-key]="item.key"
1265
+ (pointerenter)="hovered.emit(item.key)"
1266
+ (pointerleave)="hovered.emit(null)"
1267
+ >
1268
+ <ng-container [ngTemplateOutlet]="template() ?? plain" [ngTemplateOutletContext]="{ $implicit: item, index }" />
1269
+ </span>
1270
+ }
1271
+ }
1272
+ <ng-template #plain let-item>
1273
+ @if (variant() === 'stat') {
1274
+ <span class="tx-chart-legend__head">
1275
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1276
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1277
+ </span>
1278
+ <span class="tx-chart-legend__stat">{{ item.value ?? '—' }}</span>
1279
+ @if (item.caption) {
1280
+ <span class="tx-chart-legend__caption">{{ item.caption }}</span>
1281
+ }
1282
+ } @else {
1283
+ <span class="tx-chart-legend__marker" aria-hidden="true"></span>
1284
+ <span class="tx-chart-legend__label">{{ item.label }}</span>
1285
+ @if (item.value !== undefined) {
1286
+ <span class="tx-chart-legend__value">{{ item.value }}</span>
1287
+ }
1288
+ @if (item.percent !== undefined) {
1289
+ <span class="tx-chart-legend__percent">{{ item.percent }}</span>
1290
+ }
1291
+ }
1292
+ </ng-template>
1293
+ `,
1294
+ changeDetection: ChangeDetectionStrategy.OnPush,
1295
+ host: {
1296
+ class: "tx-chart-legend",
1297
+ "[attr.role]": "toggle() ? \"group\" : \"list\"",
1298
+ "[attr.aria-label]": "translations().chartLegend",
1299
+ "[attr.data-position]": "position()",
1300
+ "[attr.data-align]": "align()",
1301
+ "[attr.data-variant]": "variant()",
1302
+ "[class.tx-chart-legend--values]": "hasValues()"
1303
+ },
1304
+ styles: [":host{display:flex;flex-wrap:wrap;align-items:center;min-width:0}:host([data-align=center]){justify-content:center}:host([data-align=end]){justify-content:flex-end}:host([data-position=left]),:host([data-position=right]),:host(.tx-chart-legend--values){flex-direction:column;flex-wrap:nowrap;align-items:stretch}.tx-chart-legend__item{display:inline-flex;align-items:center;min-width:0;margin:0;border:0;background:none;color:inherit;font:inherit;text-align:start;text-transform:inherit;letter-spacing:inherit}button.tx-chart-legend__item{cursor:pointer}.tx-chart-legend__marker{flex-shrink:0;background:var(--tx-chart-legend-item-color)}.tx-chart-legend__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.tx-chart-legend--values) .tx-chart-legend__item{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto}.tx-chart-legend__value,.tx-chart-legend__percent,.tx-chart-legend__stat{font-variant-numeric:tabular-nums;white-space:nowrap}.tx-chart-legend__value,.tx-chart-legend__percent{text-align:end}:host([data-variant=stat]) .tx-chart-legend__item{flex-direction:column;align-items:flex-start}.tx-chart-legend__head{display:inline-flex;align-items:center;max-width:100%}:host([data-styled]){gap:var(--tx-chart-legend-item-gap);color:var(--tx-chart-legend-color);font-size:var(--tx-chart-legend-font-size);font-weight:var(--tx-chart-legend-font-weight);line-height:1.35}:host([data-styled]) .tx-chart-legend__item{gap:var(--tx-chart-legend-marker-gap);padding:var(--tx-chart-legend-padding-y) var(--tx-chart-legend-padding-x);border-radius:var(--tx-chart-legend-border-radius);transition:color var(--tx-chart-motion-hover-duration) ease,opacity var(--tx-chart-motion-hover-duration) ease,background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) button.tx-chart-legend__item:hover{background:var(--tx-chart-legend-hover-background)}:host([data-styled]) button.tx-chart-legend__item:focus-visible{outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:0}:host([data-styled]) .tx-chart-legend__marker{width:var(--tx-chart-legend-marker-size);height:var(--tx-chart-legend-marker-size);border-radius:var(--tx-chart-legend-marker-radius);transition:background-color var(--tx-chart-motion-hover-duration) ease,box-shadow var(--tx-chart-motion-hover-duration) ease}:host([data-styled]) .tx-chart-legend__item--hidden{color:var(--tx-chart-legend-muted-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__marker{background:transparent;box-shadow:inset 0 0 0 1.5px var(--tx-chart-legend-item-color)}:host([data-styled]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:line-through;text-decoration-color:color-mix(in srgb,currentColor 45%,transparent)}:host([data-styled]) .tx-chart-legend__value,:host([data-styled]) .tx-chart-legend__percent{color:var(--tx-chart-legend-value-color);font-weight:var(--tx-font-weight-regular)}:host([data-styled]) .tx-chart-legend__value{padding-inline-start:var(--tx-chart-legend-value-gap);color:inherit;font-weight:var(--tx-chart-legend-font-weight)}:host([data-styled]) .tx-chart-legend__percent{min-width:4.5ch;padding-inline-start:var(--tx-chart-legend-percent-gap)}:host([data-styled].tx-chart-legend--values),:host([data-styled][data-position=left]),:host([data-styled][data-position=right]){gap:var(--tx-chart-legend-list-gap)}:host([data-styled][data-variant=line]) .tx-chart-legend__marker{width:var(--tx-chart-legend-line-width);height:var(--tx-chart-legend-line-height);border-radius:var(--tx-radius-full)}:host([data-styled][data-variant=line]) .tx-chart-legend__item--hidden .tx-chart-legend__marker{background:repeating-linear-gradient(90deg,var(--tx-chart-legend-item-color) 0 3px,transparent 3px 5px);box-shadow:none}:host([data-styled][data-variant=pill]){gap:calc(var(--tx-chart-legend-item-gap) + 2px)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item{padding:var(--tx-chart-legend-pill-padding-y) var(--tx-chart-legend-pill-padding-x);border-radius:var(--tx-chart-legend-pill-radius);background:color-mix(in srgb,var(--tx-chart-legend-item-color) var(--tx-chart-legend-pill-tint),transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--tx-chart-legend-item-color) 28%,transparent)}:host([data-styled][data-variant=pill]) button.tx-chart-legend__item:hover{background:color-mix(in srgb,var(--tx-chart-legend-item-color) calc(var(--tx-chart-legend-pill-tint) + 8%),transparent)}:host([data-styled][data-variant=pill]) .tx-chart-legend__item--hidden,:host([data-styled][data-variant=pill]) button.tx-chart-legend__item--hidden:hover{background:transparent;box-shadow:inset 0 0 0 1px var(--tx-chart-legend-pill-border-color)}:host([data-styled][data-variant=stat]){gap:var(--tx-chart-legend-item-gap);align-items:stretch}:host([data-styled][data-variant=stat]) .tx-chart-legend__item{gap:2px;min-width:var(--tx-chart-legend-stat-min-width);padding:var(--tx-chart-legend-stat-padding-y) var(--tx-chart-legend-stat-padding-x);border-radius:var(--tx-chart-legend-stat-radius)}:host([data-styled][data-variant=stat]) .tx-chart-legend__head{gap:var(--tx-chart-legend-marker-gap);color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size)}:host([data-styled][data-variant=stat]) .tx-chart-legend__stat{font-size:var(--tx-chart-legend-stat-value-font-size);font-weight:var(--tx-chart-legend-stat-value-font-weight);line-height:1.2}:host([data-styled][data-variant=stat]) .tx-chart-legend__caption{color:var(--tx-chart-legend-muted-color);font-size:var(--tx-chart-legend-stat-label-font-size);font-weight:var(--tx-font-weight-regular)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden{opacity:var(--tx-chart-legend-hidden-opacity)}:host([data-styled][data-variant=stat]) .tx-chart-legend__item--hidden .tx-chart-legend__label{text-decoration:none}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-chart-legend__item,:host([data-styled]) .tx-chart-legend__marker{transition:none}}\n"]
1305
+ }]
1306
+ }],
1307
+ propDecorators: {
1308
+ items: [{
1309
+ type: i0.Input,
1310
+ args: [{
1311
+ isSignal: true,
1312
+ alias: "items",
1313
+ required: false
1314
+ }]
1315
+ }],
1316
+ position: [{
1317
+ type: i0.Input,
1318
+ args: [{
1319
+ isSignal: true,
1320
+ alias: "position",
1321
+ required: false
1322
+ }]
1323
+ }],
1324
+ align: [{
1325
+ type: i0.Input,
1326
+ args: [{
1327
+ isSignal: true,
1328
+ alias: "align",
1329
+ required: false
1330
+ }]
1331
+ }],
1332
+ variant: [{
1333
+ type: i0.Input,
1334
+ args: [{
1335
+ isSignal: true,
1336
+ alias: "variant",
1337
+ required: false
1338
+ }]
1339
+ }],
1340
+ toggle: [{
1341
+ type: i0.Input,
1342
+ args: [{
1343
+ isSignal: true,
1344
+ alias: "toggle",
1345
+ required: false
1346
+ }]
1347
+ }],
1348
+ template: [{
1349
+ type: i0.Input,
1350
+ args: [{
1351
+ isSignal: true,
1352
+ alias: "template",
1353
+ required: false
1354
+ }]
1355
+ }],
1356
+ itemPart: [{
1357
+ type: i0.Input,
1358
+ args: [{
1359
+ isSignal: true,
1360
+ alias: "itemPart",
1361
+ required: false
1362
+ }]
1363
+ }],
1364
+ toggled: [{
1365
+ type: i0.Output,
1366
+ args: ["toggled"]
1367
+ }],
1368
+ hovered: [{
1369
+ type: i0.Output,
1370
+ args: ["hovered"]
1371
+ }]
1372
+ }
1373
+ });
1374
+ var TxChartAxes = class TxChartAxes {
1375
+ model = input.required({
1376
+ ...ngDevMode ? { debugName: "model" } : /* istanbul ignore next */ {},
1377
+ alias: "tx-chart-axes"
1378
+ });
1379
+ gridPart = input(void 0, ...ngDevMode ? [{ debugName: "gridPart" }] : /* istanbul ignore next */ []);
1380
+ axisPart = input(void 0, ...ngDevMode ? [{ debugName: "axisPart" }] : /* istanbul ignore next */ []);
1381
+ static ɵfac = i0.ɵɵngDeclareFactory({
1382
+ minVersion: "12.0.0",
1383
+ version: "22.2.3",
1384
+ ngImport: i0,
1385
+ type: TxChartAxes,
1386
+ deps: [],
1387
+ target: i0.ɵɵFactoryTarget.Component
1388
+ });
1389
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1390
+ minVersion: "17.0.0",
1391
+ version: "22.2.3",
1392
+ type: TxChartAxes,
1393
+ isStandalone: true,
1394
+ selector: "g[tx-chart-axes]",
1395
+ inputs: {
1396
+ model: {
1397
+ classPropertyName: "model",
1398
+ publicName: "tx-chart-axes",
1399
+ isSignal: true,
1400
+ isRequired: true,
1401
+ transformFunction: null
1402
+ },
1403
+ gridPart: {
1404
+ classPropertyName: "gridPart",
1405
+ publicName: "gridPart",
1406
+ isSignal: true,
1407
+ isRequired: false,
1408
+ transformFunction: null
1409
+ },
1410
+ axisPart: {
1411
+ classPropertyName: "axisPart",
1412
+ publicName: "axisPart",
1413
+ isSignal: true,
1414
+ isRequired: false,
1415
+ transformFunction: null
1416
+ }
1417
+ },
1418
+ host: {
1419
+ attributes: { "aria-hidden": "true" },
1420
+ classAttribute: "tx-chart-axes"
1421
+ },
1422
+ ngImport: i0,
1423
+ template: `
1424
+ <svg:g class="tx-chart-axes__grid" [class]="gridPart()?.class" [style]="gridPart()?.style">
1425
+ @for (line of model().grid; track $index) {
1426
+ <svg:line class="tx-chart-axes__grid-line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1427
+ }
1428
+ </svg:g>
1429
+ @if (model().zero; as zero) {
1430
+ <svg:line class="tx-chart-axes__zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1431
+ }
1432
+ @for (axis of model().axes; track axis.position) {
1433
+ <svg:g class="tx-chart-axes__axis" [attr.data-position]="axis.position" [class]="axisPart()?.class" [style]="axisPart()?.style">
1434
+ @if (axis.line; as line) {
1435
+ <svg:line class="tx-chart-axes__line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1436
+ }
1437
+ @for (label of axis.labels; track $index) {
1438
+ <svg:text
1439
+ class="tx-chart-axes__label"
1440
+ [attr.x]="label.x"
1441
+ [attr.y]="label.y"
1442
+ [attr.text-anchor]="label.anchor"
1443
+ [attr.dominant-baseline]="label.baseline"
1444
+ [attr.transform]="label.rotate ? 'rotate(' + label.rotate + ' ' + label.x + ' ' + label.y + ')' : null"
1445
+ >
1446
+ {{ label.text }}
1447
+ @if (label.title) {
1448
+ <svg:title>{{ label.title }}</svg:title>
1449
+ }
1450
+ </svg:text>
1451
+ }
1452
+ @if (axis.title; as title) {
1453
+ <svg:text
1454
+ class="tx-chart-axes__title"
1455
+ text-anchor="middle"
1456
+ [attr.x]="title.x"
1457
+ [attr.y]="title.y"
1458
+ [attr.transform]="title.rotate ? 'rotate(' + title.rotate + ' ' + title.x + ' ' + title.y + ')' : null"
1459
+ >
1460
+ {{ title.text }}
1461
+ </svg:text>
1462
+ }
1463
+ </svg:g>
1464
+ }
1465
+ `,
1466
+ isInline: true,
1467
+ styles: [".tx-chart-axes__grid-line,.tx-chart-axes__zero,.tx-chart-axes__line{fill:none;shape-rendering:crispEdges}.tx-chart-axes__label,.tx-chart-axes__title{-webkit-user-select:none;user-select:none}:host-context([data-styled]) .tx-chart-axes__grid-line{stroke:var(--tx-chart-grid-color);stroke-width:var(--tx-chart-grid-width);stroke-dasharray:var(--tx-chart-grid-dash)}:host-context([data-styled]) .tx-chart-axes__zero{stroke:var(--tx-chart-zero-line-color);stroke-width:var(--tx-chart-zero-line-width)}:host-context([data-styled]) .tx-chart-axes__line{stroke:var(--tx-chart-axis-line-color)}:host-context([data-styled]) .tx-chart-axes__label{fill:var(--tx-chart-axis-label-color);font-size:var(--tx-chart-axis-label-font-size);font-weight:var(--tx-chart-axis-label-font-weight);font-variant-numeric:tabular-nums}:host-context([data-styled]) .tx-chart-axes__title{fill:var(--tx-chart-axis-title-color);font-size:var(--tx-chart-axis-title-font-size);font-weight:var(--tx-chart-axis-title-font-weight)}\n"],
1468
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1469
+ });
1470
+ };
1471
+ i0.ɵɵngDeclareClassMetadata({
1472
+ minVersion: "12.0.0",
1473
+ version: "22.2.3",
1474
+ ngImport: i0,
1475
+ type: TxChartAxes,
1476
+ decorators: [{
1477
+ type: Component,
1478
+ args: [{
1479
+ selector: "g[tx-chart-axes]",
1480
+ template: `
1481
+ <svg:g class="tx-chart-axes__grid" [class]="gridPart()?.class" [style]="gridPart()?.style">
1482
+ @for (line of model().grid; track $index) {
1483
+ <svg:line class="tx-chart-axes__grid-line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1484
+ }
1485
+ </svg:g>
1486
+ @if (model().zero; as zero) {
1487
+ <svg:line class="tx-chart-axes__zero" [attr.x1]="zero.x1" [attr.y1]="zero.y1" [attr.x2]="zero.x2" [attr.y2]="zero.y2" />
1488
+ }
1489
+ @for (axis of model().axes; track axis.position) {
1490
+ <svg:g class="tx-chart-axes__axis" [attr.data-position]="axis.position" [class]="axisPart()?.class" [style]="axisPart()?.style">
1491
+ @if (axis.line; as line) {
1492
+ <svg:line class="tx-chart-axes__line" [attr.x1]="line.x1" [attr.y1]="line.y1" [attr.x2]="line.x2" [attr.y2]="line.y2" />
1493
+ }
1494
+ @for (label of axis.labels; track $index) {
1495
+ <svg:text
1496
+ class="tx-chart-axes__label"
1497
+ [attr.x]="label.x"
1498
+ [attr.y]="label.y"
1499
+ [attr.text-anchor]="label.anchor"
1500
+ [attr.dominant-baseline]="label.baseline"
1501
+ [attr.transform]="label.rotate ? 'rotate(' + label.rotate + ' ' + label.x + ' ' + label.y + ')' : null"
1502
+ >
1503
+ {{ label.text }}
1504
+ @if (label.title) {
1505
+ <svg:title>{{ label.title }}</svg:title>
1506
+ }
1507
+ </svg:text>
1508
+ }
1509
+ @if (axis.title; as title) {
1510
+ <svg:text
1511
+ class="tx-chart-axes__title"
1512
+ text-anchor="middle"
1513
+ [attr.x]="title.x"
1514
+ [attr.y]="title.y"
1515
+ [attr.transform]="title.rotate ? 'rotate(' + title.rotate + ' ' + title.x + ' ' + title.y + ')' : null"
1516
+ >
1517
+ {{ title.text }}
1518
+ </svg:text>
1519
+ }
1520
+ </svg:g>
1521
+ }
1522
+ `,
1523
+ changeDetection: ChangeDetectionStrategy.OnPush,
1524
+ host: {
1525
+ class: "tx-chart-axes",
1526
+ "aria-hidden": "true"
1527
+ },
1528
+ styles: [".tx-chart-axes__grid-line,.tx-chart-axes__zero,.tx-chart-axes__line{fill:none;shape-rendering:crispEdges}.tx-chart-axes__label,.tx-chart-axes__title{-webkit-user-select:none;user-select:none}:host-context([data-styled]) .tx-chart-axes__grid-line{stroke:var(--tx-chart-grid-color);stroke-width:var(--tx-chart-grid-width);stroke-dasharray:var(--tx-chart-grid-dash)}:host-context([data-styled]) .tx-chart-axes__zero{stroke:var(--tx-chart-zero-line-color);stroke-width:var(--tx-chart-zero-line-width)}:host-context([data-styled]) .tx-chart-axes__line{stroke:var(--tx-chart-axis-line-color)}:host-context([data-styled]) .tx-chart-axes__label{fill:var(--tx-chart-axis-label-color);font-size:var(--tx-chart-axis-label-font-size);font-weight:var(--tx-chart-axis-label-font-weight);font-variant-numeric:tabular-nums}:host-context([data-styled]) .tx-chart-axes__title{fill:var(--tx-chart-axis-title-color);font-size:var(--tx-chart-axis-title-font-size);font-weight:var(--tx-chart-axis-title-font-weight)}\n"]
1529
+ }]
1530
+ }],
1531
+ propDecorators: {
1532
+ model: [{
1533
+ type: i0.Input,
1534
+ args: [{
1535
+ isSignal: true,
1536
+ alias: "tx-chart-axes",
1537
+ required: true
1538
+ }]
1539
+ }],
1540
+ gridPart: [{
1541
+ type: i0.Input,
1542
+ args: [{
1543
+ isSignal: true,
1544
+ alias: "gridPart",
1545
+ required: false
1546
+ }]
1547
+ }],
1548
+ axisPart: [{
1549
+ type: i0.Input,
1550
+ args: [{
1551
+ isSignal: true,
1552
+ alias: "axisPart",
1553
+ required: false
1554
+ }]
1555
+ }]
1556
+ }
1557
+ });
1558
+ const TOOLTIP_OFFSET = 10;
1559
+ var TxChartFrame = class TxChartFrame {
1560
+ host = inject(ElementRef);
1561
+ overlay = inject(TxOverlay);
1562
+ viewContainerRef = inject(ViewContainerRef);
1563
+ injector = inject(Injector);
1564
+ announcer = inject(TxAnnouncer);
1565
+ translations = injectTranslations();
1566
+ height = input(350, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
1567
+ size = model({
1568
+ width: 640,
1569
+ height: 320
1570
+ }, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
1571
+ legendItems = input([], ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
1572
+ showLegend = input(true, {
1573
+ ...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
1574
+ transform: booleanAttribute
1575
+ });
1576
+ legendPosition = input("top", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
1577
+ legendAlign = input("start", ...ngDevMode ? [{ debugName: "legendAlign" }] : /* istanbul ignore next */ []);
1578
+ legendVariant = input("dot", ...ngDevMode ? [{ debugName: "legendVariant" }] : /* istanbul ignore next */ []);
1579
+ legendToggle = input(true, {
1580
+ ...ngDevMode ? { debugName: "legendToggle" } : /* istanbul ignore next */ {},
1581
+ transform: booleanAttribute
1582
+ });
1583
+ legendTemplate = input(null, ...ngDevMode ? [{ debugName: "legendTemplate" }] : /* istanbul ignore next */ []);
1584
+ empty = input(false, {
1585
+ ...ngDevMode ? { debugName: "empty" } : /* istanbul ignore next */ {},
1586
+ transform: booleanAttribute
1587
+ });
1588
+ loading = input(false, {
1589
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
1590
+ transform: booleanAttribute
1591
+ });
1592
+ emptyIcon = input("chart-line", ...ngDevMode ? [{ debugName: "emptyIcon" }] : /* istanbul ignore next */ []);
1593
+ summary = input("", ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
1594
+ table = input(null, ...ngDevMode ? [{ debugName: "table" }] : /* istanbul ignore next */ []);
1595
+ tooltip = input(null, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
1596
+ tooltipTemplate = input(null, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
1597
+ tooltipPlacement = input("top", ...ngDevMode ? [{ debugName: "tooltipPlacement" }] : /* istanbul ignore next */ []);
1598
+ panelStyle = input({}, ...ngDevMode ? [{ debugName: "panelStyle" }] : /* istanbul ignore next */ []);
1599
+ parts = input({}, ...ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []);
1600
+ styled = input(true, {
1601
+ ...ngDevMode ? { debugName: "styled" } : /* istanbul ignore next */ {},
1602
+ transform: booleanAttribute
1603
+ });
1604
+ interactive = input(true, {
1605
+ ...ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {},
1606
+ transform: booleanAttribute
1607
+ });
1608
+ plotHeight = input(null, ...ngDevMode ? [{ debugName: "plotHeight" }] : /* istanbul ignore next */ []);
1609
+ pointer = output();
1610
+ navigate = output();
1611
+ legendToggled = output();
1612
+ legendHovered = output();
1613
+ tooltipClosed = output();
1614
+ plotRef = viewChild("plot", ...ngDevMode ? [{ debugName: "plotRef" }] : /* istanbul ignore next */ []);
1615
+ anchorRef = viewChild("anchor", ...ngDevMode ? [{ debugName: "anchorRef" }] : /* istanbul ignore next */ []);
1616
+ tooltipPanel = viewChild("tooltipPanel", ...ngDevMode ? [{ debugName: "tooltipPanel" }] : /* istanbul ignore next */ []);
1617
+ hintId = uniqueId("tx-chart-hint");
1618
+ shown = signal(null, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
1619
+ measured = signal(false, ...ngDevMode ? [{ debugName: "measured" }] : /* istanbul ignore next */ []);
1620
+ ref = null;
1621
+ openPlacement = null;
1622
+ activeRef = signal(null, ...ngDevMode ? [{ debugName: "activeRef" }] : /* istanbul ignore next */ []);
1623
+ side = computed(() => parsePlacement(this.activeRef()?.placement() ?? this.openPlacement ?? this.tooltipPlacement()).side, ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
1624
+ arrowOffset = computed(() => txArrowOffset(this.activeRef()?.placement() ?? "top", {
1625
+ width: 0,
1626
+ height: 0
1627
+ }), ...ngDevMode ? [{ debugName: "arrowOffset" }] : /* istanbul ignore next */ []);
1628
+ fills = computed(() => typeof this.height() === "string", ...ngDevMode ? [{ debugName: "fills" }] : /* istanbul ignore next */ []);
1629
+ cssHeight = computed(() => {
1630
+ const height = this.height();
1631
+ return typeof height === "number" ? `${height}px` : height;
1632
+ }, ...ngDevMode ? [{ debugName: "cssHeight" }] : /* istanbul ignore next */ []);
1633
+ legendVisible = computed(() => this.showLegend() && !this.empty() && !this.loading() && this.legendItems().length > 0, ...ngDevMode ? [{ debugName: "legendVisible" }] : /* istanbul ignore next */ []);
1634
+ viewBox = computed(() => `0 0 ${this.size().width} ${this.size().height}`, ...ngDevMode ? [{ debugName: "viewBox" }] : /* istanbul ignore next */ []);
1635
+ placeholderHeight = computed(() => chartBoxHeight(this.height(), this.legendVisible() ? this.legendPosition() : null), ...ngDevMode ? [{ debugName: "placeholderHeight" }] : /* istanbul ignore next */ []);
1636
+ constructor() {
1637
+ afterNextRender(() => this.observe());
1638
+ effect(() => {
1639
+ const data = this.tooltip();
1640
+ untracked(() => this.syncTooltip(data));
1641
+ });
1642
+ inject(DestroyRef).onDestroy(() => this.ref?.close("api"));
1643
+ }
1644
+ announce(message) {
1645
+ this.announcer.announce(message);
1646
+ }
1647
+ onPointer(event, type) {
1648
+ const plot = this.plotRef()?.nativeElement;
1649
+ if (!plot || !this.interactive()) return;
1650
+ const box = plot.getBoundingClientRect();
1651
+ this.pointer.emit({
1652
+ x: event.clientX - box.left,
1653
+ y: event.clientY - box.top,
1654
+ type,
1655
+ target: event.target
1656
+ });
1657
+ }
1658
+ onKeydown(event) {
1659
+ if (!this.interactive()) return;
1660
+ if ([
1661
+ "ArrowLeft",
1662
+ "ArrowRight",
1663
+ "ArrowUp",
1664
+ "ArrowDown",
1665
+ "Home",
1666
+ "End",
1667
+ "Escape"
1668
+ ].includes(event.key)) {
1669
+ event.preventDefault();
1670
+ this.navigate.emit(event);
1671
+ }
1672
+ }
1673
+ observe() {
1674
+ const plot = this.plotRef()?.nativeElement;
1675
+ if (!plot) return;
1676
+ const measure = () => {
1677
+ const width = Math.round(plot.clientWidth);
1678
+ const height = Math.round(plot.clientHeight);
1679
+ if (width > 0 && height > 0) {
1680
+ const current = this.size();
1681
+ if (current.width !== width || current.height !== height) this.size.set({
1682
+ width,
1683
+ height
1684
+ });
1685
+ this.measured.set(true);
1686
+ }
1687
+ };
1688
+ measure();
1689
+ const view = this.host.nativeElement.ownerDocument.defaultView;
1690
+ if (view && "ResizeObserver" in view) {
1691
+ const observer = new view.ResizeObserver(() => measure());
1692
+ observer.observe(plot);
1693
+ this.injector.get(DestroyRef).onDestroy(() => observer.disconnect());
1694
+ }
1695
+ }
1696
+ syncTooltip(data) {
1697
+ const anchor = this.anchorRef()?.nativeElement;
1698
+ const template = this.tooltipPanel();
1699
+ if (!data) {
1700
+ this.closeTooltip();
1701
+ return;
1702
+ }
1703
+ if (!anchor || !template) return;
1704
+ const placement = data.placement ?? this.tooltipPlacement();
1705
+ anchor.style.transform = `translate(${Math.round(data.x)}px, ${Math.round(data.y)}px)`;
1706
+ if (this.ref && this.openPlacement !== placement) this.closeTooltip();
1707
+ this.shown.set(data);
1708
+ if (this.ref) {
1709
+ this.ref.updatePosition();
1710
+ return;
1711
+ }
1712
+ const ref = this.overlay.open(template, {
1713
+ origin: anchor,
1714
+ viewContainerRef: this.viewContainerRef,
1715
+ placement,
1716
+ offset: TOOLTIP_OFFSET,
1717
+ layer: "tooltip",
1718
+ closeOnOutsideClick: false,
1719
+ restoreFocus: false,
1720
+ motion: "pop"
1721
+ });
1722
+ ref.element.style.pointerEvents = "none";
1723
+ ref.closed.subscribe((reason) => {
1724
+ if (this.ref === ref) {
1725
+ this.ref = null;
1726
+ this.activeRef.set(null);
1727
+ }
1728
+ if (reason !== "api") this.tooltipClosed.emit();
1729
+ });
1730
+ this.ref = ref;
1731
+ this.openPlacement = placement;
1732
+ this.activeRef.set(ref);
1733
+ }
1734
+ closeTooltip() {
1735
+ if (this.ref) {
1736
+ const ref = this.ref;
1737
+ this.ref = null;
1738
+ this.activeRef.set(null);
1739
+ ref.close("api");
1740
+ }
1741
+ }
1742
+ static ɵfac = i0.ɵɵngDeclareFactory({
1743
+ minVersion: "12.0.0",
1744
+ version: "22.2.3",
1745
+ ngImport: i0,
1746
+ type: TxChartFrame,
1747
+ deps: [],
1748
+ target: i0.ɵɵFactoryTarget.Component
1749
+ });
1750
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1751
+ minVersion: "17.0.0",
1752
+ version: "22.2.3",
1753
+ type: TxChartFrame,
1754
+ isStandalone: true,
1755
+ selector: "tx-chart-frame",
1756
+ inputs: {
1757
+ height: {
1758
+ classPropertyName: "height",
1759
+ publicName: "height",
1760
+ isSignal: true,
1761
+ isRequired: false,
1762
+ transformFunction: null
1763
+ },
1764
+ size: {
1765
+ classPropertyName: "size",
1766
+ publicName: "size",
1767
+ isSignal: true,
1768
+ isRequired: false,
1769
+ transformFunction: null
1770
+ },
1771
+ legendItems: {
1772
+ classPropertyName: "legendItems",
1773
+ publicName: "legendItems",
1774
+ isSignal: true,
1775
+ isRequired: false,
1776
+ transformFunction: null
1777
+ },
1778
+ showLegend: {
1779
+ classPropertyName: "showLegend",
1780
+ publicName: "showLegend",
1781
+ isSignal: true,
1782
+ isRequired: false,
1783
+ transformFunction: null
1784
+ },
1785
+ legendPosition: {
1786
+ classPropertyName: "legendPosition",
1787
+ publicName: "legendPosition",
1788
+ isSignal: true,
1789
+ isRequired: false,
1790
+ transformFunction: null
1791
+ },
1792
+ legendAlign: {
1793
+ classPropertyName: "legendAlign",
1794
+ publicName: "legendAlign",
1795
+ isSignal: true,
1796
+ isRequired: false,
1797
+ transformFunction: null
1798
+ },
1799
+ legendVariant: {
1800
+ classPropertyName: "legendVariant",
1801
+ publicName: "legendVariant",
1802
+ isSignal: true,
1803
+ isRequired: false,
1804
+ transformFunction: null
1805
+ },
1806
+ legendToggle: {
1807
+ classPropertyName: "legendToggle",
1808
+ publicName: "legendToggle",
1809
+ isSignal: true,
1810
+ isRequired: false,
1811
+ transformFunction: null
1812
+ },
1813
+ legendTemplate: {
1814
+ classPropertyName: "legendTemplate",
1815
+ publicName: "legendTemplate",
1816
+ isSignal: true,
1817
+ isRequired: false,
1818
+ transformFunction: null
1819
+ },
1820
+ empty: {
1821
+ classPropertyName: "empty",
1822
+ publicName: "empty",
1823
+ isSignal: true,
1824
+ isRequired: false,
1825
+ transformFunction: null
1826
+ },
1827
+ loading: {
1828
+ classPropertyName: "loading",
1829
+ publicName: "loading",
1830
+ isSignal: true,
1831
+ isRequired: false,
1832
+ transformFunction: null
1833
+ },
1834
+ emptyIcon: {
1835
+ classPropertyName: "emptyIcon",
1836
+ publicName: "emptyIcon",
1837
+ isSignal: true,
1838
+ isRequired: false,
1839
+ transformFunction: null
1840
+ },
1841
+ summary: {
1842
+ classPropertyName: "summary",
1843
+ publicName: "summary",
1844
+ isSignal: true,
1845
+ isRequired: false,
1846
+ transformFunction: null
1847
+ },
1848
+ table: {
1849
+ classPropertyName: "table",
1850
+ publicName: "table",
1851
+ isSignal: true,
1852
+ isRequired: false,
1853
+ transformFunction: null
1854
+ },
1855
+ tooltip: {
1856
+ classPropertyName: "tooltip",
1857
+ publicName: "tooltip",
1858
+ isSignal: true,
1859
+ isRequired: false,
1860
+ transformFunction: null
1861
+ },
1862
+ tooltipTemplate: {
1863
+ classPropertyName: "tooltipTemplate",
1864
+ publicName: "tooltipTemplate",
1865
+ isSignal: true,
1866
+ isRequired: false,
1867
+ transformFunction: null
1868
+ },
1869
+ tooltipPlacement: {
1870
+ classPropertyName: "tooltipPlacement",
1871
+ publicName: "tooltipPlacement",
1872
+ isSignal: true,
1873
+ isRequired: false,
1874
+ transformFunction: null
1875
+ },
1876
+ panelStyle: {
1877
+ classPropertyName: "panelStyle",
1878
+ publicName: "panelStyle",
1879
+ isSignal: true,
1880
+ isRequired: false,
1881
+ transformFunction: null
1882
+ },
1883
+ parts: {
1884
+ classPropertyName: "parts",
1885
+ publicName: "parts",
1886
+ isSignal: true,
1887
+ isRequired: false,
1888
+ transformFunction: null
1889
+ },
1890
+ styled: {
1891
+ classPropertyName: "styled",
1892
+ publicName: "styled",
1893
+ isSignal: true,
1894
+ isRequired: false,
1895
+ transformFunction: null
1896
+ },
1897
+ interactive: {
1898
+ classPropertyName: "interactive",
1899
+ publicName: "interactive",
1900
+ isSignal: true,
1901
+ isRequired: false,
1902
+ transformFunction: null
1903
+ },
1904
+ plotHeight: {
1905
+ classPropertyName: "plotHeight",
1906
+ publicName: "plotHeight",
1907
+ isSignal: true,
1908
+ isRequired: false,
1909
+ transformFunction: null
1910
+ }
1911
+ },
1912
+ outputs: {
1913
+ size: "sizeChange",
1914
+ pointer: "pointer",
1915
+ navigate: "navigate",
1916
+ legendToggled: "legendToggled",
1917
+ legendHovered: "legendHovered",
1918
+ tooltipClosed: "tooltipClosed"
1919
+ },
1920
+ host: {
1921
+ properties: {
1922
+ "attr.data-legend": "legendVisible() ? legendPosition() : null",
1923
+ "attr.data-styled": "styled() || null",
1924
+ "class.tx-chart-frame--fill": "fills()",
1925
+ "class.tx-chart-frame--interactive": "interactive()",
1926
+ "style.height": "cssHeight()"
1927
+ },
1928
+ classAttribute: "tx-chart-frame"
1929
+ },
1930
+ viewQueries: [
1931
+ {
1932
+ propertyName: "plotRef",
1933
+ first: true,
1934
+ predicate: ["plot"],
1935
+ descendants: true,
1936
+ isSignal: true
1937
+ },
1938
+ {
1939
+ propertyName: "anchorRef",
1940
+ first: true,
1941
+ predicate: ["anchor"],
1942
+ descendants: true,
1943
+ isSignal: true
1944
+ },
1945
+ {
1946
+ propertyName: "tooltipPanel",
1947
+ first: true,
1948
+ predicate: ["tooltipPanel"],
1949
+ descendants: true,
1950
+ isSignal: true
1951
+ }
1952
+ ],
1953
+ ngImport: i0,
1954
+ template: "@if (legendVisible()) {\n <tx-chart-legend\n class=\"tx-chart-frame__legend\"\n [class]=\"parts().legend?.class\"\n [style]=\"parts().legend?.style\"\n [attr.data-styled]=\"styled() || null\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [align]=\"legendAlign()\"\n [variant]=\"legendVariant()\"\n [toggle]=\"legendToggle()\"\n [template]=\"legendTemplate()\"\n [itemPart]=\"parts().legendItem\"\n (toggled)=\"legendToggled.emit($event)\"\n (hovered)=\"legendHovered.emit($event)\"\n />\n}\n<div\n #plot\n class=\"tx-chart-frame__plot\"\n [class]=\"parts().plot?.class\"\n [style]=\"parts().plot?.style\"\n [style.height.px]=\"plotHeight()\"\n [class.tx-chart-frame__plot--fixed]=\"plotHeight() !== null\"\n [attr.role]=\"empty() || loading() ? null : 'img'\"\n [attr.aria-label]=\"empty() || loading() ? null : summary()\"\n [attr.aria-describedby]=\"interactive() && !empty() && !loading() ? hintId : null\"\n [attr.tabindex]=\"interactive() && !empty() && !loading() ? 0 : null\"\n (pointermove)=\"onPointer($event, 'move')\"\n (pointerdown)=\"onPointer($event, 'move')\"\n (pointerleave)=\"onPointer($event, 'leave')\"\n (click)=\"onPointer($event, 'click')\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"pointer.emit({ x: 0, y: 0, type: 'leave', target: null })\"\n>\n @if (loading()) {\n <tx-skeleton\n class=\"tx-chart-frame__skeleton\"\n [class]=\"parts().skeleton?.class\"\n [style]=\"parts().skeleton?.style\"\n width=\"100%\"\n height=\"100%\"\n [unstyled]=\"!styled()\"\n [attr.aria-label]=\"translations().chartLoading\"\n role=\"status\"\n />\n } @else if (empty()) {\n <div class=\"tx-chart-frame__empty\" role=\"status\" [class]=\"parts().empty?.class\" [style]=\"parts().empty?.style\">\n <span class=\"tx-chart-frame__empty-icon\" aria-hidden=\"true\"><tx-icon [name]=\"emptyIcon()\" /></span>\n <span class=\"tx-chart-frame__empty-text\">{{ translations().chartNoData }}</span>\n </div>\n } @else {\n <svg\n class=\"tx-chart-frame__svg\"\n [class]=\"parts().svg?.class\"\n [style]=\"parts().svg?.style\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n preserveAspectRatio=\"xMinYMin meet\"\n [attr.viewBox]=\"viewBox()\"\n >\n <ng-content />\n </svg>\n <span #anchor class=\"tx-chart-frame__anchor\" aria-hidden=\"true\"></span>\n }\n</div>\n@if (interactive() && !empty() && !loading()) {\n <span class=\"cdk-visually-hidden\" [id]=\"hintId\">{{ translations().chartNavigateHint }}</span>\n}\n@if (table(); as data) {\n @if (!empty() && !loading()) {\n <table class=\"cdk-visually-hidden\">\n <caption>\n {{ summary() || translations().chartDataTable }}\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">{{ translations().chartCategory }}</th>\n @for (column of data.columns; track column.key) {\n <th scope=\"col\">{{ column.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of data.rows; track $index) {\n <tr>\n <th scope=\"row\">{{ row.label }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n}\n\n<ng-template #tooltipPanel>\n @if (shown(); as data) {\n <div\n class=\"tx-chart-frame__tooltip\"\n role=\"presentation\"\n [class]=\"parts().tooltip?.class\"\n [style]=\"panelStyle()\"\n [style.--tx-chart-tooltip-arrow-offset]=\"arrowOffset()\"\n [attr.data-side]=\"side()\"\n [attr.data-styled]=\"styled() || null\"\n >\n @if (styled()) {\n <span class=\"tx-chart-frame__tooltip-arrow\" aria-hidden=\"true\"></span>\n }\n @if (tooltipTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom\" [ngTemplateOutletContext]=\"{ $implicit: data }\" />\n } @else {\n @if (data.title) {\n <div class=\"tx-chart-frame__tooltip-title\">{{ data.title }}</div>\n }\n @for (row of data.rows; track row.seriesIndex) {\n <div class=\"tx-chart-frame__tooltip-row\" [class.tx-chart-frame__tooltip-row--active]=\"row.active && data.rows.length > 1\">\n <span class=\"tx-chart-frame__tooltip-marker\" [style.background]=\"row.color\"></span>\n <span class=\"tx-chart-frame__tooltip-label\">{{ row.label }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ row.value }}</span>\n @if (row.share) {\n <span class=\"tx-chart-frame__tooltip-share\">{{ row.share }}</span>\n }\n </div>\n }\n @if (data.total) {\n <div class=\"tx-chart-frame__tooltip-row tx-chart-frame__tooltip-total\">\n <span class=\"tx-chart-frame__tooltip-label\">{{ translations().chartTotal }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ data.total }}</span>\n </div>\n }\n }\n </div>\n }\n</ng-template>\n",
1955
+ styles: [":host{position:relative;display:flex;flex-direction:column;min-width:0;box-sizing:border-box}:host([data-legend=bottom]){flex-direction:column-reverse}:host([data-legend=left]){flex-direction:row}:host([data-legend=right]){flex-direction:row-reverse}:host([data-legend=left]) .tx-chart-frame__legend,:host([data-legend=right]) .tx-chart-frame__legend{flex:0 0 auto;align-self:center;max-height:100%;overflow:auto}.tx-chart-frame__plot{position:relative;flex:1 1 auto;min-width:0;min-height:0;outline:none}.tx-chart-frame__plot--fixed{flex:0 0 auto}:host([data-legend=left]) .tx-chart-frame__plot--fixed,:host([data-legend=right]) .tx-chart-frame__plot--fixed{flex:1 1 auto;align-self:center}.tx-chart-frame__svg{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:visible}.tx-chart-frame__anchor{position:absolute;top:0;left:0;width:0;height:0;pointer-events:none}.tx-chart-frame__skeleton{position:absolute;inset:0}.tx-chart-frame__empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}.tx-chart-frame__empty-icon{display:inline-flex;align-items:center;justify-content:center}.tx-chart-frame__tooltip{display:flex;flex-direction:column;white-space:nowrap;pointer-events:none}.tx-chart-frame__tooltip-row{display:flex;align-items:center}:host([data-styled]){gap:var(--tx-chart-legend-gap);color:var(--tx-chart-color);font-family:var(--tx-chart-font-family);background:var(--tx-chart-background)}:host([data-styled]) .tx-chart-frame__plot:focus-visible{border-radius:var(--tx-radius-sm);outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:var(--tx-chart-focus-ring-offset)}:host([data-styled]) .tx-chart-frame__empty{gap:var(--tx-chart-empty-gap);color:var(--tx-chart-empty-color);font-size:var(--tx-chart-empty-font-size)}:host([data-styled]) .tx-chart-frame__empty-icon{width:var(--tx-chart-empty-icon-size);height:var(--tx-chart-empty-icon-size);border-radius:var(--tx-radius-full);background:var(--tx-chart-empty-icon-background);color:var(--tx-chart-empty-icon-color);font-size:var(--tx-chart-empty-icon-font-size)}:host([data-styled][data-legend=left]),:host([data-styled][data-legend=right]){gap:var(--tx-chart-legend-item-gap)}:host([data-styled][data-legend=left]) .tx-chart-frame__legend,:host([data-styled][data-legend=right]) .tx-chart-frame__legend{max-width:var(--tx-chart-legend-side-width)}.tx-chart-frame__tooltip[data-styled]{position:relative;gap:var(--tx-chart-tooltip-row-gap);min-width:var(--tx-chart-tooltip-min-width);padding:var(--tx-chart-tooltip-padding);border:var(--tx-chart-tooltip-border-width) solid var(--tx-chart-tooltip-border-color);border-radius:var(--tx-chart-tooltip-border-radius);background:var(--tx-chart-tooltip-background);box-shadow:var(--tx-chart-tooltip-shadow);color:var(--tx-chart-tooltip-color);font-family:var(--tx-chart-font-family);font-size:var(--tx-chart-tooltip-font-size);line-height:1.35}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow{position:absolute;width:var(--tx-chart-tooltip-arrow-size);height:var(--tx-chart-tooltip-arrow-size);border:var(--tx-chart-tooltip-border-width) solid var(--tx-chart-tooltip-border-color);background:var(--tx-chart-tooltip-background);transform:rotate(45deg)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-title{margin-bottom:2px;color:var(--tx-chart-tooltip-muted-color);font-size:var(--tx-chart-tooltip-title-font-size);font-weight:var(--tx-chart-tooltip-title-font-weight)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row{gap:var(--tx-chart-tooltip-marker-gap)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-marker{flex-shrink:0;width:var(--tx-chart-tooltip-marker-size);height:var(--tx-chart-tooltip-marker-size);border-radius:var(--tx-radius-full)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-muted-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row--active .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-share{min-width:4ch;color:var(--tx-chart-tooltip-muted-color);font-variant-numeric:tabular-nums;text-align:end}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-value{margin-inline-start:auto;padding-inline-start:var(--tx-chart-tooltip-value-gap);font-weight:var(--tx-chart-tooltip-value-font-weight);font-variant-numeric:tabular-nums}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-total{margin-top:2px;padding-top:calc(var(--tx-chart-tooltip-row-gap) + 2px);border-top:1px solid var(--tx-chart-tooltip-total-border-color)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{left:var(--tx-chart-tooltip-arrow-offset);margin-left:calc(var(--tx-chart-tooltip-arrow-size) / -2)}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{top:var(--tx-chart-tooltip-arrow-offset);margin-top:calc(var(--tx-chart-tooltip-arrow-size) / -2)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow{bottom:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-top-color:transparent;border-left-color:transparent}.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{top:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-right-color:transparent;border-bottom-color:transparent}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow{right:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-bottom-color:transparent;border-left-color:transparent}.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{left:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-top-color:transparent;border-right-color:transparent}\n"],
1956
+ dependencies: [
1957
+ {
1958
+ kind: "directive",
1959
+ type: NgTemplateOutlet,
1960
+ selector: "[ngTemplateOutlet]",
1961
+ inputs: [
1962
+ "ngTemplateOutletContext",
1963
+ "ngTemplateOutlet",
1964
+ "ngTemplateOutletInjector"
1965
+ ]
1966
+ },
1967
+ {
1968
+ kind: "component",
1969
+ type: TxChartLegend,
1970
+ selector: "tx-chart-legend",
1971
+ inputs: [
1972
+ "items",
1973
+ "position",
1974
+ "align",
1975
+ "variant",
1976
+ "toggle",
1977
+ "template",
1978
+ "itemPart"
1979
+ ],
1980
+ outputs: ["toggled", "hovered"]
1981
+ },
1982
+ {
1983
+ kind: "component",
1984
+ type: TxIcon,
1985
+ selector: "tx-icon",
1986
+ inputs: ["name"]
1987
+ },
1988
+ {
1989
+ kind: "component",
1990
+ type: TxSkeleton,
1991
+ selector: "tx-skeleton",
1992
+ inputs: [
1993
+ "shape",
1994
+ "size",
1995
+ "width",
1996
+ "height",
1997
+ "borderRadius",
1998
+ "lines",
1999
+ "animation",
2000
+ "dt",
2001
+ "pt",
2002
+ "ptOptions",
2003
+ "unstyled"
2004
+ ]
2005
+ }
2006
+ ],
2007
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2008
+ });
2009
+ };
2010
+ i0.ɵɵngDeclareClassMetadata({
2011
+ minVersion: "12.0.0",
2012
+ version: "22.2.3",
2013
+ ngImport: i0,
2014
+ type: TxChartFrame,
2015
+ decorators: [{
2016
+ type: Component,
2017
+ args: [{
2018
+ selector: "tx-chart-frame",
2019
+ imports: [
2020
+ NgTemplateOutlet,
2021
+ TxChartLegend,
2022
+ TxIcon,
2023
+ TxSkeleton
2024
+ ],
2025
+ changeDetection: ChangeDetectionStrategy.OnPush,
2026
+ host: {
2027
+ class: "tx-chart-frame",
2028
+ "[attr.data-legend]": "legendVisible() ? legendPosition() : null",
2029
+ "[attr.data-styled]": "styled() || null",
2030
+ "[class.tx-chart-frame--fill]": "fills()",
2031
+ "[class.tx-chart-frame--interactive]": "interactive()",
2032
+ "[style.height]": "cssHeight()"
2033
+ },
2034
+ template: "@if (legendVisible()) {\n <tx-chart-legend\n class=\"tx-chart-frame__legend\"\n [class]=\"parts().legend?.class\"\n [style]=\"parts().legend?.style\"\n [attr.data-styled]=\"styled() || null\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [align]=\"legendAlign()\"\n [variant]=\"legendVariant()\"\n [toggle]=\"legendToggle()\"\n [template]=\"legendTemplate()\"\n [itemPart]=\"parts().legendItem\"\n (toggled)=\"legendToggled.emit($event)\"\n (hovered)=\"legendHovered.emit($event)\"\n />\n}\n<div\n #plot\n class=\"tx-chart-frame__plot\"\n [class]=\"parts().plot?.class\"\n [style]=\"parts().plot?.style\"\n [style.height.px]=\"plotHeight()\"\n [class.tx-chart-frame__plot--fixed]=\"plotHeight() !== null\"\n [attr.role]=\"empty() || loading() ? null : 'img'\"\n [attr.aria-label]=\"empty() || loading() ? null : summary()\"\n [attr.aria-describedby]=\"interactive() && !empty() && !loading() ? hintId : null\"\n [attr.tabindex]=\"interactive() && !empty() && !loading() ? 0 : null\"\n (pointermove)=\"onPointer($event, 'move')\"\n (pointerdown)=\"onPointer($event, 'move')\"\n (pointerleave)=\"onPointer($event, 'leave')\"\n (click)=\"onPointer($event, 'click')\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"pointer.emit({ x: 0, y: 0, type: 'leave', target: null })\"\n>\n @if (loading()) {\n <tx-skeleton\n class=\"tx-chart-frame__skeleton\"\n [class]=\"parts().skeleton?.class\"\n [style]=\"parts().skeleton?.style\"\n width=\"100%\"\n height=\"100%\"\n [unstyled]=\"!styled()\"\n [attr.aria-label]=\"translations().chartLoading\"\n role=\"status\"\n />\n } @else if (empty()) {\n <div class=\"tx-chart-frame__empty\" role=\"status\" [class]=\"parts().empty?.class\" [style]=\"parts().empty?.style\">\n <span class=\"tx-chart-frame__empty-icon\" aria-hidden=\"true\"><tx-icon [name]=\"emptyIcon()\" /></span>\n <span class=\"tx-chart-frame__empty-text\">{{ translations().chartNoData }}</span>\n </div>\n } @else {\n <svg\n class=\"tx-chart-frame__svg\"\n [class]=\"parts().svg?.class\"\n [style]=\"parts().svg?.style\"\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n aria-hidden=\"true\"\n preserveAspectRatio=\"xMinYMin meet\"\n [attr.viewBox]=\"viewBox()\"\n >\n <ng-content />\n </svg>\n <span #anchor class=\"tx-chart-frame__anchor\" aria-hidden=\"true\"></span>\n }\n</div>\n@if (interactive() && !empty() && !loading()) {\n <span class=\"cdk-visually-hidden\" [id]=\"hintId\">{{ translations().chartNavigateHint }}</span>\n}\n@if (table(); as data) {\n @if (!empty() && !loading()) {\n <table class=\"cdk-visually-hidden\">\n <caption>\n {{ summary() || translations().chartDataTable }}\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">{{ translations().chartCategory }}</th>\n @for (column of data.columns; track column.key) {\n <th scope=\"col\">{{ column.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of data.rows; track $index) {\n <tr>\n <th scope=\"row\">{{ row.label }}</th>\n @for (cell of row.cells; track $index) {\n <td>{{ cell }}</td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n}\n\n<ng-template #tooltipPanel>\n @if (shown(); as data) {\n <div\n class=\"tx-chart-frame__tooltip\"\n role=\"presentation\"\n [class]=\"parts().tooltip?.class\"\n [style]=\"panelStyle()\"\n [style.--tx-chart-tooltip-arrow-offset]=\"arrowOffset()\"\n [attr.data-side]=\"side()\"\n [attr.data-styled]=\"styled() || null\"\n >\n @if (styled()) {\n <span class=\"tx-chart-frame__tooltip-arrow\" aria-hidden=\"true\"></span>\n }\n @if (tooltipTemplate(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom\" [ngTemplateOutletContext]=\"{ $implicit: data }\" />\n } @else {\n @if (data.title) {\n <div class=\"tx-chart-frame__tooltip-title\">{{ data.title }}</div>\n }\n @for (row of data.rows; track row.seriesIndex) {\n <div class=\"tx-chart-frame__tooltip-row\" [class.tx-chart-frame__tooltip-row--active]=\"row.active && data.rows.length > 1\">\n <span class=\"tx-chart-frame__tooltip-marker\" [style.background]=\"row.color\"></span>\n <span class=\"tx-chart-frame__tooltip-label\">{{ row.label }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ row.value }}</span>\n @if (row.share) {\n <span class=\"tx-chart-frame__tooltip-share\">{{ row.share }}</span>\n }\n </div>\n }\n @if (data.total) {\n <div class=\"tx-chart-frame__tooltip-row tx-chart-frame__tooltip-total\">\n <span class=\"tx-chart-frame__tooltip-label\">{{ translations().chartTotal }}</span>\n <span class=\"tx-chart-frame__tooltip-value\">{{ data.total }}</span>\n </div>\n }\n }\n </div>\n }\n</ng-template>\n",
2035
+ styles: [":host{position:relative;display:flex;flex-direction:column;min-width:0;box-sizing:border-box}:host([data-legend=bottom]){flex-direction:column-reverse}:host([data-legend=left]){flex-direction:row}:host([data-legend=right]){flex-direction:row-reverse}:host([data-legend=left]) .tx-chart-frame__legend,:host([data-legend=right]) .tx-chart-frame__legend{flex:0 0 auto;align-self:center;max-height:100%;overflow:auto}.tx-chart-frame__plot{position:relative;flex:1 1 auto;min-width:0;min-height:0;outline:none}.tx-chart-frame__plot--fixed{flex:0 0 auto}:host([data-legend=left]) .tx-chart-frame__plot--fixed,:host([data-legend=right]) .tx-chart-frame__plot--fixed{flex:1 1 auto;align-self:center}.tx-chart-frame__svg{position:absolute;inset:0;display:block;width:100%;height:100%;overflow:visible}.tx-chart-frame__anchor{position:absolute;top:0;left:0;width:0;height:0;pointer-events:none}.tx-chart-frame__skeleton{position:absolute;inset:0}.tx-chart-frame__empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}.tx-chart-frame__empty-icon{display:inline-flex;align-items:center;justify-content:center}.tx-chart-frame__tooltip{display:flex;flex-direction:column;white-space:nowrap;pointer-events:none}.tx-chart-frame__tooltip-row{display:flex;align-items:center}:host([data-styled]){gap:var(--tx-chart-legend-gap);color:var(--tx-chart-color);font-family:var(--tx-chart-font-family);background:var(--tx-chart-background)}:host([data-styled]) .tx-chart-frame__plot:focus-visible{border-radius:var(--tx-radius-sm);outline:var(--tx-chart-focus-ring-width) solid var(--tx-chart-focus-ring-color);outline-offset:var(--tx-chart-focus-ring-offset)}:host([data-styled]) .tx-chart-frame__empty{gap:var(--tx-chart-empty-gap);color:var(--tx-chart-empty-color);font-size:var(--tx-chart-empty-font-size)}:host([data-styled]) .tx-chart-frame__empty-icon{width:var(--tx-chart-empty-icon-size);height:var(--tx-chart-empty-icon-size);border-radius:var(--tx-radius-full);background:var(--tx-chart-empty-icon-background);color:var(--tx-chart-empty-icon-color);font-size:var(--tx-chart-empty-icon-font-size)}:host([data-styled][data-legend=left]),:host([data-styled][data-legend=right]){gap:var(--tx-chart-legend-item-gap)}:host([data-styled][data-legend=left]) .tx-chart-frame__legend,:host([data-styled][data-legend=right]) .tx-chart-frame__legend{max-width:var(--tx-chart-legend-side-width)}.tx-chart-frame__tooltip[data-styled]{position:relative;gap:var(--tx-chart-tooltip-row-gap);min-width:var(--tx-chart-tooltip-min-width);padding:var(--tx-chart-tooltip-padding);border:var(--tx-chart-tooltip-border-width) solid var(--tx-chart-tooltip-border-color);border-radius:var(--tx-chart-tooltip-border-radius);background:var(--tx-chart-tooltip-background);box-shadow:var(--tx-chart-tooltip-shadow);color:var(--tx-chart-tooltip-color);font-family:var(--tx-chart-font-family);font-size:var(--tx-chart-tooltip-font-size);line-height:1.35}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-arrow{position:absolute;width:var(--tx-chart-tooltip-arrow-size);height:var(--tx-chart-tooltip-arrow-size);border:var(--tx-chart-tooltip-border-width) solid var(--tx-chart-tooltip-border-color);background:var(--tx-chart-tooltip-background);transform:rotate(45deg)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-title{margin-bottom:2px;color:var(--tx-chart-tooltip-muted-color);font-size:var(--tx-chart-tooltip-title-font-size);font-weight:var(--tx-chart-tooltip-title-font-weight)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row{gap:var(--tx-chart-tooltip-marker-gap)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-marker{flex-shrink:0;width:var(--tx-chart-tooltip-marker-size);height:var(--tx-chart-tooltip-marker-size);border-radius:var(--tx-radius-full)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-muted-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-row--active .tx-chart-frame__tooltip-label{color:var(--tx-chart-tooltip-color)}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-share{min-width:4ch;color:var(--tx-chart-tooltip-muted-color);font-variant-numeric:tabular-nums;text-align:end}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-value{margin-inline-start:auto;padding-inline-start:var(--tx-chart-tooltip-value-gap);font-weight:var(--tx-chart-tooltip-value-font-weight);font-variant-numeric:tabular-nums}.tx-chart-frame__tooltip[data-styled] .tx-chart-frame__tooltip-total{margin-top:2px;padding-top:calc(var(--tx-chart-tooltip-row-gap) + 2px);border-top:1px solid var(--tx-chart-tooltip-total-border-color)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{left:var(--tx-chart-tooltip-arrow-offset);margin-left:calc(var(--tx-chart-tooltip-arrow-size) / -2)}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow,.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{top:var(--tx-chart-tooltip-arrow-offset);margin-top:calc(var(--tx-chart-tooltip-arrow-size) / -2)}.tx-chart-frame__tooltip[data-styled][data-side=top] .tx-chart-frame__tooltip-arrow{bottom:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-top-color:transparent;border-left-color:transparent}.tx-chart-frame__tooltip[data-styled][data-side=bottom] .tx-chart-frame__tooltip-arrow{top:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-right-color:transparent;border-bottom-color:transparent}.tx-chart-frame__tooltip[data-styled][data-side=left] .tx-chart-frame__tooltip-arrow{right:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-bottom-color:transparent;border-left-color:transparent}.tx-chart-frame__tooltip[data-styled][data-side=right] .tx-chart-frame__tooltip-arrow{left:calc(var(--tx-chart-tooltip-arrow-size) / -2 - var(--tx-chart-tooltip-border-width));border-top-color:transparent;border-right-color:transparent}\n"]
2036
+ }]
2037
+ }],
2038
+ ctorParameters: () => [],
2039
+ propDecorators: {
2040
+ height: [{
2041
+ type: i0.Input,
2042
+ args: [{
2043
+ isSignal: true,
2044
+ alias: "height",
2045
+ required: false
2046
+ }]
2047
+ }],
2048
+ size: [{
2049
+ type: i0.Input,
2050
+ args: [{
2051
+ isSignal: true,
2052
+ alias: "size",
2053
+ required: false
2054
+ }]
2055
+ }, {
2056
+ type: i0.Output,
2057
+ args: ["sizeChange"]
2058
+ }],
2059
+ legendItems: [{
2060
+ type: i0.Input,
2061
+ args: [{
2062
+ isSignal: true,
2063
+ alias: "legendItems",
2064
+ required: false
2065
+ }]
2066
+ }],
2067
+ showLegend: [{
2068
+ type: i0.Input,
2069
+ args: [{
2070
+ isSignal: true,
2071
+ alias: "showLegend",
2072
+ required: false
2073
+ }]
2074
+ }],
2075
+ legendPosition: [{
2076
+ type: i0.Input,
2077
+ args: [{
2078
+ isSignal: true,
2079
+ alias: "legendPosition",
2080
+ required: false
2081
+ }]
2082
+ }],
2083
+ legendAlign: [{
2084
+ type: i0.Input,
2085
+ args: [{
2086
+ isSignal: true,
2087
+ alias: "legendAlign",
2088
+ required: false
2089
+ }]
2090
+ }],
2091
+ legendVariant: [{
2092
+ type: i0.Input,
2093
+ args: [{
2094
+ isSignal: true,
2095
+ alias: "legendVariant",
2096
+ required: false
2097
+ }]
2098
+ }],
2099
+ legendToggle: [{
2100
+ type: i0.Input,
2101
+ args: [{
2102
+ isSignal: true,
2103
+ alias: "legendToggle",
2104
+ required: false
2105
+ }]
2106
+ }],
2107
+ legendTemplate: [{
2108
+ type: i0.Input,
2109
+ args: [{
2110
+ isSignal: true,
2111
+ alias: "legendTemplate",
2112
+ required: false
2113
+ }]
2114
+ }],
2115
+ empty: [{
2116
+ type: i0.Input,
2117
+ args: [{
2118
+ isSignal: true,
2119
+ alias: "empty",
2120
+ required: false
2121
+ }]
2122
+ }],
2123
+ loading: [{
2124
+ type: i0.Input,
2125
+ args: [{
2126
+ isSignal: true,
2127
+ alias: "loading",
2128
+ required: false
2129
+ }]
2130
+ }],
2131
+ emptyIcon: [{
2132
+ type: i0.Input,
2133
+ args: [{
2134
+ isSignal: true,
2135
+ alias: "emptyIcon",
2136
+ required: false
2137
+ }]
2138
+ }],
2139
+ summary: [{
2140
+ type: i0.Input,
2141
+ args: [{
2142
+ isSignal: true,
2143
+ alias: "summary",
2144
+ required: false
2145
+ }]
2146
+ }],
2147
+ table: [{
2148
+ type: i0.Input,
2149
+ args: [{
2150
+ isSignal: true,
2151
+ alias: "table",
2152
+ required: false
2153
+ }]
2154
+ }],
2155
+ tooltip: [{
2156
+ type: i0.Input,
2157
+ args: [{
2158
+ isSignal: true,
2159
+ alias: "tooltip",
2160
+ required: false
2161
+ }]
2162
+ }],
2163
+ tooltipTemplate: [{
2164
+ type: i0.Input,
2165
+ args: [{
2166
+ isSignal: true,
2167
+ alias: "tooltipTemplate",
2168
+ required: false
2169
+ }]
2170
+ }],
2171
+ tooltipPlacement: [{
2172
+ type: i0.Input,
2173
+ args: [{
2174
+ isSignal: true,
2175
+ alias: "tooltipPlacement",
2176
+ required: false
2177
+ }]
2178
+ }],
2179
+ panelStyle: [{
2180
+ type: i0.Input,
2181
+ args: [{
2182
+ isSignal: true,
2183
+ alias: "panelStyle",
2184
+ required: false
2185
+ }]
2186
+ }],
2187
+ parts: [{
2188
+ type: i0.Input,
2189
+ args: [{
2190
+ isSignal: true,
2191
+ alias: "parts",
2192
+ required: false
2193
+ }]
2194
+ }],
2195
+ styled: [{
2196
+ type: i0.Input,
2197
+ args: [{
2198
+ isSignal: true,
2199
+ alias: "styled",
2200
+ required: false
2201
+ }]
2202
+ }],
2203
+ interactive: [{
2204
+ type: i0.Input,
2205
+ args: [{
2206
+ isSignal: true,
2207
+ alias: "interactive",
2208
+ required: false
2209
+ }]
2210
+ }],
2211
+ plotHeight: [{
2212
+ type: i0.Input,
2213
+ args: [{
2214
+ isSignal: true,
2215
+ alias: "plotHeight",
2216
+ required: false
2217
+ }]
2218
+ }],
2219
+ pointer: [{
2220
+ type: i0.Output,
2221
+ args: ["pointer"]
2222
+ }],
2223
+ navigate: [{
2224
+ type: i0.Output,
2225
+ args: ["navigate"]
2226
+ }],
2227
+ legendToggled: [{
2228
+ type: i0.Output,
2229
+ args: ["legendToggled"]
2230
+ }],
2231
+ legendHovered: [{
2232
+ type: i0.Output,
2233
+ args: ["legendHovered"]
2234
+ }],
2235
+ tooltipClosed: [{
2236
+ type: i0.Output,
2237
+ args: ["tooltipClosed"]
2238
+ }],
2239
+ plotRef: [{
2240
+ type: i0.ViewChild,
2241
+ args: ["plot", { isSignal: true }]
2242
+ }],
2243
+ anchorRef: [{
2244
+ type: i0.ViewChild,
2245
+ args: ["anchor", { isSignal: true }]
2246
+ }],
2247
+ tooltipPanel: [{
2248
+ type: i0.ViewChild,
2249
+ args: ["tooltipPanel", { isSignal: true }]
2250
+ }]
2251
+ }
2252
+ });
2253
+ function isPointList(data) {
2254
+ return data.length > 0 && typeof data[0] === "object" && data[0] !== null;
2255
+ }
2256
+ function numeric(value) {
2257
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
2258
+ }
2259
+ function xValue(x, type) {
2260
+ if (type === "time") return toTime(x);
2261
+ const value = typeof x === "number" ? x : Number(x);
2262
+ return Number.isFinite(value) ? value : null;
2263
+ }
2264
+ function normalizeSeries(series, categories = [], type = "category") {
2265
+ const pointMode = series.some((item) => isPointList(item.data));
2266
+ if (type === "category") {
2267
+ if (!pointMode) {
2268
+ const length = Math.max(categories.length, ...series.map((item) => item.data.length), 0);
2269
+ return {
2270
+ labels: Array.from({ length }, (_, index) => categories[index] !== void 0 ? String(categories[index]) : String(index + 1)),
2271
+ xs: Array.from({ length }, (_, index) => index),
2272
+ values: series.map((item) => Array.from({ length }, (_, index) => numeric(item.data[index])))
2273
+ };
2274
+ }
2275
+ const labels = [];
2276
+ const seen = /* @__PURE__ */ new Map();
2277
+ series.forEach((item) => item.data.forEach((point) => {
2278
+ const key = String(point.x);
2279
+ if (!seen.has(key)) {
2280
+ seen.set(key, labels.length);
2281
+ labels.push(key);
2282
+ }
2283
+ }));
2284
+ return {
2285
+ labels,
2286
+ xs: labels.map((_, index) => index),
2287
+ values: series.map((item) => {
2288
+ const row = new Array(labels.length).fill(null);
2289
+ item.data.forEach((point) => row[seen.get(String(point.x)) ?? 0] = numeric(point.y));
2290
+ return row;
2291
+ })
2292
+ };
2293
+ }
2294
+ if (!pointMode) {
2295
+ const order = categories.map((category) => xValue(category, type)).map((x, index) => ({
2296
+ x,
2297
+ index
2298
+ })).filter((entry) => entry.x !== null);
2299
+ order.sort((a, b) => a.x - b.x);
2300
+ return {
2301
+ labels: order.map((entry) => String(categories[entry.index])),
2302
+ xs: order.map((entry) => entry.x),
2303
+ values: series.map((item) => order.map((entry) => numeric(item.data[entry.index])))
2304
+ };
2305
+ }
2306
+ const all = /* @__PURE__ */ new Set();
2307
+ const parsed = series.map((item) => item.data.map((point) => ({
2308
+ x: xValue(point.x, type),
2309
+ y: numeric(point.y)
2310
+ })).filter((point) => point.x !== null));
2311
+ parsed.forEach((points) => points.forEach((point) => all.add(point.x)));
2312
+ const xs = [...all].sort((a, b) => a - b);
2313
+ const position = new Map(xs.map((x, index) => [x, index]));
2314
+ return {
2315
+ labels: xs.map(String),
2316
+ xs,
2317
+ values: parsed.map((points) => {
2318
+ const row = new Array(xs.length).fill(null);
2319
+ points.forEach((point) => row[position.get(point.x) ?? 0] = point.y);
2320
+ return row;
2321
+ })
2322
+ };
2323
+ }
2324
+ function hasChartData(values) {
2325
+ return values.some((row) => row.some((value) => value !== null));
2326
+ }
2327
+ function chartSummary(translations, intl, type, seriesCount, pointCount, range) {
2328
+ const head = formatMessage(translations.chartSummary, {
2329
+ type,
2330
+ series: seriesCount,
2331
+ points: pointCount
2332
+ }, intl);
2333
+ return range ? `${head}, ${formatMessage(translations.chartRange, {
2334
+ min: range[0],
2335
+ max: range[1]
2336
+ }, intl)}` : head;
2337
+ }
2338
+ const TX_CHART_TABLE_ROWS = 250;
2339
+ function tableRows(count, limit = 250) {
2340
+ if (count <= limit) return Array.from({ length: count }, (_, index) => index);
2341
+ const step = (count - 1) / (limit - 1);
2342
+ return Array.from({ length: limit }, (_, index) => Math.round(index * step));
2343
+ }
2344
+ function chartTable(labels, series, format, limit = 250) {
2345
+ return {
2346
+ columns: series.map((item, index) => ({
2347
+ key: `${index}`,
2348
+ label: item.name
2349
+ })),
2350
+ rows: tableRows(labels.length, limit).map((index) => ({
2351
+ label: labels[index],
2352
+ cells: series.map((item) => {
2353
+ const value = item.values[index];
2354
+ return value === null || value === void 0 ? "—" : format(value);
2355
+ })
2356
+ }))
2357
+ };
2358
+ }
2359
+ function toggleKey(keys, key) {
2360
+ const next = new Set(keys);
2361
+ if (next.has(key)) next.delete(key);
2362
+ else next.add(key);
2363
+ return next;
2364
+ }
2365
+ function stepIndex(key, index, count, forward = "ArrowRight", back = "ArrowLeft") {
2366
+ if (count <= 0) return -1;
2367
+ if (key === "Home") return 0;
2368
+ if (key === "End") return count - 1;
2369
+ if (index < 0) return key === back ? count - 1 : 0;
2370
+ if (key === forward) return Math.min(count - 1, index + 1);
2371
+ if (key === back) return Math.max(0, index - 1);
2372
+ return index;
2373
+ }
2374
+ function cycleIndex(index, step, allowed) {
2375
+ if (!allowed.length) return -1;
2376
+ const at = allowed.indexOf(index);
2377
+ if (at < 0) return allowed[0];
2378
+ return allowed[(at + step + allowed.length) % allowed.length];
2379
+ }
2380
+ function readTokenNumber(element, name, fallback) {
2381
+ const view = element?.ownerDocument?.defaultView;
2382
+ if (!element || !view) return fallback;
2383
+ return parseRatio(view.getComputedStyle(element).getPropertyValue(name).trim(), fallback);
2384
+ }
2385
+ function parseRatio(raw, fallback) {
2386
+ if (typeof raw === "number") return Number.isFinite(raw) ? raw : fallback;
2387
+ if (!raw) return fallback;
2388
+ const value = Number.parseFloat(raw);
2389
+ if (!Number.isFinite(value)) return fallback;
2390
+ return raw.trim().endsWith("%") ? value / 100 : value;
2391
+ }
2392
+ export { TX_CHART_ENTER_MS, TX_CHART_FALLBACK_HEIGHT, TX_CHART_FALLBACK_WIDTH, TX_CHART_LEGEND_ROW, TX_CHART_LEGEND_SIDE, TX_CHART_PALETTE_SIZE, TX_CHART_TABLE_ROWS, TX_TIME_INTERVALS, TxChartAxes, TxChartFrame, TxChartLegend, TxChartLegendTemplate, TxChartTooltipTemplate, addTime, areaPath, bandScale, cartesianLayout, chartBoxHeight, chartColor, chartHeightValue, chartMonthNames, chartNumberFormatter, chartPalette, chartSummary, chartTable, compactNumber, cycleIndex, dateFormat, decimalsOf, decimateSeries, extent, floorTime, hasChartData, initialChartSize, injectChartEntrance, largestTriangleThreeBuckets, linePath, linearScale, linearTicks, logDomain, logScale, logTicks, monotoneTangents, niceDomain, normalizeSeries, numberFormat, parseRatio, pointScale, prefersReducedMotion, readTokenNumber, seriesColor, splitGaps, stackExtent, stackValues, stepIndex, tableRows, textWidth, tickFormatter, tickStep, timeInterval, timeScale, timeTickFormatter, timeTickOptions, timeTicks, timeTooltipFormatter, toTime, toggleKey, topOfStack, truncateText };
2393
+
2394
+ //# sourceMappingURL=tectra-ng-charts-core.mjs.map