@poe-platform/safe-js 0.1.391 → 0.1.393

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.
@@ -647,6 +647,64 @@ function* hoistedVarDeclarations(nodes) {
647
647
  }
648
648
  }
649
649
 
650
+ // packages/safe-js/src/parse/private-names.ts
651
+ function validatePrivateNames(root) {
652
+ const pending = [{ value: root }];
653
+ while (pending.length > 0) {
654
+ const { value, scope, declaration } = pending.pop();
655
+ if (value === null || typeof value !== "object") continue;
656
+ if (Array.isArray(value)) {
657
+ for (const entry of value) pending.push({ value: entry, scope });
658
+ continue;
659
+ }
660
+ const node = value;
661
+ if (node.type === "ClassDeclaration" || node.type === "ClassExpression") {
662
+ const klass = value;
663
+ pending.push({ value: klass.superClass, scope });
664
+ const inner = { names: /* @__PURE__ */ new Set(), parent: scope };
665
+ const declarations = /* @__PURE__ */ new Map();
666
+ for (const element of klass.body.body) {
667
+ if (element.type === "StaticBlock" || element.key.type !== "PrivateIdentifier") continue;
668
+ const name = element.key.name;
669
+ if (name === "constructor") throw new Error("Private name #constructor is forbidden.");
670
+ const kind = element.type === "MethodDefinition" ? element.kind : "field";
671
+ const previous = declarations.get(name);
672
+ if (previous !== void 0 && !(previous.static === element.static && (previous.kind === "get" && kind === "set" || previous.kind === "set" && kind === "get")))
673
+ throw new Error(`Duplicate private name #${name}.`);
674
+ declarations.set(name, { kind: previous === void 0 ? kind : "pair", static: element.static });
675
+ inner.names.add(name);
676
+ }
677
+ pending.push({ value: klass.body, scope: inner });
678
+ continue;
679
+ }
680
+ if (node.type === "PrivateIdentifier") {
681
+ if (declaration) continue;
682
+ let owner = scope;
683
+ while (owner !== void 0 && !owner.names.has(String(node.name))) owner = owner.parent;
684
+ if (owner === void 0) throw new Error(`Undeclared private name #${String(node.name)}.`);
685
+ continue;
686
+ }
687
+ if (node.type === "MemberExpression") {
688
+ const property = node.property;
689
+ if (property.type === "PrivateIdentifier" && node.object.type === "Super")
690
+ throw new Error("super cannot access a private name.");
691
+ }
692
+ if (node.type === "UnaryExpression" && node.operator === "delete") {
693
+ const argument = node.argument;
694
+ if (argument.type === "MemberExpression" && argument.property.type === "PrivateIdentifier")
695
+ throw new Error("Private elements cannot be deleted.");
696
+ }
697
+ for (const [key, child] of Object.entries(node)) {
698
+ if (key === "span") continue;
699
+ pending.push({
700
+ value: child,
701
+ scope,
702
+ declaration: key === "key" && (node.type === "MethodDefinition" || node.type === "PropertyDefinition")
703
+ });
704
+ }
705
+ }
706
+ }
707
+
650
708
  // packages/safe-js/src/interp/regex/compile-guard.ts
651
709
  var compiledData = /* @__PURE__ */ new WeakMap();
