unpeek 2.0.0 → 3.0.0

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.
Files changed (103) hide show
  1. package/README.md +30 -8
  2. package/README.tr.md +30 -8
  3. package/dist/adapters/esbuild.cjs +13 -0
  4. package/dist/{esbuild.d.cts → adapters/esbuild.d.cts} +2 -2
  5. package/dist/{esbuild.d.ts → adapters/esbuild.d.ts} +2 -2
  6. package/dist/adapters/esbuild.js +11 -0
  7. package/dist/adapters/next/adapter.cjs +42 -0
  8. package/dist/{next → adapters/next}/adapter.d.cts +4 -4
  9. package/dist/{next → adapters/next}/adapter.d.ts +4 -4
  10. package/dist/adapters/next/adapter.js +42 -0
  11. package/dist/adapters/next/index.cjs +15 -0
  12. package/dist/adapters/next/index.d.cts +53 -0
  13. package/dist/adapters/next/index.d.ts +53 -0
  14. package/dist/adapters/next/index.js +15 -0
  15. package/dist/adapters/rollup.cjs +13 -0
  16. package/dist/{rollup.d.cts → adapters/rollup.d.cts} +2 -2
  17. package/dist/{rollup.d.ts → adapters/rollup.d.ts} +2 -2
  18. package/dist/adapters/rollup.js +11 -0
  19. package/dist/adapters/rspack.cjs +12 -0
  20. package/dist/adapters/rspack.d.cts +13 -0
  21. package/dist/adapters/rspack.d.ts +11 -0
  22. package/dist/adapters/rspack.js +12 -0
  23. package/dist/adapters/vite.cjs +13 -0
  24. package/dist/{vite.d.cts → adapters/vite.d.cts} +2 -2
  25. package/dist/{vite.d.ts → adapters/vite.d.ts} +2 -2
  26. package/dist/adapters/vite.js +11 -0
  27. package/dist/adapters/webpack.cjs +13 -0
  28. package/dist/{webpack.d.cts → adapters/webpack.d.cts} +2 -2
  29. package/dist/{webpack.d.ts → adapters/webpack.d.ts} +2 -2
  30. package/dist/adapters/webpack.js +11 -0
  31. package/dist/browser.cjs +8 -5
  32. package/dist/browser.d.cts +41 -3
  33. package/dist/browser.d.ts +41 -3
  34. package/dist/browser.js +10 -7
  35. package/dist/{chunk-GAVI2C44.cjs → chunk-6TDCSIRZ.cjs} +76 -47
  36. package/dist/{chunk-5LCMI2TL.js → chunk-APWMNVAZ.js} +221 -32
  37. package/dist/{chunk-5QD6FZPB.js → chunk-BPRSCRUZ.js} +71 -42
  38. package/dist/{chunk-X5MKMFMX.js → chunk-DUK2SECY.js} +7 -7
  39. package/dist/chunk-FCF2EGPM.js +80 -0
  40. package/dist/{chunk-7YVEHJVM.cjs → chunk-I6GXEHFR.cjs} +241 -52
  41. package/dist/{chunk-LXP73HJC.cjs → chunk-IAD5DV3D.cjs} +1048 -213
  42. package/dist/chunk-IEBVL5BT.cjs +80 -0
  43. package/dist/{chunk-GZB7PFLY.js → chunk-IICVBTR2.js} +25 -62
  44. package/dist/{chunk-UMPUYLLZ.js → chunk-IZIWDJRF.js} +936 -101
  45. package/dist/chunk-L6BOM5VS.cjs +40 -0
  46. package/dist/{chunk-OOXSZTRV.js → chunk-LA6J3BT3.js} +26 -1
  47. package/dist/{chunk-24K5NDXH.cjs → chunk-ONM2CSTU.cjs} +45 -82
  48. package/dist/{chunk-5M6Z7ZFT.cjs → chunk-RXUY3MPH.cjs} +10 -10
  49. package/dist/cli/index.js +7309 -32
  50. package/dist/{types-BBSRUEab.d.cts → config-CfXY_iDD.d.cts} +44 -86
  51. package/dist/{types-BBSRUEab.d.ts → config-CfXY_iDD.d.ts} +44 -86
  52. package/dist/config.cjs +4 -16
  53. package/dist/config.d.cts +1 -12
  54. package/dist/config.d.ts +1 -12
  55. package/dist/config.js +5 -17
  56. package/dist/index-CjRTNPlj.d.cts +46 -0
  57. package/dist/index-Cm1IloVm.d.ts +46 -0
  58. package/dist/index.cjs +636 -9
  59. package/dist/index.d.cts +9 -17
  60. package/dist/index.d.ts +9 -17
  61. package/dist/index.js +638 -11
  62. package/dist/plugins/unplugin.cjs +20 -0
  63. package/dist/plugins/unplugin.d.cts +17 -0
  64. package/dist/plugins/unplugin.d.ts +15 -0
  65. package/dist/{bundler → plugins}/unplugin.js +5 -5
  66. package/dist/types-DYQIzGf6.d.cts +112 -0
  67. package/dist/types-ZHAFdOd3.d.ts +112 -0
  68. package/package.json +48 -52
  69. package/dist/ast/index.cjs +0 -17
  70. package/dist/ast/index.d.cts +0 -18
  71. package/dist/ast/index.d.ts +0 -18
  72. package/dist/ast/index.js +0 -17
  73. package/dist/bundler/unplugin.cjs +0 -20
  74. package/dist/bundler/unplugin.d.cts +0 -16
  75. package/dist/bundler/unplugin.d.ts +0 -14
  76. package/dist/chunk-27HR647Q.js +0 -190
  77. package/dist/chunk-4TDLLEEU.cjs +0 -15
  78. package/dist/chunk-6N6S6WTQ.cjs +0 -423
  79. package/dist/chunk-J5CGNZDM.cjs +0 -190
  80. package/dist/chunk-KQWNFKT2.js +0 -423
  81. package/dist/chunk-R6EBIR3T.cjs +0 -14
  82. package/dist/chunk-S4S2WXGC.js +0 -14
  83. package/dist/cli/index.cjs +0 -324
  84. package/dist/cli/index.d.cts +0 -22
  85. package/dist/cli/index.d.ts +0 -22
  86. package/dist/esbuild.cjs +0 -15
  87. package/dist/esbuild.js +0 -13
  88. package/dist/next/adapter.cjs +0 -31
  89. package/dist/next/adapter.js +0 -31
  90. package/dist/next/index.cjs +0 -18
  91. package/dist/next/index.d.cts +0 -42
  92. package/dist/next/index.d.ts +0 -42
  93. package/dist/next/index.js +0 -18
  94. package/dist/rollup.cjs +0 -15
  95. package/dist/rollup.js +0 -13
  96. package/dist/runtime/index.cjs +0 -17
  97. package/dist/runtime/index.d.cts +0 -36
  98. package/dist/runtime/index.d.ts +0 -36
  99. package/dist/runtime/index.js +0 -17
  100. package/dist/vite.cjs +0 -15
  101. package/dist/vite.js +0 -13
  102. package/dist/webpack.cjs +0 -15
  103. package/dist/webpack.js +0 -13
@@ -1,18 +1,20 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
+ var _chunkL6BOM5VScjs = require('./chunk-L6BOM5VS.cjs');
3
4
 
4
-
5
-
6
-
7
-
8
- var _chunk6N6S6WTQcjs = require('./chunk-6N6S6WTQ.cjs');
9
-
10
-
11
- var _chunkR6EBIR3Tcjs = require('./chunk-R6EBIR3T.cjs');
5
+ // src/shared/hash.ts
6
+ function computeFnv1aHash(input, seed = 2166136261) {
7
+ let hash = seed >>> 0;
8
+ for (let i = 0; i < input.length; i++) {
9
+ hash ^= input.charCodeAt(i);
10
+ hash = Math.imul(hash, 16777619) >>> 0;
11
+ }
12
+ return hash >>> 0;
13
+ }
12
14
 
13
15
  // src/ast/hot-path-detector.ts
14
16
  var _acorn = require('acorn'); var acorn = _interopRequireWildcard(_acorn); var acorn4 = _interopRequireWildcard(_acorn); var acorn3 = _interopRequireWildcard(_acorn); var acorn2 = _interopRequireWildcard(_acorn); var acorn5 = _interopRequireWildcard(_acorn);
15
- var _acornwalk = require('acorn-walk'); var walk = _interopRequireWildcard(_acornwalk); var walk3 = _interopRequireWildcard(_acornwalk); var walk2 = _interopRequireWildcard(_acornwalk); var walk4 = _interopRequireWildcard(_acornwalk); var walk5 = _interopRequireWildcard(_acornwalk); var walk6 = _interopRequireWildcard(_acornwalk);
17
+ var _acornwalk = require('acorn-walk'); var walk = _interopRequireWildcard(_acornwalk); var walk4 = _interopRequireWildcard(_acornwalk); var walk3 = _interopRequireWildcard(_acornwalk); var walk2 = _interopRequireWildcard(_acornwalk); var walk5 = _interopRequireWildcard(_acornwalk); var walk6 = _interopRequireWildcard(_acornwalk); var walk7 = _interopRequireWildcard(_acornwalk); var walk8 = _interopRequireWildcard(_acornwalk);
16
18
  var ARRAY_HOF_METHODS = /* @__PURE__ */ new Set([
17
19
  "map",
18
20
  "filter",
@@ -72,19 +74,22 @@ var FUNCTION_NODE_TYPES = /* @__PURE__ */ new Set([
72
74
  "FunctionExpression",
73
75
  "ArrowFunctionExpression"
74
76
  ]);
75
- function parseJavaScriptAst(code) {
77
+ function parseJavaScriptAst(code, comments) {
76
78
  try {
77
79
  return acorn.parse(code, {
78
80
  ecmaVersion: "latest",
79
81
  sourceType: "module",
80
- allowReturnOutsideFunction: true
82
+ allowReturnOutsideFunction: true,
83
+ ...comments ? { onComment: comments } : {}
81
84
  });
82
85
  } catch (e) {
86
+ if (comments) comments.length = 0;
83
87
  try {
84
88
  return acorn.parse(code, {
85
89
  ecmaVersion: "latest",
86
90
  sourceType: "script",
87
- allowReturnOutsideFunction: true
91
+ allowReturnOutsideFunction: true,
92
+ ...comments ? { onComment: comments } : {}
88
93
  });
89
94
  } catch (e2) {
90
95
  return null;
@@ -300,8 +305,10 @@ function analyzeAstHotPaths(ast, config) {
300
305
  arrayHofMethods.add(m);
301
306
  }
302
307
  }
303
- const eventHandlerRegex = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _51 => _51.hotPath, 'optionalAccess', _52 => _52.eventHandlerRegex]), () => ( DEFAULT_EVENT_HANDLER_REGEX));
304
- const hookRegex = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _53 => _53.hotPath, 'optionalAccess', _54 => _54.hookPattern]), () => ( DEFAULT_HOOK_REGEX));
308
+ const rawEventRegex = _optionalChain([config, 'optionalAccess', _51 => _51.hotPath, 'optionalAccess', _52 => _52.eventHandlerRegex]);
309
+ const eventHandlerRegex = typeof rawEventRegex === "string" ? new RegExp(rawEventRegex) : _nullishCoalesce(rawEventRegex, () => ( DEFAULT_EVENT_HANDLER_REGEX));
310
+ const rawHookRegex = _optionalChain([config, 'optionalAccess', _53 => _53.hotPath, 'optionalAccess', _54 => _54.hookPattern]);
311
+ const hookRegex = typeof rawHookRegex === "string" ? new RegExp(rawHookRegex) : _nullishCoalesce(rawHookRegex, () => ( DEFAULT_HOOK_REGEX));
305
312
  const customHooksSet = new Set(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _55 => _55.hotPath, 'optionalAccess', _56 => _56.customHooks]), () => ( [])));
