@hot-updater/aws 0.30.12 → 0.31.0

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.
@@ -36,98 +36,6 @@ 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");
39
- //#region ../../packages/core/dist/index.mjs
40
- const NUMERIC_COHORT_SIZE = 1e3;
41
- const DEFAULT_ROLLOUT_COHORT_COUNT = NUMERIC_COHORT_SIZE;
42
- function parseNumericCohortValue(cohort) {
43
- if (!/^\d+$/.test(cohort)) return null;
44
- const parsed = Number.parseInt(cohort, 10);
45
- if (Number.isNaN(parsed) || parsed < 1 || parsed > 1e3) return null;
46
- return parsed;
47
- }
48
- function positiveMod(value, modulus) {
49
- return (value % modulus + modulus) % modulus;
50
- }
51
- function hashString(value) {
52
- let hash = 0;
53
- for (let i = 0; i < value.length; i++) {
54
- const char = value.charCodeAt(i);
55
- hash = (hash << 5) - hash + char;
56
- hash |= 0;
57
- }
58
- return hash;
59
- }
60
- function gcd(a, b) {
61
- let x = Math.abs(a);
62
- let y = Math.abs(b);
63
- while (y !== 0) {
64
- const next = x % y;
65
- x = y;
66
- y = next;
67
- }
68
- return x;
69
- }
70
- function modularInverse(value, modulus) {
71
- let t = 0;
72
- let newT = 1;
73
- let r = modulus;
74
- let newR = positiveMod(value, modulus);
75
- while (newR !== 0) {
76
- const quotient = Math.floor(r / newR);
77
- [t, newT] = [newT, t - quotient * newT];
78
- [r, newR] = [newR, r - quotient * newR];
79
- }
80
- if (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);
81
- return positiveMod(t, modulus);
82
- }
83
- function getRolloutShuffleParameters(bundleId) {
84
- let multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);
85
- if (multiplier === 0) multiplier = 1;
86
- while (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {
87
- multiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);
88
- if (multiplier === 0) multiplier = 1;
89
- }
90
- const offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);
91
- return {
92
- multiplier,
93
- offset,
94
- inverseMultiplier: modularInverse(multiplier, NUMERIC_COHORT_SIZE)
95
- };
96
- }
97
- function normalizeRolloutCohortCount(rolloutCohortCount) {
98
- if (rolloutCohortCount === null || rolloutCohortCount === void 0) return DEFAULT_ROLLOUT_COHORT_COUNT;
99
- if (rolloutCohortCount <= 0) return 0;
100
- if (rolloutCohortCount >= 1e3) return NUMERIC_COHORT_SIZE;
101
- return Math.floor(rolloutCohortCount);
102
- }
103
- function normalizeCohortValue(cohort) {
104
- const normalized = cohort.trim().toLowerCase();
105
- const numericCohort = parseNumericCohortValue(normalized);
106
- if (numericCohort !== null) return String(numericCohort);
107
- return normalized;
108
- }
109
- function getNumericCohortValue(cohort) {
110
- return parseNumericCohortValue(normalizeCohortValue(cohort));
111
- }
112
- function getNumericCohortRolloutPosition(bundleId, cohortValue) {
113
- if (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);
114
- const { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);
115
- return positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);
116
- }
117
- function isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetCohorts) {
118
- const normalizedCohort = cohort === null || cohort === void 0 ? void 0 : normalizeCohortValue(cohort);
119
- const normalizedTargetCohorts = targetCohorts?.map((targetCohort) => normalizeCohortValue(targetCohort)) ?? [];
120
- if (normalizedCohort !== void 0 && normalizedTargetCohorts.includes(normalizedCohort)) return true;
121
- const normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);
122
- if (normalizedRolloutCount <= 0) return false;
123
- if (normalizedCohort === void 0) return normalizedRolloutCount >= NUMERIC_COHORT_SIZE;
124
- const numericCohort = getNumericCohortValue(normalizedCohort);
125
- if (numericCohort === null) return false;
126
- if (normalizedRolloutCount >= 1e3) return true;
127
- return getNumericCohortRolloutPosition(bundleId, numericCohort) < normalizedRolloutCount;
128
- }
129
- const NIL_UUID = "00000000-0000-0000-0000-000000000000";
130
- //#endregion
131
39
  //#region ../plugin-core/dist/calculatePagination.mjs
132
40
  /**
133
41
  * Calculate pagination information based on total count, limit, and offset
@@ -1576,7 +1484,7 @@ function mergeWith(target, source, merge) {
1576
1484
  }
1577
1485
  //#endregion
1578
1486
  //#region ../plugin-core/dist/createDatabasePlugin.mjs
1579
- const REPLACE_ON_UPDATE_KEYS = ["targetCohorts"];
1487
+ const REPLACE_ON_UPDATE_KEYS = ["patches", "targetCohorts"];
1580
1488
  const DEFAULT_DESC_ORDER$1 = {
1581
1489
  field: "id",
1582
1490
  direction: "desc"
@@ -1841,7 +1749,7 @@ function createDatabasePlugin(options) {
1841
1749
  }
1842
1750
  //#endregion
1843
1751
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js
1844
- var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1752
+ var require_constants$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1845
1753
  const SEMVER_SPEC_VERSION = "2.0.0";
1846
1754
  const MAX_LENGTH = 256;
1847
1755
  const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
@@ -1866,14 +1774,14 @@ var require_constants$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
1866
1774
  }));
1867
1775
  //#endregion
1868
1776
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js
1869
- var require_debug$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1777
+ var require_debug$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1870
1778
  module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
1871
1779
  }));
1872
1780
  //#endregion
1873
1781
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js
1874
- var require_re$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1875
- const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants$1();
1876
- const debug = require_debug$1();
1782
+ var require_re$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1783
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants$2();
1784
+ const debug = require_debug$2();
1877
1785
  exports = module.exports = {};
1878
1786
  const re = exports.re = [];
1879
1787
  const safeRe = exports.safeRe = [];
@@ -1950,7 +1858,7 @@ var require_re$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1950
1858
  }));
1951
1859
  //#endregion
1952
1860
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js
1953
- var require_parse_options$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1861
+ var require_parse_options$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1954
1862
  const looseOption = Object.freeze({ loose: true });
1955
1863
  const emptyOpts = Object.freeze({});
1956
1864
  const parseOptions = (options) => {
@@ -1962,7 +1870,7 @@ var require_parse_options$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module)
1962
1870
  }));
1963
1871
  //#endregion
1964
1872
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js
1965
- var require_identifiers$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1873
+ var require_identifiers$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1966
1874
  const numeric = /^[0-9]+$/;
1967
1875
  const compareIdentifiers = (a, b) => {
1968
1876
  const anum = numeric.test(a);
@@ -1981,12 +1889,12 @@ var require_identifiers$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
1981
1889
  }));
1982
1890
  //#endregion
1983
1891
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js
1984
- var require_semver$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1985
- const debug = require_debug$1();
1986
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants$1();
1987
- const { safeRe: re, t } = require_re$1();
1988
- const parseOptions = require_parse_options$1();
1989
- const { compareIdentifiers } = require_identifiers$1();
1892
+ var require_semver$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
1893
+ const debug = require_debug$2();
1894
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants$2();
1895
+ const { safeRe: re, t } = require_re$2();
1896
+ const parseOptions = require_parse_options$2();
1897
+ const { compareIdentifiers } = require_identifiers$2();
1990
1898
  module.exports = class SemVer {
1991
1899
  constructor(version, options) {
1992
1900
  options = parseOptions(options);
@@ -2153,8 +2061,8 @@ var require_semver$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2153
2061
  }));
2154
2062
  //#endregion
2155
2063
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js
2156
- var require_parse$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2157
- const SemVer = require_semver$2();
2064
+ var require_parse$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2065
+ const SemVer = require_semver$3();
2158
2066
  const parse = (version, options, throwErrors = false) => {
2159
2067
  if (version instanceof SemVer) return version;
2160
2068
  try {
@@ -2168,8 +2076,8 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2168
2076
  }));
2169
2077
  //#endregion
2170
2078
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js
2171
- var require_valid$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2172
- const parse = require_parse$1();
2079
+ var require_valid$4 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2080
+ const parse = require_parse$2();
2173
2081
  const valid = (version, options) => {
2174
2082
  const v = parse(version, options);
2175
2083
  return v ? v.version : null;
@@ -2178,8 +2086,8 @@ var require_valid$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2178
2086
  }));
2179
2087
  //#endregion
2180
2088
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js
2181
- var require_clean$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2182
- const parse = require_parse$1();
2089
+ var require_clean$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2090
+ const parse = require_parse$2();
2183
2091
  const clean = (version, options) => {
2184
2092
  const s = parse(version.trim().replace(/^[=v]+/, ""), options);
2185
2093
  return s ? s.version : null;
@@ -2188,8 +2096,8 @@ var require_clean$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2188
2096
  }));
2189
2097
  //#endregion
2190
2098
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js
2191
- var require_inc$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2192
- const SemVer = require_semver$2();
2099
+ var require_inc$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2100
+ const SemVer = require_semver$3();
2193
2101
  const inc = (version, release, options, identifier, identifierBase) => {
2194
2102
  if (typeof options === "string") {
2195
2103
  identifierBase = identifier;
@@ -2206,8 +2114,8 @@ var require_inc$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2206
2114
  }));
2207
2115
  //#endregion
2208
2116
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js
2209
- var require_diff$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2210
- const parse = require_parse$1();
2117
+ var require_diff$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2118
+ const parse = require_parse$2();
2211
2119
  const diff = (version1, version2) => {
2212
2120
  const v1 = parse(version1, null, true);
2213
2121
  const v2 = parse(version2, null, true);
@@ -2234,29 +2142,29 @@ var require_diff$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2234
2142
  }));
2235
2143
  //#endregion
2236
2144
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js
2237
- var require_major$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2238
- const SemVer = require_semver$2();
2145
+ var require_major$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2146
+ const SemVer = require_semver$3();
2239
2147
  const major = (a, loose) => new SemVer(a, loose).major;
2240
2148
  module.exports = major;
2241
2149
  }));
2242
2150
  //#endregion
2243
2151
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js
2244
- var require_minor$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2245
- const SemVer = require_semver$2();
2152
+ var require_minor$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2153
+ const SemVer = require_semver$3();
2246
2154
  const minor = (a, loose) => new SemVer(a, loose).minor;
2247
2155
  module.exports = minor;
2248
2156
  }));
2249
2157
  //#endregion
2250
2158
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js
2251
- var require_patch$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2252
- const SemVer = require_semver$2();
2159
+ var require_patch$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2160
+ const SemVer = require_semver$3();
2253
2161
  const patch = (a, loose) => new SemVer(a, loose).patch;
2254
2162
  module.exports = patch;
2255
2163
  }));
2256
2164
  //#endregion
2257
2165
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js
2258
- var require_prerelease$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2259
- const parse = require_parse$1();
2166
+ var require_prerelease$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2167
+ const parse = require_parse$2();
2260
2168
  const prerelease = (version, options) => {
2261
2169
  const parsed = parse(version, options);
2262
2170
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
@@ -2265,29 +2173,29 @@ var require_prerelease$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
2265
2173
  }));
2266
2174
  //#endregion
2267
2175
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js
2268
- var require_compare$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2269
- const SemVer = require_semver$2();
2176
+ var require_compare$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2177
+ const SemVer = require_semver$3();
2270
2178
  const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
2271
2179
  module.exports = compare;
2272
2180
  }));
2273
2181
  //#endregion
2274
2182
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js
2275
- var require_rcompare$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2276
- const compare = require_compare$1();
2183
+ var require_rcompare$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2184
+ const compare = require_compare$2();
2277
2185
  const rcompare = (a, b, loose) => compare(b, a, loose);
2278
2186
  module.exports = rcompare;
2279
2187
  }));
2280
2188
  //#endregion
2281
2189
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js
2282
- var require_compare_loose$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2283
- const compare = require_compare$1();
2190
+ var require_compare_loose$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2191
+ const compare = require_compare$2();
2284
2192
  const compareLoose = (a, b) => compare(a, b, true);
2285
2193
  module.exports = compareLoose;
2286
2194
  }));
2287
2195
  //#endregion
2288
2196
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js
2289
- var require_compare_build$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2290
- const SemVer = require_semver$2();
2197
+ var require_compare_build$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2198
+ const SemVer = require_semver$3();
2291
2199
  const compareBuild = (a, b, loose) => {
2292
2200
  const versionA = new SemVer(a, loose);
2293
2201
  const versionB = new SemVer(b, loose);
@@ -2297,69 +2205,69 @@ var require_compare_build$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module)
2297
2205
  }));
2298
2206
  //#endregion
2299
2207
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js
2300
- var require_sort$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2301
- const compareBuild = require_compare_build$1();
2208
+ var require_sort$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2209
+ const compareBuild = require_compare_build$2();
2302
2210
  const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
2303
2211
  module.exports = sort;
2304
2212
  }));
2305
2213
  //#endregion
2306
2214
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js
2307
- var require_rsort$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2308
- const compareBuild = require_compare_build$1();
2215
+ var require_rsort$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2216
+ const compareBuild = require_compare_build$2();
2309
2217
  const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
2310
2218
  module.exports = rsort;
2311
2219
  }));
2312
2220
  //#endregion
2313
2221
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js
2314
- var require_gt$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2315
- const compare = require_compare$1();
2222
+ var require_gt$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2223
+ const compare = require_compare$2();
2316
2224
  const gt = (a, b, loose) => compare(a, b, loose) > 0;
2317
2225
  module.exports = gt;
2318
2226
  }));
2319
2227
  //#endregion
2320
2228
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js
2321
- var require_lt$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2322
- const compare = require_compare$1();
2229
+ var require_lt$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2230
+ const compare = require_compare$2();
2323
2231
  const lt = (a, b, loose) => compare(a, b, loose) < 0;
2324
2232
  module.exports = lt;
2325
2233
  }));
2326
2234
  //#endregion
2327
2235
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js
2328
- var require_eq$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2329
- const compare = require_compare$1();
2236
+ var require_eq$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2237
+ const compare = require_compare$2();
2330
2238
  const eq = (a, b, loose) => compare(a, b, loose) === 0;
2331
2239
  module.exports = eq;
2332
2240
  }));
2333
2241
  //#endregion
2334
2242
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js
2335
- var require_neq$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2336
- const compare = require_compare$1();
2243
+ var require_neq$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2244
+ const compare = require_compare$2();
2337
2245
  const neq = (a, b, loose) => compare(a, b, loose) !== 0;
2338
2246
  module.exports = neq;
2339
2247
  }));
2340
2248
  //#endregion
2341
2249
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js
2342
- var require_gte$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2343
- const compare = require_compare$1();
2250
+ var require_gte$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2251
+ const compare = require_compare$2();
2344
2252
  const gte = (a, b, loose) => compare(a, b, loose) >= 0;
2345
2253
  module.exports = gte;
2346
2254
  }));
2347
2255
  //#endregion
2348
2256
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js
2349
- var require_lte$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2350
- const compare = require_compare$1();
2257
+ var require_lte$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2258
+ const compare = require_compare$2();
2351
2259
  const lte = (a, b, loose) => compare(a, b, loose) <= 0;
2352
2260
  module.exports = lte;
2353
2261
  }));
2354
2262
  //#endregion
2355
2263
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js
2356
- var require_cmp$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2357
- const eq = require_eq$1();
2358
- const neq = require_neq$1();
2359
- const gt = require_gt$1();
2360
- const gte = require_gte$1();
2361
- const lt = require_lt$1();
2362
- const lte = require_lte$1();
2264
+ var require_cmp$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2265
+ const eq = require_eq$2();
2266
+ const neq = require_neq$2();
2267
+ const gt = require_gt$2();
2268
+ const gte = require_gte$2();
2269
+ const lt = require_lt$2();
2270
+ const lte = require_lte$2();
2363
2271
  const cmp = (a, op, b, loose) => {
2364
2272
  switch (op) {
2365
2273
  case "===":
@@ -2385,10 +2293,10 @@ var require_cmp$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2385
2293
  }));
2386
2294
  //#endregion
2387
2295
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js
2388
- var require_coerce$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2389
- const SemVer = require_semver$2();
2390
- const parse = require_parse$1();
2391
- const { safeRe: re, t } = require_re$1();
2296
+ var require_coerce$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2297
+ const SemVer = require_semver$3();
2298
+ const parse = require_parse$2();
2299
+ const { safeRe: re, t } = require_re$2();
2392
2300
  const coerce = (version, options) => {
2393
2301
  if (version instanceof SemVer) return version;
2394
2302
  if (typeof version === "number") version = String(version);
@@ -2413,7 +2321,7 @@ var require_coerce$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2413
2321
  }));
2414
2322
  //#endregion
2415
2323
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js
2416
- var require_lrucache$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2324
+ var require_lrucache$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2417
2325
  var LRUCache = class {
2418
2326
  constructor() {
2419
2327
  this.max = 1e3;
@@ -2446,7 +2354,7 @@ var require_lrucache$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2446
2354
  }));
2447
2355
  //#endregion
2448
2356
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js
2449
- var require_range$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2357
+ var require_range$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2450
2358
  const SPACE_CHARACTERS = /\s+/g;
2451
2359
  module.exports = class Range {
2452
2360
  constructor(range, options) {
@@ -2552,13 +2460,13 @@ var require_range$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2552
2460
  return false;
2553
2461
  }
2554
2462
  };
2555
- const cache = new (require_lrucache$1())();
2556
- const parseOptions = require_parse_options$1();
2557
- const Comparator = require_comparator$1();
2558
- const debug = require_debug$1();
2559
- const SemVer = require_semver$2();
2560
- const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re$1();
2561
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants$1();
2463
+ const cache = new (require_lrucache$2())();
2464
+ const parseOptions = require_parse_options$2();
2465
+ const Comparator = require_comparator$2();
2466
+ const debug = require_debug$2();
2467
+ const SemVer = require_semver$3();
2468
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re$2();
2469
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants$2();
2562
2470
  const isNullSet = (c) => c.value === "<0.0.0-0";
2563
2471
  const isAny = (c) => c.value === "";
2564
2472
  const isSatisfiable = (comparators, options) => {
@@ -2717,7 +2625,7 @@ var require_range$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2717
2625
  }));
2718
2626
  //#endregion
2719
2627
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js
2720
- var require_comparator$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2628
+ var require_comparator$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2721
2629
  const ANY = Symbol("SemVer ANY");
2722
2630
  module.exports = class Comparator {
2723
2631
  static get ANY() {
@@ -2778,17 +2686,17 @@ var require_comparator$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
2778
2686
  return false;
2779
2687
  }
2780
2688
  };
2781
- const parseOptions = require_parse_options$1();
2782
- const { safeRe: re, t } = require_re$1();
2783
- const cmp = require_cmp$1();
2784
- const debug = require_debug$1();
2785
- const SemVer = require_semver$2();
2786
- const Range = require_range$1();
2689
+ const parseOptions = require_parse_options$2();
2690
+ const { safeRe: re, t } = require_re$2();
2691
+ const cmp = require_cmp$2();
2692
+ const debug = require_debug$2();
2693
+ const SemVer = require_semver$3();
2694
+ const Range = require_range$2();
2787
2695
  }));
2788
2696
  //#endregion
2789
2697
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js
2790
- var require_satisfies$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2791
- const Range = require_range$1();
2698
+ var require_satisfies$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2699
+ const Range = require_range$2();
2792
2700
  const satisfies = (version, range, options) => {
2793
2701
  try {
2794
2702
  range = new Range(range, options);
@@ -2801,16 +2709,16 @@ var require_satisfies$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
2801
2709
  }));
2802
2710
  //#endregion
2803
2711
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js
2804
- var require_to_comparators$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2805
- const Range = require_range$1();
2712
+ var require_to_comparators$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2713
+ const Range = require_range$2();
2806
2714
  const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
2807
2715
  module.exports = toComparators;
2808
2716
  }));
2809
2717
  //#endregion
2810
2718
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js
2811
- var require_max_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2812
- const SemVer = require_semver$2();
2813
- const Range = require_range$1();
2719
+ var require_max_satisfying$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2720
+ const SemVer = require_semver$3();
2721
+ const Range = require_range$2();
2814
2722
  const maxSatisfying = (versions, range, options) => {
2815
2723
  let max = null;
2816
2724
  let maxSV = null;
@@ -2834,9 +2742,9 @@ var require_max_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module
2834
2742
  }));
2835
2743
  //#endregion
2836
2744
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js
2837
- var require_min_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2838
- const SemVer = require_semver$2();
2839
- const Range = require_range$1();
2745
+ var require_min_satisfying$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2746
+ const SemVer = require_semver$3();
2747
+ const Range = require_range$2();
2840
2748
  const minSatisfying = (versions, range, options) => {
2841
2749
  let min = null;
2842
2750
  let minSV = null;
@@ -2860,10 +2768,10 @@ var require_min_satisfying$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module
2860
2768
  }));
2861
2769
  //#endregion
2862
2770
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js
2863
- var require_min_version$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2864
- const SemVer = require_semver$2();
2865
- const Range = require_range$1();
2866
- const gt = require_gt$1();
2771
+ var require_min_version$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2772
+ const SemVer = require_semver$3();
2773
+ const Range = require_range$2();
2774
+ const gt = require_gt$2();
2867
2775
  const minVersion = (range, loose) => {
2868
2776
  range = new Range(range, loose);
2869
2777
  let minver = new SemVer("0.0.0");
@@ -2899,8 +2807,8 @@ var require_min_version$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =
2899
2807
  }));
2900
2808
  //#endregion
2901
2809
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js
2902
- var require_valid$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2903
- const Range = require_range$1();
2810
+ var require_valid$3 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2811
+ const Range = require_range$2();
2904
2812
  const validRange = (range, options) => {
2905
2813
  try {
2906
2814
  return new Range(range, options).range || "*";
@@ -2912,16 +2820,16 @@ var require_valid$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2912
2820
  }));
2913
2821
  //#endregion
2914
2822
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js
2915
- var require_outside$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2916
- const SemVer = require_semver$2();
2917
- const Comparator = require_comparator$1();
2823
+ var require_outside$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2824
+ const SemVer = require_semver$3();
2825
+ const Comparator = require_comparator$2();
2918
2826
  const { ANY } = Comparator;
2919
- const Range = require_range$1();
2920
- const satisfies = require_satisfies$1();
2921
- const gt = require_gt$1();
2922
- const lt = require_lt$1();
2923
- const lte = require_lte$1();
2924
- const gte = require_gte$1();
2827
+ const Range = require_range$2();
2828
+ const satisfies = require_satisfies$2();
2829
+ const gt = require_gt$2();
2830
+ const lt = require_lt$2();
2831
+ const lte = require_lte$2();
2832
+ const gte = require_gte$2();
2925
2833
  const outside = (version, range, hilo, options) => {
2926
2834
  version = new SemVer(version, options);
2927
2835
  range = new Range(range, options);
@@ -2965,22 +2873,22 @@ var require_outside$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2965
2873
  }));
2966
2874
  //#endregion
2967
2875
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js
2968
- var require_gtr$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2969
- const outside = require_outside$1();
2876
+ var require_gtr$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2877
+ const outside = require_outside$2();
2970
2878
  const gtr = (version, range, options) => outside(version, range, ">", options);
2971
2879
  module.exports = gtr;
2972
2880
  }));
2973
2881
  //#endregion
2974
2882
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js
2975
- var require_ltr$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2976
- const outside = require_outside$1();
2883
+ var require_ltr$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2884
+ const outside = require_outside$2();
2977
2885
  const ltr = (version, range, options) => outside(version, range, "<", options);
2978
2886
  module.exports = ltr;
2979
2887
  }));
2980
2888
  //#endregion
2981
2889
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js
2982
- var require_intersects$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2983
- const Range = require_range$1();
2890
+ var require_intersects$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2891
+ const Range = require_range$2();
2984
2892
  const intersects = (r1, r2, options) => {
2985
2893
  r1 = new Range(r1, options);
2986
2894
  r2 = new Range(r2, options);
@@ -2990,9 +2898,9 @@ var require_intersects$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) =>
2990
2898
  }));
2991
2899
  //#endregion
2992
2900
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js
2993
- var require_simplify$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2994
- const satisfies = require_satisfies$1();
2995
- const compare = require_compare$1();
2901
+ var require_simplify$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2902
+ const satisfies = require_satisfies$2();
2903
+ const compare = require_compare$2();
2996
2904
  module.exports = (versions, range, options) => {
2997
2905
  const set = [];
2998
2906
  let first = null;
@@ -3020,12 +2928,12 @@ var require_simplify$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3020
2928
  }));
3021
2929
  //#endregion
3022
2930
  //#region ../../node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js
3023
- var require_subset$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3024
- const Range = require_range$1();
3025
- const Comparator = require_comparator$1();
2931
+ var require_subset$2 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
2932
+ const Range = require_range$2();
2933
+ const Comparator = require_comparator$2();
3026
2934
  const { ANY } = Comparator;
3027
- const satisfies = require_satisfies$1();
3028
- const compare = require_compare$1();
2935
+ const satisfies = require_satisfies$2();
2936
+ const compare = require_compare$2();
3029
2937
  const subset = (sub, dom, options = {}) => {
3030
2938
  if (sub === dom) return true;
3031
2939
  sub = new Range(sub, options);
@@ -3115,49 +3023,49 @@ var require_subset$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3115
3023
  }));
3116
3024
  //#endregion
3117
3025
  //#region ../plugin-core/dist/semverSatisfies.mjs
3118
- var import_semver$1 = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3119
- const internalRe = require_re$1();
3120
- const constants = require_constants$1();
3121
- const SemVer = require_semver$2();
3122
- const identifiers = require_identifiers$1();
3026
+ var import_semver$2 = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
3027
+ const internalRe = require_re$2();
3028
+ const constants = require_constants$2();
3029
+ const SemVer = require_semver$3();
3030
+ const identifiers = require_identifiers$2();
3123
3031
  module.exports = {
3124
- parse: require_parse$1(),
3125
- valid: require_valid$3(),
3126
- clean: require_clean$1(),
3127
- inc: require_inc$1(),
3128
- diff: require_diff$1(),
3129
- major: require_major$1(),
3130
- minor: require_minor$1(),
3131
- patch: require_patch$1(),
3132
- prerelease: require_prerelease$1(),
3133
- compare: require_compare$1(),
3134
- rcompare: require_rcompare$1(),
3135
- compareLoose: require_compare_loose$1(),
3136
- compareBuild: require_compare_build$1(),
3137
- sort: require_sort$1(),
3138
- rsort: require_rsort$1(),
3139
- gt: require_gt$1(),
3140
- lt: require_lt$1(),
3141
- eq: require_eq$1(),
3142
- neq: require_neq$1(),
3143
- gte: require_gte$1(),
3144
- lte: require_lte$1(),
3145
- cmp: require_cmp$1(),
3146
- coerce: require_coerce$1(),
3147
- Comparator: require_comparator$1(),
3148
- Range: require_range$1(),
3149
- satisfies: require_satisfies$1(),
3150
- toComparators: require_to_comparators$1(),
3151
- maxSatisfying: require_max_satisfying$1(),
3152
- minSatisfying: require_min_satisfying$1(),
3153
- minVersion: require_min_version$1(),
3154
- validRange: require_valid$2(),
3155
- outside: require_outside$1(),
3156
- gtr: require_gtr$1(),
3157
- ltr: require_ltr$1(),
3158
- intersects: require_intersects$1(),
3159
- simplifyRange: require_simplify$1(),
3160
- subset: require_subset$1(),
3032
+ parse: require_parse$2(),
3033
+ valid: require_valid$4(),
3034
+ clean: require_clean$2(),
3035
+ inc: require_inc$2(),
3036
+ diff: require_diff$2(),
3037
+ major: require_major$2(),
3038
+ minor: require_minor$2(),
3039
+ patch: require_patch$2(),
3040
+ prerelease: require_prerelease$2(),
3041
+ compare: require_compare$2(),
3042
+ rcompare: require_rcompare$2(),
3043
+ compareLoose: require_compare_loose$2(),
3044
+ compareBuild: require_compare_build$2(),
3045
+ sort: require_sort$2(),
3046
+ rsort: require_rsort$2(),
3047
+ gt: require_gt$2(),
3048
+ lt: require_lt$2(),
3049
+ eq: require_eq$2(),
3050
+ neq: require_neq$2(),
3051
+ gte: require_gte$2(),
3052
+ lte: require_lte$2(),
3053
+ cmp: require_cmp$2(),
3054
+ coerce: require_coerce$2(),
3055
+ Comparator: require_comparator$2(),
3056
+ Range: require_range$2(),
3057
+ satisfies: require_satisfies$2(),
3058
+ toComparators: require_to_comparators$2(),
3059
+ maxSatisfying: require_max_satisfying$2(),
3060
+ minSatisfying: require_min_satisfying$2(),
3061
+ minVersion: require_min_version$2(),
3062
+ validRange: require_valid$3(),
3063
+ outside: require_outside$2(),
3064
+ gtr: require_gtr$2(),
3065
+ ltr: require_ltr$2(),
3066
+ intersects: require_intersects$2(),
3067
+ simplifyRange: require_simplify$2(),
3068
+ subset: require_subset$2(),
3161
3069
  SemVer,
3162
3070
  re: internalRe.re,
3163
3071
  src: internalRe.src,
@@ -3169,9 +3077,9 @@ var import_semver$1 = /* @__PURE__ */ __toESM$1((/* @__PURE__ */ __commonJSMin$1
3169
3077
  };
3170
3078
  })))(), 1);
