@poe-platform/safe-js 0.1.319 → 0.1.320

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-CYVI4ZUK.js";
30
+ } from "./chunk-J5UIUYUC.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8249,4 +8249,4 @@ export {
8249
8249
  parseMcpConfig,
8250
8250
  makeMcpModule
8251
8251
  };
8252
- //# sourceMappingURL=chunk-ZXUROMXW.js.map
8252
+ //# sourceMappingURL=chunk-3KICEWDS.js.map
@@ -25123,6 +25123,7 @@ function createBigIntGlobal(budget) {
25123
25123
 
25124
25124
  // packages/safe-js/src/interp/globals/array-buffer.ts
25125
25125
  var resizeBuffer2 = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "resize").value;
25126
+ var detachedBuffer = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "detached").get;
25126
25127
  function createArrayBufferGlobal(budget) {
25127
25128
  const prototype = /* @__PURE__ */ Object.create(null);
25128
25129
  const constructor = createSandboxClosure({
@@ -25190,6 +25191,78 @@ function createArrayBufferGlobal(budget) {
25190
25191
  [Symbol.toStringTag]: { value: "ArrayBuffer", configurable: true }
25191
25192
  });
25192
25193
  const getters = [];
25194
+ const species = createSandboxClosure({
25195
+ guest: true,
25196
+ sandbox: true,
25197
+ name: "get [Symbol.species]",
25198
+ length: 0,
25199
+ call: (_args, context) => context?.thisValue
25200
+ });
25201
+ getters.push(species);
25202
+ Object.defineProperty(materializeFunctionProperties(constructor), Symbol.species, {
25203
+ get: accessorAdapter(species, "get"),
25204
+ configurable: true
25205
+ });
25206
+ Object.defineProperty(prototype, "slice", {
25207
+ writable: true,
25208
+ configurable: true,
25209
+ value: createSandboxClosure({
25210
+ guest: true,
25211
+ sandbox: true,
25212
+ name: "slice",
25213
+ length: 2,
25214
+ call: async (args, context) => {
25215
+ const receiver = context?.thisValue;
25216
+ if (!isSandboxArrayBuffer(receiver)) throw new TypeError("ArrayBuffer slice requires a buffer receiver.");
25217
+ if (Reflect.apply(detachedBuffer, receiver, [])) throw new TypeError("Cannot slice a detached ArrayBuffer.");
25218
+ const length = arrayBufferLength(receiver);
25219
+ let candidate;
25220
+ let result;
25221
+ const bridge = {
25222
+ ...context,
25223
+ stack: context?.stack ?? [],
25224
+ thisValue: receiver,
25225
+ getProperty: context?.getProperty ?? ((value, key) => {
25226
+ const descriptor = getSandboxPropertyDescriptor(value, key, budget);
25227
+ return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, bridge);
25228
+ }),
25229
+ invokeClosure: context?.invokeClosure ?? ((callee, values, thisValue, construct) => invokeBuiltinClosure(callee, values, budget, context, thisValue, construct))
25230
+ };
25231
+ const release = retainValues(budget, () => [receiver, candidate, result, ...args]);
25232
+ const clamp = (number) => {
25233
+ const integer2 = Number.isNaN(number) ? 0 : Math.trunc(number);
25234
+ return integer2 < 0 ? Math.max(length + integer2, 0) : Math.min(integer2, length);
25235
+ };
25236
+ try {
25237
+ const start = clamp(await sandboxNumber(args[0], budget, bridge));
25238
+ const end = args[1] === void 0 ? length : clamp(await sandboxNumber(args[1], budget, bridge));
25239
+ const size = Math.max(end - start, 0);
25240
+ candidate = await bridge.getProperty(receiver, "constructor");
25241
+ if (candidate !== void 0) {
25242
+ if (candidate === null || typeof candidate !== "object")
25243
+ throw new TypeError("ArrayBuffer constructor must be an object.");
25244
+ candidate = await bridge.getProperty(candidate, Symbol.species);
25245
+ if (candidate !== void 0 && candidate !== null && (!isSandboxClosure(candidate) || candidate.construct === void 0))
25246
+ throw new TypeError("ArrayBuffer species must be a constructor.");
25247
+ }
25248
+ if (candidate === void 0 || candidate === null || candidate === constructor) {
25249
+ budget.allocateArrayLength(size);
25250
+ budget.provisionDataUsage(size + 1)();
25251
+ result = new ArrayBuffer(size);
25252
+ setSandboxPrototype(result, prototype, budget);
25253
+ } else result = await invokeBuiltinClosure(candidate, [size], budget, bridge, void 0, true);
25254
+ if (!isSandboxArrayBuffer(result) || Reflect.apply(detachedBuffer, result, []) || result === receiver || arrayBufferLength(result) < size)
25255
+ throw new TypeError("ArrayBuffer species must return distinct sufficient buffer storage.");
25256
+ if (Reflect.apply(detachedBuffer, receiver, [])) throw new TypeError("Cannot slice a detached ArrayBuffer.");
25257
+ const count = Math.min(size, Math.max(arrayBufferLength(receiver) - start, 0));
25258
+ if (count > 0) new Uint8Array(result, 0, count).set(new Uint8Array(receiver, start, count));
25259
+ return result;
25260
+ } finally {
25261
+ release();
25262
+ }
25263
+ }
25264
+ })
25265
+ });
25193
25266
  Object.defineProperty(prototype, "resize", {
25194
25267
  writable: true,
25195
25268
  configurable: true,
@@ -42265,4 +42338,4 @@ export {
42265
42338
  FileSnapshotBackend,
42266
42339
  run
42267
42340
  };
42268
- //# sourceMappingURL=chunk-CYVI4ZUK.js.map
42341
+ //# sourceMappingURL=chunk-J5UIUYUC.js.map