@hot-updater/aws 0.29.4 → 0.29.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/lambda/index.cjs +1694 -259
  2. package/package.json +8 -8
@@ -1,38 +1,38 @@
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 __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
10
- var __copyProps = (to, from, except, desc) => {
11
- 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++) {
12
12
  key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$1(to, key, {
14
14
  get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
16
16
  });
17
17
  }
18
18
  return to;
19
19
  };
20
- 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", {
21
21
  value: mod,
22
22
  enumerable: true
23
23
  }) : target, mod));
24
24
  //#endregion
25
25
  let node_path = require("node:path");
26
- node_path = __toESM(node_path);
26
+ node_path = __toESM$1(node_path);
27
27
  let node_crypto = require("node:crypto");
28
- node_crypto = __toESM(node_crypto);
28
+ node_crypto = __toESM$1(node_crypto);
29
29
  let _aws_sdk_client_cloudfront = require("@aws-sdk/client-cloudfront");
30
30
  let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
31
31
  let _aws_sdk_lib_storage = require("@aws-sdk/lib-storage");
32
32
  let fs_promises = require("fs/promises");
33
- fs_promises = __toESM(fs_promises);
33
+ fs_promises = __toESM$1(fs_promises);
34
34
  let path = require("path");
35
- path = __toESM(path);
35
+ path = __toESM$1(path);
36
36
  let _aws_sdk_s3_request_presigner = require("@aws-sdk/s3-request-presigner");
37
37
  let _aws_sdk_client_ssm = require("@aws-sdk/client-ssm");
38
38
  let _aws_sdk_cloudfront_signer = require("@aws-sdk/cloudfront-signer");
@@ -1623,7 +1623,7 @@ function createDatabasePlugin(options) {
1623
1623
  data
1624
1624
  });
1625
1625
  };
1626
- return {
1626
+ const plugin = {
1627
1627
  name: options.name,
1628
1628
  async getBundleById(bundleId, context) {
1629
1629
  if (context === void 0) return getMethods().getBundleById(bundleId);
@@ -1670,49 +1670,38 @@ function createDatabasePlugin(options) {
1670
1670
  markChanged("delete", deleteBundle);
1671
1671
  }
1672
1672
  };
1673
+ Object.defineProperty(plugin, "getUpdateInfo", {
1674
+ configurable: true,
1675
+ enumerable: true,
1676
+ get() {
1677
+ const directGetUpdateInfo = getMethods().getUpdateInfo;
1678
+ if (!directGetUpdateInfo) {
1679
+ Object.defineProperty(plugin, "getUpdateInfo", {
1680
+ configurable: true,
1681
+ enumerable: true,
1682
+ value: void 0
1683
+ });
1684
+ return;
1685
+ }
1686
+ const wrappedGetUpdateInfo = async (args, context) => {
1687
+ if (context === void 0) return directGetUpdateInfo(args);
1688
+ return directGetUpdateInfo(args, context);
1689
+ };
1690
+ Object.defineProperty(plugin, "getUpdateInfo", {
1691
+ configurable: true,
1692
+ enumerable: true,
1693
+ value: wrappedGetUpdateInfo
1694
+ });
1695
+ return wrappedGetUpdateInfo;
1696
+ }
1697
+ });
1698
+ return plugin;
1673
1699
  };
1674
1700
  };
1675
1701
  }
1676
1702
  //#endregion
1677
- //#region ../plugin-core/dist/queryBundles.mjs
1678
- const compareValue = (value, expected, comparator) => {
1679
- if (expected === void 0) return true;
1680
- switch (comparator) {
1681
- case "eq": return value === expected;
1682
- case "gt": return value.localeCompare(expected) > 0;
1683
- case "gte": return value.localeCompare(expected) >= 0;
1684
- case "lt": return value.localeCompare(expected) < 0;
1685
- case "lte": return value.localeCompare(expected) <= 0;
1686
- }
1687
- };
1688
- function bundleIdMatchesFilter(id, filter) {
1689
- if (!filter) return true;
1690
- if (filter.in && !filter.in.includes(id)) return false;
1691
- return compareValue(id, filter.eq, "eq") && compareValue(id, filter.gt, "gt") && compareValue(id, filter.gte, "gte") && compareValue(id, filter.lt, "lt") && compareValue(id, filter.lte, "lte");
1692
- }
1693
- function bundleMatchesQueryWhere$1(bundle, where) {
1694
- if (!where) return true;
1695
- if (where.channel !== void 0 && bundle.channel !== where.channel) return false;
1696
- if (where.platform !== void 0 && bundle.platform !== where.platform) return false;
1697
- if (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;
1698
- if (!bundleIdMatchesFilter(bundle.id, where.id)) return false;
1699
- if (where.targetAppVersionNotNull === true && bundle.targetAppVersion === null) return false;
1700
- if (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;
1701
- if (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? "")) return false;
1702
- if (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;
1703
- return true;
1704
- }
1705
- function sortBundles$1(bundles, orderBy) {
1706
- const direction = orderBy?.direction ?? "desc";
1707
- if (orderBy && orderBy.field !== "id") return bundles;
1708
- return bundles.slice().sort((a, b) => {
1709
- const result = a.id.localeCompare(b.id);
1710
- return direction === "asc" ? result : -result;
1711
- });
1712
- }
1713
- //#endregion
1714
1703
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
1715
- var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1704
+ var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1716
1705
  const SEMVER_SPEC_VERSION = "2.0.0";
1717
1706
  const MAX_LENGTH = 256;
1718
1707
  const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
@@ -1737,14 +1726,14 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1737
1726
  }));
1738
1727
  //#endregion
1739
1728
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js
1740
- var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1729
+ var require_debug$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1741
1730
  module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
1742
1731
  }));
1743
1732
  //#endregion
1744
1733
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js
1745
- var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1746
- const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
1747
- const debug = require_debug();
1734
+ var require_re$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1735
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants$1();
1736
+ const debug = require_debug$1();
1748
1737
  exports = module.exports = {};
1749
1738
  const re = exports.re = [];
1750
1739
  const safeRe = exports.safeRe = [];
@@ -1821,7 +1810,7 @@ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1821
1810
  }));
1822
1811
  //#endregion
1823
1812
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js
1824
- var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1813
+ var require_parse_options$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1825
1814
  const looseOption = Object.freeze({ loose: true });
1826
1815
  const emptyOpts = Object.freeze({});
1827
1816
  const parseOptions = (options) => {
@@ -1833,7 +1822,7 @@ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) =>
1833
1822
  }));
1834
1823
  //#endregion
1835
1824
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js
1836
- var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1825
+ var require_identifiers$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1837
1826
  const numeric = /^[0-9]+$/;
1838
1827
  const compareIdentifiers = (a, b) => {
1839
1828
  const anum = numeric.test(a);
@@ -1852,12 +1841,12 @@ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1852
1841
  }));
1853
1842
  //#endregion
1854
1843
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js
1855
- var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1856
- const debug = require_debug();
1857
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
1858
- const { safeRe: re, t } = require_re();
1859
- const parseOptions = require_parse_options();
1860
- const { compareIdentifiers } = require_identifiers();
1844
+ var require_semver$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1845
+ const debug = require_debug$1();
1846
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants$1();
1847
+ const { safeRe: re, t } = require_re$1();
1848
+ const parseOptions = require_parse_options$1();
1849
+ const { compareIdentifiers } = require_identifiers$1();
1861
1850
  module.exports = class SemVer {
1862
1851
  constructor(version, options) {
1863
1852
  options = parseOptions(options);
@@ -2024,8 +2013,8 @@ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2024
2013
  }));
2025
2014
  //#endregion
2026
2015
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js
2027
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2028
- const SemVer = require_semver$1();
2016
+ var require_parse$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2017
+ const SemVer = require_semver$2();
2029
2018
  const parse = (version, options, throwErrors = false) => {
2030
2019
  if (version instanceof SemVer) return version;
2031
2020
  try {
@@ -2039,8 +2028,8 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2039
2028
  }));
2040
2029
  //#endregion
2041
2030
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js
2042
- var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2043
- const parse = require_parse();
2031
+ var require_valid$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2032
+ const parse = require_parse$1();
2044
2033
  const valid = (version, options) => {
2045
2034
  const v = parse(version, options);
2046
2035
  return v ? v.version : null;
@@ -2049,8 +2038,8 @@ var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2049
2038
  }));
2050
2039
  //#endregion
2051
2040
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js
2052
- var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2053
- const parse = require_parse();
2041
+ var require_clean$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2042
+ const parse = require_parse$1();
2054
2043
  const clean = (version, options) => {
2055
2044
  const s = parse(version.trim().replace(/^[=v]+/, ""), options);
2056
2045
  return s ? s.version : null;
@@ -2059,8 +2048,8 @@ var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2059
2048
  }));
2060
2049
  //#endregion
2061
2050
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js
2062
- var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2063
- const SemVer = require_semver$1();
2051
+ var require_inc$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2052
+ const SemVer = require_semver$2();
2064
2053
  const inc = (version, release, options, identifier, identifierBase) => {
2065
2054
  if (typeof options === "string") {
2066
2055
  identifierBase = identifier;
@@ -2077,8 +2066,8 @@ var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2077
2066
  }));
2078
2067
  //#endregion
2079
2068
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js
2080
- var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2081
- const parse = require_parse();
2069
+ var require_diff$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2070
+ const parse = require_parse$1();
2082
2071
  const diff = (version1, version2) => {
2083
2072
  const v1 = parse(version1, null, true);
2084
2073
  const v2 = parse(version2, null, true);
@@ -2105,29 +2094,29 @@ var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2105
2094
  }));
2106
2095
  //#endregion
2107
2096
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js
2108
- var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2109
- const SemVer = require_semver$1();
2097
+ var require_major$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2098
+ const SemVer = require_semver$2();
2110
2099
  const major = (a, loose) => new SemVer(a, loose).major;
2111
2100
  module.exports = major;
2112
2101
  }));
2113
2102
  //#endregion
2114
2103
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js
2115
- var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2116
- const SemVer = require_semver$1();
2104
+ var require_minor$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2105
+ const SemVer = require_semver$2();
2117
2106
  const minor = (a, loose) => new SemVer(a, loose).minor;
2118
2107
  module.exports = minor;
2119
2108
  }));
2120
2109
  //#endregion
2121
2110
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js
2122
- var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2123
- const SemVer = require_semver$1();
2111
+ var require_patch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2112
+ const SemVer = require_semver$2();
2124
2113
  const patch = (a, loose) => new SemVer(a, loose).patch;
2125
2114
  module.exports = patch;
2126
2115
  }));
2127
2116
  //#endregion
2128
2117
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js
2129
- var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2130
- const parse = require_parse();
2118
+ var require_prerelease$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2119
+ const parse = require_parse$1();
2131
2120
  const prerelease = (version, options) => {
2132
2121
  const parsed = parse(version, options);
2133
2122
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
@@ -2136,29 +2125,29 @@ var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2136
2125
  }));
2137
2126
  //#endregion
