@astrato-io/visualizations 0.6.4 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/README.md +32 -2
  3. package/THIRD_PARTY_NOTICES.md +68 -205
  4. package/VISUALIZATION_DEFINITIONS.md +68 -114
  5. package/chunks/Button-BrGKp9Nm.js +110 -0
  6. package/chunks/DefaultPropsProvider-BsfB7QTn.js +257 -0
  7. package/chunks/FieldTypeIcon-Drs6hSJF.js +22 -0
  8. package/chunks/{LinearProgress-CUZ0D8_t.js → LinearProgress-VtfFx2vJ.js} +51 -51
  9. package/chunks/MenuOption-ByRqhRdX.js +3934 -0
  10. package/chunks/Title-CO5dP1ma.js +1691 -0
  11. package/chunks/ToggleButton-KOBAimC1.js +112 -0
  12. package/chunks/app-filter-bar.compiler-TwVTeoj5.js +64 -0
  13. package/chunks/bar.compiler-DuQg8EUb.js +374 -0
  14. package/chunks/builder-DEDvNq1k.js +201 -0
  15. package/chunks/{color-settings-ZIvgNTq1.js → color-rules-CN7TcGrC.js} +2 -6
  16. package/chunks/color-settings-3VRlf_Vw.js +6 -0
  17. package/chunks/colorManipulator-D8Pjy1pf.js +45 -0
  18. package/chunks/coloring-CncX_JRX.js +278 -0
  19. package/chunks/{src-BC7cGcJ-.js → definitions-BPJQTx16.js} +650 -464
  20. package/chunks/{escobar-BGqT1EsE.js → escobar-DRhRMYRE.js} +6282 -4931
  21. package/chunks/event-bus-CrLB-Y8z.js +3 -0
  22. package/chunks/extend-preset-CUFNpmPe.js +4398 -0
  23. package/chunks/filter.compiler-w27dlv0C.js +70 -0
  24. package/chunks/filtering-cc7WqWpg.js +1153 -0
  25. package/chunks/handlers-TOT-7INo.js +12871 -0
  26. package/chunks/icon-picker-styles-CoJmwTRi.js +2246 -0
  27. package/chunks/isEqual-B8loyPsC.js +12 -0
  28. package/chunks/label-format-type-weq1XfcX.js +8 -0
  29. package/chunks/line.compiler-Ct1WhN2p.js +198 -0
  30. package/chunks/logger-DpQtYQnX.js +1163 -0
  31. package/chunks/lookup-BWllin0q.js +36 -0
  32. package/chunks/{metadata-CPXdYoln.js → metadata-WABZrt7Y.js} +1 -1
  33. package/chunks/number.compiler-D8TPly-4.js +53 -0
  34. package/chunks/{src-C0LgoUWY.js → operations-Dh4v1Ovt.js} +7716 -7541
  35. package/chunks/{range-DrzdfBX4.js → range-Bi-7zT0k.js} +2 -2
  36. package/chunks/registry-KervaxqJ.js +31 -0
  37. package/chunks/render-wrappers-OEmtaM8g.js +2 -0
  38. package/chunks/{registry-CExpGJ1N.js → requirements-PAoRaJyb.js} +294 -326
  39. package/chunks/responsive.styles-DSiOGD7u.js +82 -0
  40. package/chunks/shared-Bn4N5QcZ.js +1218 -0
  41. package/chunks/src-77e3mC7i.js +391 -0
  42. package/chunks/standalone-B55oyW6c.js +689 -0
  43. package/chunks/{standalone-CY57qwZ-.js → standalone-BDhPQtzQ.js} +386 -352
  44. package/chunks/{standalone-BDCwI6Hn.js → standalone-BGkmozIb.js} +1108 -953
  45. package/chunks/standalone-BMTCb10X.js +179 -0
  46. package/chunks/standalone-BXKRE_Se.js +468 -0
  47. package/chunks/standalone-Bes8srx1.js +354 -0
  48. package/chunks/standalone-BjZp0QMe.js +2 -0
  49. package/chunks/{standalone-BH5NqDwp.js → standalone-BlMIwpEe.js} +687 -573
  50. package/chunks/{standalone-CCNtaJ7s.js → standalone-C8ZAEutO.js} +44 -43
  51. package/chunks/standalone-C8qAelL4.js +2 -0
  52. package/chunks/standalone-CJvIXsQE.js +743 -0
  53. package/chunks/standalone-CLmGb7nn2.js +355 -0
  54. package/chunks/{ui-D1HQNIBy.js → standalone-CM5XcAN5.js} +15946 -17658
  55. package/chunks/standalone-CXNP6-xD.js +420 -0
  56. package/chunks/{standalone-BYm1UjLr.js → standalone-D5Q5ngsD.js} +59 -57
  57. package/chunks/standalone-DLlyRIE6.js +287 -0
  58. package/chunks/standalone-DMcI1afI.js +396 -0
  59. package/chunks/{standalone-jiz0L2Dg.js → standalone-DN4S1MjT.js} +1113 -1094
  60. package/chunks/{standalone-QJ1kKMnO.js → standalone-DT0wKji7.js} +2 -2
  61. package/chunks/{standalone-D5vnf-9y.js → standalone-DVTJwsTY.js} +1110 -1035
  62. package/chunks/standalone-DW6NT205.js +518 -0
  63. package/chunks/standalone-DYQIQH4c.js +2095 -0
  64. package/chunks/standalone-D__XCp-h.js +1003 -0
  65. package/chunks/standalone-XTgSsTAa.js +354 -0
  66. package/chunks/standalone-XuGksArp.js +68 -0
  67. package/chunks/{standalone-CNyNHKVx.js → standalone-we5D5MIn.js} +176 -172
  68. package/chunks/table.compiler-DMeeHxb6.js +222 -0
  69. package/chunks/useFieldName-Cjn9KCVp.js +7 -0
  70. package/chunks/useSlotProps-DLbQp4lc.js +166 -0
  71. package/chunks/{utils-Ba9T0TqC.js → utils-vdmi_2PK.js} +6266 -6517
  72. package/chunks/{src-DvX5LU9T.js → view-BuwQugKb.js} +2893 -5956
  73. package/chunks/visualization-filters-Cc4KU-l-.js +7455 -0
  74. package/chunks/web-components-DqClFkgO.js +1185 -0
  75. package/chunks/with-html-element-D0uY2zjI.js +7328 -0
  76. package/definitions.js +3 -3
  77. package/docs/operations/astrato-app-filter-bar.md +17 -17
  78. package/docs/operations/bar.md +1006 -1071
  79. package/docs/operations/combo.md +717 -738
  80. package/docs/operations/date-picker.md +27 -27
  81. package/docs/operations/distribution-gauge.md +471 -607
  82. package/docs/operations/dot.md +787 -879
  83. package/docs/operations/filter.md +139 -163
  84. package/docs/operations/gauge.md +491 -627
  85. package/docs/operations/heatMap.md +834 -916
  86. package/docs/operations/histogram.md +166 -180
  87. package/docs/operations/iframe.md +5 -5
  88. package/docs/operations/image.md +16 -16
  89. package/docs/operations/index.md +12 -12
  90. package/docs/operations/line.md +811 -888
  91. package/docs/operations/number.md +470 -536
  92. package/docs/operations/pie.md +825 -958
  93. package/docs/operations/radar.md +599 -679
  94. package/docs/operations/sankey.md +462 -584
  95. package/docs/operations/scatter.md +823 -929
  96. package/docs/operations/shape.md +34 -34
  97. package/docs/operations/simpleTextObject.md +18 -25
  98. package/docs/operations/slider.md +33 -43
  99. package/docs/operations/table.md +1177 -1150
  100. package/docs/operations/tree.md +404 -397
  101. package/docs/operations/treemap.md +595 -673
  102. package/docs/operations/waterfall.md +369 -379
  103. package/docs/operations/word-cloud.md +512 -583
  104. package/getters.js +7 -7
  105. package/index.js +3 -1183
  106. package/metadata.js +18 -18
  107. package/operations.js +13 -13
  108. package/package.json +133 -88
  109. package/render.js +10 -0
  110. package/src/charts/bar.d.ts +1 -0
  111. package/src/charts/combo.d.ts +1 -0
  112. package/src/charts/dot.d.ts +1 -0
  113. package/src/charts/gauge-distribution.d.ts +1 -0
  114. package/src/charts/gauge.d.ts +1 -0
  115. package/src/charts/heat-map.d.ts +1 -0
  116. package/src/charts/histogram.d.ts +1 -0
  117. package/src/charts/line.d.ts +1 -0
  118. package/src/charts/pie.d.ts +1 -0
  119. package/src/charts/radar.d.ts +1 -0
  120. package/src/charts/sankey.d.ts +1 -0
  121. package/src/charts/scatter.d.ts +1 -0
  122. package/src/charts/table.d.ts +1 -0
  123. package/src/charts/tree.d.ts +1 -0
  124. package/src/charts/treemap.d.ts +1 -0
  125. package/src/charts/waterfall.d.ts +1 -0
  126. package/src/charts/word-cloud.d.ts +1 -0
  127. package/src/definitions/index.d.ts +2 -2
  128. package/src/definitions/{shared/lib → model/definitions}/available-fields.d.ts +0 -1
  129. package/src/definitions/{shared/lib/compilers/index.d.ts → model/definitions/compilers/compile.d.ts} +1 -1
  130. package/src/definitions/model/definitions/data-item-resolution.d.ts +19 -0
  131. package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +1364 -0
  132. package/src/definitions/model/definitions/descriptors/json-schema.d.ts +2 -0
  133. package/src/definitions/model/definitions/diagnostics.d.ts +5 -0
  134. package/src/definitions/model/definitions/field-suggestions.d.ts +2 -0
  135. package/src/definitions/model/definitions/index.d.ts +23 -0
  136. package/src/definitions/{shared/lib → model/definitions}/registry/compile.d.ts +1 -1
  137. package/src/definitions/model/definitions/registry/descriptor-registry.d.ts +3 -0
  138. package/src/definitions/model/definitions/schema-registry.d.ts +660 -0
  139. package/src/definitions/{shared/lib → model/definitions}/schemas/broad-chart.schema.d.ts +1 -1
  140. package/src/definitions/{shared/lib → model/definitions}/schemas/common.schema.d.ts +0 -1
  141. package/src/definitions/model/definitions/schemas/index.d.ts +9 -0
  142. package/src/definitions/{shared/lib → model/definitions}/schemas/object.schema.d.ts +8 -8
  143. package/src/definitions/{shared/lib → model/definitions}/types/compilation.types.d.ts +10 -0
  144. package/src/definitions/{shared/lib → model/definitions}/types/definition.types.d.ts +1 -1
  145. package/src/definitions/model/definitions/types/index.d.ts +3 -0
  146. package/src/definitions/{shared/lib/registry → model/definitions}/validation.d.ts +1 -1
  147. package/src/getters/index.d.ts +3 -3
  148. package/src/index.d.ts +1 -1
  149. package/src/objects/app-filter-bar.d.ts +1 -0
  150. package/src/objects/date-picker.d.ts +1 -0
  151. package/src/objects/filter.d.ts +1 -0
  152. package/src/objects/iframe.d.ts +1 -0
  153. package/src/objects/image.d.ts +1 -0
  154. package/src/objects/number.d.ts +1 -0
  155. package/src/objects/shape.d.ts +1 -0
  156. package/src/objects/slider.d.ts +1 -0
  157. package/src/objects/text.d.ts +1 -0
  158. package/src/operations/index.d.ts +3 -3
  159. package/src/registry/create-visualization-registry.d.ts +5 -0
  160. package/src/render/index.d.ts +34 -0
  161. package/src/runtime/index.d.ts +2 -2
  162. package/src/types.d.ts +9 -4
  163. package/src/web-components/index.d.ts +3 -3
  164. package/chunks/Radio-Ciu-F4CU.js +0 -957
  165. package/chunks/ToggleButton-BCJc3Jlc.js +0 -153
  166. package/chunks/_baseFlatten-DPXPOrea.js +0 -7076
  167. package/chunks/app-filter-bar.compiler-j_CVoWTa.js +0 -55
  168. package/chunks/bar.compiler-oqaPzIut.js +0 -370
  169. package/chunks/coloring-C16AUZEi.js +0 -663
  170. package/chunks/data-item-resolution-1lvYB5ln.js +0 -53
  171. package/chunks/event-bus-KiSiCJrC.js +0 -2683
  172. package/chunks/events-WZut5Ow6.js +0 -4
  173. package/chunks/filter.compiler-CuLtc_02.js +0 -60
  174. package/chunks/filtering-Yq4DEa0t.js +0 -953
  175. package/chunks/gauge-target-type-BkKXAqkX.js +0 -4
  176. package/chunks/grouping-type-BX_9Ix5q.js +0 -3
  177. package/chunks/interfaces-VUY4_yVO.js +0 -8742
  178. package/chunks/line-settings-DfYTUyPz.js +0 -4
  179. package/chunks/line.compiler-BpA_6Tc7.js +0 -188
  180. package/chunks/number.compiler-DbkWcG4S.js +0 -44
  181. package/chunks/pie-uv42Eqal.js +0 -10
  182. package/chunks/requirements-DNhuShLS.js +0 -6
  183. package/chunks/shared-CKDL4hx9.js +0 -1171
  184. package/chunks/src-Cum_2NLV.js +0 -12145
  185. package/chunks/src-Dun_jXtz.js +0 -10295
  186. package/chunks/standalone-87YV_m9n.js +0 -687
  187. package/chunks/standalone-BLVAWLNJ.js +0 -385
  188. package/chunks/standalone-BPomtAVs.js +0 -2
  189. package/chunks/standalone-BXyBcUOQ.js +0 -2
  190. package/chunks/standalone-BllF4rDp.js +0 -383
  191. package/chunks/standalone-BmfMt74U.js +0 -726
  192. package/chunks/standalone-BqWyrnZI.js +0 -281
  193. package/chunks/standalone-C85u7U6I.js +0 -340
  194. package/chunks/standalone-CDQnr6qT.js +0 -345
  195. package/chunks/standalone-CZynjFG7.js +0 -12979
  196. package/chunks/standalone-DFPva_ku.js +0 -299
  197. package/chunks/standalone-DQxxNwF8.js +0 -675
  198. package/chunks/standalone-DS9T0FZ-.js +0 -830
  199. package/chunks/standalone-Dx3MLlrO.js +0 -512
  200. package/chunks/standalone-DzixzZAL.js +0 -411
  201. package/chunks/standalone-lBm9hQ-q.js +0 -179
  202. package/chunks/standalone-rJ45Zfl1.js +0 -68
  203. package/chunks/table.compiler-BrXkm4Fz.js +0 -213
  204. package/chunks/toInteger-DVZr-D1j.js +0 -11
  205. package/chunks/treemap-x_zmJoG7.js +0 -23
  206. package/chunks/types-dVVCsDWD.js +0 -4
  207. package/chunks/useFieldName-oqQ3bvnO.js +0 -7
  208. package/chunks/view-CLqWMV7Z.js +0 -156
  209. package/src/definitions/shared/index.d.ts +0 -5
  210. package/src/definitions/shared/lib/registry/descriptor-registry.d.ts +0 -587
  211. package/src/definitions/shared/lib/registry/index.d.ts +0 -3
  212. package/src/definitions/shared/lib/schemas/index.d.ts +0 -9
  213. package/src/definitions/shared/lib/types/index.d.ts +0 -3
  214. package/src/definitions/{shared/lib → model/definitions}/schemas/app-filter-bar.schema.d.ts +0 -0
  215. package/src/definitions/{shared/lib → model/definitions}/schemas/bar.schema.d.ts +0 -0
  216. package/src/definitions/{shared/lib → model/definitions}/schemas/filter.schema.d.ts +0 -0
  217. package/src/definitions/{shared/lib → model/definitions}/schemas/line.schema.d.ts +0 -0
  218. package/src/definitions/{shared/lib → model/definitions}/schemas/number.schema.d.ts +0 -0
  219. package/src/definitions/{shared/lib → model/definitions}/schemas/table.schema.d.ts +4 -4
  220. /package/src/definitions/{shared/lib → model/definitions}/types/descriptor.types.d.ts +0 -0
