@milaboratories/pl-model-common 1.11.4 → 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.
Files changed (46) hide show
  1. package/dist/drivers/pframe/data_info.d.ts +169 -0
  2. package/dist/drivers/pframe/data_info.d.ts.map +1 -0
  3. package/dist/drivers/pframe/{data.d.ts → data_types.d.ts} +1 -7
  4. package/dist/drivers/pframe/data_types.d.ts.map +1 -0
  5. package/dist/drivers/pframe/driver.d.ts +1 -1
  6. package/dist/drivers/pframe/driver.d.ts.map +1 -1
  7. package/dist/drivers/pframe/index.d.ts +2 -1
  8. package/dist/drivers/pframe/index.d.ts.map +1 -1
  9. package/dist/drivers/pframe/spec/{anchored_id.d.ts → anchored.d.ts} +20 -13
  10. package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -0
  11. package/dist/drivers/pframe/spec/filtered_column.d.ts +31 -0
  12. package/dist/drivers/pframe/spec/filtered_column.d.ts.map +1 -0
  13. package/dist/drivers/pframe/spec/ids.d.ts +24 -0
  14. package/dist/drivers/pframe/spec/ids.d.ts.map +1 -0
  15. package/dist/drivers/pframe/spec/index.d.ts +3 -1
  16. package/dist/drivers/pframe/spec/index.d.ts.map +1 -1
  17. package/dist/drivers/pframe/spec/selectors.d.ts +3 -3
  18. package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
  19. package/dist/drivers/pframe/spec/spec.d.ts +2 -0
  20. package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
  21. package/dist/drivers/pframe/table.d.ts +1 -1
  22. package/dist/drivers/pframe/table.d.ts.map +1 -1
  23. package/dist/drivers/pframe/table_calculate.d.ts +1 -1
  24. package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
  25. package/dist/drivers/pframe/unique_values.d.ts +1 -1
  26. package/dist/drivers/pframe/unique_values.d.ts.map +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +383 -191
  30. package/dist/index.mjs.map +1 -1
  31. package/package.json +3 -3
  32. package/src/drivers/pframe/data_info.ts +430 -0
  33. package/src/drivers/pframe/{data.ts → data_types.ts} +0 -7
  34. package/src/drivers/pframe/driver.ts +1 -1
  35. package/src/drivers/pframe/index.ts +2 -1
  36. package/src/drivers/pframe/spec/{anchored_id.ts → anchored.ts} +63 -21
  37. package/src/drivers/pframe/spec/filtered_column.ts +39 -0
  38. package/src/drivers/pframe/spec/ids.ts +31 -0
  39. package/src/drivers/pframe/spec/index.ts +3 -1
  40. package/src/drivers/pframe/spec/selectors.ts +4 -3
  41. package/src/drivers/pframe/spec/spec.ts +6 -0
  42. package/src/drivers/pframe/table.ts +1 -1
  43. package/src/drivers/pframe/table_calculate.ts +1 -1
  44. package/src/drivers/pframe/unique_values.ts +1 -1
  45. package/dist/drivers/pframe/data.d.ts.map +0 -1
  46. package/dist/drivers/pframe/spec/anchored_id.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,64 +1,218 @@
1
1
  var $ = Object.defineProperty;
