{"version":3,"file":"model-parser-D3sDIRFg.cjs","sources":["../../../node_modules/lodash-es/_trimmedEndIndex.js","../../../node_modules/lodash-es/_baseTrim.js","../../../node_modules/lodash-es/toNumber.js","../../../node_modules/lodash-es/toFinite.js","../../../node_modules/lodash-es/toInteger.js","../../../node_modules/lodash-es/_baseCreate.js","../../../node_modules/lodash-es/_copyArray.js","../../../node_modules/lodash-es/_arrayEach.js","../../../node_modules/lodash-es/_baseAssignValue.js","../../../node_modules/lodash-es/_assignValue.js","../../../node_modules/lodash-es/_copyObject.js","../../../node_modules/lodash-es/_isIterateeCall.js","../../../node_modules/lodash-es/_createAssigner.js","../../../node_modules/lodash-es/_nativeKeysIn.js","../../../node_modules/lodash-es/_baseKeysIn.js","../../../node_modules/lodash-es/keysIn.js","../../../node_modules/lodash-es/_getPrototype.js","../../../node_modules/lodash-es/isPlainObject.js","../../../node_modules/lodash-es/_baseClamp.js","../../../node_modules/lodash-es/_cloneBuffer.js","../../../node_modules/lodash-es/_initCloneArray.js","../../../node_modules/lodash-es/_cloneArrayBuffer.js","../../../node_modules/lodash-es/_cloneDataView.js","../../../node_modules/lodash-es/_cloneRegExp.js","../../../node_modules/lodash-es/_cloneSymbol.js","../../../node_modules/lodash-es/_cloneTypedArray.js","../../../node_modules/lodash-es/_initCloneByTag.js","../../../node_modules/lodash-es/_initCloneObject.js","../../../node_modules/lodash-es/_baseIsMap.js","../../../node_modules/lodash-es/isMap.js","../../../node_modules/lodash-es/_baseIsSet.js","../../../node_modules/lodash-es/isSet.js","../../../node_modules/lodash-es/_baseClone.js","../../../node_modules/lodash-es/cloneDeep.js","../../../node_modules/lodash-es/_arrayAggregator.js","../../../node_modules/lodash-es/_baseAggregator.js","../../../node_modules/lodash-es/_createAggregator.js","../../../node_modules/lodash-es/_assignMergeValue.js","../../../node_modules/lodash-es/_safeGet.js","../../../node_modules/lodash-es/toPlainObject.js","../../../node_modules/lodash-es/_baseMergeDeep.js","../../../node_modules/lodash-es/_baseMerge.js","../../../node_modules/lodash-es/endsWith.js","../../../node_modules/lodash-es/groupBy.js","../../../node_modules/lodash-es/isString.js","../../../node_modules/lodash-es/_baseValues.js","../../../node_modules/lodash-es/values.js","../../../node_modules/lodash-es/includes.js","../../../node_modules/lodash-es/isBoolean.js","../../../node_modules/lodash-es/merge.js","../src/libs/model-parser/model/model.helper.ts","../src/libs/model-parser/key-property.helper.ts","../src/libs/quality/flatten-string.ts","../src/libs/model-parser/model/model.ts","../src/libs/quality/quality.controller.ts","../src/libs/model-parser/change-tracker.ts","../src/libs/model-parser/partial-update-metrics.ts","../src/libs/model-parser/reference-type-guards.ts","../src/libs/model-parser/model-parser.ts"],"sourcesContent":["/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n  var index = string.length;\n\n  while (index-- && reWhitespace.test(string.charAt(index))) {}\n  return index;\n}\n\nexport default trimmedEndIndex;\n","import trimmedEndIndex from './_trimmedEndIndex.js';\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n  return string\n    ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n    : string;\n}\n\nexport default baseTrim;\n","import baseTrim from './_baseTrim.js';\nimport isObject from './isObject.js';\nimport isSymbol from './isSymbol.js';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n  if (typeof value == 'number') {\n    return value;\n  }\n  if (isSymbol(value)) {\n    return NAN;\n  }\n  if (isObject(value)) {\n    var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n    value = isObject(other) ? (other + '') : other;\n  }\n  if (typeof value != 'string') {\n    return value === 0 ? value : +value;\n  }\n  value = baseTrim(value);\n  var isBinary = reIsBinary.test(value);\n  return (isBinary || reIsOctal.test(value))\n    ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n    : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nexport default toNumber;\n","import toNumber from './toNumber.js';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n    MAX_INTEGER = 1.7976931348623157e+308;\n\n/**\n * Converts `value` to a finite number.\n *\n * @static\n * @memberOf _\n * @since 4.12.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted number.\n * @example\n *\n * _.toFinite(3.2);\n * // => 3.2\n *\n * _.toFinite(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toFinite(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toFinite('3.2');\n * // => 3.2\n */\nfunction toFinite(value) {\n  if (!value) {\n    return value === 0 ? value : 0;\n  }\n  value = toNumber(value);\n  if (value === INFINITY || value === -INFINITY) {\n    var sign = (value < 0 ? -1 : 1);\n    return sign * MAX_INTEGER;\n  }\n  return value === value ? value : 0;\n}\n\nexport default toFinite;\n","import toFinite from './toFinite.js';\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This method is loosely based on\n * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3.2);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3.2');\n * // => 3\n */\nfunction toInteger(value) {\n  var result = toFinite(value),\n      remainder = result % 1;\n\n  return result === result ? (remainder ? result - remainder : result) : 0;\n}\n\nexport default toInteger;\n","import isObject from './isObject.js';\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n  function object() {}\n  return function(proto) {\n    if (!isObject(proto)) {\n      return {};\n    }\n    if (objectCreate) {\n      return objectCreate(proto);\n    }\n    object.prototype = proto;\n    var result = new object;\n    object.prototype = undefined;\n    return result;\n  };\n}());\n\nexport default baseCreate;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n  var index = -1,\n      length = source.length;\n\n  array || (array = Array(length));\n  while (++index < length) {\n    array[index] = source[index];\n  }\n  return array;\n}\n\nexport default copyArray;\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n  var index = -1,\n      length = array == null ? 0 : array.length;\n\n  while (++index < length) {\n    if (iteratee(array[index], index, array) === false) {\n      break;\n    }\n  }\n  return array;\n}\n\nexport default arrayEach;\n","import defineProperty from './_defineProperty.js';\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n  if (key == '__proto__' && defineProperty) {\n    defineProperty(object, key, {\n      'configurable': true,\n      'enumerable': true,\n      'value': value,\n      'writable': true\n    });\n  } else {\n    object[key] = value;\n  }\n}\n\nexport default baseAssignValue;\n","import baseAssignValue from './_baseAssignValue.js';\nimport eq from './eq.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n  var objValue = object[key];\n  if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n      (value === undefined && !(key in object))) {\n    baseAssignValue(object, key, value);\n  }\n}\n\nexport default assignValue;\n","import assignValue from './_assignValue.js';\nimport baseAssignValue from './_baseAssignValue.js';\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n  var isNew = !object;\n  object || (object = {});\n\n  var index = -1,\n      length = props.length;\n\n  while (++index < length) {\n    var key = props[index];\n\n    var newValue = customizer\n      ? customizer(object[key], source[key], key, object, source)\n      : undefined;\n\n    if (newValue === undefined) {\n      newValue = source[key];\n    }\n    if (isNew) {\n      baseAssignValue(object, key, newValue);\n    } else {\n      assignValue(object, key, newValue);\n    }\n  }\n  return object;\n}\n\nexport default copyObject;\n","import eq from './eq.js';\nimport isArrayLike from './isArrayLike.js';\nimport isIndex from './_isIndex.js';\nimport isObject from './isObject.js';\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n *  else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n  if (!isObject(object)) {\n    return false;\n  }\n  var type = typeof index;\n  if (type == 'number'\n        ? (isArrayLike(object) && isIndex(index, object.length))\n        : (type == 'string' && index in object)\n      ) {\n    return eq(object[index], value);\n  }\n  return false;\n}\n\nexport default isIterateeCall;\n","import baseRest from './_baseRest.js';\nimport isIterateeCall from './_isIterateeCall.js';\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n  return baseRest(function(object, sources) {\n    var index = -1,\n        length = sources.length,\n        customizer = length > 1 ? sources[length - 1] : undefined,\n        guard = length > 2 ? sources[2] : undefined;\n\n    customizer = (assigner.length > 3 && typeof customizer == 'function')\n      ? (length--, customizer)\n      : undefined;\n\n    if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n      customizer = length < 3 ? undefined : customizer;\n      length = 1;\n    }\n    object = Object(object);\n    while (++index < length) {\n      var source = sources[index];\n      if (source) {\n        assigner(object, source, index, customizer);\n      }\n    }\n    return object;\n  });\n}\n\nexport default createAssigner;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n  var result = [];\n  if (object != null) {\n    for (var key in Object(object)) {\n      result.push(key);\n    }\n  }\n  return result;\n}\n\nexport default nativeKeysIn;\n","import isObject from './isObject.js';\nimport isPrototype from './_isPrototype.js';\nimport nativeKeysIn from './_nativeKeysIn.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n  if (!isObject(object)) {\n    return nativeKeysIn(object);\n  }\n  var isProto = isPrototype(object),\n      result = [];\n\n  for (var key in object) {\n    if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n      result.push(key);\n    }\n  }\n  return result;\n}\n\nexport default baseKeysIn;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeysIn from './_baseKeysIn.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n *   this.a = 1;\n *   this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n  return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nexport default keysIn;\n","import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n    objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n *   this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n  if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n    return false;\n  }\n  var proto = getPrototype(value);\n  if (proto === null) {\n    return true;\n  }\n  var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n  return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n    funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n","/**\n * The base implementation of `_.clamp` which doesn't coerce arguments.\n *\n * @private\n * @param {number} number The number to clamp.\n * @param {number} [lower] The lower bound.\n * @param {number} upper The upper bound.\n * @returns {number} Returns the clamped number.\n */\nfunction baseClamp(number, lower, upper) {\n  if (number === number) {\n    if (upper !== undefined) {\n      number = number <= upper ? number : upper;\n    }\n    if (lower !== undefined) {\n      number = number >= lower ? number : lower;\n    }\n  }\n  return number;\n}\n\nexport default baseClamp;\n","import root from './_root.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n    allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of  `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n  if (isDeep) {\n    return buffer.slice();\n  }\n  var length = buffer.length,\n      result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n  buffer.copy(result);\n  return result;\n}\n\nexport default cloneBuffer;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n  var length = array.length,\n      result = new array.constructor(length);\n\n  // Add properties assigned by `RegExp#exec`.\n  if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n    result.index = array.index;\n    result.input = array.input;\n  }\n  return result;\n}\n\nexport default initCloneArray;\n","import Uint8Array from './_Uint8Array.js';\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n  new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n  return result;\n}\n\nexport default cloneArrayBuffer;\n","import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n  var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n  return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nexport default cloneDataView;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n  var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n  result.lastIndex = regexp.lastIndex;\n  return result;\n}\n\nexport default cloneRegExp;\n","import Symbol from './_Symbol.js';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n    symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n  return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nexport default cloneSymbol;\n","import cloneArrayBuffer from './_cloneArrayBuffer.js';\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n  var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nexport default cloneTypedArray;\n","import cloneArrayBuffer from './_cloneArrayBuffer.js';\nimport cloneDataView from './_cloneDataView.js';\nimport cloneRegExp from './_cloneRegExp.js';\nimport cloneSymbol from './_cloneSymbol.js';\nimport cloneTypedArray from './_cloneTypedArray.js';\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n    dateTag = '[object Date]',\n    mapTag = '[object Map]',\n    numberTag = '[object Number]',\n    regexpTag = '[object RegExp]',\n    setTag = '[object Set]',\n    stringTag = '[object String]',\n    symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n    dataViewTag = '[object DataView]',\n    float32Tag = '[object Float32Array]',\n    float64Tag = '[object Float64Array]',\n    int8Tag = '[object Int8Array]',\n    int16Tag = '[object Int16Array]',\n    int32Tag = '[object Int32Array]',\n    uint8Tag = '[object Uint8Array]',\n    uint8ClampedTag = '[object Uint8ClampedArray]',\n    uint16Tag = '[object Uint16Array]',\n    uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n  var Ctor = object.constructor;\n  switch (tag) {\n    case arrayBufferTag:\n      return cloneArrayBuffer(object);\n\n    case boolTag:\n    case dateTag:\n      return new Ctor(+object);\n\n    case dataViewTag:\n      return cloneDataView(object, isDeep);\n\n    case float32Tag: case float64Tag:\n    case int8Tag: case int16Tag: case int32Tag:\n    case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n      return cloneTypedArray(object, isDeep);\n\n    case mapTag:\n      return new Ctor;\n\n    case numberTag:\n    case stringTag:\n      return new Ctor(object);\n\n    case regexpTag:\n      return cloneRegExp(object);\n\n    case setTag:\n      return new Ctor;\n\n    case symbolTag:\n      return cloneSymbol(object);\n  }\n}\n\nexport default initCloneByTag;\n","import baseCreate from './_baseCreate.js';\nimport getPrototype from './_getPrototype.js';\nimport isPrototype from './_isPrototype.js';\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n  return (typeof object.constructor == 'function' && !isPrototype(object))\n    ? baseCreate(getPrototype(object))\n    : {};\n}\n\nexport default initCloneObject;\n","import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n  return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nexport default baseIsMap;\n","import baseIsMap from './_baseIsMap.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nexport default isMap;\n","import getTag from './_getTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n  return isObjectLike(value) && getTag(value) == setTag;\n}\n\nexport default baseIsSet;\n","import baseIsSet from './_baseIsSet.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nexport default isSet;\n","import Stack from './_Stack.js';\nimport arrayEach from './_arrayEach.js';\nimport assignValue from './_assignValue.js';\nimport baseAssign from './_baseAssign.js';\nimport baseAssignIn from './_baseAssignIn.js';\nimport cloneBuffer from './_cloneBuffer.js';\nimport copyArray from './_copyArray.js';\nimport copySymbols from './_copySymbols.js';\nimport copySymbolsIn from './_copySymbolsIn.js';\nimport getAllKeys from './_getAllKeys.js';\nimport getAllKeysIn from './_getAllKeysIn.js';\nimport getTag from './_getTag.js';\nimport initCloneArray from './_initCloneArray.js';\nimport initCloneByTag from './_initCloneByTag.js';\nimport initCloneObject from './_initCloneObject.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isMap from './isMap.js';\nimport isObject from './isObject.js';\nimport isSet from './isSet.js';\nimport keys from './keys.js';\nimport keysIn from './keysIn.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n    CLONE_FLAT_FLAG = 2,\n    CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n    arrayTag = '[object Array]',\n    boolTag = '[object Boolean]',\n    dateTag = '[object Date]',\n    errorTag = '[object Error]',\n    funcTag = '[object Function]',\n    genTag = '[object GeneratorFunction]',\n    mapTag = '[object Map]',\n    numberTag = '[object Number]',\n    objectTag = '[object Object]',\n    regexpTag = '[object RegExp]',\n    setTag = '[object Set]',\n    stringTag = '[object String]',\n    symbolTag = '[object Symbol]',\n    weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n    dataViewTag = '[object DataView]',\n    float32Tag = '[object Float32Array]',\n    float64Tag = '[object Float64Array]',\n    int8Tag = '[object Int8Array]',\n    int16Tag = '[object Int16Array]',\n    int32Tag = '[object Int32Array]',\n    uint8Tag = '[object Uint8Array]',\n    uint8ClampedTag = '[object Uint8ClampedArray]',\n    uint16Tag = '[object Uint16Array]',\n    uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n *  1 - Deep clone\n *  2 - Flatten inherited properties\n *  4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n  var result,\n      isDeep = bitmask & CLONE_DEEP_FLAG,\n      isFlat = bitmask & CLONE_FLAT_FLAG,\n      isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n  if (customizer) {\n    result = object ? customizer(value, key, object, stack) : customizer(value);\n  }\n  if (result !== undefined) {\n    return result;\n  }\n  if (!isObject(value)) {\n    return value;\n  }\n  var isArr = isArray(value);\n  if (isArr) {\n    result = initCloneArray(value);\n    if (!isDeep) {\n      return copyArray(value, result);\n    }\n  } else {\n    var tag = getTag(value),\n        isFunc = tag == funcTag || tag == genTag;\n\n    if (isBuffer(value)) {\n      return cloneBuffer(value, isDeep);\n    }\n    if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n      result = (isFlat || isFunc) ? {} : initCloneObject(value);\n      if (!isDeep) {\n        return isFlat\n          ? copySymbolsIn(value, baseAssignIn(result, value))\n          : copySymbols(value, baseAssign(result, value));\n      }\n    } else {\n      if (!cloneableTags[tag]) {\n        return object ? value : {};\n      }\n      result = initCloneByTag(value, tag, isDeep);\n    }\n  }\n  // Check for circular references and return its corresponding clone.\n  stack || (stack = new Stack);\n  var stacked = stack.get(value);\n  if (stacked) {\n    return stacked;\n  }\n  stack.set(value, result);\n\n  if (isSet(value)) {\n    value.forEach(function(subValue) {\n      result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n    });\n  } else if (isMap(value)) {\n    value.forEach(function(subValue, key) {\n      result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n    });\n  }\n\n  var keysFunc = isFull\n    ? (isFlat ? getAllKeysIn : getAllKeys)\n    : (isFlat ? keysIn : keys);\n\n  var props = isArr ? undefined : keysFunc(value);\n  arrayEach(props || value, function(subValue, key) {\n    if (props) {\n      key = subValue;\n      subValue = value[key];\n    }\n    // Recursively populate clone (susceptible to call stack limits).\n    assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n  });\n  return result;\n}\n\nexport default baseClone;\n","import baseClone from './_baseClone.js';\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n    CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n  return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nexport default cloneDeep;\n","/**\n * A specialized version of `baseAggregator` for arrays.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction arrayAggregator(array, setter, iteratee, accumulator) {\n  var index = -1,\n      length = array == null ? 0 : array.length;\n\n  while (++index < length) {\n    var value = array[index];\n    setter(accumulator, value, iteratee(value), array);\n  }\n  return accumulator;\n}\n\nexport default arrayAggregator;\n","import baseEach from './_baseEach.js';\n\n/**\n * Aggregates elements of `collection` on `accumulator` with keys transformed\n * by `iteratee` and values set by `setter`.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} setter The function to set `accumulator` values.\n * @param {Function} iteratee The iteratee to transform keys.\n * @param {Object} accumulator The initial aggregated object.\n * @returns {Function} Returns `accumulator`.\n */\nfunction baseAggregator(collection, setter, iteratee, accumulator) {\n  baseEach(collection, function(value, key, collection) {\n    setter(accumulator, value, iteratee(value), collection);\n  });\n  return accumulator;\n}\n\nexport default baseAggregator;\n","import arrayAggregator from './_arrayAggregator.js';\nimport baseAggregator from './_baseAggregator.js';\nimport baseIteratee from './_baseIteratee.js';\nimport isArray from './isArray.js';\n\n/**\n * Creates a function like `_.groupBy`.\n *\n * @private\n * @param {Function} setter The function to set accumulator values.\n * @param {Function} [initializer] The accumulator object initializer.\n * @returns {Function} Returns the new aggregator function.\n */\nfunction createAggregator(setter, initializer) {\n  return function(collection, iteratee) {\n    var func = isArray(collection) ? arrayAggregator : baseAggregator,\n        accumulator = initializer ? initializer() : {};\n\n    return func(collection, setter, baseIteratee(iteratee, 2), accumulator);\n  };\n}\n\nexport default createAggregator;\n","import baseAssignValue from './_baseAssignValue.js';\nimport eq from './eq.js';\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n  if ((value !== undefined && !eq(object[key], value)) ||\n      (value === undefined && !(key in object))) {\n    baseAssignValue(object, key, value);\n  }\n}\n\nexport default assignMergeValue;\n","/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n  if (key === 'constructor' && typeof object[key] === 'function') {\n    return;\n  }\n\n  if (key == '__proto__') {\n    return;\n  }\n\n  return object[key];\n}\n\nexport default safeGet;\n","import copyObject from './_copyObject.js';\nimport keysIn from './keysIn.js';\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n *   this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n  return copyObject(value, keysIn(value));\n}\n\nexport default toPlainObject;\n","import assignMergeValue from './_assignMergeValue.js';\nimport cloneBuffer from './_cloneBuffer.js';\nimport cloneTypedArray from './_cloneTypedArray.js';\nimport copyArray from './_copyArray.js';\nimport initCloneObject from './_initCloneObject.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isArrayLikeObject from './isArrayLikeObject.js';\nimport isBuffer from './isBuffer.js';\nimport isFunction from './isFunction.js';\nimport isObject from './isObject.js';\nimport isPlainObject from './isPlainObject.js';\nimport isTypedArray from './isTypedArray.js';\nimport safeGet from './_safeGet.js';\nimport toPlainObject from './toPlainObject.js';\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n *  counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n  var objValue = safeGet(object, key),\n      srcValue = safeGet(source, key),\n      stacked = stack.get(srcValue);\n\n  if (stacked) {\n    assignMergeValue(object, key, stacked);\n    return;\n  }\n  var newValue = customizer\n    ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n    : undefined;\n\n  var isCommon = newValue === undefined;\n\n  if (isCommon) {\n    var isArr = isArray(srcValue),\n        isBuff = !isArr && isBuffer(srcValue),\n        isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n    newValue = srcValue;\n    if (isArr || isBuff || isTyped) {\n      if (isArray(objValue)) {\n        newValue = objValue;\n      }\n      else if (isArrayLikeObject(objValue)) {\n        newValue = copyArray(objValue);\n      }\n      else if (isBuff) {\n        isCommon = false;\n        newValue = cloneBuffer(srcValue, true);\n      }\n      else if (isTyped) {\n        isCommon = false;\n        newValue = cloneTypedArray(srcValue, true);\n      }\n      else {\n        newValue = [];\n      }\n    }\n    else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n      newValue = objValue;\n      if (isArguments(objValue)) {\n        newValue = toPlainObject(objValue);\n      }\n      else if (!isObject(objValue) || isFunction(objValue)) {\n        newValue = initCloneObject(srcValue);\n      }\n    }\n    else {\n      isCommon = false;\n    }\n  }\n  if (isCommon) {\n    // Recursively merge objects and arrays (susceptible to call stack limits).\n    stack.set(srcValue, newValue);\n    mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n    stack['delete'](srcValue);\n  }\n  assignMergeValue(object, key, newValue);\n}\n\nexport default baseMergeDeep;\n","import Stack from './_Stack.js';\nimport assignMergeValue from './_assignMergeValue.js';\nimport baseFor from './_baseFor.js';\nimport baseMergeDeep from './_baseMergeDeep.js';\nimport isObject from './isObject.js';\nimport keysIn from './keysIn.js';\nimport safeGet from './_safeGet.js';\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n *  counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n  if (object === source) {\n    return;\n  }\n  baseFor(source, function(srcValue, key) {\n    stack || (stack = new Stack);\n    if (isObject(srcValue)) {\n      baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n    }\n    else {\n      var newValue = customizer\n        ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n        : undefined;\n\n      if (newValue === undefined) {\n        newValue = srcValue;\n      }\n      assignMergeValue(object, key, newValue);\n    }\n  }, keysIn);\n}\n\nexport default baseMerge;\n","import baseClamp from './_baseClamp.js';\nimport baseToString from './_baseToString.js';\nimport toInteger from './toInteger.js';\nimport toString from './toString.js';\n\n/**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category String\n * @param {string} [string=''] The string to inspect.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search up to.\n * @returns {boolean} Returns `true` if `string` ends with `target`,\n *  else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\nfunction endsWith(string, target, position) {\n  string = toString(string);\n  target = baseToString(target);\n\n  var length = string.length;\n  position = position === undefined\n    ? length\n    : baseClamp(toInteger(position), 0, length);\n\n  var end = position;\n  position -= target.length;\n  return position >= 0 && string.slice(position, end) == target;\n}\n\nexport default endsWith;\n","import baseAssignValue from './_baseAssignValue.js';\nimport createAggregator from './_createAggregator.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` thru `iteratee`. The order of grouped values\n * is determined by the order they occur in `collection`. The corresponding\n * value of each key is an array of elements responsible for generating the\n * key. The iteratee is invoked with one argument: (value).\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The iteratee to transform keys.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([6.1, 4.2, 6.3], Math.floor);\n * // => { '4': [4.2], '6': [6.1, 6.3] }\n *\n * // The `_.property` iteratee shorthand.\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\nvar groupBy = createAggregator(function(result, value, key) {\n  if (hasOwnProperty.call(result, key)) {\n    result[key].push(value);\n  } else {\n    baseAssignValue(result, key, [value]);\n  }\n});\n\nexport default groupBy;\n","import baseGetTag from './_baseGetTag.js';\nimport isArray from './isArray.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar stringTag = '[object String]';\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a string, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n  return typeof value == 'string' ||\n    (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);\n}\n\nexport default isString;\n","import arrayMap from './_arrayMap.js';\n\n/**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\nfunction baseValues(object, props) {\n  return arrayMap(props, function(key) {\n    return object[key];\n  });\n}\n\nexport default baseValues;\n","import baseValues from './_baseValues.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of the own enumerable string keyed property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n *   this.a = 1;\n *   this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\nfunction values(object) {\n  return object == null ? [] : baseValues(object, keys(object));\n}\n\nexport default values;\n","import baseIndexOf from './_baseIndexOf.js';\nimport isArrayLike from './isArrayLike.js';\nimport isString from './isString.js';\nimport toInteger from './toInteger.js';\nimport values from './values.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Checks if `value` is in `collection`. If `collection` is a string, it's\n * checked for a substring of `value`, otherwise\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * is used for equality comparisons. If `fromIndex` is negative, it's used as\n * the offset from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @param {*} value The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.\n * @returns {boolean} Returns `true` if `value` is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'a': 1, 'b': 2 }, 1);\n * // => true\n *\n * _.includes('abcd', 'bc');\n * // => true\n */\nfunction includes(collection, value, fromIndex, guard) {\n  collection = isArrayLike(collection) ? collection : values(collection);\n  fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;\n\n  var length = collection.length;\n  if (fromIndex < 0) {\n    fromIndex = nativeMax(length + fromIndex, 0);\n  }\n  return isString(collection)\n    ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)\n    : (!!length && baseIndexOf(collection, value, fromIndex) > -1);\n}\n\nexport default includes;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]';\n\n/**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\nfunction isBoolean(value) {\n  return value === true || value === false ||\n    (isObjectLike(value) && baseGetTag(value) == boolTag);\n}\n\nexport default isBoolean;\n","import baseMerge from './_baseMerge.js';\nimport createAssigner from './_createAssigner.js';\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n *   'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n *   'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n  baseMerge(object, source, srcIndex);\n});\n\nexport default merge;\n","import {\n  Reference,\n  Property,\n  PropertyType,\n  ReferenceType,\n  DerivedReference,\n  ResolvedReference,\n  GroupedRefeference,\n  ModelDefinition,\n  QualityAnalyzer,\n  parseTemplate,\n} from '@dcupl/common';\nimport { DcuplModel } from './model';\n\nconst getModelError = (title: string, attribute: string, description: string): QualityAnalyzer.InternalModelError => {\n  return {\n    title: title,\n    type: 'model',\n    errorGroup: 'ModelDefinitionError',\n    errorType: 'InvalidModelDefinition',\n    attribute: attribute,\n    description: description,\n  };\n};\n\n/**\n * Validates a property\n */\nexport const isValidProperty = (property: Property): QualityAnalyzer.InternalModelError | undefined => {\n  const validDatatypes: PropertyType[] = [\n    'any',\n    'Array<date>',\n    'Array<float>',\n    'Array<int>',\n    'Array<string>',\n    'boolean',\n    'date',\n    'float',\n    'int',\n    'json',\n    'string',\n  ];\n\n  if (!property.key) {\n    return getModelError('Invalid Property', property.key, 'Property key is missing');\n  }\n\n  if (!property.type || validDatatypes.indexOf(property.type) === -1) {\n    return getModelError('Invalid Property', property.key, 'Property type is invalid');\n  }\n\n  if ('derive' in property) {\n    if (!property.derive?.localReference) {\n      return getModelError('Invalid Property', property.key, 'Derived Property localReference is missing');\n    }\n\n    if (!property.derive.remoteProperty) {\n      return getModelError('Invalid Property', property.key, 'Derived Property remoteProperty is missing');\n    }\n  }\n\n  if ('expression' in property) {\n    if (typeof property.expression !== 'string') {\n      return getModelError('Invalid Property', property.key, 'Expression is invalid');\n    }\n  }\n\n  return;\n};\n\n/**\n * Validates a reference\n */\nexport const isValidReference = (reference: Reference): QualityAnalyzer.InternalModelError | undefined => {\n  const validReferenceTypes: ReferenceType[] = ['multiValued', 'singleValued'];\n\n  if (!reference.key) {\n    return getModelError('Invalid Reference', reference.key, 'Reference key is missing');\n  }\n\n  if (!reference.type || validReferenceTypes.indexOf(reference.type) === -1) {\n    return getModelError('Invalid Reference', reference.key, 'Reference type is invalid');\n  }\n\n  if (!reference.model) {\n    return getModelError('Invalid Reference', reference.key, 'Reference model is missing');\n  }\n\n  if ('derive' in reference) {\n    if (!reference.derive.localReference) {\n      return getModelError('Invalid Reference', reference.key, 'Derived Reference localReference is missing');\n    }\n\n    if (!reference.derive.remoteReference) {\n      return getModelError('Invalid Reference', reference.key, 'Derived Reference remoteReference is missing');\n    }\n  }\n\n  if ('resolve' in reference) {\n    if (!reference.resolve.reference) {\n      return getModelError('Invalid Reference', reference.key, 'Resolved Reference reference is missing');\n    }\n\n    if (!reference.resolve.model) {\n      return getModelError('Invalid Reference', reference.key, 'Resolved Reference model is missing');\n    }\n  }\n\n  if ('groupBy' in reference) {\n    if (!reference.groupBy.reference) {\n      return getModelError('Invalid Reference', reference.key, 'Grouped Reference reference is missing');\n    }\n  }\n  return;\n};\n\nexport const validateBasicModelStructure = (model: ModelDefinition): boolean => {\n  if (typeof model.key !== 'string' || model.key.length === 0) {\n    throw new Error('Invalid Model: key must be a non-empty string');\n  }\n\n  if (typeof model.keyProperty !== 'undefined') {\n    const kp = model.keyProperty;\n    const isValidString = typeof kp === 'string' && kp.length > 0;\n    const isValidArray = Array.isArray(kp) && kp.length > 0 && kp.every((p) => typeof p === 'string' && p.length > 0);\n    if (!isValidString && !isValidArray) {\n      throw new Error(\n        'Invalid Model: keyProperty must be a non-empty string or a non-empty array of non-empty strings',\n      );\n    }\n  }\n\n  if (typeof model.keyPropertySeparator !== 'undefined') {\n    if (typeof model.keyPropertySeparator !== 'string' || model.keyPropertySeparator.length === 0) {\n      throw new Error('Invalid Model: keyPropertySeparator must be a non-empty string');\n    }\n  }\n\n  if (typeof model.autoGenerateKey !== 'undefined' && typeof model.autoGenerateKey !== 'boolean') {\n    throw new Error('Invalid Model: autoGenerateKey must be a boolean');\n  }\n\n  if (typeof model.autoGenerateProperties !== 'undefined') {\n    const v = model.autoGenerateProperties;\n    if (typeof v !== 'boolean') {\n      if (typeof v !== 'object' || v === null || Array.isArray(v)) {\n        throw new Error('Invalid Model: autoGenerateProperties must be a boolean or an options object');\n      }\n      if (typeof v.deep !== 'undefined' && typeof v.deep !== 'boolean') {\n        throw new Error('Invalid Model: autoGenerateProperties.deep must be a boolean');\n      }\n      if (typeof v.sampleSize !== 'undefined') {\n        if (typeof v.sampleSize !== 'number' || !Number.isFinite(v.sampleSize) || v.sampleSize < 1) {\n          throw new Error('Invalid Model: autoGenerateProperties.sampleSize must be a positive number');\n        }\n      }\n    }\n  }\n\n  if (model.properties && !Array.isArray(model.properties)) {\n    throw new Error('Invalid Model: properties must be an array');\n  }\n\n  if (model.references && !Array.isArray(model.references)) {\n    throw new Error('Invalid Model: references must be an array');\n  }\n\n  return true;\n};\n\nexport const validateModels = (\n  model: DcuplModel<any>,\n  allModels: Map<string, DcuplModel<any>>,\n): QualityAnalyzer.InternalModelError[] => {\n  const errors: QualityAnalyzer.InternalModelError[] = [];\n\n  model.references.forEach((ref) => {\n    if (!allModels.has(ref.model)) {\n      errors.push({\n        title: 'Missing Model',\n        type: 'model',\n        errorGroup: 'ModelDefinitionError',\n        errorType: 'MissingModel',\n        attribute: ref.key,\n        model: model.key,\n        description: `Referenced model ${ref.model} does not exist`,\n      });\n    }\n\n    if ('derive' in ref) {\n      errors.push(...validateDerivedReference(ref, model, allModels));\n    }\n\n    if ('resolve' in ref) {\n      errors.push(...validateResolvedReference(ref, model, allModels));\n    }\n\n    if ('groupBy' in ref) {\n      errors.push(...validateGroupedReference(ref, model));\n    }\n  });\n\n  model.properties.forEach((prop) => {\n    if ('derive' in prop) {\n      errors.push(...validateDerivedProperty(prop, model, allModels));\n    }\n\n    if ('expression' in prop) {\n      errors.push(...validateExpressionProperty(prop, model));\n    }\n  });\n\n  return errors;\n};\n\nconst validateDerivedReference = (\n  ref: DerivedReference,\n  model: DcuplModel,\n  allModels: Map<string, DcuplModel>,\n): QualityAnalyzer.InternalModelError[] => {\n  const errors: QualityAnalyzer.InternalModelError[] = [];\n  const localRef = model.references.get(ref.derive.localReference);\n\n  if (!localRef) {\n    errors.push({\n      title: 'Missing Reference',\n      type: 'model',\n      errorGroup: 'ModelDefinitionError',\n      errorType: 'MissingReference',\n      attribute: ref.key,\n      model: model.key,\n      description: `Local Referenced ${ref.derive.localReference} does not exist in model ${model.key}`,\n    });\n    return errors;\n  }\n\n  const remoteModel = allModels.get(localRef.model);\n\n  if (remoteModel) {\n    const remoteReferenece = remoteModel.references.get(ref.derive.remoteReference);\n\n    if (!remoteReferenece) {\n      errors.push({\n        title: 'Missing Reference',\n        type: 'model',\n        errorGroup: 'ModelDefinitionError',\n        errorType: 'MissingReference',\n        attribute: ref.key,\n        model: model.key,\n        description: `Remote Reference ${ref.derive.remoteReference} does not exist in model ${remoteModel.key}`,\n      });\n    }\n  }\n\n  return errors;\n};\n\nconst validateResolvedReference = (\n  ref: ResolvedReference,\n  model: DcuplModel,\n  allModels: Map<string, DcuplModel>,\n): QualityAnalyzer.InternalModelError[] => {\n  const errors: QualityAnalyzer.InternalModelError[] = [];\n\n  const remoteModel = allModels.get(ref.resolve.model);\n\n  if (!remoteModel) {\n    errors.push({\n      title: 'Missing Model',\n      type: 'model',\n      errorGroup: 'ModelDefinitionError',\n      errorType: 'MissingModel',\n      attribute: ref.key,\n      model: model.key,\n      description: `Referenced model ${ref.model} does not exist`,\n    });\n    return errors;\n  }\n\n  const remoteReferenece = remoteModel.references.get(ref.resolve.reference);\n\n  if (!remoteReferenece) {\n    errors.push({\n      title: 'Missing Reference',\n      type: 'model',\n      errorGroup: 'ModelDefinitionError',\n      errorType: 'MissingReference',\n      attribute: ref.key,\n      model: model.key,\n      description: `Resolved Reference ${ref.resolve.reference} does not exist in model ${remoteModel.key}`,\n    });\n  }\n\n  return errors;\n};\n\nconst validateGroupedReference = (ref: GroupedRefeference, model: DcuplModel): QualityAnalyzer.InternalModelError[] => {\n  const errors: QualityAnalyzer.InternalModelError[] = [];\n\n  const remoteReferenece = model.references.get(ref.groupBy.reference);\n\n  if (!remoteReferenece) {\n    errors.push({\n      title: 'Missing Reference',\n      type: 'model',\n      errorGroup: 'ModelDefinitionError',\n      errorType: 'MissingReference',\n      attribute: ref.key,\n      model: model.key,\n      description: `Resolved Reference ${ref.groupBy.reference} does not exist in model ${model.key}`,\n    });\n  }\n\n  return errors;\n};\n\nconst validateDerivedProperty = (\n  prop: Property,\n  model: DcuplModel,\n  allModels: Map<string, DcuplModel>,\n): QualityAnalyzer.InternalModelError[] => {\n  const errors: QualityAnalyzer.InternalModelError[] = [];\n  const localRef = model.references.get(prop.derive!.localReference);\n\n  if (!localRef) {\n    errors.push({\n      title: 'Missing Reference',\n      type: 'model',\n      errorGroup: 'ModelDefinitionError',\n      errorType: 'MissingReference',\n      attribute: prop.key,\n      model: model.key,\n      description: `Local Referenced ${prop.derive!.localReference} does not exist in model ${model.key}`,\n    });\n    return errors;\n  }\n\n  const remoteModel = allModels.get(localRef.model);\n\n  if (remoteModel) {\n    if (prop.derive!.remoteProperty === 'key') {\n      return errors;\n    }\n\n    const remoteProperty = remoteModel.properties.get(prop.derive!.remoteProperty);\n\n    if (!remoteProperty) {\n      errors.push({\n        title: 'Missing Property',\n        type: 'model',\n        errorGroup: 'ModelDefinitionError',\n        errorType: 'MissingProperty',\n        attribute: prop.key,\n        model: model.key,\n        description: `Remote Property ${prop.derive!.remoteProperty} does not exist in model ${remoteModel.key}`,\n      });\n    }\n  }\n\n  return errors;\n};\n\nconst validateExpressionProperty = (prop: Property, model: DcuplModel): QualityAnalyzer.InternalModelError[] => {\n  const errors: QualityAnalyzer.InternalModelError[] = [];\n\n  const template = parseTemplate(prop.expression!);\n  template.variables.forEach((templateVar) => {\n    if (templateVar.name === 'key' || templateVar.name.endsWith('.key')) {\n      return;\n    }\n    if (!model.properties.get(templateVar.name) && !model.references.get(templateVar.name)) {\n      errors.push({\n        title: 'Unknown Expression Variable',\n        type: 'model',\n        errorGroup: 'ModelDefinitionError',\n        errorType: 'UnknownExpressionVariable',\n        attribute: prop.key,\n        model: model.key,\n        description: `Expression Variable ${templateVar.name} not found in expression ${prop.key} in ${model.key}`,\n      });\n    }\n  });\n\n  return errors;\n};\n","import { RawItem } from '@dcupl/common';\n\n/**\n * Default separator joining composite `keyProperty` parts when no override is\n * supplied at the model, container, or resource level.\n */\nexport const DEFAULT_KEY_PROPERTY_SEPARATOR = '::';\n\n/**\n * Normalize a `keyProperty` spec to an array of property names.\n *\n * Returns `[]` for `undefined`. Single-string and single-element-array forms\n * both collapse to a one-element array — callers that want to short-circuit\n * the join can check `parts.length === 1`.\n */\nexport function getKeyParts(keyProperty: string | readonly string[] | undefined): readonly string[] {\n  if (typeof keyProperty === 'string') return [keyProperty];\n  if (Array.isArray(keyProperty)) return keyProperty;\n  return [];\n}\n\n/**\n * Extract the composite key string from `item` using `keyProperty`.\n *\n * - String form: returns `String(item[keyProperty])`.\n * - Single-element array: equivalent to the string form (no separator applied).\n * - Multi-element array: joins `String(item[p])` for each part with `separator`.\n *\n * Each part is stringified via `String(value)`, so `null` → `'null'`,\n * `undefined` → `'undefined'`, `''` stays `''` — preserving data distinctions.\n * Row ingest uses `extractRowKey`, which treats a row without any key value as\n * missing instead of keying it `'undefined'`.\n */\nexport function extractKey(\n  item: RawItem,\n  keyProperty: string | readonly string[],\n  separator: string = DEFAULT_KEY_PROPERTY_SEPARATOR,\n): string {\n  if (typeof keyProperty === 'string') {\n    return String(item[keyProperty]);\n  }\n  if (keyProperty.length === 1) {\n    return String(item[keyProperty[0] as string]);\n  }\n  return keyProperty.map((p) => String(item[p])).join(separator);\n}\n\n/**\n * Extract a row's key from its `keyProperty` value(s) for ingest.\n *\n * Same as `extractKey`, but returns `undefined` when the row has no key: the\n * single key property is `undefined` or `null`, or every part of a composite\n * key is. The model drops such a row and records `MissingKey`, as for a row\n * without the default `key` (#377). A composite key with only some parts\n * missing keeps them as `'undefined'`/`'null'` parts.\n */\nexport function extractRowKey(\n  item: RawItem,\n  keyProperty: string | readonly string[],\n  separator: string = DEFAULT_KEY_PROPERTY_SEPARATOR,\n): string | undefined {\n  const isMissing = (part: string): boolean => item[part] === undefined || item[part] === null;\n  if (getKeyParts(keyProperty).every(isMissing)) {\n    return undefined;\n  }\n  return extractKey(item, keyProperty, separator);\n}\n\n/**\n * Whether a row carries a key. A row whose `key` is `undefined` or `null`\n * cannot be identified: the model drops it and records `MissingKey`.\n */\nexport function hasRowKey(row: RawItem): boolean {\n  return row.key !== undefined && row.key !== null;\n}\n\n/**\n * Render a `keyProperty` spec as a single string suitable for the `attribute`\n * field of error reports.\n *\n * - String → returned as-is.\n * - Array → joined with `separator` (e.g. `'ID::Language'`).\n * - `undefined` → `undefined`.\n *\n * Keeps the error contract a string for backward compatibility while making\n * the offending composite obvious to callers reading the error.\n */\nexport function joinKeyProperty(\n  keyProperty: string | readonly string[] | undefined,\n  separator: string = DEFAULT_KEY_PROPERTY_SEPARATOR,\n): string | undefined {\n  if (keyProperty === undefined) return undefined;\n  if (typeof keyProperty === 'string') return keyProperty;\n  return keyProperty.join(separator);\n}\n","/**\n * Returns `text` as a flat string. A string built by concatenation (template literals,\n * `replace`) is a tree of concatenated-string nodes in V8 until something reads its\n * characters; kept as an error description, every node stays in the heap (#444).\n *\n * The JSON round trip builds a fresh, flat string in every engine. Reading one character\n * (`text.charCodeAt(0)`) flattens a V8 string in place too, but the optimizer drops a call\n * whose result is unused, so that only works some of the time.\n */\nexport function flattenString(text: string): string {\n  return JSON.parse(JSON.stringify(text)) as string;\n}\n","import {\n  DataContainer,\n  Reference,\n  ReferenceDataTypes,\n  AggregatedReference,\n  DerivedReference,\n  GroupedRefeference,\n  ResolvedReference,\n  InverseIndexValuesMap,\n  ListItem,\n  ModelDefinition,\n  Property,\n  PropertyAggregate,\n  PropertyDateInputFormat,\n  ValueMappingConfig,\n  PropertyFloat,\n  PropertyDate,\n  PropertyJson,\n  PropertyInt,\n  ModelMetadata,\n  PropertyBoolean,\n  IndicesController,\n  resolveCacheMaxSize,\n  ChangeDetector,\n  getPropertiesForData,\n  getInferenceRowLimit,\n  parseBooleanString,\n  AutoGeneratePropertiesOption,\n  generateKey,\n  QualityAnalyzer,\n  PropertyString,\n  ModelQualityConfig,\n  isValidDate,\n  parseDate,\n  AttributeQualityConfig,\n  ModelAttribute,\n  isInt,\n  isFloat,\n  ValidatorErrorType,\n  evaluateTemplate,\n  QueryReference,\n  DcuplQueryBuilder,\n  PropertyStringArray,\n  PropertyIntArray,\n  PropertyDateArray,\n  PropertyFloatArray,\n  logger,\n  yieldToEventLoop,\n  RawItem,\n  DcuplGlobalQueryOptions,\n} from '@dcupl/common';\n\nimport { ModelParser } from '../';\nimport { isValidReference, isValidProperty } from './model.helper';\nimport { DEFAULT_KEY_PROPERTY_SEPARATOR, extractKey, getKeyParts, joinKeyProperty } from '../key-property.helper';\nimport { isBoolean, isObjectLike, isString, merge } from 'lodash-es';\nimport { flattenString } from '../../quality/flatten-string';\n\nexport const EntryMetadataValues = {\n  REF_VALUE: '_dcupl_ref_',\n};\n\ntype REF_VALUE = 'hit' | 'miss' | 'auto_hit';\n\ntype ResolvedReferenceObject<T extends ListItem = ListItem> = {\n  reference: ResolvedReference;\n  model: DcuplModel;\n  remoteData: T[];\n  inverseKeys?: InverseIndexValuesMap;\n};\n\nconst defaultAttributeQualityConfig: AttributeQualityConfig = {\n  required: true,\n  forceStrictDataType: false,\n  nullable: false,\n  validatorHandling: 'loose',\n};\n\n/** A zero followed by another digit: \"06112\", \"-007\", \"00\". Not \"0\", \"0.5\" or \"-0.5\". */\nconst LEADING_ZERO_DIGITS = /^[+-]?0\\d/;\n\nconst defaultQualityConfig: ModelQualityConfig = {\n  enabled: true,\n  attributes: defaultAttributeQualityConfig,\n};\n\nexport type ValidatorReturnValue = {\n  isValid: boolean;\n  type: ValidatorErrorType;\n};\n\n// Helper function to cast to writable entry (avoids TS2862 error with generic types)\nfunction asWritable<T extends ListItem>(entry: T): Record<string, unknown> {\n  return entry as unknown as Record<string, unknown>;\n}\n\n/** Whether two reference values list the same keys in the same order (null, undefined and [] differ). */\nfunction sameReferenceKeys(\n  a: ListItem | ListItem[] | null | undefined,\n  b: ListItem | ListItem[] | null | undefined,\n): boolean {\n  if (Array.isArray(a) && Array.isArray(b)) {\n    if (a.length !== b.length) return false;\n    for (let i = 0; i < a.length; i++) {\n      if (a[i]?.key !== b[i]?.key) return false;\n    }\n    return true;\n  }\n  if (Array.isArray(a) || Array.isArray(b) || !a || !b) return a === b;\n  return a.key === b.key;\n}\n\nexport class DcuplModel<ListType extends ListItem = ListItem> {\n  public properties: Map<string, Property> = new Map();\n  public references: Map<string, Reference> = new Map();\n  public attributeQualityConfigs: Map<string, AttributeQualityConfig> = new Map();\n  public key!: string;\n  private log = logger.child({ prefix: 'Model' });\n  public initialDefinition!: ModelDefinition;\n\n  private data: Map<string, ListType> = new Map();\n  // The raw rows of the items a referrer auto-created in this model, by key. They are not rows of\n  // the model's container, so a partial update that re-derives an attribute's errors for every row\n  // re-derives theirs from here (#608). Cleared with the data.\n  private autoCreatedRows: Map<string, ListType> = new Map();\n  // The containers of the items a referrer auto-created, waiting for their pass (addContainer).\n  // init() and the partial path run the passes of the items step 1 creates after every model's\n  // step 1 (#604, #619); an item created later gets its pass at the next yield.\n  private pendingAutoCreatedContainers: DataContainer<ListType>[] = [];\n  // The keys of the items a referrer auto-created in the running update() (#604)\n  private autoCreatedInUpdate: Set<string> = new Set();\n  // While the partial path runs the passes of auto-created items (#604): their basic-attribute\n  // errors wait for step 6 (reprocessItemsAutoCreatedInUpdate)\n  private inPartialAutoCreatedPass = false;\n  public supportsAutoCreation = false;\n  public autoGenerateKey = false;\n  public autoGenerateProperties = false;\n  public autoGeneratePropertiesOption: AutoGeneratePropertiesOption = false;\n  // How many rows with a key the last property inference read (undefined: none ran since the\n  // properties were set). Every attribute of the rows it read is a property (or `key`) since, so an\n  // update only has to look at the rows it changed and at the keyed rows past that count (#519).\n  // Cleared with the properties.\n  private inferredKeyedRows: number | undefined = undefined;\n  public keyProperty: string | readonly string[] = 'key';\n  public keyPropertySeparator?: string;\n  public valueMappings: ValueMappingConfig[] = [];\n  public meta?: ModelMetadata | undefined;\n  public qualityConfig: ModelQualityConfig = defaultQualityConfig;\n\n  public indicesController = new IndicesController();\n  public cdRef!: ChangeDetector;\n\n  // #120 Performance optimization: Reverse index for grouped references\n  // Maps reference key -> value -> Set of item keys that have that value\n  // Enables O(1) lookup instead of O(n·v²) nested loops\n  private groupedRefReverseIndex: Map<string, Map<string, Set<string>>> = new Map();\n\n  // #607: a singleValued derived reference over a multiValued remote reference\n  // stores its first key but is indexed under every key (as on init()). The\n  // keys it was indexed under, per reference and item, when there are several:\n  // the stored value alone cannot take the item out of the other entries.\n  private derivedReferenceIndexedKeys: Map<string, Map<string, string[]>> = new Map();\n\n  // #411: the keys of every row the running step-1 pass stores. A reference\n  // within this model resolves against them, not only against the rows stored\n  // so far: a later row, the row itself or a cycle exists as well.\n  private pendingItemKeys: Set<string> | undefined;\n\n  // #425: per reference key, the remote keys a basic reference did not find\n  // and the item(s) whose reference named them. An item inserted into the\n  // remote model re-resolves exactly these rows\n  // (ModelParser.getItemsReferencingChangedItems) instead of a scan over every\n  // row. A superset: an item that later resolved differently may stay listed.\n  // The step-1 pass over all rows appends to `pending` (remote key, item key,\n  // ...), cheap on init(); the first lookup folds it into `byRemoteKey`, where\n  // the partial path records directly, so a row resolved again is listed once.\n  // Before that lookup the partial path appends too, and folds once `pending`\n  // doubled the length it had at its first record (`foldAt`, #590): the list\n  // stays bounded and no single update pays for the fold of every init() miss.\n  private missedReferenceKeys: Map<\n    string,\n    { pending: string[]; byRemoteKey: Map<string, string | Set<string>> | undefined; foldAt: number | undefined }\n  > = new Map();\n  private missesToPending = false;\n\n  constructor(private modelParser: ModelParser) {\n    this.cdRef = modelParser.cdRef;\n    // performance.cache.maxSize bounds the indices this model builds for queries and sections (#361)\n    this.indicesController.maxContextIndexSize = resolveCacheMaxSize(modelParser.initOptions?.performance?.cache);\n    // A reference value no item holds any more can leave an auto-created item without referrers (#598)\n    this.indicesController.onValueReleased = (attributeKey, value): void =>\n      this.modelParser.noteReleasedReferenceKey(this.key, attributeKey, value);\n  }\n\n  public init(modelDefinition: ModelDefinition): void {\n    this.key = modelDefinition.key;\n    this.initialDefinition = modelDefinition;\n    if (modelDefinition.quality) {\n      this.qualityConfig = merge({}, defaultQualityConfig, modelDefinition.quality);\n    }\n  }\n\n  /**\n   * Drops what the previous definition set (attributes and their quality configs, the model's\n   * quality config), so `init` + `applyPropertiesAndReferences` build the model from a replaced\n   * definition as for a new model, while lists keep this instance (#408).\n   */\n  public resetDefinition(): void {\n    this.properties.clear();\n    this.inferredKeyedRows = undefined;\n    this.references.clear();\n    this.attributeQualityConfigs.clear();\n    this.qualityConfig = defaultQualityConfig;\n  }\n\n  public applyPropertiesAndReferences(modelDefinition: ModelDefinition): void {\n    // Track keys declared within THIS definition so a duplicate is reported\n    // rather than silently overwriting. (Checking this.properties directly would\n    // false-positive on model re-registration, where the map is not reset.)\n    const seenPropertyKeys = new Set<string>();\n    modelDefinition.properties?.map((prop) => {\n      const error = isValidProperty(prop);\n      if (!error) {\n        if (seenPropertyKeys.has(prop.key)) {\n          this.setDefinitionError({\n            title: 'Duplicate Property Key',\n            type: 'model',\n            errorGroup: 'ModelDefinitionError',\n            errorType: 'DuplicatePropertyKey',\n            description: `Model \"${this.key}\" declares property \"${prop.key}\" more than once; the first definition is kept and the duplicate is ignored.`,\n            attribute: prop.key,\n            model: this.key,\n          });\n          return;\n        }\n        seenPropertyKeys.add(prop.key);\n        this.setAttributeQualityConfig(prop);\n        this.properties.set(prop.key, prop);\n      } else {\n        error.model = this.key;\n        this.setDefinitionError(error);\n      }\n    });\n    modelDefinition.references?.map((reference) => {\n      const error = isValidReference(reference);\n      if (!error) {\n        reference.validity = reference.validity || 'loose';\n        this.setAttributeQualityConfig(reference);\n        this.references.set(reference.key, reference);\n      } else {\n        error.model = this.key;\n        this.setDefinitionError(error);\n      }\n    });\n\n    // set model defaults\n    this.supportsAutoCreation = !!modelDefinition.supportsAutoCreation;\n    this.keyProperty = modelDefinition.keyProperty || 'key';\n    this.keyPropertySeparator = modelDefinition.keyPropertySeparator;\n    this.autoGenerateKey = !!modelDefinition.autoGenerateKey;\n    this.autoGenerateProperties = !!modelDefinition.autoGenerateProperties;\n    this.autoGeneratePropertiesOption = modelDefinition.autoGenerateProperties ?? false;\n    this.valueMappings = modelDefinition.valueMappings || [];\n    this.meta = modelDefinition.meta;\n  }\n\n  private setAttributeQualityConfig(attribute: ModelAttribute): void {\n    const typeQualityConfig = this.qualityConfig.attributes;\n\n    const qualityConfig: AttributeQualityConfig = merge(\n      {},\n      defaultAttributeQualityConfig,\n      typeQualityConfig,\n      attribute.quality,\n    );\n\n    this.attributeQualityConfigs.set(attribute.key, qualityConfig);\n  }\n\n  public getModelDefinition(): ModelDefinition {\n    if (this.autoGenerateProperties) {\n      const modelDef: ModelDefinition = {\n        key: this.key,\n        keyProperty: this.keyProperty,\n        keyPropertySeparator: this.keyPropertySeparator,\n        references: Array.from(this.references.values()),\n        properties: Array.from(this.properties.values()),\n        autoGenerateKey: this.autoGenerateKey,\n        supportsAutoCreation: this.supportsAutoCreation,\n        valueMappings: this.valueMappings,\n        meta: this.meta,\n        autoGenerateProperties: this.autoGeneratePropertiesOption,\n        quality: this.qualityConfig,\n      };\n      return modelDef;\n    } else {\n      return this.initialDefinition;\n    }\n  }\n\n  /**\n   * Adds a property for every attribute that inference finds in the leading rows of `container`\n   * (one row by default, `sampleSize` or all rows when deep) and the model does not have yet.\n   * Properties the model has keep their type, so inference runs only when one of those rows names\n   * an attribute the model does not know (#503, #519).\n   *\n   * `changedItemKeys`: the items an update changed or inserted, given when it removed none. The\n   * rows with a key kept their order and, unless changed, their attributes since the last\n   * inference, so of the keyed rows the last inference read only the changed ones can name a new\n   * attribute. Rows without a key can move (a merge puts them last, init reads a lone `set` as it\n   * is) and are always read, as are the keyed rows past that count.\n   */\n  public generatePropertiesFromContainer(container: DataContainer, changedItemKeys?: ReadonlySet<string>): void {\n    const opt = this.autoGeneratePropertiesOption;\n    const options = typeof opt === 'object' && opt !== null ? opt : {};\n    const known =\n      changedItemKeys !== undefined && this.inferredKeyedRows !== undefined\n        ? { changedItemKeys, keyedRows: this.inferredKeyedRows }\n        : undefined;\n    const { unknownAttribute, keyedRows } = this.scanInferenceWindow(\n      container.data,\n      getInferenceRowLimit(options),\n      known,\n    );\n    this.inferredKeyedRows = keyedRows;\n    if (!unknownAttribute) {\n      return;\n    }\n    const properties = getPropertiesForData(container.data, options);\n    properties.map((property) => {\n      if (!this.properties.has(property.key)) {\n        // The internal 'key' field is always the item's identity string — skip it\n        // regardless of what keyProperty is named, since handleAlternativeKey always\n        // copies the keyProperty value into item.key as a string before inference runs.\n        if (property.key === 'key') {\n          return;\n        }\n\n        // The keyProperty is the item's identity — keys are strings, so never let\n        // string-aware inference coerce it to a numeric/date/boolean type.\n        // Fall back to the model's own keyProperty when the container doesn't carry it\n        // (e.g. after mergeContainers strips it).\n        const effectiveKeyProperty = container.keyProperty ?? this.keyProperty;\n        const keyParts = getKeyParts(effectiveKeyProperty);\n        if (keyParts.some((p) => p && p !== 'key' && p === property.key)) {\n          property.type = 'string';\n        }\n\n        property.filter = true;\n\n        this.properties.set(property.key, property);\n      }\n    });\n  }\n\n  /**\n   * Whether one of the first `rowLimit` rows has an attribute that is no property, and how many of\n   * them have a key. With `known`, the first `known.keyedRows` rows with a key are skipped unless\n   * they changed: the last inference read them.\n   */\n  private scanInferenceWindow(\n    data: readonly ListItem[],\n    rowLimit: number,\n    known?: { changedItemKeys: ReadonlySet<string>; keyedRows: number },\n  ): { unknownAttribute: boolean; keyedRows: number } {\n    const rowCount = Math.min(data.length, rowLimit);\n    let unknownAttribute = false;\n    let keyedRows = 0;\n    for (let i = 0; i < rowCount; i++) {\n      const row = data[i];\n      if (!row) continue;\n      if (row.key) {\n        keyedRows++;\n        if (known && keyedRows <= known.keyedRows && !known.changedItemKeys.has(String(row.key))) continue;\n      }\n      if (unknownAttribute) continue;\n      for (const attribute of Object.keys(row)) {\n        if (attribute !== 'key' && !this.properties.has(attribute)) {\n          unknownAttribute = true;\n          break;\n        }\n      }\n    }\n    return { unknownAttribute, keyedRows };\n  }\n\n  private getReferenceKeys(referenceValue: string[] | ListType[]): string[] {\n    return referenceValue.map((value) => {\n      if (typeof value === 'string') {\n        return String(value.trim());\n      } else if (typeof value === 'number') {\n        return String(value);\n      } else if (value === null) {\n        return 'null';\n      } else if (typeof value === 'object' && !!value && value.key) {\n        return value.key;\n      }\n      return undefined;\n    }) as string[];\n  }\n\n  /** A definition error init re-detects on every run (#417); same gate as `setError`. */\n  private setDefinitionError(error: QualityAnalyzer.InternalModelError): void {\n    if (this.modelParser.qualityController.enabled && this.qualityConfig.enabled === true) {\n      error.model = this.key;\n      this.modelParser.qualityController.setDefinitionError(error);\n    }\n  }\n\n  // Descriptions of the errors whose text does not depend on the row, one flat string per text,\n  // shared by every record of the group: built per row, each record held its own\n  // concatenated-string tree (#444). The key holds every input of the text.\n  private sharedErrorDescriptions: Map<string, string> = new Map();\n\n  private sharedErrorDescription(cacheKey: string, build: () => string): string {\n    let description = this.sharedErrorDescriptions.get(cacheKey);\n    if (description === undefined) {\n      description = flattenString(build());\n      this.sharedErrorDescriptions.set(cacheKey, description);\n    }\n    return description;\n  }\n\n  /**\n   * Sets a validation error for this model.\n   * Requires both global quality controller AND model-specific quality to be enabled.\n   */\n  private setError(error: QualityAnalyzer.InternalModelError): void {\n    if (\n      this.inPartialAutoCreatedPass &&\n      error.attribute != null &&\n      [...this.getBasicProperties(), ...this.getBasicReferences()].some(\n        (attribute) => attribute.key === error.attribute,\n      )\n    ) {\n      return;\n    }\n    if (this.modelParser.qualityController.enabled) {\n      if (this.qualityConfig.enabled === true) {\n        error.model = this.key;\n        this.modelParser.qualityController.setError(error);\n      }\n    }\n  }\n\n  /**\n   * Emit one `UnknownColumn` error per (model, attribute) for columns in the\n   * source that are NOT declared on the model. The data for those columns is\n   * silently dropped during ingest — this surfaces that data loss without\n   * failing the load. See dcupl#183.\n   */\n  private emitUnknownColumnErrors(\n    container: DataContainer<ListType>,\n    sourceColumns: string[],\n    properties: Property[],\n    references: Reference[],\n    origin: string,\n  ): void {\n    const declared = new Set<string>();\n    for (const p of properties) declared.add(p.key);\n    for (const r of references) declared.add(r.key);\n    // The key attribute is always declared, whether or not it appears in\n    // `properties` (composite keys are joined separately).\n    const effectiveKeyProperty = container.keyProperty ?? this.keyProperty;\n    if (typeof effectiveKeyProperty === 'string') {\n      declared.add(effectiveKeyProperty);\n    } else if (Array.isArray(effectiveKeyProperty)) {\n      for (const part of effectiveKeyProperty) declared.add(part);\n    }\n    // 'key' is the default name and is always a valid column even when the\n    // model uses a custom keyProperty.\n    declared.add('key');\n\n    for (const column of sourceColumns) {\n      if (declared.has(column)) continue;\n      this.setError({\n        title: 'Unknown Column',\n        type: 'model',\n        errorGroup: 'DataContainerError',\n        errorType: 'UnknownColumn',\n        description: `Column \"${column}\" in the source for model \"${container.model}\" is not declared on the model; its values are dropped during ingest`,\n        attribute: column,\n        model: container.model,\n        meta: {\n          column,\n          origin,\n        },\n      });\n    }\n  }\n\n  /**\n   * Coerces and validates one basic property of a raw row and stores it on\n   * `dataEntry`. Returns whether a value was stored — `false` when the raw\n   * value is missing or the coercion or a strict validator rejects it.\n   */\n  private processBasicProperty(\n    property: Property,\n    rawDataEntry: ListType,\n    dataEntry: ListType,\n    origin: string = 'inline',\n  ): boolean {\n    const rawValue = rawDataEntry[property.key];\n    const qualityConfig = this.attributeQualityConfigs.get(property.key);\n    let value;\n    if (typeof rawValue === 'undefined') {\n      // todo - check if property can be undefined\n      if (qualityConfig?.required) {\n        const declaredType = (property as { type?: string }).type;\n        this.setError({\n          title: 'Undefined Value',\n          type: 'model',\n          errorGroup: 'PropertyDataError',\n          errorType: 'UndefinedValue',\n          description: this.sharedErrorDescription(\n            ['UndefinedValue', 'property', property.key, declaredType ?? '', this.key].join('\\u0000'),\n            () =>\n              `The required ${declaredType ?? ''} property \"${property.key}\" in the \"${this.key}\" model is undefined (no value)`.replace(\n                /\\s+/g,\n                ' ',\n              ),\n          ),\n          itemKey: rawDataEntry.key,\n          attribute: property.key,\n          model: this.key,\n          meta: {\n            rawValue: rawValue,\n            declaredType: declaredType,\n            origin: origin,\n          },\n        });\n      }\n      return false;\n    } else {\n      if (rawValue === null) {\n        if (!qualityConfig?.nullable) {\n          this.setError({\n            title: 'Null Value',\n            description: this.sharedErrorDescription(\n              ['NullValue', 'property', property.key, this.key].join('\\u0000'),\n              () => `The value of the property \"${property.key}\" in the \"${this.key}\" model should not be null`,\n            ),\n            type: 'model',\n            errorGroup: 'PropertyDataError',\n            errorType: 'NullValue',\n            itemKey: rawDataEntry.key,\n            attribute: property.key,\n            model: this.key,\n          });\n        }\n        value = rawValue;\n      } else if (property.type === 'string') {\n        value = this.processStringProperty(property, rawValue, rawDataEntry);\n        if (typeof value === 'undefined') {\n          return false;\n        }\n      } else if (property.type === 'int') {\n        value = this.processIntProperty(property, rawValue, rawDataEntry);\n        if (typeof value === 'undefined') {\n          return false;\n        }\n      } else if (property.type === 'float') {\n        value = this.processFloatProperty(property, rawValue, rawDataEntry);\n        if (typeof value === 'undefined') {\n          return false;\n        }\n      } else if (property.type === 'date') {\n        value = this.processDateProperty(property, rawValue, rawDataEntry);\n        if (typeof value === 'undefined') {\n          return false;\n        }\n      } else if (property.type === 'json') {\n        value = this.processJSONProperty(property, rawValue, rawDataEntry);\n        if (typeof value === 'undefined') {\n          return false;\n        }\n      } else if (property.type === 'boolean') {\n        value = this.processBooleanProperty(property, rawValue, rawDataEntry);\n        if (typeof value === 'undefined') {\n          return false;\n        }\n      } else if (property.type === 'any') {\n        value = rawValue;\n      } else if (property.type === 'Array<string>') {\n        const arrayValue = this.getValueAsArray(rawValue, property?.separator);\n        if (Array.isArray(arrayValue)) {\n          value = [];\n          arrayValue.forEach((val) => {\n            const stringValue = this.processStringProperty(property, val, rawDataEntry);\n            if (typeof stringValue !== 'undefined') {\n              value.push(stringValue);\n            }\n          });\n        }\n      } else if (property.type === 'Array<int>') {\n        const arrayValue = this.getValueAsArray(rawValue, property?.separator);\n        if (Array.isArray(arrayValue)) {\n          value = [];\n          arrayValue.forEach((val) => {\n            const intValue = this.processIntProperty(property, val, rawDataEntry);\n            if (typeof intValue !== 'undefined') {\n              value.push(intValue);\n            }\n          });\n        }\n      } else if (property.type === 'Array<float>') {\n        const arrayValue = this.getValueAsArray(rawValue, property?.separator);\n        if (Array.isArray(arrayValue)) {\n          value = [];\n          arrayValue.forEach((val) => {\n            const floatValue = this.processFloatProperty(property, val, rawDataEntry);\n            if (typeof floatValue !== 'undefined') {\n              value.push(floatValue);\n            }\n          });\n        }\n      } else if (property.type === 'Array<date>') {\n        const arrayValue = this.getValueAsArray(rawValue, property?.separator);\n        if (Array.isArray(arrayValue)) {\n          value = [];\n          arrayValue.forEach((val) => {\n            const dateValue = this.processDateProperty(property, val, rawDataEntry);\n            if (typeof dateValue !== 'undefined') {\n              value.push(dateValue);\n            }\n          });\n        }\n      }\n\n      asWritable(dataEntry)[property.key] = value;\n    }\n    if (property.index) {\n      this.indicesController.fillInverseIndex(property.key, dataEntry.key, [value]);\n      this.indicesController.fillDataMap(property.key, [value]);\n    }\n    return true;\n  }\n\n  private handleValidators(value: any, property: Property, rawDataEntry: ListItem): boolean {\n    // Skip validation if quality controller is disabled globally or for this model\n    if (!this.modelParser.qualityController.enabled || this.qualityConfig.enabled !== true) {\n      return true;\n    }\n\n    let isValid = true;\n    try {\n      if (property.quality?.validators) {\n        const validationErrors = this.modelParser.qualityController.validateAttribute(\n          value,\n          property.quality.validators!,\n          property.key,\n        );\n        for (const validationError of validationErrors) {\n          isValid = false;\n          validationError.attribute = property.key;\n          validationError.itemKey = rawDataEntry.key;\n          validationError.model = this.key;\n          this.setError(validationError);\n        }\n      }\n    } catch (err) {\n      this.log.error('Validator definition error', err as Error);\n    }\n    return isValid;\n  }\n\n  private getWrongDataTypeError(\n    property: Property,\n    rawValue: any,\n    rawDataEntry: ListItem,\n  ): QualityAnalyzer.InternalModelError {\n    const error: QualityAnalyzer.InternalModelError = {\n      title: 'Wrong Data Type',\n      type: 'model',\n      errorGroup: 'PropertyDataError',\n      errorType: 'WrongDataType',\n      itemKey: rawDataEntry.key,\n      attribute: property.key,\n      model: this.key,\n      description: `Expect ${property.type} but got ${typeof rawValue} with value ${rawValue}`,\n      meta: {\n        expected: property.type,\n        rawValue: rawValue,\n        typeof: typeof rawValue,\n      },\n    };\n    return error;\n  }\n\n  /**\n   * Detects a lossy numeric coercion: the raw value was successfully coerced to a\n   * number, but information was silently dropped — either trailing/embedded\n   * non-numeric content (e.g. \"1.2 lbs\" → 1.2), a dropped leading zero on int and\n   * float properties (e.g. \"06112\" → 6112, \"007\" → 7: postal codes and article\n   * numbers lose their text, #520, #550), or fractional truncation for int\n   * properties (e.g. \"1.2\" → 1). Representation-only differences that preserve the\n   * value (trailing zeros, surrounding whitespace, \"4.0\" → 4, \"0\", \"0.5\", \"-0.0\")\n   * are not considered lossy.\n   */\n  private isLossyNumericCoercion(rawValue: any, coercedValue: number, isInt: boolean): boolean {\n    const trimmed = typeof rawValue === 'string' ? rawValue.trim() : undefined;\n    const numericFull = trimmed !== undefined ? Number(trimmed) : Number(rawValue);\n    if (isNaN(numericFull)) {\n      // The full string is not a clean number — junk was dropped during coercion.\n      return true;\n    }\n    // A zero followed by another digit (\"06112\", \"-007\") does not survive as text.\n    if (trimmed !== undefined && LEADING_ZERO_DIGITS.test(trimmed)) {\n      return true;\n    }\n    if (!isInt) {\n      return false;\n    }\n    // For int properties, a fractional source value loses its decimal part.\n    return numericFull !== coercedValue;\n  }\n\n  private getLossyCoercionError(\n    property: Property,\n    rawValue: any,\n    coercedValue: number,\n    rawDataEntry: ListItem,\n  ): QualityAnalyzer.InternalModelError {\n    return {\n      title: 'Lossy Data Coercion',\n      type: 'model',\n      errorGroup: 'PropertyDataError',\n      errorType: 'WrongDataType',\n      itemKey: rawDataEntry.key,\n      attribute: property.key,\n      model: this.key,\n      description: `Lossy coercion to ${property.type}: raw value \"${rawValue}\" was coerced to ${coercedValue}`,\n      meta: {\n        expected: property.type,\n        rawValue: rawValue,\n        coercedValue: coercedValue,\n        typeof: typeof rawValue,\n        lossy: true,\n      },\n    };\n  }\n\n  private getValueAsArray(value: string | string[] | any, separator = ','): any[] | undefined {\n    if (!value) {\n      return undefined;\n    }\n    if (Array.isArray(value)) {\n      return value;\n    }\n    if (value && typeof value === 'string') {\n      return value.split(separator).map((val) => val.trim());\n    }\n    return [];\n  }\n\n  private processStringProperty(\n    property: PropertyString | PropertyStringArray,\n    rawValue: any,\n    rawDataEntry: ListItem,\n  ): string | undefined {\n    const qualityConfig = this.attributeQualityConfigs.get(property.key);\n\n    let relevantValue = rawValue;\n    if (qualityConfig?.forceStrictDataType) {\n      if (!isString(rawValue)) {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n        return;\n      }\n    } else {\n      relevantValue = String(rawValue);\n      if (!isString(relevantValue) && relevantValue != rawValue) {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n        return;\n      }\n    }\n\n    if (!this.handleValidators(relevantValue, property, rawDataEntry)) {\n      if (qualityConfig?.validatorHandling !== 'loose') {\n        return;\n      }\n    }\n\n    return relevantValue;\n  }\n\n  private processIntProperty(\n    property: PropertyInt | PropertyIntArray,\n    rawValue: any,\n    rawDataEntry: ListItem,\n  ): number | undefined {\n    const qualityConfig = this.attributeQualityConfigs.get(property.key);\n    if (qualityConfig?.forceStrictDataType) {\n      if (!isInt(rawValue)) {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n        return;\n      }\n      return rawValue;\n    }\n\n    const value = parseInt(rawValue, 10);\n    if (isNaN(value)) {\n      this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n      return;\n    }\n\n    if (this.isLossyNumericCoercion(rawValue, value, true)) {\n      this.setError(this.getLossyCoercionError(property, rawValue, value, rawDataEntry));\n    }\n\n    if (!this.handleValidators(value, property, rawDataEntry)) {\n      if (qualityConfig?.validatorHandling !== 'loose') {\n        return;\n      }\n    }\n\n    return value;\n  }\n\n  private processFloatProperty(\n    property: PropertyFloat | PropertyFloatArray,\n    rawValue: any,\n    rawDataEntry: ListItem,\n  ): number | undefined {\n    const qualityConfig = this.attributeQualityConfigs.get(property.key);\n    if (qualityConfig?.forceStrictDataType) {\n      if (!isFloat(rawValue)) {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n        return;\n      }\n      return rawValue;\n    }\n\n    let value: number;\n    const fractionDigits = property.fractionDigits;\n\n    if (typeof fractionDigits === 'undefined') {\n      value = parseFloat(rawValue);\n    } else {\n      value = parseFloat(parseFloat(rawValue).toFixed(fractionDigits));\n    }\n    if (isNaN(value)) {\n      this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n      return;\n    }\n\n    if (this.isLossyNumericCoercion(rawValue, value, false)) {\n      this.setError(this.getLossyCoercionError(property, rawValue, value, rawDataEntry));\n    }\n\n    if (!this.handleValidators(value, property, rawDataEntry)) {\n      if (qualityConfig?.validatorHandling !== 'loose') {\n        return;\n      }\n    }\n\n    return value;\n  }\n\n  private processJSONProperty(property: PropertyJson, rawValue: any, rawDataEntry: ListItem): any | undefined {\n    const qualityConfig = this.attributeQualityConfigs.get(property.key);\n    if (qualityConfig?.forceStrictDataType) {\n      if (!isObjectLike(rawValue)) {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n        return;\n      }\n      return rawValue;\n    }\n\n    if (isObjectLike(rawValue)) {\n      return rawValue;\n    }\n    if (!isObjectLike(rawValue) && typeof rawValue === 'string') {\n      try {\n        return JSON.parse(rawValue);\n      } catch (_err) {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n        return;\n      }\n    }\n\n    return;\n  }\n\n  /**\n   * A boolean is kept as is. A string follows {@link parseBooleanString}: 'true'/'false'/'1'/'0'\n   * (case-insensitive) become booleans, any other string is a WrongDataType and the value stays\n   * undefined (#364). Numbers are strict too: 1 and 0 become true and false, any other number is a\n   * WrongDataType. Any other value, such as an object or an array, is a WrongDataType as well (#402).\n   * With `forceStrictDataType` only real booleans pass.\n   */\n  private processBooleanProperty(\n    property: PropertyBoolean,\n    rawValue: any,\n    rawDataEntry: ListItem,\n  ): boolean | undefined {\n    const qualityConfig = this.attributeQualityConfigs.get(property.key);\n    if (qualityConfig?.forceStrictDataType) {\n      if (!isBoolean(rawValue)) {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n        return;\n      }\n      return rawValue;\n    }\n\n    if (typeof rawValue === 'string') {\n      const value = parseBooleanString(rawValue);\n      if (typeof value === 'undefined') {\n        this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n      }\n      return value;\n    }\n\n    if (typeof rawValue === 'number') {\n      if (rawValue === 1 || rawValue === 0) {\n        return rawValue === 1;\n      }\n      this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n      return;\n    }\n\n    if (typeof rawValue === 'boolean') {\n      return rawValue;\n    }\n\n    // An object or an array is not a boolean either (#402)\n    this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n    return;\n  }\n\n  private processDateProperty(\n    property: PropertyDate | PropertyDateArray,\n    rawValue: any,\n    rawDataEntry: ListItem,\n  ): Date | undefined {\n    // forceStrictDataType is not supported / makes no sense for date\n\n    // A null or missing entry inside an Array<date> is not a date: `new Date(null)` would be the\n    // epoch. It is dropped with a WrongDataType error, as `parseInt` drops it in an Array<int> (#527).\n    // A null or missing scalar date never reaches this method.\n    if (rawValue === '' || rawValue === null || rawValue === undefined) {\n      this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n      return;\n    }\n\n    const inputFormat: PropertyDateInputFormat | undefined = property.inputFormat;\n\n    let date: Date;\n\n    try {\n      if (inputFormat && typeof inputFormat === 'string') {\n        let relevantValue = rawValue;\n        if (typeof relevantValue !== 'string') {\n          relevantValue = String(relevantValue);\n        }\n        date = parseDate(relevantValue, inputFormat, new Date());\n      } else {\n        date = new Date(rawValue);\n      }\n    } catch (err) {\n      this.log.error('Property extraction error', err as Error, { property: property.key, model: this.key });\n\n      this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n      return;\n    }\n\n    if (!isValidDate(date)) {\n      this.setError(this.getWrongDataTypeError(property, rawValue, rawDataEntry));\n      return;\n    }\n\n    if (property.UTC) {\n      date = new Date(\n        Date.UTC(\n          date.getFullYear(),\n          date.getMonth(),\n          date.getDate(),\n          date.getHours(),\n          date.getMinutes(),\n          date.getSeconds(),\n          date.getMilliseconds(),\n        ),\n      );\n    }\n\n    return date;\n  }\n\n  /** The NullValue error of a non-nullable reference with an explicit null, as for a property (#215). */\n  private getNullReferenceError(\n    reference: Reference,\n    rawDataEntry: ListItem,\n    model: string,\n  ): QualityAnalyzer.InternalModelError {\n    return {\n      title: 'Null Value',\n      type: 'model',\n      errorGroup: 'ReferenceDataError',\n      errorType: 'NullValue',\n      description: this.sharedErrorDescription(\n        ['NullValue', 'reference', reference.key, this.key].join('\\u0000'),\n        () => `The value of the reference \"${reference.key}\" in the \"${this.key}\" model should not be null`,\n      ),\n      itemKey: rawDataEntry.key,\n      attribute: reference.key,\n      model,\n    };\n  }\n\n  private processSingleValuedReference(\n    reference: Reference,\n    referenceValue: string | ListType,\n    dataEntry: ListType,\n  ): void {\n    const remoteModel = this.modelParser.models.get(reference.model)!;\n\n    if (!remoteModel) {\n      return;\n    }\n\n    let referenceKey = '';\n    if (typeof referenceValue === 'string') {\n      referenceKey = referenceValue;\n    } else if (typeof referenceValue === 'object' && referenceValue && referenceValue.key) {\n      referenceKey = referenceValue.key;\n    }\n\n    const remoteDataEntry = this.hasRemoteEntry(remoteModel, String(referenceKey));\n\n    // fill undefined indexMap for for single and multi valued\n    if (!remoteDataEntry) {\n      if (remoteModel.supportsAutoCreation) {\n        const remoteValue = this.handleAutoCreationAndReturnKey(remoteModel, referenceValue) as ListItem;\n        this.indicesController.fillInverseIndex(reference.key, dataEntry.key, [referenceValue]);\n        asWritable(dataEntry)[reference.key] = remoteValue;\n        this.setRefValue(remoteValue, 'auto_hit');\n        return;\n      } else {\n        this.indicesController.fillInverseIndex(reference.key, dataEntry.key, [referenceKey]);\n        this.recordMissedReference(reference.key, String(referenceKey), dataEntry.key);\n        this.setError({\n          title: 'Remote Reference Key Not Found',\n          type: 'model',\n          errorGroup: 'ReferenceDataError',\n          errorType: 'RemoteReferenceKeyNotFound',\n          itemKey: dataEntry.key,\n          attribute: reference.key,\n          description: `The reference \"${reference.key}\" in the \"${this.key}\" model can not find the value \"${referenceValue}\" in the remote model \"${reference.model}\"`,\n          meta: {\n            remoteModel: reference.model,\n            remoteKey: referenceValue,\n          },\n        });\n\n        if (reference.validity === 'strict') {\n          // No value, as on a fresh entry: a partial update must not keep the\n          // previous one once its item is removed (#368)\n          if (reference.key in dataEntry) {\n            delete asWritable(dataEntry)[reference.key];\n          }\n          return;\n        }\n      }\n    }\n\n    this.indicesController.fillInverseIndex(reference.key, dataEntry.key, [referenceKey]);\n\n    const item: ListItem = { key: String(referenceKey) };\n\n    asWritable(dataEntry)[reference.key] = item;\n\n    if (!remoteDataEntry && !remoteModel.supportsAutoCreation && reference.validity !== 'strict') {\n      this.setRefValue(item, 'miss');\n    } else {\n      this.setRefValue(item, 'hit');\n    }\n  }\n\n  private processMultiValuedReference(\n    reference: Reference,\n    referenceValue: string[] | ListType[],\n    dataEntry: ListType,\n  ): void {\n    const remoteModel = this.modelParser.models.get(reference.model)!;\n\n    if (!remoteModel) {\n      return;\n    }\n\n    const referenceKeys = this.getReferenceKeys(referenceValue);\n\n    const validReferenceKeys: ListItem[] = [];\n\n    referenceKeys.forEach((referenceKey, index) => {\n      const remoteDataEntry = this.hasRemoteEntry(remoteModel, String(referenceKey));\n\n      if (!remoteDataEntry) {\n        if (remoteModel.supportsAutoCreation) {\n          const remoteKey = this.handleAutoCreationAndReturnKey(\n            remoteModel,\n            referenceValue[index] as ListType | string,\n          ) as ListItem;\n\n          this.setRefValue(remoteKey, 'auto_hit');\n\n          validReferenceKeys.push(remoteKey);\n\n          return;\n        } else {\n          this.recordMissedReference(reference.key, String(referenceKey), dataEntry.key);\n          this.setError({\n            title: 'Remote Reference Key Not Found',\n            type: 'model',\n            errorGroup: 'ReferenceDataError',\n            errorType: 'RemoteReferenceKeyNotFound',\n            itemKey: dataEntry.key,\n            attribute: reference.key,\n            description: `The reference \"${reference.key}\" in the \"${this.key}\" model can not find the value \"${referenceKey}\" in the remote model \"${reference.model}\"`,\n            meta: {\n              remoteModel: reference.model,\n              remoteKey: referenceKey,\n            },\n          });\n          if (reference.validity === 'strict') {\n            return;\n          }\n        }\n      }\n      const item: ListItem = { key: referenceKey };\n\n      if (!remoteDataEntry && !remoteModel.supportsAutoCreation && reference.validity !== 'strict') {\n        this.setRefValue(item, 'miss');\n      } else {\n        this.setRefValue(item, 'hit');\n      }\n      validReferenceKeys.push(item);\n    });\n\n    this.indicesController.fillInverseIndex(\n      reference.key,\n      dataEntry.key,\n      validReferenceKeys.map((val) => val.key),\n    );\n    asWritable(dataEntry)[reference.key] = validReferenceKeys;\n  }\n\n  public getViewKeys(): string[] {\n    return this.modelParser['_getViewKeys']({ modelKey: this.key });\n  }\n\n  /**\n   * Records one `NonUniqueKey` per row that a later row with the same key\n   * replaced in the container's `set` payload. ModelParser dedupes the rows\n   * before processing (the last row wins as a whole) and keeps the replaced\n   * keys beside the container, so every full apply reports them again (#369).\n   */\n  private emitNonUniqueKeyErrors(container: DataContainer<ListType>): void {\n    const replacedRowKeys = this.modelParser.getReplacedRowKeys(container as DataContainer);\n    if (replacedRowKeys.length === 0) {\n      return;\n    }\n    const effectiveKeyProperty = container.keyProperty ?? this.keyProperty;\n    const effectiveSeparator =\n      container.keyPropertySeparator ?? this.keyPropertySeparator ?? DEFAULT_KEY_PROPERTY_SEPARATOR;\n    const keyAttribute = joinKeyProperty(effectiveKeyProperty, effectiveSeparator);\n    for (const duplicateKey of replacedRowKeys) {\n      // Per-row emit — matches the existing aggregation infrastructure in\n      // QualityController (errorCounts cap via maxErrorsPerGroup, group\n      // totals via getErrorCounts). meta carries a minimal audit trail on\n      // each record: droppedRows names the replaced row's key. See dcupl#188.\n      this.setError({\n        title: 'Non Unique Key',\n        type: 'model',\n        errorGroup: 'DataContainerError',\n        errorType: 'NonUniqueKey',\n        description: `Row with key \"${duplicateKey}\" in model \"${container.model}\" is replaced by a later row with the same key (key attribute \"${keyAttribute}\"); the last row wins`,\n        itemKey: duplicateKey,\n        attribute: keyAttribute,\n        model: container.model,\n        meta: {\n          duplicateCount: 1,\n          droppedRows: [duplicateKey],\n        },\n      });\n    }\n  }\n\n  /** Forgets every listed miss, before a step-1 pass over all of this model's rows (#425). */\n  public resetMissedReferenceKeys(): void {\n    this.missedReferenceKeys.clear();\n  }\n\n  /** Lists `itemKey` under the remote key its reference `referenceKey` did not find (#425). */\n  private recordMissedReference(referenceKey: string, remoteKey: string, itemKey: string): void {\n    let misses = this.missedReferenceKeys.get(referenceKey);\n    if (!misses) {\n      misses = { pending: [], byRemoteKey: undefined, foldAt: undefined };\n      this.missedReferenceKeys.set(referenceKey, misses);\n    }\n    if (this.missesToPending || !misses.byRemoteKey) {\n      if (!this.missesToPending) misses.foldAt ??= 2 * misses.pending.length;\n      misses.pending.push(remoteKey, itemKey);\n      if (!this.missesToPending && misses.pending.length > misses.foldAt!) this.foldMissedReferences(misses);\n    } else {\n      this.addMissedReference(misses.byRemoteKey, remoteKey, itemKey);\n    }\n  }\n\n  /** Moves the appended misses into `byRemoteKey`, where a row resolved again is listed once (#425, #590). */\n  private foldMissedReferences(misses: {\n    pending: string[];\n    byRemoteKey: Map<string, string | Set<string>> | undefined;\n  }): Map<string, string | Set<string>> {\n    const byRemoteKey = misses.byRemoteKey ?? new Map<string, string | Set<string>>();\n    misses.byRemoteKey = byRemoteKey;\n    for (let i = 0; i < misses.pending.length; i += 2) {\n      this.addMissedReference(byRemoteKey, misses.pending[i]!, misses.pending[i + 1]!);\n    }\n    misses.pending = [];\n    return byRemoteKey;\n  }\n\n  private addMissedReference(byRemoteKey: Map<string, string | Set<string>>, remoteKey: string, itemKey: string): void {\n    const itemKeys = byRemoteKey.get(remoteKey);\n    if (itemKeys === undefined) {\n      byRemoteKey.set(remoteKey, itemKey);\n    } else if (typeof itemKeys === 'string') {\n      if (itemKeys !== itemKey) byRemoteKey.set(remoteKey, new Set([itemKeys, itemKey]));\n    } else {\n      itemKeys.add(itemKey);\n    }\n  }\n\n  /**\n   * The stored items whose reference `referenceKey` did not find one of\n   * `remoteKeys` when it was last resolved, and drops those entries (#425):\n   * the caller re-resolves the items, which lists them again if they still miss.\n   */\n  public takeItemsMissingReferenceKeys(referenceKey: string, remoteKeys: Iterable<string>): Set<string> {\n    const itemKeys = new Set<string>();\n    const misses = this.missedReferenceKeys.get(referenceKey);\n    if (!misses) return itemKeys;\n    const byRemoteKey = this.foldMissedReferences(misses);\n    for (const remoteKey of remoteKeys) {\n      const missing = byRemoteKey.get(remoteKey);\n      if (missing === undefined) continue;\n      byRemoteKey.delete(remoteKey);\n      for (const itemKey of typeof missing === 'string' ? [missing] : missing) {\n        if (this.data.has(itemKey)) itemKeys.add(itemKey);\n      }\n    }\n    return itemKeys;\n  }\n\n  /** Whether `remoteModel` holds the item `key`, or is about to within this model's step-1 pass (#411). */\n  private hasRemoteEntry(remoteModel: DcuplModel, key: string): boolean {\n    return !!remoteModel.getEntry(key) || (remoteModel === this && !!this.pendingItemKeys?.has(key));\n  }\n\n  /**\n   * The keys of the given rows when this model has a basic reference to\n   * itself, for `pendingItemKeys` (#411); `undefined` otherwise.\n   */\n  public getPendingItemKeys(rows: ListType[]): Set<string> | undefined {\n    if (!this.getBasicReferences().some((reference) => reference.model === this.key)) {\n      return undefined;\n    }\n    const keys = new Set<string>();\n    for (const row of rows) {\n      if (row.key !== undefined && row.key !== null) keys.add(String(row.key));\n    }\n    return keys;\n  }\n\n  public addBasicPropertiesAndReferences(container: DataContainer<ListType>): void {\n    const properties = this.getBasicProperties();\n    const references = this.getBasicReferences();\n    // A pass for an auto-created row may run inside this model's own pass:\n    // it hands the outer pass its flags back when it returns (#590)\n    const outerPendingItemKeys = this.pendingItemKeys;\n    const outerMissesToPending = this.missesToPending;\n    this.pendingItemKeys = this.getPendingItemKeys(container.data);\n    this.missesToPending = true;\n    const sourceMetadata = this.modelParser.qualityController.dcupl?.getContainerSourceMetadata(\n      container as DataContainer,\n    );\n    const origin = sourceMetadata?.origin ?? 'inline';\n\n    // Detect unknown columns: any column the loader saw in the source that the\n    // model doesn't declare (as a property, reference, or key attribute) is\n    // silently dropped on ingest. Surface it as `UnknownColumn` so users see\n    // the data loss. Only runs when source metadata is registered — inline\n    // `model.data` has no equivalent \"column list\" concept. See dcupl#183.\n    if (sourceMetadata && sourceMetadata.sourceColumns.length > 0) {\n      this.emitUnknownColumnErrors(container, sourceMetadata.sourceColumns, properties, references, origin);\n    }\n\n    this.emitNonUniqueKeyErrors(container);\n\n    for (let rawDataEntry of container.data) {\n      // A row with no key cannot be identified. Previously String(undefined)\n      // stored it under the literal key 'undefined' (and multiple such rows\n      // collided). Surface it as MissingKey and drop the row instead.\n      if (rawDataEntry.key === undefined || rawDataEntry.key === null) {\n        const effectiveKeyProperty = container.keyProperty ?? this.keyProperty;\n        const effectiveSeparator =\n          container.keyPropertySeparator ?? this.keyPropertySeparator ?? DEFAULT_KEY_PROPERTY_SEPARATOR;\n        const keyAttribute = joinKeyProperty(effectiveKeyProperty, effectiveSeparator);\n        this.setError({\n          title: 'Missing Key',\n          type: 'model',\n          errorGroup: 'DataContainerError',\n          errorType: 'MissingKey',\n          description: this.sharedErrorDescription(\n            ['MissingKey', container.model, keyAttribute].join('\\u0000'),\n            () =>\n              `A row in model \"${container.model}\" has no value for the key attribute \"${keyAttribute}\"; the row is dropped.`,\n          ),\n          attribute: keyAttribute,\n          model: container.model,\n        });\n        continue;\n      }\n\n      // Rows with the same key in a `set` payload were deduped before\n      // processing (ModelParser.mergeContainers, #369); an existing entry is\n      // only met by containers that merge into it, e.g. auto-created rows.\n      let dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n\n      if (!dataEntry) {\n        dataEntry = {\n          key: String(rawDataEntry.key),\n        } as ListType;\n      }\n\n      // handle Properties\n      for (const property of properties) {\n        if (property.origin) {\n          asWritable(rawDataEntry)[property.key] = rawDataEntry[property.origin];\n        }\n\n        const valueMapping = this.valueMappings.find((map) => map.attributes.includes(property.key));\n        if (this.isValidValueMapping(valueMapping)) {\n          rawDataEntry = this.mapRawValueUsingValueMapping(rawDataEntry, property.key, valueMapping!);\n        }\n\n        this.processBasicProperty(property, rawDataEntry, dataEntry, origin);\n      }\n\n      // handle References\n      for (const reference of references) {\n        const qualityConfig = this.attributeQualityConfigs.get(reference.key);\n\n        if (reference.origin) {\n          asWritable(rawDataEntry)[reference.key] = rawDataEntry[reference.origin];\n        }\n\n        const valueMapping = this.valueMappings.find((map) => map.attributes.includes(reference.key));\n        if (this.isValidValueMapping(valueMapping)) {\n          rawDataEntry = this.mapRawValueUsingValueMapping(rawDataEntry, reference.key, valueMapping!);\n        }\n\n        let referenceValue: ReferenceDataTypes<ListType> = rawDataEntry[reference.key];\n\n        if (typeof referenceValue === 'number') {\n          referenceValue = String(referenceValue);\n        }\n\n        if (!referenceValue) {\n          // An explicit null is kept and indexed under null, as for a property; an absent or\n          // empty value stays undefined (#215)\n          const emptyValue: any = referenceValue === null ? null : undefined;\n          this.indicesController.fillInverseIndex(reference.key, dataEntry.key, [emptyValue]);\n          if (emptyValue === null) {\n            asWritable(dataEntry)[reference.key] = null;\n            // A null reference is a NullValue unless nullable, as for a property\n            if (!qualityConfig?.nullable) {\n              this.setError(this.getNullReferenceError(reference, rawDataEntry, container.model));\n            }\n          } else if (qualityConfig?.required) {\n            this.setError({\n              title: 'Undefined Value',\n              type: 'model',\n              errorGroup: 'ReferenceDataError',\n              errorType: 'UndefinedValue',\n              description: this.sharedErrorDescription(\n                ['UndefinedValue', 'reference', reference.key, reference.type, this.key].join('\\u0000'),\n                () =>\n                  `The required ${reference.type} reference \"${reference.key}\" in the \"${this.key}\" model is undefined`,\n              ),\n              itemKey: rawDataEntry.key,\n              attribute: reference.key,\n              model: container.model,\n              meta: {\n                rawValue: referenceValue,\n                declaredType: reference.type,\n                origin: origin,\n              },\n            });\n          }\n          continue;\n        }\n\n        if (reference.type === 'singleValued') {\n          if (\n            (typeof referenceValue === 'object' || typeof referenceValue === 'string') &&\n            !Array.isArray(referenceValue)\n          ) {\n            this.processSingleValuedReference(reference, referenceValue, dataEntry);\n          } else {\n            this.setError({\n              title: 'Wrong Data Type',\n              type: 'model',\n              errorGroup: 'ReferenceDataError',\n              errorType: 'WrongDataType',\n              description: `Expect ${reference.type} but got ${typeof referenceValue} with value ${referenceValue}`,\n              itemKey: rawDataEntry.key,\n              attribute: reference.key,\n              meta: {\n                value: referenceValue,\n              },\n            });\n          }\n        } else if (reference.type === 'multiValued') {\n          const arrayValue = this.getValueAsArray(referenceValue, reference?.separator);\n          if (Array.isArray(arrayValue)) {\n            this.processMultiValuedReference(reference, arrayValue, dataEntry);\n          } else {\n            this.setError({\n              title: 'Wrong Data Type',\n              type: 'model',\n              errorGroup: 'ReferenceDataError',\n              errorType: 'WrongDataType',\n              description: `Expect ${reference.type} but got ${typeof referenceValue} with value ${referenceValue}`,\n              itemKey: rawDataEntry.key,\n              attribute: reference.key,\n              meta: {\n                value: referenceValue,\n              },\n            });\n          }\n        }\n      }\n\n      const stringKey = String(dataEntry.key);\n      (dataEntry as any).key = stringKey;\n      this.data.set(stringKey, dataEntry);\n    }\n    this.pendingItemKeys = outerPendingItemKeys;\n    this.missesToPending = outerMissesToPending;\n  }\n\n  public addQueryReferences(container: DataContainer<ListType>): void {\n    const queryReferences = this.getQueryReferences();\n\n    for (let qR of queryReferences) {\n      // #121 Performance optimization: Pre-stringify query once per reference instead of per item\n      // Reduces O(q·n) JSON.stringify calls to O(q) where q = query refs, n = items\n      const strigifiedQuery = JSON.stringify(qR.query);\n\n      for (let rawDataEntry of container.data) {\n        let dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n        this.applyQueryReference(qR, strigifiedQuery, rawDataEntry, dataEntry);\n      }\n    }\n  }\n\n  /**\n   * Runs one query reference again for the given raw rows on the partial\n   * path (#429). Each row's previous value is dropped first, so a row without\n   * a hit ends up as on init(), where the attribute was never set.\n   */\n  public recomputeQueryReference(qR: QueryReference, rawRows: readonly RawItem[]): void {\n    const strigifiedQuery = JSON.stringify(qR.query);\n    for (const rawDataEntry of rawRows) {\n      const dataEntry = this.data.get(String(rawDataEntry.key)) as ListType | undefined;\n      if (!dataEntry) continue;\n      delete (dataEntry as Record<string, unknown>)[qR.key];\n      this.applyQueryReference(qR, strigifiedQuery, rawDataEntry as ListType, dataEntry);\n    }\n  }\n\n  /**\n   * The owner rows, among `rawRows`, whose query reference result a change of\n   * the target items `targetKeys` can alter (#429): the rows whose current\n   * value lists one of those items, and the rows whose query matches one of\n   * the items that exist now. Only for a query whose result is the set of\n   * matching items (see ModelParser.planQueryReferences): the other rows keep\n   * the same set of matches, so the same result.\n   */\n  public getRowsAffectedByTargetItems(\n    qR: QueryReference,\n    rawRows: readonly RawItem[],\n    targetKeys: ReadonlySet<string>,\n  ): RawItem[] {\n    const targetData = this.modelParser.models.get(qR.model)?.getData();\n    const targetItems = new Map<string, ListItem>();\n    for (const itemKey of targetKeys) {\n      const item = targetData?.get(itemKey);\n      if (item) targetItems.set(itemKey, item);\n    }\n    const queryManager = this.modelParser.dcuplInstance['queryManager'];\n    const strigifiedQuery = JSON.stringify(qR.query);\n    const affected: RawItem[] = [];\n\n    for (const rawDataEntry of rawRows) {\n      const dataEntry = this.data.get(String(rawDataEntry.key));\n      if (!dataEntry) continue;\n      const value = (dataEntry as Record<string, unknown>)[qR.key];\n      const listed = (Array.isArray(value) ? value : [value]).some(\n        (entry) => !!entry && typeof entry === 'object' && targetKeys.has(String((entry as { key?: unknown }).key)),\n      );\n      if (listed) {\n        affected.push(rawDataEntry);\n        continue;\n      }\n      if (targetItems.size === 0) continue;\n      const finalQuery = this.getQueryReferenceQuery(qR, strigifiedQuery, rawDataEntry as ListType);\n      if (\n        finalQuery.queries.length === 0 ||\n        queryManager.queryData(targetItems, finalQuery, false, new Map()).size > 0\n      ) {\n        affected.push(rawDataEntry);\n      }\n    }\n    return affected;\n  }\n\n  /** The query a query reference runs for one raw row: its template filled from the row. */\n  private getQueryReferenceQuery(\n    qR: QueryReference,\n    strigifiedQuery: string,\n    rawDataEntry: ListType,\n  ): DcuplGlobalQueryOptions<ListItem> {\n    const resolvedQuery = evaluateTemplate(strigifiedQuery, { ...rawDataEntry });\n\n    const parsedQuery = JSON.parse(resolvedQuery);\n\n    const qb: DcuplQueryBuilder = new DcuplQueryBuilder();\n    qb.init({ modelKey: qR.model });\n\n    qb.applyQuery(parsedQuery, { mode: 'set' });\n\n    // Only apply default projection if the query doesn't specify one\n    // This allows sort, pagination, and custom projection from query reference definitions\n    if (!parsedQuery.projection) {\n      qb.applyOptions({ projection: { $: false } });\n    }\n\n    return qb.getQuery();\n  }\n\n  private applyQueryReference(\n    qR: QueryReference,\n    strigifiedQuery: string,\n    rawDataEntry: ListType,\n    dataEntry: ListType,\n  ): void {\n    const finalQuery = this.getQueryReferenceQuery(qR, strigifiedQuery, rawDataEntry);\n\n    if (finalQuery.queries.length > 0) {\n      const result = this.modelParser.dcuplInstance.query.execute(finalQuery);\n\n      if (qR.type === 'singleValued') {\n        if (result[0]) {\n          asWritable(dataEntry)[qR.key] = { key: result[0].key, _dcupl_ref_: 'hit' };\n        }\n      } else if (qR.type === 'multiValued') {\n        result.forEach((entry) => {\n          entry._dcupl_ref_ = 'hit';\n        });\n        asWritable(dataEntry)[qR.key] = result;\n      }\n    } else {\n      if (qR.type === 'singleValued') {\n        asWritable(dataEntry)[qR.key] = null;\n      } else if (qR.type === 'multiValued') {\n        asWritable(dataEntry)[qR.key] = [];\n      }\n    }\n\n    const stringKey = String(dataEntry.key);\n    (dataEntry as any).key = stringKey;\n    this.data.set(stringKey, dataEntry);\n  }\n\n  private isValidValueMapping(valueMapping: ValueMappingConfig | undefined): boolean {\n    if (!valueMapping || !Array.isArray(valueMapping.attributes) || !Array.isArray(valueMapping.values)) {\n      return false;\n    }\n\n    const invalidFromValues = valueMapping.values.find((value) => !Array.isArray(value.from));\n    // Check for structural presence of `to`, not truthiness — a falsy target\n    // (false, 0, '') is a valid mapping and must not disqualify the value.\n    const invalidToValues = valueMapping.values.find((value) => value.to === undefined);\n\n    if (invalidFromValues || invalidToValues) {\n      return false;\n    }\n\n    return true;\n  }\n\n  private mapRawValueUsingValueMapping(\n    rawEntry: ListType,\n    attribute: string,\n    valueMappingConfig: ValueMappingConfig,\n  ): ListType {\n    for (const mappingValue of valueMappingConfig.values) {\n      if (mappingValue.from.includes('$dcupl_falsy')) {\n        if (typeof rawEntry[attribute] === 'undefined' || rawEntry[attribute] === null || rawEntry[attribute] === '') {\n          asWritable(rawEntry)[attribute] = mappingValue.to;\n          continue;\n        }\n        continue;\n      }\n\n      if (mappingValue.from.includes(rawEntry[attribute])) {\n        asWritable(rawEntry)[attribute] = mappingValue.to;\n        continue;\n      }\n    }\n\n    return rawEntry;\n  }\n\n  private handleAutoCreationAndReturnKey(\n    remoteModel: DcuplModel,\n    referenceValue: ReferenceDataTypes,\n  ): ListItem | ListItem[] {\n    if (Array.isArray(referenceValue)) {\n      return [];\n    }\n\n    if (referenceValue === null) {\n      return { key: 'null' };\n    }\n\n    if (typeof referenceValue === 'object') {\n      const keyProperty = remoteModel.keyProperty;\n      const separator = remoteModel.keyPropertySeparator ?? DEFAULT_KEY_PROPERTY_SEPARATOR;\n      let key: string;\n      if (remoteModel.autoGenerateKey) {\n        key = generateKey();\n      } else if (typeof keyProperty === 'string' || (Array.isArray(keyProperty) && keyProperty.length > 0)) {\n        key = extractKey(referenceValue, keyProperty, separator);\n      } else {\n        key = String(referenceValue['key']);\n      }\n      remoteModel.data.set(key, { key: key });\n      referenceValue.key = key;\n      remoteModel.autoCreatedRows.set(key, referenceValue as ListType);\n      const container: DataContainer = { model: remoteModel.key, data: [referenceValue] };\n      remoteModel.queueAutoCreatedContainer(container as DataContainer<ListType>);\n      return { key: key };\n    }\n\n    if (typeof referenceValue === 'string') {\n      const row = { key: referenceValue } as ListType;\n      remoteModel.data.set(referenceValue, { key: referenceValue });\n      remoteModel.autoCreatedRows.set(referenceValue, row);\n      const container: DataContainer = { model: remoteModel.key, data: [row] };\n      remoteModel.queueAutoCreatedContainer(container as DataContainer<ListType>);\n    }\n    return { key: String(referenceValue) };\n  }\n\n  /**\n   * Queues the pass of an auto-created item. While the parser defers the passes (step 1 of init()\n   * and of the partial path), it runs them all after every model's step 1\n   * (ModelParser.processPendingAutoCreatedItems, #604, #619); otherwise the pass runs at the next\n   * yield, one pass per callback, in order. A callback that finds the queue empty does nothing.\n   */\n  private queueAutoCreatedContainer(container: DataContainer<ListType>): void {\n    this.pendingAutoCreatedContainers.push(container);\n    for (const row of container.data) {\n      this.autoCreatedInUpdate.add(String(row.key));\n    }\n    this.modelParser.recordAutoCreationChange(this.key);\n    if (this.modelParser.defersAutoCreatedPasses) return;\n    void yieldToEventLoop().then(() => {\n      const next = this.takeAutoCreatedContainer();\n      if (next) {\n        this.addContainer(next);\n      }\n    });\n  }\n\n  /**\n   * The next queued container, without the rows a row of the model's own data replaced since\n   * (forgetAutoCreatedRows): the row's item is processed as the model's data.\n   */\n  private takeAutoCreatedContainer(): DataContainer<ListType> | undefined {\n    let next = this.pendingAutoCreatedContainers.shift();\n    while (next) {\n      const rows = next.data.filter((row) => this.autoCreatedRows.has(String(row.key)));\n      if (rows.length > 0) {\n        return rows.length === next.data.length ? next : { ...next, data: rows };\n      }\n      next = this.pendingAutoCreatedContainers.shift();\n    }\n    return undefined;\n  }\n\n  /**\n   * The first half of the queued passes of auto-created items, those they queue included: their\n   * basic properties and references. Returns the containers, for finishAutoCreatedPasses once\n   * every queued item of every model has its basic attributes (#604, #619).\n   */\n  public addBasicsOfPendingAutoCreatedContainers(partial: boolean): DataContainer<ListType>[] {\n    const containers: DataContainer<ListType>[] = [];\n    const outer = this.inPartialAutoCreatedPass;\n    this.inPartialAutoCreatedPass = partial;\n    try {\n      let next = this.takeAutoCreatedContainer();\n      while (next) {\n        if (this.addContainerBasics(next)) {\n          containers.push(next);\n        }\n        next = this.takeAutoCreatedContainer();\n      }\n    } finally {\n      this.inPartialAutoCreatedPass = outer;\n    }\n    return containers;\n  }\n\n  /**\n   * The second half of the passes addBasicsOfPendingAutoCreatedContainers began: query, resolved\n   * and derived attributes, read from the basic attributes of every item, the auto-created ones\n   * included (#619).\n   */\n  public finishAutoCreatedPasses(containers: DataContainer<ListType>[], partial: boolean): void {\n    const outer = this.inPartialAutoCreatedPass;\n    this.inPartialAutoCreatedPass = partial;\n    try {\n      // One container for all: a pass per item reads the remote models once per item\n      if (containers.length > 0) {\n        this.finishContainer({ ...containers[0]!, data: containers.flatMap((container) => container.data) });\n      }\n    } finally {\n      this.inPartialAutoCreatedPass = outer;\n    }\n  }\n\n  /** Starts the bookkeeping of the items a referrer auto-creates in an update() (#604). */\n  public clearAutoCreatedInUpdate(): void {\n    this.autoCreatedInUpdate.clear();\n  }\n\n  /** The keys of the auto-created items that a referrer created in the running update() (#604). */\n  public getItemsAutoCreatedInUpdate(): string[] {\n    return [...this.autoCreatedInUpdate].filter((key) => this.autoCreatedRows.has(key) && this.data.has(key));\n  }\n\n  /**\n   * Runs the pass of the given basic `attributes` again for the items a referrer auto-created in\n   * the running update(), whose errors the partial path removed before it consolidated the\n   * model's own rows (#604): init() records them after that consolidation.\n   */\n  public reprocessItemsAutoCreatedInUpdate(attributes: ReadonlySet<string>): void {\n    const rows = this.getItemsAutoCreatedInUpdate().map((key) => this.autoCreatedRows.get(key)!);\n    if (rows.length > 0 && attributes.size > 0) {\n      this.addBasicPropertiesAndReferencesPartial({ model: this.key, data: rows }, new Set(attributes));\n    }\n  }\n\n  /** Whether the item is one a referrer auto-created and no row of the model's data holds (#598). */\n  public isAutoCreatedItem(itemKey: string): boolean {\n    return this.autoCreatedRows.has(itemKey);\n  }\n\n  /**\n   * Adds the items a referrer auto-created in the running update() to the indices a read built\n   * before it (#599): a plain index lists every item under its value, `undefined` included, so the\n   * new item goes under its own value, as a rebuild would put it (adding it twice changes nothing).\n   * A context index (aggregate, sections, suggest) and a deep index are dropped instead: the next\n   * read rebuilds them.\n   */\n  public addItemsAutoCreatedInUpdateToIndices(): void {\n    const entries = this.getItemsAutoCreatedInUpdate()\n      .map((key) => this.data.get(key))\n      .filter((entry): entry is ListType => !!entry);\n    if (entries.length === 0) return;\n    const deepIndices = new Set(this.indicesController.getDeepIndexKeys());\n    const plainIndices = this.indicesController\n      .getAttributeIndexKeys()\n      .filter((indexName) => !deepIndices.has(indexName));\n    for (const indexName of plainIndices) {\n      for (const entry of entries) {\n        const value = entry[indexName];\n        this.indicesController.fillInverseIndex(indexName, entry.key, [value]);\n        this.indicesController.fillDataMap(indexName, [value]);\n      }\n    }\n    const plain = new Set(plainIndices);\n    this.indicesController.resetIndicesWhere((indexName) => !plain.has(indexName));\n  }\n\n  /**\n   * `rows` are rows of the model's own data: an item a referrer auto-created before is the row's\n   * item from now on, and stays when its referrers go (#598).\n   */\n  public forgetAutoCreatedRows(rows: readonly RawItem[]): void {\n    if (this.autoCreatedRows.size === 0) return;\n    for (const row of rows) {\n      if (row.key !== undefined && row.key !== null) {\n        this.autoCreatedRows.delete(String(row.key));\n      }\n    }\n  }\n\n  /** The pass of an auto-created item: its basic attributes, then the attributes read from them. */\n  private addContainer(container: DataContainer<ListType>): void {\n    if (this.addContainerBasics(container)) {\n      this.finishContainer(container);\n    }\n  }\n\n  /** The basic properties and references of auto-created items. False: the container is invalid. */\n  private addContainerBasics(container: DataContainer<ListType>): boolean {\n    this.cdRef.analyticsController.mark({ name: 'model:autogenerate_data:start', context: container.model });\n    this.modelParser.handleAlternativeKey([container]);\n\n    if (!Array.isArray(container.data)) {\n      this.setError({\n        title: 'Invalid Data',\n        type: 'model',\n        errorGroup: 'DataContainerError',\n        errorType: 'WrongDataType',\n        description: `Expect the data to be an Array but got ${typeof container.data}`,\n        model: container.model,\n      });\n      return false;\n    }\n\n    if (this.autoGenerateProperties) {\n      // The container holds an auto-created row, not this model's data: the count of keyed rows\n      // the last inference of the data read stays (round 2 review of #519)\n      const inferredKeyedRows = this.inferredKeyedRows;\n      this.generatePropertiesFromContainer(container);\n      this.inferredKeyedRows = inferredKeyedRows;\n    }\n\n    this.addBasicPropertiesAndReferences(container);\n\n    this.measureAutoGenerateData(container);\n    return true;\n  }\n\n  /** The query, resolved and derived attributes of auto-created items, after their basic ones. */\n  private finishContainer(container: DataContainer<ListType>): void {\n    this.cdRef.analyticsController.mark({ name: 'model:autogenerate_data:start', context: container.model });\n\n    this.addQueryReferences(container);\n\n    this.addResolvedReferences(container);\n\n    this.addDerivedReferencesGroupedReferencesDerivedPropertiesAndExpressionProperties(container);\n\n    if (this.hasDerivedPropertiesBasedOnResolvedReferences() || this?.hasDerivedReferencesBasedOnResolvedReferences()) {\n      this.reRunDerivedPropertiesBasedOnResolves(container);\n    }\n\n    this.measureAutoGenerateData(container);\n  }\n\n  private measureAutoGenerateData(container: DataContainer<ListType>): void {\n    this.cdRef.analyticsController.mark({ name: 'model:autogenerate_data:end', context: container.model });\n    this.cdRef.analyticsController.measure({\n      name: 'model:autogenerate_data',\n      start: 'model:autogenerate_data:start',\n      end: 'model:autogenerate_data:end',\n      sum: true,\n      context: container.model,\n      detail: {\n        model: container.model,\n        origin: this.key,\n      },\n    });\n  }\n\n  public addResolvedReferences(container: DataContainer<ListType>): void {\n    const references = this.getResolvedReferences();\n\n    const resolvedReferencesHelper: ResolvedReferenceObject[] = references\n      .map((reference) => {\n        const remoteModel = this.modelParser.models.get(reference.resolve.model);\n        if (!remoteModel) {\n          return;\n        }\n        const remoteData = remoteModel.getDataAsArray();\n\n        const inverseKeys = remoteModel.indicesController.getIndex(reference.resolve.reference);\n\n        const obj: ResolvedReferenceObject = {\n          reference,\n          model: remoteModel,\n          remoteData,\n          inverseKeys,\n        };\n        return obj;\n      })\n      .filter((entry) => !!entry) as ResolvedReferenceObject[];\n\n    for (const rawDataEntry of container.data) {\n      const localDataEntryKey = String(rawDataEntry.key);\n      const dataEntry = this.data.get(localDataEntryKey) as ListType;\n\n      for (const object of resolvedReferencesHelper) {\n        const localReferenceKey = object.reference.key;\n\n        let value: ListItem | ListItem[] | null;\n        if (object.inverseKeys) {\n          if (object.reference.type === 'multiValued') {\n            const v = object.inverseKeys.get(dataEntry.key) || new Set<string>();\n            value = Array.from(v).map((key) => {\n              return { key: key };\n            });\n          } else {\n            const vSet = object.inverseKeys.get(dataEntry.key);\n            const v = vSet ? Array.from(vSet)[0] || null : null;\n            if (v) {\n              value = { key: v };\n            } else {\n              value = null;\n            }\n          }\n          // An auto-created item lists no referrer as undefined, after init() and after a partial\n          // update alike (#606, #619)\n          if (\n            (value === null || (Array.isArray(value) && value.length === 0)) &&\n            dataEntry[localReferenceKey] === undefined &&\n            this.autoCreatedRows.has(localDataEntryKey)\n          ) {\n            continue;\n          }\n          asWritable(dataEntry)[localReferenceKey] = value;\n          this.indicesController.fillInverseIndex(localReferenceKey, localDataEntryKey, dataEntry[localReferenceKey]);\n        }\n      }\n\n      const stringKey = String(dataEntry.key);\n      (dataEntry as any).key = stringKey;\n      this.data.set(stringKey, dataEntry);\n    }\n  }\n\n  /**\n   * Rebuilds resolved references for ALL items in this model\n   * Used in partial updates when source references change\n   * @param specificReferences - Optional set of specific reference keys to rebuild\n   */\n  public rebuildResolvedReferencesForAllItems(specificReferences?: Set<string>): void {\n    let references = this.getResolvedReferences();\n    if (references.length === 0) return;\n\n    // Filter to only rebuild specific references if provided\n    if (specificReferences) {\n      references = references.filter((ref) => specificReferences.has(ref.key));\n      if (references.length === 0) return;\n    }\n\n    const resolvedReferencesHelper: ResolvedReferenceObject[] = references\n      .map((reference) => {\n        const remoteModel = this.modelParser.models.get(reference.resolve.model);\n        if (!remoteModel) {\n          return;\n        }\n        const inverseKeys = remoteModel.indicesController.getIndex(reference.resolve.reference);\n\n        const obj: ResolvedReferenceObject = {\n          reference,\n          model: remoteModel,\n          remoteData: [],\n          inverseKeys,\n        };\n        return obj;\n      })\n      .filter((entry) => !!entry) as ResolvedReferenceObject[];\n\n    // A singleValued reference whose value changed: nothing fills its index (init() neither), so a\n    // read built it and it goes, the next read rebuilds it (#609)\n    const staleLazyIndices = new Set<string>();\n\n    // Process ALL items in this model, not just those in a container\n    for (const dataEntry of this.data.values()) {\n      for (const object of resolvedReferencesHelper) {\n        const localReferenceKey = object.reference.key;\n\n        let value: ListItem | ListItem[] | null;\n        if (object.inverseKeys) {\n          if (object.reference.type === 'multiValued') {\n            const v = object.inverseKeys.get(dataEntry.key) || new Set<string>();\n            value = Array.from(v).map((key: string) => {\n              return { key: key };\n            });\n          } else {\n            const v = object.inverseKeys.get(dataEntry.key);\n            const firstKey = v ? Array.from(v)[0] : null;\n            if (firstKey) {\n              value = { key: firstKey };\n            } else {\n              value = null;\n            }\n          }\n          const previous: ListItem | ListItem[] | null | undefined = dataEntry[localReferenceKey];\n          // An auto-created item lists no referrer as undefined, as init() gives it (#606, #619)\n          if (\n            (value === null || (Array.isArray(value) && value.length === 0)) &&\n            this.autoCreatedRows.has(dataEntry.key)\n          ) {\n            if (previous === undefined) continue;\n            delete asWritable(dataEntry)[localReferenceKey];\n            if (Array.isArray(previous)) {\n              this.indicesController.removeFromInverseIndex(localReferenceKey, dataEntry.key, previous);\n            } else {\n              staleLazyIndices.add(localReferenceKey);\n            }\n            continue;\n          }\n          asWritable(dataEntry)[localReferenceKey] = value;\n          if (sameReferenceKeys(previous, value)) continue;\n          if (Array.isArray(value)) {\n            // The index is kept across updates: the item leaves the entries of its previous value\n            // first, or it stays listed under them (#609)\n            if (Array.isArray(previous)) {\n              this.indicesController.removeFromInverseIndex(localReferenceKey, dataEntry.key, previous);\n            }\n            this.indicesController.fillInverseIndex(localReferenceKey, dataEntry.key, value);\n          } else {\n            staleLazyIndices.add(localReferenceKey);\n          }\n        }\n      }\n    }\n\n    for (const referenceKey of staleLazyIndices) {\n      this.indicesController.reset(referenceKey);\n    }\n  }\n\n  public addDerivedReferencesGroupedReferencesDerivedPropertiesAndExpressionProperties(\n    container: DataContainer<ListType>,\n  ): void {\n    const derivedProperties = this.getDerivedPropertiesForBasicAndDerivedReferences();\n    const expressionProperties = this.getExpressionProperties();\n    const derivedReferences = this.getDerivedReferences();\n    const groupedReferences = this.getGroupedReferences();\n\n    for (const rawDataEntry of container.data) {\n      const dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n\n      /**\n       * 1) Derived References\n       */\n      if (derivedReferences.length > 0) {\n        derivedReferences.forEach((reference) => {\n          this.handleDerivedReferences(reference, dataEntry);\n        });\n      }\n\n      /**\n       * 2) Grouped References\n       */\n      if (groupedReferences.length > 0) {\n        groupedReferences.forEach((reference) => {\n          this.handleGroupedReferences(reference, dataEntry);\n        });\n      }\n\n      /**\n       * 3) Derived Properties\n       */\n      if (derivedProperties.length > 0) {\n        derivedProperties.forEach((prop) => {\n          this.handleDerivedProperties(prop, dataEntry);\n        });\n      }\n\n      /**\n       * 4) Expression Properties\n       */\n      if (expressionProperties.length > 0) {\n        expressionProperties.forEach((prop) => {\n          this.handleExpressionProperty(prop, dataEntry);\n        });\n      }\n\n      const stringKey = String(dataEntry.key);\n      (dataEntry as any).key = stringKey;\n      this.data.set(stringKey, dataEntry);\n    }\n  }\n\n  /**\n   * Evaluates an expression property onto the item. With `index: true` its index follows the\n   * stored value: the item leaves the entry of its previous value and joins the new one. These\n   * are the only two places an expression value is written (the full and the partial path), so\n   * the index is never stale and a partial update keeps it (#430).\n   */\n  private handleExpressionProperty(prop: Property, dataEntry: ListType): void {\n    const context = this.createExpressionContext(dataEntry);\n    const value = evaluateTemplate(prop.expression!, context);\n    if (prop.index) {\n      this.indicesController.replaceItemValue(prop.key, String(dataEntry.key), dataEntry[prop.key], value);\n    }\n    asWritable(dataEntry)[prop.key] = value;\n  }\n\n  private handleDerivedProperties(prop: Property, dataEntry: ListItem): void {\n    const reference = this.references.get(prop.derive!.localReference);\n    if (reference) {\n      const remoteModel = this.modelParser.models.get(reference!.model);\n      if (remoteModel) {\n        if (reference.type === 'singleValued') {\n          this.handleSingleValuedDerivedProperties(remoteModel, dataEntry, reference, prop);\n        } else if (reference.type === 'multiValued') {\n          this.handleMultiValuedDerivedProperties(remoteModel, dataEntry, reference, prop);\n        }\n      }\n    }\n  }\n\n  public reRunDerivedPropertiesBasedOnResolves(container: DataContainer<ListType>): void {\n    const derivedProperties = this.getDerivedProperties();\n    const derivedReferences = this.getDerivedReferences();\n\n    for (const rawDataEntry of container.data) {\n      const dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n\n      derivedReferences.forEach((reference) => {\n        this.handleDerivedReferences(reference, dataEntry);\n      });\n\n      derivedProperties.forEach((prop) => {\n        const reference = this.references.get(prop.derive!.localReference);\n        if (reference) {\n          const remoteModel = this.modelParser.models.get(reference!.model);\n          if (remoteModel) {\n            if (reference.type === 'singleValued') {\n              this.handleSingleValuedDerivedProperties(remoteModel, dataEntry, reference, prop);\n            } else if (reference.type === 'multiValued') {\n              this.handleMultiValuedDerivedProperties(remoteModel, dataEntry, reference, prop);\n            }\n          }\n        }\n      });\n\n      const stringKey = String(dataEntry.key);\n      (dataEntry as any).key = stringKey;\n      this.data.set(stringKey, dataEntry);\n    }\n  }\n\n  private handleSingleValuedDerivedProperties(\n    remoteModel: DcuplModel,\n    dataEntry: ListItem,\n    reference: Reference,\n    property: Property,\n  ): void {\n    const localReferenceValue = dataEntry[reference.key] as ListItem;\n    if (!localReferenceValue) {\n      // Clear derived property if reference is null/undefined\n      delete dataEntry[property.key];\n      return;\n    }\n\n    const remoteEntry = remoteModel?.getData().get(localReferenceValue.key);\n    if (remoteEntry) {\n      const remoteValue = remoteEntry[property.derive!.remoteProperty];\n\n      if (typeof remoteValue !== 'undefined') {\n        dataEntry[property.key] = remoteValue;\n      } else if (property.key in dataEntry) {\n        // No value, as on a fresh entry: a partial update must not keep the previous one (#400)\n        delete dataEntry[property.key];\n      }\n      if (property.index) {\n        this.indicesController.fillInverseIndex(property.key, dataEntry.key, [remoteValue]);\n      }\n    } else {\n      // Clear derived property if referenced entry no longer exists\n      delete dataEntry[property.key];\n    }\n  }\n\n  private handleMultiValuedDerivedProperties(\n    remoteModel: DcuplModel,\n    dataEntry: ListItem,\n    reference: Reference,\n    prop: Property,\n  ): void {\n    const entryValue: ListItem | ListItem[] = dataEntry[reference.key];\n    let entries: ListItem[];\n\n    if (!entryValue) {\n      entries = [];\n    } else if (Array.isArray(entryValue)) {\n      entries = [...entryValue];\n    } else if (entryValue && typeof entryValue.key === 'string') {\n      entries = [{ key: entryValue.key }];\n    } else {\n      entries = [];\n    }\n\n    const separator = prop.derive?.separator || ', ';\n\n    const remoteValues = entries\n      .map((item) => {\n        const remoteEntry = remoteModel?.getData().get(item.key);\n        if (remoteEntry) {\n          return remoteEntry[prop.derive!.remoteProperty];\n        }\n      })\n      .filter(Boolean);\n\n    let value: any;\n\n    if (prop.type.includes('Array<')) {\n      value = remoteValues;\n    } else if (prop.type === 'string' || prop.type === 'int' || prop.type === 'float' || prop.type === 'date') {\n      value = remoteValues.join(separator);\n    } else if (prop.type === 'json') {\n      value = remoteValues;\n    } else {\n      value = remoteValues;\n    }\n\n    dataEntry[prop.key] = value;\n  }\n\n  private handleDerivedReferences(reference: DerivedReference, dataEntry: ListType): void {\n    const localReferenceToDeriveFrom = this.references.get(reference.derive.localReference);\n\n    if (!localReferenceToDeriveFrom) return;\n\n    const remoteModelToDeriveFrom = this.modelParser.models.get(localReferenceToDeriveFrom.model);\n\n    if (!remoteModelToDeriveFrom) return;\n\n    const localKeyToDeriveFrom: ListItem | ListItem[] = dataEntry[localReferenceToDeriveFrom.key];\n\n    // A partial update rewrites a stored value: drop its index entries first (#400),\n    // all of them for a singleValued value indexed under several keys (#607)\n    const previousValue: ListItem | ListItem[] | undefined = dataEntry[reference.key];\n    const indexedKeys = this.derivedReferenceIndexedKeys.get(reference.key);\n    const previousIndexedKeys = indexedKeys?.get(dataEntry.key);\n    if (previousIndexedKeys) {\n      indexedKeys!.delete(dataEntry.key);\n      this.indicesController.removeFromInverseIndex(reference.key, dataEntry.key, previousIndexedKeys);\n    } else if (previousValue) {\n      this.indicesController.removeFromInverseIndex(\n        reference.key,\n        dataEntry.key,\n        (Array.isArray(previousValue) ? previousValue : [previousValue]).map((item) => item?.key),\n      );\n    }\n\n    if (!localKeyToDeriveFrom) {\n      // No value, as on a fresh entry (#400)\n      if (reference.key in dataEntry) {\n        delete asWritable(dataEntry)[reference.key];\n        this.groupedRefReverseIndex.delete(reference.key);\n      }\n      return;\n    }\n\n    let value: string[] = [];\n\n    if (Array.isArray(localKeyToDeriveFrom)) {\n      const resultSet = new Set<string>();\n\n      localKeyToDeriveFrom.forEach((item) => {\n        const dataEntryToDeriveFrom = remoteModelToDeriveFrom?.data.get(item.key);\n\n        if (dataEntryToDeriveFrom) {\n          const valueToDerive: ListItem | ListItem[] = dataEntryToDeriveFrom[reference.derive.remoteReference];\n\n          if (valueToDerive) {\n            if (Array.isArray(valueToDerive)) {\n              valueToDerive.forEach((entry) => {\n                resultSet.add(entry.key);\n              });\n            } else {\n              resultSet.add(valueToDerive.key);\n            }\n          }\n        }\n      });\n\n      // Convert Set to array ONCE after all items are processed\n      value = Array.from(resultSet.values());\n    } else {\n      const dataEntryToDeriveFrom = remoteModelToDeriveFrom?.data.get(localKeyToDeriveFrom.key);\n\n      if (dataEntryToDeriveFrom) {\n        const remoteValue: ListItem | ListItem[] = dataEntryToDeriveFrom[reference.derive.remoteReference];\n        if (!remoteValue) {\n          value = [];\n        } else if (Array.isArray(remoteValue)) {\n          value = remoteValue.map((val) => val.key);\n        } else if ('key' in remoteValue) {\n          value = [remoteValue.key];\n        }\n      }\n    }\n\n    let valueToAssign: ListItem[] | ListItem;\n    if (reference.type === 'singleValued') {\n      valueToAssign = { key: value[0] as string };\n    } else {\n      valueToAssign = value.map((v) => {\n        return { key: v };\n      });\n    }\n\n    this.indicesController.fillInverseIndex(reference.key, dataEntry.key, value);\n    if (reference.type === 'singleValued' && value.length > 1) {\n      let keysByItem = this.derivedReferenceIndexedKeys.get(reference.key);\n      if (!keysByItem) {\n        keysByItem = new Map();\n        this.derivedReferenceIndexedKeys.set(reference.key, keysByItem);\n      }\n      keysByItem.set(dataEntry.key, value);\n    }\n\n    // #244: keep grouped references correct when they group on a derived\n    // reference — its values are being rewritten here.\n    this.groupedRefReverseIndex.delete(reference.key);\n\n    asWritable(dataEntry)[reference.key] = valueToAssign;\n  }\n\n  private asStringArray(input: ListItem[] | ListItem): string[] {\n    if (!input) {\n      return [];\n    }\n    if (Array.isArray(input)) {\n      return input.map((i) => i.key);\n    } else {\n      return [input.key];\n    }\n  }\n\n  // #120 Performance optimization: Build reverse index for a reference\n  private buildReverseIndexForReference(referenceKey: string): void {\n    const reverseIndex = new Map<string, Set<string>>();\n\n    this.data.forEach((entry) => {\n      const values = this.asStringArray(entry[referenceKey]);\n      for (const value of values) {\n        if (!reverseIndex.has(value)) {\n          reverseIndex.set(value, new Set());\n        }\n        reverseIndex.get(value)!.add(entry.key);\n      }\n    });\n\n    this.groupedRefReverseIndex.set(referenceKey, reverseIndex);\n  }\n\n  // #120 Performance optimization: Ensure reverse index exists for reference\n  private ensureReverseIndex(referenceKey: string): Map<string, Set<string>> {\n    if (!this.groupedRefReverseIndex.has(referenceKey)) {\n      this.buildReverseIndexForReference(referenceKey);\n    }\n    return this.groupedRefReverseIndex.get(referenceKey)!;\n  }\n\n  private handleGroupedReferences(reference: GroupedRefeference, dataEntry: ListType): void {\n    const valueToAssign: ListItem[] = [];\n\n    const referenceToGroupOn = this.references.get(reference.groupBy.reference);\n\n    if (referenceToGroupOn) {\n      const valueToGroupOn = this.asStringArray(dataEntry[referenceToGroupOn.key]);\n\n      if (!valueToGroupOn.length) {\n        // No value, as on a fresh entry: a partial update must not keep the previous one (#400)\n        if (reference.key in dataEntry) {\n          delete asWritable(dataEntry)[reference.key];\n        }\n        return;\n      }\n\n      // #120 Performance optimization: Use reverse index for O(v) lookup instead of O(n·v²)\n      const reverseIndex = this.ensureReverseIndex(referenceToGroupOn.key);\n\n      // Collect all items that share any value with this item\n      const matchingItemKeys = new Set<string>();\n      for (const value of valueToGroupOn) {\n        const itemsWithValue = reverseIndex.get(value);\n        if (itemsWithValue) {\n          itemsWithValue.forEach((key) => matchingItemKeys.add(key));\n        }\n      }\n\n      // Build result array\n      for (const itemKey of matchingItemKeys) {\n        if (reference.groupBy.includeSelfInGroup) {\n          valueToAssign.push({ key: itemKey });\n        } else {\n          if (dataEntry.key !== itemKey) {\n            valueToAssign.push({ key: itemKey });\n          }\n        }\n      }\n    }\n\n    asWritable(dataEntry)[reference.key] = valueToAssign;\n  }\n\n  public resetData(): void {\n    this.data.clear();\n    this.autoCreatedRows.clear();\n    // #120: Clear reverse index when data is reset\n    this.groupedRefReverseIndex.clear();\n  }\n\n  public resetIndexMap(): void {\n    this.indicesController.reset();\n  }\n\n  /**\n   * Drops model-level indices derived from the given attributes after a\n   * partial update (#243): lazily built plain indices (facets/pivot\n   * fallback), context-hashed indices (aggregate/sections/suggest) and\n   * deep-query indices are built from data a partial update silently\n   * invalidates — the next read rebuilds them from current data. A\n   * reference's plain index stays: it is maintained eagerly during\n   * processing, and the generic lazy rebuild cannot reproduce its shape. So\n   * does the plain index of an expression property with `index: true` (#430).\n   * Not so for grouped and query references: nothing fills their plain index,\n   * on init() either, so the first read builds it lazily and a partial update\n   * must drop it (#609).\n   *\n   * Which attribute an index belongs to comes from the indices controller's\n   * record, not from the index name: cutting `the_customer.country_<context>`\n   * at `_` reads `the`, and `price` matched `price_net` (#358).\n   */\n  public resetIndicesForChangedAttributes(attributeKeys: Set<string>): void {\n    const indexedExpressions = new Set(\n      this.getExpressionProperties()\n        .filter((property) => property.index)\n        .map((property) => property.key),\n    );\n    const lazilyIndexedReferences = new Set(\n      [...this.getGroupedReferences(), ...this.getQueryReferences()].map((reference) => reference.key),\n    );\n    this.indicesController.resetIndicesWhere((indexKey) => {\n      // An indexed expression's plain index is kept in step by the update itself (#430)\n      if (\n        (this.references.has(indexKey) && !lazilyIndexedReferences.has(indexKey)) ||\n        indexedExpressions.has(indexKey)\n      ) {\n        return false;\n      }\n      return this.indicesController.indexDependsOn(indexKey, attributeKeys);\n    });\n  }\n\n  public deleteDataEntries(data: DataContainer): void {\n    const indexedExpressions = this.getExpressionProperties().filter((property) => property.index);\n    for (const rawDataEntry of data.data) {\n      const itemKey = String(rawDataEntry.key);\n      // An indexed expression's index outlives the update (#430): a value only this item held\n      // leaves its data map too, as a rebuilt index would not list it\n      const entry = this.data.get(itemKey);\n      if (entry) {\n        for (const property of indexedExpressions) {\n          this.indicesController.removeItemValue(property.key, itemKey, entry[property.key]);\n        }\n      }\n      // Remove from data map\n      this.data.delete(itemKey);\n      this.autoCreatedRows.delete(itemKey);\n      // Remove from all inverse indices\n      this.indicesController.removeItemFromAllIndices(itemKey);\n      this.derivedReferenceIndexedKeys.forEach((keysByItem) => keysByItem.delete(itemKey));\n\n      // #120: Remove from grouped reference reverse index\n      this.groupedRefReverseIndex.forEach((reverseIndex) => {\n        reverseIndex.forEach((itemSet) => {\n          itemSet.delete(itemKey);\n        });\n      });\n    }\n  }\n\n  public getItemCount(): number {\n    return this.data.size;\n  }\n\n  public getAttributes(): (Reference | Property)[] {\n    return [...this.references.values(), ...this.properties.values()];\n  }\n\n  public getAttribute(key: string): Reference | Property | undefined {\n    if (key === 'key') {\n      const keyProperty: Property = {\n        key: 'key',\n        type: 'string',\n      };\n      return keyProperty;\n    }\n    return this.references.get(key) || this.properties.get(key);\n  }\n\n  public getReferencesRelevantForDependencyGraph(): Reference[] {\n    return Array.from(this.references.values()).filter(\n      (reference) => !('derive' in reference) && !('resolve' in reference),\n    ) as Reference[];\n  }\n\n  public getBasicReferences(): Reference[] {\n    return Array.from(this.references.values()).filter(\n      (reference) =>\n        !('derive' in reference) && !('resolve' in reference) && !('query' in reference) && !('groupBy' in reference),\n    ) as Reference[];\n  }\n\n  public getQueryReferences(): QueryReference[] {\n    return Array.from(this.references.values()).filter((reference) => 'query' in reference) as QueryReference[];\n  }\n\n  public getResolvedReferences(): ResolvedReference[] {\n    return Array.from(this.references.values()).filter((reference) => 'resolve' in reference) as ResolvedReference[];\n  }\n\n  public getGroupedReferences(): GroupedRefeference[] {\n    return Array.from(this.references.values()).filter((reference) => 'groupBy' in reference) as GroupedRefeference[];\n  }\n\n  public getDerivedReferences(): DerivedReference[] {\n    return Array.from(this.references.values()).filter((reference) => 'derive' in reference) as DerivedReference[];\n  }\n\n  public getAggregatedReferences(): AggregatedReference[] {\n    return Array.from(this.references.values()).filter(\n      (reference) => 'aggregate' in reference,\n    ) as AggregatedReference[];\n  }\n\n  public getBasicProperties(): Property[] {\n    return Array.from(this.properties.values()).filter(\n      (property) => !('derive' in property) && !('expression' in property),\n    );\n  }\n\n  public getDerivedProperties(): Property[] {\n    return Array.from(this.properties.values()).filter((property) => 'derive' in property);\n  }\n\n  public getDerivedPropertiesForBasicAndDerivedReferences(): Property[] {\n    const basicReferences = this.getBasicReferences();\n    const derivedReferences = this.getDerivedReferences();\n    const queryReferences = this.getQueryReferences();\n    const derivedProperties = this.getDerivedProperties();\n\n    const references = [...basicReferences, ...derivedReferences, ...queryReferences];\n\n    const derivedPropertiesBasedOnBasicReferences = derivedProperties.filter((property) =>\n      references.find((reference) => reference.key === property.derive?.localReference),\n    );\n\n    return derivedPropertiesBasedOnBasicReferences;\n  }\n\n  public getDerivedPropertiesForResolvedReferences(): Property[] {\n    const resolvedReferences = this.getResolvedReferences();\n    const derivedProperties = this.getDerivedProperties();\n\n    const derivedPropertiesBasedOnResolvedReferences = derivedProperties.filter((property) =>\n      resolvedReferences.find((reference) => reference.key === property.derive?.localReference),\n    );\n\n    return derivedPropertiesBasedOnResolvedReferences;\n  }\n\n  public getDerivedReferencesForResolvedReferences(): DerivedReference[] {\n    const resolvedReferences = this.getResolvedReferences();\n    const derivedReferences = this.getDerivedReferences();\n\n    const derivedPropertiesBasedOnResolvedReferences = derivedReferences.filter((ref) =>\n      resolvedReferences.find((reference) => reference.key === ref.derive.localReference),\n    );\n\n    return derivedPropertiesBasedOnResolvedReferences;\n  }\n\n  public getExpressionProperties(): Property[] {\n    return Array.from(this.properties.values()).filter((property) => 'expression' in property);\n  }\n  public getAggregatedProperties(): PropertyAggregate[] {\n    return Array.from(this.properties.values()).filter((property) => 'aggregate' in property) as PropertyAggregate[];\n  }\n\n  public hasBasicReferences(): boolean {\n    return this.getBasicReferences().length > 0;\n  }\n\n  public hasQueryReferences(): boolean {\n    return this.getQueryReferences().length > 0;\n  }\n\n  public hasResolvedReferences(): boolean {\n    return this.getResolvedReferences().length > 0;\n  }\n\n  public hasGroupedReferences(): boolean {\n    return this.getGroupedReferences().length > 0;\n  }\n\n  public hasDerivedReferences(): boolean {\n    return this.getDerivedReferences().length > 0;\n  }\n\n  public hasBasicProperties(): boolean {\n    return this.getBasicProperties().length > 0;\n  }\n\n  public hasDerivedProperties(): boolean {\n    return this.getDerivedProperties().length > 0;\n  }\n  public hasDerivedPropertiesForBasicReferences(): boolean {\n    return this.getDerivedPropertiesForBasicAndDerivedReferences().length > 0;\n  }\n\n  public hasDerivedPropertiesBasedOnResolvedReferences(): boolean {\n    return this.getDerivedPropertiesForResolvedReferences().length > 0;\n  }\n  public hasDerivedReferencesBasedOnResolvedReferences(): boolean {\n    return this.getDerivedReferencesForResolvedReferences().length > 0;\n  }\n\n  public hasExpressionProperties(): boolean {\n    return this.getExpressionProperties().length > 0;\n  }\n\n  public hasAggregatedProperties(): boolean {\n    return this.getAggregatedProperties().length > 0;\n  }\n\n  public getData(options?: { itemKeys: string[] }): Map<string, ListType> {\n    if (options?.itemKeys) {\n      const filteredData = new Map();\n      options.itemKeys.forEach((key) => {\n        const entry = this.data.get(key);\n        if (entry) {\n          filteredData.set(entry.key, entry);\n        }\n      });\n      return filteredData;\n    }\n    return this.data;\n  }\n\n  public getDataAsArray(): ListType[] {\n    return Array.from(this.data.values());\n  }\n\n  public getEntry(key: string): ListType | undefined {\n    return this.data.get(key);\n  }\n\n  private setRefValue(item: ListItem, value: REF_VALUE): void {\n    if (this.modelParser.initOptions.referenceMetadata?.enabled) {\n      Object.defineProperty(item, EntryMetadataValues.REF_VALUE, {\n        value: value,\n        enumerable: true,\n        writable: false,\n        configurable: false,\n      });\n    }\n  }\n\n  // ========== PARTIAL UPDATE METHODS ==========\n  // These methods support selective attribute processing for partial updates\n\n  /**\n   * The raw rows of the items a referrer auto-created so far, by key: a copy, so the items a\n   * partial update auto-creates while it runs stay out of it (#608).\n   */\n  public getAutoCreatedRows(): Map<string, ListType> {\n    return new Map(this.autoCreatedRows);\n  }\n\n  /**\n   * Re-derives the given attributes of the auto-created `rows` (getAutoCreatedRows() before the\n   * update) that are still items and not rows of `container` (#608). A partial update that\n   * re-derives an attribute's errors for every row drops the errors of every item, but\n   * reprocesses only the container's rows: init() records the auto-created items' errors when\n   * the referrer creates them, after the model's own rows and their aggregates, so the partial\n   * path re-derives them after its cleanUpErrors() too. An item the update auto-created records\n   * its errors itself, so it is not in `rows`.\n   */\n  public reprocessAutoCreatedRows(\n    container: DataContainer<ListType>,\n    attributes: ReadonlySet<string>,\n    rows: ReadonlyMap<string, ListType>,\n  ): void {\n    if (rows.size === 0 || attributes.size === 0) {\n      return;\n    }\n    const containerKeys = new Set(container.data.map((row) => String(row.key)));\n    const autoRows: ListType[] = [];\n    for (const [key, row] of rows) {\n      if (!containerKeys.has(key) && this.data.has(key)) {\n        autoRows.push(row);\n      }\n    }\n    if (autoRows.length > 0) {\n      this.addBasicPropertiesAndReferencesPartial({ model: this.key, data: autoRows }, new Set(attributes));\n    }\n  }\n\n  /**\n   * Processes only specific basic properties and references (Step 1)\n   * @param container - Data container to process\n   * @param attributesToProcess - Set of attribute keys to process\n   */\n  public addBasicPropertiesAndReferencesPartial(\n    container: DataContainer<ListType>,\n    attributesToProcess: Set<string>,\n    pendingItemKeys: Set<string> | undefined = this.getPendingItemKeys(container.data),\n  ): void {\n    const properties = this.getBasicProperties().filter((p) => attributesToProcess.has(p.key));\n    const references = this.getBasicReferences().filter((r) => attributesToProcess.has(r.key));\n    this.pendingItemKeys = pendingItemKeys;\n    const origin =\n      this.modelParser.qualityController.dcupl?.getContainerSourceMetadata(container as DataContainer)?.origin ??\n      'inline';\n\n    for (let rawDataEntry of container.data) {\n      // A row with no key cannot be identified. Previously String(undefined)\n      // stored it under the literal key 'undefined' (and multiple such rows\n      // collided). Surface it as MissingKey and drop the row instead.\n      if (rawDataEntry.key === undefined || rawDataEntry.key === null) {\n        const effectiveKeyProperty = container.keyProperty ?? this.keyProperty;\n        const effectiveSeparator =\n          container.keyPropertySeparator ?? this.keyPropertySeparator ?? DEFAULT_KEY_PROPERTY_SEPARATOR;\n        const keyAttribute = joinKeyProperty(effectiveKeyProperty, effectiveSeparator);\n        this.setError({\n          title: 'Missing Key',\n          type: 'model',\n          errorGroup: 'DataContainerError',\n          errorType: 'MissingKey',\n          description: this.sharedErrorDescription(\n            ['MissingKey', container.model, keyAttribute].join('\\u0000'),\n            () =>\n              `A row in model \"${container.model}\" has no value for the key attribute \"${keyAttribute}\"; the row is dropped.`,\n          ),\n          attribute: keyAttribute,\n          model: container.model,\n        });\n        continue;\n      }\n\n      let dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n\n      if (!dataEntry) {\n        dataEntry = {\n          key: String(rawDataEntry.key),\n        } as ListType;\n      }\n\n      // Handle Properties\n      for (const property of properties) {\n        if (property.origin) {\n          asWritable(rawDataEntry)[property.key] = rawDataEntry[property.origin];\n        }\n\n        const valueMapping = this.valueMappings.find((map) => map.attributes.includes(property.key));\n        if (this.isValidValueMapping(valueMapping)) {\n          rawDataEntry = this.mapRawValueUsingValueMapping(rawDataEntry, property.key, valueMapping!);\n        }\n\n        // As on the full path's fresh entry, a raw value that is missing or\n        // that the coercion or a strict validator rejects leaves no value\n        // instead of keeping the previous one (#368).\n        if (!this.processBasicProperty(property, rawDataEntry, dataEntry, origin) && property.key in dataEntry) {\n          delete asWritable(dataEntry)[property.key];\n        }\n      }\n\n      // Handle References\n      for (const reference of references) {\n        const qualityConfig = this.attributeQualityConfigs.get(reference.key);\n\n        if (reference.origin) {\n          asWritable(rawDataEntry)[reference.key] = rawDataEntry[reference.origin];\n        }\n\n        const valueMapping = this.valueMappings.find((map) => map.attributes.includes(reference.key));\n        if (this.isValidValueMapping(valueMapping)) {\n          rawDataEntry = this.mapRawValueUsingValueMapping(rawDataEntry, reference.key, valueMapping!);\n        }\n\n        let referenceValue: ReferenceDataTypes<ListType> = rawDataEntry[reference.key];\n\n        if (typeof referenceValue === 'number') {\n          referenceValue = String(referenceValue);\n        }\n\n        // Get old value BEFORE processing to update inverse index correctly\n        const oldReferenceValue = dataEntry[reference.key];\n\n        // #244: this reference's value may change — a grouped-reference\n        // reverse index built from it is stale now. Drop it so the next\n        // grouped-reference pass rebuilds from current data (it is otherwise\n        // only cleared on a full resetData()).\n        this.groupedRefReverseIndex.delete(reference.key);\n\n        if (!referenceValue) {\n          // Remove the old mapping, also an old null or undefined one\n          this.indicesController.removeFromInverseIndex(reference.key, dataEntry.key, [oldReferenceValue]);\n\n          // An explicit null is kept and indexed under null, as on the full path (#215)\n          const emptyValue: any = referenceValue === null ? null : undefined;\n          this.indicesController.fillInverseIndex(reference.key, dataEntry.key, [emptyValue]);\n\n          if (emptyValue === null) {\n            asWritable(dataEntry)[reference.key] = null;\n            // A null reference is a NullValue unless nullable, as for a property\n            if (!qualityConfig?.nullable) {\n              this.setError(this.getNullReferenceError(reference, rawDataEntry, container.model));\n            }\n          } else {\n            // Clear the reference value in the data entry\n            delete dataEntry[reference.key];\n          }\n\n          if (emptyValue !== null && qualityConfig?.required) {\n            this.setError({\n              title: 'Undefined Value',\n              type: 'model',\n              errorGroup: 'ReferenceDataError',\n              errorType: 'UndefinedValue',\n              description: this.sharedErrorDescription(\n                ['UndefinedValue', 'reference', reference.key, reference.type, this.key].join('\\u0000'),\n                () =>\n                  `The required ${reference.type} reference \"${reference.key}\" in the \"${this.key}\" model is undefined`,\n              ),\n              itemKey: rawDataEntry.key,\n              attribute: reference.key,\n              model: container.model,\n              meta: {\n                rawValue: referenceValue,\n                declaredType: reference.type,\n                origin: origin,\n              },\n            });\n          }\n          continue;\n        }\n\n        if (reference.type === 'singleValued') {\n          if (\n            (typeof referenceValue === 'object' || typeof referenceValue === 'string') &&\n            !Array.isArray(referenceValue)\n          ) {\n            // Remove the old value (also an old null or undefined) from the inverse index before\n            // adding the new one\n            if (oldReferenceValue?.key !== referenceValue) {\n              this.indicesController.removeFromInverseIndex(reference.key, dataEntry.key, [oldReferenceValue]);\n            }\n            this.processSingleValuedReference(reference, referenceValue, dataEntry);\n          } else {\n            this.setError({\n              title: 'Wrong Data Type',\n              type: 'model',\n              errorGroup: 'ReferenceDataError',\n              errorType: 'WrongDataType',\n              description: `Expect ${reference.type} but got ${typeof referenceValue} with value ${referenceValue}`,\n              itemKey: rawDataEntry.key,\n              attribute: reference.key,\n              meta: {\n                value: referenceValue,\n              },\n            });\n          }\n        } else if (reference.type === 'multiValued') {\n          const arrayValue = this.getValueAsArray(referenceValue, reference?.separator);\n          if (Array.isArray(arrayValue)) {\n            // Remove the old values (also an old null or undefined) from the inverse index before\n            // adding the new ones\n            this.indicesController.removeFromInverseIndex(reference.key, dataEntry.key, [oldReferenceValue]);\n            this.processMultiValuedReference(reference, arrayValue, dataEntry);\n          } else {\n            this.setError({\n              title: 'Wrong Data Type',\n              type: 'model',\n              errorGroup: 'ReferenceDataError',\n              errorType: 'WrongDataType',\n              description: `Expect ${reference.type} but got ${typeof referenceValue} with value ${referenceValue}`,\n              itemKey: rawDataEntry.key,\n              attribute: reference.key,\n              meta: {\n                value: referenceValue,\n              },\n            });\n          }\n        }\n      }\n\n      const stringKey = String(dataEntry.key);\n      (dataEntry as any).key = stringKey;\n      this.data.set(stringKey, dataEntry);\n    }\n    this.pendingItemKeys = undefined;\n  }\n\n  /**\n   * Processes only specific query and resolved references (Step 2)\n   * @param container - Data container to process\n   * @param attributesToProcess - Set of attribute keys to process\n   */\n  public addQueryAndResolvedReferencesPartial(\n    container: DataContainer<ListType>,\n    attributesToProcess: Set<string>,\n  ): void {\n    // Process query references\n    if (this.hasQueryReferences()) {\n      const queryReferences = this.getQueryReferences().filter((r) => attributesToProcess.has(r.key));\n\n      for (let qR of queryReferences) {\n        // #121 Performance optimization: Pre-stringify query once per reference instead of per item\n        const strigifiedQuery = JSON.stringify(qR.query);\n\n        for (let rawDataEntry of container.data) {\n          let dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n          if (!dataEntry) continue;\n\n          const resolvedQuery = evaluateTemplate(strigifiedQuery, { ...rawDataEntry });\n          const parsedQuery = JSON.parse(resolvedQuery);\n\n          const qb: DcuplQueryBuilder = new DcuplQueryBuilder();\n          qb.init({ modelKey: qR.model });\n          qb.applyQuery(parsedQuery, { mode: 'set' });\n\n          // Only apply default projection if the query doesn't specify one\n          // This allows sort, pagination, and custom projection from query reference definitions\n          if (!parsedQuery.projection) {\n            qb.applyOptions({ projection: { $: false } });\n          }\n\n          const finalQuery = qb.getQuery();\n\n          if (finalQuery.queries.length > 0) {\n            const result = this.modelParser.dcuplInstance.query.execute(finalQuery);\n\n            if (qR.type === 'singleValued') {\n              if (result[0]) {\n                asWritable(dataEntry)[qR.key] = { key: result[0].key, _dcupl_ref_: 'hit' };\n              }\n            } else if (qR.type === 'multiValued') {\n              result.forEach((entry) => {\n                entry._dcupl_ref_ = 'hit';\n              });\n              asWritable(dataEntry)[qR.key] = result;\n            }\n          } else {\n            if (qR.type === 'singleValued') {\n              asWritable(dataEntry)[qR.key] = null;\n            } else if (qR.type === 'multiValued') {\n              asWritable(dataEntry)[qR.key] = [];\n            }\n          }\n\n          const stringKey = String(dataEntry.key);\n          (dataEntry as any).key = stringKey;\n          this.data.set(stringKey, dataEntry);\n        }\n      }\n    }\n\n    // Process resolved references\n    if (this.hasResolvedReferences()) {\n      const resolvedReferences = this.getResolvedReferences().filter((r) => attributesToProcess.has(r.key));\n\n      if (resolvedReferences.length > 0) {\n        // For resolved references in partial updates, we need to rebuild for ALL items\n        // because changes in the remote model affect all items in this model\n        // For example, if products.categoryRef changes, categories.products needs to be rebuilt for ALL categories\n        this.rebuildResolvedReferencesForAllItems();\n      }\n    }\n  }\n\n  /**\n   * Creates an expanded context object for expression evaluation\n   * Resolves references so expressions can access nested properties like productRef.baseCost\n   */\n  private createExpressionContext(dataEntry: ListType): Record<string, any> {\n    const context: Record<string, any> = { ...dataEntry };\n\n    // Expand all references\n    this.references.forEach((reference, refKey) => {\n      const refValue = dataEntry[refKey];\n      if (!refValue) return;\n\n      const remoteModel = this.modelParser.models.get(reference.model);\n      if (!remoteModel) return;\n\n      if (reference.type === 'singleValued' && typeof refValue === 'object' && 'key' in refValue) {\n        // Expand single-valued reference\n        const remoteEntry = remoteModel.getData().get((refValue as ListItem).key);\n        if (remoteEntry) {\n          // Recursively expand nested references\n          context[refKey] = this.createNestedContext(remoteEntry, remoteModel);\n        }\n      } else if (reference.type === 'multiValued' && Array.isArray(refValue)) {\n        // Expand multi-valued references\n        context[refKey] = refValue\n          .map((item: ListItem) => {\n            const remoteEntry = remoteModel.getData().get(item.key);\n            return remoteEntry ? this.createNestedContext(remoteEntry, remoteModel) : null;\n          })\n          .filter(Boolean);\n      }\n    });\n\n    return context;\n  }\n\n  /**\n   * Helper to recursively expand nested references (up to one level deep to avoid infinite recursion)\n   */\n  private createNestedContext(entry: ListItem, model: DcuplModel): Record<string, any> {\n    const context: Record<string, any> = { ...entry };\n\n    model.references.forEach((reference, refKey) => {\n      const refValue = entry[refKey];\n      if (!refValue) return;\n\n      const remoteModel = this.modelParser.models.get(reference.model);\n      if (!remoteModel) return;\n\n      if (reference.type === 'singleValued' && typeof refValue === 'object' && 'key' in refValue) {\n        const remoteEntry = remoteModel.getData().get((refValue as ListItem).key);\n        if (remoteEntry) {\n          // Shallow copy to avoid deep recursion\n          context[refKey] = { ...remoteEntry };\n        }\n      }\n    });\n\n    return context;\n  }\n\n  /**\n   * Processes only specific derived/grouped references and derived/expression properties (Step 3)\n   * @param container - Data container to process\n   * @param attributesToProcess - Set of attribute keys to process\n   */\n  public addDerivedAndExpressionAttributesPartial(\n    container: DataContainer<ListType>,\n    attributesToProcess: Set<string>,\n  ): void {\n    const derivedProperties = this.getDerivedPropertiesForBasicAndDerivedReferences().filter((p) =>\n      attributesToProcess.has(p.key),\n    );\n    const derivedReferences = this.getDerivedReferences().filter((r) => attributesToProcess.has(r.key));\n    const groupedReferences = this.getGroupedReferences().filter((r) => attributesToProcess.has(r.key));\n    const expressionProperties = this.getExpressionProperties().filter((p) => attributesToProcess.has(p.key));\n\n    for (const rawDataEntry of container.data) {\n      const dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n      if (!dataEntry) continue;\n\n      // Process derived references\n      derivedReferences.forEach((reference) => {\n        this.handleDerivedReferences(reference, dataEntry);\n      });\n\n      // Process grouped references\n      groupedReferences.forEach((reference) => {\n        this.handleGroupedReferences(reference, dataEntry);\n      });\n\n      // Process derived properties\n      derivedProperties.forEach((prop) => {\n        this.handleDerivedProperties(prop, dataEntry);\n      });\n\n      // Process expression properties\n      expressionProperties.forEach((prop) => {\n        this.handleExpressionProperty(prop, dataEntry);\n      });\n\n      const stringKey = String(dataEntry.key);\n      (dataEntry as any).key = stringKey;\n      this.data.set(stringKey, dataEntry);\n    }\n  }\n\n  /**\n   * Re-runs only specific derived properties based on resolved references (Step 4)\n   * @param container - Data container to process\n   * @param attributesToProcess - Set of attribute keys to process\n   */\n  public reRunDerivedPropertiesBasedOnResolvesPartial(\n    container: DataContainer<ListType>,\n    attributesToProcess: Set<string>,\n  ): void {\n    const derivedProperties = this.getDerivedProperties().filter((p) => attributesToProcess.has(p.key));\n    const derivedReferences = this.getDerivedReferences().filter((r) => attributesToProcess.has(r.key));\n\n    for (const rawDataEntry of container.data) {\n      const dataEntry = this.data.get(String(rawDataEntry.key)) as ListType;\n      if (!dataEntry) continue;\n\n      // Re-run derived references\n      derivedReferences.forEach((reference) => {\n        this.handleDerivedReferences(reference, dataEntry);\n      });\n\n      // Re-run derived properties\n      derivedProperties.forEach((prop) => {\n        this.handleDerivedProperties(prop, dataEntry);\n      });\n\n      const stringKey = String(dataEntry.key);\n      (dataEntry as any).key = stringKey;\n      this.data.set(stringKey, dataEntry);\n    }\n  }\n}\n","import {\n  AnalyticsEntryResource,\n  AnalyticsEntryResourceValue,\n  AttributeValidatorConfig,\n  // CustomValidatorConfig,\n  DataContainer,\n  ListItem,\n  QualityAnalyzer,\n  ScriptController,\n  ValidatorConfig,\n  generateKey,\n  logger,\n} from '@dcupl/common';\nimport { DcuplModel, ModelParser } from '../model-parser';\nimport { DcuplApi } from '../dcupl/dcupl-api';\nimport { endsWith, groupBy, includes } from 'lodash-es';\n\n/** Key prefix of the models that publish the error records (#444: built on first read). */\nexport const ERROR_TRACKING_MODEL_PREFIX = '$DcuplErrorTracking';\n\n/** The models whose rows initData() stages and the first read builds. */\nconst ERROR_TRACKING_ROW_MODELS: readonly string[] = ['$DcuplErrorTrackingErrors', '$DcuplErrorTrackingSummary'];\n\ntype ErrorCountGroup = {\n  model?: string;\n  attribute?: string;\n  errorGroup: string;\n  errorType: string;\n  type: QualityAnalyzer.DcuplErrorType;\n  count: number;\n};\n\n/**\n * Error types the data pipeline derives from an attribute's values: the\n * per-row checks of step 1 (incl. lossy coercion and validators), the\n * `unique` validator and the per-attribute aggregates of cleanUpErrors().\n * A partial update re-derives exactly these (#368).\n */\nconst ATTRIBUTE_ERROR_TYPES: ReadonlySet<string> = new Set([\n  'UndefinedValue',\n  'NullValue',\n  'WrongDataType',\n  'InvalidValidator',\n  'RemoteReferenceKeyNotFound',\n  'UndefinedAttribute',\n]);\n\n/** Error groups the data pipeline re-detects (see resetDataErrors). */\nconst DATA_ERROR_GROUPS: readonly string[] = ['ReferenceDataError', 'PropertyDataError', 'DataContainerError'];\n\nconst UNIQUE_ERROR_TITLE = 'Validator Error - Unique';\n\n/**\n * QualityController manages data quality validation and error tracking.\n *\n * TWO-TIER VALIDATION SYSTEM:\n * For validation to occur, BOTH conditions must be true:\n * 1. Global flag: qualityController.enabled (set via errorTracking.enabled OR quality.enabled in init options)\n * 2. Per-model flag: model.qualityConfig.enabled (defined in each model's quality configuration)\n *\n * This allows fine-grained control: disable validation globally for performance,\n * or enable/disable validation for specific models.\n */\nexport class QualityController {\n  public enabled = false;\n  public maxErrorsPerGroup = 1000;\n  private errors: Map<string, QualityAnalyzer.DcuplError> = new Map();\n  private errorCounts: Map<string, ErrorCountGroup> = new Map();\n  // Whether the error records changed since initData() last published them to\n  // the $DcuplErrorTracking* models (#368).\n  private errorsChangedSinceInitData = true;\n  // The containers initData() queued for $DcuplErrorTrackingErrors / -Summary and nothing has\n  // processed yet: the error set of the last init()/update(), built on first read (#444).\n  private pendingErrorTrackingContainers: DataContainer[] | undefined;\n  // The model-definition errors init re-detects from the registered definitions (#417): the keys\n  // of the stored records, and per error group how many were counted without a stored record\n  // (beyond maxErrorsPerGroup).\n  private definitionErrorKeys: Set<string> = new Set();\n  private unstoredDefinitionErrors: Map<string, number> = new Map();\n  private log = logger.child({ prefix: 'QualityController' });\n\n  public values: QualityAnalyzer.AnalyticsValues = {\n    loading: 0,\n    processing: 0,\n    startup: 0,\n    counts: {\n      resources: 0, // todo\n      modelFiles: 0,\n      dataFiles: 0,\n      models: 0,\n      rows: 0,\n      attributes: 0,\n      dataEntries: 0,\n    },\n    unusedAttributes: [],\n    errors: {\n      size: 0,\n      UndefinedValue: 0,\n      UndefinedAttribute: 0,\n      WrongDataType: 0,\n      MissingModel: 0,\n      InvalidModelDescription: 0,\n      RemoteReferenceKeyNotFound: 0,\n    },\n    sizes: {\n      totalEncoded: 0,\n      totalDecoded: 0,\n      unusedDecoded: 0,\n      models: [],\n    },\n  };\n\n  public modelParser: ModelParser | undefined;\n  public dcupl!: DcuplApi;\n\n  constructor(public scriptsController: ScriptController) {}\n\n  private getErrorGroupKey(error: QualityAnalyzer.DcuplError): string {\n    const attribute = 'attribute' in error ? error.attribute : undefined;\n    return `${error.model ?? ''}::${attribute ?? ''}::${error.errorType}`;\n  }\n\n  /**\n   * Exact occurrence count for an error group, independent of the per-group\n   * storage cap (#177). Lets consolidation reflect the true number of affected\n   * rows even when stored error objects are capped at maxErrorsPerGroup.\n   */\n  private getGroupCount(model: string | undefined, attribute: string | undefined, errorType: string): number {\n    const key = `${model ?? ''}::${attribute ?? ''}::${errorType}`;\n    return this.errorCounts.get(key)?.count ?? 0;\n  }\n\n  public setError(error: QualityAnalyzer.DcuplError): void {\n    this.errorsChangedSinceInitData = true;\n    const groupKey = this.getErrorGroupKey(error);\n    let group = this.errorCounts.get(groupKey);\n    if (!group) {\n      group = {\n        model: error.model,\n        attribute: 'attribute' in error ? error.attribute : undefined,\n        errorGroup: error.errorGroup,\n        errorType: error.errorType,\n        type: error.type,\n        count: 0,\n      };\n      this.errorCounts.set(groupKey, group);\n    }\n    group.count += 1;\n\n    if (group.count > this.maxErrorsPerGroup) {\n      return;\n    }\n\n    if (!error.key) {\n      error.key = generateKey();\n    }\n    this.errors.set(error.key, error);\n  }\n\n  /**\n   * Records a model-definition error that init re-detects from the registered definitions on every\n   * run (attribute checks when a model is built, `validateModels`), so `resetDefinitionErrors` can\n   * drop exactly these before the next run (#417). Registration errors (an invalid definition passed\n   * to `models.set`, loader errors) go through `setError` and stay.\n   */\n  public setDefinitionError(error: QualityAnalyzer.DcuplError): void {\n    this.setError(error);\n    if (error.key !== undefined && this.errors.get(error.key) === error) {\n      this.definitionErrorKeys.add(error.key);\n    } else {\n      const groupKey = this.getErrorGroupKey(error);\n      this.unstoredDefinitionErrors.set(groupKey, (this.unstoredDefinitionErrors.get(groupKey) ?? 0) + 1);\n    }\n  }\n\n  /**\n   * Drops the `InvalidModelDefinition` errors recorded when a definition for `modelKey` was\n   * rejected at registration (an invalid `models.set`, a loader file): a valid `models.set`\n   * replaces the whole definition for the key, so they no longer describe it (#417).\n   */\n  public removeRejectedDefinitionErrors(modelKey: string): void {\n    const isRejection = (error: QualityAnalyzer.DcuplError): boolean =>\n      error.type === 'model' &&\n      error.errorType === 'InvalidModelDefinition' &&\n      error.model === modelKey &&\n      !('attribute' in error && error.attribute);\n    for (const error of this.getErrors()) {\n      if (isRejection(error)) {\n        this.removeError(error.key!);\n      }\n    }\n    // records beyond maxErrorsPerGroup are counted without being stored\n    this.errorCounts.delete(`${modelKey}::::InvalidModelDefinition`);\n  }\n\n  /**\n   * Drops the errors recorded with `setDefinitionError` (#417). init calls it before it builds the\n   * models and runs `validateModels`, which record them again from the current definitions: without\n   * it, a changed definition kept the old definition's errors and every re-init counted the same\n   * errors once more.\n   */\n  public resetDefinitionErrors(): void {\n    if (this.definitionErrorKeys.size === 0 && this.unstoredDefinitionErrors.size === 0) {\n      return;\n    }\n    this.errorsChangedSinceInitData = true;\n    for (const key of this.definitionErrorKeys) {\n      this.removeError(key);\n    }\n    for (const [groupKey, count] of this.unstoredDefinitionErrors) {\n      const group = this.errorCounts.get(groupKey);\n      if (group) {\n        group.count -= count;\n        if (group.count <= 0) {\n          this.errorCounts.delete(groupKey);\n        }\n      }\n    }\n    this.definitionErrorKeys.clear();\n    this.unstoredDefinitionErrors.clear();\n  }\n\n  public getErrorCounts(): Array<{\n    model?: string;\n    attribute?: string;\n    errorType: string;\n    count: number;\n  }> {\n    return Array.from(this.errorCounts.values()).map(({ model, attribute, errorType, count }) => ({\n      model,\n      attribute,\n      errorType,\n      count,\n    }));\n  }\n\n  /**\n   * One entry per (model, attribute, errorType) group with the exact\n   * occurrence count and how many error objects were actually retained under\n   * the `maxErrorsPerGroup` cap (#204). Sized by group count, not error count,\n   * so it stays small no matter how many errors a dataset produces.\n   */\n  public getErrorSummary(): QualityAnalyzer.ErrorGroupSummary[] {\n    const storedPerGroup = new Map<string, number>();\n    for (const error of this.errors.values()) {\n      const groupKey = this.getErrorGroupKey(error);\n      storedPerGroup.set(groupKey, (storedPerGroup.get(groupKey) ?? 0) + 1);\n    }\n\n    const summary: QualityAnalyzer.ErrorGroupSummary[] = [];\n    for (const [groupKey, group] of this.errorCounts) {\n      const storedCount = storedPerGroup.get(groupKey) ?? 0;\n      summary.push({\n        key: groupKey,\n        model: group.model,\n        attribute: group.attribute,\n        errorGroup: group.errorGroup,\n        errorType: group.errorType,\n        type: group.type,\n        totalCount: group.count,\n        storedCount,\n        truncated: group.count > storedCount,\n      });\n    }\n    return summary;\n  }\n\n  /**\n   * Stamps `groupTotal` / `truncated` onto every retained error object so the\n   * `$DcuplErrorTrackingErrors` rows themselves reveal when their group was\n   * capped (#204). Mutates in place: bounded by the number of stored errors,\n   * no per-error allocation.\n   */\n  private stampGroupTotals(summary: QualityAnalyzer.ErrorGroupSummary[]): void {\n    const byGroup = new Map(summary.map((s) => [s.key, s]));\n    for (const error of this.errors.values()) {\n      const group = byGroup.get(this.getErrorGroupKey(error));\n      error.groupTotal = group?.totalCount ?? 1;\n      error.truncated = group?.truncated ?? false;\n    }\n  }\n\n  public removeError(key: string): void {\n    this.errorsChangedSinceInitData = true;\n    const error = this.errors.get(key);\n    if (error) {\n      const groupKey = this.getErrorGroupKey(error);\n      const group = this.errorCounts.get(groupKey);\n      if (group) {\n        group.count -= 1;\n        if (group.count <= 0) {\n          this.errorCounts.delete(groupKey);\n        }\n      }\n    }\n    this.errors.delete(key);\n  }\n\n  public getError(key: string): QualityAnalyzer.DcuplError | undefined {\n    return this.errors.get(key);\n  }\n\n  public getErrors(): QualityAnalyzer.DcuplError[] {\n    return Array.from(this.errors.values());\n  }\n\n  public resetErrors(): void {\n    this.errorsChangedSinceInitData = true;\n    this.errors.clear();\n    this.errorCounts.clear();\n    this.definitionErrorKeys.clear();\n    this.unstoredDefinitionErrors.clear();\n  }\n\n  public resetModelErrors(): void {\n    this.errorsChangedSinceInitData = true;\n    this.getErrors().forEach((e) => {\n      if (e.type === 'model') {\n        this.removeError(e.key!);\n      }\n    });\n    for (const [groupKey, group] of this.errorCounts) {\n      if (group.type === 'model') {\n        this.errorCounts.delete(groupKey);\n      }\n    }\n    // definition errors are model errors\n    this.definitionErrorKeys.clear();\n    this.unstoredDefinitionErrors.clear();\n  }\n\n  /** Drops every model error recorded for `modelKey`: `models.remove` unregisters the model (#420). */\n  public removeErrorsOfModel(modelKey: string): void {\n    for (const error of this.getErrors()) {\n      if (error.type === 'model' && error.model === modelKey) {\n        this.removeError(error.key!);\n      }\n    }\n    // records beyond maxErrorsPerGroup are counted without being stored\n    for (const [groupKey, group] of this.errorCounts) {\n      if (group.type === 'model' && group.model === modelKey) {\n        this.errorCounts.delete(groupKey);\n      }\n    }\n  }\n\n  public resetValidationErrors(): void {\n    this.errorsChangedSinceInitData = true;\n    this.getErrors().forEach((e) => {\n      // Only reset validation errors (InvalidValidator), not model definition errors\n      if (e.type === 'model' && e.errorType === 'InvalidValidator') {\n        this.removeError(e.key!);\n      }\n    });\n    // Counts must be cleared alongside the stored errors, otherwise\n    // getErrorCounts() keeps accumulating across update() cycles (see issue #177).\n    for (const [groupKey, group] of this.errorCounts) {\n      if (group.type === 'model' && group.errorType === 'InvalidValidator') {\n        this.errorCounts.delete(groupKey);\n      }\n    }\n  }\n\n  /**\n   * Resets every error that the data processing pipeline re-detects during a\n   * full (re-)initialization: reference, property and data-container errors.\n   *\n   * Without this, errors such as RemoteReferenceKeyNotFound accumulate on each\n   * update() cycle because resetValidationErrors() only clears InvalidValidator\n   * errors (see issue #174, Bug 2).\n   *\n   * Model-definition errors ('ModelDefinitionError') and loader errors\n   * (type 'loader') are preserved because init() does not re-generate them.\n   */\n  public resetDataErrors(): void {\n    this.errorsChangedSinceInitData = true;\n    const reprocessedGroups: QualityAnalyzer.ModelErrorGroup[] = [\n      'ReferenceDataError',\n      'PropertyDataError',\n      'DataContainerError',\n    ];\n    this.getErrors().forEach((e) => {\n      if (e.type === 'model' && reprocessedGroups.includes(e.errorGroup)) {\n        this.removeError(e.key!);\n      }\n    });\n    // Counts must be cleared alongside the stored errors, otherwise\n    // getErrorCounts() keeps accumulating across update() cycles (see issue #177).\n    for (const [groupKey, group] of this.errorCounts) {\n      if (group.type === 'model' && reprocessedGroups.includes(group.errorGroup as QualityAnalyzer.ModelErrorGroup)) {\n        this.errorCounts.delete(groupKey);\n      }\n    }\n  }\n\n  /**\n   * Consolidates the per-row errors of `model` into per-attribute aggregates\n   * once its rows are processed. `attributes` limits it to those attributes —\n   * a partial update consolidates only the attributes it reprocessed (#368).\n   */\n  public cleanUpErrors(model: DcuplModel, dataContainer: DataContainer, attributes?: ReadonlySet<string>): void {\n    const isRelevant = (attribute: string): boolean => !attributes || attributes.has(attribute);\n    const sourceMetadata = this.dcupl?.getContainerSourceMetadata(dataContainer);\n    const modelKey = dataContainer.model;\n\n    if (sourceMetadata) {\n      const coercionSamples = sourceMetadata.coercionFailureSamples ?? {};\n\n      // ---- CSV / loader path: loader-confirmed coercion failures are authoritative.\n      // Trigger on count > 0 (not storedLength === rowCount) so the #177 cap can no\n      // longer suppress consolidation on large datasets. ----\n      for (const attribute of Object.keys(coercionSamples)) {\n        const sample = coercionSamples[attribute];\n        if (!sample || sample.count <= 0 || !isRelevant(attribute)) {\n          continue;\n        }\n        // A coercion-failed cell is nulled by the loader and surfaces as a per-row\n        // UndefinedValue (or as a per-row WrongDataType under forceStrictDataType).\n        // The single aggregate below subsumes both.\n        for (const error of this.getModelErrors(modelKey)) {\n          if (\n            error.attribute === attribute &&\n            error.itemKey != null &&\n            (error.errorType === 'UndefinedValue' || error.errorType === 'WrongDataType')\n          ) {\n            this.removeError(error.key!);\n          }\n        }\n        const declaredType =\n          (model.properties.get(attribute) as { type?: string } | undefined)?.type ?? sample.expected;\n        this.setError(this.buildColumnCoercionError(modelKey, attribute, sample.rawValue, declaredType, sample.count));\n      }\n\n      // ---- Absent column: declared on the model but not present in the source.\n      // Uses the exact count so it survives the cap the same way. ----\n      for (const [attribute] of model.properties) {\n        if (coercionSamples[attribute] || sourceMetadata.sourceColumns.includes(attribute) || !isRelevant(attribute)) {\n          continue;\n        }\n        const undefinedCount = this.getGroupCount(modelKey, attribute, 'UndefinedValue');\n        if (undefinedCount > 0 && undefinedCount === dataContainer.data.length) {\n          for (const error of this.getModelErrors(modelKey)) {\n            if (error.attribute === attribute && error.itemKey != null && error.errorType === 'UndefinedValue') {\n              this.removeError(error.key!);\n            }\n          }\n          this.setError(this.buildAbsentColumnError(modelKey, attribute));\n        }\n      }\n    } else {\n      // ---- Inline / programmatic path (no loader source metadata). ----\n      // (a) uses getGroupCount (exact, cap-safe) for its comparison.\n      // (b) cannot use getGroupCount because lossy errors share the WrongDataType\n      //     count key; it uses group.length instead, which is bounded by\n      //     maxErrorsPerGroup (see the note on (b)).\n\n      // (a) Every row missing an attribute → collapse per-row UndefinedValue\n      // into a single UndefinedAttribute.\n      const undefinedAttributes = new Set(\n        this.getModelErrors(modelKey)\n          .filter((error) => error.errorType === 'UndefinedValue' && error.attribute != null)\n          .map((error) => error.attribute as string),\n      );\n      for (const attribute of undefinedAttributes) {\n        if (!isRelevant(attribute)) {\n          continue;\n        }\n        const undefinedCount = this.getGroupCount(modelKey, attribute, 'UndefinedValue');\n        if (undefinedCount > 0 && undefinedCount === dataContainer.data.length) {\n          for (const error of this.getModelErrors(modelKey)) {\n            if (error.attribute === attribute && error.itemKey != null && error.errorType === 'UndefinedValue') {\n              this.removeError(error.key!);\n            }\n          }\n          this.setError(this.buildAbsentColumnError(modelKey, attribute));\n        }\n      }\n\n      // (b) Per-row WrongDataType *property* coercion failures → collapse into a\n      // single aggregate per attribute. Excludes lossy coercion ('Lossy Data\n      // Coercion', which shares the WrongDataType errorType) and reference\n      // errors. rowCount uses the filtered group size (group.length) rather than\n      // getGroupCount, because lossy errors share the (model, attribute,\n      // WrongDataType) count key and would otherwise inflate the total.\n      // NOTE: group.length is bounded by maxErrorsPerGroup (#177), so for this\n      // inline path rowCount under-reports when there are more than\n      // maxErrorsPerGroup non-lossy failures. The CSV path (the primary\n      // production path) is exact via the loader count; this is an accepted\n      // limitation for inline data.\n      const propertyCoercionErrors = this.getModelErrors(modelKey).filter(\n        (error) =>\n          error.errorType === 'WrongDataType' &&\n          error.errorGroup === 'PropertyDataError' &&\n          error.title === 'Wrong Data Type' &&\n          error.itemKey != null,\n      );\n      const groupedByAttribute = groupBy(propertyCoercionErrors, 'attribute');\n      for (const attribute in groupedByAttribute) {\n        const group = groupedByAttribute[attribute];\n        if (!group?.length || !isRelevant(attribute)) {\n          continue;\n        }\n        const firstMeta = group[0]!.meta as { rawValue?: unknown; expected?: string } | undefined;\n        const declaredType =\n          (model.properties.get(attribute) as { type?: string } | undefined)?.type ?? firstMeta?.expected ?? 'unknown';\n        for (const error of group) {\n          this.removeError(error.key!);\n        }\n        this.setError(\n          this.buildColumnCoercionError(\n            modelKey,\n            attribute,\n            String(firstMeta?.rawValue ?? ''),\n            declaredType,\n            group.length,\n          ),\n        );\n      }\n    }\n  }\n\n  private buildColumnCoercionError(\n    model: string,\n    attribute: string,\n    rawValue: string,\n    declaredType: string,\n    rowCount: number,\n  ): QualityAnalyzer.InternalModelError {\n    return {\n      title: 'Wrong Data Type',\n      type: 'model',\n      errorGroup: 'DataContainerError',\n      errorType: 'WrongDataType',\n      model,\n      attribute,\n      description: `${rowCount} value(s) in column \"${attribute}\" of model \"${model}\" failed to coerce to the declared type \"${declaredType}\" (e.g. \"${rawValue}\")`,\n      meta: {\n        rawValue,\n        declaredType,\n        rowCount,\n      },\n    };\n  }\n\n  private buildAbsentColumnError(model: string, attribute: string): QualityAnalyzer.InternalModelError {\n    return {\n      title: 'Missing Data',\n      type: 'model',\n      errorGroup: 'DataContainerError',\n      errorType: 'UndefinedAttribute',\n      model,\n      attribute,\n      description: `The Attribute \"${attribute}\" is not present in the dataset for model \"${model}\"`,\n    };\n  }\n\n  public getModelErrors(modelKey: string): QualityAnalyzer.InternalModelError[] {\n    return this.getErrors().filter(\n      (e) => e.type === 'model' && e.model === modelKey,\n    ) as QualityAnalyzer.InternalModelError[];\n  }\n\n  /**\n   * Clean up errors for specific items and attributes only\n   * @param model - The model to clean errors for\n   * @param itemKeys - Set of item keys to clean errors for\n   * @param attributesOrErrorType - Optional set of attribute keys to clean errors for, or errorType for backwards compatibility\n   * @param errorType - Optional error type to filter by\n   */\n  public cleanUpErrorsForItems(\n    model: DcuplModel,\n    itemKeys: Set<string>,\n    attributesOrErrorType?: Set<string> | QualityAnalyzer.ModelErrorType,\n    errorType?: QualityAnalyzer.ModelErrorType,\n  ): void {\n    // Handle backwards compatibility: if 3rd param is a string (errorType), treat it as such\n    let attributes: Set<string> | undefined;\n    let actualErrorType: QualityAnalyzer.ModelErrorType | undefined;\n\n    if (typeof attributesOrErrorType === 'string') {\n      // Backwards compat: 3rd param is errorType\n      actualErrorType = attributesOrErrorType;\n    } else if (attributesOrErrorType instanceof Set) {\n      // New behavior: 3rd param is attributes Set\n      attributes = attributesOrErrorType;\n      actualErrorType = errorType;\n    }\n\n    const modelErrors = this.getModelErrors(model.key);\n    const relevantErrors = actualErrorType\n      ? modelErrors.filter((error) => error.errorType === actualErrorType)\n      : modelErrors;\n\n    for (const error of relevantErrors) {\n      if (error.itemKey && itemKeys.has(error.itemKey)) {\n        // If attributes filter is provided, only remove errors for those attributes\n        if (attributes && error.attribute && !attributes.has(error.attribute)) {\n          continue;\n        }\n        this.removeError(error.key!);\n      }\n    }\n  }\n\n  /**\n   * Get errors for specific items\n   * @param modelKey - The model key\n   * @param itemKeys - Set of item keys to get errors for\n   * @returns Array of errors for the specified items\n   */\n  public getErrorsForItems(modelKey: string, itemKeys: Set<string>): QualityAnalyzer.InternalModelError[] {\n    const modelErrors = this.getModelErrors(modelKey);\n    return modelErrors.filter((error) => error.itemKey && itemKeys.has(error.itemKey));\n  }\n\n  /**\n   * Validate specific items and attributes only (partial validation)\n   * @param model - The model to validate\n   * @param itemKeys - Set of item keys to validate\n   * @param attributes - Set of attribute keys to validate\n   * @returns Array of validation errors found\n   */\n  public validateItemsPartial(\n    model: DcuplModel,\n    itemKeys: Set<string>,\n    attributes: Set<string>,\n  ): QualityAnalyzer.InternalModelError[] {\n    if (!model) {\n      return [];\n    }\n\n    const errors: QualityAnalyzer.InternalModelError[] = [];\n    const dataMap = model.getData();\n    const modelAttributes = model.getAttributes();\n\n    // Validate each specified attribute for each specified item\n    for (const attribute of modelAttributes) {\n      if (!attributes.has(attribute.key)) {\n        continue;\n      }\n\n      const validators = attribute.quality?.validators;\n      if (!validators) {\n        continue;\n      }\n\n      // Directly access only the items we need from the Map\n      for (const itemKey of itemKeys) {\n        const item = dataMap.get(itemKey);\n        if (!item) {\n          continue;\n        }\n\n        const value = item[attribute.key];\n\n        // Validate the attribute value\n        const attributeErrors = this.validateAttribute(value, validators, attribute.key);\n\n        // Add model and itemKey context to errors\n        for (const error of attributeErrors) {\n          error.model = model.key;\n          error.itemKey = item.key;\n          errors.push(error);\n        }\n      }\n    }\n\n    return errors;\n  }\n\n  /**\n   * Prepares the error records of `model` for a partial update, so that the\n   * update leaves the same records and summary() counts as init() on the same\n   * data (#368). Removes the errors the update re-derives:\n   * - every data error of a deleted item, except its NonUniqueKey: that one\n   *   describes the set payload and init() keeps it after a remove (#603);\n   * - the attribute errors of the changed items for the changed attributes —\n   *   step 1 of the partial path reprocesses exactly these rows (`itemKeys`)\n   *   and `attributes`;\n   * - the `unique` errors when rows changed: the check compares all rows and\n   *   finishPartialUpdate() re-runs it.\n   *\n   * Returns the attributes whose errors must be derived from every row\n   * instead; all their attribute errors are removed and the partial path\n   * reprocesses them for all rows:\n   * - an attribute with a per-attribute aggregate (UndefinedAttribute,\n   *   WrongDataType): the aggregate stands for rows the update does not\n   *   reprocess;\n   * - an attribute with an error group capped by `maxErrorsPerGroup`: its\n   *   unstored errors cannot be removed one by one;\n   * - a `unique` attribute with strict handling when rows changed: init()\n   *   dropped the duplicate values, only reprocessing restores them for the\n   *   re-check.\n   */\n  public prepareErrorsForPartialUpdate(\n    model: DcuplModel,\n    attributes: ReadonlySet<string>,\n    itemKeys: ReadonlySet<string>,\n    deletedItemKeys: ReadonlySet<string>,\n  ): Set<string> {\n    const allRowsAttributes = new Set<string>();\n    if (!this.enabled || model.qualityConfig.enabled !== true) {\n      return allRowsAttributes;\n    }\n\n    const rowsChanged = itemKeys.size > 0 || deletedItemKeys.size > 0;\n    const uniqueAttributes = rowsChanged ? this.getUniqueAttributes(model) : new Set<string>();\n    const modelErrors = this.getModelErrors(model.key);\n\n    const storedPerGroup = new Map<string, number>();\n    for (const error of modelErrors) {\n      const groupKey = this.getErrorGroupKey(error);\n      storedPerGroup.set(groupKey, (storedPerGroup.get(groupKey) ?? 0) + 1);\n      if (\n        error.attribute != null &&\n        error.itemKey == null &&\n        error.errorGroup === 'DataContainerError' &&\n        ATTRIBUTE_ERROR_TYPES.has(error.errorType) &&\n        (attributes.has(error.attribute) || uniqueAttributes.has(error.attribute))\n      ) {\n        allRowsAttributes.add(error.attribute);\n      }\n    }\n    for (const [groupKey, group] of this.errorCounts) {\n      if (\n        group.model === model.key &&\n        group.attribute != null &&\n        ATTRIBUTE_ERROR_TYPES.has(group.errorType) &&\n        (attributes.has(group.attribute) || uniqueAttributes.has(group.attribute)) &&\n        group.count > (storedPerGroup.get(groupKey) ?? 0)\n      ) {\n        allRowsAttributes.add(group.attribute);\n      }\n    }\n    for (const attribute of uniqueAttributes) {\n      if (this.isStrictValidatorHandling(model, attribute)) {\n        allRowsAttributes.add(attribute);\n      }\n    }\n\n    for (const error of modelErrors) {\n      const attribute = error.attribute;\n      const itemKey = error.itemKey == null ? undefined : String(error.itemKey);\n      if (\n        itemKey !== undefined &&\n        deletedItemKeys.has(itemKey) &&\n        DATA_ERROR_GROUPS.includes(error.errorGroup) &&\n        // A NonUniqueKey describes the set payload, which still holds the duplicate: init()\n        // keeps it after a remove too, until the data is set again (#369, #603)\n        error.errorType !== 'NonUniqueKey'\n      ) {\n        this.removeError(error.key!);\n      } else if (attribute == null || !ATTRIBUTE_ERROR_TYPES.has(error.errorType)) {\n        continue;\n      } else if (allRowsAttributes.has(attribute)) {\n        this.removeError(error.key!);\n      } else if (\n        itemKey !== undefined &&\n        itemKeys.has(itemKey) &&\n        attributes.has(attribute) &&\n        error.errorGroup !== 'DataContainerError'\n      ) {\n        this.removeError(error.key!);\n      } else if (uniqueAttributes.has(attribute) && error.title === UNIQUE_ERROR_TITLE) {\n        this.removeError(error.key!);\n      }\n    }\n    // A capped group keeps counting errors it did not store: drop the count too.\n    for (const [groupKey, group] of this.errorCounts) {\n      if (\n        group.model === model.key &&\n        group.attribute != null &&\n        allRowsAttributes.has(group.attribute) &&\n        ATTRIBUTE_ERROR_TYPES.has(group.errorType)\n      ) {\n        this.errorCounts.delete(groupKey);\n        this.errorsChangedSinceInitData = true;\n      }\n    }\n\n    return allRowsAttributes;\n  }\n\n  /**\n   * Completes the error records of `model` after a partial update (#368), the\n   * way init() does: consolidates the reprocessed `attributes` into\n   * per-attribute aggregates (cleanUpErrors), re-derives the errors of the\n   * `allRowsAttributes` for the items a referrer auto-created before the update\n   * (`autoCreatedRows`, #608), the way\n   * init() records them after the model's own rows, and, when rows changed,\n   * re-runs the `unique` validators (whose errors prepareErrorsForPartialUpdate()\n   * removed). `dataContainer` is the model's complete merged container.\n   */\n  public finishPartialUpdate(\n    model: DcuplModel,\n    dataContainer: DataContainer,\n    attributes: ReadonlySet<string>,\n    rowsChanged: boolean,\n    allRowsAttributes: ReadonlySet<string> = new Set(),\n    autoCreatedRows: ReadonlyMap<string, ListItem> = new Map(),\n  ): void {\n    if (!this.enabled || model.qualityConfig.enabled !== true) {\n      return;\n    }\n    this.cleanUpErrors(model, dataContainer, attributes);\n    model.reprocessAutoCreatedRows(dataContainer, allRowsAttributes, autoCreatedRows);\n    if (rowsChanged) {\n      for (const error of this.validateAttributesAfterInitialization(model)) {\n        this.setError(error);\n      }\n    }\n  }\n\n  private getUniqueAttributes(model: DcuplModel): Set<string> {\n    const uniqueAttributes = new Set<string>();\n    for (const attribute of model.getAttributes()) {\n      if (attribute.quality?.validators?.unique) {\n        uniqueAttributes.add(attribute.key);\n      }\n    }\n    return uniqueAttributes;\n  }\n\n  /** Strict unless the attribute's quality config says `'loose'` (as validateUnique decides). */\n  private isStrictValidatorHandling(model: DcuplModel, attribute: string): boolean {\n    return model['attributeQualityConfigs']?.get(attribute)?.validatorHandling !== 'loose';\n  }\n\n  /**\n   * Whether the error records changed since initData() last published them to the\n   * $DcuplErrorTracking* models; a partial update skips the rebuild otherwise (#368).\n   */\n  public hasErrorChangesSinceInitData(): boolean {\n    return this.errorsChangedSinceInitData;\n  }\n\n  public async initData(): Promise<void> {\n    if (!this.modelParser) {\n      return;\n    }\n    // An earlier snapshot nobody read: process it before it is replaced, as the eager build did,\n    // so $DcuplErrorTrackingModel (auto-created from both models' `model` reference; initData() never\n    // resets it) keeps the model keys every apply published (#444). Only the partial path gets here\n    // with a snapshot: a full init() drops it first (discardPendingErrorTrackingSnapshot).\n    const superseded = this.pendingErrorTrackingContainers;\n    if (superseded) {\n      this.pendingErrorTrackingContainers = undefined;\n      await this.modelParser['handleDataContainer'](superseded);\n    }\n    this.errorsChangedSinceInitData = false;\n\n    // Drop error containers pushed by previous initData() calls. Otherwise they\n    // pile up in unprocessedData and the next init() reprocesses a stale error\n    // snapshot, leaving $DcuplErrorTrackingErrors one update() cycle behind\n    // getErrors() (see issue #174, Bug 1).\n    this.modelParser['unprocessedData'] = this.modelParser['unprocessedData'].filter(\n      (d) => !ERROR_TRACKING_ROW_MODELS.includes(d.model),\n    );\n\n    // Rebuild the error models from scratch so their data maps and indices\n    // reflect the current error set rather than whatever an earlier pipeline\n    // step left.\n    this.resetErrorTrackingRowModels();\n\n    // The summary carries the exact per-group totals the capped record set\n    // cannot express (#204); the same totals are stamped onto the records.\n    const summary = this.getErrorSummary();\n    this.stampGroupTotals(summary);\n\n    this.modelParser.addData({\n      data: this.getErrors(),\n      model: '$DcuplErrorTrackingErrors',\n      type: 'set',\n    });\n    this.modelParser.addData({\n      data: summary,\n      model: '$DcuplErrorTrackingSummary',\n      type: 'set',\n    });\n\n    const containers = this.modelParser['unprocessedData'].filter((d) => ERROR_TRACKING_ROW_MODELS.includes(d.model));\n\n    if (containers.length === 0) {\n      return;\n    }\n    if (this.hasErrorTrackingLists()) {\n      // the apply refreshes these lists next: build now, as before #444\n      await this.modelParser['handleDataContainer'](containers);\n    } else {\n      // built on first read (materializeErrorTrackingModels); until then their rows and indices\n      // take no memory (#444)\n      this.pendingErrorTrackingContainers = containers;\n    }\n  }\n\n  /**\n   * Builds $DcuplErrorTrackingErrors / -Summary from the error set the last init()/update()\n   * published, if no read built them since (#444). Every read of a $DcuplErrorTracking* model\n   * calls it first (ModelParser.prepareModelForRead), so a read returns what the build at\n   * init()/update() returned, and a read between two updates never sees an older set (#174).\n   * The rows go in through the parser's data processing, which leaves the change tracker and the\n   * error records alone.\n   *\n   * A read while an apply is suspended mid-processing is not guarded: reads were never queued\n   * behind applies, and what such a read sees of the error models is the state the apply has\n   * reached.\n   */\n  public materializeErrorTrackingModels(): void {\n    const containers = this.pendingErrorTrackingContainers;\n    if (!containers || !this.modelParser) {\n      return;\n    }\n    this.pendingErrorTrackingContainers = undefined;\n    try {\n      this.modelParser.processDataContainersSync(containers);\n    } catch (err) {\n      // not built: empty what the failed run half filled, so the next read builds from scratch\n      // instead of on top of it (or serving half-built models)\n      this.resetErrorTrackingRowModels();\n      this.pendingErrorTrackingContainers ??= containers;\n      throw err;\n    }\n  }\n\n  /**\n   * Drops the snapshot initData() queued and nothing has read, without building it. A full init()\n   * calls it right after prepareModels() reset the error-tracking models: the containers of the\n   * last apply are still queued, so the init pipeline processes them again, as before #444, and\n   * initData() stages the new set at its end. Replaying the unread snapshot as well would serve\n   * rows of an apply that is gone: after a full apply that fails (getErrors() is empty then), or\n   * for models that left the queue before init().\n   */\n  public discardPendingErrorTrackingSnapshot(): void {\n    this.pendingErrorTrackingContainers = undefined;\n  }\n\n  /** Empties the rows and the indices of $DcuplErrorTrackingErrors and -Summary. */\n  private resetErrorTrackingRowModels(): void {\n    for (const modelKey of ERROR_TRACKING_ROW_MODELS) {\n      const model = this.modelParser?.models.get(modelKey);\n      model?.resetData();\n      model?.resetIndexMap();\n    }\n  }\n\n  /**\n   * Whether a list over a $DcuplErrorTracking* model exists, the hidden `__global_list__…` lists\n   * of `query.execute` / `fn.*` included. The apply refreshes such a list right after\n   * initData(), so initData() builds the models for it at once (#444).\n   */\n  private hasErrorTrackingLists(): boolean {\n    return this.dcupl?.lists.getAll().some((list) => list.modelKey?.startsWith(ERROR_TRACKING_MODEL_PREFIX)) ?? false;\n  }\n\n  public initErrorTrackingModels(): void {\n    this.modelParser?.addModel({\n      key: '$DcuplErrorTrackingErrors',\n      autoGenerateKey: true,\n      supportsAutoCreation: true,\n      references: [\n        {\n          key: 'model',\n          type: 'singleValued',\n          model: '$DcuplErrorTrackingModel',\n          filter: {\n            calculateFacets: true,\n          },\n        },\n        {\n          key: 'errorGroup',\n          type: 'singleValued',\n          model: '$DcuplErrorTrackingGroup',\n          filter: {\n            calculateFacets: true,\n          },\n        },\n        {\n          key: 'errorType',\n          type: 'singleValued',\n          model: '$DcuplErrorTrackingType',\n          filter: {\n            calculateFacets: true,\n          },\n        },\n      ],\n      properties: [\n        {\n          key: 'title',\n          type: 'string',\n          filter: true,\n        },\n        {\n          key: 'itemKey',\n          type: 'string',\n          filter: true,\n        },\n        {\n          key: 'attribute',\n          type: 'string',\n          filter: true,\n        },\n        {\n          key: 'description',\n          type: 'string',\n        },\n        {\n          key: 'meta',\n          type: 'json',\n        },\n        {\n          key: 'groupTotal',\n          type: 'int',\n        },\n        {\n          key: 'truncated',\n          type: 'boolean',\n          filter: true,\n        },\n      ],\n      quality: {\n        enabled: false,\n      },\n    });\n\n    // One row per (model, attribute, errorType) group with the exact total,\n    // independent of the maxErrorsPerGroup record cap (#204).\n    this.modelParser?.addModel({\n      key: '$DcuplErrorTrackingSummary',\n      supportsAutoCreation: true,\n      references: [\n        {\n          key: 'model',\n          type: 'singleValued',\n          model: '$DcuplErrorTrackingModel',\n          filter: {\n            calculateFacets: true,\n          },\n        },\n        {\n          key: 'errorGroup',\n          type: 'singleValued',\n          model: '$DcuplErrorTrackingGroup',\n          filter: {\n            calculateFacets: true,\n          },\n        },\n        {\n          key: 'errorType',\n          type: 'singleValued',\n          model: '$DcuplErrorTrackingType',\n          filter: {\n            calculateFacets: true,\n          },\n        },\n      ],\n      properties: [\n        {\n          key: 'attribute',\n          type: 'string',\n          filter: true,\n        },\n        {\n          key: 'type',\n          type: 'string',\n          filter: true,\n        },\n        {\n          key: 'totalCount',\n          type: 'int',\n          filter: true,\n        },\n        {\n          key: 'storedCount',\n          type: 'int',\n        },\n        {\n          key: 'truncated',\n          type: 'boolean',\n          filter: true,\n        },\n      ],\n      quality: {\n        enabled: false,\n      },\n    });\n\n    // The seed is not the full vocabulary: a row whose errorType is not listed\n    // here (MissingKey, UnknownColumn, loader types, ...) creates its lookup row\n    // on resolution, otherwise the type is missing from the errorType facet (#535).\n    this.modelParser?.addModel({\n      key: '$DcuplErrorTrackingType',\n      supportsAutoCreation: true,\n      data: [\n        { key: 'UndefinedAttribute' },\n        { key: 'InvalidValidator' },\n        { key: 'UndefinedValue' },\n        { key: 'NullValue' },\n        { key: 'WrongDataType' },\n        { key: 'MissingModel' },\n        { key: 'NonUniqueKey' },\n        { key: 'RemoteReferenceKeyNotFound' },\n        { key: 'InvalidModelDescription' },\n        { key: 'InvalidResource' },\n        { key: 'InvalidModelDefinition' },\n        { key: 'EndpointScriptMissing' },\n        { key: 'EndpointDuplicate' },\n      ],\n      quality: {\n        enabled: false,\n      },\n    });\n\n    this.modelParser?.addModel({\n      key: '$DcuplErrorTrackingGroup',\n      data: [\n        { key: 'ReferenceDataError' },\n        { key: 'PropertyDataError' },\n        { key: 'DataContainerError' },\n        { key: 'ModelDescriptionError' },\n        { key: 'LoaderError' },\n        { key: 'ResourceError' },\n        { key: 'ModelDefinitionError' },\n      ],\n      quality: {\n        enabled: false,\n      },\n    });\n\n    this.modelParser?.addModel({\n      key: '$DcuplErrorTrackingModel',\n      supportsAutoCreation: true,\n      quality: {\n        enabled: false,\n      },\n    });\n  }\n\n  public initAnalyticsValues(): void {\n    this.calculateTiming();\n    this.calculateSizes();\n    this.calculateErrorTrackingFacet();\n    this.calculateCounts();\n    this.calculateUnusedAttributes();\n  }\n\n  private calculateUnusedAttributes(): void {\n    this.values.unusedAttributes = [];\n\n    const models = this.dcupl.models.keys();\n    for (const modelKey of models) {\n      const unusedAttributesForModel = this.getUnusedAttributesFromModel(this.dcupl, modelKey);\n      for (const attr of unusedAttributesForModel) {\n        this.values.unusedAttributes?.push({\n          model: modelKey,\n          attribute: attr,\n        });\n      }\n    }\n  }\n\n  private calculateCounts(): void {\n    this.values.counts = {};\n\n    // const progress = this.progress.getValue();\n    // this.values.counts.resources = progress?.total;\n\n    // User resources only: the SDK's internal $Dcupl* models (error tracking) are left out,\n    // as in `models` below (#518).\n    const isUserModel = (modelKey: string | undefined): boolean => !modelKey?.startsWith('$Dcupl');\n    let modelFiles = 0;\n    for (const modelKey of this.dcupl['modelParser'].unprocessedModelDescriptions.keys()) {\n      if (isUserModel(modelKey)) modelFiles++;\n    }\n    this.values.counts.modelFiles = modelFiles;\n    this.values.counts.dataFiles = this.dcupl['modelParser']['unprocessedData'].filter((container) =>\n      isUserModel(container.model),\n    ).length;\n    this.values.counts.models = this.dcupl.models.keys().length;\n\n    let rows = 0;\n    let attributes = 0;\n    let values = 0;\n\n    this.dcupl.models.keys().forEach((modelKey) => {\n      const model = this.dcupl['modelParser'].models.get(modelKey);\n\n      if (!model) {\n        return;\n      }\n\n      const properties = model?.getBasicProperties() || [];\n      const references = model?.getBasicReferences() || [];\n\n      const modelAttributes = properties.length + references.length;\n      attributes += modelAttributes;\n\n      const data = model['data'];\n      const modelRows = data?.size || 0;\n      rows += modelRows;\n      values += modelAttributes * modelRows;\n    });\n\n    this.values.counts.rows = rows;\n    this.values.counts.attributes = attributes;\n    this.values.counts.dataEntries = values;\n  }\n\n  private calculateTiming(): void {\n    const loadingValue = this.dcupl['analyticsController'].getByName('loader_processed');\n\n    if (loadingValue && loadingValue[0]) {\n      this.values.loading = loadingValue[0].value;\n    }\n    const processValue = this.dcupl['analyticsController'].getByName('dcupl_initialized');\n\n    if (processValue && processValue[0]) {\n      this.values.processing = processValue[0].value;\n    }\n\n    this.values.startup = this.values.loading + this.values.processing;\n  }\n\n  private calculateSizes(): void {\n    const sizes = this.calculateSizesForModels();\n    this.values.sizes = {};\n    this.values.sizes.totalEncoded = sizes.reduce((acc, item) => acc + item.encodedBodySize!, 0);\n    this.values.sizes.totalDecoded = sizes.reduce((acc, item) => acc + item.decodedBodySize!, 0);\n    this.values.sizes.unusedDecoded = this.calculateUnusedData();\n\n    this.values.sizes.models = sizes.map((item) => {\n      return {\n        model: item.model,\n        decodedBodySize: item.decodedBodySize,\n        encodedBodySize: item.encodedBodySize,\n      };\n    }) as AnalyticsEntryResourceValue[];\n\n    this.values.sizes.models?.sort((a, b) => (b.encodedBodySize || 0) - (a.encodedBodySize || 0));\n  }\n\n  private calculateErrorTrackingFacet(): void {\n    try {\n      if (!this.enabled) {\n        return;\n      }\n      // Exact per-group totals, not facet sizes over the capped\n      // $DcuplErrorTrackingErrors records (#204).\n      const totalByType = new Map<string, number>();\n      let size = 0;\n      for (const group of this.errorCounts.values()) {\n        totalByType.set(group.errorType, (totalByType.get(group.errorType) ?? 0) + group.count);\n        size += group.count;\n      }\n      this.values.errors = {\n        size,\n        UndefinedValue: totalByType.get('UndefinedValue') ?? 0,\n        UndefinedAttribute: totalByType.get('UndefinedAttribute') ?? 0,\n        WrongDataType: totalByType.get('WrongDataType') ?? 0,\n        MissingModel: totalByType.get('MissingModel') ?? 0,\n        InvalidModelDescription: totalByType.get('InvalidModelDescription') ?? 0,\n        RemoteReferenceKeyNotFound: totalByType.get('RemoteReferenceKeyNotFound') ?? 0,\n      };\n    } catch (err) {\n      this.log.error('Error calculating error tracking facet', err as Error);\n    }\n  }\n\n  private calculateSizesForModels(): Partial<AnalyticsEntryResourceValue>[] {\n    const allProcessingData = this.dcupl['analyticsController'].getByType('resource') as AnalyticsEntryResource[];\n\n    const onlyDataResources = allProcessingData.filter((item) => item.value?.type === 'data');\n\n    const groupedByModel = groupBy(onlyDataResources, (item) => item.value?.model);\n\n    const summedUpByModel = Object.keys(groupedByModel).map((key) => {\n      const encodedBodySize = groupedByModel[key]?.reduce((acc, item) => {\n        const size = item.value.encodedBodySize;\n        return acc + size;\n      }, 0);\n\n      const decodedBodySize = groupedByModel[key]?.reduce((acc, item) => {\n        const size = item.value.decodedBodySize;\n        return acc + size;\n      }, 0);\n\n      return {\n        model: key,\n        decodedBodySize: decodedBodySize,\n        encodedBodySize: encodedBodySize,\n      };\n    });\n    return summedUpByModel;\n  }\n\n  public calculateUnusedData(): number {\n    const models = this.dcupl.models.keys();\n\n    // let totalLength = 0;\n    let unusedDataLength = 0;\n\n    models.forEach((modelKey) => {\n      const relevantData =\n        this.dcupl['modelParser']['unprocessedData'].find((container: DataContainer) => container.model === modelKey)\n          ?.data || [];\n\n      const unusedAttributesForModel = this.getUnusedAttributesFromModel(this.dcupl, modelKey);\n\n      // totalLength += JSON.stringify(relevantData).length;\n\n      if (!unusedAttributesForModel.length) {\n        return;\n      }\n      const unusedData = this.getDataWithAttributes(relevantData, unusedAttributesForModel);\n      unusedDataLength += JSON.stringify(unusedData).length;\n    });\n\n    return unusedDataLength;\n  }\n\n  private getDataWithAttributes(data: any, attribute: string[]): any[] {\n    return data.map((item: any) => {\n      const newItem: any = {};\n\n      attribute.forEach((attr) => {\n        newItem[attr] = item[attr];\n      });\n\n      return newItem;\n    });\n  }\n\n  private getUnusedAttributesFromModel(dcupl: DcuplApi, modelKey: string): string[] {\n    const model = dcupl['modelParser'].models.get(modelKey);\n    const properties = model?.getBasicProperties() || [];\n    const references = model?.getBasicReferences() || [];\n    const keyProperty = model?.keyProperty;\n\n    const attributes = [...properties, ...references].map((a) => a.key);\n    if (typeof keyProperty === 'string') {\n      attributes.push(keyProperty);\n    } else if (Array.isArray(keyProperty)) {\n      attributes.push(...keyProperty);\n    } else {\n      attributes.push('key');\n    }\n    attributes.push('key');\n\n    const relevantData =\n      dcupl['modelParser']['unprocessedData'].find((container: DataContainer) => container.model === modelKey)?.data ||\n      [];\n\n    return this.getUnusedAttributes(relevantData, attributes);\n  }\n\n  private getUnusedAttributes(data: any[], attributes: string[]): string[] {\n    const unusedAttributes = new Set<string>();\n\n    data.forEach((item) => {\n      Object.keys(item).forEach((key) => {\n        if (!attributes.includes(key)) {\n          unusedAttributes.add(key);\n        }\n      });\n    });\n\n    return Array.from(unusedAttributes.values());\n  }\n\n  public validateAttribute(\n    value: any,\n    validators: AttributeValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError[] {\n    const validationErrors: QualityAnalyzer.InternalModelError[] = [];\n\n    // if (validators.custom) {\n    //   const error = this.validateCustom(value, validators.custom, attribute);\n    //   if (error) {\n    //     validationErrors.push(error);\n    //   }\n    // }\n\n    if (validators.email) {\n      const error = this.validateEmail(value, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.endsWith) {\n      const error = this.validateEndsWith(value, validators.endsWith, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.enum) {\n      const error = this.validateEnum(value, validators.enum, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.includes) {\n      const error = this.validateIncludes(value, validators.includes, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.max) {\n      const error = this.validateMax(value, validators.max, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.maxLength) {\n      const error = this.validateMaxLength(value, validators.maxLength, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.min) {\n      const error = this.validateMin(value, validators.min, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.minLength) {\n      const error = this.validateMinLength(value, validators.minLength, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.pattern) {\n      const error = this.validatePattern(value, validators.pattern, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    if (validators.startsWith) {\n      const error = this.validateStartsWith(value, validators.startsWith, attribute);\n      if (error) {\n        validationErrors.push(error);\n      }\n    }\n\n    return validationErrors;\n  }\n\n  public validateAttributesAfterInitialization(model: DcuplModel): QualityAnalyzer.InternalModelError[] {\n    if (!model) {\n      return [];\n    }\n    const attributes = model.getAttributes();\n    const data = model.getDataAsArray();\n    const errors: QualityAnalyzer.InternalModelError[] = [];\n    for (const attribute of attributes) {\n      const validators = attribute.quality?.validators;\n      if (validators) {\n        if (validators.unique) {\n          const uniqueErrors = this.validateUnique(data, attribute.key, model);\n          errors.push(...uniqueErrors);\n        }\n      }\n    }\n    return errors;\n  }\n\n  private validateUnique(data: ListItem[], attribute: string, model: DcuplModel): QualityAnalyzer.InternalModelError[] {\n    const uniqueErrors: QualityAnalyzer.InternalModelError[] = [];\n    const uniqueValues = new Set();\n\n    // Check if validator handling is strict for this attribute\n    const isStrict = this.isStrictValidatorHandling(model, attribute);\n\n    for (const item of data) {\n      const value = item[attribute];\n      if (uniqueValues.has(value)) {\n        const error: QualityAnalyzer.InternalModelError = {\n          title: UNIQUE_ERROR_TITLE,\n          type: 'model',\n          errorGroup: 'PropertyDataError',\n          model: model.key,\n          errorType: 'InvalidValidator',\n          attribute: attribute,\n          itemKey: item.key,\n          description: `The value \"${value}\" is not unique`,\n        };\n        uniqueErrors.push(error);\n\n        // Remove duplicate value in strict mode\n        if (isStrict) {\n          delete item[attribute];\n        }\n      } else {\n        uniqueValues.add(value);\n      }\n    }\n    return uniqueErrors;\n  }\n\n  // private validateCustom(\n  //   value: string,\n  //   config: CustomValidatorConfig,\n  //   attribute: string,\n  // ): QualityAnalyzer.InternalModelError | undefined {\n  //   const customScript = this.scriptsController.getScript(config.key);\n  //   if (!customScript) {\n  //     console.log('Custom Validator script not found');\n  //   }\n  //   const result = this.scriptsController.executeScript(config.key, 'validator', { value, config, attribute });\n  //   if (result !== true) {\n  //     return {\n  //       title: 'Validator Error - Custom Script',\n  //       type: 'model',\n  //       errorGroup: 'PropertyDataError',\n  //       errorType: 'InvalidValidator',\n  //       attribute: attribute,\n  //       description: `The value \"${value}\" does not pass the custom validation`,\n  //       meta: result,\n  //     };\n  //   }\n\n  //   return;\n  // }\n\n  private validateEmail(value: string, attribute: string): QualityAnalyzer.InternalModelError | undefined {\n    if (value == null) {\n      return undefined;\n    }\n    const emailRegex = /^[\\w.-]+@[a-zA-Z\\d.-]+\\.[a-zA-Z]{2,6}$/;\n    if (!emailRegex.test(value)) {\n      return {\n        title: 'Validator Error - Invalid Email',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" is not a valid email address`,\n      };\n    }\n    return undefined;\n  }\n\n  private validateMin(\n    value: any,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value < config.value) {\n      return {\n        title: 'Validator Error - Min Value',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" is smaller than the minimum value of \"${config.value}\"`,\n      };\n    }\n    return undefined;\n  }\n\n  private validateMax(\n    value: any,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value > config.value) {\n      return {\n        title: 'Validator Error - Max Value',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" is larger than the maximum value of \"${config.value}\"`,\n      };\n    }\n    return undefined;\n  }\n\n  private validateStartsWith(\n    value: string,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value == null) {\n      return undefined;\n    }\n    if (!value.startsWith(config.value)) {\n      return {\n        title: 'Validator Error - StartsWith',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" does not start with \"${config.value}\"`,\n      };\n    }\n    return undefined;\n  }\n\n  private validateEndsWith(\n    value: string,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value == null) {\n      return undefined;\n    }\n    if (!endsWith(value, config.value)) {\n      return {\n        title: 'Validator Error - EndsWith',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" does not end with \"${config.value}\"`,\n      };\n    }\n    return undefined;\n  }\n  private validateIncludes(\n    value: string,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value == null) {\n      return undefined;\n    }\n    if (!includes(value, config.value)) {\n      return {\n        title: 'Validator Error - Includes',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" does not include \"${config.value}\"`,\n      };\n    }\n    return undefined;\n  }\n\n  private validateMinLength(\n    value: string,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value == null) {\n      return undefined;\n    }\n    if (value.length < config.value) {\n      return {\n        title: 'Validator Error - Min Length',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" is shorter than the minimum length of \"${config.value}\"`,\n      };\n    }\n    return undefined;\n  }\n\n  private validateMaxLength(\n    value: string,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value == null) {\n      return undefined;\n    }\n    if (value.length > config.value) {\n      return {\n        title: 'Validator Error - Max Length',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" is longer than the maximum length of \"${config.value}\"`,\n      };\n    }\n    return undefined;\n  }\n\n  private validateEnum(\n    value: any,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (!config.value.includes(value)) {\n      return {\n        title: 'Validator Error - Enum',\n        type: 'model',\n        errorGroup: 'PropertyDataError',\n        errorType: 'InvalidValidator',\n        attribute: attribute,\n        description: `The value \"${value}\" is not in the enum values`,\n      };\n    }\n    return undefined;\n  }\n\n  private validatePattern(\n    value: string,\n    config: ValidatorConfig,\n    attribute: string,\n  ): QualityAnalyzer.InternalModelError | undefined {\n    if (value == null) {\n      return undefined;\n    }\n    try {\n      const pattern = new RegExp(config.value);\n      if (!pattern.test(value)) {\n        return {\n          title: 'Validator Error - Pattern',\n          type: 'model',\n          errorGroup: 'PropertyDataError',\n          errorType: 'InvalidValidator',\n          attribute: attribute,\n          description: `The value \"${value}\" does not match the pattern \"${config.value}\"`,\n        };\n      }\n    } catch (err) {\n      this.log.error('Invalid pattern validation', err as Error);\n    }\n    return undefined;\n  }\n}\n","import { DataContainer, RawItem } from '@dcupl/common';\n\n/**\n * Change tracking state machine states\n * - clean: No changes tracked\n * - tracking: Actively tracking incremental changes\n * - full-reset: A full reset occurred, all subsequent changes are part of the reset\n */\ntype ChangeTrackerState = 'clean' | 'tracking' | 'full-reset';\n\n/**\n * ChangeTracker detects and records which attributes and items have changed during data updates.\n *\n * This enables partial updates by tracking:\n * - Which model attributes have changed\n * - Which specific items were added/modified/deleted\n * - Whether a full model reset occurred (type='set')\n *\n * State Machine:\n * - clean → tracking (first update/upsert/remove)\n * - clean → full-reset (first set)\n * - tracking → full-reset (set occurs)\n * - full-reset → full-reset (stays in full-reset until clear())\n * - any → clean (clear() called)\n */\nexport class ChangeTracker {\n  private changedAttributes: Map<string, Set<string>>; // modelKey → Set<attributeKeys>\n  private changedItems: Map<string, Set<string>>; // modelKey → Set<itemKeys>\n  private deletedItems: Map<string, Set<string>>; // modelKey → Set<itemKeys>\n  // modelKey → row arrays of the recorded update/upsert (changed) and remove\n  // (deleted) containers, kept for refreshItemKeys()\n  private changedRows: Map<string, RawItem[][]>;\n  private deletedRows: Map<string, RawItem[][]>;\n  private modelFullReset: Set<string>; // Models that had type='set' (full reset)\n  private state: ChangeTrackerState = 'clean';\n\n  constructor() {\n    this.changedAttributes = new Map();\n    this.changedItems = new Map();\n    this.deletedItems = new Map();\n    this.changedRows = new Map();\n    this.deletedRows = new Map();\n    this.modelFullReset = new Set();\n  }\n\n  /**\n   * Records changes from a data container using state machine logic\n   * @param container - The data container with changes\n   */\n  public recordDataChange(container: DataContainer<RawItem>): void {\n    const modelKey = container.model;\n\n    // An empty incremental container changes nothing. An empty `set` is a\n    // full reset of the model (data.reset / data.set([])) and must be\n    // tracked like any other `set` (#257).\n    if (container.type !== 'set' && (!container.data || container.data.length === 0)) {\n      return;\n    }\n\n    // State machine transitions\n    if (container.type === 'set') {\n      // Transition to full-reset state if this is the first change\n      if (this.state === 'clean') {\n        this.state = 'full-reset';\n      } else if (this.state === 'tracking') {\n        // Transition from tracking to full-reset\n        // Clear tracked changes for this specific model as they're now irrelevant\n        this.state = 'full-reset';\n        this.changedAttributes.delete(modelKey);\n        this.changedItems.delete(modelKey);\n        this.deletedItems.delete(modelKey);\n        this.changedRows.delete(modelKey);\n        this.deletedRows.delete(modelKey);\n      }\n      // If already in full-reset, just add this model to the full reset set\n\n      // Mark model for full reset\n      this.modelFullReset.add(modelKey);\n    } else {\n      // For incremental changes (update, upsert, remove)\n\n      // If this specific model already had a type='set', don't track incremental changes for it\n      if (this.modelFullReset.has(modelKey)) {\n        return;\n      }\n\n      // Transition from clean to tracking (if needed)\n      if (this.state === 'clean') {\n        this.state = 'tracking';\n      } else if (this.state === 'full-reset') {\n        // If we're in full-reset state but this is a different model, we can track it\n        this.state = 'tracking';\n      }\n\n      // Track changes normally\n      if (container.type === 'remove') {\n        // Track deleted items\n        this.recordDeletedItems(modelKey, container.data);\n        // Note: Reference attributes are recorded as changed in model-parser.partialUpdate()\n      } else {\n        // update or upsert - track changed attributes and items\n        this.recordChangedData(modelKey, container.data);\n      }\n    }\n  }\n\n  /**\n   * Records a specific attribute change\n   * @param modelKey - The model key\n   * @param attributeKey - The attribute key that changed\n   */\n  public recordAttributeChange(modelKey: string, attributeKey: string): void {\n    if (!this.changedAttributes.has(modelKey)) {\n      this.changedAttributes.set(modelKey, new Set());\n    }\n    this.changedAttributes.get(modelKey)!.add(attributeKey);\n  }\n\n  /**\n   * Records changed data items and determines which attributes changed\n   * @param modelKey - The model key\n   * @param data - The changed data items\n   */\n  private recordChangedData(modelKey: string, data: RawItem[]): void {\n    // Get or create sets\n    if (!this.changedAttributes.has(modelKey)) {\n      this.changedAttributes.set(modelKey, new Set());\n    }\n    if (!this.changedItems.has(modelKey)) {\n      this.changedItems.set(modelKey, new Set());\n    }\n\n    const attributeSet = this.changedAttributes.get(modelKey)!;\n    const itemSet = this.changedItems.get(modelKey)!;\n    this.addRows(this.changedRows, modelKey, data);\n\n    for (const item of data) {\n      // Track item key\n      if (item.key) {\n        itemSet.add(String(item.key));\n      }\n\n      // Track all attributes present in this item\n      for (const attributeKey in item) {\n        if (attributeKey === 'key') continue; // Skip the key property itself\n        attributeSet.add(attributeKey);\n      }\n    }\n  }\n\n  /**\n   * Records deleted items\n   * @param modelKey - The model key\n   * @param data - The deleted data items\n   */\n  private recordDeletedItems(modelKey: string, data: RawItem[]): void {\n    if (!this.deletedItems.has(modelKey)) {\n      this.deletedItems.set(modelKey, new Set());\n    }\n\n    const deletedSet = this.deletedItems.get(modelKey)!;\n    this.addRows(this.deletedRows, modelKey, data);\n\n    for (const item of data) {\n      if (item.key) {\n        deletedSet.add(String(item.key));\n      }\n    }\n  }\n\n  private addRows(rowsByModel: Map<string, RawItem[][]>, modelKey: string, data: RawItem[]): void {\n    const rows = rowsByModel.get(modelKey);\n    if (rows) {\n      rows.push(data);\n    } else {\n      rowsByModel.set(modelKey, [data]);\n    }\n  }\n\n  /**\n   * Re-reads the changed and deleted item keys from the recorded rows. A row\n   * keyed by a custom `keyProperty` or by `autoGenerateKey` gets its `key`\n   * only when the parser applies the keys (`handleAlternativeKey`), after the\n   * row was recorded: without this its item was missing from\n   * getChangedItems() / getDeletedItems() (#368). Call it once the keys are\n   * applied.\n   */\n  public refreshItemKeys(): void {\n    const keysOf = (rowsByModel: Map<string, RawItem[][]>, itemsByModel: Map<string, Set<string>>): void => {\n      for (const [modelKey, containers] of rowsByModel) {\n        const itemKeys = new Set<string>();\n        for (const rows of containers) {\n          for (const row of rows) {\n            if (row.key) {\n              itemKeys.add(String(row.key));\n            }\n          }\n        }\n        itemsByModel.set(modelKey, itemKeys);\n      }\n    };\n    keysOf(this.changedRows, this.changedItems);\n    keysOf(this.deletedRows, this.deletedItems);\n  }\n\n  /**\n   * Gets all changed attributes grouped by model\n   * @returns Map of modelKey → Set of changed attributeKeys\n   */\n  public getChangedAttributes(): Map<string, Set<string>> {\n    return this.changedAttributes;\n  }\n\n  /**\n   * Gets changed attributes for a specific model\n   * @param modelKey - The model key\n   * @returns Set of changed attribute keys, or undefined if model has no changes\n   */\n  public getChangedAttributesForModel(modelKey: string): Set<string> | undefined {\n    return this.changedAttributes.get(modelKey);\n  }\n\n  /**\n   * Gets changed items for a specific model\n   * @param modelKey - The model key\n   * @returns Set of changed item keys, or empty set if no changes\n   */\n  public getChangedItems(modelKey: string): Set<string> {\n    return this.changedItems.get(modelKey) || new Set();\n  }\n\n  /**\n   * Gets deleted items for a specific model\n   * @param modelKey - The model key\n   * @returns Set of deleted item keys, or empty set if no deletions\n   */\n  public getDeletedItems(modelKey: string): Set<string> {\n    return this.deletedItems.get(modelKey) || new Set();\n  }\n\n  /**\n   * Gets all models that have changes (not full resets)\n   * @returns Array of model keys with changes\n   */\n  public getModelsWithChanges(): string[] {\n    const models = new Set<string>();\n\n    for (const modelKey of this.changedAttributes.keys()) {\n      models.add(modelKey);\n    }\n    for (const modelKey of this.changedItems.keys()) {\n      models.add(modelKey);\n    }\n    for (const modelKey of this.deletedItems.keys()) {\n      models.add(modelKey);\n    }\n\n    return Array.from(models);\n  }\n\n  /**\n   * Every model the pending update effectively touches: attribute changes,\n   * item changes, deletions AND full resets (#245). `getModelsWithChanges()`\n   * deliberately excludes full resets and a deletion records its attribute\n   * changes only later, inside the parser — so callers that need \"which\n   * models did this update change\" must not reconstruct the union from the\n   * per-kind accessors. Returns a fresh Set that survives `clear()`.\n   */\n  public getEffectivelyChangedModels(): Set<string> {\n    return new Set<string>([...this.getModelsWithChanges(), ...this.modelFullReset]);\n  }\n\n  /**\n   * Gets all models that had a full reset (type='set')\n   * @returns Set of model keys that need full reset\n   */\n  public getModelsWithFullReset(): Set<string> {\n    return this.modelFullReset;\n  }\n\n  /**\n   * Checks if a model had a full reset\n   * @param modelKey - The model key\n   * @returns true if model had type='set', false otherwise\n   */\n  public hasFullReset(modelKey: string): boolean {\n    return this.modelFullReset.has(modelKey);\n  }\n\n  /**\n   * Checks if there are any changes tracked\n   * @returns true if any changes are tracked, false otherwise\n   */\n  public hasChanges(): boolean {\n    return (\n      this.changedAttributes.size > 0 ||\n      this.changedItems.size > 0 ||\n      this.deletedItems.size > 0 ||\n      this.modelFullReset.size > 0\n    );\n  }\n\n  /**\n   * Gets the total number of changed items across all models\n   * @returns Total count of changed items\n   */\n  public getTotalChangedItemCount(): number {\n    let count = 0;\n    for (const items of this.changedItems.values()) {\n      count += items.size;\n    }\n    for (const items of this.deletedItems.values()) {\n      count += items.size;\n    }\n    return count;\n  }\n\n  /**\n   * Gets the ratio of models with changes to total models\n   * @param totalModelCount - Total number of models in the system\n   * @returns Ratio between 0 and 1\n   */\n  public getAffectedModelRatio(totalModelCount: number): number {\n    if (totalModelCount === 0) return 0;\n    const affectedCount = this.getModelsWithChanges().length + this.modelFullReset.size;\n    return affectedCount / totalModelCount;\n  }\n\n  /**\n   * Gets the ratio of changed items to total items for a model\n   * @param modelKey - The model key\n   * @param totalItemCount - Total number of items in the model\n   * @returns Ratio between 0 and 1\n   */\n  public getAffectedItemRatio(modelKey: string, totalItemCount: number): number {\n    if (totalItemCount === 0) return 0;\n    const changedCount = this.getChangedItems(modelKey).size;\n    return changedCount / totalItemCount;\n  }\n\n  /**\n   * Clears all tracked changes and resets state to clean\n   */\n  public clear(): void {\n    this.changedAttributes.clear();\n    this.changedItems.clear();\n    this.deletedItems.clear();\n    this.changedRows.clear();\n    this.deletedRows.clear();\n    this.modelFullReset.clear();\n    this.state = 'clean';\n  }\n\n  /**\n   * Checks if the tracker is in full-reset state\n   * @returns true if in full-reset state, false otherwise\n   */\n  public requiresFullReset(): boolean {\n    return this.state === 'full-reset';\n  }\n\n  /**\n   * Gets the current state of the change tracker\n   * @returns The current state\n   */\n  public getState(): ChangeTrackerState {\n    return this.state;\n  }\n\n  /**\n   * Gets statistics about tracked changes\n   * @returns Statistics object\n   */\n  public getStats(): {\n    modelsWithChanges: number;\n    modelsWithFullReset: number;\n    totalChangedItems: number;\n    totalDeletedItems: number;\n    totalChangedAttributes: number;\n  } {\n    let totalChangedItems = 0;\n    let totalDeletedItems = 0;\n    let totalChangedAttributes = 0;\n\n    for (const items of this.changedItems.values()) {\n      totalChangedItems += items.size;\n    }\n\n    for (const items of this.deletedItems.values()) {\n      totalDeletedItems += items.size;\n    }\n\n    for (const attrs of this.changedAttributes.values()) {\n      totalChangedAttributes += attrs.size;\n    }\n\n    return {\n      modelsWithChanges: this.getModelsWithChanges().length,\n      modelsWithFullReset: this.modelFullReset.size,\n      totalChangedItems,\n      totalDeletedItems,\n      totalChangedAttributes,\n    };\n  }\n}\n","/**\n * Tracks performance metrics for partial updates vs full updates\n */\nexport class PartialUpdateMetrics {\n  private metrics: UpdateMetric[] = [];\n  private enabled: boolean = false;\n\n  constructor() {}\n\n  public enable(): void {\n    this.enabled = true;\n  }\n\n  public disable(): void {\n    this.enabled = false;\n  }\n\n  public isEnabled(): boolean {\n    return this.enabled;\n  }\n\n  /**\n   * Records a completed update\n   */\n  public recordUpdate(metric: UpdateMetric): void {\n    if (!this.enabled) return;\n\n    this.metrics.push({\n      ...metric,\n      timestamp: Date.now(),\n    });\n\n    // Keep only last 100 updates to avoid memory bloat\n    if (this.metrics.length > 100) {\n      this.metrics.shift();\n    }\n  }\n\n  /**\n   * Gets all recorded metrics\n   */\n  public getMetrics(): UpdateMetric[] {\n    return [...this.metrics];\n  }\n\n  /**\n   * Gets summary statistics\n   */\n  public getSummary(): MetricsSummary {\n    if (this.metrics.length === 0) {\n      return {\n        totalUpdates: 0,\n        partialUpdates: 0,\n        fullUpdates: 0,\n        avgPartialUpdateTime: 0,\n        avgFullUpdateTime: 0,\n        avgAttributesProcessed: 0,\n        avgModelsAffected: 0,\n        totalTimeSaved: 0,\n      };\n    }\n\n    const partialUpdates = this.metrics.filter((m) => m.type === 'partial');\n    const fullUpdates = this.metrics.filter((m) => m.type === 'full');\n\n    const avgPartialTime =\n      partialUpdates.length > 0 ? partialUpdates.reduce((sum, m) => sum + m.durationMs, 0) / partialUpdates.length : 0;\n\n    const avgFullTime =\n      fullUpdates.length > 0 ? fullUpdates.reduce((sum, m) => sum + m.durationMs, 0) / fullUpdates.length : 0;\n\n    const avgAttributesProcessed =\n      partialUpdates.length > 0\n        ? partialUpdates.reduce((sum, m) => sum + (m.attributesProcessed || 0), 0) / partialUpdates.length\n        : 0;\n\n    const avgModelsAffected =\n      partialUpdates.length > 0\n        ? partialUpdates.reduce((sum, m) => sum + (m.modelsAffected || 0), 0) / partialUpdates.length\n        : 0;\n\n    // Estimate time saved by comparing partial updates to average full update time\n    const totalTimeSaved =\n      avgFullTime > 0 ? partialUpdates.reduce((sum, m) => sum + (avgFullTime - m.durationMs), 0) : 0;\n\n    return {\n      totalUpdates: this.metrics.length,\n      partialUpdates: partialUpdates.length,\n      fullUpdates: fullUpdates.length,\n      avgPartialUpdateTime: avgPartialTime,\n      avgFullUpdateTime: avgFullTime,\n      avgAttributesProcessed,\n      avgModelsAffected,\n      totalTimeSaved,\n    };\n  }\n\n  /**\n   * Gets the last N updates\n   */\n  public getLastUpdates(count: number = 10): UpdateMetric[] {\n    return this.metrics.slice(-count);\n  }\n\n  /**\n   * Clears all metrics\n   */\n  public clear(): void {\n    this.metrics = [];\n  }\n\n  /**\n   * Gets metrics for a specific time range\n   */\n  public getMetricsInRange(startTime: number, endTime: number): UpdateMetric[] {\n    return this.metrics.filter((m) => m.timestamp >= startTime && m.timestamp <= endTime);\n  }\n}\n\nexport interface UpdateMetric {\n  /** Type of update performed */\n  type: 'partial' | 'full';\n\n  /** Duration in milliseconds */\n  durationMs: number;\n\n  /** Timestamp when update completed */\n  timestamp: number;\n\n  /** Number of models affected (partial updates only) */\n  modelsAffected?: number;\n\n  /** Number of attributes processed (partial updates only) */\n  attributesProcessed?: number;\n\n  /** Number of items changed (partial updates only) */\n  itemsChanged?: number;\n\n  /** Whether update decision was optimal */\n  decisionReason?: string;\n}\n\nexport interface MetricsSummary {\n  totalUpdates: number;\n  partialUpdates: number;\n  fullUpdates: number;\n  avgPartialUpdateTime: number;\n  avgFullUpdateTime: number;\n  avgAttributesProcessed: number;\n  avgModelsAffected: number;\n  totalTimeSaved: number;\n}\n","import { Reference, QueryReference, ResolvedReference, DerivedReference, GroupedRefeference } from '@dcupl/common';\n\n/**\n * Type guard to check if a reference is a QueryReference\n */\nexport function isQueryReference(ref: Reference): ref is QueryReference {\n  return 'query' in ref;\n}\n\n/**\n * Type guard to check if a reference is a ResolvedReference\n */\nexport function isResolvedReference(ref: Reference): ref is ResolvedReference {\n  return 'resolve' in ref;\n}\n\n/**\n * Type guard to check if a reference is a DerivedReference\n */\nexport function isDerivedReference(ref: Reference): ref is DerivedReference {\n  return 'derive' in ref;\n}\n\n/**\n * Type guard to check if a reference is a GroupedRefeference\n */\nexport function isGroupedReference(ref: Reference): ref is GroupedRefeference {\n  return 'groupBy' in ref;\n}\n","import {\n  DataContainer,\n  DcuplInitOptions,\n  ViewDefinition,\n  generateKey,\n  ListItem,\n  ModelDefinition,\n  RawItem,\n  ChangeDetector,\n  trigger,\n  QualityAnalyzer,\n  DependencyGraph,\n  AttributeDependencyGraph,\n  AttributeNode,\n  parseTemplate,\n  logger,\n  yieldToEventLoop,\n  Property,\n  Reference,\n  DcuplSealedError,\n} from '@dcupl/common';\n\nimport { DcuplModel } from './model/model';\nimport { orderBy, groupBy, cloneDeep } from 'lodash-es';\n\nimport { validateBasicModelStructure, validateModels } from './model/model.helper';\nimport { ERROR_TRACKING_MODEL_PREFIX, QualityController } from '../quality/quality.controller';\nimport { ChangeTracker } from './change-tracker';\nimport { PartialUpdateMetrics } from './partial-update-metrics';\nimport { isQueryReference, isResolvedReference, isDerivedReference, isGroupedReference } from './reference-type-guards';\nimport { DEFAULT_KEY_PROPERTY_SEPARATOR, extractRowKey, hasRowKey } from './key-property.helper';\n\nimport { DcuplApi, ContainerSourceMetadata } from '../dcupl/dcupl-api';\n\ntype ModelParserCalculationTimingEntry = {\n  modelName: string;\n  step: string;\n  value: number;\n};\n\n/**\n * What step 2 of a partial update recomputes of one query reference (#429): `rows`, the owner rows\n * to run it for (`'all'` = every row), and `targetKeys`, the changed, inserted and removed items of\n * its target model: the owner rows whose result they can alter are run too.\n */\ntype QueryReferenceRecompute = { rows: Set<string> | 'all'; targetKeys?: Set<string> };\ntype QueryReferencePlan = Map<string, Map<string, QueryReferenceRecompute>>;\n\n/** The rows and attributes step 1 of a partial update reprocesses for one model (#368). */\ntype PartialRowScope = {\n  /** Rows of existing items the update changed. */\n  changedRows: RawItem[];\n  /** Rows the update inserts. */\n  insertedRows: RawItem[];\n  /** Attributes the update re-derives errors for. */\n  attributes: Set<string>;\n  /** Attributes reprocessed for every row (see QualityController.prepareErrorsForPartialUpdate). */\n  allRowsAttributes: Set<string>;\n  /** Whether the update changed, inserted or deleted rows of the model. */\n  rowsChanged: boolean;\n  /** The items a referrer auto-created before the update, re-derived for `allRowsAttributes` (#608). */\n  autoCreatedRows: ReadonlyMap<string, RawItem>;\n};\n\nexport class ModelParser {\n  public unprocessedModelDescriptions: Map<string, ModelDefinition> = new Map();\n  protected unprocessedData: DataContainer<RawItem>[] = [];\n\n  // Tracks containers whose composite `keyProperty` has already been applied.\n  // Without this guard, a container re-entering handleAlternativeKey (e.g.\n  // partialUpdate calls it once for deletion lookup and a second time via\n  // getMergedContainers) re-reads the already-joined `item.key` and produces\n  // doubled values like \"100::Foo::Foo\". See #182.\n  private keyedContainers: WeakSet<DataContainer<RawItem>> = new WeakSet();\n\n  // Keys of the rows a later row with the same key replaced in a `set`\n  // payload, one entry per replaced row, kept per container the merge built.\n  // The rows are deduped before processing, so the model reads these to\n  // record its NonUniqueKey errors; a re-init merges the deduped container\n  // again and carries them over, so the errors stay the same (#369).\n  private replacedRowKeys: WeakMap<DataContainer<RawItem>, string[]> = new WeakMap();\n\n  // Row arrays of `set` containers known to have unique keys, with the row\n  // count they had then: rows isProcessableAsIs checked, and the rows\n  // mergeContainers built (unique by construction). Every apply passes every\n  // queued container through getMergedContainers, so without this an update\n  // re-checked the keys of each untouched model, O(rows) per update (#506).\n  // The count makes a row pushed onto the same array count as a change.\n  private uniqueKeyRows: WeakMap<RawItem[], number> = new WeakMap();\n\n  // Row positions by key of the `set` containers mergeContainers built while\n  // folding update/upsert/remove containers, i.e. the consolidated container of\n  // a model that is updated. The parser owns their row array, so a later apply\n  // folds update/upsert rows into it in place and finds the changed rows by key\n  // (foldIntoContainer, splitChangedRows), instead of re-merging and walking\n  // every row of the model (#445). Containers a caller staged never get one:\n  // their array stays untouched. Built only once a model is updated, so an\n  // instance that only runs init() keeps no index.\n  private rowPositions: WeakMap<DataContainer<RawItem>, Map<string, number>> = new WeakMap();\n\n  // The container each update/upsert container was folded into in place. An\n  // apply that fails before consolidateUnprocessedData() leaves both queued;\n  // the next merge skips the rows already folded into that container.\n  private foldedInto: WeakMap<DataContainer<RawItem>, DataContainer<RawItem>> = new WeakMap();\n\n  // Models whose definition `models.set`/`models.update` changed since the last init (#408). The\n  // next init rebuilds their attributes in the existing model instance (lists keep it), and the\n  // next update() takes the full path, as the partial path never re-applies a definition.\n  private definitionChanges: Set<string> = new Set();\n\n  // Models that gained or lost items a referrer auto-created during the running update() (#598,\n  // #599): their lists, which the change tracker does not name, are refreshed too.\n  private autoCreationChanges: Set<string> = new Set();\n\n  // While step 1 runs (init() and the partial path): the passes of the items it auto-creates wait\n  // for processPendingAutoCreatedItems after every model's step 1, so they read every model's\n  // basic attributes (#604, #619)\n  public defersAutoCreatedPasses = false;\n\n  // The keys a reference released during the running partial update, by the reference's\n  // `supportsAutoCreation` model (#598, see noteReleasedReferenceKey). Undefined outside it.\n  private releasedReferenceKeys: Map<string, Set<string>> | undefined;\n  // The orphans removeOrphanedAutoCreatedItems() took out in the running partial update, by model\n  private orphansRemovedInUpdate: Map<string, Set<string>> = new Map();\n\n  // Models the next init or full update drops with their data (#415), see dropModel.\n  private modelDrops: Set<string> = new Set();\n  // The instances of dropped models, emptied: lists created before hold them, so a model registered\n  // again under the key reuses its instance and those lists follow it, as after any update (#413).\n  private droppedModels: Map<string, DcuplModel> = new Map();\n\n  public dependencyGraph!: DependencyGraph;\n  public attributeDependencyGraph!: AttributeDependencyGraph;\n  public changeTracker: ChangeTracker = new ChangeTracker();\n  public partialUpdateMetrics: PartialUpdateMetrics = new PartialUpdateMetrics();\n\n  public views: Map<string, ViewDefinition> = new Map();\n  public models: Map<string, DcuplModel> = new Map();\n  public initOptions!: DcuplInitOptions;\n\n  private calculationTimings: ModelParserCalculationTimingEntry[] = [];\n  private log = logger.child({ prefix: 'ModelParser' });\n\n  // Set by seal() only: the staged log is gone, every write is rejected (#332).\n  private _sealed = false;\n\n  /** True after seal(): the staged log is gone, every write is rejected (#332). Read-only; seal() sets it (#454). */\n  public get sealed(): boolean {\n    return this._sealed;\n  }\n\n  constructor(\n    public cdRef: ChangeDetector,\n    public qualityController: QualityController,\n    public dcuplInstance: DcuplApi,\n  ) {\n    this.qualityController.modelParser = this;\n  }\n\n  /**\n   * Drops the staged raw rows and the change tracker. The built models, indices and quality\n   * errors stay. After this, addData/addModel/reprocessData/init/update throw DcuplSealedError.\n   * The preconditions are checked by DcuplApi.seal(): init() completed, no apply in flight, no pending\n   * loader resource, no unapplied staged changes (rows or model definitions).\n   */\n  public seal(): void {\n    this._sealed = true;\n    this.unprocessedData = [];\n    this.calculationTimings = [];\n    this.changeTracker.clear();\n  }\n\n  private assertNotSealed(what: string): void {\n    if (this.sealed) throw new DcuplSealedError(what);\n  }\n\n  public async init(): Promise<void> {\n    this.assertNotSealed('init');\n    // Clear change tracker at start of init\n    this.changeTracker.clear();\n    if (this.qualityController.enabled) {\n      // Reset every error the data pipeline re-detects below (reference,\n      // property, data-container errors) and the model-definition errors that\n      // building the models and validateModels re-detect (#417). Registration\n      // and loader errors are preserved as they are not re-generated by a full init.\n      this.qualityController.resetDataErrors();\n      this.qualityController.resetDefinitionErrors();\n\n      if (!this.models.get('$DcuplErrorTrackingErrors')) {\n        this.qualityController.initErrorTrackingModels();\n      }\n    }\n\n    this.prepareModels();\n\n    if (this.qualityController.enabled) {\n      // prepareModels() reset the error-tracking models, and the init pipeline below processes the\n      // error containers still queued from the last apply, as it did before they were built on first\n      // read. An unread snapshot replayed on top would serve rows of an apply that is gone (#444).\n      this.qualityController.discardPendingErrorTrackingSnapshot();\n      this.validateModels();\n    }\n\n    this.initDependencyGraph();\n    this.buildAttributeDependencyGraph();\n\n    // Validate attribute dependency graph completeness\n    this.validateAttributeDependencyGraph();\n\n    const consumedData = this.unprocessedData.filter((container) => !container.placeholderUid);\n    const relevantData = this.getMergedContainers(this.unprocessedData);\n\n    await this.connectDataWithModels(relevantData);\n\n    this.consolidateUnprocessedData(relevantData, consumedData);\n\n    if (this.qualityController.enabled) {\n      await this.qualityController.initData();\n    }\n\n    // Clear change tracker at end of init since this was a full initialization\n    // Any changes tracked during init are not \"changes\" for partial update purposes\n    this.changeTracker.clear();\n    this.retrackUnprocessedData(relevantData);\n  }\n\n  private prepareModels(): void {\n    this.applyModelDrops();\n    this.unprocessedModelDescriptions.forEach((modelDescription) => {\n      const dropped = this.droppedModels.get(modelDescription.key);\n      if (dropped) {\n        // registered again after a drop: rebuilt in the instance the lists created before hold\n        this.droppedModels.delete(modelDescription.key);\n        dropped.resetDefinition();\n        dropped.init(modelDescription);\n        dropped.initialDefinition = modelDescription;\n        dropped.applyPropertiesAndReferences(modelDescription);\n        this.models.set(dropped.key, dropped);\n      } else if (!this.models.has(modelDescription.key)) {\n        const model = new DcuplModel(this);\n        model.init(modelDescription);\n        model.applyPropertiesAndReferences(modelDescription);\n        this.models.set(model.key, model);\n      } else {\n        const model = this.models.get(modelDescription.key)!;\n        if (this.definitionChanges.has(modelDescription.key)) {\n          // A definition set or merged after init: built from it like a new model, in the\n          // instance the lists hold (#408)\n          model.resetDefinition();\n          model.init(modelDescription);\n        }\n        // `models.update` after init merged into the description: `models.get` reports the merged one\n        model.initialDefinition = modelDescription;\n        model.resetData();\n        model.resetIndexMap();\n        model.applyPropertiesAndReferences(modelDescription);\n      }\n    });\n    this.definitionChanges.clear();\n  }\n\n  /**\n   * Stages dropping `modelKey` (#415): the next `init()` or `update()`, which takes the full path,\n   * removes its definition, its data and the model, as in an instance that never had it: the global\n   * API (`query.*`, `fn.*`) throws for the key, and lists created on it serve no rows. Registering\n   * the key again with `addModel` before that cancels the drop; registering it after rebuilds the\n   * model in the same instance, so those lists follow it. The app loader uses it when a model left\n   * the loader config.\n   */\n  public dropModel(modelKey: string): void {\n    this.modelDrops.add(modelKey);\n    this.markDefinitionChanged(modelKey);\n  }\n\n  /** Whether the next init or full update drops `modelKey` (see dropModel). */\n  public hasModelDrop(modelKey: string): boolean {\n    return this.modelDrops.has(modelKey);\n  }\n\n  private applyModelDrops(): void {\n    for (const modelKey of this.modelDrops) {\n      this.unprocessedModelDescriptions.delete(modelKey);\n      this.unprocessedData = this.unprocessedData.filter((container) => container.model !== modelKey);\n      const model = this.models.get(modelKey);\n      if (model) {\n        // lists hold the instance: they serve no rows, and follow the model if it comes back\n        model.resetData();\n        model.resetIndexMap();\n        this.models.delete(modelKey);\n        this.droppedModels.set(modelKey, model);\n      }\n      // the internal list behind query.* and fn.* would keep answering for the key\n      this.dcuplInstance?.lists?.destroy({ listKey: `__global_list__${modelKey}` });\n    }\n    this.modelDrops.clear();\n  }\n\n  /**\n   * Unregisters a model (#420): its stored definition, its instance and its queued data containers,\n   * so the next init does not bring it back. Counts as a definition change, so the next `update()`\n   * rebuilds everything and references to the model resolve as to a missing model.\n   */\n  public removeModel(modelKey: string): void {\n    const registered = this.unprocessedModelDescriptions.has(modelKey) || this.models.has(modelKey);\n    this.unprocessedModelDescriptions.delete(modelKey);\n    this.models.delete(modelKey);\n    this.unprocessedData = this.unprocessedData.filter((container) => container.model !== modelKey);\n    if (registered) {\n      this.markDefinitionChanged(modelKey);\n    }\n  }\n\n  /** Unregisters a view; takes effect at once (#420). */\n  public removeView(viewKey: string): void {\n    this.views.delete(viewKey);\n  }\n\n  /**\n   * Records that `models.set`/`models.update` changed the definition of `modelKey` (#408): the next\n   * `update()` rebuilds everything, like `init()`.\n   */\n  public markDefinitionChanged(modelKey: string): void {\n    this.definitionChanges.add(modelKey);\n  }\n\n  /** The models whose definition changed since the last init (#408). */\n  public getDefinitionChanges(): string[] {\n    return Array.from(this.definitionChanges);\n  }\n\n  private validateModels(): void {\n    this.models.forEach((model) => {\n      if (model.qualityConfig.enabled === true) {\n        const errors = validateModels(model, this.models);\n        // only called with quality enabled (init); re-detected on every init (#417)\n        errors.forEach((error) => this.qualityController.setDefinitionError(error));\n      }\n    });\n  }\n\n  /**\n   * initDependencyGraph\n   * The dependencies are only affected by references. Derived properties/references do not count since they\n   * are only possible if references are already present to derive from. Same goes for resolved references.\n   */\n  private initDependencyGraph(): void {\n    this.dependencyGraph = new DependencyGraph();\n\n    this.models.forEach((model) => {\n      this.dependencyGraph.addNode(model.key);\n    });\n\n    this.models.forEach((model) => {\n      model.getReferencesRelevantForDependencyGraph().forEach((reference) => {\n        if (model.key === reference.model) {\n          return;\n        }\n        this.dependencyGraph.addNode(reference.model);\n        this.dependencyGraph.addDependency(model.key, reference.model);\n      });\n    });\n\n    // Validate that there are no circular dependencies\n    const validation = this.dependencyGraph.validateNoCycles();\n    if (validation.hasCycle) {\n      const cyclePath = validation.path!.join(' → ');\n      this.log.error(\n        `Circular dependency detected in model references: ${cyclePath}\\n` +\n          `This will cause unpredictable update ordering. Please restructure your models to remove the circular dependency.`,\n      );\n      throw new Error(\n        `Circular dependency detected: ${cyclePath}\\n` +\n          `Models cannot have circular references as this leads to unpredictable behavior during updates.`,\n      );\n    }\n  }\n\n  /**\n   * buildAttributeDependencyGraph\n   * Analyzes all models and their attributes to build attribute-level dependencies.\n   * This enables partial updates by tracking which attributes depend on others.\n   */\n  private buildAttributeDependencyGraph(): void {\n    this.attributeDependencyGraph = new AttributeDependencyGraph();\n\n    // Register every attribute with its own processing step first (#400). A\n    // node keeps the step it was first added with, and the dependency helpers\n    // below add the attributes they depend on as basic (step 1) ones: a derived\n    // property on a resolved reference, or one that reads a derived property of\n    // a model defined later, registered its source as step 1, so the partial\n    // path never recomputed it.\n    this.models.forEach((model) => {\n      model.properties.forEach((property, propertyKey) => {\n        this.attributeDependencyGraph.addAttribute({\n          modelKey: model.key,\n          attributeKey: propertyKey,\n          type: 'property',\n          processingStep: this.getAttributeProcessingStep(model, property),\n        });\n      });\n      model.references.forEach((reference, referenceKey) => {\n        this.attributeDependencyGraph.addAttribute({\n          modelKey: model.key,\n          attributeKey: referenceKey,\n          type: 'reference',\n          processingStep: this.getAttributeProcessingStep(model, reference),\n        });\n      });\n    });\n\n    this.models.forEach((model) => {\n      const modelKey = model.key;\n\n      // Process all properties\n      model.properties.forEach((property, propertyKey) => {\n        if (property.expression) {\n          // Expression properties (Step 3) - depend on all properties/references in template\n          this.processExpressionProperty(modelKey, propertyKey, property.expression);\n        } else if (property.derive) {\n          // Derived properties (Step 3) - depend on reference + remote property\n          this.processDerivedProperty(modelKey, propertyKey, property.derive);\n        } else {\n          // Basic properties (Step 1) - no dependencies\n          const node: AttributeNode = {\n            modelKey,\n            attributeKey: propertyKey,\n            type: 'property',\n            processingStep: 1,\n          };\n          this.attributeDependencyGraph.addAttribute(node);\n        }\n      });\n\n      // Process all references\n      model.references.forEach((reference, referenceKey) => {\n        if (isQueryReference(reference)) {\n          // Query references (Step 2) - depend on properties used in query templates\n          this.processQueryReference(modelKey, referenceKey, reference.query);\n        } else if (isResolvedReference(reference)) {\n          // Resolved references (Step 2) - depend on inverse reference from remote model\n          this.processResolvedReference(modelKey, referenceKey, reference.resolve);\n        } else if (isDerivedReference(reference)) {\n          // Derived references (Step 3) - depend on source reference\n          this.processDerivedReference(modelKey, referenceKey, reference.derive);\n        } else if (isGroupedReference(reference)) {\n          // Grouped references (Step 3) - depend on source reference\n          this.processGroupedReference(modelKey, referenceKey, reference.groupBy);\n        } else {\n          // Basic references (Step 1) - no dependencies\n          const node: AttributeNode = {\n            modelKey,\n            attributeKey: referenceKey,\n            type: 'reference',\n            processingStep: 1,\n          };\n          this.attributeDependencyGraph.addAttribute(node);\n        }\n      });\n    });\n  }\n\n  /**\n   * The processing step of an attribute, as the full path computes it: 1 basic\n   * properties and references, 2 query and resolved references, 3 derived and\n   * grouped references and derived and expression properties, 4 derived\n   * properties and references on a resolved reference (#400).\n   */\n  private getAttributeProcessingStep(model: DcuplModel, attribute: Property | Reference): 1 | 2 | 3 | 4 {\n    if ('query' in attribute || 'resolve' in attribute) {\n      return 2;\n    }\n    if ('derive' in attribute && attribute.derive) {\n      const localReference = model.references.get(attribute.derive.localReference);\n      return localReference && isResolvedReference(localReference) ? 4 : 3;\n    }\n    if (('expression' in attribute && attribute.expression) || 'groupBy' in attribute) {\n      return 3;\n    }\n    return 1;\n  }\n\n  /**\n   * Validates that all expected attributes are present in the attribute dependency graph.\n   * Logs warnings for any missing attributes that might indicate parsing failures.\n   */\n  private validateAttributeDependencyGraph(): void {\n    const expectedAttributes = new Map<string, string[]>();\n\n    // Build expected attributes from models\n    this.models.forEach((model) => {\n      const attributes: string[] = [];\n\n      // Collect all properties\n      model.properties.forEach((_, propertyKey) => {\n        attributes.push(propertyKey);\n      });\n\n      // Collect all references\n      model.references.forEach((_, referenceKey) => {\n        attributes.push(referenceKey);\n      });\n\n      if (attributes.length > 0) {\n        expectedAttributes.set(model.key, attributes);\n      }\n    });\n\n    // Validate completeness\n    const validation = this.attributeDependencyGraph.validateCompleteness(expectedAttributes);\n\n    if (!validation.isComplete) {\n      const missingCount = validation.missing.length;\n      const missingList = validation.missing\n        .map(({ modelKey, attributeKey }) => `${modelKey}.${attributeKey}`)\n        .slice(0, 10) // Show first 10\n        .join(', ');\n\n      const message = `Attribute dependency graph incomplete. ${missingCount} attribute(s) missing: ${missingList}${\n        missingCount > 10 ? ` ... and ${missingCount - 10} more` : ''\n      }`;\n\n      this.log.warn(\n        `${message}\\n` +\n          `These attributes will default to Step 1 processing which may be incorrect. ` +\n          `This usually indicates a problem during expression or reference parsing.`,\n      );\n    }\n  }\n\n  /**\n   * Process expression property dependencies\n   * Expression properties depend on all attributes referenced in the template\n   */\n  private processExpressionProperty(modelKey: string, propertyKey: string, expression: string): void {\n    const expressionNode: AttributeNode = {\n      modelKey,\n      attributeKey: propertyKey,\n      type: 'property',\n      processingStep: 3,\n    };\n    this.attributeDependencyGraph.addAttribute(expressionNode);\n\n    // Parse template to find dependencies\n    const { variables } = parseTemplate(expression);\n    variables.forEach((variable) => {\n      // e.g. \"productRef.categoryRef.markup\", \"tags.0.name\" or \"tags[0].name\"\n      const segments = this.getExpressionPathSegments(variable.name);\n      let currentModel = this.models.get(modelKey);\n\n      // Walk the path and depend on every attribute it reads (#385): the local property or\n      // reference, each intermediate reference and the final remote property. An index into a\n      // multi-valued reference (\"0\") is skipped; the walk ends at a property (nested object\n      // paths like \"meta.color\" read the property \"meta\") or at a segment it cannot resolve.\n      for (const segment of segments) {\n        if (!currentModel) return;\n\n        if (currentModel.properties.has(segment)) {\n          this.attributeDependencyGraph.addAttributeDependency(expressionNode, {\n            modelKey: currentModel.key,\n            attributeKey: segment,\n            type: 'property',\n            processingStep: 1,\n          });\n          return;\n        }\n\n        const reference = currentModel.references.get(segment);\n        if (reference) {\n          this.attributeDependencyGraph.addAttributeDependency(expressionNode, {\n            modelKey: currentModel.key,\n            attributeKey: segment,\n            type: 'reference',\n            processingStep: 1,\n          });\n          currentModel = this.models.get(reference.model);\n          continue;\n        }\n\n        if (!/^\\d+$/.test(segment)) return;\n      }\n    });\n  }\n\n  /**\n   * Splits an expression variable path into its segments; bracket indices become segments of\n   * their own: \"tags[0].name\" -> [\"tags\", \"0\", \"name\"].\n   */\n  private getExpressionPathSegments(path: string): string[] {\n    return path\n      .replace(/\\[\\s*['\"]?([^\\]'\"]*?)['\"]?\\s*\\]/g, '.$1')\n      .split('.')\n      .map((segment) => segment.trim())\n      .filter((segment) => segment.length > 0);\n  }\n\n  /**\n   * Process derived property dependencies\n   * Derived properties depend on a local reference and the remote property\n   */\n  private processDerivedProperty(\n    modelKey: string,\n    propertyKey: string,\n    derive: { localReference: string; remoteProperty: string },\n  ): void {\n    const derivedNode: AttributeNode = {\n      modelKey,\n      attributeKey: propertyKey,\n      type: 'property',\n      processingStep: 3,\n    };\n    this.attributeDependencyGraph.addAttribute(derivedNode);\n\n    // Depends on local reference\n    const localRefNode: AttributeNode = {\n      modelKey,\n      attributeKey: derive.localReference,\n      type: 'reference',\n      processingStep: 1, // Assume basic reference for now\n    };\n    this.attributeDependencyGraph.addAttributeDependency(derivedNode, localRefNode);\n\n    // Also depends on the remote property\n    const model = this.models.get(modelKey);\n    if (model) {\n      const reference = model.references.get(derive.localReference);\n      if (reference) {\n        const remotePropertyNode: AttributeNode = {\n          modelKey: reference.model,\n          attributeKey: derive.remoteProperty,\n          type: 'property',\n          processingStep: 1,\n        };\n        this.attributeDependencyGraph.addAttributeDependency(derivedNode, remotePropertyNode);\n      }\n    }\n  }\n\n  /**\n   * Process query reference dependencies\n   * Query references depend on properties used in the query template\n   */\n  private processQueryReference(modelKey: string, referenceKey: string, query: any): void {\n    const queryRefNode: AttributeNode = {\n      modelKey,\n      attributeKey: referenceKey,\n      type: 'reference',\n      processingStep: 2,\n    };\n    this.attributeDependencyGraph.addAttribute(queryRefNode);\n\n    // Parse query as JSON string to find template variables\n    try {\n      const queryString = JSON.stringify(query);\n      const { variables } = parseTemplate(queryString);\n\n      variables.forEach((variable) => {\n        const varName = variable.name;\n        const model = this.models.get(modelKey);\n        if (!model) return;\n\n        // Check if it's a property or reference in this model\n        if (model.properties.has(varName)) {\n          const depNode: AttributeNode = {\n            modelKey,\n            attributeKey: varName,\n            type: 'property',\n            processingStep: 1,\n          };\n          this.attributeDependencyGraph.addAttributeDependency(queryRefNode, depNode);\n        } else if (model.references.has(varName)) {\n          const depNode: AttributeNode = {\n            modelKey,\n            attributeKey: varName,\n            type: 'reference',\n            processingStep: 1,\n          };\n          this.attributeDependencyGraph.addAttributeDependency(queryRefNode, depNode);\n        }\n      });\n    } catch (_err) {\n      // If query parsing fails, skip dependencies\n    }\n  }\n\n  /**\n   * Process resolved reference dependencies\n   * Resolved references depend on the inverse reference from the remote model\n   */\n  private processResolvedReference(\n    modelKey: string,\n    referenceKey: string,\n    resolve: { reference: string; model: string },\n  ): void {\n    const resolvedNode: AttributeNode = {\n      modelKey,\n      attributeKey: referenceKey,\n      type: 'reference',\n      processingStep: 2,\n    };\n    this.attributeDependencyGraph.addAttribute(resolvedNode);\n\n    // Depends on the remote reference\n    const remoteRefNode: AttributeNode = {\n      modelKey: resolve.model,\n      attributeKey: resolve.reference,\n      type: 'reference',\n      processingStep: 1, // Assume basic reference\n    };\n    this.attributeDependencyGraph.addAttributeDependency(resolvedNode, remoteRefNode);\n  }\n\n  /**\n   * Process derived reference dependencies\n   * Derived references depend on a local reference\n   */\n  private processDerivedReference(\n    modelKey: string,\n    referenceKey: string,\n    derive: { localReference: string; remoteReference: string },\n  ): void {\n    const derivedRefNode: AttributeNode = {\n      modelKey,\n      attributeKey: referenceKey,\n      type: 'reference',\n      processingStep: 3,\n    };\n    this.attributeDependencyGraph.addAttribute(derivedRefNode);\n\n    // Depends on local reference\n    const localRefNode: AttributeNode = {\n      modelKey,\n      attributeKey: derive.localReference,\n      type: 'reference',\n      processingStep: 1,\n    };\n    this.attributeDependencyGraph.addAttributeDependency(derivedRefNode, localRefNode);\n\n    // Also depends on the remote reference\n    const model = this.models.get(modelKey);\n    if (model) {\n      const reference = model.references.get(derive.localReference);\n      if (reference) {\n        const remoteRefNode: AttributeNode = {\n          modelKey: reference.model,\n          attributeKey: derive.remoteReference,\n          type: 'reference',\n          processingStep: 1,\n        };\n        this.attributeDependencyGraph.addAttributeDependency(derivedRefNode, remoteRefNode);\n      }\n    }\n  }\n\n  /**\n   * Process grouped reference dependencies\n   * Grouped references depend on a source reference\n   */\n  private processGroupedReference(modelKey: string, referenceKey: string, groupBy: { reference: string }): void {\n    const groupedRefNode: AttributeNode = {\n      modelKey,\n      attributeKey: referenceKey,\n      type: 'reference',\n      processingStep: 3,\n    };\n    this.attributeDependencyGraph.addAttribute(groupedRefNode);\n\n    // Depends on the source reference\n    const sourceRefNode: AttributeNode = {\n      modelKey,\n      attributeKey: groupBy.reference,\n      type: 'reference',\n      processingStep: 1,\n    };\n    this.attributeDependencyGraph.addAttributeDependency(groupedRefNode, sourceRefNode);\n  }\n\n  /**\n   * Applies the pending changes, on the partial path when it is possible and worth it, otherwise\n   * as a full rebuild (`init()`).\n   *\n   * @returns The path taken: `'partial'` or `'full'` (dcupl.update() reports it as\n   * `isPartialUpdate` on `dcupl_partial_update`, #383)\n   */\n  public async update(): Promise<'partial' | 'full'> {\n    this.assertNotSealed('update');\n    const startTime = performance.now();\n    this.autoCreationChanges.clear();\n    for (const model of this.models.values()) {\n      model.clearAutoCreatedInUpdate();\n    }\n\n    // Check if we can do a partial update\n    const shouldUsePartial = this.shouldUsePartialUpdate();\n\n    if (shouldUsePartial.decision) {\n      this.recordOriginColumnChanges();\n\n      // Capture metrics before update\n      const modelsAffected = this.changeTracker.getModelsWithChanges().length;\n      const attributesChanged = Array.from(this.changeTracker.getChangedAttributes().values()).reduce(\n        (sum, attrs) => sum + attrs.size,\n        0,\n      );\n      const itemsChanged = this.changeTracker.getTotalChangedItemCount();\n\n      await this.partialUpdate();\n\n      const duration = performance.now() - startTime;\n\n      // Record metrics\n      this.partialUpdateMetrics.recordUpdate({\n        type: 'partial',\n        durationMs: duration,\n        modelsAffected,\n        attributesProcessed: attributesChanged,\n        itemsChanged,\n        decisionReason: shouldUsePartial.reason,\n        timestamp: Date.now(),\n      });\n      return 'partial';\n    } else {\n      // Fall back to full update\n      await this.init();\n\n      const duration = performance.now() - startTime;\n\n      // Record metrics\n      this.partialUpdateMetrics.recordUpdate({\n        type: 'full',\n        durationMs: duration,\n        decisionReason: shouldUsePartial.reason,\n        timestamp: Date.now(),\n      });\n      return 'full';\n    }\n  }\n\n  /**\n   * The tracker records the raw columns of the staged rows. A property or reference with\n   * `origin` reads another column, so a changed origin column changes that attribute, as\n   * init() maps it (#605). Without this the partial path never reprocessed it.\n   */\n  public recordOriginColumnChanges(): void {\n    for (const [modelKey, columns] of this.changeTracker.getChangedAttributes()) {\n      const model = this.models.get(modelKey);\n      if (!model) continue;\n      for (const attribute of [...model.properties.values(), ...model.references.values()]) {\n        if (attribute.origin && columns.has(attribute.origin)) {\n          this.changeTracker.recordAttributeChange(modelKey, attribute.key);\n        }\n      }\n    }\n  }\n\n  /**\n   * Determines if a partial update is possible and beneficial\n   * @returns object with decision and reason\n   */\n  private shouldUsePartialUpdate(): { decision: boolean; reason: string } {\n    // Get configurable thresholds\n    const config = this.dcuplInstance.initOptions.performance?.partialUpdates;\n    const modelRatioThreshold = config?.modelRatioThreshold ?? 0.5;\n    const itemRatioThreshold = config?.itemRatioThreshold ?? 0.5;\n    const enableLogging = config?.enableDetailedLogging ?? false;\n\n    // A definition changed after init: only a full rebuild applies it (#408)\n    if (this.definitionChanges.size > 0) {\n      if (enableLogging) {\n        this.log.debug('Partial update decision: FULL', { reason: 'definition_changed' });\n      }\n      return { decision: false, reason: 'definition_changed' };\n    }\n\n    // If no changes tracked, skip update entirely\n    if (!this.changeTracker.hasChanges()) {\n      if (enableLogging) {\n        this.log.debug('Partial update decision: SKIP', { reason: 'no_changes_detected' });\n      }\n      return { decision: false, reason: 'no_changes_detected' };\n    }\n\n    // If any model has full reset (type='set'), do full update\n    if (this.changeTracker.getModelsWithFullReset().size > 0) {\n      if (enableLogging) {\n        this.log.debug('Partial update decision: FULL', { reason: 'full_reset_detected' });\n      }\n      return { decision: false, reason: 'full_reset_detected' };\n    }\n\n    // Calculate if partial update is worth it\n    // Only count non-internal models (exclude $ prefixed models like error tracking)\n    const totalModelCount = Array.from(this.models.keys()).filter((key) => !key.startsWith('$')).length;\n    const affectedModelRatio = this.changeTracker.getAffectedModelRatio(totalModelCount);\n\n    // Check item-level changes for affected models\n    let totalItems = 0;\n    let totalChangedItems = 0;\n\n    for (const modelKey of this.changeTracker.getModelsWithChanges()) {\n      const model = this.models.get(modelKey);\n      if (model) {\n        const modelItemCount = model.getData().size;\n        totalItems += modelItemCount;\n        totalChangedItems += this.changeTracker.getChangedItems(modelKey).size;\n        totalChangedItems += this.changeTracker.getDeletedItems(modelKey).size;\n      }\n    }\n\n    const itemRatio = totalItems > 0 ? totalChangedItems / totalItems : 0;\n\n    // Decision logic: Use partial update unless BOTH model AND item ratios are high\n    // This prevents false negatives like \"1 model, 10000 items, change 1 item\"\n    const bothRatiosHigh = affectedModelRatio > modelRatioThreshold && itemRatio > itemRatioThreshold;\n\n    if (bothRatiosHigh) {\n      if (enableLogging) {\n        this.log.debug('Partial update decision: FULL', {\n          reason: 'both_ratios_high',\n          modelRatio: affectedModelRatio.toFixed(2),\n          itemRatio: itemRatio.toFixed(2),\n        });\n      }\n      return {\n        decision: false,\n        reason: `both_ratios_high:models=${affectedModelRatio.toFixed(2)},items=${itemRatio.toFixed(2)}`,\n      };\n    }\n\n    // Use partial update\n    if (enableLogging) {\n      this.log.debug('Partial update decision: PARTIAL', {\n        modelRatio: affectedModelRatio.toFixed(2),\n        itemRatio: itemRatio.toFixed(2),\n        modelThreshold: modelRatioThreshold,\n        itemThreshold: itemRatioThreshold,\n      });\n    }\n    return {\n      decision: true,\n      reason: `optimal:models=${affectedModelRatio.toFixed(2)},items=${itemRatio.toFixed(2)}`,\n    };\n  }\n\n  /**\n   * The query references a partial update recomputes (#429; #367 took the\n   * full path for them), and for which rows of their owner model:\n   * - a model the target model reaches through its references changed, the\n   *   target generated a property (it fills rows the update did not touch),\n   *   or the query reads a dotted path or pages with an offset\n   *   (isMatchSetQuery): every row;\n   * - the target model changed: the owner rows whose result lists one of the\n   *   changed, inserted or removed target items, or whose query matches one of\n   *   them now; the other rows keep the same matches (step 2 decides);\n   * - the owner model changed: its changed and inserted rows, whose raw values\n   *   fill the query templates.\n   * Records each as a changed attribute, so it and its dependents are planned.\n   */\n  private planQueryReferences(\n    changedRowsByModel: Map<string, { changedRows: RawItem[]; insertedRows: RawItem[] }>,\n    generatedAttributes: Map<string, Set<string>>,\n  ): QueryReferencePlan {\n    const changedModels = new Set(this.changeTracker.getModelsWithChanges());\n    const reachableByTarget = new Map<string, Set<string>>();\n    const rowKeysOf = (modelKey: string): Set<string> => {\n      const { changedRows, insertedRows } = changedRowsByModel.get(modelKey) ?? { changedRows: [], insertedRows: [] };\n      return new Set([...changedRows, ...insertedRows].map((row) => String(row.key)));\n    };\n    const plan: QueryReferencePlan = new Map();\n\n    for (const model of this.models.values()) {\n      for (const queryReference of model.getQueryReferences()) {\n        let reachable = reachableByTarget.get(queryReference.model);\n        if (!reachable) {\n          reachable = this.getModelsReachableFrom(queryReference.model);\n          reachableByTarget.set(queryReference.model, reachable);\n        }\n\n        let recompute: QueryReferenceRecompute | undefined;\n        const targetChanged = changedModels.has(queryReference.model);\n        const reachedModelChanged = [...reachable].some(\n          (modelKey) => modelKey !== queryReference.model && changedModels.has(modelKey),\n        );\n        // A property the target generated in this update fills untouched rows too (#373)\n        const targetRowsChanged = generatedAttributes.has(queryReference.model);\n        if (\n          reachedModelChanged ||\n          targetRowsChanged ||\n          (targetChanged && !this.isMatchSetQuery(queryReference.query))\n        ) {\n          recompute = { rows: 'all' };\n        } else {\n          const rows = changedModels.has(model.key) ? rowKeysOf(model.key) : new Set<string>();\n          const targetKeys = targetChanged\n            ? new Set([...rowKeysOf(queryReference.model), ...this.changeTracker.getDeletedItems(queryReference.model)])\n            : undefined;\n          if (rows.size > 0 || (targetKeys && targetKeys.size > 0)) {\n            recompute = { rows, targetKeys };\n          }\n        }\n        if (!recompute) continue;\n\n        const modelPlan = plan.get(model.key) ?? new Map<string, QueryReferenceRecompute>();\n        modelPlan.set(queryReference.key, recompute);\n        plan.set(model.key, modelPlan);\n      }\n    }\n\n    for (const [modelKey, references] of plan) {\n      for (const referenceKey of references.keys()) {\n        this.changeTracker.recordAttributeChange(modelKey, referenceKey);\n      }\n    }\n    return plan;\n  }\n\n  /**\n   * Whether only a changed item the result lists, or one the query matches\n   * now, can alter a query reference's result (#429). Not so for an offset\n   * page (`start`: a match that disappears before the page moves later items\n   * into it). A `count`, a `sort` or a projection keep it: the first N matches\n   * change only through a match that is listed or new. A dotted path is left\n   * to every row as well: query.execute matches it on projected items\n   * (Filter.getProjectionForQuery), the check on the stored ones.\n   */\n  private isMatchSetQuery(query: unknown): boolean {\n    if (!Array.isArray(query)) {\n      if (!query || typeof query !== 'object') return false;\n      if (((query as { start?: unknown }).start ?? 0) !== 0) return false;\n    }\n    const readsPath = (node: unknown): boolean => {\n      if (Array.isArray(node)) return node.some(readsPath);\n      if (!node || typeof node !== 'object') return false;\n      const { attribute, queries } = node as { attribute?: unknown; queries?: unknown };\n      return (typeof attribute === 'string' && attribute.includes('.')) || readsPath(queries);\n    };\n    return !readsPath(query);\n  }\n\n  /**\n   * Drops the cached results of the hidden list that `query.execute` uses for\n   * each model the query references of `modelKeys` run over. Query references\n   * are computed through that list while an update runs, but dcupl.update()\n   * invalidates the lists only after it, so a query that ran before the update\n   * served its pre-update result: removed items stayed, changed ones were\n   * missed (#429). Covers the full and the partial path.\n   */\n  private invalidateQueryReferenceTargetLists(modelKeys: Iterable<string>): void {\n    const targets = new Set<string>();\n    for (const modelKey of modelKeys) {\n      for (const queryReference of this.models.get(modelKey)?.getQueryReferences() ?? []) {\n        targets.add(queryReference.model);\n      }\n    }\n    for (const target of targets) {\n      this.dcuplInstance?.lists?.get(`__global_list__${target}`)?.invalidate();\n    }\n  }\n\n  /**\n   * The model itself plus every model it reaches through its references of\n   * any kind, transitively.\n   */\n  private getModelsReachableFrom(modelKey: string): Set<string> {\n    const reachable = new Set<string>([modelKey]);\n    const queue = [modelKey];\n    while (queue.length > 0) {\n      const model = this.models.get(queue.pop()!);\n      if (!model) continue;\n      for (const reference of model.references.values()) {\n        if (!reachable.has(reference.model)) {\n          reachable.add(reference.model);\n          queue.push(reference.model);\n        }\n      }\n    }\n    return reachable;\n  }\n\n  /**\n   * Performs a partial update by only reprocessing changed attributes and their dependents\n   */\n  private async partialUpdate(): Promise<void> {\n    this.releasedReferenceKeys = new Map();\n    this.orphansRemovedInUpdate = new Map();\n    try {\n      await this.partialUpdateSteps();\n    } finally {\n      this.releasedReferenceKeys = undefined;\n    }\n  }\n\n  private async partialUpdateSteps(): Promise<void> {\n    // Don't reset all model errors in partial update - only the errors of the changed and deleted\n    // items are re-derived (#368, see getPartialRowScopes)\n\n    // Handle deletions first, before merging\n    const allContainers = this.handleAlternativeKey(this.unprocessedData).filter(\n      (container) => !container.placeholderUid,\n    );\n    // Rows keyed by a custom keyProperty or autoGenerateKey only have their key now\n    this.changeTracker.refreshItemKeys();\n\n    for (const container of allContainers) {\n      if (container.type === 'remove') {\n        const model = this.models.get(container.model);\n        if (model) {\n          model.deleteDataEntries(container);\n\n          // Record all properties as changed to trigger derived property updates in other models\n          // E.g., deleting modelB.propB should clear modelA.derivedProp (derived from modelB.propB)\n          for (const property of model.properties.values()) {\n            this.changeTracker.recordAttributeChange(container.model, property.key);\n          }\n\n          // Record all references as changed to trigger resolved reference updates in other models\n          // E.g., deleting a product should update category.products (resolved ref)\n          for (const reference of model.references.values()) {\n            this.changeTracker.recordAttributeChange(container.model, reference.key);\n          }\n        }\n      }\n    }\n\n    // Now merge and process non-remove containers\n    const consumedData = this.unprocessedData.filter((container) => !container.placeholderUid);\n    const relevantData = this.getMergedContainers(this.unprocessedData);\n    await this.connectDataWithModelsPartial(relevantData);\n\n    this.consolidateUnprocessedData(relevantData, consumedData);\n\n    if (this.qualityController.enabled && this.qualityController.hasErrorChangesSinceInitData()) {\n      // Rebuild $DcuplErrorTrackingErrors / $DcuplErrorTrackingSummary from the\n      // updated error records, as init() does (#368). initData() replaces their\n      // queued containers and builds the new ones itself, at once or on first read\n      // (#444): drop those from the change tracker (retrackUnprocessedData\n      // re-records anything else).\n      await this.qualityController.initData();\n      this.changeTracker.clear();\n    }\n\n    this.retrackUnprocessedData(relevantData);\n  }\n\n  public async reprocessData(): Promise<void> {\n    this.assertNotSealed('reprocessData');\n    if (this.qualityController.enabled) {\n      this.qualityController.resetModelErrors();\n    }\n    const relevantData = this.getMergedContainers(this.unprocessedData);\n    await this.connectDataWithModels(relevantData);\n  }\n\n  protected getSortedCalculationTimings(): ModelParserCalculationTimingEntry[] {\n    return orderBy(this.calculationTimings, 'value');\n  }\n\n  /**\n   * Registers a model definition, merged into an earlier one with the same key (`models.update`;\n   * `models.set` drops the earlier one first). The parser keeps its own copy, so later changes to\n   * `model` do not reach this instance, and init does not write into it (#314). Inline `data` is not\n   * part of the stored definition: it is queued through `addData`, like `dcupl.data.set`, so\n   * `models.get` does not return it.\n   */\n  @trigger({\n    scope: 'global',\n    type: 'model_add',\n    connectMessage: true,\n  })\n  public addModel(model: ModelDefinition): void {\n    this.assertNotSealed('models');\n    if (model?.quality?.enabled !== false) {\n      try {\n        validateBasicModelStructure(model);\n      } catch (err: any) {\n        if (this.qualityController.enabled) {\n          this.qualityController.setError({\n            title: 'Invalid Model Definition',\n            type: 'model',\n            errorGroup: 'ModelDefinitionError',\n            errorType: 'InvalidModelDefinition',\n            model: model.key,\n            description: err.message,\n          });\n        }\n        return;\n      }\n    }\n\n    const { data, ...rest } = model;\n    const definition: ModelDefinition = cloneDeep(rest);\n    this.modelDrops.delete(definition.key);\n\n    if (this.unprocessedModelDescriptions.has(definition.key)) {\n      const existingModel = this.unprocessedModelDescriptions.get(definition.key)!;\n      const newModel = this.mergeModels(existingModel, definition);\n      this.unprocessedModelDescriptions.set(definition.key, newModel);\n    } else {\n      this.unprocessedModelDescriptions.set(definition.key, definition);\n    }\n\n    if (data) {\n      this.addData({\n        model: definition.key,\n        data,\n        autoGenerateProperties: definition.autoGenerateProperties,\n        autoGenerateKey: definition.autoGenerateKey,\n        keyProperty: definition.keyProperty,\n      });\n    }\n  }\n\n  private mergeModels(modelA: ModelDefinition, modelB: ModelDefinition): ModelDefinition {\n    // Scalar/object fields (keyProperty, keyPropertySeparator, autoGenerateKey,\n    // autoGenerateProperties, meta, quality, ...) follow a last-write-wins\n    // contract: modelB overrides modelA for any field it carries. The\n    // `properties` and `references` arrays are the exception — they are\n    // concatenated so that successive definitions accumulate rather than clobber.\n    const newModel = Object.assign({}, modelA, modelB);\n\n    if (Array.isArray(modelA.properties) || Array.isArray(modelB.properties)) {\n      newModel.properties = [\n        ...(Array.isArray(modelA.properties) ? modelA.properties : []),\n        ...(Array.isArray(modelB.properties) ? modelB.properties : []),\n      ];\n    }\n    if (Array.isArray(modelA.references) || Array.isArray(modelB.references)) {\n      newModel.references = [\n        ...(Array.isArray(modelA.references) ? modelA.references : []),\n        ...(Array.isArray(modelB.references) ? modelB.references : []),\n      ];\n    }\n\n    return newModel;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'data_change',\n    connectMessage: true,\n  })\n  public addData(container: DataContainer<RawItem>): void {\n    this.assertNotSealed('data');\n    if (!container || !container.model || !container.data) {\n      throw new Error('Invalid Data Container');\n    }\n\n    if (!Array.isArray(container.data)) {\n      throw new Error('Invalid Data - Data must be an Array');\n    }\n\n    if (!container.type) {\n      container.type = 'set';\n    }\n\n    if (container.autoGenerateProperties) {\n      this.addModel({\n        key: container.model,\n        autoGenerateProperties: container.autoGenerateProperties,\n        autoGenerateKey: container.autoGenerateKey,\n        keyProperty: container.keyProperty || 'key',\n      });\n    }\n\n    // Track data changes for partial updates\n    this.changeTracker.recordDataChange(container);\n\n    this.unprocessedData.push(container);\n  }\n\n  /** Registers a view definition. The parser keeps its own copy (#314). */\n  @trigger({\n    scope: 'global',\n    type: 'view_add',\n    connectMessage: true,\n  })\n  public addView(view: ViewDefinition): void {\n    this.views.set(view.key, cloneDeep(view));\n  }\n\n  /**\n   * Sets a validation error for a model.\n   * Requires both global quality controller AND model-specific quality to be enabled.\n   * This implements the two-tier validation system.\n   */\n  private setError(error: QualityAnalyzer.InternalModelError, model: DcuplModel): void {\n    if (this.qualityController.enabled) {\n      if (model.qualityConfig.enabled === true) {\n        this.qualityController.setError(error);\n      }\n    }\n  }\n\n  /**\n   * Folds each model's queued containers into the one `set` container that is\n   * processed. A lone `set` container whose rows have unique keys is processed\n   * as is. Every other group goes through mergeContainers(), which applies the\n   * containers in order and dedupes the rows by key: a lone `update`/`remove`\n   * on a model without data changes nothing (#365), and duplicate keys in a\n   * `set` payload keep only the last row (#369).\n   */\n  private getMergedContainers(containers: DataContainer<RawItem>[]): DataContainer<RawItem>[] {\n    const newContainers = this.handleAlternativeKey(containers);\n    const relevantContainer = newContainers.filter((container) => !container.placeholderUid);\n    const mergedContainers: DataContainer<RawItem>[] = [];\n\n    const groupedContainers = groupBy(relevantContainer, 'model');\n\n    for (const key in groupedContainers) {\n      const containerGroup = this.withoutFoldedContainers(groupedContainers[key]!);\n      if (containerGroup.length === 1 && this.isProcessableAsIs(containerGroup[0]!)) {\n        mergedContainers.push(containerGroup[0]!);\n        continue;\n      }\n\n      const container = this.foldIntoContainer(containerGroup) ?? this.mergeContainers(containerGroup);\n      const mergedMetadata = this.mergeContainerSourceMetadata(containerGroup);\n      if (mergedMetadata) {\n        this.dcuplInstance.setContainerSourceMetadata(container, mergedMetadata);\n      }\n      mergedContainers.push(container);\n    }\n\n    return mergedContainers;\n  }\n\n  /**\n   * `containers` without the update/upsert containers an earlier apply folded\n   * into the `set` container they follow (foldIntoContainer): that apply\n   * failed before it took them out of the queue, and their rows are in the\n   * `set` container already.\n   */\n  private withoutFoldedContainers(containers: DataContainer<RawItem>[]): DataContainer<RawItem>[] {\n    let setContainer: DataContainer<RawItem> | undefined;\n    return containers.filter((container) => {\n      if (container.type === undefined || container.type === 'set') {\n        setContainer = container;\n        return true;\n      }\n      return setContainer === undefined || this.foldedInto.get(container) !== setContainer;\n    });\n  }\n\n  /**\n   * Folds a model's update/upsert/remove containers into its consolidated\n   * container in place (#445), instead of merging all its rows again. The\n   * group is one `set` container whose rows have unique keys, followed only by\n   * update/upsert/remove containers. The result is the container\n   * mergeContainers() returns for the same group, in the same row order: an\n   * update merges a row into the stored row with the same key and ignores\n   * unknown keys, an upsert does the same or appends the row, a remove takes\n   * the rows out and the rows after them move up.\n   *\n   * The parser changes only row arrays it owns: a `set` container without row\n   * positions (the caller's, or one a merge without changes built) is copied\n   * once into a new container, as mergeContainers() would build it. Returns\n   * `undefined` for every other group, which mergeContainers() merges: a later\n   * `set`, an upsert row without a key, or rows without a key in the `set`\n   * container.\n   */\n  private foldIntoContainer(containers: DataContainer<RawItem>[]): DataContainer<RawItem> | undefined {\n    const source = containers[0]!;\n    if (containers.length < 2 || (source.type !== undefined && source.type !== 'set')) {\n      return undefined;\n    }\n    const changes = containers.slice(1);\n    for (const container of changes) {\n      if (container.type === 'update' || container.type === 'remove') continue;\n      if (container.type !== 'upsert' || !container.data.every((row) => hasRowKey(row))) {\n        return undefined;\n      }\n    }\n\n    const target = this.rowPositions.has(source) ? source : this.adoptContainer(source);\n    const positions = target && this.rowPositions.get(target);\n    if (!target || !positions || positions.size !== target.data.length) {\n      return undefined;\n    }\n\n    const rows = target.data;\n    for (const container of changes) {\n      if (container.type === 'remove') {\n        this.removeRows(rows, positions, container.data);\n      } else {\n        for (const entry of container.data) {\n          if (!hasRowKey(entry)) continue;\n          const rowKey = String(entry.key);\n          const position = positions.get(rowKey);\n          if (position !== undefined) {\n            rows[position] = this.mergeRow(rows[position]!, entry);\n          } else if (container.type === 'upsert') {\n            positions.set(rowKey, rows.length);\n            rows.push(entry);\n          }\n        }\n      }\n      this.foldedInto.set(container, target);\n    }\n    this.uniqueKeyRows.set(rows, rows.length);\n    return target;\n  }\n\n  /**\n   * A copy of a `set` container whose rows have unique keys, with its row\n   * positions, for foldIntoContainer(); `undefined` when its keys are not\n   * known to be unique or a row has no key. Built like mergeContainers()\n   * builds its result from that one container.\n   */\n  private adoptContainer(source: DataContainer<RawItem>): DataContainer<RawItem> | undefined {\n    if (this.uniqueKeyRows.get(source.data) !== source.data.length) {\n      return undefined;\n    }\n    const positions = new Map<string, number>();\n    for (let position = 0; position < source.data.length; position++) {\n      const row = source.data[position]!;\n      if (!hasRowKey(row)) {\n        return undefined;\n      }\n      positions.set(String(row.key), position);\n    }\n\n    const container: DataContainer<RawItem> = { model: source.model, data: source.data.slice(), type: 'set' };\n    if (source.keyProperty !== undefined) {\n      container.keyProperty = source.keyProperty;\n    }\n    if (source.keyPropertySeparator !== undefined) {\n      container.keyPropertySeparator = source.keyPropertySeparator;\n    }\n    const replacedRowKeys = this.getReplacedRowKeys(source);\n    if (replacedRowKeys.length > 0) {\n      this.replacedRowKeys.set(container, [...replacedRowKeys]);\n    }\n    this.keyedContainers.add(container);\n    this.rowPositions.set(container, positions);\n    return container;\n  }\n\n  /** Takes the rows with the keys of `entries` out of `rows` in place; the rows after them move up. */\n  private removeRows(rows: RawItem[], positions: Map<string, number>, entries: readonly RawItem[]): void {\n    const removed = new Set<number>();\n    for (const entry of entries) {\n      if (!hasRowKey(entry)) continue;\n      const rowKey = String(entry.key);\n      const position = positions.get(rowKey);\n      if (position !== undefined) {\n        removed.add(position);\n        positions.delete(rowKey);\n      }\n    }\n    if (removed.size === 0) {\n      return;\n    }\n    let write = rows.length;\n    for (const position of removed) {\n      write = Math.min(write, position);\n    }\n    for (let read = write; read < rows.length; read++) {\n      if (removed.has(read)) continue;\n      const row = rows[read]!;\n      rows[write] = row;\n      positions.set(String(row.key), write);\n      write++;\n    }\n    rows.length = write;\n  }\n\n  /**\n   * Keys of the rows that a later row with the same key replaced in the `set`\n   * payload behind `container`, one entry per replaced row (#369). Empty for\n   * containers without duplicate keys.\n   */\n  public getReplacedRowKeys(container: DataContainer<RawItem>): readonly string[] {\n    return this.replacedRowKeys.get(container) ?? [];\n  }\n\n  /**\n   * A lone container needs no merge when it is a `set` whose rows have unique\n   * keys. A lone `update`/`upsert`/`remove` is merged onto an empty dataset,\n   * so an update or remove on a model without data changes nothing (#365).\n   */\n  private isProcessableAsIs(container: DataContainer<RawItem>): boolean {\n    if (container.type !== undefined && container.type !== 'set') {\n      return false;\n    }\n    if (this.uniqueKeyRows.get(container.data) === container.data.length) {\n      return true;\n    }\n    const rowKeys = new Set<string>();\n    for (const row of container.data) {\n      if (!hasRowKey(row)) {\n        continue;\n      }\n      const rowKey = String(row.key);\n      if (rowKeys.has(rowKey)) {\n        return false;\n      }\n      rowKeys.add(rowKey);\n    }\n    this.uniqueKeyRows.set(container.data, container.data.length);\n    return true;\n  }\n\n  /**\n   * Collapse the accumulated container history into the already-merged per-model\n   * result so `unprocessedData` stays bounded (≈ one container per model) instead\n   * of growing with every data mutation — the merged result is identical to\n   * re-merging the full history, so this is behavior-preserving and only affects\n   * how much is re-merged on the next cycle. Runs after processing completes.\n   *\n   * - Only the containers the apply merged (`consumedContainers`) are collapsed.\n   *   Every other container stays queued after the merged result, keeping its\n   *   relative order: pending (unresolved) placeholders, and placeholders\n   *   resolved or containers staged while the apply ran — it yields to the\n   *   event loop, and dropping those lost their data. A placeholder that was\n   *   already pending therefore folds after containers this apply merged, even\n   *   ones staged after it (as before).\n   * - Merged containers are registered as already-keyed so a subsequent\n   *   handleAlternativeKey pass does not re-apply a composite keyProperty (#182).\n   */\n  private consolidateUnprocessedData(\n    mergedContainers: DataContainer<RawItem>[],\n    consumedContainers: DataContainer<RawItem>[],\n  ): void {\n    const consumed = new Set(consumedContainers);\n    const pendingContainers = this.unprocessedData.filter((container) => !consumed.has(container));\n    // A merged container replaces the containers it was merged from, so it is kept only while they\n    // are still queued: `models.remove` during the apply took them out, and its rows must not come\n    // back with a later `models.set` (#420).\n    const stillQueued = new Set(this.unprocessedData);\n    const queuedModels = new Set(\n      consumedContainers.filter((container) => stillQueued.has(container)).map((container) => container.model),\n    );\n    const keptContainers = mergedContainers.filter((container) => queuedModels.has(container.model));\n    for (const container of keptContainers) {\n      this.keyedContainers.add(container);\n    }\n    this.unprocessedData = [...keptContainers, ...pendingContainers];\n  }\n\n  /**\n   * Re-records the containers still queued on top of the merged result after\n   * an apply cleared the change tracker. They were staged (or their\n   * placeholder resolved) while the apply ran and are not processed yet: the\n   * next apply must still see them, or its partial path skips their data.\n   * Left out: pending placeholders, which carry no data yet (as before), and\n   * internal `$` models, whose containers the apply stages and builds itself\n   * (quality initData stages the error-tracking models, built at once or on\n   * first read).\n   */\n  private retrackUnprocessedData(mergedContainers: DataContainer<RawItem>[]): void {\n    const merged = new Set(mergedContainers);\n    for (const container of this.unprocessedData) {\n      if (merged.has(container) || container.placeholderUid || container.model.startsWith('$')) {\n        continue;\n      }\n      this.changeTracker.recordDataChange(container);\n    }\n  }\n\n  /**\n   * Applies a model's containers in order and returns one `set` container\n   * with one row per key. Keys are compared as strings, the same identity the\n   * model stores, and rows without a key are passed through for the model to\n   * drop as `MissingKey`.\n   *\n   * - `set`: replaces the rows. Rows with the same key are deduped: the last\n   *   row wins as a whole and keeps the first row's position; the keys of the\n   *   replaced rows are kept for the model's NonUniqueKey errors (#369).\n   * - `upsert`: merges a row into the stored row with the same key (see\n   *   mergeRow) or inserts it.\n   * - `update`: merges a row into the stored row with the same key and ignores\n   *   unknown keys, also when the model has no rows yet (#365).\n   * - `remove`: deletes the rows with the given keys; unknown keys are ignored.\n   *\n   * The result carries the key settings of the `set` container that supplied\n   * the rows (without one: of the last container that has them), so the\n   * model's errors name the same key attribute.\n   */\n  private mergeContainers(containers: DataContainer<RawItem>[]): DataContainer<RawItem> {\n    let dataset = new Map<string, RawItem>();\n    let keylessRows: RawItem[] = [];\n    let replacedRowKeys: string[] = [];\n    let setContainer: DataContainer<RawItem> | undefined;\n\n    for (const newContainer of containers) {\n      switch (newContainer.type) {\n        case 'upsert':\n          for (const entry of newContainer.data) {\n            if (!hasRowKey(entry)) {\n              keylessRows.push(entry);\n              continue;\n            }\n            const rowKey = String(entry.key);\n            const storedRow = dataset.get(rowKey);\n            dataset.set(rowKey, storedRow ? this.mergeRow(storedRow, entry) : entry);\n          }\n          break;\n        case 'update':\n          for (const entry of newContainer.data) {\n            const rowKey = hasRowKey(entry) ? String(entry.key) : undefined;\n            const storedRow = rowKey === undefined ? undefined : dataset.get(rowKey);\n            if (rowKey !== undefined && storedRow) {\n              dataset.set(rowKey, this.mergeRow(storedRow, entry));\n            }\n          }\n          break;\n        case 'remove':\n          for (const entry of newContainer.data) {\n            if (hasRowKey(entry)) {\n              dataset.delete(String(entry.key));\n            }\n          }\n          break;\n        case 'set':\n        default:\n          dataset = new Map();\n          keylessRows = [];\n          // A container this merge built earlier is already deduped; its\n          // replaced rows are carried over so a re-init reports them again,\n          // also when a later update/remove touched the key (they describe\n          // this set payload).\n          replacedRowKeys = [...this.getReplacedRowKeys(newContainer)];\n          setContainer = newContainer;\n          for (const entry of newContainer.data) {\n            if (!hasRowKey(entry)) {\n              keylessRows.push(entry);\n              continue;\n            }\n            const rowKey = String(entry.key);\n            if (dataset.has(rowKey)) {\n              replacedRowKeys.push(rowKey);\n            }\n            dataset.set(rowKey, entry);\n          }\n          break;\n      }\n    }\n\n    const container: DataContainer<RawItem> = {\n      model: containers[0]!.model!,\n      data: [...dataset.values(), ...keylessRows],\n      type: 'set',\n    };\n    const keySource =\n      setContainer ?? [...containers].reverse().find((candidate) => candidate.keyProperty !== undefined);\n    if (keySource?.keyProperty !== undefined) {\n      container.keyProperty = keySource.keyProperty;\n    }\n    if (keySource?.keyPropertySeparator !== undefined) {\n      container.keyPropertySeparator = keySource.keyPropertySeparator;\n    }\n    // The rows already carry their extracted keys, and the keys are unique.\n    this.keyedContainers.add(container);\n    this.uniqueKeyRows.set(container.data, container.data.length);\n    // The model is updated: the next update folds into this container (#445)\n    if (\n      keylessRows.length === 0 &&\n      containers.some((candidate) => candidate.type !== undefined && candidate.type !== 'set')\n    ) {\n      const positions = new Map<string, number>();\n      let position = 0;\n      for (const rowKey of dataset.keys()) {\n        positions.set(rowKey, position++);\n      }\n      this.rowPositions.set(container, positions);\n    }\n    if (replacedRowKeys.length > 0) {\n      this.replacedRowKeys.set(container, replacedRowKeys);\n    }\n\n    return container;\n  }\n\n  /**\n   * Folds an update/upsert payload row into the stored row. Every attribute\n   * the payload carries replaces the stored value wholesale: arrays\n   * (Array<…> properties, multi-valued references) and objects (json/any\n   * properties) are never merged element-wise or recursively — change\n   * tracking and the partial path work per attribute, too. Attributes absent\n   * from the payload, or `undefined` in it, keep their stored value (send\n   * `null` to clear one). Returns a new row and mutates neither input: rows\n   * can be caller-owned, and json values are stored by reference.\n   */\n  private mergeRow(storedRow: RawItem, payloadRow: RawItem): RawItem {\n    const mergedRow: RawItem = { ...storedRow };\n    for (const attributeKey of Object.keys(payloadRow)) {\n      const value = payloadRow[attributeKey];\n      // An own `__proto__` key (JSON.parse yields one) would re-parent the row\n      // instead of setting an attribute; lodash `merge` skipped it, too.\n      if (value !== undefined && attributeKey !== '__proto__') {\n        mergedRow[attributeKey] = value;\n      }\n    }\n    return mergedRow;\n  }\n\n  /**\n   * Mirrors mergeContainers() for the loader source-metadata side channel: when\n   * several resources feed one model, their per-resource coercion metadata must\n   * be combined onto the merged container, otherwise the CSV aggregation path in\n   * QualityController loses its side channel (dcupl#197). 'set'/default resets the\n   * effective metadata (the dataset is replaced); 'upsert'/'update' accumulate\n   * columns and failure counts; 'remove' leaves the effective metadata unchanged\n   * (an approximation — removed rows' failures may be over-counted).\n   */\n  private mergeContainerSourceMetadata(containers: DataContainer<RawItem>[]): ContainerSourceMetadata | undefined {\n    let effective:\n      | {\n          columns: Set<string>;\n          samples: Record<string, { rawValue: string; expected: string; count: number }>;\n          origin?: string;\n        }\n      | undefined;\n\n    for (const container of containers) {\n      const meta = this.dcuplInstance.getContainerSourceMetadata(container);\n      const type = container.type ?? 'set';\n\n      if (type === 'set') {\n        // Dataset is replaced → effective metadata is exactly this container's.\n        effective = meta\n          ? {\n              columns: new Set(meta.sourceColumns),\n              samples: this.cloneCoercionSamples(meta.coercionFailureSamples),\n              origin: meta.origin,\n            }\n          : undefined;\n      } else if (type === 'upsert' || type === 'update') {\n        if (meta) {\n          if (!effective) {\n            effective = { columns: new Set(), samples: {}, origin: meta.origin };\n          }\n          // origin is kept from the dataset-owning ('set') resource; upsert/update\n          // resources contribute columns and counts but do not change origin.\n          meta.sourceColumns.forEach((col) => effective!.columns.add(col));\n          for (const col of Object.keys(meta.coercionFailureSamples)) {\n            const sample = meta.coercionFailureSamples[col]!;\n            const existing = effective.samples[col];\n            if (existing) {\n              existing.count += sample.count;\n            } else {\n              effective.samples[col] = { ...sample };\n            }\n          }\n        }\n      }\n      // type === 'remove': leave effective unchanged.\n    }\n\n    if (!effective) {\n      return undefined;\n    }\n    return {\n      sourceColumns: Array.from(effective.columns),\n      coercionFailureSamples: effective.samples,\n      origin: effective.origin,\n    };\n  }\n\n  private cloneCoercionSamples(\n    samples: Record<string, { rawValue: string; expected: string; count: number }>,\n  ): Record<string, { rawValue: string; expected: string; count: number }> {\n    const clone: Record<string, { rawValue: string; expected: string; count: number }> = {};\n    for (const col of Object.keys(samples)) {\n      clone[col] = { ...samples[col]! };\n    }\n    return clone;\n  }\n\n  private async connectDataWithModels(containers: DataContainer<RawItem>[]): Promise<void> {\n    try {\n      this.dependencyGraph.order();\n    } catch (error) {\n      this.log.warn(\n        'Your models have circular dependencies which might lead to errors. Please consider changing your models',\n      );\n      this.log.error('Dependency graph error', error as Error);\n    }\n\n    const orderedModelKeys = this.dependencyGraph.order({ allowCycles: true });\n\n    containers.sort((a, b) => {\n      return orderedModelKeys.indexOf(a.model) - orderedModelKeys.indexOf(b.model);\n    });\n\n    await this.handleDataContainer(containers);\n  }\n\n  /**\n   * Performs partial data processing by only reprocessing changed attributes and their dependents\n   * @param containers - Data containers to process\n   */\n  private async connectDataWithModelsPartial(containers: DataContainer<RawItem>[]): Promise<void> {\n    // Step 0: Sort containers by dependency order (same as full update path)\n    // This ensures models are processed in the correct order (e.g., Customer before Order)\n    const orderedModelKeys = this.dependencyGraph.order({ allowCycles: true });\n    containers.sort((a, b) => {\n      return orderedModelKeys.indexOf(a.model) - orderedModelKeys.indexOf(b.model);\n    });\n\n    // Auto-generate properties BEFORE the change plan is built (#373): an\n    // attribute that first appears in this update has no property yet, and the\n    // plan below only keeps attributes the model declares — generating it\n    // afterwards left its values undefined. The new property is unknown to the\n    // attribute dependency graph and takes the step-1 fallback below. Every\n    // row is new to it, untouched rows that carry it included: step 1 fills it\n    // for all rows, as init() does.\n    const generatedAttributes = new Map<string, Set<string>>();\n    for (const dataContainer of containers) {\n      const model = this.models.get(dataContainer.model);\n      if (model?.autoGenerateProperties) {\n        const known = new Set(model.properties.keys());\n        // Without removed rows, the rows the update did not touch kept their place and attributes:\n        // inference looks for new attributes in the changed rows only (#519)\n        const removedNone = this.changeTracker.getDeletedItems(model.key).size === 0;\n        model.generatePropertiesFromContainer(\n          dataContainer,\n          removedNone ? this.changeTracker.getChangedItems(model.key) : undefined,\n        );\n        const generated = new Set([...model.properties.keys()].filter((key) => !known.has(key)));\n        if (generated.size > 0) {\n          generatedAttributes.set(model.key, generated);\n        }\n      }\n    }\n\n    // Split the changed rows into rows of existing items and inserted rows. An\n    // inserted row changes every attribute of its model, as a removed one does\n    // (partialUpdate): without that, a row that carries only its key gave the\n    // plan no attribute and was never inserted (#398), and its derived values\n    // stayed uncomputed.\n    let changedRowsByModel = this.splitChangedRows(containers);\n\n    // Rows that reference an item this update inserts or removes resolve that\n    // reference again (#368): a hit becomes a miss with its\n    // RemoteReferenceKeyNotFound error and vice versa, as on init().\n    const referencingItemKeys = this.getItemsReferencingChangedItems(containers, changedRowsByModel);\n    if (referencingItemKeys.size > 0) {\n      changedRowsByModel = this.splitChangedRows(containers, referencingItemKeys);\n    }\n\n    for (const [modelKey, { insertedRows }] of changedRowsByModel) {\n      const model = this.models.get(modelKey);\n      if (!model || insertedRows.length === 0) continue;\n      for (const attributeKey of [...model.properties.keys(), ...model.references.keys()]) {\n        this.changeTracker.recordAttributeChange(modelKey, attributeKey);\n      }\n    }\n\n    // The query references this update can change, with the owner rows to recompute (#429)\n    const queryReferencePlan = this.planQueryReferences(changedRowsByModel, generatedAttributes);\n\n    // Step 1: Determine which attributes changed\n    const changedAttributes: AttributeNode[] = [];\n\n    for (const [modelKey, attributeKeys] of this.changeTracker.getChangedAttributes()) {\n      for (const attributeKey of attributeKeys) {\n        // Find the attribute node in the dependency graph\n        const attributeNodes = this.attributeDependencyGraph.getAttributesForModel(modelKey);\n        const matchingNode = attributeNodes.find((node) => node.attributeKey === attributeKey);\n\n        if (matchingNode) {\n          changedAttributes.push(matchingNode);\n        } else {\n          // If not in dependency graph, it's a basic attribute with no dependencies\n          // We still need to mark it as changed but it won't cascade\n          const model = this.models.get(modelKey);\n          if (model) {\n            const property = model.properties.get(attributeKey);\n            const reference = model.references.get(attributeKey);\n\n            if (property || reference) {\n              changedAttributes.push({\n                modelKey,\n                attributeKey,\n                type: property ? 'property' : 'reference',\n                processingStep: 1, // Basic attributes are step 1\n              });\n            }\n          }\n        }\n      }\n    }\n\n    // Step 2: Find all impacted attributes (including cascading dependencies)\n    const impactedAttributes = this.attributeDependencyGraph.getImpactedAttributes(changedAttributes);\n\n    // Step 3: Get processing order (grouped by model and step)\n    const processingPlan = this.attributeDependencyGraph.getProcessingOrder(impactedAttributes);\n\n    // Step 4 (#368): limit step 1 to the changed rows and prepare their error records\n    const rowScopes = this.getPartialRowScopes(processingPlan, containers, changedRowsByModel, generatedAttributes);\n\n    // Step 5: Process attributes in order by step using PARTIAL methods\n    // We need to process all models for each step before moving to the next step\n    for (const step of [1, 2] as const) {\n      if (step === 2 && queryReferencePlan.size > 0) {\n        // The query references of step 2 query the data step 1 changed: drop\n        // the indices and the cached results built from the previous data first\n        this.resetIndicesForPlan(processingPlan, rowScopes);\n        this.invalidateQueryReferenceTargetLists(queryReferencePlan.keys());\n      }\n      const defers = this.defersAutoCreatedPasses;\n      this.defersAutoCreatedPasses = step === 1;\n      try {\n        await this.processAttributesForStep(step, processingPlan, containers, rowScopes, queryReferencePlan);\n      } finally {\n        this.defersAutoCreatedPasses = defers;\n      }\n      if (step === 1) {\n        // The items step 1 auto-created get their pass now, as init() gives it at its next\n        // yield, before any derived attribute reads them (#604); the ones no referrer is left\n        // for go, as init() never creates them (#598)\n        this.processPendingAutoCreatedItems();\n        this.removeOrphanedAutoCreatedItems();\n        this.addAutoCreatedItemsToIndices();\n      }\n    }\n    // Steps 3 and 4 together, in attribute dependency order (#602)\n    this.processDerivedAttributesInDependencyOrder(processingPlan, containers);\n\n    // Step 5b (#243)\n    this.resetIndicesForPlan(processingPlan, rowScopes);\n\n    // Step 6 (#368): complete the error records the way init() does — consolidate\n    // the reprocessed attributes and re-run the unique check\n    for (const container of containers) {\n      const model = this.models.get(container.model);\n      const scope = rowScopes.get(container.model);\n      if (model && scope) {\n        this.qualityController.finishPartialUpdate(\n          model,\n          container,\n          new Set([...scope.attributes, ...scope.allRowsAttributes]),\n          scope.rowsChanged,\n          scope.allRowsAttributes,\n          scope.autoCreatedRows,\n        );\n      }\n    }\n\n    // Step 6 may auto-create items as well (the referrers' errors re-derived for every row)\n    if (this.processPendingAutoCreatedItems()) {\n      this.addAutoCreatedItemsToIndices();\n    }\n\n    this.finishErrorsOfRemovedOrphans(containers);\n\n    // The items this update auto-created ran their pass without their basic-attribute errors\n    // (#604): init() records those after the consolidation of the model's own rows, so they are\n    // recorded now, after step 6\n    if (this.qualityController.enabled) {\n      for (const model of this.models.values()) {\n        if (model.qualityConfig.enabled !== true) continue;\n        model.reprocessItemsAutoCreatedInUpdate(\n          new Set([...model.getBasicProperties(), ...model.getBasicReferences()].map((attribute) => attribute.key)),\n        );\n      }\n    }\n\n    // Clear change tracker after successful partial update\n    this.changeTracker.clear();\n  }\n\n  /** Records that `modelKey` gained or lost items a referrer auto-created (#598, #599). */\n  public recordAutoCreationChange(modelKey: string): void {\n    this.autoCreationChanges.add(modelKey);\n  }\n\n  /**\n   * The models that gained or lost items a referrer auto-created during the last update(): the\n   * change tracker does not name them, so their lists are refreshed as well (#599).\n   */\n  public getAutoCreationChanges(): string[] {\n    return [...this.autoCreationChanges];\n  }\n\n  /**\n   * Runs the queued passes of the auto-created items of every model, the items they auto-create\n   * included (#604). First the basic attributes of every queued item, then the attributes read\n   * from them: a resolved reference of an auto-created item lists an auto-created referrer as\n   * well (#619). Returns whether it ran any.\n   *\n   * @param partial - the partial path: the passes' basic-attribute errors wait for its step 6\n   */\n  private processPendingAutoCreatedItems(partial = true): boolean {\n    let processedAny = false;\n    let passes: [DcuplModel, ReturnType<DcuplModel['addBasicsOfPendingAutoCreatedContainers']>][] = [];\n    do {\n      passes = [];\n      let added = true;\n      while (added) {\n        added = false;\n        for (const model of this.models.values()) {\n          const containers = model.addBasicsOfPendingAutoCreatedContainers(partial);\n          if (containers.length > 0) {\n            passes.push([model, containers]);\n            added = true;\n          }\n        }\n      }\n      for (const [model, containers] of passes) {\n        model.finishAutoCreatedPasses(containers, partial);\n      }\n      processedAny ||= passes.length > 0;\n    } while (passes.length > 0);\n    return processedAny;\n  }\n\n  /**\n   * Records a key that a reference of `modelKey` no longer holds for any item (the indices\n   * controller's onValueReleased, #598): while a partial update runs, an auto-created item of the\n   * reference's model under that key may have lost its last referrer.\n   */\n  public noteReleasedReferenceKey(modelKey: string, attributeKey: string, value: unknown): void {\n    if (!this.releasedReferenceKeys || value === undefined || value === null) return;\n    const reference = this.models.get(modelKey)?.references.get(attributeKey);\n    if (!reference || !this.models.get(reference.model)?.supportsAutoCreation) return;\n    let keys = this.releasedReferenceKeys.get(reference.model);\n    if (!keys) {\n      keys = new Set();\n      this.releasedReferenceKeys.set(reference.model, keys);\n    }\n    keys.add(String(value));\n  }\n\n  /**\n   * Removes the auto-created items no referrer is left for (#598): init() creates an item of a\n   * `supportsAutoCreation` model only for a reference to it, so once the update removed or\n   * re-pointed the last one, a fresh init would not have the item. The candidates are the keys a\n   * reference's index entry lost its last item for during the update (noteReleasedReferenceKey); a\n   * basic reference's index is kept in step on the partial path, so an item is still referenced\n   * when any basic reference to its model lists it. Removing an item releases the keys its own\n   * references held, so this repeats until nothing goes.\n   */\n  private removeOrphanedAutoCreatedItems(): void {\n    const candidates = this.releasedReferenceKeys;\n    if (!candidates || candidates.size === 0) return;\n\n    const referrersByModel = new Map<string, { model: DcuplModel; reference: string }[]>();\n    for (const referrer of this.models.values()) {\n      for (const reference of referrer.getBasicReferences()) {\n        if (!this.models.get(reference.model)?.supportsAutoCreation) continue;\n        let referrers = referrersByModel.get(reference.model);\n        if (!referrers) {\n          referrers = [];\n          referrersByModel.set(reference.model, referrers);\n        }\n        referrers.push({ model: referrer, reference: reference.key });\n      }\n    }\n\n    while (candidates.size > 0) {\n      const round = [...candidates];\n      candidates.clear();\n      for (const [modelKey, keys] of round) {\n        const model = this.models.get(modelKey);\n        if (!model) continue;\n        const referrers = referrersByModel.get(modelKey) ?? [];\n        const orphans: string[] = [];\n        for (const itemKey of keys) {\n          if (!model.isAutoCreatedItem(itemKey) || !model.getEntry(itemKey)) continue;\n          const referenced = referrers.some(\n            ({ model: referrer, reference }) =>\n              (referrer.indicesController.getIndex(reference)?.get(itemKey)?.size ?? 0) > 0,\n          );\n          if (!referenced) orphans.push(itemKey);\n        }\n        if (orphans.length === 0) continue;\n\n        // Releases the keys the orphans' own references held: the next round checks those\n        model.deleteDataEntries({ model: modelKey, data: orphans.map((key) => ({ key })) });\n        // Their errors go after step 6 (finishErrorsOfRemovedOrphans)\n        let removed = this.orphansRemovedInUpdate.get(modelKey);\n        if (!removed) {\n          removed = new Set();\n          this.orphansRemovedInUpdate.set(modelKey, removed);\n        }\n        for (const key of orphans) removed.add(key);\n        this.recordAutoCreationChange(modelKey);\n      }\n    }\n  }\n\n  /**\n   * Removes the errors of the orphans removeOrphanedAutoCreatedItems() took out, the way the\n   * partial path removes those of a deleted row (#598): prepareErrorsForPartialUpdate() drops them\n   * and returns the attributes whose errors must be derived from every row again, a capped group\n   * (its unstored errors cannot be taken out one by one) or a per-attribute aggregate; those are\n   * reprocessed for the model's rows, then finishPartialUpdate() consolidates them and re-derives\n   * them for the auto-created items left, as on init().\n   */\n  private finishErrorsOfRemovedOrphans(containers: DataContainer<RawItem>[]): void {\n    if (!this.qualityController.enabled) return;\n    for (const [modelKey, orphans] of this.orphansRemovedInUpdate) {\n      const model = this.models.get(modelKey);\n      if (!model || model.qualityConfig.enabled !== true) continue;\n      const basicAttributes = new Set(\n        [...model.getBasicProperties(), ...model.getBasicReferences()].map((attribute) => attribute.key),\n      );\n      const allRowsAttributes = this.qualityController.prepareErrorsForPartialUpdate(\n        model,\n        basicAttributes,\n        new Set(),\n        orphans,\n      );\n      const container = containers.find((c) => c.model === modelKey) ?? { model: modelKey, data: [] };\n      if (allRowsAttributes.size > 0) {\n        const keyedRows = container.data.filter((row) => row.key !== undefined && row.key !== null);\n        model.addBasicPropertiesAndReferencesPartial(\n          this.getContainerWithRows(container, keyedRows),\n          allRowsAttributes,\n        );\n      }\n      const createdNow = new Set(model.getItemsAutoCreatedInUpdate());\n      const autoCreatedBefore = new Map([...model.getAutoCreatedRows()].filter(([key]) => !createdNow.has(key)));\n      this.qualityController.finishPartialUpdate(\n        model,\n        container,\n        allRowsAttributes,\n        true,\n        allRowsAttributes,\n        autoCreatedBefore,\n      );\n    }\n  }\n\n  /** Adds the items this update auto-created to the indices built before it (#599). */\n  private addAutoCreatedItemsToIndices(): void {\n    for (const modelKey of this.autoCreationChanges) {\n      this.models.get(modelKey)?.addItemsAutoCreatedInUpdateToIndices();\n    }\n  }\n\n  /**\n   * Drops the model-level indices derived from the planned attributes (#243):\n   * eager fills only cover index:true properties and references, so lazily\n   * built plain indices (facets/pivot), the context-hashed indices\n   * (aggregate/sections/suggest) and deep indices would keep serving\n   * pre-update values. The next read rebuilds them.\n   */\n  private resetIndicesForPlan(\n    processingPlan: Map<string, Map<number, Set<string>>>,\n    rowScopes: Map<string, PartialRowScope>,\n  ): void {\n    for (const [modelKey, stepMap] of processingPlan.entries()) {\n      const model = this.models.get(modelKey);\n      if (!model) continue;\n      const impactedAttributeKeys = new Set<string>();\n      for (const attrs of stepMap.values()) {\n        for (const attributeKey of attrs) {\n          impactedAttributeKeys.add(attributeKey);\n        }\n      }\n      for (const attributeKey of rowScopes.get(modelKey)?.allRowsAttributes ?? []) {\n        impactedAttributeKeys.add(attributeKey);\n      }\n      model.resetIndicesForChangedAttributes(impactedAttributeKeys);\n    }\n  }\n\n  /**\n   * Step 2 of the partial path for the query references of one model (#429):\n   * runs each planned query reference again for the rows planQueryReferences\n   * chose, from the model's merged raw rows, as init() does.\n   */\n  private recomputeQueryReferences(\n    model: DcuplModel,\n    container: DataContainer<RawItem> | undefined,\n    attributes: Set<string>,\n    plan: Map<string, QueryReferenceRecompute> | undefined,\n  ): void {\n    if (!container) return;\n    for (const queryReference of model.getQueryReferences()) {\n      if (!attributes.has(queryReference.key)) continue;\n      // Planned through a dependency only: every row, to be safe\n      const { rows, targetKeys } = plan?.get(queryReference.key) ?? { rows: 'all' as const };\n      if (rows === 'all') {\n        model.recomputeQueryReference(queryReference, container.data);\n        continue;\n      }\n      const ownRows = rows.size === 0 ? [] : this.getRowsWithKeys(container, rows, undefined);\n      const rawRows: RawItem[] = [];\n      const otherRows: RawItem[] = [];\n      for (const row of targetKeys ? container.data : ownRows) {\n        if (row.key === undefined || row.key === null) continue;\n        (rows.has(String(row.key)) ? rawRows : otherRows).push(row);\n      }\n      if (targetKeys && targetKeys.size > 0) {\n        rawRows.push(...model.getRowsAffectedByTargetItems(queryReference, otherRows, targetKeys));\n      }\n      model.recomputeQueryReference(queryReference, rawRows);\n    }\n  }\n\n  /**\n   * The merged rows of the items the pending changes touch, per model: rows of\n   * existing items and rows the update inserts (no stored item yet). Rows\n   * without a key are left out — init() reported them already (MissingKey).\n   */\n  private splitChangedRows(\n    containers: DataContainer<RawItem>[],\n    extraItemKeys?: Map<string, Set<string>>,\n  ): Map<string, { changedRows: RawItem[]; insertedRows: RawItem[] }> {\n    const rowsByModel = new Map<string, { changedRows: RawItem[]; insertedRows: RawItem[] }>();\n    for (const container of containers) {\n      const model = this.models.get(container.model);\n      const changedItemKeys = this.changeTracker.getChangedItems(container.model);\n      const extraKeys = extraItemKeys?.get(container.model);\n      if (!model || (changedItemKeys.size === 0 && !extraKeys)) continue;\n\n      const changedRows: RawItem[] = [];\n      const insertedRows: RawItem[] = [];\n      for (const row of this.getRowsWithKeys(container, changedItemKeys, extraKeys)) {\n        if (row.key === undefined || row.key === null) continue;\n        const itemKey = String(row.key);\n        if (!changedItemKeys.has(itemKey) && !extraKeys?.has(itemKey)) continue;\n        (model.getEntry(itemKey) ? changedRows : insertedRows).push(row);\n      }\n      rowsByModel.set(container.model, { changedRows, insertedRows });\n    }\n    return rowsByModel;\n  }\n\n  /**\n   * The rows of `container` that may carry one of the keys, in container\n   * order. A container with row positions (foldIntoContainer) looks the keys\n   * up (#445); any other container returns all its rows.\n   */\n  private getRowsWithKeys(\n    container: DataContainer<RawItem>,\n    keys: ReadonlySet<string>,\n    extraKeys: ReadonlySet<string> | undefined,\n  ): readonly RawItem[] {\n    const positions = this.rowPositions.get(container);\n    if (!positions || positions.size !== container.data.length) {\n      return container.data;\n    }\n    const found = new Set<number>();\n    for (const itemKeys of [keys, extraKeys]) {\n      for (const itemKey of itemKeys ?? []) {\n        const position = positions.get(itemKey);\n        if (position !== undefined) found.add(position);\n      }\n    }\n    return [...found].sort((a, b) => a - b).map((position) => container.data[position]!);\n  }\n\n  /**\n   * The items, per model, whose basic reference points at an item that this\n   * update inserts or removes (#368). Records those references as changed, so\n   * they and their dependents are processed again. References within one model\n   * count too: they resolve against every row of the model, whatever its\n   * position (#411).\n   *\n   * An inserted item was missing until now, so only the items whose reference\n   * did not find its key can resolve differently: the model lists them when it\n   * resolves (DcuplModel.takeItemsMissingReferenceKeys), and they are looked up\n   * instead of scanning every row (#425). A removed item can be named by any\n   * row: a reference to a model with removed items scans the rows and matches\n   * the raw reference value (any separator part, array element or object key)\n   * and the stored one, so strict references that dropped a missing key are\n   * found too.\n   */\n  private getItemsReferencingChangedItems(\n    containers: DataContainer<RawItem>[],\n    changedRowsByModel: Map<string, { changedRows: RawItem[]; insertedRows: RawItem[] }>,\n  ): Map<string, Set<string>> {\n    const insertedKeysByModel = new Map<string, Set<string>>();\n    const deletedKeysByModel = new Map<string, Set<string>>();\n    const addKey = (keysByModel: Map<string, Set<string>>, modelKey: string, itemKey: string): void => {\n      const keys = keysByModel.get(modelKey) ?? new Set<string>();\n      keys.add(itemKey);\n      keysByModel.set(modelKey, keys);\n    };\n    for (const [modelKey, { insertedRows }] of changedRowsByModel) {\n      for (const row of insertedRows) addKey(insertedKeysByModel, modelKey, String(row.key));\n    }\n    for (const modelKey of this.changeTracker.getModelsWithChanges()) {\n      for (const itemKey of this.changeTracker.getDeletedItems(modelKey)) {\n        addKey(deletedKeysByModel, modelKey, itemKey);\n      }\n    }\n\n    const referencingItemKeys = new Map<string, Set<string>>();\n    if (insertedKeysByModel.size === 0 && deletedKeysByModel.size === 0) return referencingItemKeys;\n\n    for (const container of containers) {\n      const model = this.models.get(container.model);\n      if (!model) continue;\n      const itemKeys = new Set<string>();\n\n      // References to a model with removed items: scan the rows (#368)\n      const scanned: { reference: Reference; keys: Set<string> }[] = [];\n      for (const reference of model.getBasicReferences()) {\n        const inserted = insertedKeysByModel.get(reference.model);\n        const deleted = deletedKeysByModel.get(reference.model);\n        // The entries for the inserted keys go: the items found below resolve again\n        const missing = inserted ? model.takeItemsMissingReferenceKeys(reference.key, inserted) : undefined;\n        if (deleted) {\n          scanned.push({ reference, keys: inserted ? new Set([...deleted, ...inserted]) : deleted });\n        } else if (missing && missing.size > 0) {\n          for (const itemKey of missing) itemKeys.add(itemKey);\n          this.changeTracker.recordAttributeChange(model.key, reference.key);\n        }\n      }\n\n      if (scanned.length > 0) {\n        for (const row of container.data) {\n          if (row.key === undefined || row.key === null) continue;\n          const stored = model.getEntry(String(row.key));\n          if (!stored) continue;\n          for (const { reference, keys } of scanned) {\n            const values = [\n              row[reference.key],\n              reference.origin ? row[reference.origin] : undefined,\n              stored[reference.key],\n            ];\n            if (values.some((value) => this.referencesAnyKey(value, keys, reference.separator))) {\n              itemKeys.add(String(row.key));\n              this.changeTracker.recordAttributeChange(model.key, reference.key);\n            }\n          }\n        }\n      }\n      if (itemKeys.size > 0) {\n        referencingItemKeys.set(model.key, itemKeys);\n      }\n    }\n    return referencingItemKeys;\n  }\n\n  /** Whether a raw or stored reference value names one of `keys` (a superset match). */\n  private referencesAnyKey(value: unknown, keys: Set<string>, separator = ','): boolean {\n    if (value === undefined || value === null) return false;\n    if (Array.isArray(value)) {\n      return value.some((entry) => this.referencesAnyKey(entry, keys, separator));\n    }\n    if (typeof value === 'object') {\n      const key = (value as { key?: unknown }).key;\n      return key !== undefined && key !== null && keys.has(String(key));\n    }\n    const text = String(value);\n    return keys.has(text) || keys.has(text.trim()) || text.split(separator).some((part) => keys.has(part.trim()));\n  }\n\n  /**\n   * Scopes step 1 of a partial update to the rows that changed (#368): the\n   * other rows' raw values did not change, so reprocessing them only recorded\n   * their errors again. Rows the update inserts are processed for every basic\n   * attribute, as init() does. With error tracking on, it removes the error\n   * records the update re-derives (QualityController.prepareErrorsForPartialUpdate);\n   * the attributes whose errors need every row are reprocessed for all rows.\n   */\n  private getPartialRowScopes(\n    processingPlan: Map<string, Map<number, Set<string>>>,\n    containers: DataContainer<RawItem>[],\n    changedRowsByModel: Map<string, { changedRows: RawItem[]; insertedRows: RawItem[] }>,\n    generatedAttributes: Map<string, Set<string>>,\n  ): Map<string, PartialRowScope> {\n    const scopes = new Map<string, PartialRowScope>();\n\n    for (const container of containers) {\n      const model = this.models.get(container.model);\n      const planAttributes = processingPlan.get(container.model)?.get(1) ?? new Set<string>();\n      const { changedRows, insertedRows } = changedRowsByModel.get(container.model) ?? {\n        changedRows: [],\n        insertedRows: [],\n      };\n      const generated = generatedAttributes.get(container.model) ?? new Set<string>();\n      // A model without attributes still has to insert its new rows (#398)\n      if (!model || (planAttributes.size === 0 && insertedRows.length === 0 && generated.size === 0)) continue;\n\n      const attributes = new Set(planAttributes);\n      if (insertedRows.length > 0) {\n        for (const attributeKey of [...model.properties.keys(), ...model.references.keys()]) {\n          attributes.add(attributeKey);\n        }\n      }\n\n      const rowKeys = new Set([...changedRows, ...insertedRows].map((row) => String(row.key)));\n      const deletedItemKeys = this.changeTracker.getDeletedItems(model.key);\n      const allRowsAttributes = this.qualityController.enabled\n        ? this.qualityController.prepareErrorsForPartialUpdate(model, attributes, rowKeys, deletedItemKeys)\n        : new Set<string>();\n      // A property generated in this update is new to every row (#373)\n      for (const attributeKey of generated) {\n        allRowsAttributes.add(attributeKey);\n      }\n\n      scopes.set(model.key, {\n        changedRows,\n        insertedRows,\n        attributes,\n        allRowsAttributes,\n        rowsChanged: rowKeys.size > 0 || deletedItemKeys.size > 0,\n        autoCreatedRows:\n          this.qualityController.enabled && allRowsAttributes.size > 0 ? model.getAutoCreatedRows() : new Map(),\n      });\n    }\n\n    return scopes;\n  }\n\n  /**\n   * Step 1 of the partial path for one model (#368): the changed attributes of\n   * the changed rows, every basic attribute of the inserted rows, and the\n   * attributes of `scope.allRowsAttributes` for every row.\n   */\n  private addBasicAttributesPartial(\n    model: DcuplModel,\n    container: DataContainer<RawItem>,\n    attributes: Set<string>,\n    scope: PartialRowScope | undefined,\n  ): void {\n    // A reference within the model resolves against every row the model will\n    // hold, not only the rows processed so far (#411). Removals are applied and\n    // every existing row is stored already, so only inserted rows are pending.\n    const pendingItemKeys = model.getPendingItemKeys(scope ? scope.insertedRows : container.data);\n    // An item a referrer auto-created before is the row's item from now on (#598)\n    if (scope) {\n      model.forgetAutoCreatedRows(scope.changedRows);\n      model.forgetAutoCreatedRows(scope.insertedRows);\n    } else {\n      model.forgetAutoCreatedRows(container.data);\n    }\n\n    if (!scope) {\n      model.addBasicPropertiesAndReferencesPartial(container, attributes, pendingItemKeys);\n      return;\n    }\n\n    const withoutAllRows = (keys: Set<string>): Set<string> =>\n      new Set([...keys].filter((key) => !scope.allRowsAttributes.has(key)));\n\n    const changedRowAttributes = withoutAllRows(attributes);\n    if (scope.changedRows.length > 0 && changedRowAttributes.size > 0) {\n      model.addBasicPropertiesAndReferencesPartial(\n        this.getContainerWithRows(container, scope.changedRows),\n        changedRowAttributes,\n        pendingItemKeys,\n      );\n    }\n    if (scope.insertedRows.length > 0) {\n      model.addBasicPropertiesAndReferencesPartial(\n        this.getContainerWithRows(container, scope.insertedRows),\n        withoutAllRows(scope.attributes),\n        pendingItemKeys,\n      );\n    }\n    if (scope.allRowsAttributes.size > 0) {\n      const keyedRows = container.data.filter((row) => row.key !== undefined && row.key !== null);\n      model.addBasicPropertiesAndReferencesPartial(\n        this.getContainerWithRows(container, keyedRows),\n        scope.allRowsAttributes,\n        pendingItemKeys,\n      );\n    }\n  }\n\n  /** `container` limited to `rows`, keeping its source metadata (the error `origin`). */\n  private getContainerWithRows(container: DataContainer<RawItem>, rows: RawItem[]): DataContainer<RawItem> {\n    const view: DataContainer<RawItem> = { ...container, data: rows };\n    const sourceMetadata = this.dcuplInstance.getContainerSourceMetadata(container);\n    if (sourceMetadata) {\n      this.dcuplInstance.setContainerSourceMetadata(view, sourceMetadata);\n    }\n    return view;\n  }\n\n  /**\n   * Computes the processing order for resolved references in step 2\n   * Resolved references that depend on basic references should be processed before\n   * resolved references that depend on other resolved references\n   * @param processingPlan - The full processing plan\n   * @returns Array of model keys in the correct processing order\n   */\n  private getResolvedReferenceProcessingOrder(processingPlan: Map<string, Map<number, Set<string>>>): string[] {\n    // Build a dependency graph for resolved references\n    const dependencies = new Map<string, Set<string>>(); // modelKey → Set of models it depends on\n    const allModelsWithStep2 = new Set<string>();\n\n    // Collect all models that have step 2 attributes\n    for (const [modelKey, stepMap] of processingPlan.entries()) {\n      const step2Attrs = stepMap.get(2);\n      if (step2Attrs && step2Attrs.size > 0) {\n        allModelsWithStep2.add(modelKey);\n        dependencies.set(modelKey, new Set());\n      }\n    }\n\n    // If no models have step 2 attributes, return the original order\n    if (allModelsWithStep2.size === 0) {\n      return this.dependencyGraph.order();\n    }\n\n    // For each model with step 2, find which other models' resolved references it depends on\n    for (const modelKey of allModelsWithStep2) {\n      const model = this.models.get(modelKey);\n      if (!model) continue;\n\n      const step2Attrs = processingPlan.get(modelKey)?.get(2);\n      if (!step2Attrs) continue;\n\n      // Check each resolved reference\n      for (const attrKey of step2Attrs) {\n        const reference = model.references.get(attrKey);\n        if (reference && isResolvedReference(reference)) {\n          // This is a resolved reference - it depends on the remote model's basic reference\n          const remoteModelKey = reference.resolve.model;\n          const remoteRefKey = reference.resolve.reference;\n\n          // Check if the remote reference is ALSO a resolved reference being rebuilt\n          const remoteModel = this.models.get(remoteModelKey);\n          if (remoteModel) {\n            const remoteRef = remoteModel.references.get(remoteRefKey);\n            // If the remote reference is a resolved reference, we have a dependency\n            if (remoteRef && isResolvedReference(remoteRef)) {\n              // modelKey depends on remoteModelKey\n              dependencies.get(modelKey)!.add(remoteModelKey);\n            }\n          }\n        }\n      }\n    }\n\n    // Topological sort\n    const sorted: string[] = [];\n    const visiting = new Set<string>();\n    const visited = new Set<string>();\n\n    const visit = (modelKey: string): void => {\n      if (visited.has(modelKey)) return;\n      if (visiting.has(modelKey)) {\n        // Circular dependency - just continue\n        return;\n      }\n\n      visiting.add(modelKey);\n      const deps = dependencies.get(modelKey);\n      if (deps) {\n        for (const dep of deps) {\n          visit(dep);\n        }\n      }\n      visiting.delete(modelKey);\n      visited.add(modelKey);\n      sorted.push(modelKey);\n    };\n\n    for (const modelKey of allModelsWithStep2) {\n      visit(modelKey);\n    }\n\n    // Only return the models that have step 2 attributes, in dependency order\n    // All other models will be skipped during step 2 processing anyway\n    return sorted;\n  }\n\n  /**\n   * Processes specific attributes for a given step across all affected models\n   * (steps 3 and 4: processDerivedAttributesInDependencyOrder)\n   * @param step - Processing step (1 or 2)\n   * @param processingPlan - Map of modelKey → Map of step → Set of attributeKeys\n   * @param containers - Data containers being processed\n   */\n  private async processAttributesForStep(\n    step: 1 | 2,\n    processingPlan: Map<string, Map<number, Set<string>>>,\n    containers: DataContainer<RawItem>[],\n    rowScopes: Map<string, PartialRowScope>,\n    queryReferencePlan: QueryReferencePlan,\n  ): Promise<void> {\n    // Get dependency-ordered model list\n    let orderedModelKeys = this.dependencyGraph.order({ allowCycles: true });\n\n    // For step 2 (resolved references), we need special ordering\n    // because resolved references can depend on OTHER resolved references\n    if (step === 2) {\n      orderedModelKeys = this.getResolvedReferenceProcessingOrder(processingPlan);\n    }\n\n    // Process models in dependency order\n    for (const modelKey of orderedModelKeys) {\n      // Step 1 also runs for a model without attributes to plan when it inserts\n      // rows (#398) or generated a property in this update (#373)\n      const scope = step === 1 ? rowScopes.get(modelKey) : undefined;\n      const hasRowWork = !!scope && (scope.insertedRows.length > 0 || scope.allRowsAttributes.size > 0);\n      const attributesForStep = processingPlan.get(modelKey)?.get(step) ?? new Set<string>();\n      if (attributesForStep.size === 0 && !hasRowWork) continue;\n\n      const model = this.models.get(modelKey);\n      if (!model) continue;\n\n      const context = generateKey();\n      const stepName = `dcupl:partial_process_data:step_${step}`;\n\n      this.cdRef.analyticsController.mark({\n        name: `${stepName}:start`,\n        context,\n      });\n\n      // For step 2 (resolved references), we may need to process even if there's no container\n      // because changes in other models affect resolved references\n      if (step === 2) {\n        // Query references first, as on init() (#429)\n        this.recomputeQueryReferences(\n          model,\n          containers.find((c) => c.model === modelKey),\n          attributesForStep,\n          queryReferencePlan.get(modelKey),\n        );\n        // Rebuild only the specific resolved references in the processing plan\n        // This ensures we don't rebuild references using stale data from other unprocessed resolved references\n        model.rebuildResolvedReferencesForAllItems(attributesForStep);\n      } else {\n        // For other steps, we need a container\n        const container = containers.find((c) => c.model === modelKey);\n        if (!container) continue;\n\n        // Basic properties and references, for the changed rows only (#368)\n        this.addBasicAttributesPartial(model, container, attributesForStep, rowScopes.get(modelKey));\n      }\n\n      this.cdRef.analyticsController.mark({\n        name: `${stepName}:end`,\n        context,\n      });\n\n      this.cdRef.analyticsController.measure({\n        name: stepName,\n        start: `${stepName}:start`,\n        end: `${stepName}:end`,\n        context,\n        detail: {\n          model: modelKey,\n          attributeCount: attributesForStep.size,\n        },\n      });\n    }\n  }\n\n  /**\n   * Steps 3 and 4 of the partial path (#602): derived, grouped and expression\n   * attributes (step 3) and derived attributes on a resolved reference (step 4)\n   * read each other across models: `Product.decor_tool` (step 3) derives from\n   * `Decor.tools`, which derives from the resolved `Decor.prints` (step 4). Run\n   * as two bands, step 3 read the value step 4 had not recomputed yet. Each\n   * planned attribute instead runs after the planned attributes it depends on:\n   * level 0 depends on none of them, level n on one of level n - 1 at most.\n   * Within a level the attributes do not depend on each other, so each model\n   * still takes one pass over its rows per level and step.\n   */\n  private processDerivedAttributesInDependencyOrder(\n    processingPlan: Map<string, Map<number, Set<string>>>,\n    containers: DataContainer<RawItem>[],\n  ): void {\n    const nodeId = (modelKey: string, attributeKey: string): string => `${modelKey}\\u0000${attributeKey}`;\n    const planned = new Map<string, AttributeNode>();\n    for (const [modelKey, stepMap] of processingPlan.entries()) {\n      for (const step of [3, 4] as const) {\n        for (const attributeKey of stepMap.get(step) ?? []) {\n          planned.set(nodeId(modelKey, attributeKey), {\n            modelKey,\n            attributeKey,\n            type: this.models.get(modelKey)?.references.has(attributeKey) ? 'reference' : 'property',\n            processingStep: step,\n          });\n        }\n      }\n    }\n    if (planned.size === 0) return;\n\n    // The level of each planned attribute; a dependency cycle (none on init()\n    // either) is cut where it closes\n    const levels = new Map<string, number>();\n    const visiting = new Set<string>();\n    const levelOf = (id: string): number => {\n      const known = levels.get(id);\n      if (known !== undefined) return known;\n      if (visiting.has(id)) return -1;\n      visiting.add(id);\n      let level = 0;\n      for (const dependency of this.attributeDependencyGraph.getDependencies(planned.get(id)!)) {\n        const dependencyId = nodeId(dependency.modelKey, dependency.attributeKey);\n        if (dependencyId === id || !planned.has(dependencyId)) continue;\n        level = Math.max(level, levelOf(dependencyId) + 1);\n      }\n      visiting.delete(id);\n      levels.set(id, level);\n      return level;\n    };\n\n    // level -> model -> step -> attributes\n    const byLevel: Map<string, Map<3 | 4, Set<string>>>[] = [];\n    for (const [id, node] of planned) {\n      const level = levelOf(id);\n      const models = (byLevel[level] ??= new Map());\n      let steps = models.get(node.modelKey);\n      if (!steps) {\n        steps = new Map();\n        models.set(node.modelKey, steps);\n      }\n      const step = node.processingStep as 3 | 4;\n      let attributes = steps.get(step);\n      if (!attributes) {\n        attributes = new Set();\n        steps.set(step, attributes);\n      }\n      attributes.add(node.attributeKey);\n    }\n\n    const orderedModelKeys = this.dependencyGraph.order({ allowCycles: true });\n    for (const models of byLevel) {\n      if (!models) continue;\n      for (const modelKey of orderedModelKeys) {\n        const steps = models.get(modelKey);\n        const model = this.models.get(modelKey);\n        const container = containers.find((c) => c.model === modelKey);\n        if (!steps || !model || !container) continue;\n        for (const step of [3, 4] as const) {\n          const attributes = steps.get(step);\n          if (!attributes || attributes.size === 0) continue;\n          const context = generateKey();\n          const stepName = `dcupl:partial_process_data:step_${step}`;\n          this.cdRef.analyticsController.mark({ name: `${stepName}:start`, context });\n          if (step === 3) {\n            // Derived/grouped references and derived/expression properties\n            model.addDerivedAndExpressionAttributesPartial(container, attributes);\n          } else {\n            // Derived properties and references based on resolved references\n            model.reRunDerivedPropertiesBasedOnResolvesPartial(container, attributes);\n          }\n          this.cdRef.analyticsController.mark({ name: `${stepName}:end`, context });\n          this.cdRef.analyticsController.measure({\n            name: stepName,\n            start: `${stepName}:start`,\n            end: `${stepName}:end`,\n            context,\n            detail: { model: modelKey, attributeCount: attributes.size },\n          });\n        }\n      }\n    }\n  }\n\n  public handleAlternativeKey(containers: DataContainer<RawItem>[]): DataContainer<ListItem>[] {\n    containers.forEach((container) => {\n      if (this.keyedContainers.has(container)) {\n        return;\n      }\n\n      const model = this.models.get(container.model);\n\n      const keyProperty = container.keyProperty ?? model?.keyProperty;\n      const separator = container.keyPropertySeparator ?? model?.keyPropertySeparator ?? DEFAULT_KEY_PROPERTY_SEPARATOR;\n      const autoGenerateKey = container.autoGenerateKey || model?.autoGenerateKey;\n\n      const hasNamedKey =\n        typeof keyProperty === 'string'\n          ? keyProperty !== '' && keyProperty !== 'key'\n          : Array.isArray(keyProperty) && keyProperty.length > 0;\n\n      if (hasNamedKey) {\n        // A row without a key value gets `key: undefined`: the model drops it\n        // as MissingKey instead of keying it 'undefined' (#377).\n        container.data.forEach((item) => {\n          item.key = extractRowKey(item, keyProperty as string | readonly string[], separator);\n        });\n      } else if (autoGenerateKey) {\n        container.data.forEach((item) => {\n          if (!item.key) {\n            item.key = generateKey();\n          }\n        });\n      }\n\n      this.keyedContainers.add(container);\n    });\n    return containers;\n  }\n\n  @trigger({\n    scope: 'global',\n    type: 'dcupl_handle_datacontainer',\n  })\n  private async handleDataContainer(containers: DataContainer[]): Promise<void> {\n    const steps = this.processDataContainers(containers);\n    while (!steps.next().done) {\n      await yieldToEventLoop();\n    }\n  }\n\n  /**\n   * The processing of handleDataContainer without yielding to the event loop, for callers that\n   * cannot wait: the error-tracking models are built on first read, inside a synchronous read (#444).\n   * It emits the same `dcupl_handle_datacontainer` message, when the containers are processed.\n   */\n  @trigger({\n    scope: 'global',\n    type: 'dcupl_handle_datacontainer',\n  })\n  public processDataContainersSync(containers: DataContainer[]): void {\n    const steps = this.processDataContainers(containers);\n    while (!steps.next().done) {\n      // run every step to the end\n    }\n  }\n\n  /**\n   * Steps 1-4 of the data processing. Yields where the async caller gives the event loop a turn\n   * (performance.containerBatchSize decides where, as before).\n   */\n  private *processDataContainers(containers: DataContainer[]): Generator<void, void, undefined> {\n    // Auto-generate properties first\n    for (const dataContainer of containers) {\n      const model = this.models.get(dataContainer.model);\n      if (model?.autoGenerateProperties) {\n        model.generatePropertiesFromContainer(dataContainer);\n      }\n    }\n\n    // Get batch size from config\n    // If undefined: yield after every container (default async behavior)\n    // If 0: never yield (fully synchronous)\n    // If > 0: yield every N containers (batched processing)\n    const batchSize = this.initOptions.performance?.containerBatchSize;\n    const syncMode = batchSize !== undefined; // true if explicitly set, false for default async\n\n    // Step 1: Basic properties and references. Every row of these models\n    // resolves its references again and lists its misses anew (#425).\n    for (const dataContainer of containers) {\n      this.models.get(dataContainer.model)?.resetMissedReferenceKeys();\n    }\n    // The items step 1 auto-creates get their pass after every model's step 1 (#619)\n    const defers = this.defersAutoCreatedPasses;\n    this.defersAutoCreatedPasses = true;\n    try {\n      for (let i = 0; i < containers.length; i++) {\n        const dataContainer = containers[i]!;\n        const model = this.models.get(dataContainer.model);\n        const context = generateKey();\n\n        this.cdRef.analyticsController.mark({\n          name: `dcupl:process_data:step_1:start`,\n          context,\n        });\n\n        if (model) {\n          model.addBasicPropertiesAndReferences(dataContainer);\n          // An item a referrer auto-created before is this row's item (#598)\n          model.forgetAutoCreatedRows(dataContainer.data);\n\n          if (this.qualityController.enabled) {\n            if (model.qualityConfig.enabled === true) {\n              this.qualityController.cleanUpErrors(model, dataContainer);\n            }\n          }\n        }\n\n        this.cdRef.analyticsController.mark({\n          name: `dcupl:process_data:step_1:end`,\n          context,\n        });\n        this.cdRef.analyticsController.measure({\n          name: `dcupl:process_data:step_1`,\n          start: `dcupl:process_data:step_1:start`,\n          end: `dcupl:process_data:step_1:end`,\n          context,\n          detail: {\n            model: dataContainer.model,\n          },\n        });\n\n        // Yield logic:\n        // - Default (batchSize === undefined): yield after every container\n        // - Sync mode (batchSize === 0): never yield\n        // - Batched (batchSize > 0): yield every N containers\n        if (!syncMode) {\n          // Default: yield after every container\n          yield;\n        } else if (batchSize! > 0 && i > 0 && i % batchSize! === 0) {\n          // Batched: yield every N containers\n          yield;\n        }\n      }\n    } finally {\n      this.defersAutoCreatedPasses = defers;\n    }\n    this.processPendingAutoCreatedItems(false);\n\n    // Step 2: Query and resolved references. Their queries read the data step 1 built, not\n    // results cached before this update (#429).\n    this.invalidateQueryReferenceTargetLists(containers.map((container) => container.model));\n    for (let i = 0; i < containers.length; i++) {\n      const dataContainer = containers[i]!;\n      const model = this.models.get(dataContainer.model);\n      const context = generateKey();\n\n      this.cdRef.analyticsController.mark({\n        name: `dcupl:process_data:step_2:start`,\n        context,\n      });\n\n      if (model && model.hasQueryReferences()) {\n        model.addQueryReferences(dataContainer);\n      }\n\n      if (model && model.hasResolvedReferences()) {\n        model.addResolvedReferences(dataContainer);\n      }\n\n      this.cdRef.analyticsController.mark({\n        name: `dcupl:process_data:step_2:end`,\n        context,\n      });\n      this.cdRef.analyticsController.measure({\n        name: `dcupl:process_data:step_2`,\n        start: `dcupl:process_data:step_2:start`,\n        end: `dcupl:process_data:step_2:end`,\n        context,\n        detail: {\n          model: dataContainer.model,\n        },\n      });\n\n      // Yield logic (same as step 1)\n      if (!syncMode) {\n        yield;\n      } else if (batchSize! > 0 && i > 0 && i % batchSize! === 0) {\n        yield;\n      }\n    }\n\n    // Step 3: Derived references, grouped references, and expression properties\n    for (let i = 0; i < containers.length; i++) {\n      const dataContainer = containers[i]!;\n      const model = this.models.get(dataContainer.model);\n      const context = generateKey();\n\n      this.cdRef.analyticsController.mark({\n        name: `dcupl:process_data:step_3:start`,\n        context,\n      });\n\n      if (\n        model &&\n        (model.hasDerivedPropertiesForBasicReferences() ||\n          model?.hasDerivedReferences() ||\n          model?.hasGroupedReferences() ||\n          model?.hasExpressionProperties())\n      ) {\n        model.addDerivedReferencesGroupedReferencesDerivedPropertiesAndExpressionProperties(dataContainer);\n      }\n\n      this.cdRef.analyticsController.mark({\n        name: `dcupl:process_data:step_3:end`,\n        context,\n      });\n      this.cdRef.analyticsController.measure({\n        name: `dcupl:process_data:step_3`,\n        start: `dcupl:process_data:step_3:start`,\n        end: `dcupl:process_data:step_3:end`,\n        context,\n        detail: {\n          model: dataContainer.model,\n        },\n      });\n\n      // Yield logic (same as step 1)\n      if (!syncMode) {\n        yield;\n      } else if (batchSize! > 0 && i > 0 && i % batchSize! === 0) {\n        yield;\n      }\n    }\n\n    /**\n     * Step 4: Re-run derived properties based on resolved references\n     * In theory... if there is a derivedProperty based on a resolved reference we have to reprocess all Properties of this model.\n     */\n    for (let i = 0; i < containers.length; i++) {\n      const dataContainer = containers[i]!;\n      const model = this.models.get(dataContainer.model);\n\n      if (!model) {\n        this.log.error('Model not found during data processing', undefined, { model: dataContainer.model, step: 4 });\n        continue;\n      }\n\n      const context = generateKey();\n      this.cdRef.analyticsController.mark({\n        name: `dcupl:process_data:step_4:start`,\n        context,\n      });\n\n      if (\n        model.hasDerivedPropertiesBasedOnResolvedReferences() ||\n        model.hasDerivedReferencesBasedOnResolvedReferences()\n      ) {\n        model.reRunDerivedPropertiesBasedOnResolves(dataContainer);\n      }\n\n      this.cdRef.analyticsController.mark({\n        name: `dcupl:process_data:step_4:end`,\n        context,\n      });\n      this.cdRef.analyticsController.measure({\n        name: `dcupl:process_data:step_4`,\n        start: `dcupl:process_data:step_4:start`,\n        end: `dcupl:process_data:step_4:end`,\n        context,\n        detail: {\n          model: dataContainer.model,\n        },\n      });\n\n      // Quality validation\n      if (this.qualityController.enabled && model.qualityConfig.enabled === true) {\n        const errors = this.qualityController.validateAttributesAfterInitialization(model);\n        errors.forEach((error) => {\n          this.setError(error, model);\n        });\n      }\n\n      // Yield logic (same as step 1)\n      if (!syncMode) {\n        yield;\n      } else if (batchSize! > 0 && i > 0 && i % batchSize! === 0) {\n        yield;\n      }\n    }\n  }\n\n  /**\n   * Called before a read of `modelKey`'s rows from outside the parser: the error-tracking models\n   * are built on first read (#444).\n   */\n  public prepareModelForRead(modelKey: string | undefined): void {\n    // no modelKey (the app runner passes `config.data` to `fn.*` unvalidated): the read fails the\n    // way it did before, \"Model with key undefined not found\"\n    if (modelKey?.startsWith(ERROR_TRACKING_MODEL_PREFIX)) {\n      this.qualityController.materializeErrorTrackingModels();\n    }\n  }\n\n  public _getModelKeys(): string[] {\n    return Array.from(this.models.values())\n      .map((model) => model.key)\n      .filter((key) => key && !key.startsWith('$Dcupl'));\n  }\n\n  public _getViewKeys(options?: { modelKey: string }): string[] {\n    const modelKey = options?.modelKey;\n\n    return Array.from(this.views.values())\n      .filter((view) => {\n        if (modelKey) {\n          return view.model === modelKey;\n        }\n        return true;\n      })\n      .map((view) => view.key);\n  }\n\n  /**\n   * Gets the total number of items across all models\n   * @returns Total count of items\n   */\n  public getTotalItemCount(): number {\n    let total = 0;\n    for (const model of this.models.values()) {\n      total += model.getItemCount();\n    }\n    return total;\n  }\n}\n"],"names":["reWhitespace","trimmedEndIndex","string","index","reTrimStart","baseTrim","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","value","isSymbol","isObject","other","isBinary","INFINITY","MAX_INTEGER","toFinite","sign","toInteger","result","remainder","objectCreate","baseCreate","object","proto","copyArray","source","array","length","arrayEach","iteratee","baseAssignValue","key","defineProperty","objectProto","hasOwnProperty","assignValue","objValue","eq","copyObject","props","customizer","isNew","newValue","isIterateeCall","type","isArrayLike","isIndex","createAssigner","assigner","baseRest","sources","guard","nativeKeysIn","baseKeysIn","isProto","isPrototype","keysIn","arrayLikeKeys","getPrototype","overArg","objectTag","funcProto","funcToString","objectCtorString","isPlainObject","isObjectLike","baseGetTag","Ctor","baseClamp","number","lower","upper","freeExports","freeModule","moduleExports","Buffer","root","allocUnsafe","cloneBuffer","buffer","isDeep","initCloneArray","cloneArrayBuffer","arrayBuffer","Uint8Array","cloneDataView","dataView","reFlags","cloneRegExp","regexp","symbolProto","Symbol","symbolValueOf","cloneSymbol","symbol","cloneTypedArray","typedArray","boolTag","dateTag","mapTag","numberTag","regexpTag","setTag","stringTag","symbolTag","arrayBufferTag","dataViewTag","float32Tag","float64Tag","int8Tag","int16Tag","int32Tag","uint8Tag","uint8ClampedTag","uint16Tag","uint32Tag","initCloneByTag","tag","initCloneObject","baseIsMap","getTag","nodeIsMap","nodeUtil","isMap","baseUnary","baseIsSet","nodeIsSet","isSet","CLONE_DEEP_FLAG","argsTag","arrayTag","errorTag","funcTag","genTag","weakMapTag","cloneableTags","baseClone","bitmask","stack","isArr","isArray","isFunc","isBuffer","Stack","stacked","subValue","keysFunc","getAllKeys","CLONE_SYMBOLS_FLAG","cloneDeep","arrayAggregator","setter","accumulator","baseAggregator","collection","baseEach","createAggregator","initializer","func","baseIteratee","assignMergeValue","safeGet","toPlainObject","baseMergeDeep","srcIndex","mergeFunc","srcValue","isCommon","isBuff","isTyped","isTypedArray","isArrayLikeObject","isArguments","isFunction","baseMerge","baseFor","endsWith","target","position","toString","baseToString","end","groupBy","isString","baseValues","arrayMap","values","keys","nativeMax","includes","fromIndex","baseIndexOf","isBoolean","merge","getModelError","title","attribute","description","isValidProperty","property","validDatatypes","isValidReference","reference","validReferenceTypes","validateBasicModelStructure","model","kp","isValidString","isValidArray","p","v","validateModels","allModels","errors","ref","validateDerivedReference","validateResolvedReference","validateGroupedReference","prop","validateDerivedProperty","validateExpressionProperty","localRef","remoteModel","parseTemplate","templateVar","DEFAULT_KEY_PROPERTY_SEPARATOR","getKeyParts","keyProperty","extractKey","item","separator","extractRowKey","isMissing","part","hasRowKey","row","joinKeyProperty","flattenString","text","EntryMetadataValues","defaultAttributeQualityConfig","LEADING_ZERO_DIGITS","defaultQualityConfig","sameReferenceKeys","a","b","i","DcuplModel","modelParser","resolveCacheMaxSize","attributeKey","logger","IndicesController","modelDefinition","seenPropertyKeys","error","typeQualityConfig","qualityConfig","container","changedItemKeys","opt","options","known","unknownAttribute","keyedRows","getInferenceRowLimit","getPropertiesForData","effectiveKeyProperty","data","rowLimit","rowCount","referenceValue","cacheKey","build","sourceColumns","properties","references","origin","declared","r","column","rawDataEntry","dataEntry","rawValue","declaredType","arrayValue","val","stringValue","intValue","floatValue","dateValue","isValid","validationErrors","validationError","err","coercedValue","isInt","trimmed","numericFull","relevantValue","isFloat","fractionDigits","parseBooleanString","inputFormat","date","parseDate","isValidDate","referenceKey","remoteDataEntry","remoteValue","referenceKeys","validReferenceKeys","remoteKey","replacedRowKeys","effectiveSeparator","keyAttribute","duplicateKey","itemKey","misses","byRemoteKey","itemKeys","remoteKeys","missing","rows","outerPendingItemKeys","outerMissesToPending","sourceMetadata","valueMapping","map","emptyValue","stringKey","queryReferences","qR","strigifiedQuery","rawRows","targetKeys","targetData","targetItems","queryManager","affected","entry","finalQuery","resolvedQuery","evaluateTemplate","parsedQuery","qb","DcuplQueryBuilder","invalidFromValues","invalidToValues","rawEntry","valueMappingConfig","mappingValue","generateKey","yieldToEventLoop","next","partial","containers","outer","attributes","entries","deepIndices","plainIndices","indexName","plain","inferredKeyedRows","resolvedReferencesHelper","remoteData","inverseKeys","localDataEntryKey","localReferenceKey","vSet","specificReferences","staleLazyIndices","firstKey","previous","derivedProperties","expressionProperties","derivedReferences","groupedReferences","context","localReferenceValue","remoteEntry","entryValue","remoteValues","localReferenceToDeriveFrom","remoteModelToDeriveFrom","localKeyToDeriveFrom","previousValue","indexedKeys","previousIndexedKeys","resultSet","dataEntryToDeriveFrom","valueToDerive","valueToAssign","keysByItem","input","reverseIndex","referenceToGroupOn","valueToGroupOn","matchingItemKeys","itemsWithValue","attributeKeys","indexedExpressions","lazilyIndexedReferences","indexKey","itemSet","basicReferences","resolvedReferences","filteredData","containerKeys","autoRows","attributesToProcess","pendingItemKeys","oldReferenceValue","refKey","refValue","ERROR_TRACKING_MODEL_PREFIX","ERROR_TRACKING_ROW_MODELS","ATTRIBUTE_ERROR_TYPES","DATA_ERROR_GROUPS","UNIQUE_ERROR_TITLE","QualityController","scriptsController","errorType","groupKey","group","modelKey","isRejection","count","storedPerGroup","summary","storedCount","byGroup","s","reprocessedGroups","e","dataContainer","isRelevant","coercionSamples","sample","undefinedCount","undefinedAttributes","propertyCoercionErrors","groupedByAttribute","firstMeta","attributesOrErrorType","actualErrorType","modelErrors","relevantErrors","dataMap","modelAttributes","validators","attributeErrors","deletedItemKeys","allRowsAttributes","uniqueAttributes","rowsChanged","autoCreatedRows","superseded","d","list","models","unusedAttributesForModel","attr","isUserModel","modelFiles","modelRows","loadingValue","processValue","sizes","acc","totalByType","size","onlyDataResources","groupedByModel","encodedBodySize","decodedBodySize","unusedDataLength","relevantData","unusedData","newItem","dcupl","unusedAttributes","uniqueErrors","uniqueValues","isStrict","config","ChangeTracker","attributeSet","deletedSet","rowsByModel","keysOf","itemsByModel","items","totalModelCount","totalItemCount","totalChangedItems","totalDeletedItems","totalChangedAttributes","attrs","PartialUpdateMetrics","metric","partialUpdates","m","fullUpdates","avgPartialTime","sum","avgFullTime","avgAttributesProcessed","avgModelsAffected","totalTimeSaved","startTime","endTime","isQueryReference","isResolvedReference","isDerivedReference","isGroupedReference","ModelParser","cdRef","qualityController","dcuplInstance","what","DcuplSealedError","consumedData","modelDescription","dropped","registered","viewKey","DependencyGraph","validation","cyclePath","AttributeDependencyGraph","propertyKey","node","localReference","expectedAttributes","_","missingCount","missingList","message","expression","expressionNode","variables","variable","segments","currentModel","segment","path","derive","derivedNode","localRefNode","remotePropertyNode","query","queryRefNode","queryString","varName","depNode","resolve","resolvedNode","remoteRefNode","derivedRefNode","groupedRefNode","sourceRefNode","shouldUsePartial","modelsAffected","attributesChanged","itemsChanged","duration","columns","modelRatioThreshold","itemRatioThreshold","enableLogging","affectedModelRatio","totalItems","modelItemCount","itemRatio","changedRowsByModel","generatedAttributes","changedModels","reachableByTarget","rowKeysOf","changedRows","insertedRows","plan","queryReference","reachable","recompute","targetChanged","reachedModelChanged","targetRowsChanged","modelPlan","readsPath","queries","modelKeys","targets","queue","allContainers","orderBy","rest","definition","existingModel","newModel","modelA","modelB","view","relevantContainer","mergedContainers","groupedContainers","containerGroup","mergedMetadata","setContainer","changes","positions","rowKey","removed","write","read","rowKeys","consumedContainers","consumed","pendingContainers","stillQueued","queuedModels","keptContainers","merged","dataset","keylessRows","newContainer","storedRow","keySource","candidate","payloadRow","mergedRow","effective","meta","col","existing","samples","clone","orderedModelKeys","removedNone","generated","referencingItemKeys","queryReferencePlan","changedAttributes","matchingNode","impactedAttributes","processingPlan","rowScopes","step","defers","scope","processedAny","passes","added","candidates","referrersByModel","referrer","referrers","round","orphans","basicAttributes","c","createdNow","autoCreatedBefore","stepMap","impactedAttributeKeys","ownRows","otherRows","extraItemKeys","extraKeys","found","insertedKeysByModel","deletedKeysByModel","addKey","keysByModel","scanned","inserted","deleted","stored","scopes","planAttributes","withoutAllRows","changedRowAttributes","dependencies","allModelsWithStep2","step2Attrs","attrKey","remoteModelKey","remoteRefKey","remoteRef","sorted","visiting","visited","visit","deps","dep","hasRowWork","attributesForStep","stepName","nodeId","planned","levels","levelOf","id","level","dependency","dependencyId","byLevel","steps","autoGenerateKey","batchSize","syncMode","total","__decorateClass","trigger"],"mappings":"uDACA,IAAIA,GAAe,KAUnB,SAASC,GAAgBC,EAAQ,CAG/B,QAFIC,EAAQD,EAAO,OAEZC,KAAWH,GAAa,KAAKE,EAAO,OAAOC,CAAK,CAAC,GAAG,CAC3D,OAAOA,CACT,CCbA,IAAIC,GAAc,OASlB,SAASC,GAASH,EAAQ,CACxB,OAAOA,GACHA,EAAO,MAAM,EAAGD,GAAgBC,CAAM,EAAI,CAAC,EAAE,QAAQE,GAAa,EAAE,CAE1E,CCXA,IAAIE,EAAM,IAGNC,GAAa,qBAGbC,GAAa,aAGbC,GAAY,cAGZC,GAAe,SAyBnB,SAASC,GAASC,EAAO,CACvB,GAAI,OAAOA,GAAS,SAClB,OAAOA,EAET,GAAIC,EAAAA,SAASD,CAAK,EAChB,OAAON,EAET,GAAIQ,EAAAA,SAASF,CAAK,EAAG,CACnB,IAAIG,EAAQ,OAAOH,EAAM,SAAW,WAAaA,EAAM,QAAO,EAAKA,EACnEA,EAAQE,EAAAA,SAASC,CAAK,EAAKA,EAAQ,GAAMA,CAC3C,CACA,GAAI,OAAOH,GAAS,SAClB,OAAOA,IAAU,EAAIA,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