@poe-platform/safe-js 0.1.307 → 0.1.308

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,155 @@ 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.defineProperties(materializeFunctionProperties(constructor), {
14577
+ prototype: { value: prototype, writable: false },
14578
+ BYTES_PER_ELEMENT: { value: 4, writable: false, enumerable: false, configurable: false }
14579
+ });
14580
+ Object.defineProperties(prototype, {
14581
+ constructor: { value: constructor, writable: true, configurable: true },
14582
+ BYTES_PER_ELEMENT: { value: 4 }
14583
+ });
14584
+ Object.defineProperty(shared, "constructor", { value: typedArray, writable: true, configurable: true });
14585
+ setSandboxPrototype(constructor, typedArray);
14586
+ setSandboxPrototype(prototype, shared);
14587
+ setSandboxPrototype(shared, getSandboxPrototype(/* @__PURE__ */ Object.create(null), budget));
14588
+ const getters = [];
14589
+ for (const key of ["length", "byteLength", "byteOffset"]) {
14590
+ const getter = createSandboxClosure({
14591
+ guest: true,
14592
+ sandbox: true,
14593
+ name: `get ${key}`,
14594
+ length: 0,
14595
+ call: (_args, context) => {
14596
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError(`TypedArray ${key} requires a typed array receiver.`);
14597
+ const storage = float32Storage(context.thisValue);
14598
+ return key === "byteLength" ? storage.length * 4 : storage[key];
14599
+ }
14600
+ });
14601
+ getters.push(getter);
14602
+ Object.defineProperty(shared, key, { get: accessorAdapter(getter, "get"), configurable: true });
14603
+ }
14604
+ for (const key of ["set", "slice", "subarray"])
14605
+ Object.defineProperty(shared, key, { value: getFloat32Member(new Float32Array(0), key, budget), writable: true, configurable: true });
14606
+ const arrayPrototype = resolveIntrinsicIdentity(budget, '["Array","prototype"]');
14607
+ Object.defineProperty(shared, "toString", { value: getSandboxDataProperty(arrayPrototype, "toString", budget), writable: true, configurable: true });
14608
+ Object.defineProperty(shared, "join", {
14609
+ writable: true,
14610
+ configurable: true,
14611
+ value: createSandboxClosure({
14612
+ guest: true,
14613
+ sandbox: true,
14614
+ name: "join",
14615
+ length: 1,
14616
+ call: async (args, context) => {
14617
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError("TypedArray join requires a typed array receiver.");
14618
+ const receiver = context.thisValue;
14619
+ const length = float32Storage(receiver).length;
14620
+ let separator = ",";
14621
+ let text = "";
14622
+ const release = retainValues(budget, () => [receiver, separator, text, ...args]);
14623
+ try {
14624
+ if (args[0] !== void 0) separator = await sandboxString(args[0], budget, context);
14625
+ for (let index = 0; index < length; index++) {
14626
+ budget.visitNode();
14627
+ text = budget.allocateString(text + (index === 0 ? "" : separator) + String(receiver[index]));
14628
+ }
14629
+ return text;
14630
+ } finally {
14631
+ release();
14632
+ }
14633
+ }
14634
+ })
14635
+ });
14636
+ const tagGetter = createSandboxClosure({
14637
+ guest: true,
14638
+ sandbox: true,
14639
+ name: "get [Symbol.toStringTag]",
14640
+ length: 0,
14641
+ call: (_args, context) => isFloat32Array(context?.thisValue) ? "Float32Array" : void 0
14642
+ });
14643
+ getters.push(tagGetter);
14644
+ Object.defineProperty(shared, Symbol.toStringTag, { get: accessorAdapter(tagGetter, "get"), configurable: true });
14645
+ for (const key of ["values", "keys", "entries"]) {
14646
+ const method = getSandboxDataProperty(arrayPrototype, key, budget);
14647
+ const closure = createSandboxClosure({
14648
+ guest: true,
14649
+ sandbox: true,
14650
+ name: key,
14651
+ length: 0,
14652
+ call: (args, context) => {
14653
+ if (!isFloat32Array(context?.thisValue)) throw new TypeError(`TypedArray ${key} requires a typed array receiver.`);
14654
+ return invokeBuiltinClosure(method, args, budget, context, context.thisValue);
14655
+ }
14656
+ });
14657
+ Object.defineProperty(shared, key, { value: closure, writable: true, configurable: true });
14658
+ if (key === "values") Object.defineProperty(shared, Symbol.iterator, { value: closure, writable: true, configurable: true });
14659
+ }
14660
+ float32Prototypes.set(budget, prototype);
14661
+ registerBuiltinIdentities(budget, { Float32Array: constructor, "%TypedArray%": typedArray });
14662
+ registerIntrinsicFunction(budget, constructor);
14663
+ registerIntrinsicFunction(budget, typedArray);
14664
+ registerIntrinsicObject(budget, prototype);
14665
+ registerIntrinsicObject(budget, shared);
14666
+ for (const getter of getters) registerIntrinsicFunction(budget, getter);
14667
+ }
14523
14668
  function isFloat32ArrayConstructor(value) {
14524
14669
  return typeof value === "object" && value !== null && constructors.has(value);
14525
14670
  }