306
313
  function isHookName(name) {
307
314
  if (!name) return false;
@@ -865,6 +872,423 @@ function detectHotPaths(code, config) {
865
872
  return analyzeAstHotPaths(ast, config).report;
866
873
  }
867
874
 
875
+ // src/runtime/integrity-guard.ts
876
+ var FNV_OFFSET_BASIS = 2166136261;
877
+ function computeIntegrityHash(source, seed = 0) {
878
+ return computeFnv1aHash(source, (FNV_OFFSET_BASIS ^ seed >>> 0) >>> 0);
879
+ }
880
+ function verifyCodeIntegrity(fnOrSource, expectedHash, seed = 0) {
881
+ const raw = typeof fnOrSource === "function" ? Function.prototype.toString.call(fnOrSource) : String(fnOrSource);
882
+ return computeIntegrityHash(raw, seed) === expectedHash >>> 0;
883
+ }
884
+
885
+ // src/ast/codegen.ts
886
+ var _astring = require('astring');
887
+ function derivePolymorphicIdent(seed, role) {
888
+ let h = (2166136261 ^ seed >>> 0) >>> 0;
889
+ for (let i = 0; i < role.length; i++) {
890
+ h ^= role.charCodeAt(i);
891
+ h = Math.imul(h, 16777619) >>> 0;
892
+ }
893
+ const rolePrefixes = {
894
+ vault: "_a",
895
+ shield: "$b",
896
+ decoy: "_d",
897
+ shader: "_s",
898
+ vm: "_m",
899
+ wasm: "_w",
900
+ salted: "_k",
901
+ windowKey: "_z"
902
+ };
903
+ const prefix = _nullishCoalesce(rolePrefixes[role], () => ( `_${String.fromCharCode(97 + h % 26)}`));
904
+ const suffix = ((h >>> 4) % 1296).toString(36).padStart(2, "0");
905
+ return `${prefix}${suffix}`;
906
+ }
907
+ var OPERATOR_PRECEDENCE = {
908
+ "||": 2,
909
+ "??": 3,
910
+ "&&": 4,
911
+ "|": 5,
912
+ "^": 6,
913
+ "&": 7,
914
+ "==": 8,
915
+ "!=": 8,
916
+ "===": 8,
917
+ "!==": 8,
918
+ "<": 9,
919
+ ">": 9,
920
+ "<=": 9,
921
+ ">=": 9,
922
+ "in": 9,
923
+ "instanceof": 9,
924
+ "<<": 10,
925
+ ">>": 10,
926
+ ">>>": 10,
927
+ "+": 11,
928
+ "-": 11,
929
+ "*": 12,
930
+ "%": 12,
931
+ "/": 12,
932
+ "**": 13
933
+ };
934
+ var NEEDS_PARENTHESES = 17;
935
+ function expressionNeedsParenthesis(state, node, parentNode, isRightHand) {
936
+ const nodePrecedence = state.expressionsPrecedence[node.type];
937
+ if (nodePrecedence === NEEDS_PARENTHESES) {
938
+ return true;
939
+ }
940
+ const parentNodePrecedence = state.expressionsPrecedence[parentNode.type];
941
+ if (nodePrecedence !== parentNodePrecedence) {
942
+ return !isRightHand && nodePrecedence === 15 && parentNodePrecedence === 14 && parentNode.operator === "**" || nodePrecedence < parentNodePrecedence;
943
+ }
944
+ if (nodePrecedence !== 13 && nodePrecedence !== 14) {
945
+ return false;
946
+ }
947
+ if (node.operator === "**" && parentNode.operator === "**") {
948
+ return !isRightHand;
949
+ }
950
+ if (nodePrecedence === 13 && parentNodePrecedence === 13 && (node.operator === "??" || parentNode.operator === "??")) {
951
+ return true;
952
+ }
953
+ if (isRightHand) {
954
+ return OPERATOR_PRECEDENCE[node.operator] <= OPERATOR_PRECEDENCE[parentNode.operator];
955
+ }
956
+ return OPERATOR_PRECEDENCE[node.operator] < OPERATOR_PRECEDENCE[parentNode.operator];
957
+ }
958
+ function formatExpression(state, node, parentNode, isRightHand) {
959
+ const generator = state.generator;
960
+ if (expressionNeedsParenthesis(state, node, parentNode, isRightHand)) {
961
+ state.write("(");
962
+ generator[node.type](node, state);
963
+ state.write(")");
964
+ } else {
965
+ generator[node.type](node, state);
966
+ }
967
+ }
968
+ function formatSequence(state, expressions) {
969
+ const length = expressions.length;
970
+ if (length > 0) {
971
+ state.write("(");
972
+ state.generator[expressions[0].type](expressions[0], state);
973
+ for (let i = 1; i < length; i++) {
974
+ state.write(",");
975
+ state.generator[expressions[i].type](expressions[i], state);
976
+ }
977
+ state.write(")");
978
+ } else {
979
+ state.write("()");
980
+ }
981
+ }
982
+ function expressionStartsWith(node, char) {
983
+ if (!node) return false;
984
+ if (node.type === "UnaryExpression" && node.prefix) {
985
+ return node.operator === char;
986
+ }
987
+ if (node.type === "UpdateExpression" && node.prefix) {
988
+ return node.operator[0] === char;
989
+ }
990
+ return false;
991
+ }
992
+ function expressionEndsWith(node, char) {
993
+ if (!node) return false;
994
+ if (node.type === "UpdateExpression" && !node.prefix) {
995
+ return node.operator[0] === char;
996
+ }
997
+ return false;
998
+ }
999
+ function isRegExp(node) {
1000
+ return node && (node.type === "Literal" && !!node.regex || node.type === "RegExpLiteral");
1001
+ }
1002
+ var compactGenerator = Object.assign({}, _astring.baseGenerator, {
1003
+ BinaryExpression(node, state) {
1004
+ const isIn = node.operator === "in";
1005
+ if (isIn) {
1006
+ state.write("(");
1007
+ }
1008
+ formatExpression(state, node.left, node, false);
1009
+ const op = node.operator;
1010
+ let spaceBefore = false;
1011
+ let spaceAfter = false;
1012
+ if (op === "in" || op === "instanceof") {
1013
+ spaceBefore = true;
1014
+ spaceAfter = true;
1015
+ } else {
1016
+ if ((op === "+" || op === "-") && expressionEndsWith(node.left, op) && !expressionNeedsParenthesis(state, node.left, node, false)) {
1017
+ spaceBefore = true;
1018
+ }
1019
+ if ((op === "+" || op === "-") && expressionStartsWith(node.right, op) && !expressionNeedsParenthesis(state, node.right, node, true) || op === "/" && isRegExp(node.right)) {
1020
+ spaceAfter = true;
1021
+ }
1022
+ }
1023
+ if (spaceBefore) state.write(" ");
1024
+ state.write(op);
1025
+ if (spaceAfter) state.write(" ");
1026
+ formatExpression(state, node.right, node, true);
1027
+ if (isIn) {
1028
+ state.write(")");
1029
+ }
1030
+ },
1031
+ LogicalExpression(node, state) {
1032
+ formatExpression(state, node.left, node, false);
1033
+ state.write(node.operator);
1034
+ formatExpression(state, node.right, node, true);
1035
+ },
1036
+ AssignmentExpression(node, state) {
1037
+ this[node.left.type](node.left, state);
1038
+ const op = node.operator;
1039
+ if (op.endsWith("+") && expressionStartsWith(node.right, "+") || op.endsWith("-") && expressionStartsWith(node.right, "-") || op.endsWith("/") && isRegExp(node.right)) {
1040
+ state.write(op + " ");
1041
+ } else {
1042
+ state.write(op);
1043
+ }
1044
+ this[node.right.type](node.right, state);
1045
+ },
1046
+ ConditionalExpression(node, state) {
1047
+ const test = node.test;
1048
+ const precedence = state.expressionsPrecedence[test.type];
1049
+ if (precedence === NEEDS_PARENTHESES || precedence <= state.expressionsPrecedence.ConditionalExpression) {
1050
+ state.write("(");
1051
+ this[test.type](test, state);
1052
+ state.write(")");
1053
+ } else {
1054
+ this[test.type](test, state);
1055
+ }
1056
+ state.write("?");
1057
+ this[node.consequent.type](node.consequent, state);
1058
+ state.write(":");
1059
+ this[node.alternate.type](node.alternate, state);
1060
+ },
1061
+ ArrayExpression(node, state) {
1062
+ state.write("[");
1063
+ const elements = node.elements;
1064
+ const length = elements.length;
1065
+ for (let i = 0; i < length; i++) {
1066
+ const element = elements[i];
1067
+ if (element != null) {
1068
+ this[element.type](element, state);
1069
+ }
1070
+ if (i + 1 < length) {
1071
+ state.write(",");
1072
+ }
1073
+ }
1074
+ state.write("]");
1075
+ },
1076
+ ObjectExpression(node, state) {
1077
+ state.write("{");
1078
+ const properties = node.properties;
1079
+ const length = properties.length;
1080
+ for (let i = 0; i < length; i++) {
1081
+ const property = properties[i];
1082
+ this[property.type](property, state);
1083
+ if (i + 1 < length) {
1084
+ state.write(",");
1085
+ }
1086
+ }
1087
+ state.write("}");
1088
+ },
1089
+ Property(node, state) {
1090
+ if (node.method || node.kind[0] !== "i") {
1091
+ this.MethodDefinition(node, state);
1092
+ } else {
1093
+ if (!node.shorthand) {
1094
+ if (node.computed) {
1095
+ state.write("[");
1096
+ this[node.key.type](node.key, state);
1097
+ state.write("]");
1098
+ } else {
1099
+ this[node.key.type](node.key, state);
1100
+ }
1101
+ state.write(":");
1102
+ }
1103
+ this[node.value.type](node.value, state);
1104
+ }
1105
+ },
1106
+ CallExpression(node, state) {
1107
+ formatExpression(state, node.callee, node, false);
1108
+ if (node.optional) {
1109
+ state.write("?.");
1110
+ }
1111
+ formatSequence(state, node.arguments);
1112
+ },
1113
+ SequenceExpression(node, state) {
1114
+ formatSequence(state, node.expressions);
1115
+ },
1116
+ FunctionDeclaration(node, state) {
1117
+ state.write(
1118
+ (node.async ? "async " : "") + (node.generator ? "function* " : "function ") + (node.id ? node.id.name : ""),
1119
+ node
1120
+ );
1121
+ formatSequence(state, node.params);
1122
+ this[node.body.type](node.body, state);
1123
+ },
1124
+ FunctionExpression(node, state) {
1125
+ compactGenerator.FunctionDeclaration.call(this, node, state);
1126
+ },
1127
+ ArrowFunctionExpression(node, state) {
1128
+ state.write(node.async ? "async " : "", node);
1129
+ const params = node.params;
1130
+ if (params != null) {
1131
+ if (params.length === 0) {
1132
+ state.write("()");
1133
+ } else if (params.length === 1 && params[0].type === "Identifier") {
1134
+ state.write(params[0].name, params[0]);
1135
+ } else {
1136
+ formatSequence(state, node.params);
1137
+ }
1138
+ } else {
1139
+ state.write("()");
1140
+ }
1141
+ state.write("=>");
1142
+ if (node.body.type[0] === "O") {
1143
+ state.write("(");
1144
+ this.ObjectExpression(node.body, state);
1145
+ state.write(")");
1146
+ } else {
1147
+ this[node.body.type](node.body, state);
1148
+ }
1149
+ },
1150
+ ForStatement(node, state) {
1151
+ state.write("for(");
1152
+ if (node.init != null) {
1153
+ const init = node.init;
1154
+ if (init.type[0] === "V") {
1155
+ this.VariableDeclaration(init, state);
1156
+ } else {
1157
+ this[init.type](init, state);
1158
+ state.write(";");
1159
+ }
1160
+ } else {
1161
+ state.write(";");
1162
+ }
1163
+ if (node.test) {
1164
+ this[node.test.type](node.test, state);
1165
+ }
1166
+ state.write(";");
1167
+ if (node.update) {
1168
+ this[node.update.type](node.update, state);
1169
+ }
1170
+ state.write(")");
1171
+ this[node.body.type](node.body, state);
1172
+ },
1173
+ IfStatement(node, state) {
1174
+ state.write("if(");
1175
+ this[node.test.type](node.test, state);
1176
+ state.write(")");
1177
+ this[node.consequent.type](node.consequent, state);
1178
+ if (node.alternate != null) {
1179
+ if (node.consequent.type === "BlockStatement") {
1180
+ state.write("else");
1181
+ } else {
1182
+ state.write(" else");
1183
+ }
1184
+ if (node.alternate.type === "BlockStatement") {
1185
+ this[node.alternate.type](node.alternate, state);
1186
+ } else if (node.alternate.type === "IfStatement") {
1187
+ state.write(" ");
1188
+ this[node.alternate.type](node.alternate, state);
1189
+ } else {
1190
+ state.write(" ");
1191
+ this[node.alternate.type](node.alternate, state);
1192
+ }
1193
+ }
1194
+ },
1195
+ VariableDeclaration(node, state) {
1196
+ state.write(node.kind + " ");
1197
+ const declarations = node.declarations;
1198
+ const length = declarations.length;
1199
+ for (let i = 0; i < length; i++) {
1200
+ this.VariableDeclarator(declarations[i], state);
1201
+ if (i + 1 < length) {
1202
+ state.write(",");
1203
+ }
1204
+ }
1205
+ state.write(";");
1206
+ },
1207
+ VariableDeclarator(node, state) {
1208
+ this[node.id.type](node.id, state);
1209
+ if (node.init != null) {
1210
+ state.write("=");
1211
+ this[node.init.type](node.init, state);
1212
+ }
1213
+ },
1214
+ ReturnStatement(node, state) {
1215
+ state.write("return");
1216
+ if (node.argument) {
1217
+ state.write(" ");
1218
+ this[node.argument.type](node.argument, state);
1219
+ }
1220
+ state.write(";");
1221
+ },
1222
+ ImportExpression(node, state) {
1223
+ state.write("import(");
1224
+ if (Array.isArray(_optionalChain([node, 'access', _155 => _155.source, 'optionalAccess', _156 => _156.comments])) && node.source.comments.length > 0) {
1225
+ for (const c of node.source.comments) {
1226
+ state.write(c.type === "Block" ? `/*${c.value}*/` : `//${c.value}
1227
+ `);
1228
+ }
1229
+ }
1230
+ this[node.source.type](node.source, state);
1231
+ if (node.options != null) {
1232
+ state.write(",");
1233
+ this[node.options.type](node.options, state);
1234
+ }
1235
+ state.write(")");
1236
+ }
1237
+ });
1238
+ function generateCompactJs(ast) {
1239
+ return _astring.generate.call(void 0, ast, {
1240
+ generator: compactGenerator,
1241
+ indent: "",
1242
+ lineEnd: ""
1243
+ });
1244
+ }
1245
+
1246
+ // src/runtime/devtools-deterrent.ts
1247
+ function deriveIntegrityFnName(seed) {
1248
+ return derivePolymorphicIdent(seed, "shield");
1249
+ }
1250
+ function deriveWindowKeySymbol(seed) {
1251
+ return derivePolymorphicIdent(seed, "windowKey");
1252
+ }
1253
+ function createDeterrentSnippet(config) {
1254
+ const seed = config.seed >>> 0;
1255
+ const deterrentMode = _nullishCoalesce(config.deterrentMode, () => ( "passive"));
1256
+ const detectHeadless = _nullishCoalesce(config.detectHeadless, () => ( false));
1257
+ const fnName = deriveIntegrityFnName(seed);
1258
+ const sym = _nullishCoalesce(config.windowKeySymbol, () => ( deriveWindowKeySymbol(seed)));
1259
+ const consoleSilence = deterrentMode === "gradual" ? "for(var k in console)console[k]=function(){return 0;};" : "";
1260
+ const symLit = JSON.stringify(sym);
1261
+ const headlessDecl = detectHeadless ? ",n=w.navigator||0" : "";
1262
+ const headlessCond = detectHeadless ? "||n.webdriver||/HeadlessChrome/.test(n.userAgent)" : "";
1263
+ return `(function ${fnName}(w){var G=typeof globalThis!=='undefined'?globalThis:w;if(w){var O=Object,P=O.getOwnPropertyDescriptor,GP=O.getPrototypeOf,T=function(o,k){try{while(o){var r=P&&P(o,k);if(r&&(r.set||!r.writable))return 1;o=GP?GP(o):0;}}catch(e){return 1;}},S=function(o,k,v){try{o[k]=v;}catch(e){}},s=Function.prototype.toString${headlessDecl},src='',t=0;try{src=s.call(${fnName});if('prototype' in s||s.name!=='toString'||s.length!==0||s.call(s).indexOf('[native code]')<0||/\\n/.test(src)${headlessCond})t=1;}catch(e){t=1;}try{s.call(0);t=1;}catch(e){}if(T(w,${symLit})||T(G,${symLit})||T(G,'__unpeek_tampered')||T(w,'__unpeek_tampered')||T(String.prototype,'_u'))t=1;for(var h=0x811c9dc5,i=0;i<src.length;i++)h=Math.imul(h^src.charCodeAt(i),0x01000193)>>>0;var d=h&0xffff;if(t){var pd=(d^(((h>>>16)^0x5a5b)||1))&0xffff;if(!T(G,${symLit}))S(G,${symLit},pd);if(!T(w,${symLit}))S(w,${symLit},pd);S(G,'__unpeek_delta',pd);S(w,'__unpeek_delta',pd);try{String.prototype._u=14;}catch(e){}var ns=((w.__unpeek_seed||${seed})^1)>>>0;S(G,'__unpeek_seed',ns);S(w,'__unpeek_seed',ns);S(G,'__unpeek_tampered',!0);S(w,'__unpeek_tampered',!0);try{${consoleSilence}if(w.dispatchEvent)w.dispatchEvent(new CustomEvent('unpeek:tamper'));}catch(e){}}else{S(G,${symLit},d);S(w,${symLit},d);}}})(typeof window!=='undefined'?window:(typeof self!=='undefined'?self:0));`;
1264
+ }
1265
+
1266
+ // src/runtime/index.ts
1267
+ function generateRuntimeShield(config) {
1268
+ const seed = config.seed >>> 0;
1269
+ const windowKeySymbol = _nullishCoalesce(config.windowKeySymbol, () => ( deriveWindowKeySymbol(seed)));
1270
+ const integrityCheckFnName = deriveIntegrityFnName(seed);
1271
+ const preambleCode = createDeterrentSnippet({
1272
+ ...config,
1273
+ windowKeySymbol
1274
+ });
1275
+ const fnStart = preambleCode.indexOf("function");
1276
+ const endMarker = preambleCode.lastIndexOf("})(");
1277
+ const fnEnd = endMarker !== -1 ? endMarker + 1 : preambleCode.lastIndexOf("(") - 1;
1278
+ const fnDecl = preambleCode.slice(fnStart, fnEnd);
1279
+ const computedHash = computeIntegrityHash(fnDecl, 0);
1280
+ const expectedHash = config.expectedIntegrityHash !== void 0 ? config.expectedIntegrityHash >>> 0 : computedHash;
1281
+ const expectedDelta = config.expectedDelta !== void 0 ? config.expectedDelta & 65535 : computedHash >>> 0 & 65535;
1282
+ const payload = {
1283
+ preambleCode,
1284
+ integrityCheckFnName,
1285
+ expectedHash,
1286
+ windowKeySymbol,
1287
+ expectedDelta
1288
+ };
1289
+ return payload;
1290
+ }
1291
+
868
1292
  // src/ast/string-vault.ts
869
1293
 
870
1294
 
@@ -913,9 +1337,9 @@ function writeI32LE(value) {
913
1337
  }
914
1338
  function deriveKdfParams(seed) {
915
1339
  const sVal = seed | 0;
916
- const c1 = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "wasm-c1", seed) ^ 2246822507 | 1;
917
- const c2 = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "wasm-c2", seed) ^ 3266489909 | 1;
918
- const k0 = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "wasm-k0", seed) | 0;
1340
+ const c1 = computeFnv1aHash("wasm-c1", seed) ^ 2246822507 | 1;
1341
+ const c2 = computeFnv1aHash("wasm-c2", seed) ^ 3266489909 | 1;
1342
+ const k0 = computeFnv1aHash("wasm-k0", seed) | 0;
919
1343
  const r1 = (seed >>> 0) % 19 + 7;
920
1344
  const r2 = (seed >>> 5) % 17 + 5;
921
1345
  return { sVal, c1, c2, k0, r1, r2 };
@@ -923,12 +1347,12 @@ function deriveKdfParams(seed) {
923
1347
  function generateWasmKdfBinary(seed) {
924
1348
  const { sVal, c1, c2, k0, r1, r2 } = deriveKdfParams(seed);
925
1349
  const memBase = (seed >>> 0 & 127) * 4;
926
- const r0 = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "wasm-r0", seed) | 0;
1350
+ const r0 = computeFnv1aHash("wasm-r0", seed) | 0;
927
1351
  const rotAmt = (seed >>> 0) % 27 + 3;
928
- const kMul = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "wasm-kmul", seed) | 1;
1352
+ const kMul = computeFnv1aHash("wasm-kmul", seed) | 1;
929
1353
  const kA = kMul >>> 16 & 65535;
930
1354
  const kB = kMul & 65535;
931
- const memMask = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "wasm-mem", seed) & 1023 | 1;
1355
+ const memMask = computeFnv1aHash("wasm-mem", seed) & 1023 | 1;
932
1356
  const memA = memBase ^ memMask;
933
1357
  const w0 = r0;
934
1358
  const w1 = sVal ^ rotl32(r0, rotAmt) ^ Math.imul(r0 | 1, kMul) | 0;
