@genome-spy/app 0.56.1 → 0.58.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.
@@ -1,2136 +0,0 @@
1
- import { b as ce } from "./index-B6haPltu.js";
2
- import { _ as Vt } from "./__vite-browser-external-C--ziKoh.js";
3
- import { a as Gt } from "./_commonjsHelpers-DSebQMb9.js";
4
- var He = { exports: {} }, z = typeof Reflect == "object" ? Reflect : null, Je = z && typeof z.apply == "function" ? z.apply : function(e, r, a) {
5
- return Function.prototype.apply.call(e, r, a);
6
- }, ue;
7
- z && typeof z.ownKeys == "function" ? ue = z.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
8
- return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
9
- } : ue = function(e) {
10
- return Object.getOwnPropertyNames(e);
11
- };
12
- function Kt(t) {
13
- console && console.warn && console.warn(t);
14
- }
15
- var bt = Number.isNaN || function(e) {
16
- return e !== e;
17
- };
18
- function q() {
19
- q.init.call(this);
20
- }
21
- He.exports = q;
22
- He.exports.once = Jt;
23
- q.EventEmitter = q;
24
- q.prototype._events = void 0;
25
- q.prototype._eventsCount = 0;
26
- q.prototype._maxListeners = void 0;
27
- var Qe = 10;
28
- function he(t) {
29
- if (typeof t != "function")
30
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t);
31
- }
32
- Object.defineProperty(q, "defaultMaxListeners", {
33
- enumerable: !0,
34
- get: function() {
35
- return Qe;
36
- },
37
- set: function(t) {
38
- if (typeof t != "number" || t < 0 || bt(t))
39
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + ".");
40
- Qe = t;
41
- }
42
- });
43
- q.init = function() {
44
- (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
45
- };
46
- q.prototype.setMaxListeners = function(e) {
47
- if (typeof e != "number" || e < 0 || bt(e))
48
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
49
- return this._maxListeners = e, this;
50
- };
51
- function gt(t) {
52
- return t._maxListeners === void 0 ? q.defaultMaxListeners : t._maxListeners;
53
- }
54
- q.prototype.getMaxListeners = function() {
55
- return gt(this);
56
- };
57
- q.prototype.emit = function(e) {
58
- for (var r = [], a = 1; a < arguments.length; a++) r.push(arguments[a]);
59
- var o = e === "error", s = this._events;
60
- if (s !== void 0)
61
- o = o && s.error === void 0;
62
- else if (!o)
63
- return !1;
64
- if (o) {
65
- var f;
66
- if (r.length > 0 && (f = r[0]), f instanceof Error)
67
- throw f;
68
- var u = new Error("Unhandled error." + (f ? " (" + f.message + ")" : ""));
69
- throw u.context = f, u;
70
- }
71
- var l = s[e];
72
- if (l === void 0)
73
- return !1;
74
- if (typeof l == "function")
75
- Je(l, this, r);
76
- else
77
- for (var h = l.length, g = St(l, h), a = 0; a < h; ++a)
78
- Je(g[a], this, r);
79
- return !0;
80
- };
81
- function yt(t, e, r, a) {
82
- var o, s, f;
83
- if (he(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit(
84
- "newListener",
85
- e,
86
- r.listener ? r.listener : r
87
- ), s = t._events), f = s[e]), f === void 0)
88
- f = s[e] = r, ++t._eventsCount;
89
- else if (typeof f == "function" ? f = s[e] = a ? [r, f] : [f, r] : a ? f.unshift(r) : f.push(r), o = gt(t), o > 0 && f.length > o && !f.warned) {
90
- f.warned = !0;
91
- var u = new Error("Possible EventEmitter memory leak detected. " + f.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
92
- u.name = "MaxListenersExceededWarning", u.emitter = t, u.type = e, u.count = f.length, Kt(u);
93
- }
94
- return t;
95
- }
96
- q.prototype.addListener = function(e, r) {
97
- return yt(this, e, r, !1);
98
- };
99
- q.prototype.on = q.prototype.addListener;
100
- q.prototype.prependListener = function(e, r) {
101
- return yt(this, e, r, !0);
102
- };
103
- function Yt() {
104
- if (!this.fired)
105
- return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
106
- }
107
- function wt(t, e, r) {
108
- var a = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, o = Yt.bind(a);
109
- return o.listener = r, a.wrapFn = o, o;
110
- }
111
- q.prototype.once = function(e, r) {
112
- return he(r), this.on(e, wt(this, e, r)), this;
113
- };
114
- q.prototype.prependOnceListener = function(e, r) {
115
- return he(r), this.prependListener(e, wt(this, e, r)), this;
116
- };
117
- q.prototype.removeListener = function(e, r) {
118
- var a, o, s, f, u;
119
- if (he(r), o = this._events, o === void 0)
120
- return this;
121
- if (a = o[e], a === void 0)
122
- return this;
123
- if (a === r || a.listener === r)
124
- --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete o[e], o.removeListener && this.emit("removeListener", e, a.listener || r));
125
- else if (typeof a != "function") {
126
- for (s = -1, f = a.length - 1; f >= 0; f--)
127
- if (a[f] === r || a[f].listener === r) {
128
- u = a[f].listener, s = f;
129
- break;
130
- }
131
- if (s < 0)
132
- return this;
133
- s === 0 ? a.shift() : zt(a, s), a.length === 1 && (o[e] = a[0]), o.removeListener !== void 0 && this.emit("removeListener", e, u || r);
134
- }
135
- return this;
136
- };
137
- q.prototype.off = q.prototype.removeListener;
138
- q.prototype.removeAllListeners = function(e) {
139
- var r, a, o;
140
- if (a = this._events, a === void 0)
141
- return this;
142
- if (a.removeListener === void 0)
143
- return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : a[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete a[e]), this;
144
- if (arguments.length === 0) {
145
- var s = Object.keys(a), f;
146
- for (o = 0; o < s.length; ++o)
147
- f = s[o], f !== "removeListener" && this.removeAllListeners(f);
148
- return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
149
- }
150
- if (r = a[e], typeof r == "function")
151
- this.removeListener(e, r);
152
- else if (r !== void 0)
153
- for (o = r.length - 1; o >= 0; o--)
154
- this.removeListener(e, r[o]);
155
- return this;
156
- };
157
- function mt(t, e, r) {
158
- var a = t._events;
159
- if (a === void 0)
160
- return [];
161
- var o = a[e];
162
- return o === void 0 ? [] : typeof o == "function" ? r ? [o.listener || o] : [o] : r ? Xt(o) : St(o, o.length);
163
- }
164
- q.prototype.listeners = function(e) {
165
- return mt(this, e, !0);
166
- };
167
- q.prototype.rawListeners = function(e) {
168
- return mt(this, e, !1);
169
- };
170
- q.listenerCount = function(t, e) {
171
- return typeof t.listenerCount == "function" ? t.listenerCount(e) : Et.call(t, e);
172
- };
173
- q.prototype.listenerCount = Et;
174
- function Et(t) {
175
- var e = this._events;
176
- if (e !== void 0) {
177
- var r = e[t];
178
- if (typeof r == "function")
179
- return 1;
180
- if (r !== void 0)
181
- return r.length;
182
- }
183
- return 0;
184
- }
185
- q.prototype.eventNames = function() {
186
- return this._eventsCount > 0 ? ue(this._events) : [];
187
- };
188
- function St(t, e) {
189
- for (var r = new Array(e), a = 0; a < e; ++a)
190
- r[a] = t[a];
191
- return r;
192
- }
193
- function zt(t, e) {
194
- for (; e + 1 < t.length; e++)
195
- t[e] = t[e + 1];
196
- t.pop();
197
- }
198
- function Xt(t) {
199
- for (var e = new Array(t.length), r = 0; r < e.length; ++r)
200
- e[r] = t[r].listener || t[r];
201
- return e;
202
- }
203
- function Jt(t, e) {
204
- return new Promise(function(r, a) {
205
- function o(f) {
206
- t.removeListener(e, s), a(f);
207
- }
208
- function s() {
209
- typeof t.removeListener == "function" && t.removeListener("error", o), r([].slice.call(arguments));
210
- }
211
- Rt(t, e, s, { once: !0 }), e !== "error" && Qt(t, o, { once: !0 });
212
- });
213
- }
214
- function Qt(t, e, r) {
215
- typeof t.on == "function" && Rt(t, "error", e, r);
216
- }
217
- function Rt(t, e, r, a) {
218
- if (typeof t.on == "function")
219
- a.once ? t.once(e, r) : t.on(e, r);
220
- else if (typeof t.addEventListener == "function")
221
- t.addEventListener(e, function o(s) {
222
- a.once && t.removeEventListener(e, o), r(s);
223
- });
224
- else
225
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t);
226
- }
227
- var $e = He.exports, Fe = { exports: {} };
228
- typeof Object.create == "function" ? Fe.exports = function(e, r) {
229
- r && (e.super_ = r, e.prototype = Object.create(r.prototype, {
230
- constructor: {
231
- value: e,
232
- enumerable: !1,
233
- writable: !0,
234
- configurable: !0
235
- }
236
- }));
237
- } : Fe.exports = function(e, r) {
238
- if (r) {
239
- e.super_ = r;
240
- var a = function() {
241
- };
242
- a.prototype = r.prototype, e.prototype = new a(), e.prototype.constructor = e;
243
- }
244
- };
245
- var J = Fe.exports, Se, Ze;
246
- function Lt() {
247
- return Ze || (Ze = 1, Se = $e.EventEmitter), Se;
248
- }
249
- const Tt = /* @__PURE__ */ Gt(Vt);
250
- var Re, et;
251
- function Zt() {
252
- if (et) return Re;
253
- et = 1;
254
- function t(m, S) {
255
- var b = Object.keys(m);
256
- if (Object.getOwnPropertySymbols) {
257
- var w = Object.getOwnPropertySymbols(m);
258
- S && (w = w.filter(function(T) {
259
- return Object.getOwnPropertyDescriptor(m, T).enumerable;
260
- })), b.push.apply(b, w);
261
- }
262
- return b;
263
- }
264
- function e(m) {
265
- for (var S = 1; S < arguments.length; S++) {
266
- var b = arguments[S] != null ? arguments[S] : {};
267
- S % 2 ? t(Object(b), !0).forEach(function(w) {
268
- r(m, w, b[w]);
269
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(m, Object.getOwnPropertyDescriptors(b)) : t(Object(b)).forEach(function(w) {
270
- Object.defineProperty(m, w, Object.getOwnPropertyDescriptor(b, w));
271
- });
272
- }
273
- return m;
274
- }
275
- function r(m, S, b) {
276
- return S = f(S), S in m ? Object.defineProperty(m, S, { value: b, enumerable: !0, configurable: !0, writable: !0 }) : m[S] = b, m;
277
- }
278
- function a(m, S) {
279
- if (!(m instanceof S))
280
- throw new TypeError("Cannot call a class as a function");
281
- }
282
- function o(m, S) {
283
- for (var b = 0; b < S.length; b++) {
284
- var w = S[b];
285
- w.enumerable = w.enumerable || !1, w.configurable = !0, "value" in w && (w.writable = !0), Object.defineProperty(m, f(w.key), w);
286
- }
287
- }
288
- function s(m, S, b) {
289
- return S && o(m.prototype, S), Object.defineProperty(m, "prototype", { writable: !1 }), m;
290
- }
291
- function f(m) {
292
- var S = u(m, "string");
293
- return typeof S == "symbol" ? S : String(S);
294
- }
295
- function u(m, S) {
296
- if (typeof m != "object" || m === null) return m;
297
- var b = m[Symbol.toPrimitive];
298
- if (b !== void 0) {
299
- var w = b.call(m, S || "default");
300
- if (typeof w != "object") return w;
301
- throw new TypeError("@@toPrimitive must return a primitive value.");
302
- }
303
- return (S === "string" ? String : Number)(m);
304
- }
305
- var l = ce, h = l.Buffer, g = Tt, y = g.inspect, _ = y && y.custom || "inspect";
306
- function M(m, S, b) {
307
- h.prototype.copy.call(m, S, b);
308
- }
309
- return Re = /* @__PURE__ */ function() {
310
- function m() {
311
- a(this, m), this.head = null, this.tail = null, this.length = 0;
312
- }
313
- return s(m, [{
314
- key: "push",
315
- value: function(b) {
316
- var w = {
317
- data: b,
318
- next: null
319
- };
320
- this.length > 0 ? this.tail.next = w : this.head = w, this.tail = w, ++this.length;
321
- }
322
- }, {
323
- key: "unshift",
324
- value: function(b) {
325
- var w = {
326
- data: b,
327
- next: this.head
328
- };
329
- this.length === 0 && (this.tail = w), this.head = w, ++this.length;
330
- }
331
- }, {
332
- key: "shift",
333
- value: function() {
334
- if (this.length !== 0) {
335
- var b = this.head.data;
336
- return this.length === 1 ? this.head = this.tail = null : this.head = this.head.next, --this.length, b;
337
- }
338
- }
339
- }, {
340
- key: "clear",
341
- value: function() {
342
- this.head = this.tail = null, this.length = 0;
343
- }
344
- }, {
345
- key: "join",
346
- value: function(b) {
347
- if (this.length === 0) return "";
348
- for (var w = this.head, T = "" + w.data; w = w.next; ) T += b + w.data;
349
- return T;
350
- }
351
- }, {
352
- key: "concat",
353
- value: function(b) {
354
- if (this.length === 0) return h.alloc(0);
355
- for (var w = h.allocUnsafe(b >>> 0), T = this.head, L = 0; T; )
356
- M(T.data, w, L), L += T.data.length, T = T.next;
357
- return w;
358
- }
359
- // Consumes a specified amount of bytes or characters from the buffered data.
360
- }, {
361
- key: "consume",
362
- value: function(b, w) {
363
- var T;
364
- return b < this.head.data.length ? (T = this.head.data.slice(0, b), this.head.data = this.head.data.slice(b)) : b === this.head.data.length ? T = this.shift() : T = w ? this._getString(b) : this._getBuffer(b), T;
365
- }
366
- }, {
367
- key: "first",
368
- value: function() {
369
- return this.head.data;
370
- }
371
- // Consumes a specified amount of characters from the buffered data.
372
- }, {
373
- key: "_getString",
374
- value: function(b) {
375
- var w = this.head, T = 1, L = w.data;
376
- for (b -= L.length; w = w.next; ) {
377
- var R = w.data, A = b > R.length ? R.length : b;
378
- if (A === R.length ? L += R : L += R.slice(0, b), b -= A, b === 0) {
379
- A === R.length ? (++T, w.next ? this.head = w.next : this.head = this.tail = null) : (this.head = w, w.data = R.slice(A));
380
- break;
381
- }
382
- ++T;
383
- }
384
- return this.length -= T, L;
385
- }
386
- // Consumes a specified amount of bytes from the buffered data.
387
- }, {
388
- key: "_getBuffer",
389
- value: function(b) {
390
- var w = h.allocUnsafe(b), T = this.head, L = 1;
391
- for (T.data.copy(w), b -= T.data.length; T = T.next; ) {
392
- var R = T.data, A = b > R.length ? R.length : b;
393
- if (R.copy(w, w.length - b, 0, A), b -= A, b === 0) {
394
- A === R.length ? (++L, T.next ? this.head = T.next : this.head = this.tail = null) : (this.head = T, T.data = R.slice(A));
395
- break;
396
- }
397
- ++L;
398
- }
399
- return this.length -= L, w;
400
- }
401
- // Make sure the linked list only shows the minimal necessary information.
402
- }, {
403
- key: _,
404
- value: function(b, w) {
405
- return y(this, e(e({}, w), {}, {
406
- // Only inspect one level.
407
- depth: 0,
408
- // It should not recurse.
409
- customInspect: !1
410
- }));
411
- }
412
- }]), m;
413
- }(), Re;
414
- }
415
- var Le, tt;
416
- function Ct() {
417
- if (tt) return Le;
418
- tt = 1;
419
- function t(f, u) {
420
- var l = this, h = this._readableState && this._readableState.destroyed, g = this._writableState && this._writableState.destroyed;
421
- return h || g ? (u ? u(f) : f && (this._writableState ? this._writableState.errorEmitted || (this._writableState.errorEmitted = !0, process.nextTick(o, this, f)) : process.nextTick(o, this, f)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(f || null, function(y) {
422
- !u && y ? l._writableState ? l._writableState.errorEmitted ? process.nextTick(r, l) : (l._writableState.errorEmitted = !0, process.nextTick(e, l, y)) : process.nextTick(e, l, y) : u ? (process.nextTick(r, l), u(y)) : process.nextTick(r, l);
423
- }), this);
424
- }
425
- function e(f, u) {
426
- o(f, u), r(f);
427
- }
428
- function r(f) {
429
- f._writableState && !f._writableState.emitClose || f._readableState && !f._readableState.emitClose || f.emit("close");
430
- }
431
- function a() {
432
- this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1);
433
- }
434
- function o(f, u) {
435
- f.emit("error", u);
436
- }
437
- function s(f, u) {
438
- var l = f._readableState, h = f._writableState;
439
- l && l.autoDestroy || h && h.autoDestroy ? f.destroy(u) : f.emit("error", u);
440
- }
441
- return Le = {
442
- destroy: t,
443
- undestroy: a,
444
- errorOrDestroy: s
445
- }, Le;
446
- }
447
- var Te = {}, rt;
448
- function Q() {
449
- if (rt) return Te;
450
- rt = 1;
451
- function t(u, l) {
452
- u.prototype = Object.create(l.prototype), u.prototype.constructor = u, u.__proto__ = l;
453
- }
454
- var e = {};
455
- function r(u, l, h) {
456
- h || (h = Error);
457
- function g(_, M, m) {
458
- return typeof l == "string" ? l : l(_, M, m);
459
- }
460
- var y = /* @__PURE__ */ function(_) {
461
- t(M, _);
462
- function M(m, S, b) {
463
- return _.call(this, g(m, S, b)) || this;
464
- }
465
- return M;
466
- }(h);
467
- y.prototype.name = h.name, y.prototype.code = u, e[u] = y;
468
- }
469
- function a(u, l) {
470
- if (Array.isArray(u)) {
471
- var h = u.length;
472
- return u = u.map(function(g) {
473
- return String(g);
474
- }), h > 2 ? "one of ".concat(l, " ").concat(u.slice(0, h - 1).join(", "), ", or ") + u[h - 1] : h === 2 ? "one of ".concat(l, " ").concat(u[0], " or ").concat(u[1]) : "of ".concat(l, " ").concat(u[0]);
475
- } else
476
- return "of ".concat(l, " ").concat(String(u));
477
- }
478
- function o(u, l, h) {
479
- return u.substr(0, l.length) === l;
480
- }
481
- function s(u, l, h) {
482
- return (h === void 0 || h > u.length) && (h = u.length), u.substring(h - l.length, h) === l;
483
- }
484
- function f(u, l, h) {
485
- return typeof h != "number" && (h = 0), h + l.length > u.length ? !1 : u.indexOf(l, h) !== -1;
486
- }
487
- return r("ERR_INVALID_OPT_VALUE", function(u, l) {
488
- return 'The value "' + l + '" is invalid for option "' + u + '"';
489
- }, TypeError), r("ERR_INVALID_ARG_TYPE", function(u, l, h) {
490
- var g;
491
- typeof l == "string" && o(l, "not ") ? (g = "must not be", l = l.replace(/^not /, "")) : g = "must be";
492
- var y;
493
- if (s(u, " argument"))
494
- y = "The ".concat(u, " ").concat(g, " ").concat(a(l, "type"));
495
- else {
496
- var _ = f(u, ".") ? "property" : "argument";
497
- y = 'The "'.concat(u, '" ').concat(_, " ").concat(g, " ").concat(a(l, "type"));
498
- }
499
- return y += ". Received type ".concat(typeof h), y;
500
- }, TypeError), r("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), r("ERR_METHOD_NOT_IMPLEMENTED", function(u) {
501
- return "The " + u + " method is not implemented";
502
- }), r("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), r("ERR_STREAM_DESTROYED", function(u) {
503
- return "Cannot call " + u + " after a stream was destroyed";
504
- }), r("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), r("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), r("ERR_STREAM_WRITE_AFTER_END", "write after end"), r("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), r("ERR_UNKNOWN_ENCODING", function(u) {
505
- return "Unknown encoding: " + u;
506
- }, TypeError), r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), Te.codes = e, Te;
507
- }
508
- var Ce, nt;
509
- function At() {
510
- if (nt) return Ce;
511
- nt = 1;
512
- var t = Q().codes.ERR_INVALID_OPT_VALUE;
513
- function e(a, o, s) {
514
- return a.highWaterMark != null ? a.highWaterMark : o ? a[s] : null;
515
- }
516
- function r(a, o, s, f) {
517
- var u = e(o, f, s);
518
- if (u != null) {
519
- if (!(isFinite(u) && Math.floor(u) === u) || u < 0) {
520
- var l = f ? s : "highWaterMark";
521
- throw new t(l, u);
522
- }
523
- return Math.floor(u);
524
- }
525
- return a.objectMode ? 16 : 16 * 1024;
526
- }
527
- return Ce = {
528
- getHighWaterMark: r
529
- }, Ce;
530
- }
531
- var Ae, it;
532
- function er() {
533
- if (it) return Ae;
534
- it = 1, Ae = t;
535
- function t(r, a) {
536
- if (e("noDeprecation"))
537
- return r;
538
- var o = !1;
539
- function s() {
540
- if (!o) {
541
- if (e("throwDeprecation"))
542
- throw new Error(a);
543
- e("traceDeprecation") ? console.trace(a) : console.warn(a), o = !0;
544
- }
545
- return r.apply(this, arguments);
546
- }
547
- return s;
548
- }
549
- function e(r) {
550
- try {
551
- if (!globalThis.localStorage) return !1;
552
- } catch {
553
- return !1;
554
- }
555
- var a = globalThis.localStorage[r];
556
- return a == null ? !1 : String(a).toLowerCase() === "true";
557
- }
558
- return Ae;
559
- }
560
- var Me, at;
561
- function Mt() {
562
- if (at) return Me;
563
- at = 1, Me = N;
564
- function t(c) {
565
- var d = this;
566
- this.next = null, this.entry = null, this.finish = function() {
567
- ye(d, c);
568
- };
569
- }
570
- var e;
571
- N.WritableState = O;
572
- var r = {
573
- deprecate: er()
574
- }, a = Lt(), o = ce.Buffer, s = (typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
575
- };
576
- function f(c) {
577
- return o.from(c);
578
- }
579
- function u(c) {
580
- return o.isBuffer(c) || c instanceof s;
581
- }
582
- var l = Ct(), h = At(), g = h.getHighWaterMark, y = Q().codes, _ = y.ERR_INVALID_ARG_TYPE, M = y.ERR_METHOD_NOT_IMPLEMENTED, m = y.ERR_MULTIPLE_CALLBACK, S = y.ERR_STREAM_CANNOT_PIPE, b = y.ERR_STREAM_DESTROYED, w = y.ERR_STREAM_NULL_VALUES, T = y.ERR_STREAM_WRITE_AFTER_END, L = y.ERR_UNKNOWN_ENCODING, R = l.errorOrDestroy;
583
- J(N, a);
584
- function A() {
585
- }
586
- function O(c, d, v) {
587
- e = e || X(), c = c || {}, typeof v != "boolean" && (v = d instanceof e), this.objectMode = !!c.objectMode, v && (this.objectMode = this.objectMode || !!c.writableObjectMode), this.highWaterMark = g(this, c, "writableHighWaterMark", v), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
588
- var C = c.decodeStrings === !1;
589
- this.decodeStrings = !C, this.defaultEncoding = c.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(P) {
590
- _e(d, P);
591
- }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = c.emitClose !== !1, this.autoDestroy = !!c.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new t(this);
592
- }
593
- O.prototype.getBuffer = function() {
594
- for (var d = this.bufferedRequest, v = []; d; )
595
- v.push(d), d = d.next;
596
- return v;
597
- }, function() {
598
- try {
599
- Object.defineProperty(O.prototype, "buffer", {
600
- get: r.deprecate(function() {
601
- return this.getBuffer();
602
- }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
603
- });
604
- } catch {
605
- }
606
- }();
607
- var I;
608
- typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (I = Function.prototype[Symbol.hasInstance], Object.defineProperty(N, Symbol.hasInstance, {
609
- value: function(d) {
610
- return I.call(this, d) ? !0 : this !== N ? !1 : d && d._writableState instanceof O;
611
- }
612
- })) : I = function(d) {
613
- return d instanceof this;
614
- };
615
- function N(c) {
616
- e = e || X();
617
- var d = this instanceof e;
618
- if (!d && !I.call(N, this)) return new N(c);
619
- this._writableState = new O(c, this, d), this.writable = !0, c && (typeof c.write == "function" && (this._write = c.write), typeof c.writev == "function" && (this._writev = c.writev), typeof c.destroy == "function" && (this._destroy = c.destroy), typeof c.final == "function" && (this._final = c.final)), a.call(this);
620
- }
621
- N.prototype.pipe = function() {
622
- R(this, new S());
623
- };
624
- function D(c, d) {
625
- var v = new T();
626
- R(c, v), process.nextTick(d, v);
627
- }
628
- function B(c, d, v, C) {
629
- var P;
630
- return v === null ? P = new w() : typeof v != "string" && !d.objectMode && (P = new _("chunk", ["string", "Buffer"], v)), P ? (R(c, P), process.nextTick(C, P), !1) : !0;
631
- }
632
- N.prototype.write = function(c, d, v) {
633
- var C = this._writableState, P = !1, n = !C.objectMode && u(c);
634
- return n && !o.isBuffer(c) && (c = f(c)), typeof d == "function" && (v = d, d = null), n ? d = "buffer" : d || (d = C.defaultEncoding), typeof v != "function" && (v = A), C.ending ? D(this, v) : (n || B(this, C, c, v)) && (C.pendingcb++, P = pe(this, C, n, c, d, v)), P;
635
- }, N.prototype.cork = function() {
636
- this._writableState.corked++;
637
- }, N.prototype.uncork = function() {
638
- var c = this._writableState;
639
- c.corked && (c.corked--, !c.writing && !c.corked && !c.bufferProcessing && c.bufferedRequest && V(this, c));
640
- }, N.prototype.setDefaultEncoding = function(d) {
641
- if (typeof d == "string" && (d = d.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((d + "").toLowerCase()) > -1)) throw new L(d);
642
- return this._writableState.defaultEncoding = d, this;
643
- }, Object.defineProperty(N.prototype, "writableBuffer", {
644
- // making it explicit this property is not enumerable
645
- // because otherwise some prototype manipulation in
646
- // userland will fail
647
- enumerable: !1,
648
- get: function() {
649
- return this._writableState && this._writableState.getBuffer();
650
- }
651
- });
652
- function Z(c, d, v) {
653
- return !c.objectMode && c.decodeStrings !== !1 && typeof d == "string" && (d = o.from(d, v)), d;
654
- }
655
- Object.defineProperty(N.prototype, "writableHighWaterMark", {
656
- // making it explicit this property is not enumerable
657
- // because otherwise some prototype manipulation in
658
- // userland will fail
659
- enumerable: !1,
660
- get: function() {
661
- return this._writableState.highWaterMark;
662
- }
663
- });
664
- function pe(c, d, v, C, P, n) {
665
- if (!v) {
666
- var i = Z(d, C, P);
667
- C !== i && (v = !0, P = "buffer", C = i);
668
- }
669
- var p = d.objectMode ? 1 : C.length;
670
- d.length += p;
671
- var E = d.length < d.highWaterMark;
672
- if (E || (d.needDrain = !0), d.writing || d.corked) {
673
- var j = d.lastBufferedRequest;
674
- d.lastBufferedRequest = {
675
- chunk: C,
676
- encoding: P,
677
- isBuf: v,
678
- callback: n,
679
- next: null
680
- }, j ? j.next = d.lastBufferedRequest : d.bufferedRequest = d.lastBufferedRequest, d.bufferedRequestCount += 1;
681
- } else
682
- $(c, d, !1, p, C, P, n);
683
- return E;
684
- }
685
- function $(c, d, v, C, P, n, i) {
686
- d.writelen = C, d.writecb = i, d.writing = !0, d.sync = !0, d.destroyed ? d.onwrite(new b("write")) : v ? c._writev(P, d.onwrite) : c._write(P, n, d.onwrite), d.sync = !1;
687
- }
688
- function ve(c, d, v, C, P) {
689
- --d.pendingcb, v ? (process.nextTick(P, C), process.nextTick(H, c, d), c._writableState.errorEmitted = !0, R(c, C)) : (P(C), c._writableState.errorEmitted = !0, R(c, C), H(c, d));
690
- }
691
- function ie(c) {
692
- c.writing = !1, c.writecb = null, c.length -= c.writelen, c.writelen = 0;
693
- }
694
- function _e(c, d) {
695
- var v = c._writableState, C = v.sync, P = v.writecb;
696
- if (typeof P != "function") throw new m();
697
- if (ie(v), d) ve(c, v, C, d, P);
698
- else {
699
- var n = se(v) || c.destroyed;
700
- !n && !v.corked && !v.bufferProcessing && v.bufferedRequest && V(c, v), C ? process.nextTick(U, c, v, n, P) : U(c, v, n, P);
701
- }
702
- }
703
- function U(c, d, v, C) {
704
- v || ae(c, d), d.pendingcb--, C(), H(c, d);
705
- }
706
- function ae(c, d) {
707
- d.length === 0 && d.needDrain && (d.needDrain = !1, c.emit("drain"));
708
- }
709
- function V(c, d) {
710
- d.bufferProcessing = !0;
711
- var v = d.bufferedRequest;
712
- if (c._writev && v && v.next) {
713
- var C = d.bufferedRequestCount, P = new Array(C), n = d.corkedRequestsFree;
714
- n.entry = v;
715
- for (var i = 0, p = !0; v; )
716
- P[i] = v, v.isBuf || (p = !1), v = v.next, i += 1;
717
- P.allBuffers = p, $(c, d, !0, d.length, P, "", n.finish), d.pendingcb++, d.lastBufferedRequest = null, n.next ? (d.corkedRequestsFree = n.next, n.next = null) : d.corkedRequestsFree = new t(d), d.bufferedRequestCount = 0;
718
- } else {
719
- for (; v; ) {
720
- var E = v.chunk, j = v.encoding, x = v.callback, k = d.objectMode ? 1 : E.length;
721
- if ($(c, d, !1, k, E, j, x), v = v.next, d.bufferedRequestCount--, d.writing)
722
- break;
723
- }
724
- v === null && (d.lastBufferedRequest = null);
725
- }
726
- d.bufferedRequest = v, d.bufferProcessing = !1;
727
- }
728
- N.prototype._write = function(c, d, v) {
729
- v(new M("_write()"));
730
- }, N.prototype._writev = null, N.prototype.end = function(c, d, v) {
731
- var C = this._writableState;
732
- return typeof c == "function" ? (v = c, c = null, d = null) : typeof d == "function" && (v = d, d = null), c != null && this.write(c, d), C.corked && (C.corked = 1, this.uncork()), C.ending || ge(this, C, v), this;
733
- }, Object.defineProperty(N.prototype, "writableLength", {
734
- // making it explicit this property is not enumerable
735
- // because otherwise some prototype manipulation in
736
- // userland will fail
737
- enumerable: !1,
738
- get: function() {
739
- return this._writableState.length;
740
- }
741
- });
742
- function se(c) {
743
- return c.ending && c.length === 0 && c.bufferedRequest === null && !c.finished && !c.writing;
744
- }
745
- function be(c, d) {
746
- c._final(function(v) {
747
- d.pendingcb--, v && R(c, v), d.prefinished = !0, c.emit("prefinish"), H(c, d);
748
- });
749
- }
750
- function oe(c, d) {
751
- !d.prefinished && !d.finalCalled && (typeof c._final == "function" && !d.destroyed ? (d.pendingcb++, d.finalCalled = !0, process.nextTick(be, c, d)) : (d.prefinished = !0, c.emit("prefinish")));
752
- }
753
- function H(c, d) {
754
- var v = se(d);
755
- if (v && (oe(c, d), d.pendingcb === 0 && (d.finished = !0, c.emit("finish"), d.autoDestroy))) {
756
- var C = c._readableState;
757
- (!C || C.autoDestroy && C.endEmitted) && c.destroy();
758
- }
759
- return v;
760
- }
761
- function ge(c, d, v) {
762
- d.ending = !0, H(c, d), v && (d.finished ? process.nextTick(v) : c.once("finish", v)), d.ended = !0, c.writable = !1;
763
- }
764
- function ye(c, d, v) {
765
- var C = c.entry;
766
- for (c.entry = null; C; ) {
767
- var P = C.callback;
768
- d.pendingcb--, P(v), C = C.next;
769
- }
770
- d.corkedRequestsFree.next = c;
771
- }
772
- return Object.defineProperty(N.prototype, "destroyed", {
773
- // making it explicit this property is not enumerable
774
- // because otherwise some prototype manipulation in
775
- // userland will fail
776
- enumerable: !1,
777
- get: function() {
778
- return this._writableState === void 0 ? !1 : this._writableState.destroyed;
779
- },
780
- set: function(d) {
781
- this._writableState && (this._writableState.destroyed = d);
782
- }
783
- }), N.prototype.destroy = l.destroy, N.prototype._undestroy = l.undestroy, N.prototype._destroy = function(c, d) {
784
- d(c);
785
- }, Me;
786
- }
787
- var Oe, st;
788
- function X() {
789
- if (st) return Oe;
790
- st = 1;
791
- var t = Object.keys || function(h) {
792
- var g = [];
793
- for (var y in h) g.push(y);
794
- return g;
795
- };
796
- Oe = f;
797
- var e = Ot(), r = Mt();
798
- J(f, e);
799
- for (var a = t(r.prototype), o = 0; o < a.length; o++) {
800
- var s = a[o];
801
- f.prototype[s] || (f.prototype[s] = r.prototype[s]);
802
- }
803
- function f(h) {
804
- if (!(this instanceof f)) return new f(h);
805
- e.call(this, h), r.call(this, h), this.allowHalfOpen = !0, h && (h.readable === !1 && (this.readable = !1), h.writable === !1 && (this.writable = !1), h.allowHalfOpen === !1 && (this.allowHalfOpen = !1, this.once("end", u)));
806
- }
807
- Object.defineProperty(f.prototype, "writableHighWaterMark", {
808
- // making it explicit this property is not enumerable
809
- // because otherwise some prototype manipulation in
810
- // userland will fail
811
- enumerable: !1,
812
- get: function() {
813
- return this._writableState.highWaterMark;
814
- }
815
- }), Object.defineProperty(f.prototype, "writableBuffer", {
816
- // making it explicit this property is not enumerable
817
- // because otherwise some prototype manipulation in
818
- // userland will fail
819
- enumerable: !1,
820
- get: function() {
821
- return this._writableState && this._writableState.getBuffer();
822
- }
823
- }), Object.defineProperty(f.prototype, "writableLength", {
824
- // making it explicit this property is not enumerable
825
- // because otherwise some prototype manipulation in
826
- // userland will fail
827
- enumerable: !1,
828
- get: function() {
829
- return this._writableState.length;
830
- }
831
- });
832
- function u() {
833
- this._writableState.ended || process.nextTick(l, this);
834
- }
835
- function l(h) {
836
- h.end();
837
- }
838
- return Object.defineProperty(f.prototype, "destroyed", {
839
- // making it explicit this property is not enumerable
840
- // because otherwise some prototype manipulation in
841
- // userland will fail
842
- enumerable: !1,
843
- get: function() {
844
- return this._readableState === void 0 || this._writableState === void 0 ? !1 : this._readableState.destroyed && this._writableState.destroyed;
845
- },
846
- set: function(g) {
847
- this._readableState === void 0 || this._writableState === void 0 || (this._readableState.destroyed = g, this._writableState.destroyed = g);
848
- }
849
- }), Oe;
850
- }
851
- var Be = {}, We = { exports: {} };
852
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
853
- (function(t, e) {
854
- var r = ce, a = r.Buffer;
855
- function o(f, u) {
856
- for (var l in f)
857
- u[l] = f[l];
858
- }
859
- a.from && a.alloc && a.allocUnsafe && a.allocUnsafeSlow ? t.exports = r : (o(r, e), e.Buffer = s);
860
- function s(f, u, l) {
861
- return a(f, u, l);
862
- }
863
- s.prototype = Object.create(a.prototype), o(a, s), s.from = function(f, u, l) {
864
- if (typeof f == "number")
865
- throw new TypeError("Argument must not be a number");
866
- return a(f, u, l);
867
- }, s.alloc = function(f, u, l) {
868
- if (typeof f != "number")
869
- throw new TypeError("Argument must be a number");
870
- var h = a(f);
871
- return u !== void 0 ? typeof l == "string" ? h.fill(u, l) : h.fill(u) : h.fill(0), h;
872
- }, s.allocUnsafe = function(f) {
873
- if (typeof f != "number")
874
- throw new TypeError("Argument must be a number");
875
- return a(f);
876
- }, s.allocUnsafeSlow = function(f) {
877
- if (typeof f != "number")
878
- throw new TypeError("Argument must be a number");
879
- return r.SlowBuffer(f);
880
- };
881
- })(We, We.exports);
882
- var tr = We.exports, Ve = tr.Buffer, ot = Ve.isEncoding || function(t) {
883
- switch (t = "" + t, t && t.toLowerCase()) {
884
- case "hex":
885
- case "utf8":
886
- case "utf-8":
887
- case "ascii":
888
- case "binary":
889
- case "base64":
890
- case "ucs2":
891
- case "ucs-2":
892
- case "utf16le":
893
- case "utf-16le":
894
- case "raw":
895
- return !0;
896
- default:
897
- return !1;
898
- }
899
- };
900
- function rr(t) {
901
- if (!t) return "utf8";
902
- for (var e; ; )
903
- switch (t) {
904
- case "utf8":
905
- case "utf-8":
906
- return "utf8";
907
- case "ucs2":
908
- case "ucs-2":
909
- case "utf16le":
910
- case "utf-16le":
911
- return "utf16le";
912
- case "latin1":
913
- case "binary":
914
- return "latin1";
915
- case "base64":
916
- case "ascii":
917
- case "hex":
918
- return t;
919
- default:
920
- if (e) return;
921
- t = ("" + t).toLowerCase(), e = !0;
922
- }
923
- }
924
- function nr(t) {
925
- var e = rr(t);
926
- if (typeof e != "string" && (Ve.isEncoding === ot || !ot(t))) throw new Error("Unknown encoding: " + t);
927
- return e || t;
928
- }
929
- var ir = Be.StringDecoder = ne;
930
- function ne(t) {
931
- this.encoding = nr(t);
932
- var e;
933
- switch (this.encoding) {
934
- case "utf16le":
935
- this.text = lr, this.end = dr, e = 4;
936
- break;
937
- case "utf8":
938
- this.fillLast = or, e = 4;
939
- break;
940
- case "base64":
941
- this.text = cr, this.end = hr, e = 3;
942
- break;
943
- default:
944
- this.write = pr, this.end = vr;
945
- return;
946
- }
947
- this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Ve.allocUnsafe(e);
948
- }
949
- ne.prototype.write = function(t) {
950
- if (t.length === 0) return "";
951
- var e, r;
952
- if (this.lastNeed) {
953
- if (e = this.fillLast(t), e === void 0) return "";
954
- r = this.lastNeed, this.lastNeed = 0;
955
- } else
956
- r = 0;
957
- return r < t.length ? e ? e + this.text(t, r) : this.text(t, r) : e || "";
958
- };
959
- ne.prototype.end = ur;
960
- ne.prototype.text = fr;
961
- ne.prototype.fillLast = function(t) {
962
- if (this.lastNeed <= t.length)
963
- return t.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
964
- t.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, t.length), this.lastNeed -= t.length;
965
- };
966
- function De(t) {
967
- return t <= 127 ? 0 : t >> 5 === 6 ? 2 : t >> 4 === 14 ? 3 : t >> 3 === 30 ? 4 : t >> 6 === 2 ? -1 : -2;
968
- }
969
- function ar(t, e, r) {
970
- var a = e.length - 1;
971
- if (a < r) return 0;
972
- var o = De(e[a]);
973
- return o >= 0 ? (o > 0 && (t.lastNeed = o - 1), o) : --a < r || o === -2 ? 0 : (o = De(e[a]), o >= 0 ? (o > 0 && (t.lastNeed = o - 2), o) : --a < r || o === -2 ? 0 : (o = De(e[a]), o >= 0 ? (o > 0 && (o === 2 ? o = 0 : t.lastNeed = o - 3), o) : 0));
974
- }
975
- function sr(t, e, r) {
976
- if ((e[0] & 192) !== 128)
977
- return t.lastNeed = 0, "�";
978
- if (t.lastNeed > 1 && e.length > 1) {
979
- if ((e[1] & 192) !== 128)
980
- return t.lastNeed = 1, "�";
981
- if (t.lastNeed > 2 && e.length > 2 && (e[2] & 192) !== 128)
982
- return t.lastNeed = 2, "�";
983
- }
984
- }
985
- function or(t) {
986
- var e = this.lastTotal - this.lastNeed, r = sr(this, t);
987
- if (r !== void 0) return r;
988
- if (this.lastNeed <= t.length)
989
- return t.copy(this.lastChar, e, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
990
- t.copy(this.lastChar, e, 0, t.length), this.lastNeed -= t.length;
991
- }
992
- function fr(t, e) {
993
- var r = ar(this, t, e);
994
- if (!this.lastNeed) return t.toString("utf8", e);
995
- this.lastTotal = r;
996
- var a = t.length - (r - this.lastNeed);
997
- return t.copy(this.lastChar, 0, a), t.toString("utf8", e, a);
998
- }
999
- function ur(t) {
1000
- var e = t && t.length ? this.write(t) : "";
1001
- return this.lastNeed ? e + "�" : e;
1002
- }
1003
- function lr(t, e) {
1004
- if ((t.length - e) % 2 === 0) {
1005
- var r = t.toString("utf16le", e);
1006
- if (r) {
1007
- var a = r.charCodeAt(r.length - 1);
1008
- if (a >= 55296 && a <= 56319)
1009
- return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = t[t.length - 2], this.lastChar[1] = t[t.length - 1], r.slice(0, -1);
1010
- }
1011
- return r;
1012
- }
1013
- return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = t[t.length - 1], t.toString("utf16le", e, t.length - 1);
1014
- }
1015
- function dr(t) {
1016
- var e = t && t.length ? this.write(t) : "";
1017
- if (this.lastNeed) {
1018
- var r = this.lastTotal - this.lastNeed;
1019
- return e + this.lastChar.toString("utf16le", 0, r);
1020
- }
1021
- return e;
1022
- }
1023
- function cr(t, e) {
1024
- var r = (t.length - e) % 3;
1025
- return r === 0 ? t.toString("base64", e) : (this.lastNeed = 3 - r, this.lastTotal = 3, r === 1 ? this.lastChar[0] = t[t.length - 1] : (this.lastChar[0] = t[t.length - 2], this.lastChar[1] = t[t.length - 1]), t.toString("base64", e, t.length - r));
1026
- }
1027
- function hr(t) {
1028
- var e = t && t.length ? this.write(t) : "";
1029
- return this.lastNeed ? e + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : e;
1030
- }
1031
- function pr(t) {
1032
- return t.toString(this.encoding);
1033
- }
1034
- function vr(t) {
1035
- return t && t.length ? this.write(t) : "";
1036
- }
1037
- var xe, ft;
1038
- function Ge() {
1039
- if (ft) return xe;
1040
- ft = 1;
1041
- var t = Q().codes.ERR_STREAM_PREMATURE_CLOSE;
1042
- function e(s) {
1043
- var f = !1;
1044
- return function() {
1045
- if (!f) {
1046
- f = !0;
1047
- for (var u = arguments.length, l = new Array(u), h = 0; h < u; h++)
1048
- l[h] = arguments[h];
1049
- s.apply(this, l);
1050
- }
1051
- };
1052
- }
1053
- function r() {
1054
- }
1055
- function a(s) {
1056
- return s.setHeader && typeof s.abort == "function";
1057
- }
1058
- function o(s, f, u) {
1059
- if (typeof f == "function") return o(s, null, f);
1060
- f || (f = {}), u = e(u || r);
1061
- var l = f.readable || f.readable !== !1 && s.readable, h = f.writable || f.writable !== !1 && s.writable, g = function() {
1062
- s.writable || _();
1063
- }, y = s._writableState && s._writableState.finished, _ = function() {
1064
- h = !1, y = !0, l || u.call(s);
1065
- }, M = s._readableState && s._readableState.endEmitted, m = function() {
1066
- l = !1, M = !0, h || u.call(s);
1067
- }, S = function(L) {
1068
- u.call(s, L);
1069
- }, b = function() {
1070
- var L;
1071
- if (l && !M)
1072
- return (!s._readableState || !s._readableState.ended) && (L = new t()), u.call(s, L);
1073
- if (h && !y)
1074
- return (!s._writableState || !s._writableState.ended) && (L = new t()), u.call(s, L);
1075
- }, w = function() {
1076
- s.req.on("finish", _);
1077
- };
1078
- return a(s) ? (s.on("complete", _), s.on("abort", b), s.req ? w() : s.on("request", w)) : h && !s._writableState && (s.on("end", g), s.on("close", g)), s.on("end", m), s.on("finish", _), f.error !== !1 && s.on("error", S), s.on("close", b), function() {
1079
- s.removeListener("complete", _), s.removeListener("abort", b), s.removeListener("request", w), s.req && s.req.removeListener("finish", _), s.removeListener("end", g), s.removeListener("close", g), s.removeListener("finish", _), s.removeListener("end", m), s.removeListener("error", S), s.removeListener("close", b);
1080
- };
1081
- }
1082
- return xe = o, xe;
1083
- }
1084
- var Pe, ut;
1085
- function _r() {
1086
- if (ut) return Pe;
1087
- ut = 1;
1088
- var t;
1089
- function e(L, R, A) {
1090
- return R = r(R), R in L ? Object.defineProperty(L, R, { value: A, enumerable: !0, configurable: !0, writable: !0 }) : L[R] = A, L;
1091
- }
1092
- function r(L) {
1093
- var R = a(L, "string");
1094
- return typeof R == "symbol" ? R : String(R);
1095
- }
1096
- function a(L, R) {
1097
- if (typeof L != "object" || L === null) return L;
1098
- var A = L[Symbol.toPrimitive];
1099
- if (A !== void 0) {
1100
- var O = A.call(L, R || "default");
1101
- if (typeof O != "object") return O;
1102
- throw new TypeError("@@toPrimitive must return a primitive value.");
1103
- }
1104
- return (R === "string" ? String : Number)(L);
1105
- }
1106
- var o = Ge(), s = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), h = Symbol("lastPromise"), g = Symbol("handlePromise"), y = Symbol("stream");
1107
- function _(L, R) {
1108
- return {
1109
- value: L,
1110
- done: R
1111
- };
1112
- }
1113
- function M(L) {
1114
- var R = L[s];
1115
- if (R !== null) {
1116
- var A = L[y].read();
1117
- A !== null && (L[h] = null, L[s] = null, L[f] = null, R(_(A, !1)));
1118
- }
1119
- }
1120
- function m(L) {
1121
- process.nextTick(M, L);
1122
- }
1123
- function S(L, R) {
1124
- return function(A, O) {
1125
- L.then(function() {
1126
- if (R[l]) {
1127
- A(_(void 0, !0));
1128
- return;
1129
- }
1130
- R[g](A, O);
1131
- }, O);
1132
- };
1133
- }
1134
- var b = Object.getPrototypeOf(function() {
1135
- }), w = Object.setPrototypeOf((t = {
1136
- get stream() {
1137
- return this[y];
1138
- },
1139
- next: function() {
1140
- var R = this, A = this[u];
1141
- if (A !== null)
1142
- return Promise.reject(A);
1143
- if (this[l])
1144
- return Promise.resolve(_(void 0, !0));
1145
- if (this[y].destroyed)
1146
- return new Promise(function(D, B) {
1147
- process.nextTick(function() {
1148
- R[u] ? B(R[u]) : D(_(void 0, !0));
1149
- });
1150
- });
1151
- var O = this[h], I;
1152
- if (O)
1153
- I = new Promise(S(O, this));
1154
- else {
1155
- var N = this[y].read();
1156
- if (N !== null)
1157
- return Promise.resolve(_(N, !1));
1158
- I = new Promise(this[g]);
1159
- }
1160
- return this[h] = I, I;
1161
- }
1162
- }, e(t, Symbol.asyncIterator, function() {
1163
- return this;
1164
- }), e(t, "return", function() {
1165
- var R = this;
1166
- return new Promise(function(A, O) {
1167
- R[y].destroy(null, function(I) {
1168
- if (I) {
1169
- O(I);
1170
- return;
1171
- }
1172
- A(_(void 0, !0));
1173
- });
1174
- });
1175
- }), t), b), T = function(R) {
1176
- var A, O = Object.create(w, (A = {}, e(A, y, {
1177
- value: R,
1178
- writable: !0
1179
- }), e(A, s, {
1180
- value: null,
1181
- writable: !0
1182
- }), e(A, f, {
1183
- value: null,
1184
- writable: !0
1185
- }), e(A, u, {
1186
- value: null,
1187
- writable: !0
1188
- }), e(A, l, {
1189
- value: R._readableState.endEmitted,
1190
- writable: !0
1191
- }), e(A, g, {
1192
- value: function(N, D) {
1193
- var B = O[y].read();
1194
- B ? (O[h] = null, O[s] = null, O[f] = null, N(_(B, !1))) : (O[s] = N, O[f] = D);
1195
- },
1196
- writable: !0
1197
- }), A));
1198
- return O[h] = null, o(R, function(I) {
1199
- if (I && I.code !== "ERR_STREAM_PREMATURE_CLOSE") {
1200
- var N = O[f];
1201
- N !== null && (O[h] = null, O[s] = null, O[f] = null, N(I)), O[u] = I;
1202
- return;
1203
- }
1204
- var D = O[s];
1205
- D !== null && (O[h] = null, O[s] = null, O[f] = null, D(_(void 0, !0))), O[l] = !0;
1206
- }), R.on("readable", m.bind(null, O)), O;
1207
- };
1208
- return Pe = T, Pe;
1209
- }
1210
- var Ne, lt;
1211
- function br() {
1212
- return lt || (lt = 1, Ne = function() {
1213
- throw new Error("Readable.from is not available in the browser");
1214
- }), Ne;
1215
- }
1216
- var qe, dt;
1217
- function Ot() {
1218
- if (dt) return qe;
1219
- dt = 1, qe = D;
1220
- var t;
1221
- D.ReadableState = N, $e.EventEmitter;
1222
- var e = function(i, p) {
1223
- return i.listeners(p).length;
1224
- }, r = Lt(), a = ce.Buffer, o = (typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
1225
- };
1226
- function s(n) {
1227
- return a.from(n);
1228
- }
1229
- function f(n) {
1230
- return a.isBuffer(n) || n instanceof o;
1231
- }
1232
- var u = Tt, l;
1233
- u && u.debuglog ? l = u.debuglog("stream") : l = function() {
1234
- };
1235
- var h = Zt(), g = Ct(), y = At(), _ = y.getHighWaterMark, M = Q().codes, m = M.ERR_INVALID_ARG_TYPE, S = M.ERR_STREAM_PUSH_AFTER_EOF, b = M.ERR_METHOD_NOT_IMPLEMENTED, w = M.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, T, L, R;
1236
- J(D, r);
1237
- var A = g.errorOrDestroy, O = ["error", "close", "destroy", "pause", "resume"];
1238
- function I(n, i, p) {
1239
- if (typeof n.prependListener == "function") return n.prependListener(i, p);
1240
- !n._events || !n._events[i] ? n.on(i, p) : Array.isArray(n._events[i]) ? n._events[i].unshift(p) : n._events[i] = [p, n._events[i]];
1241
- }
1242
- function N(n, i, p) {
1243
- t = t || X(), n = n || {}, typeof p != "boolean" && (p = i instanceof t), this.objectMode = !!n.objectMode, p && (this.objectMode = this.objectMode || !!n.readableObjectMode), this.highWaterMark = _(this, n, "readableHighWaterMark", p), this.buffer = new h(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = n.emitClose !== !1, this.autoDestroy = !!n.autoDestroy, this.destroyed = !1, this.defaultEncoding = n.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, n.encoding && (T || (T = Be.StringDecoder), this.decoder = new T(n.encoding), this.encoding = n.encoding);
1244
- }
1245
- function D(n) {
1246
- if (t = t || X(), !(this instanceof D)) return new D(n);
1247
- var i = this instanceof t;
1248
- this._readableState = new N(n, this, i), this.readable = !0, n && (typeof n.read == "function" && (this._read = n.read), typeof n.destroy == "function" && (this._destroy = n.destroy)), r.call(this);
1249
- }
1250
- Object.defineProperty(D.prototype, "destroyed", {
1251
- // making it explicit this property is not enumerable
1252
- // because otherwise some prototype manipulation in
1253
- // userland will fail
1254
- enumerable: !1,
1255
- get: function() {
1256
- return this._readableState === void 0 ? !1 : this._readableState.destroyed;
1257
- },
1258
- set: function(i) {
1259
- this._readableState && (this._readableState.destroyed = i);
1260
- }
1261
- }), D.prototype.destroy = g.destroy, D.prototype._undestroy = g.undestroy, D.prototype._destroy = function(n, i) {
1262
- i(n);
1263
- }, D.prototype.push = function(n, i) {
1264
- var p = this._readableState, E;
1265
- return p.objectMode ? E = !0 : typeof n == "string" && (i = i || p.defaultEncoding, i !== p.encoding && (n = a.from(n, i), i = ""), E = !0), B(this, n, i, !1, E);
1266
- }, D.prototype.unshift = function(n) {
1267
- return B(this, n, null, !0, !1);
1268
- };
1269
- function B(n, i, p, E, j) {
1270
- l("readableAddChunk", i);
1271
- var x = n._readableState;
1272
- if (i === null)
1273
- x.reading = !1, _e(n, x);
1274
- else {
1275
- var k;
1276
- if (j || (k = pe(x, i)), k)
1277
- A(n, k);
1278
- else if (x.objectMode || i && i.length > 0)
1279
- if (typeof i != "string" && !x.objectMode && Object.getPrototypeOf(i) !== a.prototype && (i = s(i)), E)
1280
- x.endEmitted ? A(n, new w()) : Z(n, x, i, !0);
1281
- else if (x.ended)
1282
- A(n, new S());
1283
- else {
1284
- if (x.destroyed)
1285
- return !1;
1286
- x.reading = !1, x.decoder && !p ? (i = x.decoder.write(i), x.objectMode || i.length !== 0 ? Z(n, x, i, !1) : V(n, x)) : Z(n, x, i, !1);
1287
- }
1288
- else E || (x.reading = !1, V(n, x));
1289
- }
1290
- return !x.ended && (x.length < x.highWaterMark || x.length === 0);
1291
- }
1292
- function Z(n, i, p, E) {
1293
- i.flowing && i.length === 0 && !i.sync ? (i.awaitDrain = 0, n.emit("data", p)) : (i.length += i.objectMode ? 1 : p.length, E ? i.buffer.unshift(p) : i.buffer.push(p), i.needReadable && U(n)), V(n, i);
1294
- }
1295
- function pe(n, i) {
1296
- var p;
1297
- return !f(i) && typeof i != "string" && i !== void 0 && !n.objectMode && (p = new m("chunk", ["string", "Buffer", "Uint8Array"], i)), p;
1298
- }
1299
- D.prototype.isPaused = function() {
1300
- return this._readableState.flowing === !1;
1301
- }, D.prototype.setEncoding = function(n) {
1302
- T || (T = Be.StringDecoder);
1303
- var i = new T(n);
1304
- this._readableState.decoder = i, this._readableState.encoding = this._readableState.decoder.encoding;
1305
- for (var p = this._readableState.buffer.head, E = ""; p !== null; )
1306
- E += i.write(p.data), p = p.next;
1307
- return this._readableState.buffer.clear(), E !== "" && this._readableState.buffer.push(E), this._readableState.length = E.length, this;
1308
- };
1309
- var $ = 1073741824;
1310
- function ve(n) {
1311
- return n >= $ ? n = $ : (n--, n |= n >>> 1, n |= n >>> 2, n |= n >>> 4, n |= n >>> 8, n |= n >>> 16, n++), n;
1312
- }
1313
- function ie(n, i) {
1314
- return n <= 0 || i.length === 0 && i.ended ? 0 : i.objectMode ? 1 : n !== n ? i.flowing && i.length ? i.buffer.head.data.length : i.length : (n > i.highWaterMark && (i.highWaterMark = ve(n)), n <= i.length ? n : i.ended ? i.length : (i.needReadable = !0, 0));
1315
- }
1316
- D.prototype.read = function(n) {
1317
- l("read", n), n = parseInt(n, 10);
1318
- var i = this._readableState, p = n;
1319
- if (n !== 0 && (i.emittedReadable = !1), n === 0 && i.needReadable && ((i.highWaterMark !== 0 ? i.length >= i.highWaterMark : i.length > 0) || i.ended))
1320
- return l("read: emitReadable", i.length, i.ended), i.length === 0 && i.ended ? v(this) : U(this), null;
1321
- if (n = ie(n, i), n === 0 && i.ended)
1322
- return i.length === 0 && v(this), null;
1323
- var E = i.needReadable;
1324
- l("need readable", E), (i.length === 0 || i.length - n < i.highWaterMark) && (E = !0, l("length less than watermark", E)), i.ended || i.reading ? (E = !1, l("reading or ended", E)) : E && (l("do read"), i.reading = !0, i.sync = !0, i.length === 0 && (i.needReadable = !0), this._read(i.highWaterMark), i.sync = !1, i.reading || (n = ie(p, i)));
1325
- var j;
1326
- return n > 0 ? j = d(n, i) : j = null, j === null ? (i.needReadable = i.length <= i.highWaterMark, n = 0) : (i.length -= n, i.awaitDrain = 0), i.length === 0 && (i.ended || (i.needReadable = !0), p !== n && i.ended && v(this)), j !== null && this.emit("data", j), j;
1327
- };
1328
- function _e(n, i) {
1329
- if (l("onEofChunk"), !i.ended) {
1330
- if (i.decoder) {
1331
- var p = i.decoder.end();
1332
- p && p.length && (i.buffer.push(p), i.length += i.objectMode ? 1 : p.length);
1333
- }
1334
- i.ended = !0, i.sync ? U(n) : (i.needReadable = !1, i.emittedReadable || (i.emittedReadable = !0, ae(n)));
1335
- }
1336
- }
1337
- function U(n) {
1338
- var i = n._readableState;
1339
- l("emitReadable", i.needReadable, i.emittedReadable), i.needReadable = !1, i.emittedReadable || (l("emitReadable", i.flowing), i.emittedReadable = !0, process.nextTick(ae, n));
1340
- }
1341
- function ae(n) {
1342
- var i = n._readableState;
1343
- l("emitReadable_", i.destroyed, i.length, i.ended), !i.destroyed && (i.length || i.ended) && (n.emit("readable"), i.emittedReadable = !1), i.needReadable = !i.flowing && !i.ended && i.length <= i.highWaterMark, c(n);
1344
- }
1345
- function V(n, i) {
1346
- i.readingMore || (i.readingMore = !0, process.nextTick(se, n, i));
1347
- }
1348
- function se(n, i) {
1349
- for (; !i.reading && !i.ended && (i.length < i.highWaterMark || i.flowing && i.length === 0); ) {
1350
- var p = i.length;
1351
- if (l("maybeReadMore read 0"), n.read(0), p === i.length)
1352
- break;
1353
- }
1354
- i.readingMore = !1;
1355
- }
1356
- D.prototype._read = function(n) {
1357
- A(this, new b("_read()"));
1358
- }, D.prototype.pipe = function(n, i) {
1359
- var p = this, E = this._readableState;
1360
- switch (E.pipesCount) {
1361
- case 0:
1362
- E.pipes = n;
1363
- break;
1364
- case 1:
1365
- E.pipes = [E.pipes, n];
1366
- break;
1367
- default:
1368
- E.pipes.push(n);
1369
- break;
1370
- }
1371
- E.pipesCount += 1, l("pipe count=%d opts=%j", E.pipesCount, i);
1372
- var j = (!i || i.end !== !1) && n !== process.stdout && n !== process.stderr, x = j ? G : ee;
1373
- E.endEmitted ? process.nextTick(x) : p.once("end", x), n.on("unpipe", k);
1374
- function k(K, Y) {
1375
- l("onunpipe"), K === p && Y && Y.hasUnpiped === !1 && (Y.hasUnpiped = !0, $t());
1376
- }
1377
- function G() {
1378
- l("onend"), n.end();
1379
- }
1380
- var fe = be(p);
1381
- n.on("drain", fe);
1382
- var ze = !1;
1383
- function $t() {
1384
- l("cleanup"), n.removeListener("close", me), n.removeListener("finish", Ee), n.removeListener("drain", fe), n.removeListener("error", we), n.removeListener("unpipe", k), p.removeListener("end", G), p.removeListener("end", ee), p.removeListener("data", Xe), ze = !0, E.awaitDrain && (!n._writableState || n._writableState.needDrain) && fe();
1385
- }
1386
- p.on("data", Xe);
1387
- function Xe(K) {
1388
- l("ondata");
1389
- var Y = n.write(K);
1390
- l("dest.write", Y), Y === !1 && ((E.pipesCount === 1 && E.pipes === n || E.pipesCount > 1 && P(E.pipes, n) !== -1) && !ze && (l("false write response, pause", E.awaitDrain), E.awaitDrain++), p.pause());
1391
- }
1392
- function we(K) {
1393
- l("onerror", K), ee(), n.removeListener("error", we), e(n, "error") === 0 && A(n, K);
1394
- }
1395
- I(n, "error", we);
1396
- function me() {
1397
- n.removeListener("finish", Ee), ee();
1398
- }
1399
- n.once("close", me);
1400
- function Ee() {
1401
- l("onfinish"), n.removeListener("close", me), ee();
1402
- }
1403
- n.once("finish", Ee);
1404
- function ee() {
1405
- l("unpipe"), p.unpipe(n);
1406
- }
1407
- return n.emit("pipe", p), E.flowing || (l("pipe resume"), p.resume()), n;
1408
- };
1409
- function be(n) {
1410
- return function() {
1411
- var p = n._readableState;
1412
- l("pipeOnDrain", p.awaitDrain), p.awaitDrain && p.awaitDrain--, p.awaitDrain === 0 && e(n, "data") && (p.flowing = !0, c(n));
1413
- };
1414
- }
1415
- D.prototype.unpipe = function(n) {
1416
- var i = this._readableState, p = {
1417
- hasUnpiped: !1
1418
- };
1419
- if (i.pipesCount === 0) return this;
1420
- if (i.pipesCount === 1)
1421
- return n && n !== i.pipes ? this : (n || (n = i.pipes), i.pipes = null, i.pipesCount = 0, i.flowing = !1, n && n.emit("unpipe", this, p), this);
1422
- if (!n) {
1423
- var E = i.pipes, j = i.pipesCount;
1424
- i.pipes = null, i.pipesCount = 0, i.flowing = !1;
1425
- for (var x = 0; x < j; x++) E[x].emit("unpipe", this, {
1426
- hasUnpiped: !1
1427
- });
1428
- return this;
1429
- }
1430
- var k = P(i.pipes, n);
1431
- return k === -1 ? this : (i.pipes.splice(k, 1), i.pipesCount -= 1, i.pipesCount === 1 && (i.pipes = i.pipes[0]), n.emit("unpipe", this, p), this);
1432
- }, D.prototype.on = function(n, i) {
1433
- var p = r.prototype.on.call(this, n, i), E = this._readableState;
1434
- return n === "data" ? (E.readableListening = this.listenerCount("readable") > 0, E.flowing !== !1 && this.resume()) : n === "readable" && !E.endEmitted && !E.readableListening && (E.readableListening = E.needReadable = !0, E.flowing = !1, E.emittedReadable = !1, l("on readable", E.length, E.reading), E.length ? U(this) : E.reading || process.nextTick(H, this)), p;
1435
- }, D.prototype.addListener = D.prototype.on, D.prototype.removeListener = function(n, i) {
1436
- var p = r.prototype.removeListener.call(this, n, i);
1437
- return n === "readable" && process.nextTick(oe, this), p;
1438
- }, D.prototype.removeAllListeners = function(n) {
1439
- var i = r.prototype.removeAllListeners.apply(this, arguments);
1440
- return (n === "readable" || n === void 0) && process.nextTick(oe, this), i;
1441
- };
1442
- function oe(n) {
1443
- var i = n._readableState;
1444
- i.readableListening = n.listenerCount("readable") > 0, i.resumeScheduled && !i.paused ? i.flowing = !0 : n.listenerCount("data") > 0 && n.resume();
1445
- }
1446
- function H(n) {
1447
- l("readable nexttick read 0"), n.read(0);
1448
- }
1449
- D.prototype.resume = function() {
1450
- var n = this._readableState;
1451
- return n.flowing || (l("resume"), n.flowing = !n.readableListening, ge(this, n)), n.paused = !1, this;
1452
- };
1453
- function ge(n, i) {
1454
- i.resumeScheduled || (i.resumeScheduled = !0, process.nextTick(ye, n, i));
1455
- }
1456
- function ye(n, i) {
1457
- l("resume", i.reading), i.reading || n.read(0), i.resumeScheduled = !1, n.emit("resume"), c(n), i.flowing && !i.reading && n.read(0);
1458
- }
1459
- D.prototype.pause = function() {
1460
- return l("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (l("pause"), this._readableState.flowing = !1, this.emit("pause")), this._readableState.paused = !0, this;
1461
- };
1462
- function c(n) {
1463
- var i = n._readableState;
1464
- for (l("flow", i.flowing); i.flowing && n.read() !== null; ) ;
1465
- }
1466
- D.prototype.wrap = function(n) {
1467
- var i = this, p = this._readableState, E = !1;
1468
- n.on("end", function() {
1469
- if (l("wrapped end"), p.decoder && !p.ended) {
1470
- var k = p.decoder.end();
1471
- k && k.length && i.push(k);
1472
- }
1473
- i.push(null);
1474
- }), n.on("data", function(k) {
1475
- if (l("wrapped data"), p.decoder && (k = p.decoder.write(k)), !(p.objectMode && k == null) && !(!p.objectMode && (!k || !k.length))) {
1476
- var G = i.push(k);
1477
- G || (E = !0, n.pause());
1478
- }
1479
- });
1480
- for (var j in n)
1481
- this[j] === void 0 && typeof n[j] == "function" && (this[j] = /* @__PURE__ */ function(G) {
1482
- return function() {
1483
- return n[G].apply(n, arguments);
1484
- };
1485
- }(j));
1486
- for (var x = 0; x < O.length; x++)
1487
- n.on(O[x], this.emit.bind(this, O[x]));
1488
- return this._read = function(k) {
1489
- l("wrapped _read", k), E && (E = !1, n.resume());
1490
- }, this;
1491
- }, typeof Symbol == "function" && (D.prototype[Symbol.asyncIterator] = function() {
1492
- return L === void 0 && (L = _r()), L(this);
1493
- }), Object.defineProperty(D.prototype, "readableHighWaterMark", {
1494
- // making it explicit this property is not enumerable
1495
- // because otherwise some prototype manipulation in
1496
- // userland will fail
1497
- enumerable: !1,
1498
- get: function() {
1499
- return this._readableState.highWaterMark;
1500
- }
1501
- }), Object.defineProperty(D.prototype, "readableBuffer", {
1502
- // making it explicit this property is not enumerable
1503
- // because otherwise some prototype manipulation in
1504
- // userland will fail
1505
- enumerable: !1,
1506
- get: function() {
1507
- return this._readableState && this._readableState.buffer;
1508
- }
1509
- }), Object.defineProperty(D.prototype, "readableFlowing", {
1510
- // making it explicit this property is not enumerable
1511
- // because otherwise some prototype manipulation in
1512
- // userland will fail
1513
- enumerable: !1,
1514
- get: function() {
1515
- return this._readableState.flowing;
1516
- },
1517
- set: function(i) {
1518
- this._readableState && (this._readableState.flowing = i);
1519
- }
1520
- }), D._fromList = d, Object.defineProperty(D.prototype, "readableLength", {
1521
- // making it explicit this property is not enumerable
1522
- // because otherwise some prototype manipulation in
1523
- // userland will fail
1524
- enumerable: !1,
1525
- get: function() {
1526
- return this._readableState.length;
1527
- }
1528
- });
1529
- function d(n, i) {
1530
- if (i.length === 0) return null;
1531
- var p;
1532
- return i.objectMode ? p = i.buffer.shift() : !n || n >= i.length ? (i.decoder ? p = i.buffer.join("") : i.buffer.length === 1 ? p = i.buffer.first() : p = i.buffer.concat(i.length), i.buffer.clear()) : p = i.buffer.consume(n, i.decoder), p;
1533
- }
1534
- function v(n) {
1535
- var i = n._readableState;
1536
- l("endReadable", i.endEmitted), i.endEmitted || (i.ended = !0, process.nextTick(C, i, n));
1537
- }
1538
- function C(n, i) {
1539
- if (l("endReadableNT", n.endEmitted, n.length), !n.endEmitted && n.length === 0 && (n.endEmitted = !0, i.readable = !1, i.emit("end"), n.autoDestroy)) {
1540
- var p = i._writableState;
1541
- (!p || p.autoDestroy && p.finished) && i.destroy();
1542
- }
1543
- }
1544
- typeof Symbol == "function" && (D.from = function(n, i) {
1545
- return R === void 0 && (R = br()), R(D, n, i);
1546
- });
1547
- function P(n, i) {
1548
- for (var p = 0, E = n.length; p < E; p++)
1549
- if (n[p] === i) return p;
1550
- return -1;
1551
- }
1552
- return qe;
1553
- }
1554
- var ke, ct;
1555
- function Dt() {
1556
- if (ct) return ke;
1557
- ct = 1, ke = u;
1558
- var t = Q().codes, e = t.ERR_METHOD_NOT_IMPLEMENTED, r = t.ERR_MULTIPLE_CALLBACK, a = t.ERR_TRANSFORM_ALREADY_TRANSFORMING, o = t.ERR_TRANSFORM_WITH_LENGTH_0, s = X();
1559
- J(u, s);
1560
- function f(g, y) {
1561
- var _ = this._transformState;
1562
- _.transforming = !1;
1563
- var M = _.writecb;
1564
- if (M === null)
1565
- return this.emit("error", new r());
1566
- _.writechunk = null, _.writecb = null, y != null && this.push(y), M(g);
1567
- var m = this._readableState;
1568
- m.reading = !1, (m.needReadable || m.length < m.highWaterMark) && this._read(m.highWaterMark);
1569
- }
1570
- function u(g) {
1571
- if (!(this instanceof u)) return new u(g);
1572
- s.call(this, g), this._transformState = {
1573
- afterTransform: f.bind(this),
1574
- needTransform: !1,
1575
- transforming: !1,
1576
- writecb: null,
1577
- writechunk: null,
1578
- writeencoding: null
1579
- }, this._readableState.needReadable = !0, this._readableState.sync = !1, g && (typeof g.transform == "function" && (this._transform = g.transform), typeof g.flush == "function" && (this._flush = g.flush)), this.on("prefinish", l);
1580
- }
1581
- function l() {
1582
- var g = this;
1583
- typeof this._flush == "function" && !this._readableState.destroyed ? this._flush(function(y, _) {
1584
- h(g, y, _);
1585
- }) : h(this, null, null);
1586
- }
1587
- u.prototype.push = function(g, y) {
1588
- return this._transformState.needTransform = !1, s.prototype.push.call(this, g, y);
1589
- }, u.prototype._transform = function(g, y, _) {
1590
- _(new e("_transform()"));
1591
- }, u.prototype._write = function(g, y, _) {
1592
- var M = this._transformState;
1593
- if (M.writecb = _, M.writechunk = g, M.writeencoding = y, !M.transforming) {
1594
- var m = this._readableState;
1595
- (M.needTransform || m.needReadable || m.length < m.highWaterMark) && this._read(m.highWaterMark);
1596
- }
1597
- }, u.prototype._read = function(g) {
1598
- var y = this._transformState;
1599
- y.writechunk !== null && !y.transforming ? (y.transforming = !0, this._transform(y.writechunk, y.writeencoding, y.afterTransform)) : y.needTransform = !0;
1600
- }, u.prototype._destroy = function(g, y) {
1601
- s.prototype._destroy.call(this, g, function(_) {
1602
- y(_);
1603
- });
1604
- };
1605
- function h(g, y, _) {
1606
- if (y) return g.emit("error", y);
1607
- if (_ != null && g.push(_), g._writableState.length) throw new o();
1608
- if (g._transformState.transforming) throw new a();
1609
- return g.push(null);
1610
- }
1611
- return ke;
1612
- }
1613
- var je, ht;
1614
- function gr() {
1615
- if (ht) return je;
1616
- ht = 1, je = e;
1617
- var t = Dt();
1618
- J(e, t);
1619
- function e(r) {
1620
- if (!(this instanceof e)) return new e(r);
1621
- t.call(this, r);
1622
- }
1623
- return e.prototype._transform = function(r, a, o) {
1624
- o(null, r);
1625
- }, je;
1626
- }
1627
- var Ie, pt;
1628
- function yr() {
1629
- if (pt) return Ie;
1630
- pt = 1;
1631
- var t;
1632
- function e(_) {
1633
- var M = !1;
1634
- return function() {
1635
- M || (M = !0, _.apply(void 0, arguments));
1636
- };
1637
- }
1638
- var r = Q().codes, a = r.ERR_MISSING_ARGS, o = r.ERR_STREAM_DESTROYED;
1639
- function s(_) {
1640
- if (_) throw _;
1641
- }
1642
- function f(_) {
1643
- return _.setHeader && typeof _.abort == "function";
1644
- }
1645
- function u(_, M, m, S) {
1646
- S = e(S);
1647
- var b = !1;
1648
- _.on("close", function() {
1649
- b = !0;
1650
- }), t === void 0 && (t = Ge()), t(_, {
1651
- readable: M,
1652
- writable: m
1653
- }, function(T) {
1654
- if (T) return S(T);
1655
- b = !0, S();
1656
- });
1657
- var w = !1;
1658
- return function(T) {
1659
- if (!b && !w) {
1660
- if (w = !0, f(_)) return _.abort();
1661
- if (typeof _.destroy == "function") return _.destroy();
1662
- S(T || new o("pipe"));
1663
- }
1664
- };
1665
- }
1666
- function l(_) {
1667
- _();
1668
- }
1669
- function h(_, M) {
1670
- return _.pipe(M);
1671
- }
1672
- function g(_) {
1673
- return !_.length || typeof _[_.length - 1] != "function" ? s : _.pop();
1674
- }
1675
- function y() {
1676
- for (var _ = arguments.length, M = new Array(_), m = 0; m < _; m++)
1677
- M[m] = arguments[m];
1678
- var S = g(M);
1679
- if (Array.isArray(M[0]) && (M = M[0]), M.length < 2)
1680
- throw new a("streams");
1681
- var b, w = M.map(function(T, L) {
1682
- var R = L < M.length - 1, A = L > 0;
1683
- return u(T, R, A, function(O) {
1684
- b || (b = O), O && w.forEach(l), !R && (w.forEach(l), S(b));
1685
- });
1686
- });
1687
- return M.reduce(h);
1688
- }
1689
- return Ie = y, Ie;
1690
- }
1691
- var xt = F, Ke = $e.EventEmitter, wr = J;
1692
- wr(F, Ke);
1693
- F.Readable = Ot();
1694
- F.Writable = Mt();
1695
- F.Duplex = X();
1696
- F.Transform = Dt();
1697
- F.PassThrough = gr();
1698
- F.finished = Ge();
1699
- F.pipeline = yr();
1700
- F.Stream = F;
1701
- function F() {
1702
- Ke.call(this);
1703
- }
1704
- F.prototype.pipe = function(t, e) {
1705
- var r = this;
1706
- function a(g) {
1707
- t.writable && t.write(g) === !1 && r.pause && r.pause();
1708
- }
1709
- r.on("data", a);
1710
- function o() {
1711
- r.readable && r.resume && r.resume();
1712
- }
1713
- t.on("drain", o), !t._isStdio && (!e || e.end !== !1) && (r.on("end", f), r.on("close", u));
1714
- var s = !1;
1715
- function f() {
1716
- s || (s = !0, t.end());
1717
- }
1718
- function u() {
1719
- s || (s = !0, typeof t.destroy == "function" && t.destroy());
1720
- }
1721
- function l(g) {
1722
- if (h(), Ke.listenerCount(this, "error") === 0)
1723
- throw g;
1724
- }
1725
- r.on("error", l), t.on("error", l);
1726
- function h() {
1727
- r.removeListener("data", a), t.removeListener("drain", o), r.removeListener("end", f), r.removeListener("close", u), r.removeListener("error", l), t.removeListener("error", l), r.removeListener("end", h), r.removeListener("close", h), t.removeListener("close", h);
1728
- }
1729
- return r.on("end", h), r.on("close", h), t.on("close", h), t.emit("pipe", r), t;
1730
- };
1731
- function re(t) {
1732
- return t.replace(/%([0-9A-Fa-f]{2})/g, (e, r) => String.fromCharCode(parseInt(r, 16)));
1733
- }
1734
- function Pt(t, e) {
1735
- return String(e).replace(t, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`);
1736
- }
1737
- function te(t) {
1738
- return Pt(/[\n;\r\t=%&,\x00-\x1f\x7f-\xff]/g, t);
1739
- }
1740
- function W(t) {
1741
- return Pt(/[\n\r\t%\x00-\x1f\x7f-\xff]/g, t);
1742
- }
1743
- function Nt(t) {
1744
- if (!(t && t.length) || t === ".")
1745
- return {};
1746
- const e = {};
1747
- return t.replace(/\r?\n$/, "").split(";").forEach((r) => {
1748
- const a = r.split("=", 2);
1749
- if (!(a[1] && a[1].length))
1750
- return;
1751
- a[0] = a[0].trim();
1752
- let o = e[a[0].trim()];
1753
- o || (o = [], e[a[0]] = o), o.push(...a[1].split(",").map((s) => s.trim()).map(re));
1754
- }), e;
1755
- }
1756
- function qt(t) {
1757
- const e = t.split(" ").map((a) => a === "." || a === "" ? null : a);
1758
- return {
1759
- seq_id: e[0] && re(e[0]),
1760
- source: e[1] && re(e[1]),
1761
- type: e[2] && re(e[2]),
1762
- start: e[3] === null ? null : parseInt(e[3], 10),
1763
- end: e[4] === null ? null : parseInt(e[4], 10),
1764
- score: e[5] === null ? null : parseFloat(e[5]),
1765
- strand: e[6],
1766
- phase: e[7],
1767
- attributes: e[8] === null ? null : Nt(e[8])
1768
- };
1769
- }
1770
- function kt(t) {
1771
- const e = /^\s*##\s*(\S+)\s*(.*)/.exec(t);
1772
- if (!e)
1773
- return null;
1774
- const [, r] = e;
1775
- let [, , a] = e;
1776
- const o = { directive: r };
1777
- if (a.length && (a = a.replace(/\r?\n$/, ""), o.value = a), r === "sequence-region") {
1778
- const s = a.split(/\s+/, 3);
1779
- return {
1780
- ...o,
1781
- seq_id: s[0],
1782
- start: s[1] && s[1].replace(/\D/g, ""),
1783
- end: s[2] && s[2].replace(/\D/g, "")
1784
- };
1785
- } else if (r === "genome-build") {
1786
- const [s, f] = a.split(/\s+/, 2);
1787
- return {
1788
- ...o,
1789
- source: s,
1790
- buildName: f
1791
- };
1792
- }
1793
- return o;
1794
- }
1795
- function jt(t) {
1796
- const e = [];
1797
- return Object.entries(t).forEach(([r, a]) => {
1798
- if (!a)
1799
- return;
1800
- let o;
1801
- a.hasOwnProperty("toString") ? o = te(a.toString()) : Array.isArray(a) ? o = a.map(te).join(",") : o = te(a), e.push(`${te(r)}=${o}`);
1802
- }), e.length ? e.join(";") : ".";
1803
- }
1804
- function mr(t, e) {
1805
- const r = t.attributes === null || t.attributes === void 0 ? "." : jt(t.attributes), o = `${[
1806
- t.seq_id === null ? "." : W(t.seq_id),
1807
- t.source === null ? "." : W(t.source),
1808
- t.type === null ? "." : W(t.type),
1809
- t.start === null ? "." : W(t.start),
1810
- t.end === null ? "." : W(t.end),
1811
- t.score === null ? "." : W(t.score),
1812
- t.strand === null ? "." : W(t.strand),
1813
- t.phase === null ? "." : W(t.phase),
1814
- r
1815
- ].join(" ")}
1816
- `;
1817
- return e[o] ? "" : (e[o] = !0, o);
1818
- }
1819
- function le(t, e) {
1820
- if (Array.isArray(t))
1821
- return t.map((a) => le(a, e)).join("");
1822
- const r = [mr(t, e)];
1823
- return Er(t) && r.push(...t.child_features.map((a) => le(a, e)), ...t.derived_features.map((a) => le(a, e))), r.join("");
1824
- }
1825
- function It(t) {
1826
- return le(t, {});
1827
- }
1828
- function Ft(t) {
1829
- let e = `##${t.directive}`;
1830
- return t.value && (e += ` ${t.value}`), e += `
1831
- `, e;
1832
- }
1833
- function Bt(t) {
1834
- return `# ${t.comment}
1835
- `;
1836
- }
1837
- function Ye(t) {
1838
- return `>${t.id}${t.description ? ` ${t.description}` : ""}
1839
- ${t.sequence}
1840
- `;
1841
- }
1842
- function de(t) {
1843
- function e(r) {
1844
- return "attributes" in r ? It(r) : "directive" in r ? Ft(r) : "sequence" in r ? Ye(r) : "comment" in r ? Bt(r) : `# (invalid item found during format)
1845
- `;
1846
- }
1847
- return Array.isArray(t) ? t.map(e) : e(t);
1848
- }
1849
- function Er(t) {
1850
- return t.child_features !== void 0 && t.derived_features !== void 0;
1851
- }
1852
- const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1853
- __proto__: null,
1854
- escape: te,
1855
- escapeColumn: W,
1856
- formatAttributes: jt,
1857
- formatComment: Bt,
1858
- formatDirective: Ft,
1859
- formatFeature: It,
1860
- formatItem: de,
1861
- formatSequence: Ye,
1862
- parseAttributes: Nt,
1863
- parseDirective: kt,
1864
- parseFeature: qt,
1865
- unescape: re
1866
- }, Symbol.toStringTag, { value: "Module" })), vt = {
1867
- Parent: "child_features",
1868
- Derives_from: "derived_features"
1869
- };
1870
- class _t {
1871
- constructor(e) {
1872
- this.seqCallback = e, this.currentSequence = void 0;
1873
- }
1874
- addLine(e) {
1875
- const r = /^>\s*(\S+)\s*(.*)/.exec(e);
1876
- r ? (this._flush(), this.currentSequence = { id: r[1], sequence: "" }, r[2] && (this.currentSequence.description = r[2].trim())) : this.currentSequence && /\S/.test(e) && (this.currentSequence.sequence += e.replace(/\s/g, ""));
1877
- }
1878
- _flush() {
1879
- this.currentSequence && this.seqCallback(this.currentSequence);
1880
- }
1881
- finish() {
1882
- this._flush();
1883
- }
1884
- }
1885
- class Wt {
1886
- constructor(e) {
1887
- this.fastaParser = void 0, this.eof = !1, this.lineNumber = 0, this._underConstructionTopLevel = [], this._underConstructionById = {}, this._completedReferences = {}, this._underConstructionOrphans = {};
1888
- const r = () => {
1889
- };
1890
- this.featureCallback = e.featureCallback || r, this.endCallback = e.endCallback || r, this.commentCallback = e.commentCallback || r, this.errorCallback = e.errorCallback || r, this.directiveCallback = e.directiveCallback || r, this.sequenceCallback = e.sequenceCallback || r, this.disableDerivesFromReferences = e.disableDerivesFromReferences || !1, this.bufferSize = e.bufferSize === void 0 ? 1e3 : e.bufferSize;
1891
- }
1892
- addLine(e) {
1893
- if (this.fastaParser) {
1894
- this.fastaParser.addLine(e);
1895
- return;
1896
- }
1897
- if (this.eof)
1898
- return;
1899
- if (this.lineNumber += 1, /^\s*[^#\s>]/.test(e)) {
1900
- this._bufferLine(e);
1901
- return;
1902
- }
1903
- const r = /^\s*(#+)(.*)/.exec(e);
1904
- if (r) {
1905
- const [, a] = r;
1906
- let [, , o] = r;
1907
- if (a.length === 3)
1908
- this._emitAllUnderConstructionFeatures();
1909
- else if (a.length === 2) {
1910
- const s = kt(e);
1911
- s && (s.directive === "FASTA" ? (this._emitAllUnderConstructionFeatures(), this.eof = !0, this.fastaParser = new _t(this.sequenceCallback)) : this._emitItem(s));
1912
- } else
1913
- o = o.replace(/\s*/, ""), this._emitItem({ comment: o });
1914
- } else if (!/^\s*$/.test(e)) if (/^\s*>/.test(e))
1915
- this._emitAllUnderConstructionFeatures(), this.eof = !0, this.fastaParser = new _t(this.sequenceCallback), this.fastaParser.addLine(e);
1916
- else {
1917
- const a = e.replace(/\r?\n?$/g, "");
1918
- throw new Error(`GFF3 parse error. Cannot parse '${a}'.`);
1919
- }
1920
- }
1921
- finish() {
1922
- this._emitAllUnderConstructionFeatures(), this.fastaParser && this.fastaParser.finish(), this.endCallback();
1923
- }
1924
- _emitItem(e) {
1925
- Array.isArray(e) ? this.featureCallback(e) : "directive" in e ? this.directiveCallback(e) : "comment" in e && this.commentCallback(e);
1926
- }
1927
- _enforceBufferSizeLimit(e = 0) {
1928
- const r = (a) => {
1929
- a && Array.isArray(a) && a[0].attributes && a[0].attributes.ID && a[0].attributes.ID[0] && (a[0].attributes.ID.forEach((s) => {
1930
- delete this._underConstructionById[s], delete this._completedReferences[s];
1931
- }), a.forEach((s) => {
1932
- s.child_features && s.child_features.forEach((f) => r(f)), s.derived_features && s.derived_features.forEach((f) => r(f));
1933
- }));
1934
- };
1935
- for (; this._underConstructionTopLevel.length + e > this.bufferSize; ) {
1936
- const a = this._underConstructionTopLevel.shift();
1937
- a && (this._emitItem(a), r(a));
1938
- }
1939
- }
1940
- /**
1941
- * return all under-construction features, called when we know
1942
- * there will be no additional data to attach to them
1943
- */
1944
- _emitAllUnderConstructionFeatures() {
1945
- if (this._underConstructionTopLevel.forEach(this._emitItem.bind(this)), this._underConstructionTopLevel = [], this._underConstructionById = {}, this._completedReferences = {}, Array.from(Object.values(this._underConstructionOrphans)).length)
1946
- throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${Object.keys(this._underConstructionOrphans)}`);
1947
- }
1948
- // do the right thing with a newly-parsed feature line
1949
- _bufferLine(e) {
1950
- var r, a, o;
1951
- const f = {
1952
- ...qt(e),
1953
- child_features: [],
1954
- derived_features: []
1955
- }, u = ((r = f.attributes) === null || r === void 0 ? void 0 : r.ID) || [], l = ((a = f.attributes) === null || a === void 0 ? void 0 : a.Parent) || [], h = this.disableDerivesFromReferences ? [] : ((o = f.attributes) === null || o === void 0 ? void 0 : o.Derives_from) || [];
1956
- if (!u.length && !l.length && !h.length) {
1957
- this._emitItem([f]);
1958
- return;
1959
- }
1960
- let g;
1961
- u.forEach((y) => {
1962
- const _ = this._underConstructionById[y];
1963
- _ ? (_[_.length - 1].type !== f.type && this._parseError(`multi-line feature "${y}" has inconsistent types: "${f.type}", "${_[_.length - 1].type}"`), _.push(f), g = _) : (g = [f], this._enforceBufferSizeLimit(1), !l.length && !h.length && this._underConstructionTopLevel.push(g), this._underConstructionById[y] = g, this._resolveReferencesTo(g, y));
1964
- }), this._resolveReferencesFrom(g || [f], { Parent: l, Derives_from: h }, u);
1965
- }
1966
- _resolveReferencesTo(e, r) {
1967
- const a = this._underConstructionOrphans[r];
1968
- a && (e.forEach((o) => {
1969
- o.child_features.push(...a.Parent);
1970
- }), e.forEach((o) => {
1971
- o.derived_features.push(...a.Derives_from);
1972
- }), delete this._underConstructionOrphans[r]);
1973
- }
1974
- _parseError(e) {
1975
- this.eof = !0, this.errorCallback(`${this.lineNumber}: ${e}`);
1976
- }
1977
- _resolveReferencesFrom(e, r, a) {
1978
- function o(s, f, u) {
1979
- let l = s[f];
1980
- l || (l = {}, s[f] = l);
1981
- const h = l[u] || !1;
1982
- return l[u] = !0, h;
1983
- }
1984
- r.Parent.forEach((s) => {
1985
- const f = this._underConstructionById[s];
1986
- if (f) {
1987
- const u = vt.Parent;
1988
- a.filter((l) => o(this._completedReferences, l, `Parent,${s}`)).length || f.forEach((l) => {
1989
- l[u].push(e);
1990
- });
1991
- } else {
1992
- let u = this._underConstructionOrphans[s];
1993
- u || (u = {
1994
- Parent: [],
1995
- Derives_from: []
1996
- }, this._underConstructionOrphans[s] = u), u.Parent.push(e);
1997
- }
1998
- }), r.Derives_from.forEach((s) => {
1999
- const f = this._underConstructionById[s];
2000
- if (f) {
2001
- const u = vt.Derives_from;
2002
- a.filter((l) => o(this._completedReferences, l, `Derives_from,${s}`)).length || f.forEach((l) => {
2003
- l[u].push(e);
2004
- });
2005
- } else {
2006
- let u = this._underConstructionOrphans[s];
2007
- u || (u = {
2008
- Parent: [],
2009
- Derives_from: []
2010
- }, this._underConstructionOrphans[s] = u), u.Derives_from.push(e);
2011
- }
2012
- });
2013
- }
2014
- }
2015
- function Ue(t) {
2016
- process && process.nextTick ? process.nextTick(t) : t();
2017
- }
2018
- function Ut(t) {
2019
- const e = {
2020
- encoding: "utf8",
2021
- parseFeatures: !0,
2022
- parseDirectives: !1,
2023
- parseSequences: !0,
2024
- parseComments: !1,
2025
- bufferSize: 1e3,
2026
- disableDerivesFromReferences: !1,
2027
- ...t
2028
- };
2029
- return t.parseAll && (e.parseFeatures = !0, e.parseDirectives = !0, e.parseComments = !0, e.parseSequences = !0), e;
2030
- }
2031
- class Rr extends xt.Transform {
2032
- constructor(e = {}) {
2033
- super({ objectMode: !0 }), this.textBuffer = "";
2034
- const r = Ut(e);
2035
- this.encoding = e.encoding || "utf8", this.decoder = new ir();
2036
- const a = this.push.bind(this);
2037
- this.parser = new Wt({
2038
- featureCallback: r.parseFeatures ? a : void 0,
2039
- directiveCallback: r.parseDirectives ? a : void 0,
2040
- commentCallback: r.parseComments ? a : void 0,
2041
- sequenceCallback: r.parseSequences ? a : void 0,
2042
- errorCallback: (o) => this.emit("error", o),
2043
- bufferSize: r.bufferSize,
2044
- disableDerivesFromReferences: r.disableDerivesFromReferences
2045
- });
2046
- }
2047
- _addLine(e) {
2048
- e && this.parser.addLine(e);
2049
- }
2050
- _nextText(e) {
2051
- const r = (this.textBuffer + e).split(/\r?\n/);
2052
- this.textBuffer = r.pop() || "", r.forEach((a) => this._addLine(a));
2053
- }
2054
- _transform(e, r, a) {
2055
- this._nextText(this.decoder.write(e)), Ue(a);
2056
- }
2057
- _flush(e) {
2058
- this.decoder.end && this._nextText(this.decoder.end()), this.textBuffer != null && this._addLine(this.textBuffer), this.parser.finish(), Ue(e);
2059
- }
2060
- }
2061
- function Lr(t = {}) {
2062
- return new Rr(t);
2063
- }
2064
- function Tr(t, e = {}) {
2065
- if (!t)
2066
- return [];
2067
- const r = Ut(e), a = [], o = a.push.bind(a), s = new Wt({
2068
- featureCallback: r.parseFeatures ? o : void 0,
2069
- directiveCallback: r.parseDirectives ? o : void 0,
2070
- commentCallback: r.parseComments ? o : void 0,
2071
- sequenceCallback: r.parseSequences ? o : void 0,
2072
- disableDerivesFromReferences: r.disableDerivesFromReferences || !1,
2073
- bufferSize: 1 / 0,
2074
- errorCallback: (f) => {
2075
- throw f;
2076
- }
2077
- });
2078
- return t.split(/\r?\n/).forEach(s.addLine.bind(s)), s.finish(), a;
2079
- }
2080
- function Cr(t) {
2081
- const e = [], r = [];
2082
- t.forEach((o) => {
2083
- "sequence" in o ? r.push(o) : e.push(o);
2084
- });
2085
- let a = e.map(de).join("");
2086
- return r.length && (a += `##FASTA
2087
- `, a += r.map(Ye).join("")), a;
2088
- }
2089
- class Ht extends xt.Transform {
2090
- constructor(e = {}) {
2091
- super(Object.assign(e, { objectMode: !0 })), this.linesSinceLastSyncMark = 0, this.haveWeEmittedData = !1, this.fastaMode = !1, this.minLinesBetweenSyncMarks = e.minSyncLines || 100, this.insertVersionDirective = e.insertVersionDirective || !1;
2092
- }
2093
- _transform(e, r, a) {
2094
- let o;
2095
- if (!this.haveWeEmittedData && this.insertVersionDirective) {
2096
- const s = Array.isArray(e) ? e[0] : e;
2097
- "directive" in s && s.directive !== "gff-version" && this.push(`##gff-version 3
2098
- `);
2099
- }
2100
- if ("sequence" in e && !this.fastaMode && (this.push(`##FASTA
2101
- `), this.fastaMode = !0), Array.isArray(e) ? o = e.map(de).join("") : o = de(e), this.push(o), this.linesSinceLastSyncMark >= this.minLinesBetweenSyncMarks)
2102
- this.push(`###
2103
- `), this.linesSinceLastSyncMark = 0;
2104
- else {
2105
- let s = 0;
2106
- for (let f = 0; f < o.length; f += 1)
2107
- o[f] === `
2108
- ` && (s += 1);
2109
- this.linesSinceLastSyncMark += s;
2110
- }
2111
- this.haveWeEmittedData = !0, Ue(a);
2112
- }
2113
- }
2114
- function Ar(t = {}) {
2115
- return new Ht(t);
2116
- }
2117
- function Mr(t, e, r = {}) {
2118
- const a = {
2119
- insertVersionDirective: !0,
2120
- ...r
2121
- };
2122
- return new Promise((o, s) => {
2123
- t.pipe(new Ht(a)).on("end", () => o(null)).on("error", s).pipe(e);
2124
- });
2125
- }
2126
- const Pr = {
2127
- parseStream: Lr,
2128
- parseStringSync: Tr,
2129
- formatSync: Cr,
2130
- formatStream: Ar,
2131
- formatFile: Mr,
2132
- util: Sr
2133
- };
2134
- export {
2135
- Pr as default
2136
- };