3171
3079
  const semverSatisfies$1 = (targetAppVersion, currentVersion) => {
3172
- const currentCoerce = import_semver$1.default.coerce(currentVersion);
3080
+ const currentCoerce = import_semver$2.default.coerce(currentVersion);
3173
3081
  if (!currentCoerce) return false;
3174
- return import_semver$1.default.satisfies(currentCoerce.version, targetAppVersion);
3082
+ return import_semver$2.default.satisfies(currentCoerce.version, targetAppVersion);
3175
3083
  };
3176
3084
  //#endregion
3177
3085
  //#region ../plugin-core/dist/filterCompatibleAppVersions.mjs
@@ -3274,67 +3182,196 @@ function paginateBundles({ bundles, limit, offset, cursor, orderBy }) {
3274
3182
  };
3275
3183
  }
3276
3184
  //#endregion
3277
- //#region ../js/dist/index.mjs
3278
- var __create = Object.create;
3279
- var __defProp = Object.defineProperty;
3280
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3281
- var __getOwnPropNames = Object.getOwnPropertyNames;
3282
- var __getProtoOf = Object.getPrototypeOf;
3283
- var __hasOwnProp = Object.prototype.hasOwnProperty;
3284
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3285
- var __copyProps = (to, from, except, desc) => {
3286
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
3287
- key = keys[i];
3288
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
3289
- get: ((k) => from[k]).bind(null, key),
3290
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
3291
- });
3292
- }
3293
- return to;
3185
+ //#region ../../packages/core/dist/index.mjs
3186
+ const getManifestStorageUri = (bundle) => bundle.manifestStorageUri ?? null;
3187
+ const getManifestFileHash = (bundle) => bundle.manifestFileHash ?? null;
3188
+ const getAssetBaseStorageUri = (bundle) => bundle.assetBaseStorageUri ?? null;
3189
+ const isBundlePatchArtifact = (value) => {
3190
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
3191
+ const candidate = value;
3192
+ return typeof candidate.baseBundleId === "string" && typeof candidate.baseFileHash === "string" && typeof candidate.patchFileHash === "string" && typeof candidate.patchStorageUri === "string";
3294
3193
  };
3295
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
3296
- value: mod,
3297
- enumerable: true
3298
- }) : target, mod));
3299
- var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3300
- const SEMVER_SPEC_VERSION = "2.0.0";
3301
- const MAX_LENGTH = 256;
3302
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
3303
- module.exports = {
3304
- MAX_LENGTH,
3305
- MAX_SAFE_COMPONENT_LENGTH: 16,
3306
- MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
3307
- MAX_SAFE_INTEGER,
3308
- RELEASE_TYPES: [
3309
- "major",
3310
- "premajor",
3311
- "minor",
3312
- "preminor",
3313
- "patch",
3314
- "prepatch",
3315
- "prerelease"
3316
- ],
3317
- SEMVER_SPEC_VERSION,
3318
- FLAG_INCLUDE_PRERELEASE: 1,
3319
- FLAG_LOOSE: 2
3320
- };
3321
- }));
3322
- var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3323
- module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
3324
- }));
3325
- var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3326
- const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
3327
- const debug = require_debug();
3328
- exports = module.exports = {};
3329
- const re = exports.re = [];
3330
- const safeRe = exports.safeRe = [];
3331
- const src = exports.src = [];
3332
- const safeSrc = exports.safeSrc = [];
3333
- const t = exports.t = {};
3334
- let R = 0;
3335
- const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
3336
- const safeRegexReplacements = [
3337
- ["\\s", 1],
3194
+ const readBundlePatchArray = (patches) => {
3195
+ if (!Array.isArray(patches)) return [];
3196
+ return patches.filter(isBundlePatchArtifact);
3197
+ };
3198
+ const getBundlePatches = (bundle) => {
3199
+ const patches = readBundlePatchArray(bundle.patches);
3200
+ const seenBaseBundleIds = /* @__PURE__ */ new Set();
3201
+ return patches.filter((patch) => {
3202
+ if (seenBaseBundleIds.has(patch.baseBundleId)) return false;
3203
+ seenBaseBundleIds.add(patch.baseBundleId);
3204
+ return true;
3205
+ });
3206
+ };
3207
+ const getBundlePatch = (bundle, baseBundleId) => {
3208
+ return getBundlePatches(bundle).find((patch) => patch.baseBundleId === baseBundleId) ?? null;
3209
+ };
3210
+ const NUMERIC_COHORT_SIZE = 1e3;
3211
+ const DEFAULT_ROLLOUT_COHORT_COUNT = NUMERIC_COHORT_SIZE;
3212
+ const INVALID_COHORT_ERROR_MESSAGE = `Invalid cohort. Use 1-1000 or a lowercase slug without spaces, up to 64 characters.`;
3213
+ const CUSTOM_COHORT_PATTERN = /^[a-z0-9-]+$/;
3214
+ function parseNumericCohortValue(cohort) {
3215
+ if (!/^\d+$/.test(cohort)) return null;
3216
+ const parsed = Number.parseInt(cohort, 10);
3217
+ if (Number.isNaN(parsed) || parsed < 1 || parsed > 1e3) return null;
3218
+ return parsed;
3219
+ }
3220
+ function positiveMod(value, modulus) {
3221
+ return (value % modulus + modulus) % modulus;
3222
+ }
3223
+ function hashString(value) {
3224
+ let hash = 0;
3225
+ for (let i = 0; i < value.length; i++) {
3226
+ const char = value.charCodeAt(i);
3227
+ hash = (hash << 5) - hash + char;
3228
+ hash |= 0;
3229
+ }
3230
+ return hash;
3231
+ }
3232
+ function gcd(a, b) {
3233
+ let x = Math.abs(a);
3234
+ let y = Math.abs(b);
3235
+ while (y !== 0) {
3236
+ const next = x % y;
3237
+ x = y;
3238
+ y = next;
3239
+ }
3240
+ return x;
3241
+ }
3242
+ function modularInverse(value, modulus) {
3243
+ let t = 0;
3244
+ let newT = 1;
3245
+ let r = modulus;
3246
+ let newR = positiveMod(value, modulus);
3247
+ while (newR !== 0) {
3248
+ const quotient = Math.floor(r / newR);
3249
+ [t, newT] = [newT, t - quotient * newT];
3250
+ [r, newR] = [newR, r - quotient * newR];
3251
+ }
3252
+ if (r > 1) throw new Error(`No modular inverse for ${value} mod ${modulus}`);
3253
+ return positiveMod(t, modulus);
3254
+ }
3255
+ function getRolloutShuffleParameters(bundleId) {
3256
+ let multiplier = positiveMod(hashString(`${bundleId}:multiplier`), 997);
3257
+ if (multiplier === 0) multiplier = 1;
3258
+ while (gcd(multiplier, NUMERIC_COHORT_SIZE) !== 1) {
3259
+ multiplier = positiveMod(multiplier + 1, NUMERIC_COHORT_SIZE);
3260
+ if (multiplier === 0) multiplier = 1;
3261
+ }
3262
+ const offset = positiveMod(hashString(`${bundleId}:offset`), NUMERIC_COHORT_SIZE);
3263
+ return {
3264
+ multiplier,
3265
+ offset,
3266
+ inverseMultiplier: modularInverse(multiplier, NUMERIC_COHORT_SIZE)
3267
+ };
3268
+ }
3269
+ function normalizeRolloutCohortCount(rolloutCohortCount) {
3270
+ if (rolloutCohortCount === null || rolloutCohortCount === void 0) return DEFAULT_ROLLOUT_COHORT_COUNT;
3271
+ if (rolloutCohortCount <= 0) return 0;
3272
+ if (rolloutCohortCount >= 1e3) return NUMERIC_COHORT_SIZE;
3273
+ return Math.floor(rolloutCohortCount);
3274
+ }
3275
+ function normalizeCohortValue(cohort) {
3276
+ const normalized = cohort.trim().toLowerCase();
3277
+ const numericCohort = parseNumericCohortValue(normalized);
3278
+ if (numericCohort !== null) return String(numericCohort);
3279
+ return normalized;
3280
+ }
3281
+ function getNumericCohortValue(cohort) {
3282
+ return parseNumericCohortValue(normalizeCohortValue(cohort));
3283
+ }
3284
+ function isNumericCohort(cohort) {
3285
+ return getNumericCohortValue(cohort) !== null;
3286
+ }
3287
+ function isCustomCohort(cohort) {
3288
+ const normalized = normalizeCohortValue(cohort);
3289
+ return normalized.length > 0 && normalized.length <= 64 && !/^\d+$/.test(normalized) && CUSTOM_COHORT_PATTERN.test(normalized);
3290
+ }
3291
+ function isValidCohort(cohort) {
3292
+ const normalized = normalizeCohortValue(cohort);
3293
+ return isNumericCohort(normalized) || isCustomCohort(normalized);
3294
+ }
3295
+ function getNumericCohortRolloutPosition(bundleId, cohortValue) {
3296
+ if (cohortValue < 1 || cohortValue > 1e3) throw new Error(`Invalid numeric cohort: ${cohortValue}`);
3297
+ const { offset, inverseMultiplier } = getRolloutShuffleParameters(bundleId);
3298
+ return positiveMod(inverseMultiplier * (cohortValue - 1 - offset), NUMERIC_COHORT_SIZE);
3299
+ }
3300
+ function isCohortEligibleForUpdate(bundleId, cohort, rolloutCohortCount, targetCohorts) {
3301
+ const normalizedCohort = cohort === null || cohort === void 0 ? void 0 : normalizeCohortValue(cohort);
3302
+ const normalizedTargetCohorts = targetCohorts?.map((targetCohort) => normalizeCohortValue(targetCohort)) ?? [];
3303
+ if (normalizedCohort !== void 0 && normalizedTargetCohorts.includes(normalizedCohort)) return true;
3304
+ const normalizedRolloutCount = normalizeRolloutCohortCount(rolloutCohortCount);
3305
+ if (normalizedRolloutCount <= 0) return false;
3306
+ if (normalizedCohort === void 0) return normalizedRolloutCount >= NUMERIC_COHORT_SIZE;
3307
+ const numericCohort = getNumericCohortValue(normalizedCohort);
3308
+ if (numericCohort === null) return false;
3309
+ if (normalizedRolloutCount >= 1e3) return true;
3310
+ return getNumericCohortRolloutPosition(bundleId, numericCohort) < normalizedRolloutCount;
3311
+ }
3312
+ const NIL_UUID = "00000000-0000-0000-0000-000000000000";
3313
+ //#endregion
3314
+ //#region ../js/dist/index.mjs
3315
+ var __create = Object.create;
3316
+ var __defProp = Object.defineProperty;
3317
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3318
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3319
+ var __getProtoOf = Object.getPrototypeOf;
3320
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3321
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3322
+ var __copyProps = (to, from, except, desc) => {
3323
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
3324
+ key = keys[i];
3325
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
3326
+ get: ((k) => from[k]).bind(null, key),
3327
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
3328
+ });
3329
+ }
3330
+ return to;
3331
+ };
3332
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
3333
+ value: mod,
3334
+ enumerable: true
3335
+ }) : target, mod));
3336
+ var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3337
+ const SEMVER_SPEC_VERSION = "2.0.0";
3338
+ const MAX_LENGTH = 256;
3339
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
3340
+ module.exports = {
3341
+ MAX_LENGTH,
3342
+ MAX_SAFE_COMPONENT_LENGTH: 16,
3343
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
3344
+ MAX_SAFE_INTEGER,
3345
+ RELEASE_TYPES: [
3346
+ "major",
3347
+ "premajor",
3348
+ "minor",
3349
+ "preminor",
3350
+ "patch",
3351
+ "prepatch",
3352
+ "prerelease"
3353
+ ],
3354
+ SEMVER_SPEC_VERSION,
3355
+ FLAG_INCLUDE_PRERELEASE: 1,
3356
+ FLAG_LOOSE: 2
3357
+ };
3358
+ }));
3359
+ var require_debug$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3360
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
3361
+ }));
3362
+ var require_re$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3363
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants$1();
3364
+ const debug = require_debug$1();
3365
+ exports = module.exports = {};
3366
+ const re = exports.re = [];
3367
+ const safeRe = exports.safeRe = [];
3368
+ const src = exports.src = [];
3369
+ const safeSrc = exports.safeSrc = [];
3370
+ const t = exports.t = {};
3371
+ let R = 0;
3372
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
3373
+ const safeRegexReplacements = [
3374
+ ["\\s", 1],
3338
3375
  ["\\d", MAX_LENGTH],
3339
3376
  [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
3340
3377
  ];
@@ -3399,7 +3436,7 @@ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3399
3436
  createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
3400
3437
  createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
3401
3438
  }));
