@platforma-sdk/model 1.42.15 → 1.42.20

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