@platforma-open/milaboratories.mixcr-clonotyping-2 2.25.1 → 2.26.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.
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
1
- import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-B-1-B7_t.js";
2
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/plugin_handle.js
1
+ import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-SbdDWaPq.js";
2
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/plugin_handle.js
3
3
  const PLUGIN_OUTPUT_PREFIX = "plugin-output#";
4
4
  /** Construct the output key for a plugin output in the block outputs map. */
5
5
  function pluginOutputKey(handle, outputKey) {
6
6
  return `${PLUGIN_OUTPUT_PREFIX}${handle}#${outputKey}`;
7
7
  }
8
- //#endregion
9
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/block_storage.js
8
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/block_storage.js
10
9
  /**
11
10
  * Discriminator key for BlockStorage format detection.
12
11
  * This unique hash-based key identifies data as BlockStorage vs legacy formats.
@@ -247,8 +246,7 @@ function getPluginData(rawStorage, handle) {
247
246
  if (!pluginEntry) throw new Error(`Plugin '${handle}' not found in block storage`);
248
247
  return pluginEntry.__data;
249
248
  }
250
- //#endregion
251
- //#region ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
249
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
252
250
  var util;
253
251
  (function(util) {
254
252
  util.assertEqual = (_) => {};
@@ -343,8 +341,7 @@ const getParsedType = (data) => {
343
341
  default: return ZodParsedType.unknown;
344
342
  }
345
343
  };
346
- //#endregion
347
- //#region ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
344
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
348
345
  const ZodIssueCode = util.arrayToEnum([
349
346
  "invalid_type",
350
347
  "invalid_literal",
@@ -442,8 +439,7 @@ var ZodError = class ZodError extends Error {
442
439
  ZodError.create = (issues) => {
443
440
  return new ZodError(issues);
444
441
  };
445
- //#endregion
446
- //#region ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
442
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
447
443
  const errorMap = (issue, _ctx) => {
448
444
  let message;
449
445
  switch (issue.code) {
@@ -476,13 +472,14 @@ const errorMap = (issue, _ctx) => {
476
472
  message = `Invalid date`;
477
473
  break;
478
474
  case ZodIssueCode.invalid_string:
479
- if (typeof issue.validation === "object") if ("includes" in issue.validation) {
480
- message = `Invalid input: must include "${issue.validation.includes}"`;
481
- if (typeof issue.validation.position === "number") message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
482
- } else if ("startsWith" in issue.validation) message = `Invalid input: must start with "${issue.validation.startsWith}"`;
483
- else if ("endsWith" in issue.validation) message = `Invalid input: must end with "${issue.validation.endsWith}"`;
484
- else util.assertNever(issue.validation);
485
- else if (issue.validation !== "regex") message = `Invalid ${issue.validation}`;
475
+ if (typeof issue.validation === "object") {
476
+ if ("includes" in issue.validation) {
477
+ message = `Invalid input: must include "${issue.validation.includes}"`;
478
+ if (typeof issue.validation.position === "number") message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
479
+ } else if ("startsWith" in issue.validation) message = `Invalid input: must start with "${issue.validation.startsWith}"`;
480
+ else if ("endsWith" in issue.validation) message = `Invalid input: must end with "${issue.validation.endsWith}"`;
481
+ else util.assertNever(issue.validation);
482
+ } else if (issue.validation !== "regex") message = `Invalid ${issue.validation}`;
486
483
  else message = "Invalid";
487
484
  break;
488
485
  case ZodIssueCode.too_small:
@@ -519,14 +516,12 @@ const errorMap = (issue, _ctx) => {
519
516
  }
520
517
  return { message };
521
518
  };
522
- //#endregion
523
- //#region ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
519
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
524
520
  let overrideErrorMap = errorMap;
525
521
  function getErrorMap() {
526
522
  return overrideErrorMap;
527
523
  }
528
- //#endregion
529
- //#region ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
524
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
530
525
  const makeIssue = (params) => {
531
526
  const { data, path, errorMaps, issueData } = params;
532
527
  const fullPath = [...path, ...issueData.path || []];
@@ -629,15 +624,13 @@ const isAborted = (x) => x.status === "aborted";
629
624
  const isDirty = (x) => x.status === "dirty";
630
625
  const isValid = (x) => x.status === "valid";
631
626
  const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
632
- //#endregion
633
- //#region ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
627
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
634
628
  var errorUtil;
635
629
  (function(errorUtil) {
636
630
  errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
637
631
  errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
638
632
  })(errorUtil || (errorUtil = {}));
639
- //#endregion
640
- //#region ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
633
+ // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
641
634
  var ParseInputLazyPath = class {
642
635
  constructor(parent, value, path, key) {
643
636
  this._cachedPath = [];
@@ -647,8 +640,10 @@ var ParseInputLazyPath = class {
647
640
  this._key = key;
648
641
  }
649
642
  get path() {
650
- if (!this._cachedPath.length) if (Array.isArray(this._key)) this._cachedPath.push(...this._path, ...this._key);
651
- else this._cachedPath.push(...this._path, this._key);
643
+ if (!this._cachedPath.length) {
644
+ if (Array.isArray(this._key)) this._cachedPath.push(...this._path, ...this._key);
645
+ else this._cachedPath.push(...this._path, this._key);
646
+ }
652
647
  return this._cachedPath;
653
648
  }
654
649
  };
@@ -747,11 +742,12 @@ var ZodType = class {
747
742
  data,
748
743
  parsedType: getParsedType(data)
749
744
  };
750
- return handleResult(ctx, this._parseSync({
745
+ const result = this._parseSync({
751
746
  data,
752
747
  path: ctx.path,
753
748
  parent: ctx
754
- }));
749
+ });
750
+ return handleResult(ctx, result);
755
751
  }
756
752
  "~validate"(data) {
757
753
  const ctx = {
@@ -808,7 +804,8 @@ var ZodType = class {
808
804
  path: ctx.path,
809
805
  parent: ctx
810
806
  });
811
- return handleResult(ctx, await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult)));
807
+ const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
808
+ return handleResult(ctx, result);
812
809
  }
813
810
  refine(check, message) {
814
811
  const getIssueProperties = (val) => {
@@ -3361,7 +3358,8 @@ var ZodPromise = class extends ZodType {
3361
3358
  });
3362
3359
  return INVALID;
3363
3360
  }
3364
- return OK((ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data)).then((data) => {
3361
+ const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3362
+ return OK(promisified.then((data) => {
3365
3363
  return this._def.type.parseAsync(data, {
3366
3364
  path: ctx.path,
3367
3365
  errorMap: ctx.common.contextualErrorMap
@@ -3459,30 +3457,32 @@ var ZodEffects = class extends ZodType {
3459
3457
  });
3460
3458
  });
3461
3459
  }
3462
- if (effect.type === "transform") if (ctx.common.async === false) {
3463
- const base = this._def.schema._parseSync({
3460
+ if (effect.type === "transform") {
3461
+ if (ctx.common.async === false) {
3462
+ const base = this._def.schema._parseSync({
3463
+ data: ctx.data,
3464
+ path: ctx.path,
3465
+ parent: ctx
3466
+ });
3467
+ if (!isValid(base)) return INVALID;
3468
+ const result = effect.transform(base.value, checkCtx);
3469
+ if (result instanceof Promise) throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3470
+ return {
3471
+ status: status.value,
3472
+ value: result
3473
+ };
3474
+ } else return this._def.schema._parseAsync({
3464
3475
  data: ctx.data,
3465
3476
  path: ctx.path,
3466
3477
  parent: ctx
3478
+ }).then((base) => {
3479
+ if (!isValid(base)) return INVALID;
3480
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3481
+ status: status.value,
3482
+ value: result
3483
+ }));
3467
3484
  });
3468
- if (!isValid(base)) return INVALID;
3469
- const result = effect.transform(base.value, checkCtx);
3470
- if (result instanceof Promise) throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3471
- return {
3472
- status: status.value,
3473
- value: result
3474
- };
3475
- } else return this._def.schema._parseAsync({
3476
- data: ctx.data,
3477
- path: ctx.path,
3478
- parent: ctx
3479
- }).then((base) => {
3480
- if (!isValid(base)) return INVALID;
3481
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3482
- status: status.value,
3483
- value: result
3484
- }));
3485
- });
3485
+ }
3486
3486
  util.assertNever(effect);
3487
3487
  }
3488
3488
  };
@@ -3810,28 +3810,13 @@ const coerce = {
3810
3810
  coerce: true
3811
3811
  }))
3812
3812
  };
3813
- objectType({
3814
- type: literalType("plain"),
3815
- content: stringType()
3816
- });
3817
- //#endregion
3818
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/bmodel/block_kind_ref.js
3819
- /**
3820
- * Compose a {@link BlockKindReference} from a kind's `name`/`version`.
3821
- *
3822
- * The single place that decides how the reference is assembled. If global
3823
- * uniqueness later requires the name segment to be org-qualified, this is the
3824
- * one line that changes.
3825
- */
3826
- const formatKindRef = (k) => `${k.name}@${k.version}`;
3827
3813
  objectType({
3828
3814
  /** Included left border. */
3829
3815
  from: numberType().min(0),
3830
3816
  /** Excluded right border. */
3831
3817
  to: numberType().min(1)
3832
3818
  });
3833
- //#endregion
3834
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/util.js
3819
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/util.js
3835
3820
  function assertNever(x) {
3836
3821
  throw new Error("Unexpected object: " + x);
3837
3822
  }
@@ -3842,14 +3827,12 @@ function assertNever(x) {
3842
3827
  function uniqueBy(array, makeId) {
3843
3828
  return [...new Map(array.map((e) => [makeId(e), e])).values()];
3844
3829
  }
3845
- //#endregion
3846
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/ls.js
3830
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/ls.js
3847
3831
  const indexPrefix = "index://index/";
3848
3832
  function isImportFileHandleIndex(handle) {
3849
3833
  return handle.startsWith(indexPrefix);
3850
3834
  }
3851
- //#endregion
3852
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_info.js
3835
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_info.js
3853
3836
  /**
3854
3837
  * Type guard function that checks if the given value is a valid DataInfo.
3855
3838
  *
@@ -3918,9 +3901,7 @@ function visitDataInfo(dataInfo, cb) {
3918
3901
  cb(chunk.values);
3919
3902
  });
3920
3903
  break;
3921
- case "ParquetPartitioned":
3922
- Object.values(dataInfo.parts).forEach(cb);
3923
- break;
3904
+ case "ParquetPartitioned": Object.values(dataInfo.parts).forEach(cb);
3924
3905
  }
3925
3906
  }
3926
3907
  /**
@@ -4039,8 +4020,7 @@ function entriesToDataInfo(dataInfoEntries) {
4039
4020
  default: assertNever(dataInfoEntries);
4040
4021
  }
4041
4022
  }
4042
- //#endregion
4043
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/errors.js
4023
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/errors.js
4044
4024
  var ServiceError = class extends Error {
4045
4025
  name = "ServiceError";
4046
4026
  };
@@ -4063,8 +4043,7 @@ function ensureError(value) {
4063
4043
  if (value instanceof Error) return value;
4064
4044
  return new Error(stringifyValue(value));
4065
4045
  }
4066
- //#endregion
4067
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/json.js
4046
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/json.js
4068
4047
  var import_canonicalize = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4069
4048
  module.exports = function serialize(object) {
4070
4049
  if (typeof object === "number" && isNaN(object)) throw new Error("NaN is not allowed");
@@ -4096,8 +4075,7 @@ function parseJsonSafely(value, fallback) {
4096
4075
  return fallback;
4097
4076
  }
4098
4077
  }
4099
- //#endregion
4100
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js
4078
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js
4101
4079
  function readMetadata(metadata, key) {
4102
4080
  return metadata?.[key];
4103
4081
  }
@@ -4421,8 +4399,7 @@ function matchDomain$1(query, target) {
4421
4399
  function matchAxisId(query, target) {
4422
4400
  return query.name === target.name && matchDomain$1(query.domain, target.domain) && matchDomain$1(query.contextDomain, target.contextDomain);
4423
4401
  }
4424
- //#endregion
4425
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/utils.js
4402
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/query/utils.js
4426
4403
  const BOOLEAN_TYPES = /* @__PURE__ */ new Set([
4427
4404
  "numericComparison",
4428
4405
  "stringEquals",
@@ -4526,8 +4503,7 @@ function collectSpecQueryColumns(query) {
4526
4503
  } });
4527
4504
  return result;
4528
4505
  }
4529
- //#endregion
4530
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_calculate.js
4506
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_calculate.js
4531
4507
  function mapPTableDef(def, cb) {
4532
4508
  return {
4533
4509
  ...def,
@@ -4569,8 +4545,7 @@ function mapJoinEntry(entry, cb) {
4569
4545
  default: assertNever(entry);
4570
4546
  }
4571
4547
  }
4572
- //#endregion
4573
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_common.js
4548
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/table_common.js
4574
4549
  function getPTableColumnId(spec) {
4575
4550
  switch (spec.type) {
4576
4551
  case "axis": return {
@@ -4583,8 +4558,7 @@ function getPTableColumnId(spec) {
4583
4558
  };
4584
4559
  }
4585
4560
  }
4586
- //#endregion
4587
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/filtered_column.js
4561
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/filtered_column.js
4588
4562
  function stringifyColumnFilteredId(key) {
4589
4563
  return canonicalizeJson(createColumnFilteredKey(key));
4590
4564
  }
@@ -4616,8 +4590,7 @@ function applyAxisFilters(spec, axisFilters) {
4616
4590
  axesSpec: spec.axesSpec.filter((_, i) => !fixed.has(i))
4617
4591
  };
4618
4592
  }
4619
- //#endregion
4620
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/pool/spec.js
4593
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/pool/spec.js
4621
4594
  function isPObjectId(value) {
4622
4595
  if (typeof value !== "string") return false;
4623
4596
  return isPObjectKey(parseJsonSafely(value));
@@ -4699,8 +4672,7 @@ function extractAllColumns(entry) {
4699
4672
  addAllColumns(entry);
4700
4673
  return [...columns.values()];
4701
4674
  }
4702
- //#endregion
4703
- //#region ../node_modules/.pnpm/@milaboratories+helpers@1.14.5/node_modules/@milaboratories/helpers/dist/utils.js
4675
+ // ../node_modules/.pnpm/@milaboratories+helpers@1.14.7/node_modules/@milaboratories/helpers/dist/utils.js
4704
4676
  function isNil$1(v) {
4705
4677
  return v === null || v === void 0;
4706
4678
  }
@@ -4732,14 +4704,12 @@ function isPlainObject$1(value) {
4732
4704
  const prototype = Object.getPrototypeOf(value);
4733
4705
  return prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null;
4734
4706
  }
4735
- //#endregion
4736
- //#region ../node_modules/.pnpm/@milaboratories+helpers@1.14.5/node_modules/@milaboratories/helpers/dist/error.js
4707
+ // ../node_modules/.pnpm/@milaboratories+helpers@1.14.7/node_modules/@milaboratories/helpers/dist/error.js
4737
4708
  function throwError(v) {
4738
4709
  if (typeof v === "string") throw new Error(v);
4739
4710
  else throw v;
4740
4711
  }
4741
- //#endregion
4742
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/discovered_column.js
4712
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/discovered_column.js
4743
4713
  function isColumnDiscoveredKey(obj) {
4744
4714
  return typeof obj === "object" && obj !== null && "__isDiscovered" in obj;
4745
4715
  }
@@ -4758,13 +4728,11 @@ function stringifyColumnDiscoveredId(id) {
4758
4728
  ...id
4759
4729
  }));
4760
4730
  }
4761
- //#endregion
4762
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/array/uniq.mjs
4731
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/array/uniq.mjs
4763
4732
  function uniq(arr) {
4764
4733
  return [...new Set(arr)];
4765
4734
  }
