langchain-stripe-loader 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2671 @@
1
+ class Ft {
2
+ constructor(r = !1) {
3
+ this.debug = r;
4
+ }
5
+ log(r) {
6
+ this.debug && console.log(r);
7
+ }
8
+ error(r) {
9
+ console.error(r);
10
+ }
11
+ warn(r) {
12
+ this.debug && console.warn(r);
13
+ }
14
+ }
15
+ class wt {
16
+ /**
17
+ * Constructor for SitemapProcessor
18
+ * @param options Configuration options
19
+ */
20
+ constructor(r = {}) {
21
+ this.debug = r.debug ?? !1, this.logger = r.logger ?? new Ft(this.debug);
22
+ }
23
+ /**
24
+ * Log a message if debug mode is enabled
25
+ * @param message Message to log
26
+ */
27
+ log(r) {
28
+ this.logger.log(r);
29
+ }
30
+ /**
31
+ * Log an error message
32
+ * @param message Error message to log
33
+ */
34
+ logError(r) {
35
+ this.logger.error(r);
36
+ }
37
+ /**
38
+ * Log a warning message
39
+ * @param message Warning message to log
40
+ */
41
+ logWarning(r) {
42
+ this.logger.warn(r);
43
+ }
44
+ /**
45
+ * Extract URLs from a sitemap
46
+ * @param content Sitemap XML content
47
+ * @param baseUrl Base URL part to extract (e.g., https://docs.stripe.com/)
48
+ * @returns Array of extracted URLs
49
+ */
50
+ extractUrlsFromSitemap(r, t = "https://docs.stripe.com/") {
51
+ const n = new RegExp(`<loc>(${t}[^<]+)</loc>`, "g"), a = [];
52
+ let l;
53
+ for (; (l = n.exec(r)) !== null; )
54
+ a.push(l[1]);
55
+ return a;
56
+ }
57
+ /**
58
+ * Extract sitemap URLs from a sitemap index
59
+ * @param content Sitemap index XML content
60
+ * @returns Array of extracted sitemap URLs
61
+ */
62
+ extractSitemapUrlsFromIndex(r) {
63
+ if (!r || typeof r != "string")
64
+ return this.logError("Invalid input: content must be a string"), [];
65
+ if (!r.includes("<?xml") || !r.includes("<sitemapindex"))
66
+ return this.logError("Invalid sitemap index XML: Missing <?xml or <sitemapindex> elements."), [];
67
+ try {
68
+ const t = /<loc>([^<]+)<\/loc>/g, n = [];
69
+ let a;
70
+ for (; (a = t.exec(r)) !== null; ) {
71
+ const l = a[1];
72
+ try {
73
+ new URL(l), n.push(l);
74
+ } catch {
75
+ this.logWarning(`Skipped invalid URL format: ${l}`);
76
+ }
77
+ }
78
+ return n.length === 0 && this.logWarning("No valid URLs found in sitemap index"), n;
79
+ } catch (t) {
80
+ return this.logError(`Error extracting URLs from sitemap index: ${t}`), [];
81
+ }
82
+ }
83
+ /**
84
+ * Find newly added URLs
85
+ * @param currentUrls Current URL list
86
+ * @param previousUrls Previous URL list
87
+ * @returns Array of newly added URLs
88
+ */
89
+ findNewUrls(r, t) {
90
+ const n = new Set(t);
91
+ return r.filter((a) => !n.has(a));
92
+ }
93
+ /**
94
+ * Fetch and process a sitemap
95
+ * @param url Sitemap URL
96
+ * @param baseUrl Base URL part to extract
97
+ * @returns List of retrieved URLs
98
+ */
99
+ async fetchAndProcessSitemap(r, t) {
100
+ const n = await fetch(r);
101
+ if (!n.ok)
102
+ throw new Error(`Failed to fetch sitemap: ${n.status} ${n.statusText}`);
103
+ const a = await n.text();
104
+ return this.extractUrlsFromSitemap(a, t);
105
+ }
106
+ /**
107
+ * Fetch and process a sitemap index
108
+ * @param indexUrl Sitemap index URL
109
+ * @param baseUrl Base URL part to extract
110
+ * @returns List of retrieved URLs
111
+ */
112
+ async fetchAndProcessSitemapIndex(r, t) {
113
+ this.log(`Fetching sitemap index: ${r}`);
114
+ const n = await fetch(r);
115
+ if (!n.ok)
116
+ throw new Error(`Failed to fetch sitemap index: ${n.status} ${n.statusText}`);
117
+ const a = await n.text(), l = this.extractSitemapUrlsFromIndex(a);
118
+ this.log(`Number of sitemap partitions: ${l.length}`);
119
+ const u = [];
120
+ for (let o = 0; o < l.length; o++) {
121
+ const s = l[o];
122
+ this.log(`Processing partition ${o + 1}/${l.length}: ${s}`);
123
+ const h = await this.fetchAndProcessSitemap(s, t);
124
+ this.log(`Retrieved ${h.length} URLs from partition ${o + 1}`), u.push(...h);
125
+ }
126
+ return u;
127
+ }
128
+ }
129
+ class $t {
130
+ /**
131
+ * @deprecated Use `this.load()` and `splitter.splitDocuments()` individually.
132
+ * Loads the documents and splits them using a specified text splitter.
133
+ * @param textSplitter The TextSplitter instance to use for splitting the loaded documents. Defaults to a RecursiveCharacterTextSplitter instance.
134
+ * @returns A Promise that resolves with an array of Document instances, each split according to the provided TextSplitter.
135
+ */
136
+ async loadAndSplit(r) {
137
+ if (r === void 0)
138
+ throw new Error("You must pass a text splitter to use this method.");
139
+ const t = await this.load();
140
+ return r.invoke(t);
141
+ }
142
+ }
143
+ class Tt {
144
+ constructor(r) {
145
+ Object.defineProperty(this, "pageContent", {
146
+ enumerable: !0,
147
+ configurable: !0,
148
+ writable: !0,
149
+ value: void 0
150
+ }), Object.defineProperty(this, "metadata", {
151
+ enumerable: !0,
152
+ configurable: !0,
153
+ writable: !0,
154
+ value: void 0
155
+ }), Object.defineProperty(this, "id", {
156
+ enumerable: !0,
157
+ configurable: !0,
158
+ writable: !0,
159
+ value: void 0
160
+ }), this.pageContent = r.pageContent !== void 0 ? r.pageContent.toString() : "", this.metadata = r.metadata ?? {}, this.id = r.id;
161
+ }
162
+ }
163
+ function Ut(e) {
164
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
165
+ }
166
+ var V = { exports: {} }, ce = {}, fe, gr;
167
+ function Bt() {
168
+ if (gr) return fe;
169
+ gr = 1;
170
+ function e(r, t) {
171
+ typeof t == "boolean" && (t = { forever: t }), this._originalTimeouts = JSON.parse(JSON.stringify(r)), this._timeouts = r, this._options = t || {}, this._maxRetryTime = t && t.maxRetryTime || 1 / 0, this._fn = null, this._errors = [], this._attempts = 1, this._operationTimeout = null, this._operationTimeoutCb = null, this._timeout = null, this._operationStart = null, this._timer = null, this._options.forever && (this._cachedTimeouts = this._timeouts.slice(0));
172
+ }
173
+ return fe = e, e.prototype.reset = function() {
174
+ this._attempts = 1, this._timeouts = this._originalTimeouts.slice(0);
175
+ }, e.prototype.stop = function() {
176
+ this._timeout && clearTimeout(this._timeout), this._timer && clearTimeout(this._timer), this._timeouts = [], this._cachedTimeouts = null;
177
+ }, e.prototype.retry = function(r) {
178
+ if (this._timeout && clearTimeout(this._timeout), !r)
179
+ return !1;
180
+ var t = (/* @__PURE__ */ new Date()).getTime();
181
+ if (r && t - this._operationStart >= this._maxRetryTime)
182
+ return this._errors.push(r), this._errors.unshift(new Error("RetryOperation timeout occurred")), !1;
183
+ this._errors.push(r);
184
+ var n = this._timeouts.shift();
185
+ if (n === void 0)
186
+ if (this._cachedTimeouts)
187
+ this._errors.splice(0, this._errors.length - 1), n = this._cachedTimeouts.slice(-1);
188
+ else
189
+ return !1;
190
+ var a = this;
191
+ return this._timer = setTimeout(function() {
192
+ a._attempts++, a._operationTimeoutCb && (a._timeout = setTimeout(function() {
193
+ a._operationTimeoutCb(a._attempts);
194
+ }, a._operationTimeout), a._options.unref && a._timeout.unref()), a._fn(a._attempts);
195
+ }, n), this._options.unref && this._timer.unref(), !0;
196
+ }, e.prototype.attempt = function(r, t) {
197
+ this._fn = r, t && (t.timeout && (this._operationTimeout = t.timeout), t.cb && (this._operationTimeoutCb = t.cb));
198
+ var n = this;
199
+ this._operationTimeoutCb && (this._timeout = setTimeout(function() {
200
+ n._operationTimeoutCb();
201
+ }, n._operationTimeout)), this._operationStart = (/* @__PURE__ */ new Date()).getTime(), this._fn(this._attempts);
202
+ }, e.prototype.try = function(r) {
203
+ console.log("Using RetryOperation.try() is deprecated"), this.attempt(r);
204
+ }, e.prototype.start = function(r) {
205
+ console.log("Using RetryOperation.start() is deprecated"), this.attempt(r);
206
+ }, e.prototype.start = e.prototype.try, e.prototype.errors = function() {
207
+ return this._errors;
208
+ }, e.prototype.attempts = function() {
209
+ return this._attempts;
210
+ }, e.prototype.mainError = function() {
211
+ if (this._errors.length === 0)
212
+ return null;
213
+ for (var r = {}, t = null, n = 0, a = 0; a < this._errors.length; a++) {
214
+ var l = this._errors[a], u = l.message, o = (r[u] || 0) + 1;
215
+ r[u] = o, o >= n && (t = l, n = o);
216
+ }
217
+ return t;
218
+ }, fe;
219
+ }
220
+ var Rr;
221
+ function kt() {
222
+ return Rr || (Rr = 1, function(e) {
223
+ var r = Bt();
224
+ e.operation = function(t) {
225
+ var n = e.timeouts(t);
226
+ return new r(n, {
227
+ forever: t && (t.forever || t.retries === 1 / 0),
228
+ unref: t && t.unref,
229
+ maxRetryTime: t && t.maxRetryTime
230
+ });
231
+ }, e.timeouts = function(t) {
232
+ if (t instanceof Array)
233
+ return [].concat(t);
234
+ var n = {
235
+ retries: 10,
236
+ factor: 2,
237
+ minTimeout: 1 * 1e3,
238
+ maxTimeout: 1 / 0,
239
+ randomize: !1
240
+ };
241
+ for (var a in t)
242
+ n[a] = t[a];
243
+ if (n.minTimeout > n.maxTimeout)
244
+ throw new Error("minTimeout is greater than maxTimeout");
245
+ for (var l = [], u = 0; u < n.retries; u++)
246
+ l.push(this.createTimeout(u, n));
247
+ return t && t.forever && !l.length && l.push(this.createTimeout(u, n)), l.sort(function(o, s) {
248
+ return o - s;
249
+ }), l;
250
+ }, e.createTimeout = function(t, n) {
251
+ var a = n.randomize ? Math.random() + 1 : 1, l = Math.round(a * Math.max(n.minTimeout, 1) * Math.pow(n.factor, t));
252
+ return l = Math.min(l, n.maxTimeout), l;
253
+ }, e.wrap = function(t, n, a) {
254
+ if (n instanceof Array && (a = n, n = null), !a) {
255
+ a = [];
256
+ for (var l in t)
257
+ typeof t[l] == "function" && a.push(l);
258
+ }
259
+ for (var u = 0; u < a.length; u++) {
260
+ var o = a[u], s = t[o];
261
+ t[o] = (function(i) {
262
+ var f = e.operation(n), c = Array.prototype.slice.call(arguments, 1), p = c.pop();
263
+ c.push(function(d) {
264
+ f.retry(d) || (d && (arguments[0] = f.mainError()), p.apply(this, arguments));
265
+ }), f.attempt(function() {
266
+ i.apply(t, c);
267
+ });
268
+ }).bind(t, s), t[o].options = n;
269
+ }
270
+ };
271
+ }(ce)), ce;
272
+ }
273
+ var he, yr;
274
+ function Gt() {
275
+ return yr || (yr = 1, he = kt()), he;
276
+ }
277
+ var _r;
278
+ function Mt() {
279
+ if (_r) return V.exports;
280
+ _r = 1;
281
+ const e = Gt(), r = [
282
+ "Failed to fetch",
283
+ // Chrome
284
+ "NetworkError when attempting to fetch resource.",
285
+ // Firefox
286
+ "The Internet connection appears to be offline.",
287
+ // Safari
288
+ "Network request failed"
289
+ // `cross-fetch`
290
+ ];
291
+ class t extends Error {
292
+ constructor(o) {
293
+ super(), o instanceof Error ? (this.originalError = o, { message: o } = o) : (this.originalError = new Error(o), this.originalError.stack = this.stack), this.name = "AbortError", this.message = o;
294
+ }
295
+ }
296
+ const n = (u, o, s) => {
297
+ const h = s.retries - (o - 1);
298
+ return u.attemptNumber = o, u.retriesLeft = h, u;
299
+ }, a = (u) => r.includes(u), l = (u, o) => new Promise((s, h) => {
300
+ o = {
301
+ onFailedAttempt: () => {
302
+ },
303
+ retries: 10,
304
+ ...o
305
+ };
306
+ const i = e.operation(o);
307
+ i.attempt(async (f) => {
308
+ try {
309
+ s(await u(f));
310
+ } catch (c) {
311
+ if (!(c instanceof Error)) {
312
+ h(new TypeError(`Non-error was thrown: "${c}". You should only throw errors.`));
313
+ return;
314
+ }
315
+ if (c instanceof t)
316
+ i.stop(), h(c.originalError);
317
+ else if (c instanceof TypeError && !a(c.message))
318
+ i.stop(), h(c);
319
+ else {
320
+ n(c, f, o);
321
+ try {
322
+ await o.onFailedAttempt(c);
323
+ } catch (p) {
324
+ h(p);
325
+ return;
326
+ }
327
+ i.retry(c) || h(i.mainError());
328
+ }
329
+ }
330
+ });
331
+ });
332
+ return V.exports = l, V.exports.default = l, V.exports.AbortError = t, V.exports;
333
+ }
334
+ Mt();
335
+ var z = {}, pe = { exports: {} }, Ir;
336
+ function jt() {
337
+ return Ir || (Ir = 1, function(e) {
338
+ var r = Object.prototype.hasOwnProperty, t = "~";
339
+ function n() {
340
+ }
341
+ Object.create && (n.prototype = /* @__PURE__ */ Object.create(null), new n().__proto__ || (t = !1));
342
+ function a(s, h, i) {
343
+ this.fn = s, this.context = h, this.once = i || !1;
344
+ }
345
+ function l(s, h, i, f, c) {
346
+ if (typeof i != "function")
347
+ throw new TypeError("The listener must be a function");
348
+ var p = new a(i, f || s, c), d = t ? t + h : h;
349
+ return s._events[d] ? s._events[d].fn ? s._events[d] = [s._events[d], p] : s._events[d].push(p) : (s._events[d] = p, s._eventsCount++), s;
350
+ }
351
+ function u(s, h) {
352
+ --s._eventsCount === 0 ? s._events = new n() : delete s._events[h];
353
+ }
354
+ function o() {
355
+ this._events = new n(), this._eventsCount = 0;
356
+ }
357
+ o.prototype.eventNames = function() {
358
+ var h = [], i, f;
359
+ if (this._eventsCount === 0) return h;
360
+ for (f in i = this._events)
361
+ r.call(i, f) && h.push(t ? f.slice(1) : f);
362
+ return Object.getOwnPropertySymbols ? h.concat(Object.getOwnPropertySymbols(i)) : h;
363
+ }, o.prototype.listeners = function(h) {
364
+ var i = t ? t + h : h, f = this._events[i];
365
+ if (!f) return [];
366
+ if (f.fn) return [f.fn];
367
+ for (var c = 0, p = f.length, d = new Array(p); c < p; c++)
368
+ d[c] = f[c].fn;
369
+ return d;
370
+ }, o.prototype.listenerCount = function(h) {
371
+ var i = t ? t + h : h, f = this._events[i];
372
+ return f ? f.fn ? 1 : f.length : 0;
373
+ }, o.prototype.emit = function(h, i, f, c, p, d) {
374
+ var m = t ? t + h : h;
375
+ if (!this._events[m]) return !1;
376
+ var E = this._events[m], y = arguments.length, L, R;
377
+ if (E.fn) {
378
+ switch (E.once && this.removeListener(h, E.fn, void 0, !0), y) {
379
+ case 1:
380
+ return E.fn.call(E.context), !0;
381
+ case 2:
382
+ return E.fn.call(E.context, i), !0;
383
+ case 3:
384
+ return E.fn.call(E.context, i, f), !0;
385
+ case 4:
386
+ return E.fn.call(E.context, i, f, c), !0;
387
+ case 5:
388
+ return E.fn.call(E.context, i, f, c, p), !0;
389
+ case 6:
390
+ return E.fn.call(E.context, i, f, c, p, d), !0;
391
+ }
392
+ for (R = 1, L = new Array(y - 1); R < y; R++)
393
+ L[R - 1] = arguments[R];
394
+ E.fn.apply(E.context, L);
395
+ } else {
396
+ var q = E.length, b;
397
+ for (R = 0; R < q; R++)
398
+ switch (E[R].once && this.removeListener(h, E[R].fn, void 0, !0), y) {
399
+ case 1:
400
+ E[R].fn.call(E[R].context);
401
+ break;
402
+ case 2:
403
+ E[R].fn.call(E[R].context, i);
404
+ break;
405
+ case 3:
406
+ E[R].fn.call(E[R].context, i, f);
407
+ break;
408
+ case 4:
409
+ E[R].fn.call(E[R].context, i, f, c);
410
+ break;
411
+ default:
412
+ if (!L) for (b = 1, L = new Array(y - 1); b < y; b++)
413
+ L[b - 1] = arguments[b];
414
+ E[R].fn.apply(E[R].context, L);
415
+ }
416
+ }
417
+ return !0;
418
+ }, o.prototype.on = function(h, i, f) {
419
+ return l(this, h, i, f, !1);
420
+ }, o.prototype.once = function(h, i, f) {
421
+ return l(this, h, i, f, !0);
422
+ }, o.prototype.removeListener = function(h, i, f, c) {
423
+ var p = t ? t + h : h;
424
+ if (!this._events[p]) return this;
425
+ if (!i)
426
+ return u(this, p), this;
427
+ var d = this._events[p];
428
+ if (d.fn)
429
+ d.fn === i && (!c || d.once) && (!f || d.context === f) && u(this, p);
430
+ else {
431
+ for (var m = 0, E = [], y = d.length; m < y; m++)
432
+ (d[m].fn !== i || c && !d[m].once || f && d[m].context !== f) && E.push(d[m]);
433
+ E.length ? this._events[p] = E.length === 1 ? E[0] : E : u(this, p);
434
+ }
435
+ return this;
436
+ }, o.prototype.removeAllListeners = function(h) {
437
+ var i;
438
+ return h ? (i = t ? t + h : h, this._events[i] && u(this, i)) : (this._events = new n(), this._eventsCount = 0), this;
439
+ }, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = t, o.EventEmitter = o, e.exports = o;
440
+ }(pe)), pe.exports;
441
+ }
442
+ var X = { exports: {} }, me, wr;
443
+ function Vt() {
444
+ return wr || (wr = 1, me = (e, r) => (r = r || (() => {
445
+ }), e.then(
446
+ (t) => new Promise((n) => {
447
+ n(r());
448
+ }).then(() => t),
449
+ (t) => new Promise((n) => {
450
+ n(r());
451
+ }).then(() => {
452
+ throw t;
453
+ })
454
+ ))), me;
455
+ }
456
+ var $r;
457
+ function Xt() {
458
+ if ($r) return X.exports;
459
+ $r = 1;
460
+ const e = Vt();
461
+ class r extends Error {
462
+ constructor(a) {
463
+ super(a), this.name = "TimeoutError";
464
+ }
465
+ }
466
+ const t = (n, a, l) => new Promise((u, o) => {
467
+ if (typeof a != "number" || a < 0)
468
+ throw new TypeError("Expected `milliseconds` to be a positive number");
469
+ if (a === 1 / 0) {
470
+ u(n);
471
+ return;
472
+ }
473
+ const s = setTimeout(() => {
474
+ if (typeof l == "function") {
475
+ try {
476
+ u(l());
477
+ } catch (f) {
478
+ o(f);
479
+ }
480
+ return;
481
+ }
482
+ const h = typeof l == "string" ? l : `Promise timed out after ${a} milliseconds`, i = l instanceof Error ? l : new r(h);
483
+ typeof n.cancel == "function" && n.cancel(), o(i);
484
+ }, a);
485
+ e(
486
+ // eslint-disable-next-line promise/prefer-await-to-then
487
+ n.then(u, o),
488
+ () => {
489
+ clearTimeout(s);
490
+ }
491
+ );
492
+ });
493
+ return X.exports = t, X.exports.default = t, X.exports.TimeoutError = r, X.exports;
494
+ }
495
+ var Y = {}, Q = {}, Tr;
496
+ function Ht() {
497
+ if (Tr) return Q;
498
+ Tr = 1, Object.defineProperty(Q, "__esModule", { value: !0 });
499
+ function e(r, t, n) {
500
+ let a = 0, l = r.length;
501
+ for (; l > 0; ) {
502
+ const u = l / 2 | 0;
503
+ let o = a + u;
504
+ n(r[o], t) <= 0 ? (a = ++o, l -= u + 1) : l = u;
505
+ }
506
+ return a;
507
+ }
508
+ return Q.default = e, Q;
509
+ }
510
+ var Ar;
511
+ function Wt() {
512
+ if (Ar) return Y;
513
+ Ar = 1, Object.defineProperty(Y, "__esModule", { value: !0 });
514
+ const e = Ht();
515
+ class r {
516
+ constructor() {
517
+ this._queue = [];
518
+ }
519
+ enqueue(n, a) {
520
+ a = Object.assign({ priority: 0 }, a);
521
+ const l = {
522
+ priority: a.priority,
523
+ run: n
524
+ };
525
+ if (this.size && this._queue[this.size - 1].priority >= a.priority) {
526
+ this._queue.push(l);
527
+ return;
528
+ }
529
+ const u = e.default(this._queue, l, (o, s) => s.priority - o.priority);
530
+ this._queue.splice(u, 0, l);
531
+ }
532
+ dequeue() {
533
+ const n = this._queue.shift();
534
+ return n == null ? void 0 : n.run;
535
+ }
536
+ filter(n) {
537
+ return this._queue.filter((a) => a.priority === n.priority).map((a) => a.run);
538
+ }
539
+ get size() {
540
+ return this._queue.length;
541
+ }
542
+ }
543
+ return Y.default = r, Y;
544
+ }
545
+ var Sr;
546
+ function zt() {
547
+ if (Sr) return z;
548
+ Sr = 1, Object.defineProperty(z, "__esModule", { value: !0 });
549
+ const e = jt(), r = Xt(), t = Wt(), n = () => {
550
+ }, a = new r.TimeoutError();
551
+ class l extends e {
552
+ constructor(o) {
553
+ var s, h, i, f;
554
+ if (super(), this._intervalCount = 0, this._intervalEnd = 0, this._pendingCount = 0, this._resolveEmpty = n, this._resolveIdle = n, o = Object.assign({ carryoverConcurrencyCount: !1, intervalCap: 1 / 0, interval: 0, concurrency: 1 / 0, autoStart: !0, queueClass: t.default }, o), !(typeof o.intervalCap == "number" && o.intervalCap >= 1))
555
+ throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(h = (s = o.intervalCap) === null || s === void 0 ? void 0 : s.toString()) !== null && h !== void 0 ? h : ""}\` (${typeof o.intervalCap})`);
556
+ if (o.interval === void 0 || !(Number.isFinite(o.interval) && o.interval >= 0))
557
+ throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(f = (i = o.interval) === null || i === void 0 ? void 0 : i.toString()) !== null && f !== void 0 ? f : ""}\` (${typeof o.interval})`);
558
+ this._carryoverConcurrencyCount = o.carryoverConcurrencyCount, this._isIntervalIgnored = o.intervalCap === 1 / 0 || o.interval === 0, this._intervalCap = o.intervalCap, this._interval = o.interval, this._queue = new o.queueClass(), this._queueClass = o.queueClass, this.concurrency = o.concurrency, this._timeout = o.timeout, this._throwOnTimeout = o.throwOnTimeout === !0, this._isPaused = o.autoStart === !1;
559
+ }
560
+ get _doesIntervalAllowAnother() {
561
+ return this._isIntervalIgnored || this._intervalCount < this._intervalCap;
562
+ }
563
+ get _doesConcurrentAllowAnother() {
564
+ return this._pendingCount < this._concurrency;
565
+ }
566
+ _next() {
567
+ this._pendingCount--, this._tryToStartAnother(), this.emit("next");
568
+ }
569
+ _resolvePromises() {
570
+ this._resolveEmpty(), this._resolveEmpty = n, this._pendingCount === 0 && (this._resolveIdle(), this._resolveIdle = n, this.emit("idle"));
571
+ }
572
+ _onResumeInterval() {
573
+ this._onInterval(), this._initializeIntervalIfNeeded(), this._timeoutId = void 0;
574
+ }
575
+ _isIntervalPaused() {
576
+ const o = Date.now();
577
+ if (this._intervalId === void 0) {
578
+ const s = this._intervalEnd - o;
579
+ if (s < 0)
580
+ this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
581
+ else
582
+ return this._timeoutId === void 0 && (this._timeoutId = setTimeout(() => {
583
+ this._onResumeInterval();
584
+ }, s)), !0;
585
+ }
586
+ return !1;
587
+ }
588
+ _tryToStartAnother() {
589
+ if (this._queue.size === 0)
590
+ return this._intervalId && clearInterval(this._intervalId), this._intervalId = void 0, this._resolvePromises(), !1;
591
+ if (!this._isPaused) {
592
+ const o = !this._isIntervalPaused();
593
+ if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {
594
+ const s = this._queue.dequeue();
595
+ return s ? (this.emit("active"), s(), o && this._initializeIntervalIfNeeded(), !0) : !1;
596
+ }
597
+ }
598
+ return !1;
599
+ }
600
+ _initializeIntervalIfNeeded() {
601
+ this._isIntervalIgnored || this._intervalId !== void 0 || (this._intervalId = setInterval(() => {
602
+ this._onInterval();
603
+ }, this._interval), this._intervalEnd = Date.now() + this._interval);
604
+ }
605
+ _onInterval() {
606
+ this._intervalCount === 0 && this._pendingCount === 0 && this._intervalId && (clearInterval(this._intervalId), this._intervalId = void 0), this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0, this._processQueue();
607
+ }
608
+ /**
609
+ Executes all queued functions until it reaches the limit.
610
+ */
611
+ _processQueue() {
612
+ for (; this._tryToStartAnother(); )
613
+ ;
614
+ }
615
+ get concurrency() {
616
+ return this._concurrency;
617
+ }
618
+ set concurrency(o) {
619
+ if (!(typeof o == "number" && o >= 1))
620
+ throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${o}\` (${typeof o})`);
621
+ this._concurrency = o, this._processQueue();
622
+ }
623
+ /**
624
+ Adds a sync or async task to the queue. Always returns a promise.
625
+ */
626
+ async add(o, s = {}) {
627
+ return new Promise((h, i) => {
628
+ const f = async () => {
629
+ this._pendingCount++, this._intervalCount++;
630
+ try {
631
+ const c = this._timeout === void 0 && s.timeout === void 0 ? o() : r.default(Promise.resolve(o()), s.timeout === void 0 ? this._timeout : s.timeout, () => {
632
+ (s.throwOnTimeout === void 0 ? this._throwOnTimeout : s.throwOnTimeout) && i(a);
633
+ });
634
+ h(await c);
635
+ } catch (c) {
636
+ i(c);
637
+ }
638
+ this._next();
639
+ };
640
+ this._queue.enqueue(f, s), this._tryToStartAnother(), this.emit("add");
641
+ });
642
+ }
643
+ /**
644
+ Same as `.add()`, but accepts an array of sync or async functions.
645
+
646
+ @returns A promise that resolves when all functions are resolved.
647
+ */
648
+ async addAll(o, s) {
649
+ return Promise.all(o.map(async (h) => this.add(h, s)));
650
+ }
651
+ /**
652
+ Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
653
+ */
654
+ start() {
655
+ return this._isPaused ? (this._isPaused = !1, this._processQueue(), this) : this;
656
+ }
657
+ /**
658
+ Put queue execution on hold.
659
+ */
660
+ pause() {
661
+ this._isPaused = !0;
662
+ }
663
+ /**
664
+ Clear the queue.
665
+ */
666
+ clear() {
667
+ this._queue = new this._queueClass();
668
+ }
669
+ /**
670
+ Can be called multiple times. Useful if you for example add additional items at a later time.
671
+
672
+ @returns A promise that settles when the queue becomes empty.
673
+ */
674
+ async onEmpty() {
675
+ if (this._queue.size !== 0)
676
+ return new Promise((o) => {
677
+ const s = this._resolveEmpty;
678
+ this._resolveEmpty = () => {
679
+ s(), o();
680
+ };
681
+ });
682
+ }
683
+ /**
684
+ The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
685
+
686
+ @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
687
+ */
688
+ async onIdle() {
689
+ if (!(this._pendingCount === 0 && this._queue.size === 0))
690
+ return new Promise((o) => {
691
+ const s = this._resolveIdle;
692
+ this._resolveIdle = () => {
693
+ s(), o();
694
+ };
695
+ });
696
+ }
697
+ /**
698
+ Size of the queue.
699
+ */
700
+ get size() {
701
+ return this._queue.size;
702
+ }
703
+ /**
704
+ Size of the queue, filtered by the given options.
705
+
706
+ For example, this can be used to find the number of items remaining in the queue with a specific priority level.
707
+ */
708
+ sizeBy(o) {
709
+ return this._queue.filter(o).length;
710
+ }
711
+ /**
712
+ Number of pending promises.
713
+ */
714
+ get pending() {
715
+ return this._pendingCount;
716
+ }
717
+ /**
718
+ Whether the queue is currently paused.
719
+ */
720
+ get isPaused() {
721
+ return this._isPaused;
722
+ }
723
+ get timeout() {
724
+ return this._timeout;
725
+ }
726
+ /**
727
+ Set the timeout for future operations.
728
+ */
729
+ set timeout(o) {
730
+ this._timeout = o;
731
+ }
732
+ }
733
+ return z.default = l, z;
734
+ }
735
+ zt();
736
+ var K = { exports: {} }, de, Lr;
737
+ function re() {
738
+ if (Lr) return de;
739
+ Lr = 1;
740
+ const e = "2.0.0", r = 256, t = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
741
+ 9007199254740991, n = 16, a = r - 6;
742
+ return de = {
743
+ MAX_LENGTH: r,
744
+ MAX_SAFE_COMPONENT_LENGTH: n,
745
+ MAX_SAFE_BUILD_LENGTH: a,
746
+ MAX_SAFE_INTEGER: t,
747
+ RELEASE_TYPES: [
748
+ "major",
749
+ "premajor",
750
+ "minor",
751
+ "preminor",
752
+ "patch",
753
+ "prepatch",
754
+ "prerelease"
755
+ ],
756
+ SEMVER_SPEC_VERSION: e,
757
+ FLAG_INCLUDE_PRERELEASE: 1,
758
+ FLAG_LOOSE: 2
759
+ }, de;
760
+ }
761
+ var Ee, Nr;
762
+ function te() {
763
+ return Nr || (Nr = 1, Ee = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...r) => console.error("SEMVER", ...r) : () => {
764
+ }), Ee;
765
+ }
766
+ var Cr;
767
+ function W() {
768
+ return Cr || (Cr = 1, function(e, r) {
769
+ const {
770
+ MAX_SAFE_COMPONENT_LENGTH: t,
771
+ MAX_SAFE_BUILD_LENGTH: n,
772
+ MAX_LENGTH: a
773
+ } = re(), l = te();
774
+ r = e.exports = {};
775
+ const u = r.re = [], o = r.safeRe = [], s = r.src = [], h = r.safeSrc = [], i = r.t = {};
776
+ let f = 0;
777
+ const c = "[a-zA-Z0-9-]", p = [
778
+ ["\\s", 1],
779
+ ["\\d", a],
780
+ [c, n]
781
+ ], d = (E) => {
782
+ for (const [y, L] of p)
783
+ E = E.split(`${y}*`).join(`${y}{0,${L}}`).split(`${y}+`).join(`${y}{1,${L}}`);
784
+ return E;
785
+ }, m = (E, y, L) => {
786
+ const R = d(y), q = f++;
787
+ l(E, q, y), i[E] = q, s[q] = y, h[q] = R, u[q] = new RegExp(y, L ? "g" : void 0), o[q] = new RegExp(R, L ? "g" : void 0);
788
+ };
789
+ m("NUMERICIDENTIFIER", "0|[1-9]\\d*"), m("NUMERICIDENTIFIERLOOSE", "\\d+"), m("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${c}*`), m("MAINVERSION", `(${s[i.NUMERICIDENTIFIER]})\\.(${s[i.NUMERICIDENTIFIER]})\\.(${s[i.NUMERICIDENTIFIER]})`), m("MAINVERSIONLOOSE", `(${s[i.NUMERICIDENTIFIERLOOSE]})\\.(${s[i.NUMERICIDENTIFIERLOOSE]})\\.(${s[i.NUMERICIDENTIFIERLOOSE]})`), m("PRERELEASEIDENTIFIER", `(?:${s[i.NUMERICIDENTIFIER]}|${s[i.NONNUMERICIDENTIFIER]})`), m("PRERELEASEIDENTIFIERLOOSE", `(?:${s[i.NUMERICIDENTIFIERLOOSE]}|${s[i.NONNUMERICIDENTIFIER]})`), m("PRERELEASE", `(?:-(${s[i.PRERELEASEIDENTIFIER]}(?:\\.${s[i.PRERELEASEIDENTIFIER]})*))`), m("PRERELEASELOOSE", `(?:-?(${s[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${s[i.PRERELEASEIDENTIFIERLOOSE]})*))`), m("BUILDIDENTIFIER", `${c}+`), m("BUILD", `(?:\\+(${s[i.BUILDIDENTIFIER]}(?:\\.${s[i.BUILDIDENTIFIER]})*))`), m("FULLPLAIN", `v?${s[i.MAINVERSION]}${s[i.PRERELEASE]}?${s[i.BUILD]}?`), m("FULL", `^${s[i.FULLPLAIN]}$`), m("LOOSEPLAIN", `[v=\\s]*${s[i.MAINVERSIONLOOSE]}${s[i.PRERELEASELOOSE]}?${s[i.BUILD]}?`), m("LOOSE", `^${s[i.LOOSEPLAIN]}$`), m("GTLT", "((?:<|>)?=?)"), m("XRANGEIDENTIFIERLOOSE", `${s[i.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), m("XRANGEIDENTIFIER", `${s[i.NUMERICIDENTIFIER]}|x|X|\\*`), m("XRANGEPLAIN", `[v=\\s]*(${s[i.XRANGEIDENTIFIER]})(?:\\.(${s[i.XRANGEIDENTIFIER]})(?:\\.(${s[i.XRANGEIDENTIFIER]})(?:${s[i.PRERELEASE]})?${s[i.BUILD]}?)?)?`), m("XRANGEPLAINLOOSE", `[v=\\s]*(${s[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${s[i.XRANGEIDENTIFIERLOOSE]})(?:${s[i.PRERELEASELOOSE]})?${s[i.BUILD]}?)?)?`), m("XRANGE", `^${s[i.GTLT]}\\s*${s[i.XRANGEPLAIN]}$`), m("XRANGELOOSE", `^${s[i.GTLT]}\\s*${s[i.XRANGEPLAINLOOSE]}$`), m("COERCEPLAIN", `(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`), m("COERCE", `${s[i.COERCEPLAIN]}(?:$|[^\\d])`), m("COERCEFULL", s[i.COERCEPLAIN] + `(?:${s[i.PRERELEASE]})?(?:${s[i.BUILD]})?(?:$|[^\\d])`), m("COERCERTL", s[i.COERCE], !0), m("COERCERTLFULL", s[i.COERCEFULL], !0), m("LONETILDE", "(?:~>?)"), m("TILDETRIM", `(\\s*)${s[i.LONETILDE]}\\s+`, !0), r.tildeTrimReplace = "$1~", m("TILDE", `^${s[i.LONETILDE]}${s[i.XRANGEPLAIN]}$`), m("TILDELOOSE", `^${s[i.LONETILDE]}${s[i.XRANGEPLAINLOOSE]}$`), m("LONECARET", "(?:\\^)"), m("CARETTRIM", `(\\s*)${s[i.LONECARET]}\\s+`, !0), r.caretTrimReplace = "$1^", m("CARET", `^${s[i.LONECARET]}${s[i.XRANGEPLAIN]}$`), m("CARETLOOSE", `^${s[i.LONECARET]}${s[i.XRANGEPLAINLOOSE]}$`), m("COMPARATORLOOSE", `^${s[i.GTLT]}\\s*(${s[i.LOOSEPLAIN]})$|^$`), m("COMPARATOR", `^${s[i.GTLT]}\\s*(${s[i.FULLPLAIN]})$|^$`), m("COMPARATORTRIM", `(\\s*)${s[i.GTLT]}\\s*(${s[i.LOOSEPLAIN]}|${s[i.XRANGEPLAIN]})`, !0), r.comparatorTrimReplace = "$1$2$3", m("HYPHENRANGE", `^\\s*(${s[i.XRANGEPLAIN]})\\s+-\\s+(${s[i.XRANGEPLAIN]})\\s*$`), m("HYPHENRANGELOOSE", `^\\s*(${s[i.XRANGEPLAINLOOSE]})\\s+-\\s+(${s[i.XRANGEPLAINLOOSE]})\\s*$`), m("STAR", "(<|>)?=?\\s*\\*"), m("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), m("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
790
+ }(K, K.exports)), K.exports;
791
+ }
792
+ var ve, Or;
793
+ function lr() {
794
+ if (Or) return ve;
795
+ Or = 1;
796
+ const e = Object.freeze({ loose: !0 }), r = Object.freeze({});
797
+ return ve = (n) => n ? typeof n != "object" ? e : n : r, ve;
798
+ }
799
+ var ge, br;
800
+ function At() {
801
+ if (br) return ge;
802
+ br = 1;
803
+ const e = /^[0-9]+$/, r = (n, a) => {
804
+ const l = e.test(n), u = e.test(a);
805
+ return l && u && (n = +n, a = +a), n === a ? 0 : l && !u ? -1 : u && !l ? 1 : n < a ? -1 : 1;
806
+ };
807
+ return ge = {
808
+ compareIdentifiers: r,
809
+ rcompareIdentifiers: (n, a) => r(a, n)
810
+ }, ge;
811
+ }
812
+ var Re, Pr;
813
+ function U() {
814
+ if (Pr) return Re;
815
+ Pr = 1;
816
+ const e = te(), { MAX_LENGTH: r, MAX_SAFE_INTEGER: t } = re(), { safeRe: n, safeSrc: a, t: l } = W(), u = lr(), { compareIdentifiers: o } = At();
817
+ class s {
818
+ constructor(i, f) {
819
+ if (f = u(f), i instanceof s) {
820
+ if (i.loose === !!f.loose && i.includePrerelease === !!f.includePrerelease)
821
+ return i;
822
+ i = i.version;
823
+ } else if (typeof i != "string")
824
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof i}".`);
825
+ if (i.length > r)
826
+ throw new TypeError(
827
+ `version is longer than ${r} characters`
828
+ );
829
+ e("SemVer", i, f), this.options = f, this.loose = !!f.loose, this.includePrerelease = !!f.includePrerelease;
830
+ const c = i.trim().match(f.loose ? n[l.LOOSE] : n[l.FULL]);
831
+ if (!c)
832
+ throw new TypeError(`Invalid Version: ${i}`);
833
+ if (this.raw = i, this.major = +c[1], this.minor = +c[2], this.patch = +c[3], this.major > t || this.major < 0)
834
+ throw new TypeError("Invalid major version");
835
+ if (this.minor > t || this.minor < 0)
836
+ throw new TypeError("Invalid minor version");
837
+ if (this.patch > t || this.patch < 0)
838
+ throw new TypeError("Invalid patch version");
839
+ c[4] ? this.prerelease = c[4].split(".").map((p) => {
840
+ if (/^[0-9]+$/.test(p)) {
841
+ const d = +p;
842
+ if (d >= 0 && d < t)
843
+ return d;
844
+ }
845
+ return p;
846
+ }) : this.prerelease = [], this.build = c[5] ? c[5].split(".") : [], this.format();
847
+ }
848
+ format() {
849
+ return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
850
+ }
851
+ toString() {
852
+ return this.version;
853
+ }
854
+ compare(i) {
855
+ if (e("SemVer.compare", this.version, this.options, i), !(i instanceof s)) {
856
+ if (typeof i == "string" && i === this.version)
857
+ return 0;
858
+ i = new s(i, this.options);
859
+ }
860
+ return i.version === this.version ? 0 : this.compareMain(i) || this.comparePre(i);
861
+ }
862
+ compareMain(i) {
863
+ return i instanceof s || (i = new s(i, this.options)), o(this.major, i.major) || o(this.minor, i.minor) || o(this.patch, i.patch);
864
+ }
865
+ comparePre(i) {
866
+ if (i instanceof s || (i = new s(i, this.options)), this.prerelease.length && !i.prerelease.length)
867
+ return -1;
868
+ if (!this.prerelease.length && i.prerelease.length)
869
+ return 1;
870
+ if (!this.prerelease.length && !i.prerelease.length)
871
+ return 0;
872
+ let f = 0;
873
+ do {
874
+ const c = this.prerelease[f], p = i.prerelease[f];
875
+ if (e("prerelease compare", f, c, p), c === void 0 && p === void 0)
876
+ return 0;
877
+ if (p === void 0)
878
+ return 1;
879
+ if (c === void 0)
880
+ return -1;
881
+ if (c === p)
882
+ continue;
883
+ return o(c, p);
884
+ } while (++f);
885
+ }
886
+ compareBuild(i) {
887
+ i instanceof s || (i = new s(i, this.options));
888
+ let f = 0;
889
+ do {
890
+ const c = this.build[f], p = i.build[f];
891
+ if (e("build compare", f, c, p), c === void 0 && p === void 0)
892
+ return 0;
893
+ if (p === void 0)
894
+ return 1;
895
+ if (c === void 0)
896
+ return -1;
897
+ if (c === p)
898
+ continue;
899
+ return o(c, p);
900
+ } while (++f);
901
+ }
902
+ // preminor will bump the version up to the next minor release, and immediately
903
+ // down to pre-release. premajor and prepatch work the same way.
904
+ inc(i, f, c) {
905
+ if (i.startsWith("pre")) {
906
+ if (!f && c === !1)
907
+ throw new Error("invalid increment argument: identifier is empty");
908
+ if (f) {
909
+ const p = new RegExp(`^${this.options.loose ? a[l.PRERELEASELOOSE] : a[l.PRERELEASE]}$`), d = `-${f}`.match(p);
910
+ if (!d || d[1] !== f)
911
+ throw new Error(`invalid identifier: ${f}`);
912
+ }
913
+ }
914
+ switch (i) {
915
+ case "premajor":
916
+ this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", f, c);
917
+ break;
918
+ case "preminor":
919
+ this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", f, c);
920
+ break;
921
+ case "prepatch":
922
+ this.prerelease.length = 0, this.inc("patch", f, c), this.inc("pre", f, c);
923
+ break;
924
+ // If the input is a non-prerelease version, this acts the same as
925
+ // prepatch.
926
+ case "prerelease":
927
+ this.prerelease.length === 0 && this.inc("patch", f, c), this.inc("pre", f, c);
928
+ break;
929
+ case "release":
930
+ if (this.prerelease.length === 0)
931
+ throw new Error(`version ${this.raw} is not a prerelease`);
932
+ this.prerelease.length = 0;
933
+ break;
934
+ case "major":
935
+ (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
936
+ break;
937
+ case "minor":
938
+ (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
939
+ break;
940
+ case "patch":
941
+ this.prerelease.length === 0 && this.patch++, this.prerelease = [];
942
+ break;
943
+ // This probably shouldn't be used publicly.
944
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
945
+ case "pre": {
946
+ const p = Number(c) ? 1 : 0;
947
+ if (this.prerelease.length === 0)
948
+ this.prerelease = [p];
949
+ else {
950
+ let d = this.prerelease.length;
951
+ for (; --d >= 0; )
952
+ typeof this.prerelease[d] == "number" && (this.prerelease[d]++, d = -2);
953
+ if (d === -1) {
954
+ if (f === this.prerelease.join(".") && c === !1)
955
+ throw new Error("invalid increment argument: identifier already exists");
956
+ this.prerelease.push(p);
957
+ }
958
+ }
959
+ if (f) {
960
+ let d = [f, p];
961
+ c === !1 && (d = [f]), o(this.prerelease[0], f) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = d) : this.prerelease = d;
962
+ }
963
+ break;
964
+ }
965
+ default:
966
+ throw new Error(`invalid increment argument: ${i}`);
967
+ }
968
+ return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
969
+ }
970
+ }
971
+ return Re = s, Re;
972
+ }
973
+ var ye, xr;
974
+ function G() {
975
+ if (xr) return ye;
976
+ xr = 1;
977
+ const e = U();
978
+ return ye = (t, n, a = !1) => {
979
+ if (t instanceof e)
980
+ return t;
981
+ try {
982
+ return new e(t, n);
983
+ } catch (l) {
984
+ if (!a)
985
+ return null;
986
+ throw l;
987
+ }
988
+ }, ye;
989
+ }
990
+ var _e, qr;
991
+ function Yt() {
992
+ if (qr) return _e;
993
+ qr = 1;
994
+ const e = G();
995
+ return _e = (t, n) => {
996
+ const a = e(t, n);
997
+ return a ? a.version : null;
998
+ }, _e;
999
+ }
1000
+ var Ie, Dr;
1001
+ function Qt() {
1002
+ if (Dr) return Ie;
1003
+ Dr = 1;
1004
+ const e = G();
1005
+ return Ie = (t, n) => {
1006
+ const a = e(t.trim().replace(/^[=v]+/, ""), n);
1007
+ return a ? a.version : null;
1008
+ }, Ie;
1009
+ }
1010
+ var we, Fr;
1011
+ function Kt() {
1012
+ if (Fr) return we;
1013
+ Fr = 1;
1014
+ const e = U();
1015
+ return we = (t, n, a, l, u) => {
1016
+ typeof a == "string" && (u = l, l = a, a = void 0);
1017
+ try {
1018
+ return new e(
1019
+ t instanceof e ? t.version : t,
1020
+ a
1021
+ ).inc(n, l, u).version;
1022
+ } catch {
1023
+ return null;
1024
+ }
1025
+ }, we;
1026
+ }
1027
+ var $e, Ur;
1028
+ function Jt() {
1029
+ if (Ur) return $e;
1030
+ Ur = 1;
1031
+ const e = G();
1032
+ return $e = (t, n) => {
1033
+ const a = e(t, null, !0), l = e(n, null, !0), u = a.compare(l);
1034
+ if (u === 0)
1035
+ return null;
1036
+ const o = u > 0, s = o ? a : l, h = o ? l : a, i = !!s.prerelease.length;
1037
+ if (!!h.prerelease.length && !i) {
1038
+ if (!h.patch && !h.minor)
1039
+ return "major";
1040
+ if (h.compareMain(s) === 0)
1041
+ return h.minor && !h.patch ? "minor" : "patch";
1042
+ }
1043
+ const c = i ? "pre" : "";
1044
+ return a.major !== l.major ? c + "major" : a.minor !== l.minor ? c + "minor" : a.patch !== l.patch ? c + "patch" : "prerelease";
1045
+ }, $e;
1046
+ }
1047
+ var Te, Br;
1048
+ function Zt() {
1049
+ if (Br) return Te;
1050
+ Br = 1;
1051
+ const e = U();
1052
+ return Te = (t, n) => new e(t, n).major, Te;
1053
+ }
1054
+ var Ae, kr;
1055
+ function en() {
1056
+ if (kr) return Ae;
1057
+ kr = 1;
1058
+ const e = U();
1059
+ return Ae = (t, n) => new e(t, n).minor, Ae;
1060
+ }
1061
+ var Se, Gr;
1062
+ function rn() {
1063
+ if (Gr) return Se;
1064
+ Gr = 1;
1065
+ const e = U();
1066
+ return Se = (t, n) => new e(t, n).patch, Se;
1067
+ }
1068
+ var Le, Mr;
1069
+ function tn() {
1070
+ if (Mr) return Le;
1071
+ Mr = 1;
1072
+ const e = G();
1073
+ return Le = (t, n) => {
1074
+ const a = e(t, n);
1075
+ return a && a.prerelease.length ? a.prerelease : null;
1076
+ }, Le;
1077
+ }
1078
+ var Ne, jr;
1079
+ function B() {
1080
+ if (jr) return Ne;
1081
+ jr = 1;
1082
+ const e = U();
1083
+ return Ne = (t, n, a) => new e(t, a).compare(new e(n, a)), Ne;
1084
+ }
1085
+ var Ce, Vr;
1086
+ function nn() {
1087
+ if (Vr) return Ce;
1088
+ Vr = 1;
1089
+ const e = B();
1090
+ return Ce = (t, n, a) => e(n, t, a), Ce;
1091
+ }
1092
+ var Oe, Xr;
1093
+ function sn() {
1094
+ if (Xr) return Oe;
1095
+ Xr = 1;
1096
+ const e = B();
1097
+ return Oe = (t, n) => e(t, n, !0), Oe;
1098
+ }
1099
+ var be, Hr;
1100
+ function cr() {
1101
+ if (Hr) return be;
1102
+ Hr = 1;
1103
+ const e = U();
1104
+ return be = (t, n, a) => {
1105
+ const l = new e(t, a), u = new e(n, a);
1106
+ return l.compare(u) || l.compareBuild(u);
1107
+ }, be;
1108
+ }
1109
+ var Pe, Wr;
1110
+ function an() {
1111
+ if (Wr) return Pe;
1112
+ Wr = 1;
1113
+ const e = cr();
1114
+ return Pe = (t, n) => t.sort((a, l) => e(a, l, n)), Pe;
1115
+ }
1116
+ var xe, zr;
1117
+ function on() {
1118
+ if (zr) return xe;
1119
+ zr = 1;
1120
+ const e = cr();
1121
+ return xe = (t, n) => t.sort((a, l) => e(l, a, n)), xe;
1122
+ }
1123
+ var qe, Yr;
1124
+ function ne() {
1125
+ if (Yr) return qe;
1126
+ Yr = 1;
1127
+ const e = B();
1128
+ return qe = (t, n, a) => e(t, n, a) > 0, qe;
1129
+ }
1130
+ var De, Qr;
1131
+ function fr() {
1132
+ if (Qr) return De;
1133
+ Qr = 1;
1134
+ const e = B();
1135
+ return De = (t, n, a) => e(t, n, a) < 0, De;
1136
+ }
1137
+ var Fe, Kr;
1138
+ function St() {
1139
+ if (Kr) return Fe;
1140
+ Kr = 1;
1141
+ const e = B();
1142
+ return Fe = (t, n, a) => e(t, n, a) === 0, Fe;
1143
+ }
1144
+ var Ue, Jr;
1145
+ function Lt() {
1146
+ if (Jr) return Ue;
1147
+ Jr = 1;
1148
+ const e = B();
1149
+ return Ue = (t, n, a) => e(t, n, a) !== 0, Ue;
1150
+ }
1151
+ var Be, Zr;
1152
+ function hr() {
1153
+ if (Zr) return Be;
1154
+ Zr = 1;
1155
+ const e = B();
1156
+ return Be = (t, n, a) => e(t, n, a) >= 0, Be;
1157
+ }
1158
+ var ke, et;
1159
+ function pr() {
1160
+ if (et) return ke;
1161
+ et = 1;
1162
+ const e = B();
1163
+ return ke = (t, n, a) => e(t, n, a) <= 0, ke;
1164
+ }
1165
+ var Ge, rt;
1166
+ function Nt() {
1167
+ if (rt) return Ge;
1168
+ rt = 1;
1169
+ const e = St(), r = Lt(), t = ne(), n = hr(), a = fr(), l = pr();
1170
+ return Ge = (o, s, h, i) => {
1171
+ switch (s) {
1172
+ case "===":
1173
+ return typeof o == "object" && (o = o.version), typeof h == "object" && (h = h.version), o === h;
1174
+ case "!==":
1175
+ return typeof o == "object" && (o = o.version), typeof h == "object" && (h = h.version), o !== h;
1176
+ case "":
1177
+ case "=":
1178
+ case "==":
1179
+ return e(o, h, i);
1180
+ case "!=":
1181
+ return r(o, h, i);
1182
+ case ">":
1183
+ return t(o, h, i);
1184
+ case ">=":
1185
+ return n(o, h, i);
1186
+ case "<":
1187
+ return a(o, h, i);
1188
+ case "<=":
1189
+ return l(o, h, i);
1190
+ default:
1191
+ throw new TypeError(`Invalid operator: ${s}`);
1192
+ }
1193
+ }, Ge;
1194
+ }
1195
+ var Me, tt;
1196
+ function un() {
1197
+ if (tt) return Me;
1198
+ tt = 1;
1199
+ const e = U(), r = G(), { safeRe: t, t: n } = W();
1200
+ return Me = (l, u) => {
1201
+ if (l instanceof e)
1202
+ return l;
1203
+ if (typeof l == "number" && (l = String(l)), typeof l != "string")
1204
+ return null;
1205
+ u = u || {};
1206
+ let o = null;
1207
+ if (!u.rtl)
1208
+ o = l.match(u.includePrerelease ? t[n.COERCEFULL] : t[n.COERCE]);
1209
+ else {
1210
+ const p = u.includePrerelease ? t[n.COERCERTLFULL] : t[n.COERCERTL];
1211
+ let d;
1212
+ for (; (d = p.exec(l)) && (!o || o.index + o[0].length !== l.length); )
1213
+ (!o || d.index + d[0].length !== o.index + o[0].length) && (o = d), p.lastIndex = d.index + d[1].length + d[2].length;
1214
+ p.lastIndex = -1;
1215
+ }
1216
+ if (o === null)
1217
+ return null;
1218
+ const s = o[2], h = o[3] || "0", i = o[4] || "0", f = u.includePrerelease && o[5] ? `-${o[5]}` : "", c = u.includePrerelease && o[6] ? `+${o[6]}` : "";
1219
+ return r(`${s}.${h}.${i}${f}${c}`, u);
1220
+ }, Me;
1221
+ }
1222
+ var je, nt;
1223
+ function ln() {
1224
+ if (nt) return je;
1225
+ nt = 1;
1226
+ class e {
1227
+ constructor() {
1228
+ this.max = 1e3, this.map = /* @__PURE__ */ new Map();
1229
+ }
1230
+ get(t) {
1231
+ const n = this.map.get(t);
1232
+ if (n !== void 0)
1233
+ return this.map.delete(t), this.map.set(t, n), n;
1234
+ }
1235
+ delete(t) {
1236
+ return this.map.delete(t);
1237
+ }
1238
+ set(t, n) {
1239
+ if (!this.delete(t) && n !== void 0) {
1240
+ if (this.map.size >= this.max) {
1241
+ const l = this.map.keys().next().value;
1242
+ this.delete(l);
1243
+ }
1244
+ this.map.set(t, n);
1245
+ }
1246
+ return this;
1247
+ }
1248
+ }
1249
+ return je = e, je;
1250
+ }
1251
+ var Ve, it;
1252
+ function k() {
1253
+ if (it) return Ve;
1254
+ it = 1;
1255
+ const e = /\s+/g;
1256
+ class r {
1257
+ constructor(v, w) {
1258
+ if (w = a(w), v instanceof r)
1259
+ return v.loose === !!w.loose && v.includePrerelease === !!w.includePrerelease ? v : new r(v.raw, w);
1260
+ if (v instanceof l)
1261
+ return this.raw = v.value, this.set = [[v]], this.formatted = void 0, this;
1262
+ if (this.options = w, this.loose = !!w.loose, this.includePrerelease = !!w.includePrerelease, this.raw = v.trim().replace(e, " "), this.set = this.raw.split("||").map((_) => this.parseRange(_.trim())).filter((_) => _.length), !this.set.length)
1263
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
1264
+ if (this.set.length > 1) {
1265
+ const _ = this.set[0];
1266
+ if (this.set = this.set.filter(($) => !m($[0])), this.set.length === 0)
1267
+ this.set = [_];
1268
+ else if (this.set.length > 1) {
1269
+ for (const $ of this.set)
1270
+ if ($.length === 1 && E($[0])) {
1271
+ this.set = [$];
1272
+ break;
1273
+ }
1274
+ }
1275
+ }
1276
+ this.formatted = void 0;
1277
+ }
1278
+ get range() {
1279
+ if (this.formatted === void 0) {
1280
+ this.formatted = "";
1281
+ for (let v = 0; v < this.set.length; v++) {
1282
+ v > 0 && (this.formatted += "||");
1283
+ const w = this.set[v];
1284
+ for (let _ = 0; _ < w.length; _++)
1285
+ _ > 0 && (this.formatted += " "), this.formatted += w[_].toString().trim();
1286
+ }
1287
+ }
1288
+ return this.formatted;
1289
+ }
1290
+ format() {
1291
+ return this.range;
1292
+ }
1293
+ toString() {
1294
+ return this.range;
1295
+ }
1296
+ parseRange(v) {
1297
+ const _ = ((this.options.includePrerelease && p) | (this.options.loose && d)) + ":" + v, $ = n.get(_);
1298
+ if ($)
1299
+ return $;
1300
+ const I = this.options.loose, T = I ? s[h.HYPHENRANGELOOSE] : s[h.HYPHENRANGE];
1301
+ v = v.replace(T, ue(this.options.includePrerelease)), u("hyphen replace", v), v = v.replace(s[h.COMPARATORTRIM], i), u("comparator trim", v), v = v.replace(s[h.TILDETRIM], f), u("tilde trim", v), v = v.replace(s[h.CARETTRIM], c), u("caret trim", v);
1302
+ let N = v.split(" ").map((P) => L(P, this.options)).join(" ").split(/\s+/).map((P) => oe(P, this.options));
1303
+ I && (N = N.filter((P) => (u("loose invalid filter", P, this.options), !!P.match(s[h.COMPARATORLOOSE])))), u("range list", N);
1304
+ const S = /* @__PURE__ */ new Map(), C = N.map((P) => new l(P, this.options));
1305
+ for (const P of C) {
1306
+ if (m(P))
1307
+ return [P];
1308
+ S.set(P.value, P);
1309
+ }
1310
+ S.size > 1 && S.has("") && S.delete("");
1311
+ const F = [...S.values()];
1312
+ return n.set(_, F), F;
1313
+ }
1314
+ intersects(v, w) {
1315
+ if (!(v instanceof r))
1316
+ throw new TypeError("a Range is required");
1317
+ return this.set.some((_) => y(_, w) && v.set.some(($) => y($, w) && _.every((I) => $.every((T) => I.intersects(T, w)))));
1318
+ }
1319
+ // if ANY of the sets match ALL of its comparators, then pass
1320
+ test(v) {
1321
+ if (!v)
1322
+ return !1;
1323
+ if (typeof v == "string")
1324
+ try {
1325
+ v = new o(v, this.options);
1326
+ } catch {
1327
+ return !1;
1328
+ }
1329
+ for (let w = 0; w < this.set.length; w++)
1330
+ if (le(this.set[w], v, this.options))
1331
+ return !0;
1332
+ return !1;
1333
+ }
1334
+ }
1335
+ Ve = r;
1336
+ const t = ln(), n = new t(), a = lr(), l = ie(), u = te(), o = U(), {
1337
+ safeRe: s,
1338
+ t: h,
1339
+ comparatorTrimReplace: i,
1340
+ tildeTrimReplace: f,
1341
+ caretTrimReplace: c
1342
+ } = W(), { FLAG_INCLUDE_PRERELEASE: p, FLAG_LOOSE: d } = re(), m = (g) => g.value === "<0.0.0-0", E = (g) => g.value === "", y = (g, v) => {
1343
+ let w = !0;
1344
+ const _ = g.slice();
1345
+ let $ = _.pop();
1346
+ for (; w && _.length; )
1347
+ w = _.every((I) => $.intersects(I, v)), $ = _.pop();
1348
+ return w;
1349
+ }, L = (g, v) => (u("comp", g, v), g = O(g, v), u("caret", g), g = q(g, v), u("tildes", g), g = A(g, v), u("xrange", g), g = ae(g, v), u("stars", g), g), R = (g) => !g || g.toLowerCase() === "x" || g === "*", q = (g, v) => g.trim().split(/\s+/).map((w) => b(w, v)).join(" "), b = (g, v) => {
1350
+ const w = v.loose ? s[h.TILDELOOSE] : s[h.TILDE];
1351
+ return g.replace(w, (_, $, I, T, N) => {
1352
+ u("tilde", g, _, $, I, T, N);
1353
+ let S;
1354
+ return R($) ? S = "" : R(I) ? S = `>=${$}.0.0 <${+$ + 1}.0.0-0` : R(T) ? S = `>=${$}.${I}.0 <${$}.${+I + 1}.0-0` : N ? (u("replaceTilde pr", N), S = `>=${$}.${I}.${T}-${N} <${$}.${+I + 1}.0-0`) : S = `>=${$}.${I}.${T} <${$}.${+I + 1}.0-0`, u("tilde return", S), S;
1355
+ });
1356
+ }, O = (g, v) => g.trim().split(/\s+/).map((w) => x(w, v)).join(" "), x = (g, v) => {
1357
+ u("caret", g, v);
1358
+ const w = v.loose ? s[h.CARETLOOSE] : s[h.CARET], _ = v.includePrerelease ? "-0" : "";
1359
+ return g.replace(w, ($, I, T, N, S) => {
1360
+ u("caret", g, $, I, T, N, S);
1361
+ let C;
1362
+ return R(I) ? C = "" : R(T) ? C = `>=${I}.0.0${_} <${+I + 1}.0.0-0` : R(N) ? I === "0" ? C = `>=${I}.${T}.0${_} <${I}.${+T + 1}.0-0` : C = `>=${I}.${T}.0${_} <${+I + 1}.0.0-0` : S ? (u("replaceCaret pr", S), I === "0" ? T === "0" ? C = `>=${I}.${T}.${N}-${S} <${I}.${T}.${+N + 1}-0` : C = `>=${I}.${T}.${N}-${S} <${I}.${+T + 1}.0-0` : C = `>=${I}.${T}.${N}-${S} <${+I + 1}.0.0-0`) : (u("no pr"), I === "0" ? T === "0" ? C = `>=${I}.${T}.${N}${_} <${I}.${T}.${+N + 1}-0` : C = `>=${I}.${T}.${N}${_} <${I}.${+T + 1}.0-0` : C = `>=${I}.${T}.${N} <${+I + 1}.0.0-0`), u("caret return", C), C;
1363
+ });
1364
+ }, A = (g, v) => (u("replaceXRanges", g, v), g.split(/\s+/).map((w) => M(w, v)).join(" ")), M = (g, v) => {
1365
+ g = g.trim();
1366
+ const w = v.loose ? s[h.XRANGELOOSE] : s[h.XRANGE];
1367
+ return g.replace(w, (_, $, I, T, N, S) => {
1368
+ u("xRange", g, _, $, I, T, N, S);
1369
+ const C = R(I), F = C || R(T), P = F || R(N), j = P;
1370
+ return $ === "=" && j && ($ = ""), S = v.includePrerelease ? "-0" : "", C ? $ === ">" || $ === "<" ? _ = "<0.0.0-0" : _ = "*" : $ && j ? (F && (T = 0), N = 0, $ === ">" ? ($ = ">=", F ? (I = +I + 1, T = 0, N = 0) : (T = +T + 1, N = 0)) : $ === "<=" && ($ = "<", F ? I = +I + 1 : T = +T + 1), $ === "<" && (S = "-0"), _ = `${$ + I}.${T}.${N}${S}`) : F ? _ = `>=${I}.0.0${S} <${+I + 1}.0.0-0` : P && (_ = `>=${I}.${T}.0${S} <${I}.${+T + 1}.0-0`), u("xRange return", _), _;
1371
+ });
1372
+ }, ae = (g, v) => (u("replaceStars", g, v), g.trim().replace(s[h.STAR], "")), oe = (g, v) => (u("replaceGTE0", g, v), g.trim().replace(s[v.includePrerelease ? h.GTE0PRE : h.GTE0], "")), ue = (g) => (v, w, _, $, I, T, N, S, C, F, P, j) => (R(_) ? w = "" : R($) ? w = `>=${_}.0.0${g ? "-0" : ""}` : R(I) ? w = `>=${_}.${$}.0${g ? "-0" : ""}` : T ? w = `>=${w}` : w = `>=${w}${g ? "-0" : ""}`, R(C) ? S = "" : R(F) ? S = `<${+C + 1}.0.0-0` : R(P) ? S = `<${C}.${+F + 1}.0-0` : j ? S = `<=${C}.${F}.${P}-${j}` : g ? S = `<${C}.${F}.${+P + 1}-0` : S = `<=${S}`, `${w} ${S}`.trim()), le = (g, v, w) => {
1373
+ for (let _ = 0; _ < g.length; _++)
1374
+ if (!g[_].test(v))
1375
+ return !1;
1376
+ if (v.prerelease.length && !w.includePrerelease) {
1377
+ for (let _ = 0; _ < g.length; _++)
1378
+ if (u(g[_].semver), g[_].semver !== l.ANY && g[_].semver.prerelease.length > 0) {
1379
+ const $ = g[_].semver;
1380
+ if ($.major === v.major && $.minor === v.minor && $.patch === v.patch)
1381
+ return !0;
1382
+ }
1383
+ return !1;
1384
+ }
1385
+ return !0;
1386
+ };
1387
+ return Ve;
1388
+ }
1389
+ var Xe, st;
1390
+ function ie() {
1391
+ if (st) return Xe;
1392
+ st = 1;
1393
+ const e = Symbol("SemVer ANY");
1394
+ class r {
1395
+ static get ANY() {
1396
+ return e;
1397
+ }
1398
+ constructor(i, f) {
1399
+ if (f = t(f), i instanceof r) {
1400
+ if (i.loose === !!f.loose)
1401
+ return i;
1402
+ i = i.value;
1403
+ }
1404
+ i = i.trim().split(/\s+/).join(" "), u("comparator", i, f), this.options = f, this.loose = !!f.loose, this.parse(i), this.semver === e ? this.value = "" : this.value = this.operator + this.semver.version, u("comp", this);
1405
+ }
1406
+ parse(i) {
1407
+ const f = this.options.loose ? n[a.COMPARATORLOOSE] : n[a.COMPARATOR], c = i.match(f);
1408
+ if (!c)
1409
+ throw new TypeError(`Invalid comparator: ${i}`);
1410
+ this.operator = c[1] !== void 0 ? c[1] : "", this.operator === "=" && (this.operator = ""), c[2] ? this.semver = new o(c[2], this.options.loose) : this.semver = e;
1411
+ }
1412
+ toString() {
1413
+ return this.value;
1414
+ }
1415
+ test(i) {
1416
+ if (u("Comparator.test", i, this.options.loose), this.semver === e || i === e)
1417
+ return !0;
1418
+ if (typeof i == "string")
1419
+ try {
1420
+ i = new o(i, this.options);
1421
+ } catch {
1422
+ return !1;
1423
+ }
1424
+ return l(i, this.operator, this.semver, this.options);
1425
+ }
1426
+ intersects(i, f) {
1427
+ if (!(i instanceof r))
1428
+ throw new TypeError("a Comparator is required");
1429
+ return this.operator === "" ? this.value === "" ? !0 : new s(i.value, f).test(this.value) : i.operator === "" ? i.value === "" ? !0 : new s(this.value, f).test(i.semver) : (f = t(f), f.includePrerelease && (this.value === "<0.0.0-0" || i.value === "<0.0.0-0") || !f.includePrerelease && (this.value.startsWith("<0.0.0") || i.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && i.operator.startsWith(">") || this.operator.startsWith("<") && i.operator.startsWith("<") || this.semver.version === i.semver.version && this.operator.includes("=") && i.operator.includes("=") || l(this.semver, "<", i.semver, f) && this.operator.startsWith(">") && i.operator.startsWith("<") || l(this.semver, ">", i.semver, f) && this.operator.startsWith("<") && i.operator.startsWith(">")));
1430
+ }
1431
+ }
1432
+ Xe = r;
1433
+ const t = lr(), { safeRe: n, t: a } = W(), l = Nt(), u = te(), o = U(), s = k();
1434
+ return Xe;
1435
+ }
1436
+ var He, at;
1437
+ function se() {
1438
+ if (at) return He;
1439
+ at = 1;
1440
+ const e = k();
1441
+ return He = (t, n, a) => {
1442
+ try {
1443
+ n = new e(n, a);
1444
+ } catch {
1445
+ return !1;
1446
+ }
1447
+ return n.test(t);
1448
+ }, He;
1449
+ }
1450
+ var We, ot;
1451
+ function cn() {
1452
+ if (ot) return We;
1453
+ ot = 1;
1454
+ const e = k();
1455
+ return We = (t, n) => new e(t, n).set.map((a) => a.map((l) => l.value).join(" ").trim().split(" ")), We;
1456
+ }
1457
+ var ze, ut;
1458
+ function fn() {
1459
+ if (ut) return ze;
1460
+ ut = 1;
1461
+ const e = U(), r = k();
1462
+ return ze = (n, a, l) => {
1463
+ let u = null, o = null, s = null;
1464
+ try {
1465
+ s = new r(a, l);
1466
+ } catch {
1467
+ return null;
1468
+ }
1469
+ return n.forEach((h) => {
1470
+ s.test(h) && (!u || o.compare(h) === -1) && (u = h, o = new e(u, l));
1471
+ }), u;
1472
+ }, ze;
1473
+ }
1474
+ var Ye, lt;
1475
+ function hn() {
1476
+ if (lt) return Ye;
1477
+ lt = 1;
1478
+ const e = U(), r = k();
1479
+ return Ye = (n, a, l) => {
1480
+ let u = null, o = null, s = null;
1481
+ try {
1482
+ s = new r(a, l);
1483
+ } catch {
1484
+ return null;
1485
+ }
1486
+ return n.forEach((h) => {
1487
+ s.test(h) && (!u || o.compare(h) === 1) && (u = h, o = new e(u, l));
1488
+ }), u;
1489
+ }, Ye;
1490
+ }
1491
+ var Qe, ct;
1492
+ function pn() {
1493
+ if (ct) return Qe;
1494
+ ct = 1;
1495
+ const e = U(), r = k(), t = ne();
1496
+ return Qe = (a, l) => {
1497
+ a = new r(a, l);
1498
+ let u = new e("0.0.0");
1499
+ if (a.test(u) || (u = new e("0.0.0-0"), a.test(u)))
1500
+ return u;
1501
+ u = null;
1502
+ for (let o = 0; o < a.set.length; ++o) {
1503
+ const s = a.set[o];
1504
+ let h = null;
1505
+ s.forEach((i) => {
1506
+ const f = new e(i.semver.version);
1507
+ switch (i.operator) {
1508
+ case ">":
1509
+ f.prerelease.length === 0 ? f.patch++ : f.prerelease.push(0), f.raw = f.format();
1510
+ /* fallthrough */
1511
+ case "":
1512
+ case ">=":
1513
+ (!h || t(f, h)) && (h = f);
1514
+ break;
1515
+ case "<":
1516
+ case "<=":
1517
+ break;
1518
+ /* istanbul ignore next */
1519
+ default:
1520
+ throw new Error(`Unexpected operation: ${i.operator}`);
1521
+ }
1522
+ }), h && (!u || t(u, h)) && (u = h);
1523
+ }
1524
+ return u && a.test(u) ? u : null;
1525
+ }, Qe;
1526
+ }
1527
+ var Ke, ft;
1528
+ function mn() {
1529
+ if (ft) return Ke;
1530
+ ft = 1;
1531
+ const e = k();
1532
+ return Ke = (t, n) => {
1533
+ try {
1534
+ return new e(t, n).range || "*";
1535
+ } catch {
1536
+ return null;
1537
+ }
1538
+ }, Ke;
1539
+ }
1540
+ var Je, ht;
1541
+ function mr() {
1542
+ if (ht) return Je;
1543
+ ht = 1;
1544
+ const e = U(), r = ie(), { ANY: t } = r, n = k(), a = se(), l = ne(), u = fr(), o = pr(), s = hr();
1545
+ return Je = (i, f, c, p) => {
1546
+ i = new e(i, p), f = new n(f, p);
1547
+ let d, m, E, y, L;
1548
+ switch (c) {
1549
+ case ">":
1550
+ d = l, m = o, E = u, y = ">", L = ">=";
1551
+ break;
1552
+ case "<":
1553
+ d = u, m = s, E = l, y = "<", L = "<=";
1554
+ break;
1555
+ default:
1556
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
1557
+ }
1558
+ if (a(i, f, p))
1559
+ return !1;
1560
+ for (let R = 0; R < f.set.length; ++R) {
1561
+ const q = f.set[R];
1562
+ let b = null, O = null;
1563
+ if (q.forEach((x) => {
1564
+ x.semver === t && (x = new r(">=0.0.0")), b = b || x, O = O || x, d(x.semver, b.semver, p) ? b = x : E(x.semver, O.semver, p) && (O = x);
1565
+ }), b.operator === y || b.operator === L || (!O.operator || O.operator === y) && m(i, O.semver))
1566
+ return !1;
1567
+ if (O.operator === L && E(i, O.semver))
1568
+ return !1;
1569
+ }
1570
+ return !0;
1571
+ }, Je;
1572
+ }
1573
+ var Ze, pt;
1574
+ function dn() {
1575
+ if (pt) return Ze;
1576
+ pt = 1;
1577
+ const e = mr();
1578
+ return Ze = (t, n, a) => e(t, n, ">", a), Ze;
1579
+ }
1580
+ var er, mt;
1581
+ function En() {
1582
+ if (mt) return er;
1583
+ mt = 1;
1584
+ const e = mr();
1585
+ return er = (t, n, a) => e(t, n, "<", a), er;
1586
+ }
1587
+ var rr, dt;
1588
+ function vn() {
1589
+ if (dt) return rr;
1590
+ dt = 1;
1591
+ const e = k();
1592
+ return rr = (t, n, a) => (t = new e(t, a), n = new e(n, a), t.intersects(n, a)), rr;
1593
+ }
1594
+ var tr, Et;
1595
+ function gn() {
1596
+ if (Et) return tr;
1597
+ Et = 1;
1598
+ const e = se(), r = B();
1599
+ return tr = (t, n, a) => {
1600
+ const l = [];
1601
+ let u = null, o = null;
1602
+ const s = t.sort((c, p) => r(c, p, a));
1603
+ for (const c of s)
1604
+ e(c, n, a) ? (o = c, u || (u = c)) : (o && l.push([u, o]), o = null, u = null);
1605
+ u && l.push([u, null]);
1606
+ const h = [];
1607
+ for (const [c, p] of l)
1608
+ c === p ? h.push(c) : !p && c === s[0] ? h.push("*") : p ? c === s[0] ? h.push(`<=${p}`) : h.push(`${c} - ${p}`) : h.push(`>=${c}`);
1609
+ const i = h.join(" || "), f = typeof n.raw == "string" ? n.raw : String(n);
1610
+ return i.length < f.length ? i : n;
1611
+ }, tr;
1612
+ }
1613
+ var nr, vt;
1614
+ function Rn() {
1615
+ if (vt) return nr;
1616
+ vt = 1;
1617
+ const e = k(), r = ie(), { ANY: t } = r, n = se(), a = B(), l = (f, c, p = {}) => {
1618
+ if (f === c)
1619
+ return !0;
1620
+ f = new e(f, p), c = new e(c, p);
1621
+ let d = !1;
1622
+ e: for (const m of f.set) {
1623
+ for (const E of c.set) {
1624
+ const y = s(m, E, p);
1625
+ if (d = d || y !== null, y)
1626
+ continue e;
1627
+ }
1628
+ if (d)
1629
+ return !1;
1630
+ }
1631
+ return !0;
1632
+ }, u = [new r(">=0.0.0-0")], o = [new r(">=0.0.0")], s = (f, c, p) => {
1633
+ if (f === c)
1634
+ return !0;
1635
+ if (f.length === 1 && f[0].semver === t) {
1636
+ if (c.length === 1 && c[0].semver === t)
1637
+ return !0;
1638
+ p.includePrerelease ? f = u : f = o;
1639
+ }
1640
+ if (c.length === 1 && c[0].semver === t) {
1641
+ if (p.includePrerelease)
1642
+ return !0;
1643
+ c = o;
1644
+ }
1645
+ const d = /* @__PURE__ */ new Set();
1646
+ let m, E;
1647
+ for (const A of f)
1648
+ A.operator === ">" || A.operator === ">=" ? m = h(m, A, p) : A.operator === "<" || A.operator === "<=" ? E = i(E, A, p) : d.add(A.semver);
1649
+ if (d.size > 1)
1650
+ return null;
1651
+ let y;
1652
+ if (m && E) {
1653
+ if (y = a(m.semver, E.semver, p), y > 0)
1654
+ return null;
1655
+ if (y === 0 && (m.operator !== ">=" || E.operator !== "<="))
1656
+ return null;
1657
+ }
1658
+ for (const A of d) {
1659
+ if (m && !n(A, String(m), p) || E && !n(A, String(E), p))
1660
+ return null;
1661
+ for (const M of c)
1662
+ if (!n(A, String(M), p))
1663
+ return !1;
1664
+ return !0;
1665
+ }
1666
+ let L, R, q, b, O = E && !p.includePrerelease && E.semver.prerelease.length ? E.semver : !1, x = m && !p.includePrerelease && m.semver.prerelease.length ? m.semver : !1;
1667
+ O && O.prerelease.length === 1 && E.operator === "<" && O.prerelease[0] === 0 && (O = !1);
1668
+ for (const A of c) {
1669
+ if (b = b || A.operator === ">" || A.operator === ">=", q = q || A.operator === "<" || A.operator === "<=", m) {
1670
+ if (x && A.semver.prerelease && A.semver.prerelease.length && A.semver.major === x.major && A.semver.minor === x.minor && A.semver.patch === x.patch && (x = !1), A.operator === ">" || A.operator === ">=") {
1671
+ if (L = h(m, A, p), L === A && L !== m)
1672
+ return !1;
1673
+ } else if (m.operator === ">=" && !n(m.semver, String(A), p))
1674
+ return !1;
1675
+ }
1676
+ if (E) {
1677
+ if (O && A.semver.prerelease && A.semver.prerelease.length && A.semver.major === O.major && A.semver.minor === O.minor && A.semver.patch === O.patch && (O = !1), A.operator === "<" || A.operator === "<=") {
1678
+ if (R = i(E, A, p), R === A && R !== E)
1679
+ return !1;
1680
+ } else if (E.operator === "<=" && !n(E.semver, String(A), p))
1681
+ return !1;
1682
+ }
1683
+ if (!A.operator && (E || m) && y !== 0)
1684
+ return !1;
1685
+ }
1686
+ return !(m && q && !E && y !== 0 || E && b && !m && y !== 0 || x || O);
1687
+ }, h = (f, c, p) => {
1688
+ if (!f)
1689
+ return c;
1690
+ const d = a(f.semver, c.semver, p);
1691
+ return d > 0 ? f : d < 0 || c.operator === ">" && f.operator === ">=" ? c : f;
1692
+ }, i = (f, c, p) => {
1693
+ if (!f)
1694
+ return c;
1695
+ const d = a(f.semver, c.semver, p);
1696
+ return d < 0 ? f : d > 0 || c.operator === "<" && f.operator === "<=" ? c : f;
1697
+ };
1698
+ return nr = l, nr;
1699
+ }
1700
+ var ir, gt;
1701
+ function yn() {
1702
+ if (gt) return ir;
1703
+ gt = 1;
1704
+ const e = W(), r = re(), t = U(), n = At(), a = G(), l = Yt(), u = Qt(), o = Kt(), s = Jt(), h = Zt(), i = en(), f = rn(), c = tn(), p = B(), d = nn(), m = sn(), E = cr(), y = an(), L = on(), R = ne(), q = fr(), b = St(), O = Lt(), x = hr(), A = pr(), M = Nt(), ae = un(), oe = ie(), ue = k(), le = se(), g = cn(), v = fn(), w = hn(), _ = pn(), $ = mn(), I = mr(), T = dn(), N = En(), S = vn(), C = gn(), F = Rn();
1705
+ return ir = {
1706
+ parse: a,
1707
+ valid: l,
1708
+ clean: u,
1709
+ inc: o,
1710
+ diff: s,
1711
+ major: h,
1712
+ minor: i,
1713
+ patch: f,
1714
+ prerelease: c,
1715
+ compare: p,
1716
+ rcompare: d,
1717
+ compareLoose: m,
1718
+ compareBuild: E,
1719
+ sort: y,
1720
+ rsort: L,
1721
+ gt: R,
1722
+ lt: q,
1723
+ eq: b,
1724
+ neq: O,
1725
+ gte: x,
1726
+ lte: A,
1727
+ cmp: M,
1728
+ coerce: ae,
1729
+ Comparator: oe,
1730
+ Range: ue,
1731
+ satisfies: le,
1732
+ toComparators: g,
1733
+ maxSatisfying: v,
1734
+ minSatisfying: w,
1735
+ minVersion: _,
1736
+ validRange: $,
1737
+ outside: I,
1738
+ gtr: T,
1739
+ ltr: N,
1740
+ intersects: S,
1741
+ simplifyRange: C,
1742
+ subset: F,
1743
+ SemVer: t,
1744
+ re: e.re,
1745
+ src: e.src,
1746
+ tokens: e.t,
1747
+ SEMVER_SPEC_VERSION: r.SEMVER_SPEC_VERSION,
1748
+ RELEASE_TYPES: r.RELEASE_TYPES,
1749
+ compareIdentifiers: n.compareIdentifiers,
1750
+ rcompareIdentifiers: n.rcompareIdentifiers
1751
+ }, ir;
1752
+ }
1753
+ yn();
1754
+ new TextEncoder();
1755
+ var J = { exports: {} }, Rt;
1756
+ function _n() {
1757
+ if (Rt) return J.exports;
1758
+ Rt = 1;
1759
+ const e = /[\p{Lu}]/u, r = /[\p{Ll}]/u, t = /^[\p{Lu}](?![\p{Lu}])/gu, n = /([\p{Alpha}\p{N}_]|$)/u, a = /[_.\- ]+/, l = new RegExp("^" + a.source), u = new RegExp(a.source + n.source, "gu"), o = new RegExp("\\d+" + n.source, "gu"), s = (c, p, d) => {
1760
+ let m = !1, E = !1, y = !1;
1761
+ for (let L = 0; L < c.length; L++) {
1762
+ const R = c[L];
1763
+ m && e.test(R) ? (c = c.slice(0, L) + "-" + c.slice(L), m = !1, y = E, E = !0, L++) : E && y && r.test(R) ? (c = c.slice(0, L - 1) + "-" + c.slice(L - 1), y = E, E = !1, m = !0) : (m = p(R) === R && d(R) !== R, y = E, E = d(R) === R && p(R) !== R);
1764
+ }
1765
+ return c;
1766
+ }, h = (c, p) => (t.lastIndex = 0, c.replace(t, (d) => p(d))), i = (c, p) => (u.lastIndex = 0, o.lastIndex = 0, c.replace(u, (d, m) => p(m)).replace(o, (d) => p(d))), f = (c, p) => {
1767
+ if (!(typeof c == "string" || Array.isArray(c)))
1768
+ throw new TypeError("Expected the input to be `string | string[]`");
1769
+ if (p = {
1770
+ pascalCase: !1,
1771
+ preserveConsecutiveUppercase: !1,
1772
+ ...p
1773
+ }, Array.isArray(c) ? c = c.map((y) => y.trim()).filter((y) => y.length).join("-") : c = c.trim(), c.length === 0)
1774
+ return "";
1775
+ const d = p.locale === !1 ? (y) => y.toLowerCase() : (y) => y.toLocaleLowerCase(p.locale), m = p.locale === !1 ? (y) => y.toUpperCase() : (y) => y.toLocaleUpperCase(p.locale);
1776
+ return c.length === 1 ? p.pascalCase ? m(c) : d(c) : (c !== d(c) && (c = s(c, d, m)), c = c.replace(l, ""), p.preserveConsecutiveUppercase ? c = h(c, d) : c = d(c), p.pascalCase && (c = m(c.charAt(0)) + c.slice(1)), i(c, m));
1777
+ };
1778
+ return J.exports = f, J.exports.default = f, J.exports;
1779
+ }
1780
+ _n();
1781
+ var Z = { exports: {} };
1782
+ Z.exports;
1783
+ var yt;
1784
+ function In() {
1785
+ return yt || (yt = 1, function(e) {
1786
+ const t = (l = 0) => (u) => `\x1B[${38 + l};5;${u}m`, n = (l = 0) => (u, o, s) => `\x1B[${38 + l};2;${u};${o};${s}m`;
1787
+ function a() {
1788
+ const l = /* @__PURE__ */ new Map(), u = {
1789
+ modifier: {
1790
+ reset: [0, 0],
1791
+ // 21 isn't widely supported and 22 does the same thing
1792
+ bold: [1, 22],
1793
+ dim: [2, 22],
1794
+ italic: [3, 23],
1795
+ underline: [4, 24],
1796
+ overline: [53, 55],
1797
+ inverse: [7, 27],
1798
+ hidden: [8, 28],
1799
+ strikethrough: [9, 29]
1800
+ },
1801
+ color: {
1802
+ black: [30, 39],
1803
+ red: [31, 39],
1804
+ green: [32, 39],
1805
+ yellow: [33, 39],
1806
+ blue: [34, 39],
1807
+ magenta: [35, 39],
1808
+ cyan: [36, 39],
1809
+ white: [37, 39],
1810
+ // Bright color
1811
+ blackBright: [90, 39],
1812
+ redBright: [91, 39],
1813
+ greenBright: [92, 39],
1814
+ yellowBright: [93, 39],
1815
+ blueBright: [94, 39],
1816
+ magentaBright: [95, 39],
1817
+ cyanBright: [96, 39],
1818
+ whiteBright: [97, 39]
1819
+ },
1820
+ bgColor: {
1821
+ bgBlack: [40, 49],
1822
+ bgRed: [41, 49],
1823
+ bgGreen: [42, 49],
1824
+ bgYellow: [43, 49],
1825
+ bgBlue: [44, 49],
1826
+ bgMagenta: [45, 49],
1827
+ bgCyan: [46, 49],
1828
+ bgWhite: [47, 49],
1829
+ // Bright color
1830
+ bgBlackBright: [100, 49],
1831
+ bgRedBright: [101, 49],
1832
+ bgGreenBright: [102, 49],
1833
+ bgYellowBright: [103, 49],
1834
+ bgBlueBright: [104, 49],
1835
+ bgMagentaBright: [105, 49],
1836
+ bgCyanBright: [106, 49],
1837
+ bgWhiteBright: [107, 49]
1838
+ }
1839
+ };
1840
+ u.color.gray = u.color.blackBright, u.bgColor.bgGray = u.bgColor.bgBlackBright, u.color.grey = u.color.blackBright, u.bgColor.bgGrey = u.bgColor.bgBlackBright;
1841
+ for (const [o, s] of Object.entries(u)) {
1842
+ for (const [h, i] of Object.entries(s))
1843
+ u[h] = {
1844
+ open: `\x1B[${i[0]}m`,
1845
+ close: `\x1B[${i[1]}m`
1846
+ }, s[h] = u[h], l.set(i[0], i[1]);
1847
+ Object.defineProperty(u, o, {
1848
+ value: s,
1849
+ enumerable: !1
1850
+ });
1851
+ }
1852
+ return Object.defineProperty(u, "codes", {
1853
+ value: l,
1854
+ enumerable: !1
1855
+ }), u.color.close = "\x1B[39m", u.bgColor.close = "\x1B[49m", u.color.ansi256 = t(), u.color.ansi16m = n(), u.bgColor.ansi256 = t(10), u.bgColor.ansi16m = n(10), Object.defineProperties(u, {
1856
+ rgbToAnsi256: {
1857
+ value: (o, s, h) => o === s && s === h ? o < 8 ? 16 : o > 248 ? 231 : Math.round((o - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(o / 255 * 5) + 6 * Math.round(s / 255 * 5) + Math.round(h / 255 * 5),
1858
+ enumerable: !1
1859
+ },
1860
+ hexToRgb: {
1861
+ value: (o) => {
1862
+ const s = /(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(o.toString(16));
1863
+ if (!s)
1864
+ return [0, 0, 0];
1865
+ let { colorString: h } = s.groups;
1866
+ h.length === 3 && (h = h.split("").map((f) => f + f).join(""));
1867
+ const i = Number.parseInt(h, 16);
1868
+ return [
1869
+ i >> 16 & 255,
1870
+ i >> 8 & 255,
1871
+ i & 255
1872
+ ];
1873
+ },
1874
+ enumerable: !1
1875
+ },
1876
+ hexToAnsi256: {
1877
+ value: (o) => u.rgbToAnsi256(...u.hexToRgb(o)),
1878
+ enumerable: !1
1879
+ }
1880
+ }), u;
1881
+ }
1882
+ Object.defineProperty(e, "exports", {
1883
+ enumerable: !0,
1884
+ get: a
1885
+ });
1886
+ }(Z)), Z.exports;
1887
+ }
1888
+ var wn = In();
1889
+ const $n = /* @__PURE__ */ Ut(wn), { color: Jn } = $n;
1890
+ new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
1891
+ function Tn(e) {
1892
+ for (var r = 1; r < arguments.length; r++) {
1893
+ var t = arguments[r];
1894
+ for (var n in t)
1895
+ t.hasOwnProperty(n) && (e[n] = t[n]);
1896
+ }
1897
+ return e;
1898
+ }
1899
+ function ur(e, r) {
1900
+ return Array(r + 1).join(e);
1901
+ }
1902
+ function An(e) {
1903
+ return e.replace(/^\n*/, "");
1904
+ }
1905
+ function Sn(e) {
1906
+ for (var r = e.length; r > 0 && e[r - 1] === `
1907
+ `; ) r--;
1908
+ return e.substring(0, r);
1909
+ }
1910
+ var Ln = [
1911
+ "ADDRESS",
1912
+ "ARTICLE",
1913
+ "ASIDE",
1914
+ "AUDIO",
1915
+ "BLOCKQUOTE",
1916
+ "BODY",
1917
+ "CANVAS",
1918
+ "CENTER",
1919
+ "DD",
1920
+ "DIR",
1921
+ "DIV",
1922
+ "DL",
1923
+ "DT",
1924
+ "FIELDSET",
1925
+ "FIGCAPTION",
1926
+ "FIGURE",
1927
+ "FOOTER",
1928
+ "FORM",
1929
+ "FRAMESET",
1930
+ "H1",
1931
+ "H2",
1932
+ "H3",
1933
+ "H4",
1934
+ "H5",
1935
+ "H6",
1936
+ "HEADER",
1937
+ "HGROUP",
1938
+ "HR",
1939
+ "HTML",
1940
+ "ISINDEX",
1941
+ "LI",
1942
+ "MAIN",
1943
+ "MENU",
1944
+ "NAV",
1945
+ "NOFRAMES",
1946
+ "NOSCRIPT",
1947
+ "OL",
1948
+ "OUTPUT",
1949
+ "P",
1950
+ "PRE",
1951
+ "SECTION",
1952
+ "TABLE",
1953
+ "TBODY",
1954
+ "TD",
1955
+ "TFOOT",
1956
+ "TH",
1957
+ "THEAD",
1958
+ "TR",
1959
+ "UL"
1960
+ ];
1961
+ function dr(e) {
1962
+ return Er(e, Ln);
1963
+ }
1964
+ var Ct = [
1965
+ "AREA",
1966
+ "BASE",
1967
+ "BR",
1968
+ "COL",
1969
+ "COMMAND",
1970
+ "EMBED",
1971
+ "HR",
1972
+ "IMG",
1973
+ "INPUT",
1974
+ "KEYGEN",
1975
+ "LINK",
1976
+ "META",
1977
+ "PARAM",
1978
+ "SOURCE",
1979
+ "TRACK",
1980
+ "WBR"
1981
+ ];
1982
+ function Ot(e) {
1983
+ return Er(e, Ct);
1984
+ }
1985
+ function Nn(e) {
1986
+ return Pt(e, Ct);
1987
+ }
1988
+ var bt = [
1989
+ "A",
1990
+ "TABLE",
1991
+ "THEAD",
1992
+ "TBODY",
1993
+ "TFOOT",
1994
+ "TH",
1995
+ "TD",
1996
+ "IFRAME",
1997
+ "SCRIPT",
1998
+ "AUDIO",
1999
+ "VIDEO"
2000
+ ];
2001
+ function Cn(e) {
2002
+ return Er(e, bt);
2003
+ }
2004
+ function On(e) {
2005
+ return Pt(e, bt);
2006
+ }
2007
+ function Er(e, r) {
2008
+ return r.indexOf(e.nodeName) >= 0;
2009
+ }
2010
+ function Pt(e, r) {
2011
+ return e.getElementsByTagName && r.some(function(t) {
2012
+ return e.getElementsByTagName(t).length;
2013
+ });
2014
+ }
2015
+ var D = {};
2016
+ D.paragraph = {
2017
+ filter: "p",
2018
+ replacement: function(e) {
2019
+ return `
2020
+
2021
+ ` + e + `
2022
+
2023
+ `;
2024
+ }
2025
+ };
2026
+ D.lineBreak = {
2027
+ filter: "br",
2028
+ replacement: function(e, r, t) {
2029
+ return t.br + `
2030
+ `;
2031
+ }
2032
+ };
2033
+ D.heading = {
2034
+ filter: ["h1", "h2", "h3", "h4", "h5", "h6"],
2035
+ replacement: function(e, r, t) {
2036
+ var n = Number(r.nodeName.charAt(1));
2037
+ if (t.headingStyle === "setext" && n < 3) {
2038
+ var a = ur(n === 1 ? "=" : "-", e.length);
2039
+ return `
2040
+
2041
+ ` + e + `
2042
+ ` + a + `
2043
+
2044
+ `;
2045
+ } else
2046
+ return `
2047
+
2048
+ ` + ur("#", n) + " " + e + `
2049
+
2050
+ `;
2051
+ }
2052
+ };
2053
+ D.blockquote = {
2054
+ filter: "blockquote",
2055
+ replacement: function(e) {
2056
+ return e = e.replace(/^\n+|\n+$/g, ""), e = e.replace(/^/gm, "> "), `
2057
+
2058
+ ` + e + `
2059
+
2060
+ `;
2061
+ }
2062
+ };
2063
+ D.list = {
2064
+ filter: ["ul", "ol"],
2065
+ replacement: function(e, r) {
2066
+ var t = r.parentNode;
2067
+ return t.nodeName === "LI" && t.lastElementChild === r ? `
2068
+ ` + e : `
2069
+
2070
+ ` + e + `
2071
+
2072
+ `;
2073
+ }
2074
+ };
2075
+ D.listItem = {
2076
+ filter: "li",
2077
+ replacement: function(e, r, t) {
2078
+ e = e.replace(/^\n+/, "").replace(/\n+$/, `
2079
+ `).replace(/\n/gm, `
2080
+ `);
2081
+ var n = t.bulletListMarker + " ", a = r.parentNode;
2082
+ if (a.nodeName === "OL") {
2083
+ var l = a.getAttribute("start"), u = Array.prototype.indexOf.call(a.children, r);
2084
+ n = (l ? Number(l) + u : u + 1) + ". ";
2085
+ }
2086
+ return n + e + (r.nextSibling && !/\n$/.test(e) ? `
2087
+ ` : "");
2088
+ }
2089
+ };
2090
+ D.indentedCodeBlock = {
2091
+ filter: function(e, r) {
2092
+ return r.codeBlockStyle === "indented" && e.nodeName === "PRE" && e.firstChild && e.firstChild.nodeName === "CODE";
2093
+ },
2094
+ replacement: function(e, r, t) {
2095
+ return `
2096
+
2097
+ ` + r.firstChild.textContent.replace(/\n/g, `
2098
+ `) + `
2099
+
2100
+ `;
2101
+ }
2102
+ };
2103
+ D.fencedCodeBlock = {
2104
+ filter: function(e, r) {
2105
+ return r.codeBlockStyle === "fenced" && e.nodeName === "PRE" && e.firstChild && e.firstChild.nodeName === "CODE";
2106
+ },
2107
+ replacement: function(e, r, t) {
2108
+ for (var n = r.firstChild.getAttribute("class") || "", a = (n.match(/language-(\S+)/) || [null, ""])[1], l = r.firstChild.textContent, u = t.fence.charAt(0), o = 3, s = new RegExp("^" + u + "{3,}", "gm"), h; h = s.exec(l); )
2109
+ h[0].length >= o && (o = h[0].length + 1);
2110
+ var i = ur(u, o);
2111
+ return `
2112
+
2113
+ ` + i + a + `
2114
+ ` + l.replace(/\n$/, "") + `
2115
+ ` + i + `
2116
+
2117
+ `;
2118
+ }
2119
+ };
2120
+ D.horizontalRule = {
2121
+ filter: "hr",
2122
+ replacement: function(e, r, t) {
2123
+ return `
2124
+
2125
+ ` + t.hr + `
2126
+
2127
+ `;
2128
+ }
2129
+ };
2130
+ D.inlineLink = {
2131
+ filter: function(e, r) {
2132
+ return r.linkStyle === "inlined" && e.nodeName === "A" && e.getAttribute("href");
2133
+ },
2134
+ replacement: function(e, r) {
2135
+ var t = r.getAttribute("href");
2136
+ t && (t = t.replace(/([()])/g, "\\$1"));
2137
+ var n = ee(r.getAttribute("title"));
2138
+ return n && (n = ' "' + n.replace(/"/g, '\\"') + '"'), "[" + e + "](" + t + n + ")";
2139
+ }
2140
+ };
2141
+ D.referenceLink = {
2142
+ filter: function(e, r) {
2143
+ return r.linkStyle === "referenced" && e.nodeName === "A" && e.getAttribute("href");
2144
+ },
2145
+ replacement: function(e, r, t) {
2146
+ var n = r.getAttribute("href"), a = ee(r.getAttribute("title"));
2147
+ a && (a = ' "' + a + '"');
2148
+ var l, u;
2149
+ switch (t.linkReferenceStyle) {
2150
+ case "collapsed":
2151
+ l = "[" + e + "][]", u = "[" + e + "]: " + n + a;
2152
+ break;
2153
+ case "shortcut":
2154
+ l = "[" + e + "]", u = "[" + e + "]: " + n + a;
2155
+ break;
2156
+ default:
2157
+ var o = this.references.length + 1;
2158
+ l = "[" + e + "][" + o + "]", u = "[" + o + "]: " + n + a;
2159
+ }
2160
+ return this.references.push(u), l;
2161
+ },
2162
+ references: [],
2163
+ append: function(e) {
2164
+ var r = "";
2165
+ return this.references.length && (r = `
2166
+
2167
+ ` + this.references.join(`
2168
+ `) + `
2169
+
2170
+ `, this.references = []), r;
2171
+ }
2172
+ };
2173
+ D.emphasis = {
2174
+ filter: ["em", "i"],
2175
+ replacement: function(e, r, t) {
2176
+ return e.trim() ? t.emDelimiter + e + t.emDelimiter : "";
2177
+ }
2178
+ };
2179
+ D.strong = {
2180
+ filter: ["strong", "b"],
2181
+ replacement: function(e, r, t) {
2182
+ return e.trim() ? t.strongDelimiter + e + t.strongDelimiter : "";
2183
+ }
2184
+ };
2185
+ D.code = {
2186
+ filter: function(e) {
2187
+ var r = e.previousSibling || e.nextSibling, t = e.parentNode.nodeName === "PRE" && !r;
2188
+ return e.nodeName === "CODE" && !t;
2189
+ },
2190
+ replacement: function(e) {
2191
+ if (!e) return "";
2192
+ e = e.replace(/\r?\n|\r/g, " ");
2193
+ for (var r = /^`|^ .*?[^ ].* $|`$/.test(e) ? " " : "", t = "`", n = e.match(/`+/gm) || []; n.indexOf(t) !== -1; ) t = t + "`";
2194
+ return t + r + e + r + t;
2195
+ }
2196
+ };
2197
+ D.image = {
2198
+ filter: "img",
2199
+ replacement: function(e, r) {
2200
+ var t = ee(r.getAttribute("alt")), n = r.getAttribute("src") || "", a = ee(r.getAttribute("title")), l = a ? ' "' + a + '"' : "";
2201
+ return n ? "![" + t + "](" + n + l + ")" : "";
2202
+ }
2203
+ };
2204
+ function ee(e) {
2205
+ return e ? e.replace(/(\n+\s*)+/g, `
2206
+ `) : "";
2207
+ }
2208
+ function xt(e) {
2209
+ this.options = e, this._keep = [], this._remove = [], this.blankRule = {
2210
+ replacement: e.blankReplacement
2211
+ }, this.keepReplacement = e.keepReplacement, this.defaultRule = {
2212
+ replacement: e.defaultReplacement
2213
+ }, this.array = [];
2214
+ for (var r in e.rules) this.array.push(e.rules[r]);
2215
+ }
2216
+ xt.prototype = {
2217
+ add: function(e, r) {
2218
+ this.array.unshift(r);
2219
+ },
2220
+ keep: function(e) {
2221
+ this._keep.unshift({
2222
+ filter: e,
2223
+ replacement: this.keepReplacement
2224
+ });
2225
+ },
2226
+ remove: function(e) {
2227
+ this._remove.unshift({
2228
+ filter: e,
2229
+ replacement: function() {
2230
+ return "";
2231
+ }
2232
+ });
2233
+ },
2234
+ forNode: function(e) {
2235
+ if (e.isBlank) return this.blankRule;
2236
+ var r;
2237
+ return (r = sr(this.array, e, this.options)) || (r = sr(this._keep, e, this.options)) || (r = sr(this._remove, e, this.options)) ? r : this.defaultRule;
2238
+ },
2239
+ forEach: function(e) {
2240
+ for (var r = 0; r < this.array.length; r++) e(this.array[r], r);
2241
+ }
2242
+ };
2243
+ function sr(e, r, t) {
2244
+ for (var n = 0; n < e.length; n++) {
2245
+ var a = e[n];
2246
+ if (bn(a, r, t)) return a;
2247
+ }
2248
+ }
2249
+ function bn(e, r, t) {
2250
+ var n = e.filter;
2251
+ if (typeof n == "string") {
2252
+ if (n === r.nodeName.toLowerCase()) return !0;
2253
+ } else if (Array.isArray(n)) {
2254
+ if (n.indexOf(r.nodeName.toLowerCase()) > -1) return !0;
2255
+ } else if (typeof n == "function") {
2256
+ if (n.call(e, r, t)) return !0;
2257
+ } else
2258
+ throw new TypeError("`filter` needs to be a string, array, or function");
2259
+ }
2260
+ function Pn(e) {
2261
+ var r = e.element, t = e.isBlock, n = e.isVoid, a = e.isPre || function(f) {
2262
+ return f.nodeName === "PRE";
2263
+ };
2264
+ if (!(!r.firstChild || a(r))) {
2265
+ for (var l = null, u = !1, o = null, s = _t(o, r, a); s !== r; ) {
2266
+ if (s.nodeType === 3 || s.nodeType === 4) {
2267
+ var h = s.data.replace(/[ \r\n\t]+/g, " ");
2268
+ if ((!l || / $/.test(l.data)) && !u && h[0] === " " && (h = h.substr(1)), !h) {
2269
+ s = ar(s);
2270
+ continue;
2271
+ }
2272
+ s.data = h, l = s;
2273
+ } else if (s.nodeType === 1)
2274
+ t(s) || s.nodeName === "BR" ? (l && (l.data = l.data.replace(/ $/, "")), l = null, u = !1) : n(s) || a(s) ? (l = null, u = !0) : l && (u = !1);
2275
+ else {
2276
+ s = ar(s);
2277
+ continue;
2278
+ }
2279
+ var i = _t(o, s, a);
2280
+ o = s, s = i;
2281
+ }
2282
+ l && (l.data = l.data.replace(/ $/, ""), l.data || ar(l));
2283
+ }
2284
+ }
2285
+ function ar(e) {
2286
+ var r = e.nextSibling || e.parentNode;
2287
+ return e.parentNode.removeChild(e), r;
2288
+ }
2289
+ function _t(e, r, t) {
2290
+ return e && e.parentNode === r || t(r) ? r.nextSibling || r.parentNode : r.firstChild || r.nextSibling || r.parentNode;
2291
+ }
2292
+ var vr = typeof window < "u" ? window : {};
2293
+ function xn() {
2294
+ var e = vr.DOMParser, r = !1;
2295
+ try {
2296
+ new e().parseFromString("", "text/html") && (r = !0);
2297
+ } catch {
2298
+ }
2299
+ return r;
2300
+ }
2301
+ function qn() {
2302
+ var e = function() {
2303
+ };
2304
+ return Dn() ? e.prototype.parseFromString = function(r) {
2305
+ var t = new window.ActiveXObject("htmlfile");
2306
+ return t.designMode = "on", t.open(), t.write(r), t.close(), t;
2307
+ } : e.prototype.parseFromString = function(r) {
2308
+ var t = document.implementation.createHTMLDocument("");
2309
+ return t.open(), t.write(r), t.close(), t;
2310
+ }, e;
2311
+ }
2312
+ function Dn() {
2313
+ var e = !1;
2314
+ try {
2315
+ document.implementation.createHTMLDocument("").open();
2316
+ } catch {
2317
+ vr.ActiveXObject && (e = !0);
2318
+ }
2319
+ return e;
2320
+ }
2321
+ var Fn = xn() ? vr.DOMParser : qn();
2322
+ function Un(e, r) {
2323
+ var t;
2324
+ if (typeof e == "string") {
2325
+ var n = Bn().parseFromString(
2326
+ // DOM parsers arrange elements in the <head> and <body>.
2327
+ // Wrapping in a custom element ensures elements are reliably arranged in
2328
+ // a single element.
2329
+ '<x-turndown id="turndown-root">' + e + "</x-turndown>",
2330
+ "text/html"
2331
+ );
2332
+ t = n.getElementById("turndown-root");
2333
+ } else
2334
+ t = e.cloneNode(!0);
2335
+ return Pn({
2336
+ element: t,
2337
+ isBlock: dr,
2338
+ isVoid: Ot,
2339
+ isPre: r.preformattedCode ? kn : null
2340
+ }), t;
2341
+ }
2342
+ var or;
2343
+ function Bn() {
2344
+ return or = or || new Fn(), or;
2345
+ }
2346
+ function kn(e) {
2347
+ return e.nodeName === "PRE" || e.nodeName === "CODE";
2348
+ }
2349
+ function Gn(e, r) {
2350
+ return e.isBlock = dr(e), e.isCode = e.nodeName === "CODE" || e.parentNode.isCode, e.isBlank = Mn(e), e.flankingWhitespace = jn(e, r), e;
2351
+ }
2352
+ function Mn(e) {
2353
+ return !Ot(e) && !Cn(e) && /^\s*$/i.test(e.textContent) && !Nn(e) && !On(e);
2354
+ }
2355
+ function jn(e, r) {
2356
+ if (e.isBlock || r.preformattedCode && e.isCode)
2357
+ return { leading: "", trailing: "" };
2358
+ var t = Vn(e.textContent);
2359
+ return t.leadingAscii && It("left", e, r) && (t.leading = t.leadingNonAscii), t.trailingAscii && It("right", e, r) && (t.trailing = t.trailingNonAscii), { leading: t.leading, trailing: t.trailing };
2360
+ }
2361
+ function Vn(e) {
2362
+ var r = e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
2363
+ return {
2364
+ leading: r[1],
2365
+ // whole string for whitespace-only strings
2366
+ leadingAscii: r[2],
2367
+ leadingNonAscii: r[3],
2368
+ trailing: r[4],
2369
+ // empty for whitespace-only strings
2370
+ trailingNonAscii: r[5],
2371
+ trailingAscii: r[6]
2372
+ };
2373
+ }
2374
+ function It(e, r, t) {
2375
+ var n, a, l;
2376
+ return e === "left" ? (n = r.previousSibling, a = / $/) : (n = r.nextSibling, a = /^ /), n && (n.nodeType === 3 ? l = a.test(n.nodeValue) : t.preformattedCode && n.nodeName === "CODE" ? l = !1 : n.nodeType === 1 && !dr(n) && (l = a.test(n.textContent))), l;
2377
+ }
2378
+ var Xn = Array.prototype.reduce, Hn = [
2379
+ [/\\/g, "\\\\"],
2380
+ [/\*/g, "\\*"],
2381
+ [/^-/g, "\\-"],
2382
+ [/^\+ /g, "\\+ "],
2383
+ [/^(=+)/g, "\\$1"],
2384
+ [/^(#{1,6}) /g, "\\$1 "],
2385
+ [/`/g, "\\`"],
2386
+ [/^~~~/g, "\\~~~"],
2387
+ [/\[/g, "\\["],
2388
+ [/\]/g, "\\]"],
2389
+ [/^>/g, "\\>"],
2390
+ [/_/g, "\\_"],
2391
+ [/^(\d+)\. /g, "$1\\. "]
2392
+ ];
2393
+ function H(e) {
2394
+ if (!(this instanceof H)) return new H(e);
2395
+ var r = {
2396
+ rules: D,
2397
+ headingStyle: "setext",
2398
+ hr: "* * *",
2399
+ bulletListMarker: "*",
2400
+ codeBlockStyle: "indented",
2401
+ fence: "```",
2402
+ emDelimiter: "_",
2403
+ strongDelimiter: "**",
2404
+ linkStyle: "inlined",
2405
+ linkReferenceStyle: "full",
2406
+ br: " ",
2407
+ preformattedCode: !1,
2408
+ blankReplacement: function(t, n) {
2409
+ return n.isBlock ? `
2410
+
2411
+ ` : "";
2412
+ },
2413
+ keepReplacement: function(t, n) {
2414
+ return n.isBlock ? `
2415
+
2416
+ ` + n.outerHTML + `
2417
+
2418
+ ` : n.outerHTML;
2419
+ },
2420
+ defaultReplacement: function(t, n) {
2421
+ return n.isBlock ? `
2422
+
2423
+ ` + t + `
2424
+
2425
+ ` : t;
2426
+ }
2427
+ };
2428
+ this.options = Tn({}, r, e), this.rules = new xt(this.options);
2429
+ }
2430
+ H.prototype = {
2431
+ /**
2432
+ * The entry point for converting a string or DOM node to Markdown
2433
+ * @public
2434
+ * @param {String|HTMLElement} input The string or DOM node to convert
2435
+ * @returns A Markdown representation of the input
2436
+ * @type String
2437
+ */
2438
+ turndown: function(e) {
2439
+ if (!Yn(e))
2440
+ throw new TypeError(
2441
+ e + " is not a string, or an element/document/fragment node."
2442
+ );
2443
+ if (e === "") return "";
2444
+ var r = qt.call(this, new Un(e, this.options));
2445
+ return Wn.call(this, r);
2446
+ },
2447
+ /**
2448
+ * Add one or more plugins
2449
+ * @public
2450
+ * @param {Function|Array} plugin The plugin or array of plugins to add
2451
+ * @returns The Turndown instance for chaining
2452
+ * @type Object
2453
+ */
2454
+ use: function(e) {
2455
+ if (Array.isArray(e))
2456
+ for (var r = 0; r < e.length; r++) this.use(e[r]);
2457
+ else if (typeof e == "function")
2458
+ e(this);
2459
+ else
2460
+ throw new TypeError("plugin must be a Function or an Array of Functions");
2461
+ return this;
2462
+ },
2463
+ /**
2464
+ * Adds a rule
2465
+ * @public
2466
+ * @param {String} key The unique key of the rule
2467
+ * @param {Object} rule The rule
2468
+ * @returns The Turndown instance for chaining
2469
+ * @type Object
2470
+ */
2471
+ addRule: function(e, r) {
2472
+ return this.rules.add(e, r), this;
2473
+ },
2474
+ /**
2475
+ * Keep a node (as HTML) that matches the filter
2476
+ * @public
2477
+ * @param {String|Array|Function} filter The unique key of the rule
2478
+ * @returns The Turndown instance for chaining
2479
+ * @type Object
2480
+ */
2481
+ keep: function(e) {
2482
+ return this.rules.keep(e), this;
2483
+ },
2484
+ /**
2485
+ * Remove a node that matches the filter
2486
+ * @public
2487
+ * @param {String|Array|Function} filter The unique key of the rule
2488
+ * @returns The Turndown instance for chaining
2489
+ * @type Object
2490
+ */
2491
+ remove: function(e) {
2492
+ return this.rules.remove(e), this;
2493
+ },
2494
+ /**
2495
+ * Escapes Markdown syntax
2496
+ * @public
2497
+ * @param {String} string The string to escape
2498
+ * @returns A string with Markdown syntax escaped
2499
+ * @type String
2500
+ */
2501
+ escape: function(e) {
2502
+ return Hn.reduce(function(r, t) {
2503
+ return r.replace(t[0], t[1]);
2504
+ }, e);
2505
+ }
2506
+ };
2507
+ function qt(e) {
2508
+ var r = this;
2509
+ return Xn.call(e.childNodes, function(t, n) {
2510
+ n = new Gn(n, r.options);
2511
+ var a = "";
2512
+ return n.nodeType === 3 ? a = n.isCode ? n.nodeValue : r.escape(n.nodeValue) : n.nodeType === 1 && (a = zn.call(r, n)), Dt(t, a);
2513
+ }, "");
2514
+ }
2515
+ function Wn(e) {
2516
+ var r = this;
2517
+ return this.rules.forEach(function(t) {
2518
+ typeof t.append == "function" && (e = Dt(e, t.append(r.options)));
2519
+ }), e.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
2520
+ }
2521
+ function zn(e) {
2522
+ var r = this.rules.forNode(e), t = qt.call(this, e), n = e.flankingWhitespace;
2523
+ return (n.leading || n.trailing) && (t = t.trim()), n.leading + r.replacement(t, e, this.options) + n.trailing;
2524
+ }
2525
+ function Dt(e, r) {
2526
+ var t = Sn(e), n = An(r), a = Math.max(e.length - t.length, r.length - n.length), l = `
2527
+
2528
+ `.substring(0, a);
2529
+ return t + l + n;
2530
+ }
2531
+ function Yn(e) {
2532
+ return e != null && (typeof e == "string" || e.nodeType && (e.nodeType === 1 || e.nodeType === 9 || e.nodeType === 11));
2533
+ }
2534
+ function Qn(e) {
2535
+ try {
2536
+ const r = /<body[^>]*>([\s\S]*?)<\/body>/g, t = [];
2537
+ let n;
2538
+ for (; (n = r.exec(e)) !== null; )
2539
+ t.push(n[1].trim());
2540
+ return t.length === 0 ? (console.log("No body tags found"), []) : t;
2541
+ } catch (r) {
2542
+ return console.error("An error occurred:", r), [];
2543
+ }
2544
+ }
2545
+ function Kn(e) {
2546
+ try {
2547
+ const r = /<article[^>]*>([\s\S]*?)<\/article>/g, t = [];
2548
+ let n;
2549
+ for (; (n = r.exec(e)) !== null; )
2550
+ t.push(n[1].trim());
2551
+ return t.length === 0 ? (console.log("No article tags found"), []) : t;
2552
+ } catch (r) {
2553
+ return console.error("An error occurred:", r), [];
2554
+ }
2555
+ }
2556
+ class Zn extends $t {
2557
+ constructor(r = !1) {
2558
+ super(), this.debug = r;
2559
+ }
2560
+ /**
2561
+ * Fetches URLs from the Stripe Docs sitemap
2562
+ * @returns {Promise<string[]>} Array of URLs from the sitemap
2563
+ */
2564
+ async fetchURLsFromSitemap() {
2565
+ return await new wt({
2566
+ debug: this.debug
2567
+ }).fetchAndProcessSitemap("https://docs.stripe.com/sitemap.xml");
2568
+ }
2569
+ /**
2570
+ * Fetches articles from the sitemap
2571
+ * @param {string} locale Locale for the content
2572
+ * @returns {Promise<StripeDocsArticle[]>} Array of article objects
2573
+ */
2574
+ async fetchArticlesFromSitemap(r) {
2575
+ const t = await this.fetchURLsFromSitemap(), n = [];
2576
+ for await (const a of t) {
2577
+ const u = await (await fetch(`${a}?locale=${r}`)).text(), o = Kn(u), s = u.match(/<title[^>]*>([^<]+)<\/title>/), h = u.match(/<meta[^>]*name="description"[^>]*content="([^"]+)"[^>]*>/), i = s ? s[1].trim() : "Unknown", f = h ? h[1].trim() : "No description";
2578
+ n.push(...o.map((c) => ({ url: a, content: c, title: i, description: f })));
2579
+ }
2580
+ return n;
2581
+ }
2582
+ /**
2583
+ * Loads documents from Stripe Docs
2584
+ * @param {string} locale Locale for the content (defaults to 'en-US')
2585
+ * @returns {Promise<Document[]>} Array of LangChain documents
2586
+ */
2587
+ async load(r = "en-US") {
2588
+ const t = await this.fetchArticlesFromSitemap(r), n = new H();
2589
+ return t.map((l) => {
2590
+ const u = n.turndown(l.content);
2591
+ return new Tt({
2592
+ pageContent: u,
2593
+ metadata: {
2594
+ source: l.url,
2595
+ title: l.title,
2596
+ description: l.description
2597
+ }
2598
+ });
2599
+ });
2600
+ }
2601
+ }
2602
+ class ei extends $t {
2603
+ constructor(r = !1) {
2604
+ super(), this.debug = r;
2605
+ }
2606
+ /**
2607
+ * Fetches URLs from the Stripe.com sitemap
2608
+ * @param {string} resource Optional resource path to filter URLs
2609
+ * @returns {Promise<string[]>} Array of URLs from the sitemap
2610
+ */
2611
+ async fetchURLsFromSitemap(r) {
2612
+ const t = await new wt({
2613
+ debug: this.debug
2614
+ }).fetchAndProcessSitemapIndex(
2615
+ "https://stripe.com/sitemap/sitemap.xml",
2616
+ ["https://stripe.com/", r].filter(Boolean).join("")
2617
+ );
2618
+ return [t[0], t[1]];
2619
+ }
2620
+ /**
2621
+ * Fetches article content from a list of URLs
2622
+ * @param {string[]} urls Array of URLs to fetch content from
2623
+ * @param {string} locale Optional locale for the content
2624
+ * @returns {Promise<StripeDocsArticle[]>} Array of article objects
2625
+ */
2626
+ async fetchArticlesFromURLs(r, t) {
2627
+ const n = [];
2628
+ for await (const a of r) {
2629
+ const u = await (await fetch(`${a}?locale=${t}`)).text(), o = Qn(u), s = u.match(/<title[^>]*>([^<]+)<\/title>/), h = u.match(/<meta[^>]*name="description"[^>]*content="([^"]+)"[^>]*>/), i = s ? s[1].trim() : "Unknown", f = h ? h[1].trim() : "No description";
2630
+ n.push(...o.map((c) => ({ url: a, content: c, title: i, description: f })));
2631
+ }
2632
+ return n;
2633
+ }
2634
+ /**
2635
+ * Fetches articles from the sitemap
2636
+ * @param {string} resource Optional resource path to filter URLs
2637
+ * @param {string} locale Optional locale for the content
2638
+ * @returns {Promise<StripeDocsArticle[]>} Array of article objects
2639
+ */
2640
+ async fetchArticlesFromSitemap(r, t) {
2641
+ const n = await this.fetchURLsFromSitemap(r);
2642
+ return await this.fetchArticlesFromURLs(n, t);
2643
+ }
2644
+ /**
2645
+ * Loads documents from Stripe.com
2646
+ * @param {Object} options Loading options
2647
+ * @param {string} options.resource Optional resource path to filter URLs
2648
+ * @param {string} options.locale Optional locale for the content (defaults to 'en-US')
2649
+ * @param {string[]} options.urls Optional list of specific URLs to load
2650
+ * @returns {Promise<Document[]>} Array of LangChain documents
2651
+ */
2652
+ async load(r) {
2653
+ const { resource: t, urls: n } = r ?? {}, a = (r == null ? void 0 : r.locale) ?? "en-US", l = n ? await this.fetchArticlesFromURLs(n, a) : await this.fetchArticlesFromSitemap(t, a), u = new H();
2654
+ return l.map((s) => {
2655
+ const h = u.turndown(s.content);
2656
+ return new Tt({
2657
+ pageContent: h,
2658
+ metadata: {
2659
+ source: s.url,
2660
+ title: s.title,
2661
+ description: s.description
2662
+ }
2663
+ });
2664
+ });
2665
+ }
2666
+ }
2667
+ export {
2668
+ ei as StripeComDocumentLoader,
2669
+ Zn as StripeDocsDocumentLoader
2670
+ };
2671
+ //# sourceMappingURL=langchain-stripe-loader.js.map