@carbon/charts 1.16.6 → 1.16.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +3 -4
  3. package/dist/angle-utils-BSzg7qin.mjs +1681 -0
  4. package/dist/angle-utils-BSzg7qin.mjs.map +1 -0
  5. package/dist/array-BRmw0x1E.mjs +32 -0
  6. package/dist/array-BRmw0x1E.mjs.map +1 -0
  7. package/dist/choropleth-BwaUZYh6.mjs +11722 -0
  8. package/dist/choropleth-BwaUZYh6.mjs.map +1 -0
  9. package/dist/color-scale-utils-DAbXVtf-.mjs +5722 -0
  10. package/dist/color-scale-utils-DAbXVtf-.mjs.map +1 -0
  11. package/dist/components/essentials/geo-projection.d.ts +7 -5
  12. package/dist/components/essentials/highlights.d.ts +1 -1
  13. package/dist/components/essentials/threshold.d.ts +1 -1
  14. package/dist/components/essentials/tooltip.d.ts +1 -1
  15. package/dist/components/index.mjs +3 -3
  16. package/dist/demo/index.mjs +244 -264
  17. package/dist/demo/index.mjs.map +1 -1
  18. package/dist/enums-DwsxZqjR.mjs.map +1 -1
  19. package/dist/index-DnyOi0rJ.mjs +1477 -0
  20. package/dist/index-DnyOi0rJ.mjs.map +1 -0
  21. package/dist/index.mjs +35 -35
  22. package/dist/interfaces/axis-scales.d.ts +3 -3
  23. package/dist/interfaces/charts.d.ts +5 -3
  24. package/dist/interfaces/components.d.ts +4 -3
  25. package/dist/interfaces/model.d.ts +30 -6
  26. package/dist/model/index.mjs +1321 -17
  27. package/dist/model/index.mjs.map +1 -1
  28. package/dist/services/index.mjs +16 -16
  29. package/dist/umd/bundle.umd.js +11 -11
  30. package/dist/umd/bundle.umd.js.map +1 -1
  31. package/package.json +2 -15
  32. package/dist/_baseEach-Bp7pBkX8.mjs +0 -20
  33. package/dist/_baseEach-Bp7pBkX8.mjs.map +0 -1
  34. package/dist/angle-utils-BCx3SRS2.mjs +0 -849
  35. package/dist/angle-utils-BCx3SRS2.mjs.map +0 -1
  36. package/dist/choropleth-B7eXF9sA.mjs +0 -8662
  37. package/dist/choropleth-B7eXF9sA.mjs.map +0 -1
  38. package/dist/color-scale-utils-BaTmNvWt.mjs +0 -3467
  39. package/dist/color-scale-utils-BaTmNvWt.mjs.map +0 -1
  40. package/dist/wordcloud-BsEQRUwL.mjs +0 -1169
  41. package/dist/wordcloud-BsEQRUwL.mjs.map +0 -1
  42. package/dist/zoom-E2POxw6n.mjs +0 -739
  43. package/dist/zoom-E2POxw6n.mjs.map +0 -1