2138
2127
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js
2139
- var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2140
- const SemVer = require_semver$1();
2128
+ var require_compare$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2129
+ const SemVer = require_semver$2();
2141
2130
  const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
2142
2131
  module.exports = compare;
2143
2132
  }));
2144
2133
  //#endregion
2145
2134
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js
2146
- var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2147
- const compare = require_compare();
2135
+ var require_rcompare$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2136
+ const compare = require_compare$1();
2148
2137
  const rcompare = (a, b, loose) => compare(b, a, loose);
2149
2138
  module.exports = rcompare;
2150
2139
  }));
2151
2140
  //#endregion
2152
2141
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js
2153
- var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2154
- const compare = require_compare();
2142
+ var require_compare_loose$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2143
+ const compare = require_compare$1();
2155
2144
  const compareLoose = (a, b) => compare(a, b, true);
2156
2145
  module.exports = compareLoose;
2157
2146
  }));
2158
2147
  //#endregion
2159
2148
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js
2160
- var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2161
- const SemVer = require_semver$1();
2149
+ var require_compare_build$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2150
+ const SemVer = require_semver$2();
2162
2151
  const compareBuild = (a, b, loose) => {
2163
2152
  const versionA = new SemVer(a, loose);
2164
2153
  const versionB = new SemVer(b, loose);
@@ -2168,69 +2157,69 @@ var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
2168
2157
  }));
2169
2158
  //#endregion
2170
2159
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js
2171
- var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2172
- const compareBuild = require_compare_build();
2160
+ var require_sort$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2161
+ const compareBuild = require_compare_build$1();
2173
2162
  const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
2174
2163
  module.exports = sort;
2175
2164
  }));
2176
2165
  //#endregion
2177
2166
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js
2178
- var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2179
- const compareBuild = require_compare_build();
2167
+ var require_rsort$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2168
+ const compareBuild = require_compare_build$1();
2180
2169
  const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
2181
2170
  module.exports = rsort;
2182
2171
  }));
2183
2172
  //#endregion
2184
2173
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js
2185
- var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2186
- const compare = require_compare();
2174
+ var require_gt$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2175
+ const compare = require_compare$1();
2187
2176
  const gt = (a, b, loose) => compare(a, b, loose) > 0;
2188
2177
  module.exports = gt;
2189
2178
  }));
2190
2179
  //#endregion
2191
2180
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js
2192
- var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2193
- const compare = require_compare();
2181
+ var require_lt$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2182
+ const compare = require_compare$1();
2194
2183
  const lt = (a, b, loose) => compare(a, b, loose) < 0;
2195
2184
  module.exports = lt;
2196
2185
  }));
2197
2186
  //#endregion
2198
2187
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js
2199
- var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2200
- const compare = require_compare();
2188
+ var require_eq$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2189
+ const compare = require_compare$1();
2201
2190
  const eq = (a, b, loose) => compare(a, b, loose) === 0;
2202
2191
  module.exports = eq;
2203
2192
  }));
2204
2193
  //#endregion
2205
2194
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js
2206
- var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2207
- const compare = require_compare();
2195
+ var require_neq$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2196
+ const compare = require_compare$1();
2208
2197
  const neq = (a, b, loose) => compare(a, b, loose) !== 0;
2209
2198
  module.exports = neq;
2210
2199
  }));
2211
2200
  //#endregion
2212
2201
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js
2213
- var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2214
- const compare = require_compare();
2202
+ var require_gte$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2203
+ const compare = require_compare$1();
2215
2204
  const gte = (a, b, loose) => compare(a, b, loose) >= 0;
2216
2205
  module.exports = gte;
2217
2206
  }));
2218
2207
  //#endregion
2219
2208
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js
2220
- var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2221
- const compare = require_compare();
2209
+ var require_lte$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2210
+ const compare = require_compare$1();
2222
2211
  const lte = (a, b, loose) => compare(a, b, loose) <= 0;
2223
2212
  module.exports = lte;
2224
2213
  }));
2225
2214
  //#endregion
2226
2215
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js
2227
- var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2228
- const eq = require_eq();
2229
- const neq = require_neq();
2230
- const gt = require_gt();
2231
- const gte = require_gte();
2232
- const lt = require_lt();
2233
- const lte = require_lte();
2216
+ var require_cmp$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2217
+ const eq = require_eq$1();
2218
+ const neq = require_neq$1();
2219
+ const gt = require_gt$1();
2220
+ const gte = require_gte$1();
2221
+ const lt = require_lt$1();
2222
+ const lte = require_lte$1();
2234
2223
  const cmp = (a, op, b, loose) => {
2235
2224
  switch (op) {
2236
2225
  case "===":
@@ -2256,10 +2245,10 @@ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2256
2245
  }));
2257
2246
  //#endregion
2258
2247
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js
2259
- var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2260
- const SemVer = require_semver$1();
2261
- const parse = require_parse();
2262
- const { safeRe: re, t } = require_re();
2248
+ var require_coerce$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2249
+ const SemVer = require_semver$2();
2250
+ const parse = require_parse$1();
2251
+ const { safeRe: re, t } = require_re$1();
2263
2252
  const coerce = (version, options) => {
2264
2253
  if (version instanceof SemVer) return version;
2265
2254
  if (typeof version === "number") version = String(version);
@@ -2284,7 +2273,7 @@ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2284
2273
  }));
2285
2274
  //#endregion
2286
2275
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js
2287
- var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2276
+ var require_lrucache$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2288
2277
  var LRUCache = class {
2289
2278
  constructor() {
2290
2279
  this.max = 1e3;
@@ -2317,7 +2306,7 @@ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2317
2306
  }));
2318
2307
  //#endregion
2319
2308
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js
2320
- var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2309
+ var require_range$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2321
2310
  const SPACE_CHARACTERS = /\s+/g;
2322
2311
  module.exports = class Range {
2323
2312
  constructor(range, options) {
@@ -2423,13 +2412,13 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2423
2412
  return false;
2424
2413
  }
2425
2414
  };
2426
- const cache = new (require_lrucache())();
2427
- const parseOptions = require_parse_options();
2428
- const Comparator = require_comparator();
2429
- const debug = require_debug();
2430
- const SemVer = require_semver$1();
2431
- const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
2432
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
2415
+ const cache = new (require_lrucache$1())();
2416
+ const parseOptions = require_parse_options$1();
2417
+ const Comparator = require_comparator$1();
2418
+ const debug = require_debug$1();
2419
+ const SemVer = require_semver$2();
2420
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re$1();
2421
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants$1();
2433
2422
  const isNullSet = (c) => c.value === "<0.0.0-0";
2434
2423
  const isAny = (c) => c.value === "";
2435
2424
  const isSatisfiable = (comparators, options) => {
@@ -2588,7 +2577,7 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2588
2577
  }));
2589
2578
  //#endregion
2590
2579
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js
2591
- var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2580
+ var require_comparator$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2592
2581
  const ANY = Symbol("SemVer ANY");
2593
2582
  module.exports = class Comparator {
2594
2583
  static get ANY() {
@@ -2649,17 +2638,17 @@ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2649
2638
  return false;
2650
2639
  }
2651
2640
  };
2652
- const parseOptions = require_parse_options();
2653
- const { safeRe: re, t } = require_re();
2654
- const cmp = require_cmp();
2655
- const debug = require_debug();
2656
- const SemVer = require_semver$1();
2657
- const Range = require_range();
2641
+ const parseOptions = require_parse_options$1();
2642
+ const { safeRe: re, t } = require_re$1();
2643
+ const cmp = require_cmp$1();
2644
+ const debug = require_debug$1();
2645
+ const SemVer = require_semver$2();
2646
+ const Range = require_range$1();
2658
2647
  }));
2659
2648
  //#endregion
2660
2649
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js
2661
- var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2662
- const Range = require_range();
2650
+ var require_satisfies$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2651
+ const Range = require_range$1();
2663
2652
  const satisfies = (version, range, options) => {
2664
2653
  try {
2665
2654
  range = new Range(range, options);
@@ -2672,16 +2661,16 @@ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2672
2661
  }));
2673
2662
  //#endregion
2674
2663
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js
2675
- var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2676
- const Range = require_range();
2664
+ var require_to_comparators$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2665
+ const Range = require_range$1();
2677
2666
  const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
2678
2667
  module.exports = toComparators;
2679
2668
  }));
2680
2669
  //#endregion
2681
2670
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js
2682
- var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2683
- const SemVer = require_semver$1();
2684
- const Range = require_range();
2671
+ var require_max_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2672
+ const SemVer = require_semver$2();
2673
+ const Range = require_range$1();
2685
2674
  const maxSatisfying = (versions, range, options) => {
2686
2675
  let max = null;
2687
2676
  let maxSV = null;
@@ -2705,9 +2694,9 @@ var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) =>
2705
2694
  }));
2706
2695
  //#endregion
2707
2696
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js
2708
- var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2709
- const SemVer = require_semver$1();
2710
- const Range = require_range();
2697
+ var require_min_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2698
+ const SemVer = require_semver$2();
2699
+ const Range = require_range$1();
2711
2700
  const minSatisfying = (versions, range, options) => {
2712
2701
  let min = null;
2713
2702
  let minSV = null;
@@ -2731,10 +2720,10 @@ var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) =>
2731
2720
  }));
2732
2721
  //#endregion
2733
2722
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js
2734
- var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2735
- const SemVer = require_semver$1();
2736
- const Range = require_range();
2737
- const gt = require_gt();
2723
+ var require_min_version$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2724
+ const SemVer = require_semver$2();
2725
+ const Range = require_range$1();
2726
+ const gt = require_gt$1();
2738
2727
  const minVersion = (range, loose) => {
2739
2728
  range = new Range(range, loose);
2740
2729
  let minver = new SemVer("0.0.0");
@@ -2770,8 +2759,8 @@ var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2770
2759
  }));
2771
2760
  //#endregion
2772
2761
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js
2773
- var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2774
- const Range = require_range();
2762
+ var require_valid$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2763
+ const Range = require_range$1();
2775
2764
  const validRange = (range, options) => {
2776
2765
  try {
2777
2766
  return new Range(range, options).range || "*";
@@ -2783,16 +2772,16 @@ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2783
2772
  }));
2784
2773
  //#endregion
2785
2774
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js
2786
- var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2787
- const SemVer = require_semver$1();
2788
- const Comparator = require_comparator();
2775
+ var require_outside$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2776
+ const SemVer = require_semver$2();
2777
+ const Comparator = require_comparator$1();
2789
2778
  const { ANY } = Comparator;
2790
- const Range = require_range();
2791
- const satisfies = require_satisfies();
2792
- const gt = require_gt();
2793
- const lt = require_lt();
2794
- const lte = require_lte();
2795
- const gte = require_gte();
2779
+ const Range = require_range$1();
2780
+ const satisfies = require_satisfies$1();
2781
+ const gt = require_gt$1();
2782
+ const lt = require_lt$1();
2783
+ const lte = require_lte$1();
2784
+ const gte = require_gte$1();
2796
2785
  const outside = (version, range, hilo, options) => {
2797
2786
  version = new SemVer(version, options);
2798
2787
  range = new Range(range, options);
@@ -2836,22 +2825,22 @@ var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2836
2825
  }));
