@hot-updater/firebase 0.29.5 → 0.29.6

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.
@@ -1,37 +1,129 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
3
+ var __create$1 = Object.create;
4
+ var __defProp$1 = Object.defineProperty;
5
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames$1 = Object.getOwnPropertyNames;
7
+ var __getProtoOf$1 = Object.getPrototypeOf;
8
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
9
+ var __commonJSMin$1 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
10
+ var __copyProps$1 = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$1(from), i = 0, n = keys.length, key; i < n; i++) {
11
12
  key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$1(to, key, {
13
14
  get: ((k) => from[k]).bind(null, key),
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
15
16
  });
16
17
  }
17
18
  return to;
18
19
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$1(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
20
21
  value: mod,
21
22
  enumerable: true
22
23
  }) : target, mod));
23
24
  //#endregion
24
25
  let _hot_updater_server_runtime = require("@hot-updater/server/runtime");
25
26
  let firebase_admin = require("firebase-admin");
26
- firebase_admin = __toESM(firebase_admin);
27
+ firebase_admin = __toESM$1(firebase_admin);
27
28
  let firebase_functions_v2_https = require("firebase-functions/v2/https");
28
29
  let hono = require("hono");
29
30
  let node_path = require("node:path");
30
- node_path = __toESM(node_path);
31
+ node_path = __toESM$1(node_path);
31
32
  let fs_promises = require("fs/promises");
32
- fs_promises = __toESM(fs_promises);
33
+ fs_promises = __toESM$1(fs_promises);
33
34
  let path = require("path");
34
- path = __toESM(path);
35
+ path = __toESM$1(path);
36
+ //#region ../../packages/core/dist/index.mjs
37
+ const NUMERIC_COHORT_SIZE = 1e3;
38
+ const DEFAULT_ROLLOUT_COHORT_COUNT = NUMERIC_COHORT_SIZE;
39
+ function parseNumericCohortValue(cohort) {
40
+ if (!/^\d+$/.test(cohort)) return null;
41
+ const parsed = Number.parseInt(cohort, 10);
42
+ if (Number.isNaN(parsed) || parsed < 1 || parsed > 1e3) return null;
43
+ return parsed;
44
+ }
45
+ function positiveMod(value, modulus) {
46
+ return (value % modulus + modulus) % modulus;
47
+ }
48
+ function hashString(value) {
49
+ let hash = 0;
50
+ for (let i = 0; i < value.length; i++) {
51
+ const char = value.charCodeAt(i);
52
+ hash = (hash << 5) - hash + char;
53
+ hash |= 0;
54
+ }
55
+ return hash;
56
+ }
57
+ function gcd(a, b) {
58
+ let x = Math.abs(a);
59
+ let y = Math.abs(b);
60
+ while (y !== 0) {
61
+ const next = x % y;
62
+ x = y;
63
+ y = next;
64
+ }
65
+ return x;
66
+ }
67
+ function modularInverse(value, modulus) {
68
+ let t = 0;
69
+ let newT = 1;
70
+ let r = modulus;
71
+ let newR = positiveMod(value, modulus);
72
+ while (newR !== 0) {
73
+ const quotient = Math.floor(r / newR);
74
+ [t, newT] = [newT, t - quotient * newT];
75
+ [r, newR] = [newR, r - quotient * newR];
76
+ }
77
+ if (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);
78
+ return positiveMod(t, modulus);
79
+ }
80
+ function getRolloutShuffleParameters(bundleId) {
81
+ let multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);
82
+ if (multiplier === 0) multiplier = 1;
83
+ while (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {
84
+ multiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);
85
+ if (multiplier === 0) multiplier = 1;
86
+ }
87
+ const offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);
88
+ return {
89
+ multiplier,
90
+ offset,
91
+ inverseMultiplier: modularInverse(multiplier, NUMERIC_COHORT_SIZE)
92
+ };
93
+ }
94
+ function normalizeRolloutCohortCount(rolloutCohortCount) {
95
+ if (rolloutCohortCount === null || rolloutCohortCount === void 0) return DEFAULT_ROLLOUT_COHORT_COUNT;
96
+ if (rolloutCohortCount <= 0) return 0;
97
+ if (rolloutCohortCount >= 1e3) return NUMERIC_COHORT_SIZE;
98
+ return Math.floor(rolloutCohortCount);
99
+ }
100
+ function normalizeCohortValue(cohort) {
101
+ const normalized = cohort.trim().toLowerCase();
102
+ const numericCohort = parseNumericCohortValue(normalized);
103
+ if (numericCohort !== null) return String(numericCohort);
104
+ return normalized;
105
+ }
106
+ function getNumericCohortValue(cohort) {
107
+ return parseNumericCohortValue(normalizeCohortValue(cohort));
108
+ }
109
+ function getNumericCohortRolloutPosition(bundleId, cohortValue) {
110
+ if (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);
111
+ const { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);
112
+ return positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);
113
+ }
114
+ function isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetCohorts) {
115
+ const normalizedCohort = cohort === null || cohort === void 0 ? void 0 : normalizeCohortValue(cohort);
116
+ const normalizedTargetCohorts = targetCohorts?.map((targetCohort) => normalizeCohortValue(targetCohort)) ?? [];
117
+ if (normalizedTargetCohorts.length > 0) return normalizedCohort !== void 0 && normalizedTargetCohorts.includes(normalizedCohort);
118
+ const normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);
119
+ if (normalizedRolloutCount <= 0) return false;
120
+ if (normalizedCohort === void 0) return normalizedRolloutCount >= NUMERIC_COHORT_SIZE;
121
+ const numericCohort = getNumericCohortValue(normalizedCohort);
122
+ if (numericCohort === null) return false;
123
+ if (normalizedRolloutCount >= 1e3) return true;
124
+ return getNumericCohortRolloutPosition(bundleId, numericCohort) < normalizedRolloutCount;
125
+ }
126
+ const NIL_UUID = "00000000-0000-0000-0000-000000000000";
35
127
  //#endregion
36
128
  //#region ../plugin-core/dist/calculatePagination.mjs
