@vorlefan/prisma-backup
Version:
Export all the databse models into json files and use them as backup
1,546 lines • 95.8 kB
JavaScript
import He from "fs";
import ce from "path";
import Ze from "crypto";
function U(s) {
return function(t, h, p) {
const E = p.value;
return p.value = function(...m) {
try {
const a = E.apply(this, m);
return a instanceof Promise ? a.catch((c) => {
const n = s(c);
throw console.error(n), n;
}) : a;
} catch (a) {
const c = s(a);
throw console.error(c), c;
}
}, p;
};
}
class M extends Error {
_tag;
cause;
constructor(t, h, p) {
super(h), this._tag = t, this.name = t, this.cause = p;
}
}
class ze extends M {
constructor(t) {
super("PrismaBackup", "A prisma-backup error occurred", t);
}
}
class je extends M {
constructor(t) {
super(
"PrismaBackupGetAllTableNameError",
"A error occured when trying to fetch the table name and row count from your prisma client.",
t
);
}
}
class Re extends M {
constructor(t) {
super(
"PrismaBackupSaveTableJsonError",
"A error occured when trying to save the data from the table of the database",
t
);
}
}
class Ge extends M {
constructor(t) {
super("PrismaBackupQueryDataError", "A error occured when trying to query data", t);
}
}
class Ae extends M {
constructor(t) {
super("PrismaBackupTransformDataError", "A error occured when trying to transform query data", t);
}
}
class $e extends M {
constructor(t) {
super("PrismaBackupCompressError", "A error occured when trying to compress backup data", t);
}
}
function qe(s) {
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
}
function ke(s) {
if (Object.prototype.hasOwnProperty.call(s, "__esModule")) return s;
var t = s.default;
if (typeof t == "function") {
var h = function p() {
var E = !1;
try {
E = this instanceof p;
} catch {
}
return E ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
};
h.prototype = t.prototype;
} else h = {};
return Object.defineProperty(h, "__esModule", { value: !0 }), Object.keys(s).forEach(function(p) {
var E = Object.getOwnPropertyDescriptor(s, p);
Object.defineProperty(h, p, E.get ? E : {
enumerable: !0,
get: function() {
return s[p];
}
});
}), h;
}
var X = { exports: {} };
const $ = {}, Ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: $
}, Symbol.toStringTag, { value: "Module" })), j = /* @__PURE__ */ ke(Ve);
var he;
function We() {
return he || (he = 1, (() => {
var s = { 607: function(p, E, m) {
var a = this && this.__importDefault || function(n) {
return n && n.__esModule ? n : { default: n };
};
Object.defineProperty(E, "__esModule", { value: !0 }), E.PathRoute = void 0;
var c = m(706);
Object.defineProperty(E, "PathRoute", { enumerable: !0, get: function() {
return a(c).default;
} });
}, 706: function(p, E, m) {
var a, c, n, f, _, y = this && this.__awaiter || function(e, i, r, o) {
return new (r || (r = Promise))((function(d, w) {
function v(x) {
try {
N(o.next(x));
} catch (T) {
w(T);
}
}
function F(x) {
try {
N(o.throw(x));
} catch (T) {
w(T);
}
}
function N(x) {
var T;
x.done ? d(x.value) : (T = x.value, T instanceof r ? T : new r((function(A) {
A(T);
}))).then(v, F);
}
N((o = o.apply(e, i || [])).next());
}));
}, g = this && this.__classPrivateFieldSet || function(e, i, r, o, d) {
if (o === "m") throw new TypeError("Private method is not writable");
if (o === "a" && !d) throw new TypeError("Private accessor was defined without a setter");
if (typeof i == "function" ? e !== i || !d : !i.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return o === "a" ? d.call(e, r) : d ? d.value = r : i.set(e, r), r;
}, l = this && this.__classPrivateFieldGet || function(e, i, r, o) {
if (r === "a" && !o) throw new TypeError("Private accessor was defined without a getter");
if (typeof i == "function" ? e !== i || !o : !i.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return r === "m" ? o : r === "a" ? o.call(e) : o ? o.value : i.get(e);
}, D = this && this.__importDefault || function(e) {
return e && e.__esModule ? e : { default: e };
};
Object.defineProperty(E, "__esModule", { value: !0 });
const I = D(m(411)), O = D(m(561)), C = m(254), L = D(m(418)), S = D(m(470)), u = D(m(714));
E.default = class {
constructor() {
a.set(this, []), c.set(this, void 0), n.set(this, void 0), f.set(this, void 0), _.set(this, /* @__PURE__ */ new Set()), g(this, c, new L.default(this), "f"), g(this, n, new S.default(this), "f"), g(this, f, new u.default(this), "f");
}
stream() {
return l(this, f, "f");
}
json() {
return l(this, n, "f");
}
io() {
return l(this, c, "f");
}
routes() {
return l(this, a, "f");
}
skip(e) {
return e.map(((i) => {
l(this, _, "f").add(i.join("|"));
})), this;
}
addSkip(e, i) {
return l(this, _, "f").add(`${e}|${i}`), this;
}
hasSkip(e, i) {
return l(this, _, "f").has(`${e}|${i}`);
}
deleteSkip(e, i) {
return l(this, _, "f").delete(`${e}|${i}`), this;
}
clearSkips() {
return l(this, _, "f").clear(), this;
}
getSkips() {
return Array.from(l(this, _, "f")).map(((e) => e.split("|")));
}
hasSkipped(e) {
let i = !1;
const r = this.endsWith(e), o = (0, C.splitFilepath)(e);
for (const d of l(this, _, "f").values()) {
const [w, v] = d.split("|");
let F = this.endsWith(w);
const N = o.findIndex(((R) => R === F)), x = this.isFilepathSameSource(w, e), T = r === v, A = o.find(((R, P) => P >= N && R === v));
if (x && T || x && A) {
i = !0;
break;
}
}
return i;
}
isFilepathSameSource(e, i) {
const r = (0, C.sanitizeFilepath)(e).replace(/(\/|\\)/g, "_").replace(":", "");
let o = (0, C.sanitizeFilepath)(i).replace(/(\/|\\)/g, "_").replace(":", "");
return new RegExp(`^(${r})`, "gm").test(o);
}
isRouteSameSource(e, i) {
const r = this.get(e), o = this.get(i);
return !(!r || !o) && this.isFilepathSameSource(r.routePath, o.routePath);
}
size() {
return l(this, a, "f").length;
}
add(e, i) {
return !this.has(e) && l(this, a, "f").push({ routeName: e, routePath: i }), this;
}
edit(e, i) {
const r = l(this, a, "f").findIndex(((o) => o.routeName === e));
return r && (l(this, a, "f")[r] = { routeName: e, routePath: i }), this;
}
has(e) {
return !!this.get(e);
}
get(e) {
return l(this, a, "f").find(((i) => i.routeName === e));
}
remove(e) {
return g(this, a, [...l(this, a, "f").filter(((i) => i.routeName !== e))], "f"), this;
}
alias(e, i) {
const r = this.get(i);
return !this.has(e) && r && this.add(e, r.routePath), this;
}
join(e, i, r) {
const o = this.get(i);
return o && this.add(e, I.default.join(o.routePath, r || e)), this;
}
plug(e, i) {
const r = this.get(e);
if (r) return I.default.join(r.routePath, i);
}
sanitize(e) {
const i = this.get(e);
return i ? (0, C.sanitizeFilepath)(i.routePath) : void 0;
}
endsWith(e) {
const i = (0, C.sanitizeFilepath)(e);
return I.default.basename(i);
}
backward(e, i = 1) {
const r = this.get(e);
if (r) {
const o = new Array(i).fill("..");
return I.default.resolve(r.routePath, ...o);
}
}
towards(e, i, r) {
try {
let o = e.split(/(\/|\\)/gimu);
const d = [], w = o.length;
for (let v = 0; v < w; v++) {
const F = o[v];
if (d.push(F), r) {
if (F === i) break;
} else if (new RegExp(`(${i})`, "giu").test(F)) break;
}
return I.default.join(...d);
} catch {
return;
}
}
hierarchy(e) {
const i = {}, r = this.get(e);
if (!r) return i;
const { routePath: o } = r;
return (0, C.splitFilepath)(o).map(((d, w, v) => {
let F = v[w - 1];
const N = v.length - w;
i[d] = { path: this.backward(e, N), index: N, next: "", parent: "", current: d }, i.hasOwnProperty(F) && (i[d].parent = F, i[F].next = d);
})), i;
}
resolve(...e) {
return I.default.resolve(...e);
}
basename(e, i) {
return I.default.basename(e, i);
}
dirname(e) {
return I.default.dirname(e);
}
files(e, i = void 0) {
return y(this, void 0, void 0, (function* () {
const r = [], o = this.get(e);
return o && l(this, c, "f").exists(o.routePath) && (yield O.default.promises.readdir(o.routePath, { encoding: "utf-8" })).map(((d) => {
const w = I.default.join(o.routePath, d);
if (!O.default.lstatSync(w).isDirectory()) {
let v = w.replace(/^.*[\\\/]/, ""), F = I.default.extname(v);
if (i && !v.match(i)) return;
r.push({ name: v.replace(F, ""), filename: v, filepath: w, extension: F, routeName: o.routeName });
}
})), r;
}));
}
lastFiles(e, i = void 0) {
return y(this, void 0, void 0, (function* () {
return (yield this.files(e, i)).sort(((r, o) => O.default.statSync(o.filepath).mtimeMs - O.default.statSync(r.filepath).mtimeMs));
}));
}
allFilepaths(e, i = []) {
return y(this, void 0, void 0, (function* () {
const r = yield O.default.promises.readdir(e);
return yield Promise.allSettled(r.map(((o) => y(this, void 0, void 0, (function* () {
const d = I.default.join(e, o);
O.default.lstatSync(d).isDirectory() ? yield this.allFilepaths(d, i) : this.hasSkipped(d) || i.push(d);
}))))), i;
}));
}
folders(e) {
const i = [], r = this.get(e);
if (!r) return i;
let o = O.default.readdirSync(r.routePath);
return o = o.map(((d) => I.default.join(r.routePath, d))).filter(this.io().isDirectory).filter(((d) => this.hasSkipped(d) === !1)), o.map(((d) => {
const w = d.replace(/^.*[\\\/]/, "");
i.push({ name: w, path: d });
})), i;
}
inject(e, i, r) {
if (this.has(e)) return this;
const o = r || e;
return this.io().createFolder(this.plug(i, o) || ""), this.join(e, i, r), this;
}
foldersJoin(e) {
return this.has(e) ? (this.folders(e).map((({ name: i, path: r }) => this.add(`${e}/${i}`, r))), this) : this;
}
}, a = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap();
}, 418: function(p, E, m) {
var a = this && this.__awaiter || function(f, _, y, g) {
return new (y || (y = Promise))((function(l, D) {
function I(L) {
try {
C(g.next(L));
} catch (S) {
D(S);
}
}
function O(L) {
try {
C(g.throw(L));
} catch (S) {
D(S);
}
}
function C(L) {
var S;
L.done ? l(L.value) : (S = L.value, S instanceof y ? S : new y((function(u) {
u(S);
}))).then(I, O);
}
C((g = g.apply(f, _ || [])).next());
}));
}, c = this && this.__importDefault || function(f) {
return f && f.__esModule ? f : { default: f };
};
Object.defineProperty(E, "__esModule", { value: !0 });
const n = c(m(561));
E.default = class {
constructor(f) {
this._route = f;
}
isFileValid(f, _ = ["R_OK", "F_OK"]) {
return a(this, void 0, void 0, (function* () {
const y = _.map(((g) => n.default.constants[g])).reduce(((g, l) => l | g));
return yield new Promise(((g) => n.default.access(f, y, ((l) => g(!l)))));
}));
}
copy(f, _) {
return a(this, void 0, void 0, (function* () {
try {
return !!(yield this.isFileValid(f)) && (yield n.default.promises.copyFile(f, _), !0);
} catch {
return !1;
}
}));
}
read(f, _ = "utf-8") {
return a(this, void 0, void 0, (function* () {
try {
return (yield this.isFileValid(f)) ? yield n.default.promises.readFile(f, { encoding: _ }) : void 0;
} catch {
return;
}
}));
}
write(f, _, y = !0, g = "utf-8") {
return a(this, void 0, void 0, (function* () {
try {
return !((yield this.isFileValid(f)) && !y || (yield n.default.promises.writeFile(f, _, g), 0));
} catch {
return !1;
}
}));
}
remove(f) {
return a(this, void 0, void 0, (function* () {
try {
return !!(yield this.isFileValid(f)) && (yield n.default.promises.unlink(f), !0);
} catch {
return !1;
}
}));
}
isFolderValid(f) {
return !!n.default.existsSync(f) && n.default.lstatSync(f).isDirectory();
}
createFolder(f) {
try {
return !this.isFolderValid(f) && (n.default.mkdirSync(f, { recursive: !1 }), !0);
} catch {
return !1;
}
}
removeFolder(f) {
return a(this, void 0, void 0, (function* () {
try {
return !!(yield this.isFolderValid(f)) && (yield n.default.promises.rmdir(f), !0);
} catch {
return !1;
}
}));
}
exists(f) {
return n.default.existsSync(f);
}
isDirectory(f) {
return n.default.lstatSync(f).isDirectory();
}
};
}, 470: function(p, E) {
var m = this && this.__awaiter || function(a, c, n, f) {
return new (n || (n = Promise))((function(_, y) {
function g(I) {
try {
D(f.next(I));
} catch (O) {
y(O);
}
}
function l(I) {
try {
D(f.throw(I));
} catch (O) {
y(O);
}
}
function D(I) {
var O;
I.done ? _(I.value) : (O = I.value, O instanceof n ? O : new n((function(C) {
C(O);
}))).then(g, l);
}
D((f = f.apply(a, c || [])).next());
}));
};
Object.defineProperty(E, "__esModule", { value: !0 }), E.default = class {
constructor(a) {
this._route = a;
}
read(a) {
return m(this, void 0, void 0, (function* () {
const c = yield this._route.io().read(a);
if (c) return JSON.parse(c);
}));
}
write(a, c, n = !0) {
return m(this, void 0, void 0, (function* () {
const f = JSON.stringify(c, null, " ");
return yield this._route.io().write(a, f, n);
}));
}
};
}, 714: function(p, E, m) {
var a = this && this.__awaiter || function(y, g, l, D) {
return new (l || (l = Promise))((function(I, O) {
function C(u) {
try {
S(D.next(u));
} catch (e) {
O(e);
}
}
function L(u) {
try {
S(D.throw(u));
} catch (e) {
O(e);
}
}
function S(u) {
var e;
u.done ? I(u.value) : (e = u.value, e instanceof l ? e : new l((function(i) {
i(e);
}))).then(C, L);
}
S((D = D.apply(y, g || [])).next());
}));
}, c = this && this.__importDefault || function(y) {
return y && y.__esModule ? y : { default: y };
};
Object.defineProperty(E, "__esModule", { value: !0 });
const n = c(m(561)), f = c(m(849)), _ = c(m(286));
E.default = class {
constructor(y) {
this._route = y;
}
download(y, g, l) {
return a(this, void 0, void 0, (function* () {
return new Promise(((D, I) => {
const O = n.default.createWriteStream(g);
(l === "http" ? f.default : _.default).get(y, ((C) => {
C.pipe(O), O.on("finish", (() => {
O.close(), D(!0);
})).on("error", (() => {
n.default.unlinkSync(g), I(!1);
}));
}));
}));
}));
}
read(y, g) {
return a(this, void 0, void 0, (function* () {
return new Promise(((l, D) => {
const I = n.default.createReadStream(y, { encoding: "utf-8" });
let O = "";
I.on("data", (function(C) {
O += C.toString(), g && g(C, O);
})).on("end", (function() {
l(O);
})).on("error", (function() {
D(void 0);
}));
}));
}));
}
write(y, g) {
return a(this, void 0, void 0, (function* () {
return new Promise(((l, D) => {
const I = n.default.createWriteStream(y, { encoding: "utf-8" });
I.write(g), I.end(), I.on("finish", (() => l(!0))).on("error", D);
}));
}));
}
};
}, 254: (p, E) => {
Object.defineProperty(E, "__esModule", { value: !0 }), E.splitFilepath = E.sanitizeFilepath = void 0, E.sanitizeFilepath = function(m) {
return m.replace(/(\/)[(/)]/g, "/");
}, E.splitFilepath = function(m, a = " ") {
return m.replace(/(\/|\/\/|\\|\\\\)/g, a).split(a);
};
}, 561: (p) => {
p.exports = j;
}, 849: (p) => {
p.exports = j;
}, 286: (p) => {
p.exports = j;
}, 411: (p) => {
p.exports = j;
} }, t = {}, h = (function p(E) {
var m = t[E];
if (m !== void 0) return m.exports;
var a = t[E] = { exports: {} };
return s[E].call(a.exports, a, a.exports, p), a.exports;
})(607);
X.exports = h;
})()), X.exports;
}
var Xe = We();
const b = new Xe.PathRoute();
b.add("__dirname", b.resolve(__dirname));
b.add("main", b.backward("__dirname", 2));
b.add("root", b.backward("main", 2));
async function Pe(s, t, h) {
return new Promise((p, E) => {
$.scrypt(s, t, h, function(m, a) {
m && E(void 0), p(a);
});
});
}
function Ee(s) {
return s.replace(/[\/\?<>\\:\*\|":]/g, "").replace(/[\x00-\x1f\x80-\x9f]/g, "").replace(/^\.+$/, "").replace(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i, "").replace(/\s/gim, "_").split("").splice(0, 255).join("");
}
function Ke(s) {
return s ? s.charAt(0).toLowerCase() + s.slice(1) : "";
}
function Je(s, t) {
const h = {};
for (const p in s)
t.includes(p) || (h[p] = s[p]);
return h;
}
function me(s, t) {
const h = {};
for (const p of t)
p in s && (h[p] = s[p]);
return h;
}
const Ye = (s) => new Promise((t, h) => setTimeout(() => t(!0), s));
async function Qe({ password: s, text: t }) {
return new Promise(async (h, p) => {
const E = await Pe(s, "salt", 24);
if (E === void 0) return p(void 0);
const m = $.randomBytes(12), a = JSON.stringify(m), c = $.createCipheriv("aes-192-ccm", E, m, {
authTagLength: 12
});
c.setEncoding("hex");
let n = "";
c.on("data", (f) => {
n += f;
}), c.on("end", () => h({ encryptedText: n, iv: a })), c.on("error", () => p(void 0)), c.write(t), c.end();
});
}
async function Ct({ password: s, encryptedText: t, iv: h }) {
return new Promise(async (p, E) => {
if (!t || !h)
return E(void 0);
const m = Buffer.from(JSON.parse(h)), a = await Pe(s, "salt", 24);
if (a === void 0) return E(void 0);
const c = $.createCipheriv("aes-192-ccm", a, m, {
authTagLength: 12
});
let n = "";
c.on("readable", () => {
let f = c.read();
f && (n += f.toString("utf-8"));
}), c.on("end", () => {
p(n);
}), c.write(t, "hex"), c.end();
});
}
var z = { exports: {} }, K, pe;
function Ue() {
return pe || (pe = 1, K = {
/* The local file header */
LOCHDR: 30,
// LOC header size
LOCSIG: 67324752,
// "PK\003\004"
LOCVER: 4,
// version needed to extract
LOCFLG: 6,
// general purpose bit flag
LOCHOW: 8,
// compression method
LOCTIM: 10,
// modification time (2 bytes time, 2 bytes date)
LOCCRC: 14,
// uncompressed file crc-32 value
LOCSIZ: 18,
// compressed size
LOCLEN: 22,
// uncompressed size
LOCNAM: 26,
// filename length
LOCEXT: 28,
// extra field length
/* The Data descriptor */
EXTSIG: 134695760,
// "PK\007\008"
EXTHDR: 16,
// EXT header size
EXTCRC: 4,
// uncompressed file crc-32 value
EXTSIZ: 8,
// compressed size
EXTLEN: 12,
// uncompressed size
/* The central directory file header */
CENHDR: 46,
// CEN header size
CENSIG: 33639248,
// "PK\001\002"
CENVEM: 4,
// version made by
CENVER: 6,
// version needed to extract
CENFLG: 8,
// encrypt, decrypt flags
CENHOW: 10,
// compression method
CENTIM: 12,
// modification time (2 bytes time, 2 bytes date)
CENCRC: 16,
// uncompressed file crc-32 value
CENSIZ: 20,
// compressed size
CENLEN: 24,
// uncompressed size
CENNAM: 28,
// filename length
CENEXT: 30,
// extra field length
CENCOM: 32,
// file comment length
CENDSK: 34,
// volume number start
CENATT: 36,
// internal file attributes
CENATX: 38,
// external file attributes (host system dependent)
CENOFF: 42,
// LOC header offset
/* The entries in the end of central directory */
ENDHDR: 22,
// END header size
ENDSIG: 101010256,
// "PK\005\006"
ENDSUB: 8,
// number of entries on this disk
ENDTOT: 10,
// total number of entries
ENDSIZ: 12,
// central directory size in bytes
ENDOFF: 16,
// offset of first CEN header
ENDCOM: 20,
// zip file comment length
END64HDR: 20,
// zip64 END header size
END64SIG: 117853008,
// zip64 Locator signature, "PK\006\007"
END64START: 4,
// number of the disk with the start of the zip64
END64OFF: 8,
// relative offset of the zip64 end of central directory
END64NUMDISKS: 16,
// total number of disks
ZIP64SIG: 101075792,
// zip64 signature, "PK\006\006"
ZIP64HDR: 56,
// zip64 record minimum size
ZIP64LEAD: 12,
// leading bytes at the start of the record, not counted by the value stored in ZIP64SIZE
ZIP64SIZE: 4,
// zip64 size of the central directory record
ZIP64VEM: 12,
// zip64 version made by
ZIP64VER: 14,
// zip64 version needed to extract
ZIP64DSK: 16,
// zip64 number of this disk
ZIP64DSKDIR: 20,
// number of the disk with the start of the record directory
ZIP64SUB: 24,
// number of entries on this disk
ZIP64TOT: 32,
// total number of entries
ZIP64SIZB: 40,
// zip64 central directory size in bytes
ZIP64OFF: 48,
// offset of start of central directory with respect to the starting disk number
ZIP64EXTRA: 56,
// extensible data sector
/* Compression methods */
STORED: 0,
// no compression
SHRUNK: 1,
// shrunk
REDUCED1: 2,
// reduced with compression factor 1
REDUCED2: 3,
// reduced with compression factor 2
REDUCED3: 4,
// reduced with compression factor 3
REDUCED4: 5,
// reduced with compression factor 4
IMPLODED: 6,
// imploded
// 7 reserved for Tokenizing compression algorithm
DEFLATED: 8,
// deflated
ENHANCED_DEFLATED: 9,
// enhanced deflated
PKWARE: 10,
// PKWare DCL imploded
// 11 reserved by PKWARE
BZIP2: 12,
// compressed using BZIP2
// 13 reserved by PKWARE
LZMA: 14,
// LZMA
// 15-17 reserved by PKWARE
IBM_TERSE: 18,
// compressed using IBM TERSE
IBM_LZ77: 19,
// IBM LZ77 z
AES_ENCRYPT: 99,
// WinZIP AES encryption method
/* General purpose bit flag */
// values can obtained with expression 2**bitnr
FLG_ENC: 1,
// Bit 0: encrypted file
FLG_COMP1: 2,
// Bit 1, compression option
FLG_COMP2: 4,
// Bit 2, compression option
FLG_DESC: 8,
// Bit 3, data descriptor
FLG_ENH: 16,
// Bit 4, enhanced deflating
FLG_PATCH: 32,
// Bit 5, indicates that the file is compressed patched data.
FLG_STR: 64,
// Bit 6, strong encryption (patented)
// Bits 7-10: Currently unused.
FLG_EFS: 2048,
// Bit 11: Language encoding flag (EFS)
// Bit 12: Reserved by PKWARE for enhanced compression.
// Bit 13: encrypted the Central Directory (patented).
// Bits 14-15: Reserved by PKWARE.
FLG_MSK: 4096,
// mask header values
/* Load type */
FILE: 2,
BUFFER: 1,
NONE: 0,
/* 4.5 Extensible data fields */
EF_ID: 0,
EF_SIZE: 2,
/* Header IDs */
ID_ZIP64: 1,
ID_AVINFO: 7,
ID_PFS: 8,
ID_OS2: 9,
ID_NTFS: 10,
ID_OPENVMS: 12,
ID_UNIX: 13,
ID_FORK: 14,
ID_PATCH: 15,
ID_X509_PKCS7: 20,
ID_X509_CERTID_F: 21,
ID_X509_CERTID_C: 22,
ID_STRONGENC: 23,
ID_RECORD_MGT: 24,
ID_X509_PKCS7_RL: 25,
ID_IBM1: 101,
ID_IBM2: 102,
ID_POSZIP: 18064,
EF_ZIP64_OR_32: 4294967295,
EF_ZIP64_OR_16: 65535,
EF_ZIP64_SUNCOMP: 0,
EF_ZIP64_SCOMP: 8,
EF_ZIP64_RHO: 16,
EF_ZIP64_DSN: 24
}), K;
}
var J = {}, ye;
function ue() {
return ye || (ye = 1, (function(s) {
const t = {
/* Header error messages */
INVALID_LOC: "Invalid LOC header (bad signature)",
INVALID_CEN: "Invalid CEN header (bad signature)",
INVALID_END: "Invalid END header (bad signature)",
/* Descriptor */
DESCRIPTOR_NOT_EXIST: "No descriptor present",
DESCRIPTOR_UNKNOWN: "Unknown descriptor format",
DESCRIPTOR_FAULTY: "Descriptor data is malformed",
/* ZipEntry error messages*/
NO_DATA: "Nothing to decompress",
BAD_CRC: "CRC32 checksum failed {0}",
FILE_IN_THE_WAY: "There is a file in the way: {0}",
UNKNOWN_METHOD: "Invalid/unsupported compression method",
/* Inflater error messages */
AVAIL_DATA: "inflate::Available inflate data did not terminate",
INVALID_DISTANCE: "inflate::Invalid literal/length or distance code in fixed or dynamic block",
TO_MANY_CODES: "inflate::Dynamic block code description: too many length or distance codes",
INVALID_REPEAT_LEN: "inflate::Dynamic block code description: repeat more than specified lengths",
INVALID_REPEAT_FIRST: "inflate::Dynamic block code description: repeat lengths with no first length",
INCOMPLETE_CODES: "inflate::Dynamic block code description: code lengths codes incomplete",
INVALID_DYN_DISTANCE: "inflate::Dynamic block code description: invalid distance code lengths",
INVALID_CODES_LEN: "inflate::Dynamic block code description: invalid literal/length code lengths",
INVALID_STORE_BLOCK: "inflate::Stored block length did not match one's complement",
INVALID_BLOCK_TYPE: "inflate::Invalid block type (type == 3)",
/* ADM-ZIP error messages */
CANT_EXTRACT_FILE: "Could not extract the file",
CANT_OVERRIDE: "Target file already exists",
DISK_ENTRY_TOO_LARGE: "Number of disk entries is too large",
NO_ZIP: "No zip file was loaded",
NO_ENTRY: "Entry doesn't exist",
DIRECTORY_CONTENT_ERROR: "A directory cannot have content",
FILE_NOT_FOUND: 'File not found: "{0}"',
NOT_IMPLEMENTED: "Not implemented",
INVALID_FILENAME: "Invalid filename",
INVALID_FORMAT: "Invalid or unsupported zip format. No END header found",
INVALID_PASS_PARAM: "Incompatible password parameter",
WRONG_PASSWORD: "Wrong Password",
/* ADM-ZIP */
COMMENT_TOO_LONG: "Comment is too long",
// Comment can be max 65535 bytes long (NOTE: some non-US characters may take more space)
EXTRA_FIELD_PARSE_ERROR: "Extra field parsing error"
};
function h(p) {
return function(...E) {
return E.length && (p = p.replace(/\{(\d)\}/g, (m, a) => E[a] || "")), new Error("ADM-ZIP: " + p);
};
}
for (const p of Object.keys(t))
s[p] = h(t[p]);
})(J)), J;
}
var Y, ge;
function et() {
if (ge) return Y;
ge = 1;
const s = He, t = ce, h = Ue(), p = ue(), E = typeof process == "object" && process.platform === "win32", m = (n) => typeof n == "object" && n !== null, a = new Uint32Array(256).map((n, f) => {
for (let _ = 0; _ < 8; _++)
(f & 1) !== 0 ? f = 3988292384 ^ f >>> 1 : f >>>= 1;
return f >>> 0;
});
function c(n) {
this.sep = t.sep, this.fs = s, m(n) && m(n.fs) && typeof n.fs.statSync == "function" && (this.fs = n.fs);
}
return Y = c, c.prototype.makeDir = function(n) {
const f = this;
function _(y) {
let g = y.split(f.sep)[0];
y.split(f.sep).forEach(function(l) {
if (!(!l || l.substr(-1, 1) === ":")) {
g += f.sep + l;
var D;
try {
D = f.fs.statSync(g);
} catch {
f.fs.mkdirSync(g);
}
if (D && D.isFile()) throw p.FILE_IN_THE_WAY(`"${g}"`);
}
});
}
_(n);
}, c.prototype.writeFileTo = function(n, f, _, y) {
const g = this;
if (g.fs.existsSync(n)) {
if (!_) return !1;
var l = g.fs.statSync(n);
if (l.isDirectory())
return !1;
}
var D = t.dirname(n);
g.fs.existsSync(D) || g.makeDir(D);
var I;
try {
I = g.fs.openSync(n, "w", 438);
} catch {
g.fs.chmodSync(n, 438), I = g.fs.openSync(n, "w", 438);
}
if (I)
try {
g.fs.writeSync(I, f, 0, f.length, 0);
} finally {
g.fs.closeSync(I);
}
return g.fs.chmodSync(n, y || 438), !0;
}, c.prototype.writeFileToAsync = function(n, f, _, y, g) {
typeof y == "function" && (g = y, y = void 0);
const l = this;
l.fs.exists(n, function(D) {
if (D && !_) return g(!1);
l.fs.stat(n, function(I, O) {
if (D && O.isDirectory())
return g(!1);
var C = t.dirname(n);
l.fs.exists(C, function(L) {
L || l.makeDir(C), l.fs.open(n, "w", 438, function(S, u) {
S ? l.fs.chmod(n, 438, function() {
l.fs.open(n, "w", 438, function(e, i) {
l.fs.write(i, f, 0, f.length, 0, function() {
l.fs.close(i, function() {
l.fs.chmod(n, y || 438, function() {
g(!0);
});
});
});
});
}) : u ? l.fs.write(u, f, 0, f.length, 0, function() {
l.fs.close(u, function() {
l.fs.chmod(n, y || 438, function() {
g(!0);
});
});
}) : l.fs.chmod(n, y || 438, function() {
g(!0);
});
});
});
});
});
}, c.prototype.findFiles = function(n) {
const f = this;
function _(y, g, l) {
let D = [];
return f.fs.readdirSync(y).forEach(function(I) {
const O = t.join(y, I), C = f.fs.statSync(O);
D.push(t.normalize(O) + (C.isDirectory() ? f.sep : "")), C.isDirectory() && l && (D = D.concat(_(O, g, l)));
}), D;
}
return _(n, void 0, !0);
}, c.prototype.findFilesAsync = function(n, f) {
const _ = this;
let y = [];
_.fs.readdir(n, function(g, l) {
if (g) return f(g);
let D = l.length;
if (!D) return f(null, y);
l.forEach(function(I) {
I = t.join(n, I), _.fs.stat(I, function(O, C) {
if (O) return f(O);
C && (y.push(t.normalize(I) + (C.isDirectory() ? _.sep : "")), C.isDirectory() ? _.findFilesAsync(I, function(L, S) {
if (L) return f(L);
y = y.concat(S), --D || f(null, y);
}) : --D || f(null, y));
});
});
});
}, c.prototype.getAttributes = function() {
}, c.prototype.setAttributes = function() {
}, c.crc32update = function(n, f) {
return a[(n ^ f) & 255] ^ n >>> 8;
}, c.crc32 = function(n) {
typeof n == "string" && (n = Buffer.from(n, "utf8"));
let f = n.length, _ = -1;
for (let y = 0; y < f; ) _ = c.crc32update(_, n[y++]);
return ~_ >>> 0;
}, c.methodToString = function(n) {
switch (n) {
case h.STORED:
return "STORED (" + n + ")";
case h.DEFLATED:
return "DEFLATED (" + n + ")";
default:
return "UNSUPPORTED (" + n + ")";
}
}, c.canonical = function(n) {
if (!n) return "";
const f = t.posix.normalize("/" + n.split("\\").join("/"));
return t.join(".", f);
}, c.zipnamefix = function(n) {
if (!n) return "";
const f = t.posix.normalize("/" + n.split("\\").join("/"));
return t.posix.join(".", f);
}, c.findLast = function(n, f) {
if (!Array.isArray(n)) throw new TypeError("arr is not array");
const _ = n.length >>> 0;
for (let y = _ - 1; y >= 0; y--)
if (f(n[y], y, n))
return n[y];
}, c.sanitize = function(n, f) {
n = t.resolve(t.normalize(n));
for (var _ = f.split("/"), y = 0, g = _.length; y < g; y++) {
var l = t.normalize(t.join(n, _.slice(y, g).join(t.sep)));
if (l.indexOf(n) === 0)
return l;
}
return t.normalize(t.join(n, t.basename(f)));
}, c.toBuffer = function(f, _) {
return Buffer.isBuffer(f) ? f : f instanceof Uint8Array ? Buffer.from(f) : typeof f == "string" ? _(f) : Buffer.alloc(0);
}, c.readBigUInt64LE = function(n, f) {
var _ = Buffer.from(n.slice(f, f + 8));
return _.swap64(), parseInt(`0x${_.toString("hex")}`);
}, c.fromDOS2Date = function(n) {
return new Date((n >> 25 & 127) + 1980, Math.max((n >> 21 & 15) - 1, 0), Math.max(n >> 16 & 31, 1), n >> 11 & 31, n >> 5 & 63, (n & 31) << 1);
}, c.fromDate2DOS = function(n) {
let f = 0, _ = 0;
return n.getFullYear() > 1979 && (f = (n.getFullYear() - 1980 & 127) << 9 | n.getMonth() + 1 << 5 | n.getDate(), _ = n.getHours() << 11 | n.getMinutes() << 5 | n.getSeconds() >> 1), f << 16 | _;
}, c.isWin = E, c.crcTable = a, Y;
}
var Q, _e;
function tt() {
if (_e) return Q;
_e = 1;
const s = ce;
return Q = function(t, { fs: h }) {
var p = t || "", E = a(), m = null;
function a() {
return {
directory: !1,
readonly: !1,
hidden: !1,
executable: !1,
mtime: 0,
atime: 0
};
}
return p && h.existsSync(p) ? (m = h.statSync(p), E.directory = m.isDirectory(), E.mtime = m.mtime, E.atime = m.atime, E.executable = (73 & m.mode) !== 0, E.readonly = (128 & m.mode) === 0, E.hidden = s.basename(p)[0] === ".") : console.warn("Invalid path: " + p), {
get directory() {
return E.directory;
},
get readOnly() {
return E.readonly;
},
get hidden() {
return E.hidden;
},
get mtime() {
return E.mtime;
},
get atime() {
return E.atime;
},
get executable() {
return E.executable;
},
decodeAttributes: function() {
},
encodeAttributes: function() {
},
toJSON: function() {
return {
path: p,
isDirectory: E.directory,
isReadOnly: E.readonly,
isHidden: E.hidden,
isExecutable: E.executable,
mTime: E.mtime,
aTime: E.atime
};
},
toString: function() {
return JSON.stringify(this.toJSON(), null, " ");
}
};
}, Q;
}
var ee, Ie;
function rt() {
return Ie || (Ie = 1, ee = {
efs: !0,
encode: (s) => Buffer.from(s, "utf8"),
decode: (s) => s.toString("utf8")
}), ee;
}
var De;
function q() {
return De || (De = 1, z.exports = et(), z.exports.Constants = Ue(), z.exports.Errors = ue(), z.exports.FileAttr = tt(), z.exports.decoder = rt()), z.exports;
}
var k = {}, te, Ne;
function nt() {
if (Ne) return te;
Ne = 1;
var s = q(), t = s.Constants;
return te = function() {
var h = 20, p = 10, E = 0, m = 0, a = 0, c = 0, n = 0, f = 0, _ = 0, y = 0, g = 0, l = 0, D = 0, I = 0, O = 0;
h |= s.isWin ? 2560 : 768, E |= t.FLG_EFS;
const C = {
extraLen: 0
}, L = (u) => Math.max(0, u) >>> 0, S = (u) => Math.max(0, u) & 255;
return a = s.fromDate2DOS(/* @__PURE__ */ new Date()), {
get made() {
return h;
},
set made(u) {
h = u;
},
get version() {
return p;
},
set version(u) {
p = u;
},
get flags() {
return E;
},
set flags(u) {
E = u;
},
get flags_efs() {
return (E & t.FLG_EFS) > 0;
},
set flags_efs(u) {
u ? E |= t.FLG_EFS : E &= ~t.FLG_EFS;
},
get flags_desc() {
return (E & t.FLG_DESC) > 0;
},
set flags_desc(u) {
u ? E |= t.FLG_DESC : E &= ~t.FLG_DESC;
},
get method() {
return m;
},
set method(u) {
switch (u) {
case t.STORED:
this.version = 10;
case t.DEFLATED:
default:
this.version = 20;
}
m = u;
},
get time() {
return s.fromDOS2Date(this.timeval);
},
set time(u) {
this.timeval = s.fromDate2DOS(u);
},
get timeval() {
return a;
},
set timeval(u) {
a = L(u);
},
get timeHighByte() {
return S(a >>> 8);
},
get crc() {
return c;
},
set crc(u) {
c = L(u);
},
get compressedSize() {
return n;
},
set compressedSize(u) {
n = L(u);
},
get size() {
return f;
},
set size(u) {
f = L(u);
},
get fileNameLength() {
return _;
},
set fileNameLength(u) {
_ = u;
},
get extraLength() {
return y;
},
set extraLength(u) {
y = u;
},
get extraLocalLength() {
return C.extraLen;
},
set extraLocalLength(u) {
C.extraLen = u;
},
get commentLength() {
return g;
},
set commentLength(u) {
g = u;
},
get diskNumStart() {
return l;
},
set diskNumStart(u) {
l = L(u);
},
get inAttr() {
return D;
},
set inAttr(u) {
D = L(u);
},
get attr() {
return I;
},
set attr(u) {
I = L(u);
},
// get Unix file permissions
get fileAttr() {
return (I || 0) >> 16 & 4095;
},
get offset() {
return O;
},
set offset(u) {
O = L(u);
},
get encrypted() {
return (E & t.FLG_ENC) === t.FLG_ENC;
},
get centralHeaderSize() {
return t.CENHDR + _ + y + g;
},
get realDataOffset() {
return O + t.LOCHDR + C.fnameLen + C.extraLen;
},
get localHeader() {
return C;
},
loadLocalHeaderFromBinary: function(u) {
var e = u.slice(O, O + t.LOCHDR);
if (e.readUInt32LE(0) !== t.LOCSIG)
throw s.Errors.INVALID_LOC();
C.version = e.readUInt16LE(t.LOCVER), C.flags = e.readUInt16LE(t.LOCFLG), C.method = e.readUInt16LE(t.LOCHOW), C.time = e.readUInt32LE(t.LOCTIM), C.crc = e.readUInt32LE(t.LOCCRC), C.compressedSize = e.readUInt32LE(t.LOCSIZ), C.size = e.readUInt32LE(t.LOCLEN), C.fnameLen = e.readUInt16LE(t.LOCNAM), C.extraLen = e.readUInt16LE(t.LOCEXT);
const i = O + t.LOCHDR + C.fnameLen, r = i + C.extraLen;
return u.slice(i, r);
},
loadFromBinary: function(u) {
if (u.length !== t.CENHDR || u.readUInt32LE(0) !== t.CENSIG)
throw s.Errors.INVALID_CEN();
h = u.readUInt16LE(t.CENVEM), p = u.readUInt16LE(t.CENVER), E = u.readUInt16LE(t.CENFLG), m = u.readUInt16LE(t.CENHOW), a = u.readUInt32LE(t.CENTIM), c = u.readUInt32LE(t.CENCRC), n = u.readUInt32LE(t.CENSIZ), f = u.readUInt32LE(t.CENLEN), _ = u.readUInt16LE(t.CENNAM), y = u.readUInt16LE(t.CENEXT), g = u.readUInt16LE(t.CENCOM), l = u.readUInt16LE(t.CENDSK), D = u.readUInt16LE(t.CENATT), I = u.readUInt32LE(t.CENATX), O = u.readUInt32LE(t.CENOFF);
},
localHeaderToBinary: function() {
var u = Buffer.alloc(t.LOCHDR);
return u.writeUInt32LE(t.LOCSIG, 0), u.writeUInt16LE(p, t.LOCVER), u.writeUInt16LE(E, t.LOCFLG), u.writeUInt16LE(m, t.LOCHOW), u.writeUInt32LE(a, t.LOCTIM), u.writeUInt32LE(c, t.LOCCRC), u.writeUInt32LE(n, t.LOCSIZ), u.writeUInt32LE(f, t.LOCLEN), u.writeUInt16LE(_, t.LOCNAM), u.writeUInt16LE(C.extraLen, t.LOCEXT), u;
},
centralHeaderToBinary: function() {
var u = Buffer.alloc(t.CENHDR + _ + y + g);
return u.writeUInt32LE(t.CENSIG, 0), u.writeUInt16LE(h, t.CENVEM), u.writeUInt16LE(p, t.CENVER), u.writeUInt16LE(E, t.CENFLG), u.writeUInt16LE(m, t.CENHOW), u.writeUInt32LE(a, t.CENTIM), u.writeUInt32LE(c, t.CENCRC), u.writeUInt32LE(n, t.CENSIZ), u.writeUInt32LE(f, t.CENLEN), u.writeUInt16LE(_, t.CENNAM), u.writeUInt16LE(y, t.CENEXT), u.writeUInt16LE(g, t.CENCOM), u.writeUInt16LE(l, t.CENDSK), u.writeUInt16LE(D, t.CENATT), u.writeUInt32LE(I, t.CENATX), u.writeUInt32LE(O, t.CENOFF), u;
},
toJSON: function() {
const u = function(e) {
return e + " bytes";
};
return {
made: h,
version: p,
flags: E,
method: s.methodToString(m),
time: this.time,
crc: "0x" + c.toString(16).toUpperCase(),
compressedSize: u(n),
size: u(f),
fileNameLength: u(_),
extraLength: u(y),
commentLength: u(g),
diskNumStart: l,
inAttr: D,
attr: I,
offset: O,
centralHeaderSize: u(t.CENHDR + _ + y + g)
};
},
toString: function() {
return JSON.stringify(this.toJSON(), null, " ");
}
};
}, te;
}
var re, Le;
function it() {
if (Le) return re;
Le = 1;
var s = q(), t = s.Constants;
return re = function() {
var h = 0, p = 0, E = 0, m = 0, a = 0;
return {
get diskEntries() {
return h;
},
set diskEntries(c) {
h = p = c;
},
get totalEntries() {
return p;
},
set totalEntries(c) {
p = h = c;
},
get size() {
return E;
},
set size(c) {
E = c;
},
get offset() {
return m;
},
set offset(c) {
m = c;
},
get commentLength() {
return a;
},
set commentLength(c) {
a = c;
},
get mainHeaderSize() {
return t.ENDHDR + a;
},
loadFromBinary: function(c) {
if ((c.length !== t.ENDHDR || c.readUInt32LE(0) !== t.ENDSIG) && (c.length < t.ZIP64HDR || c.readUInt32LE(0) !== t.ZIP64SIG))
throw s.Errors.INVALID_END();
c.readUInt32LE(0) === t.ENDSIG ? (h = c.readUInt16LE(t.ENDSUB), p = c.readUInt16LE(t.ENDTOT), E = c.readUInt32LE(t.ENDSIZ), m = c.readUInt32LE(t.ENDOFF), a = c.readUInt16LE(t.ENDCOM)) : (h = s.readBigUInt64LE(c, t.ZIP64SUB), p = s.readBigUInt64LE(c, t.ZIP64TOT), E = s.readBigUInt64LE(c, t.ZIP64SIZE), m = s.readBigUInt64LE(c, t.ZIP64OFF), a = 0);
},
toBinary: function() {
var c = Buffer.alloc(t.ENDHDR + a);
return c.writeUInt32LE(t.ENDSIG, 0), c.writeUInt32LE(0, 4), c.writeUInt16LE(h, t.ENDSUB), c.writeUInt16LE(p, t.ENDTOT), c.writeUInt32LE(E, t.ENDSIZ), c.writeUInt32LE(m, t.ENDOFF), c.writeUInt16LE(a, t.ENDCOM), c.fill(" ", t.ENDHDR), c;
},
toJSON: function() {
const c = function(n, f) {
let _ = n.toString(16).toUpperCase();
for (; _.length < f; ) _ = "0" + _;
return "0x" + _;
};
return {
diskEntries: h,
totalEntries: p,
size: E + " bytes",
offset: c(m, 4),
commentLength: a
};
},
toString: function() {
return JSON.stringify(this.toJSON(), null, " ");
}
};
}, re;
}
var we;
function Be() {
return we || (we = 1, k.EntryHeader = nt(), k.MainHeader = it()), k;
}
var G = {}, ne, Ce;
function ot() {
return Ce || (Ce = 1, ne = function(s) {
var t = j, h = { chunkSize: (parseInt(s.length / 1024) + 1) * 1024 };
return {
deflate: function() {
return t.deflateRawSync(s, h);
},
deflateAsync: function(p) {
var E = t.createDeflateRaw(h), m = [], a = 0;
E.on("data", function(c) {
m.push(c), a += c.length;
}), E.on("end", function() {
var c = Buffer.alloc(a), n = 0;
c.fill(0);
for (var f = 0; f < m.length; f++) {
var _ = m[f];
_.copy(c, n), n += _.length;
}
p && p(c);
}), E.end(s);
}
};
}), ne;
}
var ie, Se;
function st() {
if (Se) return ie;
Se = 1;
const s = +(process.versions ? process.versions.node : "").split(".")[0] || 0;
return ie = function(t, h) {
var p = j;
const E = s >= 15 && h > 0 ? { maxOutputLength: h } : {};
return {
inflate: function() {
return p.inflateRawSync(t, E);
},
inflateAsync: function(m) {
var a = p.createInflateRaw(E), c = [], n = 0;
a.on("data", function(f) {
c.push(f), n += f.length;
}), a.on("end", function() {
var f = Buffer.alloc(n), _ = 0;
f.fill(0);
for (var y = 0; y < c.length; y++) {
var g = c[y];
g.copy(f, _), _ += g.length;
}
m && m(f);
}), a.end(t);
}
};
}, ie;
}
var oe, ve;
function at() {
if (ve) return oe;
ve = 1;
const { randomFillSync: s } = Ze, t = ue(), h = new Uint32Array(256).map((l, D) => {
for (let I = 0; I < 8; I++)
(D & 1) !== 0 ? D = D >>> 1 ^ 3988292384 : D >>>= 1;
return D >>> 0;
}), p = (l, D) => Math.imul(l, D) >>> 0, E = (l, D) => h[(l ^ D) & 255] ^ l >>> 8, m = () => typeof s == "function" ? s(Buffer.alloc(12)) : m.node();
m.node = () => {
const l = Buffer.alloc(12), D = l.length;
for (let I = 0; I < D; I++) l[I] = Math.random() * 256 & 255;
return l;
};
const a = {
genSalt: m
};
function c(l) {
const D = Buffer.isBuffer(l) ? l : Buffer.from(l);
this.keys = new Uint32Array([305419896, 591751049, 878082192]);
for (let I = 0; I < D.length; I++)
this.updateKeys(D[I]);
}
c.prototype.updateKeys = function(l) {
const D = this.keys;
return D[0] = E(D[0], l), D[1] += D[0] & 255, D[1] = p(D[1], 134775813) + 1, D[2] = E(D[2], D[1] >>> 24), l;
}, c.prototype.next = function() {
const l = (this.keys[2] | 2) >>> 0;
return p(l, l ^ 1) >> 8 & 255;
};
function n(l) {
const D = new c(l);
return function(I) {
const O = Buffer.alloc(I.length);
let C = 0;
for (let L of I)
O[C++] = D.updateKeys(L ^ D.next());
return O;
};
}
function f(l) {
const D = new c(l);
return function(I, O, C = 0) {
O || (O = Buffer.alloc(I.length));
for (let L of I) {
const S = D.next();
O[C++] = L ^ S, D.updateKeys(L);
}
return O;
};
}
function _(l, D, I) {
if (!l || !Buffer.isBuffer(l) || l.length < 12)
return Buffer.alloc(0);
const O = n(I), C = O(l.slice(0, 12)), L = (D.flags & 8) === 8 ? D.timeHighByte : D.crc >>> 24;
if (C[11] !== L)
throw t.WRONG_PASSWORD();
return O(l.slice(12));
}
function y(l) {
Buffer.isBuffer(l) && l.length >= 12 ? a.genSalt = function() {
return l.slice(0, 12);
} : l === "node" ? a.genSalt = m.node : a.genSalt = m;
}
function g(l, D, I, O = !1) {
l == null && (l = Buffer.alloc(0)), Buffer.isBuffer(l) || (l = Buffer.from(l.toString()));
const C = f(I), L = a.genSalt();
L[11] = D.crc >>> 24 & 255, O && (L[10] = D.crc >>> 16 & 255);
const S = Buffer.alloc(l.length + 12);
return C(L, S), C(l, S, 12);
}
return oe = { decrypt: _, encrypt: g, _salter: y }, oe;
}
var Oe;
function ft