@@ -1,41 +1,45 @@
1
1
  import { o as e } from "./rolldown-runtime-DleVn1XH.js";
2
- import { No as t, Oa as n, Ta as r, Ti as i, Wc as a, Xs as o, Yn as s, lo as c, pc as l, qs as u, so as d, ta as f, ti as p } from "./interfaces-VUY4_yVO.js";
3
- import { I as m, Ki as h, P as g, Zt as _, o as v, wi as y } from "./utils-Ba9T0TqC.js";
4
- import { It as b, Jt as x, Lt as S, Vt as C, X as w, Z as T, bt as E, cn as D, en as ee, i as O, in as k, j as te, ln as A, n as ne, nn as j, rn as M, rt as re, sn as N, tn as ie, un as P, xt as ae } from "./escobar-BGqT1EsE.js";
5
- import { l as F, vt as I } from "./_baseFlatten-DPXPOrea.js";
6
- import { a as oe, r as se, t as ce } from "./coloring-C16AUZEi.js";
7
- import { f as le, r as L, t as ue, u as de } from "./src-D9XogOrc.js";
8
- var fe = /* @__PURE__ */ e(h()), R = /* @__PURE__ */ function(e) {
2
+ import { Ca as t, Ds as n, Hi as r, Ta as i, Us as a, Xa as o, _c as s, hi as c, hn as l, mr as u, ws as d, zi as f, zr as p } from "./visualization-filters-Cc4KU-l-.js";
3
+ import { Ei as m, F as h, N as g, Xt as _, o as v, ri as y } from "./utils-vdmi_2PK.js";
4
+ import "./logger-DpQtYQnX.js";
5
+ import { F as b, Ht as x, Kt as S, Tt as C, Vt as w, _n as T, dn as E, et as D, fn as O, gn as k, hn as A, i as ee, in as te, ln as j, n as ne, nn as re, st as ie, tn as ae, tt as oe, un as M, vn as N, wt as se } from "./escobar-DRhRMYRE.js";
6
+ import { _ as P } from "./MenuOption-ByRqhRdX.js";
7
+ import { a as ce, r as le, t as ue } from "./coloring-CncX_JRX.js";
8
+ import { f as F, r as I, t as de, u as fe } from "./src-D9XogOrc.js";
9
+ var pe = /* @__PURE__ */ e(m()), L = /* @__PURE__ */ function(e) {
9
10
  return e.sankey = "key-sankey", e.labels = "key-labels", e.columnLabels = "key-column-labels", e;
10
- }({}), z = /* @__PURE__ */ function(e) {
11
+ }({}), R = /* @__PURE__ */ function(e) {
11
12
  return e.NodeFlow = "flow", e.NodeColor = "color", e;
12
- }({}), B = /* @__PURE__ */ function(e) {
13
+ }({}), z = /* @__PURE__ */ function(e) {
13
14
  return e.ColumnTitleLeft = "columnTitleLeft", e.ColumnTitleCenter = "columnTitleCenter", e.ColumnTitleRight = "columnTitleRight", e.NodeLabelLeft = "nodeLabelLeft", e.NodeLabelCenter = "nodeLabelCenter", e.NodeLabelRight = "nodeLabelRight", e;
14
- }({}), pe = class extends ce {
15
+ }({}), me = class extends ue {
15
16
  dimensionIds = [];
16
17
  dimensionColoring = {};
17
18
  constructor(e, t, n) {
18
- super(e, t, n), this.dimensionIds = [], this.vSpec.dimensions.filter((e) => i(e)).forEach((e) => {
19
- let t = l(e.dataItem);
19
+ super(e, t, n), this.dimensionIds = [], this.vSpec.dimensions.filter((e) => p(e)).forEach((e) => {
20
+ let t = a(e.dataItem);
20
21
  this.dimensionColoring[t] = e.coloring, this.dimensionIds.push(t);
21
22
  });
22
23
  }
23
24
  getColorByScale(e, t = {}) {
24
- let { ref: n } = t, r = this.getDatumFromProp(e, n, "color"), i = r?.value, a = e.resources.scale(r.source?.field ?? r.label), s = r.source.field && this.dimensionColoring[r.source.field];
25
- if (s?.type === o.Categorical && s.persistentColors === !0) {
26
- let e = a.range();
27
- return e[this.getHash(i) % e.length];
25
+ let { ref: r } = t, i = this.getDatumFromProp(e, r, "color"), a = i?.value, o = e.resources.scale(i.source?.field ?? i.label), s = i.source?.field, c = s ? this.dimensionColoring[s] : void 0;
26
+ if (c?.type === n.Categorical && c.persistentColors === !0) {
27
+ let e = o.range();
28
+ return e[this.getHash(a) % e.length];
28
29
  }
29
- return a(i);
30
+ return o(a);
30
31
  }
31
32
  getDatumFromProp(e, t, n) {
32
33
  return t === this.MAIN_FIELD ? e.datum : e.datum[t || n];
33
34
  }
34
35
  getLinkOverwrite(e) {
35
- let t = this.vSpec.coloring?.overwrites;
36
+ let t = this.vSpec.coloring?.overwrites ?? [];
36
37
  for (let n = 0; n < t.length; n++) {
37
38
  let r = t[n], i = e.datum, a = r.operator || "equals";
38
- if ([i, ...Object.keys(i).filter((e) => this.dimensionIds.includes(i[e]?.source?.field)).map((e) => i[e])].find((e) => e.source.field === r?.dataItemId ? a === "equals" ? r.value === e.value || r.value === String(e.value) : se(r, e.value) : !1)) return r.color;
39
+ if ([i, ...Object.keys(i).filter((e) => {
40
+ let t = i[e]?.source?.field;
41
+ return t !== void 0 && this.dimensionIds.includes(t);
42
+ }).map((e) => i[e])].find((e) => e.source?.field === r?.dataItemId ? a === "equals" ? r.value === e.value || r.value === String(e.value) : le(r, e.value) : !1)) return r.color;
39
43
  }
40
44
  }
41
45
  getFilteredColor() {
@@ -44,7 +48,7 @@ var fe = /* @__PURE__ */ e(h()), R = /* @__PURE__ */ function(e) {
44
48
  getLinkColorDefinition() {
45
49
  return (e) => {
46
50
  if (this.notAffectedItems?.pattern?.length && this.vSpec.staticFilters.ignoreGlobalFilters && this.vSpec.staticFilters.showGlobalFiltersEffect) {
47
- let t = oe(e, this.notAffectedItems);
51
+ let t = ce(e, this.notAffectedItems);
48
52
  if (t) return t;
49
53
  }
50
54
  if (this.isColorOverwriteActive()) {
@@ -57,83 +61,86 @@ var fe = /* @__PURE__ */ e(h()), R = /* @__PURE__ */ function(e) {
57
61
  }
58
62
  };
59
63
  }
60
- }, me = (e, t) => e.data.value === t.data.value ? 0 : e.data.value < t.data.value ? 1 : -1, he = (e, t) => e.data.value === t.data.value ? 0 : e.data.value < t.data.value ? -1 : 1, ge = (e, t) => e.data.flow.value === t.data.flow.value ? 0 : e.data.flow.value < t.data.flow.value ? 1 : -1, _e = (e, t) => e.data.flow.value === t.data.flow.value ? 0 : e.data.flow.value < t.data.flow.value ? -1 : 1;
61
- function ve(e, t) {
62
- let n = e.dimensions.filter((e) => i(e)), r = (e.querySettings?.sortingOrder ?? []).map((e) => ({
63
- id: l(e.dataItem),
64
+ }, he = (e, t) => e.data.value === t.data.value ? 0 : e.data.value < t.data.value ? 1 : -1, ge = (e, t) => e.data.value === t.data.value ? 0 : e.data.value < t.data.value ? -1 : 1, _e = (e, t) => e.data.flow.value === t.data.flow.value ? 0 : e.data.flow.value < t.data.flow.value ? 1 : -1, ve = (e, t) => e.data.flow.value === t.data.flow.value ? 0 : e.data.flow.value < t.data.flow.value ? -1 : 1;
65
+ function ye(e, t) {
66
+ let n = e.dimensions.filter((e) => p(e)), r = (e.querySettings?.sortingOrder ?? []).map((e) => ({
67
+ id: a(e.dataItem),
64
68
  direction: e.sortDirection,
65
69
  type: e.fieldType
66
- })), a = r.find((e) => e.type === "measure"), o = r.indexOf(a);
70
+ })), i = r.find((e) => e.type === "measure"), o = i ? r.indexOf(i) : -1;
67
71
  return n.map((n) => {
68
- let i = l(n.dataItem), s;
72
+ let s = a(n.dataItem), c;
69
73
  if (e.sankeySettings.applyDataSortOnNodeColumns) {
70
- let e = r.find((e) => e.id === i), t = r.indexOf(e);
71
- e && t < o ? s = e.direction === "desc" ? me : he : a && (s = a.direction === "desc" ? ge : _e);
74
+ let e = r.find((e) => e.id === s), t = e ? r.indexOf(e) : -1;
75
+ e && t < o ? c = e.direction === "desc" ? he : ge : i && (c = i.direction === "desc" ? _e : ve);
72
76
  }
73
77
  return {
74
- id: i,
75
- sort: s,
76
- isGrouped: p(e.dimensions, e.enableAlternate, t)
78
+ id: s,
79
+ sort: c,
80
+ isGrouped: u(e.dimensions, e.enableAlternate, t)
77
81
  };
78
82
  });
79
83
  }
80
- var ye = (e, t) => {
81
- let r = e.sankeySettings.linkColoring?.opacity ?? .3, i = t.valuePickerMode ?? !1, a = i ? t.valuePickerTargetDataItemId : "";
84
+ var be = (e, t) => {
85
+ let n = e.sankeySettings.linkColoring?.opacity ?? .3, i = t.valuePickerMode ?? !1, a = i ? t.valuePickerTargetDataItemId : "";
82
86
  return {
83
87
  trigger: [{
84
- on: D.Tap,
85
- action: N.Toggle,
88
+ on: k.Tap,
89
+ action: A.Toggle,
86
90
  globalPropagation: "stop",
87
91
  data: ["", "linkTarget"],
88
- contexts: [M.Selection]
92
+ contexts: [E.Selection]
89
93
  }, {
90
- on: D.Over,
91
- action: N.Set,
94
+ on: k.Over,
95
+ action: A.Set,
92
96
  globalPropagation: "stop",
93
97
  data: ["", "linkTarget"],
94
- contexts: [M.Highlight]
98
+ contexts: [E.Highlight]
95
99
  }],
96
100
  consume: [
97
101
  {
98
- context: M.Selection,
102
+ context: E.Selection,
99
103
  data: ["", "linkTarget"],
100
104
  filter: (e) => e.data?.type?.value === "link",
101
- mode: A.Or,
102
- style: { inactive: { opacity: r * .25 } }
105
+ mode: T.Or,
106
+ style: { inactive: { opacity: n * .25 } }
103
107
  },
104
108
  {
105
- context: M.Selection,
109
+ context: E.Selection,
106
110
  data: [""],
107
111
  filter: (e) => e.data?.type?.value === "node",
108
- mode: A.Or,
112
+ mode: T.Or,
109
113
  style: { inactive: { fill: (e) => {
110
- let t = !e.fill || e.fill === "none" || e.fill === "transparent";
114
+ let t = e, n = !t.fill || t.fill === "none" || t.fill === "transparent";
111
115
  switch (!0) {
112
- case t:
113
- case i && e.data.source.field === a: return e.fill;
114
- default: return ee(ie(e.fill), .25);
116
+ case n:
117
+ case i && t.data.source.field === a: return t.fill;
118
+ default: return ae(re(t.fill), .25);
115
119
  }
116
120
  } } }
117
121
  },
118
122
  {
119
- context: M.Highlight,
123
+ context: E.Highlight,
120
124
  data: [""],
121
125
  filter: (e) => e.data?.type?.value === "node",
122
- mode: A.Or,
126
+ mode: T.Or,
123
127
  style: { active: {
124
128
  strokeWidth: (e) => i && e.data.source.field !== a ? 0 : 1,
125
- stroke: n.mainDarkNavy
129
+ stroke: r.mainDarkNavy
126
130
  } }
127
131
  }
128
132
  ]
129
133
  };
130
- }, be = (e, t, n, r, a, o) => {
131
- let s = e.dimensions.filter((e) => i(e)), c = new pe(e, t, a?.[0]?.itemsNotAffectedByFiltering), u = e.sankeySettings.linkColoring?.opacity ?? .3, d = e.sankeySettings.linkColoring, f = s.map((e) => l(e.dataItem)), p = f.map((e, t) => `dim${t}`), m = e.sankeySettings.showNullNodes ? (e, t) => p[f.indexOf(t) + 1] : (e, t) => {
132
- let n = f.indexOf(t), r = f.slice(n + 1).find((t) => e[p[f.indexOf(t)]].value !== null);
133
- return p[f.indexOf(r)];
134
- }, h = {
135
- key: R.sankey,
136
- type: P.Sankey,
134
+ }, xe = (e, t, n, r, i, o) => {
135
+ if (!o) throw Error("Missing Sankey visualization properties");
136
+ let s = e.sankeySettings.nodeLabels.placements;
137
+ if (!s) throw Error("Missing Sankey node label placements");
138
+ let c = e.dimensions.filter((e) => p(e)), l = new me(e, t, i?.[0]?.itemsNotAffectedByFiltering), u = e.sankeySettings.linkColoring?.opacity ?? .3, d = e.sankeySettings.linkColoring, f = c.map((e) => a(e.dataItem)), m = f.map((e, t) => `dim${t}`), h = e.sankeySettings.showNullNodes ? (e, t) => m[f.indexOf(t) + 1] : (e, t) => {
139
+ let n = f.indexOf(t), r = f.slice(n + 1).find((t) => e[m[f.indexOf(t)]].value !== null), i = r === void 0 ? -1 : f.indexOf(r);
140
+ return m[i];
141
+ }, g = {
142
+ key: L.sankey,
143
+ type: N.Sankey,
137
144
  data: { collection: "coll" },
138
145
  settings: {
139
146
  showNullNodes: e.sankeySettings.showNullNodes,
@@ -147,28 +154,37 @@ var ye = (e, t) => {
147
154
  showNodeFlowLabel: e.sankeySettings.nodeLabels.enabled && e.sankeySettings.nodeLabels.showFlowValue,
148
155
  showNodeLabelBackdrop: e.sankeySettings.nodeLabels.showBackdrop !== !1,
149
156
  nodeLabelBackdropColor: e.sankeySettings.nodeLabels.backdropColor,
150
- columnFields: ve(e, o.isPrintMode),
151
- nodeLabelPlacements: e.sankeySettings.nodeLabels.placements.filter((e) => e.enabled).map((e) => e.placement),
157
+ columnFields: ye(e, o.isPrintMode ?? !1),
158
+ nodeLabelPlacements: s.filter((e) => e.enabled).map((e) => e.placement),
152
159
  node: {
153
- id: (e) => `${e.datum.source.field}::${e.datum.value}`,
154
- fill: c.getColorDefinition({
155
- ref: z.NodeColor,
156
- overwriteSources: [c.MAIN_FIELD, "color"]
160
+ id: (e) => {
161
+ let t = e.datum;
162
+ return `${t.source.field}::${t.value}`;
163
+ },
164
+ fill: l.getColorDefinition({
165
+ ref: R.NodeColor,
166
+ overwriteSources: [l.MAIN_FIELD, "color"]
157
167
  })
158
168
  },
159
169
  link: {
160
- linkSource: (e) => `${e.datum.source.field}::${e.datum.value}`,
170
+ linkSource: (e) => {
171
+ let t = e.datum;
172
+ return `${t.source.field}::${t.value}`;
173
+ },
161
174
  linkTarget: (e) => {
162
- let t = m(e.datum, e.datum.source.field);
163
- return t ? (e.datum.linkTarget = e.datum[t], `${e.datum[t].source.field}::${e.datum[t].value}`) : null;
175
+ let t = e.datum, n = h(t, t.source.field);
176
+ if (!n) return null;
177
+ t.linkTarget = t[n];
178
+ let r = t[n];
179
+ return `${r.source.field}::${r.value}`;
164
180
  },
165
181
  value: { ref: "flow" },
166
- dataFill: c.getLinkColorDefinition(),
182
+ dataFill: l.getLinkColorDefinition(),
167
183
  fill: () => d.override ? d.color || t.colors.brandColors[0] : void 0,
168
184
  opacity: u
169
185
  }
170
186
  },
171
- brush: o.disable?.brushing === !0 ? void 0 : ye(e, o),
187
+ brush: o.disable?.brushing === !0 ? void 0 : be(e, o),
172
188
  animations: {
173
189
  presetId: "simple-opacity",
174
190
  enabled: !0
@@ -176,15 +192,15 @@ var ye = (e, t) => {
176
192
  };
177
193
  return {
178
194
  ...n,
179
- components: [...n.components, h]
195
+ components: [...n.components, g]
180
196
  };
181
- }, xe = (e, t, n) => {
182
- let r = e.measures.filter((e) => i(e)), a = e.dimensions.filter((e) => i(e)), o = l(r[0].dataItem), s = a.map((e) => l(e.dataItem)), c = s.map((e) => ({
197
+ }, Se = (e, t, n) => {
198
+ let r = e.measures.filter((e) => p(e)), i = e.dimensions.filter((e) => p(e)), o = a(r[0].dataItem), s = i.map((e) => a(e.dataItem)), c = s.map((e) => ({
183
199
  field: e,
184
200
  trackBy: (e) => e,
185
201
  reduce: "first",
186
202
  props: {
187
- [z.NodeFlow]: {
203
+ [R.NodeFlow]: {
188
204
  field: o,
189
205
  reduce: "sum"
190
206
  },
@@ -192,10 +208,10 @@ var ye = (e, t) => {
192
208
  field: o,
193
209
  reduce: "sum"
194
210
  },
195
- [z.NodeColor]: { field: e },
211
+ [R.NodeColor]: { field: e },
196
212
  type: "node"
197
213
  }
198
- })), u = s.slice(0, s.length - 1).map((e, t) => {
214
+ })), l = s.slice(0, s.length - 1).map((e, t) => {
199
215
  let n = {
200
216
  field: s[t],
201
217
  props: {
@@ -207,23 +223,23 @@ var ye = (e, t) => {
207
223
  return s.forEach((e, t) => {
208
224
  n.field !== e && (n.props[`dim${t}`] = { field: e });
209
225
  }), n;
210
- }), d = [{
226
+ }), u = [{
211
227
  key: "coll",
212
228
  data: {
213
- extract: [...c, ...u],
229
+ extract: [...c, ...l],
214
230
  filter: e.sankeySettings.showNullNodes ? void 0 : (e) => e.value !== null
215
231
  }
216
232
  }];
217
233
  return {
218
234
  ...n,
219
- collections: d,
235
+ collections: u,
220
236
  formatters: { flow: {
221
237
  type: "excel-format",
222
238
  format: r[0].formatter?.format
223
239
  } }
224
240
  };
225
- }, V = (e, t) => ({
226
- component: R.sankey,
241
+ }, B = (e, t) => ({
242
+ component: L.sankey,
227
243
  selector: e,
228
244
  strategy: {
229
245
  type: "rows",
@@ -231,18 +247,20 @@ var ye = (e, t) => {
231
247
  justify: .5,
232
248
  align: t,
233
249
  labels: [{
234
- linkData: ({ node: e }) => e.desc.field,
250
+ linkData({ node: e }) {
251
+ return e.desc.field;
252
+ },
235
253
  label({ node: e }) {
236
- let t = e.desc.label;
237
- return e.desc?.isGrouped ? C(t) : t;
254
+ let t = e.desc, n = t.label;
255
+ return t.isGrouped ? S(n) : n;
238
256
  }
239
257
  }]
240
258
  }
241
259
  }
242
- }), H = 64, Se = new F(I.fontLight), Ce = new F(I.fontDark), U = (e, t, n) => {
243
- let r = new F(n.fonts.general.color);
260
+ }), V = 64, Ce = new P(j.fontLight), we = new P(j.fontDark), H = (e, t, n) => {
261
+ let r = new P(n.fonts.general.color);
244
262
  return {
245
- component: R.sankey,
263
+ component: L.sankey,
246
264
  selector: e,
247
265
  strategy: {
248
266
  type: "rows",
@@ -257,75 +275,85 @@ var ye = (e, t) => {
257
275
  return e.desc?.backdrop;
258
276
  },
259
277
  fill({ node: e }) {
260
- return !e.desc.backdrop && !e.desc.background ? r.rgb() : new F(e.desc?.backdrop?.fill || e.desc.background).betterContrast(r, Se, Ce).rgb();
278
+ let t = e.desc;
279
+ if (!t.backdrop && !t.background) return r.rgb();
280
+ let n = t.backdrop?.fill || t.background;
281
+ if (n === void 0) throw Error("Color: Unknown color parameter");
282
+ return new P(n).betterContrast(r, Ce, we).rgb();
261
283
  },
262
284
  linkData({ node: e }) {
263
285
  return e.desc?.data;
264
286
  },
265
287
  label({ node: e, formatter: t }) {
266
- let n = e.desc.showFlow ? t("flow")(e.desc?.data?.[z.NodeFlow]?.value) : void 0, r = e.desc?.label?.length > H - 1 ? `${e.desc?.label?.substring(0, H - 1).replace(/\s+$/, "")}…` : e.desc?.label;
267
- return [e.desc.showDimension ? r : void 0, n].filter(Boolean).join(": ");
288
+ let n = e.desc, r = n.showFlow ? t("flow")(n.data?.[R.NodeFlow]?.value) : void 0, i = n.label?.length > V - 1 ? `${n.label?.substring(0, V - 1).replace(/\s+$/, "")}…` : n.label;
289
+ return [n.showDimension ? i : void 0, r].filter(Boolean).join(": ");
268
290
  }
269
291
  }]
270
292
  }
271
293
  }
272
294
  };
273
- }, we = (e, n, r, o, c, u, d, f) => {
295
+ }, Te = (e, t, n, r, i, c, d, f) => {
296
+ if (!c) throw Error("Missing Sankey visualization properties");
274
297
  let m = [];
275
- f && m.push(S(R.columnLabels, R.columnLabels, f));
298
+ f && m.push(x(L.columnLabels, L.columnLabels, f));
276
299
  let h = {
277
- type: P.Labels,
278
- key: R.columnLabels,
300
+ type: N.Labels,
301
+ key: L.columnLabels,
279
302
  layout: { displayOrder: 2 },
280
303
  settings: { sources: [
281
- V(`.${B.ColumnTitleLeft}`, 0),
282
- V(`.${B.ColumnTitleCenter}`, .5),
283
- V(`.${B.ColumnTitleRight}`, 1)
304
+ B(`.${z.ColumnTitleLeft}`, 0),
305
+ B(`.${z.ColumnTitleCenter}`, .5),
306
+ B(`.${z.ColumnTitleRight}`, 1)
284
307
  ] },
285
308
  style: { label: "$title" },
286
309
  animations: {
287
310
  presetId: "simple-opacity",
288
311
  enabled: !0
289
312
  }
290
- }, g = e?.measures.find(i), _ = g ? l(g.dataItem) : void 0, v = g && (s(g) || g.label || g.dataItem?.name || "Measure");
291
- f && g && e.measures.length > 1 && m.push(b(P.Text, f));
292
- let y = g && e.measures.length > 1 ? {
293
- type: P.Text,
294
- key: `text-${_}`,
295
- dataItemType: a.Measure,
296
- dataItemRole: g.role,
297
- text: p(e.measures, e.enableAlternate, u.isPrintMode) ? C(v) : v,
298
- layout: {
299
- dock: t.Bottom,
300
- color: "red"
301
- },
302
- style: { text: {
303
- fontFamily: n.fonts.general.fontFamily,
304
- fontSize: `${I.fieldTitle.fontSize}px`,
305
- fontStyle: "normal",
306
- fill: n.fonts.general.color
307
- } },
308
- anchor: t.Center
309
- } : void 0, x = {
310
- type: P.Labels,
311
- key: R.labels,
313
+ }, g = e?.measures.find(p), _ = g ? a(g.dataItem) : void 0;
314
+ f && g && e.measures.length > 1 && m.push(w(N.Text, f));
315
+ let v;
316
+ if (g && e.measures.length > 1) {
317
+ let n = l(g) || g.label || g.dataItem?.name || "Measure";
318
+ v = {
319
+ type: N.Text,
320
+ key: `text-${_}`,
321
+ dataItemType: s.Measure,
322
+ dataItemRole: g.role,
323
+ text: u(e.measures, e.enableAlternate, c.isPrintMode) ? S(n) : n,
324
+ layout: {
325
+ dock: o.Bottom,
326
+ color: "red"
327
+ },
328
+ style: { text: {
329
+ fontFamily: t.fonts.general.fontFamily,
330
+ fontSize: `${j.fieldTitle.fontSize}px`,
331
+ fontStyle: "normal",
332
+ fill: t.fonts.general.color
333
+ } },
334
+ anchor: o.Center
335
+ };
336
+ }
337
+ let y = {
338
+ type: N.Labels,
339
+ key: L.labels,
312
340
  layout: { displayOrder: 2 },
313
341
  settings: { sources: [
314
- U(`.${B.NodeLabelLeft}`, 0, n),
315
- U(`.${B.NodeLabelCenter}`, .5, n),
316
- U(`.${B.NodeLabelRight}`, 1, n)
342
+ H(`.${z.NodeLabelLeft}`, 0, t),
343
+ H(`.${z.NodeLabelCenter}`, .5, t),
344
+ H(`.${z.NodeLabelRight}`, 1, t)
317
345
  ] },
318
346
  style: { label: "$label" },
319
- brush: u.disable?.brushing === !0 ? void 0 : {
347
+ brush: c.disable?.brushing === !0 ? void 0 : {
320
348
  trigger: [{
321
- on: D.Tap,
322
- action: N.Toggle,
349
+ on: k.Tap,
350
+ action: A.Toggle,
323
351
  globalPropagation: "stop",
324
352
  data: [""],
325
- contexts: [M.Selection]
353
+ contexts: [E.Selection]
326
354
  }],
327
355
  consume: [{
328
- context: M.Selection,
356
+ context: E.Selection,
329
357
  data: [""],
330
358
  style: { inactive: { opacity: .3 } }
331
359
  }]
@@ -336,60 +364,62 @@ var ye = (e, t) => {
336
364
  }
337
365
  };
338
366
  return {
339
- ...r,
367
+ ...n,
340
368
  components: [
341
- ...r.components,
369
+ ...n.components,
342
370
  h,
343
- ...y ? [y] : [],
344
- x
371
+ ...v ? [v] : [],
372
+ y
345
373
  ],
346
- interactions: r.interactions ? [...r.interactions, ...m] : [...m]
374
+ interactions: n.interactions ? [...n.interactions, ...m] : [...m]
347
375
  };
348
- }, Te = (e, t, n, r, i) => {
349
- if (n.type !== o.PerEachDimension) {
350
- let e = n.color || t?.colors?.brandColors?.[0] || "#aaa";
376
+ }, Ee = (e, t, r, i, o) => {
377
+ if (r.type !== n.PerEachDimension) {
378
+ let e = r.color || t?.colors?.brandColors?.[0] || "#aaa";
351
379
  return {
352
- type: k.CategoricalColor,
380
+ type: O.CategoricalColor,
353
381
  data: [],
354
382
  range: [e],
355
383
  unknown: e
356
384
  };
357
385
  }
358
- let a = r.coloring || {};
359
- if (a.type !== o.Categorical) {
360
- let n = i[e.dimensions.indexOf(r) % i.length], o = a.color || n || t?.colors?.brandColors?.[0] || "#aaa";
386
+ let s = i.coloring || {};
387
+ if (s.type !== n.Categorical) {
388
+ let n = o[e.dimensions.indexOf(i) % o.length], r = s.color || n || t?.colors?.brandColors?.[0] || "#aaa";
361
389
  return {
362
- type: k.CategoricalColor,
390
+ type: O.CategoricalColor,
363
391
  data: [],
364
- range: [o],
365
- unknown: o
392
+ range: [r],
393
+ unknown: r
366
394
  };
367
395
  }
368
- return ae(e, t, l(r.dataItem), {
369
- customPalette: a.customPalette ?? f.customPalette,
370
- palette: a.palette
396
+ return C(e, t, a(i.dataItem), {
397
+ customPalette: s.customPalette ?? c.customPalette,
398
+ palette: s.palette
371
399
  });
372
- }, Ee = (e, t, n) => {
373
- let r = e.dimensions.filter((e) => i(e));
400
+ }, De = (e, t, n) => {
401
+ let r = e.dimensions.filter((e) => p(e));
374
402
  if (!r[0]) return n;
375
- let a = {}, o = E({
376
- palette: e.coloring.palette,
377
- customPalette: e.coloring.customPalette ?? f.customPalette
403
+ let i = e.coloring;
404
+ if (!i) throw Error("Missing Sankey coloring settings");
405
+ let o = {}, s = se({
406
+ palette: i.palette,
407
+ customPalette: i.customPalette ?? c.customPalette
378
408
  }, t);
379
409
  return r.forEach((n) => {
380
- let r = l(n.dataItem);
381
- a[r] = Te(e, t, e.coloring, n, o);
410
+ let r = a(n.dataItem);
411
+ o[r] = Ee(e, t, i, n, s);
382
412
  }), {
383
413
  ...n,
384
- scales: a
414
+ scales: o
385
415
  };
386
- }, De = (e, t, n) => {
387
- let r = e.dimensions.filter((e) => i(e)), a = e.measures.filter((e) => i(e));
388
- if (!r[0] || !a[0]) return n;
389
- let o = {
416
+ }, Oe = (e, t, n) => {
417
+ let r = e.dimensions.filter((e) => p(e)), i = e.measures.filter((e) => p(e));
418
+ if (!r[0] || !i[0]) return n;
419
+ let a = {
390
420
  "$font-family": t.fonts.general.fontFamily,
391
421
  "$font-color": t.fonts.general.color,
392
- "$font-size": `${x(e.sankeySettings?.nodeLabels?.fontSize)}px`,
422
+ "$font-size": `${te(e.sankeySettings?.nodeLabels?.fontSize)}px`,
393
423
  $label: {
394
424
  fontSize: "$font-size",
395
425
  fontFamily: "$font-family",
@@ -398,41 +428,41 @@ var ye = (e, t) => {
398
428
  },
399
429
  $title: {
400
430
  "@extend": "$label",
401
- fontSize: `${I.fieldTitle.fontSize}px`,
431
+ fontSize: `${j.fieldTitle.fontSize}px`,
402
432
  padding: 4
403
433
  }
404
434
  };
405
435
  return {
406
436
  ...n,
407
- style: o
437
+ style: a
408
438
  };
409
- }, Oe = (e, t) => t?.data?.type?.value === "link" ? `${t.data.label} - ${t.data.linkTarget.label}` : t.data.label, ke = (e, t, n, r, i, a, o) => {
410
- let c = [], l = s(e[0]) || e[0].label || e[0].dataItem.name || "", u = e.length ? l : "Count", d = t.desc?.flow ?? t.data?.flow.value;
411
- return d = o ? n.formatter(re())(d) : n.formatter("flow")(d), c.push({
439
+ }, ke = (e, t) => t?.data?.type?.value === "link" ? `${t.data.label} - ${t.data.linkTarget.label}` : t.data.label, Ae = (e, t, n, r, i, a, o) => {
440
+ let s = [], c = l(e[0]) || e[0].label || e[0].dataItem.name || "", u = e.length ? c : "Count", d = t.desc?.flow ?? t.data?.flow.value, f = o ? n.formatter(ie())(d) : n.formatter("flow")(d);
441
+ return s.push({
412
442
  label: u,
413
- value: d
414
- }), c;
415
- }, Ae = (e, t, n, r, i) => {
443
+ value: f
444
+ }), s;
445
+ }, je = (e, t, n, r, i) => {
416
446
  let a = { placement: ({ nodes: e }) => ({
417
447
  area: "target",
418
448
  type: e[0]?.data?.type?.value === "link" ? "pointer" : "bounds"
419
449
  }) };
420
- return a.extract = T(e, t, ke, Oe), w(e, t, n, a, "tooltip", i);
421
- }, je = class extends te {
450
+ return a.extract = oe(e, t, Ae, ke), D(e, t, n, a, "tooltip", i);
451
+ }, Me = class extends b {
422
452
  constructor() {
423
453
  super([
424
- xe,
425
- Ee,
426
- be,
427
- we,
454
+ Se,
428
455
  De,
429
- Ae
456
+ xe,
457
+ Te,
458
+ Oe,
459
+ je
430
460
  ]);
431
461
  }
432
462
  preCompile(e, t) {
433
- let n = e.measures.filter((e) => i(e)), r = e.dimensions.filter((e) => i(e)), a = n[0];
434
- if (!a) return;
435
- let o = l(a.dataItem), s = r.map((e) => l(e.dataItem));
463
+ let n = e.measures.filter((e) => p(e)), r = e.dimensions.filter((e) => p(e)), i = n[0];
464
+ if (!i) return;
465
+ let o = a(i.dataItem), s = r.map((e) => a(e.dataItem));
436
466
  t.forEach((t) => {
437
467
  if (t.items?.length) {
438
468
  if (t.items = t.items.filter((e) => e[o] > 0), !t.items.length) throw Error("Current data query resulted in only negative and/or null values which can not be displayed in this chart.");
@@ -440,20 +470,20 @@ var ye = (e, t) => {
440
470
  }
441
471
  });
442
472
  }
443
- }, W = {
473
+ }, U = {
444
474
  showNullNodes: !1,
445
475
  nodePadding: .2,
446
476
  nodeWidth: .2,
447
477
  linkMargin: 0,
448
478
  showColumnHeaderLabels: !1,
449
- linkFillStrategy: d.Interpolated,
479
+ linkFillStrategy: t.Interpolated,
450
480
  nodeFillOverride: null,
451
481
  showNodeFlowLabel: !0,
452
482
  showNodeDimensionLabel: !0,
453
483
  showNodeLabelBackdrop: !0,
454
484
  nodeLabelBackdropColor: null,
455
485
  columnFields: [],
456
- nodeLabelPlacements: [c.Beside],
486
+ nodeLabelPlacements: [i.Beside],
457
487
  node: {
458
488
  id: "",
459
489
  fill: "#333333"
@@ -465,10 +495,10 @@ var ye = (e, t) => {
465
495
  value: 1
466
496
  }
467
497
  };
468
- function G(e, t) {
469
- return e.dataFill === t.dataFill ? 0 : e.dataFill < t.dataFill ? -1 : 1;
498
+ function W(e, t) {
499
+ return e.dataFill === t.dataFill ? 0 : e.dataFill !== void 0 && t.dataFill !== void 0 && e.dataFill < t.dataFill ? -1 : 1;
470
500
  }
471
- function Me(e) {
501
+ function Ne(e) {
472
502
  let t = e.target.x0 - e.source.x1, n = e.y0 - e.y1, r = Math.abs(n) < .1 ? 0 : .5;
473
503
  return [
474
504
  `M${e.source.x1},${e.y0}`,
@@ -477,12 +507,12 @@ function Me(e) {
477
507
  `${e.target.x0},${e.y1}`
478
508
  ].join(" ");
479
509
  }
480
- function Ne(e) {
510
+ function Pe(e) {
481
511
  return e.map((e) => ({
482
- type: j.Path,
512
+ type: M.Path,
483
513
  data: e.data,
484
514
  desc: { flow: e.value },
485
- d: Me(e),
515
+ d: Ne(e),
486
516
  fill: "none",
487
517
  strokeWidth: Math.max(.5, e.width),
488
518
  stroke: e.fill,
@@ -492,45 +522,45 @@ function Ne(e) {
492
522
  collider: { visual: !0 }
493
523
  }));
494
524
  }
495
- function Pe(e) {
496
- let { data: t, resolver: n, settings: r, resolvedNodes: i } = e, a = {};
497
- i.forEach((e) => {
498
- a[e.id] = e;
525
+ function Fe(e) {
526
+ let { data: n, resolver: r, settings: i, resolvedNodes: a } = e, o = {};
527
+ a.forEach((e) => {
528
+ o[e.id] = e;
499
529
  });
500
- let o = t.items.filter((e) => e.type.value === "link"), { items: s } = n.resolve({
501
- data: { items: o },
502
- defaults: { ...W.link },
503
- settings: r.link
504
- }), c = {};
505
- return s.filter((e) => !!e.linkTarget).forEach((e) => {
506
- let t = a[e.linkSource], n = a[e.linkTarget], i;
507
- if (!e.fill && !e.dataFill) switch (r.linkFillStrategy) {
508
- case d.Source:
509
- e.fill = t.fill;
510
- break;
511
- case d.Target:
530
+ let s = n.items.filter((e) => e.type.value === "link"), { items: c } = r.resolve({
531
+ data: { items: s },
532
+ defaults: { ...U.link },
533
+ settings: i.link
534
+ }), l = {};
535
+ return c.filter((e) => !!e.linkTarget).forEach((e) => {
536
+ let n = o[e.linkSource], r = o[e.linkTarget], a;
537
+ if (!e.fill && !e.dataFill) switch (i.linkFillStrategy) {
538
+ case t.Source:
512
539
  e.fill = n.fill;
513
540
  break;
514
- case d.Interpolated:
541
+ case t.Target:
542
+ e.fill = r.fill;
543
+ break;
544
+ case t.Interpolated:
515
545
  e.fill = {
516
546
  type: "gradient",
517
547
  orientation: "linear",
518
548
  degree: -180,
519
549
  stops: [{
520
- color: t.fill,
550
+ color: n.fill,
521
551
  offset: 0
522
552
  }, {
523
- color: n.fill,
553
+ color: r.fill,
524
554
  offset: 1
525
555
  }]
526
- }, i = `${t.fill}::${n.fill}`;
556
+ }, a = `${n.fill}::${r.fill}`;
527
557
  break;
528
558
  }
529
559
  else e.dataFill && (e.fill = e.dataFill);
530
- i ||= e.fill, e.fillId = i;
531
- let o = `${e.linkSource}::${e.linkTarget}`;
532
- c[o] && c[o].fillId !== e.fillId && (o += `::${e.fillId}`), c[o] ? c[o].value += e.value : (c[o] = e, e.id = o);
533
- }), Object.values(c).map((e) => ({
560
+ a ||= e.fill, e.fillId = a;
561
+ let s = `${e.linkSource}::${e.linkTarget}`;
562
+ l[s] && l[s].fillId !== e.fillId && (s += `::${e.fillId}`), l[s] ? l[s].value += e.value : (l[s] = e, e.id = s);
563
+ }), Object.values(l).map((e) => ({
534
564
  source: e.linkSource,
535
565
  target: e.linkTarget,
536
566
  id: e.id,
@@ -541,10 +571,10 @@ function Pe(e) {
541
571
  opacity: e.opacity
542
572
  }));
543
573
  }
544
- function Fe(e) {
574
+ function Ie(e) {
545
575
  let { data: t, resolver: n, settings: r } = e, i = t.items.filter((e) => e.type.value === "node"), { items: a } = n.resolve({
546
576
  data: { items: i },
547
- defaults: { ...W.node },
577
+ defaults: { ...U.node },
548
578
  settings: {
549
579
  ...r.node,
550
580
  fixedValue: ({ datum: e }) => e.flow.value
@@ -552,63 +582,63 @@ function Fe(e) {
552
582
  });
553
583
  return a;
554
584
  }
555
- function Ie(e, t) {
585
+ function Le(e, t) {
556
586
  let n = [];
557
587
  return e.map((e) => {
558
- let r = {};
588
+ let r = e.data, i = {};
559
589
  e.sourceLinks.forEach((e) => {
560
- e.dataFill && (r[e.dataFill] || (r[e.dataFill] = {
590
+ e.dataFill && (i[e.dataFill] || (i[e.dataFill] = {
561
591
  dataFill: e.dataFill,
562
592
  sourceSum: 0,
563
593
  targetSum: 0
564
- }), r[e.dataFill].sourceSum += e.value);
594
+ }), i[e.dataFill].sourceSum += e.value);
565
595
  }), e.targetLinks.forEach((e) => {
566
- e.dataFill && (r[e.dataFill] || (r[e.dataFill] = {
596
+ e.dataFill && (i[e.dataFill] || (i[e.dataFill] = {
567
597
  dataFill: e.dataFill,
568
598
  sourceSum: 0,
569
599
  targetSum: 0
570
- }), r[e.dataFill].targetSum += e.value);
600
+ }), i[e.dataFill].targetSum += e.value);
571
601
  });
572
- let i = Object.values(r);
573
- i.sort(G);
574
- let a = i.reduce(([e, t], n) => [e + n.sourceSum, t + n.targetSum], [0, 0]), o = 1 - Math.max(...a) / e.value, s = e.y1 - e.y0, c = e.y0;
602
+ let a = Object.values(i);
603
+ a.sort(W);
604
+ let o = a.reduce(([e, t], n) => [e + n.sourceSum, t + n.targetSum], [0, 0]), s = 1 - Math.max(...o) / e.value, c = e.y1 - e.y0, l = e.y0;
575
605
  n.push({
576
606
  id: e.id,
577
- type: j.Rect,
607
+ type: M.Rect,
578
608
  x: e.x0 + t.nodeMargin,
579
609
  width: e.x1 - e.x0 - t.nodeMargin * 2,
580
- y: c,
581
- height: Math.max(.5, o * s),
610
+ y: l,
611
+ height: Math.max(.5, s * c),
582
612
  fill: e.fill,
583
613
  opacity: 1,
584
- data: e.data,
614
+ data: r,
585
615
  desc: {
586
- data: e.data,
616
+ data: r,
587
617
  label: e.data.label,
588
618
  flow: e.data.flow.value
589
619
  }
590
- }), c += o * s, i.forEach(({ dataFill: r, sourceSum: i, targetSum: a }, o) => {
591
- let l = s * (Math.max(i, a) / e.value);
620
+ }), l += s * c, a.forEach(({ dataFill: i, sourceSum: a, targetSum: o }, s) => {
621
+ let u = c * (Math.max(a, o) / e.value);
592
622
  n.push({
593
- id: `${e.id}::${o}`,
594
- type: j.Rect,
623
+ id: `${e.id}::${s}`,
624
+ type: M.Rect,
595
625
  x: e.x0 + t.nodeMargin,
596
626
  width: e.x1 - e.x0 - t.nodeMargin * 2,
597
- y: c,
598
- height: Math.max(.5, l),
599
- fill: r,
627
+ y: l,
628
+ height: Math.max(.5, u),
629
+ fill: i,
600
630
  opacity: 1,
601
- data: e.data,
631
+ data: r,
602
632
  desc: {
603
- data: e.data,
633
+ data: r,
604
634
  label: e.data.label,
605
635
  flow: e.data.flow.value
606
636
  }
607
- }), c += l;
637
+ }), l += u;
608
638
  });
609
639
  }), n;
610
640
  }
611
- var K = (e, t, n = !1, r = [4, 2]) => ({
641
+ var G = (e, t, n = !1, r = [4, 2]) => ({
612
642
  data: e.data,
613
643
  background: n ? e.fill : void 0,
614
644
  label: e.data.label,
@@ -619,12 +649,12 @@ var K = (e, t, n = !1, r = [4, 2]) => ({
619
649
  opacity: t.backdropColor ? 1 : .8,
620
650
  padding: r
621
651
  } : void 0
622
- }), Le = (e, t, n, r) => {
652
+ }), Re = (e, t, n, r) => {
623
653
  let { nodeLabelHeight: i, nodePadding: a } = r;
624
654
  return a < i ? [] : e.map((e) => {
625
- let t = n[e.layer], a = K(e, r, !1, [4, 0]), o = a.backdrop?.padding ?? [0, 0], s = t.align < .5 ? B.NodeLabelLeft : t.align > .5 ? B.NodeLabelRight : B.NodeLabelCenter;
655
+ let t = n[e.layer], a = G(e, r, !1, [4, 0]), o = a.backdrop?.padding ?? [0, 0], s = t.align < .5 ? z.NodeLabelLeft : t.align > .5 ? z.NodeLabelRight : z.NodeLabelCenter;
626
656
  return {
627
- type: j.Rect,
657
+ type: M.Rect,
628
658
  id: `${e.id}::labelTarget`,
629
659
  x: t.fullX + (t.align < .5 ? r.nodeMargin + o[0] : 0),
630
660
  width: t.fullWidth - (t.align === .5 ? 0 : r.nodeMargin + o[0]),
@@ -635,11 +665,11 @@ var K = (e, t, n = !1, r = [4, 2]) => ({
635
665
  fill: "none"
636
666
  };
637
667
  });
638
- }, Re = (e) => e.canShowNodeLabelAboveNode, ze = (e, t, n, r) => {
668
+ }, ze = (e) => e.canShowNodeLabelAboveNode, Be = (e, t, n, r) => {
639
669
  let { nodePadding: i } = r;
640
670
  return e.filter((e) => e.y1 - e.y0 + i >= r.nodeLabelHeight).map((e) => {
641
- let t = n[e.layer], a = t.align <= .5 ? B.NodeLabelLeft : B.NodeLabelRight, o = K(e, r, !1, [4, 2]), s = o.backdrop?.padding ?? [0, 0], c = [2, 2], l = [s[0] + c[0], s[1] + c[1]], u = {
642
- type: j.Rect,
671
+ let t = n[e.layer], a = t.align <= .5 ? z.NodeLabelLeft : z.NodeLabelRight, o = G(e, r, !1, [4, 2]), s = o.backdrop?.padding ?? [0, 0], c = [2, 2], l = [s[0] + c[0], s[1] + c[1]], u = {
672
+ type: M.Rect,
643
673
  id: `${e.id}::labelTarget`,
644
674
  x: t.gapX + l[0],
645
675
  width: t.gapWidth - 2 * l[0],
@@ -649,51 +679,51 @@ var K = (e, t, n = !1, r = [4, 2]) => ({
649
679
  tag: a,
650
680
  fill: "none"
651
681
  };
652
- return t.nodeWidth === 0 && (u.x = t.fullX + s[0], u.width = t.fullWidth - 2 * s[1], u.tag = t.align < .5 ? B.NodeLabelLeft : t.align > .5 ? B.NodeLabelRight : B.NodeLabelCenter), u;
682
+ return t.nodeWidth === 0 && (u.x = t.fullX + s[0], u.width = t.fullWidth - 2 * s[1], u.tag = t.align < .5 ? z.NodeLabelLeft : t.align > .5 ? z.NodeLabelRight : z.NodeLabelCenter), u;
653
683
  });
654
- }, Be = (e) => e.columnGap >= 20, Ve = (e, t, n, r) => e.filter((e) => e.y1 - e.y0 >= r.nodeLabelHeight).map((e) => {
655
- let t = K(e, r, !0, [4, 2]);
684
+ }, Ve = (e) => e.columnGap >= 20, He = (e, t, n, r) => e.filter((e) => e.y1 - e.y0 >= r.nodeLabelHeight).map((e) => {
685
+ let t = G(e, r, !0, [4, 2]);
656
686
  return {
657
- type: j.Rect,
687
+ type: M.Rect,
658
688
  id: `${e.id}::labelTarget`,
659
689
  x: e.x0 + r.nodeMargin,
660
690
  width: e.x1 - e.x0 - r.nodeMargin * 2,
661
691
  y: e.y0,
662
692
  height: e.y1 - e.y0,
663
693
  desc: t,
664
- tag: B.NodeLabelCenter,
694
+ tag: z.NodeLabelCenter,
665
695
  fill: "none"
666
696
  };
667
- }), He = (e) => e.columnWidth >= 80, q = {
668
- [c.Above]: {
669
- condition: Re,
670
- create: Le
697
+ }), Ue = (e) => e.columnWidth >= 80, K = {
698
+ [i.Above]: {
699
+ condition: ze,
700
+ create: Re
671
701
  },
672
- [c.Beside]: {
673
- condition: Be,
674
- create: ze
702
+ [i.Beside]: {
703
+ condition: Ve,
704
+ create: Be
675
705
  },
676
- [c.Inside]: {
677
- condition: He,
678
- create: Ve
706
+ [i.Inside]: {
707
+ condition: Ue,
708
+ create: He
679
709
  }
680
- }, Ue = (e) => e.priority.find((t) => q[t]?.condition(e)), We = (e, t, n, r) => {
710
+ }, We = (e) => e.priority.find((t) => K[t]?.condition(e)), Ge = (e, t, n, r) => {
681
711
  let i = [], a = n[0];
682
712
  if (!r.showDimensionLabel && !r.showFlowLabel) return [];
683
- let o = r.priority.find((e) => q[e]?.condition({
713
+ let o = r.priority.find((e) => K[e]?.condition({
684
714
  canShowNodeLabelAboveNode: r.canShowNodeLabelAboveNode,
685
715
  columnGap: a.gapWidth,
686
716
  columnWidth: a.nodeWidth,
687
717
  priority: r.priority
688
718
  }));
689
- return o && i.push(...q[o].create(e, t, n, r)), i;
719
+ return o && i.push(...K[o].create(e, t, n, r)), i;
690
720
  };
691
- function Ge(e, t) {
721
+ function Ke(e, t) {
692
722
  let { headerHeight: n } = t;
693
723
  return e.map((e) => {
694
- let t = e.align < .5 ? B.ColumnTitleLeft : e.align > .5 ? B.ColumnTitleRight : B.ColumnTitleCenter;
724
+ let t = e.align < .5 ? z.ColumnTitleLeft : e.align > .5 ? z.ColumnTitleRight : z.ColumnTitleCenter;
695
725
  return {
696
- type: j.Rect,
726
+ type: M.Rect,
697
727
  id: `column::${e.field}::labelTarget`,
698
728
  tag: t,
699
729
  fill: "none",
@@ -710,7 +740,7 @@ function Ge(e, t) {
710
740
  };
711
741
  });
712
742
  }
713
- function Ke(e, t, n, r) {
743
+ function qe(e, t, n, r) {
714
744
  let i = {};
715
745
  e.columnFields.forEach((e) => {
716
746
  i[e.id] = {
@@ -728,9 +758,9 @@ function Ke(e, t, n, r) {
728
758
  field: e.id,
729
759
  sort: e.sort
730
760
  }));
731
- return qe(a, t, n, e.showNullNodes), a;
761
+ return Je(a, t, n, e.showNullNodes), a;
732
762
  }
733
- function qe(e, t, n, r = !1) {
763
+ function Je(e, t, n, r = !1) {
734
764
  (e.find((e) => !e.count) || !r) && e.forEach((r, i) => {
735
765
  let a = `dummy-${i}`, o = `dummy-${i + 1}`;
736
766
  t.unshift({
@@ -757,13 +787,13 @@ function qe(e, t, n, r = !1) {
757
787
  });
758
788
  });
759
789
  }
760
- function Je(e, t) {
790
+ function Ye(e, t) {
761
791
  return {
762
792
  nodes: e.filter((e) => !e.id.startsWith("dummy-")),
763
793
  links: t.filter((e) => !e.source.id.startsWith("dummy-"))
764
794
  };
765
795
  }
766
- function Ye(e, t, n) {
796
+ function Xe(e, t, n) {
767
797
  let r = n[1][1] - n[0][1], i = e.reduce(([e, t], n) => [Math.min(e, n.y0), Math.max(t, n.y1)], [e[0].y0, e[0].y1]), a = i[0] - n[0][1], o = n[1][1] - i[1], s = 0;
768
798
  a > o && r / a > .1 ? s = -a / 2 : o > a && r / o > .1 && (s = o / 2), s !== 0 && (e.forEach((e) => {
769
799
  e.y0 += s, e.y1 += s;
@@ -771,9 +801,11 @@ function Ye(e, t, n) {
771
801
  e.y0 += s, e.y1 += s;
772
802
  }));
773
803
  }
774
- function Xe(e, t, n) {
804
+ function Ze(e, t, n) {
775
805
  return e.map((r) => {
776
- let i = t.find((e) => e.data.source.field === r.field), a = i.x0, o = i.x1 - i.x0, s = i.x1, c = n, l = i.x0 - n / 2, u = n + o, d = .5;
806
+ let i = t.find((e) => e.data.source.field === r.field);
807
+ if (!i) throw Error(`Missing Sankey node for column ${r.field}`);
808
+ let a = i.x0, o = i.x1 - i.x0, s = i.x1, c = n, l = i.x0 - n / 2, u = n + o, d = .5;
777
809
  return i.layer ? i.layer === e.length - 2 ? c = n / 2 : i.layer === e.length - 1 && (u = o + n / 2, c = n / 2, s = a - n / 2, d = 1) : (u = o + n / 2, l = 0, d = 0), {
778
810
  ...r,
779
811
  gapX: s,
@@ -786,85 +818,85 @@ function Xe(e, t, n) {
786
818
  };
787
819
  });
788
820
  }
789
- function Ze(e, t, n, r, i) {
790
- let a = Math.max(0, n.width / (e.length * 2) * t.nodeWidth), o = a > 0 ? t.linkMargin * .5 * Math.min(24, (n.width - a * e.length) / (e.length - 1) / 2) : 0;
791
- a += o * 2;
792
- let s = (n.width - a * e.length) / (e.length - 1), l = Math.max(...e.map((e) => e.count)), u = r.measureText(i.title).height + 2 * i.title.padding, d = 8 + u, f = t.showColumnHeaderLabels && n.height - 8 - d > 0, p = r.measureText(i.label).height + 2 * i.label.padding, m = f ? d : 0, h = n.height - m, g = h / l / 2 * t.nodePadding, _ = (t.showNodeDimensionLabel || t.showNodeFlowLabel) && p * l < h / 2, v = g, y = Ue({
821
+ function Qe(e, t, n, r, a) {
822
+ let o = Math.max(0, n.width / (e.length * 2) * t.nodeWidth), s = o > 0 ? t.linkMargin * .5 * Math.min(24, (n.width - o * e.length) / (e.length - 1) / 2) : 0;
823
+ o += s * 2;
824
+ let c = (n.width - o * e.length) / (e.length - 1), l = Math.max(...e.map((e) => e.count)), u = r.measureText(a.title).height + 2 * a.title.padding, d = 8 + u, f = t.showColumnHeaderLabels && n.height - 8 - d > 0, p = r.measureText(a.label).height + 2 * a.label.padding, m = f ? d : 0, h = n.height - m, g = h / l / 2 * t.nodePadding, _ = (t.showNodeDimensionLabel || t.showNodeFlowLabel) && p * l < h / 2, v = g, y = We({
793
825
  canShowNodeLabelAboveNode: _,
794
- columnGap: s,
795
- columnWidth: a,
826
+ columnGap: c,
827
+ columnWidth: o,
796
828
  priority: t.nodeLabelPlacements
797
829
  });
798
- return _ && y === c.Above && (m += p, v = Math.max(p, g)), {
799
- columnGap: s,
800
- columnWidth: a,
830
+ return _ && y === i.Above && (m += p, v = Math.max(p, g)), {
831
+ columnGap: c,
832
+ columnWidth: o,
801
833
  nodePadding: v,
802
834
  availableHeight: h,
803
835
  nodeLabelHeight: p,
804
- nodeMargin: o,
836
+ nodeMargin: s,
805
837
  top: m,
806
838
  showHeader: f,
807
839
  headerTitleHeight: u,
808
840
  canShowNodeLabelAboveNode: _
809
841
  };
810
842
  }
811
- function Qe(e, t) {
843
+ function $e(e, t) {
812
844
  return e.sourceLinks.length ? e.depth : t - 1;
813
845
  }
814
- function J(e) {
846
+ function q(e) {
815
847
  return function() {
816
848
  return e;
817
849
  };
818
850
  }
819
- ue();
851
+ de();
852
+ function J(e, t) {
853
+ return X(e.source, t.source) || e.index - t.index;
854
+ }
820
855
  function Y(e, t) {
821
- return Z(e.source, t.source) || e.index - t.index;
856
+ return X(e.target, t.target) || e.index - t.index;
822
857
  }
823
858
  function X(e, t) {
824
- return Z(e.target, t.target) || e.index - t.index;
825
- }
826
- function Z(e, t) {
827
859
  return e.y0 - t.y0;
828
860
  }
829
- function Q(e) {
861
+ function Z(e) {
830
862
  return e.value;
831
863
  }
832
- function $e(e) {
864
+ function et(e) {
833
865
  return e.index;
834
866
  }
835
- function et(e) {
867
+ function tt(e) {
836
868
  return e.nodes;
837
869
  }
838
- function tt(e) {
870
+ function nt(e) {
839
871
  return e.links;
840
872
  }
841
- function nt(e, t) {
873
+ function Q(e, t) {
842
874
  let n = e.get(t);
843
875
  if (!n) throw Error("missing: " + t);
844
876
  return n;
845
877
  }
846
- function rt({ nodes: e }) {
878
+ function $({ nodes: e }) {
847
879
  for (let t of e) {
848
880
  let e = t.y0, n = e;
849
881
  for (let n of t.sourceLinks) n.y0 = e + n.width / 2, e += n.width;
850
882
  for (let e of t.targetLinks) e.y1 = n + e.width / 2, n += e.width;
851
883
  }
852
884
  }
853
- function it() {
854
- let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = $e, c = Qe, l, u, d = et, f = tt, p = 6;
885
+ function rt() {
886
+ let e = 0, t = 0, n = 1, r = 1, i = 24, a = 8, o, s = et, c = $e, l, u, d = tt, f = nt, p = 6;
855
887
  function m() {
856
888
  let e = {
857
889
  nodes: d.apply(null, arguments),
858
890
  links: f.apply(null, arguments)
859
891
  };
860
- return h(e), g(e), _(e), v(e), x(e), rt(e), e;
892
+ return h(e), g(e), _(e), v(e), x(e), $(e), e;
861
893
  }
862
894
  m.update = function(e) {
863
- return rt(e), e;
895
+ return $(e), e;
864
896
  }, m.nodeId = function(e) {
865
- return arguments.length ? (s = typeof e == "function" ? e : J(e), m) : s;
897
+ return arguments.length ? (s = typeof e == "function" ? e : q(e), m) : s;
866
898
  }, m.nodeAlign = function(e) {
867
- return arguments.length ? (c = typeof e == "function" ? e : J(e), m) : c;
899
+ return arguments.length ? (c = typeof e == "function" ? e : q(e), m) : c;
868
900
  }, m.nodeSort = function(e) {
869
901
  return arguments.length ? (l = e, m) : l;
870
902
  }, m.nodeWidth = function(e) {
@@ -872,9 +904,9 @@ function it() {
872
904
  }, m.nodePadding = function(e) {
873
905
  return arguments.length ? (a = o = +e, m) : a;
874
906
  }, m.nodes = function(e) {
875
- return arguments.length ? (d = typeof e == "function" ? e : J(e), m) : d;
907
+ return arguments.length ? (d = typeof e == "function" ? e : q(e), m) : d;
876
908
  }, m.links = function(e) {
877
- return arguments.length ? (f = typeof e == "function" ? e : J(e), m) : f;
909
+ return arguments.length ? (f = typeof e == "function" ? e : q(e), m) : f;
878
910
  }, m.linkSort = function(e) {
879
911
  return arguments.length ? (u = e, m) : u;
880
912
  }, m.size = function(i) {
@@ -890,12 +922,12 @@ function it() {
890
922
  for (let [e, r] of t.entries()) {
891
923
  r.index = e;
892
924
  let { source: t, target: i } = r;
893
- typeof t != "object" && (t = r.source = nt(n, t)), typeof i != "object" && (i = r.target = nt(n, i)), t.sourceLinks.push(r), i.targetLinks.push(r);
925
+ typeof t != "object" && (t = r.source = Q(n, t)), typeof i != "object" && (i = r.target = Q(n, i)), t.sourceLinks.push(r), i.targetLinks.push(r);
894
926
  }
895
927
  if (u != null) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(u), n.sort(u);
896
928
  }
897
929
  function g({ nodes: e }) {
898
- for (let t of e) t.value = t.fixedValue === void 0 ? Math.max(L(t.sourceLinks, Q), L(t.targetLinks, Q)) : t.fixedValue;
930
+ for (let t of e) t.value = t.fixedValue === void 0 ? Math.max(I(t.sourceLinks, Z), I(t.targetLinks, Z)) : t.fixedValue;
899
931
  }
900
932
  function _({ nodes: e }) {
901
933
  let t = e.length, n = new Set(e), r = /* @__PURE__ */ new Set(), i = 0;
@@ -920,7 +952,7 @@ function it() {
920
952
  }
921
953
  }
922
954
  function y({ nodes: t }) {
923
- let r = le(t, (e) => e.depth) + 1, a = (n - e - i) / (r - 1), o = Array(r);
955
+ let r = F(t, (e) => e.depth) + 1, a = (n - e - i) / (r - 1), o = Array(r);
924
956
  for (let n of t) {
925
957
  let t = Math.max(0, Math.min(r - 1, Math.floor(c.call(null, n, r))));
926
958
  n.layer = t, n.x0 = e + t * a, n.x1 = n.x0 + i, o[t] ? o[t].push(n) : o[t] = [n];
@@ -929,7 +961,7 @@ function it() {
929
961
  return o;
930
962
  }
931
963
  function b(e) {
932
- let n = de(e, (e) => (r - t - (e.length - 1) * o) / L(e, Q));
964
+ let n = fe(e, (e) => (r - t - (e.length - 1) * o) / I(e, Z));
933
965
  for (let i of e) {
934
966
  let e = t;
935
967
  for (let t of i) {
@@ -941,12 +973,12 @@ function it() {
941
973
  let n = i[t];
942
974
  n.y0 += e * (t + 1), n.y1 += e * (t + 1);
943
975
  }
944
- ee(i);
976
+ O(i);
945
977
  }
946
978
  }
947
979
  function x(e) {
948
980
  let n = y(e);
949
- o = Math.min(a, (r - t) / (le(n, (e) => e.length) - 1)), b(n);
981
+ o = Math.min(a, (r - t) / (F(n, (e) => e.length) - 1)), b(n);
950
982
  for (let e = 0; e < p; ++e) {
951
983
  let t = .99 ** e, r = Math.max(1 - t, (e + 1) / p);
952
984
  C(n, t, r), S(n, t, r);
@@ -959,13 +991,13 @@ function it() {
959
991
  let n = 0, r = 0;
960
992
  for (let { source: t, value: i } of e.targetLinks) {
961
993
  let a = i * (e.layer - t.layer);
962
- n += O(t, e) * a, r += a;
994
+ n += k(t, e) * a, r += a;
963
995
  }
964
996
  if (!(r > 0)) continue;
965
997
  let i = (n / r - e.y0) * t;
966
998
  e.y0 += i, e.y1 += i, D(e);
967
999
  }
968
- l === void 0 && i.sort(Z), w(i, n);
1000
+ l === void 0 && i.sort(X), w(i, n);
969
1001
  }
970
1002
  }
971
1003
  function C(e, t, n) {
@@ -975,13 +1007,13 @@ function it() {
975
1007
  let n = 0, r = 0;
976
1008
  for (let { target: t, value: i } of e.sourceLinks) {
977
1009
  let a = i * (t.layer - e.layer);
978
- n += k(e, t) * a, r += a;
1010
+ n += A(e, t) * a, r += a;
979
1011
  }
980
1012
  if (!(r > 0)) continue;
981
1013
  let i = (n / r - e.y0) * t;
982
1014
  e.y0 += i, e.y1 += i, D(e);
983
1015
  }
984
- l === void 0 && i.sort(Z), w(i, n);
1016
+ l === void 0 && i.sort(X), w(i, n);
985
1017
  }
986
1018
  }
987
1019
  function w(e, n) {
@@ -1002,14 +1034,14 @@ function it() {
1002
1034
  }
1003
1035
  function D({ sourceLinks: e, targetLinks: t }) {
1004
1036
  if (u === void 0) {
1005
- for (let { source: { sourceLinks: e } } of t) e.sort(X);
1006
- for (let { target: { targetLinks: t } } of e) t.sort(Y);
1037
+ for (let { source: { sourceLinks: e } } of t) e.sort(Y);
1038
+ for (let { target: { targetLinks: t } } of e) t.sort(J);
1007
1039
  }
1008
1040
  }
1009
- function ee(e) {
1010
- if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(X), n.sort(Y);
1041
+ function O(e) {
1042
+ if (u === void 0) for (let { sourceLinks: t, targetLinks: n } of e) t.sort(Y), n.sort(J);
1011
1043
  }
1012
- function O(e, t) {
1044
+ function k(e, t) {
1013
1045
  let n = e.y0 - (e.sourceLinks.length - 1) * o / 2;
1014
1046
  for (let { target: r, width: i } of e.sourceLinks) {
1015
1047
  if (r === t) break;
@@ -1021,7 +1053,7 @@ function it() {
1021
1053
  }
1022
1054
  return n;
1023
1055
  }
1024
- function k(e, t) {
1056
+ function A(e, t) {
1025
1057
  let n = t.y0 - (t.targetLinks.length - 1) * o / 2;
1026
1058
  for (let { source: r, width: i } of t.targetLinks) {
1027
1059
  if (r === e) break;
@@ -1035,18 +1067,20 @@ function it() {
1035
1067
  }
1036
1068
  return m;
1037
1069
  }
1038
- var $ = 4;
1070
+ var it = 4;
1039
1071
  function at(e) {
1040
- let { columns: t, sankeyNodes: n, sankeyLinks: r, columnWidth: i, columnGap: a, nodePadding: o, top: s, rect: c } = e, l = t.map((e) => e.field), u = (e) => l.indexOf(e.data.source.field), d = t.find((e) => !!e.sort) ? (e, n) => t[e.layer].sort?.(e, n) : void 0, f = [[0, s + $], [c.width, c.height - 2 * $]];
1041
- it().nodeId((e) => e.id).nodePadding(o).nodeWidth(i).linkSort((e, t) => e.dataFill && t.dataFill ? G(e, t) : e.dataFill ? 1 : -1).nodeSort(d).nodeAlign(u).extent(f).iterations(6)({
1072
+ let { columns: t, sankeyNodes: n, sankeyLinks: r, columnWidth: i, columnGap: a, nodePadding: o, top: s, rect: c } = e, l = t.map((e) => e.field), u = (e) => l.indexOf(e.data.source.field), d = t.find((e) => !!e.sort) ? (e, n) => {
1073
+ if (e.layer === void 0) throw Error("Missing Sankey node layer before sorting");
1074
+ let r = t[e.layer].sort;
1075
+ return r?.(e, n) ?? 0;
1076
+ } : void 0, f = [[0, s + it], [c.width, c.height - 2 * it]], p = rt().nodeId((e) => e.id).nodePadding(o).nodeWidth(i).linkSort((e, t) => e.dataFill && t.dataFill ? W(e, t) : e.dataFill ? 1 : -1).nodeSort(d).nodeAlign(u).extent(f).iterations(6)({
1042
1077
  nodes: n,
1043
1078
  links: r
1044
- });
1045
- let p = Xe(t, n, a), { nodes: m, links: h } = Je(n, r);
1046
- return Ye(m, h, f), {
1047
- nodes: m,
1048
- links: h,
1049
- columns: p
1079
+ }), m = Ze(t, p.nodes, a), { nodes: h, links: g } = Ye(p.nodes, p.links);
1080
+ return Xe(h, g, f), {
1081
+ nodes: h,
1082
+ links: g,
1083
+ columns: m
1050
1084
  };
1051
1085
  }
1052
1086
  var ot = {
@@ -1056,26 +1090,25 @@ var ot = {
1056
1090
  "renderer"
1057
1091
  ],
1058
1092
  defaultSettings: {
1059
- settings: W,
1093
+ settings: U,
1060
1094
  style: {
1061
1095
  title: "$title",
1062
1096
  label: "$label"
1063
1097
  }
1064
1098
  },
1065
1099
  render({ data: e }) {
1066
- let { settings: t } = this.settings, n = Fe({
1100
+ let { settings: t } = this.settings, n = Ie({
1067
1101
  data: e,
1068
1102
  resolver: this.resolver,
1069
1103
  settings: t
1070
- }), r = Pe({
1104
+ }), r = Fe({
1071
1105
  data: e,
1072
1106
  resolver: this.resolver,
1073
1107
  settings: t,
1074
1108
  resolvedNodes: n
1075
- }), i = Ke(t, n, r, this.chart.dataset()), { columnGap: a, columnWidth: o, nodePadding: s, availableHeight: c, nodeLabelHeight: l, nodeMargin: u, top: d, showHeader: f, headerTitleHeight: p, canShowNodeLabelAboveNode: m } = Ze(i, t, this.rect, this.renderer, this.style);
1109
+ }), i = qe(t, n, r, this.chart.dataset()), { columnGap: a, columnWidth: o, nodePadding: s, availableHeight: c, nodeLabelHeight: l, nodeMargin: u, top: d, showHeader: f, headerTitleHeight: p, canShowNodeLabelAboveNode: m } = Qe(i, t, this.rect, this.renderer, this.style);
1076
1110
  if (c < 8) return [];
1077
- let h = [];
1078
- ({nodes: n, links: r, columns: h} = at({
1111
+ let { nodes: h, links: g, columns: _ } = at({
1079
1112
  columns: i,
1080
1113
  sankeyNodes: n,
1081
1114
  sankeyLinks: r,
@@ -1084,8 +1117,7 @@ var ot = {
1084
1117
  nodePadding: s,
1085
1118
  top: d,
1086
1119
  rect: this.rect
1087
- }));
1088
- let g = Ie(n, { nodeMargin: u }), _ = We(n, g, h, {
1120
+ }), v = Le(h, { nodeMargin: u }), y = Ge(h, v, _, {
1089
1121
  nodeLabelHeight: l,
1090
1122
  canShowNodeLabelAboveNode: m,
1091
1123
  nodePadding: s,
@@ -1097,31 +1129,33 @@ var ot = {
1097
1129
  priority: t.nodeLabelPlacements
1098
1130
  });
1099
1131
  return [
1100
- ...Ne(r),
1101
- ...g,
1102
- ...f ? Ge(h, { headerHeight: p }) : [],
1103
- ..._
1132
+ ...Pe(g),
1133
+ ...v,
1134
+ ...f ? Ke(_, { headerHeight: p }) : [],
1135
+ ...y
1104
1136
  ];
1105
1137
  }
1106
1138
  };
1107
1139
  function st(e) {
1108
- e.component(P.Sankey, ot);
1140
+ e.component(N.Sankey, ot);
1109
1141
  }
1110
- var ct = y(), lt = _(({ vSpec: e, vTheme: t, data: n, elementSize: i, vizProperties: a }) => {
1111
- let o = g(), [s] = (0, fe.useState)(() => new je()), c = t || r, d = v(), f = m(), p = d.targetDataItemId;
1112
- if (!p && d.targetInternalKey) {
1113
- let t = e.dimensions.find((e) => e.dataItem.internalKey === d.targetInternalKey);
1114
- t && (p = l(t.dataItem));
1142
+ var ct = y(), lt = _(({ vSpec: e, vTheme: t, data: n, elementSize: r, vizProperties: i }) => {
1143
+ let o = g(), [s] = (0, pe.useState)(() => new Me()), c = t || f, l = v(), u = h(), p = ne();
1144
+ if (!e) return null;
1145
+ let m = l.targetDataItemId;
1146
+ if (!m && l.targetInternalKey) {
1147
+ let t = e.dimensions.find((e) => e.dataItem.internalKey === l.targetInternalKey);
1148
+ t && (m = a(t.dataItem));
1115
1149
  }
1116
- let h = {
1117
- ...a,
1118
- valuePickerMode: !!d.activeKey,
1119
- valuePickerTargetDataItemId: p
1120
- }, _ = s.compile(e, c, n, i, h, u.Sankey, o, f, ne());
1121
- return _ ? /* @__PURE__ */ (0, ct.jsx)(O, {
1122
- config: a,
1123
- definition: _,
1124
- size: i,
1150
+ let _ = {
1151
+ ...i,
1152
+ valuePickerMode: !!l.activeKey,
1153
+ valuePickerTargetDataItemId: m ?? void 0
1154
+ }, y = s.compile(e, c, n, r, _, d.Sankey, o, u, p);
1155
+ return y ? /* @__PURE__ */ (0, ct.jsx)(ee, {
1156
+ config: i,
1157
+ definition: y,
1158
+ size: r,
1125
1159
  vSpec: e,
1126
1160
  escobarPlugins: [st]
1127
1161
  }) : null;