UNPKG

@queuedash/api

Version:

A stunning, sleek dashboard for Bull, BullMQ, and Bee-Queue

1,875 lines 79.3 kB
var Ue = Object.defineProperty; var Re = (i, e, t) => e in i ? Ue(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t; var ee = (i, e, t) => Re(i, typeof e != "symbol" ? e + "" : e, t); import { g as Pe } from "./main-D6IAhcTU.mjs"; function v(i) { return new DataView(i.buffer, i.byteOffset); } const Ne = { len: 1, get(i, e) { return v(i).getUint8(e); }, put(i, e, t) { return v(i).setUint8(e, t), e + 1; } }, h = { len: 2, get(i, e) { return v(i).getUint16(e, !0); }, put(i, e, t) { return v(i).setUint16(e, t, !0), e + 2; } }, V = { len: 2, get(i, e) { return v(i).getUint16(e); }, put(i, e, t) { return v(i).setUint16(e, t), e + 2; } }, w = { len: 4, get(i, e) { return v(i).getUint32(e, !0); }, put(i, e, t) { return v(i).setUint32(e, t, !0), e + 4; } }, qe = { len: 4, get(i, e) { return v(i).getUint32(e); }, put(i, e, t) { return v(i).setUint32(e, t), e + 4; } }, He = { len: 4, get(i, e) { return v(i).getInt32(e); }, put(i, e, t) { return v(i).setInt32(e, t), e + 4; } }, Ve = { len: 8, get(i, e) { return v(i).getBigUint64(e, !0); }, put(i, e, t) { return v(i).setBigUint64(e, t, !0), e + 8; } }; class E { constructor(e, t) { this.len = e, this.encoding = t, this.textDecoder = new TextDecoder(t); } get(e, t) { return this.textDecoder.decode(e.subarray(t, t + this.len)); } } const _e = "End-Of-Stream"; class S extends Error { constructor() { super(_e), this.name = "EndOfStreamError"; } } class $e extends Error { constructor(e = "The operation was aborted") { super(e), this.name = "AbortError"; } } class ye { constructor() { this.endOfStream = !1, this.interrupted = !1, this.peekQueue = []; } async peek(e, t = !1) { const r = await this.read(e, t); return this.peekQueue.push(e.subarray(0, r)), r; } async read(e, t = !1) { if (e.length === 0) return 0; let r = this.readFromPeekBuffer(e); if (this.endOfStream || (r += await this.readRemainderFromStream(e.subarray(r), t)), r === 0) throw new S(); return r; } /** * Read chunk from stream * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in * @returns Number of bytes read */ readFromPeekBuffer(e) { let t = e.length, r = 0; for (; this.peekQueue.length > 0 && t > 0; ) { const n = this.peekQueue.pop(); if (!n) throw new Error("peekData should be defined"); const o = Math.min(n.length, t); e.set(n.subarray(0, o), r), r += o, t -= o, o < n.length && this.peekQueue.push(n.subarray(o)); } return r; } async readRemainderFromStream(e, t) { let r = 0; for (; r < e.length && !this.endOfStream; ) { if (this.interrupted) throw new $e(); const n = await this.readFromStream(e.subarray(r), t); if (n === 0) break; r += n; } if (!t && r < e.length) throw new S(); return r; } } class We extends ye { constructor(e) { super(), this.reader = e; } async abort() { return this.close(); } async close() { this.reader.releaseLock(); } } class Ze extends We { /** * Read from stream * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in * @param mayBeLess - If true, may fill the buffer partially * @protected Bytes read */ async readFromStream(e, t) { if (e.length === 0) return 0; const r = await this.reader.read(new Uint8Array(e.length), { min: t ? void 0 : e.length }); return r.done && (this.endOfStream = r.done), r.value ? (e.set(r.value), r.value.length) : 0; } } class ve extends ye { constructor(e) { super(), this.reader = e, this.buffer = null; } /** * Copy chunk to target, and store the remainder in this.buffer */ writeChunk(e, t) { const r = Math.min(t.length, e.length); return e.set(t.subarray(0, r)), r < t.length ? this.buffer = t.subarray(r) : this.buffer = null, r; } /** * Read from stream * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in * @param mayBeLess - If true, may fill the buffer partially * @protected Bytes read */ async readFromStream(e, t) { if (e.length === 0) return 0; let r = 0; for (this.buffer && (r += this.writeChunk(e, this.buffer)); r < e.length && !this.endOfStream; ) { const n = await this.reader.read(); if (n.done) { this.endOfStream = !0; break; } n.value && (r += this.writeChunk(e.subarray(r), n.value)); } if (r === 0 && this.endOfStream) throw new S(); return r; } abort() { return this.interrupted = !0, this.reader.cancel(); } async close() { await this.abort(), this.reader.releaseLock(); } } function Ge(i) { try { const e = i.getReader({ mode: "byob" }); return e instanceof ReadableStreamDefaultReader ? new ve(e) : new Ze(e); } catch (e) { if (e instanceof TypeError) return new ve(i.getReader()); throw e; } } class Fe { /** * Constructor * @param options Tokenizer options * @protected */ constructor(e) { this.numBuffer = new Uint8Array(8), this.position = 0, this.onClose = e == null ? void 0 : e.onClose, e != null && e.abortSignal && e.abortSignal.addEventListener("abort", () => { this.abort(); }); } /** * Read a token from the tokenizer-stream * @param token - The token to read * @param position - If provided, the desired position in the tokenizer-stream * @returns Promise with token data */ async readToken(e, t = this.position) { const r = new Uint8Array(e.len); if (await this.readBuffer(r, { position: t }) < e.len) throw new S(); return e.get(r, 0); } /** * Peek a token from the tokenizer-stream. * @param token - Token to peek from the tokenizer-stream. * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. * @returns Promise with token data */ async peekToken(e, t = this.position) { const r = new Uint8Array(e.len); if (await this.peekBuffer(r, { position: t }) < e.len) throw new S(); return e.get(r, 0); } /** * Read a numeric token from the stream * @param token - Numeric token * @returns Promise with number */ async readNumber(e) { if (await this.readBuffer(this.numBuffer, { length: e.len }) < e.len) throw new S(); return e.get(this.numBuffer, 0); } /** * Read a numeric token from the stream * @param token - Numeric token * @returns Promise with number */ async peekNumber(e) { if (await this.peekBuffer(this.numBuffer, { length: e.len }) < e.len) throw new S(); return e.get(this.numBuffer, 0); } /** * Ignore number of bytes, advances the pointer in under tokenizer-stream. * @param length - Number of bytes to ignore * @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available */ async ignore(e) { if (this.fileInfo.size !== void 0) { const t = this.fileInfo.size - this.position; if (e > t) return this.position += t, t; } return this.position += e, e; } async close() { var e; await this.abort(), await ((e = this.onClose) == null ? void 0 : e.call(this)); } normalizeOptions(e, t) { if (!this.supportsRandomAccess() && t && t.position !== void 0 && t.position < this.position) throw new Error("`options.position` must be equal or greater than `tokenizer.position`"); return { mayBeLess: !1, offset: 0, length: e.length, position: this.position, ...t }; } abort() { return Promise.resolve(); } } const Qe = 256e3; class Je extends Fe { /** * Constructor * @param streamReader stream-reader to read from * @param options Tokenizer options */ constructor(e, t) { super(t), this.streamReader = e, this.fileInfo = (t == null ? void 0 : t.fileInfo) ?? {}; } /** * Read buffer from tokenizer * @param uint8Array - Target Uint8Array to fill with data read from the tokenizer-stream * @param options - Read behaviour options * @returns Promise with number of bytes read */ async readBuffer(e, t) { const r = this.normalizeOptions(e, t), n = r.position - this.position; if (n > 0) return await this.ignore(n), this.readBuffer(e, t); if (n < 0) throw new Error("`options.position` must be equal or greater than `tokenizer.position`"); if (r.length === 0) return 0; const o = await this.streamReader.read(e.subarray(0, r.length), r.mayBeLess); if (this.position += o, (!t || !t.mayBeLess) && o < r.length) throw new S(); return o; } /** * Peek (read ahead) buffer from tokenizer * @param uint8Array - Uint8Array (or Buffer) to write data to * @param options - Read behaviour options * @returns Promise with number of bytes peeked */ async peekBuffer(e, t) { const r = this.normalizeOptions(e, t); let n = 0; if (r.position) { const o = r.position - this.position; if (o > 0) { const m = new Uint8Array(r.length + o); return n = await this.peekBuffer(m, { mayBeLess: r.mayBeLess }), e.set(m.subarray(o)), n - o; } if (o < 0) throw new Error("Cannot peek from a negative offset in a stream"); } if (r.length > 0) { try { n = await this.streamReader.peek(e.subarray(0, r.length), r.mayBeLess); } catch (o) { if (t != null && t.mayBeLess && o instanceof S) return 0; throw o; } if (!r.mayBeLess && n < r.length) throw new S(); } return n; } async ignore(e) { const t = Math.min(Qe, e), r = new Uint8Array(t); let n = 0; for (; n < e; ) { const o = e - n, m = await this.readBuffer(r, { length: Math.min(t, o) }); if (m < 0) return m; n += m; } return n; } abort() { return this.streamReader.abort(); } async close() { return this.streamReader.close(); } supportsRandomAccess() { return !1; } } class Ke extends Fe { /** * Construct BufferTokenizer * @param uint8Array - Uint8Array to tokenize * @param options Tokenizer options */ constructor(e, t) { super(t), this.uint8Array = e, this.fileInfo = { ...(t == null ? void 0 : t.fileInfo) ?? {}, size: e.length }; } /** * Read buffer from tokenizer * @param uint8Array - Uint8Array to tokenize * @param options - Read behaviour options * @returns {Promise<number>} */ async readBuffer(e, t) { t != null && t.position && (this.position = t.position); const r = await this.peekBuffer(e, t); return this.position += r, r; } /** * Peek (read ahead) buffer from tokenizer * @param uint8Array * @param options - Read behaviour options * @returns {Promise<number>} */ async peekBuffer(e, t) { const r = this.normalizeOptions(e, t), n = Math.min(this.uint8Array.length - r.position, r.length); if (!r.mayBeLess && n < r.length) throw new S(); return e.set(this.uint8Array.subarray(r.position, r.position + n)), n; } close() { return super.close(); } supportsRandomAccess() { return !0; } setPosition(e) { this.position = e; } } function Xe(i, e) { const t = Ge(i), r = e ?? {}, n = r.onClose; return r.onClose = async () => { if (await t.close(), n) return n(); }, new Je(t, r); } function Ye(i, e) { return new Ke(i, e); } var C = Uint8Array, P = Uint16Array, et = Int32Array, Se = new C([ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0 ]), Be = new C([ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0 ]), tt = new C([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Ae = function(i, e) { for (var t = new P(31), r = 0; r < 31; ++r) t[r] = e += 1 << i[r - 1]; for (var n = new et(t[30]), r = 1; r < 30; ++r) for (var o = t[r]; o < t[r + 1]; ++o) n[o] = o - t[r] << 5 | r; return { b: t, r: n }; }, ze = Ae(Se, 2), De = ze.b, it = ze.r; De[28] = 258, it[258] = 28; var rt = Ae(Be, 0), nt = rt.b, oe = new P(32768); for (var u = 0; u < 32768; ++u) { var L = (u & 43690) >> 1 | (u & 21845) << 1; L = (L & 52428) >> 2 | (L & 13107) << 2, L = (L & 61680) >> 4 | (L & 3855) << 4, oe[u] = ((L & 65280) >> 8 | (L & 255) << 8) >> 1; } var _ = function(i, e, t) { for (var r = i.length, n = 0, o = new P(e); n < r; ++n) i[n] && ++o[i[n] - 1]; var m = new P(e); for (n = 1; n < e; ++n) m[n] = m[n - 1] + o[n - 1] << 1; var l; if (t) { l = new P(1 << e); var f = 15 - e; for (n = 0; n < r; ++n) if (i[n]) for (var x = n << 4 | i[n], s = e - i[n], a = m[i[n] - 1]++ << s, c = a | (1 << s) - 1; a <= c; ++a) l[oe[a] >> f] = x; } else for (l = new P(r), n = 0; n < r; ++n) i[n] && (l[n] = oe[m[i[n] - 1]++] >> 15 - i[n]); return l; }, $ = new C(288); for (var u = 0; u < 144; ++u) $[u] = 8; for (var u = 144; u < 256; ++u) $[u] = 9; for (var u = 256; u < 280; ++u) $[u] = 7; for (var u = 280; u < 288; ++u) $[u] = 8; var Ee = new C(32); for (var u = 0; u < 32; ++u) Ee[u] = 5; var at = /* @__PURE__ */ _($, 9, 1), st = /* @__PURE__ */ _(Ee, 5, 1), te = function(i) { for (var e = i[0], t = 1; t < i.length; ++t) i[t] > e && (e = i[t]); return e; }, A = function(i, e, t) { var r = e / 8 | 0; return (i[r] | i[r + 1] << 8) >> (e & 7) & t; }, ie = function(i, e) { var t = e / 8 | 0; return (i[t] | i[t + 1] << 8 | i[t + 2] << 16) >> (e & 7); }, ot = function(i) { return (i + 7) / 8 | 0; }, ct = function(i, e, t) { return (t == null || t > i.length) && (t = i.length), new C(i.subarray(e, t)); }, ft = [ "unexpected EOF", "invalid block type", "invalid length/literal", "invalid distance", "stream finished", "no stream handler", , "no callback", "invalid UTF-8 data", "extra field too long", "date not in range 1980-2099", "filename too long", "stream finishing", "invalid zip data" // determined by unknown compression method ], b = function(i, e, t) { var r = new Error(e || ft[i]); if (r.code = i, Error.captureStackTrace && Error.captureStackTrace(r, b), !t) throw r; return r; }, fe = function(i, e, t, r) { var n = i.length, o = 0; if (!n || e.f && !e.l) return t || new C(0); var m = !t, l = m || e.i != 2, f = e.i; m && (t = new C(n * 3)); var x = function(de) { var ge = t.length; if (de > ge) { var we = new C(Math.max(ge * 2, de)); we.set(t), t = we; } }, s = e.f || 0, a = e.p || 0, c = e.b || 0, p = e.l, k = e.d, d = e.m, g = e.n, B = n * 8; do { if (!p) { s = A(i, a, 1); var T = A(i, a + 1, 3); if (a += 3, T) if (T == 1) p = at, k = st, d = 9, g = 5; else if (T == 2) { var M = A(i, a, 31) + 257, Z = A(i, a + 10, 15) + 4, q = M + A(i, a + 5, 31) + 1; a += 14; for (var j = new C(q), J = new C(19), F = 0; F < Z; ++F) J[tt[F]] = A(i, a + F * 3, 7); a += Z * 3; for (var me = te(J), Oe = (1 << me) - 1, Ie = _(J, me, 1), F = 0; F < q; ) { var xe = Ie[A(i, a, Oe)]; a += xe & 15; var y = xe >> 4; if (y < 16) j[F++] = y; else { var U = 0, G = 0; for (y == 16 ? (G = 3 + A(i, a, 3), a += 2, U = j[F - 1]) : y == 17 ? (G = 3 + A(i, a, 7), a += 3) : y == 18 && (G = 11 + A(i, a, 127), a += 7); G--; ) j[F++] = U; } } var le = j.subarray(0, M), I = j.subarray(M); d = te(le), g = te(I), p = _(le, d, 1), k = _(I, g, 1); } else b(1); else { var y = ot(a) + 4, O = i[y - 4] | i[y - 3] << 8, W = y + O; if (W > n) { f && b(0); break; } l && x(c + O), t.set(i.subarray(y, W), c), e.b = c += O, e.p = a = W * 8, e.f = s; continue; } if (a > B) { f && b(0); break; } } l && x(c + 131072); for (var Le = (1 << d) - 1, Me = (1 << g) - 1, K = a; ; K = a) { var U = p[ie(i, a) & Le], R = U >> 4; if (a += U & 15, a > B) { f && b(0); break; } if (U || b(2), R < 256) t[c++] = R; else if (R == 256) { K = a, p = null; break; } else { var pe = R - 254; if (R > 264) { var F = R - 257, H = Se[F]; pe = A(i, a, (1 << H) - 1) + De[F], a += H; } var X = k[ie(i, a) & Me], Y = X >> 4; X || b(3), a += X & 15; var I = nt[Y]; if (Y > 3) { var H = Be[Y]; I += ie(i, a) & (1 << H) - 1, a += H; } if (a > B) { f && b(0); break; } l && x(c + 131072); var ue = c + pe; if (c < I) { var he = o - I, je = Math.min(I, ue); for (he + c < 0 && b(3); c < je; ++c) t[c] = r[he + c]; } for (; c < ue; ++c) t[c] = t[c - I]; } } e.l = p, e.p = K, e.b = c, e.f = s, p && (s = 1, e.m = d, e.d = k, e.n = g); } while (!s); return c != t.length && m ? ct(t, 0, c) : t.subarray(0, c); }, mt = /* @__PURE__ */ new C(0), xt = function(i) { (i[0] != 31 || i[1] != 139 || i[2] != 8) && b(6, "invalid gzip data"); var e = i[3], t = 10; e & 4 && (t += (i[10] | i[11] << 8) + 2); for (var r = (e >> 3 & 1) + (e >> 4 & 1); r > 0; r -= !i[t++]) ; return t + (e & 2); }, lt = function(i) { var e = i.length; return (i[e - 4] | i[e - 3] << 8 | i[e - 2] << 16 | i[e - 1] << 24) >>> 0; }, pt = function(i, e) { return ((i[0] & 15) != 8 || i[0] >> 4 > 7 || (i[0] << 8 | i[1]) % 31) && b(6, "invalid zlib data"), (i[1] >> 5 & 1) == 1 && b(6, "invalid zlib data: " + (i[1] & 32 ? "need" : "unexpected") + " dictionary"), (i[1] >> 3 & 4) + 2; }; function ut(i, e) { return fe(i, { i: 2 }, e, e); } function ht(i, e) { var t = xt(i); return t + 8 > i.length && b(6, "invalid gzip data"), fe(i.subarray(t, -8), { i: 2 }, new C(lt(i)), e); } function dt(i, e) { return fe(i.subarray(pt(i), -4), { i: 2 }, e, e); } function gt(i, e) { return i[0] == 31 && i[1] == 139 && i[2] == 8 ? ht(i, e) : (i[0] & 15) != 8 || i[0] >> 4 > 7 || (i[0] << 8 | i[1]) % 31 ? ut(i, e) : dt(i, e); } var wt = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), vt = 0; try { wt.decode(mt, { stream: !0 }), vt = 1; } catch { } var ce = { exports: {} }, re, ke; function kt() { if (ke) return re; ke = 1; var i = 1e3, e = i * 60, t = e * 60, r = t * 24, n = r * 7, o = r * 365.25; re = function(s, a) { a = a || {}; var c = typeof s; if (c === "string" && s.length > 0) return m(s); if (c === "number" && isFinite(s)) return a.long ? f(s) : l(s); throw new Error( "val is not a non-empty string or a valid number. val=" + JSON.stringify(s) ); }; function m(s) { if (s = String(s), !(s.length > 100)) { var a = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( s ); if (a) { var c = parseFloat(a[1]), p = (a[2] || "ms").toLowerCase(); switch (p) { case "years": case "year": case "yrs": case "yr": case "y": return c * o; case "weeks": case "week": case "w": return c * n; case "days": case "day": case "d": return c * r; case "hours": case "hour": case "hrs": case "hr": case "h": return c * t; case "minutes": case "minute": case "mins": case "min": case "m": return c * e; case "seconds": case "second": case "secs": case "sec": case "s": return c * i; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": return c; default: return; } } } } function l(s) { var a = Math.abs(s); return a >= r ? Math.round(s / r) + "d" : a >= t ? Math.round(s / t) + "h" : a >= e ? Math.round(s / e) + "m" : a >= i ? Math.round(s / i) + "s" : s + "ms"; } function f(s) { var a = Math.abs(s); return a >= r ? x(s, a, r, "day") : a >= t ? x(s, a, t, "hour") : a >= e ? x(s, a, e, "minute") : a >= i ? x(s, a, i, "second") : s + " ms"; } function x(s, a, c, p) { var k = a >= c * 1.5; return Math.round(s / c) + " " + p + (k ? "s" : ""); } return re; } function bt(i) { t.debug = t, t.default = t, t.coerce = f, t.disable = m, t.enable = n, t.enabled = l, t.humanize = kt(), t.destroy = x, Object.keys(i).forEach((s) => { t[s] = i[s]; }), t.names = [], t.skips = [], t.formatters = {}; function e(s) { let a = 0; for (let c = 0; c < s.length; c++) a = (a << 5) - a + s.charCodeAt(c), a |= 0; return t.colors[Math.abs(a) % t.colors.length]; } t.selectColor = e; function t(s) { let a, c = null, p, k; function d(...g) { if (!d.enabled) return; const B = d, T = Number(/* @__PURE__ */ new Date()), y = T - (a || T); B.diff = y, B.prev = a, B.curr = T, a = T, g[0] = t.coerce(g[0]), typeof g[0] != "string" && g.unshift("%O"); let O = 0; g[0] = g[0].replace(/%([a-zA-Z%])/g, (M, Z) => { if (M === "%%") return "%"; O++; const q = t.formatters[Z]; if (typeof q == "function") { const j = g[O]; M = q.call(B, j), g.splice(O, 1), O--; } return M; }), t.formatArgs.call(B, g), (B.log || t.log).apply(B, g); } return d.namespace = s, d.useColors = t.useColors(), d.color = t.selectColor(s), d.extend = r, d.destroy = t.destroy, Object.defineProperty(d, "enabled", { enumerable: !0, configurable: !1, get: () => c !== null ? c : (p !== t.namespaces && (p = t.namespaces, k = t.enabled(s)), k), set: (g) => { c = g; } }), typeof t.init == "function" && t.init(d), d; } function r(s, a) { const c = t(this.namespace + (typeof a > "u" ? ":" : a) + s); return c.log = this.log, c; } function n(s) { t.save(s), t.namespaces = s, t.names = [], t.skips = []; const a = (typeof s == "string" ? s : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean); for (const c of a) c[0] === "-" ? t.skips.push(c.slice(1)) : t.names.push(c); } function o(s, a) { let c = 0, p = 0, k = -1, d = 0; for (; c < s.length; ) if (p < a.length && (a[p] === s[c] || a[p] === "*")) a[p] === "*" ? (k = p, d = c, p++) : (c++, p++); else if (k !== -1) p = k + 1, d++, c = d; else return !1; for (; p < a.length && a[p] === "*"; ) p++; return p === a.length; } function m() { const s = [ ...t.names, ...t.skips.map((a) => "-" + a) ].join(","); return t.enable(""), s; } function l(s) { for (const a of t.skips) if (o(s, a)) return !1; for (const a of t.names) if (o(s, a)) return !0; return !1; } function f(s) { return s instanceof Error ? s.stack || s.message : s; } function x() { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } return t.enable(t.load()), t; } var Ct = bt; (function(i, e) { e.formatArgs = r, e.save = n, e.load = o, e.useColors = t, e.storage = m(), e.destroy = /* @__PURE__ */ (() => { let f = !1; return () => { f || (f = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")); }; })(), e.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ]; function t() { if (typeof window < "u" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return !0; if (typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return !1; let f; return typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages typeof navigator < "u" && navigator.userAgent && (f = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(f[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } function r(f) { if (f[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + f[0] + (this.useColors ? "%c " : " ") + "+" + i.exports.humanize(this.diff), !this.useColors) return; const x = "color: " + this.color; f.splice(1, 0, x, "color: inherit"); let s = 0, a = 0; f[0].replace(/%[a-zA-Z%]/g, (c) => { c !== "%%" && (s++, c === "%c" && (a = s)); }), f.splice(a, 0, x); } e.log = console.debug || console.log || (() => { }); function n(f) { try { f ? e.storage.setItem("debug", f) : e.storage.removeItem("debug"); } catch { } } function o() { let f; try { f = e.storage.getItem("debug") || e.storage.getItem("DEBUG"); } catch { } return !f && typeof process < "u" && "env" in process && (f = process.env.DEBUG), f; } function m() { try { return localStorage; } catch { } } i.exports = Ct(e); const { formatters: l } = i.exports; l.j = function(f) { try { return JSON.stringify(f); } catch (x) { return "[UnexpectedJSONParseError]: " + x.message; } }; })(ce, ce.exports); var yt = ce.exports; const Ft = /* @__PURE__ */ Pe(yt), N = { LocalFileHeader: 67324752, DataDescriptor: 134695760, CentralFileHeader: 33639248, EndOfCentralDirectory: 101010256 }, be = { get(i) { return h.get(i, 6), { signature: w.get(i, 0), compressedSize: w.get(i, 8), uncompressedSize: w.get(i, 12) }; }, len: 16 }, St = { get(i) { const e = h.get(i, 6); return { signature: w.get(i, 0), minVersion: h.get(i, 4), dataDescriptor: !!(e & 8), compressedMethod: h.get(i, 8), compressedSize: w.get(i, 18), uncompressedSize: w.get(i, 22), filenameLength: h.get(i, 26), extraFieldLength: h.get(i, 28), filename: null }; }, len: 30 }, Bt = { get(i) { return { signature: w.get(i, 0), nrOfThisDisk: h.get(i, 4), nrOfThisDiskWithTheStart: h.get(i, 6), nrOfEntriesOnThisDisk: h.get(i, 8), nrOfEntriesOfSize: h.get(i, 10), sizeOfCd: w.get(i, 12), offsetOfStartOfCd: w.get(i, 16), zipFileCommentLength: h.get(i, 20) }; }, len: 22 }, At = { get(i) { const e = h.get(i, 8); return { signature: w.get(i, 0), minVersion: h.get(i, 6), dataDescriptor: !!(e & 8), compressedMethod: h.get(i, 10), compressedSize: w.get(i, 20), uncompressedSize: w.get(i, 24), filenameLength: h.get(i, 28), extraFieldLength: h.get(i, 30), fileCommentLength: h.get(i, 32), relativeOffsetOfLocalHeader: w.get(i, 42), filename: null }; }, len: 46 }; function Te(i) { const e = new Uint8Array(w.len); return w.put(e, 0, i), e; } const z = Ft("tokenizer:inflate"), ne = 256 * 1024, zt = Te(N.DataDescriptor), Q = Te(N.EndOfCentralDirectory); class Dt { constructor(e) { this.tokenizer = e, this.syncBuffer = new Uint8Array(ne); } async isZip() { return await this.peekSignature() === N.LocalFileHeader; } peekSignature() { return this.tokenizer.peekToken(w); } async findEndOfCentralDirectoryLocator() { const e = this.tokenizer, t = Math.min(16 * 1024, e.fileInfo.size), r = this.syncBuffer.subarray(0, t); await this.tokenizer.readBuffer(r, { position: e.fileInfo.size - t }); for (let n = r.length - 4; n >= 0; n--) if (r[n] === Q[0] && r[n + 1] === Q[1] && r[n + 2] === Q[2] && r[n + 3] === Q[3]) return e.fileInfo.size - t + n; return -1; } async readCentralDirectory() { if (!this.tokenizer.supportsRandomAccess()) { z("Cannot reading central-directory without random-read support"); return; } z("Reading central-directory..."); const e = this.tokenizer.position, t = await this.findEndOfCentralDirectoryLocator(); if (t > 0) { z("Central-directory 32-bit signature found"); const r = await this.tokenizer.readToken(Bt, t), n = []; this.tokenizer.setPosition(r.offsetOfStartOfCd); for (let o = 0; o < r.nrOfEntriesOfSize; ++o) { const m = await this.tokenizer.readToken(At); if (m.signature !== N.CentralFileHeader) throw new Error("Expected Central-File-Header signature"); m.filename = await this.tokenizer.readToken(new E(m.filenameLength, "utf-8")), await this.tokenizer.ignore(m.extraFieldLength), await this.tokenizer.ignore(m.fileCommentLength), n.push(m), z(`Add central-directory file-entry: n=${o + 1}/${n.length}: filename=${n[o].filename}`); } return this.tokenizer.setPosition(e), n; } this.tokenizer.setPosition(e); } async unzip(e) { const t = await this.readCentralDirectory(); if (t) return this.iterateOverCentralDirectory(t, e); let r = !1; do { const n = await this.readLocalFileHeader(); if (!n) break; const o = e(n); r = !!o.stop; let m; if (await this.tokenizer.ignore(n.extraFieldLength), n.dataDescriptor && n.compressedSize === 0) { const l = []; let f = ne; z("Compressed-file-size unknown, scanning for next data-descriptor-signature...."); let x = -1; for (; x < 0 && f === ne; ) { f = await this.tokenizer.peekBuffer(this.syncBuffer, { mayBeLess: !0 }), x = Et(this.syncBuffer.subarray(0, f), zt); const s = x >= 0 ? x : f; if (o.handler) { const a = new Uint8Array(s); await this.tokenizer.readBuffer(a), l.push(a); } else await this.tokenizer.ignore(s); } z(`Found data-descriptor-signature at pos=${this.tokenizer.position}`), o.handler && await this.inflate(n, Tt(l), o.handler); } else o.handler ? (z(`Reading compressed-file-data: ${n.compressedSize} bytes`), m = new Uint8Array(n.compressedSize), await this.tokenizer.readBuffer(m), await this.inflate(n, m, o.handler)) : (z(`Ignoring compressed-file-data: ${n.compressedSize} bytes`), await this.tokenizer.ignore(n.compressedSize)); if (z(`Reading data-descriptor at pos=${this.tokenizer.position}`), n.dataDescriptor && (await this.tokenizer.readToken(be)).signature !== 134695760) throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - be.len}`); } while (!r); } async iterateOverCentralDirectory(e, t) { for (const r of e) { const n = t(r); if (n.handler) { this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader); const o = await this.readLocalFileHeader(); if (o) { await this.tokenizer.ignore(o.extraFieldLength); const m = new Uint8Array(r.compressedSize); await this.tokenizer.readBuffer(m), await this.inflate(o, m, n.handler); } } if (n.stop) break; } } inflate(e, t, r) { if (e.compressedMethod === 0) return r(t); z(`Decompress filename=${e.filename}, compressed-size=${t.length}`); const n = gt(t); return r(n); } async readLocalFileHeader() { const e = await this.tokenizer.peekToken(w); if (e === N.LocalFileHeader) { const t = await this.tokenizer.readToken(St); return t.filename = await this.tokenizer.readToken(new E(t.filenameLength, "utf-8")), t; } if (e === N.CentralFileHeader) return !1; throw e === 3759263696 ? new Error("Encrypted ZIP") : new Error("Unexpected signature"); } } function Et(i, e) { const t = i.length, r = e.length; if (r > t) return -1; for (let n = 0; n <= t - r; n++) { let o = !0; for (let m = 0; m < r; m++) if (i[n + m] !== e[m]) { o = !1; break; } if (o) return n; } return -1; } function Tt(i) { const e = i.reduce((n, o) => n + o.length, 0), t = new Uint8Array(e); let r = 0; for (const n of i) t.set(n, r), r += n.length; return t; } new globalThis.TextDecoder("utf8"); new globalThis.TextEncoder(); Array.from({ length: 256 }, (i, e) => e.toString(16).padStart(2, "0")); function Ce(i) { const { byteLength: e } = i; if (e === 6) return i.getUint16(0) * 2 ** 32 + i.getUint32(2); if (e === 5) return i.getUint8(0) * 2 ** 32 + i.getUint32(1); if (e === 4) return i.getUint32(0); if (e === 3) return i.getUint8(0) * 2 ** 16 + i.getUint16(1); if (e === 2) return i.getUint16(0); if (e === 1) return i.getUint8(0); } function Ot(i) { return [...i].map((e) => e.charCodeAt(0)); } function It(i, e = 0) { const t = Number.parseInt(new E(6).get(i, 148).replace(/\0.*$/, "").trim(), 8); if (Number.isNaN(t)) return !1; let r = 8 * 32; for (let n = e; n < e + 148; n++) r += i[n]; for (let n = e + 156; n < e + 512; n++) r += i[n]; return t === r; } const Lt = { get: (i, e) => i[e + 3] & 127 | i[e + 2] << 7 | i[e + 1] << 14 | i[e] << 21, len: 4 }, Mt = [ "jpg", "png", "apng", "gif", "webp", "flif", "xcf", "cr2", "cr3", "orf", "arw", "dng", "nef", "rw2", "raf", "tif", "bmp", "icns", "jxr", "psd", "indd", "zip", "tar", "rar", "gz", "bz2", "7z", "dmg", "mp4", "mid", "mkv", "webm", "mov", "avi", "mpg", "mp2", "mp3", "m4a", "oga", "ogg", "ogv", "opus", "flac", "wav", "spx", "amr", "pdf", "epub", "elf", "macho", "exe", "swf", "rtf", "wasm", "woff", "woff2", "eot", "ttf", "otf", "ttc", "ico", "flv", "ps", "xz", "sqlite", "nes", "crx", "xpi", "cab", "deb", "ar", "rpm", "Z", "lz", "cfb", "mxf", "mts", "blend", "bpg", "docx", "pptx", "xlsx", "3gp", "3g2", "j2c", "jp2", "jpm", "jpx", "mj2", "aif", "qcp", "odt", "ods", "odp", "xml", "mobi", "heic", "cur", "ktx", "ape", "wv", "dcm", "ics", "glb", "pcap", "dsf", "lnk", "alias", "voc", "ac3", "m4v", "m4p", "m4b", "f4v", "f4p", "f4b", "f4a", "mie", "asf", "ogm", "ogx", "mpc", "arrow", "shp", "aac", "mp1", "it", "s3m", "xm", "skp", "avif", "eps", "lzh", "pgp", "asar", "stl", "chm", "3mf", "zst", "jxl", "vcf", "jls", "pst", "dwg", "parquet", "class", "arj", "cpio", "ace", "avro", "icc", "fbx", "vsdx", "vtt", "apk", "drc", "lz4", "potx", "xltx", "dotx", "xltm", "ott", "ots", "otp", "odg", "otg", "xlsm", "docm", "dotm", "potm", "pptm", "jar", "rm", "ppsm", "ppsx" ], jt = [ "image/jpeg", "image/png", "image/gif", "image/webp", "image/flif", "image/x-xcf", "image/x-canon-cr2", "image/x-canon-cr3", "image/tiff", "image/bmp", "image/vnd.ms-photo", "image/vnd.adobe.photoshop", "application/x-indesign", "application/epub+zip", "application/x-xpinstall", "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "application/vnd.oasis.opendocument.text", "application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.presentation", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "application/zip", "application/x-tar", "application/x-rar-compressed", "application/gzip", "application/x-bzip2", "application/x-7z-compressed", "application/x-apple-diskimage", "application/vnd.apache.arrow.file", "video/mp4", "audio/midi", "video/matroska", "video/webm", "video/quicktime", "video/vnd.avi", "audio/wav", "audio/qcelp", "audio/x-ms-asf", "video/x-ms-asf", "application/vnd.ms-asf", "video/mpeg", "video/3gpp", "audio/mpeg", "audio/mp4", // RFC 4337 "video/ogg", "audio/ogg", "audio/ogg; codecs=opus", "application/ogg", "audio/flac", "audio/ape", "audio/wavpack", "audio/amr", "application/pdf", "application/x-elf", "application/x-mach-binary", "application/x-msdownload", "application/x-shockwave-flash", "application/rtf", "application/wasm", "font/woff", "font/woff2", "application/vnd.ms-fontobject", "font/ttf", "font/otf", "font/collection", "image/x-icon", "video/x-flv", "application/postscript", "application/eps", "application/x-xz", "application/x-sqlite3", "application/x-nintendo-nes-rom", "application/x-google-chrome-extension", "application/vnd.ms-cab-compressed", "application/x-deb", "application/x-unix-archive", "application/x-rpm", "application/x-compress", "application/x-lzip", "application/x-cfb", "application/x-mie", "application/mxf", "video/mp2t", "application/x-blender", "image/bpg", "image/j2c", "image/jp2", "image/jpx", "image/jpm", "image/mj2", "audio/aiff", "application/xml", "application/x-mobipocket-ebook", "image/heif", "image/heif-sequence", "image/heic", "image/heic-sequence", "image/icns", "image/ktx", "application/dicom", "audio/x-musepack", "text/calendar", "text/vcard", "text/vtt", "model/gltf-binary", "application/vnd.tcpdump.pcap", "audio/x-dsf", // Non-standard "application/x.ms.shortcut", // Invented by us "application/x.apple.alias", // Invented by us "audio/x-voc", "audio/vnd.dolby.dd-raw", "audio/x-m4a", "image/apng", "image/x-olympus-orf", "image/x-sony-arw", "image/x-adobe-dng", "image/x-nikon-nef", "image/x-panasonic-rw2", "image/x-fujifilm-raf", "video/x-m4v", "video/3gpp2", "application/x-esri-shape", "audio/aac", "audio/x-it", "audio/x-s3m", "audio/x-xm", "video/MP1S", "video/MP2P", "application/vnd.sketchup.skp", "image/avif", "application/x-lzh-compressed", "application/pgp-encrypted", "application/x-asar", "model/stl", "application/vnd.ms-htmlhelp", "model/3mf", "image/jxl", "application/zstd", "image/jls", "application/vnd.ms-outlook", "image/vnd.dwg", "application/vnd.apache.parquet", "application/java-vm", "application/x-arj", "application/x-cpio", "application/x-ace-compressed", "application/avro", "application/vnd.iccprofile", "application/x.autodesk.fbx", // Invented by us "application/vnd.visio", "application/vnd.android.package-archive", "application/vnd.google.draco", // Invented by us "application/x-lz4", // Invented by us "application/vnd.openxmlformats-officedocument.presentationml.template", "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "application/vnd.ms-excel.template.macroenabled.12", "application/vnd.oasis.opendocument.text-template", "application/vnd.oasis.opendocument.spreadsheet-template", "application/vnd.oasis.opendocument.presentation-template", "application/vnd.oasis.opendocument.graphics", "application/vnd.oasis.opendocument.graphics-template", "application/vnd.ms-excel.sheet.macroenabled.12", "application/vnd.ms-word.document.macroenabled.12", "application/vnd.ms-word.template.macroenabled.12", "application/vnd.ms-powerpoint.template.macroenabled.12", "application/vnd.ms-powerpoint.presentation.macroenabled.12", "application/java-archive", "application/vnd.rn-realmedia" ], ae = 4100; async function Nt(i, e) { return new Ut(e).fromBlob(i); } function se(i) { switch (i = i.toLowerCase(), i) { case "application/epub+zip": return { ext: "epub", mime: i }; case "application/vnd.oasis.opendocument.text": return { ext: "odt", mime: i }; case "application/vnd.oasis.opendocument.text-template": return { ext: "ott", mime: i }; case "application/vnd.oasis.opendocument.spreadsheet": return { ext: "ods", mime: i }; case "application/vnd.oasis.opendocument.spreadsheet-template": return { ext: "ots", mime: i }; case "application/vnd.oasis.opendocument.presentation": return { ext: "odp", mime: i }; case "application/vnd.oasis.opendocument.presentation-template": return { ext: "otp", mime: i }; case "application/vnd.oasis.opendocument.graphics": return { ext: "odg", mime: i }; case "application/vnd.oasis.opendocument.graphics-template": return { ext: "otg", mime: i }; case "application/vnd.openxmlformats-officedocument.presentationml.slideshow": return { ext: "ppsx", mime: i }; case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return { ext: "xlsx", mime: i }; case "application/vnd.ms-excel.sheet.macroenabled": return { ext: "xlsm", mime: "application/vnd.ms-excel.sheet.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.spreadsheetml.template": return { ext: "xltx", mime: i }; case "application/vnd.ms-excel.template.macroenabled": return { ext: "xltm", mime: "application/vnd.ms-excel.template.macroenabled.12" }; case "application/vnd.ms-powerpoint.slideshow.macroenabled": return { ext: "ppsm", mime: "application/vnd.ms-powerpoint.slideshow.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return { ext: "docx", mime: i }; case "application/vnd.ms-word.document.macroenabled": return { ext: "docm", mime: "application/vnd.ms-word.document.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.wordprocessingml.template": return { ext: "dotx", mime: i }; case "application/vnd.ms-word.template.macroenabledtemplate": return { ext: "dotm", mime: "application/vnd.ms-word.template.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.presentationml.template": return { ext: "potx", mime: i }; case "application/vnd.ms-powerpoint.template.macroenabled": return { ext: "potm", mime: "application/vnd.ms-powerpoint.template.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return { ext: "pptx", mime: i }; case "application/vnd.ms-powerpoint.presentation.macroenabled": return { ext: "pptm", mime: "application/vnd.ms-powerpoint.presentation.macroenabled.12" }; case "application/vnd.ms-visio.drawing": return { ext: "vsdx", mime: "application/vnd.visio" }; case "application/vnd.ms-package.3dmanufacturing-3dmodel+xml": return { ext: "3mf", mime: "model/3mf" }; } } function D(i, e, t) { t = { offset: 0, ...t }; for (const [r, n] of e.entries()) if (t.mask) { if (n !== (t.mask[r] & i[r + t.offset])) return !1; } else if (n !== i[r + t.offset]) return !1; return !0; } class Ut { constructor(e) { // Detections with a high degree of certainty in identifying the correct file type ee(this, "detectConfident", async (e) => { if (this.buffer = new Uint8Array(ae), e.fileInfo.size === void 0 && (e.fileInfo.size = Number.MAX_SAFE_INTEGER), this.tokenizer = e, await e.peekBuffer(this.buffer, { length: 12, mayBeLess: !0 }), this.check([66, 77])) return { ext: "bmp", mime: "image/bmp" }; if (this.check([11, 119])) return { ext: "ac3", mime: "audio/vnd.dolby.dd-raw" }; if (this.check([120, 1])) return { ext: "dmg", mime: "application/x-apple-diskimage" }; if (this.check([77, 90])) return { ext: "exe", mime: "application/x-msdownload" }; if (this.check([37, 33])) return await e.peekBuffer(this.buffer, { length: 24, mayBeLess: !0 }), this.checkString("PS-Adobe-", { offset: 2 }) && this.checkString(" EPSF-", { offset: 14 }) ? { ext: "eps", mime: "application/eps" } : { ext: "ps", mime: "application/postscript" }; if (this.check([31, 160]) || this.check([31, 157])) return { ext: "Z", mime: "application/x-compress" }; if (this.check([199, 113])) return { ext: "cpio", mime: "application/x-cpio" }; if (this.check([96, 234])) return { ext: "arj", mime: "application/x-arj" }; if (this.check([239, 187, 191])) return this.tokenizer.ignore(3), this.detectConfident(e); if (this.check([71, 73, 70])) return { ext: "gif", mime: "image/gif" }; if (this.check([73, 73, 188])) return { ext: "jxr", mime: "image/vnd.ms-photo" }; if (this.check([31, 139, 8])) return { ext: "gz", mime: "application/gzip" }; if (this.check([66, 90, 104])) return { ext: "bz2", mime: "application/x-bzip2" }; if (this.checkString("ID3")) { await e.ignore(6); const t = await e.readToken(Lt); return e.position + t > e.fileInfo.size ? { ext: "mp3", mime: "audio/mpeg" } : (await e.ignore(t), this.fromTokenizer(e)); } if (this.checkString("MP+")) return { ext: "mpc", mime: "audio/x-musepack" }; if ((this.buffer[0] === 67 || this.buffer[0] === 70) && this.check([87, 83], { offset: 1 })) return { ext: "swf", mime: "application/x-shockwave-flash" }; if (this.check([255, 216, 255])) return this.check([247], { offset: 3 }) ? { ext: "jls", mime: "image/jls" } : { ext: "jpg", mime: "image/jpeg" }; if (this.check([79, 98, 106, 1])) return { ext: "avro", mime: "application/avro" }; if (this.checkString("FLIF")) return { ext: "flif", mime: "image/flif" }; if (this.checkString("8BPS")) return { ext: "psd", mime: "image/vnd.adobe.photoshop" }; if (this.checkString("MPCK")) return { ext: "mpc", mime: "audio/x-musepack" }; if (this.checkString("FORM")) return { ext: "aif", mime: "audio/aiff" }; if (this.checkString("icns", { offset: 0 })) return { ext: "icns", mime: "image/icns" }; if (this.check([80, 75, 3, 4])) { let t; return await new Dt(e).unzip((r) => { switch (r.filename) { case "META-I