@poe-platform/safe-js 0.1.307 → 0.1.309

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.
@@ -6835,13 +6835,20 @@ function float32Storage(value) {
6835
6835
  byteLength: Reflect.apply(bufferLength, buffer, [])
6836
6836
  };
6837
6837
  }
6838
+ function float32Properties(value) {
6839
+ const properties = [];
6840
+ for (const key of Reflect.ownKeys(value)) {
6841
+ if (typeof key === "string" && isFloat32Index(key)) continue;
6842
+ properties.push([key, Object.getOwnPropertyDescriptor(value, key)]);
6843
+ }
6844
+ return properties;
6845
+ }
6838
6846
  function float32DataProperties(value) {
6839
6847
  if (Object.getOwnPropertySymbols(value).length > 0)
6840
6848
  throw new TypeError("Float32Array symbol properties are not supported.");
6841
6849
  const properties = [];
6842
- for (const key of Object.getOwnPropertyNames(value)) {
6843
- if (isFloat32Index(key)) continue;
6844
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
6850
+ for (const [key, descriptor] of float32Properties(value)) {
6851
+ if (typeof key !== "string") throw new TypeError("Float32Array symbol properties are not supported.");
6845
6852
  if (!("value" in descriptor))
6846
6853
  throw new TypeError(`Float32Array accessor property '${key}' is not supported.`);
6847
6854
  properties.push([key, descriptor]);
@@ -7865,6 +7872,9 @@ function namedKeys(state) {
7865
7872
  // packages/safe-js/src/interp/error-prototypes.ts
7866
7873
  var errorPrototypes = /* @__PURE__ */ new WeakMap();
7867
7874
 
7875
+ // packages/safe-js/src/interp/float32-prototypes.ts
7876
+ var float32Prototypes = /* @__PURE__ */ new WeakMap();
7877
+
7868
7878
  // packages/safe-js/src/interp/object-model.ts
7869
7879
  var guestClosures = /* @__PURE__ */ new WeakSet();
7870
7880
  var functionProperties = /* @__PURE__ */ new WeakMap();
@@ -8090,11 +8100,13 @@ function releaseObjectPrototype(budget) {
8090
8100
  functionPrototypes.delete(budget);
8091
8101
  generatorPrototypes.delete(budget);
8092
8102
  errorPrototypes.delete(budget);
8103
+ float32Prototypes.delete(budget);
8093
8104
  initialRegexDescriptors.delete(budget);
8094
8105
  intrinsicPrototypes.delete(budget);
8095
8106
  }
8096
8107
  function getSandboxPrototype(value, budget) {
8097
8108
  if (prototypes.has(value)) return prototypes.get(value) ?? null;
8109
+ if (isFloat32Array(value)) return budget === void 0 ? null : float32Prototypes.get(budget) ?? null;
8098
8110
  const errorType = sandboxErrorTypes.get(value);
8099
8111
  if (budget !== void 0 && errorType !== void 0) {
8100
8112
  const prototype = errorPrototypes.get(budget)?.get(errorType);
@@ -8127,6 +8139,8 @@ function getSandboxPropertyDescriptor(value, key, budget) {
8127
8139
  let current = value;
8128
8140
  let depth = 0;
8129
8141
  while (typeof current === "object" && current !== null && (Array.isArray(current) || isSandboxGenerator(current) || isSandboxDate(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxMap(current) || isSandboxSet(current) || isPrototypeRecord(current))) {
8142
+ if (isFloat32Array(current) && typeof key !== "symbol" && isFloat32Index(String(key)))
8143
+ return Object.getOwnPropertyDescriptor(current, key);
8130
8144
  const properties = isSandboxGenerator(current) ? getGeneratorProperties(current) : isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? key === "prototype" && current.construct !== void 0 && current.boundTarget === void 0 ? materializeFunctionProperties(current) : getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
8131
8145
  if (properties === void 0 && isGuestClosure(current) && (key === "name" || key === "length"))
8132
8146
  return {
@@ -8149,6 +8163,8 @@ function getSandboxDataProperty(value, key, budget) {
8149
8163
  let current = value;
8150
8164
  let depth = 0;
8151
8165
  while (typeof current === "object" && current !== null) {
8166
+ if (isFloat32Array(current) && typeof key !== "symbol" && isFloat32Index(String(key)))
8167
+ return Object.getOwnPropertyDescriptor(current, key)?.value;
8152
8168
  if (isGuestHostObject(current)) return typeof key === "symbol" ? void 0 : getHostObjectMember(current, String(key));
8153
8169
  if (isSandboxRegex(current)) return Object.getOwnPropertyDescriptor(getRegexProperties(current), key)?.value;
8154
8170
  if (isSandboxPromise(current)) return Object.getOwnPropertyDescriptor(getPromiseProperties(current), key)?.value;
@@ -8200,6 +8216,7 @@ function setSandboxPrototype(value, prototype, budget) {
8200
8216
  prototypes.set(value, prototype);
8201
8217
  }
8202
8218
  function isPrototypeRecord(value) {
8219
+ if (isFloat32Array(value)) return true;
8203
8220
  if (isGuestClosure(value)) return true;
8204
8221
  if (isGuestHostObject(value)) return false;
8205
8222
  if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxPromise(value) || isSandboxRegex(value) || isSandboxSet(value))
@@ -8219,7 +8236,7 @@ function hasGuestObjectState(value) {
8219
8236
  if (isLiveCapability(value)) return true;
8220
8237
  if (functionProperties.has(value) || prototypes.has(value) && !hasNullObjectPrototype(value)) return true;
8221
8238
  if (isSandboxBox(value) || isSandboxDate(value)) return false;
8222
- return descriptorObjects.has(value) && Object.values(Object.getOwnPropertyDescriptors(value)).some(
8239
+ return descriptorObjects.has(value) && (isFloat32Array(value) ? float32Properties(value).map(([, descriptor]) => descriptor) : Object.values(Object.getOwnPropertyDescriptors(value))).some(
8223
8240
  (descriptor) => !descriptor.enumerable || !descriptor.configurable || !descriptor.writable
8224
8241
  );
8225
8242
  }
@@ -9535,7 +9552,7 @@ async function readIteratorResult(iterator, result, property) {
9535
9552
  }
9536
9553
  function getSandboxAsyncIterator(value, budget, context, signal) {
9537
9554
  if (isSandboxGenerator(value) && value.async) {
9538
- return hasExplicitSandboxPrototype(value) ? context?.getProperty === void 0 ? generatorProtocolAdapter(value, budget, context, true, signal) : void 0 : { ...generatorObjectIterator(value, budget, context), asyncProtocol: true };
9555
+ return hasExplicitSandboxPrototype(value) ? context?.getProperty === void 0 ? guestProtocolAdapter(value, budget, context, true, signal) : void 0 : { ...generatorObjectIterator(value, budget, context), asyncProtocol: true };
9539
9556
  }
9540
9557
  if (value !== null && (typeof value === "object" || typeof value === "function") && !isGuestHostObject(value)) {
9541
9558
  const method = value[Symbol.asyncIterator];
@@ -9682,11 +9699,15 @@ function getSandboxIterator(value, budget, context) {
9682
9699
  }
9683
9700
  if (isGuestHostObject(value)) return getHostObjectIterator(value);
9684
9701
  if (isFloat32Array(value)) {
9702
+ if (hasExplicitSandboxPrototype(value) || budget !== void 0 && float32Prototypes.has(budget)) {
9703
+ if (getSandboxPropertyDescriptor(value, Symbol.iterator, budget) === void 0) return void 0;
9704
+ return guestProtocolAdapter(value, budget ?? new Budget(), context, false);
9705
+ }
9685
9706
  return syncIterator(Float32Array.prototype.values.call(value));
9686
9707
  }
9687
9708
  if (isSandboxGenerator(value)) {
9688
9709
  if (value.async) return void 0;
9689
- if (hasExplicitSandboxPrototype(value)) return context?.getProperty === void 0 ? generatorProtocolAdapter(value, budget ?? new Budget(), context, false) : void 0;
9710
+ if (hasExplicitSandboxPrototype(value)) return context?.getProperty === void 0 ? guestProtocolAdapter(value, budget ?? new Budget(), context, false) : void 0;
9690
9711
  return generatorObjectIterator(value, budget, context);
9691
9712
  }
9692
9713
  if (typeof value === "string") {
@@ -9764,7 +9785,7 @@ function collectionIterator(collection, value) {
9764
9785
  return adapter;
9765
9786
  }
9766
9787
  var asyncGeneratorRequests = /* @__PURE__ */ new WeakMap();
9767
- function generatorProtocolAdapter(value, budget, context, asyncProtocol, signal) {
9788
+ function guestProtocolAdapter(value, budget, context, asyncProtocol, signal) {
9768
9789
  const bridge = {
9769
9790
  ...context,
9770
9791
  stack: context?.stack ?? [],
@@ -9778,7 +9799,7 @@ function generatorProtocolAdapter(value, budget, context, asyncProtocol, signal)
9778
9799
  let resolved;
9779
9800
  let pending;
9780
9801
  const initialize = () => pending ??= acquireSandboxIterator(value, budget, bridge, asyncProtocol, signal).then((iterator) => {
9781
- if (iterator === void 0) throw new TypeError("Generator does not provide an iterator protocol.");
9802
+ if (iterator === void 0) throw new TypeError("Value does not provide an iterator protocol.");
9782
9803
  return resolved = iterator;
9783
9804
  });
9784
9805
  return {
@@ -13649,8 +13670,8 @@ async function definePropertiesFromObject(target, descriptors2, budget, context)
13649
13670
  }
13650
13671
  function defineDataProperty(target, key, descriptor, budget) {
13651
13672
  budget.visitNode();
13652
- if (isFloat32Array(target))
13653
- throw new TypeError("Typed array property descriptors are not supported.");
13673
+ if (isFloat32Array(target) && typeof key !== "symbol" && isFloat32Index(String(key)) && "value" in descriptor)
13674
+ descriptor = { ...descriptor, value: float32Number(descriptor.value) };
13654
13675
  const properties = objectProperties(target, true);
13655
13676
  if (Array.isArray(properties)) {
13656
13677
  if (key === "length" && "value" in descriptor)
@@ -14485,8 +14506,9 @@ async function callSetMethod(target, methodName, args, options, stack = []) {
14485
14506
 
14486
14507
  // packages/safe-js/src/interp/globals/float32array.ts
14487
14508
  var constructors = /* @__PURE__ */ new WeakSet();
14488
- function createFloat32ArrayGlobal(budget) {
14509
+ function createFloat32ArrayGlobal(budget, nativePrototype = false) {
14489
14510
  const constructor = createSandboxClosure({
14511
+ guest: nativePrototype,
14490
14512
  sandbox: true,
14491
14513
  name: "Float32Array",
14492
14514
  length: 3,
@@ -14494,32 +14516,184 @@ function createFloat32ArrayGlobal(budget) {
14494
14516
  call: () => {
14495
14517
  throw new TypeError("Constructor Float32Array requires 'new'.");
14496
14518
  },
14497
- construct: ([source]) => {
14498
- if (Array.isArray(source) || isFloat32Array(source)) {
14499
- const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
14500
- checkFloat32Allocation(length2, budget);
14501
- if (isFloat32Array(source)) return new Float32Array(source);
14502
- const result = new Float32Array(length2);
14503
- for (let index = 0; index < length2; index += 1) {
14504
- budget.visitNode();
14505
- const descriptor = Object.getOwnPropertyDescriptor(source, index);
14506
- if (descriptor !== void 0 && !("value" in descriptor))
14507
- throw new TypeError("Float32Array input accessors are not supported.");
14508
- result[index] = float32Number(descriptor?.value);
14519
+ construct: (args, context) => {
14520
+ if (!nativePrototype) return allocateFloat32Array(args[0], budget);
14521
+ return (async () => {
14522
+ const newTarget = context?.newTarget ?? constructor;
14523
+ const candidate = context?.getProperty === void 0 ? getSandboxDataProperty(newTarget, "prototype", budget) : await context.getProperty(newTarget, "prototype");
14524
+ const prototype = candidate !== null && typeof candidate === "object" ? candidate : float32Prototypes.get(budget);
14525
+ const release = retainValues(budget, () => [prototype, ...args]);
14526
+ try {
14527
+ const result = allocateFloat32Array(args[0], budget);
14528
+ setSandboxPrototype(result, prototype, budget);
14529
+ return result;
14530
+ } finally {
14531
+ release();
14509
14532
  }
14510
- return result;
14511
- }
14512
- const number = float32Number(source);
14513
- const length = Number.isNaN(number) ? 0 : Math.trunc(number);
14514
- if (length < 0 || !Number.isSafeInteger(length))
14515
- throw new RangeError("Invalid typed array length.");
14516
- checkFloat32Allocation(length, budget);
14517
- return new Float32Array(length);
14533
+ })();
14518
14534
  }
14519
14535
  });
14520
14536
  constructors.add(constructor);
14521
14537
  return constructor;
14522
14538
  }
14539
+ function allocateFloat32Array(source, budget) {
14540
+ if (Array.isArray(source) || isFloat32Array(source)) {
14541
+ const length2 = isFloat32Array(source) ? float32Storage(source).length : source.length;
14542
+ checkFloat32Allocation(length2, budget);
14543
+ if (isFloat32Array(source)) return new Float32Array(source);
14544
+ const result = new Float32Array(length2);
14545
+ for (let index = 0; index < length2; index += 1) {
14546
+ budget.visitNode();
14547
+ const descriptor = Object.getOwnPropertyDescriptor(source, index);
14548
+ if (descriptor !== void 0 && !("value" in descriptor))
14549
+ throw new TypeError("Float32Array input accessors are not supported.");
14550
+ result[index] = float32Number(descriptor?.value);
14551
+ }
14552
+ return result;
14553
+ }
14554
+ const number = float32Number(source);
14555
+ const length = Number.isNaN(number) ? 0 : Math.trunc(number);
14556
+ if (length < 0 || !Number.isSafeInteger(length))
14557
+ throw new RangeError("Invalid typed array length.");
14558
+ checkFloat32Allocation(length, budget);
14559
+ return new Float32Array(length);
14560
+ }
14561
+ function createFloat32ArrayPrototypes(budget, constructor) {
14562
+ const prototype = /* @__PURE__ */ Object.create(null);
14563
+ const shared = /* @__PURE__ */ Object.create(null);
14564
+ const abstractCall = () => {
14565
+ throw new TypeError("Abstract TypedArray constructor cannot be called.");
14566
+ };
14567
+ const typedArray = createSandboxClosure({
14568
+ guest: true,
14569
+ sandbox: true,
14570
+ name: "TypedArray",
14571
+ length: 0,
14572
+ call: abstractCall,
14573
+ construct: abstractCall
14574
+ });
14575
+ Object.defineProperty(materializeFunctionProperties(typedArray), "prototype", { value: shared, writable: false });
14576
+ Object.defineProperty(materializeFunctionProperties(typedArray), "of", {
14577
+ writable: true,
14578
+ configurable: true,
14579
+ value: createSandboxClosure({
14580
+ guest: true,
14581
+ sandbox: true,
14582
+ name: "of",
14583
+ length: 0,
14584
+ call: async (args, context) => {
14585
+ const target = context?.thisValue;
14586
+ if (!isSandboxClosure(target) || target.construct === void 0)
14587
+ throw new TypeError("TypedArray.of requires a constructor receiver.");
14588
+ let result;
14589
+ const release = retainValues(budget, () => [target, result, ...args]);
14590
+ try {
14591
+ result = await invokeBuiltinClosure(target, [args.length], budget, context, void 0, true);
14592
+ if (!isFloat32Array(result) || float32Storage(result).length < args.length)
14593
+ throw new TypeError("TypedArray.of constructor must return sufficient typed storage.");
14594
+ for (let index = 0; index < args.length; index++) {
14595
+ budget.visitNode();
14596
+ result[index] = await sandboxNumber(args[index], budget, context);
14597
+ }
14598
+ return result;
14599
+ } finally {
14600
+ release();
14601
+ }
14602
+ }
14603
+ })
14604
+ });
14605
+ Object.defineProperties(materializeFunctionProperties(constructor), {
14606
+ prototype: { value: prototype, writable: false },
14607
+ BYTES_PER_ELEMENT: { value: 4, writable: false, enumerable: false, configurable: false }
14608
+ });
14609
+ Object.defineProperties(prototype, {
14610
+ constructor: { value: constructor, writable: true, configurable: true },
14611
+ BYTES_PER_ELEMENT: { value: 4 }
14612
+ });
14613
+ Object.defineProperty(shared, "constructor", { value: typedArray, writable: true, configurable: true });
14614
+ setSandboxPrototype(constructor, typedArray);
14615
+ setSandboxPrototype(prototype, shared);
14616
+ setSandboxPrototype(shared, getSandboxPrototype(/* @__PURE__ */ Object.create(null), budget));
14617
+ const getters = [];
14618
+ for (const key of ["length", "byteLength", "byteOffset"]) {
14619
+ const getter = createSandboxClosure({
14620
+ guest: true,
14621
+ sandbox: true,
14622
+ name: `get ${key}`,
14623
+ length: 0,
14624
+ call: (_args, context) => {
14625
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError(`TypedArray ${key} requires a typed array receiver.`);
14626
+ const storage = float32Storage(context.thisValue);
14627
+ return key === "byteLength" ? storage.length * 4 : storage[key];
14628
+ }
14629
+ });
14630
+ getters.push(getter);
14631
+ Object.defineProperty(shared, key, { get: accessorAdapter(getter, "get"), configurable: true });
14632
+ }
14633
+ for (const key of ["set", "slice", "subarray"])
14634
+ Object.defineProperty(shared, key, { value: getFloat32Member(new Float32Array(0), key, budget), writable: true, configurable: true });
14635
+ const arrayPrototype = resolveIntrinsicIdentity(budget, '["Array","prototype"]');
14636
+ Object.defineProperty(shared, "toString", { value: getSandboxDataProperty(arrayPrototype, "toString", budget), writable: true, configurable: true });
14637
+ Object.defineProperty(shared, "join", {
14638
+ writable: true,
14639
+ configurable: true,
14640
+ value: createSandboxClosure({
14641
+ guest: true,
14642
+ sandbox: true,
14643
+ name: "join",
14644
+ length: 1,
14645
+ call: async (args, context) => {
14646
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError("TypedArray join requires a typed array receiver.");
14647
+ const receiver = context.thisValue;
14648
+ const length = float32Storage(receiver).length;
14649
+ let separator = ",";
14650
+ let text = "";
14651
+ const release = retainValues(budget, () => [receiver, separator, text, ...args]);
14652
+ try {
14653
+ if (args[0] !== void 0) separator = await sandboxString(args[0], budget, context);
14654
+ for (let index = 0; index < length; index++) {
14655
+ budget.visitNode();
14656
+ text = budget.allocateString(text + (index === 0 ? "" : separator) + String(receiver[index]));
14657
+ }
14658
+ return text;
14659
+ } finally {
14660
+ release();
14661
+ }
14662
+ }
14663
+ })
14664
+ });
14665
+ const tagGetter = createSandboxClosure({
14666
+ guest: true,
14667
+ sandbox: true,
14668
+ name: "get [Symbol.toStringTag]",
14669
+ length: 0,
14670
+ call: (_args, context) => isFloat32Array(context?.thisValue) ? "Float32Array" : void 0
14671
+ });
14672
+ getters.push(tagGetter);
14673
+ Object.defineProperty(shared, Symbol.toStringTag, { get: accessorAdapter(tagGetter, "get"), configurable: true });
14674
+ for (const key of ["values", "keys", "entries"]) {
14675
+ const method = getSandboxDataProperty(arrayPrototype, key, budget);
14676
+ const closure = createSandboxClosure({
14677
+ guest: true,
14678
+ sandbox: true,
14679
+ name: key,
14680
+ length: 0,
14681
+ call: (args, context) => {
14682
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError(`TypedArray ${key} requires a typed array receiver.`);
14683
+ return invokeBuiltinClosure(method, args, budget, context, context.thisValue);
14684
+ }
14685
+ });
14686
+ Object.defineProperty(shared, key, { value: closure, writable: true, configurable: true });
14687
+ if (key === "values") Object.defineProperty(shared, Symbol.iterator, { value: closure, writable: true, configurable: true });
14688
+ }
14689
+ float32Prototypes.set(budget, prototype);
14690
+ registerBuiltinIdentities(budget, { Float32Array: constructor, "%TypedArray%": typedArray });
14691
+ registerIntrinsicFunction(budget, constructor);
14692
+ registerIntrinsicFunction(budget, typedArray);
14693
+ registerIntrinsicObject(budget, prototype);
14694
+ registerIntrinsicObject(budget, shared);
14695
+ for (const getter of getters) registerIntrinsicFunction(budget, getter);
14696
+ }
14523
14697
  function isFloat32ArrayConstructor(value) {
14524
14698
  return typeof value === "object" && value !== null && constructors.has(value);
14525
14699
  }
@@ -14530,6 +14704,7 @@ function getFloat32Member(value, property, budget) {
14530
14704
  if (!("value" in descriptor)) throw new TypeError("Float32Array accessors are not supported.");
14531
14705
  return descriptor.value;
14532
14706
  }
14707
+ if (float32Prototypes.has(budget)) return void 0;
14533
14708
  const storage = float32Storage(value);
14534
14709
  if (key === "length") return storage.length;
14535
14710
  if (key === "byteLength") return storage.length * 4;
@@ -14537,6 +14712,7 @@ function getFloat32Member(value, property, budget) {
14537
14712
  if (key === "BYTES_PER_ELEMENT") return 4;
14538
14713
  if (!["set", "slice", "subarray"].includes(key)) return void 0;
14539
14714
  return createSandboxClosure({
14715
+ guest: true,
14540
14716
  sandbox: true,
14541
14717
  name: key,
14542
14718
  length: key === "set" ? 1 : 2,
@@ -14584,17 +14760,18 @@ function getFloat32Member(value, property, budget) {
14584
14760
  }
14585
14761
  });
14586
14762
  }
14587
- function setFloat32Member(value, property, entry) {
14588
- const key = String(property);
14589
- if (isFloat32Index(key)) {
14763
+ function setFloat32Member(value, property, entry, budget) {
14764
+ const key = typeof property === "symbol" ? property : String(property);
14765
+ if (typeof key !== "symbol" && isFloat32Index(key)) {
14590
14766
  Reflect.set(value, key, float32Number(entry));
14591
14767
  return;
14592
14768
  }
14593
14769
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
14594
- if (descriptor === void 0 && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key))
14595
- throw new TypeError(`Cannot assign to read only property '${key}'.`);
14596
- if (descriptor !== void 0 && (!("value" in descriptor) || !descriptor.writable))
14597
- throw new TypeError(`Cannot assign to read only property '${key}'.`);
14770
+ const inherited = descriptor ?? (budget === void 0 ? void 0 : getSandboxPropertyDescriptor(value, key, budget));
14771
+ if (descriptor === void 0 && typeof key === "string" && (budget === void 0 || !float32Prototypes.has(budget)) && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key))
14772
+ throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
14773
+ if (inherited !== void 0 && (!("value" in inherited) || !inherited.writable))
14774
+ throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
14598
14775
  Object.defineProperty(
14599
14776
  value,
14600
14777
  key,
@@ -14766,7 +14943,7 @@ async function ordinaryHasInstance(value, constructor, budget, context) {
14766
14943
  budget.visitNode();
14767
14944
  return evaluateInstanceof(value, constructor.boundTarget, budget, context);
14768
14945
  }
14769
- if (isFloat32ArrayConstructor(constructor)) return isFloat32Array(value);
14946
+ if (isFloat32ArrayConstructor(constructor) && !isGuestClosure(constructor)) return isFloat32Array(value);
14770
14947
  if ((!isGuestClosure(constructor) || value !== null && typeof value === "object" && !hasExplicitSandboxPrototype(value)) && isSandboxErrorConstructorInstance2(value, constructor)) return true;
14771
14948
  if (!isGuestClosure(constructor) || typeof value !== "object" || value === null) return false;
14772
14949
  const prototype = await readInstanceProperty(constructor, "prototype", budget, context);
@@ -17406,7 +17583,7 @@ async function evaluateMemberCallExpression(node, context) {
17406
17583
  if (isFloat32Array(member.object)) {
17407
17584
  return evaluateResolvedCallExpression(
17408
17585
  node,
17409
- getFloat32Member(member.object, member.property, context.budget),
17586
+ await getPropertyValue(member.object, member.property, context),
17410
17587
  context,
17411
17588
  member.object
17412
17589
  );
@@ -17943,8 +18120,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
17943
18120
  if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
17944
18121
  if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
17945
18122
  if (isFloat32Array(target)) {
17946
- if (typeof property === "symbol") throw new TypeError("Typed array symbol properties are not yet supported.");
17947
- setFloat32Member(target, property, value);
18123
+ setFloat32Member(target, property, value, budget);
17948
18124
  return;
17949
18125
  }
17950
18126
  if (isSandboxRegex(target)) {
@@ -24518,7 +24694,7 @@ function createBuiltinBindings(options) {
24518
24694
  const bindings = {
24519
24695
  ...createConsoleJsonGlobals(options),
24520
24696
  ...createCollectionGlobals(options),
24521
- Float32Array: createFloat32ArrayGlobal(options.budget),
24697
+ Float32Array: createFloat32ArrayGlobal(options.budget, options.float32Prototypes !== false),
24522
24698
  Date: createDateGlobal(options),
24523
24699
  Symbol: createSymbolGlobal(options.budget),
24524
24700
  BigInt: createBigIntGlobal(options.budget),
@@ -24531,6 +24707,7 @@ function createBuiltinBindings(options) {
24531
24707
  ...createRegexGlobals(options)
24532
24708
  };
24533
24709
  createFunctionPrototype(options.budget, options.functionHasInstance);
24710
+ if (options.float32Prototypes !== false) createFloat32ArrayPrototypes(options.budget, bindings.Float32Array);
24534
24711
  if (options.errorPrototypes !== false) createErrorPrototypes(options.budget, bindings);
24535
24712
  createGeneratorPrototypes(options.budget);
24536
24713
  registerBuiltinIdentities(options.budget, bindings);
@@ -25263,6 +25440,10 @@ function validateDumpHeap(root, state) {
25263
25440
  if (entry.kind === "float32array") {
25264
25441
  validateFloat32Storage(entry);
25265
25442
  requireRecord(entry.entries, `${path}.entries`);
25443
+ if (Object.hasOwn(entry, "state")) {
25444
+ if (Object.keys(entry.entries).length !== 0) fail("invalidValue", path, "ambiguous Float32Array property state");
25445
+ validateGuestHeapNode({ kind: "guest-object", state: entry.state }, heap, state.limits.maxEntries);
25446
+ }
25266
25447
  continue;
25267
25448
  }
25268
25449
  if (entry.kind === "arguments") {
@@ -25491,6 +25672,10 @@ function validateHeapValue(value, path, state, heap) {
25491
25672
  if (record4.kind === "float32array") {
25492
25673
  validateFloat32Storage(record4);
25493
25674
  requireRecord(record4.entries, `${path}.entries`);
25675
+ if (Object.hasOwn(record4, "state")) {
25676
+ if (Object.keys(record4.entries).length !== 0) fail("invalidValue", path, "ambiguous Float32Array property state");
25677
+ validateGuestHeapNode({ kind: "guest-object", state: record4.state }, heap, state.limits.maxEntries);
25678
+ }
25494
25679
  }
25495
25680
  if (record4.kind === "map") {
25496
25681
  const entries = requireArray(record4.entries, `${path}.entries`, state);
@@ -26485,9 +26670,12 @@ function measureSandboxData(values, options = {}) {
26485
26670
  seen.add(storage.buffer);
26486
26671
  usage += storage.byteLength;
26487
26672
  }
26488
- for (const [key, descriptor] of float32DataProperties(value)) {
26489
- usage += key.length + 1;
26490
- visit(descriptor.value, depth + 1);
26673
+ for (const [key, descriptor] of float32Properties(value)) {
26674
+ usage += 1;
26675
+ if (typeof key === "string") usage += key.length;
26676
+ else visit(key, depth + 1);
26677
+ if ("value" in descriptor) visit(descriptor.value, depth + 1);
26678
+ else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
26491
26679
  }
26492
26680
  return;
26493
26681
  }
@@ -41448,4 +41636,4 @@ export {
41448
41636
  FileSnapshotBackend,
41449
41637
  run
41450
41638
  };
41451
- //# sourceMappingURL=chunk-V6LQP64H.js.map
41639
+ //# sourceMappingURL=chunk-A5S5VD23.js.map