Files
twtxt-lib/dist-demo/dist-browser/twtxt-lib.min.js
2026-02-22 21:26:15 -05:00

2319 lines
73 KiB
JavaScript

// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
var er = Object.defineProperty, nr = Object.defineProperties;
var ir = Object.getOwnPropertyDescriptors;
var _t = Object.getOwnPropertySymbols;
var or = Object.prototype.hasOwnProperty, ur = Object.prototype.propertyIsEnumerable;
var Y = Math.pow, Rt = (f, l, x) => l in f ? er(f, l, { enumerable: !0, configurable: !0, writable: !0, value: x }) : f[l] = x, Ot = (f, l) => {
for (var x in l || (l = {}))
or.call(l, x) && Rt(f, x, l[x]);
if (_t)
for (var x of _t(l))
ur.call(l, x) && Rt(f, x, l[x]);
return f;
}, Lt = (f, l) => nr(f, ir(l));
var Nt = (f, l, x) => new Promise((d, A) => {
var p = (u) => {
try {
a(x.next(u));
} catch (B) {
A(B);
}
}, h = (u) => {
try {
a(x.throw(u));
} catch (B) {
A(B);
}
}, a = (u) => u.done ? d(u.value) : Promise.resolve(u.value).then(p, h);
a((x = x.apply(f, l)).next());
});
var Z = {}, Bt = {};
Bt.byteLength = fr;
Bt.toByteArray = hr;
Bt.fromByteArray = dr;
var st = [], et = [], sr = typeof Uint8Array != "undefined" ? Uint8Array : Array, $t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for (var dt = 0, ar = $t.length; dt < ar; ++dt)
st[dt] = $t[dt], et[$t.charCodeAt(dt)] = dt;
et[45] = 62;
et[95] = 63;
function zt(f) {
var l = f.length;
if (l % 4 > 0)
throw new Error("Invalid string. Length must be a multiple of 4");
var x = f.indexOf("=");
x === -1 && (x = l);
var d = x === l ? 0 : 4 - x % 4;
return [x, d];
}
function fr(f) {
var l = zt(f), x = l[0], d = l[1];
return (x + d) * 3 / 4 - d;
}
function cr(f, l, x) {
return (l + x) * 3 / 4 - x;
}
function hr(f) {
var l, x = zt(f), d = x[0], A = x[1], p = new sr(cr(f, d, A)), h = 0, a = A > 0 ? d - 4 : d, u;
for (u = 0; u < a; u += 4)
l = et[f.charCodeAt(u)] << 18 | et[f.charCodeAt(u + 1)] << 12 | et[f.charCodeAt(u + 2)] << 6 | et[f.charCodeAt(u + 3)], p[h++] = l >> 16 & 255, p[h++] = l >> 8 & 255, p[h++] = l & 255;
return A === 2 && (l = et[f.charCodeAt(u)] << 2 | et[f.charCodeAt(u + 1)] >> 4, p[h++] = l & 255), A === 1 && (l = et[f.charCodeAt(u)] << 10 | et[f.charCodeAt(u + 1)] << 4 | et[f.charCodeAt(u + 2)] >> 2, p[h++] = l >> 8 & 255, p[h++] = l & 255), p;
}
function lr(f) {
return st[f >> 18 & 63] + st[f >> 12 & 63] + st[f >> 6 & 63] + st[f & 63];
}
function pr(f, l, x) {
for (var d, A = [], p = l; p < x; p += 3)
d = (f[p] << 16 & 16711680) + (f[p + 1] << 8 & 65280) + (f[p + 2] & 255), A.push(lr(d));
return A.join("");
}
function dr(f) {
for (var l, x = f.length, d = x % 3, A = [], p = 16383, h = 0, a = x - d; h < a; h += p)
A.push(pr(f, h, h + p > a ? a : h + p));
return d === 1 ? (l = f[x - 1], A.push(
st[l >> 2] + st[l << 4 & 63] + "=="
)) : d === 2 && (l = (f[x - 2] << 8) + f[x - 1], A.push(
st[l >> 10] + st[l >> 4 & 63] + st[l << 2 & 63] + "="
)), A.join("");
}
var Tt = {};
Tt.read = function(f, l, x, d, A) {
var p, h, a = A * 8 - d - 1, u = (1 << a) - 1, B = u >> 1, i = -7, F = x ? A - 1 : 0, M = x ? -1 : 1, k = f[l + F];
for (F += M, p = k & (1 << -i) - 1, k >>= -i, i += a; i > 0; p = p * 256 + f[l + F], F += M, i -= 8)
;
for (h = p & (1 << -i) - 1, p >>= -i, i += d; i > 0; h = h * 256 + f[l + F], F += M, i -= 8)
;
if (p === 0)
p = 1 - B;
else {
if (p === u)
return h ? NaN : (k ? -1 : 1) * (1 / 0);
h = h + Math.pow(2, d), p = p - B;
}
return (k ? -1 : 1) * h * Math.pow(2, p - d);
};
Tt.write = function(f, l, x, d, A, p) {
var h, a, u, B = p * 8 - A - 1, i = (1 << B) - 1, F = i >> 1, M = A === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, k = d ? 0 : p - 1, b = d ? 1 : -1, m = l < 0 || l === 0 && 1 / l < 0 ? 1 : 0;
for (l = Math.abs(l), isNaN(l) || l === 1 / 0 ? (a = isNaN(l) ? 1 : 0, h = i) : (h = Math.floor(Math.log(l) / Math.LN2), l * (u = Math.pow(2, -h)) < 1 && (h--, u *= 2), h + F >= 1 ? l += M / u : l += M * Math.pow(2, 1 - F), l * u >= 2 && (h++, u /= 2), h + F >= i ? (a = 0, h = i) : h + F >= 1 ? (a = (l * u - 1) * Math.pow(2, A), h = h + F) : (a = l * Math.pow(2, F - 1) * Math.pow(2, A), h = 0)); A >= 8; f[x + k] = a & 255, k += b, a /= 256, A -= 8)
;
for (h = h << A | a, B += A; B > 0; f[x + k] = h & 255, k += b, h /= 256, B -= 8)
;
f[x + k - b] |= m * 128;
};
(function(f) {
const l = Bt, x = Tt, d = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
f.Buffer = i, f.SlowBuffer = N, f.INSPECT_MAX_BYTES = 50;
const A = 2147483647;
f.kMaxLength = A;
const { Uint8Array: p, ArrayBuffer: h, SharedArrayBuffer: a } = globalThis;
i.TYPED_ARRAY_SUPPORT = u(), !i.TYPED_ARRAY_SUPPORT && typeof console != "undefined" && typeof console.error == "function" && console.error(
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
);
function u() {
try {
const e = new p(1), t = { foo: function() {
return 42;
} };
return Object.setPrototypeOf(t, p.prototype), Object.setPrototypeOf(e, t), e.foo() === 42;
} catch (e) {
return !1;
}
}
Object.defineProperty(i.prototype, "parent", {
enumerable: !0,
get: function() {
if (i.isBuffer(this))
return this.buffer;
}
}), Object.defineProperty(i.prototype, "offset", {
enumerable: !0,
get: function() {
if (i.isBuffer(this))
return this.byteOffset;
}
});
function B(e) {
if (e > A)
throw new RangeError('The value "' + e + '" is invalid for option "size"');
const t = new p(e);
return Object.setPrototypeOf(t, i.prototype), t;
}
function i(e, t, r) {
if (typeof e == "number") {
if (typeof t == "string")
throw new TypeError(
'The "string" argument must be of type string. Received type number'
);
return b(e);
}
return F(e, t, r);
}
i.poolSize = 8192;
function F(e, t, r) {
if (typeof e == "string")
return m(e, t);
if (h.isView(e))
return y(e);
if (e == null)
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e
);
if (ut(e, h) || e && ut(e.buffer, h) || typeof a != "undefined" && (ut(e, a) || e && ut(e.buffer, a)))
return U(e, t, r);
if (typeof e == "number")
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
);
const n = e.valueOf && e.valueOf();
if (n != null && n !== e)
return i.from(n, t, r);
const o = w(e);
if (o) return o;
if (typeof Symbol != "undefined" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function")
return i.from(e[Symbol.toPrimitive]("string"), t, r);
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e
);
}
i.from = function(e, t, r) {
return F(e, t, r);
}, Object.setPrototypeOf(i.prototype, p.prototype), Object.setPrototypeOf(i, p);
function M(e) {
if (typeof e != "number")
throw new TypeError('"size" argument must be of type number');
if (e < 0)
throw new RangeError('The value "' + e + '" is invalid for option "size"');
}
function k(e, t, r) {
return M(e), e <= 0 ? B(e) : t !== void 0 ? typeof r == "string" ? B(e).fill(t, r) : B(e).fill(t) : B(e);
}
i.alloc = function(e, t, r) {
return k(e, t, r);
};
function b(e) {
return M(e), B(e < 0 ? 0 : O(e) | 0);
}
i.allocUnsafe = function(e) {
return b(e);
}, i.allocUnsafeSlow = function(e) {
return b(e);
};
function m(e, t) {
if ((typeof t != "string" || t === "") && (t = "utf8"), !i.isEncoding(t))
throw new TypeError("Unknown encoding: " + t);
const r = j(e, t) | 0;
let n = B(r);
const o = n.write(e, t);
return o !== r && (n = n.slice(0, o)), n;
}
function g(e) {
const t = e.length < 0 ? 0 : O(e.length) | 0, r = B(t);
for (let n = 0; n < t; n += 1)
r[n] = e[n] & 255;
return r;
}
function y(e) {
if (ut(e, p)) {
const t = new p(e);
return U(t.buffer, t.byteOffset, t.byteLength);
}
return g(e);
}
function U(e, t, r) {
if (t < 0 || e.byteLength < t)
throw new RangeError('"offset" is outside of buffer bounds');
if (e.byteLength < t + (r || 0))
throw new RangeError('"length" is outside of buffer bounds');
let n;
return t === void 0 && r === void 0 ? n = new p(e) : r === void 0 ? n = new p(e, t) : n = new p(e, t, r), Object.setPrototypeOf(n, i.prototype), n;
}
function w(e) {
if (i.isBuffer(e)) {
const t = O(e.length) | 0, r = B(t);
return r.length === 0 || e.copy(r, 0, 0, t), r;
}
if (e.length !== void 0)
return typeof e.length != "number" || It(e.length) ? B(0) : g(e);
if (e.type === "Buffer" && Array.isArray(e.data))
return g(e.data);
}
function O(e) {
if (e >= A)
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + A.toString(16) + " bytes");
return e | 0;
}
function N(e) {
return +e != e && (e = 0), i.alloc(+e);
}
i.isBuffer = function(t) {
return t != null && t._isBuffer === !0 && t !== i.prototype;
}, i.compare = function(t, r) {
if (ut(t, p) && (t = i.from(t, t.offset, t.byteLength)), ut(r, p) && (r = i.from(r, r.offset, r.byteLength)), !i.isBuffer(t) || !i.isBuffer(r))
throw new TypeError(
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
);
if (t === r) return 0;
let n = t.length, o = r.length;
for (let s = 0, c = Math.min(n, o); s < c; ++s)
if (t[s] !== r[s]) {
n = t[s], o = r[s];
break;
}
return n < o ? -1 : o < n ? 1 : 0;
}, i.isEncoding = function(t) {
switch (String(t).toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "latin1":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return !0;
default:
return !1;
}
}, i.concat = function(t, r) {
if (!Array.isArray(t))
throw new TypeError('"list" argument must be an Array of Buffers');
if (t.length === 0)
return i.alloc(0);
let n;
if (r === void 0)
for (r = 0, n = 0; n < t.length; ++n)
r += t[n].length;
const o = i.allocUnsafe(r);
let s = 0;
for (n = 0; n < t.length; ++n) {
let c = t[n];
if (ut(c, p))
s + c.length > o.length ? (i.isBuffer(c) || (c = i.from(c)), c.copy(o, s)) : p.prototype.set.call(
o,
c,
s
);
else if (i.isBuffer(c))
c.copy(o, s);
else
throw new TypeError('"list" argument must be an Array of Buffers');
s += c.length;
}
return o;
};
function j(e, t) {
if (i.isBuffer(e))
return e.length;
if (h.isView(e) || ut(e, h))
return e.byteLength;
if (typeof e != "string")
throw new TypeError(
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof e
);
const r = e.length, n = arguments.length > 2 && arguments[2] === !0;
if (!n && r === 0) return 0;
let o = !1;
for (; ; )
switch (t) {
case "ascii":
case "latin1":
case "binary":
return r;
case "utf8":
case "utf-8":
return Et(e).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return r * 2;
case "hex":
return r >>> 1;
case "base64":
return Ct(e).length;
default:
if (o)
return n ? -1 : Et(e).length;
t = ("" + t).toLowerCase(), o = !0;
}
}
i.byteLength = j;
function nt(e, t, r) {
let n = !1;
if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, t >>>= 0, r <= t))
return "";
for (e || (e = "utf8"); ; )
switch (e) {
case "hex":
return W(this, t, r);
case "utf8":
case "utf-8":
return S(this, t, r);
case "ascii":
return C(this, t, r);
case "latin1":
case "binary":
return P(this, t, r);
case "base64":
return E(this, t, r);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return J(this, t, r);
default:
if (n) throw new TypeError("Unknown encoding: " + e);
e = (e + "").toLowerCase(), n = !0;
}
}
i.prototype._isBuffer = !0;
function Q(e, t, r) {
const n = e[t];
e[t] = e[r], e[r] = n;
}
i.prototype.swap16 = function() {
const t = this.length;
if (t % 2 !== 0)
throw new RangeError("Buffer size must be a multiple of 16-bits");
for (let r = 0; r < t; r += 2)
Q(this, r, r + 1);
return this;
}, i.prototype.swap32 = function() {
const t = this.length;
if (t % 4 !== 0)
throw new RangeError("Buffer size must be a multiple of 32-bits");
for (let r = 0; r < t; r += 4)
Q(this, r, r + 3), Q(this, r + 1, r + 2);
return this;
}, i.prototype.swap64 = function() {
const t = this.length;
if (t % 8 !== 0)
throw new RangeError("Buffer size must be a multiple of 64-bits");
for (let r = 0; r < t; r += 8)
Q(this, r, r + 7), Q(this, r + 1, r + 6), Q(this, r + 2, r + 5), Q(this, r + 3, r + 4);
return this;
}, i.prototype.toString = function() {
const t = this.length;
return t === 0 ? "" : arguments.length === 0 ? S(this, 0, t) : nt.apply(this, arguments);
}, i.prototype.toLocaleString = i.prototype.toString, i.prototype.equals = function(t) {
if (!i.isBuffer(t)) throw new TypeError("Argument must be a Buffer");
return this === t ? !0 : i.compare(this, t) === 0;
}, i.prototype.inspect = function() {
let t = "";
const r = f.INSPECT_MAX_BYTES;
return t = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (t += " ... "), "<Buffer " + t + ">";
}, d && (i.prototype[d] = i.prototype.inspect), i.prototype.compare = function(t, r, n, o, s) {
if (ut(t, p) && (t = i.from(t, t.offset, t.byteLength)), !i.isBuffer(t))
throw new TypeError(
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof t
);
if (r === void 0 && (r = 0), n === void 0 && (n = t ? t.length : 0), o === void 0 && (o = 0), s === void 0 && (s = this.length), r < 0 || n > t.length || o < 0 || s > this.length)
throw new RangeError("out of range index");
if (o >= s && r >= n)
return 0;
if (o >= s)
return -1;
if (r >= n)
return 1;
if (r >>>= 0, n >>>= 0, o >>>= 0, s >>>= 0, this === t) return 0;
let c = s - o, R = n - r;
const z = Math.min(c, R), G = this.slice(o, s), V = t.slice(r, n);
for (let H = 0; H < z; ++H)
if (G[H] !== V[H]) {
c = G[H], R = V[H];
break;
}
return c < R ? -1 : R < c ? 1 : 0;
};
function rt(e, t, r, n, o) {
if (e.length === 0) return -1;
if (typeof r == "string" ? (n = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, It(r) && (r = o ? 0 : e.length - 1), r < 0 && (r = e.length + r), r >= e.length) {
if (o) return -1;
r = e.length - 1;
} else if (r < 0)
if (o) r = 0;
else return -1;
if (typeof t == "string" && (t = i.from(t, n)), i.isBuffer(t))
return t.length === 0 ? -1 : q(e, t, r, n, o);
if (typeof t == "number")
return t = t & 255, typeof p.prototype.indexOf == "function" ? o ? p.prototype.indexOf.call(e, t, r) : p.prototype.lastIndexOf.call(e, t, r) : q(e, [t], r, n, o);
throw new TypeError("val must be string, number or Buffer");
}
function q(e, t, r, n, o) {
let s = 1, c = e.length, R = t.length;
if (n !== void 0 && (n = String(n).toLowerCase(), n === "ucs2" || n === "ucs-2" || n === "utf16le" || n === "utf-16le")) {
if (e.length < 2 || t.length < 2)
return -1;
s = 2, c /= 2, R /= 2, r /= 2;
}
function z(V, H) {
return s === 1 ? V[H] : V.readUInt16BE(H * s);
}
let G;
if (o) {
let V = -1;
for (G = r; G < c; G++)
if (z(e, G) === z(t, V === -1 ? 0 : G - V)) {
if (V === -1 && (V = G), G - V + 1 === R) return V * s;
} else
V !== -1 && (G -= G - V), V = -1;
} else
for (r + R > c && (r = c - R), G = r; G >= 0; G--) {
let V = !0;
for (let H = 0; H < R; H++)
if (z(e, G + H) !== z(t, H)) {
V = !1;
break;
}
if (V) return G;
}
return -1;
}
i.prototype.includes = function(t, r, n) {
return this.indexOf(t, r, n) !== -1;
}, i.prototype.indexOf = function(t, r, n) {
return rt(this, t, r, n, !0);
}, i.prototype.lastIndexOf = function(t, r, n) {
return rt(this, t, r, n, !1);
};
function _(e, t, r, n) {
r = Number(r) || 0;
const o = e.length - r;
n ? (n = Number(n), n > o && (n = o)) : n = o;
const s = t.length;
n > s / 2 && (n = s / 2);
let c;
for (c = 0; c < n; ++c) {
const R = parseInt(t.substr(c * 2, 2), 16);
if (It(R)) return c;
e[r + c] = R;
}
return c;
}
function X(e, t, r, n) {
return bt(Et(t, e.length - r), e, r, n);
}
function mt(e, t, r, n) {
return bt(Kt(t), e, r, n);
}
function T(e, t, r, n) {
return bt(Ct(t), e, r, n);
}
function $(e, t, r, n) {
return bt(Qt(t, e.length - r), e, r, n);
}
i.prototype.write = function(t, r, n, o) {
if (r === void 0)
o = "utf8", n = this.length, r = 0;
else if (n === void 0 && typeof r == "string")
o = r, n = this.length, r = 0;
else if (isFinite(r))
r = r >>> 0, isFinite(n) ? (n = n >>> 0, o === void 0 && (o = "utf8")) : (o = n, n = void 0);
else
throw new Error(
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
);
const s = this.length - r;
if ((n === void 0 || n > s) && (n = s), t.length > 0 && (n < 0 || r < 0) || r > this.length)
throw new RangeError("Attempt to write outside buffer bounds");
o || (o = "utf8");
let c = !1;
for (; ; )
switch (o) {
case "hex":
return _(this, t, r, n);
case "utf8":
case "utf-8":
return X(this, t, r, n);
case "ascii":
case "latin1":
case "binary":
return mt(this, t, r, n);
case "base64":
return T(this, t, r, n);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return $(this, t, r, n);
default:
if (c) throw new TypeError("Unknown encoding: " + o);
o = ("" + o).toLowerCase(), c = !0;
}
}, i.prototype.toJSON = function() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
};
};
function E(e, t, r) {
return t === 0 && r === e.length ? l.fromByteArray(e) : l.fromByteArray(e.slice(t, r));
}
function S(e, t, r) {
r = Math.min(e.length, r);
const n = [];
let o = t;
for (; o < r; ) {
const s = e[o];
let c = null, R = s > 239 ? 4 : s > 223 ? 3 : s > 191 ? 2 : 1;
if (o + R <= r) {
let z, G, V, H;
switch (R) {
case 1:
s < 128 && (c = s);
break;
case 2:
z = e[o + 1], (z & 192) === 128 && (H = (s & 31) << 6 | z & 63, H > 127 && (c = H));
break;
case 3:
z = e[o + 1], G = e[o + 2], (z & 192) === 128 && (G & 192) === 128 && (H = (s & 15) << 12 | (z & 63) << 6 | G & 63, H > 2047 && (H < 55296 || H > 57343) && (c = H));
break;
case 4:
z = e[o + 1], G = e[o + 2], V = e[o + 3], (z & 192) === 128 && (G & 192) === 128 && (V & 192) === 128 && (H = (s & 15) << 18 | (z & 63) << 12 | (G & 63) << 6 | V & 63, H > 65535 && H < 1114112 && (c = H));
}
}
c === null ? (c = 65533, R = 1) : c > 65535 && (c -= 65536, n.push(c >>> 10 & 1023 | 55296), c = 56320 | c & 1023), n.push(c), o += R;
}
return D(n);
}
const I = 4096;
function D(e) {
const t = e.length;
if (t <= I)
return String.fromCharCode.apply(String, e);
let r = "", n = 0;
for (; n < t; )
r += String.fromCharCode.apply(
String,
e.slice(n, n += I)
);
return r;
}
function C(e, t, r) {
let n = "";
r = Math.min(e.length, r);
for (let o = t; o < r; ++o)
n += String.fromCharCode(e[o] & 127);
return n;
}
function P(e, t, r) {
let n = "";
r = Math.min(e.length, r);
for (let o = t; o < r; ++o)
n += String.fromCharCode(e[o]);
return n;
}
function W(e, t, r) {
const n = e.length;
(!t || t < 0) && (t = 0), (!r || r < 0 || r > n) && (r = n);
let o = "";
for (let s = t; s < r; ++s)
o += tr[e[s]];
return o;
}
function J(e, t, r) {
const n = e.slice(t, r);
let o = "";
for (let s = 0; s < n.length - 1; s += 2)
o += String.fromCharCode(n[s] + n[s + 1] * 256);
return o;
}
i.prototype.slice = function(t, r) {
const n = this.length;
t = ~~t, r = r === void 0 ? n : ~~r, t < 0 ? (t += n, t < 0 && (t = 0)) : t > n && (t = n), r < 0 ? (r += n, r < 0 && (r = 0)) : r > n && (r = n), r < t && (r = t);
const o = this.subarray(t, r);
return Object.setPrototypeOf(o, i.prototype), o;
};
function L(e, t, r) {
if (e % 1 !== 0 || e < 0) throw new RangeError("offset is not uint");
if (e + t > r) throw new RangeError("Trying to access beyond buffer length");
}
i.prototype.readUintLE = i.prototype.readUIntLE = function(t, r, n) {
t = t >>> 0, r = r >>> 0, n || L(t, r, this.length);
let o = this[t], s = 1, c = 0;
for (; ++c < r && (s *= 256); )
o += this[t + c] * s;
return o;
}, i.prototype.readUintBE = i.prototype.readUIntBE = function(t, r, n) {
t = t >>> 0, r = r >>> 0, n || L(t, r, this.length);
let o = this[t + --r], s = 1;
for (; r > 0 && (s *= 256); )
o += this[t + --r] * s;
return o;
}, i.prototype.readUint8 = i.prototype.readUInt8 = function(t, r) {
return t = t >>> 0, r || L(t, 1, this.length), this[t];
}, i.prototype.readUint16LE = i.prototype.readUInt16LE = function(t, r) {
return t = t >>> 0, r || L(t, 2, this.length), this[t] | this[t + 1] << 8;
}, i.prototype.readUint16BE = i.prototype.readUInt16BE = function(t, r) {
return t = t >>> 0, r || L(t, 2, this.length), this[t] << 8 | this[t + 1];
}, i.prototype.readUint32LE = i.prototype.readUInt32LE = function(t, r) {
return t = t >>> 0, r || L(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + this[t + 3] * 16777216;
}, i.prototype.readUint32BE = i.prototype.readUInt32BE = function(t, r) {
return t = t >>> 0, r || L(t, 4, this.length), this[t] * 16777216 + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]);
}, i.prototype.readBigUInt64LE = ht(function(t) {
t = t >>> 0, pt(t, "offset");
const r = this[t], n = this[t + 7];
(r === void 0 || n === void 0) && yt(t, this.length - 8);
const o = r + this[++t] * Y(2, 8) + this[++t] * Y(2, 16) + this[++t] * Y(2, 24), s = this[++t] + this[++t] * Y(2, 8) + this[++t] * Y(2, 16) + n * Y(2, 24);
return BigInt(o) + (BigInt(s) << BigInt(32));
}), i.prototype.readBigUInt64BE = ht(function(t) {
t = t >>> 0, pt(t, "offset");
const r = this[t], n = this[t + 7];
(r === void 0 || n === void 0) && yt(t, this.length - 8);
const o = r * Y(2, 24) + this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + this[++t], s = this[++t] * Y(2, 24) + this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + n;
return (BigInt(o) << BigInt(32)) + BigInt(s);
}), i.prototype.readIntLE = function(t, r, n) {
t = t >>> 0, r = r >>> 0, n || L(t, r, this.length);
let o = this[t], s = 1, c = 0;
for (; ++c < r && (s *= 256); )
o += this[t + c] * s;
return s *= 128, o >= s && (o -= Math.pow(2, 8 * r)), o;
}, i.prototype.readIntBE = function(t, r, n) {
t = t >>> 0, r = r >>> 0, n || L(t, r, this.length);
let o = r, s = 1, c = this[t + --o];
for (; o > 0 && (s *= 256); )
c += this[t + --o] * s;
return s *= 128, c >= s && (c -= Math.pow(2, 8 * r)), c;
}, i.prototype.readInt8 = function(t, r) {
return t = t >>> 0, r || L(t, 1, this.length), this[t] & 128 ? (255 - this[t] + 1) * -1 : this[t];
}, i.prototype.readInt16LE = function(t, r) {
t = t >>> 0, r || L(t, 2, this.length);
const n = this[t] | this[t + 1] << 8;
return n & 32768 ? n | 4294901760 : n;
}, i.prototype.readInt16BE = function(t, r) {
t = t >>> 0, r || L(t, 2, this.length);
const n = this[t + 1] | this[t] << 8;
return n & 32768 ? n | 4294901760 : n;
}, i.prototype.readInt32LE = function(t, r) {
return t = t >>> 0, r || L(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24;
}, i.prototype.readInt32BE = function(t, r) {
return t = t >>> 0, r || L(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3];
}, i.prototype.readBigInt64LE = ht(function(t) {
t = t >>> 0, pt(t, "offset");
const r = this[t], n = this[t + 7];
(r === void 0 || n === void 0) && yt(t, this.length - 8);
const o = this[t + 4] + this[t + 5] * Y(2, 8) + this[t + 6] * Y(2, 16) + (n << 24);
return (BigInt(o) << BigInt(32)) + BigInt(r + this[++t] * Y(2, 8) + this[++t] * Y(2, 16) + this[++t] * Y(2, 24));
}), i.prototype.readBigInt64BE = ht(function(t) {
t = t >>> 0, pt(t, "offset");
const r = this[t], n = this[t + 7];
(r === void 0 || n === void 0) && yt(t, this.length - 8);
const o = (r << 24) + // Overflow
this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + this[++t];
return (BigInt(o) << BigInt(32)) + BigInt(this[++t] * Y(2, 24) + this[++t] * Y(2, 16) + this[++t] * Y(2, 8) + n);
}), i.prototype.readFloatLE = function(t, r) {
return t = t >>> 0, r || L(t, 4, this.length), x.read(this, t, !0, 23, 4);
}, i.prototype.readFloatBE = function(t, r) {
return t = t >>> 0, r || L(t, 4, this.length), x.read(this, t, !1, 23, 4);
}, i.prototype.readDoubleLE = function(t, r) {
return t = t >>> 0, r || L(t, 8, this.length), x.read(this, t, !0, 52, 8);
}, i.prototype.readDoubleBE = function(t, r) {
return t = t >>> 0, r || L(t, 8, this.length), x.read(this, t, !1, 52, 8);
};
function v(e, t, r, n, o, s) {
if (!i.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
if (t > o || t < s) throw new RangeError('"value" argument is out of bounds');
if (r + n > e.length) throw new RangeError("Index out of range");
}
i.prototype.writeUintLE = i.prototype.writeUIntLE = function(t, r, n, o) {
if (t = +t, r = r >>> 0, n = n >>> 0, !o) {
const R = Math.pow(2, 8 * n) - 1;
v(this, t, r, n, R, 0);
}
let s = 1, c = 0;
for (this[r] = t & 255; ++c < n && (s *= 256); )
this[r + c] = t / s & 255;
return r + n;
}, i.prototype.writeUintBE = i.prototype.writeUIntBE = function(t, r, n, o) {
if (t = +t, r = r >>> 0, n = n >>> 0, !o) {
const R = Math.pow(2, 8 * n) - 1;
v(this, t, r, n, R, 0);
}
let s = n - 1, c = 1;
for (this[r + s] = t & 255; --s >= 0 && (c *= 256); )
this[r + s] = t / c & 255;
return r + n;
}, i.prototype.writeUint8 = i.prototype.writeUInt8 = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 1, 255, 0), this[r] = t & 255, r + 1;
}, i.prototype.writeUint16LE = i.prototype.writeUInt16LE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 2, 65535, 0), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2;
}, i.prototype.writeUint16BE = i.prototype.writeUInt16BE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 2, 65535, 0), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2;
}, i.prototype.writeUint32LE = i.prototype.writeUInt32LE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 4, 4294967295, 0), this[r + 3] = t >>> 24, this[r + 2] = t >>> 16, this[r + 1] = t >>> 8, this[r] = t & 255, r + 4;
}, i.prototype.writeUint32BE = i.prototype.writeUInt32BE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 4, 4294967295, 0), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4;
};
function at(e, t, r, n, o) {
Dt(t, n, o, e, r, 7);
let s = Number(t & BigInt(4294967295));
e[r++] = s, s = s >> 8, e[r++] = s, s = s >> 8, e[r++] = s, s = s >> 8, e[r++] = s;
let c = Number(t >> BigInt(32) & BigInt(4294967295));
return e[r++] = c, c = c >> 8, e[r++] = c, c = c >> 8, e[r++] = c, c = c >> 8, e[r++] = c, r;
}
function it(e, t, r, n, o) {
Dt(t, n, o, e, r, 7);
let s = Number(t & BigInt(4294967295));
e[r + 7] = s, s = s >> 8, e[r + 6] = s, s = s >> 8, e[r + 5] = s, s = s >> 8, e[r + 4] = s;
let c = Number(t >> BigInt(32) & BigInt(4294967295));
return e[r + 3] = c, c = c >> 8, e[r + 2] = c, c = c >> 8, e[r + 1] = c, c = c >> 8, e[r] = c, r + 8;
}
i.prototype.writeBigUInt64LE = ht(function(t, r = 0) {
return at(this, t, r, BigInt(0), BigInt("0xffffffffffffffff"));
}), i.prototype.writeBigUInt64BE = ht(function(t, r = 0) {
return it(this, t, r, BigInt(0), BigInt("0xffffffffffffffff"));
}), i.prototype.writeIntLE = function(t, r, n, o) {
if (t = +t, r = r >>> 0, !o) {
const z = Math.pow(2, 8 * n - 1);
v(this, t, r, n, z - 1, -z);
}
let s = 0, c = 1, R = 0;
for (this[r] = t & 255; ++s < n && (c *= 256); )
t < 0 && R === 0 && this[r + s - 1] !== 0 && (R = 1), this[r + s] = (t / c >> 0) - R & 255;
return r + n;
}, i.prototype.writeIntBE = function(t, r, n, o) {
if (t = +t, r = r >>> 0, !o) {
const z = Math.pow(2, 8 * n - 1);
v(this, t, r, n, z - 1, -z);
}
let s = n - 1, c = 1, R = 0;
for (this[r + s] = t & 255; --s >= 0 && (c *= 256); )
t < 0 && R === 0 && this[r + s + 1] !== 0 && (R = 1), this[r + s] = (t / c >> 0) - R & 255;
return r + n;
}, i.prototype.writeInt8 = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 1, 127, -128), t < 0 && (t = 255 + t + 1), this[r] = t & 255, r + 1;
}, i.prototype.writeInt16LE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 2, 32767, -32768), this[r] = t & 255, this[r + 1] = t >>> 8, r + 2;
}, i.prototype.writeInt16BE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 2, 32767, -32768), this[r] = t >>> 8, this[r + 1] = t & 255, r + 2;
}, i.prototype.writeInt32LE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 4, 2147483647, -2147483648), this[r] = t & 255, this[r + 1] = t >>> 8, this[r + 2] = t >>> 16, this[r + 3] = t >>> 24, r + 4;
}, i.prototype.writeInt32BE = function(t, r, n) {
return t = +t, r = r >>> 0, n || v(this, t, r, 4, 2147483647, -2147483648), t < 0 && (t = 4294967295 + t + 1), this[r] = t >>> 24, this[r + 1] = t >>> 16, this[r + 2] = t >>> 8, this[r + 3] = t & 255, r + 4;
}, i.prototype.writeBigInt64LE = ht(function(t, r = 0) {
return at(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
}), i.prototype.writeBigInt64BE = ht(function(t, r = 0) {
return it(this, t, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
});
function ct(e, t, r, n, o, s) {
if (r + n > e.length) throw new RangeError("Index out of range");
if (r < 0) throw new RangeError("Index out of range");
}
function ot(e, t, r, n, o) {
return t = +t, r = r >>> 0, o || ct(e, t, r, 4), x.write(e, t, r, n, 23, 4), r + 4;
}
i.prototype.writeFloatLE = function(t, r, n) {
return ot(this, t, r, !0, n);
}, i.prototype.writeFloatBE = function(t, r, n) {
return ot(this, t, r, !1, n);
};
function K(e, t, r, n, o) {
return t = +t, r = r >>> 0, o || ct(e, t, r, 8), x.write(e, t, r, n, 52, 8), r + 8;
}
i.prototype.writeDoubleLE = function(t, r, n) {
return K(this, t, r, !0, n);
}, i.prototype.writeDoubleBE = function(t, r, n) {
return K(this, t, r, !1, n);
}, i.prototype.copy = function(t, r, n, o) {
if (!i.isBuffer(t)) throw new TypeError("argument should be a Buffer");
if (n || (n = 0), !o && o !== 0 && (o = this.length), r >= t.length && (r = t.length), r || (r = 0), o > 0 && o < n && (o = n), o === n || t.length === 0 || this.length === 0) return 0;
if (r < 0)
throw new RangeError("targetStart out of bounds");
if (n < 0 || n >= this.length) throw new RangeError("Index out of range");
if (o < 0) throw new RangeError("sourceEnd out of bounds");
o > this.length && (o = this.length), t.length - r < o - n && (o = t.length - r + n);
const s = o - n;
return this === t && typeof p.prototype.copyWithin == "function" ? this.copyWithin(r, n, o) : p.prototype.set.call(
t,
this.subarray(n, o),
r
), s;
}, i.prototype.fill = function(t, r, n, o) {
if (typeof t == "string") {
if (typeof r == "string" ? (o = r, r = 0, n = this.length) : typeof n == "string" && (o = n, n = this.length), o !== void 0 && typeof o != "string")
throw new TypeError("encoding must be a string");
if (typeof o == "string" && !i.isEncoding(o))
throw new TypeError("Unknown encoding: " + o);
if (t.length === 1) {
const c = t.charCodeAt(0);
(o === "utf8" && c < 128 || o === "latin1") && (t = c);
}
} else typeof t == "number" ? t = t & 255 : typeof t == "boolean" && (t = Number(t));
if (r < 0 || this.length < r || this.length < n)
throw new RangeError("Out of range index");
if (n <= r)
return this;
r = r >>> 0, n = n === void 0 ? this.length : n >>> 0, t || (t = 0);
let s;
if (typeof t == "number")
for (s = r; s < n; ++s)
this[s] = t;
else {
const c = i.isBuffer(t) ? t : i.from(t, o), R = c.length;
if (R === 0)
throw new TypeError('The value "' + t + '" is invalid for argument "value"');
for (s = 0; s < n - r; ++s)
this[s + r] = c[s % R];
}
return this;
};
const tt = {};
function ft(e, t, r) {
tt[e] = class extends r {
constructor() {
super(), Object.defineProperty(this, "message", {
value: t.apply(this, arguments),
writable: !0,
configurable: !0
}), this.name = `${this.name} [${e}]`, this.stack, delete this.name;
}
get code() {
return e;
}
set code(o) {
Object.defineProperty(this, "code", {
configurable: !0,
enumerable: !0,
value: o,
writable: !0
});
}
toString() {
return `${this.name} [${e}]: ${this.message}`;
}
};
}
ft(
"ERR_BUFFER_OUT_OF_BOUNDS",
function(e) {
return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
},
RangeError
), ft(
"ERR_INVALID_ARG_TYPE",
function(e, t) {
return `The "${e}" argument must be of type number. Received type ${typeof t}`;
},
TypeError
), ft(
"ERR_OUT_OF_RANGE",
function(e, t, r) {
let n = `The value of "${e}" is out of range.`, o = r;
return Number.isInteger(r) && Math.abs(r) > Y(2, 32) ? o = lt(String(r)) : typeof r == "bigint" && (o = String(r), (r > Y(BigInt(2), BigInt(32)) || r < -Y(BigInt(2), BigInt(32))) && (o = lt(o)), o += "n"), n += ` It must be ${t}. Received ${o}`, n;
},
RangeError
);
function lt(e) {
let t = "", r = e.length;
const n = e[0] === "-" ? 1 : 0;
for (; r >= n + 4; r -= 3)
t = `_${e.slice(r - 3, r)}${t}`;
return `${e.slice(0, r)}${t}`;
}
function Jt(e, t, r) {
pt(t, "offset"), (e[t] === void 0 || e[t + r] === void 0) && yt(t, e.length - (r + 1));
}
function Dt(e, t, r, n, o, s) {
if (e > r || e < t) {
const c = typeof t == "bigint" ? "n" : "";
let R;
throw s > 3 ? t === 0 || t === BigInt(0) ? R = `>= 0${c} and < 2${c} ** ${(s + 1) * 8}${c}` : R = `>= -(2${c} ** ${(s + 1) * 8 - 1}${c}) and < 2 ** ${(s + 1) * 8 - 1}${c}` : R = `>= ${t}${c} and <= ${r}${c}`, new tt.ERR_OUT_OF_RANGE("value", R, e);
}
Jt(n, o, s);
}
function pt(e, t) {
if (typeof e != "number")
throw new tt.ERR_INVALID_ARG_TYPE(t, "number", e);
}
function yt(e, t, r) {
throw Math.floor(e) !== e ? (pt(e, r), new tt.ERR_OUT_OF_RANGE(r || "offset", "an integer", e)) : t < 0 ? new tt.ERR_BUFFER_OUT_OF_BOUNDS() : new tt.ERR_OUT_OF_RANGE(
r || "offset",
`>= ${r ? 1 : 0} and <= ${t}`,
e
);
}
const Zt = /[^+/0-9A-Za-z-_]/g;
function Xt(e) {
if (e = e.split("=")[0], e = e.trim().replace(Zt, ""), e.length < 2) return "";
for (; e.length % 4 !== 0; )
e = e + "=";
return e;
}
function Et(e, t) {
t = t || 1 / 0;
let r;
const n = e.length;
let o = null;
const s = [];
for (let c = 0; c < n; ++c) {
if (r = e.charCodeAt(c), r > 55295 && r < 57344) {
if (!o) {
if (r > 56319) {
(t -= 3) > -1 && s.push(239, 191, 189);
continue;
} else if (c + 1 === n) {
(t -= 3) > -1 && s.push(239, 191, 189);
continue;
}
o = r;
continue;
}
if (r < 56320) {
(t -= 3) > -1 && s.push(239, 191, 189), o = r;
continue;
}
r = (o - 55296 << 10 | r - 56320) + 65536;
} else o && (t -= 3) > -1 && s.push(239, 191, 189);
if (o = null, r < 128) {
if ((t -= 1) < 0) break;
s.push(r);
} else if (r < 2048) {
if ((t -= 2) < 0) break;
s.push(
r >> 6 | 192,
r & 63 | 128
);
} else if (r < 65536) {
if ((t -= 3) < 0) break;
s.push(
r >> 12 | 224,
r >> 6 & 63 | 128,
r & 63 | 128
);
} else if (r < 1114112) {
if ((t -= 4) < 0) break;
s.push(
r >> 18 | 240,
r >> 12 & 63 | 128,
r >> 6 & 63 | 128,
r & 63 | 128
);
} else
throw new Error("Invalid code point");
}
return s;
}
function Kt(e) {
const t = [];
for (let r = 0; r < e.length; ++r)
t.push(e.charCodeAt(r) & 255);
return t;
}
function Qt(e, t) {
let r, n, o;
const s = [];
for (let c = 0; c < e.length && !((t -= 2) < 0); ++c)
r = e.charCodeAt(c), n = r >> 8, o = r % 256, s.push(o), s.push(n);
return s;
}
function Ct(e) {
return l.toByteArray(Xt(e));
}
function bt(e, t, r, n) {
let o;
for (o = 0; o < n && !(o + r >= t.length || o >= e.length); ++o)
t[o + r] = e[o];
return o;
}
function ut(e, t) {
return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
}
function It(e) {
return e !== e;
}
const tr = (function() {
const e = "0123456789abcdef", t = new Array(256);
for (let r = 0; r < 16; ++r) {
const n = r * 16;
for (let o = 0; o < 16; ++o)
t[n + o] = e[r] + e[o];
}
return t;
})();
function ht(e) {
return typeof BigInt == "undefined" ? rr : e;
}
function rr() {
throw new Error("BigInt not supported");
}
})(Z);
const jt = Z.Buffer, Nr = Z.Blob, jr = Z.BlobOptions, yr = Z.Buffer, Pr = Z.File, vr = Z.FileOptions, Hr = Z.INSPECT_MAX_BYTES, Yr = Z.SlowBuffer, Gr = Z.TranscodeEncoding, qr = Z.atob, Wr = Z.btoa, zr = Z.constants, Vr = Z.isAscii, Jr = Z.isUtf8, Zr = Z.kMaxLength, Xr = Z.kStringMaxLength, Kr = Z.resolveObjectURL, Qr = Z.transcode;
function Mt(f) {
return f && f.__esModule && Object.prototype.hasOwnProperty.call(f, "default") ? f.default : f;
}
var Ft, Pt;
function Vt() {
if (Pt) return Ft;
Pt = 1;
const f = "Input must be an string, Buffer or Uint8Array";
function l(h) {
let a;
if (h instanceof Uint8Array)
a = h;
else if (h instanceof jt)
a = new Uint8Array(h);
else if (typeof h == "string")
a = new Uint8Array(jt.from(h, "utf8"));
else
throw new Error(f);
return a;
}
function x(h) {
return Array.prototype.map.call(h, function(a) {
return (a < 16 ? "0" : "") + a.toString(16);
}).join("");
}
function d(h) {
return (4294967296 + h).toString(16).substring(1);
}
function A(h, a, u) {
let B = `
` + h + " = ";
for (let i = 0; i < a.length; i += 2) {
if (u === 32)
B += d(a[i]).toUpperCase(), B += " ", B += d(a[i + 1]).toUpperCase();
else if (u === 64)
B += d(a[i + 1]).toUpperCase(), B += d(a[i]).toUpperCase();
else throw new Error("Invalid size " + u);
i % 6 === 4 ? B += `
` + new Array(h.length + 4).join(" ") : i < a.length - 2 && (B += " ");
}
console.log(B);
}
function p(h, a, u) {
let B = (/* @__PURE__ */ new Date()).getTime();
const i = new Uint8Array(a);
for (let M = 0; M < a; M++)
i[M] = M % 256;
const F = (/* @__PURE__ */ new Date()).getTime();
console.log("Generated random input in " + (F - B) + "ms"), B = F;
for (let M = 0; M < u; M++) {
const k = h(i), b = (/* @__PURE__ */ new Date()).getTime(), m = b - B;
B = b, console.log("Hashed in " + m + "ms: " + k.substring(0, 20) + "..."), console.log(
Math.round(a / (1 << 20) / (m / 1e3) * 100) / 100 + " MB PER SECOND"
);
}
}
return Ft = {
normalizeInput: l,
toHex: x,
debugPrint: A,
testSpeed: p
}, Ft;
}
var Ut, vt;
function wr() {
if (vt) return Ut;
vt = 1;
const f = Vt();
function l(y, U, w) {
const O = y[U] + y[w];
let N = y[U + 1] + y[w + 1];
O >= 4294967296 && N++, y[U] = O, y[U + 1] = N;
}
function x(y, U, w, O) {
let N = y[U] + w;
w < 0 && (N += 4294967296);
let j = y[U + 1] + O;
N >= 4294967296 && j++, y[U] = N, y[U + 1] = j;
}
function d(y, U) {
return y[U] ^ y[U + 1] << 8 ^ y[U + 2] << 16 ^ y[U + 3] << 24;
}
function A(y, U, w, O, N, j) {
const nt = B[N], Q = B[N + 1], rt = B[j], q = B[j + 1];
l(u, y, U), x(u, y, nt, Q);
let _ = u[O] ^ u[y], X = u[O + 1] ^ u[y + 1];
u[O] = X, u[O + 1] = _, l(u, w, O), _ = u[U] ^ u[w], X = u[U + 1] ^ u[w + 1], u[U] = _ >>> 24 ^ X << 8, u[U + 1] = X >>> 24 ^ _ << 8, l(u, y, U), x(u, y, rt, q), _ = u[O] ^ u[y], X = u[O + 1] ^ u[y + 1], u[O] = _ >>> 16 ^ X << 16, u[O + 1] = X >>> 16 ^ _ << 16, l(u, w, O), _ = u[U] ^ u[w], X = u[U + 1] ^ u[w + 1], u[U] = X >>> 31 ^ _ << 1, u[U + 1] = _ >>> 31 ^ X << 1;
}
const p = new Uint32Array([
4089235720,
1779033703,
2227873595,
3144134277,
4271175723,
1013904242,
1595750129,
2773480762,
2917565137,
1359893119,
725511199,
2600822924,
4215389547,
528734635,
327033209,
1541459225
]), h = [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
14,
10,
4,
8,
9,
15,
13,
6,
1,
12,
0,
2,
11,
7,
5,
3,
11,
8,
12,
0,
5,
2,
15,
13,
10,
14,
3,
6,
7,
1,
9,
4,
7,
9,
3,
1,
13,
12,
11,
14,
2,
6,
5,
10,
4,
0,
15,
8,
9,
0,
5,
7,
2,
4,
10,
15,
14,
1,
11,
12,
6,
8,
3,
13,
2,
12,
6,
10,
0,
11,
8,
3,
4,
13,
7,
5,
15,
14,
1,
9,
12,
5,
1,
15,
14,
13,
4,
10,
0,
7,
6,
3,
9,
2,
8,
11,
13,
11,
7,
14,
12,
1,
3,
9,
5,
0,
15,
4,
8,
6,
2,
10,
6,
15,
14,
9,
11,
3,
0,
8,
12,
2,
13,
7,
1,
4,
10,
5,
10,
2,
8,
4,
7,
6,
1,
5,
15,
11,
9,
14,
3,
12,
13,
0,
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
14,
10,
4,
8,
9,
15,
13,
6,
1,
12,
0,
2,
11,
7,
5,
3
], a = new Uint8Array(
h.map(function(y) {
return y * 2;
})
), u = new Uint32Array(32), B = new Uint32Array(32);
function i(y, U) {
let w = 0;
for (w = 0; w < 16; w++)
u[w] = y.h[w], u[w + 16] = p[w];
for (u[24] = u[24] ^ y.t, u[25] = u[25] ^ y.t / 4294967296, U && (u[28] = ~u[28], u[29] = ~u[29]), w = 0; w < 32; w++)
B[w] = d(y.b, 4 * w);
for (w = 0; w < 12; w++)
A(0, 8, 16, 24, a[w * 16 + 0], a[w * 16 + 1]), A(2, 10, 18, 26, a[w * 16 + 2], a[w * 16 + 3]), A(4, 12, 20, 28, a[w * 16 + 4], a[w * 16 + 5]), A(6, 14, 22, 30, a[w * 16 + 6], a[w * 16 + 7]), A(0, 10, 20, 30, a[w * 16 + 8], a[w * 16 + 9]), A(2, 12, 22, 24, a[w * 16 + 10], a[w * 16 + 11]), A(4, 14, 16, 26, a[w * 16 + 12], a[w * 16 + 13]), A(6, 8, 18, 28, a[w * 16 + 14], a[w * 16 + 15]);
for (w = 0; w < 16; w++)
y.h[w] = y.h[w] ^ u[w] ^ u[w + 16];
}
var F = new Uint8Array([
0,
0,
0,
0,
// 0: outlen, keylen, fanout, depth
0,
0,
0,
0,
// 4: leaf length, sequential mode
0,
0,
0,
0,
// 8: node offset
0,
0,
0,
0,
// 12: node offset
0,
0,
0,
0,
// 16: node depth, inner length, rfu
0,
0,
0,
0,
// 20: rfu
0,
0,
0,
0,
// 24: rfu
0,
0,
0,
0,
// 28: rfu
0,
0,
0,
0,
// 32: salt
0,
0,
0,
0,
// 36: salt
0,
0,
0,
0,
// 40: salt
0,
0,
0,
0,
// 44: salt
0,
0,
0,
0,
// 48: personal
0,
0,
0,
0,
// 52: personal
0,
0,
0,
0,
// 56: personal
0,
0,
0,
0
// 60: personal
]);
function M(y, U, w, O) {
if (y === 0 || y > 64)
throw new Error("Illegal output length, expected 0 < length <= 64");
if (U && U.length > 64)
throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");
if (w && w.length !== 16)
throw new Error("Illegal salt, expected Uint8Array with length is 16");
if (O && O.length !== 16)
throw new Error("Illegal personal, expected Uint8Array with length is 16");
const N = {
b: new Uint8Array(128),
h: new Uint32Array(16),
t: 0,
// input count
c: 0,
// pointer within buffer
outlen: y
// output length in bytes
};
F.fill(0), F[0] = y, U && (F[1] = U.length), F[2] = 1, F[3] = 1, w && F.set(w, 32), O && F.set(O, 48);
for (let j = 0; j < 16; j++)
N.h[j] = p[j] ^ d(F, j * 4);
return U && (k(N, U), N.c = 128), N;
}
function k(y, U) {
for (let w = 0; w < U.length; w++)
y.c === 128 && (y.t += y.c, i(y, !1), y.c = 0), y.b[y.c++] = U[w];
}
function b(y) {
for (y.t += y.c; y.c < 128; )
y.b[y.c++] = 0;
i(y, !0);
const U = new Uint8Array(y.outlen);
for (let w = 0; w < y.outlen; w++)
U[w] = y.h[w >> 2] >> 8 * (w & 3);
return U;
}
function m(y, U, w, O, N) {
w = w || 64, y = f.normalizeInput(y), O && (O = f.normalizeInput(O)), N && (N = f.normalizeInput(N));
const j = M(w, U, O, N);
return k(j, y), b(j);
}
function g(y, U, w, O, N) {
const j = m(y, U, w, O, N);
return f.toHex(j);
}
return Ut = {
blake2b: m,
blake2bHex: g,
blake2bInit: M,
blake2bUpdate: k,
blake2bFinal: b
}, Ut;
}
var At, Ht;
function gr() {
if (Ht) return At;
Ht = 1;
const f = Vt();
function l(b, m) {
return b[m] ^ b[m + 1] << 8 ^ b[m + 2] << 16 ^ b[m + 3] << 24;
}
function x(b, m, g, y, U, w) {
h[b] = h[b] + h[m] + U, h[y] = d(h[y] ^ h[b], 16), h[g] = h[g] + h[y], h[m] = d(h[m] ^ h[g], 12), h[b] = h[b] + h[m] + w, h[y] = d(h[y] ^ h[b], 8), h[g] = h[g] + h[y], h[m] = d(h[m] ^ h[g], 7);
}
function d(b, m) {
return b >>> m ^ b << 32 - m;
}
const A = new Uint32Array([
1779033703,
3144134277,
1013904242,
2773480762,
1359893119,
2600822924,
528734635,
1541459225
]), p = new Uint8Array([
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
14,
10,
4,
8,
9,
15,
13,
6,
1,
12,
0,
2,
11,
7,
5,
3,
11,
8,
12,
0,
5,
2,
15,
13,
10,
14,
3,
6,
7,
1,
9,
4,
7,
9,
3,
1,
13,
12,
11,
14,
2,
6,
5,
10,
4,
0,
15,
8,
9,
0,
5,
7,
2,
4,
10,
15,
14,
1,
11,
12,
6,
8,
3,
13,
2,
12,
6,
10,
0,
11,
8,
3,
4,
13,
7,
5,
15,
14,
1,
9,
12,
5,
1,
15,
14,
13,
4,
10,
0,
7,
6,
3,
9,
2,
8,
11,
13,
11,
7,
14,
12,
1,
3,
9,
5,
0,
15,
4,
8,
6,
2,
10,
6,
15,
14,
9,
11,
3,
0,
8,
12,
2,
13,
7,
1,
4,
10,
5,
10,
2,
8,
4,
7,
6,
1,
5,
15,
11,
9,
14,
3,
12,
13,
0
]), h = new Uint32Array(16), a = new Uint32Array(16);
function u(b, m) {
let g = 0;
for (g = 0; g < 8; g++)
h[g] = b.h[g], h[g + 8] = A[g];
for (h[12] ^= b.t, h[13] ^= b.t / 4294967296, m && (h[14] = ~h[14]), g = 0; g < 16; g++)
a[g] = l(b.b, 4 * g);
for (g = 0; g < 10; g++)
x(0, 4, 8, 12, a[p[g * 16 + 0]], a[p[g * 16 + 1]]), x(1, 5, 9, 13, a[p[g * 16 + 2]], a[p[g * 16 + 3]]), x(2, 6, 10, 14, a[p[g * 16 + 4]], a[p[g * 16 + 5]]), x(3, 7, 11, 15, a[p[g * 16 + 6]], a[p[g * 16 + 7]]), x(0, 5, 10, 15, a[p[g * 16 + 8]], a[p[g * 16 + 9]]), x(1, 6, 11, 12, a[p[g * 16 + 10]], a[p[g * 16 + 11]]), x(2, 7, 8, 13, a[p[g * 16 + 12]], a[p[g * 16 + 13]]), x(3, 4, 9, 14, a[p[g * 16 + 14]], a[p[g * 16 + 15]]);
for (g = 0; g < 8; g++)
b.h[g] ^= h[g] ^ h[g + 8];
}
function B(b, m) {
if (!(b > 0 && b <= 32))
throw new Error("Incorrect output length, should be in [1, 32]");
const g = m ? m.length : 0;
if (m && !(g > 0 && g <= 32))
throw new Error("Incorrect key length, should be in [1, 32]");
const y = {
h: new Uint32Array(A),
// hash state
b: new Uint8Array(64),
// input block
c: 0,
// pointer within block
t: 0,
// input count
outlen: b
// output length in bytes
};
return y.h[0] ^= 16842752 ^ g << 8 ^ b, g > 0 && (i(y, m), y.c = 64), y;
}
function i(b, m) {
for (let g = 0; g < m.length; g++)
b.c === 64 && (b.t += b.c, u(b, !1), b.c = 0), b.b[b.c++] = m[g];
}
function F(b) {
for (b.t += b.c; b.c < 64; )
b.b[b.c++] = 0;
u(b, !0);
const m = new Uint8Array(b.outlen);
for (let g = 0; g < b.outlen; g++)
m[g] = b.h[g >> 2] >> 8 * (g & 3) & 255;
return m;
}
function M(b, m, g) {
g = g || 32, b = f.normalizeInput(b);
const y = B(g, m);
return i(y, b), F(y);
}
function k(b, m, g) {
const y = M(b, m, g);
return f.toHex(y);
}
return At = {
blake2s: M,
blake2sHex: k,
blake2sInit: B,
blake2sUpdate: i,
blake2sFinal: F
}, At;
}
var St, Yt;
function xr() {
if (Yt) return St;
Yt = 1;
const f = wr(), l = gr();
return St = {
blake2b: f.blake2b,
blake2bHex: f.blake2bHex,
blake2bInit: f.blake2bInit,
blake2bUpdate: f.blake2bUpdate,
blake2bFinal: f.blake2bFinal,
blake2s: l.blake2s,
blake2sHex: l.blake2sHex,
blake2sInit: l.blake2sInit,
blake2sUpdate: l.blake2sUpdate,
blake2sFinal: l.blake2sFinal
}, St;
}
var mr = xr();
var kt = {}, Gt;
function br() {
return Gt || (Gt = 1, (function(f) {
"use strict";
var l = function(a, u) {
return u || (u = {}), a.split("").forEach(function(B, i) {
B in u || (u[B] = i);
}), u;
}, x = {
alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
charmap: {
0: 14,
1: 8
}
};
x.charmap = l(x.alphabet, x.charmap);
var d = {
alphabet: "0123456789ABCDEFGHJKMNPQRSTVWXYZ",
charmap: {
O: 0,
I: 1,
L: 1
}
};
d.charmap = l(d.alphabet, d.charmap);
var A = {
alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
charmap: {}
};
A.charmap = l(A.alphabet, A.charmap);
function p(a) {
if (this.buf = [], this.shift = 8, this.carry = 0, a) {
switch (a.type) {
case "rfc4648":
this.charmap = f.rfc4648.charmap;
break;
case "crockford":
this.charmap = f.crockford.charmap;
break;
case "base32hex":
this.charmap = f.base32hex.charmap;
break;
default:
throw new Error("invalid type");
}
a.charmap && (this.charmap = a.charmap);
}
}
p.prototype.charmap = x.charmap, p.prototype.write = function(a) {
var u = this.charmap, B = this.buf, i = this.shift, F = this.carry;
return a.toUpperCase().split("").forEach(function(M) {
if (M != "=") {
var k = u[M] & 255;
i -= 5, i > 0 ? F |= k << i : i < 0 ? (B.push(F | k >> -i), i += 8, F = k << i & 255) : (B.push(F | k), i = 8, F = 0);
}
}), this.shift = i, this.carry = F, this;
}, p.prototype.finalize = function(a) {
return a && this.write(a), this.shift !== 8 && this.carry !== 0 && (this.buf.push(this.carry), this.shift = 8, this.carry = 0), this.buf;
};
function h(a) {
if (this.buf = "", this.shift = 3, this.carry = 0, a) {
switch (a.type) {
case "rfc4648":
this.alphabet = f.rfc4648.alphabet;
break;
case "crockford":
this.alphabet = f.crockford.alphabet;
break;
case "base32hex":
this.alphabet = f.base32hex.alphabet;
break;
default:
throw new Error("invalid type");
}
a.alphabet ? this.alphabet = a.alphabet : a.lc && (this.alphabet = this.alphabet.toLowerCase());
}
}
h.prototype.alphabet = x.alphabet, h.prototype.write = function(a) {
var u = this.shift, B = this.carry, i, F, M;
for (M = 0; M < a.length; M++)
F = a[M], i = B | F >> u, this.buf += this.alphabet[i & 31], u > 5 && (u -= 5, i = F >> u, this.buf += this.alphabet[i & 31]), u = 5 - u, B = F << u, u = 8 - u;
return this.shift = u, this.carry = B, this;
}, h.prototype.finalize = function(a) {
return a && this.write(a), this.shift !== 3 && (this.buf += this.alphabet[this.carry & 31], this.shift = 3, this.carry = 0), this.buf;
}, f.encode = function(a, u) {
return new h(u).finalize(a);
}, f.decode = function(a, u) {
return new p(u).finalize(a);
}, f.Decoder = p, f.Encoder = h, f.charmap = l, f.crockford = d, f.rfc4648 = x, f.base32hex = A;
})(kt)), kt;
}
var Br = br();
const Er = /* @__PURE__ */ Mt(Br), Ir = (f) => new Er.Encoder({ type: "rfc4648" }).write(f).finalize(), $r = (f) => Array.isArray(f) && f.length ? f[0] : f;
globalThis.Buffer = yr;
const Fr = /^(\d{4})-(\d{2})-(\d{2})([tT ])(\d{2}):(\d{2}):(\d{2})\.?(\d{3})?(?:(?:([+-]\d{2}):?(\d{2}))|Z)?$/, Ur = (f) => {
const l = (p = 0) => `${+p < 10 ? 0 : ""}${+p}`, x = (p = 0) => `${+p < 1e3 ? 0 : ""}${+p < 100 ? 0 : ""}${+p < 10 ? 0 : ""}${+p}`;
let d = Fr.exec(f);
d && (d == null ? void 0 : d[9]) === void 0 && (d[9] = "+00"), d && (d == null ? void 0 : d[10]) === void 0 && (d[10] = "00");
const A = `${d == null ? void 0 : d[9]}:${d == null ? void 0 : d[10]}`.replace(/[+-]?00:00$/, "Z");
return [
x(d == null ? void 0 : d[1]),
"-",
l(d == null ? void 0 : d[2]),
"-",
l(d == null ? void 0 : d[3]),
d == null ? void 0 : d[4],
l(d == null ? void 0 : d[5]),
":",
l(d == null ? void 0 : d[6]),
":",
l(d == null ? void 0 : d[7]),
//ignore milliseconds (m[8])
A
].join("");
};
function Ar(f) {
const l = Ur(f.created), x = [f.url, l, f.content].join(`
`);
return Ir(mr.blake2b(x, void 0, 32)).toLowerCase().slice(-7);
}
var wt = { exports: {} }, Sr = wt.exports, qt;
function kr() {
return qt || (qt = 1, (function(f, l) {
(function(x, d) {
f.exports = d();
})(Sr, (function() {
"use strict";
var x = 1e3, d = 6e4, A = 36e5, p = "millisecond", h = "second", a = "minute", u = "hour", B = "day", i = "week", F = "month", M = "quarter", k = "year", b = "date", m = "Invalid Date", g = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, U = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(T) {
var $ = ["th", "st", "nd", "rd"], E = T % 100;
return "[" + T + ($[(E - 20) % 10] || $[E] || $[0]) + "]";
} }, w = function(T, $, E) {
var S = String(T);
return !S || S.length >= $ ? T : "" + Array($ + 1 - S.length).join(E) + T;
}, O = { s: w, z: function(T) {
var $ = -T.utcOffset(), E = Math.abs($), S = Math.floor(E / 60), I = E % 60;
return ($ <= 0 ? "+" : "-") + w(S, 2, "0") + ":" + w(I, 2, "0");
}, m: function T($, E) {
if ($.date() < E.date()) return -T(E, $);
var S = 12 * (E.year() - $.year()) + (E.month() - $.month()), I = $.clone().add(S, F), D = E - I < 0, C = $.clone().add(S + (D ? -1 : 1), F);
return +(-(S + (E - I) / (D ? I - C : C - I)) || 0);
}, a: function(T) {
return T < 0 ? Math.ceil(T) || 0 : Math.floor(T);
}, p: function(T) {
return { M: F, y: k, w: i, d: B, D: b, h: u, m: a, s: h, ms: p, Q: M }[T] || String(T || "").toLowerCase().replace(/s$/, "");
}, u: function(T) {
return T === void 0;
} }, N = "en", j = {};
j[N] = U;
var nt = "$isDayjsObject", Q = function(T) {
return T instanceof X || !(!T || !T[nt]);
}, rt = function T($, E, S) {
var I;
if (!$) return N;
if (typeof $ == "string") {
var D = $.toLowerCase();
j[D] && (I = D), E && (j[D] = E, I = D);
var C = $.split("-");
if (!I && C.length > 1) return T(C[0]);
} else {
var P = $.name;
j[P] = $, I = P;
}
return !S && I && (N = I), I || !S && N;
}, q = function(T, $) {
if (Q(T)) return T.clone();
var E = typeof $ == "object" ? $ : {};
return E.date = T, E.args = arguments, new X(E);
}, _ = O;
_.l = rt, _.i = Q, _.w = function(T, $) {
return q(T, { locale: $.$L, utc: $.$u, x: $.$x, $offset: $.$offset });
};
var X = (function() {
function T(E) {
this.$L = rt(E.locale, null, !0), this.parse(E), this.$x = this.$x || E.x || {}, this[nt] = !0;
}
var $ = T.prototype;
return $.parse = function(E) {
this.$d = (function(S) {
var I = S.date, D = S.utc;
if (I === null) return /* @__PURE__ */ new Date(NaN);
if (_.u(I)) return /* @__PURE__ */ new Date();
if (I instanceof Date) return new Date(I);
if (typeof I == "string" && !/Z$/i.test(I)) {
var C = I.match(g);
if (C) {
var P = C[2] - 1 || 0, W = (C[7] || "0").substring(0, 3);
return D ? new Date(Date.UTC(C[1], P, C[3] || 1, C[4] || 0, C[5] || 0, C[6] || 0, W)) : new Date(C[1], P, C[3] || 1, C[4] || 0, C[5] || 0, C[6] || 0, W);
}
}
return new Date(I);
})(E), this.init();
}, $.init = function() {
var E = this.$d;
this.$y = E.getFullYear(), this.$M = E.getMonth(), this.$D = E.getDate(), this.$W = E.getDay(), this.$H = E.getHours(), this.$m = E.getMinutes(), this.$s = E.getSeconds(), this.$ms = E.getMilliseconds();
}, $.$utils = function() {
return _;
}, $.isValid = function() {
return this.$d.toString() !== m;
}, $.isSame = function(E, S) {
var I = q(E);
return this.startOf(S) <= I && I <= this.endOf(S);
}, $.isAfter = function(E, S) {
return q(E) < this.startOf(S);
}, $.isBefore = function(E, S) {
return this.endOf(S) < q(E);
}, $.$g = function(E, S, I) {
return _.u(E) ? this[S] : this.set(I, E);
}, $.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, $.valueOf = function() {
return this.$d.getTime();
}, $.startOf = function(E, S) {
var I = this, D = !!_.u(S) || S, C = _.p(E), P = function(ot, K) {
var tt = _.w(I.$u ? Date.UTC(I.$y, K, ot) : new Date(I.$y, K, ot), I);
return D ? tt : tt.endOf(B);
}, W = function(ot, K) {
return _.w(I.toDate()[ot].apply(I.toDate("s"), (D ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(K)), I);
}, J = this.$W, L = this.$M, v = this.$D, at = "set" + (this.$u ? "UTC" : "");
switch (C) {
case k:
return D ? P(1, 0) : P(31, 11);
case F:
return D ? P(1, L) : P(0, L + 1);
case i:
var it = this.$locale().weekStart || 0, ct = (J < it ? J + 7 : J) - it;
return P(D ? v - ct : v + (6 - ct), L);
case B:
case b:
return W(at + "Hours", 0);
case u:
return W(at + "Minutes", 1);
case a:
return W(at + "Seconds", 2);
case h:
return W(at + "Milliseconds", 3);
default:
return this.clone();
}
}, $.endOf = function(E) {
return this.startOf(E, !1);
}, $.$set = function(E, S) {
var I, D = _.p(E), C = "set" + (this.$u ? "UTC" : ""), P = (I = {}, I[B] = C + "Date", I[b] = C + "Date", I[F] = C + "Month", I[k] = C + "FullYear", I[u] = C + "Hours", I[a] = C + "Minutes", I[h] = C + "Seconds", I[p] = C + "Milliseconds", I)[D], W = D === B ? this.$D + (S - this.$W) : S;
if (D === F || D === k) {
var J = this.clone().set(b, 1);
J.$d[P](W), J.init(), this.$d = J.set(b, Math.min(this.$D, J.daysInMonth())).$d;
} else P && this.$d[P](W);
return this.init(), this;
}, $.set = function(E, S) {
return this.clone().$set(E, S);
}, $.get = function(E) {
return this[_.p(E)]();
}, $.add = function(E, S) {
var I, D = this;
E = Number(E);
var C = _.p(S), P = function(L) {
var v = q(D);
return _.w(v.date(v.date() + Math.round(L * E)), D);
};
if (C === F) return this.set(F, this.$M + E);
if (C === k) return this.set(k, this.$y + E);
if (C === B) return P(1);
if (C === i) return P(7);
var W = (I = {}, I[a] = d, I[u] = A, I[h] = x, I)[C] || 1, J = this.$d.getTime() + E * W;
return _.w(J, this);
}, $.subtract = function(E, S) {
return this.add(-1 * E, S);
}, $.format = function(E) {
var S = this, I = this.$locale();
if (!this.isValid()) return I.invalidDate || m;
var D = E || "YYYY-MM-DDTHH:mm:ssZ", C = _.z(this), P = this.$H, W = this.$m, J = this.$M, L = I.weekdays, v = I.months, at = I.meridiem, it = function(K, tt, ft, lt) {
return K && (K[tt] || K(S, D)) || ft[tt].slice(0, lt);
}, ct = function(K) {
return _.s(P % 12 || 12, K, "0");
}, ot = at || function(K, tt, ft) {
var lt = K < 12 ? "AM" : "PM";
return ft ? lt.toLowerCase() : lt;
};
return D.replace(y, (function(K, tt) {
return tt || (function(ft) {
switch (ft) {
case "YY":
return String(S.$y).slice(-2);
case "YYYY":
return _.s(S.$y, 4, "0");
case "M":
return J + 1;
case "MM":
return _.s(J + 1, 2, "0");
case "MMM":
return it(I.monthsShort, J, v, 3);
case "MMMM":
return it(v, J);
case "D":
return S.$D;
case "DD":
return _.s(S.$D, 2, "0");
case "d":
return String(S.$W);
case "dd":
return it(I.weekdaysMin, S.$W, L, 2);
case "ddd":
return it(I.weekdaysShort, S.$W, L, 3);
case "dddd":
return L[S.$W];
case "H":
return String(P);
case "HH":
return _.s(P, 2, "0");
case "h":
return ct(1);
case "hh":
return ct(2);
case "a":
return ot(P, W, !0);
case "A":
return ot(P, W, !1);
case "m":
return String(W);
case "mm":
return _.s(W, 2, "0");
case "s":
return String(S.$s);
case "ss":
return _.s(S.$s, 2, "0");
case "SSS":
return _.s(S.$ms, 3, "0");
case "Z":
return C;
}
return null;
})(K) || C.replace(":", "");
}));
}, $.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, $.diff = function(E, S, I) {
var D, C = this, P = _.p(S), W = q(E), J = (W.utcOffset() - this.utcOffset()) * d, L = this - W, v = function() {
return _.m(C, W);
};
switch (P) {
case k:
D = v() / 12;
break;
case F:
D = v();
break;
case M:
D = v() / 3;
break;
case i:
D = (L - J) / 6048e5;
break;
case B:
D = (L - J) / 864e5;
break;
case u:
D = L / A;
break;
case a:
D = L / d;
break;
case h:
D = L / x;
break;
default:
D = L;
}
return I ? D : _.a(D);
}, $.daysInMonth = function() {
return this.endOf(F).$D;
}, $.$locale = function() {
return j[this.$L];
}, $.locale = function(E, S) {
if (!E) return this.$L;
var I = this.clone(), D = rt(E, S, !0);
return D && (I.$L = D), I;
}, $.clone = function() {
return _.w(this.$d, this);
}, $.toDate = function() {
return new Date(this.valueOf());
}, $.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, $.toISOString = function() {
return this.$d.toISOString();
}, $.toString = function() {
return this.$d.toUTCString();
}, T;
})(), mt = X.prototype;
return q.prototype = mt, [["$ms", p], ["$s", h], ["$m", a], ["$H", u], ["$W", B], ["$M", F], ["$y", k], ["$D", b]].forEach((function(T) {
mt[T[1]] = function($) {
return this.$g($, T[0], T[1]);
};
})), q.extend = function(T, $) {
return T.$i || (T($, X, q), T.$i = !0), q;
}, q.locale = rt, q.isDayjs = Q, q.unix = function(T) {
return q(1e3 * T);
}, q.en = j[N], q.Ls = j, q.p = {}, q;
}));
})(wt, wt.exports)), wt.exports;
}
var Tr = kr();
const xt = /* @__PURE__ */ Mt(Tr);
var gt = { exports: {} }, Mr = gt.exports, Wt;
function Dr() {
return Wt || (Wt = 1, (function(f, l) {
(function(x, d) {
f.exports = d();
})(Mr, (function() {
"use strict";
var x = "minute", d = /[+-]\d\d(?::?\d\d)?/g, A = /([+-]|\d\d)/g;
return function(p, h, a) {
var u = h.prototype;
a.utc = function(m) {
var g = { date: m, utc: !0, args: arguments };
return new h(g);
}, u.utc = function(m) {
var g = a(this.toDate(), { locale: this.$L, utc: !0 });
return m ? g.add(this.utcOffset(), x) : g;
}, u.local = function() {
return a(this.toDate(), { locale: this.$L, utc: !1 });
};
var B = u.parse;
u.parse = function(m) {
m.utc && (this.$u = !0), this.$utils().u(m.$offset) || (this.$offset = m.$offset), B.call(this, m);
};
var i = u.init;
u.init = function() {
if (this.$u) {
var m = this.$d;
this.$y = m.getUTCFullYear(), this.$M = m.getUTCMonth(), this.$D = m.getUTCDate(), this.$W = m.getUTCDay(), this.$H = m.getUTCHours(), this.$m = m.getUTCMinutes(), this.$s = m.getUTCSeconds(), this.$ms = m.getUTCMilliseconds();
} else i.call(this);
};
var F = u.utcOffset;
u.utcOffset = function(m, g) {
var y = this.$utils().u;
if (y(m)) return this.$u ? 0 : y(this.$offset) ? F.call(this) : this.$offset;
if (typeof m == "string" && (m = (function(N) {
N === void 0 && (N = "");
var j = N.match(d);
if (!j) return null;
var nt = ("" + j[0]).match(A) || ["-", 0, 0], Q = nt[0], rt = 60 * +nt[1] + +nt[2];
return rt === 0 ? 0 : Q === "+" ? rt : -rt;
})(m), m === null)) return this;
var U = Math.abs(m) <= 16 ? 60 * m : m;
if (U === 0) return this.utc(g);
var w = this.clone();
if (g) return w.$offset = U, w.$u = !1, w;
var O = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
return (w = this.local().add(U + O, x)).$offset = U, w.$x.$localOffset = O, w;
};
var M = u.format;
u.format = function(m) {
var g = m || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
return M.call(this, g);
}, u.valueOf = function() {
var m = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
return this.$d.valueOf() - 6e4 * m;
}, u.isUTC = function() {
return !!this.$u;
}, u.toISOString = function() {
return this.toDate().toISOString();
}, u.toString = function() {
return this.toDate().toUTCString();
};
var k = u.toDate;
u.toDate = function(m) {
return m === "s" && this.$offset ? a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : k.call(this);
};
var b = u.diff;
u.diff = function(m, g, y) {
if (m && this.$u === m.$u) return b.call(this, m, g, y);
var U = this.local(), w = a(m).local();
return b.call(U, w, g, y);
};
};
}));
})(gt, gt.exports)), gt.exports;
}
var Cr = Dr();
const _r = /* @__PURE__ */ Mt(Cr);
xt.extend(_r);
function Rr(f) {
const l = f.split(`
`), { commentLines: x = [], contentLines: d = [] } = l.reduce(
(u, B) => {
const i = B.trim();
return i === "" || (i.startsWith("#") ? u.commentLines.push(i) : u.contentLines.push(i)), u;
},
{
commentLines: [],
contentLines: []
}
), { following: A = [], metadata: p = {} } = x.filter((u) => u.includes("=")).reduce(
(u, B) => {
const [i, ...F] = B.substring(1).split("=").map((k) => k.trim()), M = F.join("=");
if (i === "follow") {
const [k, b] = M.trim().split(/\s+/);
u.following.push({ nick: k, url: b });
} else
u.metadata[i] ? Array.isArray(u.metadata[i]) ? u.metadata[i].push(M) : u.metadata[i] = [u.metadata[i], M] : u.metadata[i] = M;
return u;
},
{
following: [],
metadata: {}
}
), h = /\(#([\w]+)\) (\<\@(\S+) ([^>]+)>)*/, a = d.map((u) => {
var U;
const [B, i] = u.split(/\t/).map((w) => w.trim());
if (typeof i == "undefined")
throw new Error(`Content is undefined: ${u}`);
const F = xt.utc(B);
if (!F.isValid())
throw new Error(`Date is invalid: ${u}`);
const M = F.toISOString(), k = h.exec(i);
let b, m, g;
k != null && k.length && (b = k == null ? void 0 : k[1], m = k == null ? void 0 : k[3], g = k == null ? void 0 : k[4]);
const y = Ar({
content: i,
created: B,
createdUTC: M,
url: $r((U = p == null ? void 0 : p.url) != null ? U : "")
});
return {
content: i,
created: B,
createdUTC: M,
hash: y,
replyHash: b,
replyNick: m,
replyUrl: g
};
}).sort((u, B) => xt(u.created).diff(xt(B.created)));
return {
following: A,
metadata: p,
twts: a
};
}
function te(f = "") {
return Nt(this, null, function* () {
if (!f) throw new Error("URL is required");
try {
const l = yield fetch(f), x = yield l.text(), d = xt(
l.headers.get("Last-Modified")
).toISOString();
return Lt(Ot({}, Rr(x)), {
lastModified: d
});
} catch (l) {
throw console.error(l), l;
}
});
}
export {
Ir as base32Encode,
Ar as hashTwt,
te as loadAndParseTwtxtFile,
Rr as parseTwtxt
};
//# sourceMappingURL=twtxt-lib.min.js.map
// @license-end