@poe-platform/safe-js 0.1.311 → 0.1.312

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-GWV7ELQW.js";
30
+ } from "./chunk-UKPTA2FY.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-7LBVMJQT.js.map
8252
+ //# sourceMappingURL=chunk-DXPIMJKO.js.map
@@ -14557,7 +14557,7 @@ function createFloat32ArrayGlobal(budget, nativePrototype = false) {
14557
14557
  const prototype = candidate !== null && typeof candidate === "object" ? candidate : float32Prototypes.get(budget);
14558
14558
  const release = retainValues(budget, () => [prototype, ...args]);
14559
14559
  try {
14560
- const result = allocateFloat32Array(args[0], budget);
14560
+ const result = args[0] !== null && typeof args[0] === "object" && !isFloat32Array(args[0]) ? await allocateFloat32Input(args[0], budget, context) : allocateFloat32Array(args[0], budget);
14561
14561
  setSandboxPrototype(result, prototype, budget);
14562
14562
  return result;
14563
14563
  } finally {
@@ -14569,6 +14569,57 @@ function createFloat32ArrayGlobal(budget, nativePrototype = false) {
14569
14569
  constructors.add(constructor);
14570
14570
  return constructor;
14571
14571
  }
14572
+ async function allocateFloat32Input(source, budget, context) {
14573
+ const callerContext = context;
14574
+ const bridge = {
14575
+ ...callerContext,
14576
+ stack: callerContext?.stack ?? [],
14577
+ thisValue: void 0,
14578
+ getProperty: callerContext?.getProperty ?? ((value, key) => {
14579
+ const descriptor = getSandboxPropertyDescriptor(value, key, budget);
14580
+ return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, bridge);
14581
+ }),
14582
+ invokeClosure: callerContext?.invokeClosure ?? ((callee, values2, receiver, construct) => invokeBuiltinClosure(callee, values2, budget, callerContext, receiver, construct))
14583
+ };
14584
+ const values = [];
14585
+ let iterator;
14586
+ let current;
14587
+ let result;
14588
+ const release = retainValues(budget, () => [source, values, iterator?.retainedValue, current, result]);
14589
+ const checkData = createDataCheckpoint(budget, bridge);
14590
+ try {
14591
+ iterator = await acquireSandboxIterator(source, budget, bridge);
14592
+ let length;
14593
+ if (iterator !== void 0) {
14594
+ while (true) {
14595
+ budget.visitNode();
14596
+ const next = await iterator.next();
14597
+ if (typeof next !== "object" || next === null) throw new TypeError("Iterator result must be an object.");
14598
+ if ((await readIteratorResult(iterator, next, "done")).value) break;
14599
+ current = (await readIteratorResult(iterator, next, "value")).value;
14600
+ budget.allocateArrayLength(values.length + 1);
14601
+ values.push(current);
14602
+ checkData(values, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([current])));
14603
+ }
14604
+ length = values.length;
14605
+ } else {
14606
+ current = await bridge.getProperty(source, "length");
14607
+ const number = await sandboxNumber(current, budget, bridge);
14608
+ length = Number.isNaN(number) || number <= 0 ? 0 : Math.min(Math.trunc(number), Number.MAX_SAFE_INTEGER);
14609
+ }
14610
+ checkFloat32Allocation(length, budget);
14611
+ result = new Float32Array(length);
14612
+ checkData(result, 0, true);
14613
+ for (let index = 0; index < length; index++) {
14614
+ budget.visitNode();
14615
+ current = iterator === void 0 ? await bridge.getProperty(source, String(index)) : values[index];
14616
+ result[index] = await sandboxNumber(current, budget, bridge);
14617
+ }
14618
+ return result;
14619
+ } finally {
14620
+ release();
14621
+ }
14622
+ }
14572
14623
  function allocateFloat32Array(source, budget) {
14573
14624
  if (Array.isArray(source) || isFloat32Array(source)) {
14574
14625
  const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
@@ -41741,4 +41792,4 @@ export {
41741
41792
  FileSnapshotBackend,
41742
41793
  run
41743
41794
  };
41744
- //# sourceMappingURL=chunk-GWV7ELQW.js.map
41795
+ //# sourceMappingURL=chunk-UKPTA2FY.js.map