@platforma-sdk/model 1.42.16 → 1.42.22

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 (222) hide show
  1. package/dist/bconfig/index.d.ts +0 -1
  2. package/dist/bconfig/lambdas.d.ts +0 -1
  3. package/dist/bconfig/normalization.cjs +19 -0
  4. package/dist/bconfig/normalization.cjs.map +1 -0
  5. package/dist/bconfig/normalization.d.ts +0 -1
  6. package/dist/bconfig/normalization.js +16 -0
  7. package/dist/bconfig/normalization.js.map +1 -0
  8. package/dist/bconfig/types.cjs +8 -0
  9. package/dist/bconfig/types.cjs.map +1 -0
  10. package/dist/bconfig/types.d.ts +0 -1
  11. package/dist/bconfig/types.js +6 -0
  12. package/dist/bconfig/types.js.map +1 -0
  13. package/dist/bconfig/util.d.ts +0 -1
  14. package/dist/bconfig/v3.d.ts +0 -1
  15. package/dist/block_api_v1.d.ts +0 -1
  16. package/dist/block_api_v2.d.ts +0 -1
  17. package/dist/block_state_patch.d.ts +0 -1
  18. package/dist/block_state_util.cjs +28 -0
  19. package/dist/block_state_util.cjs.map +1 -0
  20. package/dist/block_state_util.d.ts +0 -1
  21. package/dist/block_state_util.js +24 -0
  22. package/dist/block_state_util.js.map +1 -0
  23. package/dist/branding.d.ts +0 -1
  24. package/dist/builder.cjs +166 -0
  25. package/dist/builder.cjs.map +1 -0
  26. package/dist/builder.d.ts +0 -1
  27. package/dist/builder.js +164 -0
  28. package/dist/builder.js.map +1 -0
  29. package/dist/components/PFrameForGraphs.cjs +261 -0
  30. package/dist/components/PFrameForGraphs.cjs.map +1 -0
  31. package/dist/components/PFrameForGraphs.d.ts +0 -1
  32. package/dist/components/PFrameForGraphs.js +254 -0
  33. package/dist/components/PFrameForGraphs.js.map +1 -0
  34. package/dist/components/PlAnnotations/filter.d.ts +0 -1
  35. package/dist/components/PlAnnotations/filters_ui.cjs +556 -0
  36. package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -0
  37. package/dist/components/PlAnnotations/filters_ui.d.ts +0 -1
  38. package/dist/components/PlAnnotations/filters_ui.js +548 -0
  39. package/dist/components/PlAnnotations/filters_ui.js.map +1 -0
  40. package/dist/components/PlAnnotations/index.d.ts +0 -1
  41. package/dist/components/PlAnnotations/types.d.ts +0 -1
  42. package/dist/components/PlDataTable.cjs +337 -0
  43. package/dist/components/PlDataTable.cjs.map +1 -0
  44. package/dist/components/PlDataTable.d.ts +0 -1
  45. package/dist/components/PlDataTable.js +324 -0
  46. package/dist/components/PlDataTable.js.map +1 -0
  47. package/dist/components/PlMultiSequenceAlignment.cjs +33 -0
  48. package/dist/components/PlMultiSequenceAlignment.cjs.map +1 -0
  49. package/dist/components/PlMultiSequenceAlignment.d.ts +0 -1
  50. package/dist/components/PlMultiSequenceAlignment.js +31 -0
  51. package/dist/components/PlMultiSequenceAlignment.js.map +1 -0
  52. package/dist/components/PlSelectionModel.cjs +11 -0
  53. package/dist/components/PlSelectionModel.cjs.map +1 -0
  54. package/dist/components/PlSelectionModel.d.ts +0 -1
  55. package/dist/components/PlSelectionModel.js +9 -0
  56. package/dist/components/PlSelectionModel.js.map +1 -0
  57. package/dist/components/index.d.ts +0 -1
  58. package/dist/config/actions.cjs +266 -0
  59. package/dist/config/actions.cjs.map +1 -0
  60. package/dist/config/actions.d.ts +0 -1
  61. package/dist/config/actions.js +233 -0
  62. package/dist/config/actions.js.map +1 -0
  63. package/dist/config/actions_kinds.d.ts +0 -1
  64. package/dist/config/index.d.ts +0 -1
  65. package/dist/config/model.d.ts +0 -1
  66. package/dist/config/model_meta.d.ts +0 -1
  67. package/dist/config/type_engine.d.ts +0 -1
  68. package/dist/config/type_util.d.ts +0 -1
  69. package/dist/env_value.cjs +11 -0
  70. package/dist/env_value.cjs.map +1 -0
  71. package/dist/env_value.d.ts +0 -1
  72. package/dist/env_value.js +9 -0
  73. package/dist/env_value.js.map +1 -0
  74. package/dist/global.d.ts +14 -0
  75. package/dist/index.cjs +138 -0
  76. package/dist/index.cjs.map +1 -0
  77. package/dist/index.d.ts +0 -1
  78. package/dist/index.js +26 -1
  79. package/dist/index.js.map +1 -1
  80. package/dist/internal.cjs +56 -0
  81. package/dist/internal.cjs.map +1 -0
  82. package/dist/internal.d.ts +0 -1
  83. package/dist/internal.js +49 -0
  84. package/dist/internal.js.map +1 -0
  85. package/dist/package.json.cjs +6 -0
  86. package/dist/package.json.cjs.map +1 -0
  87. package/dist/package.json.js +4 -0
  88. package/dist/package.json.js.map +1 -0
  89. package/dist/pframe.cjs +34 -0
  90. package/dist/pframe.cjs.map +1 -0
  91. package/dist/pframe.d.ts +0 -1
  92. package/dist/pframe.js +32 -0
  93. package/dist/pframe.js.map +1 -0
  94. package/dist/platforma.d.ts +0 -1
  95. package/dist/raw_globals.cjs +28 -0
  96. package/dist/raw_globals.cjs.map +1 -0
  97. package/dist/raw_globals.d.ts +0 -1
  98. package/dist/raw_globals.js +25 -0
  99. package/dist/raw_globals.js.map +1 -0
  100. package/dist/ref_util.cjs +21 -0
  101. package/dist/ref_util.cjs.map +1 -0
  102. package/dist/ref_util.d.ts +11 -12
  103. package/dist/ref_util.js +18 -0
  104. package/dist/ref_util.js.map +1 -0
  105. package/dist/render/accessor.cjs +233 -0
  106. package/dist/render/accessor.cjs.map +1 -0
  107. package/dist/render/accessor.d.ts +0 -1
  108. package/dist/render/accessor.js +230 -0
  109. package/dist/render/accessor.js.map +1 -0
  110. package/dist/render/api.cjs +514 -0
  111. package/dist/render/api.cjs.map +1 -0
  112. package/dist/render/api.d.ts +0 -1
  113. package/dist/render/api.js +511 -0
  114. package/dist/render/api.js.map +1 -0
  115. package/dist/render/future.cjs +35 -0
  116. package/dist/render/future.cjs.map +1 -0
  117. package/dist/render/future.d.ts +0 -1
  118. package/dist/render/future.js +33 -0
  119. package/dist/render/future.js.map +1 -0
  120. package/dist/render/index.d.ts +0 -1
  121. package/dist/render/internal.cjs +43 -0
  122. package/dist/render/internal.cjs.map +1 -0
  123. package/dist/render/internal.d.ts +0 -1
  124. package/dist/render/internal.js +37 -0
  125. package/dist/render/internal.js.map +1 -0
  126. package/dist/render/traversal_ops.d.ts +0 -1
  127. package/dist/render/util/axis_filtering.cjs +87 -0
  128. package/dist/render/util/axis_filtering.cjs.map +1 -0
  129. package/dist/render/util/axis_filtering.d.ts +0 -1
  130. package/dist/render/util/axis_filtering.js +85 -0
  131. package/dist/render/util/axis_filtering.js.map +1 -0
  132. package/dist/render/util/column_collection.cjs +309 -0
  133. package/dist/render/util/column_collection.cjs.map +1 -0
  134. package/dist/render/util/column_collection.d.ts +0 -1
  135. package/dist/render/util/column_collection.js +307 -0
  136. package/dist/render/util/column_collection.js.map +1 -0
  137. package/dist/render/util/index.d.ts +0 -1
  138. package/dist/render/util/label.cjs +153 -0
  139. package/dist/render/util/label.cjs.map +1 -0
  140. package/dist/render/util/label.d.ts +0 -1
  141. package/dist/render/util/label.js +149 -0
  142. package/dist/render/util/label.js.map +1 -0
  143. package/dist/render/util/pcolumn_data.cjs +342 -0
  144. package/dist/render/util/pcolumn_data.cjs.map +1 -0
  145. package/dist/render/util/pcolumn_data.d.ts +0 -1
  146. package/dist/render/util/pcolumn_data.js +330 -0
  147. package/dist/render/util/pcolumn_data.js.map +1 -0
  148. package/dist/render/util/pframe_upgraders.cjs +47 -0
  149. package/dist/render/util/pframe_upgraders.cjs.map +1 -0
  150. package/dist/render/util/pframe_upgraders.d.ts +0 -1
  151. package/dist/render/util/pframe_upgraders.js +45 -0
  152. package/dist/render/util/pframe_upgraders.js.map +1 -0
  153. package/dist/render/util/split_selectors.d.ts +0 -1
  154. package/dist/sdk_info.cjs +10 -0
  155. package/dist/sdk_info.cjs.map +1 -0
  156. package/dist/sdk_info.d.ts +0 -1
  157. package/dist/sdk_info.js +8 -0
  158. package/dist/sdk_info.js.map +1 -0
  159. package/dist/unionize.d.ts +0 -1
  160. package/dist/version.cjs +8 -0
  161. package/dist/version.cjs.map +1 -0
  162. package/dist/version.d.ts +0 -1
  163. package/dist/version.js +6 -0
  164. package/dist/version.js.map +1 -0
  165. package/package.json +16 -18
  166. package/src/components/PFrameForGraphs.test.ts +2 -2
  167. package/src/components/PlAnnotations/filters_ui.test.ts +1 -1
  168. package/src/render/util/label.test.ts +2 -2
  169. package/src/typing.test.ts +2 -1
  170. package/dist/bconfig/index.d.ts.map +0 -1
  171. package/dist/bconfig/lambdas.d.ts.map +0 -1
  172. package/dist/bconfig/normalization.d.ts.map +0 -1
  173. package/dist/bconfig/types.d.ts.map +0 -1
  174. package/dist/bconfig/util.d.ts.map +0 -1
  175. package/dist/bconfig/v3.d.ts.map +0 -1
  176. package/dist/block_api_v1.d.ts.map +0 -1
  177. package/dist/block_api_v2.d.ts.map +0 -1
  178. package/dist/block_state_patch.d.ts.map +0 -1
  179. package/dist/block_state_util.d.ts.map +0 -1
  180. package/dist/branding.d.ts.map +0 -1
  181. package/dist/builder.d.ts.map +0 -1
  182. package/dist/components/PFrameForGraphs.d.ts.map +0 -1
  183. package/dist/components/PlAnnotations/filter.d.ts.map +0 -1
  184. package/dist/components/PlAnnotations/filters_ui.d.ts.map +0 -1
  185. package/dist/components/PlAnnotations/index.d.ts.map +0 -1
  186. package/dist/components/PlAnnotations/types.d.ts.map +0 -1
  187. package/dist/components/PlDataTable.d.ts.map +0 -1
  188. package/dist/components/PlMultiSequenceAlignment.d.ts.map +0 -1
  189. package/dist/components/PlSelectionModel.d.ts.map +0 -1
  190. package/dist/components/index.d.ts.map +0 -1
  191. package/dist/config/actions.d.ts.map +0 -1
  192. package/dist/config/actions_kinds.d.ts.map +0 -1
  193. package/dist/config/index.d.ts.map +0 -1
  194. package/dist/config/model.d.ts.map +0 -1
  195. package/dist/config/model_meta.d.ts.map +0 -1
  196. package/dist/config/type_engine.d.ts.map +0 -1
  197. package/dist/config/type_util.d.ts.map +0 -1
  198. package/dist/env_value.d.ts.map +0 -1
  199. package/dist/index.d.ts.map +0 -1
  200. package/dist/index.mjs +0 -2845
  201. package/dist/index.mjs.map +0 -1
  202. package/dist/internal.d.ts.map +0 -1
  203. package/dist/pframe.d.ts.map +0 -1
  204. package/dist/platforma.d.ts.map +0 -1
  205. package/dist/raw_globals.d.ts.map +0 -1
  206. package/dist/ref_util.d.ts.map +0 -1
  207. package/dist/render/accessor.d.ts.map +0 -1
  208. package/dist/render/api.d.ts.map +0 -1
  209. package/dist/render/future.d.ts.map +0 -1
  210. package/dist/render/index.d.ts.map +0 -1
  211. package/dist/render/internal.d.ts.map +0 -1
  212. package/dist/render/traversal_ops.d.ts.map +0 -1
  213. package/dist/render/util/axis_filtering.d.ts.map +0 -1
  214. package/dist/render/util/column_collection.d.ts.map +0 -1
  215. package/dist/render/util/index.d.ts.map +0 -1
  216. package/dist/render/util/label.d.ts.map +0 -1
  217. package/dist/render/util/pcolumn_data.d.ts.map +0 -1
  218. package/dist/render/util/pframe_upgraders.d.ts.map +0 -1
  219. package/dist/render/util/split_selectors.d.ts.map +0 -1
  220. package/dist/sdk_info.d.ts.map +0 -1
  221. package/dist/unionize.d.ts.map +0 -1
  222. package/dist/version.d.ts.map +0 -1
