@milaboratories/milaboratories.ui-examples.model 1.1.37 → 1.1.39

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/bundle.js CHANGED
@@ -35,7 +35,7 @@
35
35
  }, "");
36
36
  return `{${values}}`;
37
37
  };
38
- const g = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
38
+ const Pe = /* @__PURE__ */ getDefaultExportFromCjs(canonicalize);
39
39
  var util;
40
40
  (function(util2) {
41
41
  util2.assertEqual = (val) => val;
@@ -3103,7 +3103,7 @@
3103
3103
  });
3104
3104
  }
3105
3105
  const params = { errorMap: ctx.common.contextualErrorMap };
3106
- const fn = ctx.data;
3106
+ const fn2 = ctx.data;
3107
3107
  if (this._def.returns instanceof ZodPromise) {
3108
3108
  const me = this;
3109
3109
  return OK(async function(...args) {
@@ -3112,7 +3112,7 @@
3112
3112
  error.addIssue(makeArgsIssue(args, e));
3113
3113
  throw error;
3114
3114
  });
3115
- const result = await Reflect.apply(fn, this, parsedArgs);
3115
+ const result = await Reflect.apply(fn2, this, parsedArgs);
3116
3116
  const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3117
3117
  error.addIssue(makeReturnsIssue(result, e));
3118
3118
  throw error;
@@ -3126,7 +3126,7 @@
3126
3126
  if (!parsedArgs.success) {
3127
3127
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3128
3128
  }
3129
- const result = Reflect.apply(fn, this, parsedArgs.data);
3129
+ const result = Reflect.apply(fn2, this, parsedArgs.data);
3130
3130
  const parsedReturns = me._def.returns.safeParse(result, params);
3131
3131
  if (!parsedReturns.success) {
3132
3132
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
@@ -3832,7 +3832,7 @@
3832
3832
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3833
3833
  };
3834
3834
  const NEVER = INVALID;
3835
- var z$2 = /* @__PURE__ */ Object.freeze({
3835
+ var z$1 = /* @__PURE__ */ Object.freeze({
3836
3836
  __proto__: null,
3837
3837
  defaultErrorMap: errorMap,
3838
3838
  setErrorMap,
@@ -3948,13 +3948,13 @@
3948
3948
  quotelessJson,
3949
3949
  ZodError
3950
3950
  });
3951
- var $$1 = Object.defineProperty;
3952
- var L = (n2, t, e) => t in n2 ? $$1(n2, t, { enumerable: true, configurable: true, writable: true, value: e }) : n2[t] = e;
3953
- var p$1 = (n2, t, e) => L(n2, typeof t != "symbol" ? t + "" : t, e);
3951
+ var $ = Object.defineProperty;
3952
+ var L$1 = (n2, t, e) => t in n2 ? $(n2, t, { enumerable: true, configurable: true, writable: true, value: e }) : n2[t] = e;
3953
+ var p$1 = (n2, t, e) => L$1(n2, typeof t != "symbol" ? t + "" : t, e);
3954
3954
  function w(n2) {
3955
3955
  throw new Error("Unexpected object: " + n2);
3956
3956
  }
3957
- function dn(n2) {
3957
+ function pn(n2) {
3958
3958
  if (!n2 || typeof n2 != "object")
3959
3959
  return false;
3960
3960
  const t = n2;
@@ -3971,7 +3971,7 @@
3971
3971
  return false;
3972
3972
  }
3973
3973
  }
3974
- function pn(n2, t) {
3974
+ function mn(n2, t) {
3975
3975
  if (n2 !== void 0)
3976
3976
  switch (n2.type) {
3977
3977
  case "Json":
@@ -3999,7 +3999,55 @@
3999
3999
  }
4000
4000
  }
4001
4001
  }
4002
+ function j(n2) {
4003
+ if (!n2 || typeof n2 != "object")
4004
+ return false;
4005
+ const t = n2;
4006
+ if (!("type" in t))
4007
+ return false;
4008
+ switch (t.type) {
4009
+ case "Json":
4010
+ return typeof t.keyLength == "number" && Array.isArray(t.data);
4011
+ case "JsonPartitioned":
4012
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
4013
+ case "BinaryPartitioned":
4014
+ return typeof t.partitionKeyLength == "number" && Array.isArray(t.parts);
4015
+ default:
4016
+ return false;
4017
+ }
4018
+ }
4019
+ function yn(n2) {
4020
+ return j(n2) ? n2.type === "JsonPartitioned" || n2.type === "BinaryPartitioned" : false;
4021
+ }
4002
4022
  function ln(n2) {
4023
+ switch (n2.type) {
4024
+ case "Json": {
4025
+ const t = Object.entries(n2.data).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4026
+ return {
4027
+ type: "Json",
4028
+ keyLength: n2.keyLength,
4029
+ data: t
4030
+ };
4031
+ }
4032
+ case "JsonPartitioned": {
4033
+ const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4034
+ return {
4035
+ type: "JsonPartitioned",
4036
+ partitionKeyLength: n2.partitionKeyLength,
4037
+ parts: t
4038
+ };
4039
+ }
4040
+ case "BinaryPartitioned": {
4041
+ const t = Object.entries(n2.parts).map(([e, r]) => ({ key: JSON.parse(e), value: r }));
4042
+ return {
4043
+ type: "BinaryPartitioned",
4044
+ partitionKeyLength: n2.partitionKeyLength,
4045
+ parts: t
4046
+ };
4047
+ }
4048
+ }
4049
+ }
4050
+ function hn(n2) {
4003
4051
  switch (n2.type) {
4004
4052
  case "Json": {
4005
4053
  const t = {};
@@ -4037,20 +4085,20 @@
4037
4085
  const { type: t, name: e, domain: r } = n2;
4038
4086
  return { type: t, name: e, ...r && { domain: r } };
4039
4087
  }
4040
- function Sn(n2) {
4041
- return g(y(n2));
4088
+ function En(n2) {
4089
+ return Pe(y(n2));
4042
4090
  }
4043
- function W(n2, t) {
4091
+ function X$1(n2, t) {
4044
4092
  if (n2 === void 0) return t === void 0;
4045
4093
  if (t === void 0) return true;
4046
4094
  for (const e in t)
4047
4095
  if (n2[e] !== t[e]) return false;
4048
4096
  return true;
4049
4097
  }
4050
- function X(n2, t) {
4051
- return n2.name === t.name && W(n2.domain, t.domain);
4098
+ function z(n2, t) {
4099
+ return n2.name === t.name && X$1(n2.domain, t.domain);
4052
4100
  }
4053
- function En(n2, t) {
4101
+ function Cn(n2, t) {
4054
4102
  return { ...n2, src: l$1(n2.src, t) };
4055
4103
  }
4056
4104
  function l$1(n2, t) {
@@ -4083,11 +4131,11 @@
4083
4131
  w(n2);
4084
4132
  }
4085
4133
  }
4086
- function z$1(n2) {
4087
- return g(n2);
4134
+ function G(n2) {
4135
+ return Pe(n2);
4088
4136
  }
4089
- function P(n2) {
4090
- return g(y(n2));
4137
+ function A(n2) {
4138
+ return Pe(y(n2));
4091
4139
  }
4092
4140
  function x(n2, t) {
4093
4141
  return JSON.stringify([n2, t]);
@@ -4107,7 +4155,7 @@
4107
4155
  e.sort((r, o) => r[0].localeCompare(o[0]));
4108
4156
  for (const [r, o] of e) {
4109
4157
  for (let i = 0; i < o.axesSpec.length; i++) {
4110
- const a = o.axesSpec[i], s2 = P(a);
4158
+ const a = o.axesSpec[i], s2 = A(a);
4111
4159
  this.axes.set(s2, { anchor: r, idx: i });
4112
4160
  }
4113
4161
  if (o.domain !== void 0) {
@@ -4153,7 +4201,7 @@
4153
4201
  r.domain ?? (r.domain = {}), r.domain[a] = c2 ? { anchor: c2 } : s2;
4154
4202
  }
4155
4203
  if (r.axes = t.axesSpec.map((a) => {
4156
- const s2 = P(a);
4204
+ const s2 = A(a);
4157
4205
  return this.axes.get(s2) ?? a;
4158
4206
  }), !e || e.length === 0)
4159
4207
  return r;
@@ -4183,10 +4231,10 @@
4183
4231
  * @returns A canonicalized string representation of the anchored column identifier
4184
4232
  */
4185
4233
  deriveS(t, e) {
4186
- return z$1(this.derive(t, e));
4234
+ return G(this.derive(t, e));
4187
4235
  }
4188
4236
  }
4189
- function Jn(n2, t) {
4237
+ function $n(n2, t) {
4190
4238
  const e = { ...t };
4191
4239
  if (e.domainAnchor !== void 0) {
4192
4240
  const r = n2[e.domainAnchor];
@@ -4210,10 +4258,10 @@
4210
4258
  }
4211
4259
  e.domain = r;
4212
4260
  }
4213
- return e.axes && (e.axes = e.axes.map((r) => G(n2, r))), e;
4261
+ return e.axes && (e.axes = e.axes.map((r) => Q(n2, r))), e;
4214
4262
  }
4215
- function G(n2, t) {
4216
- if (!Q$1(t))
4263
+ function Q(n2, t) {
4264
+ if (!Y$1(t))
4217
4265
  return t;
4218
4266
  const e = t.anchor, r = n2[e];
4219
4267
  if (!r)
@@ -4230,7 +4278,7 @@
4230
4278
  throw new Error(`Axis with name "${t.name}" not found in anchor "${e}"`);
4231
4279
  return o[0];
4232
4280
  } else if ("id" in t) {
4233
- const o = r.axesSpec.filter((i) => X(t.id, y(i)));
4281
+ const o = r.axesSpec.filter((i) => z(t.id, y(i)));
4234
4282
  if (o.length > 1)
4235
4283
  throw new Error(`Multiple matching axes found for matcher in anchor "${e}"`);
4236
4284
  if (o.length === 0)
@@ -4239,20 +4287,20 @@
4239
4287
  }
4240
4288
  throw new Error("Unsupported axis reference type");
4241
4289
  }
4242
- function Q$1(n2) {
4290
+ function Y$1(n2) {
4243
4291
  return typeof n2 == "object" && "anchor" in n2;
4244
4292
  }
4245
4293
  function f(n2) {
4246
4294
  return n2.kind === "PColumn";
4247
4295
  }
4248
- function Y$1(n2) {
4296
+ function Z$1(n2) {
4249
4297
  return f(n2.spec);
4250
4298
  }
4251
- function Dn(n2) {
4252
- if (!Y$1(n2)) throw new Error(`not a PColumn (kind = ${n2.spec.kind})`);
4299
+ function In(n2) {
4300
+ if (!Z$1(n2)) throw new Error(`not a PColumn (kind = ${n2.spec.kind})`);
4253
4301
  return n2;
4254
4302
  }
4255
- function In(n2, t) {
4303
+ function Bn(n2, t) {
4256
4304
  return n2 === void 0 ? void 0 : {
4257
4305
  ...n2,
4258
4306
  data: t(n2.data)
@@ -4345,24 +4393,24 @@
4345
4393
  }
4346
4394
  return true;
4347
4395
  }
4348
- function Bn(n2) {
4396
+ function Fn(n2) {
4349
4397
  return Array.isArray(n2) ? (t) => n2.some((e) => f(t) && N(t, e)) : (t) => f(t) && N(t, n2);
4350
4398
  }
4351
- z$2.object({
4352
- __isRef: z$2.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4353
- blockId: z$2.string().describe("Upstream block id"),
4354
- name: z$2.string().describe("Name of the output provided to the upstream block's output context")
4399
+ z$1.object({
4400
+ __isRef: z$1.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
4401
+ blockId: z$1.string().describe("Upstream block id"),
4402
+ name: z$1.string().describe("Name of the output provided to the upstream block's output context")
4355
4403
  }).describe(
4356
4404
  "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."
4357
4405
  ).strict().readonly();
4358
- function Kn(n2) {
4406
+ function Rn(n2) {
4359
4407
  return typeof n2 == "object" && n2 !== null && "__isRef" in n2 && n2.__isRef === true && "blockId" in n2 && "name" in n2;
4360
4408
  }
4361
- function Mn(n2, t) {
4409
+ function _n(n2, t) {
4362
4410
  return n2.ok ? { ok: true, value: t(n2.value) } : n2;
4363
4411
  }
4364
- const rn = 24;
4365
- z$2.string().length(rn).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4412
+ const on = 24;
4413
+ z$1.string().length(on).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
4366
4414
  var stringify = { exports: {} };
4367
4415
  (function(module2, exports3) {
4368
4416
  exports3 = module2.exports = stringify2;
@@ -4387,82 +4435,82 @@
4387
4435
  };
4388
4436
  }
4389
4437
  })(stringify, stringify.exports);
4390
- const l = z$2.object({
4391
- type: z$2.literal("PlError"),
4392
- name: z$2.string(),
4393
- message: z$2.string(),
4438
+ const l = z$1.object({
4439
+ type: z$1.literal("PlError"),
4440
+ name: z$1.string(),
4441
+ message: z$1.string(),
4394
4442
  /** The message with all details needed for SDK developers. */
4395
- fullMessage: z$2.string().optional(),
4396
- stack: z$2.string().optional()
4443
+ fullMessage: z$1.string().optional(),
4444
+ stack: z$1.string().optional()
4397
4445
  }), c = l.extend({
4398
- cause: z$2.lazy(() => s).optional(),
4399
- errors: z$2.lazy(() => s.array()).optional()
4400
- }), m = z$2.object({
4401
- type: z$2.literal("StandardError"),
4402
- name: z$2.string(),
4403
- message: z$2.string(),
4404
- stack: z$2.string().optional()
4405
- }), p = m.extend({
4406
- cause: z$2.lazy(() => s).optional(),
4407
- errors: z$2.lazy(() => s.array()).optional()
4408
- }), s = z$2.union([p, c]);
4409
- const u = z$2.object({
4410
- name: z$2.string(),
4411
- message: z$2.string(),
4412
- fullMessage: z$2.string().optional(),
4413
- stack: z$2.string().optional()
4446
+ cause: z$1.lazy(() => s).optional(),
4447
+ errors: z$1.lazy(() => s.array()).optional()
4448
+ }), m$1 = z$1.object({
4449
+ type: z$1.literal("StandardError"),
4450
+ name: z$1.string(),
4451
+ message: z$1.string(),
4452
+ stack: z$1.string().optional()
4453
+ }), p = m$1.extend({
4454
+ cause: z$1.lazy(() => s).optional(),
4455
+ errors: z$1.lazy(() => s.array()).optional()
4456
+ }), s = z$1.union([p, c]);
4457
+ const u = z$1.object({
4458
+ name: z$1.string(),
4459
+ message: z$1.string(),
4460
+ fullMessage: z$1.string().optional(),
4461
+ stack: z$1.string().optional()
4414
4462
  }), n = u.extend({
4415
- cause: z$2.lazy(() => n).optional(),
4416
- errors: z$2.lazy(() => n.array()).optional()
4463
+ cause: z$1.lazy(() => n).optional(),
4464
+ errors: z$1.lazy(() => n.array()).optional()
4417
4465
  });
4418
- var _e = Object.defineProperty;
4419
- var Ie = (t, e, n2) => e in t ? _e(t, e, { enumerable: true, configurable: true, writable: true, value: n2 }) : t[e] = n2;
4420
- var F = (t, e, n2) => Ie(t, typeof e != "symbol" ? e + "" : e, n2);
4421
- function Y(t) {
4466
+ var je = Object.defineProperty;
4467
+ var Ke = (t, e, n2) => e in t ? je(t, e, { enumerable: true, configurable: true, writable: true, value: n2 }) : t[e] = n2;
4468
+ var L = (t, e, n2) => Ke(t, typeof e != "symbol" ? e + "" : e, n2);
4469
+ function Z(t) {
4422
4470
  return { type: "Immediate", value: t };
4423
4471
  }
4424
- function Ke() {
4472
+ function Xe() {
4425
4473
  return typeof globalThis.getPlatforma < "u" || typeof globalThis.platforma < "u";
4426
4474
  }
4427
- function be(t) {
4475
+ function _e(t) {
4428
4476
  if (t && typeof globalThis.getPlatforma == "function")
4429
4477
  return globalThis.getPlatforma(t);
4430
4478
  if (typeof globalThis.platforma < "u") return globalThis.platforma;
4431
4479
  throw new Error("Can't get platforma instance.");
4432
4480
  }
4433
- function Je() {
4481
+ function Qe() {
4434
4482
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4435
4483
  }
4436
- function h() {
4484
+ function m() {
4437
4485
  if (typeof globalThis.cfgRenderCtx < "u") return globalThis.cfgRenderCtx;
4438
4486
  throw new Error("Not in config rendering context");
4439
4487
  }
4440
- function q(t, e) {
4441
- const n2 = Je();
4488
+ function Y(t, e) {
4489
+ const n2 = Qe();
4442
4490
  if (n2 === void 0) return false;
4443
4491
  if (t in n2.callbackRegistry) throw new Error(`Callback with key ${t} already registered.`);
4444
4492
  return n2.callbackRegistry[t] = e, true;
4445
4493
  }
4446
- const ne = /* @__PURE__ */ new Map();
4447
- function Ne(t, e) {
4448
- t in h().callbackRegistry || (h().callbackRegistry[t] = (n2) => {
4449
- for (const r of ne.get(t))
4494
+ const ae = /* @__PURE__ */ new Map();
4495
+ function Ze(t, e) {
4496
+ t in m().callbackRegistry || (m().callbackRegistry[t] = (n2) => {
4497
+ for (const r of ae.get(t))
4450
4498
  r(n2);
4451
- }, ne.set(t, [])), ne.get(t).push(e);
4499
+ }, ae.set(t, [])), ae.get(t).push(e);
4452
4500
  }
4453
- class S {
4501
+ class C {
4454
4502
  constructor(e, n2 = (r) => r) {
4455
- F(this, "isResolved", false);
4456
- F(this, "resolvedValue");
4457
- this.handle = e, this.postProcess = n2, Ne(e, (r) => {
4503
+ L(this, "isResolved", false);
4504
+ L(this, "resolvedValue");
4505
+ this.handle = e, this.postProcess = n2, Ze(e, (r) => {
4458
4506
  this.resolvedValue = n2(r), this.isResolved = true;
4459
4507
  });
4460
4508
  }
4461
4509
  map(e) {
4462
- return new S(this.handle, (n2) => e(this.postProcess(n2)));
4510
+ return new C(this.handle, (n2) => e(this.postProcess(n2)));
4463
4511
  }
4464
4512
  mapDefined(e) {
4465
- return new S(this.handle, (n2) => {
4513
+ return new C(this.handle, (n2) => {
4466
4514
  const r = this.postProcess(n2);
4467
4515
  return r ? e(r) : void 0;
4468
4516
  });
@@ -4471,10 +4519,10 @@
4471
4519
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
4472
4520
  }
4473
4521
  }
4474
- function ie(t, e) {
4522
+ function pe(t, e) {
4475
4523
  return t === void 0 ? void 0 : e(t);
4476
4524
  }
4477
- class I {
4525
+ class _ {
4478
4526
  constructor(e, n2) {
4479
4527
  this.handle = e, this.resolvePath = n2;
4480
4528
  }
@@ -4513,47 +4561,47 @@
4513
4561
  ...this.resolvePath,
4514
4562
  ...n2.map((i) => typeof i == "string" ? i : i.field)
4515
4563
  ];
4516
- return ie(
4517
- h().resolveWithCommon(this.handle, e, ...n2),
4518
- (i) => new I(i, r)
4564
+ return pe(
4565
+ m().resolveWithCommon(this.handle, e, ...n2),
4566
+ (i) => new _(i, r)
4519
4567
  );
4520
4568
  }
4521
4569
  get resourceType() {
4522
- return h().getResourceType(this.handle);
4570
+ return m().getResourceType(this.handle);
4523
4571
  }
4524
4572
  getInputsLocked() {
4525
- return h().getInputsLocked(this.handle);
4573
+ return m().getInputsLocked(this.handle);
4526
4574
  }
4527
4575
  getOutputsLocked() {
4528
- return h().getOutputsLocked(this.handle);
4576
+ return m().getOutputsLocked(this.handle);
4529
4577
  }
4530
4578
  getIsReadyOrError() {
4531
- return h().getIsReadyOrError(this.handle);
4579
+ return m().getIsReadyOrError(this.handle);
4532
4580
  }
4533
4581
  getIsFinal() {
4534
- return h().getIsFinal(this.handle);
4582
+ return m().getIsFinal(this.handle);
4535
4583
  }
4536
4584
  getError() {
4537
4585
  const e = [...this.resolvePath, "error"];
4538
- return ie(
4539
- h().getError(this.handle),
4540
- (n2) => new I(n2, e)
4586
+ return pe(
4587
+ m().getError(this.handle),
4588
+ (n2) => new _(n2, e)
4541
4589
  );
4542
4590
  }
4543
4591
  listInputFields() {
4544
- return h().listInputFields(this.handle);
4592
+ return m().listInputFields(this.handle);
4545
4593
  }
4546
4594
  listOutputFields() {
4547
- return h().listOutputFields(this.handle);
4595
+ return m().listOutputFields(this.handle);
4548
4596
  }
4549
4597
  listDynamicFields() {
4550
- return h().listDynamicFields(this.handle);
4598
+ return m().listDynamicFields(this.handle);
4551
4599
  }
4552
4600
  getKeyValueBase64(e) {
4553
- return h().getKeyValueBase64(this.handle, e);
4601
+ return m().getKeyValueBase64(this.handle, e);
4554
4602
  }
4555
4603
  getKeyValueAsString(e) {
4556
- return h().getKeyValueAsString(this.handle, e);
4604
+ return m().getKeyValueAsString(this.handle, e);
4557
4605
  }
4558
4606
  getKeyValueAsJson(e) {
4559
4607
  const n2 = this.getKeyValueAsString(e);
@@ -4561,10 +4609,10 @@
4561
4609
  return JSON.parse(n2);
4562
4610
  }
4563
4611
  getDataBase64() {
4564
- return h().getDataBase64(this.handle);
4612
+ return m().getDataBase64(this.handle);
4565
4613
  }
4566
4614
  getDataAsString() {
4567
- return h().getDataAsString(this.handle);
4615
+ return m().getDataAsString(this.handle);
4568
4616
  }
4569
4617
  getDataAsJson() {
4570
4618
  const e = this.getDataAsString();
@@ -4577,7 +4625,7 @@
4577
4625
  getPColumns(e = false, n2 = "") {
4578
4626
  const r = this.parsePObjectCollection(e, n2);
4579
4627
  return r === void 0 ? void 0 : Object.entries(r).map(([, s2]) => {
4580
- if (!Y$1(s2)) throw new Error(`not a PColumn (kind = ${s2.spec.kind})`);
4628
+ if (!Z$1(s2)) throw new Error(`not a PColumn (kind = ${s2.spec.kind})`);
4581
4629
  return s2;
4582
4630
  });
4583
4631
  }
@@ -4585,7 +4633,7 @@
4585
4633
  *
4586
4634
  */
4587
4635
  parsePObjectCollection(e = false, n2 = "") {
4588
- const r = h().parsePObjectCollection(
4636
+ const r = m().parsePObjectCollection(
4589
4637
  this.handle,
4590
4638
  e,
4591
4639
  n2,
@@ -4595,19 +4643,19 @@
4595
4643
  const i = {};
4596
4644
  for (const [s2, o] of Object.entries(r)) {
4597
4645
  const a = [...this.resolvePath, s2];
4598
- i[s2] = In(o, (c2) => new I(c2, a));
4646
+ i[s2] = Bn(o, (l2) => new _(l2, a));
4599
4647
  }
4600
4648
  return i;
4601
4649
  }
4602
4650
  getFileContentAsBase64() {
4603
- return new S(h().getBlobContentAsBase64(this.handle));
4651
+ return new C(m().getBlobContentAsBase64(this.handle));
4604
4652
  }
4605
4653
  getFileContentAsString() {
4606
- return new S(h().getBlobContentAsString(this.handle));
4654
+ return new C(m().getBlobContentAsString(this.handle));
4607
4655
  }
4608
4656
  getFileContentAsJson() {
4609
- return new S(
4610
- h().getBlobContentAsString(this.handle)
4657
+ return new C(
4658
+ m().getBlobContentAsString(this.handle)
4611
4659
  ).mapDefined((e) => JSON.parse(e));
4612
4660
  }
4613
4661
  /**
@@ -4626,7 +4674,7 @@
4626
4674
  * @returns downloaded file handle
4627
4675
  */
4628
4676
  getFileHandle() {
4629
- return new S(h().getDownloadedBlobContentHandle(this.handle));
4677
+ return new C(m().getDownloadedBlobContentHandle(this.handle));
4630
4678
  }
4631
4679
  /**
4632
4680
  * @deprecated use getFileHandle
@@ -4638,7 +4686,7 @@
4638
4686
  * @returns downloaded file handle
4639
4687
  */
4640
4688
  getRemoteFileHandle() {
4641
- return new S(h().getOnDemandBlobContentHandle(this.handle));
4689
+ return new C(m().getOnDemandBlobContentHandle(this.handle));
4642
4690
  }
4643
4691
  /**
4644
4692
  * @deprecated use getRemoteFileHandle
@@ -4650,22 +4698,22 @@
4650
4698
  * @returns the url to the extracted folder
4651
4699
  */
4652
4700
  extractArchiveAndGetURL(e) {
4653
- return new S(h().extractArchiveAndGetURL(this.handle, e));
4701
+ return new C(m().extractArchiveAndGetURL(this.handle, e));
4654
4702
  }
4655
4703
  getImportProgress() {
4656
- return new S(h().getImportProgress(this.handle));
4704
+ return new C(m().getImportProgress(this.handle));
4657
4705
  }
4658
4706
  getLastLogs(e) {
4659
- return new S(h().getLastLogs(this.handle, e));
4707
+ return new C(m().getLastLogs(this.handle, e));
4660
4708
  }
4661
4709
  getProgressLog(e) {
4662
- return new S(h().getProgressLog(this.handle, e));
4710
+ return new C(m().getProgressLog(this.handle, e));
4663
4711
  }
4664
4712
  getProgressLogWithInfo(e) {
4665
- return new S(h().getProgressLogWithInfo(this.handle, e));
4713
+ return new C(m().getProgressLogWithInfo(this.handle, e));
4666
4714
  }
4667
4715
  getLogHandle() {
4668
- return new S(h().getLogHandle(this.handle));
4716
+ return new C(m().getLogHandle(this.handle));
4669
4717
  }
4670
4718
  allFieldsResolved(e = "Input") {
4671
4719
  switch (e) {
@@ -4688,196 +4736,171 @@
4688
4736
  }, o = e;
4689
4737
  if (i && (r === "Input" && !this.getInputsLocked() || r === "Output" && !this.getOutputsLocked()))
4690
4738
  return;
4691
- let c2 = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4692
- (l2) => [l2, this.resolve({ field: l2, assertFieldType: r })]
4739
+ let l2 = (r === "Input" ? this.listInputFields() : r === "Output" ? this.listOutputFields() : this.listDynamicFields()).map(
4740
+ (u2) => [u2, this.resolve({ field: u2, assertFieldType: r })]
4693
4741
  );
4694
- return s2 && (c2 = c2.filter((l2) => l2[1] !== void 0)), c2.map(([l2, m2]) => o(l2, m2));
4742
+ return s2 && (l2 = l2.filter((u2) => u2[1] !== void 0)), l2.map(([u2, S]) => o(u2, S));
4695
4743
  }
4696
4744
  }
4697
- const ve = "staging", we = "main";
4698
- function Ue(t, e) {
4699
- const n2 = [...e].sort((s2, o) => o[0] - s2[0]);
4700
- if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
4701
- const { partitionKeyLength: s2 } = t;
4702
- for (const [o] of e)
4703
- if (o >= s2)
4704
- throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s2}`);
4705
- } else if (t.type === "Json") {
4706
- const { keyLength: s2 } = t;
4707
- for (const [o] of e)
4708
- if (o >= s2)
4709
- throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s2}`);
4710
- }
4711
- const r = (s2) => {
4712
- for (const [o, a] of n2)
4713
- if (s2[o] !== a)
4714
- return false;
4715
- return true;
4716
- }, i = (s2) => {
4717
- const o = [...s2];
4718
- for (const [a] of n2)
4719
- o.splice(a, 1);
4720
- return o;
4721
- };
4722
- switch (t.type) {
4723
- case "Json": {
4724
- const s2 = t.data.filter((o) => r(o.key)).map((o) => ({
4725
- key: i(o.key),
4726
- value: o.value
4727
- }));
4728
- return {
4729
- type: "Json",
4730
- keyLength: t.keyLength - e.length,
4731
- data: s2
4732
- };
4733
- }
4734
- case "JsonPartitioned": {
4735
- const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
4736
- key: i(o.key),
4737
- value: o.value
4738
- }));
4739
- return {
4740
- type: "JsonPartitioned",
4741
- partitionKeyLength: t.partitionKeyLength - e.length,
4742
- parts: s2
4743
- };
4744
- }
4745
- case "BinaryPartitioned": {
4746
- const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
4747
- key: i(o.key),
4748
- value: o.value
4749
- }));
4750
- return {
4751
- type: "BinaryPartitioned",
4752
- partitionKeyLength: t.partitionKeyLength - e.length,
4753
- parts: s2
4754
- };
4755
- }
4756
- }
4757
- }
4758
- const Me = "pl7.app/label", Ge = "pl7.app/trace", We = z$2.object({
4759
- type: z$2.string(),
4760
- importance: z$2.number().optional(),
4761
- id: z$2.string().optional(),
4762
- label: z$2.string()
4763
- }), He = z$2.array(We), qe = 1e-3, ze = "__LABEL__", pe = "__LABEL__@1";
4764
- function de(t, e, n2 = {}) {
4765
- const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s2 = t.map((f2) => {
4766
- var R, k2;
4767
- const p2 = e(f2);
4768
- let d, y2, g2;
4769
- "spec" in p2 && typeof p2.spec == "object" ? (d = p2.spec, y2 = p2.prefixTrace, g2 = p2.suffixTrace) : d = p2;
4770
- const v = (R = d.annotations) == null ? void 0 : R[Me], w2 = (k2 = d.annotations) == null ? void 0 : k2[Ge], x2 = (w2 ? He.safeParse(JSON.parse(w2)).data : void 0) ?? [], C = [
4771
- ...y2 ?? [],
4772
- ...x2,
4773
- ...g2 ?? []
4745
+ const Ie = "staging", Le = "main";
4746
+ const nt = "pl7.app/label", rt = "pl7.app/trace", it = z$1.object({
4747
+ type: z$1.string(),
4748
+ importance: z$1.number().optional(),
4749
+ id: z$1.string().optional(),
4750
+ label: z$1.string()
4751
+ }), st = z$1.array(it), ot = 1e-3, at = "__LABEL__", ve = "__LABEL__@1";
4752
+ function Ee(t, e, n2 = {}) {
4753
+ const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s2 = t.map((p2) => {
4754
+ var q, D;
4755
+ const c2 = e(p2);
4756
+ let h, A2, y2;
4757
+ "spec" in c2 && typeof c2.spec == "object" ? (h = c2.spec, A2 = c2.prefixTrace, y2 = c2.suffixTrace) : h = c2;
4758
+ const v = (q = h.annotations) == null ? void 0 : q[nt], g = (D = h.annotations) == null ? void 0 : D[rt], P = (g ? st.safeParse(JSON.parse(g)).data : void 0) ?? [], b = [
4759
+ ...A2 ?? [],
4760
+ ...P,
4761
+ ...y2 ?? []
4774
4762
  ];
4775
4763
  if (v) {
4776
- const A = { label: v, type: ze, importance: -2 };
4777
- n2.addLabelAsSuffix ? C.push(A) : C.splice(0, 0, A);
4778
- }
4779
- const P2 = [], T = /* @__PURE__ */ new Map();
4780
- for (let A = C.length - 1; A >= 0; --A) {
4781
- const { type: j } = C[A], V = C[A].importance ?? 0, K = (T.get(j) ?? 0) + 1;
4782
- T.set(j, K);
4783
- const J = `${j}@${K}`;
4784
- i.set(J, (i.get(J) ?? 0) + 1), r.set(
4785
- J,
4764
+ const I = { label: v, type: at, importance: -2 };
4765
+ n2.addLabelAsSuffix ? b.push(I) : b.splice(0, 0, I);
4766
+ }
4767
+ const F = [], $2 = /* @__PURE__ */ new Map();
4768
+ for (let I = b.length - 1; I >= 0; --I) {
4769
+ const { type: R } = b[I], se = b[I].importance ?? 0, J = ($2.get(R) ?? 0) + 1;
4770
+ $2.set(R, J);
4771
+ const w2 = `${R}@${J}`;
4772
+ i.set(w2, (i.get(w2) ?? 0) + 1), r.set(
4773
+ w2,
4786
4774
  Math.max(
4787
- r.get(J) ?? Number.NEGATIVE_INFINITY,
4788
- V - (C.length - A) * qe
4775
+ r.get(w2) ?? Number.NEGATIVE_INFINITY,
4776
+ se - (b.length - I) * ot
4789
4777
  )
4790
- ), P2.push({ ...C[A], fullType: J, occurenceIndex: K });
4778
+ ), F.push({ ...b[I], fullType: w2, occurenceIndex: J });
4791
4779
  }
4792
- return P2.reverse(), {
4793
- value: f2,
4794
- spec: d,
4780
+ return F.reverse(), {
4781
+ value: p2,
4782
+ spec: h,
4795
4783
  label: v,
4796
- fullTrace: P2
4797
- };
4798
- }), o = [], a = [], c2 = [...r];
4799
- c2.sort(([, f2], [, p2]) => p2 - f2);
4800
- for (const [f2] of c2)
4801
- f2.endsWith("@1") || i.get(f2) === t.length ? o.push(f2) : a.push(f2);
4802
- const l2 = (f2) => s2.map((p2) => {
4803
- const d = p2.fullTrace.filter((g2) => f2.has(g2.fullType)).map((g2) => g2.label), y2 = n2.separator ?? " / ";
4804
- return {
4805
- label: d.join(y2),
4806
- value: p2.value
4784
+ fullTrace: F
4807
4785
  };
4808
- });
4786
+ }), o = [], a = [], l2 = [...r];
4787
+ l2.sort(([, p2], [, c2]) => c2 - p2);
4788
+ for (const [p2] of l2)
4789
+ p2.endsWith("@1") || i.get(p2) === t.length ? o.push(p2) : a.push(p2);
4790
+ const u2 = (p2) => {
4791
+ const c2 = [];
4792
+ for (let h = 0; h < s2.length; h++) {
4793
+ const A2 = s2[h], y2 = A2.fullTrace.filter((P) => p2.has(P.fullType));
4794
+ if (y2.length === 0)
4795
+ return;
4796
+ const v = y2.map((P) => P.label), g = n2.separator ?? " / ";
4797
+ c2.push({
4798
+ label: v.join(g),
4799
+ value: A2.value
4800
+ });
4801
+ }
4802
+ return c2;
4803
+ };
4809
4804
  if (o.length === 0) {
4810
4805
  if (a.length !== 0) throw new Error("Assertion error.");
4811
- return l2(new Set(pe));
4812
- }
4813
- let m2 = 0, u2 = 0;
4814
- for (; m2 < o.length; ) {
4815
- const f2 = /* @__PURE__ */ new Set();
4816
- n2.includeNativeLabel && f2.add(pe);
4817
- for (let d = 0; d < m2; ++d) f2.add(o[d]);
4818
- f2.add(o[u2]);
4819
- const p2 = l2(f2);
4820
- if (new Set(p2.map((d) => d.label)).size === t.length) return p2;
4821
- u2++, u2 == o.length && (m2++, u2 = m2);
4822
- }
4823
- return l2(/* @__PURE__ */ new Set([...o, ...a]));
4806
+ const p2 = u2(new Set(ve));
4807
+ if (p2 === void 0) throw new Error("Assertion error.");
4808
+ return p2;
4809
+ }
4810
+ let S = 0, d = 0;
4811
+ for (; S < o.length; ) {
4812
+ const p2 = /* @__PURE__ */ new Set();
4813
+ n2.includeNativeLabel && p2.add(ve);
4814
+ for (let h = 0; h < S; ++h) p2.add(o[h]);
4815
+ p2.add(o[d]);
4816
+ const c2 = u2(p2);
4817
+ if (c2 !== void 0) {
4818
+ if (new Set(c2.map((h) => h.label)).size === t.length) return c2;
4819
+ d++, d == o.length && (S++, d = S);
4820
+ }
4821
+ }
4822
+ const f2 = u2(/* @__PURE__ */ new Set([...o, ...a]));
4823
+ if (f2 === void 0) throw new Error("Assertion error.");
4824
+ return f2;
4824
4825
  }
4825
- const H = "PColumnData/", Q = H + "ResourceMap", Z = H + "Partitioned/ResourceMap", $ = H + "JsonPartitioned", E = H + "BinaryPartitioned", Ae = H + "Partitioned/", ee = Ae + "JsonPartitioned", B = Ae + "BinaryPartitioned";
4826
- const ae = (t) => {
4826
+ const H = "PColumnData/", te = H + "ResourceMap", ne = H + "Partitioned/ResourceMap", U = H + "JsonPartitioned", V = H + "BinaryPartitioned", Fe = H + "Partitioned/", re = Fe + "JsonPartitioned", B = Fe + "BinaryPartitioned";
4827
+ const fe = (t) => {
4827
4828
  if (t.endsWith(".index"))
4828
4829
  return { baseKey: t.substring(0, t.length - 6), type: "index" };
4829
4830
  if (t.endsWith(".values"))
4830
4831
  return { baseKey: t.substring(0, t.length - 7), type: "values" };
4831
4832
  throw new Error(`key must ends on .index/.values for binary p-column, got: ${t}`);
4832
4833
  };
4833
- function Ye(t) {
4834
+ function lt(t) {
4834
4835
  if (!t) return;
4835
4836
  const e = t.resourceType.name, n2 = t.getDataAsJson(), r = [];
4836
4837
  let i = 0;
4837
4838
  switch (e) {
4838
- case Q:
4839
+ case te:
4839
4840
  i = n2.keyLength;
4840
4841
  break;
4841
- case Z:
4842
+ case ne:
4842
4843
  i = n2.partitionKeyLength + n2.keyLength;
4843
4844
  break;
4844
- case $:
4845
- case E:
4845
+ case U:
4846
+ case V:
4846
4847
  i = n2.partitionKeyLength;
4847
4848
  break;
4848
4849
  case B:
4849
- case ee:
4850
+ case re:
4850
4851
  i = n2.superPartitionKeyLength + n2.partitionKeyLength;
4851
4852
  break;
4852
4853
  }
4853
4854
  switch (e) {
4854
- case Q:
4855
- case $:
4856
- case E:
4855
+ case te:
4856
+ case U:
4857
+ case V:
4857
4858
  for (let s2 of t.listInputFields()) {
4858
- e === E && (s2 = ae(s2).baseKey);
4859
+ e === V && (s2 = fe(s2).baseKey);
4859
4860
  const o = [...JSON.parse(s2)];
4860
4861
  r.push(o);
4861
4862
  }
4862
4863
  break;
4863
- case Z:
4864
+ case ne:
4864
4865
  case B:
4865
- case ee:
4866
+ case re:
4866
4867
  for (const s2 of t.listInputFields()) {
4867
4868
  const o = [...JSON.parse(s2)], a = t.resolve({ field: s2, assertFieldType: "Input" });
4868
4869
  if (a !== void 0)
4869
- for (let c2 of a.listInputFields()) {
4870
- e === B && (c2 = ae(c2).baseKey);
4871
- const l2 = [...o, ...JSON.parse(c2)];
4872
- r.push(l2);
4870
+ for (let l2 of a.listInputFields()) {
4871
+ e === B && (l2 = fe(l2).baseKey);
4872
+ const u2 = [...o, ...JSON.parse(l2)];
4873
+ r.push(u2);
4873
4874
  }
4874
4875
  }
4875
4876
  break;
4876
4877
  }
4877
4878
  return { data: r, keyLength: i };
4878
4879
  }
4879
- function Xe(t) {
4880
- const e = Ye(t);
4880
+ function ut(t) {
4881
+ if (t.type !== "JsonPartitioned" && t.type !== "BinaryPartitioned")
4882
+ throw new Error(`Splitting requires Partitioned DataInfoEntries, got ${t.type}`);
4883
+ const { parts: e, partitionKeyLength: n2 } = t, r = [];
4884
+ for (let i = 0; i < n2; ++i)
4885
+ r.push(/* @__PURE__ */ new Set());
4886
+ for (const i of e) {
4887
+ const s2 = i.key;
4888
+ if (s2.length !== n2)
4889
+ throw new Error(
4890
+ `Key length (${s2.length}) does not match partition length (${n2}) for key: ${JSON.stringify(
4891
+ s2
4892
+ )}`
4893
+ );
4894
+ for (let o = 0; o < n2; ++o)
4895
+ r[o].add(s2[o]);
4896
+ }
4897
+ return r.map((i) => Array.from(i.values()));
4898
+ }
4899
+ function ct(t) {
4900
+ if (t === void 0) return;
4901
+ if (j(t))
4902
+ return ut(t);
4903
+ const e = lt(t);
4881
4904
  if (!e) return;
4882
4905
  const { data: n2, keyLength: r } = e, i = [];
4883
4906
  for (let s2 = 0; s2 < r; ++s2)
@@ -4890,16 +4913,16 @@
4890
4913
  }
4891
4914
  return i.map((s2) => Array.from(s2.values()));
4892
4915
  }
4893
- function le(t, e = []) {
4894
- if (t === void 0) return;
4916
+ function he(t, e = []) {
4917
+ if (t === void 0 || !t.getIsReadyOrError()) return;
4895
4918
  const n2 = t.resourceType.name, r = t.getDataAsJson();
4896
- if (e.length > 0 && (n2 === ee || n2 === B))
4919
+ if (e.length > 0 && (n2 === re || n2 === B))
4897
4920
  throw new Error(`Unexpected nested super-partitioned resource: ${n2}`);
4898
4921
  switch (n2) {
4899
- case Q:
4900
- case Z:
4922
+ case te:
4923
+ case ne:
4901
4924
  throw new Error(`Only data columns are supported, got: ${n2}`);
4902
- case $: {
4925
+ case U: {
4903
4926
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4904
4927
  throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4905
4928
  const i = [];
@@ -4915,21 +4938,21 @@
4915
4938
  parts: i
4916
4939
  };
4917
4940
  }
4918
- case E: {
4941
+ case V: {
4919
4942
  if (typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4920
4943
  throw new Error(`Missing partitionKeyLength in metadata for ${n2}`);
4921
4944
  const i = [], s2 = /* @__PURE__ */ new Map();
4922
4945
  for (const o of t.listInputFields()) {
4923
- const a = ae(o), c2 = t.resolve({ field: o, assertFieldType: "Input" });
4924
- if (c2 === void 0) return;
4925
- let l2 = s2.get(a.baseKey);
4926
- l2 || (l2 = {}, s2.set(a.baseKey, l2)), a.type === "index" ? l2.index = c2 : l2.values = c2;
4946
+ const a = fe(o), l2 = t.resolve({ field: o, assertFieldType: "Input" });
4947
+ if (l2 === void 0) return;
4948
+ let u2 = s2.get(a.baseKey);
4949
+ u2 || (u2 = {}, s2.set(a.baseKey, u2)), a.type === "index" ? u2.index = l2 : u2.values = l2;
4927
4950
  }
4928
4951
  for (const [o, a] of s2.entries()) {
4929
4952
  if (!a.index || !a.values) return;
4930
- const c2 = [...e, ...JSON.parse(o)];
4953
+ const l2 = [...e, ...JSON.parse(o)];
4931
4954
  i.push({
4932
- key: c2,
4955
+ key: l2,
4933
4956
  value: {
4934
4957
  index: a.index,
4935
4958
  values: a.values
@@ -4942,20 +4965,20 @@
4942
4965
  parts: i
4943
4966
  };
4944
4967
  }
4945
- case ee: {
4968
+ case re: {
4946
4969
  if (typeof (r == null ? void 0 : r.superPartitionKeyLength) != "number" || typeof (r == null ? void 0 : r.partitionKeyLength) != "number")
4947
4970
  throw new Error(`Missing superPartitionKeyLength or partitionKeyLength in metadata for ${n2}`);
4948
4971
  const i = r.superPartitionKeyLength + r.partitionKeyLength, s2 = [];
4949
4972
  for (const o of t.listInputFields()) {
4950
4973
  const a = t.resolve({ field: o, assertFieldType: "Input" });
4951
4974
  if (a === void 0) return;
4952
- if (a.resourceType.name !== $)
4953
- throw new Error(`Expected ${$} inside ${n2}, but got ${a.resourceType.name}`);
4954
- const c2 = le(a, JSON.parse(o));
4955
- if (c2 === void 0) return;
4956
- if (c2.type !== "JsonPartitioned")
4957
- throw new Error(`Unexpected inner result type for ${n2}: ${c2.type}`);
4958
- s2.push(...c2.parts);
4975
+ if (a.resourceType.name !== U)
4976
+ throw new Error(`Expected ${U} inside ${n2}, but got ${a.resourceType.name}`);
4977
+ const l2 = he(a, JSON.parse(o));
4978
+ if (l2 === void 0) return;
4979
+ if (l2.type !== "JsonPartitioned")
4980
+ throw new Error(`Unexpected inner result type for ${n2}: ${l2.type}`);
4981
+ s2.push(...l2.parts);
4959
4982
  }
4960
4983
  return {
4961
4984
  type: "JsonPartitioned",
@@ -4970,13 +4993,13 @@
4970
4993
  for (const o of t.listInputFields()) {
4971
4994
  const a = t.resolve({ field: o, assertFieldType: "Input" });
4972
4995
  if (a === void 0) return;
4973
- if (a.resourceType.name !== E)
4974
- throw new Error(`Expected ${E} inside ${n2}, but got ${a.resourceType.name}`);
4975
- const c2 = le(a, JSON.parse(o));
4976
- if (c2 === void 0) return;
4977
- if (c2.type !== "BinaryPartitioned")
4978
- throw new Error(`Unexpected inner result type for ${n2}: ${c2.type}`);
4979
- s2.push(...c2.parts);
4996
+ if (a.resourceType.name !== V)
4997
+ throw new Error(`Expected ${V} inside ${n2}, but got ${a.resourceType.name}`);
4998
+ const l2 = he(a, JSON.parse(o));
4999
+ if (l2 === void 0) return;
5000
+ if (l2.type !== "BinaryPartitioned")
5001
+ throw new Error(`Unexpected inner result type for ${n2}: ${l2.type}`);
5002
+ s2.push(...l2.parts);
4980
5003
  }
4981
5004
  return {
4982
5005
  type: "BinaryPartitioned",
@@ -4988,32 +5011,287 @@
4988
5011
  throw new Error(`Unknown resource type: ${n2}`);
4989
5012
  }
4990
5013
  }
4991
- function re(t, e) {
4992
- if (t === void 0) return e === void 0;
4993
- if (e === void 0) return true;
4994
- for (const n2 in e)
4995
- if (t[n2] !== e[n2]) return false;
4996
- return true;
5014
+ function pt(t) {
5015
+ if (t !== void 0) {
5016
+ if (j(t)) return t;
5017
+ if (pn(t)) return ln(t);
5018
+ if (t instanceof _) return he(t);
5019
+ throw new Error(`Unexpected input type: ${typeof t}`);
5020
+ }
4997
5021
  }
4998
- function fe(t) {
4999
- return In(t, (e) => e instanceof I ? e.handle : dn(e) ? pn(e, (n2) => n2.handle) : e);
5022
+ function dt(t, e) {
5023
+ const n2 = [...e].sort((s2, o) => o[0] - s2[0]);
5024
+ if (t.type === "JsonPartitioned" || t.type === "BinaryPartitioned") {
5025
+ const { partitionKeyLength: s2 } = t;
5026
+ for (const [o] of e)
5027
+ if (o >= s2)
5028
+ throw new Error(`Can't filter on non-partitioned axis ${o}. Must be >= ${s2}`);
5029
+ } else if (t.type === "Json") {
5030
+ const { keyLength: s2 } = t;
5031
+ for (const [o] of e)
5032
+ if (o >= s2)
5033
+ throw new Error(`Can't filter on non-data axis ${o}. Must be >= ${s2}`);
5034
+ }
5035
+ const r = (s2) => {
5036
+ for (const [o, a] of n2)
5037
+ if (s2[o] !== a)
5038
+ return false;
5039
+ return true;
5040
+ }, i = (s2) => {
5041
+ const o = [...s2];
5042
+ for (const [a] of n2)
5043
+ o.splice(a, 1);
5044
+ return o;
5045
+ };
5046
+ switch (t.type) {
5047
+ case "Json": {
5048
+ const s2 = t.data.filter((o) => r(o.key)).map((o) => ({
5049
+ key: i(o.key),
5050
+ value: o.value
5051
+ }));
5052
+ return {
5053
+ type: "Json",
5054
+ keyLength: t.keyLength - e.length,
5055
+ data: s2
5056
+ };
5057
+ }
5058
+ case "JsonPartitioned": {
5059
+ const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
5060
+ key: i(o.key),
5061
+ value: o.value
5062
+ }));
5063
+ return {
5064
+ type: "JsonPartitioned",
5065
+ partitionKeyLength: t.partitionKeyLength - e.length,
5066
+ parts: s2
5067
+ };
5068
+ }
5069
+ case "BinaryPartitioned": {
5070
+ const s2 = t.parts.filter((o) => r(o.key)).map((o) => ({
5071
+ key: i(o.key),
5072
+ value: o.value
5073
+ }));
5074
+ return {
5075
+ type: "BinaryPartitioned",
5076
+ partitionKeyLength: t.partitionKeyLength - e.length,
5077
+ parts: s2
5078
+ };
5079
+ }
5080
+ }
5000
5081
  }
5001
- function Qe(t) {
5082
+ class ft {
5083
+ constructor(e) {
5084
+ this.columns = e;
5085
+ }
5086
+ selectColumns(e) {
5087
+ const n2 = typeof e == "function" ? e : Fn(e);
5088
+ return this.columns.filter((r) => n2(r.spec));
5089
+ }
5090
+ }
5091
+ function ht(t) {
5002
5092
  if (t)
5003
5093
  return t.map((e) => ({
5004
- type: `split:${Sn(e.axisId)}`,
5094
+ type: `split:${En(e.axisId)}`,
5005
5095
  label: e.label,
5006
5096
  importance: 1e6
5007
5097
  // High importance for split filters in labels
5008
5098
  }));
5009
5099
  }
5010
- function Ze(t) {
5100
+ function gt(t) {
5011
5101
  if (t)
5012
5102
  return t.map((e) => [e.axisIdx, e.value]);
5013
5103
  }
5014
- class et {
5104
+ function mt(t, e) {
5105
+ if (!e || e.length === 0) return t;
5106
+ const n2 = [...e].sort((r, i) => r[0] - i[0]);
5107
+ return Pe({ id: t, axisFilters: n2 });
5108
+ }
5109
+ function yt(t) {
5110
+ if (!t || typeof t != "object") return false;
5111
+ const e = t, n2 = 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);
5112
+ return !!e.domainAnchor || n2 || r;
5113
+ }
5114
+ function vt(t) {
5115
+ if (typeof t != "object" || !("axes" in t) || t.axes === void 0)
5116
+ return [];
5117
+ const e = t.axes.map((n2, r) => typeof n2 == "object" && "split" in n2 && n2.split === true ? r : -1).filter((n2) => n2 !== -1);
5118
+ if (e.length > 0 && t.partialAxesMatch !== void 0)
5119
+ throw new Error("Axis splitting is not supported when `partialAxesMatch` is defined.");
5120
+ return e.sort((n2, r) => n2 - r), e;
5121
+ }
5122
+ class be {
5123
+ constructor() {
5124
+ L(this, "defaultProviderStore", []);
5125
+ L(this, "providers", [new ft(this.defaultProviderStore)]);
5126
+ L(this, "axisLabelProviders", []);
5127
+ }
5128
+ addColumnProvider(e) {
5129
+ return this.providers.push(e), this;
5130
+ }
5131
+ addAxisLabelProvider(e) {
5132
+ return this.axisLabelProviders.push(e), this;
5133
+ }
5134
+ addColumns(e) {
5135
+ return this.defaultProviderStore.push(...e), this;
5136
+ }
5137
+ addColumn(e) {
5138
+ return this.defaultProviderStore.push(e), this;
5139
+ }
5140
+ /** Fetches labels for a given axis from the registered providers */
5141
+ findLabels(e) {
5142
+ for (const n2 of this.axisLabelProviders) {
5143
+ const r = n2.findLabels(e);
5144
+ if (r) return r;
5145
+ }
5146
+ }
5147
+ getUniversalEntries(e, n2) {
5148
+ const { anchorCtx: r, labelOps: i, dontWaitAllData: s2 = false, overrideLabelAnnotation: o = false } = n2 ?? {}, a = {
5149
+ ...o && (i == null ? void 0 : i.includeNativeLabel) !== false ? { includeNativeLabel: true } : {},
5150
+ ...i ?? {}
5151
+ }, l2 = typeof e == "function" ? [e] : Array.isArray(e) ? e : [e], u2 = [];
5152
+ for (const f$1 of l2) {
5153
+ const p2 = yt(f$1);
5154
+ let c2;
5155
+ if (p2) {
5156
+ if (!r)
5157
+ throw new Error("Anchored selectors require an AnchoredIdDeriver to be provided in options.");
5158
+ c2 = $n(r.anchors, f$1);
5159
+ } else
5160
+ c2 = f$1;
5161
+ const h = /* @__PURE__ */ new Set(), A2 = [];
5162
+ for (const g of this.providers) {
5163
+ const P = g.selectColumns(c2);
5164
+ for (const b of P) {
5165
+ if (h.has(b.id)) throw new Error(`Duplicate column id ${b.id} in provider ${g.constructor.name}`);
5166
+ h.add(b.id), A2.push(b);
5167
+ }
5168
+ }
5169
+ if (A2.length === 0) continue;
5170
+ const y$1 = vt(f$1), v = y$1.length > 0;
5171
+ for (const g of A2) {
5172
+ if (!f(g.spec)) continue;
5173
+ const P = g.spec;
5174
+ if (v) {
5175
+ const b = pt(g.data);
5176
+ if (!b) {
5177
+ if (s2) continue;
5178
+ return;
5179
+ }
5180
+ if (!yn(b))
5181
+ throw new Error(`Splitting requires Partitioned DataInfoEntries, but parsing resulted in ${b.type} for column ${g.id}`);
5182
+ const F = ct(b), $2 = y$1[y$1.length - 1];
5183
+ if ($2 >= b.partitionKeyLength)
5184
+ throw new Error(`Not enough partition keys (${b.partitionKeyLength}) for requested split axes (max index ${$2}) in column ${P.name}`);
5185
+ const q = y$1.map((w2) => this.findLabels(y(P.axesSpec[w2]))), D = [], I = (w2, N2) => {
5186
+ if (N2 >= y$1.length) {
5187
+ D.push([...w2]);
5188
+ return;
5189
+ }
5190
+ const k2 = y$1[N2];
5191
+ if (k2 >= F.length)
5192
+ throw new Error(`Axis index ${k2} out of bounds for unique keys array (length ${F.length}) during split key generation for column ${g.id}`);
5193
+ const O = F[k2];
5194
+ if (!O || O.length === 0) {
5195
+ D.length = 0;
5196
+ return;
5197
+ }
5198
+ for (const z2 of O)
5199
+ w2.push(z2), I(w2, N2 + 1), w2.pop();
5200
+ };
5201
+ if (I([], 0), D.length === 0)
5202
+ continue;
5203
+ const R = [...P.axesSpec], se = y$1.map((w2) => w2);
5204
+ for (let w2 = y$1.length - 1; w2 >= 0; w2--)
5205
+ R.splice(y$1[w2], 1);
5206
+ const J = { ...P, axesSpec: R };
5207
+ for (const w2 of D) {
5208
+ const N2 = w2.map((k2, O) => {
5209
+ const z2 = se[O], Re = y(P.axesSpec[z2]), oe = q[O], Oe = (oe == null ? void 0 : oe[k2]) ?? String(k2);
5210
+ return { axisIdx: z2, axisId: Re, value: k2, label: Oe };
5211
+ });
5212
+ u2.push({
5213
+ type: "split",
5214
+ originalColumn: g,
5215
+ spec: P,
5216
+ adjustedSpec: J,
5217
+ dataEntries: b,
5218
+ axisFilters: N2
5219
+ });
5220
+ }
5221
+ } else
5222
+ u2.push({
5223
+ type: "direct",
5224
+ originalColumn: g,
5225
+ spec: P,
5226
+ adjustedSpec: P
5227
+ });
5228
+ }
5229
+ }
5230
+ if (u2.length === 0) return [];
5231
+ const S = Ee(
5232
+ u2,
5233
+ (f2) => ({
5234
+ spec: f2.spec,
5235
+ suffixTrace: f2.type === "split" ? ht(f2.axisFilters) : void 0
5236
+ }),
5237
+ a
5238
+ ), d = [];
5239
+ for (const { value: f2, label: p2 } of S) {
5240
+ const { originalColumn: c2, spec: h } = f2, A2 = f2.type === "split" ? f2.axisFilters : void 0, y2 = gt(A2);
5241
+ let v;
5242
+ r ? v = r.deriveS(h, y2) : v = mt(c2.id, y2);
5243
+ let g = { ...f2.adjustedSpec };
5244
+ o && (g = {
5245
+ ...g,
5246
+ annotations: {
5247
+ ...g.annotations ?? {},
5248
+ "pl7.app/label": p2
5249
+ }
5250
+ }), d.push({
5251
+ id: v,
5252
+ spec: g,
5253
+ data: () => f2.type === "split" ? hn(dt(f2.dataEntries, y2)) : f2.originalColumn.data,
5254
+ label: p2
5255
+ });
5256
+ }
5257
+ return d;
5258
+ }
5259
+ getColumns(e, n2) {
5260
+ const r = this.getUniversalEntries(e, {
5261
+ overrideLabelAnnotation: true,
5262
+ // default for getColumns
5263
+ ...n2 ?? {}
5264
+ });
5265
+ if (!r) return;
5266
+ const i = [];
5267
+ for (const s2 of r) {
5268
+ const o = s2.data();
5269
+ if (!o) {
5270
+ if (n2 != null && n2.dontWaitAllData) continue;
5271
+ return;
5272
+ }
5273
+ i.push({
5274
+ id: s2.id,
5275
+ spec: s2.spec,
5276
+ data: o
5277
+ });
5278
+ }
5279
+ return i;
5280
+ }
5281
+ }
5282
+ function le(t, e) {
5283
+ if (t === void 0) return e === void 0;
5284
+ if (e === void 0) return true;
5285
+ for (const n2 in e)
5286
+ if (t[n2] !== e[n2]) return false;
5287
+ return true;
5288
+ }
5289
+ function we(t) {
5290
+ return Bn(t, (e) => e instanceof _ ? e.handle : pn(e) ? mn(e, (n2) => n2.handle) : e);
5291
+ }
5292
+ class bt {
5015
5293
  constructor() {
5016
- F(this, "ctx", h());
5294
+ L(this, "ctx", m());
5017
5295
  }
5018
5296
  /**
5019
5297
  * @deprecated use getOptions()
@@ -5022,8 +5300,8 @@
5022
5300
  return this.ctx.calculateOptions(e);
5023
5301
  }
5024
5302
  getOptions(e, n2) {
5025
- const r = typeof e == "function" ? e : Bn(e), i = this.getSpecs().entries.filter((s2) => r(s2.obj));
5026
- return typeof n2 == "object" || typeof n2 > "u" ? de(i, (s2) => s2.obj, n2 ?? {}).map(({ value: { ref: s2 }, label: o }) => ({
5303
+ const r = typeof e == "function" ? e : Fn(e), i = this.getSpecs().entries.filter((s2) => r(s2.obj));
5304
+ return typeof n2 == "object" || typeof n2 > "u" ? Ee(i, (s2) => s2.obj, n2 ?? {}).map(({ value: { ref: s2 }, label: o }) => ({
5027
5305
  ref: s2,
5028
5306
  label: o
5029
5307
  })) : i.map((s2) => ({
@@ -5031,93 +5309,18 @@
5031
5309
  label: n2(s2.obj, s2.ref)
5032
5310
  }));
5033
5311
  }
5034
- /**
5035
- * Internal implementation that generates UniversalPColumnEntry objects from the provided
5036
- * anchors and selectors.
5037
- */
5038
- getUniversalPColumnEntries(e, n2, r) {
5039
- const i = {};
5040
- if (!(e instanceof On))
5041
- for (const [l2, m2] of Object.entries(e))
5042
- if (Kn(m2)) {
5043
- const u2 = this.getPColumnSpecByRef(m2);
5044
- if (!u2)
5045
- return;
5046
- i[l2] = u2;
5047
- } else
5048
- i[l2] = m2;
5049
- const s2 = typeof n2 == "function" ? [n2] : Array.isArray(n2) ? n2 : [n2], o = e instanceof On ? e : new On(i), a = [];
5050
- for (const l2 of s2) {
5051
- const m2 = typeof l2 == "function" ? l2 : Bn(Jn(i, l2)), u2 = this.getSpecs().entries.filter(({ obj: p2 }) => f(p2) ? m2(p2) : false);
5052
- if (u2.length === 0)
5053
- continue;
5054
- const f$1 = typeof l2 == "object" && "axes" in l2 && l2.axes !== void 0 && l2.partialAxesMatch === void 0 ? l2.axes.map((p2, d) => "split" in p2 && p2.split === true ? d : -1).filter((p2) => p2 !== -1) : [];
5055
- if (f$1.sort((p2, d) => p2 - d), f$1.length > 0) {
5056
- const p2 = f$1[f$1.length - 1];
5057
- for (const { ref: d, obj: y$1 } of u2) {
5058
- if (!f(y$1)) throw new Error(`Assertion failed: expected PColumnSpec, got ${y$1.kind}`);
5059
- const g2 = this.getDataByRef(d);
5060
- if (!g2) {
5061
- if (r != null && r.dontWaitAllData) continue;
5062
- return;
5063
- }
5064
- if (!Y$1(g2)) throw new Error(`Assertion failed: expected PColumn, got ${g2.spec.kind}`);
5065
- const v = Xe(g2.data);
5066
- if (!v) {
5067
- if (r != null && r.dontWaitAllData) continue;
5068
- return;
5069
- }
5070
- if (p2 >= v.length)
5071
- throw new Error(`Not enough partition keys for the requested split axes in column ${y$1.name}`);
5072
- const w2 = f$1.map((P2) => this.findLabels(y(y$1.axesSpec[P2]))), x2 = [], C = (P2, T) => {
5073
- if (T >= f$1.length) {
5074
- x2.push([...P2]);
5075
- return;
5076
- }
5077
- const R = f$1[T], k2 = v[R];
5078
- for (const A of k2)
5079
- P2.push(A), C(P2, T + 1), P2.pop();
5080
- };
5081
- C([], 0);
5082
- for (const P2 of x2) {
5083
- const T = P2.map((R, k2) => {
5084
- const A = f$1[k2], j = y(y$1.axesSpec[A]), V = w2[k2], K = (V == null ? void 0 : V[R]) ?? String(R);
5085
- return { axisIdx: A, axisId: j, value: R, label: K };
5086
- });
5087
- a.push({
5088
- obj: y$1,
5089
- ref: d,
5090
- axisFilters: T
5091
- });
5092
- }
5093
- }
5312
+ resolveAnchorCtx(e) {
5313
+ if (e instanceof On) return e;
5314
+ const n2 = {};
5315
+ for (const [r, i] of Object.entries(e))
5316
+ if (Rn(i)) {
5317
+ const s2 = this.getPColumnSpecByRef(i);
5318
+ if (!s2)
5319
+ return;
5320
+ n2[r] = s2;
5094
5321
  } else
5095
- for (const { ref: p2, obj: d } of u2)
5096
- f(d) && a.push({
5097
- obj: d,
5098
- ref: p2
5099
- // No splitFilters needed here
5100
- });
5101
- }
5102
- return a.length === 0 ? [] : de(
5103
- a,
5104
- (l2) => ({
5105
- spec: l2.obj,
5106
- suffixTrace: Qe(l2.axisFilters)
5107
- // Use helper function
5108
- }),
5109
- (r == null ? void 0 : r.labelOps) ?? {}
5110
- ).map((l2) => ({
5111
- id: o.deriveS(
5112
- l2.value.obj,
5113
- Ze(l2.value.axisFilters)
5114
- // Use helper function
5115
- ),
5116
- obj: l2.value.obj,
5117
- ref: l2.value.ref,
5118
- axisFilters: l2.value.axisFilters,
5119
- label: l2.label
5120
- }));
5322
+ n2[r] = i;
5323
+ return new On(n2);
5121
5324
  }
5122
5325
  /**
5123
5326
  * Returns columns that match the provided anchors and selectors. It applies axis filters and label derivation.
@@ -5128,55 +5331,12 @@
5128
5331
  * @returns A PFrameHandle for the created PFrame, or undefined if any required data is missing
5129
5332
  */
5130
5333
  getAnchoredPColumns(e, n2, r) {
5131
- const i = {
5132
- ...r,
5133
- labelOps: {
5134
- includeNativeLabel: true,
5135
- ...(r == null ? void 0 : r.labelOps) || {}
5136
- }
5137
- }, s2 = this.getUniversalPColumnEntries(
5138
- e,
5139
- n2,
5140
- i
5141
- );
5142
- if (!s2 || s2.length === 0) return;
5143
- const o = [];
5144
- for (const a of s2) {
5145
- const c2 = this.getPColumnByRef(a.ref);
5146
- if (!c2) return;
5147
- const l2 = le(c2.data);
5148
- if (!l2) return;
5149
- let m2 = l2, u2 = { ...c2.spec };
5150
- if (a.axisFilters && a.axisFilters.length > 0) {
5151
- const p2 = a.axisFilters.map((g2) => [
5152
- g2.axisIdx,
5153
- g2.value
5154
- ]);
5155
- m2 = Ue(l2, p2);
5156
- const d = [...a.axisFilters].map((g2) => g2.axisIdx).sort((g2, v) => v - g2), y2 = [...u2.axesSpec];
5157
- for (const g2 of d)
5158
- y2.splice(g2, 1);
5159
- u2 = { ...u2, axesSpec: y2 };
5160
- }
5161
- const f2 = ln(m2);
5162
- u2.annotations ? u2 = {
5163
- ...u2,
5164
- annotations: {
5165
- ...u2.annotations,
5166
- "pl7.app/label": a.label
5167
- }
5168
- } : u2 = {
5169
- ...u2,
5170
- annotations: {
5171
- "pl7.app/label": a.label
5172
- }
5173
- }, o.push({
5174
- id: a.id,
5175
- spec: u2,
5176
- data: f2
5334
+ const i = this.resolveAnchorCtx(e);
5335
+ if (i)
5336
+ return new be().addColumnProvider(this).addAxisLabelProvider(this).getColumns(n2, {
5337
+ ...r,
5338
+ anchorCtx: i
5177
5339
  });
5178
- }
5179
- return o;
5180
5340
  }
5181
5341
  /**
5182
5342
  * Calculates anchored identifier options for columns matching a given predicate and returns their
@@ -5208,11 +5368,16 @@
5208
5368
  * or undefined if any PlRef resolution fails.
5209
5369
  */
5210
5370
  getCanonicalOptions(e, n2, r) {
5211
- const i = this.getUniversalPColumnEntries(e, n2, r);
5212
- if (i)
5213
- return i.map((s2) => ({
5214
- value: s2.id,
5215
- label: s2.label
5371
+ const i = this.resolveAnchorCtx(e);
5372
+ if (!i) return;
5373
+ const s2 = new be().addColumnProvider(this).addAxisLabelProvider(this).getUniversalEntries(n2, {
5374
+ ...r,
5375
+ anchorCtx: i
5376
+ });
5377
+ if (s2)
5378
+ return s2.map((o) => ({
5379
+ value: o.id,
5380
+ label: o.label
5216
5381
  }));
5217
5382
  }
5218
5383
  /**
@@ -5229,7 +5394,7 @@
5229
5394
  ref: n2.ref,
5230
5395
  obj: {
5231
5396
  ...n2.obj,
5232
- data: new I(n2.obj.data, [n2.ref.blockId, n2.ref.name])
5397
+ data: new _(n2.obj.data, [n2.ref.blockId, n2.ref.name])
5233
5398
  }
5234
5399
  }))
5235
5400
  };
@@ -5248,9 +5413,9 @@
5248
5413
  ref: n2.ref,
5249
5414
  obj: {
5250
5415
  ...n2.obj,
5251
- data: Mn(
5416
+ data: _n(
5252
5417
  n2.obj.data,
5253
- (r) => new I(r, [n2.ref.blockId, n2.ref.name])
5418
+ (r) => new _(r, [n2.ref.blockId, n2.ref.name])
5254
5419
  )
5255
5420
  }
5256
5421
  }))
@@ -5277,9 +5442,9 @@
5277
5442
  )) == null ? void 0 : r.obj;
5278
5443
  const n2 = this.ctx.getDataFromResultPoolByRef(e.blockId, e.name);
5279
5444
  if (n2)
5280
- return In(
5445
+ return Bn(
5281
5446
  n2,
5282
- (i) => new I(i, [e.blockId, e.name])
5447
+ (i) => new _(i, [e.blockId, e.name])
5283
5448
  );
5284
5449
  }
5285
5450
  /**
@@ -5290,7 +5455,7 @@
5290
5455
  getPColumnByRef(e) {
5291
5456
  const n2 = this.getDataByRef(e);
5292
5457
  if (n2)
5293
- return Dn(n2);
5458
+ return In(n2);
5294
5459
  }
5295
5460
  /**
5296
5461
  * Returns spec associated with the ref ensuring that it is a p-column spec.
@@ -5322,10 +5487,10 @@
5322
5487
  if (!f(r.obj.spec))
5323
5488
  continue;
5324
5489
  const i = r.obj.spec;
5325
- if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && re(e.domain, i.domain)) {
5490
+ if (e.name === i.name && e.valueType === i.valueType && e.axesSpec.length === i.axesSpec.length && le(e.domain, i.domain)) {
5326
5491
  for (let s2 = 0; s2 < e.axesSpec.length; ++s2) {
5327
5492
  const o = e.axesSpec[s2], a = i.axesSpec[s2];
5328
- if (o.name !== a.name || o.type !== a.type || !re(o.domain, a.domain))
5493
+ if (o.name !== a.name || o.type !== a.type || !le(o.domain, a.domain))
5329
5494
  continue e;
5330
5495
  }
5331
5496
  n2.push(r.obj);
@@ -5340,9 +5505,9 @@
5340
5505
  findLabels(e) {
5341
5506
  const n2 = this.getData();
5342
5507
  for (const r of n2.entries) {
5343
- if (!Y$1(r.obj)) continue;
5508
+ if (!Z$1(r.obj)) continue;
5344
5509
  const i = r.obj.spec;
5345
- if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && re(e.domain, i.axesSpec[0].domain)) {
5510
+ if (i.name === "pl7.app/label" && i.axesSpec.length === 1 && i.axesSpec[0].name === e.name && i.axesSpec[0].type === e.type && le(e.domain, i.axesSpec[0].domain)) {
5346
5511
  if (r.obj.data.resourceType.name !== "PColumnData/Json")
5347
5512
  throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);
5348
5513
  return Object.fromEntries(
@@ -5353,6 +5518,29 @@
5353
5518
  }
5354
5519
  }
5355
5520
  }
5521
+ /**
5522
+ * Selects columns based on the provided selectors, returning PColumn objects
5523
+ * with lazily loaded data.
5524
+ *
5525
+ * @param selectors - A predicate function, a single selector, or an array of selectors.
5526
+ * @returns An array of PColumn objects matching the selectors. Data is loaded on first access.
5527
+ */
5528
+ selectColumns(e) {
5529
+ const n2 = typeof e == "function" ? e : Fn(e);
5530
+ return this.getSpecs().entries.filter(({ obj: i }) => f(i) ? n2(i) : false).map(({ ref: i, obj: s2 }) => {
5531
+ const o = s2;
5532
+ let a = null;
5533
+ const l2 = this;
5534
+ return {
5535
+ id: Pe(i),
5536
+ spec: o,
5537
+ get data() {
5538
+ var u2;
5539
+ return a !== null || (a = (u2 = l2.getPColumnByRef(i)) == null ? void 0 : u2.data), a;
5540
+ }
5541
+ };
5542
+ });
5543
+ }
5356
5544
  /**
5357
5545
  * Find labels data for a given axis id of a p-column.
5358
5546
  * @returns a map of axis value => label
@@ -5366,14 +5554,14 @@
5366
5554
  }));
5367
5555
  }
5368
5556
  }
5369
- class z {
5557
+ class X {
5370
5558
  constructor() {
5371
- F(this, "ctx");
5372
- F(this, "args");
5373
- F(this, "uiState");
5374
- F(this, "_activeArgsCache");
5375
- F(this, "resultPool", new et());
5376
- this.ctx = h(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
5559
+ L(this, "ctx");
5560
+ L(this, "args");
5561
+ L(this, "uiState");
5562
+ L(this, "_activeArgsCache");
5563
+ L(this, "resultPool", new bt());
5564
+ this.ctx = m(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : {};
5377
5565
  }
5378
5566
  /**
5379
5567
  * Returns args snapshot the block was executed for (i.e. when "Run" button was pressed).
@@ -5389,16 +5577,16 @@
5389
5577
  // return this.ctx.featureFlags;
5390
5578
  // }
5391
5579
  getNamedAccessor(e) {
5392
- return ie(
5580
+ return pe(
5393
5581
  this.ctx.getAccessorHandleByName(e),
5394
- (n2) => new I(n2, [e])
5582
+ (n2) => new _(n2, [e])
5395
5583
  );
5396
5584
  }
5397
5585
  get prerun() {
5398
- return this.getNamedAccessor(ve);
5586
+ return this.getNamedAccessor(Ie);
5399
5587
  }
5400
5588
  get outputs() {
5401
- return this.getNamedAccessor(we);
5589
+ return this.getNamedAccessor(Le);
5402
5590
  }
5403
5591
  /**
5404
5592
  * Find labels data for a given axis id. It will search for a label column and return its data as a map.
@@ -5410,12 +5598,13 @@
5410
5598
  }
5411
5599
  verifyInlineAndExplicitColumnsSupport(e) {
5412
5600
  var i;
5413
- const n2 = e.some((s2) => !(s2.data instanceof I) || dn(s2.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === true;
5601
+ const n2 = e.some((s2) => !(s2.data instanceof _) || pn(s2.data)), r = ((i = this.ctx.featureFlags) == null ? void 0 : i.inlineColumnsSupport) === true;
5414
5602
  if (n2 && !r) throw Error("Inline or explicit columns not supported");
5415
5603
  }
5604
+ // TODO remove all non-PColumn fields
5416
5605
  createPFrame(e) {
5417
5606
  return this.verifyInlineAndExplicitColumnsSupport(e), this.ctx.createPFrame(
5418
- e.map((n2) => fe(n2))
5607
+ e.map((n2) => we(n2))
5419
5608
  );
5420
5609
  }
5421
5610
  createPTable(e) {
@@ -5428,7 +5617,7 @@
5428
5617
  filters: e.filters ?? [],
5429
5618
  sorting: e.sorting ?? []
5430
5619
  } : n2 = e, this.verifyInlineAndExplicitColumnsSupport(jn(n2.src)), this.ctx.createPTable(
5431
- En(n2, (r) => fe(r))
5620
+ Cn(n2, (r) => we(r))
5432
5621
  );
5433
5622
  }
5434
5623
  /** @deprecated scheduled for removal from SDK */
@@ -5440,33 +5629,33 @@
5440
5629
  return this.ctx.getCurrentUnstableMarker();
5441
5630
  }
5442
5631
  }
5443
- const U = "1.27.17";
5444
- function tt(t) {
5632
+ const M = "1.28.1";
5633
+ function wt(t) {
5445
5634
  return t.__renderLambda === true;
5446
5635
  }
5447
- function se(t) {
5636
+ function ue(t) {
5448
5637
  if (t !== void 0)
5449
- return tt(t) ? t.handle : t;
5638
+ return wt(t) ? t.handle : t;
5450
5639
  }
5451
- class _ {
5640
+ class T {
5452
5641
  constructor(e, n2, r, i, s2, o, a) {
5453
5642
  this._renderingMode = e, this._initialArgs = n2, this._initialUiState = r, this._outputs = i, this._inputsValid = s2, this._sections = o, this._title = a;
5454
5643
  }
5455
5644
  static create(e = "Heavy") {
5456
- return new _(
5645
+ return new T(
5457
5646
  e,
5458
5647
  void 0,
5459
5648
  {},
5460
5649
  {},
5461
- Y(true),
5462
- Y([]),
5650
+ Z(true),
5651
+ Z([]),
5463
5652
  void 0
5464
5653
  );
5465
5654
  }
5466
5655
  output(e, n2, r = {}) {
5467
5656
  if (typeof n2 == "function") {
5468
5657
  const i = `output#${e}`;
5469
- return q(i, () => n2(new z())), new _(
5658
+ return Y(i, () => n2(new X())), new T(
5470
5659
  this._renderingMode,
5471
5660
  this._initialArgs,
5472
5661
  this._initialUiState,
@@ -5483,7 +5672,7 @@
5483
5672
  this._title
5484
5673
  );
5485
5674
  } else
5486
- return new _(
5675
+ return new T(
5487
5676
  this._renderingMode,
5488
5677
  this._initialArgs,
5489
5678
  this._initialUiState,
@@ -5501,7 +5690,7 @@
5501
5690
  return this.output(e, n2, { retentive: true });
5502
5691
  }
5503
5692
  argsValid(e) {
5504
- return typeof e == "function" ? (q("inputsValid", () => e(new z())), new _(
5693
+ return typeof e == "function" ? (Y("inputsValid", () => e(new X())), new T(
5505
5694
  this._renderingMode,
5506
5695
  this._initialArgs,
5507
5696
  this._initialUiState,
@@ -5512,7 +5701,7 @@
5512
5701
  },
5513
5702
  this._sections,
5514
5703
  this._title
5515
- )) : new _(
5704
+ )) : new T(
5516
5705
  this._renderingMode,
5517
5706
  this._initialArgs,
5518
5707
  this._initialUiState,
@@ -5523,7 +5712,7 @@
5523
5712
  );
5524
5713
  }
5525
5714
  sections(e) {
5526
- return Array.isArray(e) ? this.sections(Y(e)) : typeof e == "function" ? (q("sections", () => e(new z())), new _(
5715
+ return Array.isArray(e) ? this.sections(Z(e)) : typeof e == "function" ? (Y("sections", () => e(new X())), new T(
5527
5716
  this._renderingMode,
5528
5717
  this._initialArgs,
5529
5718
  this._initialUiState,
@@ -5531,7 +5720,7 @@
5531
5720
  this._inputsValid,
5532
5721
  { __renderLambda: true, handle: "sections" },
5533
5722
  this._title
5534
- )) : new _(
5723
+ )) : new T(
5535
5724
  this._renderingMode,
5536
5725
  this._initialArgs,
5537
5726
  this._initialUiState,
@@ -5543,7 +5732,7 @@
5543
5732
  }
5544
5733
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
5545
5734
  title(e) {
5546
- return q("title", () => e(new z())), new _(
5735
+ return Y("title", () => e(new X())), new T(
5547
5736
  this._renderingMode,
5548
5737
  this._initialArgs,
5549
5738
  this._initialUiState,
@@ -5558,7 +5747,7 @@
5558
5747
  * @deprecated use {@link withArgs}
5559
5748
  * */
5560
5749
  initialArgs(e) {
5561
- return new _(
5750
+ return new T(
5562
5751
  this._renderingMode,
5563
5752
  e,
5564
5753
  this._initialUiState,
@@ -5570,7 +5759,7 @@
5570
5759
  }
5571
5760
  /** Sets initial args for the block, this value must be specified. */
5572
5761
  withArgs(e) {
5573
- return new _(
5762
+ return new T(
5574
5763
  this._renderingMode,
5575
5764
  e,
5576
5765
  this._initialUiState,
@@ -5582,7 +5771,7 @@
5582
5771
  }
5583
5772
  /** Defines type and sets initial value for block UiState. */
5584
5773
  withUiState(e) {
5585
- return new _(
5774
+ return new T(
5586
5775
  this._renderingMode,
5587
5776
  this._initialArgs,
5588
5777
  e,
@@ -5599,7 +5788,7 @@
5599
5788
  if (this._initialArgs === void 0) throw new Error("Initial arguments not set.");
5600
5789
  const e = {
5601
5790
  v3: {
5602
- sdkVersion: U,
5791
+ sdkVersion: M,
5603
5792
  renderingMode: this._renderingMode,
5604
5793
  initialArgs: this._initialArgs,
5605
5794
  initialUiState: this._initialUiState,
@@ -5609,75 +5798,75 @@
5609
5798
  outputs: this._outputs
5610
5799
  },
5611
5800
  // fields below are added to allow previous desktop versions read generated configs
5612
- sdkVersion: U,
5801
+ sdkVersion: M,
5613
5802
  renderingMode: this._renderingMode,
5614
5803
  initialArgs: this._initialArgs,
5615
- inputsValid: se(this._inputsValid),
5616
- sections: se(this._sections),
5804
+ inputsValid: ue(this._inputsValid),
5805
+ sections: ue(this._sections),
5617
5806
  outputs: Object.fromEntries(
5618
- Object.entries(this._outputs).map(([n2, r]) => [n2, se(r)])
5807
+ Object.entries(this._outputs).map(([n2, r]) => [n2, ue(r)])
5619
5808
  )
5620
5809
  };
5621
- return Ke() ? be({ sdkVersion: U }) : { config: e };
5810
+ return Xe() ? _e({ sdkVersion: M }) : { config: e };
5622
5811
  }
5623
5812
  }
5624
- function Wt(t, e, n2, r) {
5625
- var l2, m2;
5813
+ function fn(t, e, n2, r) {
5814
+ var u2, S;
5626
5815
  Array.isArray(r) && (r = { filters: r });
5627
- const i = t.resultPool.getData().entries.map((u2) => u2.obj).filter(Y$1).filter((u2) => u2.spec.name === "pl7.app/label" && u2.spec.axesSpec.length === 1), s2 = (u2, f2) => {
5628
- let p2 = u2.toString();
5816
+ const i = t.resultPool.getData().entries.map((d) => d.obj).filter(Z$1).filter((d) => d.spec.name === "pl7.app/label" && d.spec.axesSpec.length === 1), s2 = (d, f2) => {
5817
+ let p2 = d.toString();
5629
5818
  if (f2)
5630
- for (const d in f2)
5631
- p2 += d, p2 += f2[d];
5819
+ for (const c2 in f2)
5820
+ p2 += c2, p2 += f2[c2];
5632
5821
  return p2;
5633
5822
  }, o = /* @__PURE__ */ new Map();
5634
- for (const u2 of e)
5635
- for (const f2 of u2.spec.axesSpec) {
5823
+ for (const d of e)
5824
+ for (const f2 of d.spec.axesSpec) {
5636
5825
  const p2 = y(f2);
5637
- for (const d of i) {
5638
- const y$1 = d.spec.axesSpec[0], g2 = y(d.spec.axesSpec[0]);
5639
- if (X(p2, g2)) {
5640
- const v = Object.keys(p2.domain ?? {}).length, w2 = Object.keys(g2.domain ?? {}).length;
5641
- if (v > w2) {
5642
- const x2 = s2(d.id, p2.domain);
5643
- o.set(x2, {
5644
- id: x2,
5826
+ for (const c2 of i) {
5827
+ const h = c2.spec.axesSpec[0], A2 = y(c2.spec.axesSpec[0]);
5828
+ if (z(p2, A2)) {
5829
+ const y2 = Object.keys(p2.domain ?? {}).length, v = Object.keys(A2.domain ?? {}).length;
5830
+ if (y2 > v) {
5831
+ const g = s2(c2.id, p2.domain);
5832
+ o.set(g, {
5833
+ id: g,
5645
5834
  spec: {
5646
- ...d.spec,
5647
- axesSpec: [{ ...p2, annotations: y$1.annotations }]
5835
+ ...c2.spec,
5836
+ axesSpec: [{ ...p2, annotations: h.annotations }]
5648
5837
  },
5649
- data: d.data
5838
+ data: c2.data
5650
5839
  });
5651
5840
  } else
5652
- o.set(s2(d.id), d);
5841
+ o.set(s2(c2.id), c2);
5653
5842
  }
5654
5843
  }
5655
5844
  }
5656
5845
  if ([...e, ...o.values()].some(
5657
- (u2) => u2.data instanceof I && !u2.data.getIsReadyOrError()
5846
+ (d) => d.data instanceof _ && !d.data.getIsReadyOrError()
5658
5847
  ))
5659
5848
  return;
5660
5849
  let a = e;
5661
- const c2 = [];
5850
+ const l2 = [];
5662
5851
  if (r != null && r.coreColumnPredicate) {
5663
5852
  a = [];
5664
- for (const u2 of e)
5665
- r.coreColumnPredicate(u2.spec) ? a.push(u2) : c2.push(u2);
5853
+ for (const d of e)
5854
+ r.coreColumnPredicate(d.spec) ? a.push(d) : l2.push(d);
5666
5855
  }
5667
- return c2.push(...o.values()), t.createPTable({
5856
+ return l2.push(...o.values()), t.createPTable({
5668
5857
  src: {
5669
5858
  type: "outer",
5670
5859
  primary: {
5671
5860
  type: (r == null ? void 0 : r.coreJoinType) ?? "full",
5672
- entries: a.map((u2) => ({ type: "column", column: u2 }))
5861
+ entries: a.map((d) => ({ type: "column", column: d }))
5673
5862
  },
5674
- secondary: c2.map((u2) => ({ type: "column", column: u2 }))
5863
+ secondary: l2.map((d) => ({ type: "column", column: d }))
5675
5864
  },
5676
- filters: [...(r == null ? void 0 : r.filters) ?? [], ...((l2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : l2.filters) ?? []],
5677
- sorting: ((m2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : m2.sorting) ?? []
5865
+ filters: [...(r == null ? void 0 : r.filters) ?? [], ...((u2 = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : u2.filters) ?? []],
5866
+ sorting: ((S = n2 == null ? void 0 : n2.pTableParams) == null ? void 0 : S.sorting) ?? []
5678
5867
  });
5679
5868
  }
5680
- const ImportFileHandleSchema = z$2.string().optional().refine(
5869
+ const ImportFileHandleSchema = z$1.string().optional().refine(
5681
5870
  (_a) => true
5682
5871
  );
5683
5872
  function* range(from, to, step = 1) {
@@ -5687,20 +5876,20 @@
5687
5876
  }
5688
5877
  function toList(iterable) {
5689
5878
  const lst = [];
5690
- for (const it of iterable) {
5691
- lst.push(it);
5879
+ for (const it2 of iterable) {
5880
+ lst.push(it2);
5692
5881
  }
5693
5882
  return lst;
5694
5883
  }
5695
5884
  function times(n2, cb) {
5696
5885
  return toList(range(0, n2)).map(cb);
5697
5886
  }
5698
- const $BlockArgs = z$2.object({
5699
- tableNumRows: z$2.number().default(100),
5700
- numbers: z$2.array(z$2.coerce.number()),
5701
- handles: z$2.array(ImportFileHandleSchema)
5887
+ const $BlockArgs = z$1.object({
5888
+ tableNumRows: z$1.number().default(100),
5889
+ numbers: z$1.array(z$1.coerce.number()),
5890
+ handles: z$1.array(ImportFileHandleSchema)
5702
5891
  });
5703
- const platforma = _.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5892
+ const platforma = T.create("Heavy").withArgs({ numbers: [1, 2, 3, 4], tableNumRows: 100, handles: [] }).withUiState({ dataTableState: void 0, dynamicSections: [] }).argsValid((ctx) => {
5704
5893
  if (ctx.args.numbers.length === 5) {
5705
5894
  throw new Error("argsValid: test error");
5706
5895
  }
@@ -5723,7 +5912,7 @@
5723
5912
  val: v.toString()
5724
5913
  };
5725
5914
  });
5726
- return Wt(
5915
+ return fn(
5727
5916
  ctx,
5728
5917
  [
5729
5918
  {
@@ -5772,12 +5961,12 @@
5772
5961
  }
5773
5962
  return "Ui Examples";
5774
5963
  }).sections((ctx) => {
5775
- const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it) => ({
5964
+ const dynamicSections = (ctx.uiState.dynamicSections ?? []).map((it2) => ({
5776
5965
  type: "link",
5777
- href: `/section?id=${it.id}`,
5778
- label: it.label
5966
+ href: `/section?id=${it2.id}`,
5967
+ label: it2.label
5779
5968
  }));
5780
- if (dynamicSections.some((it) => it.label === "Error")) {
5969
+ if (dynamicSections.some((it2) => it2.label === "Error")) {
5781
5970
  throw new Error("sections: test error");
5782
5971
  }
5783
5972
  return [