@platforma-open/milaboratories.generation-probability.block 1.2.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
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.1/node_modules/@platforma-sdk/model/dist/plugin_handle.js
2
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/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
8
  //#endregion
9
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/block_storage.js
9
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/block_storage.js
10
10
  /**
11
11
  * Discriminator key for BlockStorage format detection.
12
12
  * This unique hash-based key identifies data as BlockStorage vs legacy formats.
@@ -4651,6 +4651,10 @@ function isGlobalPObjectKey(value) {
4651
4651
  if (typeof value !== "object" || value === null) return false;
4652
4652
  return "__isRef" in value && "blockId" in value && "name" in value;
4653
4653
  }
4654
+ function isGlobalPObjectId(value) {
4655
+ if (typeof value !== "string") return false;
4656
+ return isGlobalPObjectKey(parseJsonSafely(value));
4657
+ }
4654
4658
  function isPObject(obj) {
4655
4659
  return typeof obj === "object" && obj !== null && "id" in obj && "spec" in obj && "data" in obj;
4656
4660
  }
@@ -5644,6 +5648,51 @@ function legacyColumnSelectorsToPredicate(predicateOrSelectors) {
5644
5648
  if (Array.isArray(predicateOrSelectors)) return (spec) => predicateOrSelectors.some((selector) => isPColumnSpec(spec) && matchPColumn(spec, selector));
5645
5649
  else return (spec) => isPColumnSpec(spec) && matchPColumn(spec, predicateOrSelectors);
5646
5650
  }
5651
+ function matchString(matcher, value) {
5652
+ return matcher.type === "exact" ? value === matcher.value : new RegExp(matcher.value).test(value);
5653
+ }
5654
+ function matchMatcherMap(map, target) {
5655
+ const t = target ?? {};
5656
+ for (const [key, matchers] of Object.entries(map)) {
5657
+ const v = t[key];
5658
+ if (v === void 0) return false;
5659
+ if (!matchers.some((m) => matchString(m, v))) return false;
5660
+ }
5661
+ return true;
5662
+ }
5663
+ function matchMultiAxis(selector, axis) {
5664
+ if (selector.type !== void 0 && !selector.type.includes(axis.type)) return false;
5665
+ if (selector.name !== void 0 && !selector.name.some((m) => matchString(m, axis.name))) return false;
5666
+ if (selector.domain !== void 0 && !matchMatcherMap(selector.domain, axis.domain)) return false;
5667
+ if (selector.contextDomain !== void 0 && !matchMatcherMap(selector.contextDomain, axis.contextDomain)) return false;
5668
+ return true;
5669
+ }
5670
+ /** Match a {@link PColumnSpec} against a {@link MultiColumnSelector}. */
5671
+ function matchMultiColumnSelector(spec, selector) {
5672
+ if (selector.type !== void 0 && !selector.type.includes(spec.valueType)) return false;
5673
+ if (selector.name !== void 0 && !selector.name.some((m) => matchString(m, spec.name))) return false;
5674
+ if (selector.domain !== void 0 && !matchMatcherMap(selector.domain, spec.domain)) return false;
5675
+ if (selector.contextDomain !== void 0 && !matchMatcherMap(selector.contextDomain, spec.contextDomain)) return false;
5676
+ if (selector.annotations !== void 0 && !matchMatcherMap(selector.annotations, spec.annotations)) return false;
5677
+ if (selector.axes !== void 0) {
5678
+ const columnAxes = spec.axesSpec.map(getAxisId);
5679
+ if (selector.partialAxesMatch ?? true) {
5680
+ for (const axisSelector of selector.axes) if (!columnAxes.some((axis) => matchMultiAxis(axisSelector, axis))) return false;
5681
+ } else {
5682
+ if (columnAxes.length !== selector.axes.length) return false;
5683
+ for (let i = 0; i < selector.axes.length; i++) if (!matchMultiAxis(selector.axes[i], columnAxes[i])) return false;
5684
+ }
5685
+ }
5686
+ return true;
5687
+ }
5688
+ /**
5689
+ * Convert a {@link MultiColumnSelector} (or array; selectors OR-ed) to a predicate.
5690
+ * Non-PColumn specs always return false.
5691
+ */
5692
+ function multiColumnSelectorsToPredicate(selectors) {
5693
+ const arr = Array.isArray(selectors) ? selectors : [selectors];
5694
+ return (spec) => isPColumnSpec(spec) && arr.some((sel) => matchMultiColumnSelector(spec, sel));
5695
+ }
5647
5696
  //#endregion
5648
5697
  //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.51.0/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/native_id.js
5649
5698
  function deriveNativeId(spec) {
@@ -5877,6 +5926,19 @@ function withEnrichments(ref, requireEnrichments = true) {
5877
5926
  return rest;
5878
5927
  }
5879
5928
  }
5929
+ function createEnrichmentRef(hit, options = {}) {
5930
+ const { path, qualifications } = options;
5931
+ return {
5932
+ __isEnrichment: "v1",
5933
+ hit,
5934
+ ...path !== void 0 && path.length > 0 ? { path } : {},
5935
+ ...qualifications !== void 0 && qualifications.length > 0 ? { qualifications } : {}
5936
+ };
5937
+ }
5938
+ /** Compare two PlRefs and returns true if they are qual */
5939
+ function plRefsEqual(ref1, ref2, ignoreEnrichments = false) {
5940
+ return ref1.blockId === ref2.blockId && ref1.name === ref2.name && (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments);
5941
+ }
5880
5942
  //#endregion