@@ -1,849 +0,0 @@
1
- import { select as d } from "d3";
2
- import { j as he, l as O, r as fe, m as T, n as _ } from "./color-scale-utils-BaTmNvWt.mjs";
3
- import { _ as P, T as E, o as b } from "./enums-DwsxZqjR.mjs";
4
- var de = /\s/;
5
- function me(t) {
6
- for (var e = t.length; e-- && de.test(t.charAt(e)); )
7
- ;
8
- return e;
9
- }
10
- var ge = /^\s+/;
11
- function pe(t) {
12
- return t && t.slice(0, me(t) + 1).replace(ge, "");
13
- }
14
- var q = NaN, ye = /^[-+]0x[0-9a-f]+$/i, we = /^0b[01]+$/i, Se = /^0o[0-7]+$/i, Ee = parseInt;
15
- function j(t) {
16
- if (typeof t == "number")
17
- return t;
18
- if (he(t))
19
- return q;
20
- if (O(t)) {
21
- var e = typeof t.valueOf == "function" ? t.valueOf() : t;
22
- t = O(e) ? e + "" : e;
23
- }
24
- if (typeof t != "string")
25
- return t === 0 ? t : +t;
26
- t = pe(t);
27
- var n = we.test(t);
28
- return n || Se.test(t) ? Ee(t.slice(2), n ? 2 : 8) : ye.test(t) ? q : +t;
29
- }
30
- var M = function() {
31
- return fe.Date.now();
32
- }, be = "Expected a function", xe = Math.max, Re = Math.min;
33
- function Ce(t, e, n) {
34
- var r, i, s, a, c, o, u = 0, f = !1, m = !1, h = !0;
35
- if (typeof t != "function")
36
- throw new TypeError(be);
37
- e = j(e) || 0, O(n) && (f = !!n.leading, m = "maxWait" in n, s = m ? xe(j(n.maxWait) || 0, e) : s, h = "trailing" in n ? !!n.trailing : h);
38
- function w(l) {
39
- var S = r, C = i;
40
- return r = i = void 0, u = l, a = t.apply(C, S), a;
41
- }
42
- function R(l) {
43
- return u = l, c = setTimeout(L, e), f ? w(l) : a;
44
- }
45
- function I(l) {
46
- var S = l - o, C = l - u, U = e - S;
47
- return m ? Re(U, s - C) : U;
48
- }
49
- function z(l) {
50
- var S = l - o, C = l - u;
51
- return o === void 0 || S >= e || S < 0 || m && C >= s;
52
- }
53
- function L() {
54
- var l = M();
55
- if (z(l))
56
- return G(l);
57
- c = setTimeout(L, I(l));
58
- }
59
- function G(l) {
60
- return c = void 0, h && r ? w(l) : (r = i = void 0, a);
61
- }
62
- function le() {
63
- c !== void 0 && clearTimeout(c), u = 0, r = o = i = c = void 0;
64
- }
65
- function ue() {
66
- return c === void 0 ? a : G(M());
67
- }
68
- function $() {
69
- var l = M(), S = z(l);
70
- if (r = arguments, i = this, o = l, S) {
71
- if (c === void 0)
72
- return R(o);
73
- if (m)
74
- return clearTimeout(c), c = setTimeout(L, e), w(o);
75
- }
76
- return c === void 0 && (c = setTimeout(L, e)), a;
77
- }
78
- return $.cancel = le, $.flush = ue, $;
79
- }
80
- function Te(t, e) {
81
- if (t.match(/^[a-z]+:\/\//i))
82
- return t;
83
- if (t.match(/^\/\//))
84
- return window.location.protocol + t;
85
- if (t.match(/^[a-z]+:/i))
86
- return t;
87
- const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
88
- return n.head.appendChild(r), n.body.appendChild(i), e && (r.href = e), i.href = t, i.href;
89
- }
90
- const Ie = /* @__PURE__ */ (() => {
91
- let t = 0;
92
- const e = () => (
93
- // eslint-disable-next-line no-bitwise
94
- `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
95
- );
96
- return () => (t += 1, `u${e()}${t}`);
97
- })();
98
- function y(t) {
99
- const e = [];
100
- for (let n = 0, r = t.length; n < r; n++)
101
- e.push(t[n]);
102
- return e;
103
- }
104
- function v(t, e) {
105
- const r = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
106
- return r ? parseFloat(r.replace("px", "")) : 0;
107
- }
108
- function Le(t) {
109
- const e = v(t, "border-left-width"), n = v(t, "border-right-width");
110
- return t.clientWidth + e + n;
111
- }
112
- function De(t) {
113
- const e = v(t, "border-top-width"), n = v(t, "border-bottom-width");
114
- return t.clientHeight + e + n;
115
- }
116
- function ee(t, e = {}) {
117
- const n = e.width || Le(t), r = e.height || De(t);
118
- return { width: n, height: r };
119
- }
120
- function ve() {
121
- let t, e;
122
- try {
123
- e = process;
124
- } catch {
125
- }
126
- const n = e && e.env ? e.env.devicePixelRatio : null;
127
- return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
128
- }
129
- const p = 16384;
130
- function Fe(t) {
131
- (t.width > p || t.height > p) && (t.width > p && t.height > p ? t.width > t.height ? (t.height *= p / t.width, t.width = p) : (t.width *= p / t.height, t.height = p) : t.width > p ? (t.height *= p / t.width, t.width = p) : (t.width *= p / t.height, t.height = p));
132
- }
133
- function F(t) {
134
- return new Promise((e, n) => {
135
- const r = new Image();
136
- r.decode = () => e(r), r.onload = () => e(r), r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
137
- });
138
- }
139
- async function Ae(t) {
140
- return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
141
- }
142
- async function $e(t, e, n) {
143
- const r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), s = document.createElementNS(r, "foreignObject");
144
- return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${n}`), s.setAttribute("width", "100%"), s.setAttribute("height", "100%"), s.setAttribute("x", "0"), s.setAttribute("y", "0"), s.setAttribute("externalResourcesRequired", "true"), i.appendChild(s), s.appendChild(t), Ae(i);
145
- }
146
- const g = (t, e) => {
147
- if (t instanceof e)
148
- return !0;
149
- const n = Object.getPrototypeOf(t);
150
- return n === null ? !1 : n.constructor.name === e.name || g(n, e);
151
- };
152
- function Pe(t) {
153
- const e = t.getPropertyValue("content");
154
- return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
155
- }
156
- function Me(t) {
157
- return y(t).map((e) => {
158
- const n = t.getPropertyValue(e), r = t.getPropertyPriority(e);
159
- return `${e}: ${n}${r ? " !important" : ""};`;
160
- }).join(" ");
161
- }
162
- function He(t, e, n) {
163
- const r = `.${t}:${e}`, i = n.cssText ? Pe(n) : Me(n);
164
- return document.createTextNode(`${r}{${i}}`);
165
- }
166
- function N(t, e, n) {
167
- const r = window.getComputedStyle(t, n), i = r.getPropertyValue("content");
168
- if (i === "" || i === "none")
169
- return;
170
- const s = Ie();
171
- try {
172
- e.className = `${e.className} ${s}`;
173
- } catch {
174
- return;
175
- }
176
- const a = document.createElement("style");
177
- a.appendChild(He(s, n, r)), e.appendChild(a);
178
- }
179
- function Oe(t, e) {
180
- N(t, e, ":before"), N(t, e, ":after");
181
- }
182
- const X = "application/font-woff", J = "image/jpeg", Be = {
183
- woff: X,
184
- woff2: X,
185
- ttf: "application/font-truetype",
186
- eot: "application/vnd.ms-fontobject",
187
- png: "image/png",
188
- jpg: J,
189
- jpeg: J,
190
- gif: "image/gif",
191
- tiff: "image/tiff",
192
- svg: "image/svg+xml",
193
- webp: "image/webp"
194
- };
195
- function ke(t) {
196
- const e = /\.([^./]*?)$/g.exec(t);
197
- return e ? e[1] : "";
198
- }
199
- function V(t) {
200
- const e = ke(t).toLowerCase();
201
- return Be[e] || "";
202
- }
203
- function Ve(t) {
204
- return t.split(/,/)[1];
205
- }
206
- function B(t) {
207
- return t.search(/^(data:)/) !== -1;
208
- }
209
- function We(t, e) {
210
- return `data:${e};base64,${t}`;
211
- }
212
- async function te(t, e, n) {
213
- const r = await fetch(t, e);
214
- if (r.status === 404)
215
- throw new Error(`Resource "${r.url}" not found`);
216
- const i = await r.blob();
217
- return new Promise((s, a) => {
218
- const c = new FileReader();
219
- c.onerror = a, c.onloadend = () => {
220
- try {
221
- s(n({ res: r, result: c.result }));
222
- } catch (o) {
223
- a(o);
224
- }
225
- }, c.readAsDataURL(i);
226
- });
227
- }
228
- const H = {};
229
- function ze(t, e, n) {
230
- let r = t.replace(/\?.*/, "");
231
- return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
232
- }
233
- async function W(t, e, n) {
234
- const r = ze(t, e, n.includeQueryParams);
235
- if (H[r] != null)
236
- return H[r];
237
- n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
238
- let i;
239
- try {
240
- const s = await te(t, n.fetchRequestInit, ({ res: a, result: c }) => (e || (e = a.headers.get("Content-Type") || ""), Ve(c)));
241
- i = We(s, e);
242
- } catch (s) {
243
- i = n.imagePlaceholder || "";
244
- let a = `Failed to fetch resource: ${t}`;
245
- s && (a = typeof s == "string" ? s : s.message), a && console.warn(a);
246
- }
247
- return H[r] = i, i;
248
- }
249
- async function Ge(t) {
250
- const e = t.toDataURL();
251
- return e === "data:," ? t.cloneNode(!1) : F(e);
252
- }
253
- async function Ue(t, e) {
254
- if (t.currentSrc) {
255
- const s = document.createElement("canvas"), a = s.getContext("2d");
256
- s.width = t.clientWidth, s.height = t.clientHeight, a == null || a.drawImage(t, 0, 0, s.width, s.height);
257
- const c = s.toDataURL();
258
- return F(c);
259
- }
260
- const n = t.poster, r = V(n), i = await W(n, r, e);
261
- return F(i);
262
- }
263
- async function _e(t) {
264
- var e;
265
- try {
266
- if (!((e = t == null ? void 0 : t.contentDocument) === null || e === void 0) && e.body)
267
- return await A(t.contentDocument.body, {}, !0);
268
- } catch {
269
- }
270
- return t.cloneNode(!1);
271
- }
272
- async function qe(t, e) {
273
- return g(t, HTMLCanvasElement) ? Ge(t) : g(t, HTMLVideoElement) ? Ue(t, e) : g(t, HTMLIFrameElement) ? _e(t) : t.cloneNode(!1);
274
- }
275
- const je = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT";
276
- async function Ne(t, e, n) {
277
- var r, i;
278
- let s = [];
279
- return je(t) && t.assignedNodes ? s = y(t.assignedNodes()) : g(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? s = y(t.contentDocument.body.childNodes) : s = y(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), s.length === 0 || g(t, HTMLVideoElement) || await s.reduce((a, c) => a.then(() => A(c, n)).then((o) => {
280
- o && e.appendChild(o);
281
- }), Promise.resolve()), e;
282
- }
283
- function Xe(t, e) {
284
- const n = e.style;
285
- if (!n)
286
- return;
287
- const r = window.getComputedStyle(t);
288
- r.cssText ? (n.cssText = r.cssText, n.transformOrigin = r.transformOrigin) : y(r).forEach((i) => {
289
- let s = r.getPropertyValue(i);
290
- i === "font-size" && s.endsWith("px") && (s = `${Math.floor(parseFloat(s.substring(0, s.length - 2))) - 0.1}px`), g(t, HTMLIFrameElement) && i === "display" && s === "inline" && (s = "block"), i === "d" && e.getAttribute("d") && (s = `path(${e.getAttribute("d")})`), n.setProperty(i, s, r.getPropertyPriority(i));
291
- });
292
- }
293
- function Je(t, e) {
294
- g(t, HTMLTextAreaElement) && (e.innerHTML = t.value), g(t, HTMLInputElement) && e.setAttribute("value", t.value);
295
- }
296
- function Qe(t, e) {
297
- if (g(t, HTMLSelectElement)) {
298
- const n = e, r = Array.from(n.children).find((i) => t.value === i.getAttribute("value"));
299
- r && r.setAttribute("selected", "");
300
- }
301
- }
302
- function Ye(t, e) {
303
- return g(e, Element) && (Xe(t, e), Oe(t, e), Je(t, e), Qe(t, e)), e;
304
- }
305
- async function Ze(t, e) {
306
- const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
307
- if (n.length === 0)
308
- return t;
309
- const r = {};
310
- for (let s = 0; s < n.length; s++) {
311
- const c = n[s].getAttribute("xlink:href");
312
- if (c) {
313
- const o = t.querySelector(c), u = document.querySelector(c);
314
- !o && u && !r[c] && (r[c] = await A(u, e, !0));
315
- }
316
- }
317
- const i = Object.values(r);
318
- if (i.length) {
319
- const s = "http://www.w3.org/1999/xhtml", a = document.createElementNS(s, "svg");
320
- a.setAttribute("xmlns", s), a.style.position = "absolute", a.style.width = "0", a.style.height = "0", a.style.overflow = "hidden", a.style.display = "none";
321
- const c = document.createElementNS(s, "defs");
322
- a.appendChild(c);
323
- for (let o = 0; o < i.length; o++)
324
- c.appendChild(i[o]);
325
- t.appendChild(a);
326
- }
327
- return t;
328
- }
329
- async function A(t, e, n) {
330
- return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => qe(r, e)).then((r) => Ne(t, r, e)).then((r) => Ye(t, r)).then((r) => Ze(r, e));
331
- }
332
- const ne = /url\((['"]?)([^'"]+?)\1\)/g, Ke = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, et = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
333
- function tt(t) {
334
- const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
335
- return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
336
- }
337
- function nt(t) {
338
- const e = [];
339
- return t.replace(ne, (n, r, i) => (e.push(i), n)), e.filter((n) => !B(n));
340
- }
341
- async function rt(t, e, n, r, i) {
342
- try {
343
- const s = n ? Te(e, n) : e, a = V(e);
344
- let c;
345
- return i || (c = await W(s, a, r)), t.replace(tt(e), `$1${c}$3`);
346
- } catch {
347
- }
348
- return t;
349
- }
350
- function it(t, { preferredFontFormat: e }) {
351
- return e ? t.replace(et, (n) => {
352
- for (; ; ) {
353
- const [r, , i] = Ke.exec(n) || [];
354
- if (!i)
355
- return "";
356
- if (i === e)
357
- return `src: ${r};`;
358
- }
359
- }) : t;
360
- }
361
- function re(t) {
362
- return t.search(ne) !== -1;
363
- }
364
- async function ie(t, e, n) {
365
- if (!re(t))
366
- return t;
367
- const r = it(t, n);
368
- return nt(r).reduce((s, a) => s.then((c) => rt(c, a, e, n)), Promise.resolve(r));
369
- }
370
- async function D(t, e, n) {
371
- var r;
372
- const i = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
373
- if (i) {
374
- const s = await ie(i, null, n);
375
- return e.style.setProperty(t, s, e.style.getPropertyPriority(t)), !0;
376
- }
377
- return !1;
378
- }
379
- async function st(t, e) {
380
- await D("background", t, e) || await D("background-image", t, e), await D("mask", t, e) || await D("mask-image", t, e);
381
- }
382
- async function at(t, e) {
383
- const n = g(t, HTMLImageElement);
384
- if (!(n && !B(t.src)) && !(g(t, SVGImageElement) && !B(t.href.baseVal)))
385
- return;
386
- const r = n ? t.src : t.href.baseVal, i = await W(r, V(r), e);
387
- await new Promise((s, a) => {
388
- t.onload = s, t.onerror = a;
389
- const c = t;
390
- c.decode && (c.decode = s), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
391
- });
392
- }
393
- async function ct(t, e) {
394
- const r = y(t.childNodes).map((i) => se(i, e));
395
- await Promise.all(r).then(() => t);
396
- }
397
- async function se(t, e) {
398
- g(t, Element) && (await st(t, e), await at(t, e), await ct(t, e));
399
- }
400
- function ot(t, e) {
401
- const { style: n } = t;
402
- e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
403
- const r = e.style;
404
- return r != null && Object.keys(r).forEach((i) => {
405
- n[i] = r[i];
406
- }), t;
407
- }
408
- const Q = {};
409
- async function Y(t) {
410
- let e = Q[t];
411
- if (e != null)
412
- return e;
413
- const r = await (await fetch(t)).text();
414
- return e = { url: t, cssText: r }, Q[t] = e, e;
415
- }
416
- async function Z(t, e) {
417
- let n = t.cssText;
418
- const r = /url\(["']?([^"')]+)["']?\)/g, s = (n.match(/url\([^)]+\)/g) || []).map(async (a) => {
419
- let c = a.replace(r, "$1");
420
- return c.startsWith("https://") || (c = new URL(c, t.url).href), te(c, e.fetchRequestInit, ({ result: o }) => (n = n.replace(a, `url(${o})`), [a, o]));
421
- });
422
- return Promise.all(s).then(() => n);
423
- }
424
- function K(t) {
425
- if (t == null)
426
- return [];
427
- const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
428
- let r = t.replace(n, "");
429
- const i = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
430
- for (; ; ) {
431
- const o = i.exec(r);
432
- if (o === null)
433
- break;
434
- e.push(o[0]);
435
- }
436
- r = r.replace(i, "");
437
- const s = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", c = new RegExp(a, "gi");
438
- for (; ; ) {
439
- let o = s.exec(r);
440
- if (o === null) {
441
- if (o = c.exec(r), o === null)
442
- break;
443
- s.lastIndex = c.lastIndex;
444
- } else
445
- c.lastIndex = s.lastIndex;
446
- e.push(o[0]);
447
- }
448
- return e;
449
- }
450
- async function lt(t, e) {
451
- const n = [], r = [];
452
- return t.forEach((i) => {
453
- if ("cssRules" in i)
454
- try {
455
- y(i.cssRules || []).forEach((s, a) => {
456
- if (s.type === CSSRule.IMPORT_RULE) {
457
- let c = a + 1;
458
- const o = s.href, u = Y(o).then((f) => Z(f, e)).then((f) => K(f).forEach((m) => {
459
- try {
460
- i.insertRule(m, m.startsWith("@import") ? c += 1 : i.cssRules.length);
461
- } catch (h) {
462
- console.error("Error inserting rule from remote css", {
463
- rule: m,
464
- error: h
465
- });
466
- }
467
- })).catch((f) => {
468
- console.error("Error loading remote css", f.toString());
469
- });
470
- r.push(u);
471
- }
472
- });
473
- } catch (s) {
474
- const a = t.find((c) => c.href == null) || document.styleSheets[0];
475
- i.href != null && r.push(Y(i.href).then((c) => Z(c, e)).then((c) => K(c).forEach((o) => {
476
- a.insertRule(o, i.cssRules.length);
477
- })).catch((c) => {
478
- console.error("Error loading remote stylesheet", c);
479
- })), console.error("Error inlining remote css file", s);
480
- }
481
- }), Promise.all(r).then(() => (t.forEach((i) => {
482
- if ("cssRules" in i)
483
- try {
484
- y(i.cssRules || []).forEach((s) => {
485
- n.push(s);
486
- });
487
- } catch (s) {
488
- console.error(`Error while reading CSS rules from ${i.href}`, s);
489
- }
490
- }), n));
491
- }
492
- function ut(t) {
493
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => re(e.style.getPropertyValue("src")));
494
- }
495
- async function ht(t, e) {
496
- if (t.ownerDocument == null)
497
- throw new Error("Provided element is not within a Document");
498
- const n = y(t.ownerDocument.styleSheets), r = await lt(n, e);
499
- return ut(r);
500
- }
501
- async function ft(t, e) {
502
- const n = await ht(t, e);
503
- return (await Promise.all(n.map((i) => {
504
- const s = i.parentStyleSheet ? i.parentStyleSheet.href : null;
505
- return ie(i.cssText, s, e);
506
- }))).join(`
507
- `);
508
- }
509
- async function dt(t, e) {
510
- const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await ft(t, e);
511
- if (n) {
512
- const r = document.createElement("style"), i = document.createTextNode(n);
513
- r.appendChild(i), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
514
- }
515
- }
516
- async function mt(t, e = {}) {
517
- const { width: n, height: r } = ee(t, e), i = await A(t, e, !0);
518
- return await dt(i, e), await se(i, e), ot(i, e), await $e(i, n, r);
519
- }
520
- async function ae(t, e = {}) {
521
- const { width: n, height: r } = ee(t, e), i = await mt(t, e), s = await F(i), a = document.createElement("canvas"), c = a.getContext("2d"), o = e.pixelRatio || ve(), u = e.canvasWidth || n, f = e.canvasHeight || r;
522
- return a.width = u * o, a.height = f * o, e.skipAutoScale || Fe(a), a.style.width = `${u}`, a.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, a.width, a.height)), c.drawImage(s, 0, 0, a.width, a.height), a;
523
- }
524
- async function gt(t, e = {}) {
525
- return (await ae(t, e)).toDataURL();
526
- }
527
- async function pt(t, e = {}) {
528
- return (await ae(t, e)).toDataURL("image/jpeg", e.quality || 1);
529
- }
530
- class ce {
531
- constructor(e, n) {
532
- this.model = e, this.services = n, this.init();
533
- }
534
- init() {
535
- }
536
- update() {
537
- }
538
- // Used to pass down information to the components
539
- setModel(e) {
540
- this.model = e;
541
- }
542
- // Used to pass down services to the components
543
- setServices(e) {
544
- this.services = e;
545
- }
546
- }
547
- const yt = "DONT_STYLE_ME_css_styles_verifier";
548
- class k extends ce {
549
- // initialized in initializeID() called by init()
550
- constructor(e, n) {
551
- super(e, n);
552
- }
553
- static getHTMLElementSize(e) {
554
- return {
555
- width: e.clientWidth,
556
- height: e.clientHeight
557
- };
558
- }
559
- static getSVGElementSize(e, n = {
560
- useAttrs: !1,
561
- useClientDimensions: !1,
562
- useBBox: !1,
563
- useBoundingRect: !1
564
- }) {
565
- e.attr || (e = d(e));
566
- const r = {
567
- width: 0,
568
- height: 0
569
- }, i = (h) => {
570
- h && Object.keys(r).forEach((w) => {
571
- if (h[w]) {
572
- const R = h[w], I = parseFloat(R);
573
- R && I > r[w] && ("" + R).indexOf("%") === -1 && (r[w] = I);
574
- }
575
- });
576
- }, s = {
577
- width: e.attr("width"),
578
- height: e.attr("height")
579
- }, a = e.node();
580
- let c, o, u, f;
581
- try {
582
- typeof a.getBBox == "function" && (c = a.getBBox(), o = {
583
- width: c.width,
584
- height: c.height
585
- });
586
- } catch (h) {
587
- console.error(h);
588
- }
589
- try {
590
- typeof (a == null ? void 0 : a.getBoundingClientRect) == "function" && (u = a.getBoundingClientRect(), f = {
591
- width: u.width,
592
- height: u.height
593
- });
594
- } catch (h) {
595
- console.error(h);
596
- }
597
- let m;
598
- if (a instanceof SVGSVGElement && (m = {
599
- width: a.clientWidth,
600
- height: a.clientHeight
601
- }), n) {
602
- if (n.useAttrs && (i(s), r.width > 0 && r.height > 0))
603
- return r;
604
- if (n.useClientDimensions && (i(m), r.width > 0 && r.height > 0))
605
- return m;
606
- if (n.useBBox && (i(o), r.width > 0 && r.height > 0))
607
- return o;
608
- if (n.useBoundingRect && (i(f), r.width > 0 && r.height > 0))
609
- return f;
610
- }
611
- try {
612
- const h = {
613
- width: T(e.node(), "width", "baseVal", "value"),
614
- height: T(e.node(), "height", "baseVal", "value")
615
- };
616
- i(h);
617
- } catch {
618
- i(m), i(o), i(s);
619
- }
620
- return r;
621
- }
622
- static appendOrSelect(e, n) {
623
- const r = e.select(`${n}`);
624
- if (r.empty()) {
625
- let i = n.split("#"), s, a;
626
- return i.length === 2 ? (s = i[0], i = i[1].split("."), a = i[0]) : (i = n.split("."), s = i[0]), e.append(s).attr("id", a).attr("class", i.slice(1).join(" "));
627
- }
628
- return r;
629
- }
630
- init() {
631
- this.initializeID(), this.styleHolderElement(), this.addMainContainer(), this.model.getOptions().resizable && this.addResizeListener(), this.addHolderListeners(), this.handleFullscreenChange();
632
- }
633
- getChartID() {
634
- return this.chartID;
635
- }
636
- getElementOffset(e, n = !1) {
637
- const r = { left: 0, top: 0 }, i = e.getBoundingClientRect(), s = n ? { left: 0, top: 0 } : this.getHolder().getBoundingClientRect();
638
- try {
639
- r.left = i.left - s.left, r.top = i.top - s.top;
640
- } catch (a) {
641
- console.error(a);
642
- }
643
- return r;
644
- }
645
- generateElementIDString(e) {
646
- return `chart-${this.chartID}-${e}`;
647
- }
648
- initializeID() {
649
- this.chartID = Math.floor((1 + Math.random()) * 281474976710656).toString(16);
650
- }
651
- addMainContainer() {
652
- const e = this.model.getOptions(), n = T(e, "style", "prefix"), r = d(this.getHolder()).append("div").classed(`${_}--${n}--chart-wrapper`, !0).attr("id", `chart-${this.getChartID()}`).style("height", "100%").style("width", "100%");
653
- r.append("g").attr("class", yt), this.mainContainer = r.node();
654
- }
655
- update() {
656
- this.styleHolderElement();
657
- }
658
- styleHolderElement() {
659
- const e = this.getHolder(), { width: n, height: r, theme: i } = this.model.getOptions();
660
- n !== this.width && (e.style.width = n, this.width = n), r !== this.height && (e.style.height = r, this.height = r), d(this.getHolder()).classed(`${_}--chart-holder`, !0).attr("data-carbon-theme", i);
661
- }
662
- getHolder() {
663
- return this.model.get("holder");
664
- }
665
- exportToJPG() {
666
- const e = this, n = this.model.getOptions(), r = this.getHolder(), i = d(r);
667
- i.classed("filled", !0), pt(this.getMainContainer(), {
668
- quality: 1,
669
- // Remove toolbar
670
- filter: (s) => !(s.classList && s.classList.contains("cds--cc--toolbar"))
671
- }).then(function(s) {
672
- var o;
673
- let a = "myChart";
674
- const c = T(n, "fileDownload", "fileName");
675
- typeof c == "function" ? a = c("jpg") : typeof c == "string" && (a = c), (o = e.services.files) == null || o.downloadImage(s, `${a}.jpg`), i.classed("filled", !1);
676
- });
677
- }
678
- exportToPNG() {
679
- const e = this, n = this.model.getOptions(), r = this.getHolder(), i = d(r);
680
- i.classed("filled", !0), gt(this.getMainContainer(), {
681
- quality: 1,
682
- // Remove toolbar
683
- filter: (s) => !(s.classList && s.classList.contains("cds--cc--toolbar"))
684
- }).then(function(s) {
685
- var o;
686
- let a = "myChart";
687
- const c = T(n, "fileDownload", "fileName");
688
- typeof c == "function" ? a = c("png") : typeof c == "string" && (a = c), (o = e.services.files) == null || o.downloadImage(s, `${a}.png`), i.classed("filled", !1);
689
- }).catch(function(s) {
690
- console.error("oops, something went wrong!", s);
691
- });
692
- }
693
- isFullScreenMode() {
694
- return d(this.getHolder()).classed("fullscreen");
695
- }
696
- toggleFullscreen() {
697
- const e = this.getHolder();
698
- d(e).classed("fullscreen") && (document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement) ? document.exitFullscreen ? document.exitFullscreen() : document.webkitExitFullscreen ? document.webkitExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen() : e.requestFullscreen ? e.requestFullscreen() : e.webkitRequestFullscreen ? e.webkitRequestFullscreen() : e.mozRequestFullScreen ? e.mozRequestFullScreen() : e.msRequestFullscreen && e.msRequestFullscreen();
699
- }
700
- handleFullscreenChange() {
701
- document.addEventListener("fullscreenchange", () => {
702
- const e = d(this.getHolder()), n = e.classed("fullscreen");
703
- e.classed("fullscreen", !n);
704
- });
705
- }
706
- setSVGMaxHeight() {
707
- if (!this.model.getOptions().height) {
708
- const { height: e } = k.getSVGElementSize(
709
- d(this.mainContainer),
710
- {
711
- useBBox: !0
712
- }
713
- ), n = d(this.mainContainer).attr("class"), r = d(this.mainContainer).selectAll(`.${n} > svg`);
714
- let i = 0;
715
- r.nodes().forEach(function(s) {
716
- i += Number(
717
- k.getSVGElementSize(d(s), {
718
- useBBox: !0
719
- }).height
720
- );
721
- }), i <= e ? d(this.mainContainer).attr("height", i) : d(this.mainContainer).attr("height", "100%");
722
- }
723
- }
724
- getMainContainer() {
725
- return this.mainContainer;
726
- }
727
- addHolderListeners() {
728
- const e = this.getHolder();
729
- e && d(e).on("mouseover", () => {
730
- var n;
731
- (n = this.services.events) == null || n.dispatchEvent(P.Chart.MOUSEOVER);
732
- }).on("mouseout", () => {
733
- var n;
734
- (n = this.services.events) == null || n.dispatchEvent(P.Chart.MOUSEOUT);
735
- });
736
- }
737
- addResizeListener() {
738
- const e = this.getHolder();
739
- if (!e)
740
- return;
741
- let n = e.clientWidth, r = e.clientHeight;
742
- const i = Ce(() => {
743
- var a;
744
- e && (Math.abs(n - e.clientWidth) > 1 || Math.abs(r - e.clientHeight) > 1) && (n = e.clientWidth, r = e.clientHeight, (a = this.services.events) == null || a.dispatchEvent(P.Chart.RESIZE));
745
- }, 12.5);
746
- new ResizeObserver(i).observe(e);
747
- }
748
- }
749
- class oe extends ce {
750
- static appendOrUpdateLinearGradient(e) {
751
- let n = e.svg.select(`defs linearGradient#${e.id}`);
752
- n.empty() && (n = e.svg.append("defs").append("linearGradient").attr("id", e.id).attr("x1", e.x1).attr("x2", e.x2).attr("y1", e.y1).attr("y2", e.y2)), n.selectAll("stop").remove(), n.selectAll("stop").data(e.stops).enter().append("stop").attr("offset", (r) => r.offset).style("stop-color", (r) => r.color).style("stop-opacity", (r) => r.opacity);
753
- }
754
- static getOffsetRatio(e) {
755
- return (Math.abs(e[1]) * 100 / Math.abs(e[0] - e[1])).toFixed(2) + "%";
756
- }
757
- static getStops(e, n) {
758
- const r = e[0] < 0 && e[1] > 0;
759
- let i = [
760
- {
761
- offset: "0%",
762
- color: n,
763
- opacity: "0.6"
764
- },
765
- {
766
- offset: "80%",
767
- color: n,
768
- opacity: "0"
769
- }
770
- ];
771
- return r && (i = [
772
- {
773
- offset: "0%",
774
- color: n,
775
- opacity: "0.6"
776
- },
777
- {
778
- offset: oe.getOffsetRatio(e),
779
- color: n,
780
- opacity: "0"
781
- },
782
- {
783
- offset: "100%",
784
- color: n,
785
- opacity: "0.6"
786
- }
787
- ]), i;
788
- }
789
- }
790
- function Rt(t) {
791
- const e = wt(St(t), 360);
792
- return x(e, [0, 10]) || x(e, [350, 0]) ? {
793
- textAnchor: E.START,
794
- dominantBaseline: b.MIDDLE
795
- } : x(e, [10, 80]) ? {
796
- textAnchor: E.START,
797
- dominantBaseline: b.HANGING
798
- } : x(e, [80, 100]) ? {
799
- textAnchor: E.MIDDLE,
800
- dominantBaseline: b.HANGING
801
- } : x(e, [100, 170]) ? {
802
- textAnchor: E.END,
803
- dominantBaseline: b.HANGING
804
- } : x(e, [170, 190]) ? {
805
- textAnchor: E.END,
806
- dominantBaseline: b.MIDDLE
807
- } : x(e, [190, 260]) ? {
808
- textAnchor: E.END,
809
- dominantBaseline: b.BASELINE
810
- } : x(e, [260, 280]) ? {
811
- textAnchor: E.MIDDLE,
812
- dominantBaseline: b.BASELINE
813
- } : {
814
- textAnchor: E.START,
815
- dominantBaseline: b.BASELINE
816
- };
817
- }
818
- function wt(t, e) {
819
- return (t % e + e) % e;
820
- }
821
- function x(t, [e, n]) {
822
- return t >= e && t <= n;
823
- }
824
- function St(t) {
825
- return t * (180 / Math.PI);
826
- }
827
- function Ct(t) {
828
- return t * (Math.PI / 180);
829
- }
830
- function Tt(t, e, n = { x: 0, y: 0 }) {
831
- const r = e * Math.cos(t) + n.x, i = e * Math.sin(t) + n.y;
832
- return { x: isNaN(r) ? 0 : r, y: isNaN(i) ? 0 : i };
833
- }
834
- function It(t, e) {
835
- return e * Math.sin(t - Math.PI / 2);
836
- }
837
- export {
838
- k as D,
839
- oe as G,
840
- ce as S,
841
- It as a,
842
- St as b,
843
- Ce as c,
844
- Ct as d,
845
- Tt as p,
846
- Rt as r,
847
- j as t
848
- };
849
- //# sourceMappingURL=angle-utils-BCx3SRS2.mjs.map