@@ -1308,8 +1732,8 @@ function fallbackKdf(fnId, callSiteSalt, shieldHash, seed) {
1308
1732
  function isWasmVaultAlreadyInjected(ast) {
1309
1733
  if (!ast || !Array.isArray(ast.body)) return false;
1310
1734
  return ast.body.some((stmt) => {
1311
- if (stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _155 => _155.declarations, 'optionalAccess', _156 => _156.some, 'call', _157 => _157(
1312
- (d) => _optionalChain([d, 'access', _158 => _158.id, 'optionalAccess', _159 => _159.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_wKdf")
1735
+ if (stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _157 => _157.declarations, 'optionalAccess', _158 => _158.some, 'call', _159 => _159(
1736
+ (d) => _optionalChain([d, 'access', _160 => _160.id, 'optionalAccess', _161 => _161.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_wKdf")
1313
1737
  )])) {
1314
1738
  return true;
1315
1739
  }
@@ -1317,16 +1741,16 @@ function isWasmVaultAlreadyInjected(ast) {
1317
1741
  });
1318
1742
  }
1319
1743
  function injectWasmVault(ast, seed = 2654435769) {
1320
- const suffix = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, `wasm:${seed}`, seed).toString(36);
1744
+ const suffix = computeFnv1aHash(`wasm:${seed}`, seed).toString(36);
1321
1745
  const kdfFnName = `_wKdf${suffix}`;
1322
1746
  const wasmVarName = `_wb${suffix}`;
1323
1747
  if (isWasmVaultAlreadyInjected(ast)) {
1324
1748
  const existing = ast.body.find(
1325
- (stmt) => stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _160 => _160.declarations, 'optionalAccess', _161 => _161.some, 'call', _162 => _162(
1326
- (d) => _optionalChain([d, 'access', _163 => _163.id, 'optionalAccess', _164 => _164.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_wKdf")
1749
+ (stmt) => stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _162 => _162.declarations, 'optionalAccess', _163 => _163.some, 'call', _164 => _164(
1750
+ (d) => _optionalChain([d, 'access', _165 => _165.id, 'optionalAccess', _166 => _166.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_wKdf")
1327
1751
  )])
1328
1752
  );
1329
- const id = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _165 => _165.declarations, 'access', _166 => _166[0], 'optionalAccess', _167 => _167.id, 'optionalAccess', _168 => _168.name]), () => ( kdfFnName));
1753
+ const id = _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _167 => _167.declarations, 'access', _168 => _168[0], 'optionalAccess', _169 => _169.id, 'optionalAccess', _170 => _170.name]), () => ( kdfFnName));
1330
1754
  return {
1331
1755
  kdfFnName: id,
1332
1756
  wasmBytes: generateWasmKdfBinary(seed),
@@ -1341,8 +1765,8 @@ function injectWasmVault(ast, seed = 2654435769) {
1341
1765
  const bArr = [];
1342
1766
  const mArr = [];
1343
1767
  for (let i = 0; i < targets.length; i++) {
1344
- const aVal = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, `mba-a:${i}`, seed) | 0;
1345
- const mVal = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, `mba-m:${i}`, seed) | 0;
1768
+ const aVal = computeFnv1aHash(`mba-a:${i}`, seed) | 0;
1769
+ const mVal = computeFnv1aHash(`mba-m:${i}`, seed) | 0;
1346
1770
  const bVal = (targets[i] ^ mVal) - aVal | 0;
1347
1771
  aArr.push(aVal);
1348
1772
  bArr.push(bVal);
@@ -1396,7 +1820,7 @@ try {
1396
1820
  let insertIdx = 0;
1397
1821
  while (insertIdx < ast.body.length) {
1398
1822
  const stmt = ast.body[insertIdx];
1399
- const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _169 => _169.expression, 'optionalAccess', _170 => _170.type]) === "Literal" && typeof stmt.expression.value === "string" && /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim()));
1823
+ const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _171 => _171.expression, 'optionalAccess', _172 => _172.type]) === "Literal" && typeof stmt.expression.value === "string" && /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim()));
1400
1824
  if (isDirective || stmt.type === "ImportDeclaration") {
1401
1825
  insertIdx++;
1402
1826
  } else {
@@ -1411,6 +1835,137 @@ try {
1411
1835
  };
1412
1836
  }
1413
1837
 
1838
+ // src/ast/boundary-classifier.ts
1839
+
1840
+ var GLOBAL_HOSTS = /* @__PURE__ */ new Set(["self", "window", "globalThis"]);
1841
+ var MAGIC_COMMENT_RE = /webpack(?:ChunkName|Mode|Prefetch|Preload|Ignore|Include|Exclude|Exports)|@?vite-ignore|viteIgnore/i;
1842
+ function isHostMember(node, propName) {
1843
+ if (!node) return false;
1844
+ if (node.type === "Identifier" && node.name === propName) {
1845
+ return true;
1846
+ }
1847
+ if (node.type === "MemberExpression" && !node.computed && _optionalChain([node, 'access', _173 => _173.object, 'optionalAccess', _174 => _174.type]) === "Identifier" && GLOBAL_HOSTS.has(node.object.name) && _optionalChain([node, 'access', _175 => _175.property, 'optionalAccess', _176 => _176.type]) === "Identifier" && node.property.name === propName) {
1848
+ return true;
1849
+ }
1850
+ return false;
1851
+ }
1852
+ function unwrapAssignedHostMember(node, propName) {
1853
+ if (!node) return false;
1854
+ if (isHostMember(node, propName)) return true;
1855
+ if (node.type === "AssignmentExpression" && isHostMember(node.left, propName)) {
1856
+ return true;
1857
+ }
1858
+ return false;
1859
+ }
1860
+ function classifyChunkBoundary(ast) {
1861
+ const exemptSubtreeRoots = /* @__PURE__ */ new WeakSet();
1862
+ const importSourceNodes = /* @__PURE__ */ new WeakSet();
1863
+ const importExpressions = [];
1864
+ let hasEntryBootstrap = false;
1865
+ let hasRscFlight = false;
1866
+ let hasPreloadManifest = false;
1867
+ walk2.simple(ast, {
1868
+ CallExpression(node) {
1869
+ const callee = node.callee;
1870
+ if (_optionalChain([callee, 'optionalAccess', _177 => _177.type]) === "MemberExpression" && !callee.computed && _optionalChain([callee, 'access', _178 => _178.property, 'optionalAccess', _179 => _179.type]) === "Identifier" && callee.property.name === "push") {
1871
+ if (unwrapAssignedHostMember(callee.object, "__next_f")) {
1872
+ hasRscFlight = true;
1873
+ if (Array.isArray(node.arguments)) {
1874
+ for (const arg of node.arguments) {
1875
+ if (arg && typeof arg === "object") {
1876
+ exemptSubtreeRoots.add(arg);
1877
+ }
1878
+ }
1879
+ }
1880
+ } else if (unwrapAssignedHostMember(callee.object, "TURBOPACK")) {
1881
+ hasEntryBootstrap = true;
1882
+ exemptSubtreeRoots.add(node);
1883
+ if (Array.isArray(node.arguments)) {
1884
+ for (const arg of node.arguments) {
1885
+ if (arg && typeof arg === "object") {
1886
+ exemptSubtreeRoots.add(arg);
1887
+ }
1888
+ }
1889
+ }
1890
+ }
1891
+ }
1892
+ },
1893
+ AssignmentExpression(node) {
1894
+ if (isHostMember(node.left, "TURBOPACK")) {
1895
+ hasEntryBootstrap = true;
1896
+ exemptSubtreeRoots.add(node);
1897
+ } else if (_optionalChain([node, 'access', _180 => _180.left, 'optionalAccess', _181 => _181.type]) === "Identifier" && node.left.name === "__vite__mapDeps") {
1898
+ hasPreloadManifest = true;
1899
+ exemptSubtreeRoots.add(node);
1900
+ }
1901
+ },
1902
+ VariableDeclarator(node) {
1903
+ if (_optionalChain([node, 'access', _182 => _182.id, 'optionalAccess', _183 => _183.type]) === "Identifier") {
1904
+ if (node.id.name === "__vite__mapDeps") {
1905
+ hasPreloadManifest = true;
1906
+ exemptSubtreeRoots.add(node);
1907
+ } else if (node.id.name === "TURBOPACK") {
1908
+ hasEntryBootstrap = true;
1909
+ exemptSubtreeRoots.add(node);
1910
+ }
1911
+ }
1912
+ },
1913
+ FunctionDeclaration(node) {
1914
+ if (_optionalChain([node, 'access', _184 => _184.id, 'optionalAccess', _185 => _185.type]) === "Identifier" && node.id.name === "__vite__mapDeps") {
1915
+ hasPreloadManifest = true;
1916
+ exemptSubtreeRoots.add(node);
1917
+ }
1918
+ },
1919
+ ImportExpression(node) {
1920
+ importExpressions.push(node);
1921
+ if (node.source && typeof node.source === "object") {
1922
+ exemptSubtreeRoots.add(node.source);
1923
+ importSourceNodes.add(node.source);
1924
+ }
1925
+ }
1926
+ });
1927
+ let kind = "app-chunk";
1928
+ if (hasEntryBootstrap) {
1929
+ kind = "entry-bootstrap";
1930
+ } else if (hasRscFlight) {
1931
+ kind = "rsc-flight";
1932
+ } else if (hasPreloadManifest) {
1933
+ kind = "preload-manifest";
1934
+ }
1935
+ return {
1936
+ kind,
1937
+ exemptSubtreeRoots,
1938
+ importSourceNodes,
1939
+ importExpressions
1940
+ };
1941
+ }
1942
+ function isNodeInExemptSubtree(ancestors, exemptRoots) {
1943
+ if (!exemptRoots) return false;
1944
+ for (let i = ancestors.length - 1; i >= 0; i--) {
1945
+ if (exemptRoots.has(ancestors[i])) {
1946
+ return true;
1947
+ }
1948
+ }
1949
+ return false;
1950
+ }
1951
+ function attachMagicComments(importExpressions, comments) {
1952
+ if (importExpressions.length === 0 || comments.length === 0) return;
1953
+ const magicComments = comments.filter((c) => MAGIC_COMMENT_RE.test(c.value));
1954
+ if (magicComments.length === 0) return;
1955
+ for (const expr of importExpressions) {
1956
+ const src = _optionalChain([expr, 'optionalAccess', _186 => _186.source]);
1957
+ if (!src || typeof expr.start !== "number" || typeof src.start !== "number") {
1958
+ continue;
1959
+ }
1960
+ const matched = magicComments.filter(
1961
+ (c) => c.start >= expr.start && c.end <= src.start
1962
+ );
1963
+ if (matched.length > 0) {
1964
+ src.comments = matched.map((c) => ({ type: c.type, value: c.value }));
1965
+ }
1966
+ }
1967
+ }
1968
+
1414
1969
  // src/ast/salted-vault.ts
1415
1970
  function computeCallSiteSalt(seed, idx) {
1416
1971
  return ((Math.imul((seed ^ idx) >>> 0, 2654435761) ^ Math.imul(idx + 1 >>> 0, 73244475)) & 31) >>> 0;
@@ -1423,7 +1978,7 @@ function createSaltedDecryptorFnAst(seed, pChars, expectedDelta, windowKeySymbol
1423
1978
  } else if (browserOnly) {
1424
1979
  fBody = `var m=[],c=Function.prototype.toString.call(f);for(var h=0x811c9dc5,j=0;j<c.length;j++)h=Math.imul(h^c.charCodeAt(j),0x01000193)>>>0;var q,A="${safeAlpha}",P="${pChars}";return function(i,s){if(q===void 0){var w=typeof window<"u"?window:typeof self<"u"?self:0,G=typeof globalThis<"u"?globalThis:w||this,d=G&&G${propAccess}!=null?G${propAccess}:w&&w${propAccess}!=null?w${propAccess}:w?-1:0;q=(h^(""._u||a._u||0)^d)>>>0;}if(i in m)return m[i];var p=a[i],o="";if(p)for(var t=q^s^Math.imul(i+1,0x01000193),j=0;j<p.length;j++){t=Math.imul(t^j+1,0x01000193)^0x811c9dc5;var c=p[j],k=A.indexOf(c);o+=k<0?c:A[(A.indexOf(P[(k-(t&65535)%92+92)%92])-(t>>>16)%92+92)%92];}return m[i]=o;};`;
1425
1980
  } else {
1426
- const maskA = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "delta-a", seed) & 65535 | 1;
1981
+ const maskA = computeFnv1aHash("delta-a", seed) & 65535 | 1;
1427
1982
  const maskB = (expectedDelta & 65535 ^ maskA) & 65535;
1428
1983
  fBody = `var m=[],c=Function.prototype.toString.call(f);for(var h=0x811c9dc5,j=0;j<c.length;j++)h=Math.imul(h^c.charCodeAt(j),0x01000193)>>>0;var q,A="${safeAlpha}",P="${pChars}";return function(i,s){if(q===void 0){var w=typeof window<"u"?window:typeof self<"u"?self:0,G=typeof globalThis<"u"?globalThis:w||this,d=G&&G${propAccess}!=null?G${propAccess}:w&&w${propAccess}!=null?w${propAccess}:w?-1:(${maskA}^${maskB});q=(h^(""._u||a._u||0)^d)>>>0;}if(i in m)return m[i];var p=a[i],o="";if(p)for(var t=q^s^Math.imul(i+1,0x01000193),j=0;j<p.length;j++){t=Math.imul(t^j+1,0x01000193)^0x811c9dc5;var c=p[j],k=A.indexOf(c);o+=k<0?c:A[(A.indexOf(P[(k-(t&65535)%92+92)%92])-(t>>>16)%92+92)%92];}return m[i]=o;};`;
1429
1984
  }
@@ -1473,8 +2028,8 @@ function encodeSaltedString(str, k) {
1473
2028
  function isAstAlreadySalted(ast) {
1474
2029
  if (!ast || !Array.isArray(ast.body)) return false;
1475
2030
  return ast.body.some((stmt) => {
1476
- if (stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _171 => _171.declarations, 'optionalAccess', _172 => _172.some, 'call', _173 => _173(
1477
- (d) => _optionalChain([d, 'access', _174 => _174.id, 'optionalAccess', _175 => _175.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_uP")
2031
+ if (stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _187 => _187.declarations, 'optionalAccess', _188 => _188.some, 'call', _189 => _189(
2032
+ (d) => _optionalChain([d, 'access', _190 => _190.id, 'optionalAccess', _191 => _191.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_uP")
1478
2033
  )])) {
1479
2034
  return true;
1480
2035
  }
@@ -1499,32 +2054,35 @@ function replaceNodeInParent(parent, oldNode, newNode) {
1499
2054
  }
1500
2055
  return false;
1501
2056
  }
1502
- function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, config, windowKeySymbol, expectedDelta, deterrentMode, shieldCoupled = true, detectHeadless = false) {
2057
+ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, config, windowKeySymbol, expectedDelta, deterrentMode, shieldCoupled = true, detectHeadless = false, exemptSubtreeRoots) {
1503
2058
  if (isAstAlreadySalted(ast)) {
1504
2059
  return {
1505
2060
  encryptedStringsCount: 0,
1506
- integrityToken: _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "already-salted", seed),
2061
+ integrityToken: computeFnv1aHash("already-salted", seed),
1507
2062
  vaultVarName: "",
1508
2063
  decryptFnName: ""
1509
2064
  };
1510
2065
  }
1511
- const minLen = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _176 => _176.vault, 'optionalAccess', _177 => _177.minStringLength]), () => ( minStringLength));
2066
+ const minLen = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _192 => _192.vault, 'optionalAccess', _193 => _193.minStringLength]), () => ( minStringLength));
1512
2067
  const activeDirectives = new Set(DIRECTIVE_STRINGS);
