@milaboratories/pl-model-common 1.10.6 → 1.11.1

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/column_filter.d.ts +1 -1
  2. package/dist/drivers/pframe/column_filter.d.ts.map +1 -1
  3. package/dist/drivers/pframe/data.d.ts +1 -1
  4. package/dist/drivers/pframe/data.d.ts.map +1 -1
  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/find_columns.d.ts +1 -1
  8. package/dist/drivers/pframe/find_columns.d.ts.map +1 -1
  9. package/dist/drivers/pframe/index.d.ts +2 -1
  10. package/dist/drivers/pframe/index.d.ts.map +1 -1
  11. package/dist/drivers/pframe/pframe.d.ts +1 -1
  12. package/dist/drivers/pframe/pframe.d.ts.map +1 -1
  13. package/dist/drivers/pframe/spec/anchored_id.d.ts +50 -0
  14. package/dist/drivers/pframe/spec/anchored_id.d.ts.map +1 -0
  15. package/dist/drivers/pframe/spec/index.d.ts +4 -0
  16. package/dist/drivers/pframe/spec/index.d.ts.map +1 -0
  17. package/dist/drivers/pframe/spec/selectors.d.ts +165 -0
  18. package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -0
  19. package/dist/drivers/pframe/{spec.d.ts → spec/spec.d.ts} +1 -1
  20. package/dist/drivers/pframe/spec/spec.d.ts.map +1 -0
  21. package/dist/drivers/pframe/table_common.d.ts +1 -1
  22. package/dist/drivers/pframe/table_common.d.ts.map +1 -1
  23. package/dist/drivers/pframe/unique_values.d.ts +1 -1
  24. package/dist/drivers/pframe/unique_values.d.ts.map +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +472 -245
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/ref.d.ts +7 -0
  30. package/dist/ref.d.ts.map +1 -1
  31. package/package.json +9 -3
  32. package/src/drivers/pframe/column_filter.ts +1 -1
  33. package/src/drivers/pframe/data.ts +1 -1
  34. package/src/drivers/pframe/driver.ts +1 -1
  35. package/src/drivers/pframe/find_columns.ts +1 -1
  36. package/src/drivers/pframe/index.ts +3 -1
  37. package/src/drivers/pframe/pframe.ts +1 -1
  38. package/src/drivers/pframe/spec/anchored_id.ts +223 -0
  39. package/src/drivers/pframe/spec/index.ts +3 -0
  40. package/src/drivers/pframe/spec/selectors.test.ts +209 -0
  41. package/src/drivers/pframe/spec/selectors.ts +267 -0
  42. package/src/drivers/pframe/{spec.ts → spec/spec.ts} +3 -3
  43. package/src/drivers/pframe/table_common.ts +1 -1
  44. package/src/drivers/pframe/unique_values.ts +1 -1
  45. package/src/ref.ts +17 -0
  46. package/dist/drivers/pframe/spec.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,144 +1,148 @@
