strapi-plugin-firebase-authentication 1.2.1 → 1.2.4

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.
@@ -13,7 +13,7 @@ import require$$0$8 from "constants";
13
13
  import "node:stream";
14
14
  import admin$1 from "firebase-admin";
15
15
  import CryptoJS from "crypto-js";
16
- import * as fs$6 from "fs/promises";
16
+ import * as fs$8 from "fs/promises";
17
17
  async function migrateFirebaseUserData(strapi2, dryRun = false) {
18
18
  strapi2.log.info("=== Firebase User Data Migration ===");
19
19
  strapi2.log.info(`Mode: ${dryRun ? "DRY RUN (no changes)" : "LIVE (will modify database)"}`);
@@ -982,9 +982,9 @@ lodash.exports;
982
982
  function hasUnicodeWord2(string2) {
983
983
  return reHasUnicodeWord2.test(string2);
984
984
  }
985
- function iteratorToArray(iterator) {
985
+ function iteratorToArray(iterator2) {
986
986
  var data, result = [];
987
- while (!(data = iterator.next()).done) {
987
+ while (!(data = iterator2.next()).done) {
988
988
  result.push(data.value);
989
989
  }
990
990
  return result;
@@ -9567,7 +9567,7 @@ var _mapping = {};
9567
9567
  })(_mapping);
9568
9568
  var placeholder = {};
9569
9569
  var mapping = _mapping, fallbackHolder = placeholder;
9570
- var push = Array.prototype.push;
9570
+ var push$1 = Array.prototype.push;
9571
9571
  function baseArity(func, n) {
9572
9572
  return n == 2 ? function(a, b) {
9573
9573
  return func.apply(void 0, arguments);
@@ -9602,10 +9602,10 @@ function flatSpread(func, start) {
9602
9602
  }
9603
9603
  var array2 = args[start], otherArgs = args.slice(0, start);
9604
9604
  if (array2) {
9605
- push.apply(otherArgs, array2);
9605
+ push$1.apply(otherArgs, array2);
9606
9606
  }
9607
9607
  if (start != lastIndex) {
9608
- push.apply(otherArgs, args.slice(start + 1));
9608
+ push$1.apply(otherArgs, args.slice(start + 1));
9609
9609
  }
9610
9610
  return func.apply(this, otherArgs);
9611
9611
  };
@@ -12213,11 +12213,11 @@ function baseGet$2(object2, path2) {
12213
12213
  }
12214
12214
  var _baseGet = baseGet$2;
12215
12215
  var baseGet$1 = _baseGet;
12216
- function get$1(object2, path2, defaultValue) {
12216
+ function get$2(object2, path2, defaultValue) {
12217
12217
  var result = object2 == null ? void 0 : baseGet$1(object2, path2);
12218
12218
  return result === void 0 ? defaultValue : result;
12219
12219
  }
12220
- var get_1 = get$1;
12220
+ var get_1 = get$2;
12221
12221
  function baseHasIn$1(object2, key) {
12222
12222
  return object2 != null && key in Object(object2);
12223
12223
  }
@@ -12227,14 +12227,14 @@ function hasIn$1(object2, path2) {
12227
12227
  return object2 != null && hasPath(object2, path2, baseHasIn);
12228
12228
  }
12229
12229
  var hasIn_1 = hasIn$1;
12230
- var baseIsEqual = _baseIsEqual, get = get_1, hasIn = hasIn_1, isKey$1 = _isKey, isStrictComparable = _isStrictComparable, matchesStrictComparable = _matchesStrictComparable, toKey$1 = _toKey;
12230
+ var baseIsEqual = _baseIsEqual, get$1 = get_1, hasIn = hasIn_1, isKey$1 = _isKey, isStrictComparable = _isStrictComparable, matchesStrictComparable = _matchesStrictComparable, toKey$1 = _toKey;
12231
12231
  var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
12232
12232
  function baseMatchesProperty$1(path2, srcValue) {
12233
12233
  if (isKey$1(path2) && isStrictComparable(srcValue)) {
12234
12234
  return matchesStrictComparable(toKey$1(path2), srcValue);
12235
12235
  }
12236
12236
  return function(object2) {
12237
- var objValue = get(object2, path2);
12237
+ var objValue = get$1(object2, path2);
12238
12238
  return objValue === void 0 && objValue === srcValue ? hasIn(object2, path2) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
12239
12239
  };
12240
12240
  }
@@ -12530,7 +12530,7 @@ function createValidation(config2) {
12530
12530
  validate2.OPTIONS = config2;
12531
12531
  return validate2;
12532
12532
  }
12533
- let trim = (part) => part.substr(0, part.length - 1).substr(1);
12533
+ let trim$1 = (part) => part.substr(0, part.length - 1).substr(1);
12534
12534
  function getIn(schema2, path2, value, context = value) {
12535
12535
  let parent, lastPart, lastPartDebug;
12536
12536
  if (!path2) return {
@@ -12539,7 +12539,7 @@ function getIn(schema2, path2, value, context = value) {
12539
12539
  schema: schema2
12540
12540
  };
12541
12541
  propertyExpr.forEach(path2, (_part, isBracket, isArray2) => {
12542
- let part = isBracket ? trim(_part) : _part;
12542
+ let part = isBracket ? trim$1(_part) : _part;
12543
12543
  schema2 = schema2.resolve({
12544
12544
  context,
12545
12545
  parent,
@@ -14926,7 +14926,7 @@ var pMap = async (iterable, mapper, {
14926
14926
  }
14927
14927
  const result = [];
14928
14928
  const errors2 = [];
14929
- const iterator = iterable[Symbol.iterator]();
14929
+ const iterator2 = iterable[Symbol.iterator]();
14930
14930
  let isRejected = false;
14931
14931
  let isIterableDone = false;
14932
14932
  let resolvingCount = 0;
@@ -14935,7 +14935,7 @@ var pMap = async (iterable, mapper, {
14935
14935
  if (isRejected) {
14936
14936
  return;
14937
14937
  }
14938
- const nextItem = iterator.next();
14938
+ const nextItem = iterator2.next();
14939
14939
  const index2 = currentIndex;
14940
14940
  currentIndex++;
14941
14941
  if (nextItem.done) {
@@ -16145,16 +16145,16 @@ var shebangCommand$1 = (string2 = "") => {
16145
16145
  }
16146
16146
  return argument ? `${binary2} ${argument}` : binary2;
16147
16147
  };
16148
- const fs$5 = require$$0$4;
16148
+ const fs$7 = require$$0$4;
16149
16149
  const shebangCommand = shebangCommand$1;
16150
16150
  function readShebang$1(command2) {
16151
16151
  const size = 150;
16152
16152
  const buffer = Buffer.alloc(size);
16153
16153
  let fd;
16154
16154
  try {
16155
- fd = fs$5.openSync(command2, "r");
16156
- fs$5.readSync(fd, buffer, 0, size, 0);
16157
- fs$5.closeSync(fd);
16155
+ fd = fs$7.openSync(command2, "r");
16156
+ fs$7.readSync(fd, buffer, 0, size, 0);
16157
+ fs$7.closeSync(fd);
16158
16158
  } catch (e) {
16159
16159
  }
16160
16160
  return shebangCommand(buffer.toString());
@@ -17165,9 +17165,9 @@ var bufferStream$1 = (options2) => {
17165
17165
  };
17166
17166
  const { constants: BufferConstants } = require$$0$7;
17167
17167
  const stream$1 = require$$0$6;
17168
- const { promisify: promisify$3 } = require$$2$1;
17168
+ const { promisify: promisify$5 } = require$$2$1;
17169
17169
  const bufferStream = bufferStream$1;
17170
- const streamPipelinePromisified = promisify$3(stream$1.pipeline);
17170
+ const streamPipelinePromisified = promisify$5(stream$1.pipeline);
17171
17171
  class MaxBufferError extends Error {
17172
17172
  constructor() {
17173
17173
  super("maxBuffer exceeded");
@@ -17703,11 +17703,11 @@ pLocate$4.exports = pLocate$3;
17703
17703
  pLocate$4.exports.default = pLocate$3;
17704
17704
  var pLocateExports = pLocate$4.exports;
17705
17705
  const path$4 = require$$0__default;
17706
- const fs$4 = require$$0$4;
17707
- const { promisify: promisify$2 } = require$$2$1;
17706
+ const fs$6 = require$$0$4;
17707
+ const { promisify: promisify$4 } = require$$2$1;
17708
17708
  const pLocate$2 = pLocateExports;
17709
- const fsStat$1 = promisify$2(fs$4.stat);
17710
- const fsLStat$1 = promisify$2(fs$4.lstat);
17709
+ const fsStat$1 = promisify$4(fs$6.stat);
17710
+ const fsLStat$1 = promisify$4(fs$6.lstat);
17711
17711
  const typeMappings$1 = {
17712
17712
  directory: "isDirectory",
17713
17713
  file: "isFile"
@@ -17745,7 +17745,7 @@ locatePath$1.exports.sync = (paths, options2) => {
17745
17745
  ...options2
17746
17746
  };
17747
17747
  checkType$1(options2);
17748
- const statFn = options2.allowSymlinks ? fs$4.statSync : fs$4.lstatSync;
17748
+ const statFn = options2.allowSymlinks ? fs$6.statSync : fs$6.lstatSync;
17749
17749
  for (const path_ of paths) {
17750
17750
  try {
17751
17751
  const stat = statFn(path$4.resolve(options2.cwd, path_));
@@ -17757,31 +17757,31 @@ locatePath$1.exports.sync = (paths, options2) => {
17757
17757
  }
17758
17758
  };
17759
17759
  var locatePathExports$1 = locatePath$1.exports;
17760
- var pathExists = { exports: {} };
17761
- const fs$3 = require$$0$4;
17762
- const { promisify: promisify$1 } = require$$2$1;
17763
- const pAccess = promisify$1(fs$3.access);
17764
- pathExists.exports = async (path2) => {
17760
+ var pathExists$2 = { exports: {} };
17761
+ const fs$5 = require$$0$4;
17762
+ const { promisify: promisify$3 } = require$$2$1;
17763
+ const pAccess$2 = promisify$3(fs$5.access);
17764
+ pathExists$2.exports = async (path2) => {
17765
17765
  try {
17766
- await pAccess(path2);
17766
+ await pAccess$2(path2);
17767
17767
  return true;
17768
17768
  } catch (_2) {
17769
17769
  return false;
17770
17770
  }
17771
17771
  };
17772
- pathExists.exports.sync = (path2) => {
17772
+ pathExists$2.exports.sync = (path2) => {
17773
17773
  try {
17774
- fs$3.accessSync(path2);
17774
+ fs$5.accessSync(path2);
17775
17775
  return true;
17776
17776
  } catch (_2) {
17777
17777
  return false;
17778
17778
  }
17779
17779
  };
17780
- var pathExistsExports = pathExists.exports;
17780
+ var pathExistsExports$1 = pathExists$2.exports;
17781
17781
  (function(module) {
17782
17782
  const path2 = require$$0__default;
17783
17783
  const locatePath2 = locatePathExports$1;
17784
- const pathExists2 = pathExistsExports;
17784
+ const pathExists2 = pathExistsExports$1;
17785
17785
  const stop = Symbol("findUp.stop");
17786
17786
  module.exports = async (name, options2 = {}) => {
17787
17787
  let directory = path2.resolve(options2.cwd || "");
@@ -20535,14 +20535,14 @@ const core_1 = core$1;
20535
20535
  core_1.findWorkspaceRoot;
20536
20536
  var findUp = { exports: {} };
20537
20537
  var locatePath = { exports: {} };
20538
- class Node {
20538
+ let Node$1 = class Node {
20539
20539
  /// value;
20540
20540
  /// next;
20541
20541
  constructor(value) {
20542
20542
  this.value = value;
20543
20543
  this.next = void 0;
20544
20544
  }
20545
- }
20545
+ };
20546
20546
  let Queue$1 = class Queue {
20547
20547
  // TODO: Use private class fields when targeting Node.js 12.
20548
20548
  // #_head;
@@ -20552,7 +20552,7 @@ let Queue$1 = class Queue {
20552
20552
  this.clear();
20553
20553
  }
20554
20554
  enqueue(value) {
20555
- const node = new Node(value);
20555
+ const node = new Node$1(value);
20556
20556
  if (this._head) {
20557
20557
  this._tail.next = node;
20558
20558
  this._tail = node;
@@ -20674,11 +20674,11 @@ const pLocate$1 = async (iterable, tester, options2) => {
20674
20674
  };
20675
20675
  var pLocate_1 = pLocate$1;
20676
20676
  const path = require$$0__default;
20677
- const fs$2 = require$$0$4;
20678
- const { promisify } = require$$2$1;
20677
+ const fs$4 = require$$0$4;
20678
+ const { promisify: promisify$2 } = require$$2$1;
20679
20679
  const pLocate = pLocate_1;
20680
- const fsStat = promisify(fs$2.stat);
20681
- const fsLStat = promisify(fs$2.lstat);
20680
+ const fsStat = promisify$2(fs$4.stat);
20681
+ const fsLStat = promisify$2(fs$4.lstat);
20682
20682
  const typeMappings = {
20683
20683
  directory: "isDirectory",
20684
20684
  file: "isFile"
@@ -20716,7 +20716,7 @@ locatePath.exports.sync = (paths, options2) => {
20716
20716
  ...options2
20717
20717
  };
20718
20718
  checkType(options2);
20719
- const statFn = options2.allowSymlinks ? fs$2.statSync : fs$2.lstatSync;
20719
+ const statFn = options2.allowSymlinks ? fs$4.statSync : fs$4.lstatSync;
20720
20720
  for (const path_ of paths) {
20721
20721
  try {
20722
20722
  const stat = statFn(path.resolve(options2.cwd, path_));
@@ -20728,6 +20728,27 @@ locatePath.exports.sync = (paths, options2) => {
20728
20728
  }
20729
20729
  };
20730
20730
  var locatePathExports = locatePath.exports;
20731
+ var pathExists$1 = { exports: {} };
20732
+ const fs$3 = require$$0$4;
20733
+ const { promisify: promisify$1 } = require$$2$1;
20734
+ const pAccess$1 = promisify$1(fs$3.access);
20735
+ pathExists$1.exports = async (path2) => {
20736
+ try {
20737
+ await pAccess$1(path2);
20738
+ return true;
20739
+ } catch (_2) {
20740
+ return false;
20741
+ }
20742
+ };
20743
+ pathExists$1.exports.sync = (path2) => {
20744
+ try {
20745
+ fs$3.accessSync(path2);
20746
+ return true;
20747
+ } catch (_2) {
20748
+ return false;
20749
+ }
20750
+ };
20751
+ var pathExistsExports = pathExists$1.exports;
20731
20752
  (function(module) {
20732
20753
  const path2 = require$$0__default;
20733
20754
  const locatePath2 = locatePathExports;
@@ -20793,6 +20814,26 @@ var locatePathExports = locatePath.exports;
20793
20814
  module.exports.sync.exists = pathExists2.sync;
20794
20815
  module.exports.stop = stop;
20795
20816
  })(findUp);
20817
+ var pathExists = { exports: {} };
20818
+ const fs$2 = require$$0$4;
20819
+ const { promisify } = require$$2$1;
20820
+ const pAccess = promisify(fs$2.access);
20821
+ pathExists.exports = async (path2) => {
20822
+ try {
20823
+ await pAccess(path2);
20824
+ return true;
20825
+ } catch (_2) {
20826
+ return false;
20827
+ }
20828
+ };
20829
+ pathExists.exports.sync = (path2) => {
20830
+ try {
20831
+ fs$2.accessSync(path2);
20832
+ return true;
20833
+ } catch (_2) {
20834
+ return false;
20835
+ }
20836
+ };
20796
20837
  var loadYamlFile = { exports: {} };
20797
20838
  var constants$2 = require$$0$8;
20798
20839
  var origCwd = process.cwd;
@@ -23620,17 +23661,17 @@ function loadDocuments(input, options2) {
23620
23661
  }
23621
23662
  return state.documents;
23622
23663
  }
23623
- function loadAll(input, iterator, options2) {
23624
- if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") {
23625
- options2 = iterator;
23626
- iterator = null;
23664
+ function loadAll(input, iterator2, options2) {
23665
+ if (iterator2 !== null && typeof iterator2 === "object" && typeof options2 === "undefined") {
23666
+ options2 = iterator2;
23667
+ iterator2 = null;
23627
23668
  }
23628
23669
  var documents = loadDocuments(input, options2);
23629
- if (typeof iterator !== "function") {
23670
+ if (typeof iterator2 !== "function") {
23630
23671
  return documents;
23631
23672
  }
23632
23673
  for (var index2 = 0, length = documents.length; index2 < length; index2 += 1) {
23633
- iterator(documents[index2]);
23674
+ iterator2(documents[index2]);
23634
23675
  }
23635
23676
  }
23636
23677
  function load(input, options2) {
@@ -23642,12 +23683,12 @@ function load(input, options2) {
23642
23683
  }
23643
23684
  throw new YAMLException$1("expected a single document in the stream, but found more");
23644
23685
  }
23645
- function safeLoadAll(input, iterator, options2) {
23646
- if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") {
23647
- options2 = iterator;
23648
- iterator = null;
23686
+ function safeLoadAll(input, iterator2, options2) {
23687
+ if (typeof iterator2 === "object" && iterator2 !== null && typeof options2 === "undefined") {
23688
+ options2 = iterator2;
23689
+ iterator2 = null;
23649
23690
  }
23650
- return loadAll(input, iterator, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options2));
23691
+ return loadAll(input, iterator2, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options2));
23651
23692
  }
23652
23693
  function safeLoad(input, options2) {
23653
23694
  return load(input, common$1.extend({ schema: DEFAULT_SAFE_SCHEMA$1 }, options2));
@@ -28910,12 +28951,15 @@ const firebaseController = {
28910
28951
  try {
28911
28952
  const { token } = ctx.request.body || {};
28912
28953
  if (!token) {
28913
- throw new ValidationError$1("Token is required");
28954
+ return ctx.badRequest("Token is required");
28914
28955
  }
28915
28956
  const result = await strapi.plugin(pluginName).service("firebaseService").verifyEmail(token);
28916
28957
  ctx.body = result;
28917
28958
  } catch (error2) {
28918
28959
  strapi.log.error("verifyEmail controller error:", error2);
28960
+ if (error2.name === "ValidationError") {
28961
+ return ctx.badRequest(error2.message);
28962
+ }
28919
28963
  throw error2;
28920
28964
  }
28921
28965
  }
@@ -31111,6 +31155,22 @@ const firebaseService = ({ strapi: strapi2 }) => ({
31111
31155
  const tokenService2 = strapi2.plugin("firebase-authentication").service("tokenService");
31112
31156
  const validationResult = await tokenService2.validateVerificationToken(token);
31113
31157
  if (!validationResult.valid) {
31158
+ if (validationResult.code === "TOKEN_ALREADY_USED" && validationResult.firebaseUID) {
31159
+ try {
31160
+ const firebaseUser = await strapi2.firebase.auth().getUser(validationResult.firebaseUID);
31161
+ if (firebaseUser.emailVerified) {
31162
+ strapi2.log.info(
31163
+ `[verifyEmail] Token already used but email is verified for: ${firebaseUser.email}`
31164
+ );
31165
+ return {
31166
+ success: true,
31167
+ message: "This email has already been verified."
31168
+ };
31169
+ }
31170
+ } catch (checkError) {
31171
+ strapi2.log.warn(`[verifyEmail] Could not verify Firebase user status: ${checkError.message}`);
31172
+ }
31173
+ }
31114
31174
  strapi2.log.warn(`[verifyEmail] Token validation failed: ${validationResult.error}`);
31115
31175
  throw new ValidationError$1(validationResult.error || "Invalid verification link");
31116
31176
  }
@@ -31709,7 +31769,7 @@ class TemplateService {
31709
31769
  if (userTemplate.htmlFile) {
31710
31770
  try {
31711
31771
  const htmlPath = require$$0$1.resolve(userTemplate.htmlFile);
31712
- mergedTemplate.html = await fs$6.readFile(htmlPath, "utf-8");
31772
+ mergedTemplate.html = await fs$8.readFile(htmlPath, "utf-8");
31713
31773
  } catch (error2) {
31714
31774
  strapi.log.warn(
31715
31775
  `Failed to load HTML template from ${userTemplate.htmlFile}: ${error2.message}. Using default template.`
@@ -31721,7 +31781,7 @@ class TemplateService {
31721
31781
  if (userTemplate.textFile) {
31722
31782
  try {
31723
31783
  const textPath = require$$0$1.resolve(userTemplate.textFile);
31724
- mergedTemplate.text = await fs$6.readFile(textPath, "utf-8");
31784
+ mergedTemplate.text = await fs$8.readFile(textPath, "utf-8");
31725
31785
  } catch (error2) {
31726
31786
  strapi.log.warn(
31727
31787
  `Failed to load text template from ${userTemplate.textFile}: ${error2.message}. Using default template.`
@@ -33467,7 +33527,6 @@ var debug_1 = debug$1;
33467
33527
  const re2 = exports$1.re = [];
33468
33528
  const safeRe = exports$1.safeRe = [];
33469
33529
  const src = exports$1.src = [];
33470
- const safeSrc = exports$1.safeSrc = [];
33471
33530
  const t2 = exports$1.t = {};
33472
33531
  let R = 0;
33473
33532
  const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
@@ -33488,7 +33547,6 @@ var debug_1 = debug$1;
33488
33547
  debug2(name, index2, value);
33489
33548
  t2[name] = index2;
33490
33549
  src[index2] = value;
33491
- safeSrc[index2] = safe;
33492
33550
  re2[index2] = new RegExp(value, isGlobal ? "g" : void 0);
33493
33551
  safeRe[index2] = new RegExp(safe, isGlobal ? "g" : void 0);
33494
33552
  };
@@ -33497,8 +33555,8 @@ var debug_1 = debug$1;
33497
33555
  createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
33498
33556
  createToken("MAINVERSION", `(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})\\.(${src[t2.NUMERICIDENTIFIER]})`);
33499
33557
  createToken("MAINVERSIONLOOSE", `(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})\\.(${src[t2.NUMERICIDENTIFIERLOOSE]})`);
33500
- createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NONNUMERICIDENTIFIER]}|${src[t2.NUMERICIDENTIFIER]})`);
33501
- createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NONNUMERICIDENTIFIER]}|${src[t2.NUMERICIDENTIFIERLOOSE]})`);
33558
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t2.NUMERICIDENTIFIER]}|${src[t2.NONNUMERICIDENTIFIER]})`);
33559
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t2.NUMERICIDENTIFIERLOOSE]}|${src[t2.NONNUMERICIDENTIFIER]})`);
33502
33560
  createToken("PRERELEASE", `(?:-(${src[t2.PRERELEASEIDENTIFIER]}(?:\\.${src[t2.PRERELEASEIDENTIFIER]})*))`);
33503
33561
  createToken("PRERELEASELOOSE", `(?:-?(${src[t2.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t2.PRERELEASEIDENTIFIERLOOSE]})*))`);
33504
33562
  createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
@@ -33514,11 +33572,8 @@ var debug_1 = debug$1;
33514
33572
  createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t2.XRANGEIDENTIFIERLOOSE]})(?:${src[t2.PRERELEASELOOSE]})?${src[t2.BUILD]}?)?)?`);
33515
33573
  createToken("XRANGE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAIN]}$`);
33516
33574
  createToken("XRANGELOOSE", `^${src[t2.GTLT]}\\s*${src[t2.XRANGEPLAINLOOSE]}$`);
33517
- createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?`);
33518
- createToken("COERCE", `${src[t2.COERCEPLAIN]}(?:$|[^\\d])`);
33519
- createToken("COERCEFULL", src[t2.COERCEPLAIN] + `(?:${src[t2.PRERELEASE]})?(?:${src[t2.BUILD]})?(?:$|[^\\d])`);
33575
+ createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:$|[^\\d])`);
33520
33576
  createToken("COERCERTL", src[t2.COERCE], true);
33521
- createToken("COERCERTLFULL", src[t2.COERCEFULL], true);
33522
33577
  createToken("LONETILDE", "(?:~>?)");
33523
33578
  createToken("TILDETRIM", `(\\s*)${src[t2.LONETILDE]}\\s+`, true);
33524
33579
  exports$1.tildeTrimReplace = "$1~";
@@ -33554,9 +33609,6 @@ const parseOptions$1 = (options2) => {
33554
33609
  var parseOptions_1 = parseOptions$1;
33555
33610
  const numeric = /^[0-9]+$/;
33556
33611
  const compareIdentifiers$1 = (a, b) => {
33557
- if (typeof a === "number" && typeof b === "number") {
33558
- return a === b ? 0 : a < b ? -1 : 1;
33559
- }
33560
33612
  const anum = numeric.test(a);
33561
33613
  const bnum = numeric.test(b);
33562
33614
  if (anum && bnum) {
@@ -33656,25 +33708,7 @@ let SemVer$d = class SemVer {
33656
33708
  if (!(other instanceof SemVer)) {
33657
33709
  other = new SemVer(other, this.options);
33658
33710
  }
33659
- if (this.major < other.major) {
33660
- return -1;
33661
- }
33662
- if (this.major > other.major) {
33663
- return 1;
33664
- }
33665
- if (this.minor < other.minor) {
33666
- return -1;
33667
- }
33668
- if (this.minor > other.minor) {
33669
- return 1;
33670
- }
33671
- if (this.patch < other.patch) {
33672
- return -1;
33673
- }
33674
- if (this.patch > other.patch) {
33675
- return 1;
33676
- }
33677
- return 0;
33711
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
33678
33712
  }
33679
33713
  comparePre(other) {
33680
33714
  if (!(other instanceof SemVer)) {
@@ -33713,7 +33747,7 @@ let SemVer$d = class SemVer {
33713
33747
  do {
33714
33748
  const a = this.build[i];
33715
33749
  const b = other.build[i];
33716
- debug("build compare", i, a, b);
33750
+ debug("prerelease compare", i, a, b);
33717
33751
  if (a === void 0 && b === void 0) {
33718
33752
  return 0;
33719
33753
  } else if (b === void 0) {
@@ -33730,17 +33764,6 @@ let SemVer$d = class SemVer {
33730
33764
  // preminor will bump the version up to the next minor release, and immediately
33731
33765
  // down to pre-release. premajor and prepatch work the same way.
33732
33766
  inc(release, identifier, identifierBase) {
33733
- if (release.startsWith("pre")) {
33734
- if (!identifier && identifierBase === false) {
33735
- throw new Error("invalid increment argument: identifier is empty");
33736
- }
33737
- if (identifier) {
33738
- const match = `-${identifier}`.match(this.options.loose ? re$1[t$1.PRERELEASELOOSE] : re$1[t$1.PRERELEASE]);
33739
- if (!match || match[1] !== identifier) {
33740
- throw new Error(`invalid identifier: ${identifier}`);
33741
- }
33742
- }
33743
- }
33744
33767
  switch (release) {
33745
33768
  case "premajor":
33746
33769
  this.prerelease.length = 0;
@@ -33766,12 +33789,6 @@ let SemVer$d = class SemVer {
33766
33789
  }
33767
33790
  this.inc("pre", identifier, identifierBase);
33768
33791
  break;
33769
- case "release":
33770
- if (this.prerelease.length === 0) {
33771
- throw new Error(`version ${this.raw} is not a prerelease`);
33772
- }
33773
- this.prerelease.length = 0;
33774
- break;
33775
33792
  case "major":
33776
33793
  if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
33777
33794
  this.major++;
@@ -33795,6 +33812,9 @@ let SemVer$d = class SemVer {
33795
33812
  break;
33796
33813
  case "pre": {
33797
33814
  const base = Number(identifierBase) ? 1 : 0;
33815
+ if (!identifier && identifierBase === false) {
33816
+ throw new Error("invalid increment argument: identifier is empty");
33817
+ }
33798
33818
  if (this.prerelease.length === 0) {
33799
33819
  this.prerelease = [base];
33800
33820
  } else {
@@ -33899,12 +33919,13 @@ const diff$1 = (version1, version2) => {
33899
33919
  if (!lowVersion.patch && !lowVersion.minor) {
33900
33920
  return "major";
33901
33921
  }
33902
- if (lowVersion.compareMain(highVersion) === 0) {
33903
- if (lowVersion.minor && !lowVersion.patch) {
33904
- return "minor";
33905
- }
33922
+ if (highVersion.patch) {
33906
33923
  return "patch";
33907
33924
  }
33925
+ if (highVersion.minor) {
33926
+ return "minor";
33927
+ }
33928
+ return "major";
33908
33929
  }
33909
33930
  const prefix = highHasPre ? "pre" : "";
33910
33931
  if (v1.major !== v2.major) {
@@ -34033,66 +34054,666 @@ const coerce$1 = (version2, options2) => {
34033
34054
  options2 = options2 || {};
34034
34055
  let match = null;
34035
34056
  if (!options2.rtl) {
34036
- match = version2.match(options2.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
34057
+ match = version2.match(re[t.COERCE]);
34037
34058
  } else {
34038
- const coerceRtlRegex = options2.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
34039
34059
  let next;
34040
- while ((next = coerceRtlRegex.exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
34060
+ while ((next = re[t.COERCERTL].exec(version2)) && (!match || match.index + match[0].length !== version2.length)) {
34041
34061
  if (!match || next.index + next[0].length !== match.index + match[0].length) {
34042
34062
  match = next;
34043
34063
  }
34044
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
34064
+ re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
34045
34065
  }
34046
- coerceRtlRegex.lastIndex = -1;
34066
+ re[t.COERCERTL].lastIndex = -1;
34047
34067
  }
34048
34068
  if (match === null) {
34049
34069
  return null;
34050
34070
  }
34051
- const major2 = match[2];
34052
- const minor2 = match[3] || "0";
34053
- const patch2 = match[4] || "0";
34054
- const prerelease2 = options2.includePrerelease && match[5] ? `-${match[5]}` : "";
34055
- const build = options2.includePrerelease && match[6] ? `+${match[6]}` : "";
34056
- return parse$1(`${major2}.${minor2}.${patch2}${prerelease2}${build}`, options2);
34071
+ return parse$1(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options2);
34057
34072
  };
34058
34073
  var coerce_1 = coerce$1;
34074
+ var iterator;
34075
+ var hasRequiredIterator;
34076
+ function requireIterator() {
34077
+ if (hasRequiredIterator) return iterator;
34078
+ hasRequiredIterator = 1;
34079
+ iterator = function(Yallist2) {
34080
+ Yallist2.prototype[Symbol.iterator] = function* () {
34081
+ for (let walker = this.head; walker; walker = walker.next) {
34082
+ yield walker.value;
34083
+ }
34084
+ };
34085
+ };
34086
+ return iterator;
34087
+ }
34088
+ var yallist = Yallist$1;
34089
+ Yallist$1.Node = Node2;
34090
+ Yallist$1.create = Yallist$1;
34091
+ function Yallist$1(list) {
34092
+ var self2 = this;
34093
+ if (!(self2 instanceof Yallist$1)) {
34094
+ self2 = new Yallist$1();
34095
+ }
34096
+ self2.tail = null;
34097
+ self2.head = null;
34098
+ self2.length = 0;
34099
+ if (list && typeof list.forEach === "function") {
34100
+ list.forEach(function(item) {
34101
+ self2.push(item);
34102
+ });
34103
+ } else if (arguments.length > 0) {
34104
+ for (var i = 0, l = arguments.length; i < l; i++) {
34105
+ self2.push(arguments[i]);
34106
+ }
34107
+ }
34108
+ return self2;
34109
+ }
34110
+ Yallist$1.prototype.removeNode = function(node) {
34111
+ if (node.list !== this) {
34112
+ throw new Error("removing node which does not belong to this list");
34113
+ }
34114
+ var next = node.next;
34115
+ var prev = node.prev;
34116
+ if (next) {
34117
+ next.prev = prev;
34118
+ }
34119
+ if (prev) {
34120
+ prev.next = next;
34121
+ }
34122
+ if (node === this.head) {
34123
+ this.head = next;
34124
+ }
34125
+ if (node === this.tail) {
34126
+ this.tail = prev;
34127
+ }
34128
+ node.list.length--;
34129
+ node.next = null;
34130
+ node.prev = null;
34131
+ node.list = null;
34132
+ return next;
34133
+ };
34134
+ Yallist$1.prototype.unshiftNode = function(node) {
34135
+ if (node === this.head) {
34136
+ return;
34137
+ }
34138
+ if (node.list) {
34139
+ node.list.removeNode(node);
34140
+ }
34141
+ var head = this.head;
34142
+ node.list = this;
34143
+ node.next = head;
34144
+ if (head) {
34145
+ head.prev = node;
34146
+ }
34147
+ this.head = node;
34148
+ if (!this.tail) {
34149
+ this.tail = node;
34150
+ }
34151
+ this.length++;
34152
+ };
34153
+ Yallist$1.prototype.pushNode = function(node) {
34154
+ if (node === this.tail) {
34155
+ return;
34156
+ }
34157
+ if (node.list) {
34158
+ node.list.removeNode(node);
34159
+ }
34160
+ var tail = this.tail;
34161
+ node.list = this;
34162
+ node.prev = tail;
34163
+ if (tail) {
34164
+ tail.next = node;
34165
+ }
34166
+ this.tail = node;
34167
+ if (!this.head) {
34168
+ this.head = node;
34169
+ }
34170
+ this.length++;
34171
+ };
34172
+ Yallist$1.prototype.push = function() {
34173
+ for (var i = 0, l = arguments.length; i < l; i++) {
34174
+ push(this, arguments[i]);
34175
+ }
34176
+ return this.length;
34177
+ };
34178
+ Yallist$1.prototype.unshift = function() {
34179
+ for (var i = 0, l = arguments.length; i < l; i++) {
34180
+ unshift(this, arguments[i]);
34181
+ }
34182
+ return this.length;
34183
+ };
34184
+ Yallist$1.prototype.pop = function() {
34185
+ if (!this.tail) {
34186
+ return void 0;
34187
+ }
34188
+ var res = this.tail.value;
34189
+ this.tail = this.tail.prev;
34190
+ if (this.tail) {
34191
+ this.tail.next = null;
34192
+ } else {
34193
+ this.head = null;
34194
+ }
34195
+ this.length--;
34196
+ return res;
34197
+ };
34198
+ Yallist$1.prototype.shift = function() {
34199
+ if (!this.head) {
34200
+ return void 0;
34201
+ }
34202
+ var res = this.head.value;
34203
+ this.head = this.head.next;
34204
+ if (this.head) {
34205
+ this.head.prev = null;
34206
+ } else {
34207
+ this.tail = null;
34208
+ }
34209
+ this.length--;
34210
+ return res;
34211
+ };
34212
+ Yallist$1.prototype.forEach = function(fn, thisp) {
34213
+ thisp = thisp || this;
34214
+ for (var walker = this.head, i = 0; walker !== null; i++) {
34215
+ fn.call(thisp, walker.value, i, this);
34216
+ walker = walker.next;
34217
+ }
34218
+ };
34219
+ Yallist$1.prototype.forEachReverse = function(fn, thisp) {
34220
+ thisp = thisp || this;
34221
+ for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
34222
+ fn.call(thisp, walker.value, i, this);
34223
+ walker = walker.prev;
34224
+ }
34225
+ };
34226
+ Yallist$1.prototype.get = function(n) {
34227
+ for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
34228
+ walker = walker.next;
34229
+ }
34230
+ if (i === n && walker !== null) {
34231
+ return walker.value;
34232
+ }
34233
+ };
34234
+ Yallist$1.prototype.getReverse = function(n) {
34235
+ for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
34236
+ walker = walker.prev;
34237
+ }
34238
+ if (i === n && walker !== null) {
34239
+ return walker.value;
34240
+ }
34241
+ };
34242
+ Yallist$1.prototype.map = function(fn, thisp) {
34243
+ thisp = thisp || this;
34244
+ var res = new Yallist$1();
34245
+ for (var walker = this.head; walker !== null; ) {
34246
+ res.push(fn.call(thisp, walker.value, this));
34247
+ walker = walker.next;
34248
+ }
34249
+ return res;
34250
+ };
34251
+ Yallist$1.prototype.mapReverse = function(fn, thisp) {
34252
+ thisp = thisp || this;
34253
+ var res = new Yallist$1();
34254
+ for (var walker = this.tail; walker !== null; ) {
34255
+ res.push(fn.call(thisp, walker.value, this));
34256
+ walker = walker.prev;
34257
+ }
34258
+ return res;
34259
+ };
34260
+ Yallist$1.prototype.reduce = function(fn, initial) {
34261
+ var acc;
34262
+ var walker = this.head;
34263
+ if (arguments.length > 1) {
34264
+ acc = initial;
34265
+ } else if (this.head) {
34266
+ walker = this.head.next;
34267
+ acc = this.head.value;
34268
+ } else {
34269
+ throw new TypeError("Reduce of empty list with no initial value");
34270
+ }
34271
+ for (var i = 0; walker !== null; i++) {
34272
+ acc = fn(acc, walker.value, i);
34273
+ walker = walker.next;
34274
+ }
34275
+ return acc;
34276
+ };
34277
+ Yallist$1.prototype.reduceReverse = function(fn, initial) {
34278
+ var acc;
34279
+ var walker = this.tail;
34280
+ if (arguments.length > 1) {
34281
+ acc = initial;
34282
+ } else if (this.tail) {
34283
+ walker = this.tail.prev;
34284
+ acc = this.tail.value;
34285
+ } else {
34286
+ throw new TypeError("Reduce of empty list with no initial value");
34287
+ }
34288
+ for (var i = this.length - 1; walker !== null; i--) {
34289
+ acc = fn(acc, walker.value, i);
34290
+ walker = walker.prev;
34291
+ }
34292
+ return acc;
34293
+ };
34294
+ Yallist$1.prototype.toArray = function() {
34295
+ var arr = new Array(this.length);
34296
+ for (var i = 0, walker = this.head; walker !== null; i++) {
34297
+ arr[i] = walker.value;
34298
+ walker = walker.next;
34299
+ }
34300
+ return arr;
34301
+ };
34302
+ Yallist$1.prototype.toArrayReverse = function() {
34303
+ var arr = new Array(this.length);
34304
+ for (var i = 0, walker = this.tail; walker !== null; i++) {
34305
+ arr[i] = walker.value;
34306
+ walker = walker.prev;
34307
+ }
34308
+ return arr;
34309
+ };
34310
+ Yallist$1.prototype.slice = function(from, to) {
34311
+ to = to || this.length;
34312
+ if (to < 0) {
34313
+ to += this.length;
34314
+ }
34315
+ from = from || 0;
34316
+ if (from < 0) {
34317
+ from += this.length;
34318
+ }
34319
+ var ret = new Yallist$1();
34320
+ if (to < from || to < 0) {
34321
+ return ret;
34322
+ }
34323
+ if (from < 0) {
34324
+ from = 0;
34325
+ }
34326
+ if (to > this.length) {
34327
+ to = this.length;
34328
+ }
34329
+ for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
34330
+ walker = walker.next;
34331
+ }
34332
+ for (; walker !== null && i < to; i++, walker = walker.next) {
34333
+ ret.push(walker.value);
34334
+ }
34335
+ return ret;
34336
+ };
34337
+ Yallist$1.prototype.sliceReverse = function(from, to) {
34338
+ to = to || this.length;
34339
+ if (to < 0) {
34340
+ to += this.length;
34341
+ }
34342
+ from = from || 0;
34343
+ if (from < 0) {
34344
+ from += this.length;
34345
+ }
34346
+ var ret = new Yallist$1();
34347
+ if (to < from || to < 0) {
34348
+ return ret;
34349
+ }
34350
+ if (from < 0) {
34351
+ from = 0;
34352
+ }
34353
+ if (to > this.length) {
34354
+ to = this.length;
34355
+ }
34356
+ for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
34357
+ walker = walker.prev;
34358
+ }
34359
+ for (; walker !== null && i > from; i--, walker = walker.prev) {
34360
+ ret.push(walker.value);
34361
+ }
34362
+ return ret;
34363
+ };
34364
+ Yallist$1.prototype.splice = function(start, deleteCount, ...nodes) {
34365
+ if (start > this.length) {
34366
+ start = this.length - 1;
34367
+ }
34368
+ if (start < 0) {
34369
+ start = this.length + start;
34370
+ }
34371
+ for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
34372
+ walker = walker.next;
34373
+ }
34374
+ var ret = [];
34375
+ for (var i = 0; walker && i < deleteCount; i++) {
34376
+ ret.push(walker.value);
34377
+ walker = this.removeNode(walker);
34378
+ }
34379
+ if (walker === null) {
34380
+ walker = this.tail;
34381
+ }
34382
+ if (walker !== this.head && walker !== this.tail) {
34383
+ walker = walker.prev;
34384
+ }
34385
+ for (var i = 0; i < nodes.length; i++) {
34386
+ walker = insert(this, walker, nodes[i]);
34387
+ }
34388
+ return ret;
34389
+ };
34390
+ Yallist$1.prototype.reverse = function() {
34391
+ var head = this.head;
34392
+ var tail = this.tail;
34393
+ for (var walker = head; walker !== null; walker = walker.prev) {
34394
+ var p = walker.prev;
34395
+ walker.prev = walker.next;
34396
+ walker.next = p;
34397
+ }
34398
+ this.head = tail;
34399
+ this.tail = head;
34400
+ return this;
34401
+ };
34402
+ function insert(self2, node, value) {
34403
+ var inserted = node === self2.head ? new Node2(value, null, node, self2) : new Node2(value, node, node.next, self2);
34404
+ if (inserted.next === null) {
34405
+ self2.tail = inserted;
34406
+ }
34407
+ if (inserted.prev === null) {
34408
+ self2.head = inserted;
34409
+ }
34410
+ self2.length++;
34411
+ return inserted;
34412
+ }
34413
+ function push(self2, item) {
34414
+ self2.tail = new Node2(item, self2.tail, null, self2);
34415
+ if (!self2.head) {
34416
+ self2.head = self2.tail;
34417
+ }
34418
+ self2.length++;
34419
+ }
34420
+ function unshift(self2, item) {
34421
+ self2.head = new Node2(item, null, self2.head, self2);
34422
+ if (!self2.tail) {
34423
+ self2.tail = self2.head;
34424
+ }
34425
+ self2.length++;
34426
+ }
34427
+ function Node2(value, prev, next, list) {
34428
+ if (!(this instanceof Node2)) {
34429
+ return new Node2(value, prev, next, list);
34430
+ }
34431
+ this.list = list;
34432
+ this.value = value;
34433
+ if (prev) {
34434
+ prev.next = this;
34435
+ this.prev = prev;
34436
+ } else {
34437
+ this.prev = null;
34438
+ }
34439
+ if (next) {
34440
+ next.prev = this;
34441
+ this.next = next;
34442
+ } else {
34443
+ this.next = null;
34444
+ }
34445
+ }
34446
+ try {
34447
+ requireIterator()(Yallist$1);
34448
+ } catch (er) {
34449
+ }
34450
+ const Yallist = yallist;
34451
+ const MAX = Symbol("max");
34452
+ const LENGTH = Symbol("length");
34453
+ const LENGTH_CALCULATOR = Symbol("lengthCalculator");
34454
+ const ALLOW_STALE = Symbol("allowStale");
34455
+ const MAX_AGE = Symbol("maxAge");
34456
+ const DISPOSE = Symbol("dispose");
34457
+ const NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
34458
+ const LRU_LIST = Symbol("lruList");
34459
+ const CACHE = Symbol("cache");
34460
+ const UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
34461
+ const naiveLength = () => 1;
34059
34462
  class LRUCache {
34060
- constructor() {
34061
- this.max = 1e3;
34062
- this.map = /* @__PURE__ */ new Map();
34463
+ constructor(options2) {
34464
+ if (typeof options2 === "number")
34465
+ options2 = { max: options2 };
34466
+ if (!options2)
34467
+ options2 = {};
34468
+ if (options2.max && (typeof options2.max !== "number" || options2.max < 0))
34469
+ throw new TypeError("max must be a non-negative number");
34470
+ this[MAX] = options2.max || Infinity;
34471
+ const lc = options2.length || naiveLength;
34472
+ this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
34473
+ this[ALLOW_STALE] = options2.stale || false;
34474
+ if (options2.maxAge && typeof options2.maxAge !== "number")
34475
+ throw new TypeError("maxAge must be a number");
34476
+ this[MAX_AGE] = options2.maxAge || 0;
34477
+ this[DISPOSE] = options2.dispose;
34478
+ this[NO_DISPOSE_ON_SET] = options2.noDisposeOnSet || false;
34479
+ this[UPDATE_AGE_ON_GET] = options2.updateAgeOnGet || false;
34480
+ this.reset();
34481
+ }
34482
+ // resize the cache when the max changes.
34483
+ set max(mL) {
34484
+ if (typeof mL !== "number" || mL < 0)
34485
+ throw new TypeError("max must be a non-negative number");
34486
+ this[MAX] = mL || Infinity;
34487
+ trim(this);
34488
+ }
34489
+ get max() {
34490
+ return this[MAX];
34491
+ }
34492
+ set allowStale(allowStale) {
34493
+ this[ALLOW_STALE] = !!allowStale;
34494
+ }
34495
+ get allowStale() {
34496
+ return this[ALLOW_STALE];
34497
+ }
34498
+ set maxAge(mA) {
34499
+ if (typeof mA !== "number")
34500
+ throw new TypeError("maxAge must be a non-negative number");
34501
+ this[MAX_AGE] = mA;
34502
+ trim(this);
34503
+ }
34504
+ get maxAge() {
34505
+ return this[MAX_AGE];
34506
+ }
34507
+ // resize the cache when the lengthCalculator changes.
34508
+ set lengthCalculator(lC) {
34509
+ if (typeof lC !== "function")
34510
+ lC = naiveLength;
34511
+ if (lC !== this[LENGTH_CALCULATOR]) {
34512
+ this[LENGTH_CALCULATOR] = lC;
34513
+ this[LENGTH] = 0;
34514
+ this[LRU_LIST].forEach((hit) => {
34515
+ hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
34516
+ this[LENGTH] += hit.length;
34517
+ });
34518
+ }
34519
+ trim(this);
34520
+ }
34521
+ get lengthCalculator() {
34522
+ return this[LENGTH_CALCULATOR];
34523
+ }
34524
+ get length() {
34525
+ return this[LENGTH];
34526
+ }
34527
+ get itemCount() {
34528
+ return this[LRU_LIST].length;
34529
+ }
34530
+ rforEach(fn, thisp) {
34531
+ thisp = thisp || this;
34532
+ for (let walker = this[LRU_LIST].tail; walker !== null; ) {
34533
+ const prev = walker.prev;
34534
+ forEachStep(this, fn, walker, thisp);
34535
+ walker = prev;
34536
+ }
34537
+ }
34538
+ forEach(fn, thisp) {
34539
+ thisp = thisp || this;
34540
+ for (let walker = this[LRU_LIST].head; walker !== null; ) {
34541
+ const next = walker.next;
34542
+ forEachStep(this, fn, walker, thisp);
34543
+ walker = next;
34544
+ }
34545
+ }
34546
+ keys() {
34547
+ return this[LRU_LIST].toArray().map((k) => k.key);
34548
+ }
34549
+ values() {
34550
+ return this[LRU_LIST].toArray().map((k) => k.value);
34551
+ }
34552
+ reset() {
34553
+ if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
34554
+ this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
34555
+ }
34556
+ this[CACHE] = /* @__PURE__ */ new Map();
34557
+ this[LRU_LIST] = new Yallist();
34558
+ this[LENGTH] = 0;
34559
+ }
34560
+ dump() {
34561
+ return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
34562
+ k: hit.key,
34563
+ v: hit.value,
34564
+ e: hit.now + (hit.maxAge || 0)
34565
+ }).toArray().filter((h2) => h2);
34566
+ }
34567
+ dumpLru() {
34568
+ return this[LRU_LIST];
34569
+ }
34570
+ set(key, value, maxAge) {
34571
+ maxAge = maxAge || this[MAX_AGE];
34572
+ if (maxAge && typeof maxAge !== "number")
34573
+ throw new TypeError("maxAge must be a number");
34574
+ const now = maxAge ? Date.now() : 0;
34575
+ const len = this[LENGTH_CALCULATOR](value, key);
34576
+ if (this[CACHE].has(key)) {
34577
+ if (len > this[MAX]) {
34578
+ del(this, this[CACHE].get(key));
34579
+ return false;
34580
+ }
34581
+ const node = this[CACHE].get(key);
34582
+ const item = node.value;
34583
+ if (this[DISPOSE]) {
34584
+ if (!this[NO_DISPOSE_ON_SET])
34585
+ this[DISPOSE](key, item.value);
34586
+ }
34587
+ item.now = now;
34588
+ item.maxAge = maxAge;
34589
+ item.value = value;
34590
+ this[LENGTH] += len - item.length;
34591
+ item.length = len;
34592
+ this.get(key);
34593
+ trim(this);
34594
+ return true;
34595
+ }
34596
+ const hit = new Entry(key, value, len, now, maxAge);
34597
+ if (hit.length > this[MAX]) {
34598
+ if (this[DISPOSE])
34599
+ this[DISPOSE](key, value);
34600
+ return false;
34601
+ }
34602
+ this[LENGTH] += hit.length;
34603
+ this[LRU_LIST].unshift(hit);
34604
+ this[CACHE].set(key, this[LRU_LIST].head);
34605
+ trim(this);
34606
+ return true;
34607
+ }
34608
+ has(key) {
34609
+ if (!this[CACHE].has(key)) return false;
34610
+ const hit = this[CACHE].get(key).value;
34611
+ return !isStale(this, hit);
34063
34612
  }
34064
34613
  get(key) {
34065
- const value = this.map.get(key);
34066
- if (value === void 0) {
34067
- return void 0;
34068
- } else {
34069
- this.map.delete(key);
34070
- this.map.set(key, value);
34071
- return value;
34614
+ return get(this, key, true);
34615
+ }
34616
+ peek(key) {
34617
+ return get(this, key, false);
34618
+ }
34619
+ pop() {
34620
+ const node = this[LRU_LIST].tail;
34621
+ if (!node)
34622
+ return null;
34623
+ del(this, node);
34624
+ return node.value;
34625
+ }
34626
+ del(key) {
34627
+ del(this, this[CACHE].get(key));
34628
+ }
34629
+ load(arr) {
34630
+ this.reset();
34631
+ const now = Date.now();
34632
+ for (let l = arr.length - 1; l >= 0; l--) {
34633
+ const hit = arr[l];
34634
+ const expiresAt = hit.e || 0;
34635
+ if (expiresAt === 0)
34636
+ this.set(hit.k, hit.v);
34637
+ else {
34638
+ const maxAge = expiresAt - now;
34639
+ if (maxAge > 0) {
34640
+ this.set(hit.k, hit.v, maxAge);
34641
+ }
34642
+ }
34072
34643
  }
34073
34644
  }
34074
- delete(key) {
34075
- return this.map.delete(key);
34645
+ prune() {
34646
+ this[CACHE].forEach((value, key) => get(this, key, false));
34076
34647
  }
34077
- set(key, value) {
34078
- const deleted = this.delete(key);
34079
- if (!deleted && value !== void 0) {
34080
- if (this.map.size >= this.max) {
34081
- const firstKey = this.map.keys().next().value;
34082
- this.delete(firstKey);
34648
+ }
34649
+ const get = (self2, key, doUse) => {
34650
+ const node = self2[CACHE].get(key);
34651
+ if (node) {
34652
+ const hit = node.value;
34653
+ if (isStale(self2, hit)) {
34654
+ del(self2, node);
34655
+ if (!self2[ALLOW_STALE])
34656
+ return void 0;
34657
+ } else {
34658
+ if (doUse) {
34659
+ if (self2[UPDATE_AGE_ON_GET])
34660
+ node.value.now = Date.now();
34661
+ self2[LRU_LIST].unshiftNode(node);
34083
34662
  }
34084
- this.map.set(key, value);
34085
34663
  }
34086
- return this;
34664
+ return hit.value;
34665
+ }
34666
+ };
34667
+ const isStale = (self2, hit) => {
34668
+ if (!hit || !hit.maxAge && !self2[MAX_AGE])
34669
+ return false;
34670
+ const diff2 = Date.now() - hit.now;
34671
+ return hit.maxAge ? diff2 > hit.maxAge : self2[MAX_AGE] && diff2 > self2[MAX_AGE];
34672
+ };
34673
+ const trim = (self2) => {
34674
+ if (self2[LENGTH] > self2[MAX]) {
34675
+ for (let walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
34676
+ const prev = walker.prev;
34677
+ del(self2, walker);
34678
+ walker = prev;
34679
+ }
34680
+ }
34681
+ };
34682
+ const del = (self2, node) => {
34683
+ if (node) {
34684
+ const hit = node.value;
34685
+ if (self2[DISPOSE])
34686
+ self2[DISPOSE](hit.key, hit.value);
34687
+ self2[LENGTH] -= hit.length;
34688
+ self2[CACHE].delete(hit.key);
34689
+ self2[LRU_LIST].removeNode(node);
34690
+ }
34691
+ };
34692
+ class Entry {
34693
+ constructor(key, value, length, now, maxAge) {
34694
+ this.key = key;
34695
+ this.value = value;
34696
+ this.length = length;
34697
+ this.now = now;
34698
+ this.maxAge = maxAge || 0;
34087
34699
  }
34088
34700
  }
34089
- var lrucache = LRUCache;
34701
+ const forEachStep = (self2, fn, node, thisp) => {
34702
+ let hit = node.value;
34703
+ if (isStale(self2, hit)) {
34704
+ del(self2, node);
34705
+ if (!self2[ALLOW_STALE])
34706
+ hit = void 0;
34707
+ }
34708
+ if (hit)
34709
+ fn.call(thisp, hit.value, hit.key, self2);
34710
+ };
34711
+ var lruCache = LRUCache;
34090
34712
  var range;
34091
34713
  var hasRequiredRange;
34092
34714
  function requireRange() {
34093
34715
  if (hasRequiredRange) return range;
34094
34716
  hasRequiredRange = 1;
34095
- const SPACE_CHARACTERS = /\s+/g;
34096
34717
  class Range2 {
34097
34718
  constructor(range2, options2) {
34098
34719
  options2 = parseOptions2(options2);
@@ -34106,13 +34727,13 @@ function requireRange() {
34106
34727
  if (range2 instanceof Comparator2) {
34107
34728
  this.raw = range2.value;
34108
34729
  this.set = [[range2]];
34109
- this.formatted = void 0;
34730
+ this.format();
34110
34731
  return this;
34111
34732
  }
34112
34733
  this.options = options2;
34113
34734
  this.loose = !!options2.loose;
34114
34735
  this.includePrerelease = !!options2.includePrerelease;
34115
- this.raw = range2.trim().replace(SPACE_CHARACTERS, " ");
34736
+ this.raw = range2.trim().split(/\s+/).join(" ");
34116
34737
  this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
34117
34738
  if (!this.set.length) {
34118
34739
  throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
@@ -34131,27 +34752,10 @@ function requireRange() {
34131
34752
  }
34132
34753
  }
34133
34754
  }
34134
- this.formatted = void 0;
34135
- }
34136
- get range() {
34137
- if (this.formatted === void 0) {
34138
- this.formatted = "";
34139
- for (let i = 0; i < this.set.length; i++) {
34140
- if (i > 0) {
34141
- this.formatted += "||";
34142
- }
34143
- const comps = this.set[i];
34144
- for (let k = 0; k < comps.length; k++) {
34145
- if (k > 0) {
34146
- this.formatted += " ";
34147
- }
34148
- this.formatted += comps[k].toString().trim();
34149
- }
34150
- }
34151
- }
34152
- return this.formatted;
34755
+ this.format();
34153
34756
  }
34154
34757
  format() {
34758
+ this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
34155
34759
  return this.range;
34156
34760
  }
34157
34761
  toString() {
@@ -34232,8 +34836,8 @@ function requireRange() {
34232
34836
  }
34233
34837
  }
34234
34838
  range = Range2;
34235
- const LRU = lrucache;
34236
- const cache = new LRU();
34839
+ const LRU = lruCache;
34840
+ const cache = new LRU({ max: 1e3 });
34237
34841
  const parseOptions2 = parseOptions_1;
34238
34842
  const Comparator2 = requireComparator();
34239
34843
  const debug2 = debug_1;
@@ -34261,7 +34865,6 @@ function requireRange() {
34261
34865
  return result;
34262
34866
  };
34263
34867
  const parseComparator = (comp, options2) => {
34264
- comp = comp.replace(re2[t2.BUILD], "");
34265
34868
  debug2("comp", comp, options2);
34266
34869
  comp = replaceCarets(comp, options2);
34267
34870
  debug2("caret", comp);
@@ -34412,7 +35015,7 @@ function requireRange() {
34412
35015
  debug2("replaceGTE0", comp, options2);
34413
35016
  return comp.trim().replace(re2[options2.includePrerelease ? t2.GTE0PRE : t2.GTE0], "");
34414
35017
  };
34415
- const hyphenReplace = (incPr) => ($0, from, fM, fm, fp2, fpr, fb, to, tM, tm, tp, tpr) => {
35018
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp2, fpr, fb, to, tM, tm, tp, tpr, tb) => {
34416
35019
  if (isX(fM)) {
34417
35020
  from = "";
34418
35021
  } else if (isX(fm)) {
@@ -35735,9 +36338,10 @@ const tokenService = ({ strapi: strapi2 }) => {
35735
36338
  if (firebaseUserData2.verificationTokenHash !== tokenHash) {
35736
36339
  return {
35737
36340
  valid: false,
35738
- firebaseUserDataDocumentId: "",
35739
- firebaseUID: "",
35740
- error: "Verification link has already been used or is invalid"
36341
+ firebaseUserDataDocumentId: firebaseUserData2.documentId,
36342
+ firebaseUID: firebaseUserData2.firebaseUserID,
36343
+ error: "Verification link has already been used or is invalid",
36344
+ code: "TOKEN_ALREADY_USED"
35741
36345
  };
35742
36346
  }
35743
36347
  if (firebaseUserData2.verificationTokenExpiresAt) {