@milaboratories/graph-maker 1.1.139 → 1.1.141

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 (152) hide show
  1. package/dist/GraphMaker/components/Chart.vue.d.ts.map +1 -1
  2. package/dist/GraphMaker/components/Chart.vue.js +1 -0
  3. package/dist/GraphMaker/components/Chart.vue.js.map +1 -1
  4. package/dist/GraphMaker/dataBindAes.d.ts +5 -5
  5. package/dist/GraphMaker/dataBindAes.d.ts.map +1 -1
  6. package/dist/GraphMaker/dataBindAes.js +52 -49
  7. package/dist/GraphMaker/dataBindAes.js.map +1 -1
  8. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js +14 -14
  9. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js.map +1 -1
  10. package/dist/GraphMaker/index.vue.d.ts.map +1 -1
  11. package/dist/GraphMaker/index.vue.js +115 -113
  12. package/dist/GraphMaker/index.vue.js.map +1 -1
  13. package/dist/GraphMaker/store.js +9 -9
  14. package/dist/GraphMaker/types.d.ts +1 -1
  15. package/dist/GraphMaker/types.d.ts.map +1 -1
  16. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +3 -3
  17. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts +4 -8
  18. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.d.ts.map +1 -1
  19. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
  20. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDendroSettings.d.ts +2 -2
  21. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +5 -5
  22. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  23. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +7 -7
  24. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +9 -9
  25. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
  26. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +20 -16
  27. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
  28. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +65 -69
  29. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
  30. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +20 -16
  31. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts.map +1 -1
  32. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +20 -19
  33. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
  34. package/dist/GraphMaker/utils/loadDefaultSources.js +4 -3
  35. package/dist/GraphMaker/utils/loadDefaultSources.js.map +1 -1
  36. package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
  37. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +57 -54
  38. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
  39. package/dist/_virtual/_commonjsHelpers.js +3 -5
  40. package/dist/_virtual/_commonjsHelpers.js.map +1 -1
  41. package/dist/lib.js +1 -1
  42. package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js +5 -5
  43. package/dist/node_modules/@milaboratories/miplots4/dist/AbstractChart.js.map +1 -1
  44. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +8 -5
  45. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js.map +1 -1
  46. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js +22 -22
  47. package/dist/node_modules/@milaboratories/miplots4/dist/bubble/index.js.map +1 -1
  48. package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js +4 -22
  49. package/dist/node_modules/@milaboratories/miplots4/dist/common/Error.js.map +1 -1
  50. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js +53 -53
  51. package/dist/node_modules/@milaboratories/miplots4/dist/dendro/index.js.map +1 -1
  52. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/ChartRenderer.js +6 -6
  53. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +45 -45
  54. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
  55. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js +71 -70
  56. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
  57. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +117 -112
  58. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js.map +1 -1
  59. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/ChartsGroup.js +14 -14
  60. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +6 -6
  61. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
  62. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js +36 -36
  63. package/dist/node_modules/@milaboratories/miplots4/dist/histogram/index.js.map +1 -1
  64. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js +24 -24
  65. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/ScatterplotSettingsImpl.js.map +1 -1
  66. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js +23 -26
  67. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/dots.js.map +1 -1
  68. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js +13 -10
  69. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/getLayersData.js.map +1 -1
  70. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js +67 -73
  71. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/index.js.map +1 -1
  72. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +44 -39
  73. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
  74. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js +18 -0
  75. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/sortDotsByGrouping.js.map +1 -0
  76. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js +14 -14
  77. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/SettingsImpl.js.map +1 -1
  78. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js +68 -64
  79. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot-umap/index.js.map +1 -1
  80. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js +23 -17
  81. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot-umap.js.map +1 -1
  82. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js +23 -17
  83. package/dist/node_modules/@milaboratories/miplots4/dist/types/scatterplot.js.map +1 -1
  84. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js +7 -0
  85. package/dist/node_modules/@milaboratories/miplots4/dist/utils/arraysAreDifferent.js.map +1 -0
  86. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js +9 -0
  87. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js.map +1 -0
  88. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js +8 -0
  89. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js.map +1 -0
  90. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash.js +8 -0
  91. package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/lodash.js.map +1 -1
  92. package/dist/{_virtual/lodash.js → node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js} +1 -1
  93. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js.map +1 -0
  94. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify.js +3 -0
  95. package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/stringify.js.map +1 -1
  96. package/dist/{_virtual/stringify.js → node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js} +1 -1
  97. package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js.map +1 -0
  98. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +15 -0
  99. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -0
  100. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +198 -0
  101. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -0
  102. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +342 -0
  103. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -0
  104. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +278 -0
  105. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -0
  106. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +453 -0
  107. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js.map +1 -0
  108. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +203 -0
  109. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js.map +1 -0
  110. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +432 -0
  111. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -0
  112. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +170 -0
  113. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js.map +1 -0
  114. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +315 -0
  115. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -0
  116. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +323 -0
  117. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -0
  118. package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js +11 -0
  119. package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js.map +1 -0
  120. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +36 -3420
  121. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
  122. package/dist/node_modules/@milaboratories/{pl-error-like → pf-plots/dist/node_modules/@milaboratories/pl-error-like}/dist/index.js +1 -1
  123. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +1 -0
  124. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +979 -0
  125. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +1 -0
  126. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +1599 -0
  127. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +1 -0
  128. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js +19 -0
  129. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js.map +1 -0
  130. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js +26 -0
  131. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js.map +1 -0
  132. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js +3678 -0
  133. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js.map +1 -0
  134. package/dist/node_modules/{zod → @milaboratories/pf-plots/dist/node_modules/zod}/lib/index.js +1141 -1141
  135. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/zod/lib/index.js.map +1 -0
  136. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +247 -0
  137. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -0
  138. package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js +62 -0
  139. package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js.map +1 -0
  140. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +286 -0
  141. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -0
  142. package/package.json +3 -3
  143. package/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
  144. package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -584
  145. package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
  146. package/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1559
  147. package/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
  148. package/dist/node_modules/json-stringify-safe/stringify.js +0 -20
  149. package/dist/node_modules/json-stringify-safe/stringify.js.map +0 -1
  150. package/dist/node_modules/lodash/lodash.js +0 -3678
  151. package/dist/node_modules/lodash/lodash.js.map +0 -1
  152. package/dist/node_modules/zod/lib/index.js.map +0 -1