1513
- if (_optionalChain([config, 'optionalAccess', _178 => _178.vault, 'optionalAccess', _179 => _179.customDirectives])) {
2068
+ if (_optionalChain([config, 'optionalAccess', _194 => _194.vault, 'optionalAccess', _195 => _195.customDirectives])) {
1514
2069
  for (const dir of config.vault.customDirectives) {
1515
2070
  activeDirectives.add(dir);
1516
2071
  }
1517
2072
  }
1518
- const customReserved = _optionalChain([config, 'optionalAccess', _180 => _180.vault, 'optionalAccess', _181 => _181.reservedProps]) ? new Set(config.vault.reservedProps) : void 0;
2073
+ const customReserved = _optionalChain([config, 'optionalAccess', _196 => _196.vault, 'optionalAccess', _197 => _197.reservedProps]) ? new Set(config.vault.reservedProps) : void 0;
1519
2074
  const targetsToReplace = [];
1520
2075
  const encryptedPayloads = [];
1521
- walk2.ancestor(ast, {
2076
+ walk3.ancestor(ast, {
1522
2077
  Literal(node, ancestors) {
1523
2078
  if (typeof node.value !== "string") return;
1524
2079
  if (node.value.length < minLen) return;
1525
2080
  if (activeDirectives.has(node.value)) return;
1526
2081
  const parent = ancestors[ancestors.length - 2];
1527
2082
  if (!parent) return;
2083
+ if (isNodeInExemptSubtree(ancestors, exemptSubtreeRoots)) {
2084
+ return;
2085
+ }
1528
2086
  if (parent.type === "ExpressionStatement" && (Boolean(parent.directive) || activeDirectives.has(node.value))) {
1529
2087
  return;
1530
2088
  }
@@ -1553,7 +2111,7 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
1553
2111
  if (isTailwindNoise(node.value)) return;
1554
2112
  if (isSvgPathString(node.value, parent)) return;
1555
2113
  const callSiteIdx = targetsToReplace.length;
1556
- const localSalt = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, `salt:${seed}:${callSiteIdx}`, seed) & 2147483647 | 1;
2114
+ const localSalt = computeFnv1aHash(`salt:${seed}:${callSiteIdx}`, seed) & 2147483647 | 1;
1557
2115
  targetsToReplace.push({
1558
2116
  node,
1559
2117
  parent,
@@ -1566,23 +2124,23 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
1566
2124
  if (targetsToReplace.length === 0) {
1567
2125
  return {
1568
2126
  encryptedStringsCount: 0,
1569
- integrityToken: _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "empty-salted", seed),
2127
+ integrityToken: computeFnv1aHash("empty-salted", seed),
1570
2128
  vaultVarName: "",
1571
2129
  decryptFnName: ""
1572
2130
  };
1573
2131
  }
1574
2132
  const wasmResult = injectWasmVault(ast, seed);
1575
2133
  const kdfFnName = wasmResult.kdfFnName;
1576
- const suffix = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, `salted:${seed}`, seed).toString(36);
2134
+ const suffix = computeFnv1aHash(`salted:${seed}`, seed).toString(36);
1577
2135
  const vaultVarName = `_uP${suffix}`;
1578
2136
  const cacheVarName = `_uCache${suffix}`;
1579
2137
  const dCacheVarName = `_uDc${suffix}`;
1580
2138
  const decryptFnName = `_uD${suffix}`;
1581
- const sym = _nullishCoalesce(windowKeySymbol, () => ( _chunk6N6S6WTQcjs.deriveWindowKeySymbol.call(void 0, seed)));
1582
- const browserOnly = _optionalChain([config, 'optionalAccess', _182 => _182.target]) === "browser";
2139
+ const sym = _nullishCoalesce(windowKeySymbol, () => ( deriveWindowKeySymbol(seed)));
2140
+ const browserOnly = _optionalChain([config, 'optionalAccess', _198 => _198.target]) === "browser";
1583
2141
  let expDelta = expectedDelta;
1584
2142
  if (shieldCoupled && expDelta === void 0) {
1585
- const shield = _chunk6N6S6WTQcjs.generateRuntimeShield.call(void 0, {
2143
+ const shield = generateRuntimeShield({
1586
2144
  seed,
1587
2145
  windowKeySymbol: sym,
1588
2146
  deterrentMode: _nullishCoalesce(deterrentMode, () => ( "passive")),
@@ -1595,7 +2153,7 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
1595
2153
  if (!shieldCoupled) {
1596
2154
  shieldDeltaExpr = `var dv=(G&&G.__unpeek_delta!=null?G.__unpeek_delta:0)|0;${dCacheVarName}=((h|0)^dv)|0;`;
1597
2155
  } else {
1598
- const fallbackExpr = browserOnly ? "0" : `(${_chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "salted-a", seed) & 65535 | 1}^${((_nullishCoalesce(expDelta, () => ( 0))) & 65535 ^ (_chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "salted-a", seed) & 65535 | 1)) & 65535})`;
2156
+ const fallbackExpr = browserOnly ? "0" : `(${computeFnv1aHash("salted-a", seed) & 65535 | 1}^${((_nullishCoalesce(expDelta, () => ( 0))) & 65535 ^ (computeFnv1aHash("salted-a", seed) & 65535 | 1)) & 65535})`;
1599
2157
  shieldDeltaExpr = `var w=typeof window<"u"?window:typeof self<"u"?self:0;var sv=G&&G${propAccess}!=null?G${propAccess}:w&&w${propAccess}!=null?w${propAccess}:w?-1:${fallbackExpr};var dv=(G&&G.__unpeek_delta!=null?G.__unpeek_delta:w&&w.__unpeek_delta!=null?w.__unpeek_delta:0)|0;${dCacheVarName}=((h|0)^(sv|0)^dv)|0;`;
1600
2158
  }
1601
2159
  const helperFnSnippet = `function ${decryptFnName}(i,s){if(${cacheVarName}[i]!==void 0)return ${cacheVarName}[i];if(${dCacheVarName}===void 0){var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:this;var c=Function.prototype.toString.call(${decryptFnName}),h=0x811c9dc5;for(var l=0;l<c.length;l++)h=Math.imul(h^c.charCodeAt(l),0x01000193)>>>0;${shieldDeltaExpr}}var k=${kdfFnName}(i,s,${dCacheVarName});var p=${vaultVarName}[i],o="",rk=k|0;for(var j=0;j<p.length;j++){rk=(Math.imul(rk^(j+1),0x45d9f3b)+0x9e3779b9)|0;o+=String.fromCharCode(p.charCodeAt(j)^(((rk>>>16)&127)|1));}return (${cacheVarName}[i]=o);}`;
@@ -1604,7 +2162,7 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
1604
2162
  sourceType: "script"
1605
2163
  });
1606
2164
  const fnDeclAst = parsedFn.body[0];
1607
- const selfHash = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, _chunk6N6S6WTQcjs.generateCompactJs.call(void 0, fnDeclAst)) | 0;
2165
+ const selfHash = computeFnv1aHash(generateCompactJs(fnDeclAst)) | 0;
1608
2166
  const buildD = shieldCoupled ? selfHash ^ (_nullishCoalesce(expDelta, () => ( 0))) & 65535 | 0 : selfHash | 0;
1609
2167
  for (const target of targetsToReplace) {
1610
2168
  const k = fallbackKdf(target.callSiteIdx, target.localSalt, buildD, seed);
@@ -1632,7 +2190,7 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
1632
2190
  replaceNodeInParent(target.parent, target.node, callExpr);
1633
2191
  }
1634
2192
  const serializedTable = JSON.stringify(encryptedPayloads);
1635
- const integrityToken = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, serializedTable, seed);
2193
+ const integrityToken = computeFnv1aHash(serializedTable, seed);
1636
2194
  const varsSnippet = `var ${vaultVarName}=${serializedTable};var ${cacheVarName}=[];var ${dCacheVarName};`;
1637
2195
  const parsedVars = acorn3.parse(varsSnippet, {
1638
2196
  ecmaVersion: "latest",
@@ -1641,7 +2199,7 @@ function applySaltedStringVault(ast, seed = 2654435769, minStringLength = 4, hot
1641
2199
  let insertIdx = 0;
1642
2200
  while (insertIdx < ast.body.length) {
1643
2201
  const stmt = ast.body[insertIdx];
1644
- const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _183 => _183.expression, 'optionalAccess', _184 => _184.type]) === "Literal" && typeof stmt.expression.value === "string" && (activeDirectives.has(stmt.expression.value) || /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim())));
2202
+ const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _199 => _199.expression, 'optionalAccess', _200 => _200.type]) === "Literal" && typeof stmt.expression.value === "string" && (activeDirectives.has(stmt.expression.value) || /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim())));
1645
2203
  if (isDirective || stmt.type === "ImportDeclaration") {
1646
2204
  insertIdx++;
1647
2205
  } else {
@@ -1713,7 +2271,7 @@ function isReactDomSpecialProp(val, node, parent, customReserved) {
1713
2271
  if (parent.key === node && !parent.computed) {
1714
2272
  return true;
1715
2273
  }
1716
- const keyName = _optionalChain([parent, 'access', _185 => _185.key, 'optionalAccess', _186 => _186.type]) === "Identifier" ? parent.key.name : _optionalChain([parent, 'access', _187 => _187.key, 'optionalAccess', _188 => _188.type]) === "Literal" ? String(parent.key.value) : "";
2274
+ const keyName = _optionalChain([parent, 'access', _201 => _201.key, 'optionalAccess', _202 => _202.type]) === "Identifier" ? parent.key.name : _optionalChain([parent, 'access', _203 => _203.key, 'optionalAccess', _204 => _204.type]) === "Literal" ? String(parent.key.value) : "";
1717
2275
  if (keyName && isReservedProp(keyName, customReserved)) {
1718
2276
  return true;
1719
2277
  }
@@ -1776,11 +2334,11 @@ var DEFAULT_SEMANTIC_ANCHOR_RE = /(?:\bapi\/|\bcheckout\b|\badmin\b|\bauth\b|\bt
1776
2334
  function isUiClassName(val, parent) {
1777
2335
  if (parent) {
1778
2336
  if (parent.type === "Property") {
1779
- const k = _optionalChain([parent, 'access', _189 => _189.key, 'optionalAccess', _190 => _190.type]) === "Identifier" ? parent.key.name : _optionalChain([parent, 'access', _191 => _191.key, 'optionalAccess', _192 => _192.type]) === "Literal" ? String(parent.key.value) : "";
2337
+ const k = _optionalChain([parent, 'access', _205 => _205.key, 'optionalAccess', _206 => _206.type]) === "Identifier" ? parent.key.name : _optionalChain([parent, 'access', _207 => _207.key, 'optionalAccess', _208 => _208.type]) === "Literal" ? String(parent.key.value) : "";
1780
2338
  if (k === "className" || k === "class" || k === "classList") return true;
1781
2339
  }
1782
2340
  if (parent.type === "JSXAttribute") {
1783
- const name = _optionalChain([parent, 'access', _193 => _193.name, 'optionalAccess', _194 => _194.name]);
2341
+ const name = _optionalChain([parent, 'access', _209 => _209.name, 'optionalAccess', _210 => _210.name]);
1784
2342
  if (name === "className" || name === "class") return true;
1785
2343
  }
1786
2344
  }
@@ -1829,7 +2387,7 @@ function isEligibleHotLiteral(val, node, parent, ancestors, minLen, seed = 26544
1829
2387
  for (let i = ancestors.length - 2; i >= 0; i--) {
1830
2388
  const a = ancestors[i];
1831
2389
  if (a.type === "FunctionDeclaration" || a.type === "FunctionExpression" || a.type === "ArrowFunctionExpression") {
1832
- if (_optionalChain([a, 'access', _195 => _195.id, 'optionalAccess', _196 => _196.name]) && /^[A-Z]/.test(a.id.name)) {
2390
+ if (_optionalChain([a, 'access', _211 => _211.id, 'optionalAccess', _212 => _212.name]) && /^[A-Z]/.test(a.id.name)) {
1833
2391
  isInsideRender = true;
1834
2392
  break;
1835
2393
  }
@@ -1935,7 +2493,7 @@ function createShaderVaultAst(shaderVarName, shaderPayloads, seed) {
1935
2493
  });
1936
2494
  const firstStmt = parsedProgram.body[0];
1937
2495
  const fnAst = firstStmt.expression;
1938
- const buildH = _chunk6N6S6WTQcjs.computeIntegrityHash.call(void 0, _chunk6N6S6WTQcjs.generateCompactJs.call(void 0, fnAst), 0);
2496
+ const buildH = computeIntegrityHash(generateCompactJs(fnAst), 0);
1939
2497
  const S = (buildH ^ sSeed) >>> 0;
1940
2498
  const textEncoder = new TextEncoder();
1941
2499
  const b64List = [];
@@ -1951,26 +2509,53 @@ function createShaderVaultAst(shaderVarName, shaderPayloads, seed) {
1951
2509
  }
1952
2510
  return createSaltedVaultHelperAst(shaderVarName, b64List, fnAst);
1953
2511
  }
1954
- function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, windowKeySymbol, expectedDelta, deterrentMode, config, shieldCoupled = true, detectHeadless = false) {
1955
- const minLen = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _197 => _197.vault, 'optionalAccess', _198 => _198.minStringLength]), () => ( minStringLength));
2512
+ function extractScopeChain(ast, ancestors) {
2513
+ const chain = [ast];
2514
+ for (let i = 1; i < ancestors.length - 1; i++) {
2515
+ const a = ancestors[i];
2516
+ const prev = ancestors[i - 1];
2517
+ if (a.type === "BlockStatement" && (prev.type === "FunctionDeclaration" || prev.type === "FunctionExpression" || prev.type === "ArrowFunctionExpression")) {
2518
+ chain.push(a);
2519
+ }
2520
+ }
2521
+ return chain;
2522
+ }
2523
+ function findLowestCommonScope(ast, chains) {
2524
+ if (chains.length === 0) return ast;
2525
+ let lca = chains[0];
2526
+ for (let c = 1; c < chains.length; c++) {
2527
+ const cur = chains[c];
2528
+ let matchLen = 0;
2529
+ const limit = Math.min(lca.length, cur.length);
2530
+ while (matchLen < limit && lca[matchLen] === cur[matchLen]) {
2531
+ matchLen++;
2532
+ }
2533
+ lca = lca.slice(0, Math.max(1, matchLen));
2534
+ }
2535
+ return _nullishCoalesce(lca[lca.length - 1], () => ( ast));
2536
+ }
2537
+ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExemptNodes, windowKeySymbol, expectedDelta, deterrentMode, config, shieldCoupled = true, detectHeadless = false, exemptSubtreeRoots) {
2538
+ const minLen = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _213 => _213.vault, 'optionalAccess', _214 => _214.minStringLength]), () => ( minStringLength));
1956
2539
  const activeDirectives = new Set(DIRECTIVE_STRINGS);
1957
- if (_optionalChain([config, 'optionalAccess', _199 => _199.vault, 'optionalAccess', _200 => _200.customDirectives])) {
2540
+ if (_optionalChain([config, 'optionalAccess', _215 => _215.vault, 'optionalAccess', _216 => _216.customDirectives])) {
1958
2541
  for (const dir of config.vault.customDirectives) {
1959
2542
  activeDirectives.add(dir);
1960
2543
  }
1961
2544
  }
1962
- const customReserved = _optionalChain([config, 'optionalAccess', _201 => _201.vault, 'optionalAccess', _202 => _202.reservedProps]) ? new Set(config.vault.reservedProps) : void 0;
1963
- const semanticPatterns = _optionalChain([config, 'optionalAccess', _203 => _203.vault, 'optionalAccess', _204 => _204.semanticAnchors, 'optionalAccess', _205 => _205.patterns]);
1964
- const excludeUi = _optionalChain([config, 'optionalAccess', _206 => _206.vault, 'optionalAccess', _207 => _207.semanticAnchors, 'optionalAccess', _208 => _208.excludeUiClasses]) !== false;
2545
+ const customReserved = _optionalChain([config, 'optionalAccess', _217 => _217.vault, 'optionalAccess', _218 => _218.reservedProps]) ? new Set(config.vault.reservedProps) : void 0;
2546
+ const semanticPatterns = _optionalChain([config, 'optionalAccess', _219 => _219.vault, 'optionalAccess', _220 => _220.semanticAnchors, 'optionalAccess', _221 => _221.patterns, 'optionalAccess', _222 => _222.map, 'call', _223 => _223(
2547
+ (p) => typeof p === "string" ? new RegExp(p) : p
2548
+ )]);
2549
+ const excludeUi = _optionalChain([config, 'optionalAccess', _224 => _224.vault, 'optionalAccess', _225 => _225.semanticAnchors, 'optionalAccess', _226 => _226.excludeUiClasses]) !== false;
1965
2550
  const suffix = (seed >>> 0 & 65535).toString(36);
1966
2551
  const decryptFnName = `_uD${suffix}`;
1967
- const cacheVarName = _chunk6N6S6WTQcjs.derivePolymorphicIdent.call(void 0, seed, "vault");
1968
- const shaderVarName = _chunk6N6S6WTQcjs.derivePolymorphicIdent.call(void 0, seed, "shader");
1969
- const sym = _nullishCoalesce(windowKeySymbol, () => ( _chunk6N6S6WTQcjs.deriveWindowKeySymbol.call(void 0, seed)));
1970
- const browserOnly = _optionalChain([config, 'optionalAccess', _209 => _209.target]) === "browser";
2552
+ const cacheVarName = derivePolymorphicIdent(seed, "vault");
2553
+ const shaderVarName = derivePolymorphicIdent(seed, "shader");
2554
+ const sym = _nullishCoalesce(windowKeySymbol, () => ( deriveWindowKeySymbol(seed)));
2555
+ const browserOnly = _optionalChain([config, 'optionalAccess', _227 => _227.target]) === "browser";
1971
2556
  let expDelta = shieldCoupled ? expectedDelta : 0;
1972
2557
  if (shieldCoupled && expDelta === void 0) {
1973
- const shield = _chunk6N6S6WTQcjs.generateRuntimeShield.call(void 0, {
2558
+ const shield = generateRuntimeShield({
1974
2559
  seed,
1975
2560
  windowKeySymbol: sym,
1976
2561
  deterrentMode: _nullishCoalesce(deterrentMode, () => ( "passive")),
@@ -1979,14 +2564,14 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
1979
2564
  expDelta = _nullishCoalesce(shield.expectedDelta, () => ( 0));
1980
2565
  }
1981
2566
  const alreadyVaulted = ast.body.some(
1982
- (stmt) => stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _210 => _210.declarations, 'optionalAccess', _211 => _211.some, 'call', _212 => _212(
1983
- (d) => _optionalChain([d, 'access', _213 => _213.id, 'optionalAccess', _214 => _214.type]) === "Identifier" && typeof d.id.name === "string" && (d.id.name.startsWith("_uC") || d.id.name.startsWith("_uD") || d.id.name === decryptFnName || d.id.name === cacheVarName || _optionalChain([d, 'access', _215 => _215.init, 'optionalAccess', _216 => _216.type]) === "CallExpression" && _optionalChain([d, 'access', _217 => _217.init, 'access', _218 => _218.callee, 'optionalAccess', _219 => _219.type]) === "FunctionExpression" && _optionalChain([d, 'access', _220 => _220.init, 'access', _221 => _221.callee, 'optionalAccess', _222 => _222.id, 'optionalAccess', _223 => _223.name]) === "f" && _optionalChain([d, 'access', _224 => _224.init, 'access', _225 => _225.arguments, 'optionalAccess', _226 => _226[0], 'optionalAccess', _227 => _227.type]) === "ArrayExpression")
2567
+ (stmt) => stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _228 => _228.declarations, 'optionalAccess', _229 => _229.some, 'call', _230 => _230(
2568
+ (d) => _optionalChain([d, 'access', _231 => _231.id, 'optionalAccess', _232 => _232.type]) === "Identifier" && typeof d.id.name === "string" && (d.id.name.startsWith("_uC") || d.id.name.startsWith("_uD") || d.id.name === decryptFnName || d.id.name === cacheVarName || _optionalChain([d, 'access', _233 => _233.init, 'optionalAccess', _234 => _234.type]) === "CallExpression" && _optionalChain([d, 'access', _235 => _235.init, 'access', _236 => _236.callee, 'optionalAccess', _237 => _237.type]) === "FunctionExpression" && _optionalChain([d, 'access', _238 => _238.init, 'access', _239 => _239.callee, 'optionalAccess', _240 => _240.id, 'optionalAccess', _241 => _241.name]) === "f" && _optionalChain([d, 'access', _242 => _242.init, 'access', _243 => _243.arguments, 'optionalAccess', _244 => _244[0], 'optionalAccess', _245 => _245.type]) === "ArrayExpression")
1984
2569
  )])
1985
2570
  );
1986
2571
  if (alreadyVaulted) {
1987
2572
  return {
1988
2573
  encryptedStringsCount: 0,
1989
- integrityToken: _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "already-vaulted", seed),
2574
+ integrityToken: computeFnv1aHash("already-vaulted", seed),
1990
2575
  shaderBuffersCount: 0
1991
2576
  };
1992
2577
  }
@@ -2000,23 +2585,24 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2000
2585
  shieldCoupled,
2001
2586
  browserOnly
2002
2587
  );
2003
- const compactFnStr = _chunk6N6S6WTQcjs.generateCompactJs.call(void 0, fnAst);
2004
- const buildH = _chunk6N6S6WTQcjs.computeIntegrityHash.call(void 0, compactFnStr, 0);
2588
+ const compactFnStr = generateCompactJs(fnAst);
2589
+ const buildH = computeIntegrityHash(compactFnStr, 0);
2005
2590
  const expectedKey = (buildH ^ 0 ^ (shieldCoupled ? (_nullishCoalesce(expDelta, () => ( 0))) & 65535 : 0)) >>> 0;
2006
2591
  const stringToIndex = /* @__PURE__ */ new Map();
2592
+ const uniqueStrings = [];
2007
2593
  const encryptedPayloads = [];
2008
2594
  const shaderToIndex = /* @__PURE__ */ new Map();
2009
2595
  const shaderPayloads = [];
2010
2596
  const targetsToReplace = [];
2011
2597
  const hotTargetsToReplace = [];
2012
2598
  const customWalkBase = {
2013
- ...walk3.base,
2599
+ ...walk4.base,
2014
2600
  Property(node, st, c) {
2015
2601
  c(node.key, st);
2016
2602
  if (node.value) c(node.value, st);
2017
2603
  }
2018
2604
  };
2019
- walk3.ancestor(
2605
+ walk4.ancestor(
2020
2606
  ast,
2021
2607
  {
2022
2608
  Literal(node, _state, ancestors) {
@@ -2034,6 +2620,9 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2034
2620
  }
2035
2621
  const parent = ancestors[ancestors.length - 2];
2036
2622
  if (!parent) return;
2623
+ if (isNodeInExemptSubtree(ancestors, exemptSubtreeRoots)) {
2624
+ return;
2625
+ }
2037
2626
  if (parent.type === "ExpressionStatement" && (Boolean(parent.directive) || activeDirectives.has(val))) {
2038
2627
  return;
2039
2628
  }
@@ -2089,19 +2678,28 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2089
2678
  shaderToIndex.set(val, idx);
2090
2679
  shaderPayloads.push(val);
2091
2680
  }
2092
- targetsToReplace.push({ type: "shader", node, parent, idx });
2681
+ targetsToReplace.push({
2682
+ type: "shader",
2683
+ node,
2684
+ parent,
2685
+ idx,
2686
+ scopeChain: extractScopeChain(ast, ancestors)
2687
+ });
2093
2688
  } else {
2094
2689
  if (!shouldEncryptString(val, minLen, parent, activeDirectives, customReserved)) return;
2095
2690
  let idx = stringToIndex.get(val);
2096
2691
  if (idx === void 0) {
2097
- idx = encryptedPayloads.length;
2692
+ idx = uniqueStrings.length;
2098
2693
  stringToIndex.set(val, idx);
2099
- const salt = computeCallSiteSalt(seed, idx);
2100
- encryptedPayloads.push(
2101
- encodeStringWithSeed(val, P_CHARS, expectedKey, salt, idx)
2102
- );
2694
+ uniqueStrings.push(val);
2103
2695
  }
2104
- targetsToReplace.push({ type: "string", node, parent, idx });
2696
+ targetsToReplace.push({
2697
+ type: "string",
2698
+ node,
2699
+ parent,
2700
+ idx,
2701
+ scopeChain: extractScopeChain(ast, ancestors)
2702
+ });
2105
2703
  }
2106
2704
  },
2107
2705
  TemplateLiteral(node, _state, ancestors) {
@@ -2109,6 +2707,9 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2109
2707
  if (node.expressions && node.expressions.length !== 0) return;
2110
2708
  const val = _nullishCoalesce(node.quasis[0].value.cooked, () => ( node.quasis[0].value.raw));
2111
2709
  if (typeof val !== "string" || activeDirectives.has(val)) return;
2710
+ if (isNodeInExemptSubtree(ancestors, exemptSubtreeRoots)) {
2711
+ return;
2712
+ }
2112
2713
  let isHotExempt = false;
2113
2714
  if (hotExemptNodes) {
2114
2715
  for (let i = ancestors.length - 2; i >= 0; i--) {
@@ -2120,6 +2721,9 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2120
2721
  }
2121
2722
  const parent = ancestors[ancestors.length - 2];
2122
2723
  if (!parent) return;
2724
+ if (isNodeInExemptSubtree(ancestors, exemptSubtreeRoots)) {
2725
+ return;
2726
+ }
2123
2727
  if (parent.type === "ExpressionStatement" && (Boolean(parent.directive) || activeDirectives.has(val))) {
2124
2728
  return;
2125
2729
  }
@@ -2161,19 +2765,28 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2161
2765
  shaderToIndex.set(val, idx);
2162
2766
  shaderPayloads.push(val);
2163
2767
  }
2164
- targetsToReplace.push({ type: "shader", node, parent, idx });
2768
+ targetsToReplace.push({
2769
+ type: "shader",
2770
+ node,
2771
+ parent,
2772
+ idx,
2773
+ scopeChain: extractScopeChain(ast, ancestors)
2774
+ });
2165
2775
  } else {
2166
2776
  if (!shouldEncryptString(val, minLen, parent, activeDirectives, customReserved)) return;
2167
2777
  let idx = stringToIndex.get(val);
2168
2778
  if (idx === void 0) {
2169
- idx = encryptedPayloads.length;
2779
+ idx = uniqueStrings.length;
2170
2780
  stringToIndex.set(val, idx);
2171
- const salt = computeCallSiteSalt(seed, idx);
2172
- encryptedPayloads.push(
2173
- encodeStringWithSeed(val, P_CHARS, expectedKey, salt, idx)
2174
- );
2781
+ uniqueStrings.push(val);
2175
2782
  }
2176
- targetsToReplace.push({ type: "string", node, parent, idx });
2783
+ targetsToReplace.push({
2784
+ type: "string",
2785
+ node,
2786
+ parent,
2787
+ idx,
2788
+ scopeChain: extractScopeChain(ast, ancestors)
2789
+ });
2177
2790
  }
2178
2791
  }
2179
2792
  },
@@ -2182,7 +2795,7 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2182
2795
  if (targetsToReplace.length === 0 && hotTargetsToReplace.length === 0) {
2183
2796
  return {
2184
2797
  encryptedStringsCount: 0,
2185
- integrityToken: _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "empty", seed),
2798
+ integrityToken: computeFnv1aHash("empty", seed),
2186
2799
  shaderBuffersCount: 0
2187
2800
  };
2188
2801
  }
@@ -2192,7 +2805,7 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2192
2805
  for (let i = 0; i < val.length; i++) {
2193
2806
  encodedStr += String.fromCharCode(val.charCodeAt(i) ^ key);
2194
2807
  }
2195
- if (_optionalChain([parent, 'optionalAccess', _228 => _228.type]) === "Property" && parent.key === node) {
2808
+ if (_optionalChain([parent, 'optionalAccess', _246 => _246.type]) === "Property" && parent.key === node) {
2196
2809
  parent.computed = true;
2197
2810
  }
2198
2811
  node.type = "CallExpression";
@@ -2218,69 +2831,170 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2218
2831
  delete node.quasis;
2219
2832
  delete node.expressions;
2220
2833
  }
2221
- const serializedTable = JSON.stringify(encryptedPayloads);
2222
- const integrityToken = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, serializedTable, seed);
2223
- for (const { type, node, parent, idx } of targetsToReplace) {
2224
- if (_optionalChain([parent, 'optionalAccess', _229 => _229.type]) === "Property" && parent.key === node) {
2225
- parent.computed = true;
2834
+ let insertIdx = 0;
2835
+ while (insertIdx < ast.body.length) {
2836
+ const stmt = ast.body[insertIdx];
2837
+ const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _247 => _247.expression, 'optionalAccess', _248 => _248.type]) === "Literal" && typeof stmt.expression.value === "string" && (activeDirectives.has(stmt.expression.value) || /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim())));
2838
+ if (isDirective || stmt.type === "ImportDeclaration") {
2839
+ insertIdx++;
2840
+ } else {
2841
+ break;
2226
2842
  }
