babel-plugin-react-compiler 19.0.0-beta-201e55d-20241215 → 19.0.0-beta-b2e8e9c-20241220

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 (2) hide show
  1. package/dist/index.js +1124 -2025
  2. package/package.json +1 -3
package/dist/index.js CHANGED
@@ -12895,13 +12895,13 @@ function requireAncestry$1() {
12895
12895
  var inference$1 = {};
12896
12896
  var inferers$1 = {};
12897
12897
  var infererReference$1 = {};
12898
- var util$7 = {};
12898
+ var util$6 = {};
12899
12899
  var hasRequiredUtil$1;
12900
12900
  function requireUtil$1() {
12901
- if (hasRequiredUtil$1) return util$7;
12901
+ if (hasRequiredUtil$1) return util$6;
12902
12902
  hasRequiredUtil$1 = 1;
12903
- Object.defineProperty(util$7, '__esModule', {value: true});
12904
- util$7.createUnionType = createUnionType;
12903
+ Object.defineProperty(util$6, '__esModule', {value: true});
12904
+ util$6.createUnionType = createUnionType;
12905
12905
  var _t = t$d;
12906
12906
  const {
12907
12907
  createFlowUnionType: createFlowUnionType,
@@ -12924,7 +12924,7 @@ function requireUtil$1() {
12924
12924
  }
12925
12925
  }
12926
12926
  }
12927
- return util$7;
12927
+ return util$6;
12928
12928
  }
12929
12929
  var hasRequiredInfererReference$1;
12930
12930
  function requireInfererReference$1() {
@@ -50740,7 +50740,7 @@ function requireLib$g() {
50740
50740
  })(lib$d);
50741
50741
  return lib$d;
50742
50742
  }
50743
- var chalk$2 = {exports: {}};
50743
+ var chalk$1 = {exports: {}};
50744
50744
  var escapeStringRegexp$1;
50745
50745
  var hasRequiredEscapeStringRegexp$1;
50746
50746
  function requireEscapeStringRegexp$1() {
@@ -50755,14 +50755,14 @@ function requireEscapeStringRegexp$1() {
50755
50755
  };
50756
50756
  return escapeStringRegexp$1;
50757
50757
  }