@@ -1,3430 +1,46 @@
1
- import z from "../../../canonicalize/lib/canonicalize.js";
2
- import { deriveLabels as _e, isLabelColumn as Le } from "../../../@platforma-sdk/model/dist/index.js";
3
- import { canonicalizeJson as j, pTableValue as Te } from "../../pl-model-common/dist/index.js";
4
- import ue from "../../../lodash/lodash.js";
5
- var ke = "pl7.app/axisNature", we = "pl7.app/label", Ee = "pl7.app/columnAsAxis/name", Ne = "pl7.app/columnAsAxis/domain", $ = "pl7.app/isSubset", ee = "pl7.app/isDiscreteFilter", Ge = "pl7.app/discreteValues", Me = "pl7.app/graph/axis/highCardinality", qe = "pl7.app/graph/isVirtual", Ce = "pl7.app/isLinkerColumn", pe = "pl7.app/format", _ = class se {
6
- constructor({ type: e, name: o, domain: n }) {
7
- this.kind = "axis", this.type = e, this.name = o, this.domain = { ...n };
8
- }
9
- toCanonicalString() {
10
- return z(this);
11
- }
12
- static fromAxisSpec(e) {
13
- return new se({ name: e.name, type: e.type, domain: e.domain });
14
- }
15
- static fromAxesSpec(e) {
16
- return e.map((o) => se.fromAxisSpec(o));
17
- }
18
- copy() {
19
- return new se({ type: this.type, name: this.name, domain: this.domain });
20
- }
21
- toPFrameId() {
22
- return {
23
- type: this.type,
24
- name: this.name,
25
- domain: this.domain
26
- };
27
- }
28
- static fromPojo(e) {
29
- return new se(e);
30
- }
31
- }, W = class ve {
32
- constructor({ name: e, type: o }) {
33
- this.kind = "column", this.name = e, this.type = o;
34
- }
35
- toCanonicalString() {
36
- return z(this);
37
- }
38
- static fromPojo(e) {
39
- return new ve(e);
40
- }
41
- };
42
- function P(t) {
43
- return t !== null && t.kind === "column";
44
- }
45
- function ae(t) {
46
- return t !== null && t.kind === "axis";
47
- }
48
- function A(t) {
49
- const e = JSON.parse(t);
50
- if (e.kind === "column")
51
- return W.fromPojo(e);
52
- if (e.kind === "axis")
53
- return _.fromPojo(e);
54
- throw Error("wrong column or axis object");
55
- }
56
- var fe = "pl7.app/parents";
57
- function Ae(t) {
58
- return !t.annotations || !t.annotations[fe] ? [] : JSON.parse(t.annotations[fe]);
59
- }
60
- function Ve(t, e) {
61
- const o = j(t[e]);
62
- for (let n = 0; n < t.length; n++) {
63
- const l = t[n];
64
- if (e === n)
65
- continue;
66
- if (Ae(l).some((c) => j(c) === o))
67
- return !1;
68
- }
69
- return !0;
70
- }
71
- function je(t) {
72
- for (let e = 0; e < t.length; e++)
73
- if (Ve(t, e))
74
- return t[e];
75
- return null;
76
- }
77
- function ze(t) {
78
- const e = { axis: t, parents: [] };
79
- let o = [e];
80
- for (; o.length; ) {
81
- const n = [];
82
- for (const l of o) {
83
- const s = Ae(l.axis);
84
- l.parents = s.map((c) => ({ axis: c, parents: [] })), n.push(...l.parents);
85
- }
86
- o = n;
87
- }
88
- return e;
89
- }
90
- function Ke(t) {
91
- const e = /* @__PURE__ */ new Set([j(t.axis)]);
92
- let o = [t];
93
- for (; o.length; ) {
94
- const n = [];
95
- for (const l of o)
96
- for (const s of l.parents)
97
- e.add(j(s.axis)), n.push(s);
98
- o = n;
99
- }
100
- return e;
101
- }
102
- function Ue(t) {
103
- const e = [t.axis];
104
- let o = [t];
105
- for (; o.length; ) {
106
- const n = [];
107
- for (const l of o)
108
- for (const s of l.parents)
109
- e.push(s.axis), n.push(s);
110
- o = n;
111
- }
112
- return e;
113
- }
114
- function te(t) {
115
- if (!t.length)
116
- return [];
117
- let e = t;
118
- const o = [];
119
- for (; e.length; ) {
120
- const n = je(e);
121
- if (n === null)
122
- return null;
123
- const l = ze(n);
124
- if (l === null)
125
- return null;
126
- const s = Ke(l), c = Ue(l);
127
- o.push(c), e = e.filter((r) => !s.has(j(r)));
128
- }
129
- return o;
130
- }
131
- function We(t) {
132
- var e, o;
133
- const n = /* @__PURE__ */ new Map();
134
- for (const l of t) {
135
- const s = new W({ name: l.columnId, type: l.spec.valueType }), c = te(l.spec.axesSpec);
136
- if (!c || c.length !== 2)
137
- continue;
138
- const [r, a] = c, u = j(r), p = j(a);
139
- n.has(u) || n.set(u, /* @__PURE__ */ new Map()), n.has(p) || n.set(p, /* @__PURE__ */ new Map()), (e = n.get(u)) == null || e.set(p, s), (o = n.get(p)) == null || o.set(u, s);
140
- }
141
- return n;
142
- }
143
- async function He(t, e, o, n, l, s, c, r = !0, a) {
144
- var u, p, m, y;
145
- const x = A(e);
146
- if (P(x)) {
147
- const g = await t.pFrameProvider.getColumnSpecById(x);
148
- if (!g)
149
- return;
150
- const w = De(
151
- g,
152
- l,
153
- s,
154
- c,
155
- a
156
- ).map((d) => _.fromAxisSpec(d).toCanonicalString()), C = new Set(w), D = g.axesSpec.map((d) => _.fromAxisSpec(d).toCanonicalString()), B = {};
157
- r && D.forEach((d, i) => {
158
- C.has(d) && (B[d] = i);
159
- });
160
- const v = {
161
- kind: "column",
162
- name: g.name,
163
- label: o ?? await T(t, e, []),
164
- type: g.valueType,
165
- spec: g,
166
- annotations: g.annotations,
167
- isSubsetFilter: ((u = g.annotations) == null ? void 0 : u[$]) === "true",
168
- isDiscreteFilter: g.valueType === "String" || ((p = g.annotations) == null ? void 0 : p[ee]) === "true",
169
- axesToBeFixed: w,
170
- axesToBeFixedIndexes: B
171
- };
172
- n.set(x.toCanonicalString(), v);
173
- for (const d of g.axesSpec) {
174
- const S = _.fromAxisSpec(d).toCanonicalString();
175
- if (n.has(S))
176
- continue;
177
- const f = Ie(d), h = {
178
- kind: "axis",
179
- name: d.name,
180
- label: await T(t, S, [e]),
181
- type: d.type,
182
- mustBeConsumed: f,
183
- dividable: !1,
184
- spec: d,
185
- annotations: d.annotations,
186
- isSubsetFilter: ((m = d.annotations) == null ? void 0 : m[$]) === "true",
187
- isDiscreteFilter: d.type === "String" || ((y = d.annotations) == null ? void 0 : y[ee]) === "true",
188
- parentSources: [e]
189
- };
190
- n.set(S, h);
191
- }
192
- }
193
- }
194
- function ge(t) {
195
- const e = A(t), { name: o, type: n } = e;
196
- return P(e) ? {
197
- kind: "column",
198
- name: "",
199
- label: " ",
200
- type: e.type,
201
- spec: { axesSpec: [], kind: "PColumn", valueType: e.type, name: o },
202
- annotations: void 0,
203
- isSubsetFilter: !1,
204
- isDiscreteFilter: e.type === "String",
205
- axesToBeFixed: [],
206
- axesToBeFixedIndexes: {}
207
- } : {
208
- kind: "axis",
209
- name: "",
210
- label: " ",
211
- type: n,
212
- spec: { type: n, name: o },
213
- mustBeConsumed: !1,
214
- dividable: !1,
215
- annotations: void 0,
216
- isSubsetFilter: !1,
217
- isDiscreteFilter: n === "String",
218
- parentSources: []
219
- };
220
- }
221
- function me(t) {
222
- return {
223
- type: t.type,
224
- components: { ...t.components },
225
- dividedAxes: { ...t.dividedAxes }
226
- };
227
- }
228
- function Ye(t) {
229
- const { selectedSource: e, type: o, selectedFilterRange: n, selectedFilterValue: l } = t, s = A(e);
230
- if (!s)
231
- throw Error("Empty source selected");
232
- if (o === "range") {
233
- const c = [];
234
- return (n == null ? void 0 : n.max) !== void 0 && c.push({
235
- type: "bySingleColumnV2",
236
- column: ae(s) ? { type: "axis", id: s.toPFrameId() } : { type: "column", id: s.name },
237
- predicate: {
238
- operator: "LessOrEqual",
239
- reference: n.max
240
- }
241
- }), (n == null ? void 0 : n.min) !== void 0 && c.push({
242
- type: "bySingleColumnV2",
243
- column: ae(s) ? { type: "axis", id: s.toPFrameId() } : { type: "column", id: s.name },
244
- predicate: {
245
- operator: "GreaterOrEqual",
246
- reference: n == null ? void 0 : n.min
247
- }
248
- }), c;
249
- } else if (o === "subset")
250
- return [
251
- {
252
- type: "bySingleColumnV2",
253
- column: ae(s) ? { type: "axis", id: s.toPFrameId() } : { type: "column", id: s.name },
254
- predicate: {
255
- operator: "Not",
256
- operand: { operator: "IsNA" }
257
- }
258
- }
259
- ];
260
- return typeof l > "u" ? [] : [
261
- {
262
- type: "bySingleColumnV2",
263
- column: ae(s) ? { type: "axis", id: s.toPFrameId() } : {
264
- type: "column",
265
- id: s.name
266
- },
267
- predicate: {
268
- operator: "Equal",
269
- reference: s.type === "String" ? String(l) : Number(l)
270
- }
271
- }
272
- ];
273
- }
274
- function Y(t) {
275
- const e = [];
276
- for (const o of t)
277
- e.push(...Ye(o));
278
- return e;
279
- }
280
- function xe(t) {
281
- var e, o, n, l;
282
- if ("kind" in t && t.kind === "PColumn") {
283
- const r = (o = t.name) != null ? o : (e = t.annotations) == null ? void 0 : e[Ee], a = (l = t.domain) != null ? l : (n = t.annotations) == null ? void 0 : n[Ne];
284
- return z({ name: r, domain: a });
285
- }
286
- const s = t.name, c = t.domain;
287
- return z({ name: s, domain: c });
288
- }
289
- async function be(t, e, o) {
290
- var n;
291
- for (const l of o) {
292
- const s = A(l);
293
- if (P(s)) {
294
- const c = await t.pFrameProvider.getColumnSpecById(s), r = ((n = c == null ? void 0 : c.axesSpec) != null ? n : []).find(
295
- (a) => _.fromAxisSpec(a).toCanonicalString() === e.toCanonicalString()
296
- );
297
- if (r)
298
- return r;
299
- }
300
- }
301
- return null;
302
- }
303
- var Re = "pl7.app/label";
304
- async function k(t, e, o) {
305
- const n = A(e);
306
- if (P(n))
307
- return;
308
- async function l(a) {
309
- const u = await be(t, a, o);
310
- return u ? xe(u) : null;
311
- }
312
- const s = await t.pFrameProvider.getColumnsFull([], !1, void 0, [Re]), c = await l(n), r = s.find(({ spec: a }) => a && a.axesSpec.length === 1 && xe(a.axesSpec[0]) === c);
313
- return r ? new W({ name: r.columnId, type: r.spec.valueType }) : void 0;
314
- }
315
- async function le(t, e, o) {
316
- const n = A(e), l = await k(t, e, o);
317
- let s;
318
- return P(n) ? s = await t.pFrameProvider.getColumnSpecById(l ?? n) : s = l ? await t.pFrameProvider.getColumnSpecById(l) : await be(t, n, o), s;
319
- }
320
- async function T(t, e, o) {
321
- var n, l;
322
- const s = await le(t, e, o);
323
- if (!s)
324
- return "";
325
- const c = (l = (n = s.annotations) == null ? void 0 : n[we]) != null ? l : s.name;
326
- return t.labelsModifier(s.name, c);
327
- }
328
- function Ie(t) {
329
- var e, o;
330
- const n = (o = (e = t.annotations) == null ? void 0 : e[ke]) == null ? void 0 : o.toLowerCase();
331
- return !!n && n !== "homogenous" && n !== "homogeneous";
332
- }
333
- function R(t) {
334
- var e, o;
335
- return ((e = t.annotations) == null ? void 0 : e[$]) === "true" || ((o = t.annotations) == null ? void 0 : o[ee]) === "true", !0;
336
- }
337
- function Xe(t) {
338
- var e, o;
339
- return !t.name.includes("metadata") && ((e = t.annotations) == null ? void 0 : e[qe]) !== "true" && ((o = t.annotations) == null ? void 0 : o[$]) !== "true";
340
- }
341
- function $e(t) {
342
- var e;
343
- const o = {};
344
- for (const n of t.filter((l) => l.spec.axesSpec.length === 2)) {
345
- const l = new W({ name: n.columnId, type: n.spec.valueType }), s = (e = n.spec.axesSpec) != null ? e : [];
346
- if (s.length) {
347
- const [c, r] = s, a = _.fromAxisSpec(c).toCanonicalString(), u = _.fromAxisSpec(r).toCanonicalString();
348
- o[a] || (o[a] = {}), o[u] || (o[u] = {}), o[a][u] = { id: l, spec: n.spec }, o[u][a] = { id: l, spec: n.spec };
349
- }
350
- }
351
- return o;
352
- }
353
- async function J(t, e) {
354
- const o = /* @__PURE__ */ new Set(), n = [];
355
- for (const l of e) {
356
- const s = A(l);
357
- if (P(s)) {
358
- const c = await t.pFrameProvider.getColumnSpecById(s);
359
- if (!c)
360
- continue;
361
- c.axesSpec.forEach((r) => {
362
- const a = _.fromAxisSpec(r).toCanonicalString();
363
- o.has(a) || (o.add(a), n.push(r));
364
- });
365
- }
366
- }
367
- return n;
368
- }
369
- function Je(t, e, o) {
370
- const n = {}, l = /* @__PURE__ */ new Set([e]);
371
- let s = [e];
372
- for (; s.length; ) {
373
- const c = /* @__PURE__ */ new Set();
374
- for (const r of s)
375
- if (t[r]) {
376
- const a = Object.keys(t[r]);
377
- for (const u of a)
378
- if (n[u] = r, u === o) {
379
- const p = [];
380
- let m = o;
381
- for (; n[m] !== e; )
382
- p.push(m), m = n[m];
383
- return p.push(m), p.map((y) => t[y][n[y]].id);
384
- } else l.has(u) || (c.add(u), l.add(u));
385
- }
386
- s = [...c];
387
- }
388
- return null;
389
- }
390
- function Qe(t, e, o) {
391
- const n = [...e].map((s) => Je(t, s, o)).filter((s) => s !== null);
392
- if (n.length === 0)
393
- return [];
394
- let l = n[0];
395
- for (const s of n)
396
- s.length < l.length && (l = s);
397
- return l;
398
- }
399
- async function X(t) {
400
- const e = await t.pFrameProvider.getColumnsFull(
401
- [],
402
- !1,
403
- void 0,
404
- void 0,
405
- { [Ce]: "true" }
406
- ), o = $e(e.filter((l) => l.spec.axesSpec.length === 2)), n = We(e.filter((l) => l.spec.axesSpec.length > 2));
407
- return { linkerColumnsMap: o, compositeLinkerMap: n };
408
- }
409
- async function V(t, e, o, n, l, s) {
410
- const c = A(l);
411
- if (!P(c))
412
- return [];
413
- const r = await t.pFrameProvider.getColumnSpecById(c);
414
- if (!r)
415
- return [];
416
- const a = r.axesSpec.filter(
417
- (w) => {
418
- const C = _.fromAxisSpec(w).toCanonicalString();
419
- return !(s != null && s.some((D) => D.axisSource === C));
420
- }
421
- ), u = new Set(n.map((w) => _.fromAxisSpec(w).toCanonicalString())), p = a.filter((w) => {
422
- const C = _.fromAxisSpec(w).toCanonicalString();
423
- return !u.has(C);
424
- });
425
- if (!p.length)
426
- return [];
427
- const m = te(n), y = te(p);
428
- if (!m || !y)
429
- throw Error(`Can't create axes tree for ${r.name}`);
430
- const x = new Set(m.map(j)), g = /* @__PURE__ */ new Set();
431
- return y.forEach((w) => {
432
- var C;
433
- const D = j(w);
434
- if (o.has(D)) {
435
- const B = o.get(D), d = (B ? [...B.keys()] : []).find((S) => x.has(S));
436
- if (!d)
437
- throw Error(`Can't find composite linker column for ${r.name}, ${D}`);
438
- const i = (C = o.get(D)) == null ? void 0 : C.get(d);
439
- g.add(i.toCanonicalString());
440
- } else if (w.length === 1) {
441
- const B = _.fromAxisSpec(w[0]).toCanonicalString();
442
- Qe(e, u, B).forEach((d) => {
443
- g.add(d.toCanonicalString());
444
- });
445
- }
446
- }), [...g].map((w) => A(w));
447
- }
448
- function De(t, e, o, n, l) {
449
- const c = t.axesSpec.filter(
450
- (p) => !o.has(_.fromAxisSpec(p).toCanonicalString())
451
- );
452
- if (!c.length)
453
- return [];
454
- const r = te(e);
455
- let a = te(c);
456
- if (!r || !a)
457
- return c;
458
- const u = new Set(r.map(j));
459
- return a = a.filter(
460
- (p) => {
461
- const m = j(p), y = l.get(m);
462
- return !(y ? [...y.keys()] : []).some((g) => u.has(g));
463
- }
464
- ), a.some((p) => p.length > 1) ? a.flatMap((p) => p) : (a = a.filter(([p]) => !n.has(_.fromAxisSpec(p).toCanonicalString())), a.flatMap((p) => p));
465
- }
466
- function Be(t, e) {
467
- const o = e.columnsData[Object.keys(e.columnsData)[0]].length, n = new Int32Array(o).fill(0);
468
- for (let l = 0; l < o; l++) {
469
- let s = !1;
470
- for (let c = 0; c < t.length; c++) {
471
- const { selectedSource: r, selectedFilterValue: a, selectedFilterRange: u, type: p } = t[c], m = A(r), y = (P(m) ? e.columnsData[r] : e.axesData[r])[l];
472
- if (a !== void 0 && (s = s || y === a), u !== void 0 && (u.min !== void 0 || u.max !== void 0) && typeof y == "number") {
473
- let x = !0;
474
- u.min !== void 0 && (x = x && y >= u.min), u.max !== void 0 && (x = x && y <= u.max), s = s || x;
475
- }
476
- p === "subset" && (s = s || y != null);
477
- }
478
- s && (n[l] = 1);
479
- }
480
- return n;
481
- }
482
- var Q = class {
483
- constructor(t, e) {
484
- this.simpleComponentControllers = t, this.filterComponentControllers = e, this.ignoredOptionIdNames = [], this.dataInputs = [], this.dontAllowUnfilteredHighCardinality = !1;
485
- }
486
- get requiredComponents() {
487
- const t = [];
488
- for (const e of Object.keys(this.simpleComponentControllers))
489
- this.simpleComponentControllers[e].isRequired && t.push(e);
490
- return t;
491
- }
492
- get dimensionsConsumerComponents() {
493
- const t = [];
494
- for (const e of Object.keys(this.simpleComponentControllers))
495
- this.simpleComponentControllers[e].isDimensionsConsumer && t.push(e);
496
- for (const e of Object.keys(this.filterComponentControllers))
497
- this.filterComponentControllers[e].isDimensionsConsumer && t.push(e);
498
- return t;
499
- }
500
- addSelected(t, e, o) {
501
- if (t in this.simpleComponentControllers)
502
- return this.simpleComponentControllers[t].addSelected(e, o);
503
- if (t in this.filterComponentControllers)
504
- return this.filterComponentControllers[t].addSelected(e, o);
505
- throw Error(`Unknown input name: ${String(t)}`);
506
- }
507
- deleteSelected(t, e, o, n) {
508
- if (t in this.simpleComponentControllers)
509
- return this.simpleComponentControllers[t].deleteSelected(o, n.selectedSource);
510
- if (t in this.filterComponentControllers)
511
- return this.filterComponentControllers[t].deleteSelected(o, n.selectedSource);
512
- throw Error(`Unknown input name: ${String(t)}`);
513
- }
514
- changeSelected(t, e, o, n) {
515
- const l = o.components[t].selectorStates, s = l.filter((a) => !n.find((u) => u.selectedSource === a.selectedSource)), c = n.filter((a) => !l.find((u) => u.selectedSource === a.selectedSource));
516
- let r = me(o);
517
- return s.forEach((a) => {
518
- r = this.deleteSelected(t, e, r, a);
519
- }), c.forEach((a) => {
520
- r = this.addSelected(t, r, a);
521
- }), o.components[t].selectorStates = n.map(
522
- (a) => o.components[t].selectorStates.find(
523
- (u) => u.selectedSource === a.selectedSource
524
- )
525
- ).filter(Boolean), r;
526
- }
527
- switchDividableAxis(t, e) {
528
- return me(t);
529
- }
530
- async getMustBeConsumedAxes(t, e) {
531
- return Promise.resolve(/* @__PURE__ */ new Set());
532
- }
533
- createEmptyComponentsGuide(t) {
534
- return Object.fromEntries(
535
- Object.entries(t.components).map(
536
- ([e, o]) => [
537
- e,
538
- {
539
- options: [],
540
- optionsInfo: /* @__PURE__ */ new Map(),
541
- stateConsistency: {},
542
- required: !1,
543
- multipleSelectors: !1
544
- }
545
- ]
546
- )
547
- );
548
- }
549
- async getSelectedSourcesInfo(t, e, o, n, l) {
550
- var s;
551
- const c = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), a = [];
552
- for (const m of this.dataInputs)
553
- for (const y of e.components[m].selectorStates) {
554
- const x = A(y.selectedSource);
555
- if (P(x)) {
556
- const g = await t.pFrameProvider.getColumnSpecById(x);
557
- g && g.axesSpec.forEach((w) => {
558
- const C = _.fromAxisSpec(w).toCanonicalString();
559
- r.has(C) || (r.add(C), a.push(w));
560
- });
561
- }
562
- }
563
- const u = /* @__PURE__ */ new Set();
564
- let p = [...r];
565
- for (; p.length; ) {
566
- const m = [];
567
- for (const y of p)
568
- if (n[y]) {
569
- const x = Object.keys(n[y]);
570
- for (const g of x)
571
- !u.has(g) && !r.has(g) && (m.push(g), u.add(g));
572
- }
573
- p = m;
574
- }
575
- for (const [m, { selectorStates: y }] of Object.entries(e.components)) {
576
- const g = ((s = this.simpleComponentControllers[m]) != null ? s : this.filterComponentControllers[m]).settings.columnsWithExtraAxesAllowed;
577
- for (const { selectedSource: w } of y)
578
- await He(
579
- t,
580
- w,
581
- o[w],
582
- c,
583
- a,
584
- r,
585
- u,
586
- g,
587
- l
588
- );
589
- }
590
- return c;
591
- }
592
- getEmptyInputGuide(t) {
593
- return {
594
- components: this.createEmptyComponentsGuide(t),
595
- getSourceInfo: (e) => ge(e),
596
- freeOptionsSet: /* @__PURE__ */ new Set(),
597
- axesToBeFixedSet: /* @__PURE__ */ new Set(),
598
- readyData: !1,
599
- ready: !1,
600
- consistent: !0
601
- };
602
- }
603
- getConsumedOptionsSet(t) {
604
- const e = /* @__PURE__ */ new Set();
605
- for (const o of this.dimensionsConsumerComponents)
606
- for (const { selectedSource: n } of t.components[o].selectorStates)
607
- e.add(n);
608
- return e;
609
- }
610
- async getLabelsMap(t, e) {
611
- const o = await t.pFrameProvider.getColumnsFull(
612
- this.dataInputs.reduce((n, l) => {
613
- const c = e.components[l].selectorStates.map((r) => A(r.selectedSource));
614
- return n.concat(c);
615
- }, []),
616
- !1
617
- );
618
- return _e(o, (n) => n.spec).reduce((n, l) => {
619
- const s = new W({ name: l.value.columnId, type: l.value.spec.valueType }).toCanonicalString();
620
- return n[s] = l.label, n;
621
- }, {});
622
- }
623
- async calculateOptions(t, e, o = [], n = Xe) {
624
- var l, s;
625
- const c = this.createEmptyComponentsGuide(e), r = this.getConsumedOptionsSet(e), a = new Set(this.ignoredOptionIdNames), u = new Set(o), { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), y = await this.getLabelsMap(t, e), x = await this.getSelectedSourcesInfo(t, e, y, p, m), g = /* @__PURE__ */ new Map(), w = { ...this.simpleComponentControllers, ...this.filterComponentControllers }, C = /* @__PURE__ */ new Set();
626
- for (const [S, f] of Object.entries(w)) {
627
- const h = await f.getOptions(
628
- t,
629
- e,
630
- y,
631
- r,
632
- p,
633
- m,
634
- n,
635
- a,
636
- u
637
- );
638
- this.dataInputs.includes(S) || h.options.forEach((b) => {
639
- C.add(b.value);
640
- });
641
- for (const [b, O] of h.optionsInfo)
642
- g.set(b, O);
643
- c[S] = h;
644
- }
645
- const D = (S) => {
646
- const f = g.get(S);
647
- f && f.kind === "axis" && (f.mustBeConsumed = !0);
648
- const h = x.get(S);
649
- h && h.kind === "axis" && (h.mustBeConsumed = !0);
650
- }, B = await this.getMustBeConsumedAxes(t, e);
651
- for (const S of B)
652
- D(S);
653
- if (this.dontAllowUnfilteredHighCardinality) {
654
- const S = (h) => {
655
- var b;
656
- return ((b = h == null ? void 0 : h.annotations) == null ? void 0 : b[Me]) === "true";
657
- }, f = (s = (l = e.components.filters) == null ? void 0 : l.selectorStates.reduce((h, b) => {
658
- const O = x.get(b.selectedSource);
659
- return (O == null ? void 0 : O.kind) === "column" && O.spec.axesSpec.filter(S).forEach((L) => h.add(_.fromAxisSpec(L).toCanonicalString())), (O == null ? void 0 : O.kind) === "axis" && S(O.spec) && h.add(_.fromAxisSpec(O.spec).toCanonicalString()), h;
660
- }, /* @__PURE__ */ new Set())) != null ? s : /* @__PURE__ */ new Set();
661
- this.dataInputs.forEach((h) => {
662
- for (const { selectedSource: b } of e.components[h].selectorStates) {
663
- const O = x.get(b);
664
- if ((O == null ? void 0 : O.kind) === "column" && O.spec.axesSpec.filter(S).forEach((L) => {
665
- const N = _.fromAxisSpec(L).toCanonicalString();
666
- !C.has(N) && !f.has(N) && C.add(N), f.has(N) || D(N);
667
- }), (O == null ? void 0 : O.kind) === "axis" && S(O.spec)) {
668
- const E = _.fromAxisSpec(O.spec).toCanonicalString();
669
- C.has(E) || C.add(E), f.has(E) || D(E);
670
- }
671
- }
672
- });
673
- }
674
- const v = /* @__PURE__ */ new Set();
675
- for (const { selectorStates: S } of Object.values(e.components))
676
- for (const { selectedSource: f } of S) {
677
- const h = x.get(f);
678
- h && h.kind === "column" && h.axesToBeFixed.forEach((b) => {
679
- v.add(b);
680
- });
681
- }
682
- const d = await this.isConsistent(t, e, p, m), i = (S) => {
683
- var f, h, b;
684
- const O = (f = A(S).toCanonicalString()) != null ? f : S;
685
- return (b = (h = g.get(O)) != null ? h : x.get(O)) != null ? b : ge(S);
686
- };
687
- return {
688
- components: c,
689
- getSourceInfo: i,
690
- freeOptionsSet: C,
691
- axesToBeFixedSet: v,
692
- readyData: this.readyDataInputs(e),
693
- ready: this.readyForPlotBuilding(t, e, d, C, i),
694
- consistent: d
695
- };
696
- }
697
- async getUniqueSourceValuesWithLabels(t, e, o, n, l, s) {
698
- var c;
699
- const r = (p) => p.sort((m, y) => m.label.localeCompare(y.label, "en", { numeric: !0 })), a = e.getSourceInfo(o), u = (c = a.annotations) == null ? void 0 : c[Ge];
700
- try {
701
- const p = u ? JSON.parse(u).map((m) => String(m)) : null;
702
- if (p) {
703
- const m = p.map((y) => ({ value: y, label: y }));
704
- return r(m), { values: m, overflow: !1 };
705
- }
706
- } catch {
707
- console.error(`Parsing error: discrete values annotation ${u} in ${o}`);
708
- }
709
- if (a.kind === "axis") {
710
- const p = A(o), m = a.parentSources.map(A), y = await k(t, o, a.parentSources);
711
- let x = [];
712
- if (y) {
713
- l && (x = [{
714
- type: "bySingleColumnV2",
715
- column: {
716
- type: "column",
717
- id: y.name
718
- },
719
- predicate: {
720
- operator: "StringIContains",
721
- substring: l
722
- }
723
- }]), s && (x = [{
724
- type: "bySingleColumnV2",
725
- column: {
726
- type: "axis",
727
- id: p.toPFrameId()
728
- },
729
- predicate: {
730
- operator: "StringIContains",
731
- substring: s
732
- }
733
- }]);
734
- const { data: D, axesData: B } = await t.pFrameProvider.getSingleColumnData(y, x), v = B[p.toCanonicalString()], d = [];
735
- for (let i = 0; i < Math.min(v.length, n ?? v.length); i++)
736
- d.push({ value: String(v[i]), label: String(D[i]) });
737
- return r(d), { values: d, overflow: !(n === void 0 || v.length < n) };
738
- }
739
- const g = l ?? s;
740
- g && (x = [{
741
- type: "bySingleColumnV2",
742
- column: {
743
- type: "axis",
744
- id: p.toPFrameId()
745
- },
746
- predicate: {
747
- operator: "StringIContains",
748
- substring: g
749
- }
750
- }]);
751
- const w = await t.pFrameProvider.getAxisUniqueValues(p, [m[0]], n, x), C = w.values.map((D) => ({ value: String(D), label: String(D) }));
752
- return r(C), { values: C, overflow: w.overflow };
753
- }
754
- if (a.kind === "column") {
755
- const p = l ?? s, m = A(o), y = p ? [{
756
- type: "bySingleColumnV2",
757
- column: {
758
- type: "column",
759
- id: m.name
760
- },
761
- predicate: {
762
- operator: "StringIContains",
763
- substring: p
764
- }
765
- }] : [], x = await t.pFrameProvider.getColumnUniqueValues(m, n, y), g = x.values.map((w) => ({ value: String(w), label: String(w) }));
766
- return r(g), { values: g, overflow: x.overflow };
767
- }
768
- return { values: [], overflow: !1 };
769
- }
770
- async checkStateConsistency(t, e, o, n) {
771
- const l = /* @__PURE__ */ new Map();
772
- for (const s of Object.keys(this.simpleComponentControllers))
773
- l.set(
774
- s,
775
- await this.simpleComponentControllers[s].checkStateConsistency(t, e, o, n)
776
- );
777
- for (const s of Object.keys(this.filterComponentControllers))
778
- l.set(
779
- s,
780
- await this.filterComponentControllers[s].checkStateConsistency(t, e, o, n)
781
- );
782
- return l;
783
- }
784
- async isConsistent(t, e, o, n) {
785
- const l = await this.checkStateConsistency(t, e, o, n);
786
- for (const s of l.values())
787
- if (Object.values(s).some((c) => !c))
788
- return !1;
789
- return !0;
790
- }
791
- readyDataInputs(t) {
792
- return this.dataInputs.every((e) => t.components[e].selectorStates.length > 0);
793
- }
794
- readyForPlotBuilding(t, e, o, n, l) {
795
- if (!o || !this.readyDataInputs(e))
796
- return !1;
797
- let s = !1;
798
- for (const r of n) {
799
- const a = l(r);
800
- if (a && a.kind === "axis" && a.mustBeConsumed) {
801
- s = !0;
802
- break;
803
- }
804
- }
805
- let c = !1;
806
- for (const { selectorStates: r } of Object.values(e.components)) {
807
- for (const { selectedSource: a, fixedAxes: u } of r) {
808
- const p = l(a);
809
- if (p && p.kind === "column" && p.axesToBeFixed.some(
810
- (m) => {
811
- var y;
812
- return ((y = (u ?? []).find((x) => x.axisSource === m)) == null ? void 0 : y.axisValue) === void 0;
813
- }
814
- )) {
815
- c = !0;
816
- break;
817
- }
818
- }
819
- if (c)
820
- break;
821
- }
822
- return this.requiredComponents.every((r) => e.components[r].selectorStates.length > 0) && !s && !c;
823
- }
824
- async createDataForPlot(t, e) {
825
- return {
826
- data: await this.createDataByColumns(t, e),
827
- settings: await this.createChartSettings(t, e)
828
- };
829
- }
830
- }, Ze = (t) => {
831
- var e;
832
- return ((e = t == null ? void 0 : t.annotations) == null ? void 0 : e[Ce]) === "true";
833
- }, Pe = class Oe {
834
- constructor({
835
- componentName: e,
836
- allowedTypes: o,
837
- settings: n,
838
- strictlyDependsOnParents: l,
839
- dependsOn: s = [],
840
- parentComponents: c = [],
841
- annotations: r = {},
842
- checkSourceBySpec: a
843
- }) {
844
- this.componentName = e, this.allowedTypes = [...o], this.settings = { ...Oe.DefaultSettings, ...n }, this.dependsOn = [...s], this.parentComponents = [...c], this.strictlyDependsOnParents = l ?? !0, this.annotations = { ...r }, a && (this.checkSourceBySpec = a);
845
- }
846
- get isRequired() {
847
- return this.settings.required;
848
- }
849
- get isDimensionsConsumer() {
850
- return this.settings.dimensionConsumer;
851
- }
852
- addSelected(e, o) {
853
- const n = me(e);
854
- return n.components[this.componentName].selectorStates.push(o), n;
855
- }
856
- deleteSelected(e, o) {
857
- const n = me(e);
858
- return n.components[this.componentName].selectorStates = n.components[this.componentName].selectorStates.filter((l) => l.selectedSource !== o), n;
859
- }
860
- async checkStateConsistency(e, o, n, l) {
861
- const s = o.components[this.componentName], { parentAxes: c, linkerAxes: r } = await this.getAllowedAxes(e, o, n);
862
- function a(p) {
863
- const m = _.fromAxisSpec(p).toCanonicalString();
864
- return c.has(m) || r.has(m);
865
- }
866
- const u = await Promise.all(
867
- s.selectorStates.map(async ({ selectedSource: p }) => {
868
- const m = A(p);
869
- if (P(m)) {
870
- const y = await e.pFrameProvider.getColumnSpecById(m);
871
- if (!y)
872
- return !1;
873
- if (this.parentComponents.length === 0)
874
- return !0;
875
- if (this.strictlyDependsOnParents && !this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent)
876
- return y.axesSpec.every((g) => a(g));
877
- if (this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent) {
878
- if (y.axesSpec.some((w) => a(w)))
879
- return !0;
880
- const g = te(y.axesSpec);
881
- return g ? g.some((w) => l.has(j(w))) : !1;
882
- } else
883
- return c.size === 0 || y.axesSpec.some((g) => a(g));
884
- }
885
- return c.has(p);
886
- })
887
- );
888
- return s.selectorStates.reduce(
889
- (p, m, y) => (p[m.selectedSource] = u[y], p),
890
- {}
891
- );
892
- }
893
- async getProducingAxes(e, o) {
894
- const s = o.components[this.componentName].selectorStates.map((a) => A(a.selectedSource)).filter((a) => P(a)), c = /* @__PURE__ */ new Set();
895
- return (await Promise.all(
896
- s.map((a) => e.pFrameProvider.getColumnSpecById(a))
897
- )).forEach((a) => {
898
- a && a.axesSpec.forEach((u) => {
899
- c.add(_.fromAxisSpec(u).toCanonicalString());
900
- });
901
- }), c;
902
- }
903
- getParentSelectedSources(e, o) {
904
- return this.parentComponents.reduce((l, s) => {
905
- const c = o.components[s].selectorStates.map(
906
- (r) => A(r.selectedSource)
907
- );
908
- return l.push(...c), l;
909
- }, []);
910
- }
911
- async getParentAxes(e, o) {
912
- var n;
913
- const l = this.getParentSelectedSources(e, o), s = /* @__PURE__ */ new Set();
914
- for (const c of l)
915
- if (P(c)) {
916
- const r = await e.pFrameProvider.getColumnSpecById(c);
917
- (n = r == null ? void 0 : r.axesSpec) == null || n.forEach((a) => {
918
- const u = _.fromAxisSpec(a);
919
- s.add(u.toCanonicalString());
920
- });
921
- }
922
- return s;
923
- }
924
- async getAllowedAxes(e, o, n) {
925
- var l, s, c, r, a, u, p;
926
- const m = this.getParentSelectedSources(e, o), y = /* @__PURE__ */ new Set(), x = [], g = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map();
927
- for (const D of m)
928
- if (P(D)) {
929
- const B = await e.pFrameProvider.getColumnSpecById(D);
930
- for (const v of (l = B == null ? void 0 : B.axesSpec) != null ? l : []) {
931
- const i = _.fromAxisSpec(v).toCanonicalString();
932
- if (y.has(i))
933
- continue;
934
- y.add(i), x.push(v);
935
- const S = Ie(v);
936
- w.set(i, {
937
- kind: "axis",
938
- name: v.name,
939
- label: await T(e, i, [
940
- D.toCanonicalString()
941
- ]),
942
- type: v.type,
943
- mustBeConsumed: S,
944
- dividable: !1,
945
- spec: v,
946
- annotations: v.annotations,
947
- isSubsetFilter: ((s = v.annotations) == null ? void 0 : s[$]) === "true",
948
- isDiscreteFilter: v.type === "String" || ((c = v.annotations) == null ? void 0 : c[ee]) === "true",
949
- parentSources: [D.toCanonicalString()]
950
- });
951
- }
952
- }
953
- let C = [...y];
954
- for (; C.length; ) {
955
- const D = [];
956
- for (const B of C)
957
- if (n[B]) {
958
- const v = Object.keys(n[B]);
959
- for (const d of v)
960
- if (!g.has(d)) {
961
- D.push(d), g.add(d);
962
- const { spec: i, id: S } = n[B][d];
963
- for (const f of i.axesSpec) {
964
- const h = _.fromAxisSpec(f).toCanonicalString();
965
- w.has(h) || w.set(h, {
966
- kind: "axis",
967
- name: f.name,
968
- label: (a = (r = f.annotations) == null ? void 0 : r[we]) != null ? a : "",
969
- type: f.type,
970
- mustBeConsumed: !1,
971
- dividable: !1,
972
- spec: f,
973
- annotations: f.annotations,
974
- isSubsetFilter: ((u = f.annotations) == null ? void 0 : u[$]) === "true",
975
- isDiscreteFilter: f.type === "String" || ((p = f.annotations) == null ? void 0 : p[ee]) === "true",
976
- parentSources: [S.toCanonicalString()]
977
- });
978
- }
979
- }
980
- }
981
- C = D;
982
- }
983
- return { parentAxes: y, parentAxesList: x, linkerAxes: g, optionsInfo: w };
984
- }
985
- async getOptions(e, o, n, l, s, c, r, a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set()) {
986
- var p, m, y, x, g;
987
- const w = this.settings.multipleSelectors, C = this.settings.required, D = await this.checkStateConsistency(e, o, s, c);
988
- if (this.dependsOn.length && this.dependsOn.some((O) => o.components[O].selectorStates.length === 0))
989
- return { multipleSelectors: w, required: C, stateConsistency: D, options: [], optionsInfo: /* @__PURE__ */ new Map() };
990
- if (this.strictlyDependsOnParents && !this.settings.isDataComponent && this.parentComponents.some((O) => o.components[O].selectorStates.length === 0))
991
- return { multipleSelectors: w, required: C, stateConsistency: D, options: [], optionsInfo: /* @__PURE__ */ new Map() };
992
- const B = this.getParentSelectedSources(e, o), v = (await e.pFrameProvider.getColumns([], !1, this.allowedTypes, void 0, this.annotations)).filter((O) => !l.has(O.toCanonicalString())), { parentAxes: d, linkerAxes: i, parentAxesList: S, optionsInfo: f } = await this.getAllowedAxes(e, o, s), h = o.components[this.componentName], b = [];
993
- if (this.settings.axesAllowed)
994
- for (const O of d) {
995
- const E = A(O), L = f.get(E.toCanonicalString()), N = this.allowedTypes.includes(L.spec.type), F = Object.entries(this.annotations).every(
996
- ([oe, q]) => {
997
- var U;
998
- return ((U = L.spec.annotations) == null ? void 0 : U[oe]) === q;
999
- }
1000
- ), G = this.checkSourceBySpec ? this.checkSourceBySpec(L.spec, o) : !0, M = !this.settings.homogeneous || !(L != null && L.mustBeConsumed), K = !l.has(O), Z = a.has(E.name) || u.has(E.toCanonicalString()), ne = h.selectorStates.some((oe) => oe.selectedSource === O);
1001
- N && F && G && M && K && !Z && !ne && b.push({ value: O });
1002
- }
1003
- if (this.settings.columnsAllowed) {
1004
- const O = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents;
1005
- for (const E of v) {
1006
- const L = E.toCanonicalString(), N = A(L), F = await e.pFrameProvider.getColumnSpecById(N);
1007
- if (!F)
1008
- continue;
1009
- const G = De(
1010
- F,
1011
- S,
1012
- d,
1013
- i,
1014
- c
1015
- ).map((q) => _.fromAxisSpec(q).toCanonicalString()), M = new Set(G);
1016
- if (
1017
- // do not add to available options label columns, or columns that are not fit by custom spec condition, or columns that are not fit by condition for data inputs
1018
- Le(F) || Ze(F) || this.checkSourceBySpec && !this.checkSourceBySpec(F, o) || this.settings.isDataComponent && !r(F) || O && G.length > 0 || B.length && G.length > 0 && !F.axesSpec.some((q) => {
1019
- const U = _.fromAxisSpec(q).toCanonicalString();
1020
- return d.has(U) || i.has(U);
1021
- })
1022
- )
1023
- continue;
1024
- const K = (m = (p = F == null ? void 0 : F.axesSpec) == null ? void 0 : p.map((q) => _.fromAxisSpec(q).toCanonicalString())) != null ? m : [], Z = {};
1025
- if (this.settings.columnsWithExtraAxesAllowed && K.forEach((q, U) => {
1026
- M.has(q) && (Z[q] = U);
1027
- }), F) {
1028
- const q = (y = n[L]) != null ? y : await T(e, E.toCanonicalString(), []), U = {
1029
- kind: "column",
1030
- name: F.name,
1031
- label: q,
1032
- type: F.valueType,
1033
- spec: F,
1034
- annotations: F.annotations,
1035
- isSubsetFilter: ((x = F.annotations) == null ? void 0 : x[$]) === "true",
1036
- isDiscreteFilter: F.valueType === "String" || ((g = F.annotations) == null ? void 0 : g[ee]) === "true",
1037
- axesToBeFixed: G,
1038
- axesToBeFixedIndexes: Z
1039
- };
1040
- f.set(N.toCanonicalString(), U);
1041
- }
1042
- const ne = a.has(N.name) || u.has(N.toCanonicalString()), oe = o.components[this.componentName].selectorStates.some(
1043
- (q) => q.selectedSource === L
1044
- );
1045
- !ne && !oe && b.push({ value: L });
1046
- }
1047
- }
1048
- return { multipleSelectors: w, required: C, stateConsistency: D, options: b, optionsInfo: f };
1049
- }
1050
- };
1051
- Pe.DefaultSettings = {
1052
- isDataComponent: !1,
1053
- multipleSelectors: !1,
1054
- required: !1,
1055
- homogeneous: !1,
1056
- axesAllowed: !1,
1057
- columnsAllowed: !0,
1058
- columnsWithExtraAxesAllowed: !0,
1059
- dimensionConsumer: !1
1060
- };
1061
- var I = Pe, et = {
1062
- type: "bubble",
1063
- components: {
1064
- valueSize: { type: "simple", selectorStates: [] },
1065
- valueColor: { type: "simple", selectorStates: [] },
1066
- x: { type: "simple", selectorStates: [] },
1067
- y: { type: "simple", selectorStates: [] },
1068
- filters: { type: "filter", selectorStates: [] },
1069
- tabBy: { type: "filter", selectorStates: [] },
1070
- facetBy: { type: "simple", selectorStates: [] },
1071
- tooltipContent: { type: "simple", selectorStates: [] }
1072
- },
1073
- dividedAxes: {}
1074
- };
1075
- function re(t, e) {
1076
- if (!e.length)
1077
- return [];
1078
- const o = e.map((s) => A(s)), n = Object.values(t.columnsData)[0].length, l = [];
1079
- for (let s = 0; s < n; s++) {
1080
- const c = o.map((r) => {
1081
- const a = r.toCanonicalString();
1082
- return P(r) ? t.columnsData[a][s] : t.axesData[a][s];
1083
- }).join(", ");
1084
- l.push(c);
1085
- }
1086
- return l;
1087
- }
1088
- var tt = class extends Q {
1089
- constructor() {
1090
- super({
1091
- valueSize: new I({
1092
- componentName: "valueSize",
1093
- allowedTypes: ["Int", "Long", "Double", "Float"],
1094
- strictlyDependsOnParents: !0,
1095
- parentComponents: ["valueColor"],
1096
- settings: {
1097
- isDataComponent: !0,
1098
- columnsAllowed: !0,
1099
- axesAllowed: !1,
1100
- required: !0
1101
- }
1102
- }),
1103
- valueColor: new I({
1104
- componentName: "valueColor",
1105
- allowedTypes: ["Int", "Long", "Double", "Float"],
1106
- strictlyDependsOnParents: !0,
1107
- parentComponents: ["valueSize"],
1108
- settings: {
1109
- isDataComponent: !0,
1110
- columnsAllowed: !0,
1111
- axesAllowed: !1,
1112
- required: !0
1113
- }
1114
- }),
1115
- x: new I({
1116
- componentName: "x",
1117
- allowedTypes: ["Int", "String", "Long"],
1118
- strictlyDependsOnParents: !0,
1119
- parentComponents: ["valueSize", "valueColor"],
1120
- settings: {
1121
- required: !0,
1122
- dimensionConsumer: !0,
1123
- multipleSelectors: !0,
1124
- axesAllowed: !0,
1125
- columnsAllowed: !1
1126
- }
1127
- }),
1128
- y: new I({
1129
- componentName: "y",
1130
- allowedTypes: ["Int", "String", "Long"],
1131
- strictlyDependsOnParents: !0,
1132
- parentComponents: ["valueSize", "valueColor"],
1133
- settings: {
1134
- required: !0,
1135
- dimensionConsumer: !0,
1136
- multipleSelectors: !0,
1137
- axesAllowed: !0,
1138
- columnsAllowed: !1
1139
- }
1140
- }),
1141
- tooltipContent: new I({
1142
- componentName: "tooltipContent",
1143
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
1144
- strictlyDependsOnParents: !0,
1145
- parentComponents: ["valueSize", "valueColor"],
1146
- settings: {
1147
- columnsAllowed: !0,
1148
- axesAllowed: !0,
1149
- multipleSelectors: !0
1150
- }
1151
- }),
1152
- facetBy: new I({
1153
- componentName: "facetBy",
1154
- allowedTypes: ["String", "Int", "Long"],
1155
- strictlyDependsOnParents: !0,
1156
- parentComponents: ["valueSize", "valueColor"],
1157
- settings: {
1158
- axesAllowed: !0,
1159
- dimensionConsumer: !0,
1160
- multipleSelectors: !0
1161
- }
1162
- })
1163
- }, {
1164
- filters: new I({
1165
- componentName: "filters",
1166
- allowedTypes: ["String", "Int", "Long", "Double", "Long"],
1167
- strictlyDependsOnParents: !0,
1168
- parentComponents: ["valueSize", "valueColor"],
1169
- settings: {
1170
- columnsAllowed: !0,
1171
- axesAllowed: !0,
1172
- dimensionConsumer: !0,
1173
- multipleSelectors: !0
1174
- },
1175
- checkSourceBySpec: R
1176
- }),
1177
- tabBy: new I({
1178
- componentName: "tabBy",
1179
- allowedTypes: ["String", "Int"],
1180
- strictlyDependsOnParents: !0,
1181
- parentComponents: ["valueSize", "valueColor"],
1182
- settings: {
1183
- columnsAllowed: !0,
1184
- axesAllowed: !0,
1185
- dimensionConsumer: !0
1186
- }
1187
- })
1188
- }), this.dataInputs = ["valueSize", "valueColor"], this.dontAllowUnfilteredHighCardinality = !0;
1189
- }
1190
- async getMustBeConsumedAxes(t, e) {
1191
- if (!e.components.valueColor.selectorStates.length)
1192
- return /* @__PURE__ */ new Set();
1193
- const o = e.components.valueColor.selectorStates[0].selectedSource, n = await t.pFrameProvider.getColumnSpecById(A(o));
1194
- return n ? new Set(n.axesSpec.map((l) => _.fromAxisSpec(l).toCanonicalString())) : /* @__PURE__ */ new Set();
1195
- }
1196
- async createDataByColumns(t, e) {
1197
- var o, n, l;
1198
- const s = (o = e.components.valueColor.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.valueSize.selectorStates[0]) == null ? void 0 : n.selectedSource;
1199
- if (!s || !c)
1200
- throw Error("Value column is not valid");
1201
- const r = A(s), a = A(c);
1202
- if (!r || !a || !P(r) && !P(a))
1203
- throw Error("Value column is not valid");
1204
- const u = {
1205
- type: "columns",
1206
- id: (l = z(e.components)) != null ? l : "",
1207
- values: {}
1208
- }, { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), y = [
1209
- ...e.components.filters.selectorStates,
1210
- ...e.components.tabBy.selectorStates
1211
- ], x = Y(y), g = y.map((F) => A(F.selectedSource)).filter(P), w = [r, a].filter(P), C = w.map((F) => F.toCanonicalString()), D = await J(t, C), B = [
1212
- e.components.facetBy,
1213
- e.components.x,
1214
- e.components.y,
1215
- e.components.tooltipContent
1216
- ], v = [], d = w.map(() => []), i = [], S = [];
1217
- for (const { selectedSource: F, fixedAxes: G } of y)
1218
- S.push(...await V(
1219
- t,
1220
- p,
1221
- m,
1222
- D,
1223
- F,
1224
- G
1225
- )), d.push(
1226
- (G ?? []).map(({ axisIdx: M, axisValue: K }) => ({ idx: M, value: K }))
1227
- );
1228
- for (const F of B)
1229
- for (const { selectedSource: G, fixedAxes: M } of F.selectorStates) {
1230
- v.push(A(G)), i.push(
1231
- (M ?? []).map(({ axisIdx: Z, axisValue: ne }) => ({ idx: Z, value: ne }))
1232
- ), S.push(...await V(
1233
- t,
1234
- p,
1235
- m,
1236
- D,
1237
- G,
1238
- M
1239
- ));
1240
- const K = await k(t, G, C);
1241
- K && v.push(K);
1242
- }
1243
- const f = await t.pFrameProvider.getTableOuterJoin(
1244
- [...w, ...S, ...g],
1245
- v,
1246
- x,
1247
- !0,
1248
- d,
1249
- i
1250
- );
1251
- v.forEach((F) => {
1252
- const G = F.toCanonicalString();
1253
- u.values[G] = P(F) ? f.columnsData[G] : f.axesData[G];
1254
- }), u.values[s] = P(r) ? f.columnsData[s] : f.axesData[s], u.values[c] = P(a) ? f.columnsData[c] : f.axesData[c];
1255
- const h = e.components.x.selectorStates.map((F) => F.selectedSource), b = h.join(", "), O = await Promise.all(h.map(
1256
- async (F) => {
1257
- var G, M;
1258
- return (M = (G = await k(t, F, C)) == null ? void 0 : G.toCanonicalString()) != null ? M : F;
1259
- }
1260
- ));
1261
- u.values[b] = re(f, h), u.values.xLabels = re(f, O);
1262
- const E = e.components.y.selectorStates.map((F) => F.selectedSource), L = E.join(", "), N = await Promise.all(E.map(
1263
- async (F) => {
1264
- var G, M;
1265
- return (M = (G = await k(t, F, C)) == null ? void 0 : G.toCanonicalString()) != null ? M : F;
1266
- }
1267
- ));
1268
- return u.values[L] = re(f, E), u.values.yLabels = re(f, N), { byColumns: u };
1269
- }
1270
- async createChartSettings(t, e) {
1271
- var o, n;
1272
- const l = (o = e.components.valueColor.selectorStates[0]) == null ? void 0 : o.selectedSource, s = (n = e.components.valueSize.selectorStates[0]) == null ? void 0 : n.selectedSource;
1273
- if (!l || !s)
1274
- throw Error("Value column is not valid");
1275
- const c = A(l), r = A(s);
1276
- if (!P(c) && !P(r))
1277
- throw Error("Value column is not valid");
1278
- const a = [c, r].filter(P).map((v) => v.toCanonicalString()), u = {
1279
- type: "column",
1280
- value: l,
1281
- label: await T(t, l, [])
1282
- }, p = {
1283
- type: "column",
1284
- value: s,
1285
- label: await T(t, s, [])
1286
- }, y = e.components.x.selectorStates.map(({ selectedSource: v }) => v).join(", "), g = e.components.y.selectorStates.map(({ selectedSource: v }) => v).join(", "), w = await Promise.all(e.components.facetBy.selectorStates.map(async (v) => {
1287
- var d, i;
1288
- return {
1289
- type: "column",
1290
- value: (i = (d = await k(t, v.selectedSource, a)) == null ? void 0 : d.toCanonicalString()) != null ? i : v.selectedSource
1291
- };
1292
- })), C = (await Promise.all(e.components.x.selectorStates.map((v) => T(t, v.selectedSource, a)))).join(", "), D = (await Promise.all(e.components.y.selectorStates.map((v) => T(t, v.selectedSource, a)))).join(", "), B = await Promise.all(
1293
- e.components.tooltipContent.selectorStates.map(async (v) => {
1294
- var d, i;
1295
- const S = v.selectedSource;
1296
- return {
1297
- type: "column",
1298
- label: await T(t, S, a) || S,
1299
- value: S,
1300
- valueLabels: (i = (d = await k(t, S, a)) == null ? void 0 : d.toCanonicalString()) != null ? i : S
1301
- };
1302
- })
1303
- );
1304
- return {
1305
- type: "bubble",
1306
- valueColor: u,
1307
- valueSize: p,
1308
- xColumn: {
1309
- type: "column",
1310
- value: y,
1311
- label: C,
1312
- valueLabels: "xLabels"
1313
- },
1314
- yColumn: {
1315
- type: "column",
1316
- value: g,
1317
- label: D,
1318
- valueLabels: "yLabels"
1319
- },
1320
- facetBy: w,
1321
- tooltips: {
1322
- show: !0,
1323
- content: B
1324
- }
1325
- };
1326
- }
1327
- }, nt = {
1328
- type: "histogram",
1329
- components: {
1330
- value: { type: "simple", selectorStates: [] },
1331
- grouping: { type: "simple", selectorStates: [] },
1332
- filters: { type: "filter", selectorStates: [] },
1333
- tabBy: { type: "filter", selectorStates: [] },
1334
- facetBy: { type: "simple", selectorStates: [] }
1335
- },
1336
- dividedAxes: {}
1337
- }, ot = class extends Q {
1338
- constructor() {
1339
- super(
1340
- {
1341
- value: new I({
1342
- componentName: "value",
1343
- allowedTypes: ["Int", "Long", "Double", "Float"],
1344
- settings: {
1345
- isDataComponent: !0,
1346
- columnsAllowed: !0,
1347
- axesAllowed: !1,
1348
- required: !0
1349
- }
1350
- }),
1351
- grouping: new I({
1352
- componentName: "grouping",
1353
- allowedTypes: ["String", "Int", "Long"],
1354
- parentComponents: ["value"],
1355
- dependsOn: ["value"],
1356
- settings: {
1357
- axesAllowed: !0,
1358
- multipleSelectors: !1
1359
- }
1360
- }),
1361
- facetBy: new I({
1362
- componentName: "facetBy",
1363
- allowedTypes: ["String", "Int", "Long"],
1364
- parentComponents: ["value"],
1365
- dependsOn: ["value"],
1366
- settings: {
1367
- axesAllowed: !0,
1368
- dimensionConsumer: !0,
1369
- multipleSelectors: !0
1370
- }
1371
- })
1372
- },
1373
- {
1374
- filters: new I({
1375
- componentName: "filters",
1376
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
1377
- parentComponents: ["value"],
1378
- dependsOn: ["value"],
1379
- settings: {
1380
- columnsAllowed: !0,
1381
- axesAllowed: !0,
1382
- dimensionConsumer: !0,
1383
- multipleSelectors: !0
1384
- },
1385
- checkSourceBySpec: R
1386
- }),
1387
- tabBy: new I({
1388
- componentName: "tabBy",
1389
- allowedTypes: ["String", "Int"],
1390
- parentComponents: ["value"],
1391
- dependsOn: ["value"],
1392
- settings: {
1393
- columnsAllowed: !0,
1394
- axesAllowed: !0,
1395
- dimensionConsumer: !0
1396
- }
1397
- })
1398
- }
1399
- ), this.dataInputs = ["value"];
1400
- }
1401
- async createDataByColumns(t, e) {
1402
- var o, n;
1403
- const l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1404
- if (!l)
1405
- throw Error("Value column is not valid");
1406
- const s = A(l);
1407
- if (!P(s))
1408
- throw Error("Value column is not valid");
1409
- const c = {
1410
- type: "columns",
1411
- id: (n = z(e.components)) != null ? n : "",
1412
- values: {}
1413
- }, { linkerColumnsMap: r, compositeLinkerMap: a } = await X(t), u = [
1414
- ...e.components.filters.selectorStates,
1415
- ...e.components.tabBy.selectorStates
1416
- ], p = Y(u), m = u.map((d) => A(d.selectedSource)).filter(P), y = [l], x = await J(t, y), g = [e.components.facetBy, e.components.grouping], w = [], C = [[]], D = [], B = [];
1417
- for (const { selectedSource: d, fixedAxes: i } of u)
1418
- B.push(
1419
- ...await V(t, r, a, x, d, i)
1420
- ), C.push(
1421
- (i ?? []).map(({ axisIdx: S, axisValue: f }) => ({ idx: S, value: f }))
1422
- );
1423
- for (const d of g)
1424
- for (const { selectedSource: i, fixedAxes: S } of d.selectorStates) {
1425
- w.push(A(i)), D.push(
1426
- (S ?? []).map(({ axisIdx: h, axisValue: b }) => ({ idx: h, value: b }))
1427
- ), B.push(
1428
- ...await V(t, r, a, x, i, S)
1429
- );
1430
- const f = await k(t, i, y);
1431
- f && w.push(f);
1432
- }
1433
- const v = await t.pFrameProvider.getTableOuterJoin(
1434
- [s, ...B, ...m],
1435
- w,
1436
- p,
1437
- !0,
1438
- C,
1439
- D
1440
- );
1441
- return w.forEach((d) => {
1442
- const i = d.toCanonicalString();
1443
- c.values[i] = P(d) ? v.columnsData[i] : v.axesData[i];
1444
- }), c.values[s.toCanonicalString()] = v.columnsData[s.toCanonicalString()], { byColumns: c };
1445
- }
1446
- async createChartSettings(t, e) {
1447
- var o, n;
1448
- const l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1449
- if (!l)
1450
- throw Error("Value column is not valid");
1451
- const s = A(l);
1452
- if (!P(s))
1453
- throw Error("Value column is not valid");
1454
- const c = [l], r = {
1455
- type: "column",
1456
- value: l,
1457
- label: await T(t, l, [])
1458
- }, a = await Promise.all(
1459
- e.components.facetBy.selectorStates.map(async (p) => {
1460
- var m, y;
1461
- return {
1462
- type: "column",
1463
- value: (y = (m = await k(t, p.selectedSource, c)) == null ? void 0 : m.toCanonicalString()) != null ? y : p.selectedSource
1464
- };
1465
- })
1466
- );
1467
- let u;
1468
- if (e.components.grouping.selectorStates.length) {
1469
- const { selectedSource: p } = e.components.grouping.selectorStates[0];
1470
- u = {
1471
- type: "column",
1472
- value: p,
1473
- label: await T(t, p, c),
1474
- valueLabels: (n = await k(t, p, c)) == null ? void 0 : n.toCanonicalString()
1475
- };
1476
- }
1477
- return {
1478
- type: "histogram",
1479
- valueColumn: r,
1480
- facetBy: a,
1481
- grouping: u
1482
- };
1483
- }
1484
- }, st = {
1485
- type: "discrete",
1486
- components: {
1487
- y: { type: "simple", selectorStates: [] },
1488
- filters: { type: "filter", selectorStates: [] },
1489
- tabBy: { type: "filter", selectorStates: [] },
1490
- facetBy: { type: "simple", selectorStates: [] },
1491
- primaryGrouping: { type: "simple", selectorStates: [] },
1492
- secondaryGrouping: { type: "simple", selectorStates: [] }
1493
- },
1494
- dividedAxes: {}
1495
- }, lt = class extends Q {
1496
- constructor() {
1497
- super(
1498
- {
1499
- y: new I({
1500
- componentName: "y",
1501
- allowedTypes: ["Int", "Double", "Long", "Float"],
1502
- settings: { isDataComponent: !0 }
1503
- }),
1504
- primaryGrouping: new I({
1505
- componentName: "primaryGrouping",
1506
- allowedTypes: ["String", "Int", "Long"],
1507
- strictlyDependsOnParents: !0,
1508
- parentComponents: ["y"],
1509
- dependsOn: ["y"],
1510
- settings: {
1511
- axesAllowed: !0,
1512
- homogeneous: !0
1513
- }
1514
- }),
1515
- secondaryGrouping: new I({
1516
- componentName: "secondaryGrouping",
1517
- allowedTypes: ["String", "Int", "Long"],
1518
- strictlyDependsOnParents: !0,
1519
- parentComponents: ["y"],
1520
- dependsOn: ["primaryGrouping"],
1521
- settings: {
1522
- axesAllowed: !0,
1523
- homogeneous: !0
1524
- }
1525
- }),
1526
- facetBy: new I({
1527
- componentName: "facetBy",
1528
- allowedTypes: ["String", "Int", "Long"],
1529
- strictlyDependsOnParents: !0,
1530
- parentComponents: ["y"],
1531
- dependsOn: ["y"],
1532
- settings: {
1533
- axesAllowed: !0,
1534
- dimensionConsumer: !0,
1535
- multipleSelectors: !0
1536
- }
1537
- })
1538
- },
1539
- {
1540
- filters: new I({
1541
- componentName: "filters",
1542
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
1543
- strictlyDependsOnParents: !0,
1544
- parentComponents: ["y"],
1545
- dependsOn: ["y"],
1546
- settings: {
1547
- axesAllowed: !0,
1548
- dimensionConsumer: !0,
1549
- multipleSelectors: !0
1550
- },
1551
- checkSourceBySpec: R
1552
- }),
1553
- tabBy: new I({
1554
- componentName: "tabBy",
1555
- allowedTypes: ["String", "Int"],
1556
- strictlyDependsOnParents: !0,
1557
- parentComponents: ["y"],
1558
- dependsOn: ["y"],
1559
- settings: {
1560
- axesAllowed: !0,
1561
- dimensionConsumer: !0
1562
- }
1563
- })
1564
- }
1565
- ), this.dataInputs = ["y"], this.dontAllowUnfilteredHighCardinality = !0;
1566
- }
1567
- async createDataByColumns(t, e) {
1568
- var o;
1569
- const n = e.components.y.selectorStates[0].selectedSource, l = A(n);
1570
- if (!n || !P(l))
1571
- throw Error("Y column is not valid");
1572
- const s = {
1573
- type: "columns",
1574
- id: (o = z(e.components)) != null ? o : "",
1575
- values: {}
1576
- }, { linkerColumnsMap: c, compositeLinkerMap: r } = await X(t), a = [
1577
- ...e.components.filters.selectorStates,
1578
- ...e.components.tabBy.selectorStates
1579
- ], u = Y(a), p = a.map((v) => A(v.selectedSource)).filter(P), m = [n], y = await J(t, m), x = [e.components.primaryGrouping, e.components.secondaryGrouping, e.components.facetBy], g = [], w = [[]], C = [], D = [];
1580
- for (const { selectedSource: v, fixedAxes: d } of a)
1581
- D.push(...await V(
1582
- t,
1583
- c,
1584
- r,
1585
- y,
1586
- v,
1587
- d
1588
- )), w.push(
1589
- (d ?? []).map(({ axisIdx: i, axisValue: S }) => ({ idx: i, value: S }))
1590
- );
1591
- for (const v of x)
1592
- for (const { selectedSource: d, fixedAxes: i } of v.selectorStates) {
1593
- g.push(A(d)), C.push(
1594
- (i ?? []).map(({ axisIdx: f, axisValue: h }) => ({ idx: f, value: h }))
1595
- ), D.push(...await V(
1596
- t,
1597
- c,
1598
- r,
1599
- y,
1600
- d,
1601
- i
1602
- ));
1603
- const S = await k(t, d, m);
1604
- S && g.push(S);
1605
- }
1606
- const B = await t.pFrameProvider.getTableOuterJoin(
1607
- [l, ...D, ...p],
1608
- g,
1609
- u,
1610
- !0,
1611
- w,
1612
- C
1613
- );
1614
- return g.forEach((v) => {
1615
- const d = v.toCanonicalString();
1616
- s.values[d] = P(v) ? B.columnsData[d] : B.axesData[d];
1617
- }), s.values[l.toCanonicalString()] = B.columnsData[l.toCanonicalString()], { byColumns: s };
1618
- }
1619
- async createChartSettings(t, e) {
1620
- var o, n;
1621
- const l = e.components.y.selectorStates[0].selectedSource, s = A(l);
1622
- if (!l || !P(s))
1623
- throw Error("Y column is not valid");
1624
- const c = {
1625
- type: "column",
1626
- value: l,
1627
- label: await T(t, l, [])
1628
- }, r = [l];
1629
- let a;
1630
- if (e.components.primaryGrouping.selectorStates.length) {
1631
- const { selectedSource: m } = e.components.primaryGrouping.selectorStates[0];
1632
- a = {
1633
- columnName: {
1634
- type: "column",
1635
- value: m,
1636
- label: await T(t, m, r),
1637
- valueLabels: (o = await k(
1638
- t,
1639
- m,
1640
- r
1641
- )) == null ? void 0 : o.toCanonicalString()
1642
- }
1643
- };
1644
- }
1645
- let u;
1646
- if (e.components.secondaryGrouping.selectorStates.length) {
1647
- const { selectedSource: m } = e.components.secondaryGrouping.selectorStates[0];
1648
- u = {
1649
- columnName: {
1650
- type: "column",
1651
- value: m,
1652
- label: await T(t, m, r),
1653
- valueLabels: (n = await k(
1654
- t,
1655
- m,
1656
- r
1657
- )) == null ? void 0 : n.toCanonicalString()
1658
- }
1659
- };
1660
- }
1661
- const p = await Promise.all(e.components.facetBy.selectorStates.map(async (m) => {
1662
- var y, x;
1663
- return {
1664
- type: "column",
1665
- value: (x = (y = await k(t, m.selectedSource, r)) == null ? void 0 : y.toCanonicalString()) != null ? x : m.selectedSource,
1666
- label: await T(t, m.selectedSource, r)
1667
- };
1668
- }));
1669
- return {
1670
- type: "discrete",
1671
- y: c,
1672
- primaryGrouping: a,
1673
- secondaryGrouping: u,
1674
- facetBy: p
1675
- };
1676
- }
1677
- }, at = {
1678
- type: "heatmap",
1679
- components: {
1680
- value: { type: "simple", selectorStates: [] },
1681
- x: { type: "simple", selectorStates: [] },
1682
- y: { type: "simple", selectorStates: [] },
1683
- xGroupBy: { type: "simple", selectorStates: [] },
1684
- yGroupBy: { type: "simple", selectorStates: [] },
1685
- filters: { type: "filter", selectorStates: [] },
1686
- tabBy: { type: "filter", selectorStates: [] },
1687
- facetBy: { type: "simple", selectorStates: [] },
1688
- annotationsX: { type: "simple", selectorStates: [] },
1689
- annotationsY: { type: "simple", selectorStates: [] },
1690
- tooltipContent: { type: "simple", selectorStates: [] }
1691
- },
1692
- dividedAxes: {}
1693
- };
1694
- function de(t) {
1695
- return t ? "kind" in t && t.kind === "PColumn" ? t.valueType === "String" : t.type === "String" : !0;
1696
- }
1697
- function ce(t, e) {
1698
- if (!e.length)
1699
- return [];
1700
- const o = e.map((s) => A(s)), n = Object.values(t.columnsData)[0].length, l = [];
1701
- for (let s = 0; s < n; s++) {
1702
- const c = o.map((r) => {
1703
- const a = r.toCanonicalString();
1704
- return P(r) ? t.columnsData[a][s] : t.axesData[a][s];
1705
- }).join(", ");
1706
- l.push(c);
1707
- }
1708
- return l;
1709
- }
1710
- var rt = class extends Q {
1711
- constructor() {
1712
- super(
1713
- {
1714
- value: new I({
1715
- componentName: "value",
1716
- allowedTypes: ["Int", "Long", "Double", "Float", "String"],
1717
- settings: {
1718
- isDataComponent: !0,
1719
- columnsAllowed: !0,
1720
- axesAllowed: !1,
1721
- required: !0
1722
- }
1723
- }),
1724
- x: new I({
1725
- componentName: "x",
1726
- allowedTypes: ["Int", "String", "Long"],
1727
- strictlyDependsOnParents: !0,
1728
- parentComponents: ["value"],
1729
- settings: {
1730
- required: !0,
1731
- dimensionConsumer: !0,
1732
- multipleSelectors: !0,
1733
- axesAllowed: !0,
1734
- columnsAllowed: !1
1735
- }
1736
- }),
1737
- xGroupBy: new I({
1738
- componentName: "xGroupBy",
1739
- allowedTypes: ["Int", "String", "Long"],
1740
- strictlyDependsOnParents: !0,
1741
- parentComponents: ["value"],
1742
- settings: {
1743
- dimensionConsumer: !0,
1744
- multipleSelectors: !0,
1745
- axesAllowed: !0,
1746
- columnsAllowed: !0
1747
- },
1748
- dependsOn: ["x"],
1749
- checkSourceBySpec: (t, e) => {
1750
- const o = /* @__PURE__ */ new Set([
1751
- ...e.components.x.selectorStates.map((n) => n.selectedSource),
1752
- ...e.components.xGroupBy.selectorStates.map((n) => n.selectedSource)
1753
- ]);
1754
- return "kind" in t && t.kind === "PColumn" ? _.fromAxesSpec(t.axesSpec).every(
1755
- (n) => o.has(n.toCanonicalString())
1756
- ) : !0;
1757
- }
1758
- }),
1759
- y: new I({
1760
- componentName: "y",
1761
- allowedTypes: ["Int", "String", "Long"],
1762
- strictlyDependsOnParents: !0,
1763
- parentComponents: ["value"],
1764
- settings: {
1765
- required: !0,
1766
- dimensionConsumer: !0,
1767
- multipleSelectors: !0,
1768
- axesAllowed: !0,
1769
- columnsAllowed: !0
1770
- }
1771
- }),
1772
- yGroupBy: new I({
1773
- componentName: "yGroupBy",
1774
- allowedTypes: ["Int", "String", "Long"],
1775
- strictlyDependsOnParents: !0,
1776
- parentComponents: ["value"],
1777
- settings: {
1778
- dimensionConsumer: !0,
1779
- multipleSelectors: !0,
1780
- axesAllowed: !0,
1781
- columnsAllowed: !0
1782
- },
1783
- dependsOn: ["y"],
1784
- checkSourceBySpec: (t, e) => {
1785
- const o = /* @__PURE__ */ new Set([
1786
- ...e.components.y.selectorStates.map((n) => n.selectedSource),
1787
- ...e.components.yGroupBy.selectorStates.map((n) => n.selectedSource)
1788
- ]);
1789
- return "kind" in t && t.kind === "PColumn" ? _.fromAxesSpec(t.axesSpec).every(
1790
- (n) => o.has(n.toCanonicalString())
1791
- ) : !0;
1792
- }
1793
- }),
1794
- tooltipContent: new I({
1795
- componentName: "tooltipContent",
1796
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
1797
- strictlyDependsOnParents: !0,
1798
- parentComponents: ["value"],
1799
- dependsOn: ["value"],
1800
- settings: {
1801
- columnsAllowed: !0,
1802
- axesAllowed: !0,
1803
- multipleSelectors: !0
1804
- }
1805
- }),
1806
- facetBy: new I({
1807
- componentName: "facetBy",
1808
- allowedTypes: ["String", "Int", "Long"],
1809
- strictlyDependsOnParents: !0,
1810
- parentComponents: ["value"],
1811
- dependsOn: ["value"],
1812
- settings: {
1813
- axesAllowed: !0,
1814
- dimensionConsumer: !0,
1815
- multipleSelectors: !0
1816
- }
1817
- }),
1818
- annotationsX: new I({
1819
- componentName: "annotationsX",
1820
- allowedTypes: ["Int", "Long", "Double", "Float", "String"],
1821
- parentComponents: ["value"],
1822
- settings: {
1823
- axesAllowed: !0,
1824
- multipleSelectors: !0
1825
- },
1826
- dependsOn: ["x"],
1827
- checkSourceBySpec: (t, e) => {
1828
- const o = /* @__PURE__ */ new Set([
1829
- ...e.components.x.selectorStates.map((n) => n.selectedSource),
1830
- ...e.components.xGroupBy.selectorStates.map((n) => n.selectedSource)
1831
- ]);
1832
- return "kind" in t && t.kind === "PColumn" ? _.fromAxesSpec(t.axesSpec).every(
1833
- (n) => o.has(n.toCanonicalString())
1834
- ) : o.has(_.fromAxisSpec(t).toCanonicalString());
1835
- }
1836
- }),
1837
- annotationsY: new I({
1838
- componentName: "annotationsY",
1839
- allowedTypes: ["Int", "Long", "Double", "Float", "String"],
1840
- parentComponents: ["value"],
1841
- settings: {
1842
- axesAllowed: !0,
1843
- multipleSelectors: !0
1844
- },
1845
- dependsOn: ["y"],
1846
- checkSourceBySpec: (t, e) => {
1847
- const o = /* @__PURE__ */ new Set([
1848
- ...e.components.y.selectorStates.map((n) => n.selectedSource),
1849
- ...e.components.yGroupBy.selectorStates.map((n) => n.selectedSource)
1850
- ]);
1851
- return "kind" in t && t.kind === "PColumn" ? _.fromAxesSpec(t.axesSpec).every(
1852
- (n) => o.has(n.toCanonicalString())
1853
- ) : o.has(_.fromAxisSpec(t).toCanonicalString());
1854
- }
1855
- })
1856
- },
1857
- {
1858
- filters: new I({
1859
- componentName: "filters",
1860
- allowedTypes: ["String", "Int", "Long", "Double", "Long"],
1861
- strictlyDependsOnParents: !0,
1862
- parentComponents: ["value"],
1863
- dependsOn: ["value"],
1864
- settings: {
1865
- columnsAllowed: !0,
1866
- axesAllowed: !0,
1867
- dimensionConsumer: !0,
1868
- multipleSelectors: !0
1869
- },
1870
- checkSourceBySpec: R
1871
- }),
1872
- tabBy: new I({
1873
- componentName: "tabBy",
1874
- allowedTypes: ["String", "Int"],
1875
- strictlyDependsOnParents: !0,
1876
- parentComponents: ["value"],
1877
- dependsOn: ["value"],
1878
- settings: {
1879
- columnsAllowed: !0,
1880
- axesAllowed: !0,
1881
- dimensionConsumer: !0
1882
- }
1883
- })
1884
- }
1885
- ), this.dataInputs = ["value"], this.dontAllowUnfilteredHighCardinality = !0;
1886
- }
1887
- async getMustBeConsumedAxes(t, e) {
1888
- if (!e.components.value.selectorStates.length)
1889
- return /* @__PURE__ */ new Set();
1890
- const o = e.components.value.selectorStates[0].selectedSource, n = await t.pFrameProvider.getColumnSpecById(A(o));
1891
- return n ? new Set(n.axesSpec.map((l) => _.fromAxisSpec(l).toCanonicalString())) : /* @__PURE__ */ new Set();
1892
- }
1893
- async createDataByColumns(t, e) {
1894
- var o, n;
1895
- const l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1896
- if (!l)
1897
- throw Error("Value column is not valid");
1898
- const s = A(l);
1899
- if (!P(s))
1900
- throw Error("Value column is not valid");
1901
- const c = {
1902
- type: "columns",
1903
- id: (n = z(e.components)) != null ? n : "",
1904
- values: {}
1905
- }, { linkerColumnsMap: r, compositeLinkerMap: a } = await X(t), u = [
1906
- ...e.components.filters.selectorStates,
1907
- ...e.components.tabBy.selectorStates
1908
- ], p = Y(u), m = u.map((L) => A(L.selectedSource)).filter(P), y = [l], x = await J(t, y), g = [
1909
- e.components.facetBy,
1910
- e.components.annotationsX,
1911
- e.components.annotationsY,
1912
- e.components.x,
1913
- e.components.y,
1914
- e.components.xGroupBy,
1915
- e.components.yGroupBy,
1916
- e.components.tooltipContent
1917
- ], w = [], C = [[]], D = [], B = [];
1918
- for (const { selectedSource: L, fixedAxes: N } of u)
1919
- B.push(...await V(
1920
- t,
1921
- r,
1922
- a,
1923
- x,
1924
- L,
1925
- N
1926
- )), C.push(
1927
- (N ?? []).map(({ axisIdx: F, axisValue: G }) => ({ idx: F, value: G }))
1928
- );
1929
- for (const L of g)
1930
- for (const { selectedSource: N, fixedAxes: F } of L.selectorStates) {
1931
- w.push(A(N)), D.push(
1932
- (F ?? []).map(({ axisIdx: M, axisValue: K }) => ({ idx: M, value: K }))
1933
- ), B.push(...await V(
1934
- t,
1935
- r,
1936
- a,
1937
- x,
1938
- N,
1939
- F
1940
- ));
1941
- const G = await k(t, N, y);
1942
- G && w.push(G);
1943
- }
1944
- const v = await t.pFrameProvider.getTableOuterJoin(
1945
- [s, ...B, ...m],
1946
- w,
1947
- p,
1948
- !0,
1949
- C,
1950
- D
1951
- );
1952
- w.forEach((L) => {
1953
- const N = L.toCanonicalString();
1954
- c.values[N] = P(L) ? v.columnsData[N] : v.axesData[N];
1955
- }), c.values[s.toCanonicalString()] = v.columnsData[s.toCanonicalString()];
1956
- const d = e.components.x.selectorStates.concat(e.components.xGroupBy.selectorStates).map((L) => L.selectedSource), i = d.join(", ");
1957
- c.values[i] = ce(v, d);
1958
- const S = e.components.x.selectorStates.map((L) => L.selectedSource), f = await Promise.all(
1959
- S.map(
1960
- async (L) => {
1961
- var N, F;
1962
- return (F = (N = await k(t, L, y)) == null ? void 0 : N.toCanonicalString()) != null ? F : L;
1963
- }
1964
- )
1965
- );
1966
- c.values.xLabelsKey = ce(v, f);
1967
- const h = e.components.y.selectorStates.concat(e.components.yGroupBy.selectorStates).map((L) => L.selectedSource), b = h.join(", ");
1968
- c.values[b] = ce(v, h);
1969
- const O = e.components.y.selectorStates.map((L) => L.selectedSource), E = await Promise.all(
1970
- O.map(
1971
- async (L) => {
1972
- var N, F;
1973
- return (F = (N = await k(t, L, y)) == null ? void 0 : N.toCanonicalString()) != null ? F : L;
1974
- }
1975
- )
1976
- );
1977
- return c.values.yLabelsKey = ce(v, E), { byColumns: c };
1978
- }
1979
- async createChartSettings(t, e) {
1980
- var o;
1981
- const n = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource;
1982
- if (!n)
1983
- throw Error("Value column is not valid");
1984
- const l = A(n);
1985
- if (!P(l))
1986
- throw Error("Value column is not valid");
1987
- const s = [n], c = {
1988
- type: "column",
1989
- value: n,
1990
- label: await T(t, n, [])
1991
- }, a = e.components.x.selectorStates.concat(e.components.xGroupBy.selectorStates).map(({ selectedSource: d }) => A(d)).map((d) => d.toCanonicalString()).join(", "), p = e.components.y.selectorStates.concat(e.components.yGroupBy.selectorStates).map(({ selectedSource: d }) => A(d)).map((d) => d.toCanonicalString()).join(", "), m = await Promise.all(
1992
- e.components.facetBy.selectorStates.map(async (d) => {
1993
- var i, S;
1994
- return {
1995
- type: "column",
1996
- value: (S = (i = await k(t, d.selectedSource, s)) == null ? void 0 : i.toCanonicalString()) != null ? S : d.selectedSource
1997
- };
1998
- })
1999
- ), y = await Promise.all(
2000
- e.components.xGroupBy.selectorStates.map(async (d) => {
2001
- var i, S;
2002
- return {
2003
- type: "column",
2004
- label: await T(t, d.selectedSource, s),
2005
- value: d.selectedSource,
2006
- valueLabels: (S = (i = await k(t, d.selectedSource, s)) == null ? void 0 : i.toCanonicalString()) != null ? S : d.selectedSource
2007
- };
2008
- })
2009
- ), x = await Promise.all(
2010
- e.components.yGroupBy.selectorStates.map(async (d) => {
2011
- var i, S;
2012
- return {
2013
- type: "column",
2014
- label: await T(t, d.selectedSource, s),
2015
- value: d.selectedSource,
2016
- valueLabels: (S = (i = await k(t, d.selectedSource, s)) == null ? void 0 : i.toCanonicalString()) != null ? S : d.selectedSource
2017
- };
2018
- })
2019
- ), g = await t.pFrameProvider.getColumnSpecById(l), w = await Promise.all(
2020
- e.components.annotationsX.selectorStates.map(async (d) => {
2021
- var i, S;
2022
- const f = d.selectedSource, h = A(f), b = P(h) ? await t.pFrameProvider.getColumnSpecById(h) : (S = (i = g == null ? void 0 : g.axesSpec) == null ? void 0 : i.find(
2023
- (O) => _.fromAxisSpec(O).toCanonicalString() === f
2024
- )) != null ? S : null;
2025
- return {
2026
- axis: "x",
2027
- valueColumn: {
2028
- type: "column",
2029
- value: f,
2030
- label: await T(t, f, s)
2031
- },
2032
- type: de(b) ? "discrete" : "continuous"
2033
- };
2034
- })
2035
- ), C = await Promise.all(
2036
- e.components.annotationsY.selectorStates.map(async (d) => {
2037
- var i, S;
2038
- const f = d.selectedSource, h = A(f), b = P(h) ? await t.pFrameProvider.getColumnSpecById(h) : (S = (i = g == null ? void 0 : g.axesSpec) == null ? void 0 : i.find(
2039
- (O) => _.fromAxisSpec(O).toCanonicalString() === f
2040
- )) != null ? S : null;
2041
- return {
2042
- axis: "y",
2043
- valueColumn: {
2044
- type: "column",
2045
- value: f,
2046
- label: await T(t, f, s)
2047
- },
2048
- type: de(b) ? "discrete" : "continuous"
2049
- };
2050
- })
2051
- ), D = (await Promise.all(
2052
- e.components.x.selectorStates.map(
2053
- (d) => T(t, d.selectedSource, s)
2054
- )
2055
- )).join(", "), B = (await Promise.all(
2056
- e.components.y.selectorStates.map(
2057
- (d) => T(t, d.selectedSource, s)
2058
- )
2059
- )).join(", "), v = await Promise.all(
2060
- e.components.tooltipContent.selectorStates.map(async (d) => {
2061
- var i, S;
2062
- const f = d.selectedSource;
2063
- return {
2064
- type: "column",
2065
- label: await T(t, f, s) || f,
2066
- value: f,
2067
- valueLabels: (S = (i = await k(t, f, s)) == null ? void 0 : i.toCanonicalString()) != null ? S : f
2068
- };
2069
- })
2070
- );
2071
- return {
2072
- type: "heatmap",
2073
- valueColumn: c,
2074
- valueType: de(g) ? "discrete" : "continuous",
2075
- xColumn: {
2076
- type: "column",
2077
- value: a,
2078
- label: D,
2079
- valueLabels: "xLabelsKey"
2080
- },
2081
- yColumn: {
2082
- type: "column",
2083
- value: p,
2084
- label: B,
2085
- valueLabels: "yLabelsKey"
2086
- },
2087
- facetBy: m,
2088
- xGroupBy: y,
2089
- yGroupBy: x,
2090
- annotations: [...w, ...C],
2091
- tooltips: {
2092
- show: !0,
2093
- content: v
2094
- }
2095
- };
2096
- }
2097
- }, ct = {
2098
- type: "scatterplot",
2099
- components: {
2100
- x: { type: "simple", selectorStates: [] },
2101
- y: { type: "simple", selectorStates: [] },
2102
- filters: { type: "filter", selectorStates: [] },
2103
- highlight: { type: "filter", selectorStates: [] },
2104
- tabBy: { type: "filter", selectorStates: [] },
2105
- facetBy: { type: "simple", selectorStates: [] },
2106
- grouping: { type: "simple", selectorStates: [] },
2107
- shape: { type: "simple", selectorStates: [] },
2108
- size: { type: "simple", selectorStates: [] },
2109
- label: { type: "simple", selectorStates: [] },
2110
- tooltipContent: { type: "simple", selectorStates: [] }
2111
- },
2112
- dividedAxes: {}
2113
- }, it = class extends Q {
2114
- constructor() {
2115
- super(
2116
- {
2117
- x: new I({
2118
- componentName: "x",
2119
- allowedTypes: ["Int", "Long", "Double", "Float"],
2120
- parentComponents: ["y"],
2121
- strictlyDependsOnParents: !1,
2122
- settings: {
2123
- isDataComponent: !0,
2124
- required: !0,
2125
- axesAllowed: !0,
2126
- columnsAllowed: !0
2127
- }
2128
- }),
2129
- y: new I({
2130
- componentName: "y",
2131
- allowedTypes: ["Int", "Long", "Double", "Float"],
2132
- parentComponents: ["x"],
2133
- strictlyDependsOnParents: !1,
2134
- settings: {
2135
- isDataComponent: !0,
2136
- required: !0,
2137
- axesAllowed: !0,
2138
- columnsAllowed: !0
2139
- }
2140
- }),
2141
- facetBy: new I({
2142
- componentName: "facetBy",
2143
- allowedTypes: ["String", "Int", "Long"],
2144
- strictlyDependsOnParents: !0,
2145
- parentComponents: ["x", "y"],
2146
- dependsOn: ["x", "y"],
2147
- settings: {
2148
- axesAllowed: !0,
2149
- dimensionConsumer: !0,
2150
- multipleSelectors: !0
2151
- }
2152
- }),
2153
- grouping: new I({
2154
- componentName: "grouping",
2155
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2156
- strictlyDependsOnParents: !0,
2157
- parentComponents: ["x", "y"],
2158
- dependsOn: ["x", "y"],
2159
- settings: {
2160
- axesAllowed: !0,
2161
- multipleSelectors: !0
2162
- }
2163
- }),
2164
- shape: new I({
2165
- componentName: "shape",
2166
- allowedTypes: ["String", "Int", "Long"],
2167
- strictlyDependsOnParents: !0,
2168
- parentComponents: ["x", "y"],
2169
- dependsOn: ["x", "y"],
2170
- settings: {
2171
- axesAllowed: !0
2172
- }
2173
- }),
2174
- size: new I({
2175
- componentName: "size",
2176
- allowedTypes: ["Int", "Long", "Double", "Float"],
2177
- strictlyDependsOnParents: !0,
2178
- parentComponents: ["x", "y"],
2179
- dependsOn: ["x", "y"],
2180
- settings: {
2181
- axesAllowed: !0
2182
- }
2183
- }),
2184
- tooltipContent: new I({
2185
- componentName: "tooltipContent",
2186
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
2187
- strictlyDependsOnParents: !0,
2188
- parentComponents: ["x", "y"],
2189
- dependsOn: ["x", "y"],
2190
- settings: {
2191
- columnsAllowed: !0,
2192
- axesAllowed: !0,
2193
- multipleSelectors: !0
2194
- }
2195
- }),
2196
- label: new I({
2197
- componentName: "label",
2198
- allowedTypes: ["String", "Int", "Long"],
2199
- strictlyDependsOnParents: !0,
2200
- parentComponents: ["x", "y"],
2201
- dependsOn: ["x", "y"],
2202
- settings: {
2203
- axesAllowed: !0,
2204
- columnsAllowed: !0,
2205
- multipleSelectors: !1
2206
- }
2207
- })
2208
- },
2209
- {
2210
- filters: new I({
2211
- componentName: "filters",
2212
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2213
- strictlyDependsOnParents: !0,
2214
- parentComponents: ["x", "y"],
2215
- dependsOn: ["x", "y"],
2216
- settings: {
2217
- axesAllowed: !0,
2218
- columnsAllowed: !0,
2219
- dimensionConsumer: !0,
2220
- multipleSelectors: !0
2221
- },
2222
- checkSourceBySpec: R
2223
- }),
2224
- tabBy: new I({
2225
- componentName: "tabBy",
2226
- allowedTypes: ["String", "Int"],
2227
- strictlyDependsOnParents: !0,
2228
- parentComponents: ["x", "y"],
2229
- dependsOn: ["x", "y"],
2230
- settings: {
2231
- axesAllowed: !0,
2232
- dimensionConsumer: !0
2233
- }
2234
- }),
2235
- highlight: new I({
2236
- componentName: "highlight",
2237
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2238
- strictlyDependsOnParents: !0,
2239
- parentComponents: ["x", "y"],
2240
- dependsOn: ["x", "y"],
2241
- settings: {
2242
- axesAllowed: !0,
2243
- columnsAllowed: !0,
2244
- multipleSelectors: !0
2245
- },
2246
- checkSourceBySpec: R
2247
- })
2248
- }
2249
- ), this.dataInputs = ["x", "y"];
2250
- }
2251
- async getMustBeConsumedAxes(t, e) {
2252
- if (!e.components.x.selectorStates.length || !e.components.y.selectorStates.length)
2253
- return /* @__PURE__ */ new Set();
2254
- const o = e.components.x.selectorStates[0].selectedSource, n = e.components.y.selectorStates[0].selectedSource, l = await t.pFrameProvider.getColumnSpecById(A(o)), s = await t.pFrameProvider.getColumnSpecById(A(n));
2255
- if (!l || !s)
2256
- return /* @__PURE__ */ new Set();
2257
- const c = l.axesSpec.map((p) => _.fromAxisSpec(p).toCanonicalString()), r = s.axesSpec.map((p) => _.fromAxisSpec(p).toCanonicalString()), a = c.filter((p) => !r.some((m) => m === p)), u = r.filter((p) => !c.some((m) => m === p));
2258
- return /* @__PURE__ */ new Set([...a, ...u]);
2259
- }
2260
- async createDataByColumns(t, e) {
2261
- var o, n, l;
2262
- const s = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource;
2263
- if (!s || !c)
2264
- throw Error("X or Y column is not valid");
2265
- const r = A(s), a = A(c), u = {
2266
- type: "columns",
2267
- id: (l = z(e.components)) != null ? l : "",
2268
- values: {}
2269
- }, { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), y = [
2270
- ...e.components.filters.selectorStates,
2271
- ...e.components.tabBy.selectorStates
2272
- ], x = Y(y), g = y.map((h) => A(h.selectedSource)).filter(P), w = [r, a].filter(P).map((h) => h.toCanonicalString());
2273
- if (w.length === 0)
2274
- throw Error("One of X and Y should be a column");
2275
- const C = await J(t, w), D = [r, a, ...g], B = [], v = [[], []], d = [], i = [];
2276
- for (const { selectedSource: h, fixedAxes: b } of y)
2277
- i.push(...await V(
2278
- t,
2279
- p,
2280
- m,
2281
- C,
2282
- h,
2283
- b
2284
- )), v.push(
2285
- (b ?? []).map(({ axisIdx: O, axisValue: E }) => ({ idx: O, value: E }))
2286
- );
2287
- const S = [
2288
- e.components.grouping,
2289
- e.components.size,
2290
- e.components.shape,
2291
- e.components.tooltipContent,
2292
- e.components.facetBy,
2293
- e.components.label,
2294
- e.components.highlight
2295
- ];
2296
- for (const h of S)
2297
- for (const { selectedSource: b, fixedAxes: O } of h.selectorStates) {
2298
- B.push(A(b)), d.push(
2299
- (O ?? []).map(({ axisIdx: L, axisValue: N }) => ({ idx: L, value: N }))
2300
- ), i.push(...await V(
2301
- t,
2302
- p,
2303
- m,
2304
- C,
2305
- b,
2306
- O
2307
- ));
2308
- const E = await k(t, b, w);
2309
- E && B.push(E);
2310
- }
2311
- const f = await t.pFrameProvider.getTableOuterJoin(
2312
- [r, a, ...i, ...g],
2313
- B,
2314
- x,
2315
- !1,
2316
- v,
2317
- d
2318
- );
2319
- return [...D, ...B].forEach((h) => {
2320
- const b = h.toCanonicalString();
2321
- u.values[b] = P(h) ? f.columnsData[b] : f.axesData[b];
2322
- }), u.values.key = new Array(u.values[Object.keys(u.values)[0]].length).fill(0).map((h, b) => b), e.components.highlight.selectorStates.length && (u.values.highlight = Be(e.components.highlight.selectorStates, f)), { byColumns: u };
2323
- }
2324
- async createChartSettings(t, e) {
2325
- var o, n, l, s, c;
2326
- const r = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, a = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource, u = r ? A(r) : null, p = a ? A(a) : null;
2327
- if (!r || !a || !u || !p || !P(u) && !P(p))
2328
- throw Error("Empty or invalid required data");
2329
- const m = [u, p].filter(P).map((i) => i.toCanonicalString()), y = {
2330
- type: "column",
2331
- value: r,
2332
- label: await T(t, r, m)
2333
- }, x = {
2334
- type: "column",
2335
- value: a,
2336
- label: await T(t, a, m)
2337
- }, g = {
2338
- type: "column",
2339
- value: "key"
2340
- }, w = await Promise.all(
2341
- e.components.facetBy.selectorStates.map(async (i) => {
2342
- var S, f;
2343
- return {
2344
- type: "column",
2345
- value: (f = (S = await k(t, i.selectedSource, m)) == null ? void 0 : S.toCanonicalString()) != null ? f : i.selectedSource
2346
- };
2347
- })
2348
- ), C = ue.uniq([
2349
- ...e.components.grouping.selectorStates.map((i) => i.selectedSource),
2350
- ...e.components.size.selectorStates.map((i) => i.selectedSource),
2351
- ...e.components.shape.selectorStates.map((i) => i.selectedSource)
2352
- ]), D = await Promise.all(
2353
- C.map(async (i) => {
2354
- var S, f;
2355
- return {
2356
- type: "column",
2357
- label: await T(t, i, m) || i,
2358
- value: i,
2359
- valueLabels: (f = (S = await k(t, i, m)) == null ? void 0 : S.toCanonicalString()) != null ? f : i
2360
- };
2361
- })
2362
- ), B = await Promise.all(
2363
- e.components.tooltipContent.selectorStates.map(async (i) => {
2364
- var S, f;
2365
- const h = i.selectedSource, b = A(h), O = (S = await k(t, h, m)) != null ? S : b, E = await le(t, h, m);
2366
- return {
2367
- type: "column",
2368
- label: await T(t, h, m) || h,
2369
- value: h,
2370
- valueLabels: O.toCanonicalString(),
2371
- format: (f = E == null ? void 0 : E.annotations) == null ? void 0 : f[pe]
2372
- };
2373
- })
2374
- );
2375
- let v;
2376
- if (e.components.label.selectorStates.length) {
2377
- const i = e.components.label.selectorStates[0].selectedSource, S = await le(t, i, m);
2378
- v = {
2379
- type: "column",
2380
- value: i,
2381
- label: await T(t, i, m),
2382
- valueLabels: (s = (l = await k(t, i, m)) == null ? void 0 : l.toCanonicalString()) != null ? s : i,
2383
- format: (c = S == null ? void 0 : S.annotations) == null ? void 0 : c[pe]
2384
- };
2385
- }
2386
- let d;
2387
- return e.components.highlight.selectorStates.length && (d = {
2388
- type: "column",
2389
- value: "highlight"
2390
- }), {
2391
- type: "scatterplot",
2392
- x: y,
2393
- y: x,
2394
- keyColumn: g,
2395
- facetBy: w,
2396
- grouping: D,
2397
- label: v,
2398
- highlight: d,
2399
- tooltips: {
2400
- show: !0,
2401
- content: B
2402
- }
2403
- };
2404
- }
2405
- }, ut = {
2406
- type: "scatterplot-umap",
2407
- components: {
2408
- x: { type: "simple", selectorStates: [] },
2409
- y: { type: "simple", selectorStates: [] },
2410
- filters: { type: "filter", selectorStates: [] },
2411
- highlight: { type: "filter", selectorStates: [] },
2412
- tabBy: { type: "filter", selectorStates: [] },
2413
- facetBy: { type: "simple", selectorStates: [] },
2414
- grouping: { type: "simple", selectorStates: [] },
2415
- label: { type: "simple", selectorStates: [] },
2416
- tooltipContent: { type: "simple", selectorStates: [] },
2417
- size: { type: "simple", selectorStates: [] }
2418
- },
2419
- dividedAxes: {}
2420
- }, pt = class extends Q {
2421
- constructor() {
2422
- super(
2423
- {
2424
- x: new I({
2425
- componentName: "x",
2426
- allowedTypes: ["Int", "Long", "Double", "Float"],
2427
- parentComponents: ["y"],
2428
- strictlyDependsOnParents: !1,
2429
- settings: {
2430
- isDataComponent: !0,
2431
- required: !0,
2432
- axesAllowed: !0,
2433
- columnsAllowed: !0
2434
- }
2435
- }),
2436
- y: new I({
2437
- componentName: "y",
2438
- allowedTypes: ["Int", "Long", "Double", "Float"],
2439
- parentComponents: ["x"],
2440
- strictlyDependsOnParents: !1,
2441
- settings: {
2442
- isDataComponent: !0,
2443
- required: !0,
2444
- axesAllowed: !0,
2445
- columnsAllowed: !0
2446
- }
2447
- }),
2448
- facetBy: new I({
2449
- componentName: "facetBy",
2450
- allowedTypes: ["String", "Int", "Long"],
2451
- strictlyDependsOnParents: !0,
2452
- parentComponents: ["x", "y"],
2453
- dependsOn: ["x", "y"],
2454
- settings: {
2455
- axesAllowed: !0,
2456
- dimensionConsumer: !0,
2457
- multipleSelectors: !0
2458
- }
2459
- }),
2460
- grouping: new I({
2461
- componentName: "grouping",
2462
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
2463
- strictlyDependsOnParents: !0,
2464
- parentComponents: ["x", "y"],
2465
- dependsOn: ["x", "y"],
2466
- settings: {
2467
- axesAllowed: !0,
2468
- multipleSelectors: !0
2469
- }
2470
- }),
2471
- tooltipContent: new I({
2472
- componentName: "tooltipContent",
2473
- allowedTypes: ["String", "Int", "Long", "Float", "Double"],
2474
- strictlyDependsOnParents: !0,
2475
- parentComponents: ["x", "y"],
2476
- dependsOn: ["x", "y"],
2477
- settings: {
2478
- columnsAllowed: !0,
2479
- axesAllowed: !0,
2480
- multipleSelectors: !0
2481
- }
2482
- }),
2483
- label: new I({
2484
- componentName: "label",
2485
- allowedTypes: ["String", "Int", "Long"],
2486
- strictlyDependsOnParents: !0,
2487
- parentComponents: ["x", "y"],
2488
- dependsOn: ["x", "y"],
2489
- settings: {
2490
- axesAllowed: !0,
2491
- columnsAllowed: !0,
2492
- multipleSelectors: !1
2493
- }
2494
- }),
2495
- size: new I({
2496
- componentName: "size",
2497
- allowedTypes: ["Int", "Long", "Double", "Float"],
2498
- strictlyDependsOnParents: !0,
2499
- parentComponents: ["x", "y"],
2500
- dependsOn: ["x", "y"],
2501
- settings: {
2502
- axesAllowed: !0
2503
- }
2504
- })
2505
- },
2506
- {
2507
- filters: new I({
2508
- componentName: "filters",
2509
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2510
- strictlyDependsOnParents: !0,
2511
- parentComponents: ["x", "y"],
2512
- dependsOn: ["x", "y"],
2513
- settings: {
2514
- axesAllowed: !0,
2515
- dimensionConsumer: !0,
2516
- multipleSelectors: !0
2517
- },
2518
- checkSourceBySpec: R
2519
- }),
2520
- tabBy: new I({
2521
- componentName: "tabBy",
2522
- allowedTypes: ["String", "Int"],
2523
- strictlyDependsOnParents: !0,
2524
- parentComponents: ["x", "y"],
2525
- dependsOn: ["x", "y"],
2526
- settings: {
2527
- axesAllowed: !0,
2528
- dimensionConsumer: !0
2529
- }
2530
- }),
2531
- highlight: new I({
2532
- componentName: "highlight",
2533
- allowedTypes: ["String", "Int", "Long", "Double", "Float"],
2534
- strictlyDependsOnParents: !0,
2535
- parentComponents: ["x", "y"],
2536
- dependsOn: ["x", "y"],
2537
- settings: {
2538
- axesAllowed: !0,
2539
- columnsAllowed: !0,
2540
- multipleSelectors: !0
2541
- },
2542
- checkSourceBySpec: R
2543
- })
2544
- }
2545
- ), this.dataInputs = ["x", "y"];
2546
- }
2547
- async getMustBeConsumedAxes(t, e) {
2548
- if (!e.components.x.selectorStates.length || !e.components.y.selectorStates.length)
2549
- return /* @__PURE__ */ new Set();
2550
- const o = e.components.x.selectorStates[0].selectedSource, n = e.components.y.selectorStates[0].selectedSource, l = await t.pFrameProvider.getColumnSpecById(A(o)), s = await t.pFrameProvider.getColumnSpecById(A(n));
2551
- if (!l || !s)
2552
- return /* @__PURE__ */ new Set();
2553
- const c = l.axesSpec.map((p) => _.fromAxisSpec(p).toCanonicalString()), r = s.axesSpec.map((p) => _.fromAxisSpec(p).toCanonicalString()), a = c.filter((p) => !r.some((m) => m === p)), u = r.filter((p) => !c.some((m) => m === p));
2554
- return /* @__PURE__ */ new Set([...a, ...u]);
2555
- }
2556
- async createDataByColumns(t, e) {
2557
- var o, n, l;
2558
- const s = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource;
2559
- if (!s || !c)
2560
- throw Error("X or Y column is not valid");
2561
- const r = A(s), a = A(c);
2562
- if (!r || !a)
2563
- throw Error("X or Y column is not valid");
2564
- const u = {
2565
- type: "columns",
2566
- id: (l = z(e.components)) != null ? l : "",
2567
- values: {}
2568
- }, { linkerColumnsMap: p, compositeLinkerMap: m } = await X(t), y = [
2569
- ...e.components.filters.selectorStates,
2570
- ...e.components.tabBy.selectorStates
2571
- ], x = Y(y), g = y.map((h) => A(h.selectedSource)).filter(P), w = [r, a].filter(P).map((h) => h.toCanonicalString());
2572
- if (w.length === 0)
2573
- throw Error("One of X and Y should be a column");
2574
- const C = await J(t, w), D = [r, a, ...g], B = [], v = [[], []], d = [], i = [];
2575
- for (const { selectedSource: h, fixedAxes: b } of y)
2576
- i.push(...await V(
2577
- t,
2578
- p,
2579
- m,
2580
- C,
2581
- h,
2582
- b
2583
- )), v.push(
2584
- (b ?? []).map(({ axisIdx: O, axisValue: E }) => ({ idx: O, value: E }))
2585
- );
2586
- const S = [
2587
- e.components.grouping,
2588
- e.components.facetBy,
2589
- e.components.tooltipContent,
2590
- e.components.label,
2591
- e.components.highlight,
2592
- e.components.size
2593
- ];
2594
- for (const h of S)
2595
- for (const { selectedSource: b, fixedAxes: O } of h.selectorStates) {
2596
- B.push(A(b)), d.push(
2597
- (O ?? []).map(({ axisIdx: L, axisValue: N }) => ({ idx: L, value: N }))
2598
- ), i.push(...await V(
2599
- t,
2600
- p,
2601
- m,
2602
- C,
2603
- b,
2604
- O
2605
- ));
2606
- const E = await k(t, b, w);
2607
- E && B.push(E);
2608
- }
2609
- const f = await t.pFrameProvider.getTableOuterJoin(
2610
- [r, a, ...i, ...g],
2611
- B,
2612
- x,
2613
- !1,
2614
- v,
2615
- d
2616
- );
2617
- return [...D, ...B].forEach((h) => {
2618
- const b = h.toCanonicalString();
2619
- u.values[b] = P(h) ? f.columnsData[b] : f.axesData[b];
2620
- }), e.components.highlight.selectorStates.length && (u.values.highlight = Be(e.components.highlight.selectorStates, f)), {
2621
- byColumns: u,
2622
- axesData: f.axesData
2623
- };
2624
- }
2625
- async createChartSettings(t, e) {
2626
- var o, n, l, s, c;
2627
- const r = (o = e.components.x.selectorStates[0]) == null ? void 0 : o.selectedSource, a = (n = e.components.y.selectorStates[0]) == null ? void 0 : n.selectedSource, u = r ? A(r) : null, p = a ? A(a) : null;
2628
- if (!r || !a || !u || !p || !P(u) && !P(p))
2629
- throw Error("Empty or invalid required data");
2630
- const m = [u, p].filter(P).map((i) => i.toCanonicalString()), y = {
2631
- type: "column",
2632
- value: r,
2633
- label: await T(t, r, m)
2634
- }, x = {
2635
- type: "column",
2636
- value: a,
2637
- label: await T(t, a, m)
2638
- }, g = {
2639
- type: "column",
2640
- value: "key"
2641
- }, w = await Promise.all(
2642
- e.components.facetBy.selectorStates.map(async (i) => {
2643
- var S, f;
2644
- return {
2645
- type: "column",
2646
- value: (f = (S = await k(t, i.selectedSource, m)) == null ? void 0 : S.toCanonicalString()) != null ? f : i.selectedSource
2647
- };
2648
- })
2649
- ), C = ue.uniq([
2650
- ...e.components.grouping.selectorStates.map((i) => i.selectedSource),
2651
- ...e.components.size.selectorStates.map((i) => i.selectedSource)
2652
- ]), D = await Promise.all(
2653
- C.map(async (i) => {
2654
- var S, f;
2655
- return {
2656
- type: "column",
2657
- label: await T(t, i, m) || i,
2658
- value: i,
2659
- valueLabels: (f = (S = await k(t, i, m)) == null ? void 0 : S.toCanonicalString()) != null ? f : i
2660
- };
2661
- })
2662
- ), B = await Promise.all(
2663
- e.components.tooltipContent.selectorStates.map(async (i) => {
2664
- var S, f, h;
2665
- const b = i.selectedSource, O = await le(t, b, m);
2666
- return {
2667
- type: "column",
2668
- label: await T(t, b, m) || b,
2669
- value: b,
2670
- valueLabels: (f = (S = await k(t, b, m)) == null ? void 0 : S.toCanonicalString()) != null ? f : b,
2671
- format: (h = O == null ? void 0 : O.annotations) == null ? void 0 : h[pe]
2672
- };
2673
- })
2674
- );
2675
- let v;
2676
- if (e.components.label.selectorStates.length) {
2677
- const i = e.components.label.selectorStates[0].selectedSource, S = await le(t, i, m);
2678
- v = {
2679
- type: "column",
2680
- value: i,
2681
- label: await T(t, i, m),
2682
- valueLabels: (s = (l = await k(t, i, m)) == null ? void 0 : l.toCanonicalString()) != null ? s : i,
2683
- format: (c = S == null ? void 0 : S.annotations) == null ? void 0 : c[pe]
2684
- };
2685
- }
2686
- let d;
2687
- return e.components.highlight.selectorStates.length && (d = {
2688
- type: "column",
2689
- value: "highlight"
2690
- }), {
2691
- type: "scatterplot-umap",
2692
- x: y,
2693
- y: x,
2694
- keyColumn: g,
2695
- facetBy: w,
2696
- grouping: D,
2697
- label: v,
2698
- highlight: d,
2699
- tooltips: {
2700
- show: !0,
2701
- content: B
2702
- }
2703
- };
2704
- }
2705
- }, Se = "pl7.app/dendrogram/nodeId", ye = "id", mt = {
2706
- type: "dendro",
2707
- components: {
2708
- value: { type: "simple", selectorStates: [] },
2709
- height: { type: "simple", selectorStates: [] },
2710
- labels: { type: "simple", selectorStates: [] },
2711
- tableContent: { type: "simple", selectorStates: [] },
2712
- nodeColor: { type: "simple", selectorStates: [] },
2713
- nodeShape: { type: "simple", selectorStates: [] },
2714
- nodeSize: { type: "simple", selectorStates: [] },
2715
- lineColor: { type: "simple", selectorStates: [] },
2716
- heatmapAnnotation: { type: "simple", selectorStates: [] },
2717
- heatmapForSequence: { type: "simple", selectorStates: [] },
2718
- filters: { type: "filter", selectorStates: [] },
2719
- tabBy: { type: "filter", selectorStates: [] },
2720
- facetBy: { type: "simple", selectorStates: [] },
2721
- heatmapAxis: { type: "simple", selectorStates: [] },
2722
- heatmapGroup: { type: "simple", selectorStates: [] }
2723
- },
2724
- dividedAxes: {}
2725
- }, dt = class extends Q {
2726
- constructor() {
2727
- super(
2728
- {
2729
- value: new I({
2730
- componentName: "value",
2731
- allowedTypes: ["Int", "Long"],
2732
- annotations: { "pl7.app/dendrogram/isTopology": "true" },
2733
- settings: {
2734
- isDataComponent: !0,
2735
- columnsAllowed: !0,
2736
- required: !0,
2737
- dimensionConsumer: !0,
2738
- columnsWithExtraAxesAllowed: !1
2739
- }
2740
- }),
2741
- height: new I({
2742
- componentName: "height",
2743
- allowedTypes: ["Int", "Long", "Double", "Float"],
2744
- annotations: { "pl7.app/dendrogram/isDistance": "true" },
2745
- parentComponents: ["value"],
2746
- strictlyDependsOnParents: !0,
2747
- settings: {
2748
- columnsAllowed: !0,
2749
- axesAllowed: !1,
2750
- dimensionConsumer: !0,
2751
- columnsWithExtraAxesAllowed: !1
2752
- }
2753
- }),
2754
- labels: new I({
2755
- componentName: "labels",
2756
- allowedTypes: ["Int", "String", "Long"],
2757
- parentComponents: ["value"],
2758
- strictlyDependsOnParents: !1,
2759
- settings: {
2760
- columnsAllowed: !0,
2761
- axesAllowed: !1,
2762
- columnsWithExtraAxesAllowed: !1
2763
- }
2764
- }),
2765
- tableContent: new I({
2766
- componentName: "tableContent",
2767
- allowedTypes: ["Int", "String", "Long", "Double", "Float"],
2768
- parentComponents: ["value"],
2769
- strictlyDependsOnParents: !1,
2770
- settings: {
2771
- columnsAllowed: !0,
2772
- axesAllowed: !0,
2773
- multipleSelectors: !0,
2774
- columnsWithExtraAxesAllowed: !1
2775
- }
2776
- }),
2777
- nodeShape: new I({
2778
- componentName: "nodeShape",
2779
- allowedTypes: ["Int", "String", "Long"],
2780
- parentComponents: ["value"],
2781
- strictlyDependsOnParents: !1,
2782
- settings: {
2783
- columnsAllowed: !0,
2784
- axesAllowed: !0,
2785
- columnsWithExtraAxesAllowed: !1
2786
- }
2787
- }),
2788
- nodeSize: new I({
2789
- componentName: "nodeSize",
2790
- allowedTypes: ["Double", "Int", "String", "Long"],
2791
- parentComponents: ["value"],
2792
- strictlyDependsOnParents: !1,
2793
- settings: {
2794
- columnsAllowed: !0,
2795
- axesAllowed: !0,
2796
- columnsWithExtraAxesAllowed: !1
2797
- }
2798
- }),
2799
- nodeColor: new I({
2800
- componentName: "nodeColor",
2801
- allowedTypes: ["Double", "Int", "String", "Long"],
2802
- parentComponents: ["value"],
2803
- strictlyDependsOnParents: !1,
2804
- settings: {
2805
- columnsAllowed: !0,
2806
- axesAllowed: !0,
2807
- columnsWithExtraAxesAllowed: !1
2808
- }
2809
- }),
2810
- lineColor: new I({
2811
- componentName: "lineColor",
2812
- allowedTypes: ["Double", "Int", "String", "Long"],
2813
- parentComponents: ["value"],
2814
- strictlyDependsOnParents: !1,
2815
- settings: {
2816
- columnsAllowed: !0,
2817
- axesAllowed: !1,
2818
- columnsWithExtraAxesAllowed: !1
2819
- }
2820
- }),
2821
- heatmapForSequence: new I({
2822
- componentName: "heatmapForSequence",
2823
- allowedTypes: ["String"],
2824
- annotations: { "pl7.app/type": "sequence" },
2825
- parentComponents: ["value"],
2826
- strictlyDependsOnParents: !1,
2827
- settings: {
2828
- columnsAllowed: !0,
2829
- axesAllowed: !0,
2830
- columnsWithExtraAxesAllowed: !1
2831
- }
2832
- }),
2833
- heatmapAnnotation: new I({
2834
- componentName: "heatmapAnnotation",
2835
- allowedTypes: ["Double", "Int", "Long", "Float", "String"],
2836
- parentComponents: ["value"],
2837
- strictlyDependsOnParents: !1,
2838
- settings: {
2839
- isDataComponent: !0,
2840
- columnsAllowed: !0,
2841
- axesAllowed: !1,
2842
- columnsWithExtraAxesAllowed: !1
2843
- }
2844
- }),
2845
- facetBy: new I({
2846
- componentName: "facetBy",
2847
- allowedTypes: ["String", "Int", "Long"],
2848
- parentComponents: ["value"],
2849
- strictlyDependsOnParents: !0,
2850
- settings: {
2851
- dimensionConsumer: !0,
2852
- multipleSelectors: !0,
2853
- axesAllowed: !0,
2854
- columnsAllowed: !1,
2855
- columnsWithExtraAxesAllowed: !1
2856
- }
2857
- }),
2858
- heatmapAxis: new I({
2859
- componentName: "heatmapAxis",
2860
- allowedTypes: ["String", "Int", "Long"],
2861
- parentComponents: ["heatmapAnnotation"],
2862
- settings: {
2863
- dimensionConsumer: !0,
2864
- axesAllowed: !0,
2865
- columnsAllowed: !1,
2866
- columnsWithExtraAxesAllowed: !1
2867
- }
2868
- }),
2869
- heatmapGroup: new I({
2870
- componentName: "heatmapGroup",
2871
- allowedTypes: ["String", "Int", "Long"],
2872
- parentComponents: ["heatmapAnnotation"],
2873
- settings: {
2874
- dimensionConsumer: !0,
2875
- multipleSelectors: !0,
2876
- axesAllowed: !0,
2877
- columnsAllowed: !1,
2878
- columnsWithExtraAxesAllowed: !1
2879
- }
2880
- })
2881
- },
2882
- {
2883
- filters: new I({
2884
- componentName: "filters",
2885
- allowedTypes: ["String", "Int", "Long"],
2886
- parentComponents: ["value", "heatmapAnnotation"],
2887
- strictlyDependsOnParents: !1,
2888
- settings: {
2889
- dimensionConsumer: !0,
2890
- multipleSelectors: !0,
2891
- axesAllowed: !0,
2892
- columnsAllowed: !1,
2893
- columnsWithExtraAxesAllowed: !1
2894
- }
2895
- }),
2896
- tabBy: new I({
2897
- componentName: "tabBy",
2898
- allowedTypes: ["String", "Int", "Long"],
2899
- parentComponents: ["value", "heatmapAnnotation"],
2900
- strictlyDependsOnParents: !1,
2901
- settings: {
2902
- dimensionConsumer: !0,
2903
- axesAllowed: !0,
2904
- columnsAllowed: !1,
2905
- columnsWithExtraAxesAllowed: !1
2906
- }
2907
- })
2908
- }
2909
- ), this.ignoredOptionIdNames = [Se];
2910
- }
2911
- readyDataInputs(t) {
2912
- return t.components.value.selectorStates.length > 0;
2913
- }
2914
- async createTableData(t, e) {
2915
- var o;
2916
- const n = {}, l = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource, s = A(l);
2917
- if (!l || !P(s))
2918
- throw Error("Value column is not valid");
2919
- const { linkerColumnsMap: c, compositeLinkerMap: r } = await X(t), a = Y([
2920
- ...e.components.filters.selectorStates,
2921
- ...e.components.tabBy.selectorStates
2922
- ]), u = [
2923
- ...e.components.filters.selectorStates.map((d) => A(d.selectedSource)),
2924
- ...e.components.tabBy.selectorStates.map((d) => A(d.selectedSource))
2925
- ].filter(P), p = [l], m = await J(t, p), y = [], x = [], g = [], w = [e.components.value], C = [
2926
- e.components.tableContent,
2927
- // next components can content data mapped on tree
2928
- e.components.labels,
2929
- e.components.nodeColor,
2930
- e.components.nodeSize,
2931
- e.components.nodeShape,
2932
- e.components.lineColor
2933
- ], D = {};
2934
- for (const d of w)
2935
- for (const { selectedSource: i, fixedAxes: S } of d.selectorStates) {
2936
- g.push(...await V(
2937
- t,
2938
- c,
2939
- r,
2940
- m,
2941
- i,
2942
- S
2943
- ));
2944
- const f = await k(t, i, p), h = f ?? A(i);
2945
- D[h.toCanonicalString()] = i, y.push(h);
2946
- }
2947
- for (const d of C)
2948
- for (const { selectedSource: i, fixedAxes: S } of d.selectorStates) {
2949
- g.push(...await V(
2950
- t,
2951
- c,
2952
- r,
2953
- m,
2954
- i,
2955
- S
2956
- ));
2957
- const f = await k(t, i, p), h = f ?? A(i);
2958
- D[i] = h.toCanonicalString(), x.push(h);
2959
- }
2960
- const B = await t.pFrameProvider.getTableOuterJoin(
2961
- [...y, ...u, ...g],
2962
- x,
2963
- a,
2964
- !1
2965
- );
2966
- for (const d of [...y, ...x]) {
2967
- const i = d.toCanonicalString(), S = D[d.toCanonicalString()];
2968
- n[S] = {
2969
- data: P(d) ? B.columnsData[i] : B.axesData[i],
2970
- spec: P(d) ? B.columnSpecs[i] : B.axesSpecs[i],
2971
- label: await T(t, S, p)
2972
- };
2973
- }
2974
- const v = Object.keys(B.axesData).find(
2975
- (d) => {
2976
- var i;
2977
- return ((i = A(d)) == null ? void 0 : i.name) === Se;
2978
- }
2979
- );
2980
- return v ? n[ye] = {
2981
- data: B.axesData[v],
2982
- spec: { kind: "PColumn", valueType: "Int", name: "Node id" },
2983
- label: "Node id"
2984
- } : console.warn("Missed node id axis in data column"), n;
2985
- }
2986
- async createDataByColumns(t, e) {
2987
- var o, n, l;
2988
- const s = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource, c = (n = e.components.heatmapAnnotation.selectorStates[0]) == null ? void 0 : n.selectedSource, r = A(s), a = c ? A(c) : null;
2989
- if (!s || !P(r))
2990
- throw Error("Value column is not valid");
2991
- const u = {
2992
- type: "columns",
2993
- id: (l = z(e.components)) != null ? l : "",
2994
- values: {}
2995
- }, p = [
2996
- ...e.components.filters.selectorStates,
2997
- ...e.components.tabBy.selectorStates
2998
- ], m = Y(p), y = p.map((S) => A(S.selectedSource)).filter(P), x = [r, a].filter(P).map((S) => S.toCanonicalString()), g = [], w = [], C = [], D = [], B = [
2999
- e.components.value,
3000
- e.components.height,
3001
- e.components.labels,
3002
- e.components.nodeColor,
3003
- e.components.nodeSize,
3004
- e.components.nodeShape,
3005
- e.components.lineColor,
3006
- e.components.heatmapAnnotation,
3007
- e.components.heatmapForSequence
3008
- ], v = [
3009
- e.components.facetBy,
3010
- e.components.heatmapAxis,
3011
- e.components.heatmapGroup,
3012
- e.components.tableContent
3013
- ];
3014
- for (const S of B)
3015
- for (const { selectedSource: f, fixedAxes: h } of S.selectorStates) {
3016
- g.push(A(f)), C.push(
3017
- (h ?? []).map(({ axisIdx: O, axisValue: E }) => ({ idx: O, value: E }))
3018
- );
3019
- const b = await k(t, f, x);
3020
- b && g.push(b);
3021
- }
3022
- p.forEach(({ fixedAxes: S }) => {
3023
- C.push(
3024
- (S ?? []).map(({ axisIdx: f, axisValue: h }) => ({ idx: f, value: h }))
3025
- );
3026
- });
3027
- for (const S of v)
3028
- for (const { selectedSource: f, fixedAxes: h } of S.selectorStates) {
3029
- w.push(A(f)), D.push(
3030
- (h ?? []).map(({ axisIdx: O, axisValue: E }) => ({ idx: O, value: E }))
3031
- );
3032
- const b = await k(t, f, x);
3033
- b && w.push(b);
3034
- }
3035
- const d = await t.pFrameProvider.getTableOuterJoin(
3036
- [...g, ...y],
3037
- w,
3038
- m,
3039
- !1,
3040
- C,
3041
- D
3042
- );
3043
- [...g, ...w].forEach((S) => {
3044
- const f = S.toCanonicalString(), h = P(S) ? d.columnsData[f] : d.axesData[f];
3045
- u.values[f] = [], u.values[f] = h;
3046
- });
3047
- const i = Object.keys(d.axesData).find(
3048
- (S) => {
3049
- var f;
3050
- return ((f = A(S)) == null ? void 0 : f.name) === Se;
3051
- }
3052
- );
3053
- return i ? u.values[ye] = d.axesData[i] : console.warn("Missed node id axis in data column"), { byColumns: u };
3054
- }
3055
- async createChartSettings(t, e) {
3056
- var o, n, l;
3057
- const s = (o = e.components.value.selectorStates[0]) == null ? void 0 : o.selectedSource, c = A(s);
3058
- if (!s || !P(c))
3059
- throw Error("Data column is not valid");
3060
- const r = [s], a = { type: "column", value: ye }, u = { type: "column", value: s }, p = e.components.height.selectorStates.length ? { type: "column", value: e.components.height.selectorStates[0].selectedSource } : void 0, m = e.components.labels.selectorStates.length ? { type: "column", value: e.components.labels.selectorStates[0].selectedSource } : void 0, y = {};
3061
- if (e.components.nodeColor.selectorStates.length) {
3062
- const C = e.components.nodeColor.selectorStates[0].selectedSource;
3063
- y.nodeColor = {
3064
- columnName: {
3065
- type: "column",
3066
- value: C,
3067
- label: await T(t, C, r)
3068
- }
3069
- };
3070
- }
3071
- if (e.components.nodeShape.selectorStates.length) {
3072
- const C = e.components.nodeShape.selectorStates[0].selectedSource;
3073
- y.nodeShape = {
3074
- columnName: {
3075
- type: "column",
3076
- value: C,
3077
- label: await T(t, C, r)
3078
- }
3079
- };
3080
- }
3081
- if (e.components.nodeSize.selectorStates.length) {
3082
- const C = e.components.nodeSize.selectorStates[0].selectedSource;
3083
- y.nodeSize = {
3084
- columnName: {
3085
- type: "column",
3086
- value: C,
3087
- label: await T(t, C, r)
3088
- }
3089
- };
3090
- }
3091
- if (e.components.lineColor.selectorStates.length) {
3092
- const C = e.components.lineColor.selectorStates[0].selectedSource;
3093
- y.lineColor = {
3094
- columnName: {
3095
- type: "column",
3096
- value: C,
3097
- label: await T(t, C, r)
3098
- }
3099
- };
3100
- }
3101
- let x, g, w;
3102
- if (e.components.heatmapAnnotation.selectorStates.length && e.components.heatmapAxis.selectorStates.length) {
3103
- const C = e.components.heatmapAnnotation.selectorStates[0].selectedSource;
3104
- x = {
3105
- type: "column",
3106
- value: C,
3107
- label: await T(t, C, []),
3108
- valueLabels: (n = await k(t, C, [])) == null ? void 0 : n.toCanonicalString()
3109
- };
3110
- const D = e.components.heatmapAxis.selectorStates[0].selectedSource;
3111
- g = {
3112
- type: "column",
3113
- value: D,
3114
- label: await T(t, D, [C]),
3115
- valueLabels: (l = await k(t, D, [C])) == null ? void 0 : l.toCanonicalString()
3116
- }, w = await Promise.all(
3117
- e.components.heatmapGroup.selectorStates.map(async (B) => {
3118
- var v;
3119
- return {
3120
- type: "column",
3121
- value: B.selectedSource,
3122
- label: await T(t, B.selectedSource, [C]),
3123
- valueLabels: (v = await k(t, B.selectedSource, [C])) == null ? void 0 : v.toCanonicalString()
3124
- };
3125
- })
3126
- );
3127
- } else if (e.components.heatmapForSequence.selectorStates.length) {
3128
- const C = e.components.heatmapForSequence.selectorStates[0].selectedSource;
3129
- x = {
3130
- type: "column",
3131
- value: C,
3132
- label: await T(t, C, [])
3133
- };
3134
- }
3135
- return {
3136
- type: "dendro",
3137
- id: a,
3138
- parentId: u,
3139
- height: p,
3140
- labels: m,
3141
- aes: y,
3142
- heatmapAnnotation: x,
3143
- heatmapAxis: g,
3144
- heatmapGroup: w
3145
- };
3146
- }
3147
- }, he = 1e6;
3148
- function ie(t, e) {
3149
- if (t === "String")
3150
- return e.data;
3151
- const o = new Array(e.data.length);
3152
- for (let n = 0; n < e.data.length; n++)
3153
- o[n] = Te(e, n, { absent: null, na: null });
3154
- return o;
3155
- }
3156
- var H = !1;
3157
- var St = class {
3158
- constructor(t, e) {
3159
- this.pframeHandle = t, this.pframeDriver = e;
3160
- }
3161
- async isColumnExisted(t) {
3162
- return !!await this.getColumnSpecById(t);
3163
- }
3164
- async getSingleColumnData(t, e = []) {
3165
- if (!await this.isColumnExisted(t))
3166
- return {
3167
- axesData: {},
3168
- data: []
3169
- };
3170
- try {
3171
- const o = Date.now(), n = await this.pframeDriver.calculateTableData(this.pframeHandle, {
3172
- src: {
3173
- type: "column",
3174
- column: t.name
3175
- },
3176
- filters: e,
3177
- sorting: []
3178
- }), l = n.filter((c) => c.spec.type === "axis"), s = n.filter((c) => c.spec.type === "column");
3179
- return {
3180
- axesData: l.reduce((c, r) => {
3181
- const a = _.fromAxisSpec(r.spec.spec);
3182
- return c[a.toCanonicalString()] = ie(a.type, r.data), c;
3183
- }, {}),
3184
- data: s.length ? ie(t.type, s[0].data) : []
3185
- };
3186
- } catch (o) {
3187
- throw console.error("PFrame: calculateTableData error"), o;
3188
- }
3189
- }
3190
- async getColumnUniqueValues(t, e = he, o = []) {
3191
- if (!await this.isColumnExisted(t))
3192
- return { values: [], overflow: !1 };
3193
- const n = {
3194
- columnId: t.name,
3195
- filters: o,
3196
- limit: e
3197
- };
3198
- try {
3199
- const l = Date.now(), s = await this.pframeDriver.getUniqueValues(this.pframeHandle, n);
3200
- let c = !1;
3201
- return s.overflow && (c = !0, console.warn(`More than ${e} values for ${t.name} column`)), {
3202
- values: Array.from(s.values.data).map(String),
3203
- overflow: c
3204
- };
3205
- } catch (l) {
3206
- throw console.error("PFrame: getUniqueValues for column error"), l;
3207
- }
3208
- }
3209
- async getAxisUniqueValues(t, e, o = he, n = []) {
3210
- const l = e.filter(P), s = await Promise.all(l.map((a) => this.getColumnSpecById(a))), c = t.toCanonicalString(), r = l.filter((a, u) => {
3211
- const p = s[u];
3212
- return p !== null && p.axesSpec.some((m) => _.fromAxisSpec(m).toCanonicalString() === c);
3213
- });
3214
- if (r.length === 0)
3215
- return { values: [], overflow: !1 };
3216
- try {
3217
- const a = Date.now(), u = await Promise.all(
3218
- r.map(
3219
- (m) => this.pframeDriver.getUniqueValues(this.pframeHandle, {
3220
- columnId: m.name,
3221
- axis: t.toPFrameId(),
3222
- filters: n,
3223
- limit: o
3224
- })
3225
- )
3226
- );
3227
- let p = !1;
3228
- return u.forEach((m, y) => {
3229
- m.overflow && (p = !0, console.warn(`More than ${o} values for ${r[y].name} column`));
3230
- }), {
3231
- values: ue.uniq(
3232
- ue.flatten(u.map((m) => Array.from(m.values.data).map(String)))
3233
- ),
3234
- overflow: p
3235
- };
3236
- } catch (a) {
3237
- throw console.error("PFrame: getUniqueValues for axis error", a), a;
3238
- }
3239
- }
3240
- async getTableOuterJoin(t, e, o = [], n = !0, l = [], s = []) {
3241
- const c = t.filter(P), r = e.filter(P), a = {
3242
- src: {
3243
- type: "outer",
3244
- primary: {
3245
- type: n ? "inner" : "full",
3246
- entries: c.map((u, p) => {
3247
- var m;
3248
- const y = (m = l[p]) == null ? void 0 : m.map((x) => ({
3249
- type: "constant",
3250
- axisIndex: x.idx,
3251
- constant: x.value
3252
- })).filter((x) => x.constant !== void 0);
3253
- return y != null && y.length ? {
3254
- type: "slicedColumn",
3255
- newId: u.name,
3256
- column: u.name,
3257
- axisFilters: y
3258
- } : {
3259
- type: "column",
3260
- column: u.name
3261
- };
3262
- })
3263
- },
3264
- secondary: r.map((u, p) => {
3265
- var m;
3266
- const y = (m = s[p]) == null ? void 0 : m.map((x) => ({
3267
- type: "constant",
3268
- axisIndex: x.idx,
3269
- constant: x.value
3270
- })).filter((x) => x.constant !== void 0);
3271
- return y != null && y.length ? {
3272
- type: "slicedColumn",
3273
- newId: u.name,
3274
- column: u.name,
3275
- axisFilters: y
3276
- } : {
3277
- type: "column",
3278
- column: u.name
3279
- };
3280
- })
3281
- },
3282
- filters: o,
3283
- sorting: []
3284
- };
3285
- try {
3286
- const u = Date.now(), p = await this.pframeDriver.calculateTableData(this.pframeHandle, a), m = p.filter((x) => x.spec.type === "axis"), y = p.filter((x) => x.spec.type === "column");
3287
- return {
3288
- axesData: m.reduce((x, g) => {
3289
- const w = _.fromAxisSpec(g.spec.spec);
3290
- return x[w.toCanonicalString()] = ie(w.type, g.data), x;
3291
- }, {}),
3292
- columnsData: y.reduce((x, g) => {
3293
- const w = g.spec.spec, C = new W({
3294
- name: g.spec.id,
3295
- type: w.valueType
3296
- });
3297
- return x[C.toCanonicalString()] = ie(C.type, g.data), x;
3298
- }, {}),
3299
- columnSpecs: y.reduce((x, g) => {
3300
- const w = g.spec.spec, C = new W({
3301
- name: g.spec.id,
3302
- type: w.valueType
3303
- });
3304
- return x[C.toCanonicalString()] = w, x;
3305
- }, {}),
3306
- axesSpecs: m.reduce((x, g) => {
3307
- const w = g.spec.spec, C = _.fromAxisSpec(w);
3308
- return x[C.toCanonicalString()] = w, x;
3309
- }, {})
3310
- };
3311
- } catch (u) {
3312
- throw console.error("PFrame: table outer join error"), console.info("error with request: ", a), u;
3313
- }
3314
- }
3315
- async getColumnSpecById(t) {
3316
- try {
3317
- const e = Date.now(), o = await this.pframeDriver.getColumnSpec(this.pframeHandle, t.name);
3318
- return o ?? null;
3319
- } catch {
3320
- return console.error("PFrame: get single column error"), null;
3321
- }
3322
- }
3323
- async getColumnAxesIds(t) {
3324
- var e, o;
3325
- return (o = (e = await this.getColumnSpecById(t)) == null ? void 0 : e.axesSpec.map((n) => _.fromAxisSpec(n))) != null ? o : [];
3326
- }
3327
- async getRequestColumnsFromSelectedSources(t) {
3328
- var e, o;
3329
- const n = [];
3330
- for (const l of t)
3331
- if (P(l)) {
3332
- const s = (o = (e = await this.getColumnSpecById(l)) == null ? void 0 : e.axesSpec) != null ? o : [];
3333
- n.push(...s.map((c) => _.fromAxisSpec(c).toPFrameId()));
3334
- }
3335
- return n;
3336
- }
3337
- async getColumnsList() {
3338
- return this.pframeDriver.listColumns(this.pframeHandle);
3339
- }
3340
- async getColumnsFull(t, e, o, n, l) {
3341
- try {
3342
- const s = {
3343
- columnFilter: {
3344
- type: o,
3345
- name: n,
3346
- annotationValue: l
3347
- },
3348
- compatibleWith: await this.getRequestColumnsFromSelectedSources(t),
3349
- strictlyCompatible: e
3350
- // should be true if we want to get meta and false if X/Y
3351
- }, c = Date.now(), r = await this.pframeDriver.findColumns(this.pframeHandle, s), a = [];
3352
- return r.hits.forEach((u) => {
3353
- a.push(u);
3354
- }), a;
3355
- } catch (s) {
3356
- throw console.error("PFrame: findColumns error"), s;
3357
- }
3358
- }
3359
- async getColumns(t, e, o, n, l) {
3360
- return (await this.getColumnsFull(t, e, o, n, l)).map(
3361
- (s) => new W({
3362
- name: s.columnId,
3363
- type: s.spec.valueType
3364
- })
3365
- );
3366
- }
3367
- async findColumnBy(t, e, o, n) {
3368
- try {
3369
- const l = {
3370
- columnFilter: {
3371
- name: [t],
3372
- ...e ? { type: [e] } : {},
3373
- ...o ? { annotationValue: o } : {},
3374
- ...n ? { domainValue: n } : {}
3375
- },
3376
- compatibleWith: [],
3377
- strictlyCompatible: !1
3378
- }, s = Date.now(), c = await this.pframeDriver.findColumns(this.pframeHandle, l), r = [];
3379
- return c.hits.forEach(({ columnId: a, spec: u }) => {
3380
- r.push(new W({ name: a, type: u.valueType }));
3381
- }), r.length > 1 && console.warn(`More than 1 column found for ${t}}`), r.length === 0 ? (console.warn(`No columns found for ${t}}`), null) : r[0];
3382
- } catch (l) {
3383
- throw console.error("PFrame: findColumns error"), l;
3384
- }
3385
- }
3386
- }, ht = class {
3387
- constructor(t, e, o = (n, l) => l ?? n) {
3388
- this.labelsModifier = o, this.pFrameProvider = new St(t, e);
3389
- }
3390
- }, Fe = {
1
+ import { BubbleStateController as a, InitialBubbleState as r } from "./controllers/controllersByChartType/bubble.js";
2
+ import { DendroStateController as o, InitialDendroState as l } from "./controllers/controllersByChartType/dendro.js";
3
+ import { DiscreteStateController as n, InitialDiscreteState as i } from "./controllers/controllersByChartType/discrete.js";
4
+ import { HeatmapStateController as s, InitialHeatmapState as p } from "./controllers/controllersByChartType/heatmap.js";
5
+ import { HistogramStateController as m, InitialHistogramState as S } from "./controllers/controllersByChartType/histogram.js";
6
+ import { ScatterplotStateController as c, InitialScatterplotState as C } from "./controllers/controllersByChartType/scatterplot.js";
7
+ import { ScatterplotUmapStateController as b, InitialScatterplotUmapState as u } from "./controllers/controllersByChartType/scatterplot-umap.js";
8
+ import "./_virtual/canonicalize.js";
9
+ import "./_virtual/lodash.js";
10
+ import "./node_modules/@milaboratories/pl-model-common/dist/index.js";
11
+ const e = {
3391
12
  controllers: {
3392
- discrete: new lt(),
3393
- scatterplot: new it(),
3394
- "scatterplot-umap": new pt(),
3395
- heatmap: new rt(),
3396
- dendro: new dt(),
3397
- histogram: new ot(),
3398
- bubble: new tt()
13
+ discrete: new n(),
14
+ scatterplot: new c(),
15
+ "scatterplot-umap": new b(),
16
+ heatmap: new s(),
17
+ dendro: new o(),
18
+ histogram: new m(),
19
+ bubble: new a()
3399
20
  },
3400
21
  initialStates: {
3401
- discrete: st,
3402
- scatterplot: ct,
3403
- "scatterplot-umap": ut,
3404
- heatmap: at,
3405
- dendro: mt,
3406
- histogram: nt,
3407
- bubble: et
22
+ discrete: i,
23
+ scatterplot: C,
24
+ "scatterplot-umap": u,
25
+ heatmap: p,
26
+ dendro: l,
27
+ histogram: S,
28
+ bubble: r
3408
29
  }
3409
30
  };
3410
- function wt(t) {
3411
- return Fe.controllers[t];
31
+ function U(t) {
32
+ return e.controllers[t];
3412
33
  }
3413
- function Ct(t) {
3414
- return Fe.initialStates[t];
34
+ function $(t) {
35
+ return e.initialStates[t];
3415
36
  }
3416
37
  export {
3417
- _ as AxisId,
3418
- tt as BubbleStateController,
3419
- W as ColumnId,
3420
- ht as DemoDataStore,
3421
- dt as DendroStateController,
3422
- lt as DiscreteStateController,
3423
- rt as HeatmapStateController,
3424
- it as ScatterplotStateController,
3425
- A as columnOrAxisIdFromString,
3426
- wt as getControllerByType,
3427
- Ct as getInitialStateByType,
3428
- P as isColumnId
38
+ a as BubbleStateController,
39
+ o as DendroStateController,
40
+ n as DiscreteStateController,
41
+ s as HeatmapStateController,
42
+ c as ScatterplotStateController,
43
+ U as getControllerByType,
44
+ $ as getInitialStateByType
3429
45
  };
3430
46
  //# sourceMappingURL=index.js.map