2227
- if (type === "shader") {
2228
- node.type = "CallExpression";
2229
- node.callee = {
2230
- type: "Identifier",
2231
- name: shaderVarName
2232
- };
2233
- node.arguments = [
2234
- {
2235
- type: "Literal",
2236
- value: idx,
2237
- raw: String(idx)
2238
- }
2239
- ];
2843
+ }
2844
+ const wantFragmented = Boolean(_optionalChain([config, 'optionalAccess', _249 => _249.vault, 'optionalAccess', _250 => _250.fragmented]));
2845
+ let fragCount = Math.max(2, Math.min(8, Math.floor(_nullishCoalesce(_optionalChain([config, 'optionalAccess', _251 => _251.vault, 'optionalAccess', _252 => _252.fragmentCount]), () => ( 3)))));
2846
+ while (fragCount > 2 && Math.floor(uniqueStrings.length / fragCount) < 4) {
2847
+ fragCount--;
2848
+ }
2849
+ const useFragmented = wantFragmented && uniqueStrings.length >= 8 && Math.floor(uniqueStrings.length / fragCount) >= 4;
2850
+ let integrityToken = computeFnv1aHash("empty", seed);
2851
+ if (!useFragmented) {
2852
+ for (let idx = 0; idx < uniqueStrings.length; idx++) {
2853
+ const salt = computeCallSiteSalt(seed, idx);
2854
+ encryptedPayloads.push(
2855
+ encodeStringWithSeed(uniqueStrings[idx], P_CHARS, expectedKey, salt, idx)
2856
+ );
2857
+ }
2858
+ integrityToken = computeFnv1aHash(JSON.stringify(encryptedPayloads), seed);
2859
+ for (const { type, node, parent, idx } of targetsToReplace) {
2860
+ if (_optionalChain([parent, 'optionalAccess', _253 => _253.type]) === "Property" && parent.key === node) {
2861
+ parent.computed = true;
2862
+ }
2863
+ if (type === "shader") {
2864
+ node.type = "CallExpression";
2865
+ node.callee = { type: "Identifier", name: shaderVarName };
2866
+ node.arguments = [{ type: "Literal", value: idx, raw: String(idx) }];
2867
+ } else {
2868
+ const salt = computeCallSiteSalt(seed, idx);
2869
+ node.type = "CallExpression";
2870
+ node.callee = { type: "Identifier", name: decryptFnName };
2871
+ node.arguments = [
2872
+ { type: "Literal", value: idx, raw: String(idx) },
2873
+ { type: "Literal", value: salt, raw: String(salt) }
2874
+ ];
2875
+ }
2240
2876
  node.optional = false;
2241
2877
  delete node.value;
2242
2878
  delete node.raw;
2243
2879
  delete node.quasis;
2244
2880
  delete node.expressions;
2245
- } else {
2246
- const salt = computeCallSiteSalt(seed, idx);
2247
- node.type = "CallExpression";
2248
- node.callee = {
2249
- type: "Identifier",
2250
- name: decryptFnName
2251
- };
2252
- node.arguments = [
2253
- {
2254
- type: "Literal",
2255
- value: idx,
2256
- raw: String(idx)
2257
- },
2258
- {
2259
- type: "Literal",
2260
- value: salt,
2261
- raw: String(salt)
2262
- }
2263
- ];
2881
+ }
2882
+ } else {
2883
+ const perm = [];
2884
+ for (let i = 0; i < uniqueStrings.length; i++) perm.push(i);
2885
+ let prng = (seed || 305419896) >>> 0;
2886
+ for (let i = perm.length - 1; i > 0; i--) {
2887
+ prng ^= prng << 13;
2888
+ prng ^= prng >>> 17;
2889
+ prng ^= prng << 5;
2890
+ const j = (prng >>> 0) % (i + 1);
2891
+ const tmp = perm[i];
2892
+ perm[i] = perm[j];
2893
+ perm[j] = tmp;
2894
+ }
2895
+ const stringFragAssign = new Array(
2896
+ uniqueStrings.length
2897
+ );
2898
+ const fragStrings = Array.from({ length: fragCount }, () => []);
2899
+ for (let p = 0; p < perm.length; p++) {
2900
+ const strIdx = perm[p];
2901
+ const fragId = p % fragCount;
2902
+ const localIdx = fragStrings[fragId].length;
2903
+ fragStrings[fragId].push(uniqueStrings[strIdx]);
2904
+ stringFragAssign[strIdx] = { fragId, localIdx };
2905
+ }
2906
+ const fragMeta = [];
2907
+ const usedFnNames = /* @__PURE__ */ new Set();
2908
+ for (let f = 0; f < fragCount; f++) {
2909
+ const fragSeed = (seed ^ Math.imul(f + 1, 2654435769)) >>> 0;
2910
+ let fnName = `_uD${(fragSeed & 65535).toString(36)}f${f}`;
2911
+ while (usedFnNames.has(fnName)) {
2912
+ fnName += "_";
2913
+ }
2914
+ usedFnNames.add(fnName);
2915
+ const pCharsF = createPermutationTable(fragSeed);
2916
+ const fnAstF = createSaltedDecryptorFnAst(
2917
+ fragSeed,
2918
+ pCharsF,
2919
+ _nullishCoalesce(expDelta, () => ( 0)),
2920
+ sym,
2921
+ SAFE_ALPHA,
2922
+ shieldCoupled,
2923
+ browserOnly
2924
+ );
2925
+ const buildHF = computeIntegrityHash(generateCompactJs(fnAstF), 0);
2926
+ const expectedKeyF = (buildHF ^ 0 ^ (shieldCoupled ? (_nullishCoalesce(expDelta, () => ( 0))) & 65535 : 0)) >>> 0;
2927
+ const payloads = [];
2928
+ for (let localIdx = 0; localIdx < fragStrings[f].length; localIdx++) {
2929
+ const salt = computeCallSiteSalt(fragSeed, localIdx);
2930
+ payloads.push(
2931
+ encodeStringWithSeed(
2932
+ fragStrings[f][localIdx],
2933
+ pCharsF,
2934
+ expectedKeyF,
2935
+ salt,
2936
+ localIdx
2937
+ )
2938
+ );
2939
+ }
2940
+ fragMeta.push({
2941
+ fragSeed,
2942
+ fnName,
2943
+ fnAst: fnAstF,
2944
+ payloads,
2945
+ chains: []
2946
+ });
2947
+ }
2948
+ for (const { type, node, parent, idx, scopeChain } of targetsToReplace) {
2949
+ if (_optionalChain([parent, 'optionalAccess', _254 => _254.type]) === "Property" && parent.key === node) {
2950
+ parent.computed = true;
2951
+ }
2952
+ if (type === "shader") {
2953
+ node.type = "CallExpression";
2954
+ node.callee = { type: "Identifier", name: shaderVarName };
2955
+ node.arguments = [{ type: "Literal", value: idx, raw: String(idx) }];
2956
+ } else {
2957
+ const { fragId, localIdx } = stringFragAssign[idx];
2958
+ const meta = fragMeta[fragId];
2959
+ meta.chains.push(scopeChain);
2960
+ const salt = computeCallSiteSalt(meta.fragSeed, localIdx);
2961
+ node.type = "CallExpression";
2962
+ node.callee = { type: "Identifier", name: meta.fnName };
2963
+ node.arguments = [
2964
+ { type: "Literal", value: localIdx, raw: String(localIdx) },
2965
+ { type: "Literal", value: salt, raw: String(salt) }
2966
+ ];
2967
+ }
2264
2968
  node.optional = false;
2265
2969
  delete node.value;
2266
2970
  delete node.raw;
2267
2971
  delete node.quasis;
2268
2972
  delete node.expressions;
2269
2973
  }
2270
- }
2271
- let insertIdx = 0;
2272
- while (insertIdx < ast.body.length) {
2273
- const stmt = ast.body[insertIdx];
2274
- const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _230 => _230.expression, 'optionalAccess', _231 => _231.type]) === "Literal" && typeof stmt.expression.value === "string" && (activeDirectives.has(stmt.expression.value) || /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim())));
2275
- if (isDirective || stmt.type === "ImportDeclaration") {
2276
- insertIdx++;
2277
- } else {
2278
- break;
2974
+ const allPayloads = [];
2975
+ for (const meta of fragMeta) {
2976
+ allPayloads.push(meta.payloads);
2977
+ const helperStmt = createSaltedVaultHelperAst(
2978
+ meta.fnName,
2979
+ meta.payloads,
2980
+ meta.fnAst
2981
+ );
2982
+ const lcaScope = findLowestCommonScope(ast, meta.chains);
2983
+ if (lcaScope === ast || !Array.isArray(lcaScope.body)) {
2984
+ ast.body.splice(insertIdx++, 0, helperStmt);
2985
+ } else {
2986
+ let blockInsertIdx = 0;
2987
+ while (blockInsertIdx < lcaScope.body.length && _optionalChain([lcaScope, 'access', _255 => _255.body, 'access', _256 => _256[blockInsertIdx], 'optionalAccess', _257 => _257.type]) === "ExpressionStatement" && Boolean(_optionalChain([lcaScope, 'access', _258 => _258.body, 'access', _259 => _259[blockInsertIdx], 'optionalAccess', _260 => _260.directive]))) {
2988
+ blockInsertIdx++;
2989
+ }
2990
+ lcaScope.body.splice(blockInsertIdx, 0, helperStmt);
2991
+ }
2279
2992
  }
2993
+ integrityToken = computeFnv1aHash(JSON.stringify(allPayloads), seed);
2280
2994
  }