5881
5943
  //#region ../node_modules/.pnpm/@milaboratories+pl-model-common@1.51.0/node_modules/@milaboratories/pl-model-common/dist/value_or_error.js
5882
5944
  function mapValueInVOE(voe, cb) {
@@ -6444,7 +6506,7 @@ function relocateBlockIds(params, blockIds) {
6444
6506
  return walk(params);
6445
6507
  }
6446
6508
  //#endregion
6447
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/block_migrations.js
6509
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/block_migrations.js
6448
6510
  /** Create a DataVersioned wrapper with correct shape */
6449
6511
  function makeVersionedData(version, data) {
6450
6512
  return {
@@ -7022,7 +7084,7 @@ var DataModel = class DataModel {
7022
7084
  }
7023
7085
  };
7024
7086
  //#endregion
7025
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/internal.js
7087
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/internal.js
7026
7088
  /** Utility code helping to identify whether the code is running in actual UI environment */
7027
7089
  function isInUI() {
7028
7090
  return typeof globalThis.getPlatforma !== "undefined" || typeof globalThis.platforma !== "undefined";
@@ -7092,7 +7154,7 @@ function registerFutureAwait(handle, onResolve) {
7092
7154
  futureResolves.get(handle).push(onResolve);
7093
7155
  }
7094
7156
  //#endregion
7095
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/block_storage_facade.js
7157
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/block_storage_facade.js
7096
7158
  /**
7097
7159
  * All facade callback names as constants.
7098
7160
  * These are the source of truth - the interface is derived from these.
@@ -7130,7 +7192,7 @@ function registerFacadeCallbacks(callbacks) {
7130
7192
  for (const key of Object.values(BlockStorageFacadeCallbacks)) tryRegisterCallback(key, callbacks[key]);
7131
7193
  }
7132
7194
  //#endregion
7133
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/services/block_services.js
7195
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/services/block_services.js
7134
7196
  /**
7135
7197
  * Services required by all V3 blocks by default.
7136
7198
  * Edit this when a new service should be available to all blocks.
@@ -7146,7 +7208,7 @@ const BLOCK_SERVICE_FLAGS = {
7146
7208
  };
7147
7209
  resolveRequiredServices(BLOCK_SERVICE_FLAGS);
7148
7210
  //#endregion
7149
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/future.js
7211
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/future.js
7150
7212
  var FutureRef = class FutureRef {
7151
7213
  handle;
7152
7214
  postProcess;
@@ -7174,7 +7236,7 @@ var FutureRef = class FutureRef {
7174
7236
  }
7175
7237
  };
7176
7238
  //#endregion
7177
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/accessor.js
7239
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/accessor.js
7178
7240
  function ifDef(value, cb) {
7179
7241
  return value === void 0 ? void 0 : cb(value);
7180
7242
  }
@@ -7424,11 +7486,11 @@ var TreeNodeAccessor = class TreeNodeAccessor {
7424
7486
  }
7425
7487
  };
7426
7488
  //#endregion
7427
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/internal.js
7489
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/internal.js
7428
7490
  const MainAccessorName = "main";
7429
7491
  const StagingAccessorName = "staging";
7430
7492
  //#endregion
7431
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/util/axis_filtering.js
7493
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/util/axis_filtering.js
7432
7494
  function filterDataInfoEntries(dataInfoEntries, axisFilters) {
7433
7495
  const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
7434
7496
  const { type } = dataInfoEntries;
@@ -7492,7 +7554,7 @@ function filterDataInfoEntries(dataInfoEntries, axisFilters) {
7492
7554
  }
7493
7555
  }
7494
7556
  //#endregion
7495
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/labels/linked_column_postfix.js
7557
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/labels/linked_column_postfix.js
7496
7558
  /**
7497
7559
  * Structural postfix derivation for linked columns (phase 2 of `deriveDistinctLabels`).
7498
7560
  *
@@ -7675,7 +7737,7 @@ function derivePostfixes(entries, format = defaultLinkerFormatter) {
7675
7737
  });
7676
7738
  }
7677
7739
  //#endregion
7678
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/labels/derive_distinct_labels.js
7740
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/labels/derive_distinct_labels.js
7679
7741
  const DISTANCE_PENALTY = .001;
7680
7742
  const LABEL_TYPE = "__LABEL__";
7681
7743
  const LABEL_TYPE_FULL = "__LABEL__@1";
@@ -7963,7 +8025,7 @@ function repairBareByPresence(labels, minimized, records, stats, forcedSet, forc
7963
8025
  return patched;
7964
8026
  }
7965
8027
  //#endregion
7966
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/util/label.js
8028
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/util/label.js
7967
8029
  /** @deprecated Use deriveDistinctLabels */
7968
8030
  function deriveLabels(values, getSpec, options = {}) {
7969
8031
  return deriveDistinctLabels(values.map(getSpec), options).map((label, i) => ({
@@ -7972,7 +8034,7 @@ function deriveLabels(values, getSpec, options = {}) {
7972
8034
  }));
7973
8035
  }
7974
8036
  //#endregion
7975
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/util/pcolumn_data.js
8037
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/util/pcolumn_data.js
7976
8038
  const RT_RESOURCE_MAP = "PColumnData/ResourceMap";
7977
8039
  const RT_RESOURCE_MAP_PARTITIONED = "PColumnData/Partitioned/ResourceMap";
7978
8040
  const RT_JSON_PARTITIONED = "PColumnData/JsonPartitioned";
@@ -8270,7 +8332,7 @@ function allPColumnsReady(columns) {
8270
8332
  return columns.every(isPColumnReady);
8271
8333
  }
8272
8334
  //#endregion
8273
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/util/column_collection.js
8335
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/util/column_collection.js
8274
8336
  function isPColumnValues(value) {
8275
8337
  if (!Array.isArray(value)) return false;
8276
8338
  if (value.length === 0) return true;
@@ -8548,7 +8610,7 @@ var PColumnCollection = class {
8548
8610
  }
8549
8611
  };
8550
8612
  //#endregion
8551
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/services/service_bridge.js
8613
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/services/service_bridge.js
8552
8614
  /**
8553
8615
  * Builds a ServiceProxy from a ServiceDispatch.
8554
8616
  * Each service method call is forwarded to dispatch.callServiceMethod.
@@ -8557,7 +8619,7 @@ function createServiceProxy(dispatch) {
8557
8619
  return ((serviceId) => Object.freeze(Object.fromEntries(dispatch.getServiceMethods(serviceId).map((method) => [method, (...args) => dispatch.callServiceMethod(serviceId, method, ...args)]))));
8558
8620
  }
8559
8621
  //#endregion
8560
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/services/get_services.js
8622
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/services/get_services.js
8561
8623
  const cachedServices = /* @__PURE__ */ new WeakMap();
8562
8624
  function getService(name, deps) {
8563
8625
  const ctx = deps?.ctx ?? getCfgRenderCtx();
@@ -8571,7 +8633,7 @@ function getService(name, deps) {
8571
8633
  })();
8572
8634
  }
8573
8635
  //#endregion
8574
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/util/pframe_upgraders.js
8636
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/util/pframe_upgraders.js
8575
8637
  function patchInSetFilters(filters) {
8576
8638
  const inSetToOrEqual = (predicate) => {
8577
8639
  if (predicate.operator !== "InSet") return predicate;
@@ -8609,7 +8671,7 @@ function patchInSetFilters(filters) {
8609
8671
  return filters.map((filter) => mapFilter(filter, inSetToOrEqual));
8610
8672
  }
8611
8673
  //#endregion
8612
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/render/api.js
8674
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/render/api.js
8613
8675
  /**
8614
8676
  * Helper function to match domain objects
8615
8677
  * @param query Optional domain to match against
@@ -9058,27 +9120,27 @@ var PluginRenderCtx = class extends RenderCtxBase {
9058
9120
  }
9059
9121
  };
9060
9122
  //#endregion
9061
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/plugin_model.js
9123
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/plugin_model.js
9062
9124
  /** Internal plugin↔block handshake. `Symbol.for` (not `Symbol`) so it stays
9063
9125
  * identical across multiple `@platforma-sdk/model` copies in one process. */
9064
9126
  const CREATE_PLUGIN_MODEL = Symbol.for("@platforma-sdk/model:createPluginModel");
9065
9127
  //#endregion
9066
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/version.js
9067
- const PlatformaSDKVersion = "1.84.1";
9128
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/version.js
9129
+ const PlatformaSDKVersion = "1.84.3";
9068
9130
  //#endregion
9069
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/bconfig/types.js
9131
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/bconfig/types.js
9070
9132
  function isConfigLambda(cfgOrFh) {
9071
9133
  return cfgOrFh.__renderLambda === true;
9072
9134
  }
9073
9135
  //#endregion
9074
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/bconfig/normalization.js
9136
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/bconfig/normalization.js
9075
9137
  function downgradeCfgOrLambda(data) {
9076
9138
  if (data === void 0) return void 0;
9077
9139
  if (isConfigLambda(data)) return data.handle;
9078
9140
  return data;
9079
9141
  }
9080
9142
  //#endregion
9081
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/block_storage_callbacks.js
9143
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/block_storage_callbacks.js
9082
9144
  /**
9083
9145
  * BlockStorage Callback Implementations - wired to facade callbacks in BlockModelV3.done().
9084
9146
  *
@@ -9432,7 +9494,7 @@ function deriveTemplateParamsFromStorage(storageJson, deriveTemplateParams) {
9432
9494
  }
9433
9495
  }
9434
9496
  //#endregion
9435
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/block_model.js
9497
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/block_model.js
9436
9498
  /**
9437
9499
  * Merges two feature flag objects with type-aware logic:
9438
9500
  * - `supports*` (boolean): OR — `true` if either side is `true`
@@ -9798,7 +9860,7 @@ var BlockModelV3 = class BlockModelV3 {
9798
9860
  }
9799
9861
  };
9800
9862
  //#endregion
9801
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/pframe_utils/axes.js
9863
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/pframe_utils/axes.js
9802
9864
  /** Create id for column copy with added keys in axes domains */
9803
9865
  const colId = (id, domains, contextDomains) => {
9804
9866
  let wid = id.toString();
@@ -9904,7 +9966,7 @@ function getAdditionalColumnsForColumn(blockAxes, column) {
9904
9966
  })];
9905
9967
  }
9906
9968
  //#endregion
9907
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column_recipes/leaf_rebrand.js
9969
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column_recipes/leaf_rebrand.js
9908
9970
  /**
9909
9971
  * Replace every column leaf whose id equals `fromId` with `toId`, leaving
9910
9972
  * other column refs (linkers, sub-anchors) intact. Wrapper recipes
@@ -10572,7 +10634,7 @@ var U = class d {
10572
10634
  }
10573
10635
  };
10574
10636
  //#endregion
10575
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column_providers/providers.js
10637
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column_providers/providers.js
10576
10638
  /**
10577
10639
  * Unified memoised factory dispatching to the right provider flavour by the
10578
10640
  * source shape:
@@ -10661,7 +10723,7 @@ function hashRawPool(rawPool) {
10661
10723
  return rawPool.map((b) => `${b.blockId}\x1f${b.prodCtx ?? ""}\x1f${b.stagingCtx ?? ""}\x1f${b.prodIncomplete ? 1 : 0}\x1f${b.stagingIncomplete ? 1 : 0}`).join("");
10662
10724
  }
10663
10725
  //#endregion
10664
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column_providers/index.js
10726
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column_providers/index.js
10665
10727
  /**
10666
10728
  * Build the default set of ColumnsProviders for the ambient render ctx:
10667
10729
  * - `AccessorColumnsProvider` over `outputs` (if present)
@@ -10696,7 +10758,7 @@ function isColumnProvider(source) {
10696
10758
  return typeof p.getColumns === "function" && typeof p.isFinal === "function";
10697
10759
  }
10698
10760
  //#endregion
10699
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/data_column.js
10761
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/data_column.js
10700
10762
  /**
10701
10763
  * Thrown by leaf-recipe factories when the requested column is provably
10702
10764
  * absent in the active render ctx — i.e. every relevant accessor reports
@@ -10936,7 +10998,7 @@ function memoizeByEntry(fn) {
10936
10998
  };
10937
10999
  }
10938
11000
  //#endregion
10939
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_overrided_recipe.js
11001
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_overrided_recipe.js
10940
11002
  /**
10941
11003
  * Recipe wrapper that overlays {@link SpecOverrides} on top of any other
10942
11004
  * recipe. The id is `ColumnOverriddenKey { source: inner.id, specOverrides }`.
@@ -11074,7 +11136,7 @@ var DataColumnOverriddenRecipe = class extends ColumnOverriddenRecipe {
11074
11136
  }
11075
11137
  };
11076
11138
  //#endregion
11077
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_filtered_recipe.js
11139
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_filtered_recipe.js
11078
11140
  /**
11079
11141
  * Recipe wrapper that fixes the values of selected axes of an inner recipe
11080
11142
  * (axis slicing). The id is `FilteredPColumnId { source: inner.id,
@@ -11200,7 +11262,7 @@ function toAxisSelector(axis) {
11200
11262
  return selector;
11201
11263
  }
11202
11264
  //#endregion
11203
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column_recipes/index.js
11265
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column_recipes/index.js
11204
11266
  /**
11205
11267
  * Build a `ColumnRecipe` from a stringified id. Dispatches to the matching
11206
11268
  * concrete recipe variant based on the id's encoding and recurses on
@@ -11251,7 +11313,7 @@ function ColumnRecipeGetStatus(id, opts = {}) {
11251
11313
  }
11252
11314
  const ColumnRecipe = Object.assign(ColumnRecipeBuild, { getStatus: ColumnRecipeGetStatus });
11253
11315
  //#endregion
11254
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_discovered_recipe.js
11316
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column_recipes/column_discovered_recipe.js
11255
11317
  /**
11256
11318
  * Recipe for columns identified by a {@link ColumnDiscoveredKey}: a base
11257
11319
  * column + a `path` of linkers + qualifications.
@@ -11422,7 +11484,7 @@ function referencedUniIdsOf(key) {
11422
11484
  return /* @__PURE__ */ new Set([key.column, ...(key.path ?? []).map((item) => item.column)]);
11423
11485
  }
11424
11486
  //#endregion
11425
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/column.js
11487
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/column.js
11426
11488
  /**
11427
11489
  * Unified entry point — routes between the two top-level dispatchers:
11428
11490
  * - string id (`PObjectId` / `ColumnUniversalId`) → {@link ColumnRecipe}
@@ -11436,7 +11498,7 @@ function Column(source, opts) {
11436
11498
  return DataColumn(source, opts);
11437
11499
  }
11438
11500
  //#endregion
11439
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/columns_collection.js
11501
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/columns_collection.js
11440
11502
  /**
11441
11503
  * Build a {@link ColumnsCollection} from sandbox-side source descriptors.
11442
11504
  * Resolves the `columnsCollection` driver (either from `deps.driver` or via
@@ -11548,7 +11610,7 @@ function defaultCtxSources(ctx) {
11548
11610
  return [...currentBlockSources(ctx), { kind: "result_pool" }];
11549
11611
  }
11550
11612
  //#endregion
11551
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/columns/utils.js
11613
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/columns/utils.js
11552
11614
  /**
11553
11615
  * PObjectIds of every non-hit column referenced by `recipe.getQuery()`,
11554
11616
  * deduped in traversal order. The hit column is
@@ -11695,7 +11757,7 @@ function deriveColumnOptions(source, labelOptions = {}) {
11695
11757
  }));
11696
11758
  }
11697
11759
  //#endregion
11698
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/pframe_utils/columns.js
11760
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/pframe_utils/columns.js
11699
11761
  function getAllRelatedColumns(ctx, predicate) {
11700
11762
  const columns = new PColumnCollection();
11701
11763
  columns.addColumnProvider(ctx.resultPool);
@@ -11771,7 +11833,7 @@ function discoverIntegrableColumnIds(ctx, rootColumns) {
11771
11833
  }
11772
11834
  }
11773
11835
  //#endregion
11774
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/components/PFrameForGraphs.js
11836
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PFrameForGraphs.js
11775
11837
  function isHiddenFromGraphColumn(column) {
11776
11838
  return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);
11777
11839
  }
@@ -11800,7 +11862,169 @@ function createPFrameForGraphs(ctx, blockColumns) {
11800
11862
  }));
11801
11863
  }
11802
11864
  //#endregion
11803
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/filters/traverse.js
11865
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDatasetSelector/filter_discovery.js
11866
+ /**
11867
+ * Matches columns annotated `pl7.app/isSubset: "true"` whose axes ⊆ anchor axes.
11868
+ *
11869
+ * Filter-intent: only the dataset's own direct subset columns, no linker
11870
+ * traversal — so this uses `.filter()` (pins `maxHops: 0`), not `.discover()`
11871
+ * (which would default to 4 hops and surface subset columns from other,
11872
+ * linker-reachable datasets). `.filter()` still applies the default
11873
+ * `enrichment` matching mode (`allowFloatingHitAxes: false`), which enforces
11874
+ * the axes-subset constraint. See `matchingModeToConstraints()`.
11875
+ */
11876
+ function findFilterColumns(options) {
11877
+ return ColumnsCollection([...options.sources], { driver: options.driver }).filter({
11878
+ anchors: { main: options.anchorSpec },
11879
+ include: { annotations: { [Annotation.IsSubset]: "true" } }
11880
+ }).getColumns();
11881
+ }
11882
+ /**
11883
+ * Derive labeled options from filter column variants, for use in DatasetOption.filters.
11884
+ *
11885
+ * Entries whose column id has no PlRef in `refsByObjectId` are silently
11886
+ * skipped — they cannot be exposed as user-selectable options.
11887
+ */
11888
+ function filterMatchesToOptions(variants, options) {
11889
+ if (variants.length === 0) return [];
11890
+ const { refsByObjectId, datasetSpec, labelOptions } = options;
11891
+ const entries = variants.flatMap((variant) => {
11892
+ const ref = refsByObjectId.get(extractPObjectId(variant.id));
11893
+ if (ref === void 0) return [];
11894
+ return [{
11895
+ ref,
11896
+ spec: variant.getSpec(),
11897
+ linkerPath: collectLinkerColumns(variant).map((linker) => ({ spec: linker.getSpec() }))
11898
+ }];
11899
+ });
11900
+ const labels = deriveDistinctLabels([...entries, { spec: datasetSpec }], {
11901
+ ...labelOptions,
11902
+ formatters: {
11903
+ ...labelOptions?.formatters,
11904
+ native: () => void 0
11905
+ }
11906
+ });
11907
+ return entries.map(({ ref }, i) => ({
11908
+ ref,
11909
+ label: labels[i]
11910
+ }));
11911
+ }
11912
+ /** Build the `refsByObjectId` map from `ctx.resultPool.getSpecs().entries`. */
11913
+ function buildRefMap(entries) {
11914
+ return new Map(entries.map((e) => [(0, import_canonicalize.default)(e.ref), e.ref]));
11915
+ }
11916
+ //#endregion
11917
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDatasetSelector/enrichment_discovery.js
11918
+ /**
11919
+ * Linker-reached hits attached to the anchor primary. Drops zero-hop variants
11920
+ * (filters / the primary itself) and structural hits (subset, linker, label
11921
+ * columns). Narrow further with `include` selectors or a `predicate`.
11922
+ */
11923
+ function findEnrichmentColumns(options) {
11924
+ const include = options.include === void 0 ? void 0 : Array.isArray(options.include) ? options.include : [options.include];
11925
+ const columns = ColumnsCollection([...options.sources], { driver: options.driver }).discover({
11926
+ anchors: { main: options.anchorSpec },
11927
+ mode: "enrichment",
11928
+ maxHops: options.maxHops ?? 4,
11929
+ include,
11930
+ exclude: [
11931
+ { annotations: { [Annotation.IsSubset]: "true" } },
11932
+ { annotations: { [Annotation.IsLinkerColumn]: "true" } },
11933
+ { name: Annotation.Label }
11934
+ ]
11935
+ }).getColumns();
11936
+ const predicate = options.predicate;
11937
+ return columns.filter((v) => {
11938
+ if (hasSingleDataColumn(v)) return false;
11939
+ if (predicate !== void 0 && !predicate(v.getSpec())) return false;
11940
+ if (!isGlobalPObjectId(extractPObjectId(v.id))) return false;
11941
+ if (collectLinkerIds(v).some((id) => !isGlobalPObjectId(id))) return false;
11942
+ return true;
11943
+ });
11944
+ }
11945
+ /**
11946
+ * Pair each variant with a path-disambiguated label (so export headers stay
11947
+ * unique) and carry hit/linker `PObjectId`s through verbatim. Propagates
11948
+ * `qualifications.forHit`; `forQueries` is re-derived by the table builder.
11949
+ */
11950
+ function enrichmentVariantsToRefs(variants, labelOptions) {
11951
+ if (variants.length === 0) return [];
11952
+ const linkerIdsByVariant = variants.map((v) => collectLinkerIds(v));
11953
+ const hitQualsByVariant = variants.map((v) => [...hitQualifications(v)]);
11954
+ const labels = deriveDistinctLabels(variants.map((variant, i) => ({
11955
+ spec: variant.getSpec(),
11956
+ linkerPath: collectLinkerColumns(variant).map((linker) => ({ spec: linker.getSpec() })),
11957
+ qualifications: {
11958
+ forHit: hitQualsByVariant[i],
11959
+ forQueries: queriesQualifications(variant)
11960
+ }
11961
+ })), labelOptions);
11962
+ return variants.map((variant, i) => {
11963
+ const path = linkerIdsByVariant[i].length === 0 ? void 0 : linkerIdsByVariant[i].map((id) => ({
11964
+ type: "linker",
11965
+ linker: id
11966
+ }));
11967
+ return {
11968
+ ref: createEnrichmentRef(extractPObjectId(variant.id), {
11969
+ path,
11970
+ qualifications: hitQualsByVariant[i]
11971
+ }),
11972
+ label: labels[i]
11973
+ };
11974
+ });
11975
+ }
11976
+ //#endregion
11977
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDatasetSelector/build_dataset_options.js
11978
+ function toPredicate(opt) {
11979
+ if (opt === void 0) return () => true;
11980
+ return typeof opt === "function" ? opt : multiColumnSelectorsToPredicate(opt);
11981
+ }
11982
+ /**
11983
+ * Usage:
11984
+ * ```ts
11985
+ * .output("datasetOptions", (ctx) => buildDatasetOptions(ctx))
11986
+ * ```
11987
+ */
11988
+ function buildDatasetOptions(ctx, opts) {
11989
+ const primaryPredicate = toPredicate(opts?.primary);
11990
+ const filterPredicate = toPredicate(opts?.filter);
11991
+ const options = ctx.resultPool.getOptions(primaryPredicate, { refsWithEnrichments: true });
11992
+ if (options.length === 0) return [];
11993
+ const refMap = buildRefMap(ctx.resultPool.getSpecs().entries);
11994
+ const withEnrichments = opts?.withEnrichments ?? false;
11995
+ const filterSource = ColumnsProvider(ctx.ctx.getUpstreamBlockCtx());
11996
+ const enrichmentSources = withEnrichments ? getCtxProviders(ctx) : void 0;
11997
+ return options.map((primary) => {
11998
+ const datasetSpec = ctx.resultPool.getPColumnSpecByRef(primary.ref);
11999
+ if (!datasetSpec) return { primary };
12000
+ const filterMatches = findFilterColumns({
12001
+ sources: [filterSource],
12002
+ anchorSpec: datasetSpec
12003
+ }).filter((m) => filterPredicate(m.getSpec()));
12004
+ const filters = filterMatches.length === 0 ? void 0 : filterMatchesToOptions(filterMatches, {
12005
+ refsByObjectId: refMap,
12006
+ datasetSpec,
12007
+ labelOptions: opts?.labelOptions
12008
+ });
12009
+ let enrichments;
12010
+ if (enrichmentSources && withEnrichments) {
12011
+ const enrichmentVariants = findEnrichmentColumns({
12012
+ sources: enrichmentSources,
12013
+ anchorSpec: datasetSpec,
12014
+ maxHops: opts?.enrichmentMaxHops,
12015
+ ...typeof withEnrichments === "function" ? { predicate: withEnrichments } : { include: withEnrichments }
12016
+ });
12017
+ if (enrichmentVariants.length > 0) enrichments = enrichmentVariantsToRefs(enrichmentVariants, opts?.labelOptions);
12018
+ }
12019
+ return {
12020
+ primary,
12021
+ ...filters !== void 0 && filters.length > 0 ? { filters } : {},
12022
+ ...enrichments !== void 0 && enrichments.length > 0 ? { enrichments } : {}
12023
+ };
12024
+ });
12025
+ }
12026
+ //#endregion
12027
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/filters/traverse.js
11804
12028
  /**
11805
12029
  * Recursively traverses a FilterSpec tree bottom-up, applying visitor callbacks.
11806
12030
  *
@@ -11839,7 +12063,7 @@ function collectFilterSpecColumns(filter) {
11839
12063
  });
11840
12064
  }
11841
12065
  //#endregion
11842
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/filters/converters/filterToQuery.js
12066
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/filters/converters/filterToQuery.js
11843
12067
  /** Converts a QueryColumnId object into a SpecQueryExpression reference. */
11844
12068
  function resolveColumnRef(col) {
11845
12069
  return col.type === "axis" ? {
@@ -12226,7 +12450,7 @@ function isEmpty(value) {
12226
12450
  return true;
12227
12451
  }
12228
12452
  //#endregion
12229
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/filters/distill.js
12453
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/filters/distill.js
12230
12454
  /**
12231
12455
  * Strips non-FilterSpec metadata (whitelist approach) and removes
12232
12456
  * unfilled leaves (type is undefined or any required field is undefined).
@@ -12331,7 +12555,7 @@ const REQUIRED_KEYS_BY_TYPE = {
12331
12555
  greaterThanColumnOrEqual: ["column", "rhs"]
12332
12556
  };
12333
12557
  //#endregion
12334
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/components/PlDataTable/state-migration.js
12558
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDataTable/state-migration.js
12335
12559
  /** Upgrade PlDataTableStateV2 to the latest version */
12336
12560
  function upgradePlDataTableStateV2(state) {
12337
12561
  if (!state) return createPlDataTableStateV2();
@@ -12689,7 +12913,7 @@ function parseLegacyLeafColumn(s) {
12689
12913
  return parsed;
12690
12914
  }
12691
12915
  //#endregion
12692
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/utils.js
12916
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/utils.js
12693
12917
  /** Adapt a {@link ColumnRecipe} to the plain {@link RuleColumn} shape. */
12694
12918
  function toRuleColumn(col) {
12695
12919
  return {
@@ -12787,7 +13011,7 @@ function deriveAllLabels(options) {
12787
13011
  })), deriveLabelsOptions).reduce((acc, label, index) => (acc[columns[index].id] = label, acc), {});
12788
13012
  }
12789
13013
  //#endregion
12790
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js
13014
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPTableDefV3.js
12791
13015
  /**
12792
13016
  * Assemble a ptable def directly from recipes. Each secondary recipe is its own
12793
13017
  * outer-joined subtree: `getQuery()` encodes its linker chain, and its
@@ -12851,7 +13075,7 @@ function columnToJoinEntry(col, qualifications) {
12851
13075
  };
12852
13076
  }
12853
13077
  //#endregion
12854
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/components/PlDataTable/columnResolver.js
13078
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDataTable/columnResolver.js
12855
13079
  function createColumnResolver(columns) {
12856
13080
  const axisIds = [];
12857
13081
  for (const c of columns) for (const ax of c.getSpec().axesSpec) axisIds.push(getAxisId(ax));
@@ -12873,7 +13097,7 @@ function createColumnResolver(columns) {
12873
13097
  };
12874
13098
  }
12875
13099
  //#endregion
12876
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/discoverColumns.js
13100
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/discoverColumns.js
12877
13101
  /**
12878
13102
  * Discover columns from sources/anchors and split them into primary
12879
13103
  * (direct anchor hits — zero-hop, query is a bare column) and secondary
@@ -12919,7 +13143,7 @@ function discoverLabelColumns(ctx, primary) {
12919
13143
  }).getColumns();
12920
13144
  }
12921
13145
  //#endregion
12922
- //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.1/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js
13146
+ //#region ../node_modules/.pnpm/@platforma-sdk+model@1.84.3/node_modules/@platforma-sdk/model/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js
12923
13147
  function createPlDataTableV3(ctx, options) {
12924
13148
  const state = upgradePlDataTableStateV2(options.tableState);
12925
13149
  const primaryJoinType = options.primaryJoinType ?? "full";
@@ -13284,7 +13508,7 @@ const ErrorShape = objectType({
13284
13508
  //#endregion
13285
13509
  //#region ../kind/dist/package.js
13286
13510
  var name = "@platforma-open/milaboratories.generation-probability.kind";
13287
- var version = "1.0.0";
13511
+ var version = "1.1.0";
13288
13512
  //#endregion
13289
13513
  //#region ../node_modules/.pnpm/@platforma-sdk+block-kind@1.1.0/node_modules/@platforma-sdk/block-kind/dist/params.js
13290
13514
  /**
@@ -13388,11 +13612,20 @@ const SPECIES_VALUES = SPECIES_OPTIONS.map((option) => option.value);
13388
13612
  /** The same contract at runtime, for params arriving from a template file rather than typed code. */
13389
13613
  function parseInitializationParams(value) {
13390
13614
  assertParamsObject(value);
13391
- const { inputAnchor, species } = value;
13392
- if (inputAnchor !== void 0 && !isColumnUniversalId(inputAnchor)) throw new Error("'inputAnchor' must be a column id.");
13615
+ const { datasetRef, filterRef, inputAnchor, species } = value;
13616
+ if (datasetRef !== void 0 && !isPlRef(datasetRef)) throw new Error("'datasetRef' must be a reference to an upstream column.");
13617
+ if (filterRef !== void 0 && !isPlRef(filterRef)) throw new Error("'filterRef' must be a reference to an upstream column.");
13618
+ let legacyDatasetRef;
13619
+ if (inputAnchor !== void 0) {
13620
+ if (!isColumnUniversalId(inputAnchor)) throw new Error("'inputAnchor' must be a column id.");
13621
+ const parsed = JSON.parse(inputAnchor);
13622
+ if (!isPlRef(parsed)) throw new Error("'inputAnchor' must be the id of an upstream column.");
13623
+ legacyDatasetRef = parsed;
13624
+ }
13393
13625
  if (species !== void 0 && !SPECIES_VALUES.includes(species)) throw new Error(`'species' must be one of: ${SPECIES_VALUES.join(", ")}.`);
13394
13626
  return {
13395
- inputAnchor,
13627
+ datasetRef: datasetRef ?? legacyDatasetRef,
13628
+ filterRef,
13396
13629
  species
13397
13630
  };
13398
13631
  }
@@ -13409,6 +13642,13 @@ const exactly = (value) => ({
13409
13642
  type: "exact",
13410
13643
  value
13411
13644
  });
13645
+ const defaultDistributionGraphState = () => ({
13646
+ title: "Generation Probability",
13647
+ template: "bins",
13648
+ currentTab: null,
13649
+ layersSettings: { bins: { fillColor: "#99E099" } },
13650
+ axesSettings: { axisY: { scale: "log" } }
13651
+ });
13412
13652
  const ENTITY_KEY_NAMES = [
13413
13653
  "pl7.app/vdj/clonotypeKey",
13414
13654
  "pl7.app/vdj/scClonotypeKey",
@@ -13418,34 +13658,54 @@ const inputSelectors = ENTITY_KEY_NAMES.map((name) => ({
13418
13658
  axes: [{ name }],
13419
13659
  annotations: { "pl7.app/isAnchor": "true" }
13420
13660
  }));
13661
+ /**
13662
+ * A result-pool column id is the canonical JSON of its PlRef, so the two convert both ways.
13663
+ * The id form is what the workflow reads (`args.inputAnchor`) and what v1 stored, so keeping
13664
+ * it byte-identical keeps existing blocks' args unchanged.
13665
+ */
13666
+ function plRefFromColumnId(id) {
13667
+ if (id === void 0) return void 0;
13668
+ try {
13669
+ const parsed = JSON.parse(id);
13670
+ return isPlRef(parsed) ? parsed : void 0;
13671
+ } catch {
13672
+ return;
13673
+ }
13674
+ }
13675
+ const columnIdFromPlRef = (ref) => JSON.stringify({
13676
+ __isRef: true,
13677
+ blockId: ref.blockId,
13678
+ name: ref.name
13679
+ });
13421
13680
  const keyAxisOf = (spec) => spec.axesSpec.find((axis) => ENTITY_KEY_NAMES.includes(axis.name));
13422
- const dataModel = new DataModelBuilder({ kind }).from("v1").init(({ params }) => ({
13423
- inputAnchor: params?.inputAnchor,
13681
+ const dataModel = new DataModelBuilder({ kind }).from("v1").migrate("v2", ({ inputAnchor, graphStateHistogram, distributionGraphState, ...rest }) => ({
13682
+ ...rest,
13683
+ datasetRef: plRefFromColumnId(inputAnchor),
13684
+ distributionGraphState: distributionGraphState ?? graphStateHistogram ?? defaultDistributionGraphState()
13685
+ })).init(({ params }) => ({
13686
+ datasetRef: params?.datasetRef,
13687
+ filterRef: params?.filterRef,
13424
13688
  species: params?.species,
13425
13689
  datasetLabel: "",
13426
13690
  tableState: createPlDataTableStateV2(),
13427
- distributionGraphState: {
13428
- title: "Generation Probability",
13429
- template: "bins",
13430
- currentTab: null,
13431
- layersSettings: { bins: { fillColor: "#99E099" } },
13432
- axesSettings: { axisY: { scale: "log" } }
13433
- }
13691
+ distributionGraphState: defaultDistributionGraphState()
13434
13692
  }));
13435
13693
  const platforma$1 = BlockModelV3.create({
13436
13694
  dataModel,
13437
13695
  kind
13438
13696
  }).args((data) => {
13439
- if (data.inputAnchor == null) throw new Error("Input dataset is required");
13697
+ if (data.datasetRef == null) throw new Error("Input dataset is required");
13440
13698
  if (data.species == null) throw new Error("Species is required");
13441
13699
  return {
13442
- inputAnchor: data.inputAnchor,
13443
- species: data.species
13700
+ inputAnchor: columnIdFromPlRef(data.datasetRef),
13701
+ species: data.species,
13702
+ ...data.filterRef !== void 0 && { inputFilter: columnIdFromPlRef(data.filterRef) }
13444
13703
  };
13445
13704
  }).templateParams((data) => ({
13446
- inputAnchor: data.inputAnchor,
13705
+ datasetRef: data.datasetRef,
13706
+ filterRef: data.filterRef,
13447
13707
  species: data.species
13448
- })).output("inputOptions", () => {
13708
+ })).output("inputOptions", (ctx) => {
13449
13709
  const collection = ColumnsCollection(["result_pool"]).filter({ include: inputSelectors });
13450
13710
  const scorable = collection.getColumns().filter((anchor) => {
13451
13711
  const spec = anchor.getSpec();
@@ -13459,13 +13719,26 @@ const platforma$1 = BlockModelV3.create({
13459
13719
  }).isEmpty();
13460
13720
  });
13461
13721
  if (scorable.length === 0) return [];
13722
+ const withFilters = buildDatasetOptions(ctx, {
13723
+ primary: (spec) => isPColumnSpec(spec) && spec.annotations?.["pl7.app/isAnchor"] === "true" && keyAxisOf(spec) !== void 0,
13724
+ filter: (spec) => isPColumnSpec(spec) && spec.axesSpec.length === 1 && ENTITY_KEY_NAMES.includes(spec.axesSpec[0]?.name ?? "")
13725
+ }) ?? [];
13462
13726
  return deriveColumnOptions([{
13463
13727
  columns: scorable,
13464
13728
  isFinal: collection.isFinal()
13465
- }]).map(({ id, label }) => ({
13466
- value: id,
13467
- label
13468
- }));
13729
+ }]).flatMap(({ id, label }) => {
13730
+ const ref = plRefFromColumnId(id);
13731
+ if (ref === void 0) return [];
13732
+ const primary = {
13733
+ ref,
13734
+ label
13735
+ };
13736
+ const filters = withFilters.find((o) => plRefsEqual(o.primary.ref, ref, true))?.filters;
13737
+ return [filters === void 0 ? { primary } : {
13738
+ primary,
13739
+ filters
13740
+ }];
13741
+ });
13469
13742
  }).outputWithStatus("pgenTable", (ctx) => {
13470
13743
  const pgenOutput = ctx.outputs?.resolve("pgenPf");
13471
13744
  if (pgenOutput === void 0) return void 0;