@poe-platform/safe-js 0.1.449 → 0.1.450
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.
- package/dist/safe-js/chunks/{chunk-FOE6VBOD.js → chunk-6BQOHEVM.js} +2 -2
- package/dist/safe-js/chunks/{chunk-264RHYEA.js → chunk-D5ZEIZYV.js} +214 -15
- package/dist/safe-js/chunks/chunk-D5ZEIZYV.js.map +7 -0
- package/dist/safe-js/chunks/numberformat-portable-TXZMY2EF.js +7313 -0
- package/dist/safe-js/chunks/numberformat-portable-TXZMY2EF.js.map +7 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/intl-numberformat.d.ts +13 -0
- package/dist/safe-js/interp/numberformat-backend.d.ts +7 -0
- package/dist/safe-js/interp/numberformat-portable.d.ts +9 -0
- package/dist/safe-js/intl-data/dist/numberformat-engine.d.ts +1 -0
- package/dist/safe-js/snapshot/guest-heap.d.ts +6 -0
- package/package.json +5 -2
- package/dist/safe-js/chunks/chunk-264RHYEA.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-FOE6VBOD.js.map → chunk-6BQOHEVM.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-D5ZEIZYV.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-
|
|
8252
|
+
//# sourceMappingURL=chunk-6BQOHEVM.js.map
|
|
@@ -11184,18 +11184,28 @@ function decodeBase64(text, alphabet, mode, budget, maxLength = Number.MAX_SAFE_
|
|
|
11184
11184
|
}
|
|
11185
11185
|
}
|
|
11186
11186
|
|
|
11187
|
-
// packages/safe-js/src/interp/
|
|
11187
|
+
// packages/safe-js/src/interp/numberformat-backend.ts
|
|
11188
11188
|
var NativeNumberFormat = Intl.NumberFormat;
|
|
11189
|
+
var modernNative = new NativeNumberFormat("en", { maximumFractionDigits: 0, ...{ roundingMode: "floor" } }).format(1.9) === "1" && typeof Object.getOwnPropertyDescriptor(NativeNumberFormat.prototype, "formatRange")?.value === "function";
|
|
11190
|
+
var portable = modernNative ? void 0 : await import("./numberformat-portable-TXZMY2EF.js");
|
|
11191
|
+
function createNumberFormatter(locales2, options) {
|
|
11192
|
+
return portable === void 0 ? new NativeNumberFormat(locales2, options) : portable.createPortableNumberFormatter(locales2, options);
|
|
11193
|
+
}
|
|
11194
|
+
function numberFormatterOptions(formatter) {
|
|
11195
|
+
return portable === void 0 ? { ...formatter.resolvedOptions() } : portable.numberFormatterOptions(formatter);
|
|
11196
|
+
}
|
|
11197
|
+
function numberFormatterResult(formatter, method, values) {
|
|
11198
|
+
return portable === void 0 ? Reflect.apply(Reflect.get(formatter, method), formatter, values) : portable.numberFormatterResult(formatter, method, values);
|
|
11199
|
+
}
|
|
11200
|
+
|
|
11201
|
+
// packages/safe-js/src/interp/number-locale.ts
|
|
11189
11202
|
var roundingIncrements = [1, 2, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3, 2e3, 2500, 5e3];
|
|
11190
|
-
async function
|
|
11191
|
-
let locales2 = [];
|
|
11203
|
+
async function readNumberFormatOptions(inputValue, locales2, budget, context) {
|
|
11192
11204
|
const options = /* @__PURE__ */ Object.create(null);
|
|
11193
11205
|
const digits = /* @__PURE__ */ Object.create(null);
|
|
11194
|
-
const release = retainValues(budget, () => [
|
|
11195
|
-
const allocation = {};
|
|
11206
|
+
const release = retainValues(budget, () => [inputValue, locales2, options, digits]);
|
|
11196
11207
|
try {
|
|
11197
|
-
|
|
11198
|
-
const input = intlOptionsObject(args[1], budget);
|
|
11208
|
+
const input = intlOptionsObject(inputValue, budget);
|
|
11199
11209
|
const readString = async (key, type) => {
|
|
11200
11210
|
const raw = await readIntlProperty(input, key, budget, context);
|
|
11201
11211
|
if (raw === void 0) return void 0;
|
|
@@ -11224,13 +11234,13 @@ async function formatNumberLocale(value, args, budget, context) {
|
|
|
11224
11234
|
const unit = await readString("unit");
|
|
11225
11235
|
if (unit === void 0) {
|
|
11226
11236
|
if (style === "unit") throw new TypeError("Unit formatting requires a unit.");
|
|
11227
|
-
} else
|
|
11237
|
+
} else createNumberFormatter("en", { style: "unit", unit });
|
|
11228
11238
|
await readString("unitDisplay", ["short", "narrow", "long"]);
|
|
11229
11239
|
const notation = await readString("notation", ["standard", "scientific", "engineering", "compact"]) ?? "standard";
|
|
11230
11240
|
let minimumDefault = 0;
|
|
11231
11241
|
let maximumDefault = style === "percent" ? 0 : 3;
|
|
11232
11242
|
if (style === "currency" && notation === "standard") {
|
|
11233
|
-
const currencyDefaults =
|
|
11243
|
+
const currencyDefaults = numberFormatterOptions(createNumberFormatter("en", { style: "currency", currency }));
|
|
11234
11244
|
minimumDefault = currencyDefaults.minimumFractionDigits;
|
|
11235
11245
|
maximumDefault = currencyDefaults.maximumFractionDigits;
|
|
11236
11246
|
}
|
|
@@ -11265,16 +11275,29 @@ async function formatNumberLocale(value, args, budget, context) {
|
|
|
11265
11275
|
options.minimumFractionDigits = minimum;
|
|
11266
11276
|
options.maximumFractionDigits = maximum;
|
|
11267
11277
|
}
|
|
11268
|
-
|
|
11278
|
+
createNumberFormatter(locales2, options);
|
|
11269
11279
|
await readString("compactDisplay", ["short", "long"]);
|
|
11270
11280
|
const grouping = await readIntlProperty(input, "useGrouping", budget, context);
|
|
11271
11281
|
if (grouping !== void 0) options.useGrouping = grouping === true ? true : !grouping ? false : await convertIntlOption(grouping, "useGrouping", ["min2", "auto", "always", "true", "false"], budget, context);
|
|
11272
11282
|
await readString("signDisplay", ["auto", "never", "always", "exceptZero", "negative"]);
|
|
11283
|
+
return options;
|
|
11284
|
+
} finally {
|
|
11285
|
+
release();
|
|
11286
|
+
}
|
|
11287
|
+
}
|
|
11288
|
+
async function formatNumberLocale(value, args, budget, context) {
|
|
11289
|
+
let locales2 = [];
|
|
11290
|
+
let options = /* @__PURE__ */ Object.create(null);
|
|
11291
|
+
const release = retainValues(budget, () => [value, locales2, options]);
|
|
11292
|
+
const allocation = {};
|
|
11293
|
+
try {
|
|
11294
|
+
locales2 = await canonicalizeGuestLocales(args[0], budget, context);
|
|
11295
|
+
options = await readNumberFormatOptions(args[1], locales2, budget, context);
|
|
11273
11296
|
const size = typeof value === "bigint" ? value.toString(16).length * 4 : 64;
|
|
11274
11297
|
budget.visitNode(size);
|
|
11275
11298
|
budget.setRetainedDataUsage(allocation, size);
|
|
11276
|
-
const formatter =
|
|
11277
|
-
return budget.allocateString(formatter
|
|
11299
|
+
const formatter = createNumberFormatter(locales2, options);
|
|
11300
|
+
return budget.allocateString(numberFormatterResult(formatter, "format", [value]));
|
|
11278
11301
|
} finally {
|
|
11279
11302
|
budget.setRetainedDataUsage(allocation, 0);
|
|
11280
11303
|
release();
|
|
@@ -21245,6 +21268,34 @@ async function buildLocaleTag(input, optionsInput, budget, context) {
|
|
|
21245
21268
|
return budget.allocateString(Reflect.apply(nativeToString, result, []));
|
|
21246
21269
|
}
|
|
21247
21270
|
|
|
21271
|
+
// packages/safe-js/src/interp/intl-numberformat.ts
|
|
21272
|
+
var states6 = /* @__PURE__ */ new WeakMap();
|
|
21273
|
+
function createSandboxNumberFormat(locales2, options) {
|
|
21274
|
+
const native = createNumberFormatter(locales2, options);
|
|
21275
|
+
const value = /* @__PURE__ */ Object.create(null);
|
|
21276
|
+
states6.set(value, { native, options: numberFormatterOptions(native) });
|
|
21277
|
+
return value;
|
|
21278
|
+
}
|
|
21279
|
+
function isSandboxNumberFormat(value) {
|
|
21280
|
+
return typeof value === "object" && value !== null && states6.has(value);
|
|
21281
|
+
}
|
|
21282
|
+
function numberFormatState(value) {
|
|
21283
|
+
if (!isSandboxNumberFormat(value)) throw new TypeError("Intl.NumberFormat requires a NumberFormat receiver.");
|
|
21284
|
+
return states6.get(value);
|
|
21285
|
+
}
|
|
21286
|
+
async function numberFormatValue(value, budget, context) {
|
|
21287
|
+
const primitive = typeof value === "object" && value !== null ? await objectToPrimitive(value, budget, context, /* @__PURE__ */ new Set(), "number") : value;
|
|
21288
|
+
if (typeof primitive === "string" || typeof primitive === "bigint") {
|
|
21289
|
+
budget.visitNode(typeof primitive === "string" ? primitive.length : primitive.toString(16).length * 4);
|
|
21290
|
+
return primitive;
|
|
21291
|
+
}
|
|
21292
|
+
return Number(primitive);
|
|
21293
|
+
}
|
|
21294
|
+
function formatNumberValue(receiver, method, values) {
|
|
21295
|
+
const { native } = numberFormatState(receiver);
|
|
21296
|
+
return numberFormatterResult(native, method, values);
|
|
21297
|
+
}
|
|
21298
|
+
|
|
21248
21299
|
// packages/safe-js/src/interp/iterator-helper.ts
|
|
21249
21300
|
var iteratorHelperStates = /* @__PURE__ */ new WeakMap();
|
|
21250
21301
|
|
|
@@ -21584,6 +21635,10 @@ function captureGuestHeapNode(value, encode) {
|
|
|
21584
21635
|
return void 0;
|
|
21585
21636
|
}
|
|
21586
21637
|
if (isSandboxLocale(value)) return { kind: "guest-locale", tag: localeTag(value), state: captureObjectState(value, encode) };
|
|
21638
|
+
if (isSandboxNumberFormat(value)) {
|
|
21639
|
+
const { options, format } = numberFormatState(value);
|
|
21640
|
+
return { kind: "guest-numberformat", options: { ...options }, ...format === void 0 ? {} : { format: encode(format) }, state: captureObjectState(value, encode) };
|
|
21641
|
+
}
|
|
21587
21642
|
if (isSandboxCollator(value)) {
|
|
21588
21643
|
const { options, compare } = collatorState(value);
|
|
21589
21644
|
return { kind: "guest-collator", options: { ...options }, ...compare === void 0 ? {} : { compare: encode(compare) }, state: captureObjectState(value, encode) };
|
|
@@ -25891,6 +25946,128 @@ function createCollatorConstructor(budget) {
|
|
|
25891
25946
|
return constructor;
|
|
25892
25947
|
}
|
|
25893
25948
|
|
|
25949
|
+
// packages/safe-js/src/interp/globals/intl-numberformat.ts
|
|
25950
|
+
var supportedLocalesOf2 = Intl.NumberFormat.supportedLocalesOf;
|
|
25951
|
+
function createNumberFormatConstructor(budget) {
|
|
25952
|
+
const prototype = createIntrinsicObject();
|
|
25953
|
+
const formatTarget = createSandboxClosure({
|
|
25954
|
+
guest: true,
|
|
25955
|
+
sandbox: true,
|
|
25956
|
+
name: "",
|
|
25957
|
+
length: 1,
|
|
25958
|
+
call: async ([input], context) => {
|
|
25959
|
+
numberFormatState(context?.thisValue);
|
|
25960
|
+
let value = 0;
|
|
25961
|
+
const release = retainValues(budget, () => [context?.thisValue, value]);
|
|
25962
|
+
try {
|
|
25963
|
+
value = await numberFormatValue(input, budget, context);
|
|
25964
|
+
return allocateProducedSandboxValue(formatNumberValue(context?.thisValue, "format", [value]), budget);
|
|
25965
|
+
} finally {
|
|
25966
|
+
release();
|
|
25967
|
+
}
|
|
25968
|
+
}
|
|
25969
|
+
});
|
|
25970
|
+
registerBuiltinIdentities(budget, { "%NumberFormatFormat%": formatTarget });
|
|
25971
|
+
registerIntrinsicFunction(budget, formatTarget);
|
|
25972
|
+
const initialize = async ([input, options], context) => {
|
|
25973
|
+
const target = context?.newTarget;
|
|
25974
|
+
const selected = target === void 0 || target === constructor ? prototype : context?.getProperty !== void 0 ? await context.getProperty(target, "prototype") : await readPropertyDescriptor(getSandboxPropertyDescriptor(target, "prototype", budget) ?? { value: void 0 }, target, context);
|
|
25975
|
+
let locales2 = [];
|
|
25976
|
+
const release = retainValues(budget, () => [selected, locales2]);
|
|
25977
|
+
try {
|
|
25978
|
+
locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
25979
|
+
const converted = await readNumberFormatOptions(options, locales2, budget, context);
|
|
25980
|
+
const value = createSandboxNumberFormat(locales2, converted);
|
|
25981
|
+
setSandboxPrototype(value, typeof selected === "object" && selected !== null ? selected : prototype, budget);
|
|
25982
|
+
return allocateProducedSandboxValue(value, budget);
|
|
25983
|
+
} finally {
|
|
25984
|
+
release();
|
|
25985
|
+
}
|
|
25986
|
+
};
|
|
25987
|
+
const constructor = createSandboxClosure({
|
|
25988
|
+
guest: true,
|
|
25989
|
+
sandbox: true,
|
|
25990
|
+
name: "NumberFormat",
|
|
25991
|
+
length: 0,
|
|
25992
|
+
construct: initialize,
|
|
25993
|
+
call: (args, context) => initialize(args, { ...context, stack: context?.stack ?? [], thisValue: context?.thisValue, newTarget: void 0 })
|
|
25994
|
+
});
|
|
25995
|
+
const properties = materializeFunctionProperties(constructor);
|
|
25996
|
+
Object.defineProperty(properties, "prototype", { value: prototype, writable: false, configurable: false });
|
|
25997
|
+
Object.defineProperty(properties, "supportedLocalesOf", { value: createSandboxClosure({
|
|
25998
|
+
guest: true,
|
|
25999
|
+
sandbox: true,
|
|
26000
|
+
name: "supportedLocalesOf",
|
|
26001
|
+
length: 1,
|
|
26002
|
+
call: async ([input, options], context) => {
|
|
26003
|
+
const locales2 = await canonicalizeGuestLocales(input, budget, context);
|
|
26004
|
+
const release = retainValues(budget, () => [locales2]);
|
|
26005
|
+
try {
|
|
26006
|
+
const source = intlOptionsObject(options, budget);
|
|
26007
|
+
const raw = await readIntlProperty(source, "localeMatcher", budget, context);
|
|
26008
|
+
const matcher = raw === void 0 ? void 0 : await convertIntlOption(raw, "localeMatcher", ["lookup", "best fit"], budget, context);
|
|
26009
|
+
return allocateProducedSandboxValue(supportedLocalesOf2(locales2, { localeMatcher: matcher }), budget);
|
|
26010
|
+
} finally {
|
|
26011
|
+
release();
|
|
26012
|
+
}
|
|
26013
|
+
}
|
|
26014
|
+
}), writable: true, configurable: true });
|
|
26015
|
+
Object.defineProperties(prototype, {
|
|
26016
|
+
constructor: { value: constructor, writable: true, configurable: true },
|
|
26017
|
+
[Symbol.toStringTag]: { value: "Intl.NumberFormat", configurable: true },
|
|
26018
|
+
resolvedOptions: { value: createSandboxClosure({
|
|
26019
|
+
guest: true,
|
|
26020
|
+
sandbox: true,
|
|
26021
|
+
name: "resolvedOptions",
|
|
26022
|
+
length: 0,
|
|
26023
|
+
call: (_args, context) => allocateProducedSandboxValue({ ...numberFormatState(context?.thisValue).options }, budget)
|
|
26024
|
+
}), writable: true, configurable: true },
|
|
26025
|
+
format: { get: accessorAdapter(createSandboxClosure({
|
|
26026
|
+
guest: true,
|
|
26027
|
+
sandbox: true,
|
|
26028
|
+
name: "get format",
|
|
26029
|
+
length: 0,
|
|
26030
|
+
call: (_args, context) => {
|
|
26031
|
+
const receiver = context?.thisValue;
|
|
26032
|
+
const state = numberFormatState(receiver);
|
|
26033
|
+
if (state.format === void 0) {
|
|
26034
|
+
state.format = createBoundFunction(
|
|
26035
|
+
{ target: formatTarget, thisValue: receiver, args: [] },
|
|
26036
|
+
"",
|
|
26037
|
+
1,
|
|
26038
|
+
(target, args, stack, thisValue) => invokeBuiltinClosure(target, args, budget, { stack, thisValue }, thisValue)
|
|
26039
|
+
);
|
|
26040
|
+
allocateProducedSandboxValue(state.format, budget);
|
|
26041
|
+
}
|
|
26042
|
+
return state.format;
|
|
26043
|
+
}
|
|
26044
|
+
}), "get"), configurable: true }
|
|
26045
|
+
});
|
|
26046
|
+
for (const method of ["formatToParts", "formatRange", "formatRangeToParts"]) {
|
|
26047
|
+
const range = method !== "formatToParts";
|
|
26048
|
+
Object.defineProperty(prototype, method, { value: createSandboxClosure({
|
|
26049
|
+
guest: true,
|
|
26050
|
+
sandbox: true,
|
|
26051
|
+
name: method,
|
|
26052
|
+
length: range ? 2 : 1,
|
|
26053
|
+
call: async ([first, second], context) => {
|
|
26054
|
+
numberFormatState(context?.thisValue);
|
|
26055
|
+
if (range && (first === void 0 || second === void 0)) throw new TypeError("NumberFormat range requires both values.");
|
|
26056
|
+
const values = [];
|
|
26057
|
+
const release = retainValues(budget, () => [context?.thisValue, values]);
|
|
26058
|
+
try {
|
|
26059
|
+
values.push(await numberFormatValue(first, budget, context));
|
|
26060
|
+
if (range) values.push(await numberFormatValue(second, budget, context));
|
|
26061
|
+
return allocateProducedSandboxValue(formatNumberValue(context?.thisValue, method, values), budget);
|
|
26062
|
+
} finally {
|
|
26063
|
+
release();
|
|
26064
|
+
}
|
|
26065
|
+
}
|
|
26066
|
+
}), writable: true, configurable: true });
|
|
26067
|
+
}
|
|
26068
|
+
return constructor;
|
|
26069
|
+
}
|
|
26070
|
+
|
|
25894
26071
|
// packages/safe-js/src/interp/globals/intl.ts
|
|
25895
26072
|
var supportedValuesOf = Intl.supportedValuesOf;
|
|
25896
26073
|
function createIntlGlobal(budget) {
|
|
@@ -25905,15 +26082,17 @@ function createIntlGlobal(budget) {
|
|
|
25905
26082
|
const intl = createIntrinsicObject();
|
|
25906
26083
|
const locale = createLocaleConstructor(budget);
|
|
25907
26084
|
const collator = createCollatorConstructor(budget);
|
|
26085
|
+
const numberFormat = createNumberFormatConstructor(budget);
|
|
25908
26086
|
Object.defineProperty(intl, "Locale", { value: locale, writable: true, configurable: true });
|
|
25909
26087
|
Object.defineProperty(intl, "Collator", { value: collator, writable: true, configurable: true });
|
|
26088
|
+
Object.defineProperty(intl, "NumberFormat", { value: numberFormat, writable: true, configurable: true });
|
|
25910
26089
|
for (const [name, call] of Object.entries(methods2)) {
|
|
25911
26090
|
const closure = createSandboxClosure({ guest: true, sandbox: true, name, length: 1, call });
|
|
25912
26091
|
Object.defineProperty(intl, name, { value: closure, writable: true, configurable: true });
|
|
25913
26092
|
}
|
|
25914
26093
|
Object.defineProperty(intl, Symbol.toStringTag, { value: "Intl", configurable: true });
|
|
25915
26094
|
registerBuiltinIdentities(budget, { Intl: intl });
|
|
25916
|
-
for (const constructor of [locale, collator]) {
|
|
26095
|
+
for (const constructor of [locale, collator, numberFormat]) {
|
|
25917
26096
|
const prototype = constructor.properties.prototype;
|
|
25918
26097
|
for (const owner of [prototype, constructor.properties])
|
|
25919
26098
|
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(owner)))
|
|
@@ -26030,7 +26209,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
26030
26209
|
createRawJson(node.text);
|
|
26031
26210
|
return true;
|
|
26032
26211
|
}
|
|
26033
|
-
if (!["module-function", "async-generator-driver", "async-generator-handler", "async-function-driver", "async-function-handler", "thenable-state", "thenable-resolver", "construction-environment", "capability-executor", "promise-aggregate", "aggregate-entry", "aggregate-handler", "intrinsic", "bound-function", "promise-resolver", "pending-promise", "promise-reaction", "promise-adoption", "adoption-resolver", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-locale", "guest-collator", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "async-disposable-stack", "async-cleanup", "async-cleanup-handler", "disposable-stack", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
26212
|
+
if (!["module-function", "async-generator-driver", "async-generator-handler", "async-function-driver", "async-function-handler", "thenable-state", "thenable-resolver", "construction-environment", "capability-executor", "promise-aggregate", "aggregate-entry", "aggregate-handler", "intrinsic", "bound-function", "promise-resolver", "pending-promise", "promise-reaction", "promise-adoption", "adoption-resolver", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-locale", "guest-numberformat", "guest-collator", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "async-disposable-stack", "async-cleanup", "async-cleanup-handler", "disposable-stack", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
|
|
26034
26213
|
const reference = (value, kinds) => {
|
|
26035
26214
|
const ref = record2(value);
|
|
26036
26215
|
fields(ref, ["kind", "id"]);
|
|
@@ -26299,6 +26478,21 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
26299
26478
|
fields(node, ["kind", "source", "flags", "state"]);
|
|
26300
26479
|
if (typeof node.source !== "string" || typeof node.flags !== "string") throw new TypeError("Invalid guest RegExp payload.");
|
|
26301
26480
|
state(node.state);
|
|
26481
|
+
} else if (node.kind === "guest-numberformat") {
|
|
26482
|
+
fields(node, ["kind", "options", "state"], ["format"]);
|
|
26483
|
+
const options = record2(node.options);
|
|
26484
|
+
fields(options, ["locale"], ["numberingSystem", "style", "currency", "currencyDisplay", "currencySign", "unit", "unitDisplay", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits", "useGrouping", "notation", "compactDisplay", "signDisplay", "roundingIncrement", "roundingMode", "roundingPriority", "trailingZeroDisplay"]);
|
|
26485
|
+
if (typeof options.locale !== "string" || Object.values(options).some((value) => !["string", "number", "boolean"].includes(typeof value)))
|
|
26486
|
+
throw new TypeError("Invalid NumberFormat option type.");
|
|
26487
|
+
const restored = numberFormatState(createSandboxNumberFormat(options.locale, options)).options;
|
|
26488
|
+
if (Object.keys(options).length !== Object.keys(restored).length || Object.keys(restored).some((key) => options[key] !== restored[key]))
|
|
26489
|
+
throw new TypeError("Invalid resolved NumberFormat options.");
|
|
26490
|
+
if (node.format !== void 0) {
|
|
26491
|
+
const format = reference(node.format, ["bound-function"]);
|
|
26492
|
+
if (reference(format.thisValue) !== node || array(format.args).length !== 0 || format.name !== "" || format.length !== 1 || reference(format.target, ["intrinsic"]).id !== '["%NumberFormatFormat%"]')
|
|
26493
|
+
throw new TypeError("Invalid cached NumberFormat function.");
|
|
26494
|
+
}
|
|
26495
|
+
state(node.state);
|
|
26302
26496
|
} else if (node.kind === "guest-collator") {
|
|
26303
26497
|
fields(node, ["kind", "options", "state"], ["compare"]);
|
|
26304
26498
|
const options = record2(node.options);
|
|
@@ -30054,6 +30248,11 @@ function measureSandboxData(values, options = {}) {
|
|
|
30054
30248
|
}
|
|
30055
30249
|
if (isSandboxDate(value)) usage += 8;
|
|
30056
30250
|
if (isSandboxLocale(value)) usage += localeTag(value).length;
|
|
30251
|
+
if (isSandboxNumberFormat(value)) {
|
|
30252
|
+
const state = numberFormatState(value);
|
|
30253
|
+
visit(state.options, depth + 1);
|
|
30254
|
+
visit(state.format, depth + 1);
|
|
30255
|
+
}
|
|
30057
30256
|
if (isSandboxCollator(value)) {
|
|
30058
30257
|
const state = collatorState(value);
|
|
30059
30258
|
visit(state.options, depth + 1);
|
|
@@ -48022,4 +48221,4 @@ export {
|
|
|
48022
48221
|
FileSnapshotBackend,
|
|
48023
48222
|
run
|
|
48024
48223
|
};
|
|
48025
|
-
//# sourceMappingURL=chunk-
|
|
48224
|
+
//# sourceMappingURL=chunk-D5ZEIZYV.js.map
|