2281
2995
  if (hotTargetsToReplace.length > 0) {
2282
2996
  const alreadyHasHx = ast.body.some(
2283
- (stmt) => stmt.type === "FunctionDeclaration" && _optionalChain([stmt, 'access', _232 => _232.id, 'optionalAccess', _233 => _233.name]) === "_hX"
2997
+ (stmt) => stmt.type === "FunctionDeclaration" && _optionalChain([stmt, 'access', _261 => _261.id, 'optionalAccess', _262 => _262.name]) === "_hX"
2284
2998
  );
2285
2999
  if (!alreadyHasHx) {
2286
3000
  const hxAst = acorn4.parse(
@@ -2290,7 +3004,7 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2290
3004
  ast.body.splice(insertIdx++, 0, hxAst.body[0]);
2291
3005
  }
2292
3006
  }
2293
- if (encryptedPayloads.length > 0) {
3007
+ if (!useFragmented && encryptedPayloads.length > 0) {
2294
3008
  const vaultHelperStmt = createSaltedVaultHelperAst(
2295
3009
  decryptFnName,
2296
3010
  encryptedPayloads,
@@ -2307,7 +3021,7 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
2307
3021
  ast.body.splice(insertIdx++, 0, shaderHelperStmt);
2308
3022
  }
2309
3023
  return {
2310
- encryptedStringsCount: encryptedPayloads.length + hotTargetsToReplace.length,
3024
+ encryptedStringsCount: uniqueStrings.length + hotTargetsToReplace.length,
2311
3025
  integrityToken,
2312
3026
  shaderBuffersCount: shaderPayloads.length
2313
3027
  };
@@ -2468,8 +3182,10 @@ function collectPatternTargets(pattern, out, shorthandProp) {
2468
3182
  }
2469
3183
  }
2470
3184
  function isMangleableName(origName, reservedSet = RESERVED_IDENTIFIERS, manglerConfig) {
2471
- const minLength = _nullishCoalesce(_optionalChain([manglerConfig, 'optionalAccess', _234 => _234.minLength]), () => ( 3));
2472
- return origName.length >= minLength && !reservedSet.has(origName) && !JS_KEYWORDS.has(origName) && !origName.startsWith("$") && !origName.startsWith("__") && !origName.startsWith("_u") && !origName.startsWith("_0x") && (!_optionalChain([manglerConfig, 'optionalAccess', _235 => _235.excludePrefixes]) || !manglerConfig.excludePrefixes.some((p) => origName.startsWith(p))) && (!_optionalChain([manglerConfig, 'optionalAccess', _236 => _236.excludePatterns]) || !manglerConfig.excludePatterns.some((re) => re.test(origName)));
3185
+ const minLength = _nullishCoalesce(_optionalChain([manglerConfig, 'optionalAccess', _263 => _263.minLength]), () => ( 3));
3186
+ return origName.length >= minLength && !reservedSet.has(origName) && !JS_KEYWORDS.has(origName) && !origName.startsWith("$") && !origName.startsWith("__") && !origName.startsWith("_u") && !origName.startsWith("_0x") && (!_optionalChain([manglerConfig, 'optionalAccess', _264 => _264.excludePrefixes]) || !manglerConfig.excludePrefixes.some((p) => origName.startsWith(p))) && (!_optionalChain([manglerConfig, 'optionalAccess', _265 => _265.excludePatterns]) || !manglerConfig.excludePatterns.some(
3187
+ (re) => (typeof re === "string" ? new RegExp(re) : re).test(origName)
3188
+ ));
2473
3189
  }
2474
3190
  function shuffleAlphabet(chars, seed) {
2475
3191
  const arr = chars.split("");
@@ -2487,12 +3203,12 @@ function shuffleAlphabet(chars, seed) {
2487
3203
  }
2488
3204
  function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes, config) {
2489
3205
  const activeReserved = new Set(RESERVED_IDENTIFIERS);
2490
- if (_optionalChain([config, 'optionalAccess', _237 => _237.mangler, 'optionalAccess', _238 => _238.reservedIdentifiers])) {
3206
+ if (_optionalChain([config, 'optionalAccess', _266 => _266.mangler, 'optionalAccess', _267 => _267.reservedIdentifiers])) {
2491
3207
  for (const id of config.mangler.reservedIdentifiers) {
2492
3208
  activeReserved.add(id);
2493
3209
  }
2494
3210
  }
2495
- const manglerConfig = _optionalChain([config, 'optionalAccess', _239 => _239.mangler]);
3211
+ const manglerConfig = _optionalChain([config, 'optionalAccess', _268 => _268.mangler]);
2496
3212
  const scopeRecords = /* @__PURE__ */ new Map();
2497
3213
  const barrierOrFreeIds = /* @__PURE__ */ new Set();
2498
3214
  const renamedTargetNodes = /* @__PURE__ */ new WeakSet();
@@ -2597,7 +3313,7 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2597
3313
  }
2598
3314
  }
2599
3315
  ensureScopeChain([ast]);
2600
- walk4.ancestor(ast, {
3316
+ walk5.ancestor(ast, {
2601
3317
  BlockStatement(_node, _state, ancestors) {
2602
3318
  ensureScopeChain(ancestors);
2603
3319
  },
@@ -2614,17 +3330,17 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2614
3330
  ensureScopeChain(ancestors);
2615
3331
  },
2616
3332
  ImportSpecifier(node) {
2617
- if (_optionalChain([node, 'access', _240 => _240.local, 'optionalAccess', _241 => _241.name])) barrierOrFreeIds.add(node.local.name);
3333
+ if (_optionalChain([node, 'access', _269 => _269.local, 'optionalAccess', _270 => _270.name])) barrierOrFreeIds.add(node.local.name);
2618
3334
  },
2619
3335
  ImportDefaultSpecifier(node) {
2620
- if (_optionalChain([node, 'access', _242 => _242.local, 'optionalAccess', _243 => _243.name])) barrierOrFreeIds.add(node.local.name);
3336
+ if (_optionalChain([node, 'access', _271 => _271.local, 'optionalAccess', _272 => _272.name])) barrierOrFreeIds.add(node.local.name);
2621
3337
  },
2622
3338
  ImportNamespaceSpecifier(node) {
2623
- if (_optionalChain([node, 'access', _244 => _244.local, 'optionalAccess', _245 => _245.name])) barrierOrFreeIds.add(node.local.name);
3339
+ if (_optionalChain([node, 'access', _273 => _273.local, 'optionalAccess', _274 => _274.name])) barrierOrFreeIds.add(node.local.name);
2624
3340
  },
2625
3341
  FunctionDeclaration(node, _state, ancestors) {
2626
3342
  registerFunctionParams(node, ancestors);
2627
- if (_optionalChain([node, 'access', _246 => _246.id, 'optionalAccess', _247 => _247.type]) === "Identifier") {
3343
+ if (_optionalChain([node, 'access', _275 => _275.id, 'optionalAccess', _276 => _276.type]) === "Identifier") {
2628
3344
  const parentAncestors = ancestors.slice(0, -1);
2629
3345
  const lexNode = findEnclosingLexicalNode(parentAncestors);
2630
3346
  const fnNode = _nullishCoalesce(findEnclosingFunctionNode(parentAncestors), () => ( ast));
@@ -2632,15 +3348,15 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2632
3348
  if (lexNode === fnNode.body || fnNode === ast) {
2633
3349
  registerBarrierName(fnNode, node.id.name);
2634
3350
  }
2635
- if (!_optionalChain([scopeRecords, 'access', _248 => _248.get, 'call', _249 => _249(node), 'optionalAccess', _250 => _250.bindings, 'access', _251 => _251.has, 'call', _252 => _252(node.id.name)])) {
3351
+ if (!_optionalChain([scopeRecords, 'access', _277 => _277.get, 'call', _278 => _278(node), 'optionalAccess', _279 => _279.bindings, 'access', _280 => _280.has, 'call', _281 => _281(node.id.name)])) {
2636
3352
  registerBarrierName(node, node.id.name);
2637
3353
  }
2638
3354
  }
2639
3355
  },
2640
3356
  FunctionExpression(node, _state, ancestors) {
2641
3357
  registerFunctionParams(node, ancestors);
2642
- if (_optionalChain([node, 'access', _253 => _253.id, 'optionalAccess', _254 => _254.type]) === "Identifier") {
2643
- if (!_optionalChain([scopeRecords, 'access', _255 => _255.get, 'call', _256 => _256(node), 'optionalAccess', _257 => _257.bindings, 'access', _258 => _258.has, 'call', _259 => _259(node.id.name)])) {
3358
+ if (_optionalChain([node, 'access', _282 => _282.id, 'optionalAccess', _283 => _283.type]) === "Identifier") {
3359
+ if (!_optionalChain([scopeRecords, 'access', _284 => _284.get, 'call', _285 => _285(node), 'optionalAccess', _286 => _286.bindings, 'access', _287 => _287.has, 'call', _288 => _288(node.id.name)])) {
2644
3360
  registerBarrierName(node, node.id.name);
2645
3361
  }
2646
3362
  }
@@ -2650,7 +3366,7 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2650
3366
  },
2651
3367
  ClassDeclaration(node, _state, ancestors) {
2652
3368
  ensureScopeChain(ancestors);
2653
- if (_optionalChain([node, 'access', _260 => _260.id, 'optionalAccess', _261 => _261.type]) === "Identifier") {
3369
+ if (_optionalChain([node, 'access', _289 => _289.id, 'optionalAccess', _290 => _290.type]) === "Identifier") {
2654
3370
  const parentAncestors = ancestors.slice(0, -1);
2655
3371
  const lexNode = findEnclosingLexicalNode(parentAncestors);
2656
3372
  registerBarrierName(lexNode, node.id.name);
@@ -2659,7 +3375,7 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2659
3375
  },
2660
3376
  ClassExpression(node, _state, ancestors) {
2661
3377
  ensureScopeChain(ancestors);
2662
- if (_optionalChain([node, 'access', _262 => _262.id, 'optionalAccess', _263 => _263.type]) === "Identifier") {
3378
+ if (_optionalChain([node, 'access', _291 => _291.id, 'optionalAccess', _292 => _292.type]) === "Identifier") {
2663
3379
  registerBarrierName(node, node.id.name);
2664
3380
  }
2665
3381
  },
@@ -2698,7 +3414,7 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2698
3414
  if (ancestors[i] === fnScope) break;
2699
3415
  if (ancestors[i].type === "CatchClause") {
2700
3416
  const catchScope = scopeRecords.get(ancestors[i]);
2701
- if (_optionalChain([catchScope, 'optionalAccess', _264 => _264.bindings, 'access', _265 => _265.has, 'call', _266 => _266(origName)])) {
3417
+ if (_optionalChain([catchScope, 'optionalAccess', _293 => _293.bindings, 'access', _294 => _294.has, 'call', _295 => _295(origName)])) {
2702
3418
  registerBarrierName(ancestors[i], origName);
2703
3419
  registerBarrierName(fnScope, origName);
2704
3420
  }
@@ -2735,7 +3451,7 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2735
3451
  }
2736
3452
  return false;
2737
3453
  }
2738
- walk4.ancestor(ast, {
3454
+ walk5.ancestor(ast, {
2739
3455
  Identifier(node, _state, ancestors) {
2740
3456
  if (renamedTargetNodes.has(node)) return;
2741
3457
  const parent = ancestors[ancestors.length - 2];
@@ -2842,7 +3558,7 @@ function applyPolymorphicMangler(ast, seed = 2654435769, serializedFunctionNodes
2842
3558
  }
2843
3559
  }
2844
3560
  }
2845
- walk4.ancestor(ast, {
3561
+ walk5.ancestor(ast, {
2846
3562
  AssignmentExpression(node, _state, ancestors) {
2847
3563
  renamePatternTargetsInScope(node.left, ancestors);
2848
3564
  },
@@ -3125,11 +3841,11 @@ function createSotaMbaPredicate(seed, fnIndex = 0, paramNode, decoyIdent, isArro
3125
3841
  let paramName = null;
3126
3842
  if (typeof paramNode === "string") {
3127
3843
  paramName = paramNode;
3128
- } else if (_optionalChain([paramNode, 'optionalAccess', _267 => _267.type]) === "Identifier") {
3844
+ } else if (_optionalChain([paramNode, 'optionalAccess', _296 => _296.type]) === "Identifier") {
3129
3845
  paramName = paramNode.name;
3130
- } else if (_optionalChain([paramNode, 'optionalAccess', _268 => _268.type]) === "AssignmentPattern" && _optionalChain([paramNode, 'access', _269 => _269.left, 'optionalAccess', _270 => _270.type]) === "Identifier") {
3846
+ } else if (_optionalChain([paramNode, 'optionalAccess', _297 => _297.type]) === "AssignmentPattern" && _optionalChain([paramNode, 'access', _298 => _298.left, 'optionalAccess', _299 => _299.type]) === "Identifier") {
3131
3847
  paramName = paramNode.left.name;
3132
- } else if (_optionalChain([paramNode, 'optionalAccess', _271 => _271.type]) === "RestElement" && _optionalChain([paramNode, 'access', _272 => _272.argument, 'optionalAccess', _273 => _273.type]) === "Identifier") {
3848
+ } else if (_optionalChain([paramNode, 'optionalAccess', _300 => _300.type]) === "RestElement" && _optionalChain([paramNode, 'access', _301 => _301.argument, 'optionalAccess', _302 => _302.type]) === "Identifier") {
3133
3849
  paramName = paramNode.argument.name;
3134
3850
  }
3135
3851
  let vBitNode;
@@ -3236,8 +3952,8 @@ function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769, hotExempt
3236
3952
  const decoyIdent = "_d";
3237
3953
  if (Array.isArray(ast.body)) {
3238
3954
  const alreadyGuarded = ast.body.some(
3239
- (stmt) => stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _274 => _274.declarations, 'optionalAccess', _275 => _275.some, 'call', _276 => _276(
3240
- (d) => _optionalChain([d, 'access', _277 => _277.id, 'optionalAccess', _278 => _278.type]) === "Identifier" && d.id.name === decoyIdent
3955
+ (stmt) => stmt.type === "VariableDeclaration" && _optionalChain([stmt, 'access', _303 => _303.declarations, 'optionalAccess', _304 => _304.some, 'call', _305 => _305(
3956
+ (d) => _optionalChain([d, 'access', _306 => _306.id, 'optionalAccess', _307 => _307.type]) === "Identifier" && d.id.name === decoyIdent
3241
3957
  )])
3242
3958
  );
3243
3959
  if (alreadyGuarded) return 0;
@@ -3247,7 +3963,7 @@ function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769, hotExempt
3247
3963
  if (guardedCount >= MAX_COLD_GUARDS_PER_CHUNK) return;
3248
3964
  if (!coldFunctionNodes.has(node)) return;
3249
3965
  if (!node.body || node.body.type !== "BlockStatement") return;
3250
- const firstParam = _optionalChain([node, 'access', _279 => _279.params, 'optionalAccess', _280 => _280[0]]);
3966
+ const firstParam = _optionalChain([node, 'access', _308 => _308.params, 'optionalAccess', _309 => _309[0]]);
3251
3967
  const isArrow = node.type === "ArrowFunctionExpression";
3252
3968
  const guardStmt = createSotaMbaPredicate(
3253
3969
  seed,
@@ -3267,7 +3983,7 @@ function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769, hotExempt
3267
3983
  }
3268
3984
  node.body.body.splice(insertIdx, 0, guardStmt);
3269
3985
  }
3270
- walk5.simple(ast, {
3986
+ walk6.simple(ast, {
3271
3987
  FunctionDeclaration: maybeInjectGuard,
3272
3988
  FunctionExpression: maybeInjectGuard,
3273
3989
  ArrowFunctionExpression: maybeInjectGuard
@@ -3277,7 +3993,7 @@ function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769, hotExempt
3277
3993
  if (hotExemptNodes) {
3278
3994
  hotExemptNodes.add(sharedDecoyDecl);
3279
3995
  for (const decl of sharedDecoyDecl.declarations || []) {
3280
- if (_optionalChain([decl, 'access', _281 => _281.init, 'optionalAccess', _282 => _282.type]) === "ArrayExpression" && decl.init.elements) {
3996
+ if (_optionalChain([decl, 'access', _310 => _310.init, 'optionalAccess', _311 => _311.type]) === "ArrayExpression" && decl.init.elements) {
3281
3997
  for (const el of decl.init.elements) {
3282
3998
  if (el) hotExemptNodes.add(el);
3283
3999
  }
@@ -3342,7 +4058,7 @@ function shuffleRange(n, seed) {
3342
4058
  return arr;
3343
4059
  }
3344
4060
  function deriveVmKey(seed) {
3345
- return _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "vm-key", seed) | 0;
4061
+ return computeFnv1aHash("vm-key", seed) | 0;
3346
4062
  }
3347
4063
  function encryptBytecodeStream(plainBytecode, fnSalt, vmKey, stateSlots) {
3348
4064
  const len = plainBytecode.length;
@@ -3394,8 +4110,8 @@ function createInterpreterSource(vmHelperName, opMap, seed = 2654435769, windowK
3394
4110
  const opCount = opMap.length;
3395
4111
  const slotMap = shuffleRange(opCount, (seed ^ 1367130551) >>> 0);
3396
4112
  const pairOrder = shuffleRange(opCount, (seed ^ 1013904242) >>> 0);
3397
- const opMask = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "vm-opmask", seed) & 255 | 1;
3398
- const slotMask = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "vm-slotmask", seed) & 127 | 32;
4113
+ const opMask = computeFnv1aHash("vm-opmask", seed) & 255 | 1;
4114
+ const slotMask = computeFnv1aHash("vm-slotmask", seed) & 127 | 32;
3399
4115
  const vmKey = deriveVmKey(seed);
3400
4116
  const pairs = [];
3401
4117
  for (const op of pairOrder) {
@@ -3448,8 +4164,8 @@ function createInterpreterSource(vmHelperName, opMap, seed = 2654435769, windowK
3448
4164
  sourceType: "script"
3449
4165
  });
3450
4166
  const factoryExpr = parsedFactory.body[0].expression;
3451
- const compactFactory = _chunk6N6S6WTQcjs.generateCompactJs.call(void 0, factoryExpr);
3452
- const buildH = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, compactFactory);
4167
+ const compactFactory = generateCompactJs(factoryExpr);
4168
+ const buildH = computeFnv1aHash(compactFactory);
3453
4169
  const expD = hasSym ? expectedDelta & 65535 : 0;
3454
4170
  const argA = (opMask ^ buildH & 255 ^ expD & 255) & 255;
3455
4171
  const argB = (slotMask ^ buildH >>> 8 & 255 ^ expD >>> 8 & 255) & 255;
@@ -3459,14 +4175,14 @@ function createInterpreterSource(vmHelperName, opMap, seed = 2654435769, windowK
3459
4175
  }
3460
4176
  function countAstNodes(node) {
3461
4177
  let count = 0;
3462
- walk6.full(node, () => {
4178
+ walk7.full(node, () => {
3463
4179
  count++;
3464
4180
  });
3465
4181
  return count;
3466
4182
  }
3467
4183
  function hasForbiddenConstructs(fnNode) {
3468
4184
  let forbidden = false;
3469
- walk6.full(fnNode, (node) => {
4185
+ walk7.full(fnNode, (node) => {
3470
4186
  if (forbidden) return;
3471
4187
  const type = node.type;
3472
4188
  if (type === "JSXElement" || type === "JSXFragment" || type === "Super" || type === "YieldExpression" || type === "WithStatement") {
@@ -3558,7 +4274,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3558
4274
  const isVar = node.kind === "var";
3559
4275
  if (isVar || isTopBody) {
3560
4276
  for (const decl of node.declarations || []) {
3561
- if (_optionalChain([decl, 'access', _283 => _283.id, 'optionalAccess', _284 => _284.type]) !== "Identifier") {
4277
+ if (_optionalChain([decl, 'access', _312 => _312.id, 'optionalAccess', _313 => _313.type]) !== "Identifier") {
3562
4278
  invalidDecl = true;
3563
4279
  return;
3564
4280
  }
@@ -3731,7 +4447,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3731
4447
  }
3732
4448
  case "UnaryExpression": {
3733
4449
  if (node.operator === "void") {
3734
- if (_optionalChain([node, 'access', _285 => _285.argument, 'optionalAccess', _286 => _286.type]) !== "Literal" || node.argument.regex) return false;
4450
+ if (_optionalChain([node, 'access', _314 => _314.argument, 'optionalAccess', _315 => _315.type]) !== "Literal" || node.argument.regex) return false;
3735
4451
  const undefIdx2 = addConst(void 0);
3736
4452
  emit(OP_LDC, undefIdx2);
3737
4453
  return true;
@@ -3770,7 +4486,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3770
4486
  if (node.computed) {
3771
4487
  if (!compileExpr(node.property, true)) return false;
3772
4488
  } else {
3773
- if (_optionalChain([node, 'access', _287 => _287.property, 'optionalAccess', _288 => _288.type]) !== "Identifier") return false;
4489
+ if (_optionalChain([node, 'access', _316 => _316.property, 'optionalAccess', _317 => _317.type]) !== "Identifier") return false;
3774
4490
  const idx = addConst(node.property.name);
3775
4491
  emit(OP_LDC, idx);
3776
4492
  }
@@ -3785,7 +4501,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3785
4501
  if (node.callee.computed) {
3786
4502
  if (!compileExpr(node.callee.property, true)) return false;
3787
4503
  } else {
3788
- if (_optionalChain([node, 'access', _289 => _289.callee, 'access', _290 => _290.property, 'optionalAccess', _291 => _291.type]) !== "Identifier") return false;
4504
+ if (_optionalChain([node, 'access', _318 => _318.callee, 'access', _319 => _319.property, 'optionalAccess', _320 => _320.type]) !== "Identifier") return false;
3789
4505
  const idx = addConst(node.callee.property.name);
3790
4506
  emit(OP_LDC, idx);
3791
4507
  }
@@ -3848,7 +4564,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3848
4564
  if (node.left.computed) {
3849
4565
  if (!compileExpr(node.left.property, true)) return false;
3850
4566
  } else {
3851
- if (_optionalChain([node, 'access', _292 => _292.left, 'access', _293 => _293.property, 'optionalAccess', _294 => _294.type]) !== "Identifier") return false;
4567
+ if (_optionalChain([node, 'access', _321 => _321.left, 'access', _322 => _322.property, 'optionalAccess', _323 => _323.type]) !== "Identifier") return false;
3852
4568
  const idx = addConst(node.left.property.name);
3853
4569
  emit(OP_LDC, idx);
3854
4570
  }
@@ -3859,7 +4575,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3859
4575
  return false;
3860
4576
  }
3861
4577
  case "UpdateExpression": {
3862
- if (_optionalChain([node, 'access', _295 => _295.argument, 'optionalAccess', _296 => _296.type]) !== "Identifier") return false;
4578
+ if (_optionalChain([node, 'access', _324 => _324.argument, 'optionalAccess', _325 => _325.type]) !== "Identifier") return false;
3863
4579
  const name = node.argument.name;
3864
4580
  if (!canWriteVar(name)) return false;
3865
4581
  const oneIdx = addConst(1);
@@ -3895,7 +4611,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3895
4611
  if (prop.computed) {
3896
4612
  if (!compileExpr(prop.key, true)) return false;
3897
4613
  } else {
3898
- const keyName = _nullishCoalesce(_optionalChain([prop, 'access', _297 => _297.key, 'optionalAccess', _298 => _298.name]), () => ( _optionalChain([prop, 'access', _299 => _299.key, 'optionalAccess', _300 => _300.value])));
4614
+ const keyName = _nullishCoalesce(_optionalChain([prop, 'access', _326 => _326.key, 'optionalAccess', _327 => _327.name]), () => ( _optionalChain([prop, 'access', _328 => _328.key, 'optionalAccess', _329 => _329.value])));
3899
4615
  if (keyName === void 0) return false;
3900
4616
  const idx = addConst(keyName);
3901
4617
  emit(OP_LDC, idx);
@@ -3940,7 +4656,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3940
4656
  }
3941
4657
  case "VariableDeclaration": {
3942
4658
  for (const decl of stmt.declarations) {
3943
- if (_optionalChain([decl, 'access', _301 => _301.id, 'optionalAccess', _302 => _302.type]) !== "Identifier") return false;
4659
+ if (_optionalChain([decl, 'access', _330 => _330.id, 'optionalAccess', _331 => _331.type]) !== "Identifier") return false;
3944
4660
  const slot = resolveLocal(decl.id.name);
3945
4661
  if (slot === void 0) return false;
3946
4662
  if (decl.init) {
@@ -3975,7 +4691,7 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
3975
4691
  for (const s of stmt.body || []) {
3976
4692
  if (s.type === "VariableDeclaration" && s.kind !== "var") {
3977
4693
  for (const decl of s.declarations || []) {
3978
- if (_optionalChain([decl, 'access', _303 => _303.id, 'optionalAccess', _304 => _304.type]) !== "Identifier") return false;
4694
+ if (_optionalChain([decl, 'access', _332 => _332.id, 'optionalAccess', _333 => _333.type]) !== "Identifier") return false;
3979
4695
  if (!blockScope.has(decl.id.name)) {
3980
4696
  blockScope.set(decl.id.name, localCount++);
3981
4697
  }
@@ -4014,12 +4730,12 @@ function compileFunctionToBytecode(fnNode, opMap, enclosingBindings) {
4014
4730
  function findInjectedVmHelperName(ast) {
4015
4731
  if (!ast || !Array.isArray(ast.body)) return null;
4016
4732
  for (const stmt of ast.body) {
4017
- if (stmt.type === "FunctionDeclaration" && typeof _optionalChain([stmt, 'access', _305 => _305.id, 'optionalAccess', _306 => _306.name]) === "string" && stmt.id.name.startsWith("_uVm")) {
4733
+ if (stmt.type === "FunctionDeclaration" && typeof _optionalChain([stmt, 'access', _334 => _334.id, 'optionalAccess', _335 => _335.name]) === "string" && stmt.id.name.startsWith("_uVm")) {
4018
4734
  return stmt.id.name;
4019
4735
  }
4020
4736
  if (stmt.type === "VariableDeclaration" && Array.isArray(stmt.declarations)) {
4021
4737
  for (const d of stmt.declarations) {
4022
- if (_optionalChain([d, 'access', _307 => _307.id, 'optionalAccess', _308 => _308.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_uVm")) {
4738
+ if (_optionalChain([d, 'access', _336 => _336.id, 'optionalAccess', _337 => _337.type]) === "Identifier" && typeof d.id.name === "string" && d.id.name.startsWith("_uVm")) {
4023
4739
  return d.id.name;
4024
4740
  }
4025
4741
  }
@@ -4028,7 +4744,7 @@ function findInjectedVmHelperName(ast) {
4028
4744
  return null;
4029
4745
  }
4030
4746
  function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 2654435769, windowKeySymbol, expectedDelta) {
4031
- const suffix = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, `micro-vm:${seed}`, seed).toString(36);
4747
+ const suffix = computeFnv1aHash(`micro-vm:${seed}`, seed).toString(36);
4032
4748
  const vmHelperName = `_uVm${suffix}`;
4033
4749
  const existingName = findInjectedVmHelperName(ast);
4034
4750
  if (existingName) {
@@ -4066,10 +4782,10 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4066
4782
  return ast;
4067
4783
  }
4068
4784
  const candidates = [];
4069
- walk6.ancestor(ast, {
4785
+ walk7.ancestor(ast, {
4070
4786
  ImportDeclaration(node) {
4071
4787
  for (const spec of node.specifiers || []) {
4072
- if (_optionalChain([spec, 'access', _309 => _309.local, 'optionalAccess', _310 => _310.type]) === "Identifier") {
4788
+ if (_optionalChain([spec, 'access', _338 => _338.local, 'optionalAccess', _339 => _339.type]) === "Identifier") {
4073
4789
  addScopeBinding(ast, spec.local.name);
4074
4790
  }
4075
4791
  }
@@ -4086,7 +4802,7 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4086
4802
  },
4087
4803
  FunctionDeclaration(node, _state, ancestors) {
4088
4804
  const parentAncestors = ancestors.slice(0, -1);
4089
- if (_optionalChain([node, 'access', _311 => _311.id, 'optionalAccess', _312 => _312.type]) === "Identifier") {
4805
+ if (_optionalChain([node, 'access', _340 => _340.id, 'optionalAccess', _341 => _341.type]) === "Identifier") {
4090
4806
  addScopeBinding(findNearestLexicalScope(parentAncestors), node.id.name);
4091
4807
  addScopeBinding(findNearestFunctionOrProgram(parentAncestors), node.id.name);
4092
4808
  }
@@ -4100,7 +4816,7 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4100
4816
  candidates.push({ fn: node, ancestors: ancestors.slice() });
4101
4817
  },
4102
4818
  FunctionExpression(node, _state, ancestors) {
4103
- if (_optionalChain([node, 'access', _313 => _313.id, 'optionalAccess', _314 => _314.type]) === "Identifier") {
4819
+ if (_optionalChain([node, 'access', _342 => _342.id, 'optionalAccess', _343 => _343.type]) === "Identifier") {
4104
4820
  addScopeBinding(node, node.id.name);
4105
4821
  }
4106
4822
  const paramNames = /* @__PURE__ */ new Set();
@@ -4123,13 +4839,13 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4123
4839
  candidates.push({ fn: node, ancestors: ancestors.slice() });
4124
4840
  },
4125
4841
  ClassDeclaration(node, _state, ancestors) {
4126
- if (_optionalChain([node, 'access', _315 => _315.id, 'optionalAccess', _316 => _316.type]) === "Identifier") {
4842
+ if (_optionalChain([node, 'access', _344 => _344.id, 'optionalAccess', _345 => _345.type]) === "Identifier") {
4127
4843
  addScopeBinding(findNearestLexicalScope(ancestors.slice(0, -1)), node.id.name);
4128
4844
  addScopeBinding(node, node.id.name);
4129
4845
  }
4130
4846
  },
4131
4847
  ClassExpression(node) {
4132
- if (_optionalChain([node, 'access', _317 => _317.id, 'optionalAccess', _318 => _318.type]) === "Identifier") {
4848
+ if (_optionalChain([node, 'access', _346 => _346.id, 'optionalAccess', _347 => _347.type]) === "Identifier") {
4133
4849
  addScopeBinding(node, node.id.name);
4134
4850
  }
4135
4851
  },
@@ -4156,7 +4872,7 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4156
4872
  continue;
4157
4873
  }
4158
4874
  const parentNode = ancestors.length >= 2 ? ancestors[ancestors.length - 2] : null;
4159
- if (_optionalChain([parentNode, 'optionalAccess', _319 => _319.type]) === "MethodDefinition" && parentNode.kind === "constructor") {
4875
+ if (_optionalChain([parentNode, 'optionalAccess', _348 => _348.type]) === "MethodDefinition" && parentNode.kind === "constructor") {
4160
4876
  continue;
4161
4877
  }
4162
4878
  if (ancestors.some((a) => a.type === "WithStatement")) {
@@ -4178,14 +4894,14 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4178
4894
  }
4179
4895
  }
4180
4896
  }
4181
- if (fn.type === "FunctionExpression" && _optionalChain([fn, 'access', _320 => _320.id, 'optionalAccess', _321 => _321.type]) === "Identifier") {
4897
+ if (fn.type === "FunctionExpression" && _optionalChain([fn, 'access', _349 => _349.id, 'optionalAccess', _350 => _350.type]) === "Identifier") {
4182
4898
  enclosingBindings.add(fn.id.name);
4183
4899
  }
4184
4900
  const compiled = compileFunctionToBytecode(fn, opMap, enclosingBindings);
4185
4901
  if (!compiled) {
4186
4902
  continue;
4187
4903
  }
4188
- const fnSalt = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, `vm-fn:${virtualizedCount}`, seed) >>> 0;
4904
+ const fnSalt = computeFnv1aHash(`vm-fn:${virtualizedCount}`, seed) >>> 0;
4189
4905
  const encBytecode = encryptBytecodeStream(
4190
4906
  compiled.bytecode,
4191
4907
  fnSalt,
@@ -4321,7 +5037,7 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4321
5037
  let insertIdx = 0;
4322
5038
  while (insertIdx < ast.body.length) {
4323
5039
  const stmt = ast.body[insertIdx];
4324
- const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _322 => _322.expression, 'optionalAccess', _323 => _323.type]) === "Literal" && typeof stmt.expression.value === "string" && /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim()));
5040
+ const isDirective = stmt.type === "ExpressionStatement" && (Boolean(stmt.directive) || _optionalChain([stmt, 'access', _351 => _351.expression, 'optionalAccess', _352 => _352.type]) === "Literal" && typeof stmt.expression.value === "string" && /^(?:use\s+[a-zA-Z0-9_-]+)/.test(stmt.expression.value.trim()));
4325
5041
  if (isDirective || stmt.type === "ImportDeclaration") {
4326
5042
  insertIdx++;
4327
5043
  } else {
@@ -4336,24 +5052,121 @@ function applyMicroVm(ast, coldFunctionNodes, serializedFunctionNodes, seed = 26
4336
5052
  };
4337
5053
  }
4338
5054
 
5055
+ // src/ast/scrubber.ts
5056
+
5057
+ var FILE_URI_USER_RE = /file:\/\/\/(?:[A-Za-z]:\/)?(?:Users|home)\/[^/\s"'`]+\/([^\s"'`]+)/gi;
5058
+ var FILE_URI_LOCAL_RE = /file:\/\/\/(?:[A-Za-z]:\/)?([^\s"'`]+)/gi;
5059
+ var POSIX_USER_PATH_RE = /\/?(?:Users|home)\/[^/\s"'`]+\/([^\s"'`]+)/g;
5060
+ var WIN_USER_PATH_RE = /[A-Za-z]:\\{1,2}Users\\{1,2}[^\\\s"'`]+\\{1,2}([^\s"'`]+)/g;
5061
+ var PROTECTED_URL_OR_ASSET_RE = /(?:https?:\/\/[^\s"'`]+|(?:\/assets\/|\/_next\/static\/)[^\s"'`]*)/gi;
5062
+ function escapeTemplateRaw(str) {
5063
+ return str.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
5064
+ }
5065
+ function scrubStringValue(val, rootDir) {
5066
+ if (!val.includes("/") && !val.includes("\\") && !val.includes("file:")) {
5067
+ return val;
5068
+ }
5069
+ const shielded = [];
5070
+ let out = val.replace(PROTECTED_URL_OR_ASSET_RE, (match) => {
5071
+ const token = `\0_UP_SHIELD_${shielded.length}_\0`;
5072
+ shielded.push(match);
5073
+ return token;
5074
+ });
5075
+ out = out.replace(FILE_URI_USER_RE, (_m, tail) => `[src]/${tail}`);
5076
+ out = out.replace(FILE_URI_LOCAL_RE, (_m, tail) => `[src]/${tail}`);
5077
+ out = out.replace(POSIX_USER_PATH_RE, (_m, tail) => `[src]/${tail}`);
5078
+ out = out.replace(
5079
+ WIN_USER_PATH_RE,
5080
+ (_m, tail) => `[src]/${tail.replace(/\\+/g, "/")}`
5081
+ );
5082
+ if (rootDir && rootDir.length > 1) {
5083
+ const normalizedRoot = rootDir.replace(/\\/g, "/").replace(/\/+$/, "");
5084
+ if (normalizedRoot.length > 1) {
5085
+ if (out.includes(normalizedRoot + "/")) {
5086
+ out = out.split(normalizedRoot + "/").join("[src]/");
5087
+ }
5088
+ const winRoot = normalizedRoot.replace(/\//g, "\\");
5089
+ if (out.includes(winRoot + "\\")) {
5090
+ out = out.split(winRoot + "\\").join("[src]/");
5091
+ }
5092
+ }
5093
+ }
5094
+ if (shielded.length > 0) {
5095
+ out = out.replace(
5096
+ /\u0000_UP_SHIELD_(\d+)_\u0000/g,
5097
+ (_m, idxStr) => _nullishCoalesce(shielded[Number(idxStr)], () => ( ""))
5098
+ );
5099
+ }
5100
+ return out;
5101
+ }
5102
+ function scrubResidualPaths(ast, options = {}, hotExemptNodes, exemptSubtreeRoots) {
5103
+ const exemptSet = options.exemptStrings ? new Set(options.exemptStrings) : void 0;
5104
+ let scrubbedCount = 0;
5105
+ walk8.ancestor(ast, {
5106
+ Literal(node, _state, ancestors) {
5107
+ if (node.regex || typeof node.value !== "string") return;
5108
+ const val = node.value;
5109
+ if (_optionalChain([exemptSet, 'optionalAccess', _353 => _353.has, 'call', _354 => _354(val)])) return;
5110
+ const parent = ancestors[ancestors.length - 2];
5111
+ if (!parent) return;
5112
+ if ((parent.type === "ImportDeclaration" || parent.type === "ExportNamedDeclaration" || parent.type === "ExportAllDeclaration" || parent.type === "ImportExpression") && parent.source === node) {
5113
+ return;
5114
+ }
5115
+ if (parent.type === "ExpressionStatement" && Boolean(parent.directive)) {
5116
+ return;
5117
+ }
5118
+ if (isNodeInExemptSubtree(ancestors, hotExemptNodes) || isNodeInExemptSubtree(ancestors, exemptSubtreeRoots)) {
5119
+ return;
5120
+ }
5121
+ const scrubbed = scrubStringValue(val, options.rootDir);
5122
+ if (scrubbed !== val) {
5123
+ node.value = scrubbed;
5124
+ node.raw = JSON.stringify(scrubbed);
5125
+ scrubbedCount++;
5126
+ }
5127
+ },
5128
+ TemplateLiteral(node, _state, ancestors) {
5129
+ if (!Array.isArray(node.quasis)) return;
5130
+ if (isNodeInExemptSubtree(ancestors, hotExemptNodes) || isNodeInExemptSubtree(ancestors, exemptSubtreeRoots)) {
5131
+ return;
5132
+ }
5133
+ const parent = ancestors[ancestors.length - 2];
5134
+ if (_optionalChain([parent, 'optionalAccess', _355 => _355.type]) === "ImportExpression" && parent.source === node) {
5135
+ return;
5136
+ }
5137
+ for (const quasi of node.quasis) {
5138
+ const val = _nullishCoalesce(_optionalChain([quasi, 'optionalAccess', _356 => _356.value, 'optionalAccess', _357 => _357.cooked]), () => ( _optionalChain([quasi, 'optionalAccess', _358 => _358.value, 'optionalAccess', _359 => _359.raw])));
5139
+ if (typeof val !== "string" || _optionalChain([exemptSet, 'optionalAccess', _360 => _360.has, 'call', _361 => _361(val)])) continue;
5140
+ const scrubbed = scrubStringValue(val, options.rootDir);
5141
+ if (scrubbed !== val) {
5142
+ quasi.value.cooked = scrubbed;
5143
+ quasi.value.raw = escapeTemplateRaw(scrubbed);
5144
+ scrubbedCount++;
5145
+ }
5146
+ }
5147
+ }
5148
+ });
5149
+ return scrubbedCount;
5150
+ }
5151
+
4339
5152
  // src/ast/index.ts
4340
5153
  function isAstAlreadyProtected(ast) {
4341
5154
  if (!ast || !Array.isArray(ast.body)) return false;
4342
5155
  return ast.body.some((stmt) => {
4343
5156
  if (stmt.type === "VariableDeclaration" && Array.isArray(stmt.declarations)) {
4344
5157
  for (const d of stmt.declarations) {
4345
- const name = _optionalChain([d, 'access', _324 => _324.id, 'optionalAccess', _325 => _325.type]) === "Identifier" ? d.id.name : void 0;
5158
+ const name = _optionalChain([d, 'access', _362 => _362.id, 'optionalAccess', _363 => _363.type]) === "Identifier" ? d.id.name : void 0;
4346
5159
  if (typeof name === "string") {
4347
- if (name === "_d" || name.startsWith("_uC") || name.startsWith("_uD") || name.startsWith("_uS") || name.startsWith("_uVm") || name.startsWith("_wKdf") || name.startsWith("_m") || name.startsWith("_w") || name.startsWith("_k") || name.startsWith("_a") && _optionalChain([d, 'access', _326 => _326.init, 'optionalAccess', _327 => _327.type]) === "CallExpression" && _optionalChain([d, 'access', _328 => _328.init, 'access', _329 => _329.callee, 'optionalAccess', _330 => _330.type]) === "FunctionExpression" && _optionalChain([d, 'access', _331 => _331.init, 'access', _332 => _332.callee, 'optionalAccess', _333 => _333.id, 'optionalAccess', _334 => _334.name]) === "f") {
5160
+ if (name === "_d" || name.startsWith("_uC") || name.startsWith("_uD") || name.startsWith("_uS") || name.startsWith("_uVm") || name.startsWith("_wKdf") || name.startsWith("_m") || name.startsWith("_w") || name.startsWith("_k") || name.startsWith("_a") && _optionalChain([d, 'access', _364 => _364.init, 'optionalAccess', _365 => _365.type]) === "CallExpression" && _optionalChain([d, 'access', _366 => _366.init, 'access', _367 => _367.callee, 'optionalAccess', _368 => _368.type]) === "FunctionExpression" && _optionalChain([d, 'access', _369 => _369.init, 'access', _370 => _370.callee, 'optionalAccess', _371 => _371.id, 'optionalAccess', _372 => _372.name]) === "f") {
4348
5161
  return true;
4349
5162
  }
4350
5163
  }
4351
5164
  }
4352
5165
  }
4353
- if (stmt.type === "ExpressionStatement" && _optionalChain([stmt, 'access', _335 => _335.expression, 'optionalAccess', _336 => _336.type]) === "CallExpression") {
5166
+ if (stmt.type === "ExpressionStatement" && _optionalChain([stmt, 'access', _373 => _373.expression, 'optionalAccess', _374 => _374.type]) === "CallExpression") {
4354
5167
  const callee = stmt.expression.callee;
4355
- if (_optionalChain([callee, 'optionalAccess', _337 => _337.type]) === "FunctionExpression") {
4356
- const name = _optionalChain([callee, 'access', _338 => _338.id, 'optionalAccess', _339 => _339.name]);
5168
+ if (_optionalChain([callee, 'optionalAccess', _375 => _375.type]) === "FunctionExpression") {
5169
+ const name = _optionalChain([callee, 'access', _376 => _376.id, 'optionalAccess', _377 => _377.name]);
4357
5170
  if (typeof name === "string" && (name.startsWith("_u$") || name.startsWith("_$") || name.startsWith("_s") || name.startsWith("$b"))) {
4358
5171
  return true;
4359
5172
  }
@@ -4365,7 +5178,7 @@ function isAstAlreadyProtected(ast) {
4365
5178
  function transformJavaScript(code, options = {}) {
4366
5179
  const internalOptions = options;
4367
5180
  const seed = _nullishCoalesce(internalOptions.seed, () => ( 2654435769));
4368
- const minStringLength = _nullishCoalesce(_nullishCoalesce(options.minStringLength, () => ( _optionalChain([options, 'access', _340 => _340.config, 'optionalAccess', _341 => _341.vault, 'optionalAccess', _342 => _342.minStringLength]))), () => ( 4));
5181
+ const minStringLength = _nullishCoalesce(_nullishCoalesce(options.minStringLength, () => ( _optionalChain([options, 'access', _378 => _378.config, 'optionalAccess', _379 => _379.vault, 'optionalAccess', _380 => _380.minStringLength]))), () => ( 4));
4369
5182
  const isAggressive = _nullishCoalesce(options.aggressive, () => ( false));
4370
5183
  if (!code || !code.trim()) {
4371
5184
  const emptyResult = {
@@ -4377,17 +5190,19 @@ function transformJavaScript(code, options = {}) {
4377
5190
  hotFunctionsSkipped: [],
4378
5191
  coldFunctionsProtected: []
4379
5192
  },
4380
- integrityToken: _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, "", seed),
5193
+ integrityToken: computeFnv1aHash("", seed),
4381
5194
  virtualizedFunctionsCount: 0,
4382
- shaderBuffersCount: 0
5195
+ shaderBuffersCount: 0,
5196
+ skippedReason: "empty"
4383
5197
  };
4384
5198
  return emptyResult;
4385
5199
  }
4386
- const ast = parseJavaScriptAst(code);
5200
+ const comments = [];
5201
+ const ast = parseJavaScriptAst(code, comments);
4387
5202
  if (!ast) {
4388
5203
  if (options.strict) {
4389
5204
  const targetLabel = options.filename ? ` "${options.filename}"` : "";
4390
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
5205
+ throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
4391
5206
  "ERR_PARSE_FAILED",
4392
5207
  `Failed to parse JavaScript${targetLabel}.`
4393
5208
  );
@@ -4401,9 +5216,10 @@ function transformJavaScript(code, options = {}) {
4401
5216
  hotFunctionsSkipped: [],
4402
5217
  coldFunctionsProtected: []
4403
5218
  },
4404
- integrityToken: _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, code, seed),
5219
+ integrityToken: computeFnv1aHash(code, seed),
4405
5220
  virtualizedFunctionsCount: 0,
4406
- shaderBuffersCount: 0
5221
+ shaderBuffersCount: 0,
5222
+ skippedReason: "parse-error"
4407
5223
  };
4408
5224
  return unparsedResult;
4409
5225
  }
@@ -4417,12 +5233,15 @@ function transformJavaScript(code, options = {}) {
4417
5233
  hotFunctionsSkipped: [],
4418
5234
  coldFunctionsProtected: []
4419
5235
  },
4420
- integrityToken: _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, code, seed),
5236
+ integrityToken: computeFnv1aHash(code, seed),
4421
5237
  virtualizedFunctionsCount: 0,
4422
- shaderBuffersCount: 0
5238
+ shaderBuffersCount: 0,
5239
+ skippedReason: "already-protected"
4423
5240
  };
4424
5241
  return protectedResult;
4425
5242
  }
5243
+ const boundary = classifyChunkBoundary(ast);
5244
+ attachMagicComments(boundary.importExpressions, comments);
4426
5245
  const {
4427
5246
  report: hotPathReport,
4428
5247
  coldFunctionNodes,
@@ -4430,13 +5249,21 @@ function transformJavaScript(code, options = {}) {
4430
5249
  hotExemptNodes,
4431
5250
  serializedFunctionNodes
4432
5251
  } = analyzeAstHotPaths(ast, options.config);
5252
+ if (options.scrubPaths || _optionalChain([options, 'access', _381 => _381.config, 'optionalAccess', _382 => _382.scrubPaths])) {
5253
+ scrubResidualPaths(
5254
+ ast,
5255
+ { scrubPaths: true },
5256
+ hotExemptNodes,
5257
+ boundary.exemptSubtreeRoots
5258
+ );
5259
+ }
4433
5260
  const shieldCoupled = _nullishCoalesce(internalOptions.shieldCoupled, () => ( Boolean(internalOptions.injectRuntimeShield)));
4434
- const deterrentMode = _nullishCoalesce(_nullishCoalesce(internalOptions.deterrentMode, () => ( _optionalChain([internalOptions, 'access', _343 => _343.config, 'optionalAccess', _344 => _344.shield, 'optionalAccess', _345 => _345.deterrentMode]))), () => ( "passive"));
4435
- const detectHeadless = _nullishCoalesce(_nullishCoalesce(internalOptions.detectHeadless, () => ( _optionalChain([internalOptions, 'access', _346 => _346.config, 'optionalAccess', _347 => _347.shield, 'optionalAccess', _348 => _348.detectHeadless]))), () => ( false));
4436
- const sym = shieldCoupled ? _nullishCoalesce(internalOptions.windowKeySymbol, () => ( _chunk6N6S6WTQcjs.deriveWindowKeySymbol.call(void 0, seed))) : void 0;
5261
+ const deterrentMode = _nullishCoalesce(_nullishCoalesce(internalOptions.deterrentMode, () => ( _optionalChain([internalOptions, 'access', _383 => _383.config, 'optionalAccess', _384 => _384.shield, 'optionalAccess', _385 => _385.deterrentMode]))), () => ( "passive"));
5262
+ const detectHeadless = _nullishCoalesce(_nullishCoalesce(internalOptions.detectHeadless, () => ( _optionalChain([internalOptions, 'access', _386 => _386.config, 'optionalAccess', _387 => _387.shield, 'optionalAccess', _388 => _388.detectHeadless]))), () => ( false));
5263
+ const sym = shieldCoupled ? _nullishCoalesce(internalOptions.windowKeySymbol, () => ( deriveWindowKeySymbol(seed))) : void 0;
4437
5264
  let shieldDelta = shieldCoupled ? internalOptions.expectedDelta : void 0;
4438
5265
  if (shieldCoupled && shieldDelta === void 0) {
4439
- const shieldInfo = _chunk6N6S6WTQcjs.generateRuntimeShield.call(void 0, {
5266
+ const shieldInfo = generateRuntimeShield({
4440
5267
  seed,
4441
5268
  windowKeySymbol: sym,
4442
5269
  deterrentMode,
@@ -4477,7 +5304,8 @@ function transformJavaScript(code, options = {}) {
4477
5304
  shieldDelta,
4478
5305
  deterrentMode,
4479
5306
  shieldCoupled,
4480
- detectHeadless
5307
+ detectHeadless,
5308
+ boundary.exemptSubtreeRoots
4481
5309
  );
4482
5310
  encryptedStringsCount = saltedRes.encryptedStringsCount;
4483
5311
  integrityToken = saltedRes.integrityToken;
@@ -4492,16 +5320,17 @@ function transformJavaScript(code, options = {}) {
4492
5320
  deterrentMode,
4493
5321
  options.config,
4494
5322
  shieldCoupled,
4495
- detectHeadless
5323
+ detectHeadless,
5324
+ boundary.exemptSubtreeRoots
4496
5325
  );
4497
5326
  encryptedStringsCount = vaultRes.encryptedStringsCount;
4498
5327
  integrityToken = vaultRes.integrityToken;
4499
5328
  shaderBuffersCount = _nullishCoalesce(vaultRes.shaderBuffersCount, () => ( 0));
4500
5329
  }
4501
- const outputCode = _chunk6N6S6WTQcjs.generateCompactJs.call(void 0, ast);
5330
+ const outputCode = generateCompactJs(ast);
4502
5331
  let finalCode = outputCode;
4503
5332
  if (internalOptions.injectRuntimeShield && !internalOptions.skipShieldPreamble) {
4504
- const shield = _chunk6N6S6WTQcjs.generateRuntimeShield.call(void 0, {
5333
+ const shield = generateRuntimeShield({
4505
5334
  seed,
4506
5335
  windowKeySymbol: sym,
4507
5336
  expectedDelta: shieldDelta,
@@ -4529,4 +5358,10 @@ ${finalCode}`;
4529
5358
 
4530
5359
 
4531
5360
 
4532
- exports.detectHotPaths = detectHotPaths; exports.transformJavaScript = transformJavaScript;
5361
+
5362
+
5363
+
5364
+
5365
+
5366
+
5367
+ exports.computeFnv1aHash = computeFnv1aHash; exports.detectHotPaths = detectHotPaths; exports.computeIntegrityHash = computeIntegrityHash; exports.verifyCodeIntegrity = verifyCodeIntegrity; exports.deriveWindowKeySymbol = deriveWindowKeySymbol; exports.createDeterrentSnippet = createDeterrentSnippet; exports.generateRuntimeShield = generateRuntimeShield; exports.transformJavaScript = transformJavaScript;