@zoralabs/protocol-sdk 0.7.3 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.turbo/turbo-build.log +18 -16
  2. package/CHANGELOG.md +17 -0
  3. package/LICENSE +21 -0
  4. package/dist/anvil.d.ts +2 -2
  5. package/dist/anvil.d.ts.map +1 -1
  6. package/dist/apis/http-api-base.d.ts.map +1 -1
  7. package/dist/index.cjs +2272 -361
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +2 -3
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2297 -362
  12. package/dist/index.js.map +1 -1
  13. package/dist/ipfs/token-metadata.d.ts.map +1 -1
  14. package/dist/mint/mint-client.d.ts +1 -1
  15. package/dist/mint/mint-queries.d.ts +1 -1
  16. package/dist/mint/types.d.ts.map +1 -1
  17. package/dist/premint/conversions.d.ts +5 -5
  18. package/dist/premint/conversions.d.ts.map +1 -1
  19. package/dist/premint/premint-api-client.d.ts +1 -1
  20. package/dist/premint/premint-api-client.d.ts.map +1 -1
  21. package/dist/premint/premint-client.d.ts +4 -4
  22. package/dist/premint/premint-client.d.ts.map +1 -1
  23. package/dist/premint/preminter.d.ts +3 -3
  24. package/dist/premint/preminter.d.ts.map +1 -1
  25. package/dist/preminter.d.ts +2 -2
  26. package/dist/preminter.d.ts.map +1 -1
  27. package/dist/sparks/mints-queries.d.ts.map +1 -0
  28. package/dist/{mints/mints-contracts.d.ts → sparks/sparks-contracts.d.ts} +4 -3
  29. package/dist/sparks/sparks-contracts.d.ts.map +1 -0
  30. package/dist/test-utils.d.ts.map +1 -1
  31. package/package.json +17 -16
  32. package/src/index.ts +2 -4
  33. package/src/premint/preminter.test.ts +1 -1
  34. package/src/{mints/mints-contracts.test.ts → sparks/sparks-contracts-test.ts} +64 -57
  35. package/src/{mints/mints-contracts.ts → sparks/sparks-contracts.ts} +7 -3
  36. package/src/sparks/sparks-sponsored-sparks-spender.test.ts +183 -0
  37. package/tsconfig.build.json +2 -2
  38. package/tsconfig.json +1 -1
  39. package/dist/mints/mints-contracts.d.ts.map +0 -1
  40. package/dist/mints/mints-eth-unwrapper-and-caller.d.ts +0 -55
  41. package/dist/mints/mints-eth-unwrapper-and-caller.d.ts.map +0 -1
  42. package/dist/mints/mints-queries.d.ts.map +0 -1
  43. package/dist/mints/mints-relay-example.d.ts +0 -60
  44. package/dist/mints/mints-relay-example.d.ts.map +0 -1
  45. package/src/mints/mints-eth-unwrapper-and-caller.test.ts +0 -467
  46. package/src/mints/mints-eth-unwrapper-and-caller.ts +0 -83
  47. package/src/mints/mints-relay-example.ts +0 -322
  48. /package/dist/{mints → sparks}/mints-queries.d.ts +0 -0
  49. /package/src/{mints → sparks}/mints-queries.test.ts +0 -0
  50. /package/src/{mints → sparks}/mints-queries.ts +0 -0
