{"version":3,"file":"_notationAssign.mjs","names":[],"sources":["../../src/internal/_notationAssign.ts"],"sourcesContent":["import { _notationKeyCollision } from \"./_notationKeyCollision\";\n\n/**\n * Define a renamed key as an own data property.\n *\n * A destination that another source key already produced throws instead of\n * being overwritten. The caller owns both the output and its matching source\n * dictionary, and initializes that dictionary without a prototype.\n *\n * @evidence contracts/common.md#principled-implementation The destination key is computed by the rename function and defined as an own data property, so a key such as `__proto__` stays an ordinary property; if the destination already holds a value from another source key, the collision throws instead of overwriting.\n * @evidence contracts/common.md#clear-and-simple-design One function that records the source of each destination in a dictionary without a prototype.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts Collisions are an error, and no key is dropped silently.\n * @evidence contracts/common.md#meaningful-documentation A comment states the own-property assignment and the collision rule.\n */\nexport const _notationAssign = (\n  output: Record<string, any>,\n  sources: Record<string, string>,\n  source: string,\n  value: any,\n  rename: (str: string) => string,\n): void => {\n  const destination: string = rename(source);\n  if (Object.hasOwn(output, destination))\n    _notationKeyCollision(sources[destination]!, source, destination);\n  Object.defineProperty(output, destination, {\n    configurable: true,\n    enumerable: true,\n    value,\n    writable: true,\n  });\n  sources[destination] = source;\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,mBACX,QACA,SACA,QACA,OACA,WACS;CACT,MAAM,cAAsB,OAAO,MAAM;CACzC,IAAI,OAAO,OAAO,QAAQ,WAAW,GACnC,sBAAsB,QAAQ,cAAe,QAAQ,WAAW;CAClE,OAAO,eAAe,QAAQ,aAAa;EACzC,cAAc;EACd,YAAY;EACZ;EACA,UAAU;CACZ,CAAC;CACD,QAAQ,eAAe;AACzB"}