3402
- var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3439
+ var require_parse_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3403
3440
  const looseOption = Object.freeze({ loose: true });
3404
3441
  const emptyOpts = Object.freeze({});
3405
3442
  const parseOptions = (options) => {
@@ -3409,7 +3446,7 @@ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) =>
3409
3446
  };
3410
3447
  module.exports = parseOptions;
3411
3448
  }));
3412
- var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3449
+ var require_identifiers$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3413
3450
  const numeric = /^[0-9]+$/;
3414
3451
  const compareIdentifiers = (a, b) => {
3415
3452
  const anum = numeric.test(a);
@@ -3426,12 +3463,12 @@ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3426
3463
  rcompareIdentifiers
3427
3464
  };
3428
3465
  }));
3429
- var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3430
- const debug = require_debug();
3431
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
3432
- const { safeRe: re, t } = require_re();
3433
- const parseOptions = require_parse_options();
3434
- const { compareIdentifiers } = require_identifiers();
3466
+ var require_semver$1$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3467
+ const debug = require_debug$1();
3468
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants$1();
3469
+ const { safeRe: re, t } = require_re$1();
3470
+ const parseOptions = require_parse_options$1();
3471
+ const { compareIdentifiers } = require_identifiers$1();
3435
3472
  module.exports = class SemVer {
3436
3473
  constructor(version, options) {
3437
3474
  options = parseOptions(options);
@@ -3596,8 +3633,8 @@ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3596
3633
  }
3597
3634
  };
3598
3635
  }));
3599
- var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3600
- const SemVer = require_semver$1();
3636
+ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3637
+ const SemVer = require_semver$1$1();
3601
3638
  const parse = (version, options, throwErrors = false) => {
3602
3639
  if (version instanceof SemVer) return version;
3603
3640
  try {
@@ -3609,24 +3646,24 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3609
3646
  };
3610
3647
  module.exports = parse;
3611
3648
  }));
3612
- var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3613
- const parse = require_parse();
3649
+ var require_valid$1$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3650
+ const parse = require_parse$1();
3614
3651
  const valid = (version, options) => {
3615
3652
  const v = parse(version, options);
3616
3653
  return v ? v.version : null;
3617
3654
  };
3618
3655
  module.exports = valid;
3619
3656
  }));
3620
- var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3621
- const parse = require_parse();
3657
+ var require_clean$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3658
+ const parse = require_parse$1();
3622
3659
  const clean = (version, options) => {
3623
3660
  const s = parse(version.trim().replace(/^[=v]+/, ""), options);
3624
3661
  return s ? s.version : null;
3625
3662
  };
3626
3663
  module.exports = clean;
3627
3664
  }));
3628
- var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3629
- const SemVer = require_semver$1();
3665
+ var require_inc$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3666
+ const SemVer = require_semver$1$1();
3630
3667
  const inc = (version, release, options, identifier, identifierBase) => {
3631
3668
  if (typeof options === "string") {
3632
3669
  identifierBase = identifier;
@@ -3641,8 +3678,8 @@ var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3641
3678
  };
3642
3679
  module.exports = inc;
3643
3680
  }));
3644
- var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3645
- const parse = require_parse();
3681
+ var require_diff$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3682
+ const parse = require_parse$1();
3646
3683
  const diff = (version1, version2) => {
3647
3684
  const v1 = parse(version1, null, true);
3648
3685
  const v2 = parse(version2, null, true);
@@ -3667,46 +3704,46 @@ var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3667
3704
  };
3668
3705
  module.exports = diff;
3669
3706
  }));
3670
- var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3671
- const SemVer = require_semver$1();
3707
+ var require_major$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3708
+ const SemVer = require_semver$1$1();
3672
3709
  const major = (a, loose) => new SemVer(a, loose).major;
3673
3710
  module.exports = major;
3674
3711
  }));
3675
- var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3676
- const SemVer = require_semver$1();
3712
+ var require_minor$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3713
+ const SemVer = require_semver$1$1();
3677
3714
  const minor = (a, loose) => new SemVer(a, loose).minor;
3678
3715
  module.exports = minor;
3679
3716
  }));
3680
- var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3681
- const SemVer = require_semver$1();
3717
+ var require_patch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3718
+ const SemVer = require_semver$1$1();
3682
3719
  const patch = (a, loose) => new SemVer(a, loose).patch;
3683
3720
  module.exports = patch;
3684
3721
  }));
3685
- var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3686
- const parse = require_parse();
3722
+ var require_prerelease$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3723
+ const parse = require_parse$1();
3687
3724
  const prerelease = (version, options) => {
3688
3725
  const parsed = parse(version, options);
3689
3726
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
3690
3727
  };
3691
3728
  module.exports = prerelease;
3692
3729
  }));
3693
- var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3694
- const SemVer = require_semver$1();
3730
+ var require_compare$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3731
+ const SemVer = require_semver$1$1();
3695
3732
  const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
3696
3733
  module.exports = compare;
3697
3734
  }));
3698
- var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3699
- const compare = require_compare();
3735
+ var require_rcompare$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3736
+ const compare = require_compare$1();
3700
3737
  const rcompare = (a, b, loose) => compare(b, a, loose);
3701
3738
  module.exports = rcompare;
3702
3739
  }));
3703
- var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3704
- const compare = require_compare();
3740
+ var require_compare_loose$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3741
+ const compare = require_compare$1();
3705
3742
  const compareLoose = (a, b) => compare(a, b, true);
3706
3743
  module.exports = compareLoose;
3707
3744
  }));
3708
- var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3709
- const SemVer = require_semver$1();
3745
+ var require_compare_build$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3746
+ const SemVer = require_semver$1$1();
3710
3747
  const compareBuild = (a, b, loose) => {
3711
3748
  const versionA = new SemVer(a, loose);
3712
3749
  const versionB = new SemVer(b, loose);
@@ -3714,53 +3751,53 @@ var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
3714
3751
  };
3715
3752
  module.exports = compareBuild;
3716
3753
  }));
3717
- var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3718
- const compareBuild = require_compare_build();
3754
+ var require_sort$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3755
+ const compareBuild = require_compare_build$1();
3719
3756
  const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
3720
3757
  module.exports = sort;
3721
3758
  }));
3722
- var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3723
- const compareBuild = require_compare_build();
3759
+ var require_rsort$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3760
+ const compareBuild = require_compare_build$1();
3724
3761
  const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
3725
3762
  module.exports = rsort;
3726
3763
  }));
3727
- var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3728
- const compare = require_compare();
3764
+ var require_gt$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3765
+ const compare = require_compare$1();
3729
3766
  const gt = (a, b, loose) => compare(a, b, loose) > 0;
3730
3767
  module.exports = gt;
3731
3768
  }));
3732
- var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3733
- const compare = require_compare();
3769
+ var require_lt$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3770
+ const compare = require_compare$1();
3734
3771
  const lt = (a, b, loose) => compare(a, b, loose) < 0;
3735
3772
  module.exports = lt;
3736
3773
  }));
3737
- var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3738
- const compare = require_compare();
3774
+ var require_eq$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3775
+ const compare = require_compare$1();
3739
3776
  const eq = (a, b, loose) => compare(a, b, loose) === 0;
3740
3777
  module.exports = eq;
3741
3778
  }));
3742
- var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3743
- const compare = require_compare();
3779
+ var require_neq$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3780
+ const compare = require_compare$1();
3744
3781
  const neq = (a, b, loose) => compare(a, b, loose) !== 0;
3745
3782
  module.exports = neq;
3746
3783
  }));
3747
- var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3748
- const compare = require_compare();
3784
+ var require_gte$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3785
+ const compare = require_compare$1();
3749
3786
  const gte = (a, b, loose) => compare(a, b, loose) >= 0;
3750
3787
  module.exports = gte;
3751
3788
  }));
3752
- var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3753
- const compare = require_compare();
3789
+ var require_lte$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3790
+ const compare = require_compare$1();
3754
3791
  const lte = (a, b, loose) => compare(a, b, loose) <= 0;
3755
3792
  module.exports = lte;
3756
3793
  }));
3757
- var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3758
- const eq = require_eq();
3759
- const neq = require_neq();
3760
- const gt = require_gt();
3761
- const gte = require_gte();
3762
- const lt = require_lt();
3763
- const lte = require_lte();
3794
+ var require_cmp$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3795
+ const eq = require_eq$1();
3796
+ const neq = require_neq$1();
3797
+ const gt = require_gt$1();
3798
+ const gte = require_gte$1();
3799
+ const lt = require_lt$1();
3800
+ const lte = require_lte$1();
3764
3801
  const cmp = (a, op, b, loose) => {
3765
3802
  switch (op) {
3766
3803
  case "===":
@@ -3784,10 +3821,10 @@ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3784
3821
  };
3785
3822
  module.exports = cmp;
3786
3823
  }));
3787
- var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3788
- const SemVer = require_semver$1();
3789
- const parse = require_parse();
3790
- const { safeRe: re, t } = require_re();
3824
+ var require_coerce$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3825
+ const SemVer = require_semver$1$1();
3826
+ const parse = require_parse$1();
3827
+ const { safeRe: re, t } = require_re$1();
3791
3828
  const coerce = (version, options) => {
3792
3829
  if (version instanceof SemVer) return version;
3793
3830
  if (typeof version === "number") version = String(version);
@@ -3810,7 +3847,7 @@ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3810
3847
  };
3811
3848
  module.exports = coerce;
3812
3849
  }));
3813
- var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3850
+ var require_lrucache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3814
3851
  var LRUCache = class {
3815
3852
  constructor() {
3816
3853
  this.max = 1e3;
@@ -3841,7 +3878,7 @@ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3841
3878
  };
3842
3879
  module.exports = LRUCache;
3843
3880
  }));
3844
- var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3881
+ var require_range$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3845
3882
  const SPACE_CHARACTERS = /\s+/g;
3846
3883
  module.exports = class Range {
3847
3884
  constructor(range, options) {
@@ -3947,13 +3984,13 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3947
3984
  return false;
3948
3985
  }
3949
3986
  };
3950
- const cache = new (require_lrucache())();
3951
- const parseOptions = require_parse_options();
3952
- const Comparator = require_comparator();
3953
- const debug = require_debug();
3954
- const SemVer = require_semver$1();
3955
- const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
3956
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
3987
+ const cache = new (require_lrucache$1())();
3988
+ const parseOptions = require_parse_options$1();
3989
+ const Comparator = require_comparator$1();
3990
+ const debug = require_debug$1();
3991
+ const SemVer = require_semver$1$1();
3992
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re$1();
3993
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants$1();
3957
3994
  const isNullSet = (c) => c.value === "<0.0.0-0";
3958
3995
  const isAny = (c) => c.value === "";
3959
3996
  const isSatisfiable = (comparators, options) => {
@@ -4110,7 +4147,7 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4110
4147
  return true;
4111
4148
  };
4112
4149
  }));
4113
- var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4150
+ var require_comparator$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4114
4151
  const ANY = Symbol("SemVer ANY");
4115
4152
  module.exports = class Comparator {
4116
4153
  static get ANY() {
@@ -4171,15 +4208,15 @@ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4171
4208
  return false;
4172
4209
  }
4173
4210
  };
4174
- const parseOptions = require_parse_options();
4175
- const { safeRe: re, t } = require_re();
4176
- const cmp = require_cmp();
4177
- const debug = require_debug();
4178
- const SemVer = require_semver$1();
4179
- const Range = require_range();
4211
+ const parseOptions = require_parse_options$1();
4212
+ const { safeRe: re, t } = require_re$1();
4213
+ const cmp = require_cmp$1();
4214
+ const debug = require_debug$1();
4215
+ const SemVer = require_semver$1$1();
4216
+ const Range = require_range$1();
4180
4217
  }));
4181
- var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4182
- const Range = require_range();
4218
+ var require_satisfies$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4219
+ const Range = require_range$1();
4183
4220
  const satisfies = (version, range, options) => {
4184
4221
  try {
4185
4222
  range = new Range(range, options);
@@ -4190,14 +4227,14 @@ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4190
4227
  };
4191
4228
  module.exports = satisfies;
4192
4229
  }));
4193
- var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4194
- const Range = require_range();
4230
+ var require_to_comparators$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4231
+ const Range = require_range$1();
4195
4232
  const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
4196
4233
  module.exports = toComparators;
4197
4234
  }));
4198
- var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4199
- const SemVer = require_semver$1();
4200
- const Range = require_range();
4235
+ var require_max_satisfying$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4236
+ const SemVer = require_semver$1$1();
4237
+ const Range = require_range$1();
4201
4238
  const maxSatisfying = (versions, range, options) => {
4202
4239
  let max = null;
4203
4240
  let maxSV = null;
@@ -4219,9 +4256,9 @@ var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) =>
4219
4256
  };
4220
4257
  module.exports = maxSatisfying;
4221
4258
  }));
4222
- var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4223
- const SemVer = require_semver$1();
4224
- const Range = require_range();
4259
+ var require_min_satisfying$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4260
+ const SemVer = require_semver$1$1();
4261
+ const Range = require_range$1();
4225
4262
  const minSatisfying = (versions, range, options) => {
4226
4263
  let min = null;
4227
4264
  let minSV = null;
@@ -4243,10 +4280,10 @@ var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) =>
4243
4280
  };
4244
4281
  module.exports = minSatisfying;
4245
4282
  }));
4246
- var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4247
- const SemVer = require_semver$1();
4248
- const Range = require_range();
4249
- const gt = require_gt();
4283
+ var require_min_version$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4284
+ const SemVer = require_semver$1$1();
4285
+ const Range = require_range$1();
4286
+ const gt = require_gt$1();
4250
4287
  const minVersion = (range, loose) => {
4251
4288
  range = new Range(range, loose);
4252
4289
  let minver = new SemVer("0.0.0");
@@ -4280,8 +4317,8 @@ var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4280
4317
  };
4281
4318
  module.exports = minVersion;
4282
4319
  }));
4283
- var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4284
- const Range = require_range();
4320
+ var require_valid$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4321
+ const Range = require_range$1();
4285
4322
  const validRange = (range, options) => {
4286
4323
  try {
4287
4324
  return new Range(range, options).range || "*";
@@ -4291,16 +4328,16 @@ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4291
4328
  };
4292
4329
  module.exports = validRange;
4293
4330
  }));
4294
- var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4295
- const SemVer = require_semver$1();
4296
- const Comparator = require_comparator();
4331
+ var require_outside$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4332
+ const SemVer = require_semver$1$1();
4333
+ const Comparator = require_comparator$1();
4297
4334
  const { ANY } = Comparator;
4298
- const Range = require_range();
4299
- const satisfies = require_satisfies();
4300
- const gt = require_gt();
4301
- const lt = require_lt();
4302
- const lte = require_lte();
4303
- const gte = require_gte();
4335
+ const Range = require_range$1();
4336
+ const satisfies = require_satisfies$1();
4337
+ const gt = require_gt$1();
4338
+ const lt = require_lt$1();
4339
+ const lte = require_lte$1();
4340
+ const gte = require_gte$1();
4304
4341
  const outside = (version, range, hilo, options) => {
4305
4342
  version = new SemVer(version, options);
4306
4343
  range = new Range(range, options);
@@ -4342,18 +4379,18 @@ var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4342
4379
  };
4343
4380
  module.exports = outside;
4344
4381
  }));
4345
- var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4346
- const outside = require_outside();
4382
+ var require_gtr$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4383
+ const outside = require_outside$1();
4347
4384
  const gtr = (version, range, options) => outside(version, range, ">", options);
4348
4385
  module.exports = gtr;
4349
4386
  }));
4350
- var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4351
- const outside = require_outside();
4387
+ var require_ltr$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4388
+ const outside = require_outside$1();
4352
4389
  const ltr = (version, range, options) => outside(version, range, "<", options);
4353
4390
  module.exports = ltr;
4354
4391
  }));
4355
- var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4356
- const Range = require_range();
4392
+ var require_intersects$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4393
+ const Range = require_range$1();
4357
4394
  const intersects = (r1, r2, options) => {
4358
4395
  r1 = new Range(r1, options);
4359
4396
  r2 = new Range(r2, options);
@@ -4361,9 +4398,9 @@ var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4361
4398
  };
4362
4399
  module.exports = intersects;
4363
4400
  }));
