@platforma-sdk/model 1.33.8 → 1.33.14

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,54 +1,54 @@
1
- var Xe = Object.defineProperty;
2
- var Qe = (t, e, n) => e in t ? Xe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var F = (t, e, n) => Qe(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { isPColumn as be, mapPObjectData as we, isDataInfoEntries as Ee, isDataInfo as Ae, dataInfoToEntries as Ze, selectorsToPredicate as X, resolveAnchors as xe, deriveNativeId as et, isPColumnSpec as ne, isPartitionedDataInfoEntries as tt, getAxisId as T, entriesToDataInfo as nt, canonicalizeAxisId as rt, withEnrichments as Ce, AnchoredIdDeriver as Pe, isPlRef as it, mapValueInVOE as st, ensurePColumn as ot, extractAllColumns as at, mapPTableDef as lt, mapDataInfo as ut, canonicalizeJson as D, parseJson as fe, matchAxisId as K, getPColumnSpecId as ue, getColumnIdAndSpec as Oe, isPTableAbsent as ct, PTableNA as pt } from "@milaboratories/pl-model-common";
1
+ var qe = Object.defineProperty;
2
+ var ze = (t, e, n) => e in t ? qe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var k = (t, e, n) => ze(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { isPColumn as Te, mapPObjectData as be, isDataInfoEntries as Le, isDataInfo as we, dataInfoToEntries as Ye, selectorsToPredicate as X, resolveAnchors as Ae, deriveNativeId as Xe, isPColumnSpec as ne, isPartitionedDataInfoEntries as Qe, getAxisId as D, entriesToDataInfo as Ze, canonicalizeAxisId as et, withEnrichments as xe, AnchoredIdDeriver as Ce, isPlRef as tt, mapValueInVOE as nt, ensurePColumn as rt, extractAllColumns as it, mapPTableDef as st, mapDataInfo as ot, canonicalizeJson as K, matchAxisId as U, getColumnIdAndSpec as Ee, parseJson as fe, isPTableAbsent as at, PTableNA as lt } from "@milaboratories/pl-model-common";
5
5
  export * from "@milaboratories/pl-model-common";
6
- import ke from "canonicalize";
6
+ import Oe from "canonicalize";
7
7
  import { z as M } from "zod";
8
8
  export * from "@milaboratories/pl-error-like";
9
- class dt extends Error {
9
+ class ut extends Error {
10
10
  constructor(e, n) {
11
11
  super(`${e.length}${n ? "+" : ""} errors, first error: ` + e[0].message), this.errors = e, this.moreErrors = n;
12
12
  }
13
13
  }
14
- function ft(t) {
15
- if (!t.ok) throw new dt(t.errors, t.moreErrors);
14
+ function ct(t) {
15
+ if (!t.ok) throw new ut(t.errors, t.moreErrors);
16
16
  return t.value;
17
17
  }
18
- function en(t) {
18
+ function Qt(t) {
19
19
  return new Proxy(t, {
20
20
  get(e, n) {
21
- return ft(e[n]);
21
+ return ct(e[n]);
22
22
  }
23
23
  });
24
24
  }
25
- function P(t) {
25
+ function C(t) {
26
26
  return typeof t == "string" || typeof t == "number" || typeof t == "boolean" || t === null ? re(t) : t;
27
27
  }
28
28
  function Q(t) {
29
29
  return { type: "GetFromCtx", variable: t };
30
30
  }
31
- function tn(t) {
31
+ function Zt(t) {
32
32
  return {
33
33
  type: "Isolate",
34
34
  cfg: t
35
35
  };
36
36
  }
37
- const nn = Q("$args"), rn = Q("$it"), sn = Q("$prod"), on = Q("$staging"), an = Q("$ui");
37
+ const en = Q("$args"), tn = Q("$it"), nn = Q("$prod"), rn = Q("$staging"), sn = Q("$ui");
38
38
  function re(t) {
39
39
  return { type: "Immediate", value: t };
40
40
  }
41
- function Fe(t) {
41
+ function ke(t) {
42
42
  const e = {};
43
- for (const [n, r] of Object.entries(t)) e[n] = P(r);
43
+ for (const [n, r] of Object.entries(t)) e[n] = C(r);
44
44
  return {
45
45
  type: "MakeObject",
46
46
  template: e
47
47
  };
48
48
  }
49
- function ln(...t) {
49
+ function on(...t) {
50
50
  const e = [];
51
- for (const n of t) e.push(P(n));
51
+ for (const n of t) e.push(C(n));
52
52
  return {
53
53
  type: "MakeArray",
54
54
  template: e
@@ -57,11 +57,11 @@ function ln(...t) {
57
57
  function ie(t, e) {
58
58
  return {
59
59
  type: "GetJsonField",
60
- source: P(t),
61
- field: P(e)
60
+ source: C(t),
61
+ field: C(e)
62
62
  };
63
63
  }
64
- function un(t, e, n = "$it") {
64
+ function an(t, e, n = "$it") {
65
65
  return {
66
66
  type: "MapRecordValues",
67
67
  source: t,
@@ -69,7 +69,7 @@ function un(t, e, n = "$it") {
69
69
  itVar: n
70
70
  };
71
71
  }
72
- function cn(t, e, n = "$it") {
72
+ function ln(t, e, n = "$it") {
73
73
  return {
74
74
  type: "MapArrayValues",
75
75
  source: t,
@@ -77,54 +77,54 @@ function cn(t, e, n = "$it") {
77
77
  itVar: n
78
78
  };
79
79
  }
80
- function pn(t) {
80
+ function un(t) {
81
81
  return {
82
82
  type: "Flatten",
83
83
  source: t
84
84
  };
85
85
  }
86
- function dn(t) {
86
+ function cn(t) {
87
87
  return {
88
88
  type: "IsEmpty",
89
89
  arg: t
90
90
  };
91
91
  }
92
- function fn(t) {
92
+ function dn(t) {
93
93
  return {
94
94
  type: "Not",
95
95
  operand: t
96
96
  };
97
97
  }
98
- function hn(t, e) {
98
+ function pn(t, e) {
99
99
  return {
100
100
  type: "And",
101
101
  operand1: t,
102
102
  operand2: e
103
103
  };
104
104
  }
105
- function gn(t, e) {
105
+ function fn(t, e) {
106
106
  return {
107
107
  type: "Or",
108
108
  operand1: t,
109
109
  operand2: e
110
110
  };
111
111
  }
112
- function mn(t, e) {
112
+ function hn(t, e) {
113
113
  return {
114
114
  type: "GetResourceField",
115
- source: P(t),
116
- field: P(e)
115
+ source: C(t),
116
+ field: C(e)
117
117
  };
118
118
  }
119
- function yn() {
119
+ function gn() {
120
120
  return function(t) {
121
121
  return {
122
122
  type: "GetResourceValueAsJson",
123
- source: P(t)
123
+ source: C(t)
124
124
  };
125
125
  };
126
126
  }
127
- function vn(t, e, n = "$it") {
127
+ function mn(t, e, n = "$it") {
128
128
  return {
129
129
  type: "MapResourceFields",
130
130
  source: t,
@@ -132,82 +132,82 @@ function vn(t, e, n = "$it") {
132
132
  itVar: n
133
133
  };
134
134
  }
135
- function bn(t, e) {
135
+ function yn(t, e) {
136
136
  return {
137
137
  type: "GetBlobContent",
138
138
  range: e,
139
- source: P(t)
139
+ source: C(t)
140
140
  };
141
141
  }
142
- function wn(t, e) {
142
+ function vn(t, e) {
143
143
  return {
144
144
  type: "GetBlobContentAsString",
145
145
  range: e,
146
- source: P(t)
146
+ source: C(t)
147
147
  };
148
148
  }
149
- function An() {
149
+ function bn() {
150
150
  return function(t, e) {
151
151
  return {
152
152
  type: "GetBlobContentAsJson",
153
153
  range: e,
154
- source: P(t)
154
+ source: C(t)
155
155
  };
156
156
  };
157
157
  }
158
- function xn(t) {
158
+ function wn(t) {
159
159
  return {
160
160
  type: "GetDownloadedBlobContent",
161
- source: P(t)
161
+ source: C(t)
162
162
  };
163
163
  }
164
- function Cn(t) {
164
+ function An(t) {
165
165
  return {
166
166
  type: "GetOnDemandBlobContent",
167
- source: P(t)
167
+ source: C(t)
168
168
  };
169
169
  }
170
- function Pn(t, e) {
170
+ function xn(t, e) {
171
171
  return {
172
172
  type: "ExtractArchiveAndGetURL",
173
173
  format: e,
174
- source: P(t)
174
+ source: C(t)
175
175
  };
176
176
  }
177
- function Sn(t) {
177
+ function Cn(t) {
178
178
  return {
179
179
  type: "GetImportProgress",
180
- source: P(t)
180
+ source: C(t)
181
181
  };
182
182
  }
183
- function _n(t, e) {
183
+ function Pn(t, e) {
184
184
  return {
185
185
  type: "GetLastLogs",
186
- source: P(t),
186
+ source: C(t),
187
187
  lines: e
188
188
  };
189
189
  }
190
- function In(t, e) {
190
+ function Sn(t, e) {
191
191
  return {
192
192
  type: "GetProgressLog",
193
- source: P(t),
193
+ source: C(t),
194
194
  patternToSearch: e
195
195
  };
196
196
  }
197
- function Tn(t, e) {
197
+ function _n(t, e) {
198
198
  return {
199
199
  type: "GetProgressLogWithInfo",
200
- source: P(t),
200
+ source: C(t),
201
201
  patternToSearch: e
202
202
  };
203
203
  }
204
- function Ln(t) {
204
+ function In(t) {
205
205
  return {
206
206
  type: "GetLogHandle",
207
- source: P(t)
207
+ source: C(t)
208
208
  };
209
209
  }
210
- function ht() {
210
+ function dt() {
211
211
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
212
212
  }
213
213
  function Re(t) {
@@ -216,39 +216,39 @@ function Re(t) {
216
216
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
217
217
  throw new Error("Can't get platforma instance.");
218
218
  }
219
- function gt() {
219
+ function pt() {
220
220
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
221
221
  }
222
- function h() {
222
+ function g() {
223
223
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
224
224
  throw new Error("Not in config rendering context");
225
225
  }
226
226
  function H(t, e) {
227
- const n = gt();
227
+ const n = pt();
228
228
  if (n === void 0) return !1;
229
229
  if (t in n.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
230
230
  return n.callbackRegistry[t] = e, !0;
231
231
  }
232
232
  const ce = /* @__PURE__ */ new Map();
233
- function mt(t, e) {
234
- t in h().callbackRegistry || (h().callbackRegistry[t] = (n) => {
233
+ function ft(t, e) {
234
+ t in g().callbackRegistry || (g().callbackRegistry[t] = (n) => {
235
235
  for (const r of ce.get(t))
236
236
  r(n);
237
237
  }, ce.set(t, [])), ce.get(t).push(e);
238
238
  }
239
- class I {
239
+ class _ {
240
240
  constructor(e, n = (r) => r) {
241
- F(this, "isResolved", !1);
242
- F(this, "resolvedValue");
243
- this.handle = e, this.postProcess = n, mt(e, (r) => {
241
+ k(this, "isResolved", !1);
242
+ k(this, "resolvedValue");
243
+ this.handle = e, this.postProcess = n, ft(e, (r) => {
244
244
  this.resolvedValue = n(r), this.isResolved = !0;
245
245
  });
246
246
  }
247
247
  map(e) {
248
- return new I(this.handle, (n) => e(this.postProcess(n)));
248
+ return new _(this.handle, (n) => e(this.postProcess(n)));
249
249
  }
250
250
  mapDefined(e) {
251
- return new I(this.handle, (n) => {
251
+ return new _(this.handle, (n) => {
252
252
  const r = this.postProcess(n);
253
253
  return r ? e(r) : void 0;
254
254
  });
@@ -260,7 +260,7 @@ class I {
260
260
  function he(t, e) {
261
261
  return t === void 0 ? void 0 : e(t);
262
262
  }
263
- class O {
263
+ class E {
264
264
  constructor(e, n) {
265
265
  this.handle = e, this.resolvePath = n;
266
266
  }
@@ -300,46 +300,46 @@ class O {
300
300
  ...n.map((i) => typeof i == "string" ? i : i.field)
301
301
  ];
302
302
  return he(
303
- h().resolveWithCommon(this.handle, e, ...n),
304
- (i) => new O(i, r)
303
+ g().resolveWithCommon(this.handle, e, ...n),
304
+ (i) => new E(i, r)
305
305
  );
306
306
  }
307
307
  get resourceType() {
308
- return h().getResourceType(this.handle);
308
+ return g().getResourceType(this.handle);
309
309
  }
310
310
  getInputsLocked() {
311
- return h().getInputsLocked(this.handle);
311
+ return g().getInputsLocked(this.handle);
312
312
  }
313
313
  getOutputsLocked() {
314
- return h().getOutputsLocked(this.handle);
314
+ return g().getOutputsLocked(this.handle);
315
315
  }
316
316
  getIsReadyOrError() {
317
- return h().getIsReadyOrError(this.handle);
317
+ return g().getIsReadyOrError(this.handle);
318
318
  }
319
319
  getIsFinal() {
320
- return h().getIsFinal(this.handle);
320
+ return g().getIsFinal(this.handle);
321
321
  }
322
322
  getError() {
323
323
  const e = [...this.resolvePath, "error"];
324
324
  return he(
325
- h().getError(this.handle),
326
- (n) => new O(n, e)
325
+ g().getError(this.handle),
326
+ (n) => new E(n, e)
327
327
  );
328
328
  }
329
329
  listInputFields() {
330
- return h().listInputFields(this.handle);
330
+ return g().listInputFields(this.handle);
331
331
  }
332
332
  listOutputFields() {
333
- return h().listOutputFields(this.handle);
333
+ return g().listOutputFields(this.handle);
334
334
  }
335
335
  listDynamicFields() {
336
- return h().listDynamicFields(this.handle);
336
+ return g().listDynamicFields(this.handle);
337
337
  }
338
338
  getKeyValueBase64(e) {
339
- return h().getKeyValueBase64(this.handle, e);
339
+ return g().getKeyValueBase64(this.handle, e);
340
340
  }
341
341
  getKeyValueAsString(e) {
342
- return h().getKeyValueAsString(this.handle, e);
342
+ return g().getKeyValueAsString(this.handle, e);
343
343
  }
344
344
  getKeyValueAsJson(e) {
345
345
  const n = this.getKeyValueAsString(e);
@@ -347,10 +347,10 @@ class O {
347
347
  return JSON.parse(n);
348
348
  }
349
349
  getDataBase64() {
350
- return h().getDataBase64(this.handle);
350
+ return g().getDataBase64(this.handle);
351
351
  }
352
352
  getDataAsString() {
353
- return h().getDataAsString(this.handle);
353
+ return g().getDataAsString(this.handle);
354
354
  }
355
355
  getDataAsJson() {
356
356
  const e = this.getDataAsString();
@@ -363,7 +363,7 @@ class O {
363
363
  getPColumns(e = !1, n = "") {
364
364
  const r = this.parsePObjectCollection(e, n);
365
365
  return r === void 0 ? void 0 : Object.entries(r).map(([, s]) => {
366
- if (!be(s)) throw new Error(`not a PColumn (kind = ${s.spec.kind})`);
366
+ if (!Te(s)) throw new Error(`not a PColumn (kind = ${s.spec.kind})`);
367
367
  return s;
368
368
  });
369
369
  }
@@ -371,7 +371,7 @@ class O {
371
371
  *
372
372
  */
373
373
  parsePObjectCollection(e = !1, n = "") {
374
- const r = h().parsePObjectCollection(
374
+ const r = g().parsePObjectCollection(
375
375
  this.handle,
376
376
  e,
377
377
  n,
@@ -381,19 +381,19 @@ class O {
381
381
  const i = {};
382
382
  for (const [s, o] of Object.entries(r)) {
383
383
  const a = [...this.resolvePath, s];
384
- i[s] = we(o, (l) => new O(l, a));
384
+ i[s] = be(o, (l) => new E(l, a));
385
385
  }
386
386
  return i;
387
387
  }
388
388
  getFileContentAsBase64(e) {
389
- return new I(h().getBlobContentAsBase64(this.handle, e));
389
+ return new _(g().getBlobContentAsBase64(this.handle, e));
390
390
  }
391
391
  getFileContentAsString(e) {
392
- return new I(h().getBlobContentAsString(this.handle, e));
392
+ return new _(g().getBlobContentAsString(this.handle, e));
393
393
  }
394
394
  getFileContentAsJson(e) {
395
- return new I(
396
- h().getBlobContentAsString(this.handle, e)
395
+ return new _(
396
+ g().getBlobContentAsString(this.handle, e)
397
397
  ).mapDefined((n) => JSON.parse(n));
398
398
  }
399
399
  /**
@@ -412,7 +412,7 @@ class O {
412
412
  * @returns downloaded file handle
413
413
  */
414
414
  getFileHandle() {
415
- return new I(h().getDownloadedBlobContentHandle(this.handle));
415
+ return new _(g().getDownloadedBlobContentHandle(this.handle));
416
416
  }
417
417
  /**
418
418
  * @deprecated use getFileHandle
@@ -424,7 +424,7 @@ class O {
424
424
  * @returns downloaded file handle
425
425
  */
426
426
  getRemoteFileHandle() {
427
- return new I(h().getOnDemandBlobContentHandle(this.handle));
427
+ return new _(g().getOnDemandBlobContentHandle(this.handle));
428
428
  }
429
429
  /**
430
430
  * @deprecated use getRemoteFileHandle
@@ -436,22 +436,22 @@ class O {
436
436
  * @returns the url to the extracted folder
437
437
  */
438
438
  extractArchiveAndGetURL(e) {
439
- return new I(h().extractArchiveAndGetURL(this.handle, e));
439
+ return new _(g().extractArchiveAndGetURL(this.handle, e));
440
440
  }
441
441
  getImportProgress() {
442
- return new I(h().getImportProgress(this.handle));
442
+ return new _(g().getImportProgress(this.handle));
443
443
  }
444
444
  getLastLogs(e) {
445
- return new I(h().getLastLogs(this.handle, e));
445
+ return new _(g().getLastLogs(this.handle, e));
446
446
  }
447
447
  getProgressLog(e) {
448
- return new I(h().getProgressLog(this.handle, e));
448
+ return new _(g().getProgressLog(this.handle, e));
449
449
  }
450
450
  getProgressLogWithInfo(e) {
451
- return new I(h().getProgressLogWithInfo(this.handle, e));
451
+ return new _(g().getProgressLogWithInfo(this.handle, e));
452
452
  }
453
453
  getLogHandle() {
454
- return new I(h().getLogHandle(this.handle));
454
+ return new _(g().getLogHandle(this.handle));
455
455
  }
456
456
  allFieldsResolved(e = "Input") {
457
457
  switch (e) {
@@ -477,119 +477,119 @@ class O {
477
477
  let l = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
478
478
  (u) => [u, this.resolve({ field: u, assertFieldType: r })]
479
479
  );
480
- return s && (l = l.filter((u) => u[1] !== void 0)), l.map(([u, d]) => o(u, d));
480
+ return s && (l = l.filter((u) => u[1] !== void 0)), l.map(([u, c]) => o(u, c));
481
481
  }
482
482
  }
483
- const De = "staging", Ke = "main", yt = {
483
+ const De = "staging", Fe = "main", ht = {
484
484
  explicitColumnsSupport: !0,
485
485
  inlineColumnsSupport: !0,
486
486
  activeArgs: !0
487
487
  };
488
- function je(t) {
488
+ function Ke(t) {
489
489
  return typeof t == "object" && t !== null && "__awaited_futures__" in t;
490
490
  }
491
491
  function ge(t, e, n) {
492
492
  if (e.has(n)) return;
493
493
  if (e.add(n), typeof n === "object")
494
- if (je(n)) n.__awaited_futures__.forEach((i) => t.add(i));
494
+ if (Ke(n)) n.__awaited_futures__.forEach((i) => t.add(i));
495
495
  else if (Array.isArray(n))
496
496
  for (const i of n) ge(t, e, i);
497
497
  else
498
498
  for (const [, i] of Object.entries(n))
499
499
  i !== n && ge(t, e, i);
500
500
  }
501
- function vt(t) {
501
+ function gt(t) {
502
502
  const e = /* @__PURE__ */ new Set();
503
503
  return ge(e, /* @__PURE__ */ new Set(), t), e;
504
504
  }
505
- const En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
505
+ const Tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
506
506
  __proto__: null,
507
- GlobalCfgRenderCtxFeatureFlags: yt,
508
- MainAccessorName: Ke,
507
+ GlobalCfgRenderCtxFeatureFlags: ht,
508
+ MainAccessorName: Fe,
509
509
  StagingAccessorName: De,
510
- getAllFutureAwaits: vt,
511
- isFutureAwait: je
512
- }, Symbol.toStringTag, { value: "Module" })), bt = "pl7.app/label", wt = "pl7.app/trace", At = M.object({
510
+ getAllFutureAwaits: gt,
511
+ isFutureAwait: Ke
512
+ }, Symbol.toStringTag, { value: "Module" })), mt = "pl7.app/label", yt = "pl7.app/trace", vt = M.object({
513
513
  type: M.string(),
514
514
  importance: M.number().optional(),
515
515
  id: M.string().optional(),
516
516
  label: M.string()
517
- }), xt = M.array(At), Ct = 1e-3, Pt = "__LABEL__", Se = "__LABEL__@1";
517
+ }), bt = M.array(vt), wt = 1e-3, At = "__LABEL__", Pe = "__LABEL__@1";
518
518
  function Ve(t, e, n = {}) {
519
519
  const r = /* @__PURE__ */ new Map(), i = n.forceTraceElements !== void 0 && n.forceTraceElements.length > 0 ? new Set(n.forceTraceElements) : void 0, s = /* @__PURE__ */ new Map(), o = t.map((f) => {
520
- var S, R;
520
+ var P, R;
521
521
  const w = e(f);
522
- let c, g, x;
523
- "spec" in w && typeof w.spec == "object" ? (c = w.spec, g = w.prefixTrace, x = w.suffixTrace) : c = w;
524
- const p = (S = c.annotations) == null ? void 0 : S[bt], A = (R = c.annotations) == null ? void 0 : R[wt], m = (A ? xt.safeParse(JSON.parse(A)).data : void 0) ?? [], v = [
525
- ...g ?? [],
526
- ...m,
527
- ...x ?? []
522
+ let d, h, b;
523
+ "spec" in w && typeof w.spec == "object" ? (d = w.spec, h = w.prefixTrace, b = w.suffixTrace) : d = w;
524
+ const p = (P = d.annotations) == null ? void 0 : P[mt], I = (R = d.annotations) == null ? void 0 : R[yt], x = (I ? bt.safeParse(JSON.parse(I)).data : void 0) ?? [], y = [
525
+ ...h ?? [],
526
+ ...x,
527
+ ...b ?? []
528
528
  ];
529
529
  if (p !== void 0) {
530
- const k = { label: p, type: Pt, importance: -2 };
531
- n.addLabelAsSuffix ? v.push(k) : v.splice(0, 0, k);
530
+ const O = { label: p, type: At, importance: -2 };
531
+ n.addLabelAsSuffix ? y.push(O) : y.splice(0, 0, O);
532
532
  }
533
- const C = [], L = /* @__PURE__ */ new Map();
534
- for (let k = v.length - 1; k >= 0; --k) {
535
- const { type: W } = v[k], V = v[k].importance ?? 0, N = (L.get(W) ?? 0) + 1;
536
- L.set(W, N);
537
- const j = `${W}@${N}`;
538
- s.set(j, (s.get(j) ?? 0) + 1), r.set(
539
- j,
533
+ const A = [], T = /* @__PURE__ */ new Map();
534
+ for (let O = y.length - 1; O >= 0; --O) {
535
+ const { type: W } = y[O], V = y[O].importance ?? 0, $ = (T.get(W) ?? 0) + 1;
536
+ T.set(W, $);
537
+ const F = `${W}@${$}`;
538
+ s.set(F, (s.get(F) ?? 0) + 1), r.set(
539
+ F,
540
540
  Math.max(
541
- r.get(j) ?? Number.NEGATIVE_INFINITY,
542
- V - (v.length - k) * Ct
541
+ r.get(F) ?? Number.NEGATIVE_INFINITY,
542
+ V - (y.length - O) * wt
543
543
  )
544
- ), C.push({ ...v[k], fullType: j, occurrenceIndex: N });
544
+ ), A.push({ ...y[O], fullType: F, occurrenceIndex: $ });
545
545
  }
546
- return C.reverse(), {
546
+ return A.reverse(), {
547
547
  value: f,
548
- spec: c,
548
+ spec: d,
549
549
  label: p,
550
- fullTrace: C
550
+ fullTrace: A
551
551
  };
552
552
  }), a = [], l = [], u = [...r];
553
553
  u.sort(([, f], [, w]) => w - f);
554
554
  for (const [f] of u)
555
555
  f.endsWith("@1") || s.get(f) === t.length ? a.push(f) : l.push(f);
556
- const d = (f, w = !1) => {
557
- const c = [];
558
- for (let g = 0; g < o.length; g++) {
559
- const x = o[g], p = x.fullTrace.filter((v) => f.has(v.fullType) || i && i.has(v.type));
556
+ const c = (f, w = !1) => {
557
+ const d = [];
558
+ for (let h = 0; h < o.length; h++) {
559
+ const b = o[h], p = b.fullTrace.filter((y) => f.has(y.fullType) || i && i.has(y.type));
560
560
  if (p.length === 0)
561
561
  if (w)
562
- c.push({
562
+ d.push({
563
563
  label: "Unlabeled",
564
- value: x.value
564
+ value: b.value
565
565
  });
566
566
  else return;
567
- const A = p.map((v) => v.label), m = n.separator ?? " / ";
568
- c.push({
569
- label: A.join(m),
570
- value: x.value
567
+ const I = p.map((y) => y.label), x = n.separator ?? " / ";
568
+ d.push({
569
+ label: I.join(x),
570
+ value: b.value
571
571
  });
572
572
  }
573
- return c;
573
+ return d;
574
574
  };
575
575
  if (a.length === 0) {
576
576
  if (l.length !== 0) throw new Error("Non-empty secondary types list while main types list is empty.");
577
- return d(new Set(Se), !0);
577
+ return c(new Set(Pe), !0);
578
578
  }
579
- let y = 0, b = -1;
580
- for (; y < a.length; ) {
579
+ let m = 0, v = -1;
580
+ for (; m < a.length; ) {
581
581
  const f = /* @__PURE__ */ new Set();
582
- n.includeNativeLabel && f.add(Se);
583
- for (let c = 0; c < y; ++c) f.add(a[c]);
584
- b >= 0 && f.add(a[b]);
585
- const w = d(f);
586
- if (w !== void 0 && new Set(w.map((c) => c.label)).size === t.length) return w;
587
- b++, b >= a.length && (y++, b = y);
582
+ n.includeNativeLabel && f.add(Pe);
583
+ for (let d = 0; d < m; ++d) f.add(a[d]);
584
+ v >= 0 && f.add(a[v]);
585
+ const w = c(f);
586
+ if (w !== void 0 && new Set(w.map((d) => d.label)).size === t.length) return w;
587
+ v++, v >= a.length && (m++, v = m);
588
588
  }
589
- return d(/* @__PURE__ */ new Set([...a, ...l]), !0);
589
+ return c(/* @__PURE__ */ new Set([...a, ...l]), !0);
590
590
  }
591
- const Z = "PColumnData/", se = Z + "ResourceMap", oe = Z + "Partitioned/ResourceMap", q = Z + "JsonPartitioned", B = Z + "BinaryPartitioned", $e = Z + "Partitioned/", ae = $e + "JsonPartitioned", z = $e + "BinaryPartitioned";
592
- function Ne(t, e, n, r = [], i) {
591
+ const Z = "PColumnData/", se = Z + "ResourceMap", oe = Z + "Partitioned/ResourceMap", q = Z + "JsonPartitioned", B = Z + "BinaryPartitioned", je = Z + "Partitioned/", ae = je + "JsonPartitioned", z = je + "BinaryPartitioned";
592
+ function $e(t, e, n, r = [], i) {
593
593
  if (t === void 0) return !1;
594
594
  switch (t.resourceType.name) {
595
595
  case se: {
@@ -606,7 +606,7 @@ function Ne(t, e, n, r = [], i) {
606
606
  const a = t.resolve({ field: o, assertFieldType: "Input" });
607
607
  if (a === void 0) s = !1;
608
608
  else {
609
- const l = [...r, ...JSON.parse(o)], u = Ne(
609
+ const l = [...r, ...JSON.parse(o)], u = $e(
610
610
  a,
611
611
  e,
612
612
  n,
@@ -622,9 +622,9 @@ function Ne(t, e, n, r = [], i) {
622
622
  throw new Error(`Unknown resource type: ${t.resourceType.name}`);
623
623
  }
624
624
  }
625
- function On(t, e, n = !1) {
625
+ function Ln(t, e, n = !1) {
626
626
  const r = [];
627
- return { isComplete: Ne(t, e, r, [], n), data: r };
627
+ return { isComplete: $e(t, e, r, [], n), data: r };
628
628
  }
629
629
  const me = (t) => {
630
630
  if (t.endsWith(".index"))
@@ -633,7 +633,7 @@ const me = (t) => {
633
633
  return { baseKey: t.substring(0, t.length - 7), type: "values" };
634
634
  throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
635
635
  };
636
- function St(t) {
636
+ function xt(t) {
637
637
  if (!t) return;
638
638
  const e = t.resourceType.name, n = t.getDataAsJson(), r = [];
639
639
  let i = 0;
@@ -679,7 +679,7 @@ function St(t) {
679
679
  }
680
680
  return { data: r, keyLength: i };
681
681
  }
682
- function _t(t) {
682
+ function Ct(t) {
683
683
  if (t.type !== "JsonPartitioned" && t.type !== "BinaryPartitioned")
684
684
  throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${t.type}`);
685
685
  const { parts: e, partitionKeyLength: n } = t, r = [];
@@ -698,11 +698,11 @@ function _t(t) {
698
698
  }
699
699
  return r.map((i) => Array.from(i.values()));
700
700
  }
701
- function It(t) {
701
+ function Pt(t) {
702
702
  if (t === void 0) return;
703
- if (Ee(t))
704
- return _t(t);
705
- const e = St(t);
703
+ if (Le(t))
704
+ return Ct(t);
705
+ const e = xt(t);
706
706
  if (!e) return;
707
707
  const { data: n, keyLength: r } = e, i = [];
708
708
  for (let s = 0; s < r; ++s)
@@ -813,15 +813,15 @@ function ye(t, e = []) {
813
813
  throw new Error(`Unknown resource type: ${n}`);
814
814
  }
815
815
  }
816
- function Tt(t) {
816
+ function St(t) {
817
817
  if (t !== void 0) {
818
- if (Ee(t)) return t;
819
- if (Ae(t)) return Ze(t);
820
- if (t instanceof O) return ye(t);
818
+ if (Le(t)) return t;
819
+ if (we(t)) return Ye(t);
820
+ if (t instanceof E) return ye(t);
821
821
  throw new Error(`Unexpected input type: ${typeof t}`);
822
822
  }
823
823
  }
824
- function Lt(t, e) {
824
+ function _t(t, e) {
825
825
  const n = [...e].sort((s, o) => o[0] - s[0]);
826
826
  if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
827
827
  const { partitionKeyLength: s } = t;
@@ -881,7 +881,13 @@ function Lt(t, e) {
881
881
  }
882
882
  }
883
883
  }
884
- class Et {
884
+ function It(t) {
885
+ if (!Array.isArray(t)) return !1;
886
+ if (t.length === 0) return !0;
887
+ const e = t[0];
888
+ return typeof e == "object" && e !== null && "key" in e && "val" in e;
889
+ }
890
+ class Tt {
885
891
  constructor(e) {
886
892
  this.columns = e;
887
893
  }
@@ -890,30 +896,30 @@ class Et {
890
896
  return this.columns.filter((r) => n(r.spec));
891
897
  }
892
898
  }
893
- function Ot(t) {
899
+ function Lt(t) {
894
900
  if (t)
895
901
  return t.map((e) => ({
896
- type: `split:${rt(e.axisId)}`,
902
+ type: `split:${et(e.axisId)}`,
897
903
  label: e.label,
898
904
  importance: 1e6
899
905
  // High importance for split filters in labels
900
906
  }));
901
907
  }
902
- function kt(t) {
908
+ function Et(t) {
903
909
  if (t)
904
910
  return t.map((e) => [e.axisIdx, e.value]);
905
911
  }
906
- function Ft(t, e) {
912
+ function Ot(t, e) {
907
913
  if (!e || e.length === 0) return t;
908
914
  const n = [...e].sort((r, i) => r[0] - i[0]);
909
- return ke({ id: t, axisFilters: n });
915
+ return Oe({ id: t, axisFilters: n });
910
916
  }
911
- function _e(t) {
917
+ function Se(t) {
912
918
  if (!t || typeof t != "object") return !1;
913
919
  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);
914
920
  return !!e.domainAnchor || n || r;
915
921
  }
916
- function Rt(t) {
922
+ function kt(t) {
917
923
  if (typeof t != "object" || !("axes" in t) || t.axes === void 0)
918
924
  return [];
919
925
  const e = t.axes.map((n, r) => typeof n == "object" && "split" in n && n.split === !0 ? r : -1).filter((n) => n !== -1);
@@ -921,11 +927,11 @@ function Rt(t) {
921
927
  throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");
922
928
  return e.sort((n, r) => n - r), e;
923
929
  }
924
- class ve {
930
+ class le {
925
931
  constructor() {
926
- F(this, "defaultProviderStore", []);
927
- F(this, "providers", [new Et(this.defaultProviderStore)]);
928
- F(this, "axisLabelProviders", []);
932
+ k(this, "defaultProviderStore", []);
933
+ k(this, "providers", [new Tt(this.defaultProviderStore)]);
934
+ k(this, "axisLabelProviders", []);
929
935
  }
930
936
  addColumnProvider(e) {
931
937
  return this.providers.push(e), this;
@@ -953,124 +959,126 @@ class ve {
953
959
  };
954
960
  let u = () => !1;
955
961
  if (a) {
956
- const c = (Array.isArray(a) ? a : [a]).map((g) => {
957
- if (_e(g)) {
962
+ const d = (Array.isArray(a) ? a : [a]).map((h) => {
963
+ if (Se(h)) {
958
964
  if (!r)
959
965
  throw new Error("Anchored selectors in exclude require an AnchoredIdDeriver to be provided in options.");
960
- return X(xe(r.anchors, g, n));
966
+ return X(Ae(r.anchors, h, n));
961
967
  } else
962
- return X(g);
968
+ return X(h);
963
969
  });
964
- u = (g) => c.some((x) => x(g));
970
+ u = (h) => d.some((b) => b(h));
965
971
  }
966
- const d = typeof e == "function" ? [e] : Array.isArray(e) ? e : [e], y = [], b = /* @__PURE__ */ new Set();
967
- for (const c of d) {
968
- const g = _e(c);
969
- let x;
970
- if (g) {
972
+ const c = typeof e == "function" ? [e] : Array.isArray(e) ? e : [e], m = [], v = /* @__PURE__ */ new Set();
973
+ for (const d of c) {
974
+ const h = Se(d);
975
+ let b;
976
+ if (h) {
971
977
  if (!r)
972
978
  throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");
973
- x = xe(r.anchors, c, n);
979
+ b = Ae(r.anchors, d, n);
974
980
  } else
975
- x = c;
976
- const p = /* @__PURE__ */ new Set(), A = [];
977
- for (const C of this.providers) {
978
- const L = C.selectColumns(x);
979
- for (const S of L) {
980
- if (u(S.spec)) continue;
981
- if (p.has(S.id))
982
- throw new Error(`Duplicate column id ${S.id} in provider ${C.constructor.name}`);
983
- const R = et(S.spec);
984
- b.has(R) || (p.add(S.id), b.add(R), A.push(S));
981
+ b = d;
982
+ const p = /* @__PURE__ */ new Set(), I = [];
983
+ for (const A of this.providers) {
984
+ const T = A.selectColumns(b);
985
+ for (const P of T) {
986
+ if (u(P.spec)) continue;
987
+ if (p.has(P.id))
988
+ throw new Error(`Duplicate column id ${P.id} in provider ${A.constructor.name}`);
989
+ const R = Xe(P.spec);
990
+ v.has(R) || (p.add(P.id), v.add(R), I.push(P));
985
991
  }
986
992
  }
987
- if (A.length === 0) continue;
988
- const m = Rt(c), v = m.length > 0;
989
- for (const C of A) {
990
- if (!ne(C.spec)) continue;
991
- const L = C.spec;
992
- if (v) {
993
- const S = Tt(C.data);
994
- if (!S) {
993
+ if (I.length === 0) continue;
994
+ const x = kt(d), y = x.length > 0;
995
+ for (const A of I) {
996
+ if (!ne(A.spec)) continue;
997
+ const T = A.spec;
998
+ if (y) {
999
+ if (It(A.data))
1000
+ throw new Error(`Splitting is not supported for PColumns with PColumnValues data format. Column id: ${A.id}`);
1001
+ const P = St(A.data);
1002
+ if (!P) {
995
1003
  if (s) continue;
996
1004
  return;
997
1005
  }
998
- if (!tt(S))
999
- throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${S.type} for column ${C.id}`);
1000
- const R = It(S), k = m[m.length - 1];
1001
- if (k >= S.partitionKeyLength)
1002
- throw new Error(`Not enough partition keys (${S.partitionKeyLength}) for requested split axes (max index ${k}) in column ${L.name}`);
1003
- const W = m.map((_) => this.findLabels(T(L.axesSpec[_]))), V = [], N = (_, G) => {
1004
- if (G >= m.length) {
1005
- if (V.push([..._]), V.length > 1e4)
1006
+ if (!Qe(P))
1007
+ throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${P.type} for column ${A.id}`);
1008
+ const R = Pt(P), O = x[x.length - 1];
1009
+ if (O >= P.partitionKeyLength)
1010
+ throw new Error(`Not enough partition keys (${P.partitionKeyLength}) for requested split axes (max index ${O}) in column ${T.name}`);
1011
+ const W = x.map((S) => this.findLabels(D(T.axesSpec[S]))), V = [], $ = (S, G) => {
1012
+ if (G >= x.length) {
1013
+ if (V.push([...S]), V.length > 1e4)
1006
1014
  throw new Error("Too many key combinations, aborting.");
1007
1015
  return;
1008
1016
  }
1009
- const $ = m[G];
1010
- if ($ >= R.length)
1011
- throw new Error(`Axis index ${$} out of bounds for unique keys array (length ${R.length}) during split key generation for column ${C.id}`);
1012
- const J = R[$];
1013
- if (!J || J.length === 0) {
1017
+ const j = x[G];
1018
+ if (j >= R.length)
1019
+ throw new Error(`Axis index ${j} out of bounds for unique keys array (length ${R.length}) during split key generation for column ${A.id}`);
1020
+ const N = R[j];
1021
+ if (!N || N.length === 0) {
1014
1022
  V.length = 0;
1015
1023
  return;
1016
1024
  }
1017
- for (const ee of J)
1018
- _.push(ee), N(_, G + 1), _.pop();
1025
+ for (const ee of N)
1026
+ S.push(ee), $(S, G + 1), S.pop();
1019
1027
  };
1020
- if (N([], 0), V.length === 0)
1028
+ if ($([], 0), V.length === 0)
1021
1029
  continue;
1022
- const j = [...L.axesSpec], He = m.map((_) => _);
1023
- for (let _ = m.length - 1; _ >= 0; _--)
1024
- j.splice(m[_], 1);
1025
- const qe = { ...L, axesSpec: j };
1026
- for (const _ of V) {
1027
- const G = _.map(($, J) => {
1028
- const ee = He[J], ze = T(L.axesSpec[ee]), le = W[J], Ye = (le == null ? void 0 : le[$]) ?? String($);
1029
- return { axisIdx: ee, axisId: ze, value: $, label: Ye };
1030
+ const F = [...T.axesSpec], Be = x.map((S) => S);
1031
+ for (let S = x.length - 1; S >= 0; S--)
1032
+ F.splice(x[S], 1);
1033
+ const We = { ...T, axesSpec: F };
1034
+ for (const S of V) {
1035
+ const G = S.map((j, N) => {
1036
+ const ee = Be[N], Ge = D(T.axesSpec[ee]), ue = W[N], He = (ue == null ? void 0 : ue[j]) ?? String(j);
1037
+ return { axisIdx: ee, axisId: Ge, value: j, label: He };
1030
1038
  });
1031
- y.push({
1039
+ m.push({
1032
1040
  type: "split",
1033
- originalColumn: C,
1034
- spec: L,
1035
- adjustedSpec: qe,
1036
- dataEntries: S,
1041
+ originalColumn: A,
1042
+ spec: T,
1043
+ adjustedSpec: We,
1044
+ dataEntries: P,
1037
1045
  axisFilters: G
1038
1046
  });
1039
1047
  }
1040
1048
  } else
1041
- y.push({
1049
+ m.push({
1042
1050
  type: "direct",
1043
- originalColumn: C,
1044
- spec: L,
1045
- adjustedSpec: L
1051
+ originalColumn: A,
1052
+ spec: T,
1053
+ adjustedSpec: T
1046
1054
  });
1047
1055
  }
1048
1056
  }
1049
- if (y.length === 0) return [];
1057
+ if (m.length === 0) return [];
1050
1058
  const f = Ve(
1051
- y,
1052
- (c) => ({
1053
- spec: c.spec,
1054
- suffixTrace: c.type === "split" ? Ot(c.axisFilters) : void 0
1059
+ m,
1060
+ (d) => ({
1061
+ spec: d.spec,
1062
+ suffixTrace: d.type === "split" ? Lt(d.axisFilters) : void 0
1055
1063
  }),
1056
1064
  l
1057
1065
  ), w = [];
1058
- for (const { value: c, label: g } of f) {
1059
- const { originalColumn: x, spec: p } = c, A = c.type === "split" ? c.axisFilters : void 0, m = kt(A);
1060
- let v;
1061
- r ? v = r.deriveS(p, m) : v = Ft(x.id, m);
1062
- let C = { ...c.adjustedSpec };
1063
- o && (C = {
1064
- ...C,
1066
+ for (const { value: d, label: h } of f) {
1067
+ const { originalColumn: b, spec: p } = d, I = d.type === "split" ? d.axisFilters : void 0, x = Et(I);
1068
+ let y;
1069
+ r ? y = r.deriveS(p, x) : y = Ot(b.id, x);
1070
+ let A = { ...d.adjustedSpec };
1071
+ o && (A = {
1072
+ ...A,
1065
1073
  annotations: {
1066
- ...C.annotations ?? {},
1067
- "pl7.app/label": g
1074
+ ...A.annotations ?? {},
1075
+ "pl7.app/label": h
1068
1076
  }
1069
1077
  }), w.push({
1070
- id: v,
1071
- spec: C,
1072
- data: () => c.type === "split" ? nt(Lt(c.dataEntries, m)) : c.originalColumn.data,
1073
- label: g
1078
+ id: y,
1079
+ spec: A,
1080
+ data: () => d.type === "split" ? Ze(_t(d.dataEntries, x)) : d.originalColumn.data,
1081
+ label: h
1074
1082
  });
1075
1083
  }
1076
1084
  return w;
@@ -1098,19 +1106,19 @@ class ve {
1098
1106
  return i;
1099
1107
  }
1100
1108
  }
1101
- function pe(t, e) {
1109
+ function de(t, e) {
1102
1110
  if (t === void 0) return e === void 0;
1103
1111
  if (e === void 0) return !0;
1104
1112
  for (const n in e)
1105
1113
  if (t[n] !== e[n]) return !1;
1106
1114
  return !0;
1107
1115
  }
1108
- function Ie(t) {
1109
- return we(t, (e) => e instanceof O ? e.handle : Ae(e) ? ut(e, (n) => n.handle) : e);
1116
+ function _e(t) {
1117
+ return be(t, (e) => e instanceof E ? e.handle : we(e) ? ot(e, (n) => n.handle) : e);
1110
1118
  }
1111
- class Dt {
1119
+ class Rt {
1112
1120
  constructor() {
1113
- F(this, "ctx", h());
1121
+ k(this, "ctx", g());
1114
1122
  }
1115
1123
  /**
1116
1124
  * @deprecated use getOptions()
@@ -1122,25 +1130,25 @@ class Dt {
1122
1130
  const r = typeof e == "function" ? e : X(e), i = this.getSpecs().entries.filter((a) => r(a.obj));
1123
1131
  let s = {}, o = !1;
1124
1132
  return typeof n < "u" && (typeof n == "function" ? s = n : typeof n == "object" && ("includeNativeLabel" in n || "separator" in n || "addLabelAsSuffix" in n ? s = n : (n = n, s = n.label ?? {}, o = n.refsWithEnrichments ?? !1))), typeof s == "object" ? Ve(i, (a) => a.obj, s ?? {}).map(({ value: { ref: a }, label: l }) => ({
1125
- ref: Ce(a, o),
1133
+ ref: xe(a, o),
1126
1134
  label: l
1127
1135
  })) : i.map(({ ref: a, obj: l }) => ({
1128
- ref: Ce(a, o),
1136
+ ref: xe(a, o),
1129
1137
  label: s(l, a)
1130
1138
  }));
1131
1139
  }
1132
1140
  resolveAnchorCtx(e) {
1133
- if (e instanceof Pe) return e;
1141
+ if (e instanceof Ce) return e;
1134
1142
  const n = {};
1135
1143
  for (const [r, i] of Object.entries(e))
1136
- if (it(i)) {
1144
+ if (tt(i)) {
1137
1145
  const s = this.getPColumnSpecByRef(i);
1138
1146
  if (!s)
1139
1147
  return;
1140
1148
  n[r] = s;
1141
1149
  } else
1142
1150
  n[r] = i;
1143
- return new Pe(n);
1151
+ return new Ce(n);
1144
1152
  }
1145
1153
  /**
1146
1154
  * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
@@ -1153,7 +1161,7 @@ class Dt {
1153
1161
  getAnchoredPColumns(e, n, r) {
1154
1162
  const i = this.resolveAnchorCtx(e);
1155
1163
  if (i)
1156
- return new ve().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n, {
1164
+ return new le().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n, {
1157
1165
  ...r,
1158
1166
  anchorCtx: i
1159
1167
  });
@@ -1190,7 +1198,7 @@ class Dt {
1190
1198
  getCanonicalOptions(e, n, r) {
1191
1199
  const i = this.resolveAnchorCtx(e);
1192
1200
  if (!i) return;
1193
- const s = new ve().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n, {
1201
+ const s = new le().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n, {
1194
1202
  ...r,
1195
1203
  anchorCtx: i
1196
1204
  });
@@ -1214,7 +1222,7 @@ class Dt {
1214
1222
  ref: n.ref,
1215
1223
  obj: {
1216
1224
  ...n.obj,
1217
- data: new O(n.obj.data, [n.ref.blockId, n.ref.name])
1225
+ data: new E(n.obj.data, [n.ref.blockId, n.ref.name])
1218
1226
  }
1219
1227
  }))
1220
1228
  };
@@ -1233,9 +1241,9 @@ class Dt {
1233
1241
  ref: n.ref,
1234
1242
  obj: {
1235
1243
  ...n.obj,
1236
- data: st(
1244
+ data: nt(
1237
1245
  n.obj.data,
1238
- (r) => new O(r, [n.ref.blockId, n.ref.name])
1246
+ (r) => new E(r, [n.ref.blockId, n.ref.name])
1239
1247
  )
1240
1248
  }
1241
1249
  }))
@@ -1262,9 +1270,9 @@ class Dt {
1262
1270
  )) == null ? void 0 : r.obj;
1263
1271
  const n = this.ctx.getDataFromResultPoolByRef(e.blockId, e.name);
1264
1272
  if (n)
1265
- return we(
1273
+ return be(
1266
1274
  n,
1267
- (i) => new O(i, [e.blockId, e.name])
1275
+ (i) => new E(i, [e.blockId, e.name])
1268
1276
  );
1269
1277
  }
1270
1278
  /**
@@ -1275,7 +1283,7 @@ class Dt {
1275
1283
  getPColumnByRef(e) {
1276
1284
  const n = this.getDataByRef(e);
1277
1285
  if (n)
1278
- return ot(n);
1286
+ return rt(n);
1279
1287
  }
1280
1288
  /**
1281
1289
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -1307,10 +1315,10 @@ class Dt {
1307
1315
  if (!ne(r.obj.spec))
1308
1316
  continue;
1309
1317
  const i = r.obj.spec;
1310
- if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && pe(e.domain, i.domain)) {
1318
+ if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && de(e.domain, i.domain)) {
1311
1319
  for (let s = 0; s < e.axesSpec.length; ++s) {
1312
1320
  const o = e.axesSpec[s], a = i.axesSpec[s];
1313
- if (o.name !== a.name || o.type !== a.type || !pe(o.domain, a.domain))
1321
+ if (o.name !== a.name || o.type !== a.type || !de(o.domain, a.domain))
1314
1322
  continue e;
1315
1323
  }
1316
1324
  n.push(r.obj);
@@ -1325,9 +1333,9 @@ class Dt {
1325
1333
  findLabels(e) {
1326
1334
  const n = this.getData();
1327
1335
  for (const r of n.entries) {
1328
- if (!be(r.obj)) continue;
1336
+ if (!Te(r.obj)) continue;
1329
1337
  const i = r.obj.spec;
1330
- if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && pe(e.domain, i.axesSpec[0].domain)) {
1338
+ if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && de(e.domain, i.axesSpec[0].domain)) {
1331
1339
  if (r.obj.data.resourceType.name !== "PColumnData/Json")
1332
1340
  throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
1333
1341
  return Object.fromEntries(
@@ -1352,7 +1360,7 @@ class Dt {
1352
1360
  let a = null;
1353
1361
  const l = this;
1354
1362
  return {
1355
- id: ke(i),
1363
+ id: Oe(i),
1356
1364
  spec: o,
1357
1365
  get data() {
1358
1366
  var u;
@@ -1379,13 +1387,13 @@ class Dt {
1379
1387
  }
1380
1388
  class te {
1381
1389
  constructor() {
1382
- F(this, "ctx");
1383
- F(this, "args");
1384
- F(this, "uiState");
1390
+ k(this, "ctx");
1391
+ k(this, "args");
1392
+ k(this, "uiState");
1385
1393
  // lazy rendering because this feature is rarely used
1386
- F(this, "_activeArgsCache");
1387
- F(this, "resultPool", new Dt());
1388
- this.ctx = h(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
1394
+ k(this, "_activeArgsCache");
1395
+ k(this, "resultPool", new Rt());
1396
+ this.ctx = g(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
1389
1397
  }
1390
1398
  /**
1391
1399
  * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
@@ -1403,14 +1411,14 @@ class te {
1403
1411
  getNamedAccessor(e) {
1404
1412
  return he(
1405
1413
  this.ctx.getAccessorHandleByName(e),
1406
- (n) => new O(n, [e])
1414
+ (n) => new E(n, [e])
1407
1415
  );
1408
1416
  }
1409
1417
  get prerun() {
1410
1418
  return this.getNamedAccessor(De);
1411
1419
  }
1412
1420
  get outputs() {
1413
- return this.getNamedAccessor(Ke);
1421
+ return this.getNamedAccessor(Fe);
1414
1422
  }
1415
1423
  /**
1416
1424
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
@@ -1422,13 +1430,13 @@ class te {
1422
1430
  }
1423
1431
  verifyInlineAndExplicitColumnsSupport(e) {
1424
1432
  var i;
1425
- const n = e.some((s) => !(s.data instanceof O) || Ae(s.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === !0;
1433
+ const n = e.some((s) => !(s.data instanceof E) || we(s.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === !0;
1426
1434
  if (n && !r) throw Error("Inline or explicit columns not supported");
1427
1435
  }
1428
1436
  // TODO remove all non-PColumn fields
1429
1437
  createPFrame(e) {
1430
1438
  return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
1431
- e.map((n) => Ie(n))
1439
+ e.map((n) => _e(n))
1432
1440
  );
1433
1441
  }
1434
1442
  createPTable(e) {
@@ -1440,8 +1448,8 @@ class te {
1440
1448
  },
1441
1449
  filters: e.filters ?? [],
1442
1450
  sorting: e.sorting ?? []
1443
- } : n = e, this.verifyInlineAndExplicitColumnsSupport(at(n.src)), this.ctx.createPTable(
1444
- lt(n, (r) => Ie(r))
1451
+ } : n = e, this.verifyInlineAndExplicitColumnsSupport(it(n.src)), this.ctx.createPTable(
1452
+ st(n, (r) => _e(r))
1445
1453
  );
1446
1454
  }
1447
1455
  /** @deprecated scheduled for removal from SDK */
@@ -1461,19 +1469,19 @@ class te {
1461
1469
  this.ctx.logError(e);
1462
1470
  }
1463
1471
  }
1464
- const Y = "1.33.8";
1465
- function Kt(t) {
1472
+ const Y = "1.33.14";
1473
+ function Dt(t) {
1466
1474
  return t.__renderLambda === !0;
1467
1475
  }
1468
- function de(t) {
1476
+ function pe(t) {
1469
1477
  if (t !== void 0)
1470
- return Kt(t) ? t.handle : t;
1478
+ return Dt(t) ? t.handle : t;
1471
1479
  }
1472
- function U(t) {
1480
+ function J(t) {
1473
1481
  if (t !== void 0)
1474
1482
  return typeof t == "string" ? { __renderLambda: !0, handle: t, retentive: !1 } : t;
1475
1483
  }
1476
- function kn(t) {
1484
+ function En(t) {
1477
1485
  if (t.v3 !== void 0) {
1478
1486
  const {
1479
1487
  initialArgs: e,
@@ -1485,7 +1493,7 @@ function kn(t) {
1485
1493
  sections: a,
1486
1494
  title: l,
1487
1495
  enrichmentTargets: u
1488
- } = t.v3, { code: d } = t;
1496
+ } = t.v3, { code: c } = t;
1489
1497
  return {
1490
1498
  initialArgs: e,
1491
1499
  initialUiState: n,
@@ -1495,7 +1503,7 @@ function kn(t) {
1495
1503
  sdkVersion: o,
1496
1504
  sections: a,
1497
1505
  title: l,
1498
- code: d,
1506
+ code: c,
1499
1507
  enrichmentTargets: u
1500
1508
  };
1501
1509
  } else if (t.inputsValid !== void 0) {
@@ -1509,10 +1517,10 @@ function kn(t) {
1509
1517
  renderingMode: n,
1510
1518
  initialArgs: o,
1511
1519
  outputs: Object.fromEntries(
1512
- Object.entries(r).map(([u, d]) => [u, U(d)])
1520
+ Object.entries(r).map(([u, c]) => [u, J(c)])
1513
1521
  ),
1514
- inputsValid: U(i),
1515
- sections: U(s),
1522
+ inputsValid: J(i),
1523
+ sections: J(s),
1516
1524
  initialUiState: void 0,
1517
1525
  code: a
1518
1526
  };
@@ -1527,10 +1535,10 @@ function kn(t) {
1527
1535
  renderingMode: r,
1528
1536
  initialArgs: o,
1529
1537
  outputs: Object.fromEntries(
1530
- Object.entries(i).map(([u, d]) => [u, U(d)])
1538
+ Object.entries(i).map(([u, c]) => [u, J(c)])
1531
1539
  ),
1532
- inputsValid: U(n),
1533
- sections: U(s),
1540
+ inputsValid: J(n),
1541
+ sections: J(s),
1534
1542
  initialUiState: void 0,
1535
1543
  code: a
1536
1544
  };
@@ -1541,12 +1549,12 @@ function kn(t) {
1541
1549
  );
1542
1550
  }
1543
1551
  }
1544
- class E {
1552
+ class L {
1545
1553
  constructor(e, n, r, i, s, o, a, l) {
1546
1554
  this._renderingMode = e, this._initialArgs = n, this._initialUiState = r, this._outputs = i, this._inputsValid = s, this._sections = o, this._title = a, this._enrichmentTargets = l;
1547
1555
  }
1548
1556
  static create(e = "Heavy") {
1549
- return new E(
1557
+ return new L(
1550
1558
  e,
1551
1559
  void 0,
1552
1560
  {},
@@ -1560,7 +1568,7 @@ class E {
1560
1568
  output(e, n, r = {}) {
1561
1569
  if (typeof n == "function") {
1562
1570
  const i = `output#${e}`;
1563
- return H(i, () => n(new te())), new E(
1571
+ return H(i, () => n(new te())), new L(
1564
1572
  this._renderingMode,
1565
1573
  this._initialArgs,
1566
1574
  this._initialUiState,
@@ -1578,7 +1586,7 @@ class E {
1578
1586
  this._enrichmentTargets
1579
1587
  );
1580
1588
  } else
1581
- return new E(
1589
+ return new L(
1582
1590
  this._renderingMode,
1583
1591
  this._initialArgs,
1584
1592
  this._initialUiState,
@@ -1597,7 +1605,7 @@ class E {
1597
1605
  return this.output(e, n, { retentive: !0 });
1598
1606
  }
1599
1607
  argsValid(e) {
1600
- return typeof e == "function" ? (H("inputsValid", () => e(new te())), new E(
1608
+ return typeof e == "function" ? (H("inputsValid", () => e(new te())), new L(
1601
1609
  this._renderingMode,
1602
1610
  this._initialArgs,
1603
1611
  this._initialUiState,
@@ -1609,7 +1617,7 @@ class E {
1609
1617
  this._sections,
1610
1618
  this._title,
1611
1619
  this._enrichmentTargets
1612
- )) : new E(
1620
+ )) : new L(
1613
1621
  this._renderingMode,
1614
1622
  this._initialArgs,
1615
1623
  this._initialUiState,
@@ -1621,7 +1629,7 @@ class E {
1621
1629
  );
1622
1630
  }
1623
1631
  sections(e) {
1624
- return Array.isArray(e) ? this.sections(re(e)) : typeof e == "function" ? (H("sections", () => e(new te())), new E(
1632
+ return Array.isArray(e) ? this.sections(re(e)) : typeof e == "function" ? (H("sections", () => e(new te())), new L(
1625
1633
  this._renderingMode,
1626
1634
  this._initialArgs,
1627
1635
  this._initialUiState,
@@ -1630,7 +1638,7 @@ class E {
1630
1638
  { __renderLambda: !0, handle: "sections" },
1631
1639
  this._title,
1632
1640
  this._enrichmentTargets
1633
- )) : new E(
1641
+ )) : new L(
1634
1642
  this._renderingMode,
1635
1643
  this._initialArgs,
1636
1644
  this._initialUiState,
@@ -1643,7 +1651,7 @@ class E {
1643
1651
  }
1644
1652
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
1645
1653
  title(e) {
1646
- return H("title", () => e(new te())), new E(
1654
+ return H("title", () => e(new te())), new L(
1647
1655
  this._renderingMode,
1648
1656
  this._initialArgs,
1649
1657
  this._initialUiState,
@@ -1659,7 +1667,7 @@ class E {
1659
1667
  * @deprecated use {@link withArgs}
1660
1668
  * */
1661
1669
  initialArgs(e) {
1662
- return new E(
1670
+ return new L(
1663
1671
  this._renderingMode,
1664
1672
  e,
1665
1673
  this._initialUiState,
@@ -1672,7 +1680,7 @@ class E {
1672
1680
  }
1673
1681
  /** Sets initial args for the block, this value must be specified. */
1674
1682
  withArgs(e) {
1675
- return new E(
1683
+ return new L(
1676
1684
  this._renderingMode,
1677
1685
  e,
1678
1686
  this._initialUiState,
@@ -1685,7 +1693,7 @@ class E {
1685
1693
  }
1686
1694
  /** Defines type and sets initial value for block UiState. */
1687
1695
  withUiState(e) {
1688
- return new E(
1696
+ return new L(
1689
1697
  this._renderingMode,
1690
1698
  this._initialArgs,
1691
1699
  e,
@@ -1701,7 +1709,7 @@ class E {
1701
1709
  * Influences dependency graph construction.
1702
1710
  */
1703
1711
  enriches(e) {
1704
- return H("enrichmentTargets", e), new E(
1712
+ return H("enrichmentTargets", e), new L(
1705
1713
  this._renderingMode,
1706
1714
  this._initialArgs,
1707
1715
  this._initialUiState,
@@ -1733,224 +1741,75 @@ class E {
1733
1741
  sdkVersion: Y,
1734
1742
  renderingMode: this._renderingMode,
1735
1743
  initialArgs: this._initialArgs,
1736
- inputsValid: de(this._inputsValid),
1737
- sections: de(this._sections),
1744
+ inputsValid: pe(this._inputsValid),
1745
+ sections: pe(this._sections),
1738
1746
  outputs: Object.fromEntries(
1739
- Object.entries(this._outputs).map(([n, r]) => [n, de(r)])
1747
+ Object.entries(this._outputs).map(([n, r]) => [n, pe(r)])
1740
1748
  )
1741
1749
  };
1742
- return ht() ? Re({ sdkVersion: Y }) : { config: e };
1743
- }
1744
- }
1745
- const jt = (t, e) => {
1746
- let n = t.toString();
1747
- return e == null || e.forEach((r) => {
1748
- if (r)
1749
- for (const [i, s] of Object.entries(r))
1750
- n += i, n += s;
1751
- }), n;
1752
- };
1753
- function Vt(t) {
1754
- if (!t.length)
1755
- return [];
1756
- let e = [[]];
1757
- return t.forEach((n) => {
1758
- const r = [];
1759
- n.forEach((i) => {
1760
- r.push(...e.map((s) => [...s, i]));
1761
- }), e = r;
1762
- }), e;
1763
- }
1764
- function $t(t) {
1765
- var e;
1766
- return t.axesSpec.length === 2 && ((e = t.annotations) == null ? void 0 : e[Mt]) === "true";
1767
- }
1768
- function Nt(t) {
1769
- var n, r;
1770
- const e = /* @__PURE__ */ new Map();
1771
- for (const { id: i, spec: s } of t) {
1772
- const [o, a] = s.axesSpec.map(T).map(D);
1773
- e.has(o) || e.set(o, /* @__PURE__ */ new Map()), e.has(a) || e.set(a, /* @__PURE__ */ new Map()), (n = e.get(o)) == null || n.set(a, { columnId: i, spec: s }), (r = e.get(a)) == null || r.set(o, { columnId: i, spec: s });
1774
- }
1775
- return e;
1776
- }
1777
- function Je(t, e, n) {
1778
- var l;
1779
- const i = [...t.keys()].map(fe).find((u) => K(e, u));
1780
- if (!i) return !1;
1781
- const s = D(T(i)), o = /* @__PURE__ */ new Set([s]);
1782
- let a = [s];
1783
- for (; a.length; ) {
1784
- const u = [];
1785
- for (const d of a)
1786
- for (const y of ((l = t.get(d)) == null ? void 0 : l.keys()) ?? []) {
1787
- const b = fe(y);
1788
- if (K(n, b)) return !0;
1789
- o.has(y) || (u.push(y), o.add(y));
1790
- }
1791
- a = u;
1792
- }
1793
- return !1;
1794
- }
1795
- function Jt(t, e, n) {
1796
- const r = t.axesSpec.map(T), i = e.axesSpec.map(T);
1797
- return i.some((s) => r.some((o) => K(o, s) && K(s, o))) || !!n && i.some((s) => r.some((o) => Je(n, o, s)));
1798
- }
1799
- function Ue(t, e, n) {
1800
- const r = t.axesSpec.map(T), i = e.axesSpec.map(T);
1801
- return i.some((s) => r.some((o) => K(o, s))) || !!n && i.some((s) => r.some((o) => Je(n, o, s)));
1802
- }
1803
- const Ut = "pl7.app/graph/isVirtual", Te = "pl7.app/label", Mt = "pl7.app/isLinkerColumn";
1804
- function Le(t, e, n) {
1805
- const r = t.spec.axesSpec.map(T), i = e.spec.axesSpec.map(T);
1806
- if (Jt(t.spec, e.spec, n))
1807
- return [];
1808
- if (!Ue(t.spec, e.spec, n))
1809
- return [];
1810
- const a = i.map((b) => r.filter((f) => K(f, b))), l = Vt(a), u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), y = l.map((b) => {
1811
- const f = /* @__PURE__ */ new Set();
1812
- return b.map((w, c) => {
1813
- const g = e.spec.axesSpec[c].domain, x = w.domain;
1814
- return Object.entries(x ?? {}).forEach(([p, A]) => {
1815
- if ((g == null ? void 0 : g[p]) === void 0) {
1816
- const m = JSON.stringify([p, A]);
1817
- f.add(m), u.add(m);
1818
- }
1819
- }), {
1820
- ...w,
1821
- annotations: e.spec.axesSpec[c].annotations
1822
- };
1823
- }), f;
1824
- });
1825
- return [...u].forEach((b) => {
1826
- y.some((f) => !f.has(b)) && d.add(b);
1827
- }), l.map((b, f) => {
1828
- var p;
1829
- const w = jt(e.id, b.map((A) => A.domain)), c = ((p = e.spec.annotations) == null ? void 0 : p[Te]) ?? "", g = [...y[f]].filter((A) => d.has(A)).sort().map((A) => {
1830
- var m;
1831
- return (m = JSON.parse(A)) == null ? void 0 : m[1];
1832
- }).join(" / "), x = {
1833
- ...e.spec.annotations,
1834
- [Ut]: "true"
1835
- };
1836
- return (c || g) && (x[Te] = c && g ? c + " / " + g : c + g), {
1837
- id: w,
1838
- spec: {
1839
- ...e.spec,
1840
- axesSpec: b.map((A, m) => ({
1841
- ...A,
1842
- annotations: e.spec.axesSpec[m].annotations
1843
- })),
1844
- annotations: x
1845
- },
1846
- data: e.data
1847
- };
1848
- });
1849
- }
1850
- function Fn(t, e = /* @__PURE__ */ new Map()) {
1851
- const n = [];
1852
- for (let r = 0; r < t.length; r++)
1853
- for (let i = r + 1; i < t.length; i++) {
1854
- const s = t[r], o = t[i];
1855
- n.push(
1856
- ...Le(s, o, e),
1857
- ...Le(o, s, e)
1858
- );
1859
- }
1860
- return n;
1861
- }
1862
- function Bt(t, e, n = [], r = /* @__PURE__ */ new Map()) {
1863
- const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
1864
- t.forEach((a) => {
1865
- i.add(a.id), s.set(D(ue(a.spec)), a);
1866
- });
1867
- const o = /* @__PURE__ */ new Map();
1868
- for (const a of e) {
1869
- if (i.has(a.id)) continue;
1870
- const l = D(ue(a.spec));
1871
- if (!s.has(l)) {
1872
- for (const u of s.values())
1873
- if (Ue(u.spec, a.spec, r)) {
1874
- o.set(l, a);
1875
- break;
1876
- }
1877
- }
1750
+ return dt() ? Re({ sdkVersion: Y }) : { config: e };
1878
1751
  }
1879
- for (const a of n) {
1880
- if (i.has(a.id)) continue;
1881
- const l = D(ue(a.spec));
1882
- s.has(l) || o.has(l) || (i.add(a.id), s.set(l, a));
1883
- }
1884
- return [...s.values(), ...o.values()];
1885
1752
  }
1886
- function Rn(t, e) {
1887
- if (!e) return;
1888
- const n = t.resultPool.getData().entries.map((l) => l.obj).filter(be), i = [...e, ...n].filter((l) => $t(l.spec)), s = Nt(i), a = [...Bt(e, n, i, s)];
1889
- if (!a.some(
1890
- (l) => l.data instanceof O && !l.data.getIsReadyOrError()
1891
- ))
1892
- return t.createPFrame(a);
1893
- }
1894
- function Dn(t) {
1753
+ function On(t) {
1895
1754
  const e = t.type;
1896
1755
  switch (e) {
1897
1756
  case "axis":
1898
- return D(t);
1757
+ return K(t);
1899
1758
  case "column":
1900
- return D(t);
1759
+ return K(t);
1901
1760
  default:
1902
1761
  throw Error(`unsupported column type: ${e}`);
1903
1762
  }
1904
1763
  }
1905
- function Wt(t) {
1764
+ function ve(t) {
1906
1765
  return t.axesSpec.length === 1 && t.name === "pl7.app/label";
1907
1766
  }
1908
- function Me(t) {
1909
- return new ve().addAxisLabelProvider(t).addColumnProvider(t).getColumns({
1767
+ function Ne(t) {
1768
+ return new le().addAxisLabelProvider(t).addColumnProvider(t).getColumns({
1910
1769
  name: "pl7.app/label",
1911
1770
  axes: [{}]
1912
1771
  // exactly one axis
1913
1772
  }, { dontWaitAllData: !0 });
1914
1773
  }
1915
- function Be(t, e) {
1774
+ function Je(t, e) {
1916
1775
  const n = [], r = [];
1917
1776
  for (const a of t)
1918
- Wt(a.spec) ? n.push(a) : r.push(a);
1777
+ ve(a.spec) ? n.push(a) : r.push(a);
1919
1778
  const i = [];
1920
1779
  for (const a of r)
1921
1780
  for (const l of a.spec.axesSpec) {
1922
- const u = T(l);
1923
- i.some((d) => K(d, u)) || i.push(u);
1781
+ const u = D(l);
1782
+ i.some((c) => U(c, u)) || i.push(u);
1924
1783
  }
1925
1784
  for (const a of n) {
1926
- const l = T(a.spec.axesSpec[0]), u = i.findIndex((d) => K(d, l));
1785
+ const l = D(a.spec.axesSpec[0]), u = i.findIndex((c) => U(c, l));
1927
1786
  u !== -1 && i.splice(u, 1);
1928
1787
  }
1929
1788
  const s = (a, l) => {
1930
1789
  let u = a.toString();
1931
1790
  if (l)
1932
- for (const d in l)
1933
- u += d, u += l[d];
1791
+ for (const c in l)
1792
+ u += c, u += l[c];
1934
1793
  return u;
1935
1794
  }, o = [];
1936
1795
  for (const a of e) {
1937
- const l = a.spec.axesSpec[0], u = T(l), d = i.findIndex((y) => K(y, u));
1938
- if (d !== -1) {
1939
- const y = i[d], b = Object.keys(y.domain ?? {}).length, f = Object.keys(l.domain ?? {}).length;
1940
- b > f ? o.push({
1941
- id: s(a.id, y.domain),
1796
+ const l = a.spec.axesSpec[0], u = D(l), c = i.findIndex((m) => U(m, u));
1797
+ if (c !== -1) {
1798
+ const m = i[c], v = Object.keys(m.domain ?? {}).length, f = Object.keys(l.domain ?? {}).length;
1799
+ v > f ? o.push({
1800
+ id: s(a.id, m.domain),
1942
1801
  spec: {
1943
1802
  ...a.spec,
1944
- axesSpec: [{ ...y, annotations: l.annotations }]
1803
+ axesSpec: [{ ...m, annotations: l.annotations }]
1945
1804
  },
1946
1805
  data: a.data
1947
- }) : o.push(a), i.splice(d, 1);
1806
+ }) : o.push(a), i.splice(c, 1);
1948
1807
  }
1949
1808
  }
1950
1809
  return o;
1951
1810
  }
1952
- function We(t) {
1953
- const e = (i) => Array.isArray(i), n = (i) => i instanceof O, r = (i) => typeof i == "object" && "type" in i;
1811
+ function Me(t) {
1812
+ const e = (i) => Array.isArray(i), n = (i) => i instanceof E, r = (i) => typeof i == "object" && "type" in i;
1954
1813
  return t.map((i) => i.data).every((i) => {
1955
1814
  if (e(i))
1956
1815
  return !0;
@@ -1969,7 +1828,7 @@ function We(t) {
1969
1828
  throw Error(`unsupported column data type: ${i}`);
1970
1829
  });
1971
1830
  }
1972
- function Ge(t, e, n, r, i, s) {
1831
+ function Ue(t, e, n, r, i, s) {
1973
1832
  let o = t;
1974
1833
  const a = [];
1975
1834
  if (s) {
@@ -1990,42 +1849,42 @@ function Ge(t, e, n, r, i, s) {
1990
1849
  sorting: i
1991
1850
  };
1992
1851
  }
1993
- function Kn(t, e, n, r) {
1994
- var u, d;
1852
+ function kn(t, e, n, r) {
1853
+ var u, c;
1995
1854
  Array.isArray(r) && (r = { filters: r });
1996
- const i = (r == null ? void 0 : r.coreJoinType) ?? "full", s = [...(r == null ? void 0 : r.filters) ?? [], ...((u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.filters) ?? []], o = ((d = n == null ? void 0 : n.pTableParams) == null ? void 0 : d.sorting) ?? [], a = Me(t.resultPool);
1855
+ const i = (r == null ? void 0 : r.coreJoinType) ?? "full", s = [...(r == null ? void 0 : r.filters) ?? [], ...((u = n == null ? void 0 : n.pTableParams) == null ? void 0 : u.filters) ?? []], o = ((c = n == null ? void 0 : n.pTableParams) == null ? void 0 : c.sorting) ?? [], a = Ne(t.resultPool);
1997
1856
  if (!a) return;
1998
- const l = Be(e.map(Oe), a);
1999
- if (We([...e, ...l]))
1857
+ const l = Je(e.map(Ee), a);
1858
+ if (Me([...e, ...l]))
2000
1859
  return t.createPTable(
2001
- Ge(e, l, i, s, o, r == null ? void 0 : r.coreColumnPredicate)
1860
+ Ue(e, l, i, s, o, r == null ? void 0 : r.coreColumnPredicate)
2002
1861
  );
2003
1862
  }
2004
- function Gt(t) {
1863
+ function Ft(t) {
2005
1864
  var e;
2006
1865
  return ((e = t.annotations) == null ? void 0 : e["pl7.app/table/visibility"]) === "hidden";
2007
1866
  }
2008
- function Ht(t) {
1867
+ function Kt(t) {
2009
1868
  var e;
2010
1869
  return ((e = t.annotations) == null ? void 0 : e["pl7.app/table/visibility"]) === "optional";
2011
1870
  }
2012
- function jn(t, e, n, r, i) {
2013
- var g, x;
2014
- const s = (i == null ? void 0 : i.coreJoinType) ?? "full", o = [...(i == null ? void 0 : i.filters) ?? [], ...((g = r == null ? void 0 : r.pTableParams) == null ? void 0 : g.filters) ?? []], a = ((x = r == null ? void 0 : r.pTableParams) == null ? void 0 : x.sorting) ?? [], l = e.filter((p) => !Gt(p.spec)), u = l.find((p) => n(p.spec));
1871
+ function Rn(t, e, n, r, i) {
1872
+ var h, b;
1873
+ const s = (i == null ? void 0 : i.coreJoinType) ?? "full", o = [...(i == null ? void 0 : i.filters) ?? [], ...((h = r == null ? void 0 : r.pTableParams) == null ? void 0 : h.filters) ?? []], a = ((b = r == null ? void 0 : r.pTableParams) == null ? void 0 : b.sorting) ?? [], l = e.filter((p) => !Ft(p.spec)), u = l.find((p) => n(p.spec));
2015
1874
  if (!u) return;
2016
- const d = Me(t.resultPool);
2017
- if (!d) return;
2018
- const y = new Set((() => {
2019
- var A, m;
1875
+ const c = Ne(t.resultPool);
1876
+ if (!c) return;
1877
+ const m = new Set((() => {
1878
+ var I, x;
2020
1879
  if (s === "inner") return [];
2021
- const p = (m = (A = r == null ? void 0 : r.gridState.columnVisibility) == null ? void 0 : A.hiddenColIds) == null ? void 0 : m.map(fe).filter((v) => v.type === "column").map((v) => v.id);
2022
- return p || l.filter((v) => Ht(v.spec)).map((v) => v.id);
1880
+ const p = (x = (I = r == null ? void 0 : r.gridState.columnVisibility) == null ? void 0 : I.hiddenColIds) == null ? void 0 : x.map(fe).filter((y) => y.type === "column").map((y) => y.id);
1881
+ return p || l.filter((y) => Kt(y.spec)).map((y) => y.id);
2023
1882
  })());
2024
- y.delete(u.id), [...o.map((p) => p.column), ...a.map((p) => p.column)].filter((p) => p.type === "column").map((p) => y.delete(p.id));
2025
- const b = l.filter((p) => !y.has(p.id)), f = Be(b.map(Oe), d), w = [
1883
+ m.delete(u.id), [...o.map((p) => p.column), ...a.map((p) => p.column)].filter((p) => p.type === "column").map((p) => m.delete(p.id));
1884
+ const v = l.filter((p) => !m.has(p.id)), f = Je(v.map(Ee), c), w = [
2026
1885
  ...u.spec.axesSpec.map((p) => ({
2027
1886
  type: "axis",
2028
- id: T(p),
1887
+ id: D(p),
2029
1888
  spec: p
2030
1889
  })),
2031
1890
  ...[...l, ...f].map((p) => ({
@@ -2034,16 +1893,16 @@ function jn(t, e, n, r, i) {
2034
1893
  spec: p.spec
2035
1894
  }))
2036
1895
  ];
2037
- if (!We([...b, ...f])) return;
2038
- const c = t.createPTable(
2039
- Ge(l, f, s, o, a, i == null ? void 0 : i.coreColumnPredicate)
1896
+ if (!Me([...v, ...f])) return;
1897
+ const d = t.createPTable(
1898
+ Ue(l, f, s, o, a, i == null ? void 0 : i.coreColumnPredicate)
2040
1899
  );
2041
1900
  return {
2042
1901
  tableSpec: w,
2043
- tableHandle: c
1902
+ tableHandle: d
2044
1903
  };
2045
1904
  }
2046
- function Vn(t, e, n) {
1905
+ function Dn(t, e, n) {
2047
1906
  const r = t.resultPool.findLabels(e);
2048
1907
  return {
2049
1908
  axis: e,
@@ -2054,18 +1913,156 @@ function Vn(t, e, n) {
2054
1913
  defaultValue: n[0]
2055
1914
  };
2056
1915
  }
2057
- function $n(t) {
1916
+ const Vt = (t, e) => {
1917
+ let n = t.toString();
1918
+ return e == null || e.forEach((r) => {
1919
+ if (r)
1920
+ for (const [i, s] of Object.entries(r))
1921
+ n += i, n += s;
1922
+ }), n;
1923
+ };
1924
+ function jt(t) {
1925
+ if (!t.length)
1926
+ return [];
1927
+ let e = [[]];
1928
+ return t.forEach((n) => {
1929
+ const r = [];
1930
+ n.forEach((i) => {
1931
+ r.push(...e.map((s) => [...s, i]));
1932
+ }), e = r;
1933
+ }), e;
1934
+ }
1935
+ function $t(t) {
1936
+ var e;
1937
+ return t.axesSpec.length === 2 && ((e = t.annotations) == null ? void 0 : e[Jt]) === "true";
1938
+ }
1939
+ const Nt = "pl7.app/graph/isVirtual", Ie = "pl7.app/label", Jt = "pl7.app/isLinkerColumn";
1940
+ function Mt(t) {
1941
+ var n, r;
1942
+ const e = /* @__PURE__ */ new Map();
1943
+ for (const { spec: i } of t) {
1944
+ const s = i.axesSpec.map(D).map(K);
1945
+ s.forEach((o) => {
1946
+ e.has(o) || e.set(o, /* @__PURE__ */ new Set());
1947
+ });
1948
+ for (let o = 0; o < s.length - 1; o++)
1949
+ for (let a = o + 1; a < s.length; a++) {
1950
+ const l = s[o], u = s[a];
1951
+ (n = e.get(l)) == null || n.add(u), (r = e.get(u)) == null || r.add(l);
1952
+ }
1953
+ }
1954
+ return e;
1955
+ }
1956
+ function Ut(t, e) {
1957
+ const n = Mt(t), r = [...n.keys()].map(fe), i = [];
1958
+ for (const l of e.values()) {
1959
+ const u = r.find((c) => U(l, c));
1960
+ u && i.push(K(u));
1961
+ }
1962
+ const s = new Set(i), o = /* @__PURE__ */ new Map();
1963
+ let a = [...i];
1964
+ for (; a.length; ) {
1965
+ const l = [];
1966
+ for (const u of a)
1967
+ for (const c of n.get(u) ?? [])
1968
+ s.has(c) || (l.push(c), s.add(c), o.set(c, fe(c)));
1969
+ a = l;
1970
+ }
1971
+ return o;
1972
+ }
1973
+ function Bt(t, e) {
1974
+ const n = [];
1975
+ return e.forEach((r) => {
1976
+ n.push(...Wt(t, r));
1977
+ }), n;
1978
+ }
1979
+ function Wt(t, e) {
1980
+ const n = e.spec.axesSpec.map(D);
1981
+ if (n.every((u) => t.has(K(u))))
1982
+ return [e];
1983
+ const r = n.map((u) => {
1984
+ const c = [];
1985
+ for (const [m, v] of t)
1986
+ U(v, u) && !U(u, v) && c.push(v);
1987
+ return c;
1988
+ }), i = jt(r), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), a = i.map((u) => {
1989
+ const c = /* @__PURE__ */ new Set();
1990
+ return u.map((m, v) => {
1991
+ const f = e.spec.axesSpec[v].domain, w = m.domain;
1992
+ return Object.entries(w ?? {}).forEach(([d, h]) => {
1993
+ if ((f == null ? void 0 : f[d]) === void 0) {
1994
+ const b = JSON.stringify([d, h]);
1995
+ c.add(b), s.add(b);
1996
+ }
1997
+ }), {
1998
+ ...m,
1999
+ annotations: e.spec.axesSpec[v].annotations
2000
+ };
2001
+ }), c;
2002
+ });
2003
+ [...s].forEach((u) => {
2004
+ a.some((c) => !c.has(u)) && o.add(u);
2005
+ });
2006
+ const l = i.map((u, c) => {
2007
+ var d;
2008
+ const m = Vt(e.id, u.map((h) => h.domain)), v = ((d = e.spec.annotations) == null ? void 0 : d[Ie]) ?? "", f = [...a[c]].filter((h) => o.has(h)).sort().map((h) => {
2009
+ var b;
2010
+ return (b = JSON.parse(h)) == null ? void 0 : b[1];
2011
+ }).join(" / "), w = {
2012
+ ...e.spec.annotations,
2013
+ [Nt]: "true"
2014
+ };
2015
+ return (v || f) && (w[Ie] = v && f ? v + " / " + f : v + f), {
2016
+ id: m,
2017
+ spec: {
2018
+ ...e.spec,
2019
+ axesSpec: u.map((h, b) => ({
2020
+ ...h,
2021
+ annotations: e.spec.axesSpec[b].annotations
2022
+ })),
2023
+ annotations: w
2024
+ },
2025
+ data: e.data
2026
+ };
2027
+ });
2028
+ return [e, ...l];
2029
+ }
2030
+ function Fn(t, e) {
2031
+ if (!e) return;
2032
+ const n = new le();
2033
+ n.addColumnProvider(t.resultPool), n.addColumns(e);
2034
+ const r = /* @__PURE__ */ new Map();
2035
+ for (const u of e)
2036
+ for (const c of u.spec.axesSpec) {
2037
+ const m = D(c);
2038
+ r.set(K(m), m);
2039
+ }
2040
+ const i = n.getColumns((u) => $t(u)) ?? [], s = Ut(i, r), o = n.getColumns(ve) ?? [];
2041
+ for (const u of s)
2042
+ r.set(...u);
2043
+ let a = (n.getColumns([...r.values()].map((u) => ({
2044
+ axes: [u],
2045
+ partialAxesMatch: !0
2046
+ }))) ?? []).filter((u) => !ve(u.spec));
2047
+ a = a.concat(o);
2048
+ const l = Bt(r, a);
2049
+ if (!l.some(
2050
+ (u) => u.data instanceof E && !u.data.getIsReadyOrError()
2051
+ ))
2052
+ return t.createPFrame(l);
2053
+ }
2054
+ function Kn(t) {
2058
2055
  const e = t.type;
2059
2056
  switch (e) {
2060
2057
  case "axis":
2061
- return D(t);
2058
+ return K(t);
2062
2059
  case "column":
2063
- return D(t);
2060
+ return K(t);
2064
2061
  default:
2065
2062
  throw Error(`unsupported column type: ${e}`);
2066
2063
  }
2067
2064
  }
2068
- function Nn(t, e, n, r) {
2065
+ function Vn(t, e, n, r) {
2069
2066
  if (!(!e || e.axesSpec.length === 0))
2070
2067
  return {
2071
2068
  id: t,
@@ -2080,13 +2077,13 @@ function Nn(t, e, n, r) {
2080
2077
  "pl7.app/discreteValues": "[1]"
2081
2078
  }
2082
2079
  },
2083
- data: e.selectedKeys.filter((i) => !i.some((s) => ct(s))).map((i) => ({ key: i, val: 1 }))
2080
+ data: e.selectedKeys.filter((i) => !i.some((s) => at(s))).map((i) => ({ key: i, val: 1 }))
2084
2081
  };
2085
2082
  }
2086
- function Jn(t) {
2087
- return t === pt ? (console.error("Axis value can never be N/A"), "") : t;
2083
+ function jn(t) {
2084
+ return t === lt ? (console.error("Axis value can never be N/A"), "") : t;
2088
2085
  }
2089
- class Un {
2086
+ class $n {
2090
2087
  constructor(e) {
2091
2088
  this.handle = e;
2092
2089
  }
@@ -2106,52 +2103,52 @@ class Un {
2106
2103
  return await platforma.pFrameDriver.getUniqueValues(this.handle, e);
2107
2104
  }
2108
2105
  }
2109
- function qt(t) {
2110
- return Fe({
2106
+ function Gt(t) {
2107
+ return ke({
2111
2108
  __isRef: !0,
2112
2109
  blockId: ie(t, "blockId"),
2113
2110
  name: ie(t, "name")
2114
2111
  });
2115
2112
  }
2116
- function Mn(t) {
2117
- return Fe({
2118
- ref: qt(ie(t, "ref")),
2113
+ function Nn(t) {
2114
+ return ke({
2115
+ ref: Gt(ie(t, "ref")),
2119
2116
  label: ie(t, "label")
2120
2117
  });
2121
2118
  }
2122
- const Bn = {
2119
+ const Jn = {
2123
2120
  sdkVersion: Y
2124
2121
  };
2125
- function zt() {
2122
+ function Ht() {
2126
2123
  return Re({ sdkVersion: Y });
2127
2124
  }
2128
- function Wn(t) {
2125
+ function Mn(t) {
2129
2126
  try {
2130
- return zt();
2127
+ return Ht();
2131
2128
  } catch {
2132
2129
  return t;
2133
2130
  }
2134
2131
  }
2135
- function Gn(t) {
2132
+ function Un(t) {
2136
2133
  if (typeof globalThis.getEnvironmentValue == "function")
2137
2134
  return globalThis.getEnvironmentValue(t);
2138
2135
  }
2139
2136
  export {
2140
- nn as Args,
2141
- E as BlockModel,
2142
- Bn as CurrentSdkInfo,
2143
- I as FutureRef,
2144
- Ut as IS_VIRTUAL_COLUMN,
2145
- rn as It,
2146
- En as JsRenderInternal,
2147
- Te as LABEL_ANNOTATION,
2148
- Mt as LINKER_COLUMN_ANNOTATION,
2149
- sn as MainOutputs,
2150
- dt as OutputError,
2151
- bt as PAnnotationLabel,
2152
- wt as PAnnotationTrace,
2153
- ve as PColumnCollection,
2154
- Un as PFrameImpl,
2137
+ en as Args,
2138
+ L as BlockModel,
2139
+ Jn as CurrentSdkInfo,
2140
+ _ as FutureRef,
2141
+ Nt as IS_VIRTUAL_COLUMN,
2142
+ tn as It,
2143
+ Tn as JsRenderInternal,
2144
+ Ie as LABEL_ANNOTATION,
2145
+ Jt as LINKER_COLUMN_ANNOTATION,
2146
+ nn as MainOutputs,
2147
+ ut as OutputError,
2148
+ mt as PAnnotationLabel,
2149
+ yt as PAnnotationTrace,
2150
+ le as PColumnCollection,
2151
+ $n as PFrameImpl,
2155
2152
  B as RT_BINARY_PARTITIONED,
2156
2153
  z as RT_BINARY_SUPER_PARTITIONED,
2157
2154
  q as RT_JSON_PARTITIONED,
@@ -2159,75 +2156,74 @@ export {
2159
2156
  se as RT_RESOURCE_MAP,
2160
2157
  oe as RT_RESOURCE_MAP_PARTITIONED,
2161
2158
  te as RenderCtx,
2162
- Dt as ResultPool,
2163
- on as StagingOutputs,
2164
- xt as Trace,
2165
- At as TraceEntry,
2166
- O as TreeNodeAccessor,
2167
- an as UiState,
2168
- We as allColumnsComputed,
2169
- hn as and,
2170
- Tt as convertOrParsePColumnData,
2171
- Rn as createPFrameForGraphs,
2172
- Kn as createPlDataTable,
2173
- Vn as createPlDataTableSheet,
2174
- jn as createPlDataTableV2,
2175
- Nn as createRowSelectionColumn,
2159
+ Rt as ResultPool,
2160
+ rn as StagingOutputs,
2161
+ bt as Trace,
2162
+ vt as TraceEntry,
2163
+ E as TreeNodeAccessor,
2164
+ sn as UiState,
2165
+ Me as allColumnsComputed,
2166
+ pn as and,
2167
+ St as convertOrParsePColumnData,
2168
+ Fn as createPFrameForGraphs,
2169
+ kn as createPlDataTable,
2170
+ Dn as createPlDataTableSheet,
2171
+ Rn as createPlDataTableV2,
2172
+ Vn as createRowSelectionColumn,
2176
2173
  Ve as deriveLabels,
2177
- de as downgradeCfgOrLambda,
2178
- Bt as enrichColumnsWithCompatible,
2179
- Pn as extractArchiveAndGetURL,
2180
- kn as extractConfig,
2181
- Lt as filterDataInfoEntries,
2182
- pn as flatten,
2183
- Mn as fromPlOption,
2184
- qt as fromPlRef,
2185
- Fn as getAdditionalColumns,
2186
- Me as getAllLabelColumns,
2187
- bn as getBlobContent,
2188
- An as getBlobContentAsJson,
2189
- wn as getBlobContentAsString,
2190
- xn as getDownloadedBlobContent,
2191
- Gn as getEnvironmentValue,
2174
+ pe as downgradeCfgOrLambda,
2175
+ Bt as enrichCompatible,
2176
+ xn as extractArchiveAndGetURL,
2177
+ En as extractConfig,
2178
+ _t as filterDataInfoEntries,
2179
+ un as flatten,
2180
+ Nn as fromPlOption,
2181
+ Gt as fromPlRef,
2182
+ Ne as getAllLabelColumns,
2183
+ Ut as getAvailableWithLinkersAxes,
2184
+ yn as getBlobContent,
2185
+ bn as getBlobContentAsJson,
2186
+ vn as getBlobContentAsString,
2187
+ wn as getDownloadedBlobContent,
2188
+ Un as getEnvironmentValue,
2192
2189
  Q as getFromCfg,
2193
2190
  re as getImmediate,
2194
- Sn as getImportProgress,
2191
+ Cn as getImportProgress,
2195
2192
  ie as getJsonField,
2196
- _n as getLastLogs,
2197
- Nt as getLinkerColumnsMap,
2198
- Ln as getLogHandle,
2199
- Be as getMatchingLabelColumns,
2200
- Cn as getOnDemandBlobContent,
2201
- St as getPartitionKeysList,
2202
- Wn as getPlatformaOrDefault,
2203
- In as getProgressLog,
2204
- Tn as getProgressLogWithInfo,
2205
- zt as getRawPlatformaInstance,
2206
- mn as getResourceField,
2207
- yn as getResourceValueAsJson,
2208
- It as getUniquePartitionKeys,
2209
- Je as hasPathWithLinkerColumns,
2193
+ Pn as getLastLogs,
2194
+ Mt as getLinkerColumnsMap,
2195
+ In as getLogHandle,
2196
+ Je as getMatchingLabelColumns,
2197
+ An as getOnDemandBlobContent,
2198
+ xt as getPartitionKeysList,
2199
+ Mn as getPlatformaOrDefault,
2200
+ Sn as getProgressLog,
2201
+ _n as getProgressLogWithInfo,
2202
+ Ht as getRawPlatformaInstance,
2203
+ hn as getResourceField,
2204
+ gn as getResourceValueAsJson,
2205
+ Pt as getUniquePartitionKeys,
2210
2206
  he as ifDef,
2211
- Gt as isColumnHidden,
2212
- Ht as isColumnOptional,
2213
- Kt as isConfigLambda,
2214
- dn as isEmpty,
2215
- Wt as isLabelColumn,
2207
+ Ft as isColumnHidden,
2208
+ Kt as isColumnOptional,
2209
+ Dt as isConfigLambda,
2210
+ cn as isEmpty,
2211
+ ve as isLabelColumn,
2216
2212
  $t as isLinkerColumn,
2217
- tn as isolate,
2218
- ln as makeArray,
2219
- Fe as makeObject,
2220
- cn as mapArrayValues,
2221
- Jn as mapPTableValueToAxisKey,
2222
- un as mapRecordValues,
2223
- vn as mapResourceFields,
2224
- fn as not,
2225
- gn as or,
2213
+ Zt as isolate,
2214
+ on as makeArray,
2215
+ ke as makeObject,
2216
+ ln as mapArrayValues,
2217
+ jn as mapPTableValueToAxisKey,
2218
+ an as mapRecordValues,
2219
+ mn as mapResourceFields,
2220
+ dn as not,
2221
+ fn as or,
2226
2222
  ye as parsePColumnData,
2227
- On as parseResourceMap,
2228
- ft as readOutput,
2229
- $n as stringifyPTableColumnId,
2230
- Dn as stringifyPTableColumnSpec,
2231
- en as wrapOutputs
2223
+ Ln as parseResourceMap,
2224
+ ct as readOutput,
2225
+ Kn as stringifyPTableColumnId,
2226
+ On as stringifyPTableColumnSpec,
2227
+ Qt as wrapOutputs
2232
2228
  };
2233
2229
  //# sourceMappingURL=index.mjs.map