package/dist/index.js CHANGED
@@ -1,3 +1,1922 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __copyProps = (to, from2, except, desc) => {
12
+ if (from2 && typeof from2 === "object" || typeof from2 === "function") {
13
+ for (let key of __getOwnPropNames(from2))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __publicField = (obj, key, value) => {
28
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
29
+ return value;
30
+ };
31
+
32
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js
33
+ var require_constants = __commonJS({
34
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js"(exports, module) {
35
+ "use strict";
36
+ var SEMVER_SPEC_VERSION = "2.0.0";
37
+ var MAX_LENGTH = 256;
38
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
39
+ 9007199254740991;
40
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
41
+ var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
42
+ var RELEASE_TYPES = [
43
+ "major",
44
+ "premajor",
45
+ "minor",
46
+ "preminor",
47
+ "patch",
48
+ "prepatch",
49
+ "prerelease"
50
+ ];
51
+ module.exports = {
52
+ MAX_LENGTH,
53
+ MAX_SAFE_COMPONENT_LENGTH,
54
+ MAX_SAFE_BUILD_LENGTH,
55
+ MAX_SAFE_INTEGER,
56
+ RELEASE_TYPES,
57
+ SEMVER_SPEC_VERSION,
58
+ FLAG_INCLUDE_PRERELEASE: 1,
59
+ FLAG_LOOSE: 2
60
+ };
61
+ }
62
+ });
63
+
64
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js
65
+ var require_debug = __commonJS({
66
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js"(exports, module) {
67
+ "use strict";
68
+ var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
69
+ };
70
+ module.exports = debug;
71
+ }
72
+ });
73
+
74
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js
75
+ var require_re = __commonJS({
76
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js"(exports, module) {
77
+ "use strict";
78
+ var {
79
+ MAX_SAFE_COMPONENT_LENGTH,
80
+ MAX_SAFE_BUILD_LENGTH,
81
+ MAX_LENGTH
82
+ } = require_constants();
83
+ var debug = require_debug();
84
+ exports = module.exports = {};
85
+ var re = exports.re = [];
86
+ var safeRe = exports.safeRe = [];
87
+ var src2 = exports.src = [];
88
+ var t = exports.t = {};
89
+ var R = 0;
90
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
91
+ var safeRegexReplacements = [
92
+ ["\\s", 1],
93
+ ["\\d", MAX_LENGTH],
94
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
95
+ ];
96
+ var makeSafeRegex = (value) => {
97
+ for (const [token, max] of safeRegexReplacements) {
98
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
99
+ }
100
+ return value;
101
+ };
102
+ var createToken = (name, value, isGlobal) => {
103
+ const safe = makeSafeRegex(value);
104
+ const index = R++;
105
+ debug(name, index, value);
106
+ t[name] = index;
107
+ src2[index] = value;
108
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
109
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
110
+ };
111
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
112
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
113
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
114
+ createToken("MAINVERSION", `(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})`);
115
+ createToken("MAINVERSIONLOOSE", `(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})`);
116
+ createToken("PRERELEASEIDENTIFIER", `(?:${src2[t.NUMERICIDENTIFIER]}|${src2[t.NONNUMERICIDENTIFIER]})`);
117
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src2[t.NUMERICIDENTIFIERLOOSE]}|${src2[t.NONNUMERICIDENTIFIER]})`);
118
+ createToken("PRERELEASE", `(?:-(${src2[t.PRERELEASEIDENTIFIER]}(?:\\.${src2[t.PRERELEASEIDENTIFIER]})*))`);
119
+ createToken("PRERELEASELOOSE", `(?:-?(${src2[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src2[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
120
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
121
+ createToken("BUILD", `(?:\\+(${src2[t.BUILDIDENTIFIER]}(?:\\.${src2[t.BUILDIDENTIFIER]})*))`);
122
+ createToken("FULLPLAIN", `v?${src2[t.MAINVERSION]}${src2[t.PRERELEASE]}?${src2[t.BUILD]}?`);
123
+ createToken("FULL", `^${src2[t.FULLPLAIN]}$`);
124
+ createToken("LOOSEPLAIN", `[v=\\s]*${src2[t.MAINVERSIONLOOSE]}${src2[t.PRERELEASELOOSE]}?${src2[t.BUILD]}?`);
125
+ createToken("LOOSE", `^${src2[t.LOOSEPLAIN]}$`);
126
+ createToken("GTLT", "((?:<|>)?=?)");
127
+ createToken("XRANGEIDENTIFIERLOOSE", `${src2[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
128
+ createToken("XRANGEIDENTIFIER", `${src2[t.NUMERICIDENTIFIER]}|x|X|\\*`);
129
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:${src2[t.PRERELEASE]})?${src2[t.BUILD]}?)?)?`);
130
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:${src2[t.PRERELEASELOOSE]})?${src2[t.BUILD]}?)?)?`);
131
+ createToken("XRANGE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAIN]}$`);
132
+ createToken("XRANGELOOSE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAINLOOSE]}$`);
133
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
134
+ createToken("COERCE", `${src2[t.COERCEPLAIN]}(?:$|[^\\d])`);
135
+ createToken("COERCEFULL", src2[t.COERCEPLAIN] + `(?:${src2[t.PRERELEASE]})?(?:${src2[t.BUILD]})?(?:$|[^\\d])`);
136
+ createToken("COERCERTL", src2[t.COERCE], true);
137
+ createToken("COERCERTLFULL", src2[t.COERCEFULL], true);
138
+ createToken("LONETILDE", "(?:~>?)");
139
+ createToken("TILDETRIM", `(\\s*)${src2[t.LONETILDE]}\\s+`, true);
140
+ exports.tildeTrimReplace = "$1~";
141
+ createToken("TILDE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAIN]}$`);
142
+ createToken("TILDELOOSE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAINLOOSE]}$`);
143
+ createToken("LONECARET", "(?:\\^)");
144
+ createToken("CARETTRIM", `(\\s*)${src2[t.LONECARET]}\\s+`, true);
145
+ exports.caretTrimReplace = "$1^";
146
+ createToken("CARET", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAIN]}$`);
147
+ createToken("CARETLOOSE", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAINLOOSE]}$`);
148
+ createToken("COMPARATORLOOSE", `^${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]})$|^$`);
149
+ createToken("COMPARATOR", `^${src2[t.GTLT]}\\s*(${src2[t.FULLPLAIN]})$|^$`);
150
+ createToken("COMPARATORTRIM", `(\\s*)${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]}|${src2[t.XRANGEPLAIN]})`, true);
151
+ exports.comparatorTrimReplace = "$1$2$3";
152
+ createToken("HYPHENRANGE", `^\\s*(${src2[t.XRANGEPLAIN]})\\s+-\\s+(${src2[t.XRANGEPLAIN]})\\s*$`);
153
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src2[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src2[t.XRANGEPLAINLOOSE]})\\s*$`);
154
+ createToken("STAR", "(<|>)?=?\\s*\\*");
155
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
156
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
157
+ }
158
+ });
159
+
160
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js
161
+ var require_parse_options = __commonJS({
162
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js"(exports, module) {
163
+ "use strict";
164
+ var looseOption = Object.freeze({ loose: true });
165
+ var emptyOpts = Object.freeze({});
166
+ var parseOptions = (options) => {
167
+ if (!options) {
168
+ return emptyOpts;
169
+ }
170
+ if (typeof options !== "object") {
171
+ return looseOption;
172
+ }
173
+ return options;
174
+ };
175
+ module.exports = parseOptions;
176
+ }
177
+ });
178
+
179
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/identifiers.js
180
+ var require_identifiers = __commonJS({
181
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/identifiers.js"(exports, module) {
182
+ "use strict";
183
+ var numeric = /^[0-9]+$/;
184
+ var compareIdentifiers = (a, b) => {
185
+ const anum = numeric.test(a);
186
+ const bnum = numeric.test(b);
187
+ if (anum && bnum) {
188
+ a = +a;
189
+ b = +b;
190
+ }
191
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
192
+ };
193
+ var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
194
+ module.exports = {
195
+ compareIdentifiers,
196
+ rcompareIdentifiers
197
+ };
198
+ }
199
+ });
200
+
201
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js
202
+ var require_semver = __commonJS({
203
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js"(exports, module) {
204
+ "use strict";
205
+ var debug = require_debug();
206
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
207
+ var { safeRe: re, t } = require_re();
208
+ var parseOptions = require_parse_options();
209
+ var { compareIdentifiers } = require_identifiers();
210
+ var SemVer = class _SemVer {
211
+ constructor(version, options) {
212
+ options = parseOptions(options);
213
+ if (version instanceof _SemVer) {
214
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
215
+ return version;
216
+ } else {
217
+ version = version.version;
218
+ }
219
+ } else if (typeof version !== "string") {
220
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
221
+ }
222
+ if (version.length > MAX_LENGTH) {
223
+ throw new TypeError(
224
+ `version is longer than ${MAX_LENGTH} characters`
225
+ );
226
+ }
227
+ debug("SemVer", version, options);
228
+ this.options = options;
229
+ this.loose = !!options.loose;
230
+ this.includePrerelease = !!options.includePrerelease;
231
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
232
+ if (!m) {
233
+ throw new TypeError(`Invalid Version: ${version}`);
234
+ }
235
+ this.raw = version;
236
+ this.major = +m[1];
237
+ this.minor = +m[2];
238
+ this.patch = +m[3];
239
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
240
+ throw new TypeError("Invalid major version");
241
+ }
242
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
243
+ throw new TypeError("Invalid minor version");
244
+ }
245
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
246
+ throw new TypeError("Invalid patch version");
247
+ }
248
+ if (!m[4]) {
249
+ this.prerelease = [];
250
+ } else {
251
+ this.prerelease = m[4].split(".").map((id) => {
252
+ if (/^[0-9]+$/.test(id)) {
253
+ const num = +id;
254
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
255
+ return num;
256
+ }
257
+ }
258
+ return id;
259
+ });
260
+ }
261
+ this.build = m[5] ? m[5].split(".") : [];
262
+ this.format();
263
+ }
264
+ format() {
265
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
266
+ if (this.prerelease.length) {
267
+ this.version += `-${this.prerelease.join(".")}`;
268
+ }
269
+ return this.version;
270
+ }
271
+ toString() {
272
+ return this.version;
273
+ }
274
+ compare(other) {
275
+ debug("SemVer.compare", this.version, this.options, other);
276
+ if (!(other instanceof _SemVer)) {
277
+ if (typeof other === "string" && other === this.version) {
278
+ return 0;
279
+ }
280
+ other = new _SemVer(other, this.options);
281
+ }
282
+ if (other.version === this.version) {
283
+ return 0;
284
+ }
285
+ return this.compareMain(other) || this.comparePre(other);
286
+ }
287
+ compareMain(other) {
288
+ if (!(other instanceof _SemVer)) {
289
+ other = new _SemVer(other, this.options);
290
+ }
291
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
292
+ }
293
+ comparePre(other) {
294
+ if (!(other instanceof _SemVer)) {
295
+ other = new _SemVer(other, this.options);
296
+ }
297
+ if (this.prerelease.length && !other.prerelease.length) {
298
+ return -1;
299
+ } else if (!this.prerelease.length && other.prerelease.length) {
300
+ return 1;
301
+ } else if (!this.prerelease.length && !other.prerelease.length) {
302
+ return 0;
303
+ }
304
+ let i = 0;
305
+ do {
306
+ const a = this.prerelease[i];
307
+ const b = other.prerelease[i];
308
+ debug("prerelease compare", i, a, b);
309
+ if (a === void 0 && b === void 0) {
310
+ return 0;
311
+ } else if (b === void 0) {
312
+ return 1;
313
+ } else if (a === void 0) {
314
+ return -1;
315
+ } else if (a === b) {
316
+ continue;
317
+ } else {
318
+ return compareIdentifiers(a, b);
319
+ }
320
+ } while (++i);
321
+ }
322
+ compareBuild(other) {
323
+ if (!(other instanceof _SemVer)) {
324
+ other = new _SemVer(other, this.options);
325
+ }
326
+ let i = 0;
327
+ do {
328
+ const a = this.build[i];
329
+ const b = other.build[i];
330
+ debug("build compare", i, a, b);
331
+ if (a === void 0 && b === void 0) {
332
+ return 0;
333
+ } else if (b === void 0) {
334
+ return 1;
335
+ } else if (a === void 0) {
336
+ return -1;
337
+ } else if (a === b) {
338
+ continue;
339
+ } else {
340
+ return compareIdentifiers(a, b);
341
+ }
342
+ } while (++i);
343
+ }
344
+ // preminor will bump the version up to the next minor release, and immediately
345
+ // down to pre-release. premajor and prepatch work the same way.
346
+ inc(release, identifier, identifierBase) {
347
+ switch (release) {
348
+ case "premajor":
349
+ this.prerelease.length = 0;
350
+ this.patch = 0;
351
+ this.minor = 0;
352
+ this.major++;
353
+ this.inc("pre", identifier, identifierBase);
354
+ break;
355
+ case "preminor":
356
+ this.prerelease.length = 0;
357
+ this.patch = 0;
358
+ this.minor++;
359
+ this.inc("pre", identifier, identifierBase);
360
+ break;
361
+ case "prepatch":
362
+ this.prerelease.length = 0;
363
+ this.inc("patch", identifier, identifierBase);
364
+ this.inc("pre", identifier, identifierBase);
365
+ break;
366
+ case "prerelease":
367
+ if (this.prerelease.length === 0) {
368
+ this.inc("patch", identifier, identifierBase);
369
+ }
370
+ this.inc("pre", identifier, identifierBase);
371
+ break;
372
+ case "major":
373
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
374
+ this.major++;
375
+ }
376
+ this.minor = 0;
377
+ this.patch = 0;
378
+ this.prerelease = [];
379
+ break;
380
+ case "minor":
381
+ if (this.patch !== 0 || this.prerelease.length === 0) {
382
+ this.minor++;
383
+ }
384
+ this.patch = 0;
385
+ this.prerelease = [];
386
+ break;
387
+ case "patch":
388
+ if (this.prerelease.length === 0) {
389
+ this.patch++;
390
+ }
391
+ this.prerelease = [];
392
+ break;
393
+ case "pre": {
394
+ const base3 = Number(identifierBase) ? 1 : 0;
395
+ if (!identifier && identifierBase === false) {
396
+ throw new Error("invalid increment argument: identifier is empty");
397
+ }
398
+ if (this.prerelease.length === 0) {
399
+ this.prerelease = [base3];
400
+ } else {
401
+ let i = this.prerelease.length;
402
+ while (--i >= 0) {
403
+ if (typeof this.prerelease[i] === "number") {
404
+ this.prerelease[i]++;
405
+ i = -2;
406
+ }
407
+ }
408
+ if (i === -1) {
409
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
410
+ throw new Error("invalid increment argument: identifier already exists");
411
+ }
412
+ this.prerelease.push(base3);
413
+ }
414
+ }
415
+ if (identifier) {
416
+ let prerelease = [identifier, base3];
417
+ if (identifierBase === false) {
418
+ prerelease = [identifier];
419
+ }
420
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
421
+ if (isNaN(this.prerelease[1])) {
422
+ this.prerelease = prerelease;
423
+ }
424
+ } else {
425
+ this.prerelease = prerelease;
426
+ }
427
+ }
428
+ break;
429
+ }
430
+ default:
431
+ throw new Error(`invalid increment argument: ${release}`);
432
+ }
433
+ this.raw = this.format();
434
+ if (this.build.length) {
435
+ this.raw += `+${this.build.join(".")}`;
436
+ }
437
+ return this;
438
+ }
439
+ };
440
+ module.exports = SemVer;
441
+ }
442
+ });
443
+
444
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js
445
+ var require_parse = __commonJS({
446
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js"(exports, module) {
447
+ "use strict";
448
+ var SemVer = require_semver();
449
+ var parse = (version, options, throwErrors = false) => {
450
+ if (version instanceof SemVer) {
451
+ return version;
452
+ }
453
+ try {
454
+ return new SemVer(version, options);
455
+ } catch (er) {
456
+ if (!throwErrors) {
457
+ return null;
458
+ }
459
+ throw er;
460
+ }
461
+ };
462
+ module.exports = parse;
463
+ }
464
+ });
465
+
466
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/valid.js
467
+ var require_valid = __commonJS({
468
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/valid.js"(exports, module) {
469
+ "use strict";
470
+ var parse = require_parse();
471
+ var valid = (version, options) => {
472
+ const v = parse(version, options);
473
+ return v ? v.version : null;
474
+ };
475
+ module.exports = valid;
476
+ }
477
+ });
478
+
479
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/clean.js
480
+ var require_clean = __commonJS({
481
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/clean.js"(exports, module) {
482
+ "use strict";
483
+ var parse = require_parse();
484
+ var clean = (version, options) => {
485
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
486
+ return s ? s.version : null;
487
+ };
488
+ module.exports = clean;
489
+ }
490
+ });
491
+
492
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/inc.js
493
+ var require_inc = __commonJS({
494
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/inc.js"(exports, module) {
495
+ "use strict";
496
+ var SemVer = require_semver();
497
+ var inc = (version, release, options, identifier, identifierBase) => {
498
+ if (typeof options === "string") {
499
+ identifierBase = identifier;
500
+ identifier = options;
501
+ options = void 0;
502
+ }
503
+ try {
504
+ return new SemVer(
505
+ version instanceof SemVer ? version.version : version,
506
+ options
507
+ ).inc(release, identifier, identifierBase).version;
508
+ } catch (er) {
509
+ return null;
510
+ }
511
+ };
512
+ module.exports = inc;
513
+ }
514
+ });
515
+
516
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/diff.js
517
+ var require_diff = __commonJS({
518
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/diff.js"(exports, module) {
519
+ "use strict";
520
+ var parse = require_parse();
521
+ var diff = (version1, version2) => {
522
+ const v1 = parse(version1, null, true);
523
+ const v2 = parse(version2, null, true);
524
+ const comparison = v1.compare(v2);
525
+ if (comparison === 0) {
526
+ return null;
527
+ }
528
+ const v1Higher = comparison > 0;
529
+ const highVersion = v1Higher ? v1 : v2;
530
+ const lowVersion = v1Higher ? v2 : v1;
531
+ const highHasPre = !!highVersion.prerelease.length;
532
+ const lowHasPre = !!lowVersion.prerelease.length;
533
+ if (lowHasPre && !highHasPre) {
534
+ if (!lowVersion.patch && !lowVersion.minor) {
535
+ return "major";
536
+ }
537
+ if (highVersion.patch) {
538
+ return "patch";
539
+ }
540
+ if (highVersion.minor) {
541
+ return "minor";
542
+ }
543
+ return "major";
544
+ }
545
+ const prefix = highHasPre ? "pre" : "";
546
+ if (v1.major !== v2.major) {
547
+ return prefix + "major";
548
+ }
549
+ if (v1.minor !== v2.minor) {
550
+ return prefix + "minor";
551
+ }
552
+ if (v1.patch !== v2.patch) {
553
+ return prefix + "patch";
554
+ }
555
+ return "prerelease";
556
+ };
557
+ module.exports = diff;
558
+ }
559
+ });
560
+
561
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/major.js
562
+ var require_major = __commonJS({
563
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/major.js"(exports, module) {
564
+ "use strict";
565
+ var SemVer = require_semver();
566
+ var major = (a, loose) => new SemVer(a, loose).major;
567
+ module.exports = major;
568
+ }
569
+ });
570
+
571
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/minor.js
572
+ var require_minor = __commonJS({
573
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/minor.js"(exports, module) {
574
+ "use strict";
575
+ var SemVer = require_semver();
576
+ var minor = (a, loose) => new SemVer(a, loose).minor;
577
+ module.exports = minor;
578
+ }
579
+ });
580
+
581
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/patch.js
582
+ var require_patch = __commonJS({
583
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/patch.js"(exports, module) {
584
+ "use strict";
585
+ var SemVer = require_semver();
586
+ var patch = (a, loose) => new SemVer(a, loose).patch;
587
+ module.exports = patch;
588
+ }
589
+ });
590
+
591
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/prerelease.js
592
+ var require_prerelease = __commonJS({
593
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/prerelease.js"(exports, module) {
594
+ "use strict";
595
+ var parse = require_parse();
596
+ var prerelease = (version, options) => {
597
+ const parsed = parse(version, options);
598
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
599
+ };
600
+ module.exports = prerelease;
601
+ }
602
+ });
603
+
604
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js
605
+ var require_compare = __commonJS({
606
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js"(exports, module) {
607
+ "use strict";
608
+ var SemVer = require_semver();
609
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
610
+ module.exports = compare;
611
+ }
612
+ });
613
+
614
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rcompare.js
615
+ var require_rcompare = __commonJS({
616
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rcompare.js"(exports, module) {
617
+ "use strict";
618
+ var compare = require_compare();
619
+ var rcompare = (a, b, loose) => compare(b, a, loose);
620
+ module.exports = rcompare;
621
+ }
622
+ });
623
+
624
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-loose.js
625
+ var require_compare_loose = __commonJS({
626
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-loose.js"(exports, module) {
627
+ "use strict";
628
+ var compare = require_compare();
629
+ var compareLoose = (a, b) => compare(a, b, true);
630
+ module.exports = compareLoose;
631
+ }
632
+ });
633
+
634
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js
635
+ var require_compare_build = __commonJS({
636
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js"(exports, module) {
637
+ "use strict";
638
+ var SemVer = require_semver();
639
+ var compareBuild = (a, b, loose) => {
640
+ const versionA = new SemVer(a, loose);
641
+ const versionB = new SemVer(b, loose);
642
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
643
+ };
644
+ module.exports = compareBuild;
645
+ }
646
+ });
647
+
648
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/sort.js
649
+ var require_sort = __commonJS({
650
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/sort.js"(exports, module) {
651
+ "use strict";
652
+ var compareBuild = require_compare_build();
653
+ var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
654
+ module.exports = sort;
655
+ }
656
+ });
657
+
658
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rsort.js
659
+ var require_rsort = __commonJS({
660
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rsort.js"(exports, module) {
661
+ "use strict";
662
+ var compareBuild = require_compare_build();
663
+ var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
664
+ module.exports = rsort;
665
+ }
666
+ });
667
+
668
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js
669
+ var require_gt = __commonJS({
670
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js"(exports, module) {
671
+ "use strict";
672
+ var compare = require_compare();
673
+ var gt = (a, b, loose) => compare(a, b, loose) > 0;
674
+ module.exports = gt;
675
+ }
676
+ });
677
+
678
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js
679
+ var require_lt = __commonJS({
680
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js"(exports, module) {
681
+ "use strict";
682
+ var compare = require_compare();
683
+ var lt = (a, b, loose) => compare(a, b, loose) < 0;
684
+ module.exports = lt;
685
+ }
686
+ });
687
+
688
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/eq.js
689
+ var require_eq = __commonJS({
690
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/eq.js"(exports, module) {
691
+ "use strict";
692
+ var compare = require_compare();
693
+ var eq = (a, b, loose) => compare(a, b, loose) === 0;
694
+ module.exports = eq;
695
+ }
696
+ });
697
+
698
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/neq.js
699
+ var require_neq = __commonJS({
700
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/neq.js"(exports, module) {
701
+ "use strict";
702
+ var compare = require_compare();
703
+ var neq = (a, b, loose) => compare(a, b, loose) !== 0;
704
+ module.exports = neq;
705
+ }
706
+ });
707
+
708
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js
709
+ var require_gte = __commonJS({
710
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js"(exports, module) {
711
+ "use strict";
712
+ var compare = require_compare();
713
+ var gte4 = (a, b, loose) => compare(a, b, loose) >= 0;
714
+ module.exports = gte4;
715
+ }
716
+ });
717
+
718
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js
719
+ var require_lte = __commonJS({
720
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js"(exports, module) {
721
+ "use strict";
722
+ var compare = require_compare();
723
+ var lte = (a, b, loose) => compare(a, b, loose) <= 0;
724
+ module.exports = lte;
725
+ }
726
+ });
727
+
728
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/cmp.js
729
+ var require_cmp = __commonJS({
730
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/cmp.js"(exports, module) {
731
+ "use strict";
732
+ var eq = require_eq();
733
+ var neq = require_neq();
734
+ var gt = require_gt();
735
+ var gte4 = require_gte();
736
+ var lt = require_lt();
737
+ var lte = require_lte();
738
+ var cmp = (a, op, b, loose) => {
739
+ switch (op) {
740
+ case "===":
741
+ if (typeof a === "object") {
742
+ a = a.version;
743
+ }
744
+ if (typeof b === "object") {
745
+ b = b.version;
746
+ }
747
+ return a === b;
748
+ case "!==":
749
+ if (typeof a === "object") {
750
+ a = a.version;
751
+ }
752
+ if (typeof b === "object") {
753
+ b = b.version;
754
+ }
755
+ return a !== b;
756
+ case "":
757
+ case "=":
758
+ case "==":
759
+ return eq(a, b, loose);
760
+ case "!=":
761
+ return neq(a, b, loose);
762
+ case ">":
763
+ return gt(a, b, loose);
764
+ case ">=":
765
+ return gte4(a, b, loose);
766
+ case "<":
767
+ return lt(a, b, loose);
768
+ case "<=":
769
+ return lte(a, b, loose);
770
+ default:
771
+ throw new TypeError(`Invalid operator: ${op}`);
772
+ }
773
+ };
774
+ module.exports = cmp;
775
+ }
776
+ });
777
+
778
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/coerce.js
779
+ var require_coerce = __commonJS({
780
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/coerce.js"(exports, module) {
781
+ "use strict";
782
+ var SemVer = require_semver();
783
+ var parse = require_parse();
784
+ var { safeRe: re, t } = require_re();
785
+ var coerce5 = (version, options) => {
786
+ if (version instanceof SemVer) {
787
+ return version;
788
+ }
789
+ if (typeof version === "number") {
790
+ version = String(version);
791
+ }
792
+ if (typeof version !== "string") {
793
+ return null;
794
+ }
795
+ options = options || {};
796
+ let match = null;
797
+ if (!options.rtl) {
798
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
799
+ } else {
800
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
801
+ let next;
802
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
803
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
804
+ match = next;
805
+ }
806
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
807
+ }
808
+ coerceRtlRegex.lastIndex = -1;
809
+ }
810
+ if (match === null) {
811
+ return null;
812
+ }
813
+ const major = match[2];
814
+ const minor = match[3] || "0";
815
+ const patch = match[4] || "0";
816
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
817
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
818
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
819
+ };
820
+ module.exports = coerce5;
821
+ }
822
+ });
823
+
824
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/lrucache.js
825
+ var require_lrucache = __commonJS({
826
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/lrucache.js"(exports, module) {
827
+ "use strict";
828
+ var LRUCache = class {
829
+ constructor() {
830
+ this.max = 1e3;
831
+ this.map = /* @__PURE__ */ new Map();
832
+ }
833
+ get(key) {
834
+ const value = this.map.get(key);
835
+ if (value === void 0) {
836
+ return void 0;
837
+ } else {
838
+ this.map.delete(key);
839
+ this.map.set(key, value);
840
+ return value;
841
+ }
842
+ }
843
+ delete(key) {
844
+ return this.map.delete(key);
845
+ }
846
+ set(key, value) {
847
+ const deleted = this.delete(key);
848
+ if (!deleted && value !== void 0) {
849
+ if (this.map.size >= this.max) {
850
+ const firstKey = this.map.keys().next().value;
851
+ this.delete(firstKey);
852
+ }
853
+ this.map.set(key, value);
854
+ }
855
+ return this;
856
+ }
857
+ };
858
+ module.exports = LRUCache;
859
+ }
860
+ });
861
+
862
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js
863
+ var require_range = __commonJS({
864
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js"(exports, module) {
865
+ "use strict";
866
+ var SPACE_CHARACTERS = /\s+/g;
867
+ var Range = class _Range {
868
+ constructor(range, options) {
869
+ options = parseOptions(options);
870
+ if (range instanceof _Range) {
871
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
872
+ return range;
873
+ } else {
874
+ return new _Range(range.raw, options);
875
+ }
876
+ }
877
+ if (range instanceof Comparator) {
878
+ this.raw = range.value;
879
+ this.set = [[range]];
880
+ this.formatted = void 0;
881
+ return this;
882
+ }
883
+ this.options = options;
884
+ this.loose = !!options.loose;
885
+ this.includePrerelease = !!options.includePrerelease;
886
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
887
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
888
+ if (!this.set.length) {
889
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
890
+ }
891
+ if (this.set.length > 1) {
892
+ const first = this.set[0];
893
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
894
+ if (this.set.length === 0) {
895
+ this.set = [first];
896
+ } else if (this.set.length > 1) {
897
+ for (const c of this.set) {
898
+ if (c.length === 1 && isAny(c[0])) {
899
+ this.set = [c];
900
+ break;
901
+ }
902
+ }
903
+ }
904
+ }
905
+ this.formatted = void 0;
906
+ }
907
+ get range() {
908
+ if (this.formatted === void 0) {
909
+ this.formatted = "";
910
+ for (let i = 0; i < this.set.length; i++) {
911
+ if (i > 0) {
912
+ this.formatted += "||";
913
+ }
914
+ const comps = this.set[i];
915
+ for (let k = 0; k < comps.length; k++) {
916
+ if (k > 0) {
917
+ this.formatted += " ";
918
+ }
919
+ this.formatted += comps[k].toString().trim();
920
+ }
921
+ }
922
+ }
923
+ return this.formatted;
924
+ }
925
+ format() {
926
+ return this.range;
927
+ }
928
+ toString() {
929
+ return this.range;
930
+ }
931
+ parseRange(range) {
932
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
933
+ const memoKey = memoOpts + ":" + range;
934
+ const cached = cache2.get(memoKey);
935
+ if (cached) {
936
+ return cached;
937
+ }
938
+ const loose = this.options.loose;
939
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
940
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
941
+ debug("hyphen replace", range);
942
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
943
+ debug("comparator trim", range);
944
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
945
+ debug("tilde trim", range);
946
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
947
+ debug("caret trim", range);
948
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
949
+ if (loose) {
950
+ rangeList = rangeList.filter((comp) => {
951
+ debug("loose invalid filter", comp, this.options);
952
+ return !!comp.match(re[t.COMPARATORLOOSE]);
953
+ });
954
+ }
955
+ debug("range list", rangeList);
956
+ const rangeMap = /* @__PURE__ */ new Map();
957
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
958
+ for (const comp of comparators) {
959
+ if (isNullSet(comp)) {
960
+ return [comp];
961
+ }
962
+ rangeMap.set(comp.value, comp);
963
+ }
964
+ if (rangeMap.size > 1 && rangeMap.has("")) {
965
+ rangeMap.delete("");
966
+ }
967
+ const result = [...rangeMap.values()];
968
+ cache2.set(memoKey, result);
969
+ return result;
970
+ }
971
+ intersects(range, options) {
972
+ if (!(range instanceof _Range)) {
973
+ throw new TypeError("a Range is required");
974
+ }
975
+ return this.set.some((thisComparators) => {
976
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
977
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
978
+ return rangeComparators.every((rangeComparator) => {
979
+ return thisComparator.intersects(rangeComparator, options);
980
+ });
981
+ });
982
+ });
983
+ });
984
+ }
985
+ // if ANY of the sets match ALL of its comparators, then pass
986
+ test(version) {
987
+ if (!version) {
988
+ return false;
989
+ }
990
+ if (typeof version === "string") {
991
+ try {
992
+ version = new SemVer(version, this.options);
993
+ } catch (er) {
994
+ return false;
995
+ }
996
+ }
997
+ for (let i = 0; i < this.set.length; i++) {
998
+ if (testSet(this.set[i], version, this.options)) {
999
+ return true;
1000
+ }
1001
+ }
1002
+ return false;
1003
+ }
1004
+ };
1005
+ module.exports = Range;
1006
+ var LRU = require_lrucache();
1007
+ var cache2 = new LRU();
1008
+ var parseOptions = require_parse_options();
1009
+ var Comparator = require_comparator();
1010
+ var debug = require_debug();
1011
+ var SemVer = require_semver();
1012
+ var {
1013
+ safeRe: re,
1014
+ t,
1015
+ comparatorTrimReplace,
1016
+ tildeTrimReplace,
1017
+ caretTrimReplace
1018
+ } = require_re();
1019
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
1020
+ var isNullSet = (c) => c.value === "<0.0.0-0";
1021
+ var isAny = (c) => c.value === "";
1022
+ var isSatisfiable = (comparators, options) => {
1023
+ let result = true;
1024
+ const remainingComparators = comparators.slice();
1025
+ let testComparator = remainingComparators.pop();
1026
+ while (result && remainingComparators.length) {
1027
+ result = remainingComparators.every((otherComparator) => {
1028
+ return testComparator.intersects(otherComparator, options);
1029
+ });
1030
+ testComparator = remainingComparators.pop();
1031
+ }
1032
+ return result;
1033
+ };
1034
+ var parseComparator = (comp, options) => {
1035
+ debug("comp", comp, options);
1036
+ comp = replaceCarets(comp, options);
1037
+ debug("caret", comp);
1038
+ comp = replaceTildes(comp, options);
1039
+ debug("tildes", comp);
1040
+ comp = replaceXRanges(comp, options);
1041
+ debug("xrange", comp);
1042
+ comp = replaceStars(comp, options);
1043
+ debug("stars", comp);
1044
+ return comp;
1045
+ };
1046
+ var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1047
+ var replaceTildes = (comp, options) => {
1048
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
1049
+ };
1050
+ var replaceTilde = (comp, options) => {
1051
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1052
+ return comp.replace(r, (_, M, m, p, pr) => {
1053
+ debug("tilde", comp, _, M, m, p, pr);
1054
+ let ret;
1055
+ if (isX(M)) {
1056
+ ret = "";
1057
+ } else if (isX(m)) {
1058
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1059
+ } else if (isX(p)) {
1060
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1061
+ } else if (pr) {
1062
+ debug("replaceTilde pr", pr);
1063
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1064
+ } else {
1065
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1066
+ }
1067
+ debug("tilde return", ret);
1068
+ return ret;
1069
+ });
1070
+ };
1071
+ var replaceCarets = (comp, options) => {
1072
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
1073
+ };
1074
+ var replaceCaret = (comp, options) => {
1075
+ debug("caret", comp, options);
1076
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1077
+ const z = options.includePrerelease ? "-0" : "";
1078
+ return comp.replace(r, (_, M, m, p, pr) => {
1079
+ debug("caret", comp, _, M, m, p, pr);
1080
+ let ret;
1081
+ if (isX(M)) {
1082
+ ret = "";
1083
+ } else if (isX(m)) {
1084
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1085
+ } else if (isX(p)) {
1086
+ if (M === "0") {
1087
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1088
+ } else {
1089
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1090
+ }
1091
+ } else if (pr) {
1092
+ debug("replaceCaret pr", pr);
1093
+ if (M === "0") {
1094
+ if (m === "0") {
1095
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1096
+ } else {
1097
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1098
+ }
1099
+ } else {
1100
+ ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1101
+ }
1102
+ } else {
1103
+ debug("no pr");
1104
+ if (M === "0") {
1105
+ if (m === "0") {
1106
+ ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1107
+ } else {
1108
+ ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1109
+ }
1110
+ } else {
1111
+ ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1112
+ }
1113
+ }
1114
+ debug("caret return", ret);
1115
+ return ret;
1116
+ });
1117
+ };
1118
+ var replaceXRanges = (comp, options) => {
1119
+ debug("replaceXRanges", comp, options);
1120
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
1121
+ };
1122
+ var replaceXRange = (comp, options) => {
1123
+ comp = comp.trim();
1124
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1125
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1126
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
1127
+ const xM = isX(M);
1128
+ const xm = xM || isX(m);
1129
+ const xp = xm || isX(p);
1130
+ const anyX = xp;
1131
+ if (gtlt === "=" && anyX) {
1132
+ gtlt = "";
1133
+ }
1134
+ pr = options.includePrerelease ? "-0" : "";
1135
+ if (xM) {
1136
+ if (gtlt === ">" || gtlt === "<") {
1137
+ ret = "<0.0.0-0";
1138
+ } else {
1139
+ ret = "*";
1140
+ }
1141
+ } else if (gtlt && anyX) {
1142
+ if (xm) {
1143
+ m = 0;
1144
+ }
1145
+ p = 0;
1146
+ if (gtlt === ">") {
1147
+ gtlt = ">=";
1148
+ if (xm) {
1149
+ M = +M + 1;
1150
+ m = 0;
1151
+ p = 0;
1152
+ } else {
1153
+ m = +m + 1;
1154
+ p = 0;
1155
+ }
1156
+ } else if (gtlt === "<=") {
1157
+ gtlt = "<";
1158
+ if (xm) {
1159
+ M = +M + 1;
1160
+ } else {
1161
+ m = +m + 1;
1162
+ }
1163
+ }
1164
+ if (gtlt === "<") {
1165
+ pr = "-0";
1166
+ }
1167
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
1168
+ } else if (xm) {
1169
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1170
+ } else if (xp) {
1171
+ ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1172
+ }
1173
+ debug("xRange return", ret);
1174
+ return ret;
1175
+ });
1176
+ };
1177
+ var replaceStars = (comp, options) => {
1178
+ debug("replaceStars", comp, options);
1179
+ return comp.trim().replace(re[t.STAR], "");
1180
+ };
1181
+ var replaceGTE0 = (comp, options) => {
1182
+ debug("replaceGTE0", comp, options);
1183
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1184
+ };
1185
+ var hyphenReplace = (incPr) => ($0, from2, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
1186
+ if (isX(fM)) {
1187
+ from2 = "";
1188
+ } else if (isX(fm)) {
1189
+ from2 = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1190
+ } else if (isX(fp)) {
1191
+ from2 = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1192
+ } else if (fpr) {
1193
+ from2 = `>=${from2}`;
1194
+ } else {
1195
+ from2 = `>=${from2}${incPr ? "-0" : ""}`;
1196
+ }
1197
+ if (isX(tM)) {
1198
+ to = "";
1199
+ } else if (isX(tm)) {
1200
+ to = `<${+tM + 1}.0.0-0`;
1201
+ } else if (isX(tp)) {
1202
+ to = `<${tM}.${+tm + 1}.0-0`;
1203
+ } else if (tpr) {
1204
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
1205
+ } else if (incPr) {
1206
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
1207
+ } else {
1208
+ to = `<=${to}`;
1209
+ }
1210
+ return `${from2} ${to}`.trim();
1211
+ };
1212
+ var testSet = (set, version, options) => {
1213
+ for (let i = 0; i < set.length; i++) {
1214
+ if (!set[i].test(version)) {
1215
+ return false;
1216
+ }
1217
+ }
1218
+ if (version.prerelease.length && !options.includePrerelease) {
1219
+ for (let i = 0; i < set.length; i++) {
1220
+ debug(set[i].semver);
1221
+ if (set[i].semver === Comparator.ANY) {
1222
+ continue;
1223
+ }
1224
+ if (set[i].semver.prerelease.length > 0) {
1225
+ const allowed = set[i].semver;
1226
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
1227
+ return true;
1228
+ }
1229
+ }
1230
+ }
1231
+ return false;
1232
+ }
1233
+ return true;
1234
+ };
1235
+ }
1236
+ });
1237
+
1238
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js
1239
+ var require_comparator = __commonJS({
1240
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js"(exports, module) {
1241
+ "use strict";
1242
+ var ANY = Symbol("SemVer ANY");
1243
+ var Comparator = class _Comparator {
1244
+ static get ANY() {
1245
+ return ANY;
1246
+ }
1247
+ constructor(comp, options) {
1248
+ options = parseOptions(options);
1249
+ if (comp instanceof _Comparator) {
1250
+ if (comp.loose === !!options.loose) {
1251
+ return comp;
1252
+ } else {
1253
+ comp = comp.value;
1254
+ }
1255
+ }
1256
+ comp = comp.trim().split(/\s+/).join(" ");
1257
+ debug("comparator", comp, options);
1258
+ this.options = options;
1259
+ this.loose = !!options.loose;
1260
+ this.parse(comp);
1261
+ if (this.semver === ANY) {
1262
+ this.value = "";
1263
+ } else {
1264
+ this.value = this.operator + this.semver.version;
1265
+ }
1266
+ debug("comp", this);
1267
+ }
1268
+ parse(comp) {
1269
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1270
+ const m = comp.match(r);
1271
+ if (!m) {
1272
+ throw new TypeError(`Invalid comparator: ${comp}`);
1273
+ }
1274
+ this.operator = m[1] !== void 0 ? m[1] : "";
1275
+ if (this.operator === "=") {
1276
+ this.operator = "";
1277
+ }
1278
+ if (!m[2]) {
1279
+ this.semver = ANY;
1280
+ } else {
1281
+ this.semver = new SemVer(m[2], this.options.loose);
1282
+ }
1283
+ }
1284
+ toString() {
1285
+ return this.value;
1286
+ }
1287
+ test(version) {
1288
+ debug("Comparator.test", version, this.options.loose);
1289
+ if (this.semver === ANY || version === ANY) {
1290
+ return true;
1291
+ }
1292
+ if (typeof version === "string") {
1293
+ try {
1294
+ version = new SemVer(version, this.options);
1295
+ } catch (er) {
1296
+ return false;
1297
+ }
1298
+ }
1299
+ return cmp(version, this.operator, this.semver, this.options);
1300
+ }
1301
+ intersects(comp, options) {
1302
+ if (!(comp instanceof _Comparator)) {
1303
+ throw new TypeError("a Comparator is required");
1304
+ }
1305
+ if (this.operator === "") {
1306
+ if (this.value === "") {
1307
+ return true;
1308
+ }
1309
+ return new Range(comp.value, options).test(this.value);
1310
+ } else if (comp.operator === "") {
1311
+ if (comp.value === "") {
1312
+ return true;
1313
+ }
1314
+ return new Range(this.value, options).test(comp.semver);
1315
+ }
1316
+ options = parseOptions(options);
1317
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
1318
+ return false;
1319
+ }
1320
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
1321
+ return false;
1322
+ }
1323
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
1324
+ return true;
1325
+ }
1326
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
1327
+ return true;
1328
+ }
1329
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
1330
+ return true;
1331
+ }
1332
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
1333
+ return true;
1334
+ }
1335
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
1336
+ return true;
1337
+ }
1338
+ return false;
1339
+ }
1340
+ };
1341
+ module.exports = Comparator;
1342
+ var parseOptions = require_parse_options();
1343
+ var { safeRe: re, t } = require_re();
1344
+ var cmp = require_cmp();
1345
+ var debug = require_debug();
1346
+ var SemVer = require_semver();
1347
+ var Range = require_range();
1348
+ }
1349
+ });
1350
+
1351
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js
1352
+ var require_satisfies = __commonJS({
1353
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js"(exports, module) {
1354
+ "use strict";
1355
+ var Range = require_range();
1356
+ var satisfies = (version, range, options) => {
1357
+ try {
1358
+ range = new Range(range, options);
1359
+ } catch (er) {
1360
+ return false;
1361
+ }
1362
+ return range.test(version);
1363
+ };
1364
+ module.exports = satisfies;
1365
+ }
1366
+ });
1367
+
1368
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/to-comparators.js
1369
+ var require_to_comparators = __commonJS({
1370
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/to-comparators.js"(exports, module) {
1371
+ "use strict";
1372
+ var Range = require_range();
1373
+ var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1374
+ module.exports = toComparators;
1375
+ }
1376
+ });
1377
+
1378
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/max-satisfying.js
1379
+ var require_max_satisfying = __commonJS({
1380
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/max-satisfying.js"(exports, module) {
1381
+ "use strict";
1382
+ var SemVer = require_semver();
1383
+ var Range = require_range();
1384
+ var maxSatisfying = (versions, range, options) => {
1385
+ let max = null;
1386
+ let maxSV = null;
1387
+ let rangeObj = null;
1388
+ try {
1389
+ rangeObj = new Range(range, options);
1390
+ } catch (er) {
1391
+ return null;
1392
+ }
1393
+ versions.forEach((v) => {
1394
+ if (rangeObj.test(v)) {
1395
+ if (!max || maxSV.compare(v) === -1) {
1396
+ max = v;
1397
+ maxSV = new SemVer(max, options);
1398
+ }
1399
+ }
1400
+ });
1401
+ return max;
1402
+ };
1403
+ module.exports = maxSatisfying;
1404
+ }
1405
+ });
1406
+
1407
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-satisfying.js
1408
+ var require_min_satisfying = __commonJS({
1409
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-satisfying.js"(exports, module) {
1410
+ "use strict";
1411
+ var SemVer = require_semver();
1412
+ var Range = require_range();
1413
+ var minSatisfying = (versions, range, options) => {
1414
+ let min = null;
1415
+ let minSV = null;
1416
+ let rangeObj = null;
1417
+ try {
1418
+ rangeObj = new Range(range, options);
1419
+ } catch (er) {
1420
+ return null;
1421
+ }
1422
+ versions.forEach((v) => {
1423
+ if (rangeObj.test(v)) {
1424
+ if (!min || minSV.compare(v) === 1) {
1425
+ min = v;
1426
+ minSV = new SemVer(min, options);
1427
+ }
1428
+ }
1429
+ });
1430
+ return min;
1431
+ };
1432
+ module.exports = minSatisfying;
1433
+ }
1434
+ });
1435
+
1436
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-version.js
1437
+ var require_min_version = __commonJS({
1438
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-version.js"(exports, module) {
1439
+ "use strict";
1440
+ var SemVer = require_semver();
1441
+ var Range = require_range();
1442
+ var gt = require_gt();
1443
+ var minVersion = (range, loose) => {
1444
+ range = new Range(range, loose);
1445
+ let minver = new SemVer("0.0.0");
1446
+ if (range.test(minver)) {
1447
+ return minver;
1448
+ }
1449
+ minver = new SemVer("0.0.0-0");
1450
+ if (range.test(minver)) {
1451
+ return minver;
1452
+ }
1453
+ minver = null;
1454
+ for (let i = 0; i < range.set.length; ++i) {
1455
+ const comparators = range.set[i];
1456
+ let setMin = null;
1457
+ comparators.forEach((comparator) => {
1458
+ const compver = new SemVer(comparator.semver.version);
1459
+ switch (comparator.operator) {
1460
+ case ">":
1461
+ if (compver.prerelease.length === 0) {
1462
+ compver.patch++;
1463
+ } else {
1464
+ compver.prerelease.push(0);
1465
+ }
1466
+ compver.raw = compver.format();
1467
+ case "":
1468
+ case ">=":
1469
+ if (!setMin || gt(compver, setMin)) {
1470
+ setMin = compver;
1471
+ }
1472
+ break;
1473
+ case "<":
1474
+ case "<=":
1475
+ break;
1476
+ default:
1477
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
1478
+ }
1479
+ });
1480
+ if (setMin && (!minver || gt(minver, setMin))) {
1481
+ minver = setMin;
1482
+ }
1483
+ }
1484
+ if (minver && range.test(minver)) {
1485
+ return minver;
1486
+ }
1487
+ return null;
1488
+ };
1489
+ module.exports = minVersion;
1490
+ }
1491
+ });
1492
+
1493
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/valid.js
1494
+ var require_valid2 = __commonJS({
1495
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/valid.js"(exports, module) {
1496
+ "use strict";
1497
+ var Range = require_range();
1498
+ var validRange = (range, options) => {
1499
+ try {
1500
+ return new Range(range, options).range || "*";
1501
+ } catch (er) {
1502
+ return null;
1503
+ }
1504
+ };
1505
+ module.exports = validRange;
1506
+ }
1507
+ });
1508
+
1509
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js
1510
+ var require_outside = __commonJS({
1511
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js"(exports, module) {
1512
+ "use strict";
1513
+ var SemVer = require_semver();
1514
+ var Comparator = require_comparator();
1515
+ var { ANY } = Comparator;
1516
+ var Range = require_range();
1517
+ var satisfies = require_satisfies();
1518
+ var gt = require_gt();
1519
+ var lt = require_lt();
1520
+ var lte = require_lte();
1521
+ var gte4 = require_gte();
1522
+ var outside = (version, range, hilo, options) => {
1523
+ version = new SemVer(version, options);
1524
+ range = new Range(range, options);
1525
+ let gtfn, ltefn, ltfn, comp, ecomp;
1526
+ switch (hilo) {
1527
+ case ">":
1528
+ gtfn = gt;
1529
+ ltefn = lte;
1530
+ ltfn = lt;
1531
+ comp = ">";
1532
+ ecomp = ">=";
1533
+ break;
1534
+ case "<":
1535
+ gtfn = lt;
1536
+ ltefn = gte4;
1537
+ ltfn = gt;
1538
+ comp = "<";
1539
+ ecomp = "<=";
1540
+ break;
1541
+ default:
1542
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
1543
+ }
1544
+ if (satisfies(version, range, options)) {
1545
+ return false;
1546
+ }
1547
+ for (let i = 0; i < range.set.length; ++i) {
1548
+ const comparators = range.set[i];
1549
+ let high = null;
1550
+ let low = null;
1551
+ comparators.forEach((comparator) => {
1552
+ if (comparator.semver === ANY) {
1553
+ comparator = new Comparator(">=0.0.0");
1554
+ }
1555
+ high = high || comparator;
1556
+ low = low || comparator;
1557
+ if (gtfn(comparator.semver, high.semver, options)) {
1558
+ high = comparator;
1559
+ } else if (ltfn(comparator.semver, low.semver, options)) {
1560
+ low = comparator;
1561
+ }
1562
+ });
1563
+ if (high.operator === comp || high.operator === ecomp) {
1564
+ return false;
1565
+ }
1566
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
1567
+ return false;
1568
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
1569
+ return false;
1570
+ }
1571
+ }
1572
+ return true;
1573
+ };
1574
+ module.exports = outside;
1575
+ }
1576
+ });
1577
+
1578
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/gtr.js
1579
+ var require_gtr = __commonJS({
1580
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/gtr.js"(exports, module) {
1581
+ "use strict";
1582
+ var outside = require_outside();
1583
+ var gtr = (version, range, options) => outside(version, range, ">", options);
1584
+ module.exports = gtr;
1585
+ }
1586
+ });
1587
+
1588
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/ltr.js
1589
+ var require_ltr = __commonJS({
1590
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/ltr.js"(exports, module) {
1591
+ "use strict";
1592
+ var outside = require_outside();
1593
+ var ltr = (version, range, options) => outside(version, range, "<", options);
1594
+ module.exports = ltr;
1595
+ }
1596
+ });
1597
+
1598
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/intersects.js
1599
+ var require_intersects = __commonJS({
1600
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/intersects.js"(exports, module) {
1601
+ "use strict";
1602
+ var Range = require_range();
1603
+ var intersects = (r1, r2, options) => {
1604
+ r1 = new Range(r1, options);
1605
+ r2 = new Range(r2, options);
1606
+ return r1.intersects(r2, options);
1607
+ };
1608
+ module.exports = intersects;
1609
+ }
1610
+ });
1611
+
1612
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/simplify.js
1613
+ var require_simplify = __commonJS({
1614
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/simplify.js"(exports, module) {
1615
+ "use strict";
1616
+ var satisfies = require_satisfies();
1617
+ var compare = require_compare();
1618
+ module.exports = (versions, range, options) => {
1619
+ const set = [];
1620
+ let first = null;
1621
+ let prev = null;
1622
+ const v = versions.sort((a, b) => compare(a, b, options));
1623
+ for (const version of v) {
1624
+ const included = satisfies(version, range, options);
1625
+ if (included) {
1626
+ prev = version;
1627
+ if (!first) {
1628
+ first = version;
1629
+ }
1630
+ } else {
1631
+ if (prev) {
1632
+ set.push([first, prev]);
1633
+ }
1634
+ prev = null;
1635
+ first = null;
1636
+ }
1637
+ }
1638
+ if (first) {
1639
+ set.push([first, null]);
1640
+ }
1641
+ const ranges = [];
1642
+ for (const [min, max] of set) {
1643
+ if (min === max) {
1644
+ ranges.push(min);
1645
+ } else if (!max && min === v[0]) {
1646
+ ranges.push("*");
1647
+ } else if (!max) {
1648
+ ranges.push(`>=${min}`);
1649
+ } else if (min === v[0]) {
1650
+ ranges.push(`<=${max}`);
1651
+ } else {
1652
+ ranges.push(`${min} - ${max}`);
1653
+ }
1654
+ }
1655
+ const simplified = ranges.join(" || ");
1656
+ const original = typeof range.raw === "string" ? range.raw : String(range);
1657
+ return simplified.length < original.length ? simplified : range;
1658
+ };
1659
+ }
1660
+ });
1661
+
1662
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/subset.js
1663
+ var require_subset = __commonJS({
1664
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/subset.js"(exports, module) {
1665
+ "use strict";
1666
+ var Range = require_range();
1667
+ var Comparator = require_comparator();
1668
+ var { ANY } = Comparator;
1669
+ var satisfies = require_satisfies();
1670
+ var compare = require_compare();
1671
+ var subset = (sub, dom, options = {}) => {
1672
+ if (sub === dom) {
1673
+ return true;
1674
+ }
1675
+ sub = new Range(sub, options);
1676
+ dom = new Range(dom, options);
1677
+ let sawNonNull = false;
1678
+ OUTER:
1679
+ for (const simpleSub of sub.set) {
1680
+ for (const simpleDom of dom.set) {
1681
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
1682
+ sawNonNull = sawNonNull || isSub !== null;
1683
+ if (isSub) {
1684
+ continue OUTER;
1685
+ }
1686
+ }
1687
+ if (sawNonNull) {
1688
+ return false;
1689
+ }
1690
+ }
1691
+ return true;
1692
+ };
1693
+ var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
1694
+ var minimumVersion = [new Comparator(">=0.0.0")];
1695
+ var simpleSubset = (sub, dom, options) => {
1696
+ if (sub === dom) {
1697
+ return true;
1698
+ }
1699
+ if (sub.length === 1 && sub[0].semver === ANY) {
1700
+ if (dom.length === 1 && dom[0].semver === ANY) {
1701
+ return true;
1702
+ } else if (options.includePrerelease) {
1703
+ sub = minimumVersionWithPreRelease;
1704
+ } else {
1705
+ sub = minimumVersion;
1706
+ }
1707
+ }
1708
+ if (dom.length === 1 && dom[0].semver === ANY) {
1709
+ if (options.includePrerelease) {
1710
+ return true;
1711
+ } else {
1712
+ dom = minimumVersion;
1713
+ }
1714
+ }
1715
+ const eqSet = /* @__PURE__ */ new Set();
1716
+ let gt, lt;
1717
+ for (const c of sub) {
1718
+ if (c.operator === ">" || c.operator === ">=") {
1719
+ gt = higherGT(gt, c, options);
1720
+ } else if (c.operator === "<" || c.operator === "<=") {
1721
+ lt = lowerLT(lt, c, options);
1722
+ } else {
1723
+ eqSet.add(c.semver);
1724
+ }
1725
+ }
1726
+ if (eqSet.size > 1) {
1727
+ return null;
1728
+ }
1729
+ let gtltComp;
1730
+ if (gt && lt) {
1731
+ gtltComp = compare(gt.semver, lt.semver, options);
1732
+ if (gtltComp > 0) {
1733
+ return null;
1734
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
1735
+ return null;
1736
+ }
1737
+ }
1738
+ for (const eq of eqSet) {
1739
+ if (gt && !satisfies(eq, String(gt), options)) {
1740
+ return null;
1741
+ }
1742
+ if (lt && !satisfies(eq, String(lt), options)) {
1743
+ return null;
1744
+ }
1745
+ for (const c of dom) {
1746
+ if (!satisfies(eq, String(c), options)) {
1747
+ return false;
1748
+ }
1749
+ }
1750
+ return true;
1751
+ }
1752
+ let higher, lower;
1753
+ let hasDomLT, hasDomGT;
1754
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
1755
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
1756
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
1757
+ needDomLTPre = false;
1758
+ }
1759
+ for (const c of dom) {
1760
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
1761
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
1762
+ if (gt) {
1763
+ if (needDomGTPre) {
1764
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
1765
+ needDomGTPre = false;
1766
+ }
1767
+ }
1768
+ if (c.operator === ">" || c.operator === ">=") {
1769
+ higher = higherGT(gt, c, options);
1770
+ if (higher === c && higher !== gt) {
1771
+ return false;
1772
+ }
1773
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
1774
+ return false;
1775
+ }
1776
+ }
1777
+ if (lt) {
1778
+ if (needDomLTPre) {
1779
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
1780
+ needDomLTPre = false;
1781
+ }
1782
+ }
1783
+ if (c.operator === "<" || c.operator === "<=") {
1784
+ lower = lowerLT(lt, c, options);
1785
+ if (lower === c && lower !== lt) {
1786
+ return false;
1787
+ }
1788
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
1789
+ return false;
1790
+ }
1791
+ }
1792
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
1793
+ return false;
1794
+ }
1795
+ }
1796
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
1797
+ return false;
1798
+ }
1799
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
1800
+ return false;
1801
+ }
1802
+ if (needDomGTPre || needDomLTPre) {
1803
+ return false;
1804
+ }
1805
+ return true;
1806
+ };
1807
+ var higherGT = (a, b, options) => {
1808
+ if (!a) {
1809
+ return b;
1810
+ }
1811
+ const comp = compare(a.semver, b.semver, options);
1812
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
1813
+ };
1814
+ var lowerLT = (a, b, options) => {
1815
+ if (!a) {
1816
+ return b;
1817
+ }
1818
+ const comp = compare(a.semver, b.semver, options);
1819
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
1820
+ };
1821
+ module.exports = subset;
1822
+ }
1823
+ });
1824
+
1825
+ // ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/index.js
1826
+ var require_semver2 = __commonJS({
1827
+ "../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/index.js"(exports, module) {
1828
+ "use strict";
1829
+ var internalRe = require_re();
1830
+ var constants = require_constants();
1831
+ var SemVer = require_semver();
1832
+ var identifiers = require_identifiers();
1833
+ var parse = require_parse();
1834
+ var valid = require_valid();
1835
+ var clean = require_clean();
1836
+ var inc = require_inc();
1837
+ var diff = require_diff();
1838
+ var major = require_major();
1839
+ var minor = require_minor();
1840
+ var patch = require_patch();
1841
+ var prerelease = require_prerelease();
1842
+ var compare = require_compare();
1843
+ var rcompare = require_rcompare();
1844
+ var compareLoose = require_compare_loose();
1845
+ var compareBuild = require_compare_build();
1846
+ var sort = require_sort();
1847
+ var rsort = require_rsort();
1848
+ var gt = require_gt();
1849
+ var lt = require_lt();
1850
+ var eq = require_eq();
1851
+ var neq = require_neq();
1852
+ var gte4 = require_gte();
1853
+ var lte = require_lte();
1854
+ var cmp = require_cmp();
1855
+ var coerce5 = require_coerce();
1856
+ var Comparator = require_comparator();
1857
+ var Range = require_range();
1858
+ var satisfies = require_satisfies();
1859
+ var toComparators = require_to_comparators();
1860
+ var maxSatisfying = require_max_satisfying();
1861
+ var minSatisfying = require_min_satisfying();
1862
+ var minVersion = require_min_version();
1863
+ var validRange = require_valid2();
1864
+ var outside = require_outside();
1865
+ var gtr = require_gtr();
1866
+ var ltr = require_ltr();
1867
+ var intersects = require_intersects();
1868
+ var simplifyRange = require_simplify();
1869
+ var subset = require_subset();
1870
+ module.exports = {
1871
+ parse,
1872
+ valid,
1873
+ clean,
1874
+ inc,
1875
+ diff,
1876
+ major,
1877
+ minor,
1878
+ patch,
1879
+ prerelease,
1880
+ compare,
1881
+ rcompare,
1882
+ compareLoose,
1883
+ compareBuild,
1884
+ sort,
1885
+ rsort,
1886
+ gt,
1887
+ lt,
1888
+ eq,
1889
+ neq,
1890
+ gte: gte4,
1891
+ lte,
1892
+ cmp,
1893
+ coerce: coerce5,
1894
+ Comparator,
1895
+ Range,
1896
+ satisfies,
1897
+ toComparators,
1898
+ maxSatisfying,
1899
+ minSatisfying,
1900
+ minVersion,
1901
+ validRange,
1902
+ outside,
1903
+ gtr,
1904
+ ltr,
1905
+ intersects,
1906
+ simplifyRange,
1907
+ subset,
1908
+ SemVer,
1909
+ re: internalRe.re,
1910
+ src: internalRe.src,
1911
+ tokens: internalRe.t,
1912
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
1913
+ RELEASE_TYPES: constants.RELEASE_TYPES,
1914
+ compareIdentifiers: identifiers.compareIdentifiers,
1915
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
1916
+ };
1917
+ }
1918
+ });
1919
+
1
1920
  // src/premint/premint-client.ts
2
1921
  import { decodeEventLog, zeroAddress as zeroAddress2 } from "viem";
3
1922
  import {
@@ -42,8 +1961,8 @@ import { parseAbi } from "viem";
42
1961
  var ZORA_API_BASE = "https://api.zora.co/";
43
1962
  var OPEN_EDITION_MINT_SIZE = BigInt("18446744073709551615");
44
1963
  var SUBGRAPH_CONFIG_BASE = "https://api.goldsky.com/api/public/project_clhk16b61ay9t49vm6ntn4mkz/subgraphs";
45
- function getSubgraph(name, version2) {
46
- return `${SUBGRAPH_CONFIG_BASE}/${name}/${version2}/gn`;
1964
+ function getSubgraph(name, version) {
1965
+ return `${SUBGRAPH_CONFIG_BASE}/${name}/${version}/gn`;
47
1966
  }
48
1967
  var zora721Abi = parseAbi([
49
1968
  "function mintWithRewards(address recipient, uint256 quantity, string calldata comment, address mintReferral) external payable",
@@ -381,7 +2300,7 @@ function migratePremintConfigToV2({
381
2300
  };
382
2301
  }
383
2302
  var recoverCreatorFromCreatorAttribution = async ({
384
- creatorAttribution: { version: version2, domainName, structHash, signature },
2303
+ creatorAttribution: { version, domainName, structHash, signature },
385
2304
  chainId,
386
2305
  tokenContract
387
2306
  }) => {
@@ -390,7 +2309,7 @@ var recoverCreatorFromCreatorAttribution = async ({
390
2309
  chainId,
391
2310
  name: domainName,
392
2311
  verifyingContract: tokenContract,
393
- version: version2
2312
+ version
394
2313
  },
395
2314
  types: {
396
2315
  EIP712Domain: [
@@ -426,11 +2345,11 @@ var supportedPremintVersions = async ({
426
2345
  });
427
2346
  };
428
2347
  var supportsPremintVersion = async ({
429
- version: version2,
2348
+ version,
430
2349
  tokenContract,
431
2350
  publicClient
432
2351
  }) => {
433
- return (await supportedPremintVersions({ tokenContract, publicClient })).includes(version2);
2352
+ return (await supportedPremintVersions({ tokenContract, publicClient })).includes(version);
434
2353
  };
435
2354
  async function getPremintCollectionAddress({
436
2355
  publicClient,
@@ -454,7 +2373,7 @@ async function getPremintCollectionAddress({
454
2373
  }
455
2374
  function applyUpdateToPremint({
456
2375
  uid,
457
- version: version2,
2376
+ version,
458
2377
  tokenConfig,
459
2378
  tokenConfigUpdates
460
2379
  }) {
@@ -465,7 +2384,7 @@ function applyUpdateToPremint({
465
2384
  const result = {
466
2385
  deleted: false,
467
2386
  uid,
468
- version: version2 + 1,
2387
+ version: version + 1,
469
2388
  tokenConfig: updatedTokenConfig
470
2389
  };
471
2390
  return result;
@@ -810,7 +2729,7 @@ function buildPremintsOfContractQuery({
810
2729
  }
811
2730
 
812
2731
  // src/mint/subgraph-mint-getter.ts
813
- import * as semver from "semver";
2732
+ var semver = __toESM(require_semver2(), 1);
814
2733
  var getApiNetworkConfigForChain = (chainId) => {
815
2734
  if (!networkConfigByChain[chainId]) {
816
2735
  throw new Error(`chain id ${chainId} network not configured `);
@@ -1664,7 +3583,7 @@ import {
1664
3583
  } from "@zoralabs/protocol-deployments";
1665
3584
 
1666
3585
  // src/mint/utils.ts
1667
- import * as semver2 from "semver";
3586
+ var semver2 = __toESM(require_semver2(), 1);
1668
3587
  var contractSupportsNewMintFunction = (contractVersion) => {
1669
3588
  if (!contractVersion) {
1670
3589
  return false;
@@ -2228,6 +4147,7 @@ async function getContractInfo({
2228
4147
  }
2229
4148
 
2230
4149
  // src/create/token-setup.ts
4150
+ var semver3 = __toESM(require_semver2(), 1);
2231
4151
  import {
2232
4152
  erc20MinterABI as erc20MinterABI2,
2233
4153
  erc20MinterAddress as erc20MinterAddresses,
@@ -2236,7 +4156,6 @@ import {
2236
4156
  zoraCreatorFixedPriceSaleStrategyAddress as zoraCreatorFixedPriceSaleStrategyAddress2
2237
4157
  } from "@zoralabs/protocol-deployments";
2238
4158
  import { encodeFunctionData, zeroAddress as zeroAddress5 } from "viem";
2239
- import * as semver3 from "semver";
2240
4159
  var PERMISSION_BITS = {
2241
4160
  MINTER: 2n ** 2n
2242
4161
  };
@@ -2626,7 +4545,7 @@ async function createNew1155Token({
2626
4545
  };
2627
4546
  }
2628
4547
 
2629
- // src/mints/mints-queries.ts
4548
+ // src/sparks/mints-queries.ts
2630
4549
  var getMintsAccountBalanceWithPriceQuery = (account) => {
2631
4550
  const query = `
2632
4551
  query GetMintAccountBalances($account: String!) {
@@ -2682,14 +4601,16 @@ var sumBalances = (mintAccountBalances) => {
2682
4601
  }, BigInt(0));
2683
4602
  };