4364
- var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4365
- const satisfies = require_satisfies();
4366
- const compare = require_compare();
4401
+ var require_simplify$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4402
+ const satisfies = require_satisfies$1();
4403
+ const compare = require_compare$1();
4367
4404
  module.exports = (versions, range, options) => {
4368
4405
  const set = [];
4369
4406
  let first = null;
@@ -4389,12 +4426,12 @@ var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4389
4426
  return simplified.length < original.length ? simplified : range;
4390
4427
  };
4391
4428
  }));
4392
- var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4393
- const Range = require_range();
4394
- const Comparator = require_comparator();
4429
+ var require_subset$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4430
+ const Range = require_range$1();
4431
+ const Comparator = require_comparator$1();
4395
4432
  const { ANY } = Comparator;
4396
- const satisfies = require_satisfies();
4397
- const compare = require_compare();
4433
+ const satisfies = require_satisfies$1();
4434
+ const compare = require_compare$1();
4398
4435
  const subset = (sub, dom, options = {}) => {
4399
4436
  if (sub === dom) return true;
4400
4437
  sub = new Range(sub, options);
@@ -4482,49 +4519,49 @@ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4482
4519
  };
4483
4520
  module.exports = subset;
4484
4521
  }));
4485
- var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4486
- const internalRe = require_re();
4487
- const constants = require_constants();
4488
- const SemVer = require_semver$1();
4489
- const identifiers = require_identifiers();
4522
+ var import_semver$1 = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
4523
+ const internalRe = require_re$1();
4524
+ const constants = require_constants$1();
4525
+ const SemVer = require_semver$1$1();
4526
+ const identifiers = require_identifiers$1();
4490
4527
  module.exports = {
4491
- parse: require_parse(),
4492
- valid: require_valid$1(),
4493
- clean: require_clean(),
4494
- inc: require_inc(),
4495
- diff: require_diff(),
4496
- major: require_major(),
4497
- minor: require_minor(),
4498
- patch: require_patch(),
4499
- prerelease: require_prerelease(),
4500
- compare: require_compare(),
4501
- rcompare: require_rcompare(),
4502
- compareLoose: require_compare_loose(),
4503
- compareBuild: require_compare_build(),
4504
- sort: require_sort(),
4505
- rsort: require_rsort(),
4506
- gt: require_gt(),
4507
- lt: require_lt(),
4508
- eq: require_eq(),
4509
- neq: require_neq(),
4510
- gte: require_gte(),
4511
- lte: require_lte(),
4512
- cmp: require_cmp(),
4513
- coerce: require_coerce(),
4514
- Comparator: require_comparator(),
4515
- Range: require_range(),
4516
- satisfies: require_satisfies(),
4517
- toComparators: require_to_comparators(),
4518
- maxSatisfying: require_max_satisfying(),
4519
- minSatisfying: require_min_satisfying(),
4520
- minVersion: require_min_version(),
4521
- validRange: require_valid(),
4522
- outside: require_outside(),
4523
- gtr: require_gtr(),
4524
- ltr: require_ltr(),
4525
- intersects: require_intersects(),
4526
- simplifyRange: require_simplify(),
4527
- subset: require_subset(),
4528
+ parse: require_parse$1(),
4529
+ valid: require_valid$1$1(),
4530
+ clean: require_clean$1(),
4531
+ inc: require_inc$1(),
4532
+ diff: require_diff$1(),
4533
+ major: require_major$1(),
4534
+ minor: require_minor$1(),
4535
+ patch: require_patch$1(),
4536
+ prerelease: require_prerelease$1(),
4537
+ compare: require_compare$1(),
4538
+ rcompare: require_rcompare$1(),
4539
+ compareLoose: require_compare_loose$1(),
4540
+ compareBuild: require_compare_build$1(),
4541
+ sort: require_sort$1(),
4542
+ rsort: require_rsort$1(),
4543
+ gt: require_gt$1(),
4544
+ lt: require_lt$1(),
4545
+ eq: require_eq$1(),
4546
+ neq: require_neq$1(),
4547
+ gte: require_gte$1(),
4548
+ lte: require_lte$1(),
4549
+ cmp: require_cmp$1(),
4550
+ coerce: require_coerce$1(),
4551
+ Comparator: require_comparator$1(),
4552
+ Range: require_range$1(),
4553
+ satisfies: require_satisfies$1(),
4554
+ toComparators: require_to_comparators$1(),
4555
+ maxSatisfying: require_max_satisfying$1(),
4556
+ minSatisfying: require_min_satisfying$1(),
4557
+ minVersion: require_min_version$1(),
4558
+ validRange: require_valid$2(),
4559
+ outside: require_outside$1(),
4560
+ gtr: require_gtr$1(),
4561
+ ltr: require_ltr$1(),
4562
+ intersects: require_intersects$1(),
4563
+ simplifyRange: require_simplify$1(),
4564
+ subset: require_subset$1(),
4528
4565
  SemVer,
4529
4566
  re: internalRe.re,
4530
4567
  src: internalRe.src,
@@ -4536,9 +4573,9 @@ var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
4536
4573
  };
4537
4574
  })))(), 1);
4538
4575
  const semverSatisfies = (targetAppVersion, currentVersion) => {
4539
- const currentCoerce = import_semver.default.coerce(currentVersion);
4576
+ const currentCoerce = import_semver$1.default.coerce(currentVersion);
4540
4577
  if (!currentCoerce) return false;
4541
- return import_semver.default.satisfies(currentCoerce.version, targetAppVersion);
4578
+ return import_semver$1.default.satisfies(currentCoerce.version, targetAppVersion);
4542
4579
  };
