+  const { get: wmGet, set: wmSet } = WeakMap.prototype;
+  const wsConstructor = WeakSet;
+  const { add: wsAdd, has: wsHas } = WeakSet.prototype;
+  const proxyConstructorValuesMap = new WeakMap();
+  const registerConstructedProxy = (constructor, proxy) => {
+    const values = (() => {
+      const existing = reflectApply(wmGet, proxyConstructorValuesMap, [
+        constructor,
+      ]);
+      if (existing) {
+        // There is an existing values set for this constructor.
+        //
+        // It is returned.
+        return existing;
+      } else {
+        // There is no existing values set for this constructor so one
+        // must be created.
+        const result = new wsConstructor();
+        reflectApply(wmSet, proxyConstructorValuesMap, [
+          constructor,
+          result,
+        ]);
+        return result;
+      }
+    })();
+    reflectApply(wsAdd, values, [proxy]);
+    return proxy;
+  };
+  const applyBaseFunction = ($, base, lengthDelta = 0) => {
+    if (base === UNDEFINED) {
+      // No base function was provided to apply.
+      return $;
+    } else {
+      // A base function was provided.
+      //
+      // Apply it.
+      const overrides = objectCreate(null);
+      overrides.length = +base.length + lengthDelta;
+      overrides.name = base.name;
+      if (getPrototype($) === functionPrototype) {
+        // The provided function has the function prototype.
+        //
+        // Change it to match the base function.
+        setPrototype($, getPrototype(base));
+      } else {
+        // The provided function already does not have the function
+        // prototype, so its prototype is not changed.
+        /* do nothing */
+      }
+      if (hasOwnProperty($, "prototype") && "prototype" in base) {
+        // The provided function has a `.prototype´ property, and one
+        // was provided in the base function as well.
+        try {
+          // If this does not throw, the provided function is a
+          // constructor. Its `.prototype´ property is set alongside
+          // the others.
+          reflectConstruct(function () {}, [], $);
+          overrides.prototype = base.prototype;
+        } catch {
+          // The provided function is not a constructor.
+          /* do nothing */
+        }
+      } else {
+        // The provided function does not have a `.prototype´ property,
+        // or the base function did not have one.
+        /* do nothing */
+      }
+      return applyProperties($, overrides);
+    }
+  };
+  const applyProperties = ($, override) => {
+    if (override === UNDEFINED) {
+      // No properties were provided to apply.
+      return $;
+    } else {
+      // Properties were provided.
+      //
+      // Apply them.
+      const { length, name } = override;
+      if (
+        !("prototype" in override)
+        || !getOwnPropertyDescriptor($, "prototype")?.writable
+      ) {
+        // The provided function has no `.prototype´, its prototype is
+        // not writable, or no prototype value was provided.
+        //
+        // Do not modify the prototype property of the provided
+        // function.
+        /* do nothing */
+      } else {
+        // The provided function has a writable `.prototype´ and a
+        // prototype value was provided.
+        //
+        // Change the prototype property of the provided function to
+        // match.
+        defineOwnProperty(
+          $,
+          "prototype",
+          defineOwnDataProperty(
+            objectCreate(null),
+            "value",
+            override.prototype,
+          ),
+        );
+      }
+      return defineOwnProperties($, {
+        length: defineOwnDataProperty(
+          objectCreate(null),
+          "value",
+          toLength(length === UNDEFINED ? $.length : length),
+        ),
+        name: defineOwnDataProperty(
+          objectCreate(null),
+          "value",
+          toFunctionName(name === UNDEFINED ? $.name ?? "" : name),
+        ),
+      });
+    }
+  };
+