2684
4603
 
2685
- // src/mints/mints-contracts.ts
4604
+ // src/sparks/sparks-contracts.ts
2686
4605
  import {
2687
4606
  mintsSafeTransferBatchTypedDataDefinition,
2688
4607
  mintsSafeTransferTypedDataDefinition,
2689
4608
  zoraMints1155Config,
2690
4609
  zoraMintsManagerImplABI,
2691
4610
  zoraMintsManagerImplAddress,
2692
- zoraMintsManagerImplConfig
4611
+ zoraMintsManagerImplConfig,
4612
+ zoraSparksManagerImplABI,
4613
+ zoraSparksManagerImplAddress
2693
4614
  } from "@zoralabs/protocol-deployments";
2694
4615
  import {
2695
4616
  decodeErrorResult,
@@ -2698,16 +4619,17 @@ import {
2698
4619
  } from "viem";
2699
4620
  var addressOrAccountAddress = (address) => typeof address === "string" ? address : address.address;
2700
4621
  var mintWithEthParams = ({
4622
+ tokenId,
2701
4623
  quantity,
2702
4624
  recipient,
2703
4625
  chainId,
2704
4626
  pricePerMint,
2705
4627
  account
2706
4628
  }) => makeContractParameters({
2707
- abi: zoraMintsManagerImplConfig.abi,
2708
- address: zoraMintsManagerImplConfig.address[chainId],
4629
+ abi: zoraSparksManagerImplABI,
4630
+ address: zoraSparksManagerImplAddress[chainId],
2709
4631
  functionName: "mintWithEth",
2710
- args: [quantity, recipient || addressOrAccountAddress(account)],
4632
+ args: [tokenId, quantity, recipient || addressOrAccountAddress(account)],
2711
4633
  value: pricePerMint * quantity,
2712
4634
  account
2713
4635
  });
@@ -2924,41 +4846,6 @@ function decodeCallFailedError(error) {
2924
4846
  });
