@bitcobblers/wod-wiki-library
Version:
A specialized markdown-like workout syntax editor and runtime for defining workouts
1,187 lines (1,185 loc) • 483 kB
JavaScript
var Up = Object.defineProperty;
var jp = (e, t, n) => t in e ? Up(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var w = (e, t, n) => jp(e, typeof t != "symbol" ? t + "" : t, n);
import * as N from "react";
import X, { memo as Ya, useState as W, useRef as B, useCallback as ke, useEffect as V, createContext as rn, useContext as kt, useMemo as Rt, useLayoutEffect as Bp, forwardRef as zp, Fragment as Ei, isValidElement as Hp, cloneElement as Gp, createElement as Wp, useId as Xa } from "react";
import { languages as lc } from "monaco-editor";
import { createPortal as Kp } from "react-dom";
(function() {
const t = localStorage.getItem("theme");
t === "dark" ? document.documentElement.classList.add("dark") : t === "light" ? document.documentElement.classList.remove("dark") : (document.documentElement.classList.add("dark-mode-auto"), window.matchMedia("(prefers-color-scheme: dark)").matches && document.documentElement.classList.add("dark"));
})();
var si = { exports: {} }, rr = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var uc;
function Vp() {
if (uc) return rr;
uc = 1;
var e = X, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 };
function a(o, l, c) {
var u, f = {}, h = null, d = null;
c !== void 0 && (h = "" + c), l.key !== void 0 && (h = "" + l.key), l.ref !== void 0 && (d = l.ref);
for (u in l) r.call(l, u) && !s.hasOwnProperty(u) && (f[u] = l[u]);
if (o && o.defaultProps) for (u in l = o.defaultProps, l) f[u] === void 0 && (f[u] = l[u]);
return { $$typeof: t, type: o, key: h, ref: d, props: f, _owner: i.current };
}
return rr.Fragment = n, rr.jsx = a, rr.jsxs = a, rr;
}
var ir = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var fc;
function Zp() {
return fc || (fc = 1, process.env.NODE_ENV !== "production" && function() {
var e = X, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), o = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), d = Symbol.for("react.offscreen"), m = Symbol.iterator, g = "@@iterator";
function x(p) {
if (p === null || typeof p != "object")
return null;
var A = m && p[m] || p[g];
return typeof A == "function" ? A : null;
}
var y = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function b(p) {
{
for (var A = arguments.length, k = new Array(A > 1 ? A - 1 : 0), U = 1; U < A; U++)
k[U - 1] = arguments[U];
E("error", p, k);
}
}
function E(p, A, k) {
{
var U = y.ReactDebugCurrentFrame, J = U.getStackAddendum();
J !== "" && (A += "%s", k = k.concat([J]));
var ee = k.map(function(K) {
return String(K);
});
ee.unshift("Warning: " + A), Function.prototype.apply.call(console[p], console, ee);
}
}
var v = !1, T = !1, I = !1, S = !1, C = !1, O;
O = Symbol.for("react.module.reference");
function R(p) {
return !!(typeof p == "string" || typeof p == "function" || p === r || p === s || C || p === i || p === c || p === u || S || p === d || v || T || I || typeof p == "object" && p !== null && (p.$$typeof === h || p.$$typeof === f || p.$$typeof === a || p.$$typeof === o || p.$$typeof === l || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
p.$$typeof === O || p.getModuleId !== void 0));
}
function M(p, A, k) {
var U = p.displayName;
if (U)
return U;
var J = A.displayName || A.name || "";
return J !== "" ? k + "(" + J + ")" : k;
}
function ge(p) {
return p.displayName || "Context";
}
function oe(p) {
if (p == null)
return null;
if (typeof p.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof p == "function")
return p.displayName || p.name || null;
if (typeof p == "string")
return p;
switch (p) {
case r:
return "Fragment";
case n:
return "Portal";
case s:
return "Profiler";
case i:
return "StrictMode";
case c:
return "Suspense";
case u:
return "SuspenseList";
}
if (typeof p == "object")
switch (p.$$typeof) {
case o:
var A = p;
return ge(A) + ".Consumer";
case a:
var k = p;
return ge(k._context) + ".Provider";
case l:
return M(p, p.render, "ForwardRef");
case f:
var U = p.displayName || null;
return U !== null ? U : oe(p.type) || "Memo";
case h: {
var J = p, ee = J._payload, K = J._init;
try {
return oe(K(ee));
} catch {
return null;
}
}
}
return null;
}
var re = Object.assign, L = 0, H, ve, Me, we, Mt, j, q;
function de() {
}
de.__reactDisabledLog = !0;
function he() {
{
if (L === 0) {
H = console.log, ve = console.info, Me = console.warn, we = console.error, Mt = console.group, j = console.groupCollapsed, q = console.groupEnd;
var p = {
configurable: !0,
enumerable: !0,
value: de,
writable: !0
};
Object.defineProperties(console, {
info: p,
log: p,
warn: p,
error: p,
group: p,
groupCollapsed: p,
groupEnd: p
});
}
L++;
}
}
function ze() {
{
if (L--, L === 0) {
var p = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: re({}, p, {
value: H
}),
info: re({}, p, {
value: ve
}),
warn: re({}, p, {
value: Me
}),
error: re({}, p, {
value: we
}),
group: re({}, p, {
value: Mt
}),
groupCollapsed: re({}, p, {
value: j
}),
groupEnd: re({}, p, {
value: q
})
});
}
L < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var ce = y.ReactCurrentDispatcher, Q;
function ut(p, A, k) {
{
if (Q === void 0)
try {
throw Error();
} catch (J) {
var U = J.stack.trim().match(/\n( *(at )?)/);
Q = U && U[1] || "";
}
return `
` + Q + p;
}
}
var Te = !1, $e;
{
var yt = typeof WeakMap == "function" ? WeakMap : Map;
$e = new yt();
}
function Je(p, A) {
if (!p || Te)
return "";
{
var k = $e.get(p);
if (k !== void 0)
return k;
}
var U;
Te = !0;
var J = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var ee;
ee = ce.current, ce.current = null, he();
try {
if (A) {
var K = function() {
throw Error();
};
if (Object.defineProperty(K.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(K, []);
} catch (Fe) {
U = Fe;
}
Reflect.construct(p, [], K);
} else {
try {
K.call();
} catch (Fe) {
U = Fe;
}
p.call(K.prototype);
}
} else {
try {
throw Error();
} catch (Fe) {
U = Fe;
}
p();
}
} catch (Fe) {
if (Fe && U && typeof Fe.stack == "string") {
for (var z = Fe.stack.split(`
`), Oe = U.stack.split(`
`), pe = z.length - 1, me = Oe.length - 1; pe >= 1 && me >= 0 && z[pe] !== Oe[me]; )
me--;
for (; pe >= 1 && me >= 0; pe--, me--)
if (z[pe] !== Oe[me]) {
if (pe !== 1 || me !== 1)
do
if (pe--, me--, me < 0 || z[pe] !== Oe[me]) {
var Qe = `
` + z[pe].replace(" at new ", " at ");
return p.displayName && Qe.includes("<anonymous>") && (Qe = Qe.replace("<anonymous>", p.displayName)), typeof p == "function" && $e.set(p, Qe), Qe;
}
while (pe >= 1 && me >= 0);
break;
}
}
} finally {
Te = !1, ce.current = ee, ze(), Error.prepareStackTrace = J;
}
var On = p ? p.displayName || p.name : "", ln = On ? ut(On) : "";
return typeof p == "function" && $e.set(p, ln), ln;
}
function $t(p, A, k) {
return Je(p, !1);
}
function tr(p) {
var A = p.prototype;
return !!(A && A.isReactComponent);
}
function cn(p, A, k) {
if (p == null)
return "";
if (typeof p == "function")
return Je(p, tr(p));
if (typeof p == "string")
return ut(p);
switch (p) {
case c:
return ut("Suspense");
case u:
return ut("SuspenseList");
}
if (typeof p == "object")
switch (p.$$typeof) {
case l:
return $t(p.render);
case f:
return cn(p.type, A, k);
case h: {
var U = p, J = U._payload, ee = U._init;
try {
return cn(ee(J), A, k);
} catch {
}
}
}
return "";
}
var nr = Object.prototype.hasOwnProperty, Yo = {}, Xo = y.ReactDebugCurrentFrame;
function ii(p) {
if (p) {
var A = p._owner, k = cn(p.type, p._source, A ? A.type : null);
Xo.setExtraStackFrame(k);
} else
Xo.setExtraStackFrame(null);
}
function vp(p, A, k, U, J) {
{
var ee = Function.call.bind(nr);
for (var K in p)
if (ee(p, K)) {
var z = void 0;
try {
if (typeof p[K] != "function") {
var Oe = Error((U || "React class") + ": " + k + " type `" + K + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof p[K] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw Oe.name = "Invariant Violation", Oe;
}
z = p[K](A, K, U, k, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (pe) {
z = pe;
}
z && !(z instanceof Error) && (ii(J), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", U || "React class", k, K, typeof z), ii(null)), z instanceof Error && !(z.message in Yo) && (Yo[z.message] = !0, ii(J), b("Failed %s type: %s", k, z.message), ii(null));
}
}
}
var _p = Array.isArray;
function Ns(p) {
return _p(p);
}
function bp(p) {
{
var A = typeof Symbol == "function" && Symbol.toStringTag, k = A && p[Symbol.toStringTag] || p.constructor.name || "Object";
return k;
}
}
function yp(p) {
try {
return qo(p), !1;
} catch {
return !0;
}
}
function qo(p) {
return "" + p;
}
function Jo(p) {
if (yp(p))
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", bp(p)), qo(p);
}
var Qo = y.ReactCurrentOwner, Ep = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, ec, tc;
function xp(p) {
if (nr.call(p, "ref")) {
var A = Object.getOwnPropertyDescriptor(p, "ref").get;
if (A && A.isReactWarning)
return !1;
}
return p.ref !== void 0;
}
function wp(p) {
if (nr.call(p, "key")) {
var A = Object.getOwnPropertyDescriptor(p, "key").get;
if (A && A.isReactWarning)
return !1;
}
return p.key !== void 0;
}
function Tp(p, A) {
typeof p.ref == "string" && Qo.current;
}
function Sp(p, A) {
{
var k = function() {
ec || (ec = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", A));
};
k.isReactWarning = !0, Object.defineProperty(p, "key", {
get: k,
configurable: !0
});
}
}
function Ap(p, A) {
{
var k = function() {
tc || (tc = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", A));
};
k.isReactWarning = !0, Object.defineProperty(p, "ref", {
get: k,
configurable: !0
});
}
}
var Rp = function(p, A, k, U, J, ee, K) {
var z = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: t,
// Built-in properties that belong on the element
type: p,
key: A,
ref: k,
props: K,
// Record the component responsible for creating this element.
_owner: ee
};
return z._store = {}, Object.defineProperty(z._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(z, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: U
}), Object.defineProperty(z, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: J
}), Object.freeze && (Object.freeze(z.props), Object.freeze(z)), z;
};
function kp(p, A, k, U, J) {
{
var ee, K = {}, z = null, Oe = null;
k !== void 0 && (Jo(k), z = "" + k), wp(A) && (Jo(A.key), z = "" + A.key), xp(A) && (Oe = A.ref, Tp(A, J));
for (ee in A)
nr.call(A, ee) && !Ep.hasOwnProperty(ee) && (K[ee] = A[ee]);
if (p && p.defaultProps) {
var pe = p.defaultProps;
for (ee in pe)
K[ee] === void 0 && (K[ee] = pe[ee]);
}
if (z || Oe) {
var me = typeof p == "function" ? p.displayName || p.name || "Unknown" : p;
z && Sp(K, me), Oe && Ap(K, me);
}
return Rp(p, z, Oe, J, U, Qo.current, K);
}
}
var Cs = y.ReactCurrentOwner, nc = y.ReactDebugCurrentFrame;
function In(p) {
if (p) {
var A = p._owner, k = cn(p.type, p._source, A ? A.type : null);
nc.setExtraStackFrame(k);
} else
nc.setExtraStackFrame(null);
}
var Ls;
Ls = !1;
function Ps(p) {
return typeof p == "object" && p !== null && p.$$typeof === t;
}
function rc() {
{
if (Cs.current) {
var p = oe(Cs.current.type);
if (p)
return `
Check the render method of \`` + p + "`.";
}
return "";
}
}
function Ip(p) {
return "";
}
var ic = {};
function Op(p) {
{
var A = rc();
if (!A) {
var k = typeof p == "string" ? p : p.displayName || p.name;
k && (A = `
Check the top-level render call using <` + k + ">.");
}
return A;
}
}
function sc(p, A) {
{
if (!p._store || p._store.validated || p.key != null)
return;
p._store.validated = !0;
var k = Op(A);
if (ic[k])
return;
ic[k] = !0;
var U = "";
p && p._owner && p._owner !== Cs.current && (U = " It was passed a child from " + oe(p._owner.type) + "."), In(p), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', k, U), In(null);
}
}
function ac(p, A) {
{
if (typeof p != "object")
return;
if (Ns(p))
for (var k = 0; k < p.length; k++) {
var U = p[k];
Ps(U) && sc(U, A);
}
else if (Ps(p))
p._store && (p._store.validated = !0);
else if (p) {
var J = x(p);
if (typeof J == "function" && J !== p.entries)
for (var ee = J.call(p), K; !(K = ee.next()).done; )
Ps(K.value) && sc(K.value, A);
}
}
}
function Np(p) {
{
var A = p.type;
if (A == null || typeof A == "string")
return;
var k;
if (typeof A == "function")
k = A.propTypes;
else if (typeof A == "object" && (A.$$typeof === l || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
A.$$typeof === f))
k = A.propTypes;
else
return;
if (k) {
var U = oe(A);
vp(k, p.props, "prop", U, p);
} else if (A.PropTypes !== void 0 && !Ls) {
Ls = !0;
var J = oe(A);
b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", J || "Unknown");
}
typeof A.getDefaultProps == "function" && !A.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Cp(p) {
{
for (var A = Object.keys(p.props), k = 0; k < A.length; k++) {
var U = A[k];
if (U !== "children" && U !== "key") {
In(p), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", U), In(null);
break;
}
}
p.ref !== null && (In(p), b("Invalid attribute `ref` supplied to `React.Fragment`."), In(null));
}
}
var oc = {};
function cc(p, A, k, U, J, ee) {
{
var K = R(p);
if (!K) {
var z = "";
(p === void 0 || typeof p == "object" && p !== null && Object.keys(p).length === 0) && (z += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var Oe = Ip();
Oe ? z += Oe : z += rc();
var pe;
p === null ? pe = "null" : Ns(p) ? pe = "array" : p !== void 0 && p.$$typeof === t ? (pe = "<" + (oe(p.type) || "Unknown") + " />", z = " Did you accidentally export a JSX literal instead of a component?") : pe = typeof p, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", pe, z);
}
var me = kp(p, A, k, J, ee);
if (me == null)
return me;
if (K) {
var Qe = A.children;
if (Qe !== void 0)
if (U)
if (Ns(Qe)) {
for (var On = 0; On < Qe.length; On++)
ac(Qe[On], p);
Object.freeze && Object.freeze(Qe);
} else
b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
ac(Qe, p);
}
if (nr.call(A, "key")) {
var ln = oe(p), Fe = Object.keys(A).filter(function(Dp) {
return Dp !== "key";
}), Ms = Fe.length > 0 ? "{key: someKey, " + Fe.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!oc[ln + Ms]) {
var Fp = Fe.length > 0 ? "{" + Fe.join(": ..., ") + ": ...}" : "{}";
b(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, Ms, ln, Fp, ln), oc[ln + Ms] = !0;
}
}
return p === r ? Cp(me) : Np(me), me;
}
}
function Lp(p, A, k) {
return cc(p, A, k, !0);
}
function Pp(p, A, k) {
return cc(p, A, k, !1);
}
var Mp = Pp, $p = Lp;
ir.Fragment = r, ir.jsx = Mp, ir.jsxs = $p;
}()), ir;
}
var dc;
function Yp() {
return dc || (dc = 1, process.env.NODE_ENV === "production" ? si.exports = Vp() : si.exports = Zp()), si.exports;
}
var _ = Yp();
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
const Xp = 4, hc = 0, pc = 1, qp = 2;
function Zn(e) {
let t = e.length;
for (; --t >= 0; )
e[t] = 0;
}
const Jp = 0, Ou = 1, Qp = 2, em = 3, tm = 258, qa = 29, Ur = 256, Sr = Ur + 1 + qa, Mn = 30, Ja = 19, Nu = 2 * Sr + 1, dn = 15, $s = 16, nm = 7, Qa = 256, Cu = 16, Lu = 17, Pu = 18, pa = (
/* extra bits for each length code */
new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0])
), xi = (
/* extra bits for each distance code */
new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13])
), rm = (
/* extra bits for each bit length code */
new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7])
), Mu = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), im = 512, Dt = new Array((Sr + 2) * 2);
Zn(Dt);
const _r = new Array(Mn * 2);
Zn(_r);
const Ar = new Array(im);
Zn(Ar);
const Rr = new Array(tm - em + 1);
Zn(Rr);
const eo = new Array(qa);
Zn(eo);
const Ci = new Array(Mn);
Zn(Ci);
function Fs(e, t, n, r, i) {
this.static_tree = e, this.extra_bits = t, this.extra_base = n, this.elems = r, this.max_length = i, this.has_stree = e && e.length;
}
let $u, Fu, Du;
function Ds(e, t) {
this.dyn_tree = e, this.max_code = 0, this.stat_desc = t;
}
const Uu = (e) => e < 256 ? Ar[e] : Ar[256 + (e >>> 7)], kr = (e, t) => {
e.pending_buf[e.pending++] = t & 255, e.pending_buf[e.pending++] = t >>> 8 & 255;
}, De = (e, t, n) => {
e.bi_valid > $s - n ? (e.bi_buf |= t << e.bi_valid & 65535, kr(e, e.bi_buf), e.bi_buf = t >> $s - e.bi_valid, e.bi_valid += n - $s) : (e.bi_buf |= t << e.bi_valid & 65535, e.bi_valid += n);
}, wt = (e, t, n) => {
De(
e,
n[t * 2],
n[t * 2 + 1]
/*.Len*/
);
}, ju = (e, t) => {
let n = 0;
do
n |= e & 1, e >>>= 1, n <<= 1;
while (--t > 0);
return n >>> 1;
}, sm = (e) => {
e.bi_valid === 16 ? (kr(e, e.bi_buf), e.bi_buf = 0, e.bi_valid = 0) : e.bi_valid >= 8 && (e.pending_buf[e.pending++] = e.bi_buf & 255, e.bi_buf >>= 8, e.bi_valid -= 8);
}, am = (e, t) => {
const n = t.dyn_tree, r = t.max_code, i = t.stat_desc.static_tree, s = t.stat_desc.has_stree, a = t.stat_desc.extra_bits, o = t.stat_desc.extra_base, l = t.stat_desc.max_length;
let c, u, f, h, d, m, g = 0;
for (h = 0; h <= dn; h++)
e.bl_count[h] = 0;
for (n[e.heap[e.heap_max] * 2 + 1] = 0, c = e.heap_max + 1; c < Nu; c++)
u = e.heap[c], h = n[n[u * 2 + 1] * 2 + 1] + 1, h > l && (h = l, g++), n[u * 2 + 1] = h, !(u > r) && (e.bl_count[h]++, d = 0, u >= o && (d = a[u - o]), m = n[u * 2], e.opt_len += m * (h + d), s && (e.static_len += m * (i[u * 2 + 1] + d)));
if (g !== 0) {
do {
for (h = l - 1; e.bl_count[h] === 0; )
h--;
e.bl_count[h]--, e.bl_count[h + 1] += 2, e.bl_count[l]--, g -= 2;
} while (g > 0);
for (h = l; h !== 0; h--)
for (u = e.bl_count[h]; u !== 0; )
f = e.heap[--c], !(f > r) && (n[f * 2 + 1] !== h && (e.opt_len += (h - n[f * 2 + 1]) * n[f * 2], n[f * 2 + 1] = h), u--);
}
}, Bu = (e, t, n) => {
const r = new Array(dn + 1);
let i = 0, s, a;
for (s = 1; s <= dn; s++)
i = i + n[s - 1] << 1, r[s] = i;
for (a = 0; a <= t; a++) {
let o = e[a * 2 + 1];
o !== 0 && (e[a * 2] = ju(r[o]++, o));
}
}, om = () => {
let e, t, n, r, i;
const s = new Array(dn + 1);
for (n = 0, r = 0; r < qa - 1; r++)
for (eo[r] = n, e = 0; e < 1 << pa[r]; e++)
Rr[n++] = r;
for (Rr[n - 1] = r, i = 0, r = 0; r < 16; r++)
for (Ci[r] = i, e = 0; e < 1 << xi[r]; e++)
Ar[i++] = r;
for (i >>= 7; r < Mn; r++)
for (Ci[r] = i << 7, e = 0; e < 1 << xi[r] - 7; e++)
Ar[256 + i++] = r;
for (t = 0; t <= dn; t++)
s[t] = 0;
for (e = 0; e <= 143; )
Dt[e * 2 + 1] = 8, e++, s[8]++;
for (; e <= 255; )
Dt[e * 2 + 1] = 9, e++, s[9]++;
for (; e <= 279; )
Dt[e * 2 + 1] = 7, e++, s[7]++;
for (; e <= 287; )
Dt[e * 2 + 1] = 8, e++, s[8]++;
for (Bu(Dt, Sr + 1, s), e = 0; e < Mn; e++)
_r[e * 2 + 1] = 5, _r[e * 2] = ju(e, 5);
$u = new Fs(Dt, pa, Ur + 1, Sr, dn), Fu = new Fs(_r, xi, 0, Mn, dn), Du = new Fs(new Array(0), rm, 0, Ja, nm);
}, zu = (e) => {
let t;
for (t = 0; t < Sr; t++)
e.dyn_ltree[t * 2] = 0;
for (t = 0; t < Mn; t++)
e.dyn_dtree[t * 2] = 0;
for (t = 0; t < Ja; t++)
e.bl_tree[t * 2] = 0;
e.dyn_ltree[Qa * 2] = 1, e.opt_len = e.static_len = 0, e.sym_next = e.matches = 0;
}, Hu = (e) => {
e.bi_valid > 8 ? kr(e, e.bi_buf) : e.bi_valid > 0 && (e.pending_buf[e.pending++] = e.bi_buf), e.bi_buf = 0, e.bi_valid = 0;
}, mc = (e, t, n, r) => {
const i = t * 2, s = n * 2;
return e[i] < e[s] || e[i] === e[s] && r[t] <= r[n];
}, Us = (e, t, n) => {
const r = e.heap[n];
let i = n << 1;
for (; i <= e.heap_len && (i < e.heap_len && mc(t, e.heap[i + 1], e.heap[i], e.depth) && i++, !mc(t, r, e.heap[i], e.depth)); )
e.heap[n] = e.heap[i], n = i, i <<= 1;
e.heap[n] = r;
}, gc = (e, t, n) => {
let r, i, s = 0, a, o;
if (e.sym_next !== 0)
do
r = e.pending_buf[e.sym_buf + s++] & 255, r += (e.pending_buf[e.sym_buf + s++] & 255) << 8, i = e.pending_buf[e.sym_buf + s++], r === 0 ? wt(e, i, t) : (a = Rr[i], wt(e, a + Ur + 1, t), o = pa[a], o !== 0 && (i -= eo[a], De(e, i, o)), r--, a = Uu(r), wt(e, a, n), o = xi[a], o !== 0 && (r -= Ci[a], De(e, r, o)));
while (s < e.sym_next);
wt(e, Qa, t);
}, ma = (e, t) => {
const n = t.dyn_tree, r = t.stat_desc.static_tree, i = t.stat_desc.has_stree, s = t.stat_desc.elems;
let a, o, l = -1, c;
for (e.heap_len = 0, e.heap_max = Nu, a = 0; a < s; a++)
n[a * 2] !== 0 ? (e.heap[++e.heap_len] = l = a, e.depth[a] = 0) : n[a * 2 + 1] = 0;
for (; e.heap_len < 2; )
c = e.heap[++e.heap_len] = l < 2 ? ++l : 0, n[c * 2] = 1, e.depth[c] = 0, e.opt_len--, i && (e.static_len -= r[c * 2 + 1]);
for (t.max_code = l, a = e.heap_len >> 1; a >= 1; a--)
Us(e, n, a);
c = s;
do
a = e.heap[
1
/*SMALLEST*/
], e.heap[
1
/*SMALLEST*/
] = e.heap[e.heap_len--], Us(
e,
n,
1
/*SMALLEST*/
), o = e.heap[
1
/*SMALLEST*/
], e.heap[--e.heap_max] = a, e.heap[--e.heap_max] = o, n[c * 2] = n[a * 2] + n[o * 2], e.depth[c] = (e.depth[a] >= e.depth[o] ? e.depth[a] : e.depth[o]) + 1, n[a * 2 + 1] = n[o * 2 + 1] = c, e.heap[
1
/*SMALLEST*/
] = c++, Us(
e,
n,
1
/*SMALLEST*/
);
while (e.heap_len >= 2);
e.heap[--e.heap_max] = e.heap[
1
/*SMALLEST*/
], am(e, t), Bu(n, l, e.bl_count);
}, vc = (e, t, n) => {
let r, i = -1, s, a = t[0 * 2 + 1], o = 0, l = 7, c = 4;
for (a === 0 && (l = 138, c = 3), t[(n + 1) * 2 + 1] = 65535, r = 0; r <= n; r++)
s = a, a = t[(r + 1) * 2 + 1], !(++o < l && s === a) && (o < c ? e.bl_tree[s * 2] += o : s !== 0 ? (s !== i && e.bl_tree[s * 2]++, e.bl_tree[Cu * 2]++) : o <= 10 ? e.bl_tree[Lu * 2]++ : e.bl_tree[Pu * 2]++, o = 0, i = s, a === 0 ? (l = 138, c = 3) : s === a ? (l = 6, c = 3) : (l = 7, c = 4));
}, _c = (e, t, n) => {
let r, i = -1, s, a = t[0 * 2 + 1], o = 0, l = 7, c = 4;
for (a === 0 && (l = 138, c = 3), r = 0; r <= n; r++)
if (s = a, a = t[(r + 1) * 2 + 1], !(++o < l && s === a)) {
if (o < c)
do
wt(e, s, e.bl_tree);
while (--o !== 0);
else s !== 0 ? (s !== i && (wt(e, s, e.bl_tree), o--), wt(e, Cu, e.bl_tree), De(e, o - 3, 2)) : o <= 10 ? (wt(e, Lu, e.bl_tree), De(e, o - 3, 3)) : (wt(e, Pu, e.bl_tree), De(e, o - 11, 7));
o = 0, i = s, a === 0 ? (l = 138, c = 3) : s === a ? (l = 6, c = 3) : (l = 7, c = 4);
}
}, cm = (e) => {
let t;
for (vc(e, e.dyn_ltree, e.l_desc.max_code), vc(e, e.dyn_dtree, e.d_desc.max_code), ma(e, e.bl_desc), t = Ja - 1; t >= 3 && e.bl_tree[Mu[t] * 2 + 1] === 0; t--)
;
return e.opt_len += 3 * (t + 1) + 5 + 5 + 4, t;
}, lm = (e, t, n, r) => {
let i;
for (De(e, t - 257, 5), De(e, n - 1, 5), De(e, r - 4, 4), i = 0; i < r; i++)
De(e, e.bl_tree[Mu[i] * 2 + 1], 3);
_c(e, e.dyn_ltree, t - 1), _c(e, e.dyn_dtree, n - 1);
}, um = (e) => {
let t = 4093624447, n;
for (n = 0; n <= 31; n++, t >>>= 1)
if (t & 1 && e.dyn_ltree[n * 2] !== 0)
return hc;
if (e.dyn_ltree[9 * 2] !== 0 || e.dyn_ltree[10 * 2] !== 0 || e.dyn_ltree[13 * 2] !== 0)
return pc;
for (n = 32; n < Ur; n++)
if (e.dyn_ltree[n * 2] !== 0)
return pc;
return hc;
};
let bc = !1;
const fm = (e) => {
bc || (om(), bc = !0), e.l_desc = new Ds(e.dyn_ltree, $u), e.d_desc = new Ds(e.dyn_dtree, Fu), e.bl_desc = new Ds(e.bl_tree, Du), e.bi_buf = 0, e.bi_valid = 0, zu(e);
}, Gu = (e, t, n, r) => {
De(e, (Jp << 1) + (r ? 1 : 0), 3), Hu(e), kr(e, n), kr(e, ~n), n && e.pending_buf.set(e.window.subarray(t, t + n), e.pending), e.pending += n;
}, dm = (e) => {
De(e, Ou << 1, 3), wt(e, Qa, Dt), sm(e);
}, hm = (e, t, n, r) => {
let i, s, a = 0;
e.level > 0 ? (e.strm.data_type === qp && (e.strm.data_type = um(e)), ma(e, e.l_desc), ma(e, e.d_desc), a = cm(e), i = e.opt_len + 3 + 7 >>> 3, s = e.static_len + 3 + 7 >>> 3, s <= i && (i = s)) : i = s = n + 5, n + 4 <= i && t !== -1 ? Gu(e, t, n, r) : e.strategy === Xp || s === i ? (De(e, (Ou << 1) + (r ? 1 : 0), 3), gc(e, Dt, _r)) : (De(e, (Qp << 1) + (r ? 1 : 0), 3), lm(e, e.l_desc.max_code + 1, e.d_desc.max_code + 1, a + 1), gc(e, e.dyn_ltree, e.dyn_dtree)), zu(e), r && Hu(e);
}, pm = (e, t, n) => (e.pending_buf[e.sym_buf + e.sym_next++] = t, e.pending_buf[e.sym_buf + e.sym_next++] = t >> 8, e.pending_buf[e.sym_buf + e.sym_next++] = n, t === 0 ? e.dyn_ltree[n * 2]++ : (e.matches++, t--, e.dyn_ltree[(Rr[n] + Ur + 1) * 2]++, e.dyn_dtree[Uu(t) * 2]++), e.sym_next === e.sym_end);
var mm = fm, gm = Gu, vm = hm, _m = pm, bm = dm, ym = {
_tr_init: mm,
_tr_stored_block: gm,
_tr_flush_block: vm,
_tr_tally: _m,
_tr_align: bm
};
const Em = (e, t, n, r) => {
let i = e & 65535 | 0, s = e >>> 16 & 65535 | 0, a = 0;
for (; n !== 0; ) {
a = n > 2e3 ? 2e3 : n, n -= a;
do
i = i + t[r++] | 0, s = s + i | 0;
while (--a);
i %= 65521, s %= 65521;
}
return i | s << 16 | 0;
};
var Ir = Em;
const xm = () => {
let e, t = [];
for (var n = 0; n < 256; n++) {
e = n;
for (var r = 0; r < 8; r++)
e = e & 1 ? 3988292384 ^ e >>> 1 : e >>> 1;
t[n] = e;
}
return t;
}, wm = new Uint32Array(xm()), Tm = (e, t, n, r) => {
const i = wm, s = r + n;
e ^= -1;
for (let a = r; a < s; a++)
e = e >>> 8 ^ i[(e ^ t[a]) & 255];
return e ^ -1;
};
var xe = Tm, _n = {
2: "need dictionary",
/* Z_NEED_DICT 2 */
1: "stream end",
/* Z_STREAM_END 1 */
0: "",
/* Z_OK 0 */
"-1": "file error",
/* Z_ERRNO (-1) */
"-2": "stream error",
/* Z_STREAM_ERROR (-2) */
"-3": "data error",
/* Z_DATA_ERROR (-3) */
"-4": "insufficient memory",
/* Z_MEM_ERROR (-4) */
"-5": "buffer error",
/* Z_BUF_ERROR (-5) */
"-6": "incompatible version"
/* Z_VERSION_ERROR (-6) */
}, jr = {
/* Allowed flush values; see deflate() and inflate() below for details */
Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3,
Z_FINISH: 4,
Z_BLOCK: 5,
Z_TREES: 6,
/* Return codes for the compression/decompression functions. Negative values
* are errors, positive values are used for special but normal events.
*/
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_MEM_ERROR: -4,
Z_BUF_ERROR: -5,
//Z_VERSION_ERROR: -6,
/* compression levels */
Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2,
Z_RLE: 3,
Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
/* Possible values of the data_type field (though see inflate()) */
Z_BINARY: 0,
Z_TEXT: 1,
//Z_ASCII: 1, // = Z_TEXT (deprecated)
Z_UNKNOWN: 2,
/* The deflate compression method */
Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type
};
const { _tr_init: Sm, _tr_stored_block: ga, _tr_flush_block: Am, _tr_tally: Xt, _tr_align: Rm } = ym, {
Z_NO_FLUSH: qt,
Z_PARTIAL_FLUSH: km,
Z_FULL_FLUSH: Im,
Z_FINISH: rt,
Z_BLOCK: yc,
Z_OK: Ae,
Z_STREAM_END: Ec,
Z_STREAM_ERROR: Tt,
Z_DATA_ERROR: Om,
Z_BUF_ERROR: js,
Z_DEFAULT_COMPRESSION: Nm,
Z_FILTERED: Cm,
Z_HUFFMAN_ONLY: ai,
Z_RLE: Lm,
Z_FIXED: Pm,
Z_DEFAULT_STRATEGY: Mm,
Z_UNKNOWN: $m,
Z_DEFLATED: ns
} = jr, Fm = 9, Dm = 15, Um = 8, jm = 29, Bm = 256, va = Bm + 1 + jm, zm = 30, Hm = 19, Gm = 2 * va + 1, Wm = 15, G = 3, Yt = 258, St = Yt + G + 1, Km = 32, jn = 42, to = 57, _a = 69, ba = 73, ya = 91, Ea = 103, hn = 113, lr = 666, Ne = 1, Yn = 2, bn = 3, Xn = 4, Vm = 3, pn = (e, t) => (e.msg = _n[t], t), xc = (e) => e * 2 - (e > 4 ? 9 : 0), Zt = (e) => {
let t = e.length;
for (; --t >= 0; )
e[t] = 0;
}, Zm = (e) => {
let t, n, r, i = e.w_size;
t = e.hash_size, r = t;
do
n = e.head[--r], e.head[r] = n >= i ? n - i : 0;
while (--t);
t = i, r = t;
do
n = e.prev[--r], e.prev[r] = n >= i ? n - i : 0;
while (--t);
};
let Ym = (e, t, n) => (t << e.hash_shift ^ n) & e.hash_mask, Jt = Ym;
const He = (e) => {
const t = e.state;
let n = t.pending;
n > e.avail_out && (n = e.avail_out), n !== 0 && (e.output.set(t.pending_buf.subarray(t.pending_out, t.pending_out + n), e.next_out), e.next_out += n, t.pending_out += n, e.total_out += n, e.avail_out -= n, t.pending -= n, t.pending === 0 && (t.pending_out = 0));
}, We = (e, t) => {
Am(e, e.block_start >= 0 ? e.block_start : -1, e.strstart - e.block_start, t), e.block_start = e.strstart, He(e.strm);
}, Y = (e, t) => {
e.pending_buf[e.pending++] = t;
}, sr = (e, t) => {
e.pending_buf[e.pending++] = t >>> 8 & 255, e.pending_buf[e.pending++] = t & 255;
}, xa = (e, t, n, r) => {
let i = e.avail_in;
return i > r && (i = r), i === 0 ? 0 : (e.avail_in -= i, t.set(e.input.subarray(e.next_in, e.next_in + i), n), e.state.wrap === 1 ? e.adler = Ir(e.adler, t, i, n) : e.state.wrap === 2 && (e.adler = xe(e.adler, t, i, n)), e.next_in += i, e.total_in += i, i);
}, Wu = (e, t) => {
let n = e.max_chain_length, r = e.strstart, i, s, a = e.prev_length, o = e.nice_match;
const l = e.strstart > e.w_size - St ? e.strstart - (e.w_size - St) : 0, c = e.window, u = e.w_mask, f = e.prev, h = e.strstart + Yt;
let d = c[r + a - 1], m = c[r + a];
e.prev_length >= e.good_match && (n >>= 2), o > e.lookahead && (o = e.lookahead);
do
if (i = t, !(c[i + a] !== m || c[i + a - 1] !== d || c[i] !== c[r] || c[++i] !== c[r + 1])) {
r += 2, i++;
do
;
while (c[++r] === c[++i] && c[++r] === c[++i] && c[++r] === c[++i] && c[++r] === c[++i] && c[++r] === c[++i] && c[++r] === c[++i] && c[++r] === c[++i] && c[++r] === c[++i] && r < h);
if (s = Yt - (h - r), r = h - Yt, s > a) {
if (e.match_start = t, a = s, s >= o)
break;
d = c[r + a - 1], m = c[r + a];
}
}
while ((t = f[t & u]) > l && --n !== 0);
return a <= e.lookahead ? a : e.lookahead;
}, Bn = (e) => {
const t = e.w_size;
let n, r, i;
do {
if (r = e.window_size - e.lookahead - e.strstart, e.strstart >= t + (t - St) && (e.window.set(e.window.subarray(t, t + t - r), 0), e.match_start -= t, e.strstart -= t, e.block_start -= t, e.insert > e.strstart && (e.insert = e.strstart), Zm(e), r += t), e.strm.avail_in === 0)
break;
if (n = xa(e.strm, e.window, e.strstart + e.lookahead, r), e.lookahead += n, e.lookahead + e.insert >= G)
for (i = e.strstart - e.insert, e.ins_h = e.window[i], e.ins_h = Jt(e, e.ins_h, e.window[i + 1]); e.insert && (e.ins_h = Jt(e, e.ins_h, e.window[i + G - 1]), e.prev[i & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = i, i++, e.insert--, !(e.lookahead + e.insert < G)); )
;
} while (e.lookahead < St && e.strm.avail_in !== 0);
}, Ku = (e, t) => {
let n = e.pending_buf_size - 5 > e.w_size ? e.w_size : e.pending_buf_size - 5, r, i, s, a = 0, o = e.strm.avail_in;
do {
if (r = 65535, s = e.bi_valid + 42 >> 3, e.strm.avail_out < s || (s = e.strm.avail_out - s, i = e.strstart - e.block_start, r > i + e.strm.avail_in && (r = i + e.strm.avail_in), r > s && (r = s), r < n && (r === 0 && t !== rt || t === qt || r !== i + e.strm.avail_in)))
break;
a = t === rt && r === i + e.strm.avail_in ? 1 : 0, ga(e, 0, 0, a), e.pending_buf[e.pending - 4] = r, e.pending_buf[e.pending - 3] = r >> 8, e.pending_buf[e.pending - 2] = ~r, e.pending_buf[e.pending - 1] = ~r >> 8, He(e.strm), i && (i > r && (i = r), e.strm.output.set(e.window.subarray(e.block_start, e.block_start + i), e.strm.next_out), e.strm.next_out += i, e.strm.avail_out -= i, e.strm.total_out += i, e.block_start += i, r -= i), r && (xa(e.strm, e.strm.output, e.strm.next_out, r), e.strm.next_out += r, e.strm.avail_out -= r, e.strm.total_out += r);
} while (a === 0);
return o -= e.strm.avail_in, o && (o >= e.w_size ? (e.matches = 2, e.window.set(e.strm.input.subarray(e.strm.next_in - e.w_size, e.strm.next_in), 0), e.strstart = e.w_size, e.insert = e.strstart) : (e.window_size - e.strstart <= o && (e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, e.insert > e.strstart && (e.insert = e.strstart)), e.window.set(e.strm.input.subarray(e.strm.next_in - o, e.strm.next_in), e.strstart), e.strstart += o, e.insert += o > e.w_size - e.insert ? e.w_size - e.insert : o), e.block_start = e.strstart), e.high_water < e.strstart && (e.high_water = e.strstart), a ? Xn : t !== qt && t !== rt && e.strm.avail_in === 0 && e.strstart === e.block_start ? Yn : (s = e.window_size - e.strstart, e.strm.avail_in > s && e.block_start >= e.w_size && (e.block_start -= e.w_size, e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, s += e.w_size, e.insert > e.strstart && (e.insert = e.strstart)), s > e.strm.avail_in && (s = e.strm.avail_in), s && (xa(e.strm, e.window, e.strstart, s), e.strstart += s, e.insert += s > e.w_size - e.insert ? e.w_size - e.insert : s), e.high_water < e.strstart && (e.high_water = e.strstart), s = e.bi_valid + 42 >> 3, s = e.pending_buf_size - s > 65535 ? 65535 : e.pending_buf_size - s, n = s > e.w_size ? e.w_size : s, i = e.strstart - e.block_start, (i >= n || (i || t === rt) && t !== qt && e.strm.avail_in === 0 && i <= s) && (r = i > s ? s : i, a = t === rt && e.strm.avail_in === 0 && r === i ? 1 : 0, ga(e, e.block_start, r, a), e.block_start += r, He(e.strm)), a ? bn : Ne);
}, Bs = (e, t) => {
let n, r;
for (; ; ) {
if (e.lookahead < St) {
if (Bn(e), e.lookahead < St && t === qt)
return Ne;
if (e.lookahead === 0)
break;
}
if (n = 0, e.lookahead >= G && (e.ins_h = Jt(e, e.ins_h, e.window[e.strstart + G - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), n !== 0 && e.strstart - n <= e.w_size - St && (e.match_length = Wu(e, n)), e.match_length >= G)
if (r = Xt(e, e.strstart - e.match_start, e.match_length - G), e.lookahead -= e.match_length, e.match_length <= e.max_lazy_match && e.lookahead >= G) {
e.match_length--;
do
e.strstart++, e.ins_h = Jt(e, e.ins_h, e.window[e.strstart + G - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart;
while (--e.match_length !== 0);
e.strstart++;
} else
e.strstart += e.match_length, e.match_length = 0, e.ins_h = e.window[e.strstart], e.ins_h = Jt(e, e.ins_h, e.window[e.strstart + 1]);
else
r = Xt(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++;
if (r && (We(e, !1), e.strm.avail_out === 0))
return Ne;
}
return e.insert = e.strstart < G - 1 ? e.strstart : G - 1, t === rt ? (We(e, !0), e.strm.avail_out === 0 ? bn : Xn) : e.sym_next && (We(e, !1), e.strm.avail_out === 0) ? Ne : Yn;
}, Nn = (e, t) => {
let n, r, i;
for (; ; ) {
if (e.lookahead < St) {
if (Bn(e), e.lookahead < St && t === qt)
return Ne;
if (e.lookahead === 0)
break;
}
if (n = 0, e.lookahead >= G && (e.ins_h = Jt(e, e.ins_h, e.window[e.strstart + G - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), e.prev_length = e.match_length, e.prev_match = e.match_start, e.match_length = G - 1, n !== 0 && e.prev_length < e.max_lazy_match && e.strstart - n <= e.w_size - St && (e.match_length = Wu(e, n), e.match_length <= 5 && (e.strategy === Cm || e.match_length === G && e.strstart - e.match_start > 4096) && (e.match_length = G - 1)), e.prev_length >= G && e.match_length <= e.prev_length) {
i = e.strstart + e.lookahead - G, r = Xt(e, e.strstart - 1 - e.prev_match, e.prev_length - G), e.lookahead -= e.prev_length - 1, e.prev_length -= 2;
do
++e.strstart <= i && (e.ins_h = Jt(e, e.ins_h, e.window[e.strstart + G - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart);
while (--e.prev_length !== 0);
if (e.match_available = 0, e.match_length = G - 1, e.strstart++, r && (We(e, !1), e.strm.avail_out === 0))
return Ne;
} else if (e.match_available) {
if (r = Xt(e, 0, e.window[e.strstart - 1]), r && We(e, !1), e.strstart++, e.lookahead--, e.strm.avail_out === 0)
return Ne;
} else
e.match_available = 1, e.strstart++, e.lookahead--;
}
return e.match_available && (r = Xt(e, 0, e.window[e.strstart - 1]), e.match_available = 0), e.insert = e.strstart < G - 1 ? e.strstart : G - 1, t === rt ? (We(e, !0), e.strm.avail_out === 0 ? bn : Xn) : e.sym_next && (We(e, !1), e.strm.avail_out === 0) ? Ne : Yn;
}, Xm = (e, t) => {
let n, r, i, s;
const a = e.window;
for (; ; ) {
if (e.lookahead <= Yt) {
if (Bn(e), e.lookahead <= Yt && t === qt)
return Ne;
if (e.lookahead === 0)
break;
}
if (e.match_length = 0, e.lookahead >= G && e.strstart > 0 && (i = e.strstart - 1, r = a[i], r === a[++i] && r === a[++i] && r === a[++i])) {
s = e.strstart + Yt;
do
;
while (r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && r === a[++i] && i < s);
e.match_length = Yt - (s - i), e.match_length > e.lookahead && (e.match_length = e.lookahead);
}
if (e.match_length >= G ? (n = Xt(e, 1, e.match_length - G), e.lookahead -= e.match_length, e.strstart += e.match_length, e.match_length = 0) : (n = Xt(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++), n && (We(e, !1), e.strm.avail_out === 0))
return Ne;
}
return e.insert = 0, t === rt ? (We(e, !0), e.strm.avail_out === 0 ? bn : Xn) : e.sym_next && (We(e, !1), e.strm.avail_out === 0) ? Ne : Yn;
}, qm = (e, t) => {
let n;
for (; ; ) {
if (e.lookahead === 0 && (Bn(e), e.lookahead === 0)) {
if (t === qt)
return Ne;
break;
}
if (e.match_length = 0, n = Xt(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++, n && (We(e, !1), e.strm.avail_out === 0))
return Ne;
}
return e.insert = 0, t === rt ? (We(e, !0), e.strm.avail_out === 0 ? bn : Xn) : e.sym_next && (We(e, !1), e.strm.avail_out === 0) ? Ne : Yn;
};
function Et(e, t, n, r, i) {
this.good_length = e, this.max_lazy = t, this.nice_length = n, this.max_chain = r, this.func = i;
}
const ur = [
/* good lazy nice chain */
new Et(0, 0, 0, 0, Ku),
/* 0 store only */
new Et(4, 4, 8, 4, Bs),
/* 1 max speed, no lazy matches */
new Et(4, 5, 16, 8, Bs),
/* 2 */
new Et(4, 6, 32, 32, Bs),
/* 3 */
new Et(4, 4, 16, 16, Nn),
/* 4 lazy matches */
new Et(8, 16, 32, 32, Nn),
/* 5 */
new Et(8, 16, 128, 128, Nn),
/* 6 */
new Et(8, 32, 128, 256, Nn),
/* 7 */
new Et(32, 128, 258, 1024, Nn),
/* 8 */
new Et(32, 258, 258, 4096, Nn)
/* 9 max compression */
], Jm = (e) => {
e.window_size = 2 * e.w_size, Zt(e.head), e.max_lazy_match = ur[e.level].max_lazy, e.good_match = ur[e.level].good_length, e.nice_match = ur[e.level].nice_length, e.max_chain_length = ur[e.level].max_chain, e.strstart = 0, e.block_start = 0, e.lookahead = 0, e.insert = 0, e.match_length = e.prev_length = G - 1, e.match_available = 0, e.ins_h = 0;
};
function Qm() {
this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = ns, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(Gm * 2), this.dyn_dtree = new Uint16Array((2 * zm + 1) * 2), this.bl_tree = new Uint16Array((2 * Hm + 1) * 2), Zt(this.dyn_ltree), Zt(this.dyn_dtree), Zt(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(Wm + 1), this.heap = new Uint16Array(2 * va + 1), Zt(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(2 * va + 1), Zt(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
}
const Br = (e) => {
if (!e)
return 1;
const t = e.state;
return !t || t.strm !== e || t.status !== jn && //#ifdef GZIP
t.status !== to && //#endif
t.status !== _a && t.status !== ba && t.status !== ya && t.status !== Ea && t.status !== hn && t.status !== lr ? 1 : 0;
}, Vu = (e) => {
if (Br(e))
return pn(e, Tt);
e.total_in = e.total_out = 0, e.data_type = $m;
const t = e.state;
return t.pending = 0, t.pending_out = 0, t.wrap < 0 && (t.wrap = -t.wrap), t.status = //#ifdef GZIP
t.wrap === 2 ? to : (
//#endif
t.wrap ? jn : hn
), e.adler = t.wrap === 2 ? 0 : 1, t.last_flush = -2, Sm(t), Ae;
}, Zu = (e) => {
const t = Vu(e);
return t === Ae && Jm(e.state), t;
}, eg = (e, t) => Br(e) || e.state.wrap !== 2 ? Tt : (e.state.gzhead = t, Ae), Yu = (e, t, n, r, i, s) => {
if (!e)
return Tt;
let a = 1;
if (t === Nm && (t = 6), r < 0 ? (a = 0, r = -r) : r > 15 && (a = 2, r -= 16), i < 1 || i > Fm || n !== ns || r < 8 || r > 15 || t < 0 || t > 9 || s < 0 || s > Pm || r === 8 && a !== 1)
return pn(e, Tt);
r === 8 && (r = 9);
const o = new Qm();
return e.state = o, o.strm = e, o.status = jn, o.wrap = a, o.gzhead = null, o.w_bits = r, o.w_size = 1 << o.w_bits, o.w_mask = o.w_size - 1, o.hash_bits = i + 7, o.hash_size = 1 << o.hash_bits, o.hash_mask = o.hash_size - 1, o.hash_shift = ~~((o.hash_bits + G - 1) / G), o.window = new Uint8Array(o.w_size * 2), o.head = new Uint16Array(o.hash_size), o.prev = new Uint16Array(o.w_size), o.lit_bufsize = 1 << i + 6, o.pending_buf_size = o.lit_bufsize * 4, o.pending_buf = new Uint8Array(o.pending_buf_size), o.sym_buf = o.lit_bufsize, o.sym_end = (o.lit_bufsize - 1) * 3, o.level = t, o.strategy = s, o.method = n, Zu(e);
}, tg = (e, t) => Yu(e, t, ns, Dm, Um, Mm), ng = (e, t) => {
if (Br(e) || t > yc || t < 0)
return e ? pn(e, Tt) : Tt;
const n = e.state;
if (!e.output || e.avail_in !== 0 && !e.input || n.status === lr && t !== rt)
return pn(e, e.avail_out === 0 ? js : Tt);
const r = n.last_flush;
if (n.last_