2
- var F = (n, t, e) => t in n ? $(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var d = (n, t, e) => F(n, typeof t != "symbol" ? t + "" : t, e);
4
- import k from "canonicalize";
5
- import { z as m } from "zod";
6
- function un(n) {
2
+ var L = (n, t, e) => t in n ? $(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var p = (n, t, e) => L(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import g from "canonicalize";
5
+ import { z as y } from "zod";
6
+ function dn(n) {
7
7
  return n !== void 0 && n.startsWith("log+live://log/");
8
8
  }
9
- function g(n) {
9
+ function w(n) {
10
10
  throw new Error("Unexpected object: " + n);
11
11
  }
12
- const I = "upload://upload/", N = "index://index/";
13
- function D(n) {
14
- return n.startsWith(I);
12
+ const S = "upload://upload/", E = "index://index/";
13
+ function V(n) {
14
+ return n.startsWith(S);
15
15
  }
16
- function U(n) {
17
- return n.startsWith(N);
16
+ function D(n) {
17
+ return n.startsWith(E);
18
18
  }
19
- function O(n) {
20
- if (U(n)) {
21
- const t = n.slice(N.length);
19
+ function j(n) {
20
+ if (D(n)) {
21
+ const t = n.slice(E.length);
22
22
  return JSON.parse(decodeURIComponent(t)).path;
23
- } else if (D(n)) {
24
- const t = n.slice(I.length);
23
+ } else if (V(n)) {
24
+ const t = n.slice(S.length);
25
25
  return JSON.parse(decodeURIComponent(t)).localPath;
26
26
  }
27
- g(n);
27
+ w(n);
28
28
  }
29
29
  function B(n) {
30
30
  return n.replace(/^.*[\\/]/, "");
31
31
  }
32
- function dn(n) {
33
- return B(O(n));
32
+ function pn(n) {
33
+ return B(j(n));
34
+ }
35
+ function yn(n) {
36
+ if (!n || typeof n != "object")
37
+ return !1;
38
+ const t = n;
39
+ if (!("type" in t))
40
+ return !1;
41
+ switch (t.type) {
42
+ case "Json":
43
+ return typeof t.keyLength == "number" && t.data !== void 0 && typeof t.data == "object";
44
+ case "JsonPartitioned":
45
+ return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
46
+ case "BinaryPartitioned":
47
+ return typeof t.partitionKeyLength == "number" && t.parts !== void 0 && typeof t.parts == "object";
48
+ default:
49
+ return !1;
50
+ }
51
+ }
52
+ function mn(n, t) {
53
+ if (n !== void 0)
54
+ switch (n.type) {
55
+ case "Json":
56
+ return n;
57
+ case "JsonPartitioned": {
58
+ const e = {};
59
+ for (const [r, o] of Object.entries(n.parts))
60
+ e[r] = t(o);
61
+ return {
62
+ ...n,
63
+ parts: e
64
+ };
65
+ }
66
+ case "BinaryPartitioned": {
67
+ const e = {};
68
+ for (const [r, o] of Object.entries(n.parts))
69
+ e[r] = {
70
+ index: t(o.index),
71
+ values: t(o.values)
72
+ };
73
+ return {
74
+ ...n,
75
+ parts: e
76
+ };
77
+ }
78
+ }
79
+ }
80
+ function ln(n) {
81
+ if (!n || typeof n != "object")
82
+ return !1;
83
+ const t = n;
84
+ if (!("type" in t))
85
+ return !1;
86
+ switch (t.type) {
87
+ case "Json":
88
+ return typeof t.keyLength == "number" && Array.isArray(t.data);
89
+ case "JsonPartitioned":
90
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
91
+ case "BinaryPartitioned":
92
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
93
+ default:
94
+ return !1;
95
+ }
96
+ }
97
+ function hn(n) {
98
+ switch (n.type) {
99
+ case "Json": {
100
+ const t = Object.entries(n.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
101
+ return {
102
+ type: "Json",
103
+ keyLength: n.keyLength,
104
+ data: t
105
+ };
106
+ }
107
+ case "JsonPartitioned": {
108
+ const t = Object.entries(n.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
109
+ return {
110
+ type: "JsonPartitioned",
111
+ partitionKeyLength: n.partitionKeyLength,
112
+ parts: t
113
+ };
114
+ }
115
+ case "BinaryPartitioned": {
116
+ const t = Object.entries(n.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
117
+ return {
118
+ type: "BinaryPartitioned",
119
+ partitionKeyLength: n.partitionKeyLength,
120
+ parts: t
121
+ };
122
+ }
123
+ }
124
+ }
125
+ function bn(n) {
126
+ switch (n.type) {
127
+ case "Json": {
128
+ const t = {};
129
+ for (const e of n.data)
130
+ t[JSON.stringify(e.key)] = e.value;
131
+ return {
132
+ type: "Json",
133
+ keyLength: n.keyLength,
134
+ data: t
135
+ };
136
+ }
137
+ case "JsonPartitioned": {
138
+ const t = {};
139
+ for (const e of n.parts)
140
+ t[JSON.stringify(e.key)] = e.value;
141
+ return {
142
+ type: "JsonPartitioned",
143
+ partitionKeyLength: n.partitionKeyLength,
144
+ parts: t
145
+ };
146
+ }
147
+ case "BinaryPartitioned": {
148
+ const t = {};
149
+ for (const e of n.parts)
150
+ t[JSON.stringify(e.key)] = e.value;
151
+ return {
152
+ type: "BinaryPartitioned",
153
+ partitionKeyLength: n.partitionKeyLength,
154
+ parts: t
155
+ };
156
+ }
157
+ }
158
+ }
159
+ function gn(n, t) {
160
+ if (n !== void 0)
161
+ switch (n.type) {
162
+ case "Json":
163
+ return n;
164
+ case "JsonPartitioned": {
165
+ const e = n.parts.map((r) => ({
166
+ key: r.key,
167
+ value: t(r.value)
168
+ }));
169
+ return {
170
+ ...n,
171
+ parts: e
172
+ };
173
+ }
174
+ case "BinaryPartitioned": {
175
+ const e = n.parts.map((r) => ({
176
+ key: r.key,
177
+ value: {
178
+ index: t(r.value.index),
179
+ values: t(r.value.values)
180
+ }
181
+ }));
182
+ return {
183
+ ...n,
184
+ parts: e
185
+ };
186
+ }
187
+ }
34
188
  }
35
- const R = -2147483648, w = -9007199254740991n, j = NaN, L = NaN, M = null, _ = null;
36
- function p(n, t) {
189
+ const I = -2147483648, A = -9007199254740991n, F = NaN, U = NaN, K = null, R = null;
190
+ function h(n, t) {
37
191
  switch (t) {
38
192
  case "Int":
39
- return n === R;
193
+ return n === I;
40
194
  case "Long":
41
- return n === Number(w) || n === w;
195
+ return n === Number(A) || n === A;
42
196
  case "Float":
43
- return n === j;
197
+ return n === F;
44
198
  case "Double":
45
- return n === L;
199
+ return n === U;
46
200
  case "String":
47
- return n === M;
201
+ return n === K;
48
202
  case "Bytes":
49
- return n === _;
203
+ return n === R;
50
204
  default:
51
205
  throw Error(`unsupported data type: ${t}`);
52
206
  }
53
207
  }
54
- function mn(n) {
55
- if (!H(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
208
+ function wn(n) {
209
+ if (!M(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
56
210
  return n;
57
211
  }
58
- function H(n, t) {
212
+ function M(n, t) {
59
213
  if (!t)
60
214
  return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
61
- if (p(n, t)) return !1;
215
+ if (h(n, t)) return !1;
62
216
  switch (t) {
63
217
  case "Int":
64
218
  return typeof n == "number";
@@ -76,10 +230,10 @@ function H(n, t) {
76
230
  throw Error(`unsupported data type: ${t}`);
77
231
  }
78
232
  }
79
- function J(n, t) {
233
+ function _(n, t) {
80
234
  if (!t)
81
235
  return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
82
- if (p(n, t)) return !0;
236
+ if (h(n, t)) return !0;
83
237
  switch (t) {
84
238
  case "Int":
85
239
  return typeof n == "number";
@@ -97,14 +251,14 @@ function J(n, t) {
97
251
  throw Error(`unsupported data type: ${t}`);
98
252
  }
99
253
  }
100
- function ln(n) {
254
+ function An(n) {
101
255
  if (n === null || typeof n == "string" || typeof n == "number") return n;
102
256
  if (typeof n == "bigint") return { bigint: n.toString() };
103
257
  throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
104
258
  }
105
- function K(n, t) {
259
+ function v(n, t) {
106
260
  if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
107
- if (t && !p(n, t) && !J(n, t))
261
+ if (t && !h(n, t) && !_(n, t))
108
262
  throw new Error(`Unexpected value type, got ${typeof n}, expected ${t}`);
109
263
  return n;
110
264
  }
@@ -115,12 +269,12 @@ function K(n, t) {
115
269
  }
116
270
  throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
117
271
  }
118
- function pn(n) {
119
- if (n = T(n), n === null) throw new Error("Value is null");
272
+ function Pn(n) {
273
+ if (n = H(n), n === null) throw new Error("Value is null");
120
274
  return n;
121
275
  }
122
- function T(n) {
123
- if (n = K(n), n === null) return null;
276
+ function H(n) {
277
+ if (n = v(n), n === null) return null;
124
278
  if (typeof n == "string") return n;
125
279
  if (typeof n == "number") {
126
280
  if (!isFinite(n)) throw new Error(`Value is not finite (${n})`);
@@ -130,19 +284,19 @@ function T(n) {
130
284
  return Number(n);
131
285
  throw new Error(`Unexpected value type: ${typeof n}`);
132
286
  }
133
- function W(n, t) {
287
+ function T(n, t) {
134
288
  const e = Math.floor(t / 8), r = 1 << 7 - t % 8;
135
289
  return (n[e] & r) > 0;
136
290
  }
137
- const X = { type: "absent" }, G = null;
138
- function hn(n) {
291
+ const W = { type: "absent" }, X = null;
292
+ function xn(n) {
139
293
  return typeof n == "object" && n !== null && n.type === "absent";
140
294
  }
141
- function yn(n, t, e = {}) {
142
- if (W(n.absent, t))
143
- return e.absent === void 0 ? X : e.absent;
295
+ function kn(n, t, e = {}) {
296
+ if (T(n.absent, t))
297
+ return e.absent === void 0 ? W : e.absent;
144
298
  const r = n.data[t], o = n.type;
145
- if (p(r, o)) return e.na === void 0 ? G : e.na;
299
+ if (h(r, o)) return e.na === void 0 ? X : e.na;
146
300
  switch (o) {
147
301
  case "Int":
148
302
  return r;
@@ -160,24 +314,27 @@ function yn(n, t, e = {}) {
160
314
  throw Error(`unsupported data type: ${o}`);
161
315
  }
162
316
  }
163
- function h(n) {
317
+ function m(n) {
164
318
  const { type: t, name: e, domain: r } = n;
165
319
  return { type: t, name: e, ...r && { domain: r } };
166
320
  }
167
- function bn(n) {
168
- return n.map(h);
321
+ function Nn(n) {
322
+ return n.map(m);
169
323
  }
170
- function Q(n, t) {
324
+ function Sn(n) {
325
+ return g(m(n));
326
+ }
327
+ function z(n, t) {
171
328
  if (n === void 0) return t === void 0;
172
329
  if (t === void 0) return !0;
173
330
  for (const e in t)
174
331
  if (n[e] !== t[e]) return !1;
175
332
  return !0;
176
333
  }
177
- function z(n, t) {
178
- return n.name === t.name && Q(n.domain, t.domain);
334
+ function G(n, t) {
335
+ return n.name === t.name && z(n.domain, t.domain);
179
336
  }
180
- function gn(n, t) {
337
+ function En(n, t) {
181
338
  return { ...n, src: l(n.src, t) };
182
339
  }
183
340
  function l(n, t) {
@@ -200,101 +357,123 @@ function l(n, t) {
200
357
  secondary: n.secondary.map((e) => l(e, t))
201
358
  };
202
359
  default:
203
- g(n);
360
+ w(n);
204
361
  }
205
362
  }
206
- function A(n) {
207
- return k(h(n));
363
+ function Q(n) {
364
+ return g(n);
365
+ }
366
+ function Cn(n) {
367
+ return JSON.parse(n);
368
+ }
369
+ function P(n) {
370
+ return g(m(n));
208
371
  }
209
372
  function x(n, t) {
210
373
  return JSON.stringify([n, t]);
211
374
  }
212
- class wn {
375
+ class On {
213
376
  /**
214
377
  * Creates a new anchor context from a set of anchor column specifications
215
378
  * @param anchors Record of anchor column specifications indexed by anchor ID
216
379
  */
217
380
  constructor(t) {
218
- d(this, "domains", /* @__PURE__ */ new Map());
219
- d(this, "axes", /* @__PURE__ */ new Map());
381
+ p(this, "domains", /* @__PURE__ */ new Map());
382
+ p(this, "axes", /* @__PURE__ */ new Map());
220
383
  /**
221
384
  * Domain packs are used to group domain keys that can be anchored to the same anchor
222
385
  * This is used to optimize the lookup of domain anchors
223
386
  */
224
- d(this, "domainPacks", []);
387
+ p(this, "domainPacks", []);
225
388
  /**
226
389
  * Maps domain packs to anchors
227
390
  */
228
- d(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
391
+ p(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
229
392
  this.anchors = t;
230
393
  const e = Object.entries(t);
231
394
  e.sort((r, o) => r[0].localeCompare(o[0]));
232
395
  for (const [r, o] of e) {
233
396
  for (let i = 0; i < o.axesSpec.length; i++) {
234
- const a = o.axesSpec[i], s = A(a);
235
- this.axes.set(s, { anchor: r, idx: i });
397
+ const s = o.axesSpec[i], a = P(s);
398
+ this.axes.set(a, { anchor: r, idx: i });
236
399
  }
237
400
  if (o.domain !== void 0) {
238
401
  const i = Object.entries(o.domain);
239
- i.sort((a, s) => a[0].localeCompare(s[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([a]) => a));
240
- for (const [a, s] of i) {
241
- const c = x(a, s);
402
+ i.sort((s, a) => s[0].localeCompare(a[0])), this.domainPackToAnchor.set(JSON.stringify(i), r), this.domainPacks.push(i.map(([s]) => s));
403
+ for (const [s, a] of i) {
404
+ const c = x(s, a);
242
405
  this.domains.set(c, r);
243
406
  }
244
407
  }
245
408
  }
246
409
  }
247
410
  /**
248
- * Derives an anchored column identifier from a column specification
249
- * Replaces domain values and axes with anchored references when possible
250
- * @param spec Column specification to anchor
251
- * @returns An anchored column identifier that can be used to identify columns similar to the input specification
411
+ * Implementation of derive method
252
412
  */
253
- derive(t) {
254
- const e = {
413
+ derive(t, e) {
414
+ const r = {
255
415
  name: t.name,
256
416
  axes: []
257
417
  };
258
- let r;
418
+ let o;
259
419
  if (t.domain !== void 0)
260
420
  n:
261
- for (const o of this.domainPacks) {
262
- const i = [];
263
- for (const s of o) {
264
- const c = t.domain[s];
265
- if (c !== void 0)
266
- i.push([s, c]);
421
+ for (const s of this.domainPacks) {
422
+ const a = [];
423
+ for (const u of s) {
424
+ const d = t.domain[u];
425
+ if (d !== void 0)
426
+ a.push([u, d]);
267
427
  else
268
428
  break n;
269
429
  }
270
- const a = this.domainPackToAnchor.get(JSON.stringify(i));
271
- if (a !== void 0) {
272
- e.domainAnchor = a, r = new Set(o);
430
+ const c = this.domainPackToAnchor.get(JSON.stringify(a));
431
+ if (c !== void 0) {
432
+ r.domainAnchor = c, o = new Set(s);
273
433
  break;
274
434
  }
275
435
  }
276
- for (const [o, i] of Object.entries(t.domain ?? {})) {
277
- if (r !== void 0 && r.has(o))
436
+ for (const [s, a] of Object.entries(t.domain ?? {})) {
437
+ if (o !== void 0 && o.has(s))
278
438
  continue;
279
- const a = x(o, i), s = this.domains.get(a);
280
- e.domain ?? (e.domain = {}), e.domain[o] = s ? { anchor: s } : i;
439
+ const c = x(s, a), u = this.domains.get(c);
440
+ r.domain ?? (r.domain = {}), r.domain[s] = u ? { anchor: u } : a;
281
441
  }
282
- return e.axes = t.axesSpec.map((o) => {
283
- const i = A(o);
284
- return this.axes.get(i) ?? o;
285
- }), e;
442
+ if (r.axes = t.axesSpec.map((s) => {
443
+ const a = P(s);
444
+ return this.axes.get(a) ?? s;
445
+ }), !e || e.length === 0)
446
+ return r;
447
+ const i = [];
448
+ for (const s of e) {
449
+ const [a, c] = s;
450
+ if (typeof a == "number") {
451
+ if (a < 0 || a >= t.axesSpec.length)
452
+ throw new Error(`Axis index ${a} is out of bounds (0-${t.axesSpec.length - 1})`);
453
+ i.push([a, c]);
454
+ } else {
455
+ const u = t.axesSpec.findIndex((d) => d.name === a);
456
+ if (u === -1)
457
+ throw new Error(`Axis with name "${a}" not found in the column specification`);
458
+ i.push([u, c]);
459
+ }
460
+ }
461
+ return i.sort((s, a) => s[0] - a[0]), {
462
+ source: r,
463
+ axisFilters: i
464
+ };
286
465
  }
287
466
  /**
288
467
  * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
289
468
  * @param spec Column specification to anchor
469
+ * @param axisFilters Optional axis filters to apply to the column
290
470
  * @returns A canonicalized string representation of the anchored column identifier
291
471
  */
292
- deriveCanonical(t) {
293
- const e = this.derive(t);
294
- return k(e);
472
+ deriveS(t, e) {
473
+ return Q(this.derive(t, e));
295
474
  }
296
475
  }
297
- function An(n, t) {
476
+ function Jn(n, t) {
298
477
  const e = { ...t };
299
478
  if (e.domainAnchor !== void 0) {
300
479
  const r = n[e.domainAnchor];
@@ -309,12 +488,12 @@ function An(n, t) {
309
488
  if (typeof i == "string")
310
489
  r[o] = i;
311
490
  else {
312
- const a = n[i.anchor];
313
- if (!a)
491
+ const s = n[i.anchor];
492
+ if (!s)
314
493
  throw new Error(`Anchor "${i.anchor}" not found for domain key "${o}"`);
315
- if (!a.domain || a.domain[o] === void 0)
494
+ if (!s.domain || s.domain[o] === void 0)
316
495
  throw new Error(`Domain key "${o}" not found in anchor "${i.anchor}"`);
317
- r[o] = a.domain[o];
496
+ r[o] = s.domain[o];
318
497
  }
319
498
  e.domain = r;
320
499
  }
@@ -338,7 +517,7 @@ function Y(n, t) {
338
517
  throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
339
518
  return o[0];
340
519
  } else if ("id" in t) {
341
- const o = r.axesSpec.filter((i) => z(t.id, h(i)));
520
+ const o = r.axesSpec.filter((i) => G(t.id, m(i)));
342
521
  if (o.length > 1)
343
522
  throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
344
523
  if (o.length === 0)
@@ -350,29 +529,32 @@ function Y(n, t) {
350
529
  function Z(n) {
351
530
  return typeof n == "object" && "anchor" in n;
352
531
  }
532
+ function $n(n) {
533
+ return typeof n == "object" && n !== null && "source" in n && "axisFilters" in n;
534
+ }
353
535
  function f(n) {
354
536
  return n.kind === "PColumn";
355
537
  }
356
538
  function q(n) {
357
539
  return f(n.spec);
358
540
  }
359
- function xn(n) {
541
+ function Ln(n) {
360
542
  return f(n.obj);
361
543
  }
362
- function Pn(n) {
544
+ function Vn(n) {
363
545
  return f(n.obj.spec);
364
546
  }
365
- function En(n) {
547
+ function Dn(n) {
366
548
  if (!q(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
367
549
  return n;
368
550
  }
369
- function kn(n, t) {
551
+ function jn(n, t) {
370
552
  return n === void 0 ? void 0 : {
371
553
  ...n,
372
554
  data: t(n.data)
373
555
  };
374
556
  }
375
- function In(n) {
557
+ function Bn(n) {
376
558
  const t = /* @__PURE__ */ new Map(), e = (r) => {
377
559
  switch (r.type) {
378
560
  case "column":
@@ -387,12 +569,12 @@ function In(n) {
387
569
  for (const o of r.secondary) e(o);
388
570
  return;
389
571
  default:
390
- g(r);
572
+ w(r);
391
573
  }
392
574
  };
393
575
  return e(n), [...t.values()];
394
576
  }
395
- function v(n) {
577
+ function nn(n) {
396
578
  throw new Error("Unexpected object: " + n);
397
579
  }
398
580
  function b(n, t) {
@@ -424,10 +606,10 @@ function b(n, t) {
424
606
  )
425
607
  );
426
608
  default:
427
- v(n);
609
+ nn(n);
428
610
  }
429
611
  }
430
- function P(n, t) {
612
+ function k(n, t) {
431
613
  if (n.name !== void 0 && n.name !== t.name)
432
614
  return !1;
433
615
  if (n.type !== void 0) {
@@ -445,7 +627,7 @@ function P(n, t) {
445
627
  }
446
628
  return !0;
447
629
  }
448
- function E(n, t) {
630
+ function N(n, t) {
449
631
  if (t.name !== void 0 && n.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n.name))
450
632
  return !1;
451
633
  if (t.type !== void 0) {
@@ -462,16 +644,16 @@ function E(n, t) {
462
644
  return !1;
463
645
  }
464
646
  if (t.axes !== void 0) {
465
- const e = n.axesSpec.map(h);
647
+ const e = n.axesSpec.map(m);
466
648
  if (t.partialAxesMatch) {
467
649
  for (const r of t.axes)
468
- if (!e.some((o) => P(r, o)))
650
+ if (!e.some((o) => k(r, o)))
469
651
  return !1;
470
652
  } else {
471
653
  if (e.length !== t.axes.length)
472
654
  return !1;
473
655
  for (let r = 0; r < t.axes.length; r++)
474
- if (!P(t.axes[r], e[r]))
656
+ if (!k(t.axes[r], e[r]))
475
657
  return !1;
476
658
  }
477
659
  }
@@ -491,26 +673,26 @@ function E(n, t) {
491
673
  }
492
674
  return !0;
493
675
  }
494
- function Nn(n) {
495
- return Array.isArray(n) ? (t) => n.some((e) => f(t) && E(t, e)) : (t) => f(t) && E(t, n);
676
+ function In(n) {
677
+ return Array.isArray(n) ? (t) => n.some((e) => f(t) && N(t, e)) : (t) => f(t) && N(t, n);
496
678
  }
497
- const Cn = { href: "/" }, Sn = m.object({
498
- __isRef: m.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
499
- blockId: m.string().describe("Upstream block id"),
500
- name: m.string().describe("Name of the output provided to the upstream block's output context")
679
+ const Fn = { href: "/" }, Un = y.object({
680
+ __isRef: y.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
681
+ blockId: y.string().describe("Upstream block id"),
682
+ name: y.string().describe("Name of the output provided to the upstream block's output context")
501
683
  }).describe(
502
684
  "Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees."
503
685
  ).strict().readonly();
504
- function Vn(n) {
686
+ function Kn(n) {
505
687
  return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
506
688
  }
507
- function $n(n, t) {
689
+ function Rn(n, t) {
508
690
  return n.blockId === t.blockId && n.name === t.name;
509
691
  }
510
- function Fn(n, t) {
692
+ function Mn(n, t) {
511
693
  return n.ok ? { ok: !0, value: t(n.value) } : n;
512
694
  }
513
- function nn(n) {
695
+ function tn(n) {
514
696
  if (n instanceof Int8Array || n instanceof Uint8Array || n instanceof Uint8ClampedArray)
515
697
  return new DataView(n.buffer, n.byteOffset, n.byteLength);
516
698
  if (n instanceof ArrayBuffer) return new DataView(n);
@@ -518,100 +700,110 @@ function nn(n) {
518
700
  "Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray"
519
701
  );
520
702
  }
521
- const tn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", en = "0123456789ABCDEFGHIJKLMNOPQRSTUV", rn = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
703
+ const en = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", rn = "0123456789ABCDEFGHIJKLMNOPQRSTUV", on = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
522
704
  function C(n, t, e) {
523
705
  e = e || {};
524
706
  let r, o;
525
707
  switch (t) {
526
708
  case "RFC3548":
527
709
  case "RFC4648":
528
- r = tn, o = !0;
710
+ r = en, o = !0;
529
711
  break;
530
712
  case "RFC4648-HEX":
531
- r = en, o = !0;
713
+ r = rn, o = !0;
532
714
  break;
533
715
  case "Crockford":
534
- r = rn, o = !1;
716
+ r = on, o = !1;
535
717
  break;
536
718
  default:
537
719
  throw new Error("Unknown base32 variant: " + String(t));
538
720
  }
539
- const i = e.padding !== void 0 ? e.padding : o, a = nn(n);
540
- let s = 0, c = 0, u = "";
541
- for (let y = 0; y < a.byteLength; y++)
542
- for (c = c << 8 | a.getUint8(y), s += 8; s >= 5; )
543
- u += r[c >>> s - 5 & 31], s -= 5;
544
- if (s > 0 && (u += r[c << 5 - s & 31]), i)
721
+ const i = e.padding !== void 0 ? e.padding : o, s = tn(n);
722
+ let a = 0, c = 0, u = "";
723
+ for (let d = 0; d < s.byteLength; d++)
724
+ for (c = c << 8 | s.getUint8(d), a += 8; a >= 5; )
725
+ u += r[c >>> a - 5 & 31], a -= 5;
726
+ if (a > 0 && (u += r[c << 5 - a & 31]), i)
545
727
  for (; u.length % 8 !== 0; )
546
728
  u += "=";
547
729
  return u;
548
730
  }
549
- const S = 15, on = 24, V = m.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
550
- function Dn() {
551
- const n = new Uint8Array(S);
552
- return crypto.getRandomValues(n), V.parse(C(n, "RFC4648"));
731
+ const O = 15, an = 24, J = y.string().length(an).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
732
+ function _n() {
733
+ const n = new Uint8Array(O);
734
+ return crypto.getRandomValues(n), J.parse(C(n, "RFC4648"));
553
735
  }
554
- function an(n) {
555
- if (n.length !== S) throw new Error(`Wrong number of bytes: ${n.length}`);
556
- return V.parse(C(n, "RFC4648"));
736
+ function sn(n) {
737
+ if (n.length !== O) throw new Error(`Wrong number of bytes: ${n.length}`);
738
+ return J.parse(C(n, "RFC4648"));
557
739
  }
558
- async function Un(n) {
740
+ async function vn(n) {
559
741
  const t = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", t.encode(n));
560
- return an(new Uint8Array(e.slice(0, 15)));
742
+ return sn(new Uint8Array(e.slice(0, 15)));
561
743
  }
562
744
  export {
563
- wn as AnchorIdDeriver,
564
- Cn as DefaultNavigationState,
565
- X as PTableAbsent,
566
- G as PTableNA,
567
- _ as PValueBytesNA,
568
- L as PValueDoubleNA,
569
- j as PValueFloatNA,
570
- R as PValueIntNA,
571
- w as PValueLongNA,
572
- M as PValueStringNA,
573
- V as PlId,
574
- S as PlIdBytes,
575
- on as PlIdLength,
576
- Sn as PlRef,
577
- Un as digestPlId,
578
- mn as ensureNotNAPValue,
579
- En as ensurePColumn,
745
+ On as AnchoredIdDeriver,
746
+ Fn as DefaultNavigationState,
747
+ W as PTableAbsent,
748
+ X as PTableNA,
749
+ R as PValueBytesNA,
750
+ U as PValueDoubleNA,
751
+ F as PValueFloatNA,
752
+ I as PValueIntNA,
753
+ A as PValueLongNA,
754
+ K as PValueStringNA,
755
+ J as PlId,
756
+ O as PlIdBytes,
757
+ an as PlIdLength,
758
+ Un as PlRef,
759
+ Sn as canonicalizeAxisId,
760
+ hn as dataInfoToEntries,
761
+ vn as digestPlId,
762
+ wn as ensureNotNAPValue,
763
+ Dn as ensurePColumn,
764
+ bn as entriesToDataInfo,
580
765
  b as executePSpecPredicate,
581
- In as extractAllColumns,
582
- bn as getAxesId,
583
- h as getAxisId,
584
- dn as getFileNameFromHandle,
585
- O as getFilePathFromHandle,
586
- U as isImportFileHandleIndex,
587
- D as isImportFileHandleUpload,
588
- un as isLiveLog,
589
- H as isNotNAPValue,
766
+ Bn as extractAllColumns,
767
+ Nn as getAxesId,
768
+ m as getAxisId,
769
+ pn as getFileNameFromHandle,
770
+ j as getFilePathFromHandle,
771
+ yn as isDataInfo,
772
+ ln as isDataInfoEntries,
773
+ $n as isFilteredPColumn,
774
+ D as isImportFileHandleIndex,
775
+ V as isImportFileHandleUpload,
776
+ dn as isLiveLog,
777
+ M as isNotNAPValue,
590
778
  q as isPColumn,
591
- Pn as isPColumnResult,
779
+ Vn as isPColumnResult,
592
780
  f as isPColumnSpec,
593
- xn as isPColumnSpecResult,
594
- hn as isPTableAbsent,
595
- J as isPValue,
596
- Vn as isPlRef,
597
- W as isValueAbsent,
598
- p as isValueNA,
781
+ Ln as isPColumnSpecResult,
782
+ xn as isPTableAbsent,
783
+ _ as isPValue,
784
+ Kn as isPlRef,
785
+ T as isValueAbsent,
786
+ h as isValueNA,
787
+ mn as mapDataInfo,
788
+ gn as mapDataInfoEntries,
599
789
  l as mapJoinEntry,
600
- kn as mapPObjectData,
601
- gn as mapPTableDef,
602
- Fn as mapValueInVOE,
603
- P as matchAxis,
604
- z as matchAxisId,
605
- E as matchPColumn,
606
- yn as pTableValue,
607
- pn as pValueToStringOrNumber,
608
- T as pValueToStringOrNumberOrNull,
609
- an as plId,
610
- $n as plRefsEqual,
611
- An as resolveAnchors,
612
- K as safeConvertToPValue,
613
- Nn as selectorsToPredicate,
614
- ln as toJsonSafePValue,
615
- Dn as uniquePlId
790
+ jn as mapPObjectData,
791
+ En as mapPTableDef,
792
+ Mn as mapValueInVOE,
793
+ k as matchAxis,
794
+ G as matchAxisId,
795
+ N as matchPColumn,
796
+ kn as pTableValue,
797
+ Pn as pValueToStringOrNumber,
798
+ H as pValueToStringOrNumberOrNull,
799
+ Cn as parseColumnId,
800
+ sn as plId,
801
+ Rn as plRefsEqual,
802
+ Jn as resolveAnchors,
803
+ v as safeConvertToPValue,
804
+ In as selectorsToPredicate,
805
+ Q as stringifyColumnId,
806
+ An as toJsonSafePValue,
807
+ _n as uniquePlId
616
808
  };
617
809
  //# sourceMappingURL=index.mjs.map