1
- import { z as a } from "zod";
2
- function Z(t) {
3
- return t !== void 0 && t.startsWith("log+live://log/");
4
- }
5
- function b(t) {
6
- throw new Error("Unexpected object: " + t);
7
- }
8
- const w = "upload://upload/", h = "index://index/";
9
- function E(t) {
10
- return t.startsWith(w);
11
- }
12
- function I(t) {
13
- return t.startsWith(h);
14
- }
15
- function C(t) {
16
- if (I(t)) {
17
- const n = t.slice(h.length);
18
- return JSON.parse(decodeURIComponent(n)).path;
19
- } else if (E(t)) {
20
- const n = t.slice(w.length);
21
- return JSON.parse(decodeURIComponent(n)).localPath;
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) {
7
+ return n !== void 0 && n.startsWith("log+live://log/");
8
+ }
9
+ function g(n) {
10
+ throw new Error("Unexpected object: " + n);
11
+ }
12
+ const I = "upload://upload/", N = "index://index/";
13
+ function D(n) {
14
+ return n.startsWith(I);
15
+ }
16
+ function U(n) {
17
+ return n.startsWith(N);
18
+ }
19
+ function O(n) {
20
+ if (U(n)) {
21
+ const t = n.slice(N.length);
22
+ return JSON.parse(decodeURIComponent(t)).path;
23
+ } else if (D(n)) {
24
+ const t = n.slice(I.length);
25
+ return JSON.parse(decodeURIComponent(t)).localPath;
22
26
  }
23
- b(t);
27
+ g(n);
24
28
  }
25
- function V(t) {
26
- return t.replace(/^.*[\\/]/, "");
29
+ function B(n) {
30
+ return n.replace(/^.*[\\/]/, "");
27
31
  }
28
- function z(t) {
29
- return V(C(t));
32
+ function dn(n) {
33
+ return B(O(n));
30
34
  }
31
- const F = -2147483648, g = -9007199254740991n, x = NaN, R = NaN, U = null, k = null;
32
- function d(t, n) {
33
- switch (n) {
35
+ const R = -2147483648, w = -9007199254740991n, j = NaN, L = NaN, M = null, _ = null;
36
+ function p(n, t) {
37
+ switch (t) {
34
38
  case "Int":
35
- return t === F;
39
+ return n === R;
36
40
  case "Long":
37
- return t === Number(g) || t === g;
41
+ return n === Number(w) || n === w;
38
42
  case "Float":
39
- return t === x;
43
+ return n === j;
40
44
  case "Double":
41
- return t === R;
45
+ return n === L;
42
46
  case "String":
43
- return t === U;
47
+ return n === M;
44
48
  case "Bytes":
45
- return t === k;
49
+ return n === _;
46
50
  default:
47
- throw Error(`unsupported data type: ${n}`);
51
+ throw Error(`unsupported data type: ${t}`);
48
52
  }
49
53
  }
50
- function q(t) {
51
- if (!B(t)) throw new Error(`Expected not-NA PValue, got ${t}`);
52
- return t;
54
+ function mn(n) {
55
+ if (!H(n)) throw new Error(`Expected not-NA PValue, got ${n}`);
56
+ return n;
53
57
  }
54
- function B(t, n) {
55
- if (!n)
56
- return typeof t == "string" || typeof t == "number" && isFinite(t) || typeof t == "bigint";
57
- if (d(t, n)) return !1;
58
- switch (n) {
58
+ function H(n, t) {
59
+ if (!t)
60
+ return typeof n == "string" || typeof n == "number" && isFinite(n) || typeof n == "bigint";
61
+ if (p(n, t)) return !1;
62
+ switch (t) {
59
63
  case "Int":
60
- return typeof t == "number";
64
+ return typeof n == "number";
61
65
  case "Long":
62
- return typeof t == "number" || typeof t == "bigint";
66
+ return typeof n == "number" || typeof n == "bigint";
63
67
  case "Float":
64
- return typeof t == "number";
68
+ return typeof n == "number";
65
69
  case "Double":
66
- return typeof t == "number";
70
+ return typeof n == "number";
67
71
  case "String":
68
- return typeof t == "string";
72
+ return typeof n == "string";
69
73
  case "Bytes":
70
74
  throw Error("Bytes not yet supported");
71
75
  default:
72
- throw Error(`unsupported data type: ${n}`);
76
+ throw Error(`unsupported data type: ${t}`);
73
77
  }
74
78
  }
75
- function S(t, n) {
76
- if (!n)
77
- return t === null || typeof t == "string" || typeof t == "number" || typeof t == "bigint";
78
- if (d(t, n)) return !0;
79
- switch (n) {
79
+ function J(n, t) {
80
+ if (!t)
81
+ return n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint";
82
+ if (p(n, t)) return !0;
83
+ switch (t) {
80
84
  case "Int":
81
- return typeof t == "number";
85
+ return typeof n == "number";
82
86
  case "Long":
83
- return typeof t == "number" || typeof t == "bigint";
87
+ return typeof n == "number" || typeof n == "bigint";
84
88
  case "Float":
85
- return typeof t == "number";
89
+ return typeof n == "number";
86
90
  case "Double":
87
- return typeof t == "number";
91
+ return typeof n == "number";
88
92
  case "String":
89
- return typeof t == "string";
93
+ return typeof n == "string";
90
94
  case "Bytes":
91
95
  throw Error("Bytes not yet supported");
92
96
  default:
93
- throw Error(`unsupported data type: ${n}`);
97
+ throw Error(`unsupported data type: ${t}`);
94
98
  }
95
99
  }
96
- function v(t) {
97
- if (t === null || typeof t == "string" || typeof t == "number") return t;
98
- if (typeof t == "bigint") return { bigint: t.toString() };
99
- throw new Error(`Type ${typeof t} (value ${t}) not yet supported.`);
100
+ function ln(n) {
101
+ if (n === null || typeof n == "string" || typeof n == "number") return n;
102
+ if (typeof n == "bigint") return { bigint: n.toString() };
103
+ throw new Error(`Type ${typeof n} (value ${n}) not yet supported.`);
100
104
  }
101
- function D(t, n) {
102
- if (t === null || typeof t == "string" || typeof t == "number" || typeof t == "bigint") {
103
- if (n && !d(t, n) && !S(t, n))
104
- throw new Error(`Unexpected value type, got ${typeof t}, expected ${n}`);
105
- return t;
105
+ function K(n, t) {
106
+ if (n === null || typeof n == "string" || typeof n == "number" || typeof n == "bigint") {
107
+ if (t && !p(n, t) && !J(n, t))
108
+ throw new Error(`Unexpected value type, got ${typeof n}, expected ${t}`);
109
+ return n;
106
110
  }
107
- if (typeof t == "object" && t !== null && "bigint" in t && typeof t.bigint == "string") {
108
- if (n && n !== "Long")
109
- throw new Error(`Unexpected value type, got serialized bigint, expected ${n}`);
110
- return BigInt(t.bigint);
111
+ if (typeof n == "object" && n !== null && "bigint" in n && typeof n.bigint == "string") {
112
+ if (t && t !== "Long")
113
+ throw new Error(`Unexpected value type, got serialized bigint, expected ${t}`);
114
+ return BigInt(n.bigint);
111
115
  }
112
- throw new Error(`Unsupported type ${typeof t} (value ${t}).`);
113
- }
114
- function tt(t) {
115
- if (t = $(t), t === null) throw new Error("Value is null");
116
- return t;
117
- }
118
- function $(t) {
119
- if (t = D(t), t === null) return null;
120
- if (typeof t == "string") return t;
121
- if (typeof t == "number") {
122
- if (!isFinite(t)) throw new Error(`Value is not finite (${t})`);
123
- return t;
116
+ throw new Error(`Unsupported type ${typeof n} (value ${n}).`);
117
+ }
118
+ function pn(n) {
119
+ if (n = T(n), n === null) throw new Error("Value is null");
120
+ return n;
121
+ }
122
+ function T(n) {
123
+ if (n = K(n), n === null) return null;
124
+ if (typeof n == "string") return n;
125
+ if (typeof n == "number") {
126
+ if (!isFinite(n)) throw new Error(`Value is not finite (${n})`);
127
+ return n;
124
128
  }
125
- if (typeof t == "bigint")
126
- return Number(t);
127
- throw new Error(`Unexpected value type: ${typeof t}`);
128
- }
129
- function L(t, n) {
130
- const e = Math.floor(n / 8), r = 1 << 7 - n % 8;
131
- return (t[e] & r) > 0;
132
- }
133
- const O = { type: "absent" }, H = null;
134
- function nt(t) {
135
- return typeof t == "object" && t !== null && t.type === "absent";
136
- }
137
- function et(t, n, e = {}) {
138
- if (L(t.absent, n))
139
- return e.absent === void 0 ? O : e.absent;
140
- const r = t.data[n], o = t.type;
141
- if (d(r, o)) return e.na === void 0 ? H : e.na;
129
+ if (typeof n == "bigint")
130
+ return Number(n);
131
+ throw new Error(`Unexpected value type: ${typeof n}`);
132
+ }
133
+ function W(n, t) {
134
+ const e = Math.floor(t / 8), r = 1 << 7 - t % 8;
135
+ return (n[e] & r) > 0;
136
+ }
137
+ const X = { type: "absent" }, G = null;
138
+ function hn(n) {
139
+ return typeof n == "object" && n !== null && n.type === "absent";
140
+ }
141
+ function yn(n, t, e = {}) {
142
+ if (W(n.absent, t))
143
+ return e.absent === void 0 ? X : e.absent;
144
+ const r = n.data[t], o = n.type;
145
+ if (p(r, o)) return e.na === void 0 ? G : e.na;
142
146
  switch (o) {
143
147
  case "Int":
144
148
  return r;
@@ -156,86 +160,223 @@ function et(t, n, e = {}) {
156
160
  throw Error(`unsupported data type: ${o}`);
157
161
  }
158
162
  }
159
- function J(t) {
160
- const { type: n, name: e, domain: r } = t;
161
- return { type: n, name: e, ...r && { domain: r } };
163
+ function h(n) {
164
+ const { type: t, name: e, domain: r } = n;
165
+ return { type: t, name: e, ...r && { domain: r } };
162
166
  }
163
- function rt(t) {
164
- return t.map(J);
167
+ function bn(n) {
168
+ return n.map(h);
165
169
  }
166
- function _(t, n) {
167
- if (t === void 0) return n === void 0;
168
- if (n === void 0) return !0;
169
- for (const e in n)
170
- if (t[e] !== n[e]) return !1;
170
+ function Q(n, t) {
171
+ if (n === void 0) return t === void 0;
172
+ if (t === void 0) return !0;
173
+ for (const e in t)
174
+ if (n[e] !== t[e]) return !1;
171
175
  return !0;
172
176
  }
173
- function ot(t, n) {
174
- return t.name === n.name && _(t.domain, n.domain);
177
+ function z(n, t) {
178
+ return n.name === t.name && Q(n.domain, t.domain);
175
179
  }
176
- function it(t, n) {
177
- return { ...t, src: f(t.src, n) };
180
+ function gn(n, t) {
181
+ return { ...n, src: l(n.src, t) };
178
182
  }
179
- function f(t, n) {
180
- switch (t.type) {
183
+ function l(n, t) {
184
+ switch (n.type) {
181
185
  case "column":
182
186
  return {
183
187
  type: "column",
184
- column: n(t.column)
188
+ column: t(n.column)
185
189
  };
186
190
  case "inner":
187
191
  case "full":
188
192
  return {
189
- type: t.type,
190
- entries: t.entries.map((e) => f(e, n))
193
+ type: n.type,
194
+ entries: n.entries.map((e) => l(e, t))
191
195
  };
192
196
  case "outer":
193
197
  return {
194
198
  type: "outer",
195
- primary: f(t.primary, n),
196
- secondary: t.secondary.map((e) => f(e, n))
199
+ primary: l(n.primary, t),
200
+ secondary: n.secondary.map((e) => l(e, t))
197
201
  };
198
202
  default:
199
- b(t);
203
+ g(n);
200
204
  }
201
205
  }
202
- const st = { href: "/" }, ut = a.object({
203
- __isRef: a.literal(!0).describe("Crucial marker for the block dependency tree reconstruction"),
204
- blockId: a.string().describe("Upstream block id"),
205
- name: a.string().describe("Name of the output provided to the upstream block's output context")
206
- }).describe(
207
- "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."
208
- ).strict().readonly();
209
- function at(t, n) {
210
- return t.blockId === n.blockId && t.name === n.name;
206
+ function A(n) {
207
+ return k(h(n));
208
+ }
209
+ function x(n, t) {
210
+ return JSON.stringify([n, t]);
211
+ }
212
+ class wn {
213
+ /**
214
+ * Creates a new anchor context from a set of anchor column specifications
215
+ * @param anchors Record of anchor column specifications indexed by anchor ID
216
+ */
217
+ constructor(t) {
218
+ d(this, "domains", /* @__PURE__ */ new Map());
219
+ d(this, "axes", /* @__PURE__ */ new Map());
220
+ /**
221
+ * Domain packs are used to group domain keys that can be anchored to the same anchor
222
+ * This is used to optimize the lookup of domain anchors
223
+ */
224
+ d(this, "domainPacks", []);
225
+ /**
226
+ * Maps domain packs to anchors
227
+ */
228
+ d(this, "domainPackToAnchor", /* @__PURE__ */ new Map());
229
+ this.anchors = t;
230
+ const e = Object.entries(t);
231
+ e.sort((r, o) => r[0].localeCompare(o[0]));
232
+ for (const [r, o] of e) {
233
+ 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 });
236
+ }
237
+ if (o.domain !== void 0) {
238
+ 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);
242
+ this.domains.set(c, r);
243
+ }
244
+ }
245
+ }
246
+ }
247
+ /**
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
252
+ */
253
+ derive(t) {
254
+ const e = {
255
+ name: t.name,
256
+ axes: []
257
+ };
258
+ let r;
259
+ if (t.domain !== void 0)
260
+ 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]);
267
+ else
268
+ break n;
269
+ }
270
+ const a = this.domainPackToAnchor.get(JSON.stringify(i));
271
+ if (a !== void 0) {
272
+ e.domainAnchor = a, r = new Set(o);
273
+ break;
274
+ }
275
+ }
276
+ for (const [o, i] of Object.entries(t.domain ?? {})) {
277
+ if (r !== void 0 && r.has(o))
278
+ continue;
279
+ const a = x(o, i), s = this.domains.get(a);
280
+ e.domain ?? (e.domain = {}), e.domain[o] = s ? { anchor: s } : i;
281
+ }
282
+ return e.axes = t.axesSpec.map((o) => {
283
+ const i = A(o);
284
+ return this.axes.get(i) ?? o;
285
+ }), e;
286
+ }
287
+ /**
288
+ * Derives a canonicalized string representation of an anchored column identifier, can be used as a unique identifier for the column
289
+ * @param spec Column specification to anchor
290
+ * @returns A canonicalized string representation of the anchored column identifier
291
+ */
292
+ deriveCanonical(t) {
293
+ const e = this.derive(t);
294
+ return k(e);
295
+ }
296
+ }
297
+ function An(n, t) {
298
+ const e = { ...t };
299
+ if (e.domainAnchor !== void 0) {
300
+ const r = n[e.domainAnchor];
301
+ if (!r)
302
+ throw new Error(`Anchor "${e.domainAnchor}" not found`);
303
+ const o = r.domain || {};
304
+ e.domain = { ...o, ...e.domain }, delete e.domainAnchor;
305
+ }
306
+ if (e.domain) {
307
+ const r = {};
308
+ for (const [o, i] of Object.entries(e.domain))
309
+ if (typeof i == "string")
310
+ r[o] = i;
311
+ else {
312
+ const a = n[i.anchor];
313
+ if (!a)
314
+ throw new Error(`Anchor "${i.anchor}" not found for domain key "${o}"`);
315
+ if (!a.domain || a.domain[o] === void 0)
316
+ throw new Error(`Domain key "${o}" not found in anchor "${i.anchor}"`);
317
+ r[o] = a.domain[o];
318
+ }
319
+ e.domain = r;
320
+ }
321
+ return e.axes && (e.axes = e.axes.map((r) => Y(n, r))), e;
211
322
  }
212
- function i(t) {
213
- return t.kind === "PColumn";
323
+ function Y(n, t) {
324
+ if (!Z(t))
325
+ return t;
326
+ const e = t.anchor, r = n[e];
327
+ if (!r)
328
+ throw new Error(`Anchor "${e}" not found for axis reference`);
329
+ if ("idx" in t) {
330
+ if (t.idx < 0 || t.idx >= r.axesSpec.length)
331
+ throw new Error(`Axis index ${t.idx} out of bounds for anchor "${e}"`);
332
+ return r.axesSpec[t.idx];
333
+ } else if ("name" in t) {
334
+ const o = r.axesSpec.filter((i) => i.name === t.name);
335
+ if (o.length > 1)
336
+ throw new Error(`Multiple axes with name "${t.name}" found in anchor "${e}"`);
337
+ if (o.length === 0)
338
+ throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
339
+ return o[0];
340
+ } else if ("id" in t) {
341
+ const o = r.axesSpec.filter((i) => z(t.id, h(i)));
342
+ if (o.length > 1)
343
+ throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
344
+ if (o.length === 0)
345
+ throw new Error(`No matching axis found for matcher in anchor "${e}"`);
346
+ return o[0];
347
+ }
348
+ throw new Error("Unsupported axis reference type");
349
+ }
350
+ function Z(n) {
351
+ return typeof n == "object" && "anchor" in n;
214
352
  }
215
- function W(t) {
216
- return i(t.spec);
353
+ function f(n) {
354
+ return n.kind === "PColumn";
217
355
  }
218
- function ct(t) {
219
- return i(t.obj);
356
+ function q(n) {
357
+ return f(n.spec);
220
358
  }
221
- function ft(t) {
222
- return i(t.obj.spec);
359
+ function xn(n) {
360
+ return f(n.obj);
223
361
  }
224
- function dt(t) {
225
- if (!W(t)) throw new Error(`not a PColumn (kind = ${t.spec.kind})`);
226
- return t;
362
+ function Pn(n) {
363
+ return f(n.obj.spec);
227
364
  }
228
- function lt(t, n) {
229
- return t === void 0 ? void 0 : {
230
- ...t,
231
- data: n(t.data)
365
+ function En(n) {
366
+ if (!q(n)) throw new Error(`not a PColumn (kind = ${n.spec.kind})`);
367
+ return n;
368
+ }
369
+ function kn(n, t) {
370
+ return n === void 0 ? void 0 : {
371
+ ...n,
372
+ data: t(n.data)
232
373
  };
233
374
  }
234
- function pt(t) {
235
- const n = /* @__PURE__ */ new Map(), e = (r) => {
375
+ function In(n) {
376
+ const t = /* @__PURE__ */ new Map(), e = (r) => {
236
377
  switch (r.type) {
237
378
  case "column":
238
- n.set(r.column.id, r.column);
379
+ t.set(r.column.id, r.column);
239
380
  return;
240
381
  case "full":
241
382
  case "inner":
@@ -246,145 +387,231 @@ function pt(t) {
246
387
  for (const o of r.secondary) e(o);
247
388
  return;
248
389
  default:
249
- b(r);
390
+ g(r);
250
391
  }
251
392
  };
252
- return e(t), [...n.values()];
393
+ return e(n), [...t.values()];
253
394
  }
254
- function j(t) {
255
- throw new Error("Unexpected object: " + t);
395
+ function v(n) {
396
+ throw new Error("Unexpected object: " + n);
256
397
  }
257
- function m(t, n) {
258
- switch (t.type) {
398
+ function b(n, t) {
399
+ switch (n.type) {
259
400
  case "and":
260
- for (const e of t.operands)
261
- if (!m(e, n)) return !1;
401
+ for (const e of n.operands)
402
+ if (!b(e, t)) return !1;
262
403
  return !0;
263
404
  case "or":
264
- for (const e of t.operands)
265
- if (m(e, n)) return !0;
405
+ for (const e of n.operands)
406
+ if (b(e, t)) return !0;
266
407
  return !1;
267
408
  case "not":
268
- return !m(t.operand, n);
409
+ return !b(n.operand, t);
269
410
  case "name":
270
- return i(n) && n.name === t.name;
411
+ return f(t) && t.name === n.name;
271
412
  case "name_pattern":
272
- return i(n) && !!n.name.match(t.pattern);
413
+ return f(t) && !!t.name.match(n.pattern);
273
414
  case "annotation":
274
- return i(n) && n.annotations !== void 0 && n.annotations[t.annotation] === t.value;
415
+ return f(t) && t.annotations !== void 0 && t.annotations[n.annotation] === n.value;
275
416
  case "annotation_pattern":
276
- return i(n) && n.annotations !== void 0 && n.annotations[t.annotation] !== void 0 && !!n.annotations[t.annotation].match(t.pattern);
417
+ return f(t) && t.annotations !== void 0 && t.annotations[n.annotation] !== void 0 && !!t.annotations[n.annotation].match(n.pattern);
277
418
  case "has_axes":
278
- return i(n) && t.axes.every(
279
- (e) => n.axesSpec.some(
419
+ return f(t) && n.axes.every(
420
+ (e) => t.axesSpec.some(
280
421
  (r) => (e.type === void 0 || e.type === r.type) && (e.name === void 0 || e.name === r.name) && (e.domain === void 0 || Object.keys(e.domain).length === 0 || r.domain !== void 0 && Object.entries(e.domain).every(
281
- ([o, l]) => r.domain[o] === l
422
+ ([o, i]) => r.domain[o] === i
282
423
  ))
283
424
  )
284
425
  );
285
426
  default:
286
- j(t);
427
+ v(n);
428
+ }
429
+ }
430
+ function P(n, t) {
431
+ if (n.name !== void 0 && n.name !== t.name)
432
+ return !1;
433
+ if (n.type !== void 0) {
434
+ if (Array.isArray(n.type)) {
435
+ if (!n.type.includes(t.type))
436
+ return !1;
437
+ } else if (n.type !== t.type)
438
+ return !1;
439
+ }
440
+ if (n.domain !== void 0) {
441
+ const e = t.domain || {};
442
+ for (const [r, o] of Object.entries(n.domain))
443
+ if (e[r] !== o)
444
+ return !1;
445
+ }
446
+ return !0;
447
+ }
448
+ function E(n, t) {
449
+ if (t.name !== void 0 && n.name !== t.name || t.namePattern !== void 0 && !new RegExp(t.namePattern).test(n.name))
450
+ return !1;
451
+ if (t.type !== void 0) {
452
+ if (Array.isArray(t.type)) {
453
+ if (!t.type.includes(n.valueType))
454
+ return !1;
455
+ } else if (t.type !== n.valueType)
456
+ return !1;
457
+ }
458
+ if (t.domain !== void 0) {
459
+ const e = n.domain || {};
460
+ for (const [r, o] of Object.entries(t.domain))
461
+ if (e[r] !== o)
462
+ return !1;
463
+ }
464
+ if (t.axes !== void 0) {
465
+ const e = n.axesSpec.map(h);
466
+ if (t.partialAxesMatch) {
467
+ for (const r of t.axes)
468
+ if (!e.some((o) => P(r, o)))
469
+ return !1;
470
+ } else {
471
+ if (e.length !== t.axes.length)
472
+ return !1;
473
+ for (let r = 0; r < t.axes.length; r++)
474
+ if (!P(t.axes[r], e[r]))
475
+ return !1;
476
+ }
287
477
  }
478
+ if (t.annotations !== void 0) {
479
+ const e = n.annotations || {};
480
+ for (const [r, o] of Object.entries(t.annotations))
481
+ if (e[r] !== o)
482
+ return !1;
483
+ }
484
+ if (t.annotationPatterns !== void 0) {
485
+ const e = n.annotations || {};
486
+ for (const [r, o] of Object.entries(t.annotationPatterns)) {
487
+ const i = e[r];
488
+ if (i === void 0 || !new RegExp(o).test(i))
489
+ return !1;
490
+ }
491
+ }
492
+ return !0;
493
+ }
494
+ function Nn(n) {
495
+ return Array.isArray(n) ? (t) => n.some((e) => f(t) && E(t, e)) : (t) => f(t) && E(t, n);
496
+ }
497
+ const Cn = { href: "/" }, Vn = 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")
501
+ }).describe(
502
+ "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
+ ).strict().readonly();
504
+ function Sn(n) {
505
+ return typeof n == "object" && n !== null && "__isRef" in n && n.__isRef === !0 && "blockId" in n && "name" in n;
506
+ }
507
+ function $n(n, t) {
508
+ return n.blockId === t.blockId && n.name === t.name;
288
509
  }
289
- function mt(t, n) {
290
- return t.ok ? { ok: !0, value: n(t.value) } : t;
510
+ function Fn(n, t) {
511
+ return n.ok ? { ok: !0, value: t(n.value) } : n;
291
512
  }
292
- function M(t) {
293
- if (t instanceof Int8Array || t instanceof Uint8Array || t instanceof Uint8ClampedArray)
294
- return new DataView(t.buffer, t.byteOffset, t.byteLength);
295
- if (t instanceof ArrayBuffer) return new DataView(t);
513
+ function nn(n) {
514
+ if (n instanceof Int8Array || n instanceof Uint8Array || n instanceof Uint8ClampedArray)
515
+ return new DataView(n.buffer, n.byteOffset, n.byteLength);
516
+ if (n instanceof ArrayBuffer) return new DataView(n);
296
517
  throw new TypeError(
297
518
  "Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray"
298
519
  );
299
520
  }
300
- const K = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", X = "0123456789ABCDEFGHIJKLMNOPQRSTUV", G = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
301
- function P(t, n, e) {
521
+ const tn = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", en = "0123456789ABCDEFGHIJKLMNOPQRSTUV", rn = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
522
+ function C(n, t, e) {
302
523
  e = e || {};
303
524
  let r, o;
304
- switch (n) {
525
+ switch (t) {
305
526
  case "RFC3548":
306
527
  case "RFC4648":
307
- r = K, o = !0;
528
+ r = tn, o = !0;
308
529
  break;
309
530
  case "RFC4648-HEX":
310
- r = X, o = !0;
531
+ r = en, o = !0;
311
532
  break;
312
533
  case "Crockford":
313
- r = G, o = !1;
534
+ r = rn, o = !1;
314
535
  break;
315
536
  default:
316
- throw new Error("Unknown base32 variant: " + n);
537
+ throw new Error("Unknown base32 variant: " + t);
317
538
  }
318
- const l = e.padding !== void 0 ? e.padding : o, y = M(t);
539
+ const i = e.padding !== void 0 ? e.padding : o, a = nn(n);
319
540
  let s = 0, c = 0, u = "";
320
- for (let p = 0; p < y.byteLength; p++)
321
- for (c = c << 8 | y.getUint8(p), s += 8; s >= 5; )
541
+ for (let y = 0; y < a.byteLength; y++)
542
+ for (c = c << 8 | a.getUint8(y), s += 8; s >= 5; )
322
543
  u += r[c >>> s - 5 & 31], s -= 5;
323
- if (s > 0 && (u += r[c << 5 - s & 31]), l)
544
+ if (s > 0 && (u += r[c << 5 - s & 31]), i)
324
545
  for (; u.length % 8 !== 0; )
325
546
  u += "=";
326
547
  return u;
327
548
  }
328
- const N = 15, Q = 24, A = a.string().length(Q).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
329
- function bt() {
330
- const t = new Uint8Array(N);
331
- return crypto.getRandomValues(t), A.parse(P(t, "RFC4648"));
549
+ const V = 15, on = 24, S = m.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
550
+ function Dn() {
551
+ const n = new Uint8Array(V);
552
+ return crypto.getRandomValues(n), S.parse(C(n, "RFC4648"));
332
553
  }
333
- function T(t) {
334
- if (t.length !== N) throw new Error(`Wrong number of bytes: ${t.length}`);
335
- return A.parse(P(t, "RFC4648"));
554
+ function an(n) {
555
+ if (n.length !== V) throw new Error(`Wrong number of bytes: ${n.length}`);
556
+ return S.parse(C(n, "RFC4648"));
336
557
  }
337
- async function yt(t) {
338
- const n = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", n.encode(t));
339
- return T(new Uint8Array(e.slice(0, 15)));
558
+ async function Un(n) {
559
+ const t = new TextEncoder(), e = await crypto.subtle.digest("SHA-256", t.encode(n));
560
+ return an(new Uint8Array(e.slice(0, 15)));
340
561
  }
341
562
  export {
342
- st as DefaultNavigationState,
343
- O as PTableAbsent,
344
- H as PTableNA,
345
- k as PValueBytesNA,
346
- R as PValueDoubleNA,
347
- x as PValueFloatNA,
348
- F as PValueIntNA,
349
- g as PValueLongNA,
350
- U as PValueStringNA,
351
- A as PlId,
352
- N as PlIdBytes,
353
- Q as PlIdLength,
354
- ut as PlRef,
355
- yt as digestPlId,
356
- q as ensureNotNAPValue,
357
- dt as ensurePColumn,
358
- m as executePSpecPredicate,
359
- pt as extractAllColumns,
360
- rt as getAxesId,
361
- J as getAxisId,
362
- z as getFileNameFromHandle,
363
- C as getFilePathFromHandle,
364
- I as isImportFileHandleIndex,
365
- E as isImportFileHandleUpload,
366
- Z as isLiveLog,
367
- B as isNotNAPValue,
368
- W as isPColumn,
369
- ft as isPColumnResult,
370
- i as isPColumnSpec,
371
- ct as isPColumnSpecResult,
372
- nt as isPTableAbsent,
373
- S as isPValue,
374
- L as isValueAbsent,
375
- d as isValueNA,
376
- f as mapJoinEntry,
377
- lt as mapPObjectData,
378
- it as mapPTableDef,
379
- mt as mapValueInVOE,
380
- ot as matchAxisId,
381
- et as pTableValue,
382
- tt as pValueToStringOrNumber,
383
- $ as pValueToStringOrNumberOrNull,
384
- T as plId,
385
- at as plRefsEqual,
386
- D as safeConvertToPValue,
387
- v as toJsonSafePValue,
388
- bt as uniquePlId
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
+ S as PlId,
574
+ V as PlIdBytes,
575
+ on as PlIdLength,
576
+ Vn as PlRef,
577
+ Un as digestPlId,
578
+ mn as ensureNotNAPValue,
579
+ En as ensurePColumn,
580
+ 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,
590
+ q as isPColumn,
591
+ Pn as isPColumnResult,
592
+ f as isPColumnSpec,
593
+ xn as isPColumnSpecResult,
594
+ hn as isPTableAbsent,
595
+ J as isPValue,
596
+ Sn as isPlRef,
597
+ W as isValueAbsent,
598
+ p as isValueNA,
599
+ 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
389
616
  };
390
617
  //# sourceMappingURL=index.mjs.map