652
710
  var CompileScope = class {
@@ -962,6 +1020,11 @@ var Lexer = class {
962
1020
  if (char === "*" && this.peekChar(1) === "/") {
963
1021
  this.syntaxError("Unexpected block comment terminator", start);
964
1022
  }
1023
+ if (char === "#") {
1024
+ this.advance();
1025
+ this.readIdentifierOrKeyword(start, true);
1026
+ continue;
1027
+ }
965
1028
  if (isIdentifierStart(codePointChar) || this.startsUnicodeEscape()) {
966
1029
  this.readIdentifierOrKeyword(start);
967
1030
  continue;
@@ -1018,7 +1081,7 @@ var Lexer = class {
1018
1081
  break;
1019
1082
  }
1020
1083
  }
1021
- readIdentifierOrKeyword(start) {
1084
+ readIdentifierOrKeyword(start, privateName = false) {
1022
1085
  let value = "";
1023
1086
  let isStart = true;
1024
1087
  while (!this.isAtEnd()) {
@@ -1042,7 +1105,8 @@ var Lexer = class {
1042
1105
  value += char;
1043
1106
  isStart = false;
1044
1107
  }
1045
- this.pushToken(KEYWORDS.has(value) ? "keyword" : "identifier", start, value);
1108
+ if (privateName && isStart) this.syntaxError("Expected private identifier", start);
1109
+ this.pushToken(privateName ? "private-identifier" : KEYWORDS.has(value) ? "keyword" : "identifier", start, value);
1046
1110
  }
1047
1111
  readString(start, quote) {
1048
1112
  this.advance();
@@ -1732,7 +1796,7 @@ function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis, t
1732
1796
  if (previousToken === void 0) {
1733
1797
  return true;
1734
1798
  }
1735
- if (previousToken.type === "identifier" || previousToken.type === "numeric" || previousToken.type === "string" || previousToken.type === "template") {
1799
+ if (previousToken.type === "identifier" || previousToken.type === "private-identifier" || previousToken.type === "numeric" || previousToken.type === "string" || previousToken.type === "template") {
1736
1800
  return false;
1737
1801
  }
1738
1802
  if (previousToken.type === "keyword") {
@@ -2917,6 +2981,7 @@ function parse(source, filename = "<input>", owner) {
2917
2981
  );
2918
2982
  }
2919
2983
  throwIfImportMetaAssignment(result);
2984
+ if (source.includes("#")) validatePrivateNames(result);
2920
2985
  return result;
2921
2986
  } catch (error) {
2922
2987
  if (error instanceof DisallowedSyntaxError || error instanceof SandboxError) {
@@ -2933,13 +2998,15 @@ function parse(source, filename = "<input>", owner) {
2933
2998
  function parseModule(source, filename = "<input>", owner) {
2934
2999
  const compilation = new CompileScope(owner);
2935
3000
  try {
2936
- return assignIds(
3001
+ const result = assignIds(
2937
3002
  new Parser(
2938
3003
  tokenize(source, { allowRegexLiterals: true, compilation }),
2939
3004
  source,
2940
3005
  compilation
2941
3006
  ).parseModule()
2942
3007
  );
3008
+ if (source.includes("#")) validatePrivateNames(result);
3009
+ return result;
2943
3010
  } catch (error) {
2944
3011
  if (error instanceof DisallowedSyntaxError || error instanceof SandboxError) {
2945
3012
  throw error;
@@ -2963,6 +3030,7 @@ function parseExecutableModule(source, filename = "<input>", owner) {
2963
3030
  ).parseModule()
2964
3031
  );
2965
3032
  throwIfImportMetaAssignment(result);
3033
+ if (source.includes("#")) validatePrivateNames(result);
2966
3034
  return result;
2967
3035
  } catch (error) {
2968
3036
  if (error instanceof DisallowedSyntaxError || error instanceof SandboxError) {
@@ -3889,7 +3957,7 @@ var Parser = class {
3889
3957
  parseClassElement(derived) {
3890
3958
  const start = this.currentToken();
3891
3959
  let isStatic = false;
3892
- if (start.value === "static" && !["(", "=", ";", "}"].includes(this.peekToken(1).value)) {
3960
+ if (start.type !== "private-identifier" && start.value === "static" && !["(", "=", ";", "}"].includes(this.peekToken(1).value)) {
3893
3961
  this.index++;
3894
3962
  isStatic = true;
3895
3963
  if (this.currentToken().value === "{") {
@@ -3907,21 +3975,21 @@ var Parser = class {
3907
3975
  }
3908
3976
  const methodStart = this.currentToken();
3909
3977
  let async = false;
3910
- if (methodStart.value === "async" && !hasLineBreakBetween(methodStart, this.peekToken(1)) && (this.peekToken(1).value === "*" || this.isObjectMethodStart())) {
3978
+ if (methodStart.type !== "private-identifier" && methodStart.value === "async" && !hasLineBreakBetween(methodStart, this.peekToken(1)) && (this.peekToken(1).value === "*" || this.isObjectMethodStart())) {
3911
3979
  this.index++;
3912
3980
  async = true;
3913
3981
  }
3914
3982
  const generator = this.consumePunctuator("*") !== void 0;
3915
3983
  let accessor;
3916
3984
  const modifier = this.currentToken();
3917
- if ((modifier.value === "get" || modifier.value === "set") && this.isObjectMethodStart()) {
3985
+ if (modifier.type !== "private-identifier" && (modifier.value === "get" || modifier.value === "set") && this.isObjectMethodStart()) {
3918
3986
  if (async || generator || modifier.end.offset - modifier.start.offset !== modifier.value.length)
3919
3987
  throw unexpectedTokenError(modifier);
3920
3988
  accessor = modifier.value;
3921
3989
  this.index++;
3922
3990
  }
3923
3991
  const computed = this.consumePunctuator("[") !== void 0;
3924
- const key = computed ? this.parseExpression({ allowSequence: true }).node : this.currentToken().type === "string" ? createStringLiteral(this.tokens[this.index++]) : this.currentToken().type === "numeric" ? createNumericLiteral(this.tokens[this.index++]) : this.parseIdentifierName();
3992
+ const key = computed ? this.parseExpression({ allowSequence: true }).node : this.currentToken().type === "string" ? createStringLiteral(this.tokens[this.index++]) : this.currentToken().type === "numeric" ? createNumericLiteral(this.tokens[this.index++]) : this.currentToken().type === "private-identifier" ? this.parsePrivateIdentifier() : this.parseIdentifierName();
3925
3993
  if (computed) this.expectPunctuator("]");
3926
3994
  const name = computed ? void 0 : key.type === "Identifier" ? key.name : key.type === "StringLiteral" || key.type === "NumericLiteral" ? String(key.value) : void 0;
3927
3995
  if (isStatic && name === "prototype") throw new Error("A static class element cannot be named prototype.");
@@ -4518,6 +4586,22 @@ var Parser = class {
4518
4586
  return this.parseBinaryExpression(() => this.parseRelationalExpression(), EQUALITY_OPERATORS);
4519
4587
  }
4520
4588
  parseRelationalExpression() {
4589
+ if (this.currentToken().type === "private-identifier") {
4590
+ const left = this.parsePrivateIdentifier();
4591
+ this.expectKeyword("in");
4592
+ const right = this.parseShiftExpression();
4593
+ return this.parseBinaryExpression(
4594
+ () => this.parseShiftExpression(),
4595
+ RELATIONAL_OPERATORS,
4596
+ { node: {
4597
+ type: "BinaryExpression",
4598
+ operator: "in",
4599
+ left,
4600
+ right: right.node,
4601
+ span: createSpan2(left.span.start, right.node.span.end)
4602
+ }, parenthesized: false }
4603
+ );
4604
+ }
4521
4605
  return this.parseBinaryExpression(() => this.parseShiftExpression(), RELATIONAL_OPERATORS);
4522
4606
  }
4523
4607
  parseShiftExpression() {
@@ -4683,7 +4767,7 @@ var Parser = class {
4683
4767
  };
4684
4768
  continue;
4685
4769
  }
4686
- const property = this.parseIdentifierName();
4770
+ const property = this.currentToken().type === "private-identifier" ? this.parsePrivateIdentifier() : this.parseIdentifierName();
4687
4771
  expression = {
4688
4772
  node: {
4689
4773
  type: "MemberExpression",
@@ -4698,7 +4782,7 @@ var Parser = class {
4698
4782
  continue;
4699
4783
  }
4700
4784
  if (this.consumePunctuator(".") !== void 0) {
4701
- const property = this.parseIdentifierName();
4785
+ const property = this.currentToken().type === "private-identifier" ? this.parsePrivateIdentifier() : this.parseIdentifierName();
4702
4786
  expression = {
4703
4787
  node: {
4704
4788
  type: "MemberExpression",
@@ -4904,7 +4988,7 @@ var Parser = class {
4904
4988
  let callee = this.parsePrimaryExpression();
4905
4989
  while (true) {
4906
4990
  if (this.consumePunctuator(".") !== void 0) {
4907
- const property = this.parseIdentifierName();
4991
+ const property = this.currentToken().type === "private-identifier" ? this.parsePrivateIdentifier() : this.parseIdentifierName();
4908
4992
  callee = {
4909
4993
  node: {
4910
4994
  type: "MemberExpression",
@@ -5201,7 +5285,7 @@ var Parser = class {
5201
5285
  offset += 1;
5202
5286
  }
5203
5287
  }
5204
- return (propertyToken.type === "identifier" || propertyToken.type === "keyword" || propertyToken.type === "numeric" || propertyToken.type === "string") && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(";
5288
+ return (propertyToken.type === "identifier" || propertyToken.type === "private-identifier" || propertyToken.type === "keyword" || propertyToken.type === "numeric" || propertyToken.type === "string") && this.peekToken(2).type === "punctuator" && this.peekToken(2).value === "(";
5205
5289
  }
5206
5290
  parseObjectMethod(asyncToken, methodStart, accessor, generatorToken) {
5207
5291
  const { params, body } = this.parseFunctionParts(generatorToken !== void 0, {
@@ -5228,6 +5312,12 @@ var Parser = class {
5228
5312
  this.index += 1;
5229
5313
  return createIdentifierName(token);
5230
5314
  }
5315
+ parsePrivateIdentifier() {
5316
+ const token = this.currentToken();
5317
+ if (token.type !== "private-identifier") throw unexpectedTokenError(token);
5318
+ this.index++;
5319
+ return { type: "PrivateIdentifier", name: token.value, span: createSpan2(token.start, token.end) };
5320
+ }
5231
5321
  parseArguments() {
5232
5322
  const args = [];
5233
5323
  const emptyEnd = this.consumePunctuator(")");
@@ -5288,8 +5378,8 @@ var Parser = class {
5288
5378
  }
5289
5379
  return left;
5290
5380
  }
5291
- parseBinaryExpression(parseOperand, operators) {
5292
- let left = parseOperand();
5381
+ parseBinaryExpression(parseOperand, operators, initial) {
5382
+ let left = initial ?? parseOperand();
5293
5383
  while (true) {
5294
5384
  const token = this.currentToken();
5295
5385
  if (!operators.has(token.value)) {
@@ -8552,6 +8642,23 @@ var iteratorWrapperStates = /* @__PURE__ */ new WeakMap();
8552
8642
  // packages/safe-js/src/interp/iterator-helper.ts
8553
8643
  var iteratorHelperStates = /* @__PURE__ */ new WeakMap();
8554
8644
 
8645
+ // packages/safe-js/src/interp/private-state.ts
8646
+ var privateElements = /* @__PURE__ */ new WeakMap();
8647
+ function findPrivateElement(receiver, name) {
8648
+ if (receiver === null || typeof receiver !== "object") throw new TypeError("Private elements require an object receiver.");
8649
+ return privateElements.get(receiver)?.get(name);
8650
+ }
8651
+ function addPrivateElement(receiver, name, element) {
8652
+ if (receiver === null || typeof receiver !== "object") throw new TypeError("Private elements require an object receiver.");
8653
+ let slots = privateElements.get(receiver);
8654
+ if (slots === void 0) {
8655
+ slots = /* @__PURE__ */ new Map();
8656
+ privateElements.set(receiver, slots);
8657
+ }
8658
+ if (slots.has(name)) throw new TypeError(`Private element #${name.description} is already installed.`);
8659
+ slots.set(name, element);
8660
+ }
8661
+
8555
8662
  // packages/safe-js/src/interp/raw-json.ts
8556
8663
  var rawJsonValues = /* @__PURE__ */ new WeakSet();
8557
8664
  function createRawJson(text) {
@@ -8685,6 +8792,9 @@ async function flushPromiseJobs() {
8685
8792
  }
8686
8793
  }
8687
8794
 
8795
+ // packages/safe-js/src/interp/promise-state.ts
8796
+ var promiseStates = /* @__PURE__ */ new WeakMap();
8797
+
8688
8798
  // packages/safe-js/src/interp/promise-replay.ts
8689
8799
  import { AsyncLocalStorage as AsyncLocalStorage5 } from "node:async_hooks";
8690
8800
 
@@ -10366,7 +10476,7 @@ async function bindArrayPattern(pattern, value, target, scope, context) {
10366
10476
  target,
10367
10477
  scope,
10368
10478
  elementContext,
10369
- Object.hasOwn(saved, "referenceObject") ? { object: saved.referenceObject, key: saved.referenceKey } : void 0
10479
+ Object.hasOwn(saved, "referenceObject") ? { object: saved.referenceObject, key: saved.referenceKey, privateName: saved.privateName } : void 0
10370
10480
  ) : await bindPatternValue(
10371
10481
  element,
10372
10482
  async () => {
@@ -10389,6 +10499,7 @@ async function bindArrayPattern(pattern, value, target, scope, context) {
10389
10499
  if (reference !== void 0) {
10390
10500
  state.referenceObject = reference.object;
10391
10501
  state.referenceKey = reference.key;
10502
+ if (reference.privateName !== void 0) state.privateName = reference.privateName;
10392
10503
  }
10393
10504
  }
10394
10505
  );
@@ -10453,7 +10564,7 @@ async function bindObjectPattern(pattern, value, target, scope, context) {
10453
10564
  target,
10454
10565
  scope,
10455
10566
  propertyContext,
10456
- Object.hasOwn(state, "referenceObject") ? { object: state.referenceObject, key: state.referenceKey } : void 0
10567
+ Object.hasOwn(state, "referenceObject") ? { object: state.referenceObject, key: state.referenceKey, privateName: state.privateName } : void 0
10457
10568
  ) : await bindPatternValue(
10458
10569
  element,
10459
10570
  async () => ({ value: property.type === "RestElement" ? await copyObjectRestValue(value, excludedKeys, propertyContext) : await propertyContext.getProperty(value, currentState.key) }),
@@ -10466,6 +10577,7 @@ async function bindObjectPattern(pattern, value, target, scope, context) {
10466
10577
  if (reference !== void 0) {
10467
10578
  currentState.referenceObject = reference.object;
10468
10579
  currentState.referenceKey = reference.key;
10580
+ if (reference.privateName !== void 0) currentState.privateName = reference.privateName;
10469
10581
  }
10470
10582
  }
10471
10583
  );
@@ -10488,7 +10600,10 @@ async function bindMemberExpression(pattern, value, context, reference) {
10488
10600
  if (!isIndexableValue(reference.object)) {
10489
10601
  throw new TypeError("Assignment expressions require a sandbox object property.");
10490
10602
  }
10491
- await context.setProperty(reference.object, reference.key, value);
10603
+ if (reference.privateName !== void 0) {
10604
+ if (context.setPrivateProperty === void 0) throw new TypeError("Private assignment context is unavailable.");
10605
+ await context.setPrivateProperty(reference.object, reference.privateName, value);
10606
+ } else await context.setProperty(reference.object, reference.key, value);
10492
10607
  return { ok: true };
10493
10608
  }
10494
10609
  async function prepareMemberReference(pattern, context) {
@@ -15618,7 +15733,11 @@ async function evaluateClass(node, context, evaluateNode2, callContext) {
15618
15733
  throw new TypeError("Class extends value has an invalid prototype.");
15619
15734
  }
15620
15735
  const derived = node.superClass !== void 0;
15736
+ for (const element of node.body.body)
15737
+ if (element.type !== "StaticBlock" && element.key.type === "PrivateIdentifier") scope.declarePrivateName(element.key.name);
15621
15738
  constructor = createClassConstructor(node, { ...classContext, inferredName: context.inferredName }, evaluateNode2, fields2);
15739
+ const instancePrivate = classOrigins.get(constructor).privateMethods;
15740
+ const staticPrivate = /* @__PURE__ */ new Map();
15622
15741
  const properties = materializeFunctionProperties(constructor);
15623
15742
  const prototype = properties.prototype;
15624
15743
  Object.defineProperty(properties, "prototype", { writable: false });
@@ -15633,16 +15752,17 @@ async function evaluateClass(node, context, evaluateNode2, callContext) {
15633
15752
  }
15634
15753
  if (element.type === "MethodDefinition" && element.kind === "constructor") continue;
15635
15754
  let key;
15755
+ const privateName = element.key.type === "PrivateIdentifier" ? scope.resolvePrivateName(element.key.name) : void 0;
15636
15756
  if (element.computed) {
15637
15757
  const result = await evaluateNode2(element.key, classContext);
15638
15758
  if (result.kind !== "normal") return result;
15639
15759
  key = await pattern.toPropertyKey(result.value);
15640
15760
  } else {
15641
- key = element.key.type === "Identifier" ? element.key.name : String(element.key.value);
15761
+ key = privateName !== void 0 ? `#${privateName.description}` : element.key.type === "Identifier" ? element.key.name : String(element.key.value);
15642
15762
  }
15643
15763
  if (typeof key === "string") context.budget.allocateString(key);
15644
15764
  if (element.type === "PropertyDefinition") {
15645
- (element.static ? statics : fields2).push({ element, key });
15765
+ (element.static ? statics : fields2).push({ element, key, ...privateName === void 0 ? {} : { privateName } });
15646
15766
  } else {
15647
15767
  const home = element.static ? constructor : prototype;
15648
15768
  const method = createInterpretedClosure(element.value, classContext, evaluateNode2, home);
@@ -15650,6 +15770,20 @@ async function evaluateClass(node, context, evaluateNode2, callContext) {
15650
15770
  Object.defineProperty(materializeFunctionProperties(method), "name", {
15651
15771
  value: accessor === void 0 ? propertyFunctionName(key) : `${accessor} ${propertyFunctionName(key)}`
15652
15772
  });
15773
+ if (privateName !== void 0) {
15774
+ const entries = element.static ? staticPrivate : instancePrivate;
15775
+ if (accessor === void 0) entries.set(privateName, { kind: "method", value: method });
15776
+ else {
15777
+ let entry = entries.get(privateName);
15778
+ if (entry === void 0) {
15779
+ entry = { kind: "accessor" };
15780
+ entries.set(privateName, entry);
15781
+ }
15782
+ if (entry.kind !== "accessor") throw new TypeError("Invalid private accessor declaration.");
15783
+ entry[accessor] = method;
15784
+ }
15785
+ continue;
15786
+ }
15653
15787
  Object.defineProperty(
15654
15788
  element.static ? properties : prototype,
15655
15789
  key,
@@ -15658,6 +15792,7 @@ async function evaluateClass(node, context, evaluateNode2, callContext) {
15658
15792
  }
15659
15793
  }
15660
15794
  if (node.id !== void 0) scope.declare(node.id.name, "const", constructor);
15795
+ for (const [name, element] of staticPrivate) addPrivateElement(constructor, name, element);
15661
15796
  for (const element of statics) await initializeElement(element, constructor, constructor, classContext, evaluateNode2);
15662
15797
  classOrigins.get(constructor).initialized = true;
15663
15798
  if (node.type === "ClassDeclaration") {
@@ -15681,7 +15816,15 @@ function createClassConstructor(node, context, evaluateNode2, fields2) {
15681
15816
  name: node.id?.name ?? context.inferredName ?? "",
15682
15817
  length: constructorElement === void 0 ? 0 : getFunctionLength(constructorElement.value.params),
15683
15818
  sourceRange: functionSources.get(node),
15684
- retainedValues: () => [...scope.retainedValues(), ...fields2.map((field) => field.key)],
15819
+ retainedValues: () => {
15820
+ const values = [...scope.retainedValues(), ...fields2.flatMap((field) => field.privateName === void 0 ? [field.key] : [field.key, field.privateName])];
15821
+ for (const [name, element] of classOrigins.get(constructor)?.privateMethods ?? []) {
15822
+ values.push(name);
15823
+ if (element.kind === "accessor") values.push(element.get, element.set);
15824
+ else values.push(element.value);
15825
+ }
15826
+ return values;
15827
+ },
15685
15828
  call: () => {
15686
15829
  throw new TypeError("Class constructor cannot be invoked without 'new'.");
15687
15830
  },
@@ -15692,6 +15835,7 @@ function createClassConstructor(node, context, evaluateNode2, fields2) {
15692
15835
  let thisScope;
15693
15836
  let initialized = !derived;
15694
15837
  const initializeFields = async (receiver) => {
15838
+ for (const [name, element] of classOrigins.get(constructor).privateMethods) addPrivateElement(receiver, name, element);
15695
15839
  for (const field of fields2) {
15696
15840
  await initializeElement(field, receiver, prototype, classContext, evaluateNode2);
15697
15841
  }
@@ -15742,7 +15886,7 @@ function createClassConstructor(node, context, evaluateNode2, fields2) {
15742
15886
  return thisValue;
15743
15887
  }
15744
15888
  });
15745
- classOrigins.set(constructor, { node, scope, fields: fields2, initialized: false });
15889
+ classOrigins.set(constructor, { node, scope, fields: fields2, initialized: false, privateMethods: /* @__PURE__ */ new Map() });
15746
15890
  return constructor;
15747
15891
  }
15748
15892
  async function initializeElement(definition, receiver, homeObject, context, evaluateNode2) {
@@ -15759,7 +15903,8 @@ async function initializeElement(definition, receiver, homeObject, context, eval
15759
15903
  value = result.hasValue ? result.value : void 0;
15760
15904
  }
15761
15905
  if ("key" in definition) {
15762
- await defineDataProperty(receiver, definition.key, { value, configurable: true, writable: true, enumerable: true }, context.budget, createCoercionContext(context));
15906
+ if (definition.privateName !== void 0) addPrivateElement(receiver, definition.privateName, { kind: "field", value });
15907
+ else await defineDataProperty(receiver, definition.key, { value, configurable: true, writable: true, enumerable: true }, context.budget, createCoercionContext(context));
15763
15908
  }
15764
15909
  }
15765
15910
 
@@ -16433,6 +16578,7 @@ var Scope = class _Scope {
16433
16578
  parent;
16434
16579
  importMeta;
16435
16580
  options;
16581
+ privateNames;
16436
16582
  #bindings = /* @__PURE__ */ new Map();
16437
16583
  #restoredBindings;
16438
16584
  #frameHydrated = false;
@@ -16442,6 +16588,25 @@ var Scope = class _Scope {
16442
16588
  ...options
16443
16589
  });
16444
16590
  }
16591
+ declarePrivateName(description) {
16592
+ const names = this.privateNames ??= /* @__PURE__ */ new Map();
16593
+ const existing = names.get(description);
16594
+ if (existing !== void 0) return existing;
16595
+ const name = { description };
16596
+ names.set(description, name);
16597
+ return name;
16598
+ }
16599
+ resolvePrivateName(description) {
16600
+ const ownName = this.privateNames?.get(description);
16601
+ if (ownName !== void 0) return ownName;
16602
+ let scope = this.parent;
16603
+ while (scope !== void 0) {
16604
+ const name = scope.privateNames?.get(description);
16605
+ if (name !== void 0) return name;
16606
+ scope = scope.parent;
16607
+ }
16608
+ throw new SyntaxError(`Undeclared private name #${description}.`);
16609
+ }
16445
16610
  consumeRestoredBinding(name) {
16446
16611
  if (!this.#restoredBindings.has(name)) {
16447
16612
  return { found: false };
@@ -16483,6 +16648,7 @@ var Scope = class _Scope {
16483
16648
  const values = this.parent?.retainedValues() ?? [];
16484
16649
  if (this.options.chargeData !== false) {
16485
16650
  if (this.importMeta !== void 0) values.push(this.importMeta);
16651
+ if (this.privateNames !== void 0) values.push(...this.privateNames.values());
16486
16652
  for (const binding of this.#bindings.values()) {
16487
16653
  if (binding.value !== uninitialized) values.push(binding.value);
16488
16654
  }
@@ -16610,6 +16776,7 @@ var Scope = class _Scope {
16610
16776
  chargeData: this.options.chargeData !== false,
16611
16777
  bindings,
16612
16778
  cells,
16779
+ ...this.privateNames === void 0 ? {} : { privateNames: [...this.privateNames] },
16613
16780
  ...this.parent === void 0 ? { restoredBindings: [...this.#restoredBindings] } : {}
16614
16781
  };
16615
16782
  }
@@ -16636,6 +16803,7 @@ var Scope = class _Scope {
16636
16803
  const restored = new Map(frame.restoredBindings ?? []);
16637
16804
  if (restored.size !== (frame.restoredBindings?.length ?? 0)) throw new TypeError("Duplicate restored binding.");
16638
16805
  this.importMeta = frame.importMeta;
16806
+ if (frame.privateNames !== void 0) this.privateNames = new Map(frame.privateNames);
16639
16807
  for (const [name, binding] of bindings) this.#bindings.set(name, binding);
16640
16808
  if (this.parent === void 0)
16641
16809
  for (const [name, value] of restored) this.#restoredBindings.set(name, value);
@@ -17179,6 +17347,7 @@ async function evaluateTaggedTemplateExpression(node, context) {
17179
17347
  }
17180
17348
  if (node.tag.type === "MemberExpression") return evaluateMemberAccess(node.tag, context, async (member) => {
17181
17349
  if (member.kind === "nullish") throw new TypeError("Tagged template tag must be a function.");
17350
+ if (member.privateName !== void 0) return invokeTag(await readPrivateValue(member.object, member.privateName, context), member.object);
17182
17351
  const key = await toPropertyKey(member.property, context.budget, createCoercionContext(context));
17183
17352
  const receiver = member.superReceiver === void 0 ? member.object : member.superReceiver.value;
17184
17353
  return invokeTag(await getPropertyValue(member.object, key, context, receiver), receiver);
@@ -17211,6 +17380,12 @@ async function evaluateAwait(node, context) {
17211
17380
  return evaluateAwaitExpression(node, context, evaluateNode);
17212
17381
  }
17213
17382
  async function evaluateBinaryExpression(node, context) {
17383
+ if (node.left.type === "PrivateIdentifier" && node.operator === "in") {
17384
+ const name = context.scope.resolvePrivateName(node.left.name);
17385
+ const right = await evaluateNode(node.right, context);
17386
+ if (right.kind !== "normal") return right;
17387
+ return { kind: "normal", hasValue: true, value: findPrivateElement(right.value, name) !== void 0 };
17388
+ }
17214
17389
  const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
17215
17390
  if (restored !== void 0 && restored.kind !== "binary") throw new TypeError("Invalid binary expression continuation.");
17216
17391
  const left = restored?.kind === "binary" ? { kind: "normal", hasValue: true, value: restored.left } : await evaluateNode(node.left, context);
@@ -17358,12 +17533,12 @@ async function evaluateMemberAssignmentExpression(node, context) {
17358
17533
  if (member.object === null || member.object === void 0) {
17359
17534
  throw new TypeError("Cannot assign properties of null or undefined.");
17360
17535
  }
17361
- property = await toPropertyKey(
17536
+ property = member.privateName === void 0 ? await toPropertyKey(
17362
17537
  member.property,
17363
17538
  context.budget,
17364
17539
  createCoercionContext(context)
17365
- );
17366
- current = await getPropertyValue(
17540
+ ) : void 0;
17541
+ current = member.privateName !== void 0 ? await readPrivateValue(member.object, member.privateName, context) : await getPropertyValue(
17367
17542
  member.object,
17368
17543
  property,
17369
17544
  context,
@@ -17397,6 +17572,7 @@ async function evaluateMemberAssignmentExpression(node, context) {
17397
17572
  object: member.object,
17398
17573
  property: member.property,
17399
17574
  current,
17575
+ ...member.privateName === void 0 ? {} : { privateName: member.privateName.description },
17400
17576
  ...property === void 0 ? {} : { key: property },
17401
17577
  ...member.superReceiver === void 0 ? {} : { superReceiver: member.superReceiver.value }
17402
17578
  };
@@ -17415,12 +17591,13 @@ async function evaluateMemberAssignmentExpression(node, context) {
17415
17591
  throw new TypeError("Cannot assign properties of null or undefined.");
17416
17592
  }
17417
17593
  operands = [value, member.object, member.property, member.superReceiver?.value];
17418
- property ??= await toPropertyKey(
17594
+ if (member.privateName === void 0) property ??= await toPropertyKey(
17419
17595
  member.property,
17420
17596
  context.budget,
17421
17597
  createCoercionContext(context)
17422
17598
  );
17423
- if (member.superReceiver === void 0)
17599
+ if (member.privateName !== void 0) await writePrivateValue(member.object, member.privateName, value, context);
17600
+ else if (member.superReceiver === void 0)
17424
17601
  await setSandboxProperty(
17425
17602
  member.object,
17426
17603
  property,
@@ -17444,6 +17621,7 @@ async function evaluateMemberAssignmentExpression(node, context) {
17444
17621
  kind: "resolved",
17445
17622
  object: restored.object,
17446
17623
  property: restored.property,
17624
+ ...restored.privateName === void 0 ? {} : { privateName: context.scope.resolvePrivateName(restored.privateName) },
17447
17625
  ...Object.hasOwn(restored, "superReceiver") ? { superReceiver: { value: restored.superReceiver } } : {}
17448
17626
  });
17449
17627
  return evaluateMemberAccess(node.left, context, assign);
@@ -18650,11 +18828,12 @@ async function evaluateMemberUpdateExpression(node, context) {
18650
18828
  if (member.kind === "nullish" || member.object === null || member.object === void 0) {
18651
18829
  throw new TypeError("Cannot update properties of null or undefined.");
18652
18830
  }
18653
- const property = await toPropertyKey(member.property, context.budget, createCoercionContext(context));
18654
- const primitive = await toNumericPrimitive(await getPropertyValue(member.object, property, context, member.superReceiver === void 0 ? member.object : member.superReceiver.value), context);
18831
+ const property = member.privateName === void 0 ? await toPropertyKey(member.property, context.budget, createCoercionContext(context)) : void 0;
18832
+ const primitive = await toNumericPrimitive(member.privateName !== void 0 ? await readPrivateValue(member.object, member.privateName, context) : await getPropertyValue(member.object, property, context, member.superReceiver === void 0 ? member.object : member.superReceiver.value), context);
18655
18833
  const current = typeof primitive === "bigint" ? primitive : toNumber(primitive);
18656
18834
  const next = typeof current === "bigint" ? bigIntOperation(node.operator === "++" ? "+" : "-", current, 1n, context.budget) : node.operator === "++" ? current + 1 : current - 1;
18657
- if (member.superReceiver === void 0) await setSandboxProperty(member.object, property, next, context.budget, true, createCoercionContext(context));
18835
+ if (member.privateName !== void 0) await writePrivateValue(member.object, member.privateName, next, context);
18836
+ else if (member.superReceiver === void 0) await setSandboxProperty(member.object, property, next, context.budget, true, createCoercionContext(context));
18658
18837
  else await setSuperProperty(member.object, member.superReceiver.value, property, next, context);
18659
18838
  return {
18660
18839
  kind: "normal",
@@ -18672,7 +18851,7 @@ async function evaluateMemberExpression(node, context) {
18672
18851
  return {
18673
18852
  kind: "normal",
18674
18853
  hasValue: true,
18675
- value: await getPropertyValue(
18854
+ value: member.privateName !== void 0 ? await readPrivateValue(member.object, member.privateName, context) : await getPropertyValue(
18676
18855
  member.object,
18677
18856
  await toPropertyKey(member.property, context.budget, createCoercionContext(context)),
18678
18857
  context,
@@ -18681,6 +18860,23 @@ async function evaluateMemberExpression(node, context) {
18681
18860
  };
18682
18861
  });
18683
18862
  }
18863
+ async function readPrivateValue(receiver, name, context) {
18864
+ const element = findPrivateElement(receiver, name);
18865
+ if (element === void 0) throw new TypeError(`Receiver does not declare #${name.description}.`);
18866
+ if (element.kind !== "accessor") return element.value;
18867
+ if (element.get === void 0) throw new TypeError(`Private accessor #${name.description} has no getter.`);
18868
+ return invokeBuiltinClosure(element.get, [], context.budget, createCoercionContext(context), receiver);
18869
+ }
18870
+ async function writePrivateValue(receiver, name, value, context) {
18871
+ const element = findPrivateElement(receiver, name);
18872
+ if (element === void 0) throw new TypeError(`Receiver does not declare #${name.description}.`);
18873
+ if (element.kind === "field") {
18874
+ element.value = value;
18875
+ return;
18876
+ }
18877
+ if (element.kind === "method" || element.set === void 0) throw new TypeError(`Private element #${name.description} is not writable.`);
18878
+ await invokeBuiltinClosure(element.set, [value], context.budget, createCoercionContext(context), receiver);
18879
+ }
18684
18880
  function getPropertyValue(target, property, context, receiver = target) {
18685
18881
  if (isGuestHostObject(target)) return typeof property === "symbol" ? void 0 : getHostObjectMember(target, String(property));
18686
18882
  const descriptor = getSandboxPropertyDescriptor(target, property, context.budget);
@@ -18727,13 +18923,14 @@ function createPatternContext(context, scope = context.scope, evaluate = evaluat
18727
18923
  let reference;
18728
18924
  const result = await evaluateMemberAccess(pattern, evaluationContext, async (member) => {
18729
18925
  if (member.kind === "nullish") throw new TypeError("Cannot assign properties of null or undefined.");
18730
- reference = { object: member.object, key: await toPropertyKey(member.property, context.budget, createCoercionContext(evaluationContext)) };
18926
+ reference = member.privateName === void 0 ? { object: member.object, key: await toPropertyKey(member.property, context.budget, createCoercionContext(evaluationContext)) } : { object: member.object, key: member.privateName.description, privateName: member.privateName.description };
18731
18927
  return normalEmptyResult();
18732
18928
  });
18733
18929
  return result.kind === "normal" ? { ok: true, reference } : { ok: false, result };
18734
18930
  },
18735
18931
  budget: context.budget,
18736
18932
  callContext: createCoercionContext(evaluationContext),
18933
+ setPrivateProperty: (receiver, name, value) => writePrivateValue(receiver, scope.resolvePrivateName(name), value, evaluationContext),
18737
18934
  evaluate: (node, inferredName) => evaluate(node, { ...evaluationContext, inferredName }),
18738
18935
  toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(evaluationContext)),
18739
18936
  getProperty: (value, key) => getPropertyValue(value, key, evaluationContext),
@@ -18851,6 +19048,13 @@ async function evaluateMemberAccess(node, context, consume) {
18851
19048
  if ((object.value === null || object.value === void 0) && node.optional) {
18852
19049
  return consume({ kind: "nullish" });
18853
19050
  }
19051
+ if (node.property.type === "PrivateIdentifier")
19052
+ return consume({
19053
+ kind: "resolved",
19054
+ object: object.value,
19055
+ property: void 0,
19056
+ privateName: context.scope.resolvePrivateName(node.property.name)
19057
+ });
18854
19058
  let property;
18855
19059
  if (node.computed && context.generatorYield !== void 0 && node.nodeId !== void 0) {
18856
19060
  const state = {
@@ -18922,6 +19126,8 @@ async function evaluateMemberCallExpression(node, context) {
18922
19126
  }
18923
19127
  throw new TypeError("Cannot read properties of null or undefined.");
18924
19128
  }
19129
+ if (reference.privateName !== void 0)
19130
+ return evaluateResolvedCallExpression(node, await readPrivateValue(reference.object, reference.privateName, context), context, reference.object);
18925
19131
  const member = {
18926
19132
  ...reference,
18927
19133
  property: await toPropertyKey(reference.property, context.budget, createCoercionContext(context))
@@ -22036,6 +22242,17 @@ function serializeCollectionProperties(value, encode, dataOnly = false) {
22036
22242
 
22037
22243
  // packages/safe-js/src/snapshot/guest-heap.ts
22038
22244
  function captureGuestHeapNode(value, encode) {
22245
+ if (isSandboxPromise(value)) {
22246
+ const settlement = promiseStates.get(value);
22247
+ if (settlement !== void 0 && settlement.status !== "pending")
22248
+ return { kind: "guest-promise", status: settlement.status, value: encode(settlement.value), state: captureObjectState(value, encode) };
22249
+ return void 0;
22250
+ }
22251
+ if (hasGuestObjectState(value) || privateElements.has(value)) {
22252
+ if (isSandboxRegex(value)) return { kind: "guest-regex", source: value.source, flags: value.flags, state: captureObjectState(value, encode) };
22253
+ if (isSandboxBox(value)) return { kind: "guest-boxed", value: encode(boxedValue(value)), state: captureObjectState(value, encode) };
22254
+ if (isSandboxDate(value)) return { kind: "guest-date", value: encode(dateTime(value)), state: captureObjectState(value, encode) };
22255
+ }
22039
22256
  const helper = iteratorHelperStates.get(value);
22040
22257
  if (helper !== void 0) {
22041
22258
  if (helper.status === "executing") throw new TypeError("Cannot snapshot an executing iterator helper.");
@@ -22101,8 +22318,18 @@ function captureGuestHeapNode(value, encode) {
22101
22318
  state: captureObjectState(value, encode)
22102
22319
  };
22103
22320
  }
22104
- if (isSandboxMap(value)) return { kind: "map", entries: [...value.entries].map(([key, entry]) => [encode(key), encode(entry)]), ...serializeCollectionProperties(value, encode) };
22105
- if (isSandboxSet(value)) return { kind: "set", values: [...value.values].map(encode), ...serializeCollectionProperties(value, encode) };
22321
+ if (isSandboxMap(value)) return {
22322
+ kind: "map",
22323
+ entries: [...value.entries].map(([key, entry]) => [encode(key), encode(entry)]),
22324
+ ...serializeCollectionProperties(value, encode),
22325
+ ...privateElements.has(value) ? { privateElements: capturePrivateElements(privateElements.get(value), encode) } : {}
22326
+ };
22327
+ if (isSandboxSet(value)) return {
22328
+ kind: "set",
22329
+ values: [...value.values].map(encode),
22330
+ ...serializeCollectionProperties(value, encode),
22331
+ ...privateElements.has(value) ? { privateElements: capturePrivateElements(privateElements.get(value), encode) } : {}
22332
+ };
22106
22333
  if (isSandboxArrayIterator(value)) {
22107
22334
  const cursor = arrayIteratorState(value);
22108
22335
  return {
@@ -22122,7 +22349,12 @@ function captureGuestHeapNode(value, encode) {
22122
22349
  astNodeId: classOrigin.node.nodeId,
22123
22350
  scope: encode(classOrigin.scope),
22124
22351
  ...isSandboxClosure(value) && value.name !== void 0 ? { name: value.name } : {},
22125
- fields: classOrigin.fields.map((field) => ({ index: classOrigin.node.body.body.indexOf(field.element), key: encode(field.key) })),
22352
+ fields: classOrigin.fields.map((field) => ({
22353
+ index: classOrigin.node.body.body.indexOf(field.element),
22354
+ key: encode(field.key),
22355
+ ...field.privateName === void 0 ? {} : { privateName: encode(field.privateName) }
22356
+ })),
22357
+ ...classOrigin.privateMethods.size === 0 ? {} : { privateMethods: capturePrivateElements(classOrigin.privateMethods, encode) },
22126
22358
  state: captureObjectState(value, encode)
22127
22359
  };
22128
22360
  }
@@ -22135,6 +22367,7 @@ function captureGuestHeapNode(value, encode) {
22135
22367
  functionBoundary: frame.functionBoundary,
22136
22368
  chargeData: frame.chargeData,
22137
22369
  bindings: frame.bindings,
22370
+ ...frame.privateNames === void 0 ? {} : { privateNames: frame.privateNames.map(([name, identity]) => [name, encode(identity)]) },
22138
22371
  cells: frame.cells.map((cell) => cell.initialized ? { ...cell, value: encode(cell.value) } : cell),
22139
22372
  ...frame.restoredBindings === void 0 ? {} : {
22140
22373
  restoredBindings: frame.restoredBindings.map(([name, entry]) => [name, encode(entry)])
@@ -22182,6 +22415,7 @@ function captureGuestHeapNode(value, encode) {
22182
22415
  kind: "object-pattern",
22183
22416
  phase: expression.phase,
22184
22417
  index: expression.index,
22418
+ ...expression.privateName === void 0 ? {} : { privateName: expression.privateName },
22185
22419
  excludedKeys: expression.excludedKeys.map(encode),
22186
22420
  key: encode(expression.key),
22187
22421
  current: encode(expression.current),
@@ -22192,6 +22426,7 @@ function captureGuestHeapNode(value, encode) {
22192
22426
  index: expression.index,
22193
22427
  done: expression.done,
22194
22428
  current: encode(expression.current),
22429
+ ...expression.privateName === void 0 ? {} : { privateName: expression.privateName },
22195
22430
  iterator: mapIteratorSnapshot("kind" in expression.iterator ? expression.iterator : expression.iterator.snapshot?.() ?? { kind: "unsupported" }, encode),
22196
22431
  ...Object.hasOwn(expression, "referenceObject") ? { referenceObject: encode(expression.referenceObject), referenceKey: encode(expression.referenceKey) } : {}
22197
22432
  } : expression.kind === "for-of-array" ? { ...expression, values: encode(expression.values), current: encode(expression.current), scope: encode(expression.scope) } : expression.kind === "for-of-iterator" ? {
@@ -22205,6 +22440,7 @@ function captureGuestHeapNode(value, encode) {
22205
22440
  object: encode(expression.object),
22206
22441
  property: encode(expression.property),
22207
22442
  current: encode(expression.current),
22443
+ ...expression.privateName === void 0 ? {} : { privateName: expression.privateName },
22208
22444
  ...Object.hasOwn(expression, "key") ? { key: encode(expression.key) } : {},
22209
22445
  ...Object.hasOwn(expression, "superReceiver") ? { superReceiver: encode(expression.superReceiver) } : {}
22210
22446
  } : expression.kind === "member" ? {
@@ -22273,6 +22509,8 @@ function captureGuestHeapNode(value, encode) {
22273
22509
  }
22274
22510
  function captureObjectState(value, encode) {
22275
22511
  let properties = value;
22512
+ if (isSandboxRegex(value)) properties = getRegexProperties(value);
22513
+ if (isSandboxPromise(value)) properties = getPromiseProperties(value);
22276
22514
  if (isSandboxGenerator(value)) properties = getGeneratorProperties(value);
22277
22515
  if (isSandboxClosure(value)) {
22278
22516
  properties = value.properties;
@@ -22281,9 +22519,13 @@ function captureObjectState(value, encode) {
22281
22519
  if (properties === void 0) return void 0;
22282
22520
  return {
22283
22521
  properties: serializePropertyDescriptors(properties, encode),
22522
+ ...privateElements.has(value) ? { privateElements: capturePrivateElements(privateElements.get(value), encode) } : {},
22284
22523
  ...hasExplicitSandboxPrototype(value) ? { prototype: encode(getSandboxPrototype(value)) } : {}
22285
22524
  };
22286
22525
  }
22526
+ function capturePrivateElements(elements, encode) {
22527
+ return [...elements].map(([name, element]) => element.kind === "accessor" ? { name: encode(name), kind: "accessor", get: encode(element.get), set: encode(element.set) } : { name: encode(name), kind: element.kind, value: encode(element.value) });
22528
+ }
22287
22529
 
22288
22530
  // packages/safe-js/src/snapshot/arguments.ts
22289
22531
  function serializeArguments(value, serializeValue) {
@@ -22353,6 +22595,7 @@ function captureTypedArrayState(value, encode) {
22353
22595
  if (!Object.isExtensible(value)) Object.preventExtensions(metadata);
22354
22596
  return {
22355
22597
  properties: serializePropertyDescriptors(metadata, encode),
22598
+ ...privateElements.has(value) ? { privateElements: capturePrivateElements(privateElements.get(value), encode) } : {},
22356
22599
  ...hasExplicitSandboxPrototype(value) ? { prototype: encode(getSandboxPrototype(value)) } : {}
22357
22600
  };
22358
22601
  }
@@ -22422,6 +22665,7 @@ function encodeDataViewLayout(value) {
22422
22665
  function captureDataViewState(value, encode) {
22423
22666
  return {
22424
22667
  properties: serializePropertyDescriptors(value, encode),
22668
+ ...privateElements.has(value) ? { privateElements: capturePrivateElements(privateElements.get(value), encode) } : {},
22425
22669
  ...hasExplicitSandboxPrototype(value) ? { prototype: encode(getSandboxPrototype(value)) } : {}
22426
22670
  };
22427
22671
  }
@@ -22446,6 +22690,7 @@ function decodeDataViewStorage(value, resolve, budget) {
22446
22690
  function captureArrayBufferState(value, encode) {
22447
22691
  return {
22448
22692
  properties: serializePropertyDescriptors(value, encode),
22693
+ ...privateElements.has(value) ? { privateElements: capturePrivateElements(privateElements.get(value), encode) } : {},
22449
22694
  ...hasExplicitSandboxPrototype(value) ? { prototype: encode(getSandboxPrototype(value)) } : {}
22450
22695
  };
22451
22696
  }
@@ -27446,7 +27691,7 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27446
27691
  createRawJson(node.text);
27447
27692
  return true;
27448
27693
  }
27449
- if (!["intrinsic", "bound-function", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "array-iterator", "string-iterator", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
27694
+ if (!["intrinsic", "bound-function", "guest-function", "guest-class", "guest-generator", "scope-frame", "guest-object", "guest-array", "guest-boxed", "guest-date", "guest-regex", "guest-promise", "array-iterator", "string-iterator", "iterator-wrapper", "iterator-helper", "guest-collection-iterator", "guest-regexp-iterator", "map", "set"].includes(String(node.kind))) return false;
27450
27695
  const reference = (value, kinds) => {
27451
27696
  const ref = record3(value);
27452
27697
  fields(ref, ["kind", "id"]);
@@ -27461,9 +27706,35 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27461
27706
  if (target.kind === "intrinsic" && intrinsicCatalogue().get(String(target.id)) !== true)
27462
27707
  throw new TypeError("Guest accessor reference is not callable.");
27463
27708
  };
27709
+ const privateIdentity = (value, expected) => {
27710
+ const identity = reference(value, ["object"]);
27711
+ fields(identity, ["kind", "entries"]);
27712
+ const entries = record3(identity.entries);
27713
+ fields(entries, ["description"]);
27714
+ if (typeof entries.description !== "string" || entries.description.length === 0 || expected !== void 0 && entries.description !== expected) throw new TypeError("Invalid private-name identity.");
27715
+ };
27716
+ const privateState = (value, methodsOnly = false) => {
27717
+ const names = /* @__PURE__ */ new Set();
27718
+ for (const raw2 of array(value)) {
27719
+ const element = record3(raw2);
27720
+ fields(element, element.kind === "accessor" ? ["name", "kind", "get", "set"] : ["name", "kind", "value"]);
27721
+ privateIdentity(element.name);
27722
+ const id = integer(record3(element.name).id);
27723
+ if (names.has(id)) throw new TypeError("Duplicate private element.");
27724
+ names.add(id);
27725
+ if (element.kind === "accessor") {
27726
+ callable(element.get);
27727
+ callable(element.set);
27728
+ } else if (element.kind === "method") {
27729
+ if (absent(element.value)) throw new TypeError("Missing private method.");
27730
+ callable(element.value);
27731
+ } else if (element.kind !== "field" || methodsOnly) throw new TypeError("Invalid private element kind.");
27732
+ }
27733
+ };
27464
27734
  const state = (value) => {
27465
27735
  const object = record3(value);
27466
- fields(object, ["properties"], ["prototype"]);
27736
+ fields(object, ["properties"], ["prototype", "privateElements"]);
27737
+ if (object.privateElements !== void 0) privateState(object.privateElements);
27467
27738
  if (Object.hasOwn(object, "prototype") && object.prototype !== null) reference(object.prototype);
27468
27739
  const properties = record3(object.properties);
27469
27740
  fields(properties, ["properties", "extensible"]);
@@ -27493,14 +27764,35 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27493
27764
  }
27494
27765
  };
27495
27766
  if (node.kind === "map" || node.kind === "set") {
27496
- fields(node, ["kind", node.kind === "map" ? "entries" : "values"], ["propertyState", "prototype"]);
27767
+ fields(node, ["kind", node.kind === "map" ? "entries" : "values"], ["propertyState", "prototype", "privateElements"]);
27768
+ if (node.privateElements !== void 0) privateState(node.privateElements);
27497
27769
  state({
27498
27770
  properties: Object.hasOwn(node, "propertyState") ? node.propertyState : { properties: [], extensible: true },
27499
27771
  ...Object.hasOwn(node, "prototype") ? { prototype: node.prototype } : {}
27500
27772
  });
27501
27773
  return false;
27502
27774
  }
27503
- if (node.kind === "iterator-helper") {
27775
+ if (node.kind === "guest-promise") {
27776
+ fields(node, ["kind", "status", "value", "state"]);
27777
+ if (node.status !== "fulfilled" && node.status !== "rejected") throw new TypeError("Invalid guest promise settlement.");
27778
+ if (node.status === "fulfilled" && node.value !== null && typeof node.value === "object" && record3(node.value).kind === "ref" && reference(node.value) === node)
27779
+ throw new TypeError("A promise cannot fulfill with itself.");
27780
+ state(node.state);
27781
+ } else if (node.kind === "guest-regex") {
27782
+ fields(node, ["kind", "source", "flags", "state"]);
27783
+ if (typeof node.source !== "string" || typeof node.flags !== "string") throw new TypeError("Invalid guest RegExp payload.");
27784
+ state(node.state);
27785
+ } else if (node.kind === "guest-boxed" || node.kind === "guest-date") {
27786
+ fields(node, ["kind", "value", "state"]);
27787
+ if (node.kind === "guest-date") {
27788
+ if (typeof node.value !== "number" && record3(node.value).kind !== "number") throw new TypeError("Invalid guest date time.");
27789
+ } else if (!["number", "string", "boolean"].includes(typeof node.value)) {
27790
+ const payload = record3(node.value);
27791
+ if (payload.kind === "ref") reference(node.value, ["symbol"]);
27792
+ else if (payload.kind !== "number" && payload.kind !== "bigint") throw new TypeError("Invalid guest boxed payload.");
27793
+ }
27794
+ state(node.state);
27795
+ } else if (node.kind === "iterator-helper") {
27504
27796
  fields(node, ["kind", "method", "status", "callback", "remaining", "index", "state"], ["outer", "inner"]);
27505
27797
  if (!["map", "filter", "take", "drop", "flatMap"].includes(String(node.method)) || !["start", "yield", "done"].includes(String(node.status))) throw new TypeError("Invalid iterator helper mode.");
27506
27798
  integer(node.index);
@@ -27592,14 +27884,19 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27592
27884
  }
27593
27885
  }
27594
27886
  } else if (node.kind === "guest-class") {
27595
- fields(node, ["kind", "astNodeId", "scope", "state", "fields"], ["name"]);
27887
+ fields(node, ["kind", "astNodeId", "scope", "state", "fields"], ["name", "privateMethods"]);
27888
+ if (node.privateMethods !== void 0) privateState(node.privateMethods, true);
27596
27889
  if (integer(node.astNodeId) < 1) throw new TypeError("Invalid class AST identity.");
27597
27890
  reference(node.scope, ["scope-frame"]);
27598
27891
  if (Object.hasOwn(node, "name") && typeof node.name !== "string") throw new TypeError("Invalid class name.");
27599
27892
  let previous = -1;
27600
27893
  for (const item of array(node.fields)) {
27601
27894
  const field = record3(item);
27602
- fields(field, ["index", "key"]);
27895
+ fields(field, ["index", "key"], ["privateName"]);
27896
+ if (field.privateName !== void 0) {
27897
+ if (typeof field.key !== "string" || !field.key.startsWith("#")) throw new TypeError("Invalid private field key.");
27898
+ privateIdentity(field.privateName, field.key.slice(1));
27899
+ }
27603
27900
  const index = integer(field.index);
27604
27901
  if (index <= previous) throw new TypeError("Invalid class field order.");
27605
27902
  previous = index;
@@ -27666,7 +27963,8 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27666
27963
  } else if (expression.kind === "pattern-source") {
27667
27964
  fields(expression, ["kind", "value"]);
27668
27965
  } else if (expression.kind === "object-pattern") {
27669
- fields(expression, ["kind", "phase", "index", "excludedKeys", "key", "current"], ["referenceObject", "referenceKey"]);
27966
+ fields(expression, ["kind", "phase", "index", "excludedKeys", "key", "current"], ["referenceObject", "referenceKey", "privateName"]);
27967
+ if (expression.privateName !== void 0 && (typeof expression.privateName !== "string" || !Object.hasOwn(expression, "referenceObject"))) throw new TypeError("Invalid private pattern reference.");
27670
27968
  integer(expression.index);
27671
27969
  if (!["key", "reference", "binding"].includes(String(expression.phase)) || Object.hasOwn(expression, "referenceObject") !== Object.hasOwn(expression, "referenceKey")) throw new TypeError("Invalid object pattern state.");
27672
27970
  for (const key of array(expression.excludedKeys)) if (typeof key !== "string") reference(key, ["symbol"]);
@@ -27678,7 +27976,8 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27678
27976
  fields(expression, ["kind", "async", "value", "current", "iterator"]);
27679
27977
  if (typeof expression.async !== "boolean") throw new TypeError("Invalid delegated yield protocol.");
27680
27978
  } else if (expression.kind === "array-pattern") {
27681
- fields(expression, ["kind", "phase", "index", "done", "current", "iterator"], ["referenceObject", "referenceKey"]);
27979
+ fields(expression, ["kind", "phase", "index", "done", "current", "iterator"], ["referenceObject", "referenceKey", "privateName"]);
27980
+ if (expression.privateName !== void 0 && (typeof expression.privateName !== "string" || !Object.hasOwn(expression, "referenceObject"))) throw new TypeError("Invalid private pattern reference.");
27682
27981
  if (!["reference", "binding"].includes(String(expression.phase)) || typeof expression.done !== "boolean" || Object.hasOwn(expression, "referenceObject") !== Object.hasOwn(expression, "referenceKey")) throw new TypeError("Invalid array pattern state.");
27683
27982
  if (Object.hasOwn(expression, "referenceKey") && typeof expression.referenceKey !== "string") reference(expression.referenceKey, ["symbol"]);
27684
27983
  } else {
@@ -27751,7 +28050,8 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27751
28050
  } else if (expression.kind === "identifier-assignment") {
27752
28051
  fields(expression, ["kind", "current"]);
27753
28052
  } else if (expression.kind === "member-assignment") {
27754
- fields(expression, ["kind", "object", "property", "current"], ["key", "superReceiver"]);
28053
+ fields(expression, ["kind", "object", "property", "current"], ["key", "superReceiver", "privateName"]);
28054
+ if (expression.privateName !== void 0 && (typeof expression.privateName !== "string" || Object.hasOwn(expression, "key") || Object.hasOwn(expression, "superReceiver"))) throw new TypeError("Invalid private assignment reference.");
27755
28055
  if (Object.hasOwn(expression, "key") && typeof expression.key !== "string") reference(expression.key, ["symbol"]);
27756
28056
  } else if (expression.kind === "member") {
27757
28057
  fields(expression, ["kind", "object"], ["superReceiver"]);
@@ -27806,7 +28106,16 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
27806
28106
  if (Object.hasOwn(environment, "newTarget")) callable(environment.newTarget);
27807
28107
  }
27808
28108
  } else {
27809
- fields(node, ["kind", "parent", "importMeta", "functionBoundary", "chargeData", "bindings", "cells"], ["restoredBindings"]);
28109
+ fields(node, ["kind", "parent", "importMeta", "functionBoundary", "chargeData", "bindings", "cells"], ["restoredBindings", "privateNames"]);
28110
+ if (node.privateNames !== void 0) {
28111
+ const names2 = /* @__PURE__ */ new Set();
28112
+ for (const raw2 of array(node.privateNames)) {
28113
+ const entry = array(raw2);
28114
+ if (entry.length !== 2 || typeof entry[0] !== "string" || names2.has(entry[0])) throw new TypeError("Invalid private-name scope.");
28115
+ names2.add(entry[0]);
28116
+ privateIdentity(entry[1], entry[0]);
28117
+ }
28118
+ }
27810
28119
  if (!absent(node.parent)) reference(node.parent, ["scope-frame"]);
27811
28120
  if (typeof node.functionBoundary !== "boolean" || typeof node.chargeData !== "boolean") throw new TypeError("Invalid guest frame flags.");
27812
28121
  const cells = array(node.cells);
@@ -27855,6 +28164,15 @@ function validateGuestScopeParents(heap) {
27855
28164
  }
27856
28165
 
27857
28166
  // packages/safe-js/src/snapshot/guest-ast-validation.ts
28167
+ function privateAssignmentName(value) {
28168
+ if (value === null || typeof value !== "object") return void 0;
28169
+ let node = value;
28170
+ while (node.type === "AssignmentPattern" || node.type === "RestElement")
28171
+ node = node.type === "AssignmentPattern" ? node.left : node.argument;
28172
+ if (node.type !== "MemberExpression") return void 0;
28173
+ const property = node.property;
28174
+ return property.type === "PrivateIdentifier" ? String(property.name) : void 0;
28175
+ }
27858
28176
  function validateGuestFunctionAst(record4, origin) {
27859
28177
  if (record4.kind === "guest-class") {
27860
28178
  if (origin === null || typeof origin !== "object" || !["ClassDeclaration", "ClassExpression"].includes(String(origin.type)))
@@ -27866,8 +28184,9 @@ function validateGuestFunctionAst(record4, origin) {
27866
28184
  expected.forEach(({ element, index }, position) => {
27867
28185
  const field = fields2[position];
27868
28186
  if (field.index !== index) throw new TypeError("Invalid class field AST identity.");
28187
+ if (element.key.type === "PrivateIdentifier" !== (field.privateName !== void 0)) throw new TypeError("Invalid private field identity.");
27869
28188
  if (!element.computed) {
27870
- const key = element.key.type === "Identifier" ? element.key.name : String(element.key.value);
28189
+ const key = element.key.type === "PrivateIdentifier" ? `#${element.key.name}` : element.key.type === "Identifier" ? element.key.name : String(element.key.value);
27871
28190
  if (field.key !== key) throw new TypeError("Invalid class field key.");
27872
28191
  }
27873
28192
  });
@@ -27944,7 +28263,12 @@ function validateGuestFunctionAst(record4, origin) {
27944
28263
  value: property[part],
27945
28264
  blocks,
27946
28265
  finalizers: frame.finalizers,
27947
- expressions: new Map([...frame.expressions, [id, { kind: "object-pattern", index, key: part === "key" }]])
28266
+ expressions: new Map([...frame.expressions, [id, {
28267
+ kind: "object-pattern",
28268
+ index,
28269
+ key: part === "key",
28270
+ privateName: part === "key" ? void 0 : privateAssignmentName(property[part])
28271
+ }]])
27948
28272
  });
27949
28273
  }
27950
28274
  });
@@ -27980,6 +28304,7 @@ function validateGuestFunctionAst(record4, origin) {
27980
28304
  expressions: new Map([...frame.expressions, [node.nodeId, {
27981
28305
  kind,
27982
28306
  index,
28307
+ ...kind === "array-pattern" ? { privateName: privateAssignmentName(element) } : {},
27983
28308
  member: kind === "call" && node.callee?.type === "MemberExpression"
27984
28309
  }]])
27985
28310
  }));
@@ -27990,7 +28315,8 @@ function validateGuestFunctionAst(record4, origin) {
27990
28315
  blocks,
27991
28316
  expressions: (node.type === "VariableDeclarator" && key === "id" && node.init !== void 0 || (node.type === "AssignmentExpression" || node.type === "AssignmentPattern") && key === "left") && typeof node.nodeId === "number" && ["ArrayPattern", "ObjectPattern"].includes(String(value?.type)) ? new Map([...frame.expressions, [node.nodeId, { kind: "pattern-source" }]]) : node.type === "ForOfStatement" && ["left", "body"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for-of", phase: key, async: node.await === true }]]) : node.type === "ForInStatement" && ["left", "body"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for-in", phase: key }]]) : node.type === "ForStatement" && ["init", "test", "body", "update"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for", phase: key }]]) : node.type === "BinaryExpression" && key === "right" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "binary" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "Identifier" ? new Map([...frame.expressions, [node.nodeId, { kind: "identifier-assignment" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "MemberExpression" ? new Map([...frame.expressions, [node.nodeId, {
27992
28317
  kind: "member-assignment",
27993
- key: node.operator !== "=",
28318
+ key: node.operator !== "=" && node.left.property.type !== "PrivateIdentifier",
28319
+ privateName: node.left.property.type === "PrivateIdentifier" ? String(node.left.property.name) : void 0,
27994
28320
  superReceiver: node.left.object.type === "Super"
27995
28321
  }]]) : node.type === "MemberExpression" && node.computed === true && key === "property" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "member", superReceiver: node.object.type === "Super" }]]) : frame.expressions,
27996
28322
  finalizers: node.type === "TryStatement" && key === "finalizer" && typeof node.nodeId === "number" ? /* @__PURE__ */ new Set([...frame.finalizers, node.nodeId]) : frame.finalizers
@@ -28018,7 +28344,7 @@ function validateGuestFunctionAst(record4, origin) {
28018
28344
  for (const [id, expression] of expressions) {
28019
28345
  const expected = yieldExpressions?.get(Number(id));
28020
28346
  const compatibleKind = expected?.kind === expression.kind || expected?.kind === "for-of" && (expression.kind === "for-of-iterator" || !expected.async && expression.kind === "for-of-array") || expected?.kind === "call" && expected.member === true && expression.kind === "array-call";
28021
- if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "yield-delegate" && expected.kind !== "pattern-source" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.kind !== "for" && expected.kind !== "for-in" && expected.kind !== "for-of" && expected.index !== expression.index || expected.kind === "yield-delegate" && expected.async !== expression.async || expected.kind === "switch" && (expected.phase !== expression.phase || expected.statementIndex !== expression.statementIndex) || (expected.kind === "for" || expected.kind === "for-of") && expected.phase !== expression.phase || expected.kind === "for-in" && expected.phase !== (expression.phase ?? "body") || expected.kind === "object-pattern" && expected.key !== (expression.phase === "key") || expected.kind === "for-of" && expression.kind === "for-of-iterator" && expected.async !== expression.async || expected.kind === "member-assignment" && (expected.key !== Object.hasOwn(expression, "key") || expected.superReceiver !== Object.hasOwn(expression, "superReceiver")) || expected.kind === "member" && expected.superReceiver !== Object.hasOwn(expression, "superReceiver") || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
28347
+ if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "yield-delegate" && expected.kind !== "pattern-source" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.kind !== "for" && expected.kind !== "for-in" && expected.kind !== "for-of" && expected.index !== expression.index || expected.kind === "yield-delegate" && expected.async !== expression.async || expected.kind === "switch" && (expected.phase !== expression.phase || expected.statementIndex !== expression.statementIndex) || (expected.kind === "for" || expected.kind === "for-of") && expected.phase !== expression.phase || expected.kind === "for-in" && expected.phase !== (expression.phase ?? "body") || expected.kind === "object-pattern" && expected.key !== (expression.phase === "key") || (expected.kind === "object-pattern" || expected.kind === "array-pattern") && (expression.phase === "binding" ? expected.privateName : void 0) !== expression.privateName || expected.kind === "for-of" && expression.kind === "for-of-iterator" && expected.async !== expression.async || expected.kind === "member-assignment" && (expected.key !== Object.hasOwn(expression, "key") || expected.privateName !== expression.privateName || expected.superReceiver !== Object.hasOwn(expression, "superReceiver")) || expected.kind === "member" && expected.superReceiver !== Object.hasOwn(expression, "superReceiver") || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
28022
28348
  throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
28023
28349
  }
28024
28350
  }
@@ -29236,6 +29562,15 @@ function createSandboxPromise(promise, metadata = {}) {
29236
29562
  value: metadata.hostCallJournal
29237
29563
  });
29238
29564
  }
29565
+ promiseStates.set(sandboxPromise, { status: "pending" });
29566
+ original.then(
29567
+ (value) => {
29568
+ promiseStates.set(sandboxPromise, { status: "fulfilled", value });
29569
+ },
29570
+ (value) => {
29571
+ promiseStates.set(sandboxPromise, { status: "rejected", value });
29572
+ }
29573
+ );
29239
29574
  trackSandboxPromise(sandboxPromise);
29240
29575
  registerPromiseCancellation(sandboxPromise);
29241
29576
  return Object.freeze(sandboxPromise);
@@ -29471,6 +29806,16 @@ function measureSandboxData(values, options = {}) {
29471
29806
  assertSandboxDataDepth(depth);
29472
29807
  seen.add(value);
29473
29808
  usage += 1;
29809
+ const privateSlots = privateElements.get(value);
29810
+ if (privateSlots !== void 0) {
29811
+ for (const [name, element] of privateSlots) {
29812
+ visit(name, depth + 1);
29813
+ if (element.kind === "accessor") {
29814
+ visit(element.get, depth + 1);
29815
+ visit(element.set, depth + 1);
29816
+ } else visit(element.value, depth + 1);
29817
+ }
29818
+ }
29474
29819
  if (!isGuestHostObject(value)) {
29475
29820
  const symbols = Object.getOwnPropertySymbols(value);
29476
29821
  const descriptors2 = symbols.length === 0 ? [] : symbols.filter((key) => !internalSymbols.has(key)).map((key) => [key, Object.getOwnPropertyDescriptor(value, key)]);
@@ -29627,6 +29972,8 @@ function measureSandboxData(values, options = {}) {
29627
29972
  return;
29628
29973
  }
29629
29974
  if (isSandboxPromise(value)) {
29975
+ const settlement = promiseStates.get(value);
29976
+ if (settlement !== void 0 && settlement.status !== "pending") visit(settlement.value, depth + 1);
29630
29977
  for (const key of Reflect.ownKeys(getPromiseProperties(value))) {
29631
29978
  const descriptor = Object.getOwnPropertyDescriptor(getPromiseProperties(value), key);
29632
29979
  usage += typeof key === "string" ? key.length + 1 : 1;
@@ -35640,6 +35987,8 @@ function variableDeclarationContainsAwait(node) {
35640
35987
  }
35641
35988
  function expressionContainsAwait(node) {
35642
35989
  switch (node.type) {
35990
+ case "PrivateIdentifier":
35991
+ return false;
35643
35992
  case "ClassExpression":
35644
35993
  return classDefinitionContains(node, expressionContainsAwait);
35645
35994
  case "NewTargetExpression":
@@ -39325,6 +39674,8 @@ function variableDeclarationContainsAwait2(node) {
39325
39674
  }
39326
39675
  function expressionContainsAwait2(node) {
39327
39676
  switch (node.type) {
39677
+ case "PrivateIdentifier":
39678
+ return false;
39328
39679
  case "ClassExpression":
39329
39680
  return classDefinitionContains(node, expressionContainsAwait2);
39330
39681
  case "NewTargetExpression":
@@ -44607,11 +44958,11 @@ export {
44607
44958
  safeEndSpan,
44608
44959
  runResources,
44609
44960
  defineExtension,
44961
+ assertSnapshotInactive,
44610
44962
  encodeReplayData,
44611
44963
  HostOperationResumePolicyError,
44612
44964
  registerPendingHostCallPolicy,
44613
44965
  HostCallResumabilityError,
44614
- assertSnapshotInactive,
44615
44966
  isSandboxClosure,
44616
44967
  deepCopyToSandbox,
44617
44968
  deepCopyFromSandbox,
@@ -44638,4 +44989,4 @@ export {
44638
44989
  FileSnapshotBackend,
44639
44990
  run
44640
44991
  };
44641
- //# sourceMappingURL=chunk-MT4D4J5E.js.map
44992
+ //# sourceMappingURL=chunk-UDQ7HBDC.js.map