2925
4847
  }
2926
4848
 
2927
- // src/mints/mints-eth-unwrapper-and-caller.ts
2928
- import {
2929
- iUnwrapAndForwardActionABI,
2930
- mintsEthUnwrapperAndCallerAddress
2931
- } from "@zoralabs/protocol-deployments";
2932
- import { encodeFunctionData as encodeFunctionData3 } from "viem";
2933
- var makeCallWithEthSafeTransferData = ({
2934
- address: addressToCall,
2935
- call: functionToCall,
2936
- value: valueToSend
2937
- }) => encodeFunctionData3({
2938
- abi: iUnwrapAndForwardActionABI,
2939
- functionName: "callWithEth",
2940
- args: [addressToCall, functionToCall, valueToSend]
2941
- });
2942
- var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
2943
- chainId,
2944
- tokenIds,
2945
- quantities,
2946
- from: from2,
2947
- callWithEth,
2948
- safeTransferData,
2949
- deadline,
2950
- nonce
2951
- }) => makePermitTransferBatchAndTypeData({
2952
- mintsOwner: from2,
2953
- chainId,
2954
- deadline,
2955
- tokenIds,
2956
- quantities,
2957
- safeTransferData: safeTransferData || makeCallWithEthSafeTransferData(callWithEth),
2958
- to: mintsEthUnwrapperAndCallerAddress[chainId],
2959
- nonce
2960
- });
2961
-
2962
4849
  // src/sdk.ts