2837
2826
  //#endregion
2838
2827
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js
2839
- var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2840
- const outside = require_outside();
2828
+ var require_gtr$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2829
+ const outside = require_outside$1();
2841
2830
  const gtr = (version, range, options) => outside(version, range, ">", options);
2842
2831
  module.exports = gtr;
2843
2832
  }));
2844
2833
  //#endregion
2845
2834
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js
2846
- var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2847
- const outside = require_outside();
2835
+ var require_ltr$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2836
+ const outside = require_outside$1();
2848
2837
  const ltr = (version, range, options) => outside(version, range, "<", options);
2849
2838
  module.exports = ltr;
2850
2839
  }));
2851
2840
  //#endregion
2852
2841
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js
2853
- var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2854
- const Range = require_range();
2842
+ var require_intersects$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2843
+ const Range = require_range$1();
2855
2844
  const intersects = (r1, r2, options) => {
2856
2845
  r1 = new Range(r1, options);
2857
2846
  r2 = new Range(r2, options);
@@ -2861,9 +2850,9 @@ var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2861
2850
  }));
2862
2851
  //#endregion
2863
2852
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js
2864
- var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2865
- const satisfies = require_satisfies();
2866
- const compare = require_compare();
2853
+ var require_simplify$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2854
+ const satisfies = require_satisfies$1();
2855
+ const compare = require_compare$1();
2867
2856
  module.exports = (versions, range, options) => {
2868
2857
  const set = [];
2869
2858
  let first = null;
@@ -2891,12 +2880,12 @@ var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2891
2880
  }));
2892
2881
  //#endregion
2893
2882
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js
2894
- var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2895
- const Range = require_range();
2896
- const Comparator = require_comparator();
2883
+ var require_subset$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2884
+ const Range = require_range$1();
2885
+ const Comparator = require_comparator$1();
2897
2886
  const { ANY } = Comparator;
2898
- const satisfies = require_satisfies();
2899
- const compare = require_compare();
2887
+ const satisfies = require_satisfies$1();
2888
+ const compare = require_compare$1();
2900
2889
  const subset = (sub, dom, options = {}) => {
2901
2890
  if (sub === dom) return true;
2902
2891
  sub = new Range(sub, options);
@@ -2985,50 +2974,50 @@ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2985
2974
  module.exports = subset;
2986
2975
  }));
2987
2976
  //#endregion
2988
- //#region ../plugin-core/dist/createBlobDatabasePlugin.mjs
2989
- var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
2990
- const internalRe = require_re();
2991
- const constants = require_constants();
2992
- const SemVer = require_semver$1();
2993
- const identifiers = require_identifiers();
2977
+ //#region ../plugin-core/dist/semverSatisfies.mjs
2978
+ var import_semver$1 = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2979
+ const internalRe = require_re$1();
2980
+ const constants = require_constants$1();
2981
+ const SemVer = require_semver$2();
2982
+ const identifiers = require_identifiers$1();
2994
2983
  module.exports = {
2995
- parse: require_parse(),
2996
- valid: require_valid$1(),
2997
- clean: require_clean(),
2998
- inc: require_inc(),
2999
- diff: require_diff(),
3000
- major: require_major(),
3001
- minor: require_minor(),
3002
- patch: require_patch(),
3003
- prerelease: require_prerelease(),
3004
- compare: require_compare(),
3005
- rcompare: require_rcompare(),
3006
- compareLoose: require_compare_loose(),
3007
- compareBuild: require_compare_build(),
3008
- sort: require_sort(),
3009
- rsort: require_rsort(),
3010
- gt: require_gt(),
3011
- lt: require_lt(),
3012
- eq: require_eq(),
3013
- neq: require_neq(),
3014
- gte: require_gte(),
3015
- lte: require_lte(),
3016
- cmp: require_cmp(),
3017
- coerce: require_coerce(),
3018
- Comparator: require_comparator(),
3019
- Range: require_range(),
3020
- satisfies: require_satisfies(),
3021
- toComparators: require_to_comparators(),
3022
- maxSatisfying: require_max_satisfying(),
3023
- minSatisfying: require_min_satisfying(),
3024
- minVersion: require_min_version(),
3025
- validRange: require_valid(),
3026
- outside: require_outside(),
3027
- gtr: require_gtr(),
3028
- ltr: require_ltr(),
3029
- intersects: require_intersects(),
3030
- simplifyRange: require_simplify(),
3031
- subset: require_subset(),
2984
+ parse: require_parse$1(),
2985
+ valid: require_valid$3(),
2986
+ clean: require_clean$1(),
2987
+ inc: require_inc$1(),
2988
+ diff: require_diff$1(),
2989
+ major: require_major$1(),
2990
+ minor: require_minor$1(),
2991
+ patch: require_patch$1(),
2992
+ prerelease: require_prerelease$1(),
2993
+ compare: require_compare$1(),
2994
+ rcompare: require_rcompare$1(),
2995
+ compareLoose: require_compare_loose$1(),
2996
+ compareBuild: require_compare_build$1(),
2997
+ sort: require_sort$1(),
2998
+ rsort: require_rsort$1(),
2999
+ gt: require_gt$1(),
3000
+ lt: require_lt$1(),
3001
+ eq: require_eq$1(),
3002
+ neq: require_neq$1(),
3003
+ gte: require_gte$1(),
3004
+ lte: require_lte$1(),
3005
+ cmp: require_cmp$1(),
3006
+ coerce: require_coerce$1(),
3007
+ Comparator: require_comparator$1(),
3008
+ Range: require_range$1(),
3009
+ satisfies: require_satisfies$1(),
3010
+ toComparators: require_to_comparators$1(),
3011
+ maxSatisfying: require_max_satisfying$1(),
3012
+ minSatisfying: require_min_satisfying$1(),
3013
+ minVersion: require_min_version$1(),
3014
+ validRange: require_valid$2(),
3015
+ outside: require_outside$1(),
3016
+ gtr: require_gtr$1(),
3017
+ ltr: require_ltr$1(),
3018
+ intersects: require_intersects$1(),
3019
+ simplifyRange: require_simplify$1(),
3020
+ subset: require_subset$1(),
3032
3021
  SemVer,
3033
3022
  re: internalRe.re,
3034
3023
  src: internalRe.src,
@@ -3039,42 +3028,1464 @@ var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
3039
3028
  rcompareIdentifiers: identifiers.rcompareIdentifiers
3040
3029
  };
3041
3030
  })))(), 1);
3042
- function removeBundleInternalKeys(bundle) {
3043
- const { _updateJsonKey, _oldUpdateJsonKey, ...pureBundle } = bundle;
3044
- return pureBundle;
3045
- }
3046
- function normalizeTargetAppVersion(version) {
3047
- if (!version) return null;
3048
- let normalized = version.replace(/\s+/g, " ").trim();
3049
- normalized = normalized.replace(/([><=~^]+)\s+(\d)/g, (_match, operator, digit) => `${operator}${digit}`);
3050
- return normalized;
3051
- }
3052
- function isExactVersion(version) {
3053
- if (!version) return false;
3054
- const normalized = normalizeTargetAppVersion(version);
3055
- if (!normalized) return false;
3056
- return import_semver.default.valid(normalized) !== null;
3057
- }
3031
+ const semverSatisfies$1 = (targetAppVersion, currentVersion) => {
3032
+ const currentCoerce = import_semver$1.default.coerce(currentVersion);
3033
+ if (!currentCoerce) return false;
3034
+ return import_semver$1.default.satisfies(currentCoerce.version, targetAppVersion);
3035
+ };
3036
+ //#endregion
3037
+ //#region ../plugin-core/dist/filterCompatibleAppVersions.mjs
3058
3038
  /**
3059
- * Get all normalized semver versions for a version string.
3060
- * This handles the case where clients may request with different normalized forms.
3039
+ * Filters target app versions that are compatible with the current app version.
3040
+ * Returns only versions that are compatible with the current version according to semver rules.
3061
3041
  *
3062
- * Examples:
3063
- * - "1.0.0" generates ["1.0.0", "1.0", "1"]
3064
- * - "2.1.0" generates ["2.1.0", "2.1"]
3065
- * - "1.2.3" generates ["1.2.3"]
3042
+ * @param targetAppVersionList - List of target app versions to filter
3043
+ * @param currentVersion - Current app version
3044
+ * @returns Array of target app versions compatible with the current version
3066
3045
  */
