{"version":3,"file":"index.mjs","names":[],"sources":["../../_shared/native/std.ts","../src/common.ts","../src/deep.ts","../src/unsafe.ts"],"sourcesContent":["// Cached native methods for performance optimization\n\n// # Array\nexport const $isArray = Array.isArray;\nexport const $arrayFrom = Array.from;\nexport const $concat = Array.prototype.concat;\nexport const $filter = Array.prototype.filter;\nexport const $push = Array.prototype.push;\nexport const $slice = Array.prototype.slice;\nexport const $splice = Array.prototype.splice;\n\n// # Object\nexport const $fnToString = Function.prototype.toString;\nexport const $toString = Object.prototype.toString;\nexport const $ObjectPrototype = Object.prototype;\nexport const $is = Object.is;\nexport const $assign = Object.assign;\nexport const $hasOwn = Object.prototype.hasOwnProperty;\nexport const $keys = Object.keys as <T>(o: T) => Array<keyof T>;\nexport const $define = Object.defineProperty;\nexport const $defines = Object.defineProperties;\nexport const $entries = Object.entries as <T>(o: T) => Array<[keyof T, T[keyof T]]>;\nexport const $jsonStringify = JSON.stringify;\nexport const $getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors;\nexport const $freeze = Object.freeze;\n\n// # Reflect\n\nexport const $set = Reflect.set;\nexport const $get = Reflect.get;\nexport const $has = Reflect.has;\nexport const $ownKeys = Reflect.ownKeys;\n// & Do not use `Object.defineProperty`\nexport const $reflectDefine = Reflect.defineProperty;\nexport const $delete = Reflect.deleteProperty;\nexport const $getPrototypeOf = Reflect.getPrototypeOf;\nexport const $setPrototypeOf = Reflect.setPrototypeOf;\n\n// # Math and related utilities\nexport const $max = Math.max;\nexport const $min = Math.min;\nexport const $floor = Math.floor;\nexport const $random = Math.random;\nexport const $randomInt = (min: number, max: number) => $floor($random() * (max - min + 1)) + min;\n\n// # Number\nexport const $isNaN = Number.isNaN;\nexport const $isInt = Number.isInteger;\nexport const $isSafeInt = Number.isSafeInteger;\nexport const $isFinite = Number.isFinite;\nexport const $MAX_INT = Number.MAX_SAFE_INTEGER;\nexport const $MIN_INT = Number.MIN_SAFE_INTEGER;\n\nexport const $isThenable = (o: any): o is Promise<any> => typeof o?.then === 'function';\n\nexport const $isPrimitive: (o: unknown) => boolean | null | undefined | symbol | number | bigint = (o) =>\n  o === null || (typeof o !== 'object' && typeof o !== 'function');\n","// # utils\n\nexport function expectTarget(fnName: string, o: unknown) {\n  if (o === null || o === undefined) {\n    throw new TypeError(`[__NAME__] ${fnName} called with non-object target: ${o}`);\n  }\n}\n\nexport function expectTargetAndKeys(fnName: string, o: unknown, keys: PropertyKey[]) {\n  if (o === null || o === undefined) {\n    throw new TypeError(`[__NAME__] ${fnName} called with non-object target: ${o}`);\n  }\n  if (!Array.isArray(keys)) {\n    throw new TypeError(`[__NAME__] ${fnName} called with non-array keys`);\n  }\n  if (keys.length === 0) {\n    throw new TypeError(`[__NAME__] ${fnName} called with empty array of keys`);\n  }\n}\n","import {\n  $getPrototypeOf,\n  $ownKeys,\n  $has,\n  $get,\n  $set,\n  $delete,\n  $arrayFrom,\n  $reflectDefine,\n  $isPrimitive,\n} from '@shared';\nimport { expectTargetAndKeys, expectTarget } from './common.js';\n\nexport interface ReachResult {\n  /**\n   * The furthest reachable value in the object at the given property path.\n   */\n  value: any;\n\n  /**\n   * The index in `propertyKeys` of the last successfully accessed property.\n   * - Will be -1 if the first property failed.\n   */\n  index: number;\n\n  /**\n   * Whether the path was fully traversed and the final value was successfully reached.\n   */\n  reached: boolean;\n}\n\nexport interface GroupedKey {\n  /**\n   * Keys (includes symbols)\n   */\n  keys: (string | symbol)[];\n\n  /**\n   * Target itself or its prototype.\n   */\n  object: any;\n}\n\n/**\n * `ReflectDeep` namespace with strict runtime type checks.\n *\n * __PKG_INFO__\n */\n// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport namespace ReflectDeep {\n  /**\n   * Checks if a nested property exists at the given path.\n   * @param target - Target object to check.\n   * @param propertyKeys - Property path to check.\n   * @returns `true` if the property exists, `false` otherwise.\n   * @throws If target is not an object or propertyKeys is invalid.\n   * @throws If target is not an object or propertyKeys is not a valid non-empty array.\n   * @example\n   * const obj = { a: { b: { c: 'hello' } } };\n   * ReflectDeep.has(obj, ['a', 'b', 'c']); // true\n   */\n  export function has(target: object, propertyKeys: PropertyKey[]): boolean {\n    expectTargetAndKeys('has', target, propertyKeys);\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!$has(current, propertyKeys[i])) {\n        return false;\n      }\n\n      current = $get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n    return $has(current, propertyKeys[lastIndex]);\n  }\n\n  /**\n   * Gets the value of a nested property.\n   * @param target - Target object.\n   * @param propertyKeys - Property path.\n   * @param receiver - The `this` value for getter calls.\n   * @returns The property value, or `undefined` if not found.\n   * @throws If target is not an object or propertyKeys is invalid.\n   * @throws If target is not an object or propertyKeys is not a valid non-empty array.\n   * @example\n   * const obj = { a: { b: { c: 'hello' } } };\n   * ReflectDeep.get(obj, ['a', 'b', 'c']); // 'hello'\n   */\n  export function get<T = any>(target: any, propertyKeys: PropertyKey[], receiver?: any): T | undefined {\n    expectTargetAndKeys('get', target, propertyKeys);\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!$has(current, propertyKeys[i])) {\n        return undefined;\n      }\n\n      current = $get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return undefined;\n      }\n    }\n\n    const result =\n      receiver === undefined\n        ? $get(current, propertyKeys[lastIndex])\n        : $get(current, propertyKeys[lastIndex], receiver);\n\n    return result as T | undefined;\n  }\n\n  /**\n   * Sets a nested property value, creating intermediate objects as needed.\n   * @param target - Target object.\n   * @param propertyKeys - Property path.\n   * @param value - Value to set.\n   * @param receiver - The `this` value for setter calls.\n   * @returns `true` if successful, `false` otherwise.\n   * @throws If target is not an object or propertyKeys is invalid.\n   * @throws If target is not an object or propertyKeys is not a valid non-empty array.\n   * @example\n   * const obj = { };\n   * ReflectDeep.set(obj, ['a', 'b', 'c'], 'hello'); // Creates nested structure\n   * obj.a.b.c; // 'hello'\n   */\n  export function set<T = any>(target: any, propertyKeys: PropertyKey[], value: T, receiver?: any): boolean {\n    expectTargetAndKeys('set', target, propertyKeys);\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!$has(current, propertyKeys[i])) {\n        if (!$set(current, propertyKeys[i], {})) {\n          return false;\n        }\n      }\n\n      // Check if current can be set\n      current = $get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n\n    return receiver === undefined\n      ? $set(current, propertyKeys[lastIndex], value)\n      : $set(current, propertyKeys[lastIndex], value, receiver);\n  }\n\n  /**\n   * Traverses a property path and returns the furthest reachable value with its index.\n   * @param target - Target object to traverse.\n   * @param propertyKeys - Property path to traverse.\n   * @param receiver - The `this` value for getter calls.\n   * @returns Object with `value` (furthest reachable value), `index` (position reached), and `reached` (whether the full path was traversed).\n   * @throws If target is not an object or propertyKeys is invalid.\n   * @throws If target is not an object or propertyKeys is not a valid non-empty array.\n   * @example\n   * const obj = { a: { b: { c: 'hello' } } };\n   * ReflectDeep.reach(obj, ['a', 'b', 'c']); // { value: 'hello', index: 2, reached: true }\n   * ReflectDeep.reach(obj, ['a', 'b', 'd']); // { value: { c: 'hello' }, index: 1, reached: false }\n   * ReflectDeep.reach(obj, ['a', 'x']);     // { value: { b: { c: 'hello' } }, index: 0, reached: false }\n   * ReflectDeep.reach(obj, ['d', 'x']);     // { value: { a: { b: { c: 'hello' } } }, index: -1, reached: false }\n   */\n  export function reach(target: object, propertyKeys: PropertyKey[], receiver?: any): ReachResult {\n    expectTargetAndKeys('reach', target, propertyKeys);\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i <= lastIndex; i++) {\n      if (!$has(current, propertyKeys[i])) {\n        return { value: current, index: i - 1, reached: false };\n      }\n\n      if (i === lastIndex) {\n        const value =\n          receiver === undefined ? $get(current, propertyKeys[i]) : $get(current, propertyKeys[i], receiver);\n\n        return { value, index: i, reached: true };\n      }\n\n      current = $get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return { value: current, index: i, reached: false };\n      }\n    }\n\n    // Should not reach here, but just in case\n    return { value: current, index: -1, reached: false };\n  }\n\n  /**\n   * Deletes a nested property at the given path.\n   *\n   * **Has same behavior as the original `Reflect.deleteProperty`**\n   * - property does not exist, return `true`\n   * - exists and configurable, return `true`\n   * - exists but not configurable, return `false`\n   * - `target` is frozen, return `false`\n   * @param target Target object.\n   * @param propertyKeys Property path to delete.\n   * @returns `true` if successful, `false` otherwise.\n   * @throws If target is not an object or propertyKeys is not a valid non-empty array.\n   * @example\n   * const obj = { a: { b: { c: 'hello', d: 'world' } } };\n   * ReflectDeep.deleteProperty(obj, ['a', 'b', 'c']); // true\n   * obj.a.b; // { d: 'world' }\n   */\n  export function deleteProperty(target: object, propertyKeys: PropertyKey[]): boolean {\n    expectTargetAndKeys('deleteProperty', target, propertyKeys);\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!$has(current, propertyKeys[i])) {\n        return true;\n      }\n\n      current = $get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n\n    return $delete(current, propertyKeys[lastIndex]);\n  }\n\n  /**\n   * Defines a nested property with the given descriptor, creating intermediate objects as needed.\n   *\n   * **Has same behavior as the original `Reflect.defineProperty`**\n   * @param target Target object.\n   * @param propertyKeys Property path to define.\n   * @param descriptor Property descriptor to apply.\n   * @returns `true` if successful, `false` otherwise.\n   * @throws If target is not an object or propertyKeys is not a valid non-empty array.\n   * @example\n   * const obj = {};\n   * ReflectDeep.defineProperty(obj, ['a', 'b', 'c'], { value: 'hello', writable: true });\n   * obj.a.b.c; // 'hello'\n   *\n   * // Define getter/setter\n   * ReflectDeep.defineProperty(obj, ['x', 'y'], {\n   *   get() { return this._value; },\n   *   set(v) { this._value = v; }\n   * });\n   */\n  export function defineProperty(target: object, propertyKeys: PropertyKey[], descriptor: PropertyDescriptor): boolean {\n    expectTargetAndKeys('defineProperty', target, propertyKeys);\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!$has(current, propertyKeys[i])) {\n        if (!$set(current, propertyKeys[i], {})) {\n          return false;\n        }\n      }\n\n      current = $get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n\n    return $reflectDefine(current, propertyKeys[lastIndex], descriptor);\n  }\n\n  /**\n   * Gets all property keys (including symbols) from the target object and its prototype chain.\n   * Returns a flattened array of unique keys from all prototype layers.\n   * @param target - Target object to extract keys from.\n   * @returns Array of all unique property keys from the object and its prototype chain.\n   * @throws If target is not an object.\n   * @example\n   * const obj = { own: 'property', [Symbol('sym')]: 'symbol' };\n   * const keys = ReflectDeep.keys(obj);\n   * // Returns: ['own', Symbol(sym), 'toString', 'valueOf', ...] (includes prototype keys)\n   *\n   * // Works with custom prototypes\n   * function Parent() {}\n   * Parent.prototype.parentProp = 'parent';\n   * const child = Object.create(Parent.prototype);\n   * child.childProp = 'child';\n   * ReflectDeep.keys(child); // ['childProp', 'parentProp', 'toString', ...]\n   */\n  export function ownKeys<T extends object>(target: T): (string | symbol)[] {\n    expectTarget('ownKeys', target);\n\n    const keySet = new Set($ownKeys(target));\n    let proto: object | null = target;\n    while (true) {\n      proto = $getPrototypeOf(proto);\n\n      // * Proto chain will not contain any loop\n      if (proto) {\n        const keys = $ownKeys(proto);\n        for (let i = 0; i < keys.length; i++) {\n          keySet.add(keys[i]);\n        }\n      } else {\n        return $arrayFrom(keySet);\n      }\n    }\n  }\n\n  /**\n   * Gets property keys grouped by prototype layer, preserving the prototype chain structure.\n   * Returns an array where each element represents a layer in the prototype chain with its keys and object reference.\n   * @param target - Target object to extract grouped keys from.\n   * @returns Array of objects, each containing `keys` and `object` for each prototype layer.\n   * @throws If target is not an object.\n   * @example\n   * const obj = { own: 'property', [Symbol('sym')]: 'symbol' };\n   * const grouped = ReflectDeep.groupedKeys(obj);\n   * // Returns: [\n   * //   { keys: ['own', Symbol(sym)], object: obj },\n   * //   { keys: ['toString', 'valueOf', ...], object: Object.prototype },\n   * //   { keys: [], object: null }\n   * // ]\n   *\n   * // Useful for inspecting prototype chain structure\n   * function Parent() {}\n   * Parent.prototype.parentProp = 'parent';\n   * const child = Object.create(Parent.prototype);\n   * child.childProp = 'child';\n   * const layers = ReflectDeep.groupedKeys(child);\n   * // layers[0] = { keys: ['childProp'], object: child }\n   * // layers[1] = { keys: ['parentProp'], object: Parent.prototype }\n   * // layers[2] = { keys: ['toString', ...], object: Object.prototype }\n   */\n  export function groupedKeys<T extends object>(target: T): GroupedKey[] {\n    expectTarget('groupedKeys', target);\n\n    const keys: GroupedKey[] = [{ keys: $ownKeys(target), object: target }];\n    let proto = $getPrototypeOf(target);\n    while (true) {\n      // * Proto chain will not contain any loop\n      if (!proto) {\n        return keys;\n      }\n      keys.push({\n        object: proto,\n        keys: $ownKeys(proto),\n      });\n      proto = $getPrototypeOf(proto);\n    }\n  }\n}\n","import type { ReachResult, GroupedKey } from './deep.js';\nimport { $isPrimitive } from '@shared';\n\n/**\n * This is the `ReflectDeep` namespace without runtime strict type checks.\n *\n * __PKG_INFO__\n */\nexport namespace ReflectDeep {\n  /**\n   * Checks if a nested property exists at the given path.\n   * @param target - Target object to check.\n   * @param propertyKeys - Property path to check.\n   * @returns `true` if the property exists, `false` otherwise.\n   * @example\n   * const obj = { a: { b: { c: 'hello' } } };\n   * ReflectDeep.has(obj, ['a', 'b', 'c']); // true\n   */\n  export function has(target: object, propertyKeys: PropertyKey[]): boolean {\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!Reflect.has(current, propertyKeys[i])) {\n        return false;\n      }\n\n      current = Reflect.get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n    return Reflect.has(current, propertyKeys[lastIndex]);\n  }\n\n  /**\n   * Gets the value of a nested property.\n   * @param target - Target object.\n   * @param propertyKeys - Property path.\n   * @param receiver - The `this` value for getter calls.\n   * @returns The property value, or `undefined` if not found.\n   * @example\n   * const obj = { a: { b: { c: 'hello' } } };\n   * ReflectDeep.get(obj, ['a', 'b', 'c']); // 'hello'\n   */\n  export function get<T = any>(target: any, propertyKeys: PropertyKey[], receiver?: any): T | undefined {\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!Reflect.has(current, propertyKeys[i])) {\n        return undefined;\n      }\n\n      current = Reflect.get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return undefined;\n      }\n    }\n\n    const result =\n      receiver === undefined\n        ? Reflect.get(current, propertyKeys[lastIndex])\n        : Reflect.get(current, propertyKeys[lastIndex], receiver);\n\n    return result as T | undefined;\n  }\n\n  /**\n   * Sets a nested property value, creating intermediate objects as needed.\n   * @param target - Target object.\n   * @param propertyKeys - Property path.\n   * @param value - Value to set.\n   * @param receiver - The `this` value for setter calls.\n   * @returns `true` if successful, `false` otherwise.\n   * @example\n   * const obj = { };\n   * ReflectDeep.set(obj, ['a', 'b', 'c'], 'hello'); // Creates nested structure\n   * obj.a.b.c; // 'hello'\n   */\n  export function set<T = any>(target: any, propertyKeys: PropertyKey[], value: T, receiver?: any): boolean {\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!Reflect.has(current, propertyKeys[i])) {\n        if (!Reflect.set(current, propertyKeys[i], {})) {\n          return false;\n        }\n      }\n\n      // Check if current can be set\n      current = Reflect.get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n\n    return receiver === undefined\n      ? Reflect.set(current, propertyKeys[lastIndex], value)\n      : Reflect.set(current, propertyKeys[lastIndex], value, receiver);\n  }\n\n  /**\n   * Traverses a property path and returns the furthest reachable value with its index.\n   * @param target - Target object to traverse.\n   * @param propertyKeys - Property path to traverse.\n   * @param receiver - The `this` value for getter calls.\n   * @returns Object with `value` (furthest reachable value), `index` (position reached), and `reached` (whether the full path was traversed).\n   * @example\n   * const obj = { a: { b: { c: 'hello' } } };\n   * ReflectDeep.reach(obj, ['a', 'b', 'c']); // { value: 'hello', index: 2, reached: true }\n   * ReflectDeep.reach(obj, ['a', 'b', 'd']); // { value: { c: 'hello' }, index: 1, reached: false }\n   * ReflectDeep.reach(obj, ['a', 'x']);     // { value: { b: { c: 'hello' } }, index: 0, reached: false }\n   * ReflectDeep.reach(obj, ['d', 'x']);     // { value: { a: { b: { c: 'hello' } } }, index: -1, reached: false }\n   */\n  export function reach(target: object, propertyKeys: PropertyKey[], receiver?: any): ReachResult {\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i <= lastIndex; i++) {\n      if (!Reflect.has(current, propertyKeys[i])) {\n        return { value: current, index: i - 1, reached: false };\n      }\n\n      if (i === lastIndex) {\n        const value =\n          receiver === undefined\n            ? Reflect.get(current, propertyKeys[i])\n            : Reflect.get(current, propertyKeys[i], receiver);\n\n        return { value, index: i, reached: true };\n      }\n\n      current = Reflect.get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return { value: current, index: i, reached: false };\n      }\n    }\n\n    // Should not reach here, but just in case\n    return { value: current, index: -1, reached: false };\n  }\n\n  /**\n   * Deletes a nested property at the given path.\n   *\n   * **Has same behavior as the original `Reflect.deleteProperty`**\n   * - property does not exist, return `true`\n   * - exists and configurable, return `true`\n   * - exists but not configurable, return `false`\n   * - `target` is frozen, return `false`\n   * @param target Target object.\n   * @param propertyKeys Property path to delete.\n   * @returns `true` if successful, `false` otherwise.\n   * @example\n   * const obj = { a: { b: { c: 'hello', d: 'world' } } };\n   * ReflectDeep.deleteProperty(obj, ['a', 'b', 'c']); // true\n   * obj.a.b; // { d: 'world' }\n   */\n  export function deleteProperty(target: object, propertyKeys: PropertyKey[]): boolean {\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!Reflect.has(current, propertyKeys[i])) {\n        return true;\n      }\n\n      current = Reflect.get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n\n    return Reflect.deleteProperty(current, propertyKeys[lastIndex]);\n  }\n\n  /**\n   * Defines a nested property with the given descriptor, creating intermediate objects as needed.\n   *\n   * **Has same behavior as the original `Reflect.defineProperty`**\n   * @param target Target object.\n   * @param propertyKeys Property path to define.\n   * @param descriptor Property descriptor to apply.\n   * @returns `true` if successful, `false` otherwise.\n   * @example\n   * const obj = {};\n   * ReflectDeep.defineProperty(obj, ['a', 'b', 'c'], { value: 'hello', writable: true });\n   * obj.a.b.c; // 'hello'\n   *\n   * // Define getter/setter\n   * ReflectDeep.defineProperty(obj, ['x', 'y'], {\n   *   get() { return this._value; },\n   *   set(v) { this._value = v; }\n   * });\n   */\n  export function defineProperty(target: object, propertyKeys: PropertyKey[], descriptor: PropertyDescriptor): boolean {\n    const lastIndex = propertyKeys.length - 1;\n\n    let current = target;\n    for (let i = 0; i < lastIndex; i++) {\n      if (!Reflect.has(current, propertyKeys[i])) {\n        if (!Reflect.set(current, propertyKeys[i], {})) {\n          return false;\n        }\n      }\n\n      current = Reflect.get(current, propertyKeys[i]);\n      if ($isPrimitive(current)) {\n        return false;\n      }\n    }\n\n    return Reflect.defineProperty(current, propertyKeys[lastIndex], descriptor);\n  }\n\n  /**\n   * Gets all property keys (including symbols) from the target object and its prototype chain.\n   * Returns a flattened array of unique keys from all prototype layers.\n   * @param target - Target object to extract keys from.\n   * @returns Array of all unique property keys from the object and its prototype chain.\n   * @example\n   * const obj = { own: 'property', [Symbol('sym')]: 'symbol' };\n   * const keys = ReflectDeep.keys(obj);\n   * // Returns: ['own', Symbol(sym), 'toString', 'valueOf', ...] (includes prototype keys)\n   *\n   * // Works with custom prototypes\n   * function Parent() {}\n   * Parent.prototype.parentProp = 'parent';\n   * const child = Object.create(Parent.prototype);\n   * child.childProp = 'child';\n   * ReflectDeep.keys(child); // ['childProp', 'parentProp', 'toString', ...]\n   */\n  export function ownKeys<T extends object>(target: T): (string | symbol)[] {\n    const keySet = new Set(Reflect.ownKeys(target));\n    let proto: object | null = target;\n    while (true) {\n      proto = Reflect.getPrototypeOf(proto);\n\n      // * Proto chain will not contain any loop\n      if (proto) {\n        const keys = Reflect.ownKeys(proto);\n        for (let i = 0; i < keys.length; i++) {\n          keySet.add(keys[i]);\n        }\n      } else {\n        return Array.from(keySet);\n      }\n    }\n  }\n\n  /**\n   * Gets property keys grouped by prototype layer, preserving the prototype chain structure.\n   * Returns an array where each element represents a layer in the prototype chain with its keys and object reference.\n   * @param target - Target object to extract grouped keys from.\n   * @returns Array of objects, each containing `keys` and `object` for each prototype layer.\n   * @throws If target is not an object.\n   * @throws If target is not an object.\n   * @example\n   * const obj = { own: 'property', [Symbol('sym')]: 'symbol' };\n   * const grouped = ReflectDeep.groupedKeys(obj);\n   * // Returns: [\n   * //   { keys: ['own', Symbol(sym)], object: obj },\n   * //   { keys: ['toString', 'valueOf', ...], object: Object.prototype },\n   * //   { keys: [], object: null }\n   * // ]\n   *\n   * // Useful for inspecting prototype chain structure\n   * function Parent() {}\n   * Parent.prototype.parentProp = 'parent';\n   * const child = Object.create(Parent.prototype);\n   * child.childProp = 'child';\n   * const layers = ReflectDeep.groupedKeys(child);\n   * // layers[0] = { keys: ['childProp'], object: child }\n   * // layers[1] = { keys: ['parentProp'], object: Parent.prototype }\n   * // layers[2] = { keys: ['toString', ...], object: Object.prototype }\n   */\n  export function groupedKeys<T extends object>(target: T): GroupedKey[] {\n    const keys: GroupedKey[] = [{ keys: Reflect.ownKeys(target), object: target }];\n    let proto = Reflect.getPrototypeOf(target);\n    while (true) {\n      // * Proto chain will not contain any loop\n      if (!proto) {\n        return keys;\n      }\n      keys.push({\n        object: proto,\n        keys: Reflect.ownKeys(proto),\n      });\n      proto = Reflect.getPrototypeOf(proto);\n    }\n  }\n}\n"],"mapp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