package/dist/index.mjs DELETED
@@ -1,2845 +0,0 @@
1
- var at = Object.defineProperty;
2
- var lt = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var V = (t, e, n) => lt(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { isPColumn as $e, mapPObjectData as xe, readAnnotation as J, Annotation as R, parseJson as ut, isDataInfoEntries as Je, isDataInfo as pe, dataInfoToEntries as ct, selectorsToPredicate as Y, resolveAnchors as Ee, deriveNativeId as pt, isPColumnSpec as oe, isPartitionedDataInfoEntries as dt, getAxisId as F, entriesToDataInfo as ft, canonicalizeAxisId as ht, withEnrichments as Ve, AnchoredIdDeriver as ke, isPlRef as mt, mapValueInVOE as yt, ensurePColumn as gt, PColumnName as de, extractAllColumns as bt, mapPTableDef as vt, mapDataInfo as Ct, extractConfigGeneric as Tt, matchAxisId as U, getColumnIdAndSpec as ve, canonicalizeJson as D, readAnnotationJson as St, LinkerMap as Pt, getArrayFromAxisTree as At, getAxesTree as wt, visitDataInfo as Ft, getNormalizedAxesList as he, stringifyJson as Be, isPTableAbsent as xt, ValueType as It, uniquePlId as _t } from "@milaboratories/pl-model-common";
5
- export * from "@milaboratories/pl-model-common";
6
- import We from "canonicalize";
7
- import { z as M } from "zod";
8
- export * from "@milaboratories/pl-error-like";
9
- class Lt extends Error {
10
- constructor(e, n) {
11
- super(`${e.length}${n ? "+" : ""} errors, first error: ` + e[0].message), this.errors = e, this.moreErrors = n;
12
- }
13
- }
14
- function Et(t) {
15
- if (!t.ok) throw new Lt(t.errors, t.moreErrors);
16
- return t.value;
17
- }
18
- function bn(t) {
19
- return new Proxy(t, {
20
- get(e, n) {
21
- return Et(e[n]);
22
- }
23
- });
24
- }
25
- function A(t) {
26
- return typeof t == "string" || typeof t == "number" || typeof t == "boolean" || t === null ? se(t) : t;
27
- }
28
- function Z(t) {
29
- return { type: "GetFromCtx", variable: t };
30
- }
31
- function vn(t) {
32
- return {
33
- type: "Isolate",
34
- cfg: t
35
- };
36
- }
37
- const Cn = Z("$args"), Tn = Z("$it"), Sn = Z("$prod"), Pn = Z("$staging"), An = Z("$ui");
38
- function se(t) {
39
- return { type: "Immediate", value: t };
40
- }
41
- function Ge(t) {
42
- const e = {};
43
- for (const [n, r] of Object.entries(t)) e[n] = A(r);
44
- return {
45
- type: "MakeObject",
46
- template: e
47
- };
48
- }
49
- function wn(...t) {
50
- const e = [];
51
- for (const n of t) e.push(A(n));
52
- return {
53
- type: "MakeArray",
54
- template: e
55
- };
56
- }
57
- function ae(t, e) {
58
- return {
59
- type: "GetJsonField",
60
- source: A(t),
61
- field: A(e)
62
- };
63
- }
64
- function Fn(t, e, n = "$it") {
65
- return {
66
- type: "MapRecordValues",
67
- source: t,
68
- mapping: e,
69
- itVar: n
70
- };
71
- }
72
- function xn(t, e, n = "$it") {
73
- return {
74
- type: "MapArrayValues",
75
- source: t,
76
- mapping: e,
77
- itVar: n
78
- };
79
- }
80
- function In(t) {
81
- return {
82
- type: "Flatten",
83
- source: t
84
- };
85
- }
86
- function _n(t) {
87
- return {
88
- type: "IsEmpty",
89
- arg: t
90
- };
91
- }
92
- function Ln(t) {
93
- return {
94
- type: "Not",
95
- operand: t
96
- };
97
- }
98
- function En(t, e) {
99
- return {
100
- type: "And",
101
- operand1: t,
102
- operand2: e
103
- };
104
- }
105
- function Vn(t, e) {
106
- return {
107
- type: "Or",
108
- operand1: t,
109
- operand2: e
110
- };
111
- }
112
- function kn(t, e) {
113
- return {
114
- type: "GetResourceField",
115
- source: A(t),
116
- field: A(e)
117
- };
118
- }
119
- function Dn() {
120
- return function(t) {
121
- return {
122
- type: "GetResourceValueAsJson",
123
- source: A(t)
124
- };
125
- };
126
- }
127
- function On(t, e, n = "$it") {
128
- return {
129
- type: "MapResourceFields",
130
- source: t,
131
- mapping: e,
132
- itVar: n
133
- };
134
- }
135
- function Rn(t, e) {
136
- return {
137
- type: "GetBlobContent",
138
- range: e,
139
- source: A(t)
140
- };
141
- }
142
- function Nn(t, e) {
143
- return {
144
- type: "GetBlobContentAsString",
145
- range: e,
146
- source: A(t)
147
- };
148
- }
149
- function Un() {
150
- return function(t, e) {
151
- return {
152
- type: "GetBlobContentAsJson",
153
- range: e,
154
- source: A(t)
155
- };
156
- };
157
- }
158
- function Kn(t) {
159
- return {
160
- type: "GetDownloadedBlobContent",
161
- source: A(t)
162
- };
163
- }
164
- function qn(t) {
165
- return {
166
- type: "GetOnDemandBlobContent",
167
- source: A(t)
168
- };
169
- }
170
- function jn(t, e) {
171
- return {
172
- type: "ExtractArchiveAndGetURL",
173
- format: e,
174
- source: A(t)
175
- };
176
- }
177
- function Mn(t) {
178
- return {
179
- type: "GetImportProgress",
180
- source: A(t)
181
- };
182
- }
183
- function $n(t, e) {
184
- return {
185
- type: "GetLastLogs",
186
- source: A(t),
187
- lines: e
188
- };
189
- }
190
- function Jn(t, e) {
191
- return {
192
- type: "GetProgressLog",
193
- source: A(t),
194
- patternToSearch: e
195
- };
196
- }
197
- function Bn(t, e) {
198
- return {
199
- type: "GetProgressLogWithInfo",
200
- source: A(t),
201
- patternToSearch: e
202
- };
203
- }
204
- function Wn(t) {
205
- return {
206
- type: "GetLogHandle",
207
- source: A(t)
208
- };
209
- }
210
- function Vt() {
211
- return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
212
- }
213
- function He(t) {
214
- if (t && typeof globalThis.getPlatforma == "function")
215
- return globalThis.getPlatforma(t);
216
- if (typeof globalThis.platforma < "u") return globalThis.platforma;
217
- throw new Error("Can't get platforma instance.");
218
- }
219
- function kt() {
220
- if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
221
- }
222
- function v() {
223
- if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
224
- throw new Error("Not in config rendering context");
225
- }
226
- function G(t, e) {
227
- const n = kt();
228
- if (n === void 0) return !1;
229
- if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
230
- return n.callbackRegistry[t] = e, !0;
231
- }
232
- const me = /* @__PURE__ */ new Map();
233
- function Dt(t, e) {
234
- t in v().callbackRegistry || (v().callbackRegistry[t] = (n) => {
235
- for (const r of me.get(t))
236
- r(n);
237
- }, me.set(t, [])), me.get(t).push(e);
238
- }
239
- class L {
240
- constructor(e, n = (r) => r) {
241
- V(this, "isResolved", !1);
242
- V(this, "resolvedValue");
243
- this.handle = e, this.postProcess = n, Dt(e, (r) => {
244
- this.resolvedValue = n(r), this.isResolved = !0;
245
- });
246
- }
247
- map(e) {
248
- return new L(this.handle, (n) => e(this.postProcess(n)));
249
- }
250
- mapDefined(e) {
251
- return new L(this.handle, (n) => {
252
- const r = this.postProcess(n);
253
- return r ? e(r) : void 0;
254
- });
255
- }
256
- toJSON() {
257
- return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
258
- }
259
- }
260
- function Ce(t, e) {
261
- return t === void 0 ? void 0 : e(t);
262
- }
263
- class k {
264
- constructor(e, n) {
265
- this.handle = e, this.resolvePath = n;
266
- }
267
- resolve(...e) {
268
- const n = e.map(
269
- (r) => ({
270
- assertFieldType: "Input",
271
- ...typeof r == "string" ? { field: r } : r
272
- })
273
- );
274
- return this.resolveWithCommon({}, ...n);
275
- }
276
- resolveOutput(...e) {
277
- const n = e.map(
278
- (r) => ({
279
- assertFieldType: "Output",
280
- ...typeof r == "string" ? { field: r } : r
281
- })
282
- );
283
- return this.resolveWithCommon({}, ...n);
284
- }
285
- resolveInput(...e) {
286
- const n = e.map(
287
- (r) => ({
288
- assertFieldType: "Input",
289
- ...typeof r == "string" ? { field: r } : r
290
- })
291
- );
292
- return this.resolveWithCommon({}, ...n);
293
- }
294
- resolveAny(...e) {
295
- return this.resolveWithCommon({}, ...e);
296
- }
297
- resolveWithCommon(e, ...n) {
298
- const r = [
299
- ...this.resolvePath,
300
- ...n.map((i) => typeof i == "string" ? i : i.field)
301
- ];
302
- return Ce(
303
- v().resolveWithCommon(this.handle, e, ...n),
304
- (i) => new k(i, r)
305
- );
306
- }
307
- get resourceType() {
308
- return v().getResourceType(this.handle);
309
- }
310
- getInputsLocked() {
311
- return v().getInputsLocked(this.handle);
312
- }
313
- getOutputsLocked() {
314
- return v().getOutputsLocked(this.handle);
315
- }
316
- getIsReadyOrError() {
317
- return v().getIsReadyOrError(this.handle);
318
- }
319
- getIsFinal() {
320
- return v().getIsFinal(this.handle);
321
- }
322
- getError() {
323
- const e = [...this.resolvePath, "error"];
324
- return Ce(
325
- v().getError(this.handle),
326
- (n) => new k(n, e)
327
- );
328
- }
329
- listInputFields() {
330
- return v().listInputFields(this.handle);
331
- }
332
- listOutputFields() {
333
- return v().listOutputFields(this.handle);
334
- }
335
- listDynamicFields() {
336
- return v().listDynamicFields(this.handle);
337
- }
338
- getKeyValueBase64(e) {
339
- return v().getKeyValueBase64(this.handle, e);
340
- }
341
- getKeyValueAsString(e) {
342
- return v().getKeyValueAsString(this.handle, e);
343
- }
344
- getKeyValueAsJson(e) {
345
- const n = this.getKeyValueAsString(e);
346
- if (n == null) throw new Error("Resource has no content.");
347
- return JSON.parse(n);
348
- }
349
- getDataBase64() {
350
- return v().getDataBase64(this.handle);
351
- }
352
- getDataAsString() {
353
- return v().getDataAsString(this.handle);
354
- }
355
- getDataAsJson() {
356
- const e = this.getDataAsString();
357
- if (e == null) throw new Error("Resource has no content.");
358
- return JSON.parse(e);
359
- }
360
- /**
361
- *
362
- */
363
- getPColumns(e = !1, n = "") {
364
- const r = this.parsePObjectCollection(e, n);
365
- return r === void 0 ? void 0 : Object.entries(r).map(([, o]) => {
366
- if (!$e(o)) throw new Error(`not a PColumn (kind = ${o.spec.kind})`);
367
- return o;
368
- });
369
- }
370
- /**
371
- *
372
- */
373
- parsePObjectCollection(e = !1, n = "") {
374
- const r = v().parsePObjectCollection(
375
- this.handle,
376
- e,
377
- n,
378
- ...this.resolvePath
379
- );
380
- if (r === void 0) return;
381
- const i = {};
382
- for (const [o, s] of Object.entries(r)) {
383
- const a = [...this.resolvePath, o];
384
- i[o] = xe(s, (l) => new k(l, a));
385
- }
386
- return i;
387
- }
388
- getFileContentAsBase64(e) {
389
- return new L(v().getBlobContentAsBase64(this.handle, e));
390
- }
391
- getFileContentAsString(e) {
392
- return new L(v().getBlobContentAsString(this.handle, e));
393
- }
394
- getFileContentAsJson(e) {
395
- return new L(
396
- v().getBlobContentAsString(this.handle, e)
397
- ).mapDefined((n) => JSON.parse(n));
398
- }
399
- /**
400
- * @deprecated use getFileContentAsBase64
401
- */
402
- getBlobContentAsBase64() {
403
- return this.getFileContentAsBase64();
404
- }
405
- /**
406
- * @deprecated use getFileContentAsString
407
- */
408
- getBlobContentAsString() {
409
- return this.getFileContentAsString();
410
- }
411
- /**
412
- * @returns downloaded file handle
413
- */
414
- getFileHandle() {
415
- return new L(v().getDownloadedBlobContentHandle(this.handle));
416
- }
417
- /**
418
- * @deprecated use getFileHandle
419
- */
420
- getDownloadedBlobHandle() {
421
- return this.getFileHandle();
422
- }
423
- /**
424
- * @returns downloaded file handle
425
- */
426
- getRemoteFileHandle() {
427
- return new L(v().getOnDemandBlobContentHandle(this.handle));
428
- }
429
- /**
430
- * @deprecated use getRemoteFileHandle
431
- */
432
- getOnDemandBlobHandle() {
433
- return this.getRemoteFileHandle();
434
- }
435
- /**
436
- * @returns the url to the extracted folder
437
- */
438
- extractArchiveAndGetURL(e) {
439
- return new L(v().extractArchiveAndGetURL(this.handle, e));
440
- }
441
- getImportProgress() {
442
- return new L(v().getImportProgress(this.handle));
443
- }
444
- getLastLogs(e) {
445
- return new L(v().getLastLogs(this.handle, e));
446
- }
447
- getProgressLog(e) {
448
- return new L(v().getProgressLog(this.handle, e));
449
- }
450
- getProgressLogWithInfo(e) {
451
- return new L(v().getProgressLogWithInfo(this.handle, e));
452
- }
453
- getLogHandle() {
454
- return new L(v().getLogHandle(this.handle));
455
- }
456
- allFieldsResolved(e = "Input") {
457
- switch (e) {
458
- case "Input":
459
- return this.getInputsLocked() && this.listInputFields().every(
460
- (n) => this.resolve({ field: n, assertFieldType: "Input" }) !== void 0
461
- );
462
- case "Output":
463
- return this.getOutputsLocked() && this.listOutputFields().every(
464
- (n) => this.resolve({ field: n, assertFieldType: "Output" }) !== void 0
465
- );
466
- }
467
- }
468
- mapFields(e, n) {
469
- const { fieldType: r, requireLocked: i, skipUnresolved: o } = {
470
- fieldType: "Input",
471
- requireLocked: !0,
472
- skipUnresolved: !1,
473
- ...n
474
- }, s = e;
475
- if (i && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
476
- return;
477
- let l = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
478
- (c) => [c, this.resolve({ field: c, assertFieldType: r })]
479
- );
480
- return o && (l = l.filter((c) => c[1] !== void 0)), l.map(([c, m]) => s(c, m));
481
- }
482
- }
483
- const ze = "staging", Xe = "main", Ot = {
484
- explicitColumnsSupport: !0,
485
- inlineColumnsSupport: !0,
486
- activeArgs: !0,
487
- pTablePartitionFiltersSupport: !0,
488
- pFrameInSetFilterSupport: !0
489
- };
490
- function Ye(t) {
491
- return typeof t == "object" && t !== null && "__awaited_futures__" in t;
492
- }
493
- function Te(t, e, n) {
494
- if (e.has(n)) return;
495
- if (e.add(n), typeof n === "object")
496
- if (Ye(n)) n.__awaited_futures__.forEach((i) => t.add(i));
497
- else if (Array.isArray(n))
498
- for (const i of n) Te(t, e, i);
499
- else
500
- for (const [, i] of Object.entries(n))
501
- i !== n && Te(t, e, i);
502
- }
503
- function Rt(t) {
504
- const e = /* @__PURE__ */ new Set();
505
- return Te(e, /* @__PURE__ */ new Set(), t), e;
506
- }
507
- const Gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
508
- __proto__: null,
509
- GlobalCfgRenderCtxFeatureFlags: Ot,
510
- MainAccessorName: Xe,
511
- StagingAccessorName: ze,
512
- getAllFutureAwaits: Rt,
513
- isFutureAwait: Ye
514
- }, Symbol.toStringTag, { value: "Module" })), Nt = M.object({
515
- type: M.string(),
516
- importance: M.number().optional(),
517
- id: M.string().optional(),
518
- label: M.string()
519
- }), Ut = M.array(Nt), Kt = 1e-3, qt = "__LABEL__", De = "__LABEL__@1";
520
- function Qe(t, e, n = {}) {
521
- const r = /* @__PURE__ */ new Map(), i = n.forceTraceElements !== void 0 && n.forceTraceElements.length > 0 ? new Set(n.forceTraceElements) : void 0, o = /* @__PURE__ */ new Map(), s = t.map((f) => {
522
- const y = e(f);
523
- let p, g, P;
524
- "spec" in y && typeof y.spec == "object" ? (p = y.spec, g = y.prefixTrace, P = y.suffixTrace) : p = y;
525
- const E = J(p, R.Label), x = J(p, R.Trace), T = (x ? Ut.safeParse(ut(x)).data : void 0) ?? [], S = [
526
- ...g ?? [],
527
- ...T,
528
- ...P ?? []
529
- ];
530
- if (E !== void 0) {
531
- const u = { label: E, type: qt, importance: -2 };
532
- n.addLabelAsSuffix ? S.push(u) : S.splice(0, 0, u);
533
- }
534
- const C = [], I = /* @__PURE__ */ new Map();
535
- for (let u = S.length - 1; u >= 0; --u) {
536
- const { type: b } = S[u], K = S[u].importance ?? 0, B = (I.get(b) ?? 0) + 1;
537
- I.set(b, B);
538
- const O = `${b}@${B}`;
539
- o.set(O, (o.get(O) ?? 0) + 1), r.set(
540
- O,
541
- Math.max(
542
- r.get(O) ?? Number.NEGATIVE_INFINITY,
543
- K - (S.length - u) * Kt
544
- )
545
- ), C.push({ ...S[u], fullType: O, occurrenceIndex: B });
546
- }
547
- return C.reverse(), {
548
- value: f,
549
- spec: p,
550
- label: E,
551
- fullTrace: C
552
- };
553
- }), a = [], l = [], c = [...r];
554
- c.sort(([, f], [, y]) => y - f);
555
- for (const [f] of c)
556
- f.endsWith("@1") || o.get(f) === t.length ? a.push(f) : l.push(f);
557
- const m = (f, y = !1) => {
558
- const p = [];
559
- for (let g = 0; g < s.length; g++) {
560
- const P = s[g], E = P.fullTrace.filter((S) => f.has(S.fullType) || i && i.has(S.type));
561
- if (E.length === 0)
562
- if (y)
563
- p.push({
564
- label: "Unlabeled",
565
- value: P.value
566
- });
567
- else return;
568
- const x = E.map((S) => S.label), T = n.separator ?? " / ";
569
- p.push({
570
- label: x.join(T),
571
- value: P.value
572
- });
573
- }
574
- return p;
575
- };
576
- if (a.length === 0) {
577
- if (l.length !== 0) throw new Error("Non-empty secondary types list while main types list is empty.");
578
- return m(new Set(De), !0);
579
- }
580
- let d = 0, h = -1;
581
- for (; d < a.length; ) {
582
- const f = /* @__PURE__ */ new Set();
583
- n.includeNativeLabel && f.add(De);
584
- for (let p = 0; p < d; ++p) f.add(a[p]);
585
- h >= 0 && f.add(a[h]);
586
- const y = m(f);
587
- if (y !== void 0 && new Set(y.map((p) => p.label)).size === t.length) return y;
588
- h++, h >= a.length && (d++, h = d);
589
- }
590
- return m(/* @__PURE__ */ new Set([...a, ...l]), !0);
591
- }
592
- const ee = "PColumnData/", le = ee + "ResourceMap", ue = ee + "Partitioned/ResourceMap", H = ee + "JsonPartitioned", $ = ee + "BinaryPartitioned", Ze = ee + "Partitioned/", ce = Ze + "JsonPartitioned", z = Ze + "BinaryPartitioned";
593
- function et(t, e, n, r = [], i) {
594
- if (t === void 0) return !1;
595
- switch (t.resourceType.name) {
596
- case le: {
597
- let o = t.getInputsLocked();
598
- for (const s of t.listInputFields()) {
599
- const a = t.resolve({ field: s, assertFieldType: "Input" }), l = [...r, ...JSON.parse(s)], c = a === void 0 ? void 0 : e(a);
600
- c === void 0 && (o = !1), (c !== void 0 || i) && n.push({ key: l, value: c });
601
- }
602
- return o;
603
- }
604
- case ue: {
605
- let o = t.getInputsLocked();
606
- for (const s of t.listInputFields()) {
607
- const a = t.resolve({ field: s, assertFieldType: "Input" });
608
- if (a === void 0) o = !1;
609
- else {
610
- const l = [...r, ...JSON.parse(s)], c = et(
611
- a,
612
- e,
613
- n,
614
- l,
615
- i
616
- );
617
- o = o && c;
618
- }
619
- }
620
- return o;
621
- }
622
- default:
623
- throw new Error(`Unknown resource type: ${t.resourceType.name}`);
624
- }
625
- }
626
- function Hn(t, e, n = !1) {
627
- const r = [];
628
- return { isComplete: et(t, e, r, [], n), data: r };
629
- }
630
- const Se = (t) => {
631
- if (t.endsWith(".index"))
632
- return { baseKey: t.substring(0, t.length - 6), type: "index" };
633
- if (t.endsWith(".values"))
634
- return { baseKey: t.substring(0, t.length - 7), type: "values" };
635
- throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
636
- };
637
- function jt(t) {
638
- if (!t) return;
639
- const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
640
- let i = 0;
641
- switch (e) {
642
- case le:
643
- i = n.keyLength;
644
- break;
645
- case ue:
646
- i = n.partitionKeyLength + n.keyLength;
647
- break;
648
- case H:
649
- case $:
650
- i = n.partitionKeyLength;
651
- break;
652
- case z:
653
- case ce:
654
- i = n.superPartitionKeyLength + n.partitionKeyLength;
655
- break;
656
- }
657
- switch (e) {
658
- case le:
659
- case H:
660
- case $:
661
- for (let o of t.listInputFields()) {
662
- e === $ && (o = Se(o).baseKey);
663
- const s = [...JSON.parse(o)];
664
- r.push(s);
665
- }
666
- break;
667
- case ue:
668
- case z:
669
- case ce:
670
- for (const o of t.listInputFields()) {
671
- const s = [...JSON.parse(o)], a = t.resolve({ field: o, assertFieldType: "Input" });
672
- if (a !== void 0)
673
- for (let l of a.listInputFields()) {
674
- e === z && (l = Se(l).baseKey);
675
- const c = [...s, ...JSON.parse(l)];
676
- r.push(c);
677
- }
678
- }
679
- break;
680
- }
681
- return { data: r, keyLength: i };
682
- }
683
- function Mt(t) {
684
- if (t.type !== "JsonPartitioned" && t.type !== "BinaryPartitioned")
685
- throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${t.type}`);
686
- const { parts: e, partitionKeyLength: n } = t, r = [];
687
- for (let i = 0; i < n; ++i)
688
- r.push(/* @__PURE__ */ new Set());
689
- for (const i of e) {
690
- const o = i.key;
691
- if (o.length !== n)
692
- throw new Error(
693
- `Key length (${o.length}) does not match partition length (${n}) for key: ${JSON.stringify(
694
- o
695
- )}`
696
- );
697
- for (let s = 0; s < n; ++s)
698
- r[s].add(o[s]);
699
- }
700
- return r.map((i) => Array.from(i.values()));
701
- }
702
- function $t(t) {
703
- if (t === void 0) return;
704
- if (Je(t))
705
- return Mt(t);
706
- const e = jt(t);
707
- if (!e) return;
708
- const { data: n, keyLength: r } = e, i = [];
709
- for (let o = 0; o < r; ++o)
710
- i.push(/* @__PURE__ */ new Set());
711
- for (const o of n) {
712
- if (o.length !== r)
713
- throw new Error("key length does not match partition length");
714
- for (let s = 0; s < r; ++s)
715
- i[s].add(o[s]);
716
- }
717
- return i.map((o) => Array.from(o.values()));
718
- }
719
- function Pe(t, e = []) {
720
- if (t === void 0 || !t.getIsReadyOrError()) return;
721
- const n = t.resourceType.name, r = t.getDataAsJson();
722
- if (e.length > 0 && (n === ce || n === z))
723
- throw new Error(`Unexpected nested super-partitioned resource: ${n}`);
724
- switch (n) {
725
- case le:
726
- case ue:
727
- throw new Error(`Only data columns are supported, got: ${n}`);
728
- case H: {
729
- if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
730
- throw new Error(`Missing partitionKeyLength in metadata for ${n}`);
731
- const i = [];
732
- for (const o of t.listInputFields()) {
733
- const s = t.resolve({ field: o, assertFieldType: "Input" });
734
- if (s === void 0) return;
735
- const a = [...e, ...JSON.parse(o)];
736
- i.push({ key: a, value: s });
737
- }
738
- return {
739
- type: "JsonPartitioned",
740
- partitionKeyLength: r.partitionKeyLength,
741
- parts: i
742
- };
743
- }
744
- case $: {
745
- if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
746
- throw new Error(`Missing partitionKeyLength in metadata for ${n}`);
747
- const i = [], o = /* @__PURE__ */ new Map();
748
- for (const s of t.listInputFields()) {
749
- const a = Se(s), l = t.resolve({ field: s, assertFieldType: "Input" });
750
- if (l === void 0) return;
751
- let c = o.get(a.baseKey);
752
- c || (c = {}, o.set(a.baseKey, c)), a.type === "index" ? c.index = l : c.values = l;
753
- }
754
- for (const [s, a] of o.entries()) {
755
- if (!a.index || !a.values) return;
756
- const l = [...e, ...JSON.parse(s)];
757
- i.push({
758
- key: l,
759
- value: {
760
- index: a.index,
761
- values: a.values
762
- }
763
- });
764
- }
765
- return {
766
- type: "BinaryPartitioned",
767
- partitionKeyLength: r.partitionKeyLength,
768
- parts: i
769
- };
770
- }
771
- case ce: {
772
- if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
773
- throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);
774
- const i = r.superPartitionKeyLength + r.partitionKeyLength, o = [];
775
- for (const s of t.listInputFields()) {
776
- const a = t.resolve({ field: s, assertFieldType: "Input" });
777
- if (a === void 0) return;
778
- if (a.resourceType.name !== H)
779
- throw new Error(`Expected ${H} inside ${n}, but got ${a.resourceType.name}`);
780
- const l = Pe(a, JSON.parse(s));
781
- if (l === void 0) return;
782
- if (l.type !== "JsonPartitioned")
783
- throw new Error(`Unexpected inner result type for ${n}: ${l.type}`);
784
- o.push(...l.parts);
785
- }
786
- return {
787
- type: "JsonPartitioned",
788
- partitionKeyLength: i,
789
- parts: o
790
- };
791
- }
792
- case z: {
793
- if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
794
- throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n}`);
795
- const i = r.superPartitionKeyLength + r.partitionKeyLength, o = [];
796
- for (const s of t.listInputFields()) {
797
- const a = t.resolve({ field: s, assertFieldType: "Input" });
798
- if (a === void 0) return;
799
- if (a.resourceType.name !== $)
800
- throw new Error(`Expected ${$} inside ${n}, but got ${a.resourceType.name}`);
801
- const l = Pe(a, JSON.parse(s));
802
- if (l === void 0) return;
803
- if (l.type !== "BinaryPartitioned")
804
- throw new Error(`Unexpected inner result type for ${n}: ${l.type}`);
805
- o.push(...l.parts);
806
- }
807
- return {
808
- type: "BinaryPartitioned",
809
- partitionKeyLength: i,
810
- parts: o
811
- };
812
- }
813
- default:
814
- throw new Error(`Unknown resource type: ${n}`);
815
- }
816
- }
817
- function Jt(t) {
818
- if (t !== void 0) {
819
- if (Je(t)) return t;
820
- if (pe(t)) return ct(t);
821
- if (t instanceof k) return Pe(t);
822
- throw new Error(`Unexpected input type: ${typeof t}`);
823
- }
824
- }
825
- function Bt(t, e) {
826
- const n = [...e].sort((s, a) => a[0] - s[0]), { type: r } = t;
827
- switch (r) {
828
- case "Json": {
829
- const { keyLength: s } = t;
830
- for (const [a] of e)
831
- if (a >= s)
832
- throw new Error(`Can't filter on non-data axis ${a}. Must be >= ${s}`);
833
- break;
834
- }
835
- case "JsonPartitioned":
836
- case "BinaryPartitioned":
837
- case "ParquetPartitioned": {
838
- const { partitionKeyLength: s } = t;
839
- for (const [a] of e)
840
- if (a >= s)
841
- throw new Error(`Can't filter on non-partitioned axis ${a}. Must be >= ${s}`);
842
- break;
843
- }
844
- default:
845
- throw new Error(`Unsupported data info type: ${r}`);
846
- }
847
- const i = (s) => {
848
- for (const [a, l] of n)
849
- if (s[a] !== l)
850
- return !1;
851
- return !0;
852
- }, o = (s) => {
853
- const a = [...s];
854
- for (const [l] of n)
855
- a.splice(l, 1);
856
- return a;
857
- };
858
- switch (t.type) {
859
- case "Json":
860
- return {
861
- type: "Json",
862
- keyLength: t.keyLength - e.length,
863
- data: t.data.filter((s) => i(s.key)).map((s) => ({
864
- key: o(s.key),
865
- value: s.value
866
- }))
867
- };
868
- case "JsonPartitioned":
869
- return {
870
- type: "JsonPartitioned",
871
- partitionKeyLength: t.partitionKeyLength - e.length,
872
- parts: t.parts.filter((s) => i(s.key)).map((s) => ({
873
- key: o(s.key),
874
- value: s.value
875
- }))
876
- };
877
- case "BinaryPartitioned":
878
- return {
879
- type: "BinaryPartitioned",
880
- partitionKeyLength: t.partitionKeyLength - e.length,
881
- parts: t.parts.filter((s) => i(s.key)).map((s) => ({
882
- key: o(s.key),
883
- value: s.value
884
- }))
885
- };
886
- case "ParquetPartitioned":
887
- return {
888
- type: "ParquetPartitioned",
889
- partitionKeyLength: t.partitionKeyLength - e.length,
890
- parts: t.parts.filter((s) => i(s.key)).map((s) => ({
891
- key: o(s.key),
892
- value: s.value
893
- }))
894
- };
895
- }
896
- }
897
- function Wt(t) {
898
- if (!Array.isArray(t)) return !1;
899
- if (t.length === 0) return !0;
900
- const e = t[0];
901
- return typeof e == "object" && e !== null && "key" in e && "val" in e;
902
- }
903
- class Gt {
904
- constructor(e) {
905
- this.columns = e;
906
- }
907
- selectColumns(e) {
908
- const n = typeof e == "function" ? e : Y(e);
909
- return this.columns.filter((r) => n(r.spec));
910
- }
911
- }
912
- function Ht(t) {
913
- if (t)
914
- return t.map((e) => ({
915
- type: `split:${ht(e.axisId)}`,
916
- label: e.label,
917
- importance: 1e6
918
- // High importance for split filters in labels
919
- }));
920
- }
921
- function zt(t) {
922
- if (t)
923
- return t.map((e) => [e.axisIdx, e.value]);
924
- }
925
- function Xt(t, e) {
926
- if (!e || e.length === 0) return t;
927
- const n = [...e].sort((r, i) => r[0] - i[0]);
928
- return We({ id: t, axisFilters: n });
929
- }
930
- function Oe(t) {
931
- if (!t || typeof t != "object") return !1;
932
- const e = t, n = e.domain && typeof e.domain == "object" && Object.values(e.domain).some((i) => typeof i == "object" && i !== null && "anchor" in i), r = e.axes && Array.isArray(e.axes) && e.axes.some((i) => typeof i == "object" && i !== null && "anchor" in i);
933
- return !!e.domainAnchor || n || r;
934
- }
935
- function Yt(t) {
936
- if (typeof t != "object" || !("axes" in t) || t.axes === void 0)
937
- return [];
938
- const e = t.axes.map((n, r) => typeof n == "object" && "split" in n && n.split === !0 ? r : -1).filter((n) => n !== -1);
939
- if (e.length > 0 && t.partialAxesMatch !== void 0)
940
- throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");
941
- return e.sort((n, r) => n - r), e;
942
- }
943
- class Q {
944
- constructor() {
945
- V(this, "defaultProviderStore", []);
946
- V(this, "providers", [new Gt(this.defaultProviderStore)]);
947
- V(this, "axisLabelProviders", []);
948
- }
949
- addColumnProvider(e) {
950
- return this.providers.push(e), this;
951
- }
952
- addAxisLabelProvider(e) {
953
- return this.axisLabelProviders.push(e), this;
954
- }
955
- addColumns(e) {
956
- return this.defaultProviderStore.push(...e), this;
957
- }
958
- addColumn(e) {
959
- return this.defaultProviderStore.push(e), this;
960
- }
961
- /** Fetches labels for a given axis from the registered providers */
962
- findLabels(e) {
963
- for (const n of this.axisLabelProviders) {
964
- const r = n.findLabels(e);
965
- if (r) return r;
966
- }
967
- }
968
- getUniversalEntries(e, n) {
969
- const { anchorCtx: r, labelOps: i, dontWaitAllData: o = !1, overrideLabelAnnotation: s = !1, exclude: a } = n ?? {}, l = {
970
- ...s && (i == null ? void 0 : i.includeNativeLabel) !== !1 ? { includeNativeLabel: !0 } : {},
971
- ...i ?? {}
972
- };
973
- let c = () => !1;
974
- if (a) {
975
- const p = (Array.isArray(a) ? a : [a]).map((g) => {
976
- if (Oe(g)) {
977
- if (!r)
978
- throw new Error("Anchored selectors in exclude require an AnchoredIdDeriver to be provided in options.");
979
- return Y(Ee(r.anchors, g, n));
980
- } else
981
- return Y(g);
982
- });
983
- c = (g) => p.some((P) => P(g));
984
- }
985
- const m = typeof e == "function" ? [e] : Array.isArray(e) ? e : [e], d = [], h = /* @__PURE__ */ new Set();
986
- for (const p of m) {
987
- const g = Oe(p);
988
- let P;
989
- if (g) {
990
- if (!r)
991
- throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");
992
- P = Ee(r.anchors, p, n);
993
- } else
994
- P = p;
995
- const E = /* @__PURE__ */ new Set(), x = [];
996
- for (const C of this.providers) {
997
- const I = C.selectColumns(P);
998
- for (const u of I) {
999
- if (c(u.spec)) continue;
1000
- if (E.has(u.id))
1001
- throw new Error(`Duplicate column id ${u.id} in provider ${C.constructor.name}`);
1002
- const b = pt(u.spec);
1003
- h.has(b) || (E.add(u.id), h.add(b), x.push(u));
1004
- }
1005
- }
1006
- if (x.length === 0) continue;
1007
- const T = Yt(p), S = T.length > 0;
1008
- for (const C of x) {
1009
- if (!oe(C.spec)) continue;
1010
- const I = C.spec;
1011
- if (S) {
1012
- if (Wt(C.data))
1013
- throw new Error(`Splitting is not supported for PColumns with PColumnValues data format. Column id: ${C.id}`);
1014
- const u = Jt(C.data);
1015
- if (!u) {
1016
- if (o) continue;
1017
- return;
1018
- }
1019
- if (!dt(u))
1020
- throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${u.type} for column ${C.id}`);
1021
- const b = $t(u), K = T[T.length - 1];
1022
- if (K >= u.partitionKeyLength)
1023
- throw new Error(`Not enough partition keys (${u.partitionKeyLength}) for requested split axes (max index ${K}) in column ${I.name}`);
1024
- const B = T.map((_) => this.findLabels(F(I.axesSpec[_]))), O = [], _e = (_, W) => {
1025
- if (W >= T.length) {
1026
- if (O.push([..._]), O.length > 1e4)
1027
- throw new Error("Too many key combinations, aborting.");
1028
- return;
1029
- }
1030
- const q = T[W];
1031
- if (q >= b.length)
1032
- throw new Error(`Axis index ${q} out of bounds for unique keys array (length ${b.length}) during split key generation for column ${C.id}`);
1033
- const j = b[q];
1034
- if (!j || j.length === 0) {
1035
- O.length = 0;
1036
- return;
1037
- }
1038
- for (const te of j)
1039
- _.push(te), _e(_, W + 1), _.pop();
1040
- };
1041
- if (_e([], 0), O.length === 0)
1042
- continue;
1043
- const Le = [...I.axesSpec], rt = T.map((_) => _);
1044
- for (let _ = T.length - 1; _ >= 0; _--)
1045
- Le.splice(T[_], 1);
1046
- const it = { ...I, axesSpec: Le };
1047
- for (const _ of O) {
1048
- const W = _.map((q, j) => {
1049
- const te = rt[j], ot = F(I.axesSpec[te]), fe = B[j], st = (fe == null ? void 0 : fe[q]) ?? String(q);
1050
- return { axisIdx: te, axisId: ot, value: q, label: st };
1051
- });
1052
- d.push({
1053
- type: "split",
1054
- originalColumn: C,
1055
- spec: I,
1056
- adjustedSpec: it,
1057
- dataEntries: u,
1058
- axisFilters: W
1059
- });
1060
- }
1061
- } else
1062
- d.push({
1063
- type: "direct",
1064
- originalColumn: C,
1065
- spec: I,
1066
- adjustedSpec: I
1067
- });
1068
- }
1069
- }
1070
- if (d.length === 0) return [];
1071
- const f = Qe(
1072
- d,
1073
- (p) => ({
1074
- spec: p.spec,
1075
- suffixTrace: p.type === "split" ? Ht(p.axisFilters) : void 0
1076
- }),
1077
- l
1078
- ), y = [];
1079
- for (const { value: p, label: g } of f) {
1080
- const { originalColumn: P, spec: E } = p, x = p.type === "split" ? p.axisFilters : void 0, T = zt(x);
1081
- let S;
1082
- r ? S = r.deriveS(E, T) : S = Xt(P.id, T);
1083
- let C = { ...p.adjustedSpec };
1084
- s && (C = {
1085
- ...C,
1086
- annotations: {
1087
- ...C.annotations ?? {},
1088
- [R.Label]: g
1089
- }
1090
- }), y.push({
1091
- id: S,
1092
- spec: C,
1093
- data: () => p.type === "split" ? ft(Bt(p.dataEntries, T)) : p.originalColumn.data,
1094
- label: g
1095
- });
1096
- }
1097
- return y;
1098
- }
1099
- getColumns(e, n) {
1100
- const r = this.getUniversalEntries(e, {
1101
- overrideLabelAnnotation: !0,
1102
- // default for getColumns
1103
- ...n ?? {}
1104
- });
1105
- if (!r) return;
1106
- const i = [];
1107
- for (const o of r) {
1108
- const s = o.data();
1109
- if (!s) {
1110
- if (n != null && n.dontWaitAllData) continue;
1111
- return;
1112
- }
1113
- i.push({
1114
- id: o.id,
1115
- spec: o.spec,
1116
- data: s
1117
- });
1118
- }
1119
- return i;
1120
- }
1121
- }
1122
- function Ae(t) {
1123
- const e = (i) => i.operator !== "InSet" ? i : {
1124
- operator: "Or",
1125
- operands: i.references.map((o) => ({
1126
- operator: "Equal",
1127
- reference: o
1128
- }))
1129
- }, n = (i, o) => {
1130
- switch (i.operator) {
1131
- case "And":
1132
- return {
1133
- ...i,
1134
- operands: i.operands.map((a) => n(a, o))
1135
- };
1136
- case "Or":
1137
- return {
1138
- ...i,
1139
- operands: i.operands.map((a) => n(a, o))
1140
- };
1141
- case "Not":
1142
- return {
1143
- ...i,
1144
- operand: n(i.operand, o)
1145
- };
1146
- default:
1147
- return o(i);
1148
- }
1149
- }, r = (i, o) => ({
1150
- ...i,
1151
- predicate: n(i.predicate, o)
1152
- });
1153
- return t.map((i) => r(i, e));
1154
- }
1155
- function ye(t, e) {
1156
- if (t === void 0) return e === void 0;
1157
- if (e === void 0) return !0;
1158
- for (const n in e)
1159
- if (t[n] !== e[n]) return !1;
1160
- return !0;
1161
- }
1162
- function Re(t) {
1163
- return xe(t, (e) => e instanceof k ? e.handle : pe(e) ? Ct(e, (n) => n.handle) : e);
1164
- }
1165
- class Qt {
1166
- constructor() {
1167
- V(this, "ctx", v());
1168
- }
1169
- /**
1170
- * @deprecated use getOptions()
1171
- */
1172
- calculateOptions(e) {
1173
- return this.ctx.calculateOptions(e);
1174
- }
1175
- getOptions(e, n) {
1176
- const r = typeof e == "function" ? e : Y(e), i = this.getSpecs().entries.filter((a) => r(a.obj));
1177
- let o = {}, s = !1;
1178
- return typeof n < "u" && (typeof n == "function" ? o = n : typeof n == "object" && ("includeNativeLabel" in n || "separator" in n || "addLabelAsSuffix" in n ? o = n : (n = n, o = n.label ?? {}, s = n.refsWithEnrichments ?? !1))), typeof o == "object" ? Qe(i, (a) => a.obj, o ?? {}).map(({ value: { ref: a }, label: l }) => ({
1179
- ref: Ve(a, s),
1180
- label: l
1181
- })) : i.map(({ ref: a, obj: l }) => ({
1182
- ref: Ve(a, s),
1183
- label: o(l, a)
1184
- }));
1185
- }
1186
- resolveAnchorCtx(e) {
1187
- if (e instanceof ke) return e;
1188
- const n = {};
1189
- for (const [r, i] of Object.entries(e))
1190
- if (mt(i)) {
1191
- const o = this.getPColumnSpecByRef(i);
1192
- if (!o)
1193
- return;
1194
- n[r] = o;
1195
- } else
1196
- n[r] = i;
1197
- return new ke(n);
1198
- }
1199
- /**
1200
- * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
1201
- *
1202
- * @param anchorsOrCtx - Anchor context for column selection (same as in getCanonicalOptions)
1203
- * @param predicateOrSelectors - Predicate or selectors for filtering columns (same as in getCanonicalOptions)
1204
- * @param opts - Optional configuration for label generation and data waiting
1205
- * @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
1206
- */
1207
- getAnchoredPColumns(e, n, r) {
1208
- const i = this.resolveAnchorCtx(e);
1209
- if (i)
1210
- return new Q().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n, {
1211
- ...r,
1212
- anchorCtx: i
1213
- });
1214
- }
1215
- /**
1216
- * Calculates anchored identifier options for columns matching a given predicate and returns their
1217
- * canonicalized representations.
1218
- *
1219
- * This function filters column specifications from the result pool that match the provided predicate,
1220
- * creates a standardized AnchorCtx from the provided anchors, and generates a list of label-value
1221
- * pairs for UI components (like dropdowns).
1222
- *
1223
- * @param anchorsOrCtx - Either:
1224
- * - An existing AnchorCtx instance
1225
- * - A record mapping anchor IDs to PColumnSpec objects
1226
- * - A record mapping anchor IDs to PlRef objects (which will be resolved to PColumnSpec)
1227
- * @param predicateOrSelectors - Either:
1228
- * - A predicate function that takes a PColumnSpec and returns a boolean.
1229
- * Only specs that return true will be included.
1230
- * - An APColumnSelector object for declarative filtering, which will be
1231
- * resolved against the provided anchors and matched using matchPColumn.
1232
- * - An array of APColumnSelector objects - columns matching ANY selector
1233
- * in the array will be included (OR operation).
1234
- * @param opts - Optional configuration for label generation:
1235
- * - labelOps: Optional configuration for label generation:
1236
- * - includeNativeLabel: Whether to include native column labels
1237
- * - separator: String to use between label parts (defaults to " / ")
1238
- * - addLabelAsSuffix: Whether to add labels as suffix instead of prefix
1239
- * - dontWaitAllData: Whether to skip columns that don't have all data (if not set, will return undefined,
1240
- * if at least one column that requires splitting is missing data)
1241
- * @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
1242
- * or undefined if any PlRef resolution fails.
1243
- */
1244
- getCanonicalOptions(e, n, r) {
1245
- const i = this.resolveAnchorCtx(e);
1246
- if (!i) return;
1247
- const o = new Q().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n, {
1248
- ...r,
1249
- anchorCtx: i
1250
- });
1251
- if (o)
1252
- return o.map((s) => ({
1253
- value: s.id,
1254
- label: s.label
1255
- }));
1256
- }
1257
- /**
1258
- * @deprecated use getData()
1259
- */
1260
- getDataFromResultPool() {
1261
- return this.getData();
1262
- }
1263
- getData() {
1264
- const e = this.ctx.getDataFromResultPool();
1265
- return {
1266
- isComplete: e.isComplete,
1267
- entries: e.entries.map((n) => ({
1268
- ref: n.ref,
1269
- obj: {
1270
- ...n.obj,
1271
- data: new k(n.obj.data, [n.ref.blockId, n.ref.name])
1272
- }
1273
- }))
1274
- };
1275
- }
1276
- /**
1277
- * @deprecated use getDataWithErrors()
1278
- */
1279
- getDataWithErrorsFromResultPool() {
1280
- return this.getDataWithErrors();
1281
- }
1282
- getDataWithErrors() {
1283
- const e = this.ctx.getDataWithErrorsFromResultPool();
1284
- return {
1285
- isComplete: e.isComplete,
1286
- entries: e.entries.map((n) => ({
1287
- ref: n.ref,
1288
- obj: {
1289
- ...n.obj,
1290
- data: yt(
1291
- n.obj.data,
1292
- (r) => new k(r, [n.ref.blockId, n.ref.name])
1293
- )
1294
- }
1295
- }))
1296
- };
1297
- }
1298
- /**
1299
- * @deprecated use getSpecs()
1300
- */
1301
- getSpecsFromResultPool() {
1302
- return this.getSpecs();
1303
- }
1304
- getSpecs() {
1305
- return this.ctx.getSpecsFromResultPool();
1306
- }
1307
- /**
1308
- * @param ref a Ref
1309
- * @returns data associated with the ref
1310
- */
1311
- getDataByRef(e) {
1312
- var r;
1313
- if (typeof this.ctx.getDataFromResultPoolByRef > "u")
1314
- return (r = this.getData().entries.find(
1315
- (i) => i.ref.blockId === e.blockId && i.ref.name === e.name
1316
- )) == null ? void 0 : r.obj;
1317
- const n = this.ctx.getDataFromResultPoolByRef(e.blockId, e.name);
1318
- if (n)
1319
- return xe(
1320
- n,
1321
- (i) => new k(i, [e.blockId, e.name])
1322
- );
1323
- }
1324
- /**
1325
- * Returns data associated with the ref ensuring that it is a p-column.
1326
- * @param ref a Ref
1327
- * @returns p-column associated with the ref
1328
- */
1329
- getPColumnByRef(e) {
1330
- const n = this.getDataByRef(e);
1331
- if (n)
1332
- return gt(n);
1333
- }
1334
- /**
1335
- * Returns spec associated with the ref ensuring that it is a p-column spec.
1336
- * @param ref a Ref
1337
- * @returns p-column spec associated with the ref
1338
- */
1339
- getPColumnSpecByRef(e) {
1340
- const n = this.getSpecByRef(e);
1341
- if (n) {
1342
- if (!oe(n)) throw new Error(`not a PColumn spec (kind = ${n.kind})`);
1343
- return n;
1344
- }
1345
- }
1346
- /**
1347
- * @param ref a Ref
1348
- * @returns object spec associated with the ref
1349
- */
1350
- getSpecByRef(e) {
1351
- return this.ctx.getSpecFromResultPoolByRef(e.blockId, e.name);
1352
- }
1353
- /**
1354
- * @param spec object specification
1355
- * @returns array of data objects with compatible specs
1356
- * @deprecated delete this method after Jan 1, 2025
1357
- */
1358
- findDataWithCompatibleSpec(e) {
1359
- const n = [];
1360
- e: for (const r of this.getData().entries) {
1361
- if (!oe(r.obj.spec))
1362
- continue;
1363
- const i = r.obj.spec;
1364
- if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && ye(e.domain, i.domain)) {
1365
- for (let o = 0; o < e.axesSpec.length; ++o) {
1366
- const s = e.axesSpec[o], a = i.axesSpec[o];
1367
- if (s.name !== a.name || s.type !== a.type || !ye(s.domain, a.domain))
1368
- continue e;
1369
- }
1370
- n.push(r.obj);
1371
- }
1372
- }
1373
- return n;
1374
- }
1375
- /**
1376
- * Find labels data for a given axis id. It will search for a label column and return its data as a map.
1377
- * @returns a map of axis value => label
1378
- */
1379
- findLabels(e) {
1380
- const n = this.getData();
1381
- for (const r of n.entries) {
1382
- if (!$e(r.obj)) continue;
1383
- const i = r.obj.spec;
1384
- if (i.name === de.Label && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && ye(e.domain, i.axesSpec[0].domain)) {
1385
- if (r.obj.data.resourceType.name !== "PColumnData/Json")
1386
- throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
1387
- return Object.fromEntries(
1388
- Object.entries(
1389
- r.obj.data.getDataAsJson().data
1390
- ).map((s) => [JSON.parse(s[0])[0], s[1]])
1391
- );
1392
- }
1393
- }
1394
- }
1395
- /**
1396
- * Selects columns based on the provided selectors, returning PColumn objects
1397
- * with lazily loaded data.
1398
- *
1399
- * @param selectors - A predicate function, a single selector, or an array of selectors.
1400
- * @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
1401
- */
1402
- selectColumns(e) {
1403
- const n = typeof e == "function" ? e : Y(e);
1404
- return this.getSpecs().entries.filter(({ obj: i }) => oe(i) ? n(i) : !1).map(({ ref: i, obj: o }) => {
1405
- const s = o;
1406
- let a = null;
1407
- const l = this;
1408
- return {
1409
- id: We(i),
1410
- spec: s,
1411
- get data() {
1412
- var c;
1413
- return a !== null || (a = (c = l.getPColumnByRef(i)) == null ? void 0 : c.data), a;
1414
- }
1415
- };
1416
- });
1417
- }
1418
- /**
1419
- * Find labels data for a given axis id of a p-column.
1420
- * @returns a map of axis value => label
1421
- */
1422
- findLabelsForColumnAxis(e, n) {
1423
- const r = this.findLabels(e.axesSpec[n]);
1424
- if (!r) return;
1425
- const i = J(e, `pl7.app/axisKeys/${n}`);
1426
- if (i !== void 0) {
1427
- const o = JSON.parse(i);
1428
- return Object.fromEntries(o.map((s) => [s, r[s] ?? "Unlabelled"]));
1429
- } else
1430
- return r;
1431
- }
1432
- }
1433
- class ne {
1434
- constructor() {
1435
- V(this, "ctx");
1436
- V(this, "_argsCache");
1437
- V(this, "_uiStateCache");
1438
- // lazy rendering because this feature is rarely used
1439
- V(this, "_activeArgsCache");
1440
- V(this, "resultPool", new Qt());
1441
- this.ctx = v();
1442
- }
1443
- get args() {
1444
- if (this._argsCache === void 0) {
1445
- const e = this.ctx.args, n = typeof e == "function" ? e() : e;
1446
- this._argsCache = { v: JSON.parse(n) };
1447
- }
1448
- return this._argsCache.v;
1449
- }
1450
- get uiState() {
1451
- if (this._uiStateCache === void 0) {
1452
- const e = this.ctx.uiState, n = typeof e == "function" ? e() : e;
1453
- this._uiStateCache = { v: n ? JSON.parse(n) : {} };
1454
- }
1455
- return this._uiStateCache.v;
1456
- }
1457
- /**
1458
- * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
1459
- * Returns undefined, if block was never executed or stopped mid-way execution, so that the result was cleared.
1460
- * */
1461
- get activeArgs() {
1462
- if (this._activeArgsCache === void 0) {
1463
- const e = this.ctx.activeArgs, n = typeof e == "function" ? e() : e;
1464
- this._activeArgsCache = {
1465
- v: n ? JSON.parse(n) : void 0
1466
- };
1467
- }
1468
- return this._activeArgsCache.v;
1469
- }
1470
- // /** Can be used to determine features provided by the desktop instance. */
1471
- // public get featureFlags() {
1472
- // return this.ctx.featureFlags;
1473
- // }
1474
- getNamedAccessor(e) {
1475
- return Ce(
1476
- this.ctx.getAccessorHandleByName(e),
1477
- (n) => new k(n, [e])
1478
- );
1479
- }
1480
- get prerun() {
1481
- return this.getNamedAccessor(ze);
1482
- }
1483
- get outputs() {
1484
- return this.getNamedAccessor(Xe);
1485
- }
1486
- /**
1487
- * Find labels data for a given axis id. It will search for a label column and return its data as a map.
1488
- * @returns a map of axis value => label
1489
- * @deprecated Use resultPool.findLabels instead
1490
- */
1491
- findLabels(e) {
1492
- return this.resultPool.findLabels(e);
1493
- }
1494
- verifyInlineAndExplicitColumnsSupport(e) {
1495
- var i;
1496
- const n = e.some((o) => !(o.data instanceof k) || pe(o.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === !0;
1497
- if (n && !r) throw Error("Inline or explicit columns not supported");
1498
- }
1499
- patchPTableDef(e) {
1500
- var n, r;
1501
- return (n = this.ctx.featureFlags) != null && n.pTablePartitionFiltersSupport || (e = {
1502
- ...e,
1503
- partitionFilters: [],
1504
- filters: [...e.partitionFilters, ...e.filters]
1505
- }), (r = this.ctx.featureFlags) != null && r.pFrameInSetFilterSupport || (e = {
1506
- ...e,
1507
- partitionFilters: Ae(e.partitionFilters),
1508
- filters: Ae(e.filters)
1509
- }), e;
1510
- }
1511
- // TODO remove all non-PColumn fields
1512
- createPFrame(e) {
1513
- return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
1514
- e.map((n) => Re(n))
1515
- );
1516
- }
1517
- createPTable(e) {
1518
- let n;
1519
- return "columns" in e ? n = this.patchPTableDef({
1520
- src: {
1521
- type: "full",
1522
- entries: e.columns.map((r) => ({ type: "column", column: r }))
1523
- },
1524
- partitionFilters: e.filters ?? [],
1525
- filters: [],
1526
- sorting: e.sorting ?? []
1527
- }) : n = this.patchPTableDef(e), this.verifyInlineAndExplicitColumnsSupport(bt(n.src)), this.ctx.createPTable(
1528
- vt(n, (r) => Re(r))
1529
- );
1530
- }
1531
- /** @deprecated scheduled for removal from SDK */
1532
- getBlockLabel(e) {
1533
- return this.ctx.getBlockLabel(e);
1534
- }
1535
- getCurrentUnstableMarker() {
1536
- return this.ctx.getCurrentUnstableMarker();
1537
- }
1538
- logInfo(e) {
1539
- this.ctx.logInfo(e);
1540
- }
1541
- logWarn(e) {
1542
- this.ctx.logWarn(e);
1543
- }
1544
- logError(e) {
1545
- this.ctx.logError(e);
1546
- }
1547
- }
1548
- const Zt = "1.42.16", X = Zt;
1549
- function en(t) {
1550
- return t.__renderLambda === !0;
1551
- }
1552
- function ge(t) {
1553
- if (t !== void 0)
1554
- return en(t) ? t.handle : t;
1555
- }
1556
- function zn(t) {
1557
- return Tt(t);
1558
- }
1559
- const w = class w {
1560
- constructor(e, n, r, i, o, s, a, l, c) {
1561
- this._renderingMode = e, this._initialArgs = n, this._initialUiState = r, this._outputs = i, this._inputsValid = o, this._sections = s, this._title = a, this._enrichmentTargets = l, this._featureFlags = c;
1562
- }
1563
- static create(e = "Heavy") {
1564
- return new w(
1565
- e,
1566
- void 0,
1567
- {},
1568
- {},
1569
- se(!0),
1570
- se([]),
1571
- void 0,
1572
- void 0,
1573
- { ...w.INITIAL_BLOCK_FEATURE_FLAGS }
1574
- );
1575
- }
1576
- output(e, n, r = {}) {
1577
- if (typeof n == "function") {
1578
- const i = `output#${e}`;
1579
- return G(i, () => n(new ne())), new w(
1580
- this._renderingMode,
1581
- this._initialArgs,
1582
- this._initialUiState,
1583
- {
1584
- ...this._outputs,
1585
- [e]: {
1586
- __renderLambda: !0,
1587
- handle: i,
1588
- ...r
1589
- }
1590
- },
1591
- this._inputsValid,
1592
- this._sections,
1593
- this._title,
1594
- this._enrichmentTargets,
1595
- this._featureFlags
1596
- );
1597
- } else
1598
- return new w(
1599
- this._renderingMode,
1600
- this._initialArgs,
1601
- this._initialUiState,
1602
- {
1603
- ...this._outputs,
1604
- [e]: n
1605
- },
1606
- this._inputsValid,
1607
- this._sections,
1608
- this._title,
1609
- this._enrichmentTargets,
1610
- this._featureFlags
1611
- );
1612
- }
1613
- /** Shortcut for {@link output} with retentive flag set to true. */
1614
- retentiveOutput(e, n) {
1615
- return this.output(e, n, { retentive: !0 });
1616
- }
1617
- argsValid(e) {
1618
- return typeof e == "function" ? (G("inputsValid", () => e(new ne())), new w(
1619
- this._renderingMode,
1620
- this._initialArgs,
1621
- this._initialUiState,
1622
- this._outputs,
1623
- {
1624
- __renderLambda: !0,
1625
- handle: "inputsValid"
1626
- },
1627
- this._sections,
1628
- this._title,
1629
- this._enrichmentTargets,
1630
- this._featureFlags
1631
- )) : new w(
1632
- this._renderingMode,
1633
- this._initialArgs,
1634
- this._initialUiState,
1635
- this._outputs,
1636
- e,
1637
- this._sections,
1638
- this._title,
1639
- this._enrichmentTargets,
1640
- this._featureFlags
1641
- );
1642
- }
1643
- sections(e) {
1644
- return Array.isArray(e) ? this.sections(se(e)) : typeof e == "function" ? (G("sections", () => e(new ne())), new w(
1645
- this._renderingMode,
1646
- this._initialArgs,
1647
- this._initialUiState,
1648
- this._outputs,
1649
- this._inputsValid,
1650
- { __renderLambda: !0, handle: "sections" },
1651
- this._title,
1652
- this._enrichmentTargets,
1653
- this._featureFlags
1654
- )) : new w(
1655
- this._renderingMode,
1656
- this._initialArgs,
1657
- this._initialUiState,
1658
- this._outputs,
1659
- this._inputsValid,
1660
- e,
1661
- this._title,
1662
- this._enrichmentTargets,
1663
- this._featureFlags
1664
- );
1665
- }
1666
- /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
1667
- title(e) {
1668
- return G("title", () => e(new ne())), new w(
1669
- this._renderingMode,
1670
- this._initialArgs,
1671
- this._initialUiState,
1672
- this._outputs,
1673
- this._inputsValid,
1674
- this._sections,
1675
- { __renderLambda: !0, handle: "title" },
1676
- this._enrichmentTargets,
1677
- this._featureFlags
1678
- );
1679
- }
1680
- /**
1681
- * Sets initial args for the block, this value must be specified.
1682
- * @deprecated use {@link withArgs}
1683
- * */
1684
- initialArgs(e) {
1685
- return new w(
1686
- this._renderingMode,
1687
- e,
1688
- this._initialUiState,
1689
- this._outputs,
1690
- this._inputsValid,
1691
- this._sections,
1692
- this._title,
1693
- this._enrichmentTargets,
1694
- this._featureFlags
1695
- );
1696
- }
1697
- /** Sets initial args for the block, this value must be specified. */
1698
- withArgs(e) {
1699
- return new w(
1700
- this._renderingMode,
1701
- e,
1702
- this._initialUiState,
1703
- this._outputs,
1704
- this._inputsValid,
1705
- this._sections,
1706
- this._title,
1707
- this._enrichmentTargets,
1708
- this._featureFlags
1709
- );
1710
- }
1711
- /** Defines type and sets initial value for block UiState. */
1712
- withUiState(e) {
1713
- return new w(
1714
- this._renderingMode,
1715
- this._initialArgs,
1716
- e,
1717
- this._outputs,
1718
- this._inputsValid,
1719
- this._sections,
1720
- this._title,
1721
- this._enrichmentTargets,
1722
- this._featureFlags
1723
- );
1724
- }
1725
- /** Sets or overrides feature flags for the block. */
1726
- withFeatureFlags(e) {
1727
- return new w(
1728
- this._renderingMode,
1729
- this._initialArgs,
1730
- this._initialUiState,
1731
- this._outputs,
1732
- this._inputsValid,
1733
- this._sections,
1734
- this._title,
1735
- this._enrichmentTargets,
1736
- { ...this._featureFlags, ...e }
1737
- );
1738
- }
1739
- /**
1740
- * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
1741
- * Influences dependency graph construction.
1742
- */
1743
- enriches(e) {
1744
- return G("enrichmentTargets", e), new w(
1745
- this._renderingMode,
1746
- this._initialArgs,
1747
- this._initialUiState,
1748
- this._outputs,
1749
- this._inputsValid,
1750
- this._sections,
1751
- this._title,
1752
- { __renderLambda: !0, handle: "enrichmentTargets" },
1753
- this._featureFlags
1754
- );
1755
- }
1756
- /** Renders all provided block settings into a pre-configured platforma API
1757
- * instance, that can be used in frontend to interact with block state, and
1758
- * other features provided by the platforma to the block. */
1759
- done(e) {
1760
- const n = e ?? 1;
1761
- return this.withFeatureFlags({
1762
- ...this._featureFlags,
1763
- requiresUIAPIVersion: n
1764
- })._done(n);
1765
- }
1766
- _done(e) {
1767
- if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
1768
- const n = {
1769
- v3: {
1770
- sdkVersion: X,
1771
- renderingMode: this._renderingMode,
1772
- initialArgs: this._initialArgs,
1773
- initialUiState: this._initialUiState,
1774
- inputsValid: this._inputsValid,
1775
- sections: this._sections,
1776
- title: this._title,
1777
- outputs: this._outputs,
1778
- enrichmentTargets: this._enrichmentTargets,
1779
- featureFlags: this._featureFlags
1780
- },
1781
- // fields below are added to allow previous desktop versions read generated configs
1782
- sdkVersion: X,
1783
- renderingMode: this._renderingMode,
1784
- initialArgs: this._initialArgs,
1785
- inputsValid: ge(this._inputsValid),
1786
- sections: ge(this._sections),
1787
- outputs: Object.fromEntries(
1788
- Object.entries(this._outputs).map(([r, i]) => [r, ge(i)])
1789
- )
1790
- };
1791
- return globalThis.platformaApiVersion = e, Vt() ? He({ sdkVersion: X, apiVersion: platformaApiVersion }) : { config: n };
1792
- }
1793
- };
1794
- V(w, "INITIAL_BLOCK_FEATURE_FLAGS", {
1795
- supportsLazyState: !0,
1796
- requiresUIAPIVersion: 1,
1797
- requiresModelAPIVersion: 1
1798
- });
1799
- let Ne = w;
1800
- function tt() {
1801
- return {
1802
- sourceId: null,
1803
- hiddenColIds: null,
1804
- partitionFilters: [],
1805
- filters: [],
1806
- sorting: []
1807
- };
1808
- }
1809
- function Ue() {
1810
- return {
1811
- version: 4,
1812
- stateCache: [],
1813
- pTableParams: tt()
1814
- };
1815
- }
1816
- function tn(t) {
1817
- return "version" in t || (t = Ue()), t.version === 2 && (t = {
1818
- version: 3,
1819
- stateCache: t.stateCache.map((e) => ({
1820
- ...e,
1821
- filtersState: []
1822
- })),
1823
- pTableParams: tt()
1824
- }), t.version === 3 && (t = Ue()), t;
1825
- }
1826
- function we(t) {
1827
- return t.axesSpec.length === 1 && t.name === de.Label;
1828
- }
1829
- function nn(t) {
1830
- return new Q().addAxisLabelProvider(t).addColumnProvider(t).getColumns({
1831
- name: de.Label,
1832
- axes: [{}]
1833
- // exactly one axis
1834
- }, { dontWaitAllData: !0 });
1835
- }
1836
- function Ke(t, e) {
1837
- const n = [], r = [];
1838
- for (const a of t)
1839
- we(a.spec) ? n.push(a) : r.push(a);
1840
- const i = [];
1841
- for (const a of r)
1842
- for (const l of a.spec.axesSpec) {
1843
- const c = F(l);
1844
- i.some((m) => U(m, c)) || i.push(c);
1845
- }
1846
- for (const a of n) {
1847
- const l = F(a.spec.axesSpec[0]), c = i.findIndex((m) => U(m, l));
1848
- c !== -1 && i.splice(c, 1);
1849
- }
1850
- const o = (a, l) => {
1851
- let c = a.toString();
1852
- if (l)
1853
- for (const m in l)
1854
- c += m, c += l[m];
1855
- return c;
1856
- }, s = [];
1857
- for (const a of e) {
1858
- const l = a.spec.axesSpec[0], c = F(l), m = i.findIndex((d) => U(d, c));
1859
- if (m !== -1) {
1860
- const d = i[m], h = Object.keys(d.domain ?? {}).length, f = Object.keys(l.domain ?? {}).length;
1861
- h > f ? s.push({
1862
- id: o(a.id, d.domain),
1863
- spec: {
1864
- ...a.spec,
1865
- axesSpec: [{ ...d, annotations: l.annotations }]
1866
- },
1867
- data: a.data
1868
- }) : s.push(a), i.splice(m, 1);
1869
- }
1870
- }
1871
- return s;
1872
- }
1873
- function rn(t) {
1874
- const e = (i) => Array.isArray(i), n = (i) => i instanceof k, r = (i) => typeof i == "object" && "type" in i;
1875
- return t.map((i) => i.data).every((i) => {
1876
- if (e(i))
1877
- return !0;
1878
- if (n(i))
1879
- return i.getIsReadyOrError();
1880
- if (r(i))
1881
- switch (i.type) {
1882
- case "Json":
1883
- return !0;
1884
- case "JsonPartitioned":
1885
- return Object.values(i.parts).every((s) => s.getIsReadyOrError());
1886
- case "BinaryPartitioned":
1887
- return Object.values(i.parts).every((s) => s.index.getIsReadyOrError() && s.values.getIsReadyOrError());
1888
- case "ParquetPartitioned":
1889
- return Object.values(i.parts).every((s) => s.getIsReadyOrError());
1890
- }
1891
- else
1892
- throw Error(`unsupported column data type: ${i}`);
1893
- });
1894
- }
1895
- function qe(t) {
1896
- let e = t.columns;
1897
- const n = [];
1898
- if (t.coreColumnPredicate) {
1899
- e = [];
1900
- for (const r of t.columns)
1901
- t.coreColumnPredicate(r.spec) ? e.push(r) : n.push(r);
1902
- }
1903
- return n.push(...t.labelColumns), {
1904
- src: {
1905
- type: "outer",
1906
- primary: {
1907
- type: t.coreJoinType,
1908
- entries: e.map((r) => ({ type: "column", column: r }))
1909
- },
1910
- secondary: n.map((r) => ({ type: "column", column: r }))
1911
- },
1912
- partitionFilters: t.partitionFilters,
1913
- filters: t.filters,
1914
- sorting: t.sorting
1915
- };
1916
- }
1917
- function on(t) {
1918
- return J(t, R.Table.Visibility) === "hidden";
1919
- }
1920
- function sn(t) {
1921
- return J(t, R.Table.Visibility) === "optional";
1922
- }
1923
- function be(t, e) {
1924
- return [...new Map(t.map((n) => [e(n), n])).values()];
1925
- }
1926
- function Xn(t, e, n, r) {
1927
- if (e.length === 0) return;
1928
- const i = e.filter((u) => Fe(u.spec) || !on(u.spec)), o = tn(n), s = nn(t.resultPool);
1929
- if (!s) return;
1930
- const a = Ke(i.map(ve), s), l = [...i, ...a], m = [
1931
- ...be(
1932
- [...l.flatMap((u) => u.spec.axesSpec.map((b) => F(b)))],
1933
- (u) => D(u)
1934
- ).map((u) => ({ type: "axis", id: u })),
1935
- ...l.map((u) => ({ type: "column", id: u.id }))
1936
- ], d = new Set(m.map((u) => D(u))), h = (u) => d.has(D(u)), f = (r == null ? void 0 : r.coreJoinType) ?? "full", y = o.pTableParams.partitionFilters.filter((u) => {
1937
- const b = h(u.column);
1938
- return b || t.logWarn(`Partition filter ${JSON.stringify(u)} does not match provided columns, skipping`), b;
1939
- }), p = be(
1940
- [...(r == null ? void 0 : r.filters) ?? [], ...o.pTableParams.filters],
1941
- (u) => D(u.column)
1942
- ).filter((u) => {
1943
- const b = h(u.column);
1944
- return b || t.logWarn(`Filter ${JSON.stringify(u)} does not match provided columns, skipping`), b;
1945
- }), g = be(
1946
- [...(r == null ? void 0 : r.sorting) ?? [], ...o.pTableParams.sorting],
1947
- (u) => D(u.column)
1948
- ).filter((u) => {
1949
- const b = h(u.column);
1950
- return b || t.logWarn(`Sorting ${JSON.stringify(u)} does not match provided columns, skipping`), b;
1951
- }), P = qe({
1952
- columns: i,
1953
- labelColumns: a,
1954
- coreJoinType: f,
1955
- partitionFilters: y,
1956
- filters: p,
1957
- sorting: g,
1958
- coreColumnPredicate: r == null ? void 0 : r.coreColumnPredicate
1959
- }), E = t.createPTable(P), x = new Set((() => {
1960
- if (f === "inner") return [];
1961
- const u = o.pTableParams.hiddenColIds;
1962
- return u || i.filter((b) => sn(b.spec)).map((b) => b.id);
1963
- })());
1964
- i.filter((u) => Fe(u.spec)).forEach((u) => x.delete(u.id)), r != null && r.coreColumnPredicate && i.flatMap((b) => {
1965
- var K;
1966
- return (K = r == null ? void 0 : r.coreColumnPredicate) != null && K.call(r, b.spec) ? [b.id] : [];
1967
- }).forEach((b) => x.delete(b)), [...y.map((u) => u.column), ...p.map((u) => u.column), ...g.map((u) => u.column)].filter((u) => u.type === "column").forEach((u) => x.delete(u.id));
1968
- const T = i.filter((u) => !x.has(u.id)), S = Ke(T.map(ve), s);
1969
- if (!rn([...T, ...S])) return;
1970
- const C = qe({
1971
- columns: T,
1972
- labelColumns: S,
1973
- coreJoinType: f,
1974
- partitionFilters: y,
1975
- filters: p,
1976
- sorting: g,
1977
- coreColumnPredicate: r == null ? void 0 : r.coreColumnPredicate
1978
- }), I = t.createPTable(C);
1979
- return {
1980
- sourceId: o.pTableParams.sourceId,
1981
- fullTableHandle: E,
1982
- visibleTableHandle: I
1983
- };
1984
- }
1985
- function Yn(t, e, n) {
1986
- const r = t.resultPool.findLabels(e);
1987
- return {
1988
- axis: e,
1989
- options: n.map((i) => ({
1990
- value: i,
1991
- label: (r == null ? void 0 : r[i]) ?? i.toString()
1992
- })),
1993
- defaultValue: n[0]
1994
- };
1995
- }
1996
- const an = (t, e) => {
1997
- let n = t.toString();
1998
- return e == null || e.forEach((r) => {
1999
- if (r)
2000
- for (const [i, o] of Object.entries(r))
2001
- n += i, n += o;
2002
- }), n;
2003
- };
2004
- function ln(t) {
2005
- if (!t.length)
2006
- return [];
2007
- let e = [[]];
2008
- return t.forEach((n) => {
2009
- const r = [];
2010
- n.forEach((i) => {
2011
- r.push(...e.map((o) => [...o, i]));
2012
- }), e = r;
2013
- }), e;
2014
- }
2015
- function Fe(t) {
2016
- return !!St(t, R.IsLinkerColumn);
2017
- }
2018
- function un(t, e) {
2019
- const n = Pt.fromColumns(t.map(ve)), r = [], i = [...e.values()].map((a) => At(wt(a)).map(F));
2020
- for (const a of i) {
2021
- const l = n.keyAxesIds.find(
2022
- (c) => c.every(
2023
- (m) => a.find((d) => U(d, m))
2024
- )
2025
- );
2026
- l && r.push(D(l));
2027
- }
2028
- const o = n.searchAvailableAxesKeys(r), s = n.getAxesListFromKeysList([...o]);
2029
- return new Map(s.map((a) => {
2030
- const l = F(a);
2031
- return [D(l), a];
2032
- }));
2033
- }
2034
- function je(t, e) {
2035
- const n = [];
2036
- return e.forEach((r) => {
2037
- n.push(...cn(t, r));
2038
- }), n;
2039
- }
2040
- function cn(t, e) {
2041
- const n = e.spec.axesSpec.map(F);
2042
- if (n.every((c) => t.has(D(c))))
2043
- return [e];
2044
- const r = n.map((c) => {
2045
- const m = [];
2046
- for (const [d, h] of t)
2047
- U(h, c) && !U(c, h) && m.push(h);
2048
- return m;
2049
- }), i = ln(r), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), a = i.map((c) => {
2050
- const m = /* @__PURE__ */ new Set();
2051
- return c.map((d, h) => {
2052
- const f = e.spec.axesSpec[h].domain, y = d.domain;
2053
- return Object.entries(y ?? {}).forEach(([p, g]) => {
2054
- if ((f == null ? void 0 : f[p]) === void 0) {
2055
- const P = JSON.stringify([p, g]);
2056
- m.add(P), o.add(P);
2057
- }
2058
- }), {
2059
- ...d,
2060
- annotations: e.spec.axesSpec[h].annotations
2061
- };
2062
- }), m;
2063
- });
2064
- [...o].forEach((c) => {
2065
- a.some((m) => !m.has(c)) && s.add(c);
2066
- });
2067
- const l = i.map((c, m) => {
2068
- const d = an(e.id, c.map((p) => p.domain)), h = J(e.spec, R.Label) ?? "", f = [...a[m]].filter((p) => s.has(p)).sort().map((p) => {
2069
- var g;
2070
- return (g = JSON.parse(p)) == null ? void 0 : g[1];
2071
- }).join(" / "), y = {
2072
- ...e.spec.annotations,
2073
- [R.Graph.IsVirtual]: Be(!0)
2074
- };
2075
- return (h || f) && (y[R.Label] = h && f ? h + " / " + f : h + f), {
2076
- id: d,
2077
- spec: {
2078
- ...e.spec,
2079
- axesSpec: c.map((p, g) => ({
2080
- ...p,
2081
- annotations: e.spec.axesSpec[g].annotations
2082
- })),
2083
- annotations: y
2084
- },
2085
- data: e.data
2086
- };
2087
- });
2088
- return [e, ...l];
2089
- }
2090
- function pn(t) {
2091
- let e = !0;
2092
- return t.data instanceof k ? e = e && t.data.getIsReadyOrError() : pe(t.data) && Ft(t.data, (n) => {
2093
- e = e && n.getIsReadyOrError();
2094
- }), e;
2095
- }
2096
- function re(t) {
2097
- return t.every(pn);
2098
- }
2099
- function Qn(t, e) {
2100
- if (!e) {
2101
- const d = new Q();
2102
- d.addColumnProvider(t.resultPool);
2103
- const h = d.getColumns(() => !0, { dontWaitAllData: !0, overrideLabelAnnotation: !1 }) ?? [];
2104
- if (!re(h))
2105
- return;
2106
- const f = new Map(h.flatMap((p) => he(p.spec.axesSpec)).map((p) => {
2107
- const g = F(p);
2108
- return [D(g), p];
2109
- })), y = je(f, h);
2110
- return t.createPFrame(y);
2111
- }
2112
- if (!re(e))
2113
- return;
2114
- const n = new Q();
2115
- n.addColumnProvider(t.resultPool), n.addColumns(e);
2116
- const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
2117
- for (const d of e)
2118
- for (const h of he(d.spec.axesSpec)) {
2119
- const f = F(h);
2120
- r.set(D(f), h), i.set(D(f), h);
2121
- }
2122
- const o = n.getColumns((d) => Fe(d)) ?? [], s = un(o, r);
2123
- for (const d of s)
2124
- r.set(...d), i.set(...d);
2125
- const a = (n.getColumns((d) => d.axesSpec.some((h) => {
2126
- const f = F(h);
2127
- for (const y of r.values())
2128
- if (U(F(y), f))
2129
- return !0;
2130
- return !1;
2131
- }), { dontWaitAllData: !0, overrideLabelAnnotation: !1 }) ?? []).filter((d) => !we(d.spec));
2132
- if (!re(a))
2133
- return;
2134
- for (const d of a)
2135
- for (const h of he(d.spec.axesSpec)) {
2136
- const f = F(h);
2137
- i.set(D(f), h);
2138
- }
2139
- const l = (n.getColumns((d) => d.axesSpec.some((h) => {
2140
- const f = F(h);
2141
- for (const y of i.values())
2142
- if (U(F(y), f))
2143
- return !0;
2144
- return !1;
2145
- }), { dontWaitAllData: !0, overrideLabelAnnotation: !1 }) ?? []).filter((d) => we(d.spec));
2146
- if (!re(l))
2147
- return;
2148
- const c = [...a, ...l], m = je(r, c);
2149
- return t.createPFrame(m);
2150
- }
2151
- function Zn({
2152
- selection: t,
2153
- columnId: e = _t(),
2154
- label: n = "Selection marker",
2155
- domain: r
2156
- }) {
2157
- if (!(t != null && t.axesSpec.length))
2158
- return;
2159
- const i = t.selectedKeys.filter((o) => o.every((s) => !xt(s))).map((o) => ({ key: o, val: 1 }));
2160
- if (i.length)
2161
- return {
2162
- id: e,
2163
- spec: {
2164
- kind: "PColumn",
2165
- valueType: It.Int,
2166
- name: de.Table.RowSelection,
2167
- axesSpec: t.axesSpec,
2168
- ...r && Object.keys(r).length && { domain: r },
2169
- annotations: {
2170
- [R.Label]: n,
2171
- [R.DiscreteValues]: Be([1])
2172
- }
2173
- },
2174
- data: i
2175
- };
2176
- }
2177
- function er() {
2178
- return {
2179
- axesSpec: [],
2180
- selectedKeys: []
2181
- };
2182
- }
2183
- function dn(t) {
2184
- throw new Error("Unexpected object: " + t);
2185
- }
2186
- function N(t) {
2187
- return t.valueType === "Int" || t.valueType === "Long" || t.valueType === "Float" || t.valueType === "Double";
2188
- }
2189
- function ie(t) {
2190
- return t.valueType === "String";
2191
- }
2192
- const nt = {
2193
- lessThan: {
2194
- label: "Col < X (Less Than)",
2195
- form: {
2196
- column: {
2197
- label: "Column",
2198
- fieldType: "SUniversalPColumnId",
2199
- defaultValue: () => {
2200
- }
2201
- },
2202
- type: {
2203
- label: "Predicate",
2204
- fieldType: "FilterUiType",
2205
- defaultValue: () => "lessThan"
2206
- },
2207
- x: {
2208
- label: "X",
2209
- fieldType: "number",
2210
- defaultValue: () => 0
2211
- }
2212
- },
2213
- supportedFor: N
2214
- },
2215
- greaterThan: {
2216
- label: "Col > X (Greater Than)",
2217
- form: {
2218
- column: {
2219
- label: "Column",
2220
- fieldType: "SUniversalPColumnId",
2221
- defaultValue: () => {
2222
- }
2223
- },
2224
- type: {
2225
- label: "Predicate",
2226
- fieldType: "FilterUiType",
2227
- defaultValue: () => "greaterThan"
2228
- },
2229
- x: {
2230
- label: "X",
2231
- fieldType: "number",
2232
- defaultValue: () => 0
2233
- }
2234
- },
2235
- supportedFor: N
2236
- },
2237
- lessThanOrEqual: {
2238
- label: "Col ≤ X (Less Than or Equal)",
2239
- form: {
2240
- column: {
2241
- label: "Column",
2242
- fieldType: "SUniversalPColumnId",
2243
- defaultValue: () => {
2244
- }
2245
- },
2246
- type: {
2247
- label: "Predicate",
2248
- fieldType: "FilterUiType",
2249
- defaultValue: () => "lessThanOrEqual"
2250
- },
2251
- x: {
2252
- label: "X",
2253
- fieldType: "number",
2254
- defaultValue: () => 0
2255
- }
2256
- },
2257
- supportedFor: N
2258
- },
2259
- greaterThanOrEqual: {
2260
- label: "Col ≥ X (Greater Than or Equal)",
2261
- form: {
2262
- column: {
2263
- label: "Column",
2264
- fieldType: "SUniversalPColumnId",
2265
- defaultValue: () => {
2266
- }
2267
- },
2268
- type: {
2269
- label: "Predicate",
2270
- fieldType: "FilterUiType",
2271
- defaultValue: () => "greaterThanOrEqual"
2272
- },
2273
- x: {
2274
- label: "X",
2275
- fieldType: "number",
2276
- defaultValue: () => 0
2277
- }
2278
- },
2279
- supportedFor: N
2280
- },
2281
- lessThanColumn: {
2282
- label: "Col₁ < Col₂ (Compare Columns)",
2283
- form: {
2284
- column: {
2285
- label: "Col₁",
2286
- fieldType: "SUniversalPColumnId",
2287
- defaultValue: () => {
2288
- }
2289
- },
2290
- type: {
2291
- label: "Predicate",
2292
- fieldType: "FilterUiType",
2293
- defaultValue: () => "lessThanColumn"
2294
- },
2295
- rhs: {
2296
- label: "Col₂",
2297
- fieldType: "SUniversalPColumnId",
2298
- defaultValue: () => {
2299
- }
2300
- },
2301
- minDiff: {
2302
- label: "Margin (positive)",
2303
- fieldType: "number?",
2304
- defaultValue: () => {
2305
- }
2306
- }
2307
- },
2308
- supportedFor: (t, e) => N(t) && (e === void 0 || N(e))
2309
- },
2310
- lessThanColumnOrEqual: {
2311
- label: "Col₁ ≤ Col₂ (Compare Columns)",
2312
- form: {
2313
- column: {
2314
- label: "Col₁",
2315
- fieldType: "SUniversalPColumnId",
2316
- defaultValue: () => {
2317
- }
2318
- },
2319
- type: {
2320
- label: "Predicate",
2321
- fieldType: "FilterUiType",
2322
- defaultValue: () => "lessThanColumnOrEqual"
2323
- },
2324
- rhs: {
2325
- label: "Col₂",
2326
- fieldType: "SUniversalPColumnId",
2327
- defaultValue: () => {
2328
- }
2329
- },
2330
- minDiff: {
2331
- label: "Margin (positive)",
2332
- fieldType: "number?",
2333
- defaultValue: () => {
2334
- }
2335
- }
2336
- },
2337
- supportedFor: (t, e) => N(t) && (e === void 0 || N(e))
2338
- },
2339
- topN: {
2340
- label: "Top N",
2341
- form: {
2342
- column: {
2343
- label: "Rank By Column",
2344
- fieldType: "SUniversalPColumnId",
2345
- defaultValue: () => {
2346
- }
2347
- },
2348
- type: {
2349
- label: "Predicate",
2350
- fieldType: "FilterUiType",
2351
- defaultValue: () => "topN"
2352
- },
2353
- n: {
2354
- label: "N",
2355
- fieldType: "number",
2356
- defaultValue: () => 10
2357
- }
2358
- },
2359
- supportedFor: N
2360
- },
2361
- bottomN: {
2362
- label: "Bottom N",
2363
- form: {
2364
- column: {
2365
- label: "Rank By Column",
2366
- fieldType: "SUniversalPColumnId",
2367
- defaultValue: () => {
2368
- }
2369
- },
2370
- type: {
2371
- label: "Predicate",
2372
- fieldType: "FilterUiType",
2373
- defaultValue: () => "bottomN"
2374
- },
2375
- n: {
2376
- label: "N",
2377
- fieldType: "number",
2378
- defaultValue: () => 10
2379
- }
2380
- },
2381
- supportedFor: N
2382
- },
2383
- patternContainSubsequence: {
2384
- label: "Col ~ Seq (Contain Subsequence)",
2385
- form: {
2386
- column: {
2387
- label: "Column",
2388
- fieldType: "SUniversalPColumnId",
2389
- defaultValue: () => {
2390
- }
2391
- },
2392
- type: {
2393
- label: "Predicate",
2394
- fieldType: "FilterUiType",
2395
- defaultValue: () => "patternContainSubsequence"
2396
- },
2397
- value: {
2398
- label: "Seq",
2399
- fieldType: "string",
2400
- defaultValue: () => ""
2401
- }
2402
- },
2403
- supportedFor: ie
2404
- },
2405
- patternNotContainSubsequence: {
2406
- label: "Col ≁ Seq (Not Contain Subsequence)",
2407
- form: {
2408
- column: {
2409
- label: "Column",
2410
- fieldType: "SUniversalPColumnId",
2411
- defaultValue: () => {
2412
- }
2413
- },
2414
- type: {
2415
- label: "Predicate",
2416
- fieldType: "FilterUiType",
2417
- defaultValue: () => "patternNotContainSubsequence"
2418
- },
2419
- value: {
2420
- label: "Seq",
2421
- fieldType: "string",
2422
- defaultValue: () => ""
2423
- }
2424
- },
2425
- supportedFor: ie
2426
- },
2427
- patternEquals: {
2428
- label: "Col = Seq (Equals)",
2429
- form: {
2430
- column: {
2431
- label: "Column",
2432
- fieldType: "SUniversalPColumnId",
2433
- defaultValue: () => {
2434
- }
2435
- },
2436
- type: {
2437
- label: "Predicate",
2438
- fieldType: "FilterUiType",
2439
- defaultValue: () => "patternEquals"
2440
- },
2441
- value: {
2442
- label: "Seq",
2443
- fieldType: "string",
2444
- defaultValue: () => ""
2445
- }
2446
- },
2447
- supportedFor: ie
2448
- },
2449
- patternNotEquals: {
2450
- label: "Col ≠ Seq (Not Equal)",
2451
- form: {
2452
- column: {
2453
- label: "Column",
2454
- fieldType: "SUniversalPColumnId",
2455
- defaultValue: () => {
2456
- }
2457
- },
2458
- type: {
2459
- label: "Predicate",
2460
- fieldType: "FilterUiType",
2461
- defaultValue: () => "patternNotEquals"
2462
- },
2463
- value: {
2464
- label: "Seq",
2465
- fieldType: "string",
2466
- defaultValue: () => ""
2467
- }
2468
- },
2469
- supportedFor: ie
2470
- },
2471
- isNA: {
2472
- label: "Is NA",
2473
- form: {
2474
- column: {
2475
- label: "Column",
2476
- fieldType: "SUniversalPColumnId",
2477
- defaultValue: () => {
2478
- }
2479
- },
2480
- type: {
2481
- label: "Predicate",
2482
- fieldType: "FilterUiType",
2483
- defaultValue: () => "isNA"
2484
- }
2485
- },
2486
- supportedFor: () => !0
2487
- },
2488
- isNotNA: {
2489
- label: "Is Not NA",
2490
- form: {
2491
- column: {
2492
- label: "Column",
2493
- fieldType: "SUniversalPColumnId",
2494
- defaultValue: () => {
2495
- }
2496
- },
2497
- type: {
2498
- label: "Predicate",
2499
- fieldType: "FilterUiType",
2500
- defaultValue: () => "isNotNA"
2501
- }
2502
- },
2503
- supportedFor: () => !0
2504
- },
2505
- or: {
2506
- label: "Or",
2507
- form: {
2508
- type: {
2509
- fieldType: "FilterUiType",
2510
- label: "Predicate",
2511
- defaultValue: () => "or"
2512
- },
2513
- filters: {
2514
- fieldType: "unknown[]",
2515
- label: "Filters",
2516
- defaultValue: () => []
2517
- }
2518
- },
2519
- supportedFor: () => !1
2520
- },
2521
- and: {
2522
- label: "And",
2523
- form: {
2524
- type: {
2525
- fieldType: "FilterUiType",
2526
- label: "Predicate",
2527
- defaultValue: () => "and"
2528
- },
2529
- filters: {
2530
- fieldType: "unknown[]",
2531
- label: "Filters",
2532
- defaultValue: () => []
2533
- }
2534
- },
2535
- supportedFor: () => !1
2536
- },
2537
- not: {
2538
- label: "Not",
2539
- form: {
2540
- type: {
2541
- fieldType: "FilterUiType",
2542
- label: "Predicate",
2543
- defaultValue: () => "not"
2544
- },
2545
- filter: {
2546
- fieldType: "form",
2547
- label: "Filter",
2548
- defaultValue: () => {
2549
- }
2550
- // TODO:
2551
- }
2552
- },
2553
- supportedFor: () => !1
2554
- }
2555
- };
2556
- function tr(t) {
2557
- return t ? Object.entries(nt).filter(([e, n]) => n.supportedFor(t)).map(([e, n]) => ({
2558
- label: n.label,
2559
- value: e
2560
- })) : [];
2561
- }
2562
- function nr(t) {
2563
- return nt[t];
2564
- }
2565
- function Ie(t) {
2566
- if (t.type === "or")
2567
- return {
2568
- type: "or",
2569
- filters: Me(t.filters)
2570
- };
2571
- if (t.type === "and")
2572
- return {
2573
- type: "and",
2574
- filters: Me(t.filters)
2575
- };
2576
- if (t.type === "not")
2577
- return {
2578
- type: "not",
2579
- filter: Ie(t.filter)
2580
- };
2581
- if (t.type === "isNA")
2582
- return {
2583
- type: "isNA",
2584
- column: t.column
2585
- };
2586
- if (t.type === "isNotNA")
2587
- return { type: "not", filter: { type: "isNA", column: t.column } };
2588
- if (t.type === "patternEquals")
2589
- return {
2590
- type: "pattern",
2591
- column: t.column,
2592
- predicate: {
2593
- type: "equals",
2594
- value: t.value
2595
- }
2596
- };
2597
- if (t.type === "patternNotEquals")
2598
- return { type: "not", filter: {
2599
- type: "pattern",
2600
- column: t.column,
2601
- predicate: { type: "equals", value: t.value }
2602
- } };
2603
- if (t.type === "patternContainSubsequence")
2604
- return {
2605
- type: "pattern",
2606
- column: t.column,
2607
- predicate: {
2608
- type: "containSubsequence",
2609
- value: t.value
2610
- }
2611
- };
2612
- if (t.type === "patternNotContainSubsequence")
2613
- return { type: "not", filter: {
2614
- type: "pattern",
2615
- column: t.column,
2616
- predicate: { type: "containSubsequence", value: t.value }
2617
- } };
2618
- if (t.type === "topN")
2619
- return {
2620
- type: "numericalComparison",
2621
- lhs: {
2622
- transformer: "rank",
2623
- column: t.column,
2624
- descending: !0
2625
- },
2626
- rhs: t.n,
2627
- allowEqual: !0
2628
- };
2629
- if (t.type === "bottomN")
2630
- return {
2631
- type: "numericalComparison",
2632
- lhs: {
2633
- transformer: "rank",
2634
- column: t.column
2635
- },
2636
- rhs: t.n,
2637
- allowEqual: !0
2638
- };
2639
- if (t.type === "lessThan")
2640
- return {
2641
- type: "numericalComparison",
2642
- lhs: t.column,
2643
- rhs: t.x
2644
- };
2645
- if (t.type === "greaterThan")
2646
- return {
2647
- type: "numericalComparison",
2648
- rhs: t.column,
2649
- lhs: t.x
2650
- };
2651
- if (t.type === "greaterThanOrEqual")
2652
- return {
2653
- type: "numericalComparison",
2654
- rhs: t.column,
2655
- lhs: t.x,
2656
- allowEqual: !0
2657
- };
2658
- if (t.type === "lessThanOrEqual")
2659
- return {
2660
- type: "numericalComparison",
2661
- lhs: t.column,
2662
- rhs: t.x,
2663
- allowEqual: !0
2664
- };
2665
- if (t.type === "lessThanColumn")
2666
- return {
2667
- type: "numericalComparison",
2668
- lhs: t.column,
2669
- rhs: t.rhs,
2670
- minDiff: t.minDiff,
2671
- allowEqual: void 0
2672
- };
2673
- if (t.type === "lessThanColumnOrEqual")
2674
- return {
2675
- type: "numericalComparison",
2676
- lhs: t.column,
2677
- rhs: t.rhs,
2678
- minDiff: t.minDiff,
2679
- allowEqual: !0
2680
- };
2681
- if (t.type === void 0)
2682
- throw new Error("Filter type is undefined, this should not happen");
2683
- dn(t);
2684
- }
2685
- function Me(t) {
2686
- return t.filter((e) => e.type !== void 0).map(Ie);
2687
- }
2688
- function rr(t) {
2689
- return {
2690
- title: t.title,
2691
- mode: t.mode,
2692
- steps: t.steps.filter((e) => e.filter.type == null ? !1 : e.filter.type === "or" || e.filter.type === "and" ? e.filter.filters.length > 0 : !1).map((e) => ({
2693
- label: e.label.trim(),
2694
- filter: Ie(e.filter)
2695
- }))
2696
- };
2697
- }
2698
- class ir {
2699
- constructor(e) {
2700
- this.handle = e;
2701
- }
2702
- async findColumns(e) {
2703
- return await platforma.pFrameDriver.findColumns(this.handle, e);
2704
- }
2705
- async getColumnSpec(e) {
2706
- return await platforma.pFrameDriver.getColumnSpec(this.handle, e);
2707
- }
2708
- async listColumns() {
2709
- return await platforma.pFrameDriver.listColumns(this.handle);
2710
- }
2711
- async calculateTableData(e, n) {
2712
- var r;
2713
- return (r = cfgRenderCtx.featureFlags) != null && r.pFrameInSetFilterSupport || (e = {
2714
- ...e,
2715
- filters: Ae(e.filters)
2716
- }), await platforma.pFrameDriver.calculateTableData(this.handle, e, n);
2717
- }
2718
- async getUniqueValues(e) {
2719
- return await platforma.pFrameDriver.getUniqueValues(this.handle, e);
2720
- }
2721
- }
2722
- function fn(t) {
2723
- return Ge({
2724
- __isRef: !0,
2725
- blockId: ae(t, "blockId"),
2726
- name: ae(t, "name")
2727
- });
2728
- }
2729
- function or(t) {
2730
- return Ge({
2731
- ref: fn(ae(t, "ref")),
2732
- label: ae(t, "label")
2733
- });
2734
- }
2735
- const sr = {
2736
- sdkVersion: X
2737
- };
2738
- function ar() {
2739
- return platformaApiVersion ?? 1;
2740
- }
2741
- function lr() {
2742
- return He({ sdkVersion: X, apiVersion: platformaApiVersion });
2743
- }
2744
- function ur(t) {
2745
- if (typeof globalThis.getEnvironmentValue == "function")
2746
- return globalThis.getEnvironmentValue(t);
2747
- }
2748
- export {
2749
- Cn as Args,
2750
- Ne as BlockModel,
2751
- sr as CurrentSdkInfo,
2752
- L as FutureRef,
2753
- Tn as It,
2754
- Gn as JsRenderInternal,
2755
- Sn as MainOutputs,
2756
- Lt as OutputError,
2757
- Q as PColumnCollection,
2758
- ir as PFrameImpl,
2759
- $ as RT_BINARY_PARTITIONED,
2760
- z as RT_BINARY_SUPER_PARTITIONED,
2761
- H as RT_JSON_PARTITIONED,
2762
- ce as RT_JSON_SUPER_PARTITIONED,
2763
- le as RT_RESOURCE_MAP,
2764
- ue as RT_RESOURCE_MAP_PARTITIONED,
2765
- ne as RenderCtx,
2766
- Qt as ResultPool,
2767
- Pn as StagingOutputs,
2768
- Ut as Trace,
2769
- Nt as TraceEntry,
2770
- k as TreeNodeAccessor,
2771
- An as UiState,
2772
- rn as allColumnsComputed,
2773
- re as allColumnsReady,
2774
- En as and,
2775
- rr as compileAnnotationScript,
2776
- Ie as compileFilter,
2777
- Me as compileFilters,
2778
- Jt as convertOrParsePColumnData,
2779
- Qn as createPFrameForGraphs,
2780
- Yn as createPlDataTableSheet,
2781
- Ue as createPlDataTableStateV2,
2782
- Xn as createPlDataTableV2,
2783
- er as createPlSelectionModel,
2784
- Zn as createRowSelectionColumn,
2785
- Qe as deriveLabels,
2786
- ge as downgradeCfgOrLambda,
2787
- je as enrichCompatible,
2788
- jn as extractArchiveAndGetURL,
2789
- zn as extractConfig,
2790
- Bt as filterDataInfoEntries,
2791
- nt as filterUiMetadata,
2792
- In as flatten,
2793
- or as fromPlOption,
2794
- fn as fromPlRef,
2795
- nn as getAllLabelColumns,
2796
- un as getAvailableWithLinkersAxes,
2797
- Rn as getBlobContent,
2798
- Un as getBlobContentAsJson,
2799
- Nn as getBlobContentAsString,
2800
- Kn as getDownloadedBlobContent,
2801
- ur as getEnvironmentValue,
2802
- nr as getFilterUiMetadata,
2803
- tr as getFilterUiTypeOptions,
2804
- Z as getFromCfg,
2805
- se as getImmediate,
2806
- Mn as getImportProgress,
2807
- ae as getJsonField,
2808
- $n as getLastLogs,
2809
- Wn as getLogHandle,
2810
- Ke as getMatchingLabelColumns,
2811
- qn as getOnDemandBlobContent,
2812
- jt as getPartitionKeysList,
2813
- ar as getPlatformaApiVersion,
2814
- Jn as getProgressLog,
2815
- Bn as getProgressLogWithInfo,
2816
- lr as getRawPlatformaInstance,
2817
- kn as getResourceField,
2818
- Dn as getResourceValueAsJson,
2819
- $t as getUniquePartitionKeys,
2820
- Ce as ifDef,
2821
- on as isColumnHidden,
2822
- sn as isColumnOptional,
2823
- pn as isColumnReady,
2824
- en as isConfigLambda,
2825
- _n as isEmpty,
2826
- we as isLabelColumn,
2827
- Fe as isLinkerColumn,
2828
- vn as isolate,
2829
- wn as makeArray,
2830
- tt as makeDefaultPTableParams,
2831
- Ge as makeObject,
2832
- xn as mapArrayValues,
2833
- Fn as mapRecordValues,
2834
- On as mapResourceFields,
2835
- Ln as not,
2836
- Vn as or,
2837
- Pe as parsePColumnData,
2838
- Hn as parseResourceMap,
2839
- Et as readOutput,
2840
- be as uniqueBy,
2841
- dn as unreachable,
2842
- tn as upgradePlDataTableStateV2,
2843
- bn as wrapOutputs
2844
- };
2845
- //# sourceMappingURL=index.mjs.map