3067
- function getSemverNormalizedVersions(version) {
3068
- const normalized = normalizeTargetAppVersion(version) || version;
3069
- const coerced = import_semver.default.coerce(normalized);
3070
- if (!coerced) return [normalized];
3071
- const versions = /* @__PURE__ */ new Set();
3072
- versions.add(coerced.version);
3073
- if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
3074
- if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
3075
- return Array.from(versions);
3076
- }
3077
- function resolveStorageTarget({ targetAppVersion, fingerprintHash }) {
3046
+ const filterCompatibleAppVersions = (targetAppVersionList, currentVersion) => {
3047
+ return targetAppVersionList.filter((version) => semverSatisfies$1(version, currentVersion)).sort((a, b) => b.localeCompare(a));
3048
+ };
3049
+ //#endregion
3050
+ //#region ../plugin-core/dist/queryBundles.mjs
3051
+ const compareValue = (value, expected, comparator) => {
3052
+ if (expected === void 0) return true;
3053
+ switch (comparator) {
3054
+ case "eq": return value === expected;
3055
+ case "gt": return value.localeCompare(expected) > 0;
3056
+ case "gte": return value.localeCompare(expected) >= 0;
3057
+ case "lt": return value.localeCompare(expected) < 0;
3058
+ case "lte": return value.localeCompare(expected) <= 0;
3059
+ }
3060
+ };
3061
+ function bundleIdMatchesFilter(id, filter) {
3062
+ if (!filter) return true;
3063
+ if (filter.in && !filter.in.includes(id)) return false;
3064
+ return compareValue(id, filter.eq, "eq") && compareValue(id, filter.gt, "gt") && compareValue(id, filter.gte, "gte") && compareValue(id, filter.lt, "lt") && compareValue(id, filter.lte, "lte");
3065
+ }
3066
+ function bundleMatchesQueryWhere$1(bundle, where) {
3067
+ if (!where) return true;
3068
+ if (where.channel !== void 0 && bundle.channel !== where.channel) return false;
3069
+ if (where.platform !== void 0 && bundle.platform !== where.platform) return false;
3070
+ if (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;
3071
+ if (!bundleIdMatchesFilter(bundle.id, where.id)) return false;
3072
+ if (where.targetAppVersionNotNull === true && bundle.targetAppVersion === null) return false;
3073
+ if (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;
3074
+ if (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? "")) return false;
3075
+ if (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;
3076
+ return true;
3077
+ }
3078
+ function sortBundles$1(bundles, orderBy) {
3079
+ const direction = orderBy?.direction ?? "desc";
3080
+ if (orderBy && orderBy.field !== "id") return bundles;
3081
+ return bundles.slice().sort((a, b) => {
3082
+ const result = a.id.localeCompare(b.id);
3083
+ return direction === "asc" ? result : -result;
3084
+ });
3085
+ }
3086
+ //#endregion
3087
+ //#region ../js/dist/index.mjs
3088
+ var __create = Object.create;
3089
+ var __defProp = Object.defineProperty;
3090
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3091
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3092
+ var __getProtoOf = Object.getPrototypeOf;
3093
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3094
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3095
+ var __copyProps = (to, from, except, desc) => {
3096
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
3097
+ key = keys[i];
3098
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
3099
+ get: ((k) => from[k]).bind(null, key),
3100
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
3101
+ });
3102
+ }
3103
+ return to;
3104
+ };
3105
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
3106
+ value: mod,
3107
+ enumerable: true
3108
+ }) : target, mod));
3109
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3110
+ const SEMVER_SPEC_VERSION = "2.0.0";
3111
+ const MAX_LENGTH = 256;
3112
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
3113
+ module.exports = {
3114
+ MAX_LENGTH,
3115
+ MAX_SAFE_COMPONENT_LENGTH: 16,
3116
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
3117
+ MAX_SAFE_INTEGER,
3118
+ RELEASE_TYPES: [
3119
+ "major",
3120
+ "premajor",
3121
+ "minor",
3122
+ "preminor",
3123
+ "patch",
3124
+ "prepatch",
3125
+ "prerelease"
3126
+ ],
3127
+ SEMVER_SPEC_VERSION,
3128
+ FLAG_INCLUDE_PRERELEASE: 1,
3129
+ FLAG_LOOSE: 2
3130
+ };
3131
+ }));
3132
+ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3133
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
3134
+ }));
3135
+ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3136
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
3137
+ const debug = require_debug();
3138
+ exports = module.exports = {};
3139
+ const re = exports.re = [];
3140
+ const safeRe = exports.safeRe = [];
3141
+ const src = exports.src = [];
3142
+ const safeSrc = exports.safeSrc = [];
3143
+ const t = exports.t = {};
3144
+ let R = 0;
3145
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
3146
+ const safeRegexReplacements = [
3147
+ ["\\s", 1],
3148
+ ["\\d", MAX_LENGTH],
3149
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
3150
+ ];
3151
+ const makeSafeRegex = (value) => {
3152
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
3153
+ return value;
3154
+ };
3155
+ const createToken = (name, value, isGlobal) => {
3156
+ const safe = makeSafeRegex(value);
3157
+ const index = R++;
3158
+ debug(name, index, value);
3159
+ t[name] = index;
3160
+ src[index] = value;
3161
+ safeSrc[index] = safe;
3162
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
3163
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
3164
+ };
3165
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
3166
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
3167
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
3168
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
3169
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
3170
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
3171
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
3172
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
3173
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
3174
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
3175
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
3176
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
3177
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
3178
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
3179
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
3180
+ createToken("GTLT", "((?:<|>)?=?)");
3181
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
3182
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
3183
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
3184
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
3185
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
3186
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
3187
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
3188
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
3189
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
3190
+ createToken("COERCERTL", src[t.COERCE], true);
3191
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
3192
+ createToken("LONETILDE", "(?:~>?)");
3193
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
3194
+ exports.tildeTrimReplace = "$1~";
3195
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
3196
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
3197
+ createToken("LONECARET", "(?:\\^)");
3198
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
3199
+ exports.caretTrimReplace = "$1^";
3200
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
3201
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
3202
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
3203
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
3204
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
3205
+ exports.comparatorTrimReplace = "$1$2$3";
3206
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
3207
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
3208
+ createToken("STAR", "(<|>)?=?\\s*\\*");
3209
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
3210
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
3211
+ }));
3212
+ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3213
+ const looseOption = Object.freeze({ loose: true });
3214
+ const emptyOpts = Object.freeze({});
3215
+ const parseOptions = (options) => {
3216
+ if (!options) return emptyOpts;
3217
+ if (typeof options !== "object") return looseOption;
3218
+ return options;
3219
+ };
3220
+ module.exports = parseOptions;
3221
+ }));
3222
+ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3223
+ const numeric = /^[0-9]+$/;
3224
+ const compareIdentifiers = (a, b) => {
3225
+ const anum = numeric.test(a);
3226
+ const bnum = numeric.test(b);
3227
+ if (anum && bnum) {
3228
+ a = +a;
3229
+ b = +b;
3230
+ }
3231
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
3232
+ };
3233
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
3234
+ module.exports = {
3235
+ compareIdentifiers,
3236
+ rcompareIdentifiers
3237
+ };
3238
+ }));
3239
+ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3240
+ const debug = require_debug();
3241
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
3242
+ const { safeRe: re, t } = require_re();
3243
+ const parseOptions = require_parse_options();
3244
+ const { compareIdentifiers } = require_identifiers();
3245
+ module.exports = class SemVer {
3246
+ constructor(version, options) {
3247
+ options = parseOptions(options);
3248
+ if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
3249
+ else version = version.version;
3250
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
3251
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
3252
+ debug("SemVer", version, options);
3253
+ this.options = options;
3254
+ this.loose = !!options.loose;
3255
+ this.includePrerelease = !!options.includePrerelease;
3256
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
3257
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
3258
+ this.raw = version;
3259
+ this.major = +m[1];
3260
+ this.minor = +m[2];
3261
+ this.patch = +m[3];
3262
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
3263
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
3264
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
3265
+ if (!m[4]) this.prerelease = [];
3266
+ else this.prerelease = m[4].split(".").map((id) => {
3267
+ if (/^[0-9]+$/.test(id)) {
3268
+ const num = +id;
3269
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
3270
+ }
3271
+ return id;
3272
+ });
3273
+ this.build = m[5] ? m[5].split(".") : [];
3274
+ this.format();
3275
+ }
3276
+ format() {
3277
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
3278
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
3279
+ return this.version;
3280
+ }
3281
+ toString() {
3282
+ return this.version;
3283
+ }
3284
+ compare(other) {
3285
+ debug("SemVer.compare", this.version, this.options, other);
3286
+ if (!(other instanceof SemVer)) {
3287
+ if (typeof other === "string" && other === this.version) return 0;
3288
+ other = new SemVer(other, this.options);
3289
+ }
3290
+ if (other.version === this.version) return 0;
3291
+ return this.compareMain(other) || this.comparePre(other);
3292
+ }
3293
+ compareMain(other) {
3294
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3295
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
3296
+ }
3297
+ comparePre(other) {
3298
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3299
+ if (this.prerelease.length && !other.prerelease.length) return -1;
3300
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
3301
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
3302
+ let i = 0;
3303
+ do {
3304
+ const a = this.prerelease[i];
3305
+ const b = other.prerelease[i];
3306
+ debug("prerelease compare", i, a, b);
3307
+ if (a === void 0 && b === void 0) return 0;
3308
+ else if (b === void 0) return 1;
3309
+ else if (a === void 0) return -1;
3310
+ else if (a === b) continue;
3311
+ else return compareIdentifiers(a, b);
3312
+ } while (++i);
3313
+ }
3314
+ compareBuild(other) {
3315
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
3316
+ let i = 0;
3317
+ do {
3318
+ const a = this.build[i];
3319
+ const b = other.build[i];
3320
+ debug("build compare", i, a, b);
3321
+ if (a === void 0 && b === void 0) return 0;
3322
+ else if (b === void 0) return 1;
3323
+ else if (a === void 0) return -1;
3324
+ else if (a === b) continue;
3325
+ else return compareIdentifiers(a, b);
3326
+ } while (++i);
3327
+ }
3328
+ inc(release, identifier, identifierBase) {
3329
+ if (release.startsWith("pre")) {
3330
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
3331
+ if (identifier) {
3332
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
3333
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
3334
+ }
3335
+ }
3336
+ switch (release) {
3337
+ case "premajor":
3338
+ this.prerelease.length = 0;
3339
+ this.patch = 0;
3340
+ this.minor = 0;
3341
+ this.major++;
3342
+ this.inc("pre", identifier, identifierBase);
3343
+ break;
3344
+ case "preminor":
3345
+ this.prerelease.length = 0;
3346
+ this.patch = 0;
3347
+ this.minor++;
3348
+ this.inc("pre", identifier, identifierBase);
3349
+ break;
3350
+ case "prepatch":
3351
+ this.prerelease.length = 0;
3352
+ this.inc("patch", identifier, identifierBase);
3353
+ this.inc("pre", identifier, identifierBase);
3354
+ break;
3355
+ case "prerelease":
3356
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
3357
+ this.inc("pre", identifier, identifierBase);
3358
+ break;
3359
+ case "release":
3360
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
3361
+ this.prerelease.length = 0;
3362
+ break;
3363
+ case "major":
3364
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
3365
+ this.minor = 0;
3366
+ this.patch = 0;
3367
+ this.prerelease = [];
3368
+ break;
3369
+ case "minor":
3370
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
3371
+ this.patch = 0;
3372
+ this.prerelease = [];
3373
+ break;
3374
+ case "patch":
3375
+ if (this.prerelease.length === 0) this.patch++;
3376
+ this.prerelease = [];
3377
+ break;
3378
+ case "pre": {
3379
+ const base = Number(identifierBase) ? 1 : 0;
3380
+ if (this.prerelease.length === 0) this.prerelease = [base];
3381
+ else {
3382
+ let i = this.prerelease.length;
3383
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
3384
+ this.prerelease[i]++;
3385
+ i = -2;
3386
+ }
3387
+ if (i === -1) {
3388
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
3389
+ this.prerelease.push(base);
3390
+ }
3391
+ }
3392
+ if (identifier) {
3393
+ let prerelease = [identifier, base];
3394
+ if (identifierBase === false) prerelease = [identifier];
3395
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
3396
+ if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
3397
+ } else this.prerelease = prerelease;
3398
+ }
3399
+ break;
3400
+ }
3401
+ default: throw new Error(`invalid increment argument: ${release}`);
3402
+ }
3403
+ this.raw = this.format();
3404
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
3405
+ return this;
3406
+ }
3407
+ };
3408
+ }));
3409
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3410
+ const SemVer = require_semver$1();
3411
+ const parse = (version, options, throwErrors = false) => {
3412
+ if (version instanceof SemVer) return version;
3413
+ try {
3414
+ return new SemVer(version, options);
3415
+ } catch (er) {
3416
+ if (!throwErrors) return null;
3417
+ throw er;
3418
+ }
3419
+ };
3420
+ module.exports = parse;
3421
+ }));
3422
+ var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3423
+ const parse = require_parse();
3424
+ const valid = (version, options) => {
3425
+ const v = parse(version, options);
3426
+ return v ? v.version : null;
3427
+ };
3428
+ module.exports = valid;
3429
+ }));
3430
+ var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3431
+ const parse = require_parse();
3432
+ const clean = (version, options) => {
3433
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
3434
+ return s ? s.version : null;
3435
+ };
3436
+ module.exports = clean;
3437
+ }));
3438
+ var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3439
+ const SemVer = require_semver$1();
3440
+ const inc = (version, release, options, identifier, identifierBase) => {
3441
+ if (typeof options === "string") {
3442
+ identifierBase = identifier;
3443
+ identifier = options;
3444
+ options = void 0;
3445
+ }
3446
+ try {
3447
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
3448
+ } catch (er) {
3449
+ return null;
3450
+ }
3451
+ };
3452
+ module.exports = inc;
3453
+ }));
3454
+ var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3455
+ const parse = require_parse();
3456
+ const diff = (version1, version2) => {
3457
+ const v1 = parse(version1, null, true);
3458
+ const v2 = parse(version2, null, true);
3459
+ const comparison = v1.compare(v2);
3460
+ if (comparison === 0) return null;
3461
+ const v1Higher = comparison > 0;
3462
+ const highVersion = v1Higher ? v1 : v2;
3463
+ const lowVersion = v1Higher ? v2 : v1;
3464
+ const highHasPre = !!highVersion.prerelease.length;
3465
+ if (!!lowVersion.prerelease.length && !highHasPre) {
3466
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
3467
+ if (lowVersion.compareMain(highVersion) === 0) {
3468
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
3469
+ return "patch";
3470
+ }
3471
+ }
3472
+ const prefix = highHasPre ? "pre" : "";
3473
+ if (v1.major !== v2.major) return prefix + "major";
3474
+ if (v1.minor !== v2.minor) return prefix + "minor";
3475
+ if (v1.patch !== v2.patch) return prefix + "patch";
3476
+ return "prerelease";
3477
+ };
3478
+ module.exports = diff;
3479
+ }));
3480
+ var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3481
+ const SemVer = require_semver$1();
3482
+ const major = (a, loose) => new SemVer(a, loose).major;
3483
+ module.exports = major;
3484
+ }));
3485
+ var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3486
+ const SemVer = require_semver$1();
3487
+ const minor = (a, loose) => new SemVer(a, loose).minor;
3488
+ module.exports = minor;
3489
+ }));
3490
+ var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3491
+ const SemVer = require_semver$1();
3492
+ const patch = (a, loose) => new SemVer(a, loose).patch;
3493
+ module.exports = patch;
3494
+ }));
3495
+ var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3496
+ const parse = require_parse();
3497
+ const prerelease = (version, options) => {
3498
+ const parsed = parse(version, options);
3499
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
3500
+ };
3501
+ module.exports = prerelease;
3502
+ }));
3503
+ var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3504
+ const SemVer = require_semver$1();
3505
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
3506
+ module.exports = compare;
3507
+ }));
3508
+ var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3509
+ const compare = require_compare();
3510
+ const rcompare = (a, b, loose) => compare(b, a, loose);
3511
+ module.exports = rcompare;
3512
+ }));
3513
+ var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3514
+ const compare = require_compare();
3515
+ const compareLoose = (a, b) => compare(a, b, true);
3516
+ module.exports = compareLoose;
3517
+ }));
3518
+ var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3519
+ const SemVer = require_semver$1();
3520
+ const compareBuild = (a, b, loose) => {
3521
+ const versionA = new SemVer(a, loose);
3522
+ const versionB = new SemVer(b, loose);
3523
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
3524
+ };
3525
+ module.exports = compareBuild;
3526
+ }));
3527
+ var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3528
+ const compareBuild = require_compare_build();
3529
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
3530
+ module.exports = sort;
3531
+ }));
3532
+ var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3533
+ const compareBuild = require_compare_build();
3534
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
3535
+ module.exports = rsort;
3536
+ }));
3537
+ var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3538
+ const compare = require_compare();
3539
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
3540
+ module.exports = gt;
3541
+ }));
3542
+ var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3543
+ const compare = require_compare();
3544
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
3545
+ module.exports = lt;
3546
+ }));
3547
+ var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3548
+ const compare = require_compare();
3549
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
3550
+ module.exports = eq;
3551
+ }));
3552
+ var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3553
+ const compare = require_compare();
3554
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
3555
+ module.exports = neq;
3556
+ }));
3557
+ var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3558
+ const compare = require_compare();
3559
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
3560
+ module.exports = gte;
3561
+ }));
3562
+ var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3563
+ const compare = require_compare();
3564
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
3565
+ module.exports = lte;
3566
+ }));
3567
+ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3568
+ const eq = require_eq();
3569
+ const neq = require_neq();
3570
+ const gt = require_gt();
3571
+ const gte = require_gte();
3572
+ const lt = require_lt();
3573
+ const lte = require_lte();
3574
+ const cmp = (a, op, b, loose) => {
3575
+ switch (op) {
3576
+ case "===":
3577
+ if (typeof a === "object") a = a.version;
3578
+ if (typeof b === "object") b = b.version;
3579
+ return a === b;
3580
+ case "!==":
3581
+ if (typeof a === "object") a = a.version;
3582
+ if (typeof b === "object") b = b.version;
3583
+ return a !== b;
3584
+ case "":
3585
+ case "=":
3586
+ case "==": return eq(a, b, loose);
3587
+ case "!=": return neq(a, b, loose);
3588
+ case ">": return gt(a, b, loose);
3589
+ case ">=": return gte(a, b, loose);
3590
+ case "<": return lt(a, b, loose);
3591
+ case "<=": return lte(a, b, loose);
3592
+ default: throw new TypeError(`Invalid operator: ${op}`);
3593
+ }
3594
+ };
3595
+ module.exports = cmp;
3596
+ }));
3597
+ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3598
+ const SemVer = require_semver$1();
3599
+ const parse = require_parse();
3600
+ const { safeRe: re, t } = require_re();
3601
+ const coerce = (version, options) => {
3602
+ if (version instanceof SemVer) return version;
3603
+ if (typeof version === "number") version = String(version);
3604
+ if (typeof version !== "string") return null;
3605
+ options = options || {};
3606
+ let match = null;
3607
+ if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
3608
+ else {
3609
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
3610
+ let next;
3611
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
3612
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
3613
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
3614
+ }
3615
+ coerceRtlRegex.lastIndex = -1;
3616
+ }
3617
+ if (match === null) return null;
3618
+ const major = match[2];
3619
+ return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
3620
+ };
3621
+ module.exports = coerce;
3622
+ }));
3623
+ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3624
+ var LRUCache = class {
3625
+ constructor() {
3626
+ this.max = 1e3;
3627
+ this.map = /* @__PURE__ */ new Map();
3628
+ }
3629
+ get(key) {
3630
+ const value = this.map.get(key);
3631
+ if (value === void 0) return;
3632
+ else {
3633
+ this.map.delete(key);
3634
+ this.map.set(key, value);
3635
+ return value;
3636
+ }
3637
+ }
3638
+ delete(key) {
3639
+ return this.map.delete(key);
3640
+ }
3641
+ set(key, value) {
3642
+ if (!this.delete(key) && value !== void 0) {
3643
+ if (this.map.size >= this.max) {
3644
+ const firstKey = this.map.keys().next().value;
3645
+ this.delete(firstKey);
3646
+ }
3647
+ this.map.set(key, value);
3648
+ }
3649
+ return this;
3650
+ }
3651
+ };
3652
+ module.exports = LRUCache;
3653
+ }));
3654
+ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3655
+ const SPACE_CHARACTERS = /\s+/g;
3656
+ module.exports = class Range {
3657
+ constructor(range, options) {
3658
+ options = parseOptions(options);
3659
+ if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
3660
+ else return new Range(range.raw, options);
3661
+ if (range instanceof Comparator) {
3662
+ this.raw = range.value;
3663
+ this.set = [[range]];
3664
+ this.formatted = void 0;
3665
+ return this;
3666
+ }
3667
+ this.options = options;
3668
+ this.loose = !!options.loose;
3669
+ this.includePrerelease = !!options.includePrerelease;
3670
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
3671
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
3672
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
3673
+ if (this.set.length > 1) {
3674
+ const first = this.set[0];
3675
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
3676
+ if (this.set.length === 0) this.set = [first];
3677
+ else if (this.set.length > 1) {
3678
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
3679
+ this.set = [c];
3680
+ break;
3681
+ }
3682
+ }
3683
+ }
3684
+ this.formatted = void 0;
3685
+ }
3686
+ get range() {
3687
+ if (this.formatted === void 0) {
3688
+ this.formatted = "";
3689
+ for (let i = 0; i < this.set.length; i++) {
3690
+ if (i > 0) this.formatted += "||";
3691
+ const comps = this.set[i];
3692
+ for (let k = 0; k < comps.length; k++) {
3693
+ if (k > 0) this.formatted += " ";
3694
+ this.formatted += comps[k].toString().trim();
3695
+ }
3696
+ }
3697
+ }
3698
+ return this.formatted;
3699
+ }
3700
+ format() {
3701
+ return this.range;
3702
+ }
3703
+ toString() {
3704
+ return this.range;
3705
+ }
3706
+ parseRange(range) {
3707
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
3708
+ const cached = cache.get(memoKey);
3709
+ if (cached) return cached;
3710
+ const loose = this.options.loose;
3711
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
3712
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
3713
+ debug("hyphen replace", range);
3714
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
3715
+ debug("comparator trim", range);
3716
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
3717
+ debug("tilde trim", range);
3718
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
3719
+ debug("caret trim", range);
3720
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
3721
+ if (loose) rangeList = rangeList.filter((comp) => {
3722
+ debug("loose invalid filter", comp, this.options);
3723
+ return !!comp.match(re[t.COMPARATORLOOSE]);
3724
+ });
3725
+ debug("range list", rangeList);
3726
+ const rangeMap = /* @__PURE__ */ new Map();
3727
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
3728
+ for (const comp of comparators) {
3729
+ if (isNullSet(comp)) return [comp];
3730
+ rangeMap.set(comp.value, comp);
3731
+ }
3732
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
3733
+ const result = [...rangeMap.values()];
3734
+ cache.set(memoKey, result);
3735
+ return result;
3736
+ }
3737
+ intersects(range, options) {
3738
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
3739
+ return this.set.some((thisComparators) => {
3740
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
3741
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
3742
+ return rangeComparators.every((rangeComparator) => {
3743
+ return thisComparator.intersects(rangeComparator, options);
3744
+ });
3745
+ });
3746
+ });
3747
+ });
3748
+ }
3749
+ test(version) {
3750
+ if (!version) return false;
3751
+ if (typeof version === "string") try {
3752
+ version = new SemVer(version, this.options);
3753
+ } catch (er) {
3754
+ return false;
3755
+ }
3756
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
3757
+ return false;
3758
+ }
3759
+ };
3760
+ const cache = new (require_lrucache())();
3761
+ const parseOptions = require_parse_options();
3762
+ const Comparator = require_comparator();
3763
+ const debug = require_debug();
3764
+ const SemVer = require_semver$1();
3765
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
3766
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
3767
+ const isNullSet = (c) => c.value === "<0.0.0-0";
3768
+ const isAny = (c) => c.value === "";
3769
+ const isSatisfiable = (comparators, options) => {
3770
+ let result = true;
3771
+ const remainingComparators = comparators.slice();
3772
+ let testComparator = remainingComparators.pop();
3773
+ while (result && remainingComparators.length) {
3774
+ result = remainingComparators.every((otherComparator) => {
3775
+ return testComparator.intersects(otherComparator, options);
3776
+ });
3777
+ testComparator = remainingComparators.pop();
3778
+ }
3779
+ return result;
3780
+ };
3781
+ const parseComparator = (comp, options) => {
3782
+ debug("comp", comp, options);
3783
+ comp = replaceCarets(comp, options);
3784
+ debug("caret", comp);
3785
+ comp = replaceTildes(comp, options);
3786
+ debug("tildes", comp);
3787
+ comp = replaceXRanges(comp, options);
3788
+ debug("xrange", comp);
3789
+ comp = replaceStars(comp, options);
3790
+ debug("stars", comp);
3791
+ return comp;
3792
+ };
3793
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
3794
+ const replaceTildes = (comp, options) => {
3795
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
3796
+ };
3797
+ const replaceTilde = (comp, options) => {
3798
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
3799
+ return comp.replace(r, (_, M, m, p, pr) => {
3800
+ debug("tilde", comp, _, M, m, p, pr);
3801
+ let ret;
3802
+ if (isX(M)) ret = "";
3803
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
3804
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
3805
+ else if (pr) {
3806
+ debug("replaceTilde pr", pr);
3807
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
3808
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
3809
+ debug("tilde return", ret);
3810
+ return ret;
3811
+ });
3812
+ };
3813
+ const replaceCarets = (comp, options) => {
3814
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
3815
+ };
3816
+ const replaceCaret = (comp, options) => {
3817
+ debug("caret", comp, options);
3818
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
3819
+ const z = options.includePrerelease ? "-0" : "";
3820
+ return comp.replace(r, (_, M, m, p, pr) => {
3821
+ debug("caret", comp, _, M, m, p, pr);
3822
+ let ret;
3823
+ if (isX(M)) ret = "";
3824
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
3825
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
3826
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
3827
+ else if (pr) {
3828
+ debug("replaceCaret pr", pr);
3829
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
3830
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
3831
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
3832
+ } else {
3833
+ debug("no pr");
3834
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
3835
+ else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
3836
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
3837
+ }
3838
+ debug("caret return", ret);
3839
+ return ret;
3840
+ });
3841
+ };
3842
+ const replaceXRanges = (comp, options) => {
3843
+ debug("replaceXRanges", comp, options);
3844
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
3845
+ };
3846
+ const replaceXRange = (comp, options) => {
3847
+ comp = comp.trim();
3848
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
3849
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
3850
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
3851
+ const xM = isX(M);
3852
+ const xm = xM || isX(m);
3853
+ const xp = xm || isX(p);
3854
+ const anyX = xp;
3855
+ if (gtlt === "=" && anyX) gtlt = "";
3856
+ pr = options.includePrerelease ? "-0" : "";
3857
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
3858
+ else ret = "*";
3859
+ else if (gtlt && anyX) {
3860
+ if (xm) m = 0;
3861
+ p = 0;
3862
+ if (gtlt === ">") {
3863
+ gtlt = ">=";
3864
+ if (xm) {
3865
+ M = +M + 1;
3866
+ m = 0;
3867
+ p = 0;
3868
+ } else {
3869
+ m = +m + 1;
3870
+ p = 0;
3871
+ }
3872
+ } else if (gtlt === "<=") {
3873
+ gtlt = "<";
3874
+ if (xm) M = +M + 1;
3875
+ else m = +m + 1;
3876
+ }
3877
+ if (gtlt === "<") pr = "-0";
3878
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
3879
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
3880
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
3881
+ debug("xRange return", ret);
3882
+ return ret;
3883
+ });
3884
+ };
3885
+ const replaceStars = (comp, options) => {
3886
+ debug("replaceStars", comp, options);
3887
+ return comp.trim().replace(re[t.STAR], "");
3888
+ };
3889
+ const replaceGTE0 = (comp, options) => {
3890
+ debug("replaceGTE0", comp, options);
3891
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
3892
+ };
3893
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
3894
+ if (isX(fM)) from = "";
3895
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
3896
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
3897
+ else if (fpr) from = `>=${from}`;
3898
+ else from = `>=${from}${incPr ? "-0" : ""}`;
3899
+ if (isX(tM)) to = "";
3900
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
3901
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
3902
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
3903
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
3904
+ else to = `<=${to}`;
3905
+ return `${from} ${to}`.trim();
3906
+ };
3907
+ const testSet = (set, version, options) => {
3908
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
3909
+ if (version.prerelease.length && !options.includePrerelease) {
3910
+ for (let i = 0; i < set.length; i++) {
3911
+ debug(set[i].semver);
3912
+ if (set[i].semver === Comparator.ANY) continue;
3913
+ if (set[i].semver.prerelease.length > 0) {
3914
+ const allowed = set[i].semver;
3915
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
3916
+ }
3917
+ }
3918
+ return false;
3919
+ }
3920
+ return true;
3921
+ };
3922
+ }));
3923
+ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3924
+ const ANY = Symbol("SemVer ANY");
3925
+ module.exports = class Comparator {
3926
+ static get ANY() {
3927
+ return ANY;
3928
+ }
3929
+ constructor(comp, options) {
3930
+ options = parseOptions(options);
3931
+ if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
3932
+ else comp = comp.value;
3933
+ comp = comp.trim().split(/\s+/).join(" ");
3934
+ debug("comparator", comp, options);
3935
+ this.options = options;
3936
+ this.loose = !!options.loose;
3937
+ this.parse(comp);
3938
+ if (this.semver === ANY) this.value = "";
3939
+ else this.value = this.operator + this.semver.version;
3940
+ debug("comp", this);
3941
+ }
3942
+ parse(comp) {
3943
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
3944
+ const m = comp.match(r);
3945
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
3946
+ this.operator = m[1] !== void 0 ? m[1] : "";
3947
+ if (this.operator === "=") this.operator = "";
3948
+ if (!m[2]) this.semver = ANY;
3949
+ else this.semver = new SemVer(m[2], this.options.loose);
3950
+ }
3951
+ toString() {
3952
+ return this.value;
3953
+ }
3954
+ test(version) {
3955
+ debug("Comparator.test", version, this.options.loose);
3956
+ if (this.semver === ANY || version === ANY) return true;
3957
+ if (typeof version === "string") try {
3958
+ version = new SemVer(version, this.options);
3959
+ } catch (er) {
3960
+ return false;
3961
+ }
3962
+ return cmp(version, this.operator, this.semver, this.options);
3963
+ }
3964
+ intersects(comp, options) {
3965
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
3966
+ if (this.operator === "") {
3967
+ if (this.value === "") return true;
3968
+ return new Range(comp.value, options).test(this.value);
3969
+ } else if (comp.operator === "") {
3970
+ if (comp.value === "") return true;
3971
+ return new Range(this.value, options).test(comp.semver);
3972
+ }
3973
+ options = parseOptions(options);
3974
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
3975
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
3976
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
3977
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
3978
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
3979
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
3980
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
3981
+ return false;
3982
+ }
3983
+ };
3984
+ const parseOptions = require_parse_options();
3985
+ const { safeRe: re, t } = require_re();
3986
+ const cmp = require_cmp();
3987
+ const debug = require_debug();
3988
+ const SemVer = require_semver$1();
3989
+ const Range = require_range();
3990
+ }));
3991
+ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3992
+ const Range = require_range();
3993
+ const satisfies = (version, range, options) => {
3994
+ try {
3995
+ range = new Range(range, options);
3996
+ } catch (er) {
3997
+ return false;
3998
+ }
3999
+ return range.test(version);
4000
+ };
4001
+ module.exports = satisfies;
4002
+ }));
4003
+ var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4004
+ const Range = require_range();
4005
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
4006
+ module.exports = toComparators;
4007
+ }));
4008
+ var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4009
+ const SemVer = require_semver$1();
4010
+ const Range = require_range();
4011
+ const maxSatisfying = (versions, range, options) => {
4012
+ let max = null;
4013
+ let maxSV = null;
4014
+ let rangeObj = null;
4015
+ try {
4016
+ rangeObj = new Range(range, options);
4017
+ } catch (er) {
4018
+ return null;
4019
+ }
4020
+ versions.forEach((v) => {
4021
+ if (rangeObj.test(v)) {
4022
+ if (!max || maxSV.compare(v) === -1) {
4023
+ max = v;
4024
+ maxSV = new SemVer(max, options);
4025
+ }
4026
+ }
4027
+ });
4028
+ return max;
4029
+ };
4030
+ module.exports = maxSatisfying;
4031
+ }));
4032
+ var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4033
+ const SemVer = require_semver$1();
4034
+ const Range = require_range();
4035
+ const minSatisfying = (versions, range, options) => {
4036
+ let min = null;
4037
+ let minSV = null;
4038
+ let rangeObj = null;
4039
+ try {
4040
+ rangeObj = new Range(range, options);
4041
+ } catch (er) {
4042
+ return null;
4043
+ }
4044
+ versions.forEach((v) => {
4045
+ if (rangeObj.test(v)) {
4046
+ if (!min || minSV.compare(v) === 1) {
4047
+ min = v;
4048
+ minSV = new SemVer(min, options);
4049
+ }
4050
+ }
4051
+ });
4052
+ return min;
4053
+ };
4054
+ module.exports = minSatisfying;
4055
+ }));
4056
+ var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4057
+ const SemVer = require_semver$1();
4058
+ const Range = require_range();
4059
+ const gt = require_gt();
4060
+ const minVersion = (range, loose) => {
4061
+ range = new Range(range, loose);
4062
+ let minver = new SemVer("0.0.0");
4063
+ if (range.test(minver)) return minver;
4064
+ minver = new SemVer("0.0.0-0");
4065
+ if (range.test(minver)) return minver;
4066
+ minver = null;
4067
+ for (let i = 0; i < range.set.length; ++i) {
4068
+ const comparators = range.set[i];
4069
+ let setMin = null;
4070
+ comparators.forEach((comparator) => {
4071
+ const compver = new SemVer(comparator.semver.version);
4072
+ switch (comparator.operator) {
4073
+ case ">":
4074
+ if (compver.prerelease.length === 0) compver.patch++;
4075
+ else compver.prerelease.push(0);
4076
+ compver.raw = compver.format();
4077
+ case "":
4078
+ case ">=":
4079
+ if (!setMin || gt(compver, setMin)) setMin = compver;
4080
+ break;
4081
+ case "<":
4082
+ case "<=": break;
4083
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
4084
+ }
4085
+ });
4086
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
4087
+ }
4088
+ if (minver && range.test(minver)) return minver;
4089
+ return null;
4090
+ };
4091
+ module.exports = minVersion;
4092
+ }));
4093
+ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4094
+ const Range = require_range();
4095
+ const validRange = (range, options) => {
4096
+ try {
4097
+ return new Range(range, options).range || "*";
4098
+ } catch (er) {
4099
+ return null;
4100
+ }
4101
+ };
4102
+ module.exports = validRange;
4103
+ }));
4104
+ var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4105
+ const SemVer = require_semver$1();
4106
+ const Comparator = require_comparator();
4107
+ const { ANY } = Comparator;
4108
+ const Range = require_range();
4109
+ const satisfies = require_satisfies();
4110
+ const gt = require_gt();
4111
+ const lt = require_lt();
4112
+ const lte = require_lte();
4113
+ const gte = require_gte();
4114
+ const outside = (version, range, hilo, options) => {
4115
+ version = new SemVer(version, options);
4116
+ range = new Range(range, options);
4117
+ let gtfn, ltefn, ltfn, comp, ecomp;
4118
+ switch (hilo) {
4119
+ case ">":
4120
+ gtfn = gt;
4121
+ ltefn = lte;
4122
+ ltfn = lt;
4123
+ comp = ">";
4124
+ ecomp = ">=";
4125
+ break;
4126
+ case "<":
4127
+ gtfn = lt;
4128
+ ltefn = gte;
4129
+ ltfn = gt;
4130
+ comp = "<";
4131
+ ecomp = "<=";
4132
+ break;
4133
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
4134
+ }
4135
+ if (satisfies(version, range, options)) return false;
4136
+ for (let i = 0; i < range.set.length; ++i) {
4137
+ const comparators = range.set[i];
4138
+ let high = null;
4139
+ let low = null;
4140
+ comparators.forEach((comparator) => {
4141
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
4142
+ high = high || comparator;
4143
+ low = low || comparator;
4144
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
4145
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
4146
+ });
4147
+ if (high.operator === comp || high.operator === ecomp) return false;
4148
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
4149
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
4150
+ }
4151
+ return true;
4152
+ };
4153
+ module.exports = outside;
4154
+ }));
4155
+ var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4156
+ const outside = require_outside();
4157
+ const gtr = (version, range, options) => outside(version, range, ">", options);
4158
+ module.exports = gtr;
4159
+ }));
4160
+ var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4161
+ const outside = require_outside();
4162
+ const ltr = (version, range, options) => outside(version, range, "<", options);
4163
+ module.exports = ltr;
4164
+ }));
4165
+ var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4166
+ const Range = require_range();
4167
+ const intersects = (r1, r2, options) => {
4168
+ r1 = new Range(r1, options);
4169
+ r2 = new Range(r2, options);
4170
+ return r1.intersects(r2, options);
4171
+ };
4172
+ module.exports = intersects;
4173
+ }));
4174
+ var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4175
+ const satisfies = require_satisfies();
4176
+ const compare = require_compare();
4177
+ module.exports = (versions, range, options) => {
4178
+ const set = [];
4179
+ let first = null;
4180
+ let prev = null;
4181
+ const v = versions.sort((a, b) => compare(a, b, options));
4182
+ for (const version of v) if (satisfies(version, range, options)) {
4183
+ prev = version;
4184
+ if (!first) first = version;
4185
+ } else {
4186
+ if (prev) set.push([first, prev]);
4187
+ prev = null;
4188
+ first = null;
4189
+ }
4190
+ if (first) set.push([first, null]);
4191
+ const ranges = [];
4192
+ for (const [min, max] of set) if (min === max) ranges.push(min);
4193
+ else if (!max && min === v[0]) ranges.push("*");
4194
+ else if (!max) ranges.push(`>=${min}`);
4195
+ else if (min === v[0]) ranges.push(`<=${max}`);
4196
+ else ranges.push(`${min} - ${max}`);
4197
+ const simplified = ranges.join(" || ");
4198
+ const original = typeof range.raw === "string" ? range.raw : String(range);
4199
+ return simplified.length < original.length ? simplified : range;
4200
+ };
4201
+ }));
4202
+ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4203
+ const Range = require_range();
4204
+ const Comparator = require_comparator();
4205
+ const { ANY } = Comparator;
4206
+ const satisfies = require_satisfies();
4207
+ const compare = require_compare();
4208
+ const subset = (sub, dom, options = {}) => {
4209
+ if (sub === dom) return true;
4210
+ sub = new Range(sub, options);
4211
+ dom = new Range(dom, options);
4212
+ let sawNonNull = false;
4213
+ OUTER: for (const simpleSub of sub.set) {
4214
+ for (const simpleDom of dom.set) {
4215
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
4216
+ sawNonNull = sawNonNull || isSub !== null;
4217
+ if (isSub) continue OUTER;
4218
+ }
4219
+ if (sawNonNull) return false;
4220
+ }
4221
+ return true;
4222
+ };
4223
+ const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
4224
+ const minimumVersion = [new Comparator(">=0.0.0")];
4225
+ const simpleSubset = (sub, dom, options) => {
4226
+ if (sub === dom) return true;
4227
+ if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
4228
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
4229
+ else sub = minimumVersion;
4230
+ if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
4231
+ else dom = minimumVersion;
4232
+ const eqSet = /* @__PURE__ */ new Set();
4233
+ let gt, lt;
4234
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
4235
+ else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
4236
+ else eqSet.add(c.semver);
4237
+ if (eqSet.size > 1) return null;
4238
+ let gtltComp;
4239
+ if (gt && lt) {
4240
+ gtltComp = compare(gt.semver, lt.semver, options);
4241
+ if (gtltComp > 0) return null;
4242
+ else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
4243
+ }
4244
+ for (const eq of eqSet) {
4245
+ if (gt && !satisfies(eq, String(gt), options)) return null;
4246
+ if (lt && !satisfies(eq, String(lt), options)) return null;
4247
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
4248
+ return true;
4249
+ }
4250
+ let higher, lower;
4251
+ let hasDomLT, hasDomGT;
4252
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
4253
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
4254
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
4255
+ for (const c of dom) {
4256
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
4257
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
4258
+ if (gt) {
4259
+ if (needDomGTPre) {
4260
+ 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;
4261
+ }
4262
+ if (c.operator === ">" || c.operator === ">=") {
4263
+ higher = higherGT(gt, c, options);
4264
+ if (higher === c && higher !== gt) return false;
4265
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
4266
+ }
4267
+ if (lt) {
4268
+ if (needDomLTPre) {
4269
+ 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;
4270
+ }
4271
+ if (c.operator === "<" || c.operator === "<=") {
4272
+ lower = lowerLT(lt, c, options);
4273
+ if (lower === c && lower !== lt) return false;
4274
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
4275
+ }
4276
+ if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
4277
+ }
4278
+ if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
4279
+ if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
4280
+ if (needDomGTPre || needDomLTPre) return false;
4281
+ return true;
4282
+ };
4283
+ const higherGT = (a, b, options) => {
4284
+ if (!a) return b;
4285
+ const comp = compare(a.semver, b.semver, options);
4286
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
4287
+ };
4288
+ const lowerLT = (a, b, options) => {
4289
+ if (!a) return b;
4290
+ const comp = compare(a.semver, b.semver, options);
4291
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
4292
+ };
4293
+ module.exports = subset;
4294
+ }));
4295
+ var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4296
+ const internalRe = require_re();
4297
+ const constants = require_constants();
4298
+ const SemVer = require_semver$1();
4299
+ const identifiers = require_identifiers();
4300
+ module.exports = {
4301
+ parse: require_parse(),
4302
+ valid: require_valid$1(),
4303
+ clean: require_clean(),
4304
+ inc: require_inc(),
4305
+ diff: require_diff(),
4306
+ major: require_major(),
4307
+ minor: require_minor(),
4308
+ patch: require_patch(),
4309
+ prerelease: require_prerelease(),
4310
+ compare: require_compare(),
4311
+ rcompare: require_rcompare(),
4312
+ compareLoose: require_compare_loose(),
4313
+ compareBuild: require_compare_build(),
4314
+ sort: require_sort(),
4315
+ rsort: require_rsort(),
4316
+ gt: require_gt(),
4317
+ lt: require_lt(),
4318
+ eq: require_eq(),
4319
+ neq: require_neq(),
4320
+ gte: require_gte(),
4321
+ lte: require_lte(),
4322
+ cmp: require_cmp(),
4323
+ coerce: require_coerce(),
4324
+ Comparator: require_comparator(),
4325
+ Range: require_range(),
4326
+ satisfies: require_satisfies(),
4327
+ toComparators: require_to_comparators(),
4328
+ maxSatisfying: require_max_satisfying(),
4329
+ minSatisfying: require_min_satisfying(),
4330
+ minVersion: require_min_version(),
4331
+ validRange: require_valid(),
4332
+ outside: require_outside(),
4333
+ gtr: require_gtr(),
4334
+ ltr: require_ltr(),
4335
+ intersects: require_intersects(),
4336
+ simplifyRange: require_simplify(),
4337
+ subset: require_subset(),
4338
+ SemVer,
4339
+ re: internalRe.re,
4340
+ src: internalRe.src,
4341
+ tokens: internalRe.t,
4342
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
4343
+ RELEASE_TYPES: constants.RELEASE_TYPES,
4344
+ compareIdentifiers: identifiers.compareIdentifiers,
4345
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
4346
+ };
4347
+ })))(), 1);
4348
+ const semverSatisfies = (targetAppVersion, currentVersion) => {
4349
+ const currentCoerce = import_semver.default.coerce(currentVersion);
4350
+ if (!currentCoerce) return false;
4351
+ return import_semver.default.satisfies(currentCoerce.version, targetAppVersion);
4352
+ };
4353
+ const INIT_BUNDLE_ROLLBACK_UPDATE_INFO$1 = {
4354
+ message: null,
4355
+ id: NIL_UUID,
4356
+ shouldForceUpdate: true,
4357
+ status: "ROLLBACK",
4358
+ storageUri: null,
4359
+ fileHash: null
4360
+ };
4361
+ const makeResponse$1 = (bundle, status) => ({
4362
+ id: bundle.id,
4363
+ message: bundle.message,
4364
+ shouldForceUpdate: status === "ROLLBACK" ? true : bundle.shouldForceUpdate,
4365
+ status,
4366
+ storageUri: bundle.storageUri,
4367
+ fileHash: bundle.fileHash
4368
+ });
4369
+ const isEligibleUpdateCandidate = (bundle, cohort) => {
4370
+ return isCohortEligibleForUpdate(bundle.id, cohort, bundle.rolloutCohortCount, bundle.targetCohorts);
4371
+ };
4372
+ const findLatestEligibleUpdateCandidate = (bundles, bundleId, cohort) => {
4373
+ let updateCandidate = null;
4374
+ for (const bundle of bundles) if (bundle.id.localeCompare(bundleId) > 0 && isEligibleUpdateCandidate(bundle, cohort) && (!updateCandidate || bundle.id.localeCompare(updateCandidate.id) > 0)) updateCandidate = bundle;
4375
+ return updateCandidate;
4376
+ };
4377
+ const getUpdateInfo = async (bundles, args) => {
4378
+ switch (args._updateStrategy) {
4379
+ case "appVersion": return appVersionStrategy(bundles, args);
4380
+ case "fingerprint": return fingerprintStrategy(bundles, args);
4381
+ default: return null;
4382
+ }
4383
+ };
4384
+ const appVersionStrategy = async (bundles, { channel = "production", minBundleId = NIL_UUID, platform, appVersion, bundleId, cohort }) => {
4385
+ const candidateBundles = [];
4386
+ for (const b of bundles) {
4387
+ if (b.platform !== platform || b.channel !== channel || !b.targetAppVersion || !semverSatisfies(b.targetAppVersion, appVersion) || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;
4388
+ candidateBundles.push(b);
4389
+ }
4390
+ if (candidateBundles.length === 0) {
4391
+ if (bundleId === "00000000-0000-0000-0000-000000000000" || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4392
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO$1;
4393
+ }
4394
+ let rollbackCandidate = null;
4395
+ let currentBundle;
4396
+ for (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;
4397
+ else if (bundleId !== "00000000-0000-0000-0000-000000000000" && b.id.localeCompare(bundleId) < 0) {
4398
+ if (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;
4399
+ }
4400
+ const updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);
4401
+ const currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;
4402
+ if (bundleId === "00000000-0000-0000-0000-000000000000") {
4403
+ if (updateCandidate) return makeResponse$1(updateCandidate, "UPDATE");
4404
+ return null;
4405
+ }
4406
+ if (currentBundleEligible) {
4407
+ if (updateCandidate) return makeResponse$1(updateCandidate, "UPDATE");
4408
+ return null;
4409
+ }
4410
+ if (updateCandidate) return makeResponse$1(updateCandidate, "UPDATE");
4411
+ if (rollbackCandidate) return makeResponse$1(rollbackCandidate, "ROLLBACK");
4412
+ if (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4413
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO$1;
4414
+ };
4415
+ const fingerprintStrategy = async (bundles, { channel = "production", minBundleId = NIL_UUID, platform, fingerprintHash, bundleId, cohort }) => {
4416
+ const candidateBundles = [];
4417
+ for (const b of bundles) {
4418
+ if (b.platform !== platform || b.channel !== channel || !b.fingerprintHash || b.fingerprintHash !== fingerprintHash || !b.enabled || minBundleId && b.id.localeCompare(minBundleId) < 0) continue;
4419
+ candidateBundles.push(b);
4420
+ }
4421
+ if (candidateBundles.length === 0) {
4422
+ if (bundleId === "00000000-0000-0000-0000-000000000000" || minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4423
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO$1;
4424
+ }
4425
+ let rollbackCandidate = null;
4426
+ let currentBundle;
4427
+ for (const b of candidateBundles) if (b.id === bundleId) currentBundle = b;
4428
+ else if (bundleId !== "00000000-0000-0000-0000-000000000000" && b.id.localeCompare(bundleId) < 0) {
4429
+ if (!rollbackCandidate || b.id.localeCompare(rollbackCandidate.id) > 0) rollbackCandidate = b;
4430
+ }
4431
+ const updateCandidate = findLatestEligibleUpdateCandidate(candidateBundles, bundleId, cohort);
4432
+ const currentBundleEligible = currentBundle ? isEligibleUpdateCandidate(currentBundle, cohort) : false;
4433
+ if (bundleId === "00000000-0000-0000-0000-000000000000") {
4434
+ if (updateCandidate) return makeResponse$1(updateCandidate, "UPDATE");
4435
+ return null;
4436
+ }
4437
+ if (currentBundleEligible) {
4438
+ if (updateCandidate) return makeResponse$1(updateCandidate, "UPDATE");
4439
+ return null;
4440
+ }
4441
+ if (updateCandidate) return makeResponse$1(updateCandidate, "UPDATE");
4442
+ if (rollbackCandidate) return makeResponse$1(rollbackCandidate, "ROLLBACK");
4443
+ if (minBundleId && bundleId.localeCompare(minBundleId) <= 0) return null;
4444
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO$1;
4445
+ };
4446
+ new TextEncoder();
4447
+ new TextDecoder();
4448
+ const day = 3600 * 24;
4449
+ day * 7;
4450
+ day * 365.25;
4451
+ //#endregion
4452
+ //#region ../plugin-core/dist/createBlobDatabasePlugin.mjs
4453
+ function removeBundleInternalKeys(bundle) {
4454
+ const { _updateJsonKey, _oldUpdateJsonKey, ...pureBundle } = bundle;
4455
+ return pureBundle;
4456
+ }
4457
+ function normalizeTargetAppVersion(version) {
4458
+ if (!version) return null;
4459
+ let normalized = version.replace(/\s+/g, " ").trim();
4460
+ normalized = normalized.replace(/([><=~^]+)\s+(\d)/g, (_match, operator, digit) => `${operator}${digit}`);
4461
+ return normalized;
4462
+ }
4463
+ function isExactVersion(version) {
4464
+ if (!version) return false;
4465
+ const normalized = normalizeTargetAppVersion(version);
4466
+ if (!normalized) return false;
4467
+ return import_semver$1.default.valid(normalized) !== null;
4468
+ }
4469
+ /**
4470
+ * Get all normalized semver versions for a version string.
4471
+ * This handles the case where clients may request with different normalized forms.
4472
+ *
4473
+ * Examples:
4474
+ * - "1.0.0" generates ["1.0.0", "1.0", "1"]
4475
+ * - "2.1.0" generates ["2.1.0", "2.1"]
4476
+ * - "1.2.3" generates ["1.2.3"]
4477
+ */
4478
+ function getSemverNormalizedVersions(version) {
4479
+ const normalized = normalizeTargetAppVersion(version) || version;
4480
+ const coerced = import_semver$1.default.coerce(normalized);
4481
+ if (!coerced) return [normalized];
4482
+ const versions = /* @__PURE__ */ new Set();
4483
+ versions.add(coerced.version);
4484
+ if (coerced.patch === 0) versions.add(`${coerced.major}.${coerced.minor}`);
4485
+ if (coerced.minor === 0 && coerced.patch === 0) versions.add(`${coerced.major}`);
4486
+ return Array.from(versions);
4487
+ }
4488
+ function resolveStorageTarget({ targetAppVersion, fingerprintHash }) {
3078
4489
  const target = normalizeTargetAppVersion(targetAppVersion) ?? fingerprintHash;
3079
4490
  if (!target) throw new Error("target not found");
3080
4491
  return target;
@@ -3149,6 +4560,31 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
3149
4560
  const pattern = channel ? platform ? new RegExp(`^${channel}/${platform}/[^/]+/update\\.json$`) : new RegExp(`^${channel}/[^/]+/[^/]+/update\\.json$`) : platform ? new RegExp(`^[^/]+/${platform}/[^/]+/update\\.json$`) : /^[^/]+\/[^/]+\/[^/]+\/update\.json$/;
3150
4561
  return listObjects(prefix).then((keys) => keys.filter((key) => pattern.test(key)));
3151
4562
  }
4563
+ const getAppVersionUpdateInfo = async ({ appVersion, bundleId, channel = "production", cohort, minBundleId, platform }) => {
4564
+ const matchingVersions = filterCompatibleAppVersions(await loadObject(`${channel}/${platform}/target-app-versions.json`) ?? [], appVersion);
4565
+ return getUpdateInfo((await Promise.allSettled(matchingVersions.map(async (targetAppVersion) => {
4566
+ return await loadObject(`${channel}/${platform}/${normalizeTargetAppVersion(targetAppVersion) ?? targetAppVersion}/update.json`) ?? [];
4567
+ }))).filter((entry) => entry.status === "fulfilled").flatMap((entry) => entry.value), {
4568
+ _updateStrategy: "appVersion",
4569
+ appVersion,
4570
+ bundleId,
4571
+ channel,
4572
+ cohort,
4573
+ minBundleId,
4574
+ platform
4575
+ });
4576
+ };
4577
+ const getFingerprintUpdateInfo = async ({ bundleId, channel = "production", cohort, fingerprintHash, minBundleId, platform }) => {
4578
+ return getUpdateInfo(await loadObject(`${channel}/${platform}/${fingerprintHash}/update.json`) ?? [], {
4579
+ _updateStrategy: "fingerprint",
4580
+ bundleId,
4581
+ channel,
4582
+ cohort,
4583
+ fingerprintHash,
4584
+ minBundleId,
4585
+ platform
4586
+ });
4587
+ };
3152
4588
  const addAppVersionInvalidationPaths = (pathsToInvalidate, { platform, channel, targetAppVersion }) => {
3153
4589
  if (!isExactVersion(targetAppVersion)) {
3154
4590
  pathsToInvalidate.add(`${apiBasePath}/app-version/${platform}/*`);
@@ -3178,6 +4614,10 @@ const createBlobDatabasePlugin = ({ name, factory }) => {
3178
4614
  if (bundle) return removeBundleInternalKeys(bundle);
3179
4615
  return (await reloadBundles()).find((bundle) => bundle.id === bundleId) ?? null;
3180
4616
  },
4617
+ async getUpdateInfo(args) {
4618
+ if (args._updateStrategy === "appVersion") return getAppVersionUpdateInfo(args);
4619
+ return getFingerprintUpdateInfo(args);
4620
+ },
3181
4621
  async getBundles(options) {
3182
4622
  let allBundles = await reloadBundles();
3183
4623
  const { where, limit, offset, orderBy } = options;
@@ -3367,13 +4807,6 @@ const createStoragePlugin = (options) => {
3367
4807
  };
3368
4808
  };
3369
4809
  //#endregion
3370
- //#region ../plugin-core/dist/semverSatisfies.mjs
3371
- const semverSatisfies = (targetAppVersion, currentVersion) => {
3372
- const currentCoerce = import_semver.default.coerce(currentVersion);
3373
- if (!currentCoerce) return false;
3374
- return import_semver.default.satisfies(currentCoerce.version, targetAppVersion);
3375
- };
3376
- //#endregion
3377
4810
  //#region ../plugin-core/dist/parseStorageUri.mjs
3378
4811
  /**
3379
4812
  * Parses a storage URI and validates the protocol.
@@ -3519,6 +4952,8 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
3519
4952
  return getPlugin().getBundleById(id, context);
3520
4953
  },
3521
4954
  async getUpdateInfo(args, context) {
4955
+ const directGetUpdateInfo = getPlugin().getUpdateInfo;
4956
+ if (directGetUpdateInfo) return context === void 0 ? await directGetUpdateInfo(args) : await directGetUpdateInfo(args, context);
3522
4957
  const channel = args.channel ?? "production";
3523
4958
  const minBundleId = args.minBundleId ?? "00000000-0000-0000-0000-000000000000";
3524
4959
  const baseWhere = getBaseWhere({
@@ -3542,7 +4977,7 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
3542
4977
  queryWhere: { ...baseWhere },
3543
4978
  context,
3544
4979
  isCandidate: (bundle) => {
3545
- return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && !!bundle.targetAppVersion && semverSatisfies(bundle.targetAppVersion, args.appVersion);
4980
+ return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && !!bundle.targetAppVersion && semverSatisfies$1(bundle.targetAppVersion, args.appVersion);
3546
4981
  }
3547
4982
  });
3548
4983
  },