37
129
  /**
@@ -1460,11 +1552,71 @@ function mergeWith(target, source, merge) {
1460
1552
  //#endregion
1461
1553
  //#region ../plugin-core/dist/createDatabasePlugin.mjs
1462
1554
  const REPLACE_ON_UPDATE_KEYS = ["targetCohorts"];
1555
+ const DEFAULT_DESC_ORDER = {
1556
+ field: "id",
1557
+ direction: "desc"
1558
+ };
1559
+ function normalizePage(value) {
1560
+ if (!Number.isInteger(value) || value === void 0 || value < 1) return;
1561
+ return value;
1562
+ }
1463
1563
  function mergeBundleUpdate(baseBundle, patch) {
1464
1564
  return mergeWith(baseBundle, patch, (_targetValue, sourceValue, key) => {
1465
1565
  if (REPLACE_ON_UPDATE_KEYS.includes(key)) return sourceValue;
1466
1566
  });
1467
1567
  }
1568
+ function mergeIdFilter(base, patch) {
1569
+ return {
1570
+ ...base,
1571
+ ...patch
1572
+ };
1573
+ }
1574
+ function mergeWhereWithIdFilter(where, idFilter) {
1575
+ return {
1576
+ ...where,
1577
+ id: mergeIdFilter(where?.id, idFilter)
1578
+ };
1579
+ }
1580
+ function buildCursorPageQuery(where, cursor, orderBy) {
1581
+ const direction = orderBy.direction;
1582
+ if (cursor.after) return {
1583
+ reverseData: false,
1584
+ where: mergeWhereWithIdFilter(where, { [direction === "desc" ? "lt" : "gt"]: cursor.after }),
1585
+ orderBy
1586
+ };
1587
+ if (cursor.before) return {
1588
+ reverseData: true,
1589
+ where: mergeWhereWithIdFilter(where, { [direction === "desc" ? "gt" : "lt"]: cursor.before }),
1590
+ orderBy: {
1591
+ field: orderBy.field,
1592
+ direction: direction === "desc" ? "asc" : "desc"
1593
+ }
1594
+ };
1595
+ return {
1596
+ reverseData: false,
1597
+ where: where ?? {},
1598
+ orderBy
1599
+ };
1600
+ }
1601
+ function buildCountBeforeWhere(where, firstBundleId, orderBy) {
1602
+ return mergeWhereWithIdFilter(where, { [orderBy.direction === "desc" ? "gt" : "lt"]: firstBundleId });
1603
+ }
1604
+ function createPaginatedResult(total, limit, startIndex, data) {
1605
+ const pagination = calculatePagination(total, {
1606
+ limit,
1607
+ offset: startIndex
1608
+ });
1609
+ const nextCursor = data.length > 0 && startIndex + data.length < total ? data.at(-1)?.id : void 0;
1610
+ const previousCursor = data.length > 0 && startIndex > 0 ? data[0]?.id : void 0;
1611
+ return {
1612
+ data,
1613
+ pagination: {
1614
+ ...pagination,
1615
+ ...nextCursor ? { nextCursor } : {},
1616
+ ...previousCursor ? { previousCursor } : {}
1617
+ }
1618
+ };
1619
+ }
1468
1620
  /**
1469
1621
  * Creates a database plugin with lazy initialization and automatic hook execution.
1470
1622
  *
@@ -1506,6 +1658,59 @@ function createDatabasePlugin(options) {
1506
1658
  data
1507
1659
  });
1508
1660
  };
1661
+ const runGetBundles = async (options, context) => {
1662
+ if (context === void 0) return getMethods().getBundles(options);
1663
+ return getMethods().getBundles(options, context);
1664
+ };
1665
+ const getBundlesWithLegacyCursorFallback = async (options, context) => {
1666
+ const orderBy = options.orderBy ?? DEFAULT_DESC_ORDER;
1667
+ const baseWhere = options.where;
1668
+ const total = (await runGetBundles({
1669
+ where: baseWhere,
1670
+ limit: 1,
1671
+ offset: 0,
1672
+ orderBy
1673
+ }, context)).pagination.total;
1674
+ if (!options.cursor?.after && !options.cursor?.before) {
1675
+ const firstPage = await runGetBundles({
1676
+ where: baseWhere,
1677
+ limit: options.limit,
1678
+ offset: 0,
1679
+ orderBy
1680
+ }, context);
1681
+ return createPaginatedResult(total, options.limit, 0, firstPage.data);
1682
+ }
1683
+ const { where, orderBy: queryOrderBy, reverseData } = buildCursorPageQuery(baseWhere, options.cursor, orderBy);
1684
+ const cursorPage = await runGetBundles({
1685
+ where,
1686
+ limit: options.limit,
1687
+ offset: 0,
1688
+ orderBy: queryOrderBy
1689
+ }, context);
1690
+ const data = reverseData ? cursorPage.data.slice().reverse() : cursorPage.data;
1691
+ if (data.length === 0) {
1692
+ const emptyStartIndex = options.cursor.after ? total : 0;
1693
+ return {
1694
+ data,
1695
+ pagination: {
1696
+ ...calculatePagination(total, {
1697
+ limit: options.limit,
1698
+ offset: emptyStartIndex
1699
+ }),
1700
+ ...options.cursor.after ? { previousCursor: options.cursor.after } : {},
1701
+ ...options.cursor.before ? { nextCursor: options.cursor.before } : {}
1702
+ }
1703
+ };
1704
+ }
1705
+ const firstBundleId = data[0].id;
1706
+ const countBeforeResult = await runGetBundles({
1707
+ where: buildCountBeforeWhere(baseWhere, firstBundleId, orderBy),
1708
+ limit: 1,
1709
+ offset: 0,
1710
+ orderBy
1711
+ }, context);
1712
+ return createPaginatedResult(total, options.limit, countBeforeResult.pagination.total, data);
1713
+ };
1509
1714
  const plugin = {
1510
1715
  name: options.name,
1511
1716
  async getBundleById(bundleId, context) {
@@ -1513,8 +1718,35 @@ function createDatabasePlugin(options) {
1513
1718
  return getMethods().getBundleById(bundleId, context);
1514
1719
  },
1515
1720
  async getBundles(options, context) {
1516
- if (context === void 0) return getMethods().getBundles(options);
1517
- return getMethods().getBundles(options, context);
1721
+ if (typeof options === "object" && options !== null && "offset" in options && options.offset !== void 0) throw new Error("Bundle offset pagination has been removed. Use cursor.after or cursor.before instead.");
1722
+ const methods = getMethods();
1723
+ const normalizedOptions = {
1724
+ ...options,
1725
+ page: normalizePage(options.page),
1726
+ orderBy: options.orderBy ?? DEFAULT_DESC_ORDER
1727
+ };
1728
+ if (normalizedOptions.page !== void 0) {
1729
+ const { page, ...pageOptions } = normalizedOptions;
1730
+ const requestedOffset = (page - 1) * normalizedOptions.limit;
1731
+ let pageResult = await runGetBundles({
1732
+ ...pageOptions,
1733
+ offset: requestedOffset
1734
+ }, context);
1735
+ const total = pageResult.pagination.total;
1736
+ const totalPages = total === 0 ? 0 : Math.ceil(total / normalizedOptions.limit);
1737
+ const maxOffset = totalPages === 0 ? 0 : (Math.max(1, totalPages) - 1) * normalizedOptions.limit;
1738
+ const resolvedOffset = Math.min(requestedOffset, maxOffset);
1739
+ if (resolvedOffset !== requestedOffset) pageResult = await runGetBundles({
1740
+ ...pageOptions,
1741
+ offset: resolvedOffset
1742
+ }, context);
1743
+ return createPaginatedResult(total, normalizedOptions.limit, resolvedOffset, pageResult.data);
1744
+ }
1745
+ if (methods.supportsCursorPagination) {
1746
+ if (context === void 0) return methods.getBundles(normalizedOptions);
1747
+ return methods.getBundles(normalizedOptions, context);
1748
+ }
1749
+ return getBundlesWithLegacyCursorFallback(normalizedOptions, context);
1518
1750
  },
1519
1751
  async getChannels(context) {
1520
1752
  if (context === void 0) return getMethods().getChannels();
@@ -1583,6 +1815,2741 @@ function createDatabasePlugin(options) {
1583
1815
  };
1584
1816
  }
1585
1817
  //#endregion
1818
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
1819
+ var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1820
+ const SEMVER_SPEC_VERSION = "2.0.0";
1821
+ const MAX_LENGTH = 256;
1822
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
1823
+ module.exports = {
1824
+ MAX_LENGTH,
1825
+ MAX_SAFE_COMPONENT_LENGTH: 16,
1826
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
1827
+ MAX_SAFE_INTEGER,
1828
+ RELEASE_TYPES: [
1829
+ "major",
1830
+ "premajor",
1831
+ "minor",
1832
+ "preminor",
1833
+ "patch",
1834
+ "prepatch",
1835
+ "prerelease"
1836
+ ],
1837
+ SEMVER_SPEC_VERSION,
1838
+ FLAG_INCLUDE_PRERELEASE: 1,
1839
+ FLAG_LOOSE: 2
1840
+ };
1841
+ }));
1842
+ //#endregion
1843
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js
1844
+ var require_debug$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1845
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
1846
+ }));
1847
+ //#endregion
1848
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js
1849
+ var require_re$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1850
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants$1();
1851
+ const debug = require_debug$1();
1852
+ exports = module.exports = {};
1853
+ const re = exports.re = [];
1854
+ const safeRe = exports.safeRe = [];
1855
+ const src = exports.src = [];
1856
+ const safeSrc = exports.safeSrc = [];
1857
+ const t = exports.t = {};
1858
+ let R = 0;
1859
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
1860
+ const safeRegexReplacements = [
1861
+ ["\\s", 1],
1862
+ ["\\d", MAX_LENGTH],
1863
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
1864
+ ];
1865
+ const makeSafeRegex = (value) => {
1866
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
1867
+ return value;
1868
+ };
1869
+ const createToken = (name, value, isGlobal) => {
1870
+ const safe = makeSafeRegex(value);
1871
+ const index = R++;
1872
+ debug(name, index, value);
1873
+ t[name] = index;
1874
+ src[index] = value;
1875
+ safeSrc[index] = safe;
1876
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
1877
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
1878
+ };
1879
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
1880
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
1881
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
1882
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
1883
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
1884
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
1885
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
1886
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
1887
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
1888
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
1889
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
1890
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
1891
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
1892
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
1893
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
1894
+ createToken("GTLT", "((?:<|>)?=?)");
1895
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
1896
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
1897
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
1898
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
1899
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
1900
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
1901
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
1902
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
1903
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
1904
+ createToken("COERCERTL", src[t.COERCE], true);
1905
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
1906
+ createToken("LONETILDE", "(?:~>?)");
1907
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
1908
+ exports.tildeTrimReplace = "$1~";
1909
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
1910
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
1911
+ createToken("LONECARET", "(?:\\^)");
1912
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
1913
+ exports.caretTrimReplace = "$1^";
1914
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
1915
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
1916
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
1917
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
1918
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
1919
+ exports.comparatorTrimReplace = "$1$2$3";
1920
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
1921
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
1922
+ createToken("STAR", "(<|>)?=?\\s*\\*");
1923
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
1924
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
1925
+ }));
1926
+ //#endregion
1927
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js
1928
+ var require_parse_options$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1929
+ const looseOption = Object.freeze({ loose: true });
1930
+ const emptyOpts = Object.freeze({});
1931
+ const parseOptions = (options) => {
1932
+ if (!options) return emptyOpts;
1933
+ if (typeof options !== "object") return looseOption;
1934
+ return options;
1935
+ };
1936
+ module.exports = parseOptions;
1937
+ }));
1938
+ //#endregion
1939
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js
1940
+ var require_identifiers$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1941
+ const numeric = /^[0-9]+$/;
1942
+ const compareIdentifiers = (a, b) => {
1943
+ const anum = numeric.test(a);
1944
+ const bnum = numeric.test(b);
1945
+ if (anum && bnum) {
1946
+ a = +a;
1947
+ b = +b;
1948
+ }
1949
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
1950
+ };
1951
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
1952
+ module.exports = {
1953
+ compareIdentifiers,
1954
+ rcompareIdentifiers
1955
+ };
1956
+ }));
1957
+ //#endregion
1958
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js
1959
+ var require_semver$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1960
+ const debug = require_debug$1();
1961
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants$1();
1962
+ const { safeRe: re, t } = require_re$1();
1963
+ const parseOptions = require_parse_options$1();
1964
+ const { compareIdentifiers } = require_identifiers$1();
1965
+ module.exports = class SemVer {
1966
+ constructor(version, options) {
1967
+ options = parseOptions(options);
1968
+ if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
1969
+ else version = version.version;
1970
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
1971
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
1972
+ debug("SemVer", version, options);
1973
+ this.options = options;
1974
+ this.loose = !!options.loose;
1975
+ this.includePrerelease = !!options.includePrerelease;
1976
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
1977
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
1978
+ this.raw = version;
1979
+ this.major = +m[1];
1980
+ this.minor = +m[2];
1981
+ this.patch = +m[3];
1982
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
1983
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
1984
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
1985
+ if (!m[4]) this.prerelease = [];
1986
+ else this.prerelease = m[4].split(".").map((id) => {
1987
+ if (/^[0-9]+$/.test(id)) {
1988
+ const num = +id;
1989
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
1990
+ }
1991
+ return id;
1992
+ });
1993
+ this.build = m[5] ? m[5].split(".") : [];
1994
+ this.format();
1995
+ }
1996
+ format() {
1997
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
1998
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
1999
+ return this.version;
2000
+ }
2001
+ toString() {
2002
+ return this.version;
2003
+ }
2004
+ compare(other) {
2005
+ debug("SemVer.compare", this.version, this.options, other);
2006
+ if (!(other instanceof SemVer)) {
2007
+ if (typeof other === "string" && other === this.version) return 0;
2008
+ other = new SemVer(other, this.options);
2009
+ }
2010
+ if (other.version === this.version) return 0;
2011
+ return this.compareMain(other) || this.comparePre(other);
2012
+ }
2013
+ compareMain(other) {
2014
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
2015
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
2016
+ }
2017
+ comparePre(other) {
2018
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
2019
+ if (this.prerelease.length && !other.prerelease.length) return -1;
2020
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
2021
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
2022
+ let i = 0;
2023
+ do {
2024
+ const a = this.prerelease[i];
2025
+ const b = other.prerelease[i];
2026
+ debug("prerelease compare", i, a, b);
2027
+ if (a === void 0 && b === void 0) return 0;
2028
+ else if (b === void 0) return 1;
2029
+ else if (a === void 0) return -1;
2030
+ else if (a === b) continue;
2031
+ else return compareIdentifiers(a, b);
2032
+ } while (++i);
2033
+ }
2034
+ compareBuild(other) {
2035
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
2036
+ let i = 0;
2037
+ do {
2038
+ const a = this.build[i];
2039
+ const b = other.build[i];
2040
+ debug("build compare", i, a, b);
2041
+ if (a === void 0 && b === void 0) return 0;
2042
+ else if (b === void 0) return 1;
2043
+ else if (a === void 0) return -1;
2044
+ else if (a === b) continue;
2045
+ else return compareIdentifiers(a, b);
2046
+ } while (++i);
2047
+ }
2048
+ inc(release, identifier, identifierBase) {
2049
+ if (release.startsWith("pre")) {
2050
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
2051
+ if (identifier) {
2052
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
2053
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
2054
+ }
2055
+ }
2056
+ switch (release) {
2057
+ case "premajor":
2058
+ this.prerelease.length = 0;
2059
+ this.patch = 0;
2060
+ this.minor = 0;
2061
+ this.major++;
2062
+ this.inc("pre", identifier, identifierBase);
2063
+ break;
2064
+ case "preminor":
2065
+ this.prerelease.length = 0;
2066
+ this.patch = 0;
2067
+ this.minor++;
2068
+ this.inc("pre", identifier, identifierBase);
2069
+ break;
2070
+ case "prepatch":
2071
+ this.prerelease.length = 0;
2072
+ this.inc("patch", identifier, identifierBase);
2073
+ this.inc("pre", identifier, identifierBase);
2074
+ break;
2075
+ case "prerelease":
2076
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
2077
+ this.inc("pre", identifier, identifierBase);
2078
+ break;
2079
+ case "release":
2080
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
2081
+ this.prerelease.length = 0;
2082
+ break;
2083
+ case "major":
2084
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
2085
+ this.minor = 0;
2086
+ this.patch = 0;
2087
+ this.prerelease = [];
2088
+ break;
2089
+ case "minor":
2090
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
2091
+ this.patch = 0;
2092
+ this.prerelease = [];
2093
+ break;
2094
+ case "patch":
2095
+ if (this.prerelease.length === 0) this.patch++;
2096
+ this.prerelease = [];
2097
+ break;
2098
+ case "pre": {
2099
+ const base = Number(identifierBase) ? 1 : 0;
2100
+ if (this.prerelease.length === 0) this.prerelease = [base];
2101
+ else {
2102
+ let i = this.prerelease.length;
2103
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
2104
+ this.prerelease[i]++;
2105
+ i = -2;
2106
+ }
2107
+ if (i === -1) {
2108
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
2109
+ this.prerelease.push(base);
2110
+ }
2111
+ }
2112
+ if (identifier) {
2113
+ let prerelease = [identifier, base];
2114
+ if (identifierBase === false) prerelease = [identifier];
2115
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
2116
+ if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
2117
+ } else this.prerelease = prerelease;
2118
+ }
2119
+ break;
2120
+ }
2121
+ default: throw new Error(`invalid increment argument: ${release}`);
2122
+ }
2123
+ this.raw = this.format();
2124
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
2125
+ return this;
2126
+ }
2127
+ };
2128
+ }));
2129
+ //#endregion
2130
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js
2131
+ var require_parse$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2132
+ const SemVer = require_semver$2();
2133
+ const parse = (version, options, throwErrors = false) => {
2134
+ if (version instanceof SemVer) return version;
2135
+ try {
2136
+ return new SemVer(version, options);
2137
+ } catch (er) {
2138
+ if (!throwErrors) return null;
2139
+ throw er;
2140
+ }
2141
+ };
2142
+ module.exports = parse;
2143
+ }));
2144
+ //#endregion
2145
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js
2146
+ var require_valid$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2147
+ const parse = require_parse$1();
2148
+ const valid = (version, options) => {
2149
+ const v = parse(version, options);
2150
+ return v ? v.version : null;
2151
+ };
2152
+ module.exports = valid;
2153
+ }));
2154
+ //#endregion
2155
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js
2156
+ var require_clean$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2157
+ const parse = require_parse$1();
2158
+ const clean = (version, options) => {
2159
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
2160
+ return s ? s.version : null;
2161
+ };
2162
+ module.exports = clean;
2163
+ }));
2164
+ //#endregion
2165
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js
2166
+ var require_inc$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2167
+ const SemVer = require_semver$2();
2168
+ const inc = (version, release, options, identifier, identifierBase) => {
2169
+ if (typeof options === "string") {
2170
+ identifierBase = identifier;
2171
+ identifier = options;
2172
+ options = void 0;
2173
+ }
2174
+ try {
2175
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
2176
+ } catch (er) {
2177
+ return null;
2178
+ }
2179
+ };
2180
+ module.exports = inc;
2181
+ }));
2182
+ //#endregion
2183
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js
2184
+ var require_diff$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2185
+ const parse = require_parse$1();
2186
+ const diff = (version1, version2) => {
2187
+ const v1 = parse(version1, null, true);
2188
+ const v2 = parse(version2, null, true);
2189
+ const comparison = v1.compare(v2);
2190
+ if (comparison === 0) return null;
2191
+ const v1Higher = comparison > 0;
2192
+ const highVersion = v1Higher ? v1 : v2;
2193
+ const lowVersion = v1Higher ? v2 : v1;
2194
+ const highHasPre = !!highVersion.prerelease.length;
2195
+ if (!!lowVersion.prerelease.length && !highHasPre) {
2196
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
2197
+ if (lowVersion.compareMain(highVersion) === 0) {
2198
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
2199
+ return "patch";
2200
+ }
2201
+ }
2202
+ const prefix = highHasPre ? "pre" : "";
2203
+ if (v1.major !== v2.major) return prefix + "major";
2204
+ if (v1.minor !== v2.minor) return prefix + "minor";
2205
+ if (v1.patch !== v2.patch) return prefix + "patch";
2206
+ return "prerelease";
2207
+ };
2208
+ module.exports = diff;
2209
+ }));
2210
+ //#endregion
2211
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js
2212
+ var require_major$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2213
+ const SemVer = require_semver$2();
2214
+ const major = (a, loose) => new SemVer(a, loose).major;
2215
+ module.exports = major;
2216
+ }));
2217
+ //#endregion
2218
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js
2219
+ var require_minor$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2220
+ const SemVer = require_semver$2();
2221
+ const minor = (a, loose) => new SemVer(a, loose).minor;
2222
+ module.exports = minor;
2223
+ }));
2224
+ //#endregion
2225
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js
2226
+ var require_patch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2227
+ const SemVer = require_semver$2();
2228
+ const patch = (a, loose) => new SemVer(a, loose).patch;
2229
+ module.exports = patch;
2230
+ }));
2231
+ //#endregion
2232
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js
2233
+ var require_prerelease$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2234
+ const parse = require_parse$1();
2235
+ const prerelease = (version, options) => {
2236
+ const parsed = parse(version, options);
2237
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
2238
+ };
2239
+ module.exports = prerelease;
2240
+ }));
2241
+ //#endregion
2242
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js
2243
+ var require_compare$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2244
+ const SemVer = require_semver$2();
2245
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
2246
+ module.exports = compare;
2247
+ }));
2248
+ //#endregion
2249
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js
2250
+ var require_rcompare$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2251
+ const compare = require_compare$1();
2252
+ const rcompare = (a, b, loose) => compare(b, a, loose);
2253
+ module.exports = rcompare;
2254
+ }));
2255
+ //#endregion
2256
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js
2257
+ var require_compare_loose$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2258
+ const compare = require_compare$1();
2259
+ const compareLoose = (a, b) => compare(a, b, true);
2260
+ module.exports = compareLoose;
2261
+ }));
2262
+ //#endregion
2263
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js
2264
+ var require_compare_build$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2265
+ const SemVer = require_semver$2();
2266
+ const compareBuild = (a, b, loose) => {
2267
+ const versionA = new SemVer(a, loose);
2268
+ const versionB = new SemVer(b, loose);
2269
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
2270
+ };
2271
+ module.exports = compareBuild;
2272
+ }));
2273
+ //#endregion
2274
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js
2275
+ var require_sort$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2276
+ const compareBuild = require_compare_build$1();
2277
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
2278
+ module.exports = sort;
2279
+ }));
2280
+ //#endregion
2281
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js
2282
+ var require_rsort$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2283
+ const compareBuild = require_compare_build$1();
2284
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
2285
+ module.exports = rsort;
2286
+ }));
2287
+ //#endregion
2288
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js
2289
+ var require_gt$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2290
+ const compare = require_compare$1();
2291
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
2292
+ module.exports = gt;
2293
+ }));
2294
+ //#endregion
2295
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js
2296
+ var require_lt$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2297
+ const compare = require_compare$1();
2298
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
2299
+ module.exports = lt;
2300
+ }));
2301
+ //#endregion
2302
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js
2303
+ var require_eq$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2304
+ const compare = require_compare$1();
2305
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
2306
+ module.exports = eq;
2307
+ }));
2308
+ //#endregion
2309
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js
2310
+ var require_neq$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2311
+ const compare = require_compare$1();
2312
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
2313
+ module.exports = neq;
2314
+ }));
2315
+ //#endregion
2316
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js
2317
+ var require_gte$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2318
+ const compare = require_compare$1();
2319
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
2320
+ module.exports = gte;
2321
+ }));
2322
+ //#endregion
2323
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js
2324
+ var require_lte$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2325
+ const compare = require_compare$1();
2326
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
2327
+ module.exports = lte;
2328
+ }));
2329
+ //#endregion
2330
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js
2331
+ var require_cmp$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2332
+ const eq = require_eq$1();
2333
+ const neq = require_neq$1();
2334
+ const gt = require_gt$1();
2335
+ const gte = require_gte$1();
2336
+ const lt = require_lt$1();
2337
+ const lte = require_lte$1();
2338
+ const cmp = (a, op, b, loose) => {
2339
+ switch (op) {
2340
+ case "===":
2341
+ if (typeof a === "object") a = a.version;
2342
+ if (typeof b === "object") b = b.version;
2343
+ return a === b;
2344
+ case "!==":
2345
+ if (typeof a === "object") a = a.version;
2346
+ if (typeof b === "object") b = b.version;
2347
+ return a !== b;
2348
+ case "":
2349
+ case "=":
2350
+ case "==": return eq(a, b, loose);
2351
+ case "!=": return neq(a, b, loose);
2352
+ case ">": return gt(a, b, loose);
2353
+ case ">=": return gte(a, b, loose);
2354
+ case "<": return lt(a, b, loose);
2355
+ case "<=": return lte(a, b, loose);
2356
+ default: throw new TypeError(`Invalid operator: ${op}`);
2357
+ }
2358
+ };
2359
+ module.exports = cmp;
2360
+ }));
2361
+ //#endregion
2362
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js
2363
+ var require_coerce$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2364
+ const SemVer = require_semver$2();
2365
+ const parse = require_parse$1();
2366
+ const { safeRe: re, t } = require_re$1();
2367
+ const coerce = (version, options) => {
2368
+ if (version instanceof SemVer) return version;
2369
+ if (typeof version === "number") version = String(version);
2370
+ if (typeof version !== "string") return null;
2371
+ options = options || {};
2372
+ let match = null;
2373
+ if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
2374
+ else {
2375
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
2376
+ let next;
2377
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
2378
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
2379
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
2380
+ }
2381
+ coerceRtlRegex.lastIndex = -1;
2382
+ }
2383
+ if (match === null) return null;
2384
+ const major = match[2];
2385
+ return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
2386
+ };
2387
+ module.exports = coerce;
2388
+ }));
2389
+ //#endregion
2390
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js
2391
+ var require_lrucache$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2392
+ var LRUCache = class {
2393
+ constructor() {
2394
+ this.max = 1e3;
2395
+ this.map = /* @__PURE__ */ new Map();
2396
+ }
2397
+ get(key) {
2398
+ const value = this.map.get(key);
2399
+ if (value === void 0) return;
2400
+ else {
2401
+ this.map.delete(key);
2402
+ this.map.set(key, value);
2403
+ return value;
2404
+ }
2405
+ }
2406
+ delete(key) {
2407
+ return this.map.delete(key);
2408
+ }
2409
+ set(key, value) {
2410
+ if (!this.delete(key) && value !== void 0) {
2411
+ if (this.map.size >= this.max) {
2412
+ const firstKey = this.map.keys().next().value;
2413
+ this.delete(firstKey);
2414
+ }
2415
+ this.map.set(key, value);
2416
+ }
2417
+ return this;
2418
+ }
2419
+ };
2420
+ module.exports = LRUCache;
2421
+ }));
2422
+ //#endregion
2423
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js
2424
+ var require_range$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2425
+ const SPACE_CHARACTERS = /\s+/g;
2426
+ module.exports = class Range {
2427
+ constructor(range, options) {
2428
+ options = parseOptions(options);
2429
+ if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
2430
+ else return new Range(range.raw, options);
2431
+ if (range instanceof Comparator) {
2432
+ this.raw = range.value;
2433
+ this.set = [[range]];
2434
+ this.formatted = void 0;
2435
+ return this;
2436
+ }
2437
+ this.options = options;
2438
+ this.loose = !!options.loose;
2439
+ this.includePrerelease = !!options.includePrerelease;
2440
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
2441
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
2442
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
2443
+ if (this.set.length > 1) {
2444
+ const first = this.set[0];
2445
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
2446
+ if (this.set.length === 0) this.set = [first];
2447
+ else if (this.set.length > 1) {
2448
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
2449
+ this.set = [c];
2450
+ break;
2451
+ }
2452
+ }
2453
+ }
2454
+ this.formatted = void 0;
2455
+ }
2456
+ get range() {
2457
+ if (this.formatted === void 0) {
2458
+ this.formatted = "";
2459
+ for (let i = 0; i < this.set.length; i++) {
2460
+ if (i > 0) this.formatted += "||";
2461
+ const comps = this.set[i];
2462
+ for (let k = 0; k < comps.length; k++) {
2463
+ if (k > 0) this.formatted += " ";
2464
+ this.formatted += comps[k].toString().trim();
2465
+ }
2466
+ }
2467
+ }
2468
+ return this.formatted;
2469
+ }
2470
+ format() {
2471
+ return this.range;
2472
+ }
2473
+ toString() {
2474
+ return this.range;
2475
+ }
2476
+ parseRange(range) {
2477
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
2478
+ const cached = cache.get(memoKey);
2479
+ if (cached) return cached;
2480
+ const loose = this.options.loose;
2481
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
2482
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
2483
+ debug("hyphen replace", range);
2484
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
2485
+ debug("comparator trim", range);
2486
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
2487
+ debug("tilde trim", range);
2488
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
2489
+ debug("caret trim", range);
2490
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
2491
+ if (loose) rangeList = rangeList.filter((comp) => {
2492
+ debug("loose invalid filter", comp, this.options);
2493
+ return !!comp.match(re[t.COMPARATORLOOSE]);
2494
+ });
2495
+ debug("range list", rangeList);
2496
+ const rangeMap = /* @__PURE__ */ new Map();
2497
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
2498
+ for (const comp of comparators) {
2499
+ if (isNullSet(comp)) return [comp];
2500
+ rangeMap.set(comp.value, comp);
2501
+ }
2502
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
2503
+ const result = [...rangeMap.values()];
2504
+ cache.set(memoKey, result);
2505
+ return result;
2506
+ }
2507
+ intersects(range, options) {
2508
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
2509
+ return this.set.some((thisComparators) => {
2510
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
2511
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
2512
+ return rangeComparators.every((rangeComparator) => {
2513
+ return thisComparator.intersects(rangeComparator, options);
2514
+ });
2515
+ });
2516
+ });
2517
+ });
2518
+ }
2519
+ test(version) {
2520
+ if (!version) return false;
2521
+ if (typeof version === "string") try {
2522
+ version = new SemVer(version, this.options);
2523
+ } catch (er) {
2524
+ return false;
2525
+ }
2526
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
2527
+ return false;
2528
+ }
2529
+ };
2530
+ const cache = new (require_lrucache$1())();
2531
+ const parseOptions = require_parse_options$1();
2532
+ const Comparator = require_comparator$1();
2533
+ const debug = require_debug$1();
2534
+ const SemVer = require_semver$2();
2535
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re$1();
2536
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants$1();
2537
+ const isNullSet = (c) => c.value === "<0.0.0-0";
2538
+ const isAny = (c) => c.value === "";
2539
+ const isSatisfiable = (comparators, options) => {
2540
+ let result = true;
2541
+ const remainingComparators = comparators.slice();
2542
+ let testComparator = remainingComparators.pop();
2543
+ while (result && remainingComparators.length) {
2544
+ result = remainingComparators.every((otherComparator) => {
2545
+ return testComparator.intersects(otherComparator, options);
2546
+ });
2547
+ testComparator = remainingComparators.pop();
2548
+ }
2549
+ return result;
2550
+ };
2551
+ const parseComparator = (comp, options) => {
2552
+ debug("comp", comp, options);
2553
+ comp = replaceCarets(comp, options);
2554
+ debug("caret", comp);
2555
+ comp = replaceTildes(comp, options);
2556
+ debug("tildes", comp);
2557
+ comp = replaceXRanges(comp, options);
2558
+ debug("xrange", comp);
2559
+ comp = replaceStars(comp, options);
2560
+ debug("stars", comp);
2561
+ return comp;
2562
+ };
2563
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
2564
+ const replaceTildes = (comp, options) => {
2565
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
2566
+ };
2567
+ const replaceTilde = (comp, options) => {
2568
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
2569
+ return comp.replace(r, (_, M, m, p, pr) => {
2570
+ debug("tilde", comp, _, M, m, p, pr);
2571
+ let ret;
2572
+ if (isX(M)) ret = "";
2573
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
2574
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
2575
+ else if (pr) {
2576
+ debug("replaceTilde pr", pr);
2577
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
2578
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
2579
+ debug("tilde return", ret);
2580
+ return ret;
2581
+ });
2582
+ };
2583
+ const replaceCarets = (comp, options) => {
2584
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
2585
+ };
2586
+ const replaceCaret = (comp, options) => {
2587
+ debug("caret", comp, options);
2588
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
2589
+ const z = options.includePrerelease ? "-0" : "";
2590
+ return comp.replace(r, (_, M, m, p, pr) => {
2591
+ debug("caret", comp, _, M, m, p, pr);
2592
+ let ret;
2593
+ if (isX(M)) ret = "";
2594
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
2595
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
2596
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
2597
+ else if (pr) {
2598
+ debug("replaceCaret pr", pr);
2599
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
2600
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
2601
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
2602
+ } else {
2603
+ debug("no pr");
2604
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
2605
+ else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
2606
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
2607
+ }
2608
+ debug("caret return", ret);
2609
+ return ret;
2610
+ });
2611
+ };
2612
+ const replaceXRanges = (comp, options) => {
2613
+ debug("replaceXRanges", comp, options);
2614
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
2615
+ };
2616
+ const replaceXRange = (comp, options) => {
2617
+ comp = comp.trim();
2618
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
2619
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
2620
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
2621
+ const xM = isX(M);
2622
+ const xm = xM || isX(m);
2623
+ const xp = xm || isX(p);
2624
+ const anyX = xp;
2625
+ if (gtlt === "=" && anyX) gtlt = "";
2626
+ pr = options.includePrerelease ? "-0" : "";
2627
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
2628
+ else ret = "*";
2629
+ else if (gtlt && anyX) {
2630
+ if (xm) m = 0;
2631
+ p = 0;
2632
+ if (gtlt === ">") {
2633
+ gtlt = ">=";
2634
+ if (xm) {
2635
+ M = +M + 1;
2636
+ m = 0;
2637
+ p = 0;
2638
+ } else {
2639
+ m = +m + 1;
2640
+ p = 0;
2641
+ }
2642
+ } else if (gtlt === "<=") {
2643
+ gtlt = "<";
2644
+ if (xm) M = +M + 1;
2645
+ else m = +m + 1;
2646
+ }
2647
+ if (gtlt === "<") pr = "-0";
2648
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
2649
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
2650
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
2651
+ debug("xRange return", ret);
2652
+ return ret;
2653
+ });
2654
+ };
2655
+ const replaceStars = (comp, options) => {
2656
+ debug("replaceStars", comp, options);
2657
+ return comp.trim().replace(re[t.STAR], "");
2658
+ };
2659
+ const replaceGTE0 = (comp, options) => {
2660
+ debug("replaceGTE0", comp, options);
2661
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
2662
+ };
2663
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
2664
+ if (isX(fM)) from = "";
2665
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
2666
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
2667
+ else if (fpr) from = `>=${from}`;
2668
+ else from = `>=${from}${incPr ? "-0" : ""}`;
2669
+ if (isX(tM)) to = "";
2670
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
2671
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
2672
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
2673
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
2674
+ else to = `<=${to}`;
2675
+ return `${from} ${to}`.trim();
2676
+ };
2677
+ const testSet = (set, version, options) => {
2678
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
2679
+ if (version.prerelease.length && !options.includePrerelease) {
2680
+ for (let i = 0; i < set.length; i++) {
2681
+ debug(set[i].semver);
2682
+ if (set[i].semver === Comparator.ANY) continue;
2683
+ if (set[i].semver.prerelease.length > 0) {
2684
+ const allowed = set[i].semver;
2685
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
2686
+ }
2687
+ }
2688
+ return false;
2689
+ }
2690
+ return true;
2691
+ };
2692
+ }));
2693
+ //#endregion
2694
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js
2695
+ var require_comparator$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2696
+ const ANY = Symbol("SemVer ANY");
2697
+ module.exports = class Comparator {
2698
+ static get ANY() {
2699
+ return ANY;
2700
+ }
2701
+ constructor(comp, options) {
2702
+ options = parseOptions(options);
2703
+ if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
2704
+ else comp = comp.value;
2705
+ comp = comp.trim().split(/\s+/).join(" ");
2706
+ debug("comparator", comp, options);
2707
+ this.options = options;
2708
+ this.loose = !!options.loose;
2709
+ this.parse(comp);
2710
+ if (this.semver === ANY) this.value = "";
2711
+ else this.value = this.operator + this.semver.version;
2712
+ debug("comp", this);
2713
+ }
2714
+ parse(comp) {
2715
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
2716
+ const m = comp.match(r);
2717
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
2718
+ this.operator = m[1] !== void 0 ? m[1] : "";
2719
+ if (this.operator === "=") this.operator = "";
2720
+ if (!m[2]) this.semver = ANY;
2721
+ else this.semver = new SemVer(m[2], this.options.loose);
2722
+ }
2723
+ toString() {
2724
+ return this.value;
2725
+ }
2726
+ test(version) {
2727
+ debug("Comparator.test", version, this.options.loose);
2728
+ if (this.semver === ANY || version === ANY) return true;
2729
+ if (typeof version === "string") try {
2730
+ version = new SemVer(version, this.options);
2731
+ } catch (er) {
2732
+ return false;
2733
+ }
2734
+ return cmp(version, this.operator, this.semver, this.options);
2735
+ }
2736
+ intersects(comp, options) {
2737
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
2738
+ if (this.operator === "") {
2739
+ if (this.value === "") return true;
2740
+ return new Range(comp.value, options).test(this.value);
2741
+ } else if (comp.operator === "") {
2742
+ if (comp.value === "") return true;
2743
+ return new Range(this.value, options).test(comp.semver);
2744
+ }
2745
+ options = parseOptions(options);
2746
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
2747
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
2748
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
2749
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
2750
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
2751
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
2752
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
2753
+ return false;
2754
+ }
2755
+ };
2756
+ const parseOptions = require_parse_options$1();
2757
+ const { safeRe: re, t } = require_re$1();
2758
+ const cmp = require_cmp$1();
2759
+ const debug = require_debug$1();
2760
+ const SemVer = require_semver$2();
2761
+ const Range = require_range$1();
2762
+ }));
2763
+ //#endregion
2764
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js
2765
+ var require_satisfies$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2766
+ const Range = require_range$1();
2767
+ const satisfies = (version, range, options) => {
2768
+ try {
2769
+ range = new Range(range, options);
2770
+ } catch (er) {
2771
+ return false;
2772
+ }
2773
+ return range.test(version);
2774
+ };
2775
+ module.exports = satisfies;
2776
+ }));
2777
+ //#endregion
2778
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js
2779
+ var require_to_comparators$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2780
+ const Range = require_range$1();
2781
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
2782
+ module.exports = toComparators;
2783
+ }));
2784
+ //#endregion
2785
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js
2786
+ var require_max_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2787
+ const SemVer = require_semver$2();
2788
+ const Range = require_range$1();
2789
+ const maxSatisfying = (versions, range, options) => {
2790
+ let max = null;
2791
+ let maxSV = null;
2792
+ let rangeObj = null;
2793
+ try {
2794
+ rangeObj = new Range(range, options);
2795
+ } catch (er) {
2796
+ return null;
2797
+ }
2798
+ versions.forEach((v) => {
2799
+ if (rangeObj.test(v)) {
2800
+ if (!max || maxSV.compare(v) === -1) {
2801
+ max = v;
2802
+ maxSV = new SemVer(max, options);
2803
+ }
2804
+ }
2805
+ });
2806
+ return max;
2807
+ };
2808
+ module.exports = maxSatisfying;
2809
+ }));
2810
+ //#endregion
2811
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js
2812
+ var require_min_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2813
+ const SemVer = require_semver$2();
2814
+ const Range = require_range$1();
2815
+ const minSatisfying = (versions, range, options) => {
2816
+ let min = null;
2817
+ let minSV = null;
2818
+ let rangeObj = null;
2819
+ try {
2820
+ rangeObj = new Range(range, options);
2821
+ } catch (er) {
2822
+ return null;
2823
+ }
2824
+ versions.forEach((v) => {
2825
+ if (rangeObj.test(v)) {
2826
+ if (!min || minSV.compare(v) === 1) {
2827
+ min = v;
2828
+ minSV = new SemVer(min, options);
2829
+ }
2830
+ }
2831
+ });
2832
+ return min;
2833
+ };
2834
+ module.exports = minSatisfying;
2835
+ }));
2836
+ //#endregion
2837
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js
2838
+ var require_min_version$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2839
+ const SemVer = require_semver$2();
2840
+ const Range = require_range$1();
2841
+ const gt = require_gt$1();
2842
+ const minVersion = (range, loose) => {
2843
+ range = new Range(range, loose);
2844
+ let minver = new SemVer("0.0.0");
2845
+ if (range.test(minver)) return minver;
2846
+ minver = new SemVer("0.0.0-0");
2847
+ if (range.test(minver)) return minver;
2848
+ minver = null;
2849
+ for (let i = 0; i < range.set.length; ++i) {
2850
+ const comparators = range.set[i];
2851
+ let setMin = null;
2852
+ comparators.forEach((comparator) => {
2853
+ const compver = new SemVer(comparator.semver.version);
2854
+ switch (comparator.operator) {
2855
+ case ">":
2856
+ if (compver.prerelease.length === 0) compver.patch++;
2857
+ else compver.prerelease.push(0);
2858
+ compver.raw = compver.format();
2859
+ case "":
2860
+ case ">=":
2861
+ if (!setMin || gt(compver, setMin)) setMin = compver;
2862
+ break;
2863
+ case "<":
2864
+ case "<=": break;
2865
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
2866
+ }
2867
+ });
2868
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
2869
+ }
2870
+ if (minver && range.test(minver)) return minver;
2871
+ return null;
2872
+ };
2873
+ module.exports = minVersion;
2874
+ }));
2875
+ //#endregion
2876
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js
2877
+ var require_valid$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2878
+ const Range = require_range$1();
2879
+ const validRange = (range, options) => {
2880
+ try {
2881
+ return new Range(range, options).range || "*";
2882
+ } catch (er) {
2883
+ return null;
2884
+ }
2885
+ };
2886
+ module.exports = validRange;
2887
+ }));
2888
+ //#endregion
2889
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js
2890
+ var require_outside$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2891
+ const SemVer = require_semver$2();
2892
+ const Comparator = require_comparator$1();
2893
+ const { ANY } = Comparator;
2894
+ const Range = require_range$1();
2895
+ const satisfies = require_satisfies$1();
2896
+ const gt = require_gt$1();
2897
+ const lt = require_lt$1();
2898
+ const lte = require_lte$1();
2899
+ const gte = require_gte$1();
2900
+ const outside = (version, range, hilo, options) => {
2901
+ version = new SemVer(version, options);
2902
+ range = new Range(range, options);
2903
+ let gtfn, ltefn, ltfn, comp, ecomp;
2904
+ switch (hilo) {
2905
+ case ">":
2906
+ gtfn = gt;
2907
+ ltefn = lte;
2908
+ ltfn = lt;
2909
+ comp = ">";
2910
+ ecomp = ">=";
2911
+ break;
2912
+ case "<":
2913
+ gtfn = lt;
2914
+ ltefn = gte;
2915
+ ltfn = gt;
2916
+ comp = "<";
2917
+ ecomp = "<=";
2918
+ break;
2919
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
2920
+ }
2921
+ if (satisfies(version, range, options)) return false;
2922
+ for (let i = 0; i < range.set.length; ++i) {
2923
+ const comparators = range.set[i];
2924
+ let high = null;
2925
+ let low = null;
2926
+ comparators.forEach((comparator) => {
2927
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
2928
+ high = high || comparator;
2929
+ low = low || comparator;
2930
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
2931
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
2932
+ });
2933
+ if (high.operator === comp || high.operator === ecomp) return false;
2934
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
2935
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
2936
+ }
2937
+ return true;
2938
+ };
2939
+ module.exports = outside;
2940
+ }));
2941
+ //#endregion
2942
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js
2943
+ var require_gtr$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2944
+ const outside = require_outside$1();
2945
+ const gtr = (version, range, options) => outside(version, range, ">", options);
2946
+ module.exports = gtr;
2947
+ }));
2948
+ //#endregion
2949
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js
2950
+ var require_ltr$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2951
+ const outside = require_outside$1();
2952
+ const ltr = (version, range, options) => outside(version, range, "<", options);
2953
+ module.exports = ltr;
2954
+ }));
2955
+ //#endregion
2956
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js
2957
+ var require_intersects$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2958
+ const Range = require_range$1();
2959
+ const intersects = (r1, r2, options) => {
2960
+ r1 = new Range(r1, options);
2961
+ r2 = new Range(r2, options);
2962
+ return r1.intersects(r2, options);
2963
+ };
2964
+ module.exports = intersects;
2965
+ }));
2966
+ //#endregion
2967
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js
2968
+ var require_simplify$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2969
+ const satisfies = require_satisfies$1();
2970
+ const compare = require_compare$1();
2971
+ module.exports = (versions, range, options) => {
2972
+ const set = [];
2973
+ let first = null;
2974
+ let prev = null;
2975
+ const v = versions.sort((a, b) => compare(a, b, options));
2976
+ for (const version of v) if (satisfies(version, range, options)) {
2977
+ prev = version;
2978
+ if (!first) first = version;
2979
+ } else {
2980
+ if (prev) set.push([first, prev]);
2981
+ prev = null;
2982
+ first = null;
2983
+ }
2984
+ if (first) set.push([first, null]);
2985
+ const ranges = [];
2986
+ for (const [min, max] of set) if (min === max) ranges.push(min);
2987
+ else if (!max && min === v[0]) ranges.push("*");
2988
+ else if (!max) ranges.push(`>=${min}`);
2989
+ else if (min === v[0]) ranges.push(`<=${max}`);
2990
+ else ranges.push(`${min} - ${max}`);
2991
+ const simplified = ranges.join(" || ");
2992
+ const original = typeof range.raw === "string" ? range.raw : String(range);
2993
+ return simplified.length < original.length ? simplified : range;
2994
+ };
2995
+ }));
2996
+ //#endregion
2997
+ //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js
2998
+ var require_subset$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2999
+ const Range = require_range$1();
3000
+ const Comparator = require_comparator$1();
3001
+ const { ANY } = Comparator;
3002
+ const satisfies = require_satisfies$1();
3003
+ const compare = require_compare$1();
3004
+ const subset = (sub, dom, options = {}) => {
3005
+ if (sub === dom) return true;
3006
+ sub = new Range(sub, options);
3007
+ dom = new Range(dom, options);
3008
+ let sawNonNull = false;
3009
+ OUTER: for (const simpleSub of sub.set) {
3010
+ for (const simpleDom of dom.set) {
3011
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
3012
+ sawNonNull = sawNonNull || isSub !== null;
3013
+ if (isSub) continue OUTER;
3014
+ }
3015
+ if (sawNonNull) return false;
3016
+ }
3017
+ return true;
3018
+ };
3019
+ const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
3020
+ const minimumVersion = [new Comparator(">=0.0.0")];
3021
+ const simpleSubset = (sub, dom, options) => {
3022
+ if (sub === dom) return true;
3023
+ if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
3024
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
3025
+ else sub = minimumVersion;
3026
+ if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
3027
+ else dom = minimumVersion;
3028
+ const eqSet = /* @__PURE__ */ new Set();
3029
+ let gt, lt;
3030
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
3031
+ else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
3032
+ else eqSet.add(c.semver);
3033
+ if (eqSet.size > 1) return null;
3034
+ let gtltComp;
3035
+ if (gt && lt) {
3036
+ gtltComp = compare(gt.semver, lt.semver, options);
3037
+ if (gtltComp > 0) return null;
3038
+ else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
3039
+ }
3040
+ for (const eq of eqSet) {
3041
+ if (gt && !satisfies(eq, String(gt), options)) return null;
3042
+ if (lt && !satisfies(eq, String(lt), options)) return null;
3043
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
3044
+ return true;
3045
+ }
3046
+ let higher, lower;
3047
+ let hasDomLT, hasDomGT;
3048
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
3049
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
3050
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
3051
+ for (const c of dom) {
3052
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
3053
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
3054
+ if (gt) {
3055
+ if (needDomGTPre) {
3056
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
3057
+ }
3058
+ if (c.operator === ">" || c.operator === ">=") {
3059
+ higher = higherGT(gt, c, options);
3060
+ if (higher === c && higher !== gt) return false;
3061
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
3062
+ }
3063
+ if (lt) {
3064
+ if (needDomLTPre) {
3065
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
3066
+ }
3067
+ if (c.operator === "<" || c.operator === "<=") {
3068
+ lower = lowerLT(lt, c, options);
3069
+ if (lower === c && lower !== lt) return false;
3070
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
3071
+ }
3072
+ if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
3073
+ }
3074
+ if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
3075
+ if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
3076
+ if (needDomGTPre || needDomLTPre) return false;
3077
+ return true;
3078
+ };
3079
+ const higherGT = (a, b, options) => {
3080
+ if (!a) return b;
3081
+ const comp = compare(a.semver, b.semver, options);
3082
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
3083
+ };
3084
+ const lowerLT = (a, b, options) => {
3085
+ if (!a) return b;
3086
+ const comp = compare(a.semver, b.semver, options);
3087
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
3088
+ };
3089
+ module.exports = subset;
3090
+ }));
3091
+ //#endregion
3092
+ //#region ../plugin-core/dist/semverSatisfies.mjs
3093
+ var import_semver$1 = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3094
+ const internalRe = require_re$1();
3095
+ const constants = require_constants$1();
3096
+ const SemVer = require_semver$2();
3097
+ const identifiers = require_identifiers$1();
3098
+ module.exports = {
3099
+ parse: require_parse$1(),
3100
+ valid: require_valid$3(),
3101
+ clean: require_clean$1(),
3102
+ inc: require_inc$1(),
3103
+ diff: require_diff$1(),
3104
+ major: require_major$1(),
3105
+ minor: require_minor$1(),
3106
+ patch: require_patch$1(),
3107
+ prerelease: require_prerelease$1(),
3108
+ compare: require_compare$1(),
3109
+ rcompare: require_rcompare$1(),
3110
+ compareLoose: require_compare_loose$1(),
3111
+ compareBuild: require_compare_build$1(),
3112
+ sort: require_sort$1(),
3113
+ rsort: require_rsort$1(),
3114
+ gt: require_gt$1(),
3115
+ lt: require_lt$1(),
3116
+ eq: require_eq$1(),
3117
+ neq: require_neq$1(),
3118
+ gte: require_gte$1(),
3119
+ lte: require_lte$1(),
3120
+ cmp: require_cmp$1(),
3121
+ coerce: require_coerce$1(),
3122
+ Comparator: require_comparator$1(),
3123
+ Range: require_range$1(),
3124
+ satisfies: require_satisfies$1(),
3125
+ toComparators: require_to_comparators$1(),
3126
+ maxSatisfying: require_max_satisfying$1(),
3127
+ minSatisfying: require_min_satisfying$1(),
3128
+ minVersion: require_min_version$1(),
3129
+ validRange: require_valid$2(),
3130
+ outside: require_outside$1(),
3131
+ gtr: require_gtr$1(),
3132
+ ltr: require_ltr$1(),
3133
+ intersects: require_intersects$1(),
3134
+ simplifyRange: require_simplify$1(),
3135
+ subset: require_subset$1(),
3136
+ SemVer,
3137
+ re: internalRe.re,
3138
+ src: internalRe.src,
3139
+ tokens: internalRe.t,
3140
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
3141
+ RELEASE_TYPES: constants.RELEASE_TYPES,
3142
+ compareIdentifiers: identifiers.compareIdentifiers,
3143
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
3144
+ };
3145
+ })))(), 1);
3146
+ const semverSatisfies$1 = (targetAppVersion, currentVersion) => {
3147
+ const currentCoerce = import_semver$1.default.coerce(currentVersion);
3148
+ if (!currentCoerce) return false;
3149
+ return import_semver$1.default.satisfies(currentCoerce.version, targetAppVersion);
3150
+ };
3151
+ //#endregion
3152
+ //#region ../plugin-core/dist/filterCompatibleAppVersions.mjs
3153
+ /**
3154
+ * Filters target app versions that are compatible with the current app version.
3155
+ * Returns only versions that are compatible with the current version according to semver rules.
3156
+ *
3157
+ * @param targetAppVersionList - List of target app versions to filter
3158
+ * @param currentVersion - Current app version
3159
+ * @returns Array of target app versions compatible with the current version
3160
+ */
3161
+ const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
3162
+ return targetAppVersionList.filter((version) => semverSatisfies$1(version, currentVersion)).sort((a, b) => b.localeCompare(a));
3163
+ };
3164
+ //#endregion
3165
+ //#region ../js/dist/index.mjs
3166
+ var __create = Object.create;
3167
+ var __defProp = Object.defineProperty;
3168
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3169
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3170
+ var __getProtoOf = Object.getPrototypeOf;
3171
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3172
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3173
+ var __copyProps = (to, from, except, desc) => {
3174
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
3175
+ key = keys[i];
3176
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
3177
+ get: ((k) => from[k]).bind(null, key),
3178
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
3179
+ });
3180
+ }
3181
+ return to;
3182
+ };
3183
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
3184
+ value: mod,
3185
+ enumerable: true
3186
+ }) : target, mod));
3187
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3188
+ const SEMVER_SPEC_VERSION = "2.0.0";
3189
+ const MAX_LENGTH = 256;
3190
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
3191
+ module.exports = {
3192
+ MAX_LENGTH,
3193
+ MAX_SAFE_COMPONENT_LENGTH: 16,
3194
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
3195
+ MAX_SAFE_INTEGER,
3196
+ RELEASE_TYPES: [
3197
+ "major",
3198
+ "premajor",
3199
+ "minor",
3200
+ "preminor",
3201
+ "patch",
3202
+ "prepatch",
3203
+ "prerelease"
3204
+ ],
3205
+ SEMVER_SPEC_VERSION,
3206
+ FLAG_INCLUDE_PRERELEASE: 1,
3207
+ FLAG_LOOSE: 2
3208
+ };
3209
+ }));
3210
+ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3211
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
3212
+ }));
3213
+ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3214
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
3215
+ const debug = require_debug();
3216
+ exports = module.exports = {};
3217
+ const re = exports.re = [];
3218
+ const safeRe = exports.safeRe = [];
3219
+ const src = exports.src = [];
3220
+ const safeSrc = exports.safeSrc = [];
3221
+ const t = exports.t = {};
3222
+ let R = 0;
3223
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
3224
+ const safeRegexReplacements = [
3225
+ ["\\s", 1],
3226
+ ["\\d", MAX_LENGTH],
3227
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
3228
+ ];
3229
+ const makeSafeRegex = (value) => {
3230
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
3231
+ return value;
3232
+ };
3233
+ const createToken = (name, value, isGlobal) => {
3234
+ const safe = makeSafeRegex(value);
3235
+ const index = R++;
3236
+ debug(name, index, value);
3237
+ t[name] = index;
3238
+ src[index] = value;
3239
+ safeSrc[index] = safe;
3240
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
3241
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
3242
+ };
3243
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
3244
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
3245
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
3246
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
3247
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
3248
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
3249
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
3250
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
3251
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
3252
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
3253
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
3254
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
3255
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
3256
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
3257
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
3258
+ createToken("GTLT", "((?:<|>)?=?)");
3259
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
3260
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
3261
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
3262
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
3263
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
3264
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
3265
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
3266
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
3267
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
3268
+ createToken("COERCERTL", src[t.COERCE], true);
3269
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
3270
+ createToken("LONETILDE", "(?:~>?)");
3271
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
3272
+ exports.tildeTrimReplace = "$1~";
3273
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
3274
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
3275
+ createToken("LONECARET", "(?:\\^)");
3276
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
3277
+ exports.caretTrimReplace = "$1^";
3278
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
3279
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
3280
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
3281
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
3282
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
3283
+ exports.comparatorTrimReplace = "$1$2$3";
3284
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
3285
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
3286
+ createToken("STAR", "(<|>)?=?\\s*\\*");
3287
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
3288
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
3289
+ }));
3290
+ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3291
+ const looseOption = Object.freeze({ loose: true });
3292
+ const emptyOpts = Object.freeze({});
3293
+ const parseOptions = (options) => {
3294
+ if (!options) return emptyOpts;
3295
+ if (typeof options !== "object") return looseOption;
3296
+ return options;
3297
+ };
3298
+ module.exports = parseOptions;
3299
+ }));
3300
+ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3301
+ const numeric = /^[0-9]+$/;
3302
+ const compareIdentifiers = (a, b) => {
3303
+ const anum = numeric.test(a);
3304
+ const bnum = numeric.test(b);
3305
+ if (anum && bnum) {
3306
+ a = +a;
3307
+ b = +b;
3308
+ }
3309
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
3310
+ };
3311
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
3312
+ module.exports = {
3313
+ compareIdentifiers,
3314
+ rcompareIdentifiers
3315
+ };
3316
+ }));
3317
+ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3318
+ const debug = require_debug();
3319
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
3320
+ const { safeRe: re, t } = require_re();
3321
+ const parseOptions = require_parse_options();
3322
+ const { compareIdentifiers } = require_identifiers();
3323
+ module.exports = class SemVer {
3324
+ constructor(version, options) {
3325
+ options = parseOptions(options);
3326
+ if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
3327
+ else version = version.version;
3328
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
3329
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
3330
+ debug("SemVer", version, options);
3331
+ this.options = options;
3332
+ this.loose = !!options.loose;
3333
+ this.includePrerelease = !!options.includePrerelease;
3334
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
3335
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
3336
+ this.raw = version;
3337
+ this.major = +m[1];
3338
+ this.minor = +m[2];
3339
+ this.patch = +m[3];
3340
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
3341
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
3342
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
3343
+ if (!m[4]) this.prerelease = [];
3344
+ else this.prerelease = m[4].split(".").map((id) => {
3345
+ if (/^[0-9]+$/.test(id)) {
3346
+ const num = +id;
3347
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
3348
+ }
3349
+ return id;
3350
+ });
3351
+ this.build = m[5] ? m[5].split(".") : [];
3352
+ this.format();
3353
+ }
3354
+ format() {
3355
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
3356
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
3357
+ return this.version;
3358
+ }
3359
+ toString() {
3360
+ return this.version;
3361
+ }
3362
+ compare(other) {
3363
+ debug("SemVer.compare", this.version, this.options, other);
3364
+ if (!(other instanceof SemVer)) {
3365
+ if (typeof other === "string" && other === this.version) return 0;
3366
+ other = new SemVer(other, this.options);
3367
+ }
3368
+ if (other.version === this.version) return 0;
3369
+ return this.compareMain(other) || this.comparePre(other);
3370
+ }
3371
+ compareMain(other) {
3372
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3373
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
3374
+ }
3375
+ comparePre(other) {
3376
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3377
+ if (this.prerelease.length && !other.prerelease.length) return -1;
3378
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
3379
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
3380
+ let i = 0;
3381
+ do {
3382
+ const a = this.prerelease[i];
3383
+ const b = other.prerelease[i];
3384
+ debug("prerelease compare", i, a, b);
3385
+ if (a === void 0 && b === void 0) return 0;
3386
+ else if (b === void 0) return 1;
3387
+ else if (a === void 0) return -1;
3388
+ else if (a === b) continue;
3389
+ else return compareIdentifiers(a, b);
3390
+ } while (++i);
3391
+ }
3392
+ compareBuild(other) {
3393
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3394
+ let i = 0;
3395
+ do {
3396
+ const a = this.build[i];
3397
+ const b = other.build[i];
3398
+ debug("build compare", i, a, b);
3399
+ if (a === void 0 && b === void 0) return 0;
3400
+ else if (b === void 0) return 1;
3401
+ else if (a === void 0) return -1;
3402
+ else if (a === b) continue;
3403
+ else return compareIdentifiers(a, b);
3404
+ } while (++i);
3405
+ }
3406
+ inc(release, identifier, identifierBase) {
3407
+ if (release.startsWith("pre")) {
3408
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
3409
+ if (identifier) {
3410
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
3411
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
3412
+ }
3413
+ }
3414
+ switch (release) {
3415
+ case "premajor":
3416
+ this.prerelease.length = 0;
3417
+ this.patch = 0;
3418
+ this.minor = 0;
3419
+ this.major++;
3420
+ this.inc("pre", identifier, identifierBase);
3421
+ break;
3422
+ case "preminor":
3423
+ this.prerelease.length = 0;
3424
+ this.patch = 0;
3425
+ this.minor++;
3426
+ this.inc("pre", identifier, identifierBase);
3427
+ break;
3428
+ case "prepatch":
3429
+ this.prerelease.length = 0;
3430
+ this.inc("patch", identifier, identifierBase);
3431
+ this.inc("pre", identifier, identifierBase);
3432
+ break;
3433
+ case "prerelease":
3434
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
3435
+ this.inc("pre", identifier, identifierBase);
3436
+ break;
3437
+ case "release":
3438
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
3439
+ this.prerelease.length = 0;
3440
+ break;
3441
+ case "major":
3442
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
3443
+ this.minor = 0;
3444
+ this.patch = 0;
3445
+ this.prerelease = [];
3446
+ break;
3447
+ case "minor":
3448
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
3449
+ this.patch = 0;
3450
+ this.prerelease = [];
3451
+ break;
3452
+ case "patch":
3453
+ if (this.prerelease.length === 0) this.patch++;
3454
+ this.prerelease = [];
3455
+ break;
3456
+ case "pre": {
3457
+ const base = Number(identifierBase) ? 1 : 0;
3458
+ if (this.prerelease.length === 0) this.prerelease = [base];
3459
+ else {
3460
+ let i = this.prerelease.length;
3461
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
3462
+ this.prerelease[i]++;
3463
+ i = -2;
3464
+ }
3465
+ if (i === -1) {
3466
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
3467
+ this.prerelease.push(base);
3468
+ }
3469
+ }
3470
+ if (identifier) {
3471
+ let prerelease = [identifier, base];
3472
+ if (identifierBase === false) prerelease = [identifier];
3473
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
3474
+ if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
3475
+ } else this.prerelease = prerelease;
3476
+ }
3477
+ break;
3478
+ }
3479
+ default: throw new Error(`invalid increment argument: ${release}`);
3480
+ }
3481
+ this.raw = this.format();
3482
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
3483
+ return this;
3484
+ }
3485
+ };
3486
+ }));
3487
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3488
+ const SemVer = require_semver$1();
3489
+ const parse = (version, options, throwErrors = false) => {
3490
+ if (version instanceof SemVer) return version;
3491
+ try {
3492
+ return new SemVer(version, options);
3493
+ } catch (er) {
3494
+ if (!throwErrors) return null;
3495
+ throw er;
3496
+ }
3497
+ };
3498
+ module.exports = parse;
3499
+ }));
3500
+ var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3501
+ const parse = require_parse();
3502
+ const valid = (version, options) => {
3503
+ const v = parse(version, options);
3504
+ return v ? v.version : null;
3505
+ };
3506
+ module.exports = valid;
3507
+ }));
3508
+ var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3509
+ const parse = require_parse();
3510
+ const clean = (version, options) => {
3511
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
3512
+ return s ? s.version : null;
3513
+ };
3514
+ module.exports = clean;
3515
+ }));
3516
+ var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3517
+ const SemVer = require_semver$1();
3518
+ const inc = (version, release, options, identifier, identifierBase) => {
3519
+ if (typeof options === "string") {
3520
+ identifierBase = identifier;
3521
+ identifier = options;
3522
+ options = void 0;
3523
+ }
3524
+ try {
3525
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
3526
+ } catch (er) {
3527
+ return null;
3528
+ }
3529
+ };
3530
+ module.exports = inc;
3531
+ }));
3532
+ var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3533
+ const parse = require_parse();
3534
+ const diff = (version1, version2) => {
3535
+ const v1 = parse(version1, null, true);
3536
+ const v2 = parse(version2, null, true);
3537
+ const comparison = v1.compare(v2);
3538
+ if (comparison === 0) return null;
3539
+ const v1Higher = comparison > 0;
3540
+ const highVersion = v1Higher ? v1 : v2;
3541
+ const lowVersion = v1Higher ? v2 : v1;
3542
+ const highHasPre = !!highVersion.prerelease.length;
3543
+ if (!!lowVersion.prerelease.length && !highHasPre) {
3544
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
3545
+ if (lowVersion.compareMain(highVersion) === 0) {
3546
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
3547
+ return "patch";
3548
+ }
3549
+ }
3550
+ const prefix = highHasPre ? "pre" : "";
3551
+ if (v1.major !== v2.major) return prefix + "major";
3552
+ if (v1.minor !== v2.minor) return prefix + "minor";
3553
+ if (v1.patch !== v2.patch) return prefix + "patch";
3554
+ return "prerelease";
3555
+ };
3556
+ module.exports = diff;
3557
+ }));
3558
+ var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3559
+ const SemVer = require_semver$1();
3560
+ const major = (a, loose) => new SemVer(a, loose).major;
3561
+ module.exports = major;
3562
+ }));
3563
+ var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3564
+ const SemVer = require_semver$1();
3565
+ const minor = (a, loose) => new SemVer(a, loose).minor;
3566
+ module.exports = minor;
3567
+ }));
3568
+ var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3569
+ const SemVer = require_semver$1();
3570
+ const patch = (a, loose) => new SemVer(a, loose).patch;
3571
+ module.exports = patch;
3572
+ }));
3573
+ var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3574
+ const parse = require_parse();
3575
+ const prerelease = (version, options) => {
3576
+ const parsed = parse(version, options);
3577
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
3578
+ };
3579
+ module.exports = prerelease;
3580
+ }));
3581
+ var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3582
+ const SemVer = require_semver$1();
3583
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
3584
+ module.exports = compare;
3585
+ }));
3586
+ var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3587
+ const compare = require_compare();
3588
+ const rcompare = (a, b, loose) => compare(b, a, loose);
3589
+ module.exports = rcompare;
3590
+ }));
3591
+ var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3592
+ const compare = require_compare();
3593
+ const compareLoose = (a, b) => compare(a, b, true);
3594
+ module.exports = compareLoose;
3595
+ }));
3596
+ var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3597
+ const SemVer = require_semver$1();
3598
+ const compareBuild = (a, b, loose) => {
3599
+ const versionA = new SemVer(a, loose);
3600
+ const versionB = new SemVer(b, loose);
3601
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
3602
+ };
3603
+ module.exports = compareBuild;
3604
+ }));
3605
+ var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3606
+ const compareBuild = require_compare_build();
3607
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
3608
+ module.exports = sort;
3609
+ }));
3610
+ var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3611
+ const compareBuild = require_compare_build();
3612
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
3613
+ module.exports = rsort;
3614
+ }));
3615
+ var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3616
+ const compare = require_compare();
3617
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
3618
+ module.exports = gt;
3619
+ }));
3620
+ var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3621
+ const compare = require_compare();
3622
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
3623
+ module.exports = lt;
3624
+ }));
3625
+ var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3626
+ const compare = require_compare();
3627
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
3628
+ module.exports = eq;
3629
+ }));
3630
+ var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3631
+ const compare = require_compare();
3632
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
3633
+ module.exports = neq;
3634
+ }));
3635
+ var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3636
+ const compare = require_compare();
3637
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
3638
+ module.exports = gte;
3639
+ }));
3640
+ var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3641
+ const compare = require_compare();
3642
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
3643
+ module.exports = lte;
3644
+ }));
3645
+ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3646
+ const eq = require_eq();
3647
+ const neq = require_neq();
3648
+ const gt = require_gt();
3649
+ const gte = require_gte();
3650
+ const lt = require_lt();
3651
+ const lte = require_lte();
3652
+ const cmp = (a, op, b, loose) => {
3653
+ switch (op) {
3654
+ case "===":
3655
+ if (typeof a === "object") a = a.version;
3656
+ if (typeof b === "object") b = b.version;
3657
+ return a === b;
3658
+ case "!==":
3659
+ if (typeof a === "object") a = a.version;
3660
+ if (typeof b === "object") b = b.version;
3661
+ return a !== b;
3662
+ case "":
3663
+ case "=":
3664
+ case "==": return eq(a, b, loose);
3665
+ case "!=": return neq(a, b, loose);
3666
+ case ">": return gt(a, b, loose);
3667
+ case ">=": return gte(a, b, loose);
3668
+ case "<": return lt(a, b, loose);
3669
+ case "<=": return lte(a, b, loose);
3670
+ default: throw new TypeError(`Invalid operator: ${op}`);
3671
+ }
3672
+ };
3673
+ module.exports = cmp;
3674
+ }));
3675
+ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3676
+ const SemVer = require_semver$1();
3677
+ const parse = require_parse();
3678
+ const { safeRe: re, t } = require_re();
3679
+ const coerce = (version, options) => {
3680
+ if (version instanceof SemVer) return version;
3681
+ if (typeof version === "number") version = String(version);
3682
+ if (typeof version !== "string") return null;
3683
+ options = options || {};
3684
+ let match = null;
3685
+ if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
3686
+ else {
3687
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
3688
+ let next;
3689
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
3690
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
3691
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
3692
+ }
3693
+ coerceRtlRegex.lastIndex = -1;
3694
+ }
3695
+ if (match === null) return null;
3696
+ const major = match[2];
3697
+ return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
3698
+ };
3699
+ module.exports = coerce;
3700
+ }));
3701
+ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3702
+ var LRUCache = class {
3703
+ constructor() {
3704
+ this.max = 1e3;
3705
+ this.map = /* @__PURE__ */ new Map();
3706
+ }
3707
+ get(key) {
3708
+ const value = this.map.get(key);
3709
+ if (value === void 0) return;
3710
+ else {
3711
+ this.map.delete(key);
3712
+ this.map.set(key, value);
3713
+ return value;
3714
+ }
3715
+ }
3716
+ delete(key) {
3717
+ return this.map.delete(key);
3718
+ }
3719
+ set(key, value) {
3720
+ if (!this.delete(key) && value !== void 0) {
3721
+ if (this.map.size >= this.max) {
3722
+ const firstKey = this.map.keys().next().value;
3723
+ this.delete(firstKey);
3724
+ }
3725
+ this.map.set(key, value);
3726
+ }
3727
+ return this;
3728
+ }
3729
+ };
3730
+ module.exports = LRUCache;
3731
+ }));
3732
+ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3733
+ const SPACE_CHARACTERS = /\s+/g;
3734
+ module.exports = class Range {
3735
+ constructor(range, options) {
3736
+ options = parseOptions(options);
3737
+ if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
3738
+ else return new Range(range.raw, options);
3739
+ if (range instanceof Comparator) {
3740
+ this.raw = range.value;
3741
+ this.set = [[range]];
3742
+ this.formatted = void 0;
3743
+ return this;
3744
+ }
3745
+ this.options = options;
3746
+ this.loose = !!options.loose;
3747
+ this.includePrerelease = !!options.includePrerelease;
3748
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
3749
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
3750
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
3751
+ if (this.set.length > 1) {
3752
+ const first = this.set[0];
3753
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
3754
+ if (this.set.length === 0) this.set = [first];
3755
+ else if (this.set.length > 1) {
3756
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
3757
+ this.set = [c];
3758
+ break;
3759
+ }
3760
+ }
3761
+ }
3762
+ this.formatted = void 0;
3763
+ }
3764
+ get range() {
3765
+ if (this.formatted === void 0) {
3766
+ this.formatted = "";
3767
+ for (let i = 0; i < this.set.length; i++) {
3768
+ if (i > 0) this.formatted += "||";
3769
+ const comps = this.set[i];
3770
+ for (let k = 0; k < comps.length; k++) {
3771
+ if (k > 0) this.formatted += " ";
3772
+ this.formatted += comps[k].toString().trim();
3773
+ }
3774
+ }
3775
+ }
3776
+ return this.formatted;
3777
+ }
3778
+ format() {
3779
+ return this.range;
3780
+ }
3781
+ toString() {
3782
+ return this.range;
3783
+ }
3784
+ parseRange(range) {
3785
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
3786
+ const cached = cache.get(memoKey);
3787
+ if (cached) return cached;
3788
+ const loose = this.options.loose;
3789
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
3790
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
3791
+ debug("hyphen replace", range);
3792
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
3793
+ debug("comparator trim", range);
3794
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
3795
+ debug("tilde trim", range);
3796
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
3797
+ debug("caret trim", range);
3798
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
3799
+ if (loose) rangeList = rangeList.filter((comp) => {
3800
+ debug("loose invalid filter", comp, this.options);
3801
+ return !!comp.match(re[t.COMPARATORLOOSE]);
3802
+ });
3803
+ debug("range list", rangeList);
3804
+ const rangeMap = /* @__PURE__ */ new Map();
3805
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
3806
+ for (const comp of comparators) {
3807
+ if (isNullSet(comp)) return [comp];
3808
+ rangeMap.set(comp.value, comp);
3809
+ }
3810
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
3811
+ const result = [...rangeMap.values()];
3812
+ cache.set(memoKey, result);
3813
+ return result;
3814
+ }
3815
+ intersects(range, options) {
3816
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
3817
+ return this.set.some((thisComparators) => {
3818
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
3819
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
3820
+ return rangeComparators.every((rangeComparator) => {
3821
+ return thisComparator.intersects(rangeComparator, options);
3822
+ });
3823
+ });
3824
+ });
3825
+ });
3826
+ }
3827
+ test(version) {
3828
+ if (!version) return false;
3829
+ if (typeof version === "string") try {
3830
+ version = new SemVer(version, this.options);
3831
+ } catch (er) {
3832
+ return false;
3833
+ }
3834
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
3835
+ return false;
3836
+ }
3837
+ };
3838
+ const cache = new (require_lrucache())();
3839
+ const parseOptions = require_parse_options();
3840
+ const Comparator = require_comparator();
3841
+ const debug = require_debug();
3842
+ const SemVer = require_semver$1();
3843
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
3844
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
3845
+ const isNullSet = (c) => c.value === "<0.0.0-0";
3846
+ const isAny = (c) => c.value === "";
3847
+ const isSatisfiable = (comparators, options) => {
3848
+ let result = true;
3849
+ const remainingComparators = comparators.slice();
3850
+ let testComparator = remainingComparators.pop();
3851
+ while (result && remainingComparators.length) {
3852
+ result = remainingComparators.every((otherComparator) => {
3853
+ return testComparator.intersects(otherComparator, options);
3854
+ });
3855
+ testComparator = remainingComparators.pop();
3856
+ }
3857
+ return result;
3858
+ };
3859
+ const parseComparator = (comp, options) => {
3860
+ debug("comp", comp, options);
3861
+ comp = replaceCarets(comp, options);
3862
+ debug("caret", comp);
3863
+ comp = replaceTildes(comp, options);
3864
+ debug("tildes", comp);
3865
+ comp = replaceXRanges(comp, options);
3866
+ debug("xrange", comp);
3867
+ comp = replaceStars(comp, options);
3868
+ debug("stars", comp);
3869
+ return comp;
3870
+ };
3871
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
3872
+ const replaceTildes = (comp, options) => {
3873
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
3874
+ };
3875
+ const replaceTilde = (comp, options) => {
3876
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
3877
+ return comp.replace(r, (_, M, m, p, pr) => {
3878
+ debug("tilde", comp, _, M, m, p, pr);
3879
+ let ret;
3880
+ if (isX(M)) ret = "";
3881
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
3882
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
3883
+ else if (pr) {
3884
+ debug("replaceTilde pr", pr);
3885
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
3886
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
3887
+ debug("tilde return", ret);
3888
+ return ret;
3889
+ });
3890
+ };
3891
+ const replaceCarets = (comp, options) => {
3892
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
3893
+ };
3894
+ const replaceCaret = (comp, options) => {
3895
+ debug("caret", comp, options);
3896
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
3897
+ const z = options.includePrerelease ? "-0" : "";
3898
+ return comp.replace(r, (_, M, m, p, pr) => {
3899
+ debug("caret", comp, _, M, m, p, pr);
3900
+ let ret;
3901
+ if (isX(M)) ret = "";
3902
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
3903
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
3904
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
3905
+ else if (pr) {
3906
+ debug("replaceCaret pr", pr);
3907
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
3908
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
3909
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
3910
+ } else {
3911
+ debug("no pr");
3912
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
3913
+ else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
3914
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
3915
+ }
3916
+ debug("caret return", ret);
3917
+ return ret;
3918
+ });
3919
+ };
3920
+ const replaceXRanges = (comp, options) => {
3921
+ debug("replaceXRanges", comp, options);
3922
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
3923
+ };
3924
+ const replaceXRange = (comp, options) => {
3925
+ comp = comp.trim();
3926
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
3927
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
3928
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
3929
+ const xM = isX(M);
3930
+ const xm = xM || isX(m);
3931
+ const xp = xm || isX(p);
3932
+ const anyX = xp;
3933
+ if (gtlt === "=" && anyX) gtlt = "";
3934
+ pr = options.includePrerelease ? "-0" : "";
3935
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
3936
+ else ret = "*";
3937
+ else if (gtlt && anyX) {
3938
+ if (xm) m = 0;
3939
+ p = 0;
3940
+ if (gtlt === ">") {
3941
+ gtlt = ">=";
3942
+ if (xm) {
3943
+ M = +M + 1;
3944
+ m = 0;
3945
+ p = 0;
3946
+ } else {
3947
+ m = +m + 1;
3948
+ p = 0;
3949
+ }
3950
+ } else if (gtlt === "<=") {
3951
+ gtlt = "<";
3952
+ if (xm) M = +M + 1;
3953
+ else m = +m + 1;
3954
+ }
3955
+ if (gtlt === "<") pr = "-0";
3956
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
3957
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
3958
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
3959
+ debug("xRange return", ret);
3960
+ return ret;
3961
+ });
3962
+ };
3963
+ const replaceStars = (comp, options) => {
3964
+ debug("replaceStars", comp, options);
3965
+ return comp.trim().replace(re[t.STAR], "");
3966
+ };
3967
+ const replaceGTE0 = (comp, options) => {
3968
+ debug("replaceGTE0", comp, options);
3969
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
3970
+ };
3971
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
3972
+ if (isX(fM)) from = "";
3973
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
3974
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
3975
+ else if (fpr) from = `>=${from}`;
3976
+ else from = `>=${from}${incPr ? "-0" : ""}`;
3977
+ if (isX(tM)) to = "";
3978
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
3979
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
3980
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
3981
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
3982
+ else to = `<=${to}`;
3983
+ return `${from} ${to}`.trim();
3984
+ };
3985
+ const testSet = (set, version, options) => {
3986
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
3987
+ if (version.prerelease.length && !options.includePrerelease) {
3988
+ for (let i = 0; i < set.length; i++) {
3989
+ debug(set[i].semver);
3990
+ if (set[i].semver === Comparator.ANY) continue;
3991
+ if (set[i].semver.prerelease.length > 0) {
3992
+ const allowed = set[i].semver;
3993
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
3994
+ }
3995
+ }
3996
+ return false;
3997
+ }
3998
+ return true;
3999
+ };
4000
+ }));
4001
+ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4002
+ const ANY = Symbol("SemVer ANY");
4003
+ module.exports = class Comparator {
4004
+ static get ANY() {
4005
+ return ANY;
4006
+ }
4007
+ constructor(comp, options) {
4008
+ options = parseOptions(options);
4009
+ if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
4010
+ else comp = comp.value;
4011
+ comp = comp.trim().split(/\s+/).join(" ");
4012
+ debug("comparator", comp, options);
4013
+ this.options = options;
4014
+ this.loose = !!options.loose;
4015
+ this.parse(comp);
4016
+ if (this.semver === ANY) this.value = "";
4017
+ else this.value = this.operator + this.semver.version;
4018
+ debug("comp", this);
4019
+ }
4020
+ parse(comp) {
4021
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
4022
+ const m = comp.match(r);
4023
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
4024
+ this.operator = m[1] !== void 0 ? m[1] : "";
4025
+ if (this.operator === "=") this.operator = "";
4026
+ if (!m[2]) this.semver = ANY;
4027
+ else this.semver = new SemVer(m[2], this.options.loose);
4028
+ }
4029
+ toString() {
4030
+ return this.value;
4031
+ }
4032
+ test(version) {
4033
+ debug("Comparator.test", version, this.options.loose);
4034
+ if (this.semver === ANY || version === ANY) return true;
4035
+ if (typeof version === "string") try {
4036
+ version = new SemVer(version, this.options);
4037
+ } catch (er) {
4038
+ return false;
4039
+ }
4040
+ return cmp(version, this.operator, this.semver, this.options);
4041
+ }
4042
+ intersects(comp, options) {
4043
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
4044
+ if (this.operator === "") {
4045
+ if (this.value === "") return true;
4046
+ return new Range(comp.value, options).test(this.value);
4047
+ } else if (comp.operator === "") {
4048
+ if (comp.value === "") return true;
4049
+ return new Range(this.value, options).test(comp.semver);
4050
+ }
4051
+ options = parseOptions(options);
4052
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
4053
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
4054
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
4055
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
4056
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
4057
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
4058
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
4059
+ return false;
4060
+ }
4061
+ };
4062
+ const parseOptions = require_parse_options();
4063
+ const { safeRe: re, t } = require_re();
4064
+ const cmp = require_cmp();
4065
+ const debug = require_debug();
4066
+ const SemVer = require_semver$1();
4067
+ const Range = require_range();
4068
+ }));
4069
+ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4070
+ const Range = require_range();
4071
+ const satisfies = (version, range, options) => {
4072
+ try {
4073
+ range = new Range(range, options);
4074
+ } catch (er) {
4075
+ return false;
4076
+ }
4077
+ return range.test(version);
4078
+ };
4079
+ module.exports = satisfies;
4080
+ }));
4081
+ var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4082
+ const Range = require_range();
4083
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
4084
+ module.exports = toComparators;
4085
+ }));
4086
+ var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4087
+ const SemVer = require_semver$1();
4088
+ const Range = require_range();
4089
+ const maxSatisfying = (versions, range, options) => {
4090
+ let max = null;
4091
+ let maxSV = null;
4092
+ let rangeObj = null;
4093
+ try {
4094
+ rangeObj = new Range(range, options);
4095
+ } catch (er) {
4096
+ return null;
4097
+ }
4098
+ versions.forEach((v) => {
4099
+ if (rangeObj.test(v)) {
4100
+ if (!max || maxSV.compare(v) === -1) {
4101
+ max = v;
4102
+ maxSV = new SemVer(max, options);
4103
+ }
4104
+ }
4105
+ });
4106
+ return max;
4107
+ };
4108
+ module.exports = maxSatisfying;
4109
+ }));
4110
+ var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4111
+ const SemVer = require_semver$1();
4112
+ const Range = require_range();
4113
+ const minSatisfying = (versions, range, options) => {
4114
+ let min = null;
4115
+ let minSV = null;
4116
+ let rangeObj = null;
4117
+ try {
4118
+ rangeObj = new Range(range, options);
4119
+ } catch (er) {
4120
+ return null;
4121
+ }
4122
+ versions.forEach((v) => {
4123
+ if (rangeObj.test(v)) {
4124
+ if (!min || minSV.compare(v) === 1) {
4125
+ min = v;
4126
+ minSV = new SemVer(min, options);
4127
+ }
4128
+ }
4129
+ });
4130
+ return min;
4131
+ };
4132
+ module.exports = minSatisfying;
4133
+ }));
4134
+ var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4135
+ const SemVer = require_semver$1();
4136
+ const Range = require_range();
4137
+ const gt = require_gt();
4138
+ const minVersion = (range, loose) => {
4139
+ range = new Range(range, loose);
4140
+ let minver = new SemVer("0.0.0");
4141
+ if (range.test(minver)) return minver;
4142
+ minver = new SemVer("0.0.0-0");
4143
+ if (range.test(minver)) return minver;
4144
+ minver = null;
4145
+ for (let i = 0; i < range.set.length; ++i) {
4146
+ const comparators = range.set[i];
4147
+ let setMin = null;
4148
+ comparators.forEach((comparator) => {
4149
+ const compver = new SemVer(comparator.semver.version);
4150
+ switch (comparator.operator) {
4151
+ case ">":
4152
+ if (compver.prerelease.length === 0) compver.patch++;
4153
+ else compver.prerelease.push(0);
4154
+ compver.raw = compver.format();
4155
+ case "":
4156
+ case ">=":
4157
+ if (!setMin || gt(compver, setMin)) setMin = compver;
4158
+ break;
4159
+ case "<":
4160
+ case "<=": break;
4161
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
4162
+ }
4163
+ });
4164
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
4165
+ }
4166
+ if (minver && range.test(minver)) return minver;
4167
+ return null;
4168
+ };
4169
+ module.exports = minVersion;
4170
+ }));
4171
+ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4172
+ const Range = require_range();
4173
+ const validRange = (range, options) => {
4174
+ try {
4175
+ return new Range(range, options).range || "*";
4176
+ } catch (er) {
4177
+ return null;
4178
+ }
4179
+ };
4180
+ module.exports = validRange;
4181
+ }));
4182
+ var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4183
+ const SemVer = require_semver$1();
4184
+ const Comparator = require_comparator();
4185
+ const { ANY } = Comparator;
4186
+ const Range = require_range();
4187
+ const satisfies = require_satisfies();
4188
+ const gt = require_gt();
4189
+ const lt = require_lt();
4190
+ const lte = require_lte();
4191
+ const gte = require_gte();
4192
+ const outside = (version, range, hilo, options) => {
4193
+ version = new SemVer(version, options);
4194
+ range = new Range(range, options);
4195
+ let gtfn, ltefn, ltfn, comp, ecomp;
4196
+ switch (hilo) {
4197
+ case ">":
4198
+ gtfn = gt;
4199
+ ltefn = lte;
4200
+ ltfn = lt;
4201
+ comp = ">";
4202
+ ecomp = ">=";
4203
+ break;
4204
+ case "<":
4205
+ gtfn = lt;
4206
+ ltefn = gte;
4207
+ ltfn = gt;
4208
+ comp = "<";
4209
+ ecomp = "<=";
4210
+ break;
4211
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
4212
+ }
4213
+ if (satisfies(version, range, options)) return false;
4214
+ for (let i = 0; i < range.set.length; ++i) {
4215
+ const comparators = range.set[i];
4216
+ let high = null;
4217
+ let low = null;
4218
+ comparators.forEach((comparator) => {
4219
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
4220
+ high = high || comparator;
4221
+ low = low || comparator;
4222
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
4223
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
4224
+ });
4225
+ if (high.operator === comp || high.operator === ecomp) return false;
4226
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
4227
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
4228
+ }
4229
+ return true;
4230
+ };
4231
+ module.exports = outside;
4232
+ }));
4233
+ var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4234
+ const outside = require_outside();
4235
+ const gtr = (version, range, options) => outside(version, range, ">", options);
4236
+ module.exports = gtr;
4237
+ }));
4238
+ var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4239
+ const outside = require_outside();
4240
+ const ltr = (version, range, options) => outside(version, range, "<", options);
4241
+ module.exports = ltr;
4242
+ }));
4243
+ var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4244
+ const Range = require_range();
4245
+ const intersects = (r1, r2, options) => {
4246
+ r1 = new Range(r1, options);
4247
+ r2 = new Range(r2, options);
4248
+ return r1.intersects(r2, options);
4249
+ };
4250
+ module.exports = intersects;
4251
+ }));
4252
+ var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4253
+ const satisfies = require_satisfies();
4254
+ const compare = require_compare();
4255
+ module.exports = (versions, range, options) => {
4256
+ const set = [];
4257
+ let first = null;
4258
+ let prev = null;
4259
+ const v = versions.sort((a, b) => compare(a, b, options));
4260
+ for (const version of v) if (satisfies(version, range, options)) {
4261
+ prev = version;
4262
+ if (!first) first = version;
4263
+ } else {
4264
+ if (prev) set.push([first, prev]);
4265
+ prev = null;
4266
+ first = null;
4267
+ }
4268
+ if (first) set.push([first, null]);
4269
+ const ranges = [];
4270
+ for (const [min, max] of set) if (min === max) ranges.push(min);
4271
+ else if (!max && min === v[0]) ranges.push("*");
4272
+ else if (!max) ranges.push(`>=${min}`);
4273
+ else if (min === v[0]) ranges.push(`<=${max}`);
4274
+ else ranges.push(`${min} - ${max}`);
4275
+ const simplified = ranges.join(" || ");
4276
+ const original = typeof range.raw === "string" ? range.raw : String(range);
4277
+ return simplified.length < original.length ? simplified : range;
4278
+ };
4279
+ }));
4280
+ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4281
+ const Range = require_range();
4282
+ const Comparator = require_comparator();
4283
+ const { ANY } = Comparator;
4284
+ const satisfies = require_satisfies();
4285
+ const compare = require_compare();
4286
+ const subset = (sub, dom, options = {}) => {
4287
+ if (sub === dom) return true;
4288
+ sub = new Range(sub, options);
4289
+ dom = new Range(dom, options);
4290
+ let sawNonNull = false;
4291
+ OUTER: for (const simpleSub of sub.set) {
4292
+ for (const simpleDom of dom.set) {
4293
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
4294
+ sawNonNull = sawNonNull || isSub !== null;
4295
+ if (isSub) continue OUTER;
4296
+ }
4297
+ if (sawNonNull) return false;
4298
+ }
4299
+ return true;
4300
+ };
4301
+ const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
4302
+ const minimumVersion = [new Comparator(">=0.0.0")];
4303
+ const simpleSubset = (sub, dom, options) => {
4304
+ if (sub === dom) return true;
4305
+ if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
4306
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
4307
+ else sub = minimumVersion;
4308
+ if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
4309
+ else dom = minimumVersion;
4310
+ const eqSet = /* @__PURE__ */ new Set();
4311
+ let gt, lt;
4312
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
4313
+ else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
4314
+ else eqSet.add(c.semver);
4315
+ if (eqSet.size > 1) return null;
4316
+ let gtltComp;
4317
+ if (gt && lt) {
4318
+ gtltComp = compare(gt.semver, lt.semver, options);
4319
+ if (gtltComp > 0) return null;
4320
+ else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
4321
+ }
4322
+ for (const eq of eqSet) {
4323
+ if (gt && !satisfies(eq, String(gt), options)) return null;
4324
+ if (lt && !satisfies(eq, String(lt), options)) return null;
4325
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
4326
+ return true;
4327
+ }
4328
+ let higher, lower;
4329
+ let hasDomLT, hasDomGT;
4330
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
4331
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
4332
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
4333
+ for (const c of dom) {
4334
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
4335
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
4336
+ if (gt) {
4337
+ if (needDomGTPre) {
4338
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
4339
+ }
4340
+ if (c.operator === ">" || c.operator === ">=") {
4341
+ higher = higherGT(gt, c, options);
4342
+ if (higher === c && higher !== gt) return false;
4343
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
4344
+ }
4345
+ if (lt) {
4346
+ if (needDomLTPre) {
4347
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
4348
+ }
4349
+ if (c.operator === "<" || c.operator === "<=") {
4350
+ lower = lowerLT(lt, c, options);
4351
+ if (lower === c && lower !== lt) return false;
4352
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
4353
+ }
4354
+ if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
4355
+ }
4356
+ if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
4357
+ if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
4358
+ if (needDomGTPre || needDomLTPre) return false;
4359
+ return true;
4360
+ };
4361
+ const higherGT = (a, b, options) => {
4362
+ if (!a) return b;
4363
+ const comp = compare(a.semver, b.semver, options);
4364
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
4365
+ };
4366
+ const lowerLT = (a, b, options) => {
4367
+ if (!a) return b;
4368
+ const comp = compare(a.semver, b.semver, options);
4369
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
4370
+ };
4371
+ module.exports = subset;
4372
+ }));
4373
+ var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4374
+ const internalRe = require_re();
4375
+ const constants = require_constants();
4376
+ const SemVer = require_semver$1();
4377
+ const identifiers = require_identifiers();
4378
+ module.exports = {
4379
+ parse: require_parse(),
4380
+ valid: require_valid$1(),
4381
+ clean: require_clean(),
4382
+ inc: require_inc(),
4383
+ diff: require_diff(),
4384
+ major: require_major(),
4385
+ minor: require_minor(),
4386
+ patch: require_patch(),
4387
+ prerelease: require_prerelease(),
4388
+ compare: require_compare(),
4389
+ rcompare: require_rcompare(),
4390
+ compareLoose: require_compare_loose(),
4391
+ compareBuild: require_compare_build(),
4392
+ sort: require_sort(),
4393
+ rsort: require_rsort(),
4394
+ gt: require_gt(),
4395
+ lt: require_lt(),
4396
+ eq: require_eq(),
4397
+ neq: require_neq(),
4398
+ gte: require_gte(),
4399
+ lte: require_lte(),
4400
+ cmp: require_cmp(),
4401
+ coerce: require_coerce(),
4402
+ Comparator: require_comparator(),
4403
+ Range: require_range(),
4404
+ satisfies: require_satisfies(),
4405
+ toComparators: require_to_comparators(),
4406
+ maxSatisfying: require_max_satisfying(),
4407
+ minSatisfying: require_min_satisfying(),
4408
+ minVersion: require_min_version(),
4409
+ validRange: require_valid(),
4410
+ outside: require_outside(),
4411
+ gtr: require_gtr(),
4412
+ ltr: require_ltr(),
4413
+ intersects: require_intersects(),
4414
+ simplifyRange: require_simplify(),
4415
+ subset: require_subset(),
4416
+ SemVer,
4417
+ re: internalRe.re,
4418
+ src: internalRe.src,
4419
+ tokens: internalRe.t,
4420
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
4421
+ RELEASE_TYPES: constants.RELEASE_TYPES,
4422
+ compareIdentifiers: identifiers.compareIdentifiers,
4423
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
4424
+ };
4425
+ })))(), 1);
4426
+ const semverSatisfies = (targetAppVersion, currentVersion) => {
4427
+ const currentCoerce = import_semver.default.coerce(currentVersion);
4428
+ if (!currentCoerce) return false;
4429
+ return import_semver.default.satisfies(currentCoerce.version, targetAppVersion);
4430
+ };
4431
+ const INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {
4432
+ message: null,
4433
+ id: NIL_UUID,
4434
+ shouldForceUpdate: true,
4435
+ status: "ROLLBACK",
4436
+ storageUri: null,
4437
+ fileHash: null
4438
+ };
4439
+ const makeResponse = (bundle, status) => ({
4440
+ id: bundle.id,
4441
+ message: bundle.message,
4442
+ shouldForceUpdate: status === "ROLLBACK" ? true : bundle.shouldForceUpdate,
4443
+ status,
4444
+ storageUri: bundle.storageUri,
4445
+ fileHash: bundle.fileHash
4446
+ });
4447
+ const isEligibleUpdateCandidate = (bundle, cohort) => {
4448
+ return isCohortEligibleForUpdate(bundle.id, cohort, bundle.rolloutCohortCount, bundle.targetCohorts);
4449
+ };
4450
+ const findLatestEligibleUpdateCandidate = (bundles, bundleId, cohort) => {
4451
+ let updateCandidate = null;
4452
+ for (const bundle of bundles) if (bundle.id.localeCompare(bundleId) > 0 && isEligibleUpdateCandidate(bundle, cohort) && (!updateCandidate || bundle.id.localeCompare(updateCandidate.id) > 0)) updateCandidate = bundle;
4453
+ return updateCandidate;
4454
+ };
4455
+ const getUpdateInfo = async (bundles, args) => {
4456
+ switch (args._updateStrategy) {
4457
+ case "appVersion": return appVersionStrategy(bundles, args);
4458
+ case "fingerprint": return fingerprintStrategy(bundles, args);
4459
+ default: return null;
4460
+ }
4461
+ };
4462
+ const appVersionStrategy = async (bundles, { channel = "production", minBundleId = NIL_UUID, platform, appVersion, bundleId, cohort }) => {
4463
+ const candidateBundles = [];
4464
+ for (const b of bundles) {
4465
+ if (b.platform !== platform || b.channel !== channel || !b.targetAppVersion || !semverSatisfies(b.targetAppVersion, appVersion) || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;
4466
+ candidateBundles.push(b);
4467
+ }
4468
+ if (candidateBundles.length === 0) {
4469
+ if (bundleId === "00000000-0000-0000-0000-000000000000" || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4470
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
4471
+ }
4472
+ let rollbackCandidate = null;
4473
+ let currentBundle;
4474
+ for (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;
4475
+ else if (bundleId !== "00000000-0000-0000-0000-000000000000" && b.id.localeCompare(bundleId) < 0) {
4476
+ if (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;
4477
+ }
4478
+ const updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);
4479
+ const currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;
4480
+ if (bundleId === "00000000-0000-0000-0000-000000000000") {
4481
+ if (updateCandidate) return makeResponse(updateCandidate, "UPDATE");
4482
+ return null;
4483
+ }
4484
+ if (currentBundleEligible) {
4485
+ if (updateCandidate) return makeResponse(updateCandidate, "UPDATE");
4486
+ return null;
4487
+ }
4488
+ if (updateCandidate) return makeResponse(updateCandidate, "UPDATE");
4489
+ if (rollbackCandidate) return makeResponse(rollbackCandidate, "ROLLBACK");
4490
+ if (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4491
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
4492
+ };
4493
+ const fingerprintStrategy = async (bundles, { channel = "production", minBundleId = NIL_UUID, platform, fingerprintHash, bundleId, cohort }) => {
4494
+ const candidateBundles = [];
4495
+ for (const b of bundles) {
4496
+ if (b.platform !== platform || b.channel !== channel || !b.fingerprintHash || b.fingerprintHash !== fingerprintHash || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;
4497
+ candidateBundles.push(b);
4498
+ }
4499
+ if (candidateBundles.length === 0) {
4500
+ if (bundleId === "00000000-0000-0000-0000-000000000000" || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4501
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
4502
+ }
4503
+ let rollbackCandidate = null;
4504
+ let currentBundle;
4505
+ for (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;
4506
+ else if (bundleId !== "00000000-0000-0000-0000-000000000000" && b.id.localeCompare(bundleId) < 0) {
4507
+ if (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;
4508
+ }
4509
+ const updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);
4510
+ const currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;
4511
+ if (bundleId === "00000000-0000-0000-0000-000000000000") {
4512
+ if (updateCandidate) return makeResponse(updateCandidate, "UPDATE");
4513
+ return null;
4514
+ }
4515
+ if (currentBundleEligible) {
4516
+ if (updateCandidate) return makeResponse(updateCandidate, "UPDATE");
4517
+ return null;
4518
+ }
4519
+ if (updateCandidate) return makeResponse(updateCandidate, "UPDATE");
4520
+ if (rollbackCandidate) return makeResponse(rollbackCandidate, "ROLLBACK");
4521
+ if (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4522
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
4523
+ };
4524
+ new TextEncoder();
4525
+ new TextDecoder();
4526
+ const day = 3600 * 24;
4527
+ day * 7;
4528
+ day * 365.25;
4529
+ //#endregion
4530
+ //#region ../plugin-core/dist/createDatabasePluginGetUpdateInfo.mjs
4531
+ const normalizeAppVersionArgs = (args) => ({
4532
+ ...args,
4533
+ channel: args.channel ?? "production",
4534
+ minBundleId: args.minBundleId ?? "00000000-0000-0000-0000-000000000000"
4535
+ });
4536
+ const normalizeFingerprintArgs = (args) => ({
4537
+ ...args,
4538
+ channel: args.channel ?? "production",
4539
+ minBundleId: args.minBundleId ?? "00000000-0000-0000-0000-000000000000"
4540
+ });
4541
+ const createDatabasePluginGetUpdateInfo = ({ getBundlesByFingerprint, getBundlesByTargetAppVersions, listTargetAppVersions }) => {
4542
+ return async (args, context) => {
4543
+ if (args._updateStrategy === "appVersion") {
4544
+ const normalizedArgs = normalizeAppVersionArgs(args);
4545
+ const compatibleAppVersions = filterCompatibleAppVersions(await listTargetAppVersions(normalizedArgs, context), normalizedArgs.appVersion);
4546
+ return getUpdateInfo(compatibleAppVersions.length > 0 ? await getBundlesByTargetAppVersions(normalizedArgs, compatibleAppVersions, context) : [], normalizedArgs);
4547
+ }
4548
+ const normalizedArgs = normalizeFingerprintArgs(args);
4549
+ return getUpdateInfo(await getBundlesByFingerprint(normalizedArgs, context), normalizedArgs);
4550
+ };
4551
+ };
4552
+ //#endregion
1586
4553
  //#region ../plugin-core/dist/createStorageKeyBuilder.mjs
1587
4554
  const createStorageKeyBuilder = (basePath) => (...args) => {
1588
4555
  return [basePath || "", ...args].filter(Boolean).join("/");
@@ -1716,6 +4683,11 @@ const applyFirestoreQueryableFilters = (query, where) => {
1716
4683
  const requiresInMemoryFiltering = (where) => {
1717
4684
  return Boolean(where?.id?.in || where?.targetAppVersionIn || where?.targetAppVersionNotNull || where?.targetAppVersion === null || where?.fingerprintHash === null);
1718
4685
  };
4686
+ const chunkValues = (values, size) => {
4687
+ const chunks = [];
4688
+ for (let index = 0; index < values.length; index += size) chunks.push(values.slice(index, index + size));
4689
+ return chunks;
4690
+ };
1719
4691
  const convertToBundle = (firestoreData) => ({
1720
4692
  channel: firestoreData.channel,
1721
4693
  enabled: Boolean(firestoreData.enabled),
@@ -1743,14 +4715,28 @@ const firebaseDatabase = createDatabasePlugin({
1743
4715
  }
1744
4716
  const db = firebase_admin.default.firestore(app);
1745
4717
  const bundlesCollection = db.collection("bundles");
4718
+ const targetAppVersionsCollection = db.collection("target_app_versions");
1746
4719
  return {
4720
+ getUpdateInfo: createDatabasePluginGetUpdateInfo({
4721
+ async listTargetAppVersions({ platform, channel }) {
4722
+ const querySnapshot = await targetAppVersionsCollection.where("platform", "==", platform).where("channel", "==", channel).select("target_app_version").get();
4723
+ return Array.from(new Set(querySnapshot.docs.map((doc) => doc.data().target_app_version).filter((version) => Boolean(version))));
4724
+ },
4725
+ async getBundlesByTargetAppVersions({ platform, channel, minBundleId }, targetAppVersions) {
4726
+ return (await Promise.all(chunkValues(targetAppVersions, 10).map((versions) => bundlesCollection.where("platform", "==", platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("target_app_version", "in", versions).get()))).flatMap((snapshot) => snapshot.docs.map((doc) => convertToBundle(doc.data())));
4727
+ },
4728
+ async getBundlesByFingerprint({ platform, channel, minBundleId, fingerprintHash }) {
4729
+ return (await bundlesCollection.where("platform", "==", platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("fingerprint_hash", "==", fingerprintHash).get()).docs.map((doc) => convertToBundle(doc.data()));
4730
+ }
4731
+ }),
1747
4732
  async getBundleById(bundleId) {
1748
4733
  const bundleSnap = await bundlesCollection.doc(bundleId).get();
1749
4734
  if (!bundleSnap.exists) return null;
1750
4735
  return convertToBundle(bundleSnap.data());
1751
4736
  },
1752
4737
  async getBundles(options) {
1753
- const { where, limit, offset, orderBy } = options;
4738
+ const { where, limit, orderBy } = options;
4739
+ const offset = ("offset" in options ? options.offset : void 0) ?? 0;
1754
4740
  let query = applyFirestoreQueryableFilters(bundlesCollection, where);
1755
4741
  query = query.orderBy("id", orderBy?.direction === "asc" ? "asc" : "desc");
1756
4742
  if (requiresInMemoryFiltering(where)) {