4766
- //#endregion
4767
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/array/uniqBy.mjs
4735
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/array/uniqBy.mjs
4768
4736
  function uniqBy(arr, mapper) {
4769
4737
  const map = /* @__PURE__ */ new Map();
4770
4738
  for (let i = 0; i < arr.length; i++) {
@@ -4774,36 +4742,47 @@ function uniqBy(arr, mapper) {
4774
4742
  }
4775
4743
  return Array.from(map.values());
4776
4744
  }
4777
- //#endregion
4778
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isBoolean.mjs
4745
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
4746
+ function isTypedArray$1(x) {
4747
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
4748
+ }
4749
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
4750
+ function getTag(value) {
4751
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
4752
+ return Object.prototype.toString.call(value);
4753
+ }
4754
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
4755
+ function isPlainObject(value) {
4756
+ if (!value || typeof value !== "object") return false;
4757
+ const proto = Object.getPrototypeOf(value);
4758
+ if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
4759
+ return Object.prototype.toString.call(value) === "[object Object]";
4760
+ }
4761
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isBoolean.mjs
4779
4762
  function isBoolean(x) {
4780
4763
  return typeof x === "boolean";
4781
4764
  }
4782
- //#endregion
4783
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isFunction.mjs
4765
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isFunction.mjs
4784
4766
  function isFunction(value) {
4785
4767
  return typeof value === "function";
4786
4768
  }
4787
- //#endregion
4788
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isNil.mjs
4769
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isLength.mjs
4770
+ function isLength(value) {
4771
+ return Number.isSafeInteger(value) && value >= 0;
4772
+ }
4773
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isNil.mjs
4789
4774
  function isNil(x) {
4790
4775
  return x == null;
4791
4776
  }
4792
- //#endregion
4793
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
4794
- function isPlainObject(value) {
4795
- if (!value || typeof value !== "object") return false;
4796
- const proto = Object.getPrototypeOf(value);
4797
- if (!(proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null)) return false;
4798
- return Object.prototype.toString.call(value) === "[object Object]";
4799
- }
4800
- //#endregion
4801
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isString.mjs
4777
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isString.mjs
4802
4778
  function isString(value) {
4803
4779
  return typeof value === "string";
4804
4780
  }
4805
- //#endregion
4806
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/ids.js
4781
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/column_value.js
4782
+ function isColumnValueKey(obj) {
4783
+ return typeof obj === "object" && obj !== null && "__isColumnValue" in obj && obj.__isColumnValue === true && "column" in obj && isColumnUniversalId(obj.column) && "value" in obj && isString(obj.value);
4784
+ }
4785
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/ids.js
4807
4786
  /**
4808
4787
  * Canonically serializes a column key to a branded string id. Accepts both
4809
4788
  * the new {@link ColumnUniversalKey} and the deprecated {@link UniversalPColumnId}
@@ -4823,6 +4802,10 @@ function parseColumnIdSafely(str, fallback = void 0) {
4823
4802
  function isColumnUniversalKey(value) {
4824
4803
  return isPObjectKey(value) || isColumnFilteredKey(value) || isColumnDiscoveredKey(value) || isColumnOverriddenKey(value);
4825
4804
  }
4805
+ function isColumnUniversalId(value) {
4806
+ const key = isString(value) ? parseJsonSafely(value, false) : false;
4807
+ return key === false ? false : isColumnUniversalKey(key);
4808
+ }
4826
4809
  /**
4827
4810
  * Take a value out of however many `JSON.stringify` passes wrapped it, or `undefined`
4828
4811
  * when `s` is not JSON at all.
@@ -4862,7 +4845,8 @@ function peelJsonLayers(s) {
4862
4845
  }
4863
4846
  }
4864
4847
  /**
4865
- * Rewrite every block id buried inside a column id.
4848
+ * Rewrite every block id buried inside a column id, or inside the column of a column value
4849
+ * id — a picked value names its producer through that column's leaf.
4866
4850
  *
4867
4851
  * A {@link GlobalPObjectKey} leaf names its upstream by block id, and the wrapper key forms
4868
4852
  * nest by *string* id rather than by object — so a block id can sit under several layers of
@@ -4892,17 +4876,43 @@ function remapColumnIdBlockIds(id, remapBlockId) {
4892
4876
  *
4893
4877
  * Escape padding is peeled and put back, so an id that reached params through an extra
4894
4878
  * `JSON.stringify` is rewritten in place and comes back wrapped as it was found. A string
4895
- * that does not peel to a column key is left alone: params hold ordinary strings too.
4879
+ * that peels to neither a column key nor a column value key is left alone: params hold
4880
+ * ordinary strings too.
4896
4881
  */
4897
4882
  function remapIdString(id, remapBlockId) {
4898
4883
  const peeled = peelJsonLayers(id);
4899
- if (peeled === void 0 || !isColumnUniversalKey(peeled.value)) return void 0;
4900
- const remappedKey = remapKey(peeled.value, remapBlockId);
4901
- if (remappedKey === void 0) return void 0;
4902
- let rebuilt = stringifyColumnId(remappedKey);
4884
+ if (peeled === void 0) return void 0;
4885
+ let rebuilt;
4886
+ if (isColumnValueKey(peeled.value)) {
4887
+ const remappedKey = remapValueKey(peeled.value, remapBlockId);
4888
+ if (remappedKey === void 0) return void 0;
4889
+ rebuilt = canonicalizeJson(remappedKey);
4890
+ } else if (isColumnUniversalKey(peeled.value)) {
4891
+ const remappedKey = remapKey(peeled.value, remapBlockId);
4892
+ if (remappedKey === void 0) return void 0;
4893
+ rebuilt = stringifyColumnId(remappedKey);
4894
+ } else return;
4903
4895
  for (let layer = 0; layer < peeled.layers; layer++) rebuilt = JSON.stringify(rebuilt);
4904
4896
  return rebuilt;
4905
4897
  }
4898
+ /**
4899
+ * {@link remapIdString} over a column id. Remapping keeps an id's shape, so a column id comes
4900
+ * back a column id.
4901
+ */
4902
+ function remapColumnIdString(id, remapBlockId) {
4903
+ return remapIdString(id, remapBlockId);
4904
+ }
4905
+ /**
4906
+ * The value-id half of {@link remapIdString}. `undefined` means "nothing to change". Only the
4907
+ * column carries block ids; the value is cell data and stays as it is.
4908
+ */
4909
+ function remapValueKey(key, remapBlockId) {
4910
+ const column = remapColumnIdString(key.column, remapBlockId);
4911
+ return column === void 0 ? void 0 : {
4912
+ ...key,
4913
+ column
4914
+ };
4915
+ }
4906
4916
  /** The key half of {@link remapColumnIdBlockIds}. `undefined` means "nothing to change". */
4907
4917
  function remapKey(key, remapBlockId) {
4908
4918
  if (isGlobalPObjectKey(key)) {
@@ -4914,7 +4924,7 @@ function remapKey(key, remapBlockId) {
4914
4924
  }
4915
4925
  if (isLocalPObjectKey(key)) return void 0;
4916
4926
  if (isColumnFilteredKey(key)) {
4917
- const source = remapIdString(key.source, remapBlockId);
4927
+ const source = remapColumnIdString(key.source, remapBlockId);
4918
4928
  return source === void 0 ? void 0 : {
4919
4929
  ...key,
4920
4930
  source
@@ -4936,10 +4946,10 @@ function remapKey(key, remapBlockId) {
4936
4946
  * id is the map key, not the value.
4937
4947
  */
4938
4948
  function remapDiscoveredKey(key, remapBlockId) {
4939
- const column = remapIdString(key.column, remapBlockId);
4949
+ const column = remapColumnIdString(key.column, remapBlockId);
4940
4950
  let pathChanged = false;
4941
4951
  const path = key.path?.map((item) => {
4942
- const itemColumn = remapIdString(item.column, remapBlockId);
4952
+ const itemColumn = remapColumnIdString(item.column, remapBlockId);
4943
4953
  if (itemColumn === void 0) return item;
4944
4954
  pathChanged = true;
4945
4955
  return {
@@ -4976,8 +4986,7 @@ function extractPObjectId(id) {
4976
4986
  if (isColumnDiscoveredKey(id)) return extractPObjectId(id.column);
4977
4987
  throw new Error(`extractPObjectId: unrecognized column id structure: ${JSON.stringify(id)}`);
4978
4988
  }
4979
- //#endregion
4980
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/overridden.js
4989
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/overridden.js
4981
4990
  function isColumnOverriddenKey(obj) {
4982
4991
  return typeof obj === "object" && obj !== null && "__isOverridden" in obj;
4983
4992
  }
@@ -5098,8 +5107,7 @@ function mergeRecord(a, b) {
5098
5107
  ...b
5099
5108
  };
5100
5109
  }
5101
- //#endregion
5102
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/anchored.js
5110
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/anchored.js
5103
5111
  function axisKey(axis) {
5104
5112
  return (0, import_canonicalize.default)(getAxisId(axis));
5105
5113
  }
@@ -5344,8 +5352,7 @@ function resolveAxisReference(anchors, axisRef) {
5344
5352
  function isAnchorAxisRef(value) {
5345
5353
  return typeof value === "object" && "anchor" in value;
5346
5354
  }
5347
- //#endregion
5348
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/selectors.js
5355
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/selectors.js
5349
5356
  /**
5350
5357
  * Determines if an axis ID matches an axis selector.
5351
5358
  *
@@ -5425,8 +5432,7 @@ function legacyColumnSelectorsToPredicate(predicateOrSelectors) {
5425
5432
  if (Array.isArray(predicateOrSelectors)) return (spec) => predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));
5426
5433
  else return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);
5427
5434
  }
5428
- //#endregion
5429
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/native_id.js
5435
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/native_id.js
5430
5436
  function deriveNativeId(spec) {
5431
5437
  const result = {
5432
5438
  kind: spec.kind,
@@ -5437,8 +5443,7 @@ function deriveNativeId(spec) {
5437
5443
  if (isPColumnSpec(spec)) result.axesSpec = getAxesId(spec.axesSpec);
5438
5444
  return (0, import_canonicalize.default)(result);
5439
5445
  }
5440
- //#endregion
5441
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js
5446
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js
5442
5447
  var LinkerMap = class LinkerMap {
5443
5448
  /** Graph of linkers connected by axes (single or grouped by parents) */
5444
5449
  data;
@@ -5573,7 +5578,6 @@ var LinkerMap = class LinkerMap {
5573
5578
  switch (axesSpec.length) {
5574
5579
  case 0: return [];
5575
5580
  case 1: return [[axesSpec[0]]];
5576
- default: break;
5577
5581
  }
5578
5582
  const axisKeys = axesSpec.map((spec) => canonicalizeJson(getAxisId(spec)));
5579
5583
  const axisParentsIdxs = axesSpec.map((spec) => new Set(spec.parentAxesSpec.map((spec) => canonicalizeJson(getAxisId(spec))).map((el) => {
@@ -5615,61 +5619,7 @@ var LinkerMap = class LinkerMap {
5615
5619
  return axes.filter((axis) => !parentsSet.has(canonicalizeJson(getAxisId(axis))));
5616
5620
  }
5617
5621
  };
5618
- //#endregion
5619
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/flags/block_flags.js
5620
- /**
5621
- * Required PFrames version. Bump this in lockstep with the `@milaboratories/pframes-rs-*`
5622
- * version in `pnpm-workspace.yaml` so blocks built against the new SDK refuse to load on
5623
- * older desktop apps.
5624
- */
5625
- const REQUIRES_PFRAMES_VERSION = 1001031;
5626
- stringType().length(24).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/);
5627
- //#endregion
5628
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/ref.js
5629
- const PlRef = objectType({
5630
- __isRef: literalType(true).describe("Crucial marker for the block dependency tree reconstruction"),
5631
- blockId: stringType().describe("Upstream block id"),
5632
- name: stringType().describe("Name of the output provided to the upstream block's output context"),
5633
- requireEnrichments: literalType(true).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")
5634
- }).describe("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.").readonly();
5635
- /**
5636
- * Type guard to check if a value is a PlRef.
5637
- *
5638
- * @param value - The value to check.
5639
- * @returns True if the value is a PlRef, false otherwise.
5640
- */
5641
- function isPlRef(value) {
5642
- return typeof value === "object" && value !== null && "__isRef" in value && value.__isRef === true && "blockId" in value && "name" in value;
5643
- }
5644
- /**
5645
- * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the
5646
- * requireEnrichments property.
5647
- *
5648
- * @param ref - The original PlRef object.
5649
- * @param requireEnrichments - If true, the `requireEnrichments: true` property is added
5650
- * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.
5651
- * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.
5652
- */
5653
- function withEnrichments(ref, requireEnrichments = true) {
5654
- if (requireEnrichments) return {
5655
- ...ref,
5656
- requireEnrichments: true
5657
- };
5658
- else {
5659
- const { requireEnrichments: _, ...rest } = ref;
5660
- return rest;
5661
- }
5662
- }
5663
- //#endregion
5664
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/value_or_error.js
5665
- function mapValueInVOE(voe, cb) {
5666
- return voe.ok ? {
5667
- ok: true,
5668
- value: cb(voe.value)
5669
- } : voe;
5670
- }
5671
- //#endregion
5672
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/resource_types.js
5622
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/resource_types.js
5673
5623
  /** Well-known resource type names used across the platform. */
5674
5624
  const ResourceTypeName = {
5675
5625
  StreamManager: "StreamManager",
@@ -5715,10 +5665,110 @@ const ResourceTypeName = {
5715
5665
  ClientRoot: "ClientRoot",
5716
5666
  SharingOutbox: "SharingOutbox",
5717
5667
  SharingState: "SharingState",
5718
- SharedEnvelope: "SharedEnvelope"
5668
+ SharedEnvelope: "SharedEnvelope",
5669
+ ActionContext: "ActionContext"
5719
5670
  };
5720
- //#endregion
5721
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/services/service_types.js
5671
+ objectType({
5672
+ type: literalType("plain"),
5673
+ content: stringType()
5674
+ });
5675
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/bmodel/block_kind_ref.js
5676
+ /**
5677
+ * Compose a {@link BlockKindReference} from a kind's `name`/`version`.
5678
+ *
5679
+ * The single place that decides how the reference is assembled. If global
5680
+ * uniqueness later requires the name segment to be org-qualified, this is the
5681
+ * one line that changes.
5682
+ */
5683
+ const formatKindRef = (k) => `${k.name}@${k.version}`;
5684
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/flags/block_flags.js
5685
+ /**
5686
+ * Required PFrames version. Bump this in lockstep with the `@milaboratories/pframes-rs-*`
5687
+ * version in `pnpm-workspace.yaml` so blocks built against the new SDK refuse to load on
5688
+ * older desktop apps.
5689
+ */
5690
+ const REQUIRES_PFRAMES_VERSION = 1001031;
5691
+ stringType().length(24).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/);
5692
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/ref.js
5693
+ /** One output of one block: the block and the name of the output in its output context. */
5694
+ const BlockOutput = objectType({
5695
+ blockId: stringType().describe("Upstream block id"),
5696
+ name: stringType().describe("Name of the output provided to the upstream block's output context")
5697
+ });
5698
+ const PlRef = objectType({
5699
+ __isRef: literalType(true).describe("Crucial marker for the block dependency tree reconstruction"),
5700
+ ...BlockOutput.shape,
5701
+ requireEnrichments: literalType(true).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")
5702
+ }).describe("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.").readonly();
5703
+ /**
5704
+ * Type guard to check if a value is a PlRef.
5705
+ *
5706
+ * @param value - The value to check.
5707
+ * @returns True if the value is a PlRef, false otherwise.
5708
+ */
5709
+ function isPlRef(value) {
5710
+ return typeof value === "object" && value !== null && "__isRef" in value && value.__isRef === true && "blockId" in value && "name" in value;
5711
+ }
5712
+ /**
5713
+ * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the
5714
+ * requireEnrichments property.
5715
+ *
5716
+ * @param ref - The original PlRef object.
5717
+ * @param requireEnrichments - If true, the `requireEnrichments: true` property is added
5718
+ * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.
5719
+ * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.
5720
+ */
5721
+ function withEnrichments(ref, requireEnrichments = true) {
5722
+ if (requireEnrichments) return {
5723
+ ...ref,
5724
+ requireEnrichments: true
5725
+ };
5726
+ else {
5727
+ const { requireEnrichments: _, ...rest } = ref;
5728
+ return rest;
5729
+ }
5730
+ }
5731
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/args_issue.js
5732
+ /**
5733
+ * Reads one {@link ArgsIssue} from a value of unknown origin.
5734
+ *
5735
+ * Any severity other than `"warning"` is read as `"error"`: an issue whose weight cannot be
5736
+ * told keeps the block from running rather than letting it run on a misread finding.
5737
+ *
5738
+ * @throws when `value` is not an object carrying a string `message`
5739
+ */
5740
+ function parseArgsIssue(value) {
5741
+ if (typeof value !== "object" || value === null) throw new Error(`An args issue must be an object, got ${describe$1(value)}`);
5742
+ const message = "message" in value ? value.message : void 0;
5743
+ if (!isString(message)) throw new Error(`An args issue must carry a string message, got ${describe$1(message)}`);
5744
+ return {
5745
+ severity: "severity" in value && value.severity === "warning" ? "warning" : "error",
5746
+ message
5747
+ };
5748
+ }
5749
+ /**
5750
+ * Reads a list of {@link ArgsIssue}s from a value of unknown origin, each entry as
5751
+ * {@link parseArgsIssue} reads it.
5752
+ *
5753
+ * @throws when `value` is not an array, or one of its entries is not an issue
5754
+ */
5755
+ function parseArgsIssues(value) {
5756
+ if (!Array.isArray(value)) throw new Error(`Args issues must be an array, got ${describe$1(value)}`);
5757
+ return value.map(parseArgsIssue);
5758
+ }
5759
+ function describe$1(value) {
5760
+ if (value === null) return "null";
5761
+ if (Array.isArray(value)) return "an array";
5762
+ return typeof value;
5763
+ }
5764
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/value_or_error.js
5765
+ function mapValueInVOE(voe, cb) {
5766
+ return voe.ok ? {
5767
+ ok: true,
5768
+ value: cb(voe.value)
5769
+ } : voe;
5770
+ }
5771
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/services/service_types.js
5722
5772
  const SERVICE_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9]*$/;
5723
5773
  const { service, isNodeService, isWasmService, isMainService, getServiceKind, getServiceModelMethods, getServiceUiMethods } = (() => {
5724
5774
  const typeMap = /* @__PURE__ */ new Map();
@@ -5756,8 +5806,7 @@ const { service, isNodeService, isWasmService, isMainService, getServiceKind, ge
5756
5806
  }
5757
5807
  };
5758
5808
  })();
5759
- //#endregion
5760
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/services/service_declarations.js
5809
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/services/service_declarations.js
5761
5810
  const Services = {
5762
5811
  PFrameSpec: service()({
5763
5812
  type: "wasm",
@@ -5850,8 +5899,7 @@ function resolveRequiredServices(flags) {
5850
5899
  return Object.keys(Services).filter((key) => flags[`requires${key}`] === true).map((key) => Services[key]);
5851
5900
  }
5852
5901
  Object.fromEntries(Object.keys(Services).map((key) => [`requires${key}`, true]));
5853
- //#endregion
5854
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/services/service_injectors.js
5902
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/services/service_injectors.js
5855
5903
  function buildMethodMap(pick) {
5856
5904
  const result = {};
5857
5905
  for (const id of Object.values(Services)) result[id] = [...pick(id)];
@@ -5859,8 +5907,7 @@ function buildMethodMap(pick) {
5859
5907
  }
5860
5908
  buildMethodMap(getServiceUiMethods);
5861
5909
  buildMethodMap(getServiceModelMethods);
5862
- //#endregion
5863
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/columns/accessor_traversal.js
5910
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/columns/accessor_traversal.js
5864
5911
  /** Resource types that hold column collections — DFS stops here and collects. */
5865
5912
  const COLLECT_TYPES = [ResourceTypeName.PFrame];
5866
5913
  /** Resource types DFS descends through when looking for PFrames. */
@@ -5967,8 +6014,7 @@ function indexPoolBlock(block) {
5967
6014
  }
5968
6015
  return result;
5969
6016
  }
5970
- //#endregion
5971
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/columns/column_registry.js
6017
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/columns/column_registry.js
5972
6018
  /**
5973
6019
  * Id-index over a set of {@link ColumnEntriesProvider}s. Sole job:
5974
6020
  * {@link PObjectId} → {@link LeafEntry}. Generic over the accessor flavour, so
@@ -6004,8 +6050,7 @@ var ColumnRegistry = class {
6004
6050
  }
6005
6051
  }
6006
6052
  };
6007
- //#endregion
6008
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/columns/dedup.js
6053
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/columns/dedup.js
6009
6054
  /**
6010
6055
  * Two-track dedup over an item stream keyed by `ColumnUniversalId`:
6011
6056
  *
@@ -6045,8 +6090,7 @@ function dedupColumns(items, getId, getSpec) {
6045
6090
  }
6046
6091
  return out;
6047
6092
  }
6048
- //#endregion
6049
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/columns/providers.js
6093
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/columns/providers.js
6050
6094
  /**
6051
6095
  * Generic entries provider over a single accessor root. Walks `<root>` once
6052
6096
  * from the supplied `rootPath`, builds an id → {@link LeafEntry} map and
@@ -6102,8 +6146,7 @@ var ResultPoolEntriesProvider = class {
6102
6146
  return true;
6103
6147
  }
6104
6148
  };
6105
- //#endregion
6106
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/template/template_ref_form.js
6149
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/template/template_ref_form.js
6107
6150
  /**
6108
6151
  * Whether `value` is a reference in the readable spelling.
6109
6152
  *
@@ -6171,8 +6214,7 @@ function expandTemplatePlRef(ref) {
6171
6214
  name: ref.name
6172
6215
  };
6173
6216
  }
6174
- //#endregion
6175
- //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.52.0/node_modules/@milaboratories/pl-model-common/dist/template/template_relocate.js
6217
+ // ../node_modules/.pnpm/@milaboratories+pl-model-common@1.55.2/node_modules/@milaboratories/pl-model-common/dist/template/template_relocate.js
6176
6218
  /**
6177
6219
  * Point every column identifier in a block's params at the blocks of the project being built.
6178
6220
  *
@@ -6231,8 +6273,7 @@ function relocateBlockIds(params, blockIds) {
6231
6273
  const relocateDomain = (domain) => Object.fromEntries(Object.entries(domain).map(([key, value]) => [key, typeof value === "string" && BlockScopedDomain.has(key) ? remapBlockId(value) : walk(value)]));
6232
6274
  return walk(params);
6233
6275
  }
6234
- //#endregion
6235
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/block_migrations.js
6276
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/block_migrations.js
6236
6277
  /** Create a DataVersioned wrapper with correct shape */
6237
6278
  function makeVersionedData(version, data) {
6238
6279
  return {
@@ -6544,9 +6585,10 @@ var DataModelInitialChain = class extends DataModelMigrationChain {
6544
6585
  if (data !== null && typeof data === "object" && "args" in data) return fn(data);
6545
6586
  return data;
6546
6587
  };
6588
+ const initialVersion = this.versionChain[0];
6547
6589
  const step = {
6548
6590
  fromVersion: DATA_MODEL_LEGACY_VERSION,
6549
- toVersion: this.versionChain[0],
6591
+ toVersion: initialVersion,
6550
6592
  migrate: wrappedFn
6551
6593
  };
6552
6594
  return new DataModelMigrationChainWithRecover({
@@ -6809,8 +6851,7 @@ var DataModel = class DataModel {
6809
6851
  };
6810
6852
  }
6811
6853
  };
6812
- //#endregion
6813
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/internal.js
6854
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/internal.js
6814
6855
  /** Utility code helping to identify whether the code is running in actual UI environment */
6815
6856
  function isInUI() {
6816
6857
  return typeof globalThis.getPlatforma !== "undefined" || typeof globalThis.platforma !== "undefined";
@@ -6879,8 +6920,7 @@ function registerFutureAwait(handle, onResolve) {
6879
6920
  }
6880
6921
  futureResolves.get(handle).push(onResolve);
6881
6922
  }
6882
- //#endregion
6883
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/block_storage_facade.js
6923
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/block_storage_facade.js
6884
6924
  /**
6885
6925
  * All facade callback names as constants.
6886
6926
  * These are the source of truth - the interface is derived from these.
@@ -6917,8 +6957,7 @@ const BlockStorageFacadeHandles = createFacadeHandles(BlockStorageFacadeCallback
6917
6957
  function registerFacadeCallbacks(callbacks) {
6918
6958
  for (const key of Object.values(BlockStorageFacadeCallbacks)) tryRegisterCallback(key, callbacks[key]);
6919
6959
  }
6920
- //#endregion
6921
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/services/block_services.js
6960
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/services/block_services.js
6922
6961
  /**
6923
6962
  * Services required by all V3 blocks by default.
6924
6963
  * Edit this when a new service should be available to all blocks.
@@ -6933,8 +6972,7 @@ const BLOCK_SERVICE_FLAGS = {
6933
6972
  requiresColumnsCollection: true
6934
6973
  };
6935
6974
  resolveRequiredServices(BLOCK_SERVICE_FLAGS);
6936
- //#endregion
6937
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/future.js
6975
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/future.js
6938
6976
  var FutureRef = class FutureRef {
6939
6977
  handle;
6940
6978
  postProcess;
@@ -6961,8 +6999,7 @@ var FutureRef = class FutureRef {
6961
6999
  return this.isResolved ? this.resolvedValue : { __awaited_futures__: [this.handle] };
6962
7000
  }
6963
7001
  };
6964
- //#endregion
6965
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/accessor.js
7002
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/accessor.js
6966
7003
  function ifDef(value, cb) {
6967
7004
  return value === void 0 ? void 0 : cb(value);
6968
7005
  }
@@ -7211,12 +7248,10 @@ var TreeNodeAccessor = class TreeNodeAccessor {
7211
7248
  return fieldEntries.map(([name, value]) => mapping(name, value));
7212
7249
  }
7213
7250
  };
7214
- //#endregion
7215
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/internal.js
7251
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/internal.js
7216
7252
  const MainAccessorName = "main";
7217
7253
  const StagingAccessorName = "staging";
7218
- //#endregion
7219
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/util/axis_filtering.js
7254
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/util/axis_filtering.js
7220
7255
  function filterDataInfoEntries(dataInfoEntries, axisFilters) {
7221
7256
  const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
7222
7257
  const { type } = dataInfoEntries;
@@ -7279,8 +7314,7 @@ function filterDataInfoEntries(dataInfoEntries, axisFilters) {
7279
7314
  };
7280
7315
  }
7281
7316
  }
7282
- //#endregion
7283
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/labels/linked_column_postfix.js
7317
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/labels/linked_column_postfix.js
7284
7318
  /**
7285
7319
  * Structural postfix derivation for linked columns (phase 2 of `deriveDistinctLabels`).
7286
7320
  *
@@ -7452,7 +7486,10 @@ function resolveGroup(entries, indices, format) {
7452
7486
  * linked columns by the difference between their sources.
7453
7487
  */
7454
7488
  function derivePostfixes(entries, format = defaultLinkerFormatter) {
7455
- const postfix = [...entries.reduce((acc, e, idx) => acc.set(e.stem, [...acc.get(e.stem) ?? [], idx]), /* @__PURE__ */ new Map()).values()].reduce((acc, idxs) => {
7489
+ const postfix = [...entries.reduce((acc, e, idx) => {
7490
+ const key = `${e.stem}\u0000${e.marker ?? ""}`;
7491
+ return acc.set(key, [...acc.get(key) ?? [], idx]);
7492
+ }, /* @__PURE__ */ new Map()).values()].reduce((acc, idxs) => {
7456
7493
  if (idxs.length < 2) return acc;
7457
7494
  const resolved = resolveGroup(idxs.map((i) => entries[i]), idxs, format);
7458
7495
  return idxs.reduce((m, i, k) => m.set(i, resolved[k]), acc);
@@ -7462,8 +7499,7 @@ function derivePostfixes(entries, format = defaultLinkerFormatter) {
7462
7499
  return p ? `${e.stem} ${p}` : e.stem;
7463
7500
  });
7464
7501
  }
7465
- //#endregion
7466
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/labels/derive_distinct_labels.js
7502
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/labels/derive_distinct_labels.js
7467
7503
  const DISTANCE_PENALTY = .001;
7468
7504
  const LABEL_TYPE = "__LABEL__";
7469
7505
  const LABEL_TYPE_FULL = "__LABEL__@1";
@@ -7485,9 +7521,10 @@ function isSyntheticType(t) {
7485
7521
  function deriveDistinctLabels(values, options = {}) {
7486
7522
  const stems = deriveStems(values, options);
7487
7523
  return derivePostfixes(values.map((v, i) => {
7488
- const { spec, linkerPath } = extractEntryParts(v);
7524
+ const { spec, linkerPath, marker } = extractEntryParts(v);
7489
7525
  return {
7490
7526
  stem: stems[i],
7527
+ marker,
7491
7528
  hit: spec,
7492
7529
  linkers: (linkerPath ?? []).map((s) => s.spec)
7493
7530
  };
@@ -7505,6 +7542,7 @@ function deriveStems(values, options) {
7505
7542
  if (labelForced) forcedSet.add(LABEL_TYPE_FULL);
7506
7543
  const { mainTypes, secondaryTypes } = classifyTypes(stats, values.length);
7507
7544
  const build = (typeSet, force) => buildLabels(records, typeSet, forceTraceElements, separator, force);
7545
+ const finalize = (minimized, rendered) => repairBareLabels(rendered, minimized, records, stats, forceTraceElements, separator);
7508
7546
  if (mainTypes.length === 0) {
7509
7547
  if (secondaryTypes.length !== 0) throw new Error("Non-empty secondary types list while main types list is empty.");
7510
7548
  return build(/* @__PURE__ */ new Set([LABEL_TYPE_FULL]), true) ?? throwError("Failed to derive labels using native column labels");
@@ -7518,7 +7556,7 @@ function deriveStems(values, options) {
7518
7556
  const candidateResult = build(currentSet, false);
7519
7557
  if (candidateResult !== void 0 && countUniqueLabels(candidateResult) === values.length) {
7520
7558
  const minimized = minimizeTypeSet(currentSet, records, stats, forceTraceElements, forcedSet, separator);
7521
- return repairBareByPresence(build(minimized, false) ?? throwError("Failed to derive unique labels"), minimized, records, stats, forcedSet, forceTraceElements, separator);
7559
+ return finalize(minimized, build(minimized, false) ?? throwError("Failed to derive unique labels"));
7522
7560
  }
7523
7561
  additionalType++;
7524
7562
  if (additionalType >= mainTypes.length) {
@@ -7531,20 +7569,22 @@ function deriveStems(values, options) {
7531
7569
  ...mainTypes,
7532
7570
  ...secondaryTypes
7533
7571
  ]), records, stats, forceTraceElements, forcedSet, separator);
7534
- return repairBareByPresence(build(minimized, true) ?? throwError("Failed to derive unique labels"), minimized, records, stats, forcedSet, forceTraceElements, separator);
7572
+ return finalize(minimized, build(minimized, true) ?? throwError("Failed to derive unique labels"));
7535
7573
  }
7536
7574
  function extractEntryParts(entry) {
7537
7575
  if (!("spec" in entry && typeof entry.spec === "object")) return {
7538
7576
  spec: entry,
7539
7577
  extraTrace: void 0,
7540
7578
  linkerPath: void 0,
7541
- qualifications: void 0
7579
+ qualifications: void 0,
7580
+ marker: void 0
7542
7581
  };
7543
7582
  return {
7544
7583
  spec: entry.spec,
7545
7584
  extraTrace: entry.extraTrace,
7546
7585
  linkerPath: entry.linkerPath,
7547
- qualifications: entry.qualifications
7586
+ qualifications: entry.qualifications,
7587
+ marker: entry.marker
7548
7588
  };
7549
7589
  }
7550
7590
  function formatQualification(q) {
@@ -7696,62 +7736,201 @@ function minimizeTypeSet(typeSet, records, stats, forceTraceElements, forcedSet,
7696
7736
  }
7697
7737
  return result;
7698
7738
  }
7699
- const ABSENT_VALUE = "\0absent";
7700
- /** Whether `fullType`'s rendered value differs across the group (absence counts as a value). */
7701
- function typeDistinguishes(records, group, fullType) {
7702
- const values = /* @__PURE__ */ new Set();
7703
- for (const i of group) {
7704
- const ft = records[i].fullTrace.find((e) => e.fullType === fullType);
7705
- values.add(ft?.label ?? ABSENT_VALUE);
7706
- if (values.size > 1) return true;
7707
- }
7708
- return false;
7709
- }
7710
- /** The highest-importance trace type this row HAS (outside `typeSet`) that sets it apart from its
7711
- * group peers. `undefined` when the row carries nothing distinguishing of its own. */
7712
- function bestDistinguishingType(records, group, row, typeSet, forcedSet, forceTraceElements, stats) {
7713
- return records[row].fullTrace.reduce((best, ft) => {
7714
- if (typeSet.has(ft.fullType) || forcedSet.has(ft.fullType) || forceTraceElements?.has(ft.type)) return best;
7715
- if (!typeDistinguishes(records, group, ft.fullType)) return best;
7716
- const imp = stats.importances.get(ft.fullType) ?? 0;
7717
- return best === void 0 || imp > best.imp ? {
7718
- type: ft.fullType,
7719
- imp
7720
- } : best;
7721
- }, void 0)?.type;
7722
- }
7723
- /**
7724
- * Un-bare columns distinguished only "by absence". After minimization a column can end up with a
7725
- * bare trace zone (only the forced native label) while a peer sharing that same base renders extra
7726
- * tokens — the column reads as unique purely because it LACKS what the peer has. For each such bare
7727
- * column this re-renders JUST that column's label with the highest-importance trace type it actually
7728
- * carries that tells it apart from its peers, so every colliding column is distinguished by a token
7729
- * it HAS rather than by omission.
7730
- *
7731
- * Patches individual labels rather than the shared type set on purpose: the set is global, so adding
7732
- * a type there would also decorate unrelated columns in other groups that happen to carry it. Only
7733
- * bare columns' labels grow (a superset of their previous value), so uniqueness is preserved. Groups
7734
- * are keyed by the base = the label rendered from the forced types alone.
7735
- */
7736
- function repairBareByPresence(labels, minimized, records, stats, forcedSet, forceTraceElements, separator) {
7737
- const base = records.map((r) => renderRecordLabel(r, forcedSet, forceTraceElements, separator));
7738
- const isBare = records.map((r, i) => renderRecordLabel(r, minimized, forceTraceElements, separator) === base[i]);
7739
- const groups = records.reduce((acc, _, i) => acc.set(base[i] ?? "", [...acc.get(base[i] ?? "") ?? [], i]), /* @__PURE__ */ new Map());
7739
+ /**
7740
+ * Repairs labels told apart only by what they lack: in a group with the same shown base, a
7741
+ * member is bare when its shown parts are a strict subset of a peer's. The group is re-labelled
7742
+ * from parts all members carry, or bare members add a hidden part (group-wide when labels stay
7743
+ * unique), whichever keeps the more important distinction; labels stay unique across the list.
7744
+ */
7745
+ function repairBareLabels(labels, minimized, records, stats, forceTraceElements, separator) {
7746
+ const traces = records.map((r) => new Map(r.fullTrace.map((ft) => [ft.fullType, ft.label])));
7747
+ const isQualification = (t) => isSyntheticType(t.split("@")[0]);
7748
+ const depths = records.map((r) => {
7749
+ const steps = r.fullTrace.filter((ft) => ft.fullType !== LABEL_TYPE_FULL && !isQualification(ft.fullType));
7750
+ return new Map(steps.map((ft, idx) => [ft.fullType, steps.length - idx]));
7751
+ });
7752
+ const isForced = (t) => forceTraceElements?.has(t.split("@")[0]) === true;
7753
+ const isDistinctionType = (t) => t !== LABEL_TYPE_FULL && !isQualification(t);
7754
+ const importance = (t) => stats.importances.get(t) ?? 0;
7755
+ const byImportance = (a, b) => importance(b) - importance(a);
7756
+ const render = (i, types) => renderRecordLabel(records[i], types, forceTraceElements, separator);
7757
+ const partKey = (t, l) => `${t}\u0000${l}`;
7758
+ const labelShown = minimized.has(LABEL_TYPE_FULL);
7759
+ const baseTypes = new Set(labelShown ? [LABEL_TYPE_FULL] : []);
7760
+ const qualTypes = [...minimized].filter(isQualification);
7761
+ const groups = /* @__PURE__ */ new Map();
7762
+ records.forEach((_, i) => {
7763
+ const key = render(i, baseTypes) ?? "";
7764
+ const group = groups.get(key);
7765
+ if (group) group.push(i);
7766
+ else groups.set(key, [i]);
7767
+ });
7740
7768
  const patched = [...labels];
7741
- for (const group of groups.values()) {
7742
- if (!group.some((i) => !isBare[i])) continue;
7743
- for (const i of group) {
7744
- if (!isBare[i]) continue;
7745
- const chosen = bestDistinguishingType(records, group, i, minimized, forcedSet, forceTraceElements, stats);
7746
- if (chosen === void 0) continue;
7747
- const withToken = /* @__PURE__ */ new Set([...minimized, chosen]);
7748
- patched[i] = renderRecordLabel(records[i], withToken, forceTraceElements, separator) ?? patched[i];
7749
- }
7769
+ const counts = /* @__PURE__ */ new Map();
7770
+ const addCount = (l, d) => counts.set(l, (counts.get(l) ?? 0) + d);
7771
+ for (const l of patched) addCount(l, 1);
7772
+ const tryApply = (members, next) => {
7773
+ if (new Set(next).size !== members.length) return false;
7774
+ for (const i of members) addCount(patched[i], -1);
7775
+ const clashes = next.some((l) => (counts.get(l) ?? 0) > 0);
7776
+ members.forEach((i, k) => {
7777
+ if (!clashes) patched[i] = next[k];
7778
+ addCount(patched[i], 1);
7779
+ });
7780
+ return !clashes;
7781
+ };
7782
+ for (const [key, group] of groups) {
7783
+ if (group.length < 2) continue;
7784
+ const shown = group.map((i) => [...traces[i]].filter(([t]) => t !== LABEL_TYPE_FULL && (minimized.has(t) || isForced(t))));
7785
+ const partKeys = shown.map((parts) => parts.map(([t, l]) => partKey(t, l)));
7786
+ const sigIndex = /* @__PURE__ */ new Map();
7787
+ const setKeys = [];
7788
+ const setMembers = [];
7789
+ const sigOf = partKeys.map((keys, k) => {
7790
+ const sig = [...keys].sort().join("");
7791
+ let s = sigIndex.get(sig);
7792
+ if (s === void 0) {
7793
+ s = setKeys.length;
7794
+ sigIndex.set(sig, s);
7795
+ setKeys.push(keys);
7796
+ setMembers.push([]);
7797
+ }
7798
+ setMembers[s].push(k);
7799
+ return s;
7800
+ });
7801
+ const setSets = setKeys.map((keys) => new Set(keys));
7802
+ const postings = /* @__PURE__ */ new Map();
7803
+ setKeys.forEach((keys, s) => keys.forEach((p) => {
7804
+ const list = postings.get(p);
7805
+ if (list) list.push(s);
7806
+ else postings.set(p, [s]);
7807
+ }));
7808
+ const withParts = setKeys.map((_, s) => s).filter((s) => setKeys[s].length > 0);
7809
+ const supersetSets = setKeys.map((keys, s) => {
7810
+ if (keys.length === 0) return withParts;
7811
+ const rarest = keys.reduce((a, b) => postings.get(a).length <= postings.get(b).length ? a : b);
7812
+ return postings.get(rarest).filter((t) => t !== s && setSets[t].size > keys.length && keys.every((x) => setSets[t].has(x)));
7813
+ });
7814
+ const bare = group.map((_, k) => supersetSets[sigOf[k]].length > 0);
7815
+ if (!bare.some(Boolean)) continue;
7816
+ const typeCount = /* @__PURE__ */ new Map();
7817
+ for (const i of group) for (const t of traces[i].keys()) typeCount.set(t, (typeCount.get(t) ?? 0) + 1);
7818
+ const isUneven = (t) => (typeCount.get(t) ?? 0) > 0 && typeCount.get(t) < group.length;
7819
+ const unevenMax = Math.max(...[...minimized].filter((t) => isDistinctionType(t) && !isForced(t) && isUneven(t)).map(importance));
7820
+ let sharedLabels;
7821
+ let sharedMax = Number.NEGATIVE_INFINITY;
7822
+ if (labelShown && key !== "") {
7823
+ const shared = [...typeCount].filter(([t, n]) => n === group.length && isDistinctionType(t)).map(([t]) => t).sort(byImportance);
7824
+ const chosen = new Set(baseTypes);
7825
+ const distinctCount = (types) => new Set(group.map((i) => render(i, types) ?? "")).size;
7826
+ let count = distinctCount(chosen);
7827
+ for (const t of shared) {
7828
+ if (count === group.length) break;
7829
+ const next = distinctCount(/* @__PURE__ */ new Set([...chosen, t]));
7830
+ if (next > count) {
7831
+ if (chosen.size === baseTypes.size) sharedMax = importance(t);
7832
+ chosen.add(t);
7833
+ count = next;
7834
+ }
7835
+ }
7836
+ const withTags = /* @__PURE__ */ new Set([...chosen, ...qualTypes]);
7837
+ const complete = group.map((i) => render(i, withTags)).filter((l) => l !== void 0);
7838
+ if (count === group.length && complete.length === group.length && new Set(complete).size === group.length) sharedLabels = complete;
7839
+ }
7840
+ const applyBareFix = () => {
7841
+ const bareMembers = group.filter((_, k) => bare[k]);
7842
+ const oldBare = /* @__PURE__ */ new Map();
7843
+ for (const i of bareMembers) oldBare.set(patched[i], (oldBare.get(patched[i]) ?? 0) + 1);
7844
+ const isFree = (l) => (counts.get(l) ?? 0) - (oldBare.get(l) ?? 0) === 0;
7845
+ const shownTypes = (k) => [
7846
+ ...baseTypes,
7847
+ ...shown[k].map(([t]) => t),
7848
+ ...qualTypes
7849
+ ];
7850
+ const setLabels = /* @__PURE__ */ new Map();
7851
+ const labelsIn = (s) => {
7852
+ let byType = setLabels.get(s);
7853
+ if (byType) return byType;
7854
+ byType = /* @__PURE__ */ new Map();
7855
+ for (const m of setMembers[s]) for (const [t, l] of traces[group[m]]) {
7856
+ const entry = byType.get(t) ?? {
7857
+ labels: /* @__PURE__ */ new Set(),
7858
+ n: 0
7859
+ };
7860
+ entry.labels.add(l);
7861
+ entry.n++;
7862
+ byType.set(t, entry);
7863
+ }
7864
+ setLabels.set(s, byType);
7865
+ return byType;
7866
+ };
7867
+ const someDiffers = (s, u, mine) => {
7868
+ const entry = labelsIn(s).get(u);
7869
+ if (entry === void 0) return mine !== void 0;
7870
+ if (entry.n < setMembers[s].length) return true;
7871
+ return entry.labels.size > 1 || !entry.labels.has(mine ?? "");
7872
+ };
7873
+ const extraDepthsOf = /* @__PURE__ */ new Map();
7874
+ const extraDepths = (s) => {
7875
+ let depthsSet = extraDepthsOf.get(s);
7876
+ if (depthsSet) return depthsSet;
7877
+ depthsSet = new Set(supersetSets[s].flatMap((t) => {
7878
+ const rep = setMembers[t][0];
7879
+ return shown[rep].filter(([u, l]) => !isQualification(u) && !setSets[s].has(partKey(u, l))).map(([u]) => depths[group[rep]].get(u));
7880
+ }));
7881
+ extraDepthsOf.set(s, depthsSet);
7882
+ return depthsSet;
7883
+ };
7884
+ const picks = /* @__PURE__ */ new Map();
7885
+ group.forEach((i, k) => {
7886
+ if (!bare[k]) return;
7887
+ const peers = supersetSets[sigOf[k]];
7888
+ const kindDepths = extraDepths(sigOf[k]);
7889
+ const sameKind = (u) => kindDepths.has(depths[i].get(u)) ? 1 : 0;
7890
+ const candidates = [...traces[i].keys()].filter((u) => !minimized.has(u) && !isForced(u)).filter((u) => peers.some((t) => someDiffers(t, u, traces[i].get(u)))).sort((a, b) => sameKind(b) - sameKind(a) || byImportance(a, b));
7891
+ for (const u of candidates) {
7892
+ const label = render(i, /* @__PURE__ */ new Set([...shownTypes(k), u]));
7893
+ if (label !== void 0 && isFree(label)) {
7894
+ picks.set(i, {
7895
+ type: u,
7896
+ label
7897
+ });
7898
+ break;
7899
+ }
7900
+ }
7901
+ });
7902
+ if (picks.size === 0) return false;
7903
+ if (labelShown && key !== "") {
7904
+ const picked = [...new Set([...picks.values()].map((p) => p.type))];
7905
+ const full = group.map((i, k) => render(i, /* @__PURE__ */ new Set([...shownTypes(k), ...picked]))).filter((l) => l !== void 0);
7906
+ if (full.length === group.length && tryApply(group, full)) return true;
7907
+ }
7908
+ const proposed = new Map([...picks].map(([i, p]) => [i, p.label]));
7909
+ for (let changed = true; changed;) {
7910
+ changed = false;
7911
+ const firstOld = /* @__PURE__ */ new Map();
7912
+ for (const [i, l] of proposed) {
7913
+ const old = firstOld.get(l);
7914
+ if (old === void 0) firstOld.set(l, patched[i]);
7915
+ else if (old !== patched[i]) changed = proposed.delete(i);
7916
+ }
7917
+ const kept = new Set(bareMembers.filter((i) => !proposed.has(i)).map((i) => patched[i]));
7918
+ for (const [i, l] of proposed) if (kept.has(l)) changed = proposed.delete(i);
7919
+ }
7920
+ for (const i of bareMembers) addCount(patched[i], -1);
7921
+ for (const i of bareMembers) {
7922
+ patched[i] = proposed.get(i) ?? patched[i];
7923
+ addCount(patched[i], 1);
7924
+ }
7925
+ return proposed.size > 0;
7926
+ };
7927
+ if (sharedLabels && sharedMax >= unevenMax && tryApply(group, sharedLabels)) continue;
7928
+ if (applyBareFix()) continue;
7929
+ if (sharedLabels && sharedMax < unevenMax) tryApply(group, sharedLabels);
7750
7930
  }
7751
7931
  return patched;
7752
7932
  }
7753
- //#endregion
7754
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/util/label.js
7933
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/util/label.js
7755
7934
  /** @deprecated Use deriveDistinctLabels */
7756
7935
  function deriveLabels(values, getSpec, options = {}) {
7757
7936
  return deriveDistinctLabels(values.map(getSpec), options).map((label, i) => ({
@@ -7759,16 +7938,17 @@ function deriveLabels(values, getSpec, options = {}) {
7759
7938
  label
7760
7939
  }));
7761
7940
  }
7762
- //#endregion
7763
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/util/pcolumn_data.js
7764
- const RT_RESOURCE_MAP = "PColumnData/ResourceMap";
7765
- const RT_RESOURCE_MAP_PARTITIONED = "PColumnData/Partitioned/ResourceMap";
7766
- const RT_JSON_PARTITIONED = "PColumnData/JsonPartitioned";
7767
- const RT_BINARY_PARTITIONED = "PColumnData/BinaryPartitioned";
7768
- const RT_PARQUET_PARTITIONED = "PColumnData/ParquetPartitioned";
7769
- const RT_JSON_SUPER_PARTITIONED = "PColumnData/Partitioned/JsonPartitioned";
7770
- const RT_BINARY_SUPER_PARTITIONED = "PColumnData/Partitioned/BinaryPartitioned";
7771
- const RT_PARQUET_SUPER_PARTITIONED = "PColumnData/Partitioned/ParquetPartitioned";
7941
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/util/pcolumn_data.js
7942
+ const PCD_PREFIX = "PColumnData/";
7943
+ const RT_RESOURCE_MAP = PCD_PREFIX + "ResourceMap";
7944
+ const RT_RESOURCE_MAP_PARTITIONED = PCD_PREFIX + "Partitioned/ResourceMap";
7945
+ const RT_JSON_PARTITIONED = PCD_PREFIX + "JsonPartitioned";
7946
+ const RT_BINARY_PARTITIONED = PCD_PREFIX + "BinaryPartitioned";
7947
+ const RT_PARQUET_PARTITIONED = PCD_PREFIX + "ParquetPartitioned";
7948
+ const PCD_SUP_PREFIX = PCD_PREFIX + "Partitioned/";
7949
+ const RT_JSON_SUPER_PARTITIONED = PCD_SUP_PREFIX + "JsonPartitioned";
7950
+ const RT_BINARY_SUPER_PARTITIONED = PCD_SUP_PREFIX + "BinaryPartitioned";
7951
+ const RT_PARQUET_SUPER_PARTITIONED = PCD_SUP_PREFIX + "ParquetPartitioned";
7772
7952
  function populateResourceMapData(acc, resourceParser, data, keyPrefix = [], addEntriesWithNoData) {
7773
7953
  if (acc === void 0) return false;
7774
7954
  switch (acc.resourceType.name) {
@@ -7846,9 +8026,7 @@ function getPartitionKeysList(acc) {
7846
8026
  break;
7847
8027
  case RT_BINARY_SUPER_PARTITIONED:
7848
8028
  case RT_JSON_SUPER_PARTITIONED:
7849
- case RT_PARQUET_SUPER_PARTITIONED:
7850
- keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
7851
- break;
8029
+ case RT_PARQUET_SUPER_PARTITIONED: keyLength = meta["superPartitionKeyLength"] + meta["partitionKeyLength"];
7852
8030
  }
7853
8031
  switch (rt) {
7854
8032
  case RT_RESOURCE_MAP:
@@ -7864,20 +8042,18 @@ function getPartitionKeysList(acc) {
7864
8042
  case RT_RESOURCE_MAP_PARTITIONED:
7865
8043
  case RT_BINARY_SUPER_PARTITIONED:
7866
8044
  case RT_JSON_SUPER_PARTITIONED:
7867
- case RT_PARQUET_SUPER_PARTITIONED:
7868
- for (const supKeyStr of acc.listInputFields()) {
7869
- const keyPrefix = [...JSON.parse(supKeyStr)];
7870
- const value = acc.resolve({
7871
- field: supKeyStr,
7872
- assertFieldType: "Input"
7873
- });
7874
- if (value !== void 0) for (let keyStr of value.listInputFields()) {
7875
- if (rt === "PColumnData/Partitioned/BinaryPartitioned") keyStr = removeIndexSuffix(keyStr).baseKey;
7876
- const key = [...keyPrefix, ...JSON.parse(keyStr)];
7877
- data.push(key);
7878
- }
8045
+ case RT_PARQUET_SUPER_PARTITIONED: for (const supKeyStr of acc.listInputFields()) {
8046
+ const keyPrefix = [...JSON.parse(supKeyStr)];
8047
+ const value = acc.resolve({
8048
+ field: supKeyStr,
8049
+ assertFieldType: "Input"
8050
+ });
8051
+ if (value !== void 0) for (let keyStr of value.listInputFields()) {
8052
+ if (rt === "PColumnData/Partitioned/BinaryPartitioned") keyStr = removeIndexSuffix(keyStr).baseKey;
8053
+ const key = [...keyPrefix, ...JSON.parse(keyStr)];
8054
+ data.push(key);
7879
8055
  }
7880
- break;
8056
+ }
7881
8057
  }
7882
8058
  return {
7883
8059
  data,
@@ -8102,8 +8278,7 @@ function isPColumnReady(c) {
8102
8278
  function allPColumnsReady(columns) {
8103
8279
  return columns.every(isPColumnReady);
8104
8280
  }
8105
- //#endregion
8106
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/util/column_collection.js
8281
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/util/column_collection.js
8107
8282
  function isPColumnValues(value) {
8108
8283
  if (!Array.isArray(value)) return false;
8109
8284
  if (value.length === 0) return true;
@@ -8137,9 +8312,10 @@ function splitFiltersToAxisFilter(splitFilters) {
8137
8312
  }
8138
8313
  function fallbackIdDeriver(originalId, axisFilters) {
8139
8314
  if (!axisFilters || axisFilters.length === 0) return originalId;
8315
+ const filtersToCanonicalize = [...axisFilters].sort((a, b) => a[0] - b[0]);
8140
8316
  return (0, import_canonicalize.default)({
8141
8317
  id: originalId,
8142
- axisFilters: [...axisFilters].sort((a, b) => a[0] - b[0])
8318
+ axisFilters: filtersToCanonicalize
8143
8319
  });
8144
8320
  }
8145
8321
  /** Checks if a selector object uses any anchor properties */
@@ -8380,8 +8556,7 @@ var PColumnCollection = class {
8380
8556
  return columns;
8381
8557
  }
8382
8558
  };
8383
- //#endregion
8384
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/services/service_bridge.js
8559
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/services/service_bridge.js
8385
8560
  /**
8386
8561
  * Builds a ServiceProxy from a ServiceDispatch.
8387
8562
  * Each service method call is forwarded to dispatch.callServiceMethod.
@@ -8389,8 +8564,7 @@ var PColumnCollection = class {
8389
8564
  function createServiceProxy(dispatch) {
8390
8565
  return ((serviceId) => Object.freeze(Object.fromEntries(dispatch.getServiceMethods(serviceId).map((method) => [method, (...args) => dispatch.callServiceMethod(serviceId, method, ...args)]))));
8391
8566
  }
8392
- //#endregion
8393
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/services/get_services.js
8567
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/services/get_services.js
8394
8568
  const cachedServices = /* @__PURE__ */ new WeakMap();
8395
8569
  function getService(name, deps) {
8396
8570
  const ctx = deps?.ctx ?? getCfgRenderCtx();
@@ -8403,8 +8577,7 @@ function getService(name, deps) {
8403
8577
  return map.get(name);
8404
8578
  })();
8405
8579
  }
8406
- //#endregion
8407
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/util/pframe_upgraders.js
8580
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/util/pframe_upgraders.js
8408
8581
  function patchInSetFilters(filters) {
8409
8582
  const inSetToOrEqual = (predicate) => {
8410
8583
  if (predicate.operator !== "InSet") return predicate;
@@ -8441,8 +8614,7 @@ function patchInSetFilters(filters) {
8441
8614
  };
8442
8615
  return filters.map((filter) => mapFilter(filter, inSetToOrEqual));
8443
8616
  }
8444
- //#endregion
8445
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/render/api.js
8617
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/render/api.js
8446
8618
  /**
8447
8619
  * Helper function to match domain objects
8448
8620
  * @param query Optional domain to match against
@@ -8493,11 +8665,13 @@ var ResultPool = class {
8493
8665
  let refsWithEnrichments = false;
8494
8666
  if (typeof opts !== "undefined") {
8495
8667
  if (typeof opts === "function") labelOps = opts;
8496
- else if (typeof opts === "object") if ("includeNativeLabel" in opts || "separator" in opts || "addLabelAsSuffix" in opts) labelOps = opts;
8497
- else {
8498
- opts = opts;
8499
- labelOps = opts.label ?? {};
8500
- refsWithEnrichments = opts.refsWithEnrichments ?? false;
8668
+ else if (typeof opts === "object") {
8669
+ if ("includeNativeLabel" in opts || "separator" in opts || "addLabelAsSuffix" in opts) labelOps = opts;
8670
+ else {
8671
+ opts = opts;
8672
+ labelOps = opts.label ?? {};
8673
+ refsWithEnrichments = opts.refsWithEnrichments ?? false;
8674
+ }
8501
8675
  }
8502
8676
  }
8503
8677
  if (typeof labelOps === "object") return deriveLabels(filtered, (o) => o.obj, labelOps ?? {}).map(({ value: { ref }, label }) => ({
@@ -8890,28 +9064,23 @@ var PluginRenderCtx = class extends RenderCtxBase {
8890
9064
  return this.paramsCache.v;
8891
9065
  }
8892
9066
  };
8893
- //#endregion
8894
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/plugin_model.js
9067
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/plugin_model.js
8895
9068
  /** Internal plugin↔block handshake. `Symbol.for` (not `Symbol`) so it stays
8896
9069
  * identical across multiple `@platforma-sdk/model` copies in one process. */
8897
9070
  const CREATE_PLUGIN_MODEL = Symbol.for("@platforma-sdk/model:createPluginModel");
8898
- //#endregion
8899
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/version.js
8900
- const PlatformaSDKVersion = "1.84.10";
8901
- //#endregion
8902
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/bconfig/types.js
9071
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/version.js
9072
+ const PlatformaSDKVersion = "1.88.16";
9073
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/bconfig/types.js
8903
9074
  function isConfigLambda(cfgOrFh) {
8904
9075
  return cfgOrFh.__renderLambda === true;
8905
9076
  }
8906
- //#endregion
8907
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/bconfig/normalization.js
9077
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/bconfig/normalization.js
8908
9078
  function downgradeCfgOrLambda(data) {
8909
9079
  if (data === void 0) return void 0;
8910
9080
  if (isConfigLambda(data)) return data.handle;
8911
9081
  return data;
8912
9082
  }
8913
- //#endregion
8914
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/block_storage_callbacks.js
9083
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/block_storage_callbacks.js
8915
9084
  /**
8916
9085
  * BlockStorage Callback Implementations - wired to facade callbacks in BlockModelV3.done().
8917
9086
  *
@@ -9200,42 +9369,77 @@ function createInitialStorageFromParams(paramsJson, blockIdsJson, hooks) {
9200
9369
  }
9201
9370
  }
9202
9371
  /**
9203
- * Derives args from storage using the provided args function.
9204
- * This extracts data from storage and passes it to the block's args() function.
9372
+ * Derives args from storage using the block's args function, then finds the issues in them
9373
+ * with the block's `argsIssues()`.
9374
+ *
9375
+ * A throw from `argsIssues()`, or a result that is not a list of issues, is one error carrying
9376
+ * the thrown or parser message, so a broken check keeps the block from running instead of
9377
+ * letting it run unchecked.
9205
9378
  *
9206
9379
  * @param storageJson - Storage as JSON string
9207
- * @param deriveArgs - The block's args derivation function
9208
- * @returns ArgsDeriveResult with derived args or error
9380
+ * @param derivation - The block's args and args issues lambdas
9381
+ * @returns ArgsDeriveResult with derived args and args issues, or error
9209
9382
  */
9210
- function deriveArgsFromStorage(storageJson, deriveArgs) {
9383
+ function deriveArgsFromStorage(storageJson, derivation) {
9211
9384
  const { data } = normalizeStorage(storageJson);
9212
- try {
9213
- return { value: deriveArgs(data) };
9214
- } catch (e) {
9215
- return { error: `args() threw: ${e instanceof Error ? e.message : String(e)}` };
9216
- }
9385
+ const run = deriveArgsWithIssues(data, derivation);
9386
+ if (run.type === "threw") return { error: `args() threw: ${run.message}` };
9387
+ const { args, issues } = run;
9388
+ const errors = errorMessages(issues);
9389
+ if (errors.length > 0) return {
9390
+ error: errors.join("; "),
9391
+ args,
9392
+ issues
9393
+ };
9394
+ return {
9395
+ value: args,
9396
+ issues
9397
+ };
9217
9398
  }
9218
9399
  /**
9219
9400
  * Derives prerunArgs from storage.
9220
- * Uses derivePrerunArgs if provided, otherwise falls back to deriveArgs.
9401
+ *
9402
+ * A block with its own `prerunArgs()` is staged with what it returns, unless its
9403
+ * `prerunArgsIssues()` finds errors in it; `argsIssues()` is not consulted then. A `prerunArgs()`
9404
+ * that returns `undefined` skips staging, and `prerunArgsIssues()` is not called for it.
9405
+ *
9406
+ * A block without its own `prerunArgs()` is staged with its args, unless `argsIssues()` finds
9407
+ * errors in them: args that may not run are not staged either.
9408
+ *
9409
+ * A throw from either issues lambda, or a result that is not a list of issues, is one error
9410
+ * carrying the thrown or parser message.
9221
9411
  *
9222
9412
  * @param storageJson - Storage as JSON string
9223
- * @param deriveArgs - The block's args derivation function (fallback)
9224
- * @param derivePrerunArgs - Optional prerun args derivation function
9225
- * @returns ArgsDeriveResult with derived prerunArgs or error
9413
+ * @param derivation - The block's args, args issues and own staging lambdas
9414
+ * @returns PrerunArgsDeriveResult with derived prerunArgs and their issues, or error
9226
9415
  */
9227
- function derivePrerunArgsFromStorage(storageJson, deriveArgs, derivePrerunArgs) {
9416
+ function derivePrerunArgsFromStorage(storageJson, derivation) {
9228
9417
  const { data } = normalizeStorage(storageJson);
9229
- if (derivePrerunArgs) try {
9230
- return { value: derivePrerunArgs(data) };
9231
- } catch (e) {
9232
- return { error: `prerunArgs() threw: ${e instanceof Error ? e.message : String(e)}` };
9233
- }
9234
- try {
9235
- return { value: deriveArgs(data) };
9236
- } catch (e) {
9237
- return { error: `args() threw (fallback): ${e instanceof Error ? e.message : String(e)}` };
9418
+ const { ownPrerunArgs } = derivation;
9419
+ if (ownPrerunArgs !== void 0) {
9420
+ const run = derivePrerunArgsWithIssues(data, ownPrerunArgs);
9421
+ if (run.type === "threw") return { error: `prerunArgs() threw: ${run.message}` };
9422
+ const errors = errorMessages(run.issues);
9423
+ if (errors.length > 0) return {
9424
+ error: errors.join("; "),
9425
+ issues: run.issues
9426
+ };
9427
+ return {
9428
+ value: run.args,
9429
+ issues: run.issues
9430
+ };
9238
9431
  }
9432
+ const run = deriveArgsWithIssues(data, derivation);
9433
+ if (run.type === "threw") return { error: `args() threw (fallback): ${run.message}` };
9434
+ const errors = errorMessages(run.issues);
9435
+ if (errors.length > 0) return {
9436
+ error: `argsIssues() found errors (fallback): ${errors.join("; ")}`,
9437
+ issues: run.issues
9438
+ };
9439
+ return {
9440
+ value: run.args,
9441
+ issues: run.issues
9442
+ };
9239
9443
  }
9240
9444
  /**
9241
9445
  * Derives this block's template-entry params from storage.
@@ -9254,7 +9458,7 @@ function derivePrerunArgsFromStorage(storageJson, deriveArgs, derivePrerunArgs)
9254
9458
  *
9255
9459
  * @param storageJson - Storage as JSON string
9256
9460
  * @param deriveTemplateParams - The block's templateParams lambda
9257
- * @returns ArgsDeriveResult holding the params exactly as the block projected them
9461
+ * @returns DeriveResult holding the params exactly as the block projected them
9258
9462
  */
9259
9463
  function deriveTemplateParamsFromStorage(storageJson, deriveTemplateParams) {
9260
9464
  const { data } = normalizeStorage(storageJson);
@@ -9264,14 +9468,81 @@ function deriveTemplateParamsFromStorage(storageJson, deriveTemplateParams) {
9264
9468
  return { error: `templateParams() threw: ${e instanceof Error ? e.message : String(e)}` };
9265
9469
  }
9266
9470
  }
9267
- //#endregion
9268
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/block_model.js
9269
- /**
9270
- * Merges two feature flag objects with type-aware logic:
9271
- * - `supports*` (boolean): OR — `true` if either side is `true`
9272
- * - `requires*` (numeric): MAX — take the higher version requirement
9273
- */
9274
- function mergeFeatureFlags(base, override) {
9471
+ function deriveArgsWithIssues(data, derivation) {
9472
+ const { deriveArgs, argsIssues } = derivation;
9473
+ let args;
9474
+ try {
9475
+ args = deriveArgs(data);
9476
+ } catch (e) {
9477
+ return {
9478
+ type: "threw",
9479
+ message: messageOf(e)
9480
+ };
9481
+ }
9482
+ if (argsIssues === void 0) return {
9483
+ type: "derived",
9484
+ args,
9485
+ issues: []
9486
+ };
9487
+ return {
9488
+ type: "derived",
9489
+ args,
9490
+ issues: collectIssues(() => argsIssues({
9491
+ args,
9492
+ data
9493
+ }))
9494
+ };
9495
+ }
9496
+ function derivePrerunArgsWithIssues(data, derivation) {
9497
+ const { derivePrerunArgs, prerunArgsIssues } = derivation;
9498
+ let prerunArgs;
9499
+ try {
9500
+ prerunArgs = derivePrerunArgs(data);
9501
+ } catch (e) {
9502
+ return {
9503
+ type: "threw",
9504
+ message: messageOf(e)
9505
+ };
9506
+ }
9507
+ if (prerunArgsIssues === void 0 || prerunArgs === void 0) return {
9508
+ type: "derived",
9509
+ args: prerunArgs,
9510
+ issues: []
9511
+ };
9512
+ return {
9513
+ type: "derived",
9514
+ args: prerunArgs,
9515
+ issues: collectIssues(() => prerunArgsIssues({
9516
+ prerunArgs,
9517
+ data
9518
+ }))
9519
+ };
9520
+ }
9521
+ /**
9522
+ * Calls an issues lambda of the block. Its result is parsed rather than trusted: a block's types
9523
+ * do not hold at run time, and an entry that cannot be read must count as an error, not slip
9524
+ * past. A throw, or a result that cannot be read, is one error carrying its message.
9525
+ */
9526
+ function collectIssues(issuesOf) {
9527
+ try {
9528
+ return parseArgsIssues(issuesOf());
9529
+ } catch (e) {
9530
+ return [{
9531
+ severity: "error",
9532
+ message: messageOf(e)
9533
+ }];
9534
+ }
9535
+ }
9536
+ function errorMessages(issues) {
9537
+ return issues.filter((issue) => issue.severity !== "warning").map((issue) => issue.message);
9538
+ }
9539
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/block_model.js
9540
+ /**
9541
+ * Merges two feature flag objects with type-aware logic:
9542
+ * - `supports*` (boolean): OR — `true` if either side is `true`
9543
+ * - `requires*` (numeric): MAX — take the higher version requirement
9544
+ */
9545
+ function mergeFeatureFlags(base, override) {
9275
9546
  const result = { ...base };
9276
9547
  for (const [key, value] of Object.entries(override)) {
9277
9548
  if (value === void 0) continue;
@@ -9293,10 +9564,12 @@ var BlockModelV3 = class BlockModelV3 {
9293
9564
  static FEATURE_FLAGS = {
9294
9565
  supportsLazyState: true,
9295
9566
  supportsPframeQueryRanking: true,
9567
+ supportsColumnLinks: true,
9296
9568
  requiresUIAPIVersion: 3,
9297
9569
  requiresModelAPIVersion: 2,
9298
9570
  requiresCreatePTable: 2,
9299
9571
  requiresPFramesVersion: REQUIRES_PFRAMES_VERSION,
9572
+ requiresArgsIssues: true,
9300
9573
  ...BLOCK_SERVICE_FLAGS
9301
9574
  };
9302
9575
  /** @deprecated Use FEATURE_FLAGS */
@@ -9340,7 +9613,9 @@ var BlockModelV3 = class BlockModelV3 {
9340
9613
  enrichmentTargets: void 0,
9341
9614
  featureFlags: { ...BlockModelV3.FEATURE_FLAGS },
9342
9615
  deriveArgs: void 0,
9616
+ argsIssues: void 0,
9343
9617
  derivePrerunArgs: void 0,
9618
+ prerunArgsIssues: void 0,
9344
9619
  deriveTemplateParams: void 0,
9345
9620
  plugins: {}
9346
9621
  });
@@ -9370,19 +9645,56 @@ var BlockModelV3 = class BlockModelV3 {
9370
9645
  * Sets a function to derive block args from data.
9371
9646
  * This is called during setData to compute the args that will be used for block execution.
9372
9647
  *
9648
+ * Build args even from incomplete data, and say what keeps the block from running in
9649
+ * {@link argsIssues}: args that exist let the platform see what the block references
9650
+ * before it is ready to run. Throwing here still works, and means there are no args at all.
9651
+ *
9652
+ * Setting args again drops a {@link argsIssues} set before, since it checked other args.
9653
+ *
9373
9654
  * @example
9374
9655
  * .args<BlockArgs>((data) => ({ numbers: data.numbers }))
9375
9656
  *
9376
9657
  * @example
9377
- * .args<BlockArgs>((data) => {
9378
- * if (data.numbers.length === 0) throw new Error('Numbers required'); // block not ready
9379
- * return { numbers: data.numbers };
9380
- * })
9658
+ * .args<BlockArgs>((data) => ({ numbers: data.numbers }))
9659
+ * .argsIssues(({ args }) =>
9660
+ * args.numbers.length === 0 ? [{ severity: 'error', message: 'Numbers required' }] : [],
9661
+ * )
9381
9662
  */
9382
9663
  args(lambda) {
9383
9664
  return new BlockModelV3({
9384
9665
  ...this.config,
9385
- deriveArgs: lambda
9666
+ deriveArgs: lambda,
9667
+ argsIssues: void 0
9668
+ });
9669
+ }
9670
+ /**
9671
+ * Sets a function that finds what keeps the block from running with the args {@link args}
9672
+ * derived (optional). It is called after `args()`, with its result and the data it was built
9673
+ * from.
9674
+ *
9675
+ * An issue of severity `"error"` keeps the block from running; a `"warning"` does not. A throw,
9676
+ * or a result that is not a list of issues, counts as one error carrying the thrown or parser
9677
+ * message. Without this function, args that `args()` returns are always runnable.
9678
+ *
9679
+ * A block without its own {@link prerunArgs} is staged with its args, and only while this
9680
+ * function finds no errors in them.
9681
+ *
9682
+ * Must be set after `.args()`, and is dropped when `.args()` is set again.
9683
+ *
9684
+ * @example
9685
+ * .args((data) => ({ dataset: data.dataset, threshold: data.threshold }))
9686
+ * .argsIssues(({ args }) => {
9687
+ * const issues: ArgsIssue[] = [];
9688
+ * if (args.dataset === undefined) issues.push({ severity: 'error', message: 'Select a dataset' });
9689
+ * if (args.threshold > 0.5) issues.push({ severity: 'warning', message: 'Threshold is high' });
9690
+ * return issues;
9691
+ * })
9692
+ */
9693
+ argsIssues(fn) {
9694
+ if (this.config.deriveArgs === void 0) throw new Error("argsIssues() must be set after args(): it checks the args they derive.");
9695
+ return new BlockModelV3({
9696
+ ...this.config,
9697
+ argsIssues: fn
9386
9698
  });
9387
9699
  }
9388
9700
  /**
@@ -9395,6 +9707,9 @@ var BlockModelV3 = class BlockModelV3 {
9395
9707
  * The staging / prerun phase runs only if currentPrerunArgs differs from the executed
9396
9708
  * version of prerunArgs (same comparison logic as currentArgs vs prodArgs).
9397
9709
  *
9710
+ * Setting prerun args again drops a {@link prerunArgsIssues} set before, since it checked other
9711
+ * args.
9712
+ *
9398
9713
  * @example
9399
9714
  * .prerunArgs((data) => ({ numbers: data.numbers }))
9400
9715
  *
@@ -9408,7 +9723,33 @@ var BlockModelV3 = class BlockModelV3 {
9408
9723
  prerunArgs(fn) {
9409
9724
  return new BlockModelV3({
9410
9725
  ...this.config,
9411
- derivePrerunArgs: fn
9726
+ derivePrerunArgs: fn,
9727
+ prerunArgsIssues: void 0
9728
+ });
9729
+ }
9730
+ /**
9731
+ * Sets a function that finds what keeps the block from being staged with the args
9732
+ * {@link prerunArgs} derived (optional). It is called after `prerunArgs()`, with its result
9733
+ * and the data it was built from; not when `prerunArgs()` returned `undefined`, which skips
9734
+ * staging anyway.
9735
+ *
9736
+ * An issue of severity `"error"` keeps the block from being staged; a `"warning"` does not. A
9737
+ * throw, or a result that is not a list of issues, counts as one error carrying the thrown or
9738
+ * parser message. {@link argsIssues} is not consulted for a block with its own prerun args.
9739
+ *
9740
+ * Must be set after `.prerunArgs()`, and is dropped when `.prerunArgs()` is set again.
9741
+ *
9742
+ * @example
9743
+ * .prerunArgs((data) => ({ dataset: data.dataset }))
9744
+ * .prerunArgsIssues(({ prerunArgs }) =>
9745
+ * prerunArgs.dataset === undefined ? [{ severity: 'error', message: 'Select a dataset' }] : [],
9746
+ * )
9747
+ */
9748
+ prerunArgsIssues(fn) {
9749
+ if (this.config.derivePrerunArgs === void 0) throw new Error("prerunArgsIssues() must be set after prerunArgs(): it checks the prerun args they derive.");
9750
+ return new BlockModelV3({
9751
+ ...this.config,
9752
+ prerunArgsIssues: fn
9412
9753
  });
9413
9754
  }
9414
9755
  /**
@@ -9465,6 +9806,11 @@ var BlockModelV3 = class BlockModelV3 {
9465
9806
  })
9466
9807
  });
9467
9808
  }
9809
+ /**
9810
+ * Sets a rendering function to derive block subtitle, shown below the title in the left
9811
+ * blocks-overview panel. Unlike the title, it can read the result pool, so it can name the
9812
+ * inputs the block reads (e.g. through `ctx.resultPool.getPColumnSpecByRef`).
9813
+ */
9468
9814
  subtitle(rf) {
9469
9815
  return new BlockModelV3({
9470
9816
  ...this.config,
@@ -9541,7 +9887,7 @@ var BlockModelV3 = class BlockModelV3 {
9541
9887
  const pluginRegistry = {};
9542
9888
  const pluginHandles = Object.keys(plugins);
9543
9889
  for (const handle of pluginHandles) pluginRegistry[handle] = plugins[handle].model.name;
9544
- const { dataModel, deriveArgs, derivePrerunArgs, deriveTemplateParams, parseInitializationParams } = this.config;
9890
+ const { dataModel, deriveArgs, argsIssues, derivePrerunArgs, prerunArgsIssues, deriveTemplateParams, parseInitializationParams } = this.config;
9545
9891
  function getPlugin(handle) {
9546
9892
  const plugin = plugins[handle];
9547
9893
  if (!plugin) throw new Error(`Plugin model not found for '${handle}'`);
@@ -9564,8 +9910,18 @@ var BlockModelV3 = class BlockModelV3 {
9564
9910
  getPluginRegistry: () => pluginRegistry,
9565
9911
  createPluginData: (handle) => getPlugin(handle).model.getDefaultData()
9566
9912
  }),
9567
- [BlockStorageFacadeCallbacks.ArgsDerive]: (storageJson) => deriveArgsFromStorage(storageJson, deriveArgs),
9568
- [BlockStorageFacadeCallbacks.PrerunArgsDerive]: (storageJson) => derivePrerunArgsFromStorage(storageJson, deriveArgs, derivePrerunArgs),
9913
+ [BlockStorageFacadeCallbacks.ArgsDerive]: (storageJson) => deriveArgsFromStorage(storageJson, {
9914
+ deriveArgs,
9915
+ argsIssues
9916
+ }),
9917
+ [BlockStorageFacadeCallbacks.PrerunArgsDerive]: (storageJson) => derivePrerunArgsFromStorage(storageJson, {
9918
+ deriveArgs,
9919
+ argsIssues,
9920
+ ownPrerunArgs: derivePrerunArgs === void 0 ? void 0 : {
9921
+ derivePrerunArgs,
9922
+ prerunArgsIssues
9923
+ }
9924
+ }),
9569
9925
  [BlockStorageFacadeCallbacks.InitializationParamsDerive]: (storageJson) => deriveTemplateParamsFromStorage(storageJson, deriveTemplateParams),
9570
9926
  [BlockStorageFacadeCallbacks.StorageInitialFromParams]: (paramsJson, blockIdsJson) => createInitialStorageFromParams(paramsJson, blockIdsJson, {
9571
9927
  getBlockDataFromParams: (params) => dataModel.getDataFromParams(params),
@@ -9630,8 +9986,7 @@ var BlockModelV3 = class BlockModelV3 {
9630
9986
  };
9631
9987
  }
9632
9988
  };
9633
- //#endregion
9634
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column_recipes/leaf_rebrand.js
9989
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column_recipes/leaf_rebrand.js
9635
9990
  /**
9636
9991
  * Replace every column leaf whose id equals `fromId` with `toId`, leaving
9637
9992
  * other column refs (linkers, sub-anchors) intact. Wrapper recipes
@@ -9648,1208 +10003,656 @@ function rebrandLeafId(node, fromId, toId) {
9648
10003
  if (fromId === toId) return node;
9649
10004
  return mapSpecQueryColumns(node, { column: (id) => id === fromId ? toId : id });
9650
10005
  }
9651
- //#endregion
9652
- //#region ../node_modules/.pnpm/lru-cache@11.2.4/node_modules/lru-cache/dist/esm/index.js
9653
- /**
9654
- * @module LRUCache
9655
- */
9656
- const defaultPerf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
9657
- const warned = /* @__PURE__ */ new Set();
9658
- /* c8 ignore start */
9659
- const PROCESS = typeof process === "object" && !!process ? process : {};
9660
- /* c8 ignore start */
9661
- const emitWarning = (msg, type, code, fn) => {
9662
- typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
9663
- };
9664
- let AC = globalThis.AbortController;
9665
- let AS = globalThis.AbortSignal;
9666
- /* c8 ignore start */
9667
- if (typeof AC === "undefined") {
9668
- AS = class AbortSignal {
9669
- onabort;
9670
- _onabort = [];
9671
- reason;
9672
- aborted = false;
9673
- addEventListener(_, fn) {
9674
- this._onabort.push(fn);
9675
- }
9676
- };
9677
- AC = class AbortController {
9678
- constructor() {
9679
- warnACPolyfill();
9680
- }
9681
- signal = new AS();
9682
- abort(reason) {
9683
- if (this.signal.aborted) return;
9684
- this.signal.reason = reason;
9685
- this.signal.aborted = true;
9686
- for (const fn of this.signal._onabort) fn(reason);
9687
- this.signal.onabort?.(reason);
9688
- }
9689
- };
9690
- let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
9691
- const warnACPolyfill = () => {
9692
- if (!printACPolyfillWarning) return;
9693
- printACPolyfillWarning = false;
9694
- emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
9695
- };
9696
- }
9697
- /* c8 ignore stop */
9698
- const shouldWarn = (code) => !warned.has(code);
9699
- const isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
9700
- /* c8 ignore start */
9701
- const getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
9702
- /* c8 ignore stop */
9703
- var ZeroArray = class extends Array {
9704
- constructor(size) {
9705
- super(size);
9706
- this.fill(0);
9707
- }
9708
- };
9709
- var Stack = class Stack {
10006
+ // ../node_modules/.pnpm/lru-cache@11.5.3/node_modules/lru-cache/dist/esm/browser/index.min.js
10007
+ var L = { hasSubscribers: !1 };
10008
+ var S = L;
10009
+ var W = L;
10010
+ var M = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
10011
+ var R = () => S.hasSubscribers || W.hasSubscribers;
10012
+ var j = /* @__PURE__ */ new Set();
10013
+ var I = typeof process == "object" && process ? process : {};
10014
+ var P = (d, e, t, i) => {
10015
+ typeof I.emitWarning == "function" ? I.emitWarning(d, e, t, i) : console.error(`[${t}] ${e}: ${d}`);
10016
+ };
10017
+ var k = (d) => !j.has(d);
10018
+ var T = (d) => !!d && d === Math.floor(d) && d > 0 && isFinite(d);
10019
+ var G = (d) => T(d) ? d <= Math.pow(2, 8) ? Uint8Array : d <= Math.pow(2, 16) ? Uint16Array : d <= Math.pow(2, 32) ? Uint32Array : d <= Number.MAX_SAFE_INTEGER ? O : null : null;
10020
+ var O = class extends Array {
10021
+ constructor(e) {
10022
+ super(e), this.fill(0);
10023
+ }
10024
+ };
10025
+ var x = class d {
9710
10026
  heap;
9711
10027
  length;
9712
- static #constructing = false;
9713
- static create(max) {
9714
- const HeapCls = getUintArray(max);
9715
- if (!HeapCls) return [];
9716
- Stack.#constructing = true;
9717
- const s = new Stack(max, HeapCls);
9718
- Stack.#constructing = false;
9719
- return s;
9720
- }
9721
- constructor(max, HeapCls) {
9722
- /* c8 ignore start */
9723
- if (!Stack.#constructing) throw new TypeError("instantiate Stack using Stack.create(n)");
9724
- /* c8 ignore stop */
9725
- this.heap = new HeapCls(max);
9726
- this.length = 0;
9727
- }
9728
- push(n) {
9729
- this.heap[this.length++] = n;
10028
+ static #o = !1;
10029
+ static create(e) {
10030
+ let t = G(e);
10031
+ if (!t) return [];
10032
+ d.#o = !0;
10033
+ let i = new d(e, t);
10034
+ return d.#o = !1, i;
10035
+ }
10036
+ constructor(e, t) {
10037
+ if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
10038
+ this.heap = new t(e), this.length = 0;
10039
+ }
10040
+ push(e) {
10041
+ this.heap[this.length++] = e;
9730
10042
  }
9731
10043
  pop() {
9732
10044
  return this.heap[--this.length];
9733
10045
  }
9734
10046
  };
9735
- /**
9736
- * Default export, the thing you're using this module to get.
9737
- *
9738
- * The `K` and `V` types define the key and value types, respectively. The
9739
- * optional `FC` type defines the type of the `context` object passed to
9740
- * `cache.fetch()` and `cache.memo()`.
9741
- *
9742
- * Keys and values **must not** be `null` or `undefined`.
9743
- *
9744
- * All properties from the options object (with the exception of `max`,
9745
- * `maxSize`, `fetchMethod`, `memoMethod`, `dispose` and `disposeAfter`) are
9746
- * added as normal public members. (The listed options are read-only getters.)
9747
- *
9748
- * Changing any of these will alter the defaults for subsequent method calls.
9749
- */
9750
- var LRUCache = class LRUCache {
9751
- #max;
9752
- #maxSize;
9753
- #dispose;
9754
- #onInsert;
9755
- #disposeAfter;
9756
- #fetchMethod;
9757
- #memoMethod;
9758
- #perf;
9759
- /**
9760
- * {@link LRUCache.OptionsBase.perf}
9761
- */
10047
+ var U = class d {
10048
+ #o;
10049
+ #c;
10050
+ #S;
10051
+ #O;
10052
+ #w;
10053
+ #M;
10054
+ #I;
10055
+ #m;
9762
10056
  get perf() {
9763
- return this.#perf;
10057
+ return this.#m;
9764
10058
  }
9765
- /**
9766
- * {@link LRUCache.OptionsBase.ttl}
9767
- */
9768
10059
  ttl;
9769
- /**
9770
- * {@link LRUCache.OptionsBase.ttlResolution}
9771
- */
9772
10060
  ttlResolution;
9773
- /**
9774
- * {@link LRUCache.OptionsBase.ttlAutopurge}
9775
- */
9776
10061
  ttlAutopurge;
9777
- /**
9778
- * {@link LRUCache.OptionsBase.updateAgeOnGet}
9779
- */
9780
10062
  updateAgeOnGet;
9781
- /**
9782
- * {@link LRUCache.OptionsBase.updateAgeOnHas}
9783
- */
9784
10063
  updateAgeOnHas;
9785
- /**
9786
- * {@link LRUCache.OptionsBase.allowStale}
9787
- */
9788
10064
  allowStale;
9789
- /**
9790
- * {@link LRUCache.OptionsBase.noDisposeOnSet}
9791
- */
9792
10065
  noDisposeOnSet;
9793
- /**
9794
- * {@link LRUCache.OptionsBase.noUpdateTTL}
9795
- */
9796
10066
  noUpdateTTL;
9797
- /**
9798
- * {@link LRUCache.OptionsBase.maxEntrySize}
9799
- */
9800
10067
  maxEntrySize;
9801
- /**
9802
- * {@link LRUCache.OptionsBase.sizeCalculation}
9803
- */
9804
10068
  sizeCalculation;
9805
- /**
9806
- * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
9807
- */
9808
10069
  noDeleteOnFetchRejection;
9809
- /**
9810
- * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
9811
- */
9812
10070
  noDeleteOnStaleGet;
9813
- /**
9814
- * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
9815
- */
9816
10071
  allowStaleOnFetchAbort;
9817
- /**
9818
- * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
9819
- */
9820
10072
  allowStaleOnFetchRejection;
9821
- /**
9822
- * {@link LRUCache.OptionsBase.ignoreFetchAbort}
9823
- */
9824
10073
  ignoreFetchAbort;
9825
- #size;
9826
- #calculatedSize;
9827
- #keyMap;
9828
- #keyList;
9829
- #valList;
9830
- #next;
9831
- #prev;
9832
- #head;
9833
- #tail;
9834
- #free;
9835
- #disposed;
9836
- #sizes;
9837
- #starts;
9838
- #ttls;
9839
- #autopurgeTimers;
9840
- #hasDispose;
9841
- #hasFetchMethod;
9842
- #hasDisposeAfter;
9843
- #hasOnInsert;
9844
- /**
9845
- * Do not call this method unless you need to inspect the
9846
- * inner workings of the cache. If anything returned by this
9847
- * object is modified in any way, strange breakage may occur.
9848
- *
9849
- * These fields are private for a reason!
9850
- *
9851
- * @internal
9852
- */
9853
- static unsafeExposeInternals(c) {
10074
+ backgroundFetchSize;
10075
+ #n;
10076
+ #b;
10077
+ #s;
10078
+ #i;
10079
+ #t;
10080
+ #l;
10081
+ #u;
10082
+ #a;
10083
+ #h;
10084
+ #y;
10085
+ #r;
10086
+ #_;
10087
+ #F;
10088
+ #d;
10089
+ #g;
10090
+ #T;
10091
+ #U;
10092
+ #f;
10093
+ #D;
10094
+ static unsafeExposeInternals(e) {
9854
10095
  return {
9855
- starts: c.#starts,
9856
- ttls: c.#ttls,
9857
- autopurgeTimers: c.#autopurgeTimers,
9858
- sizes: c.#sizes,
9859
- keyMap: c.#keyMap,
9860
- keyList: c.#keyList,
9861
- valList: c.#valList,
9862
- next: c.#next,
9863
- prev: c.#prev,
10096
+ starts: e.#F,
10097
+ ttls: e.#d,
10098
+ autopurgeTimers: e.#g,
10099
+ sizes: e.#_,
10100
+ keyMap: e.#s,
10101
+ keyList: e.#i,
10102
+ valList: e.#t,
10103
+ next: e.#l,
10104
+ prev: e.#u,
9864
10105
  get head() {
9865
- return c.#head;
10106
+ return e.#a;
9866
10107
  },
9867
10108
  get tail() {
9868
- return c.#tail;
10109
+ return e.#h;
9869
10110
  },
9870
- free: c.#free,
9871
- isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
9872
- backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
9873
- moveToTail: (index) => c.#moveToTail(index),
9874
- indexes: (options) => c.#indexes(options),
9875
- rindexes: (options) => c.#rindexes(options),
9876
- isStale: (index) => c.#isStale(index)
10111
+ free: e.#y,
10112
+ isBackgroundFetch: (t) => e.#e(t),
10113
+ backgroundFetch: (t, i, s, n) => e.#P(t, i, s, n),
10114
+ moveToTail: (t) => e.#L(t),
10115
+ indexes: (t) => e.#A(t),
10116
+ rindexes: (t) => e.#z(t),
10117
+ isStale: (t) => e.#p(t)
9877
10118
  };
9878
10119
  }
9879
- /**
9880
- * {@link LRUCache.OptionsBase.max} (read-only)
9881
- */
9882
10120
  get max() {
9883
- return this.#max;
10121
+ return this.#o;
9884
10122
  }
9885
- /**
9886
- * {@link LRUCache.OptionsBase.maxSize} (read-only)
9887
- */
9888
10123
  get maxSize() {
9889
- return this.#maxSize;
10124
+ return this.#c;
9890
10125
  }
9891
- /**
9892
- * The total computed size of items in the cache (read-only)
9893
- */
9894
10126
  get calculatedSize() {
9895
- return this.#calculatedSize;
10127
+ return this.#b;
9896
10128
  }
9897
- /**
9898
- * The number of items stored in the cache (read-only)
9899
- */
9900
10129
  get size() {
9901
- return this.#size;
10130
+ return this.#n;
9902
10131
  }
9903
- /**
9904
- * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
9905
- */
9906
10132
  get fetchMethod() {
9907
- return this.#fetchMethod;
10133
+ return this.#M;
9908
10134
  }
9909
10135
  get memoMethod() {
9910
- return this.#memoMethod;
10136
+ return this.#I;
9911
10137
  }
9912
- /**
9913
- * {@link LRUCache.OptionsBase.dispose} (read-only)
9914
- */
9915
10138
  get dispose() {
9916
- return this.#dispose;
10139
+ return this.#S;
9917
10140
  }
9918
- /**
9919
- * {@link LRUCache.OptionsBase.onInsert} (read-only)
9920
- */
9921
10141
  get onInsert() {
9922
- return this.#onInsert;
10142
+ return this.#O;
9923
10143
  }
9924
- /**
9925
- * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
9926
- */
9927
10144
  get disposeAfter() {
9928
- return this.#disposeAfter;
9929
- }
9930
- constructor(options) {
9931
- const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, perf } = options;
9932
- if (perf !== void 0) {
9933
- if (typeof perf?.now !== "function") throw new TypeError("perf option must have a now() method if specified");
9934
- }
9935
- this.#perf = perf ?? defaultPerf;
9936
- if (max !== 0 && !isPosInt(max)) throw new TypeError("max option must be a nonnegative integer");
9937
- const UintArray = max ? getUintArray(max) : Array;
9938
- if (!UintArray) throw new Error("invalid max value: " + max);
9939
- this.#max = max;
9940
- this.#maxSize = maxSize;
9941
- this.maxEntrySize = maxEntrySize || this.#maxSize;
9942
- this.sizeCalculation = sizeCalculation;
9943
- if (this.sizeCalculation) {
9944
- if (!this.#maxSize && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
9945
- if (typeof this.sizeCalculation !== "function") throw new TypeError("sizeCalculation set to non-function");
9946
- }
9947
- if (memoMethod !== void 0 && typeof memoMethod !== "function") throw new TypeError("memoMethod must be a function if defined");
9948
- this.#memoMethod = memoMethod;
9949
- if (fetchMethod !== void 0 && typeof fetchMethod !== "function") throw new TypeError("fetchMethod must be a function if specified");
9950
- this.#fetchMethod = fetchMethod;
9951
- this.#hasFetchMethod = !!fetchMethod;
9952
- this.#keyMap = /* @__PURE__ */ new Map();
9953
- this.#keyList = new Array(max).fill(void 0);
9954
- this.#valList = new Array(max).fill(void 0);
9955
- this.#next = new UintArray(max);
9956
- this.#prev = new UintArray(max);
9957
- this.#head = 0;
9958
- this.#tail = 0;
9959
- this.#free = Stack.create(max);
9960
- this.#size = 0;
9961
- this.#calculatedSize = 0;
9962
- if (typeof dispose === "function") this.#dispose = dispose;
9963
- if (typeof onInsert === "function") this.#onInsert = onInsert;
9964
- if (typeof disposeAfter === "function") {
9965
- this.#disposeAfter = disposeAfter;
9966
- this.#disposed = [];
9967
- } else {
9968
- this.#disposeAfter = void 0;
9969
- this.#disposed = void 0;
9970
- }
9971
- this.#hasDispose = !!this.#dispose;
9972
- this.#hasOnInsert = !!this.#onInsert;
9973
- this.#hasDisposeAfter = !!this.#disposeAfter;
9974
- this.noDisposeOnSet = !!noDisposeOnSet;
9975
- this.noUpdateTTL = !!noUpdateTTL;
9976
- this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
9977
- this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
9978
- this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
9979
- this.ignoreFetchAbort = !!ignoreFetchAbort;
9980
- if (this.maxEntrySize !== 0) {
9981
- if (this.#maxSize !== 0) {
9982
- if (!isPosInt(this.#maxSize)) throw new TypeError("maxSize must be a positive integer if specified");
9983
- }
9984
- if (!isPosInt(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
9985
- this.#initializeSizeTracking();
9986
- }
9987
- this.allowStale = !!allowStale;
9988
- this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
9989
- this.updateAgeOnGet = !!updateAgeOnGet;
9990
- this.updateAgeOnHas = !!updateAgeOnHas;
9991
- this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
9992
- this.ttlAutopurge = !!ttlAutopurge;
9993
- this.ttl = ttl || 0;
9994
- if (this.ttl) {
9995
- if (!isPosInt(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
9996
- this.#initializeTTLTracking();
9997
- }
9998
- if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
9999
- if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
10000
- const code = "LRU_CACHE_UNBOUNDED";
10001
- if (shouldWarn(code)) {
10002
- warned.add(code);
10003
- emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", code, LRUCache);
10004
- }
10005
- }
10006
- }
10007
- /**
10008
- * Return the number of ms left in the item's TTL. If item is not in cache,
10009
- * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
10010
- */
10011
- getRemainingTTL(key) {
10012
- return this.#keyMap.has(key) ? Infinity : 0;
10013
- }
10014
- #initializeTTLTracking() {
10015
- const ttls = new ZeroArray(this.#max);
10016
- const starts = new ZeroArray(this.#max);
10017
- this.#ttls = ttls;
10018
- this.#starts = starts;
10019
- const purgeTimers = this.ttlAutopurge ? new Array(this.#max) : void 0;
10020
- this.#autopurgeTimers = purgeTimers;
10021
- this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
10022
- starts[index] = ttl !== 0 ? start : 0;
10023
- ttls[index] = ttl;
10024
- if (purgeTimers?.[index]) {
10025
- clearTimeout(purgeTimers[index]);
10026
- purgeTimers[index] = void 0;
10027
- }
10028
- if (ttl !== 0 && purgeTimers) {
10029
- const t = setTimeout(() => {
10030
- if (this.#isStale(index)) this.#delete(this.#keyList[index], "expire");
10031
- }, ttl + 1);
10032
- /* c8 ignore start */
10033
- if (t.unref) t.unref();
10034
- /* c8 ignore stop */
10035
- purgeTimers[index] = t;
10036
- }
10037
- };
10038
- this.#updateItemAge = (index) => {
10039
- starts[index] = ttls[index] !== 0 ? this.#perf.now() : 0;
10040
- };
10041
- this.#statusTTL = (status, index) => {
10042
- if (ttls[index]) {
10043
- const ttl = ttls[index];
10044
- const start = starts[index];
10045
- /* c8 ignore next */
10046
- if (!ttl || !start) return;
10047
- status.ttl = ttl;
10048
- status.start = start;
10049
- status.now = cachedNow || getNow();
10050
- status.remainingTTL = ttl - (status.now - start);
10051
- }
10052
- };
10053
- let cachedNow = 0;
10054
- const getNow = () => {
10055
- const n = this.#perf.now();
10145
+ return this.#w;
10146
+ }
10147
+ constructor(e) {
10148
+ let { max: t = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: m, noDisposeOnSet: _, noUpdateTTL: u, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: y, fetchMethod: a, memoMethod: w, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, backgroundFetchSize: C = 1, perf: E } = e;
10149
+ if (this.backgroundFetchSize = C, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
10150
+ if (this.#m = E ?? M, t !== 0 && !T(t)) throw new TypeError("max option must be a nonnegative integer");
10151
+ let v = t ? G(t) : Array;
10152
+ if (!v) throw new Error("invalid max value: " + t);
10153
+ if (this.#o = t, this.#c = g, this.maxEntrySize = f || this.#c, this.sizeCalculation = y, this.sizeCalculation) {
10154
+ if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
10155
+ if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
10156
+ }
10157
+ if (w !== void 0 && typeof w != "function") throw new TypeError("memoMethod must be a function if defined");
10158
+ if (this.#I = w, a !== void 0 && typeof a != "function") throw new TypeError("fetchMethod must be a function if specified");
10159
+ if (this.#M = a, this.#U = !!a, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t }).fill(void 0), this.#t = Array.from({ length: t }).fill(void 0), this.#l = new v(t), this.#u = new v(t), this.#a = 0, this.#h = 0, this.#y = x.create(t), this.#n = 0, this.#b = 0, typeof r == "function" && (this.#S = r), typeof c == "function" && (this.#O = c), typeof m == "function" ? (this.#w = m, this.#r = []) : (this.#w = void 0, this.#r = void 0), this.#T = !!this.#S, this.#D = !!this.#O, this.#f = !!this.#w, this.noDisposeOnSet = !!_, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
10160
+ if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
10161
+ if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
10162
+ this.#X();
10163
+ }
10164
+ if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
10165
+ if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
10166
+ this.#k();
10167
+ }
10168
+ if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
10169
+ if (!this.ttlAutopurge && !this.#o && !this.#c) {
10170
+ let D = "LRU_CACHE_UNBOUNDED";
10171
+ k(D) && (j.add(D), P("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d));
10172
+ }
10173
+ }
10174
+ getRemainingTTL(e) {
10175
+ return this.#s.has(e) ? 1 / 0 : 0;
10176
+ }
10177
+ #k() {
10178
+ let e = new O(this.#o), t = new O(this.#o);
10179
+ this.#d = e, this.#F = t;
10180
+ let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
10181
+ this.#g = i, this.#H = (h, r, c = this.#m.now()) => {
10182
+ t[h] = r !== 0 ? c : 0, e[h] = r, s(h, r);
10183
+ }, this.#R = (h) => {
10184
+ t[h] = e[h] !== 0 ? this.#m.now() : 0, s(h, e[h]);
10185
+ };
10186
+ let s = this.ttlAutopurge ? (h, r) => {
10187
+ if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), r && r !== 0 && i) {
10188
+ let c = setTimeout(() => {
10189
+ this.#p(h) ? (this.#E(this.#i[h], "expire"), i[h] = void 0) : s(h, l(h));
10190
+ }, r + 1);
10191
+ c.unref && c.unref(), i[h] = c;
10192
+ }
10193
+ } : () => {};
10194
+ this.#v = (h, r) => {
10195
+ if (e[r]) {
10196
+ let c = e[r], m = t[r];
10197
+ if (!c || !m) return;
10198
+ h.ttl = c, h.start = m, h.now = n || o();
10199
+ h.remainingTTL = c - (h.now - m);
10200
+ }
10201
+ };
10202
+ let n = 0, o = () => {
10203
+ let h = this.#m.now();
10056
10204
  if (this.ttlResolution > 0) {
10057
- cachedNow = n;
10058
- const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
10059
- /* c8 ignore start */
10060
- if (t.unref) t.unref();
10061
- }
10062
- return n;
10063
- };
10064
- this.getRemainingTTL = (key) => {
10065
- const index = this.#keyMap.get(key);
10066
- if (index === void 0) return 0;
10067
- const ttl = ttls[index];
10068
- const start = starts[index];
10069
- if (!ttl || !start) return Infinity;
10070
- return ttl - ((cachedNow || getNow()) - start);
10071
- };
10072
- this.#isStale = (index) => {
10073
- const s = starts[index];
10074
- const t = ttls[index];
10075
- return !!t && !!s && (cachedNow || getNow()) - s > t;
10076
- };
10077
- }
10078
- #updateItemAge = () => {};
10079
- #statusTTL = () => {};
10080
- #setItemTTL = () => {};
10081
- /* c8 ignore stop */
10082
- #isStale = () => false;
10083
- #initializeSizeTracking() {
10084
- const sizes = new ZeroArray(this.#max);
10085
- this.#calculatedSize = 0;
10086
- this.#sizes = sizes;
10087
- this.#removeItemSize = (index) => {
10088
- this.#calculatedSize -= sizes[index];
10089
- sizes[index] = 0;
10090
- };
10091
- this.#requireSize = (k, v, size, sizeCalculation) => {
10092
- if (this.#isBackgroundFetch(v)) return 0;
10093
- if (!isPosInt(size)) if (sizeCalculation) {
10094
- if (typeof sizeCalculation !== "function") throw new TypeError("sizeCalculation must be a function");
10095
- size = sizeCalculation(v, k);
10096
- if (!isPosInt(size)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
10097
- } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
10098
- return size;
10099
- };
10100
- this.#addItemSize = (index, size, status) => {
10101
- sizes[index] = size;
10102
- if (this.#maxSize) {
10103
- const maxSize = this.#maxSize - sizes[index];
10104
- while (this.#calculatedSize > maxSize) this.#evict(true);
10105
- }
10106
- this.#calculatedSize += sizes[index];
10107
- if (status) {
10108
- status.entrySize = size;
10109
- status.totalCalculatedSize = this.#calculatedSize;
10110
- }
10111
- };
10112
- }
10113
- #removeItemSize = (_i) => {};
10114
- #addItemSize = (_i, _s, _st) => {};
10115
- #requireSize = (_k, _v, size, sizeCalculation) => {
10116
- if (size || sizeCalculation) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
10205
+ n = h;
10206
+ let r = setTimeout(() => n = 0, this.ttlResolution);
10207
+ r.unref && r.unref();
10208
+ }
10209
+ return h;
10210
+ };
10211
+ this.getRemainingTTL = (h) => {
10212
+ let r = this.#s.get(h);
10213
+ return r === void 0 ? 0 : l(r);
10214
+ };
10215
+ let l = (h) => {
10216
+ let r = e[h], c = t[h];
10217
+ if (!r || !c) return 1 / 0;
10218
+ return r - ((n || o()) - c);
10219
+ };
10220
+ this.#p = (h) => {
10221
+ let r = t[h], c = e[h];
10222
+ return !!c && !!r && (n || o()) - r > c;
10223
+ };
10224
+ }
10225
+ #R = () => {};
10226
+ #v = () => {};
10227
+ #H = () => {};
10228
+ #p = () => !1;
10229
+ #X() {
10230
+ let e = new O(this.#o);
10231
+ this.#b = 0, this.#_ = e, this.#x = (t) => {
10232
+ this.#b -= e[t], e[t] = 0;
10233
+ }, this.#N = (t, i, s, n) => {
10234
+ if (!T(s)) {
10235
+ if (this.#e(i)) return this.backgroundFetchSize;
10236
+ if (n) {
10237
+ if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
10238
+ if (s = n(i, t), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
10239
+ } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
10240
+ }
10241
+ return s;
10242
+ }, this.#j = (t, i, s) => {
10243
+ if (e[t] = i, this.#c) {
10244
+ let n = this.#c - e[t];
10245
+ for (; this.#b > n;) this.#G(!0);
10246
+ }
10247
+ this.#b += e[t], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
10248
+ };
10249
+ }
10250
+ #x = (e) => {};
10251
+ #j = (e, t, i) => {};
10252
+ #N = (e, t, i, s) => {
10253
+ if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
10117
10254
  return 0;
10118
10255
  };
10119
- *#indexes({ allowStale = this.allowStale } = {}) {
10120
- if (this.#size) for (let i = this.#tail;;) {
10121
- if (!this.#isValidIndex(i)) break;
10122
- if (allowStale || !this.#isStale(i)) yield i;
10123
- if (i === this.#head) break;
10124
- else i = this.#prev[i];
10125
- }
10256
+ *#A({ allowStale: e = this.allowStale } = {}) {
10257
+ if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#a);) t = this.#u[t];
10126
10258
  }
10127
- *#rindexes({ allowStale = this.allowStale } = {}) {
10128
- if (this.#size) for (let i = this.#head;;) {
10129
- if (!this.#isValidIndex(i)) break;
10130
- if (allowStale || !this.#isStale(i)) yield i;
10131
- if (i === this.#tail) break;
10132
- else i = this.#next[i];
10133
- }
10259
+ *#z({ allowStale: e = this.allowStale } = {}) {
10260
+ if (this.#n) for (let t = this.#a; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h);) t = this.#l[t];
10134
10261
  }
10135
- #isValidIndex(index) {
10136
- return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
10262
+ #V(e) {
10263
+ return e !== void 0 && this.#s.get(this.#i[e]) === e;
10137
10264
  }
10138
- /**
10139
- * Return a generator yielding `[key, value]` pairs,
10140
- * in order from most recently used to least recently used.
10141
- */
10142
10265
  *entries() {
10143
- for (const i of this.#indexes()) if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield [this.#keyList[i], this.#valList[i]];
10266
+ for (let e of this.#A()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
10144
10267
  }
10145
- /**
10146
- * Inverse order version of {@link LRUCache.entries}
10147
- *
10148
- * Return a generator yielding `[key, value]` pairs,
10149
- * in order from least recently used to most recently used.
10150
- */
10151
10268
  *rentries() {
10152
- for (const i of this.#rindexes()) if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield [this.#keyList[i], this.#valList[i]];
10269
+ for (let e of this.#z()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
10153
10270
  }
10154
- /**
10155
- * Return a generator yielding the keys in the cache,
10156
- * in order from most recently used to least recently used.
10157
- */
10158
10271
  *keys() {
10159
- for (const i of this.#indexes()) {
10160
- const k = this.#keyList[i];
10161
- if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield k;
10272
+ for (let e of this.#A()) {
10273
+ let t = this.#i[e];
10274
+ t !== void 0 && !this.#e(this.#t[e]) && (yield t);
10162
10275
  }
10163
10276
  }
10164
- /**
10165
- * Inverse order version of {@link LRUCache.keys}
10166
- *
10167
- * Return a generator yielding the keys in the cache,
10168
- * in order from least recently used to most recently used.
10169
- */
10170
10277
  *rkeys() {
10171
- for (const i of this.#rindexes()) {
10172
- const k = this.#keyList[i];
10173
- if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield k;
10278
+ for (let e of this.#z()) {
10279
+ let t = this.#i[e];
10280
+ t !== void 0 && !this.#e(this.#t[e]) && (yield t);
10174
10281
  }
10175
10282
  }
10176
- /**
10177
- * Return a generator yielding the values in the cache,
10178
- * in order from most recently used to least recently used.
10179
- */
10180
10283
  *values() {
10181
- for (const i of this.#indexes()) if (this.#valList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
10284
+ for (let e of this.#A()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
10182
10285
  }
10183
- /**
10184
- * Inverse order version of {@link LRUCache.values}
10185
- *
10186
- * Return a generator yielding the values in the cache,
10187
- * in order from least recently used to most recently used.
10188
- */
10189
10286
  *rvalues() {
10190
- for (const i of this.#rindexes()) if (this.#valList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) yield this.#valList[i];
10287
+ for (let e of this.#z()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
10191
10288
  }
10192
- /**
10193
- * Iterating over the cache itself yields the same results as
10194
- * {@link LRUCache.entries}
10195
- */
10196
10289
  [Symbol.iterator]() {
10197
10290
  return this.entries();
10198
10291
  }
10199
- /**
10200
- * A String value that is used in the creation of the default string
10201
- * description of an object. Called by the built-in method
10202
- * `Object.prototype.toString`.
10203
- */
10204
10292
  [Symbol.toStringTag] = "LRUCache";
10205
- /**
10206
- * Find a value for which the supplied fn method returns a truthy value,
10207
- * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
10208
- */
10209
- find(fn, getOptions = {}) {
10210
- for (const i of this.#indexes()) {
10211
- const v = this.#valList[i];
10212
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
10213
- if (value === void 0) continue;
10214
- if (fn(value, this.#keyList[i], this)) return this.get(this.#keyList[i], getOptions);
10293
+ find(e, t = {}) {
10294
+ for (let i of this.#A()) {
10295
+ let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
10296
+ if (n !== void 0 && e(n, this.#i[i], this)) return this.#C(this.#i[i], t);
10215
10297
  }
10216
10298
  }
10217
- /**
10218
- * Call the supplied function on each item in the cache, in order from most
10219
- * recently used to least recently used.
10220
- *
10221
- * `fn` is called as `fn(value, key, cache)`.
10222
- *
10223
- * If `thisp` is provided, function will be called in the `this`-context of
10224
- * the provided object, or the cache if no `thisp` object is provided.
10225
- *
10226
- * Does not update age or recenty of use, or iterate over stale values.
10227
- */
10228
- forEach(fn, thisp = this) {
10229
- for (const i of this.#indexes()) {
10230
- const v = this.#valList[i];
10231
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
10232
- if (value === void 0) continue;
10233
- fn.call(thisp, value, this.#keyList[i], this);
10299
+ forEach(e, t = this) {
10300
+ for (let i of this.#A()) {
10301
+ let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
10302
+ n !== void 0 && e.call(t, n, this.#i[i], this);
10234
10303
  }
10235
10304
  }
10236
- /**
10237
- * The same as {@link LRUCache.forEach} but items are iterated over in
10238
- * reverse order. (ie, less recently used items are iterated over first.)
10239
- */
10240
- rforEach(fn, thisp = this) {
10241
- for (const i of this.#rindexes()) {
10242
- const v = this.#valList[i];
10243
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
10244
- if (value === void 0) continue;
10245
- fn.call(thisp, value, this.#keyList[i], this);
10305
+ rforEach(e, t = this) {
10306
+ for (let i of this.#z()) {
10307
+ let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
10308
+ n !== void 0 && e.call(t, n, this.#i[i], this);
10246
10309
  }
10247
10310
  }
10248
- /**
10249
- * Delete any stale entries. Returns true if anything was removed,
10250
- * false otherwise.
10251
- */
10252
10311
  purgeStale() {
10253
- let deleted = false;
10254
- for (const i of this.#rindexes({ allowStale: true })) if (this.#isStale(i)) {
10255
- this.#delete(this.#keyList[i], "expire");
10256
- deleted = true;
10257
- }
10258
- return deleted;
10312
+ let e = !1;
10313
+ for (let t of this.#z({ allowStale: !0 })) this.#p(t) && (this.#E(this.#i[t], "expire"), e = !0);
10314
+ return e;
10315
+ }
10316
+ info(e) {
10317
+ let t = this.#s.get(e);
10318
+ if (t === void 0) return;
10319
+ let i = this.#t[t], s = this.#e(i) ? i.__staleWhileFetching : i;
10320
+ if (s === void 0) return;
10321
+ let n = { value: s };
10322
+ if (this.#d && this.#F) {
10323
+ let o = this.#d[t], l = this.#F[t];
10324
+ if (o && l) n.ttl = o - (this.#m.now() - l), n.start = Date.now();
10325
+ }
10326
+ return this.#_ && (n.size = this.#_[t]), n;
10259
10327
  }
10260
- /**
10261
- * Get the extended info about a given entry, to get its value, size, and
10262
- * TTL info simultaneously. Returns `undefined` if the key is not present.
10263
- *
10264
- * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
10265
- * serialization, the `start` value is always the current timestamp, and the
10266
- * `ttl` is a calculated remaining time to live (negative if expired).
10267
- *
10268
- * Always returns stale values, if their info is found in the cache, so be
10269
- * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
10270
- * if relevant.
10271
- */
10272
- info(key) {
10273
- const i = this.#keyMap.get(key);
10274
- if (i === void 0) return void 0;
10275
- const v = this.#valList[i];
10276
- /* c8 ignore start - this isn't tested for the info function,
10277
- * but it's the same logic as found in other places. */
10278
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
10279
- if (value === void 0) return void 0;
10280
- /* c8 ignore end */
10281
- const entry = { value };
10282
- if (this.#ttls && this.#starts) {
10283
- const ttl = this.#ttls[i];
10284
- const start = this.#starts[i];
10285
- if (ttl && start) {
10286
- entry.ttl = ttl - (this.#perf.now() - start);
10287
- entry.start = Date.now();
10288
- }
10289
- }
10290
- if (this.#sizes) entry.size = this.#sizes[i];
10291
- return entry;
10292
- }
10293
- /**
10294
- * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
10295
- * passed to {@link LRUCache#load}.
10296
- *
10297
- * The `start` fields are calculated relative to a portable `Date.now()`
10298
- * timestamp, even if `performance.now()` is available.
10299
- *
10300
- * Stale entries are always included in the `dump`, even if
10301
- * {@link LRUCache.OptionsBase.allowStale} is false.
10302
- *
10303
- * Note: this returns an actual array, not a generator, so it can be more
10304
- * easily passed around.
10305
- */
10306
10328
  dump() {
10307
- const arr = [];
10308
- for (const i of this.#indexes({ allowStale: true })) {
10309
- const key = this.#keyList[i];
10310
- const v = this.#valList[i];
10311
- const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
10312
- if (value === void 0 || key === void 0) continue;
10313
- const entry = { value };
10314
- if (this.#ttls && this.#starts) {
10315
- entry.ttl = this.#ttls[i];
10316
- const age = this.#perf.now() - this.#starts[i];
10317
- entry.start = Math.floor(Date.now() - age);
10318
- }
10319
- if (this.#sizes) entry.size = this.#sizes[i];
10320
- arr.unshift([key, entry]);
10321
- }
10322
- return arr;
10323
- }
10324
- /**
10325
- * Reset the cache and load in the items in entries in the order listed.
10326
- *
10327
- * The shape of the resulting cache may be different if the same options are
10328
- * not used in both caches.
10329
- *
10330
- * The `start` fields are assumed to be calculated relative to a portable
10331
- * `Date.now()` timestamp, even if `performance.now()` is available.
10332
- */
10333
- load(arr) {
10334
- this.clear();
10335
- for (const [key, entry] of arr) {
10336
- if (entry.start) {
10337
- const age = Date.now() - entry.start;
10338
- entry.start = this.#perf.now() - age;
10329
+ let e = [];
10330
+ for (let t of this.#A({ allowStale: !0 })) {
10331
+ let i = this.#i[t], s = this.#t[t], n = this.#e(s) ? s.__staleWhileFetching : s;
10332
+ if (n === void 0 || i === void 0) continue;
10333
+ let o = { value: n };
10334
+ if (this.#d && this.#F) {
10335
+ o.ttl = this.#d[t];
10336
+ let l = this.#m.now() - this.#F[t];
10337
+ o.start = Math.floor(Date.now() - l);
10339
10338
  }
10340
- this.set(key, entry.value, entry);
10339
+ this.#_ && (o.size = this.#_[t]), e.unshift([i, o]);
10341
10340
  }
10341
+ return e;
10342
10342
  }
10343
- /**
10344
- * Add a value to the cache.
10345
- *
10346
- * Note: if `undefined` is specified as a value, this is an alias for
10347
- * {@link LRUCache#delete}
10348
- *
10349
- * Fields on the {@link LRUCache.SetOptions} options param will override
10350
- * their corresponding values in the constructor options for the scope
10351
- * of this single `set()` operation.
10352
- *
10353
- * If `start` is provided, then that will set the effective start
10354
- * time for the TTL calculation. Note that this must be a previous
10355
- * value of `performance.now()` if supported, or a previous value of
10356
- * `Date.now()` if not.
10357
- *
10358
- * Options object may also include `size`, which will prevent
10359
- * calling the `sizeCalculation` function and just use the specified
10360
- * number if it is a positive integer, and `noDisposeOnSet` which
10361
- * will prevent calling a `dispose` function in the case of
10362
- * overwrites.
10363
- *
10364
- * If the `size` (or return value of `sizeCalculation`) for a given
10365
- * entry is greater than `maxEntrySize`, then the item will not be
10366
- * added to the cache.
10367
- *
10368
- * Will update the recency of the entry.
10369
- *
10370
- * If the value is `undefined`, then this is an alias for
10371
- * `cache.delete(key)`. `undefined` is never stored in the cache.
10372
- */
10373
- set(k, v, setOptions = {}) {
10374
- if (v === void 0) {
10375
- this.delete(k);
10376
- return this;
10377
- }
10378
- const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
10379
- let { noUpdateTTL = this.noUpdateTTL } = setOptions;
10380
- const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
10381
- if (this.maxEntrySize && size > this.maxEntrySize) {
10382
- if (status) {
10383
- status.set = "miss";
10384
- status.maxEntrySizeExceeded = true;
10385
- }
10386
- this.#delete(k, "set");
10387
- return this;
10388
- }
10389
- let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
10390
- if (index === void 0) {
10391
- index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
10392
- this.#keyList[index] = k;
10393
- this.#valList[index] = v;
10394
- this.#keyMap.set(k, index);
10395
- this.#next[this.#tail] = index;
10396
- this.#prev[index] = this.#tail;
10397
- this.#tail = index;
10398
- this.#size++;
10399
- this.#addItemSize(index, size, status);
10400
- if (status) status.set = "add";
10401
- noUpdateTTL = false;
10402
- if (this.#hasOnInsert) this.#onInsert?.(v, k, "add");
10403
- } else {
10404
- this.#moveToTail(index);
10405
- const oldVal = this.#valList[index];
10406
- if (v !== oldVal) {
10407
- if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
10408
- oldVal.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
10409
- const { __staleWhileFetching: s } = oldVal;
10410
- if (s !== void 0 && !noDisposeOnSet) {
10411
- if (this.#hasDispose) this.#dispose?.(s, k, "set");
10412
- if (this.#hasDisposeAfter) this.#disposed?.push([
10413
- s,
10414
- k,
10415
- "set"
10416
- ]);
10417
- }
10418
- } else if (!noDisposeOnSet) {
10419
- if (this.#hasDispose) this.#dispose?.(oldVal, k, "set");
10420
- if (this.#hasDisposeAfter) this.#disposed?.push([
10421
- oldVal,
10422
- k,
10343
+ load(e) {
10344
+ this.clear();
10345
+ for (let [t, i] of e) {
10346
+ if (i.start) {
10347
+ let s = Date.now() - i.start;
10348
+ i.start = this.#m.now() - s;
10349
+ }
10350
+ this.#W(t, i.value, i);
10351
+ }
10352
+ }
10353
+ set(e, t, i = {}) {
10354
+ let { status: s = S.hasSubscribers ? {} : void 0 } = i;
10355
+ i.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t), s.cache = this);
10356
+ let n = this.#W(e, t, i);
10357
+ return s && S.hasSubscribers && S.publish(s), n;
10358
+ }
10359
+ #W(e, t, i, s) {
10360
+ let { ttl: n = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, c = this.#e(t);
10361
+ if (t === void 0) return r && (r.set = "deleted"), this.delete(e), this;
10362
+ let { noUpdateTTL: m = this.noUpdateTTL } = i;
10363
+ r && !c && (r.value = t);
10364
+ let _ = this.#N(e, t, i.size || 0, h, r);
10365
+ if (this.maxEntrySize && _ > this.maxEntrySize) return this.#E(e, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = !0), this;
10366
+ let u = this.#n === 0 ? void 0 : this.#s.get(e);
10367
+ if (u === void 0) u = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(!1) : this.#n, this.#i[u] = e, this.#t[u] = t, this.#s.set(e, u), this.#l[this.#h] = u, this.#u[u] = this.#h, this.#h = u, this.#n++, this.#j(u, _, r), r && (r.set = "add"), m = !1, this.#D && !c && this.#O?.(t, e, "add");
10368
+ else {
10369
+ this.#L(u);
10370
+ let g = this.#t[u];
10371
+ if (t !== g) {
10372
+ if (!l) if (this.#e(g)) {
10373
+ g !== s && g.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
10374
+ let { __staleWhileFetching: f } = g;
10375
+ f !== void 0 && f !== t && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([
10376
+ f,
10377
+ e,
10423
10378
  "set"
10424
- ]);
10425
- }
10426
- this.#removeItemSize(index);
10427
- this.#addItemSize(index, size, status);
10428
- this.#valList[index] = v;
10429
- if (status) {
10430
- status.set = "replace";
10431
- const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
10432
- if (oldValue !== void 0) status.oldValue = oldValue;
10379
+ ]));
10380
+ } else this.#T && this.#S?.(g, e, "set"), this.#f && this.#r?.push([
10381
+ g,
10382
+ e,
10383
+ "set"
10384
+ ]);
10385
+ if (this.#x(u), this.#j(u, _, r), this.#t[u] = t, !c) {
10386
+ let f = g && this.#e(g) ? g.__staleWhileFetching : g, y = f === void 0 ? "add" : t !== f ? "replace" : "update";
10387
+ r && (r.set = y, f !== void 0 && (r.oldValue = f)), this.#D && this.onInsert?.(t, e, y);
10433
10388
  }
10434
- } else if (status) status.set = "update";
10435
- if (this.#hasOnInsert) this.onInsert?.(v, k, v === oldVal ? "update" : "replace");
10436
- }
10437
- if (ttl !== 0 && !this.#ttls) this.#initializeTTLTracking();
10438
- if (this.#ttls) {
10439
- if (!noUpdateTTL) this.#setItemTTL(index, ttl, start);
10440
- if (status) this.#statusTTL(status, index);
10389
+ } else c || (r && (r.set = "update"), this.#D && this.onInsert?.(t, e, "update"));
10441
10390
  }
10442
- if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
10443
- const dt = this.#disposed;
10444
- let task;
10445
- while (task = dt?.shift()) this.#disposeAfter?.(...task);
10391
+ if (n !== 0 && !this.#d && this.#k(), this.#d && (m || this.#H(u, n, o), r && this.#v(r, u)), !l && this.#f && this.#r) {
10392
+ let g = this.#r, f;
10393
+ for (; f = g?.shift();) this.#w?.(...f);
10446
10394
  }
10447
10395
  return this;
10448
10396
  }
10449
- /**
10450
- * Evict the least recently used item, returning its value or
10451
- * `undefined` if cache is empty.
10452
- */
10453
10397
  pop() {
10454
10398
  try {
10455
- while (this.#size) {
10456
- const val = this.#valList[this.#head];
10457
- this.#evict(true);
10458
- if (this.#isBackgroundFetch(val)) {
10459
- if (val.__staleWhileFetching) return val.__staleWhileFetching;
10460
- } else if (val !== void 0) return val;
10399
+ for (; this.#n;) {
10400
+ let e = this.#t[this.#a];
10401
+ if (this.#G(!0), this.#e(e)) {
10402
+ if (e.__staleWhileFetching) return e.__staleWhileFetching;
10403
+ } else if (e !== void 0) return e;
10461
10404
  }
10462
10405
  } finally {
10463
- if (this.#hasDisposeAfter && this.#disposed) {
10464
- const dt = this.#disposed;
10465
- let task;
10466
- while (task = dt?.shift()) this.#disposeAfter?.(...task);
10467
- }
10468
- }
10469
- }
10470
- #evict(free) {
10471
- const head = this.#head;
10472
- const k = this.#keyList[head];
10473
- const v = this.#valList[head];
10474
- if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) v.__abortController.abort(/* @__PURE__ */ new Error("evicted"));
10475
- else if (this.#hasDispose || this.#hasDisposeAfter) {
10476
- if (this.#hasDispose) this.#dispose?.(v, k, "evict");
10477
- if (this.#hasDisposeAfter) this.#disposed?.push([
10478
- v,
10479
- k,
10480
- "evict"
10481
- ]);
10482
- }
10483
- this.#removeItemSize(head);
10484
- if (this.#autopurgeTimers?.[head]) {
10485
- clearTimeout(this.#autopurgeTimers[head]);
10486
- this.#autopurgeTimers[head] = void 0;
10487
- }
10488
- if (free) {
10489
- this.#keyList[head] = void 0;
10490
- this.#valList[head] = void 0;
10491
- this.#free.push(head);
10492
- }
10493
- if (this.#size === 1) {
10494
- this.#head = this.#tail = 0;
10495
- this.#free.length = 0;
10496
- } else this.#head = this.#next[head];
10497
- this.#keyMap.delete(k);
10498
- this.#size--;
10499
- return head;
10500
- }
10501
- /**
10502
- * Check if a key is in the cache, without updating the recency of use.
10503
- * Will return false if the item is stale, even though it is technically
10504
- * in the cache.
10505
- *
10506
- * Check if a key is in the cache, without updating the recency of
10507
- * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
10508
- * to `true` in either the options or the constructor.
10509
- *
10510
- * Will return `false` if the item is stale, even though it is technically in
10511
- * the cache. The difference can be determined (if it matters) by using a
10512
- * `status` argument, and inspecting the `has` field.
10513
- *
10514
- * Will not update item age unless
10515
- * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
10516
- */
10517
- has(k, hasOptions = {}) {
10518
- const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
10519
- const index = this.#keyMap.get(k);
10520
- if (index !== void 0) {
10521
- const v = this.#valList[index];
10522
- if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) return false;
10523
- if (!this.#isStale(index)) {
10524
- if (updateAgeOnHas) this.#updateItemAge(index);
10525
- if (status) {
10526
- status.has = "hit";
10527
- this.#statusTTL(status, index);
10528
- }
10529
- return true;
10530
- } else if (status) {
10531
- status.has = "stale";
10532
- this.#statusTTL(status, index);
10533
- }
10534
- } else if (status) status.has = "miss";
10535
- return false;
10536
- }
10537
- /**
10538
- * Like {@link LRUCache#get} but doesn't update recency or delete stale
10539
- * items.
10540
- *
10541
- * Returns `undefined` if the item is stale, unless
10542
- * {@link LRUCache.OptionsBase.allowStale} is set.
10543
- */
10544
- peek(k, peekOptions = {}) {
10545
- const { allowStale = this.allowStale } = peekOptions;
10546
- const index = this.#keyMap.get(k);
10547
- if (index === void 0 || !allowStale && this.#isStale(index)) return;
10548
- const v = this.#valList[index];
10549
- return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
10550
- }
10551
- #backgroundFetch(k, index, options, context) {
10552
- const v = index === void 0 ? void 0 : this.#valList[index];
10553
- if (this.#isBackgroundFetch(v)) return v;
10554
- const ac = new AC();
10555
- const { signal } = options;
10556
- signal?.addEventListener("abort", () => ac.abort(signal.reason), { signal: ac.signal });
10557
- const fetchOpts = {
10558
- signal: ac.signal,
10559
- options,
10560
- context
10561
- };
10562
- const cb = (v, updateCache = false) => {
10563
- const { aborted } = ac.signal;
10564
- const ignoreAbort = options.ignoreFetchAbort && v !== void 0;
10565
- if (options.status) if (aborted && !updateCache) {
10566
- options.status.fetchAborted = true;
10567
- options.status.fetchError = ac.signal.reason;
10568
- if (ignoreAbort) options.status.fetchAbortIgnored = true;
10569
- } else options.status.fetchResolved = true;
10570
- if (aborted && !ignoreAbort && !updateCache) return fetchFail(ac.signal.reason);
10571
- const bf = p;
10572
- const vl = this.#valList[index];
10573
- if (vl === p || ignoreAbort && updateCache && vl === void 0) if (v === void 0) if (bf.__staleWhileFetching !== void 0) this.#valList[index] = bf.__staleWhileFetching;
10574
- else this.#delete(k, "fetch");
10575
- else {
10576
- if (options.status) options.status.fetchUpdated = true;
10577
- this.set(k, v, fetchOpts.options);
10578
- }
10579
- return v;
10580
- };
10581
- const eb = (er) => {
10582
- if (options.status) {
10583
- options.status.fetchRejected = true;
10584
- options.status.fetchError = er;
10585
- }
10586
- return fetchFail(er);
10587
- };
10588
- const fetchFail = (er) => {
10589
- const { aborted } = ac.signal;
10590
- const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
10591
- const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
10592
- const noDelete = allowStale || options.noDeleteOnFetchRejection;
10593
- const bf = p;
10594
- if (this.#valList[index] === p) {
10595
- if (!noDelete || bf.__staleWhileFetching === void 0) this.#delete(k, "fetch");
10596
- else if (!allowStaleAborted) this.#valList[index] = bf.__staleWhileFetching;
10597
- }
10598
- if (allowStale) {
10599
- if (options.status && bf.__staleWhileFetching !== void 0) options.status.returnedStale = true;
10600
- return bf.__staleWhileFetching;
10601
- } else if (bf.__returned === bf) throw er;
10602
- };
10603
- const pcall = (res, rej) => {
10604
- const fmp = this.#fetchMethod?.(k, v, fetchOpts);
10605
- if (fmp && fmp instanceof Promise) fmp.then((v) => res(v === void 0 ? void 0 : v), rej);
10606
- ac.signal.addEventListener("abort", () => {
10607
- if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
10608
- res(void 0);
10609
- if (options.allowStaleOnFetchAbort) res = (v) => cb(v, true);
10610
- }
10611
- });
10612
- };
10613
- if (options.status) options.status.fetchDispatched = true;
10614
- const p = new Promise(pcall).then(cb, eb);
10615
- const bf = Object.assign(p, {
10616
- __abortController: ac,
10617
- __staleWhileFetching: v,
10406
+ if (this.#f && this.#r) {
10407
+ let e = this.#r, t;
10408
+ for (; t = e?.shift();) this.#w?.(...t);
10409
+ }
10410
+ }
10411
+ }
10412
+ #G(e) {
10413
+ let t = this.#a, i = this.#i[t], s = this.#t[t], n = this.#e(s);
10414
+ n && s.__abortController.abort(/* @__PURE__ */ new Error("evicted"));
10415
+ let o = n ? s.__staleWhileFetching : s;
10416
+ return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i, "evict"), this.#f && this.#r?.push([
10417
+ o,
10418
+ i,
10419
+ "evict"
10420
+ ])), this.#x(t), this.#g?.[t] && (clearTimeout(this.#g[t]), this.#g[t] = void 0), e && (this.#i[t] = void 0, this.#t[t] = void 0, this.#y.push(t)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t], this.#s.delete(i), this.#n--, t;
10421
+ }
10422
+ has(e, t = {}) {
10423
+ let { status: i = S.hasSubscribers ? {} : void 0 } = t;
10424
+ t.status = i, i && (i.op = "has", i.key = e, i.cache = this);
10425
+ let s = this.#Y(e, t);
10426
+ return S.hasSubscribers && S.publish(i), s;
10427
+ }
10428
+ #Y(e, t = {}) {
10429
+ let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = t, n = this.#s.get(e);
10430
+ if (n !== void 0) {
10431
+ let o = this.#t[n];
10432
+ if (this.#e(o) && o.__staleWhileFetching === void 0) return !1;
10433
+ if (this.#p(n)) s && (s.has = "stale", this.#v(s, n));
10434
+ else return i && this.#R(n), s && (s.has = "hit", this.#v(s, n)), !0;
10435
+ } else s && (s.has = "miss");
10436
+ return !1;
10437
+ }
10438
+ peek(e, t = {}) {
10439
+ let { status: i = R() ? {} : void 0 } = t;
10440
+ i && (i.op = "peek", i.key = e, i.cache = this), t.status = i;
10441
+ let s = this.#J(e, t);
10442
+ return S.hasSubscribers && S.publish(i), s;
10443
+ }
10444
+ #J(e, t) {
10445
+ let { status: i, allowStale: s = this.allowStale } = t, n = this.#s.get(e);
10446
+ if (n === void 0 || !s && this.#p(n)) {
10447
+ i && (i.peek = n === void 0 ? "miss" : "stale");
10448
+ return;
10449
+ }
10450
+ let o = this.#t[n], l = this.#e(o) ? o.__staleWhileFetching : o;
10451
+ return i && (l !== void 0 ? (i.peek = "hit", i.value = l) : i.peek = "miss"), l;
10452
+ }
10453
+ #P(e, t, i, s) {
10454
+ let n = t === void 0 ? void 0 : this.#t[t];
10455
+ if (this.#e(n)) return n;
10456
+ let o = new AbortController(), { signal: l } = i;
10457
+ l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal });
10458
+ let h = {
10459
+ signal: o.signal,
10460
+ options: i,
10461
+ context: s
10462
+ }, r = (f, y = !1) => {
10463
+ let { aborted: a } = o.signal, w = i.ignoreFetchAbort && f !== void 0, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== void 0);
10464
+ if (i.status && (a && !y ? (i.status.fetchAborted = !0, i.status.fetchError = o.signal.reason, w && (i.status.fetchAbortIgnored = !0)) : i.status.fetchResolved = !0), a && !w && !y) return m(o.signal.reason, F);
10465
+ let b = u, p = this.#t[t];
10466
+ return (p === u || p === void 0 && w && y) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t] = b.__staleWhileFetching : this.#E(e, "fetch") : (i.status && (i.status.fetchUpdated = !0), this.#W(e, f, h.options, b))), f;
10467
+ }, c = (f) => (i.status && (i.status.fetchRejected = !0, i.status.fetchError = f), m(f, !1)), m = (f, y) => {
10468
+ let { aborted: a } = o.signal, w = a && i.allowStaleOnFetchAbort, F = w || i.allowStaleOnFetchRejection, b = F || i.noDeleteOnFetchRejection, p = u;
10469
+ if (this.#t[t] === u && (!b || !y && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w || (this.#t[t] = p.__staleWhileFetching)), F) return i.status && p.__staleWhileFetching !== void 0 && (i.status.returnedStale = !0), p.__staleWhileFetching;
10470
+ if (p.__returned === p) throw f;
10471
+ }, _ = (f, y) => {
10472
+ let a = this.#M?.(e, n, h);
10473
+ o.signal.addEventListener("abort", () => {
10474
+ (!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(void 0), i.allowStaleOnFetchAbort && (f = (w) => r(w, !0)));
10475
+ }), a && a instanceof Promise ? a.then((w) => f(w === void 0 ? void 0 : w), y) : a !== void 0 && f(a);
10476
+ };
10477
+ i.status && (i.status.fetchDispatched = !0);
10478
+ let u = new Promise(_).then(r, c), g = Object.assign(u, {
10479
+ __abortController: o,
10480
+ __staleWhileFetching: n,
10618
10481
  __returned: void 0
10619
10482
  });
10620
- if (index === void 0) {
10621
- this.set(k, bf, {
10622
- ...fetchOpts.options,
10623
- status: void 0
10624
- });
10625
- index = this.#keyMap.get(k);
10626
- } else this.#valList[index] = bf;
10627
- return bf;
10628
- }
10629
- #isBackgroundFetch(p) {
10630
- if (!this.#hasFetchMethod) return false;
10631
- const b = p;
10632
- return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
10633
- }
10634
- async fetch(k, fetchOptions = {}) {
10635
- const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, ttl = this.ttl, noDisposeOnSet = this.noDisposeOnSet, size = 0, sizeCalculation = this.sizeCalculation, noUpdateTTL = this.noUpdateTTL, noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, ignoreFetchAbort = this.ignoreFetchAbort, allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, context, forceRefresh = false, status, signal } = fetchOptions;
10636
- if (!this.#hasFetchMethod) {
10637
- if (status) status.fetch = "get";
10638
- return this.get(k, {
10639
- allowStale,
10640
- updateAgeOnGet,
10641
- noDeleteOnStaleGet,
10642
- status
10643
- });
10644
- }
10645
- const options = {
10646
- allowStale,
10647
- updateAgeOnGet,
10648
- noDeleteOnStaleGet,
10649
- ttl,
10650
- noDisposeOnSet,
10651
- size,
10652
- sizeCalculation,
10653
- noUpdateTTL,
10654
- noDeleteOnFetchRejection,
10655
- allowStaleOnFetchRejection,
10656
- allowStaleOnFetchAbort,
10657
- ignoreFetchAbort,
10658
- status,
10659
- signal
10660
- };
10661
- let index = this.#keyMap.get(k);
10662
- if (index === void 0) {
10663
- if (status) status.fetch = "miss";
10664
- const p = this.#backgroundFetch(k, index, options, context);
10483
+ return t === void 0 ? (this.#W(e, g, {
10484
+ ...h.options,
10485
+ status: void 0
10486
+ }), t = this.#s.get(e)) : this.#t[t] = g, g;
10487
+ }
10488
+ #e(e) {
10489
+ if (!this.#U) return !1;
10490
+ let t = e;
10491
+ return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
10492
+ }
10493
+ fetch(e, t = {}) {
10494
+ let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
10495
+ t.status = s, s && t.context && (s.context = t.context);
10496
+ let n = this.#B(e, t);
10497
+ return s && i && (s.trace = !0, W.tracePromise(() => n, s).catch(() => {})), n;
10498
+ }
10499
+ async #B(e, t = {}) {
10500
+ let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l = this.noDisposeOnSet, size: h = 0, sizeCalculation: r = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: m = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _ = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: y = !1, status: a, signal: w } = t;
10501
+ if (a && (a.op = "fetch", a.key = e, y && (a.forceRefresh = !0), a.cache = this), !this.#U) return a && (a.fetch = "get"), this.#C(e, {
10502
+ allowStale: i,
10503
+ updateAgeOnGet: s,
10504
+ noDeleteOnStaleGet: n,
10505
+ status: a
10506
+ });
10507
+ let F = {
10508
+ allowStale: i,
10509
+ updateAgeOnGet: s,
10510
+ noDeleteOnStaleGet: n,
10511
+ ttl: o,
10512
+ noDisposeOnSet: l,
10513
+ size: h,
10514
+ sizeCalculation: r,
10515
+ noUpdateTTL: c,
10516
+ noDeleteOnFetchRejection: m,
10517
+ allowStaleOnFetchRejection: _,
10518
+ allowStaleOnFetchAbort: g,
10519
+ ignoreFetchAbort: u,
10520
+ status: a,
10521
+ signal: w
10522
+ }, b = this.#s.get(e);
10523
+ if (b === void 0) {
10524
+ a && (a.fetch = "miss");
10525
+ let p = this.#P(e, b, F, f);
10665
10526
  return p.__returned = p;
10666
10527
  } else {
10667
- const v = this.#valList[index];
10668
- if (this.#isBackgroundFetch(v)) {
10669
- const stale = allowStale && v.__staleWhileFetching !== void 0;
10670
- if (status) {
10671
- status.fetch = "inflight";
10672
- if (stale) status.returnedStale = true;
10673
- }
10674
- return stale ? v.__staleWhileFetching : v.__returned = v;
10675
- }
10676
- const isStale = this.#isStale(index);
10677
- if (!forceRefresh && !isStale) {
10678
- if (status) status.fetch = "hit";
10679
- this.#moveToTail(index);
10680
- if (updateAgeOnGet) this.#updateItemAge(index);
10681
- if (status) this.#statusTTL(status, index);
10682
- return v;
10683
- }
10684
- const p = this.#backgroundFetch(k, index, options, context);
10685
- const staleVal = p.__staleWhileFetching !== void 0 && allowStale;
10686
- if (status) {
10687
- status.fetch = isStale ? "stale" : "refresh";
10688
- if (staleVal && isStale) status.returnedStale = true;
10689
- }
10690
- return staleVal ? p.__staleWhileFetching : p.__returned = p;
10691
- }
10692
- }
10693
- async forceFetch(k, fetchOptions = {}) {
10694
- const v = await this.fetch(k, fetchOptions);
10695
- if (v === void 0) throw new Error("fetch() returned undefined");
10696
- return v;
10697
- }
10698
- memo(k, memoOptions = {}) {
10699
- const memoMethod = this.#memoMethod;
10700
- if (!memoMethod) throw new Error("no memoMethod provided to constructor");
10701
- const { context, forceRefresh, ...options } = memoOptions;
10702
- const v = this.get(k, options);
10703
- if (!forceRefresh && v !== void 0) return v;
10704
- const vv = memoMethod(k, v, {
10705
- options,
10706
- context
10707
- });
10708
- this.set(k, vv, options);
10709
- return vv;
10528
+ let p = this.#t[b];
10529
+ if (this.#e(p)) {
10530
+ let v = i && p.__staleWhileFetching !== void 0;
10531
+ return a && (a.fetch = "inflight", v && (a.returnedStale = !0)), v ? p.__staleWhileFetching : p.__returned = p;
10532
+ }
10533
+ let A = this.#p(b);
10534
+ if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#R(b), a && this.#v(a, b), p;
10535
+ let z = this.#P(e, b, F, f), E = z.__staleWhileFetching !== void 0 && i;
10536
+ return a && (a.fetch = A ? "stale" : "refresh", E && A && (a.returnedStale = !0)), E ? z.__staleWhileFetching : z.__returned = z;
10537
+ }
10538
+ }
10539
+ forceFetch(e, t = {}) {
10540
+ let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
10541
+ t.status = s, s && t.context && (s.context = t.context);
10542
+ let n = this.#K(e, t);
10543
+ return s && i && (s.trace = !0, W.tracePromise(() => n, s).catch(() => {})), n;
10544
+ }
10545
+ async #K(e, t = {}) {
10546
+ let i = await this.#B(e, t);
10547
+ if (i === void 0) throw new Error("fetch() returned undefined");
10548
+ return i;
10549
+ }
10550
+ memo(e, t = {}) {
10551
+ let { status: i = S.hasSubscribers ? {} : void 0 } = t;
10552
+ t.status = i, i && (i.op = "memo", i.key = e, t.context && (i.context = t.context), i.cache = this);
10553
+ let s = this.#Q(e, t);
10554
+ return i && (i.value = s), S.hasSubscribers && S.publish(i), s;
10555
+ }
10556
+ #Q(e, t = {}) {
10557
+ let i = this.#I;
10558
+ if (!i) throw new Error("no memoMethod provided to constructor");
10559
+ let { context: s, status: n, forceRefresh: o, ...l } = t;
10560
+ n && o && (n.forceRefresh = !0);
10561
+ let h = this.#C(e, l), r = o || h === void 0;
10562
+ if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) return h;
10563
+ let c = i(e, h, {
10564
+ options: l,
10565
+ context: s
10566
+ });
10567
+ return n && (n.value = c), this.#W(e, c, l), c;
10568
+ }
10569
+ get(e, t = {}) {
10570
+ let { status: i = S.hasSubscribers ? {} : void 0 } = t;
10571
+ t.status = i, i && (i.op = "get", i.key = e, i.cache = this);
10572
+ let s = this.#C(e, t);
10573
+ return i && (s !== void 0 && (i.value = s), S.hasSubscribers && S.publish(i)), s;
10574
+ }
10575
+ #C(e, t = {}) {
10576
+ let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t, l = this.#s.get(e);
10577
+ if (l === void 0) {
10578
+ o && (o.get = "miss");
10579
+ return;
10580
+ }
10581
+ let h = this.#t[l], r = this.#e(h);
10582
+ return o && this.#v(o, l), this.#p(l) ? r ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = !0), h.__staleWhileFetching) : void 0) : (n || this.#E(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = !0), h) : void 0) : (o && (o.get = r ? "fetching" : "hit"), this.#L(l), s && this.#R(l), r ? h.__staleWhileFetching : h);
10710
10583
  }
10711
- /**
10712
- * Return a value from the cache. Will update the recency of the cache
10713
- * entry found.
10714
- *
10715
- * If the key is not found, get() will return `undefined`.
10716
- */
10717
- get(k, getOptions = {}) {
10718
- const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
10719
- const index = this.#keyMap.get(k);
10720
- if (index !== void 0) {
10721
- const value = this.#valList[index];
10722
- const fetching = this.#isBackgroundFetch(value);
10723
- if (status) this.#statusTTL(status, index);
10724
- if (this.#isStale(index)) {
10725
- if (status) status.get = "stale";
10726
- if (!fetching) {
10727
- if (!noDeleteOnStaleGet) this.#delete(k, "expire");
10728
- if (status && allowStale) status.returnedStale = true;
10729
- return allowStale ? value : void 0;
10730
- } else {
10731
- if (status && allowStale && value.__staleWhileFetching !== void 0) status.returnedStale = true;
10732
- return allowStale ? value.__staleWhileFetching : void 0;
10733
- }
10734
- } else {
10735
- if (status) status.get = "hit";
10736
- if (fetching) return value.__staleWhileFetching;
10737
- this.#moveToTail(index);
10738
- if (updateAgeOnGet) this.#updateItemAge(index);
10739
- return value;
10740
- }
10741
- } else if (status) status.get = "miss";
10584
+ #$(e, t) {
10585
+ this.#u[t] = e, this.#l[e] = t;
10742
10586
  }
10743
- #connect(p, n) {
10744
- this.#prev[n] = p;
10745
- this.#next[p] = n;
10587
+ #L(e) {
10588
+ e !== this.#h && (e === this.#a ? this.#a = this.#l[e] : this.#$(this.#u[e], this.#l[e]), this.#$(this.#h, e), this.#h = e);
10746
10589
  }
10747
- #moveToTail(index) {
10748
- if (index !== this.#tail) {
10749
- if (index === this.#head) this.#head = this.#next[index];
10750
- else this.#connect(this.#prev[index], this.#next[index]);
10751
- this.#connect(this.#tail, index);
10752
- this.#tail = index;
10753
- }
10590
+ delete(e) {
10591
+ return this.#E(e, "delete");
10754
10592
  }
10755
- /**
10756
- * Deletes a key out of the cache.
10757
- *
10758
- * Returns true if the key was deleted, false otherwise.
10759
- */
10760
- delete(k) {
10761
- return this.#delete(k, "delete");
10762
- }
10763
- #delete(k, reason) {
10764
- let deleted = false;
10765
- if (this.#size !== 0) {
10766
- const index = this.#keyMap.get(k);
10767
- if (index !== void 0) {
10768
- if (this.#autopurgeTimers?.[index]) {
10769
- clearTimeout(this.#autopurgeTimers?.[index]);
10770
- this.#autopurgeTimers[index] = void 0;
10771
- }
10772
- deleted = true;
10773
- if (this.#size === 1) this.#clear(reason);
10593
+ #E(e, t) {
10594
+ S.hasSubscribers && S.publish({
10595
+ op: "delete",
10596
+ delete: t,
10597
+ key: e,
10598
+ cache: this
10599
+ });
10600
+ let i = !1;
10601
+ if (this.#n !== 0) {
10602
+ let s = this.#s.get(e);
10603
+ if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i = !0, this.#n === 1) this.#q(t);
10604
+ else {
10605
+ this.#x(s);
10606
+ let n = this.#t[s];
10607
+ if (this.#e(n) ? n.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n, e, t), this.#f && this.#r?.push([
10608
+ n,
10609
+ e,
10610
+ t
10611
+ ])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
10612
+ else if (s === this.#a) this.#a = this.#l[s];
10774
10613
  else {
10775
- this.#removeItemSize(index);
10776
- const v = this.#valList[index];
10777
- if (this.#isBackgroundFetch(v)) v.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
10778
- else if (this.#hasDispose || this.#hasDisposeAfter) {
10779
- if (this.#hasDispose) this.#dispose?.(v, k, reason);
10780
- if (this.#hasDisposeAfter) this.#disposed?.push([
10781
- v,
10782
- k,
10783
- reason
10784
- ]);
10785
- }
10786
- this.#keyMap.delete(k);
10787
- this.#keyList[index] = void 0;
10788
- this.#valList[index] = void 0;
10789
- if (index === this.#tail) this.#tail = this.#prev[index];
10790
- else if (index === this.#head) this.#head = this.#next[index];
10791
- else {
10792
- const pi = this.#prev[index];
10793
- this.#next[pi] = this.#next[index];
10794
- const ni = this.#next[index];
10795
- this.#prev[ni] = this.#prev[index];
10796
- }
10797
- this.#size--;
10798
- this.#free.push(index);
10614
+ let o = this.#u[s];
10615
+ this.#l[o] = this.#l[s];
10616
+ let l = this.#l[s];
10617
+ this.#u[l] = this.#u[s];
10799
10618
  }
10619
+ this.#n--, this.#y.push(s);
10800
10620
  }
10801
10621
  }
10802
- if (this.#hasDisposeAfter && this.#disposed?.length) {
10803
- const dt = this.#disposed;
10804
- let task;
10805
- while (task = dt?.shift()) this.#disposeAfter?.(...task);
10622
+ if (this.#f && this.#r?.length) {
10623
+ let s = this.#r, n;
10624
+ for (; n = s?.shift();) this.#w?.(...n);
10806
10625
  }
10807
- return deleted;
10626
+ return i;
10808
10627
  }
10809
- /**
10810
- * Clear the cache entirely, throwing away all values.
10811
- */
10812
10628
  clear() {
10813
- return this.#clear("delete");
10629
+ return this.#q("delete");
10814
10630
  }
10815
- #clear(reason) {
10816
- for (const index of this.#rindexes({ allowStale: true })) {
10817
- const v = this.#valList[index];
10818
- if (this.#isBackgroundFetch(v)) v.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
10631
+ #q(e) {
10632
+ for (let t of this.#z({ allowStale: !0 })) {
10633
+ let i = this.#t[t];
10634
+ if (this.#e(i)) i.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
10819
10635
  else {
10820
- const k = this.#keyList[index];
10821
- if (this.#hasDispose) this.#dispose?.(v, k, reason);
10822
- if (this.#hasDisposeAfter) this.#disposed?.push([
10823
- v,
10824
- k,
10825
- reason
10636
+ let s = this.#i[t];
10637
+ this.#T && this.#S?.(i, s, e), this.#f && this.#r?.push([
10638
+ i,
10639
+ s,
10640
+ e
10826
10641
  ]);
10827
10642
  }
10828
10643
  }
10829
- this.#keyMap.clear();
10830
- this.#valList.fill(void 0);
10831
- this.#keyList.fill(void 0);
10832
- if (this.#ttls && this.#starts) {
10833
- this.#ttls.fill(0);
10834
- this.#starts.fill(0);
10835
- for (const t of this.#autopurgeTimers ?? []) if (t !== void 0) clearTimeout(t);
10836
- this.#autopurgeTimers?.fill(void 0);
10644
+ if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
10645
+ this.#d.fill(0), this.#F.fill(0);
10646
+ for (let t of this.#g ?? []) t !== void 0 && clearTimeout(t);
10647
+ this.#g?.fill(void 0);
10837
10648
  }
10838
- if (this.#sizes) this.#sizes.fill(0);
10839
- this.#head = 0;
10840
- this.#tail = 0;
10841
- this.#free.length = 0;
10842
- this.#calculatedSize = 0;
10843
- this.#size = 0;
10844
- if (this.#hasDisposeAfter && this.#disposed) {
10845
- const dt = this.#disposed;
10846
- let task;
10847
- while (task = dt?.shift()) this.#disposeAfter?.(...task);
10649
+ if (this.#_ && this.#_.fill(0), this.#a = 0, this.#h = 0, this.#y.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
10650
+ let t = this.#r, i;
10651
+ for (; i = t?.shift();) this.#w?.(...i);
10848
10652
  }
10849
10653
  }
10850
10654
  };
10851
- //#endregion
10852
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column_providers/providers.js
10655
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column_providers/providers.js
10853
10656
  /**
10854
10657
  * Unified memoised factory dispatching to the right provider flavour by the
10855
10658
  * source shape:
@@ -10872,7 +10675,7 @@ function ColumnsProvider(source) {
10872
10675
  * {@link AccessorColumnsProviderImpl}, so `indexAccessorRoot` runs once per
10873
10676
  * accessor root (within the LRU window).
10874
10677
  */
10875
- const _accessorProviderCache = new LRUCache({ max: 64 });
10678
+ const _accessorProviderCache = new U({ max: 64 });
10876
10679
  function AccessorColumnsProvider(root) {
10877
10680
  let provider = _accessorProviderCache.get(root.handle);
10878
10681
  if (provider === void 0) {
@@ -10886,7 +10689,7 @@ function AccessorColumnsProvider(root) {
10886
10689
  * {@link ResultPoolColumnsProviderImpl}, so `indexPoolBlock` runs once per
10887
10690
  * pool snapshot (within the LRU window).
10888
10691
  */
10889
- const _resultPoolProviderCache = new LRUCache({ max: 4 });
10692
+ const _resultPoolProviderCache = new U({ max: 4 });
10890
10693
  function ResultPoolColumnsProvider(rawPool = getCfgRenderCtx().getUpstreamBlockCtx()) {
10891
10694
  const key = hashRawPool(rawPool);
10892
10695
  let provider = _resultPoolProviderCache.get(key);
@@ -10909,7 +10712,7 @@ var AccessorColumnsProviderImpl = class extends AccessorEntriesProvider {
10909
10712
  }
10910
10713
  getColumns() {
10911
10714
  if (this.cachedColumns !== void 0) return this.cachedColumns;
10912
- return this.cachedColumns = Array.from(this.entries.values()).map((e) => DataColumn.fromAccessor(e)).filter((v) => !isNil(v));
10715
+ return this.cachedColumns = Array.from(this.entries.values(), DataColumn.fromAccessor).filter((column) => column !== void 0);
10913
10716
  }
10914
10717
  };
10915
10718
  /**
@@ -10931,14 +10734,13 @@ var ResultPoolColumnsProviderImpl = class extends ResultPoolEntriesProvider {
10931
10734
  }
10932
10735
  getColumns() {
10933
10736
  if (this.cachedColumns !== void 0) return this.cachedColumns;
10934
- return this.cachedColumns = Array.from(this.getPObjectEntries().values()).map((e) => DataColumn.fromAccessor(e)).filter((v) => !isNil(v));
10737
+ return this.cachedColumns = Array.from(this.getPObjectEntries().values(), DataColumn.fromAccessor).filter((column) => column !== void 0);
10935
10738
  }
10936
10739
  };
10937
10740
  function hashRawPool(rawPool) {
10938
10741
  return rawPool.map((b) => `${b.blockId}\x1f${b.prodCtx ?? ""}\x1f${b.stagingCtx ?? ""}\x1f${b.prodIncomplete ? 1 : 0}\x1f${b.stagingIncomplete ? 1 : 0}`).join("");
10939
10742
  }
10940
- //#endregion
10941
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column_providers/index.js
10743
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column_providers/index.js
10942
10744
  /**
10943
10745
  * Build the default set of ColumnsProviders for the ambient render ctx:
10944
10746
  * - `AccessorColumnsProvider` over `outputs` (if present)
@@ -10972,27 +10774,7 @@ function isColumnProvider(source) {
10972
10774
  const p = source;
10973
10775
  return typeof p.getColumns === "function" && typeof p.isFinal === "function";
10974
10776
  }
10975
- //#endregion
10976
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/data_column.js
10977
- /**
10978
- * Thrown by leaf-recipe factories when the requested column is provably
10979
- * absent in the active render ctx — i.e. every relevant accessor reports
10980
- * `inputsLocked` and the column did not appear. Distinct from the
10981
- * `undefined` return that the factories still use for the "resolving" case
10982
- * (the column may still appear later).
10983
- *
10984
- * Catch at the boundary (resolver / filter+sort wiring / data-table assembly)
10985
- * when partial absence should be surfaced to the user rather than silently
10986
- * producing an empty result.
10987
- */
10988
- var ColumnAbsentError = class extends Error {
10989
- id;
10990
- constructor(id) {
10991
- super(`Column is absent in the active render ctx and will not appear: ${id}`);
10992
- this.id = id;
10993
- this.name = "ColumnAbsentError";
10994
- }
10995
- };
10777
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/data_column.js
10996
10778
  /**
10997
10779
  * The leaf-recipe building block: a {@link DataColumnRecipe} whose `id` is a bare
10998
10780
  * {@link PObjectId} and whose readers are bound to a single tree-accessor
@@ -11045,29 +10827,15 @@ var DataColumnImpl = class DataColumnImpl {
11045
10827
  }
11046
10828
  /**
11047
10829
  * Resolve via the ambient {@link ColumnRegistry}. Spec is resolved eagerly:
11048
- * returns `undefined` if the leaf isn't reachable yet (resolving). Throws
11049
- * {@link ColumnAbsentError} when every relevant accessor is `inputsLocked`
11050
- * and the column did not appear — the column will not exist in this ctx.
10830
+ * returns `undefined` unless the id names a column whose spec is readable in
10831
+ * this ctx — while it is resolving, when it is absent, and when the id names
10832
+ * an export that is not a column (a `kind: "File"` object, for example).
11051
10833
  * Data and dataStatus stay lazy.
11052
10834
  */
11053
10835
  static fromId(id, { ctx } = {}) {
11054
- const registry = new ColumnRegistry(getCtxProviders({ ctx }));
11055
- const leaf = registry.resolve(id);
11056
- if (isNil(leaf)) {
11057
- if (registry.isFinal()) throw new ColumnAbsentError(id);
11058
- return;
11059
- }
11060
- const spec = readSpecAccessor(leaf);
11061
- if (isNil(spec)) {
11062
- if (leaf.accessor.getInputsLocked()) throw new ColumnAbsentError(id);
11063
- return;
11064
- }
11065
- if (!spec.hasData()) return void 0;
11066
- return new DataColumnImpl(id, {
11067
- getSpec: () => spec.getDataAsJson(),
11068
- getData: () => readDataAccessor(leaf),
11069
- getDataStatus: () => readDataStatus(leaf)
11070
- });
10836
+ const leaf = new ColumnRegistry(getCtxProviders({ ctx })).resolve(id);
10837
+ if (isNil(leaf)) return void 0;
10838
+ return DataColumnImpl.fromAccessor(leaf);
11071
10839
  }
11072
10840
  /** {@link PlRef} wrapper over {@link fromId}. */
11073
10841
  static fromPlRef(ref) {
@@ -11075,18 +10843,15 @@ var DataColumnImpl = class DataColumnImpl {
11075
10843
  }
11076
10844
  /**
11077
10845
  * Bind directly to an accessor-backed {@link LeafEntry} — no registry.
11078
- * Throws {@link ColumnAbsentError} if the leaf has no spec field and its
11079
- * accessor is `inputsLocked`. Returns `undefined` while still resolving.
10846
+ * Returns `undefined` unless the leaf's spec is readable and is a column
10847
+ * spec: while the spec is resolving, when it is absent, and for an export
10848
+ * that is not a column.
11080
10849
  */
11081
10850
  static fromAccessor(entry) {
11082
- const spec = readSpecAccessor(entry);
11083
- if (isNil(spec)) {
11084
- if (entry.accessor.getInputsLocked()) throw new ColumnAbsentError(entry.id);
11085
- return;
11086
- }
11087
- if (!spec.hasData()) return void 0;
10851
+ const spec = readSpec(entry);
10852
+ if (spec === void 0 || !isPColumnSpec(spec)) return void 0;
11088
10853
  return new DataColumnImpl(entry.id, {
11089
- getSpec: () => spec.getDataAsJson(),
10854
+ getSpec: () => spec,
11090
10855
  getData: () => readDataAccessor(entry),
11091
10856
  getDataStatus: () => readDataStatus(entry)
11092
10857
  });
@@ -11108,7 +10873,9 @@ var DataColumnImpl = class DataColumnImpl {
11108
10873
  * Distinguishes `present` / `resolving` / `absent` for a {@link PObjectId}
11109
10874
  * in the active render ctx. Falls back to the registry's `isFinal()`
11110
10875
  * when the id has no entry — only then we can say `absent` instead of
11111
- * `resolving`.
10876
+ * `resolving`. The status tells only whether the spec is readable: for an
10877
+ * export that is not a column it is `present`, and the factories return
10878
+ * `undefined`.
11112
10879
  */
11113
10880
  static getStatusById(id, { ctx } = {}) {
11114
10881
  const registry = new ColumnRegistry(getCtxProviders({ ctx }));
@@ -11177,6 +10944,12 @@ const readSpecAccessor = memoizeByEntry(({ accessor, name }) => accessor.travers
11177
10944
  assertFieldType: "Input",
11178
10945
  ignoreError: true
11179
10946
  }));
10947
+ /** The leaf's spec, or `undefined` until the spec resource has data. */
10948
+ const readSpec = memoizeByEntry((entry) => {
10949
+ const spec = readSpecAccessor(entry);
10950
+ if (isNil(spec) || !spec.hasData()) return void 0;
10951
+ return spec.getDataAsJson();
10952
+ });
11180
10953
  /**
11181
10954
  * Per-entry counterpart to {@link readDataStatus}: tells whether the leaf's
11182
10955
  * **spec** can be read in this ctx, and — for the negative cases —
@@ -11204,7 +10977,7 @@ const readDataStatus = memoizeByEntry(({ accessor, name }) => {
11204
10977
  return accessor.getInputsLocked() ? "absent" : "resolving";
11205
10978
  });
11206
10979
  function memoizeByEntry(fn) {
11207
- const cache = new LRUCache({ max: 1e3 });
10980
+ const cache = new U({ max: 1e3 });
11208
10981
  return (entry) => {
11209
10982
  const key = `${entry.accessor.handle}:${entry.name}`;
11210
10983
  let hit = cache.get(key);
@@ -11212,8 +10985,7 @@ function memoizeByEntry(fn) {
11212
10985
  return hit.value;
11213
10986
  };
11214
10987
  }
11215
- //#endregion
11216
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_overrided_recipe.js
10988
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_overrided_recipe.js
11217
10989
  /**
11218
10990
  * Recipe wrapper that overlays {@link SpecOverrides} on top of any other
11219
10991
  * recipe. The id is `ColumnOverriddenKey { source: inner.id, specOverrides }`.
@@ -11350,8 +11122,7 @@ var DataColumnOverriddenRecipe = class extends ColumnOverriddenRecipe {
11350
11122
  return this.getInner().getData();
11351
11123
  }
11352
11124
  };
11353
- //#endregion
11354
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_filtered_recipe.js
11125
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_filtered_recipe.js
11355
11126
  /**
11356
11127
  * Recipe wrapper that fixes the values of selected axes of an inner recipe
11357
11128
  * (axis slicing). The id is `FilteredPColumnId { source: inner.id,
@@ -11476,8 +11247,7 @@ function toAxisSelector(axis) {
11476
11247
  if (axis.contextDomain !== void 0 && Object.keys(axis.contextDomain).length > 0) selector.contextDomain = axis.contextDomain;
11477
11248
  return selector;
11478
11249
  }
11479
- //#endregion
11480
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column_recipes/index.js
11250
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column_recipes/index.js
11481
11251
  /**
11482
11252
  * Build a `ColumnRecipe` from a stringified id. Dispatches to the matching
11483
11253
  * concrete recipe variant based on the id's encoding and recurses on
@@ -11515,8 +11285,8 @@ function ColumnRecipeBuild(id, opts = {}) {
11515
11285
  * Resolution status counterpart to {@link ColumnRecipeBuild}. Dispatches on
11516
11286
  * the parsed id shape to the matching `getStatusBy*` static — never
11517
11287
  * constructs the recipe. Use this at boundaries (resolver, filter/sort
11518
- * targets) to throw early on `absent` instead of silently producing an empty
11519
- * recipe via {@link ColumnRecipeBuild}.
11288
+ * targets) to tell an `absent` column from a `resolving` one: the recipe
11289
+ * factory returns `undefined` for both.
11520
11290
  */
11521
11291
  function ColumnRecipeGetStatus(id, opts = {}) {
11522
11292
  const parsed = parseColumnIdSafely(id);
@@ -11527,8 +11297,7 @@ function ColumnRecipeGetStatus(id, opts = {}) {
11527
11297
  throw new Error(`Unsupported ColumnRecipe id variant: ${id}`);
11528
11298
  }
11529
11299
  const ColumnRecipe = Object.assign(ColumnRecipeBuild, { getStatus: ColumnRecipeGetStatus });
11530
- //#endregion
11531
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_discovered_recipe.js
11300
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_discovered_recipe.js
11532
11301
  /**
11533
11302
  * Recipe for columns identified by a {@link ColumnDiscoveredKey}: a base
11534
11303
  * column + a `path` of linkers + qualifications.
@@ -11698,8 +11467,7 @@ var ColumnDiscoveredRecipe = class ColumnDiscoveredRecipe {
11698
11467
  function referencedUniIdsOf(key) {
11699
11468
  return /* @__PURE__ */ new Set([key.column, ...(key.path ?? []).map((item) => item.column)]);
11700
11469
  }
11701
- //#endregion
11702
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/column.js
11470
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/column.js
11703
11471
  /**
11704
11472
  * Unified entry point — routes between the two top-level dispatchers:
11705
11473
  * - string id (`PObjectId` / `ColumnUniversalId`) → {@link ColumnRecipe}
@@ -11712,8 +11480,7 @@ function Column(source, opts) {
11712
11480
  if (typeof source === "string") return ColumnRecipe(source, opts);
11713
11481
  return DataColumn(source, opts);
11714
11482
  }
11715
- //#endregion
11716
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/columns_collection.js
11483
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/columns_collection.js
11717
11484
  /**
11718
11485
  * Build a {@link ColumnsCollection} from sandbox-side source descriptors.
11719
11486
  * Resolves the `columnsCollection` driver (either from `deps.driver` or via
@@ -11821,8 +11588,34 @@ function currentBlockSources(ctx) {
11821
11588
  function defaultCtxSources(ctx) {
11822
11589
  return [...currentBlockSources(ctx), { kind: "result_pool" }];
11823
11590
  }
11824
- //#endregion
11825
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/columns/utils.js
11591
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/peer_links.js
11592
+ /** Main axes of the datasets: the second axis of every column marked `pl7.app/isAnchor`. */
11593
+ function collectDatasetAxes(specs) {
11594
+ return new Set(specs.flatMap((spec) => {
11595
+ const main = spec.axesSpec[1];
11596
+ return readAnnotation(spec, Annotation.IsAnchor) === "true" && main !== void 0 ? [canonicalizeAxisId(main)] : [];
11597
+ }));
11598
+ }
11599
+ /** {@link collectDatasetAxes} over the result pool. */
11600
+ function getResultPoolDatasetAxes() {
11601
+ return collectDatasetAxes(ResultPoolColumnsProvider().getColumns().map((c) => c.getSpec()));
11602
+ }
11603
+ /**
11604
+ * Labels of the peer links on a linker path. A peer link joins two datasets' main axes, e.g. one
11605
+ * clonotype to another, so the columns behind it describe a different clonotype than the row.
11606
+ */
11607
+ function findPeerLinks(linkers, datasetAxes) {
11608
+ return uniq(linkers.flatMap((l) => {
11609
+ const peer = l.axesSpec.every((a) => datasetAxes.has(canonicalizeAxisId(a)));
11610
+ const label = readAnnotation(l, Annotation.LinkLabel) ?? readAnnotation(l, Annotation.Label);
11611
+ return peer && label ? [label] : [];
11612
+ }));
11613
+ }
11614
+ /** Hover text for the link icon. */
11615
+ function describePeerLinks(links) {
11616
+ return `Reached via ${links.join(", then ")}`;
11617
+ }
11618
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/columns/utils.js
11826
11619
  /**
11827
11620
  * PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
11828
11621
  * deduped in traversal order. The hit column is
@@ -11952,8 +11745,7 @@ function findDiscovered(recipe) {
11952
11745
  function hasSingleDataColumn(recipe) {
11953
11746
  return recipe.getReferencedIds().length === 1;
11954
11747
  }
11955
- //#endregion
11956
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/filters/traverse.js
11748
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/filters/traverse.js
11957
11749
  /**
11958
11750
  * Recursively traverses a FilterSpec tree bottom-up, applying visitor callbacks.
11959
11751
  *
@@ -11991,8 +11783,7 @@ function collectFilterSpecColumns(filter) {
11991
11783
  not: (result) => result
11992
11784
  });
11993
11785
  }
11994
- //#endregion
11995
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/filters/converters/filterToQuery.js
11786
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/filters/converters/filterToQuery.js
11996
11787
  /** Converts a QueryColumnId object into a SpecQueryExpression reference. */
11997
11788
  function resolveColumnRef(col) {
11998
11789
  return col.type === "axis" ? {
@@ -12266,45 +12057,24 @@ function leafToSpecQueryExpr(filter) {
12266
12057
  default: assertNever(filter);
12267
12058
  }
12268
12059
  }
12269
- //#endregion
12270
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
12271
- function getTag(value) {
12272
- if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
12273
- return Object.prototype.toString.call(value);
12274
- }
12275
- //#endregion
12276
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs
12277
- function isArguments(value) {
12278
- return value !== null && typeof value === "object" && getTag(value) === "[object Arguments]";
12279
- }
12280
- //#endregion
12281
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isLength.mjs
12282
- function isLength(value) {
12283
- return Number.isSafeInteger(value) && value >= 0;
12284
- }
12285
- //#endregion
12286
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
12060
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.mjs
12287
12061
  function isArrayLike(value) {
12288
12062
  return value != null && typeof value !== "function" && isLength(value.length);
12289
12063
  }
12290
- //#endregion
12291
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
12292
- function isTypedArray$1(x) {
12293
- return ArrayBuffer.isView(x) && !(x instanceof DataView);
12294
- }
12295
- //#endregion
12296
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs
12297
- function isTypedArray(x) {
12298
- return isTypedArray$1(x);
12064
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isArguments.mjs
12065
+ function isArguments(value) {
12066
+ return value !== null && typeof value === "object" && getTag(value) === "[object Arguments]";
12299
12067
  }
12300
- //#endregion
12301
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs
12068
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/_internal/isPrototype.mjs
12302
12069
  function isPrototype(value) {
12303
12070
  const constructor = value?.constructor;
12304
12071
  return value === (typeof constructor === "function" ? constructor.prototype : Object.prototype);
12305
12072
  }
12306
- //#endregion
12307
- //#region ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs
12073
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.mjs
12074
+ function isTypedArray(x) {
12075
+ return isTypedArray$1(x);
12076
+ }
12077
+ // ../node_modules/.pnpm/es-toolkit@1.42.0/node_modules/es-toolkit/dist/compat/predicate/isEmpty.mjs
12308
12078
  function isEmpty(value) {
12309
12079
  if (value == null) return true;
12310
12080
  if (isArrayLike(value)) {
@@ -12319,8 +12089,7 @@ function isEmpty(value) {
12319
12089
  }
12320
12090
  return true;
12321
12091
  }
12322
- //#endregion
12323
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/filters/distill.js
12092
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/filters/distill.js
12324
12093
  /**
12325
12094
  * Strips non-FilterSpec metadata (whitelist approach) and removes
12326
12095
  * unfilled leaves (type is undefined or any required field is undefined).
@@ -12424,8 +12193,7 @@ const REQUIRED_KEYS_BY_TYPE = {
12424
12193
  lessThanColumnOrEqual: ["column", "rhs"],
12425
12194
  greaterThanColumnOrEqual: ["column", "rhs"]
12426
12195
  };
12427
- //#endregion
12428
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/components/PlDataTable/state-migration.js
12196
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/components/PlDataTable/state-migration.js
12429
12197
  /** Upgrade PlDataTableStateV2 to the latest version */
12430
12198
  function upgradePlDataTableStateV2(state) {
12431
12199
  if (!state) return createPlDataTableStateV2();
@@ -12443,6 +12211,7 @@ function upgradePlDataTableStateV2(state) {
12443
12211
  if (state.version === 5) state = migrateV5toV6(state);
12444
12212
  if (state.version === 6) state = migrateV6toV7(state);
12445
12213
  if (state.version === 7) state = migrateV7toV8(state);
12214
+ if (state.version === 8) state = migrateV8toV9(state);
12446
12215
  return state;
12447
12216
  }
12448
12217
  /** Migrate v5 to v6: unwrap `{source, labeled}` colIds in gridState. */
@@ -12690,7 +12459,7 @@ function createDefaultPTableParams() {
12690
12459
  }
12691
12460
  function createPlDataTableStateV2() {
12692
12461
  return {
12693
- version: 8,
12462
+ version: 9,
12694
12463
  stateCache: [],
12695
12464
  pTableParams: createDefaultPTableParams()
12696
12465
  };
@@ -12782,8 +12551,151 @@ function parseLegacyLeafColumn(s) {
12782
12551
  if (t !== "axis" && t !== "column") return void 0;
12783
12552
  return parsed;
12784
12553
  }
12785
- //#endregion
12786
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/utils.js
12554
+ function migrateV8toV9(state) {
12555
+ return {
12556
+ version: 9,
12557
+ stateCache: state.stateCache.map((entry) => ({
12558
+ ...entry,
12559
+ gridState: upgradeGridStateColumnIds(entry.gridState),
12560
+ filtersState: upgradeFilterColumnIds(entry.filtersState),
12561
+ defaultFiltersState: upgradeFilterColumnIds(entry.defaultFiltersState)
12562
+ })),
12563
+ pTableParams: upgradeParamsColumnIds(state.pTableParams)
12564
+ };
12565
+ }
12566
+ /** Keys a pre-rework discovered column id could carry; it had no marker. */
12567
+ const LEGACY_DISCOVERED_KEYS = /* @__PURE__ */ new Set([
12568
+ "column",
12569
+ "path",
12570
+ "columnQualifications",
12571
+ "queriesQualifications"
12572
+ ]);
12573
+ function isLegacyDiscoveredKey(value) {
12574
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
12575
+ if (!Object.keys(value).every((key) => LEGACY_DISCOVERED_KEYS.has(key))) return false;
12576
+ const { column, path } = value;
12577
+ if (typeof column !== "string") return false;
12578
+ if (path === void 0) return true;
12579
+ return Array.isArray(path) && path.every((item) => typeof item === "object" && item !== null && item.type === "linker" && typeof item.column === "string");
12580
+ }
12581
+ /**
12582
+ * A stored column id in its current form: unchanged when already current,
12583
+ * rewritten when it is a pre-rework discovered id, `undefined` when it cannot be
12584
+ * carried over (a pre-rework anchored or filtered id, or not an id at all).
12585
+ */
12586
+ function upgradeLegacyColumnId(id) {
12587
+ const key = parseJsonSafely(id);
12588
+ if (isColumnUniversalKey(key)) return id;
12589
+ if (!isLegacyDiscoveredKey(key)) return void 0;
12590
+ const column = upgradeLegacyColumnId(key.column);
12591
+ if (column === void 0) return void 0;
12592
+ const path = [];
12593
+ for (const item of key.path ?? []) {
12594
+ const linker = upgradeLegacyColumnId(item.column);
12595
+ if (linker === void 0) return void 0;
12596
+ path.push({
12597
+ type: "linker",
12598
+ column: linker
12599
+ });
12600
+ }
12601
+ const hasQualifications = (key.columnQualifications?.length ?? 0) > 0 || Object.keys(key.queriesQualifications ?? {}).length > 0;
12602
+ if (path.length === 0 && !hasQualifications) return column;
12603
+ return stringifyColumnDiscoveredId({
12604
+ column,
12605
+ path,
12606
+ columnQualifications: key.columnQualifications,
12607
+ queriesQualifications: key.queriesQualifications
12608
+ });
12609
+ }
12610
+ function upgradeColumnRef(ref) {
12611
+ if (ref.type !== "column") return ref;
12612
+ const id = upgradeLegacyColumnId(ref.id);
12613
+ return id === void 0 ? void 0 : {
12614
+ type: "column",
12615
+ id
12616
+ };
12617
+ }
12618
+ function upgradeParamsColumnIds(params) {
12619
+ if (params.sourceId === null) return params;
12620
+ const hiddenColIds = params.hiddenColIds === null ? null : params.hiddenColIds.flatMap((ref) => upgradeColumnRef(ref) ?? []);
12621
+ return {
12622
+ ...params,
12623
+ hiddenColIds,
12624
+ sorting: params.sorting === null ? null : upgradeSorting(params.sorting),
12625
+ filters: upgradeFilterColumnIds(params.filters),
12626
+ defaultFilters: upgradeFilterColumnIds(params.defaultFilters)
12627
+ };
12628
+ }
12629
+ /** `[]` is the user's cleared sorting and stays. A sorting emptied by dropped
12630
+ * entries falls back to the default (`null`) instead of reading as cleared. */
12631
+ function upgradeSorting(sorting) {
12632
+ if (sorting.length === 0) return sorting;
12633
+ const kept = sorting.flatMap((entry) => {
12634
+ const column = upgradeColumnRef(entry.column);
12635
+ return column === void 0 ? [] : [{
12636
+ ...entry,
12637
+ column
12638
+ }];
12639
+ });
12640
+ return kept.length === 0 ? null : kept;
12641
+ }
12642
+ function upgradeGridColId(colId) {
12643
+ const parsed = parseJsonSafely(colId);
12644
+ if (typeof parsed !== "object" || parsed === null || !("type" in parsed) || !("id" in parsed)) return colId;
12645
+ const ref = upgradeColumnRef(parsed);
12646
+ if (ref === void 0) return void 0;
12647
+ return ref === parsed ? colId : canonicalizeJson(ref);
12648
+ }
12649
+ function upgradeGridStateColumnIds(gridState) {
12650
+ const upgradeAll = (colIds) => colIds.flatMap((colId) => upgradeGridColId(colId) ?? []);
12651
+ return {
12652
+ ...gridState,
12653
+ ...gridState.columnOrder && { columnOrder: { orderedColIds: upgradeAll(gridState.columnOrder.orderedColIds) } },
12654
+ ...gridState.sort && { sort: { sortModel: gridState.sort.sortModel.flatMap((s) => {
12655
+ const colId = upgradeGridColId(s.colId);
12656
+ return colId === void 0 ? [] : [{
12657
+ ...s,
12658
+ colId
12659
+ }];
12660
+ }) } },
12661
+ ...gridState.columnVisibility && { columnVisibility: { hiddenColIds: upgradeAll(gridState.columnVisibility.hiddenColIds) } }
12662
+ };
12663
+ }
12664
+ function upgradeFilterColumnIds(node) {
12665
+ if (node === null) return null;
12666
+ const result = upgradeFilterNode(node);
12667
+ return result === void 0 ? null : result;
12668
+ }
12669
+ /** Rewrites the column ids in a filter tree. A leaf whose id cannot be carried
12670
+ * over is dropped, and a group left empty with it. */
12671
+ function upgradeFilterNode(node) {
12672
+ if (!node || typeof node !== "object") return void 0;
12673
+ const n = node;
12674
+ if (n.type === "and" || n.type === "or") {
12675
+ const kept = (n.filters ?? []).map(upgradeFilterNode).filter((f) => f !== void 0);
12676
+ if (kept.length === 0) return void 0;
12677
+ return {
12678
+ ...n,
12679
+ filters: kept
12680
+ };
12681
+ }
12682
+ if (n.type === "not") {
12683
+ const inner = upgradeFilterNode(n.filter);
12684
+ return inner === void 0 ? void 0 : {
12685
+ ...n,
12686
+ filter: inner
12687
+ };
12688
+ }
12689
+ const leaf = { ...n };
12690
+ for (const field of ["column", "rhs"]) {
12691
+ if (!(field in leaf)) continue;
12692
+ const ref = upgradeColumnRef(leaf[field]);
12693
+ if (ref === void 0) return void 0;
12694
+ leaf[field] = ref;
12695
+ }
12696
+ return leaf;
12697
+ }
12698
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/utils.js
12787
12699
  /** Adapt a {@link ColumnRecipe} to the plain {@link RuleColumn} shape. */
12788
12700
  function toRuleColumn(col) {
12789
12701
  return {
@@ -12877,11 +12789,11 @@ function deriveAllLabels(options) {
12877
12789
  return deriveDistinctLabels(columns.map((c) => ({
12878
12790
  spec: c.spec,
12879
12791
  linkerPath: c.linkerPath?.map((step) => ({ spec: step.linker.spec })),
12880
- qualifications: c.qualifications
12792
+ qualifications: c.qualifications,
12793
+ marker: c.marker
12881
12794
  })), deriveLabelsOptions).reduce((acc, label, index) => (acc[columns[index].id] = label, acc), {});
12882
12795
  }
12883
- //#endregion
12884
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js
12796
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js
12885
12797
  /**
12886
12798
  * Assemble a ptable def directly from recipes. Each secondary recipe is its own
12887
12799
  * outer-joined subtree: `getQuery()` encodes its linker chain, and its
@@ -12944,8 +12856,7 @@ function columnToJoinEntry(col, qualifications) {
12944
12856
  qualifications
12945
12857
  };
12946
12858
  }
12947
- //#endregion
12948
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/components/PlDataTable/columnResolver.js
12859
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/components/PlDataTable/columnResolver.js
12949
12860
  function createColumnResolver(columns) {
12950
12861
  const axisIds = [];
12951
12862
  for (const c of columns) for (const ax of c.getSpec().axesSpec) axisIds.push(getAxisId(ax));
@@ -12958,7 +12869,8 @@ function createColumnResolver(columns) {
12958
12869
  }
12959
12870
  return (ref) => {
12960
12871
  if (ref.type === "axis") return axisIds.some((a) => matchAxisId(ref.id, a)) ? ref : void 0;
12961
- const hit = byFullId.get(ref.id) ?? byPObjectId.get(extractPObjectId(ref.id));
12872
+ const pid = tryExtractPObjectId(ref.id);
12873
+ const hit = byFullId.get(ref.id) ?? (pid === void 0 ? void 0 : byPObjectId.get(pid));
12962
12874
  if (hit === void 0) return void 0;
12963
12875
  return {
12964
12876
  type: "column",
@@ -12966,8 +12878,16 @@ function createColumnResolver(columns) {
12966
12878
  };
12967
12879
  };
12968
12880
  }
12969
- //#endregion
12970
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/discoverColumns.js
12881
+ /** {@link extractPObjectId} for a stored reference: an id it cannot parse resolves to
12882
+ * nothing, so the one entry is dropped instead of failing the whole table. */
12883
+ function tryExtractPObjectId(id) {
12884
+ try {
12885
+ return extractPObjectId(id);
12886
+ } catch {
12887
+ return;
12888
+ }
12889
+ }
12890
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/discoverColumns.js
12971
12891
  /**
12972
12892
  * Discover columns from sources/anchors and split them into primary
12973
12893
  * (direct anchor hits — zero-hop, query is a bare column) and secondary
@@ -13012,8 +12932,7 @@ function discoverLabelColumns(ctx, primary) {
13012
12932
  maxHops: 0
13013
12933
  }).getColumns();
13014
12934
  }
13015
- //#endregion
13016
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.10/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js
12935
+ // ../node_modules/.pnpm/@platforma-sdk+model@1.88.16/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js
13017
12936
  function createPlDataTableV3(ctx, options) {
13018
12937
  const state = upgradePlDataTableStateV2(options.tableState);
13019
12938
  const primaryJoinType = options.primaryJoinType ?? "full";
@@ -13022,8 +12941,13 @@ function createPlDataTableV3(ctx, options) {
13022
12941
  const { primary, secondary } = resolved;
13023
12942
  if (primary.length === 0) return void 0;
13024
12943
  const { direct, linked } = splitByTopology(secondary);
12944
+ const labelable = [...primary, ...secondary].map(toLabelableColumn);
12945
+ const linkHints = collectLinkHints(labelable);
13025
12946
  const derivedLabels = deriveAllLabels({
13026
- columns: [...primary, ...secondary].filter((c) => !isColumnHidden(c.getSpec())).map(toLabelableColumn),
12947
+ columns: labelable.filter((c) => !isColumnHidden(c.spec)).map((c) => ({
12948
+ ...c,
12949
+ marker: linkHints.get(c.id)
12950
+ })),
13027
12951
  deriveLabelsOptions: {
13028
12952
  includeNativeLabel: true,
13029
12953
  ...options.labelsOptions
@@ -13096,6 +13020,7 @@ function createPlDataTableV3(ctx, options) {
13096
13020
  ],
13097
13021
  primaryColumns: primary,
13098
13022
  derivedLabels,
13023
+ linkHints,
13099
13024
  visibilityByColId,
13100
13025
  orderByColId
13101
13026
  });
@@ -13137,6 +13062,15 @@ function splitByTopology(columns) {
13137
13062
  function collectLinkerSnapshots(linked) {
13138
13063
  return uniqueBy(linked.flatMap((c) => collectLinkerColumns(c)), (c) => c.id);
13139
13064
  }
13065
+ /** Link icon hover text per column, for columns reached through at least one peer link. */
13066
+ function collectLinkHints(columns) {
13067
+ if (!columns.some((c) => c.linkerPath?.length)) return /* @__PURE__ */ new Map();
13068
+ const datasetAxes = getResultPoolDatasetAxes();
13069
+ return new Map(columns.flatMap((c) => {
13070
+ const links = findPeerLinks(c.linkerPath?.map((step) => step.linker.spec) ?? [], datasetAxes);
13071
+ return links.length > 0 ? [[c.id, describePeerLinks(links)]] : [];
13072
+ }));
13073
+ }
13140
13074
  function toLabelableColumn(col) {
13141
13075
  return {
13142
13076
  id: col.id,
@@ -13157,7 +13091,7 @@ function toLabelableColumn(col) {
13157
13091
  * The UI overlays this onto the engine-emitted specs at render time.
13158
13092
  */
13159
13093
  function buildColumnsMeta(params) {
13160
- const { fullColumns, visibleColumns, primaryColumns, derivedLabels } = params;
13094
+ const { fullColumns, visibleColumns, primaryColumns, derivedLabels, linkHints } = params;
13161
13095
  const { visibilityByColId, orderByColId } = params;
13162
13096
  const visibleStatus = buildDataStatusMap(visibleColumns);
13163
13097
  const columns = fullColumns.reduce((acc, c) => {
@@ -13166,7 +13100,8 @@ function buildColumnsMeta(params) {
13166
13100
  label: derivedLabels[c.id],
13167
13101
  visibility: getEffectiveVisibility(rc, visibilityByColId),
13168
13102
  order: getOrderPriority(rc, orderByColId),
13169
- status: visibleStatus[c.id]
13103
+ status: visibleStatus[c.id],
13104
+ linkHint: linkHints.get(c.id)
13170
13105
  };
13171
13106
  return acc;
13172
13107
  }, {});
@@ -13351,6 +13286,7 @@ const PlErrorLike = objectType({
13351
13286
  type: literalType("PlError"),
13352
13287
  name: stringType(),
13353
13288
  message: stringType(),
13289
+ /** The message with all details needed for SDK developers. */
13354
13290
  fullMessage: stringType().optional(),
13355
13291
  stack: stringType().optional()
13356
13292
  }).extend({
@@ -13404,7 +13340,6 @@ const StepResourceOverride = objectType({
13404
13340
  /** Keyed by step: the MiXCR command, or `mitool-<command>`. */
13405
13341
  const StepResources = recordType(stringType(), StepResourceOverride);
13406
13342
  const BlockArgsValidBase = objectType({
13407
- defaultBlockLabel: stringType().optional(),
13408
13343
  customBlockLabel: stringType().optional(),
13409
13344
  input: PlRef,
13410
13345
  inputLibrary: PlRef.optional(),
@@ -13442,14 +13377,11 @@ const BlockArgsValid = BlockArgsValidBase;
13442
13377
  BlockArgsValidBase.partial({
13443
13378
  input: true,
13444
13379
  preset: true,
13445
- defaultBlockLabel: true,
13446
13380
  customBlockLabel: true
13447
13381
  });
13448
- //#endregion
13449
- //#region ../model/dist/progress.js
13382
+ // ../model/dist/progress.js
13450
13383
  const ProgressPrefix = "[==PROGRESS==]";
13451
- //#endregion
13452
- //#region ../model/dist/step-resources.js
13384
+ // ../model/dist/step-resources.js
13453
13385
  /** Drops steps whose override sets no field, so clearing a row leaves no trace in the args. */
13454
13386
  function dropEmptyOverrides(o) {
13455
13387
  if (o === void 0) return void 0;
@@ -13457,8 +13389,7 @@ function dropEmptyOverrides(o) {
13457
13389
  return kept.length > 0 ? Object.fromEntries(kept) : void 0;
13458
13390
  }
13459
13391
  stringType().length(24).regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/).brand("PlId");
13460
- //#endregion
13461
- //#region ../model/dist/preset.js
13392
+ // ../model/dist/preset.js
13462
13393
  const MiXCRStage = unionType([
13463
13394
  literalType("mitool-parse"),
13464
13395
  literalType("mitool-refine-tags"),
@@ -13497,8 +13428,7 @@ const SupportedPresetOverview = objectType({
13497
13428
  reportTypes: arrayType(MiXCRStage)
13498
13429
  });
13499
13430
  arrayType(unknownType()).transform((presets) => presets.map((p) => SupportedPresetOverview.safeParse(p)).filter((p) => p.success).map((p) => p.data));
13500
- //#endregion
13501
- //#region ../model/dist/qc.js
13431
+ // ../model/dist/qc.js
13502
13432
  const QcStatus = unionType([
13503
13433
  literalType("OK"),
13504
13434
  literalType("WARN"),
@@ -13520,8 +13450,7 @@ arrayType(objectType({
13520
13450
  labelOverride: coerce.string().optional()
13521
13451
  })
13522
13452
  }));
13523
- //#endregion
13524
- //#region ../model/dist/reports.js
13453
+ // ../model/dist/reports.js
13525
13454
  const ImmuneChain = unionType([
13526
13455
  literalType(""),
13527
13456
  literalType("TRA"),
@@ -13619,12 +13548,10 @@ objectType({
13619
13548
  clonesFilteredInPostFiltering: numberType().int(),
13620
13549
  readsFilteredInPostFiltering: RoundedToInt
13621
13550
  });
13622
- //#endregion
13623
- //#region ../kind/dist/package.js
13551
+ // ../kind/dist/package.js
13624
13552
  var name = "@platforma-open/milaboratories.mixcr-clonotyping-2.kind";
13625
- var version = "1.2.0";
13626
- //#endregion
13627
- //#region ../node_modules/.pnpm/@platforma-sdk+block-kind@1.1.0/node_modules/@platforma-sdk/block-kind/dist/params.js
13553
+ var version = "1.3.0";
13554
+ // ../node_modules/.pnpm/@platforma-sdk+block-kind@1.1.1/node_modules/@platforma-sdk/block-kind/dist/params.js
13628
13555
  /**
13629
13556
  * Establish that a value is an object whose fields a kind can read — the half of a params
13630
13557
  * check every kind needs and no two kinds differ on.
@@ -13679,8 +13606,7 @@ function describe(value) {
13679
13606
  if (Array.isArray(value)) return "an array";
13680
13607
  return `a ${typeof value} (${JSON.stringify(value) ?? String(value)})`;
13681
13608
  }
13682
- //#endregion
13683
- //#region ../node_modules/.pnpm/@platforma-sdk+block-kind@1.1.0/node_modules/@platforma-sdk/block-kind/dist/index.js
13609
+ // ../node_modules/.pnpm/@platforma-sdk+block-kind@1.1.1/node_modules/@platforma-sdk/block-kind/dist/index.js
13684
13610
  /**
13685
13611
  * Define a block kind.
13686
13612
  *
@@ -13713,8 +13639,7 @@ function defineBlockKind(meta) {
13713
13639
  parseInitializationParams: meta.parseInitializationParams
13714
13640
  });
13715
13641
  }
13716
- //#endregion
13717
- //#region ../kind/dist/params.js
13642
+ // ../kind/dist/params.js
13718
13643
  /**
13719
13644
  * The contract at runtime, for params that arrive from a template file rather
13720
13645
  * than from typed code.
@@ -13798,26 +13723,22 @@ const CONTRACT = {
13798
13723
  limitInput: check(isInteger, "an integer"),
13799
13724
  perProcessMemGB: check(isInteger, "an integer"),
13800
13725
  perProcessCPUs: check(isInteger, "an integer"),
13801
- defaultBlockLabel: check(isString, "a string"),
13802
13726
  customBlockLabel: check(isString, "a string"),
13803
13727
  title: check(isString, "a string")
13804
13728
  };
13805
- //#endregion
13806
- //#region ../kind/dist/index.js
13729
+ // ../kind/dist/index.js
13807
13730
  const kind = defineBlockKind({
13808
13731
  name,
13809
13732
  version,
13810
13733
  parseInitializationParams
13811
13734
  });
13812
- //#endregion
13813
- //#region ../model/dist/index.js
13735
+ // ../model/dist/index.js
13814
13736
  const dataModel = new DataModelBuilder({ kind }).from("v1").upgradeLegacy(({ args, uiState }) => ({
13815
13737
  ...args,
13816
13738
  tableState: uiState.tableState,
13817
13739
  runMode: (args.limitInput ?? 0) > 0 ? "dry" : "full"
13818
- })).init(({ params }) => ({
13740
+ })).migrate("v2", ({ defaultBlockLabel: _, ...rest }) => rest).init(({ params }) => ({
13819
13741
  ...params,
13820
- defaultBlockLabel: params?.defaultBlockLabel ?? "",
13821
13742
  customBlockLabel: params?.customBlockLabel ?? "",
13822
13743
  chains: params?.chains ?? [
13823
13744
  "IG",
@@ -13829,32 +13750,55 @@ const dataModel = new DataModelBuilder({ kind }).from("v1").upgradeLegacy(({ arg
13829
13750
  runMode: params?.runMode ?? "full"
13830
13751
  }));
13831
13752
  /**
13753
+ * The input field `field` of `map`, or undefined while it is unset or when it carries an error.
13754
+ * A step that failed, or the steps that never ran after it, must not hide the logs of the others.
13755
+ */
13756
+ function resolveUnlessErrored(map, field) {
13757
+ try {
13758
+ return map.resolve({
13759
+ field,
13760
+ assertFieldType: "Input"
13761
+ });
13762
+ } catch {
13763
+ return;
13764
+ }
13765
+ }
13766
+ /**
13832
13767
  * Reads the per-sample `logs` column. A sample's value is one log stream, or a map of streams
13833
- * keyed by MiXCR step for a run split into one command per step. Entries are keyed [sampleId]
13834
- * or [sampleId, step].
13768
+ * keyed by MiXCR step for a run split into one command per step. A run that waits for the align
13769
+ * report nests the map of the later steps as one entry of that map; it is flattened here.
13770
+ * Entries are keyed [sampleId] or [sampleId, step].
13835
13771
  */
13836
13772
  function parseSampleLogs(acc, parse) {
13837
13773
  if (acc === void 0) return void 0;
13838
13774
  const data = [];
13775
+ const addSteps = (steps, prefix) => {
13776
+ let complete = steps.getInputsLocked();
13777
+ for (const stepKey of steps.listInputFields()) {
13778
+ const step = resolveUnlessErrored(steps, stepKey);
13779
+ if (step === void 0) complete = false;
13780
+ else if (step.resourceType.name === "PColumnData/ResourceMap") complete = addSteps(step, prefix) && complete;
13781
+ else {
13782
+ const value = parse(step);
13783
+ if (value === void 0 || value === null) complete = false;
13784
+ else data.push({
13785
+ key: [...prefix, ...JSON.parse(stepKey)],
13786
+ value
13787
+ });
13788
+ }
13789
+ }
13790
+ return complete;
13791
+ };
13839
13792
  let isComplete = acc.getInputsLocked();
13840
13793
  for (const sampleKey of acc.listInputFields()) {
13841
- const sample = acc.resolve({
13842
- field: sampleKey,
13843
- assertFieldType: "Input"
13844
- });
13794
+ const sample = resolveUnlessErrored(acc, sampleKey);
13845
13795
  if (sample === void 0) {
13846
13796
  isComplete = false;
13847
13797
  continue;
13848
13798
  }
13849
13799
  const key = JSON.parse(sampleKey);
13850
- if (sample.resourceType.name === "PColumnData/ResourceMap") {
13851
- const steps = parseResourceMap(sample, parse, false);
13852
- isComplete &&= steps.isComplete;
13853
- for (const step of steps.data) data.push({
13854
- key: [...key, ...step.key],
13855
- value: step.value
13856
- });
13857
- } else {
13800
+ if (sample.resourceType.name === "PColumnData/ResourceMap") isComplete = addSteps(sample, key) && isComplete;
13801
+ else {
13858
13802
  const value = parse(sample);
13859
13803
  if (value === void 0 || value === null) isComplete = false;
13860
13804
  else data.push({
@@ -13898,7 +13842,6 @@ const platforma$1 = BlockModelV3.create({
13898
13842
  limitInput: data.limitInput,
13899
13843
  perProcessMemGB: data.perProcessMemGB,
13900
13844
  perProcessCPUs: data.perProcessCPUs,
13901
- defaultBlockLabel: data.defaultBlockLabel,
13902
13845
  customBlockLabel: data.customBlockLabel,
13903
13846
  title: data.title
13904
13847
  })).prerunArgs((data) => ({
@@ -13921,7 +13864,6 @@ const platforma$1 = BlockModelV3.create({
13921
13864
  if (!BlockArgsValid.safeParse(data).success) return void 0;
13922
13865
  const builtIn = data.preset.type === "name";
13923
13866
  return {
13924
- defaultBlockLabel: data.defaultBlockLabel ?? "",
13925
13867
  customBlockLabel: data.customBlockLabel ?? "",
13926
13868
  input: data.input,
13927
13869
  preset: data.preset,
@@ -14070,7 +14012,7 @@ const platforma$1 = BlockModelV3.create({
14070
14012
  href: "/qc-report-table",
14071
14013
  label: "QC Report Table"
14072
14014
  }];
14073
- }).title(() => "MiXCR Clonotyping").subtitle((ctx) => ctx.data.customBlockLabel || ctx.data.defaultBlockLabel || "").done();
14015
+ }).title(() => "MiXCR Clonotyping").subtitle((ctx) => ctx.data.customBlockLabel || [ctx.data.title, labelFromParams(ctx.data)].filter(Boolean).join(" - ")).done();
14074
14016
  /** `parseResourceMap` needs the accessor arm of the column-data union. */
14075
14017
  function asAccessor(data) {
14076
14018
  return data instanceof TreeNodeAccessor ? data : void 0;
@@ -14088,8 +14030,11 @@ function portablePreset(preset) {
14088
14030
  file
14089
14031
  };
14090
14032
  }
14091
- //#endregion
14092
- //#region src/index.ts
14033
+ /** Settings part of the subtitle: the chosen receptors and chains. */
14034
+ function labelFromParams(data) {
14035
+ return (data.chains ?? []).join(", ");
14036
+ }
14037
+ // src/index.ts
14093
14038
  const selfUrl = import.meta.url;
14094
14039
  const dirUrl = selfUrl.slice(0, selfUrl.lastIndexOf("/"));
14095
14040
  const rootUrl = dirUrl.slice(0, dirUrl.lastIndexOf("/"));
@@ -14099,7 +14044,6 @@ const BlockPointer = {
14099
14044
  rootUrl
14100
14045
  };
14101
14046
  const MixcrClonotyping2BlockPointer = BlockPointer;
14102
- //#endregion
14103
14047
  export { BlockPointer, MixcrClonotyping2BlockPointer, platforma$1 as platforma };
14104
14048
 
14105
14049
  //# sourceMappingURL=index.js.map