{
  "version": 3,
  "sources": ["../../node_modules/@nejs/extension/src/errors/CannotBeExtendedError.js", "../../node_modules/@nejs/extension/src/errors/MissingOwnerValue.js", "../../node_modules/@nejs/extension/src/patchtoggle.js", "../../node_modules/@nejs/extension/src/patchentry.js", "../../node_modules/@nejs/extension/src/patch.js", "../../node_modules/@nejs/extension/src/extension.js", "../../node_modules/@nejs/extension/src/semver.js", "../../node_modules/@nejs/extension/src/index.js", "../../src/array.extensions.js", "../../src/big.int.extension.js", "../../src/function.extensions.js", "../../src/utils/copy.object.js", "../../src/utils/toolkit.js", "../../src/global.this.js", "../../src/json.extensions.js", "../../src/map.extensions.js", "../../src/math.extension.js", "../../src/number.extension.js", "../../src/classes/symkeys.js", "../../src/symbol.extensions.js", "../../src/utils/descriptor.utils.js", "../../src/classes/descriptor.js", "../../src/classes/property.js", "../../src/object.extensions.js", "../../src/reflect.extensions.js", "../../src/regular.expression.extensions.js", "../../src/set.extensions.js", "../../src/string.extensions.js", "../../src/classes/deferred.js", "../../src/utils/stdout.js", "../../src/classes/enum.js", "../../node_modules/@nejs/enumeration/src/enumeration.mjs", "../../src/classes/enumeration.js", "../../src/classes/introspector.js", "../../src/classes/iterable.js", "../../src/classes/param.parser.js", "../../src/classes/pluggable.proxy.js", "../../src/weakref.extensions.js", "../../src/classes/refmap.js", "../../src/classes/refset.js", "../../src/classes/type.js", "../../src/classes/asyncIterable.js", "../../src/index.js"],
  "sourcesContent": ["/** Small utility to fetch name of class or type */\nconst typeOf = o => /(\\w+)]/.exec(Object.prototype.toString.call(o))[1]\n\n/**\n * Represents an error that is thrown when there is an attempt to extend a\n * restricted part of the code. This error is specifically used to signal\n * violations of extension constraints, such as tampering with certain keys\n * or properties of an object. The error message constructed will include the\n * details of the owner (the restricted part) and the key that was attempted to\n * be tampered with.\n */\nexport class CannotBeExtendedError extends Error {\n  /**\n   * Constructs a new CannotBeExtendedError instance.\n   *\n   * @param {string} owner The name or identifier of the restricted part\n   * that is disallowing extension or tampering.\n   * @param {string} key The key or property that was attempted to be\n   * modified or extended.\n   */\n  constructor(owner, key) {\n    super(`${typeOf(owner)} disallows tampering with ${key}.`)\n    Object.assign(this, { owner, key })\n  }\n\n  /**\n   * Custom getter for the toStringTag symbol. Overrides the default\n   * Object.prototype.toString behavior, returning the constructor's name\n   * of this error instance. Useful for debugging and logging purposes.\n   * @returns {string} The name of the constructor for this error instance.\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n}\n", "/** Small utility to fetch name of class or type */\nconst typeOf = o => /(\\w+)]/.exec(Object.prototype.toString.call(o))[1]\n\n/**\n * Represents an error that is thrown when a property is missing from a specified\n * owner object. This error is used to indicate that a specific key or property\n * expected to be present on the owner is not found, highlighting potential issues\n * in property access or data integrity.\n */\nexport class MissingOwnerValue extends Error {\n  /**\n   * Constructs a new MissingOwnerValue instance.\n   *\n   * @param {string} owner The object or entity that is supposed to contain the\n   * property.\n   * @param {string} key The name of the property that is missing from the owner.\n   */\n  constructor(owner, key) {\n    super(`${typeOf(owner)} does not have a property named '${key}'.`)\n    Object.assign(this, { owner, key })\n  }\n\n  /**\n   * Custom getter for the toStringTag symbol. Overrides the default\n   * Object.prototype.toString behavior, returning the constructor's name\n   * of this error instance. Useful for debugging and logging purposes.\n   *\n   * @returns {string} The name of the constructor for this error instance.\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n}\n", "import { Patch } from \"./patch.js\";\n\n/**\n * Early usage of the Patch and Extension classes made it clear that it was\n * cumbersome to use a Patch temporarily for a block of code and excessive\n * amounts of if/else statements were required. This simple wrapper makes that\n * process easier.\n */\nexport class PatchToggle {\n  /**\n   * Wraps an instance of a Patch. It allows low-code clean-readability to\n   * start and stop the underlying patch regardless of whether or not the\n   * patch has been already applied.\n   *\n   * @param {Patch} patch instance of `Patch` to wrap with this toggle\n   * @param {boolean} preventRevert prevents the call to `.revert()` on the\n   * supplied patch when stop() is called.\n   */\n  constructor(patch, preventRevert = false) {\n    this.started = false\n    this.preventRevert = preventRevert\n    this.patch = patch\n    this.patchName = (\n      patch.owner?.name ??\n      patch.owner?.constructor?.name ??\n      /(\\w+)]/.exec(Object.prototype.toString.call(patch.owner))[1]\n    )\n    this.state = {\n      needsApplication: false,\n      needsReversion: false,\n    }\n  }\n\n  /**\n   * If the usage of the wrapped Patch hasn't been started yet, the code checks\n   * whether or not the patch has been applied by checking for signs of it in\n   * the owning object.\n   *\n   * If the patch needs to be applied, it will be applied at this time.\n   *\n   * @returns {PatchToggle} returns `this` to allow for chaining\n   */\n  start() {\n    if (!this.started) {\n      this.state.needsApplication = !this.patch.applied\n      this.state.needsReversion = this.patch.applied\n      this.started = true\n\n      if (this.state.needsApplication) {\n        this.patch.apply()\n      }\n    }\n\n    return this\n  }\n\n  /**\n   * Performs a task with the wrapped patch. If the patch hasn't been\n   * started, it will be started. If the patch doesn't need to be\n   * reverted, it will be stopped after the task is complete.\n   *\n   * @param {Function} task a function that takes the `PatchToggle`\n   * instance and the wrapped `Patch` instance as parameters. By\n   * default, this is an empty function.\n   * @returns {*} the result of the `task` function\n   *\n   * @example\n   * const result = toggle.perform((toggle, patch) => {\n   *   // do something with `toggle` and `patch`\n   *   return \"done\"\n   * })\n   * console.log(result) // outputs: \"done\"\n   */\n  perform(task = (toggle, patch) => {}) {\n    if (!this.state.needsApplication) {\n      this.start()\n    }\n\n    const result = task(this, this.patch)\n\n    if (!this.state.needsReversion) {\n      this.stop()\n    }\n\n    return result\n  }\n\n  /**\n   * Checks to see if the toggle has been started. If so, the patch is reverted\n   * if it needed to be applied previously. After stopping, the state of the instance\n   * is reverted to allow for clean subsequent calls to start.\n   *\n   * @returns {PatchToggle} returns `this` to allow further chaining\n   */\n  stop() {\n    if (this.started) {\n      if (this.preventRevert || this.patch.applied) {\n        this.patch.revert()\n      }\n\n      this.state.needsApplication = false\n      this.state.needsReversion = false\n      this.started = false\n    }\n\n    return this\n  }\n\n  /**\n   * When the string tag for this class instance is inspected, it will\n   * reflect the string `PatchToggle:PatchName`\n   */\n  get [Symbol.toStringTag]() {\n    return `${this.constructor.name}:${this.patchName}`\n  }\n\n  /**\n   * Custom inspect function for Node.js that provides a formatted representation\n   * of the PatchToggle instance, primarily for debugging purposes.\n   *\n   * @param {number} depth The depth to which the object should be formatted.\n   * @param {object} options Formatting options.\n   * @param {function} inspect The inspection function to format the object.\n   * @returns {string} A formatted string representing the PatchEntry instance.\n   */\n  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n    const objName = this[Symbol.toStringTag]\n    const status = `(started: ${this.started} needed: ${this.state.needsApplication})`\n\n    return inspect(`${objName} ${status}`, {...options, depth})\n  }\n}", "/**\n * A PatchEntry class is a wrapper that maps the descriptor, key and owning\n * object in a single instance. When a Patch or Extension are created, one\n * of these for each patch is created so that the patch can be applied and\n * reverted.\n */\nexport class PatchEntry {\n\n  /**\n   * Constructs a new PatchEntry instance, encapsulating the logic for\n   * patching a property onto an object with optional conditions and\n   * descriptor overrides.\n   *\n   * This constructor validates the provided property and owningObject,\n   * constructs a property descriptor by merging the existing descriptor\n   * (if any) with any provided overrides, and initializes the PatchEntry\n   * instance with these details.\n   *\n   * @param {string|symbol} property The property key to patch. Must be a\n   * non-null string or symbol.\n   * @param {object} [owningObject=globalThis] The object to which the\n   * property will be patched. Defaults to the global object.\n   * @param {Function} [condition=undefined] An optional function that\n   * determines if the patch should be applied. If undefined, the patch\n   * is always applied.\n   * @param {object} [descriptorOverrides={}] Optional overrides for the\n   * property descriptor of the patch.\n   * @throws {TypeError} If `property` is not a string or symbol, or if\n   * `owningObject` is not an object.\n   */\n  constructor(\n    property,\n    owningObject = globalThis,\n    condition = undefined,\n    descriptorOverrides = {}\n  ) {\n    const isNullish = (value) => (value === null || value === undefined)\n    const isKey = (value, types = ['string', 'symbol']) =>\n      !isNullish(value) && (!!types.find(f => f === (typeof value)))\n    const isObject = value => isKey(value, ['object'])\n\n    if (!isKey(property)) {\n      console.error(\n        'Property', property, `(type: ${typeof property})`,\n        'owningObject', owningObject, `(type: ${typeof owningObject})`,\n        'condition', condition, `(type: ${typeof condition})`,\n      )\n      throw new TypeError(\n        'Property must be non-null and either a string or symbol'\n      )\n    }\n\n    if (!isObject(owningObject)) {\n      throw new TypeError(\n        'Cannot create Patch entry as owning object is invalid'\n      )\n    }\n\n    const descriptor = {\n      ...Object.getOwnPropertyDescriptor(owningObject, property),\n      ...Object(descriptorOverrides)\n    }\n\n    Object.assign(this, {\n      key: property,\n      descriptor,\n      owner: owningObject,\n      condition: (typeof condition === 'function') ? condition : undefined\n    })\n  }\n\n  /**\n   * Computes and returns the current value of the patch, based on its type\n   * (data or accessor).\n   *\n   * @returns {any} The current value of the patch.\n   */\n  get computed() {\n    if (this.isAccessor) {\n      return this.descriptor.get.bind(this.owner).call()\n    }\n    else {\n      return this.descriptor.value\n    }\n  }\n\n  /**\n   * Checks if the patch is a data property (has a value).\n   *\n   * @returns {boolean} True if the patch is a data property, false otherwise.\n   */\n  get isData() {\n    return Reflect.has(this.descriptor, 'value')\n  }\n\n  /**\n   * Checks if the patch is an accessor property (has a getter).\n   *\n   * @returns {boolean} True if the patch is an accessor property, false otherwise.\n   */\n  get isAccessor() {\n    return Reflect.has(this.descriptor, 'get')\n  }\n\n  /**\n   * Checks if the patch is read-only (not configurable or not writable).\n   *\n   * @returns {boolean} True if the patch is read-only, false otherwise.\n   */\n  get isReadOnly() {\n    return (\n      (Reflect.has(this.descriptor, 'configurable') && !this.descriptor.configurable) ||\n      (Reflect.has(this.descriptor, 'writable') && !this.descriptor.writable)\n    )\n  }\n\n  /**\n   * If a `condition` is associated with this specific patch entry, then it will\n   * run and its result will be returned. Otherwise `true` is returned allowing\n   * all non-conditional `PatchEntry` instances to be applied every time.\n   *\n   * @returns {boolean} `true` if the condition is true or there is no condition\n   * applied to this instance. `false` if the condition fails.\n   */\n  get isAllowed() {\n    const validAndPresent = (\n      this.condition &&\n      typeof this.condition === 'function'\n    )\n\n    return validAndPresent ? this.condition() : true\n  }\n\n  /**\n   * Applies the patch entry to a given object. This method takes the\n   * descriptor from the current patch entry and defines it on the target\n   * object. If `bindAccessors` is true and the descriptor contains accessor\n   * methods (getters/setters), they will be bound to the original owner of\n   * the patch before being applied to ensure the correct `this` context.\n   *\n   * @param {object} anotherObject - The object to which the patch will be\n   * applied.\n   * @param {boolean} [bindAccessors=false] - Whether to bind accessor methods\n   * to the patch's owner.\n   */\n  applyTo(anotherObject, bindAccessors = false) {\n    const descriptor = { ...this.descriptor }\n\n    if (bindAccessors) {\n      if (typeof descriptor.get === 'function') {\n        descriptor.get = descriptor.get.bind(this.owner);\n      }\n      if (typeof descriptor.set === 'function') {\n        descriptor.set = descriptor.set.bind(this.owner);\n      }\n    }\n\n    Object.defineProperty(anotherObject, this.key, descriptor);\n  }\n\n  /**\n   * Custom getter for the toStringTag symbol. Provides the class name of\n   * the PatchEntry instance.\n   *\n   * @returns {string} The class name of the PatchEntry instance.\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * Custom inspect function for Node.js that provides a formatted representation\n   * of the PatchEntry instance, primarily for debugging purposes.\n   *\n   * @param {number} depth The depth to which the object should be formatted.\n   * @param {object} options Formatting options.\n   * @param {function} inspect The inspection function to format the object.\n   * @returns {string} A formatted string representing the PatchEntry instance.\n   */\n  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n    const name = `\\x1b[33m${this.key}\\x1b[39m`\n    const type = this.isData ? ' Data' : ' Accessor'\n    const writable = this.isReadOnly ? ' [\\x1b[2;3mReadOnly\\x1b[22;23m]' : ''\n\n    return `PatchEntry<${name}${type}${writable}>`\n  }\n}\n", "import { PatchToggle } from './patchtoggle.js'\nimport { PatchEntry } from './patchentry.js'\n\n/**\n * The Patch class provides a mechanism to apply patches to properties or\n * methods of an object (the owner). It keeps track of the original state of\n * these properties and allows for the application and reversion of patches.\n */\nexport class Patch {\n  /**\n   * A record of conflicts between existing and patched properties or methods.\n   * This object maps property names to their respective PatchEntry instances,\n   * which contain information about the original and patched values.\n   *\n   * @type {object}\n   */\n  patchConflicts = Object.create(null)\n\n  /**\n   * An object to store patch entries. Each key corresponds to a property or\n   * method name on the owner object, and the value is the associated\n   * PatchEntry instance which contains the patched and original values.\n   *\n   * @type {object}\n   */\n  patchEntries = Object.create(null)\n\n  /**\n   * The object containing the patches to be applied to the owner. It is\n   * initially undefined and will be populated with the patches passed to the\n   * constructor.\n   *\n   * @type {object}\n   */\n  patchesOwner = undefined\n\n  /**\n   * The count of patches that have been applied. This is incremented\n   * each time a patch is applied and decremented when a patch is\n   * reverted.\n   *\n   * @type {number}\n   */\n  patchCount = 0\n\n  /**\n   * The number of patches that have been successfully applied. This count\n   * is incremented after each successful patch application and decremented\n   * when a patch is reverted.\n   *\n   * @type {number}\n   */\n  patchesApplied = 0\n\n\n  /**\n   * The `displayName` property is used to store a human-readable name for the\n   * Patch instance. This name can be used for logging or debugging purposes to\n   * easily identify the patch in a more meaningful way than a generic identifier\n   * or memory reference. It is initially set to `undefined` and can be updated\n   * to any string value as needed.\n   *\n   * @type {string|undefined}\n   */\n  ownerDisplayName = undefined\n\n  /**\n   * Constructs a new Patch instance. Supported options for Patch instances\n   * include either a global condition for the Patch to be applied or\n   * specific property conditions subjecting only a subset of the patches\n   * to conditional application.\n   *\n   * @example\n   * ```\n   * const custom = Symbol.for('nodejs.util.inspect.custom')\n   * const patch = new Patch(\n   *   Object,\n   *   {\n   *     property: 'value',\n   *     [custom](depth, options, inspect) {\n   *       // ... custom return string for nodejs\n   *     }\n   *   },\n   *   {\n   *     conditions: {\n   *       [custom]() { return process?.versions?.node !== null },\n   *     },\n   *   }\n   * )\n   * patch.apply() // applies `property` but only applies the `custom`\n   *               // property if the JavaScript is running in NodeJS\n   * ```\n   *\n   * @param {object} owner The object to which patches will be applied.\n   * @param {object} patches An object containing properties or methods to\n   *                         be patched onto the owner.\n   * @param {object} [options=Object.create(null)] Additional options for\n   * patching behavior.\n   */\n  constructor(owner, patches, options = Object.create(null)) {\n    Object.assign(this, {\n      owner,\n      options,\n    })\n\n    this.ownerDisplayName = options?.displayName ?? Patch.extractName(owner)\n    this.patchesOwner = Patch.constructWithStore(patches, this)\n    this.generatePatchEntries(this.patchesOwner)\n\n    if (!Patch.patches.has(owner)) {\n      Patch.patches.set(owner, [])\n    }\n\n    Patch.patches.get(owner).push(this)\n  }\n\n  /**\n   * Iterates over the properties of `patchesOwner` and attempts to generate\n   * patches based on the provided conditions and overrides. This method\n   * supports conditional patching, allowing patches to be applied only if\n   * certain conditions are met. It also handles descriptor overrides for\n   * patch symbols, enabling custom behavior for patched properties.\n   *\n   * @param {object} patchesOwner The object containing the patches to be\n   * applied. Each key in this object represents a property to be patched.\n   * @param {object} [overrides] Optional. An object containing descriptor\n   * overrides for the properties to be patched. If not provided, overrides\n   * will be determined based on patch symbols.\n   */\n  generatePatchEntries(patchesOwner, overrides = undefined) {\n    const globalCondition = this?.options.condition\n\n    Reflect.ownKeys(patchesOwner).forEach(key => {\n      const condition = this?.options?.conditions?.[key] ?? globalCondition\n\n      try {\n        const useOverrides = (\n          overrides ??\n          Patch.getDescriptorOverridesFromSymbol(key)\n        );\n        let useOwner = patchesOwner;\n\n        if (Patch.isKnownPatchSymbol(key)) {\n          useOwner = Patch.constructWithStore(patchesOwner[key], this, key)\n          patchesOwner[key] = useOwner\n          this.generatePatchEntries(useOwner, useOverrides);\n          return;\n        }\n\n        this.patchEntries[key] = new PatchEntry(\n          key, patchesOwner, condition, overrides\n        )\n        this.patchCount += 1\n      }\n      catch (error) {\n        console.error(`Failed to process patch for ${String(key)}\\n`, error)\n      }\n\n      if (Reflect.has(this.owner, key)) {\n        try {\n          this.patchConflicts[key] = new PatchEntry(key, this.owner)\n        }\n        catch (error) {\n          console.error(`Cannot capture conflicting patch key ${key}\\n`, error)\n        }\n      }\n    })\n  }\n\n  /**\n   * Retrieves the patch entries as an array of [key, patchEntry] pairs.\n   *\n   * @returns {Array} An array of [key, patchEntry] pairs.\n   */\n  get entries() {\n    return Reflect.ownKeys(this.patchEntries).map(key => {\n      return [key, this.patchEntries[key]]\n    })\n  }\n\n  /**\n   * Retrieves an array of patch entries that have been successfully applied.\n   * Each entry is a key-value pair array where the key is the patch identifier\n   * and the value is the corresponding `PatchEntry` object. Only patches with\n   * a state of `true` in `patchState` are included, indicating they are\n   * currently applied to the owner object.\n   *\n   * @returns {Array} An array of [key, patchEntry]\n   * pairs representing the applied patches.\n   */\n  get appliedEntries() {\n    return Reflect.\n      ownKeys(this.patchEntries).\n      filter(key => this.patchState.get(key) === true).\n      map(key => {\n        return [key, this.patchEntries[key]]\n      })\n  }\n\n  /**\n   * Retrieves an array of patch entries that have not been applied. Each entry\n   * is a key-value pair array where the key is the patch identifier and the\n   * value is the corresponding `PatchEntry` object. Only patches with a state\n   * of `false` in `patchState` are included, indicating they are not currently\n   * applied to the owner object.\n   *\n   * @returns {Array} An array of [key, patchEntry]\n   * pairs representing the unapplied patches.\n   */\n  get unappliedEntries() {\n    return Reflect.\n      ownKeys(this.patchEntries).\n      filter(key => this.patchState.get(key) === false).\n      map(key => {\n        return [key, this.patchEntries[key]]\n      })\n  }\n\n  /**\n   * Depending on how the PatchEntry is configured, accessing the patch\n   * by name can be somewhat irritating, so this provides an object with\n   * the actual current patch value at the time patchValues is requested.\n   *\n   * @example let { patch1, patch2 } = patch.patchValues\n   * @returns {object} an object with the patchName mapped to the current\n   * computed patchEntry value.\n   */\n  get patches() {\n    return this.entries.reduce((acc, [key, patchEntry]) => {\n      acc[key] = patchEntry.computed\n      return acc\n    }, Object.create(null))\n  }\n\n  /**\n   * Retrieves an object containing all patches that have been successfully\n   * applied. The object's keys are the patch keys, and the values are the\n   * computed values of the corresponding patch entries. Only patches with\n   * a state of `true` in `patchState` are considered applied.\n   *\n   * @returns {object} An object mapping each applied patch key to its\n   * computed value.\n   */\n  get appliedPatches() {\n    return this.entries.reduce((acc, [key, patchEntry]) => {\n      if (this.patchState.get(key) === true) {\n        acc[key] = patchEntry.computed\n      }\n      return acc\n    }, Object.create(null))\n  }\n\n  /**\n   * Retrieves an object containing all patches that have not been applied.\n   * The object's keys are the patch keys, and the values are the computed\n   * values of the corresponding patch entries. Only patches with a state\n   * of `false` in `patchState` are considered unapplied.\n   *\n   * @example\n   * // Assuming `patch` is an instance of `Patch` and `patch1` is unapplied:\n   * let unapplied = patch.unappliedPatches;\n   * console.log(unapplied); // { patch1: computedValueOfPatch1 }\n   *\n   * @returns {object} An object mapping each unapplied patch key to its\n   * computed value.\n   */\n  get unappliedPatches() {\n    return this.entries.reduce((acc, [key, patchEntry]) => {\n      if (this.patchState.get(key) === false) {\n        acc[key] = patchEntry.computed\n      }\n      return acc\n    }, Object.create(null))\n  }\n\n  /**\n   * Retrieves an array of patch keys.\n   *\n   * This getter returns an array containing only the keys of the patch entries,\n   * which can be useful for iterating over the patches or checking for the\n   * existence of specific patches by key.\n   *\n   * @returns {string[]} An array of patch keys.\n   */\n  get patchKeys() {\n    return this.entries.map(([key, _]) => key)\n  }\n\n  /**\n   * Generates a list of entries with enhanced string representations. This\n   * getter iterates over the `entries` property, transforming each [key, value]\n   * pair into a more informative string object. This is particularly useful\n   * for debugging or logging, as it provides a clear, readable format for\n   * each entry. The string representation includes the entry's key and value,\n   * with the key being converted to a string using its `Symbol.toStringTag`,\n   * `name` property, or a direct string conversion as fallback.\n   *\n   * Each value in the resultant array additionally has '.key', `.value`,\n   * `.entry` and `.entries` accessors. The `.key` is the `owner` object, the\n   * `.value` is the `PatchEntry` instance. The entry accessor provides the\n   * key and value in an array as one might expect to find the\n   * `Object.entries()` array and `.entries` is the same as `[stringRef.entry]`\n   * or `[[key, value]]`.\n   *\n   * @returns {Array} An array of string objects, each representing an entry\n   * from the `entries` property. Each string object is enhanced with additional\n   * properties and methods for improved usability and debugging.\n   */\n  get prettyEntries() {\n    const prettyEntries = this.entries.map(([key, value]) => Patch.stringRef(\n      Patch.extractName(key),\n      key,\n      value\n    ))\n\n    Object.defineProperty(prettyEntries, 'asEntries', {\n      get() { return this.map(pe => pe.entry) },\n      enumerable: false,\n      configurable: true,\n    })\n\n    return prettyEntries\n  }\n\n  /**\n   * Retrieves the conflict entries (existing properties on the owner that\n   * will be overridden by patches) as an array of [key, patchEntry] pairs.\n   *\n   * @returns {Array} An array of [key, patchEntry] pairs.\n   */\n  get conflicts() {\n    return Reflect.ownKeys(this.patchConflicts).map(key => {\n      return [key, this.patchConflicts[key]]\n    })\n  }\n\n  /**\n   * Checks to see if the tracked number of applied patches is greater than 0\n   *\n   * @returns {boolean} true if at least one patch has been applied\n   */\n  get applied() {\n    return this.patchesApplied > 0\n  }\n\n  /**\n   * Provided for semantics, but this method is synonymous with {@link applied}.\n   *\n   * @returns {boolean} true if at least one patch has been applied\n   */\n  get isPartiallyPatched() {\n    return this.applied\n  }\n\n  /**\n   * Returns true only when the number of tracked patches matches the number\n   * of applied patches.\n   *\n   * @returns {boolean} true if applied patches is equal to the count of patches\n   */\n  get isFullyPatched() {\n    return this.patchCount == this.patchesApplied\n  }\n\n  /**\n   * Applies all patches to the owner object. If a property with the same key\n   * already exists on the owner, it will be overridden. Optionally a callback\n   * can be supplied to the call to revert. If the callback is a valid function,\n   * it will be invoked with an object containing the results of the reversion\n   * of the patch. The callback receives a single parameter which is an object\n   * of counts. It has the signature:\n   *\n   * ```\n   * type counts = {\n   *   patches: number;\n   *   applied: number;\n   *   errors: Array<PatchEntry,Error>;\n   *   notApplied: number;\n   * }\n   * ```\n   *\n   * While the keys may be obvious to some, `patches` is the count of patches\n   * this instance tracks. `applied` is the number of patches that were applied\n   * 'errors' is an array of arrays where the first element is the `PatchEntry`\n   * and the second element is an `Error` indicating the problem. An error will\n   * only be generated if `isAllowed` is `true` and the patch still failed to\n   * apply Lastly `notApplied` is the number of patches that were unable to\n   * be applied.\n   *\n   * Additional logic that should track\n   * ```\n   *   \u2022 patches should === applied when done\n   *   \u2022 errors.length should be 0 when done\n   *   \u2022 notApplied should be 0 when done\n   * ```\n   *\n   * @param {function} metrics - a callback which receives a status of the\n   * `revert` action if supplied. This callback will not be invoked, nor will\n   * any of the other logic be captured, if {@link applied} returns false\n   */\n  apply(metrics) {\n    const entries = this.entries\n    const counts = {\n      patches: entries.length,\n      applied: 0,\n      errors: [],\n      notApplied: entries.length,\n    }\n\n    this.patchState.clear()\n\n    entries.forEach(([,patch]) => {\n      if (patch.isAllowed) {\n        // Patch\n        Object.defineProperty(this.owner, patch.key, patch.descriptor)\n\n        // Verify\n        let oDesc = Object.getOwnPropertyDescriptor(this.owner, patch.key)\n        if (this.#equalDescriptors(oDesc, patch.descriptor)) {\n          counts.applied += 1\n          counts.notApplied -= 1\n\n          this.patchState.set(patch, true)\n\n        }\n        else {\n          counts.errors.push([patch, new Error(\n            `Could not apply patch for key ${patch.key}`\n          )])\n          this.patchState.set(patch, false)\n        }\n      }\n      else {\n        this.patchState.set(patch, false)\n      }\n    })\n\n    this.patchesApplied = counts.applied\n\n    if (typeof metrics === 'function') {\n      metrics(counts)\n    }\n  }\n\n  /**\n   * Creates an easy to use toggle for working with `Patch` classes\n   *\n   * @param {boolean} preventRevert true if calling stop() on the toggle does not\n   * revert the patch. false, the default, if it should.\n   * @returns {PatchToggle} an instance of PatchToggle wrapped around this instance\n   * of `Patch`\n   * @example const toggle = ObjectExtensions.createToggle().start()\n   */\n  createToggle(preventRevert = false) {\n    return new PatchToggle(this, preventRevert)\n  }\n\n  /**\n   * Reverts all applied patches on the owner object, restoring any overridden\n   * properties to their original state. Optionally a callback can be supplied to\n   * the call to revert. If the callback is a valid function, it will be invoked\n   * with an object containing the results of the reversion of the patch. The\n   * callback receives a single parameter which is an object of counts. It has\n   * the signature:\n   *\n   * ```\n   * type counts = {\n   *   patches: number;\n   *   reverted: number;\n   *   restored: number;\n   *   conflicts: number;\n   *   errors: Array<PatchEntry,Error>;\n   *   stillApplied: number;\n   * }\n   * ```\n   *\n   * While the keys may be obvious to some, `patches` is the count of patches\n   * this instance tracks. `reverted` is the number of patches that were removed'\n   * `restored` is the number of originally conflicting keys that were restored.\n   * `conflicts` is the total number of conflicts expected. `errors` is an array of\n   * arrays where the first element is the `PatchEntry` and the second element\n   * is an `Error` indicating the problem. Lastly `stillApplied` is the number of\n   * patchesApplied still tracked. If this is greater than zero, you can assume\n   * something went wrong.\n   *\n   * Additional logic that should track\n   * ```\n   *   \u2022 patches should === reverted when done\n   *   \u2022 restored should === conflicts when done\n   *   \u2022 errors.length should be 0 when done\n   *   \u2022 stillApplied should be 0 when done\n   * ```\n   *\n   * @param {function} metrics - a callback which receives a status of the\n   * `revert` action if supplied. This callback will not be invoked, nor will\n   * any of the other logic be captured, if {@link applied} returns false\n   */\n  revert(metrics) {\n    if (!this.applied) {\n      return\n    }\n\n    const entries = this.entries\n    const conflicts = this.conflicts\n\n    const counts = {\n      patches: entries.length,\n      reverted: 0,\n      restored: 0,\n      conflicts: conflicts.length,\n      errors: [],\n      stillApplied: 0,\n    }\n\n    entries.forEach(([,patch]) => {\n      const successful = delete this.owner[patch.key]\n      if (successful) {\n        this.patchesApplied -= 1\n        counts.reverted += 1\n        this.patchState.set(patch, false)\n      }\n      else {\n        counts.errors.push([patch, new Error(\n          `Failed to revert patch ${patch.key}`\n        )])\n      }\n    })\n\n    conflicts.forEach(([,patch]) => {\n      Object.defineProperty(this.owner, patch.key, patch.descriptor)\n      const appliedDescriptor = Object.getOwnPropertyDescriptor(this.owner, patch.key)\n      if (this.#equalDescriptors(patch.descriptor, appliedDescriptor)) {\n        counts.restored += 1\n      }\n      else {\n        counts.errors.push([patch, new Error(\n          `Failed to restore original ${patch.key}`\n        )])\n      }\n    })\n\n    counts.stillApplied = this.patchesApplied\n    if (typeof metrics === 'function') {\n      metrics(counts)\n    }\n  }\n\n  /**\n   * Removes this Patch instance from being tracked amongst all the tracked Patch\n   * instances. The JavaScript virtual machine will clean this instance up once\n   * nothing else is holding a reference to it.\n   */\n  release() {\n    const patches = Patch.patches.get(this.owner)\n    patches.splice(patches.find(e => e === this), 1)\n  }\n\n  /**\n   * The object to which the patches are applied.\n   */\n  owner = null;\n\n  /**\n   * Additional options for patching behavior.\n   */\n  options = null;\n\n  /**\n   * Patches that are currently live and active will have true as their\n   * value and inert or non-applied patches will have false as their\n   * value. The key is always the associated {@link PatchEntry}.\n   */\n  patchState = new Map();\n\n  /**\n   * Creates an iterator for the patch entries, allowing the `Patch` instance to\n   * be directly iterable using a `for...of` loop. Each iteration will yield a\n   * `[key, patchEntry]` pair, where `key` is the property name and `patchEntry`\n   * is the corresponding `PatchEntry` instance.\n   *\n   * @returns {Iterator} An iterator that yields `[key, patchEntry]` pairs.\n   */\n  [Symbol.iterator]() {\n    return this.entries.values()\n  }\n\n  /**\n   * Compares two property descriptor objects to determine if they are equivalent.\n   *\n   * This method checks if both descriptors have the same value for the\n   * `configurable`, `enumerable`, `value`, `writable`, `get`, and `set`\n   * properties. If any of these properties differ between the two descriptors,\n   * the descriptors are considered not equivalent.\n   *\n   * @param {PropertyDescriptor} left - The first descriptor to compare.\n   * @param {PropertyDescriptor} right - The second descriptor to compare.\n   * @returns {boolean} - True if the descriptors are equivalent, false otherwise.\n   * @private\n   */\n  #equalDescriptors(left, right) {\n    if (!left || !right) {\n      return false;\n    }\n\n    return (\n      left.configurable === right.configurable &&\n      left.enumerable === right.enumerable &&\n      left.value === right.value &&\n      left.writable === right.writable &&\n      left.get === right.get &&\n      left.set === right.set\n    )\n  }\n\n  /**\n   * Custom inspection function for Node.js that is called when `util.inspect`\n   * is used to convert the instance to a string. This allows for customizing\n   * the output of `util.inspect` for objects of this class.\n   *\n   * @param {number} depth The current depth of the inspection. If the depth\n   * is less than the recurse times set, it will return the object itself,\n   * otherwise it will return the inspected result.\n   * @param {object} options An object containing options for the inspection.\n   * @param {function} inspect The inspection function provided by Node.js\n   * that can be called to inspect other properties with the same options as\n   * the original call.\n   * @returns {string} A string representation of the instance tailored for\n   * Node.js' `util.inspect`.\n   */\n  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n    const type = this.ownerDisplayName ?? ''\n    const name = (type.length\n      ? `[\\x1b[32m${type}\\x1b[39m]`\n      : ''\n    )\n    const keys = (this.prettyEntries\n      .map(entry => {\n        return `\\x1b[2;33m${entry}\\x1b[22;39m`\n      })\n      .join(', ')\n    )\n\n    return `${this.constructor.name}${name} { ${keys} }`;\n  }\n\n  /**\n   * A global mapping of all patches in play\n   */\n  static patches = new Map()\n\n  /**\n   * Applies all patches associated with a given owner object. This method\n   * is used to enable all patches for a specific owner if they have been\n   * previously registered.\n   *\n   * @param {object} owner The object whose patches are to be applied.\n   */\n  static enableFor(owner) {\n    if (Patch.patches.has(owner)) {\n      for (const patch of Patch.patches.get(owner)) {\n        patch.apply()\n      }\n    }\n  }\n\n  /**\n   * Enables patches for all static members registered in the system. This\n   * method iterates over all registered owners, identifying those represented\n   * by functions (typically static members or classes) and enables patches\n   * specifically for them. It's particularly useful for activating patches\n   * that are meant to modify or enhance static properties or methods of\n   * classes.\n   */\n  static enableProbableStatics() {\n    for (const owner of Patch.patches.keys()) {\n      if (typeof owner !== 'function') {\n        continue;\n      }\n\n      Patch.enableFor(owner);\n    }\n  }\n\n  /**\n   * Iterates over all registered owners and enables patches for those\n   * identified as instance entities (non-functions). This method is\n   * particularly useful for activating patches on instance-level properties\n   * or methods of classes, without affecting static-level patches. It ensures\n   * that only owners not represented by functions, typically instance members,\n   * are targeted for patch enabling.\n   */\n  static enableProbableInstances() {\n    for (const owner of Patch.patches.keys()) {\n      if (typeof owner === 'function') {\n        continue;\n      }\n\n      Patch.enableFor(owner);\n    }\n  }\n\n  /**\n   * Enables all patches for every owner currently registered in the system.\n   * This static method iterates over all owners that have patches registered\n   * and applies those patches by invoking `enableFor` on each owner. This\n   * method is particularly useful when a global application of all patches\n   * is required, without the need to manually enable them for each owner\n   * individually.\n   */\n  static enableAll() {\n    for (const owner of Patch.patches.keys()) {\n      Patch.enableFor(owner);\n    }\n  }\n\n  /**\n   * Reverts all patches associated with a given owner object. This method\n   * is used to disable all patches for a specific owner if they have been\n   * previously applied.\n   *\n   * @param {object} owner The object whose patches are to be reverted.\n   */\n  static disableFor(owner) {\n    if (Patch.patches.has(owner)) {\n      for (const patch of Patch.patches.get(owner)) {\n        patch.revert()\n      }\n    }\n  }\n\n  /**\n   * Disables all patches for every owner currently registered in the system.\n   * This method iterates over all owners that have patches registered and\n   * reverts those patches by invoking `disableFor` on each owner. It is\n   * particularly useful when a global reversion of all patches is required,\n   * without the need to manually disable them for each owner individually.\n   */\n  static disableAll() {\n    for (const owner of Patch.patches.keys()) {\n      Patch.disableFor(owner);\n    }\n  }\n\n  /**\n   * Iterates over all registered owners and disables patches for those\n   * identified as static entities (functions). This method is particularly\n   * useful for reverting patches to static methods or properties of classes,\n   * without affecting instance-level patches. It ensures that only owners\n   * represented by functions, typically static members, are targeted for\n   * patch disabling.\n   */\n  static disableProbableStatics() {\n    for (const owner of Patch.patches.keys()) {\n      if (typeof owner !== 'function') {\n        continue;\n      }\n\n      Patch.disableFor(owner);\n    }\n  }\n\n  /**\n   * Iterates over all registered owners and disables patches for those\n   * not identified as static entities (functions). This method is\n   * particularly useful for reverting patches applied to instance-level\n   * properties or methods, ensuring that patches on static members remain\n   * unaffected. It targets only owners not represented by functions,\n   * typically instance members, for patch disabling.\n   */\n  static disableProbableInstances() {\n    for (const owner of Patch.patches.keys()) {\n      if (typeof owner === 'function') {\n        continue;\n      }\n\n      Patch.disableFor(owner);\n    }\n  }\n\n\n  /**\n   * A static getter that provides a proxy to manage and interact with the\n   * patches that have been applied globally. This proxy abstracts the\n   * underlying details and presents a simplified interface for querying and\n   * manipulating applied patches. It is particularly useful in IDEs, as it\n   * allows developers to access the state of applied patches without needing\n   * to delve into the source code.\n   *\n   * @returns {Object} An object showing all the keys known to be patched for\n   * the default owner, `globalThis`\n   */\n  static get applied() {\n    return this.#allPatchesForOwner(globalThis, true)\n  }\n\n  /**\n   * A static getter that provides access to a proxy representing all known\n   * patches, whether applied or not. This is useful for inspecting the\n   * complete set of patches that have been registered in the system, without\n   * limiting the view to only those that are currently active. The proxy\n   * abstracts the underlying details and presents a simplified interface for\n   * querying and manipulating the patches.\n   *\n   * @returns {Proxy} A proxy object that represents a virtual view of all\n   * registered patches, allowing for operations like checking if a patch is\n   * known and retrieving patch values.\n   */\n  static get known() {\n    return this.#allPatchesForOwner(globalThis, false)\n  }\n\n  /**\n   * A static getter that provides access to a proxy for managing patch\n   * entries with a toggle functionality. This proxy allows the temporary\n   * application of patches within a certain scope, and automatically reverts\n   * them after the scope ends. It is useful for applying patches in a\n   * controlled manner, ensuring that they do not remain active beyond the\n   * intended usage.\n   *\n   * @returns {Proxy} A proxy object that represents a virtual view of the\n   * patches with toggle functionality, allowing for temporary application\n   * and automatic reversion of patches.\n   */\n  static get use() {\n    return this.#allPatchesForOwner(globalThis, false, true)\n  }\n\n  /**\n   * A static getter that provides access to a proxy for managing patch\n   * entries with lazy initialization. This proxy defers the creation and\n   * application of patches until they are explicitly requested. It is\n   * beneficial for performance optimization, as it avoids the overhead of\n   * initializing patches that may not be used.\n   *\n   * @returns {Proxy} A proxy object that represents a virtual view of the\n   * patches with lazy initialization, allowing patches to be created and\n   * applied only when needed.\n   */\n  static get lazy() {\n    return this.#allPatchesForOwner(globalThis, false, false, true)\n  }\n\n  /**\n   * Returns an object with getters to access different proxy views of patches\n   * scoped to a specific owner. This allows for interaction with patches\n   * that are either applied, known, or used within a certain scope, providing\n   * a controlled environment for patch management.\n   *\n   * @param {object} owner - The object to scope the patch proxies to.\n   * @returns {object} An object containing getters for `applied`, `known`,\n   * and `use` proxies:\n   * - `applied`: Proxy for patches applied to the owner.\n   * - `known`: Proxy for all patches known to the owner, applied or not.\n   * - `use`: Proxy that allows temporary application of patches.\n   */\n  static scopedTo(owner) {\n    const allForOwner = (\n      owner,\n      appliedOnly,\n      wrapInToggle = false,\n      applyOnRequest = false\n    ) => {\n      return this.#allPatchesForOwner(\n        owner,\n        appliedOnly,\n        wrapInToggle,\n        applyOnRequest\n      )\n    }\n\n    return {\n      /**\n       * Getter for a proxy that represents patches applied to the owner.\n       * This proxy provides a simplified interface for interacting with\n       * applied patches, such as checking their status or retrieving values.\n       *\n       * @returns {Proxy} A proxy to the applied patches.\n       */\n      get applied() {\n        return allForOwner(owner, true, false)\n      },\n\n      /**\n       * Getter for a proxy that represents all patches known to the owner,\n       * whether they are applied or not. This proxy allows for querying\n       * and manipulation of the patches without directly accessing them.\n       *\n       * @returns {Proxy} A proxy to all known patches.\n       */\n      get known() {\n        return allForOwner(owner, false, false)\n      },\n\n      /**\n       * Getter for a proxy that enables temporary application of patches\n       * within a certain scope. The patches are automatically reverted\n       * after the scope ends, ensuring controlled usage.\n       *\n       * @returns {Proxy} A proxy to patches with toggle functionality.\n       */\n      get use() {\n        return allForOwner(owner, false, true)\n      },\n\n      /**\n       * Getter for a proxy that represents patches that are not immediately\n       * applied but are applied on request. This allows for patches to be\n       * applied only when they are explicitly needed, potentially improving\n       * performance by deferring the application of patches until necessary.\n       *\n       * @returns {Proxy} A proxy to patches that are applied on request.\n       */\n      get lazy() {\n        return allForOwner(owner, false, false, true)\n      },\n    }\n  }\n\n  /**\n   * Aggregates patches for a given owner into a single object, optionally\n   * filtering by applied status and wrapping in a toggle function.\n   *\n   * This method collects all patches associated with the specified owner\n   * and constructs an object where each patch is represented by its key.\n   * If `onlyApplied` is true, only patches that are currently applied will\n   * be included. If `wrapInToggle` is true, each patch will be represented\n   * as a function that temporarily applies the patch when called.\n   *\n   * @param {object} owner - The owner object whose patches are to be\n   * aggregated.\n   * @param {boolean} onlyApplied - If true, only include patches that\n   * are applied.\n   * @param {boolean} [wrapInToggle=false] - If true, wrap patches in a\n   * toggle function for temporary application.\n   * @returns {object} An object representing the aggregated patches, with\n   * each patch keyed by its property name.\n   * @private\n   */\n  static #allPatchesForOwner(\n    owner,\n    onlyApplied,\n    wrapInToggle = false,\n    applyOnRequest = false\n  ) {\n    return [...Patch.patches.values()].\n      flat().\n      filter(patch => patch.owner === owner).\n      reduce((accumulator, patch) => {\n        for (const [,patchEntry] of patch.entries) {\n          if (onlyApplied && patch.patchState.get(patchEntry) !== true) {\n            continue\n          }\n\n          if (wrapInToggle) {\n            accumulator[patchEntry.key] = async (usage) => {\n              if (typeof usage !== 'function') {\n                return\n              }\n\n              const type = Object.prototype.toString.call(usage)\n              const toggle = patch.createToggle()\n\n              toggle.start()\n              if('[object AsyncFunction]' === type) {\n                await usage(patchEntry.computed, patchEntry)\n              }\n              else {\n                usage(patchEntry.computed, patchEntry)\n              }\n              toggle.stop()\n            }\n\n            continue\n          }\n\n          if (applyOnRequest) {\n            Object.defineProperty(accumulator, patchEntry.key, {\n              get() {\n                patch.apply()\n                return patchEntry.computed\n              },\n              enumerable: true,\n              configurable: true,\n            });\n\n            continue;\n          }\n\n\n          if (patchEntry.isAccessor) {\n            let dynName = `applyAccessorFor_${String(patchEntry.key)}`\n            let dynNameContainer = {\n              [dynName](applyTo) {\n                patchEntry.applyTo(applyTo)\n                return applyTo\n              }\n            };\n\n            accumulator[patchEntry.key] = dynNameContainer[dynName]\n          }\n          else {\n            patchEntry.applyTo(accumulator)\n          }\n        }\n\n        return accumulator\n      }, Object.create(null))\n  }\n\n  /**\n   * A getter for the custom inspect symbol used by Node.js.\n   *\n   * @returns {symbol} The custom inspect symbol.\n   */\n  static get CustomInspect() {\n    return Symbol.for('nodejs.util.inspect.custom')\n  }\n\n  /**\n   * Strips leading and trailing control characters, brackets, braces, and\n   * quotes from a string. This is typically used to clean strings that may\n   * have special characters or escape sequences that are not desired in the\n   * output.\n   *\n   * @param {string} fromString The string to be stripped of extras.\n   * @returns {string} The cleaned string with extras stripped.\n   */\n  static stripExtras(fromString) {\n    return fromString\n      .replaceAll(\n        /^(\\x1B\\[\\d+m)?[\\[\\{]\\s?|\\s?[\\]\\}](\\x1B\\[\\d+m)?$/gm,\n        '$1$2'\n      )\n      .replaceAll(\n        /['\"](.*?)['\"]/gm,\n        '$1'\n      )\n  }\n\n  /**\n   * Accessor for a Symbol uniquely representing properties that are\n   * non-enumerable but configurable. This symbol can be used to tag\n   * properties with these characteristics in a consistent manner across\n   * different parts of the application.\n   *\n   * @returns {symbol} A Symbol for properties that are non-enumerable\n   * but configurable.\n   */\n  static get kMutablyHidden() {\n    return Symbol.for('{\"enumerable\":false,\"configurable\":true}')\n  }\n\n  /**\n   * Applies a custom descriptor patch to an instance, marking properties as\n   * non-enumerable but configurable. This method utilizes the `kMutablyHidden`\n   * symbol to tag properties accordingly. It's useful for hiding properties\n   * in a way that they remain configurable for future changes.\n   *\n   * @param {object} instance The object instance to apply the patch to.\n   * @param {object} [store=Object.create(null)] An optional store object to\n   * hold patched properties' original values and descriptors.\n   * @returns {object} The result of applying the custom descriptor patch,\n   * typically a modified version of the `store` object containing the patched\n   * properties' descriptors.\n   */\n  static mutablyHidden(instance, store = Object.create(null)) {\n    return this.customDescriptorPatch(instance, this.kMutablyHidden, store);\n  }\n\n  /**\n   * Accessor for a Symbol uniquely representing properties that are both\n   * enumerable and configurable. This symbol can be used to tag properties\n   * with these characteristics in a consistent manner across different parts\n   * of the application. The symbol is created or retrieved based on a\n   * standardized JSON string, ensuring consistency in its representation.\n   *\n   * @returns {symbol} A Symbol for properties that are both enumerable and\n   * configurable, allowing them to be listed in object property enumerations\n   * and reconfigured or deleted.\n   */\n  static get kMutablyVisible() {\n    return Symbol.for('{\"enumerable\":true,\"configurable\":true}')\n  }\n\n  /**\n   * Applies a custom descriptor patch to an instance, marking properties as\n   * both enumerable and configurable. This method leverages the `kMutablyVisible`\n   * symbol to tag properties, making them visible in enumerations and allowing\n   * them to be reconfigured or deleted. This is particularly useful for\n   * properties that need to be exposed for iteration or manipulation while\n   * maintaining the ability to modify their descriptors in the future.\n   *\n   * @param {object} instance The object instance to apply the patch to.\n   * @param {object} [store=Object.create(null)] An optional store object to\n   * hold patched properties' original values and descriptors. If not provided,\n   * a new object will be used to store this information.\n   * @returns {object} The result of applying the custom descriptor patch,\n   * typically a modified version of the `store` object containing the patched\n   * properties' descriptors.\n   */\n  static mutablyVisible(instance, store = Object.create(null)) {\n    return this.customDescriptorPatch(instance, this.kMutablyVisible, store)\n  }\n\n  /**\n   * Accessor for a Symbol uniquely identifying properties that are neither\n   * enumerable nor configurable. This symbol is used to tag properties to\n   * ensure they are hidden from enumeration and cannot be reconfigured or\n   * deleted, providing a level of immutability. The symbol is generated or\n   * retrieved based on a standardized JSON string, ensuring consistency\n   * across different parts of the application.\n   *\n   * @returns {symbol} A Symbol for properties that are neither enumerable\n   * nor configurable, effectively making them immutable and hidden from\n   * property enumerations.\n   */\n  static get kImmutablyHidden() {\n    return Symbol.for('{\"enumerable\":false,\"configurable\":false}')\n  }\n\n  /**\n   * Applies a descriptor patch to an object instance, marking properties as\n   * neither enumerable nor configurable. This method uses the `kImmutablyHidden`\n   * symbol to tag properties, ensuring they remain hidden from enumerations\n   * and cannot be reconfigured or deleted. This enhances property immutability\n   * and privacy within an object. It's particularly useful for securing\n   * properties that should not be exposed or altered.\n   *\n   * @param {object} instance The object instance to apply the patch to.\n   * @param {object} [store=Object.create(null)] An optional store object to\n   * hold patched properties' original values and descriptors. If not provided,\n   * a new object will be used to store this information.\n   * @returns {object} The result of applying the descriptor patch, typically\n   * a modified version of the `store` object containing the patched properties'\n   * descriptors.\n   */\n  static immutablyHidden(instance, store = Object.create(null)) {\n    return this.customDescriptorPatch(instance, this.kImmutablyHidden, store)\n  }\n\n  /**\n   * Accessor for a Symbol uniquely identifying properties that are visible\n   * (enumerable) but not configurable. This symbol is used to tag properties\n   * to ensure they are included in enumerations such as loops and object\n   * keys retrievals, yet cannot be reconfigured or deleted. This provides a\n   * balance between visibility and immutability. The symbol is generated or\n   * retrieved based on a standardized JSON string, ensuring consistency\n   * across different parts of the application.\n   *\n   * @returns {symbol} A Symbol for properties that are enumerable but not\n   * configurable, making them visible in enumerations while preventing\n   * modifications to their descriptors.\n   */\n  static get kImmutablyVisible() {\n    return Symbol.for('{\"enumerable\":true,\"configurable\":false}')\n  }\n\n  /**\n   * Applies a descriptor patch to an object instance, marking properties as\n   * enumerable but not configurable. This method leverages the\n   * `kImmutablyVisible` symbol to tag properties, ensuring they are visible\n   * in property enumerations like loops and `Object.keys` retrievals, yet\n   * remain immutable by preventing reconfiguration or deletion. This method\n   * is particularly useful for making properties visible while maintaining\n   * their immutability and preventing modifications.\n   *\n   * @param {object} instance The object instance to apply the patch to.\n   * @param {object} [store=Object.create(null)] An optional store object to\n   * hold patched\n   * properties' original values and descriptors. If not provided, a new\n   * object will be used to store this information.\n   * @returns {object} The result of applying the descriptor patch, typically\n   * a modified version of the `store` object containing the patched properties'\n   * descriptors.\n   */\n  static immutablyVisible(instance, store = Object.create(null)) {\n    return this.customDescriptorPatch(instance, this.kImmutablyVisible, store)\n  }\n\n  /**\n   * Applies a custom descriptor patch to an object instance using a provided\n   * symbol to tag the patched properties. This method also ensures the instance\n   * is tracked for cleanup and stores the patch information in a WeakMap for\n   * future reference or rollback. It's designed to work with property\n   * descriptors that are either hidden or visible but immutable.\n   *\n   * @param {symbol} symbol The symbol used to tag the patched properties,\n   * indicating the nature of the patch (e.g., hidden or visible but immutable).\n   * @param {object} instance The object instance to which the patch is applied.\n   * @param {object} [store=Object.create(null)] An optional object to store\n   * the original property descriptors before the patch is applied. If not\n   * provided, an empty object will be used.\n   * @returns {object} The store object associated with the instance in the\n   * WeakMap, containing the patched properties' descriptors.\n   */\n  static customDescriptorPatch(instance, symbol, store = Object.create(null)) {\n    if (!this.stores.has(instance)) {\n      this.stores.set(instance, store);\n\n      if (Patch.isKnownPatchSymbol(symbol)) {\n        store[symbol] = Object.create(null);\n        return this.stores.get(instance)[symbol];\n      }\n    }\n\n    return this.stores.get(instance);\n  }\n\n  /**\n   * Determines if a given symbol is recognized as a patch symbol within the\n   * system. Patch symbols are predefined symbols used to tag properties with\n   * specific visibility and mutability characteristics. This method checks\n   * if the provided symbol matches any of the known patch symbols.\n   *\n   * @param {symbol} maybeSymbol The symbol to check against known patch symbols.\n   * @returns {boolean} True if the symbol is a known patch symbol, false otherwise.\n   */\n  static isKnownPatchSymbol(maybeSymbol) {\n    if (typeof maybeSymbol === 'symbol') {\n      return [\n        this.kImmutablyHidden,\n        this.kImmutablyVisible,\n        this.kMutablyHidden,\n        this.kMutablyVisible\n      ].some(symbol => symbol === maybeSymbol)\n    }\n\n    return false\n  }\n\n  /**\n   * Constructs an object or executes a function based on the `patchesOwner`\n   * parameter, utilizing a custom descriptor patch. This method is intended\n   * for advanced manipulation of object properties or function behaviors\n   * through patching mechanisms defined by symbols. It applies a custom\n   * descriptor patch to the `instance` using the provided `symbol` and\n   * `store`, then either returns the `patchesOwner` directly if it's not a\n   * function, or invokes it with the patched store.\n   *\n   * @param {Function|Object} patchesOwner The target function to be invoked\n   * or the object to be returned directly. If a function, it is called with\n   * the patched store.\n   * @param {Object} instance The object instance to which the patch is applied.\n   * @param {Symbol} symbol A symbol indicating the nature of the patch to be\n   * applied, typically representing specific property behaviors.\n   * @param {Object} [store=Object.create(null)] An optional object to store\n   * the original property descriptors before the patch is applied. Defaults\n   * to an empty object if not provided.\n   * @returns {Function|Object} The result of calling `patchesOwner` with the\n   * patched store if `patchesOwner` is a function, or `patchesOwner` itself\n   * if it is not a function.\n   */\n  static constructWithStore(\n    patchesOwner,\n    instance,\n    symbol,\n    store = Object.create(null)\n  ) {\n    if (typeof patchesOwner !== 'function') {\n      return patchesOwner;\n    }\n\n    try {\n      const useStore = Patch.customDescriptorPatch(instance, symbol, store);\n      return patchesOwner(useStore);\n    }\n    catch (ignored) {\n      console.error(ignored);\n      return patchesOwner;\n    }\n  }\n\n  /**\n   * Retrieves descriptor overrides from a symbol if it is recognized as a\n   * known patch symbol. This method is crucial for dynamically adjusting\n   * property descriptors based on predefined symbols, facilitating the\n   * application of specific property behaviors (e.g., visibility, mutability)\n   * without direct manipulation of the descriptors. It parses the symbol's\n   * description, which is expected to be a JSON string representing the\n   * descriptor overrides, and returns these overrides as an object.\n   *\n   * @param {symbol} symbol The symbol whose description contains JSON\n   * stringified descriptor overrides.\n   * @returns {object} An object representing the descriptor overrides if the\n   * symbol is recognized; otherwise, an empty object.\n   */\n  static getDescriptorOverridesFromSymbol(symbol) {\n    let overrides = Object.create(null)\n\n    if (this.isKnownPatchSymbol(symbol)) {\n      overrides = JSON.parse(symbol.description)\n    }\n\n    return overrides;\n  }\n\n  /**\n   * A WeakMap to store patch information for object instances. This map\n   * associates each patched object instance with its corresponding store\n   * object, which contains the original property descriptors before the\n   * patch was applied. The use of a WeakMap ensures that the memory used\n   * to store this information can be reclaimed once the object instances\n   * are no longer in use, preventing memory leaks.\n   */\n  static stores = new WeakMap();\n\n  /**\n   * Creates and returns an object that wraps a string with additional\n   * properties and methods, making it more informative and useful for\n   * debugging purposes. This method enhances a string by associating it\n   * with a key-value pair and providing custom inspection functionality\n   * for Node.js environments.\n   *\n   * @param {string} string The base string to be wrapped and enhanced.\n   * @param {string} key The key associated with the string, accessible via the\n   * `key` property of the returned object.\n   * @param {any} value The value associated with the key, accessible via the\n   * `value` property of the returned object.\n   * @returns {object} An object that wraps the original string and includes\n   * additional properties (`key`, `value`, `entry`, `entries`) and methods\n   * (`valueOf`, custom inspection method for Node.js) for enhanced usability\n   * and debugging.\n   */\n  static stringRef(string, key, value) {\n    const stringObj = Object.assign(Object(string), {\n      get key() { return key },\n      get value() { return value },\n      get entry() { return [key, value] },\n      get entries() { return [this.entry] },\n      valueOf() { return String(this) },\n      [Symbol.toStringTag]: 'String',\n      [Symbol.for('nodejs.util.inspect.custom')](_, __, inspect) {\n        return inspect(String(this), { colors: true })\n      }\n    });\n\n    return stringObj\n  }\n\n  /**\n   * Checks if all own property names of an instance are also present as own\n   * property names in a given prototype or the instance's constructor\n   * prototype. This method is useful for determining if an instance shares\n   * all its own property names with a prototype, which can be helpful in\n   * various forms of type or structure validation.\n   *\n   * @param {object} instance The object instance whose own property names are\n   * to be checked.\n   * @param {object} [prototype] The prototype object to compare against. If not\n   * provided, the method uses the instance's constructor prototype.\n   * @returns {boolean} Returns true if all own property names of the instance\n   * are also own property names in the given prototype or the instance's\n   * constructor prototype. Otherwise, returns false.\n   */\n  static shareOwnPropertyNames(instance, prototype) {\n    const ownPropNames = o => Object.getOwnPropertyNames(Object(o))\n\n    return ownPropNames(instance).every(key =>\n      ownPropNames(prototype ?? instance?.constructor?.prototype).\n      some(innerKey => innerKey == key)\n    )\n  }\n\n\n  /**\n   * Extracts a descriptive name for a given object or function. This method\n   * attempts to identify the most appropriate name based on the object's\n   * characteristics or its constructor's name. If no specific name can be\n   * determined, it falls back to a provided default name or generates a\n   * unique identifier.\n   *\n   * The method first checks if the object is a non-function or an exception\n   * like `Function.prototype`, and if it shares all the same own property\n   * names as its constructor's prototype, it returns the constructor's name\n   * with `.prototype` appended. If this check fails, it looks for a\n   * `Symbol.toStringTag` property, then for a function's `name` property,\n   * and then evaluates `defaultName` if it's a function or uses its string\n   * value. If all these checks fail, it looks for known exceptions like\n   * `Reflect` or generates a random string prefixed with `Unknown.`.\n   *\n   * @param {object|function} object The object or function to extract the name\n   * from.\n   * @param {string|function} defaultName A default name or a function that\n   * returns a default name to use if no specific name can be determined.\n   * @returns {string} The extracted name or the default/fallback name.\n   */\n  static extractName(object, defaultName) {\n    // Short-hand helper for Array.some(k => k === value)\n    const oneOf = (a,type) => a.some(value => value === type)\n\n    // Initially set valueOf to undefined\n    let valueOf = undefined\n\n    // Skipping known exceptions, check to see if the valueOf() exists\n    if (!oneOf([Symbol.prototype, Date.prototype, BigInt.prototype], object)) {\n      valueOf = object?.valueOf?.()\n    }\n\n    // Check to see if the result from valueOf() is a String\n    let valueOfAsString = (\n      (valueOf && (valueOf instanceof String || typeof valueOf === 'string'))\n        ? String(valueOf)\n        : undefined\n    )\n\n    return (\n      // If its a symbol, use its String() value\n      (typeof object === 'symbol' ? String(object) : undefined) ??\n      (typeof object === 'string' ? object : undefined) ??\n      (object instanceof String ? String(object) : undefined)\n    ) || (\n      // If we have a non-function (Function.prototype is the exception)\n      // and we do have a constructor property, we share all the same\n      // ownPropertyNames as the constructor's prototype (string instances\n      // do not have the same props for example) then we can probably\n      // assume we have a class/function prototype so return its name plus\n      // .prototype\n      (\n        (object === Function.prototype || typeof object !== 'function') &&\n        typeof object !== 'symbol'\n      ) &&\n      Patch.shareOwnPropertyNames(object) &&\n      object?.constructor?.name &&\n      `${object.constructor.name}.prototype`\n    ) || (\n      // Look for a Symbol.toStringTag first as this denotes a specified name\n      object?.[Symbol.toStringTag] ??\n\n      // Look for a function instance .name property next\n      object?.name ??\n\n      // Look for object.valueOf() and see if its a string\n      valueOfAsString ??\n\n      // If defaultName is a function, use its return value\n      (typeof defaultName === 'function' ? defaultName(object) : undefined) ??\n\n      // If defaultName is a string, use its value\n      (typeof defaultName === 'string' ? defaultName : undefined) ??\n\n      // Check for rare exceptions like Reflect (add more here as found)\n      Object.entries({\n        Reflect\n      }).find(([k,v]) => v === object)?.[0] ??\n\n      // Finally generate an Unknown.{randomString} value if nothing else works\n      `Unknown.${Math.random().toString(36).slice(2)}`\n    )\n  }\n}\n\n/**\n * Custom inspection function for Node.js `util.inspect` that formats the\n * entries of the Patch.patches Map for improved readability in console output.\n * This function is specifically designed to be used as a custom inspection\n * function within Node.js environments, enhancing the debugging experience\n * by providing a clear, formatted view of the Patch.patches Map's entries.\n *\n * @param {number} depth The depth to which the object should be formatted.\n * @param {object} options Formatting options provided by `util.inspect`.\n * @param {function} inspect The inspection function provided by Node.js\n * `util.inspect`, allowing for custom formatting of nested properties.\n * @returns {string} A formatted string representation of the Patch.patches\n * Map's entries, with each key-value pair on a new line and keys highlighted\n * for easy identification.\n */\nPatch.patches[Symbol.for('nodejs.util.inspect.custom')] = function(\n  depth,\n  options,\n  inspect\n) {\n  let parts = [\n    'Patches [',\n    ([...this.entries()]\n      .map(([key, value]) => {\n        const patches = (value\n          .map(patch => `${' '.repeat(2)}${inspect(patch, options)}`)\n          .toSorted()\n          .join('\\n')\n        )\n\n        return (\n          `\\x1b[22;1m${Patch.extractName(key)}\\x1b[22m =>\\n` +\n          `${patches}\\n`\n        );\n      })\n      .toSorted()\n      .join('\\n')\n    ),\n    ']'\n  ];\n\n  if (parts[1].includes('\\n')) {\n    // Indent each line of the body by two spaces\n    parts[1] = (parts[1]\n      .split('\\n')\n      .map(line => `${' '.repeat(2)}${line}`)\n      .join('\\n')\n    );\n\n    // Join the output with new lines surrounding the body\n    let output = parts.join('\\n');\n    return output.replace(/\\n\\s*\\n]$/m, '\\n]');\n  }\n\n  if (!parts[1]) {\n    parts[1] = '\\x1b[2;3mNo patches or extensions yet\\x1b[22;23m'\n  }\n\n  return parts.join('');\n}", "import { CannotBeExtendedError } from \"./errors/CannotBeExtendedError.js\"\nimport { MissingOwnerValue } from './errors/MissingOwnerValue.js'\nimport { Patch } from './patch.js'\n\n/** Shared array of primitive types for use with `isPrimitive` */\nconst primitives = ['number', 'boolean', 'bigint', 'string', 'symbol']\n\n/**\n * The Extension class, inheriting from the Patch class, is specifically designed\n * for extending properties or methods of a given object. It facilitates the\n * extension process by determining the target key and value for the extension and\n * ensuring the target property is writable and configurable. If these conditions\n * are not met, the class throws a CannotBeExtendedError. This class is useful\n * in scenarios like testing, dynamic behavior adjustments, or managing complex\n * object configurations.\n */\nexport class Extension extends Patch {\n  /**\n   * Constructs a new Extension instance. This constructor initializes the extension\n   * by determining the target key and value for the extension and ensuring that\n   * the property to be extended is configurable and writable. It throws an error\n   * if these conditions are not satisfied. The constructor leverages the Patch\n   * class's functionalities to manage the extension effectively.\n   *\n   * @param {Function|string} keyClassOrFn - The key, class, or function to be\n   * used for the extension. If a function or class is provided, its name is used\n   * as the key.\n   * @param {*} value - The value or method to be used for the extension.\n   * @param {object} [owner=globalThis] - The object to which the extension will\n   * be applied.\n   * @param {object} [options={}] - Additional options for the extension behavior.\n   * @throws {CannotBeExtendedError} If the target property is not writable or\n   * configurable.\n   * @throws {MissingOwnerValue} If the `keyClassOrFn` value is null or there\n   * is an error determining the key and extension values, MissingOwnerValue is\n   * thrown.\n   */\n  constructor(keyClassOrFn, value, owner = globalThis, options = {}) {\n    const metadata = Extension.determineInput(keyClassOrFn)\n    let { key, extension, valid } = metadata\n    extension = value || extension\n\n    if (!valid) {\n      throw new MissingOwnerValue(owner, key)\n    }\n\n    const descriptor = Object.getOwnPropertyDescriptor(owner, key)\n    if (descriptor) {\n      if (\n        (Reflect.has(descriptor, 'writable') && !descriptor.writable) ||\n        (Reflect.has(descriptor, 'configurable') && !descriptor.configurable)\n      ) {\n        throw new CannotBeExtendedError(owner, key)\n      }\n    }\n\n    super(owner, { [key]: extension }, options)\n    this.key = key\n\n    this.class = metadata.class\n    this.function = metadata.function\n  }\n\n  /**\n   * Returns true if this `Extension` represents a `function`\n   *\n   * @returns {boolean} `true` if this `Extension` introduces a `function`, or\n   * `false` if it does not\n   */\n  get isFunction() { return !!(this.function) }\n\n  /**\n   * Returns true if this `Extension` represents a `class`\n   *\n   * @returns {boolean} `true` if this `Extension` introduces a `class`, or\n   * `false` if it does not\n   */\n  get isClass() { return !!(this.class) }\n\n  /**\n   * Returns true if this `Extension` represents a `primitive`\n   *\n   * @returns {boolean} `true` if this `Extension` introduces a\n   * primitive value or `false` if it does not.\n   */\n  get isPrimitive() {\n    return ~primitives.indexOf(typeof this.value)\n  }\n\n  /**\n   * Returns true if this `Extension` represents a value that is not\n   * coerced into an `Object` wrapper when wrapped with `Object(value)`\n   *\n   * @returns {boolean} `true` if this `Extension` introduces a value\n   * that is alrady an `object`, `false` otherwise.\n   */\n  get isObject() {\n    return Object(this.value) === this.value\n  }\n\n  /**\n   * A static getter that provides a proxy to manage and interact with the\n   * patches that have been applied globally. This proxy abstracts the\n   * underlying details and presents a simplified interface for querying and\n   * manipulating applied patches. It is particularly useful in IDEs, as it\n   * allows developers to access the state of applied patches without needing\n   * to delve into the source code.\n   *\n   * @returns {Object} An object showing all the keys known to be patched for\n   * the default owner, `globalThis`\n   */\n  static get applied() {\n    return Patch.applied;\n  }\n\n  /**\n   * A static getter that provides access to a proxy representing all known\n   * patches, whether applied or not. This is useful for inspecting the\n   * complete set of patches that have been registered in the system, without\n   * limiting the view to only those that are currently active. The proxy\n   * abstracts the underlying details and presents a simplified interface for\n   * querying and manipulating the patches.\n   *\n   * @returns {Proxy} A proxy object that represents a virtual view of all\n   * registered patches, allowing for operations like checking if a patch is\n   * known and retrieving patch values.\n   */\n  static get known() {\n    return Patch.known;\n  }\n\n  /**\n   * A static getter that provides access to a proxy for managing patch\n   * entries with a toggle functionality. This proxy allows the temporary\n   * application of patches within a certain scope, and automatically reverts\n   * them after the scope ends. It is useful for applying patches in a\n   * controlled manner, ensuring that they do not remain active beyond the\n   * intended usage.\n   *\n   * @returns {Proxy} A proxy object that represents a virtual view of the\n   * patches with toggle functionality, allowing for temporary application\n   * and automatic reversion of patches.\n   */\n  static get use() {\n    return Patch.use;\n  }\n\n  /**\n   * A static getter that provides access to a proxy for managing patch\n   * entries with lazy initialization. This proxy defers the creation and\n   * application of patches until they are explicitly requested. It is\n   * beneficial for performance optimization, as it avoids the overhead of\n   * initializing patches that may not be used.\n   *\n   * @returns {Proxy} A proxy object that represents a virtual view of the\n   * patches with lazy initialization, allowing patches to be created and\n   * applied only when needed.\n   */\n  static get lazy() {\n    return Patch.lazy;\n  }\n\n\n  /**\n   * Returns an object with getters to access different proxy views of patches\n   * scoped to a specific owner. This allows for interaction with patches\n   * that are either applied, known, or used within a certain scope, providing\n   * a controlled environment for patch management.\n   *\n   * @param {object} owner - The object to scope the patch proxies to.\n   * @returns {object} An object containing getters for `applied`, `known`,\n   * and `use` proxies:\n   * - `applied`: Proxy for patches applied to the owner.\n   * - `known`: Proxy for all patches known to the owner, applied or not.\n   * - `use`: Proxy that allows temporary application of patches.\n   */\n  static scopedTo(owner) {\n    return Patch.scopedTo(owner);\n  }\n\n  /**\n   * Determines the input type for the extension. This method processes the input\n   * and identifies the key for the extension and the associated value or method.\n   * It supports inputs as either a string key or a function/class, providing\n   * flexibility in defining extensions.\n   *\n   * @param {Function|string} keyClassOrFn - The key, class, or function provided\n   * as input. If a function or class is provided, its name is used as the key.\n   * containing the determined key, the extension value/method, and a validity flag\n   * indicating whether the input is usable.\n   * @returns {{key: string|null, extension: *|null, valid: boolean}} An object\n   */\n  static determineInput(keyClassOrFn) {\n    let input = { key: null, extension: null, valid: false }\n\n    if (keyClassOrFn instanceof Function) {\n      input = {\n        key: keyClassOrFn.name,\n        extension: keyClassOrFn,\n        valid: true\n      }\n\n      if (/^class .*/.exec(keyClassOrFn.toString())) {\n        input.class = keyClassOrFn\n      }\n\n      if (/^(async )?function .*/.exec(keyClassOrFn.toString())) {\n        input.function = keyClassOrFn\n      }\n    }\n    else if (typeof keyClassOrFn === 'string' || keyClassOrFn instanceof String) {\n      input = { key: keyClassOrFn, extension: null, valid: true }\n    }\n\n    return input\n  }\n\n  /**\n   * Custom inspect function for Node.js that provides a formatted representation\n   * of the Extension instance, primarily for debugging purposes.\n   *\n   * @param {number} depth The depth to which the object should be formatted.\n   * @param {object} options Formatting options.\n   * @param {function} inspect The inspection function to format the object.\n   * @returns {string} A formatted string representing the Extension instance.\n   */\n  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n    const exprs = {\n      get braces() { return /^(\\x1B\\[\\d+m)?[\\[\\{]|[\\]\\}](\\x1B\\[\\d+m)?$/g },\n    }\n\n    const val =\n      inspect(this.patches[this.key], options).replaceAll(exprs.braces, '$1$2')\n\n    return `Extension[${val}]`\n  }\n\n  /**\n   * Custom getter for the toStringTag symbol. Provides the class name when the\n   * object is converted to a string, typically used for debugging and logging.\n   *\n   * @returns {string} The class name of the Extension instance.\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * Creates a new ExtensionSet with the provided name and extensions.\n   *\n   * @param {string} name - The name of the extension set.\n   * @param {...Extension|Function} extensions - A list of extensions or\n   * functions to include in the set.\n   * @returns {ExtensionSet} A new instance of ExtensionSet containing the\n   * given extensions.\n   */\n  static createSet(name, ...extensions) {\n    return new Extension.ExtensionSet(name, ...extensions)\n  }\n\n  /**\n   * Represents a set of extensions.\n   */\n  static ExtensionSet = class ExtensionSet {\n    /**\n     * Creates an instance of ExtensionSet.\n     *\n     * @param {string} name - The name of the extension set.\n     * @param {...(Extension|Function)} extensions - Extensions or functions to\n     * add to the set.\n     */\n    constructor(name, ...extensions) {\n      this.name = name;\n      this.extensionObjects = new Set();\n      this.extensions = new Set();\n\n      for (const extensionValue of extensions) {\n        if (extensionValue instanceof Extension) {\n          this.extensions.add(extensionValue);\n          this.extensionObjects.add(extensionValue.patches[extensionValue.key]);\n        } else if (extensionValue instanceof Function) {\n          this.extensionObjects.add(extensionValue);\n          this.extensions.add(new Extension(extensionValue));\n        }\n      }\n    }\n\n    /**\n     * Applies all extensions in the set.\n     */\n    apply() {\n      for (const extension of this.extensions) {\n        extension.apply();\n      }\n    }\n\n    /**\n     * Reverts all extensions in the set.\n     */\n    revert() {\n      for (const extension of this.extensions) {\n        extension.revert();\n      }\n    }\n  }\n}", "/**\n * Represents a semantic version (semver) and provides utility methods for\n * managing and comparing versions according to the semver specification.\n */\nexport class SemVer {\n  /**\n   * Constructs a SemVer instance. Initializes the version based on the\n   * provided semver string or defaults to \"0.0.0\" if not specified.\n   *\n   * Alternatively, if a specific portion of the version is indicated, only\n   * that portion of the version instance will be modified. The `part` parameter\n   * needs to match a portion of the SemVer object instance that needs updating;\n   * `major`, `minor`, and `patch` are all converted to integers, while `prerelease`\n   * and `metadata` are set as strings, unchanged.\n   *\n   * @param {string} [semverString=\"0.0.0\"] - The initial semantic version string.\n   * @param {string} [part=\"*\"] - by default this is set to `*` which indicates that\n   * the entire `semverString` is to be parsed. If the `part` is the name of a property\n   * matching one of [`major`, `minor`, `patch`, `prerelease` or `metadata`] then\n   * only that portion of the version is set. For major, minor and patch, the value\n   * will be parsed into an integer. If an unknown key is specified, the entire\n   * string will be processed.\n   * @throws {Error} If semverString is not a valid semver format.\n   */\n  constructor(semverString = \"0.0.0\") {\n    this.set(semverString)\n  }\n\n  /**\n   * Sets the version based on a semver string. This method parses the string\n   * and updates the major, minor, patch, prerelease, and metadata parts of the\n   * version accordingly.\n   *\n   * @param {string} semverString - The semver string to parse and set.\n   * @param {string} part - The part of the semver string to modify; this is one\n   * of 'major', 'minor', 'patch', 'prerelease' and 'metadata'. If `SemVer.FULL`,\n   * the default, is set, the entire string is parsed for values and all positions\n   * will be updated.\n   * @param {boolean} cascadeValues - if true, setting a new value for major or\n   * minor that are higher than they were before will set minor and/or patch to\n   * 0. So increasing a the MAJOR portion of 1.1.4, will cause the new version to\n   * be 2.0.0. Likewise incrementing MINOR would cause that new value to be 1.2.0.\n   * If this value is false, this additional value setting does not occur.\n   * @returns {SemVer} returns `this` for chaining\n   * @throws {Error} If semverString is not a string or not in valid semver format.\n   */\n  set(semverString, part = '*', cascadeValues = true) {\n    const { MAJOR, MINOR, PATCH, PRERELEASE, METADATA, FULL } = SemVer\n\n    if (part !== FULL) {\n      const oldValue = this[part]\n      const newValue = [MAJOR, MINOR, PATCH].includes(String(semverString).toLowerCase())\n        ? parseInt(semverString)\n        : semverString\n\n      switch (part) {\n        case MAJOR:\n          this[part] = newValue\n          if ((oldValue < newValue) && cascadeValues) {\n            this[MINOR] = 0\n            this[PATCH] = 0\n          }\n          return this\n\n        case MINOR:\n          this[part] = newValue\n          if ((oldValue < newValue) && cascadeValues) {\n            this[PATCH] = 0\n          }\n          return this\n\n        case PATCH: this[part] = newValue; return this\n        case PRERELEASE: this[part] = newValue; return this\n        case METADATA: this[part] = newValue; return this\n        default:\n          break\n      }\n    }\n\n    const [versionPart, prereleaseAndMetadata] = semverString.split('+');\n    const [version, prerelease] = versionPart.split('-');\n    const [major, minor, patch] = version.split('.').map(Number);\n\n    if (version.split('.').length !== 3) {\n      throw new Error('Version must be in the format major.minor.patch');\n    }\n\n    if ([major, minor, patch].some(num => num < 0 || isNaN(num))) {\n      throw new Error('Major, minor, and patch versions must be non-negative integers');\n    }\n\n    this.major = major;\n    this.minor = minor;\n    this.patch = patch;\n    this.prerelease = prerelease || '';\n    this.metadata = prereleaseAndMetadata && prereleaseAndMetadata !== prerelease\n      ? prereleaseAndMetadata\n      : '';\n\n    return this\n  }\n\n  /**\n   * Retrieves the full version string in semver format. Constructs the version\n   * string including the major, minor, patch versions, and optionally the\n   * prerelease and metadata parts if they are present.\n   *\n   * @returns {string} The full version string in semver format.\n   */\n  get() {\n    let semverString = `${this.major}.${this.minor}.${this.patch}`;\n    if (this.prerelease) {\n      semverString += `-${this.prerelease}`;\n    }\n    if (this.metadata) {\n      semverString += `+${this.metadata}`;\n    }\n    return semverString;\n  }\n\n  /**\n   * Increments part of the SemVer instance by the indicated amount.\n   *\n   * @param {string} version the portion of the version to increment. Valid values\n   * are `major`, `minor` or `patch`.\n   * @param {number} by - the amount by which the version is incremented. This\n   * defaults to 1.\n   * @returns {SemVer} the `this` instance for further chaining\n   */\n  increment(version, by = 1) {\n    const { MAJOR, MINOR, PATCH } = SemVer\n\n    if ([MAJOR, MINOR, PATCH].includes(version)) {\n      this[version] = Math.round(this[version] + parseInt(by))\n\n      if (version === MINOR || version === MAJOR) { this[PATCH] = 0 }\n      if (version === MAJOR) { this[MINOR] = 0 }\n    }\n\n    return this\n  }\n\n  /**\n   * Decrements part of the SemVer instance by the indicated amount.\n   *\n   * @param {string} version the portion of the version to decrement. Valid values\n   * are `major`, `minor` or `patch`.\n   * @param {number} by - the amount by which the version is decremented. This\n   * defaults to 1.\n   * @returns {SemVer} the `this` instance for further chaining\n   */\n  decrement(version, by = 1) {\n    const { MAJOR, MINOR, PATCH } = SemVer\n\n    if ([MAJOR, MINOR, PATCH].includes(version)) {\n      const newValue = Math.round(this[version] - parseInt(by))\n\n      this[version] = Math.max(0, newValue)\n    }\n\n    return this\n  }\n\n  /**\n   * Returns a string representation of the SemVer instance.\n   *\n   * This method is an alias for the `get()` method, which returns the\n   * full semver string including the major, minor, patch, prerelease,\n   * and metadata components.\n   *\n   * @returns {string} The string representation of the SemVer instance.\n   *\n   * @example\n   * const version = new SemVer('1.2.3-beta.1+build.123')\n   * console.log(version.toString())\n   * // Output: '1.2.3-beta.1+build.123'\n   */\n  toString() {\n    return this.get()\n  }\n\n  /**\n   * Converts the version to a primitive value based on the context. When\n   * converting to a number, only the major and minor parts are considered.\n   * When converting to a string, the full semver string is returned.\n   *\n   * @param {string} hint - The context in which conversion is requested (\"number\"\n   * or \"string\").\n   * @returns {(string|number|null)} The converted value.\n   */\n  [Symbol.toPrimitive](hint) {\n    switch (hint) {\n      case 'number':\n        return parseFloat(`${this.major}.${this.minor}`);\n      case 'string':\n        return this.get();\n      default:\n        return null;\n    }\n  }\n\n  /**\n   * Determines if this version is exactly equal to another version. This\n   * comparison includes the major, minor, patch, prerelease, and metadata\n   * parts of the version. It's a strict comparison where all parts must match.\n   *\n   * @param {SemVer} otherVersion - The other SemVer instance to compare with.\n   * @returns {boolean} True if all version components are exactly equal.\n   */\n  isEqual(otherVersion) {\n    return this.major === otherVersion.major &&\n           this.minor === otherVersion.minor &&\n           this.patch === otherVersion.patch &&\n           this.prerelease === otherVersion.prerelease &&\n           this.metadata === otherVersion.metadata;\n  }\n\n  /**\n   * Checks if this version is equal to another version based only on the major,\n   * minor, and patch numbers. This method ignores the prerelease and metadata\n   * parts of the version, making it a \"loose\" or \"lenient\" comparison. It is\n   * useful for determining compatibility or disregarding build and pre-release\n   * details.\n   *\n   * @param {SemVer} otherVersion - The other SemVer instance to compare with.\n   * @returns {boolean} True if major, minor, and patch numbers are equal.\n   */\n  isLooselyEqual(otherVersion) {\n    return this.major === otherVersion.major &&\n           this.minor === otherVersion.minor &&\n           this.patch === otherVersion.patch;\n  }\n\n  /**\n   * Compares this version to another version according to semver equality\n   * rules. In semver, two versions are considered equal if they have the same\n   * major, minor, and patch numbers. This method also considers prerelease\n   * tags but ignores build metadata. For example, \"1.0.0-alpha\" and\n   * \"1.0.0-alpha+build\" are considered equal.\n   *\n   * @param {SemVer} otherVersion - The other SemVer instance to compare with.\n   * @returns {boolean} True if versions are considered equal in semver terms.\n   */\n  isSemverEqual(otherVersion) {\n    return this.major === otherVersion.major &&\n           this.minor === otherVersion.minor &&\n           this.patch === otherVersion.patch &&\n           this.prerelease === otherVersion.prerelease;\n  }\n\n  /**\n   * Provides a custom tag when the object is converted to a string. This\n   * method overrides the default behavior to return the class name instead\n   * of the generic \"Object\" tag.\n   *\n   * @returns {string} The class name \"SemVer\".\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * The primary version number for this SemVer instance. This version of the\n   * instance, when bumped, indicates likely breaking changes or at least a\n   * semmantic separation from previous major revisions\n   *\n   * @type {number}\n   */\n  major = 0\n\n  /**\n   * The minor version number for this SemVer instance. This version of the instance,\n   * when bumped, usually indicates that new features are present. It is expected,\n   * however, that minor bump versions are backwards compatible.\n   *\n   * @type {number}\n   */\n  minor = 0\n\n  /**\n   * The patch version number for this SemVer instance. This version of the instance,\n   * when bumped, usually indicates that some fix has been applied but that there are\n   * no new features or breaking changes. These should usually be taken greedily.\n   */\n  patch = 0\n\n  /**\n   * This is prerelease string indicator. Usually this has a value like \"alpha\" or\n   * \"beta\". A SemVer value with a prerelease indicator might look like \"1.0.0-beta\"\n   * indicating, in this example, that it is a beta release for 1.0.0.\n   *\n   * @type {string}\n   */\n  prerelease = ''\n\n  /**\n   * The metadata string portion of a SemVer version is a note to the consumer but\n   * may not have any real bearing on changes. This is a human readable version. A\n   * metadata portion may show up in a SemVer string as \"1.0.0-beta+001\". In this\n   * case maybe providing an iteration value. It can be any string. It is only usually\n   * compared in version comparisons, in the strictest compares.\n   *\n   * @type {string}\n   */\n  metadata = ''\n\n  /**\n   * Creates a SemVer instance from a substring containing a semantic\n   * version string.\n   *\n   * @param {string} fromSubstring - The string to extract a semantic\n   *   version from.\n   * @returns {object|undefined} An object containing the matched\n   *   `SemVer` instance and the range of the match, or `undefined` if\n   *   no match is found.\n   * @example\n   * const result = SemVer.from('This is version 1.2.3-beta.1+build.123')\n   * if (result) {\n   *   console.log(result.semVer.get()) // '1.2.3-beta.1+build.123'\n   *   console.log(result.range) // [16, 37]\n   * }\n   */\n  static from(fromSubstring) {\n    const match = this.match(fromSubstring)\n\n    if (match.semVer) {\n      return { semVer: match.semVer, range: match.range }\n    }\n\n    return undefined\n  }\n\n  /**\n   * Matches a semantic version string within a larger string.\n   *\n   * @param {string} asSubstringOf - The string to search for a\n   *   semantic version within.\n   * @returns {object} An object containing the matched semantic\n   *   version string, a `SemVer` instance, the range of the match,\n   *   the parsed regex result, and `toString` and `Symbol.iterator`\n   *   methods.\n   * @example\n   * const result = SemVer.match('This is version 1.2.3-beta.1+build.123')\n   * console.log(result.semVerString) // '1.2.3-beta.1+build.123'\n   * console.log(result.semVer.get()) // '1.2.3-beta.1+build.123'\n   * console.log(result.range) // [16, 37]\n   * console.log([...result])  // ['1', '.', '2', '.', '3', ...]\n   */\n  static match(asSubstringOf) {\n    let semVerString\n    let semVer\n    let parts = []\n\n    const r = SemVer.kSemVerPattern.exec(asSubstringOf)\n    if (r) {\n      parts = parts.concat(r.slice(1, 4)).filter(p => p)\n      parts = [parts.join('.')]\n\n      if (r[4]) {\n        parts.push(`-${r[4]}`)\n      }\n\n      if (r[5]) {\n        parts.push(`+${r[5]}`)\n      }\n    }\n\n    if (parts.length) {\n      semVerString = parts.join('')\n      semVer = new SemVer(semVerString)\n    }\n\n    return {\n      semVerString,\n      semVer,\n      range: [r.index, r.index + r[0].length],\n      regexParsed: r,\n      toString() { return this.semVer },\n      *[Symbol.iterator]() {\n        return this?.semVer[Symbol.iterator]\n      }\n    }\n  }\n\n  /**\n   * The `kSemVerPattern` is a regular expression that matches semantic\n   * version strings. It captures the major, minor, and patch version\n   * numbers, as well as optional prerelease and build metadata.\n   *\n   * @example\n   * const version = '1.2.3-beta.1+build.123'\n   * const match = version.match(SemVer.kSemVerPattern)\n   * console.log(match)\n   * // Output:\n   * // [\n   * //   '1.2.3-beta.1+build.123',\n   * //   '1',\n   * //   '2',\n   * //   '3',\n   * //   'beta.1',\n   * //   'build.123'\n   * // ]\n   *\n   * @type {RegExp}\n   */\n  static get kSemVerPattern() {\n    return /\\b(\\d+)\\.?(\\d+)?\\.?(\\d+)?\\-?([\\w\\d]+)?\\+?([\\w\\d]+)?\\b/\n  }\n\n  /**\n   * The `FULL` constant can be passed as a second parameter, inspite of it being\n   * the default value, to the `.set()` method on `SemVer` instances. It indicates\n   * that the full SemVer string should be parsed and set.\n   *\n   * @type {string}\n   */\n  static get FULL() { return \"*\" }\n\n  /**\n   * The `MAJOR` constant can be used as a parameter to `set()`, `increment()`,\n   * and `decrement()` methods. It points to the major semver version number.\n   *\n   * @example semver.increment(SemVer.MAJOR).get()\n   *\n   * @type {string}\n   */\n  static get MAJOR() { return \"major\" }\n\n  /**\n   * The `MINOR` constant can be used as a parameter to `set()`, `increment()`,\n   * and `decrement()` methods. It points to the minor semver version number.\n   *\n   * @example semver.increment(SemVer.MINOR).get()\n   *\n   * @type {string}\n   */\n  static get MINOR() { return \"minor\" }\n\n  /**\n   * The `PATCH` constant can be used as a parameter to `set()`, `increment()`,\n   * and `decrement()` methods. It points to the patch semver version number.\n   *\n   * @example semver.increment(SemVer.PATCH).get()\n   *\n   * @type {string}\n   */\n  static get PATCH() { return \"patch\" }\n\n  /**\n   * The `PRERELEASE` constant can be used as a parameter to `set()` method. It\n   * points to the pre-release semver version text.\n   *\n   * @example semver.set(\"beta\", SemVer.PRERELEASE).get()\n   *\n   * @type {string}\n   */\n  static get PRERELEASE() { return \"prerelease\" }\n\n  /**\n   * The `METADATA` constant can be used as a parameter to `set()` method. It\n   * points to the metadata semver version text.\n   *\n   * @example semver.set(\"bries_release\", SemVer.METADATA).get()\n   *\n   * @type {string}\n   */\n  static get METADATA() { return \"metadata\" }\n\n  /**\n   * Compares two semver strings for semver equality. This static method allows\n   * for a direct comparison without needing to create SemVer instances\n   * externally. It is useful for quick comparisons where instantiation of\n   * objects is not necessary.\n   *\n   * @param {string} leftVersion - The first version string to compare.\n   * @param {string} rightVersion - The second version string to compare.\n   * @returns {boolean} True if the versions are semver equal according to\n   * the isSemverEqual method.\n   */\n  static compare(leftVersion, rightVersion) {\n    return new SemVer(leftVersion).isSemverEqual(new SemVer(rightVersion))\n  }\n}\n\nexport default SemVer", "export { Extension } from './extension.js'\nexport { Patch } from './patch.js'\nexport { PatchEntry } from './patchentry.js'\nexport { PatchToggle } from './patchtoggle.js'\nexport { SemVer } from './semver.js'\n\nimport { CannotBeExtendedError } from './errors/CannotBeExtendedError.js'\nimport { MissingOwnerValue } from './errors/MissingOwnerValue.js'\n\nexport const Errors = {\n  get CannotBeExtended() { return CannotBeExtendedError },\n  get MissingOwnerValue() { return MissingOwnerValue },\n}\n", "import { Patch } from '@nejs/extension'\n\n/**\n * `ArrayExtensions` is a constant that applies a patch to the global\n * `Array` constructor. This patch extends the `Array` with additional\n * methods and properties, enhancing its functionality.\n *\n * The `Patch` function takes two arguments: the target object to be patched\n * (in this case, `Array`), and an object containing the methods and\n * properties to be added to the target object.\n *\n * @example\n * // Using a method added by ArrayExtensions\n * const arr = [1, 2, 3];\n * console.log(Array.ifArray(arr, 'Array', 'Not Array')); // Output: 'Array'\n *\n * @const\n * @type {Patch}\n * @memberof module:array.extensions\n */\nexport const ArrayExtensions = new Patch(Array, {\n  /**\n   * Checks if the provided value is an array and returns one of two\n   * provided values based on the result. This function is a convenience\n   * method for performing conditional operations based on the type of\n   * the provided value.\n   *\n   * @name ifArray\n   * @type {function}\n   * @memberof ArrayExtensions\n   * @param {any} value - The value to be checked.\n   * @param {function | any} thenValue - The value to be returned if the\n   * provided value is an array.\n   * @param {function | any} elseValue - The value to be returned if the\n   * provided value is not an array.\n   * @returns {any} Returns `thenValue` if the provided value is an array,\n   * otherwise returns `elseValue`.\n   *\n   * @example\n   * const arr = [1, 2, 3];\n   * console.log(ArrayExtensions.ifArray(arr, 'Array', 'Not Array'));\n   * // Output: 'Array'\n   *\n   * const notArr = \"I'm not an array\";\n   * console.log(ArrayExtensions.ifArray(notArr, 'Array', 'Not Array'));\n   * // Output: 'Not Array'\n   */\n  ifArray(value, thenValue, elseValue) {\n    return isThenElse(Array.isArray(value), thenValue, elseValue)\n  },\n})\n\nconst { ifArray: pIfArray } = ArrayExtensions.patches\n\n// todo: everyOfType(type), someOfType(type)\n// todo: everyWithTag(stringTag), someWithTag(stringTag),\n// todo: everyOfInstance(Class), someOfInstance(Class)\n\n/**\n * `ArrayPrototypeExtensions` is a constant that applies a patch to the\n * Array prototype. This patch extends the Array prototype with additional\n * methods and properties, enhancing its functionality.\n *\n * The `Patch` function takes two arguments: the target object to be patched\n * (in this case, `Array.prototype`), and an object containing the methods\n * and properties to be added to the target object.\n *\n * @example\n * // Using a method added by ArrayPrototypeExtensions\n * const arr = [1, 2, 3];\n * console.log(arr.ifArray('Array', 'Not Array')); // Output: 'Array'\n *\n * @const\n * @type {Patch}\n * @memberof module:array.extensions\n */\nexport const ArrayPrototypeExtensions = new Patch(Array.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Sometimes defining even a short function for the invocation of `find`\n     * can be troublesome. This helper function performs that job for you. If\n     * the specified element is in the array, `true` will be returned.\n     *\n     * @param {*} value the value to search for. This value must triple equals\n     * the array element in order to return true.\n     * @returns true if the exact element exists in the array, false otherwise\n     */\n    contains(value) {\n      return !!this.find(entry => entry === value)\n    },\n\n    /**\n     * The `findEntry` function searches the entries of the object and returns\n     * the `[index, value]` entry array for the first matching value found.\n     *\n     * @param {function} findFn a function that takes the element to be checked\n     * and returns a boolean value\n     * @returns if `findFn` returns `true`, an array with two elements, the first\n     * being the index, the second being the value, is returned.\n     */\n    findEntry(findFn) {\n      const entries = this.entries()\n      const VALUE = 1\n\n      for (let entry of entries) {\n        if (findFn(entry[VALUE])) {\n          return entry\n        }\n      }\n\n      return undefined\n    },\n\n    /**\n     * A getter property that returns the first element of the array. If the\n     * array is empty, it returns `undefined`. This property is useful for\n     * scenarios where you need to quickly access the first item of an array\n     * without the need for additional checks or method calls.\n     *\n     * @returns {*} The first element of the array or `undefined` if the array\n     * is empty.\n     */\n    get first() {\n      return this[0];\n    },\n\n    /**\n     * A getter property that checks if the current context (`this`) is an\n     * array. This is a convenience method that wraps the native\n     * `Array.isArray` function.\n     *\n     * @name isArray\n     * @type {function}\n     * @memberof Array.prototype\n     * @returns {boolean} `true` if the current context is an array,\n     * `false` otherwise.\n     *\n     * @example\n     * const arr = [1, 2, 3];\n     * console.log(arr.isArray); // Output: true\n     *\n     * const notArr = \"I'm not an array\";\n     * console.log(notArr.isArray); // Output: false\n     */\n    get isArray() {\n      return Array.isArray(this)\n    },\n\n    /**\n     * Checks if the current context (`this`) is an array and returns one of\n     * two provided values based on the result. This function is a convenience\n     * method for performing conditional operations based on the type of\n     * the current context.\n     *\n     * @name ifArray\n     * @type {function}\n     * @memberof Array.prototype\n     * @param {function | any} thenValue - The value to be returned if the\n     * current context is an array.\n     * @param {function | any} elseValue - The value to be returned if the\n     * current context is not an array.\n     * @returns {*} Returns `thenValue` if the current context is an array,\n     * otherwise returns `elseValue`.\n     *\n     * @example\n     * const arr = [1, 2, 3];\n     * console.log(arr.ifArray('Array', 'Not Array')); // Output: 'Array'\n     *\n     * const notArr = \"I'm not an array\";\n     * console.log(notArr.ifArray('Array', 'Not Array')); // Output: 'Not Array'\n     */\n    ifArray(thenValue, elseValue) {\n      return pIfArray(this, thenValue, elseValue)\n    },\n\n    /**\n     * Checks if at least one element in the array is equal to the provided\n     * value. This method uses the `Array.prototype.some` function to iterate\n     * over the array and compare each element with the provided value.\n     *\n     * @name oneIs\n     * @type {function}\n     * @memberof Array.prototype\n     * @param {*} value - The value to be compared with the array elements.\n     * @param {boolean} [doubleEqualsOkay=true] - A flag indicating whether to\n     * use loose equality (`==`) or strict equality (`===`) for the comparison.\n     * If `true`, loose equality is used. If `false`, strict equality is used.\n     * @returns {boolean} Returns `true` if at least one element in the array\n     * is equal to the provided value, otherwise `false`.\n     *\n     * @example\n     * const arr = [1, 2, 3];\n     * console.log(arr.oneIs(2)); // Output: true\n     *\n     * const arr2 = ['1', '2', '3'];\n     * console.log(arr2.oneIs(2, false)); // Output: false\n     */\n    oneIs(value, doubleEqualsOkay = true) {\n      return this.some(element => (\n        doubleEqualsOkay ? element == value : element === value\n      ))\n    },\n\n    /**\n     * Checks if some elements in the array are included in the provided values.\n     * This method uses the `Array.prototype.some` function to iterate over the\n     * array and checks if any of the elements are included in the provided values.\n     *\n     * @name someAre\n     * @type {function}\n     * @memberof Array.prototype\n     * @param {...*} values - The values to be checked against the array elements.\n     * @returns {boolean} Returns `true` if at least one element in the array\n     * is included in the provided values, otherwise `false`.\n     *\n     * @example\n     * const arr = [1, 2, 3];\n     * console.log(arr.someAre(2, 4)); // Output: true\n     *\n     * const arr2 = ['1', '2', '3'];\n     * console.log(arr2.someAre(4, 5)); // Output: false\n     */\n    someAre(...values) {\n      return this.some(element => !!~values.indexOf(element))\n    },\n\n    /**\n     * Checks if all elements in the array are equal to the provided value.\n     * This method uses the `Array.prototype.every` function to iterate over\n     * the array and compare each element with the provided value.\n     *\n     * @name allAre\n     * @type {function}\n     * @memberof Array.prototype\n     * @param {*} value - The value to be compared with the array elements.\n     * @param {boolean} [doubleEqualsOkay=true] - A flag indicating whether to\n     * use loose equality (`==`) or strict equality (`===`) for the comparison.\n     * If `true`, loose equality is used. If `false`, strict equality is used.\n     * @returns {boolean} Returns `true` if all elements in the array are equal\n     * to the provided value, otherwise `false`.\n     *\n     * @example\n     * const arr = [2, 2, 2];\n     * console.log(arr.allAre(2)); // Output: true\n     *\n     * const arr2 = ['2', '2', '2'];\n     * console.log(arr2.allAre(2, false)); // Output: false\n     */\n    allAre(value, doubleEqualsOkay = true) {\n      return this.every(element => (\n        doubleEqualsOkay ? element == value : element === value\n      ))\n    },\n\n   /**\n     * A getter property that returns the last element of the array. It\n     * calculates the last index based on the array's length. If the array is\n     * empty, it returns `undefined`. This property is beneficial when you need\n     * to access the last item in an array, improving code readability and\n     * avoiding manual index calculation.\n     *\n     * @returns {*} The last element of the array or `undefined` if the\n     * array is empty.\n     */\n    get last() {\n      return this[this.length - 1];\n    },\n\n    /**\n     * A getter that returns a new array containing only truthy elements.\n     * Filters out falsy values like null, undefined, 0, false, NaN, and ''.\n     * Useful for quickly removing falsy values from an array.\n     *\n     * @returns {Array} A new array with only truthy elements.\n     */\n    get onlyTruthy() {\n      return this.filter(truthy => !!truthy);\n    },\n\n    /**\n     * A getter that returns a new array containing only falsy elements.\n     * Keeps falsy values like null, undefined, 0, false, NaN, and ''.\n     * Useful for isolating falsy values in an array for further processing.\n     *\n     * @returns {Array} A new array with only falsy elements.\n     */\n    get onlyFalsy() {\n      return this.filter(falsy => !!!falsy);\n    },\n\n    // expected usage:\n    // function example(name, age) {\n    //   const variants = [{name}, {age}].variants()\n    //   if (typeof name === 'object')\n    // }\n    variants() {\n      const keys = this.map(o => Object.keys(o)?.[0])\n      const entries = this.map(o => Object.entries(o)?.[0])\n      const object = entries.reduce((acc,[key, value]) => {\n        acc[key] = value;\n        return acc;\n      }, {})\n\n      const result = {\n        order: keys,\n        entries: entries,\n        object: object,\n      }\n\n      Object.defineProperty(result, 'check', {\n        value(position) {\n          if (\n            typeof position !== 'number' &&\n            position >= 0 &&\n            position < this.order.length\n          ) {\n            return false\n          }\n\n          const value = this.entries[position][1]\n\n          if (typeof value === 'object' && value) {\n            if (Object.keys(value).every(key => ~this.order.indexOf(key))) {\n              return true\n            }\n          }\n\n          return false\n        },\n        enumerable: false,\n        configurable: true\n      })\n\n      return result\n    },\n\n    /**\n     * Weaves together an array of keys and an array of values into an\n     * object, using the provided default value for missing values and\n     * the specified base descriptor for defining properties. This can\n     * be used to quickly generate empty models if a list of keys from\n     * a preset or other object.\n     *\n     * @param {Array} arrayOfKeys - An array of keys to be used as\n     * property names in the resulting object.\n     * @param {Array} [arrayOfValues] - An optional array of values to\n     * be assigned to the corresponding keys. If not provided or not an\n     * array, the `defaultValue` will be used for all properties.\n     * @param {*} [defaultValue] - The default value to be used for\n     * missing values or when `arrayOfValues` is not an array or when\n     * there are not enough values for the number of keys.\n     * @param {Object|string} [baseDescriptor] - The base property\n     * descriptor to be used for defining properties. If not provided,\n     * default descriptor values will be used. Special string values\n     * `'hidden'` and `'immutable'` can be used for predefined\n     * descriptors.\n     * @returns {Object} - The resulting object with the woven\n     * properties.\n     *\n     * @example\n     * const employee134 = { name: 'Jane Doe', yearsOfService: 3 }\n     * const employee135 = Array.weave(Object.keys(employee134))\n     * // employee135 = { name: undefined, yearsOfService: undefined }\n     *\n     * @example\n     * const keys = ['a', 'b', 'c']\n     * const values = [1, 2, 3]\n     * const obj = Array.weave(keys, values)\n     * console.log(obj) // { a: 1, b: 2, c: 3 }\n     *\n     * @example\n     * const keys = ['x', 'y', 'z']\n     * const obj = Array.weave(keys, 42, 0, 'immutable')\n     * console.log(obj) // { x: 42, y: 42, z: 42 } (immutable)\n     */\n    weave(arrayOfKeys, arrayOfValues, defaultValue, baseDescriptor) {\n      if (!Array.isArray(arrayOfKeys)) {\n        return {}\n      }\n\n      if (arrayOfValues && !Array.isArray(arrayOfValues)) {\n        const repeatedValue = arrayOfValues\n        arrayOfValues = []\n        for (const _ of arrayOfKeys) {\n          arrayOfValues.push(repeatedValue)\n        }\n      }\n\n      const descKeys = ['configurable', 'enumerable', 'writable']\n\n      let object = {}\n      let descriptor\n      let keys = arrayOfKeys\n      let values = arrayOfValues\n      let useGetter = false\n\n      // Ensure we have a descriptor\n      if (!baseDescriptor) {\n        descriptor = descKeys.reduce(\n          (acc, key) => { acc[key] = true; return acc }, {}\n        )\n      }\n      else if (baseDescriptor === 'hidden') {\n        baseDescriptor = { configurable: true, enumerable: false }\n      }\n      else if (baseDescriptor === 'immutable') {\n        useGetter = true\n        baseDescriptor = { configurable: false, enumerable: false }\n      }\n      else if (baseDescriptor && typeof baseDescriptor === 'object') {\n        descriptor = descKeys.reduce(\n          (acc, key) => {\n            acc[key] = baseDescriptor?.[key] ?? true; return acc\n          }, {}\n        )\n      }\n\n      for (const [index, key] of Object.entries(keys)) {\n        if (useGetter) {\n          Object.defineProperty(object, key, {\n            ...descriptor,\n            get() { return values?.[index] ?? defaultValue },\n          })\n        }\n        else {\n          Object.defineProperty(object, key, {\n            ...descriptor,\n            value: values?.[index] ?? defaultValue,\n          })\n        }\n      }\n\n      return object\n    },\n\n    /**\n     * @property {object} kTypeDefaults\n     * @description\n     * An object that maps JavaScript types to their default values.\n     * This is useful for initializing variables or properties with\n     * a default value based on their expected type.\n     *\n     * Note that `symbol` types are initialized with `undefined`\n     * due to the fact that their usage is by definition, unique;\n     * or at the very least deliberately reused.\n     *\n     * The default values for each type are:\n     * - `undefined`: `undefined`\n     * - `symbol`: `undefined`\n     * - `string`: `\"\"`\n     * - `object`: `{}`\n     * - `number`: `0`\n     * - `boolean`: `true`\n     * - `bigint`: `0n`\n     * - `function`: an empty function\n     *\n     * @example\n     * const defaultString = Array.kTypeDefaults.string\n     * console.log(defaultString) // Output: \"\"\n     *\n     * const defaultNumber = Array.kTypeDefaults.number\n     * console.log(defaultNumber) // Output: 0\n     */\n    get [Symbol.for('@nejs.defaults.by.type')]() {\n      return {\n        undefined: undefined,\n        symbol: undefined,\n        string: \"\",\n        object: {},\n        number: 0,\n        boolean: true,\n        bigint: 0n,\n        function() {},\n      }\n    },\n\n    /**\n     * @property {symbol} kDefaultsByType\n     * @description\n     * A unique symbol that represents the key for accessing\n     * the default values for different types.\n     *\n     * This symbol is created using `Symbol.for()` with the key\n     * `'@nejs.defaults.by.type'`. It can be used to retrieve\n     * the default values object from other parts of the code.\n     *\n     * @example\n     * const defaultsByType = Array[Array.kDefaultsByType]\n     * console.log(defaultsByType.string) // Output: \"\"\n     * console.log(defaultsByType.number) // Output: 0\n     *\n     * @returns {symbol} The unique symbol for accessing the\n     * default values by type.\n     */\n    get kDefaultsByType() {\n      return Symbol.for('@nejs.defaults.by.type')\n    },\n  },\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  function isFunction(value) { typeof value === 'function' }\n\n  if (arguments.length > 1) {\n    var _then = isFunction(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = isFunction(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n", "import { Patch } from '@nejs/extension'\n\n/**\n * `BigIntExtensions` is a patch for the JavaScript built-in `BigInt` class.\n * It adds utility methods to the `BigInt` class without modifying the global\n * namespace directly. This patch includes methods for checking if a value is\n * a `BigInt` and conditionally returning a value based on whether the supplied\n * value is a `BigInt` or not.\n *\n * @type {Patch}\n * @example\n * import { BigIntExtensions } from 'big.int.extension.js'\n *\n * BigIntExtensions.apply()\n * // Now the `BigInt` class has additional methods available\n */\nexport const BigIntExtensions = new Patch(BigInt, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Checks if all or some of the supplied values are numbers.\n     *\n     * This method uses the `Array.prototype.every` or `Array.prototype.some`\n     * method to check if all or some of the supplied values are numbers,\n     * respectively. The method to use is determined by the `which` parameter.\n     *\n     * @param {string} [which='every'] - Determines the method to use for the\n     * check. Can be either 'every' or 'some'. Defaults to 'every'.\n     * @param {...*} values - The values to check.\n     * @returns {boolean} - Returns `true` if all or some of the values are\n     * numbers (based on the `which` parameter), `false` otherwise.\n     *\n     * @example\n     * areNumbers('every', 1, 2, 3) // true\n     * areNumbers('some', 1, '2', 3) // true\n     * areNumbers('every', 1, '2', 3) // false\n     */\n    areBigInts(which = ['every', 'some'][0], ...values) {\n      if (which !== 'every' && which !== 'some') {\n        return false\n      }\n\n      return values[which](num => this.isBigInt(num))\n    },\n\n    /**\n     * Determines if the supplied `value` is a `BigInt`. This check is\n     * performed by first checking the `typeof` the `value` and then\n     * checking to see if the `value` is an `instanceof` `BigInt`\n     *\n     * @param {*} value The value that needs to be checked to determine\n     * if it is a `BigInt` or not\n     * @returns {boolean} `true` if the supplied `value` is a `BigInt`,\n     * `false` otherwise\n     *\n     * @example\n     * const bigInt = 1234567890123456789012345678901234567890n\n     * isBigInt(bigInt) // true\n     * isBigInt(1234567890123456789012345678901234567890) // false\n     * isBigInt('1234567890123456789012345678901234567890') // false\n     * isBigInt(BigInt('1234567890123456789012345678901234567890')) // true\n     */\n    isBigInt(value) {\n      return typeof value === 'bigint' || value instanceof BigInt\n    },\n\n    /**\n     * Conditionally returns a value based on whether the supplied\n     * `value` is a `BigInt` or not. If the `value` is a `BigInt`,\n     * the `thenValue` will be returned. If it is not a `BigInt`,\n     * the `elseValue` will be returned instead.\n     *\n     * @param {any} value The value to check to determine if it is a\n     * `BigInt`\n     * @param {any} thenValue The value to return if the supplied\n     * `value` is a `BigInt`\n     * @param {any} elseValue The value to return if the supplied\n     * `value` is not a `BigInt`\n     * @returns {any} Either the `thenValue` or `elseValue` depending\n     * on if the supplied `value` is a `BigInt`\n     *\n     * @example\n     * const bigInt = 1234567890123456789012345678901234567890n\n     * const num = 42\n     * ifBigInt(bigInt, 'is a BigInt', 'not a BigInt')\n     * // 'is a BigInt'\n     * ifBigInt(num, 'is a BigInt', 'not a BigInt')\n     * // 'not a BigInt'\n     */\n    ifBigInt(value, thenValue, elseValue) {\n      return isThenElse(this.isBigInt(value), thenValue, elseValue)\n    },\n\n    /**\n     * The Math.min() static method returns the smallest of the numbers given\n     * as input parameters, or Infinity if there are no parameters.\n     *\n     * @param {bigint|number} values value1, \u2026, valueN \u2013 Zero or more numbers\n     * among which the lowest value will be selected and returned.\n     * @returns {bigint|number|Infinity} The smallest of the given numbers.\n     * Returns Infinity if no parameters are provided.\n     */\n    min(...values) {\n      const sorter = (l,r) => l < r ? -1 : l > r ? 1 : 0\n\n      if (!values.length)\n        return Infinity\n\n      if (values.every(n => typeof n === 'bigint')) {\n        return values.toSorted(sorter).at(0)\n      }\n      else {\n        throw new TypeError('All supplied values must be of type bigint')\n      }\n    },\n\n    /**\n     * The Math.max() static method returns the largest of the numbers given\n     * as input parameters, or Infinity if there are no parameters.\n     *\n     * @param {bigint|number} values value1, \u2026, valueN \u2013 Zero or more numbers\n     * among which the largest value will be selected and returned.\n     * @returns {bigint|number|Infinity} The largest of the given numbers.\n     * Returns Infinity if no parameters are provided.\n     */\n    max(...values) {\n      const sorter = (l,r) => l < r ? -1 : l > r ? 1 : 0\n\n      if (!values.length)\n        return Infinity\n\n      if (values.every(n => typeof n === 'bigint')) {\n        return values.toSorted(sorter).at(-1)\n      }\n      else {\n        throw new TypeError('All supplied values must be of type bigint')\n      }\n    },\n  },\n})\n\nconst { isBigInt: pIsBigInt, ifBigInt: pIfBigInt } = BigIntExtensions.patches\n\n/**\n * `BigIntPrototypeExtensions` is a patch for the JavaScript built-in\n * `BigInt.prototype`. It adds utility methods to the `BigInt` prototype\n * without modifying the global namespace directly. This patch includes\n * methods for checking if a value is a BigInt and conditionally returning\n * a value based on whether the supplied value is a BigInt or not.\n *\n * @type {Patch}\n * @example\n * import { BigIntPrototypeExtensions } from 'big.int.extension.js'\n *\n * BigIntPrototypeExtensions.apply()\n * // Now the `BigInt` prototype has additional methods available\n */\nexport const BigIntPrototypeExtensions = new Patch(BigInt.prototype, {\n  /**\n   * Clamps a value between a minimum and maximum value.\n   *\n   * This method checks if the provided value and the min and max bounds are\n   * numbers. If they are not, it returns the original value. If they are,\n   * it ensures that the value does not go below the minimum value or above\n   * the maximum value.\n   *\n   * @param {bigint} [minValue=BigInt(-Number.MAX_VALUE)] - The minimum value.\n   * Defaults to BigInt(-Number.MAX_VALUE).\n   * @param {bigint} [maxValue=BigInt(Number.MAX_VALUE)] - The maximum value.\n   * Defaults to BigInt(Number.MAX_VALUE).\n   * @returns {bigint} - Returns the clamped value if all parameters are\n   * big integers.\n   *\n   * @example\n   * (10n).clamp(1n, 5n) // returns 5n\n   * (-10n).clamp(1n, 5n) // returns 1n\n   * (3n).clamp(1n, 5n) // returns 3n\n   */\n  clamp(\n    minValue = BigInt(-Number.MAX_VALUE),\n    maxValue = BigInt(Number.MAX_VALUE)\n  ) {\n    if (typeof minValue !== 'bigint' || typeof maxValue !== 'bigint')\n      throw new TypeError('All values must be big integers')\n\n    return BigInt.max(minValue, BigInt.min(maxValue, this))\n  },\n\n  /**\n   * A getter method that returns an object representation of the BigInt\n   * instance.\n   *\n   * This method wraps the BigInt instance in an object, allowing it to be\n   * treated as an object. The returned object is created using the `Object()`\n   * constructor, which takes the BigInt instance as its argument.\n   *\n   * @type {Object}\n   * @readonly\n   *\n   * @example\n   * const bigInt = 1234567890123456789012345678901234567890n\n   * console.log(typeof bigInt)           // 'bigint'\n   * console.log(typeof bigInt.instance)  // 'object'\n   */\n  get instance() {\n    return Object(this)\n  },\n\n  /**\n   * A getter method that checks if the current instance is a BigInt.\n   *\n   * This method uses the `pIsBigInt` function from the `BigIntExtensions`\n   * patch to determine if the current instance (`this`) is a BigInt.\n   *\n   * @type {boolean}\n   * @readonly\n   *\n   * @example\n   * const bigInt = 1234567890123456789012345678901234567890n\n   * console.log(bigInt.isBigInt) // Output: true\n   *\n   * const notBigInt = 42\n   * console.log(notBigInt.isBigInt) // Output: false\n   */\n  get isBigInt() {\n    return pIsBigInt(this)\n  },\n\n  /**\n   * Checks if the current object is a BigInt and returns the corresponding\n   * value based on the result.\n   *\n   * This method uses the `pIfBigInt` function from the `BigIntExtensions`\n   * patch to determine if the current object (`this`) is a BigInt. If it is\n   * a BigInt, the `thenValue` is returned. Otherwise, the `elseValue` is\n   * returned.\n   *\n   * @param {any} thenValue - The value to return if the current object\n   * is a BigInt.\n   * @param {any} elseValue - The value to return if the current object\n   * is not a BigInt.\n   * @returns {any} The `thenValue` if the current object is a BigInt, or\n   * the `elseValue` if it is not a BigInt.\n   *\n   * @example\n   * const bigInt = 1234567890123456789012345678901234567890n\n   * // 'Is a BigInt'\n   * console.log(bigInt.ifBigInt('Is a BigInt', 'Not a BigInt'))\n   *\n   * const notBigInt = 42\n   * // 'Not a BigInt'\n   * console.log(notBigInt.ifBigInt('Is a BigInt', 'Not a BigInt'))\n   */\n  ifBigInt(thenValue, elseValue) {\n    return pIfBigInt(this, thenValue, elseValue)\n  },\n\n  /**\n   * Provides a way when dealing with numbers to determine if\n   * a given number is within a range of values. By default, if\n   * no parameters are supplied, it always returns true since\n   * the default range is -Infinity to +Infinity. Additionally,\n   * by default, the number will always be less than the supplied\n   * max unless inclusive is set to true.\n   *\n   * @param min the lower range value, defaults to -Infinity\n   * @param max the upper range value, defaults to +Infinity\n   * @param inclusive defaults to false, set to true if you\n   * want the max value to less than and equals to\n   * @returns {boolean} true if within the range, false otherwise\n   */\n  within(\n    min = BigInt(-Infinity),\n    max = BigInt(Infinity),\n    inclusive = false\n  ) {\n    return this >= min && (inclusive ? this <= max : this < max)\n  }\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  function isFunction(value) { typeof value === 'function' }\n\n  if (arguments.length > 1) {\n    var _then = isFunction(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = isFunction(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n", "import { Patch } from '@nejs/extension'\n\n/**\n * The `FunctionExtensions` class is a patch applied to the built-in JavaScript\n * `Function` constructor. It extends `Function` with additional utility methods\n * for determining the specific type or nature of function-like objects. These\n * methods allow developers to distinguish between classes, regular functions,\n * async functions, and arrow functions in a more intuitive and straightforward\n * manner. This class is part of the `@nejs/extension` library and enhances the\n * capabilities of function handling and introspection in JavaScript.\n */\nexport const FunctionExtensions = new Patch(Function, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Retrieves the properties of a function and its prototype.\n     *\n     * This method uses the `Reflect.ownKeys` function to get all the keys\n     * (including non-enumerable and symbol keys) of the function and its\n     * prototype. It then uses `Object.getOwnPropertyDescriptor` to get the\n     * property descriptors for each key. The descriptors include information\n     * about the property's value, writability, enumerability, and\n     * configurability.\n     *\n     * @param {Function} fn - The function whose properties are to be retrieved.\n     * @returns {Array} An array containing the function itself, its property\n     * descriptors, its prototype, and the prototype's property descriptors.\n     *\n     * @example\n     * function MyFunction() {}\n     * MyFunction.myProp = 'hello';\n     * MyFunction.prototype.myProtoProp = 'world';\n     *\n     * const result = getClassProperties(MyFunction);\n     * console.log(result);\n     * // Output: [MyFunction, { myProp: { value: 'hello', writable: true,\n     * // enumerable: true, configurable: true } }, MyFunction.prototype,\n     * // { myProtoProp: { value: 'world', writable: true, enumerable: true,\n     * // configurable: true } }]\n     */\n    getClassProperties(fn) {\n      const descriptors = Reflect.ownKeys(fn).reduce((acc, key) => {\n        acc[key] = Object.getOwnPropertyDescriptor(fn, key)\n        return acc\n      }, {})\n\n      const prototypeDescriptors = Reflect.ownKeys(fn.prototype).reduce(\n        (acc, key) => {\n          acc[key] = Object.getOwnPropertyDescriptor(fn.prototype, key)\n          return acc\n        }, {}\n      )\n\n      return [fn, descriptors, fn.prototype, prototypeDescriptors]\n    },\n\n    /**\n     * Determines if a given value is an asynchronous function. It checks if the\n     * value is an instance of `Function` and if its string representation\n     * includes the keyword 'Async'. This method is particularly useful for\n     * identifying async functions.\n     *\n     * @param {*} value - The value to be checked.\n     * @returns {boolean} Returns `true` if the value is an async function,\n     * otherwise `false`.\n     */\n    isAsync(value) {\n      const stringTag = /(\\w+)]/g.exec(Object.prototype.toString.call(value))[1]\n      return (\n        value instanceof Function &&\n        stringTag.includes('Async')\n      )\n    },\n\n    /**\n     * The `ifAsync` function checks if a given value is an async function and\n     * returns one of two provided values based on the result. This function is\n     * a convenience method for performing conditional operations based on the\n     * type of a value.\n     *\n     * @param {*} value - The value to be checked. If this is an async function,\n     * `thenValue` is returned, otherwise `elseValue` is returned.\n     * @param {*} thenValue - The value to be returned if `value` is an async\n     * function.\n     * @param {*} elseValue - The value to be returned if `value` is not an\n     * async function.\n     * @returns {*} Returns `thenValue` if `value` is an async function,\n     * otherwise returns `elseValue`.\n     * @see {@link isThenElse}\n     *\n     * @example\n     * // Suppose we have an async function and a regular function\n     * async function asyncFunc() { return 'I am async'; }\n     * function regularFunc() { return 'I am regular'; }\n     *\n     * // Using ifAsync\n     * console.log(Function.ifAsync(asyncFunc, 'Async', 'Not Async'));\n     * // Output: 'Async'\n     * console.log(Function.ifAsync(regularFunc, 'Async', 'Not Async'));\n     * // Output: 'Not Async'\n     */\n    ifAsync(value, thenValue, elseValue) {\n      return isThenElse(this.isAsync(value), thenValue, elseValue)\n    },\n\n    /**\n     * The function checks if a given value is an async generator function\n     *\n     * @param {any} value - The `value` parameter is the value that we want to\n     * check if it is a generator function.\n     * @returns {boolean} `true` if the value is an instance of a function and\n     * its string tag is 'AsyncGeneratorFunction', otherwise it returns `false`.\n     */\n    isAsyncGenerator(value) {\n      const stringTag = getStringTag(value)\n\n      return (\n        value instanceof Function &&\n        stringTag == 'AsyncGeneratorFunction'\n      )\n    },\n\n    /**\n     * The `ifAsyncGenerator` function checks if a given value is an async\n     * generator function and returns one of two provided values based on the\n     * result. This function is a convenience method for performing conditional\n     * operations based on the type of a value.\n     *\n     * @param {*} value - The value to be checked. If this is an async\n     * generator function, `thenValue` is returned, otherwise `elseValue` is\n     * returned.\n     * @param {*} thenValue - The value to be returned if `value` is an async\n     * generator function.\n     * @param {*} elseValue - The value to be returned if `value` is not an\n     * async generator function.\n     * @returns {*} Returns `thenValue` if `value` is an async generator\n     * function, otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have an async generator function and a regular function\n     * async function* asyncGenFunc() { yield 'I am async'; }\n     * function regularFunc() { return 'I am regular'; }\n     *\n     * // Using ifAsyncGenerator\n     * console.log(Function.ifAsyncGenerator(asyncGenFunc, 'Async', 'Not Async'));\n     * // Output: 'Async'\n     * console.log(Function.ifAsyncGenerator(regularFunc, 'Async', 'Not Async'));\n     * // Output: 'Not Async'\n     */\n    ifAsyncGenerator(value, thenValue, elseValue) {\n      return isThenElse(this.isAsyncGenerator(value), thenValue, elseValue)\n    },\n\n    /**\n     * Checks if a given value is an arrow function. It verifies if the value is\n     * an instance of `Function`, if its string representation includes the '=>'\n     * symbol, and if it lacks a prototype, which is a characteristic of arrow\n     * functions in JavaScript.\n     *\n     * @param {*} value - The value to be checked.\n     * @returns {boolean} Returns `true` if the value is an arrow function,\n     * otherwise `false`.\n     */\n    isBigArrow(value) {\n      return (\n        value instanceof Function &&\n        String(value).includes('=>') &&\n        !String(value).startsWith('bound') &&\n        !Reflect.has(value, 'prototype')\n      );\n    },\n\n    /**\n     * The `ifBigArrow` function checks if a given value is an arrow function\n     * and returns one of two provided values based on the result. This function\n     * is a convenience method for performing conditional operations based on\n     * the type of a value.\n     *\n     * @param {*} value - The value to be checked. If this is an arrow function,\n     * `thenValue` is returned, otherwise `elseValue` is returned.\n     * @param {*} thenValue - The value to be returned if `value` is an arrow\n     * function.\n     * @param {*} elseValue - The value to be returned if `value` is not an\n     * arrow function.\n     * @returns {*} Returns `thenValue` if `value` is an arrow function,\n     * otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have an arrow function and a regular function\n     * const arrowFunc = () => 'I am an arrow function';\n     * function regularFunc() { return 'I am a regular function'; }\n     *\n     * // Using ifBigArrow\n     * console.log(Function.ifBigArrow(arrowFunc, 'Arrow', 'Not Arrow'));\n     * // Output: 'Arrow'\n     * console.log(Function.ifBigArrow(regularFunc, 'Arrow', 'Not Arrow'));\n     * // Output: 'Not Arrow'\n     */\n    ifBigArrow(value, thenValue, elseValue) {\n      return isThenElse(this.isBigArrow(value), thenValue, elseValue)\n    },\n\n    /**\n     * Determines if a given value is a bound function. Bound functions are\n     * created using the `Function.prototype.bind` method, which allows setting\n     * the `this` value at the time of binding. This method checks if the value\n     * is an instance of `Function`, if its string representation starts with\n     * 'bound', and if it lacks a `prototype` property. These characteristics\n     * are indicative of bound functions in JavaScript.\n     *\n     * @param {*} value - The value to be checked, typically a function.\n     * @returns {boolean} Returns `true` if the value is a bound function,\n     * otherwise `false`. Bound functions have a specific format in their\n     * string representation and do not have their own `prototype` property.\n     */\n    isBound(value) {\n      return (\n        value instanceof Function &&\n        String(value).startsWith('bound') &&\n        !Reflect.has(value, 'prototype')\n      )\n    },\n\n    /**\n     * The `ifBound` function checks if a given value is a bound function and\n     * returns one of two provided values based on the result. This function\n     * is a convenience method for performing conditional operations based on\n     * the type of a value.\n     *\n     * @param {*} value - The value to be checked. If this is a bound function,\n     * `thenValue` is returned, otherwise `elseValue` is returned.\n     * @param {*} thenValue - The value to be returned if `value` is a bound\n     * function.\n     * @param {*} elseValue - The value to be returned if `value` is not a\n     * bound function.\n     * @returns {*} Returns `thenValue` if `value` is a bound function,\n     * otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a bound function and a regular function\n     * const boundFunc = function() { return this.x }.bind({x: 'I am bound'});\n     * function regularFunc() { return 'I am a regular function'; }\n     *\n     * // Using ifBound\n     * console.log(Function.ifBound(boundFunc, 'Bound', 'Not Bound'));\n     * // Output: 'Bound'\n     * console.log(Function.ifBound(regularFunc, 'Bound', 'Not Bound'));\n     * // Output: 'Not Bound'\n     */\n    ifBound(value, thenValue, elseValue) {\n      return isThenElse(this.isBound(value), thenValue, elseValue)\n    },\n\n    /**\n     * Determines if a given value is a class. It checks if the value is an\n     * instance of `Function` and if its string representation includes the\n     * keyword 'class'. This method is useful for distinguishing classes from\n     * other function types in JavaScript.\n     *\n     * @param {*} value - The value to be checked.\n     * @returns {boolean} Returns `true` if the value is a class, otherwise\n     * `false`.\n     */\n    isClass(value) {\n      return value instanceof Function && !!/^class\\s/.exec(String(value))\n    },\n\n    /**\n     * The `ifClass` function checks if a given value is a class and returns\n     * one of two provided values based on the result. This function is a\n     * convenience method for performing conditional operations based on the\n     * type of a value.\n     *\n     * @param {*} value - The value to be checked. If this is a class,\n     * `thenValue` is returned, otherwise `elseValue` is returned.\n     * @param {*} thenValue - The value to be returned if `value` is a class.\n     * @param {*} elseValue - The value to be returned if `value` is not a\n     * class.\n     * @returns {*} Returns `thenValue` if `value` is a class, otherwise returns\n     * `elseValue`.\n     *\n     * @example\n     * // Suppose we have a class and a regular function\n     * class MyClass {}\n     * function myFunction() {}\n     *\n     * // Using ifClass\n     * console.log(Function.ifClass(MyClass, 'Class', 'Not Class'));\n     * // Output: 'Class'\n     * console.log(Function.ifClass(myFunction, 'Class', 'Not Class'));\n     * // Output: 'Not Class'\n     */\n    ifClass(value, thenValue, elseValue) {\n      return isThenElse(this.isClass(value), thenValue, elseValue)\n    },\n\n    /**\n     * Checks if a given value is a regular function. This method verifies if\n     * the value is an instance of `Function`, which includes regular functions,\n     * classes, and async functions but excludes arrow functions.\n     *\n     * @param {*} value - The value to be checked.\n     * @returns {boolean} Returns `true` if the value is a regular function,\n     * otherwise `false`.\n     */\n    isFunction(value) {\n      return value instanceof Function && !Function.isClass(value);\n    },\n\n    /**\n     * The `ifFunction` method checks if a given value is a regular function\n     * and returns one of two provided values based on the result. This method\n     * is a convenience for performing conditional operations based on the\n     * type of a value.\n     *\n     * @param {*} value - The value to be checked. If this is a function,\n     * `thenValue` is returned, otherwise `elseValue` is returned.\n     * @param {*} thenValue - The value to be returned if `value` is a function.\n     * @param {*} elseValue - The value to be returned if `value` is not a\n     * function.\n     * @returns {*} Returns `thenValue` if `value` is a function, otherwise\n     * returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a function and a non-function value\n     * function myFunction() {}\n     * let notFunction = \"I'm not a function\";\n     *\n     * // Using ifFunction\n     * console.log(Function.ifFunction(myFunction, 'Function', 'Not Function'));\n     * // Output: 'Function'\n     * console.log(Function.ifFunction(notFunction, 'Function', 'Not Function'));\n     * // Output: 'Not Function'\n     */\n    ifFunction(value, thenValue, elseValue) {\n      return isThenElse(this.isFunction(value), thenValue, elseValue)\n    },\n\n    /**\n     * The function checks if a given value is a generator function\n     *\n     * @param {any} value - The `value` parameter is the value that we want to\n     * check if it is a generator function.\n     * @returns {boolean} `true` if the value is an instance of a function and\n     * its string tag is 'GeneratorFunction', otherwise it returns `false`.\n     */\n    isGenerator(value) {\n      const stringTag = getStringTag(value)\n\n      return (\n        value instanceof Function &&\n        stringTag == 'GeneratorFunction'\n      )\n    },\n\n    /**\n     * The `ifGenerator` method checks if a given value is a generator function\n     * and returns one of two provided values based on the result. This method\n     * is a convenience for performing conditional operations based on the\n     * type of a value.\n     *\n     * @param {*} value - The value to be checked. If this is a generator\n     * function, `thenValue` is returned, otherwise `elseValue` is returned.\n     * @param {*} thenValue - The value to be returned if `value` is a generator\n     * function.\n     * @param {*} elseValue - The value to be returned if `value` is not a\n     * generator function.\n     * @returns {*} Returns `thenValue` if `value` is a generator function,\n     * otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a generator function and a non-generator function\n     * function* myGenerator() {}\n     * function myFunction() {}\n     *\n     * // Using ifGenerator\n     * console.log(Function.ifGenerator(myGenerator, 'Generator', 'Not Generator'));\n     * // Output: 'Generator'\n     * console.log(Function.ifGenerator(myFunction, 'Generator', 'Not Generator'));\n     * // Output: 'Not Generator'\n     */\n    ifGenerator(value, thenValue, elseValue) {\n      return isThenElse(this.isGenerator(value), thenValue, elseValue)\n    },\n\n    /**\n     * This method modifies the behavior of the `instanceof` operator for a\n     * given class. It does this by defining a custom `Symbol.hasInstance`\n     * method on the class. The custom method checks if the string tag of the\n     * instance matches the name of the class or if the instance is part of\n     * the prototype chain of the class.\n     *\n     * @param {Function} Class - The class for which to modify the behavior\n     * of the `instanceof` operator.\n     *\n     * @example\n     * // Suppose we have a class `MyClass`\n     * class MyClass {}\n     *\n     * // And an instance of the class\n     * const myInstance = new MyClass();\n     *\n     * // Before applying `StringTagHasInstance`, `instanceof` works as usual\n     * console.log(myInstance instanceof MyClass); // Output: true\n     *\n     * // Now we apply `StringTagHasInstance` to `MyClass`\n     * FunctionExtensions.patches.StringTagHasInstance(MyClass);\n     *\n     * // `instanceof` now checks the string tag and the prototype chain\n     * console.log(myInstance instanceof MyClass); // Output: true\n     */\n    StringTagHasInstance(Class) {\n      Object.defineProperty(Class, Symbol.hasInstance, {\n        value: function stringTagAwareHasInstance(fn) {\n          const protoChain = getPrototypeChainEntries(fn)\n          return (\n            fn[Symbol.toStringTag] === this.name ||\n            fn instanceof this\n          )\n        }\n      })\n    },\n  },\n})\n\nconst {\n  isAsyncGenerator: pIsAsyncGenerator,  ifAsyncGenerator: pIfAsyncGenerator,\n  isAsync: pIsAsync,                    ifAsync: pIfAsync,\n  isBigArrow: pIsBigArrow,              ifBigArrow: pIfBigArrow,\n  isBound: pIsBound,                    ifBound: pIfBound,\n  isClass: pIsClass,                    ifClass: pIfClass,\n  isFunction: pIsFunction,              ifFunction: pIfFunction,\n  isGenerator: pIsGenerator,            ifGenerator: pIfGenerator,\n} = FunctionExtensions.patches\n\nexport const FunctionPrototypeExtensions = new Patch(Function.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Determines if a given value is an asynchronous function. It checks if the\n     * value is an instance of `Function` and if its string representation\n     * includes the keyword 'Async'. This method is particularly useful for\n     * identifying async functions.\n     *\n     * @returns {boolean} Returns `true` if the value is an async function,\n     * otherwise `false`.\n     */\n    get isAsync() {\n      return pIsAsync(this)\n    },\n\n    /**\n     * The `ifAsync` method checks if the current function is asynchronous and\n     * returns one of two provided values based on the result. This method is\n     * a convenience for performing conditional operations based on the\n     * type of a function.\n     *\n     * @param {*} thenValue - The value to be returned if the function is\n     * asynchronous.\n     * @param {*} elseValue - The value to be returned if the function is not\n     * asynchronous.\n     * @returns {*} Returns `thenValue` if the function is asynchronous,\n     * otherwise returns `elseValue`.\n     * @see {@link Function.ifAsync}\n     *\n     * @example\n     * // Suppose we have an async function and a non-async function\n     * async function myAsyncFunction() {}\n     * function myFunction() {}\n     *\n     * // Using ifAsync\n     * console.log(myAsyncFunction.ifAsync('Async', 'Not Async'));\n     * // Output: 'Async'\n     * console.log(myFunction.ifAsync('Async', 'Not Async'));\n     * // Output: 'Not Async'\n     */\n    ifAsync(thenValue, elseValue) {\n      return pIfAsync(this, thenValue, elseValue)\n    },\n\n    /**\n     * The function checks if a given value is an async generator function\n     *\n     * @returns {boolean} `true` if the value is an instance of a function and\n     * its string tag is 'AsyncGeneratorFunction', otherwise it returns `false`.\n     */\n    get isAsyncGenerator() {\n      return pIsAsyncGenerator(this)\n    },\n\n    /**\n     * The `ifAsyncGenerator` method checks if the current function is an\n     * asynchronous generator and returns one of two provided values based on\n     * the result. This method is a convenience for performing conditional\n     * operations based on the type of a function.\n     *\n     * @param {*} thenValue - The value to be returned if the function is an\n     * asynchronous generator.\n     * @param {*} elseValue - The value to be returned if the function is not\n     * an asynchronous generator.\n     * @returns {*} Returns `thenValue` if the function is an asynchronous\n     * generator, otherwise returns `elseValue`.\n     * @see {@link Function.ifAsyncGenerator}\n     *\n     * @example\n     * // Suppose we have an async generator function and a non-async function\n     * async function* myAsyncGeneratorFunction() {}\n     * function myFunction() {}\n     *\n     * // Using ifAsyncGenerator\n     * console.log(myAsyncGeneratorFunction.ifAsyncGenerator(\n     *   'Async Generator', 'Not Async Generator'\n     * ));\n     * // Output: 'Async Generator'\n     * console.log(myFunction.ifAsyncGenerator(\n     *   'Async Generator', 'Not Async Generator'\n     * ));\n     * // Output: 'Not Async Generator'\n     */\n    ifAsyncGenerator(thenValue, elseValue) {\n      return pIfAsyncGenerator(this, thenValue, elseValue)\n    },\n\n    /**\n     * Checks if a given value is an arrow function. It verifies if the value is\n     * an instance of `Function`, if its string representation includes the '=>'\n     * symbol, and if it lacks a prototype, which is a characteristic of arrow\n     * functions in JavaScript.\n     *\n     * @returns {boolean} Returns `true` if the value is an arrow function,\n     * otherwise `false`.\n     */\n    get isBigArrow() {\n      return pIsBigArrow(this)\n    },\n\n    /**\n     * Checks if the current function is a \"big arrow\" function and\n     * returns one of two provided values based on the result.\n     *\n     * A \"big arrow\" function is an arrow function that is not bound\n     * to a specific context and does not have its own `this` value.\n     *\n     * @param {*} thenValue - The value to be returned if the function\n     * is a \"big arrow\" function.\n     * @param {*} elseValue - The value to be returned if the function\n     * is not a \"big arrow\" function.\n     * @returns {*} Returns `thenValue` if the function is a \"big arrow\"\n     * function, otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a \"big arrow\" function and a regular function\n     * const bigArrowFn = () => {}\n     * function regularFn() {}\n     *\n     * // Using ifBigArrow\n     * console.log(bigArrowFn.ifBigArrow('Big Arrow', 'Not Big Arrow'))\n     * // Output: 'Big Arrow'\n     * console.log(regularFn.ifBigArrow('Big Arrow', 'Not Big Arrow'))\n     * // Output: 'Not Big Arrow'\n     */\n    ifBigArrow(thenValue, elseValue) {\n      return pIfBigArrow(this, thenValue, elseValue)\n    },\n\n    /**\n     * Determines if a given value is a bound function. Bound functions are\n     * created using the `Function.prototype.bind` method, which allows setting\n     * the `this` value at the time of binding. This method checks if the value\n     * is an instance of `Function`, if its string representation starts with\n     * 'bound', and if it lacks a `prototype` property. These characteristics\n     * are indicative of bound functions in JavaScript.\n     *\n     * @returns {boolean} Returns `true` if the value is a bound function,\n     * otherwise `false`. Bound functions have a specific format in their\n     * string representation and do not have their own `prototype` property.\n     */\n    get isBound() {\n      return pIsBound(this)\n    },\n\n    /**\n     * Checks if the current function is bound and returns one of two\n     * provided values based on the result.\n     *\n     * A bound function is a function that has a fixed `this` value and\n     * may have preset arguments. It is created using the\n     * `Function.prototype.bind` method.\n     *\n     * @param {*} thenValue - The value to be returned if the function\n     * is bound.\n     * @param {*} elseValue - The value to be returned if the function\n     * is not bound.\n     * @returns {*} Returns `thenValue` if the function is bound,\n     * otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a bound function and a regular function\n     * const boundFn = function() {}.bind(null)\n     * function regularFn() {}\n     *\n     * // Using ifBound\n     * console.log(boundFn.ifBound('Bound', 'Not Bound'))\n     * // Output: 'Bound'\n     * console.log(regularFn.ifBound('Bound', 'Not Bound'))\n     * // Output: 'Not Bound'\n     */\n    ifBound(thenValue, elseValue) {\n      return pIfBound(this, thenValue, elseValue)\n    },\n\n    /**\n     * Determines if a given value is a class. It checks if the value is an\n     * instance of `Function` and if its string representation includes the\n     * keyword 'class'. This method is useful for distinguishing classes from\n     * other function types in JavaScript.\n     *\n     * @returns {boolean} Returns `true` if the value is a class, otherwise\n     * `false`.\n     */\n    get isClass() {\n      return pIsClass(this)\n    },\n\n    /**\n     * Checks if the current function is a class and returns one of two\n     * provided values based on the result.\n     *\n     * A class is a special type of function in JavaScript that is\n     * defined using the `class` keyword. It serves as a blueprint for\n     * creating objects and encapsulates data and behavior.\n     *\n     * @param {any} thenValue - The value to be returned if the function\n     * is a class.\n     * @param {any} elseValue - The value to be returned if the function\n     * is not a class.\n     * @returns {any} Returns `thenValue` if the function is a class,\n     * otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a class and a regular function\n     * class MyClass {}\n     * function myFunction() {}\n     *\n     * // Using ifClass\n     * console.log(MyClass.ifClass('Class', 'Not Class'))\n     * // Output: 'Class'\n     * console.log(myFunction.ifClass('Class', 'Not Class'))\n     * // Output: 'Not Class'\n     */\n    ifClass(thenValue, elseValue) {\n      return pIfClass(this, thenValue, elseValue)\n    },\n\n    /**\n     * Checks if a given value is a regular function. This method verifies if\n     * the value is an instance of `Function`, which includes regular functions,\n     * classes, and async functions but excludes arrow functions.\n     *\n     * @returns {boolean} Returns `true` if the value is a regular function,\n     * otherwise `false`.\n     */\n    get isFunction() {\n      return pIsFunction(this)\n    },\n\n    /**\n     * Checks if the current function is a regular function and returns\n     * one of two provided values based on the result.\n     *\n     * A regular function is an instance of `Function`, which includes\n     * regular functions, classes, and async functions but excludes\n     * arrow functions.\n     *\n     * @param {any} thenValue - The value to be returned if the function\n     * is a regular function.\n     * @param {any} elseValue - The value to be returned if the function\n     * is not a regular function.\n     * @returns {any} Returns `thenValue` if the function is a regular\n     * function, otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a regular function and an arrow function\n     * function regularFunction() {}\n     * const arrowFunction = () => {}\n     *\n     * // Using ifFunction\n     * console.log(regularFunction.ifFunction('Regular', 'Not Regular'))\n     * // Output: 'Regular'\n     * console.log(arrowFunction.ifFunction('Regular', 'Not Regular'))\n     * // Output: 'Not Regular'\n     */\n    ifFunction(thenValue, elseValue) {\n      return pIfFunction(this, thenValue, elseValue)\n    },\n\n    /**\n     * The function checks if a given value is a generator function\n     *\n     * @returns {boolean} `true` if the value is an instance of a function and\n     * its string tag is 'GeneratorFunction', otherwise it returns `false`.\n     */\n    get isGenerator() {\n      return pIsGenerator(this)\n    },\n\n    /**\n     * Checks if the current function is a generator function and\n     * returns one of two provided values based on the result.\n     *\n     * A generator function is a special type of function that can be\n     * paused and resumed, allowing it to yield multiple values over\n     * time rather than returning a single value.\n     *\n     * @param {any} thenValue - The value to be returned if the\n     * function is a generator function.\n     * @param {any} elseValue - The value to be returned if the\n     * function is not a generator function.\n     * @returns {any} Returns `thenValue` if the function is a\n     * generator function, otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a generator function and a regular function\n     * function* generatorFunction() {\n     *   yield 1\n     *   yield 2\n     *   yield 3\n     * }\n     * function regularFunction() {}\n     *\n     * // Using ifGenerator\n     * console.log(generatorFunction.ifGenerator('Generator', 'Regular'))\n     * // Output: 'Generator'\n     * console.log(regularFunction.ifGenerator('Generator', 'Regular'))\n     * // Output: 'Regular'\n     */\n    ifGenerator(thenValue, elseValue) {\n      return pIfGenerator(this, thenValue, elseValue)\n    },\n\n    /**\n     * Retrieves the properties of the current function and its prototype.\n     *\n     * This method uses the `getClassProperties` function from the\n     * `FunctionExtensions.patches` object to get all the properties of the\n     * current function and its prototype. The properties include both\n     * enumerable and non-enumerable properties, as well as properties\n     * defined with symbols.\n     *\n     * @returns {Array} An array containing the function itself, its property\n     * descriptors, its prototype, and the prototype's property descriptors.\n     *\n     * @example\n     * // Suppose we have a function with a property and a prototype property\n     * function MyFunction() {}\n     * MyFunction.myProp = 'hello';\n     * MyFunction.prototype.myProtoProp = 'world';\n     *\n     * // Using getClassProperties\n     * const result = MyFunction.getClassProperties();\n     * console.log(result);\n     * // Output: [MyFunction, { myProp: { value: 'hello', writable: true,\n     * // enumerable: true, configurable: true } }, MyFunction.prototype,\n     * // { myProtoProp: { value: 'world', writable: true, enumerable: true,\n     * // configurable: true } }]\n     */\n    getClassProperties() {\n      return FunctionExtensions.patches.getClassProperties(this)\n    },\n  },\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  function isFunction(value) { typeof value === 'function' }\n\n  if (arguments.length > 1) {\n    var _then = isFunction(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = isFunction(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n\nfunction hasStringTag(value) {\n  return Object.isObject(value) && Reflect.has(value, Symbol.toStringTag)\n}\n\nfunction getStringTag(value, strict = false) {\n  if (Object.hasStringTag(value)) {\n    return value[Symbol.toStringTag]\n  }\n\n  if (strict) {\n    return undefined\n  }\n\n  if (value && (typeof value === 'function')) {\n    return value.name\n  }\n\n  return /\\s(.+)]/.exec(Object.prototype.toString.call(value))[1];\n}\n\nfunction getPrototypeChainEntries(object) {\n  const entries = []\n\n  let prototype = Object.getPrototypeOf(object)\n  while (prototype) {\n    const descriptors = Reflect.ownKeys(prototype).reduce((acc, key) => {\n      acc[key] = Object.getOwnPropertyDescriptor(prototype, key)\n      return acc\n    }, {})\n\n    entries.push([prototype, descriptors])\n\n    prototype = Object.getPrototypeOf(prototype)\n  }\n\n  return entries\n}", "/**\n * Transforms an array into an object using a provided transform\n * function.\n *\n * @function transduceFrom\n * @param {Array} array - The array to transform.\n * @param {Function} transform - The function used to transform each\n *   element of the array. It should return an object with 'key' and\n *   'value' properties.\n * @param {Object} [into={}] - The object to transform the array into.\n * @returns {Object} The transformed object.\n * @example\n * const array = [{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }]\n * const transform = (element) => ({ key: element.id, value: element.name })\n * transduceFrom(array, transform)\n * // => { 1: 'John', 2: 'Jane' }\n */\nexport function tryIgnore(code) {\n  try { return code() } catch(ignore) { return undefined }\n}\n\nexport function transduceFrom(array, transform, into = {}) {\n  if (typeof transform !== 'function') {\n    return into\n  }\n\n  return array.reduce((accumulator, element) => {\n    const { key, value } = (transform?.(element) ?? {})\n    if (key && value) {\n      accumulator[key] = value\n    }\n\n    return accumulator\n  }, into)\n}\n\n/**\n * Transforms a COHandler instance into an object with 'key' and 'value'\n * properties.\n *\n * @function transduceFromCOHandler\n * @param {COHandler} element - The COHandler instance to transform.\n * @returns {Object} An object with 'key' and 'value' properties, where\n *   'key' is the 'property' of the COHandler instance and 'value' is\n *   the COHandler instance itself.\n * @example\n * const handler = new COHandler('foo')\n * transduceFromCOHandler(handler)\n * // => { key: 'foo', value: handler }\n */\nexport function transduceFromCOHandler(element) {\n  const result = {}\n\n  if (element instanceof COPropertyHandler) {\n    result.key = element.property\n    result.value = element\n  }\n\n  return result\n}\n\n/**\n * Creates a transducer function by partially applying the 'array' and\n * 'transform' arguments to the 'transduceFrom' function.\n *\n * @function makeTransducer\n * @param {Array} array - The array to transform.\n * @param {Function} transform - The function used to transform each\n *   element of the array.\n * @returns {Function} A transducer function that takes an 'into' object\n *   and returns the result of calling 'transduceFrom' with the provided\n *   'array', 'transform', and 'into' arguments.\n * @example\n * const array = [{ id: 1, name: 'John' }, { id: 2, name: 'Jane' }]\n * const transform = (element) => ({ key: element.id, value: element.name })\n * const transducer = makeTransducer(array, transform)\n * transducer({ 3: 'Jim' })\n * // => { 1: 'John', 2: 'Jane', 3: 'Jim' }\n */\nexport function makeTransducer(array, transform) {\n  return transduceFrom.bind(null, array, transform)\n}\n\n/**\n * A class for handling property descriptors during object copying.\n * @class\n * @example\n * const handler = new COPropertyHandler('foo', (prop, descriptor) => {\n *   descriptor.enumerable = false\n *   return descriptor\n * })\n * handler.handle('foo', { value: 42, writable: true, enumerable: true })\n * // => { value: 42, writable: true, enumerable: false }\n */\nexport class COPropertyHandler {\n  /**\n   * The name of the property this handler is responsible for.\n   * @type {string|undefined}\n   */\n  property = undefined;\n\n  /**\n   * The property handler. When provided and invoked, it will receive\n   * a the property name of the value being handled, the current\n   * descriptor to transform, and the object into which values are\n   * currently being copied into.\n   *\n   * The result must be a COPropertyHandler response type, which can\n   * be made with {@link COPropertyHandler.makeResponse} and which\n   * can be validated with {@link COPropertyHandler.isResponse}.\n   *\n   * The handler should have the following parameters\n   *  - {string} property - The name of the property being handled.\n   *  - {Object} curDescriptor - The property descriptor to handle.\n   *  - {Object} destination - The destination object into which\n   *    properties are being copied.\n   *\n   * An should return\n   *  - {Object} a `COPropertyHandler.Response` type object which\n   *    can be made with {@link COPropertyHandler.makeResponse}.\n   *\n   * @type {function|undefined}\n   */\n  handler = undefined;\n\n  /**\n   * Creates a new COPropertyHandler instance.\n   * @param {string} [property] - The name of the property to handle.\n   * @param {function} [handler] - The function to handle the property\n   * descriptor.\n   */\n  constructor(property, handler) {\n    Object.assign(this, { property, handler })\n  }\n\n  /**\n   * Handles a property descriptor using the registered handler function.\n   * @param {string} property - The name of the property being handled.\n   * @param {Object} descriptor - The property descriptor to handle.\n   * @returns {Object} The resulting property descriptor after handling.\n   */\n  handle(property, descriptor, destination) {\n    if (this.handler) {\n      return COPropertyHandler.defaultHandle(\n        property,\n        descriptor,\n        this.handler,\n      )\n    }\n\n    return descriptor\n  }\n\n  /**\n   * The default property descriptor handler.\n   *\n   * @param {string} property - The name of the property being handled.\n   * @param {Object} curDescriptor - The property descriptor to handle.\n   * @param {Object} destination - The destination object into which\n   * properties are being copied.\n   * @param {function} handler - The function to handle the property\n   * descriptor.\n   * @returns {Object} a `COPropertyHandler.Response` type object which\n   * can be made with {@link COPropertyHandler.makeResponse}.\n   */\n  static defaultHandle(property, curDescriptor, destination, handler) {\n    if (typeof handler === 'function') {\n      try {\n        const {\n          descriptor,\n          flow\n        } = handler(property, curDescriptor, destination)\n        return this.makeResponse(descriptor, flow)\n      }\n      catch (ignore) { }\n    }\n\n    return this.makeResponse(curDescriptor)\n  }\n\n  /**\n   * Creates a COPropertyHandler response object.\n   *\n   * @param {Object} descriptor - The property descriptor.\n   * @param {string} [flow=COPropertyHandler.kNoChange] - The flow control\n   * directive. Must be one of the values from\n   * {@link COPropertyHandler.flowTypes} if provided.\n   * @returns {COPropertyHandler.Response} The response object.\n   * @example\n   * COPropertyHandler.makeResponse({ value: 42, writable: false })\n   * // => {\n   * //   newDescriptor: { value: 42, writable: false },\n   * //   flow: 'nochange'\n   * // }\n   */\n  static makeResponse(descriptor, flow) {\n    return {\n      newDescriptor: descriptor,\n      flow: flow ?? this.kNoChange,\n      get [Symbol.toStringTag]() { return 'COPropertyHandler.Response' }\n    }\n  }\n\n  /**\n   * Checks if a value is a valid COPropertyHandler response object.\n   * @param {*} value - The value to check.\n   * @returns {boolean} `true` if the value is a response object, `false`\n   * otherwise.\n   * @example\n   * COPropertyHandler.isResponse({\n   *   newDescriptor: { value: 42 },\n   *   flow: 'nochange'\n   * })\n   * // => true\n   */\n  static isResponse(value) {\n    return (\n      value && typeof value === 'object' &&\n      value[Symbol.toStringTag] === 'COPropertyHandler.Response'\n    )\n  }\n\n  /**\n   * The flow control directive indicating no change in flow.\n   * @type {string}\n   */\n  static get kNoChange() { return 'nochange' }\n\n  /**\n   * The flow control directive indicating to continue the loop.\n   * @type {string}\n   */\n  static get kContinue() { return 'continue' }\n\n  /**\n   * The flow control directive indicating to break the loop.\n   * @type {string}\n   */\n  static get kBreak() { return 'break' }\n\n  /**\n   * An array of all valid flow control directive values.\n   * @type {string[]}\n   */\n  static get flowTypes() {\n    return [this.kNoChange, this.kContinue, this.kBreak]\n  }\n\n  /**\n   * An object mapping flow control directive values to their\n   * corresponding string representations.\n   * @type {Object.<string, string>}\n   */\n  static get flowEnum() {\n    return {\n      [this.kNoChange]: this.kNoChange,\n      [this.kContinue]: this.kContinue,\n      [this.kBreak]: this.kBreak,\n    }\n  }\n}\n\n/**\n * Returns an object containing getter functions that return Symbol\n * values representing different visibility configurations for object\n * properties.\n *\n * @function\n * @name kVisibilityKeys\n * @returns {Object} An object with the following properties:\n * @property {symbol} mutablyHidden - Returns a Symbol representing a\n *   property that is not enumerable but is configurable.\n * @property {symbol} mutablyVisible - Returns a Symbol representing a\n *   property that is both enumerable and configurable.\n * @property {symbol} immutablyHidden - Returns a Symbol representing\n *   a property that is neither enumerable nor configurable.\n * @property {symbol} immutablyVisible - Returns a Symbol representing\n *   a property that is enumerable but not configurable.\n * @property {symbol} flexiblyHidden - Returns a Symbol representing a\n *   property that is not enumerable, writable and not configurable.\n * @property {symbol} flexiblyVisible - Returns a Symbol representing\n *   a property that is both enumerable and writable, but not\n *   configurable.\n * @property {Generator} keys - Returns a generator that yields the\n *   string keys of the visibility configurations.\n * @property {Generator} symbols - Returns a generator that yields the\n *   Symbol values of the visibility configurations.\n * @property {Generator} entries - Returns a generator that yields\n *   [key, Symbol] pairs for each visibility configuration.\n * @property {Generator} descriptors - Returns a generator that yields\n *   [key, descriptor] pairs for each visibility configuration, where\n *   descriptor is the parsed JSON representation of the Symbol's\n *   description.\n * @property {Generator} [Symbol.iterator] - Returns the same generator\n *   as the symbols property, allowing the object to be iterated over\n *   directly to access the Symbol values.\n *\n * @example\n * const { mutablyHidden, mutablyVisible } = kVisibilityKeys()\n *\n * const obj = {\n *   [mutablyHidden]: 'hidden value',\n *   [mutablyVisible]: 'visible value',\n * }\n *\n * console.log(obj) // { [Symbol()]: 'visible value' }\n * console.log(obj[mutablyHidden]) // 'hidden value'\n * console.log(obj[mutablyVisible]) // 'visible value'\n *\n * @example\n * const visibilityKeys = kVisibilityKeys()\n *\n * for (const key of visibilityKeys.keys()) {\n *   console.log(key)\n * }\n * // Output:\n * // 'mutablyHidden'\n * // 'mutablyVisible'\n * // 'immutablyHidden'\n * // 'immutablyVisible'\n * // 'flexiblyHidden'\n * // 'flexiblyVisible'\n *\n * @example\n * const visibilityKeys = kVisibilityKeys()\n *\n * for (const symbol of visibilityKeys) {\n *   console.log(symbol)\n * }\n * // Output:\n * // Symbol({\"enumerable\":false,\"configurable\":true})\n * // Symbol({\"enumerable\":true,\"configurable\":true})\n * // Symbol({\"enumerable\":false,\"configurable\":false})\n * // Symbol({\"enumerable\":true,\"configurable\":false})\n * // Symbol({\"enumerable\":false,\"writable\":true})\n * // Symbol({\"enumerable\":true,\"writable\":true})\n */\nexport function kVisibilityKeys() {\n  const keys = {\n    get mutablyHidden() {\n      return Symbol.for(JSON.stringify({\n        enumerable: false,\n        configurable: true,\n      }))\n    },\n\n    get mutablyVisible() {\n      return Symbol.for(JSON.stringify({\n        enumerable: true,\n        configurable: true,\n      }))\n    },\n\n    get immutablyHidden() {\n      return Symbol.for(JSON.stringify({\n        enumerable: false,\n        configurable: false,\n      }))\n    },\n\n    get immutablyVisible() {\n      return Symbol.for(JSON.stringify({\n        enumerable: true,\n        configurable: false,\n      }))\n    },\n\n    get flexiblyHidden() {\n      return Symbol.for(JSON.stringify({\n        enumerable: false,\n        configurable: false,\n        writable: true,\n      }))\n    },\n\n    get flexiblyVisible() {\n      return Symbol.for(JSON.stringify({\n        enumerable: true,\n        configurable: false,\n        writable: true,\n      }))\n    },\n  }\n\n  const enumerated = {\n    mutablyHidden: keys.mutablyHidden,\n    mutablyVisible: keys.mutablyVisible,\n    immutablyHidden: keys.immutablyHidden,\n    immutablyVisible: keys.immutablyVisible,\n    flexiblyHidden: keys.flexiblyHidden,\n    flexiblyVisible: keys.flexiblyVisible,\n  }\n\n  function *keyGenerator() {\n    for (const key of Object.keys(enumerated)) { yield key }\n  }\n\n  function *symbolGenerator() {\n    for (const value of Object.values(enumerated)) { yield value }\n  }\n\n  function *entryGenerator() {\n    for (const entry of Object.entries(enumerated)) { yield entry }\n  }\n\n  function *descriptorGenertor() {\n    for (const [key, value] of entryGenerator()) {\n      yield [key, JSON.parse(value.description)]\n    }\n  }\n\n  Object.defineProperties(keys, {\n    enumeration: { get() { return enumerated }, enumerable: false },\n    keys: { get() { return keyGenerator() }, enumerable: false },\n    symbols: { get() { return symbolGenerator() }, enumerable: false},\n    entries: { get() { return entryGenerator() }, enumerable: false},\n    descriptors: { get() { return descriptorGenertor() }, enumerable: false },\n    descriptorFor: {\n      value(symbol) {\n        try {\n          return JSON.parse(symbol.description)\n        }\n        catch (ignored) {}\n        return undefined\n      },\n      enumerable: false\n    },\n    [Symbol.iterator]: { get() { return symbolGenerator() } },\n  })\n\n  return keys\n}\n\n/**\n * An object containing Symbol values representing different visibility\n * configurations for object properties.\n *\n * @constant {Object} VisibilityKeys\n * @property {symbol} mutablyHidden - A Symbol representing a property\n *   that is not enumerable but is configurable.\n * @property {symbol} mutablyVisible - A Symbol representing a property\n *   that is both enumerable and configurable.\n * @property {symbol} immutablyHidden - A Symbol representing a property\n *   that is neither enumerable nor configurable.\n * @property {symbol} immutablyVisible - A Symbol representing a property\n *   that is enumerable but not configurable.\n * @property {symbol} flexiblyHidden - A Symbol representing a property\n *   that is not enumerable, writable and not configurable.\n * @property {symbol} flexiblyVisible - A Symbol representing a property\n *   that is both enumerable and writable, but not configurable.\n */\nexport const VisibilityKeys = kVisibilityKeys()\n\n/**\n * A class for handling property descriptors during object copying based\n * on a specified visibility key.\n *\n * @class VisibilityScopeHandler\n * @extends COPropertyHandler\n * @param {symbol} visibilityKey - The visibility key to use for handling\n *   property descriptors.\n * @example\n * const handler = new VisibilityScopeHandler(VisibilityKeys.mutablyHidden)\n * handler.handle('foo', { value: 42, writable: true, enumerable: true })\n * // => { value: 42, writable: true, enumerable: false }\n */\nexport class VisibilityScopeHandler extends COPropertyHandler {\n  overrides = undefined;\n\n  /**\n   * Creates a new VisibilityScopeHandler instance.\n   *\n   * @constructor\n   * @param {symbol} visibilityKey - The visibility key to use for handling\n   *   property descriptors.\n   */\n  constructor(visibilityKey) {\n    super(visibilityKey, (property, descriptor, dest, source) => {\n      let data = descriptor?.value\n      if (!descriptor || typeof descriptor.value !== 'object') {\n        return COPropertyHandler.makeResponse(descriptor, 'nochange')\n      }\n\n      if (!data && (descriptor?.get || descriptor?.set)) {\n        const newDescriptor = this.applyOverridesTo(descriptor)\n        return COPropertyHandler.makeResponse(newDescriptor, 'nochange')\n      }\n\n      data = customCopyObject({deep: false}, {}, data ?? {})\n      this.walkAndApply(data)\n      descriptor.value = data\n\n      return COPropertyHandler.makeResponse(descriptor, 'continue')\n    })\n\n    tryIgnore(() => this.overrides = JSON.parse(property.description))\n  }\n\n  applyOverridesTo(existingDescriptor, overwrite = false) {\n    const allowed = ['value','get','set','writable','configurable','enumerable']\n    const output = overwrite ? existingDescriptor : { ...existingDescriptor }\n    for (let [key, value] of Object.entries(this.overrides ?? {})) {\n      if (!~allowed.indexOf(key)) {\n        continue\n      }\n\n      if (!(\n        ['get','set'].some(k => k === key) &&\n        ['undefined', 'function'].some(t => typeof value === t)\n      )) {\n        continue\n      }\n\n      if (!(\n        ['enumerable','configurable','writable'].some(k => k === key) &&\n        typeof value !== 'boolean'\n      )) {\n        value = !!value\n      }\n\n      delete output[key]\n      output[key] = value\n    }\n    return output\n  }\n\n  walkAndApply(to) {\n    Reflect.ownKeys(to).forEach(key => {\n      tryIgnore(() => {\n        let result = Object.getOwnPropertyDescriptor(to, key)\n        this.applyOverridesTo(result, true)\n        Object.defineProperty(to, key, result)\n      })\n    })\n  }\n}\n\n/**\n * A handler for mutably visible properties during object copying.\n * @class\n * @extends VisibilityScopeHandler\n * @example\n * const handler = new MutablyVisibleHandler()\n * const sharedHandler = MutablyVisibleHandler.shared\n */\nexport class MutablyVisibleHandler extends VisibilityScopeHandler {\n  constructor() { super(VisibilityKeys.mutablyVisible) }\n  static get shared() {\n    return this.#singleton ?? (this.#singleton = new this)\n  }\n  static #singleton\n}\n\n/**\n * A handler for mutably hidden properties during object copying.\n * @class\n * @extends VisibilityScopeHandler\n * @example\n * const handler = new MutablyHiddenHandler()\n * const sharedHandler = MutablyHiddenHandler.shared\n */\nexport class MutablyHiddenHandler extends VisibilityScopeHandler {\n  constructor() { super(VisibilityKeys.mutablyHidden) }\n  static get shared() {\n    return this.#singleton ?? (this.#singleton = new this)\n  }\n  static #singleton\n}\n\n/**\n * A handler for immutably visible properties during object copying.\n * @class\n * @extends VisibilityScopeHandler\n * @example\n * const handler = new ImmutablyVisibleHandler()\n * const sharedHandler = ImmutablyVisibleHandler.shared\n */\nexport class ImmutablyVisibleHandler extends VisibilityScopeHandler {\n  constructor() { super(VisibilityKeys.immutablyVisible) }\n  static get shared() {\n    return this.#singleton ?? (this.#singleton = new this)\n  }\n  static #singleton\n}\n\n/**\n * A handler for immutably hidden properties during object copying.\n * @class\n * @extends VisibilityScopeHandler\n * @example\n * const handler = new ImmutablyHiddenHandler()\n * const sharedHandler = ImmutablyHiddenHandler.shared\n */\nexport class ImmutablyHiddenHandler extends VisibilityScopeHandler {\n  constructor() { super(VisibilityKeys.immutablyHidden) }\n  static get shared() {\n    return this.#singleton ?? (this.#singleton = new this)\n  }\n  static #singleton\n}\n\n/**\n * A handler for flexibly visible properties during object copying.\n * @class\n * @extends VisibilityScopeHandler\n * @example\n * const handler = new FlexiblyVisibleHandler()\n * const sharedHandler = FlexiblyVisibleHandler.shared\n */\nexport class FlexiblyVisibleHandler extends VisibilityScopeHandler {\n  constructor() { super(VisibilityKeys.flexiblyVisible) }\n  static get shared() {\n    return this.#singleton ?? (this.#singleton = new this)\n  }\n  static #singleton\n}\n\n/**\n * A handler for flexibly hidden properties during object copying.\n * @class\n * @extends VisibilityScopeHandler\n * @example\n * const handler = new FlexiblyHiddenHandler()\n * const sharedHandler = FlexiblyHiddenHandler.shared\n */\nexport class FlexiblyHiddenHandler extends VisibilityScopeHandler {\n  constructor() { super(VisibilityKeys.flexiblyHidden) }\n  static get shared() {\n    return this.#singleton ?? (this.#singleton = new this)\n  }\n  static #singleton\n}\n\nObject.defineProperties(COPropertyHandler, {\n  MutablyHiddenHandler: { get() { return MutablyHiddenHandler.shared } },\n  MutablyVisibleHandler: { get() { return MutablyVisibleHandler.shared } },\n  ImmutablyHiddenHandler: { get() { return ImmutablyHiddenHandler.shared } },\n  ImmutablyVisibleHandler: { get() { return ImmutablyVisibleHandler.shared } },\n  FlexiblyHiddenHandler: { get() { return FlexiblyHiddenHandler.shared } },\n  FlexiblyVisibleHandler: { get() { return FlexiblyVisibleHandler.shared } },\n  handlers: {\n    value: [\n      MutablyHiddenHandler, MutablyVisibleHandler, ImmutablyHiddenHandler,\n      ImmutablyVisibleHandler, FlexiblyHiddenHandler, FlexiblyVisibleHandler,\n    ].map(klass => klass.shared),\n    configurable: true,\n    enumerable: true\n  },\n})\n\n/**\n * Creates a deep or shallow copy of the provided source objects and merges\n * them into the destination object. The function uses a Set to keep track\n * of visited objects to avoid circular references.\n *\n * @function\n * @name copyObject\n * @param {boolean} deep - If true, performs a deep copy, otherwise performs\n * a shallow copy.\n * @param {object} destination - The object to which properties will be copied.\n * @param {...object} sources - The source object(s) from which properties\n * will be copied.\n * @returns {object} The destination object with the copied properties.\n *\n * @example\n* // Shallow copy\n* const obj1 = { a: 1, b: { c: 2 } };\n* const obj2 = { b: { d: 3 }, e: 4 };\n* const result = copyObject(false, obj1, obj2);\n* console.log(result); // Output: { a: 1, b: { d: 3 }, e: 4 }\n*\n* @example\n* // Deep copy\n* const obj1 = { a: 1, b: { c: 2 } };\n* const obj2 = { b: { d: 3 }, e: 4 };\n* const result = copyObject(true, obj1, obj2);\n* console.log(result); // Output: { a: 1, b: { c: 2, d: 3 }, e: 4 }\n*/\nexport function copyObject(deep, destination, ...sources) {\n  const options = {\n    deep: deep || false,\n    propertyHandlers: COPropertyHandler?.handlers ?? [],\n  }\n\n  return customCopyObject(options, destination, ...sources)\n}\n\nexport function customCopyObject(_options, _destination, ..._sources) {\n  const visited = new Set()\n  const [options, destination, sources] = ccoParseArgs(\n    _options, _destination, ..._sources\n  )\n\n  let { deep } = options\n\n  for (const source of sources) {\n    if (source === null || typeof source !== 'object' || visited.has(source)) {\n      continue\n    }\n\n    visited.add(source)\n    const keys = Reflect.ownKeys(source)\n    for (let key of keys) {\n      let descriptor\n\n      try {\n        descriptor = Object.getOwnPropertyDescriptor(source, key)\n      } catch (err) {\n        console.warn(`Failed to get descriptor for key \"${key}\": ${err}`)\n        continue\n      }\n\n      const isDataDesc = Reflect.has(descriptor, 'value')\n      const keyedValue = descriptor?.value\n\n      const conditionsMet = [\n        isDataDesc,\n        keyedValue,\n        typeof keyedValue === 'object',\n        !visited.has(keyedValue)\n      ].every(condition => condition)\n\n      if (conditionsMet) {\n        visited.add(keyedValue)\n\n        const prototype = Object.getPrototypeOf(keyedValue)\n        const descriptors = Object.getOwnPropertyDescriptors(keyedValue)\n        const replacement = Object.create(prototype, descriptors)\n\n        descriptor.value = deep\n          ? customCopyObject(options, replacement, keyedValue)\n          : replacement\n      }\n\n      try {\n        Object.defineProperty(destination, key, descriptor)\n      } catch (err) {\n        console.error(`Failed to define property \"${key}\": ${err}`)\n      }\n  }\n}\n\n return destination\n}\n\nfunction ccoParseArgs(options, destination, ...sources) {\n  // Parse options\n  let { deep = true, propertyHandlers = [] } = options\n\n  // Ensure boolean'ness\n  deep = !!deep\n\n  // Ensure propertyHandlers are converted for our ease of use\n  // Transform 1: Ensure array of COPropertyHandlers at the\n  // cost of potentially having none\n  propertyHandlers = (Array.isArray(propertyHandlers)\n    ? propertyHandlers\n    : [propertyHandlers]\n  ).filter(element => element instanceof COPropertyHandler)\n\n  // Transform 2: Convert array of handlers into an object keyed\n  // as { [handler.property]: handler }\n  const transducer = makeTransducer(propertyHandlers, transduceFromCOHandler)\n  propertyHandlers = transducer({})\n\n  // Rebuild options in the case that we recurse\n  options = { deep, propertyHandlers }\n\n  // Ensure sources have only objects\n  sources = sources.filter(source => source && typeof source === 'object')\n\n  // Ensure the destination is not null\n  if (!destination) {\n    destination = {}\n  }\n\n  return [ options, destination, sources ]\n}\n\nexport default copyObject", "const map = new Map([\n  ['object', Object],       [Object, 'object'],       ['Object', Object],\n  ['number', Number],       [Number, 'number'],       ['Number', Number],\n  ['string', String],       [String, 'string'],       ['String', String],\n  ['function', Function],   [Function, 'function'],   ['Function', Function],\n  ['boolean', Boolean],     [Boolean, 'boolean'],     ['Boolean', Boolean],\n  ['bigint', BigInt],       [BigInt, 'bigint'],       ['BigInt', BigInt],\n  ['symbol', Symbol],       [Symbol, 'symbol'],       ['Symbol', Symbol],\n  ['undefined', undefined], [undefined, 'undefined'],\n  ['null', null],           [null, 'null'],\n])\n\n/**\n * Utility functions to check the type and properties of a value.\n */\nexport const is = {\n  /**\n   * Checks if a value matches a specified type or class.\n   *\n   * This function determines if the provided value matches the specified\n   * type or class. It supports both primitive types and class constructors.\n   *\n   * @param {*} value - The value to check.\n   * @param {*} typeOrClass - The type or class to compare against.\n   * @returns {boolean} True if the value matches the type or class,\n   *   false otherwise.\n   *\n   * @example\n   * // Returns true\n   * is.a(42, 'number')\n   *\n   * @example\n   * // Returns true\n   * is.a(new Date(), Date)\n   *\n   * @example\n   * // Returns false\n   * is.a('string', Number)\n   */\n  a(value, typeOrClass) {\n    const valueType = typeof value\n    const valueTag = this.object(value) && value[Symbol.toStringTag]\n\n    if (value === typeOrClass)\n      return true\n\n    if (this.function(typeOrClass)) {\n      const typeTag = this.object(typeOrClass) && typeOrClass[Symbol.toStringTag]\n\n      if (valueTag && valueTag === typeOrClass.name)\n        return true\n\n      if (typeOrClass?.prototype && value instanceof typeOrClass)\n        return true\n\n      return map.get(valueType) === typeOrClass\n    }\n\n    else if (map.get(valueType)?.name === typeOrClass)\n      return true\n\n    else if (valueType === typeOrClass || valueTag === typeOrClass)\n      return true\n\n    return false\n  },\n\n  /**\n   * Check if a value is an accessor descriptor.\n   *\n   * An accessor descriptor is an object that describes the configuration of a\n   * property on an object, specifically focusing on the 'get' and 'set'\n   * attributes. Computed accessor descriptors are invalid if they also have\n   * a `value` and/or `writable` property.\n   *\n   * @param value The value to check.\n   * @returns True if the value is an accessor descriptor, false otherwise.\n   *\n   * @example\n   * // Returns true\n   * is.accessorDescriptor({ get: () => 42, set: () => {} })\n   *\n   * // Returns false\n   * is.accessorDescriptor({ value: 42, writable: true })\n   */\n  accessorDescriptor(value) {\n    return !!(\n      this.descriptor(value) &&\n      (value?.get || value?.set) &&\n      value?.writable === undefined &&\n      value?.value === undefined\n    )\n  },\n\n  /**\n   * Check if a value is an array.\n   *\n   * @param value The value to check.\n   * @returns True if the value is an array, false otherwise.\n   *\n   * @example\n   * is.array([1, 2, 3]) // true\n   * is.array('string') // false\n   */\n  array(value) {\n    return Array.isArray(value)\n  },\n\n  /**\n   * Check if a value is a bigint.\n   *\n   * @param value The value to check.\n   * @returns True if the value is a bigint, false otherwise.\n   *\n   * @example\n   * is.bigint(123n) // true\n   * is.bigint(123) // false\n   */\n  bigint(value) {\n    return typeof value === \"bigint\" || value instanceof globalThis?.BigInt\n  },\n\n  /**\n   * Checks if a value is strictly a boolean (true or false).\n   *\n   * This method verifies if the provided value is either `true` or `false`.\n   *\n   * @param {*} value - The value to check.\n   * @returns {boolean} True if the value is a boolean, false otherwise.\n   *\n   * @example\n   * is.boolean(true) // true\n   * is.boolean(false) // true\n   * is.boolean(1) // false\n   * is.boolean(\"true\") // false\n   */\n  boolean(value) {\n    return [true, false].some(bool => bool === value)\n  },\n\n  /**\n   * Check if an object is callable. This function is more or less a\n   * synonym or alias for `is.function()`.\n   *\n   * @param object The object to check.\n   * @returns True if the object is callable, false otherwise.\n   *\n   * @note if you wish to know if a descriptor has a callable `value`,\n   * `get`, or `set` function, use `is.callableDescriptor` instead.\n   *\n   * @example\n   * is.callable(function() {}) // true\n   */\n  callable(object) {\n    return this.function(object)\n  },\n\n  /**\n   * Check if an object is a callable descriptor. It looks to see if the\n   * object represents a descriptor that is callable by checking object\n   * properties named `value`, `get`, and `set`. If any of the three\n   * yields a function type, true is returned.\n   *\n   * @param object The object to check.\n   * @returns True if the object is a callable descriptor, false otherwise.\n   *\n   * @example\n   * is.callableDescriptor({ get: function() {} }) // true\n   * is.callableDescriptor(123) // false\n   *\n   * // Note the differences between these\n   * const object = { get name() { return \"Brie\"; } }\n   * const descriptor = Object.getOwnPropertyDescriptor(object, 'name')\n   * is.callableDescriptor(object) // false\n   * is.callableDescriptor(descriptor) // true\n   */\n  callableDescriptor(object) {\n    const { value, get, set } = this.shiny(object) ? object : {}\n    return [value, get, set].some((val) => this.function(val))\n  },\n\n  /**\n   * Check if a value is a data property descriptor.\n   *\n   * A data descriptor is an object that describes the configuration of a\n   * property on an object, specifically focusing on the 'value' and\n   * 'writable' attributes. The descriptor is invalid if it contains\n   * the accessor descriptors `get` or `set`.\n   *\n   * @param value The value to check.\n   * @returns True if the value is a data descriptor, false otherwise.\n   *\n   * @example\n   * // Returns true\n   * is.dataDescriptor({ value: 42, writable: true })\n   *\n   * // Returns false\n   * is.dataDescriptor({ get: () => 42, set: () => {} })\n   */\n  dataDescriptor(value) {\n    return !!(\n      this.descriptor(value) &&\n      (value?.value !== undefined || value?.writable !== undefined) &&\n      value?.get === undefined &&\n      value?.set === undefined\n    )\n  },\n\n  /**\n   * Check if a value is a property descriptor.\n   *\n   * A property descriptor is an object that describes the configuration of a\n   * property on an object. This function checks if the provided value is an\n   * object and contains any of the standard property descriptor keys.\n   *\n   * @param value The value to check.\n   * @returns True if the value is a property descriptor, false otherwise.\n   *\n   * @example\n   * is.descriptor({ configurable: true, enumerable: false }) // true\n   * is.descriptor({ get: () => {}, set: () => {} }) // true\n   * is.descriptor({}) // false\n   */\n  descriptor(value) {\n    if (!is.object(value)) {\n      return false\n    }\n\n    const _has = (key) => Reflect.has(value, key)\n    const hasBase = [\"configurable\", \"enumerable\"].some((key) => _has(key))\n    const hasData = [\"value\", \"writable\"].some((key) => _has(key))\n    const hasAccess = [\"get\", \"set\"].some((key) => _has(key))\n    return hasBase || hasData || hasAccess\n  },\n\n  /**\n   * Checks if a value is strictly false.\n   *\n   * This method verifies if the provided value is strictly `false`.\n   *\n   * @param {*} value - The value to check.\n   * @returns {boolean} True if the value is strictly false, false otherwise.\n   *\n   * @example\n   * is.false(false) // true\n   * is.false(true) // false\n   * is.false(0) // false\n   */\n  false(value) {\n    return value === false\n  },\n\n  /**\n   * Checks if a value is falsy.\n   *\n   * This method converts the provided value to a boolean and returns\n   * `true` if the value is falsy (i.e., false, 0, \"\", null, undefined,\n   * or NaN).\n   *\n   * @param {*} value - The value to check.\n   * @returns {boolean} True if the value is falsy, false otherwise.\n   *\n   * @example\n   * is.falsy(0) // true\n   * is.falsy(\"\") // true\n   * is.falsy(1) // false\n   * is.falsy(\"hello\") // false\n   */\n  falsy(value) {\n    return !!!value\n  },\n\n  /**\n   * Alias for the `falsy` method.\n   *\n   * This method is an alias for `is.falsy` and performs the same check.\n   *\n   * @param {*} value - The value to check.\n   * @returns {boolean} True if the value is falsy, false otherwise.\n   *\n   * @example\n   * is.falsey(0) // true\n   * is.falsey(\"\") // true\n   * is.falsey(1) // false\n   * is.falsey(\"hello\") // false\n   */\n  falsey(value) {\n    return this.falsy(value)\n  },\n\n  /**\n   * Check if a value is a function.\n   *\n   * @param value The value to check.\n   * @returns True if the value is a function, false otherwise.\n   *\n   * @example\n   * is.function(function() {}) // true\n   * is.function(123) // false\n   */\n  function(value) {\n    return typeof value === \"function\" || value instanceof Function\n  },\n\n  /**\n   * Check if a value is iterable. Depending on the environment, JavaScript\n   * will permit `'string'[Symbol.iterator]()` whereas in some places, you\n   * will need to wrap string in an object first. Since other JSVM provided\n   * environments may or may not be leniant with this, we play it safe by\n   * implicitly object converting values before checking for the symbol. If\n   * a value is already an object, it will simply be passed through.\n   *\n   * @param value The value to check.\n   * @returns True if the value is iterable, false otherwise.\n   *\n   * @example\n   * is.iterable([1, 2, 3]) // true\n   * is.iterable('string') // true\n   * is.iterable(123) // false\n   */\n  iterable(value) {\n    const object = Object(value)\n    return object && Reflect.has(object, Symbol.iterator)\n  },\n\n  /**\n   * Check if a value is null or undefined.\n   *\n   * @param value The value to check.\n   * @returns True if the value is null or undefined, false otherwise.\n   *\n   * @example\n   * is.nullish(null) // true\n   * is.nullish(undefined) // true\n   * is.nullish('value') // false\n   */\n  nullish(value) {\n    return value === null || value === undefined\n  },\n\n  /**\n   * Check if a value is a number.\n   *\n   * @param value The value to check.\n   * @returns True if the value is a number, false otherwise.\n   *\n   * @example\n   * is.number(123) // true\n   * is.number('123') // false\n   */\n  number(value) {\n    return typeof value === \"number\" || value instanceof Number\n  },\n\n  /**\n   * Check if a value is an object.\n   *\n   * @param value The value to check.\n   * @returns True if the value is an object, false otherwise.\n   *\n   * @example\n   * is.object({}) // true\n   * is.object(null) // false\n   */\n  object(value) {\n    return !!(value && typeof value === \"object\")\n  },\n\n  /**\n   * The {@link Object#entries} function returns the properties of a given\n   * value as an array of arrays where each element of the inner arrays is\n   * a valid object key (so one of {@link String}, {@link Number}, or\n   * {@link Symbol}) and the second element is the value of the pair which\n   * can be any type.\n   *\n   * This function vets this criteria and would return true for each entry\n   * in the returned outer array of a call to {@link Object#entries}.\n   *\n   * @param {any} value the value to test\n   * @returns {boolean} true if the value is a valid object entry in the\n   * form of `[key, value]`.\n   */\n  objectEntry(value) {\n    if (!(\n      // Must be an array\n      Array.isArray(value) &&\n\n      // Must have only two elements\n      value.length == 2 &&\n\n      // Must have its first element be string|number|symbol\n      (this.string(value[0]) || this.number(value[0]) || this.symbol(value[0]))\n    )) {\n      return false\n    }\n\n    return true\n  },\n\n  /**\n   * Check if a value is a valid object key. Valid object keys are strings,\n   * numbers, or symbols \u2014 the same types accepted as property keys in\n   * JavaScript objects.\n   *\n   * @param {*} value - The value to check.\n   * @returns {boolean} True if the value is a string, number, or symbol,\n   * false otherwise.\n   *\n   * @example\n   * is.objectKey('name') // true\n   * is.objectKey(0) // true\n   * is.objectKey(Symbol('id')) // true\n   * is.objectKey({}) // false\n   * is.objectKey(null) // false\n   */\n  objectKey(value) {\n    return this.string(value) || this.number(value) || this.symbol(value)\n  },\n\n  /**\n   * Check if a value is a primitive type.\n   *\n   * This function determines if the provided value is one of the JavaScript\n   * primitive types: string, number, boolean, bigint, or symbol.\n   *\n   * @param value The value to check.\n   * @returns True if the value is a primitive type, false otherwise.\n   *\n   * @example\n   * // Returns true\n   * is.primitive('hello')\n   *\n   * // Returns true\n   * is.primitive(123)\n   *\n   * // Returns true\n   * is.primitive(true)\n   *\n   * // Returns true\n   * is.primitive(123n)\n   *\n   * // Returns true\n   * is.primitive(Symbol('symbol'))\n   *\n   * // Returns false\n   * is.primitive({})\n   *\n   * // Returns false\n   * is.primitive([])\n   */\n  primitive(value) {\n    if (this.nullish(value))\n      return true\n\n    return [\"string\", \"number\", \"boolean\", \"bigint\", \"symbol\"].some(\n      (type) => typeof value === type\n    )\n  },\n\n  /**\n   * The use of `typeof` is not a safe guarantor when it comes to Reflect\n   * supported values. Any non-null value that returns a `typeof` either\n   * `object` or `function` should suffice. Note that arrays return 'object'\n   * when run through `typeof`. Shiny is clearly a reference to something\n   * reflective and is much shorter to type. Also, Mal says shiny. :)\n   *\n   * @param value The value to check.\n   * @returns True if the value is an object or a function, false otherwise.\n   *\n   * @example\n   * is.shiny({}) // true\n   * is.shiny(function() {}) // true\n   * is.shiny(123) // false\n   */\n  shiny(value) {\n    return !!(this.object(value) || this.function(value))\n  },\n\n  /**\n   * Check if a value is a string.\n   *\n   * @param value The value to check.\n   * @returns True if the value is a string, false otherwise.\n   *\n   * @example\n   * is.string('hello') // true\n   * is.string(123) // false\n   */\n  string(value) {\n    return typeof value === \"string\" || value instanceof String\n  },\n\n  /**\n   * Checks if a value is a symbol.\n   *\n   * This function determines whether the provided value is of type\n   * 'symbol' or an instance of the Symbol object.\n   *\n   * @param value - The value to check.\n   * @returns True if the value is a symbol, false otherwise.\n   *\n   * @example\n   * is.symbol(Symbol('foo')) // Returns true\n   * is.symbol('foo') // Returns false\n   */\n  symbol(value) {\n    return typeof value === \"symbol\" || value instanceof Symbol\n  },\n\n  /**\n   * Checks if a value is strictly true.\n   *\n   * This method verifies if the provided value is strictly `true`.\n   *\n   * @param {*} value - The value to check.\n   * @returns {boolean} True if the value is strictly true, false otherwise.\n   *\n   * @example\n   * is.true(true) // true\n   * is.true(false) // false\n   * is.true(1) // false\n   */\n  true(value) {\n    return value === true\n  },\n\n  /**\n   * Checks if a value is truthy.\n   *\n   * This method converts the provided value to a boolean and returns\n   * `true` if the value is truthy (i.e., not false, 0, \"\", null, undefined,\n   * or NaN).\n   *\n   * @param {*} value - The value to check.\n   * @returns {boolean} True if the value is truthy, false otherwise.\n   *\n   * @example\n   * is.truthy(1) // true\n   * is.truthy(\"hello\") // true\n   * is.truthy(0) // false\n   * is.truthy(\"\") // false\n   */\n  truthy(value) {\n    return !!value\n  },\n}\n\nexport const si = {\n  /**\n   * Inline if-then-else based on whether value matches a specified type or\n   * class. Delegates the condition check to {@link is#a}.\n   *\n   * @param {*} value - The value to check.\n   * @param {*} typeOrClass - The type or class to compare against.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value matches typeOrClass.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value does not match typeOrClass.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.a(42, 'number', 'yes', 'no') // 'yes'\n   * si.a('str', Number, 'yes', 'no') // 'no'\n   * si.a(42, 'number', () => 'computed', 'no') // 'computed'\n   */\n  a(value, typeOrClass, thenValue, elseValue) {\n    return ifThenElse(is.a(value, typeOrClass), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is an accessor descriptor.\n   * Delegates the condition check to {@link is#accessorDescriptor}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is an accessor descriptor.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not an accessor descriptor.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.accessorDescriptor({ get: () => 42 }, 'yes', 'no') // 'yes'\n   * si.accessorDescriptor({ value: 42 }, 'yes', 'no') // 'no'\n   * si.accessorDescriptor({ get: () => 42 }, () => 'computed', 'no') // 'computed'\n   */\n  accessorDescriptor(value, thenValue, elseValue) {\n    return ifThenElse(is.accessorDescriptor(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is an array.\n   * Delegates the condition check to {@link is#array}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is an array.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not an array.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.array([1, 2, 3], 'yes', 'no') // 'yes'\n   * si.array('string', 'yes', 'no') // 'no'\n   * si.array([1, 2, 3], () => 'computed', 'no') // 'computed'\n   */\n  array(value, thenValue, elseValue) {\n    return ifThenElse(is.array(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a bigint.\n   * Delegates the condition check to {@link is#bigint}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a bigint.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a bigint.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.bigint(123n, 'yes', 'no') // 'yes'\n   * si.bigint(123, 'yes', 'no') // 'no'\n   * si.bigint(123n, () => 'computed', 'no') // 'computed'\n   */\n  bigint(value, thenValue, elseValue) {\n    return ifThenElse(is.bigint(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a boolean.\n   * Delegates the condition check to {@link is#boolean}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a boolean.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a boolean.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.boolean(true, 'yes', 'no') // 'yes'\n   * si.boolean(1, 'yes', 'no') // 'no'\n   * si.boolean(false, () => 'computed', 'no') // 'computed'\n   */\n  boolean(value, thenValue, elseValue) {\n    return ifThenElse(is.boolean(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether object is callable.\n   * Delegates the condition check to {@link is#callable}.\n   *\n   * @param {*} object - The object to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if object is callable.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if object is not callable.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.callable(function() {}, 'yes', 'no') // 'yes'\n   * si.callable(123, 'yes', 'no') // 'no'\n   * si.callable(function() {}, () => 'computed', 'no') // 'computed'\n   */\n  callable(object, thenValue, elseValue) {\n    return ifThenElse(is.callable(object), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether object is a callable descriptor.\n   * Delegates the condition check to {@link is#callableDescriptor}.\n   *\n   * @param {*} object - The object to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if object is a callable descriptor.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if object is not a callable descriptor.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.callableDescriptor({ get: function() {} }, 'yes', 'no') // 'yes'\n   * si.callableDescriptor(123, 'yes', 'no') // 'no'\n   * si.callableDescriptor({ get: function() {} }, () => 'computed', 'no') // 'computed'\n   */\n  callableDescriptor(object, thenValue, elseValue) {\n    return ifThenElse(is.callableDescriptor(object), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a data property descriptor.\n   * Delegates the condition check to {@link is#dataDescriptor}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a data descriptor.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a data descriptor.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.dataDescriptor({ value: 42, writable: true }, 'yes', 'no') // 'yes'\n   * si.dataDescriptor({ get: () => 42 }, 'yes', 'no') // 'no'\n   * si.dataDescriptor({ value: 42 }, () => 'computed', 'no') // 'computed'\n   */\n  dataDescriptor(value, thenValue, elseValue) {\n    return ifThenElse(is.dataDescriptor(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a property descriptor.\n   * Delegates the condition check to {@link is#descriptor}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a property descriptor.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a property descriptor.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.descriptor({ configurable: true }, 'yes', 'no') // 'yes'\n   * si.descriptor({}, 'yes', 'no') // 'no'\n   * si.descriptor({ get: () => {} }, () => 'computed', 'no') // 'computed'\n   */\n  descriptor(value, thenValue, elseValue) {\n    return ifThenElse(is.descriptor(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is strictly false.\n   * Delegates the condition check to {@link is#false}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is strictly false.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not strictly false.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.false(false, 'yes', 'no') // 'yes'\n   * si.false(0, 'yes', 'no') // 'no'\n   * si.false(false, () => 'computed', 'no') // 'computed'\n   */\n  false(value, thenValue, elseValue) {\n    return ifThenElse(is.false(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is falsy.\n   * Delegates the condition check to {@link is#falsy}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is falsy.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not falsy.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.falsy(0, 'yes', 'no') // 'yes'\n   * si.falsy(1, 'yes', 'no') // 'no'\n   * si.falsy('', () => 'computed', 'no') // 'computed'\n   */\n  falsy(value, thenValue, elseValue) {\n    return ifThenElse(is.falsy(value), thenValue, elseValue)\n  },\n\n  /**\n   * Alias for {@link si#falsy}. Inline if-then-else based on whether value\n   * is falsy. Delegates the condition check to {@link is#falsey}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is falsy.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not falsy.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.falsey(0, 'yes', 'no') // 'yes'\n   * si.falsey(1, 'yes', 'no') // 'no'\n   * si.falsey('', () => 'computed', 'no') // 'computed'\n   */\n  falsey(value, thenValue, elseValue) {\n    return ifThenElse(is.falsey(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a function.\n   * Delegates the condition check to {@link is#function}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a function.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a function.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.function(function() {}, 'yes', 'no') // 'yes'\n   * si.function(123, 'yes', 'no') // 'no'\n   * si.function(function() {}, () => 'computed', 'no') // 'computed'\n   */\n  function(value, thenValue, elseValue) {\n    return ifThenElse(is.function(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is iterable.\n   * Delegates the condition check to {@link is#iterable}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is iterable.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not iterable.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.iterable([1, 2, 3], 'yes', 'no') // 'yes'\n   * si.iterable(123, 'yes', 'no') // 'no'\n   * si.iterable('string', () => 'computed', 'no') // 'computed'\n   */\n  iterable(value, thenValue, elseValue) {\n    return ifThenElse(is.iterable(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is null or undefined.\n   * Delegates the condition check to {@link is#nullish}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is nullish.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not nullish.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.nullish(null, 'yes', 'no') // 'yes'\n   * si.nullish('value', 'yes', 'no') // 'no'\n   * si.nullish(undefined, () => 'computed', 'no') // 'computed'\n   */\n  nullish(value, thenValue, elseValue) {\n    return ifThenElse(is.nullish(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a number.\n   * Delegates the condition check to {@link is#number}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a number.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a number.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.number(123, 'yes', 'no') // 'yes'\n   * si.number('123', 'yes', 'no') // 'no'\n   * si.number(123, () => 'computed', 'no') // 'computed'\n   */\n  number(value, thenValue, elseValue) {\n    return ifThenElse(is.number(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is an object.\n   * Delegates the condition check to {@link is#object}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is an object.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not an object.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.object({}, 'yes', 'no') // 'yes'\n   * si.object(null, 'yes', 'no') // 'no'\n   * si.object({}, () => 'computed', 'no') // 'computed'\n   */\n  object(value, thenValue, elseValue) {\n    return ifThenElse(is.object(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a valid object entry.\n   * Delegates the condition check to {@link is#objectEntry}.\n   *\n   * @param {any} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a valid object entry.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a valid object entry.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.objectEntry(['key', 42], 'yes', 'no') // 'yes'\n   * si.objectEntry([1, 2, 3], 'yes', 'no') // 'no'\n   * si.objectEntry(['key', 42], () => 'computed', 'no') // 'computed'\n   */\n  objectEntry(value, thenValue, elseValue) {\n    return ifThenElse(is.objectEntry(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a valid object key.\n   * Delegates the condition check to {@link is#objectKey}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a valid object key.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a valid object key.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.objectKey('name', 'yes', 'no') // 'yes'\n   * si.objectKey({}, 'yes', 'no') // 'no'\n   * si.objectKey(Symbol('id'), () => 'computed', 'no') // 'computed'\n   */\n  objectKey(value, thenValue, elseValue) {\n    return ifThenElse(is.objectKey(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a primitive type.\n   * Delegates the condition check to {@link is#primitive}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a primitive.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a primitive.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.primitive('hello', 'yes', 'no') // 'yes'\n   * si.primitive({}, 'yes', 'no') // 'no'\n   * si.primitive(123, () => 'computed', 'no') // 'computed'\n   */\n  primitive(value, thenValue, elseValue) {\n    return ifThenElse(is.primitive(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is shiny (object or function).\n   * Delegates the condition check to {@link is#shiny}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is shiny.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not shiny.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.shiny({}, 'yes', 'no') // 'yes'\n   * si.shiny(123, 'yes', 'no') // 'no'\n   * si.shiny(function() {}, () => 'computed', 'no') // 'computed'\n   */\n  shiny(value, thenValue, elseValue) {\n    return ifThenElse(is.shiny(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a string.\n   * Delegates the condition check to {@link is#string}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a string.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a string.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.string('hello', 'yes', 'no') // 'yes'\n   * si.string(123, 'yes', 'no') // 'no'\n   * si.string('hello', () => 'computed', 'no') // 'computed'\n   */\n  string(value, thenValue, elseValue) {\n    return ifThenElse(is.string(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is a symbol.\n   * Delegates the condition check to {@link is#symbol}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is a symbol.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not a symbol.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.symbol(Symbol('foo'), 'yes', 'no') // 'yes'\n   * si.symbol('foo', 'yes', 'no') // 'no'\n   * si.symbol(Symbol('foo'), () => 'computed', 'no') // 'computed'\n   */\n  symbol(value, thenValue, elseValue) {\n    return ifThenElse(is.symbol(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else using an arbitrary condition. If condition is a\n   * function, it is called and its result is used as the condition; otherwise\n   * the condition value is evaluated directly.\n   *\n   * @param {function|*} condition - The condition to evaluate. If a function,\n   *   it is called and its return value is used as the condition.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if the condition is truthy.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if the condition is falsy.\n   * @returns {*} The result of thenValue if the condition is truthy,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.then(true, 'yes', 'no') // 'yes'\n   * si.then(false, 'yes', 'no') // 'no'\n   * si.then(() => true, 'yes', 'no') // 'yes'\n   * si.then(() => false, () => 'computed', 'no') // 'no'\n   */\n  then(condition, thenValue, elseValue) {\n    return ifThenElse(\n      is.function(condition) ? condition() : condition,\n      thenValue,\n      elseValue\n    )\n  },\n\n  /**\n   * Inline if-then-else based on whether value is strictly true.\n   * Delegates the condition check to {@link is#true}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is strictly true.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not strictly true.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.true(true, 'yes', 'no') // 'yes'\n   * si.true(1, 'yes', 'no') // 'no'\n   * si.true(true, () => 'computed', 'no') // 'computed'\n   */\n  true(value, thenValue, elseValue) {\n    return ifThenElse(is.true(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is truthy.\n   * Delegates the condition check to {@link is#truthy}.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is truthy.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not truthy.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.truthy(1, 'yes', 'no') // 'yes'\n   * si.truthy(0, 'yes', 'no') // 'no'\n   * si.truthy(\"hello\", () => 'computed', 'no') // 'computed'\n   */\n  truthy(value, thenValue, elseValue) {\n    return ifThenElse(is.truthy(value), thenValue, elseValue)\n  },\n\n  /**\n   * Inline if-then-else based on whether value is undefined.\n   * Delegates the condition check to {@link is#a} with type 'undefined'.\n   *\n   * @param {*} value - The value to check.\n   * @param {function|*} thenValue - Returned (or called and its result\n   *   returned) if value is undefined.\n   * @param {function|*} elseValue - Returned (or called and its result\n   *   returned) if value is not undefined.\n   * @returns {*} The result of thenValue if the condition is true,\n   *   elseValue otherwise. If thenValue or elseValue is a function,\n   *   its return value is used instead.\n   *\n   * @example\n   * si.undefined(undefined, 'yes', 'no') // 'yes'\n   * si.undefined('value', 'yes', 'no') // 'no'\n   * si.undefined(undefined, () => 'computed', 'no') // 'computed'\n   */\n  undefined(value, thenValue, elseValue) {\n    return ifThenElse(is.a(value, 'undefined'), thenValue, elseValue)\n  }\n}\n\n/**\n * Checks if an object contains a specific key.\n *\n * This function determines if the provided object contains the specified key.\n * It supports various types of objects including Map, Set, WeakMap, and\n * WeakSet. For other objects, it uses the Reflect API to check for the key.\n *\n * @param object The object to check.\n * @param key The key to look for in the object.\n * @returns True if the object contains the key, false otherwise.\n *\n * @example\n * // Returns true\n * has(new Map([['key', 'value']]), 'key')\n *\n * @example\n * // Returns false\n * has({}, 'key')\n */\nexport const has = function has(object, key) {\n  if ([Map, Set, WeakMap, WeakSet].some((i) => object instanceof i)) {\n    return object.has(key)\n  }\n\n  return is.shiny(object) && Reflect.has(object, key)\n}\n\nObject.assign(has, {\n  /**\n   * Checks if an object contains all specified keys.\n   *\n   * This function determines if the provided object contains all the keys\n   * specified in the keys array. It supports various types of objects\n   * including Map, Set, WeakMap, and WeakSet. For other objects, it uses\n   * the Reflect API to check for the keys.\n   *\n   * @param object The object to check.\n   * @param keys The array of keys to look for in the object.\n   * @returns True if the object contains all the keys, false otherwise.\n   *\n   * @example\n   * // Returns true\n   * has.all(new Map([\n   *   ['key1', 'value1'], ['key2', 'value2']\n   * ]), ['key1', 'key2'])\n   *\n   * @example\n   * // Returns false\n   * has.all({}, ['key1', 'key2'])\n   */\n  all(object, keys) {\n    if (!is.shiny(object) || !is.array(keys) || !keys.length) {\n      return false\n    }\n\n    return keys.every((key) => has(object, key))\n  },\n\n  /**\n   * Checks if an object contains at least one of the specified keys.\n   *\n   * This function determines if the provided object contains at least one\n   * of the keys specified in the keys array. It supports various types of\n   * objects including Map, Set, WeakMap, and WeakSet. For other objects,\n   * it uses the Reflect API to check for the keys.\n   *\n   * @param object The object to check.\n   * @param keys The array of keys to look for in the object.\n   * @returns True if the object contains at least one of the keys, false\n   * otherwise.\n   *\n   * @example\n   * // Returns true\n   * has.some(new Map([['key1', 'value1'], ['key2', 'value2']]), ['key1'])\n   *\n   * @example\n   * // Returns false\n   * has.some({}, ['key1', 'key2'])\n   */\n  some(object, keys) {\n    if (!is.shiny(object) || !is.array(keys) || !keys.length) {\n      return false\n    }\n\n    return keys.some((key) => has(object, key))\n  },\n\n  /**\n   * Checks if an object has a 'prototype' property.\n   *\n   * This function is one way to determine if a supplied function is a big\n   * arrow function or not. Regular functions and class functions, both\n   * static and instance level, all have prototypes. Only big arrow functions\n   * do not.\n   *\n   * @param {Object} object - The object to check.\n   * @returns {boolean} True if the object has a 'prototype' property,\n   * false otherwise.\n   *\n   * @example\n   * // Returns true\n   * has.prototype(function() {})\n   *\n   * @example\n   * // Returns false\n   * has.prototype(() => {})\n   * has.prototype(5)\n   * has.prototype(true)\n   */\n  prototype(object) {\n    // Shiny objects work with calls to Reflect.has\n    return is.shiny(object) && has(object, 'prototype')\n  },\n\n  /**\n   * Checks if an object has a custom string tag.\n   *\n   * This method determines if the object has a Symbol.toStringTag property,\n   * which is used to customize the behavior of Object.prototype.toString().\n   *\n   * @param object - The object to check.\n   * @returns True if the object has a custom string tag, false otherwise.\n   *\n   * @example\n   * const obj = { [Symbol.toStringTag]: 'CustomObject' }\n   * has.stringTag(obj) // Returns true\n   */\n  stringTag(object) {\n    return is.object(object) && has(object, Symbol.toStringTag)\n  },\n\n  /**\n   * Checks if an object has a custom toPrimitive method.\n   *\n   * This method determines if the object has a Symbol.toPrimitive property,\n   * which is used to convert an object to a primitive value.\n   *\n   * @param object - The object to check.\n   * @returns True if the object has a custom toPrimitive method,\n   * false otherwise.\n   *\n   * @example\n   * const obj = { [Symbol.toPrimitive]: () => 42 }\n   * has.toPrimitive(obj) // Returns true\n   */\n  toPrimitive(object) {\n    return is.object(object) && has(object, Symbol.toPrimitive)\n  },\n\n  /**\n   * Checks if an object has a custom valueOf method.\n   *\n   * This method determines if the object has a valueOf property that is a\n   * function, which is used to convert an object to a primitive value.\n   *\n   * @param object - The object to check.\n   * @returns True if the object has a custom valueOf method, false otherwise.\n   *\n   * @example\n   * const obj = { valueOf: () => 42 }\n   * has.valueOfFn(obj) // Returns true\n   */\n  valueOfFn(object) {\n    return (\n      is.object(object) && Object.hasOwn(object, \"valueOf\") && is.function(object.valueOf)\n    )\n  },\n})\n\nexport const as = {\n  /**\n   * Converts a value to an array if it is iterable.\n   *\n   * @param value The value to convert.\n   * @returns The converted array if the value is iterable, otherwise undefined.\n   *\n   * @example\n   * // Returns [1, 2, 3]\n   * as.array([1, 2, 3])\n   *\n   * @example\n   * // Returns ['s', 't', 'r', 'i', 'n', 'g']\n   * as.array('string')\n   *\n   * @example\n   * // Returns undefined\n   * as.array(123)\n   */\n  array(value) {\n    return (is.iterable(value) && Array.from(value)) || undefined\n  },\n\n  /**\n   * Converts a value to an object. If the supplied value is a primitive\n   * value, in many cases, this will convert it to an object instance of\n   * that type. Numbers, strings, symbols, and big integers, all have\n   * object instance variants. Wrapping them in a call to `Object()` will\n   * convert the primitive into this instance variant.\n   *\n   * @param value The value to convert.\n   * @returns The converted object.\n   *\n   * @example\n   * // Returns { key: 'value' }\n   * as.object({ key: 'value' })\n   *\n   * @example\n   * // String instance as oppposed to primitive string\n   * typeof as.object('string') // 'object'\n   * as.object('string') instanceof String // true\n   * 'string' instanceof String // false\n   *\n   * @example\n   * // Returns {}\n   * as.object(null)\n   */\n  object(value) {\n    return Object(value)\n  },\n\n  /**\n   * Converts a given value to a string. This function handles various types\n   * of values, including null, undefined, objects with custom\n   * [Symbol.toPrimitive] methods, and objects with toString or valueOf\n   * methods.\n   *\n   * @param value The value to convert to a string.\n   * @param use Optional configuration object:\n   *        - description: If true, returns the description of a Symbol.\n   *        - stringTag: If true, returns the [Symbol.toStringTag] value if present.\n   * @returns The string representation of the value.\n   *\n   * @example\n   * // Returns 'null'\n   * as.string(null)\n   *\n   * @example\n   * // Returns '123'\n   * as.string(123)\n   *\n   * @example\n   * // Returns 'custom'\n   * const obj = {\n   *   [Symbol.toPrimitive](hint) {\n   *     if (hint === 'string') return 'custom'\n   *     return null\n   *   }\n   * }\n   * as.string(obj)\n   *\n   * @example\n   * // Returns 'mySymbol'\n   * as.string(Symbol('mySymbol'), { description: true })\n   *\n   * @example\n   * // Returns 'Array'\n   * as.string([], { stringTag: true })\n   */\n  string(\n    value,\n    use = {\n      description: false,\n      stringTag: false,\n    }\n  ) {\n    // Check if the value is null or undefined directly\n    if (value === null || value === undefined) {\n      return String(value)\n    }\n\n    if (is.symbol(value) && use?.description) {\n      return value.description\n    }\n\n    if (has.stringTag(value) && use?.stringTag) {\n      return value[Symbol.toStringTag]\n    }\n\n    // Check if the value has a [Symbol.toPrimitive] method\n    if (is.function(value?.[Symbol.toPrimitive])) {\n      const primitiveValue = value[Symbol.toPrimitive](\"string\")\n      if (is.string(primitiveValue)) {\n        return primitiveValue\n      }\n    }\n\n    // Check if the value has a valueOf method\n    if (is.function(value?.valueOf)) {\n      const valueOfValue = value.valueOf()\n      if (is.string(valueOfValue)) {\n        return valueOfValue\n      }\n      // If valueOf returns a primitive other than string, convert it to string\n      if (!is.object(valueOfValue)) {\n        return String(valueOfValue)\n      }\n    }\n\n    // Check if the value has a toString method\n    if (is.function(value?.toString)) {\n      const stringValue = value.toString()\n      if (is.string(stringValue)) {\n        return stringValue\n      }\n    }\n\n    // Fallback to String() function\n    return String(value)\n  },\n\n  /**\n   * Converts a given value to a string representing an integer.\n   *\n   * This method first converts the value to a number string and then extracts\n   * the integer part by splitting the string at the decimal point.\n   *\n   * @param value The value to convert to an integer string.\n   * @returns The integer part of the value as a string.\n   *\n   * @example\n   * // Returns '123'\n   * as.integerString(123.456)\n   *\n   * @example\n   * // Returns '0'\n   * as.integerString('0.789')\n   */\n  integerString(value) {\n    return this.numberString(value).split(\".\")[0]\n  },\n\n  /**\n   * Converts a given value to a string representing a number.\n   *\n   * This method first converts the value to a string, trims any whitespace,\n   * and removes any non-numeric characters except for '.', 'e', 'E', '+',\n   * and '-'. It then uses a regular expression to match a floating-point\n   * number, allowing an optional leading '+' or '-' sign, digits before\n   * and after a single decimal point.\n   *\n   * @param value The value to convert to a number string.\n   * @returns The sanitized number string or an empty string if no valid\n   * float was found.\n   *\n   * @example\n   * // Returns '123.456'\n   * as.numberString('  123.456abc  ')\n   *\n   * @example\n   * // Returns '-0.789'\n   * as.numberString('-0.789xyz')\n   */\n  numberString(value) {\n    // Trim the input string\n    const string = this.string(value)\n      .trim()\n      .replace(/[^0-9.eE+-]/g, \"\")\n    // Use a regular expression to match a floating-point number\n    // Allow an optional leading '+' or '-' sign, digits before and after a\n    // single decimal point\n    const sanitizedStr = string.match(/^[-+]?\\d*\\.?\\d+([eE][-+]?\\d+)?/)\n\n    // Return the sanitized string or an empty string if no valid float\n    // was found\n    return sanitizedStr ? sanitizedStr[0] : \"\"\n  },\n\n  /**\n   * Converts a given value to a number.\n   *\n   * This method uses the `numberString` method to sanitize the input value\n   * and then converts it to a number.\n   *\n   * @param value The value to convert to a number.\n   * @returns The numeric representation of the value.\n   *\n   * @example\n   * // Returns 123.456\n   * as.number('123.456abc')\n   *\n   * @example\n   * // Returns -0.789\n   * as.number('-0.789xyz')\n   */\n  number(value) {\n    return Number(this.numberString(value))\n  },\n\n  /**\n   * Converts a given value to a bigint.\n   *\n   * This method uses the `integerString` method to sanitize the input value\n   * and then converts it to a bigint.\n   *\n   * @param value The value to convert to a bigint.\n   * @returns The bigint representation of the value.\n   *\n   * @example\n   * // Returns 123n\n   * as.bigint('123.456abc')\n   *\n   * @example\n   * // Returns 0n\n   * as.bigint('0.789xyz')\n   */\n  bigint(value) {\n    const BigInt = globalThis?.BigInt\n    return BigInt(this.integerString(value))\n  },\n\n  /**\n   * Converts a given value to a boolean.\n   *\n   * This method takes a value, converts it to a string, and then checks\n   * if it matches common representations of boolean values. It returns\n   * `true` for \"1\", \"yes\", and \"true\" (case insensitive), and `false`\n   * for \"0\", \"no\", and \"false\" (case insensitive). For any other values,\n   * it returns the boolean representation of the value.\n   *\n   * @param {*} value - The value to convert to a boolean.\n   * @returns {boolean} The boolean representation of the value.\n   *\n   * @example\n   * // Returns true\n   * as.boolean(\"yes\")\n   *\n   * @example\n   * // Returns false\n   * as.boolean(\"no\")\n   *\n   * @example\n   * // Returns true\n   * as.boolean(1)\n   *\n   * @example\n   * // Returns false\n   * as.boolean(0)\n   *\n   * @example\n   * // Returns true\n   * as.boolean(\"true\")\n   *\n   * @example\n   * // Returns false\n   * as.boolean(\"false\")\n   *\n   * @example\n   * // Returns true\n   * as.boolean({})\n   *\n   * @example\n   * // Returns false\n   * as.boolean(null)\n   */\n  boolean(value) {\n    switch (String(value).toLowerCase()) {\n      case \"1\":\n      case \"yes\":\n      case \"true\":\n        return true\n\n      case \"0\":\n      case \"no\":\n      case \"false\":\n        return false\n\n      default:\n        return Boolean(value)\n    }\n  },\n}\n\nexport function createToolkit() {\n  return { si, is, has, as }\n}\n\nexport default {\n  as,\n  has,\n  is,\n  si,\n\n  createToolkit,\n}\n\nfunction ifThenElse(condition, thenCase, elseCase) {\n  if (typeof thenCase === 'undefined' && typeof elseCase === 'undefined')\n    return !!condition\n\n  if (typeof thenCase === 'undefined')\n    thenCase = condition\n\n  if (condition) {\n    if (is.function(thenCase))\n      return thenCase()\n    else\n      return thenCase\n  }\n  else {\n    if (is.function(elseCase))\n      return elseCase()\n    else\n      return elseCase\n  }\n}\n", "import { Patch } from '@nejs/extension'\nimport { FunctionExtensions } from './function.extensions.js'\nimport * as copyObject from './utils/copy.object.js'\nimport { as, has, is, si } from './utils/toolkit.js'\n\nconst { isClass, isFunction } = FunctionExtensions.patches\nconst CustomInspect = Symbol.for('nodejs.util.inspect.custom')\n\nexport const GlobalFunctionsAndProps = new Patch(globalThis, {\n  [Patch.kMutablyHidden]: {\n    /** copyObject suite exports into global */\n    ...copyObject,\n\n    /** Type toolkit exports into global */\n    as, has, is, si,\n\n    /**\n     * The `isThenElse` function is a utility function that behaves like a\n     * ternary operator. It takes three arguments: `boolValue`, `thenValue`,\n     * and `elseValue`.\n     *\n     * It first checks the truthiness of `boolValue`.\n     *\n     * If `boolValue` is truthy, it returns `thenValue`; otherwise,\n     * it returns `elseValue`.\n     *\n     * If `thenValue` or `elseValue` is a function, it will be invoked with\n     * `boolValue` as an argument.\n     *\n     * If `elseValue` is not provided, it returns `boolValue` or `thenValue`\n     * depending on the truthiness of `boolValue`.\n     *\n     * If only `boolValue` is provided, it simply returns `boolValue`.\n     *\n     * @param {any} boolValue - Any object or value that is tested for\n     * truthiness.\n     * @param {function | any} [thenValue] - The value to return if `boolValue`\n     * is truthy. If a function, it's invoked with `boolValue`.\n     * @param {function | any} [elseValue] - The value to return if `boolValue`\n     * is falsy. If a function, it's invoked with `boolValue`.\n     * @returns {boolean | any} The result of the ternary operation.\n     *\n     * @example\n     * // Using values\n     * isThenElse(true, 'yes', 'no');  // Returns: 'yes'\n     * isThenElse(false, 'yes', 'no'); // Returns: 'no'\n     *\n     * // Using functions\n     * isThenElse(true, val => val ? 'yes' : 'no');  // Returns: 'yes'\n     * isThenElse(false, val => val ? 'yes' : 'no'); // Returns: 'no'\n     */\n    isThenElse(boolValue, thenValue, elseValue) {\n      if (arguments.length > 1) {\n        const _then = isFunction(thenValue) ? thenValue(boolValue) : thenValue\n\n        if (arguments.length > 2) {\n          const _else = isFunction(elseValue) ? thenValue(boolValue) : elseValue\n\n          return boolValue ? _then : _else\n        }\n\n        return boolValue || _then\n      }\n\n      return boolValue\n    },\n\n    /**\n     * Transforms an object to mimic a specified prototype, altering its type\n     * conversion and inspection behaviors. This function is especially useful\n     * for creating objects that need to behave like different primitive types\n     * under various operations.\n     *\n     * @param {Object} object - The object to be transformed.\n     * @param {Function|Object} [prototype=String.prototype] - The prototype or\n     * class to emulate. If a function is provided, its prototype is used.\n     * Defaults to String.prototype.\n     * @param {Function} [toPrimitive=(hint, val) => String(val)] - A function\n     * defining how the object should be converted to a primitive value. It\n     * receives a type hint ('number', 'string', or 'default') and the object,\n     * returning the primitive value.\n     * @returns {Object|null} The transformed object, or null if neither a class\n     * nor a prototype could be derived from the provided prototype parameter.\n     */\n    maskAs(object, classPrototype, options) {\n      const {\n        prototype,\n        toPrimitive\n      } = GenericMask({...options, prototype: classPrototype})\n\n      const base = { configurable: true, enumerable: false }\n      const proto = isFunction(prototype) ? prototype.prototype : prototype\n      const klass = isClass(prototype) ? prototype : proto?.constructor\n\n      if (!klass && !proto) {\n        return null\n      }\n\n      Object.setPrototypeOf(object, proto)\n      Object.defineProperties(object, {\n        valueOf: {\n          value() { return String(toPrimitive('default', object)) }, ...base },\n\n        [Symbol.toPrimitive]: {\n          value(hint) { return toPrimitive(hint, object) }, ...base\n        },\n        [Symbol.toStringTag]: { value: klass.name, ...base },\n        [Symbol.species]: { get() { return klass }, ...base },\n        [CustomInspect]: { ...base, value(depth, opts, inspect) {\n          return inspect(this[Symbol.toPrimitive](), { ...opts, depth })\n        }}\n      })\n\n      return object\n    },\n\n    /**\n     * Masks an object as a string-like object by setting its prototype to\n     * String and defining how it converts to primitive types. This is\n     * particularly useful when an object needs to behave like a string in\n     * certain contexts, such as type coercion or logging.\n     *\n     * @param {Object} object - The object to be masked as a string.\n     * @param {string} [stringKey='value'] - The object property key used for\n     * the string representation. Defaults to 'value'.\n     * @param {Function} [toPrimitive] - Optional custom function for primitive\n     * conversion. If omitted, a default function handling various conversion\n     * hints is used.\n     * @returns {Object|null} The string-masked object, or null if the object\n     * doesn't have the specified stringKey property.\n     */\n    maskAsString(\n      object,\n      stringKey,\n      toPrimitive\n    ) {\n      if (object && Reflect.has(object, stringKey)) {\n        return maskAs(object, StringMask(stringKey ?? 'value', toPrimitive))\n      }\n\n      return null\n    },\n\n    /**\n     * Masks an object as a number-like object. This allows the object to\n     * behave like a number in operations like arithmetic and type coercion.\n     * It sets the prototype to Number and defines custom conversion behavior.\n     *\n     * @param {Object} object - The object to be masked as a number\n     * representation. Defaults to 'value'.\n     * @param {Function} [toPrimitive] - Optional custom function for primitive\n     * conversion. If not provided, a default function handling different\n     * conversion hints is used.\n     * @returns {Object|null} The number-masked object, or null if the object\n     * doesn't have the specified numberKey property.\n     */\n    maskAsNumber(\n      object,\n      numberKey,\n      toPrimitive\n    ) {\n      if (object && Reflect.has(object, numberKey)) {\n        return maskAs(object, NumberMask(numberKey ?? 'value', toPrimitive))\n      }\n\n      return null\n    },\n\n    /**\n     * Generates options for generic masking of an object, providing defaults for\n     * prototype and toPrimitive function if not specified.\n     *\n     * @param {Object} options - The options object including prototype,\n     * targetKey, and toPrimitive function.\n     * @returns {Object} The options object with defaults applied as necessary.\n     */\n    GenericMask({ prototype, targetKey = 'value', toPrimitive }) {\n      const options = { targetKey, toPrimitive, prototype };\n\n      if (!isFunction(toPrimitive)) {\n        options.toPrimitive = (hint, object) => {\n          let property = object[targetKey];\n          let isNum = (\n            (typeof property === 'number' && Number.isFinite(property)) ||\n            (typeof property === 'string' &&\n              !isNaN(parseFloat(property)) && isFinite(property)\n            )\n          );\n\n          switch (hint) {\n            case 'string':\n              return isNum ? String(property) : (property ?? String(object));\n            case 'number':\n              return isNum ? Number(property) : NaN;\n            case 'default':\n            default:\n              return isNum ? Number(property) : property;\n          }\n        }\n      }\n\n      return options;\n    },\n\n    /**\n     * Generates options for string masking of an object, providing a default\n     * toPrimitive function if not specified.\n     *\n     * @param {string} targetKey - The object property key for string\n     * representation.\n     * @param {Function} toPrimitive - Custom function for primitive conversion.\n     * @returns {Object} Options for string masking.\n     */\n    StringMask(targetKey, toPrimitive) {\n      const options = { targetKey, toPrimitive, prototype: String.prototype }\n\n      if (!isFunction(toPrimitive)) {\n        options.toPrimitive = function toPrimitive(hint, object) {\n          switch (hint) {\n            case 'default': return object[targetKey]\n            case 'number': return parseInt(object[targetKey], 36)\n            case 'string': return String(object[targetKey])\n            default: return object\n          }\n        }\n      }\n\n      return options\n    },\n\n    /**\n     * Generates options for number masking of an object, providing a default\n     * toPrimitive function if not specified.\n     *\n     * @param {string} targetKey - The object property key for number\n     * representation.\n     * @param {Function} toPrimitive - Custom function for primitive conversion.\n     * @returns {Object} Options for number masking.\n     */\n    NumberMask(targetKey, toPrimitive) {\n      const options = { targetKey, toPrimitive, prototype: Number.prototype }\n\n      if (!isFunction(toPrimitive)) {\n        options.toPrimitive = function toPrimitive(hint, object) {\n          switch (hint) {\n            case 'default': return object[targetKey]\n            case 'number': return Number(object[targetKey])\n            case 'string': return String(object[targetKey])\n            default: return object\n          }\n        }\n      }\n\n      return options\n    },\n\n    /**\n     * Blends the properties of multiple objects into a new object. This\n     * function creates a new object that inherits the prototype from the\n     * root object and the properties of the other objects and their parent\n     * prototypes.\n     *\n     * @param {Object} root - The root object to blend prototypes into.\n     * @param {...Object} objects - The objects whose prototypes to blend.\n     * @returns {Object} The new object with blended prototypes.\n     *\n     * @example\n     * // Define some objects with properties\n     * const obj1 = { prop1: 'value1' }\n     * const obj2 = { prop2: 'value2' }\n     * const obj3 = { prop3: 'value3' }\n     *\n     * // Blend the prototypes of obj2 and obj3 into obj1\n     * const blended = blendProtos(obj1, obj2, obj3)\n     *\n     * // Now blended has properties from obj1, obj2, and obj3\n     * console.log(blended.prop1) // Outputs: 'value1'\n     * console.log(blended.prop2) // Outputs: 'value2'\n     * console.log(blended.prop3) // Outputs: 'value3'\n     */\n    blendProtos(root, ...objects) {\n      const descriptor = (o, k) => Object.getOwnPropertyDescriptor(o,k)\n      const parent = o => Object.getPrototypeOf(o)\n      const all = o => (Reflect\n        .ownKeys(o)\n        .reduce((a, k)=>({ ...a, [k]: descriptor(o,k) }), { })\n      )\n\n      const newRoot = Object.create(parent(root), objects.reduce)\n      const protos = objects.map(object => parent(object))\n\n      let descriptors = Object.create(null)\n      let uniques = new Set\n\n      for (let object of protos) {\n        let current = object\n\n        while (current) {\n          if (!uniques.has(current)) {\n            uniques.add(current)\n            descriptors = { ...descriptors, ...all(current) }\n          }\n          current = parent(current)\n        }\n      }\n\n      const blendedPrototype = Object.create(parent(root), descriptors)\n\n      return Object.setPrototypeOf(newRoot, blendedPrototype)\n    },\n  },\n})\n", "import { Patch } from '@nejs/extension'\n\nexport const JSONExtensions = new Patch(JSON, {\n  [Patch.kMutablyHidden]: {\n    extractAllFrom(string) {\n      const pattern = this.JSONStartPattern\n      const notJSON = Symbol(\"Value is not valid JSON\")\n      const decoder = part => {\n        try { return JSON.parse(part) } catch (_) { return notJSON }\n      }\n\n      const parts = []\n      let part = undefined\n\n      while ((part = pattern.exec(string))) {\n        parts.push(decoder(part?.[0]))\n      }\n\n      return parts.filter(isJSON => isJSON !== notJSON)\n    },\n\n    /**\n     * The `extractFrom` method attempts to extract a JSON object from a string.\n     * It uses a regular expression to identify potential JSON objects in the\n     * string and attempts to parse them. If a valid JSON object is found, it is\n     * returned. If no valid JSON object is found, the method returns undefined.\n     *\n     * NOTE: This method will only find JSON from an iterated upon start spot\n     * until the end of the string. So `'JSON follows {\"count\": 0}'` will\n     * return `{count: 0}` but `'JSON follows {\"count\": 0} and more'` will\n     * fail to locate any JSON in the String. You've been warned.\n     *\n     * @param {string} string - The string from which to extract a JSON object.\n     * @returns {Object|undefined} - The first valid JSON object found in the\n     * string, or undefined if no valid JSON object is found.\n     *\n     * @example\n     * // Suppose we have a string with embedded JSON\n     * const str1 = 'Hello {\"name\":\"John\", \"age\":30} World'\n     * const str2 = 'Hello {\"name\": \"John\", \"age\": 30}'\n     *\n     * // Using `extractFrom`\n     * console.log(JSON.extractFrom(str1))  // Output: undefined\n     * console.log(JSON.extractFrom(str2))  // Output: {name: 'John', age: 30}\n     */\n    extractFrom(string) {\n      this.extractAllFrom(string)?.[0]\n    },\n\n    /**\n     * The `mightContain` method checks if a string might contain a JSON object.\n     * It uses the `JSONStartPattern` regular expression to search for potential\n     * JSON objects in the string. If a potential JSON object is found, the method\n     * returns true. If no potential JSON object is found, the method returns false.\n     *\n     * @param {string} string - The string to check for potential JSON objects.\n     * @returns {boolean} - Returns true if the string might contain a JSON object,\n     * false otherwise.\n     *\n     * @example\n     * // Suppose we have a string with embedded JSON\n     * const str = 'Hello {\"name\":\"John\", \"age\":30} World'\n     *\n     * // Using `mightContain`\n     * console.log(JSON.mightContain(str))  // Output: true\n     */\n    mightContain(string, detail = false) {\n      const results = this.JSONStartPattern.exec(string)\n      return detail ? [!!results, results?.index ?? -1, results] : !!results\n    },\n\n    /**\n     * Getter method for the JSONStartPattern.\n     *\n     * This method constructs a regular expression pattern that is used to\n     * identify potential JSON objects in a string. The pattern is designed\n     * to match various JSON data types including null, boolean, number,\n     * string, object, and array.\n     *\n     * The pattern is constructed using an array of strings, each representing\n     * a part of the pattern. The array is then joined into a single string\n     * and passed to the RegExp constructor to create the pattern.\n     *\n     * @returns {RegExp} - The constructed regular expression pattern.\n     *\n     * @example\n     * // Using `JSONStartPattern`\n     * const pattern = JSONStartPattern;\n     * const str = 'Hello {\"name\":\"John\", \"age\":30} World';\n     * const match = pattern.exec(str);\n     * console.log(match[0]);  // Output: '{\"name\":\"John\", \"age\":30}'\n     */\n    get JSONStartPattern() {\n      const pattern = new RegExp([\n        '(?:',                    // Start with a non-capturing group and match\n          '(null)|',              // ...a null\n          '(true|false)|',        // ...a bool\n          '(\\\\d+\\\\.?\\\\d*)|',      // ...a number (including floats)\n          '(\"[^\\\\\"]*(?:[^:])\")|', // ...a double quote (start of string)\n          '((?:\\\\{.*\\\\})+)|',     // ...an open curly brace (object)\n          '((?:\\\\[.*\\\\]+))',      // ...an open square bracket (array)\n        ')+',                     // End of the groups\n      ].join(''), 'gm')\n\n      return pattern\n    },\n  }\n})", "import { Patch } from '@nejs/extension'\n\nexport const MapExtensions = new Patch(Map, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Determines if the supplied `value` is a `Map` object. This check\n     * is performed by first looking for the `Symbol.toStringTag` on the\n     * `value` and checking to see if it is equal to the string \"Map\".\n     * If that check fails, `instanceof` is used as a fallback to check\n     * the prototype chain.\n     *\n     * @param {any} value the value that needs to be checked to determine\n     * if it is a `Map` object or not\n     * @returns {boolean} `true` if the supplied `value` is a `Map`\n     * object, `false` otherwise\n     *\n     * @example\n     * const map = new Map()\n     * isMap(map) // true\n     * isMap(new Set()) // false\n     * isMap([]) // false\n     * isMap({}) // false\n     */\n    isMap(value) {\n      return value?.[Symbol.toStringTag] === Map.name && value instanceof Map\n    },\n\n    /**\n     * Conditionally returns a value based on whether the supplied\n     * `value` is a `Map` object or not. If the `value` is a `Map`\n     * object, the `thenValue` will be returned. If it is not a `Map`\n     * object, the `elseValue` will be returned instead.\n     *\n     * @param {any} value the value to check to determine if it is a\n     * `Map` object\n     * @param {any} thenValue the value to return if the supplied\n     * `value` is a `Map` object\n     * @param {any} elseValue the value to return if the supplied\n     * `value` is not a `Map` object\n     * @returns {any} either the `thenValue` or `elseValue` depending\n     * on if the supplied `value` is a `Map` object\n     *\n     * @example\n     * const map = new Map()\n     * const set = new Set()\n     * ifMap(map, 'is a map', 'not a map') // 'is a map'\n     * ifMap(set, 'is a map', 'not a map') // 'not a map'\n     */\n    ifMap(value, thenValue, elseValue) {\n      return isThenElse(this.isMap(value), thenValue, elseValue)\n    },\n  }\n})\n\nconst { isMap: pIsMap, ifMap: pIfMap } = MapExtensions.patches\n\nexport const MapPrototypeExtensions = new Patch(Map.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Determines if the current object is a `Map` object\n     *\n     * This is a getter that uses the `isMap` function from the\n     * `MapExtensions` patch to check if the current object (`this`) is\n     * a `Map` object\n     *\n     * @type {boolean}\n     * @readonly\n     *\n     * @example\n     * const map = new Map()\n     * console.log(map.isMap) // Output: true\n     *\n     * const notMap = {}\n     * console.log(notMap.isMap) // Output: false\n     */\n    get isMap() {\n      return pIsMap(this)\n    },\n\n    /**\n     * Conditionally returns a value based on whether the current\n     * object is a `Map` object or not\n     *\n     * If the current object is a `Map` object, the `thenValue` will\n     * be returned. If it is not a `Map` object, the `elseValue` will\n     * be returned instead.\n     *\n     * @param {any} thenValue the value to return if the current\n     * object is a `Map` object\n     * @param {any} elseValue the value to return if the current\n     * object is not a `Map` object\n     * @returns {any} either the `thenValue` or `elseValue` depending\n     * on if the current object is a `Map` object\n     *\n     * @example\n     * const map = new Map()\n     * map.ifMap('is a map', 'not a map') // 'is a map'\n     *\n     * const notMap = {}\n     * notMap.ifMap('is a map', 'not a map') // 'not a map'\n     */\n    ifMap(thenValue, elseValue) {\n      return pIfMap(this, thenValue, elseValue)\n    },\n\n    /**\n     * The function `getKey` returns the key associated with a given value\n     * in a map.\n     *\n     * @param {any} value - The value parameter is the value that you want to\n     * find the corresponding key for in the map.\n     * @param [strict=true] - The \"strict\" parameter is a boolean value that\n     * determines whether strict equality (===) or loose equality (==) should\n     * be used when comparing the \"value\" parameter with the values in the\n     * entries of the object. If \"strict\" is set to true, strict equality will\n     * be used.\n     * @returns the key associated with the given value. If a matching key is\n     * found, it is returned. If no matching key is found, null is returned.\n     */\n    getKey(value, strict = true) {\n      for (const [key, entryValue] of this) {\n        if (\n          (strict && value === entryValue) &&\n          (!strict && value == entryValue)\n        ) {\n          return key\n        }\n\n        return null\n      }\n    },\n  },\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  function isFunction(value) { typeof value === 'function' }\n\n  if (arguments.length > 1) {\n    var _then = isFunction(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = isFunction(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n", "import { Patch } from '@nejs/extension'\n\n/**\n * `Math` extensions. Building better worlds...actually just\n * providing some parity between Number and BigInt types for\n * now, but later, better worlds.\n *\n * @type {Patch}\n * @example\n * import { MathExtensions } from 'math.extension.js'\n *\n * MathExtensions.apply()\n * // Now the `Math` class has additional methods available\n */\nexport const MathExtensions = new Patch(Math, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * The Math.min() static method returns the smallest of the numbers given\n     * as input parameters, or Infinity if there are no parameters.\n     *\n     * @param {bigint|number} values value1, \u2026, valueN \u2013 Zero or more numbers\n     * among which the lowest value will be selected and returned.\n     * @returns {bigint|number|NaN|Infinity} The smallest of the given numbers.\n     * Returns NaN if any of the parameters is or is converted into NaN or if\n     * the types of numbers are mismatched (i.e., bigint vs. number types).\n     * Returns Infinity if no parameters are provided.\n     */\n    min(...values) {\n      const sorter = (l,r) => l < r ? -1 : l > r ? 1 : 0\n\n      if (!values.length)\n        return Infinity\n\n      if (values.every(n => typeof n === 'bigint')) {\n        return values.toSorted(sorter).at(0)\n      }\n      else if (values.every(n => typeof n === 'number')) {\n        return values.toSorted(sorter).at(0)\n      }\n      else {\n        return NaN\n      }\n    },\n\n    /**\n     * The Math.max() static method returns the largest of the numbers given\n     * as input parameters, or Infinity if there are no parameters.\n     *\n     * @param {bigint|number} values value1, \u2026, valueN \u2013 Zero or more numbers\n     * among which the largest value will be selected and returned.\n     * @returns {bigint|number|NaN|Infinity} The largest of the given numbers.\n     * Returns NaN if any of the parameters is or is converted into NaN or if\n     * the types of numbers are mismatched (i.e., bigint vs. number types).\n     * Returns Infinity if no parameters are provided.\n     */\n    max(...values) {\n      const sorter = (l,r) => l < r ? -1 : l > r ? 1 : 0\n\n      if (!values.length)\n        return Infinity\n\n      if (values.every(n => typeof n === 'bigint')) {\n        return values.toSorted(sorter).at(-1)\n      }\n      else if (values.every(n => typeof n === 'number')) {\n        return values.toSorted(sorter).at(-1)\n      }\n      else {\n        return NaN\n      }\n    },\n  },\n})", "import { Patch } from '@nejs/extension'\n\n/**\n * A patch for the JavaScript built-in `Number` class that adds utility\n * methods without modifying the global namespace directly\n *\n * This patch includes methods for checking if a value is a number and\n * conditionally returning a value based on whether the supplied value is\n * a number or not.\n *\n * @type {Patch}\n * @property {Object} [Patch.kMutablyHidden] An object containing methods\n * that are hidden from enumeration and mutation\n *\n * @example\n * import { NumberExtensions } from 'number.extension.js'\n *\n * NumberExtensions.apply()\n * // Now the `Number` class has additional methods available\n */\nexport const NumberExtensions = new Patch(Number, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Determines if the supplied `value` is a `Number`. This check is\n     * performed by first converting the `value` to a `Number` using the\n     * `Number()` constructor and checking to see if the result is not\n     * `NaN`. If that check passes, `typeof` is used to ensure that the\n     * original `value` is of type \"number\".\n     *\n     * @param {*} value The value that needs to be checked to determine if it\n     * is a `Number` or not\n     * @returns {boolean} `true` if the supplied `value` is a `Number`,\n     * `false` otherwise\n     *\n     * @example\n     * const num = 42\n     * isNumber(num) // true\n     * isNumber('42') // false\n     * isNumber(NaN) // false\n     * isNumber(Infinity) // true\n     */\n    isNumber(value) {\n      return !isNaN(value) && typeof value === 'number'\n    },\n\n    /**\n     * Checks if all or some of the supplied values are numbers.\n     *\n     * This method uses the `Array.prototype.every` or `Array.prototype.some`\n     * method to check if all or some of the supplied values are numbers,\n     * respectively. The method to use is determined by the `which` parameter.\n     *\n     * @param {string} [which='every'] - Determines the method to use for the\n     * check. Can be either 'every' or 'some'. Defaults to 'every'.\n     * @param {...*} values - The values to check.\n     * @returns {boolean} - Returns `true` if all or some of the values are\n     * numbers (based on the `which` parameter), `false` otherwise.\n     *\n     * @example\n     * areNumbers('every', 1, 2, 3) // true\n     * areNumbers('some', 1, '2', 3) // true\n     * areNumbers('every', 1, '2', 3) // false\n     */\n    areNumbers(which = ['every','some'][0], ...values) {\n      if (which !== 'every' && which !== 'some') {\n        return false\n      }\n\n      return values[which](num => this.isNumber(num))\n    },\n\n    /**\n     * Conditionally returns a value based on whether the supplied `value` is\n     * a `Number` or not. If the `value` is a `Number`, the `thenValue` will\n     * be returned. If it is not a `Number`, the `elseValue` will be\n     * returned instead.\n     *\n     * @param {*} value The value to check to determine if it is a `Number`\n     * @param {*} thenValue The value to return if the supplied `value` is\n     * a `Number`\n     * @param {*} elseValue The value to return if the supplied `value` is\n     * not a `Number`\n     * @returns {*} Either the `thenValue` or `elseValue` depending on if the\n     * supplied `value` is a `Number`\n     *\n     * @example\n     * const num = 42\n     * const str = 'hello'\n     * ifNumber(num, 'is a number', 'not a number') // 'is a number'\n     * ifNumber(str, 'is a number', 'not a number') // 'not a number'\n     */\n    ifNumber(value, thenValue, elseValue) {\n      return isThenElse(this.isNumber(value), thenValue, elseValue)\n    },\n\n    /**\n     * Conditionally returns a value based on whether all or some of the\n     * supplied values are numbers.\n     *\n     * This method uses the `areNumbers` method to check if all or some of\n     * the supplied values are numbers, based on the `which` parameter.\n     * If the condition is met, the `thenValue` is returned, otherwise\n     * the `elseValue` is returned.\n     *\n     * @param {*} thenValue - The value to return if the condition is met.\n     * @param {*} elseValue - The value to return if the condition is not met.\n     * @param {string} [which='every'] - Determines the method to use for the\n     * check. Can be either 'every' or 'some'. Defaults to 'every'.\n     * @param {...*} numbers - The values to check.\n     * @returns {*} Either the `thenValue` or `elseValue` depending on if all\n     * or some of the supplied values are numbers.\n     *\n     * @example\n     * ifNumbers('All are numbers', 'Not all are numbers', 'every', 1, 2, 3)\n     * // returns 'All are numbers'\n     * ifNumbers('At least one is a number', 'None are numbers', 'some', 1, '2', 3)\n     * // returns 'At least one is a number'\n     * ifNumbers('All are numbers', 'Not all are numbers', 'every', 1, '2', 3)\n     * // returns 'Not all are numbers'\n     */\n    ifNumbers(\n      thenValue,\n      elseValue,\n      which = ['every','some'][0],\n      ...numbers\n    ) {\n      return isThenElse(\n        this.areNumbers(which, ...numbers),\n        thenValue,\n        elseValue\n      )\n    },\n\n    /**\n     * Clamps a value between a minimum and maximum value.\n     *\n     * This method checks if the provided value and the min and max bounds are\n     * numbers. If they are not, it returns the original value. If they are,\n     * it ensures that the value does not go below the minimum value or above\n     * the maximum value.\n     *\n     * @param {*} value - The value to clamp.\n     * @param {number} [minValue=-Infinity] - The minimum value. Defaults\n     * to -Infinity.\n     * @param {number} [maxValue=Infinity] - The maximum value. Defaults\n     * to Infinity.\n     * @returns {*} - Returns the clamped value if all parameters are numbers,\n     * otherwise returns the original value.\n     *\n     * @example\n     * clamp(10, 1, 5) // returns 5\n     * clamp(-10, 1, 5) // returns 1\n     * clamp(3, 1, 5) // returns 3\n     * clamp('10', 1, 5) // returns '10'\n     */\n    clamp(value, minValue = -Infinity, maxValue = Infinity) {\n      if (!this.areNumbers('every', value, minValue, maxValue)) {\n        return value\n      }\n\n      return Math.max(minValue, Math.min(maxValue, value))\n    },\n  }\n})\n\nconst { isNumber: pIsNumber, ifNumber: pIfNumber } = NumberExtensions.patches\n\n/**\n * `NumberPrototypeExtensions` provides a set of utility methods that\n * are added to the `Number` prototype. This allows all number instances\n * to access new functionality directly, enhancing their capabilities\n * beyond the standard `Number` class methods.\n *\n * These extensions are applied using the `Patch` class from\n * '@nejs/extension', ensuring that they do not interfere with the\n * global namespace or existing properties.\n *\n * The extensions include methods for checking if a value is a number,\n * conditionally returning values based on whether a value is a number,\n * and more, making number-related tasks more convenient and expressive.\n *\n * @example\n * const num = 42\n * console.log(num.isNumber) // Output: true\n *\n * const notNum = \"123\"\n * console.log(notNum.isNumber) // Output: false\n *\n * @type {Patch}\n */\nexport const NumberPrototypeExtensions = new Patch(Number.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Returns an object representation of the number instance.\n     *\n     * This getter method creates and returns an object that wraps the number\n     * instance, allowing it to be treated as an object. The returned object\n     * is created using the `Object()` constructor, which takes the number\n     * instance as its argument.\n     *\n     * @type {Object}\n     * @readonly\n     *\n     * @example\n     * const num = 42\n     * console.log(typeof num)           // 'number'\n     * console.log(typeof num.instance)  // 'object'\n     */\n    get instance() {\n      return Object(this)\n    },\n\n    /**\n     * Determines if the current object is a number\n     *\n     * This getter uses the `pIsNumber` function from the `NumberExtensions`\n     * patch to check if the current object (`this`) is a number.\n     *\n     * @type {boolean}\n     * @readonly\n     *\n     * @example\n     * const num = 42\n     * console.log(num.isNumber) // Output: true\n     *\n     * const notNum = \"123\"\n     * console.log(notNum.isNumber) // Output: false\n     */\n    get isNumber() {\n      return pIsNumber(this)\n    },\n\n    /**\n     * Checks if the current object is a number and returns the corresponding\n     * value based on the result.\n     *\n     * This method uses the `pIfNumber` function from the `NumberExtensions`\n     * patch to determine if the current object (`this`) is a number. If it is\n     * a number, the `thenValue` is returned. Otherwise, the `elseValue` is\n     * returned.\n     *\n     * @param {any} thenValue The value to return if the current object is\n     * a number\n     * @param {any} elseValue The value to return if the current object is not\n     * a number\n     * @returns {any} The `thenValue` if the current object is a number, or\n     * the `elseValue` if it is not a number\n     *\n     * @example\n     * const num = 42\n     * console.log(num.ifNumber('Is a number', 'Not a number'))\n     * // Output: 'Is a number'\n     *\n     * const notNum = '123'\n     * console.log(notNum.ifNumber('Is a number', 'Not a number'))\n     * // Output: 'Not a number'\n     */\n    ifNumber(thenValue, elseValue) {\n      return pIfNumber(this, thenValue, elseValue)\n    },\n\n    /**\n     * Provides a way when dealing with numbers to determine if\n     * a given number is within a range of values. By default, if\n     * no parameters are supplied, it always returns true since\n     * the default range is -Infinity to +Infinity. Additionally,\n     * by default, the number will always be less than the supplied\n     * max unless inclusive is set to true.\n     *\n     * @param min the lower range value, defaults to -Infinity\n     * @param max the upper range value, defaults to +Infinity\n     * @param inclusive defaults to false, set to true if you\n     * want the max value to less than and equals to\n     * @returns {boolean} true if within the range, false otherwise\n     */\n    within(min = -Infinity, max = Infinity, inclusive = false) {\n      return this >= min && (inclusive ? this <= max : this < max)\n    }\n  }\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  function isFunction(value) { typeof value === 'function' }\n\n  if (arguments.length > 1) {\n    var _then = isFunction(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = isFunction(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n", "import { Extension } from '@nejs/extension'\n\n/**\n * Represents a secure container for storing and retrieving unique symbols\n * associated with data. This class provides methods to add new symbols to\n * the Symkeys and to retrieve data associated with a particular symbol.\n *\n * @example\n* // Create a new Symkeys instance\n* const symkeys = new Symkeys();\n*\n* // Add a symbol with associated data to the Symkeys\n* const mySymbol = Symkeys.add('myIdentifier', { foo: 'bar' });\n*\n* // Retrieve the data using the symbol\n* const myData = Symkeys.dataFor(mySymbol);\n* console.log(myData); // Output: { foo: 'bar' }\n*/\nexport class Symkeys {\n  /**\n   * Adds a new symbol to the Symkeys instance with the given name and\n   * associated data.\n   *\n   * This method generates a unique symbol based on the provided name,\n   * optional domain, separator, and token. It also allows embedding\n   * additional data into the symbol's name.\n   *\n   * @param {string} named - The base name for the new symbol.\n   * @param {Object} options - Additional options for the symbol.\n   * @param {*} [options.associate={}] - Data to associate with the symbol.\n   * @param {Object} [options.embed] - Optional data to embed in the symbol.\n   * @param {string} [options.useDomain] - Optional domain to include in the\n   * symbol's name.\n   * @param {string} [options.useSeparator] - Optional separator to use in\n   * the symbol's name.\n   * @param {string} [options.useToken] - Optional token to use for the\n   * symbol. If not provided, a random token is generated.\n   * @returns {Symbol} The newly created symbol.\n   *\n   * @example\n   * // Add a symbol with associated data\n   * const mySymbol = symkeys.add('myIdentifier', {\n   *   associate: { foo: 'bar' },\n   *   embed: { baz: 'qux' },\n   *   useDomain: 'exampleDomain',\n   *   useSeparator: '-',\n   *   useToken: 'customToken',\n   * })\n   * console.log(mySymbol)\n   * // Symbol(@exampleDomain-myIdentifier {\"baz\":\"qux\"} #customToken)\n   */\n  add(\n    named,\n    {\n      associate = {},\n      embed = undefined,\n      useDomain = undefined,\n      useSeparator = undefined,\n      useToken = undefined,\n    }\n  ) {\n    // Generate a unique token for the symbol\n    const token = useToken ?? Symkeys.token\n\n    // Calculate a name (optionally with domain and separator)\n    let symName = this.calculateName(named, useDomain, useSeparator)\n\n    if (embed && typeof embed === 'object') {\n      try {\n        symName += ` ${JSON.stringify(embed)}`\n      }\n      catch (error) {\n        console.warn(`Cannot create JSON from ${embed}; skipping`)\n      }\n    }\n\n    // Create a symbol using the provided name and the unique token\n    const symbol = Symbol.for(`@${symName} #${token}`)\n\n    // Store the symbol and associated data in the Symkeys's internal map\n    this[Symkeys.kDataKey].set(symbol, associate ?? {})\n\n    // Return the unique symbol for external use\n    return symbol\n  }\n\n  /**\n   * Creates or retrieves a shared symbol key with the given name and\n   * optional associated data.\n   *\n   * This method generates a shared symbol key using the provided name\n   * and optional parameters. If the symbol already exists in the\n   * Symkeys's internal map, it updates the associated data if provided.\n   * Otherwise, it creates a new symbol with the specified parameters.\n   *\n   * @param {string} named - The name to use for the shared symbol key.\n   * @param {Object} options - Optional parameters for the shared symbol key.\n   * @param {Object} [options.associate] - Data to associate with the symbol.\n   * @param {Object} [options.embed] - Data to embed in the symbol's name.\n   * @param {string} [options.useDomain] - Domain to include in the symbol's name.\n   * @param {string} [options.useSeparator] - Separator to use in the symbol's name.\n   * @returns {Symbol} The shared symbol key.\n   *\n   * @example\n   * // Create or retrieve a shared symbol key with associated data\n   * const sharedSymbol = symkeys.sharedKey('mySharedKey', {\n   *   associate: { foo: 'bar' },\n   *   embed: { baz: 'qux' },\n   *   useDomain: 'exampleDomain',\n   *   useSeparator: '-',\n   * })\n   * console.log(sharedSymbol)\n   * // Symbol(@exampleDomain-mySharedKey {\"baz\":\"qux\"} #shared)\n   */\n  sharedKey(named, { associate, embed, useDomain, useSeparator }) {\n    // Calculate the symbol name with optional domain and separator\n    const symName = this.calculateName(named, useDomain, useSeparator)\n\n    // Initialize JSON string for embedded data\n    let json = ''\n    if (embed && typeof embed === 'object') {\n      try {\n        json = ` ${JSON.stringify(embed)}`\n      } catch (ignored) {\n        // Ignore JSON stringify errors\n      }\n    }\n\n    // Create the shared symbol key\n    const symbol = Symbol.for(`@${symName}${json} #shared`)\n\n    // Check if the symbol already exists in the internal map\n    if (this[Symkeys.kDataKey].has(symbol)) {\n      // Update associated data if provided and symbol is a Symkey\n      if (associate && symbol.isSymkey) {\n        symbol.data = associate\n      }\n\n      // Return the existing symbol\n      return symbol\n    }\n\n    // Add a new symbol with the specified parameters\n    return this.add(named, {\n      associate: associate ?? {},\n      embed,\n      useDomain,\n      useSeparator,\n      useToken: 'shared'\n    })\n  }\n\n  /**\n   * Retrieves the data associated with a given symbol from the Symkeys.\n   *\n   * This method allows access to the data that has been associated with a\n   * particular symbol in the Symkeys. It is useful for retrieving stored\n   * information when only the symbol is known.\n   *\n   * @param symbol - The symbol whose associated data is to be\n   * retrieved.\n   * @returns The data associated with the symbol, or undefined if\n   *                   the symbol is not found in the Symkeys.\n   *\n   * @example\n   * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys\n   * // with associated data\n   * const data = Symkeys.dataFor(mySymbol);\n   * console.log(data); // Output: The data associated with 'mySymbol'\n   */\n  data(forSymbol) {\n    return this[Symkeys.kDataKey].get(forSymbol)\n  }\n\n  /**\n   * Deletes the data associated with a given symbol from the Symkeys.\n   *\n   * This method allows removal of the data that has been associated with a\n   * particular symbol in the Symkeys. It is useful when you want to clean up\n   * or remove stored information associated with a symbol.\n   *\n   * @param {Symbol} forSymbol - The symbol whose associated data is to be\n   * deleted.\n   * @param {*} replaceWith - Optionally, if `replaceWith` is not `undefined`,\n   * a new value can be set after the original is deleted\n   * @returns {boolean} - Returns true if an element in the Symkeys existed and\n   * has been removed, or false if the element does not exist\n   *\n   * @example\n   * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys\n   * // with associated data\n   * const isDeleted = Symkeys.deleteData(mySymbol);\n   * console.log(isDeleted); // Output: true if data was deleted, false otherwise\n   */\n  deleteData(forSymbol, replaceWith = undefined) {\n    if (this.hasData(forSymbol)) {\n      const result = this[Symkeys.kDataKey].delete(forSymbol)\n\n      if (replaceWith !== undefined) {\n        this[Symkeys.kDataKey].set(forSymbol, replaceWith)\n      }\n\n      return result\n    }\n\n    return false\n  }\n\n  /**\n   * Checks if the Symkeys instance has data associated with a given symbol.\n   *\n   * This method checks if the Symkeys instance has any data associated with\n   * the provided symbol. It is useful when you need to verify if data exists\n   * for a particular symbol before attempting to retrieve or manipulate it.\n   *\n   * @param {Symbol} forSymbol - The symbol to check for associated data.\n   * @returns {boolean} Returns true if data exists for the symbol, false otherwise.\n   *\n   * @example\n   * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys\n   * // with associated data\n   * const hasData = Symkeys.hasData(mySymbol);\n   * console.log(hasData); // Output: true if data exists, false otherwise\n   */\n  hasData(forSymbol) {\n    return this[Symkeys.kDataKey].has(forSymbol)\n  }\n\n  /**\n   * Sets the data associated with a given symbol in the Symkeys.\n   *\n   * This method allows you to associate data with a particular symbol in the\n   * Symkeys. It is useful when you want to store information that can be\n   * retrieved later using the symbol.\n   *\n   * Note that setting only succeeds if the Symkey symbol has already been\n   * added via {@link Symkeys.add}\n   *\n   * @param {Symbol} forSymbol - The symbol with which the data is to be\n   * associated.\n   * @param {*} value - The data to be associated with the symbol.\n   * @returns {boolean} true if the value has been set, false if the key\n   * has not yet been added via {@link Symkeys.add}\n   *\n   * @example\n   * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys\n   * // and 'myData' is the data to be associated with 'mySymbol'\n   * Symkeys.setData(mySymbol, myData);\n   */\n  setData(forSymbol, value) {\n    if (this.hasData(forSymbol)) {\n      this[Symkeys.kDataKey].set(forSymbol, value)\n      return true\n    }\n    return false\n  }\n\n  /**\n   * Extracts the token part from a symbol created by the `add` method.\n   *\n   * This method parses the string representation of a symbol to retrieve\n   * the unique token that was appended to the symbol's name upon creation.\n   * It is useful for debugging or for operations that require knowledge of\n   * the token associated with a symbol.\n   *\n   * @param symbol - The symbol whose token is to be extracted.\n   * @returns The extracted token or undefined if the\n   * token cannot be extracted.\n   *\n   * @example\n   * // Assuming 'mySymbol' is a symbol created with the name 'myEntry'\n   * // and a token 'agftofxob6f'\n   * const token = Symkeys.tokenFor(mySymbol);\n   * console.log(token); // Output: 'agftofxob6f'\n   */\n  token(forSymbol) {\n    // Use a regular expression to match the token pattern in the symbol\n    // description exists on symbol but our JS output target is too old\n    return /^.* \\#(.*?)$/.exec(forSymbol)?.description?.[1];\n  }\n\n  /**\n   * Retrieves the separator used in the Symkeys instance.\n   *\n   * This getter method allows access to the separator that is used to\n   * distinguish between different parts of a symbol in the Symkeys instance.\n   * It is useful when you need to know the separator for parsing symbols or\n   * constructing new ones.\n   *\n   * @returns {string} The separator used in the Symkeys instance.\n   *\n   * @example\n   * // Assuming the Symkeys instance has a separator '.'\n   * const separator = Symkeys.separator;\n   * console.log(separator); // Output: '.'\n   */\n  get separator() {\n    return this[kSeparator]\n  }\n\n  /**\n   * Retrieves an iterator for the symbols stored in the Symkeys.\n   *\n   * This method provides access to the symbols that have been stored in\n   * the Symkeys. It returns an iterator which can be used to loop over\n   * all the symbols. This is particularly useful for iterating through\n   * all stored data without knowing the individual symbols in advance.\n   *\n   * @returns An iterator that yields all the symbols\n   * stored in the Symkeys.\n   *\n   * @example\n   * // Assuming the Symkeys has symbols stored\n   * for (const symbol of Symkeys.symbols()) {\n   *   console.log(symbol);\n   * }\n   */\n  symbols() {\n    // Retrieve the keys (symbols) from the Symkeys data map and return\n    // the iterator.\n    return this[Symkeys.kDataKey].keys();\n  }\n\n  /**\n   * Calculates a name by combining a provided name, domain, and separator.\n   *\n   * This method takes a provided name, domain, and separator as input and\n   * constructs a new name by combining these elements. If the domain or\n   * separator are not provided, it uses the default domain and separator\n   * stored in the Symkeys instance. If the provided name starts with the\n   * separator, it removes the leading separator from the name.\n   *\n   * If the domain ends with the separator, it removes the trailing separator\n   * from the domain. If the domain is empty, it sets the separator to an\n   * empty string.\n   *\n   * @param {string} providedName - The name to be used in the calculation.\n   * @param {string} [useDomain] - The domain to be used in the calculation.\n   * If not provided, the default domain of the Symkeys instance is used.\n   * @param {string} [useSeparator] - The separator to be used in the\n   * calculation. If not provided, the default separator of the Symkeys\n   * instance is used.\n   * @returns {string} The calculated name.\n   *\n   * @example\n   * // Assuming the Symkeys instance has a domain 'symkeys.internal'\n   * // and a separator '.'\n   * const name = Symkeys.calculateName('feature', 'symkeys.public', '/');\n   * console.log(name); // Output: 'symkeys.public/feature'\n   */\n  calculateName(providedName, useDomain, useSeparator) {\n    let domain = String(useDomain || this[Symkeys.kDomain])\n    let separator = String(useSeparator || this[Symkeys.kSeparator])\n    let postfix = (String(providedName).startsWith(separator)\n      ? providedName.substring(1)\n      : providedName\n    )\n\n    if (domain.length) {\n      if (domain.endsWith(separator)) {\n        domain = domain.substring(0, domain.length - 1)\n      }\n    }\n    else {\n      separator = ''\n    }\n\n    return `${domain}${separator}${postfix}`\n  }\n\n  /**\n   * Constructs a new instance of the Symkeys, setting up a proxy to\n   * intercept and manage access to properties.\n   *\n   * This constructor initializes the Symkeys with a proxy that\n   * overrides the default behavior for property access, checking, and\n   * enumeration. It allows the Symkeys to behave like a map for its\n   * own properties, while also maintaining the prototype chain.\n   *\n   * @param {string} domain an optional prefix string, to which the\n   * `separator` parameter value will be guaranteed to have in between\n   * the domain (if truthy) and the name of the added key.\n   * @param {string} separator defaults to a period. So if your domain\n   * is 'symkeys.internal' then calling {@link add()} with a name of\n   * `\"feature\"` will result in the full name being\n   * `\"symkeys.internal.feature\"`\n   *\n   * @example\n   * const Symkeys = new Symkeys();\n   * Symkeys[Symbol.for('myProperty')] = 'myValue';\n   * console.log(Symkeys[Symbol.for('myProperty')]); // 'myValue'\n   */\n  constructor(domain = '', separator = '.') {\n    // Create a prototype from the parent class to maintain the chain.\n    const prototype = Object.create(Object.getPrototypeOf(this))\n\n    // Store the original prototype for potential future use.\n    this[Symkeys.kPrototype] = prototype\n\n    // Create map for this instance\n    this[Symkeys.kDataKey] = new Map()\n\n    // Store the domain\n    this[Symkeys.kDomain] = (typeof domain === 'string' && domain)\n\n    // Store the separator\n    this[Symkeys.kSeparator] = separator\n\n    // Access the internal map that stores Symkeys data.\n    const map = this[Symkeys.kDataKey];\n\n    // Replace the instance's prototype with a proxy that manages\n    // property access and manipulation.\n    Object.setPrototypeOf(\n      this,\n      new Proxy(Object.create(prototype), {\n        // Return the stored prototype for the target.\n        getPrototypeOf(_) {\n          return prototype;\n        },\n\n        // Intercept property access.\n        get(target, property, receiver) {\n          // If the property exists in the Symkeys map, return its value.\n          if (map.has(property)) {\n            return map.get(property);\n          }\n          // Otherwise, perform the default behavior.\n          return Reflect.get(target, property, receiver);\n        },\n\n        // Check for property existence. Check both the Symkeys map and the target for\n        // the property.\n        has(target, property) {\n          return map.has(property) || Reflect.has(target, property);\n        },\n\n        // Retrieve all property keys. Combine keys from the Symkeys map and the target.\n        ownKeys(target) {\n          return [...Array.from(map.keys()), ...Reflect.ownKeys(target)];\n        },\n\n        // Intercept property assignment.\n        set(_, property, value, __) {\n          // If the property exists in the Symkeys map, set its value.\n          if (map.has(property)) {\n            map.set(property, value);\n            return true;\n          }\n          // If not, the operation is not allowed.\n          return false;\n        },\n\n        // Retrieve property descriptors.\n        getOwnPropertyDescriptor(_, property) {\n          // Convert the Symkeys map to an object to use with\n          // Object.getOwnPropertyDescriptor.\n          const object = [...map.entries()].reduce(\n            (a, e) => Object.assign(a, { [e[0]]: e[1] }),\n            {},\n          );\n          // Retrieve the descriptor from the object.\n          return Object.getOwnPropertyDescriptor(object, property);\n        },\n      }),\n    );\n  }\n\n  /**\n   * Checks if a given value is a Symkey.\n   *\n   * This method checks if the provided value is a Symkey. A Symkey is a\n   * symbol that matches a specific pattern. The pattern is defined as a\n   * symbol that starts with '@', followed by any characters, a space, a '#',\n   * and ends with one or more word characters.\n   *\n   * @param {Symbol} value - The value to check.\n   * @returns {boolean} Returns true if the value is a Symkey, false otherwise.\n   *\n   * @example\n   * // Check if a symbol is a Symkey:\n   * const sym = Symbol('@nejs.prototype #rwiy2o905d');\n   * console.log(Symkeys.isSymkey(sym)); // Outputs: true\n   */\n  static isSymkey(value) {\n    if (!(typeof value === 'symbol' || value instanceof Symbol)) {\n      return false\n    }\n\n    return !!/^@.*? #\\w+$/.exec(value?.description)\n  }\n\n  /**\n   * Generates a random token string.\n   *\n   * This method creates a pseudo-random token that can be used for various\n   * purposes within the library, such as generating unique identifiers or\n   * keys. The token is generated using a base 36 encoding, which includes\n   * numbers and lowercase letters.\n   *\n   * @returns A random token string.\n   *\n   * @example\n   * // Example of getting a random token:\n   * const token = MyClass.token;\n   * console.log(token); // Outputs a string like 'qg6k1zr0is'\n   */\n  static get token() {\n    return Math.random().toString(36).slice(2);\n  }\n\n  /**\n   * Reusable publicly static key for identifying where data is stored.\n   */\n  static get kDataKey() {\n    return Symbol.for('symkeys.data');\n  }\n\n  /**\n   * Reusable publicly static key for identifying where data is stored.\n   */\n  static get kPrototype() {\n    return Symbol.for('symkeys.prototype')\n  }\n\n  /**\n   * A static getter that returns a unique, reusable symbol for 'symkeys.domain'.\n   *\n   * This getter is used to create a unique symbol that can be used as a key\n   * for storing and retrieving domain-specific data in the Symkeys. The symbol\n   * is created using the `Symbol.for` method, which ensures that the same\n   * symbol is returned for a given key, in this case 'symkeys.domain'.\n   *\n   * @returns {Symbol} A unique symbol for 'symkeys.domain'.\n   *\n   * @example\n   * // Retrieve the 'symkeys.domain' symbol\n   * const domainSymbol = Symkeys.kDomain;\n   * console.log(domainSymbol); // Outputs: Symbol(symkeys.domain)\n   */\n  static get kDomain() {\n    return Symbol.for('symkeys.domain')\n  }\n\n  /**\n   * A static getter that returns a unique, reusable symbol for 'symkeys.separator'.\n   *\n   * This getter is used to create a unique symbol that can be used as a key\n   * for storing and retrieving separator-specific data in the Symkeys. The symbol\n   * is created using the `Symbol.for` method, which ensures that the same\n   * symbol is returned for a given key, in this case 'symkeys.separator'.\n   *\n   * @returns {Symbol} A unique symbol for 'symkeys.separator'.\n   *\n   * @example\n   * // Retrieve the 'symkeys.separator' symbol\n   * const separatorSymbol = Symkeys.kSeparator;\n   * console.log(separatorSymbol); // Outputs: Symbol(symkeys.separator)\n   */\n  static get kSeparator() {\n    return Symbol.for('symkeys.separator')\n  }\n}\n\nexport const SymkeysExtension = new Extension(Symkeys)", "import { Patch, PatchToggle } from '@nejs/extension';\n\nimport { Symkeys } from './classes/symkeys.js'\nimport { JSONExtensions } from './json.extensions.js'\n\nconst JSONToggle = new PatchToggle(JSONExtensions)\nconst symkeys = new Symkeys('nejs')\n\n/**\n * `SymbolExtensions` is a patch for the JavaScript built-in `Symbol` class. It\n * adds utility methods to the `Symbol` class without modifying the global namespace\n * directly. This patch includes methods for key validation, object type checking,\n * and retrieving the string tag of an object. These methods are useful for\n * enhancing the capabilities of the standard `Symbol` class with additional\n * utility functions.\n */\nexport const SymbolExtensions = new Patch(Symbol, {\n  /**\n   * Adds a new symbol to the Symkeys instance with the given name and\n   * associated data.\n   *\n   * This method generates a unique symbol based on the provided name,\n   * optional domain, separator, and token. It also allows embedding\n   * additional data into the symbol's name.\n   *\n   * @param {string} named - The base name for the new symbol.\n   * @param {Object} options - Additional options for the symbol.\n   * @param {*} [options.associate={}] - Data to associate with the symbol.\n   * @param {Object} [options.embed] - Optional data to embed in the symbol.\n   * @param {string} [options.useDomain] - Optional domain to include in the\n   * symbol's name.\n   * @param {string} [options.useSeparator] - Optional separator to use in\n   * the symbol's name.\n   * @param {string} [options.useToken] - Optional token to use for the\n   * symbol. If not provided, a random token is generated.\n   * @returns {Symbol} The newly created symbol.\n   *\n   * @example\n   * // Add a symbol with associated data\n   * const mySymbol = SymbolExtensions.add('myIdentifier', {\n   *   associate: { foo: 'bar' },\n   *   embed: { baz: 'qux' },\n   *   useDomain: 'exampleDomain',\n   *   useSeparator: '-',\n   *   useToken: 'customToken',\n   * })\n   * console.log(mySymbol)\n   * // Symbol(@exampleDomain-myIdentifier {\"baz\":\"qux\"} #customToken)\n   */\n  add(named, { associate = {}, embed, useToken, useDomain, useSeparator }) {\n    return this.keys.add(named, {\n      associate, embed, useToken, useDomain, useSeparator,\n    })\n  },\n\n  /**\n   * Deletes the data associated with a given symbol from the Symkeys\n   * instance.\n   *\n   * This method allows removal of the data that has been associated with a\n   * particular symbol in the Symkeys instance. It is useful when you want\n   * to clean up or remove stored information associated with a symbol.\n   *\n   * @param {Symbol} forSymbol - The symbol whose associated data is to be\n   * deleted.\n   * @param {*} [replaceWith=undefined] - Optionally, if `replaceWith` is\n   * not `undefined`, a new value can be set after the original is deleted\n   * @returns {boolean} - Returns true if an element in the Symkeys existed\n   * and has been removed, or false if the element does not exist\n   *\n   * @example\n   * // Assuming 'mySymbol' is a symbol that has been added to the Symkeys\n   * // with associated data\n   * const isDeleted = Symbol.deleteData(mySymbol)\n   * console.log(isDeleted) // Output: true if data was deleted, false\n   *\n   * @example\n   * // Deleting data and replacing it with a new value\n   * const mySymbol = Symbol.for('mySymbol')\n   * Symbol.setData(mySymbol, { foo: 'bar' })\n   * Symbol.deleteData(mySymbol, { newFoo: 'newBar' })\n   * console.log(Symbol.keys.data(mySymbol)) // Output: { newFoo: 'newBar' }\n   */\n  deleteData(forSymbol, replaceWith = undefined) {\n    return this.keys.deleteData(forSymbol, replaceWith)\n  },\n\n  /**\n   * Evaluates a key or value and generates a shared symbol key based on\n   * the provided object name and owner name.\n   *\n   * This method takes a key or value, an object name, and an object owner\n   * name as parameters. It determines the type of each parameter and\n   * constructs a token string by concatenating the owner name, object\n   * name, and key/value (if they are valid object keys).\n   *\n   * The token string is then used to create a shared symbol key using the\n   * `sharedKey` method of the current instance. The shared symbol key is\n   * returned along with the token as associated data.\n   *\n   * @param {string|Symbol} keyOrValue - The key or value to evaluate.\n   * @param {string|Symbol} objectName - The name of the object associated\n   * with the key or value.\n   * @param {string|Function|Object} objectOwnerName - The name of the\n   * owner of the object.\n   * @returns {Symbol} The shared symbol key generated based on the\n   * provided parameters.\n   *\n   * @example\n   * const symbolKey = SymbolExtensions.evalKey('myKey', 'myObject', 'myOwner')\n   * console.log(symbolKey)\n   * // Output: Symbol(@nejs.internal.refkey:myOwner.myObject.myKey)\n   *\n   * @example\n   * const symbolKey = SymbolExtensions.evalKey(\n   *   'myValue', () => {}, { [Symbol.toStringTag]: 'myOwner' }\n   * )\n   * console.log(symbolKey)\n   * // Output: Symbol(@nejs.internal.refkey:myOwner.myValue)\n   */\n  evalKey(keyOrValue, objectName, objectOwnerName) {\n    const is = {\n      string(v) { return typeof v === 'string' },\n      func(v) { return typeof v === 'function' },\n      object(v) { return typeof v === 'object' },\n      objKey(v) { return ['symbol', 'string'].some(k => typeof v === k) },\n    }\n    is.key = is.objKey(keyOrValue)\n\n    const ownerName = (\n      (is.string(objectOwnerName) && objectOwnerName) ||\n      (is.func(objectOwnerName) && objectOwnerName?.name) ||\n      (is.object(objectOwnerName) && objectOwnerName?.[Symbol.toStringTag]) ||\n      undefined\n    )\n\n    const token = [\n      ownerName && `${ownerName}.` || '',\n      is.objKey(objectName) && `${objectName}.` || '',\n      is.objKey(keyOrValue) && `${keyOrValue}`,\n    ].join('')\n\n    return this.sharedKey(`internal.refkey:${token}`, { token })\n  },\n\n  /**\n   * Checks if the Symkeys instance has data associated with a given\n   * symbol\n   *\n   * This method checks if the Symkeys instance has any data associated\n   * with the provided symbol. It is useful when you need to verify if\n   * data exists for a particular symbol before attempting to retrieve\n   * or manipulate it\n   *\n   * @param {Symbol} forSymbol - The symbol to check for associated data\n   * @returns {boolean} Returns true if data exists for the symbol,\n   *                    false otherwise\n   *\n   * @example\n   * // Assuming 'mySymbol' is a symbol that has been added to the\n   * // Symkeys with associated data\n   * const hasData = Symbol.hasData(mySymbol)\n   * console.log(hasData) // Output: true\n   *\n   * @example\n   * // Assuming 'nonExistentSymbol' is a symbol that has not been added\n   * // to the Symkeys\n   * const hasData = Symbol.hasData(nonExistentSymbol)\n   * console.log(hasData) // Output: false\n   */\n  hasData(forSymbol) {\n    return this.keys.hasData(forSymbol)\n  },\n\n  /**\n   * The `isSymbol` method does exactly what one would it expect. It returns\n   * true if the string matches typeof or instanceof as a symbol.\n   *\n   * @param {*} value checks to see if the `value` is a string\n   * @returns {boolean} `true` if it is a `Symbol`, `false` otherwise\n   */\n  isSymbol(value) {\n    return value && (typeof value === 'symbol');\n  },\n\n  /**\n   * Returns true if the supplied value is a Symbol created using\n   * `Symbol.for()`.\n   *\n   * @param {any} value assumption is that the supplied value is of type\n   * 'symbol' however, unless `allowOnlySymbols` is set to `true`, `false`\n   * will be returned for any non-symbol values.\n   * @param {boolean} allowOnlySymbols true if an error should be thrown\n   * if the supplied value is not of type 'symbol'\n   * @returns true if the symbol is registered, meaning, none of the spec\n   * static symbols (`toStringTag`, `iterator`, etc...), and no symbols\n   * created by passing a value directly to the Symbol function, such as\n   * `Symbol('name')`\n   */\n  isRegistered(value, allowOnlySymbols = false) {\n    if (!Symbol.isSymbol(value)) {\n      if (allowOnlySymbols) {\n        throw new TypeError('allowOnlySymbols specified; value is not a symbol')\n      }\n      return false\n    }\n\n    return Symbol.keyFor(value) !== undefined\n  },\n\n  /**\n   * A function that returns true if the symbol is not registered, meaning,\n   * any of the spec static symbols (`toStringTag`, `iterator`, etc...), and\n   * any symbols created by passing a value directly to the `Symbol` function,\n   * such as `Symbol('name')`.\n   *\n   * @param {any} value assumption is that the supplied value is of type\n   * 'symbol' however, unless allowOnlySymbols is set to true, false will\n   * be returned for any non-symbol values.\n   * @param {boolean} allowOnlySymbols true if an error should be thrown\n   * if the supplied value is not of type 'symbol'\n   * @returns true if the symbol is not registered, meaning, any of the\n   * spec static symbols (`toStringTag`, `iterator`, etc...), and any symbols\n   * created by passing a value directly to the `Symbol` function, such as\n   * `Symbol('name')`\n   * @returns true if the `value` in question is both a `symbol` and has\n   * returns `undefined` if passed to `Symbol.keyFor`\n   */\n  isNonRegistered(value, allowOnlySymbols = false) {\n    return !Symbol.isRegistered(value, allowOnlySymbols)\n  },\n\n  /**\n   * `keys` is an instance of the `Symkeys` class, initialized with the\n   * domain 'nejs'. The `Symkeys` class provides a way to easily generate\n   * Symbol.for elements that follow particular pattern. Symkeys also\n   * allows associated data storage with each generated key.\n   *\n   * @type {Symkeys}\n   * @see {@link SymKeys}\n   * @example\n   * // Returns something like Symbol.for('@nejs.prototype #rwiy2o905d')\n   * const kOriginal = Symbol.keys.add('prototypes')\n   *\n   * // Which can be used to retrieve and fetch data associated with that key\n   * // The value stored is an array by default, but can be anything. It can\n   * // be accessed one property at a time\n   * Symbol.keys[kOriginal].original = Object.prototype\n   * Symbol.keys[kOriginal].modified = Object.create(Object.prototype, ...)\n   *\n   * // Or wholesale replaced\n   * Symbol.keys[kOriginal] = [Object.prototype, Array.prototype]\n   *\n   * // But if all Symbol Extensions are in place, including prototype add-ons\n   * kOriginal.data.original = Object.prototype           // ...and...\n   * kOriginal.data = [Object.prototype, Array.prototype] // ...both work\n   */\n  get keys() { return symkeys },\n\n  /**\n   * Sets the data associated with a given symbol in the Symkeys\n   * instance.\n   *\n   * This method allows you to store data associated with a specific\n   * symbol in the Symkeys instance. It is useful when you want to\n   * attach additional information or metadata to a symbol for later\n   * retrieval.\n   *\n   * @param {Symbol} forSymbol - The symbol for which to set the\n   * associated data.\n   * @param {*} value - The data to be associated with the symbol.\n   *\n   * @example\n   * // Create a symbol\n   * const mySymbol = Symbol.for('mySymbol')\n   *\n   * // Set data for the symbol\n   * Symbol.setData(mySymbol, { foo: 'bar' })\n   *\n   * // Retrieve the data associated with the symbol\n   * const data = Symbol.keys.data(mySymbol)\n   * console.log(data) // Output: { foo: 'bar' }\n   */\n  setData(forSymbol, value) {\n    this.keys.setData(forSymbol, value)\n  },\n\n  /**\n   * Creates or retrieves a shared symbol key with the given name and\n   * optional associated data.\n   *\n   * This method generates a shared symbol key using the provided name\n   * and optional parameters. If the symbol already exists in the\n   * Symkeys's internal map, it updates the associated data if provided.\n   * Otherwise, it creates a new symbol with the specified parameters.\n   *\n   * @param {string} named - The name to use for the shared symbol key.\n   * @param {Object} options - Optional parameters for the shared symbol key.\n   * @param {Object} [options.associate] - Data to associate with the symbol.\n   * @param {Object} [options.embed] - Data to embed in the symbol's name.\n   * @param {string} [options.useDomain] - Domain to include in the symbol's name.\n   * @param {string} [options.useSeparator] - Separator to use in the symbol's name.\n   * @returns {Symbol} The shared symbol key.\n   *\n   * @example\n   * // Create or retrieve a shared symbol key with associated data\n   * const sharedSymbol = Symbol.sharedKey('mySharedKey', {\n   *   associate: { foo: 'bar' },\n   *   embed: { baz: 'qux' },\n   *   useDomain: 'exampleDomain',\n   *   useSeparator: '-',\n   * })\n   * console.log(sharedSymbol)\n   * // Output: Symbol(@exampleDomain-mySharedKey {\"baz\":\"qux\"} #shared)\n   */\n  sharedKey(named, options) {\n    return this.keys.sharedKey(named, options)\n  },\n\n  /**\n   * A symbol used as the storage key for the single instance of a\n   * singleton.\n   *\n   * This getter returns a unique symbol created using `Symbol.for()`\n   * with the string 'singleton'. The symbol is used to store and\n   * retrieve the single instance of a singleton object.\n   *\n   * @type {symbol}\n   * @readonly\n   *\n   * @example\n   * const singletonKey = Symbol.singleton\n   * const singletonInstance = {}\n   * global[singletonKey] = singletonInstance\n   */\n  get singleton() {\n    return Symbol.for('singleton')\n  },\n\n  /**\n   * Creates a new Symbol with the given name and optional data. If data\n   * is provided, it will be stringified and appended to the symbol's\n   * name. This method is useful for creating unique symbols that carry\n   * additional metadata.\n   *\n   * @param {string} name The name of the symbol.\n   * @param {*} [data] Optional data to be associated with the symbol.\n   * @returns {symbol} A new symbol created with Symbol.for(), using the\n   * provided name and stringified data (if provided).\n   *\n   * @example\n   * const symbolWithData = Symbol.withData('mySymbol', { foo: 'bar' })\n   * console.log(symbolWithData.toString())\n   * // Output: \"Symbol(mySymbol {\"foo\":\"bar\"})\"\n   *\n   * @example\n   * const symbolWithoutData = Symbol.withData('mySymbol')\n   * console.log(symbolWithoutData.toString())\n   * // Output: \"Symbol(mySymbol)\"\n   */\n  withData(name, data) {\n    return data !== undefined\n      ? Symbol.for(`${name} ${JSON.stringify(data)}`)\n      : Symbol.for(name)\n  },\n});\n\nexport const SymbolPrototypeExtensions = new Patch(Symbol.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Returns an object representation of the symbol instance.\n     *\n     * This getter method creates and returns an object that wraps the\n     * symbol instance, allowing it to be treated as an object. The\n     * returned object is created using the `Object()` constructor,\n     * which takes the symbol instance as its argument.\n     *\n     * @type {Object}\n     * @readonly\n     *\n     * @example\n     * const sym = Symbol('example')\n     * console.log(typeof sym)        // 'symbol'\n     * console.log(typeof sym.instance) // 'object'\n     */\n    get instance() {\n      return Object(this)\n    },\n\n    /**\n     * Getter method for retrieving the data associated with a symbol.\n     *\n     * This method first checks if the symbol is a Symkey created symbol\n     * by checking the existence of Symbol.keys and if the symbol's\n     * description matches the Symkey pattern. If it is a Symkey symbol,\n     * it attempts to fetch its associated data.\n     *\n     * NOTE: Symkey data is returned as its value directly, this is because\n     * it is stored in a {@link Map}. Embedded JSON data might be expensive\n     * to parse and as such a function is returned when data is accessed that\n     * needs to be invoked in order to decode its contents. See\n     * `{@link mightHaveEmbeddedJSON}` for more information.\n     *\n     * If the symbol is not a Symkey symbol or if no data is associated\n     * with it, the method attempts to parse the symbol's description as\n     * JSON and returns the first valid JSON object found.\n     *\n     * If no valid JSON object is found in the description, the method\n     * returns undefined.\n     *\n     * @type {Object|Function}\n     * @readonly\n     *\n     * @example\n     * const keys = new Symkeys\n     * const key = keys.add('example', {count: 0})\n     * const data = key.data // note this isn't function!!\n     * const count = data.count\n     *\n     * @example\n     * const sym = Symbol.for('fun {\"name\":\"Brie\"}')\n     * let json = sym.data() // {name: 'Brie'} JS object\n     *\n     * @example\n     * const sym = Symbol('mySymbol')\n     * let data = sym.data() // undefined\n     */\n    get data() {\n      if (Symbol?.keys && Symkeys.isSymkey(this)) {\n        const possibleData = Symbol.keys[this]\n        if (possibleData) {\n          return possibleData\n        }\n      }\n\n      let result = undefined;\n      let revertToggle = false\n      if (!JSONExtensions.applied) {\n        JSONToggle.start()\n        revertToggle = true\n      }\n\n      if (JSON.mightContain(this.description)) {\n        try { result = JSON.extractFrom(this.description) }\n        catch (ignore) { }\n      }\n\n      if (revertToggle) {\n        JSONToggle.stop()\n      }\n\n      return result\n    },\n\n    /**\n     * Sets the data associated with a symbol.\n     *\n     * This setter method checks if the symbol is a Symkey and if it has\n     * associated data. If both conditions are met, it sets the data of the\n     * symbol to the provided value and returns true. If the conditions are\n     * not met, it simply returns false.\n     *\n     * While Symbols have been upgraded to also support embedded JSON data\n     * with this extension, symbol descriptions are static. Non Symkey symbols\n     * do not associated their data outside of a symbol, and cannot be changed,\n     * there new data cannot be set on them.\n     *\n     * @param {any} value - The value to be set as the symbol's data.\n     * @returns {boolean} - Returns true if the data was successfully set,\n     * false otherwise.\n     *\n     * @example\n     * const sym = Symbol.for('fun {\"name\":\"Brie\"}')\n     * Symkeys.isSymkey(sym) // false; not in Symkey format\n     * let json = sym.data() // {name: 'Brie'} JS object\n     * sym.data = JSON.stringify({name: 'Jane'}) // fails silently\n     * json = sym.data() // {name: 'Brie'} is hard-coded in description\n     *\n     * @example\n     * const sym = Symbol('mySymbol')\n     * Symkeys.isSymkey(sym) // false; not in Symkey format\n     * Symkeys.hasData(sym) // false\n     * sym.data = { name: 'John', age: 30 } // will fail silently\n     * Symkeys.hasData(sym) // still false\n     *\n     * // Now let's create a Symkey with data\n     * const symWithData = Symkeys.create('mySymbolWithData',\n     *                                    { name: 'Jane', age: 25 })\n     * Symkeys.isSymkey(symWithData) // true\n     * Symkeys.hasData(symWithData) // true\n     * symWithData.data = { name: 'Jane', age: 26 } // will succeed\n     * Symkeys.getData(symWithData) // returns { name: 'Jane', age: 26 }\n     */\n    set data(value) {\n      if (Symkeys.isSymkey(this)) {\n        Symbol.keys.setData(this, value)\n      }\n      else {\n        console.error(`The symbol ${this.description} is not a symkey`)\n      }\n    },\n\n    /**\n     * Retrieves the embedded JSON data from the symbol's description.\n     *\n     * This getter method checks if the symbol's description might contain\n     * JSON data. If the description contains JSON, it parses and returns\n     * the first JSON object found. If no JSON is found, it returns\n     * `undefined`.\n     *\n     * @returns {Object|undefined} - The parsed JSON object if found,\n     * otherwise `undefined`.\n     *\n     * @example\n     * const sym = Symbol.for('example {\"name\":\"Brie\"}')\n     * console.log(sym.embeddedJSON) // Output: { name: 'Brie' }\n     *\n     * @example\n     * const sym = Symbol('noJSON')\n     * console.log(sym.embeddedJSON) // Output: undefined\n     */\n    get embeddedJSON() {\n      return JSONToggle.perform((toggle, patch) => {\n        let [mightHave, index, parsed] = JSON.mightContain(\n          this.description, true\n        )\n\n        if (mightHave) {\n          return parsed?.[0]\n        }\n\n        return undefined\n      })\n    },\n\n    /**\n     * Parses the embedded JSON data from the symbol's description.\n     *\n     * This getter method first retrieves the embedded JSON data using the\n     * `embeddedJSON` getter. If JSON data is found, it attempts to parse\n     * the JSON string and return the resulting object. If parsing fails,\n     * an error is logged to the console.\n     *\n     * @returns {Object|undefined} - The parsed JSON object if parsing is\n     * successful, otherwise `undefined`.\n     *\n     * @example\n     * const sym = Symbol.for('example {\"name\":\"Brie\"}')\n     * console.log(sym.embeddedJSONParsed) // Output: { name: 'Brie' }\n     *\n     * @example\n     * const sym = Symbol('invalidJSON')\n     * console.log(sym.embeddedJSONParsed) // Output: undefined\n     */\n    get embeddedJSONParsed() {\n      const json = this.embeddedJSON\n\n      if (json) {\n        try {\n          return JSON.parse(json)\n        }\n        catch (error) {\n          console.error(`Failed to parse json: \"${json}\"`)\n        }\n      }\n\n      return undefined\n    },\n\n    /**\n     * Checks if the current symbol is a Symkey.\n     *\n     * This getter method determines whether the current symbol instance\n     * conforms to the Symkey pattern. A Symkey is a symbol that matches\n     * a specific pattern defined in the Symkeys class.\n     *\n     * @type {boolean}\n     * @readonly\n     *\n     * @returns {boolean} - Returns true if the symbol is a Symkey,\n     *                      otherwise false.\n     *\n     * @example\n     * const sym = Symbol('@nejs.prototype #rwiy2o905d')\n     * console.log(sym.isSymkey) // Output: true\n     *\n     * @example\n     * const sym = Symbol('regularSymbol')\n     * console.log(sym.isSymkey) // Output: false\n     */\n    get isSymkey() {\n      return Symkeys.isSymkey(this)\n    },\n\n    /**\n     * Checks if the symbol might have embedded JSON data.\n     *\n     * This getter method checks if the symbol's description might contain\n     * JSON data and if the data property of the symbol is a function. If both\n     * conditions are met, it returns true, otherwise it returns false.\n     *\n     * @returns {boolean} - Returns true if the symbol might have embedded\n     * JSON, false otherwise.\n     *\n     * @example\n     * const sym = Symbol.for('fun {\"name\":\"Brie\"}')\n     * console.log(sym.mightHaveEmbeddedJSON) // Output: true\n     *\n     * @example\n     * const sym = Symbol('mySymbol')\n     * console.log(sym.mightHaveEmbeddedJSON) // Output: false\n     */\n    get mightHaveEmbeddedJSON() {\n      return JSONToggle.perform((toggle, patch) => {\n        return JSON.mightContain(this.description)\n      })\n    },\n\n    /**\n     * Retrieves the reference object associated with the symbol.\n     *\n     * This getter method checks if the symbol's description matches a\n     * specific pattern using a regular expression. If a match is found,\n     * it extracts the token from the description and constructs a shared\n     * key using the token. It then retrieves the symbol associated with\n     * the shared key using the `sharedKey` method of the\n     * `SymbolExtensions.patches` object. Finally, it returns the data\n     * associated with the retrieved symbol.\n     *\n     * If no match is found or the retrieved symbol has no associated\n     * data, `undefined` is returned.\n     *\n     * @type {any}\n     * @readonly\n     *\n     * @example\n     * const sym = Symbol.for('@nejs.internal.refkey:example #shared')\n     * console.log(sym.refObject) // Output: the data associated with the\n     *                             // 'internal.refkey:example' shared key\n     *\n     * @example\n     * const sym = Symbol('no_match')\n     * console.log(sym.refObject) // Output: undefined\n     */\n    get refObject() {\n      const re = /@nejs.internal.refkey:(\\S+) #shared/.exec(this.description)\n      if (re?.[1]) {\n        const [_match, token] = re\n        const shareKey = `internal.refkey:${token}`\n        const symbol = SymbolExtensions.patches.sharedKey(shareKey)\n        return symbol?.data\n      }\n\n      return undefined\n    },\n\n    /**\n     * Returns a formatted string representation of the symbol's\n     * description, highlighting any embedded JSON data.\n     *\n     * This getter method checks if the symbol's description contains\n     * JSON data and formats it for better readability. It uses the\n     * `sgr` function from the `String` object to apply color formatting\n     * to the output.\n     *\n     * If the symbol's description contains JSON data longer than 30\n     * characters, it truncates the JSON data and displays an ellipsis\n     * in the middle. The JSON data is highlighted using the 'di' color\n     * code.\n     *\n     * @type {string}\n     * @readonly\n     *\n     * @example\n     * const sym = Symbol.for('mySymbol {\"name\":\"John Doe\"}')\n     * console.log(sym.sgrString)\n     * // Output: Symbol.for(mySymbol {\"name\":\"John ...hn Doe\"})\n     *\n     * @example\n     * const sym = Symbol('mySymbol')\n     * console.log(sym.sgrString)\n     * // Output: mySymbol\n     */\n    get sgrString() {\n      let { sgr } = String\n\n      if (!sgr) {\n        sgr = (string, ...args) => string\n      }\n\n      const response = JSONToggle.perform((toggle, patch) => {\n        let [mightContain, index, jsonResponse] =\n          JSON.mightContain(this.description, true)\n        let jsonText = jsonResponse?.[0]\n\n        if (mightContain) {\n          if (~index && jsonText && jsonText.length > 30) {\n            let desc = this.description\n            let newDescription = [\n              sgr(`Symbol.for(${desc.slice(0, index)}`, 'green'),\n              sgr(jsonText.slice(0, 10), 'di'),\n              '...',\n              sgr(jsonText.slice(-5), 'di'),\n              sgr(`${desc.slice(index + jsonText.length + 1)})`, 'green')\n            ].join('')\n\n            return `${newDescription}`\n          }\n        }\n      })\n\n      return response ?? this.description\n    },\n\n    /**\n     * Custom inspect method for Node.js util.inspect.\n     *\n     * NOTE: this will only apply if looking at an instance of Symbol,\n     * sadly; {@see SymbolPrototypeExtensions.instance}\n     *\n     * This method is used by Node.js util.inspect to provide a custom\n     * representation of the symbol when inspected. It checks if the\n     * symbol's description might contain JSON data and if so, it\n     * truncates the JSON data in the description to a maximum of 30\n     * characters and formats the output with colors using the `sgr`\n     * function from the `String` object.\n     *\n     * @param {number} depth - The current depth of the recursive\n     * inspection.\n     * @param {Object} options - The options object passed to\n     * util.inspect.\n     * @param {Function} inspect - The original util.inspect function.\n     *\n     * @returns {string} - The formatted representation of the symbol.\n     *\n     * @example\n     * const sym = Symbol.for('fun {\"name\":\"John Doe\"}')\n     * console.log(util.inspect(sym))\n     * // Output: Symbol.for(fun {\"name\":\"John ...hn Doe\"})\n     */\n    [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n      let revert = false\n      let detail = undefined\n\n      let { sgr } = String\n      if (!sgr) { sgr = (string, ...args) => string }\n\n      if (!JSONExtensions.applied) { JSONToggle.start(); revert = true }\n      if ((detail = JSON.mightContain(this.description, true))) {\n        let jsonText = detail[2]?.[0]\n        let index = detail[1]\n\n        if (~index && jsonText && jsonText.length > 30) {\n          let desc = this.description\n          let newDescription = [\n            sgr(`Symbol.for(${desc.slice(0, index)}`, 'green'),\n            sgr(jsonText.slice(0, 10), 'di'),\n            '...',\n            sgr(jsonText.slice(-5), 'di'),\n            sgr(`${desc.slice(index + jsonText.length + 1)})`, 'green'),\n          ].join('')\n\n          if (revert) { JSONToggle.stop() }\n          return `${newDescription}`\n        }\n      }\n\n      if (revert) { JSONToggle.stop() }\n      return inspect(this, { colors: true })\n    },\n  },\n})\n", "/**\n * The object key that associates a value as part of an object must, by\n * definition, be one of: string, symbol, or number. This type definition\n * helps to define that easily for future reference.\n *\n * @typedef {string|symbol|number} PropertyKey\n */\n\n/**\n * The `IsDescriptorStats` block contains all the information used to make\n *  determination whether a given value is an instance of the type\n * {@link PropertyDescriptor} or at least compatible to use as one.\n *\n * @typedef {Object} IsDescriptorStats\n * @property {number} confidence this is going to be a number from 0.0-1.0\n * indicating the confidence ratio that the object supplied to `isDescriptor`\n * is actually a valid `PropertyDescriptor` object. If the number is greater\n * than 0 but less than 1.0, it likely indicates that the object can be used\n * as a `PropertyDescriptor` but one or more factors gives it less than 100%\n * confidence that being such is the objects intended purpose (e.g. it could\n * be that there are more properties than a descriptor might have or that\n * it is missing crucial properties such as `value`, `get` or `set`)\n * @property {boolean} isAccessor true if the object is functional as an\n * accessor descriptor; false otherwise\n * @property {boolean} isData true if the object is functional as a data\n * descriptor; false otherwise\n * @property {boolean} isValid true if the object is technically a valid\n * `PropertyDescriptor` object or compatible as one.\n * @property {boolean} hasBaseDescriptorKeys true if the object has either\n * `configurable` or `enumerable` property keys and both are `undefined` or\n * of type `boolean`.\n * @property {boolean} hasAccessorKeys true if the object has either `get`\n * or `set` property keys and both are either `undefined` or of type\n * `function`\n * @property {boolean} hasDataKeys true if the object has either `value` or\n * `writable` property keys and if `writable` is present, then it is of type\n * `boolean`\n */\n\n/**\n * The response from a call to {@link DescriptorUtils.isDescriptor} can\n * be either a {@link boolean} or a {@link IsDescriptorStats} object.\n *\n * @typedef {IsDescriptorStats | boolean} IsDescriptorResponse\n */\n\n/**\n * A set of utility functions work with {@link PropertyDescriptor} objects.\n * The creation of property descriptors can be large in boilerplate, so\n * these tools can reduce the boilerplate and increase readability.\n *\n * @name DescriptorUtils\n * @typedef {DescriptorUtils}\n */\nexport const DescriptorUtils = {\n  /**\n   * Creates an accessor descriptor object\n   *\n   * This function has multiple possible overloads\n   *\n   * _**zeroFn** is a function that takes no parameters_\n   * _**oneFn** is a function that takes a single parameter_\n   * _**oneOrNone** is a either a function that takes a single parameter or nullish_\n   * _**nonFn** is any value that is not a function_\n   * _**nullish** is either null or undefined_\n   * _**...** means configurable?, enumerable?, storage?, key? liaison? as\n   * the subsequent following parameters in that order_\n   *\n   * **accessor ()**\n   *   creates a storage-backed accessor that is both read and write.\n   *   The storage object will be a provided empty object with the key\n   *   being 'value'. Configurable and enumerable flags will be set to\n   *   `true`.\n   *\n   * **accessor (options)**\n   *   this single argument variant of accessor() consists of a single\n   *   options object. If neither `get` nor `set` are provided, a\n   *    storage-backed read-write accessor with undefined as the initial\n   *   value will be constructed.\n   *\n   * **accessor (nonFn)**\n   * **accessor (any, true, options?)**\n   * **accessor (any, true, ...)**\n   *   supplying only a non-function-only parameter or any value and the\n   *   value `true` as the second parameter, you will get a read-write\n   *   accessor stored in the default or specified storage. The resultant\n   *   initial value will be whatever is provided as the first parameter.\n   *   See options to customize `configurable`, `enumerable`, `storage`,\n   *   `key` and the `liaison` factory function.\n   *\n   * **accessor (any, false, options?)**\n   * **accessor (any, false, ...)**\n   *   supplying only a non-function-only parameter or any value and the\n   *   value `false` as the second parameter, you will get a read-only\n   *   getter stored in the default or specified storage. The resultant\n   *   value will be whatever is provided as the first parameter.\n   *   See options to customize `configurable`, `enumerable`, `storage`,\n   *   `key` and the `liaison` factory function.\n   *\n   * **accessor (zeroFn)**\n   * **accessor (zeroFn, nullish, options?)**\n   * **accessor (zeroFn, nullish, ...)**\n   *   creates a generic read-only accessor with the first no-argument\n   *   function parameter being the getter and either null or undefined\n   *   for the setter. Either an options object or the manually ordered\n   *   parameters can optionally follow if a nullish value for setter\n   *   is provided.\n   *\n   * **accessor (zeroFn, oneOrNone, options?)**\n   * **accessor (zeroFn, oneOrNone, ...)**\n   *   creates a generic read-write accessor with the first no-argument\n   *   function parameter being the getter and the second single-argument\n   *   function parameter being the setter. Either an options object or\n   *   the manually ordered parameters can optionally follow.\n   *\n   * **accessor (oneFn, oneFn, options?)**\n   * **accessor (oneFn, oneFn, ...)**\n   *   this special variant of the accessor() invocation allows a single\n   *   argument getter and setter factory to be supplied. These will\n   *   automatically be invoked with the specified or default storage\n   *   object. The result of the getter factory should be a no-argument\n   *   function. And the result of the setter factory should be a single\n   *   argument function. The options for `liaison` and `key` will be\n   *   ignored and should be handled specifically in the factory\n   *   functions to suit your own use case.\n   *\n   *\n   * Options are an object-oriented way of supplying the alternate\n   * flags to the data descriptor. They are\n   *\n   *   * **`get`** - only referenced when an options object is the only\n   *     parameter\n   *   * **`set`** - only referenced when an options object is the only\n   *     parameter\n   *   * **`configurable`** - if true, the descriptor of the object that this\n   *     accessor descriptor represents can be redefined at later time by\n   *     later calls to {@link Object.defineProperty} or\n   *     {@link Object.defineProperties}\n   *   * **`enumerable`** - if true, enumeration over the object this\n   *     descriptor is applied to will show the property\n   *     represented by this descriptor. See the associated MDN\n   *     page regarding this {@link PropertyDescriptor} if you\n   *     want to know more.\n   *   * **`storage`** - an object, usually {@link Object} or {@link Map} or\n   *     nullish if unused\n   *   * **`key`** - a {@link PropertyKey} of your choosing or the default\n   *      string `\"value\"`\n   *   * **`bind`** - true if you wish to have the `storage` object bound as\n   *     the `thisObj` for both the `get` and `set` functions when\n   *     storage is used. **note* this will not work if you supply a\n   *     big arrow function for the accessor function in question. This\n   *     defaults to `false`.\n   *   * **`liaison`** - an optional factory function that must return an\n   *     object with two properties. The first is a `get()` function that\n   *     returns a value, and the second is a `set(value)` function that\n   *     stores a value. The factory function receives `storage` and\n   *     `key`, in that order. The default uses {@link Map.get} and\n   *     {@link Map.set} if the storage is an instance of {@link Map}.\n   *     Otherwise, the typical `object[key]` format is used if the\n   *     storage object is an instanceof {@link Object}\n   *\n   * @param {(object|any)?} value the JavaScript value representing\n   * this descriptor's value or an options object if it is the\n   * only parameter.\n   *\n   * @param {(object|boolean)?} optionsOrConfigurable true or false if\n   * you wish the `configurable` flag to be set. Optionally supply an\n   * object with one of the supported options to configure the run\n   * of the function.\n   *\n   * @param {boolean?} enumerable true or false if you wish to\n   * configure the `.enumerable` property of the descriptor\n   *\n   * @param {object?} storage an object upon which data storage should\n   * be written to and read from. Defaults to an empty {@link Object}\n   * when storage is needed and not supplied via this parameter or\n   * an options object.\n   *\n   * @param {PropertyKey?} key the key used to store content on the\n   * storage object.\n   *\n   * @param {{function(object, PropertyKey): {\n   *   get: function(): any,\n   *   set: function(*): void\n   * }}} liaison\n   * an optional accessor factory for the storage object. Defaults support\n   * {@link Map} and plain {@link Object}; provide this if you need to support\n   * something else. Receives the storage object and a property key; returns\n   * a `get()` and `set(value)` pair for reading and writing that key.\n   *\n   * @returns {PropertyDescriptor}\n   *\n   * @see {@link PropertyDescriptor}\n   * @note More info on this can be found at the\n   * [MDN Object.defineProperty/ies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)\n   * page\n   *\n   * @type {Function & { keys: string[] }}\n   */\n  get accessor() {\n    function accessor(\n      get,\n      set,\n      optionsOrConfigurable = true,\n      enumerable = true,\n      storage,\n      key = 'value',\n      liaison\n    ) {\n      const count = arguments.length\n      const storageKeys = ['storage', 'key', 'liaison', 'initial', 'bind']\n      const optionKeys = [\n        // accessor functions\n        'get', 'set',\n\n        // descriptor flags\n        'configurable', 'enumerable',\n\n        // storage configuration keys\n        ...storageKeys\n      ]\n      const has = (object, key) => isObject(object) && Reflect.has(object, key)\n      const isOpts = object => optionKeys.some(key => has(object, key))\n\n      let configurable = !!optionsOrConfigurable\n      let initial = undefined\n      let bind = false\n      let options = {}\n\n      if (count === 1 && isObject(get) && hasSome(get, ...optionKeys)) {\n        options = { ...get };\n        ({ get, set } = get);\n      }\n\n      if (isObject(optionsOrConfigurable) || isObject(set)) {\n        options = isObject(set) && count === 2\n          ? { ...set }\n          : { ...optionsOrConfigurable };\n\n        ({ configurable, enumerable, storage, key, bind, initial } = options)\n      }\n\n      liaison = options?.liaison ?? liaison ?? ((storage, key) => ({\n        get() {\n          if (storage instanceof Map)\n            return storage.get(key)\n          else if (isObject(storage))\n            return storage[key]\n        },\n        set(value) {\n          if (storage instanceof Map)\n            storage.set(key, value)\n          else if (isObject(storage))\n            storage[key] = value\n        }\n      }))\n\n      configurable = configurable ?? true\n      enumerable = enumerable ?? true\n      key = key ?? 'value'\n      bind = bind ?? false\n\n      const nullish = (value) => value === null || value === undefined\n      const nonFn = (value) => !nullish(value) && typeof value !== 'function'\n      const yesFn = (value) => typeof value === 'function'\n      const zeroFn = (value) => (yesFn(value) && value.length === 0)\n      const oneFn = (value) => (yesFn(value) && value.length === 1)\n      const isTrue = (value) => value === true\n      const isFalse = (value) => value === false\n      const addRefs = (fn, value) => Object.defineProperties(fn, {\n        storage: { value, configurable: true, enumerable: false },\n        key: { value: key, configurable: true, enumerable: false },\n      })\n\n      if (count === 0 || (!get && !set)) {\n        storage = { [key]: initial }\n        const _ = liaison(storage, key)\n\n        get = addRefs(function() { return _.get() }, storage)\n        set = addRefs(function(value) { _.set(value) }, storage)\n\n        return { get, set, configurable, enumerable }\n      }\n\n      if (count === 1 && oneFn(get)) {\n        set = false\n      }\n\n      if ((count === 1 && nonFn(get)) || (isTrue(set) || isFalse(set))) {\n        const skipSet = isFalse(set)\n\n        if (!storage || !(storage instanceof Map) || !isObject(storage)) {\n          storage = {}\n        }\n\n        const _ = liaison(storage, key)\n        _.set(get)\n\n        let _get = function() { return _.get() }\n        let _set = function(value) { _.set(value) }\n\n        if (bind) {\n          _get = _get.bind(storage)\n          _set = _set.bind(storage)\n        }\n\n        get = addRefs(_get, storage)\n        set = addRefs(_set, storage)\n\n        if (skipSet) {\n          set = undefined\n        }\n\n        return {get, set, configurable, enumerable}\n      }\n\n      if ((zeroFn(get) && !set) || (zeroFn(get) && oneFn(set))) {\n        const descriptor = { get, set, configurable, enumerable }\n\n        if (isObject(options) && Reflect.has(options, 'initial'))\n          descriptor.set(initial)\n\n        return descriptor\n      }\n\n      if (oneFn(get) && oneFn(set)) {\n        storage = storage || { }\n\n        let _get = get(storage)\n        let _set = set(storage)\n\n        if (bind) {\n          _get = _get.bind(storage)\n          _set = _set.bind(storage)\n        }\n\n        return {\n          get: addRefs(_get, storage),\n          set: addRefs(_set, storage),\n          configurable,\n          enumerable,\n        }\n      }\n\n      return { get, set, configurable, enumerable }\n    }\n\n    Object.defineProperty(accessor, 'keys', {\n      get() { return Object.defineProperties(\n        ['get', 'set', 'configurable', 'enumerable'],\n        {\n          from: {\n            value: function extractKeysFrom(object) {\n              const response = {\n                get: undefined,\n                set: undefined,\n                configurable: undefined,\n                enumerable: undefined,\n              }\n\n              if (!object || !(object instanceof Object))\n                return response\n\n              for (const key of DescriptorUtils.accessor.keys) {\n                if (Reflect.has(object, key))\n                  response[key] = object[key]\n              }\n            },\n            writable: false,\n            configurable: false,\n            enumerable: false\n          }\n        }\n      ) },\n      configurable: true,\n      enumerable: false,\n    })\n\n    return accessor\n  },\n\n  /**\n   * Creates a data descriptor object\n   *\n   * This function has multiple possible overloads\n   *\n   * **data ()**\n   *   creates a data descriptor with a value of `undefined` that\n   *   is writable, configurable and enumerable.\n   *\n   * **data (options)**\n   *   if the only parameter is an object and that object contains\n   *   at least a `.value` property, this funtion will return a\n   *   data descriptor with the associated values. This variant\n   *   is useful if you want to extract the normal data descriptor\n   *   properties: value, writable, configurable and/or enumerable\n   *   from an object that has properties with these names, in\n   *   addition to other properties or functions. Note that if you\n   *   wish for the value of the descriptor to be an object that\n   *   also contains a `.value` property, use `data({value: obj})`\n   *   instead.\n   *\n   * **data (value)**\n   * **data (value, options?)**\n   *   creates a data descriptor from the supplied `value`,\n   *   optionally augmented by additional `options`. The defaults\n   *   for these writable, configurable and enumerable values are set\n   *   to `true`\n   *\n   * **data (value, writable?, configurable?, enumerable?)**\n   *   if writable, configurable or enumerable or true or false\n   *   then this function creates a data descriptor with those\n   *   flags and the supplied value (there's no real reason to\n   *   invoke this function if you're supplying all four values)\n   *\n   * Options are an object-oriented way of supplying the alternate\n   * flags to the data descriptor. They are\n   *\n   *   * **`value`** - only referenced when an options object is the\n   *     only parameter\n   *   * **`writable`** - true if the value represented by this data\n   *     descriptor can be reassigned a new value.\n   *   * **`configurable`** - if true, the descriptor of the object\n   *     that this data descriptor represents can be redefined at\n   *      a later time by later calls to `Object.defineProperty`\n   *     or `Object.defineProperties`. If `.configurable` is true,\n   *     this can be done even if `.writable` is set to false\n   *   * **`enumerable`** - if true, enumeration over the object this\n   *     descriptor is applied to will show the property\n   *     represented by this descriptor. See the associated MDN\n   *     page regarding this `PropertyDescriptor` if you want to\n   *     know more.\n   *\n   * @param {(object|any)?} value the JavaScript value representing\n   * this descriptor's value or an options object if it is the\n   * only parameter.\n   *\n   * @param {(object|boolean)?} optionsOrWritable true or false if\n   * you wish the writable flag to be set. Optionally supply an\n   * object with one of the supported options to configure the run\n   * of the function.\n   *\n   * @param {boolean?} configurable true or false if you wish to\n   * configure the `.configurable` property of the descriptor\n   *\n   * @param {boolean?} enumerable true or false if you wish to\n   * configure the `.enumerable` property of the descriptor\n   *\n   * @returns {PropertyDescriptor}\n   *\n   * @note More info on this can be found at the\n   * [MDN Object.defineProperty/ies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)\n   * page\n   *\n   * @type {Function & { keys: string[] }}\n   */\n  get data() {\n    function data(value, optionsOrWritable, configurable, enumerable) {\n      const count = arguments.length\n      let valueIsDescriptor = false\n\n      if (count === 0) {\n        return {\n          value: undefined,\n          writable: true,\n          configurable: true,\n          enumerable: true\n        }\n      }\n\n      if (count === 1) {\n        const stats = DescriptorUtils.isDescriptor(value, true)\n        if (stats.isValid && stats.isData) {\n          valueIsDescriptor = true\n        }\n      }\n\n      let writable = optionsOrWritable === undefined\n        ? true\n        : !!optionsOrWritable;\n\n      let options = typeof optionsOrWritable === 'boolean'\n        ? {}\n        : Object(optionsOrWritable);\n\n      configurable = configurable === undefined ? true : !!configurable\n      enumerable = enumerable === undefined ? true : !!enumerable\n\n      if (valueIsDescriptor && !(options?.allowDescriptorValue)) {\n        options = {\n          writable: value?.writable ?? true,\n          configurable: value?.configurable ?? true,\n          enumerable: value?.enumerable ?? true,\n        };\n        value = value?.value\n      }\n\n      if (options) {\n        ({writable, configurable, enumerable} = {\n          ...{writable, configurable, enumerable},\n          ...options\n        })\n      }\n\n      return { value, writable, configurable, enumerable }\n    }\n\n    Object.defineProperty(data, 'keys', {\n      value: Object.defineProperties(\n        ['value', 'writable', 'configurable', 'enumerable'],\n        {\n          from: {\n            value: function extractKeysFrom(object) {\n              const response = {\n                value: undefined,\n                writable: undefined,\n                configurable: undefined,\n                enumerable: undefined,\n              }\n\n              if (!object || !(object instanceof Object))\n                return response\n\n              for (const key of DescriptorUtils.data.keys) {\n                if (Reflect.has(object, key))\n                  response[key] = object[key]\n              }\n            },\n            writable: false,\n            configurable: false,\n            enumerable: false,\n          }\n        }\n      ),\n      writable: false,\n      configurable: true,\n      enumerable: false\n    })\n\n    return data\n  },\n\n  describe(object, key, value, detectDescriptorValues = true) {\n    const { isAccessor, isData, data } = DescriptorUtils\n\n    if (!(object && object instanceof Object))\n      return undefined\n\n    if (!(['string', 'number', 'symbol'].includes(typeof key)))\n      return undefined\n\n    if (detectDescriptorValues && isAccessor(value) || isData(value)) {\n      return Object.defineProperty(object, key, value)\n    }\n    else {\n      return Object.defineProperty(object, key, data(value))\n    }\n  },\n\n  describeMany(object, keyValues, detectDescriptorValues = true) {\n    const { isAccessor, isData, isDescriptor, data, describe } = DescriptorUtils\n    const isKey = k => ['string', 'number', 'symbol'].includes(typeof k)\n\n    let map = undefined\n\n    if (Array.isArray(keyValues)) {\n      map = new Map(keyValues.filter(keyValue => {\n        return typeof keyValue === 'function' && keyValue.length === 2\n      }))\n    }\n    else if (keyValues instanceof Map) {\n      map = keyValues\n    }\n    else if (keyValues instanceof Object) {\n      const descriptors = Object.getOwnPropertyDescriptors(keyValues)\n      map = new Object.entries(descriptors)\n    }\n    else {\n      return []\n    }\n\n    for (const [key, value] of map) {\n      if (detectDescriptorValues) {\n        if (isDescriptor(key)) {\n\n        }\n      }\n    }\n\n    const accessorBase = { enumerable: true, configurable: true }\n    const dataBase = { writable: true, ...accessorBase }\n    const extractBase = descriptor => {\n      if (isAccessor(descriptor)) {\n        const { configurable, enumerable } = descriptor\n        return { configurable, enumerable }\n      }\n      else if (isData(descriptor)) {\n        const { writable, configurable, enumerable } = descriptor\n        return { writable, configurable, enumerable }\n      }\n      return undefined\n    }\n\n    // convert all map entries to\n    // [baseDescriptor, {key: value, key: value, ...}]\n    // unless detectDescriptorValues == false in which case\n    // [dataBase, { key: value, key: value, etc... }]\n    //   ... dropping all non-isKey(key) values\n\n    for (const [key, value] of map.entries()) {\n      const descriptor = (detectDescriptorValues && isDescriptor(value)\n        ? value\n        : data(value, dataBase)\n      )\n\n    }\n\n  },\n\n  extract(\n    fromObject,\n    keysToExtract,\n    defaultIfMissing = undefined,\n    extractDescriptors = false\n  ) {\n    const { data } = DescriptorUtils\n    const output = { }\n\n    if (!fromObject || typeof fromObject !== 'object')\n      return output\n\n    if (!Array.isArray(keysToExtract))\n      keysToExtract = [keysToExtract]\n\n    for (const key of keysToExtract) {\n      let descriptor = Object.getOwnPropertyDescriptor(fromObject, key)\n\n      if (!descriptor)\n        descriptor = data(defaultIfMissing)\n\n      if (extractDescriptors)\n        descriptor.value = data(descriptor, { allowDescriptorValue: true })\n\n      Object.defineProperty(output, key, descriptor)\n    }\n\n    return output\n  },\n\n  /**\n   * Determines if a given value is an accessor descriptor.\n   *\n   * An accessor descriptor is a property descriptor that defines\n   * getter and/or setter functions for a property. This function\n   * checks the validity of the descriptor and whether it qualifies\n   * as an accessor.\n   *\n   * @param {Object} value - The descriptor object to evaluate.\n   * @param {boolean} [strict=true] - If true, performs a strict\n   *   validation of the descriptor.\n   * @returns {boolean} Returns true if the descriptor is valid and\n   *   is an accessor descriptor, otherwise false.\n   *\n   * @example\n   * // Example usage:\n   * const descriptor = { get: () => 42, set: (val) => {} }\n   * const result = DescriptorUtils.isAccessor(descriptor)\n   * console.log(result) // Outputs: true\n   */\n  isAccessor(value, strict = true) {\n    const stats = DescriptorUtils.isDescriptor(value, true, strict)\n    return stats.isValid && stats.isAccessor\n  },\n\n  /**\n   * Checks if a given value is a data descriptor.\n   *\n   * A data descriptor is a property descriptor that defines a value\n   * and optionally a writable attribute for a property. This function\n   * evaluates the descriptor's validity and whether it qualifies as\n   * a data descriptor.\n   *\n   * @param {Object} value - The descriptor object to evaluate.\n   * @param {boolean} [strict=true] - If true, performs a strict\n   *   validation of the descriptor.\n   * @returns {boolean} Returns true if the descriptor is valid and\n   *   is a data descriptor, otherwise false.\n   *\n   * @example\n   * // Example usage:\n   * const descriptor = { value: 42, writable: true }\n   * const result = DescriptorUtils.isData(descriptor)\n   * console.log(result) // Outputs: true\n   */\n  isData(value, strict = true) {\n    const stats = DescriptorUtils.isDescriptor(value, true, strict)\n    return stats.isValid && stats.isData\n  },\n\n  /**\n   * A function that, given a value that might be a `PropertyDescriptor`,\n   * calculates a deterministic probability that the supplied value is\n   * an object that either is a `PropertyDescriptor` or that can function\n   * as one.\n   *\n   * @param {unknown} value a JavaScript value that might be a\n   * `PropertyDescriptor` type.\n   * @param {boolean?} returnStats if this value is true, instead of returning\n   * a determined boolean value indicating the supplied value might be a\n   * `PropertyDescriptor`, an object containing the determined flags and score\n   * the led to the determination instead is returned.\n   * @param {boolean?} strict if this value is `true`, which is the default,\n   * then the function will not allow descriptor compatible objects, rather it\n   * will only return true if the object has keys that belong in a descriptor\n   * and do not form an invalid combination.\n   * @returns {IsDescriptorResponse} if `returnStats` is `true`\n   * an object of type {@link IsDescriptorStats} is returned. This object\n   * will have a lot of {@link Boolean} flags pertaining to the `true`/`false`\n   * evaluation. If `returnStats` is `false`, then a boolean value denoting\n   * whether or not the value is a {@link PropertyDescriptor} is returned\n   * instead. This is effectively the same as the `isValid` parameter from the\n   * stats block.\n   */\n  isDescriptor(value, returnStats = false, strict = true) {\n    const areBools = (...props) => props.flat().every(\n      prop => boolTypes.includes(typeof value[prop])\n    );\n\n    const areFuncs = (...props) => props.flat().every(\n      prop => funcTypes.includes(typeof value[prop])\n    );\n\n    const hasKeyFn = (property) => Reflect.has(value, property)\n    const isOfType = (type) => (element) => typeof element === type\n\n    const baseProps = [ 'configurable', 'enumerable' ]\n    const dataProps = [ 'value', 'writable' ]\n    const accessorProps = [ 'get', 'set' ]\n    const anyDescProps = [ ...baseProps, ...dataProps, ...accessorProps ]\n    const boolTypes = [ 'undefined', 'boolean' ]\n    const funcTypes = [ 'undefined', 'function' ]\n    const stats = {\n      confidence: 0,\n      hasAccessorKeys: false,\n      hasBaseDescriptorKeys: false,\n      hasDataKeys: false,\n      isAccessor: false,\n      isData: false,\n      isValid: false,\n      isBase: false,\n    }\n\n    if (!value || typeof value !== 'object' || !(value instanceof Object))\n      return returnStats ? stats : false;\n\n    let score = 0\n\n    if (value && typeof value === 'object') {\n      const objKeys = Reflect.ownKeys(value)\n      const nonDescKeys = objKeys.filter(k => !(anyDescProps.includes(k)))\n\n      if (strict && nonDescKeys.length)\n        return false\n\n      if (objKeys.length <= 4)\n        score++\n\n      stats.hasAccessorKeys =\n        accessorProps.some(hasKeyFn) && areFuncs(accessorProps)\n\n      stats.hasDataKeys =\n        dataProps.some(hasKeyFn) && areBools('writable')\n\n      stats.hasBaseDescriptorKeys =\n        baseProps.some(hasKeyFn) && areBools(baseProps)\n\n      if (stats.hasBaseDescriptorKeys)\n        score++\n\n      if (stats.hasAccessorKeys || stats.hasDataKeys)\n        score++\n\n      if (score > 0)\n        stats.isValid = true\n\n      if (score > 0 && stats.hasAccessorKeys)\n        stats.isAccessor = true\n\n      if (score > 0 && stats.hasDataKeys)\n        stats.isData = true\n\n      if (stats.isValid && !(['get','set','value'].some(hasKeyFn)))\n        stats.isBase = true\n\n      if (stats.isValid && stats.isData && Reflect.has(value, 'value'))\n        score++\n\n      else if (stats.isValid && stats.isAccessor) {\n        if ([value?.get, value?.set].some(isOfType('function')))\n          score++\n      }\n\n      if (stats.hasAccessorKeys && stats.hasDataKeys) {\n        score = 0\n        stats.isValid = false\n      }\n\n      stats.confidence = parseFloat(score / 4.0)\n    }\n\n    if (returnStats)\n      return stats\n\n    return score >= 0.0\n      ? true\n      : false;\n  },\n\n  /**\n   * Redefines a property on an object with new descriptors and options.\n   * This function allows renaming, aliasing, and redefining property\n   * descriptors such as configurable, enumerable, writable, get, and set.\n   *\n   * @param {Object} object - The target object whose property is to be\n   * redefined.\n   * @param {string|symbol} key - The key of the property to redefine.\n   * @param {Object} as - An object containing new property descriptors.\n   * @param {Object} [options] - Optional settings for renaming and aliasing.\n   * @param {string|symbol} [options.rename] - New key name for the property.\n   * @param {Array<string|symbol>} [options.alsoAs] - Additional aliases for\n   * the property.\n   * @param {Object} [options.moveTo] optionally move the descriptor from this\n   * object to another.\n   * @returns {any} the result of `object[key]` in its final state\n   *\n   * @example\n   * const obj = { a: 1 }\n   * redescribe(obj, 'a', { writable: false }, { rename: 'b', alsoAs: ['c'] })\n   * console.log(obj.b) // Outputs: 1\n   * console.log(obj.c) // Outputs: 1\n   */\n  redescribe(object, key, as, options) {\n    const { isAccessor, isData } = DescriptorUtils\n\n    const ifThen = (condition, fn, ...args) => condition && fn(...args)\n    const isBool = value => typeof value === 'boolean' || value instanceof Boolean\n    const isFunction = value => typeof value === 'function'\n    const isObject = value => value && value instanceof Object\n    const isDefined = (value, key) => isObject(value) && Reflect.has(value, key)\n    const isObjectKey = v => ['string', 'number', 'symbol'].includes(typeof v)\n    const define = (key, values) => Object.defineProperty(object, key, values)\n    const assign = (object, ...values) => Object.assign(object, ...values)\n\n    const isAnObject = isObject(object)\n    let   asIsObject = isObject(as)\n    const descriptor = isAnObject && Object.getOwnPropertyDescriptor(object, key)\n    const aliases = []\n\n    if (descriptor && !asIsObject) {\n      asIsObject = true\n      as = {}\n    }\n\n    if (isObject(options)) {\n      if (isDefined(options, 'rename')) {\n        const successfulDelete = delete object[key]\n\n        if (successfulDelete)\n          key = options.rename\n      }\n\n      if (isDefined(options, 'alsoAs')) {\n        if (Array.isArray(options.alsoAs)) {\n          for (const value of options.alsoAs.filter(v => isObjectKey(v)))\n            aliases.push(value)\n        }\n        else if (isObjectKey(options.alsoAs)) {\n          aliases.push(options.alsoAs)\n        }\n      }\n\n      if (isDefined(options, 'moveTo')) {\n        ifThen(isObject(options.moveTo), () => (object = options.moveTo))\n      }\n    }\n\n    if (isAnObject && asIsObject) {\n      let { configurable, enumerable, writable, get, set, value } = as\n\n      if (isAccessor(descriptor)) {\n        ifThen(isFunction(get), () => assign(descriptor, { get }))\n        ifThen(isFunction(set), () => assign(descriptor, { set }))\n      }\n\n      ifThen(isBool(writable) && isData(descriptor), () => {\n        assign(descriptor, {\n          writable,\n          value: isDefined(as, 'value')\n            ? value\n            : descriptor.value,\n        })\n      })\n\n      ifThen(isBool(configurable), () => assign(descriptor, { configurable }))\n      ifThen(isBool(enumerable), () => assign(descriptor, { enumerable }))\n\n      define(key, descriptor)\n\n      for (const alias of aliases) {\n        define(alias, descriptor)\n      }\n\n      return object[key]\n    }\n  },\n\n  /**\n   * Retrieves the keys associated with accessor descriptors.\n   *\n   * Accessor descriptors are property descriptors that define\n   * getter and/or setter functions for a property.\n   *\n   * @type {string[]}\n   *\n   * @example\n   * // Example usage:\n   * const keys = DescriptorUtils.kAccessorDescriptorKeys\n   * console.log(keys) // Output: ['get', 'set']\n   */\n  get kAccessorDescriptorKeys() {\n    return ['get', 'set']\n  },\n\n  /**\n   * Retrieves the keys associated with data descriptors.\n   *\n   * Data descriptors are property descriptors that define a value\n   * and optionally a writable attribute for a property.\n   *\n   * @type {string[]}\n   *\n   * @example\n   * // Example usage:\n   * const keys = DescriptorUtils.kDataDescriptorKeys\n   * console.log(keys) // Output: ['value', 'writable']\n   */\n  get kDataDescriptorKeys() {\n    return ['value', 'writable']\n  },\n\n  /**\n   * Retrieves the keys associated with shared descriptors.\n   *\n   * Shared descriptors are property descriptors that define\n   * common attributes for a property, such as whether the\n   * property is configurable or enumerable.\n   *\n   * @type {string[]}\n   *\n   * @example\n   * // Example usage:\n   * const keys = DescriptorUtils.kSharedDescriptorKeys\n   * console.log(keys) // Output: ['configurable', 'enumerable']\n   */\n  get kSharedDescriptorKeys() {\n    return ['configurable', 'enumerable']\n  },\n\n  /**\n   * Retrieves all descriptor keys, combining accessor, data, and shared\n   * descriptor keys.\n   *\n   * This getter method aggregates keys from accessor descriptors,\n   * data descriptors, and shared descriptors into a single array.\n   * This can be useful when you need to validate or inspect all\n   * possible descriptor keys.\n   *\n   * @type {string[]}\n   *\n   * @example\n   * // Example usage:\n   * const allKeys = DescriptorUtils.kDescriptorKeys\n   * console.log(allKeys)\n   * // Output: [\n   * //   'get', 'set', 'value', 'writable', 'configurable', 'enumerable'\n   * // ]\n   */\n  get kDescriptorKeys() {\n    return [\n      ...(this.kAccessorDescriptorKeys),\n      ...(this.kDataDescriptorKeys),\n      ...(this.kSharedDescriptorKeys),\n    ]\n  }\n}\n\n// Destructure the functions individually...\nconst {\n  accessor, data, describe, describeMany, extract, isDescriptor,\n  isAccessor, isData, redescribe,\n} = DescriptorUtils\n\n// ...also destructure the constants individually....\nconst {\n  kAccessorDescriptorKeys,\n  kDataDescriptorKeys,\n  kDescriptorKeys,\n  kSharedDescriptorKeys\n} = DescriptorUtils\n\n// ... so they can also be individually exported.\nexport {\n  accessor,\n  data,\n  describe,\n  describeMany,\n  extract,\n  isAccessor,\n  isData,\n  isDescriptor,\n  redescribe,\n\n  kAccessorDescriptorKeys,\n  kDataDescriptorKeys,\n  kDescriptorKeys,\n  kSharedDescriptorKeys\n}\n\n// Provide default exports as well\nexport default {\n  DescriptorUtils,\n\n  accessor,\n  data,\n  describe,\n  describeMany,\n  extract,\n  isAccessor,\n  isData,\n  isDescriptor,\n  redescribe,\n\n  kAccessorDescriptorKeys,\n  kDataDescriptorKeys,\n  kDescriptorKeys,\n  kSharedDescriptorKeys\n}\n\n// ---- non-exported helper functions ----\n\nfunction isObject(o) { return o && typeof o === 'object' }\n\nfunction hasSome(object, ...keys) { return hasQuantity('some', object, keys) }\n\nfunction hasQuantity(quantityFn, object, keys) {\n  return isObject(object) && (keys.flat(Infinity)\n    .map(key => Reflect.has(object, key))\n    [quantityFn](has => has)\n  )\n}\n\n/**\n * Small method that verbosely checks to see if a supplied value has either\n * a `typeof` compliant with {@link PropertyKey} or is an instance of the\n * {@link PropertyKey} class types.\n *\n * @param {any} value any value\n * @returns {boolean} true if it is {@link PropertyKey} compliant, false\n * otherwise.\n */\nfunction isKey(value) {\n  if (['symbol', 'string', 'number'].some(type => typeof value === type))\n    return true\n  else if (\n    (typeof value === 'object' && value !== null) &&\n    [Symbol, String, Number].some(klass => value instanceof klass)\n  )\n    return true\n\n  return false\n}\n", "import { Extension } from '@nejs/extension'\n\nimport {\n  accessor as uAccessor,\n  data as uData,\n  isDescriptor as uIsDescriptor,\n  kAccessorDescriptorKeys,\n  kDataDescriptorKeys,\n  kDescriptorKeys,\n  kSharedDescriptorKeys\n} from '../utils/descriptor.utils.js'\n\nexport class Descriptor {\n  /**\n   * The default private descriptor value is that of `enigmatic`\n   *\n   * @private\n   * @type {object}\n   */\n  _desc = undefined\n\n  /**\n   * An optionally associated object, usually the parent from which\n   * the descriptor was taken, or undefined if none was able to be\n   * derived.\n   *\n   * @type {object}\n   */\n  _object = undefined\n\n  /**\n   * Constructs a Descriptor instance which wraps and manages an object\n   * property descriptor. The constructor can handle an existing descriptor\n   * object or create a new one based on an object and a property key.\n   *\n   * @param {object|Descriptor} object - The target object or an existing\n   * Descriptor instance. If it's an object, it is used in conjunction with\n   * `key` to create a descriptor. If it's a Descriptor instance, it is used\n   * directly as the descriptor.\n   * @param {string|symbol} [key] - The property key for which the descriptor\n   * is to be created. This parameter is ignored if `object` is a Descriptor\n   * instance. If `key` is an object and `object` is a valid descriptor, `key`\n   * is treated as the associated object.\n   * @throws {Error} Throws an error if the constructed descriptor is not\n   * valid.\n   */\n  constructor(object, key) {\n    if (arguments.length === 0) {\n      this._desc = Descriptor.enigmatic\n    }\n\n    else if (Descriptor.isDescriptor(object)) {\n      this._desc = object\n      this._object = isObject(key) ? key : undefined\n    }\n\n    else if (isObject(object) && isValidKey(key)) {\n      console.log('new Descriptor(%o, %o)', object, key)\n      this._desc = Object.getOwnPropertyDescriptor(object, key)\n      this._object = object\n    }\n\n    if (!this.isDescriptor) {\n      const objectMsg = object === globalThis\n        ? '[GLOBAL]'\n        : (typeof key === 'object' ? JSON.stringify(object) : String(object));\n\n      const keyMsg = key === globalThis\n        ? '[GLOBAL]'\n        : (typeof key === 'object' ? JSON.stringify(key) : String(key));\n\n      console.error(`\n      Descriptor(object: ${object}, key: ${key}) FAILED:\n        object:      ${objectMsg}\n        key:         ${keyMsg}\n        descriptor:  `, this._desc\n      )\n\n      throw new Error(`Not a valid descriptor:`, this._desc)\n    }\n  }\n\n  /**\n   * Detects whether or not this instance is an accessor object descriptor\n   *\n   * @returns {boolean} true if this object has a getter or setter and is not\n   * a data descriptor\n   */\n  get isAccessor() {\n    return uIsDescriptor(this._desc, true).isAccessor\n  }\n\n  /**\n   * Detects whether or not this instance is an data object descriptor\n   *\n   * @returns {boolean} true if this object has a value property and is not\n   * an accessor descriptor\n   */\n  get isData() {\n    return uIsDescriptor(this._desc, true).isData\n  }\n\n  /**\n   * Detects whether or not this instance is a valid object descriptor\n   *\n   * @returns {boolean} true if this descriptor store is a valid descriptor\n   */\n  get isDescriptor() {\n    return uIsDescriptor(this._desc)\n  }\n\n  /**\n   * Retrieves the {@link get} function for this accessor and binds it to\n   * the object from which the descriptor was derived, if that value is set.\n   * Otherwise this method is identical to the {@link get} accessor.\n   *\n   * @returns {function} the getter if one is defined. If possible this\n   * getter will be bound the associated and previously set `object`.\n   */\n  get boundGet() {\n    return (isObject(this._object) ? this.get?.bind(this._object) : this.get)\n  }\n\n  /**\n   * Retrieves the {@link set} function for this accessor and binds it to\n   * the object from which the descriptor was derived, if that value is set.\n   * Otherwise this method is identical to the {@link set} accessor.\n   *\n   * @returns {function} the setter if one is defined. If possible this\n   * setter will be bound the associated and previously set `object`.\n   */\n  get boundSet() {\n    return (isObject(this._object) ? this.set?.bind(this._object) : this.set)\n  }\n\n  /**\n   * The function checks the descriptor's associated object has been set on this\n   * instance of `Descriptor`.\n   *\n   * @returns {boolean} `true` if the `object` property has been set,\n   * `false` otherwise\n   */\n  get hasObject() { return isObject(this._object) }\n\n  /**\n   * Returns the descriptor's associated `object` value. This is usually the\n   * parent object from which the descriptor was derived. If the value is preset\n   * it will be returned. Undefined will be returned otherwise\n   *\n   * @returns {object} the associated object for this descriptor or undefined\n   * if it has not yet been set.\n   */\n  get object() { return this._object }\n\n  /**\n   * Sets the descriptor's associated `object` value. This is usually the\n   * parent object from which the descriptor was derived.\n   *\n   * @param {object} value sets the object for which this descriptor is to\n   * be associated with.\n   */\n  set object(value) { this._object = Object(value) }\n\n  /**\n   * Take the descriptor defined by this objects values and apply them to\n   * the specified object using the specified key.\n   *\n   * @param {object} object the object to apply this descriptor to\n   * @param {string|symbol} forKey the string or symbol for which this\n   * descriptor will abe applied\n   */\n  applyTo(object, forKey, bindAccessors = false) {\n    if (!isObject(object) || !isValidKey(forKey)) {\n      throw new Error( `Cannot apply descriptor to non-object or invalid key`)\n    }\n\n    return Object.defineProperty(object, forKey, this.toObject(bindAccessors))\n  }\n\n  /**\n   * Converts this Descriptor class instance into a basic object descriptor\n   * that is accepted by all the standard JavaScript runtime methods that\n   * deal with object descriptors.\n   *\n   * @param {boolean|object} bindAccessors if `true`, a non-fatal attempt to\n   * bind accessor getter and setter methods is made before returning the\n   * object. If `bindAccessors` is truthy and is also an object, this is the\n   * object the accessors will be bound to. If the value is falsy or if the\n   * descriptor instance represents a data descriptor, nothing happens.\n   * @returns {object} the object instance's basic object representation as\n   * a descriptor.\n   */\n  toObject(bindAccessors = false) {\n    let descriptor = { ...this._desc }\n\n    if (bindAccessors && this.isAccessor) {\n      if (this.hasObject) {\n        descriptor = {\n          ...descriptor,\n          get: this.boundGet,\n          set: this.boundSet\n        }\n      }\n      else if (isObject(bindAccessors)) {\n        descriptor = {\n          ...descriptor,\n          get: this.get?.bind(bindAccessors),\n          set: this.set?.bind(bindAccessors)\n        }\n      }\n    }\n\n    return descriptor\n  }\n\n  /**\n   * The function returns a string representation of a descriptor object with\n   * additional information about its type when used in the NodeJS repl.\n   *\n   * @param {number} depth - The `depth` parameter is used to specify the\n   * maximum depth to which nested objects and arrays will be formatted. If\n   * the depth is exceeded, the output will be truncated with ellipses.\n   * @param {object} options - The `options` parameter is an object that\n   * contains various configuration options for the `inspect` function.\n   * These options can be used to customize the output of the inspection.\n   * @param {function} inspect - The `inspect` parameter is a function that\n   * is used to convert an object into a string representation. It is\n   * typically used for debugging purposes or when displaying an object's\n   * properties.\n   * @returns a string that represents a descriptor. The string includes the\n   * type of the descriptor (either \"Accessor\" or \"Data\") and the result of\n   * inspecting the descriptor object using the provided options and depth.\n   */\n  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n    const type = this.isAccessor ? ' (Accessor)' : this.isData ? ' (Data)' : ''\n    return `Descriptor${type} ${inspect(this._desc, {...options, depth})}`\n  }\n\n  /**\n   * Converts this descriptor object into a base representation\n   *\n   * @param {string} hint one of `string`, `number` or default;\n   * @returns if the hint is 'string', then a string identifying the enum\n   * and its type is returned. `number` will always be NaN since it is incoret\n   */\n  [Symbol.toPrimitive](hint) {\n    switch (hint) {\n      case 'string':\n        if (this.isAccessor) {\n          const props = []\n\n          if (Reflect.has(this._desc, 'get')) props.push('getter')\n          if (Reflect.has(this._desc, 'set')) props.push('setter')\n\n          return `Accessor (${props.join(', ')})`\n        }\n        else if (this.isData) {\n          const props = []\n\n          if (Reflect.has(this._desc, 'value')) props.push('value')\n          if (Reflect.has(this._desc, 'writable')) props.push('writable')\n\n          return `Data (${props.join(', ')})`\n        }\n        break\n\n      case 'number':\n        return NaN\n\n      default:\n        return this.toObject()\n    }\n  }\n\n  /**\n   * Ensures that the constructor of this object instance's name\n   * is returned if the string tag for this instance is queried\n   *\n   * @returns {string} the name of the class\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * The function `getData` retrieves the value of a property from an object\n   * if it exists and is a data property.\n   *\n   * @param {object} object - The \"object\" parameter is the object from which\n   * we want to retrieve data.\n   * @param {string|symbol} property - The `property` parameter is the name of\n   * the property that you want to retrieve the data from.\n   * @returns either the value of the specified property if it exists and is\n   * a data property, or undefined if the property does not exist or is not\n   * a data property.\n   */\n  static getData(object, property) {\n    if (!isObject(object) || !Reflect.has(object, property)) {\n      return undefined;\n    }\n\n    const descriptor = Descriptor.for(object, property, true)\n    if (!descriptor.isData) {\n      return null\n    }\n\n    return descriptor.value\n  }\n\n  /**\n   * The function `getAccessor` checks if an object has a getter/setter accessor\n   * for a given property and returns the accessor functions if found.\n   *\n   * @param object - The `object` parameter is the object from which we want to\n   * retrieve the accessor for a specific property.\n   * @param property - The `property` parameter is the name of the property for\n   * which we want to get the accessor.\n   * @returns an object that contains the getter and setter functions for the\n   * specified property of the given object. If the property is an accessor\n   * property (defined with a getter and/or setter), the returned object will\n   * also have additional properties such as \"accessor\" and \"descriptor\". If\n   * the property is not found or is not an accessor property, the function\n   * returns undefined.\n   */\n  static getAccessor(object, property) {\n    if (!isObject(object) || !Reflect.has(object, property)) {\n      return undefined;\n    }\n\n    const descriptor = Descriptor.for(object, property, true)\n    if (!descriptor.isAccessor) {\n      return null\n    }\n\n    return descriptor.get.bind(object)()\n  }\n\n  /**\n   * The function returns an object with enumerable and configurable properties\n   * based on the input parameters.\n   *\n   * @param [enumerable=false] - A boolean value indicating whether the property\n   * can be enumerated (listed) when iterating over the object's properties.\n   * @param [configurable=false] - The `configurable` parameter determines\n   * whether the property can be deleted or its attributes can be modified.\n   * If `configurable` is set to `true`, the property can be deleted and its\n   * attributes can be changed. If `configurable` is set to `false`, the\n   * property cannot be deleted and\n   * @returns An object with the properties `enumerable` and `configurable` is\n   * being returned. The values of these properties are determined by the\n   * arguments passed to the `base` function.\n   */\n  static base(enumerable = false, configurable = false) {\n    return {\n      enumerable,\n      configurable\n    }\n  }\n\n  /**\n   * The function \"newAccessor\" creates a new property descriptor object with a\n   * getter and setter function, along with optional enumerable and configurable\n   * flags.\n   *\n   * @param getter - The getter parameter is a function that will be used as the\n   * getter for the property. It will be called when the property is accessed.\n   * @param setter - The `setter` parameter is a function that will be used as\n   * the setter for the property. It will be called whenever the property is\n   * assigned a new value.\n   * @param [] - - `getter`: A function that will be used as the getter for the\n   * property.\n   * @returns an object with properties \"get\", \"set\", \"enumerable\", and\n   * \"configurable\".\n   */\n  static accessor() {\n    return uAccessor(...arguments)\n  }\n\n  /**\n   * The function \"newData\" creates a new data object with customizable\n   * properties.\n   *\n   * @param value - The value parameter represents the value that will be\n   * assigned to the property.\n   * @param [writable=true] - The `writable` parameter determines whether the\n   * value of the property can be changed. If `writable` is set to `true`, the\n   * value can be changed. If `writable` is set to `false`, the value cannot be\n   * changed.\n   * @param [] - - `value`: The value to be assigned to the property.\n   * @returns an object with properties `value`, `enumerable`, `writable`, and\n   * `configurable`.\n   */\n  static data(\n    value,\n    writable = true,\n    { enumerable, configurable } = { configurable: true, enumerable: true }\n  ) {\n    return uData(value, writable, enumerable, configurable)\n  }\n\n  /**\n   * Shorthand for Object.getOwnPropertyDescriptor()\n   *\n   * @param {object} object a non-null object instance\n   * @param {string|symbol} key a symbol or string referencing which key on the\n   * object to return a descriptor for.\n   * @returns an object descriptor for the requested field or null\n   */\n  static for(object, key, wrap = false) {\n    if (!isObject(object) || !isValidKey(key) || !Reflect.has(object, key)) {\n      return null\n    }\n\n    return (wrap\n      ? new Descriptor(Object.getOwnPropertyDescriptor(object, key))\n      : Object.getOwnPropertyDescriptor(object, key)\n    )\n  }\n\n  /**\n   * The function checks if an object is a likely an object descriptor in\n   * JavaScript. This is determined as an object with some of the known\n   * descriptor keys (e.g. enumerable, configurable, value, writable, get,\n   * or set). Technically, any object could serve as a descriptor but this\n   * function only returns true if known descriptor keys are found.\n   *\n   * @param {any} object - Any value we want to check for being a descriptor.\n   * @param {boolean} returnStatsInstead defaults to false, but if the value\n   * is `true` then an object with reasoning behind the decision of whether\n   * or not the\n   * @returns {IsDescriptorResponse} either a {@link boolean} value or\n   * an object conforming to {@link IsDescriptorStats} if `returnStatsInstead`\n   * is `true`\n   *\n   * @see {@link DescriptorUtils.isDescriptor}\n   */\n  static isDescriptor(object, returnStatsInstead = false) {\n    return uIsDescriptor(object, returnStatsInstead)\n  }\n\n  /**\n   * The function checks if a given property descriptor or property of an\n   * object is an accessor.\n   *\n   * @param {object} objectOrDescriptor - The `objectOrDescriptor` parameter\n   * can be either a descriptor object or a property name.\n   * @param {(string|number|symbol)?} property the property name you wish to\n   * check the validity as an accessor descriptor. Only expected if the\n   * `objectOrDescriptor` parameter is the object that would contain this\n   * property.\n   * @returns {@link Boolean} returning `true` if the `descriptor` object\n   * has any keys that match the {@link Descriptor.ACCESSOR_KEYS} array,\n   * otherwise it returns `false`.\n   */\n  static isAccessor(objectOrDescriptor, property) {\n    const needsDescriptor =\n      objectOrDescriptor &&\n      property &&\n      isObject(objectOrDescriptor) &&\n      isValidKey(property);\n\n    const descriptor = needsDescriptor\n      ? Descriptor.for(objectOrDescriptor, property)\n      : objectOrDescriptor\n\n    return uIsDescriptor(descriptor, true).isAccessor\n  }\n\n  /**\n   * The function checks if a given property or descriptor is a data property.\n   *\n   * @param {object} objectOrDescriptor - The `objectOrDescriptor` parameter\n   * can be either a descriptor object or a property name.\n   * @param {(string|number|symbol)?} property the property name you wish to\n   * check the validity as an accessor descriptor. Only expected if the\n   * `objectOrDescriptor` parameter is the object that would contain this\n   * property.\n   * @returns {@link Boolean} returning `true` if the `descriptor` object\n   * has any keys that match the {@link Descriptor.DATA_KEYS} array, otherwise\n   * it returns `false`.\n   */\n  static isData(objectOrDescriptor, property) {\n    const needsDescriptor =\n      objectOrDescriptor &&\n      property &&\n      isObject(objectOrDescriptor) &&\n      isValidKey(property);\n\n    const descriptor = needsDescriptor\n      ? Descriptor.for(objectOrDescriptor, property)\n      : objectOrDescriptor\n\n    return uIsDescriptor(descriptor, true).isData\n  }\n\n  /**\n   * A base descriptor (new for each read) that is both enumerable and\n   * configurable\n   *\n   * @returns `{ enumerable: true, configurable: true }`\n   */\n  static get flexible() {\n    return { enumerable: true, configurable: true }\n  }\n\n  /**\n   * A base descriptor (new for each read) that is not enumerable but is\n   * configurable\n   *\n   * @returns `{ enumerable: false, configurable: true }`\n   */\n  static get enigmatic() {\n    return { enumerable: false, configurable: true }\n  }\n\n  /**\n   * A base descriptor (new for each read) that is neither enumerable\n   * nor configurable.\n   *\n   * @returns `{ enumerable: false, configurable: false }`\n   */\n  static get intrinsic() {\n    return { enumerable: false, configurable: false }\n  }\n\n  /**\n   * A base descriptor (new for each read) that is enumerable but\n   * not configurable\n   *\n   * @returns `{ enumerable: true, configurable: false }`\n   */\n  static get transparent() {\n    return { enumerable: true, configurable: false }\n  }\n\n  /**\n   * The function returns an array of shared descriptor keys.\n   *\n   * @returns An array containing the strings 'configurable' and 'enumerable'.\n   */\n  static get SHARED_KEYS() {\n    return kSharedDescriptorKeys\n  }\n\n  /**\n   * The function returns an array of accessor descriptor keys.\n   *\n   * @returns An array containing the strings 'get' and 'set' is being returned.\n   */\n  static get ACCESSOR_KEYS() {\n    return kAccessorDescriptorKeys\n  }\n\n  /**\n   * The function returns an array of data descriptor keys.\n   *\n   * @returns An array containing the strings 'value' and 'writable' is being\n   * returned.\n   */\n  static get DATA_KEYS() {\n    return kDataDescriptorKeys\n  }\n\n  static {\n    for (const key of kDescriptorKeys) {\n      Object.defineProperties(Descriptor.prototype, {\n        [key]: uAccessor(\n          function getMaker(storage) { return function get() {\n            return this._desc[key]\n          }},\n          function setMaker(storage) { return function set(value) {\n            this._desc[key] = value\n          }},\n        )\n      })\n    }\n  }\n}\n\nexport const DescriptorExtensions = new Extension(Descriptor)\n\nfunction typeOrType(type, Class, notNullish = true) {\n  return (value) => (\n    (!notNullish || (notNullish && value !== null && value !== undefined)) &&\n    (typeof value === type || (value && value instanceof Class))\n  )\n}\n\nfunction isObject(o) { return typeOrType('object', Object)(o) }\nfunction isString(o) { return typeOrType('string', String)(o) }\nfunction isNumber(o) { return typeOrType('number', Number)(o) }\nfunction isSymbol(o) { return typeOrType('symbol', Symbol)(o) }\nfunction isFunction(o) { return typeOrType('function', Function)(o) }\nfunction isValidKey(o) { return isString(o) || isNumber(o) || isSymbol(o) }\n\nfunction hasAll(object, ...keys) { return hasQuantity('every', object, keys) }\nfunction hasSome(object, ...keys) { return hasQuantity('some', object, keys) }\nfunction hasQuantity(quantityFn, object, keys) {\n  return isObject(object) && (keys.flat(Infinity)\n    .map(key => Reflect.has(object, key))\n    [quantityFn](has => has)\n  )\n}\nfunction hasOne(object, ...keys) {\n  return isObject(object) && (keys.flat(Infinity)\n    .map(key => Reflect.has(object, key))\n    .filter(has => has)\n    .length === 1\n  )\n}", "import { Extension } from '@nejs/extension'\n\nexport class Property {\n  constructor(key, descriptor) {\n    if (key.startsWith(':')) key = Symbol.for(key.slice(1))\n    if (typeof key !== 'string' && typeof key !== 'symbol') {\n      throw new TypeError('Key or symbol or :symbol must be supplied!');\n    }\n\n    this.key = key;\n\n    if (!Property.is.descriptor(descriptor)) {\n      this.descriptor = {\n        value: descriptor,\n        writable: true,\n        configurable: true,\n        enumerable: true,\n      }\n    }\n    else {\n      this.descriptor = descriptor;\n    }\n  }\n\n  apply(toObject, asKey) {\n    if (!toObject || !['object','function'].some(k => k == typeof toObject))\n      return;\n\n    return Object.defineProperty(toObject, asKey ?? this.key, this.descriptor)\n  }\n\n  get descriptor() {\n    const baseline = { configurable: true, enumerable: false };\n    const result = {\n      enumerable: this.meta.enumerable,\n      configurable: this.meta.configurable,\n    };\n\n    if (this.is.accessor) {\n      result.get = this.meta.accessor.get;\n      result.set = this.meta.accessor.set;\n    }\n    else {\n      result.value = this.meta.data.value;\n      result.writable = this.meta.data.writable;\n    }\n\n    return Object.defineProperties(result, {\n      make: {\n        ...baseline,\n        get() {\n          const self = this;\n\n          return {\n            get enumerable() {self.enumerable = true; return self},\n            get hidden() {self.enumerable = false; return self},\n\n            get writable() {self.writable = true; return self},\n            get readonly() {self.writable = false; return self},\n\n            get configurable() {self.configurable = true; return self},\n            get immutable() {self.configurable = false; return self},\n          }\n        }\n      },\n\n      is: {\n        ...baseline,\n        get() {\n          const self = this;\n\n          return {\n            get accessor() {return self.is.accssor},\n            get data() {return self.is.data}\n          }\n        }\n      },\n    })\n  }\n\n  set descriptor(descriptor) {\n    const { is } = this.constructor;\n\n    if (!is.descriptor(descriptor))\n      return;\n\n    this.meta.configurable = descriptor.configurable ?? true\n    this.meta.enumerable = descriptor.enumerable ?? true\n\n    if (Reflect.has(descriptor, 'get') || Reflect.has(descriptor, 'set')) {\n      const { get, set } = descriptor;\n\n      if (get !== undefined) this.meta.accessor.get = get;\n      if (set !== undefined) this.meta.accessor.set = set;\n    }\n    else {\n      const { value, writable } = descriptor;\n\n      this.meta.data.value = value;\n      this.meta.data.writable = writable ?? true;\n    }\n  }\n\n  get is() {\n    const self = this;\n\n    return {\n      get accessor() {\n        return !!(\n          self.meta.accessor.get ||\n          self.meta.accessor.set\n        );\n      },\n\n      get data() {\n        return !!!this.accessor\n      },\n    }\n  }\n\n  toString(colors = false, {key, descriptor} = {}) {\n    const bold = s => colors ? `\\x1b[1m${s}\\x1b[22m` : s;\n    const dim = s => colors ? `\\x1b[2m${s}\\x1b[22m` : s;\n    const red = s => colors ? `\\x1b[31m${s}\\x1b[39m` : s;\n    const green = s => colors ? `\\x1b[32m${s}\\x1b[39m` : s;\n    const blue = s => colors ? `\\x1b[34m${s}\\x1b[39m` : s;\n\n    if (!key) ({key} = this);\n    if (!descriptor || !Property.is.descriptor(descriptor))\n      ({descriptor} = this);\n\n    const buffer = [`${bold(key)} { `]\n    const keyPresent = (object) => (key) => Reflect.has(object, key)\n    const eqeq = (value, compare = (a,b) => a === b) =>\n      (element) => compare(element, value);\n\n    if (['get', 'set'].some(keyPresent(descriptor))) {\n      if (descriptor.get) {\n        buffer.push(blue('getter'))\n        if (descriptor.set) {\n          buffer.push(bold('|'))\n        }\n      }\n\n      if (descriptor.set) {\n        buffer.push(blue('setter'))\n      }\n    }\n    else {\n      buffer.push(green('value'))\n      buffer.push(bold('|'))\n      buffer.push(descriptor.writable ? green('writable') : red('readonly'))\n    }\n\n    buffer.push(' ')\n    buffer.push(descriptor.configurable ? green('mutable') : red('immuatable'))\n\n    buffer.push(' ')\n    buffer.push(descriptor.enumerable ? green('visible') : red('hidden'))\n\n    buffer.push(' }')\n\n    return buffer.join('')\n  }\n\n  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n    return this.toString(true);\n  }\n\n  /**\n   * Creates an accessor property with customizable getter and setter functions.\n   *\n   * This method offers flexible ways to define accessor properties, including\n   * support for storage-based getters and setters. It can handle various input\n   * formats, making it versatile for different use cases.\n   *\n   * @param {string} name - The name of the accessor property.\n   * @param {Object} accessors - Object containing getter and/or setter functions.\n   * @param {Function} [accessors.get] - Getter function for the property.\n   * @param {Function} [accessors.set] - Setter function for the property.\n   * @param {Object} [accessors.prototype] - Prototype object for getter/setter.\n   * @param {Object} [options] - Additional options for the accessor property.\n   * @param {boolean} [options.configurable=true] - Whether property is configurable.\n   * @param {boolean} [options.enumerable=true] - Whether property is enumerable.\n   * @param {Object} [options.storage] - Storage object for getter/setter closures.\n   * @returns {Property} A new Property instance representing the accessor.\n   * @throws {TypeError} If no name, getter, or setter is provided.\n   *\n   * @example\n   * // Basic usage\n   * Property.accessor('color', {\n   *   get() { return this._color; },\n   *   set(value) { this._color = value; }\n   * });\n   *\n   * @example\n   * // Using storage\n   * Property.accessor('keyword', {\n   *   get(storage) { return () => storage.keyword; },\n   *   set(storage) { return (value) => { storage.keyword = value; } }\n   * }, { storage: { keyword: 'initial' } });\n   *\n   * @example\n   * // Using named getter function\n   * Property.accessor('color', function get() { return 'red' })\n   *\n   * @example\n   * // Using prototype\n   * const ColorAccessors = {\n   *   red: { get() { return this._red; } }\n   * };\n   * Property.accessor('red', ColorAccessors.red);\n   */\n  static accessor(\n    name,\n    {get, set, prototype},\n    {configurable, enumerable, storage} = {}\n  ) {\n    if (!get && !set && prototype) {\n      const constructor = prototype?.constructor;\n\n      if (constructor?.name === 'get') {\n        get = constructor;\n      }\n      else if (constructor?.name === 'set') {\n        set = constructor\n      }\n    }\n\n    if (get && storage && get.length == 1) {\n      get = get(storage);\n    }\n\n    if (set && storage && set.length == 1) {\n      set = set(storage);\n    }\n\n    if (!name && !get && !set) throw new TypeError('Cannot create accessor');\n\n    configurable ??= true\n    enumerable ??= true\n\n    return new Property(name, { get, set, configurable, enumerable });\n  }\n\n  static data(name, value, { writable, configurable, enumerable } = {}) {\n    if (!name) throw new TypeError('Cannot create data property without name')\n\n    writable ??= true\n    configurable ??= true\n    enumerable ??= true\n\n    return new Property(name, { value, writable, configurable, enumerable })\n  }\n\n  static from(object, name) {\n    const descriptor = Object.getOwnPropertyDescriptor(object, name);\n    return new Property(name, descriptor);\n  }\n\n  static get is() {\n    return {\n      object(value) {\n        return value && ['object','function'].some(k => k == typeof value);\n      },\n\n      descriptor(object) {\n        if (!Property.is.object(object)) {\n          return false;\n        }\n\n        const present = element => Reflect.has(object, element);\n        const props = {\n          base: ['configurable', 'enumerable'],\n          data: ['writable', 'value'],\n          accessor: ['get', 'set'],\n        };\n\n        if (Object.getOwnPropertyNames(object).length > 4)\n          return false;\n\n        if (props.data.some(present) && props.accessor.some(present))\n          return false;\n\n        if (props.base.some(present)) return true;\n        if (props.data.some(present)) return true;\n        if (props.accessor.some(present)) return true;\n\n        return false;\n      }\n    }\n  }\n\n  static {\n    const storage = Object.assign(Object.create(null), {\n      key: undefined,\n      meta: {\n        enumerable: true,\n        configurable: true,\n        accessor: {\n          get: undefined,\n          set: undefined\n        },\n        data: {\n          value: undefined,\n          writable: true\n        },\n      },\n    });\n\n    basic_accessor(this.prototype, 'key', storage.key, storage)\n    basic_accessor(this.prototype, 'meta', storage.meta, storage);\n  }\n}\n\nexport const PropertyExtensions = new Extension(Property);\n\nfunction basic_accessor(prototype, key, initialValue, storage = {}) {\n  storage[key] = initialValue;\n\n  Object.defineProperty(prototype, key, {\n    get() {\n      return storage[key]\n    },\n    set(value) {\n      storage[key] = value\n    },\n    enumerable: true,\n    configurable: true,\n  });\n\n  return Object.getOwnPropertyDescriptor(prototype, key);\n}", "import { Patch } from '@nejs/extension'\n\nimport { SymbolExtensions } from './symbol.extensions.js';\nimport { Descriptor } from './classes/descriptor.js';\nimport { Property } from './classes/property.js';\n\nimport { as, has, is, si } from './utils/toolkit.js';\nimport { copyObject } from './utils/copy.object.js';\n\nconst { keys: symkeys } = SymbolExtensions.patches\n\n/**\n * `ObjectExtensions` is a constant that applies a patch to the global\n * `Object` constructor. This patch extends the `Object` with additional\n * methods and properties, enhancing its functionality.\n *\n * The `Patch` function takes two arguments: the target object to be patched\n * (in this case, `Object`), and an object containing the methods and\n * properties to be added to the target object.\n *\n * @type {Patch}\n * @memberof module:object.extensions\n */\nexport const ObjectExtensions = new Patch(Object, {\n  [Patch.kMutablyHidden]: {\n    add(...args) {\n      const { isDescriptor } = Descriptor\n      const { isObject: isObj } = this\n      const { kDescriptorStore } = this\n\n      let obj, key, value, _get, _set, storage, storageKey\n      let _type, _flag, _desc\n\n      // Check to see if we received multiple arguments or an object\n      if (args.length && isObj(args[0])) {\n        ({\n          to: obj,\n          key,\n          value,\n          get: _get,\n          set: _set,\n          storage,\n          storageKey,\n          type: _type = ['accessor', 'data'][1],\n          flag: _flag = undefined,\n          descriptorBase: _desc = undefined,\n        } = args[0])\n      }\n      else if (args.length > 1) {\n        ([\n          to,\n          _type,\n          key,\n          getOrValue,\n          _set,\n          storage,\n          storageKey,\n          _flag,\n          _desc,\n        ] = args)\n\n        obj = to\n        _type = (\n          ['accessor', 'data'].includes(_type.toLowerCase())\n          ? _type.toLowerCase() : 'data'\n        )\n        _get = _type === 'accessor' ? getOrValue : undefined\n        _value = _type === 'data' ? getOrValue : undefined\n      }\n\n      if (!this.isObject(obj)) {\n        console.warn('Object.add() must receive an object for `toObject`')\n        return obj;\n      }\n\n      const more = isDescriptor(_desc) ? _desc : {}\n      const flag = _flag || Object.definitionType.mutablyVisible\n      const props = { ...Patch.getDescriptorOverridesFromSymbol(flag), ...more }\n      const type = (['accessor', 'data'].includes(_type)\n        ? String(_type).toLowerCase() : 'data'\n      )\n\n      switch (type) {\n        case 'accessor':\n          let store = storage;\n          let storeKey = storageKey || key\n          let makeStore = false\n          let get = _get;\n          let set = _set;\n\n          if (!is.truthy(get) && !is.function(get)) { get = undefined }\n          if (!is.truthy(set) && !is.function(set)) { set = undefined }\n\n          if (isObj(store) ||is.true(store) || is.function(store)) {\n            makeStore =is.true(store)\n            store = is.fn(store) ? store() : store\n            store = is.object(store) ? store : (makeStore && {} || undefined)\n          }\n          // store should be defined by here: object or undefined\n\n          if ((!get && !set) && makeStore) {\n            // being lazy here, someone has defined we make an accessor but\n            // wants the default accessor behaviors with an associated store\n            // made by us.\n            Object.defineProperty(obj, kDescriptorStore, {\n              value: symkeys.add('descriptor.store', store),\n              configurable: true,\n              enumerable: false,\n              writable: true,\n            })\n\n            get = () => this[kDescriptorStore]?.data?.[storeKey]\n            set = (value) => { this[kDescriptorStore].data[storeKey] = value }\n          }\n\n          else if (get?.length && set?.length > 1 && store) {\n            // if we received a get or set that takes more arguments than\n            // expected, assume the last argument should be the store variable\n            // so we execute the supplied function with the storage and its\n            // results or byproducts are the result to the get/set we define\n            const innerGet = get\n            const innerSet = set\n            get = () => innerGet(store)\n            set = (value) => innerSet(value, store)\n          }\n          // get and set should be in their final state by here\n\n          Object.defineProperty(obj, key, { ...props, get, set })\n          break\n\n        case 'data':\n          Object.defineProperty(obj, key, { ...props, value })\n          break\n      }\n\n      return obj\n    },\n\n    addAccessor(to, key, getter, setter, storage) {\n      const store = storage ?? (!getter && !setter) ? true : undefined;\n      return this.add({ to, key, get: getter, set: setter, storage: store })\n    },\n\n    addData(to, key, value) {\n      return this.add({ to, key, value })\n    },\n\n    /**\n     * Creates a shallow copy of the provided object(s).\n     *\n     * This method uses the `copyObject` function with the `deep` parameter\n     * set to `false`, indicating a shallow copy. It takes a destination\n     * object and any number of source objects, and copies the properties\n     * from the source objects to the destination object. If a property\n     * already exists on the destination object, it will be overwritten.\n     *\n     * Note: This method does not copy nested objects or arrays. They are\n     * copied by reference, not by value. To create a deep copy, use the\n     * `deepCopy` method instead.\n     *\n     * @param {object} destination - The object to which properties will be\n     * copied.\n     * @param {...object} sources - The source object(s) from which\n     * properties will be copied.\n     * @returns {object} The destination object with the copied properties.\n     *\n     * @example\n     * const obj1 = { a: 1, b: 2 };\n     * const obj2 = { b: 3, c: 4 };\n     * const result = ObjectExtensions.copy(obj1, obj2);\n     * console.log(result); // Output: { a: 1, b: 3, c: 4 }\n     */\n    copy(destination, ...sources) {\n      return copyObject(false, destination, ...sources)\n    },\n\n    /**\n     * Creates a deep copy of the provided object(s).\n     *\n     * This method uses the `copyObject` function with the `deep` parameter\n     * set to `true`, indicating a deep copy. It takes a destination\n     * object and any number of source objects, and copies the properties\n     * from the source objects to the destination object. If a property\n     * already exists on the destination object, it will be overwritten.\n     *\n     * Note: This method copies nested objects or arrays by value, not by\n     * reference. To create a shallow copy, use the `copy` method instead.\n     *\n     * @param {object} destination - The object to which properties will be\n     * copied.\n     * @param {...object} sources - The source object(s) from which\n     * properties will be copied.\n     * @returns {object} The destination object with the copied properties.\n     *\n     * @example\n     * const obj1 = { a: 1, b: { c: 2 } };\n     * const obj2 = { b: { d: 3 }, e: 4 };\n     * const result = ObjectExtensions.deepCopy(obj1, obj2);\n     * console.log(result); // Output: { a: 1, b: { d: 3 }, e: 4 }\n     */\n    deepCopy(destination, ...sources) {\n      return copyObject(true, destination, ...sources)\n    },\n\n    /**\n     * Defines a new property on an object with a specified value and\n     * visibility/mutability flag. The flag determines the visibility and\n     * mutability of the property. By default, the property is defined as\n     * mutably hidden.\n     *\n     * @param {object} object - The object on which to define the property.\n     * @param {string} key - The name of the property to be defined.\n     * @param {any} value - The value of the property to be defined.\n     * @param {symbol} [flag=Object.definitionType.mutablyHidden] - The\n     * visibility/mutability flag for the property. This should be one of the\n     * symbols available in `ObjectExtensions.definitionType`.\n     * @returns {object} The object with the newly defined property.\n     *\n     * @example\n     * // Define a new mutably hidden property on an object\n     * const myObject = {};\n     * const myValue = 'Hello, world!';\n     * const hiddenSymbol = Object.definitionType.mutablyHidden;\n     * Object.define(myObject, 'myProperty', myValue, hiddenSymbol);\n     * // myObject now has a mutably hidden property 'myProperty' with value\n     * // 'Hello, world!'\n     */\n    define(object, key, value, flag = Object.definitionType.mutablyHidden) {\n      const properties = Patch.getDescriptorOverridesFromSymbol(flag)\n      return Object.defineProperty(object, key, { ...properties, value })\n    },\n\n    /**\n     * A getter property that provides access to the definition types used\n     * for object property definitions. These types are used to control the\n     * visibility and mutability of object properties.\n     *\n     * @returns {Object} An object with getter properties for each definition\n     * type. The properties are:\n     * - `mutablyHidden`: A symbol representing a mutably hidden property,\n     *   non-enumerable, but configurable.\n     * - `mutablyVisible`: A symbol representing a mutably visible property,\n     *   enumerable, configurable\n     * - `immutablyHidden`: A symbol representing an immutably hidden property,\n     *   non-enumerable, non-configurable.\n     * - `immutablyVisible`: A symbol representing an immutably visible\n     *   property, enumerable, non-configurable.\n     *\n     * @example\n     * // Get the symbol for a mutably hidden property\n     * const hiddenSymbol = Object.definitionType.mutablyHidden;\n     *\n     * // Define a new mutably hidden property on an object\n     * Object.define(myObject, 'myProperty', myValue, hiddenSymbol);\n     */\n    get definitionType() {\n      return {\n        get mutablyHidden() { return Patch.kMutablyHidden },\n        get mutablyVisible() { return Patch.kMutablyVisible },\n        get immutablyHidden() { return Patch.kImmutablyHidden },\n        get immutablyVisible() { return Patch.kImmutablyVisible },\n      }\n    },\n\n    /**\n     * Defines a new accessor property on an object with specified getter and\n     * setter functions and a visibility/mutability flag. The flag determines\n     * the visibility and mutability of the property. By default, the property\n     * is defined as mutably hidden.\n     *\n     * @param {object} object - The object on which to define the property.\n     * @param {string} key - The name of the property to be defined.\n     * @param {function} get - The getter function for the property.\n     * @param {function} set - The setter function for the property.\n     * @param {symbol} [flag=Object.definitionType.mutablyHidden] - The\n     * visibility/mutability flag for the property. This should be one of the\n     * symbols available in `ObjectExtensions.definitionType`.\n     * @returns {object} The object with the newly defined property.\n     *\n     * @example\n     * // Define a new mutably hidden accessor property on an object\n     * const myObject = {};\n     * const hiddenSymbol = ObjectExtensions.definitionType.mutablyHidden;\n     * ObjectExtensions.defineAccessor(\n     *   myObject,\n     *   'myProperty',\n     *   () => 'Hello, world!',\n     *   (value) => console.log(`Setting value: ${value}`),\n     *   hiddenSymbol\n     * );\n     * // myObject now has a mutably hidden property 'myProperty' with getter\n     * // and setter functions\n     */\n    defineAccessor(\n      object, key, get, set, flag = Object.definitionType.mutablyHidden\n    ) {\n      const properties = Patch.getDescriptorOverridesFromSymbol(flag)\n      return Object.defineProperty(object, key, { ...properties, get, set })\n    },\n\n    /**\n     * Creates a new object from an array of key-value pairs (entries), with an\n     * optional prototype and reducer function. If no prototype is provided,\n     * the default Object.prototype is used. If no reducer is provided, a\n     * default reducer is used that assigns each value to its corresponding key.\n     *\n     * @param {Array} entries - An array of key-value pairs. Each entry should\n     * be an array where the first element is the key and the second element is\n     * the value. Non-conforming entries are ignored.\n     * @param {object} [prototype=Object.prototype] - The prototype to use for\n     * the new object. If not provided, Object.prototype is used.\n     * @param {Function} [reducer] - An optional reducer function to use when\n     * creating the new object. If not provided, a default reducer is used that\n     * assigns each value to its corresponding key.\n     * @returns {object|undefined} - The new object created from the entries, or\n     * undefined if the entries array is not valid or contains no valid entries.\n     *\n     * @example\n     * // Create an object with a custom prototype and reducer\n     * const myPrototype = { foo: 'bar' };\n     * const myReducer = (obj, [key, value]) => {\n     *   obj[key] = value.toUpperCase();\n     *   return obj;\n     * };\n     *\n     * const myEntries = [['name', 'John'], ['age', '30']];\n     * const myObject = Object.fromEntriesUsing(\n     *   myEntries, myPrototype, myReducer\n     * );\n     *\n     * // myObject is now { name: 'JOHN', age: '30' }\n     * // with prototype { foo: 'bar' }\n     */\n    fromEntriesUsing(entries, prototype = Object.prototype, reducer = undefined) {\n      if (!is.array(entries)) {\n        return undefined;\n      }\n\n      const entriesToUse = entries.filter(\n        entry => is.array(entry) && entry.length >= 2\n      );\n\n      if (!entriesToUse.length) {\n        return undefined;\n      }\n\n      const useReducer = reducer instanceof Function\n        ? reducer\n        : (accumulator, [key, value]) => {\n          accumulator[key] = value;\n          return accumulator;\n        };\n\n      return entriesToUse.reduce(\n        useReducer, Object.create(prototype ?? Object.prototype)\n      );\n    },\n\n    /**\n     * Retrieves the prototype chain entries of a given object.\n     *\n     * This method traverses the prototype chain of the provided object and\n     * collects an array of entries. Each entry is a pair consisting of the\n     * prototype object and its property descriptors.\n     *\n     * The property descriptors are obtained using the `Reflect.ownKeys`\n     * method and the `Object.getOwnPropertyDescriptor` function.\n     *\n     * @param {Object} object - The object whose prototype chain entries are\n     * to be retrieved.\n     * @returns {Array} An array of entries, where each entry is a pair\n     * consisting of a prototype object and its property descriptors.\n     *\n     * @example\n     * const obj = Object.create({ foo: 'bar' });\n     * console.log(getPrototypeChainEntries(obj));\n     * // Output: [[{ foo: 'bar' }, { foo: { value: 'bar', writable: true,\n     * // enumerable: true, configurable: true } }], [Object.prototype, { ... }]]\n     */\n    getPrototypeChainEntries(object) {\n      const entries = []\n\n      let prototype = Object.getPrototypeOf(object)\n      while (prototype) {\n        const descriptors = Reflect.ownKeys(prototype).reduce((acc, key) => {\n          acc[key] = Object.getOwnPropertyDescriptor(prototype, key)\n          return acc\n        }, {})\n\n        entries.push([prototype, descriptors])\n\n        prototype = Object.getPrototypeOf(prototype)\n      }\n\n      return entries\n    },\n\n    /**\n     * Retrieves the string tag of an object. The string tag is a representation\n     * of the object's type, as defined by its `Object.prototype.toString`\n     * method. This utility method is helpful for getting a more descriptive\n     * type of an object than what is returned by the `typeof` operator,\n     * especially for custom objects.\n     *\n     * @param {*} value - The object whose string tag is to be retrieved.\n     * @param {boolean} strict - if this is set to true, undefined will be\n     * returned whenever a supplied object does not have a\n     * `Symbol.toStringTag` defined, period. if false, the default,\n     * @returns {string} - The string tag of the object, indicating its type.\n     */\n    getStringTag(value, strict = false) {\n      if (has.stringTag(value)) {\n        return value[Symbol.toStringTag]\n      }\n\n      if (strict) {\n        return undefined\n      }\n\n      if (value && (typeof value === 'function')) {\n        return value.name\n      }\n\n      return /\\s(.+)]/.exec(Object.prototype.toString.call(value))[1];\n    },\n\n    /**\n     * Determines the type of the given value based on its string tag. This method\n     * uses `Object.getStringTag` to obtain the string tag of the value, which\n     * represents its more specific type (e.g., Array, Map, Set) rather than just\n     * 'object'. The method then maps this string tag to the corresponding type\n     * present in the provided `owner` object, which defaults to `globalThis`.\n     * This utility method is especially useful for identifying the specific\n     * constructor or class of an object, beyond the basic types identified by\n     * the `typeof` operator.\n     *\n     * @param {any} value - The value whose type is to be determined.\n     * @param {object} [owner=globalThis] - The object in which to look up the\n     * constructor corresponding to the string tag. Defaults to `globalThis`,\n     * which covers global constructors like `Array`, `Object`, etc.\n     * @returns {Function|object|null|undefined} - Returns the constructor or\n     * type of the value based on its string tag. For 'Null' and 'Undefined',\n     * it returns `null` and `undefined`, respectively. For other types, it\n     * returns the corresponding constructor (e.g., `Array` for arrays) if\n     * available in the `owner` object.\n     */\n    getType(value, owner = globalThis) {\n      const stringTag = Object.getStringTag(value)\n\n      switch (stringTag) {\n        case 'Null': return null\n        case 'Undefined': return undefined\n        default:\n          return owner[stringTag]\n      }\n    },\n\n    /**\n     * Checks to see if the supplied `value` is both an object, and has the\n     * appropriate symbol defined.\n     *\n     * @param {any} value the value to determine if it contains a defined\n     * `Symbol.toStringTag` defined.\n     * @returns true if the symbol is defined, false otherwise\n     */\n    hasStringTag(value) {\n      return has.stringTag(value)\n    },\n\n    /**\n     * The function checks if a value is either `undefined` or `null`.\n     *\n     * @param {any} value - The parameter \"value\" is a variable that can hold\n     * any value.\n     * @returns {boolean} `true` if the value is either `undefined` or `null`,\n     * and `false` otherwise.\n     */\n    isNullDefined(value) {\n      return is.nullish(value)\n    },\n\n    /**\n     * The `ifNullDefined` function checks if a given value is either `null` or\n     * `undefined` and returns one of two provided values based on the result.\n     * This function is a convenience method for performing conditional\n     * operations based on the type of a value.\n     *\n     * @param {any} value - The value to be checked. If this is either `null`\n     * or `undefined`, `thenValue` is returned, otherwise `elseValue`\n     * is returned.\n     * @param {function | any} thenValue - The value to be returned if `value`\n     * is either `null` or `undefined`.\n     * @param {function | any} elseValue - The value to be returned if `value`\n     * is not either `null` or `undefined`.\n     * @returns {*} Returns `thenValue` if `value` is either `null` or\n     * `undefined`, otherwise returns `elseValue`.\n     *\n     * @example\n     * // Suppose we have a null value and a defined value\n     * let nullValue = null;\n     * let definedValue = \"I'm defined\";\n     *\n     * // Using ifNullDefined\n     * // Output: 'Null or Undefined'\n     * console.log(\n     *   Object.ifNullDefined(nullValue, 'Null or Undefined', 'Defined')\n     * );\n     *\n     * // Output: 'Defined'\n     * console.log(\n     *   Object.ifNullDefined(definedValue, 'Null or Undefined', 'Defined')\n     * );\n     */\n    ifNullDefined(value, thenValue, elseValue) {\n      return isThenElse(is.nullish(value), thenValue, elseValue);\n    },\n\n    /**\n     * Checks if the provided value is an object.\n     *\n     * This function checks if the provided value is an instance of an Object\n     * or if the value is truthy and its type is 'object'. This is used to\n     * determine if a value can have properties and methods like an object.\n     *\n     * @param {any} value - The value to be checked.\n     * @returns {boolean} Returns `true` if the value is an object, `false`\n     * otherwise.\n     *\n     * @example\n     * // Using a string\n     * console.log(isObject('Hello, world!')); // Output: false\n     *\n     * // Using an object\n     * console.log(isObject({ key: 'value' })); // Output: true\n     *\n     * // Using null\n     * console.log(isObject(null)); // Output: false\n     */\n    isObject(value) {\n      return is.object(value)\n    },\n\n    /**\n     * Executes a conditional function based on whether the provided value\n     * is an object or not. This method first checks if the value is an\n     * object using the `is.object` method from the toolkit. If it is, it\n     * returns the `thenValue`, otherwise it returns the `elseValue`.\n     *\n     * @param {any} value - The value to be checked.\n     * @param {function | any} thenValue - The value to return if `value`\n     * is an object.\n     * @param {function | any} elseValue - The value to return if `value`\n     * is not an object.\n     * @returns {*} - Returns `thenValue` if the value is an object,\n     * otherwise `elseValue`.\n     *\n     * @example\n     * // returns 'Is Object'\n     * ifObject({}, 'Is Object', 'Not Object')\n     * // returns 'Not Object'\n     * ifObject(42, 'Is Object', 'Not Object')\n     */\n    ifObject(value, thenValue, elseValue) {\n      return isThenElse(is.object(value), thenValue, elseValue)\n    },\n\n    /**\n     * Checks to see if the supplied value is a primitive value.\n     *\n     * @param {any} value the value to test to see if it is a primitive value type\n     * @returns true if the object is considered widely to be a primitive value,\n     * false otherwise.\n     */\n    isPrimitive(value) {\n      return is.primitive(value)\n    },\n\n    /**\n     * Executes a conditional function based on whether the provided value is\n     * primitive or not. This method first checks if the value is primitive\n     * using the `isPrimitive` method. If it is, it returns the `thenValue`,\n     * otherwise it returns the `elseValue`.\n     *\n     * @param {any} value - The value to be checked.\n     * @param {function | any} thenValue - The value to return if `value` is\n     * primitive.\n     * @param {function | any} elseValue - The value to return if `value` is\n     * not primitive.\n     * @returns {*} - Returns `thenValue` if the value is primitive, otherwise\n     * `elseValue`.\n     *\n     * @example\n     * // returns 1\n     * ifPrimitive('hello', 1, 2)\n     * // returns 2\n     * ifPrimitive({a: 'hello'}, 1, 2)\n     */\n    ifPrimitive(value, thenValue, elseValue) {\n      return isThenElse(is.primitive(value), thenValue, elseValue)\n    },\n\n    /**\n     * Checks if the given value is a valid key for an object. In JavaScript, a\n     * valid key can be either a string or a symbol. This method is useful for\n     * validating object keys before using them in operations like setting or\n     * getting object properties.\n     *\n     * @param {*} value - The value to be checked.\n     * @returns {boolean} - Returns `true` if the value is a valid object key\n     * (string or symbol), otherwise `false`.\n     */\n    isValidKey(value) {\n      return (typeof value === 'string' || typeof value === 'symbol');\n    },\n\n    /**\n     * Executes a conditional function based on whether the provided\n     * value is a valid key for an object. This method first checks if\n     * the value is a valid key using the `isValidKey` method. If it is,\n     * it returns the `thenValue`, otherwise it returns the `elseValue`.\n     *\n     * @param {any} value - The value to be checked.\n     * @param {function | any} thenValue - The value to return if\n     * `value` is a valid key.\n     * @param {function | any} elseValue - The value to return if\n     * `value` is not a valid key.\n     * @returns {any} - Returns `thenValue` if the value is a valid key,\n     * otherwise `elseValue`.\n     *\n     * @example\n     * // returns 1\n     * ifValidKey('name', 1, 2)\n     * // returns 2\n     * ifValidKey(123, 1, 2)\n     */\n    ifValidKey(value, thenValue, elseValue) {\n      return isThenElse(this.isValidKey(value), thenValue, elseValue)\n    },\n\n    /**\n     * A symbol constant defined on Object that can be used to reference\n     * storage for an accessor descriptor created with Object.add() or\n     * other descriptor assigning and creation methods used by this extension.\n     *\n     * The value assigned here is actually another symbol but one generated\n     * by {@link Symkeys} for uniqueness and has access to data storage.\n     *\n     * @returns {Symbol} - Returns a symbol for the descriptor storage.\n     *\n     * @example\n     * // returns Symbol(@nejs.object.descriptor.storage)\n     * kDescriptorStore\n     *\n     * // add descriptor value to an object\n     * const object = {}\n     * Object.add({object, key: 'name', type: 'accessor'})\n     * object.name = 'Jane Doe'\n     *\n     * // Value assigned here is another symbol with its own storage generated\n     * // by Symkeys. Description might be '@nejs.descriptor.store #234sdafj'\n     * object[Object.kDescriptorStore]\n     *\n     * // But its nested data can be accessed using the '.data' getter\n     * object[Object.kDescriptorStore].data // { name: 'Jane Doe' }\n     */\n    get kDescriptorStore() {\n      return Symbol.for('@nejs.object.descriptor.storage')\n    },\n\n    /**\n     * Creates an object with predefined keys and descriptors. This method is\n     * useful for creating objects with specific properties and behaviors.\n     *\n     * @param {Array|Object} keys - An array of keys or an object where keys\n     * are the object's own properties. If an array is provided, each key will\n     * be assigned the `defaultValue`. If an object is provided, its own\n     * properties will be used as keys and their corresponding values as values.\n     * @param {*} [defaultValue=undefined] - The default value for each key.\n     * @param {string} [definedAs='data'] - Defines how the properties are\n     * defined. If 'data', properties are defined with a value. If 'accessor',\n     * properties are defined with get and set accessors.\n     * @param {Object} [accessorMeta={ get: undefined, set: undefined,\n     * thisArg: undefined }] - An object containing the get and set accessors\n     * and the `thisArg` to bind to the accessors.\n     * @param {Object} [descriptorBase={ enumerable: true, configurable: true }]\n     * - The base descriptor for the properties.\n     * @param {Object} [extraDescriptors=undefined] - Extra descriptors to be\n     * added to the object.\n     * @param {Object} [prototype=Object.prototype] - The prototype of the\n     * created object.\n     * @returns {Object} - Returns the created object.\n     *\n     * @example\n     * // returns { name: undefined }\n     * prekeyed(['name'])\n     * // returns { name: 'John' }\n     * prekeyed({ name: 'John' })\n     * // returns { name: 'John' }\n     * prekeyed(['name'], 'John')\n     */\n    prekeyed(\n      keys,\n      defaultValue = undefined,\n      definedAs = ['data', 'accessor'][0],\n      accessorMeta = { get: undefined, set: undefined, thisArg: undefined },\n      descriptorBase = { enumerable: true, configurable: true },\n      extraDescriptors = undefined,\n      prototype = Object.prototype\n    ) {\n      const object = Object.create(prototype, extraDescriptors)\n      let mapped = {}\n\n      if (Array.isArray(keys)) {\n        mapped = keys.reduce((a, k) => ({ ...a, [k]: defaultValue }), {})\n      }\n      else if (keys && typeof keys === 'object') {\n        Object.assign(mapped, keys)\n      }\n      else {\n        console.warn('skipping')\n        return object\n      }\n\n      for (const [key, value] of Object.entries(mapped)) {\n        let symKey = Symbol.for(`${key}#${Math.random().toString(36).slice(2)}`)\n        let suppliedValue = mapped[key] ?? defaultValue\n        if (definedAs === 'accessor' && accessorMeta.get === undefined) {\n          Object.defineProperty(\n            object, symKey, {\n              value: suppliedValue, enumerable: false, configurable: true\n            }\n          )\n          accessorMeta.thisArg = object\n        }\n\n        let descriptorRest = definedAs === 'data'\n          ? { value: value ?? defaultValue, writable: true }\n          : {\n              get: accessorMeta.get ?? function()  { return this[symKey] },\n              set: accessorMeta.set ?? function(v) { this[symKey] = v }\n            }\n\n        if (accessorMeta.thisArg) {\n          descriptorRest.get = descriptorRest.get.bind(accessorMeta.thisArg)\n          descriptorRest.set = descriptorRest.set.bind(accessorMeta.thisArg)\n        }\n\n        Object.defineProperty(\n          object, key, { ...descriptorBase, ...descriptorRest }\n        )\n      }\n\n      return object\n    },\n\n    redescribe() {\n\n    },\n\n    /**\n     * Strips an object down to only the keys specified. Optionally, any\n     * accessors can be made to retain their context on the source object.\n     *\n     * @param {object} object the object to pare down\n     * @param {Array<string|symbol>} keys the keys that should appear in the\n     * final reduced object\n     * @param {boolean} [bindAccessors = true] if this value is true then any\n     * accessors from the source object will continue to have their `this`\n     * value bound to the source. If the getter or setter on that object is\n     * defined using an arrow function, this will not work as intended.\n     * @returns {object} an object containing only the keys and symbols\n     * specified in the `keys` parameter.\n     */\n    stripTo(object, keys, bindAccessors = true) {\n      if (!object || typeof object !== 'object') {\n        throw new TypeError(\n          'Object.stripTo requires an object to strip. Received',\n          object\n        );\n      }\n\n      const result = {};\n\n      if (!Array.isArray(keys)) {\n        return result;\n      }\n\n      for (let key of keys) {\n        if (Reflect.has(object, key)) {\n          const originalDescriptor = Object.getOwnPropertyDescriptor(object, key);\n          const descriptor = { ...originalDescriptor };\n\n          if (\n            typeof descriptor.get === 'function' ||\n            typeof descriptor.set === 'function'\n          ) {\n            if (bindAccessors) {\n              descriptor.get = descriptor.get?.bind(object);\n              descriptor.set = descriptor.set?.bind(object);\n            }\n          }\n\n          Object.defineProperty(result, key, descriptor);\n        }\n      }\n\n      return result;\n    },\n\n    withProperties(prototype, ...properties) {\n      const props = properties.filter(p => p instanceof Property);\n      const possible = properties.filter(p => Array.isArray(p))\n\n      if (possible.length) {\n        for (const [key, descriptorOrDataOrAccessorArgs, ...rest] of possible) {\n          // if arg[1] is a descriptor\n          if (Property.is.descriptor(descriptorOrDataOrAccessorArgs)) {\n            props.push(new Property(key, descriptorOrDataOrAccessorArgs))\n          }\n          else {\n            const { get, set } = descriptorOrDataOrAccessorArgs;\n            const args = [key, descriptorOrDataOrAccessorArgs, ...rest];\n            if (get || set) {\n              props.push(Property.accessor(...args))\n            }\n            else {\n              props.push(Property.data(...args))\n            }\n          }\n        }\n      }\n\n      const object = Object.create(prototype ?? Object.prototype);\n      const sorted = props.toSorted(\n        (a,b) => a.key < b.key ? -1 : (a.key > b.key ? 1 : 0)\n      );\n      for (const property of sorted) {\n        property.apply(object);\n      }\n\n      Property.data(Symbol.for('properties'), sorted).apply(object);\n      return object;\n    },\n\n    /**\n     * Retrieves a toolkit object containing various utility functions\n     * for type checking and introspection.\n     *\n     * The toolkit includes many functions. It was designed to read as\n     * though the toolkit were assigned to the variable `it`.\n     *\n     * @example\n     * const is = ObjectExtensions.patches.toolkit\n     * console.log(is.object({})) // Output: true\n     * console.log(is.string('hello')) // Output: true\n     * console.log(is.number(42)) // Output: true\n     *\n     * @returns {object} The toolkit object containing various utility\n     * functions for type checking and introspection.\n     */\n    get toolkit() {\n      return { as, has, is, si }\n    },\n  },\n});\n\nconst {\n  isObject: pIsObject,            ifObject: pIfObject,\n  isNullDefined: pIsNullDefined,  ifNullDefined: pIfNullDefined,\n  isPrimitive: pIsPrimitive,      ifPrimitive: pIfPrimitive,\n  isValidKey: pIsValidKey,        ifValidKey: pIfValidKey,\n  hasStringTag: pHasStringTag,    getStringTag: pGetStringTag,\n  stripTo: pStripTo,\n\n} = ObjectExtensions.patches;\n\n/**\n * `ObjectPrototypeExtensions` is a constant that applies a patch to the\n * Object prototype. This patch extends the Object prototype with additional\n * methods and properties, enhancing its functionality.\n *\n * The `Patch` function takes two arguments: the target object to be patched\n * (in this case, `Object.prototype`), and an object containing the methods\n * and properties to be added to the target object.\n *\n * @example\n * // Using a method added by ObjectPrototypeExtensions\n * const obj = {};\n * console.log(obj.isObject()); // Output: true\n *\n * @const\n * @type {Patch}\n * @memberof module:object.extensions\n */\nexport const ObjectPrototypeExtensions = new Patch(Object.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Retrieves the prototype chain entries of the current object.\n     *\n     * This method traverses the prototype chain of the current object\n     * (`this`) and collects an array of entries. Each entry is a pair\n     * consisting of the prototype object and its property descriptors.\n     *\n     * The property descriptors are obtained using the `Reflect.ownKeys`\n     * method and the `Object.getOwnPropertyDescriptor` function.\n     *\n     * @returns {Array} An array of entries, where each entry is a pair\n     * consisting of a prototype object and its property descriptors.\n     *\n     * @example\n     * const obj = Object.create({ foo: 'bar' });\n     * console.log(obj.getPrototypeChainEntries());\n     * // Output: [[{ foo: 'bar' }, { foo: { value: 'bar', writable: true, enumerable: true, configurable: true } }], [Object.prototype, { ... }]]\n     */\n    getPrototypeChainEntries() {\n      return ObjectExtensions.patches.getPrototypeChainEntries(this)\n    },\n\n    /**\n     * Determines if the current value is an object.\n     *\n     * This method checks whether the current value is an object,\n     * excluding null. It is a convenience wrapper around the\n     * `pIsObject` function from the `ObjectExtensions` patch.\n     *\n     * @name isObject\n     * @type {function}\n     * @memberof Object.prototype\n     * @returns {boolean} `true` if the current value is an object\n     * (excluding null), `false` otherwise.\n     *\n     * @example\n     * const obj = {};\n     * console.log(obj.isObject());\n     * // Output: true\n     *\n     * const str = \"hello\";\n     * console.log(str.isObject());\n     * // Output: false\n     *\n     * console.log(null.isObject());\n     * // Output: false\n     */\n    get isObject() {\n      return pIsObject(this)\n    },\n\n    /**\n     * Semantically `isObject` is a constant, but some JavaScript\n     * libraries and strict modes complain about the existence of only\n     * a getter without a setter for Object properties.\n     */\n    set isObject(_ignored) {\n      return\n    },\n\n    /**\n     * Checks if the current value is an object and returns one of two\n     * provided values based on the result. This function is a convenience\n     * method for performing conditional operations based on the type of\n     * the current value.\n     *\n     * @name ifObject\n     * @type {function}\n     * @memberof Object.prototype\n     * @param {function | any} thenValue - The value to be returned if the\n     * current value is an object (excluding null).\n     * @param {function | any} elseValue - The value to be returned if the\n     * current value is not an object or is null.\n     * @returns {*} Returns `thenValue` if the current value is an object\n     * (excluding null), otherwise returns `elseValue`.\n     *\n     * @example\n     * const obj = {};\n     * console.log(obj.ifObject('Object', 'Not an object'));\n     * // Output: 'Object'\n     *\n     * const str = \"hello\";\n     * console.log(str.ifObject('Object', 'Not an object'));\n     * // Output: 'Not an object'\n     *\n     * console.log(null.ifObject('Object', 'Not an object'));\n     * // Output: 'Not an object'\n     */\n    ifObject(thenValue, elseValue) {\n      return pIfObject(this, thenValue, elseValue)\n    },\n\n    /**\n     * Checks if the current value is either `null` or `undefined`.\n     *\n     * @name isNullDefined\n     * @type {boolean}\n     * @memberof Object.prototype\n     * @returns {boolean} Returns `true` if the current value is either\n     * `null` or `undefined`, `false` otherwise.\n     *\n     * @example\n     * const obj = null;\n     * console.log(obj.isNullDefined);\n     * // Output: true\n     *\n     * const str = \"hello\";\n     * console.log(str.isNullDefined);\n     * // Output: false\n     */\n    get isNullDefined() {\n      return pIsNullDefined(this)\n    },\n\n    /**\n     * Semantically `isNullDefined` is a constant, but some JavaScript\n     * libraries and strict modes complain about the existence of only\n     * a getter without a setter for Object properties.\n     */\n    set isNullDefined(_ignored) {\n      return\n    },\n\n\n    /**\n     * Checks if the current value is either `null` or `undefined` and\n     * returns one of two provided values based on the result.\n     *\n     * @name ifNullDefined\n     * @type {function}\n     * @memberof Object.prototype\n     * @param {function | any} thenValue - The value to be returned if the\n     * current value is either `null` or `undefined`.\n     * @param {function | any} elseValue - The value to be returned if the\n     * current value is not `null` or `undefined`.\n     * @returns {*} Returns `thenValue` if the current value is either\n     * `null` or `undefined`, otherwise returns `elseValue`.\n     *\n     * @example\n     * const obj = null\n     * console.log(obj.ifNullDefined('Null or Undefined', 'Defined'))\n     * // Output: 'Null or Undefined'\n     *\n     * const str = \"hello\"\n     * console.log(str.ifNullDefined('Null or Undefined', 'Defined'))\n     * // Output: 'Defined'\n     */\n    ifNullDefined(thenValue, elseValue) {\n      return pIfNullDefined(this, thenValue, elseValue)\n    },\n\n    /**\n     * Checks if the current value is a primitive type.\n     *\n     * Primitive types in JavaScript include `string`, `number`,\n     * `bigint`, `boolean`, `undefined`, `symbol`, and `null`.\n     *\n     * @name isPrimitive\n     * @type {boolean}\n     * @memberof Object.prototype\n     * @returns {boolean} Returns `true` if the current value is a\n     * primitive type, `false` otherwise.\n     *\n     * @example\n     * const str = \"hello\"\n     * console.log(str.isPrimitive)\n     * // Output: true\n     *\n     * const obj = { key: \"value\" }\n     * console.log(obj.isPrimitive)\n     * // Output: false\n     */\n    get isPrimitive() {\n      return pIsPrimitive(this)\n    },\n\n    /**\n     * Semantically `isPrimitive` is a constant, but some JavaScript\n     * libraries and strict modes complain about the existence of only\n     * a getter without a setter for Object properties.\n     */\n    set isPrimitive(_ignored) {\n      return\n    },\n\n    /**\n     * Checks if the current value is a primitive type and returns one\n     * of two provided values based on the result.\n     *\n     * Primitive types in JavaScript include `string`, `number`,\n     * `bigint`, `boolean`, `undefined`, `symbol`, and `null`.\n     *\n     * @name ifPrimitive\n     * @type {function}\n     * @memberof Object.prototype\n     * @param {function | any} thenValue - The value to be returned if\n     * the current value is a primitive type.\n     * @param {function | any} elseValue - The value to be returned if\n     * the current value is not a primitive type.\n     * @returns {*} Returns `thenValue` if the current value is a\n     * primitive type, otherwise returns `elseValue`.\n     *\n     * @example\n     * const str = \"hello\"\n     * console.log(str.ifPrimitive('Primitive', 'Not Primitive'))\n     * // Output: 'Primitive'\n     *\n     * const obj = { key: \"value\" }\n     * console.log(obj.ifPrimitive('Primitive', 'Not Primitive'))\n     * // Output: 'Not Primitive'\n     */\n    ifPrimitive(thenValue, elseValue) {\n      return pIfPrimitive(this, thenValue, elseValue)\n    },\n\n    /**\n     * Determines if the current value is a valid key for an object.\n     *\n     * A valid key is either a string or a symbol. This method is a\n     * convenience wrapper around the `pIsValidKey` function from the\n     * `ObjectExtensions` patch.\n     *\n     * @name isValidKey\n     * @type {boolean}\n     * @memberof Object.prototype\n     * @returns {boolean} `true` if the current value is a valid key for\n     * an object (i.e., a string or symbol), `false` otherwise.\n     *\n     * @example\n     * const str = \"key\"\n     * console.log(str.isValidKey)\n     * // Output: true\n     *\n     * const sym = Symbol(\"key\")\n     * console.log(sym.isValidKey)\n     * // Output: true\n     *\n     * const num = 42\n     * console.log(num.isValidKey)\n     * // Output: false\n     */\n    get isValidKey() {\n      return pIsValidKey(this)\n    },\n\n    /**\n     * Semantically `isValidKey` is a constant, but some JavaScript\n     * libraries and strict modes complain about the existence of only\n     * a getter without a setter for Object properties.\n     */\n    set isValidKey(_ignored) {\n      return\n    },\n\n    /**\n     * Checks if the current value is a valid key for an object and returns\n     * one of two provided values based on the result. This function is a\n     * convenience method for performing conditional operations based on\n     * the type of the current value.\n     *\n     * A valid key is either a string or a symbol.\n     *\n     * @name ifValidKey\n     * @type {function}\n     * @memberof Object.prototype\n     * @param {function | any} thenValue - The value to be returned if the\n     * current value is a valid key for an object.\n     * @param {function | any} elseValue - The value to be returned if the\n     * current value is not a valid key for an object.\n     * @returns {*} Returns `thenValue` if the current value is a valid key\n     * for an object, otherwise returns `elseValue`.\n     *\n     * @example\n     * const str = \"key\"\n     * console.log(str.ifValidKey('Valid Key', 'Not a Valid Key'))\n     * // Output: 'Valid Key'\n     *\n     * const num = 42\n     * console.log(num.ifValidKey('Valid Key', 'Not a Valid Key'))\n     * // Output: 'Not a Valid Key'\n     */\n    ifValidKey(thenValue, elseValue) {\n      return pIfValidKey(this, thenValue, elseValue)\n    },\n\n    /**\n     * Checks to see if the supplied `value` is both an object, and has the\n     * appropriate symbol defined.\n     *\n     * @param {any} value the value to determine if it contains a defined\n     * `Symbol.toStringTag` defined.\n     * @returns true if the symbol is defined, false otherwise\n     */\n    get hasStringTag() {\n      return pHasStringTag(this)\n    },\n\n    /**\n     * Semantically `hasStringTag` is a constant, but some JavaScript\n     * libraries and strict modes complain about the existence of only\n     * a getter without a setter for Object properties.\n     */\n    set hasStringTag(_ignored) {\n      return\n    },\n\n    /**\n     * Retrieves the string tag of an object. The string tag is a representation\n     * of the object's type, as defined by its `Object.prototype.toString`\n     * method. This utility method is helpful for getting a more descriptive\n     * type of an object than what is returned by the `typeof` operator,\n     * especially for custom objects.\n     *\n     * @param {*} value - The object whose string tag is to be retrieved.\n     * @param {boolean} strict - if this is set to true, undefined will be\n     * returned whenever a supplied object does not have a\n     * `Symbol.toStringTag` defined, period. if false, the default,\n     * @returns {string} - The string tag of the object, indicating its type.\n     */\n    getStringTag(strict = false) {\n      return pGetStringTag(this, strict)\n    },\n\n    /**\n     * Strips an object down to only the keys specified. Optionally, any\n     * accessors can be made to retain their context on the source object.\n     * This is a passthrough to the static {@link Object.stripTo} function\n     *\n     * @param {Array<string|symbol>} keys the keys that should appear in the\n     * final reduced object\n     * @param {boolean} [bindAccessors = true] if this value is true then any\n     * accessors from the source object will continue to have their `this`\n     * value bound to the source. If the getter or setter on that object is\n     * defined using an arrow function, this will not work as intended.\n     * @returns {object} an object containing only the keys and symbols\n     * specified in the `keys` parameter.\n     */\n    stripTo(keys, bindAccessors = true) {\n      return pStripTo(this, keys, bindAccessors)\n    },\n  },\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  if (arguments.length > 1) {\n    var _then = is.function(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = is.function(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n\n", "import { Patch } from '@nejs/extension'\n\n/**\n * The `ReflectExtensions` class is a patch applied to the built-in JavaScript\n * `Reflect` object. It extends `Reflect` with additional utility methods that\n * enhance its capabilities. These methods provide more advanced ways of\n * interacting with object properties, such as checking for the presence of\n * multiple keys at once (`hasAll`) or verifying if at least one specified key\n * exists in an object (`hasSome`). This class is part of the `@nejs/extension`\n * library and is designed to offer these extended functionalities in a way\n * that is consistent with the existing `Reflect` API, making it intuitive for\n * developers who are already familiar with standard reflection methods in\n * JavaScript.\n */\nexport const ReflectExtensions = new Patch(Reflect, {\n  /**\n   * The function checks if an object has all the specified keys.\n   *\n   * @param object - The `object` parameter is the object that we want to\n   * check if it has all the specified keys.\n   * @param keys - The `keys` parameter is a rest parameter, which means\n   * it can accept any number of arguments. In this case, it is expected\n   * to receive multiple keys as arguments.\n   * @returns a boolean value.\n   */\n  hasAll(object, ...keys) {\n    return Object.isObject(object) && (keys.flat(Infinity)\n      .map(key => Reflect.has(object, key))\n      .every(has => has)\n    )\n  },\n\n  /**\n   * The function checks if an object has at least one of the specified keys.\n   *\n   * @param object - The `object` parameter is the object that we want to check\n   * for the presence of certain keys.\n   * @param keys - The `keys` parameter is a rest parameter, which means it can\n   * accept any number of arguments. These arguments are the keys that we want\n   * to check if they exist in the `object`.\n   * @returns The function `hasSome` returns a boolean value indicating whether\n   * at least one of the keys provided as arguments exists in the given object.\n   */\n  hasSome(object, ...keys) {\n    return isObject(object) && (keys.flat(Infinity)\n      .map(key => Reflect.has(object, key))\n      .some(has => has)\n    )\n  },\n\n  /**\n   * The `metadata` method retrieves metadata about a property of an object.\n   * It returns an object containing information about the property, such as\n   * its value, descriptor, and whether it is read-only, assignable, an\n   * accessor, or a data descriptor.\n   *\n   * @param {string} key - The name of the property.\n   * @param {object} [owner=globalThis] - The object that owns the property.\n   * If not provided, it defaults to the global object.\n   * @returns {object|undefined} An object containing metadata about the\n   * property, or `undefined` if the property does not exist or the owner is\n   * not an object.\n   *\n   * @example\n   * const obj = { foo: 'bar' }\n   * const meta = ReflectExtensions.metadata('foo', obj)\n   * console.log(meta.value) // Outputs: 'bar'\n   * console.log(meta.isReadOnly) // Outputs: false\n   */\n  metadata(key, owner = globalThis) {\n    const args = [{key}, {owner}]\n    const variants = applyVariants(args)()\n    if (variants.check(0)) {\n      key = variants.object.key\n      owner = variants.object.owner\n    }\n\n    const descriptor = isObject(owner) && isValidKey(key)\n      ? Object.getOwnPropertyDescriptor(owner, key)\n      : undefined\n\n    const value = () => descriptor?.get?.bind(owner)?.() ?? owner[key]\n\n    if (!descriptor) {\n      return undefined\n    }\n\n    const meta = {\n      /**\n       * A getter method that returns the owner of the property.\n       * The owner is the object that owns the property.\n       *\n       * @returns {object} The owner of the property.\n       *\n       * @example\n       * const obj = { foo: 'bar' }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.owner) // Outputs: obj\n       */\n      get owner() { return owner },\n\n      /**\n       * A getter method that returns the key of the property.\n       * The key is the name of the property.\n       *\n       * @returns {string} The key of the property.\n       *\n       * @example\n       * const obj = { foo: 'bar' }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.key) // Outputs: 'foo'\n       */\n      get key() { return key },\n\n      /**\n       * A getter method that returns the value of the property.\n       * The value is obtained by invoking the `value` function.\n       *\n       * @returns {*} The value of the property.\n       *\n       * @example\n       * const obj = { foo: 'bar' }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.value) // Outputs: 'bar'\n       */\n      get value() { return value() },\n\n      /**\n       * A getter method that returns the descriptor of the property.\n       * The descriptor is an object that describes a property's configuration.\n       * It includes properties like value, writable, enumerable, configurable,\n       * get, and set.\n       *\n       * @returns {object} The descriptor of the property.\n       *\n       * @example\n       * const obj = { foo: 'bar' }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.descriptor)\n       *\n       * // Outputs: {\n       * //   value: 'bar',\n       * //   writable: true,\n       * //   enumerable: true,\n       * //   configurable: true\n       * // }\n       */\n      get descriptor() { return descriptor },\n\n      /**\n       * A getter method that checks if the property is read-only.\n       * A property is considered read-only if it is an accessor property\n       * (i.e., it has a getter or a setter) and it does not have a setter.\n       * This means that the property can be read, but not written to.\n       *\n       * @returns {boolean} `true` if the property is read-only,\n       * `false` otherwise.\n       *\n       * @example\n       * const obj = {\n       *   get foo() { return 'bar' }\n       * }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.isReadOnly) // Outputs: true\n       */\n      get isReadOnly() {\n        return this.isAccessor && !descriptor?.set\n      },\n\n      /**\n       * A getter method that checks if the property is assignable.\n       * A property is considered assignable if it is either configurable\n       * or writable. Configurable properties can be modified and deleted,\n       * while writable properties can have their values changed.\n       *\n       * @returns {boolean} `true` if the property is assignable,\n       * `false` otherwise.\n       *\n       * @example\n       * const obj = { foo: 'bar' }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.isAssignable) // Outputs: true\n       */\n      get isAssignable() {\n        return descriptor?.configurable ?? descriptor?.writable\n      },\n\n      /**\n       * A getter method that checks if the property is an accessor.\n       * An accessor property is a property that has a getter method, a setter\n       * method, or both. This method returns `true` if the property has either\n       * a getter or a setter, and `false` otherwise.\n       *\n       * @returns {boolean} `true` if the property is an accessor,\n       * `false` otherwise.\n       *\n       * @example\n       * const obj = {\n       *   get foo() { return 'bar' },\n       *   set foo(value) { console.log('Setting foo to', value) }\n       * }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.isAccessor) // Outputs: true\n       */\n      get isAccessor() {\n        return !!(this?.descriptor?.get || this?.descriptor?.set)\n      },\n\n      /**\n       * A getter method that checks if the property is a data property.\n       * A data property is a property that has a value and can be written to.\n       * This method returns `true` if the property has a value or is writable,\n       * and `false` otherwise.\n       *\n       * @returns {boolean} `true` if the property is a data property,\n       * `false` otherwise.\n       *\n       * @example\n       * const obj = { foo: 'bar' }\n       * const meta = Reflect.metadata('foo', obj)\n       * console.log(meta.isData) // Outputs: true\n       */\n      get isData() {\n        return !!(this?.descriptor?.value || this?.descriptor?.writable)\n      },\n    }\n\n    return meta\n  },\n\n  /**\n   * Fetches all descriptors of an object, including those mapped to a\n   * symbol descriptor value.\n   *\n   * @param {object} object the object from whose descriptors need to be\n   * retrieved.\n   * @returns {object} with keys mapped to object descriptors\n   * @throws {TypeError} if the supplied `object` is null or not an object\n   * a TypeError exception will be thrown\n   */\n  ownDescriptors(object) {\n    if (!isObject(object)) {\n      throw new TypeError('The supplied object must be non-null and an object')\n    }\n\n    const result = {}\n\n    const keys = Reflect.ownKeys(object)\n\n    for (const key of keys) {\n      result[key] = Object.getOwnPropertyDescriptor(key)\n    }\n\n    return result\n  },\n\n  /**\n   * Retrieves an array of [key, descriptor] pairs for each property of the\n   * provided object. This method is akin to `Object.entries` but includes\n   * property descriptors instead of the property values. It's useful for cases\n   * where you need detailed information about properties, including their\n   * configurability, enumerability, and accessors.\n   *\n   * @param {object} object - The object whose property entries are to be\n   * retrieved.\n   * @returns {Array} An array of [key, descriptor] pairs, where each pair\n   * consists of the property name (key) and its descriptor. Returns an empty\n   * array if the input is not a valid object.\n   */\n  entries(object) {\n    if (!object || typeof object !== 'object') { return [] }\n\n    return Reflect.ownKeys(object).map(key => [\n      key, Object.getOwnPropertyDescriptor(object, key)\n    ])\n  },\n\n  /**\n   * Retrieves an array of values from the property descriptors of the given\n   * object. This method works similarly to `Object.values` but operates on\n   * property descriptors instead. It's useful when you need the values of\n   * properties including getters, setters, and other descriptor-specific\n   * attributes.\n   *\n   * @param {object} object - The object whose property values are to be\n   * retrieved.\n   * @returns {Array} An array of values extracted from the object's property\n   * descriptors. The values correspond to the `value` attribute in each\n   * property's descriptor. Returns an empty array if the input is not a valid\n   * object.\n   */\n  values(object) {\n    return Reflect.entries.map(([,value]) => value)\n  },\n})\n\nfunction isObject(value) {\n  return value && typeof value === 'object'\n}\n\nfunction isValidKey(value) {\n  return ['string', 'symbol'].some(type => typeof value === type)\n}\n\nfunction applyVariants(thisArg) {\n  return ((function variants() {\n    const keys = this.map(o => Object.keys(o)?.[0])\n    const entries = this.map(o => Object.entries(o)?.[0])\n    const object = entries.reduce((acc,[key, value]) => {\n      acc[key] = value;\n      return acc;\n    }, {})\n\n    const result = {\n      order: keys,\n      entries: entries,\n      object: object,\n    }\n\n    Object.defineProperty(result, 'check', {\n      value(position) {\n        if (\n          typeof position !== 'number' &&\n          position >= 0 &&\n          position < this.order.length\n        ) {\n          return false\n        }\n\n        const value = this.entries[position][1]\n\n        if (typeof value === 'object' && value) {\n          if (Object.keys(value).every(key => ~this.order.indexOf(key))) {\n            return true\n          }\n        }\n\n        return false\n      },\n      enumerable: false,\n      configurable: true\n    })\n\n    return result\n  }).bind(thisArg))\n}", "import { Patch } from '@nejs/extension'\n\nexport const RegExpExtensions = new Patch(RegExp, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Generates a regular expression pattern that matches any character.\n     *\n     * This method creates a regular expression pattern that matches any\n     * character. The pattern can be configured to be greedy or non-greedy,\n     * and to include or exclude newline characters.\n     *\n     * @param {boolean} [greedy=false] - If true, the pattern will be greedy,\n     * meaning it will match as many characters as possible. If false, the\n     * pattern will be non-greedy, meaning it will match as few characters\n     * as possible.\n     * @param {boolean} [includeNewlines=false] - If true, the pattern will\n     * include newline characters ('\\n' and '\\r'). If false, newline\n     * characters will be excluded from the pattern.\n     * @returns {string} - The generated regular expression pattern.\n     *\n     * @example\n     * // Generate a non-greedy pattern that excludes newlines\n     * console.log(anything())  // Output: '[.]*?'\n     *\n     * @example\n     * // Generate a greedy pattern that includes newlines\n     * console.log(anything(true, true))  // Output: '[.\\\\n\\\\r]*'\n     */\n    anything(greedy = false, includeNewlines = false) {\n      return `[.${includeNewlines ? '\\\\n\\\\r' : ''}]*${greedy ? '' : '?'}`\n    },\n\n    /**\n     * Creates a non-capturing group in a regular expression.\n     *\n     * This method wraps the provided string in a non-capturing group,\n     * which is denoted by the syntax `(?:...)` in a regular expression.\n     * Non-capturing groups match the pattern inside the group but do not\n     * capture the matched content for later use.\n     *\n     * @param {string} string - The string to be wrapped in a non-capturing group.\n     * @returns {string} - The string wrapped in a non-capturing group.\n     *\n     * @example\n     * // Suppose we have a string 'abc'\n     * const str = 'abc'\n     *\n     * // Using `nonCaptureGroup`\n     * console.log(nonCaptureGroup(str))  // Output: '(?:abc)'\n     */\n    nonCaptureGroup(string) {\n      return `(?:${string})`\n    },\n\n    /**\n     * Creates a capturing group in a regular expression.\n     *\n     * This method wraps the provided string in a capturing group,\n     * which is denoted by the syntax `(...)` in a regular expression.\n     * Capturing groups match the pattern inside the group and capture\n     * the matched content for later use.\n     *\n     * @param {string} string - The string to be wrapped in a capturing group.\n     * @returns {string} - The string wrapped in a capturing group.\n     *\n     * @example\n     * // Suppose we have a string 'abc'\n     * const str = 'abc'\n     *\n     * // Using `captureGroup`\n     * console.log(captureGroup(str))  // Output: '(abc)'\n     */\n    captureGroup(string) {\n      return `(${string})`\n    },\n\n    /**\n     * Creates a regular expression pattern that matches any one of the\n     * provided strings.\n     *\n     * This method takes any number of strings as arguments, and returns a\n     * string that represents a regular expression pattern. The pattern\n     * matches any one of the provided strings. The strings are joined\n     * together with the '|' character, which represents the OR operator\n     * in regular expressions.\n     *\n     * @param {...string} strings - The strings to be included in the pattern.\n     * @returns {string} - A string representing a regular expression pattern\n     * that matches any one of the provided strings.\n     *\n     * @example\n     * // Suppose we have strings 'abc', 'def', and 'ghi'\n     * const str1 = 'abc'\n     * const str2 = 'def'\n     * const str3 = 'ghi'\n     *\n     * // Using `oneOf`\n     * console.log(oneOf(str1, str2, str3))  // Output: 'abc|def|ghi'\n     */\n    oneOf(...strings) {\n      return strings.join('|')\n    },\n\n    /**\n     * Creates a regular expression pattern that matches zero or more\n     * occurrences of the provided string.\n     *\n     * This method wraps the provided string in a non-capturing group,\n     * which is denoted by the syntax `(?:...)` in a regular expression,\n     * and appends the `*` character, which represents zero or more\n     * occurrences in regular expressions.\n     *\n     * @param {string} string - The string to be matched zero or more times.\n     * @returns {string} - A string representing a regular expression pattern\n     * that matches zero or more occurrences of the provided string.\n     *\n     * @example\n     * // Suppose we have a string 'abc'\n     * const str = 'abc'\n     *\n     * // Using `zeroOrMore`\n     * console.log(zeroOrMore(str))  // Output: '(?:abc)*'\n     */\n    zeroOrMore(string) {\n      return `(?:${string})*`\n    },\n\n    /**\n     * Creates a regular expression pattern that matches zero or one\n     * occurrence of the provided string.\n     *\n     * This method wraps the provided string in a non-capturing group,\n     * which is denoted by the syntax `(?:...)` in a regular expression,\n     * and appends the `?` character, which represents zero or one\n     * occurrence in regular expressions.\n     *\n     * @param {string} string - The string to be matched zero or one time.\n     * @returns {string} - A string representing a regular expression pattern\n     * that matches zero or one occurrence of the provided string.\n     *\n     * @example\n     * // Suppose we have a string 'abc'\n     * const str = 'abc'\n     *\n     * // Using `zeroOrOne`\n     * console.log(zeroOrOne(str))  // Output: '(?:abc)?'\n     */\n    zeroOrOne(string) {\n      return `(?:${string})?`\n    },\n\n    /**\n     * Getter method that returns a string 'null'.\n     *\n     * This method is used when you need a string representation of null\n     * in your regular expressions. It simply returns the string 'null'.\n     *\n     * @returns {string} - A string 'null'.\n     *\n     * @example\n     * // Using `null`\n     * console.log(this.null)  // Output: 'null'\n     */\n    get null() {\n      return 'null'\n    },\n\n    /**\n     * Getter method that returns a regular expression string for boolean\n     * values.\n     *\n     * This method uses the `oneOf` method to create a regular expression\n     * string that matches either 'true' or 'false'. This is useful when you\n     * need to match boolean values in a string using a regular expression.\n     *\n     * @returns {string} - A regular expression string that matches 'true'\n     * or 'false'.\n     *\n     * @example\n     * // Using `bool`\n     * const boolRegex = new RegExp(this.bool)\n     * console.log(boolRegex.test('true'))  // Output: true\n     * console.log(boolRegex.test('false')) // Output: true\n     * console.log(boolRegex.test('maybe')) // Output: false\n     */\n    get bool() {\n      return this.oneOf('true', 'false')\n    },\n\n    /**\n     * Generates a regular expression string that matches the symbols of\n     * specified currencies.\n     *\n     * This method uses the Intl API to get the symbols of the specified\n     * currencies and constructs a regular expression string that matches\n     * these symbols. If no specific currencies are provided, it defaults\n     * to all known currencies. If a single currency is provided as a\n     * string, it is converted to an array. If the symbols array is empty\n     * after filtering out unknown currencies, it defaults back to all\n     * known currencies.\n     *\n     * @param {Array|string} [symbols=[['*'], ['USD','GBP']][0]] - The\n     * currencies to include in the regular expression. Can be an array\n     * of currency codes or a single currency code as a string. Defaults\n     * to all known currencies.\n     * @param {string} [locale='en-US'] - The locale to use when getting\n     * the currency symbols. Defaults to 'en-US'.\n     * @returns {string} - A regular expression string that matches the\n     * symbols of the specified currencies.\n     *\n     * @example\n     * // Using `currencySymbols` with default parameters\n     * console.log(this.currencySymbols())\n     * // Output: A regular expression string that matches all known\n     * // currency symbols\n     *\n     * @example\n     * // Using `currencySymbols` with specific currencies\n     * console.log(this.currencySymbols(['USD', 'EUR']))\n     * // Output: A regular expression string that matches the symbols\n     * // of USD and EUR\n     */\n    currencySymbols(symbols = [['*'], ['USD','GBP']][0], locale = 'en-US') {\n      const known = Intl.supportedValuesOf('currency')\n      const has = code => !!~known.indexOf(code)\n\n      if (typeof symbols === 'string' && has(symbols)) {\n        symbols = [symbols]\n      }\n\n      if (!Array.isArray(symbols)) {\n        symbols = known\n      }\n\n      symbols = symbols.filter(symbol => has(symbol))\n      if (!symbols.length) {\n        symbols = known\n      }\n\n      const opts = (currency) => ({style: 'currency', currency})\n      const fmt = (place, currency) => Intl.NumberFormat(place, opts(currency))\n      const codes = (\n        ((symbols.length === 1 && symbols[0] === '*') ? known : symbols)\n          .filter(code => has(code))\n          .map(currency => {\n            const symbol = fmt(locale, currency).formatToParts()?.[0].value\n            return symbol && `(?:${RegExp.escape(symbol)})`\n          })\n          .join('|')\n      )\n\n      return codes\n    },\n\n    /**\n     * Getter method that returns a regular expression string for numbers.\n     *\n     * This method returns a regular expression string that matches both\n     * integer and floating point numbers. The returned regular expression\n     * string is '\\\\d+\\\\.?\\\\d*', which matches one or more digits followed\n     * by an optional decimal point and zero or more digits.\n     *\n     * @returns {string} - A regular expression string that matches numbers.\n     *\n     * @example\n     * // Using `number`\n     * const numberRegex = new RegExp(this.number)\n     * console.log(numberRegex.test('123'))    // Output: true\n     * console.log(numberRegex.test('123.45')) // Output: true\n     * console.log(numberRegex.test('abc'))    // Output: false\n     */\n    get number() {\n      const instance = Object(`\\\\d+\\\\.?\\\\d*`)\n      const self = this\n\n      Object.defineProperties(instance, {\n        // alias for .float\n        any: { get() { return String(instance) } },\n\n        /**\n         * Getter method that returns a regular expression string for floating\n         * point numbers.\n         *\n         * This method returns a regular expression string that matches floating\n         * point numbers. It leverages the 'number' getter method which matches\n         * both integer and floating point numbers. The returned regular expression\n         * string is '\\\\d+\\\\.?\\\\d*', which matches one or more digits followed by\n         * an optional decimal point and zero or more digits.\n         *\n         * @returns {string} - A regular expression string that matches floating\n         * point numbers.\n         *\n         * @example\n         * // Using `float`\n         * const floatRegex = new RegExp(this.float)\n         * console.log(floatRegex.test('123.45')) // Output: true\n         * console.log(floatRegex.test('123'))    // Output: false\n         * console.log(floatRegex.test('abc'))    // Output: false\n         */\n        float: { get() { return String(instance) } },\n\n        // any known locale currency symbol + .float\n        money: { get() { return `(?:${self.currencySymbols()})?${this.float}` }},\n\n        /**\n         * Getter method that returns a regular expression string for integers.\n         *\n         * This method returns a regular expression string that matches integer\n         * numbers. The returned regular expression string is '\\\\d+', which matches\n         * one or more digits.\n         *\n         * @returns {string} - A regular expression string that matches integers.\n         *\n         * @example\n         * // Using `integer`\n         * const integerRegex = new RegExp(this.integer)\n         * console.log(integerRegex.test('123'))    // Output: true\n         * console.log(integerRegex.test('123.45')) // Output: false\n         * console.log(integerRegex.test('abc'))    // Output: false\n         */\n        integer: { get() { return `\\\\d+` } },\n\n        /**\n         * Getter method that returns a regular expression string for pretty\n         * numbers.\n         *\n         * This method returns a regular expression string that matches numbers\n         * with commas or spaces for thousands separators. The returned regular\n         * expression string is '[\\\\d\\\\$]+\\\\.?[\\\\d,\\\\$]*', which matches one or\n         * more digits or dollar signs, followed by an optional decimal point,\n         * and zero or more digits, commas, or dollar signs.\n         *\n         * @returns {string} - A regular expression string that matches pretty\n         * numbers.\n         *\n         * @example\n         * // Using `pretty`\n         * const prettyRegex = new RegExp(this.pretty)\n         * console.log(prettyRegex.test('1,234.56')) // Output: true\n         * console.log(prettyRegex.test('1234.56'))  // Output: true\n         * console.log(prettyRegex.test('1 234.56')) // Output: true\n         * console.log(prettyRegex.test('abc'))      // Output: false\n         */\n        pretty: {\n          value(locale = 'en-US') {\n            const symbols = self.zeroOrMore(self.currencySymbols(['*'], locale))\n            return `${symbols}[\\\\d,]+\\\\.?[\\\\d]*`\n          }\n        },\n\n        /**\n         * Getter method that returns a regular expression string for JavaScript\n         * literals.\n         *\n         * This method returns a regular expression string that matches JavaScript\n         * literals. The returned regular expression string is '[\\\\d_]+', which\n         * matches one or more digits or underscores.\n         *\n         * @returns {string} - A regular expression string that matches JavaScript\n         * literals.\n         *\n         * @example\n         * // Using `jsLiteral`\n         * const jsLiteralRegex = new RegExp(this.jsLiteral)\n         * console.log(jsLiteralRegex.test('123_456')) // Output: true\n         * console.log(jsLiteralRegex.test('abc'))     // Output: false\n         */\n        jsLiteral: { get() { return `[\\\\d_]+` } }\n      })\n\n      return instance\n    },\n\n\n    /**\n     * Getter method that returns a regular expression string for integers.\n     *\n     * This method returns a regular expression string that matches integer\n     * numbers. The returned regular expression string is '\\\\d+', which matches\n     * one or more digits.\n     *\n     * @returns {string} - A regular expression string that matches integers.\n     *\n     * @example\n     * // Using `integer`\n     * const integerRegex = new RegExp(this.integer)\n     * console.log(integerRegex.test('123'))    // Output: true\n     * console.log(integerRegex.test('123.45')) // Output: false\n     * console.log(integerRegex.test('abc'))    // Output: false\n     */\n    get integer() {\n      return `\\\\d+`\n    },\n\n    get string() {\n      return {\n        get doubleQuoted() {\n          return '\"[^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*\"'\n        },\n\n        get singleQuoted() {\n          return \"'[^'\\\\\\\\]*(?:\\\\\\\\.[^'\\\\\\\\]*)*'\"\n        }\n      }\n    },\n\n    get whitespace() {\n      return `\\\\s*`\n    },\n\n    get comma() {\n      return `,${this.whitespace}`\n    },\n  }\n})\n\n", "import { Patch } from '@nejs/extension';\n\n/**\n * `SetExtensions` is a constant that applies a patch to the global\n * `Set` constructor. This patch extends the `Set` with additional\n * methods and properties, enhancing its functionality.\n *\n * The `Patch` function takes two arguments: the target object to be patched\n * (in this case, `Set`), and an object containing the methods and\n * properties to be added to the target object.\n *\n * @example\n * // Using a method added by SetExtensions\n * const set = new Set();\n * console.log(Set.isSet(set)); // Output: true\n *\n * @const\n * @type {Patch}\n * @memberof module:set.extensions\n */\nexport const SetExtensions = new Patch(Set, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Determines if the supplied `value` is a `Set` object. This check\n     * is performed by first looking for the `Symbol.toStringTag` on the\n     * `value` and checking to see if it is equal to the string \"Set\".\n     * If that check fails, `instanceof` is used as a fallback to check\n     * the prototype chain.\n     *\n     * @param {any} value the value that needs to be checked to determine\n     * if it is a `Set` object or not\n     * @returns {boolean} `true` if the supplied `value` is a `Set`\n     * object, `false` otherwise\n     *\n     * @example\n     * const set = new Set()\n     * isSet(set) // true\n     * isSet(new Map()) // false\n     * isSet([]) // false\n     * isSet({}) // false\n     */\n    isSet(value) {\n      return value?.[Symbol.toStringTag] === Set.name || value instanceof Set\n    },\n\n    /**\n     * Conditionally returns a value based on whether the supplied\n     * `value` is a `Set` object or not. If the `value` is a `Set`\n     * object, the `thenValue` will be returned. If it is not a `Set`\n     * object, the `elseValue` will be returned instead.\n     *\n     * @param {any} value the value to check to determine if it is a\n     * `Set` object\n     * @param {any} thenValue the value to return if the supplied\n     * `value` is a `Set` object\n     * @param {any} elseValue the value to return if the supplied\n     * `value` is not a `Set` object\n     * @returns {any} either the `thenValue` or `elseValue` depending\n     * on if the supplied `value` is a `Set` object\n     *\n     * @example\n     * const set = new Set()\n     * const map = new Map()\n     * ifSet(set, 'is a set', 'not a set') // 'is a set'\n     * ifSet(map, 'is a set', 'not a set') // 'not a set'\n     */\n    ifSet(value, thenValue, elseValue) {\n      return isThenElse(this.isSet(value), thenValue, elseValue)\n    },\n  }\n})\n\nconst { isSet: pIsSet } = SetExtensions.patches\n\n/**\n * `SetPrototypeExtensions` is a constant that applies a patch to the\n * prototype of the built-in JavaScript `Set` object. This patch extends the\n * `Set` prototype with additional methods and properties, enhancing its\n * functionality.\n *\n * The `Patch` function takes two arguments: the target object to be patched\n * (in this case, `Set.prototype`), and an object containing the methods and\n * properties to be added to the target object.\n *\n * @example\n * // Using a method added by SetPrototypeExtensions\n * const mySet = new Set();\n * mySet.myNewMethod(); // Calls the new method added by the patch\n *\n * @const\n * @type {Patch}\n * @memberof module:set.extensions\n */\nexport const SetPrototypeExtensions = new Patch(Set.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Merges multiple iterables into the set. Each element from the iterables\n     * is added to the set, ensuring uniqueness of all elements. This method\n     * mutates the original set.\n     *\n     * @param {...Iterable} iterables - One or more iterable objects (like Set\n     * or Array) whose elements will be added to the set.\n     */\n    concat(...iterables) {\n      for (const iterable of iterables) {\n        if (\n          typeof iterable === 'string' ||\n          !Reflect.has(iterable, Symbol.iterator)\n        ) {\n          this.add(iterable)\n          continue\n        }\n\n        for (const element of iterable) {\n          this.add(element)\n        }\n      }\n    },\n\n    /**\n     * Checks to see if any value within the `Set` loosely equals the supplied\n     * value.\n     *\n     * @param {*} value any value that might be loosely equal to an item in the\n     * set, as opposed to {@link Set.has} which is the equivalent of a strict or\n     * triple equals (`===`) check\n     * @returns {boolean} `true` if any value within the set is loosely equal to\n     * the supplied value, `false` otherwise\n     */\n    contains(value) {\n      for (const element of this) {\n        if (value == element) {\n          return true\n        }\n      }\n\n      return false\n    },\n\n    /**\n     * Checks if every element in the set passes the test implemented by the\n     * provided function. The function is called with each element of the set.\n     * Note: Since sets do not have indices, the index parameter is always NaN.\n     *\n     * @param {Function} everyFn - The function to test each element. Receives\n     * the element, index (always NaN), and the set itself.\n     * @param {Object} [thisArg] - Optional. Value to use as `this` when executing\n     * `everyFn`.\n     * @throws {TypeError} If `everyFn` is not a function.\n     * @returns {boolean} True if every element passes the test, false otherwise.\n     */\n    every(everyFn, thisArg) {\n      if (typeof everyFn !== 'function') {\n        throw new TypeError(\n          `everyFn must be a function! Received ${String(everyFn)}`\n        )\n      }\n\n      let found = 0\n\n      for (const element of this) {\n        if (everyFn.call(thisArg, element, NaN, this)) {\n          found++\n        }\n      }\n\n      return (found === this.size)\n    },\n\n    /**\n     * Finds the first element in the set satisfying the provided testing\n     * function. If no elements satisfy the testing function, undefined is\n     * returned. The function is called with each element of the set.\n     * Note: Since sets do not have indices, the index parameter is always NaN.\n     *\n     * @param {Function} findFn - The function to execute on each element. It\n     * receives the element, index (always NaN), and the set itself.\n     * @param {Object} [thisArg] - Optional. Value to use as `this` when executing\n     * `findFn`.\n     * @throws {TypeError} If `findFn` is not a function.\n     * @returns {*} The first element that satisfies `findFn`, or undefined.\n     */\n    find(findFn, thisArg) {\n      if (typeof findFn !== 'function') {\n        throw new TypeError(\n          `findFn must be a function! Received ${String(findFn)}`\n        )\n      }\n\n      for (const element of this) {\n        const match = findFn.call(thisArg, element, NaN, this)\n        if (match) {\n          return element\n        }\n      }\n\n      return undefined\n    },\n\n    /**\n     * Finds the last element in the set satisfying the provided testing function.\n     * If no elements satisfy the testing function, undefined is returned. The\n     * function is called with each element of the set in reverse order.\n     * Note: Since sets do not have indices, the index parameter is always NaN.\n     *\n     * @param {Function} findFn - The function to execute on each element. It\n     * receives the element, index (always NaN), and the set itself.\n     * @param {Object} [thisArg] - Optional. Value to use as `this` when executing\n     * `findFn`.\n     * @throws {TypeError} If `findFn` is not a function.\n     * @returns {*} The last element that satisfies `findFn`, or undefined.\n     */\n    findLast(findFn, thisArg) {\n      if (typeof findFn !== 'function') {\n        throw new TypeError(\n          `findFn must be a function! Received ${String(findFn)}`\n        )\n      }\n\n      const found = []\n\n      for (const element of this) {\n        const match = findFn.call(thisArg, element, NaN, this)\n        if (match) {\n          found.push(element)\n        }\n      }\n\n      if (found.length) {\n        return found[found.length - 1]\n      }\n\n      return undefined\n    },\n\n    /**\n     * Determines if the current object is a `Set` object.\n     *\n     * This is a getter that uses the `isSet` function from the\n     * `SetExtensions` patch to check if the current object (`this`) is\n     * a `Set` object.\n     *\n     * @type {boolean}\n     * @readonly\n     *\n     * @example\n    * const set = new Set()\n    * console.log(set.isSet) // Output: true\n    *\n    * const notSet = {}\n    * console.log(notSet.isSet) // Output: false\n    */\n   get isSet() {\n     return pIsSet(this)\n   },\n\n   /**\n    * Checks if the current object is a Set and returns the\n    * corresponding value based on the result.\n    *\n    * This method uses the `isThenElse` function from the\n    * `SetExtensions` patch to determine if the current object\n    * (`this`) is a Set. If it is a Set, the `thenValue` is returned.\n    * Otherwise, the `elseValue` is returned.\n    *\n    * @param {any} thenValue - The value to return if the current object\n    * is a Set.\n    * @param {any} elseValue - The value to return if the current object\n    * is not a Set.\n    * @returns {any} The `thenValue` if the current object is a Set, or\n    * the `elseValue` if it is not a Set.\n    *\n    * @example\n    * const set = new Set([1, 2, 3])\n    * console.log(set.ifSet('Is a Set', 'Not a Set')) // 'Is a Set'\n    *\n    * const notSet = {}\n    * console.log(notSet.ifSet('Is a Set', 'Not a Set')) // 'Not a Set'\n    */\n   ifSet(thenValue, elseValue) {\n     return isThenElse(pIsSet(this), thenValue, elseValue)\n   },\n\n    /**\n     * A getter property that returns the number of elements in the set.\n     * This is an alias for the `size` property of the set.\n     *\n     * @returns {number} The number of elements in the set.\n     */\n    get length() {\n      return this.size\n    },\n\n    /**\n     * Creates a new array populated with the results of calling the provided\n     * function on every element in the set. The function is called with each\n     * element of the set. Note: Since sets do not have indices, the index\n     * parameter is always NaN.\n     *\n     * @param {Function} mapFn - The function to execute on each element. It\n     * receives the element, index (always NaN), and the set itself.\n     * @param {Object} [thisArg] - Optional. Value to use as `this` when executing\n     * `mapFn`.\n     * @throws {TypeError} If `mapFn` is not a function.\n     * @returns {Array} A new array with each element being the result of the\n     * `mapFn`.\n     */\n    map(mapFn, thisArg) {\n      if (typeof mapFn !== 'function') {\n        throw new TypeError(\n          `mapFn must be a function! Received ${String(mapFn)}`\n        )\n      }\n\n      const transformed = []\n\n      for (const element of this) {\n        transformed.push(mapFn.call(thisArg, element, NaN, this))\n      }\n\n      return transformed\n    },\n\n    /**\n     * Applies a function against an accumulator and each element in the set to\n     * reduce it to a single value. The function is called with each element of\n     * the set. Note: Since sets do not have indices, the index parameter is\n     * always NaN.\n     *\n     * @param {Function} reduceFn - The function to execute on each element. It\n     * receives the accumulator, element, index (always NaN), and the set itself.\n     * @param {*} initialValue - The initial value to start reducing from.\n     * @param {Object} [thisArg] - Optional. Value to use as `this` when executing\n     * `reduceFn`.\n     * @throws {TypeError} If `reduceFn` is not a function.\n     * @returns {*} The reduced value.\n     */\n    reduce(reduceFn, initialValue, thisArg) {\n      if (typeof reduceFn !== 'function') {\n        throw new TypeError(\n          `reduceFn must be a Function! Received ${String(reduceFn)}`\n        )\n      }\n\n      let accumulator = initialValue\n      for (const element of this) {\n        accumulator = reduceFn.call(thisArg, accumulator, element, NaN, this)\n      }\n\n      return accumulator\n    },\n\n    /**\n     * Tests whether at least one element in the set passes the test implemented\n     * by the provided function. The function is called with each element of the\n     * set. Note: Since sets do not have indices, the index parameter is always NaN.\n     *\n     * @param {Function} someFn - The function to test each element. It receives\n     * the element, index (always NaN), and the set itself.\n     * @param {Object} [thisArg] - Optional. Value to use as `this` when executing\n     * `someFn`.\n     * @throws {TypeError} If `someFn` is not a function.\n     * @returns {boolean} True if at least one element passes the test, false\n     * otherwise.\n     */\n    some(someFn, thisArg) {\n      if (typeof someFn !== 'function') {\n        throw new TypeError(\n          `someFn must be a function! Received ${String(someFn)}`\n        )\n      }\n\n      for (const element of this) {\n        if (someFn.call(thisArg, element, NaN, this)) {\n          return true\n        }\n      }\n\n      return false\n    },\n  },\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  function isFunction(value) { typeof value === 'function' }\n\n  if (arguments.length > 1) {\n    var _then = isFunction(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = isFunction(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n", "import { Patch } from '@nejs/extension'\n\nconst parenthesisPair = ['(', ')']\n\n/**\n * `StringExtensions` is a patch for the JavaScript built-in `String` class. It\n * adds utility methods to the `String` class without modifying the global namespace\n * directly. This patch includes methods for key validation, object type checking,\n * and retrieving the string tag of an object. These methods are useful for\n * enhancing the capabilities of the standard `String` class with additional\n * utility functions.\n */\nexport const StringExtensions = new Patch(String, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * The `isString` method does exactly what one would it expect. It returns\n     * true if the string matches typeof or instanceof as a string.\n     *\n     * @param {*} value checks to see if the `value` is a string\n     * @returns {boolean} `true` if it is a `String`, `false` otherwise\n     */\n    isString(value) {\n      return (\n        value !== null && value !== undefined &&\n        (typeof value === 'string' || value instanceof String)\n      )\n    },\n\n    /**\n     * Conditionally returns a value based on whether the supplied\n     * `value` is a `String` or not. If the `value` is a `String`,\n     * the `thenValue` will be returned. If it is not a `String`,\n     * the `elseValue` will be returned instead.\n     *\n     * @param {any} value the value to check to determine if it is a\n     * `String`\n     * @param {any} thenValue the value to return if the supplied\n     * `value` is a `String`\n     * @param {any} elseValue the value to return if the supplied\n     * `value` is not a `String`\n     * @returns {any} either the `thenValue` or `elseValue` depending\n     * on if the supplied `value` is a `String`\n     *\n     * @example\n     * const str = 'hello'\n     * const num = 42\n     * ifString(str, 'is a string', 'not a string') // 'is a string'\n     * ifString(num, 'is a string', 'not a string') // 'not a string'\n     */\n    ifString(value, thenValue, elseValue) {\n      return isThenElse(String.isString(value), thenValue, elseValue)\n    },\n\n    /**\n     * A getter property that returns a pair of parentheses as an array.\n     * This property can be used when operations require a clear distinction\n     * between the opening and closing parentheses, such as parsing or\n     * matching balanced expressions in strings.\n     *\n     * @returns {[string, string]} An array containing a pair of strings: the\n     * opening parenthesis '(' as the first element, and the closing parenthesis\n     * ')' as the second element.\n     */\n    get parenthesisPair() {\n      return ['(', ')'];\n    },\n\n    /**\n     * A getter property that returns a pair of square brackets as an array.\n     * This property is particularly useful for operations that require a clear\n     * distinction between the opening and closing square brackets, such as\n     * parsing arrays in strings or matching balanced expressions within\n     * square brackets.\n     *\n     * @returns {[string, string]} An array containing a pair of strings: the\n     * opening square bracket '[' as the first element, and the closing square\n     * bracket ']' as the second element.\n     */\n    get squareBracketsPair() {\n      return ['[', ']'];\n    },\n\n    /**\n     * A getter property that returns a pair of curly brackets as an array.\n     * This property is particularly useful for operations that require a clear\n     * distinction between the opening and closing curly brackets, such as\n     * parsing objects in strings or matching balanced expressions within\n     * curly brackets. The returned array consists of the opening curly bracket\n     * '{' as the first element, and the closing curly bracket '}' as the\n     * second element.\n     *\n     * @returns {[string, string]} An array containing a pair of strings: the\n     * opening curly bracket '{' as the first element, and the closing curly\n     * bracket '}' as the second element.\n     */\n    get curlyBracketsPair() {\n      return ['{', '}'];\n    },\n\n    /**\n     * Generates a random string using base 36 (numbers and lowercase letters).\n     * This method is useful when you need a random string that includes both\n     * numbers and letters. The generated string does not include the leading\n     * '0.' that is part of the string representation of a random number in\n     * base 36.\n     *\n     * @returns {string} A random string of characters in base 36.\n     *\n     * @example\n     * const randomStr = StringExtensions.random36();\n     * console.log(randomStr); // Output: \"3n5yzxjkf2o\"\n     */\n    random36() {\n      return Math.random().toString(36).slice(2)\n    },\n\n    /**\n     * Generates a random string using base 16 (hexadecimal numbers).\n     * This method is useful when you need a random string that includes both\n     * numbers and letters in hexadecimal format. The generated string does not\n     * include the leading '0.' that is part of the string representation of a\n     * random number in base 16.\n     *\n     * @returns {string} A random string of characters in base 16.\n     *\n     * @example\n     * const randomStr = StringExtensions.random16();\n     * console.log(randomStr); // Output: \"3a5f4c\"\n     */\n    random16() {\n      return Math.random().toString(16).slice(2)\n    },\n\n    /**\n     * Generates a random RGB color code.\n     *\n     * This method generates a random hexadecimal number, slices off the\n     * leading '0.' and takes the first 6 characters. It then pads the\n     * end of the string with '0' until it is 6 characters long. The\n     * result is a string that can be used as a color code in CSS.\n     *\n     * @param {string} [prefix='#'] - The prefix to prepend to the color\n     * code. Defaults to '#'.\n     *\n     * @returns {string} A random RGB color code.\n     *\n     * @example\n     * const randomColor = StringExtensions.randomRGB();\n     * console.log(randomColor); // Output: \"#3a5f4c\"\n     */\n    randomRGBHex(prefix = '#') {\n      const hex = Math.random().toString(16).slice(2).substring(0,6)\n      return `${prefix}${hex.padEnd(6, '0')}`\n    },\n\n    /**\n     * Generates a random ARGB color code.\n     *\n     * This method generates a random hexadecimal number, slices off the\n     * leading '0.' and takes the first 8 characters. It then pads the\n     * start of the string with '0' until it is 6 characters long and the\n     * end of the string with '0' until it is 8 characters long. The\n     * result is a string that can be used as a color code in CSS.\n     *\n     * @param {string} [prefix='#'] - The prefix to prepend to the color\n     * code. Defaults to '#'.\n     *\n     * @returns {string} A random ARGB color code.\n     *\n     * @example\n     * const randomColor = StringExtensions.randomARGB();\n     * console.log(randomColor); // Output: \"#3a5f4c00\"\n     */\n    randomARGBHex(prefix = '#') {\n      const hex = Math.random().toString(16).slice(2).substring(0,8)\n      return `${prefix}${hex.padStart(6, '0').padEnd(8, '0')}`\n    },\n\n    /**\n     * Generates a random RGBA color code.\n     *\n     * This method generates a random hexadecimal number, slices off the\n     * leading '0.' and takes the first 8 characters. It then pads the\n     * start of the string with '0' until it is 6 characters long and the\n     * end of the string with '0' until it is 8 characters long. The\n     * result is a string that can be used as a color code in CSS.\n     *\n     * @param {string} [prefix='#'] - The prefix to prepend to the color\n     * code. Defaults to '#'.\n     *\n     * @returns {string} A random RGBA color code.\n     *\n     * @example\n     * const randomColor = StringExtensions.randomRGBA();\n     * console.log(randomColor); // Output: \"#3a5f4c00\"\n     */\n    randomRGBAHex(prefix = '#') {\n      const hex = Math.random().toString(16).slice(2).substring(0,8)\n      return `${prefix}${hex.padStart(6, '0').padStart(8, '0')}`\n    },\n\n    /**\n     * Generates a random RGB color code.\n     *\n     * This method generates a random hexadecimal number, slices off the\n     * leading '0.' and pads the end of the string with '0' until it is\n     * 8 characters long. It then parses the first 6 characters into\n     * three separate 2-character strings, each representing a color\n     * component (red, green, blue) in hexadecimal format. These strings\n     * are then converted into decimal format and used to construct an\n     * RGB color code.\n     *\n     * @returns {string} A random RGB color code.\n     *\n     * @example\n     * const randomColor = StringExtensions.randomRGB();\n     * console.log(randomColor); // Output: \"rgb(58,95,76)\"\n     */\n    randomRGB() {\n      const hex = Math.random().toString(16).slice(2).padEnd(8, '0')\n      const red = parseInt(hex.substring(0,2), 16)\n      const green = parseInt(hex.substring(2,4), 16)\n      const blue = parseInt(hex.substring(4, 6), 16)\n      return `rgb(${red}, ${green}, ${blue})`\n    },\n\n    /**\n     * Generates a random RGBA color code with optional forced color values.\n     *\n     * This method generates a random hexadecimal number, slices off the\n     * leading '0.' and pads the end of the string with '0' until it is\n     * 8 characters long. It then parses the first 8 characters into\n     * four separate 2-character strings, each representing a color\n     * component (red, green, blue, alpha) in hexadecimal format. These strings\n     * are then converted into decimal format and used to construct an\n     * RGBA color code.\n     *\n     * If a color component is provided in the `force` parameter, it will\n     * be used instead of a random value for that component.\n     *\n     * @param {Object} force - An object with properties for each color\n     * component (red, green, blue, alpha) that should be forced to a\n     * specific value. If a property is undefined or not provided, a\n     * random value will be used for that component.\n     * @param {number} force.red - The red component (0-255).\n     * @param {number} force.green - The green component (0-255).\n     * @param {number} force.blue - The blue component (0-255).\n     * @param {number} force.alpha - The alpha component (0.0-1.0).\n     *\n     * @returns {string} A random RGBA color code.\n     *\n     * @example\n     * const randomColor = StringExtensions.randomRGBA();\n     * console.log(randomColor); // Output: \"rgba(58,95,76,0.50)\"\n     *\n     * const forcedGreen = StringExtensions.randomRGBA({ green: 255 });\n     * console.log(forcedGreen); // Output: \"rgba(58,255,76,0.50)\"\n     */\n    randomRGBA(\n      force = {\n        red: undefined,\n        green: undefined,\n        blue: undefined,\n        alpha: undefined\n      }\n    ) {\n      const hex = Math.random().toString(16).slice(2).padEnd(8, '0')\n      const red = force.red ?? parseInt(hex.substring(0,2), 16)\n      const green = force.green ?? parseInt(hex.substring(2,4), 16)\n      const blue = force.blue ?? parseInt(hex.substring(4, 6), 16)\n      const alpha = force.alpha ??\n        (parseInt(hex.substring(6, 8), 16) / 255.0) * 1.0\n\n      return `rgba(${red}, ${green}, ${blue}, ${alpha.toFixed(2)})`\n    },\n\n    /**\n     * Applies Select Graphic Rendition (SGR) parameters to a given message for\n     * styling in terminal environments. This function allows for the dynamic\n     * styling of text output using ANSI escape codes. It supports a variety of\n     * modes such as color, brightness, and text decorations like bold or underline.\n     *\n     * @param {string} message The message to be styled.\n     * @param {...string} useModes A series of strings representing the desired\n     * styling modes. Modes can include colors (e.g., 'red', 'blue'), brightness\n     * ('bright'), foreground/background ('fg', 'bg'), and text decorations\n     * ('bold', 'underline'). Modes can be combined in a single string using\n     * commas or passed as separate arguments.\n     *\n     * Colors:\n     * ```\n     * 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'\n     * ```\n     * Color Specifiers:\n     * ```\n     * 'fg' -> foreground   |  'bg' -> background  |  'bright' -> bright colors\n     * ```\n     *\n     * Modes:\n     * ```\n     * 'blink' or 'k' | 'conceal' or 'c' | 'italics' or 'i'  | 'strike' or 's'\n     * 'bold' or 'b'  | 'dim' or 'd'     | 'negative' or 'n' | 'underline' or 'u'\n     * ```\n     *\n     * Examples:\n     * - `sgr('Hello', 'red')` applies red color to 'Hello'.\n     * - `sgr('World', 'green,bold')` applies green color and bold styling\n     *   to 'World'.\n     * - `sgr('Example', 'bluebgbright')` applies bright blue\n     *   background color.\n     *\n     * Short hand syntax is also allowed:\n     * - `sgr('hello', 'biu')` applies bold, italics and underline\n     * - `sgr('hello', 'bi,redfg')` applies bold, italics and red foreground\n     *\n     * As a bonus, there is a secret getter applied to the return string that\n     * allows you to invoke `sgr(...).show` to automatically log the output to\n     * `console.log`. This is done by wrapping the output string in `Object()`\n     * to make it a `String` instance and then adding the property descriptor.\n     * A custom `Symbol` is applied to make it evaluate in nodejs as though it\n     * were a normal string. To strip the extras, wrap the output in `String()`\n     *\n     * @returns {string} The message wrapped in ANSI escape codes corresponding\n     * to the specified modes. The returned string, when printed to a terminal,\n     * displays the styled message. Additional properties are attached to the\n     * result for utility purposes, such as 'show' for immediate console output.\n     */\n    sgr(message, ...useModes) {\n      const colors = Object.assign(\n        ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'],\n        {\n          isBG: a => !!/bg/i.exec(a),\n          isBright: a => !!/bright/i.exec(a),\n          isColor: a => {\n            let color = colors.find(c => new RegExp(c, 'i').exec(a));\n            return [!!color, colors.indexOf(color)];\n          },\n        }\n      );\n\n      const arrayifyString = s => {\n        if (Array.isArray(s)) {\n          let results = [];\n\n          for (const i of s) {\n            results = [ ...results, ...arrayifyString(i) ];\n          }\n\n          return results.flat().filter(i => i.length);\n        }\n\n        if (!s || typeof s !== 'string') {\n          return [''];\n        }\n        else if (s.includes(',')) {\n          return arrayifyString(s.split(','));\n        }\n        else {\n          if (!colors.isColor(s)[0] && s.length > 1) {\n            return [...s];\n          }\n          else return [s];\n        }\n      }\n\n      let modes = arrayifyString(useModes)\n\n      const sgrModes = {\n        blink: ['\\x1b[5m', '\\x1b[25m', 'k'],\n        bold: ['\\x1b[1m', '\\x1b[22m', 'b'],\n        conceal: ['\\x1b[8m', '\\x1b[28m', 'c'],\n        dim: ['\\x1b[2m', '\\x1b[22m', 'd'],\n        italics: ['\\x1b[3m', '\\x1b[23m', 'i'],\n        negative: ['\\x1b[7m', '\\x1b[27m', 'n'],\n        strike: ['\\x1b[9m', '\\x1b[29m', 's'],\n        underline: ['\\x1b[4m', '\\x1b[24m', 'u'],\n      };\n\n      Object.values(sgrModes).forEach(mode => sgrModes[mode[2]] = mode);\n\n      const codes = a => {\n        let open = '', close = '', mode = String(a).toLowerCase();\n        let [_isColor, colorIndex] = colors.isColor(mode);\n\n        if (_isColor) {\n          open = colors.isBG(mode)\n            ? `\\x1b[${colors.isBright(mode) ? 10 : 4}${colorIndex}m`\n            : `\\x1b[${colors.isBright(mode) ? 9 : 3}${colorIndex}m`;\n          close = colors.isBG(mode) ? '\\x1b[49m' : `\\x1b[39m`;\n        }\n        else if (sgrModes[mode]) {\n          open = sgrModes[mode][0];\n          close = sgrModes[mode][1];\n        }\n\n        return [open, close];\n      };\n\n      const onOrder = modes.map(key => codes(key)[0]).join('');\n      const offOrder = modes.map(key => codes(key)[1]).reverse().join('');\n\n      let result = Object(`${onOrder}${message}${offOrder}`)\n\n      Object.defineProperties(result, {\n        show: {\n          get() { console.log(String(this)); return this },\n          enumerable: false,\n        },\n        [Symbol.for('nodejs.util.inspect.custom')]: {\n          value(depth, options, inspect) {return String(this)},\n          enumerable: false,\n        },\n        [Symbol.toStringTag]: {\n          get() { return \"SgrString\" },\n          enumerable: false,\n        }\n      })\n\n      return result\n    },\n\n    /**\n     * Wraps an object's properties into a formatted string.\n     *\n     * This method takes an object and a set of options to format the\n     * object's properties into a string. It allows customization of\n     * indentation, line endings, maximum line length, and more.\n     *\n     * @param {Object} [object=globalThis] - The object to wrap.\n     * @param {Object} [options={}] - The formatting options.\n     * @param {number} [options.indent=2] - The number of indentation\n     * characters to use.\n     * @param {string} [options.indentCharacter=' '] - The character to use\n     * for indentation.\n     * @param {Array} [options.inspector=[Object, 'getOwnPropertyNames']] -\n     * The inspector to use for retrieving object properties.\n     * @param {string} [options.lineEnding='\\n'] - The line ending character.\n     * @param {number} [options.maxLen=78] - The maximum line length.\n     * @param {Function} [options.perLine=undefined] - A function to apply\n     * per line of output.\n     * @param {Function} [options.perLinePerProperty=undefined] - A function\n     * to apply per property per line of output.\n     * @param {Function} [options.preProcess=undefined] - A function to\n     * preprocess the object's properties.\n     * @param {Function} [options.preReturn=undefined] - A function to apply\n     * to the final output before returning.\n     * @param {string} [options.separator=', '] - The separator to use\n     * between properties.\n     *\n     * @returns {string} The formatted string representation of the object.\n     *\n     * @example\n     * const obj = { a: 1, b: 2, c: 3 }\n     * const wrapped = StringExtensions.wrap(obj, { maxLen: 20 })\n     * console.log(wrapped)\n     * // Output:\n     * // {\n     * //   a: 1,\n     * //   b: 2,\n     * //   c: 3\n     * // }\n     */\n    wrap(\n      objectOrLines,\n      options = {\n        colorProperties: undefined,\n        indent: 2,\n        indentCharacter: ' ',\n        inspector: [Object, 'getOwnPropertyNames'],\n        lineEnding: '\\n',\n        maxLen: 78,\n        perLine: undefined,\n        perLinePerProperty: undefined,\n        preProcess: undefined,\n        preReturn: undefined,\n        separator: ', ',\n      }\n    ) {\n      let {\n        colorProperties = undefined,\n        indent = options?.indent ?? 2,\n        indentCharacter = options?.indentCharacter ?? ' ',\n        inspector = options?.inspector ?? [Object, 'getOwnPropertyNames'],\n        lineEnding = options?.lineEnding ?? '\\n',\n        maxLen = options?.maxLen ?? 78,\n        perLine = options?.perLine ?? undefined,\n        perLinePerProperty = options?.perLinePerProperty ?? undefined,\n        preProcess = options?.preProcess ?? undefined,\n        preReturn = options?.preReturn ?? undefined,\n        separator = options?.separator ?? ', ',\n      } = options ?? {}\n\n      let tab = indent === 0 ? ''\n        : indentCharacter.repeat(Number(indent) || 2)\n      maxLen = 78 - tab.length\n\n      const sgr = this.sgr;\n      const validMapper = f => typeof f === 'function'\n\n      let line = []\n      let getElements = inspector[0][inspector[1]]\n      let values = Array.isArray(objectOrLines)\n        ? objectOrLines : getElements(Object(objectOrLines))\n\n      if (validMapper(preProcess)) {\n        values = preProcess(values)\n      }\n\n      const context = { indent, indentCharacter, lineEnding, maxLen, tab, sgr }\n\n      let finalLines = values.reduce((acc, nextProp) => {\n        let ifCombined = [...line, nextProp].join(separator)\n\n        if ((tab.length + ifCombined.length) <= maxLen) {\n          line.push(nextProp)\n        }\n\n        else {\n          let lineProps = [...line]\n\n          if (validMapper(perLinePerProperty)) {\n            lineProps = lineProps.map((value, index, array) => {\n              return perLinePerProperty(value, index, array, context)\n            })\n          }\n\n          if (colorProperties) {\n            const sgrArgs = (Array.isArray(colorProperties)\n              ? colorProperties\n              : [colorProperties]\n            )\n            lineProps = lineProps.map(v => sgr(v, ...sgrArgs))\n          }\n\n          lineProps = [tab, lineProps.join(separator)].join('')\n          if (validMapper(perLine)) {\n            lineProps = perLine(lineProps[0], 0, lineProps)?.[0] ?? lineProps[0]\n          }\n\n          acc.push(lineProps)\n          line = []\n        }\n\n        return acc\n      }, [])\n\n      if (validMapper(preReturn)) {\n        finalLines = finalLines.map((value, index, array) => {\n          return preReturn(value, index, array, context)\n        })\n      }\n\n      Symbol.for(`@nejs.string.wrap ${JSON.stringify({lines: finalLines})}`)\n\n      if (lineEnding) {\n        finalLines = finalLines.join(lineEnding)\n      }\n\n      return finalLines\n    },\n  },\n});\n\nconst { isString: pIsString, ifString: pIfString } = StringExtensions.patches\n\n/**\n * `StringPrototypeExtensions` provides a set of utility methods that are\n * added to the `String` prototype. This allows all string instances to\n * access new functionality directly, enhancing their capabilities beyond\n * the standard `String` class methods. These extensions are applied using\n * the `Patch` class from '@nejs/extension', ensuring that they do not\n * interfere with the global namespace or existing properties.\n *\n * The extensions include methods for extracting substrings based on\n * specific tokens, checking the presence of certain patterns, and more,\n * making string manipulation tasks more convenient and expressive.\n */\nexport const StringPrototypeExtensions = new Patch(String.prototype, {\n  [Patch.kMutablyHidden]: {\n    /**\n     * Determines if the current object is a string.\n     *\n     * This getter uses the `pIsString` function from the\n     * `StringExtensions` patch to check if the current object\n     * (`this`) is a string.\n     *\n     * @type {boolean}\n     * @readonly\n     *\n     * @example\n     * const str = \"Hello, World!\"\n     * console.log(str.isString) // Output: true\n     *\n     * const notStr = 123\n     * console.log(notStr.isString) // Output: false\n     */\n    get isString() {\n      return pIsString(this)\n    },\n\n    /**\n     * Checks if the current object is a string and returns the\n     * corresponding value based on the result.\n     *\n     * This method uses the `pIfString` function from the\n     * `StringExtensions` patch to determine if the current object\n     * (`this`) is a string. If it is a string, the `thenValue` is returned.\n     * Otherwise, the `elseValue` is returned.\n     *\n     * @param {any} thenValue - The value to return if the current object\n     * is a string.\n     * @param {any} elseValue - The value to return if the current object\n     * is not a string.\n     * @returns {any} The `thenValue` if the current object is a string, or\n     * the `elseValue` if it is not a string.\n     *\n     * @example\n     * const str = \"Hello, World!\"\n     * // 'Is a string'\n     * console.log(str.ifString('Is a string', 'Not a string'))\n     *\n     * const notStr = 123\n     * // 'Not a string'\n     * console.log(notStr.ifString('Is a string', 'Not a string'))\n     */\n    ifString(thenValue, elseValue) {\n      return pIfString(this, thenValue, elseValue)\n    },\n\n    /**\n     * Returns an object representation of the string instance.\n     *\n     * This getter method creates and returns an object that wraps\n     * the string instance, allowing it to be treated as an object.\n     * The returned object is created using the `Object()`\n     * constructor, which takes the string instance as its argument.\n     *\n     * @type {Object}\n     * @readonly\n     *\n     * @example\n     * const str = 'Hello, World!'\n     * console.log(typeof str)        // 'string'\n     * console.log(typeof str.instance) // 'object'\n     */\n    get instance() {\n      return Object(this)\n    },\n\n    /**\n     * Extracts a substring from the current string, starting at a given offset\n     * and bounded by specified opening and closing tokens. This method is\n     * particularly useful for parsing nested structures or quoted strings,\n     * where the level of nesting or the presence of escape characters must\n     * be considered.\n     *\n     * @param {number} offset The position in the string from which to start the\n     * search for the substring.\n     * @param {[string, string]} tokens An array containing two strings: the\n     * opening and closing tokens that define the boundaries of the substring\n     * to be extracted.\n     * @returns {Object} An object with two properties: `extracted`, the\n     * extracted substring, and `newOffset`, the position in the original\n     * string immediately after the end of the extracted substring. If no\n     * substring is found, `extracted` is `null` and `newOffset` is the same\n     * as the input offset.\n     */\n    extractSubstring(offset = 0, tokens = parenthesisPair) {\n      let [openToken, closeToken] = tokens;\n      let depth = 0;\n      let start = -1;\n      let end = -1;\n      let leadingToken = '';\n      let firstToken = 0;\n\n      for (let i = offset; i < this.length; i++) {\n        const char = this[i];\n\n        if (char === openToken) {\n          depth++;\n          if (start === -1)\n            start = i;\n        }\n        else if (char === closeToken) {\n          depth--;\n          if (depth === 0) {\n            end = i;\n            break;\n          }\n        }\n      }\n\n      let lRange = [\n        Math.max(0, start - 100),\n        start\n      ];\n      let leading = [...this.substring(lRange[0], lRange[1])].reverse().join('')\n      let reversedLeadingToken;\n\n      try {\n        reversedLeadingToken = /([^ \\,\\\"\\'\\`]+)/.exec(leading)[1] ?? '';\n        leadingToken = [...reversedLeadingToken].reverse().join('');\n      }\n      catch(ignored) { }\n\n      if (start !== -1 && end !== -1) {\n        const sliceRange = [start, end + 1];\n        const extracted = this.slice(sliceRange[0], sliceRange[1]);\n\n        return {\n          extracted,\n          range: [start, end],\n          newOffset: end + 1,\n          leadingToken,\n        };\n      }\n      else {\n        return {\n          extracted: null,\n          range: [start, end],\n          newOffset: offset,\n          leadingToken,\n        };\n      }\n    },\n\n    /**\n     * Prints the string representation of the current object using a specified\n     * function and context.\n     *\n     * This method converts the current object to a string and then prints it\n     * using the provided function. By default, it uses `console.log` to print\n     * to the console. The function is called with a specified `thisArg` to\n     * set the context in which the function is executed.\n     *\n     * @param {Function} [fn=console.log] - The function used to print the\n     *   string. Defaults to `console.log`.\n     * @param {Object} [thisArg=console] - The value of `this` provided for\n     *   the call to `fn`. Defaults to the global `console` object.\n     *\n     * @returns {string} The string representation of the current object.\n     *\n     * @example\n     * // assuming extensions are applied\n     * const str = 'Hello, World!'\n     * str.print() // Logs: 'Hello, World!' to the console\n     *\n     * @example\n     * // assuming extensions are applied\n     * const str = 'Hello, World!'\n     * const customLogger = {\n     *   time: new Date(),\n     *   log: (msg) => {\n     *     console.info('[%s]: %s', this.time..toLocaleDateString(), msg)\n     *   }\n     * }\n     * str.print(customLogger.log, customLogger)\n     * // prints \"[10/16/2024] Hello, World!\"\n     */\n    print(fn = console.log, thisArg = console) {\n      const string = this.toString()\n\n      fn.call(thisArg, string)\n\n      return string\n    },\n  },\n})\n\n// NOTE to self; this is repeated here otherwise a circular reference from\n// Object<->Function<->Global occurs. See original source in global.this.js\n// {@see globalThis.isThenElse}\nfunction isThenElse(bv, tv, ev) {\n  function isFunction(value) { typeof value === 'function' }\n\n  if (arguments.length > 1) {\n    var _then = isFunction(tv) ? tv(bv) : tv; if (arguments.length > 2) {\n      var _else = isFunction(ev) ? tv(bv) : ev; return bv ? _then : _else\n    } return bv || _then;\n  } return bv\n}\n", "import { Extension } from '@nejs/extension'\n\n/**\n * Deferreds, which were first introduced by jQuery for browsers in the early\n * 2000s, are a way to manage asynchronous operations. They have been widely\n * used and replicated by engineers since then. Although the Promise class in\n * modern JavaScript provides a static method called `withResolvers` that\n * returns an object with similar properties to a Deferred, it is not directly\n * supported by Node.js.\n *\n * ```\n * const withResolvers = Promise.withResolvers()\n * Reflect.has(withResolvers, 'promise') // true\n * Reflect.has(withResolvers, 'resolve') // true\n * Reflect.has(withResolvers, 'reject')  // true\n * ```\n *\n * This Deferred class extends the Promise class, allowing it to capture the\n * value or reason for easy access after resolution, akin to\n * {@link Promise.withResolvers}. As it extends {@link Promise}, it is\n * 'thenable' and works with `await` as if it were a native Promise. This\n * allows seamless integration with code expecting Promise-like objects.\n */\nexport class Deferred extends Promise {\n  /**\n   * The promise backing this deferred object. Created when the constructor\n   * runs, this promise is what all `Promise.prototype` functions are routed\n   * to.\n   *\n   * @type {Promise}\n   */\n  #promise = null\n\n  /**\n   * The reject() resolver that will be assigned when a new instance is\n   * created. Invoking this function with or without a `reason` will cause\n   * the deferred's promise to be settled.\n   *\n   * @type {function}\n   */\n  #reject = null\n\n  /**\n   * The resolve() resolver that will be assigned when a new instance is\n   * created. Invoking this function with or without a `value` will cause\n   * the deferred's promise to be settled.\n   *\n   * @type {function}\n   */\n  #resolve = null\n\n  #rejected = false\n\n  #resolved = false\n\n  /**\n   * When the Deferred is settled with {@link Deferred.resolve}, the `value`\n   * passed to that function will be set here as well.\n   *\n   * @type {*}\n   */\n  value = null\n\n  /**\n   * When the Deferred is settled with {@link Deferred.reject}, the `reason`\n   * passed to that rejection will also be stored here.\n   *\n   * @type {*}\n   */\n  reason = null\n\n  /**\n   * When either {@link Deferred.resolve} or {@link Deferred.reject} are called,\n   * this property is set to `true`. Its current status at any time can be\n   * queried using the {@link Deferred.settled} getter.\n   *\n   * @type {boolean}\n   */\n  #settled = false\n\n  /**\n   * The constructor for Deferred instances. By default, a new Deferred will\n   * have three important properties: `promise`, `resolve`, and `reject`.\n   *\n   * The constructor takes an object called `options`. It can have the\n   * following properties:\n   *\n   * ```\n   * interface BaseDeferredOptions {\n   *   // Deferreds store the value or reason. To turn this off, pass true\n   *   // to this option.\n   *   doNotTrackAnswers?: boolean;\n   * }\n   *\n   * interface ResolveDeferredOptions {\n   *   // Passing in an option object with a resolve value will auto resolve\n   *   // the Deferred with your value. An error will be raised if both\n   *   // resolve and reject are supplied at the same time.\n   *   resolve?: (value: any) => void;\n   * }\n   *\n   * interface RejectDeferredOptions {\n   *   // Passing in an option object with a reject reason will auto reject\n   *   // the Deferred with your reason. An error will be raised if both\n   *   // resolve and reject are supplied at the same time.\n   *   reject?: (reason: any) => void;\n   * }\n   *\n   * type DeferredOptions = BaseDeferredOptions &\n   *   (ResolveDeferredOptions | RejectDeferredOptions)\n   * ```\n   *\n   * @param {object} options see above for examples on supported options, but\n   * when supplied, the constructor can take instructions on how to auto\n   * resolve or reject the deferred created here.\n   */\n  constructor(options) {\n    // Check if options is an object, if not, assign an empty object to config\n    const config = (options && typeof(options) === 'object'\n      ? options\n      : {}\n    )\n\n    // Throw an error if both resolve and reject options are provided\n    if (config?.resolve && config?.reject) {\n      throw new TypeError(\n        'resolve and reject options cannot be simultaneously provided'\n      )\n    }\n\n    // Create an empty object to store the resolve and reject functions\n    let _resolve, _reject;\n\n    // Create a new promise and assign its resolve and reject functions to resolvers\n    super((resolve, reject) =>{\n      _resolve = resolve\n      _reject = reject\n\n      if (config?.executor && typeof(config?.executor) === 'function') {\n        config?.executor(resolve, reject)\n      }\n    })\n\n    // Define the resolve function for the Deferred instance\n    this.#resolve = (value) => {\n      // If doNotTrackAnswers is not set to true, store the value\n      if (config?.doNotTrackAnswers !== true) {\n        this.value = value\n      }\n      // Mark the Deferred instance as settled\n      this.#settled = true\n\n      // Mark the Deferred instance as resolved\n      this.#resolved = true\n\n      // Resolve the promise with the provided value\n      return _resolve(value)\n    }\n\n    // Define the reject function for the Deferred instance\n    this.#reject = async (reason) => {\n      // If doNotTrackAnswers is not set to true, store the reason\n      if (config?.doNotTrackAnswers !== true) {\n        this.reason = reason\n      }\n      // Mark the Deferred instance as settled\n      this.#settled = true\n\n      // Mark the Deferred as being rejected.\n      this.#rejected = true\n\n      // Reject the promise with the provided reason\n      return _reject(reason)\n    }\n\n    this.#promise = this\n\n    // If a resolve option is provided, resolve the Deferred instance with it\n    if (config?.resolve) {\n      this.#resolve(config?.resolve)\n    }\n    // If a reject option is provided, reject the Deferred instance with it\n    else if (config?.reject) {\n      this.#reject(config?.reject)\n    }\n  }\n\n  /**\n   * Returns a boolean value that indicates whether or not this Deferred\n   * has been settled (either resolve or reject have been invoked).\n   *\n   * @returns {boolean} `true` if either {@link Deferred.resolve} or\n   * {@link Deferred.reject} have been invoked; `false` otherwise\n   */\n  get settled() {\n    return this.#settled\n  }\n\n  /**\n   * A getter that returns a boolean indicating whether the Deferred instance\n   * was rejected. This property can be used to check if the Deferred has been\n   * settled with a rejection. It is particularly useful in scenarios where\n   * the resolution status of the Deferred needs to be checked without\n   * accessing the rejection reason or invoking any additional logic.\n   *\n   * @returns {boolean} `true` if the Deferred was rejected, otherwise `false`.\n   */\n  get wasRejected() {\n    return this.#rejected\n  }\n\n  /**\n   * A getter that returns a boolean indicating whether the Deferred instance\n   * was resolved. This property is useful for checking if the Deferred has been\n   * settled with a resolution, allowing for checks on the Deferred's status\n   * without needing to access the resolved value or trigger any additional\n   * logic.\n   *\n   * @returns {boolean} `true` if the Deferred was resolved, otherwise `false`.\n   */\n  get wasResolved() {\n    return this.#resolved\n  }\n\n  /**\n   * Accessor for the promise managed by this Deferred instance.\n   *\n   * This getter provides access to the internal promise which is controlled\n   * by the Deferred's resolve and reject methods. It allows external code to\n   * attach callbacks for the resolution or rejection of the Deferred without\n   * the ability to directly resolve or reject it.\n   *\n   * @returns {Promise} The promise controlled by this Deferred instance.\n   */\n  get promise() {\n    return this.#promise\n  }\n\n  /**\n   * Resolves the Deferred with the given value. If the value is a thenable\n   * (i.e., has a \"then\" method), the Deferred will \"follow\" that thenable,\n   * adopting its eventual state; otherwise, the Deferred will be fulfilled\n   * with the value. This function behaves the same as Promise.resolve.\n   *\n   * @param {*} value - The value to resolve the Deferred with.\n   * @returns {Promise} A Promise that is resolved with the given value.\n   */\n  resolve(value) {\n    return this.#resolve(value)\n  }\n\n  /**\n   * Rejects the Deferred with the given reason. This function behaves the\n   * same as Promise.reject. The Deferred will be rejected with the provided\n   * reason.\n   *\n   * @param {*} reason - The reason to reject the Deferred with.\n   * @returns {Promise} A Promise that is rejected with the given reason.\n   */\n  reject(reason) {\n    return this.#reject(reason)\n  }\n\n  /**\n   * Customizes the output of `util.inspect` on instances of Deferred when\n   * used in Node.js. This method is invoked by Node.js's `util.inspect`\n   * utility to format the inspection output of a Deferred instance.\n   *\n   * The output includes the state of the Deferred (resolved, rejected, or\n   * unsettled) along with the resolved value or rejection reason, if\n   * applicable. This provides a quick, readable status of the Deferred\n   * instance directly in the console or debugging tools.\n   *\n   * @param {number} depth The depth to which `util.inspect` will recurse.\n   * @param {object} options Formatting options provided by `util.inspect`.\n   * @param {function} inspect Reference to the `util.inspect` function.\n   * @returns {string} A formatted string representing the Deferred instance.\n   */\n  [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {\n    return [\n      '\\x1b[1mDeferred [\\x1b[22;3mPromise\\x1b[23;1m]\\x1b[22m ',\n      '{ ',\n      (this.settled\n        ? (this.wasResolved\n          ? `resolved with \\x1b[32m${this.value}\\x1b[39m`\n          : `rejected with \\x1b[31m${this.reason?.message ?? this.reason}\\x1b[39m`)\n        : '\\x1b[33munsettled valued or reason\\x1b[39m'\n      ),\n      ' }'\n    ].join('')\n  }\n\n  /**\n   * A getter for the species symbol which returns a custom DeferredPromise\n   * class. This class extends from Deferred and is used to ensure that the\n   * constructor signature matches that of a Promise. The executor function\n   * passed to the constructor of this class is used to initialize the Deferred\n   * object with resolve and reject functions, similar to how a Promise would\n   * be initialized.\n   *\n   * @returns {DeferredPromise} A DeferredPromise class that extends Deferred.\n   */\n  static get [Symbol.species]() {\n    return class DeferredPromise extends Deferred {\n      /**\n       * The constructor for the DeferredPromise class.\n       * It takes an executor function which is used to initialize the Deferred.\n       *\n       * @param {Function} executor - A function that is passed with the resolve\n       * and reject functions. The executor is expected to initialize the\n       * Deferred by calling resolve or reject at some point.\n       */\n      constructor(executor) {\n        super({executor})\n      }\n    }\n  }\n}\n\nexport const DeferredExtension = new Extension(Deferred)", "import { Extension, Patch } from '@nejs/extension'\n\n/**\n * True when running in an environment that has `process.stdout` (Node.js).\n * Used to guard stdout/stderr access so the module can be safely imported\n * in browsers.\n */\nconst hasProcess = (\n  typeof process !== 'undefined' &&\n  process?.stdout?.write &&\n  process?.stderr?.write\n)\n\n/**\n * Captures the output written to `process.stdout` during the execution of\n * a callback function. This function temporarily overrides the standard\n * output stream to capture any data written to it, allowing for inspection\n * or testing of console output.\n *\n * In browser environments where `process.stdout` is unavailable, the\n * callback is still executed but output cannot be captured \u2014 an empty\n * string is returned.\n *\n * @param {Function|*} callback - The function to execute, during which\n *   `process.stdout` is captured. If not a function, it will be treated\n *   as the first argument to a console log.\n * @param {Array} [args=[]] - Arguments to pass to the callback function.\n * @param {Object} [thisArg=console] - The value of `this` provided for\n *   the call to `callback`.\n * @returns {string} The captured output from `process.stdout`.\n *\n * @example\n * const output = captureStdout(() => {\n *   console.log('Hello, World!')\n * })\n * console.log(output) // Outputs: 'Hello, World!'\n *\n * @description\n * This function is useful for testing or capturing console output without\n * displaying it in the terminal. It works by temporarily replacing\n * `process.stdout.write` with a custom function that appends output to a\n * string. After the callback is executed, the original `process.stdout.write`\n * is restored.\n */\nexport function captureStdout(callback, args = [], thisArg = console) {\n  let captured = ''\n  const originalWrite = hasProcess ? process.stdout.write : null\n\n  if (typeof callback !== 'function') {\n    let newArgs = [callback]\n\n    if (thisArg) {\n      newArgs.push(thisArg)\n    }\n\n    newArgs = newArgs.concat(args)\n\n    callback = function () {\n      console.log(...newArgs)\n    }\n\n    thisArg = console\n    args = []\n  }\n\n  if (hasProcess) {\n    process.stdout.write = (chunk, encoding, callback) => {\n      captured += chunk\n    }\n  }\n\n  try {\n    callback.apply(thisArg, args)\n  } finally {\n    if (hasProcess) {\n      process.stdout.write = originalWrite\n    }\n  }\n\n  return captured.substring(0, captured.length - 1)\n}\n\n/**\n * A class that simulates a console for capturing and manipulating console\n * output as strings. This class provides methods to log messages, format\n * them with colors, and store them in a buffer for later inspection or\n * manipulation.\n *\n * @example\n * const stringConsole = new StringConsole()\n * stringConsole.log('Hello, World!')\n * stringConsole.buffer // ['Hello, World!']\n *\n * @description\n * The StringConsole class is designed to capture console output without\n * displaying it in the terminal. It stores the output in a buffer, allowing\n * for easy retrieval and manipulation. This is particularly useful for\n * testing or when console output needs to be processed programmatically.\n */\nexport class StringConsole {\n  /**\n   * @type {Array}\n   * @description\n   * The buffer array is used to store captured console output. It is\n   * initialized as an empty array and can be populated with strings\n   * representing console messages. This buffer serves as a temporary\n   * storage for output that can be manipulated or inspected later.\n   *\n   * @example\n   * const console = new StringConsole()\n   * console.buffer.push('Hello, World!')\n   * console.buffer // ['Hello, World!']\n   */\n  buffer = [];\n\n  /**\n   * The last index of the buffer when capture began. This number should be\n   * set to `NaN` when not in use.\n   *\n   * @type {number|NaN}\n   */\n  capturedAt = NaN\n\n  /**\n   * If this is `true`, all \"logged\" output will be captured in an ever\n   * growing buffer.\n   *\n   * @type {boolean}\n   * @see {@link StringConsole.buffer}\n   */\n  captureOutput = true;\n\n  /**\n   * @typedef {\n   *   Int8Array|Int16Array|Int32Array|Float32Array|Float64Array\n   * } TypedArray\n   */\n\n  /**\n   * @typedef {(\n   *   chunk: string|Buffer|TypedArray|DataView,\n   *   encoding: string|null,\n   *   callback: ()=>{}\n   * )=>boolean} StringConsoleRecorder\n   * @property {boolean} [Symbol.for('StringConsole.recorder')]\n   */\n\n  /**\n   * The recorder function is what is subsituted for the `process.stdout.write`\n   * function whenever we need to temporarily capture the output of data bound\n   * for the bidirectional read-write stream, `stdout`.\n   *\n   * @type {StringConsoleRecorder}\n   * @param {string|Buffer|TypedArray|DataView|any} chunk Optional data to\n   * write. For streams not operating in object mode, chunk must be a\n   * {@link String}, {@link Buffer}, {@link Int8Array}, {@link Int16Array},\n   * {@link Int32Array}, {@link Float32Array}, {@link Float64Array} or\n   * {@link DataView}. For object mode streams, chunk may be any JavaScript\n   * value other than `null`.\n   * @param {string|null} encoding the encoding, if chunk is a string.\n   * Default: `'utf8'`\n   * @param {Function} callback callback for when this chunk of data is\n   * flushed.\n   *\n   * @returns {boolean} false if the stream wishes for the calling code to\n   * wait for the 'drain' event to be emitted before continuing to write\n   * additional data; otherwise true.\n   */\n  recorder = Object.defineProperty(\n    function recorder(chunk, encoding, callback) { this.buffer.push(chunk) },\n    Symbol.for(`StringConsole.recorder`),\n    { value: true, configurable: true }\n  );\n\n  /**\n   * Initializes a new instance of the StringConsole class.\n   *\n   * @param {string|string[]} [initialContents] - The initial contents to\n   * populate the buffer. If an array is provided, it will be used directly\n   * as the buffer. If a single string is provided, it will be converted\n   * to a string and added to the buffer.\n   *\n   * @example\n   * const console1 = new StringConsole('Hello')\n   * console1.buffer // ['Hello']\n   *\n   * const console2 = new StringConsole(['Hello', 'World'])\n   * console2.buffer // ['Hello', 'World']\n   */\n  constructor(captureOutput = true, initialContents = undefined) {\n    this.recorder = this.recorder.bind(this)\n\n    if (Array.isArray(initialContents))\n      this.buffer = initialContents\n\n    else if (initialContents)\n      this.buffer.push(String(initialContents))\n  }\n\n  /**\n   * Clears the buffer by removing all elements.\n   *\n   * This method utilizes the `splice` function to remove all elements\n   * from the buffer array, effectively resetting it to an empty state.\n   * This is useful when you want to discard all previously captured\n   * console output and start fresh.\n   *\n   * @returns {StringConsole} `this` to allow for calling `clear()`\n   * before immediately invoking a console method.\n   *\n   * @example\n   * const console = new StringConsole(['Hello', 'World'])\n   * console.clear()\n   * console.buffer // []\n   */\n  clear() {\n    this.buffer.splice(0, this.buffer.length)\n\n    return this\n  }\n\n\n  /**\n   * Checks if the console output is currently being captured.\n   *\n   * This method determines if the `process.stdout.write` function has been\n   * overridden to capture console output by checking for the presence of\n   * a specific symbol.\n   *\n   * @returns {boolean} True if capturing is active, false otherwise.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.startCapture()\n   * console.log(stringConsole.isCapturing()) // Stores 'true' in the buffer\n   */\n  isCapturing() {\n    if (!hasProcess) return false\n\n    return Reflect.has(\n      process.stdout.write,\n      Symbol.for('StringConsole.recorder')\n    )\n  }\n\n  /**\n   * Starts capturing console output.\n   *\n   * This method overrides the `process.stdout.write` function with a custom\n   * recorder function to capture all console output.\n   *\n   * @returns {number} the last index of the buffer in its current state or\n   * 0 if it is empty\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.startCapture()\n   * console.log('This will be stored in stringConsole.buffer')\n   */\n  startCapture() {\n    if (this.captureOutput === false)\n      this.buffer = []\n\n    if (hasProcess) {\n      process.stdout.write = this.recorder\n      process.stderr.write = this.recorder\n    }\n    this.capturedAt = this.buffer.length ? this.buffer.length : 0\n\n    return this.capturedAt\n  }\n\n  /**\n   * An object containing two properties covering the captured content\n   * while `process.stdout.write` was swapped. It should contain the\n   * range of line indicies as well as the content as an array of strings\n   *\n   * @typedef {object} StringConsoleCapturedOutput\n   * @property {number[]} range an array of two numbers, a starting index\n   * and an ending index. This value will be [NaN,NaN] if this instance\n   * has indicated that storing captured output is disabled.\n   * @property {string[]} lines an array of strings of captured output\n   * that occurred in between calls to {@link ~startCapture} and then\n   * ending call to {@link ~stopCapture}\n   */\n\n  /**\n   * Stops capturing console output.\n   *\n   * This method restores the original `process.stdout.write` function,\n   * ceasing the capture of console output.\n   *\n   * @returns {StringConsoleCapturedOutput} the range of indices capturing\n   * the lines of the buffer that have been added since capturing was\n   * started.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.startCapture()\n   * console.log('This will be stored in stringConsole.buffer')\n   * stringConsole.stopCapture()\n   * console.log('This will not be captured')\n   */\n  stopCapture() {\n    const range = [this.capturedAt || 0, this.buffer.length - 1]\n    const lines = this.buffer.slice(range[0], range[1] + 1)\n\n    if (this.captureOutput === false)\n      this.buffer = []\n\n    if (hasProcess) {\n      process.stdout.write = StringConsole[Symbol.for('process.stdout.write')]\n      process.stderr.write = StringConsole[Symbol.for('process.stderr.write')]\n    }\n    this.capturedAt = NaN\n\n    return { range, lines }\n  }\n\n  /**\n   * Joins the StringConsole output as a single string. By default, each entry\n   * captured so far is joined on a new line. Pass a different joiner such as\n   * an empty string or a whitespace character, as examples, to change the\n   * output string.\n   *\n   * @param {string} joinOn the string to join the output buffer on, defaults\n   * to a new line character\n   * @returns a single string of contatenated entries so far to this buffer.\n   */\n  toString(joinOn = '') {\n    return this.buffer.join(joinOn)\n  }\n\n  /**\n   * Captures formatted debug messages as though they'd been printed. The\n   * resulting output that would have been printed is stored in the buffer\n   * as well as being returned.\n   *\n   * This method formats the provided arguments with color coding specific\n   * to the 'debug' level as though `console.debug` were used. The output\n   * is captured and stored in the buffer for later inspection, but not\n   * actually printed to the standard output.\n   *\n   * @param {any[]} args - The arguments to be log captured. These can be\n   * of any type and will be formatted with color coding without being logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.debug('[debug]', 'message')\n   * stringConsole.buffer // Contains the captured messages so far as an array\n   */\n  debug(...args) {\n    args = this.constructor.colorArgs('debug', args)\n\n    this.startCapture()\n    console.debug(...args)\n\n    return this.stopCapture().lines.join('\\n')\n  }\n\n  /**\n   * Captures formatted error messages as though they'd been printed. The\n   * resulting output that would have been printed is stored in the buffer\n   * as well as being returned.\n   *\n   * This method formats the provided arguments with color coding specific\n   * to the 'error' level as though `console.error` were used. The output\n   * is captured and stored in the buffer for later inspection, but not\n   * actually printed to the standard output.\n   *\n   * @param {any[]} args - The arguments to be log captured. These can be\n   * of any type and will be formatted with color coding without being logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.error('[error]', 'message')\n   * stringConsole.buffer // Contains the captured messages so far as an array\n   */\n  error(...args) {\n    args = this.constructor.colorArgs('error', args)\n\n    this.startCapture()\n    console.error(...args)\n\n    return this.stopCapture().lines.join('\\n')\n  }\n\n  /**\n   * Groups console output under a specified group name and captures the\n   * output. No content will actually be logged to the console, just\n   * the output that normally would be is formatted in a string and returned\n   * instead.\n   *\n   * This method allows you to format multiple messages under a single\n   * group name. It captures the output of each invocation and stores it in\n   * a buffer. The captured output is returned as a single string.\n   *\n   * @param {string} groupName - The name of the group under which the\n   * messages will be logged.\n   * @param {...Array} invocations - An array of invocations where each\n   * invocation is an array. The first element is the log level (e.g.,\n   * 'log', 'info'), and the remaining elements are the arguments to be\n   * logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const console = new StringConsole()\n   * const output = console.group('MyGroup',\n   *   ['log', 'Hello'],\n   *   ['warn', 'Warning!']\n   * )\n   *\n   * console.buffer // Contains the captured group output\n   */\n  group(groupName, ...invocations) {\n    const commands = ['log', 'info', 'warn', 'error', 'debug', 'trace']\n    const buffer = []\n\n    invocations = invocations.filter(i => commands.includes(i?.[0]))\n\n    if (groupName)\n      groupName = this.constructor.style(groupName, ['underline', 'bold'])\n    else\n      groupName = this.constructor.style('grouped', ['underline', 'bold'])\n\n    this.startCapture()\n    console.group(groupName)\n\n    for (const invocation of invocations) {\n      if (!Array.isArray(invocation) || invocation.length < 2)\n        continue\n\n      const [level, ...args] = invocation\n      console[level](...this.constructor.colorArgs(level, args))\n    }\n\n    console.groupEnd(groupName)\n\n    return this.stopCapture().lines.join('')\n  }\n\n  /**\n   * Captures formatted info messages as though they'd been printed. The\n   * resulting output that would have been printed is stored in the buffer\n   * as well as being returned.\n   *\n   * This method formats the provided arguments with color coding specific\n   * to the 'info' level as though `console.info` were used. The output\n   * is captured and stored in the buffer for later inspection, but not\n   * actually printed to the standard output.\n   *\n   * @param {any[]} args - The arguments to be log captured. These can be\n   * of any type and will be formatted with color coding without being logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.info('[info]', 'message')\n   * stringConsole.buffer // Contains the captured messages so far as an array\n   */\n  info(...args) {\n    args = this.constructor.colorArgs('info', args)\n\n    this.startCapture()\n    console.info(...args)\n\n    return this.stopCapture().lines.join('\\n')\n  }\n\n  /**\n   * Captures formatted log messages as though they'd been printed. The\n   * resulting output that would have been printed is stored in the buffer\n   * as well as being returned.\n   *\n   * This method formats the provided arguments with color coding specific\n   * to the 'log' level as though `console.log` were used. The output\n   * is captured and stored in the buffer for later inspection, but not\n   * actually printed to the standard output.\n   *\n   * @param {any[]} args - The arguments to be log captured. These can be\n   * of any type and will be formatted with color coding without being logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.log('[log]', 'message')\n   * stringConsole.buffer // Contains the captured messages so far as an array\n   */\n  log(...args) {\n    args = this.constructor.colorArgs('log', args)\n\n    this.startCapture()\n    console.log(...args)\n\n    return this.stopCapture().lines.join('\\n')\n  }\n\n  /**\n   * Captures formatted trace messages as though they'd been printed. The\n   * resulting output that would have been printed is stored in the buffer\n   * as well as being returned.\n   *\n   * This method formats the provided arguments with color coding specific\n   * to the 'trace' level as though `console.trace` were used. The output\n   * is captured and stored in the buffer for later inspection, but not\n   * actually printed to the standard output.\n   *\n   * @param {any[]} args - The arguments to be log captured. These can be\n   * of any type and will be formatted with color coding without being logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.trace('[trace]', 'message')\n   * stringConsole.buffer // Contains the captured messages so far as an array\n   */\n  trace(...args) {\n    args = this.constructor.colorArgs('trace', args)\n\n    this.startCapture()\n    console.trace(...args)\n\n    return this.stopCapture().lines.join('\\n')\n  }\n\n  /**\n   * Captures formatted warn messages as though they'd been printed. The\n   * resulting output that would have been printed is stored in the buffer\n   * as well as being returned.\n   *\n   * This method formats the provided arguments with color coding specific\n   * to the 'warn' level as though `console.warn` were used. The output\n   * is captured and stored in the buffer for later inspection, but not\n   * actually printed to the standard output.\n   *\n   * @param {any[]} args - The arguments to be log captured. These can be\n   * of any type and will be formatted with color coding without being logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const stringConsole = new StringConsole()\n   * stringConsole.warn('[warn]', 'message')\n   * stringConsole.buffer // Contains the captured messages so far as an array\n   */\n  warn(...args) {\n    args = this.constructor.colorArgs('warn', args)\n\n    this.startCapture()\n    console.warn(...args)\n\n    return this.stopCapture().lines.join('\\n')\n  }\n\n  /**\n   * Captures a single line of text that would be logged to the console if\n   * the console function of the same name were to be invoked. The string\n   * is formatted according to the log colors, or any pre-existing colors as\n   * those are untouched. After formatting, the string is returned.\n   *\n   * @param {...*} args the arguments to be logged. These can be of any\n   *   type and will be passed to the underlying console's method of the same\n   *   name.\n   *\n   * @returns {string}\n   *\n   * @example\n   * const string = StringConsole.debug('[debug]: %o', someVariable)\n   */\n  static debug(...args) {\n    return this.#console.clear().debug(...args)\n  }\n\n  /**\n   * Captures a single line of text that would be logged to the console if\n   * the console function of the same name were to be invoked. The string\n   * is formatted according to the log colors, or any pre-existing colors as\n   * those are untouched. After formatting, the string is returned.\n   *\n   * @param {...*} args the arguments to be logged. These can be of any\n   *   type and will be passed to the underlying console's method of the same\n   *   name.\n   *\n   * @returns {string}\n   *\n   * @example\n   * const string = StringConsole.error('[error]: %o', someVariable)\n   */\n  static error(...args) {\n    return this.#console.clear().error(...args)\n  }\n\n  /**\n   * Groups console output under a specified group name and captures the\n   * output. No content will actually be logged to the console, just\n   * the output that normally would be is formatted in a string and returned\n   * instead.\n   *\n   * This method allows you to format multiple messages under a single\n   * group name. It captures the output of each invocation and stores it in\n   * a buffer. The captured output is returned as a single string.\n   *\n   * @param {string} groupName - The name of the group under which the\n   * messages will be logged.\n   * @param {...Array} invocations - An array of invocations where each\n   * invocation is an array. The first element is the log level (e.g.,\n   * 'log', 'info'), and the remaining elements are the arguments to be\n   * logged.\n   *\n   * @returns {string} The captured console output as a string.\n   *\n   * @example\n   * const console = new StringConsole()\n   * const output = console.group('MyGroup',\n   *   ['log', 'Hello'],\n   *   ['warn', 'Warning!']\n   * )\n   *\n   * console.buffer // Contains the captured group output\n   */\n  static group(groupName, ...invocations) {\n    return this.#console.clear().group(groupName, ...invocations)\n  }\n\n  /**\n   * Captures a single line of text that would be logged to the console if\n   * the console function of the same name were to be invoked. The string\n   * is formatted according to the log colors, or any pre-existing colors as\n   * those are untouched. After formatting, the string is returned.\n   *\n   * @param {...*} args the arguments to be logged. These can be of any\n   *   type and will be passed to the underlying console's method of the same\n   *   name.\n   *\n   * @returns {string}\n   *\n   * @example\n   * const string = StringConsole.info('[info]: %o', someVariable)\n   */\n  static info(...args) {\n    return this.#console.clear().info(...args)\n  }\n\n  /**\n   * Captures a single line of text that would be logged to the console if\n   * the console function of the same name were to be invoked. The string\n   * is formatted according to the log colors, or any pre-existing colors as\n   * those are untouched. After formatting, the string is returned.\n   *\n   * @param {...*} args the arguments to be logged. These can be of any\n   *   type and will be passed to the underlying console's method of the same\n   *   name.\n   *\n   * @returns {string}\n   *\n   * @example\n   * const string = StringConsole.log('[log]: %o', someVariable)\n   */\n  static log(...args) {\n    return this.#console.clear().log(...args)\n  }\n\n  /**\n   * Captures a single line of text that would be logged to the console if\n   * the console function of the same name were to be invoked. The string\n   * is formatted according to the log colors, or any pre-existing colors as\n   * those are untouched. After formatting, the string is returned.\n   *\n   * @param {...*} args the arguments to be logged. These can be of any\n   *   type and will be passed to the underlying console's method of the same\n   *   name.\n   *\n   * @returns {string}\n   *\n   * @example\n   * const string = StringConsole.trace('[trace]: %o', someVariable)\n   */\n  static trace(...args) {\n    return this.#console.clear().trace(...args)\n  }\n\n  /**\n   * Captures a single line of text that would be logged to the console if\n   * the console function of the same name were to be invoked. The string\n   * is formatted according to the log colors, or any pre-existing colors as\n   * those are untouched. After formatting, the string is returned.\n   *\n   * @param {...*} args the arguments to be logged. These can be of any\n   *   type and will be passed to the underlying console's method of the same\n   *   name.\n   *\n   * @returns {string}\n   *\n   * @example\n   * const string = StringConsole.warn('[warn]: %o', someVariable)\n   */\n  static warn(...args) {\n    return this.#console.clear().warn(...args)\n  }\n\n  /**\n   * Internal instance of {@link StringConsole} used for static logging\n   * methods.\n   *\n   * @type {StringConsole}\n   */\n  static #console = new StringConsole(false);\n\n  /**\n   * A static map defining color codes for console output. Each color is\n   * associated with an array containing two numbers, which represent\n   * the ANSI escape codes for styling text in the terminal.\n   *\n   * The first number in the array is the suffix code for the standard\n   * color, while the second number suffix code to undo the color. These\n   * codes are useless without the pen prefix code.\n   *\n   * @type {Map<string, number[]>}\n   * @see {@link StringConsole.pens}\n   *\n   * @example\n   * // Accessing the color codes for 'red'\n   * const redCodes = StringConsole.colors.get('red')\n   * const fgCodes = StringConsole.pens.get('foreground')\n   * const prefix = `\\x1b[${fgCodes[0]}${redCodes[0]}m`\n   * const suffix = `\\x1b[${fgCodes[1]}${redCodes[1]}m`\n   * // Outputs: \"Text\" in red but \"!!\" in the default color\n   * console.log(`${prefix}Text!!${suffix}`)\n   *\n   * @description\n   * This map is used to apply color coding to console messages, enhancing\n   * readability and providing visual cues for different log levels.\n   */\n  static colors = new Map([\n    ['black', [0, 9]],\n    ['red', [1, 9]],\n    ['green', [2, 9]],\n    ['yellow', [3, 9]],\n    ['blue', [4, 9]],\n    ['magenta', [5, 9]],\n    ['cyan', [6, 9]],\n    ['white', [7, 9]]\n  ])\n\n  /**\n   * A static map defining the color schemes for different logging levels.\n   * Each log level is associated with an array of color styles that are\n   * applied to the console output for that level.\n   *\n   * The available log levels and their corresponding color styles are:\n   * - 'log': White\n   * - 'info': Cyan\n   * - 'warn': Yellow\n   * - 'error': Red\n   * - 'trace': Magenta\n   * - 'debug': Bold Yellow\n   *\n   * @type {Map<string, string[]>}\n   *\n   * @example\n   * const logColor = StringConsole.levels.get('log') // ['white']\n   * const errorColor = StringConsole.levels.get('error') // ['red']\n   */\n  static levels = Object.defineProperties(new Map([\n    ['log', ['white']],\n    ['info', ['cyan']],\n    ['warn', ['yellow']],\n    ['error', ['red']],\n    ['trace', ['magenta']],\n    ['debug', ['bold', 'yellow']]\n  ]), {\n    color: {\n      value: function color(key) {\n        for (const value of this.get(key)) {\n          if (StringConsole.colors.has(value)) {\n            return StringConsole.colors.get(value)\n          }\n        }\n\n        return StringConsole.colors.get('white')\n      },\n      configurable: true,\n    },\n\n    styles: {\n      value: function styles(key) {\n        const styles = []\n\n        for (const value of this.get(key)) {\n          if (StringConsole.styles.has(value)) {\n            styles.push(StringConsole.styles.get(value))\n          }\n        }\n\n        return styles\n      },\n      configurable: true,\n    },\n  });\n\n  /**\n   * A static map defining the ANSI escape codes for different pen styles\n   * used in console output. Each pen style is associated with an array\n   * containing two numbers: the first for setting the style and the second\n   * for resetting it.\n   *\n   * The available pen styles and their corresponding ANSI codes are:\n   * - 'foreground': [3, 3] - Standard foreground color\n   * - 'background': [4, 4] - Standard background color\n   * - 'bright.foreground': [9, 3] - Bright foreground color\n   * - 'bright.background': [10, 4] - Bright background color\n   *\n   * These are prefixes for both enabling and disabling. Normally a red color\n   * is represented using SGR (Select Graphic Rendition) codes like \\x1b[31m\n   * for the foreground and \\x1b[39m to return to normal color. So the 3\n   * determines a foreground prefix for starting and stopping (the 3's in 31\n   * and 39). Background prefixes are usually 4. These change for bright\n   * colors which use 9 and 3, and 10 and 4, respectively.\n   *\n   * @type {Map<string, number[]>}\n   *\n   * @example\n   * // [3, 3]\n   * const foregroundPen = StringConsole.pens.get('foreground')\n   *\n   * // [10, 4]\n   * const brightBackgroundPen = StringConsole.pens.get('bright.background')\n   */\n  static pens = new Map([\n    ['foreground', [3, 3]],\n    ['background', [4, 4]],\n    ['bright.foreground', [9, 3]],\n    ['bright.background', [10, 4]]\n  ]);\n\n  /**\n   * A static map defining ANSI escape codes for various text styles used\n   * in console output. Each style is associated with an array containing\n   * two escape codes: one for enabling the style and one for disabling it.\n   *\n   * The available styles and their corresponding ANSI codes are:\n   * - 'reset': Resets all styles to default.\n   * - 'blink': Enables blinking text.\n   * - 'bold': Makes text bold.\n   * - 'conceal': Conceals text.\n   * - 'dim': Dims the text.\n   * - 'italics': Italicizes the text.\n   * - 'negative': Inverts the foreground and background colors.\n   * - 'strike': Strikes through the text.\n   * - 'underline': Underlines the text.\n   *\n   * @type {Map<string, string[]>}\n   *\n   * @example\n   * const boldStyle = StringConsole.styles.get('bold')\n   * // ['\\x1b[1m', '\\x1b[22m']\n   */\n  static styles = new Map([\n    ['reset', ['\\x1b[0m']],\n    ['blink', ['\\x1b[5m', '\\x1b[25m']],\n    ['bold', ['\\x1b[1m', '\\x1b[22m']],\n    ['conceal', ['\\x1b[8m', '\\x1b[28m']],\n    ['dim', ['\\x1b[2m', '\\x1b[22m']],\n    ['italics', ['\\x1b[3m', '\\x1b[23m']],\n    ['negative', ['\\x1b[7m', '\\x1b[27m']],\n    ['strike', ['\\x1b[9m', '\\x1b[29m']],\n    ['underline', ['\\x1b[4m', '\\x1b[24m']]\n  ]);\n\n  /**\n   * Applies ANSI color codes to a given string based on specified options.\n   * This method checks if the string already contains color codes or if\n   * the input is not a string, in which case it returns the original input.\n   * Otherwise, it formats the string with the specified color and pen\n   * options.\n   *\n   * @param {string} string - The string to be colorized.\n   * @param {Object} [options] - Configuration options for colorization.\n   * @param {string} [options.level] - The log level determining\n   *   which colors to apply.\n   * @param {number[]} [options.rgb8] a single color code where 0 - 7, for\n   * the 'standard' colors specified by the SGR sequences 30 to 37; 8-15 are\n   * high intensity or bright colors,\n   * @param {number[]} [options.rgb24] An array of three values, ordered, red,\n   *   green and then blue. The values should range from 0 to 255.\n   * @param {string|string[]} [options.styles] defaulting to an empty array, if\n   *   supplied with a single known style {@link ~styles}, or an array of them.\n   * @param {string} [options.pen='foreground'] - The pen type for color\n   *   application, either 'foreground' or 'background'.\n   * @param {Array} [options.buffer=[]] - An array to prepend to the\n   *   formatted string.\n   * @param {Array} [options.before=[]] - An array of strings to prepend\n   *   before the main string.\n   * @param {Array} [options.after=[]] - An array of strings to append\n   *   after the main string. 16 - 231, for the colors in the 6 \u00D7 6 \u00D7 6 cube\n   *   defined by 16 + 36 \u00D7 r + 6 \u00D7 g + b (0 \u2264 r, g, b \u2264 5); 232-255:\n   *   grayscale from dark to light in 24 steps.\n   *\n   * @returns {string} The colorized string with ANSI codes applied.\n   *\n   * @example\n   * const coloredString = StringConsole.color('Hello', {\n   *   level: 'info',\n   *   pen: 'bright.foreground'\n   * })\n   * console.log(coloredString)\n   */\n  static color(string, options = {\n    level: undefined,\n    color: undefined,\n    pen: 'foreground',\n    rgb8: undefined,\n    rgb24: [186, 186, 186],\n    styles: [],\n    buffer: [],\n    before: [],\n    after: [],\n  }) {\n    const { colors: Colors, styles: Styles, pens: Pens, levels: Levels } = this\n    let useColors = undefined\n    let useRGB = false\n    let styles = []\n\n    const pens = this.pens.get(options?.pen ?? 'foreground')\n    const [p0, p1] = pens\n\n    if (options?.styles) {\n      if (Array.isArray(options.styles))\n        styles = options.styles\n          .filter(s => Styles.has(s))\n          .map(s => Styles.get(s))\n      else if (typeof options.styles === 'string' && Styles.has(options.styles))\n        styles = Styles.get(options.styles)\n    }\n\n    if (options?.level && Levels.has(options.level)) {\n      useColors = Levels.color(options.level)\n\n      const addlStyles = Levels.styles(options.level)\n      if (addlStyles.length)\n        styles = styles.concat(addlStyles)\n    }\n\n    else if (options?.color && Colors.has(options.color))\n      useColors = Colors.get(options.color)\n\n    else if (options?.rgb24 && Array.isArray(options.rgb24)) {\n      useColors = [`\\x1b[${p0}8;2;${options.rgb24.join(';')};m`, `\\x1b[${p1}9m`]\n      useRGB = true\n    }\n\n    else if (options?.rgb8 && typeof options.rgb8 === 'number' ) {\n      useColors = [`\\x1b[${p0}8;5;${options.rgb8}m`, `\\x1b[${p1}9m`]\n      useRGB = true\n    }\n\n    else useColors = [9,9]\n\n    const [c0, c1] = (useRGB\n      ? useColors\n      : useColors?.map((c,i) => `\\x1b[${pens[i]}${c}m`) ?? [`\\x1b[39;49m`]\n    )\n\n    if (this.hasColor(string)) return string\n    if (typeof string !== 'string') return string\n    if (string instanceof String) (string = String(string))\n    if (!useColors) return string\n\n    if (options?.buffer && !Array.isArray(options.buffer))\n      options.buffer = [String(options.buffer)]\n\n    if (options?.before && !Array.isArray(options.before))\n      options.before = [String(options.before)]\n\n    if (options?.after && !Array.isArray(options.after))\n      options.after = [String(options.after)]\n\n    const buffer = [].concat(options?.buffer ?? [])\n    const before = [].concat(options?.before ?? [])\n    const after = [].concat(options?.after ?? [])\n\n    if (c0)\n      before.push(c0)\n\n    if (c1)\n      after.push(c1)\n\n    for (const style of styles) {\n      if (style?.[0])\n        before.push(style[0])\n\n      if (style?.[1])\n        after.push(style[1])\n    }\n\n    return [...buffer, before.join(''), string, after.join('')].join('')\n  }\n\n  /**\n   * Applies color formatting to each argument based on the specified log level.\n   *\n   * This method processes an array of arguments, applying color formatting\n   * to each one according to the provided log level. The color formatting\n   * is determined by the `color` method, which uses the log level to\n   * select the appropriate color scheme.\n   *\n   * @param {string} level - The log level that determines the color scheme\n   * to be applied. Common levels include 'log', 'info', 'warn', 'error',\n   * etc.\n   * @param {Array} args - An array of arguments to be formatted. Each\n   * argument will be processed individually to apply the color formatting.\n   *\n   * @returns {Array} A new array containing the formatted arguments with\n   * color applied.\n   *\n   * @example\n   * const formattedArgs = StringConsole.colorArgs(\n   *   'info',\n   *   ['Message 1', 'Message 2']\n   * )\n   * // formattedArgs will contain the messages with 'info' level\n   * // color formatting\n   */\n  static colorArgs(level, args) {\n    const newArgs = []\n\n    if (args === null || args === undefined || !Array.isArray(args))\n      return args\n\n    for (const arg of args) {\n      newArgs.push(this.color(arg, { level }))\n    }\n\n    return newArgs\n  }\n\n  /**\n   * Determines if a given string contains ANSI color codes.\n   *\n   * This method checks for the presence of ANSI escape codes in the\n   * provided string, which are used for color formatting in terminal\n   * outputs. The presence of these codes indicates that the string\n   * has color formatting applied.\n   *\n   * @param {string} string - The string to be checked for ANSI color codes.\n   *\n   * @returns {boolean} Returns true if the string contains ANSI color codes,\n   * otherwise false.\n   *\n   * @example\n   * const hasColor = StringConsole.hasColor('\\x1b[31mRed Text\\x1b[0m')\n   * // hasColor will be true\n   *\n   * const noColor = StringConsole.hasColor('Plain Text')\n   * // noColor will be false\n   */\n  static hasColor(string) {\n    return string.includes('\\x1b[')\n  }\n\n  /**\n   * Applies a series of styles to a given string using ANSI escape codes.\n   *\n   * This method takes a string and an array of style names or style arrays,\n   * and applies the corresponding ANSI escape codes to the string. The\n   * styles are defined in the `styles` map, which associates style names\n   * with their respective ANSI codes.\n   *\n   * @param {string} string - The string to which styles will be applied.\n   * @param {string|string[]} styles - A style name or an array of style\n   *   names/arrays to be applied. Each style can be a string that matches\n   *   a key in the `styles` map or an array containing ANSI codes.\n   *\n   * @returns {string} The styled string with ANSI escape codes applied.\n   *\n   * @example\n   * const styledText = StringConsole.style('Hello', ['bold', 'underline'])\n   * // styledText will have 'Hello' with bold and underline styles\n   */\n  static style(string, styles) {\n    const before = []\n    const after = []\n    const buffer = []\n\n    if (typeof styles === 'string' && this.styles.has(styles)) {\n      styles = [styles]\n    }\n\n    for (const style of styles) {\n      let group = []\n\n      if (this.styles.has(style))\n        group = this.styles.get(style)\n\n      else if (Array.isArray(style) && style.length >= 1)\n        group = style\n\n      if (group?.[0])\n        before.push(group?.[0])\n\n      if (group?.[1])\n        after.push(group?.[1])\n    }\n\n    return [before.join(''), string, after.join('')].join('')\n  }\n\n  /* Since this class captures the swaps the process.stdout.write function,\n   * in to and out of place repeatedly, we want to avoid any possible issues\n   * where this conflict could be problematic. To this end, we capture the\n   * global process.stdout.write function as a copy when this class is defined\n   * but before it is used.\n   *\n   * If no other code modifies the `writer` property, this is created as a\n   * non-enumerable alias to the [Symbol.for('process.stdout.write')] symbol\n   * the actual function is stored in.\n   */\n  static {\n    if (hasProcess) {\n      Object.defineProperties(StringConsole, {\n        [Symbol.for('process.stdout.write')]: {\n          value: Object.defineProperties(process.stdout.write, {\n            [Symbol.for('original')]: {value: true, configurable: true },\n            isOriginal: { get() { return true }, configurable: true },\n          }),\n          configurable: true,\n        },\n\n        [Symbol.for('process.stderr.write')]: {\n          value: Object.defineProperties(process.stderr.write, {\n            [Symbol.for('original')]: {value: true, configurable: true },\n            isOriginal: { get() { return true }, configurable: true },\n          }),\n          configurable: true,\n        },\n      })\n\n      if (!Reflect.has(StringConsole, 'writer')) {\n        Object.defineProperties(StringConsole, {\n          writer: {\n            value: StringConsole[Symbol.for('process.stdout.write')],\n            configurable: true,\n          },\n\n          errorWriter: {\n            value: StringConsole[Symbol.for('process.stderr.write')],\n            configurable: true,\n          },\n        })\n      }\n    }\n  }\n}\n\nexport const SC = StringConsole\nexport const StringConsoleExtension = new Extension(StringConsole)\nexport const StdoutGlobalPatches = new Patch(globalThis, {\n  [Patch.kMutablyHidden]: {\n    captureStdout,\n  }\n})\n\nexport default {\n  SC: StringConsole,\n  StringConsole,\n  StringConsoleExtension,\n  StdoutGlobalPatches,\n\n  captureStdout,\n}", "import { Extension } from '@nejs/extension'\nimport { accessor, as, data, isDescriptor, redescribe } from '../utils/index.js'\n\n/**\n * Creates an enumeration object with specified values and properties.\n *\n * @param {string} name - The name of the enumeration.\n * @param {Array|any} values - The values to be included in the enumeration.\n *   If not an array, it will be converted into a single-element array.\n * @param {Object|Map} [properties] - Additional properties to be added to\n *   the enumeration. Can be an object or a Map.\n * @returns {Object} The constructed enumeration object.\n *\n * @deprecated Since 2.20.0 \u2014 use {@link Enumeration} instead.\n *\n * @example\n * const colors = Enum('Colors', ['red', 'green', 'blue'])\n * console.log(colors.red) // EnumValue object for 'red'\n *\n * @description\n * The `Enum` function constructs an enumeration object with a given name,\n * values, and optional properties. It supports primitive types, arrays,\n * and objects as values. The function uses a combination of `Object.create`\n * and `Proxy` to define and manage the properties of the enumeration.\n *\n * The enumeration object includes:\n * - A `toString` method that returns the enumeration name.\n * - A `Symbol.toStringTag` for identifying the object as an 'Enum'.\n * - A `Symbol.for('Enum.name')` for storing the enumeration name.\n *\n * For array values, it creates a maker function that returns an\n * `EnumValue` object with properties like `real`, `value`, `type`,\n * `name`, and `compare`.\n */\nexport function Enum(name, values, properties) {\n  const enumeration = makeBaseEnum(name)\n\n  if (!Array.isArray(values)) {\n    values = [values]\n  }\n\n  /**\n  * A new base `EnumValue` type object. It contains enough custom symbols and\n  * identifiers to allow things like a `compare(to)` function to also work on\n  * each of the elements. Thing of this as the shared base functionality for\n  * each `Enum` element.\n  *\n  * @param {any} enumValue the value around which an `EnumValue` type is\n  * created.\n  * @returns an object defined by {@link Symbol.toStringTag} as well as some\n  * custom {@link Symbol} keys. The `node.js` custom inspect symbol is also\n  * defined for better REPL representation.\n  */\n  const makeEnumValue = (property, enumValue) => ({\n    toString: data(() => enumValue, false, true, false),\n\n    [Symbol.for('Enum.name')]: data(name, false, true, false),\n    [Symbol.for('Enum.is')]: data(true, false, false, false),\n    [Symbol.for('nodejs.util.inspect.custom')]: data(\n      function(depth, options, inspect) {\n        const _options = { ...(options || {}), colors: true }\n        const _skip = this.value === Symbol.for('Enum.NonAssociatedValue')\n        const _value = _skip\n          ? ''\n          : ` { value: ${inspect(this.value, _options) } }`;\n\n        return `${property}${_value}`\n      },\n      false, true, false\n    ),\n    [Symbol.toStringTag]: accessor('EnumValue', false, true, false),\n    [Symbol.for('compare')]: data(\n     function compareValue(to) {\n       const toObj = (to && typeof to === 'object') ? to : { real: to }\n       const kName = Symbol.for('Enum.name')\n\n       const hasAndIs = o =>\n         (Reflect.has(o, Symbol.for('Enum.is')) && o[Symbol.for('Enum.is')]);\n\n       const isLEnum = hasAndIs(this)\n       const isREnum = hasAndIs(toObj)\n\n       if (!isLEnum || !isREnum)\n         return false\n\n       const {real: lReal, value: lValue, name: lName, type: lType} = this\n       const {real: rReal, value: rValue, name: rName, type: rType} = toObj\n\n       return (\n         lName === rName && lType === rType &&\n         lReal === rReal && lValue === rValue\n       )\n    }, false, true, false),\n    [Symbol.toPrimitive]: data(\n     function EnumValueToPrimitive(hint) {\n       const original = this.real\n       const type = typeof original\n\n       switch (hint) {\n         case 'string':\n           if ('string' === type)\n             return original\n           else\n             return String(original)\n\n         case 'number':\n           if ('number' === type)\n             return original\n           else\n             return NaN\n\n         case 'bigint':\n           if ('bigint' === type)\n             return original\n           else\n             return NaN\n\n         default:\n           return original\n       }\n     },\n     false, true, false),\n  })\n\n  /**\n  * Given a value, determine how to represent it as both a key and a response\n  * or underlying original value. The method for this is dependent on the type\n  * of the value itself.\n  *\n  * @param {any} value the value to be converted\n  * @returns {[string, any]} an array where the first value is the transformed\n  * value as a key and the second element is the originally supplied value.\n  */\n  const fromPrimitive = (value) => {\n   let valueType = typeof value\n\n   switch (valueType) {\n     case 'string':\n     case 'number':\n     case 'bigint':\n     case 'boolean':\n     default:\n       return [String(value), value]\n\n     case 'symbol':\n       return [value.description, value]\n\n     case 'function':\n       return [value.name, value]\n\n     case 'object': {\n       const str = asString(value)\n       return [str, str]\n     }\n   }\n  }\n\n  // Determine the keys that the final proxy should be aware of when computing\n  // the enumeration value itself.\n  const kValueProps = ['real', 'value', 'type', 'name', 'compare', 'isEnum']\n  const kCustomPropKeys = []\n\n  // Capture and calculate any custom properties defined for each element\n  // of the enumeration. Each custom property is appended to `kCustomPropKeys`\n  const props = {}\n  if (properties) {\n    if (Array.isArray(properties)) {\n      const entries = properties.filter(e => Array.isArray(e) && e.length === 2)\n\n      if (entries.length)\n        properties = new Map(entries)\n      else\n        properties = new Map()\n    }\n    else if (typeof properties === 'object') {\n      properties = new Map(\n        Object.entries(Object.getOwnPropertyDescriptors(properties)))\n    }\n\n    if (properties instanceof Map) {\n     const applyPropertiesOf = (object, baseDescriptor) => {\n       const property = {\n         configurable: baseDescriptor?.configurable ?? true,\n         enumerable: baseDescriptor?.enumerable ?? true,\n         writable: baseDescriptor?.writable ?? true,\n       }\n\n       const descriptors = Object.getOwnPropertyDescriptors(object)\n       for (const [key, subvalue] of Object.entries(descriptors)) {\n          const stats = isDescriptor(subvalue, true)\n          const baseStats = isDescriptor(baseDescriptor, true)\n\n          if (stats.isAccessor && baseStats.isValid) {\n            props[key] = { ...subvalue, ...accessor.keys.from(baseDescriptor) }\n          }\n          else if (stats.isData && baseStats.isValid) {\n            props[key] = { ...subvalue, ...data.keys.from(baseDescriptor) }\n          }\n       }\n     }\n\n     let stats = {}\n\n     for (const [property, value] of properties.entries()) {\n       kCustomPropKeys.push(property)\n\n       if (isDescriptor(property)) {\n         if (typeof value === 'object') {\n           applyPropertiesOf(value, property)\n           continue\n         }\n       }\n\n       props[property] = value\n     }\n    }\n  }\n\n  for (const value of values) {\n   const valueType = Array.isArray(value) ? 'array' : typeof value\n\n   let property = undefined\n   let response = undefined\n   let wasArray = false\n   let elements = value\n\n   switch (valueType) {\n     case 'array':\n       if (value.length >= 1) {\n         wasArray = true;\n         ([property, response] = fromPrimitive(elements[0]))\n       }\n\n     default:\n       ([property, response] = fromPrimitive(value))\n   }\n\n   const maker = {\n     [property](initialValue) {\n        const storage = new Map()\n        const key = property\n        const realValue = accessor(response, false, { storage, key })\n\n        let _opts, associatedValue;\n\n        if (wasArray) {\n          _opts = { storage, key: key + '.associated' }\n          associatedValue = elements.length === 1\n            ? accessor(initialValue, true, _opts)\n            : accessor(elements?.[1], elements?.[2], _opts);\n        }\n        else\n         associatedValue = accessor(\n           Symbol.for('Enum.NonAssociatedValue'),\n           false, false, false)\n\n        const _prop = Object(asString(response))\n        const valueProps = [...kValueProps, ...kCustomPropKeys]\n        const enumResponse = Object.create(_prop, {\n         ...makeEnumValue(property, response),\n         ...props,\n        })\n\n        const proxy = new Proxy(_prop, {\n         get(target, _property, receiver) {\n           if (_property === 'real')\n             return realValue.get()\n\n           if (_property === 'value')\n             return associatedValue.get()\n\n           if (_property === 'type')\n             return name\n\n           if (_property === 'name')\n             return property\n\n           if (_property === 'compare')\n             return enumResponse[Symbol.for('compare')]\n\n           if (_property === 'isEnum')\n             return true\n\n           if (!valueProps.includes(_property))\n             return undefined\n         },\n         has(target, _property) {\n           return valueProps.includes(_property)\n         },\n         ownKeys(target) {\n           return valueProps\n         },\n         set(target, _property, value, receiver) {\n           if (_property === 'value' && wasArray)\n             return associatedValue.set(value)\n\n           return false\n         }\n        })\n\n        Object.setPrototypeOf(proxy, Object.getPrototypeOf(_prop))\n        Object.setPrototypeOf(enumResponse, proxy)\n\n        return enumResponse\n     }\n   }\n\n   enumeration[Symbol.for('Enum.valueKeys')].push(property)\n\n   const dataValue = wasArray ? maker[property] : maker[property]()\n   const baseProps = {\n     writable: false,\n     configurable: false,\n     enumerable: true,\n   }\n\n   Object.defineProperty(enumeration, property, data(dataValue, baseProps))\n  }\n\n  return enumeration\n}\n\n/**\n * The {@link Extension} that wraps and exposes the {@link Enum} class\n * to the global domain.\n *\n * @deprecated Since 2.20.0 \u2014 use {@link Enumeration} instead.\n * @type {Extension<Enum>}\n */\nexport const EnumExtension = new Extension(Enum)\n\n/**\n * Converts a given value to a string representation with additional\n * options for description and string tag.\n *\n * @param {any} value - The value to be converted to a string. This can\n *   be of any type, including objects, arrays, numbers, etc.\n * @returns {string} A string representation of the input value, enhanced\n *   with a description and string tag if applicable.\n *\n * @example\n * // Convert a number to a string with additional options\n * const result = asString(123)\n * console.log(result) // Outputs: \"123\" with description and string tag\n *\n * @example\n * // Convert an object to a string with additional options\n * const obj = { key: 'value' }\n * const result = asString(obj)\n * console.log(result) // Outputs: \"[object Object]\" with description and\n *                     // string tag\n */\nfunction asString(value) {\n  return as.string(value, { description: true, stringTag: true })\n}\n\n/**\n * Creates a base enumeration object with predefined properties and\n * symbols. This function is used to initialize an enumeration with\n * specific characteristics, such as a name and various symbolic\n * properties that enhance its functionality and identification.\n *\n * @param {string} name - The name of the enumeration. This name is\n *   used to identify the enumeration and is stored as a symbol on\n *   the object.\n * @returns {Object} A new enumeration object with specific properties\n *   and symbols set for enhanced functionality and identification.\n *\n * @deprecated Since 2.20.0 \u2014 use {@link Enumeration} instead.\n *\n * @example\n * // Create a base enum with the name 'Color'\n * const colorEnum = makeBaseEnum('Color')\n * console.log(colorEnum[Symbol.for('Enum.name')]) // Outputs: 'Color'\n */\nexport function makeBaseEnum(name) {\n  return Object.create({}, {\n    /**\n     * Defines the `toStringTag` symbol on each enumeration to allow for\n     * type identification and to be consistent in naming conventions.\n     *\n     * @type {string}\n     */\n    [Symbol.toStringTag]: accessor('Enum', false, true, false),\n\n    /**\n     * In addition to the `toStringTag` symbol which defines this enumeration\n     * as an Enum type, the name of the enum is also codified in as a symbol\n     * on the object. It can be found using `Symbol.for('Enum.name')`.\n     *\n     * @type {string|symbol|number}\n     */\n    [Symbol.for('Enum.name')]: accessor(name, false, true, false),\n\n    /**\n     * Knowing which keys of the enum are part of the keys themselves is also\n     * crucial for enumerations. These can always be found on each Enum type\n     * as `Symbol.for('Enum.valueKeys')` as an array, but can also be found\n     * as the `.keys` property if there is no enum value of that name.\n     */\n    [Symbol.for('Enum.valueKeys')]: data([], false, true, false),\n\n    /**\n     * For users of the node.js REPL, this symbol represents enum types in a\n     * more readily readable format. See the docs for node's `util.inspect()`\n     * function for more details.\n     *\n     * @type {function(number, object, function): string}\n     */\n    [Symbol.for('nodejs.util.inspect.custom')]: data(\n      function(_, __, ___) {\n        const valueKeys = this[Symbol.for('Enum.valueKeys')] ?? []\n\n        let valueText = valueKeys\n          .map(key => `\\x1b[1;2m${key}\\x1b[22m`)\n          .join(', ')\n\n        if (valueText.length)\n          valueText = ` { ${valueText} }`\n\n        return `\\x1b[1menum \\x1b[22m${name}${valueText}`\n      }, false, true, false\n    ),\n\n    /**\n     * This function checks the supplied `possibleEnumValue` to see if it\n     * is an enum value type from this enum.\n     *\n     * @param {any} possibleEnumValue the value to evaluate\n     * @returns {boolean} returns `true` if the value is an enum value type\n     * from this `Enum`, irrespective of any associated value. Returns `false`\n     * otherwise.\n     */\n    isValueOf: data(function isValueOf(possibleEnumValue) {\n      if (!possibleEnumValue || typeof possibleEnumValue !== 'object')\n        return false\n\n      const enumValueType = possibleEnumValue?.type\n      const enumValueName = possibleEnumValue?.name\n\n      const thisEnumName = this[Symbol.for('Enum.name')]\n      const thisEnumKeys = this[Symbol.for('Enum.valueKeys')]\n\n      return (\n        enumValueType === thisEnumName &&\n        thisEnumKeys.includes(enumValueName)\n      )\n    }, false, true, false),\n\n    /**\n     * A simple overload of the `toString()` method to represent the enum\n     * more identifiably when called. The result will be the word enum with\n     * the name of the enum in parenthesis. So a Gender enum might be seen\n     * as `Enum(Gender)` as a result to calling this function.\n     *\n     * @returns {string} a {@link String} representation of this object.\n     */\n    toString: data(function toString() {\n      return `Enum(${name})`\n    }, false, true, false)\n  })\n}\n\n/**\n * Creates a symlink for a property from an existing key to a new key on\n * the specified object. This function checks if the new key already\n * exists on the object and, if not, it creates a new property with the\n * same descriptor as the old key.\n *\n * Since this method creates the new link through the use of property\n * descriptors, computed getters and setters also are mapped properly.\n *\n * @param {Object} on - The target object on which the symlink is to be\n * created.\n * @param {string|symbol} oldKey - The existing key whose property\n * descriptor will be used for the new key.\n * @param {...(string|symbol)} newKeys - The new key under which the property\n * will be accessible.\n *\n * @deprecated Since 2.20.0 \u2014 use {@link Enumeration} instead.\n *\n * @example\n * const obj = { a: 1 }\n * createSymlink(obj, 'a', 'b')\n * console.log(obj.b) // Outputs: 1\n */\nexport function createSymlinks(on, oldKey, ...newKeys) {\n  redescribe(on, oldKey, {}, { alsoAs: newKeys })\n}\n", "/**\n * Tiny internal toolkit to work with types at runtime when dealing\n * with Enumerations.\n *\n * @type {TypeToolbox}\n */\nexport const is = {\n  object(v) { return !!(v && typeof (v) === 'object') },\n  function(v) { return (typeof(v) === 'function') || v instanceof Function },\n  array(v) { return Array.isArray(v) },\n  number(v) { return (typeof(v) === 'number' || v instanceof Number)},\n  objectEntry(v) {\n    return this.array(v) && v.length === 2 && this.objectKey(v[0])\n  },\n  objectKey(v) {\n    const types = ['symbol', 'string', 'number']\n\n    return types.some(type => typeof v === type)\n  },\n}\n\n/**\n * Allows the creation of static, complex, enumeration values\n * that can be used and identified at runtime (as opposed to\n * TypeScript enum values which apply only during compile time).\n *\n * Below is a simple example defining some colors on a `Color`\n * enum. Simple enums are a combination of key and value. In\n * the following case the key is the color name and the value\n * is an object with color channel data (red, green, blue, and\n * alpha channel values from 0 to 255).\n *\n * ```js\n * class Color extends Enumeration {\n *   static {\n *     Color.define('red', {r: 255, g: 0, b: 0, a: 255})\n *     Color.define('green', {r: 0, g:255, b: 0, a: 255})\n *     Color.define('blue', {r: 0, g: 0, b: 255, a: 255})\n *   }\n * }\n *\n * Color.red.value.r === 255 // true\n * Color.red.r === 255 // true; this uses the SubscriptProxy\n *\n * // Grab all four color channels' data in one go. This also\n * // uses the SubscriptProxy for syntactic sugar.\n * const { r, g, b, a } = Color.red\n * ```\n *\n * New types could be defined later with subsequent Color.define()\n * calls. But take the case of customizable color case such as\n * one that is different everytime it is used. Each instance of a\n * child class of an Enumeration has the option to associate values\n * to it.\n *\n * ```js\n * class Color extends Enumeration {\n *   static {\n *     // assume cases from above as well\n *\n *     // define an `rgb` case that assumes associated color\n *     // channel data.\n *     Color.define('rgb', {r: 0, g: 0, b: 0, a: 255})\n *   }\n * }\n *\n * let car = { model: \"Ferrari\", color: Color.red }\n * let horse = {\n *   breed: \"American Saddlebred\",\n *   color: Color.rgb.associate({ r: 200, g: 76, b: 49, a: 255 })\n * }\n * ```\n *\n * This last snippet of code creates a contrived horse object with\n * a chestnut/sorrel colored color. The enum case type for this is\n * still `Color.rgb`, but a rgb cased enum indicates at least three\n * color channels. It's specific values are available through\n * the SubscriptProxy's direct key value access, .r/.g/.b/.a, but\n * is stored not in the value but in the associations object. If we\n * wanted `Color.rgb` to directly surface its associated values, a\n * little more customization would be needed.\n *\n * ```js\n * class Color extends Enumeration {\n *   static {\n *     // assume cases from above as well\n *\n *     // define an `rgb` case that assumes associated color\n *     // channel data.\n *     Color.define('rgb', {r: 0, g: 0, b: 0, a: 255}, {\n *       // always return the associations object instead of the\n *       // value for an unmodified Color enum case.\n *       get value() { return this.associations }\n *     })\n *   }\n * }\n *\n * // Now, you can access it in all three ways.\n * const { r, g, b, a } = horse.color\n * // or\n * const { r, g, b, a } = horse.color.value\n * // or\n * const { r, g, b, a } = horse.color.associations\n * ```\n *\n * When programmers think of enums, they inevitably think of\n * the switch/case construct. This works with Enumeration instances\n * as well. That might look like this.\n *\n * ```js\n * switch (horse.color.key) {\n *   case Color.red.key: ...; break;\n *   case Color.green.key: ...; break;\n *   case Color.blue.key: ...; break;\n * }\n * ```\n *\n * But this is largely because enums in many languages, outside of Swift,\n * are often simple constant keys with values of either the same as their\n * name or incrementing numbers. With Enumeration, each case is a fully\n * fledged instance of the Enumeration type. So we could easily provide\n * methods that work on the aforementioned color channel value object.\n *\n * ```js\n * class Color extends Enumeration {\n *   toHex(includeAlpha = false) {\n *     const { r, g, b, a } = this;\n *     const base = `#` + [r, g, b]\n *       .map(c => c.toString(16).padStart(2, '0')).join('');\n *\n *     if (includeAlpha)\n *       return (base + a.toString(16));\n *\n *     return base;\n *   }\n *\n *   static {\n *     // define cases\n *   }\n * }\n * ```\n *\n * Now there is little need for the switch case. You can simply use it define\n * a hexadecimal color. The case becomes the controller, the value/associations\n * become the model. The case knows how to operate on all types of this class,\n * or in this case all colors. The value or associations object are the model\n * and the methods such as toHex() belong to the controller.\n *\n * Given that we are using normal JavaScript to achieve this, everything is\n * where you would expect it to be; `toHex()` lives on the `Color.prototype`\n * object and all normal JavaScript manipulation works here.\n *\n * ```js\n * console.log(car.color.toHex())  // #ff0000\n * console.log(horse.color.toHex())  // #c84c31\n * ```\n *\n * For more complex use cases you could use the Color.match() function\n *\n * ```js\n * Color.match(horse.color, (color, enumCase, { r, g, b, a }) => {\n *   // horse.color is Color.rgb with associated values\n *   // enumCase is Color.rgb without associated values\n *   // the third parameter is either an empty object or the custom\n *   //   associations object that you can destructure expected content\n *   //   from.\n *\n *   // do something with r, g, b, a if `horse.color` is a Color case type\n * })\n * ```\n */\nexport class Enumeration {\n  /**\n   * The case name for this {@link Enumeration} instance.\n   *\n   * @type {string|symbol}\n   */\n  key;\n\n  /**\n   * The value for this case name, defaults to the same as the\n   * case name unless specifically supplied.\n   *\n   * @type {any}\n   */\n  value;\n\n  /**\n   * For {@link Enumeration} instances that have instance level associated\n   * values. This is uncommon but is modeled after Swift's enums with\n   * associated values. This object is `null` if there are no associations.\n   *\n   * @type {object}\n   */\n  associations;\n\n  /**\n   * Creates a new simple {@link Enumeration} case with a key (case name)\n   * and associated value of any type. If no value is supplied, it will be\n   * set to the value of the key unless `acceptUndefinedValue` is set to\n   * true.\n   *\n   * @param {string|number|symbol} key the case name represented by this\n   * instance of {@link Enumeration}.\n   * @param {any} value any value for this enumeration case. If this is\n   * `undefined` and `acceptUndefinedValue` is set to false (the default)\n   * then the value will be identical to the `key`.\n   * @param {boolean} [acceptUndefinedValue=false] a flag that allows the\n   * rare case of setting a case's value explicitly to `undefined`\n   * @returns {Enumeration} a new {@link Enumeration} value, or instance of\n   * whatever child class has extended `Enumeration`.\n   */\n  constructor(key, value = undefined, acceptUndefinedValue = false) {\n    if (value === undefined && !acceptUndefinedValue) value = key;\n\n    Object.assign(this, { key, value });\n    Object.defineProperty(this, 'associations', {\n      value: null,\n      configurable: true,\n      enumerable: false,\n      writable: true,\n    });\n\n    /**\n     * Enables a subscript proxy on the instances of each {@link Enumeration}\n     * derived instance such that if there is no actual relevant property of\n     * the same name, and the instance has associated values, then it returns\n     * the value of the property of the same name on the associations object\n     * within.\n     *\n     * @example\n     * class Shapes extends Enumeration {\n     *   static {\n     *     Shapes.define('other')\n     *   }\n     * }\n     *\n     * let customShape = Shapes.other.associate({name: 'Dodecahedron'})\n     *\n     * console.log(customShape.name) // \"Dodecahedron\"\n     *\n     * @note if there is an existing property of the same name, such as the\n     * `.key` or `.value`, it is safer to use the {@link Enumeration#associated}\n     * function retrieve the value. You have been warned.\n     */\n    Object.setPrototypeOf(\n      this.constructor.prototype,\n      SubscriptProxy(\n        Object.create(Object.getPrototypeOf(this.constructor.prototype))\n      )\n    );\n\n    return this;\n  }\n\n  /**\n   * Creates a duplicate of this enumeration case, and assigns instance\n   * level associated key/value pairs on the copy. It is still of the\n   * same enum class type, but has instance level associated value.\n   *\n   * @param {...(object|string|number|symbol|[string|number|symbol,any])} entries\n   * a variadic list of objects (whose key/value pairs will be flattened\n   * and added to the associations), a key (string|number|symbol) whose\n   * value will be the same as the key, or an Object entry (i.e. an array with\n   * the first value being the key and the second value being the value).\n   * @returns {*} an instance of this class\n   */\n  associate(...entries) {\n    const associations = { };\n\n    for (const entry of entries) {\n      if (is.objectEntry(entry)) {\n        associations[entry[0]] = entry[1];\n      }\n      else if (is.object(entry)) {\n        Object.assign(associations, entry);\n      }\n      else if (is.objectKey(entry)) {\n        associations[entry] = entry;\n      }\n    }\n\n    if (this.hasAssociatedValues) {\n      Object.assign(this.associations, associations);\n\n      return this;\n    }\n\n    // Create a duplicate of this case instance\n    const variantCase = Object.create(this);\n\n    // Assign the associations object we created\n    variantCase.associations = associations;\n\n    return variantCase;\n  }\n\n  /**\n   * Shorthand for retrieving an internal associated value\n   *\n   * @param {string|number|symbol} key a key into the internal\n   * associations store. Typically, this value is null.\n   * @returns {any|null} null if there is no such named association\n   * or if there are no associations stored on this enum value.\n   */\n  associated(key) {\n    return this.associations?.[key];\n  }\n\n  /**\n   * Returns true if there is an associated value for this enumeration case.\n   *\n   * @returns {boolean} true if associations exist, denoting this is as\n   * a variant case; false otherwise.\n   */\n  get hasAssociatedValues() {\n    return this.associations !== null;\n  }\n\n  /**\n   * Checks to see if this object is, or is loosely, the same as\n   * the supplied `someCase` value. This is determined by comparing\n   * the `.key` property.\n   *\n   * @param {any} someCase some object value that might have a\n   * matching (double equals) key property value\n   * @returns {boolean} true if the objects are loosely equal (==)\n   * or if each of `.key` values are loosely equal (==)\n   */\n  is(someCase) {\n    // noinspection EqualityComparisonWithCoercionJS\n    return this == someCase || this?.key == someCase?.key;\n  }\n\n  /**\n   * Define the string representation of any given {@link Enumeration}\n   * instance to be its `.key` value.\n   *\n   * @returns {string} the value of the `.key` property wrapped in\n   * a call to `String()` to ensure conversion.\n   */\n  toString() {\n    return String(this.key);\n  }\n\n  /**\n   * Returns a combination of the class' name followed by this\n   * instances key value. This can be more explicit than just using\n   * the `.key` property.\n   *\n   * @example\n   * class Shape extends Enumeration {\n   *   static {\n   *     Shape.define('circle')\n   *     Shape.define('square')\n   *   }\n   * }\n   *\n   * console.log(Shape.circle.case) // 'Shape.circle'\n   *\n   * // ['Shape.circle', 'Shape.square']\n   * console.log([...Shape.values()].map(s => s.case))\n   *\n   * @type {string}\n   */\n  get case() {\n    return `${this.constructor.name}.${String(this.key)}`\n  }\n\n  /**\n   * Define the result of a call to {@link #valueOf} to always be\n   * the contents of the `.value` property.\n   *\n   * @returns {any} the contents of the `.value` property\n   */\n  valueOf() {\n    return this.value\n  }\n\n  /**\n   * Returns the `.key` value as a primitive, unless a conversion to\n   * number is requested. In which case, if the `.value` property is\n   * of type {@link Number} then it will be returned. In all other\n   * cases the result will be `String(this.key)`.\n   *\n   * @returns {string|number|NaN} returns a {@link String} representation\n   * of the `.key` property unless a number is requested. See above\n   * for custom logic pertaining to number coercion.\n   */\n  [Symbol.toPrimitive](hint) {\n    switch (hint) {\n      default:\n      case 'string':\n        return String(this.key);\n\n      case 'number':\n        return is.number(this.value)\n          ? this.value\n          : Number(this.key)\n    }\n  }\n\n  /**\n   * Generates a custom tag name that matches this instances class name.\n   *\n   * @example\n   * class Shape extends Enumeration {\n   *   static { Shape.define('circle') }\n   * }\n   *\n   * console.log(Shape.circle[Symbol.toStringTag]) // 'Shape'\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name;\n  }\n\n  /**\n   * Given an instance of a child class of {@link Enumeration}, this code\n   * walks through all valid enum cases for this class. If either present\n   * or missing are functions, they will be invoked and their results will\n   * be what are returned from this match. If they are not functions, then\n   * their direct values will be returned. If they are not supplied, true\n   * is returned if the case is present, false is returned otherwise.\n   *\n   * In the case of present being a function, its signature is expected\n   * to be something like the following. Note that this will be awaited\n   * before returning its result.\n   *\n   * ```js\n   * async present(instance, baseCase, associations) => Promise<any>\n   * ```\n   * where\n   *  * **instance** is the instance of the enum supplied\n   *  * **baseCase** is the instance of the enum matching `instance`\n   *  * **associations** is either an empty object when there are no custom\n   *    associations, or the associations object itself.\n   *\n   * and missing simply receives the instance passed to `asyncMatch()`,\n   * but if missing is an async function, its call will be awaited before\n   * returning a result.\n   *\n   * ```js\n   * async missing(instance) => Promise<any>\n   * ```\n   * where\n   *  * **instance** is the instance of the enum supplied\n   *\n   * Some examples:\n   * ```js\n   * Color.match(Color.red) // returns true\n   * Color.match(Color.red, (_,__,{r}) => r) // returns 255\n   * Color.match(null) // returns false\n   * Color.match(null, (_,__,{r}) => r, () => 0) // returns 0\n   * Color.match(null, 'red', 'missing') // returns 'missing'\n   *\n   * Color.match(horse.color) // returns true\n   * Color.match(horse.color, instance => instance.toHex()) // '#c84c31'\n   * ```\n   *\n   * @param {Enumeration} instance an instance of any {@link Enumeration}\n   * derived class. With or without associated values.\n   * @param {\n   *   (function(Enumeration,Enumeration,object): Promise<any>|any|undefined)\n   * } present an async function that computes a value or a variable value to\n   * return if the `instance` is one of the known {@link Enumeration} cases\n   * for this subclass. Defaults to `true` if not supplied\n   * @param {function(Enumeration): Promise<any>} missing an async function\n   * that computes a value or a variable value to return if the `instance` is\n   * not one of the known cases for this subclass. Defaults to `false` if not\n   * supplied.\n   * @returns {any} the result of either `present`, or `missing`, using the\n   * default values of `true` and `false`, respectively, should they not be\n   * supplied. The outcome is determined by the existence of the supplied\n   * `instance` object being a known case for this enum subclass.\n   */\n  static async asyncMatch(instance, present, missing) {\n    const resolvePresent = async (caseValue) => {\n      if (is.function(present)) {\n        const associations = instance?.associations\n          ?? (is.object(instance?.value) ? instance.value : {});\n        return present(instance, caseValue, associations);\n      }\n\n      else\n        return present ?? true;\n    }\n\n    const resolveMissing = async () => {\n      if (is.function(missing))\n        return await missing(instance);\n      else\n        return missing ?? false;\n    }\n\n    if (!is.object(instance) || !(instance instanceof this))\n      return await resolveMissing();\n\n    for (const [_, caseValue] of this) {\n      if (instance.key === caseValue.key)\n        return await resolvePresent(caseValue);\n    }\n\n    return await resolveMissing();\n  }\n\n  /**\n   * Static variant of {@link Enumeration#is} that takes a left and\n   * right hand value, then checks to see if both objects are, or are\n   * loosely, the same as each other's `.key` value.\n   *\n   * @param {any} leftCase some object value that might have a\n   * matching (double equals) key property value\n   * @param {any} rightCase some object value that might have a\n   * matching (double equals) key property value\n   * @returns {boolean} true if the objects are loosely equal (==)\n   * or if each of `.key` values are loosely equal (==)\n   */\n  static is(leftCase, rightCase) {\n    // noinspection EqualityComparisonWithCoercionJS\n    return leftCase == rightCase || leftCase?.key == rightCase?.key;\n  }\n\n  /**\n   * Used when creating a static instance of {@link Enumeration}. Generally\n   * this is done as follows:\n   *\n   * @example\n   * class Shape extends Enumeration {\n   *   static {\n   *     Shape.define('cylinder')\n   *     Shape.define('cube')\n   *     Shade.define('other')\n   *   }\n   * }\n   *\n   * @param {string|number|symbol} key the case name of the this particular\n   * enumeration instance.\n   * @param {any|[string|number|symbol, any]} value the value of the newly\n   * defined {@link Enumeration} instance.\n   * @param {function|object} [customizeInstance=undefined] defaults to\n   * `undefined`, but when it is passed in as a function, the signature\n   * would be to take an instance of this Enumeration class and return\n   * one (presumably after modification), or in the form of an object whose\n   * property descriptors are copied onto the defined instance. This later\n   * approach retains getter and setter application as well as other rare\n   * descriptor modifications.\n   * @returns {*} an instance of this {@link Enumeration} class type.\n   */\n  static define(key, value = undefined, customizeInstance = undefined) {\n    if (!is.objectKey(key)) {\n      throw new TypeError(\n        'Enumeration.define() must have a string/number/symbol key'\n      );\n    }\n\n    let caseName = key;\n    let caseValue = value ?? key;\n\n    if (is.objectEntry(value)) {\n      caseName = value[0];\n      caseValue = value[1];\n    }\n\n    let instance = new this(caseName, caseValue);\n\n    if (customizeInstance instanceof Function) {\n      const newInstance = customizeInstance(instance);\n\n      if (newInstance instanceof this)\n        instance = newInstance;\n    }\n    else if (is.object(customizeInstance)) {\n      const descriptors = Object.getOwnPropertyDescriptors(customizeInstance)\n\n      Object.defineProperties(instance, descriptors)\n    }\n\n    Object.defineProperty(this, key, {\n      get() {\n        return instance;\n      },\n      configurable: true,\n      enumerable: true,\n    });\n  }\n\n  /**\n   * Creates an iterator of all {@link Enumeration} derived instances that\n   * are statically assigned to this class. Generally this is only useful\n   * if applied to child class of `Enumeration`.\n   *\n   * @returns {Generator<string, void, *>} an iterator that walks instances\n   * of derived {@link Enumeration} classes and returns their `.key` values\n   */\n  static *cases() {\n    for (let [key, _] of this) yield key;\n  }\n\n  /**\n   * Given an instance of a child class of {@link Enumeration}, this code\n   * walks through all valid enum cases for this class. If either present\n   * or missing are functions, they will be invoked and their results will\n   * be what are returned from this match. If they are not functions, then\n   * their direct values will be returned. If they are not supplied, true\n   * is returned if the case is present, false is returned otherwise.\n   *\n   * In the case of present being a function, its signature is expected\n   * to be something like the following:\n   *\n   * ```js\n   * present(instance, baseCase, associations) => any\n   * ```\n   * where\n   *  * **instance** is the instance of the enum supplied\n   *  * **baseCase** is the instance of the enum matching `instance`\n   *  * **associations** is either an empty object when there are no custom\n   *    associations, or the associations object itself.\n   *\n   * and missing simply receives the instance passed to `match()` as its\n   * only parameter.\n   *\n   * ```js\n   * missing(instance) => any\n   * ```\n   * where\n   *  * **instance** is the instance of the enum supplied\n   *\n   * Some examples:\n   * ```js\n   * Color.match(Color.red) // returns true\n   * Color.match(Color.red, (_,__,{r}) => r) // returns 255\n   * Color.match(null) // returns false\n   * Color.match(null, (_,__,{r}) => r, () => 0) // returns 0\n   * Color.match(null, 'red', 'missing') // returns 'missing'\n   *\n   * Color.match(horse.color) // returns true\n   * Color.match(horse.color, instance => instance.toHex()) // '#c84c31'\n   * ```\n   * @param {Enumeration} instance an instance of any {@link Enumeration}\n   * derived class. With or without associated values.\n   * @param {\n   *   (function(Enumeration,Enumeration,object): any|any|undefined)\n   * } present a function that computes a value or a variable value to\n   * return if the `instance` is one of the known {@link Enumeration} cases\n   * for this subclass. Defaults to `true` if not supplied\n   * @param {function(Enumeration): any} missing a function\n   * that computes a value or a variable value to return if the `instance` is\n   * not one of the known cases for this subclass. Defaults to `false` if not\n   * supplied.\n   * @returns {any} the result of either `present`, or `missing`, using the\n   * default values of `true` and `false`, respectively, should they not be\n   * supplied. The outcome is determined by the existence of the supplied\n   * `instance` object being a known case for this enum subclass.    */\n  static match(instance, present, missing) {\n    const resolvePresent = (caseValue) => {\n      if (is.function(present)) {\n        const associations = instance?.associations\n          ?? (is.object(instance?.value) ? instance.value : {});\n        return present(instance, caseValue, associations);\n      }\n\n      else\n        return present ?? true;\n    }\n\n    const resolveMissing = () => {\n      return is.function(missing) ? missing(instance) : (missing ?? false);\n    }\n\n    if (!is.object(instance) || !(instance instanceof this))\n      return resolveMissing();\n\n    for (const [_, caseValue] of this) {\n      if (instance.key === caseValue.key)\n        return resolvePresent(caseValue);\n    }\n\n    return resolveMissing();\n  }\n\n  /**\n   * Creates an iterator of all {@link Enumeration} derived instances that\n   * are statically assigned to this class. Generally this is only useful\n   * if applied to child class of `Enumeration`.\n   *\n   * @returns {Generator<string, void, *>} an iterator that walks instances\n   * of derived {@link Enumeration} classes and returns their `.value` values\n   */\n  static *values() {\n    for (let [_, value] of this) yield value;\n  }\n\n  /**\n   * Creates an iterator of all {@link Enumeration} derived instances that\n   * are statically assigned to this class. Generally this is only useful\n   * if applied to child class of `Enumeration`.\n   *\n   * @returns {Generator<*, void, *>} an iterator that walks instances\n   * of derived {@link Enumeration} classes and returns each key/value pair\n   * as arrays. **This is the same as `Object.entries(ChildEnumerationClass)`\n   * and then filter the results for pairs whose values are instances of\n   * `ChildEnumerationClass`**\n   */\n  static *[Symbol.iterator]() {\n    const keys = Object.keys(this);\n\n    for (const key of keys) {\n      const value = this[key];\n\n      if (value instanceof this) yield [key, value];\n    }\n  }\n}\n\n/**\n * Creates a prototype safe {@link Proxy} object, specific to\n * {@link Enumeration} instances, that if a getter tries to reach a named\n * property that doesn't exist on the enum, **and** `.hasAssociatedValues`\n * is `true`, then it will attempt to return `this.associations[property]`\n * instead.\n *\n * @param {object} proxied the object to the behavior to; typically this is\n * the prototype of the class itself. See the constructor in Enumeration for\n * usage.\n * @returns {*|null|object} a {@link Proxy} instance around the supplied\n * object to be proxied with the above defined behavior.\n */\nexport function SubscriptProxy(proxied) {\n  const has = (object, property) => Reflect.has(object, property)\n\n  return new Proxy(proxied, {\n    get(target, property, receiver) {\n      // First, if our target does not have a property with the\n      // requested, check, in order, the following:\n      //   1. The instance's associations object.\n      //   2. The instance's value, if it's an object.\n      if (!Reflect.has(target, property)) {\n        // If the associations object has a property of a given name\n        // return it first\n        if (has((receiver?.associations ?? {}),property))\n          return receiver.associated(property);\n\n        // If we are still here and the value is an object and it has\n        // a property with the supplied name, return it.\n        if (is.object(receiver.value) && has(receiver.value, property))\n          return receiver.value[property];\n      }\n\n      // If we failed above or in all other cases, provide\n      // the default experience for handling property access\n      return Reflect.get(target, property, receiver);\n    },\n\n    set(target, property, newValue, receiver) {\n      if (\n        !Reflect.has(target, property) &&\n        receiver.hasAssociatedValues &&\n        Reflect.has(receiver.associations, property)\n      ) {\n        receiver.associations[property] = newValue\n        return true\n      }\n\n      return Reflect.set(target, property, newValue, receiver);\n    },\n  });\n}\n\nexport default Enumeration\n\n/**\n * @typedef {object} TypeToolbox\n *\n * @property {function(any): boolean} object a function that takes any value\n * and returns a boolean value if the object is of type `'object'` and not null\n * @property {function(any): boolean} function a function that takes any value\n * and returns true if is of type `'function'` or is an `instanceof`\n * {@link Function}.\n * @property {function(any): boolean} array a pass-thru to the\n * {@link Array#isArray} function.\n * @property {function(any): boolean} number a function that takes any value\n * and returns `true` if the value is a number, and `false` otherwise.\n * @property {function(any): boolean} objectEntry a function that takes any\n * value and returns true if the object is a 2 element array where the first\n * parameter is one of a string, symbol, or number type. The second parameter\n * can be of any type. If these criteria are not met, false is returned.\n * @property {function(any): boolean} objectKey a function that takes any value\n * and returns true if it is of type symbol, string, or number. Any other type\n * results in a false return value.\n */\n", "import { Extension } from '@nejs/extension'\nimport { Enumeration } from '@nejs/enumeration'\n\n/**\n * A {@link Extension} instance wrapping the capable {@link Enumeration}\n * class allowing for reuse and shipping the code through this repository.\n *\n * @type {Extension}\n */\nexport const EnumerationExtension = new Extension(Enumeration)\n\n/**\n * Provide a named export for {@link Enumeration}.\n */\nexport { Enumeration }\n\n/**\n * Make the default export be the {@link Enumeration} class.\n */\nexport default Enumeration\n", "import { Extension } from '@nejs/extension'\n\nexport class Introspector {\n  static addExpansion(array) {\n    const toEntriesFrom = (owner = globalThis) => {\n      return (accumulator, key) => {\n        const count = accumulator.length;\n\n        try {\n          const value = owner[key]\n          accumulator.splice(count, 0, [key, value], [value, key])\n        }\n        catch (error) { accumulator.splice(count, 0, [key, error]) }\n\n        return accumulator\n      }\n    }\n\n    return Object.defineProperty(array, 'expand', {\n      get() {\n        return new Map(\n          this.reduce(toEntriesFrom(globalThis), [])\n        )\n      },\n      configurable: true,\n      enumerable: true,\n    })\n  }\n\n  static accessors(owner = globalThis, keys = []) {\n    const entries = []\n\n    for (const key of keys) {\n      try {\n        const metadata = this.metadata(owner, key)\n        if (metadata.get || metadata.set) {\n          entries.push([key, metadata])\n        }\n        continue\n      }\n      catch (error) {\n        entries.push([key, error])\n      }\n    }\n\n    return new Map(entries)\n  }\n\n  static classes(owner = globalThis) {\n    return this.fetcher(\n      'function', /^[A-Z]/, Object, 'getOwnPropertyNames', owner\n    )\n  }\n\n  static functions(owner = globalThis) {\n    return this.fetcher(\n      'function', /^[a-z]/, Object, 'getOwnPropertyNames', owner\n    )\n  }\n\n  static objects(owner = globalThis) {\n    return this.fetcher('object', null, Object, 'getOwnPropertyNames', owner)\n  }\n\n  static properties(owner = globalThis) {\n    return this.fetcher(\n      (v,t,d) => t !== 'object' && t !== 'function',\n      null, Object, 'getOwnPropertyNames', owner\n    )\n  }\n\n  static symbols(owner = globalThis) {\n    return this.addExpansion(Object.getOwnPropertySymbols(owner))\n  }\n\n  static metadata(owner, key) {\n    const metadata = {\n      owner, key,\n      descriptor: undefined,\n      value: undefined,\n      get type() { return typeof this.value },\n    }\n\n    try { metadata.descriptor = Object.getOwnPropertyDescriptor(owner, key) }\n    catch(error) { metadata.descriptor = error }\n\n    try {\n      metadata.value = (\n        metadata.descriptor?.value ??\n        metadata.descriptor?.get?.bind(owner)?.() ??\n        owner[key]\n      )\n    }\n    catch(error) { metadata.value = error }\n\n    return metadata\n  }\n\n  static fetcher(\n    typeNameOrTyperFn,\n    regExp = undefined,\n    searchClass = Object,\n    searchFunction = 'getOwnPropertyNames',\n    owner = globalThis\n  ) {\n    let typer = typeNameOrTyperFn\n\n    if (typeof typeNameOrTyperFn !== 'function') {\n      const type = String(typeNameOrTyperFn)\n      typer = (function(value, typeName, descriptor) {\n        return typeName === type\n      }).bind(this)\n    }\n\n    return this.addExpansion(\n      searchClass[searchFunction](owner).filter(key => {\n        const metadata = this.metadata(owner, key)\n        return (\n          (!regExp || regExp.exec(String(key))) &&\n          typer(metadata.value, metadata.type, metadata.descriptor)\n        )\n      }).toSorted()\n    )\n  }\n\n  static makeReport(owner = globalThis) {\n    let names = [\n      'classes', 'functions', 'objects', 'properties', 'symbols', 'accessors'\n    ];\n    let bound = names.reduce(\n      (a,n) => { a[n] = this[n].bind(this); return a },\n      {}\n    )\n    const { classes, functions, objects, properties, symbols, accessors } = bound\n    const result = { }\n\n    Object.assign(result, {\n      accessors: {\n        classes: undefined,\n        functions: undefined,\n        objects: undefined,\n        properties: undefined,\n        symbols: undefined,\n      },\n      classes: this[classes.name](),\n      functions: this[functions.name](),\n      objects: this[objects.name](),\n      properties: this[properties.name](),\n      symbols: this[symbols.name](),\n      expandAll() {\n        names.forEach(reportName => {\n          result[reportName] = result?.[reportName]?.expand\n        })\n      },\n    })\n\n    (names.forEach(type => {\n        debugger\n        result.accessors[type] = accessors(globalThis, result[type])\n      })\n    )\n\n    return result\n  }\n}\n\nexport const IntrospectorExtensions = new Extension(Introspector);", "import { Extension } from '@nejs/extension'\n\n/**\n * The Iterable class is designed to provide a convenient way to create synchronous\n * iterable objects. It can be initialized with either an array or individual elements.\n * This class implements the iterable protocol, allowing instances to be used with\n * `for...of` loops and other standard JavaScript iteration mechanisms.\n */\nexport class Iterable {\n  /**\n   * Private field to store the elements of the iterable.\n   * @private\n   */\n  #elements = [];\n\n  /**\n   * Constructs an instance of Iterable. It can be initialized with either an\n   * iterable object (such as an array, Set, Map, string, or any object\n   * implementing the iterable protocol) or individual elements. If the first\n   * argument is an iterable, the class instance is initialized with the\n   * elements from the iterable, followed by any additional arguments. If the\n   * first argument is not an iterable, all arguments are treated as individual\n   * elements.\n   *\n   * @param {Iterable|*} elementsOrFirstElement - An iterable object or the\n   * first element.\n   * @param {...*} moreElements - Additional elements if the first argument is\n   * not an iterable.\n   */\n  constructor(elementsOrFirstElement, ...moreElements) {\n    if (\n      elementsOrFirstElement != null &&\n      typeof elementsOrFirstElement[Symbol.iterator] === 'function'\n    ) {\n      this.#elements = [...elementsOrFirstElement, ...moreElements];\n    } else {\n      this.#elements = [elementsOrFirstElement, ...moreElements];\n    }\n  }\n\n  /**\n   * Implements the iterable protocol. When an instance of Iterable is used\n   * in a `for...of` loop or spread syntax, this generator function is invoked\n   * to yield the elements one by one in a synchronous manner.\n   *\n   * @returns {Generator} A generator that yields each element of the iterable.\n   */\n  *[Symbol.iterator]() {\n    for (const element of this.#elements) {\n      yield element;\n    }\n  }\n\n  /**\n   * Provides access to the elements as a standard array. Useful for scenarios\n   * where array methods and behaviors are needed.\n   *\n   * @returns {Array} An array containing all the elements of the iterable.\n   */\n  get asArray() {\n    return this.#elements;\n  }\n\n  /**\n   * Ensures that the constructor of this object instance's name\n   * is returned if the string tag for this instance is queried\n   *\n   * @returns {string} the name of the class\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * Checks if a given value is an iterable. This method determines if the\n   * provided value has a `Symbol.iterator` property that is a generator\n   * function. It's a precise way to identify if the value conforms to the\n   * iterable protocol using a generator function.\n   *\n   * Note: This method specifically checks for generator functions. Some\n   * iterables might use regular functions that return an iterator, which\n   * this method won't identify.\n   *\n   * @param {*} value - The value to be checked for iterability.\n   * @returns {boolean} - Returns true if the value is an iterable implemented\n   * using a generator function, false otherwise.\n   */\n  static isIterable(value) {\n    const type = Object.prototype.toString.call(value?.[Symbol.iterator]);\n    return type === '[object GeneratorFunction]';\n  }\n}\n\n/**\n * Being able to create a compliant `Iterator` around any type of iterable\n * object. This can be wrapped around any type of object that has a\n * `[Symbol.iterator]` property assigned to a generator function.\n */\nexport class Iterator {\n  /**\n   * A private function that when provided has the following signature:\n   * `function mapEach(entry) -> entry`. This allows any changes to be made\n   * to each element, conditionally and programmatically, as needed before\n   * they are returned to the called code.\n   */\n  #mapEach = undefined\n\n  /**\n   * Creates a new `Iterator` object instance.\n   *\n   * @param {object} iterable any object that has a `[Symbol.iterator]`\n   * property assigned to a generator function.\n   * @param {function} mapEach when provided `mapEach` is a callback that\n   * takes an entry as input and receives one as output.\n   */\n  constructor(iterable, mapEach) {\n    if (!iterable || !Reflect.has(iterable, Symbol.iterator)) {\n      throw new TypeError(\n        'Value used to instantiate Iterator is not iterable'\n      );\n    }\n\n    this.#iterable = iterable;\n    this.#iterator = iterable[Symbol.iterator]();\n    this.#mapEach = typeof mapEach === 'function' ? mapEach : undefined\n  }\n\n  /**\n   * Returns a new `Array` derived from the iterable this object\n   * wraps.\n   *\n   * @returns {array} a new `Array` generated from the wrapped\n   * iterable. The method is generated from `Array.from()`\n   */\n  get asArray() {\n    return Array.from(this.#iterable)\n  }\n\n  /**\n   * Returns the actual iterable object passed to the constructor that\n   * created this instance.\n   *\n   * @returns {object} the object containing the `[Symbol.iterator]`\n   */\n  get iterable() {\n    return this.#iterable\n  }\n\n  /**\n   * The function retrieves the next value in the iterator. If the\n   * the iterator has run its course, `reset()` can be invoked to\n   * reset the pointer to the beginning of the iteration.\n   *\n   * @returns {any} the next value\n   */\n  next() {\n    const input = this.#iterator.next();\n    let output = input\n\n    if (output.done) {\n      return { value: undefined, done: true };\n    }\n    else {\n      if (this.#mapEach && typeof this.#mapEach === 'function') {\n        output.value = this.#mapEach(input.value)\n      }\n\n      return { value: output.value, done: false };\n    }\n  }\n\n  /**\n   * Resets the iterator to the beginning allowing it to be\n   * iterated over again.\n   */\n  reset() {\n    this.#iterator = this.#iterable[Symbol.iterator]();\n  }\n\n  /**\n   * The existence of this symbol on the object instances, indicates that\n   * it can be used in `for(.. of ..)` loops and its values can be\n   * extracted from calls to `Array.from()`\n   *\n   * @returns {Iterator} this is returned since this object is already\n   * conforming to the expected JavaScript Iterator interface\n   */\n  [Symbol.iterator]() {\n    return this;\n  }\n\n  /**\n   * Ensures that the constructor of this object instance's name\n   * is returned if the string tag for this instance is queried\n   *\n   * @returns {string} the name of the class\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * The object from which its iterator functionality is derived.\n   *\n   * @type {object}\n   * @private\n   */\n  #iterable = null;\n\n  /**\n   * The results of a call to the iterable's `[Symbol.iterator]`\n   * generator function.\n   *\n   * @type {object}\n   * @private\n   */\n  #iterator = null;\n\n  /**\n   * Creates an Iterator for the keys of the given object.\n   *\n   * @note alternatives to keyFetcher might be `Reflect.ownKeys` or even\n   * `Object.keys`. Each type of fetcher has their own requirements but\n   * any function that takes an object and returns keys will suffice.\n   *\n   * @param {Object} object - The object whose keys will be iterated.\n   * @param {Function} [mapEach] - Optional function to map each key.\n   * @param {Function} [keyFetcher=Object.getOwnPropertyNames] - Function to\n   * fetch keys from the object. Defaults to Object.getOwnPropertyNames.\n   * @returns {Iterator} An Iterator instance containing the object's keys.\n   */\n  static keys(object, mapEach, keyFetcher) {\n    keyFetcher ??= Object.getOwnPropertyNames;\n\n    const keys = keyFetcher(object);\n    return new Iterator(keys, mapEach);\n  }\n\n  /**\n   * Creates an Iterator for the entries of the given object.\n   *\n   * @note alternatives to keyFetcher might be `Reflect.ownKeys` or even\n   * `Object.keys`. Each type of fetcher has their own requirements but\n   * any function that takes an object and returns keys will suffice.\n   *\n   * @param {Object} object - The object whose entries will be iterated.\n   * @param {Function} [mapEach] - Optional function to map each entry.\n   * @param {Function} [keyFetcher=Object.getOwnPropertyNames] - Function to\n   * fetch keys from the object. Defaults to Object.getOwnPropertyNames.\n   * @returns {Iterator} An Iterator instance containing the object's entries.\n   */\n  static entries(object, mapEach, keyFetcher) {\n    keyFetcher ??= Object.getOwnPropertyNames;\n\n    const keys = keyFetcher(object);\n    const entries = [];\n\n    for (const key of keys) {\n      entries.push([key, object[key]]);\n    }\n\n    return new Iterator(entries, mapEach)\n  }\n\n  /**\n   * Creates an Iterator for the property descriptors of the given object.\n   *\n   * @note alternatives to keyFetcher might be `Reflect.ownKeys` or even\n   * `Object.keys`. Each type of fetcher has their own requirements but\n   * any function that takes an object and returns keys will suffice.\n   *\n   * @param {Object} object - The object whose descriptors will be iterated.\n   * @param {Function} [mapEach] - Optional function to map each descriptor\n   * entry.\n   * @param {Function} [keyFetcher=Object.getOwnPropertyNames] - Function to\n   * fetch keys from the object. Defaults to Object.getOwnPropertyNames.\n   * @returns {Iterator} An Iterator instance containing entries of [key,\n   * descriptor] pairs.\n   */\n  static descriptors(object, mapEach, keyFetcher) {\n    keyFetcher ??= Object.getOwnPropertyNames;\n\n    const keys = keyFetcher(object);\n    const entries = [];\n\n    for (const key of keys) {\n      entries.push([key, Object.getOwnPropertyDescriptor(object, key)])\n    }\n\n    return new Iterator(entries, mapEach);\n  }\n}\n\nexport const IterableExtensions = new Extension(Iterable)\nexport const IteratorExtensions = new Extension(Iterator)", "import { Extension } from '@nejs/extension'\n\nexport class ParamParser {\n  /**\n   * Constructs an instance of ParamParser. It takes in parameters, an optional\n   * validator function, and an optional parser function. The parameters are\n   * validated and if successful, parsed.\n   *\n   * @param {any[]} parameters - Arguments passed in by the process.\n   * @param {((any[]) => boolean)?} [validator=() => {}] - An optional function\n   * to specify a validator without subclassing ParamParser. It should return\n   * a boolean indicating the validity of the parameters.\n   * @param {((any[]) => object)?} [parser=() => {}] - An optional function to\n   * specify a parser without subclassing ParamParser. It should return an\n   * object after parsing the input parameters.\n   *\n   * @example\n   * const parameters = ['param1', 'param2']\n   * const validator = params => params.every(param => typeof param === 'string')\n   * const parser = params => ({ params })\n   * const paramParser = new ParamParser(parameters, validator, parser)\n   * if (paramParser.success) {\n   *   console.log('Parsing successful:', paramParser.results)\n   * } else {\n   *   console.error('Parsing failed.')\n   * }\n   */\n  constructor(parameters, validator = () => {}, parser = () => {}) {\n    this.args = parameters\n    this.parser = parser\n    this.validator = validator\n    this.result = undefined\n    this.success = this.validate(this.args)\n\n    if (this.success) {\n      this.results = this.parse(this.args)\n    }\n  }\n\n  /**\n   * @param {object} args arguments that were previously validated\n   * by either the overloaded validate() method or the supplied\n   * validator closure.\n   * @returns {object} returns the output object, or an empty\n   * object, after parsing the input arguments or parameters.\n   */\n  parse(args) {\n    return this.parser?.(args);\n  }\n\n  /**\n   * Walk the arguments and determine if the supplied input is\n   * a valid parsing.\n   *\n   * @param {any[]} args arguments supplied by the process.\n   * @returns {boolean} `true` if the validation is successful,\n   * `false` otherwise.\n   */\n  validate(args) {\n    return this.validator?.(args);\n  }\n\n  /**\n   * Attempts to parse the given parameters using the provided parsers, throwing an\n   * error if no valid parser is found. This method serves as a convenience wrapper\n   * around `safeTryParsers`, enforcing strict parsing by automatically enabling\n   * error throwing on failure.\n   *\n   * @param {any[]} parameters - The parameters to be parsed.\n   * @param {Function[]} parsers - An array of `ParamParser` subclasses to attempt\n   * parsing with.\n   * @returns {Object} An object containing the parsing result, with a `success`\n   * property indicating if parsing was successful, and a `data` property containing\n   * the parsed data if successful.\n   * @example\n   * const parameters = ['param1', 'param2'];\n   * const parsers = [Parser1, Parser2];\n   * const result = ParamParser.tryParsers(parameters, parsers);\n   * if (result.success) {\n   *   console.log('Parsing successful:', result.data);\n   * } else {\n   *   console.error('Parsing failed.');\n   * }\n   */\n  static tryParsers(parameters, parsers) {\n    return this.safeTryParsers(parameters, parsers, true)\n  }\n\n  /**\n   * Tries parsing `parameters` with each parser in `parsers`. If\n   * `throwOnFail` is true, throws an error when validation fails or\n   * no valid parser is found.\n   *\n   * This method attempts to parse the given parameters using the\n   * provided list of parsers. It validates the input to ensure both\n   * `parameters` and `parsers` are arrays and that `parsers`\n   * contains at least one valid `ParamParser` subclass. If\n   * `throwOnFail` is set to true, it will throw specific errors for\n   * invalid inputs or when no parser succeeds. Otherwise, it returns\n   * an object indicating the success status and the result of\n   * parsing, if successful.\n   *\n   * @param {any[]} parameters - The parameters to be parsed.\n   * @param {Function[]} parsers - An array of `ParamParser`\n   * subclasses to attempt parsing with.\n   * @param {boolean} [throwOnFail=false] - Whether to throw an\n   * error on failure.\n   * @returns {{success: boolean, data: any}} An object with a\n   * `success` flag and `data` containing the parsing result, if\n   * successful.\n   * @throws {ParametersMustBeArrayError} If `parameters` or\n   * `parsers` are not arrays when `throwOnFail` is true.\n   * @throws {ParsersArrayMustContainParsersError} If `parsers`\n   * does not contain at least one valid `ParamParser` subclass\n   * when `throwOnFail` is true.\n   * @throws {NoValidParsersFound} If no valid parser is found\n   * and `throwOnFail` is true.\n   * @example\n   * const parameters = ['param1', 'param2'];\n   * const parsers = [Parser1, Parser2];\n   * const result = ParamParser.safeTryParsers(\n   *   parameters, parsers, true\n   * );\n   *\n   * if (result.success) {\n   *   console.log('Parsing successful:', result.data);\n   * } else {\n   *   console.error('Parsing failed.');\n   * }\n   */\n  static safeTryParsers(parameters, parsers, throwOnFail = false) {\n    if (!Array.isArray(parameters) || !Array.isArray(parsers)) {\n      if (throwOnFail) {\n        throw new this.ParametersMustBeArrayError(\n          `${this.name}.tryParsers must receive two arrays as args`\n        );\n      }\n    }\n\n    if (!parsers.some(parser => parser?.prototype instanceof ParamParser &&\n                                typeof parser === 'function')) {\n      if (throwOnFail) {\n        throw new this.ParsersArrayMustContainParsersError(\n          `${this.name}.tryParsers parsers argument must contain at least one ` +\n          `ParamParser derived class`\n        );\n      }\n    }\n\n    let success = false;\n    let result = undefined;\n\n    for (let Parser of parsers) {\n      const parser = new Parser(parameters);\n      if (parser.success) {\n        success = true;\n        result = parser.result;\n        break;\n      }\n    }\n\n    if (!success && throwOnFail) {\n      throw new this.NoValidParsersFound('No valid parsers found');\n    }\n\n    return { success, data: result };\n  }\n\n  /**\n   * A custom error class that signifies no valid parsers were found\n   * during the parsing process. This error is thrown when all\n   * parsers fail to parse the given parameters and the `throwOnFail`\n   * flag is set to true in the `safeTryParsers` method.\n   *\n   * @returns {Function} A class extending Error, representing a\n   * specific error when no valid parsers are found.ound.\n   *\n   * @example\n   * try {\n   *   const result = ParamParser.safeTryParsers(\n   *     parameters, parsers, true\n   *   );\n   * } catch (error) {\n   *   if (error instanceof ParamParser.NoValidParsersFound) {\n   *     console.error(\n   *       'No valid parsers could process the parameters.'\n   *     );\n   *   }\n   * }\n   */\n  static get NoValidParsersFound() {\n    return class NoValidParsersFound extends Error { }\n  }\n\n  /**\n   * Represents an error thrown when the parameters provided to a method\n   * are not in an array format as expected. This class extends the\n   * native JavaScript `Error` class, allowing for instances of this\n   * error to be thrown and caught using standard error handling\n   * mechanisms in JavaScript.\n   *\n   * This error is specifically used in scenarios where a method\n   * expects its arguments to be provided as an array, and the\n   * validation of those arguments fails because they were not\n   * provided in an array format. It serves as a clear indicator\n   * of the nature of the error to developers, enabling them to\n   * quickly identify and rectify the issue in their code.\n   *\n   * @example\n   * try {\n   *   ParamParser.safeTryParsers(nonArrayParameters, parsers, true);\n   * } catch (error) {\n   *   if (error instanceof ParamParser.ParametersMustBeArrayError) {\n   *     console.error('Parameters must be provided as an array.');\n   *   }\n   * }\n   */\n  static get ParametersMustBeArrayError() {\n    return class ParametersMustBeArrayError extends Error { }\n  }\n\n  /**\n   * A custom error class indicating that the parsers array does not\n   * contain valid parser functions. This error is thrown when the\n   * validation of parsers within `ParamParser.safeTryParsers` fails\n   * to find any instance that is a subclass of `ParamParser`. It\n   * extends the native JavaScript `Error` class, allowing it to be\n   * thrown and caught using standard error handling mechanisms.\n   *\n   * This error serves as a clear indicator to developers that the\n   * provided array of parsers does not meet the expected criteria,\n   * specifically that it must contain at least one valid parser\n   * that extends `ParamParser`. This ensures that the parsing\n   * process can be executed with at least one valid parser function.\n   *\n   * @example\n   * try {\n   *   ParamParser.safeTryParsers(parameters, [], true);\n   * } catch (error) {\n   *   const { ParsersArrayMustContainParsersError } = ParamParser\n   *   if (error instanceof ParsersArrayMustContainParsersError) {\n   *     console.error(\n   *       'The parsers array must contain at least one valid parser.'\n   *     );\n   *   }\n   * }\n   */\n  static get ParsersArrayMustContainParsersError() {\n    return class ParsersArrayMustContainParsersError extends Error { }\n  }\n}\n\nexport const ParamParserExtensions = new Extension(ParamParser);", "import { Extension } from '@nejs/extension'\n\nconst { toStringTag, hasInstance } = Symbol\n\nexport class ProxyHandlerResponse {\n  constructor(success = false, value = undefined, context = undefined) {\n    Object.assign(this, { succes, value, context })\n  }\n\n  /**\n   * A getter method for the toStringTag symbol.\n   * This method returns the name of the constructor of the instance.\n   * It is used to provide a custom string description of the object,\n   * which can be useful for debugging or logging purposes.\n   *\n   * @example\n   * const response = new ProxyHandlerResponse();\n   * console.log(response[Symbol.toStringTag]); // logs: \"ProxyHandlerResponse\"\n   *\n   * @returns {string} The name of the constructor of the instance.\n   */\n  get [toStringTag]() { return this.constructor.name }\n\n  /**\n   * This static method is a Symbol.hasInstance method implementation.\n   * It checks if the provided instance is an instance of the class.\n   * It does this by comparing the instance's toStringTag or constructor\n   * to the class's name or the class itself respectively.\n   *\n   * @param {Object} instance - The instance to check.\n   * @returns {boolean} True if the instance is of the class, false otherwise.\n   *\n   * @example\n   * // Assuming MyClass has implemented this method\n   * const myInstance = new MyClass();\n   * // logs: true\n   * console.log(MyClass[Symbol.hasInstance](myInstance));\n   */\n  static [hasInstance](instance) {\n    return (\n      instance?.[toStringTag] === this.name ||\n      instance?.constructor === this\n    )\n  }\n}\n\nexport class ProxyHandler {\n  constructor(handler, type = ProxyHandler.type.get) {\n    this.handler = handler;\n    this.typeName = Array.isArray(type)\n      ? ProxyHandler.nameFromType(type) ?? 'get'\n      : String(type)\n    this.type = Array.isArray(type) ? type : ProxyHandler.type[type ?? 'get'];\n  }\n\n  invoke(...args) {\n    const context = {\n      defaultValue: Reflect[this.typeName](...args),\n      proxyHandler: this,\n      typeHandler: this.handler,\n    }\n\n    try {\n      const result = this.handler.apply(context, args)\n\n      if (!(result?.[Symbol.toStringTag] === ProxyHandler.ResponseType)) {\n        return ProxyHandler.response(!!result, result, context)\n      }\n\n      result.context = context\n\n      return result\n    }\n    catch (error) {\n      return ProxyHandler.response(false, error)\n    }\n  }\n\n  /**\n   * This static method is used to create a response object. The response\n   * object contains the success status, the value, and the context of the\n   * response. It also includes a getter for the Symbol.toStringTag property\n   * that returns the ResponseType of the ProxyHandler.\n   *\n   * @param {boolean} success - The success status of the response.\n   * @param {*} value - The value of the response.\n   * @param {Object} context - The context of the response.\n   * @returns {Object} The response object.\n   *\n   * @example\n   * // Create a response object\n   * const response = ProxyHandler.response(\n   *   true, 'value', { key: 'context' }\n   * );\n   *\n   * // Output: { success: true, value: 'value', context: { key: 'context' },\n   * //           [Symbol.toStringTag]: 'ProxyHandlerResponse' }\n   * console.log(response);\n   */\n  static response(success, value, context) {\n    return {\n      success, value, context,\n      get [Symbol.toStringTag]() { return this.ResponseType }\n    }\n  }\n\n  /**\n   * This static getter method is used to retrieve the response type\n   * of the ProxyHandler. It returns a string that represents the\n   * response type of the ProxyHandler.\n   *\n   * @property {function} ResponseType - A static getter method that\n   * returns the response type of the ProxyHandler.\n   * @returns {string} A string representing the response type of the\n   * ProxyHandler.\n   *\n   * @example\n   * // Get the response type of the ProxyHandler\n   * const responseType = ProxyHandler.ResponseType;\n   *\n   * // Output: 'ProxyHandlerResponse'\n   * console.log(responseType);\n   */\n  static get ResponseType() { return 'ProxyHandlerResponse' }\n\n  /**\n   * This static method is used to retrieve the name of a ProxyHandler type\n   * from a given array of arguments. If the array of arguments matches any\n   * of the ProxyHandler types, the name of that type is returned. If no\n   * match is found, or if the input is not an array, 'custom' is returned.\n   *\n   * @param {Array.<*>} proxyHandlerType - An array of arguments to match\n   * against the ProxyHandler types.\n   * @returns {string} The name of the matching ProxyHandler type, or 'custom'\n   * if no match is found.\n   *\n   * @example\n   * // Get the name of a type from its arguments\n   * const typeName = ProxyHandler.nameFromType(\n   *   ['target', 'thisArg', 'argumentsList']\n   * );\n   *\n   * // Output: 'apply'\n   * console.log(typeName);\n   *\n   * @throws {TypeError} If ProxyHandler.type is undefined.\n   */\n  static nameFromType(proxyHandlerType) {\n    if (!Array.isArray(proxyHandlerType)) {\n      return 'custom'\n    }\n\n    const names = Object.entries(ProxyHandler.type)\n    for (const [name, args] of names) {\n      if (proxyHandlerType.every(element => ~args.indexOf(element))) {\n        return name\n      }\n    }\n\n    return 'custom'\n  }\n\n  /**\n   * This method is used to retrieve all the types of ProxyHandler available\n   * in the ProxyHandler.type object. It is useful when you need to iterate\n   * over all the types or when you need to check if a certain type exists.\n   *\n   * @property {function} typeNames - A static getter method that returns an\n   * array of keys from the ProxyHandler.type object.\n   * @returns {Array.<string>} An array of strings representing the keys of\n   * the ProxyHandler.type object.\n   *\n   * @example\n   * // Get all type names\n   * const types = ProxyHandler.typeNames;\n   *\n   * // Output: ['apply', 'construct', 'defineProperty', ...]\n   * console.log(types);\n   *\n   * @throws {TypeError} If ProxyHandler.type is undefined.\n   */\n  static get typeNames() {\n    return Object.keys(ProxyHandler.type)\n  }\n\n  /**\n   * A static getter method that returns an object containing keyed proxy\n   * trap types and their associated expected arguments list by name. A\n   * docstring description complete with url shortening links for each entry\n   * are provided (links go to the MDN documentation)\n   *\n   * @property {function} type - A static getter method that returns an object\n   * of ProxyHandler types.\n   * @returns {Object.<string, function>} An object where each key is a type\n   * name and each value is a function that returns an array of strings\n   * representing the arguments for that type.\n   *\n   * @example\n   * // Get the 'apply' type\n   * const applyType = ProxyHandler.type.apply;\n   *\n   * // Output: ['target', 'thisArg', 'argumentsList']\n   * console.log(applyType());\n   *\n   * @throws {TypeError} If ProxyHandler.type is undefined.\n   */\n  static get type() {\n    return {\n      /**\n       * The handler.apply() method is a trap for the [[Call]] object internal\n       * method, which is used by operations such as function calls.\n       * MDN link: https://t.ly/orBsG\n       */\n      get apply() { return ['target', 'thisArg', 'argumentsList'] },\n\n      /**\n       * The handler.construct() method is a trap for the [[Construct]] object\n       * internal method, which is used by operations such as the new operator.\n       * In order for the new operation to be valid on the resulting Proxy\n       * object, the target used to initialize the proxy must itself be a\n       * valid constructor.\n       * MDN link: https://t.ly/1LukS\n       */\n      get construct() { return ['target', 'args'] },\n\n      /**\n       * The handler.defineProperty() method is a trap for the\n       * [[DefineOwnProperty]] object internal method, which is used by\n       * operations such as Object.defineProperty().\n       * MDN link: https://t.ly/3Ml9y\n       */\n      get defineProperty() { return ['target', 'key', 'descriptor'] },\n\n      /**\n       * The handler.deleteProperty() method is a trap for the [[Delete]]\n       * object internal method, which is used by operations such as the\n       * delete operator.\n       * MDN link: https://t.ly/neu2H\n       */\n      get deleteProperty() { return ['target', 'property'] },\n\n      /**\n       * The handler.get() method is a trap for the [[Get]] object internal\n       * method, which is used by operations such as property accessors.\n       * MDN link: https://t.ly/E419x\n       */\n      get get() { return ['target', 'property', 'receiver'] },\n\n      /**\n       * The handler.getOwnPropertyDescriptor() method is a trap for the\n       * [[GetOwnProperty]] object internal method, which is used by operations\n       * such as Object.getOwnPropertyDescriptor().\n       * MDN link: https://t.ly/wzPTX\n       */\n      get getOwnPropertyDescriptor() { return ['target', 'property'] },\n\n      /**\n       * The handler.getPrototypeOf() method is a trap for the\n       * [[GetPrototypeOf]] object internal method, which is used by operations\n       * such as Object.getPrototypeOf().\n       * MDN link: https://t.ly/Ww4S1\n       */\n      get getPrototypeOf() { return ['target'] },\n\n      /**\n       * The handler.has() method is a trap for the [[HasProperty]] object\n       * internal method, which is used by operations such as the in operator.\n       * MDN link: https://t.ly/UcJL-\n       */\n      get has() { return ['target', 'prototype'] },\n\n      /**\n       * The handler.isExtensible() method is a trap for the [[IsExtensible]]\n       * object internal method, which is used by operations such as\n       * Object.isExtensible().\n       * MDN link: https://t.ly/MkdIK\n       */\n      get isExtensible() { return ['target'] },\n\n      /**\n       * The handler.ownKeys() method is a trap for the [[OwnPropertyKeys]]\n       * object internal method, which is used by operations such as\n       * Object.keys(), Reflect.ownKeys(), etc.\n       * MDN link: https://t.ly/QkiTI\n       */\n      get ownKeys() { return ['target'] },\n\n      /**\n       * The handler.preventExtensions() method is a trap for the\n       * [[PreventExtensions]] object internal method, which is used by\n       * operations such as Object.preventExtensions().\n       * MDN link: https://t.ly/nvfjJ\n       */\n      get preventExtensions() { return ['target'] },\n\n      /**\n       * The handler.set() method is a trap for the [[Set]] object internal\n       * method, which is used by operations such as using property accessors\n       * to set a property's value.\n       * MDN link: https://t.ly/FDWcl\n       */\n      get set() { return ['target', 'property', 'value', 'receiver'] },\n\n      /**\n       * The handler.setPrototypeOf() method is a trap for the\n       * [[SetPrototypeOf]] object internal method, which is used by operations\n       * such as Object.setPrototypeOf().\n       * MDN link: https://t.ly/pS8ej\n       */\n      get setPrototypeOf() { return ['target', 'prototype'] },\n    }\n  }\n}\n\nexport class PluggableProxy {\n  constructor(Class, handlers, options = {\n    prototype: undefined, // undefined means extract from class\n    apply: true,\n  }) {\n    const validHandlers = handlers.filter(h => h instanceof ProxyHandler)\n\n    Object.assign(this, {\n      class: Class instanceof Function ? Class : Class.constructor,\n      instance: Class instanceof Function ? null : Class,\n    })\n\n    this.handlers = new Map()\n\n    for (let typeName of ProxyHandler.typeNames) {\n      const handlersOfType = [].concat(\n        validHandlers.filter(h => h.typeName === typeName)\n      )\n\n      this.handlers.set(typeName, handlersOfType)\n    }\n\n    this[PluggableProxy.kOriginal] = (\n      options?.prototype ?? Object.getPrototypeOf(this.class)\n    )\n\n    this[PluggableProxy.kCreated] = Object.create(\n      this[PluggableProxy.kOriginal],\n      this.instance,\n    )\n\n    this[PluggableProxy.kProxy] = new Proxy(this[PluggableProxy.kCreated], this)\n\n    if (options?.apply != true) {\n      const target = this?.instance ?? this.class\n      Object.setPrototypeOf(target, this[PluggableProxy.kCreated])\n    }\n  }\n\n  handlersOfType(typeName) {\n    return this.handlers.get(typeName)\n  }\n\n  tryEachOfType(type, ...args) {\n    const types = ProxyHandler.typeNames\n    const failures = []\n\n    for (const handler of types) {\n      const result = handler.invoke(...args)\n      if (result.success) {\n        return [result, failures]\n      }\n      failures.push(result)\n    }\n\n    return [undefined, failures]\n  }\n\n  apply(target, thisArg, argumentsList) {\n    const type = 'apply', args = [target, thisArg, argumentsList]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  construct(target, args) {\n    const type = 'construct', _args = [target, args]\n    const [result, _fails] = tryEachOfType(type, ..._args)\n    if (result) { return result }\n    return Reflect[type](..._args)\n  }\n\n  defineProperty(target, key, descriptor) {\n    const type = 'defineProperty', args = [target, key, descriptor]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  deleteProperty(target, property) {\n    const type = 'deleteProperty', args = [target, property]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  get(target, property, receiver) {\n    const type = 'get', args = [target, property, receiver]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  getOwnPropertyDescriptor(target, property) {\n    const type = 'getOwnPropertyDescriptor', args = [target, property]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  getPrototypeOf(target) {\n    const type = 'getPrototypeOf', args = [target]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  has(target, property) {\n    const type = 'has', args = [target, property]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  isExtensible(target) {\n    const type = 'isExtensible', args = [target]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  ownKeys(target) {\n    const type = 'ownKeys', args = [target]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  preventExtensions(target) {\n    const type = 'preventExtensions', args = [target]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  set(target, property, value, receiver) {\n    const type = 'set', args = [target, property, value, receiver]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  setPrototypeOf(target, prototype) {\n    const type = 'setPrototypeOf', args = [target, prototype]\n    const [result, _fails] = tryEachOfType(type, ...args)\n    if (result) { return result }\n    return Reflect[type](...args)\n  }\n\n  static get kCreated() {\n    return Symbol.for('pp.prototype.created')\n  }\n\n  static get kOriginal() {\n    return Symbol.for('pp.prototype.original')\n  }\n\n  static get kProxy() {\n    return Symbol.for('pp.proxy')\n  }\n}\n\nexport const ProxyHandlerExtensions = new Extension(ProxyHandler)\nexport const PluggableProxyExtensions = new Extension(PluggableProxy)\n\n\nexport const PluggableProxyExtensionSet = new Extension.ExtensionSet(\n  'PluggableProxyExtensionSet',\n  ProxyHandlerExtensions,\n  PluggableProxyExtensions\n)", "import { Patch } from '@nejs/extension'\n\nexport const WeakRefExtensions = new Patch(WeakRef, {\n  /**\n   * A static method to check if a given value is a valid target for a WeakRef.\n   *\n   * @param {*} value - The value to check for validity as a WeakRef target.\n   * @returns {boolean} - True if the value is a valid WeakRef target,\n   * false otherwise.\n   */\n  isValidReference(value) {\n    return !(\n      (typeof value === 'symbol' && Symbol.keyFor(value) === undefined) ||\n      (typeof value !== 'object' && typeof value !== 'symbol') ||\n      (value === null || value === undefined)\n    )\n  },\n})", "import { Extension } from '@nejs/extension'\n\nimport { ObjectExtensions } from '../object.extensions.js'\nimport { SymbolExtensions } from '../symbol.extensions.js'\nimport { WeakRefExtensions } from '../weakref.extensions.js'\n\nimport { Iterable, Iterator } from './iterable.js'\n\nconst { isObject, isNullDefined, isValidKey } = ObjectExtensions.patches\nconst { isRegistered } = SymbolExtensions.patches\nconst { isValidReference } = WeakRefExtensions.patches\n\n/**\n * RefMap class extends the standard Map object to manage a collection of\n * WeakRef values mapped to strong keys. It provides additional functionality\n * such as objectification of values and various utility methods.\n *\n * Unlike standard Maps or Objects, RefMap stores weak references to objects,\n * allowing them to be garbage-collected if there are no other references to\n * them. This behavior is different from Maps and standard Objects, which\n * maintain strong references to their elements.\n *\n * @extends Map\n */\nexport class RefMap extends Map {\n  /**\n   * Private field to track whether the RefMap should objectify primitive\n   * values.\n   *\n   * @private\n   */\n  #objectifyValues = false\n\n  constructor(...args) {\n    super(...args)\n  }\n\n  /**\n   * Method to control whether the RefMap should objectify its values. When\n   * objectifying, primitive values (number, string, boolean, bigint) are\n   * converted to their respective object types, which allows them to be used as\n   * WeakRef targets.\n   *\n   * @param {boolean} setObjectification - Flag to enable or disable\n   * objectification.\n   * @returns {RefMap} - The current RefMap instance to allow method chaining.\n   */\n  objectifying(setObjectification = true) {\n    this.objectifyValues = setObjectification\n    return this\n  }\n\n  /**\n   * The function converts a JavaScript Map object into a regular JavaScript\n   * object, handling invalid keys by converting them to strings.\n   *\n   * @returns {object} an object; keys that are not either a `String` or a\n   * `Symbol` will be converted to a string.\n   */\n  asObject() {\n    const object = {}\n\n    for (const [key, value] of this) {\n      const useKey = isValidKey(key) ? key : String(key)\n      const useValue = value?.valueOf() || value\n\n      object[useKey] = useValue\n    }\n\n    return object\n  }\n\n  /**\n   * Returns the state indicating whether or not `RefMap` will attempt to\n   * convert non-valid primitives into targets that are valid input for\n   * new `WeakRef` object instances. If this value is `false` then no\n   * *objectification* will occur.\n   *\n   * @returns {boolean} The current state of objectifyValues.\n   */\n  get objectifyValues() {\n    return this.#objectifyValues\n  }\n\n\n  /**\n   * The `get` function retrieves a value from a map and returns it, or returns a\n   * default value if the value is null or undefined. The actual retrieved value\n   * is a dereferenced `WeakRef`. If the result is `undefined` and this is not the\n   * expected response, it is likely the value has been garbage collected.\n   *\n   * @param {any} key - The key parameter is the key of the value you want to\n   * retrieve from the data structure.\n   * @param {any} defaultValue - The `defaultValue` parameter is the value that\n   * will be returned if the key does not exist in the map or if the value\n   * associated with the key has been garbage collected (i.e., it no longer\n   * exists).\n   * @returns The method is returning the value associated with the given key.\n   * If the value is not found or if it has been garbage collected (deref()\n   * returns null), then the defaultValue is returned.\n   */\n  get(key, defaultValue) {\n    const value = super.get(key)\n\n    if (!value || !value?.deref()) {\n      return defaultValue\n    }\n\n    return value?.deref()\n  }\n\n  /**\n   * Setting this value to true, will cause all set values to the Map to\n   * be analyzed for validity as a candidate to be wrapped in a `WeakRef`\n   * object. If true, and if possible, the object will be turned into an\n   * `Object` variant first.\n   *\n   * @param {boolean} value - The new state to set for objectifyValues.\n   */\n  set objectifyValues(value) {\n    this.#objectifyValues = !!value\n  }\n\n  /**\n   * Overrides the set method of `Map`. Adds a value to the `RefMap`,\n   * converting it to a `WeakRef`. Throws an error if the value is not a\n   * valid `WeakRef` target (e.g., `null`, `undefined`, or a registered\n   * `symbol`). If {@link objectifyValues} is enabled, an attempt to convert\n   * primitives to their object variants will be made. These are `numbers`,\n   * `strings`, `boolean` values and `bigint`s.\n   *\n   * @param {*} key - The `key` to be set on the `RefMap`\n   * @param {*} value - The value to be associated with the `key`\n   * @throws {TypeError} If the value is not a valid WeakRef target.\n   */\n  set(key, value) {\n    let useValue = value\n\n    // Objectify the value if needed\n    if (this.#objectifyValues && (\n      typeof useValue === 'number' ||\n      typeof useValue === 'string' ||\n      typeof useValue === 'boolean' ||\n      typeof useValue === 'bigint'\n    )) {\n      useValue = Object(useValue);\n    }\n\n    // Check if the value is an object, and if it's a symbol, ensure it's not registered\n    if (typeof useValue === 'symbol' && Symbol.keyFor(useValue) !== undefined) {\n      throw new TypeError('RefMap cannot accept registered symbols as values');\n    }\n\n    if (typeof useValue !== 'object' && typeof useValue !== 'symbol') {\n      throw new TypeError(\n        'RefMap values must be objects, non-registered symbols, or objectified primitives'\n      );\n    }\n\n    // If the value is null or undefined, throw an error\n    if (useValue === null || useValue === undefined) {\n      throw new TypeError('RefMap values cannot be null or undefined');\n    }\n\n    const ref = new WeakRef(useValue)\n\n    super.set(key, ref)\n  }\n\n  /**\n   * Sets multiple values at a single time. The format is an array of array\n   * or rather an array of {@link Object.entries} (for example,\n   * `[[key1,value1], [key2,value2]]`). For each entry pair, if the length\n   * is not 2, either missing a key or value, it will be skipped.\n   *\n   * @param {Iterable} values - An iterable of values to add to the RefMap.\n   * @throws {TypeError} If the supplied values are falsey or non-iterable.\n   * @returns {RepMap} returns `this` to allow for chaining\n   */\n  setAll(entries) {\n    if (!Iterable.isIterable(entries)) {\n      throw new TypeError(\n        'The supplied list of entries must be an array of arrays in the ' +\n        'format [[key1, value1], [key2, value2], ...].'\n      )\n    }\n\n    const forEach = entry => {\n      const [key, value] = entry\n\n      if (!key || !isObject(value) || !isRegistered(value)) {\n        return\n      }\n\n      this.set(key, value)\n    }\n\n    for (const entry of entries) {\n      forEach(entry)\n    }\n\n    return this\n  }\n\n  /**\n   * Removes all elements from the RefMap that have been garbage collected\n   * (i.e., their WeakRef no longer points to an object).\n   *\n   * @returns {RefMap} - The current RefMap instance to allow method chaining.\n   */\n  clean() {\n    for (const [key, dereferenced] of this) {\n      if (!dereferenced) {\n        this.delete(key)\n      }\n    }\n\n    return this\n  }\n\n  /**\n   * Executes a provided function once for each value in the RefMap. The callback\n   * function receives the dereferenced value, the value again (as RefMap doesn't\n   * use keys), and the RefMap itself. This method provides a way to iterate over\n   * and apply operations to the values stored in the RefMap, taking into account\n   * that they are weak references and may have been garbage-collected.\n   *\n   * @param {Function} forEachFn - Function to execute for each element. It\n   * takes three arguments: element, element (again, as RefMap has no key), and\n   * the RefMap itself.\n   * @param {*} thisArg - Value to use as `this` when executing `forEachFn`.\n   */\n  entries() {\n    const entriesIterator = super.entries()\n    const refIterator = new Iterator(entriesIterator, (entry) => {\n      if (entry) {\n        const [key, ref] = entry\n        const value = ref?.deref()\n\n        return [key, value]\n      }\n\n      return entry\n    })\n\n    return refIterator\n  }\n\n  /**\n   * Iterate over the items in the map and pass them to the supplied\n   * function ala `Map.prototype.forEach`. Note however, there are no\n   * indexes on Maps and as such, the index parameter of the callback\n   * will always be the value's key. Subsequently the `array` or third\n   * parameter will receive the map instance rather than an array.\n   *\n   * @param {function} forEachFn the function to use for each element in\n   * the set.\n   * @param {object} thisArg the `this` argument to be applied to each\n   * invocation of the `forEachFn` callback. Note, this value is unable\n   * to be applied if the `forEachFn` is a big arrow function\n   */\n  forEach(forEachFn, thisArg) {\n    for (const [key, ref] of super.entries()) {\n      const value = ref?.deref()\n\n      if (!value) {\n        continue\n      }\n\n      forEachFn.call(thisArg, value, key, this)\n    }\n  }\n\n  /**\n   * Returns an iterator for the values in the RefMap. Each value is\n   * dereferenced from its WeakRef before being returned. This method allows\n   * iterating over he set's values, similar to how one would iterate over\n   * values in a standard Map or Array, but with the understanding that the\n   * values are weakly referenced and may no longer exist (in which case\n   * they are skipped).\n   *\n   * @returns {Iterator} An iterator for the values.\n   */\n  values() {\n    return new Iterator(super.values(), function perItem(value) {\n      const dereferenced = value?.deref()\n      return dereferenced || value\n    })\n  }\n\n  /**\n   * Determines whether an element with the specified value exists in the\n   * `RefMap`. For non-objectified sets, this method checks if the dereferenced\n   * values of the map include the specified value.\n   *\n   * For objectified sets, strict is set to false which uses loose\n   * equality to allow for things like `Object(5)` to equal `5`. This is important\n   * because otherwise primitives could not be weakly referenced. In the grand\n   * scheme of things, this is only useful if the objectified value is the\n   * one being referenced.\n   *\n   * @param {*} value - The value to check for presence in the RefMap.\n   * @param {boolean} strict - if `true`, the default, then the supplied value\n   * is hard compared to the dereferenced value (`===`). If `false`, then a\n   * loose comparison is used (`==`)\n   * @returns {boolean} - True if an element with the specified value exists\n   * in the RefMap, false otherwise.\n   */\n  hasValue(value, strict = true) {\n    if (isNullDefined(value)) {\n      return false\n    }\n\n    if (this.#objectifyValues) {\n      strict = false\n    }\n\n    for (const [_, dereferenced] of this) {\n      if (\n        (strict && value === dereferenced) ||\n        (!strict && value == dereferenced)\n      ) {\n        return true\n      }\n    }\n\n    return false\n  }\n\n  /**\n   * The `filter` function filters the entries of a `RefMap` object based on\n   * a given filter function. The dereferenced entries of the values of the map\n   * will be passed to the function rather than a `WeakRef` itself.\n   *\n   * A new resulting entry set will be generated and a new `RefMap` will be made\n   * from these entries and returned. Note that this function never returns\n   * `null`\n   *\n   * @param {function} filterFn - The `filterFn` parameter is a function that\n   * will be used to filter the entries in the `RefMap`. It will be called with\n   * three arguments: the value of the current entry, the key of the current\n   * entry, and the `RefMap` itself. The function should return `true`\n   * @param {object} thisArg - The `thisArg` parameter is an optional argument\n   * that specifies the value to be used as `this` when executing the\n   * `filterFn` function. It allows you to explicitly set the context in which\n   * the `filterFn` function is called. If `thisArg` is not provided, `this\n   * @returns {array} The `filter` method is returning an array of filtered map\n   * entries\n   */\n  filter(filterFn, thisArg) {\n    const resultingEntries = []\n\n    for (const [key, dereferenced] of this) {\n      if (filterFn.call(thisArg, dereferenced, key, this)) {\n        resultingEntries.push([key, dereferenced])\n      }\n    }\n\n    return resultingEntries\n  }\n\n  /**\n   * The `find` function iterates over a map and calls a given function on\n   * each value, returning the first value for which the function returns\n   * a truthy value.\n   *\n   * The function signature of `findFn` is\n   * ```\n   * function findFn(value, key, map)\n   * ```\n   * 'value' is passed to findFn up to two times; first with the `WeakRef`\n   * value, second with the result of {@link WeakRef.deref}. If `findFn`\n   * returns true for either of these the dereferenced value will be\n   * returned from the call to {@link RefMap.find}.\n   * `key` represents the key object that the value is mapped to.\n   * `map` is simply a reference to `this` map.\n   *\n   * @param findFn - `findFn` is a function that will be called for each\n   * element in the map. It takes three arguments: `ref`, `key`, and `map`;\n   * where `ref` is the value of the current element in the map, `key` is\n   * the key of the current element, and `map` is a reference to the instance\n   * being searched.\n   * @param thisArg - The `thisArg` parameter is the value to be used as\n   * the `this` value when executing the `findFn` function. It allows you\n   * to specify the context in which the `findFn` function should be called.\n   * @returns the first dereferenced value that satisfies the condition\n   * specified by the `findFn` function. If no value satisfies the condition,\n   * it returns `null`.\n   */\n  find(findFn, thisArg) {\n    for (const [key, dereferenced] of this) {\n      const ref = super.get(key)\n      let result = findFn.call(thisArg, ref, key, map)\n\n      if (!result) {\n        result = findFn.call(thisArg, dereferenced, key, map)\n      }\n\n      if (result) {\n        return dereferenced\n      }\n    }\n\n    return null\n  }\n\n  /**\n   * Creates a new array or `RefMap` with the results of calling a provided\n   * function on every element in the calling `RefMap`. This method dereferences\n   * each value, applies the `mapFn`, and collects the results. If `toRefMap` is\n   * `true`, a new `RefMap` is returned; otherwise, an array. This method\n   * differs from `Array.map` in handling weak references and the potential to\n   * return a new `RefMap` instead of an array.\n   *\n   * @param {Function} mapFn - Function that produces an element of the new\n   * array or `RefMap`, taking three arguments.\n   * @param {*} thisArg - Value to use as this when executing mapFn.\n   * @param {boolean} toRefMap - Determines if the output should be a new\n   * `RefMap` (`true`) or an array (`false`).\n   * @param {boolean} mirrorObjectification - If `true` and `toRefMap` is\n   * `true`, the new `RefMap` mirrors the objectification setting of the\n   * original.\n   * @returns {Array|RefMap} - A new array or `RefMap` with each element being\n   * the result of the `mapFn`.\n   */\n  map(mapFn, thisArg, toRefMap, mirrorObjectification) {\n    if (typeof mapFn !== 'function') {\n      throw new TypeError('mapFn must be a function! Received', mapFn)\n    }\n\n    const entries = []\n    const errors = []\n\n    let needsObjectification = mirrorObjectification && this.objectifyValues\n    let detectNeed = mirrorObjectification === undefined\n    let objectify = needsObjectification\n\n    for (const [key, dereferenced] of this) {\n      const [, VALUE] = [0,1]\n      const transformed = mapFn.call(thisArg, [key, dereferenced], key, this)\n\n      if (!isValidReference(transformed[VALUE])) {\n        if (isValidReference(Object(transformed[VALUE]))) {\n          needsObjectification = true\n          if (detectNeed && !objectify) {\n            objectify = true\n            transformed[VALUE] = Object(transformed[VALUE])\n          }\n        }\n      }\n\n      entries.push(transformed)\n    }\n\n    if (toRefMap) {\n      return new RefMap(entries).objectifying(objectify)\n    }\n\n    return entries\n  }\n\n  /**\n   * The function returns an iterator that iterates over the entries of an object,\n   * dereferencing any weak references.\n   *\n   * @returns {Iterator} A new iterator object is being returned.\n   */\n  *[Symbol.iterator]() {\n    for (const [key, ref] of this.entries()) {\n      yield [key, ref]\n    }\n  }\n\n  /**\n   * Ensures that the constructor of this object instance's name\n   * is returned if the string tag for this instance is queried\n   *\n   * @returns {string} the name of the class\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n}\n\nexport const RefMapExtensions = new Extension(RefMap)", "import { Extension } from '@nejs/extension'\n\n/**\n * RefSet class extends the standard Set object to manage a collection of\n * WeakRef objects. It provides additional functionality such as objectification\n * of values and various utility methods.\n *\n * Unlike standard Sets or Arrays, RefSet stores weak references to objects,\n * allowing them to be garbage-collected if there are no other references to\n * them. This behavior is different from Arrays and standard Sets, which\n * maintain strong references to their elements.\n *\n * @extends Set\n */\nexport class RefSet extends Set {\n  /**\n   * Private field to track whether the RefSet should objectify primitive\n   * values.\n   *\n   * @private\n   */\n  #objectifyValues = false\n\n  /**\n   * Method to control whether the RefSet should objectify its values. When\n   * objectifying, primitive values (number, string, boolean, bigint) are\n   * converted to their respective object types, which allows them to be used as\n   * WeakRef targets.\n   *\n   * @param {boolean} setObjectification - Flag to enable or disable\n   * objectification.\n   * @returns {RefSet} - The current RefSet instance to allow method chaining.\n   */\n  objectifying(setObjectification = true) {\n    this.objectifyValues = setObjectification\n    return this\n  }\n\n  /**\n   * Returns the state indicating whether or not `RefSet` will attempt to\n   * convert non-valid primitives into targets that are valid input for\n   * new `WeakRef` object instances. If this value is `false` then no\n   * *objectification* will occur.\n   *\n   * @returns {boolean} The current state of objectifyValues.\n   */\n  get objectifyValues() {\n    return this.#objectifyValues\n  }\n\n  /**\n   * Setting this value to true, will cause all added values to the Set to\n   * be analyzed for validity as a candidate to be wrapped in a `WeakRef`\n   * object. If true, and if possible, the object will be turned into an\n   * `Object` variant first. This will also enable less rigid variable\n   * comparison in the `.has()` method (i.e. `==` instead of `===`).\n   *\n   * @param {boolean} value - The new state to set for objectifyValues.\n   */\n  set objectifyValues(value) {\n    this.#objectifyValues = !!value\n  }\n\n  /**\n   * Overrides the add method of Set. Adds a value to the RefSet, converting it\n   * to a WeakRef. Throws an error if the value is not a valid WeakRef target\n   * (e.g., null, undefined, or a registered symbol). If `objectifyValues` is\n   * enabled, an attempt to convert primitives to their object variants will be\n   * made. These are numbers, strings, boolean values and big integers.\n   *\n   * @param {*} value - The value to be added to the RefSet.\n   * @throws {TypeError} If the value is not a valid WeakRef target.\n   */\n  add(value) {\n    // Objectify the value if needed\n    if (this.#objectifyValues && (\n      typeof value === 'number' ||\n      typeof value === 'string' ||\n      typeof value === 'boolean' ||\n      typeof value === 'bigint'\n    )) {\n      value = Object(value);\n    }\n\n    // Check if the value is an object, and if it's a symbol, ensure it's not registered\n    if (typeof value === 'symbol' && Symbol.keyFor(value) !== undefined) {\n      throw new TypeError('RefSet cannot accept registered symbols as values');\n    }\n\n    if (typeof value !== 'object' && typeof value !== 'symbol') {\n      throw new TypeError(\n        'RefSet values must be objects, non-registered symbols, or objectified primitives'\n      );\n    }\n\n    // If the value is null or undefined, throw an error\n    if (value === null || value === undefined) {\n      throw new TypeError('RefSet values cannot be null or undefined');\n    }\n\n    super.add(new WeakRef(value));\n  }\n\n  /**\n   * Adds multiple values to the RefSet. The supplied `values` should be\n   * iterable and truthy. This function defers to `.add()` for its logic so\n   * each value from the supplied collection of values will also be subject\n   * to the criteria of that function.\n   *\n   * @param {Iterable} values - An iterable of values to add to the RefSet.\n   * @throws {TypeError} If the supplied values are falsey or non-iterable.\n   */\n  addAll(values) {\n    if (\n      !values ||\n      (typeof values !== 'object') ||\n      !Reflect.has(values, Symbol.iterator)\n    ) {\n      throw new TypeError('The supplied values are either falsey or non-iterable')\n    }\n\n    for (const value of values) {\n      this.add(value)\n    }\n  }\n\n  /**\n   * Removes all elements from the RefSet that have been garbage collected\n   * (i.e., their WeakRef no longer points to an object).\n   *\n   * @returns {RefSet} - The current RefSet instance to allow method chaining.\n   */\n  clean() {\n    for (const ref of this) {\n      if (!ref.deref()) {\n        this.delete(ref)\n      }\n    }\n\n    return this\n  }\n\n  /**\n   * Executes a provided function once for each value in the RefSet. The callback\n   * function receives the dereferenced value, the value again (as RefSet doesn't\n   * use keys), and the RefSet itself. This method provides a way to iterate over\n   * and apply operations to the values stored in the RefSet, taking into account\n   * that they are weak references and may have been garbage-collected.\n   *\n   * @param {Function} forEachFn - Function to execute for each element. It\n   * takes three arguments: element, element (again, as RefSet has no key), and\n   * the RefSet itself.\n   * @param {*} thisArg - Value to use as `this` when executing `forEachFn`.\n   */\n  entries() {\n    const refEntries = Array.from(super.entries())\n\n    return refEntries\n      .map(([_, ref]) => [ref.deref(), ref.deref()])\n      .filter(([_, value]) => !!value)\n  }\n\n  /**\n   * Iterate over the items in the set and pass them to the supplied\n   * function ala `Array.prototype.forEach`. Note however, there are no\n   * indexes on Sets and as such, the index parameter of the callback\n   * will always be `NaN`. Subsequently the `array` or third parameter\n   * will receive the set instance rather than an array.\n   *\n   * @param {function} forEachFn the function to use for each element in\n   * the set.\n   * @param {object} thisArg the `this` argument to be applied to each\n   * invocation of the `forEachFn` callback. Note, this value is unable\n   * to be applied if the `forEachFn` is a big arrow function\n   */\n  forEach(forEachFn, thisArg) {\n    const set = this\n\n    super.forEach(function(ref) {\n      const value = ref.deref()\n\n      if (!value) {\n        return\n      }\n\n      forEachFn.call(thisArg, value, value, set)\n    })\n  }\n\n  /**\n   * Returns an iterator for the values in the RefSet. Each value is\n   * dereferenced from its WeakRef before being returned. This method allows\n   * iterating over he set's values, similar to how one would iterate over\n   * values in a standard Set or Array, but with the understanding that the\n   * values are weakly referenced and may no longer exist (in which case\n   * they are skipped).\n   *\n   * @returns {Iterator} An iterator for the values.\n   */\n  values() {\n    const values = []\n\n    for (const value of this) {\n      const dereferenced = value.deref()\n\n      if (dereferenced) {\n        values.push(dereferenced)\n      }\n    }\n\n    return values\n  }\n\n  /**\n   * Returns an iterator for the keys of the RefSet. In RefSet, keys and\n   * values are identical, so this method behaves the same as `values()`. It\n   * provides compatibility with the standard Set interface and allows use in\n   * contexts where keys are expected, despite RefSet not differentiating\n   * between keys and values.\n   *\n   * @returns {Iterator} An iterator for the keys.\n   */\n  keys() {\n    return this.values()\n  }\n\n  /**\n   * Determines whether an element with the specified value exists in the\n   * `RefSet`. For non-objectified sets, this method checks if the dereferenced\n   * values of the set include the specified value.\n   *\n   * For objectified sets, it uses the `contains` method which accounts for\n   * the objectification. This method differs from standard Set `has` in that\n   * it works with weak references and considers objectification settings.\n   *\n   * @param {*} value - The value to check for presence in the RefSet.\n   * @returns {boolean} - True if an element with the specified value exists\n   * in the RefSet, false otherwise.\n   */\n  has(value) {\n    if (this.#objectifyValues) {\n      return this.contains(value)\n    }\n\n    for (const item of this.values()) {\n      if (item === value) {\n        return true\n      }\n    }\n\n    return false\n  }\n\n  /**\n   * Checks if the RefSet contains a value that is equal to the specified\n   * value. This method is used primarily in objectified RefSets to determine\n   * the presence of a value, taking into account objectification. It differs\n   * from the `has` method in that it's tailored for sets that have\n   * transformed their primitive values into objects, whereas `has` is more\n   * general-purpose.\n   *\n   * @param {*} value - The value to search for in the RefSet.\n   * @returns {boolean} - True if the RefSet contains the value, false otherwise.\n   */\n  contains(value) {\n    return !!(Array.from(this.values())\n      .filter(dereferencedValue => {\n       return value == dereferencedValue\n      })\n      .length\n    )\n  }\n\n  /**\n   * Creates a new array with all elements that pass the test implemented by\n   * the provided function. This method iterates over each element,\n   * dereferences it, and applies the filter function. Unlike Array `filter`,\n   * the callback receives the dereferenced value and not an index or array,\n   * reflecting the non-indexed nature of RefSet. Useful for selectively\n   * creating arrays from the set based on certain conditions, especially when\n   * dealing with weak references.\n   *\n   * @param {Function} filterFn - Function to test each element of the RefSet.\n   * The function receives the dereferenced value.\n   * @param {*} thisArg - Value to use as `this` when executing `filterFn`.\n   * @returns {Array} - A new array with the elements that pass the test.\n   */\n  filter(filterFn, thisArg) {\n    const results = []\n\n    for (const value of this) {\n      const dereferenced = value?.deref()\n\n      if (dereferenced) {\n        const include = filterFn.call(thisArg, dereferenced, NaN, this)\n\n        if (include) {\n          results.push(dereferenced)\n        }\n      }\n    }\n\n    return results\n  }\n\n  /**\n   * Returns the value of the first element in the RefSet that satisfies the\n   * provided testing function. Similar to Array `find`, this method iterates\n   * over the RefSet, dereferencing each value and applying the testing\n   * function. The non-indexed nature of RefSet is considered, as the\n   * callback does not receive an index. This method is useful for finding a\n   * specific element based on a condition.\n   *\n   * @param {*} thisArg - Value to use as this when executing findFn.\n   * @returns {*} - The value of the first element in the RefSet that satisfies\n   * the testing function, or undefined if none found.\n   * @returns {any} the dereferenced value if found, or undefined otherwise\n   */\n  find(findFn, thisArg) {\n    for (const value of this) {\n      const dereferenced = value?.deref()\n\n      if (dereferenced) {\n        const found = findFn.call(thisArg, dereferenced, NaN, this)\n\n        if (found) {\n          return dereferenced\n        }\n      }\n    }\n\n    return undefined\n  }\n\n  /**\n   * Creates a new array or `RefSet` with the results of calling a provided\n   * function on every element in the calling `RefSet`. This method dereferences\n   * each value, applies the `mapFn`, and collects the results. If `toRefSet` is\n   * `true`, a new `RefSet` is returned; otherwise, an array. This method\n   * differs from `Array.map` in handling weak references and the potential to\n   * return a new `RefSet` instead of an array.\n   *\n   * @param {Function} mapFn - Function that produces an element of the new\n   * array or `RefSet`, taking three arguments.\n   * @param {*} thisArg - Value to use as this when executing mapFn.\n   * @param {boolean} toRefSet - Determines if the output should be a new\n   * `RefSet` (`true`) or an array (`false`).\n   * @param {boolean} mirrorObjectification - If `true` and `toRefSet` is\n   * `true`, the new `RefSet` mirrors the objectification setting of the\n   * original.\n   * @returns {Array|RefSet} - A new array or `RefSet` with each element being\n   * the result of the `mapFn`.\n   */\n  map(mapFn, thisArg, toRefSet, mirrorObjectification) {\n    const mapped = []\n\n    let validRefSetOutput = true\n    let validRefSetOutputIfObjectified = true\n\n    for (const value of this) {\n      const dereferenced = value?.deref()\n\n      if (dereferenced) {\n        const mappedItem = mapFn.call(thisArg, dereferenced, NaN, this)\n\n        if (validRefSetOutput || validRefSetOutputIfObjectified) {\n          const weakReferenceable = this.#validWeakRefTarget(mappedItem)\n\n          if (!weakReferenceable) {\n            validRefSetOutput = false\n\n            if (validRefSetOutputIfObjectified) {\n              validRefSetOutputIfObjectified =\n                this.#validWeakRefTarget(Object(mappedItem))\n            }\n          }\n        }\n\n        mapped.push(mappedItem)\n      }\n    }\n\n    if (toRefSet) {\n      if (validRefSetOutput) {\n        return new RefSet(mapped).objectifying(\n          mirrorObjectification ? this.objectifyValues : false\n        )\n      }\n\n      if (validRefSetOutputIfObjectified) {\n        return new RefSet(mapped.map(value => {\n          return this.#validWeakRefTarget(value) ? value : Object(value)\n        })).objectifying()\n      }\n    }\n\n    return mapped\n  }\n\n  /**\n   * Ensures that the constructor of this object instance's name\n   * is returned if the string tag for this instance is queried\n   *\n   * @returns {string} the name of the class\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * Private method to check if a given value is a valid target for a WeakRef.\n   *\n   * @param {*} value - The value to check for validity as a WeakRef target.\n   * @returns {boolean} - True if the value is a valid WeakRef target,\n   * false otherwise.\n   * @private\n   */\n  #validWeakRefTarget(value) {\n    return !(\n      (typeof value === 'symbol' && Symbol.keyFor(value) === undefined) ||\n      (typeof value !== 'object' && typeof value !== 'symbol') ||\n      (value === null || value === undefined)\n    )\n  }\n}\n\nexport const RefSetExtensions = new Extension(RefSet)", "import { Extension } from '@nejs/extension'\n\nimport { Introspector } from './introspector.js'\n\nexport class Type {\n  mapped = new Map(Type.mapped.entries())\n\n  of(value) { return Type.of(value) }\n  class(value) { return Type.class(value) }\n  isPrimitive(value) { return Type.isPrimitive(value) }\n\n  static is(value, ofType) {\n    const name = Type.of(value)\n    return name === Type.name(ofType)\n  }\n\n  static of(value) {\n    return typeof value\n  }\n\n  static named(value) {\n    const tag = / (.*?)\\]/.exec(Object.prototype.toString.call(value))?.[1]\n    const name = (\n      value?.[Symbol.toStringTag] ??\n      tag ??\n      (value instanceof Function ? value.name : undefined) ??\n      Type.mapped.get(typeof value).name\n    )\n\n    return name\n  }\n\n  static class(value, mapped) {\n    mapped = mapped ?? Type.mapped\n\n    const name = (\n      value?.[Symbol.toStringTag] ??\n      (value instanceof Function ? value.name : undefined) ??\n      typeof value\n    )\n\n    const type = mapped.has(name)\n      ? Type.mapped.get(name)\n      : value?.constructor\n\n    if (Type.of(type) === 'function' && !mapped.has(name) && this !== Type) {\n      mapped.set(name, type)\n      mapped.set(type, name)\n    }\n\n    return !type ? mapped.get(typeof value) : type\n  }\n\n  static isPrimitive(value) {\n    return new Set([...Type.primitives]).has(typeof value)\n  }\n\n  static get primitives() {\n    return function*() {\n      yield 'bigint'\n      yield 'boolean'\n      yield 'number'\n      yield 'string'\n      yield 'symbol'\n      yield 'undefined'\n    }\n  }\n\n  static get typeOfTypes() {\n    return function*() {\n      yield 'bigint'\n      yield 'boolean'\n      yield 'function'\n      yield 'number'\n      yield 'object'\n      yield 'string'\n      yield 'symbol'\n      yield 'undefined'\n    }\n  }\n\n  static mapped = new Map([\n    ['bigint',BigInt],\n    ['boolean',Boolean],\n    ['function',Function],\n    ['number',Number],\n    ['object',Object],\n    ['string',String],\n    ['symbol',Symbol],\n    ['undefined',undefined],\n    [BigInt, 'bigint'],\n    [Boolean, 'boolean'],\n    [Function, 'function'],\n    [Number, 'number'],\n    [Object, 'object'],\n    [String, 'string'],\n    [Symbol, 'symbol'],\n    [BigInt.name, BigInt],\n    [Boolean.name, Boolean],\n    [Function.name, Function],\n    [Number.name, Number],\n    [Object.name, Object],\n    [String.name, String],\n    [Symbol.name, Symbol],\n    [undefined, 'undefined'],\n  ])\n\n  serverJs = {\n    nodejs: {\n      'v21.1.0': {\n        version: 'v21.1.0',\n        date: new Date('2024-04-21T15:58:12.490Z'),\n        classes: Introspector.addExpansion([\n          'AbortController', 'AbortSignal', 'AggregateError', 'Array',\n          'ArrayBuffer', 'BigInt', 'BigInt64Array', 'BigUint64Array', 'Blob',\n          'Boolean', 'BroadcastChannel', 'Buffer', 'ByteLengthQueuingStrategy',\n          'CompressionStream', 'CountQueuingStrategy', 'Crypto', 'CryptoKey',\n          'CustomEvent', 'DataView', 'Date', 'DecompressionStream', 'DOMException',\n          'Error', 'EvalError', 'Event', 'EventTarget', 'File',\n          'FinalizationRegistry', 'Float32Array', 'Float64Array', 'FormData',\n          'Function', 'Headers', 'Int16Array', 'Int32Array', 'Int8Array', 'Map',\n          'MessageChannel', 'MessageEvent', 'MessagePort', 'Navigator', 'Number',\n          'Object', 'Performance', 'PerformanceEntry', 'PerformanceMark',\n          'PerformanceMeasure', 'PerformanceObserver',\n          'PerformanceObserverEntryList', 'PerformanceResourceTiming', 'Promise',\n          'Proxy', 'RangeError', 'ReadableByteStreamController', 'ReadableStream',\n          'ReadableStreamBYOBReader', 'ReadableStreamBYOBRequest',\n          'ReadableStreamDefaultController', 'ReadableStreamDefaultReader',\n          'ReferenceError', 'RegExp', 'Request', 'Response', 'Set',\n          'SharedArrayBuffer', 'String', 'SubtleCrypto', 'Symbol', 'SyntaxError',\n          'TextDecoder', 'TextDecoderStream', 'TextEncoder', 'TextEncoderStream',\n          'TransformStream', 'TransformStreamDefaultController', 'TypeError',\n          'Uint16Array', 'Uint32Array', 'Uint8Array', 'Uint8ClampedArray',\n          'URIError', 'URL', 'URLSearchParams', 'WeakMap', 'WeakRef', 'WeakSet',\n          'WritableStream', 'WritableStreamDefaultController',\n          'WritableStreamDefaultWriter'\n        ]),\n        nodeSpecificClasses: Introspector.addExpansion([\n          'Buffer', 'CryptoKey', 'SharedArrayBuffer', 'SubtleCrypto',\n        ]),\n        functions: Introspector.addExpansion([\n          'assert', 'atob', 'btoa', 'clearImmediate', 'clearInterval',\n          'clearTimeout', 'decodeURI', 'decodeURIComponent', 'encodeURI',\n          'encodeURIComponent', 'escape', 'eval', 'events', 'fetch', 'isFinite',\n          'isNaN', 'parseFloat', 'parseInt', 'queueMicrotask', 'require',\n          'setImmediate', 'setInterval', 'setTimeout', 'stream', 'structuredClone',\n          'unescape',\n        ]),\n        objects: Introspector.addExpansion([\n          'Atomics', 'Intl', 'JSON', 'Math', 'Reflect', 'WebAssembly',\n          '_', '_error', 'async_hooks', 'buffer', 'child_process', 'cluster',\n          'console', 'constants', 'crypto', 'dgram', 'diagnostics_channel', 'dns',\n          'domain', 'fs', 'global', 'globalThis', 'http', 'http2',\n          'https', 'inspector', 'module', 'navigator', 'net', 'os',\n          'path', 'perf_hooks', 'performance', 'process', 'punycode', 'querystring',\n          'readline', 'repl', 'string_decoder', 'sys', 'timers', 'tls',\n          'trace_events', 'tty', 'url', 'util', 'v8', 'vm',\n          'wasi', 'worker_threads', 'zlib'\n        ]),\n        properties: Introspector.addExpansion(['Infinity', 'NaN', 'undefined']),\n        symbols: Introspector.addExpansion([Symbol.toStringTag])\n      },\n    },\n\n    qjs: {\n      'v': {\n        version: 'v',\n        classes: Introspector.addExpansion([\n          'AggregateError', 'Array', 'ArrayBuffer', 'BigInt', 'BigInt64Array',\n          'BigUint64Array', 'Boolean', 'DataView', 'Date', 'Error', 'EvalError',\n          'Float32Array', 'Float64Array', 'Function', 'Int16Array', 'Int32Array',\n          'Int8Array', 'InternalError', 'Map', 'Number', 'Object', 'Promise',\n          'Proxy', 'RangeError', 'ReferenceError', 'RegExp', 'Set',\n          'SharedArrayBuffer', 'String', 'Symbol', 'SyntaxError', 'TypeError',\n          'URIError', 'Uint16Array', 'Uint32Array', 'Uint8Array',\n          'Uint8ClampedArray', 'WeakMap', 'WeakSet',\n        ]),\n        functions: Introspector.addExpansion([\n          'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent',\n          'escape', 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt',\n          'print', 'unescape'\n        ]),\n        objects: Introspector.addExpansion([\n          'Atomics', 'JSON', 'Math', 'Reflect', '_', 'console',\n          'globalThis', 'os', 'scriptArgs', 'std',\n        ]),\n        properties: Introspector.addExpansion([\n          'Infinity', 'NaN', 'undefined'\n        ]),\n        symbols: Introspector.addExpansion([]),\n      }\n    }\n  }\n\n  browser = {\n    arc: {\n      version: 'Version 1.39.0 (48951)',\n      userAgent: [\n        'Mozilla/5.0',\n        '(Macintosh; Intel Mac OS X 10_15_7)',\n        'AppleWebKit/537.36',\n        '(KHTML, like Gecko)',\n        'Chrome/124.0.0.0',\n        'Safari/537.36'\n      ].join(' '),\n      types: {\n        classes: Introspector.addExpansion([\n          'AbortController', 'AbortSignal', 'AggregateError', 'Array',\n          'ArrayBuffer', 'BigInt', 'BigInt64Array', 'BigUint64Array', 'Blob',\n          'Boolean', 'BroadcastChannel', 'ByteLengthQueuingStrategy',\n          'CompressionStream', 'CountQueuingStrategy', 'Crypto', 'CustomEvent',\n          'DOMException', 'DataView', 'Date', 'DecompressionStream', 'Error',\n          'EvalError', 'Event', 'EventTarget', 'File', 'FinalizationRegistry',\n          'Float32Array', 'Float64Array', 'FormData', 'Function', 'Headers',\n          'Int16Array', 'Int32Array', 'Int8Array', 'Map', 'MessageChannel',\n          'MessageEvent', 'MessagePort', 'Navigator', 'Number', 'Object',\n          'Performance', 'PerformanceEntry', 'PerformanceMark',\n          'PerformanceMeasure', 'PerformanceObserver',\n          'PerformanceObserverEntryList', 'PerformanceResourceTiming', 'Promise',\n          'Proxy', 'RangeError', 'ReadableByteStreamController', 'ReadableStream',\n          'ReadableStreamBYOBReader', 'ReadableStreamBYOBRequest',\n          'ReadableStreamDefaultController', 'ReadableStreamDefaultReader',\n          'ReferenceError', 'RegExp', 'Request', 'Response', 'Set', 'String',\n          'Symbol', 'SyntaxError', 'TextDecoder', 'TextDecoderStream',\n          'TextEncoder', 'TextEncoderStream', 'TransformStream',\n          'TransformStreamDefaultController', 'TypeError', 'URIError', 'URL',\n          'URLSearchParams', 'Uint16Array', 'Uint32Array', 'Uint8Array',\n          'Uint8ClampedArray', 'WeakMap', 'WeakRef', 'WeakSet', 'WritableStream',\n          'WritableStreamDefaultController', 'WritableStreamDefaultWriter'\n        ]),\n        browserClasses: Introspector.addExpansion([\n          \"AbstractRange\", \"AnalyserNode\", \"Animation\", \"AnimationEffect\",\n          \"AnimationEvent\", \"AnimationPlaybackEvent\", \"AnimationTimeline\", \"Attr\",\n          \"Audio\", \"AudioBuffer\", \"AudioBufferSourceNode\", \"AudioContext\",\n          \"AudioData\", \"AudioDestinationNode\", \"AudioListener\", \"AudioNode\",\n          \"AudioParam\", \"AudioParamMap\", \"AudioProcessingEvent\",\n          \"AudioScheduledSourceNode\", \"AudioSinkInfo\", \"AudioWorkletNode\",\n          \"BackgroundFetchManager\", \"BackgroundFetchRecord\",\n          \"BackgroundFetchRegistration\", \"BarProp\", \"BaseAudioContext\",\n          \"BeforeInstallPromptEvent\", \"BeforeUnloadEvent\", \"BiquadFilterNode\",\n          \"BlobEvent\", \"BluetoothUUID\", \"BrowserCaptureMediaStreamTrack\",\n          \"CDATASection\", \"CSSAnimation\", \"CSSConditionRule\", \"CSSContainerRule\",\n          \"CSSCounterStyleRule\", \"CSSFontFaceRule\", \"CSSFontPaletteValuesRule\",\n          \"CSSGroupingRule\", \"CSSImageValue\", \"CSSImportRule\", \"CSSKeyframeRule\",\n          \"CSSKeyframesRule\", \"CSSKeywordValue\", \"CSSLayerBlockRule\",\n          \"CSSLayerStatementRule\", \"CSSMathClamp\", \"CSSMathInvert\", \"CSSMathMax\",\n          \"CSSMathMin\", \"CSSMathNegate\", \"CSSMathProduct\", \"CSSMathSum\",\n          \"CSSMathValue\", \"CSSMatrixComponent\", \"CSSMediaRule\", \"CSSNamespaceRule\",\n          \"CSSNumericArray\", \"CSSNumericValue\", \"CSSPageRule\", \"CSSPerspective\",\n          \"CSSPositionValue\", \"CSSPropertyRule\", \"CSSRotate\", \"CSSRule\",\n          \"CSSRuleList\", \"CSSScale\", \"CSSScopeRule\", \"CSSSkew\", \"CSSSkewX\",\n          \"CSSSkewY\", \"CSSStartingStyleRule\", \"CSSStyleDeclaration\", \"CSSStyleRule\",\n          \"CSSStyleSheet\", \"CSSStyleValue\", \"CSSSupportsRule\",\n          \"CSSTransformComponent\", \"CSSTransformValue\", \"CSSTransition\",\n          \"CSSTranslate\", \"CSSUnitValue\", \"CSSUnparsedValue\",\n          \"CSSVariableReferenceValue\", \"CanvasCaptureMediaStreamTrack\",\n          \"CanvasGradient\", \"CanvasPattern\", \"CanvasRenderingContext2D\",\n          \"ChannelMergerNode\", \"ChannelSplitterNode\", \"CharacterBoundsUpdateEvent\",\n          \"CharacterData\", \"ClipboardEvent\", \"CloseEvent\", \"Comment\",\n          \"CompositionEvent\", \"ConstantSourceNode\",\n          \"ContentVisibilityAutoStateChangeEvent\", \"ConvolverNode\", \"CropTarget\",\n          \"CustomElementRegistry\", \"CustomStateSet\", \"DOMError\",\n          \"DOMImplementation\", \"DOMMatrix\", \"DOMMatrixReadOnly\", \"DOMParser\",\n          \"DOMPoint\", \"DOMPointReadOnly\", \"DOMQuad\", \"DOMRect\", \"DOMRectList\",\n          \"DOMRectReadOnly\", \"DOMStringList\", \"DOMStringMap\", \"DOMTokenList\",\n          \"DataTransfer\", \"DataTransferItem\", \"DataTransferItemList\", \"DelayNode\",\n          \"DelegatedInkTrailPresenter\", \"Document\", \"DocumentFragment\",\n          \"DocumentPictureInPictureEvent\", \"DocumentTimeline\", \"DocumentType\",\n          \"DragEvent\", \"DynamicsCompressorNode\", \"EditContext\", \"Element\",\n          \"ElementInternals\", \"EncodedAudioChunk\", \"EncodedVideoChunk\",\n          \"ErrorEvent\", \"EventCounts\", \"EventSource\", \"External\", \"FeaturePolicy\",\n          \"FileList\", \"FileReader\", \"FocusEvent\", \"FontFace\",\n          \"FontFaceSetLoadEvent\", \"FormDataEvent\", \"FragmentDirective\", \"GainNode\",\n          \"Gamepad\", \"GamepadButton\", \"GamepadEvent\", \"GamepadHapticActuator\",\n          \"Geolocation\", \"GeolocationCoordinates\", \"GeolocationPosition\",\n          \"GeolocationPositionError\", \"HTMLAllCollection\", \"HTMLAnchorElement\",\n          \"HTMLAreaElement\", \"HTMLAudioElement\", \"HTMLBRElement\", \"HTMLBaseElement\",\n          \"HTMLBodyElement\", \"HTMLButtonElement\", \"HTMLCanvasElement\",\n          \"HTMLCollection\", \"HTMLDListElement\", \"HTMLDataElement\",\n          \"HTMLDataListElement\", \"HTMLDetailsElement\", \"HTMLDialogElement\",\n          \"HTMLDirectoryElement\", \"HTMLDivElement\", \"HTMLDocument\", \"HTMLElement\",\n          \"HTMLEmbedElement\", \"HTMLFieldSetElement\", \"HTMLFontElement\",\n          \"HTMLFormControlsCollection\", \"HTMLFormElement\", \"HTMLFrameElement\",\n          \"HTMLFrameSetElement\", \"HTMLHRElement\", \"HTMLHeadElement\",\n          \"HTMLHeadingElement\", \"HTMLHtmlElement\", \"HTMLIFrameElement\",\n          \"HTMLImageElement\", \"HTMLInputElement\", \"HTMLLIElement\",\n          \"HTMLLabelElement\", \"HTMLLegendElement\", \"HTMLLinkElement\",\n          \"HTMLMapElement\", \"HTMLMarqueeElement\", \"HTMLMediaElement\",\n          \"HTMLMenuElement\", \"HTMLMetaElement\", \"HTMLMeterElement\",\n          \"HTMLModElement\", \"HTMLOListElement\", \"HTMLObjectElement\",\n          \"HTMLOptGroupElement\", \"HTMLOptionElement\", \"HTMLOptionsCollection\",\n          \"HTMLOutputElement\", \"HTMLParagraphElement\", \"HTMLParamElement\",\n          \"HTMLPictureElement\", \"HTMLPreElement\", \"HTMLProgressElement\",\n          \"HTMLQuoteElement\", \"HTMLScriptElement\", \"HTMLSelectElement\",\n          \"HTMLSlotElement\", \"HTMLSourceElement\", \"HTMLSpanElement\",\n          \"HTMLStyleElement\", \"HTMLTableCaptionElement\", \"HTMLTableCellElement\",\n          \"HTMLTableColElement\", \"HTMLTableElement\", \"HTMLTableRowElement\",\n          \"HTMLTableSectionElement\", \"HTMLTemplateElement\", \"HTMLTextAreaElement\",\n          \"HTMLTimeElement\", \"HTMLTitleElement\", \"HTMLTrackElement\",\n          \"HTMLUListElement\", \"HTMLUnknownElement\", \"HTMLVideoElement\",\n          \"HashChangeEvent\", \"Highlight\", \"HighlightRegistry\", \"History\",\n          \"IDBCursor\", \"IDBCursorWithValue\", \"IDBDatabase\", \"IDBFactory\",\n          \"IDBIndex\", \"IDBKeyRange\", \"IDBObjectStore\", \"IDBOpenDBRequest\",\n          \"IDBRequest\", \"IDBTransaction\", \"IDBVersionChangeEvent\", \"IIRFilterNode\",\n          \"IdleDeadline\", \"Image\", \"ImageBitmap\", \"ImageBitmapRenderingContext\",\n          \"ImageCapture\", \"ImageData\", \"ImageTrack\", \"ImageTrackList\", \"Ink\",\n          \"InputDeviceCapabilities\", \"InputDeviceInfo\", \"InputEvent\",\n          \"IntersectionObserver\", \"IntersectionObserverEntry\", \"Iterator\",\n          \"KeyboardEvent\", \"KeyframeEffect\", \"LargestContentfulPaint\",\n          \"LaunchParams\", \"LaunchQueue\", \"LayoutShift\", \"LayoutShiftAttribution\",\n          \"Location\", \"MathMLElement\", \"MediaCapabilities\",\n          \"MediaElementAudioSourceNode\", \"MediaEncryptedEvent\", \"MediaError\",\n          \"MediaList\", \"MediaMetadata\", \"MediaQueryList\", \"MediaQueryListEvent\",\n          \"MediaRecorder\", \"MediaSession\", \"MediaSource\", \"MediaSourceHandle\",\n          \"MediaStream\", \"MediaStreamAudioDestinationNode\",\n          \"MediaStreamAudioSourceNode\", \"MediaStreamEvent\", \"MediaStreamTrack\",\n          \"MediaStreamTrackEvent\", \"MediaStreamTrackGenerator\",\n          \"MediaStreamTrackProcessor\", \"MediaStreamTrackVideoStats\", \"MimeType\",\n          \"MimeTypeArray\", \"MouseEvent\", \"MutationEvent\", \"MutationObserver\",\n          \"MutationRecord\", \"NamedNodeMap\", \"NavigateEvent\", \"Navigation\",\n          \"NavigationActivation\", \"NavigationCurrentEntryChangeEvent\",\n          \"NavigationDestination\", \"NavigationHistoryEntry\", \"NavigationTransition\",\n          \"NavigatorUAData\", \"NetworkInformation\", \"Node\", \"NodeFilter\",\n          \"NodeIterator\", \"NodeList\", \"Notification\",\n          \"OfflineAudioCompletionEvent\", \"OfflineAudioContext\", \"OffscreenCanvas\",\n          \"OffscreenCanvasRenderingContext2D\", \"Option\", \"OscillatorNode\",\n          \"OverconstrainedError\", \"PageRevealEvent\", \"PageSwapEvent\",\n          \"PageTransitionEvent\", \"PannerNode\", \"Path2D\",\n          \"PerformanceElementTiming\", \"PerformanceEventTiming\",\n          \"PerformanceLongAnimationFrameTiming\", \"PerformanceLongTaskTiming\",\n          \"PerformanceNavigation\", \"PerformanceNavigationTiming\",\n          \"PerformancePaintTiming\", \"PerformanceScriptTiming\",\n          \"PerformanceServerTiming\", \"PerformanceTiming\", \"PeriodicSyncManager\",\n          \"PeriodicWave\", \"PermissionStatus\", \"Permissions\",\n          \"PictureInPictureEvent\", \"PictureInPictureWindow\", \"Plugin\",\n          \"PluginArray\", \"PointerEvent\", \"PopStateEvent\",\n          \"ProcessingInstruction\", \"Profiler\", \"ProgressEvent\",\n          \"PromiseRejectionEvent\", \"PushManager\", \"PushSubscription\",\n          \"PushSubscriptionOptions\", \"RTCCertificate\", \"RTCDTMFSender\",\n          \"RTCDTMFToneChangeEvent\", \"RTCDataChannel\", \"RTCDataChannelEvent\",\n          \"RTCDtlsTransport\", \"RTCEncodedAudioFrame\", \"RTCEncodedVideoFrame\",\n          \"RTCError\", \"RTCErrorEvent\", \"RTCIceCandidate\", \"RTCIceTransport\",\n          \"RTCPeerConnection\", \"RTCPeerConnectionIceErrorEvent\",\n          \"RTCPeerConnectionIceEvent\", \"RTCRtpReceiver\", \"RTCRtpSender\",\n          \"RTCRtpTransceiver\", \"RTCSctpTransport\", \"RTCSessionDescription\",\n          \"RTCStatsReport\", \"RTCTrackEvent\", \"RadioNodeList\", \"Range\",\n          \"RemotePlayback\", \"ReportingObserver\", \"ResizeObserver\",\n          \"ResizeObserverEntry\", \"ResizeObserverSize\", \"SVGAElement\", \"SVGAngle\",\n          \"SVGAnimateElement\", \"SVGAnimateMotionElement\",\n          \"SVGAnimateTransformElement\", \"SVGAnimatedAngle\", \"SVGAnimatedBoolean\",\n          \"SVGAnimatedEnumeration\", \"SVGAnimatedInteger\", \"SVGAnimatedLength\",\n          \"SVGAnimatedLengthList\", \"SVGAnimatedNumber\", \"SVGAnimatedNumberList\",\n          \"SVGAnimatedPreserveAspectRatio\", \"SVGAnimatedRect\",\n          \"SVGAnimatedString\", \"SVGAnimatedTransformList\", \"SVGAnimationElement\",\n          \"SVGCircleElement\", \"SVGClipPathElement\",\n          \"SVGComponentTransferFunctionElement\", \"SVGDefsElement\", \"SVGDescElement\",\n          \"SVGElement\", \"SVGEllipseElement\", \"SVGFEBlendElement\",\n          \"SVGFEColorMatrixElement\", \"SVGFEComponentTransferElement\",\n          \"SVGFECompositeElement\", \"SVGFEConvolveMatrixElement\",\n          \"SVGFEDiffuseLightingElement\", \"SVGFEDisplacementMapElement\",\n          \"SVGFEDistantLightElement\", \"SVGFEDropShadowElement\", \"SVGFEFloodElement\",\n          \"SVGFEFuncAElement\", \"SVGFEFuncBElement\", \"SVGFEFuncGElement\",\n          \"SVGFEFuncRElement\", \"SVGFEGaussianBlurElement\", \"SVGFEImageElement\",\n          \"SVGFEMergeElement\", \"SVGFEMergeNodeElement\", \"SVGFEMorphologyElement\",\n          \"SVGFEOffsetElement\", \"SVGFEPointLightElement\",\n          \"SVGFESpecularLightingElement\", \"SVGFESpotLightElement\",\n          \"SVGFETileElement\", \"SVGFETurbulenceElement\", \"SVGFilterElement\",\n          \"SVGForeignObjectElement\", \"SVGGElement\", \"SVGGeometryElement\",\n          \"SVGGradientElement\", \"SVGGraphicsElement\", \"SVGImageElement\",\n          \"SVGLength\", \"SVGLengthList\", \"SVGLineElement\",\n          \"SVGLinearGradientElement\", \"SVGMPathElement\", \"SVGMarkerElement\",\n          \"SVGMaskElement\", \"SVGMatrix\", \"SVGMetadataElement\", \"SVGNumber\",\n          \"SVGNumberList\", \"SVGPathElement\", \"SVGPatternElement\", \"SVGPoint\",\n          \"SVGPointList\", \"SVGPolygonElement\", \"SVGPolylineElement\",\n          \"SVGPreserveAspectRatio\", \"SVGRadialGradientElement\", \"SVGRect\",\n          \"SVGRectElement\", \"SVGSVGElement\", \"SVGScriptElement\", \"SVGSetElement\",\n          \"SVGStopElement\", \"SVGStringList\", \"SVGStyleElement\", \"SVGSwitchElement\",\n          \"SVGSymbolElement\", \"SVGTSpanElement\", \"SVGTextContentElement\",\n          \"SVGTextElement\", \"SVGTextPathElement\", \"SVGTextPositioningElement\",\n          \"SVGTitleElement\", \"SVGTransform\", \"SVGTransformList\", \"SVGUnitTypes\",\n          \"SVGUseElement\", \"SVGViewElement\", \"Scheduler\", \"Scheduling\", \"Screen\",\n          \"ScreenOrientation\", \"ScriptProcessorNode\", \"ScrollTimeline\",\n          \"SecurityPolicyViolationEvent\", \"Selection\", \"ShadowRoot\",\n          \"SharedWorker\", \"SourceBuffer\", \"SourceBufferList\", \"SpeechSynthesis\",\n          \"SpeechSynthesisErrorEvent\", \"SpeechSynthesisEvent\",\n          \"SpeechSynthesisUtterance\", \"SpeechSynthesisVoice\", \"StaticRange\",\n          \"StereoPannerNode\", \"Storage\", \"StorageEvent\", \"StylePropertyMap\",\n          \"StylePropertyMapReadOnly\", \"StyleSheet\", \"StyleSheetList\",\n          \"SubmitEvent\", \"SyncManager\", \"TaskAttributionTiming\", \"TaskController\",\n          \"TaskPriorityChangeEvent\", \"TaskSignal\", \"Text\", \"TextEvent\",\n          \"TextFormat\", \"TextFormatUpdateEvent\", \"TextMetrics\", \"TextTrack\",\n          \"TextTrackCue\", \"TextTrackCueList\", \"TextTrackList\", \"TextUpdateEvent\",\n          \"TimeRanges\", \"ToggleEvent\", \"Touch\", \"TouchEvent\", \"TouchList\",\n          \"TrackEvent\", \"TransitionEvent\", \"TreeWalker\", \"TrustedHTML\",\n          \"TrustedScript\", \"TrustedScriptURL\", \"TrustedTypePolicy\",\n          \"TrustedTypePolicyFactory\", \"UIEvent\", \"URLPattern\", \"UserActivation\",\n          \"VTTCue\", \"ValidityState\", \"VideoColorSpace\", \"VideoFrame\",\n          \"VideoPlaybackQuality\", \"ViewTimeline\", \"ViewTransition\",\n          \"VirtualKeyboardGeometryChangeEvent\", \"VisibilityStateEntry\",\n          \"VisualViewport\", \"WaveShaperNode\", \"WebGL2RenderingContext\",\n          \"WebGLActiveInfo\", \"WebGLBuffer\", \"WebGLContextEvent\", \"WebGLFramebuffer\",\n          \"WebGLProgram\", \"WebGLQuery\", \"WebGLRenderbuffer\",\n          \"WebGLRenderingContext\", \"WebGLSampler\", \"WebGLShader\",\n          \"WebGLShaderPrecisionFormat\", \"WebGLSync\", \"WebGLTexture\",\n          \"WebGLTransformFeedback\", \"WebGLUniformLocation\",\n          \"WebGLVertexArrayObject\", \"WebKitCSSMatrix\", \"WebKitMutationObserver\",\n          \"WebSocket\", \"WebSocketError\", \"WebSocketStream\", \"WheelEvent\", \"Window\",\n          \"WindowControlsOverlay\", \"WindowControlsOverlayGeometryChangeEvent\",\n          \"Worker\", \"XMLDocument\", \"XMLHttpRequest\", \"XMLHttpRequestEventTarget\",\n          \"XMLHttpRequestUpload\", \"XMLSerializer\", \"XPathEvaluator\",\n          \"XPathExpression\", \"XPathResult\", \"XSLTProcessor\"\n        ]),\n      },\n      methods: {\n        get classes() { return addExpansion(fetcher('function', /^[A-Z]/)) },\n        get functions() {  },\n        get objects() {  },\n      }\n    },\n\n    safari: {\n\n    }\n  }\n}\n\nexport const TypeExtensions = new Extension(Type)", "import { Extension } from '@nejs/extension'\n\n/**\n * The AsyncIterable class extends the concept of Iterable to asynchronous\n * operations. It allows creating iterable objects where each element can be\n * an asynchronous entity, like a Promise. This class is particularly useful\n * when dealing with asynchronous data sources, such as API responses, file\n * reading in chunks, or any other data that is not immediately available but\n * arrives over time.\n */\nexport class AsyncIterable {\n  /**\n   * Private field to store the elements of the async iterable.\n   * @private\n   */\n  #elements = [];\n\n  /**\n   * Constructs an instance of AsyncIterable. Similar to Iterable, it can be\n   * initialized with either an iterable object, an async generator function,\n   * or individual elements. The elements can be promises, direct values, or a\n   * mix of both. If the first argument is an iterable or an async generator\n   * function, the instance is initialized with the elements from the iterable\n   * or the generated elements from the async generator function, followed by\n   * any additional arguments. If the first argument is not an iterable or an\n   * async generator function, all arguments are treated as individual elements.\n   *\n   * @param {Iterable|AsyncGeneratorFunction|Promise|*} elementsOrFirstElement - \n   * An iterable object, an async generator function, a Promise, or the first \n   * element.\n   * @param {...Promise|*} moreElements - Additional elements if the first\n   * argument is not an iterable or an async generator function.\n   */\n  constructor(elementsOrFirstElement, ...moreElements) {\n    if (\n      elementsOrFirstElement != null &&\n      (typeof elementsOrFirstElement[Symbol.iterator] === 'function' ||\n       typeof elementsOrFirstElement[Symbol.asyncIterator] === 'function')\n    ) {\n      this.#elements = [...elementsOrFirstElement, ...moreElements];\n    } else if (\n      typeof elementsOrFirstElement === 'function' &&\n      elementsOrFirstElement.constructor.name === 'AsyncGeneratorFunction'\n    ) {\n      this.#elements = elementsOrFirstElement();\n    } else {\n      this.#elements = [elementsOrFirstElement, ...moreElements];\n    }\n  }\n\n  /**\n   * Implements the async iterable protocol. When an instance of AsyncIterable\n   * is used in a `for await...of` loop, this async generator function is\n   * invoked. It yields each element as a Promise, allowing asynchronous\n   * iteration. Elements that are not Promises are automatically wrapped in\n   * a resolved Promise to ensure consistency.\n   *\n   * @returns {AsyncGenerator} An async generator that yields each element as\n   * a Promise.\n   */\n  async *[Symbol.asyncIterator]() {\n    for await (const element of this.#elements) {\n      // No need to wrap as a promise here since `for await...of` can handle\n      // both Promises and non-Promise values.\n      yield element;\n    }\n  }\n\n  /**\n   * Ensures that the constructor of this object instance's name\n   * is returned if the string tag for this instance is queried\n   *\n   * @returns {string} the name of the class\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name\n  }\n\n  /**\n   * Checks if a given value is an async iterable. This method determines if\n   * the provided value has a `Symbol.asyncIterator` property that is an async\n   * generator function. It's a precise way to identify if the value conforms\n   * to the async iterable protocol using an async generator function.\n   *\n   * Note: This method specifically checks for async generator functions. Some\n   * async iterables might use regular async functions that return an async\n   * iterator, which this method won't identify.\n   *\n   * @param {*} value - The value to be checked for async iterability.\n   * @returns {boolean} - Returns true if the value is an async iterable\n   * implemented using an async generator function, false otherwise.\n   */\n  static isAsyncIterable(value) {\n    const type = Object.prototype.toString.call(value?.[Symbol.asyncIterator]);\n    return type === '[object AsyncGeneratorFunction]';\n  }\n}\n\n/**\n * Being able to create a compliant `AsyncIterator` around any type of\n * iterable object. This can be wrapped around any type of object that\n * has a `[Symbol.asyncIterator]` property assigned to a generator\n * function.\n */\nexport class AsyncIterator {\n  /**\n   * Creates a new `AsyncIterator` object instance.\n   *\n   * @param {object|AsyncGeneratorFunction} asyncIterable any object that has a\n   * `[Symbol.asyncIterable]` property assigned to a generator function or an\n   * async generator function itself.\n   */\n  constructor(asyncIterable) {\n    if (typeof asyncIterable === 'function' &&\n        asyncIterable.constructor.name === 'AsyncGeneratorFunction') {\n      this.#asyncIterable = asyncIterable();\n    } else if (\n      !asyncIterable || \n      !Reflect.has(asyncIterable, Symbol.asyncIterator)\n    ) {\n      throw new TypeError(\n        'Value used to instantiate AsyncIterator is not an async iterable'\n      );\n    } else {\n      this.#asyncIterable = asyncIterable;\n    }\n    this.#asyncIterator = this.#asyncIterable[Symbol.asyncIterator]();\n  }\n\n  /**\n   * Returns a new `Array` derived from the iterable this object\n   * wraps.\n   *\n   * @returns {array} a new `Array` generated from the wrapped\n   * iterable. The method is generated from using an async for of\n   * loop.\n   */\n  async asArray() {\n    const array = []\n\n    for await (const value of this) {\n      array.push(value)\n    }\n\n    return array\n  }\n\n  /**\n   * Returns the actual iterable object passed to the constructor that\n   * created this instance.\n   *\n   * @returns {object} the object containing the `[Symbol.iterator]`\n   */\n  get asyncIterable() {\n    return this.#asyncIterable\n  }\n\n  /**\n   * The function retrieves the next value in the iterator. If the\n   * the iterator has run its course, `reset()` can be invoked to\n   * reset the pointer to the beginning of the iteration.\n   *\n   * @returns {any} the next value\n   */\n  async next() {\n    const result = await this.#asyncIterator.next();\n    if (result.done) {\n      return { value: undefined, done: true };\n    } else {\n      return { value: result.value, done: false };\n    }\n  }\n\n  /**\n   * Resets the async iterator to the beginning allowing it to be\n   * iterated over again.\n   */\n  async reset() {\n    this.#asyncIterator = this.#asyncIterable[Symbol.asyncIterator]();\n  }\n\n  /**\n   * The existence of this symbol on the object instances, indicates that\n   * it can be used in `for(.. of ..)` loops and its values can be\n   * extracted from calls to `Array.from()`\n   *\n   * @returns {AsyncIterable} this is returned since this object is already\n   * conforming to the expected JavaScript AsyncIterator interface\n   */\n  [Symbol.asyncIterator]() {\n    return this;\n  }\n\n  /**\n   * Ensures that the constructor of this object instance's name\n   * is returned if the string tag for this instance is queried\n   *\n   * @returns {string} the name of the class\n   */\n  get [Symbol.toStringTag]() {\n    return this.constructor.name;\n  }\n\n  /**\n   * The object from which its iterator functionality is derived.\n   *\n   * @type {object}\n   * @private\n   */\n  #asyncIterable = null;\n\n  /**\n   * The results of a call to the iterable's `[Symbol.asyncIterator]`\n   * generator function.\n   *\n   * @type {object}\n   * @private\n   */\n  #asyncIterator = null;\n}\n\nexport const AsyncIterableExtensions = new Extension(AsyncIterable)\nexport const AsyncIteratorExtensions = new Extension(AsyncIterator)", "import { ArrayExtensions, ArrayPrototypeExtensions } from './array.extensions.js'\nimport { BigIntExtensions, BigIntPrototypeExtensions } from './big.int.extension.js'\nimport { FunctionExtensions, FunctionPrototypeExtensions } from './function.extensions.js'\nimport { GlobalFunctionsAndProps } from './global.this.js'\nimport { JSONExtensions } from './json.extensions.js'\nimport { MapExtensions, MapPrototypeExtensions } from './map.extensions.js'\nimport { MathExtensions } from './math.extension.js'\nimport { NumberExtensions, NumberPrototypeExtensions } from './number.extension.js'\nimport { ObjectExtensions, ObjectPrototypeExtensions } from './object.extensions.js'\nimport { ReflectExtensions } from './reflect.extensions.js'\nimport { RegExpExtensions } from './regular.expression.extensions.js'\nimport { SetExtensions, SetPrototypeExtensions } from './set.extensions.js'\nimport { StringExtensions, StringPrototypeExtensions } from './string.extensions.js'\nimport { SymbolExtensions, SymbolPrototypeExtensions } from './symbol.extensions.js'\n\nimport { DeferredExtension } from './classes/deferred.js'\nimport { DescriptorExtensions, Descriptor } from './classes/descriptor.js'\nimport { EnumExtension, Enum } from './classes/enum.js'\nimport { EnumerationExtension, Enumeration } from './classes/enumeration.js'\nimport { IntrospectorExtensions } from './classes/introspector.js'\nimport { IteratorExtensions, IterableExtensions } from './classes/iterable.js'\nimport { ParamParserExtensions } from './classes/param.parser.js'\nimport { PropertyExtensions } from './classes/property.js'\nimport {\n  PluggableProxyExtensions,\n  ProxyHandlerExtensions,\n  PluggableProxyExtensionSet\n} from './classes/pluggable.proxy.js'\nimport { RefMapExtensions } from './classes/refmap.js'\nimport { RefSetExtensions } from './classes/refset.js'\nimport { SymkeysExtension } from './classes/symkeys.js'\nimport { TypeExtensions } from './classes/type.js'\n\nexport * from './utils/stdout.js'\nimport {\n  StringConsole,\n  StdoutGlobalPatches,\n  StringConsoleExtension,\n\n  captureStdout,\n} from './utils/stdout.js'\n\nexport * from './utils/copy.object.js'\nexport * from './utils/toolkit.js'\nexport * from './utils/descriptor.utils.js'\n\nimport {\n  AsyncIteratorExtensions,\n  AsyncIterableExtensions\n} from './classes/asyncIterable.js'\n\nconst StaticPatches = [\n  [Array, ArrayExtensions, Array.name],\n  [BigInt, BigIntExtensions, BigInt.name],\n  [Function, FunctionExtensions, Function.name],\n  [JSON, JSONExtensions, 'JSON'],                // Missing a .name property\n  [Map, MapExtensions, Map.name],\n  [Math, MathExtensions, 'Math'],\n  [Number, NumberExtensions, Number.name],\n  [Object, ObjectExtensions, Object.name],\n  [Reflect, ReflectExtensions, 'Reflect'],       // Missing a .name property\n  [RegExp, RegExpExtensions, RegExp.name],\n  [Set, SetExtensions, Set.name],\n  [String, StringExtensions, String.name],\n  [Symbol, SymbolExtensions, 'Symbol'],          // Missing a .name property\n]\n\nconst InstancePatches = [\n  [Array.prototype, ArrayPrototypeExtensions, Array.name],\n  [BigInt.prototype, BigIntPrototypeExtensions, BigInt.name],\n  [Function.prototype, FunctionPrototypeExtensions, Function.name],\n  [Map.prototype, MapPrototypeExtensions, Map.name],\n  [Number.prototype, NumberPrototypeExtensions, Number.name],\n  [Object.prototype, ObjectPrototypeExtensions, Object.name],\n  [Set.prototype, SetPrototypeExtensions, Set.name],\n  [String.prototype, StringPrototypeExtensions, String.name],\n  [Symbol.prototype, SymbolPrototypeExtensions, Symbol.name],\n]\n\nconst Patches = new Map([\n  ...StaticPatches,\n  ...InstancePatches,\n\n  [globalThis, GlobalFunctionsAndProps, 'globalThis'], // Missing .name property\n  [globalThis, StdoutGlobalPatches, 'globalThis'],     // Missing .name property\n])\n\nconst Extensions = {\n  [AsyncIterableExtensions.key]: AsyncIterableExtensions,\n  [AsyncIteratorExtensions.key]: AsyncIteratorExtensions,\n  [DeferredExtension.key]: DeferredExtension,\n  [DescriptorExtensions.key]: DescriptorExtensions,\n  [EnumExtension.key]: EnumExtension,\n  [EnumerationExtension.key]: EnumerationExtension,\n  [IntrospectorExtensions.key]: IntrospectorExtensions,\n  [IterableExtensions.key]: IterableExtensions,\n  [IteratorExtensions.key]: IteratorExtensions,\n  [ParamParserExtensions.key]: ParamParserExtensions,\n  [PluggableProxyExtensions.key]: PluggableProxyExtensions,\n  [ProxyHandlerExtensions.key]: ProxyHandlerExtensions,\n  [PropertyExtensions.key]: PropertyExtensions,\n  [RefMapExtensions.key]: RefMapExtensions,\n  [RefSetExtensions.key]: RefSetExtensions,\n  [StringConsoleExtension.key]: StringConsoleExtension,\n  [SymkeysExtension.key]: SymkeysExtension,\n  [TypeExtensions.key]: TypeExtensions,\n}\n\nexport const Classes = {}\nfor (const extension of Object.values(Extensions)) {\n  const fnOrClass = extension.class || extension.function\n  if (fnOrClass?.name) {\n    Classes[fnOrClass.name] = fnOrClass\n  }\n}\n\nconst Controls = {}\n\nObject.assign(Controls, {\n  enableAll() {\n    Controls.enablePatches()\n    Controls.enableExtensions()\n  },\n\n  enablePatches() {\n    Patches.forEach((extension) => { extension.apply() })\n  },\n\n  enableStaticPatches(filter = ([owner, extension]) => true) {\n    const patches = StaticPatches.filter(toFilterFn(filter))\n    patches.forEach(([_, extension]) => extension.apply())\n    return patches\n  },\n\n  enableInstancePatches(filter = ([owner, extension]) => true) {\n    const patches = InstancePatches.filter(toFilterFn(filter))\n    patches.forEach(([_, extension]) => extension.apply())\n    return patches\n  },\n\n  enableExtensions() {\n    Object.values(Extensions).forEach((extension) => { extension.apply() })\n  },\n\n  disableAll() {\n    Controls.disablePatches()\n    Controls.disableExtensions()\n  },\n\n  disablePatches() {\n    Patches.forEach((extension) => { extension.revert() })\n  },\n\n  disableStaticPatches(filter = ([owner, extension]) => true) {\n    const patches = StaticPatches.filter(toFilterFn(filter))\n    patches.forEach(([_, extension]) => extension.revert())\n    return patches\n  },\n\n  disableInstancePatches(filter = ([owner, extension]) => true) {\n    const patches = InstancePatches.filter(toFilterFn(filter))\n    patches.forEach(([_, extension]) => extension.revert())\n    return patches\n  },\n\n  disableExtensions() {\n    Object.values(Extensions).forEach((extension) => { extension.revert() })\n  },\n})\n\nexport const all = (() => {\n  const dest = {\n    patches: {},\n    classes: {},\n    global: {},\n  };\n\n  const entriesReducer = (accumulator, [key, entry]) => {\n    const descriptor = new Descriptor(entry.descriptor, entry.owner)\n\n    descriptor.applyTo(accumulator, key, true)\n\n    return accumulator\n  }\n\n  const staticPatchReducer = (accumulator, [_, patch, ownerName]) => {\n    if (!accumulator?.[ownerName]) {\n      accumulator[ownerName] = {}\n    }\n\n    [...patch].reduce(entriesReducer, accumulator[ownerName])\n    return accumulator\n  };\n\n  const instancePatchReducer = (accumulator, [_, patch, ownerName]) => {\n    if (!accumulator?.[ownerName])\n      accumulator[ownerName] = {};\n\n    if (!accumulator[ownerName]?.prototype)\n      accumulator[ownerName].prototype = {};\n\n      [...patch].reduce(entriesReducer, accumulator[ownerName].prototype)\n    return accumulator\n  }\n\n  StaticPatches.reduce(staticPatchReducer, dest.patches);\n  InstancePatches.reduce(instancePatchReducer, dest.patches);\n  (Object.values(Extensions)\n    .flatMap(extension => [...extension])\n    .reduce(entriesReducer, dest.classes)\n  )\n\n  const globals = [...GlobalFunctionsAndProps].concat([...StdoutGlobalPatches])\n\n  for (const [key, entry] of globals) {\n    const descriptor = new Descriptor(entry.descriptor, entry.owner)\n    Object.defineProperty(dest.global, key, descriptor.toObject(true))\n  }\n\n  return dest\n})()\n\nconst results = {\n  ...Controls,\n  all,\n  Controls,\n  Extensions,\n  extensions: Extensions,\n  GlobalFunctionsAndProps,\n  InstancePatches,\n  Patches,\n  patches: Patches,\n  StaticPatches,\n  StdoutGlobalPatches,\n}\n\nexport default results\n\nexport {\n  Extensions,\n  Patches,\n  StaticPatches,\n  InstancePatches,\n  Controls,\n  GlobalFunctionsAndProps,\n}\n\nfunction toFilterFn(filter = ([owner, extension]) => true) {\n  let filterFn = filter\n\n  if (typeof filterFn !== 'function') {\n    const elements = Array.isArray(filter) ? filter : [filter]\n    filterFn = ([owner, _]) => {\n      for (const element of elements) {\n        const elementStr = String(element)\n        if (elementStr.startsWith('^')) {\n          if ((owner?.name ?? owner) != elementStr.substring(1)) {\n            return true\n          }\n        }\n        if ((owner?.name ?? owner) == elementStr) {\n          return true\n        }\n      }\n      return false\n    }\n  }\n\n  return filterFn\n}\n"],
  "mappings": "6FACA,IAAMA,GAASC,GAAK,SAAS,KAAK,OAAO,UAAU,SAAS,KAAKA,CAAC,CAAC,EAAE,CAAC,EAUzDC,GAAN,cAAoC,KAAM,CAS/C,YAAYC,EAAOC,EAAK,CACtB,MAAM,GAAGJ,GAAOG,CAAK,CAAC,6BAA6BC,CAAG,GAAG,EACzD,OAAO,OAAO,KAAM,CAAE,MAAAD,EAAO,IAAAC,CAAI,CAAC,CACpC,CAQA,IAAK,OAAO,WAAW,GAAI,CACzB,OAAO,KAAK,YAAY,IAC1B,CACF,ECjCMJ,GAASC,GAAK,SAAS,KAAK,OAAO,UAAU,SAAS,KAAKA,CAAC,CAA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EACzDG,EAAW,CAAC,CAACF,EAAOI,CAAC,IAAM,CACzB,QAAWC,KAAWF,EAAU,CAC9B,IAAMG,EAAa,OAAOD,CAAO,EAMjC,GALIC,EAAW,WAAW,GAAG,IACtBN,GAAO,MAAQA,IAAUM,EAAW,UAAU,CAAC,IAIjDN,GAAO,MAAQA,IAAUM,EAC5B,MAAO,EAEX,CACA,MAAO,EACT,CACF,CAEA,OAAOJ,CACT",
  "names": ["typeOf", "o", "CannotBeExtendedError", "owner", "key", "MissingOwnerValue", "PatchToggle", "patch", "preventRevert", "task", "toggle", "result", "depth", "options", "inspect", "objName", "status", "PatchEntry", "property", "owningObject", "condition", "descriptorOverrides", "isNullish", "value", "isKey", "types", "f", "isObject", "descriptor", "anotherObject", "bindAccessors", "name", "type", "writable", "Patch", "_Patch", "patches", "patchesOwner", "overrides", "globalCondition", "useOverrides", "useOwner", "error", "acc", "patchEntry", "_", "prettyEntries", "pe", "metrics", "entries", "counts", "oDesc", "#equalDescriptors", "conflicts", "appliedDescriptor", "e", "left", "right", "keys", "entry", "#allPatchesForOwner", "allForOwner", "appliedOnly", "wrapInToggle", "applyOnRequest", "onlyApplied", "accumulator", "usage", "dynName", "dynNameContainer", "applyTo", "fromString", "instance", "store", "symbol", "maybeSymbol", "useStore", "ignored", "string", "__", "prototype", "ownPropNames", "innerKey", "object", "defaultName", "oneOf", "a", "valueOf", "valueOfAsString", "k", "v", "parts", "line", "primitives", "Extension", "_Extension", "keyClassOrFn", "metadata", "extension", "valid", "input", "exprs", "extensions", "extensionValue", "ArrayExtensions", "u", "value", "thenValue", "elseValue", "isThenElse", "pIfArray", "ArrayPrototypeExtensions", "entry", "findFn", "entries", "VALUE", "doubleEqualsOkay", "element", "values", "truthy", "falsy", "keys", "o", "object", "acc", "key", "result", "position", "arrayOfKeys", "arrayOfValues", "defaultValue", "baseDescriptor", "repeatedValue", "_", "descKeys", "descriptor", "useGetter", "index", "bv", "tv", "ev", "isFunction", "_then", "_else", "BigIntExtensions", "u", "which", "values", "num", "value", "thenValue", "elseValue", "isThenElse", "sorter", "l", "r", "n", "pIsBigInt", "pIfBigInt", "BigIntPrototypeExtensions", "minValue", "maxValue", "min", "max", "inclusive", "bv", "tv", "ev", "isFunction", "_then", "_else", "FunctionExtensions", "u", "fn", "descriptors", "acc", "key", "prototypeDescriptors", "value", "stringTag", "thenValue", "elseValue", "isThenElse", "getStringTag", "Class", "protoChain", "getPrototypeChainEntries", "pIsAsyncGenerator", "pIfAsyncGenerator", "pIsAsync", "pIfAsync", "pIsBigArrow", "pIfBigArrow", "pIsBound", "pIfBound", "pIsClass", "pIfClass", "pIsFunction", "pIfFunction", "pIsGenerator", "pIfGenerator", "FunctionPrototypeExtensions", "bv", "tv", "ev", "isFunction", "_then", "_else", "getStringTag", "value", "strict", "getPrototypeChainEntries", "object", "entries", "prototype", "descriptors", "acc", "key", "copy_object_exports", "__export", "COPropertyHandler", "FlexiblyHiddenHandler", "FlexiblyVisibleHandler", "ImmutablyHiddenHandler", "ImmutablyVisibleHandler", "MutablyHiddenHandler", "MutablyVisibleHandler", "VisibilityKeys", "VisibilityScopeHandler", "copyObject", "customCopyObject", "copy_object_default", "kVisibilityKeys", "makeTransducer", "transduceFrom", "transduceFromCOHandler", "tryIgnore", "code", "array", "transform", "into", "accumulator", "element", "key", "value", "result", "_COPropertyHandler", "property", "handler", "descriptor", "destination", "curDescriptor", "flow", "keys", "enumerated", "keyGenerator", "symbolGenerator", "entryGenerator", "entry", "descriptorGenertor", "symbol", "visibilityKey", "dest", "source", "data", "newDescriptor", "existingDescriptor", "overwrite", "allowed", "output", "k", "t", "to", "#singleton", "klass", "deep", "sources", "options", "_options", "_destination", "_sources", "visited", "ccoParseArgs", "err", "isDataDesc", "keyedValue", "condition", "prototype", "descriptors", "replacement", "propertyHandlers", "map", "is", "value", "typeOrClass", "valueType", "valueTag", "typeTag", "bool", "object", "get", "set", "val", "_has", "key", "hasBase", "hasData", "hasAccess", "type", "si", "thenValue", "elseValue", "ifThenElse", "condition", "has", "i", "keys", "as", "use", "primitiveValue", "valueOfValue", "stringValue", "sanitizedStr", "BigInt", "createToolkit", "ifThenElse", "condition", "thenCase", "elseCase", "is", "isClass", "isFunction", "FunctionExtensions", "CustomInspect", "GlobalFunctionsAndProps", "u", "copy_object_exports", "as", "has", "is", "si", "boolValue", "thenValue", "elseValue", "_then", "_else", "object", "classPrototype", "options", "prototype", "toPrimitive", "base", "proto", "klass", "hint", "depth", "opts", "inspect", "stringKey", "numberKey", "targetKey", "property", "isNum", "root", "objects", "descriptor", "o", "k", "parent", "all", "a", "newRoot", "protos", "descriptors", "uniques", "current", "blendedPrototype", "JSONExtensions", "u", "string", "pattern", "notJSON", "decoder", "part", "parts", "isJSON", "detail", "results", "MapExtensions", "u", "value", "thenValue", "elseValue", "isThenElse", "pIsMap", "pIfMap", "MapPrototypeExtensions", "strict", "key", "entryValue", "bv", "tv", "ev", "isFunction", "_then", "_else", "MathExtensions", "u", "values", "sorter", "l", "r", "n", "NumberExtensions", "u", "value", "which", "values", "num", "thenValue", "elseValue", "isThenElse", "numbers", "minValue", "maxValue", "pIsNumber", "pIfNumber", "NumberPrototypeExtensions", "min", "max", "inclusive", "bv", "tv", "ev", "isFunction", "_then", "_else", "Symkeys", "_Symkeys", "named", "associate", "embed", "useDomain", "useSeparator", "useToken", "token", "symName", "symbol", "json", "forSymbol", "replaceWith", "result", "value", "providedName", "domain", "separator", "postfix", "prototype", "map", "_", "target", "property", "receiver", "__", "object", "a", "e", "SymkeysExtension", "S", "JSONToggle", "y", "JSONExtensions", "symkeys", "Symkeys", "SymbolExtensions", "u", "named", "associate", "embed", "useToken", "useDomain", "useSeparator", "forSymbol", "replaceWith", "keyOrValue", "objectName", "objectOwnerName", "is", "v", "k", "ownerName", "token", "value", "allowOnlySymbols", "options", "name", "data", "SymbolPrototypeExtensions", "possibleData", "result", "revertToggle", "toggle", "patch", "mightHave", "index", "parsed", "json", "re", "_match", "shareKey", "sgr", "string", "args", "mightContain", "jsonResponse", "jsonText", "desc", "depth", "inspect", "revert", "detail", "newDescription", "DescriptorUtils", "accessor", "get", "set", "optionsOrConfigurable", "enumerable", "storage", "key", "liaison", "count", "optionKeys", "has", "object", "isObject", "isOpts", "configurable", "initial", "bind", "options", "hasSome", "value", "nullish", "nonFn", "yesFn", "zeroFn", "oneFn", "isTrue", "isFalse", "addRefs", "fn", "_", "skipSet", "_get", "_set", "descriptor", "response", "data", "optionsOrWritable", "valueIsDescriptor", "stats", "writable", "detectDescriptorValues", "isAccessor", "isData", "keyValues", "isDescriptor", "describe", "isKey", "k", "map", "keyValue", "descriptors", "dataBase", "extractBase", "fromObject", "keysToExtract", "defaultIfMissing", "extractDescriptors", "output", "strict", "returnStats", "areBools", "props", "prop", "boolTypes", "areFuncs", "funcTypes", "hasKeyFn", "property", "isOfType", "type", "element", "baseProps", "dataProps", "accessorProps", "anyDescProps", "score", "objKeys", "nonDescKeys", "as", "ifThen", "condition", "args", "isBool", "isFunction", "isDefined", "isObjectKey", "v", "define", "values", "assign", "isAnObject", "asIsObject", "aliases", "alias", "describeMany", "extract", "redescribe", "kAccessorDescriptorKeys", "kDataDescriptorKeys", "kDescriptorKeys", "kSharedDescriptorKeys", "isObject", "o", "hasSome", "object", "keys", "hasQuantity", "quantityFn", "key", "has", "Descriptor", "_Descriptor", "object", "key", "isObject", "isValidKey", "objectMsg", "keyMsg", "isDescriptor", "value", "forKey", "bindAccessors", "descriptor", "depth", "options", "inspect", "hint", "props", "property", "enumerable", "configurable", "accessor", "writable", "data", "wrap", "returnStatsInstead", "objectOrDescriptor", "kSharedDescriptorKeys", "kAccessorDescriptorKeys", "kDataDescriptorKeys", "kDescriptorKeys", "storage", "DescriptorExtensions", "S", "typeOrType", "type", "Class", "notNullish", "o", "isString", "isNumber", "isSymbol", "isValidKey", "o", "isString", "isNumber", "isSymbol", "Property", "_Property", "key", "descriptor", "toObject", "asKey", "k", "baseline", "result", "self", "is", "get", "set", "value", "writable", "colors", "bold", "s", "dim", "red", "green", "blue", "buffer", "keyPresent", "object", "eqeq", "compare", "a", "element", "depth", "options", "inspect", "name", "prototype", "configurable", "enumerable", "storage", "constructor", "present", "props", "basic_accessor", "PropertyExtensions", "S", "initialValue", "symkeys", "SymbolExtensions", "ObjectExtensions", "u", "args", "isDescriptor", "Descriptor", "isObj", "kDescriptorStore", "obj", "key", "value", "_get", "_set", "storage", "storageKey", "_type", "_flag", "_desc", "more", "flag", "props", "store", "storeKey", "makeStore", "get", "set", "is", "innerGet", "innerSet", "to", "getter", "setter", "destination", "sources", "copyObject", "object", "properties", "entries", "prototype", "reducer", "entriesToUse", "entry", "useReducer", "accumulator", "descriptors", "acc", "strict", "has", "owner", "stringTag", "thenValue", "elseValue", "isThenElse", "keys", "defaultValue", "definedAs", "accessorMeta", "descriptorBase", "extraDescriptors", "mapped", "a", "k", "symKey", "suppliedValue", "descriptorRest", "v", "bindAccessors", "result", "descriptor", "p", "Property", "possible", "descriptorOrDataOrAccessorArgs", "rest", "sorted", "b", "property", "as", "si", "pIsObject", "pIfObject", "pIsNullDefined", "pIfNullDefined", "pIsPrimitive", "pIfPrimitive", "pIsValidKey", "pIfValidKey", "pHasStringTag", "pGetStringTag", "pStripTo", "ObjectPrototypeExtensions", "_ignored", "bv", "tv", "ev", "_then", "_else", "ReflectExtensions", "u", "object", "keys", "key", "has", "isObject", "owner", "variants", "applyVariants", "descriptor", "isValidKey", "value", "result", "type", "thisArg", "entries", "acc", "position", "RegExpExtensions", "u", "greedy", "includeNewlines", "string", "strings", "symbols", "locale", "known", "has", "code", "symbol", "opts", "currency", "fmt", "place", "instance", "self", "SetExtensions", "u", "value", "thenValue", "elseValue", "isThenElse", "pIsSet", "SetPrototypeExtensions", "iterables", "iterable", "element", "everyFn", "thisArg", "found", "findFn", "mapFn", "transformed", "reduceFn", "initialValue", "accumulator", "someFn", "bv", "tv", "ev", "isFunction", "_then", "_else", "parenthesisPair", "StringExtensions", "u", "value", "thenValue", "elseValue", "isThenElse", "prefix", "hex", "red", "green", "blue", "force", "alpha", "message", "useModes", "colors", "a", "color", "c", "arrayifyString", "s", "results", "i", "modes", "sgrModes", "mode", "codes", "open", "close", "_isColor", "colorIndex", "onOrder", "key", "offOrder", "result", "depth", "options", "inspect", "objectOrLines", "colorProperties", "indent", "indentCharacter", "inspector", "lineEnding", "maxLen", "perLine", "perLinePerProperty", "preProcess", "preReturn", "separator", "tab", "sgr", "validMapper", "f", "line", "getElements", "values", "context", "finalLines", "acc", "nextProp", "ifCombined", "lineProps", "index", "array", "sgrArgs", "v", "pIsString", "pIfString", "StringPrototypeExtensions", "offset", "tokens", "openToken", "closeToken", "start", "end", "leadingToken", "firstToken", "char", "lRange", "leading", "reversedLeadingToken", "sliceRange", "fn", "thisArg", "string", "bv", "tv", "ev", "isFunction", "_then", "_else", "Deferred", "_Deferred", "#promise", "#reject", "#resolve", "#rejected", "#resolved", "#settled", "options", "config", "_resolve", "_reject", "resolve", "reject", "value", "reason", "depth", "inspect", "executor", "DeferredExtension", "S", "hasProcess", "captureStdout", "callback", "args", "thisArg", "captured", "originalWrite", "newArgs", "chunk", "encoding", "StringConsole", "_StringConsole", "captureOutput", "initialContents", "range", "lines", "joinOn", "groupName", "invocations", "commands", "buffer", "invocation", "level", "#console", "key", "value", "styles", "string", "options", "Colors", "Styles", "Pens", "Levels", "useColors", "useRGB", "pens", "p0", "p1", "s", "addlStyles", "c0", "c1", "c", "i", "before", "after", "style", "arg", "group", "SC", "StringConsoleExtension", "S", "StdoutGlobalPatches", "u", "Enum", "name", "values", "properties", "enumeration", "makeBaseEnum", "makeEnumValue", "property", "enumValue", "data", "depth", "options", "inspect", "_options", "_value", "accessor", "to", "toObj", "kName", "hasAndIs", "o", "isLEnum", "isREnum", "lReal", "lValue", "lName", "lType", "rReal", "rValue", "rName", "rType", "hint", "original", "type", "fromPrimitive", "value", "str", "asString", "kValueProps", "kCustomPropKeys", "props", "entries", "e", "applyPropertiesOf", "object", "baseDescriptor", "descriptors", "key", "subvalue", "stats", "isDescriptor", "baseStats", "valueType", "response", "wasArray", "elements", "maker", "initialValue", "storage", "realValue", "_opts", "associatedValue", "_prop", "valueProps", "enumResponse", "proxy", "target", "_property", "receiver", "dataValue", "EnumExtension", "S", "as", "_", "__", "___", "valueText", "possibleEnumValue", "enumValueType", "enumValueName", "thisEnumName", "thisEnumKeys", "is", "v", "type", "Enumeration", "key", "value", "acceptUndefinedValue", "SubscriptProxy", "entries", "associations", "entry", "variantCase", "someCase", "hint", "instance", "present", "missing", "resolvePresent", "caseValue", "resolveMissing", "_", "leftCase", "rightCase", "customizeInstance", "caseName", "newInstance", "descriptors", "keys", "proxied", "has", "object", "property", "target", "receiver", "newValue", "EnumerationExtension", "S", "Enumeration", "Introspector", "array", "toEntriesFrom", "owner", "accumulator", "key", "count", "value", "error", "keys", "entries", "metadata", "v", "t", "d", "typeNameOrTyperFn", "regExp", "searchClass", "searchFunction", "typer", "type", "typeName", "descriptor", "names", "bound", "a", "n", "classes", "functions", "objects", "properties", "symbols", "accessors", "result", "reportName", "IntrospectorExtensions", "S", "Iterable", "#elements", "elementsOrFirstElement", "moreElements", "element", "value", "Iterator", "_Iterator", "#mapEach", "iterable", "mapEach", "#iterable", "#iterator", "input", "output", "object", "keyFetcher", "keys", "entries", "key", "IterableExtensions", "S", "IteratorExtensions", "ParamParser", "_ParamParser", "parameters", "validator", "parser", "args", "parsers", "throwOnFail", "success", "result", "Parser", "ParamParserExtensions", "S", "toStringTag", "hasInstance", "ProxyHandlerResponse", "success", "value", "context", "instance", "ProxyHandler", "_ProxyHandler", "handler", "type", "args", "result", "error", "proxyHandlerType", "names", "name", "element", "PluggableProxy", "_PluggableProxy", "Class", "handlers", "options", "validHandlers", "h", "typeName", "handlersOfType", "target", "types", "failures", "thisArg", "argumentsList", "_fails", "_args", "key", "descriptor", "property", "receiver", "prototype", "ProxyHandlerExtensions", "S", "PluggableProxyExtensions", "PluggableProxyExtensionSet", "WeakRefExtensions", "u", "value", "isObject", "isNullDefined", "isValidKey", "ObjectExtensions", "isRegistered", "SymbolExtensions", "isValidReference", "WeakRefExtensions", "RefMap", "_RefMap", "#objectifyValues", "args", "setObjectification", "object", "key", "value", "useKey", "useValue", "defaultValue", "ref", "entries", "Iterable", "forEach", "entry", "dereferenced", "entriesIterator", "Iterator", "forEachFn", "thisArg", "strict", "_", "filterFn", "resultingEntries", "findFn", "result", "mapFn", "toRefMap", "mirrorObjectification", "errors", "needsObjectification", "detectNeed", "objectify", "VALUE", "transformed", "RefMapExtensions", "S", "RefSet", "_RefSet", "#objectifyValues", "setObjectification", "value", "values", "ref", "_", "forEachFn", "thisArg", "set", "dereferenced", "item", "dereferencedValue", "filterFn", "results", "findFn", "mapFn", "toRefSet", "mirrorObjectification", "mapped", "validRefSetOutput", "validRefSetOutputIfObjectified", "mappedItem", "#validWeakRefTarget", "RefSetExtensions", "S", "Type", "_Type", "value", "ofType", "tag", "mapped", "name", "type", "Introspector", "TypeExtensions", "S", "AsyncIterable", "#elements", "elementsOrFirstElement", "moreElements", "element", "value", "AsyncIterator", "asyncIterable", "#asyncIterable", "#asyncIterator", "array", "result", "AsyncIterableExtensions", "S", "AsyncIteratorExtensions", "StaticPatches", "ArrayExtensions", "BigIntExtensions", "FunctionExtensions", "JSONExtensions", "MapExtensions", "MathExtensions", "NumberExtensions", "ObjectExtensions", "ReflectExtensions", "RegExpExtensions", "SetExtensions", "StringExtensions", "SymbolExtensions", "InstancePatches", "ArrayPrototypeExtensions", "BigIntPrototypeExtensions", "FunctionPrototypeExtensions", "MapPrototypeExtensions", "NumberPrototypeExtensions", "ObjectPrototypeExtensions", "SetPrototypeExtensions", "StringPrototypeExtensions", "SymbolPrototypeExtensions", "Patches", "GlobalFunctionsAndProps", "StdoutGlobalPatches", "Extensions", "AsyncIterableExtensions", "AsyncIteratorExtensions", "DeferredExtension", "DescriptorExtensions", "EnumExtension", "EnumerationExtension", "IntrospectorExtensions", "IterableExtensions", "IteratorExtensions", "ParamParserExtensions", "PluggableProxyExtensions", "ProxyHandlerExtensions", "PropertyExtensions", "RefMapExtensions", "RefSetExtensions", "StringConsoleExtension", "SymkeysExtension", "TypeExtensions", "Classes", "extension", "fnOrClass", "Controls", "filter", "owner", "patches", "toFilterFn", "_", "all", "dest", "entriesReducer", "accumulator", "key", "entry", "Descriptor", "staticPatchReducer", "patch", "ownerName", "instancePatchReducer", "globals", "descriptor", "results", "index_default", "toFilterFn", "filter", "owner", "extension", "filterFn", "elements", "_", "element", "elementStr"]
}