@@ -14530,6 +14675,7 @@ function getFloat32Member(value, property, budget) {
14530
14675
  if (!("value" in descriptor)) throw new TypeError("Float32Array accessors are not supported.");
14531
14676
  return descriptor.value;
14532
14677
  }
14678
+ if (float32Prototypes.has(budget)) return void 0;
14533
14679
  const storage = float32Storage(value);
14534
14680
  if (key === "length") return storage.length;
14535
14681
  if (key === "byteLength") return storage.length * 4;
@@ -14537,6 +14683,7 @@ function getFloat32Member(value, property, budget) {
14537
14683
  if (key === "BYTES_PER_ELEMENT") return 4;
14538
14684
  if (!["set", "slice", "subarray"].includes(key)) return void 0;
14539
14685
  return createSandboxClosure({
14686
+ guest: true,
14540
14687
  sandbox: true,
14541
14688
  name: key,
14542
14689
  length: key === "set" ? 1 : 2,
@@ -14584,17 +14731,18 @@ function getFloat32Member(value, property, budget) {
14584
14731
  }
14585
14732
  });
14586
14733
  }
14587
- function setFloat32Member(value, property, entry) {
14588
- const key = String(property);
14589
- if (isFloat32Index(key)) {
14734
+ function setFloat32Member(value, property, entry, budget) {
14735
+ const key = typeof property === "symbol" ? property : String(property);
14736
+ if (typeof key !== "symbol" && isFloat32Index(key)) {
14590
14737
  Reflect.set(value, key, float32Number(entry));
14591
14738
  return;
14592
14739
  }
14593
14740
  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}'.`);
14741
+ const inherited = descriptor ?? (budget === void 0 ? void 0 : getSandboxPropertyDescriptor(value, key, budget));
14742
+ if (descriptor === void 0 && typeof key === "string" && (budget === void 0 || !float32Prototypes.has(budget)) && ["length", "byteLength", "byteOffset", "buffer", "BYTES_PER_ELEMENT"].includes(key))
14743
+ throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
14744
+ if (inherited !== void 0 && (!("value" in inherited) || !inherited.writable))
14745
+ throw new TypeError(`Cannot assign to read only property '${String(key)}'.`);
14598
14746
  Object.defineProperty(
14599
14747
  value,
14600
14748
  key,
@@ -14766,7 +14914,7 @@ async function ordinaryHasInstance(value, constructor, budget, context) {
14766
14914
  budget.visitNode();
14767
14915
  return evaluateInstanceof(value, constructor.boundTarget, budget, context);
14768
14916
  }
14769
- if (isFloat32ArrayConstructor(constructor)) return isFloat32Array(value);
14917
+ if (isFloat32ArrayConstructor(constructor) && !isGuestClosure(constructor)) return isFloat32Array(value);
14770
14918
  if ((!isGuestClosure(constructor) || value !== null && typeof value === "object" && !hasExplicitSandboxPrototype(value)) && isSandboxErrorConstructorInstance2(value, constructor)) return true;
14771
14919
  if (!isGuestClosure(constructor) || typeof value !== "object" || value === null) return false;
14772
14920
  const prototype = await readInstanceProperty(constructor, "prototype", budget, context);
@@ -17406,7 +17554,7 @@ async function evaluateMemberCallExpression(node, context) {
17406
17554
  if (isFloat32Array(member.object)) {
17407
17555
  return evaluateResolvedCallExpression(
17408
17556
  node,
17409
- getFloat32Member(member.object, member.property, context.budget),
17557
+ await getPropertyValue(member.object, member.property, context),
17410
17558
  context,
17411
17559
  member.object
17412
17560
  );
@@ -17943,8 +18091,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
17943
18091
  if (isSandboxGenerator(target)) target = getGeneratorProperties(target);
17944
18092
  if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
17945
18093
  if (isFloat32Array(target)) {
17946
- if (typeof property === "symbol") throw new TypeError("Typed array symbol properties are not yet supported.");
17947
- setFloat32Member(target, property, value);
18094
+ setFloat32Member(target, property, value, budget);
17948
18095
  return;
17949
18096
  }
17950
18097
  if (isSandboxRegex(target)) {
@@ -24518,7 +24665,7 @@ function createBuiltinBindings(options) {
24518
24665
  const bindings = {
24519
24666
  ...createConsoleJsonGlobals(options),
24520
24667
  ...createCollectionGlobals(options),
24521
- Float32Array: createFloat32ArrayGlobal(options.budget),
24668
+ Float32Array: createFloat32ArrayGlobal(options.budget, options.float32Prototypes !== false),
24522
24669
  Date: createDateGlobal(options),
24523
24670
  Symbol: createSymbolGlobal(options.budget),
24524
24671
  BigInt: createBigIntGlobal(options.budget),
@@ -24531,6 +24678,7 @@ function createBuiltinBindings(options) {
24531
24678
  ...createRegexGlobals(options)
24532
24679
  };
24533
24680
  createFunctionPrototype(options.budget, options.functionHasInstance);
24681
+ if (options.float32Prototypes !== false) createFloat32ArrayPrototypes(options.budget, bindings.Float32Array);
24534
24682
  if (options.errorPrototypes !== false) createErrorPrototypes(options.budget, bindings);
24535
24683
  createGeneratorPrototypes(options.budget);
24536
24684
  registerBuiltinIdentities(options.budget, bindings);
@@ -25263,6 +25411,10 @@ function validateDumpHeap(root, state) {
25263
25411
  if (entry.kind === "float32array") {
25264
25412
  validateFloat32Storage(entry);
25265
25413
  requireRecord(entry.entries, `${path}.entries`);
25414
+ if (Object.hasOwn(entry, "state")) {
25415
+ if (Object.keys(entry.entries).length !== 0) fail("invalidValue", path, "ambiguous Float32Array property state");
25416
+ validateGuestHeapNode({ kind: "guest-object", state: entry.state }, heap, state.limits.maxEntries);
25417
+ }
25266
25418
  continue;
25267
25419
  }
25268
25420
  if (entry.kind === "arguments") {
@@ -25491,6 +25643,10 @@ function validateHeapValue(value, path, state, heap) {
25491
25643
  if (record4.kind === "float32array") {
25492
25644
  validateFloat32Storage(record4);
25493
25645
  requireRecord(record4.entries, `${path}.entries`);
25646
+ if (Object.hasOwn(record4, "state")) {
25647
+ if (Object.keys(record4.entries).length !== 0) fail("invalidValue", path, "ambiguous Float32Array property state");
25648
+ validateGuestHeapNode({ kind: "guest-object", state: record4.state }, heap, state.limits.maxEntries);
25649
+ }
25494
25650
  }
25495
25651
  if (record4.kind === "map") {
25496
25652
  const entries = requireArray(record4.entries, `${path}.entries`, state);
@@ -26485,9 +26641,12 @@ function measureSandboxData(values, options = {}) {
26485
26641
  seen.add(storage.buffer);
26486
26642
  usage += storage.byteLength;
26487
26643
  }
26488
- for (const [key, descriptor] of float32DataProperties(value)) {
26489
- usage += key.length + 1;
26490
- visit(descriptor.value, depth + 1);
26644
+ for (const [key, descriptor] of float32Properties(value)) {
26645
+ usage += 1;
26646
+ if (typeof key === "string") usage += key.length;
26647
+ else visit(key, depth + 1);
26648
+ if ("value" in descriptor) visit(descriptor.value, depth + 1);
26649
+ else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
26491
26650
  }
26492
26651
  return;
26493
26652
  }
@@ -41448,4 +41607,4 @@ export {
41448
41607
  FileSnapshotBackend,
41449
41608
  run
41450
41609
  };
41451
- //# sourceMappingURL=chunk-V6LQP64H.js.map
41610
+ //# sourceMappingURL=chunk-F7WO3VT4.js.map