4543
4580
  const INIT_BUNDLE_ROLLBACK_UPDATE_INFO$1 = {
4544
4581
  message: null,
@@ -4654,7 +4691,7 @@ function isExactVersion(version) {
4654
4691
  if (!version) return false;
4655
4692
  const normalized = normalizeTargetAppVersion(version);
4656
4693
  if (!normalized) return false;
4657
- return import_semver$1.default.valid(normalized) !== null;
4694
+ return import_semver$2.default.valid(normalized) !== null;
4658
4695
  }
4659
4696
  /**
4660
4697
  * Get all normalized semver versions for a version string.
@@ -4667,7 +4704,7 @@ function isExactVersion(version) {
4667
4704
  */
4668
4705
  function getSemverNormalizedVersions(version) {
4669
4706
  const normalized = normalizeTargetAppVersion(version) || version;
4670
- const coerced = import_semver$1.default.coerce(normalized);
4707
+ const coerced = import_semver$2.default.coerce(normalized);
4671
4708
  if (!coerced) return [normalized];
4672
4709
  const versions = /* @__PURE__ */ new Set();
4673
4710
  versions.add(coerced.version);
@@ -5351,56 +5388,93 @@ const createStorageKeyBuilder = (basePath) => (...args) => {
5351
5388
  };
5352
5389
  //#endregion
5353
5390
  //#region ../plugin-core/dist/createStoragePlugin.mjs
5391
+ const wrapNodeProfile = (node, hooks) => ({
5392
+ ...node,
5393
+ async upload(key, filePath) {
5394
+ const result = await node.upload(key, filePath);
5395
+ await hooks?.onStorageUploaded?.();
5396
+ return result;
5397
+ }
5398
+ });
5399
+ const createProfiledStoragePlugin = ({ createProfiles, name, profileShape, supportedProtocol }, hooks) => {
5400
+ let cachedProfiles = null;
5401
+ let cachedNodeProfile;
5402
+ let cachedRuntimeProfile;
5403
+ const getProfiles = () => {
5404
+ cachedProfiles ??= createProfiles();
5405
+ return cachedProfiles;
5406
+ };
5407
+ const getNodeProfile = () => {
5408
+ const node = getProfiles().node;
5409
+ if (!node) return;
5410
+ cachedNodeProfile ??= wrapNodeProfile(node, hooks);
5411
+ return cachedNodeProfile;
5412
+ };
5413
+ const requireNodeProfile = () => {
5414
+ const node = getNodeProfile();
5415
+ if (!node) throw new Error(`${name} does not implement the node storage profile for protocol "${supportedProtocol}".`);
5416
+ return node;
5417
+ };
5418
+ const getRuntimeProfile = () => {
5419
+ const runtime = getProfiles().runtime;
5420
+ if (!runtime) return;
5421
+ cachedRuntimeProfile ??= runtime;
5422
+ return cachedRuntimeProfile;
5423
+ };
5424
+ const requireRuntimeProfile = () => {
5425
+ const runtime = getRuntimeProfile();
5426
+ if (!runtime) throw new Error(`${name} does not implement the runtime storage profile for protocol "${supportedProtocol}".`);
5427
+ return runtime;
5428
+ };
5429
+ const profiles = {};
5430
+ if (profileShape?.node) profiles.node = {
5431
+ async delete(storageUri) {
5432
+ return requireNodeProfile().delete(storageUri);
5433
+ },
5434
+ async downloadFile(storageUri, filePath) {
5435
+ return requireNodeProfile().downloadFile(storageUri, filePath);
5436
+ },
5437
+ async upload(key, filePath) {
5438
+ return requireNodeProfile().upload(key, filePath);
5439
+ }
5440
+ };
5441
+ else if (profileShape?.node !== false) Object.defineProperty(profiles, "node", {
5442
+ enumerable: true,
5443
+ get: getNodeProfile
5444
+ });
5445
+ if (profileShape?.runtime) profiles.runtime = {
5446
+ async getDownloadUrl(storageUri, context) {
5447
+ return requireRuntimeProfile().getDownloadUrl(storageUri, context);
5448
+ },
5449
+ async readText(storageUri, context) {
5450
+ return requireRuntimeProfile().readText(storageUri, context);
5451
+ }
5452
+ };
5453
+ else if (profileShape?.runtime !== false) Object.defineProperty(profiles, "runtime", {
5454
+ enumerable: true,
5455
+ get: getRuntimeProfile
5456
+ });
5457
+ return {
5458
+ name,
5459
+ supportedProtocol,
5460
+ profiles
5461
+ };
5462
+ };
5354
5463
  /**
5355
- * Creates a storage plugin with lazy initialization and automatic hook execution.
5356
- *
5357
- * This factory function abstracts the double currying pattern used by all storage plugins,
5358
- * ensuring consistent lazy initialization behavior across different storage providers.
5359
- * Hooks are automatically executed at appropriate times without requiring manual invocation.
5360
- *
5361
- * @param options - Configuration options for the storage plugin
5362
- * @returns A double-curried function that lazily initializes the storage plugin
5363
- *
5364
- * @example
5365
- * ```typescript
5366
- * export const s3Storage = createStoragePlugin<S3StorageConfig>({
5367
- * name: "s3Storage",
5368
- * supportedProtocol: "s3",
5369
- * factory: (config) => {
5370
- * const client = new S3Client(config);
5371
- * return {
5372
- * async upload(key, filePath) { ... },
5373
- * async delete(storageUri) { ... },
5374
- * async getDownloadUrl(storageUri, context) { ... }
5375
- * };
5376
- * }
5377
- * });
5378
- * ```
5464
+ * Creates a storage plugin that can be used by both Node tooling and update
5465
+ * check runtimes.
5379
5466
  */
5380
- const createStoragePlugin = (options) => {
5467
+ const createUniversalStoragePlugin = (options) => {
5381
5468
  return (config, hooks) => {
5382
- return () => {
5383
- let cachedMethods = null;
5384
- const getMethods = () => {
5385
- if (!cachedMethods) cachedMethods = options.factory(config);
5386
- return cachedMethods;
5387
- };
5388
- return {
5389
- name: options.name,
5390
- supportedProtocol: options.supportedProtocol,
5391
- async upload(key, filePath) {
5392
- const result = await getMethods().upload(key, filePath);
5393
- await hooks?.onStorageUploaded?.();
5394
- return result;
5395
- },
5396
- async delete(storageUri) {
5397
- return getMethods().delete(storageUri);
5398
- },
5399
- async getDownloadUrl(storageUri, context) {
5400
- return getMethods().getDownloadUrl(storageUri, context);
5401
- }
5402
- };
5403
- };
5469
+ return () => createProfiledStoragePlugin({
5470
+ createProfiles: () => options.factory(config),
5471
+ name: options.name,
5472
+ profileShape: {
5473
+ node: true,
5474
+ runtime: true
5475
+ },
5476
+ supportedProtocol: options.supportedProtocol
5477
+ }, hooks);
5404
5478
  };
5405
5479
  };
5406
5480
  //#endregion
@@ -5436,6 +5510,142 @@ function parseStorageUri(storageUri, expectedProtocol) {
5436
5510
  }
5437
5511
  }
5438
5512
  //#endregion
5513
+ //#region ../plugin-core/dist/storageProfile.mjs
5514
+ const createMissingProfileError = (plugin, profile) => /* @__PURE__ */ new Error(`${plugin.name} does not implement the ${profile} storage profile for protocol "${plugin.supportedProtocol}".`);
5515
+ const isRuntimeStoragePlugin = (plugin) => Boolean(plugin.profiles.runtime);
5516
+ function assertRuntimeStoragePlugin(plugin) {
5517
+ if (!isRuntimeStoragePlugin(plugin)) throw createMissingProfileError(plugin, "runtime");
5518
+ }
5519
+ //#endregion
5520
+ //#region ../../packages/server/src/db/schemaEnhancements.ts
5521
+ const normalizeNullableString = (value) => {
5522
+ if (value === null || value === void 0) return null;
5523
+ const normalized = value.trim();
5524
+ return normalized.length > 0 ? normalized : null;
5525
+ };
5526
+ const assertBundlePersistenceConstraints = (bundle) => {
5527
+ const targetAppVersion = normalizeNullableString(bundle.targetAppVersion);
5528
+ const fingerprintHash = normalizeNullableString(bundle.fingerprintHash);
5529
+ if (!targetAppVersion && !fingerprintHash) throw new Error("Bundle must define either targetAppVersion or fingerprintHash.");
5530
+ const rolloutCohortCount = bundle.rolloutCohortCount;
5531
+ if (rolloutCohortCount !== null && rolloutCohortCount !== void 0) {
5532
+ if (!Number.isInteger(rolloutCohortCount) || rolloutCohortCount < 0 || rolloutCohortCount > 1e3) throw new Error(`rolloutCohortCount must be an integer between 0 and ${DEFAULT_ROLLOUT_COHORT_COUNT}.`);
5533
+ }
5534
+ for (const cohort of bundle.targetCohorts ?? []) if (!isValidCohort(cohort)) throw new Error(`Invalid target cohort "${cohort}". ${INVALID_COHORT_ERROR_MESSAGE}`);
5535
+ };
5536
+ //#endregion
5537
+ //#region ../../packages/server/src/db/updateArtifacts.ts
5538
+ const HBC_ASSET_PATH_RE = /\.bundle$/;
5539
+ const BR_COMPRESSED_ASSET_PATH_RE = /(^|\/)index\.[^/]+\.bundle$/;
5540
+ const resolveUniqueHbcAssetPath = (manifest) => {
5541
+ const candidates = Object.keys(manifest.assets).sort((left, right) => left.localeCompare(right)).filter((candidate) => HBC_ASSET_PATH_RE.test(candidate));
5542
+ return candidates.length === 1 ? candidates[0] : null;
5543
+ };
5544
+ const isBundleManifest = (value) => {
5545
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
5546
+ const manifest = value;
5547
+ if (typeof manifest.bundleId !== "string") return false;
5548
+ if (!manifest.assets || typeof manifest.assets !== "object") return false;
5549
+ return Object.values(manifest.assets).every((asset) => {
5550
+ if (!asset || typeof asset !== "object" || Array.isArray(asset)) return false;
5551
+ const manifestAsset = asset;
5552
+ return typeof manifestAsset.fileHash === "string" && (manifestAsset.signature === void 0 || typeof manifestAsset.signature === "string");
5553
+ });
5554
+ };
5555
+ const createChildStorageUri = (baseStorageUri, relativePath) => {
5556
+ const baseUrl = new URL(baseStorageUri);
5557
+ baseUrl.pathname = `${baseUrl.pathname.replace(/\/+$/, "")}/${relativePath.split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
5558
+ return baseUrl.toString();
5559
+ };
5560
+ async function fetchBundleManifest(storageUri, readStorageText, resolveFileUrl, context) {
5561
+ const [storageText, fileUrl] = await Promise.all([readStorageText(storageUri, context), resolveFileUrl(storageUri, context)]);
5562
+ if (storageText === null) return null;
5563
+ let payload;
5564
+ try {
5565
+ payload = JSON.parse(storageText);
5566
+ } catch {
5567
+ return null;
5568
+ }
5569
+ if (!isBundleManifest(payload)) return null;
5570
+ if (!fileUrl) return null;
5571
+ return {
5572
+ fileUrl,
5573
+ manifest: payload
5574
+ };
5575
+ }
5576
+ async function resolveChangedAssets({ assetBaseStorageUri, currentManifest, currentBundle, resolveFileUrl, targetBundle, targetManifest, context }) {
5577
+ const patchDescriptor = await resolveHbcPatchDescriptor({
5578
+ currentBundle,
5579
+ resolveFileUrl,
5580
+ targetBundle,
5581
+ targetManifest,
5582
+ context
5583
+ });
5584
+ const changedEntries = await Promise.all(Object.entries(targetManifest.assets).map(async ([assetPath, asset]) => {
5585
+ if ((currentManifest?.assets[assetPath])?.fileHash === asset.fileHash) return null;
5586
+ const usesBrotliAsset = BR_COMPRESSED_ASSET_PATH_RE.test(assetPath);
5587
+ const storageUri = createChildStorageUri(assetBaseStorageUri, usesBrotliAsset ? `${assetPath}.br` : assetPath);
5588
+ const patch = patchDescriptor?.assetPath === assetPath ? patchDescriptor.patch : null;
5589
+ let fileUrl = null;
5590
+ try {
5591
+ fileUrl = await resolveFileUrl(storageUri, context);
5592
+ } catch (error) {
5593
+ if (!patch) throw error;
5594
+ }
5595
+ if (!fileUrl && !patch) return false;
5596
+ const changedAsset = { fileHash: asset.fileHash };
5597
+ if (fileUrl) {
5598
+ changedAsset.file = { url: fileUrl };
5599
+ if (usesBrotliAsset) changedAsset.file.compression = "br";
5600
+ }
5601
+ if (patch) changedAsset.patch = patch;
5602
+ return [assetPath, changedAsset];
5603
+ }));
5604
+ if (changedEntries.some((entry) => entry === false)) return null;
5605
+ return Object.fromEntries(changedEntries.filter((entry) => entry !== null));
5606
+ }
5607
+ async function resolveHbcPatchDescriptor({ currentBundle, resolveFileUrl, targetBundle, targetManifest, context }) {
5608
+ const matchingPatch = targetBundle && currentBundle ? getBundlePatch(targetBundle, currentBundle.id) : null;
5609
+ const patchAssetPath = resolveUniqueHbcAssetPath(targetManifest);
5610
+ if (!currentBundle || !matchingPatch || !patchAssetPath || !matchingPatch.patchStorageUri || !matchingPatch.patchFileHash || !matchingPatch.baseFileHash) return null;
5611
+ const patchUrl = await resolveFileUrl(matchingPatch.patchStorageUri, context);
5612
+ if (!patchUrl) return null;
5613
+ return {
5614
+ assetPath: patchAssetPath,
5615
+ patch: {
5616
+ algorithm: "bsdiff",
5617
+ baseBundleId: matchingPatch.baseBundleId,
5618
+ baseFileHash: matchingPatch.baseFileHash,
5619
+ patchFileHash: matchingPatch.patchFileHash,
5620
+ patchUrl
5621
+ }
5622
+ };
5623
+ }
5624
+ async function resolveManifestArtifacts({ currentBundle, resolveFileUrl, readStorageText, targetBundle, context }) {
5625
+ const manifestStorageUri = targetBundle ? getManifestStorageUri(targetBundle) : null;
5626
+ const manifestFileHash = targetBundle ? getManifestFileHash(targetBundle) : null;
5627
+ const assetBaseStorageUri = targetBundle ? getAssetBaseStorageUri(targetBundle) : null;
5628
+ if (!manifestStorageUri || !manifestFileHash || !assetBaseStorageUri) return null;
5629
+ const currentManifestStorageUri = currentBundle ? getManifestStorageUri(currentBundle) : null;
5630
+ const [targetManifestResult, currentManifestResult] = await Promise.all([fetchBundleManifest(manifestStorageUri, readStorageText, resolveFileUrl, context), currentManifestStorageUri ? fetchBundleManifest(currentManifestStorageUri, readStorageText, resolveFileUrl, context) : null]);
5631
+ if (!targetManifestResult) return null;
5632
+ const changedAssets = await resolveChangedAssets({
5633
+ assetBaseStorageUri,
5634
+ currentManifest: currentManifestResult?.manifest ?? null,
5635
+ currentBundle,
5636
+ resolveFileUrl,
5637
+ targetBundle,
5638
+ targetManifest: targetManifestResult.manifest,
5639
+ context
5640
+ });
5641
+ if (!changedAssets) return null;
5642
+ return {
5643
+ changedAssets,
5644
+ manifestFileHash,
5645
+ manifestUrl: targetManifestResult.fileUrl
5646
+ };
5647
+ }
5648
+ //#endregion
5439
5649
  //#region ../../packages/server/src/db/pluginCore.ts
5440
5650
  const PAGE_SIZE = 100;
5441
5651
  const DESC_ORDER = {
@@ -5530,101 +5740,1476 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
5530
5740
  }
5531
5741
  return makeResponse(bundle, "ROLLBACK");
5532
5742
  }
5533
- if (!pagination.hasNextPage) break;
5534
- after = data.at(-1)?.id;
5535
- if (!after) break;
5743
+ if (!pagination.hasNextPage) break;
5744
+ after = data.at(-1)?.id;
5745
+ if (!after) break;
5746
+ }
5747
+ if (args.bundleId === "00000000-0000-0000-0000-000000000000") return null;
5748
+ if (args.minBundleId && args.bundleId.localeCompare(args.minBundleId) <= 0) return null;
5749
+ return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
5750
+ };
5751
+ const getBaseWhere = ({ platform, channel, minBundleId }) => ({
5752
+ platform,
5753
+ channel,
5754
+ enabled: true,
5755
+ id: { gte: minBundleId }
5756
+ });
5757
+ return {
5758
+ api: {
5759
+ async getBundleById(id, context) {
5760
+ return getPlugin().getBundleById(id, context);
5761
+ },
5762
+ async getUpdateInfo(args, context) {
5763
+ const directGetUpdateInfo = getPlugin().getUpdateInfo;
5764
+ if (directGetUpdateInfo) return context === void 0 ? await directGetUpdateInfo(args) : await directGetUpdateInfo(args, context);
5765
+ const channel = args.channel ?? "production";
5766
+ const minBundleId = args.minBundleId ?? "00000000-0000-0000-0000-000000000000";
5767
+ const baseWhere = getBaseWhere({
5768
+ platform: args.platform,
5769
+ channel,
5770
+ minBundleId
5771
+ });
5772
+ if (args._updateStrategy === "fingerprint") return findUpdateInfoByScanning({
5773
+ args,
5774
+ queryWhere: {
5775
+ ...baseWhere,
5776
+ fingerprintHash: args.fingerprintHash
5777
+ },
5778
+ context,
5779
+ isCandidate: (bundle) => {
5780
+ return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && bundle.fingerprintHash === args.fingerprintHash;
5781
+ }
5782
+ });
5783
+ return findUpdateInfoByScanning({
5784
+ args,
5785
+ queryWhere: { ...baseWhere },
5786
+ context,
5787
+ isCandidate: (bundle) => {
5788
+ return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && !!bundle.targetAppVersion && semverSatisfies$1(bundle.targetAppVersion, args.appVersion);
5789
+ }
5790
+ });
5791
+ },
5792
+ async getAppUpdateInfo(args, context) {
5793
+ const info = await this.getUpdateInfo(args, context);
5794
+ if (!info) return null;
5795
+ const { storageUri, ...rest } = info;
5796
+ const readStorageText = options?.readStorageText;
5797
+ if (info.id === "00000000-0000-0000-0000-000000000000" || !readStorageText) {
5798
+ const fileUrl = await resolveFileUrl(storageUri ?? null, context);
5799
+ return {
5800
+ ...rest,
5801
+ fileUrl
5802
+ };
5803
+ }
5804
+ const [fileUrl, targetBundle, currentBundle] = await Promise.all([
5805
+ resolveFileUrl(storageUri ?? null, context),
5806
+ getPlugin().getBundleById(info.id, context),
5807
+ args.bundleId !== "00000000-0000-0000-0000-000000000000" ? getPlugin().getBundleById(args.bundleId, context) : null
5808
+ ]);
5809
+ const baseResponse = {
5810
+ ...rest,
5811
+ fileUrl
5812
+ };
5813
+ const manifestArtifacts = await resolveManifestArtifacts({
5814
+ currentBundle,
5815
+ resolveFileUrl,
5816
+ readStorageText,
5817
+ targetBundle,
5818
+ context
5819
+ });
5820
+ if (!manifestArtifacts) return baseResponse;
5821
+ return {
5822
+ ...baseResponse,
5823
+ ...manifestArtifacts
5824
+ };
5825
+ },
5826
+ async getChannels(context) {
5827
+ return getPlugin().getChannels(context);
5828
+ },
5829
+ async getBundles(options, context) {
5830
+ return getPlugin().getBundles(options, context);
5831
+ },
5832
+ async insertBundle(bundle, context) {
5833
+ assertBundlePersistenceConstraints(bundle);
5834
+ await runWithMutationPlugin(async (plugin) => {
5835
+ await plugin.appendBundle(bundle, context);
5836
+ await plugin.commitBundle(context);
5837
+ });
5838
+ },
5839
+ async updateBundleById(bundleId, newBundle, context) {
5840
+ await runWithMutationPlugin(async (plugin) => {
5841
+ const current = await plugin.getBundleById(bundleId, context);
5842
+ if (!current) throw new Error("targetBundleId not found");
5843
+ assertBundlePersistenceConstraints({
5844
+ ...current,
5845
+ ...newBundle
5846
+ });
5847
+ await plugin.updateBundle(bundleId, newBundle, context);
5848
+ await plugin.commitBundle(context);
5849
+ });
5850
+ },
5851
+ async deleteBundleById(bundleId, context) {
5852
+ await runWithMutationPlugin(async (plugin) => {
5853
+ const bundle = await plugin.getBundleById(bundleId, context);
5854
+ if (!bundle) return;
5855
+ await plugin.deleteBundle(bundle, context);
5856
+ await plugin.commitBundle(context);
5857
+ });
5858
+ }
5859
+ },
5860
+ adapterName: getPlugin().name,
5861
+ createMigrator: () => {
5862
+ throw new Error("createMigrator is only available for Kysely/Prisma/Drizzle database adapters.");
5863
+ },
5864
+ generateSchema: () => {
5865
+ throw new Error("generateSchema is only available for Kysely/Prisma/Drizzle database adapters.");
5866
+ }
5867
+ };
5868
+ }
5869
+ //#endregion
5870
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
5871
+ var require_constants = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5872
+ const SEMVER_SPEC_VERSION = "2.0.0";
5873
+ const MAX_LENGTH = 256;
5874
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
5875
+ module.exports = {
5876
+ MAX_LENGTH,
5877
+ MAX_SAFE_COMPONENT_LENGTH: 16,
5878
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
5879
+ MAX_SAFE_INTEGER,
5880
+ RELEASE_TYPES: [
5881
+ "major",
5882
+ "premajor",
5883
+ "minor",
5884
+ "preminor",
5885
+ "patch",
5886
+ "prepatch",
5887
+ "prerelease"
5888
+ ],
5889
+ SEMVER_SPEC_VERSION,
5890
+ FLAG_INCLUDE_PRERELEASE: 1,
5891
+ FLAG_LOOSE: 2
5892
+ };
5893
+ }));
5894
+ //#endregion
5895
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
5896
+ var require_debug = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5897
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
5898
+ }));
5899
+ //#endregion
5900
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js
5901
+ var require_re = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5902
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
5903
+ const debug = require_debug();
5904
+ exports = module.exports = {};
5905
+ const re = exports.re = [];
5906
+ const safeRe = exports.safeRe = [];
5907
+ const src = exports.src = [];
5908
+ const safeSrc = exports.safeSrc = [];
5909
+ const t = exports.t = {};
5910
+ let R = 0;
5911
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
5912
+ const safeRegexReplacements = [
5913
+ ["\\s", 1],
5914
+ ["\\d", MAX_LENGTH],
5915
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
5916
+ ];
5917
+ const makeSafeRegex = (value) => {
5918
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
5919
+ return value;
5920
+ };
5921
+ const createToken = (name, value, isGlobal) => {
5922
+ const safe = makeSafeRegex(value);
5923
+ const index = R++;
5924
+ debug(name, index, value);
5925
+ t[name] = index;
5926
+ src[index] = value;
5927
+ safeSrc[index] = safe;
5928
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
5929
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
5930
+ };
5931
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
5932
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
5933
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
5934
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
5935
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
5936
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
5937
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
5938
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
5939
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
5940
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
5941
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
5942
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
5943
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
5944
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
5945
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
5946
+ createToken("GTLT", "((?:<|>)?=?)");
5947
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
5948
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
5949
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
5950
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
5951
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
5952
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
5953
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
5954
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
5955
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
5956
+ createToken("COERCERTL", src[t.COERCE], true);
5957
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
5958
+ createToken("LONETILDE", "(?:~>?)");
5959
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
5960
+ exports.tildeTrimReplace = "$1~";
5961
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
5962
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
5963
+ createToken("LONECARET", "(?:\\^)");
5964
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
5965
+ exports.caretTrimReplace = "$1^";
5966
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
5967
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
5968
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
5969
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
5970
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
5971
+ exports.comparatorTrimReplace = "$1$2$3";
5972
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
5973
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
5974
+ createToken("STAR", "(<|>)?=?\\s*\\*");
5975
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
5976
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
5977
+ }));
5978
+ //#endregion
5979
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js
5980
+ var require_parse_options = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5981
+ const looseOption = Object.freeze({ loose: true });
5982
+ const emptyOpts = Object.freeze({});
5983
+ const parseOptions = (options) => {
5984
+ if (!options) return emptyOpts;
5985
+ if (typeof options !== "object") return looseOption;
5986
+ return options;
5987
+ };
5988
+ module.exports = parseOptions;
5989
+ }));
5990
+ //#endregion
5991
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js
5992
+ var require_identifiers = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5993
+ const numeric = /^[0-9]+$/;
5994
+ const compareIdentifiers = (a, b) => {
5995
+ if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
5996
+ const anum = numeric.test(a);
5997
+ const bnum = numeric.test(b);
5998
+ if (anum && bnum) {
5999
+ a = +a;
6000
+ b = +b;
6001
+ }
6002
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
6003
+ };
6004
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
6005
+ module.exports = {
6006
+ compareIdentifiers,
6007
+ rcompareIdentifiers
6008
+ };
6009
+ }));
6010
+ //#endregion
6011
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js
6012
+ var require_semver$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6013
+ const debug = require_debug();
6014
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
6015
+ const { safeRe: re, t } = require_re();
6016
+ const parseOptions = require_parse_options();
6017
+ const { compareIdentifiers } = require_identifiers();
6018
+ module.exports = class SemVer {
6019
+ constructor(version, options) {
6020
+ options = parseOptions(options);
6021
+ if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
6022
+ else version = version.version;
6023
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
6024
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
6025
+ debug("SemVer", version, options);
6026
+ this.options = options;
6027
+ this.loose = !!options.loose;
6028
+ this.includePrerelease = !!options.includePrerelease;
6029
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
6030
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
6031
+ this.raw = version;
6032
+ this.major = +m[1];
6033
+ this.minor = +m[2];
6034
+ this.patch = +m[3];
6035
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
6036
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
6037
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
6038
+ if (!m[4]) this.prerelease = [];
6039
+ else this.prerelease = m[4].split(".").map((id) => {
6040
+ if (/^[0-9]+$/.test(id)) {
6041
+ const num = +id;
6042
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
6043
+ }
6044
+ return id;
6045
+ });
6046
+ this.build = m[5] ? m[5].split(".") : [];
6047
+ this.format();
6048
+ }
6049
+ format() {
6050
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
6051
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
6052
+ return this.version;
6053
+ }
6054
+ toString() {
6055
+ return this.version;
6056
+ }
6057
+ compare(other) {
6058
+ debug("SemVer.compare", this.version, this.options, other);
6059
+ if (!(other instanceof SemVer)) {
6060
+ if (typeof other === "string" && other === this.version) return 0;
6061
+ other = new SemVer(other, this.options);
6062
+ }
6063
+ if (other.version === this.version) return 0;
6064
+ return this.compareMain(other) || this.comparePre(other);
6065
+ }
6066
+ compareMain(other) {
6067
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
6068
+ if (this.major < other.major) return -1;
6069
+ if (this.major > other.major) return 1;
6070
+ if (this.minor < other.minor) return -1;
6071
+ if (this.minor > other.minor) return 1;
6072
+ if (this.patch < other.patch) return -1;
6073
+ if (this.patch > other.patch) return 1;
6074
+ return 0;
6075
+ }
6076
+ comparePre(other) {
6077
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
6078
+ if (this.prerelease.length && !other.prerelease.length) return -1;
6079
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
6080
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
6081
+ let i = 0;
6082
+ do {
6083
+ const a = this.prerelease[i];
6084
+ const b = other.prerelease[i];
6085
+ debug("prerelease compare", i, a, b);
6086
+ if (a === void 0 && b === void 0) return 0;
6087
+ else if (b === void 0) return 1;
6088
+ else if (a === void 0) return -1;
6089
+ else if (a === b) continue;
6090
+ else return compareIdentifiers(a, b);
6091
+ } while (++i);
6092
+ }
6093
+ compareBuild(other) {
6094
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
6095
+ let i = 0;
6096
+ do {
6097
+ const a = this.build[i];
6098
+ const b = other.build[i];
6099
+ debug("build compare", i, a, b);
6100
+ if (a === void 0 && b === void 0) return 0;
6101
+ else if (b === void 0) return 1;
6102
+ else if (a === void 0) return -1;
6103
+ else if (a === b) continue;
6104
+ else return compareIdentifiers(a, b);
6105
+ } while (++i);
6106
+ }
6107
+ inc(release, identifier, identifierBase) {
6108
+ if (release.startsWith("pre")) {
6109
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
6110
+ if (identifier) {
6111
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
6112
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
6113
+ }
6114
+ }
6115
+ switch (release) {
6116
+ case "premajor":
6117
+ this.prerelease.length = 0;
6118
+ this.patch = 0;
6119
+ this.minor = 0;
6120
+ this.major++;
6121
+ this.inc("pre", identifier, identifierBase);
6122
+ break;
6123
+ case "preminor":
6124
+ this.prerelease.length = 0;
6125
+ this.patch = 0;
6126
+ this.minor++;
6127
+ this.inc("pre", identifier, identifierBase);
6128
+ break;
6129
+ case "prepatch":
6130
+ this.prerelease.length = 0;
6131
+ this.inc("patch", identifier, identifierBase);
6132
+ this.inc("pre", identifier, identifierBase);
6133
+ break;
6134
+ case "prerelease":
6135
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
6136
+ this.inc("pre", identifier, identifierBase);
6137
+ break;
6138
+ case "release":
6139
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
6140
+ this.prerelease.length = 0;
6141
+ break;
6142
+ case "major":
6143
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
6144
+ this.minor = 0;
6145
+ this.patch = 0;
6146
+ this.prerelease = [];
6147
+ break;
6148
+ case "minor":
6149
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
6150
+ this.patch = 0;
6151
+ this.prerelease = [];
6152
+ break;
6153
+ case "patch":
6154
+ if (this.prerelease.length === 0) this.patch++;
6155
+ this.prerelease = [];
6156
+ break;
6157
+ case "pre": {
6158
+ const base = Number(identifierBase) ? 1 : 0;
6159
+ if (this.prerelease.length === 0) this.prerelease = [base];
6160
+ else {
6161
+ let i = this.prerelease.length;
6162
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
6163
+ this.prerelease[i]++;
6164
+ i = -2;
6165
+ }
6166
+ if (i === -1) {
6167
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
6168
+ this.prerelease.push(base);
6169
+ }
6170
+ }
6171
+ if (identifier) {
6172
+ let prerelease = [identifier, base];
6173
+ if (identifierBase === false) prerelease = [identifier];
6174
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
6175
+ if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
6176
+ } else this.prerelease = prerelease;
6177
+ }
6178
+ break;
6179
+ }
6180
+ default: throw new Error(`invalid increment argument: ${release}`);
6181
+ }
6182
+ this.raw = this.format();
6183
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
6184
+ return this;
6185
+ }
6186
+ };
6187
+ }));
6188
+ //#endregion
6189
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js
6190
+ var require_parse = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6191
+ const SemVer = require_semver$1();
6192
+ const parse = (version, options, throwErrors = false) => {
6193
+ if (version instanceof SemVer) return version;
6194
+ try {
6195
+ return new SemVer(version, options);
6196
+ } catch (er) {
6197
+ if (!throwErrors) return null;
6198
+ throw er;
6199
+ }
6200
+ };
6201
+ module.exports = parse;
6202
+ }));
6203
+ //#endregion
6204
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js
6205
+ var require_valid$1 = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6206
+ const parse = require_parse();
6207
+ const valid = (version, options) => {
6208
+ const v = parse(version, options);
6209
+ return v ? v.version : null;
6210
+ };
6211
+ module.exports = valid;
6212
+ }));
6213
+ //#endregion
6214
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js
6215
+ var require_clean = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6216
+ const parse = require_parse();
6217
+ const clean = (version, options) => {
6218
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
6219
+ return s ? s.version : null;
6220
+ };
6221
+ module.exports = clean;
6222
+ }));
6223
+ //#endregion
6224
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js
6225
+ var require_inc = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6226
+ const SemVer = require_semver$1();
6227
+ const inc = (version, release, options, identifier, identifierBase) => {
6228
+ if (typeof options === "string") {
6229
+ identifierBase = identifier;
6230
+ identifier = options;
6231
+ options = void 0;
6232
+ }
6233
+ try {
6234
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
6235
+ } catch (er) {
6236
+ return null;
6237
+ }
6238
+ };
6239
+ module.exports = inc;
6240
+ }));
6241
+ //#endregion
6242
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js
6243
+ var require_diff = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6244
+ const parse = require_parse();
6245
+ const diff = (version1, version2) => {
6246
+ const v1 = parse(version1, null, true);
6247
+ const v2 = parse(version2, null, true);
6248
+ const comparison = v1.compare(v2);
6249
+ if (comparison === 0) return null;
6250
+ const v1Higher = comparison > 0;
6251
+ const highVersion = v1Higher ? v1 : v2;
6252
+ const lowVersion = v1Higher ? v2 : v1;
6253
+ const highHasPre = !!highVersion.prerelease.length;
6254
+ if (!!lowVersion.prerelease.length && !highHasPre) {
6255
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
6256
+ if (lowVersion.compareMain(highVersion) === 0) {
6257
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
6258
+ return "patch";
6259
+ }
6260
+ }
6261
+ const prefix = highHasPre ? "pre" : "";
6262
+ if (v1.major !== v2.major) return prefix + "major";
6263
+ if (v1.minor !== v2.minor) return prefix + "minor";
6264
+ if (v1.patch !== v2.patch) return prefix + "patch";
6265
+ return "prerelease";
6266
+ };
6267
+ module.exports = diff;
6268
+ }));
6269
+ //#endregion
6270
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js
6271
+ var require_major = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6272
+ const SemVer = require_semver$1();
6273
+ const major = (a, loose) => new SemVer(a, loose).major;
6274
+ module.exports = major;
6275
+ }));
6276
+ //#endregion
6277
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js
6278
+ var require_minor = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6279
+ const SemVer = require_semver$1();
6280
+ const minor = (a, loose) => new SemVer(a, loose).minor;
6281
+ module.exports = minor;
6282
+ }));
6283
+ //#endregion
6284
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js
6285
+ var require_patch = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6286
+ const SemVer = require_semver$1();
6287
+ const patch = (a, loose) => new SemVer(a, loose).patch;
6288
+ module.exports = patch;
6289
+ }));
6290
+ //#endregion
6291
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js
6292
+ var require_prerelease = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6293
+ const parse = require_parse();
6294
+ const prerelease = (version, options) => {
6295
+ const parsed = parse(version, options);
6296
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
6297
+ };
6298
+ module.exports = prerelease;
6299
+ }));
6300
+ //#endregion
6301
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js
6302
+ var require_compare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6303
+ const SemVer = require_semver$1();
6304
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
6305
+ module.exports = compare;
6306
+ }));
6307
+ //#endregion
6308
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js
6309
+ var require_rcompare = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6310
+ const compare = require_compare();
6311
+ const rcompare = (a, b, loose) => compare(b, a, loose);
6312
+ module.exports = rcompare;
6313
+ }));
6314
+ //#endregion
6315
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js
6316
+ var require_compare_loose = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6317
+ const compare = require_compare();
6318
+ const compareLoose = (a, b) => compare(a, b, true);
6319
+ module.exports = compareLoose;
6320
+ }));
6321
+ //#endregion
6322
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js
6323
+ var require_compare_build = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6324
+ const SemVer = require_semver$1();
6325
+ const compareBuild = (a, b, loose) => {
6326
+ const versionA = new SemVer(a, loose);
6327
+ const versionB = new SemVer(b, loose);
6328
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
6329
+ };
6330
+ module.exports = compareBuild;
6331
+ }));
6332
+ //#endregion
6333
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js
6334
+ var require_sort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6335
+ const compareBuild = require_compare_build();
6336
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
6337
+ module.exports = sort;
6338
+ }));
6339
+ //#endregion
6340
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js
6341
+ var require_rsort = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6342
+ const compareBuild = require_compare_build();
6343
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
6344
+ module.exports = rsort;
6345
+ }));
6346
+ //#endregion
6347
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js
6348
+ var require_gt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6349
+ const compare = require_compare();
6350
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
6351
+ module.exports = gt;
6352
+ }));
6353
+ //#endregion
6354
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js
6355
+ var require_lt = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6356
+ const compare = require_compare();
6357
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
6358
+ module.exports = lt;
6359
+ }));
6360
+ //#endregion
6361
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js
6362
+ var require_eq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6363
+ const compare = require_compare();
6364
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
6365
+ module.exports = eq;
6366
+ }));
6367
+ //#endregion
6368
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js
6369
+ var require_neq = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6370
+ const compare = require_compare();
6371
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
6372
+ module.exports = neq;
6373
+ }));
6374
+ //#endregion
6375
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js
6376
+ var require_gte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6377
+ const compare = require_compare();
6378
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
6379
+ module.exports = gte;
6380
+ }));
6381
+ //#endregion
6382
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js
6383
+ var require_lte = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6384
+ const compare = require_compare();
6385
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
6386
+ module.exports = lte;
6387
+ }));
6388
+ //#endregion
6389
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js
6390
+ var require_cmp = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6391
+ const eq = require_eq();
6392
+ const neq = require_neq();
6393
+ const gt = require_gt();
6394
+ const gte = require_gte();
6395
+ const lt = require_lt();
6396
+ const lte = require_lte();
6397
+ const cmp = (a, op, b, loose) => {
6398
+ switch (op) {
6399
+ case "===":
6400
+ if (typeof a === "object") a = a.version;
6401
+ if (typeof b === "object") b = b.version;
6402
+ return a === b;
6403
+ case "!==":
6404
+ if (typeof a === "object") a = a.version;
6405
+ if (typeof b === "object") b = b.version;
6406
+ return a !== b;
6407
+ case "":
6408
+ case "=":
6409
+ case "==": return eq(a, b, loose);
6410
+ case "!=": return neq(a, b, loose);
6411
+ case ">": return gt(a, b, loose);
6412
+ case ">=": return gte(a, b, loose);
6413
+ case "<": return lt(a, b, loose);
6414
+ case "<=": return lte(a, b, loose);
6415
+ default: throw new TypeError(`Invalid operator: ${op}`);
6416
+ }
6417
+ };
6418
+ module.exports = cmp;
6419
+ }));
6420
+ //#endregion
6421
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js
6422
+ var require_coerce = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6423
+ const SemVer = require_semver$1();
6424
+ const parse = require_parse();
6425
+ const { safeRe: re, t } = require_re();
6426
+ const coerce = (version, options) => {
6427
+ if (version instanceof SemVer) return version;
6428
+ if (typeof version === "number") version = String(version);
6429
+ if (typeof version !== "string") return null;
6430
+ options = options || {};
6431
+ let match = null;
6432
+ if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
6433
+ else {
6434
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
6435
+ let next;
6436
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
6437
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
6438
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
6439
+ }
6440
+ coerceRtlRegex.lastIndex = -1;
6441
+ }
6442
+ if (match === null) return null;
6443
+ const major = match[2];
6444
+ return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
6445
+ };
6446
+ module.exports = coerce;
6447
+ }));
6448
+ //#endregion
6449
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js
6450
+ var require_lrucache = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6451
+ var LRUCache = class {
6452
+ constructor() {
6453
+ this.max = 1e3;
6454
+ this.map = /* @__PURE__ */ new Map();
6455
+ }
6456
+ get(key) {
6457
+ const value = this.map.get(key);
6458
+ if (value === void 0) return;
6459
+ else {
6460
+ this.map.delete(key);
6461
+ this.map.set(key, value);
6462
+ return value;
6463
+ }
6464
+ }
6465
+ delete(key) {
6466
+ return this.map.delete(key);
6467
+ }
6468
+ set(key, value) {
6469
+ if (!this.delete(key) && value !== void 0) {
6470
+ if (this.map.size >= this.max) {
6471
+ const firstKey = this.map.keys().next().value;
6472
+ this.delete(firstKey);
6473
+ }
6474
+ this.map.set(key, value);
6475
+ }
6476
+ return this;
6477
+ }
6478
+ };
6479
+ module.exports = LRUCache;
6480
+ }));
6481
+ //#endregion
6482
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js
6483
+ var require_range = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6484
+ const SPACE_CHARACTERS = /\s+/g;
6485
+ module.exports = class Range {
6486
+ constructor(range, options) {
6487
+ options = parseOptions(options);
6488
+ if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
6489
+ else return new Range(range.raw, options);
6490
+ if (range instanceof Comparator) {
6491
+ this.raw = range.value;
6492
+ this.set = [[range]];
6493
+ this.formatted = void 0;
6494
+ return this;
6495
+ }
6496
+ this.options = options;
6497
+ this.loose = !!options.loose;
6498
+ this.includePrerelease = !!options.includePrerelease;
6499
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
6500
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
6501
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
6502
+ if (this.set.length > 1) {
6503
+ const first = this.set[0];
6504
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
6505
+ if (this.set.length === 0) this.set = [first];
6506
+ else if (this.set.length > 1) {
6507
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
6508
+ this.set = [c];
6509
+ break;
6510
+ }
6511
+ }
6512
+ }
6513
+ this.formatted = void 0;
6514
+ }
6515
+ get range() {
6516
+ if (this.formatted === void 0) {
6517
+ this.formatted = "";
6518
+ for (let i = 0; i < this.set.length; i++) {
6519
+ if (i > 0) this.formatted += "||";
6520
+ const comps = this.set[i];
6521
+ for (let k = 0; k < comps.length; k++) {
6522
+ if (k > 0) this.formatted += " ";
6523
+ this.formatted += comps[k].toString().trim();
6524
+ }
6525
+ }
6526
+ }
6527
+ return this.formatted;
6528
+ }
6529
+ format() {
6530
+ return this.range;
6531
+ }
6532
+ toString() {
6533
+ return this.range;
6534
+ }
6535
+ parseRange(range) {
6536
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
6537
+ const cached = cache.get(memoKey);
6538
+ if (cached) return cached;
6539
+ const loose = this.options.loose;
6540
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
6541
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
6542
+ debug("hyphen replace", range);
6543
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
6544
+ debug("comparator trim", range);
6545
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
6546
+ debug("tilde trim", range);
6547
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
6548
+ debug("caret trim", range);
6549
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
6550
+ if (loose) rangeList = rangeList.filter((comp) => {
6551
+ debug("loose invalid filter", comp, this.options);
6552
+ return !!comp.match(re[t.COMPARATORLOOSE]);
6553
+ });
6554
+ debug("range list", rangeList);
6555
+ const rangeMap = /* @__PURE__ */ new Map();
6556
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
6557
+ for (const comp of comparators) {
6558
+ if (isNullSet(comp)) return [comp];
6559
+ rangeMap.set(comp.value, comp);
6560
+ }
6561
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
6562
+ const result = [...rangeMap.values()];
6563
+ cache.set(memoKey, result);
6564
+ return result;
6565
+ }
6566
+ intersects(range, options) {
6567
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
6568
+ return this.set.some((thisComparators) => {
6569
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
6570
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
6571
+ return rangeComparators.every((rangeComparator) => {
6572
+ return thisComparator.intersects(rangeComparator, options);
6573
+ });
6574
+ });
6575
+ });
6576
+ });
6577
+ }
6578
+ test(version) {
6579
+ if (!version) return false;
6580
+ if (typeof version === "string") try {
6581
+ version = new SemVer(version, this.options);
6582
+ } catch (er) {
6583
+ return false;
6584
+ }
6585
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
6586
+ return false;
6587
+ }
6588
+ };
6589
+ const cache = new (require_lrucache())();
6590
+ const parseOptions = require_parse_options();
6591
+ const Comparator = require_comparator();
6592
+ const debug = require_debug();
6593
+ const SemVer = require_semver$1();
6594
+ const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
6595
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
6596
+ const isNullSet = (c) => c.value === "<0.0.0-0";
6597
+ const isAny = (c) => c.value === "";
6598
+ const isSatisfiable = (comparators, options) => {
6599
+ let result = true;
6600
+ const remainingComparators = comparators.slice();
6601
+ let testComparator = remainingComparators.pop();
6602
+ while (result && remainingComparators.length) {
6603
+ result = remainingComparators.every((otherComparator) => {
6604
+ return testComparator.intersects(otherComparator, options);
6605
+ });
6606
+ testComparator = remainingComparators.pop();
6607
+ }
6608
+ return result;
6609
+ };
6610
+ const parseComparator = (comp, options) => {
6611
+ comp = comp.replace(re[t.BUILD], "");
6612
+ debug("comp", comp, options);
6613
+ comp = replaceCarets(comp, options);
6614
+ debug("caret", comp);
6615
+ comp = replaceTildes(comp, options);
6616
+ debug("tildes", comp);
6617
+ comp = replaceXRanges(comp, options);
6618
+ debug("xrange", comp);
6619
+ comp = replaceStars(comp, options);
6620
+ debug("stars", comp);
6621
+ return comp;
6622
+ };
6623
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
6624
+ const replaceTildes = (comp, options) => {
6625
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
6626
+ };
6627
+ const replaceTilde = (comp, options) => {
6628
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
6629
+ return comp.replace(r, (_, M, m, p, pr) => {
6630
+ debug("tilde", comp, _, M, m, p, pr);
6631
+ let ret;
6632
+ if (isX(M)) ret = "";
6633
+ else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
6634
+ else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
6635
+ else if (pr) {
6636
+ debug("replaceTilde pr", pr);
6637
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
6638
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
6639
+ debug("tilde return", ret);
6640
+ return ret;
6641
+ });
6642
+ };
6643
+ const replaceCarets = (comp, options) => {
6644
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
6645
+ };
6646
+ const replaceCaret = (comp, options) => {
6647
+ debug("caret", comp, options);
6648
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
6649
+ const z = options.includePrerelease ? "-0" : "";
6650
+ return comp.replace(r, (_, M, m, p, pr) => {
6651
+ debug("caret", comp, _, M, m, p, pr);
6652
+ let ret;
6653
+ if (isX(M)) ret = "";
6654
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
6655
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
6656
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
6657
+ else if (pr) {
6658
+ debug("replaceCaret pr", pr);
6659
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
6660
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
6661
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
6662
+ } else {
6663
+ debug("no pr");
6664
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
6665
+ else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
6666
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
6667
+ }
6668
+ debug("caret return", ret);
6669
+ return ret;
6670
+ });
6671
+ };
6672
+ const replaceXRanges = (comp, options) => {
6673
+ debug("replaceXRanges", comp, options);
6674
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
6675
+ };
6676
+ const replaceXRange = (comp, options) => {
6677
+ comp = comp.trim();
6678
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
6679
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
6680
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
6681
+ const xM = isX(M);
6682
+ const xm = xM || isX(m);
6683
+ const xp = xm || isX(p);
6684
+ const anyX = xp;
6685
+ if (gtlt === "=" && anyX) gtlt = "";
6686
+ pr = options.includePrerelease ? "-0" : "";
6687
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
6688
+ else ret = "*";
6689
+ else if (gtlt && anyX) {
6690
+ if (xm) m = 0;
6691
+ p = 0;
6692
+ if (gtlt === ">") {
6693
+ gtlt = ">=";
6694
+ if (xm) {
6695
+ M = +M + 1;
6696
+ m = 0;
6697
+ p = 0;
6698
+ } else {
6699
+ m = +m + 1;
6700
+ p = 0;
6701
+ }
6702
+ } else if (gtlt === "<=") {
6703
+ gtlt = "<";
6704
+ if (xm) M = +M + 1;
6705
+ else m = +m + 1;
6706
+ }
6707
+ if (gtlt === "<") pr = "-0";
6708
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
6709
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
6710
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
6711
+ debug("xRange return", ret);
6712
+ return ret;
6713
+ });
6714
+ };
6715
+ const replaceStars = (comp, options) => {
6716
+ debug("replaceStars", comp, options);
6717
+ return comp.trim().replace(re[t.STAR], "");
6718
+ };
6719
+ const replaceGTE0 = (comp, options) => {
6720
+ debug("replaceGTE0", comp, options);
6721
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
6722
+ };
6723
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
6724
+ if (isX(fM)) from = "";
6725
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
6726
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
6727
+ else if (fpr) from = `>=${from}`;
6728
+ else from = `>=${from}${incPr ? "-0" : ""}`;
6729
+ if (isX(tM)) to = "";
6730
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
6731
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
6732
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
6733
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
6734
+ else to = `<=${to}`;
6735
+ return `${from} ${to}`.trim();
6736
+ };
6737
+ const testSet = (set, version, options) => {
6738
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
6739
+ if (version.prerelease.length && !options.includePrerelease) {
6740
+ for (let i = 0; i < set.length; i++) {
6741
+ debug(set[i].semver);
6742
+ if (set[i].semver === Comparator.ANY) continue;
6743
+ if (set[i].semver.prerelease.length > 0) {
6744
+ const allowed = set[i].semver;
6745
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
6746
+ }
6747
+ }
6748
+ return false;
6749
+ }
6750
+ return true;
6751
+ };
6752
+ }));
6753
+ //#endregion
6754
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js
6755
+ var require_comparator = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6756
+ const ANY = Symbol("SemVer ANY");
6757
+ module.exports = class Comparator {
6758
+ static get ANY() {
6759
+ return ANY;
6760
+ }
6761
+ constructor(comp, options) {
6762
+ options = parseOptions(options);
6763
+ if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
6764
+ else comp = comp.value;
6765
+ comp = comp.trim().split(/\s+/).join(" ");
6766
+ debug("comparator", comp, options);
6767
+ this.options = options;
6768
+ this.loose = !!options.loose;
6769
+ this.parse(comp);
6770
+ if (this.semver === ANY) this.value = "";
6771
+ else this.value = this.operator + this.semver.version;
6772
+ debug("comp", this);
6773
+ }
6774
+ parse(comp) {
6775
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
6776
+ const m = comp.match(r);
6777
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
6778
+ this.operator = m[1] !== void 0 ? m[1] : "";
6779
+ if (this.operator === "=") this.operator = "";
6780
+ if (!m[2]) this.semver = ANY;
6781
+ else this.semver = new SemVer(m[2], this.options.loose);
6782
+ }
6783
+ toString() {
6784
+ return this.value;
6785
+ }
6786
+ test(version) {
6787
+ debug("Comparator.test", version, this.options.loose);
6788
+ if (this.semver === ANY || version === ANY) return true;
6789
+ if (typeof version === "string") try {
6790
+ version = new SemVer(version, this.options);
6791
+ } catch (er) {
6792
+ return false;
6793
+ }
6794
+ return cmp(version, this.operator, this.semver, this.options);
6795
+ }
6796
+ intersects(comp, options) {
6797
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
6798
+ if (this.operator === "") {
6799
+ if (this.value === "") return true;
6800
+ return new Range(comp.value, options).test(this.value);
6801
+ } else if (comp.operator === "") {
6802
+ if (comp.value === "") return true;
6803
+ return new Range(this.value, options).test(comp.semver);
6804
+ }
6805
+ options = parseOptions(options);
6806
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
6807
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
6808
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
6809
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
6810
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
6811
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
6812
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
6813
+ return false;
6814
+ }
6815
+ };
6816
+ const parseOptions = require_parse_options();
6817
+ const { safeRe: re, t } = require_re();
6818
+ const cmp = require_cmp();
6819
+ const debug = require_debug();
6820
+ const SemVer = require_semver$1();
6821
+ const Range = require_range();
6822
+ }));
6823
+ //#endregion
6824
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js
6825
+ var require_satisfies = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6826
+ const Range = require_range();
6827
+ const satisfies = (version, range, options) => {
6828
+ try {
6829
+ range = new Range(range, options);
6830
+ } catch (er) {
6831
+ return false;
6832
+ }
6833
+ return range.test(version);
6834
+ };
6835
+ module.exports = satisfies;
6836
+ }));
6837
+ //#endregion
6838
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
6839
+ var require_to_comparators = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6840
+ const Range = require_range();
6841
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
6842
+ module.exports = toComparators;
6843
+ }));
6844
+ //#endregion
6845
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
6846
+ var require_max_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6847
+ const SemVer = require_semver$1();
6848
+ const Range = require_range();
6849
+ const maxSatisfying = (versions, range, options) => {
6850
+ let max = null;
6851
+ let maxSV = null;
6852
+ let rangeObj = null;
6853
+ try {
6854
+ rangeObj = new Range(range, options);
6855
+ } catch (er) {
6856
+ return null;
6857
+ }
6858
+ versions.forEach((v) => {
6859
+ if (rangeObj.test(v)) {
6860
+ if (!max || maxSV.compare(v) === -1) {
6861
+ max = v;
6862
+ maxSV = new SemVer(max, options);
6863
+ }
6864
+ }
6865
+ });
6866
+ return max;
6867
+ };
6868
+ module.exports = maxSatisfying;
6869
+ }));
6870
+ //#endregion
6871
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
6872
+ var require_min_satisfying = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6873
+ const SemVer = require_semver$1();
6874
+ const Range = require_range();
6875
+ const minSatisfying = (versions, range, options) => {
6876
+ let min = null;
6877
+ let minSV = null;
6878
+ let rangeObj = null;
6879
+ try {
6880
+ rangeObj = new Range(range, options);
6881
+ } catch (er) {
6882
+ return null;
6883
+ }
6884
+ versions.forEach((v) => {
6885
+ if (rangeObj.test(v)) {
6886
+ if (!min || minSV.compare(v) === 1) {
6887
+ min = v;
6888
+ minSV = new SemVer(min, options);
6889
+ }
6890
+ }
6891
+ });
6892
+ return min;
6893
+ };
6894
+ module.exports = minSatisfying;
6895
+ }));
6896
+ //#endregion
6897
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js
6898
+ var require_min_version = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6899
+ const SemVer = require_semver$1();
6900
+ const Range = require_range();
6901
+ const gt = require_gt();
6902
+ const minVersion = (range, loose) => {
6903
+ range = new Range(range, loose);
6904
+ let minver = new SemVer("0.0.0");
6905
+ if (range.test(minver)) return minver;
6906
+ minver = new SemVer("0.0.0-0");
6907
+ if (range.test(minver)) return minver;
6908
+ minver = null;
6909
+ for (let i = 0; i < range.set.length; ++i) {
6910
+ const comparators = range.set[i];
6911
+ let setMin = null;
6912
+ comparators.forEach((comparator) => {
6913
+ const compver = new SemVer(comparator.semver.version);
6914
+ switch (comparator.operator) {
6915
+ case ">":
6916
+ if (compver.prerelease.length === 0) compver.patch++;
6917
+ else compver.prerelease.push(0);
6918
+ compver.raw = compver.format();
6919
+ case "":
6920
+ case ">=":
6921
+ if (!setMin || gt(compver, setMin)) setMin = compver;
6922
+ break;
6923
+ case "<":
6924
+ case "<=": break;
6925
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
6926
+ }
6927
+ });
6928
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
6929
+ }
6930
+ if (minver && range.test(minver)) return minver;
6931
+ return null;
6932
+ };
6933
+ module.exports = minVersion;
6934
+ }));
6935
+ //#endregion
6936
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
6937
+ var require_valid = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6938
+ const Range = require_range();
6939
+ const validRange = (range, options) => {
6940
+ try {
6941
+ return new Range(range, options).range || "*";
6942
+ } catch (er) {
6943
+ return null;
6944
+ }
6945
+ };
6946
+ module.exports = validRange;
6947
+ }));
6948
+ //#endregion
6949
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js
6950
+ var require_outside = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
6951
+ const SemVer = require_semver$1();
6952
+ const Comparator = require_comparator();
6953
+ const { ANY } = Comparator;
6954
+ const Range = require_range();
6955
+ const satisfies = require_satisfies();
6956
+ const gt = require_gt();
6957
+ const lt = require_lt();
6958
+ const lte = require_lte();
6959
+ const gte = require_gte();
6960
+ const outside = (version, range, hilo, options) => {
6961
+ version = new SemVer(version, options);
6962
+ range = new Range(range, options);
6963
+ let gtfn, ltefn, ltfn, comp, ecomp;
6964
+ switch (hilo) {
6965
+ case ">":
6966
+ gtfn = gt;
6967
+ ltefn = lte;
6968
+ ltfn = lt;
6969
+ comp = ">";
6970
+ ecomp = ">=";
6971
+ break;
6972
+ case "<":
6973
+ gtfn = lt;
6974
+ ltefn = gte;
6975
+ ltfn = gt;
6976
+ comp = "<";
6977
+ ecomp = "<=";
6978
+ break;
6979
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
6980
+ }
6981
+ if (satisfies(version, range, options)) return false;
6982
+ for (let i = 0; i < range.set.length; ++i) {
6983
+ const comparators = range.set[i];
6984
+ let high = null;
6985
+ let low = null;
6986
+ comparators.forEach((comparator) => {
6987
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
6988
+ high = high || comparator;
6989
+ low = low || comparator;
6990
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
6991
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
6992
+ });
6993
+ if (high.operator === comp || high.operator === ecomp) return false;
6994
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
6995
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
6996
+ }
6997
+ return true;
6998
+ };
6999
+ module.exports = outside;
7000
+ }));
7001
+ //#endregion
7002
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js
7003
+ var require_gtr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
7004
+ const outside = require_outside();
7005
+ const gtr = (version, range, options) => outside(version, range, ">", options);
7006
+ module.exports = gtr;
7007
+ }));
7008
+ //#endregion
7009
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js
7010
+ var require_ltr = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
7011
+ const outside = require_outside();
7012
+ const ltr = (version, range, options) => outside(version, range, "<", options);
7013
+ module.exports = ltr;
7014
+ }));
7015
+ //#endregion
7016
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js
7017
+ var require_intersects = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
7018
+ const Range = require_range();
7019
+ const intersects = (r1, r2, options) => {
7020
+ r1 = new Range(r1, options);
7021
+ r2 = new Range(r2, options);
7022
+ return r1.intersects(r2, options);
7023
+ };
7024
+ module.exports = intersects;
7025
+ }));
7026
+ //#endregion
7027
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js
7028
+ var require_simplify = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
7029
+ const satisfies = require_satisfies();
7030
+ const compare = require_compare();
7031
+ module.exports = (versions, range, options) => {
7032
+ const set = [];
7033
+ let first = null;
7034
+ let prev = null;
7035
+ const v = versions.sort((a, b) => compare(a, b, options));
7036
+ for (const version of v) if (satisfies(version, range, options)) {
7037
+ prev = version;
7038
+ if (!first) first = version;
7039
+ } else {
7040
+ if (prev) set.push([first, prev]);
7041
+ prev = null;
7042
+ first = null;
7043
+ }
7044
+ if (first) set.push([first, null]);
7045
+ const ranges = [];
7046
+ for (const [min, max] of set) if (min === max) ranges.push(min);
7047
+ else if (!max && min === v[0]) ranges.push("*");
7048
+ else if (!max) ranges.push(`>=${min}`);
7049
+ else if (min === v[0]) ranges.push(`<=${max}`);
7050
+ else ranges.push(`${min} - ${max}`);
7051
+ const simplified = ranges.join(" || ");
7052
+ const original = typeof range.raw === "string" ? range.raw : String(range);
7053
+ return simplified.length < original.length ? simplified : range;
7054
+ };
7055
+ }));
7056
+ //#endregion
7057
+ //#region ../../node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js
7058
+ var require_subset = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
7059
+ const Range = require_range();
7060
+ const Comparator = require_comparator();
7061
+ const { ANY } = Comparator;
7062
+ const satisfies = require_satisfies();
7063
+ const compare = require_compare();
7064
+ const subset = (sub, dom, options = {}) => {
7065
+ if (sub === dom) return true;
7066
+ sub = new Range(sub, options);
7067
+ dom = new Range(dom, options);
7068
+ let sawNonNull = false;
7069
+ OUTER: for (const simpleSub of sub.set) {
7070
+ for (const simpleDom of dom.set) {
7071
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
7072
+ sawNonNull = sawNonNull || isSub !== null;
7073
+ if (isSub) continue OUTER;
7074
+ }
7075
+ if (sawNonNull) return false;
5536
7076
  }
5537
- if (args.bundleId === "00000000-0000-0000-0000-000000000000") return null;
5538
- if (args.minBundleId && args.bundleId.localeCompare(args.minBundleId) <= 0) return null;
5539
- return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
7077
+ return true;
5540
7078
  };
5541
- const getBaseWhere = ({ platform, channel, minBundleId }) => ({
5542
- platform,
5543
- channel,
5544
- enabled: true,
5545
- id: { gte: minBundleId }
5546
- });
5547
- return {
5548
- api: {
5549
- async getBundleById(id, context) {
5550
- return getPlugin().getBundleById(id, context);
5551
- },
5552
- async getUpdateInfo(args, context) {
5553
- const directGetUpdateInfo = getPlugin().getUpdateInfo;
5554
- if (directGetUpdateInfo) return context === void 0 ? await directGetUpdateInfo(args) : await directGetUpdateInfo(args, context);
5555
- const channel = args.channel ?? "production";
5556
- const minBundleId = args.minBundleId ?? "00000000-0000-0000-0000-000000000000";
5557
- const baseWhere = getBaseWhere({
5558
- platform: args.platform,
5559
- channel,
5560
- minBundleId
5561
- });
5562
- if (args._updateStrategy === "fingerprint") return findUpdateInfoByScanning({
5563
- args,
5564
- queryWhere: {
5565
- ...baseWhere,
5566
- fingerprintHash: args.fingerprintHash
5567
- },
5568
- context,
5569
- isCandidate: (bundle) => {
5570
- return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && bundle.fingerprintHash === args.fingerprintHash;
5571
- }
5572
- });
5573
- return findUpdateInfoByScanning({
5574
- args,
5575
- queryWhere: { ...baseWhere },
5576
- context,
5577
- isCandidate: (bundle) => {
5578
- return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && !!bundle.targetAppVersion && semverSatisfies$1(bundle.targetAppVersion, args.appVersion);
5579
- }
5580
- });
5581
- },
5582
- async getAppUpdateInfo(args, context) {
5583
- const info = await this.getUpdateInfo(args, context);
5584
- if (!info) return null;
5585
- const { storageUri, ...rest } = info;
5586
- const fileUrl = await resolveFileUrl(storageUri ?? null, context);
5587
- return {
5588
- ...rest,
5589
- fileUrl
5590
- };
5591
- },
5592
- async getChannels(context) {
5593
- return getPlugin().getChannels(context);
5594
- },
5595
- async getBundles(options, context) {
5596
- return getPlugin().getBundles(options, context);
5597
- },
5598
- async insertBundle(bundle, context) {
5599
- await runWithMutationPlugin(async (plugin) => {
5600
- await plugin.appendBundle(bundle, context);
5601
- await plugin.commitBundle(context);
5602
- });
5603
- },
5604
- async updateBundleById(bundleId, newBundle, context) {
5605
- await runWithMutationPlugin(async (plugin) => {
5606
- await plugin.updateBundle(bundleId, newBundle, context);
5607
- await plugin.commitBundle(context);
5608
- });
5609
- },
5610
- async deleteBundleById(bundleId, context) {
5611
- await runWithMutationPlugin(async (plugin) => {
5612
- const bundle = await plugin.getBundleById(bundleId, context);
5613
- if (!bundle) return;
5614
- await plugin.deleteBundle(bundle, context);
5615
- await plugin.commitBundle(context);
5616
- });
7079
+ const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
7080
+ const minimumVersion = [new Comparator(">=0.0.0")];
7081
+ const simpleSubset = (sub, dom, options) => {
7082
+ if (sub === dom) return true;
7083
+ if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
7084
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
7085
+ else sub = minimumVersion;
7086
+ if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
7087
+ else dom = minimumVersion;
7088
+ const eqSet = /* @__PURE__ */ new Set();
7089
+ let gt, lt;
7090
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
7091
+ else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
7092
+ else eqSet.add(c.semver);
7093
+ if (eqSet.size > 1) return null;
7094
+ let gtltComp;
7095
+ if (gt && lt) {
7096
+ gtltComp = compare(gt.semver, lt.semver, options);
7097
+ if (gtltComp > 0) return null;
7098
+ else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
7099
+ }
7100
+ for (const eq of eqSet) {
7101
+ if (gt && !satisfies(eq, String(gt), options)) return null;
7102
+ if (lt && !satisfies(eq, String(lt), options)) return null;
7103
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
7104
+ return true;
7105
+ }
7106
+ let higher, lower;
7107
+ let hasDomLT, hasDomGT;
7108
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
7109
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
7110
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
7111
+ for (const c of dom) {
7112
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
7113
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
7114
+ if (gt) {
7115
+ if (needDomGTPre) {
7116
+ 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;
7117
+ }
7118
+ if (c.operator === ">" || c.operator === ">=") {
7119
+ higher = higherGT(gt, c, options);
7120
+ if (higher === c && higher !== gt) return false;
7121
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
5617
7122
  }
5618
- },
5619
- adapterName: getPlugin().name,
5620
- createMigrator: () => {
5621
- throw new Error("createMigrator is only available for Kysely/Prisma/Drizzle database adapters.");
5622
- },
5623
- generateSchema: () => {
5624
- throw new Error("generateSchema is only available for Kysely/Prisma/Drizzle database adapters.");
7123
+ if (lt) {
7124
+ if (needDomLTPre) {
7125
+ 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;
7126
+ }
7127
+ if (c.operator === "<" || c.operator === "<=") {
7128
+ lower = lowerLT(lt, c, options);
7129
+ if (lower === c && lower !== lt) return false;
7130
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
7131
+ }
7132
+ if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
5625
7133
  }
7134
+ if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
7135
+ if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
7136
+ if (needDomGTPre || needDomLTPre) return false;
7137
+ return true;
5626
7138
  };
5627
- }
7139
+ const higherGT = (a, b, options) => {
7140
+ if (!a) return b;
7141
+ const comp = compare(a.semver, b.semver, options);
7142
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
7143
+ };
7144
+ const lowerLT = (a, b, options) => {
7145
+ if (!a) return b;
7146
+ const comp = compare(a.semver, b.semver, options);
7147
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
7148
+ };
7149
+ module.exports = subset;
7150
+ }));
7151
+ (/* @__PURE__ */ __commonJSMin$1(((exports, module) => {
7152
+ const internalRe = require_re();
7153
+ const constants = require_constants();
7154
+ const SemVer = require_semver$1();
7155
+ const identifiers = require_identifiers();
7156
+ module.exports = {
7157
+ parse: require_parse(),
7158
+ valid: require_valid$1(),
7159
+ clean: require_clean(),
7160
+ inc: require_inc(),
7161
+ diff: require_diff(),
7162
+ major: require_major(),
7163
+ minor: require_minor(),
7164
+ patch: require_patch(),
7165
+ prerelease: require_prerelease(),
7166
+ compare: require_compare(),
7167
+ rcompare: require_rcompare(),
7168
+ compareLoose: require_compare_loose(),
7169
+ compareBuild: require_compare_build(),
7170
+ sort: require_sort(),
7171
+ rsort: require_rsort(),
7172
+ gt: require_gt(),
7173
+ lt: require_lt(),
7174
+ eq: require_eq(),
7175
+ neq: require_neq(),
7176
+ gte: require_gte(),
7177
+ lte: require_lte(),
7178
+ cmp: require_cmp(),
7179
+ coerce: require_coerce(),
7180
+ Comparator: require_comparator(),
7181
+ Range: require_range(),
7182
+ satisfies: require_satisfies(),
7183
+ toComparators: require_to_comparators(),
7184
+ maxSatisfying: require_max_satisfying(),
7185
+ minSatisfying: require_min_satisfying(),
7186
+ minVersion: require_min_version(),
7187
+ validRange: require_valid(),
7188
+ outside: require_outside(),
7189
+ gtr: require_gtr(),
7190
+ ltr: require_ltr(),
7191
+ intersects: require_intersects(),
7192
+ simplifyRange: require_simplify(),
7193
+ subset: require_subset(),
7194
+ SemVer,
7195
+ re: internalRe.re,
7196
+ src: internalRe.src,
7197
+ tokens: internalRe.t,
7198
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
7199
+ RELEASE_TYPES: constants.RELEASE_TYPES,
7200
+ compareIdentifiers: identifiers.compareIdentifiers,
7201
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
7202
+ };
7203
+ })))();
7204
+ var sqlProviders = [
7205
+ "sqlite",
7206
+ "cockroachdb",
7207
+ "mysql",
7208
+ "postgresql",
7209
+ "mssql"
7210
+ ];
7211
+ var noSqlProviders = ["mongodb"];
7212
+ [...sqlProviders, ...noSqlProviders];
5628
7213
  //#endregion
5629
7214
  //#region ../../packages/server/src/db/types.ts
5630
7215
  function isDatabasePluginFactory(adapter) {
@@ -5686,7 +7271,7 @@ function findRoute(router, method, path) {
5686
7271
  }
5687
7272
  //#endregion
5688
7273
  //#region ../../packages/server/src/version.ts
5689
- const HOT_UPDATER_SERVER_VERSION = "0.30.12";
7274
+ const HOT_UPDATER_SERVER_VERSION = "0.31.0";
5690
7275
  //#endregion
5691
7276
  //#region ../../packages/server/src/handler.ts
5692
7277
  var HandlerBadRequestError = class extends Error {
@@ -5695,6 +7280,19 @@ var HandlerBadRequestError = class extends Error {
5695
7280
  this.name = "HandlerBadRequestError";
5696
7281
  }
5697
7282
  };
7283
+ const SDK_VERSION_HEADER = "Hot-Updater-SDK-Version";
7284
+ const EXPLICIT_NO_UPDATE_MIN_SDK_VERSION = "0.31.0";
7285
+ const supportsExplicitNoUpdateResponse = (request) => {
7286
+ const sdkVersion = request.headers.get(SDK_VERSION_HEADER)?.trim();
7287
+ if (!sdkVersion) return false;
7288
+ const normalizedSdkVersion = import_semver$2.default.valid(sdkVersion);
7289
+ return normalizedSdkVersion !== null && import_semver$2.default.gte(normalizedSdkVersion, EXPLICIT_NO_UPDATE_MIN_SDK_VERSION);
7290
+ };
7291
+ const serializeUpdateInfo = (updateInfo, request) => {
7292
+ if (updateInfo) return JSON.stringify(updateInfo);
7293
+ if (supportsExplicitNoUpdateResponse(request)) return JSON.stringify({ status: "UP_TO_DATE" });
7294
+ return JSON.stringify(null);
7295
+ };
5698
7296
  const handleVersion = async () => {
5699
7297
  return new Response(JSON.stringify({ version: HOT_UPDATER_SERVER_VERSION }), {
5700
7298
  status: 200,
@@ -5717,6 +7315,22 @@ const requireRouteParam = (params, key) => {
5717
7315
  if (!value) throw new HandlerBadRequestError(`Missing route parameter: ${key}`);
5718
7316
  return value;
5719
7317
  };
7318
+ const parseBooleanSearchParam = (url, key) => {
7319
+ const value = url.searchParams.get(key);
7320
+ if (value === null) return;
7321
+ if (value === "true") return true;
7322
+ if (value === "false") return false;
7323
+ throw new HandlerBadRequestError(`The '${key}' query parameter must be 'true' or 'false'.`);
7324
+ };
7325
+ const parseNullableStringSearchParam = (url, key) => {
7326
+ const value = url.searchParams.get(key);
7327
+ if (value === null) return;
7328
+ return value === "null" ? null : value;
7329
+ };
7330
+ const parseStringArraySearchParam = (url, key) => {
7331
+ const values = url.searchParams.getAll(key);
7332
+ return values.length > 0 ? values : void 0;
7333
+ };
5720
7334
  const requirePlatformParam = (params) => {
5721
7335
  const platform = requireRouteParam(params, "platform");
5722
7336
  if (!isPlatform(platform)) throw new HandlerBadRequestError(`Invalid platform: ${platform}. Expected 'ios' or 'android'.`);
@@ -5729,7 +7343,7 @@ const requireBundlePatchPayload = (payload, bundleId) => {
5729
7343
  const { id: _ignoredId, ...rest } = bundlePatch;
5730
7344
  return rest;
5731
7345
  };
5732
- const handleFingerprintUpdateWithCohort = async (params, _request, api, context) => {
7346
+ const handleFingerprintUpdateWithCohort = async (params, request, api, context) => {
5733
7347
  const platform = requirePlatformParam(params);
5734
7348
  const fingerprintHash = requireRouteParam(params, "fingerprintHash");
5735
7349
  const channel = requireRouteParam(params, "channel");
@@ -5744,12 +7358,12 @@ const handleFingerprintUpdateWithCohort = async (params, _request, api, context)
5744
7358
  bundleId,
5745
7359
  cohort: decodeMaybe(params.cohort)
5746
7360
  }, context);
5747
- return new Response(JSON.stringify(updateInfo), {
7361
+ return new Response(serializeUpdateInfo(updateInfo, request), {
5748
7362
  status: 200,
5749
7363
  headers: { "Content-Type": "application/json" }
5750
7364
  });
5751
7365
  };
5752
- const handleAppVersionUpdateWithCohort = async (params, _request, api, context) => {
7366
+ const handleAppVersionUpdateWithCohort = async (params, request, api, context) => {
5753
7367
  const platform = requirePlatformParam(params);
5754
7368
  const appVersion = requireRouteParam(params, "appVersion");
5755
7369
  const channel = requireRouteParam(params, "channel");
@@ -5764,7 +7378,7 @@ const handleAppVersionUpdateWithCohort = async (params, _request, api, context)
5764
7378
  bundleId,
5765
7379
  cohort: decodeMaybe(params.cohort)
5766
7380
  }, context);
5767
- return new Response(JSON.stringify(updateInfo), {
7381
+ return new Response(serializeUpdateInfo(updateInfo, request), {
5768
7382
  status: 200,
5769
7383
  headers: { "Content-Type": "application/json" }
5770
7384
  });
@@ -5790,6 +7404,17 @@ const handleGetBundles = async (_params, request, api, context) => {
5790
7404
  const offset = url.searchParams.get("offset");
5791
7405
  const after = url.searchParams.get("after") ?? void 0;
5792
7406
  const before = url.searchParams.get("before") ?? void 0;
7407
+ const enabled = parseBooleanSearchParam(url, "enabled");
7408
+ const targetAppVersion = parseNullableStringSearchParam(url, "targetAppVersion");
7409
+ const targetAppVersionIn = parseStringArraySearchParam(url, "targetAppVersionIn");
7410
+ const targetAppVersionNotNull = parseBooleanSearchParam(url, "targetAppVersionNotNull");
7411
+ const fingerprintHash = parseNullableStringSearchParam(url, "fingerprintHash");
7412
+ const idEq = url.searchParams.get("idEq") ?? void 0;
7413
+ const idGt = url.searchParams.get("idGt") ?? void 0;
7414
+ const idGte = url.searchParams.get("idGte") ?? void 0;
7415
+ const idLt = url.searchParams.get("idLt") ?? void 0;
7416
+ const idLte = url.searchParams.get("idLte") ?? void 0;
7417
+ const idIn = parseStringArraySearchParam(url, "idIn");
5793
7418
  const page = pageParam === null ? void 0 : Number.isInteger(Number(pageParam)) && Number(pageParam) > 0 ? Number(pageParam) : null;
5794
7419
  if (offset !== null) throw new HandlerBadRequestError("The 'offset' query parameter has been removed. Use 'after' or 'before' cursor pagination instead.");
5795
7420
  if (page === null) throw new HandlerBadRequestError("The 'page' query parameter must be a positive integer.");
@@ -5797,7 +7422,20 @@ const handleGetBundles = async (_params, request, api, context) => {
5797
7422
  const result = await api.getBundles({
5798
7423
  where: {
5799
7424
  ...channel && { channel },
5800
- ...platform && { platform }
7425
+ ...platform && { platform },
7426
+ ...enabled !== void 0 && { enabled },
7427
+ ...idEq || idGt || idGte || idLt || idLte || idIn && idIn.length > 0 ? { id: {
7428
+ ...idEq && { eq: idEq },
7429
+ ...idGt && { gt: idGt },
7430
+ ...idGte && { gte: idGte },
7431
+ ...idLt && { lt: idLt },
7432
+ ...idLte && { lte: idLte },
7433
+ ...idIn && idIn.length > 0 && { in: idIn }
7434
+ } } : {},
7435
+ ...targetAppVersion !== void 0 && { targetAppVersion },
7436
+ ...targetAppVersionIn && { targetAppVersionIn },
7437
+ ...targetAppVersionNotNull !== void 0 && { targetAppVersionNotNull },
7438
+ ...fingerprintHash !== void 0 && { fingerprintHash }
5801
7439
  },
5802
7440
  limit,
5803
7441
  page,
@@ -5920,24 +7558,64 @@ const normalizeBasePath = (basePath) => {
5920
7558
  return basePath.endsWith("/") ? basePath.slice(0, -1) : basePath;
5921
7559
  };
5922
7560
  //#endregion
7561
+ //#region ../../packages/server/src/storageAccess.ts
7562
+ const assertRemoteDownloadUrl = (fileUrl) => {
7563
+ try {
7564
+ const protocol = new URL(fileUrl).protocol.replace(":", "");
7565
+ if (protocol === "http" || protocol === "https") return fileUrl;
7566
+ } catch {}
7567
+ throw new Error("Storage plugin returned a local file path; runtime update checks require an HTTP(S) download URL.");
7568
+ };
7569
+ const getStorageProtocol = (storageUri) => new URL(storageUri).protocol.replace(":", "");
7570
+ const isRemoteUrlProtocol = (protocol) => protocol === "http" || protocol === "https";
7571
+ const createStorageAccess = (storagePlugins) => {
7572
+ const findStoragePlugin = (protocol) => {
7573
+ return storagePlugins.find((item) => item.supportedProtocol === protocol);
7574
+ };
7575
+ const resolveFileUrl = async (storageUri, context) => {
7576
+ if (!storageUri) return null;
7577
+ const protocol = getStorageProtocol(storageUri);
7578
+ const plugin = findStoragePlugin(protocol);
7579
+ if (plugin) {
7580
+ const { fileUrl } = await plugin.profiles.runtime.getDownloadUrl(storageUri, context);
7581
+ if (!fileUrl) throw new Error("Storage plugin returned empty fileUrl");
7582
+ return assertRemoteDownloadUrl(fileUrl);
7583
+ }
7584
+ if (isRemoteUrlProtocol(protocol)) return storageUri;
7585
+ throw new Error(`No storage plugin for protocol: ${protocol}`);
7586
+ };
7587
+ const readStorageText = async (storageUri, context) => {
7588
+ const protocol = getStorageProtocol(storageUri);
7589
+ const plugin = findStoragePlugin(protocol);
7590
+ if (plugin) return plugin.profiles.runtime.readText(storageUri, context);
7591
+ if (isRemoteUrlProtocol(protocol)) {
7592
+ const response = await fetch(storageUri);
7593
+ if (!response.ok) return null;
7594
+ return response.text();
7595
+ }
7596
+ throw new Error(`No storage plugin for protocol: ${protocol}`);
7597
+ };
7598
+ return {
7599
+ readStorageText,
7600
+ resolveFileUrl
7601
+ };
7602
+ };
7603
+ //#endregion
5923
7604
  //#region ../../packages/server/src/runtime.ts
5924
7605
  function createHotUpdater(options) {
5925
7606
  const database = options.database;
5926
7607
  const basePath = normalizeBasePath(options.basePath ?? "/api");
5927
- const storagePlugins = (options.storages ?? options.storagePlugins ?? []).map((plugin) => typeof plugin === "function" ? plugin() : plugin);
5928
- const resolveStoragePluginUrl = async (storageUri, context) => {
5929
- if (!storageUri) return null;
5930
- const protocol = new URL(storageUri).protocol.replace(":", "");
5931
- if (protocol === "http" || protocol === "https") return storageUri;
5932
- const plugin = storagePlugins.find((item) => item.supportedProtocol === protocol);
5933
- if (!plugin) throw new Error(`No storage plugin for protocol: ${protocol}`);
5934
- const { fileUrl } = await plugin.getDownloadUrl(storageUri, context);
5935
- if (!fileUrl) throw new Error("Storage plugin returned empty fileUrl");
5936
- return fileUrl;
5937
- };
7608
+ const { readStorageText, resolveFileUrl } = createStorageAccess((options.storages ?? options.storagePlugins ?? []).map((plugin) => {
7609
+ const storagePlugin = typeof plugin === "function" ? plugin() : plugin;
7610
+ assertRuntimeStoragePlugin(storagePlugin);
7611
+ return storagePlugin;
7612
+ }));
5938
7613
  if (!isDatabasePluginFactory(database) && !isDatabasePlugin(database)) throw new Error("@hot-updater/server/runtime only supports database plugins.");
5939
7614
  const plugin = isDatabasePluginFactory(database) ? database() : database;
5940
- const core = createPluginDatabaseCore(() => plugin, resolveStoragePluginUrl, isDatabasePluginFactory(database) ? { createMutationPlugin: () => database() } : void 0);
7615
+ const core = createPluginDatabaseCore(() => plugin, resolveFileUrl, isDatabasePluginFactory(database) ? {
7616
+ createMutationPlugin: () => database(),
7617
+ readStorageText
7618
+ } : { readStorageText });
5941
7619
  const api = {
5942
7620
  ...core.api,
5943
7621
  handler: createHandler(core.api, {
@@ -7968,7 +9646,7 @@ const s3Database = createBlobDatabasePlugin({
7968
9646
  });
7969
9647
  //#endregion
7970
9648
  //#region src/s3Storage.ts
7971
- const s3Storage = createStoragePlugin({
9649
+ const s3Storage = createUniversalStoragePlugin({
7972
9650
  name: "s3Storage",
7973
9651
  supportedProtocol: "s3",
7974
9652
  factory: (config) => {
@@ -7976,59 +9654,89 @@ const s3Storage = createStoragePlugin({
7976
9654
  const client = new _aws_sdk_client_s3.S3Client(applyS3RuntimeAwsConfig(s3Config));
7977
9655
  const getStorageKey = createStorageKeyBuilder(config.basePath);
7978
9656
  return {
7979
- async delete(storageUri) {
7980
- const { bucket, key } = parseStorageUri(storageUri, "s3");
7981
- if (bucket !== bucketName) throw new Error(`Bucket name mismatch: expected "${bucketName}", but found "${bucket}".`);
7982
- const listCommand = new _aws_sdk_client_s3.ListObjectsV2Command({
7983
- Bucket: bucketName,
7984
- Prefix: key
7985
- });
7986
- const listResponse = await client.send(listCommand);
7987
- if (listResponse.Contents && listResponse.Contents.length > 0) {
7988
- const deleteCommand = new _aws_sdk_client_s3.DeleteObjectsCommand({
9657
+ node: {
9658
+ async delete(storageUri) {
9659
+ const { bucket, key } = parseStorageUri(storageUri, "s3");
9660
+ if (bucket !== bucketName) throw new Error(`Bucket name mismatch: expected "${bucketName}", but found "${bucket}".`);
9661
+ const listCommand = new _aws_sdk_client_s3.ListObjectsV2Command({
7989
9662
  Bucket: bucketName,
7990
- Delete: {
7991
- Objects: listResponse.Contents.map((obj) => ({ Key: obj.Key })),
7992
- Quiet: true
7993
- }
9663
+ Prefix: key
7994
9664
  });
7995
- await client.send(deleteCommand);
7996
- return;
7997
- }
7998
- throw new Error("Bundle Not Found");
7999
- },
8000
- async upload(key, filePath) {
8001
- const Body = await fs_promises.default.readFile(filePath);
8002
- const ContentType = getContentType(filePath);
8003
- const Key = getStorageKey(key, path.default.basename(filePath));
8004
- const response = await new _aws_sdk_lib_storage.Upload({
8005
- client,
8006
- params: {
8007
- ContentType,
8008
- Bucket: bucketName,
8009
- Key,
8010
- Body,
8011
- CacheControl: "max-age=31536000"
9665
+ const listResponse = await client.send(listCommand);
9666
+ if (listResponse.Contents && listResponse.Contents.length > 0) {
9667
+ const deleteCommand = new _aws_sdk_client_s3.DeleteObjectsCommand({
9668
+ Bucket: bucketName,
9669
+ Delete: {
9670
+ Objects: listResponse.Contents.map((obj) => ({ Key: obj.Key })),
9671
+ Quiet: true
9672
+ }
9673
+ });
9674
+ await client.send(deleteCommand);
9675
+ return;
8012
9676
  }
8013
- }).done();
8014
- if (!response.Bucket || !response.Key) throw new Error("Upload Failed");
8015
- return { storageUri: `s3://${bucketName}/${Key}` };
8016
- },
8017
- async getDownloadUrl(storageUri) {
8018
- const u = new URL(storageUri);
8019
- if (u.protocol.replace(":", "") !== "s3") throw new Error("Invalid S3 storage URI protocol");
8020
- const bucket = u.host;
8021
- const key = u.pathname.slice(1);
8022
- if (!bucket || !key) throw new Error("Invalid S3 storage URI: missing bucket or key");
8023
- try {
8024
- const signedUrl = await (0, _aws_sdk_s3_request_presigner.getSignedUrl)(client, new _aws_sdk_client_s3.GetObjectCommand({
9677
+ throw new Error("Bundle Not Found");
9678
+ },
9679
+ async upload(key, filePath) {
9680
+ const Body = await fs_promises.default.readFile(filePath);
9681
+ const ContentType = getContentType(filePath);
9682
+ const Key = getStorageKey(key, path.default.basename(filePath));
9683
+ const response = await new _aws_sdk_lib_storage.Upload({
9684
+ client,
9685
+ params: {
9686
+ ContentType,
9687
+ Bucket: bucketName,
9688
+ Key,
9689
+ Body,
9690
+ CacheControl: "max-age=31536000"
9691
+ }
9692
+ }).done();
9693
+ if (!response.Bucket || !response.Key) throw new Error("Upload Failed");
9694
+ return { storageUri: `s3://${bucketName}/${Key}` };
9695
+ },
9696
+ async downloadFile(storageUri, filePath) {
9697
+ const { bucket, key } = parseStorageUri(storageUri, "s3");
9698
+ if (bucket !== bucketName) throw new Error(`Bucket name mismatch: expected "${bucketName}", but found "${bucket}".`);
9699
+ const response = await client.send(new _aws_sdk_client_s3.GetObjectCommand({
8025
9700
  Bucket: bucket,
8026
9701
  Key: key
8027
- }), { expiresIn: 3600 });
8028
- if (!signedUrl) throw new Error("Failed to presign S3 URL");
8029
- return { fileUrl: signedUrl };
8030
- } catch (e) {
8031
- throw new Error(e instanceof Error ? `Failed to presign S3 URL: ${e.message}` : "Failed to presign S3 URL");
9702
+ }));
9703
+ if (!response.Body) throw new Error("S3 object body is empty");
9704
+ await fs_promises.default.mkdir(path.default.dirname(filePath), { recursive: true });
9705
+ await fs_promises.default.writeFile(filePath, await response.Body.transformToByteArray());
9706
+ }
9707
+ },
9708
+ runtime: {
9709
+ async readText(storageUri) {
9710
+ const { bucket, key } = parseStorageUri(storageUri, "s3");
9711
+ if (bucket !== bucketName) throw new Error(`Bucket name mismatch: expected "${bucketName}", but found "${bucket}".`);
9712
+ try {
9713
+ const response = await client.send(new _aws_sdk_client_s3.GetObjectCommand({
9714
+ Bucket: bucket,
9715
+ Key: key
9716
+ }));
9717
+ if (!response.Body) return null;
9718
+ return response.Body.transformToString();
9719
+ } catch (error) {
9720
+ if (error instanceof Error && error.name === "NoSuchKey") return null;
9721
+ throw error;
9722
+ }
9723
+ },
9724
+ async getDownloadUrl(storageUri) {
9725
+ const u = new URL(storageUri);
9726
+ if (u.protocol.replace(":", "") !== "s3") throw new Error("Invalid S3 storage URI protocol");
9727
+ const bucket = u.host;
9728
+ const key = u.pathname.slice(1);
9729
+ if (!bucket || !key) throw new Error("Invalid S3 storage URI: missing bucket or key");
9730
+ try {
9731
+ const signedUrl = await (0, _aws_sdk_s3_request_presigner.getSignedUrl)(client, new _aws_sdk_client_s3.GetObjectCommand({
9732
+ Bucket: bucket,
9733
+ Key: key
9734
+ }), { expiresIn: 3600 });
9735
+ if (!signedUrl) throw new Error("Failed to presign S3 URL");
9736
+ return { fileUrl: signedUrl };
9737
+ } catch (e) {
9738
+ throw new Error(e instanceof Error ? `Failed to presign S3 URL: ${e.message}` : "Failed to presign S3 URL");
9739
+ }
8032
9740
  }
8033
9741
  }
8034
9742
  };
@@ -8080,19 +9788,25 @@ const withCloudFrontSignedUrl = (storageFactory, config) => {
8080
9788
  return {
8081
9789
  ...baseStorage,
8082
9790
  name: `${baseStorage.name}WithCloudFrontSignedUrl`,
8083
- async getDownloadUrl(storageUri, context) {
8084
- const storageUrl = new URL(storageUri);
8085
- if (storageUrl.protocol !== "s3:") return baseStorage.getDownloadUrl(storageUri, context);
8086
- const [privateKey, publicBaseUrl] = await Promise.all([resolvePrivateKey(config), resolvePublicBaseUrl(config, context)]);
8087
- const url = new URL(publicBaseUrl);
8088
- url.pathname = storageUrl.pathname;
8089
- url.search = "";
8090
- return { fileUrl: (0, _aws_sdk_cloudfront_signer.getSignedUrl)({
8091
- url: url.toString(),
8092
- keyPairId: config.keyPairId,
8093
- privateKey,
8094
- dateLessThan: new Date(Date.now() + (config.expiresSeconds ?? ONE_YEAR_IN_SECONDS$1) * 1e3).toISOString()
8095
- }) };
9791
+ profiles: {
9792
+ ...baseStorage.profiles,
9793
+ runtime: {
9794
+ ...baseStorage.profiles.runtime,
9795
+ async getDownloadUrl(storageUri, context) {
9796
+ const storageUrl = new URL(storageUri);
9797
+ if (storageUrl.protocol !== "s3:") return baseStorage.profiles.runtime.getDownloadUrl(storageUri, context);
9798
+ const [privateKey, publicBaseUrl] = await Promise.all([resolvePrivateKey(config), resolvePublicBaseUrl(config, context)]);
9799
+ const url = new URL(publicBaseUrl);
9800
+ url.pathname = storageUrl.pathname;
9801
+ url.search = "";
9802
+ return { fileUrl: (0, _aws_sdk_cloudfront_signer.getSignedUrl)({
9803
+ url: url.toString(),
9804
+ keyPairId: config.keyPairId,
9805
+ privateKey,
9806
+ dateLessThan: new Date(Date.now() + (config.expiresSeconds ?? ONE_YEAR_IN_SECONDS$1) * 1e3).toISOString()
9807
+ }) };
9808
+ }
9809
+ }
8096
9810
  }
8097
9811
  };
8098
9812
  };