50758
- var ansiStyles$3 = {exports: {}};
50759
- var conversions$4 = {exports: {}};
50760
- var colorName$2;
50761
- var hasRequiredColorName$1;
50762
- function requireColorName$1() {
50763
- if (hasRequiredColorName$1) return colorName$2;
50764
- hasRequiredColorName$1 = 1;
50765
- colorName$2 = {
50758
+ var ansiStyles$1 = {exports: {}};
50759
+ var conversions$3 = {exports: {}};
50760
+ var colorName$1;
50761
+ var hasRequiredColorName;
50762
+ function requireColorName() {
50763
+ if (hasRequiredColorName) return colorName$1;
50764
+ hasRequiredColorName = 1;
50765
+ colorName$1 = {
50766
50766
  aliceblue: [240, 248, 255],
50767
50767
  antiquewhite: [250, 235, 215],
50768
50768
  aqua: [0, 255, 255],
@@ -50912,20 +50912,20 @@ function requireColorName$1() {
50912
50912
  yellow: [255, 255, 0],
50913
50913
  yellowgreen: [154, 205, 50],
50914
50914
  };
50915
- return colorName$2;
50915
+ return colorName$1;
50916
50916
  }
50917
- var hasRequiredConversions$1;
50918
- function requireConversions$1() {
50919
- if (hasRequiredConversions$1) return conversions$4.exports;
50920
- hasRequiredConversions$1 = 1;
50921
- var cssKeywords = requireColorName$1();
50917
+ var hasRequiredConversions;
50918
+ function requireConversions() {
50919
+ if (hasRequiredConversions) return conversions$3.exports;
50920
+ hasRequiredConversions = 1;
50921
+ var cssKeywords = requireColorName();
50922
50922
  var reverseKeywords = {};
50923
50923
  for (var key in cssKeywords) {
50924
50924
  if (cssKeywords.hasOwnProperty(key)) {
50925
50925
  reverseKeywords[cssKeywords[key]] = key;
50926
50926
  }
50927
50927
  }
50928
- var convert = (conversions$4.exports = {
50928
+ var convert = (conversions$3.exports = {
50929
50929
  rgb: {channels: 3, labels: 'rgb'},
50930
50930
  hsl: {channels: 3, labels: 'hsl'},
50931
50931
  hsv: {channels: 3, labels: 'hsv'},
@@ -51647,14 +51647,14 @@ function requireConversions$1() {
51647
51647
  var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
51648
51648
  return [(val / 255) * 100];
51649
51649
  };
51650
- return conversions$4.exports;
51651
- }
51652
- var route$3;
51653
- var hasRequiredRoute$1;
51654
- function requireRoute$1() {
51655
- if (hasRequiredRoute$1) return route$3;
51656
- hasRequiredRoute$1 = 1;
51657
- var conversions = requireConversions$1();
51650
+ return conversions$3.exports;
51651
+ }
51652
+ var route$2;
51653
+ var hasRequiredRoute;
51654
+ function requireRoute() {
51655
+ if (hasRequiredRoute) return route$2;
51656
+ hasRequiredRoute = 1;
51657
+ var conversions = requireConversions();
51658
51658
  function buildGraph() {
51659
51659
  var graph = {};
51660
51660
  var models = Object.keys(conversions);
@@ -51699,7 +51699,7 @@ function requireRoute$1() {
51699
51699
  fn.conversion = path;
51700
51700
  return fn;
51701
51701
  }
51702
- route$3 = function (fromModel) {
51702
+ route$2 = function (fromModel) {
51703
51703
  var graph = deriveBFS(fromModel);
51704
51704
  var conversion = {};
51705
51705
  var models = Object.keys(graph);
@@ -51713,15 +51713,15 @@ function requireRoute$1() {
51713
51713
  }
51714
51714
  return conversion;
51715
51715
  };
51716
- return route$3;
51717
- }
51718
- var colorConvert$2;
51719
- var hasRequiredColorConvert$1;
51720
- function requireColorConvert$1() {
51721
- if (hasRequiredColorConvert$1) return colorConvert$2;
51722
- hasRequiredColorConvert$1 = 1;
51723
- var conversions = requireConversions$1();
51724
- var route = requireRoute$1();
51716
+ return route$2;
51717
+ }
51718
+ var colorConvert$1;
51719
+ var hasRequiredColorConvert;
51720
+ function requireColorConvert() {
51721
+ if (hasRequiredColorConvert) return colorConvert$1;
51722
+ hasRequiredColorConvert = 1;
51723
+ var conversions = requireConversions();
51724
+ var route = requireRoute();
51725
51725
  var convert = {};
51726
51726
  var models = Object.keys(conversions);
51727
51727
  function wrapRaw(fn) {
@@ -51776,16 +51776,16 @@ function requireColorConvert$1() {
51776
51776
  convert[fromModel][toModel].raw = wrapRaw(fn);
51777
51777
  });
51778
51778
  });
51779
- colorConvert$2 = convert;
51780
- return colorConvert$2;
51779
+ colorConvert$1 = convert;
51780
+ return colorConvert$1;
51781
51781
  }
51782
- ansiStyles$3.exports;
51782
+ ansiStyles$1.exports;
51783
51783
  var hasRequiredAnsiStyles;
51784
51784
  function requireAnsiStyles() {
51785
- if (hasRequiredAnsiStyles) return ansiStyles$3.exports;
51785
+ if (hasRequiredAnsiStyles) return ansiStyles$1.exports;
51786
51786
  hasRequiredAnsiStyles = 1;
51787
51787
  (function (module) {
51788
- const colorConvert = requireColorConvert$1();
51788
+ const colorConvert = requireColorConvert();
51789
51789
  const wrapAnsi16 = (fn, offset) =>
51790
51790
  function () {
51791
51791
  const code = fn.apply(colorConvert, arguments);
@@ -51906,27 +51906,27 @@ function requireAnsiStyles() {
51906
51906
  enumerable: true,
51907
51907
  get: assembleStyles,
51908
51908
  });
51909
- })(ansiStyles$3);
51910
- return ansiStyles$3.exports;
51909
+ })(ansiStyles$1);
51910
+ return ansiStyles$1.exports;
51911
51911
  }
51912
- var hasFlag$3;
51912
+ var hasFlag$1;
51913
51913
  var hasRequiredHasFlag$1;
51914
51914
  function requireHasFlag$1() {
51915
- if (hasRequiredHasFlag$1) return hasFlag$3;
51915
+ if (hasRequiredHasFlag$1) return hasFlag$1;
51916
51916
  hasRequiredHasFlag$1 = 1;
51917
- hasFlag$3 = (flag, argv) => {
51917
+ hasFlag$1 = (flag, argv) => {
51918
51918
  argv = argv || process.argv;
51919
51919
  const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
51920
51920
  const pos = argv.indexOf(prefix + flag);
51921
51921
  const terminatorPos = argv.indexOf('--');
51922
51922
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
51923
51923
  };
51924
- return hasFlag$3;
51924
+ return hasFlag$1;
51925
51925
  }
51926
- var supportsColor_1$2;
51926
+ var supportsColor_1$1;
51927
51927
  var hasRequiredSupportsColor$1;
51928
51928
  function requireSupportsColor$1() {
51929
- if (hasRequiredSupportsColor$1) return supportsColor_1$2;
51929
+ if (hasRequiredSupportsColor$1) return supportsColor_1$1;
51930
51930
  hasRequiredSupportsColor$1 = 1;
51931
51931
  const os = require$$0$3;
51932
51932
  const hasFlag = requireHasFlag$1();
@@ -52037,18 +52037,18 @@ function requireSupportsColor$1() {
52037
52037
  const level = supportsColor(stream);
52038
52038
  return translateLevel(level);
52039
52039
  }
52040
- supportsColor_1$2 = {
52040
+ supportsColor_1$1 = {
52041
52041
  supportsColor: getSupportLevel,
52042
52042
  stdout: getSupportLevel(process.stdout),
52043
52043
  stderr: getSupportLevel(process.stderr),
52044
52044
  };
52045
- return supportsColor_1$2;
52045
+ return supportsColor_1$1;
52046
52046
  }
52047
- var templates$2;
52048
- var hasRequiredTemplates$2;
52049
- function requireTemplates$2() {
52050
- if (hasRequiredTemplates$2) return templates$2;
52051
- hasRequiredTemplates$2 = 1;
52047
+ var templates$1;
52048
+ var hasRequiredTemplates$1;
52049
+ function requireTemplates$1() {
52050
+ if (hasRequiredTemplates$1) return templates$1;
52051
+ hasRequiredTemplates$1 = 1;
52052
52052
  const TEMPLATE_REGEX =
52053
52053
  /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
52054
52054
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
@@ -52130,7 +52130,7 @@ function requireTemplates$2() {
52130
52130
  }
52131
52131
  return current;
52132
52132
  }
52133
- templates$2 = (chalk, tmp) => {
52133
+ templates$1 = (chalk, tmp) => {
52134
52134
  const styles = [];
52135
52135
  const chunks = [];
52136
52136
  let chunk = [];
@@ -52160,17 +52160,17 @@ function requireTemplates$2() {
52160
52160
  }
52161
52161
  return chunks.join('');
52162
52162
  };
52163
- return templates$2;
52163
+ return templates$1;
52164
52164
  }
52165
52165
  var hasRequiredChalk$1;
52166
52166
  function requireChalk$1() {
52167
- if (hasRequiredChalk$1) return chalk$2.exports;
52167
+ if (hasRequiredChalk$1) return chalk$1.exports;
52168
52168
  hasRequiredChalk$1 = 1;
52169
52169
  (function (module) {
52170
52170
  const escapeStringRegexp = requireEscapeStringRegexp$1();
52171
52171
  const ansiStyles = requireAnsiStyles();
52172
52172
  const stdoutColor = requireSupportsColor$1().stdout;
52173
- const template = requireTemplates$2();
52173
+ const template = requireTemplates$1();
52174
52174
  const isSimpleWindowsTerm =
52175
52175
  process.platform === 'win32' &&
52176
52176
  !(process.env.TERM || '').toLowerCase().startsWith('xterm');
@@ -52358,8 +52358,8 @@ function requireChalk$1() {
52358
52358
  module.exports = Chalk();
52359
52359
  module.exports.supportsColor = stdoutColor;
52360
52360
  module.exports.default = module.exports;
52361
- })(chalk$2);
52362
- return chalk$2.exports;
52361
+ })(chalk$1);
52362
+ return chalk$1.exports;
52363
52363
  }
52364
52364
  var hasRequiredLib$f;
52365
52365
  function requireLib$f() {
@@ -65086,7 +65086,7 @@ function requireLib$9() {
65086
65086
  })(lib$7);
65087
65087
  return lib$7;
65088
65088
  }
65089
- var chalk$1 = {exports: {}};
65089
+ var chalk = {exports: {}};
65090
65090
  var escapeStringRegexp;
65091
65091
  var hasRequiredEscapeStringRegexp;
65092
65092
  function requireEscapeStringRegexp() {
@@ -65101,9 +65101,9 @@ function requireEscapeStringRegexp() {
65101
65101
  };
65102
65102
  return escapeStringRegexp;
65103
65103
  }
65104
- var ansiStyles$2 = {exports: {}};
65105
- var conversions$3 = {exports: {}};
65106
- var colorName$1 = {
65104
+ var ansiStyles = {exports: {}};
65105
+ var conversions$2 = {exports: {}};
65106
+ var colorName = {
65107
65107
  aliceblue: [240, 248, 255],
65108
65108
  antiquewhite: [250, 235, 215],
65109
65109
  aqua: [0, 255, 255],
@@ -65253,14 +65253,14 @@ var colorName$1 = {
65253
65253
  yellow: [255, 255, 0],
65254
65254
  yellowgreen: [154, 205, 50],
65255
65255
  };
65256
- var cssKeywords = colorName$1;
65256
+ var cssKeywords = colorName;
65257
65257
  var reverseKeywords = {};
65258
65258
  for (var key$1 in cssKeywords) {
65259
65259
  if (cssKeywords.hasOwnProperty(key$1)) {
65260
65260
  reverseKeywords[cssKeywords[key$1]] = key$1;
65261
65261
  }
65262
65262
  }
65263
- var convert$1 = (conversions$3.exports = {
65263
+ var convert$1 = (conversions$2.exports = {
65264
65264
  rgb: {channels: 3, labels: 'rgb'},
65265
65265
  hsl: {channels: 3, labels: 'hsl'},
65266
65266
  hsv: {channels: 3, labels: 'hsv'},
@@ -65978,11 +65978,11 @@ convert$1.rgb.gray = function (rgb) {
65978
65978
  var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
65979
65979
  return [(val / 255) * 100];
65980
65980
  };
65981
- var conversionsExports = conversions$3.exports;
65982
- var conversions$2 = conversionsExports;
65981
+ var conversionsExports = conversions$2.exports;
65982
+ var conversions$1 = conversionsExports;
65983
65983
  function buildGraph() {
65984
65984
  var graph = {};
65985
- var models = Object.keys(conversions$2);
65985
+ var models = Object.keys(conversions$1);
65986
65986
  for (var len = models.length, i = 0; i < len; i++) {
65987
65987
  graph[models[i]] = {distance: -1, parent: null};
65988
65988
  }
@@ -65994,7 +65994,7 @@ function deriveBFS(fromModel) {
65994
65994
  graph[fromModel].distance = 0;
65995
65995
  while (queue.length) {
65996
65996
  var current = queue.pop();
65997
- var adjacents = Object.keys(conversions$2[current]);
65997
+ var adjacents = Object.keys(conversions$1[current]);
65998
65998
  for (var len = adjacents.length, i = 0; i < len; i++) {
65999
65999
  var adjacent = adjacents[i];
66000
66000
  var node = graph[adjacent];
@@ -66014,17 +66014,17 @@ function link(from, to) {
66014
66014
  }
66015
66015
  function wrapConversion(toModel, graph) {
66016
66016
  var path = [graph[toModel].parent, toModel];
66017
- var fn = conversions$2[graph[toModel].parent][toModel];
66017
+ var fn = conversions$1[graph[toModel].parent][toModel];
66018
66018
  var cur = graph[toModel].parent;
66019
66019
  while (graph[cur].parent) {
66020
66020
  path.unshift(graph[cur].parent);
66021
- fn = link(conversions$2[graph[cur].parent][cur], fn);
66021
+ fn = link(conversions$1[graph[cur].parent][cur], fn);
66022
66022
  cur = graph[cur].parent;
66023
66023
  }
66024
66024
  fn.conversion = path;
66025
66025
  return fn;
66026
66026
  }
66027
- var route$2 = function (fromModel) {
66027
+ var route$1 = function (fromModel) {
66028
66028
  var graph = deriveBFS(fromModel);
66029
66029
  var conversion = {};
66030
66030
  var models = Object.keys(graph);
@@ -66038,10 +66038,10 @@ var route$2 = function (fromModel) {
66038
66038
  }
66039
66039
  return conversion;
66040
66040
  };
66041
- var conversions$1 = conversionsExports;
66042
- var route$1 = route$2;
66041
+ var conversions = conversionsExports;
66042
+ var route = route$1;
66043
66043
  var convert = {};
66044
- var models = Object.keys(conversions$1);
66044
+ var models = Object.keys(conversions);
66045
66045
  function wrapRaw(fn) {
66046
66046
  var wrappedFn = function (args) {
66047
66047
  if (args === undefined || args === null) {
@@ -66081,12 +66081,12 @@ function wrapRounded(fn) {
66081
66081
  models.forEach(function (fromModel) {
66082
66082
  convert[fromModel] = {};
66083
66083
  Object.defineProperty(convert[fromModel], 'channels', {
66084
- value: conversions$1[fromModel].channels,
66084
+ value: conversions[fromModel].channels,
66085
66085
  });
66086
66086
  Object.defineProperty(convert[fromModel], 'labels', {
66087
- value: conversions$1[fromModel].labels,
66087
+ value: conversions[fromModel].labels,
66088
66088
  });
66089
- var routes = route$1(fromModel);
66089
+ var routes = route(fromModel);
66090
66090
  var routeModels = Object.keys(routes);
66091
66091
  routeModels.forEach(function (toModel) {
66092
66092
  var fn = routes[toModel];
@@ -66094,23 +66094,23 @@ models.forEach(function (fromModel) {
66094
66094
  convert[fromModel][toModel].raw = wrapRaw(fn);
66095
66095
  });
66096
66096
  });
66097
- var colorConvert$1 = convert;
66098
- ansiStyles$2.exports;
66097
+ var colorConvert = convert;
66098
+ ansiStyles.exports;
66099
66099
  (function (module) {
66100
- const colorConvert = colorConvert$1;
66100
+ const colorConvert$1 = colorConvert;
66101
66101
  const wrapAnsi16 = (fn, offset) =>
66102
66102
  function () {
66103
- const code = fn.apply(colorConvert, arguments);
66103
+ const code = fn.apply(colorConvert$1, arguments);
66104
66104
  return `[${code + offset}m`;
66105
66105
  };
66106
66106
  const wrapAnsi256 = (fn, offset) =>
66107
66107
  function () {
66108
- const code = fn.apply(colorConvert, arguments);
66108
+ const code = fn.apply(colorConvert$1, arguments);
66109
66109
  return `[${38 + offset};5;${code}m`;
66110
66110
  };
66111
66111
  const wrapAnsi16m = (fn, offset) =>
66112
66112
  function () {
66113
- const rgb = fn.apply(colorConvert, arguments);
66113
+ const rgb = fn.apply(colorConvert$1, arguments);
66114
66114
  return `[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
66115
66115
  };
66116
66116
  function assembleStyles() {
@@ -66188,11 +66188,11 @@ ansiStyles$2.exports;
66188
66188
  styles.bgColor.ansi = {ansi: wrapAnsi16(ansi2ansi, 10)};
66189
66189
  styles.bgColor.ansi256 = {ansi256: wrapAnsi256(ansi2ansi, 10)};
66190
66190
  styles.bgColor.ansi16m = {rgb: wrapAnsi16m(rgb2rgb, 10)};
66191
- for (let key of Object.keys(colorConvert)) {
66192
- if (typeof colorConvert[key] !== 'object') {
66191
+ for (let key of Object.keys(colorConvert$1)) {
66192
+ if (typeof colorConvert$1[key] !== 'object') {
66193
66193
  continue;
66194
66194
  }
66195
- const suite = colorConvert[key];
66195
+ const suite = colorConvert$1[key];
66196
66196
  if (key === 'ansi16') {
66197
66197
  key = 'ansi';
66198
66198
  }
@@ -66215,26 +66215,26 @@ ansiStyles$2.exports;
66215
66215
  enumerable: true,
66216
66216
  get: assembleStyles,
66217
66217
  });
66218
- })(ansiStyles$2);
66219
- var ansiStylesExports$1 = ansiStyles$2.exports;
66220
- var hasFlag$2;
66218
+ })(ansiStyles);
66219
+ var ansiStylesExports = ansiStyles.exports;
66220
+ var hasFlag;
66221
66221
  var hasRequiredHasFlag;
66222
66222
  function requireHasFlag() {
66223
- if (hasRequiredHasFlag) return hasFlag$2;
66223
+ if (hasRequiredHasFlag) return hasFlag;
66224
66224
  hasRequiredHasFlag = 1;
66225
- hasFlag$2 = (flag, argv) => {
66225
+ hasFlag = (flag, argv) => {
66226
66226
  argv = argv || process.argv;
66227
66227
  const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
66228
66228
  const pos = argv.indexOf(prefix + flag);
66229
66229
  const terminatorPos = argv.indexOf('--');
66230
66230
  return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
66231
66231
  };
66232
- return hasFlag$2;
66232
+ return hasFlag;
66233
66233
  }
66234
- var supportsColor_1$1;
66234
+ var supportsColor_1;
66235
66235
  var hasRequiredSupportsColor;
66236
66236
  function requireSupportsColor() {
66237
- if (hasRequiredSupportsColor) return supportsColor_1$1;
66237
+ if (hasRequiredSupportsColor) return supportsColor_1;
66238
66238
  hasRequiredSupportsColor = 1;
66239
66239
  const os = require$$0$3;
66240
66240
  const hasFlag = requireHasFlag();
@@ -66345,18 +66345,18 @@ function requireSupportsColor() {
66345
66345
  const level = supportsColor(stream);
66346
66346
  return translateLevel(level);
66347
66347
  }
66348
- supportsColor_1$1 = {
66348
+ supportsColor_1 = {
66349
66349
  supportsColor: getSupportLevel,
66350
66350
  stdout: getSupportLevel(process.stdout),
66351
66351
  stderr: getSupportLevel(process.stderr),
66352
66352
  };
66353
- return supportsColor_1$1;
66353
+ return supportsColor_1;
66354
66354
  }
66355
- var templates$1;
66356
- var hasRequiredTemplates$1;
66357
- function requireTemplates$1() {
66358
- if (hasRequiredTemplates$1) return templates$1;
66359
- hasRequiredTemplates$1 = 1;
66355
+ var templates;
66356
+ var hasRequiredTemplates;
66357
+ function requireTemplates() {
66358
+ if (hasRequiredTemplates) return templates;
66359
+ hasRequiredTemplates = 1;
66360
66360
  const TEMPLATE_REGEX =
66361
66361
  /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
66362
66362
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
@@ -66438,7 +66438,7 @@ function requireTemplates$1() {
66438
66438
  }
66439
66439
  return current;
66440
66440
  }
66441
- templates$1 = (chalk, tmp) => {
66441
+ templates = (chalk, tmp) => {
66442
66442
  const styles = [];
66443
66443
  const chunks = [];
66444
66444
  let chunk = [];
@@ -66468,17 +66468,17 @@ function requireTemplates$1() {
66468
66468
  }
66469
66469
  return chunks.join('');
66470
66470
  };
66471
- return templates$1;
66471
+ return templates;
66472
66472
  }
66473
66473
  var hasRequiredChalk;
66474
66474
  function requireChalk() {
66475
- if (hasRequiredChalk) return chalk$1.exports;
66475
+ if (hasRequiredChalk) return chalk.exports;
66476
66476
  hasRequiredChalk = 1;
66477
66477
  (function (module) {
66478
66478
  const escapeStringRegexp = requireEscapeStringRegexp();
66479
- const ansiStyles = ansiStylesExports$1;
66479
+ const ansiStyles = ansiStylesExports;
66480
66480
  const stdoutColor = requireSupportsColor().stdout;
66481
- const template = requireTemplates$1();
66481
+ const template = requireTemplates();
66482
66482
  const isSimpleWindowsTerm =
66483
66483
  process.platform === 'win32' &&
66484
66484
  !(process.env.TERM || '').toLowerCase().startsWith('xterm');
@@ -66666,8 +66666,8 @@ function requireChalk() {
66666
66666
  module.exports = Chalk();
66667
66667
  module.exports.supportsColor = stdoutColor;
66668
66668
  module.exports.default = module.exports;
66669
- })(chalk$1);
66670
- return chalk$1.exports;
66669
+ })(chalk);
66670
+ return chalk.exports;
66671
66671
  }
66672
66672
  var hasRequiredLib$8;
66673
66673
  function requireLib$8() {
@@ -107002,10 +107002,10 @@ function requireBase64Vlq() {
107002
107002
  };
107003
107003
  return base64Vlq;
107004
107004
  }
107005
- var util$6 = {};
107005
+ var util$5 = {};
107006
107006
  var hasRequiredUtil;
107007
107007
  function requireUtil() {
107008
- if (hasRequiredUtil) return util$6;
107008
+ if (hasRequiredUtil) return util$5;
107009
107009
  hasRequiredUtil = 1;
107010
107010
  (function (exports) {
107011
107011
  function getArg(aArgs, aName, aDefaultValue) {
@@ -107293,8 +107293,8 @@ function requireUtil() {
107293
107293
  }
107294
107294
  exports.compareByGeneratedPositionsInflated =
107295
107295
  compareByGeneratedPositionsInflated;
107296
- })(util$6);
107297
- return util$6;
107296
+ })(util$5);
107297
+ return util$5;
107298
107298
  }
107299
107299
  var arraySet = {};
107300
107300
  var hasRequiredArraySet;
@@ -113645,7 +113645,7 @@ var unicode = {
113645
113645
  ID_Start: ID_Start,
113646
113646
  ID_Continue: ID_Continue,
113647
113647
  };
113648
- var util$5 = {
113648
+ var util$4 = {
113649
113649
  isSpaceSeparator(c) {
113650
113650
  return typeof c === 'string' && unicode.Space_Separator.test(c);
113651
113651
  },
@@ -113804,7 +113804,7 @@ const lexStates = {
113804
113804
  read$1();
113805
113805
  return newToken('eof');
113806
113806
  }
113807
- if (util$5.isSpaceSeparator(c)) {
113807
+ if (util$4.isSpaceSeparator(c)) {
113808
113808
  read$1();
113809
113809
  return;
113810
113810
  }
@@ -113936,7 +113936,7 @@ const lexStates = {
113936
113936
  case '_':
113937
113937
  break;
113938
113938
  default:
113939
- if (!util$5.isIdStartChar(u)) {
113939
+ if (!util$4.isIdStartChar(u)) {
113940
113940
  throw invalidIdentifier();
113941
113941
  }
113942
113942
  break;
@@ -113957,7 +113957,7 @@ const lexStates = {
113957
113957
  lexState = 'identifierNameEscape';
113958
113958
  return;
113959
113959
  }
113960
- if (util$5.isIdContinueChar(c)) {
113960
+ if (util$4.isIdContinueChar(c)) {
113961
113961
  buffer$2 += read$1();
113962
113962
  return;
113963
113963
  }
@@ -113976,7 +113976,7 @@ const lexStates = {
113976
113976
  case '‍':
113977
113977
  break;
113978
113978
  default:
113979
- if (!util$5.isIdContinueChar(u)) {
113979
+ if (!util$4.isIdContinueChar(u)) {
113980
113980
  throw invalidIdentifier();
113981
113981
  }
113982
113982
  break;
@@ -114048,14 +114048,14 @@ const lexStates = {
114048
114048
  lexState = 'decimalExponent';
114049
114049
  return;
114050
114050
  }
114051
- if (util$5.isDigit(c)) {
114051
+ if (util$4.isDigit(c)) {
114052
114052
  buffer$2 += read$1();
114053
114053
  return;
114054
114054
  }
114055
114055
  return newToken('numeric', sign * Number(buffer$2));
114056
114056
  },
114057
114057
  decimalPointLeading() {
114058
- if (util$5.isDigit(c)) {
114058
+ if (util$4.isDigit(c)) {
114059
114059
  buffer$2 += read$1();
114060
114060
  lexState = 'decimalFraction';
114061
114061
  return;
@@ -114070,7 +114070,7 @@ const lexStates = {
114070
114070
  lexState = 'decimalExponent';
114071
114071
  return;
114072
114072
  }
114073
- if (util$5.isDigit(c)) {
114073
+ if (util$4.isDigit(c)) {
114074
114074
  buffer$2 += read$1();
114075
114075
  lexState = 'decimalFraction';
114076
114076
  return;
@@ -114085,7 +114085,7 @@ const lexStates = {
114085
114085
  lexState = 'decimalExponent';
114086
114086
  return;
114087
114087
  }
114088
- if (util$5.isDigit(c)) {
114088
+ if (util$4.isDigit(c)) {
114089
114089
  buffer$2 += read$1();
114090
114090
  return;
114091
114091
  }
@@ -114099,7 +114099,7 @@ const lexStates = {
114099
114099
  lexState = 'decimalExponentSign';
114100
114100
  return;
114101
114101
  }
114102
- if (util$5.isDigit(c)) {
114102
+ if (util$4.isDigit(c)) {
114103
114103
  buffer$2 += read$1();
114104
114104
  lexState = 'decimalExponentInteger';
114105
114105
  return;
@@ -114107,7 +114107,7 @@ const lexStates = {
114107
114107
  throw invalidChar(read$1());
114108
114108
  },
114109
114109
  decimalExponentSign() {
114110
- if (util$5.isDigit(c)) {
114110
+ if (util$4.isDigit(c)) {
114111
114111
  buffer$2 += read$1();
114112
114112
  lexState = 'decimalExponentInteger';
114113
114113
  return;
@@ -114115,14 +114115,14 @@ const lexStates = {
114115
114115
  throw invalidChar(read$1());
114116
114116
  },
114117
114117
  decimalExponentInteger() {
114118
- if (util$5.isDigit(c)) {
114118
+ if (util$4.isDigit(c)) {
114119
114119
  buffer$2 += read$1();
114120
114120
  return;
114121
114121
  }
114122
114122
  return newToken('numeric', sign * Number(buffer$2));
114123
114123
  },
114124
114124
  hexadecimal() {
114125
- if (util$5.isHexDigit(c)) {
114125
+ if (util$4.isHexDigit(c)) {
114126
114126
  buffer$2 += read$1();
114127
114127
  lexState = 'hexadecimalInteger';
114128
114128
  return;
@@ -114130,7 +114130,7 @@ const lexStates = {
114130
114130
  throw invalidChar(read$1());
114131
114131
  },
114132
114132
  hexadecimalInteger() {
114133
- if (util$5.isHexDigit(c)) {
114133
+ if (util$4.isHexDigit(c)) {
114134
114134
  buffer$2 += read$1();
114135
114135
  return;
114136
114136
  }
@@ -114195,7 +114195,7 @@ const lexStates = {
114195
114195
  lexState = 'string';
114196
114196
  return;
114197
114197
  }
114198
- if (util$5.isIdStartChar(c)) {
114198
+ if (util$4.isIdStartChar(c)) {
114199
114199
  buffer$2 += read$1();
114200
114200
  lexState = 'identifierName';
114201
114201
  return;
@@ -114272,7 +114272,7 @@ function escape() {
114272
114272
  return '\v';
114273
114273
  case '0':
114274
114274
  read$1();
114275
- if (util$5.isDigit(peek())) {
114275
+ if (util$4.isDigit(peek())) {
114276
114276
  throw invalidChar(read$1());
114277
114277
  }
114278
114278
  return '\0';
@@ -114311,12 +114311,12 @@ function escape() {
114311
114311
  function hexEscape() {
114312
114312
  let buffer = '';
114313
114313
  let c = peek();
114314
- if (!util$5.isHexDigit(c)) {
114314
+ if (!util$4.isHexDigit(c)) {
114315
114315
  throw invalidChar(read$1());
114316
114316
  }
114317
114317
  buffer += read$1();
114318
114318
  c = peek();
114319
- if (!util$5.isHexDigit(c)) {
114319
+ if (!util$4.isHexDigit(c)) {
114320
114320
  throw invalidChar(read$1());
114321
114321
  }
114322
114322
  buffer += read$1();
@@ -114327,7 +114327,7 @@ function unicodeEscape() {
114327
114327
  let count = 4;
114328
114328
  while (count-- > 0) {
114329
114329
  const c = peek();
114330
- if (!util$5.isHexDigit(c)) {
114330
+ if (!util$4.isHexDigit(c)) {
114331
114331
  throw invalidChar(read$1());
114332
114332
  }
114333
114333
  buffer += read$1();
@@ -114635,7 +114635,7 @@ var stringify = function stringify(value, replacer, space) {
114635
114635
  product += c;
114636
114636
  continue;
114637
114637
  case '\0':
114638
- if (util$5.isDigit(value[i + 1])) {
114638
+ if (util$4.isDigit(value[i + 1])) {
114639
114639
  product += '\\x00';
114640
114640
  continue;
114641
114641
  }
@@ -114703,11 +114703,11 @@ var stringify = function stringify(value, replacer, space) {
114703
114703
  return quoteString(key);
114704
114704
  }
114705
114705
  const firstChar = String.fromCodePoint(key.codePointAt(0));
114706
- if (!util$5.isIdStartChar(firstChar)) {
114706
+ if (!util$4.isIdStartChar(firstChar)) {
114707
114707
  return quoteString(key);
114708
114708
  }
114709
114709
  for (let i = firstChar.length; i < key.length; i++) {
114710
- if (!util$5.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
114710
+ if (!util$4.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
114711
114711
  return quoteString(key);
114712
114712
  }
114713
114713
  }
@@ -115014,7 +115014,7 @@ var inspector$1 = '>= 8';
115014
115014
  var _linklist$1 = '< 8';
115015
115015
  var module$2 = true;
115016
115016
  var net$1 = true;
115017
- var os$2 = true;
115017
+ var os$1 = true;
115018
115018
  var path$1 = true;
115019
115019
  var perf_hooks$1 = '>= 8.5';
115020
115020
  var process$3 = '>= 1';
@@ -115038,9 +115038,9 @@ var _tls_legacy$1 = '>= 0.11.3 && < 10';
115038
115038
  var _tls_wrap$1 = '>= 0.11.3';
115039
115039
  var tls$1 = true;
115040
115040
  var trace_events$1 = '>= 10';
115041
- var tty$2 = true;
115041
+ var tty$1 = true;
115042
115042
  var url$1 = true;
115043
- var util$4 = true;
115043
+ var util$3 = true;
115044
115044
  var v8$1 = '>= 1';
115045
115045
  var vm$1 = true;
115046
115046
  var wasi$1 = '>= 13.4 && < 13.5';
@@ -115113,7 +115113,7 @@ var require$$1 = {
115113
115113
  'node-inspect/lib/_inspect': '>= 7.6 && < 12',
115114
115114
  'node-inspect/lib/internal/inspect_client': '>= 7.6 && < 12',
115115
115115
  'node-inspect/lib/internal/inspect_repl': '>= 7.6 && < 12',
115116
- os: os$2,
115116
+ os: os$1,
115117
115117
  'node:os': ['>= 14.18 && < 15', '>= 16'],
115118
115118
  path: path$1,
115119
115119
  'node:path': ['>= 14.18 && < 15', '>= 16'],
@@ -115174,11 +115174,11 @@ var require$$1 = {
115174
115174
  'node:tls': ['>= 14.18 && < 15', '>= 16'],
115175
115175
  trace_events: trace_events$1,
115176
115176
  'node:trace_events': ['>= 14.18 && < 15', '>= 16'],
115177
- tty: tty$2,
115177
+ tty: tty$1,
115178
115178
  'node:tty': ['>= 14.18 && < 15', '>= 16'],
115179
115179
  url: url$1,
115180
115180
  'node:url': ['>= 14.18 && < 15', '>= 16'],
115181
- util: util$4,
115181
+ util: util$3,
115182
115182
  'node:util': ['>= 14.18 && < 15', '>= 16'],
115183
115183
  'util/types': '>= 15.3',
115184
115184
  'node:util/types': '>= 16',
@@ -115613,7 +115613,7 @@ var inspector = '>= 8';
115613
115613
  var _linklist = '< 8';
115614
115614
  var module$1 = true;
115615
115615
  var net = true;
115616
- var os$1 = true;
115616
+ var os = true;
115617
115617
  var path = true;
115618
115618
  var perf_hooks = '>= 8.5';
115619
115619
  var process$2 = '>= 1';
@@ -115637,9 +115637,9 @@ var _tls_legacy = '>= 0.11.3 && < 10';
115637
115637
  var _tls_wrap = '>= 0.11.3';
115638
115638
  var tls = true;
115639
115639
  var trace_events = '>= 10';
115640
- var tty$1 = true;
115640
+ var tty = true;
115641
115641
  var url = true;
115642
- var util$3 = true;
115642
+ var util$2 = true;
115643
115643
  var v8 = '>= 1';
115644
115644
  var vm = true;
115645
115645
  var wasi = '>= 13.4 && < 13.5';
@@ -115712,7 +115712,7 @@ var require$$0 = {
115712
115712
  'node-inspect/lib/_inspect': '>= 7.6 && < 12',
115713
115713
  'node-inspect/lib/internal/inspect_client': '>= 7.6 && < 12',
115714
115714
  'node-inspect/lib/internal/inspect_repl': '>= 7.6 && < 12',
115715
- os: os$1,
115715
+ os: os,
115716
115716
  'node:os': ['>= 14.18 && < 15', '>= 16'],
115717
115717
  path: path,
115718
115718
  'node:path': ['>= 14.18 && < 15', '>= 16'],
@@ -115773,11 +115773,11 @@ var require$$0 = {
115773
115773
  'node:tls': ['>= 14.18 && < 15', '>= 16'],
115774
115774
  trace_events: trace_events,
115775
115775
  'node:trace_events': ['>= 14.18 && < 15', '>= 16'],
115776
- tty: tty$1,
115776
+ tty: tty,
115777
115777
  'node:tty': ['>= 14.18 && < 15', '>= 16'],
115778
115778
  url: url,
115779
115779
  'node:url': ['>= 14.18 && < 15', '>= 16'],
115780
- util: util$3,
115780
+ util: util$2,
115781
115781
  'node:util': ['>= 14.18 && < 15', '>= 16'],
115782
115782
  'util/types': '>= 15.3',
115783
115783
  'node:util/types': '>= 16',
@@ -117063,9 +117063,9 @@ function requireItem() {
117063
117063
  }
117064
117064
  var config = {};
117065
117065
  var full = {};
117066
- var util$2 = {};
117067
- Object.defineProperty(util$2, '__esModule', {value: true});
117068
- util$2.mergeOptions = mergeOptions;
117066
+ var util$1 = {};
117067
+ Object.defineProperty(util$1, '__esModule', {value: true});
117068
+ util$1.mergeOptions = mergeOptions;
117069
117069
  function mergeOptions(target, source) {
117070
117070
  for (const k of Object.keys(source)) {
117071
117071
  if (k === 'parserOpts' && source.parserOpts) {
@@ -118223,7 +118223,7 @@ function requirePartial() {
118223
118223
  return data;
118224
118224
  }
118225
118225
  var _plugin = _interopRequireDefault(plugin$7);
118226
- var _util = util$2;
118226
+ var _util = util$1;
118227
118227
  var _item = requireItem();
118228
118228
  var _configChain = requireConfigChain();
118229
118229
  var _environment = environment;
@@ -118360,7 +118360,7 @@ function requireFull() {
118360
118360
  hasRequiredFull = 1;
118361
118361
  Object.defineProperty(full, '__esModule', {value: true});
118362
118362
  full.default = loadFullConfig;
118363
- var _util = util$2;
118363
+ var _util = util$1;
118364
118364
  var context = _interopRequireWildcard(requireLib());
118365
118365
  var _plugin = _interopRequireDefault(plugin$7);
118366
118366
  var _item = requireItem();
@@ -121963,7 +121963,7 @@ function phiTypeEquals(tA, tB) {
121963
121963
  }
121964
121964
  return false;
121965
121965
  }
121966
- var util$1;
121966
+ var util;
121967
121967
  (function (util) {
121968
121968
  util.assertEqual = val => val;
121969
121969
  function assertIs(_arg) {}
@@ -122028,12 +122028,12 @@ var util$1;
122028
122028
  }
122029
122029
  return value;
122030
122030
  };
122031
- })(util$1 || (util$1 = {}));
122031
+ })(util || (util = {}));
122032
122032
  var objectUtil;
122033
122033
  (function (objectUtil) {
122034
122034
  objectUtil.mergeShapes = (first, second) => ({...first, ...second});
122035
122035
  })(objectUtil || (objectUtil = {}));
122036
- const ZodParsedType = util$1.arrayToEnum([
122036
+ const ZodParsedType = util.arrayToEnum([
122037
122037
  'string',
122038
122038
  'nan',
122039
122039
  'number',
@@ -122101,7 +122101,7 @@ const getParsedType = data => {
122101
122101
  return ZodParsedType.unknown;
122102
122102
  }
122103
122103
  };
122104
- const ZodIssueCode = util$1.arrayToEnum([
122104
+ const ZodIssueCode = util.arrayToEnum([
122105
122105
  'invalid_type',
122106
122106
  'invalid_literal',
122107
122107
  'custom',
@@ -122187,7 +122187,7 @@ class ZodError extends Error {
122187
122187
  return this.message;
122188
122188
  }
122189
122189
  get message() {
122190
- return JSON.stringify(this.issues, util$1.jsonStringifyReplacer, 2);
122190
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
122191
122191
  }
122192
122192
  get isEmpty() {
122193
122193
  return this.issues.length === 0;
@@ -122224,19 +122224,19 @@ const errorMap = (issue, _ctx) => {
122224
122224
  }
122225
122225
  break;
122226
122226
  case ZodIssueCode.invalid_literal:
122227
- message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$1.jsonStringifyReplacer)}`;
122227
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
122228
122228
  break;
122229
122229
  case ZodIssueCode.unrecognized_keys:
122230
- message = `Unrecognized key(s) in object: ${util$1.joinValues(issue.keys, ', ')}`;
122230
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ', ')}`;
122231
122231
  break;
122232
122232
  case ZodIssueCode.invalid_union:
122233
122233
  message = `Invalid input`;
122234
122234
  break;
122235
122235
  case ZodIssueCode.invalid_union_discriminator:
122236
- message = `Invalid discriminator value. Expected ${util$1.joinValues(issue.options)}`;
122236
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
122237
122237
  break;
122238
122238
  case ZodIssueCode.invalid_enum_value:
122239
- message = `Invalid enum value. Expected ${util$1.joinValues(issue.options)}, received '${issue.received}'`;
122239
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
122240
122240
  break;
122241
122241
  case ZodIssueCode.invalid_arguments:
122242
122242
  message = `Invalid function arguments`;
@@ -122259,7 +122259,7 @@ const errorMap = (issue, _ctx) => {
122259
122259
  } else if ('endsWith' in issue.validation) {
122260
122260
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
122261
122261
  } else {
122262
- util$1.assertNever(issue.validation);
122262
+ util.assertNever(issue.validation);
122263
122263
  }
122264
122264
  } else if (issue.validation !== 'regex') {
122265
122265
  message = `Invalid ${issue.validation}`;
@@ -122305,7 +122305,7 @@ const errorMap = (issue, _ctx) => {
122305
122305
  break;
122306
122306
  default:
122307
122307
  message = _ctx.defaultError;
122308
- util$1.assertNever(issue);
122308
+ util.assertNever(issue);
122309
122309
  }
122310
122310
  return {message: message};
122311
122311
  };
@@ -123012,7 +123012,7 @@ class ZodString extends ZodType {
123012
123012
  status.dirty();
123013
123013
  }
123014
123014
  } else {
123015
- util$1.assertNever(check);
123015
+ util.assertNever(check);
123016
123016
  }
123017
123017
  }
123018
123018
  return {status: status.value, value: input.data};
@@ -123248,7 +123248,7 @@ class ZodNumber extends ZodType {
123248
123248
  const status = new ParseStatus();
123249
123249
  for (const check of this._def.checks) {
123250
123250
  if (check.kind === 'int') {
123251
- if (!util$1.isInteger(input.data)) {
123251
+ if (!util.isInteger(input.data)) {
123252
123252
  ctx = this._getOrReturnCtx(input, ctx);
123253
123253
  addIssueToContext(ctx, {
123254
123254
  code: ZodIssueCode.invalid_type,
@@ -123310,7 +123310,7 @@ class ZodNumber extends ZodType {
123310
123310
  status.dirty();
123311
123311
  }
123312
123312
  } else {
123313
- util$1.assertNever(check);
123313
+ util.assertNever(check);
123314
123314
  }
123315
123315
  }
123316
123316
  return {status: status.value, value: input.data};
@@ -123427,7 +123427,7 @@ class ZodNumber extends ZodType {
123427
123427
  return !!this._def.checks.find(
123428
123428
  ch =>
123429
123429
  ch.kind === 'int' ||
123430
- (ch.kind === 'multipleOf' && util$1.isInteger(ch.value))
123430
+ (ch.kind === 'multipleOf' && util.isInteger(ch.value))
123431
123431
  );
123432
123432
  }
123433
123433
  get isFinite() {
@@ -123521,7 +123521,7 @@ class ZodBigInt extends ZodType {
123521
123521
  status.dirty();
123522
123522
  }
123523
123523
  } else {
123524
- util$1.assertNever(check);
123524
+ util.assertNever(check);
123525
123525
  }
123526
123526
  }
123527
123527
  return {status: status.value, value: input.data};
@@ -123701,7 +123701,7 @@ class ZodDate extends ZodType {
123701
123701
  status.dirty();
123702
123702
  }
123703
123703
  } else {
123704
- util$1.assertNever(check);
123704
+ util.assertNever(check);
123705
123705
  }
123706
123706
  }
123707
123707
  return {status: status.value, value: new Date(input.data.getTime())};
@@ -124004,7 +124004,7 @@ class ZodObject extends ZodType {
124004
124004
  _getCached() {
124005
124005
  if (this._cached !== null) return this._cached;
124006
124006
  const shape = this._def.shape();
124007
- const keys = util$1.objectKeys(shape);
124007
+ const keys = util.objectKeys(shape);
124008
124008
  return (this._cached = {shape: shape, keys: keys});
124009
124009
  }
124010
124010
  _parse(input) {
@@ -124160,7 +124160,7 @@ class ZodObject extends ZodType {
124160
124160
  }
124161
124161
  pick(mask) {
124162
124162
  const shape = {};
124163
- util$1.objectKeys(mask).forEach(key => {
124163
+ util.objectKeys(mask).forEach(key => {
124164
124164
  if (mask[key] && this.shape[key]) {
124165
124165
  shape[key] = this.shape[key];
124166
124166
  }
@@ -124169,7 +124169,7 @@ class ZodObject extends ZodType {
124169
124169
  }
124170
124170
  omit(mask) {
124171
124171
  const shape = {};
124172
- util$1.objectKeys(this.shape).forEach(key => {
124172
+ util.objectKeys(this.shape).forEach(key => {
124173
124173
  if (!mask[key]) {
124174
124174
  shape[key] = this.shape[key];
124175
124175
  }
@@ -124181,7 +124181,7 @@ class ZodObject extends ZodType {
124181
124181
  }
124182
124182
  partial(mask) {
124183
124183
  const newShape = {};
124184
- util$1.objectKeys(this.shape).forEach(key => {
124184
+ util.objectKeys(this.shape).forEach(key => {
124185
124185
  const fieldSchema = this.shape[key];
124186
124186
  if (mask && !mask[key]) {
124187
124187
  newShape[key] = fieldSchema;
@@ -124193,7 +124193,7 @@ class ZodObject extends ZodType {
124193
124193
  }
124194
124194
  required(mask) {
124195
124195
  const newShape = {};
124196
- util$1.objectKeys(this.shape).forEach(key => {
124196
+ util.objectKeys(this.shape).forEach(key => {
124197
124197
  if (mask && !mask[key]) {
124198
124198
  newShape[key] = this.shape[key];
124199
124199
  } else {
@@ -124208,7 +124208,7 @@ class ZodObject extends ZodType {
124208
124208
  return new ZodObject({...this._def, shape: () => newShape});
124209
124209
  }
124210
124210
  keyof() {
124211
- return createZodEnum(util$1.objectKeys(this.shape));
124211
+ return createZodEnum(util.objectKeys(this.shape));
124212
124212
  }
124213
124213
  }
124214
124214
  ZodObject.create = (shape, params) =>
@@ -124414,8 +124414,8 @@ function mergeValues$1(a, b) {
124414
124414
  if (a === b) {
124415
124415
  return {valid: true, data: a};
124416
124416
  } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
124417
- const bKeys = util$1.objectKeys(b);
124418
- const sharedKeys = util$1
124417
+ const bKeys = util.objectKeys(b);
124418
+ const sharedKeys = util
124419
124419
  .objectKeys(a)
124420
124420
  .filter(key => bKeys.indexOf(key) !== -1);
124421
124421
  const newObj = {...a, ...b};
@@ -124945,7 +124945,7 @@ class ZodEnum extends ZodType {
124945
124945
  const ctx = this._getOrReturnCtx(input);
124946
124946
  const expectedValues = this._def.values;
124947
124947
  addIssueToContext(ctx, {
124948
- expected: util$1.joinValues(expectedValues),
124948
+ expected: util.joinValues(expectedValues),
124949
124949
  received: ctx.parsedType,
124950
124950
  code: ZodIssueCode.invalid_type,
124951
124951
  });
@@ -124997,22 +124997,22 @@ class ZodEnum extends ZodType {
124997
124997
  ZodEnum.create = createZodEnum;
124998
124998
  class ZodNativeEnum extends ZodType {
124999
124999
  _parse(input) {
125000
- const nativeEnumValues = util$1.getValidEnumValues(this._def.values);
125000
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
125001
125001
  const ctx = this._getOrReturnCtx(input);
125002
125002
  if (
125003
125003
  ctx.parsedType !== ZodParsedType.string &&
125004
125004
  ctx.parsedType !== ZodParsedType.number
125005
125005
  ) {
125006
- const expectedValues = util$1.objectValues(nativeEnumValues);
125006
+ const expectedValues = util.objectValues(nativeEnumValues);
125007
125007
  addIssueToContext(ctx, {
125008
- expected: util$1.joinValues(expectedValues),
125008
+ expected: util.joinValues(expectedValues),
125009
125009
  received: ctx.parsedType,
125010
125010
  code: ZodIssueCode.invalid_type,
125011
125011
  });
125012
125012
  return INVALID;
125013
125013
  }
125014
125014
  if (nativeEnumValues.indexOf(input.data) === -1) {
125015
- const expectedValues = util$1.objectValues(nativeEnumValues);
125015
+ const expectedValues = util.objectValues(nativeEnumValues);
125016
125016
  addIssueToContext(ctx, {
125017
125017
  received: ctx.data,
125018
125018
  code: ZodIssueCode.invalid_enum_value,
@@ -125178,7 +125178,7 @@ class ZodEffects extends ZodType {
125178
125178
  });
125179
125179
  }
125180
125180
  }
125181
- util$1.assertNever(effect);
125181
+ util.assertNever(effect);
125182
125182
  }
125183
125183
  }
125184
125184
  ZodEffects.create = (schema, effect, params) =>
@@ -125531,7 +125531,7 @@ var z = Object.freeze({
125531
125531
  isValid: isValid,
125532
125532
  isAsync: isAsync,
125533
125533
  get util() {
125534
- return util$1;
125534
+ return util;
125535
125535
  },
125536
125536
  get objectUtil() {
125537
125537
  return objectUtil;
@@ -127070,6 +127070,13 @@ function printSourceLocation(loc) {
127070
127070
  return `${loc.start.line}:${loc.start.column}:${loc.end.line}:${loc.end.column}`;
127071
127071
  }
127072
127072
  }
127073
+ function printSourceLocationLine(loc) {
127074
+ if (typeof loc === 'symbol') {
127075
+ return 'generated';
127076
+ } else {
127077
+ return `${loc.start.line}:${loc.end.line}`;
127078
+ }
127079
+ }
127073
127080
  function getFunctionName$1(instrValue, defaultValue) {
127074
127081
  var _a;
127075
127082
  switch (instrValue.kind) {
@@ -129294,6 +129301,7 @@ const BuiltInDispatchId = 'BuiltInDispatch';
129294
129301
  const BuiltInUseContextHookId = 'BuiltInUseContextHook';
129295
129302
  const BuiltInUseTransitionId = 'BuiltInUseTransition';
129296
129303
  const BuiltInStartTransitionId = 'BuiltInStartTransition';
129304
+ const BuiltInFireId = 'BuiltInFire';
129297
129305
  const BUILTIN_SHAPES = new Map();
129298
129306
  addObject(BUILTIN_SHAPES, BuiltInPropsId, [
129299
129307
  ['ref', {kind: 'Object', shapeId: BuiltInUseRefId}],
@@ -134205,7 +134213,7 @@ var ansiRegex = options => {
134205
134213
  Object.defineProperty(ConvertAnsi, '__esModule', {value: true});
134206
134214
  ConvertAnsi.default = ConvertAnsi.serialize = ConvertAnsi.test = void 0;
134207
134215
  var _ansiRegex = _interopRequireDefault$2(ansiRegex);
134208
- var _ansiStyles$1 = _interopRequireDefault$2(ansiStylesExports$1);
134216
+ var _ansiStyles$1 = _interopRequireDefault$2(ansiStylesExports);
134209
134217
  function _interopRequireDefault$2(obj) {
134210
134218
  return obj && obj.__esModule ? obj : {default: obj};
134211
134219
  }
@@ -135262,7 +135270,7 @@ ReactTestComponent.test = test;
135262
135270
  const plugin = {serialize: serialize, test: test};
135263
135271
  var _default = plugin;
135264
135272
  ReactTestComponent.default = _default;
135265
- var _ansiStyles = _interopRequireDefault(ansiStylesExports$1);
135273
+ var _ansiStyles = _interopRequireDefault(ansiStylesExports);
135266
135274
  var _collections = collections;
135267
135275
  var _AsymmetricMatcher = _interopRequireDefault(AsymmetricMatcher);
135268
135276
  var _ConvertAnsi = _interopRequireDefault(ConvertAnsi);
@@ -136014,6 +136022,21 @@ const UNTYPED_GLOBALS = new Set([
136014
136022
  'decodeURIComponent',
136015
136023
  ]);
136016
136024
  const TYPED_GLOBALS = [
136025
+ [
136026
+ 'Object',
136027
+ addObject(DEFAULT_SHAPES, 'Object', [
136028
+ [
136029
+ 'keys',
136030
+ addFunction(DEFAULT_SHAPES, [], {
136031
+ positionalParams: [exports.Effect.Read],
136032
+ restParam: null,
136033
+ returnType: {kind: 'Object', shapeId: BuiltInArrayId},
136034
+ calleeEffect: exports.Effect.Read,
136035
+ returnValueKind: exports.ValueKind.Mutable,
136036
+ }),
136037
+ ],
136038
+ ]),
136039
+ ],
136017
136040
  [
136018
136041
  'Array',
136019
136042
  addObject(DEFAULT_SHAPES, 'Array', [
@@ -136371,6 +136394,21 @@ const REACT_APIS = [
136371
136394
  BuiltInUseOperatorId
136372
136395
  ),
136373
136396
  ],
136397
+ [
136398
+ 'fire',
136399
+ addFunction(
136400
+ DEFAULT_SHAPES,
136401
+ [],
136402
+ {
136403
+ positionalParams: [],
136404
+ restParam: null,
136405
+ returnType: {kind: 'Primitive'},
136406
+ calleeEffect: exports.Effect.Read,
136407
+ returnValueKind: exports.ValueKind.Frozen,
136408
+ },
136409
+ BuiltInFireId
136410
+ ),
136411
+ ],
136374
136412
  ];
136375
136413
  TYPED_GLOBALS.push(
136376
136414
  [
@@ -136720,7 +136758,7 @@ const EnvironmentConfigSchema = z.object({
136720
136758
  customHooks: z.map(z.string(), HookSchema).default(new Map()),
136721
136759
  moduleTypeProvider: z.nullable(z.function().args(z.string())).default(null),
136722
136760
  customMacros: z.nullable(z.array(MacroSchema)).default(null),
136723
- enableResetCacheOnSourceFileChanges: z.boolean().default(false),
136761
+ enableResetCacheOnSourceFileChanges: z.nullable(z.boolean()).default(null),
136724
136762
  enablePreserveExistingMemoizationGuarantees: z.boolean().default(false),
136725
136763
  validatePreserveExistingMemoizationGuarantees: z.boolean().default(true),
136726
136764
  enablePreserveExistingManualUseMemo: z.boolean().default(false),
@@ -136728,6 +136766,7 @@ const EnvironmentConfigSchema = z.object({
136728
136766
  enableUseTypeAnnotations: z.boolean().default(false),
136729
136767
  enableFunctionDependencyRewrite: z.boolean().default(true),
136730
136768
  enableOptionalDependencies: z.boolean().default(true),
136769
+ enableFire: z.boolean().default(false),
136731
136770
  inferEffectDependencies: z
136732
136771
  .nullable(
136733
136772
  z.array(
@@ -136848,7 +136887,10 @@ function parseConfigPragmaForTests(pragma) {
136848
136887
  }
136849
136888
  continue;
136850
136889
  }
136851
- if (typeof defaultConfig[key] !== 'boolean') {
136890
+ if (
136891
+ key !== 'enableResetCacheOnSourceFileChanges' &&
136892
+ typeof defaultConfig[key] !== 'boolean'
136893
+ ) {
136852
136894
  continue;
136853
136895
  }
136854
136896
  if (val === undefined || val === 'true') {
@@ -136859,6 +136901,9 @@ function parseConfigPragmaForTests(pragma) {
136859
136901
  }
136860
136902
  const config = EnvironmentConfigSchema.safeParse(maybeConfig);
136861
136903
  if (config.success) {
136904
+ if (config.data.enableResetCacheOnSourceFileChanges == null) {
136905
+ config.data.enableResetCacheOnSourceFileChanges = false;
136906
+ }
136862
136907
  return config.data;
136863
136908
  }
136864
136909
  CompilerError.invariant(false, {
@@ -136910,6 +136955,7 @@ class Environment {
136910
136955
  'f'
136911
136956
  );
136912
136957
  this.hasLoweredContextAccess = false;
136958
+ this.hasFireRewrite = false;
136913
136959
  if (
136914
136960
  config.disableMemoizationForDebugging &&
136915
136961
  config.enableChangeDetectionForDebugging != null
@@ -137596,1634 +137642,8 @@ class DisjointSet {
137596
137642
  }
137597
137643
  }
137598
137644
  _DisjointSet_entries = new WeakMap();
137599
- var ansiStyles$1 = {exports: {}};
137600
- var colorName;
137601
- var hasRequiredColorName;
137602
- function requireColorName() {
137603
- if (hasRequiredColorName) return colorName;
137604
- hasRequiredColorName = 1;
137605
- colorName = {
137606
- aliceblue: [240, 248, 255],
137607
- antiquewhite: [250, 235, 215],
137608
- aqua: [0, 255, 255],
137609
- aquamarine: [127, 255, 212],
137610
- azure: [240, 255, 255],
137611
- beige: [245, 245, 220],
137612
- bisque: [255, 228, 196],
137613
- black: [0, 0, 0],
137614
- blanchedalmond: [255, 235, 205],
137615
- blue: [0, 0, 255],
137616
- blueviolet: [138, 43, 226],
137617
- brown: [165, 42, 42],
137618
- burlywood: [222, 184, 135],
137619
- cadetblue: [95, 158, 160],
137620
- chartreuse: [127, 255, 0],
137621
- chocolate: [210, 105, 30],
137622
- coral: [255, 127, 80],
137623
- cornflowerblue: [100, 149, 237],
137624
- cornsilk: [255, 248, 220],
137625
- crimson: [220, 20, 60],
137626
- cyan: [0, 255, 255],
137627
- darkblue: [0, 0, 139],
137628
- darkcyan: [0, 139, 139],
137629
- darkgoldenrod: [184, 134, 11],
137630
- darkgray: [169, 169, 169],
137631
- darkgreen: [0, 100, 0],
137632
- darkgrey: [169, 169, 169],
137633
- darkkhaki: [189, 183, 107],
137634
- darkmagenta: [139, 0, 139],
137635
- darkolivegreen: [85, 107, 47],
137636
- darkorange: [255, 140, 0],
137637
- darkorchid: [153, 50, 204],
137638
- darkred: [139, 0, 0],
137639
- darksalmon: [233, 150, 122],
137640
- darkseagreen: [143, 188, 143],
137641
- darkslateblue: [72, 61, 139],
137642
- darkslategray: [47, 79, 79],
137643
- darkslategrey: [47, 79, 79],
137644
- darkturquoise: [0, 206, 209],
137645
- darkviolet: [148, 0, 211],
137646
- deeppink: [255, 20, 147],
137647
- deepskyblue: [0, 191, 255],
137648
- dimgray: [105, 105, 105],
137649
- dimgrey: [105, 105, 105],
137650
- dodgerblue: [30, 144, 255],
137651
- firebrick: [178, 34, 34],
137652
- floralwhite: [255, 250, 240],
137653
- forestgreen: [34, 139, 34],
137654
- fuchsia: [255, 0, 255],
137655
- gainsboro: [220, 220, 220],
137656
- ghostwhite: [248, 248, 255],
137657
- gold: [255, 215, 0],
137658
- goldenrod: [218, 165, 32],
137659
- gray: [128, 128, 128],
137660
- green: [0, 128, 0],
137661
- greenyellow: [173, 255, 47],
137662
- grey: [128, 128, 128],
137663
- honeydew: [240, 255, 240],
137664
- hotpink: [255, 105, 180],
137665
- indianred: [205, 92, 92],
137666
- indigo: [75, 0, 130],
137667
- ivory: [255, 255, 240],
137668
- khaki: [240, 230, 140],
137669
- lavender: [230, 230, 250],
137670
- lavenderblush: [255, 240, 245],
137671
- lawngreen: [124, 252, 0],
137672
- lemonchiffon: [255, 250, 205],
137673
- lightblue: [173, 216, 230],
137674
- lightcoral: [240, 128, 128],
137675
- lightcyan: [224, 255, 255],
137676
- lightgoldenrodyellow: [250, 250, 210],
137677
- lightgray: [211, 211, 211],
137678
- lightgreen: [144, 238, 144],
137679
- lightgrey: [211, 211, 211],
137680
- lightpink: [255, 182, 193],
137681
- lightsalmon: [255, 160, 122],
137682
- lightseagreen: [32, 178, 170],
137683
- lightskyblue: [135, 206, 250],
137684
- lightslategray: [119, 136, 153],
137685
- lightslategrey: [119, 136, 153],
137686
- lightsteelblue: [176, 196, 222],
137687
- lightyellow: [255, 255, 224],
137688
- lime: [0, 255, 0],
137689
- limegreen: [50, 205, 50],
137690
- linen: [250, 240, 230],
137691
- magenta: [255, 0, 255],
137692
- maroon: [128, 0, 0],
137693
- mediumaquamarine: [102, 205, 170],
137694
- mediumblue: [0, 0, 205],
137695
- mediumorchid: [186, 85, 211],
137696
- mediumpurple: [147, 112, 219],
137697
- mediumseagreen: [60, 179, 113],
137698
- mediumslateblue: [123, 104, 238],
137699
- mediumspringgreen: [0, 250, 154],
137700
- mediumturquoise: [72, 209, 204],
137701
- mediumvioletred: [199, 21, 133],
137702
- midnightblue: [25, 25, 112],
137703
- mintcream: [245, 255, 250],
137704
- mistyrose: [255, 228, 225],
137705
- moccasin: [255, 228, 181],
137706
- navajowhite: [255, 222, 173],
137707
- navy: [0, 0, 128],
137708
- oldlace: [253, 245, 230],
137709
- olive: [128, 128, 0],
137710
- olivedrab: [107, 142, 35],
137711
- orange: [255, 165, 0],
137712
- orangered: [255, 69, 0],
137713
- orchid: [218, 112, 214],
137714
- palegoldenrod: [238, 232, 170],
137715
- palegreen: [152, 251, 152],
137716
- paleturquoise: [175, 238, 238],
137717
- palevioletred: [219, 112, 147],
137718
- papayawhip: [255, 239, 213],
137719
- peachpuff: [255, 218, 185],
137720
- peru: [205, 133, 63],
137721
- pink: [255, 192, 203],
137722
- plum: [221, 160, 221],
137723
- powderblue: [176, 224, 230],
137724
- purple: [128, 0, 128],
137725
- rebeccapurple: [102, 51, 153],
137726
- red: [255, 0, 0],
137727
- rosybrown: [188, 143, 143],
137728
- royalblue: [65, 105, 225],
137729
- saddlebrown: [139, 69, 19],
137730
- salmon: [250, 128, 114],
137731
- sandybrown: [244, 164, 96],
137732
- seagreen: [46, 139, 87],
137733
- seashell: [255, 245, 238],
137734
- sienna: [160, 82, 45],
137735
- silver: [192, 192, 192],
137736
- skyblue: [135, 206, 235],
137737
- slateblue: [106, 90, 205],
137738
- slategray: [112, 128, 144],
137739
- slategrey: [112, 128, 144],
137740
- snow: [255, 250, 250],
137741
- springgreen: [0, 255, 127],
137742
- steelblue: [70, 130, 180],
137743
- tan: [210, 180, 140],
137744
- teal: [0, 128, 128],
137745
- thistle: [216, 191, 216],
137746
- tomato: [255, 99, 71],
137747
- turquoise: [64, 224, 208],
137748
- violet: [238, 130, 238],
137749
- wheat: [245, 222, 179],
137750
- white: [255, 255, 255],
137751
- whitesmoke: [245, 245, 245],
137752
- yellow: [255, 255, 0],
137753
- yellowgreen: [154, 205, 50],
137754
- };
137755
- return colorName;
137756
- }
137757
- var conversions;
137758
- var hasRequiredConversions;
137759
- function requireConversions() {
137760
- if (hasRequiredConversions) return conversions;
137761
- hasRequiredConversions = 1;
137762
- const cssKeywords = requireColorName();
137763
- const reverseKeywords = {};
137764
- for (const key of Object.keys(cssKeywords)) {
137765
- reverseKeywords[cssKeywords[key]] = key;
137766
- }
137767
- const convert = {
137768
- rgb: {channels: 3, labels: 'rgb'},
137769
- hsl: {channels: 3, labels: 'hsl'},
137770
- hsv: {channels: 3, labels: 'hsv'},
137771
- hwb: {channels: 3, labels: 'hwb'},
137772
- cmyk: {channels: 4, labels: 'cmyk'},
137773
- xyz: {channels: 3, labels: 'xyz'},
137774
- lab: {channels: 3, labels: 'lab'},
137775
- lch: {channels: 3, labels: 'lch'},
137776
- hex: {channels: 1, labels: ['hex']},
137777
- keyword: {channels: 1, labels: ['keyword']},
137778
- ansi16: {channels: 1, labels: ['ansi16']},
137779
- ansi256: {channels: 1, labels: ['ansi256']},
137780
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
137781
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
137782
- gray: {channels: 1, labels: ['gray']},
137783
- };
137784
- conversions = convert;
137785
- for (const model of Object.keys(convert)) {
137786
- if (!('channels' in convert[model])) {
137787
- throw new Error('missing channels property: ' + model);
137788
- }
137789
- if (!('labels' in convert[model])) {
137790
- throw new Error('missing channel labels property: ' + model);
137791
- }
137792
- if (convert[model].labels.length !== convert[model].channels) {
137793
- throw new Error('channel and label counts mismatch: ' + model);
137794
- }
137795
- const {channels: channels, labels: labels} = convert[model];
137796
- delete convert[model].channels;
137797
- delete convert[model].labels;
137798
- Object.defineProperty(convert[model], 'channels', {value: channels});
137799
- Object.defineProperty(convert[model], 'labels', {value: labels});
137800
- }
137801
- convert.rgb.hsl = function (rgb) {
137802
- const r = rgb[0] / 255;
137803
- const g = rgb[1] / 255;
137804
- const b = rgb[2] / 255;
137805
- const min = Math.min(r, g, b);
137806
- const max = Math.max(r, g, b);
137807
- const delta = max - min;
137808
- let h;
137809
- let s;
137810
- if (max === min) {
137811
- h = 0;
137812
- } else if (r === max) {
137813
- h = (g - b) / delta;
137814
- } else if (g === max) {
137815
- h = 2 + (b - r) / delta;
137816
- } else if (b === max) {
137817
- h = 4 + (r - g) / delta;
137818
- }
137819
- h = Math.min(h * 60, 360);
137820
- if (h < 0) {
137821
- h += 360;
137822
- }
137823
- const l = (min + max) / 2;
137824
- if (max === min) {
137825
- s = 0;
137826
- } else if (l <= 0.5) {
137827
- s = delta / (max + min);
137828
- } else {
137829
- s = delta / (2 - max - min);
137830
- }
137831
- return [h, s * 100, l * 100];
137832
- };
137833
- convert.rgb.hsv = function (rgb) {
137834
- let rdif;
137835
- let gdif;
137836
- let bdif;
137837
- let h;
137838
- let s;
137839
- const r = rgb[0] / 255;
137840
- const g = rgb[1] / 255;
137841
- const b = rgb[2] / 255;
137842
- const v = Math.max(r, g, b);
137843
- const diff = v - Math.min(r, g, b);
137844
- const diffc = function (c) {
137845
- return (v - c) / 6 / diff + 1 / 2;
137846
- };
137847
- if (diff === 0) {
137848
- h = 0;
137849
- s = 0;
137850
- } else {
137851
- s = diff / v;
137852
- rdif = diffc(r);
137853
- gdif = diffc(g);
137854
- bdif = diffc(b);
137855
- if (r === v) {
137856
- h = bdif - gdif;
137857
- } else if (g === v) {
137858
- h = 1 / 3 + rdif - bdif;
137859
- } else if (b === v) {
137860
- h = 2 / 3 + gdif - rdif;
137861
- }
137862
- if (h < 0) {
137863
- h += 1;
137864
- } else if (h > 1) {
137865
- h -= 1;
137866
- }
137867
- }
137868
- return [h * 360, s * 100, v * 100];
137869
- };
137870
- convert.rgb.hwb = function (rgb) {
137871
- const r = rgb[0];
137872
- const g = rgb[1];
137873
- let b = rgb[2];
137874
- const h = convert.rgb.hsl(rgb)[0];
137875
- const w = (1 / 255) * Math.min(r, Math.min(g, b));
137876
- b = 1 - (1 / 255) * Math.max(r, Math.max(g, b));
137877
- return [h, w * 100, b * 100];
137878
- };
137879
- convert.rgb.cmyk = function (rgb) {
137880
- const r = rgb[0] / 255;
137881
- const g = rgb[1] / 255;
137882
- const b = rgb[2] / 255;
137883
- const k = Math.min(1 - r, 1 - g, 1 - b);
137884
- const c = (1 - r - k) / (1 - k) || 0;
137885
- const m = (1 - g - k) / (1 - k) || 0;
137886
- const y = (1 - b - k) / (1 - k) || 0;
137887
- return [c * 100, m * 100, y * 100, k * 100];
137888
- };
137889
- function comparativeDistance(x, y) {
137890
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
137891
- }
137892
- convert.rgb.keyword = function (rgb) {
137893
- const reversed = reverseKeywords[rgb];
137894
- if (reversed) {
137895
- return reversed;
137896
- }
137897
- let currentClosestDistance = Infinity;
137898
- let currentClosestKeyword;
137899
- for (const keyword of Object.keys(cssKeywords)) {
137900
- const value = cssKeywords[keyword];
137901
- const distance = comparativeDistance(rgb, value);
137902
- if (distance < currentClosestDistance) {
137903
- currentClosestDistance = distance;
137904
- currentClosestKeyword = keyword;
137905
- }
137906
- }
137907
- return currentClosestKeyword;
137908
- };
137909
- convert.keyword.rgb = function (keyword) {
137910
- return cssKeywords[keyword];
137911
- };
137912
- convert.rgb.xyz = function (rgb) {
137913
- let r = rgb[0] / 255;
137914
- let g = rgb[1] / 255;
137915
- let b = rgb[2] / 255;
137916
- r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
137917
- g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
137918
- b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
137919
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
137920
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
137921
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
137922
- return [x * 100, y * 100, z * 100];
137923
- };
137924
- convert.rgb.lab = function (rgb) {
137925
- const xyz = convert.rgb.xyz(rgb);
137926
- let x = xyz[0];
137927
- let y = xyz[1];
137928
- let z = xyz[2];
137929
- x /= 95.047;
137930
- y /= 100;
137931
- z /= 108.883;
137932
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
137933
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
137934
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
137935
- const l = 116 * y - 16;
137936
- const a = 500 * (x - y);
137937
- const b = 200 * (y - z);
137938
- return [l, a, b];
137939
- };
137940
- convert.hsl.rgb = function (hsl) {
137941
- const h = hsl[0] / 360;
137942
- const s = hsl[1] / 100;
137943
- const l = hsl[2] / 100;
137944
- let t2;
137945
- let t3;
137946
- let val;
137947
- if (s === 0) {
137948
- val = l * 255;
137949
- return [val, val, val];
137950
- }
137951
- if (l < 0.5) {
137952
- t2 = l * (1 + s);
137953
- } else {
137954
- t2 = l + s - l * s;
137955
- }
137956
- const t1 = 2 * l - t2;
137957
- const rgb = [0, 0, 0];
137958
- for (let i = 0; i < 3; i++) {
137959
- t3 = h + (1 / 3) * -(i - 1);
137960
- if (t3 < 0) {
137961
- t3++;
137962
- }
137963
- if (t3 > 1) {
137964
- t3--;
137965
- }
137966
- if (6 * t3 < 1) {
137967
- val = t1 + (t2 - t1) * 6 * t3;
137968
- } else if (2 * t3 < 1) {
137969
- val = t2;
137970
- } else if (3 * t3 < 2) {
137971
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
137972
- } else {
137973
- val = t1;
137974
- }
137975
- rgb[i] = val * 255;
137976
- }
137977
- return rgb;
137978
- };
137979
- convert.hsl.hsv = function (hsl) {
137980
- const h = hsl[0];
137981
- let s = hsl[1] / 100;
137982
- let l = hsl[2] / 100;
137983
- let smin = s;
137984
- const lmin = Math.max(l, 0.01);
137985
- l *= 2;
137986
- s *= l <= 1 ? l : 2 - l;
137987
- smin *= lmin <= 1 ? lmin : 2 - lmin;
137988
- const v = (l + s) / 2;
137989
- const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
137990
- return [h, sv * 100, v * 100];
137991
- };
137992
- convert.hsv.rgb = function (hsv) {
137993
- const h = hsv[0] / 60;
137994
- const s = hsv[1] / 100;
137995
- let v = hsv[2] / 100;
137996
- const hi = Math.floor(h) % 6;
137997
- const f = h - Math.floor(h);
137998
- const p = 255 * v * (1 - s);
137999
- const q = 255 * v * (1 - s * f);
138000
- const t = 255 * v * (1 - s * (1 - f));
138001
- v *= 255;
138002
- switch (hi) {
138003
- case 0:
138004
- return [v, t, p];
138005
- case 1:
138006
- return [q, v, p];
138007
- case 2:
138008
- return [p, v, t];
138009
- case 3:
138010
- return [p, q, v];
138011
- case 4:
138012
- return [t, p, v];
138013
- case 5:
138014
- return [v, p, q];
138015
- }
138016
- };
138017
- convert.hsv.hsl = function (hsv) {
138018
- const h = hsv[0];
138019
- const s = hsv[1] / 100;
138020
- const v = hsv[2] / 100;
138021
- const vmin = Math.max(v, 0.01);
138022
- let sl;
138023
- let l;
138024
- l = (2 - s) * v;
138025
- const lmin = (2 - s) * vmin;
138026
- sl = s * vmin;
138027
- sl /= lmin <= 1 ? lmin : 2 - lmin;
138028
- sl = sl || 0;
138029
- l /= 2;
138030
- return [h, sl * 100, l * 100];
138031
- };
138032
- convert.hwb.rgb = function (hwb) {
138033
- const h = hwb[0] / 360;
138034
- let wh = hwb[1] / 100;
138035
- let bl = hwb[2] / 100;
138036
- const ratio = wh + bl;
138037
- let f;
138038
- if (ratio > 1) {
138039
- wh /= ratio;
138040
- bl /= ratio;
138041
- }
138042
- const i = Math.floor(6 * h);
138043
- const v = 1 - bl;
138044
- f = 6 * h - i;
138045
- if ((i & 1) !== 0) {
138046
- f = 1 - f;
138047
- }
138048
- const n = wh + f * (v - wh);
138049
- let r;
138050
- let g;
138051
- let b;
138052
- switch (i) {
138053
- default:
138054
- case 6:
138055
- case 0:
138056
- r = v;
138057
- g = n;
138058
- b = wh;
138059
- break;
138060
- case 1:
138061
- r = n;
138062
- g = v;
138063
- b = wh;
138064
- break;
138065
- case 2:
138066
- r = wh;
138067
- g = v;
138068
- b = n;
138069
- break;
138070
- case 3:
138071
- r = wh;
138072
- g = n;
138073
- b = v;
138074
- break;
138075
- case 4:
138076
- r = n;
138077
- g = wh;
138078
- b = v;
138079
- break;
138080
- case 5:
138081
- r = v;
138082
- g = wh;
138083
- b = n;
138084
- break;
138085
- }
138086
- return [r * 255, g * 255, b * 255];
138087
- };
138088
- convert.cmyk.rgb = function (cmyk) {
138089
- const c = cmyk[0] / 100;
138090
- const m = cmyk[1] / 100;
138091
- const y = cmyk[2] / 100;
138092
- const k = cmyk[3] / 100;
138093
- const r = 1 - Math.min(1, c * (1 - k) + k);
138094
- const g = 1 - Math.min(1, m * (1 - k) + k);
138095
- const b = 1 - Math.min(1, y * (1 - k) + k);
138096
- return [r * 255, g * 255, b * 255];
138097
- };
138098
- convert.xyz.rgb = function (xyz) {
138099
- const x = xyz[0] / 100;
138100
- const y = xyz[1] / 100;
138101
- const z = xyz[2] / 100;
138102
- let r;
138103
- let g;
138104
- let b;
138105
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
138106
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
138107
- b = x * 0.0557 + y * -0.204 + z * 1.057;
138108
- r = r > 0.0031308 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
138109
- g = g > 0.0031308 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
138110
- b = b > 0.0031308 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
138111
- r = Math.min(Math.max(0, r), 1);
138112
- g = Math.min(Math.max(0, g), 1);
138113
- b = Math.min(Math.max(0, b), 1);
138114
- return [r * 255, g * 255, b * 255];
138115
- };
138116
- convert.xyz.lab = function (xyz) {
138117
- let x = xyz[0];
138118
- let y = xyz[1];
138119
- let z = xyz[2];
138120
- x /= 95.047;
138121
- y /= 100;
138122
- z /= 108.883;
138123
- x = x > 0.008856 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
138124
- y = y > 0.008856 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
138125
- z = z > 0.008856 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
138126
- const l = 116 * y - 16;
138127
- const a = 500 * (x - y);
138128
- const b = 200 * (y - z);
138129
- return [l, a, b];
138130
- };
138131
- convert.lab.xyz = function (lab) {
138132
- const l = lab[0];
138133
- const a = lab[1];
138134
- const b = lab[2];
138135
- let x;
138136
- let y;
138137
- let z;
138138
- y = (l + 16) / 116;
138139
- x = a / 500 + y;
138140
- z = y - b / 200;
138141
- const y2 = y ** 3;
138142
- const x2 = x ** 3;
138143
- const z2 = z ** 3;
138144
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
138145
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
138146
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
138147
- x *= 95.047;
138148
- y *= 100;
138149
- z *= 108.883;
138150
- return [x, y, z];
138151
- };
138152
- convert.lab.lch = function (lab) {
138153
- const l = lab[0];
138154
- const a = lab[1];
138155
- const b = lab[2];
138156
- let h;
138157
- const hr = Math.atan2(b, a);
138158
- h = (hr * 360) / 2 / Math.PI;
138159
- if (h < 0) {
138160
- h += 360;
138161
- }
138162
- const c = Math.sqrt(a * a + b * b);
138163
- return [l, c, h];
138164
- };
138165
- convert.lch.lab = function (lch) {
138166
- const l = lch[0];
138167
- const c = lch[1];
138168
- const h = lch[2];
138169
- const hr = (h / 360) * 2 * Math.PI;
138170
- const a = c * Math.cos(hr);
138171
- const b = c * Math.sin(hr);
138172
- return [l, a, b];
138173
- };
138174
- convert.rgb.ansi16 = function (args, saturation = null) {
138175
- const [r, g, b] = args;
138176
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
138177
- value = Math.round(value / 50);
138178
- if (value === 0) {
138179
- return 30;
138180
- }
138181
- let ansi =
138182
- 30 +
138183
- ((Math.round(b / 255) << 2) |
138184
- (Math.round(g / 255) << 1) |
138185
- Math.round(r / 255));
138186
- if (value === 2) {
138187
- ansi += 60;
138188
- }
138189
- return ansi;
138190
- };
138191
- convert.hsv.ansi16 = function (args) {
138192
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
138193
- };
138194
- convert.rgb.ansi256 = function (args) {
138195
- const r = args[0];
138196
- const g = args[1];
138197
- const b = args[2];
138198
- if (r === g && g === b) {
138199
- if (r < 8) {
138200
- return 16;
138201
- }
138202
- if (r > 248) {
138203
- return 231;
138204
- }
138205
- return Math.round(((r - 8) / 247) * 24) + 232;
138206
- }
138207
- const ansi =
138208
- 16 +
138209
- 36 * Math.round((r / 255) * 5) +
138210
- 6 * Math.round((g / 255) * 5) +
138211
- Math.round((b / 255) * 5);
138212
- return ansi;
138213
- };
138214
- convert.ansi16.rgb = function (args) {
138215
- let color = args % 10;
138216
- if (color === 0 || color === 7) {
138217
- if (args > 50) {
138218
- color += 3.5;
138219
- }
138220
- color = (color / 10.5) * 255;
138221
- return [color, color, color];
138222
- }
138223
- const mult = (~~(args > 50) + 1) * 0.5;
138224
- const r = (color & 1) * mult * 255;
138225
- const g = ((color >> 1) & 1) * mult * 255;
138226
- const b = ((color >> 2) & 1) * mult * 255;
138227
- return [r, g, b];
138228
- };
138229
- convert.ansi256.rgb = function (args) {
138230
- if (args >= 232) {
138231
- const c = (args - 232) * 10 + 8;
138232
- return [c, c, c];
138233
- }
138234
- args -= 16;
138235
- let rem;
138236
- const r = (Math.floor(args / 36) / 5) * 255;
138237
- const g = (Math.floor((rem = args % 36) / 6) / 5) * 255;
138238
- const b = ((rem % 6) / 5) * 255;
138239
- return [r, g, b];
138240
- };
138241
- convert.rgb.hex = function (args) {
138242
- const integer =
138243
- ((Math.round(args[0]) & 255) << 16) +
138244
- ((Math.round(args[1]) & 255) << 8) +
138245
- (Math.round(args[2]) & 255);
138246
- const string = integer.toString(16).toUpperCase();
138247
- return '000000'.substring(string.length) + string;
138248
- };
138249
- convert.hex.rgb = function (args) {
138250
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
138251
- if (!match) {
138252
- return [0, 0, 0];
138253
- }
138254
- let colorString = match[0];
138255
- if (match[0].length === 3) {
138256
- colorString = colorString
138257
- .split('')
138258
- .map(char => char + char)
138259
- .join('');
138260
- }
138261
- const integer = parseInt(colorString, 16);
138262
- const r = (integer >> 16) & 255;
138263
- const g = (integer >> 8) & 255;
138264
- const b = integer & 255;
138265
- return [r, g, b];
138266
- };
138267
- convert.rgb.hcg = function (rgb) {
138268
- const r = rgb[0] / 255;
138269
- const g = rgb[1] / 255;
138270
- const b = rgb[2] / 255;
138271
- const max = Math.max(Math.max(r, g), b);
138272
- const min = Math.min(Math.min(r, g), b);
138273
- const chroma = max - min;
138274
- let grayscale;
138275
- let hue;
138276
- if (chroma < 1) {
138277
- grayscale = min / (1 - chroma);
138278
- } else {
138279
- grayscale = 0;
138280
- }
138281
- if (chroma <= 0) {
138282
- hue = 0;
138283
- } else if (max === r) {
138284
- hue = ((g - b) / chroma) % 6;
138285
- } else if (max === g) {
138286
- hue = 2 + (b - r) / chroma;
138287
- } else {
138288
- hue = 4 + (r - g) / chroma;
138289
- }
138290
- hue /= 6;
138291
- hue %= 1;
138292
- return [hue * 360, chroma * 100, grayscale * 100];
138293
- };
138294
- convert.hsl.hcg = function (hsl) {
138295
- const s = hsl[1] / 100;
138296
- const l = hsl[2] / 100;
138297
- const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
138298
- let f = 0;
138299
- if (c < 1) {
138300
- f = (l - 0.5 * c) / (1 - c);
138301
- }
138302
- return [hsl[0], c * 100, f * 100];
138303
- };
138304
- convert.hsv.hcg = function (hsv) {
138305
- const s = hsv[1] / 100;
138306
- const v = hsv[2] / 100;
138307
- const c = s * v;
138308
- let f = 0;
138309
- if (c < 1) {
138310
- f = (v - c) / (1 - c);
138311
- }
138312
- return [hsv[0], c * 100, f * 100];
138313
- };
138314
- convert.hcg.rgb = function (hcg) {
138315
- const h = hcg[0] / 360;
138316
- const c = hcg[1] / 100;
138317
- const g = hcg[2] / 100;
138318
- if (c === 0) {
138319
- return [g * 255, g * 255, g * 255];
138320
- }
138321
- const pure = [0, 0, 0];
138322
- const hi = (h % 1) * 6;
138323
- const v = hi % 1;
138324
- const w = 1 - v;
138325
- let mg = 0;
138326
- switch (Math.floor(hi)) {
138327
- case 0:
138328
- pure[0] = 1;
138329
- pure[1] = v;
138330
- pure[2] = 0;
138331
- break;
138332
- case 1:
138333
- pure[0] = w;
138334
- pure[1] = 1;
138335
- pure[2] = 0;
138336
- break;
138337
- case 2:
138338
- pure[0] = 0;
138339
- pure[1] = 1;
138340
- pure[2] = v;
138341
- break;
138342
- case 3:
138343
- pure[0] = 0;
138344
- pure[1] = w;
138345
- pure[2] = 1;
138346
- break;
138347
- case 4:
138348
- pure[0] = v;
138349
- pure[1] = 0;
138350
- pure[2] = 1;
138351
- break;
138352
- default:
138353
- pure[0] = 1;
138354
- pure[1] = 0;
138355
- pure[2] = w;
138356
- }
138357
- mg = (1 - c) * g;
138358
- return [
138359
- (c * pure[0] + mg) * 255,
138360
- (c * pure[1] + mg) * 255,
138361
- (c * pure[2] + mg) * 255,
138362
- ];
138363
- };
138364
- convert.hcg.hsv = function (hcg) {
138365
- const c = hcg[1] / 100;
138366
- const g = hcg[2] / 100;
138367
- const v = c + g * (1 - c);
138368
- let f = 0;
138369
- if (v > 0) {
138370
- f = c / v;
138371
- }
138372
- return [hcg[0], f * 100, v * 100];
138373
- };
138374
- convert.hcg.hsl = function (hcg) {
138375
- const c = hcg[1] / 100;
138376
- const g = hcg[2] / 100;
138377
- const l = g * (1 - c) + 0.5 * c;
138378
- let s = 0;
138379
- if (l > 0 && l < 0.5) {
138380
- s = c / (2 * l);
138381
- } else if (l >= 0.5 && l < 1) {
138382
- s = c / (2 * (1 - l));
138383
- }
138384
- return [hcg[0], s * 100, l * 100];
138385
- };
138386
- convert.hcg.hwb = function (hcg) {
138387
- const c = hcg[1] / 100;
138388
- const g = hcg[2] / 100;
138389
- const v = c + g * (1 - c);
138390
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
138391
- };
138392
- convert.hwb.hcg = function (hwb) {
138393
- const w = hwb[1] / 100;
138394
- const b = hwb[2] / 100;
138395
- const v = 1 - b;
138396
- const c = v - w;
138397
- let g = 0;
138398
- if (c < 1) {
138399
- g = (v - c) / (1 - c);
138400
- }
138401
- return [hwb[0], c * 100, g * 100];
138402
- };
138403
- convert.apple.rgb = function (apple) {
138404
- return [
138405
- (apple[0] / 65535) * 255,
138406
- (apple[1] / 65535) * 255,
138407
- (apple[2] / 65535) * 255,
138408
- ];
138409
- };
138410
- convert.rgb.apple = function (rgb) {
138411
- return [
138412
- (rgb[0] / 255) * 65535,
138413
- (rgb[1] / 255) * 65535,
138414
- (rgb[2] / 255) * 65535,
138415
- ];
138416
- };
138417
- convert.gray.rgb = function (args) {
138418
- return [
138419
- (args[0] / 100) * 255,
138420
- (args[0] / 100) * 255,
138421
- (args[0] / 100) * 255,
138422
- ];
138423
- };
138424
- convert.gray.hsl = function (args) {
138425
- return [0, 0, args[0]];
138426
- };
138427
- convert.gray.hsv = convert.gray.hsl;
138428
- convert.gray.hwb = function (gray) {
138429
- return [0, 100, gray[0]];
138430
- };
138431
- convert.gray.cmyk = function (gray) {
138432
- return [0, 0, 0, gray[0]];
138433
- };
138434
- convert.gray.lab = function (gray) {
138435
- return [gray[0], 0, 0];
138436
- };
138437
- convert.gray.hex = function (gray) {
138438
- const val = Math.round((gray[0] / 100) * 255) & 255;
138439
- const integer = (val << 16) + (val << 8) + val;
138440
- const string = integer.toString(16).toUpperCase();
138441
- return '000000'.substring(string.length) + string;
138442
- };
138443
- convert.rgb.gray = function (rgb) {
138444
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
138445
- return [(val / 255) * 100];
138446
- };
138447
- return conversions;
138448
- }
138449
- var route;
138450
- var hasRequiredRoute;
138451
- function requireRoute() {
138452
- if (hasRequiredRoute) return route;
138453
- hasRequiredRoute = 1;
138454
- const conversions = requireConversions();
138455
- function buildGraph() {
138456
- const graph = {};
138457
- const models = Object.keys(conversions);
138458
- for (let len = models.length, i = 0; i < len; i++) {
138459
- graph[models[i]] = {distance: -1, parent: null};
138460
- }
138461
- return graph;
138462
- }
138463
- function deriveBFS(fromModel) {
138464
- const graph = buildGraph();
138465
- const queue = [fromModel];
138466
- graph[fromModel].distance = 0;
138467
- while (queue.length) {
138468
- const current = queue.pop();
138469
- const adjacents = Object.keys(conversions[current]);
138470
- for (let len = adjacents.length, i = 0; i < len; i++) {
138471
- const adjacent = adjacents[i];
138472
- const node = graph[adjacent];
138473
- if (node.distance === -1) {
138474
- node.distance = graph[current].distance + 1;
138475
- node.parent = current;
138476
- queue.unshift(adjacent);
138477
- }
138478
- }
138479
- }
138480
- return graph;
138481
- }
138482
- function link(from, to) {
138483
- return function (args) {
138484
- return to(from(args));
138485
- };
138486
- }
138487
- function wrapConversion(toModel, graph) {
138488
- const path = [graph[toModel].parent, toModel];
138489
- let fn = conversions[graph[toModel].parent][toModel];
138490
- let cur = graph[toModel].parent;
138491
- while (graph[cur].parent) {
138492
- path.unshift(graph[cur].parent);
138493
- fn = link(conversions[graph[cur].parent][cur], fn);
138494
- cur = graph[cur].parent;
138495
- }
138496
- fn.conversion = path;
138497
- return fn;
138498
- }
138499
- route = function (fromModel) {
138500
- const graph = deriveBFS(fromModel);
138501
- const conversion = {};
138502
- const models = Object.keys(graph);
138503
- for (let len = models.length, i = 0; i < len; i++) {
138504
- const toModel = models[i];
138505
- const node = graph[toModel];
138506
- if (node.parent === null) {
138507
- continue;
138508
- }
138509
- conversion[toModel] = wrapConversion(toModel, graph);
138510
- }
138511
- return conversion;
138512
- };
138513
- return route;
138514
- }
138515
- var colorConvert;
138516
- var hasRequiredColorConvert;
138517
- function requireColorConvert() {
138518
- if (hasRequiredColorConvert) return colorConvert;
138519
- hasRequiredColorConvert = 1;
138520
- const conversions = requireConversions();
138521
- const route = requireRoute();
138522
- const convert = {};
138523
- const models = Object.keys(conversions);
138524
- function wrapRaw(fn) {
138525
- const wrappedFn = function (...args) {
138526
- const arg0 = args[0];
138527
- if (arg0 === undefined || arg0 === null) {
138528
- return arg0;
138529
- }
138530
- if (arg0.length > 1) {
138531
- args = arg0;
138532
- }
138533
- return fn(args);
138534
- };
138535
- if ('conversion' in fn) {
138536
- wrappedFn.conversion = fn.conversion;
138537
- }
138538
- return wrappedFn;
138539
- }
138540
- function wrapRounded(fn) {
138541
- const wrappedFn = function (...args) {
138542
- const arg0 = args[0];
138543
- if (arg0 === undefined || arg0 === null) {
138544
- return arg0;
138545
- }
138546
- if (arg0.length > 1) {
138547
- args = arg0;
138548
- }
138549
- const result = fn(args);
138550
- if (typeof result === 'object') {
138551
- for (let len = result.length, i = 0; i < len; i++) {
138552
- result[i] = Math.round(result[i]);
138553
- }
138554
- }
138555
- return result;
138556
- };
138557
- if ('conversion' in fn) {
138558
- wrappedFn.conversion = fn.conversion;
138559
- }
138560
- return wrappedFn;
138561
- }
138562
- models.forEach(fromModel => {
138563
- convert[fromModel] = {};
138564
- Object.defineProperty(convert[fromModel], 'channels', {
138565
- value: conversions[fromModel].channels,
138566
- });
138567
- Object.defineProperty(convert[fromModel], 'labels', {
138568
- value: conversions[fromModel].labels,
138569
- });
138570
- const routes = route(fromModel);
138571
- const routeModels = Object.keys(routes);
138572
- routeModels.forEach(toModel => {
138573
- const fn = routes[toModel];
138574
- convert[fromModel][toModel] = wrapRounded(fn);
138575
- convert[fromModel][toModel].raw = wrapRaw(fn);
138576
- });
138577
- });
138578
- colorConvert = convert;
138579
- return colorConvert;
138580
- }
138581
- ansiStyles$1.exports;
138582
- (function (module) {
138583
- const wrapAnsi16 =
138584
- (fn, offset) =>
138585
- (...args) => {
138586
- const code = fn(...args);
138587
- return `[${code + offset}m`;
138588
- };
138589
- const wrapAnsi256 =
138590
- (fn, offset) =>
138591
- (...args) => {
138592
- const code = fn(...args);
138593
- return `[${38 + offset};5;${code}m`;
138594
- };
138595
- const wrapAnsi16m =
138596
- (fn, offset) =>
138597
- (...args) => {
138598
- const rgb = fn(...args);
138599
- return `[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
138600
- };
138601
- const ansi2ansi = n => n;
138602
- const rgb2rgb = (r, g, b) => [r, g, b];
138603
- const setLazyProperty = (object, property, get) => {
138604
- Object.defineProperty(object, property, {
138605
- get: () => {
138606
- const value = get();
138607
- Object.defineProperty(object, property, {
138608
- value: value,
138609
- enumerable: true,
138610
- configurable: true,
138611
- });
138612
- return value;
138613
- },
138614
- enumerable: true,
138615
- configurable: true,
138616
- });
138617
- };
138618
- let colorConvert;
138619
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
138620
- if (colorConvert === undefined) {
138621
- colorConvert = requireColorConvert();
138622
- }
138623
- const offset = isBackground ? 10 : 0;
138624
- const styles = {};
138625
- for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
138626
- const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
138627
- if (sourceSpace === targetSpace) {
138628
- styles[name] = wrap(identity, offset);
138629
- } else if (typeof suite === 'object') {
138630
- styles[name] = wrap(suite[targetSpace], offset);
138631
- }
138632
- }
138633
- return styles;
138634
- };
138635
- function assembleStyles() {
138636
- const codes = new Map();
138637
- const styles = {
138638
- modifier: {
138639
- reset: [0, 0],
138640
- bold: [1, 22],
138641
- dim: [2, 22],
138642
- italic: [3, 23],
138643
- underline: [4, 24],
138644
- inverse: [7, 27],
138645
- hidden: [8, 28],
138646
- strikethrough: [9, 29],
138647
- },
138648
- color: {
138649
- black: [30, 39],
138650
- red: [31, 39],
138651
- green: [32, 39],
138652
- yellow: [33, 39],
138653
- blue: [34, 39],
138654
- magenta: [35, 39],
138655
- cyan: [36, 39],
138656
- white: [37, 39],
138657
- blackBright: [90, 39],
138658
- redBright: [91, 39],
138659
- greenBright: [92, 39],
138660
- yellowBright: [93, 39],
138661
- blueBright: [94, 39],
138662
- magentaBright: [95, 39],
138663
- cyanBright: [96, 39],
138664
- whiteBright: [97, 39],
138665
- },
138666
- bgColor: {
138667
- bgBlack: [40, 49],
138668
- bgRed: [41, 49],
138669
- bgGreen: [42, 49],
138670
- bgYellow: [43, 49],
138671
- bgBlue: [44, 49],
138672
- bgMagenta: [45, 49],
138673
- bgCyan: [46, 49],
138674
- bgWhite: [47, 49],
138675
- bgBlackBright: [100, 49],
138676
- bgRedBright: [101, 49],
138677
- bgGreenBright: [102, 49],
138678
- bgYellowBright: [103, 49],
138679
- bgBlueBright: [104, 49],
138680
- bgMagentaBright: [105, 49],
138681
- bgCyanBright: [106, 49],
138682
- bgWhiteBright: [107, 49],
138683
- },
138684
- };
138685
- styles.color.gray = styles.color.blackBright;
138686
- styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
138687
- styles.color.grey = styles.color.blackBright;
138688
- styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
138689
- for (const [groupName, group] of Object.entries(styles)) {
138690
- for (const [styleName, style] of Object.entries(group)) {
138691
- styles[styleName] = {open: `[${style[0]}m`, close: `[${style[1]}m`};
138692
- group[styleName] = styles[styleName];
138693
- codes.set(style[0], style[1]);
138694
- }
138695
- Object.defineProperty(styles, groupName, {
138696
- value: group,
138697
- enumerable: false,
138698
- });
138699
- }
138700
- Object.defineProperty(styles, 'codes', {value: codes, enumerable: false});
138701
- styles.color.close = '';
138702
- styles.bgColor.close = '';
138703
- setLazyProperty(styles.color, 'ansi', () =>
138704
- makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)
138705
- );
138706
- setLazyProperty(styles.color, 'ansi256', () =>
138707
- makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)
138708
- );
138709
- setLazyProperty(styles.color, 'ansi16m', () =>
138710
- makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)
138711
- );
138712
- setLazyProperty(styles.bgColor, 'ansi', () =>
138713
- makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)
138714
- );
138715
- setLazyProperty(styles.bgColor, 'ansi256', () =>
138716
- makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)
138717
- );
138718
- setLazyProperty(styles.bgColor, 'ansi16m', () =>
138719
- makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)
138720
- );
138721
- return styles;
138722
- }
138723
- Object.defineProperty(module, 'exports', {
138724
- enumerable: true,
138725
- get: assembleStyles,
138726
- });
138727
- })(ansiStyles$1);
138728
- var ansiStylesExports = ansiStyles$1.exports;
138729
- var hasFlag$1 = (flag, argv = process.argv) => {
138730
- const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
138731
- const position = argv.indexOf(prefix + flag);
138732
- const terminatorPosition = argv.indexOf('--');
138733
- return (
138734
- position !== -1 &&
138735
- (terminatorPosition === -1 || position < terminatorPosition)
138736
- );
138737
- };
138738
- const os = require$$0$3;
138739
- const tty = require$$0$2;
138740
- const hasFlag = hasFlag$1;
138741
- const {env: env} = process;
138742
- let forceColor;
138743
- if (
138744
- hasFlag('no-color') ||
138745
- hasFlag('no-colors') ||
138746
- hasFlag('color=false') ||
138747
- hasFlag('color=never')
138748
- ) {
138749
- forceColor = 0;
138750
- } else if (
138751
- hasFlag('color') ||
138752
- hasFlag('colors') ||
138753
- hasFlag('color=true') ||
138754
- hasFlag('color=always')
138755
- ) {
138756
- forceColor = 1;
138757
- }
138758
- if ('FORCE_COLOR' in env) {
138759
- if (env.FORCE_COLOR === 'true') {
138760
- forceColor = 1;
138761
- } else if (env.FORCE_COLOR === 'false') {
138762
- forceColor = 0;
138763
- } else {
138764
- forceColor =
138765
- env.FORCE_COLOR.length === 0
138766
- ? 1
138767
- : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
138768
- }
138769
- }
138770
- function translateLevel(level) {
138771
- if (level === 0) {
138772
- return false;
138773
- }
138774
- return {level: level, hasBasic: true, has256: level >= 2, has16m: level >= 3};
138775
- }
138776
- function supportsColor(haveStream, streamIsTTY) {
138777
- if (forceColor === 0) {
138778
- return 0;
138779
- }
138780
- if (
138781
- hasFlag('color=16m') ||
138782
- hasFlag('color=full') ||
138783
- hasFlag('color=truecolor')
138784
- ) {
138785
- return 3;
138786
- }
138787
- if (hasFlag('color=256')) {
138788
- return 2;
138789
- }
138790
- if (haveStream && !streamIsTTY && forceColor === undefined) {
138791
- return 0;
138792
- }
138793
- const min = forceColor || 0;
138794
- if (env.TERM === 'dumb') {
138795
- return min;
138796
- }
138797
- if (process.platform === 'win32') {
138798
- const osRelease = os.release().split('.');
138799
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
138800
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
138801
- }
138802
- return 1;
138803
- }
138804
- if ('CI' in env) {
138805
- if (
138806
- [
138807
- 'TRAVIS',
138808
- 'CIRCLECI',
138809
- 'APPVEYOR',
138810
- 'GITLAB_CI',
138811
- 'GITHUB_ACTIONS',
138812
- 'BUILDKITE',
138813
- ].some(sign => sign in env) ||
138814
- env.CI_NAME === 'codeship'
138815
- ) {
138816
- return 1;
138817
- }
138818
- return min;
138819
- }
138820
- if ('TEAMCITY_VERSION' in env) {
138821
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
138822
- }
138823
- if (env.COLORTERM === 'truecolor') {
138824
- return 3;
138825
- }
138826
- if ('TERM_PROGRAM' in env) {
138827
- const version = parseInt(
138828
- (env.TERM_PROGRAM_VERSION || '').split('.')[0],
138829
- 10
138830
- );
138831
- switch (env.TERM_PROGRAM) {
138832
- case 'iTerm.app':
138833
- return version >= 3 ? 3 : 2;
138834
- case 'Apple_Terminal':
138835
- return 2;
138836
- }
138837
- }
138838
- if (/-256(color)?$/i.test(env.TERM)) {
138839
- return 2;
138840
- }
138841
- if (
138842
- /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)
138843
- ) {
138844
- return 1;
138845
- }
138846
- if ('COLORTERM' in env) {
138847
- return 1;
138848
- }
138849
- return min;
138850
- }
138851
- function getSupportLevel(stream) {
138852
- const level = supportsColor(stream, stream && stream.isTTY);
138853
- return translateLevel(level);
138854
- }
138855
- var supportsColor_1 = {
138856
- supportsColor: getSupportLevel,
138857
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
138858
- stderr: translateLevel(supportsColor(true, tty.isatty(2))),
138859
- };
138860
- const stringReplaceAll$1 = (string, substring, replacer) => {
138861
- let index = string.indexOf(substring);
138862
- if (index === -1) {
138863
- return string;
138864
- }
138865
- const substringLength = substring.length;
138866
- let endIndex = 0;
138867
- let returnValue = '';
138868
- do {
138869
- returnValue +=
138870
- string.substr(endIndex, index - endIndex) + substring + replacer;
138871
- endIndex = index + substringLength;
138872
- index = string.indexOf(substring, endIndex);
138873
- } while (index !== -1);
138874
- returnValue += string.substr(endIndex);
138875
- return returnValue;
138876
- };
138877
- const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
138878
- let endIndex = 0;
138879
- let returnValue = '';
138880
- do {
138881
- const gotCR = string[index - 1] === '\r';
138882
- returnValue +=
138883
- string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) +
138884
- prefix +
138885
- (gotCR ? '\r\n' : '\n') +
138886
- postfix;
138887
- endIndex = index + 1;
138888
- index = string.indexOf('\n', endIndex);
138889
- } while (index !== -1);
138890
- returnValue += string.substr(endIndex);
138891
- return returnValue;
138892
- };
138893
- var util = {
138894
- stringReplaceAll: stringReplaceAll$1,
138895
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1,
138896
- };
138897
- var templates;
138898
- var hasRequiredTemplates;
138899
- function requireTemplates() {
138900
- if (hasRequiredTemplates) return templates;
138901
- hasRequiredTemplates = 1;
138902
- const TEMPLATE_REGEX =
138903
- /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
138904
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
138905
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
138906
- const ESCAPE_REGEX =
138907
- /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
138908
- const ESCAPES = new Map([
138909
- ['n', '\n'],
138910
- ['r', '\r'],
138911
- ['t', '\t'],
138912
- ['b', '\b'],
138913
- ['f', '\f'],
138914
- ['v', '\v'],
138915
- ['0', '\0'],
138916
- ['\\', '\\'],
138917
- ['e', ''],
138918
- ['a', ''],
138919
- ]);
138920
- function unescape(c) {
138921
- const u = c[0] === 'u';
138922
- const bracket = c[1] === '{';
138923
- if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
138924
- return String.fromCharCode(parseInt(c.slice(1), 16));
138925
- }
138926
- if (u && bracket) {
138927
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
138928
- }
138929
- return ESCAPES.get(c) || c;
138930
- }
138931
- function parseArguments(name, arguments_) {
138932
- const results = [];
138933
- const chunks = arguments_.trim().split(/\s*,\s*/g);
138934
- let matches;
138935
- for (const chunk of chunks) {
138936
- const number = Number(chunk);
138937
- if (!Number.isNaN(number)) {
138938
- results.push(number);
138939
- } else if ((matches = chunk.match(STRING_REGEX))) {
138940
- results.push(
138941
- matches[2].replace(ESCAPE_REGEX, (m, escape, character) =>
138942
- escape ? unescape(escape) : character
138943
- )
138944
- );
138945
- } else {
138946
- throw new Error(
138947
- `Invalid Chalk template style argument: ${chunk} (in style '${name}')`
138948
- );
138949
- }
138950
- }
138951
- return results;
138952
- }
138953
- function parseStyle(style) {
138954
- STYLE_REGEX.lastIndex = 0;
138955
- const results = [];
138956
- let matches;
138957
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
138958
- const name = matches[1];
138959
- if (matches[2]) {
138960
- const args = parseArguments(name, matches[2]);
138961
- results.push([name].concat(args));
138962
- } else {
138963
- results.push([name]);
138964
- }
138965
- }
138966
- return results;
138967
- }
138968
- function buildStyle(chalk, styles) {
138969
- const enabled = {};
138970
- for (const layer of styles) {
138971
- for (const style of layer.styles) {
138972
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
138973
- }
138974
- }
138975
- let current = chalk;
138976
- for (const [styleName, styles] of Object.entries(enabled)) {
138977
- if (!Array.isArray(styles)) {
138978
- continue;
138979
- }
138980
- if (!(styleName in current)) {
138981
- throw new Error(`Unknown Chalk style: ${styleName}`);
138982
- }
138983
- current =
138984
- styles.length > 0 ? current[styleName](...styles) : current[styleName];
138985
- }
138986
- return current;
138987
- }
138988
- templates = (chalk, temporary) => {
138989
- const styles = [];
138990
- const chunks = [];
138991
- let chunk = [];
138992
- temporary.replace(
138993
- TEMPLATE_REGEX,
138994
- (m, escapeCharacter, inverse, style, close, character) => {
138995
- if (escapeCharacter) {
138996
- chunk.push(unescape(escapeCharacter));
138997
- } else if (style) {
138998
- const string = chunk.join('');
138999
- chunk = [];
139000
- chunks.push(
139001
- styles.length === 0 ? string : buildStyle(chalk, styles)(string)
139002
- );
139003
- styles.push({inverse: inverse, styles: parseStyle(style)});
139004
- } else if (close) {
139005
- if (styles.length === 0) {
139006
- throw new Error('Found extraneous } in Chalk template literal');
139007
- }
139008
- chunks.push(buildStyle(chalk, styles)(chunk.join('')));
139009
- chunk = [];
139010
- styles.pop();
139011
- } else {
139012
- chunk.push(character);
139013
- }
139014
- }
139015
- );
139016
- chunks.push(chunk.join(''));
139017
- if (styles.length > 0) {
139018
- const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
139019
- throw new Error(errMessage);
139020
- }
139021
- return chunks.join('');
139022
- };
139023
- return templates;
139024
- }
139025
- const ansiStyles = ansiStylesExports;
139026
- const {stdout: stdoutColor, stderr: stderrColor} = supportsColor_1;
139027
- const {
139028
- stringReplaceAll: stringReplaceAll,
139029
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex,
139030
- } = util;
139031
- const {isArray: isArray} = Array;
139032
- const levelMapping = ['ansi', 'ansi', 'ansi256', 'ansi16m'];
139033
- const styles = Object.create(null);
139034
- const applyOptions = (object, options = {}) => {
139035
- if (
139036
- options.level &&
139037
- !(
139038
- Number.isInteger(options.level) &&
139039
- options.level >= 0 &&
139040
- options.level <= 3
139041
- )
139042
- ) {
139043
- throw new Error('The `level` option should be an integer from 0 to 3');
139044
- }
139045
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
139046
- object.level = options.level === undefined ? colorLevel : options.level;
139047
- };
139048
- class ChalkClass {
139049
- constructor(options) {
139050
- return chalkFactory(options);
139051
- }
139052
- }
139053
- const chalkFactory = options => {
139054
- const chalk = {};
139055
- applyOptions(chalk, options);
139056
- chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
139057
- Object.setPrototypeOf(chalk, Chalk.prototype);
139058
- Object.setPrototypeOf(chalk.template, chalk);
139059
- chalk.template.constructor = () => {
139060
- throw new Error(
139061
- '`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'
139062
- );
139063
- };
139064
- chalk.template.Instance = ChalkClass;
139065
- return chalk.template;
139066
- };
139067
- function Chalk(options) {
139068
- return chalkFactory(options);
139069
- }
139070
- for (const [styleName, style] of Object.entries(ansiStyles)) {
139071
- styles[styleName] = {
139072
- get() {
139073
- const builder = createBuilder(
139074
- this,
139075
- createStyler(style.open, style.close, this._styler),
139076
- this._isEmpty
139077
- );
139078
- Object.defineProperty(this, styleName, {value: builder});
139079
- return builder;
139080
- },
139081
- };
139082
- }
139083
- styles.visible = {
139084
- get() {
139085
- const builder = createBuilder(this, this._styler, true);
139086
- Object.defineProperty(this, 'visible', {value: builder});
139087
- return builder;
139088
- },
139089
- };
139090
- const usedModels = [
139091
- 'rgb',
139092
- 'hex',
139093
- 'keyword',
139094
- 'hsl',
139095
- 'hsv',
139096
- 'hwb',
139097
- 'ansi',
139098
- 'ansi256',
139099
- ];
139100
- for (const model of usedModels) {
139101
- styles[model] = {
139102
- get() {
139103
- const {level: level} = this;
139104
- return function (...arguments_) {
139105
- const styler = createStyler(
139106
- ansiStyles.color[levelMapping[level]][model](...arguments_),
139107
- ansiStyles.color.close,
139108
- this._styler
139109
- );
139110
- return createBuilder(this, styler, this._isEmpty);
139111
- };
139112
- },
139113
- };
139114
- }
139115
- for (const model of usedModels) {
139116
- const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
139117
- styles[bgModel] = {
139118
- get() {
139119
- const {level: level} = this;
139120
- return function (...arguments_) {
139121
- const styler = createStyler(
139122
- ansiStyles.bgColor[levelMapping[level]][model](...arguments_),
139123
- ansiStyles.bgColor.close,
139124
- this._styler
139125
- );
139126
- return createBuilder(this, styler, this._isEmpty);
139127
- };
139128
- },
139129
- };
139130
- }
139131
- const proto = Object.defineProperties(() => {}, {
139132
- ...styles,
139133
- level: {
139134
- enumerable: true,
139135
- get() {
139136
- return this._generator.level;
139137
- },
139138
- set(level) {
139139
- this._generator.level = level;
139140
- },
139141
- },
139142
- });
139143
- const createStyler = (open, close, parent) => {
139144
- let openAll;
139145
- let closeAll;
139146
- if (parent === undefined) {
139147
- openAll = open;
139148
- closeAll = close;
139149
- } else {
139150
- openAll = parent.openAll + open;
139151
- closeAll = close + parent.closeAll;
139152
- }
139153
- return {
139154
- open: open,
139155
- close: close,
139156
- openAll: openAll,
139157
- closeAll: closeAll,
139158
- parent: parent,
139159
- };
139160
- };
139161
- const createBuilder = (self, _styler, _isEmpty) => {
139162
- const builder = (...arguments_) => {
139163
- if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
139164
- return applyStyle(builder, chalkTag(builder, ...arguments_));
139165
- }
139166
- return applyStyle(
139167
- builder,
139168
- arguments_.length === 1 ? '' + arguments_[0] : arguments_.join(' ')
139169
- );
139170
- };
139171
- Object.setPrototypeOf(builder, proto);
139172
- builder._generator = self;
139173
- builder._styler = _styler;
139174
- builder._isEmpty = _isEmpty;
139175
- return builder;
139176
- };
139177
- const applyStyle = (self, string) => {
139178
- if (self.level <= 0 || !string) {
139179
- return self._isEmpty ? '' : string;
139180
- }
139181
- let styler = self._styler;
139182
- if (styler === undefined) {
139183
- return string;
139184
- }
139185
- const {openAll: openAll, closeAll: closeAll} = styler;
139186
- if (string.indexOf('') !== -1) {
139187
- while (styler !== undefined) {
139188
- string = stringReplaceAll(string, styler.close, styler.open);
139189
- styler = styler.parent;
139190
- }
139191
- }
139192
- const lfIndex = string.indexOf('\n');
139193
- if (lfIndex !== -1) {
139194
- string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
139195
- }
139196
- return openAll + string + closeAll;
139197
- };
139198
- let template;
139199
- const chalkTag = (chalk, ...strings) => {
139200
- const [firstString] = strings;
139201
- if (!isArray(firstString) || !isArray(firstString.raw)) {
139202
- return strings.join(' ');
139203
- }
139204
- const arguments_ = strings.slice(1);
139205
- const parts = [firstString.raw[0]];
139206
- for (let i = 1; i < firstString.length; i++) {
139207
- parts.push(
139208
- String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
139209
- String(firstString.raw[i])
139210
- );
139211
- }
139212
- if (template === undefined) {
139213
- template = requireTemplates();
139214
- }
139215
- return template(chalk, parts.join(''));
139216
- };
139217
- Object.defineProperties(Chalk.prototype, styles);
139218
- const chalk = Chalk();
139219
- chalk.supportsColor = stdoutColor;
139220
- chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0});
139221
- chalk.stderr.supportsColor = stderrColor;
139222
- function logDebug(step, value) {}
139223
- function logCodegenFunction(step, fn) {}
139224
- function logHIRFunction(step, fn) {}
139225
- function logReactiveFunction(step, fn) {}
139226
137645
  function inferReactiveScopeVariables(fn) {
137646
+ var _a, _b;
139227
137647
  const scopeIdentifiers = findDisjointMutableValues(fn);
139228
137648
  const scopes = new Map();
139229
137649
  scopeIdentifiers.forEach((identifier, groupIdentifier) => {
@@ -139272,6 +137692,16 @@ function inferReactiveScopeVariables(fn) {
139272
137692
  maxInstruction === 0 ||
139273
137693
  scope.range.end > maxInstruction + 1
139274
137694
  ) {
137695
+ (_b =
137696
+ (_a = fn.env.logger) === null || _a === void 0
137697
+ ? void 0
137698
+ : _a.debugLogIRs) === null || _b === void 0
137699
+ ? void 0
137700
+ : _b.call(_a, {
137701
+ kind: 'hir',
137702
+ name: 'InferReactiveScopeVariables (invalid scope)',
137703
+ value: fn,
137704
+ });
139275
137705
  CompilerError.invariant(false, {
139276
137706
  reason: `Invalid mutable range for scope`,
139277
137707
  loc: GeneratedSource,
@@ -142609,7 +141039,7 @@ var _Context_nextScheduleId,
142609
141039
  _Context_catchHandlers,
142610
141040
  _Context_controlFlowStack;
142611
141041
  function buildReactiveFunction(fn) {
142612
- const cx = new Context$2(fn.body);
141042
+ const cx = new Context$3(fn.body);
142613
141043
  const driver = new Driver(cx);
142614
141044
  const body = driver.traverseBlock(cx.block(fn.body.entry));
142615
141045
  return {
@@ -143657,7 +142087,7 @@ class Driver {
143657
142087
  };
143658
142088
  }
143659
142089
  }
143660
- let Context$2 = class Context {
142090
+ let Context$3 = class Context {
143661
142091
  constructor(ir) {
143662
142092
  _Context_nextScheduleId.set(this, 0);
143663
142093
  this.emitted = new Set();
@@ -144045,7 +142475,7 @@ function codegenFunction(
144045
142475
  {uniqueIdentifiers: uniqueIdentifiers, fbtOperands: fbtOperands}
144046
142476
  ) {
144047
142477
  var _a, _b, _c;
144048
- const cx = new Context$1(
142478
+ const cx = new Context$2(
144049
142479
  fn.env,
144050
142480
  (_a = fn.id) !== null && _a !== void 0 ? _a : '[[ anonymous ]]',
144051
142481
  uniqueIdentifiers,
@@ -144210,7 +142640,7 @@ function codegenFunction(
144210
142640
  pruneHoistedContexts(reactiveFunction);
144211
142641
  const identifiers = renameVariables(reactiveFunction);
144212
142642
  const codegen = codegenReactiveFunction(
144213
- new Context$1(
142643
+ new Context$2(
144214
142644
  cx.env,
144215
142645
  (_c = reactiveFunction.id) !== null && _c !== void 0
144216
142646
  ? _c
@@ -144268,6 +142698,7 @@ function codegenReactiveFunction(cx, fn) {
144268
142698
  prunedMemoValues: countMemoBlockVisitor.prunedMemoValues,
144269
142699
  outlined: [],
144270
142700
  hasLoweredContextAccess: fn.env.hasLoweredContextAccess,
142701
+ hasFireRewrite: fn.env.hasFireRewrite,
144271
142702
  });
144272
142703
  }
144273
142704
  class CountMemoBlockVisitor extends ReactiveFunctionVisitor {
@@ -144297,7 +142728,7 @@ function convertParameter(param) {
144297
142728
  return t__namespace.restElement(convertIdentifier(param.place.identifier));
144298
142729
  }
144299
142730
  }
144300
- let Context$1 = class Context {
142731
+ let Context$2 = class Context {
144301
142732
  constructor(env, fnName, uniqueIdentifiers, fbtOperands, temporaries = null) {
144302
142733
  _Context_nextCacheIndex.set(this, 0);
144303
142734
  _Context_declarations$1.set(this, new Set());
@@ -145632,7 +144063,7 @@ function codegenInstructionValue(cx, instrValue) {
145632
144063
  pruneUnusedLabels(reactiveFunction);
145633
144064
  pruneUnusedLValues(reactiveFunction);
145634
144065
  const fn = codegenReactiveFunction(
145635
- new Context$1(
144066
+ new Context$2(
145636
144067
  cx.env,
145637
144068
  (_e = reactiveFunction.id) !== null && _e !== void 0
145638
144069
  ? _e
@@ -145831,7 +144262,7 @@ function codegenInstructionValue(cx, instrValue) {
145831
144262
  pruneUnusedLValues(reactiveFunction);
145832
144263
  pruneHoistedContexts(reactiveFunction);
145833
144264
  const fn = codegenReactiveFunction(
145834
- new Context$1(
144265
+ new Context$2(
145835
144266
  cx.env,
145836
144267
  (_g = reactiveFunction.id) !== null && _g !== void 0
145837
144268
  ? _g
@@ -146428,7 +144859,7 @@ function mergeReactiveScopesThatInvalidateTogether(fn) {
146428
144859
  visitReactiveFunction(fn, lastUsageVisitor, undefined);
146429
144860
  visitReactiveFunction(fn, new Transform$4(lastUsageVisitor.lastUsage), null);
146430
144861
  }
146431
- function log$1(msg) {}
144862
+ function log(msg) {}
146432
144863
  class FindLastUsageVisitor extends ReactiveFunctionVisitor {
146433
144864
  constructor() {
146434
144865
  super(...arguments);
@@ -146481,7 +144912,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146481
144912
  switch (instr.kind) {
146482
144913
  case 'terminal': {
146483
144914
  if (current !== null) {
146484
- log$1(
144915
+ log(
146485
144916
  `Reset scope @${current.block.scope.id} from terminal [${instr.terminal.id}]`
146486
144917
  );
146487
144918
  reset();
@@ -146490,7 +144921,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146490
144921
  }
146491
144922
  case 'pruned-scope': {
146492
144923
  if (current !== null) {
146493
- log$1(
144924
+ log(
146494
144925
  `Reset scope @${current.block.scope.id} from pruned scope @${instr.scope.id}`
146495
144926
  );
146496
144927
  reset();
@@ -146526,7 +144957,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146526
144957
  current.lvalues.add(lvalue.identifier.declarationId);
146527
144958
  }
146528
144959
  } else {
146529
- log$1(
144960
+ log(
146530
144961
  `Reset scope @${current.block.scope.id} from StoreLocal in [${instr.instruction.id}]`
146531
144962
  );
146532
144963
  reset();
@@ -146536,7 +144967,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146536
144967
  }
146537
144968
  default: {
146538
144969
  if (current !== null) {
146539
- log$1(
144970
+ log(
146540
144971
  `Reset scope @${current.block.scope.id} from instruction [${instr.instruction.id}]`
146541
144972
  );
146542
144973
  reset();
@@ -146555,7 +144986,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146555
144986
  this.lastUsage
146556
144987
  )
146557
144988
  ) {
146558
- log$1(
144989
+ log(
146559
144990
  `Can merge scope @${current.block.scope.id} with @${instr.scope.id}`
146560
144991
  );
146561
144992
  current.block.scope.range.end = makeInstructionId(
@@ -146568,14 +144999,14 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146568
144999
  current.to = i + 1;
146569
145000
  current.lvalues.clear();
146570
145001
  if (!scopeIsEligibleForMerging(instr)) {
146571
- log$1(
145002
+ log(
146572
145003
  ` but scope @${instr.scope.id} doesnt guaranteed invalidate so it cannot merge further`
146573
145004
  );
146574
145005
  reset();
146575
145006
  }
146576
145007
  } else {
146577
145008
  if (current !== null) {
146578
- log$1(
145009
+ log(
146579
145010
  `Reset scope @${current.block.scope.id}, not mergeable with subsequent scope @${instr.scope.id}`
146580
145011
  );
146581
145012
  reset();
@@ -146583,7 +145014,7 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146583
145014
  if (scopeIsEligibleForMerging(instr)) {
146584
145015
  current = {block: instr, from: i, to: i + 1, lvalues: new Set()};
146585
145016
  } else {
146586
- log$1(
145017
+ log(
146587
145018
  `scope @${instr.scope.id} doesnt guaranteed invalidate so it cannot merge further`
146588
145019
  );
146589
145020
  }
@@ -146602,9 +145033,9 @@ let Transform$4 = class Transform extends ReactiveFunctionTransform {
146602
145033
  reset();
146603
145034
  }
146604
145035
  if (merged.length) {
146605
- log$1(`merged ${merged.length} scopes:`);
145036
+ log(`merged ${merged.length} scopes:`);
146606
145037
  for (const entry of merged) {
146607
- log$1(
145038
+ log(
146608
145039
  printReactiveScopeSummary(entry.block.scope) +
146609
145040
  ` from=${entry.from} to=${entry.to}`
146610
145041
  );
@@ -146659,7 +145090,7 @@ function areLValuesLastUsedByScope(scope, lvalues, lastUsage) {
146659
145090
  for (const lvalue of lvalues) {
146660
145091
  const lastUsedAt = lastUsage.get(lvalue);
146661
145092
  if (lastUsedAt >= scope.range.end) {
146662
- log$1(` lvalue ${lvalue} used after scope @${scope.id}, cannot merge`);
145093
+ log(` lvalue ${lvalue} used after scope @${scope.id}, cannot merge`);
146663
145094
  return false;
146664
145095
  }
146665
145096
  }
@@ -146700,8 +145131,8 @@ function canMergeScopes(current, next) {
146700
145131
  ) {
146701
145132
  return true;
146702
145133
  }
146703
- log$1(` ${printReactiveScopeSummary(current.scope)}`);
146704
- log$1(` ${printReactiveScopeSummary(next.scope)}`);
145134
+ log(` ${printReactiveScopeSummary(current.scope)}`);
145135
+ log(` ${printReactiveScopeSummary(next.scope)}`);
146705
145136
  return false;
146706
145137
  }
146707
145138
  function isAlwaysInvalidatingType(type) {
@@ -150805,6 +149236,7 @@ function analyseFunctions(func) {
150805
149236
  }
150806
149237
  }
150807
149238
  function lower(func) {
149239
+ var _a, _b;
150808
149240
  analyseFunctions(func);
150809
149241
  inferReferenceEffects(func, {isFunctionExpression: true});
150810
149242
  deadCodeElimination(func);
@@ -150812,6 +149244,12 @@ function lower(func) {
150812
149244
  rewriteInstructionKindsBasedOnReassignment(func);
150813
149245
  inferReactiveScopeVariables(func);
150814
149246
  inferMutableContextVariables(func);
149247
+ (_b =
149248
+ (_a = func.env.logger) === null || _a === void 0
149249
+ ? void 0
149250
+ : _a.debugLogIRs) === null || _b === void 0
149251
+ ? void 0
149252
+ : _b.call(_a, {kind: 'hir', name: 'AnalyseFunction (inner)', value: func});
150815
149253
  }
150816
149254
  function infer(loweredFunc, state, context) {
150817
149255
  const mutations = new Map();
@@ -153878,7 +152316,7 @@ function joinRefAccessTypes(...types) {
153878
152316
  );
153879
152317
  }
153880
152318
  function validateNoRefAccessInRenderImpl(fn, env) {
153881
- var _a, _b, _c, _d, _e, _f, _g, _h;
152319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
153882
152320
  let returnValues = [];
153883
152321
  let place;
153884
152322
  for (const param of fn.params) {
@@ -153951,31 +152389,41 @@ function validateNoRefAccessInRenderImpl(fn, env) {
153951
152389
  );
153952
152390
  break;
153953
152391
  }
153954
- case 'LoadContext':
153955
- case 'LoadLocal': {
152392
+ case 'TypeCastExpression': {
153956
152393
  env.set(
153957
152394
  instr.lvalue.identifier.id,
153958
- (_a = env.get(instr.value.place.identifier.id)) !== null &&
152395
+ (_a = env.get(instr.value.value.identifier.id)) !== null &&
153959
152396
  _a !== void 0
153960
152397
  ? _a
153961
152398
  : refTypeOfType(instr.lvalue)
153962
152399
  );
153963
152400
  break;
153964
152401
  }
153965
- case 'StoreContext':
153966
- case 'StoreLocal': {
152402
+ case 'LoadContext':
152403
+ case 'LoadLocal': {
153967
152404
  env.set(
153968
- instr.value.lvalue.place.identifier.id,
153969
- (_b = env.get(instr.value.value.identifier.id)) !== null &&
152405
+ instr.lvalue.identifier.id,
152406
+ (_b = env.get(instr.value.place.identifier.id)) !== null &&
153970
152407
  _b !== void 0
153971
152408
  ? _b
153972
- : refTypeOfType(instr.value.lvalue.place)
152409
+ : refTypeOfType(instr.lvalue)
153973
152410
  );
152411
+ break;
152412
+ }
152413
+ case 'StoreContext':
152414
+ case 'StoreLocal': {
153974
152415
  env.set(
153975
- instr.lvalue.identifier.id,
152416
+ instr.value.lvalue.place.identifier.id,
153976
152417
  (_c = env.get(instr.value.value.identifier.id)) !== null &&
153977
152418
  _c !== void 0
153978
152419
  ? _c
152420
+ : refTypeOfType(instr.value.lvalue.place)
152421
+ );
152422
+ env.set(
152423
+ instr.lvalue.identifier.id,
152424
+ (_d = env.get(instr.value.value.identifier.id)) !== null &&
152425
+ _d !== void 0
152426
+ ? _d
153979
152427
  : refTypeOfType(instr.lvalue)
153980
152428
  );
153981
152429
  break;
@@ -154072,8 +152520,8 @@ function validateNoRefAccessInRenderImpl(fn, env) {
154072
152520
  for (const operand of eachInstructionValueOperand(instr.value)) {
154073
152521
  validateNoDirectRefValueAccess(errors, operand, env);
154074
152522
  types.push(
154075
- (_d = env.get(operand.identifier.id)) !== null && _d !== void 0
154076
- ? _d
152523
+ (_e = env.get(operand.identifier.id)) !== null && _e !== void 0
152524
+ ? _e
154077
152525
  : {kind: 'None'}
154078
152526
  );
154079
152527
  }
@@ -154180,16 +152628,16 @@ function validateNoRefAccessInRenderImpl(fn, env) {
154180
152628
  }
154181
152629
  if (
154182
152630
  isUseRefType(instr.lvalue.identifier) &&
154183
- ((_e = env.get(instr.lvalue.identifier.id)) === null || _e === void 0
152631
+ ((_f = env.get(instr.lvalue.identifier.id)) === null || _f === void 0
154184
152632
  ? void 0
154185
- : _e.kind) !== 'Ref'
152633
+ : _f.kind) !== 'Ref'
154186
152634
  ) {
154187
152635
  env.set(
154188
152636
  instr.lvalue.identifier.id,
154189
152637
  joinRefAccessTypes(
154190
- (_f = env.get(instr.lvalue.identifier.id)) !== null &&
154191
- _f !== void 0
154192
- ? _f
152638
+ (_g = env.get(instr.lvalue.identifier.id)) !== null &&
152639
+ _g !== void 0
152640
+ ? _g
154193
152641
  : {kind: 'None'},
154194
152642
  {kind: 'Ref', refId: nextRefId()}
154195
152643
  )
@@ -154197,16 +152645,16 @@ function validateNoRefAccessInRenderImpl(fn, env) {
154197
152645
  }
154198
152646
  if (
154199
152647
  isRefValueType(instr.lvalue.identifier) &&
154200
- ((_g = env.get(instr.lvalue.identifier.id)) === null || _g === void 0
152648
+ ((_h = env.get(instr.lvalue.identifier.id)) === null || _h === void 0
154201
152649
  ? void 0
154202
- : _g.kind) !== 'RefValue'
152650
+ : _h.kind) !== 'RefValue'
154203
152651
  ) {
154204
152652
  env.set(
154205
152653
  instr.lvalue.identifier.id,
154206
152654
  joinRefAccessTypes(
154207
- (_h = env.get(instr.lvalue.identifier.id)) !== null &&
154208
- _h !== void 0
154209
- ? _h
152655
+ (_j = env.get(instr.lvalue.identifier.id)) !== null &&
152656
+ _j !== void 0
152657
+ ? _j
154210
152658
  : {kind: 'None'},
154211
152659
  {kind: 'RefValue', loc: instr.loc}
154212
152660
  )
@@ -156371,6 +154819,8 @@ var _Context_instances,
156371
154819
  _Context_dependencies,
156372
154820
  _Context_temporaries,
156373
154821
  _Context_temporariesUsedOutsideScope,
154822
+ _Context_processedInstrsInOptional,
154823
+ _Context_innerFnContext,
156374
154824
  _Context_checkValidDependency,
156375
154825
  _Context_isScopeActive;
156376
154826
  function propagateScopeDependenciesHIR(fn) {
@@ -156480,24 +154930,43 @@ function collectTemporariesSidemap(fn, usedOutsideDeclaringScope) {
156480
154930
  fn,
156481
154931
  usedOutsideDeclaringScope,
156482
154932
  temporaries,
156483
- false
154933
+ null
156484
154934
  );
156485
154935
  return temporaries;
156486
154936
  }
154937
+ function isLoadContextMutable(instrValue, id) {
154938
+ if (instrValue.kind === 'LoadContext') {
154939
+ CompilerError.invariant(instrValue.place.identifier.scope != null, {
154940
+ reason:
154941
+ '[PropagateScopeDependencies] Expected all context variables to be assigned a scope',
154942
+ loc: instrValue.loc,
154943
+ });
154944
+ return id >= instrValue.place.identifier.scope.range.end;
154945
+ }
154946
+ return false;
154947
+ }
156487
154948
  function collectTemporariesSidemapImpl(
156488
154949
  fn,
156489
154950
  usedOutsideDeclaringScope,
156490
154951
  temporaries,
156491
- isInnerFn
154952
+ innerFnContext
156492
154953
  ) {
156493
154954
  for (const [_, block] of fn.body.blocks) {
156494
- for (const instr of block.instructions) {
156495
- const {value: value, lvalue: lvalue} = instr;
154955
+ for (const {
154956
+ value: value,
154957
+ lvalue: lvalue,
154958
+ id: origInstrId,
154959
+ } of block.instructions) {
154960
+ const instrId =
154961
+ innerFnContext != null ? innerFnContext.instrId : origInstrId;
156496
154962
  const usedOutside = usedOutsideDeclaringScope.has(
156497
154963
  lvalue.identifier.declarationId
156498
154964
  );
156499
154965
  if (value.kind === 'PropertyLoad' && !usedOutside) {
156500
- if (!isInnerFn || temporaries.has(value.object.identifier.id)) {
154966
+ if (
154967
+ innerFnContext == null ||
154968
+ temporaries.has(value.object.identifier.id)
154969
+ ) {
156501
154970
  const property = getProperty(
156502
154971
  value.object,
156503
154972
  value.property,
@@ -156507,13 +154976,13 @@ function collectTemporariesSidemapImpl(
156507
154976
  temporaries.set(lvalue.identifier.id, property);
156508
154977
  }
156509
154978
  } else if (
156510
- value.kind === 'LoadLocal' &&
154979
+ (value.kind === 'LoadLocal' || isLoadContextMutable(value, instrId)) &&
156511
154980
  lvalue.identifier.name == null &&
156512
154981
  value.place.identifier.name !== null &&
156513
154982
  !usedOutside
156514
154983
  ) {
156515
154984
  if (
156516
- !isInnerFn ||
154985
+ innerFnContext == null ||
156517
154986
  fn.context.some(
156518
154987
  context => context.identifier.id === value.place.identifier.id
156519
154988
  )
@@ -156531,7 +155000,9 @@ function collectTemporariesSidemapImpl(
156531
155000
  value.loweredFunc.func,
156532
155001
  usedOutsideDeclaringScope,
156533
155002
  temporaries,
156534
- true
155003
+ innerFnContext !== null && innerFnContext !== void 0
155004
+ ? innerFnContext
155005
+ : {instrId: instrId}
156535
155006
  );
156536
155007
  }
156537
155008
  }
@@ -156556,8 +155027,12 @@ function getProperty(object, propertyName, optional, temporaries) {
156556
155027
  }
156557
155028
  return property;
156558
155029
  }
156559
- class Context {
156560
- constructor(temporariesUsedOutsideScope, temporaries) {
155030
+ let Context$1 = class Context {
155031
+ constructor(
155032
+ temporariesUsedOutsideScope,
155033
+ temporaries,
155034
+ processedInstrsInOptional
155035
+ ) {
156561
155036
  _Context_instances.add(this);
156562
155037
  _Context_declarations.set(this, new Map());
156563
155038
  _Context_reassignments.set(this, new Map());
@@ -156566,7 +155041,8 @@ class Context {
156566
155041
  this.deps = new Map();
156567
155042
  _Context_temporaries.set(this, void 0);
156568
155043
  _Context_temporariesUsedOutsideScope.set(this, void 0);
156569
- this.inInnerFn = false;
155044
+ _Context_processedInstrsInOptional.set(this, void 0);
155045
+ _Context_innerFnContext.set(this, null);
156570
155046
  __classPrivateFieldSet(
156571
155047
  this,
156572
155048
  _Context_temporariesUsedOutsideScope,
@@ -156574,6 +155050,12 @@ class Context {
156574
155050
  'f'
156575
155051
  );
156576
155052
  __classPrivateFieldSet(this, _Context_temporaries, temporaries, 'f');
155053
+ __classPrivateFieldSet(
155054
+ this,
155055
+ _Context_processedInstrsInOptional,
155056
+ processedInstrsInOptional,
155057
+ 'f'
155058
+ );
156577
155059
  }
156578
155060
  enterScope(scope) {
156579
155061
  __classPrivateFieldSet(
@@ -156642,7 +155124,8 @@ class Context {
156642
155124
  ).has(place.identifier.declarationId);
156643
155125
  }
156644
155126
  declare(identifier, decl) {
156645
- if (this.inInnerFn) return;
155127
+ if (__classPrivateFieldGet(this, _Context_innerFnContext, 'f') != null)
155128
+ return;
156646
155129
  if (
156647
155130
  !__classPrivateFieldGet(this, _Context_declarations, 'f').has(
156648
155131
  identifier.declarationId
@@ -156753,13 +155236,46 @@ class Context {
156753
155236
  currentScope.reassignments.add(place.identifier);
156754
155237
  }
156755
155238
  }
156756
- }
155239
+ enterInnerFn(innerFn, cb) {
155240
+ var _a;
155241
+ const prevContext = __classPrivateFieldGet(
155242
+ this,
155243
+ _Context_innerFnContext,
155244
+ 'f'
155245
+ );
155246
+ __classPrivateFieldSet(
155247
+ this,
155248
+ _Context_innerFnContext,
155249
+ (_a = __classPrivateFieldGet(this, _Context_innerFnContext, 'f')) !==
155250
+ null && _a !== void 0
155251
+ ? _a
155252
+ : {outerInstrId: innerFn.id},
155253
+ 'f'
155254
+ );
155255
+ const result = cb();
155256
+ __classPrivateFieldSet(this, _Context_innerFnContext, prevContext, 'f');
155257
+ return result;
155258
+ }
155259
+ isDeferredDependency(instr) {
155260
+ return (
155261
+ __classPrivateFieldGet(this, _Context_processedInstrsInOptional, 'f').has(
155262
+ instr.value
155263
+ ) ||
155264
+ (instr.kind === HIRValue.Instruction &&
155265
+ __classPrivateFieldGet(this, _Context_temporaries, 'f').has(
155266
+ instr.value.lvalue.identifier.id
155267
+ ))
155268
+ );
155269
+ }
155270
+ };
156757
155271
  (_Context_declarations = new WeakMap()),
156758
155272
  (_Context_reassignments = new WeakMap()),
156759
155273
  (_Context_scopes = new WeakMap()),
156760
155274
  (_Context_dependencies = new WeakMap()),
156761
155275
  (_Context_temporaries = new WeakMap()),
156762
155276
  (_Context_temporariesUsedOutsideScope = new WeakMap()),
155277
+ (_Context_processedInstrsInOptional = new WeakMap()),
155278
+ (_Context_innerFnContext = new WeakMap()),
156763
155279
  (_Context_instances = new WeakSet()),
156764
155280
  (_Context_checkValidDependency = function _Context_checkValidDependency(
156765
155281
  maybeDependency
@@ -156795,20 +155311,21 @@ class Context {
156795
155311
  state => state === scope
156796
155312
  );
156797
155313
  });
155314
+ var HIRValue;
155315
+ (function (HIRValue) {
155316
+ HIRValue[(HIRValue['Instruction'] = 1)] = 'Instruction';
155317
+ HIRValue[(HIRValue['Terminal'] = 2)] = 'Terminal';
155318
+ })(HIRValue || (HIRValue = {}));
156798
155319
  function handleInstruction(instr, context) {
156799
155320
  const {id: id, value: value, lvalue: lvalue} = instr;
156800
- if (value.kind === 'LoadLocal') {
156801
- if (
156802
- value.place.identifier.name === null ||
156803
- lvalue.identifier.name !== null ||
156804
- context.isUsedOutsideDeclaringScope(lvalue)
156805
- ) {
156806
- context.visitOperand(value.place);
156807
- }
156808
- } else if (value.kind === 'PropertyLoad') {
156809
- if (context.isUsedOutsideDeclaringScope(lvalue)) {
156810
- context.visitProperty(value.object, value.property, false);
156811
- }
155321
+ context.declare(lvalue.identifier, {id: id, scope: context.currentScope});
155322
+ if (
155323
+ context.isDeferredDependency({kind: HIRValue.Instruction, value: instr})
155324
+ ) {
155325
+ return;
155326
+ }
155327
+ if (value.kind === 'PropertyLoad') {
155328
+ context.visitProperty(value.object, value.property, false);
156812
155329
  } else if (value.kind === 'StoreLocal') {
156813
155330
  context.visitOperand(value.value);
156814
155331
  if (value.lvalue.kind === InstructionKind.Reassign) {
@@ -156836,7 +155353,6 @@ function handleInstruction(instr, context) {
156836
155353
  context.visitOperand(operand);
156837
155354
  }
156838
155355
  }
156839
- context.declare(lvalue.identifier, {id: id, scope: context.currentScope});
156840
155356
  }
156841
155357
  function collectDependencies(
156842
155358
  fn,
@@ -156844,7 +155360,11 @@ function collectDependencies(
156844
155360
  temporaries,
156845
155361
  processedInstrsInOptional
156846
155362
  ) {
156847
- const context = new Context(usedOutsideDeclaringScope, temporaries);
155363
+ const context = new Context$1(
155364
+ usedOutsideDeclaringScope,
155365
+ temporaries,
155366
+ processedInstrsInOptional
155367
+ );
156848
155368
  for (const param of fn.params) {
156849
155369
  if (param.kind === 'Identifier') {
156850
155370
  context.declare(param.identifier, {
@@ -156894,15 +155414,20 @@ function collectDependencies(
156894
155414
  id: instr.id,
156895
155415
  scope: context.currentScope,
156896
155416
  });
156897
- const wasInInnerFn = context.inInnerFn;
156898
- context.inInnerFn = true;
156899
- handleFunction(instr.value.loweredFunc.func);
156900
- context.inInnerFn = wasInInnerFn;
156901
- } else if (!processedInstrsInOptional.has(instr)) {
155417
+ const innerFn = instr.value.loweredFunc.func;
155418
+ context.enterInnerFn(instr, () => {
155419
+ handleFunction(innerFn);
155420
+ });
155421
+ } else {
156902
155422
  handleInstruction(instr, context);
156903
155423
  }
156904
155424
  }
156905
- if (!processedInstrsInOptional.has(block.terminal)) {
155425
+ if (
155426
+ !context.isDeferredDependency({
155427
+ kind: HIRValue.Terminal,
155428
+ value: block.terminal,
155429
+ })
155430
+ ) {
156906
155431
  for (const place of eachTerminalOperand(block.terminal)) {
156907
155432
  context.visitOperand(place);
156908
155433
  }
@@ -157290,7 +155815,623 @@ function optimizePropsMethodCalls(fn) {
157290
155815
  }
157291
155816
  }
157292
155817
  }
157293
- function* run(
155818
+ var _Context_env,
155819
+ _Context_errors,
155820
+ _Context_callExpressions,
155821
+ _Context_functionExpressions,
155822
+ _Context_loadLocals,
155823
+ _Context_fireCalleesToFireFunctions,
155824
+ _Context_calleesWithInsertedFire,
155825
+ _Context_capturedCalleeIdentifierIds,
155826
+ _Context_inUseEffectLambda,
155827
+ _Context_loadGlobalInstructionIds,
155828
+ _Context_arrayExpressions;
155829
+ const CANNOT_COMPILE_FIRE = 'Cannot compile `fire`';
155830
+ function transformFire(fn) {
155831
+ const context = new Context(fn.env);
155832
+ replaceFireFunctions(fn, context);
155833
+ if (!context.hasErrors()) {
155834
+ ensureNoMoreFireUses(fn, context);
155835
+ }
155836
+ context.throwIfErrorsFound();
155837
+ }
155838
+ function replaceFireFunctions(fn, context) {
155839
+ let hasRewrite = false;
155840
+ for (const [, block] of fn.body.blocks) {
155841
+ const rewriteInstrs = new Map();
155842
+ const deleteInstrs = new Set();
155843
+ for (const instr of block.instructions) {
155844
+ const {value: value, lvalue: lvalue} = instr;
155845
+ if (
155846
+ value.kind === 'CallExpression' &&
155847
+ isUseEffectHookType(value.callee.identifier) &&
155848
+ value.args.length > 0 &&
155849
+ value.args[0].kind === 'Identifier'
155850
+ ) {
155851
+ const lambda = context.getFunctionExpression(
155852
+ value.args[0].identifier.id
155853
+ );
155854
+ if (lambda != null) {
155855
+ const capturedCallees =
155856
+ visitFunctionExpressionAndPropagateFireDependencies(
155857
+ lambda,
155858
+ context,
155859
+ true
155860
+ );
155861
+ const newInstrs = [];
155862
+ for (const [
155863
+ fireCalleePlace,
155864
+ fireCalleeInfo,
155865
+ ] of capturedCallees.entries()) {
155866
+ if (!context.hasCalleeWithInsertedFire(fireCalleePlace)) {
155867
+ context.addCalleeWithInsertedFire(fireCalleePlace);
155868
+ const loadUseFireInstr = makeLoadUseFireInstruction(fn.env);
155869
+ const loadFireCalleeInstr = makeLoadFireCalleeInstruction(
155870
+ fn.env,
155871
+ fireCalleeInfo.capturedCalleeIdentifier
155872
+ );
155873
+ const callUseFireInstr = makeCallUseFireInstruction(
155874
+ fn.env,
155875
+ loadUseFireInstr.lvalue,
155876
+ loadFireCalleeInstr.lvalue
155877
+ );
155878
+ const storeUseFireInstr = makeStoreUseFireInstruction(
155879
+ fn.env,
155880
+ callUseFireInstr.lvalue,
155881
+ fireCalleeInfo.fireFunctionBinding
155882
+ );
155883
+ newInstrs.push(
155884
+ loadUseFireInstr,
155885
+ loadFireCalleeInstr,
155886
+ callUseFireInstr,
155887
+ storeUseFireInstr
155888
+ );
155889
+ const loadUseEffectInstrId = context.getLoadGlobalInstrId(
155890
+ value.callee.identifier.id
155891
+ );
155892
+ if (loadUseEffectInstrId == null) {
155893
+ context.pushError({
155894
+ loc: value.loc,
155895
+ description: null,
155896
+ severity: exports.ErrorSeverity.Invariant,
155897
+ reason: '[InsertFire] No LoadGlobal found for useEffect call',
155898
+ suggestions: null,
155899
+ });
155900
+ continue;
155901
+ }
155902
+ rewriteInstrs.set(loadUseEffectInstrId, newInstrs);
155903
+ }
155904
+ }
155905
+ ensureNoRemainingCalleeCaptures(
155906
+ lambda.loweredFunc.func,
155907
+ context,
155908
+ capturedCallees
155909
+ );
155910
+ if (
155911
+ value.args.length > 1 &&
155912
+ value.args[1] != null &&
155913
+ value.args[1].kind === 'Identifier'
155914
+ ) {
155915
+ const depArray = value.args[1];
155916
+ const depArrayExpression = context.getArrayExpression(
155917
+ depArray.identifier.id
155918
+ );
155919
+ if (depArrayExpression != null) {
155920
+ for (const dependency of depArrayExpression.elements) {
155921
+ if (dependency.kind === 'Identifier') {
155922
+ const loadOfDependency = context.getLoadLocalInstr(
155923
+ dependency.identifier.id
155924
+ );
155925
+ if (loadOfDependency != null) {
155926
+ const replacedDepArrayItem = capturedCallees.get(
155927
+ loadOfDependency.place.identifier.id
155928
+ );
155929
+ if (replacedDepArrayItem != null) {
155930
+ loadOfDependency.place =
155931
+ replacedDepArrayItem.fireFunctionBinding;
155932
+ }
155933
+ }
155934
+ }
155935
+ }
155936
+ } else {
155937
+ context.pushError({
155938
+ loc: value.args[1].loc,
155939
+ description:
155940
+ 'You must use an array literal for an effect dependency array when that effect uses `fire()`',
155941
+ severity: exports.ErrorSeverity.Invariant,
155942
+ reason: CANNOT_COMPILE_FIRE,
155943
+ suggestions: null,
155944
+ });
155945
+ }
155946
+ } else if (value.args.length > 1 && value.args[1].kind === 'Spread') {
155947
+ context.pushError({
155948
+ loc: value.args[1].place.loc,
155949
+ description:
155950
+ 'You must use an array literal for an effect dependency array when that effect uses `fire()`',
155951
+ severity: exports.ErrorSeverity.Invariant,
155952
+ reason: CANNOT_COMPILE_FIRE,
155953
+ suggestions: null,
155954
+ });
155955
+ }
155956
+ }
155957
+ } else if (
155958
+ value.kind === 'CallExpression' &&
155959
+ value.callee.identifier.type.kind === 'Function' &&
155960
+ value.callee.identifier.type.shapeId === BuiltInFireId &&
155961
+ context.inUseEffectLambda()
155962
+ ) {
155963
+ if (value.args.length === 1 && value.args[0].kind === 'Identifier') {
155964
+ const callExpr = context.getCallExpression(
155965
+ value.args[0].identifier.id
155966
+ );
155967
+ if (callExpr != null) {
155968
+ const calleeId = callExpr.callee.identifier.id;
155969
+ const loadLocal = context.getLoadLocalInstr(calleeId);
155970
+ if (loadLocal == null) {
155971
+ context.pushError({
155972
+ loc: value.loc,
155973
+ description: null,
155974
+ severity: exports.ErrorSeverity.Invariant,
155975
+ reason:
155976
+ '[InsertFire] No loadLocal found for fire call argument',
155977
+ suggestions: null,
155978
+ });
155979
+ continue;
155980
+ }
155981
+ const fireFunctionBinding =
155982
+ context.getOrGenerateFireFunctionBinding(
155983
+ loadLocal.place,
155984
+ value.loc
155985
+ );
155986
+ loadLocal.place = Object.assign({}, fireFunctionBinding);
155987
+ deleteInstrs.add(instr.id);
155988
+ } else {
155989
+ context.pushError({
155990
+ loc: value.loc,
155991
+ description:
155992
+ '`fire()` can only receive a function call such as `fire(fn(a,b)). Method calls and other expressions are not allowed',
155993
+ severity: exports.ErrorSeverity.InvalidReact,
155994
+ reason: CANNOT_COMPILE_FIRE,
155995
+ suggestions: null,
155996
+ });
155997
+ }
155998
+ } else {
155999
+ let description =
156000
+ 'fire() can only take in a single call expression as an argument';
156001
+ if (value.args.length === 0) {
156002
+ description += ' but received none';
156003
+ } else if (value.args.length > 1) {
156004
+ description += ' but received multiple arguments';
156005
+ } else if (value.args[0].kind === 'Spread') {
156006
+ description += ' but received a spread argument';
156007
+ }
156008
+ context.pushError({
156009
+ loc: value.loc,
156010
+ description: description,
156011
+ severity: exports.ErrorSeverity.InvalidReact,
156012
+ reason: CANNOT_COMPILE_FIRE,
156013
+ suggestions: null,
156014
+ });
156015
+ }
156016
+ } else if (value.kind === 'CallExpression') {
156017
+ context.addCallExpression(lvalue.identifier.id, value);
156018
+ } else if (
156019
+ value.kind === 'FunctionExpression' &&
156020
+ context.inUseEffectLambda()
156021
+ ) {
156022
+ visitFunctionExpressionAndPropagateFireDependencies(
156023
+ value,
156024
+ context,
156025
+ false
156026
+ );
156027
+ } else if (value.kind === 'FunctionExpression') {
156028
+ context.addFunctionExpression(lvalue.identifier.id, value);
156029
+ } else if (value.kind === 'LoadLocal') {
156030
+ context.addLoadLocalInstr(lvalue.identifier.id, value);
156031
+ } else if (
156032
+ value.kind === 'LoadGlobal' &&
156033
+ value.binding.kind === 'ImportSpecifier' &&
156034
+ value.binding.module === 'react' &&
156035
+ value.binding.imported === 'fire' &&
156036
+ context.inUseEffectLambda()
156037
+ ) {
156038
+ deleteInstrs.add(instr.id);
156039
+ } else if (value.kind === 'LoadGlobal') {
156040
+ context.addLoadGlobalInstrId(lvalue.identifier.id, instr.id);
156041
+ } else if (value.kind === 'ArrayExpression') {
156042
+ context.addArrayExpression(lvalue.identifier.id, value);
156043
+ }
156044
+ }
156045
+ block.instructions = rewriteInstructions(rewriteInstrs, block.instructions);
156046
+ block.instructions = deleteInstructions(deleteInstrs, block.instructions);
156047
+ if (rewriteInstrs.size > 0 || deleteInstrs.size > 0) {
156048
+ hasRewrite = true;
156049
+ fn.env.hasFireRewrite = true;
156050
+ }
156051
+ }
156052
+ if (hasRewrite) {
156053
+ markInstructionIds(fn.body);
156054
+ }
156055
+ }
156056
+ function visitFunctionExpressionAndPropagateFireDependencies(
156057
+ fnExpr,
156058
+ context,
156059
+ enteringUseEffect
156060
+ ) {
156061
+ let withScope = enteringUseEffect
156062
+ ? context.withUseEffectLambdaScope.bind(context)
156063
+ : context.withFunctionScope.bind(context);
156064
+ const calleesCapturedByFnExpression = withScope(() =>
156065
+ replaceFireFunctions(fnExpr.loweredFunc.func, context)
156066
+ );
156067
+ const loadLocalsToDepLoads = new Map();
156068
+ for (const dep of fnExpr.loweredFunc.dependencies) {
156069
+ const loadLocal = context.getLoadLocalInstr(dep.identifier.id);
156070
+ if (loadLocal != null) {
156071
+ loadLocalsToDepLoads.set(loadLocal.place.identifier.id, loadLocal);
156072
+ }
156073
+ }
156074
+ const replacedCallees = new Map();
156075
+ for (const [
156076
+ calleeIdentifierId,
156077
+ loadedFireFunctionBindingPlace,
156078
+ ] of calleesCapturedByFnExpression.entries()) {
156079
+ const loadLocal = loadLocalsToDepLoads.get(calleeIdentifierId);
156080
+ if (loadLocal == null) {
156081
+ context.pushError({
156082
+ loc: fnExpr.loc,
156083
+ description: null,
156084
+ severity: exports.ErrorSeverity.Invariant,
156085
+ reason:
156086
+ '[InsertFire] No loadLocal found for fire call argument for lambda',
156087
+ suggestions: null,
156088
+ });
156089
+ continue;
156090
+ }
156091
+ const oldPlaceId = loadLocal.place.identifier.id;
156092
+ loadLocal.place = Object.assign(
156093
+ {},
156094
+ loadedFireFunctionBindingPlace.fireFunctionBinding
156095
+ );
156096
+ replacedCallees.set(
156097
+ oldPlaceId,
156098
+ loadedFireFunctionBindingPlace.fireFunctionBinding
156099
+ );
156100
+ }
156101
+ for (
156102
+ let contextIdx = 0;
156103
+ contextIdx < fnExpr.loweredFunc.func.context.length;
156104
+ contextIdx++
156105
+ ) {
156106
+ const contextItem = fnExpr.loweredFunc.func.context[contextIdx];
156107
+ const replacedCallee = replacedCallees.get(contextItem.identifier.id);
156108
+ if (replacedCallee != null) {
156109
+ fnExpr.loweredFunc.func.context[contextIdx] = replacedCallee;
156110
+ }
156111
+ }
156112
+ context.mergeCalleesFromInnerScope(calleesCapturedByFnExpression);
156113
+ return calleesCapturedByFnExpression;
156114
+ }
156115
+ function* eachReachablePlace(fn) {
156116
+ for (const [, block] of fn.body.blocks) {
156117
+ for (const instr of block.instructions) {
156118
+ if (
156119
+ instr.value.kind === 'FunctionExpression' ||
156120
+ instr.value.kind === 'ObjectMethod'
156121
+ ) {
156122
+ yield* eachReachablePlace(instr.value.loweredFunc.func);
156123
+ } else {
156124
+ yield* eachInstructionOperand(instr);
156125
+ }
156126
+ }
156127
+ }
156128
+ }
156129
+ function ensureNoRemainingCalleeCaptures(fn, context, capturedCallees) {
156130
+ var _a;
156131
+ for (const place of eachReachablePlace(fn)) {
156132
+ const calleeInfo = capturedCallees.get(place.identifier.id);
156133
+ if (calleeInfo != null) {
156134
+ const calleeName =
156135
+ ((_a = calleeInfo.capturedCalleeIdentifier.name) === null ||
156136
+ _a === void 0
156137
+ ? void 0
156138
+ : _a.kind) === 'named'
156139
+ ? calleeInfo.capturedCalleeIdentifier.name.value
156140
+ : '<unknown>';
156141
+ context.pushError({
156142
+ loc: place.loc,
156143
+ description: `All uses of ${calleeName} must be either used with a fire() call in this effect or not used with a fire() call at all. ${calleeName} was used with fire() on line ${printSourceLocationLine(calleeInfo.fireLoc)} in this effect`,
156144
+ severity: exports.ErrorSeverity.InvalidReact,
156145
+ reason: CANNOT_COMPILE_FIRE,
156146
+ suggestions: null,
156147
+ });
156148
+ }
156149
+ }
156150
+ }
156151
+ function ensureNoMoreFireUses(fn, context) {
156152
+ for (const place of eachReachablePlace(fn)) {
156153
+ if (
156154
+ place.identifier.type.kind === 'Function' &&
156155
+ place.identifier.type.shapeId === BuiltInFireId
156156
+ ) {
156157
+ context.pushError({
156158
+ loc: place.identifier.loc,
156159
+ description: 'Cannot use `fire` outside of a useEffect function',
156160
+ severity: exports.ErrorSeverity.Invariant,
156161
+ reason: CANNOT_COMPILE_FIRE,
156162
+ suggestions: null,
156163
+ });
156164
+ }
156165
+ }
156166
+ }
156167
+ function makeLoadUseFireInstruction(env) {
156168
+ const useFirePlace = createTemporaryPlace(env, GeneratedSource);
156169
+ useFirePlace.effect = exports.Effect.Read;
156170
+ useFirePlace.identifier.type = DefaultNonmutatingHook;
156171
+ const instrValue = {
156172
+ kind: 'LoadGlobal',
156173
+ binding: {
156174
+ kind: 'ImportSpecifier',
156175
+ name: 'useFire',
156176
+ module: 'react',
156177
+ imported: 'useFire',
156178
+ },
156179
+ loc: GeneratedSource,
156180
+ };
156181
+ return {
156182
+ id: makeInstructionId(0),
156183
+ value: instrValue,
156184
+ lvalue: Object.assign({}, useFirePlace),
156185
+ loc: GeneratedSource,
156186
+ };
156187
+ }
156188
+ function makeLoadFireCalleeInstruction(env, fireCalleeIdentifier) {
156189
+ const loadedFireCallee = createTemporaryPlace(env, GeneratedSource);
156190
+ const fireCallee = {
156191
+ kind: 'Identifier',
156192
+ identifier: fireCalleeIdentifier,
156193
+ reactive: false,
156194
+ effect: exports.Effect.Unknown,
156195
+ loc: fireCalleeIdentifier.loc,
156196
+ };
156197
+ return {
156198
+ id: makeInstructionId(0),
156199
+ value: {
156200
+ kind: 'LoadLocal',
156201
+ loc: GeneratedSource,
156202
+ place: Object.assign({}, fireCallee),
156203
+ },
156204
+ lvalue: Object.assign({}, loadedFireCallee),
156205
+ loc: GeneratedSource,
156206
+ };
156207
+ }
156208
+ function makeCallUseFireInstruction(env, useFirePlace, argPlace) {
156209
+ const useFireCallResultPlace = createTemporaryPlace(env, GeneratedSource);
156210
+ useFireCallResultPlace.effect = exports.Effect.Read;
156211
+ const useFireCall = {
156212
+ kind: 'CallExpression',
156213
+ callee: Object.assign({}, useFirePlace),
156214
+ args: [argPlace],
156215
+ loc: GeneratedSource,
156216
+ };
156217
+ return {
156218
+ id: makeInstructionId(0),
156219
+ value: useFireCall,
156220
+ lvalue: Object.assign({}, useFireCallResultPlace),
156221
+ loc: GeneratedSource,
156222
+ };
156223
+ }
156224
+ function makeStoreUseFireInstruction(
156225
+ env,
156226
+ useFireCallResultPlace,
156227
+ fireFunctionBindingPlace
156228
+ ) {
156229
+ promoteTemporary(fireFunctionBindingPlace.identifier);
156230
+ const fireFunctionBindingLValuePlace = createTemporaryPlace(
156231
+ env,
156232
+ GeneratedSource
156233
+ );
156234
+ return {
156235
+ id: makeInstructionId(0),
156236
+ value: {
156237
+ kind: 'StoreLocal',
156238
+ lvalue: {
156239
+ kind: InstructionKind.Const,
156240
+ place: Object.assign({}, fireFunctionBindingPlace),
156241
+ },
156242
+ value: Object.assign({}, useFireCallResultPlace),
156243
+ type: null,
156244
+ loc: GeneratedSource,
156245
+ },
156246
+ lvalue: fireFunctionBindingLValuePlace,
156247
+ loc: GeneratedSource,
156248
+ };
156249
+ }
156250
+ class Context {
156251
+ constructor(env) {
156252
+ _Context_env.set(this, void 0);
156253
+ _Context_errors.set(this, new CompilerError());
156254
+ _Context_callExpressions.set(this, new Map());
156255
+ _Context_functionExpressions.set(this, new Map());
156256
+ _Context_loadLocals.set(this, new Map());
156257
+ _Context_fireCalleesToFireFunctions.set(this, new Map());
156258
+ _Context_calleesWithInsertedFire.set(this, new Set());
156259
+ _Context_capturedCalleeIdentifierIds.set(this, new Map());
156260
+ _Context_inUseEffectLambda.set(this, false);
156261
+ _Context_loadGlobalInstructionIds.set(this, new Map());
156262
+ _Context_arrayExpressions.set(this, new Map());
156263
+ __classPrivateFieldSet(this, _Context_env, env, 'f');
156264
+ }
156265
+ pushError(error) {
156266
+ __classPrivateFieldGet(this, _Context_errors, 'f').push(error);
156267
+ }
156268
+ withFunctionScope(fn) {
156269
+ fn();
156270
+ return __classPrivateFieldGet(
156271
+ this,
156272
+ _Context_capturedCalleeIdentifierIds,
156273
+ 'f'
156274
+ );
156275
+ }
156276
+ withUseEffectLambdaScope(fn) {
156277
+ const capturedCalleeIdentifierIds = __classPrivateFieldGet(
156278
+ this,
156279
+ _Context_capturedCalleeIdentifierIds,
156280
+ 'f'
156281
+ );
156282
+ const inUseEffectLambda = __classPrivateFieldGet(
156283
+ this,
156284
+ _Context_inUseEffectLambda,
156285
+ 'f'
156286
+ );
156287
+ __classPrivateFieldSet(
156288
+ this,
156289
+ _Context_capturedCalleeIdentifierIds,
156290
+ new Map(),
156291
+ 'f'
156292
+ );
156293
+ __classPrivateFieldSet(this, _Context_inUseEffectLambda, true, 'f');
156294
+ const resultCapturedCalleeIdentifierIds = this.withFunctionScope(fn);
156295
+ __classPrivateFieldSet(
156296
+ this,
156297
+ _Context_capturedCalleeIdentifierIds,
156298
+ capturedCalleeIdentifierIds,
156299
+ 'f'
156300
+ );
156301
+ __classPrivateFieldSet(
156302
+ this,
156303
+ _Context_inUseEffectLambda,
156304
+ inUseEffectLambda,
156305
+ 'f'
156306
+ );
156307
+ return resultCapturedCalleeIdentifierIds;
156308
+ }
156309
+ addCallExpression(id, callExpr) {
156310
+ __classPrivateFieldGet(this, _Context_callExpressions, 'f').set(
156311
+ id,
156312
+ callExpr
156313
+ );
156314
+ }
156315
+ getCallExpression(id) {
156316
+ return __classPrivateFieldGet(this, _Context_callExpressions, 'f').get(id);
156317
+ }
156318
+ addLoadLocalInstr(id, loadLocal) {
156319
+ __classPrivateFieldGet(this, _Context_loadLocals, 'f').set(id, loadLocal);
156320
+ }
156321
+ getLoadLocalInstr(id) {
156322
+ return __classPrivateFieldGet(this, _Context_loadLocals, 'f').get(id);
156323
+ }
156324
+ getOrGenerateFireFunctionBinding(callee, fireLoc) {
156325
+ const fireFunctionBinding = getOrInsertWith(
156326
+ __classPrivateFieldGet(this, _Context_fireCalleesToFireFunctions, 'f'),
156327
+ callee.identifier.id,
156328
+ () =>
156329
+ createTemporaryPlace(
156330
+ __classPrivateFieldGet(this, _Context_env, 'f'),
156331
+ GeneratedSource
156332
+ )
156333
+ );
156334
+ __classPrivateFieldGet(this, _Context_capturedCalleeIdentifierIds, 'f').set(
156335
+ callee.identifier.id,
156336
+ {
156337
+ fireFunctionBinding: fireFunctionBinding,
156338
+ capturedCalleeIdentifier: callee.identifier,
156339
+ fireLoc: fireLoc,
156340
+ }
156341
+ );
156342
+ return fireFunctionBinding;
156343
+ }
156344
+ mergeCalleesFromInnerScope(innerCallees) {
156345
+ for (const [id, calleeInfo] of innerCallees.entries()) {
156346
+ __classPrivateFieldGet(
156347
+ this,
156348
+ _Context_capturedCalleeIdentifierIds,
156349
+ 'f'
156350
+ ).set(id, calleeInfo);
156351
+ }
156352
+ }
156353
+ addCalleeWithInsertedFire(id) {
156354
+ __classPrivateFieldGet(this, _Context_calleesWithInsertedFire, 'f').add(id);
156355
+ }
156356
+ hasCalleeWithInsertedFire(id) {
156357
+ return __classPrivateFieldGet(
156358
+ this,
156359
+ _Context_calleesWithInsertedFire,
156360
+ 'f'
156361
+ ).has(id);
156362
+ }
156363
+ inUseEffectLambda() {
156364
+ return __classPrivateFieldGet(this, _Context_inUseEffectLambda, 'f');
156365
+ }
156366
+ addFunctionExpression(id, fn) {
156367
+ __classPrivateFieldGet(this, _Context_functionExpressions, 'f').set(id, fn);
156368
+ }
156369
+ getFunctionExpression(id) {
156370
+ return __classPrivateFieldGet(this, _Context_functionExpressions, 'f').get(
156371
+ id
156372
+ );
156373
+ }
156374
+ addLoadGlobalInstrId(id, instrId) {
156375
+ __classPrivateFieldGet(this, _Context_loadGlobalInstructionIds, 'f').set(
156376
+ id,
156377
+ instrId
156378
+ );
156379
+ }
156380
+ getLoadGlobalInstrId(id) {
156381
+ return __classPrivateFieldGet(
156382
+ this,
156383
+ _Context_loadGlobalInstructionIds,
156384
+ 'f'
156385
+ ).get(id);
156386
+ }
156387
+ addArrayExpression(id, array) {
156388
+ __classPrivateFieldGet(this, _Context_arrayExpressions, 'f').set(id, array);
156389
+ }
156390
+ getArrayExpression(id) {
156391
+ return __classPrivateFieldGet(this, _Context_arrayExpressions, 'f').get(id);
156392
+ }
156393
+ hasErrors() {
156394
+ return __classPrivateFieldGet(this, _Context_errors, 'f').hasErrors();
156395
+ }
156396
+ throwIfErrorsFound() {
156397
+ if (this.hasErrors())
156398
+ throw __classPrivateFieldGet(this, _Context_errors, 'f');
156399
+ }
156400
+ }
156401
+ (_Context_env = new WeakMap()),
156402
+ (_Context_errors = new WeakMap()),
156403
+ (_Context_callExpressions = new WeakMap()),
156404
+ (_Context_functionExpressions = new WeakMap()),
156405
+ (_Context_loadLocals = new WeakMap()),
156406
+ (_Context_fireCalleesToFireFunctions = new WeakMap()),
156407
+ (_Context_calleesWithInsertedFire = new WeakMap()),
156408
+ (_Context_capturedCalleeIdentifierIds = new WeakMap()),
156409
+ (_Context_inUseEffectLambda = new WeakMap()),
156410
+ (_Context_loadGlobalInstructionIds = new WeakMap()),
156411
+ (_Context_arrayExpressions = new WeakMap());
156412
+ function deleteInstructions(deleteInstrs, instructions) {
156413
+ if (deleteInstrs.size > 0) {
156414
+ const newInstrs = instructions.filter(instr => !deleteInstrs.has(instr.id));
156415
+ return newInstrs;
156416
+ }
156417
+ return instructions;
156418
+ }
156419
+ function rewriteInstructions(rewriteInstrs, instructions) {
156420
+ if (rewriteInstrs.size > 0) {
156421
+ const newInstrs = [];
156422
+ for (const instr of instructions) {
156423
+ const newInstrsAtId = rewriteInstrs.get(instr.id);
156424
+ if (newInstrsAtId != null) {
156425
+ newInstrs.push(...newInstrsAtId, instr);
156426
+ } else {
156427
+ newInstrs.push(instr);
156428
+ }
156429
+ }
156430
+ return newInstrs;
156431
+ }
156432
+ return instructions;
156433
+ }
156434
+ function run(
157294
156435
  func,
157295
156436
  config,
157296
156437
  fnType,
@@ -157299,6 +156440,7 @@ function* run(
157299
156440
  filename,
157300
156441
  code
157301
156442
  ) {
156443
+ var _a, _b;
157302
156444
  const contextIdentifiers = findContextIdentifiers(func);
157303
156445
  const env = new Environment(
157304
156446
  func.scope,
@@ -157310,19 +156452,30 @@ function* run(
157310
156452
  code,
157311
156453
  useMemoCacheIdentifier
157312
156454
  );
157313
- yield log({
157314
- kind: 'debug',
157315
- name: 'EnvironmentConfig',
157316
- value: prettyFormat$1(env.config),
157317
- });
157318
- const ast = yield* runWithEnvironment(func, env);
157319
- return ast;
156455
+ (_b =
156456
+ (_a = env.logger) === null || _a === void 0 ? void 0 : _a.debugLogIRs) ===
156457
+ null || _b === void 0
156458
+ ? void 0
156459
+ : _b.call(_a, {
156460
+ kind: 'debug',
156461
+ name: 'EnvironmentConfig',
156462
+ value: prettyFormat$1(env.config),
156463
+ });
156464
+ return runWithEnvironment(func, env);
157320
156465
  }
157321
- function* runWithEnvironment(func, env) {
156466
+ function runWithEnvironment(func, env) {
156467
+ const log = value => {
156468
+ var _a, _b;
156469
+ (_b =
156470
+ (_a = env.logger) === null || _a === void 0 ? void 0 : _a.debugLogIRs) ===
156471
+ null || _b === void 0
156472
+ ? void 0
156473
+ : _b.call(_a, value);
156474
+ };
157322
156475
  const hir = lower$1(func, env).unwrap();
157323
- yield log({kind: 'hir', name: 'HIR', value: hir});
156476
+ log({kind: 'hir', name: 'HIR', value: hir});
157324
156477
  pruneMaybeThrows(hir);
157325
- yield log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
156478
+ log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
157326
156479
  validateContextVariableLValues(hir);
157327
156480
  validateUseMemo(hir);
157328
156481
  if (
@@ -157331,30 +156484,34 @@ function* runWithEnvironment(func, env) {
157331
156484
  !env.config.enableChangeDetectionForDebugging
157332
156485
  ) {
157333
156486
  dropManualMemoization(hir);
157334
- yield log({kind: 'hir', name: 'DropManualMemoization', value: hir});
156487
+ log({kind: 'hir', name: 'DropManualMemoization', value: hir});
157335
156488
  }
157336
156489
  inlineImmediatelyInvokedFunctionExpressions(hir);
157337
- yield log({
156490
+ log({
157338
156491
  kind: 'hir',
157339
156492
  name: 'InlineImmediatelyInvokedFunctionExpressions',
157340
156493
  value: hir,
157341
156494
  });
157342
156495
  mergeConsecutiveBlocks(hir);
157343
- yield log({kind: 'hir', name: 'MergeConsecutiveBlocks', value: hir});
156496
+ log({kind: 'hir', name: 'MergeConsecutiveBlocks', value: hir});
157344
156497
  assertConsistentIdentifiers(hir);
157345
156498
  assertTerminalSuccessorsExist(hir);
157346
156499
  enterSSA(hir);
157347
- yield log({kind: 'hir', name: 'SSA', value: hir});
156500
+ log({kind: 'hir', name: 'SSA', value: hir});
157348
156501
  eliminateRedundantPhi(hir);
157349
- yield log({kind: 'hir', name: 'EliminateRedundantPhi', value: hir});
156502
+ log({kind: 'hir', name: 'EliminateRedundantPhi', value: hir});
157350
156503
  assertConsistentIdentifiers(hir);
157351
156504
  constantPropagation(hir);
157352
- yield log({kind: 'hir', name: 'ConstantPropagation', value: hir});
156505
+ log({kind: 'hir', name: 'ConstantPropagation', value: hir});
157353
156506
  inferTypes(hir);
157354
- yield log({kind: 'hir', name: 'InferTypes', value: hir});
156507
+ log({kind: 'hir', name: 'InferTypes', value: hir});
157355
156508
  if (env.config.validateHooksUsage) {
157356
156509
  validateHooksUsage(hir);
157357
156510
  }
156511
+ if (env.config.enableFire) {
156512
+ transformFire(hir);
156513
+ log({kind: 'hir', name: 'TransformFire', value: hir});
156514
+ }
157358
156515
  if (env.config.validateNoCapitalizedCalls) {
157359
156516
  validateNoCapitalizedCalls(hir);
157360
156517
  }
@@ -157362,22 +156519,22 @@ function* runWithEnvironment(func, env) {
157362
156519
  lowerContextAccess(hir, env.config.lowerContextAccess);
157363
156520
  }
157364
156521
  optimizePropsMethodCalls(hir);
157365
- yield log({kind: 'hir', name: 'OptimizePropsMethodCalls', value: hir});
156522
+ log({kind: 'hir', name: 'OptimizePropsMethodCalls', value: hir});
157366
156523
  analyseFunctions(hir);
157367
- yield log({kind: 'hir', name: 'AnalyseFunctions', value: hir});
156524
+ log({kind: 'hir', name: 'AnalyseFunctions', value: hir});
157368
156525
  inferReferenceEffects(hir);
157369
- yield log({kind: 'hir', name: 'InferReferenceEffects', value: hir});
156526
+ log({kind: 'hir', name: 'InferReferenceEffects', value: hir});
157370
156527
  validateLocalsNotReassignedAfterRender(hir);
157371
156528
  deadCodeElimination(hir);
157372
- yield log({kind: 'hir', name: 'DeadCodeElimination', value: hir});
156529
+ log({kind: 'hir', name: 'DeadCodeElimination', value: hir});
157373
156530
  if (env.config.enableInstructionReordering) {
157374
156531
  instructionReordering(hir);
157375
- yield log({kind: 'hir', name: 'InstructionReordering', value: hir});
156532
+ log({kind: 'hir', name: 'InstructionReordering', value: hir});
157376
156533
  }
157377
156534
  pruneMaybeThrows(hir);
157378
- yield log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
156535
+ log({kind: 'hir', name: 'PruneMaybeThrows', value: hir});
157379
156536
  inferMutableRanges(hir);
157380
- yield log({kind: 'hir', name: 'InferMutableRanges', value: hir});
156537
+ log({kind: 'hir', name: 'InferMutableRanges', value: hir});
157381
156538
  if (env.config.assertValidMutableRanges) {
157382
156539
  assertValidMutableRanges(hir);
157383
156540
  }
@@ -157394,157 +156551,125 @@ function* runWithEnvironment(func, env) {
157394
156551
  validateNoJSXInTryStatement(hir);
157395
156552
  }
157396
156553
  inferReactivePlaces(hir);
157397
- yield log({kind: 'hir', name: 'InferReactivePlaces', value: hir});
156554
+ log({kind: 'hir', name: 'InferReactivePlaces', value: hir});
157398
156555
  rewriteInstructionKindsBasedOnReassignment(hir);
157399
- yield log({
156556
+ log({
157400
156557
  kind: 'hir',
157401
156558
  name: 'RewriteInstructionKindsBasedOnReassignment',
157402
156559
  value: hir,
157403
156560
  });
157404
156561
  propagatePhiTypes(hir);
157405
- yield log({kind: 'hir', name: 'PropagatePhiTypes', value: hir});
156562
+ log({kind: 'hir', name: 'PropagatePhiTypes', value: hir});
157406
156563
  inferReactiveScopeVariables(hir);
157407
- yield log({kind: 'hir', name: 'InferReactiveScopeVariables', value: hir});
156564
+ log({kind: 'hir', name: 'InferReactiveScopeVariables', value: hir});
157408
156565
  const fbtOperands = memoizeFbtAndMacroOperandsInSameScope(hir);
157409
- yield log({
157410
- kind: 'hir',
157411
- name: 'MemoizeFbtAndMacroOperandsInSameScope',
157412
- value: hir,
157413
- });
156566
+ log({kind: 'hir', name: 'MemoizeFbtAndMacroOperandsInSameScope', value: hir});
157414
156567
  if (env.config.enableJsxOutlining) {
157415
156568
  outlineJSX(hir);
157416
156569
  }
157417
156570
  if (env.config.enableFunctionOutlining) {
157418
156571
  outlineFunctions(hir, fbtOperands);
157419
- yield log({kind: 'hir', name: 'OutlineFunctions', value: hir});
156572
+ log({kind: 'hir', name: 'OutlineFunctions', value: hir});
157420
156573
  }
157421
156574
  alignMethodCallScopes(hir);
157422
- yield log({kind: 'hir', name: 'AlignMethodCallScopes', value: hir});
156575
+ log({kind: 'hir', name: 'AlignMethodCallScopes', value: hir});
157423
156576
  alignObjectMethodScopes(hir);
157424
- yield log({kind: 'hir', name: 'AlignObjectMethodScopes', value: hir});
156577
+ log({kind: 'hir', name: 'AlignObjectMethodScopes', value: hir});
157425
156578
  pruneUnusedLabelsHIR(hir);
157426
- yield log({kind: 'hir', name: 'PruneUnusedLabelsHIR', value: hir});
156579
+ log({kind: 'hir', name: 'PruneUnusedLabelsHIR', value: hir});
157427
156580
  alignReactiveScopesToBlockScopesHIR(hir);
157428
- yield log({
157429
- kind: 'hir',
157430
- name: 'AlignReactiveScopesToBlockScopesHIR',
157431
- value: hir,
157432
- });
156581
+ log({kind: 'hir', name: 'AlignReactiveScopesToBlockScopesHIR', value: hir});
157433
156582
  mergeOverlappingReactiveScopesHIR(hir);
157434
- yield log({
157435
- kind: 'hir',
157436
- name: 'MergeOverlappingReactiveScopesHIR',
157437
- value: hir,
157438
- });
156583
+ log({kind: 'hir', name: 'MergeOverlappingReactiveScopesHIR', value: hir});
157439
156584
  assertValidBlockNesting(hir);
157440
156585
  buildReactiveScopeTerminalsHIR(hir);
157441
- yield log({kind: 'hir', name: 'BuildReactiveScopeTerminalsHIR', value: hir});
156586
+ log({kind: 'hir', name: 'BuildReactiveScopeTerminalsHIR', value: hir});
157442
156587
  assertValidBlockNesting(hir);
157443
156588
  flattenReactiveLoopsHIR(hir);
157444
- yield log({kind: 'hir', name: 'FlattenReactiveLoopsHIR', value: hir});
156589
+ log({kind: 'hir', name: 'FlattenReactiveLoopsHIR', value: hir});
157445
156590
  flattenScopesWithHooksOrUseHIR(hir);
157446
- yield log({kind: 'hir', name: 'FlattenScopesWithHooksOrUseHIR', value: hir});
156591
+ log({kind: 'hir', name: 'FlattenScopesWithHooksOrUseHIR', value: hir});
157447
156592
  assertTerminalSuccessorsExist(hir);
157448
156593
  assertTerminalPredsExist(hir);
157449
156594
  propagateScopeDependenciesHIR(hir);
157450
- yield log({kind: 'hir', name: 'PropagateScopeDependenciesHIR', value: hir});
156595
+ log({kind: 'hir', name: 'PropagateScopeDependenciesHIR', value: hir});
157451
156596
  if (env.config.inferEffectDependencies) {
157452
156597
  inferEffectDependencies(hir);
157453
156598
  }
157454
156599
  if (env.config.inlineJsxTransform) {
157455
156600
  inlineJsxTransform(hir, env.config.inlineJsxTransform);
157456
- yield log({kind: 'hir', name: 'inlineJsxTransform', value: hir});
156601
+ log({kind: 'hir', name: 'inlineJsxTransform', value: hir});
157457
156602
  }
157458
156603
  const reactiveFunction = buildReactiveFunction(hir);
157459
- yield log({
156604
+ log({
157460
156605
  kind: 'reactive',
157461
156606
  name: 'BuildReactiveFunction',
157462
156607
  value: reactiveFunction,
157463
156608
  });
157464
156609
  assertWellFormedBreakTargets(reactiveFunction);
157465
156610
  pruneUnusedLabels(reactiveFunction);
157466
- yield log({
157467
- kind: 'reactive',
157468
- name: 'PruneUnusedLabels',
157469
- value: reactiveFunction,
157470
- });
156611
+ log({kind: 'reactive', name: 'PruneUnusedLabels', value: reactiveFunction});
157471
156612
  assertScopeInstructionsWithinScopes(reactiveFunction);
157472
156613
  pruneNonEscapingScopes(reactiveFunction);
157473
- yield log({
156614
+ log({
157474
156615
  kind: 'reactive',
157475
156616
  name: 'PruneNonEscapingScopes',
157476
156617
  value: reactiveFunction,
157477
156618
  });
157478
156619
  pruneNonReactiveDependencies(reactiveFunction);
157479
- yield log({
156620
+ log({
157480
156621
  kind: 'reactive',
157481
156622
  name: 'PruneNonReactiveDependencies',
157482
156623
  value: reactiveFunction,
157483
156624
  });
157484
156625
  pruneUnusedScopes(reactiveFunction);
157485
- yield log({
157486
- kind: 'reactive',
157487
- name: 'PruneUnusedScopes',
157488
- value: reactiveFunction,
157489
- });
156626
+ log({kind: 'reactive', name: 'PruneUnusedScopes', value: reactiveFunction});
157490
156627
  mergeReactiveScopesThatInvalidateTogether(reactiveFunction);
157491
- yield log({
156628
+ log({
157492
156629
  kind: 'reactive',
157493
156630
  name: 'MergeReactiveScopesThatInvalidateTogether',
157494
156631
  value: reactiveFunction,
157495
156632
  });
157496
156633
  pruneAlwaysInvalidatingScopes(reactiveFunction);
157497
- yield log({
156634
+ log({
157498
156635
  kind: 'reactive',
157499
156636
  name: 'PruneAlwaysInvalidatingScopes',
157500
156637
  value: reactiveFunction,
157501
156638
  });
157502
156639
  if (env.config.enableChangeDetectionForDebugging != null) {
157503
156640
  pruneInitializationDependencies(reactiveFunction);
157504
- yield log({
156641
+ log({
157505
156642
  kind: 'reactive',
157506
156643
  name: 'PruneInitializationDependencies',
157507
156644
  value: reactiveFunction,
157508
156645
  });
157509
156646
  }
157510
156647
  propagateEarlyReturns(reactiveFunction);
157511
- yield log({
156648
+ log({
157512
156649
  kind: 'reactive',
157513
156650
  name: 'PropagateEarlyReturns',
157514
156651
  value: reactiveFunction,
157515
156652
  });
157516
156653
  pruneUnusedLValues(reactiveFunction);
157517
- yield log({
157518
- kind: 'reactive',
157519
- name: 'PruneUnusedLValues',
157520
- value: reactiveFunction,
157521
- });
156654
+ log({kind: 'reactive', name: 'PruneUnusedLValues', value: reactiveFunction});
157522
156655
  promoteUsedTemporaries(reactiveFunction);
157523
- yield log({
156656
+ log({
157524
156657
  kind: 'reactive',
157525
156658
  name: 'PromoteUsedTemporaries',
157526
156659
  value: reactiveFunction,
157527
156660
  });
157528
156661
  extractScopeDeclarationsFromDestructuring(reactiveFunction);
157529
- yield log({
156662
+ log({
157530
156663
  kind: 'reactive',
157531
156664
  name: 'ExtractScopeDeclarationsFromDestructuring',
157532
156665
  value: reactiveFunction,
157533
156666
  });
157534
156667
  stabilizeBlockIds(reactiveFunction);
157535
- yield log({
157536
- kind: 'reactive',
157537
- name: 'StabilizeBlockIds',
157538
- value: reactiveFunction,
157539
- });
156668
+ log({kind: 'reactive', name: 'StabilizeBlockIds', value: reactiveFunction});
157540
156669
  const uniqueIdentifiers = renameVariables(reactiveFunction);
157541
- yield log({
157542
- kind: 'reactive',
157543
- name: 'RenameVariables',
157544
- value: reactiveFunction,
157545
- });
156670
+ log({kind: 'reactive', name: 'RenameVariables', value: reactiveFunction});
157546
156671
  pruneHoistedContexts(reactiveFunction);
157547
- yield log({
156672
+ log({
157548
156673
  kind: 'reactive',
157549
156674
  name: 'PruneHoistedContexts',
157550
156675
  value: reactiveFunction,
@@ -157562,9 +156687,9 @@ function* runWithEnvironment(func, env) {
157562
156687
  uniqueIdentifiers: uniqueIdentifiers,
157563
156688
  fbtOperands: fbtOperands,
157564
156689
  }).unwrap();
157565
- yield log({kind: 'ast', name: 'Codegen', value: ast});
156690
+ log({kind: 'ast', name: 'Codegen', value: ast});
157566
156691
  for (const outlined of ast.outlined) {
157567
- yield log({kind: 'ast', name: 'Codegen (outlined)', value: outlined.fn});
156692
+ log({kind: 'ast', name: 'Codegen (outlined)', value: outlined.fn});
157568
156693
  }
157569
156694
  if (env.config.throwUnknownException__testonly) {
157570
156695
  throw new Error('unexpected error');
@@ -157580,7 +156705,7 @@ function compileFn(
157580
156705
  filename,
157581
156706
  code
157582
156707
  ) {
157583
- let generator = run(
156708
+ return run(
157584
156709
  func,
157585
156710
  config,
157586
156711
  fnType,
@@ -157589,40 +156714,6 @@ function compileFn(
157589
156714
  filename,
157590
156715
  code
157591
156716
  );
157592
- while (true) {
157593
- const next = generator.next();
157594
- if (next.done) {
157595
- return next.value;
157596
- }
157597
- }
157598
- }
157599
- function log(value) {
157600
- switch (value.kind) {
157601
- case 'ast': {
157602
- logCodegenFunction(value.name, value.value);
157603
- break;
157604
- }
157605
- case 'hir': {
157606
- logHIRFunction(value.name, value.value);
157607
- break;
157608
- }
157609
- case 'reactive': {
157610
- logReactiveFunction(value.name, value.value);
157611
- break;
157612
- }
157613
- case 'debug': {
157614
- logDebug(value.name, value.value);
157615
- break;
157616
- }
157617
- default: {
157618
- assertExhaustive(value, 'Unexpected compilation kind');
157619
- }
157620
- }
157621
- return value;
157622
- }
157623
- function* runPlayground(func, config, fnType) {
157624
- const ast = yield* run(func, config, fnType, '_c', null, null, null);
157625
- return ast;
157626
156717
  }
157627
156718
  function isComponentDeclaration(node) {
157628
156719
  return Object.prototype.hasOwnProperty.call(node, '__componentDeclaration');
@@ -158172,6 +157263,13 @@ function compileProgram(program, pass) {
158172
157263
  if (environment.enableChangeDetectionForDebugging != null) {
158173
157264
  externalFunctions.push(environment.enableChangeDetectionForDebugging);
158174
157265
  }
157266
+ const hasFireRewrite = compiledFns.some(c => c.compiledFn.hasFireRewrite);
157267
+ if (environment.enableFire && hasFireRewrite) {
157268
+ externalFunctions.push({
157269
+ source: getReactCompilerRuntimeModule(pass.opts),
157270
+ importSpecifierName: 'useFire',
157271
+ });
157272
+ }
158175
157273
  } catch (err) {
158176
157274
  handleError(err, pass, null);
158177
157275
  return;
@@ -158641,7 +157739,10 @@ function BabelPluginReactCompiler(_babel) {
158641
157739
  ) {
158642
157740
  opts = injectReanimatedFlag(opts);
158643
157741
  }
158644
- if (isDev) {
157742
+ if (
157743
+ opts.environment.enableResetCacheOnSourceFileChanges !== false &&
157744
+ isDev
157745
+ ) {
158645
157746
  opts = Object.assign(Object.assign({}, opts), {
158646
157747
  environment: Object.assign(Object.assign({}, opts.environment), {
158647
157748
  enableResetCacheOnSourceFileChanges: true,
@@ -158704,7 +157805,5 @@ exports.parseConfigPragmaForTests = parseConfigPragmaForTests;
158704
157805
  exports.parsePluginOptions = parsePluginOptions;
158705
157806
  exports.printHIR = printHIR;
158706
157807
  exports.printReactiveFunction = printReactiveFunction;
158707
- exports.run = run;
158708
157808
  exports.runBabelPluginReactCompiler = runBabelPluginReactCompiler;
158709
- exports.runPlayground = runPlayground;
158710
157809
  exports.validateEnvironmentConfig = validateEnvironmentConfig;