@simulacrum/auth0-simulator 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -77,8 +77,7 @@ const convertToObj = (arrayOfObjects, key$1 = "id") => arrayOfObjects.reduce((fi
77
77
  }, {});
78
78
  const convertInitialStateToStoreState = (initialState) => {
79
79
  if (!initialState) return void 0;
80
- const storeObject = { users: convertToObj(initialState.users, "id") };
81
- return storeObject;
80
+ return { users: convertToObj(initialState.users, "id") };
82
81
  };
83
82
 
84
83
  //#endregion
@@ -86,12 +85,11 @@ const convertInitialStateToStoreState = (initialState) => {
86
85
  const inputSchema = (initialState, extendedSchema) => ({ slice: slice$3 }) => {
87
86
  const storeInitialState = convertInitialStateToStoreState(initialState);
88
87
  const extended = extendedSchema ? extendedSchema({ slice: slice$3 }) : {};
89
- let slices = {
88
+ return {
90
89
  sessions: slice$3.table(),
91
90
  users: slice$3.table({ ...!storeInitialState ? { initialState: { [defaultUser.id]: defaultUser } } : { initialState: storeInitialState.users } }),
92
91
  ...extended
93
92
  };
94
- return slices;
95
93
  };
96
94
  const inputActions = (args) => {
97
95
  return {};
@@ -190,8 +188,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
190
188
  function depd(namespace) {
191
189
  if (!namespace) throw new TypeError("argument namespace is required");
192
190
  var stack = getStack();
193
- var site = callSiteLocation(stack[1]);
194
- var file = site[0];
191
+ var file = callSiteLocation(stack[1])[0];
195
192
  function deprecate$3(message) {
196
193
  log$1.call(deprecate$3, message);
197
194
  }
@@ -216,8 +213,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
216
213
  * @private
217
214
  */
218
215
  function eehaslisteners(emitter, type) {
219
- var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
220
- return count > 0;
216
+ return (typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type)) > 0;
221
217
  }
222
218
  /**
223
219
  * Determine if namespace is ignored.
@@ -276,8 +272,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
276
272
  process.emit("deprecation", err);
277
273
  return;
278
274
  }
279
- var format$4 = process.stderr.isTTY ? formatColor : formatPlain;
280
- var output = format$4.call(this, msg, caller, stack.slice(i$6));
275
+ var output = (process.stderr.isTTY ? formatColor : formatPlain).call(this, msg, caller, stack.slice(i$6));
281
276
  process.stderr.write(output + "\n", "utf8");
282
277
  }
283
278
  /**
@@ -314,8 +309,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
314
309
  * Format deprecation message without color.
315
310
  */
316
311
  function formatPlain(msg, caller, stack) {
317
- var timestamp = (/* @__PURE__ */ new Date()).toUTCString();
318
- var formatted = timestamp + " " + this._namespace + " deprecated " + msg;
312
+ var formatted = (/* @__PURE__ */ new Date()).toUTCString() + " " + this._namespace + " deprecated " + msg;
319
313
  if (this._traced) {
320
314
  for (var i$6 = 0; i$6 < stack.length; i$6++) formatted += "\n at " + stack[i$6].toString();
321
315
  return formatted;
@@ -371,8 +365,7 @@ var require_depd = /* @__PURE__ */ __commonJS({ "../../node_modules/depd/index.j
371
365
  var stack = getStack();
372
366
  var site = callSiteLocation(stack[1]);
373
367
  site.name = fn.name;
374
- var deprecatedfn = new Function("fn", "log", "deprecate", "message", "site", "\"use strict\"\nreturn function (" + args + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn, log$1, this, message, site);
375
- return deprecatedfn;
368
+ return new Function("fn", "log", "deprecate", "message", "site", "\"use strict\"\nreturn function (" + args + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn, log$1, this, message, site);
376
369
  }
377
370
  /**
378
371
  * Wrap property in a deprecation message.
@@ -916,8 +909,7 @@ var require_ms = /* @__PURE__ */ __commonJS({ "../../node_modules/ms/index.js":
916
909
  var match$1 = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
917
910
  if (!match$1) return;
918
911
  var n = parseFloat(match$1[1]);
919
- var type = (match$1[2] || "ms").toLowerCase();
920
- switch (type) {
912
+ switch ((match$1[2] || "ms").toLowerCase()) {
921
913
  case "years":
922
914
  case "year":
923
915
  case "yrs":
@@ -949,7 +941,7 @@ var require_ms = /* @__PURE__ */ __commonJS({ "../../node_modules/ms/index.js":
949
941
  case "msecs":
950
942
  case "msec":
951
943
  case "ms": return n;
952
- default: return void 0;
944
+ default: return;
953
945
  }
954
946
  }
955
947
  /**
@@ -1052,8 +1044,7 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/debug/src/
1052
1044
  if (!debug$11.enabled) return;
1053
1045
  const self = debug$11;
1054
1046
  const curr = Number(/* @__PURE__ */ new Date());
1055
- const ms$1 = curr - (prevTime || curr);
1056
- self.diff = ms$1;
1047
+ self.diff = curr - (prevTime || curr);
1057
1048
  self.prev = prevTime;
1058
1049
  self.curr = curr;
1059
1050
  prevTime = curr;
@@ -1073,8 +1064,7 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/debug/src/
1073
1064
  return match$1;
1074
1065
  });
1075
1066
  createDebug.formatArgs.call(self, args);
1076
- const logFn = self.log || createDebug.log;
1077
- logFn.apply(self, args);
1067
+ (self.log || createDebug.log).apply(self, args);
1078
1068
  }
1079
1069
  debug$11.namespace = namespace;
1080
1070
  debug$11.useColors = createDebug.useColors();
@@ -1809,7 +1799,6 @@ var require_on_finished = /* @__PURE__ */ __commonJS({ "../../node_modules/on-fi
1809
1799
  var socket = msg.socket;
1810
1800
  if (typeof msg.finished === "boolean") return Boolean(msg.finished || socket && !socket.writable);
1811
1801
  if (typeof msg.complete === "boolean") return Boolean(msg.upgrade || !socket || !socket.readable || msg.complete && !msg.readable);
1812
- return void 0;
1813
1802
  }
1814
1803
  /**
1815
1804
  * Attach a finished listener to the message.
@@ -2000,8 +1989,7 @@ var require_bytes = /* @__PURE__ */ __commonJS({ "../../node_modules/bytes/index
2000
1989
  else if (mag >= map.mb) unit = "MB";
2001
1990
  else if (mag >= map.kb) unit = "KB";
2002
1991
  else unit = "B";
2003
- var val = value / map[unit.toLowerCase()];
2004
- var str = val.toFixed(decimalPlaces);
1992
+ var str = (value / map[unit.toLowerCase()]).toFixed(decimalPlaces);
2005
1993
  if (!fixedDecimals) str = str.replace(formatDecimalsRegExp, "$1");
2006
1994
  if (thousandsSeparator) str = str.split(".").map(function(s$1, i$6) {
2007
1995
  return i$6 === 0 ? s$1.replace(formatThousandsRegExp, thousandsSeparator) : s$1;
@@ -27666,8 +27654,7 @@ var require_mime_types = /* @__PURE__ */ __commonJS({ "../../node_modules/mime-t
27666
27654
  */
27667
27655
  function populateMaps(extensions, types) {
27668
27656
  Object.keys(db).forEach(function forEachMimeType(type) {
27669
- var mime$5 = db[type];
27670
- var exts = mime$5.extensions;
27657
+ var exts = db[type].extensions;
27671
27658
  if (!exts || !exts.length) return;
27672
27659
  extensions[type] = exts;
27673
27660
  for (var i$6 = 0; i$6 < exts.length; i$6++) {
@@ -27984,7 +27971,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/body-pars
27984
27971
  try {
27985
27972
  return (contentType$1.parse(req$2).parameters.charset || "").toLowerCase();
27986
27973
  } catch {
27987
- return void 0;
27974
+ return;
27988
27975
  }
27989
27976
  }
27990
27977
  /**
@@ -28311,12 +28298,9 @@ var require_object_inspect = /* @__PURE__ */ __commonJS({ "../../node_modules/ob
28311
28298
  var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null;
28312
28299
  var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === "function" ? setSizeDescriptor.get : null;
28313
28300
  var setForEach = hasSet && Set.prototype.forEach;
28314
- var hasWeakMap = typeof WeakMap === "function" && WeakMap.prototype;
28315
- var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
28316
- var hasWeakSet = typeof WeakSet === "function" && WeakSet.prototype;
28317
- var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
28318
- var hasWeakRef = typeof WeakRef === "function" && WeakRef.prototype;
28319
- var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
28301
+ var weakMapHas = typeof WeakMap === "function" && WeakMap.prototype ? WeakMap.prototype.has : null;
28302
+ var weakSetHas = typeof WeakSet === "function" && WeakSet.prototype ? WeakSet.prototype.has : null;
28303
+ var weakRefDeref = typeof WeakRef === "function" && WeakRef.prototype ? WeakRef.prototype.deref : null;
28320
28304
  var booleanValueOf = Boolean.prototype.valueOf;
28321
28305
  var objectToString = Object.prototype.toString;
28322
28306
  var functionToString = Function.prototype.toString;
@@ -28467,8 +28451,7 @@ var require_object_inspect = /* @__PURE__ */ __commonJS({ "../../node_modules/ob
28467
28451
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
28468
28452
  var protoTag = obj instanceof Object ? "" : "null prototype";
28469
28453
  var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
28470
- var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
28471
- var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
28454
+ var tag = (isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "") + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
28472
28455
  if (ys.length === 0) return tag + "{}";
28473
28456
  if (indent) return tag + "{" + indentedJoin(ys, indent) + "}";
28474
28457
  return tag + "{ " + $join.call(ys, ", ") + " }";
@@ -28711,7 +28694,7 @@ var require_side_channel_list = /* @__PURE__ */ __commonJS({ "../../node_modules
28711
28694
  };
28712
28695
  /** @type {import('./list.d.ts').listGet} */
28713
28696
  var listGet = function(objects, key$1) {
28714
- if (!objects) return void 0;
28697
+ if (!objects) return;
28715
28698
  var node = listGetNode(objects, key$1);
28716
28699
  return node && node.value;
28717
28700
  };
@@ -29259,8 +29242,7 @@ var require_get_intrinsic = /* @__PURE__ */ __commonJS({ "../../node_modules/get
29259
29242
  if (getProto) try {
29260
29243
  null.error;
29261
29244
  } catch (e) {
29262
- var errorProto = getProto(getProto(e));
29263
- INTRINSICS["%Error.prototype%"] = errorProto;
29245
+ INTRINSICS["%Error.prototype%"] = getProto(getProto(e));
29264
29246
  }
29265
29247
  var doEval = function doEval$1(name) {
29266
29248
  var value;
@@ -29433,7 +29415,7 @@ var require_get_intrinsic = /* @__PURE__ */ __commonJS({ "../../node_modules/get
29433
29415
  else if (value != null) {
29434
29416
  if (!(part in value)) {
29435
29417
  if (!allowMissing) throw new $TypeError$3("base intrinsic for " + name + " exists, but the property is not available.");
29436
- return void 0;
29418
+ return;
29437
29419
  }
29438
29420
  if ($gOPD && i$6 + 1 >= parts.length) {
29439
29421
  var desc$1 = $gOPD(value, part);
@@ -29537,7 +29519,7 @@ var require_side_channel_weakmap = /* @__PURE__ */ __commonJS({ "../../node_modu
29537
29519
  /** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
29538
29520
  var $weakMapDelete = callBound("WeakMap.prototype.delete", true);
29539
29521
  /** @type {import('.')} */
29540
- module.exports = $WeakMap ? function getSideChannelWeakMap$1() {
29522
+ module.exports = $WeakMap ? function getSideChannelWeakMap() {
29541
29523
  /** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel */
29542
29524
  /** @typedef {Parameters<Channel['get']>[0]} K */
29543
29525
  /** @typedef {Parameters<Channel['set']>[1]} V */
@@ -29589,8 +29571,7 @@ var require_side_channel = /* @__PURE__ */ __commonJS({ "../../node_modules/side
29589
29571
  var inspect = require_object_inspect();
29590
29572
  var getSideChannelList = require_side_channel_list();
29591
29573
  var getSideChannelMap = require_side_channel_map();
29592
- var getSideChannelWeakMap = require_side_channel_weakmap();
29593
- var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
29574
+ var makeChannel = require_side_channel_weakmap() || getSideChannelMap || getSideChannelList;
29594
29575
  /** @type {import('.')} */
29595
29576
  module.exports = function getSideChannel$1() {
29596
29577
  /** @typedef {ReturnType<typeof getSideChannel>} Channel */
@@ -30141,9 +30122,8 @@ var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/qs/lib/pars
30141
30122
  var charset$1 = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
30142
30123
  var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates;
30143
30124
  if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") throw new TypeError("The duplicates option must be either combine, first, or last");
30144
- var allowDots = typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
30145
30125
  return {
30146
- allowDots,
30126
+ allowDots: typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots,
30147
30127
  allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
30148
30128
  allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes,
30149
30129
  allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse,
@@ -30522,7 +30502,7 @@ var require_parseurl = /* @__PURE__ */ __commonJS({ "../../node_modules/parseurl
30522
30502
  */
30523
30503
  function parseurl(req$2) {
30524
30504
  var url$2 = req$2.url;
30525
- if (url$2 === void 0) return void 0;
30505
+ if (url$2 === void 0) return;
30526
30506
  var parsed = req$2._parsedUrl;
30527
30507
  if (fresh$3(url$2, parsed)) return parsed;
30528
30508
  parsed = fastparse(url$2);
@@ -30788,8 +30768,7 @@ var require_finalhandler = /* @__PURE__ */ __commonJS({ "../../node_modules/fina
30788
30768
  * @private
30789
30769
  */
30790
30770
  function createHtmlDocument$2(message) {
30791
- var body = escapeHtml$3(message).replaceAll("\n", "<br>").replaceAll(" ", " &nbsp;");
30792
- return "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>" + body + "</pre>\n</body>\n</html>\n";
30771
+ return "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>" + escapeHtml$3(message).replaceAll("\n", "<br>").replaceAll(" ", " &nbsp;") + "</pre>\n</body>\n</html>\n";
30793
30772
  }
30794
30773
  /**
30795
30774
  * Module exports.
@@ -30844,7 +30823,7 @@ var require_finalhandler = /* @__PURE__ */ __commonJS({ "../../node_modules/fina
30844
30823
  * @private
30845
30824
  */
30846
30825
  function getErrorHeaders(err) {
30847
- if (!err.headers || typeof err.headers !== "object") return void 0;
30826
+ if (!err.headers || typeof err.headers !== "object") return;
30848
30827
  return { ...err.headers };
30849
30828
  }
30850
30829
  /**
@@ -30874,7 +30853,6 @@ var require_finalhandler = /* @__PURE__ */ __commonJS({ "../../node_modules/fina
30874
30853
  function getErrorStatusCode(err) {
30875
30854
  if (typeof err.status === "number" && err.status >= 400 && err.status < 600) return err.status;
30876
30855
  if (typeof err.statusCode === "number" && err.statusCode >= 400 && err.statusCode < 600) return err.statusCode;
30877
- return void 0;
30878
30856
  }
30879
30857
  /**
30880
30858
  * Get resource name for the request.
@@ -31071,7 +31049,7 @@ var require_view = /* @__PURE__ */ __commonJS({ "../../node_modules/express/lib/
31071
31049
  try {
31072
31050
  return fs$4.statSync(path$7);
31073
31051
  } catch (e) {
31074
- return void 0;
31052
+ return;
31075
31053
  }
31076
31054
  }
31077
31055
  }) });
@@ -31105,8 +31083,7 @@ var require_etag = /* @__PURE__ */ __commonJS({ "../../node_modules/etag/index.j
31105
31083
  function entitytag(entity) {
31106
31084
  if (entity.length === 0) return "\"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk\"";
31107
31085
  var hash = crypto$1.createHash("sha1").update(entity, "utf8").digest("base64").substring(0, 27);
31108
- var len = typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length;
31109
- return "\"" + len.toString(16) + "-" + hash + "\"";
31086
+ return "\"" + (typeof entity === "string" ? Buffer.byteLength(entity, "utf8") : entity.length).toString(16) + "-" + hash + "\"";
31110
31087
  }
31111
31088
  /**
31112
31089
  * Create a simple ETag.
@@ -31145,8 +31122,7 @@ var require_etag = /* @__PURE__ */ __commonJS({ "../../node_modules/etag/index.j
31145
31122
  */
31146
31123
  function stattag(stat) {
31147
31124
  var mtime = stat.mtime.getTime().toString(16);
31148
- var size = stat.size.toString(16);
31149
- return "\"" + size + "-" + mtime + "\"";
31125
+ return "\"" + stat.size.toString(16) + "-" + mtime + "\"";
31150
31126
  }
31151
31127
  }) });
31152
31128
 
@@ -31168,9 +31144,7 @@ var require_forwarded = /* @__PURE__ */ __commonJS({ "../../node_modules/forward
31168
31144
  function forwarded$1(req$2) {
31169
31145
  if (!req$2) throw new TypeError("argument req is required");
31170
31146
  var proxyAddrs = parse$5(req$2.headers["x-forwarded-for"] || "");
31171
- var socketAddr = getSocketAddr(req$2);
31172
- var addrs = [socketAddr].concat(proxyAddrs);
31173
- return addrs;
31147
+ return [getSocketAddr(req$2)].concat(proxyAddrs);
31174
31148
  }
31175
31149
  /**
31176
31150
  * Get the socket address for a request.
@@ -31213,9 +31187,7 @@ var require_forwarded = /* @__PURE__ */ __commonJS({ "../../node_modules/forward
31213
31187
  //#region ../../node_modules/ipaddr.js/lib/ipaddr.js
31214
31188
  var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/lib/ipaddr.js": ((exports, module) => {
31215
31189
  (function() {
31216
- var expandIPv6, ipaddr$1, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root, zoneIndex;
31217
- ipaddr$1 = {};
31218
- root = this;
31190
+ var expandIPv6, ipaddr$1 = {}, ipv4Part, ipv4Regexes, ipv6Part, ipv6Regexes, matchCIDR, root = this, zoneIndex;
31219
31191
  if (typeof module !== "undefined" && module !== null && module.exports) module.exports = ipaddr$1;
31220
31192
  else root["ipaddr"] = ipaddr$1;
31221
31193
  matchCIDR = function(first$2, second, partSize, cidrBits) {
@@ -31377,8 +31349,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31377
31349
  return ipaddr$1.IPv6.parse("::ffff:" + this.toString());
31378
31350
  };
31379
31351
  IPv4.prototype.prefixLengthFromSubnetMask = function() {
31380
- var cidr, i$6, k, octet, stop, zeros, zerotable;
31381
- zerotable = {
31352
+ var cidr, i$6, k, octet, stop, zeros, zerotable = {
31382
31353
  0: 8,
31383
31354
  128: 7,
31384
31355
  192: 6,
@@ -31410,15 +31381,12 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31410
31381
  longValue: new RegExp("^" + ipv4Part + "$", "i")
31411
31382
  };
31412
31383
  ipaddr$1.IPv4.parser = function(string) {
31413
- var match$1, parseIntAuto, part, shift, value;
31414
- parseIntAuto = function(string$1) {
31384
+ var match$1, parseIntAuto = function(string$1) {
31415
31385
  if (string$1[0] === "0" && string$1[1] !== "x") return parseInt(string$1, 8);
31416
31386
  else return parseInt(string$1);
31417
- };
31387
+ }, part, shift, value;
31418
31388
  if (match$1 = string.match(ipv4Regexes.fourOctet)) return (function() {
31419
- var k, len, ref, results;
31420
- ref = match$1.slice(1, 6);
31421
- results = [];
31389
+ var k, len, ref = match$1.slice(1, 6), results = [];
31422
31390
  for (k = 0, len = ref.length; k < len; k++) {
31423
31391
  part = ref[k];
31424
31392
  results.push(parseIntAuto(part));
@@ -31429,8 +31397,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31429
31397
  value = parseIntAuto(match$1[1]);
31430
31398
  if (value > 4294967295 || value < 0) throw new Error("ipaddr: address outside defined range");
31431
31399
  return (function() {
31432
- var k, results;
31433
- results = [];
31400
+ var k, results = [];
31434
31401
  for (shift = k = 0; k <= 24; shift = k += 8) results.push(value >> shift & 255);
31435
31402
  return results;
31436
31403
  })().reverse();
@@ -31458,9 +31425,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31458
31425
  return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::");
31459
31426
  };
31460
31427
  IPv6.prototype.toRFC5952String = function() {
31461
- var bestMatchIndex, bestMatchLength, match$1, regex, string;
31462
- regex = /((^|:)(0(:|$)){2,})/g;
31463
- string = this.toNormalizedString();
31428
+ var bestMatchIndex, bestMatchLength, match$1, regex = /((^|:)(0(:|$)){2,})/g, string = this.toNormalizedString();
31464
31429
  bestMatchIndex = 0;
31465
31430
  bestMatchLength = -1;
31466
31431
  while (match$1 = regex.exec(string)) if (match$1[0].length > bestMatchLength) {
@@ -31471,9 +31436,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31471
31436
  return string.substring(0, bestMatchIndex) + "::" + string.substring(bestMatchIndex + bestMatchLength);
31472
31437
  };
31473
31438
  IPv6.prototype.toByteArray = function() {
31474
- var bytes$3, k, len, part, ref;
31475
- bytes$3 = [];
31476
- ref = this.parts;
31439
+ var bytes$3 = [], k, len, part, ref = this.parts;
31477
31440
  for (k = 0, len = ref.length; k < len; k++) {
31478
31441
  part = ref[k];
31479
31442
  bytes$3.push(part >> 8);
@@ -31482,34 +31445,26 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31482
31445
  return bytes$3;
31483
31446
  };
31484
31447
  IPv6.prototype.toNormalizedString = function() {
31485
- var addr, part, suffix;
31486
- addr = (function() {
31487
- var k, len, ref, results;
31488
- ref = this.parts;
31489
- results = [];
31448
+ var addr = (function() {
31449
+ var k, len, ref = this.parts, results = [];
31490
31450
  for (k = 0, len = ref.length; k < len; k++) {
31491
31451
  part = ref[k];
31492
31452
  results.push(part.toString(16));
31493
31453
  }
31494
31454
  return results;
31495
- }).call(this).join(":");
31496
- suffix = "";
31455
+ }).call(this).join(":"), part, suffix = "";
31497
31456
  if (this.zoneId) suffix = "%" + this.zoneId;
31498
31457
  return addr + suffix;
31499
31458
  };
31500
31459
  IPv6.prototype.toFixedLengthString = function() {
31501
- var addr, part, suffix;
31502
- addr = (function() {
31503
- var k, len, ref, results;
31504
- ref = this.parts;
31505
- results = [];
31460
+ var addr = (function() {
31461
+ var k, len, ref = this.parts, results = [];
31506
31462
  for (k = 0, len = ref.length; k < len; k++) {
31507
31463
  part = ref[k];
31508
31464
  results.push(part.toString(16).padStart(4, "0"));
31509
31465
  }
31510
31466
  return results;
31511
- }).call(this).join(":");
31512
- suffix = "";
31467
+ }).call(this).join(":"), part, suffix = "";
31513
31468
  if (this.zoneId) suffix = "%" + this.zoneId;
31514
31469
  return addr + suffix;
31515
31470
  };
@@ -31649,8 +31604,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31649
31604
  ]);
31650
31605
  };
31651
31606
  IPv6.prototype.prefixLengthFromSubnetMask = function() {
31652
- var cidr, i$6, k, part, stop, zeros, zerotable;
31653
- zerotable = {
31607
+ var cidr, i$6, k, part, stop, zeros, zerotable = {
31654
31608
  0: 16,
31655
31609
  32768: 15,
31656
31610
  49152: 14,
@@ -31712,9 +31666,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31712
31666
  if (string[0] === ":") string = string.slice(1);
31713
31667
  if (string[string.length - 1] === ":") string = string.slice(0, -1);
31714
31668
  parts = (function() {
31715
- var k, len, ref, results;
31716
- ref = string.split(":");
31717
- results = [];
31669
+ var k, len, ref = string.split(":"), results = [];
31718
31670
  for (k = 0, len = ref.length; k < len; k++) {
31719
31671
  part = ref[k];
31720
31672
  results.push(parseInt(part, 16));
@@ -31757,12 +31709,10 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31757
31709
  return this.parser(string) !== null;
31758
31710
  };
31759
31711
  ipaddr$1.IPv4.isValid = function(string) {
31760
- var e;
31761
31712
  try {
31762
31713
  new this(this.parser(string));
31763
31714
  return true;
31764
31715
  } catch (error1) {
31765
- e = error1;
31766
31716
  return false;
31767
31717
  }
31768
31718
  };
@@ -31771,26 +31721,23 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31771
31721
  else return false;
31772
31722
  };
31773
31723
  ipaddr$1.IPv6.isValid = function(string) {
31774
- var addr, e;
31724
+ var addr;
31775
31725
  if (typeof string === "string" && string.indexOf(":") === -1) return false;
31776
31726
  try {
31777
31727
  addr = this.parser(string);
31778
31728
  new this(addr.parts, addr.zoneId);
31779
31729
  return true;
31780
31730
  } catch (error1) {
31781
- e = error1;
31782
31731
  return false;
31783
31732
  }
31784
31733
  };
31785
31734
  ipaddr$1.IPv4.parse = function(string) {
31786
- var parts;
31787
- parts = this.parser(string);
31735
+ var parts = this.parser(string);
31788
31736
  if (parts === null) throw new Error("ipaddr: string is not formatted like ip address");
31789
31737
  return new this(parts);
31790
31738
  };
31791
31739
  ipaddr$1.IPv6.parse = function(string) {
31792
- var addr;
31793
- addr = this.parser(string);
31740
+ var addr = this.parser(string);
31794
31741
  if (addr.parts === null) throw new Error("ipaddr: string is not formatted like ip address");
31795
31742
  return new this(addr.parts, addr.zoneId);
31796
31743
  };
@@ -31828,7 +31775,7 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31828
31775
  return new this(octets);
31829
31776
  };
31830
31777
  ipaddr$1.IPv4.broadcastAddressFromCIDR = function(string) {
31831
- var cidr, error, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31778
+ var cidr, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31832
31779
  try {
31833
31780
  cidr = this.parseCIDR(string);
31834
31781
  ipInterfaceOctets = cidr[0].toByteArray();
@@ -31841,12 +31788,11 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31841
31788
  }
31842
31789
  return new this(octets);
31843
31790
  } catch (error1) {
31844
- error = error1;
31845
31791
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
31846
31792
  }
31847
31793
  };
31848
31794
  ipaddr$1.IPv4.networkAddressFromCIDR = function(string) {
31849
- var cidr, error, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31795
+ var cidr, i$6, ipInterfaceOctets, octets, subnetMaskOctets;
31850
31796
  try {
31851
31797
  cidr = this.parseCIDR(string);
31852
31798
  ipInterfaceOctets = cidr[0].toByteArray();
@@ -31859,7 +31805,6 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31859
31805
  }
31860
31806
  return new this(octets);
31861
31807
  } catch (error1) {
31862
- error = error1;
31863
31808
  throw new Error("ipaddr: the address does not have IPv4 CIDR format");
31864
31809
  }
31865
31810
  };
@@ -31886,29 +31831,24 @@ var require_ipaddr = /* @__PURE__ */ __commonJS({ "../../node_modules/ipaddr.js/
31886
31831
  else throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
31887
31832
  };
31888
31833
  ipaddr$1.parseCIDR = function(string) {
31889
- var e;
31890
31834
  try {
31891
31835
  return ipaddr$1.IPv6.parseCIDR(string);
31892
31836
  } catch (error1) {
31893
- e = error1;
31894
31837
  try {
31895
31838
  return ipaddr$1.IPv4.parseCIDR(string);
31896
31839
  } catch (error1$1) {
31897
- e = error1$1;
31898
31840
  throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format");
31899
31841
  }
31900
31842
  }
31901
31843
  };
31902
31844
  ipaddr$1.fromByteArray = function(bytes$3) {
31903
- var length;
31904
- length = bytes$3.length;
31845
+ var length = bytes$3.length;
31905
31846
  if (length === 4) return new ipaddr$1.IPv4(bytes$3);
31906
31847
  else if (length === 16) return new ipaddr$1.IPv6(bytes$3);
31907
31848
  else throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address");
31908
31849
  };
31909
31850
  ipaddr$1.process = function(string) {
31910
- var addr;
31911
- addr = this.parse(string);
31851
+ var addr = this.parse(string);
31912
31852
  if (addr.kind() === "ipv6" && addr.isIPv4MappedAddress()) return addr.toIPv4Address();
31913
31853
  else return addr;
31914
31854
  };
@@ -32041,8 +31981,7 @@ var require_proxy_addr = /* @__PURE__ */ __commonJS({ "../../node_modules/proxy-
32041
31981
  */
32042
31982
  function parseNetmask(netmask) {
32043
31983
  var ip = parseip(netmask);
32044
- var kind = ip.kind();
32045
- return kind === "ipv4" ? ip.prefixLengthFromSubnetMask() : null;
31984
+ return ip.kind() === "ipv4" ? ip.prefixLengthFromSubnetMask() : null;
32046
31985
  }
32047
31986
  /**
32048
31987
  * Determine address of proxied request.
@@ -32055,8 +31994,7 @@ var require_proxy_addr = /* @__PURE__ */ __commonJS({ "../../node_modules/proxy-
32055
31994
  if (!req$2) throw new TypeError("req argument is required");
32056
31995
  if (!trust) throw new TypeError("trust argument is required");
32057
31996
  var addrs = alladdrs(req$2, trust);
32058
- var addr = addrs[addrs.length - 1];
32059
- return addr;
31997
+ return addrs[addrs.length - 1];
32060
31998
  }
32061
31999
  /**
32062
32000
  * Static trust function to trust nothing.
@@ -32108,8 +32046,7 @@ var require_proxy_addr = /* @__PURE__ */ __commonJS({ "../../node_modules/proxy-
32108
32046
  return function trust(addr) {
32109
32047
  if (!isip(addr)) return false;
32110
32048
  var ip = parseip(addr);
32111
- var kind = ip.kind();
32112
- if (kind !== subnetkind) {
32049
+ if (ip.kind() !== subnetkind) {
32113
32050
  if (subnetisipv4 && !ip.isIPv4MappedAddress()) return false;
32114
32051
  ip = subnetisipv4 ? ip.toIPv4Address() : ip.toIPv4MappedAddress();
32115
32052
  }
@@ -32377,8 +32314,7 @@ var require_once = /* @__PURE__ */ __commonJS({ "../../node_modules/once/once.js
32377
32314
  f.called = true;
32378
32315
  return f.value = fn.apply(this, arguments);
32379
32316
  };
32380
- var name = fn.name || "Function wrapped with `once`";
32381
- f.onceError = name + " shouldn't be called more than once";
32317
+ f.onceError = (fn.name || "Function wrapped with `once`") + " shouldn't be called more than once";
32382
32318
  f.called = false;
32383
32319
  return f;
32384
32320
  }
@@ -32398,7 +32334,6 @@ var require_is_promise = /* @__PURE__ */ __commonJS({ "../../node_modules/is-pro
32398
32334
  //#region ../../node_modules/path-to-regexp/dist/index.js
32399
32335
  var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/path-to-regexp/dist/index.js": ((exports) => {
32400
32336
  Object.defineProperty(exports, "__esModule", { value: true });
32401
- exports.PathError = exports.TokenData = void 0;
32402
32337
  exports.parse = parse$4;
32403
32338
  exports.compile = compile;
32404
32339
  exports.match = match;
@@ -32651,9 +32586,8 @@ var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/path-to-rege
32651
32586
  let pattern = `^(?:${sources.join("|")})`;
32652
32587
  if (trailing) pattern += `(?:${escape$1(delimiter)}$)?`;
32653
32588
  pattern += end ? "$" : `(?=${escape$1(delimiter)}|$)`;
32654
- const regexp = new RegExp(pattern, flags);
32655
32589
  return {
32656
- regexp,
32590
+ regexp: new RegExp(pattern, flags),
32657
32591
  keys
32658
32592
  };
32659
32593
  }
@@ -32719,8 +32653,7 @@ var require_dist = /* @__PURE__ */ __commonJS({ "../../node_modules/path-to-rege
32719
32653
  let value = "";
32720
32654
  let i$6 = 0;
32721
32655
  function name(value$1) {
32722
- const isSafe = isNameSafe(value$1) && isNextNameSafe(tokens[i$6]);
32723
- return isSafe ? value$1 : JSON.stringify(value$1);
32656
+ return isNameSafe(value$1) && isNextNameSafe(tokens[i$6]) ? value$1 : JSON.stringify(value$1);
32724
32657
  }
32725
32658
  while (i$6 < tokens.length) {
32726
32659
  const token = tokens[i$6++];
@@ -32811,8 +32744,7 @@ var require_layer = /* @__PURE__ */ __commonJS({ "../../node_modules/router/lib/
32811
32744
  if (!match$1) return false;
32812
32745
  const params = {};
32813
32746
  for (let i$6 = 1; i$6 < match$1.length; i$6++) {
32814
- const key$1 = keys[i$6 - 1];
32815
- const prop = key$1.name;
32747
+ const prop = keys[i$6 - 1].name;
32816
32748
  const val = decodeParam(match$1[i$6]);
32817
32749
  if (val !== void 0) params[prop] = val;
32818
32750
  }
@@ -33380,7 +33312,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33380
33312
  try {
33381
33313
  return parseUrl$1(req$2).pathname;
33382
33314
  } catch (err) {
33383
- return void 0;
33315
+ return;
33384
33316
  }
33385
33317
  }
33386
33318
  /**
@@ -33390,7 +33322,7 @@ var require_router = /* @__PURE__ */ __commonJS({ "../../node_modules/router/ind
33390
33322
  * @private
33391
33323
  */
33392
33324
  function getProtohost(url$2) {
33393
- if (typeof url$2 !== "string" || url$2.length === 0 || url$2[0] === "/") return void 0;
33325
+ if (typeof url$2 !== "string" || url$2.length === 0 || url$2[0] === "/") return;
33394
33326
  const searchIndex = url$2.indexOf("?");
33395
33327
  const pathLength = searchIndex !== -1 ? searchIndex : url$2.length;
33396
33328
  const fqdnIndex = url$2.substring(0, pathLength).indexOf("://");
@@ -33936,8 +33868,7 @@ var require_application = /* @__PURE__ */ __commonJS({ "../../node_modules/expre
33936
33868
  if (renderOptions.cache == null) renderOptions.cache = this.enabled("view cache");
33937
33869
  if (renderOptions.cache) view = cache[name];
33938
33870
  if (!view) {
33939
- var View$2 = this.get("view");
33940
- view = new View$2(name, {
33871
+ view = new (this.get("view"))(name, {
33941
33872
  defaultEngine: this.get("view engine"),
33942
33873
  root: this.get("views"),
33943
33874
  engines
@@ -34714,8 +34645,7 @@ var require_accepts = /* @__PURE__ */ __commonJS({ "../../node_modules/accepts/i
34714
34645
  if (!types || types.length === 0) return this.negotiator.mediaTypes();
34715
34646
  if (!this.headers.accept) return types[0];
34716
34647
  var mimes = types.map(extToMime);
34717
- var accepts$1 = this.negotiator.mediaTypes(mimes.filter(validMime));
34718
- var first$2 = accepts$1[0];
34648
+ var first$2 = this.negotiator.mediaTypes(mimes.filter(validMime))[0];
34719
34649
  return first$2 ? types[mimes.indexOf(first$2)] : false;
34720
34650
  };
34721
34651
  /**
@@ -34843,8 +34773,7 @@ var require_fresh = /* @__PURE__ */ __commonJS({ "../../node_modules/fresh/index
34843
34773
  }
34844
34774
  if (modifiedSince) {
34845
34775
  var lastModified = resHeaders["last-modified"];
34846
- var modifiedStale = !lastModified || !(parseHttpDate$1(lastModified) <= parseHttpDate$1(modifiedSince));
34847
- if (modifiedStale) return false;
34776
+ if (!lastModified || !(parseHttpDate$1(lastModified) <= parseHttpDate$1(modifiedSince))) return false;
34848
34777
  }
34849
34778
  return true;
34850
34779
  }
@@ -35219,8 +35148,7 @@ var require_request = /* @__PURE__ */ __commonJS({ "../../node_modules/express/l
35219
35148
  */
35220
35149
  defineGetter(req$1, "protocol", function protocol() {
35221
35150
  var proto$1 = this.connection.encrypted ? "https" : "http";
35222
- var trust = this.app.get("trust proxy fn");
35223
- if (!trust(this.connection.remoteAddress, 0)) return proto$1;
35151
+ if (!this.app.get("trust proxy fn")(this.connection.remoteAddress, 0)) return proto$1;
35224
35152
  var header = this.get("X-Forwarded-Proto") || proto$1;
35225
35153
  var index = header.indexOf(",");
35226
35154
  return index !== -1 ? header.substring(0, index).trim() : header.trim();
@@ -35284,8 +35212,7 @@ var require_request = /* @__PURE__ */ __commonJS({ "../../node_modules/express/l
35284
35212
  var hostname = this.hostname;
35285
35213
  if (!hostname) return [];
35286
35214
  var offset = this.app.get("subdomain offset");
35287
- var subdomains$1 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
35288
- return subdomains$1.slice(offset);
35215
+ return (!isIP(hostname) ? hostname.split(".").reverse() : [hostname]).slice(offset);
35289
35216
  });
35290
35217
  /**
35291
35218
  * Short-hand for `url.parse(req.url).pathname`.
@@ -35367,8 +35294,7 @@ var require_request = /* @__PURE__ */ __commonJS({ "../../node_modules/express/l
35367
35294
  * @public
35368
35295
  */
35369
35296
  defineGetter(req$1, "xhr", function xhr() {
35370
- var val = this.get("X-Requested-With") || "";
35371
- return val.toLowerCase() === "xmlhttprequest";
35297
+ return (this.get("X-Requested-With") || "").toLowerCase() === "xmlhttprequest";
35372
35298
  });
35373
35299
  /**
35374
35300
  * Helper function for creating a getter on an object.
@@ -35702,8 +35628,7 @@ var require_content_disposition = /* @__PURE__ */ __commonJS({ "../../node_modul
35702
35628
  * @private
35703
35629
  */
35704
35630
  function qstring(val) {
35705
- var str = String(val);
35706
- return "\"" + str.replace(QUOTE_REGEXP, "\\$1") + "\"";
35631
+ return "\"" + String(val).replace(QUOTE_REGEXP, "\\$1") + "\"";
35707
35632
  }
35708
35633
  /**
35709
35634
  * Encode a Unicode string for HTTP (RFC 5987).
@@ -35714,8 +35639,7 @@ var require_content_disposition = /* @__PURE__ */ __commonJS({ "../../node_modul
35714
35639
  */
35715
35640
  function ustring(val) {
35716
35641
  var str = String(val);
35717
- var encoded = encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
35718
- return "UTF-8''" + encoded;
35642
+ return "UTF-8''" + encodeURIComponent(str).replace(ENCODE_URL_ATTR_CHAR_REGEXP, pencode);
35719
35643
  }
35720
35644
  /**
35721
35645
  * Class for parsed Content-Disposition header for v8 optimization
@@ -35941,38 +35865,32 @@ var require_cookie = /* @__PURE__ */ __commonJS({ "../../node_modules/cookie/ind
35941
35865
  if (opt.httpOnly) str += "; HttpOnly";
35942
35866
  if (opt.secure) str += "; Secure";
35943
35867
  if (opt.partitioned) str += "; Partitioned";
35944
- if (opt.priority) {
35945
- var priority = typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority;
35946
- switch (priority) {
35947
- case "low":
35948
- str += "; Priority=Low";
35949
- break;
35950
- case "medium":
35951
- str += "; Priority=Medium";
35952
- break;
35953
- case "high":
35954
- str += "; Priority=High";
35955
- break;
35956
- default: throw new TypeError("option priority is invalid");
35957
- }
35868
+ if (opt.priority) switch (typeof opt.priority === "string" ? opt.priority.toLowerCase() : opt.priority) {
35869
+ case "low":
35870
+ str += "; Priority=Low";
35871
+ break;
35872
+ case "medium":
35873
+ str += "; Priority=Medium";
35874
+ break;
35875
+ case "high":
35876
+ str += "; Priority=High";
35877
+ break;
35878
+ default: throw new TypeError("option priority is invalid");
35958
35879
  }
35959
- if (opt.sameSite) {
35960
- var sameSite = typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite;
35961
- switch (sameSite) {
35962
- case true:
35963
- str += "; SameSite=Strict";
35964
- break;
35965
- case "lax":
35966
- str += "; SameSite=Lax";
35967
- break;
35968
- case "strict":
35969
- str += "; SameSite=Strict";
35970
- break;
35971
- case "none":
35972
- str += "; SameSite=None";
35973
- break;
35974
- default: throw new TypeError("option sameSite is invalid");
35975
- }
35880
+ if (opt.sameSite) switch (typeof opt.sameSite === "string" ? opt.sameSite.toLowerCase() : opt.sameSite) {
35881
+ case true:
35882
+ str += "; SameSite=Strict";
35883
+ break;
35884
+ case "lax":
35885
+ str += "; SameSite=Lax";
35886
+ break;
35887
+ case "strict":
35888
+ str += "; SameSite=Strict";
35889
+ break;
35890
+ case "none":
35891
+ str += "; SameSite=None";
35892
+ break;
35893
+ default: throw new TypeError("option sameSite is invalid");
35976
35894
  }
35977
35895
  return str;
35978
35896
  }
@@ -36626,8 +36544,7 @@ var require_send = /* @__PURE__ */ __commonJS({ "../../node_modules/send/index.j
36626
36544
  * @private
36627
36545
  */
36628
36546
  function hasListeners(emitter, type) {
36629
- var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
36630
- return count > 0;
36547
+ return (typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type)) > 0;
36631
36548
  }
36632
36549
  /**
36633
36550
  * Normalize the index option into an array.
@@ -37729,10 +37646,9 @@ var require_object_assign = /* @__PURE__ */ __commonJS({ "../../node_modules/obj
37729
37646
  if (Object.getOwnPropertyNames(test1)[0] === "5") return false;
37730
37647
  var test2 = {};
37731
37648
  for (var i$6 = 0; i$6 < 10; i$6++) test2["_" + String.fromCharCode(i$6)] = i$6;
37732
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
37649
+ if (Object.getOwnPropertyNames(test2).map(function(n) {
37733
37650
  return test2[n];
37734
- });
37735
- if (order2.join("") !== "0123456789") return false;
37651
+ }).join("") !== "0123456789") return false;
37736
37652
  var test3 = {};
37737
37653
  "abcdefghijklmnopqrst".split("").forEach(function(letter) {
37738
37654
  test3[letter] = letter;
@@ -37870,8 +37786,8 @@ var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/cors/lib/inde
37870
37786
  }
37871
37787
  }
37872
37788
  function cors$1(options, req$2, res$2, next) {
37873
- var headers = [], method = req$2.method && req$2.method.toUpperCase && req$2.method.toUpperCase();
37874
- if (method === "OPTIONS") {
37789
+ var headers = [];
37790
+ if ((req$2.method && req$2.method.toUpperCase && req$2.method.toUpperCase()) === "OPTIONS") {
37875
37791
  headers.push(configureOrigin(options, req$2));
37876
37792
  headers.push(configureCredentials(options, req$2));
37877
37793
  headers.push(configureMethods(options, req$2));
@@ -37963,8 +37879,7 @@ const createSession = () => {
37963
37879
  //#region src/middleware/error-handling.ts
37964
37880
  function defaultErrorHandler(error, _req, res$2, next) {
37965
37881
  if (res$2.headersSent) return next(error);
37966
- let assertCondition = "Assert condition failed: ";
37967
- if (error?.message?.startsWith(assertCondition)) {
37882
+ if (error?.message?.startsWith("Assert condition failed: ")) {
37968
37883
  let errorCode = 500;
37969
37884
  let errorResponse = error.message;
37970
37885
  if (error.message.includes("::")) {
@@ -38084,8 +37999,7 @@ const createWebMessageHandler = () => function(req$2, res$2) {
38084
37999
  //#endregion
38085
38000
  //#region src/handlers/utils.ts
38086
38001
  const createPersonQuery = (store) => (predicate) => {
38087
- const users = store.schema.users.selectTableAsList(store.store.getState());
38088
- return users.find(predicate);
38002
+ return store.schema.users.selectTableAsList(store.store.getState()).find(predicate);
38089
38003
  };
38090
38004
  const deriveScope = ({ scopeConfig, clientID, audience }) => {
38091
38005
  if (typeof scopeConfig === "string") return scopeConfig;
@@ -38279,17 +38193,15 @@ const extensionlessFileName = (fileName) => fileName.indexOf(".") === -1 ? fileN
38279
38193
  //#endregion
38280
38194
  //#region src/rules/parse-rules-files.ts
38281
38195
  function parseRulesFiles(rulesPath) {
38282
- let ruleFiles = fs.default.readdirSync(rulesPath).filter((f) => path.default.extname(f) === ".js");
38283
- return ruleFiles.map((r) => {
38196
+ return fs.default.readdirSync(rulesPath).filter((f) => path.default.extname(f) === ".js").map((r) => {
38284
38197
  let filename = path.default.join(rulesPath, r);
38285
38198
  let jsonFile = `${extensionlessFileName(filename)}.json`;
38286
38199
  (0, assert_ts.assert)(!!jsonFile, `no corresponding rule file for ${r}`);
38287
38200
  let rawRule = fs.default.readFileSync(jsonFile, "utf8");
38288
38201
  let { enabled, order = 0, stage = "login_success" } = JSON.parse(rawRule);
38289
- if (!enabled) return void 0;
38290
- let code = fs.default.readFileSync(filename, { encoding: "utf-8" });
38202
+ if (!enabled) return;
38291
38203
  return {
38292
- code,
38204
+ code: fs.default.readFileSync(filename, { encoding: "utf-8" }),
38293
38205
  filename,
38294
38206
  order,
38295
38207
  stage
@@ -38324,7 +38236,7 @@ async function runRule(user, context, rule) {
38324
38236
  (0, assert_ts.assert)(typeof rule !== "undefined", "undefined rule");
38325
38237
  let { code, filename } = rule;
38326
38238
  console.debug(`executing rule ${path.default.basename(filename)}`);
38327
- let script = new vm.default.Script(`
38239
+ new vm.default.Script(`
38328
38240
  (async function(exports) {
38329
38241
  try {
38330
38242
  await (${code})(__simulator.user, __simulator.context, resolve);
@@ -38333,8 +38245,7 @@ async function runRule(user, context, rule) {
38333
38245
  reject();
38334
38246
  }
38335
38247
  })(module.exports)
38336
- `);
38337
- script.runInContext(vmContext, {
38248
+ `).runInContext(vmContext, {
38338
38249
  filename,
38339
38250
  displayErrors: true,
38340
38251
  timeout: 2e4
@@ -38392,8 +38303,7 @@ const createTokens = async ({ body, iss, clientID, audience, rulesDirectory, sco
38392
38303
  else if (grant_type === "refresh_token") {
38393
38304
  let { refresh_token: refreshTokenValue } = body;
38394
38305
  let refreshToken = JSON.parse((0, base64_url.decode)(refreshTokenValue));
38395
- let findUser = createPersonQuery(simulationStore);
38396
- user = findUser((person) => person.id === refreshToken.user.id);
38306
+ user = createPersonQuery(simulationStore)((person) => person.id === refreshToken.user.id);
38397
38307
  nonce = refreshToken.nonce;
38398
38308
  (0, assert_ts.assert)(!!nonce, `400::No nonce in request`);
38399
38309
  } else {
@@ -38421,8 +38331,7 @@ const createTokens = async ({ body, iss, clientID, audience, rulesDirectory, sco
38421
38331
  },
38422
38332
  idToken: idTokenData
38423
38333
  };
38424
- let rulesRunner = createRulesRunner(rulesDirectory);
38425
- await rulesRunner(userData, context);
38334
+ await createRulesRunner(rulesDirectory)(userData, context);
38426
38335
  return {
38427
38336
  access_token: createJsonWebToken({
38428
38337
  ...accessToken,
@@ -38598,8 +38507,7 @@ const createAuth0Handlers = (simulationStore, serviceURL, options, debug$11) =>
38598
38507
  (0, assert_ts.assert)(!!username, "no username in /usernamepassword/login");
38599
38508
  (0, assert_ts.assert)(!!nonce, "no nonce in /usernamepassword/login");
38600
38509
  (0, assert_ts.assert)(!!req$2.session, "no session");
38601
- let user = personQuery((person) => person.email?.toLowerCase() === username.toLowerCase() && person.password === password);
38602
- if (!user) {
38510
+ if (!personQuery((person) => person.email?.toLowerCase() === username.toLowerCase() && person.password === password)) {
38603
38511
  let query = req$2.query;
38604
38512
  let responseClientId = query.client_id ?? clientID;
38605
38513
  let responseAudience = query.audience ?? audience;
@@ -38631,8 +38539,7 @@ const createAuth0Handlers = (simulationStore, serviceURL, options, debug$11) =>
38631
38539
  wctx
38632
38540
  } });
38633
38541
  let { redirect_uri, nonce } = wctx;
38634
- const session = simulationStore.schema.sessions.selectById(simulationStore.store.getState(), { id: nonce });
38635
- const { username } = session ?? {};
38542
+ const { username } = simulationStore.schema.sessions.selectById(simulationStore.store.getState(), { id: nonce }) ?? {};
38636
38543
  let encodedNonce = (0, base64_url.encode)(`${nonce}:${username}`);
38637
38544
  let qs$2 = (0, querystring.stringify)({
38638
38545
  code: encodedNonce,
@@ -38677,10 +38584,8 @@ const createAuth0Handlers = (simulationStore, serviceURL, options, debug$11) =>
38677
38584
  },
38678
38585
  ["/userinfo"]: function(req$2, res$2) {
38679
38586
  let token = null;
38680
- if (req$2.headers.authorization) {
38681
- let authorizationHeader = req$2.headers.authorization;
38682
- token = authorizationHeader?.split(" ")?.[1];
38683
- } else token = req$2?.query?.access_token;
38587
+ if (req$2.headers.authorization) token = req$2.headers.authorization?.split(" ")?.[1];
38588
+ else token = req$2?.query?.access_token;
38684
38589
  (0, assert_ts.assert)(!!token, "no authorization header or access_token");
38685
38590
  let { sub } = (0, jsonwebtoken.decode)(token, { json: true });
38686
38591
  let user = personQuery((person) => {