@platforma-sdk/model 1.10.12 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,64 +1,65 @@
1
- var M = Object.defineProperty;
2
- var U = (e, t, n) => t in e ? M(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var f = (e, t, n) => U(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { isPColumn as D, mapPObjectData as A, mapValueInVOE as B, isPColumnSpec as $, mapPTableDef as J, getAxisId as O, matchAxisId as N } from "@milaboratories/pl-model-common";
1
+ var ct = Object.defineProperty;
2
+ var dt = (e, t, n) => t in e ? ct(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var _ = (e, t, n) => dt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { isPColumn as W, mapPObjectData as L, mapValueInVOE as pt, ensurePColumn as ft, isPColumnSpec as ht, mapPTableDef as gt, getAxisId as J, matchAxisId as mt } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
- class G extends Error {
6
+ import { z as P } from "zod";
7
+ class yt extends Error {
7
8
  constructor(t, n) {
8
9
  super(`${t.length}${n ? "+" : ""} errors, first error: ` + t[0]), this.errors = t, this.moreErrors = n;
9
10
  }
10
11
  }
11
- function H(e) {
12
- if (!e.ok) throw new G(e.errors, e.moreErrors);
12
+ function bt(e) {
13
+ if (!e.ok) throw new yt(e.errors, e.moreErrors);
13
14
  return e.value;
14
15
  }
15
- function it(e) {
16
+ function jt(e) {
16
17
  return new Proxy(e, {
17
18
  get(t, n) {
18
- return H(t[n]);
19
+ return bt(t[n]);
19
20
  }
20
21
  });
21
22
  }
22
- function c(e) {
23
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? C(e) : e;
23
+ function p(e) {
24
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null ? k(e) : e;
24
25
  }
25
- function v(e) {
26
+ function T(e) {
26
27
  return { type: "GetFromCtx", variable: e };
27
28
  }
28
- function rt(e) {
29
+ function Nt(e) {
29
30
  return {
30
31
  type: "Isolate",
31
32
  cfg: e
32
33
  };
33
34
  }
34
- const st = v("$args"), ot = v("$it"), at = v("$prod"), ut = v("$staging"), lt = v("$ui");
35
- function C(e) {
35
+ const Mt = T("$args"), Bt = T("$it"), Ut = T("$prod"), Jt = T("$staging"), $t = T("$ui");
36
+ function k(e) {
36
37
  return { type: "Immediate", value: e };
37
38
  }
38
- function k(e) {
39
+ function nt(e) {
39
40
  const t = {};
40
- for (const [n, i] of Object.entries(e)) t[n] = c(i);
41
+ for (const [n, r] of Object.entries(e)) t[n] = p(r);
41
42
  return {
42
43
  type: "MakeObject",
43
44
  template: t
44
45
  };
45
46
  }
46
- function ct(...e) {
47
+ function Kt(...e) {
47
48
  const t = [];
48
- for (const n of e) t.push(c(n));
49
+ for (const n of e) t.push(p(n));
49
50
  return {
50
51
  type: "MakeArray",
51
52
  template: t
52
53
  };
53
54
  }
54
- function S(e, t) {
55
+ function x(e, t) {
55
56
  return {
56
57
  type: "GetJsonField",
57
- source: c(e),
58
- field: c(t)
58
+ source: p(e),
59
+ field: p(t)
59
60
  };
60
61
  }
61
- function dt(e, t, n = "$it") {
62
+ function Gt(e, t, n = "$it") {
62
63
  return {
63
64
  type: "MapRecordValues",
64
65
  source: e,
@@ -66,7 +67,7 @@ function dt(e, t, n = "$it") {
66
67
  itVar: n
67
68
  };
68
69
  }
69
- function pt(e, t, n = "$it") {
70
+ function Ht(e, t, n = "$it") {
70
71
  return {
71
72
  type: "MapArrayValues",
72
73
  source: e,
@@ -74,54 +75,54 @@ function pt(e, t, n = "$it") {
74
75
  itVar: n
75
76
  };
76
77
  }
77
- function ht(e) {
78
+ function Wt(e) {
78
79
  return {
79
80
  type: "Flatten",
80
81
  source: e
81
82
  };
82
83
  }
83
- function ft(e) {
84
+ function qt(e) {
84
85
  return {
85
86
  type: "IsEmpty",
86
87
  arg: e
87
88
  };
88
89
  }
89
- function gt(e) {
90
+ function zt(e) {
90
91
  return {
91
92
  type: "Not",
92
93
  operand: e
93
94
  };
94
95
  }
95
- function mt(e, t) {
96
+ function Yt(e, t) {
96
97
  return {
97
98
  type: "And",
98
99
  operand1: e,
99
100
  operand2: t
100
101
  };
101
102
  }
102
- function yt(e, t) {
103
+ function Xt(e, t) {
103
104
  return {
104
105
  type: "Or",
105
106
  operand1: e,
106
107
  operand2: t
107
108
  };
108
109
  }
109
- function bt(e, t) {
110
+ function Qt(e, t) {
110
111
  return {
111
112
  type: "GetResourceField",
112
- source: c(e),
113
- field: c(t)
113
+ source: p(e),
114
+ field: p(t)
114
115
  };
115
116
  }
116
- function vt() {
117
+ function Zt() {
117
118
  return function(e) {
118
119
  return {
119
120
  type: "GetResourceValueAsJson",
120
- source: c(e)
121
+ source: p(e)
121
122
  };
122
123
  };
123
124
  }
124
- function _t(e, t, n = "$it") {
125
+ function te(e, t, n = "$it") {
125
126
  return {
126
127
  type: "MapResourceFields",
127
128
  source: e,
@@ -129,144 +130,144 @@ function _t(e, t, n = "$it") {
129
130
  itVar: n
130
131
  };
131
132
  }
132
- function wt(e) {
133
+ function ee(e) {
133
134
  return {
134
135
  type: "GetBlobContent",
135
- source: c(e)
136
+ source: p(e)
136
137
  };
137
138
  }
138
- function Ct(e) {
139
+ function ne(e) {
139
140
  return {
140
141
  type: "GetBlobContentAsString",
141
- source: c(e)
142
+ source: p(e)
142
143
  };
143
144
  }
144
- function At() {
145
+ function re() {
145
146
  return function(e) {
146
147
  return {
147
148
  type: "GetBlobContentAsJson",
148
- source: c(e)
149
+ source: p(e)
149
150
  };
150
151
  };
151
152
  }
152
- function St(e) {
153
+ function se(e) {
153
154
  return {
154
155
  type: "GetDownloadedBlobContent",
155
- source: c(e)
156
+ source: p(e)
156
157
  };
157
158
  }
158
- function Ft(e) {
159
+ function ie(e) {
159
160
  return {
160
161
  type: "GetOnDemandBlobContent",
161
- source: c(e)
162
+ source: p(e)
162
163
  };
163
164
  }
164
- function It(e) {
165
+ function oe(e) {
165
166
  return {
166
167
  type: "GetImportProgress",
167
- source: c(e)
168
+ source: p(e)
168
169
  };
169
170
  }
170
- function Rt(e, t) {
171
+ function ae(e, t) {
171
172
  return {
172
173
  type: "GetLastLogs",
173
- source: c(e),
174
+ source: p(e),
174
175
  lines: t
175
176
  };
176
177
  }
177
- function Ot(e, t) {
178
+ function le(e, t) {
178
179
  return {
179
180
  type: "GetProgressLog",
180
- source: c(e),
181
+ source: p(e),
181
182
  patternToSearch: t
182
183
  };
183
184
  }
184
- function Vt(e) {
185
+ function ue(e) {
185
186
  return {
186
187
  type: "GetLogHandle",
187
- source: c(e)
188
+ source: p(e)
188
189
  };
189
190
  }
190
- function K() {
191
+ function _t() {
191
192
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
192
193
  }
193
- function x(e) {
194
+ function rt(e) {
194
195
  if (e && typeof globalThis.getPlatforma == "function")
195
196
  return globalThis.getPlatforma(e);
196
197
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
197
198
  throw new Error("Can't get platforma instance.");
198
199
  }
199
- function W() {
200
+ function vt() {
200
201
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
201
202
  }
202
- function o() {
203
+ function u() {
203
204
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
204
205
  throw new Error("Not in config rendering context");
205
206
  }
206
- function _(e, t) {
207
- const n = W();
207
+ function O(e, t) {
208
+ const n = vt();
208
209
  if (n === void 0) return !1;
209
210
  if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
210
211
  return n.callbackRegistry[e] = t, !0;
211
212
  }
212
- const F = /* @__PURE__ */ new Map();
213
- function q(e, t) {
214
- e in o().callbackRegistry || (o().callbackRegistry[e] = (n) => {
215
- for (const i of F.get(e))
216
- i(n);
217
- }, F.set(e, [])), F.get(e).push(t);
213
+ const N = /* @__PURE__ */ new Map();
214
+ function wt(e, t) {
215
+ e in u().callbackRegistry || (u().callbackRegistry[e] = (n) => {
216
+ for (const r of N.get(e))
217
+ r(n);
218
+ }, N.set(e, [])), N.get(e).push(t);
218
219
  }
219
- class h {
220
- constructor(t, n = (i) => i) {
221
- f(this, "isResolved", !1);
222
- f(this, "resolvedValue");
223
- this.handle = t, this.postProcess = n, q(t, (i) => {
224
- this.resolvedValue = n(i), this.isResolved = !0;
220
+ class g {
221
+ constructor(t, n = (r) => r) {
222
+ _(this, "isResolved", !1);
223
+ _(this, "resolvedValue");
224
+ this.handle = t, this.postProcess = n, wt(t, (r) => {
225
+ this.resolvedValue = n(r), this.isResolved = !0;
225
226
  });
226
227
  }
227
228
  map(t) {
228
- return new h(this.handle, (n) => t(this.postProcess(n)));
229
+ return new g(this.handle, (n) => t(this.postProcess(n)));
229
230
  }
230
231
  mapDefined(t) {
231
- return new h(this.handle, (n) => {
232
- const i = this.postProcess(n);
233
- return i ? t(i) : void 0;
232
+ return new g(this.handle, (n) => {
233
+ const r = this.postProcess(n);
234
+ return r ? t(r) : void 0;
234
235
  });
235
236
  }
236
237
  toJSON() {
237
238
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
238
239
  }
239
240
  }
240
- function V(e) {
241
- return e === void 0 ? void 0 : new m(e);
241
+ function X(e) {
242
+ return e === void 0 ? void 0 : new w(e);
242
243
  }
243
- class m {
244
+ class w {
244
245
  constructor(t) {
245
246
  this.handle = t;
246
247
  }
247
248
  resolve(...t) {
248
249
  const n = t.map(
249
- (i) => ({
250
+ (r) => ({
250
251
  assertFieldType: "Input",
251
- ...typeof i == "string" ? { field: i } : i
252
+ ...typeof r == "string" ? { field: r } : r
252
253
  })
253
254
  );
254
255
  return this.resolveWithCommon({}, ...n);
255
256
  }
256
257
  resolveOutput(...t) {
257
258
  const n = t.map(
258
- (i) => ({
259
+ (r) => ({
259
260
  assertFieldType: "Output",
260
- ...typeof i == "string" ? { field: i } : i
261
+ ...typeof r == "string" ? { field: r } : r
261
262
  })
262
263
  );
263
264
  return this.resolveWithCommon({}, ...n);
264
265
  }
265
266
  resolveInput(...t) {
266
267
  const n = t.map(
267
- (i) => ({
268
+ (r) => ({
268
269
  assertFieldType: "Input",
269
- ...typeof i == "string" ? { field: i } : i
270
+ ...typeof r == "string" ? { field: r } : r
270
271
  })
271
272
  );
272
273
  return this.resolveWithCommon({}, ...n);
@@ -275,40 +276,40 @@ class m {
275
276
  return this.resolveWithCommon({}, ...t);
276
277
  }
277
278
  resolveWithCommon(t, ...n) {
278
- return V(o().resolveWithCommon(this.handle, t, ...n));
279
+ return X(u().resolveWithCommon(this.handle, t, ...n));
279
280
  }
280
281
  get resourceType() {
281
- return o().getResourceType(this.handle);
282
+ return u().getResourceType(this.handle);
282
283
  }
283
284
  getInputsLocked() {
284
- return o().getInputsLocked(this.handle);
285
+ return u().getInputsLocked(this.handle);
285
286
  }
286
287
  getOutputsLocked() {
287
- return o().getOutputsLocked(this.handle);
288
+ return u().getOutputsLocked(this.handle);
288
289
  }
289
290
  getIsReadyOrError() {
290
- return o().getIsReadyOrError(this.handle);
291
+ return u().getIsReadyOrError(this.handle);
291
292
  }
292
293
  getIsFinal() {
293
- return o().getIsFinal(this.handle);
294
+ return u().getIsFinal(this.handle);
294
295
  }
295
296
  getError() {
296
- return V(o().getError(this.handle));
297
+ return X(u().getError(this.handle));
297
298
  }
298
299
  listInputFields() {
299
- return o().listInputFields(this.handle);
300
+ return u().listInputFields(this.handle);
300
301
  }
301
302
  listOutputFields() {
302
- return o().listOutputFields(this.handle);
303
+ return u().listOutputFields(this.handle);
303
304
  }
304
305
  listDynamicFields() {
305
- return o().listDynamicFields(this.handle);
306
+ return u().listDynamicFields(this.handle);
306
307
  }
307
308
  getKeyValueBase64(t) {
308
- return o().getKeyValueBase64(this.handle, t);
309
+ return u().getKeyValueBase64(this.handle, t);
309
310
  }
310
311
  getKeyValueAsString(t) {
311
- return o().getKeyValueAsString(this.handle, t);
312
+ return u().getKeyValueAsString(this.handle, t);
312
313
  }
313
314
  getKeyValueAsJson(t) {
314
315
  const n = this.getKeyValueAsString(t);
@@ -316,10 +317,10 @@ class m {
316
317
  return JSON.parse(n);
317
318
  }
318
319
  getDataBase64() {
319
- return o().getDataBase64(this.handle);
320
+ return u().getDataBase64(this.handle);
320
321
  }
321
322
  getDataAsString() {
322
- return o().getDataAsString(this.handle);
323
+ return u().getDataAsString(this.handle);
323
324
  }
324
325
  getDataAsJson() {
325
326
  const t = this.getDataAsString();
@@ -330,36 +331,36 @@ class m {
330
331
  *
331
332
  */
332
333
  getPColumns(t = !1, n = "") {
333
- const i = this.parsePObjectCollection(t, n);
334
- return i === void 0 ? void 0 : Object.entries(i).map(([, s]) => {
335
- if (!D(s)) throw new Error(`not a PColumn (kind = ${s.spec.kind})`);
336
- return s;
334
+ const r = this.parsePObjectCollection(t, n);
335
+ return r === void 0 ? void 0 : Object.entries(r).map(([, i]) => {
336
+ if (!W(i)) throw new Error(`not a PColumn (kind = ${i.spec.kind})`);
337
+ return i;
337
338
  });
338
339
  }
339
340
  /**
340
341
  *
341
342
  */
342
343
  parsePObjectCollection(t = !1, n = "") {
343
- const i = o().parsePObjectCollection(
344
+ const r = u().parsePObjectCollection(
344
345
  this.handle,
345
346
  t,
346
347
  n
347
348
  );
348
- if (i === void 0) return;
349
- const r = {};
350
- for (const [s, u] of Object.entries(i))
351
- r[s] = A(u, (a) => new m(a));
352
- return r;
349
+ if (r === void 0) return;
350
+ const s = {};
351
+ for (const [i, o] of Object.entries(r))
352
+ s[i] = L(o, (a) => new w(a));
353
+ return s;
353
354
  }
354
355
  getFileContentAsBase64() {
355
- return new h(o().getBlobContentAsBase64(this.handle));
356
+ return new g(u().getBlobContentAsBase64(this.handle));
356
357
  }
357
358
  getFileContentAsString() {
358
- return new h(o().getBlobContentAsString(this.handle));
359
+ return new g(u().getBlobContentAsString(this.handle));
359
360
  }
360
361
  getFileContentAsJson() {
361
- return new h(
362
- o().getBlobContentAsString(this.handle)
362
+ return new g(
363
+ u().getBlobContentAsString(this.handle)
363
364
  ).mapDefined((t) => JSON.parse(t));
364
365
  }
365
366
  /**
@@ -378,7 +379,7 @@ class m {
378
379
  * @returns downloaded file handle
379
380
  */
380
381
  getFileHandle() {
381
- return new h(o().getDownloadedBlobContentHandle(this.handle));
382
+ return new g(u().getDownloadedBlobContentHandle(this.handle));
382
383
  }
383
384
  /**
384
385
  * @deprecated use getFileHandle
@@ -390,7 +391,7 @@ class m {
390
391
  * @returns downloaded file handle
391
392
  */
392
393
  getRemoteFileHandle() {
393
- return new h(o().getOnDemandBlobContentHandle(this.handle));
394
+ return new g(u().getOnDemandBlobContentHandle(this.handle));
394
395
  }
395
396
  /**
396
397
  * @deprecated use getRemoteFileHandle
@@ -399,16 +400,16 @@ class m {
399
400
  return this.getRemoteFileHandle();
400
401
  }
401
402
  getImportProgress() {
402
- return new h(o().getImportProgress(this.handle));
403
+ return new g(u().getImportProgress(this.handle));
403
404
  }
404
405
  getLastLogs(t) {
405
- return new h(o().getLastLogs(this.handle, t));
406
+ return new g(u().getLastLogs(this.handle, t));
406
407
  }
407
408
  getProgressLog(t) {
408
- return new h(o().getProgressLog(this.handle, t));
409
+ return new g(u().getProgressLog(this.handle, t));
409
410
  }
410
411
  getLogHandle() {
411
- return new h(o().getLogHandle(this.handle));
412
+ return new g(u().getLogHandle(this.handle));
412
413
  }
413
414
  allFieldsResolved(t = "Input") {
414
415
  switch (t) {
@@ -423,51 +424,107 @@ class m {
423
424
  }
424
425
  }
425
426
  mapFields(t, n) {
426
- const { fieldType: i, requireLocked: r, skipUnresolved: s } = {
427
+ const { fieldType: r, requireLocked: s, skipUnresolved: i } = {
427
428
  fieldType: "Input",
428
429
  requireLocked: !0,
429
430
  skipUnresolved: !1,
430
431
  ...n
431
- }, u = t;
432
- if (r && (i === "Input" && !this.getInputsLocked() || i === "Output" && !this.getOutputsLocked()))
432
+ }, o = t;
433
+ if (s && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
433
434
  return;
434
- let d = (i === "Input" ? this.listInputFields() : i === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
435
- (l) => [l, this.resolve({ field: l, assertFieldType: i })]
435
+ let l = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
436
+ (c) => [c, this.resolve({ field: c, assertFieldType: r })]
436
437
  );
437
- return s && (d = d.filter((l) => l[1] !== void 0)), d.map(([l, g]) => u(l, g));
438
+ return i && (l = l.filter((c) => c[1] !== void 0)), l.map(([c, f]) => o(c, f));
438
439
  }
439
440
  }
440
- const L = "staging", T = "main";
441
- function j(e) {
441
+ const st = "staging", it = "main";
442
+ function ot(e) {
442
443
  return typeof e == "object" && e !== null && "__awaited_futures__" in e;
443
444
  }
444
- function R(e, t, n) {
445
+ function $(e, t, n) {
445
446
  if (t.has(n)) return;
446
447
  if (t.add(n), typeof n === "object")
447
- if (j(n)) n.__awaited_futures__.forEach((r) => e.add(r));
448
+ if (ot(n)) n.__awaited_futures__.forEach((s) => e.add(s));
448
449
  else if (Array.isArray(n))
449
- for (const r of n) R(e, t, r);
450
+ for (const s of n) $(e, t, s);
450
451
  else
451
- for (const [, r] of Object.entries(n))
452
- r !== n && R(e, t, r);
452
+ for (const [, s] of Object.entries(n))
453
+ s !== n && $(e, t, s);
453
454
  }
454
- function z(e) {
455
+ function St(e) {
455
456
  const t = /* @__PURE__ */ new Set();
456
- return R(t, /* @__PURE__ */ new Set(), e), t;
457
+ return $(t, /* @__PURE__ */ new Set(), e), t;
457
458
  }
458
- const Pt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
459
+ const ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
459
460
  __proto__: null,
460
- MainAccessorName: T,
461
- StagingAccessorName: L,
462
- getAllFutureAwaits: z,
463
- isFutureAwait: j
464
- }, Symbol.toStringTag, { value: "Module" }));
465
- class Q {
461
+ MainAccessorName: it,
462
+ StagingAccessorName: st,
463
+ getAllFutureAwaits: St,
464
+ isFutureAwait: ot
465
+ }, Symbol.toStringTag, { value: "Module" })), At = "pl7.app/label", Pt = "pl7.app/trace", It = P.object({
466
+ type: P.string(),
467
+ importance: P.number().optional(),
468
+ id: P.string().optional(),
469
+ label: P.string()
470
+ }), Ct = P.array(It), Tt = 1e-3, Rt = "__LABEL__", Q = "__LABEL__@1";
471
+ function Ft(e, t, n = {}) {
472
+ const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = e.map((d) => {
473
+ var z, Y;
474
+ const m = t(d), y = (z = m.annotations) == null ? void 0 : z[At], F = (Y = m.annotations) == null ? void 0 : Y[Pt], b = (F ? Ct.safeParse(JSON.parse(F)).data : void 0) ?? [];
475
+ y && b.splice(0, 0, { label: y, type: Rt, importance: -2 });
476
+ const V = [], q = /* @__PURE__ */ new Map();
477
+ for (let S = b.length - 1; S >= 0; --S) {
478
+ const { type: E } = b[S], ut = b[S].importance ?? 0, j = (q.get(E) ?? 0) + 1;
479
+ q.set(E, j);
480
+ const I = `${E}@${j}`;
481
+ s.set(I, (s.get(I) ?? 0) + 1), r.set(
482
+ I,
483
+ Math.max(
484
+ r.get(I) ?? Number.NEGATIVE_INFINITY,
485
+ ut - (b.length - S) * Tt
486
+ )
487
+ ), V.push({ ...b[S], fullType: I, occurenceIndex: j });
488
+ }
489
+ return V.reverse(), {
490
+ value: d,
491
+ spec: m,
492
+ label: y,
493
+ fullTrace: V
494
+ };
495
+ }), o = [], a = [], l = [...r];
496
+ l.sort(([, d], [, m]) => m - d);
497
+ for (const [d] of l)
498
+ d.endsWith("@1") || s.get(d) === e.length ? o.push(d) : a.push(d);
499
+ const c = (d) => i.map((m) => {
500
+ const y = m.fullTrace.filter((b) => d.has(b.fullType)).map((b) => b.label), F = n.separator ?? " / ";
501
+ return {
502
+ label: y.join(F),
503
+ value: m.value
504
+ };
505
+ });
506
+ if (o.length === 0) {
507
+ if (a.length !== 0) throw new Error("Assertion error.");
508
+ return c(new Set(Q));
509
+ }
510
+ let f = 0, v = 0;
511
+ for (; f < o.length; ) {
512
+ const d = /* @__PURE__ */ new Set();
513
+ for (let y = 0; y < f; ++y) d.add(o[y]);
514
+ d.add(o[v]);
515
+ const m = c(d);
516
+ if (new Set(m.map((y) => y.label)).size === e.length)
517
+ return n.includeNativeLabel ? (d.add(Q), c(d)) : m;
518
+ v++, v == o.length && (f++, v = f);
519
+ }
520
+ return c(/* @__PURE__ */ new Set([...o, ...a]));
521
+ }
522
+ class Ot {
466
523
  constructor() {
467
- f(this, "ctx", o());
468
- f(this, "defaultLabelFn", (t, n) => {
469
- var i;
470
- return ((i = t.annotations) == null ? void 0 : i["pl7.app/label"]) ?? "Unlabelled";
524
+ _(this, "ctx", u());
525
+ _(this, "defaultLabelFn", (t, n) => {
526
+ var r;
527
+ return ((r = t.annotations) == null ? void 0 : r["pl7.app/label"]) ?? "Unlabelled";
471
528
  });
472
529
  }
473
530
  /**
@@ -476,10 +533,16 @@ class Q {
476
533
  calculateOptions(t) {
477
534
  return this.ctx.calculateOptions(t);
478
535
  }
479
- getOptions(t, n = this.defaultLabelFn) {
480
- return this.getSpecs().entries.filter((i) => t(i.obj)).map((i) => ({
481
- ref: i.ref,
482
- label: n(i.obj, i.ref)
536
+ getOptions(t, n) {
537
+ const r = this.getSpecs().entries.filter((s) => t(s.obj));
538
+ return typeof n == "object" || typeof n > "u" ? Ft(r, (s) => s.obj, n ?? {}).map(
539
+ ({ value: { ref: s }, label: i }) => ({
540
+ ref: s,
541
+ label: i
542
+ })
543
+ ) : r.map((s) => ({
544
+ ref: s.ref,
545
+ label: n(s.obj, s.ref)
483
546
  }));
484
547
  }
485
548
  /**
@@ -496,7 +559,7 @@ class Q {
496
559
  ref: n.ref,
497
560
  obj: {
498
561
  ...n.obj,
499
- data: new m(n.obj.data)
562
+ data: new w(n.obj.data)
500
563
  }
501
564
  }))
502
565
  };
@@ -515,7 +578,7 @@ class Q {
515
578
  ref: n.ref,
516
579
  obj: {
517
580
  ...n.obj,
518
- data: B(n.obj.data, (i) => new m(i))
581
+ data: pt(n.obj.data, (r) => new w(r))
519
582
  }
520
583
  }))
521
584
  };
@@ -536,12 +599,22 @@ class Q {
536
599
  getDataByRef(t) {
537
600
  var n;
538
601
  return typeof this.ctx.getDataFromResultPoolByRef > "u" ? (n = this.getData().entries.find(
539
- (i) => i.ref.blockId === t.blockId && i.ref.name === t.name
540
- )) == null ? void 0 : n.obj : A(
602
+ (r) => r.ref.blockId === t.blockId && r.ref.name === t.name
603
+ )) == null ? void 0 : n.obj : L(
541
604
  this.ctx.getDataFromResultPoolByRef(t.blockId, t.name),
542
- (i) => new m(i)
605
+ (r) => new w(r)
543
606
  );
544
607
  }
608
+ /**
609
+ * Returns data associated with the ref ensuring that it is a p-column.
610
+ * @param ref a Ref
611
+ * @returns p-column associated with the ref
612
+ */
613
+ getPColumnByRef(t) {
614
+ const n = this.getDataByRef(t);
615
+ if (n)
616
+ return ft(n);
617
+ }
545
618
  /**
546
619
  * @param ref a Ref
547
620
  * @returns object spec associated with the ref
@@ -549,52 +622,53 @@ class Q {
549
622
  getSpecByRef(t) {
550
623
  var n;
551
624
  return typeof this.ctx.getSpecFromResultPoolByRef > "u" ? (n = this.getSpecs().entries.find(
552
- (i) => i.ref.blockId === t.blockId && i.ref.name === t.name
625
+ (r) => r.ref.blockId === t.blockId && r.ref.name === t.name
553
626
  )) == null ? void 0 : n.obj : this.ctx.getSpecFromResultPoolByRef(t.blockId, t.name);
554
627
  }
555
628
  /**
556
629
  * @param spec object specification
557
630
  * @returns array of data objects with compatible specs
631
+ * @deprecated delete this method after Jan 1, 2025
558
632
  */
559
633
  findDataWithCompatibleSpec(t) {
560
634
  const n = [];
561
- t: for (const i of this.getData().entries) {
562
- if (!$(i.obj.spec))
635
+ t: for (const r of this.getData().entries) {
636
+ if (!ht(r.obj.spec))
563
637
  continue;
564
- const r = i.obj.spec;
565
- if (t.name === r.name && t.valueType === r.valueType && t.axesSpec.length === r.axesSpec.length && P(t.domain, r.domain)) {
566
- for (let s = 0; s < t.axesSpec.length; ++s) {
567
- const u = t.axesSpec[s], a = r.axesSpec[s];
568
- if (u.name !== a.name || u.type !== a.type || !P(u.domain, a.domain))
638
+ const s = r.obj.spec;
639
+ if (t.name === s.name && t.valueType === s.valueType && t.axesSpec.length === s.axesSpec.length && K(t.domain, s.domain)) {
640
+ for (let i = 0; i < t.axesSpec.length; ++i) {
641
+ const o = t.axesSpec[i], a = s.axesSpec[i];
642
+ if (o.name !== a.name || o.type !== a.type || !K(o.domain, a.domain))
569
643
  continue t;
570
644
  }
571
- n.push(i.obj);
645
+ n.push(r.obj);
572
646
  }
573
647
  }
574
648
  return n;
575
649
  }
576
650
  }
577
- function P(e, t) {
651
+ function K(e, t) {
578
652
  if (e === void 0) return t === void 0;
579
653
  if (t === void 0) return !0;
580
654
  for (const n in t)
581
655
  if (e[n] !== t[n]) return !1;
582
656
  return !0;
583
657
  }
584
- class w {
658
+ class D {
585
659
  constructor() {
586
- f(this, "ctx");
587
- f(this, "args");
588
- f(this, "uiState");
589
- f(this, "resultPool", new Q());
590
- this.ctx = o(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
660
+ _(this, "ctx");
661
+ _(this, "args");
662
+ _(this, "uiState");
663
+ _(this, "resultPool", new Ot());
664
+ this.ctx = u(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
591
665
  }
592
666
  getNamedAccessor(t) {
593
667
  const n = this.ctx.getAccessorHandleByName(t);
594
- return n ? new m(n) : void 0;
668
+ return n ? new w(n) : void 0;
595
669
  }
596
670
  get prerun() {
597
- return this.getNamedAccessor(L);
671
+ return this.getNamedAccessor(st);
598
672
  }
599
673
  /**
600
674
  * @deprecated use prerun
@@ -609,7 +683,7 @@ class w {
609
683
  return this.precalc;
610
684
  }
611
685
  get outputs() {
612
- return this.getNamedAccessor(T);
686
+ return this.getNamedAccessor(it);
613
687
  }
614
688
  /**
615
689
  * @deprecated use outputs
@@ -617,19 +691,39 @@ class w {
617
691
  get mainOutput() {
618
692
  return this.outputs;
619
693
  }
694
+ /**
695
+ * Find labels data for a given axis id. It will search for a label column and return its data as a map.
696
+ * @returns a map of axis value => label
697
+ */
698
+ findLabels(t) {
699
+ const n = this.resultPool.getData();
700
+ for (const r of n.entries) {
701
+ if (!W(r.obj)) continue;
702
+ const s = r.obj.spec;
703
+ if (s.name === "pl7.app/label" && s.axesSpec.length === 1 && s.axesSpec[0].name === t.name && s.axesSpec[0].type === t.type && K(t.domain, s.axesSpec[0].domain)) {
704
+ if (r.obj.data.resourceType.name !== "PColumnData/Json")
705
+ throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
706
+ return new Map(
707
+ Object.entries(
708
+ r.obj.data.getDataAsJson().data
709
+ ).map((o) => [JSON.parse(o[0])[0], o[1]])
710
+ );
711
+ }
712
+ }
713
+ }
620
714
  createPFrame(t) {
621
- return this.ctx.createPFrame(t.map((n) => A(n, (i) => i.handle)));
715
+ return this.ctx.createPFrame(t.map((n) => L(n, (r) => r.handle)));
622
716
  }
623
717
  createPTable(t) {
624
718
  var n;
625
719
  return "columns" in t ? n = {
626
720
  src: {
627
- type: "inner",
628
- entries: t.columns.map((i) => ({ type: "column", column: i }))
721
+ type: "full",
722
+ entries: t.columns.map((r) => ({ type: "column", column: r }))
629
723
  },
630
724
  filters: t.filters ?? [],
631
725
  sorting: t.sorting ?? []
632
- } : n = t, this.ctx.createPTable(J(n, (i) => A(i, (r) => r.handle)));
726
+ } : n = t, this.ctx.createPTable(gt(n, (r) => L(r, (s) => s.handle)));
633
727
  }
634
728
  /** @deprecated scheduled for removal from SDK */
635
729
  getBlockLabel(t) {
@@ -640,106 +734,187 @@ class w {
640
734
  return this.ctx.getCurrentUnstableMarker();
641
735
  }
642
736
  }
643
- const X = "PColumnData/ResourceMap", Y = "PColumnData/Partitioned/ResourceMap";
644
- function E(e, t, n, i = [], r) {
737
+ const R = "PColumnData/", G = R + "ResourceMap", H = R + "Partitioned/ResourceMap", Z = R + "JsonPartitioned", M = R + "BinaryPartitioned", at = R + "Partitioned/", tt = at + "JsonPartitioned", B = at + "BinaryPartitioned";
738
+ function lt(e, t, n, r = [], s) {
645
739
  if (e === void 0) return !1;
646
740
  switch (e.resourceType.name) {
647
- case X: {
648
- let s = e.getInputsLocked();
649
- for (const u of e.listInputFields()) {
650
- const a = e.resolve({ field: u, assertFieldType: "Input" }), d = [...i, ...JSON.parse(u)], l = a === void 0 ? void 0 : t(a);
651
- l === void 0 && (s = !1), (l !== void 0 || r) && n.push({ key: d, value: l });
741
+ case G: {
742
+ let i = e.getInputsLocked();
743
+ for (const o of e.listInputFields()) {
744
+ const a = e.resolve({ field: o, assertFieldType: "Input" }), l = [...r, ...JSON.parse(o)], c = a === void 0 ? void 0 : t(a);
745
+ c === void 0 && (i = !1), (c !== void 0 || s) && n.push({ key: l, value: c });
652
746
  }
653
- return s;
747
+ return i;
654
748
  }
655
- case Y: {
656
- let s = e.getInputsLocked();
657
- for (const u of e.listInputFields()) {
658
- const a = e.resolve({ field: u, assertFieldType: "Input" });
659
- if (a === void 0) s = !1;
749
+ case H: {
750
+ let i = e.getInputsLocked();
751
+ for (const o of e.listInputFields()) {
752
+ const a = e.resolve({ field: o, assertFieldType: "Input" });
753
+ if (a === void 0) i = !1;
660
754
  else {
661
- const d = [...i, ...JSON.parse(u)], l = E(a, t, n, d, r);
662
- s = s && l;
755
+ const l = [...r, ...JSON.parse(o)], c = lt(
756
+ a,
757
+ t,
758
+ n,
759
+ l,
760
+ s
761
+ );
762
+ i = i && c;
663
763
  }
664
764
  }
665
- return s;
765
+ return i;
666
766
  }
667
767
  default:
668
768
  throw new Error(`Unknown resource type: ${e.resourceType.name}`);
669
769
  }
670
770
  }
671
- function Dt(e, t, n = !1) {
672
- const i = [];
673
- return { isComplete: E(e, t, i, [], n), data: i };
771
+ function de(e, t, n = !1) {
772
+ const r = [];
773
+ return { isComplete: lt(e, t, r, [], n), data: r };
674
774
  }
675
- const b = "1.10.12";
676
- function Z(e) {
775
+ const et = (e) => {
776
+ if (!e.endsWith(".index")) {
777
+ if (e.endsWith(".values"))
778
+ return e.substring(0, e.length - 7);
779
+ throw Error(`key must ends on .index/.values for binary p-column, got: ${e}`);
780
+ }
781
+ };
782
+ function Dt(e) {
783
+ if (!e) return;
784
+ const t = e.resourceType.name, n = e.getDataAsJson(), r = [];
785
+ let s = 0;
786
+ switch (t) {
787
+ case G:
788
+ s = n.keyLength;
789
+ break;
790
+ case H:
791
+ s = n.partitionKeyLength + n.keyLength;
792
+ break;
793
+ case Z:
794
+ case M:
795
+ s = n.partitionKeyLength;
796
+ break;
797
+ case B:
798
+ case tt:
799
+ s = n.superPartitionKeyLength + n.partitionKeyLength;
800
+ break;
801
+ }
802
+ switch (t) {
803
+ case G:
804
+ case Z:
805
+ case M:
806
+ for (let i of e.listInputFields()) {
807
+ if (t === M) {
808
+ const a = et(i);
809
+ if (a) i = a;
810
+ else continue;
811
+ }
812
+ const o = [...JSON.parse(i)];
813
+ r.push(o);
814
+ }
815
+ break;
816
+ case H:
817
+ case B:
818
+ case tt:
819
+ for (const i of e.listInputFields()) {
820
+ const o = [...JSON.parse(i)], a = e.resolve({ field: i, assertFieldType: "Input" });
821
+ if (a !== void 0)
822
+ for (let l of a.listInputFields()) {
823
+ if (t === B) {
824
+ const f = et(l);
825
+ if (f) l = f;
826
+ else continue;
827
+ }
828
+ const c = [...o, ...JSON.parse(l)];
829
+ r.push(c);
830
+ }
831
+ }
832
+ break;
833
+ }
834
+ return { data: r, keyLength: s };
835
+ }
836
+ function pe(e) {
837
+ const t = Dt(e);
838
+ if (!t) return;
839
+ const { data: n, keyLength: r } = t, s = [];
840
+ for (let i = 0; i < r; ++i)
841
+ s.push(/* @__PURE__ */ new Set());
842
+ for (const i of n) {
843
+ if (i.length !== r)
844
+ throw new Error("key length does not match partition length");
845
+ for (let o = 0; o < r; ++o)
846
+ s[o].add(i[o]);
847
+ }
848
+ return s.map((i) => Array.from(i.values()));
849
+ }
850
+ const C = "1.13.0";
851
+ function kt(e) {
677
852
  return e.__renderLambda === !0;
678
853
  }
679
- function I(e) {
854
+ function U(e) {
680
855
  if (e !== void 0)
681
- return Z(e) ? e.handle : e;
856
+ return kt(e) ? e.handle : e;
682
857
  }
683
- function y(e) {
858
+ function A(e) {
684
859
  if (e !== void 0)
685
860
  return typeof e == "string" ? { __renderLambda: !0, handle: e, retentive: !1 } : e;
686
861
  }
687
- function kt(e) {
862
+ function fe(e) {
688
863
  if (e.v3 !== void 0) {
689
864
  const {
690
865
  initialArgs: t,
691
866
  initialUiState: n,
692
- inputsValid: i,
693
- outputs: r,
694
- renderingMode: s,
695
- sdkVersion: u,
867
+ inputsValid: r,
868
+ outputs: s,
869
+ renderingMode: i,
870
+ sdkVersion: o,
696
871
  sections: a,
697
- title: d
698
- } = e.v3, { code: l } = e;
872
+ title: l
873
+ } = e.v3, { code: c } = e;
699
874
  return {
700
875
  initialArgs: t,
701
876
  initialUiState: n,
702
- inputsValid: i,
703
- outputs: r,
704
- renderingMode: s,
705
- sdkVersion: u,
877
+ inputsValid: r,
878
+ outputs: s,
879
+ renderingMode: i,
880
+ sdkVersion: o,
706
881
  sections: a,
707
- title: d,
708
- code: l
882
+ title: l,
883
+ code: c
709
884
  };
710
885
  } else if (e.inputsValid !== void 0) {
711
- const { sdkVersion: t, renderingMode: n, outputs: i, inputsValid: r, sections: s, initialArgs: u, code: a } = e, d = Object.keys(e);
712
- if (t === void 0 || n === void 0 || i === void 0 || r === void 0 || s === void 0 || u === void 0)
886
+ const { sdkVersion: t, renderingMode: n, outputs: r, inputsValid: s, sections: i, initialArgs: o, code: a } = e, l = Object.keys(e);
887
+ if (t === void 0 || n === void 0 || r === void 0 || s === void 0 || i === void 0 || o === void 0)
713
888
  throw new Error(
714
- `Malformed config v2. SDK version ${t}; Fields = ${d.join(", ")}`
889
+ `Malformed config v2. SDK version ${t}; Fields = ${l.join(", ")}`
715
890
  );
716
891
  return {
717
892
  sdkVersion: t,
718
893
  renderingMode: n,
719
- initialArgs: u,
894
+ initialArgs: o,
720
895
  outputs: Object.fromEntries(
721
- Object.entries(i).map(([l, g]) => [l, y(g)])
896
+ Object.entries(r).map(([c, f]) => [c, A(f)])
722
897
  ),
723
- inputsValid: y(r),
724
- sections: y(s),
898
+ inputsValid: A(s),
899
+ sections: A(i),
725
900
  initialUiState: void 0,
726
901
  code: a
727
902
  };
728
903
  } else if (e.renderingMode !== void 0) {
729
- const { sdkVersion: t, canRun: n, renderingMode: i, outputs: r, sections: s, initialArgs: u, code: a } = e, d = Object.keys(e);
730
- if (i === void 0 || r === void 0 || n === void 0 || s === void 0 || u === void 0)
904
+ const { sdkVersion: t, canRun: n, renderingMode: r, outputs: s, sections: i, initialArgs: o, code: a } = e, l = Object.keys(e);
905
+ if (r === void 0 || s === void 0 || n === void 0 || i === void 0 || o === void 0)
731
906
  throw new Error(
732
- `Malformed config v1. SDK version ${t}; Fields = ${d.join(", ")}`
907
+ `Malformed config v1. SDK version ${t}; Fields = ${l.join(", ")}`
733
908
  );
734
909
  return {
735
910
  sdkVersion: t ?? "unknown",
736
- renderingMode: i,
737
- initialArgs: u,
911
+ renderingMode: r,
912
+ initialArgs: o,
738
913
  outputs: Object.fromEntries(
739
- Object.entries(r).map(([l, g]) => [l, y(g)])
914
+ Object.entries(s).map(([c, f]) => [c, A(f)])
740
915
  ),
741
- inputsValid: y(n),
742
- sections: y(s),
916
+ inputsValid: A(n),
917
+ sections: A(i),
743
918
  initialUiState: void 0,
744
919
  code: a
745
920
  };
@@ -750,25 +925,25 @@ function kt(e) {
750
925
  );
751
926
  }
752
927
  }
753
- class p {
754
- constructor(t, n, i, r, s, u, a) {
755
- this._renderingMode = t, this._initialArgs = n, this._initialUiState = i, this._outputs = r, this._inputsValid = s, this._sections = u, this._title = a;
928
+ class h {
929
+ constructor(t, n, r, s, i, o, a) {
930
+ this._renderingMode = t, this._initialArgs = n, this._initialUiState = r, this._outputs = s, this._inputsValid = i, this._sections = o, this._title = a;
756
931
  }
757
932
  static create(t = "Heavy") {
758
- return new p(
933
+ return new h(
759
934
  t,
760
935
  void 0,
761
936
  {},
762
937
  {},
763
- C(!0),
764
- C([]),
938
+ k(!0),
939
+ k([]),
765
940
  void 0
766
941
  );
767
942
  }
768
- output(t, n, i = {}) {
943
+ output(t, n, r = {}) {
769
944
  if (typeof n == "function") {
770
- const r = `output#${t}`;
771
- return _(r, () => n(new w())), new p(
945
+ const s = `output#${t}`;
946
+ return O(s, () => n(new D())), new h(
772
947
  this._renderingMode,
773
948
  this._initialArgs,
774
949
  this._initialUiState,
@@ -776,8 +951,8 @@ class p {
776
951
  ...this._outputs,
777
952
  [t]: {
778
953
  __renderLambda: !0,
779
- handle: r,
780
- ...i
954
+ handle: s,
955
+ ...r
781
956
  }
782
957
  },
783
958
  this._inputsValid,
@@ -785,7 +960,7 @@ class p {
785
960
  this._title
786
961
  );
787
962
  } else
788
- return new p(
963
+ return new h(
789
964
  this._renderingMode,
790
965
  this._initialArgs,
791
966
  this._initialUiState,
@@ -807,7 +982,7 @@ class p {
807
982
  return this.inputsValid(t);
808
983
  }
809
984
  argsValid(t) {
810
- return typeof t == "function" ? (_("inputsValid", () => t(new w())), new p(
985
+ return typeof t == "function" ? (O("inputsValid", () => t(new D())), new h(
811
986
  this._renderingMode,
812
987
  this._initialArgs,
813
988
  this._initialUiState,
@@ -818,7 +993,7 @@ class p {
818
993
  },
819
994
  this._sections,
820
995
  this._title
821
- )) : new p(
996
+ )) : new h(
822
997
  this._renderingMode,
823
998
  this._initialArgs,
824
999
  this._initialUiState,
@@ -832,7 +1007,7 @@ class p {
832
1007
  return this.argsValid(t);
833
1008
  }
834
1009
  sections(t) {
835
- return Array.isArray(t) ? this.sections(C(t)) : typeof t == "function" ? (_("sections", () => t(new w())), new p(
1010
+ return Array.isArray(t) ? this.sections(k(t)) : typeof t == "function" ? (O("sections", () => t(new D())), new h(
836
1011
  this._renderingMode,
837
1012
  this._initialArgs,
838
1013
  this._initialUiState,
@@ -840,7 +1015,7 @@ class p {
840
1015
  this._inputsValid,
841
1016
  { __renderLambda: !0, handle: "sections" },
842
1017
  this._title
843
- )) : new p(
1018
+ )) : new h(
844
1019
  this._renderingMode,
845
1020
  this._initialArgs,
846
1021
  this._initialUiState,
@@ -851,7 +1026,7 @@ class p {
851
1026
  );
852
1027
  }
853
1028
  title(t) {
854
- return _("title", () => t(new w())), new p(
1029
+ return O("title", () => t(new D())), new h(
855
1030
  this._renderingMode,
856
1031
  this._initialArgs,
857
1032
  this._initialUiState,
@@ -866,7 +1041,7 @@ class p {
866
1041
  * @deprecated use {@link withArgs}
867
1042
  * */
868
1043
  initialArgs(t) {
869
- return new p(
1044
+ return new h(
870
1045
  this._renderingMode,
871
1046
  t,
872
1047
  this._initialUiState,
@@ -878,7 +1053,7 @@ class p {
878
1053
  }
879
1054
  /** Sets initial args for the block, this value must be specified. */
880
1055
  withArgs(t) {
881
- return new p(
1056
+ return new h(
882
1057
  this._renderingMode,
883
1058
  t,
884
1059
  this._initialUiState,
@@ -890,7 +1065,7 @@ class p {
890
1065
  }
891
1066
  /** Defines type and sets initial value for block UiState. */
892
1067
  withUiState(t) {
893
- return new p(
1068
+ return new h(
894
1069
  this._renderingMode,
895
1070
  this._initialArgs,
896
1071
  t,
@@ -907,7 +1082,7 @@ class p {
907
1082
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
908
1083
  const t = {
909
1084
  v3: {
910
- sdkVersion: b,
1085
+ sdkVersion: C,
911
1086
  renderingMode: this._renderingMode,
912
1087
  initialArgs: this._initialArgs,
913
1088
  initialUiState: this._initialUiState,
@@ -917,34 +1092,52 @@ class p {
917
1092
  outputs: this._outputs
918
1093
  },
919
1094
  // fields below are added to allow previous desktop versions read generated configs
920
- sdkVersion: b,
1095
+ sdkVersion: C,
921
1096
  renderingMode: this._renderingMode,
922
1097
  initialArgs: this._initialArgs,
923
- inputsValid: I(this._inputsValid),
924
- sections: I(this._sections),
1098
+ inputsValid: U(this._inputsValid),
1099
+ sections: U(this._sections),
925
1100
  outputs: Object.fromEntries(
926
- Object.entries(this._outputs).map(([n, i]) => [n, I(i)])
1101
+ Object.entries(this._outputs).map(([n, r]) => [n, U(r)])
927
1102
  )
928
1103
  };
929
- return K() ? x({ sdkVersion: b }) : { config: t };
1104
+ return _t() ? rt({ sdkVersion: C }) : { config: t };
930
1105
  }
931
1106
  }
932
- function xt(e, t, n) {
933
- var s, u;
934
- const i = e.resultPool.getData().entries.map((a) => a.obj).filter(D).filter((a) => a.spec.name === "pl7.app/label" && a.spec.axesSpec.length === 1), r = [];
935
- for (const a of t)
936
- for (const d of a.spec.axesSpec) {
937
- const l = O(d);
938
- for (const g of i)
939
- N(l, O(g.spec.axesSpec[0])) && r.push(g);
1107
+ function he(e, t, n, r) {
1108
+ var o, a;
1109
+ const s = e.resultPool.getData().entries.map((l) => l.obj).filter(W).filter((l) => l.spec.name === "pl7.app/label" && l.spec.axesSpec.length === 1), i = /* @__PURE__ */ new Map();
1110
+ for (const l of t)
1111
+ for (const c of l.spec.axesSpec) {
1112
+ const f = J(c);
1113
+ for (const v of s)
1114
+ mt(f, J(v.spec.axesSpec[0])) && i.set(v.id, v);
940
1115
  }
941
1116
  return e.createPTable({
942
- columns: [...t, ...r],
943
- filters: (s = n == null ? void 0 : n.pTableParams) == null ? void 0 : s.filters,
944
- sorting: (u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.sorting
1117
+ src: {
1118
+ type: "outer",
1119
+ primary: {
1120
+ type: "full",
1121
+ entries: t.map((l) => ({ type: "column", column: l }))
1122
+ },
1123
+ secondary: Array.from(i.values()).map((l) => ({ type: "column", column: l }))
1124
+ },
1125
+ filters: [...((o = n == null ? void 0 : n.pTableParams) == null ? void 0 : o.filters) ?? [], ...r ?? []],
1126
+ sorting: ((a = n == null ? void 0 : n.pTableParams) == null ? void 0 : a.sorting) ?? []
945
1127
  });
946
1128
  }
947
- class Lt {
1129
+ function ge(e, t, n) {
1130
+ const r = e.findLabels(t);
1131
+ return {
1132
+ axis: J(t),
1133
+ options: n.map((s) => ({
1134
+ value: s,
1135
+ label: (r == null ? void 0 : r.get(s)) ?? s.toString()
1136
+ })),
1137
+ defaultValue: n[0]
1138
+ };
1139
+ }
1140
+ class me {
948
1141
  constructor(t) {
949
1142
  this.handle = t;
950
1143
  }
@@ -964,81 +1157,88 @@ class Lt {
964
1157
  return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
965
1158
  }
966
1159
  }
967
- function tt(e) {
968
- return k({
1160
+ function Lt(e) {
1161
+ return nt({
969
1162
  __isRef: !0,
970
- blockId: S(e, "blockId"),
971
- name: S(e, "name")
1163
+ blockId: x(e, "blockId"),
1164
+ name: x(e, "name")
972
1165
  });
973
1166
  }
974
- function Tt(e) {
975
- return k({
976
- ref: tt(S(e, "ref")),
977
- label: S(e, "label")
1167
+ function ye(e) {
1168
+ return nt({
1169
+ ref: Lt(x(e, "ref")),
1170
+ label: x(e, "label")
978
1171
  });
979
1172
  }
980
- const jt = {
981
- sdkVersion: b
1173
+ const be = {
1174
+ sdkVersion: C
982
1175
  };
983
- function Et() {
984
- return x({ sdkVersion: b });
1176
+ function _e() {
1177
+ return rt({ sdkVersion: C });
985
1178
  }
986
- function Mt(e) {
1179
+ function ve(e) {
987
1180
  if (typeof globalThis.getEnvironmentValue == "function")
988
1181
  return globalThis.getEnvironmentValue(e);
989
1182
  }
990
1183
  export {
991
- st as Args,
992
- p as BlockModel,
993
- jt as CurrentSdkInfo,
994
- h as FutureRef,
995
- ot as It,
996
- Pt as JsRenderInternal,
997
- at as MainOutputs,
998
- G as OutputError,
999
- Lt as PFrameImpl,
1000
- w as RenderCtx,
1001
- Y as ResourceMapResourcePartitionedTypeName,
1002
- X as ResourceMapResourceTypeName,
1003
- Q as ResultPool,
1004
- ut as StagingOutputs,
1005
- m as TreeNodeAccessor,
1006
- lt as UiState,
1007
- mt as and,
1008
- xt as createPlDataTable,
1009
- I as downgradeCfgOrLambda,
1010
- kt as extractConfig,
1011
- ht as flatten,
1012
- Tt as fromPlOption,
1013
- tt as fromPlRef,
1014
- wt as getBlobContent,
1015
- At as getBlobContentAsJson,
1016
- Ct as getBlobContentAsString,
1017
- St as getDownloadedBlobContent,
1018
- Mt as getEnvironmentValue,
1019
- v as getFromCfg,
1020
- C as getImmediate,
1021
- It as getImportProgress,
1022
- S as getJsonField,
1023
- Rt as getLastLogs,
1024
- Vt as getLogHandle,
1025
- Ft as getOnDemandBlobContent,
1026
- Ot as getProgressLog,
1027
- Et as getRawPlatformaInstance,
1028
- bt as getResourceField,
1029
- vt as getResourceValueAsJson,
1030
- Z as isConfigLambda,
1031
- ft as isEmpty,
1032
- rt as isolate,
1033
- ct as makeArray,
1034
- k as makeObject,
1035
- pt as mapArrayValues,
1036
- dt as mapRecordValues,
1037
- _t as mapResourceFields,
1038
- gt as not,
1039
- yt as or,
1040
- Dt as parseResourceMap,
1041
- H as readOutput,
1042
- it as wrapOutputs
1184
+ Mt as Args,
1185
+ h as BlockModel,
1186
+ be as CurrentSdkInfo,
1187
+ g as FutureRef,
1188
+ Bt as It,
1189
+ ce as JsRenderInternal,
1190
+ Ut as MainOutputs,
1191
+ yt as OutputError,
1192
+ me as PFrameImpl,
1193
+ M as RT_BINARY_PARTITIONED,
1194
+ B as RT_BINARY_SUPER_PARTITIONED,
1195
+ Z as RT_JSON_PARTITIONED,
1196
+ tt as RT_JSON_SUPER_PARTITIONED,
1197
+ G as RT_RESOURCE_MAP,
1198
+ H as RT_RESOURCE_MAP_PARTITIONED,
1199
+ D as RenderCtx,
1200
+ Ot as ResultPool,
1201
+ Jt as StagingOutputs,
1202
+ w as TreeNodeAccessor,
1203
+ $t as UiState,
1204
+ Yt as and,
1205
+ he as createPlDataTable,
1206
+ ge as createPlDataTableSheet,
1207
+ U as downgradeCfgOrLambda,
1208
+ fe as extractConfig,
1209
+ Wt as flatten,
1210
+ ye as fromPlOption,
1211
+ Lt as fromPlRef,
1212
+ ee as getBlobContent,
1213
+ re as getBlobContentAsJson,
1214
+ ne as getBlobContentAsString,
1215
+ se as getDownloadedBlobContent,
1216
+ ve as getEnvironmentValue,
1217
+ T as getFromCfg,
1218
+ k as getImmediate,
1219
+ oe as getImportProgress,
1220
+ x as getJsonField,
1221
+ ae as getLastLogs,
1222
+ ue as getLogHandle,
1223
+ ie as getOnDemandBlobContent,
1224
+ Dt as getPartitionKeysList,
1225
+ le as getProgressLog,
1226
+ _e as getRawPlatformaInstance,
1227
+ Qt as getResourceField,
1228
+ Zt as getResourceValueAsJson,
1229
+ pe as getUniquePartitionKeys,
1230
+ kt as isConfigLambda,
1231
+ qt as isEmpty,
1232
+ Nt as isolate,
1233
+ Kt as makeArray,
1234
+ nt as makeObject,
1235
+ Ht as mapArrayValues,
1236
+ Gt as mapRecordValues,
1237
+ te as mapResourceFields,
1238
+ zt as not,
1239
+ Xt as or,
1240
+ de as parseResourceMap,
1241
+ bt as readOutput,
1242
+ jt as wrapOutputs
1043
1243
  };
1044
1244
  //# sourceMappingURL=index.mjs.map