2963
4850
  function createCreatorClient(clientConfig) {
2964
4851
  const premintClient = new PremintClient({
@@ -2996,91 +4883,16 @@ function createCollectorClient(params) {
2996
4883
  mint: (p) => mintClient.mint(p),
2997
4884
  getMintCosts: (p) => mintClient.getMintCosts(p)
2998
4885
  };
2999
- }
3000
-
3001
- // src/ipfs/arweave.ts
3002
- function isArweaveURL(url) {
3003
- return url && typeof url === "string" ? url.startsWith("ar://") : false;
3004
- }
3005
-
3006
- // ../../node_modules/multiformats/esm/vendor/varint.js
3007
- var encode_1 = encode;
3008
- var MSB = 128;
3009
- var REST = 127;
3010
- var MSBALL = ~REST;
3011
- var INT = Math.pow(2, 31);
3012
- function encode(num, out, offset) {
3013
- out = out || [];
3014
- offset = offset || 0;
3015
- var oldOffset = offset;
3016
- while (num >= INT) {
3017
- out[offset++] = num & 255 | MSB;
3018
- num /= 128;
3019
- }
3020
- while (num & MSBALL) {
3021
- out[offset++] = num & 255 | MSB;
3022
- num >>>= 7;
3023
- }
3024
- out[offset] = num | 0;
3025
- encode.bytes = offset - oldOffset + 1;
3026
- return out;
3027
- }
3028
- var decode = read;
3029
- var MSB$1 = 128;
3030
- var REST$1 = 127;
3031
- function read(buf, offset) {
3032
- var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
3033
- do {
3034
- if (counter >= l) {
3035
- read.bytes = 0;
3036
- throw new RangeError("Could not decode varint");
3037
- }
3038
- b = buf[counter++];
3039
- res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
3040
- shift += 7;
3041
- } while (b >= MSB$1);
3042
- read.bytes = counter - offset;
3043
- return res;
3044
- }
3045
- var N1 = Math.pow(2, 7);
3046
- var N2 = Math.pow(2, 14);
3047
- var N3 = Math.pow(2, 21);
3048
- var N4 = Math.pow(2, 28);
3049
- var N5 = Math.pow(2, 35);
3050
- var N6 = Math.pow(2, 42);
3051
- var N7 = Math.pow(2, 49);
3052
- var N8 = Math.pow(2, 56);
3053
- var N9 = Math.pow(2, 63);
3054
- var length = function(value) {
3055
- return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
3056
- };
3057
- var varint = {
3058
- encode: encode_1,
3059
- decode,
3060
- encodingLength: length
3061
- };
3062
- var _brrp_varint = varint;
3063
- var varint_default = _brrp_varint;
4886
+ }
3064
4887
 
3065
- // ../../node_modules/multiformats/esm/src/varint.js
3066
- var decode2 = (data, offset = 0) => {
3067
- const code = varint_default.decode(data, offset);
3068
- return [
3069
- code,
3070
- varint_default.decode.bytes
3071
- ];
3072
- };
3073
- var encodeTo = (int, target, offset = 0) => {
3074
- varint_default.encode(int, target, offset);
3075
- return target;
3076
- };
3077
- var encodingLength = (int) => {
3078
- return varint_default.encodingLength(int);
3079
- };
4888
+ // src/ipfs/arweave.ts
4889
+ function isArweaveURL(url) {
4890
+ return url && typeof url === "string" ? url.startsWith("ar://") : false;
4891
+ }
3080
4892
 
3081
- // ../../node_modules/multiformats/esm/src/bytes.js
4893
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bytes.js
3082
4894
  var empty = new Uint8Array(0);
3083
- var equals = (aa, bb) => {
4895
+ function equals(aa, bb) {
3084
4896
  if (aa === bb)
3085
4897
  return true;
3086
4898
  if (aa.byteLength !== bb.byteLength) {
@@ -3092,8 +4904,8 @@ var equals = (aa, bb) => {
3092
4904
  }
3093
4905
  }
3094
4906
  return true;
3095
- };
3096
- var coerce4 = (o) => {
4907
+ }
4908
+ function coerce4(o) {
3097
4909
  if (o instanceof Uint8Array && o.constructor.name === "Uint8Array")
3098
4910
  return o;
3099
4911
  if (o instanceof ArrayBuffer)
@@ -3102,46 +4914,9 @@ var coerce4 = (o) => {
3102
4914
  return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
3103
4915
  }
3104
4916
  throw new Error("Unknown type, must be binary type");
3105
- };
3106
-
3107
- // ../../node_modules/multiformats/esm/src/hashes/digest.js
3108
- var create = (code, digest) => {
3109
- const size = digest.byteLength;
3110
- const sizeOffset = encodingLength(code);
3111
- const digestOffset = sizeOffset + encodingLength(size);
3112
- const bytes = new Uint8Array(digestOffset + size);
3113
- encodeTo(code, bytes, 0);
3114
- encodeTo(size, bytes, sizeOffset);
3115
- bytes.set(digest, digestOffset);
3116
- return new Digest(code, size, digest, bytes);
3117
- };
3118
- var decode3 = (multihash) => {
3119
- const bytes = coerce4(multihash);
3120
- const [code, sizeOffset] = decode2(bytes);
3121
- const [size, digestOffset] = decode2(bytes.subarray(sizeOffset));
3122
- const digest = bytes.subarray(sizeOffset + digestOffset);
3123
- if (digest.byteLength !== size) {
3124
- throw new Error("Incorrect length");
3125
- }
3126
- return new Digest(code, size, digest, bytes);
3127
- };
3128
- var equals2 = (a, b) => {
3129
- if (a === b) {
3130
- return true;
3131
- } else {
3132
- return a.code === b.code && a.size === b.size && equals(a.bytes, b.bytes);
3133
- }
3134
- };
3135
- var Digest = class {
3136
- constructor(code, size, digest, bytes) {
3137
- this.code = code;
3138
- this.size = size;
3139
- this.digest = digest;
3140
- this.bytes = bytes;
3141
- }
3142
- };
4917
+ }
3143
4918
 
3144
- // ../../node_modules/multiformats/esm/vendor/base-x.js
4919
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/vendor/base-x.js
3145
4920
  function base2(ALPHABET, name) {
3146
4921
  if (ALPHABET.length >= 255) {
3147
4922
  throw new TypeError("Alphabet too long");
@@ -3277,9 +5052,12 @@ var src = base2;
3277
5052
  var _brrp__multiformats_scope_baseX = src;
3278
5053
  var base_x_default = _brrp__multiformats_scope_baseX;
3279
5054
 
3280
- // ../../node_modules/multiformats/esm/src/bases/base.js
5055
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bases/base.js
3281
5056
  var Encoder = class {
3282
5057
  constructor(name, prefix, baseEncode) {
5058
+ __publicField(this, "name");
5059
+ __publicField(this, "prefix");
5060
+ __publicField(this, "baseEncode");
3283
5061
  this.name = name;
3284
5062
  this.prefix = prefix;
3285
5063
  this.baseEncode = baseEncode;
@@ -3294,6 +5072,10 @@ var Encoder = class {
3294
5072
  };
3295
5073
  var Decoder = class {
3296
5074
  constructor(name, prefix, baseDecode) {
5075
+ __publicField(this, "name");
5076
+ __publicField(this, "prefix");
5077
+ __publicField(this, "baseDecode");
5078
+ __publicField(this, "prefixCodePoint");
3297
5079
  this.name = name;
3298
5080
  this.prefix = prefix;
3299
5081
  if (prefix.codePointAt(0) === void 0) {
@@ -3318,6 +5100,7 @@ var Decoder = class {
3318
5100
  };
3319
5101
  var ComposedDecoder = class {
3320
5102
  constructor(decoders) {
5103
+ __publicField(this, "decoders");
3321
5104
  this.decoders = decoders;
3322
5105
  }
3323
5106
  or(decoder) {
@@ -3326,19 +5109,27 @@ var ComposedDecoder = class {
3326
5109
  decode(input) {
3327
5110
  const prefix = input[0];
3328
5111
  const decoder = this.decoders[prefix];
3329
- if (decoder) {
5112
+ if (decoder != null) {
3330
5113
  return decoder.decode(input);
3331
5114
  } else {
3332
5115
  throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
3333
5116
  }
3334
5117
  }
3335
5118
  };
3336
- var or = (left, right) => new ComposedDecoder({
3337
- ...left.decoders || { [left.prefix]: left },
3338
- ...right.decoders || { [right.prefix]: right }
3339
- });
5119
+ function or(left, right) {
5120
+ return new ComposedDecoder({
5121
+ ...left.decoders ?? { [left.prefix]: left },
5122
+ ...right.decoders ?? { [right.prefix]: right }
5123
+ });
5124
+ }
3340
5125
  var Codec = class {
3341
5126
  constructor(name, prefix, baseEncode, baseDecode) {
5127
+ __publicField(this, "name");
5128
+ __publicField(this, "prefix");
5129
+ __publicField(this, "baseEncode");
5130
+ __publicField(this, "baseDecode");
5131
+ __publicField(this, "encoder");
5132
+ __publicField(this, "decoder");
3342
5133
  this.name = name;
3343
5134
  this.prefix = prefix;
3344
5135
  this.baseEncode = baseEncode;
@@ -3353,8 +5144,10 @@ var Codec = class {
3353
5144
  return this.decoder.decode(input);
3354
5145
  }
3355
5146
  };
3356
- var from = ({ name, prefix, encode: encode3, decode: decode5 }) => new Codec(name, prefix, encode3, decode5);
3357
- var baseX = ({ prefix, name, alphabet }) => {
5147
+ function from({ name, prefix, encode: encode3, decode: decode5 }) {
5148
+ return new Codec(name, prefix, encode3, decode5);
5149
+ }
5150
+ function baseX({ name, prefix, alphabet }) {
3358
5151
  const { encode: encode3, decode: decode5 } = base_x_default(alphabet, name);
3359
5152
  return from({
3360
5153
  prefix,
@@ -3362,8 +5155,8 @@ var baseX = ({ prefix, name, alphabet }) => {
3362
5155
  encode: encode3,
3363
5156
  decode: (text) => coerce4(decode5(text))
3364
5157
  });
3365
- };
3366
- var decode4 = (string, alphabet, bitsPerChar, name) => {
5158
+ }
5159
+ function decode(string, alphabet, bitsPerChar, name) {
3367
5160
  const codes = {};
3368
5161
  for (let i = 0; i < alphabet.length; ++i) {
3369
5162
  codes[alphabet[i]] = i;
@@ -3388,12 +5181,12 @@ var decode4 = (string, alphabet, bitsPerChar, name) => {
3388
5181
  out[written++] = 255 & buffer >> bits;
3389
5182
  }
3390
5183
  }
3391
- if (bits >= bitsPerChar || 255 & buffer << 8 - bits) {
5184
+ if (bits >= bitsPerChar || (255 & buffer << 8 - bits) !== 0) {
3392
5185
  throw new SyntaxError("Unexpected end of data");
3393
5186
  }
3394
5187
  return out;
3395
- };
3396
- var encode2 = (data, alphabet, bitsPerChar) => {
5188
+ }
5189
+ function encode(data, alphabet, bitsPerChar) {
3397
5190
  const pad = alphabet[alphabet.length - 1] === "=";
3398
5191
  const mask = (1 << bitsPerChar) - 1;
3399
5192
  let out = "";
@@ -3407,42 +5200,30 @@ var encode2 = (data, alphabet, bitsPerChar) => {
3407
5200
  out += alphabet[mask & buffer >> bits];
3408
5201
  }
3409
5202
  }
3410
- if (bits) {
5203
+ if (bits !== 0) {
3411
5204
  out += alphabet[mask & buffer << bitsPerChar - bits];
3412
5205
  }
3413
5206
  if (pad) {
3414
- while (out.length * bitsPerChar & 7) {
5207
+ while ((out.length * bitsPerChar & 7) !== 0) {
3415
5208
  out += "=";
3416
5209
  }
3417
5210
  }
3418
5211
  return out;
3419
- };
3420
- var rfc4648 = ({ name, prefix, bitsPerChar, alphabet }) => {
5212
+ }
5213
+ function rfc4648({ name, prefix, bitsPerChar, alphabet }) {
3421
5214
  return from({
3422
5215
  prefix,
3423
5216
  name,
3424
5217
  encode(input) {
3425
- return encode2(input, alphabet, bitsPerChar);
5218
+ return encode(input, alphabet, bitsPerChar);
3426
5219
  },
3427
5220
  decode(input) {
3428
- return decode4(input, alphabet, bitsPerChar, name);
5221
+ return decode(input, alphabet, bitsPerChar, name);
3429
5222
  }
3430
5223
  });
3431
- };
3432
-
3433
- // ../../node_modules/multiformats/esm/src/bases/base58.js
3434
- var base58btc = baseX({
3435
- name: "base58btc",
3436
- prefix: "z",
3437
- alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
3438
- });
3439
- var base58flickr = baseX({
3440
- name: "base58flickr",
3441
- prefix: "Z",
3442
- alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
3443
- });
5224
+ }
3444
5225
 
3445
- // ../../node_modules/multiformats/esm/src/bases/base32.js
5226
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bases/base32.js
3446
5227
  var base32 = rfc4648({
3447
5228
  prefix: "b",
3448
5229
  name: "base32",
@@ -3498,34 +5279,198 @@ var base32z = rfc4648({
3498
5279
  bitsPerChar: 5
3499
5280
  });
3500
5281
 
3501
- // ../../node_modules/multiformats/esm/src/cid.js
5282
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bases/base58.js
5283
+ var base58btc = baseX({
5284
+ name: "base58btc",
5285
+ prefix: "z",
5286
+ alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
5287
+ });
5288
+ var base58flickr = baseX({
5289
+ name: "base58flickr",
5290
+ prefix: "Z",
5291
+ alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
5292
+ });
5293
+
5294
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/vendor/varint.js
5295
+ var encode_1 = encode2;
5296
+ var MSB = 128;
5297
+ var REST = 127;
5298
+ var MSBALL = ~REST;
5299
+ var INT = Math.pow(2, 31);
5300
+ function encode2(num, out, offset) {
5301
+ out = out || [];
5302
+ offset = offset || 0;
5303
+ var oldOffset = offset;
5304
+ while (num >= INT) {
5305
+ out[offset++] = num & 255 | MSB;
5306
+ num /= 128;
5307
+ }
5308
+ while (num & MSBALL) {
5309
+ out[offset++] = num & 255 | MSB;
5310
+ num >>>= 7;
5311
+ }
5312
+ out[offset] = num | 0;
5313
+ encode2.bytes = offset - oldOffset + 1;
5314
+ return out;
5315
+ }
5316
+ var decode2 = read;
5317
+ var MSB$1 = 128;
5318
+ var REST$1 = 127;
5319
+ function read(buf, offset) {
5320
+ var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
5321
+ do {
5322
+ if (counter >= l) {
5323
+ read.bytes = 0;
5324
+ throw new RangeError("Could not decode varint");
5325
+ }
5326
+ b = buf[counter++];
5327
+ res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
5328
+ shift += 7;
5329
+ } while (b >= MSB$1);
5330
+ read.bytes = counter - offset;
5331
+ return res;
5332
+ }
5333
+ var N1 = Math.pow(2, 7);
5334
+ var N2 = Math.pow(2, 14);
5335
+ var N3 = Math.pow(2, 21);
5336
+ var N4 = Math.pow(2, 28);
5337
+ var N5 = Math.pow(2, 35);
5338
+ var N6 = Math.pow(2, 42);
5339
+ var N7 = Math.pow(2, 49);
5340
+ var N8 = Math.pow(2, 56);
5341
+ var N9 = Math.pow(2, 63);
5342
+ var length = function(value) {
5343
+ return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
5344
+ };
5345
+ var varint = {
5346
+ encode: encode_1,
5347
+ decode: decode2,
5348
+ encodingLength: length
5349
+ };
5350
+ var _brrp_varint = varint;
5351
+ var varint_default = _brrp_varint;
5352
+
5353
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/varint.js
5354
+ function decode3(data, offset = 0) {
5355
+ const code = varint_default.decode(data, offset);
5356
+ return [code, varint_default.decode.bytes];
5357
+ }
5358
+ function encodeTo(int, target, offset = 0) {
5359
+ varint_default.encode(int, target, offset);
5360
+ return target;
5361
+ }
5362
+ function encodingLength(int) {
5363
+ return varint_default.encodingLength(int);
5364
+ }
5365
+
5366
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/hashes/digest.js
5367
+ function create(code, digest) {
5368
+ const size = digest.byteLength;
5369
+ const sizeOffset = encodingLength(code);
5370
+ const digestOffset = sizeOffset + encodingLength(size);
5371
+ const bytes = new Uint8Array(digestOffset + size);
5372
+ encodeTo(code, bytes, 0);
5373
+ encodeTo(size, bytes, sizeOffset);
5374
+ bytes.set(digest, digestOffset);
5375
+ return new Digest(code, size, digest, bytes);
5376
+ }
5377
+ function decode4(multihash) {
5378
+ const bytes = coerce4(multihash);
5379
+ const [code, sizeOffset] = decode3(bytes);
5380
+ const [size, digestOffset] = decode3(bytes.subarray(sizeOffset));
5381
+ const digest = bytes.subarray(sizeOffset + digestOffset);
5382
+ if (digest.byteLength !== size) {
5383
+ throw new Error("Incorrect length");
5384
+ }
5385
+ return new Digest(code, size, digest, bytes);
5386
+ }
5387
+ function equals2(a, b) {
5388
+ if (a === b) {
5389
+ return true;
5390
+ } else {
5391
+ const data = b;
5392
+ return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals(a.bytes, data.bytes);
5393
+ }
5394
+ }
5395
+ var Digest = class {
5396
+ /**
5397
+ * Creates a multihash digest.
5398
+ */
5399
+ constructor(code, size, digest, bytes) {
5400
+ __publicField(this, "code");
5401
+ __publicField(this, "size");
5402
+ __publicField(this, "digest");
5403
+ __publicField(this, "bytes");
5404
+ this.code = code;
5405
+ this.size = size;
5406
+ this.digest = digest;
5407
+ this.bytes = bytes;
5408
+ }
5409
+ };
5410
+
5411
+ // ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/cid.js
5412
+ function format(link, base3) {
5413
+ const { bytes, version } = link;
5414
+ switch (version) {
5415
+ case 0:
5416
+ return toStringV0(bytes, baseCache(link), base3 ?? base58btc.encoder);
5417
+ default:
5418
+ return toStringV1(bytes, baseCache(link), base3 ?? base32.encoder);
5419
+ }
5420
+ }
5421
+ var cache = /* @__PURE__ */ new WeakMap();
5422
+ function baseCache(cid) {
5423
+ const baseCache2 = cache.get(cid);
5424
+ if (baseCache2 == null) {
5425
+ const baseCache3 = /* @__PURE__ */ new Map();
5426
+ cache.set(cid, baseCache3);
5427
+ return baseCache3;
5428
+ }
5429
+ return baseCache2;
5430
+ }
5431
+ var _a;
3502
5432
  var CID = class _CID {
3503
- constructor(version2, code, multihash, bytes) {
5433
+ /**
5434
+ * @param version - Version of the CID
5435
+ * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
5436
+ * @param multihash - (Multi)hash of the of the content.
5437
+ */
5438
+ constructor(version, code, multihash, bytes) {
5439
+ __publicField(this, "code");
5440
+ __publicField(this, "version");
5441
+ __publicField(this, "multihash");
5442
+ __publicField(this, "bytes");
5443
+ __publicField(this, "/");
5444
+ __publicField(this, _a, "CID");
3504
5445
  this.code = code;
3505
- this.version = version2;
5446
+ this.version = version;
3506
5447
  this.multihash = multihash;
3507
5448
  this.bytes = bytes;
3508
- this.byteOffset = bytes.byteOffset;
3509
- this.byteLength = bytes.byteLength;
3510
- this.asCID = this;
3511
- this._baseCache = /* @__PURE__ */ new Map();
3512
- Object.defineProperties(this, {
3513
- byteOffset: hidden,
3514
- byteLength: hidden,
3515
- code: readonly,
3516
- version: readonly,
3517
- multihash: readonly,
3518
- bytes: readonly,
3519
- _baseCache: hidden,
3520
- asCID: hidden
3521
- });
5449
+ this["/"] = bytes;
5450
+ }
5451
+ /**
5452
+ * Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
5453
+ * please either use `CID.asCID(cid)` or switch to new signalling mechanism
5454
+ *
5455
+ * @deprecated
5456
+ */
5457
+ get asCID() {
5458
+ return this;
5459
+ }
5460
+ // ArrayBufferView
5461
+ get byteOffset() {
5462
+ return this.bytes.byteOffset;
5463
+ }
5464
+ // ArrayBufferView
5465
+ get byteLength() {
5466
+ return this.bytes.byteLength;
3522
5467
  }
3523
5468
  toV0() {
3524
5469
  switch (this.version) {
3525
5470
  case 0: {
3526
5471
  return this;
3527
5472
  }
3528
- default: {
5473
+ case 1: {
3529
5474
  const { code, multihash } = this;
3530
5475
  if (code !== DAG_PB_CODE) {
3531
5476
  throw new Error("Cannot convert a non dag-pb CID to CIDv0");
@@ -3535,6 +5480,9 @@ var CID = class _CID {
3535
5480
  }
3536
5481
  return _CID.createV0(multihash);
3537
5482
  }
5483
+ default: {
5484
+ throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
5485
+ }
3538
5486
  }
3539
5487
  }
3540
5488
  toV1() {
@@ -3548,102 +5496,125 @@ var CID = class _CID {
3548
5496
  return this;
3549
5497
  }
3550
5498
  default: {
3551
- throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
5499
+ throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);
3552
5500
  }
3553
5501
  }
3554
5502
  }
3555
5503
  equals(other) {
3556
- return other && this.code === other.code && this.version === other.version && equals2(this.multihash, other.multihash);
5504
+ return _CID.equals(this, other);
5505
+ }
5506
+ static equals(self, other) {
5507
+ const unknown = other;
5508
+ return unknown != null && self.code === unknown.code && self.version === unknown.version && equals2(self.multihash, unknown.multihash);
3557
5509
  }
3558
5510
  toString(base3) {
3559
- const { bytes, version: version2, _baseCache } = this;
3560
- switch (version2) {
3561
- case 0:
3562
- return toStringV0(bytes, _baseCache, base3 || base58btc.encoder);
3563
- default:
3564
- return toStringV1(bytes, _baseCache, base3 || base32.encoder);
3565
- }
5511
+ return format(this, base3);
3566
5512
  }
3567
5513
  toJSON() {
3568
- return {
3569
- code: this.code,
3570
- version: this.version,
3571
- hash: this.multihash.bytes
3572
- };
3573
- }
3574
- get [Symbol.toStringTag]() {
3575
- return "CID";
3576
- }
3577
- [Symbol.for("nodejs.util.inspect.custom")]() {
3578
- return "CID(" + this.toString() + ")";
3579
- }
3580
- static isCID(value) {
3581
- deprecate(/^0\.0/, IS_CID_DEPRECATION);
3582
- return !!(value && (value[cidSymbol] || value.asCID === value));
3583
- }
3584
- get toBaseEncodedString() {
3585
- throw new Error("Deprecated, use .toString()");
3586
- }
3587
- get codec() {
3588
- throw new Error('"codec" property is deprecated, use integer "code" property instead');
5514
+ return { "/": format(this) };
3589
5515
  }
3590
- get buffer() {
3591
- throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead");
5516
+ link() {
5517
+ return this;
3592
5518
  }
3593
- get multibaseName() {
3594
- throw new Error('"multibaseName" property is deprecated');
5519
+ // Legacy
5520
+ [(_a = Symbol.toStringTag, Symbol.for("nodejs.util.inspect.custom"))]() {
5521
+ return `CID(${this.toString()})`;
3595
5522
  }
3596
- get prefix() {
3597
- throw new Error('"prefix" property is deprecated');
3598
- }
3599
- static asCID(value) {
5523
+ /**
5524
+ * Takes any input `value` and returns a `CID` instance if it was
5525
+ * a `CID` otherwise returns `null`. If `value` is instanceof `CID`
5526
+ * it will return value back. If `value` is not instance of this CID
5527
+ * class, but is compatible CID it will return new instance of this
5528
+ * `CID` class. Otherwise returns null.
5529
+ *
5530
+ * This allows two different incompatible versions of CID library to
5531
+ * co-exist and interop as long as binary interface is compatible.
5532
+ */
5533
+ static asCID(input) {
5534
+ if (input == null) {
5535
+ return null;
5536
+ }
5537
+ const value = input;
3600
5538
  if (value instanceof _CID) {
3601
5539
  return value;
3602
- } else if (value != null && value.asCID === value) {
3603
- const { version: version2, code, multihash, bytes } = value;
3604
- return new _CID(version2, code, multihash, bytes || encodeCID(version2, code, multihash.bytes));
3605
- } else if (value != null && value[cidSymbol] === true) {
3606
- const { version: version2, multihash, code } = value;
3607
- const digest = decode3(multihash);
3608
- return _CID.create(version2, code, digest);
5540
+ } else if (value["/"] != null && value["/"] === value.bytes || value.asCID === value) {
5541
+ const { version, code, multihash, bytes } = value;
5542
+ return new _CID(version, code, multihash, bytes ?? encodeCID(version, code, multihash.bytes));
5543
+ } else if (value[cidSymbol] === true) {
5544
+ const { version, multihash, code } = value;
5545
+ const digest = decode4(multihash);
5546
+ return _CID.create(version, code, digest);
3609
5547
  } else {
3610
5548
  return null;
3611
5549
  }
3612
5550
  }
3613
- static create(version2, code, digest) {
5551
+ /**
5552
+ * @param version - Version of the CID
5553
+ * @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
5554
+ * @param digest - (Multi)hash of the of the content.
5555
+ */
5556
+ static create(version, code, digest) {
3614
5557
  if (typeof code !== "number") {
3615
5558
  throw new Error("String codecs are no longer supported");
3616
5559
  }
3617
- switch (version2) {
5560
+ if (!(digest.bytes instanceof Uint8Array)) {
5561
+ throw new Error("Invalid digest");
5562
+ }
5563
+ switch (version) {
3618
5564
  case 0: {
3619
5565
  if (code !== DAG_PB_CODE) {
3620
5566
  throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
3621
5567
  } else {
3622
- return new _CID(version2, code, digest, digest.bytes);
5568
+ return new _CID(version, code, digest, digest.bytes);
3623
5569
  }
3624
5570
  }
3625
5571
  case 1: {
3626
- const bytes = encodeCID(version2, code, digest.bytes);
3627
- return new _CID(version2, code, digest, bytes);
5572
+ const bytes = encodeCID(version, code, digest.bytes);
5573
+ return new _CID(version, code, digest, bytes);
3628
5574
  }
3629
5575
  default: {
3630
5576
  throw new Error("Invalid version");
3631
5577
  }
3632
5578
  }
3633
5579
  }
5580
+ /**
5581
+ * Simplified version of `create` for CIDv0.
5582
+ */
3634
5583
  static createV0(digest) {
3635
5584
  return _CID.create(0, DAG_PB_CODE, digest);
3636
5585
  }
5586
+ /**
5587
+ * Simplified version of `create` for CIDv1.
5588
+ *
5589
+ * @param code - Content encoding format code.
5590
+ * @param digest - Multihash of the content.
5591
+ */
3637
5592
  static createV1(code, digest) {
3638
5593
  return _CID.create(1, code, digest);
3639
5594
  }
5595
+ /**
5596
+ * Decoded a CID from its binary representation. The byte array must contain
5597
+ * only the CID with no additional bytes.
5598
+ *
5599
+ * An error will be thrown if the bytes provided do not contain a valid
5600
+ * binary representation of a CID.
5601
+ */
3640
5602
  static decode(bytes) {
3641
5603
  const [cid, remainder] = _CID.decodeFirst(bytes);
3642
- if (remainder.length) {
5604
+ if (remainder.length !== 0) {
3643
5605
  throw new Error("Incorrect length");
3644
5606
  }
3645
5607
  return cid;
3646
5608
  }
5609
+ /**
5610
+ * Decoded a CID from its binary representation at the beginning of a byte
5611
+ * array.
5612
+ *
5613
+ * Returns an array with the first element containing the CID and the second
5614
+ * element containing the remainder of the original byte array. The remainder
5615
+ * will be a zero-length byte array if the provided bytes only contained a
5616
+ * binary CID representation.
5617
+ */
3647
5618
  static decodeFirst(bytes) {
3648
5619
  const specs = _CID.inspectBytes(bytes);
3649
5620
  const prefixSize = specs.size - specs.multihashSize;
@@ -3654,154 +5625,120 @@ var CID = class _CID {
3654
5625
  const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
3655
5626
  const digest = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
3656
5627
  const cid = specs.version === 0 ? _CID.createV0(digest) : _CID.createV1(specs.codec, digest);
3657
- return [
3658
- cid,
3659
- bytes.subarray(specs.size)
3660
- ];
5628
+ return [cid, bytes.subarray(specs.size)];
3661
5629
  }
5630
+ /**
5631
+ * Inspect the initial bytes of a CID to determine its properties.
5632
+ *
5633
+ * Involves decoding up to 4 varints. Typically this will require only 4 to 6
5634
+ * bytes but for larger multicodec code values and larger multihash digest
5635
+ * lengths these varints can be quite large. It is recommended that at least
5636
+ * 10 bytes be made available in the `initialBytes` argument for a complete
5637
+ * inspection.
5638
+ */
3662
5639
  static inspectBytes(initialBytes) {
3663
5640
  let offset = 0;
3664
5641
  const next = () => {
3665
- const [i, length2] = decode2(initialBytes.subarray(offset));
5642
+ const [i, length2] = decode3(initialBytes.subarray(offset));
3666
5643
  offset += length2;
3667
5644
  return i;
3668
5645
  };
3669
- let version2 = next();
5646
+ let version = next();
3670
5647
  let codec = DAG_PB_CODE;
3671
- if (version2 === 18) {
3672
- version2 = 0;
5648
+ if (version === 18) {
5649
+ version = 0;
3673
5650
  offset = 0;
3674
- } else if (version2 === 1) {
5651
+ } else {
3675
5652
  codec = next();
3676
5653
  }
3677
- if (version2 !== 0 && version2 !== 1) {
3678
- throw new RangeError(`Invalid CID version ${version2}`);
5654
+ if (version !== 0 && version !== 1) {
5655
+ throw new RangeError(`Invalid CID version ${version}`);
3679
5656
  }
3680
5657
  const prefixSize = offset;
3681
5658
  const multihashCode = next();
3682
5659
  const digestSize = next();
3683
5660
  const size = offset + digestSize;
3684
5661
  const multihashSize = size - prefixSize;
3685
- return {
3686
- version: version2,
3687
- codec,
3688
- multihashCode,
3689
- digestSize,
3690
- multihashSize,
3691
- size
3692
- };
5662
+ return { version, codec, multihashCode, digestSize, multihashSize, size };
3693
5663
  }
5664
+ /**
5665
+ * Takes cid in a string representation and creates an instance. If `base`
5666
+ * decoder is not provided will use a default from the configuration. It will
5667
+ * throw an error if encoding of the CID is not compatible with supplied (or
5668
+ * a default decoder).
5669
+ */
3694
5670
  static parse(source, base3) {
3695
5671
  const [prefix, bytes] = parseCIDtoBytes(source, base3);
3696
5672
  const cid = _CID.decode(bytes);
3697
- cid._baseCache.set(prefix, source);
5673
+ if (cid.version === 0 && source[0] !== "Q") {
5674
+ throw Error("Version 0 CID string must not include multibase prefix");
5675
+ }
5676
+ baseCache(cid).set(prefix, source);
3698
5677
  return cid;
3699
5678
  }
3700
5679
  };
3701
- var parseCIDtoBytes = (source, base3) => {
5680
+ function parseCIDtoBytes(source, base3) {
3702
5681
  switch (source[0]) {
3703
5682
  case "Q": {
3704
- const decoder = base3 || base58btc;
5683
+ const decoder = base3 ?? base58btc;
3705
5684
  return [
3706
5685
  base58btc.prefix,
3707
5686
  decoder.decode(`${base58btc.prefix}${source}`)
3708
5687
  ];
3709
5688
  }
3710
5689
  case base58btc.prefix: {
3711
- const decoder = base3 || base58btc;
3712
- return [
3713
- base58btc.prefix,
3714
- decoder.decode(source)
3715
- ];
5690
+ const decoder = base3 ?? base58btc;
5691
+ return [base58btc.prefix, decoder.decode(source)];
3716
5692
  }
3717
5693
  case base32.prefix: {
3718
- const decoder = base3 || base32;
3719
- return [
3720
- base32.prefix,
3721
- decoder.decode(source)
3722
- ];
5694
+ const decoder = base3 ?? base32;
5695
+ return [base32.prefix, decoder.decode(source)];
3723
5696
  }
3724
5697
  default: {
3725
5698
  if (base3 == null) {
3726
5699
  throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");
3727
5700
  }
3728
- return [
3729
- source[0],
3730
- base3.decode(source)
3731
- ];
5701
+ return [source[0], base3.decode(source)];
3732
5702
  }
3733
5703
  }
3734
- };
3735
- var toStringV0 = (bytes, cache, base3) => {
5704
+ }
5705
+ function toStringV0(bytes, cache2, base3) {
3736
5706
  const { prefix } = base3;
3737
5707
  if (prefix !== base58btc.prefix) {
3738
5708
  throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
3739
5709
  }
3740
- const cid = cache.get(prefix);
5710
+ const cid = cache2.get(prefix);
3741
5711
  if (cid == null) {
3742
5712
  const cid2 = base3.encode(bytes).slice(1);
3743
- cache.set(prefix, cid2);
5713
+ cache2.set(prefix, cid2);
3744
5714
  return cid2;
3745
5715
  } else {
3746
5716
  return cid;
3747
5717
  }
3748
- };
3749
- var toStringV1 = (bytes, cache, base3) => {
5718
+ }
5719
+ function toStringV1(bytes, cache2, base3) {
3750
5720
  const { prefix } = base3;
3751
- const cid = cache.get(prefix);
5721
+ const cid = cache2.get(prefix);
3752
5722
  if (cid == null) {
3753
5723
  const cid2 = base3.encode(bytes);
3754
- cache.set(prefix, cid2);
5724
+ cache2.set(prefix, cid2);
3755
5725
  return cid2;
3756
5726
  } else {
3757
5727
  return cid;
3758
5728
  }
3759
- };
5729
+ }
3760
5730
  var DAG_PB_CODE = 112;
3761
5731
  var SHA_256_CODE = 18;
3762
- var encodeCID = (version2, code, multihash) => {
3763
- const codeOffset = encodingLength(version2);
5732
+ function encodeCID(version, code, multihash) {
5733
+ const codeOffset = encodingLength(version);
3764
5734
  const hashOffset = codeOffset + encodingLength(code);
3765
5735
  const bytes = new Uint8Array(hashOffset + multihash.byteLength);
3766
- encodeTo(version2, bytes, 0);
5736
+ encodeTo(version, bytes, 0);
3767
5737
  encodeTo(code, bytes, codeOffset);
3768
5738
  bytes.set(multihash, hashOffset);
3769
5739
  return bytes;
3770
- };
3771
- var cidSymbol = Symbol.for("@ipld/js-cid/CID");
3772
- var readonly = {
3773
- writable: false,
3774
- configurable: false,
3775
- enumerable: true
3776
- };
3777
- var hidden = {
3778
- writable: false,
3779
- enumerable: false,
3780
- configurable: false
3781
- };
3782
- var version = "0.0.0-dev";
3783
- var deprecate = (range, message) => {
3784
- if (range.test(version)) {
3785
- console.warn(message);
3786
- } else {
3787
- throw new Error(message);
3788
- }
3789
- };
3790
- var IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release.
3791
- Following code pattern:
3792
-
3793
- if (CID.isCID(value)) {
3794
- doSomethingWithCID(value)
3795
- }
3796
-
3797
- Is replaced with:
3798
-
3799
- const cid = CID.asCID(value)
3800
- if (cid) {
3801
- // Make sure to use cid instead of value
3802
- doSomethingWithCID(cid)
3803
5740
  }
3804
- `;
5741
+ var cidSymbol = Symbol.for("@ipld/js-cid/CID");
3805
5742
 
3806
5743
  // src/ipfs/ipfs.ts
3807
5744
  function isCID(str) {
@@ -4187,7 +6124,6 @@ export {
4187
6124
  isPremintConfigV1,
4188
6125
  isPremintConfigV2,
4189
6126
  isValidSignature,
4190
- makeCallWithEthSafeTransferData,
4191
6127
  makeMediaTokenMetadata,
4192
6128
  makeMintRewardsRecipient,
4193
6129
  makeNewPremint,
@@ -4206,7 +6142,6 @@ export {
4206
6142
  supportedPremintVersions,
4207
6143
  supportsPremintVersion,
4208
6144
  toContractCreationConfigOrAddress,
4209
- tryRecoverPremintSigner,
4210
- unwrapAndForwardEthPermitAndTypedDataDefinition
6145
+ tryRecoverPremintSigner
4211
6146
  };
4212
6147
  //# sourceMappingURL=index.js.map