@queuedash/api
Version:
A stunning, sleek dashboard for Bull, BullMQ, and Bee-Queue
1,871 lines (1,870 loc) • 77.7 kB
JavaScript
var J = Object.defineProperty;
var X = (i, e, t) => e in i ? J(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
var T = (i, e, t) => X(i, typeof e != "symbol" ? e + "" : e, t);
import { g as K } from "./main-CnhgUuOc.mjs";
const M = {
128: "€",
130: "‚",
131: "ƒ",
132: "„",
133: "…",
134: "†",
135: "‡",
136: "ˆ",
137: "‰",
138: "Š",
139: "‹",
140: "Œ",
142: "Ž",
145: "‘",
146: "’",
147: "“",
148: "”",
149: "•",
150: "–",
151: "—",
152: "˜",
153: "™",
154: "š",
155: "›",
156: "œ",
158: "ž",
159: "Ÿ"
};
for (const [i, e] of Object.entries(M))
;
function Y(i, e = "utf-8") {
switch (e.toLowerCase()) {
case "utf-8":
case "utf8":
return typeof globalThis.TextDecoder < "u" ? new globalThis.TextDecoder("utf-8").decode(i) : ee(i);
case "utf-16le":
return te(i);
case "ascii":
return ie(i);
case "latin1":
case "iso-8859-1":
return ne(i);
case "windows-1252":
return re(i);
default:
throw new RangeError(`Encoding '${e}' not supported`);
}
}
function ee(i) {
let e = "", t = 0;
for (; t < i.length; ) {
const n = i[t++];
if (n < 128)
e += String.fromCharCode(n);
else if (n < 224) {
const r = i[t++] & 63;
e += String.fromCharCode((n & 31) << 6 | r);
} else if (n < 240) {
const r = i[t++] & 63, a = i[t++] & 63;
e += String.fromCharCode((n & 15) << 12 | r << 6 | a);
} else {
const r = i[t++] & 63, a = i[t++] & 63, f = i[t++] & 63;
let p = (n & 7) << 18 | r << 12 | a << 6 | f;
p -= 65536, e += String.fromCharCode(55296 + (p >> 10 & 1023), 56320 + (p & 1023));
}
}
return e;
}
function te(i) {
let e = "";
for (let t = 0; t < i.length; t += 2)
e += String.fromCharCode(i[t] | i[t + 1] << 8);
return e;
}
function ie(i) {
return String.fromCharCode(...i.map((e) => e & 127));
}
function ne(i) {
return String.fromCharCode(...i);
}
function re(i) {
let e = "";
for (const t of i)
t >= 128 && t <= 159 && M[t] ? e += M[t] : e += String.fromCharCode(t);
return e;
}
function w(i) {
return new DataView(i.buffer, i.byteOffset);
}
const ae = {
len: 1,
get(i, e) {
return w(i).getUint8(e);
},
put(i, e, t) {
return w(i).setUint8(e, t), e + 1;
}
}, l = {
len: 2,
get(i, e) {
return w(i).getUint16(e, !0);
},
put(i, e, t) {
return w(i).setUint16(e, t, !0), e + 2;
}
}, B = {
len: 2,
get(i, e) {
return w(i).getUint16(e);
},
put(i, e, t) {
return w(i).setUint16(e, t), e + 2;
}
}, h = {
len: 4,
get(i, e) {
return w(i).getUint32(e, !0);
},
put(i, e, t) {
return w(i).setUint32(e, t, !0), e + 4;
}
}, se = {
len: 4,
get(i, e) {
return w(i).getUint32(e);
},
put(i, e, t) {
return w(i).setUint32(e, t), e + 4;
}
}, oe = {
len: 4,
get(i, e) {
return w(i).getInt32(e);
},
put(i, e, t) {
return w(i).setInt32(e, t), e + 4;
}
}, ce = {
len: 8,
get(i, e) {
return w(i).getBigUint64(e, !0);
},
put(i, e, t) {
return w(i).setBigUint64(e, t, !0), e + 8;
}
};
class v {
constructor(e, t) {
this.len = e, this.encoding = t;
}
get(e, t = 0) {
const n = e.subarray(t, t + this.len);
return Y(n, this.encoding);
}
}
const fe = "End-Of-Stream";
class g extends Error {
constructor() {
super(fe), this.name = "EndOfStreamError";
}
}
class me extends Error {
constructor(e = "The operation was aborted") {
super(e), this.name = "AbortError";
}
}
class W {
constructor() {
this.endOfStream = !1, this.interrupted = !1, this.peekQueue = [];
}
async peek(e, t = !1) {
const n = await this.read(e, t);
return this.peekQueue.push(e.subarray(0, n)), n;
}
async read(e, t = !1) {
if (e.length === 0)
return 0;
let n = this.readFromPeekBuffer(e);
if (this.endOfStream || (n += await this.readRemainderFromStream(e.subarray(n), t)), n === 0 && !t)
throw new g();
return n;
}
/**
* 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, n = 0;
for (; this.peekQueue.length > 0 && t > 0; ) {
const r = this.peekQueue.pop();
if (!r)
throw new Error("peekData should be defined");
const a = Math.min(r.length, t);
e.set(r.subarray(0, a), n), n += a, t -= a, a < r.length && this.peekQueue.push(r.subarray(a));
}
return n;
}
async readRemainderFromStream(e, t) {
let n = 0;
for (; n < e.length && !this.endOfStream; ) {
if (this.interrupted)
throw new me();
const r = await this.readFromStream(e.subarray(n), t);
if (r === 0)
break;
n += r;
}
if (!t && n < e.length)
throw new g();
return n;
}
}
class xe extends W {
constructor(e) {
super(), this.reader = e;
}
async abort() {
return this.close();
}
async close() {
this.reader.releaseLock();
}
}
class pe extends xe {
/**
* 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 n = await this.reader.read(new Uint8Array(e.length), { min: t ? void 0 : e.length });
return n.done && (this.endOfStream = n.done), n.value ? (e.set(n.value), n.value.length) : 0;
}
}
class q extends W {
constructor(e) {
super(), this.reader = e, this.buffer = null;
}
/**
* Copy chunk to target, and store the remainder in this.buffer
*/
writeChunk(e, t) {
const n = Math.min(t.length, e.length);
return e.set(t.subarray(0, n)), n < t.length ? this.buffer = t.subarray(n) : this.buffer = null, n;
}
/**
* 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 n = 0;
for (this.buffer && (n += this.writeChunk(e, this.buffer)); n < e.length && !this.endOfStream; ) {
const r = await this.reader.read();
if (r.done) {
this.endOfStream = !0;
break;
}
r.value && (n += this.writeChunk(e.subarray(n), r.value));
}
if (!t && n === 0 && this.endOfStream)
throw new g();
return n;
}
abort() {
return this.interrupted = !0, this.reader.cancel();
}
async close() {
await this.abort(), this.reader.releaseLock();
}
}
function le(i) {
try {
const e = i.getReader({ mode: "byob" });
return e instanceof ReadableStreamDefaultReader ? new q(e) : new pe(e);
} catch (e) {
if (e instanceof TypeError)
return new q(i.getReader());
throw e;
}
}
class R {
/**
* 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 n = new Uint8Array(e.len);
if (await this.readBuffer(n, { position: t }) < e.len)
throw new g();
return e.get(n, 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 n = new Uint8Array(e.len);
if (await this.peekBuffer(n, { position: t }) < e.len)
throw new g();
return e.get(n, 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 g();
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 g();
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 ue = 256e3;
class he extends R {
/**
* 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 n = this.normalizeOptions(e, t), r = n.position - this.position;
if (r > 0)
return await this.ignore(r), this.readBuffer(e, t);
if (r < 0)
throw new Error("`options.position` must be equal or greater than `tokenizer.position`");
if (n.length === 0)
return 0;
const a = await this.streamReader.read(e.subarray(0, n.length), n.mayBeLess);
if (this.position += a, (!t || !t.mayBeLess) && a < n.length)
throw new g();
return a;
}
/**
* 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 n = this.normalizeOptions(e, t);
let r = 0;
if (n.position) {
const a = n.position - this.position;
if (a > 0) {
const f = new Uint8Array(n.length + a);
return r = await this.peekBuffer(f, { mayBeLess: n.mayBeLess }), e.set(f.subarray(a)), r - a;
}
if (a < 0)
throw new Error("Cannot peek from a negative offset in a stream");
}
if (n.length > 0) {
try {
r = await this.streamReader.peek(e.subarray(0, n.length), n.mayBeLess);
} catch (a) {
if (t != null && t.mayBeLess && a instanceof g)
return 0;
throw a;
}
if (!n.mayBeLess && r < n.length)
throw new g();
}
return r;
}
async ignore(e) {
const t = Math.min(ue, e), n = new Uint8Array(t);
let r = 0;
for (; r < e; ) {
const a = e - r, f = await this.readBuffer(n, { length: Math.min(t, a) });
if (f < 0)
return f;
r += f;
}
return r;
}
abort() {
return this.streamReader.abort();
}
async close() {
return this.streamReader.close();
}
supportsRandomAccess() {
return !1;
}
}
class de extends R {
/**
* 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 n = await this.peekBuffer(e, t);
return this.position += n, n;
}
/**
* Peek (read ahead) buffer from tokenizer
* @param uint8Array
* @param options - Read behaviour options
* @returns {Promise<number>}
*/
async peekBuffer(e, t) {
const n = this.normalizeOptions(e, t), r = Math.min(this.uint8Array.length - n.position, n.length);
if (!n.mayBeLess && r < n.length)
throw new g();
return e.set(this.uint8Array.subarray(n.position, n.position + r)), r;
}
close() {
return super.close();
}
supportsRandomAccess() {
return !0;
}
setPosition(e) {
this.position = e;
}
}
class ge extends R {
/**
* Construct BufferTokenizer
* @param blob - Uint8Array to tokenize
* @param options Tokenizer options
*/
constructor(e, t) {
super(t), this.blob = e, this.fileInfo = { ...(t == null ? void 0 : t.fileInfo) ?? {}, size: e.size, mimeType: e.type };
}
/**
* 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 n = await this.peekBuffer(e, t);
return this.position += n, n;
}
/**
* Peek (read ahead) buffer from tokenizer
* @param buffer
* @param options - Read behaviour options
* @returns {Promise<number>}
*/
async peekBuffer(e, t) {
const n = this.normalizeOptions(e, t), r = Math.min(this.blob.size - n.position, n.length);
if (!n.mayBeLess && r < n.length)
throw new g();
const a = await this.blob.slice(n.position, n.position + r).arrayBuffer();
return e.set(new Uint8Array(a)), r;
}
close() {
return super.close();
}
supportsRandomAccess() {
return !0;
}
setPosition(e) {
this.position = e;
}
}
function we(i, e) {
const t = le(i), n = e ?? {}, r = n.onClose;
return n.onClose = async () => {
if (await t.close(), r)
return r();
}, new he(t, n);
}
function ke(i, e) {
return new de(i, e);
}
function be(i, e) {
return new ge(i, e);
}
var U = { exports: {} }, I, H;
function Ce() {
if (H) return I;
H = 1;
var i = 1e3, e = i * 60, t = e * 60, n = t * 24, r = n * 7, a = n * 365.25;
I = function(s, o) {
o = o || {};
var m = typeof s;
if (m === "string" && s.length > 0)
return f(s);
if (m === "number" && isFinite(s))
return o.long ? c(s) : p(s);
throw new Error(
"val is not a non-empty string or a valid number. val=" + JSON.stringify(s)
);
};
function f(s) {
if (s = String(s), !(s.length > 100)) {
var o = /^(-?(?:\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 (o) {
var m = parseFloat(o[1]), u = (o[2] || "ms").toLowerCase();
switch (u) {
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return m * a;
case "weeks":
case "week":
case "w":
return m * r;
case "days":
case "day":
case "d":
return m * n;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return m * t;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return m * e;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return m * i;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return m;
default:
return;
}
}
}
}
function p(s) {
var o = Math.abs(s);
return o >= n ? Math.round(s / n) + "d" : o >= t ? Math.round(s / t) + "h" : o >= e ? Math.round(s / e) + "m" : o >= i ? Math.round(s / i) + "s" : s + "ms";
}
function c(s) {
var o = Math.abs(s);
return o >= n ? x(s, o, n, "day") : o >= t ? x(s, o, t, "hour") : o >= e ? x(s, o, e, "minute") : o >= i ? x(s, o, i, "second") : s + " ms";
}
function x(s, o, m, u) {
var y = o >= m * 1.5;
return Math.round(s / m) + " " + u + (y ? "s" : "");
}
return I;
}
function ve(i) {
t.debug = t, t.default = t, t.coerce = c, t.disable = f, t.enable = r, t.enabled = p, t.humanize = Ce(), t.destroy = x, Object.keys(i).forEach((s) => {
t[s] = i[s];
}), t.names = [], t.skips = [], t.formatters = {};
function e(s) {
let o = 0;
for (let m = 0; m < s.length; m++)
o = (o << 5) - o + s.charCodeAt(m), o |= 0;
return t.colors[Math.abs(o) % t.colors.length];
}
t.selectColor = e;
function t(s) {
let o, m = null, u, y;
function d(...k) {
if (!d.enabled)
return;
const F = d, A = Number(/* @__PURE__ */ new Date()), G = A - (o || A);
F.diff = G, F.prev = o, F.curr = A, o = A, k[0] = t.coerce(k[0]), typeof k[0] != "string" && k.unshift("%O");
let z = 0;
k[0] = k[0].replace(/%([a-zA-Z%])/g, (E, Q) => {
if (E === "%%")
return "%";
z++;
const N = t.formatters[Q];
if (typeof N == "function") {
const $ = k[z];
E = N.call(F, $), k.splice(z, 1), z--;
}
return E;
}), t.formatArgs.call(F, k), (F.log || t.log).apply(F, k);
}
return d.namespace = s, d.useColors = t.useColors(), d.color = t.selectColor(s), d.extend = n, d.destroy = t.destroy, Object.defineProperty(d, "enabled", {
enumerable: !0,
configurable: !1,
get: () => m !== null ? m : (u !== t.namespaces && (u = t.namespaces, y = t.enabled(s)), y),
set: (k) => {
m = k;
}
}), typeof t.init == "function" && t.init(d), d;
}
function n(s, o) {
const m = t(this.namespace + (typeof o > "u" ? ":" : o) + s);
return m.log = this.log, m;
}
function r(s) {
t.save(s), t.namespaces = s, t.names = [], t.skips = [];
const o = (typeof s == "string" ? s : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
for (const m of o)
m[0] === "-" ? t.skips.push(m.slice(1)) : t.names.push(m);
}
function a(s, o) {
let m = 0, u = 0, y = -1, d = 0;
for (; m < s.length; )
if (u < o.length && (o[u] === s[m] || o[u] === "*"))
o[u] === "*" ? (y = u, d = m, u++) : (m++, u++);
else if (y !== -1)
u = y + 1, d++, m = d;
else
return !1;
for (; u < o.length && o[u] === "*"; )
u++;
return u === o.length;
}
function f() {
const s = [
...t.names,
...t.skips.map((o) => "-" + o)
].join(",");
return t.enable(""), s;
}
function p(s) {
for (const o of t.skips)
if (a(s, o))
return !1;
for (const o of t.names)
if (a(s, o))
return !0;
return !1;
}
function c(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 ye = ve;
(function(i, e) {
e.formatArgs = n, e.save = r, e.load = a, e.useColors = t, e.storage = f(), e.destroy = /* @__PURE__ */ (() => {
let c = !1;
return () => {
c || (c = !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 c;
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 && (c = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(c[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 n(c) {
if (c[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + c[0] + (this.useColors ? "%c " : " ") + "+" + i.exports.humanize(this.diff), !this.useColors)
return;
const x = "color: " + this.color;
c.splice(1, 0, x, "color: inherit");
let s = 0, o = 0;
c[0].replace(/%[a-zA-Z%]/g, (m) => {
m !== "%%" && (s++, m === "%c" && (o = s));
}), c.splice(o, 0, x);
}
e.log = console.debug || console.log || (() => {
});
function r(c) {
try {
c ? e.storage.setItem("debug", c) : e.storage.removeItem("debug");
} catch {
}
}
function a() {
let c;
try {
c = e.storage.getItem("debug") || e.storage.getItem("DEBUG");
} catch {
}
return !c && typeof process < "u" && "env" in process && (c = process.env.DEBUG), c;
}
function f() {
try {
return localStorage;
} catch {
}
}
i.exports = ye(e);
const { formatters: p } = i.exports;
p.j = function(c) {
try {
return JSON.stringify(c);
} catch (x) {
return "[UnexpectedJSONParseError]: " + x.message;
}
};
})(U, U.exports);
var Fe = U.exports;
const Se = /* @__PURE__ */ K(Fe), S = {
LocalFileHeader: 67324752,
DataDescriptor: 134695760,
CentralFileHeader: 33639248,
EndOfCentralDirectory: 101010256
}, V = {
get(i) {
return {
signature: h.get(i, 0),
compressedSize: h.get(i, 8),
uncompressedSize: h.get(i, 12)
};
},
len: 16
}, Be = {
get(i) {
const e = l.get(i, 6);
return {
signature: h.get(i, 0),
minVersion: l.get(i, 4),
dataDescriptor: !!(e & 8),
compressedMethod: l.get(i, 8),
compressedSize: h.get(i, 18),
uncompressedSize: h.get(i, 22),
filenameLength: l.get(i, 26),
extraFieldLength: l.get(i, 28),
filename: null
};
},
len: 30
}, Ae = {
get(i) {
return {
signature: h.get(i, 0),
nrOfThisDisk: l.get(i, 4),
nrOfThisDiskWithTheStart: l.get(i, 6),
nrOfEntriesOnThisDisk: l.get(i, 8),
nrOfEntriesOfSize: l.get(i, 10),
sizeOfCd: h.get(i, 12),
offsetOfStartOfCd: h.get(i, 16),
zipFileCommentLength: l.get(i, 20)
};
},
len: 22
}, ze = {
get(i) {
const e = l.get(i, 8);
return {
signature: h.get(i, 0),
minVersion: l.get(i, 6),
dataDescriptor: !!(e & 8),
compressedMethod: l.get(i, 10),
compressedSize: h.get(i, 20),
uncompressedSize: h.get(i, 24),
filenameLength: l.get(i, 28),
extraFieldLength: l.get(i, 30),
fileCommentLength: l.get(i, 32),
relativeOffsetOfLocalHeader: h.get(i, 42),
filename: null
};
},
len: 46
};
function Z(i) {
const e = new Uint8Array(h.len);
return h.put(e, 0, i), e;
}
const b = Se("tokenizer:inflate"), O = 256 * 1024, De = Z(S.DataDescriptor), D = Z(S.EndOfCentralDirectory);
class P {
constructor(e) {
this.tokenizer = e, this.syncBuffer = new Uint8Array(O);
}
async isZip() {
return await this.peekSignature() === S.LocalFileHeader;
}
peekSignature() {
return this.tokenizer.peekToken(h);
}
async findEndOfCentralDirectoryLocator() {
const e = this.tokenizer, t = Math.min(16 * 1024, e.fileInfo.size), n = this.syncBuffer.subarray(0, t);
await this.tokenizer.readBuffer(n, { position: e.fileInfo.size - t });
for (let r = n.length - 4; r >= 0; r--)
if (n[r] === D[0] && n[r + 1] === D[1] && n[r + 2] === D[2] && n[r + 3] === D[3])
return e.fileInfo.size - t + r;
return -1;
}
async readCentralDirectory() {
if (!this.tokenizer.supportsRandomAccess()) {
b("Cannot reading central-directory without random-read support");
return;
}
b("Reading central-directory...");
const e = this.tokenizer.position, t = await this.findEndOfCentralDirectoryLocator();
if (t > 0) {
b("Central-directory 32-bit signature found");
const n = await this.tokenizer.readToken(Ae, t), r = [];
this.tokenizer.setPosition(n.offsetOfStartOfCd);
for (let a = 0; a < n.nrOfEntriesOfSize; ++a) {
const f = await this.tokenizer.readToken(ze);
if (f.signature !== S.CentralFileHeader)
throw new Error("Expected Central-File-Header signature");
f.filename = await this.tokenizer.readToken(new v(f.filenameLength, "utf-8")), await this.tokenizer.ignore(f.extraFieldLength), await this.tokenizer.ignore(f.fileCommentLength), r.push(f), b(`Add central-directory file-entry: n=${a + 1}/${r.length}: filename=${r[a].filename}`);
}
return this.tokenizer.setPosition(e), r;
}
this.tokenizer.setPosition(e);
}
async unzip(e) {
const t = await this.readCentralDirectory();
if (t)
return this.iterateOverCentralDirectory(t, e);
let n = !1;
do {
const r = await this.readLocalFileHeader();
if (!r)
break;
const a = e(r);
n = !!a.stop;
let f;
if (await this.tokenizer.ignore(r.extraFieldLength), r.dataDescriptor && r.compressedSize === 0) {
const p = [];
let c = O;
b("Compressed-file-size unknown, scanning for next data-descriptor-signature....");
let x = -1;
for (; x < 0 && c === O; ) {
c = await this.tokenizer.peekBuffer(this.syncBuffer, { mayBeLess: !0 }), x = Ee(this.syncBuffer.subarray(0, c), De);
const s = x >= 0 ? x : c;
if (a.handler) {
const o = new Uint8Array(s);
await this.tokenizer.readBuffer(o), p.push(o);
} else
await this.tokenizer.ignore(s);
}
b(`Found data-descriptor-signature at pos=${this.tokenizer.position}`), a.handler && await this.inflate(r, Te(p), a.handler);
} else
a.handler ? (b(`Reading compressed-file-data: ${r.compressedSize} bytes`), f = new Uint8Array(r.compressedSize), await this.tokenizer.readBuffer(f), await this.inflate(r, f, a.handler)) : (b(`Ignoring compressed-file-data: ${r.compressedSize} bytes`), await this.tokenizer.ignore(r.compressedSize));
if (b(`Reading data-descriptor at pos=${this.tokenizer.position}`), r.dataDescriptor && (await this.tokenizer.readToken(V)).signature !== 134695760)
throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - V.len}`);
} while (!n);
}
async iterateOverCentralDirectory(e, t) {
for (const n of e) {
const r = t(n);
if (r.handler) {
this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);
const a = await this.readLocalFileHeader();
if (a) {
await this.tokenizer.ignore(a.extraFieldLength);
const f = new Uint8Array(n.compressedSize);
await this.tokenizer.readBuffer(f), await this.inflate(a, f, r.handler);
}
}
if (r.stop)
break;
}
}
async inflate(e, t, n) {
if (e.compressedMethod === 0)
return n(t);
if (e.compressedMethod !== 8)
throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);
b(`Decompress filename=${e.filename}, compressed-size=${t.length}`);
const r = await P.decompressDeflateRaw(t);
return n(r);
}
static async decompressDeflateRaw(e) {
const t = new ReadableStream({
start(a) {
a.enqueue(e), a.close();
}
}), n = new DecompressionStream("deflate-raw"), r = t.pipeThrough(n);
try {
const f = await new Response(r).arrayBuffer();
return new Uint8Array(f);
} catch (a) {
const f = a instanceof Error ? `Failed to deflate ZIP entry: ${a.message}` : "Unknown decompression error in ZIP entry";
throw new TypeError(f);
}
}
async readLocalFileHeader() {
const e = await this.tokenizer.peekToken(h);
if (e === S.LocalFileHeader) {
const t = await this.tokenizer.readToken(Be);
return t.filename = await this.tokenizer.readToken(new v(t.filenameLength, "utf-8")), t;
}
if (e === S.CentralFileHeader)
return !1;
throw e === 3759263696 ? new Error("Encrypted ZIP") : new Error("Unexpected signature");
}
}
function Ee(i, e) {
const t = i.length, n = e.length;
if (n > t)
return -1;
for (let r = 0; r <= t - n; r++) {
let a = !0;
for (let f = 0; f < n; f++)
if (i[r + f] !== e[f]) {
a = !1;
break;
}
if (a)
return r;
}
return -1;
}
function Te(i) {
const e = i.reduce((r, a) => r + a.length, 0), t = new Uint8Array(e);
let n = 0;
for (const r of i)
t.set(r, n), n += r.length;
return t;
}
class Ie {
constructor(e) {
this.tokenizer = e;
}
inflate() {
const e = this.tokenizer;
return new ReadableStream({
async pull(t) {
const n = new Uint8Array(1024), r = await e.readBuffer(n, { mayBeLess: !0 });
if (r === 0) {
t.close();
return;
}
t.enqueue(n.subarray(0, r));
}
}).pipeThrough(new DecompressionStream("gzip"));
}
}
new globalThis.TextDecoder("utf8");
new globalThis.TextEncoder();
Array.from({ length: 256 }, (i, e) => e.toString(16).padStart(2, "0"));
function _(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 Oe(i, e) {
if (e === "utf-16le") {
const t = [];
for (let n = 0; n < i.length; n++) {
const r = i.charCodeAt(n);
t.push(r & 255, r >> 8 & 255);
}
return t;
}
if (e === "utf-16be") {
const t = [];
for (let n = 0; n < i.length; n++) {
const r = i.charCodeAt(n);
t.push(r >> 8 & 255, r & 255);
}
return t;
}
return [...i].map((t) => t.charCodeAt(0));
}
function Le(i, e = 0) {
const t = Number.parseInt(new v(6).get(i, 148).replace(/\0.*$/, "").trim(), 8);
if (Number.isNaN(t))
return !1;
let n = 8 * 32;
for (let r = e; r < e + 148; r++)
n += i[r];
for (let r = e + 156; r < e + 512; r++)
n += i[r];
return t === n;
}
const je = {
get: (i, e) => i[e + 3] & 127 | i[e + 2] << 7 | i[e + 1] << 14 | i[e] << 21,
len: 4
}, Me = [
"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",
"tar.gz",
"reg",
"dat"
], Ue = [
"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",
"application/x-ms-regedit",
"application/x-ft-windows-registry-hive"
], L = 4100;
async function He(i, e) {
return new Re(e).fromBlob(i);
}
function j(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 C(i, e, t) {
t = {
offset: 0,
...t
};
for (const [n, r] of e.entries())
if (t.mask) {
if (r !== (t.mask[n] & i[n + t.offset]))
return !1;
} else if (r !== i[n + t.offset])
return !1;
return !0;
}
class Re {
constructor(e) {
// Detections with a high degree of certainty in identifying the correct file type
T(this, "detectConfident", async (e) => {
if (this.buffer = new Uint8Array(L), e.fileInfo.size === void 0 && (e.fileInfo.size = Number.MAX_SAFE_INTEGER), this.tokenizer = e, await e.peekBuffer(this.buffer, { length: 32, 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])) {
const n = new Ie(e).inflate();
let r = !0;
try {
let a;
try {
a = await this.fromStream(n);
} catch {
r = !1;
}
if (a && a.ext === "tar")
return {
ext: "tar.gz",
mime: "application/gzip"
};
} finally {
r && await n.cancel();
}
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(je);
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 P(e).unzip((n) => {
switch (n.filename) {
case "META-INF/mozilla.rsa":
return t = {
ext: "xpi",
mime: "application/x-xpinstall"
}, {
stop: !0
};
case "META-INF/MANIFEST.MF":
return t = {
ext: "jar",
mime: "application/java-archive"
}, {
stop: !0
};
case "mimetype":
return {
async handler(r) {
const a = new TextDecoder("utf-8").decode(r).trim();
t = j(a);
},
stop: !0
};
case "[Content_Types].xml":
return {
async handler(r) {
let a = new TextDecoder("utf-8").decode(r);
const f = a.indexOf('.main+xml"');
if (f === -1) {
const p = "application/vnd.ms-package.3dmanufacturing-3dmodel+xml";
a.includes(`ContentType="${p}"`) && (t = j(p));
} else {
a = a.slice(0, Math.max(0, f));
const p = a.lastIndexOf('"'), c = a.slice(Math.max(0, p + 1));
t = j(c);
}
},
stop: !0
};
default:
return /classes\d*\.dex/.test(n.filename) ? (t = {
ext: "apk",
mime: "application/vnd.android.package-archive"
}, { stop: !0 }) : {};
}
}).catch((n) => {
if (!(n instanceof g))
throw n;
}), t ?? {
ext: "zip",
mime: "application/zip"
};
}
if (this.checkString("OggS")) {
await e.ignore(28);
const t = new Uint8Array(8);
return await e.readBuffer(t), C(t, [79, 112, 117, 115, 72, 101, 97, 100]) ? {
ext: "opus",
mime: "audio/ogg; codecs=opus"
} : C(t, [128, 116, 104, 101, 111, 114, 97]) ? {
ext: "ogv",
mime: "video/ogg"
} : C(t, [1, 118, 105, 100, 101, 111, 0]) ? {
ext: "ogm",
mime: "video/ogg"
} : C(t, [127, 70, 76, 65, 67]) ? {
ext: "oga",
mime: "audio/ogg"