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