@poe-platform/safe-js 0.1.324 → 0.1.325

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14883,7 +14883,7 @@ function createFloat32ArrayPrototypes(budget, constructor) {
14883
14883
  getters.push(getter);
14884
14884
  Object.defineProperty(shared, key, { get: accessorAdapter(getter, "get"), configurable: true });
14885
14885
  }
14886
- for (const key of ["set", "slice", "subarray", "fill"])
14886
+ for (const key of ["set", "slice", "subarray", "fill", "copyWithin"])
14887
14887
  Object.defineProperty(shared, key, { value: getFloat32Member(new Float32Array(0), key, budget, constructor), writable: true, configurable: true });
14888
14888
  const arrayPrototype = resolveIntrinsicIdentity(budget, '["Array","prototype"]');
14889
14889
  Object.defineProperty(shared, "toString", { value: getSandboxDataProperty(arrayPrototype, "toString", budget), writable: true, configurable: true });
@@ -14965,7 +14965,7 @@ function getFloat32Member(value, property, budget, defaultConstructor) {
14965
14965
  if (key === "byteLength") return storage.length * 4;
14966
14966
  if (key === "byteOffset") return storage.byteOffset;
14967
14967
  if (key === "BYTES_PER_ELEMENT") return 4;
14968
- if (!["set", "slice", "subarray", "fill"].includes(key)) return void 0;
14968
+ if (!["set", "slice", "subarray", "fill", "copyWithin"].includes(key)) return void 0;
14969
14969
  return createSandboxClosure({
14970
14970
  guest: true,
14971
14971
  sandbox: true,
@@ -14975,7 +14975,7 @@ function getFloat32Member(value, property, budget, defaultConstructor) {
14975
14975
  const receiver = context?.thisValue;
14976
14976
  if (!isFloat32Array(receiver))
14977
14977
  throw new TypeError(`Float32Array#${key} requires a Float32Array receiver.`);
14978
- const storage2 = float32Storage(receiver, key === "slice" || key === "fill");
14978
+ const storage2 = float32Storage(receiver, key === "slice" || key === "fill" || key === "copyWithin");
14979
14979
  const bridge = {
14980
14980
  ...context,
14981
14981
  stack: context?.stack ?? [],
@@ -14986,6 +14986,36 @@ function getFloat32Member(value, property, budget, defaultConstructor) {
14986
14986
  }),
14987
14987
  invokeClosure: context?.invokeClosure ?? ((callee, values, thisValue, construct) => invokeBuiltinClosure(callee, values, budget, context, thisValue, construct))
14988
14988
  };
14989
+ if (key === "copyWithin") {
14990
+ return (async () => {
14991
+ const release = retainValues(budget, () => [receiver, ...args]);
14992
+ try {
14993
+ const target = relativeIndex(await sandboxNumber(args[0], budget, bridge), storage2.length);
14994
+ const start = relativeIndex(await sandboxNumber(args[1], budget, bridge), storage2.length);
14995
+ const end = args[2] === void 0 ? storage2.length : relativeIndex(await sandboxNumber(args[2], budget, bridge), storage2.length);
14996
+ let count = Math.min(end - start, storage2.length - target);
14997
+ if (count > 0) {
14998
+ const current = float32Storage(receiver, true);
14999
+ count = Math.min(count, current.length - start, current.length - target);
15000
+ if (count > 0) {
15001
+ const bytes = new Uint8Array(current.buffer, current.byteOffset, current.length * 4);
15002
+ const direction = start < target && target < start + count ? -1 : 1;
15003
+ let from = start * 4 + (direction < 0 ? count * 4 - 1 : 0);
15004
+ let to = target * 4 + (direction < 0 ? count * 4 - 1 : 0);
15005
+ for (let remaining = count * 4; remaining > 0; remaining--) {
15006
+ budget.visitNode();
15007
+ bytes[to] = bytes[from];
15008
+ from += direction;
15009
+ to += direction;
15010
+ }
15011
+ }
15012
+ }
15013
+ return receiver;
15014
+ } finally {
15015
+ release();
15016
+ }
15017
+ })();
15018
+ }
14989
15019
  if (key === "fill") {
14990
15020
  return (async () => {
14991
15021
  const release = retainValues(budget, () => [receiver, ...args]);
@@ -42364,4 +42394,4 @@ export {
42364
42394
  FileSnapshotBackend,
42365
42395
  run
42366
42396
  };
42367
- //# sourceMappingURL=chunk-CMWXZ76K.js.map
42397
+ //# sourceMappingURL=chunk-6YOMKQ6K.js.map