在浏览器完成DLsite Play漫画的下载、拼图或解密和保存
// ==UserScript== // @name DLsite Play Downloader // @namespace https://github.com/cpuopt/DLsite-Play-Downloader // @version 2.0.0 // @author cpufan // @description 在浏览器完成DLsite Play漫画的下载、拼图或解密和保存 // @license MIT // @icon https://www.google.com/s2/favicons?sz=64&domain=dlsite.com // @supportURL https://github.com/cpuopt/DLsite-Play-Downloader/issues // @match https://play.dlsite.com/* // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js // @grant GM_addStyle // @grant unsafeWindow // @run-at document-start // ==/UserScript== (function (vue) { 'use strict'; const d=new Set;const importCSS = async e=>{d.has(e)||(d.add(e),(t=>{typeof GM_addStyle=="function"?GM_addStyle(t):document.head.appendChild(document.createElement("style")).append(t);})(e));}; importCSS(" .plugin-area[data-v-9122b10d]{position:fixed;right:0;top:50%;padding:1rem;transform:translateY(-50%);display:flex;row-gap:1rem;flex-direction:column;background:#fff3;border-radius:16px;backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px);box-shadow:0 8px 30px #0000004d;transition:transform .6s ease-in-out}.plugin-area[hide=true][data-v-9122b10d]{transform:translateY(-50%) translate(95%)}.title[data-v-9122b10d]{width:100%;text-align:center;color:var(--surface-on-surface-primary);font-weight:700;-webkit-user-select:none;user-select:none}.button-area[data-v-9122b10d]{display:flex;row-gap:1rem;flex-direction:column}.log-area[data-v-9122b10d]{width:200px;height:100px;background-color:#00000080;border-radius:4px;display:flex;flex-direction:column;row-gap:.5rem;overflow:hidden;overflow-y:auto;flex-direction:column-reverse}.log-line[data-v-9122b10d]{line-break:anywhere} "); const styleCss = ".dlsite-play-downloader-vue{position:fixed;z-index:9999}"; importCSS(styleCss); const configProviderContextKey = Symbol(); const defaultNamespace = "el"; const statePrefix = "is-"; const _bem = (namespace, block, blockSuffix, element, modifier) => { let cls = `${namespace}-${block}`; if (blockSuffix) { cls += `-${blockSuffix}`; } if (element) { cls += `__${element}`; } if (modifier) { cls += `--${modifier}`; } return cls; }; const namespaceContextKey = Symbol("namespaceContextKey"); const useGetDerivedNamespace = (namespaceOverrides) => { const derivedNamespace = vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace); const namespace = vue.computed(() => { return vue.unref(derivedNamespace) || defaultNamespace; }); return namespace; }; const useNamespace = (block, namespaceOverrides) => { const namespace = useGetDerivedNamespace(); const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", ""); const e = (element) => element ? _bem(namespace.value, block, "", element, "") : ""; const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : ""; const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : ""; const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : ""; const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : ""; const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : ""; const is = (name, ...args) => { const state = args.length >= 1 ? args[0] : true; return name && state ? `${statePrefix}${name}` : ""; }; const cssVar = (object) => { const styles = {}; for (const key in object) { if (object[key]) { styles[`--${namespace.value}-${key}`] = object[key]; } } return styles; }; const cssVarBlock = (object) => { const styles = {}; for (const key in object) { if (object[key]) { styles[`--${namespace.value}-${block}-${key}`] = object[key]; } } return styles; }; const cssVarName = (name) => `--${namespace.value}-${name}`; const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`; return { namespace, b, e, m, be, em, bm, bem, is, cssVar, cssVarName, cssVarBlock, cssVarBlockName }; }; /** * @vue/shared v3.5.21 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ const NOOP = () => { }; const hasOwnProperty = Object.prototype.hasOwnProperty; const hasOwn = (val, key) => hasOwnProperty.call(val, key); const isString = (val) => typeof val === "string"; const isObject = (val) => val !== null && typeof val === "object"; function fromPairs(pairs) { var index = -1, length = pairs == null ? 0 : pairs.length, result = {}; while (++index < length) { var pair = pairs[index]; result[pair[0]] = pair[1]; } return result; } const isUndefined = (val) => val === void 0; const isNumber = (val) => typeof val === "number"; const isStringNumber = (val) => { if (!isString(val)) { return false; } return !Number.isNaN(Number(val)); }; const epPropKey = "__epPropKey"; const definePropType = (val) => val; const isEpProp = (val) => isObject(val) && !!val[epPropKey]; const buildProp = (prop, key) => { if (!isObject(prop) || isEpProp(prop)) return prop; const { values, required, default: defaultValue, type, validator } = prop; const _validator = values || validator ? (val) => { let valid = false; let allowedValues = []; if (values) { allowedValues = Array.from(values); if (hasOwn(prop, "default")) { allowedValues.push(defaultValue); } valid || (valid = allowedValues.includes(val)); } if (validator) valid || (valid = validator(val)); if (!valid && allowedValues.length > 0) { const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", "); vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`); } return valid; } : void 0; const epProp = { type, required: !!required, validator: _validator, [epPropKey]: true }; if (hasOwn(prop, "default")) epProp.default = defaultValue; return epProp; }; const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [ key, buildProp(option, key) ])); const componentSizes = ["", "default", "small", "large"]; const useSizeProp = buildProp({ type: String, values: componentSizes, required: false }); const SIZE_INJECTION_KEY = Symbol("size"); const useGlobalSize = () => { const injectedSize = vue.inject(SIZE_INJECTION_KEY, {}); return vue.computed(() => { return vue.unref(injectedSize.size) || ""; }); }; const globalConfig = vue.ref(); function useGlobalConfig(key, defaultValue = void 0) { const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig; { return vue.computed(() => { var _a2, _b2; return (_b2 = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b2 : defaultValue; }); } } var _export_sfc$1 = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; function addUnit(value, defaultUnit = "px") { if (!value) return ""; if (isNumber(value) || isStringNumber(value)) { return `${value}${defaultUnit}`; } else if (isString(value)) { return value; } } const withInstall = (main, extra) => { main.install = (app) => { for (const comp of [main, ...Object.values(extra != null ? extra : {})]) { app.component(comp.name, comp); } }; if (extra) { for (const [key, comp] of Object.entries(extra)) { main[key] = comp; } } return main; }; const withNoopInstall = (component) => { component.install = NOOP; return component; }; const iconProps = buildProps({ size: { type: definePropType([Number, String]) }, color: { type: String } }); const __default__$2 = vue.defineComponent({ name: "ElIcon", inheritAttrs: false }); const _sfc_main$3 = vue.defineComponent({ ...__default__$2, props: iconProps, setup(__props) { const props = __props; const ns = useNamespace("icon"); const style = vue.computed(() => { const { size, color } = props; if (!size && !color) return {}; return { fontSize: isUndefined(size) ? void 0 : addUnit(size), "--color": color }; }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({ class: vue.unref(ns).b(), style: vue.unref(style) }, _ctx.$attrs), [ vue.renderSlot(_ctx.$slots, "default") ], 16); }; } }); var Icon = _export_sfc$1(_sfc_main$3, [["__file", "icon.vue"]]); const ElIcon = withInstall(Icon); var _sfc_main150 = vue.defineComponent({ name: "Loading", __name: "loading", setup(__props) { return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ vue.createElementVNode("path", { fill: "currentColor", d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0" }) ])); } }), loading_default = _sfc_main150; const iconPropType = definePropType([ String, Object, Function ]); const formContextKey = Symbol("formContextKey"); const formItemContextKey = Symbol("formItemContextKey"); const useFormItem = () => { const form = vue.inject(formContextKey, void 0); const formItem = vue.inject(formItemContextKey, void 0); return { form, formItem }; }; const useProp = (name) => { const vm = vue.getCurrentInstance(); return vue.computed(() => { var _a2, _b2; return (_b2 = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b2[name]; }); }; const useFormSize = (fallback, ignore = {}) => { const emptyRef = vue.ref(void 0); const size = ignore.prop ? emptyRef : useProp("size"); const globalConfig2 = ignore.global ? emptyRef : useGlobalSize(); const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0); const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0); return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || ""); }; const useFormDisabled = (fallback) => { const disabled = useProp("disabled"); const form = vue.inject(formContextKey, void 0); return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false); }; const buttonGroupContextKey = Symbol("buttonGroupContextKey"); const useDeprecated = ({ from, replacement, scope, version, ref: ref2, type = "API" }, condition) => { vue.watch(() => vue.unref(condition), (val) => { }, { immediate: true }); }; const useButton = (props, emit) => { useDeprecated({ from: "type.text", replacement: "link", version: "3.0.0", scope: "props", ref: "https://element-plus.org/en-US/component/button.html#button-attributes" }, vue.computed(() => props.type === "text")); const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0); const globalConfig2 = useGlobalConfig("button"); const { form } = useFormItem(); const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size)); const _disabled = useFormDisabled(); const _ref = vue.ref(); const slots = vue.useSlots(); const _type = vue.computed(() => { var _a2; return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a2 = globalConfig2.value) == null ? void 0 : _a2.type) || ""; }); const autoInsertSpace = vue.computed(() => { var _a2, _b2, _c; return (_c = (_b2 = props.autoInsertSpace) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false; }); const _plain = vue.computed(() => { var _a2, _b2, _c; return (_c = (_b2 = props.plain) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.plain) != null ? _c : false; }); const _round = vue.computed(() => { var _a2, _b2, _c; return (_c = (_b2 = props.round) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.round) != null ? _c : false; }); const _text = vue.computed(() => { var _a2, _b2, _c; return (_c = (_b2 = props.text) != null ? _b2 : (_a2 = globalConfig2.value) == null ? void 0 : _a2.text) != null ? _c : false; }); const _props = vue.computed(() => { if (props.tag === "button") { return { ariaDisabled: _disabled.value || props.loading, disabled: _disabled.value || props.loading, autofocus: props.autofocus, type: props.nativeType }; } return {}; }); const shouldAddSpace = vue.computed(() => { var _a2; const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots); if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) { const slot = defaultSlot[0]; if ((slot == null ? void 0 : slot.type) === vue.Text) { const text = slot.children; return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(text.trim()); } } return false; }); const handleClick = (evt) => { if (_disabled.value || props.loading) { evt.stopPropagation(); return; } if (props.nativeType === "reset") { form == null ? void 0 : form.resetFields(); } emit("click", evt); }; return { _disabled, _size, _type, _ref, _props, _plain, _round, _text, shouldAddSpace, handleClick }; }; const buttonTypes = [ "default", "primary", "success", "warning", "info", "danger", "text", "" ]; const buttonNativeTypes = ["button", "submit", "reset"]; const buttonProps = buildProps({ size: useSizeProp, disabled: Boolean, type: { type: String, values: buttonTypes, default: "" }, icon: { type: iconPropType }, nativeType: { type: String, values: buttonNativeTypes, default: "button" }, loading: Boolean, loadingIcon: { type: iconPropType, default: () => loading_default }, plain: { type: Boolean, default: void 0 }, text: { type: Boolean, default: void 0 }, link: Boolean, bg: Boolean, autofocus: Boolean, round: { type: Boolean, default: void 0 }, circle: Boolean, color: String, dark: Boolean, autoInsertSpace: { type: Boolean, default: void 0 }, tag: { type: definePropType([String, Object]), default: "button" } }); const buttonEmits = { click: (evt) => evt instanceof MouseEvent }; function bound01(n, max2) { if (isOnePointZero(n)) { n = "100%"; } var isPercent = isPercentage(n); n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n))); if (isPercent) { n = parseInt(String(n * max2), 10) / 100; } if (Math.abs(n - max2) < 1e-6) { return 1; } if (max2 === 360) { n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2)); } else { n = n % max2 / parseFloat(String(max2)); } return n; } function clamp01(val) { return Math.min(1, Math.max(0, val)); } function isOnePointZero(n) { return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1; } function isPercentage(n) { return typeof n === "string" && n.indexOf("%") !== -1; } function boundAlpha(a) { a = parseFloat(a); if (isNaN(a) || a < 0 || a > 1) { a = 1; } return a; } function convertToPercentage(n) { if (n <= 1) { return "".concat(Number(n) * 100, "%"); } return n; } function pad2(c2) { return c2.length === 1 ? "0" + c2 : String(c2); } function rgbToRgb(r, g, b) { return { r: bound01(r, 255) * 255, g: bound01(g, 255) * 255, b: bound01(b, 255) * 255 }; } function rgbToHsl(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max2 = Math.max(r, g, b); var min = Math.min(r, g, b); var h = 0; var s = 0; var l = (max2 + min) / 2; if (max2 === min) { s = 0; h = 0; } else { var d = max2 - min; s = l > 0.5 ? d / (2 - max2 - min) : d / (max2 + min); switch (max2) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return { h, s, l }; } function hue2rgb(p, q, t) { if (t < 0) { t += 1; } if (t > 1) { t -= 1; } if (t < 1 / 6) { return p + (q - p) * (6 * t); } if (t < 1 / 2) { return q; } if (t < 2 / 3) { return p + (q - p) * (2 / 3 - t) * 6; } return p; } function hslToRgb(h, s, l) { var r; var g; var b; h = bound01(h, 360); s = bound01(s, 100); l = bound01(l, 100); if (s === 0) { g = l; b = l; r = l; } else { var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3); } return { r: r * 255, g: g * 255, b: b * 255 }; } function rgbToHsv(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); var max2 = Math.max(r, g, b); var min = Math.min(r, g, b); var h = 0; var v = max2; var d = max2 - min; var s = max2 === 0 ? 0 : d / max2; if (max2 === min) { h = 0; } else { switch (max2) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return { h, s, v }; } function hsvToRgb(h, s, v) { h = bound01(h, 360) * 6; s = bound01(s, 100); v = bound01(v, 100); var i = Math.floor(h); var f = h - i; var p = v * (1 - s); var q = v * (1 - f * s); var t = v * (1 - (1 - f) * s); var mod = i % 6; var r = [v, q, p, p, t, v][mod]; var g = [t, v, v, q, p, p][mod]; var b = [p, p, t, v, v, q][mod]; return { r: r * 255, g: g * 255, b: b * 255 }; } function rgbToHex(r, g, b, allow3Char) { var hex = [ pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)) ]; if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); } return hex.join(""); } function rgbaToHex(r, g, b, a, allow4Char) { var hex = [ pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a)) ]; if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) { return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); } return hex.join(""); } function convertDecimalToHex(d) { return Math.round(parseFloat(d) * 255).toString(16); } function convertHexToDecimal(h) { return parseIntFromHex(h) / 255; } function parseIntFromHex(val) { return parseInt(val, 16); } function numberInputToObject(color) { return { r: color >> 16, g: (color & 65280) >> 8, b: color & 255 }; } var names = { aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", goldenrod: "#daa520", gold: "#ffd700", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavenderblush: "#fff0f5", lavender: "#e6e6fa", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370db", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#db7093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", rebeccapurple: "#663399", red: "#ff0000", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }; function inputToRGB(color) { var rgb = { r: 0, g: 0, b: 0 }; var a = 1; var s = null; var v = null; var l = null; var ok = false; var format = false; if (typeof color === "string") { color = stringInputToObject(color); } if (typeof color === "object") { if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { rgb = rgbToRgb(color.r, color.g, color.b); ok = true; format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { s = convertToPercentage(color.s); v = convertToPercentage(color.v); rgb = hsvToRgb(color.h, s, v); ok = true; format = "hsv"; } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { s = convertToPercentage(color.s); l = convertToPercentage(color.l); rgb = hslToRgb(color.h, s, l); ok = true; format = "hsl"; } if (Object.prototype.hasOwnProperty.call(color, "a")) { a = color.a; } } a = boundAlpha(a); return { ok, format: color.format || format, r: Math.min(255, Math.max(rgb.r, 0)), g: Math.min(255, Math.max(rgb.g, 0)), b: Math.min(255, Math.max(rgb.b, 0)), a }; } var CSS_INTEGER = "[-\\+]?\\d+%?"; var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")"); var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?"); var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?"); var matchers = { CSS_UNIT: new RegExp(CSS_UNIT), rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; function stringInputToObject(color) { color = color.trim().toLowerCase(); if (color.length === 0) { return false; } var named = false; if (names[color]) { color = names[color]; named = true; } else if (color === "transparent") { return { r: 0, g: 0, b: 0, a: 0, format: "name" }; } var match = matchers.rgb.exec(color); if (match) { return { r: match[1], g: match[2], b: match[3] }; } match = matchers.rgba.exec(color); if (match) { return { r: match[1], g: match[2], b: match[3], a: match[4] }; } match = matchers.hsl.exec(color); if (match) { return { h: match[1], s: match[2], l: match[3] }; } match = matchers.hsla.exec(color); if (match) { return { h: match[1], s: match[2], l: match[3], a: match[4] }; } match = matchers.hsv.exec(color); if (match) { return { h: match[1], s: match[2], v: match[3] }; } match = matchers.hsva.exec(color); if (match) { return { h: match[1], s: match[2], v: match[3], a: match[4] }; } match = matchers.hex8.exec(color); if (match) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), a: convertHexToDecimal(match[4]), format: named ? "name" : "hex8" }; } match = matchers.hex6.exec(color); if (match) { return { r: parseIntFromHex(match[1]), g: parseIntFromHex(match[2]), b: parseIntFromHex(match[3]), format: named ? "name" : "hex" }; } match = matchers.hex4.exec(color); if (match) { return { r: parseIntFromHex(match[1] + match[1]), g: parseIntFromHex(match[2] + match[2]), b: parseIntFromHex(match[3] + match[3]), a: convertHexToDecimal(match[4] + match[4]), format: named ? "name" : "hex8" }; } match = matchers.hex3.exec(color); if (match) { return { r: parseIntFromHex(match[1] + match[1]), g: parseIntFromHex(match[2] + match[2]), b: parseIntFromHex(match[3] + match[3]), format: named ? "name" : "hex" }; } return false; } function isValidCSSUnit(color) { return Boolean(matchers.CSS_UNIT.exec(String(color))); } var TinyColor = ( (function() { function TinyColor2(color, opts) { if (color === void 0) { color = ""; } if (opts === void 0) { opts = {}; } var _a2; if (color instanceof TinyColor2) { return color; } if (typeof color === "number") { color = numberInputToObject(color); } this.originalInput = color; var rgb = inputToRGB(color); this.originalInput = color; this.r = rgb.r; this.g = rgb.g; this.b = rgb.b; this.a = rgb.a; this.roundA = Math.round(100 * this.a) / 100; this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format; this.gradientType = opts.gradientType; if (this.r < 1) { this.r = Math.round(this.r); } if (this.g < 1) { this.g = Math.round(this.g); } if (this.b < 1) { this.b = Math.round(this.b); } this.isValid = rgb.ok; } TinyColor2.prototype.isDark = function() { return this.getBrightness() < 128; }; TinyColor2.prototype.isLight = function() { return !this.isDark(); }; TinyColor2.prototype.getBrightness = function() { var rgb = this.toRgb(); return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3; }; TinyColor2.prototype.getLuminance = function() { var rgb = this.toRgb(); var R; var G; var B; var RsRGB = rgb.r / 255; var GsRGB = rgb.g / 255; var BsRGB = rgb.b / 255; if (RsRGB <= 0.03928) { R = RsRGB / 12.92; } else { R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); } if (GsRGB <= 0.03928) { G = GsRGB / 12.92; } else { G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); } if (BsRGB <= 0.03928) { B = BsRGB / 12.92; } else { B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); } return 0.2126 * R + 0.7152 * G + 0.0722 * B; }; TinyColor2.prototype.getAlpha = function() { return this.a; }; TinyColor2.prototype.setAlpha = function(alpha) { this.a = boundAlpha(alpha); this.roundA = Math.round(100 * this.a) / 100; return this; }; TinyColor2.prototype.isMonochrome = function() { var s = this.toHsl().s; return s === 0; }; TinyColor2.prototype.toHsv = function() { var hsv = rgbToHsv(this.r, this.g, this.b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a }; }; TinyColor2.prototype.toHsvString = function() { var hsv = rgbToHsv(this.r, this.g, this.b); var h = Math.round(hsv.h * 360); var s = Math.round(hsv.s * 100); var v = Math.round(hsv.v * 100); return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")"); }; TinyColor2.prototype.toHsl = function() { var hsl = rgbToHsl(this.r, this.g, this.b); return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a }; }; TinyColor2.prototype.toHslString = function() { var hsl = rgbToHsl(this.r, this.g, this.b); var h = Math.round(hsl.h * 360); var s = Math.round(hsl.s * 100); var l = Math.round(hsl.l * 100); return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")"); }; TinyColor2.prototype.toHex = function(allow3Char) { if (allow3Char === void 0) { allow3Char = false; } return rgbToHex(this.r, this.g, this.b, allow3Char); }; TinyColor2.prototype.toHexString = function(allow3Char) { if (allow3Char === void 0) { allow3Char = false; } return "#" + this.toHex(allow3Char); }; TinyColor2.prototype.toHex8 = function(allow4Char) { if (allow4Char === void 0) { allow4Char = false; } return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char); }; TinyColor2.prototype.toHex8String = function(allow4Char) { if (allow4Char === void 0) { allow4Char = false; } return "#" + this.toHex8(allow4Char); }; TinyColor2.prototype.toHexShortString = function(allowShortChar) { if (allowShortChar === void 0) { allowShortChar = false; } return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar); }; TinyColor2.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }; TinyColor2.prototype.toRgbString = function() { var r = Math.round(this.r); var g = Math.round(this.g); var b = Math.round(this.b); return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")"); }; TinyColor2.prototype.toPercentageRgb = function() { var fmt = function(x) { return "".concat(Math.round(bound01(x, 255) * 100), "%"); }; return { r: fmt(this.r), g: fmt(this.g), b: fmt(this.b), a: this.a }; }; TinyColor2.prototype.toPercentageRgbString = function() { var rnd = function(x) { return Math.round(bound01(x, 255) * 100); }; return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")"); }; TinyColor2.prototype.toName = function() { if (this.a === 0) { return "transparent"; } if (this.a < 1) { return false; } var hex = "#" + rgbToHex(this.r, this.g, this.b, false); for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) { var _b2 = _a2[_i], key = _b2[0], value = _b2[1]; if (hex === value) { return key; } } return false; }; TinyColor2.prototype.toString = function(format) { var formatSet = Boolean(format); format = format !== null && format !== void 0 ? format : this.format; var formattedString = false; var hasAlpha = this.a < 1 && this.a >= 0; var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name"); if (needsAlphaFormat) { if (format === "name" && this.a === 0) { return this.toName(); } return this.toRgbString(); } if (format === "rgb") { formattedString = this.toRgbString(); } if (format === "prgb") { formattedString = this.toPercentageRgbString(); } if (format === "hex" || format === "hex6") { formattedString = this.toHexString(); } if (format === "hex3") { formattedString = this.toHexString(true); } if (format === "hex4") { formattedString = this.toHex8String(true); } if (format === "hex8") { formattedString = this.toHex8String(); } if (format === "name") { formattedString = this.toName(); } if (format === "hsl") { formattedString = this.toHslString(); } if (format === "hsv") { formattedString = this.toHsvString(); } return formattedString || this.toHexString(); }; TinyColor2.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }; TinyColor2.prototype.clone = function() { return new TinyColor2(this.toString()); }; TinyColor2.prototype.lighten = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.l += amount / 100; hsl.l = clamp01(hsl.l); return new TinyColor2(hsl); }; TinyColor2.prototype.brighten = function(amount) { if (amount === void 0) { amount = 10; } var rgb = this.toRgb(); rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); return new TinyColor2(rgb); }; TinyColor2.prototype.darken = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.l -= amount / 100; hsl.l = clamp01(hsl.l); return new TinyColor2(hsl); }; TinyColor2.prototype.tint = function(amount) { if (amount === void 0) { amount = 10; } return this.mix("white", amount); }; TinyColor2.prototype.shade = function(amount) { if (amount === void 0) { amount = 10; } return this.mix("black", amount); }; TinyColor2.prototype.desaturate = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.s -= amount / 100; hsl.s = clamp01(hsl.s); return new TinyColor2(hsl); }; TinyColor2.prototype.saturate = function(amount) { if (amount === void 0) { amount = 10; } var hsl = this.toHsl(); hsl.s += amount / 100; hsl.s = clamp01(hsl.s); return new TinyColor2(hsl); }; TinyColor2.prototype.greyscale = function() { return this.desaturate(100); }; TinyColor2.prototype.spin = function(amount) { var hsl = this.toHsl(); var hue = (hsl.h + amount) % 360; hsl.h = hue < 0 ? 360 + hue : hue; return new TinyColor2(hsl); }; TinyColor2.prototype.mix = function(color, amount) { if (amount === void 0) { amount = 50; } var rgb1 = this.toRgb(); var rgb2 = new TinyColor2(color).toRgb(); var p = amount / 100; var rgba = { r: (rgb2.r - rgb1.r) * p + rgb1.r, g: (rgb2.g - rgb1.g) * p + rgb1.g, b: (rgb2.b - rgb1.b) * p + rgb1.b, a: (rgb2.a - rgb1.a) * p + rgb1.a }; return new TinyColor2(rgba); }; TinyColor2.prototype.analogous = function(results, slices) { if (results === void 0) { results = 6; } if (slices === void 0) { slices = 30; } var hsl = this.toHsl(); var part = 360 / slices; var ret = [this]; for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) { hsl.h = (hsl.h + part) % 360; ret.push(new TinyColor2(hsl)); } return ret; }; TinyColor2.prototype.complement = function() { var hsl = this.toHsl(); hsl.h = (hsl.h + 180) % 360; return new TinyColor2(hsl); }; TinyColor2.prototype.monochromatic = function(results) { if (results === void 0) { results = 6; } var hsv = this.toHsv(); var h = hsv.h; var s = hsv.s; var v = hsv.v; var res = []; var modification = 1 / results; while (results--) { res.push(new TinyColor2({ h, s, v })); v = (v + modification) % 1; } return res; }; TinyColor2.prototype.splitcomplement = function() { var hsl = this.toHsl(); var h = hsl.h; return [ this, new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }), new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l }) ]; }; TinyColor2.prototype.onBackground = function(background) { var fg = this.toRgb(); var bg = new TinyColor2(background).toRgb(); var alpha = fg.a + bg.a * (1 - fg.a); return new TinyColor2({ r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha, g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha, b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha, a: alpha }); }; TinyColor2.prototype.triad = function() { return this.polyad(3); }; TinyColor2.prototype.tetrad = function() { return this.polyad(4); }; TinyColor2.prototype.polyad = function(n) { var hsl = this.toHsl(); var h = hsl.h; var result = [this]; var increment = 360 / n; for (var i = 1; i < n; i++) { result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l })); } return result; }; TinyColor2.prototype.equals = function(color) { return this.toRgbString() === new TinyColor2(color).toRgbString(); }; return TinyColor2; })() ); function darken(color, amount = 20) { return color.mix("#141414", amount).toString(); } function useButtonCustomStyle(props) { const _disabled = useFormDisabled(); const ns = useNamespace("button"); return vue.computed(() => { let styles = {}; let buttonColor = props.color; if (buttonColor) { const match = buttonColor.match(/var\((.*?)\)/); if (match) { buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]); } const color = new TinyColor(buttonColor); const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20); if (props.plain) { styles = ns.cssVarBlock({ "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(), "text-color": buttonColor, "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(), "hover-text-color": `var(${ns.cssVarName("color-white")})`, "hover-bg-color": buttonColor, "hover-border-color": buttonColor, "active-bg-color": activeBgColor, "active-text-color": `var(${ns.cssVarName("color-white")})`, "active-border-color": activeBgColor }); if (_disabled.value) { styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString(); styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString(); styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString(); } } else { const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString(); const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`; styles = ns.cssVarBlock({ "bg-color": buttonColor, "text-color": textColor, "border-color": buttonColor, "hover-bg-color": hoverBgColor, "hover-text-color": textColor, "hover-border-color": hoverBgColor, "active-bg-color": activeBgColor, "active-border-color": activeBgColor }); if (_disabled.value) { const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString(); styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor; styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`; styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor; } } } return styles; }); } const __default__$1 = vue.defineComponent({ name: "ElButton" }); const _sfc_main$2 = vue.defineComponent({ ...__default__$1, props: buttonProps, emits: buttonEmits, setup(__props, { expose, emit }) { const props = __props; const buttonStyle = useButtonCustomStyle(props); const ns = useNamespace("button"); const { _ref, _size, _type, _disabled, _props, _plain, _round, _text, shouldAddSpace, handleClick } = useButton(props, emit); const buttonKls = vue.computed(() => [ ns.b(), ns.m(_type.value), ns.m(_size.value), ns.is("disabled", _disabled.value), ns.is("loading", props.loading), ns.is("plain", _plain.value), ns.is("round", _round.value), ns.is("circle", props.circle), ns.is("text", _text.value), ns.is("link", props.link), ns.is("has-bg", props.bg) ]); expose({ ref: _ref, size: _size, type: _type, disabled: _disabled, shouldAddSpace }); return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({ ref_key: "_ref", ref: _ref }, vue.unref(_props), { class: vue.unref(buttonKls), style: vue.unref(buttonStyle), onClick: vue.unref(handleClick) }), { default: vue.withCtx(() => [ _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1, class: vue.normalizeClass(vue.unref(ns).is("loading")) }, { default: vue.withCtx(() => [ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon))) ]), _: 1 }, 8, ["class"])) ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, { default: vue.withCtx(() => [ _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 }) ]), _: 3 })) : vue.createCommentVNode("v-if", true), _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", { key: 2, class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) }) }, [ vue.renderSlot(_ctx.$slots, "default") ], 2)) : vue.createCommentVNode("v-if", true) ]), _: 3 }, 16, ["class", "style", "onClick"]); }; } }); var Button = _export_sfc$1(_sfc_main$2, [["__file", "button.vue"]]); const buttonGroupProps = { size: buttonProps.size, type: buttonProps.type }; const __default__ = vue.defineComponent({ name: "ElButtonGroup" }); const _sfc_main$1 = vue.defineComponent({ ...__default__, props: buttonGroupProps, setup(__props) { const props = __props; vue.provide(buttonGroupContextKey, vue.reactive({ size: vue.toRef(props, "size"), type: vue.toRef(props, "type") })); const ns = useNamespace("button"); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { class: vue.normalizeClass(vue.unref(ns).b("group")) }, [ vue.renderSlot(_ctx.$slots, "default") ], 2); }; } }); var ButtonGroup = _export_sfc$1(_sfc_main$1, [["__file", "button-group.vue"]]); const ElButton = withInstall(Button, { ButtonGroup }); withNoopInstall(ButtonGroup); function getDefaultExportFromCjs(x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; } const baseCss = '@charset "UTF-8";:root{--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary-rgb:64,158,255;--el-color-success-rgb:103,194,58;--el-color-warning-rgb:230,162,60;--el-color-danger-rgb:245,108,108;--el-color-error-rgb:245,108,108;--el-color-info-rgb:144,147,153;--el-font-size-extra-large:20px;--el-font-size-large:18px;--el-font-size-medium:16px;--el-font-size-base:14px;--el-font-size-small:13px;--el-font-size-extra-small:12px;--el-font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;--el-font-weight-primary:500;--el-font-line-height-primary:24px;--el-index-normal:1;--el-index-top:1000;--el-index-popper:2000;--el-border-radius-base:4px;--el-border-radius-small:2px;--el-border-radius-round:20px;--el-border-radius-circle:100%;--el-transition-duration:.3s;--el-transition-duration-fast:.2s;--el-transition-function-ease-in-out-bezier:cubic-bezier(.645,.045,.355,1);--el-transition-function-fast-bezier:cubic-bezier(.23,1,.32,1);--el-transition-all:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);--el-transition-fade:opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-md-fade:transform var(--el-transition-duration) var(--el-transition-function-fast-bezier),opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-fade-linear:opacity var(--el-transition-duration-fast) linear;--el-transition-border:border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-box-shadow:box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-color:color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-component-size-large:40px;--el-component-size:32px;--el-component-size-small:24px;color-scheme:light;--el-color-primary:#409eff;--el-color-primary-light-3:rgb(121,187,255);--el-color-primary-light-5:rgb(160,207,255);--el-color-primary-light-7:rgb(198,226,255);--el-color-primary-light-8:rgb(217,236,255);--el-color-primary-light-9:rgb(236,245,255);--el-color-primary-dark-2:rgb(51,126,204);--el-color-success:#67c23a;--el-color-success-light-3:rgb(149,212,117);--el-color-success-light-5:rgb(179,225,157);--el-color-success-light-7:rgb(209,237,196);--el-color-success-light-8:rgb(225,243,216);--el-color-success-light-9:rgb(240,249,235);--el-color-success-dark-2:rgb(82,155,46);--el-color-warning:#e6a23c;--el-color-warning-light-3:rgb(238,190,119);--el-color-warning-light-5:rgb(243,209,158);--el-color-warning-light-7:rgb(248,227,197);--el-color-warning-light-8:rgb(250,236,216);--el-color-warning-light-9:rgb(253,246,236);--el-color-warning-dark-2:rgb(184,130,48);--el-color-danger:#f56c6c;--el-color-danger-light-3:rgb(248,152,152);--el-color-danger-light-5:rgb(250,182,182);--el-color-danger-light-7:rgb(252,211,211);--el-color-danger-light-8:rgb(253,226,226);--el-color-danger-light-9:rgb(254,240,240);--el-color-danger-dark-2:rgb(196,86,86);--el-color-error:#f56c6c;--el-color-error-light-3:rgb(248,152,152);--el-color-error-light-5:rgb(250,182,182);--el-color-error-light-7:rgb(252,211,211);--el-color-error-light-8:rgb(253,226,226);--el-color-error-light-9:rgb(254,240,240);--el-color-error-dark-2:rgb(196,86,86);--el-color-info:#909399;--el-color-info-light-3:rgb(177,179,184);--el-color-info-light-5:rgb(200,201,204);--el-color-info-light-7:rgb(222,223,224);--el-color-info-light-8:rgb(233,233,235);--el-color-info-light-9:rgb(244,244,245);--el-color-info-dark-2:rgb(115,118,122);--el-bg-color:#ffffff;--el-bg-color-page:#f2f3f5;--el-bg-color-overlay:#ffffff;--el-text-color-primary:#303133;--el-text-color-regular:#606266;--el-text-color-secondary:#909399;--el-text-color-placeholder:#a8abb2;--el-text-color-disabled:#c0c4cc;--el-border-color:#dcdfe6;--el-border-color-light:#e4e7ed;--el-border-color-lighter:#ebeef5;--el-border-color-extra-light:#f2f6fc;--el-border-color-dark:#d4d7de;--el-border-color-darker:#cdd0d6;--el-fill-color:#f0f2f5;--el-fill-color-light:#f5f7fa;--el-fill-color-lighter:#fafafa;--el-fill-color-extra-light:#fafcff;--el-fill-color-dark:#ebedf0;--el-fill-color-darker:#e6e8eb;--el-fill-color-blank:#ffffff;--el-box-shadow:0px 12px 32px 4px rgba(0,0,0,.04),0px 8px 20px rgba(0,0,0,.08);--el-box-shadow-light:0px 0px 12px rgba(0,0,0,.12);--el-box-shadow-lighter:0px 0px 6px rgba(0,0,0,.12);--el-box-shadow-dark:0px 16px 48px 16px rgba(0,0,0,.08),0px 12px 32px rgba(0,0,0,.12),0px 8px 16px -8px rgba(0,0,0,.16);--el-disabled-bg-color:var(--el-fill-color-light);--el-disabled-text-color:var(--el-text-color-placeholder);--el-disabled-border-color:var(--el-border-color-light);--el-overlay-color:rgba(0,0,0,.8);--el-overlay-color-light:rgba(0,0,0,.7);--el-overlay-color-lighter:rgba(0,0,0,.5);--el-mask-color:rgba(255,255,255,.9);--el-mask-color-extra-light:rgba(255,255,255,.3);--el-border-width:1px;--el-border-style:solid;--el-border-color-hover:var(--el-text-color-disabled);--el-border:var(--el-border-width) var(--el-border-style) var(--el-border-color);--el-svg-monochrome-grey:var(--el-border-color)}.fade-in-linear-enter-active,.fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.fade-in-linear-enter-from,.fade-in-linear-leave-to{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.el-fade-in-linear-enter-from,.el-fade-in-linear-leave-to{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-fade-in-enter-from,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter-from,.el-zoom-in-center-leave-active{opacity:0;transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;transform:scaleY(1);transform-origin:center top;transition:var(--el-transition-md-fade)}.el-zoom-in-top-enter-active[data-popper-placement^=top],.el-zoom-in-top-leave-active[data-popper-placement^=top]{transform-origin:center bottom}.el-zoom-in-top-enter-from,.el-zoom-in-top-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;transform:scaleY(1);transform-origin:center bottom;transition:var(--el-transition-md-fade)}.el-zoom-in-bottom-enter-from,.el-zoom-in-bottom-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;transform:scale(1);transform-origin:top left;transition:var(--el-transition-md-fade)}.el-zoom-in-left-enter-from,.el-zoom-in-left-leave-active{opacity:0;transform:scale(.45)}.collapse-transition{transition:var(--el-transition-duration) height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.el-collapse-transition-enter-active,.el-collapse-transition-leave-active{transition:var(--el-transition-duration) max-height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.horizontal-collapse-transition{transition:var(--el-transition-duration) width ease-in-out,var(--el-transition-duration) padding-left ease-in-out,var(--el-transition-duration) padding-right ease-in-out}.el-list-enter-active,.el-list-leave-active{transition:all 1s}.el-list-enter-from,.el-list-leave-to{opacity:0;transform:translateY(-30px)}.el-list-leave-active{position:absolute!important}.el-opacity-transition{transition:opacity var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.el-icon{--color:inherit;align-items:center;display:inline-flex;height:1em;justify-content:center;line-height:1em;position:relative;width:1em;fill:currentColor;color:var(--color);font-size:inherit}.el-icon.is-loading{animation:rotating 2s linear infinite}.el-icon svg{height:1em;width:1em}'; importCSS(baseCss); const elButtonCss = '.el-button{--el-button-font-weight:var(--el-font-weight-primary);--el-button-border-color:var(--el-border-color);--el-button-bg-color:var(--el-fill-color-blank);--el-button-text-color:var(--el-text-color-regular);--el-button-disabled-text-color:var(--el-disabled-text-color);--el-button-disabled-bg-color:var(--el-fill-color-blank);--el-button-disabled-border-color:var(--el-border-color-light);--el-button-divide-border-color:rgba(255,255,255,.5);--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-color-primary-light-9);--el-button-hover-border-color:var(--el-color-primary-light-7);--el-button-active-text-color:var(--el-button-hover-text-color);--el-button-active-border-color:var(--el-color-primary);--el-button-active-bg-color:var(--el-button-hover-bg-color);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-hover-link-text-color:var(--el-text-color-secondary);--el-button-active-color:var(--el-text-color-primary);align-items:center;-webkit-appearance:none;background-color:var(--el-button-bg-color);border:var(--el-border);border-color:var(--el-button-border-color);box-sizing:border-box;color:var(--el-button-text-color);cursor:pointer;display:inline-flex;font-weight:var(--el-button-font-weight);height:32px;justify-content:center;line-height:1;outline:none;text-align:center;transition:.1s;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;white-space:nowrap}.el-button:hover{background-color:var(--el-button-hover-bg-color);border-color:var(--el-button-hover-border-color);color:var(--el-button-hover-text-color);outline:none}.el-button:active{background-color:var(--el-button-active-bg-color);border-color:var(--el-button-active-border-color);color:var(--el-button-active-text-color);outline:none}.el-button:focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px;transition:outline-offset 0s,outline 0s}.el-button>span{align-items:center;display:inline-flex}.el-button+.el-button{margin-left:12px}.el-button{border-radius:var(--el-border-radius-base);font-size:var(--el-font-size-base)}.el-button,.el-button.is-round{padding:8px 15px}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon]+span{margin-left:6px}.el-button [class*=el-icon] svg{vertical-align:bottom}.el-button.is-plain{--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-fill-color-blank);--el-button-hover-border-color:var(--el-color-primary)}.el-button.is-active{background-color:var(--el-button-active-bg-color);border-color:var(--el-button-active-border-color);color:var(--el-button-active-text-color);outline:none}.el-button.is-disabled,.el-button.is-disabled:hover{background-color:var(--el-button-disabled-bg-color);background-image:none;border-color:var(--el-button-disabled-border-color);color:var(--el-button-disabled-text-color);cursor:not-allowed}.el-button.is-loading{pointer-events:none;position:relative}.el-button.is-loading:before{background-color:var(--el-mask-color-extra-light);border-radius:inherit;content:"";inset:-1px;pointer-events:none;position:absolute;z-index:1}.el-button.is-round{border-radius:var(--el-border-radius-round)}.el-button.is-circle{border-radius:50%;padding:8px;width:32px}.el-button.is-text{background-color:transparent;border:0 solid transparent;color:var(--el-button-text-color)}.el-button.is-text.is-disabled{background-color:transparent!important;color:var(--el-button-disabled-text-color)}.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled):focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px;transition:outline-offset 0s,outline 0s}.el-button.is-text:not(.is-disabled):active{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled).is-has-bg:hover{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg:active{background-color:var(--el-fill-color-dark)}.el-button__text--expand{letter-spacing:.3em;margin-right:-.3em}.el-button.is-link{background:transparent;border-color:transparent;color:var(--el-button-text-color);height:auto;padding:2px}.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button.is-link.is-disabled{background-color:transparent!important;border-color:transparent!important;color:var(--el-button-disabled-text-color)}.el-button.is-link:not(.is-disabled):active,.el-button.is-link:not(.is-disabled):hover{background-color:transparent;border-color:transparent}.el-button.is-link:not(.is-disabled):active{color:var(--el-button-active-color)}.el-button--text{background:transparent;border-color:transparent;color:var(--el-color-primary);padding-left:0;padding-right:0}.el-button--text.is-disabled{background-color:transparent!important;border-color:transparent!important;color:var(--el-button-disabled-text-color)}.el-button--text:not(.is-disabled):hover{background-color:transparent;border-color:transparent;color:var(--el-color-primary-light-3)}.el-button--text:not(.is-disabled):active{background-color:transparent;border-color:transparent;color:var(--el-color-primary-dark-2)}.el-button__link--expand{letter-spacing:.3em;margin-right:-.3em}.el-button--primary{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-primary);--el-button-border-color:var(--el-color-primary);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-active-color:var(--el-color-primary-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-primary-light-5);--el-button-hover-bg-color:var(--el-color-primary-light-3);--el-button-hover-border-color:var(--el-color-primary-light-3);--el-button-active-bg-color:var(--el-color-primary-dark-2);--el-button-active-border-color:var(--el-color-primary-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-primary-light-5);--el-button-disabled-border-color:var(--el-color-primary-light-5)}.el-button--primary.is-link,.el-button--primary.is-plain,.el-button--primary.is-text{--el-button-text-color:var(--el-color-primary);--el-button-bg-color:var(--el-color-primary-light-9);--el-button-border-color:var(--el-color-primary-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-primary);--el-button-hover-border-color:var(--el-color-primary);--el-button-active-text-color:var(--el-color-white)}.el-button--primary.is-link.is-disabled,.el-button--primary.is-link.is-disabled:active,.el-button--primary.is-link.is-disabled:focus,.el-button--primary.is-link.is-disabled:hover,.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover,.el-button--primary.is-text.is-disabled,.el-button--primary.is-text.is-disabled:active,.el-button--primary.is-text.is-disabled:focus,.el-button--primary.is-text.is-disabled:hover{background-color:var(--el-color-primary-light-9);border-color:var(--el-color-primary-light-8);color:var(--el-color-primary-light-5)}.el-button--success{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-success);--el-button-border-color:var(--el-color-success);--el-button-outline-color:var(--el-color-success-light-5);--el-button-active-color:var(--el-color-success-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-success-light-5);--el-button-hover-bg-color:var(--el-color-success-light-3);--el-button-hover-border-color:var(--el-color-success-light-3);--el-button-active-bg-color:var(--el-color-success-dark-2);--el-button-active-border-color:var(--el-color-success-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-success-light-5);--el-button-disabled-border-color:var(--el-color-success-light-5)}.el-button--success.is-link,.el-button--success.is-plain,.el-button--success.is-text{--el-button-text-color:var(--el-color-success);--el-button-bg-color:var(--el-color-success-light-9);--el-button-border-color:var(--el-color-success-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-success);--el-button-hover-border-color:var(--el-color-success);--el-button-active-text-color:var(--el-color-white)}.el-button--success.is-link.is-disabled,.el-button--success.is-link.is-disabled:active,.el-button--success.is-link.is-disabled:focus,.el-button--success.is-link.is-disabled:hover,.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover,.el-button--success.is-text.is-disabled,.el-button--success.is-text.is-disabled:active,.el-button--success.is-text.is-disabled:focus,.el-button--success.is-text.is-disabled:hover{background-color:var(--el-color-success-light-9);border-color:var(--el-color-success-light-8);color:var(--el-color-success-light-5)}.el-button--warning{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-warning);--el-button-border-color:var(--el-color-warning);--el-button-outline-color:var(--el-color-warning-light-5);--el-button-active-color:var(--el-color-warning-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-warning-light-5);--el-button-hover-bg-color:var(--el-color-warning-light-3);--el-button-hover-border-color:var(--el-color-warning-light-3);--el-button-active-bg-color:var(--el-color-warning-dark-2);--el-button-active-border-color:var(--el-color-warning-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-warning-light-5);--el-button-disabled-border-color:var(--el-color-warning-light-5)}.el-button--warning.is-link,.el-button--warning.is-plain,.el-button--warning.is-text{--el-button-text-color:var(--el-color-warning);--el-button-bg-color:var(--el-color-warning-light-9);--el-button-border-color:var(--el-color-warning-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-warning);--el-button-hover-border-color:var(--el-color-warning);--el-button-active-text-color:var(--el-color-white)}.el-button--warning.is-link.is-disabled,.el-button--warning.is-link.is-disabled:active,.el-button--warning.is-link.is-disabled:focus,.el-button--warning.is-link.is-disabled:hover,.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover,.el-button--warning.is-text.is-disabled,.el-button--warning.is-text.is-disabled:active,.el-button--warning.is-text.is-disabled:focus,.el-button--warning.is-text.is-disabled:hover{background-color:var(--el-color-warning-light-9);border-color:var(--el-color-warning-light-8);color:var(--el-color-warning-light-5)}.el-button--danger{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-danger);--el-button-border-color:var(--el-color-danger);--el-button-outline-color:var(--el-color-danger-light-5);--el-button-active-color:var(--el-color-danger-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-danger-light-5);--el-button-hover-bg-color:var(--el-color-danger-light-3);--el-button-hover-border-color:var(--el-color-danger-light-3);--el-button-active-bg-color:var(--el-color-danger-dark-2);--el-button-active-border-color:var(--el-color-danger-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-danger-light-5);--el-button-disabled-border-color:var(--el-color-danger-light-5)}.el-button--danger.is-link,.el-button--danger.is-plain,.el-button--danger.is-text{--el-button-text-color:var(--el-color-danger);--el-button-bg-color:var(--el-color-danger-light-9);--el-button-border-color:var(--el-color-danger-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-danger);--el-button-hover-border-color:var(--el-color-danger);--el-button-active-text-color:var(--el-color-white)}.el-button--danger.is-link.is-disabled,.el-button--danger.is-link.is-disabled:active,.el-button--danger.is-link.is-disabled:focus,.el-button--danger.is-link.is-disabled:hover,.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover,.el-button--danger.is-text.is-disabled,.el-button--danger.is-text.is-disabled:active,.el-button--danger.is-text.is-disabled:focus,.el-button--danger.is-text.is-disabled:hover{background-color:var(--el-color-danger-light-9);border-color:var(--el-color-danger-light-8);color:var(--el-color-danger-light-5)}.el-button--info{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-info);--el-button-border-color:var(--el-color-info);--el-button-outline-color:var(--el-color-info-light-5);--el-button-active-color:var(--el-color-info-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-info-light-5);--el-button-hover-bg-color:var(--el-color-info-light-3);--el-button-hover-border-color:var(--el-color-info-light-3);--el-button-active-bg-color:var(--el-color-info-dark-2);--el-button-active-border-color:var(--el-color-info-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-info-light-5);--el-button-disabled-border-color:var(--el-color-info-light-5)}.el-button--info.is-link,.el-button--info.is-plain,.el-button--info.is-text{--el-button-text-color:var(--el-color-info);--el-button-bg-color:var(--el-color-info-light-9);--el-button-border-color:var(--el-color-info-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-info);--el-button-hover-border-color:var(--el-color-info);--el-button-active-text-color:var(--el-color-white)}.el-button--info.is-link.is-disabled,.el-button--info.is-link.is-disabled:active,.el-button--info.is-link.is-disabled:focus,.el-button--info.is-link.is-disabled:hover,.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover,.el-button--info.is-text.is-disabled,.el-button--info.is-text.is-disabled:active,.el-button--info.is-text.is-disabled:focus,.el-button--info.is-text.is-disabled:hover{background-color:var(--el-color-info-light-9);border-color:var(--el-color-info-light-8);color:var(--el-color-info-light-5)}.el-button--large{--el-button-size:40px;height:var(--el-button-size)}.el-button--large [class*=el-icon]+span{margin-left:8px}.el-button--large{border-radius:var(--el-border-radius-base);font-size:var(--el-font-size-base);padding:12px 19px}.el-button--large.is-round{padding:12px 19px}.el-button--large.is-circle{padding:12px;width:var(--el-button-size)}.el-button--small{--el-button-size:24px;height:var(--el-button-size)}.el-button--small [class*=el-icon]+span{margin-left:4px}.el-button--small{border-radius:calc(var(--el-border-radius-base) - 1px);font-size:12px;padding:5px 11px}.el-button--small.is-round{padding:5px 11px}.el-button--small.is-circle{padding:5px;width:var(--el-button-size)}'; importCSS(elButtonCss); var _unsafeWindow = (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)(); const c = window.console; const origConsole = (() => { return { log: c.log.bind(c), warn: c.warn.bind(c), info: c.info.bind(c), error: c.error.bind(c), debug: c.debug.bind(c) }; })(); const origFetch = _unsafeWindow.fetch; const hooks = []; const registerRequestHook = (pattern, callback, once = false) => { hooks.push({ pattern, callback, once }); origConsole.log("[hookRequest] 注册 hook:", pattern, once ? "(once)" : ""); }; if (!_unsafeWindow.__requestHooked__) { _unsafeWindow.__requestHooked__ = true; _unsafeWindow.fetch = async (...args) => { const [resource] = args; const url = typeof resource === "string" ? resource : resource.url; const matchedHooks = hooks.filter((h) => h.pattern.test(url)); if (matchedHooks.length === 0) return origFetch(...args); origConsole.log("[hookRequest] 捕获 fetch 请求:", url); const response = await origFetch(...args); const cloned = response.clone(); matchedHooks.forEach((h) => { cloned.clone().json().then( (json) => { try { h.callback(json, response, url, "fetch"); } catch (err2) { origConsole.error("[hookRequest] fetch 回调错误:", err2); } if (h.once) removeHook(h); }, () => { } ); }); return response; }; const OrigXHR = _unsafeWindow.XMLHttpRequest; class HookedXHR extends OrigXHR { constructor() { super(); this._url = null; const origOpen = this.open; this.open = function(method, url, ...rest) { this._url = url; return origOpen.call(this, method, url, ...rest); }; const origSend = this.send; this.send = function(...args) { this.addEventListener("load", () => { try { const matchedHooks = hooks.filter((h) => h.pattern.test(this._url)); if (matchedHooks.length === 0) return; origConsole.log("[hookRequest] 捕获 XHR 请求:", this._url); let json = null; try { json = JSON.parse(this.responseText); } catch { } matchedHooks.forEach((h) => { try { h.callback(json, this, this._url, "xhr"); } catch (err2) { origConsole.error("[hookRequest] xhr 回调错误:", err2); } if (h.once) removeHook(h); }); } catch (err2) { origConsole.error("[hookRequest] XHR 处理错误:", err2); } }); return origSend.apply(this, args); }; } } _unsafeWindow.XMLHttpRequest = HookedXHR; origConsole.log("[hookRequest] 已挂载 fetch + XHR hook"); } function removeHook(hookObj) { const index = hooks.indexOf(hookObj); if (index !== -1) { hooks.splice(index, 1); origConsole.log("[hookRequest] 已移除一次性 hook:", hookObj.pattern); } } function extractDlsiteId(url) { return url.match(/work\/([A-Z\d]+)\//)?.[1] ?? null; } const WINDOWS_1252_EXTRA = { 128: "€", 130: "‚", 131: "ƒ", 132: "„", 133: "…", 134: "†", 135: "‡", 136: "ˆ", 137: "‰", 138: "Š", 139: "‹", 140: "Œ", 142: "Ž", 145: "‘", 146: "’", 147: "“", 148: "”", 149: "•", 150: "–", 151: "—", 152: "˜", 153: "™", 154: "š", 155: "›", 156: "œ", 158: "ž", 159: "Ÿ" }; for (const [code, char] of Object.entries(WINDOWS_1252_EXTRA)) { } function textDecode(bytes, encoding = "utf-8") { switch (encoding.toLowerCase()) { case "utf-8": case "utf8": if (typeof globalThis.TextDecoder !== "undefined") { return new globalThis.TextDecoder("utf-8").decode(bytes); } return decodeUTF8(bytes); case "utf-16le": return decodeUTF16LE(bytes); case "ascii": return decodeASCII(bytes); case "latin1": case "iso-8859-1": return decodeLatin1(bytes); case "windows-1252": return decodeWindows1252(bytes); default: throw new RangeError(`Encoding '${encoding}' not supported`); } } function decodeUTF8(bytes) { let out = ""; let i = 0; while (i < bytes.length) { const b1 = bytes[i++]; if (b1 < 128) { out += String.fromCharCode(b1); } else if (b1 < 224) { const b2 = bytes[i++] & 63; out += String.fromCharCode((b1 & 31) << 6 | b2); } else if (b1 < 240) { const b2 = bytes[i++] & 63; const b3 = bytes[i++] & 63; out += String.fromCharCode((b1 & 15) << 12 | b2 << 6 | b3); } else { const b2 = bytes[i++] & 63; const b3 = bytes[i++] & 63; const b4 = bytes[i++] & 63; let cp = (b1 & 7) << 18 | b2 << 12 | b3 << 6 | b4; cp -= 65536; out += String.fromCharCode(55296 + (cp >> 10 & 1023), 56320 + (cp & 1023)); } } return out; } function decodeUTF16LE(bytes) { let out = ""; for (let i = 0; i < bytes.length; i += 2) { out += String.fromCharCode(bytes[i] | bytes[i + 1] << 8); } return out; } function decodeASCII(bytes) { return String.fromCharCode(...bytes.map((b) => b & 127)); } function decodeLatin1(bytes) { return String.fromCharCode(...bytes); } function decodeWindows1252(bytes) { let out = ""; for (const b of bytes) { if (b >= 128 && b <= 159 && WINDOWS_1252_EXTRA[b]) { out += WINDOWS_1252_EXTRA[b]; } else { out += String.fromCharCode(b); } } return out; } function dv(array) { return new DataView(array.buffer, array.byteOffset); } const UINT8 = { len: 1, get(array, offset) { return dv(array).getUint8(offset); }, put(array, offset, value) { dv(array).setUint8(offset, value); return offset + 1; } }; const UINT16_LE = { len: 2, get(array, offset) { return dv(array).getUint16(offset, true); }, put(array, offset, value) { dv(array).setUint16(offset, value, true); return offset + 2; } }; const UINT16_BE = { len: 2, get(array, offset) { return dv(array).getUint16(offset); }, put(array, offset, value) { dv(array).setUint16(offset, value); return offset + 2; } }; const UINT32_LE = { len: 4, get(array, offset) { return dv(array).getUint32(offset, true); }, put(array, offset, value) { dv(array).setUint32(offset, value, true); return offset + 4; } }; const UINT32_BE = { len: 4, get(array, offset) { return dv(array).getUint32(offset); }, put(array, offset, value) { dv(array).setUint32(offset, value); return offset + 4; } }; const INT32_BE = { len: 4, get(array, offset) { return dv(array).getInt32(offset); }, put(array, offset, value) { dv(array).setInt32(offset, value); return offset + 4; } }; const UINT64_LE = { len: 8, get(array, offset) { return dv(array).getBigUint64(offset, true); }, put(array, offset, value) { dv(array).setBigUint64(offset, value, true); return offset + 8; } }; class StringType { constructor(len, encoding) { this.len = len; this.encoding = encoding; } get(data, offset = 0) { const bytes = data.subarray(offset, offset + this.len); return textDecode(bytes, this.encoding); } } const defaultMessages = "End-Of-Stream"; class EndOfStreamError extends Error { constructor() { super(defaultMessages); this.name = "EndOfStreamError"; } } class AbortError extends Error { constructor(message = "The operation was aborted") { super(message); this.name = "AbortError"; } } class AbstractStreamReader { constructor() { this.endOfStream = false; this.interrupted = false; this.peekQueue = []; } async peek(uint8Array, mayBeLess = false) { const bytesRead = await this.read(uint8Array, mayBeLess); this.peekQueue.push(uint8Array.subarray(0, bytesRead)); return bytesRead; } async read(buffer, mayBeLess = false) { if (buffer.length === 0) { return 0; } let bytesRead = this.readFromPeekBuffer(buffer); if (!this.endOfStream) { bytesRead += await this.readRemainderFromStream(buffer.subarray(bytesRead), mayBeLess); } if (bytesRead === 0 && !mayBeLess) { throw new EndOfStreamError(); } return bytesRead; } readFromPeekBuffer(buffer) { let remaining = buffer.length; let bytesRead = 0; while (this.peekQueue.length > 0 && remaining > 0) { const peekData = this.peekQueue.pop(); if (!peekData) throw new Error("peekData should be defined"); const lenCopy = Math.min(peekData.length, remaining); buffer.set(peekData.subarray(0, lenCopy), bytesRead); bytesRead += lenCopy; remaining -= lenCopy; if (lenCopy < peekData.length) { this.peekQueue.push(peekData.subarray(lenCopy)); } } return bytesRead; } async readRemainderFromStream(buffer, mayBeLess) { let bytesRead = 0; while (bytesRead < buffer.length && !this.endOfStream) { if (this.interrupted) { throw new AbortError(); } const chunkLen = await this.readFromStream(buffer.subarray(bytesRead), mayBeLess); if (chunkLen === 0) break; bytesRead += chunkLen; } if (!mayBeLess && bytesRead < buffer.length) { throw new EndOfStreamError(); } return bytesRead; } } class WebStreamReader extends AbstractStreamReader { constructor(reader) { super(); this.reader = reader; } async abort() { return this.close(); } async close() { this.reader.releaseLock(); } } class WebStreamByobReader extends WebStreamReader { async readFromStream(buffer, mayBeLess) { if (buffer.length === 0) return 0; const result = await this.reader.read(new Uint8Array(buffer.length), { min: mayBeLess ? void 0 : buffer.length }); if (result.done) { this.endOfStream = result.done; } if (result.value) { buffer.set(result.value); return result.value.length; } return 0; } } class WebStreamDefaultReader extends AbstractStreamReader { constructor(reader) { super(); this.reader = reader; this.buffer = null; } writeChunk(target, chunk) { const written = Math.min(chunk.length, target.length); target.set(chunk.subarray(0, written)); if (written < chunk.length) { this.buffer = chunk.subarray(written); } else { this.buffer = null; } return written; } async readFromStream(buffer, mayBeLess) { if (buffer.length === 0) return 0; let totalBytesRead = 0; if (this.buffer) { totalBytesRead += this.writeChunk(buffer, this.buffer); } while (totalBytesRead < buffer.length && !this.endOfStream) { const result = await this.reader.read(); if (result.done) { this.endOfStream = true; break; } if (result.value) { totalBytesRead += this.writeChunk(buffer.subarray(totalBytesRead), result.value); } } if (!mayBeLess && totalBytesRead === 0 && this.endOfStream) { throw new EndOfStreamError(); } return totalBytesRead; } abort() { this.interrupted = true; return this.reader.cancel(); } async close() { await this.abort(); this.reader.releaseLock(); } } function makeWebStreamReader(stream) { try { const reader = stream.getReader({ mode: "byob" }); if (reader instanceof ReadableStreamDefaultReader) { return new WebStreamDefaultReader(reader); } return new WebStreamByobReader(reader); } catch (error) { if (error instanceof TypeError) { return new WebStreamDefaultReader(stream.getReader()); } throw error; } } class AbstractTokenizer { constructor(options) { this.numBuffer = new Uint8Array(8); this.position = 0; this.onClose = options?.onClose; if (options?.abortSignal) { options.abortSignal.addEventListener("abort", () => { this.abort(); }); } } async readToken(token, position = this.position) { const uint8Array = new Uint8Array(token.len); const len = await this.readBuffer(uint8Array, { position }); if (len < token.len) throw new EndOfStreamError(); return token.get(uint8Array, 0); } async peekToken(token, position = this.position) { const uint8Array = new Uint8Array(token.len); const len = await this.peekBuffer(uint8Array, { position }); if (len < token.len) throw new EndOfStreamError(); return token.get(uint8Array, 0); } async readNumber(token) { const len = await this.readBuffer(this.numBuffer, { length: token.len }); if (len < token.len) throw new EndOfStreamError(); return token.get(this.numBuffer, 0); } async peekNumber(token) { const len = await this.peekBuffer(this.numBuffer, { length: token.len }); if (len < token.len) throw new EndOfStreamError(); return token.get(this.numBuffer, 0); } async ignore(length) { if (this.fileInfo.size !== void 0) { const bytesLeft = this.fileInfo.size - this.position; if (length > bytesLeft) { this.position += bytesLeft; return bytesLeft; } } this.position += length; return length; } async close() { await this.abort(); await this.onClose?.(); } normalizeOptions(uint8Array, options) { if (!this.supportsRandomAccess() && options && options.position !== void 0 && options.position < this.position) { throw new Error("`options.position` must be equal or greater than `tokenizer.position`"); } return { ...{ mayBeLess: false, offset: 0, length: uint8Array.length, position: this.position }, ...options }; } abort() { return Promise.resolve(); } } const maxBufferSize = 256e3; class ReadStreamTokenizer extends AbstractTokenizer { constructor(streamReader, options) { super(options); this.streamReader = streamReader; this.fileInfo = options?.fileInfo ?? {}; } async readBuffer(uint8Array, options) { const normOptions = this.normalizeOptions(uint8Array, options); const skipBytes = normOptions.position - this.position; if (skipBytes > 0) { await this.ignore(skipBytes); return this.readBuffer(uint8Array, options); } if (skipBytes < 0) { throw new Error("`options.position` must be equal or greater than `tokenizer.position`"); } if (normOptions.length === 0) { return 0; } const bytesRead = await this.streamReader.read(uint8Array.subarray(0, normOptions.length), normOptions.mayBeLess); this.position += bytesRead; if ((!options || !options.mayBeLess) && bytesRead < normOptions.length) { throw new EndOfStreamError(); } return bytesRead; } async peekBuffer(uint8Array, options) { const normOptions = this.normalizeOptions(uint8Array, options); let bytesRead = 0; if (normOptions.position) { const skipBytes = normOptions.position - this.position; if (skipBytes > 0) { const skipBuffer = new Uint8Array(normOptions.length + skipBytes); bytesRead = await this.peekBuffer(skipBuffer, { mayBeLess: normOptions.mayBeLess }); uint8Array.set(skipBuffer.subarray(skipBytes)); return bytesRead - skipBytes; } if (skipBytes < 0) { throw new Error("Cannot peek from a negative offset in a stream"); } } if (normOptions.length > 0) { try { bytesRead = await this.streamReader.peek(uint8Array.subarray(0, normOptions.length), normOptions.mayBeLess); } catch (err2) { if (options?.mayBeLess && err2 instanceof EndOfStreamError) { return 0; } throw err2; } if (!normOptions.mayBeLess && bytesRead < normOptions.length) { throw new EndOfStreamError(); } } return bytesRead; } async ignore(length) { const bufSize = Math.min(maxBufferSize, length); const buf = new Uint8Array(bufSize); let totBytesRead = 0; while (totBytesRead < length) { const remaining = length - totBytesRead; const bytesRead = await this.readBuffer(buf, { length: Math.min(bufSize, remaining) }); if (bytesRead < 0) { return bytesRead; } totBytesRead += bytesRead; } return totBytesRead; } abort() { return this.streamReader.abort(); } async close() { return this.streamReader.close(); } supportsRandomAccess() { return false; } } class BufferTokenizer extends AbstractTokenizer { constructor(uint8Array, options) { super(options); this.uint8Array = uint8Array; this.fileInfo = { ...options?.fileInfo ?? {}, ...{ size: uint8Array.length } }; } async readBuffer(uint8Array, options) { if (options?.position) { this.position = options.position; } const bytesRead = await this.peekBuffer(uint8Array, options); this.position += bytesRead; return bytesRead; } async peekBuffer(uint8Array, options) { const normOptions = this.normalizeOptions(uint8Array, options); const bytes2read = Math.min(this.uint8Array.length - normOptions.position, normOptions.length); if (!normOptions.mayBeLess && bytes2read < normOptions.length) { throw new EndOfStreamError(); } uint8Array.set(this.uint8Array.subarray(normOptions.position, normOptions.position + bytes2read)); return bytes2read; } close() { return super.close(); } supportsRandomAccess() { return true; } setPosition(position) { this.position = position; } } function fromWebStream(webStream, options) { const webStreamReader = makeWebStreamReader(webStream); const _options = options ?? {}; const chainedClose = _options.onClose; _options.onClose = async () => { await webStreamReader.close(); if (chainedClose) { return chainedClose(); } }; return new ReadStreamTokenizer(webStreamReader, _options); } function fromBuffer(uint8Array, options) { return new BufferTokenizer(uint8Array, options); } var ch2 = {}; var wk = (function(c2, id, msg, transfer, cb) { var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([ c2 + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})' ], { type: "text/javascript" })))); w.onmessage = function(e) { var d = e.data, ed = d.$e$; if (ed) { var err2 = new Error(ed[0]); err2["code"] = ed[1]; err2.stack = ed[2]; cb(err2, null); } else cb(null, d); }; w.postMessage(msg, transfer); return w; }); var u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array; var fleb = new u8([ 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, 0, 0, 0 ]); var fdeb = new u8([ 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, 0, 0 ]); var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]); var freb = function(eb, start) { var b = new u16(31); for (var i = 0; i < 31; ++i) { b[i] = start += 1 << eb[i - 1]; } var r = new i32(b[30]); for (var i = 1; i < 30; ++i) { for (var j = b[i]; j < b[i + 1]; ++j) { r[j] = j - b[i] << 5 | i; } } return { b, r }; }; var _a = freb(fleb, 2), fl = _a.b, revfl = _a.r; fl[28] = 258, revfl[258] = 28; var _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r; var rev = new u16(32768); for (var i = 0; i < 32768; ++i) { var x = (i & 43690) >> 1 | (i & 21845) << 1; x = (x & 52428) >> 2 | (x & 13107) << 2; x = (x & 61680) >> 4 | (x & 3855) << 4; rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1; } var hMap = (function(cd, mb, r) { var s = cd.length; var i = 0; var l = new u16(mb); for (; i < s; ++i) { if (cd[i]) ++l[cd[i] - 1]; } var le = new u16(mb); for (i = 1; i < mb; ++i) { le[i] = le[i - 1] + l[i - 1] << 1; } var co; if (r) { co = new u16(1 << mb); var rvb = 15 - mb; for (i = 0; i < s; ++i) { if (cd[i]) { var sv = i << 4 | cd[i]; var r_1 = mb - cd[i]; var v = le[cd[i] - 1]++ << r_1; for (var m = v | (1 << r_1) - 1; v <= m; ++v) { co[rev[v] >> rvb] = sv; } } } } else { co = new u16(s); for (i = 0; i < s; ++i) { if (cd[i]) { co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i]; } } } return co; }); var flt = new u8(288); for (var i = 0; i < 144; ++i) flt[i] = 8; for (var i = 144; i < 256; ++i) flt[i] = 9; for (var i = 256; i < 280; ++i) flt[i] = 7; for (var i = 280; i < 288; ++i) flt[i] = 8; var fdt = new u8(32); for (var i = 0; i < 32; ++i) fdt[i] = 5; var flm = hMap(flt, 9, 0), flrm = hMap(flt, 9, 1); var fdm = hMap(fdt, 5, 0), fdrm = hMap(fdt, 5, 1); var max = function(a) { var m = a[0]; for (var i = 1; i < a.length; ++i) { if (a[i] > m) m = a[i]; } return m; }; var bits = function(d, p, m) { var o = p / 8 | 0; return (d[o] | d[o + 1] << 8) >> (p & 7) & m; }; var bits16 = function(d, p) { var o = p / 8 | 0; return (d[o] | d[o + 1] << 8 | d[o + 2] << 16) >> (p & 7); }; var shft = function(p) { return (p + 7) / 8 | 0; }; var slc = function(v, s, e) { if (s == null || s < 0) s = 0; if (e == null || e > v.length) e = v.length; return new u8(v.subarray(s, e)); }; var ec = [ "unexpected EOF", "invalid block type", "invalid length/literal", "invalid distance", "stream finished", "no stream handler", , "no callback", "invalid UTF-8 data", "extra field too long", "date not in range 1980-2099", "filename too long", "stream finishing", "invalid zip data" ]; var err = function(ind, msg, nt) { var e = new Error(msg || ec[ind]); e.code = ind; if (Error.captureStackTrace) Error.captureStackTrace(e, err); if (!nt) throw e; return e; }; var inflt = function(dat, st, buf, dict) { var sl = dat.length, dl = 0; if (!sl || st.f && !st.l) return buf || new u8(0); var noBuf = !buf; var resize = noBuf || st.i != 2; var noSt = st.i; if (noBuf) buf = new u8(sl * 3); var cbuf = function(l2) { var bl = buf.length; if (l2 > bl) { var nbuf = new u8(Math.max(bl * 2, l2)); nbuf.set(buf); buf = nbuf; } }; var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n; var tbts = sl * 8; do { if (!lm) { final = bits(dat, pos, 1); var type = bits(dat, pos + 1, 3); pos += 3; if (!type) { var s = shft(pos) + 4, l = dat[s - 4] | dat[s - 3] << 8, t = s + l; if (t > sl) { if (noSt) err(0); break; } if (resize) cbuf(bt + l); buf.set(dat.subarray(s, t), bt); st.b = bt += l, st.p = pos = t * 8, st.f = final; continue; } else if (type == 1) lm = flrm, dm = fdrm, lbt = 9, dbt = 5; else if (type == 2) { var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4; var tl = hLit + bits(dat, pos + 5, 31) + 1; pos += 14; var ldt = new u8(tl); var clt = new u8(19); for (var i = 0; i < hcLen; ++i) { clt[clim[i]] = bits(dat, pos + i * 3, 7); } pos += hcLen * 3; var clb = max(clt), clbmsk = (1 << clb) - 1; var clm = hMap(clt, clb, 1); for (var i = 0; i < tl; ) { var r = clm[bits(dat, pos, clbmsk)]; pos += r & 15; var s = r >> 4; if (s < 16) { ldt[i++] = s; } else { var c2 = 0, n = 0; if (s == 16) n = 3 + bits(dat, pos, 3), pos += 2, c2 = ldt[i - 1]; else if (s == 17) n = 3 + bits(dat, pos, 7), pos += 3; else if (s == 18) n = 11 + bits(dat, pos, 127), pos += 7; while (n--) ldt[i++] = c2; } } var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit); lbt = max(lt); dbt = max(dt); lm = hMap(lt, lbt, 1); dm = hMap(dt, dbt, 1); } else err(1); if (pos > tbts) { if (noSt) err(0); break; } } if (resize) cbuf(bt + 131072); var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1; var lpos = pos; for (; ; lpos = pos) { var c2 = lm[bits16(dat, pos) & lms], sym = c2 >> 4; pos += c2 & 15; if (pos > tbts) { if (noSt) err(0); break; } if (!c2) err(2); if (sym < 256) buf[bt++] = sym; else if (sym == 256) { lpos = pos, lm = null; break; } else { var add = sym - 254; if (sym > 264) { var i = sym - 257, b = fleb[i]; add = bits(dat, pos, (1 << b) - 1) + fl[i]; pos += b; } var d = dm[bits16(dat, pos) & dms], dsym = d >> 4; if (!d) err(3); pos += d & 15; var dt = fd[dsym]; if (dsym > 3) { var b = fdeb[dsym]; dt += bits16(dat, pos) & (1 << b) - 1, pos += b; } if (pos > tbts) { if (noSt) err(0); break; } if (resize) cbuf(bt + 131072); var end = bt + add; if (bt < dt) { var shift = dl - dt, dend = Math.min(dt, end); if (shift + bt < 0) err(3); for (; bt < dend; ++bt) buf[bt] = dict[shift + bt]; } for (; bt < end; ++bt) buf[bt] = buf[bt - dt]; } } st.l = lm, st.p = lpos, st.b = bt, st.f = final; if (lm) final = 1, st.m = lbt, st.d = dm, st.n = dbt; } while (!final); return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt); }; var wbits = function(d, p, v) { v <<= p & 7; var o = p / 8 | 0; d[o] |= v; d[o + 1] |= v >> 8; }; var wbits16 = function(d, p, v) { v <<= p & 7; var o = p / 8 | 0; d[o] |= v; d[o + 1] |= v >> 8; d[o + 2] |= v >> 16; }; var hTree = function(d, mb) { var t = []; for (var i = 0; i < d.length; ++i) { if (d[i]) t.push({ s: i, f: d[i] }); } var s = t.length; var t2 = t.slice(); if (!s) return { t: et, l: 0 }; if (s == 1) { var v = new u8(t[0].s + 1); v[t[0].s] = 1; return { t: v, l: 1 }; } t.sort(function(a, b) { return a.f - b.f; }); t.push({ s: -1, f: 25001 }); var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2; t[0] = { s: -1, f: l.f + r.f, l, r }; while (i1 != s - 1) { l = t[t[i0].f < t[i2].f ? i0++ : i2++]; r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++]; t[i1++] = { s: -1, f: l.f + r.f, l, r }; } var maxSym = t2[0].s; for (var i = 1; i < s; ++i) { if (t2[i].s > maxSym) maxSym = t2[i].s; } var tr = new u16(maxSym + 1); var mbt = ln(t[i1 - 1], tr, 0); if (mbt > mb) { var i = 0, dt = 0; var lft = mbt - mb, cst = 1 << lft; t2.sort(function(a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; }); for (; i < s; ++i) { var i2_1 = t2[i].s; if (tr[i2_1] > mb) { dt += cst - (1 << mbt - tr[i2_1]); tr[i2_1] = mb; } else break; } dt >>= lft; while (dt > 0) { var i2_2 = t2[i].s; if (tr[i2_2] < mb) dt -= 1 << mb - tr[i2_2]++ - 1; else ++i; } for (; i >= 0 && dt; --i) { var i2_3 = t2[i].s; if (tr[i2_3] == mb) { --tr[i2_3]; ++dt; } } mbt = mb; } return { t: new u8(tr), l: mbt }; }; var ln = function(n, l, d) { return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d; }; var lc = function(c2) { var s = c2.length; while (s && !c2[--s]) ; var cl = new u16(++s); var cli = 0, cln = c2[0], cls = 1; var w = function(v) { cl[cli++] = v; }; for (var i = 1; i <= s; ++i) { if (c2[i] == cln && i != s) ++cls; else { if (!cln && cls > 2) { for (; cls > 138; cls -= 138) w(32754); if (cls > 2) { w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305); cls = 0; } } else if (cls > 3) { w(cln), --cls; for (; cls > 6; cls -= 6) w(8304); if (cls > 2) w(cls - 3 << 5 | 8208), cls = 0; } while (cls--) w(cln); cls = 1; cln = c2[i]; } } return { c: cl.subarray(0, cli), n: s }; }; var clen = function(cf, cl) { var l = 0; for (var i = 0; i < cl.length; ++i) l += cf[i] * cl[i]; return l; }; var wfblk = function(out, pos, dat) { var s = dat.length; var o = shft(pos + 2); out[o] = s & 255; out[o + 1] = s >> 8; out[o + 2] = out[o] ^ 255; out[o + 3] = out[o + 1] ^ 255; for (var i = 0; i < s; ++i) out[o + i + 4] = dat[i]; return (o + 4 + s) * 8; }; var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) { wbits(out, p++, final); ++lf[256]; var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l; var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l; var _c = lc(dlt), lclt = _c.c, nlc = _c.n; var _d = lc(ddt), lcdt = _d.c, ndc = _d.n; var lcfreq = new u16(19); for (var i = 0; i < lclt.length; ++i) ++lcfreq[lclt[i] & 31]; for (var i = 0; i < lcdt.length; ++i) ++lcfreq[lcdt[i] & 31]; var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l; var nlcc = 19; for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc) ; var flen = bl + 5 << 3; var ftlen = clen(lf, flt) + clen(df, fdt) + eb; var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18]; if (bs >= 0 && flen <= ftlen && flen <= dtlen) return wfblk(out, p, dat.subarray(bs, bs + bl)); var lm, ll, dm, dl; wbits(out, p, 1 + (dtlen < ftlen)), p += 2; if (dtlen < ftlen) { lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt; var llm = hMap(lct, mlcb, 0); wbits(out, p, nlc - 257); wbits(out, p + 5, ndc - 1); wbits(out, p + 10, nlcc - 4); p += 14; for (var i = 0; i < nlcc; ++i) wbits(out, p + 3 * i, lct[clim[i]]); p += 3 * nlcc; var lcts = [lclt, lcdt]; for (var it = 0; it < 2; ++it) { var clct = lcts[it]; for (var i = 0; i < clct.length; ++i) { var len = clct[i] & 31; wbits(out, p, llm[len]), p += lct[len]; if (len > 15) wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12; } } } else { lm = flm, ll = flt, dm = fdm, dl = fdt; } for (var i = 0; i < li; ++i) { var sym = syms[i]; if (sym > 255) { var len = sym >> 18 & 31; wbits16(out, p, lm[len + 257]), p += ll[len + 257]; if (len > 7) wbits(out, p, sym >> 23 & 31), p += fleb[len]; var dst = sym & 31; wbits16(out, p, dm[dst]), p += dl[dst]; if (dst > 3) wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst]; } else { wbits16(out, p, lm[sym]), p += ll[sym]; } } wbits16(out, p, lm[256]); return p + ll[256]; }; var deo = new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]); var et = new u8(0); var dflt = function(dat, lvl, plvl, pre, post, st) { var s = st.z || dat.length; var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post); var w = o.subarray(pre, o.length - post); var lst = st.l; var pos = (st.r || 0) & 7; if (lvl) { if (pos) w[0] = st.r >> 3; var opt = deo[lvl - 1]; var n = opt >> 13, c2 = opt & 8191; var msk_1 = (1 << plvl) - 1; var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1); var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1; var hsh = function(i2) { return (dat[i2] ^ dat[i2 + 1] << bs1_1 ^ dat[i2 + 2] << bs2_1) & msk_1; }; var syms = new i32(25e3); var lf = new u16(288), df = new u16(32); var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0; for (; i + 2 < s; ++i) { var hv = hsh(i); var imod = i & 32767, pimod = head[hv]; prev[imod] = pimod; head[hv] = imod; if (wi <= i) { var rem = s - i; if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) { pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos); li = lc_1 = eb = 0, bs = i; for (var j = 0; j < 286; ++j) lf[j] = 0; for (var j = 0; j < 30; ++j) df[j] = 0; } var l = 2, d = 0, ch_1 = c2, dif = imod - pimod & 32767; if (rem > 2 && hv == hsh(i - dif)) { var maxn = Math.min(n, rem) - 1; var maxd = Math.min(32767, i); var ml = Math.min(258, rem); while (dif <= maxd && --ch_1 && imod != pimod) { if (dat[i + l] == dat[i + l - dif]) { var nl = 0; for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl) ; if (nl > l) { l = nl, d = dif; if (nl > maxn) break; var mmd = Math.min(dif, nl - 2); var md = 0; for (var j = 0; j < mmd; ++j) { var ti = i - dif + j & 32767; var pti = prev[ti]; var cd = ti - pti & 32767; if (cd > md) md = cd, pimod = ti; } } } imod = pimod, pimod = prev[imod]; dif += imod - pimod & 32767; } } if (d) { syms[li++] = 268435456 | revfl[l] << 18 | revfd[d]; var lin = revfl[l] & 31, din = revfd[d] & 31; eb += fleb[lin] + fdeb[din]; ++lf[257 + lin]; ++df[din]; wi = i + l; ++lc_1; } else { syms[li++] = dat[i]; ++lf[dat[i]]; } } } for (i = Math.max(i, wi); i < s; ++i) { syms[li++] = dat[i]; ++lf[dat[i]]; } pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos); if (!lst) { st.r = pos & 7 | w[pos / 8 | 0] << 3; pos -= 7; st.h = head, st.p = prev, st.i = i, st.w = wi; } } else { for (var i = st.w || 0; i < s + lst; i += 65535) { var e = i + 65535; if (e >= s) { w[pos / 8 | 0] = lst; e = s; } pos = wfblk(w, pos + 1, dat.subarray(i, e)); } st.i = s; } return slc(o, 0, pre + shft(pos) + post); }; var crct = (function() { var t = new Int32Array(256); for (var i = 0; i < 256; ++i) { var c2 = i, k = 9; while (--k) c2 = (c2 & 1 && -306674912) ^ c2 >>> 1; t[i] = c2; } return t; })(); var crc = function() { var c2 = -1; return { p: function(d) { var cr = c2; for (var i = 0; i < d.length; ++i) cr = crct[cr & 255 ^ d[i]] ^ cr >>> 8; c2 = cr; }, d: function() { return ~c2; } }; }; var dopt = function(dat, opt, pre, post, st) { if (!st) { st = { l: 1 }; if (opt.dictionary) { var dict = opt.dictionary.subarray(-32768); var newDat = new u8(dict.length + dat.length); newDat.set(dict); newDat.set(dat, dict.length); dat = newDat; st.w = dict.length; } } return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st); }; var mrg = function(a, b) { var o = {}; for (var k in a) o[k] = a[k]; for (var k in b) o[k] = b[k]; return o; }; var wcln = function(fn, fnStr, td2) { var dt = fn(); var st = fn.toString(); var ks = st.slice(st.indexOf("[") + 1, st.lastIndexOf("]")).replace(/\s+/g, "").split(","); for (var i = 0; i < dt.length; ++i) { var v = dt[i], k = ks[i]; if (typeof v == "function") { fnStr += ";" + k + "="; var st_1 = v.toString(); if (v.prototype) { if (st_1.indexOf("[native code]") != -1) { var spInd = st_1.indexOf(" ", 8) + 1; fnStr += st_1.slice(spInd, st_1.indexOf("(", spInd)); } else { fnStr += st_1; for (var t in v.prototype) fnStr += ";" + k + ".prototype." + t + "=" + v.prototype[t].toString(); } } else fnStr += st_1; } else td2[k] = v; } return fnStr; }; var ch = []; var cbfs = function(v) { var tl = []; for (var k in v) { if (v[k].buffer) { tl.push((v[k] = new v[k].constructor(v[k])).buffer); } } return tl; }; var wrkr = function(fns, init, id, cb) { if (!ch[id]) { var fnStr = "", td_1 = {}, m = fns.length - 1; for (var i = 0; i < m; ++i) fnStr = wcln(fns[i], fnStr, td_1); ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 }; } var td2 = mrg({}, ch[id].e); return wk(ch[id].c + ";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=" + init.toString() + "}", id, td2, cbfs(td2), cb); }; var bDflt = function() { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; }; var pbf = function(msg) { return postMessage(msg, [msg.buffer]); }; var cbify = function(dat, opts, fns, init, id, cb) { var w = wrkr(fns, init, id, function(err2, dat2) { w.terminate(); cb(err2, dat2); }); w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []); return function() { w.terminate(); }; }; var wbytes = function(d, b, v) { for (; v; ++b) d[b] = v, v >>>= 8; }; var gzs = function(d) { if (d[0] != 31 || d[1] != 139 || d[2] != 8) err(6, "invalid gzip data"); var flg = d[3]; var st = 10; if (flg & 4) st += (d[10] | d[11] << 8) + 2; for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++]) ; return st + (flg & 2); }; var gzl = function(d) { var l = d.length; return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0; }; var zls = function(d, dict) { if ((d[0] & 15) != 8 || d[0] >> 4 > 7 || (d[0] << 8 | d[1]) % 31) err(6, "invalid zlib data"); if ((d[1] >> 5 & 1) == 1) err(6, "invalid zlib data: " + (d[1] & 32 ? "need" : "unexpected") + " dictionary"); return (d[1] >> 3 & 4) + 2; }; function deflate(data, opts, cb) { if (!cb) cb = opts, opts = {}; if (typeof cb != "function") err(7); return cbify(data, opts, [ bDflt ], function(ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb); } function deflateSync(data, opts) { return dopt(data, opts || {}, 0, 0); } function inflateSync(data, opts) { return inflt(data, { i: 2 }, opts, opts); } function gunzipSync(data, opts) { var st = gzs(data); if (st + 8 > data.length) err(6, "invalid gzip data"); return inflt(data.subarray(st, -8), { i: 2 }, new u8(gzl(data)), opts); } function unzlibSync(data, opts) { return inflt(data.subarray(zls(data), -4), { i: 2 }, opts, opts); } function decompressSync(data, opts) { return data[0] == 31 && data[1] == 139 && data[2] == 8 ? gunzipSync(data, opts) : (data[0] & 15) != 8 || data[0] >> 4 > 7 || (data[0] << 8 | data[1]) % 31 ? inflateSync(data, opts) : unzlibSync(data, opts); } var fltn = function(d, p, t, o) { for (var k in d) { var val = d[k], n = p + k, op = o; if (Array.isArray(val)) op = mrg(o, val[1]), val = val[0]; if (val instanceof u8) t[n] = [val, op]; else { t[n += "/"] = [new u8(0), op]; fltn(val, n, t, o); } } }; var te = typeof TextEncoder != "undefined" && new TextEncoder(); var td = typeof TextDecoder != "undefined" && new TextDecoder(); var tds = 0; try { td.decode(et, { stream: true }); tds = 1; } catch (e) { } function strToU8(str, latin1) { var i; if (te) return te.encode(str); var l = str.length; var ar = new u8(str.length + (str.length >> 1)); var ai = 0; var w = function(v) { ar[ai++] = v; }; for (var i = 0; i < l; ++i) { if (ai + 5 > ar.length) { var n = new u8(ai + 8 + (l - i << 1)); n.set(ar); ar = n; } var c2 = str.charCodeAt(i); if (c2 < 128 || latin1) w(c2); else if (c2 < 2048) w(192 | c2 >> 6), w(128 | c2 & 63); else if (c2 > 55295 && c2 < 57344) c2 = 65536 + (c2 & 1023 << 10) | str.charCodeAt(++i) & 1023, w(240 | c2 >> 18), w(128 | c2 >> 12 & 63), w(128 | c2 >> 6 & 63), w(128 | c2 & 63); else w(224 | c2 >> 12), w(128 | c2 >> 6 & 63), w(128 | c2 & 63); } return slc(ar, 0, ai); } var exfl = function(ex) { var le = 0; if (ex) { for (var k in ex) { var l = ex[k].length; if (l > 65535) err(9); le += l + 4; } } return le; }; var wzh = function(d, b, f, fn, u, c2, ce, co) { var fl2 = fn.length, ex = f.extra, col = co && co.length; var exl = exfl(ex); wbytes(d, b, ce != null ? 33639248 : 67324752), b += 4; if (ce != null) d[b++] = 20, d[b++] = f.os; d[b] = 20, b += 2; d[b++] = f.flag << 1 | (c2 < 0 && 8), d[b++] = u && 8; d[b++] = f.compression & 255, d[b++] = f.compression >> 8; var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980; if (y < 0 || y > 119) err(10); wbytes(d, b, y << 25 | dt.getMonth() + 1 << 21 | dt.getDate() << 16 | dt.getHours() << 11 | dt.getMinutes() << 5 | dt.getSeconds() >> 1), b += 4; if (c2 != -1) { wbytes(d, b, f.crc); wbytes(d, b + 4, c2 < 0 ? -c2 - 2 : c2); wbytes(d, b + 8, f.size); } wbytes(d, b + 12, fl2); wbytes(d, b + 14, exl), b += 16; if (ce != null) { wbytes(d, b, col); wbytes(d, b + 6, f.attrs); wbytes(d, b + 10, ce), b += 14; } d.set(fn, b); b += fl2; if (exl) { for (var k in ex) { var exf = ex[k], l = exf.length; wbytes(d, b, +k); wbytes(d, b + 2, l); d.set(exf, b + 4), b += 4 + l; } } if (col) d.set(co, b), b += col; return b; }; var wzf = function(o, b, c2, d, e) { wbytes(o, b, 101010256); wbytes(o, b + 8, c2); wbytes(o, b + 10, c2); wbytes(o, b + 12, d); wbytes(o, b + 16, e); }; function zip(data, opts, cb) { if (!cb) cb = opts, opts = {}; if (typeof cb != "function") err(7); var r = {}; fltn(data, "", r, opts); var k = Object.keys(r); var lft = k.length, o = 0, tot = 0; var slft = lft, files = new Array(lft); var term = []; var tAll = function() { for (var i2 = 0; i2 < term.length; ++i2) term[i2](); }; var cbd = function(a, b) { mt(function() { cb(a, b); }); }; mt(function() { cbd = cb; }); var cbf = function() { var out = new u8(tot + 22), oe = o, cdl = tot - o; tot = 0; for (var i2 = 0; i2 < slft; ++i2) { var f = files[i2]; try { var l = f.c.length; wzh(out, tot, f, f.f, f.u, l); var badd = 30 + f.f.length + exfl(f.extra); var loc = tot + badd; out.set(f.c, loc); wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l; } catch (e) { return cbd(e, null); } } wzf(out, o, files.length, cdl, oe); cbd(null, out); }; if (!lft) cbf(); var _loop_1 = function(i2) { var fn = k[i2]; var _a2 = r[fn], file = _a2[0], p = _a2[1]; var c2 = crc(), size = file.length; c2.p(file); var f = strToU8(fn), s = f.length; var com = p.comment, m = com && strToU8(com), ms2 = m && m.length; var exl = exfl(p.extra); var compression = p.level == 0 ? 0 : 8; var cbl = function(e, d) { if (e) { tAll(); cbd(e, null); } else { var l = d.length; files[i2] = mrg(p, { size, crc: c2.d(), c: d, f, m, u: s != fn.length || m && com.length != ms2, compression }); o += 30 + s + exl + l; tot += 76 + 2 * (s + exl) + (ms2 || 0) + l; if (!--lft) cbf(); } }; if (s > 65535) cbl(err(11, 0, 1), null); if (!compression) cbl(null, file); else if (size < 16e4) { try { cbl(null, deflateSync(file, p)); } catch (e) { cbl(e, null); } } else term.push(deflate(file, p, cbl)); }; for (var i = 0; i < slft; ++i) { _loop_1(i); } return tAll; } var mt = typeof queueMicrotask == "function" ? queueMicrotask : typeof setTimeout == "function" ? setTimeout : function(fn) { fn(); }; var browser = { exports: {} }; var ms; var hasRequiredMs; function requireMs() { if (hasRequiredMs) return ms; hasRequiredMs = 1; var s = 1e3; var m = s * 60; var h = m * 60; var d = h * 24; var w = d * 7; var y = d * 365.25; ms = function(val, options) { options = options || {}; var type = typeof val; if (type === "string" && val.length > 0) { return parse(val); } else if (type === "number" && isFinite(val)) { return options.long ? fmtLong(val) : fmtShort(val); } throw new Error( "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) ); }; function parse(str) { str = String(str); if (str.length > 100) { return; } var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( str ); if (!match) { return; } var n = parseFloat(match[1]); var type = (match[2] || "ms").toLowerCase(); switch (type) { case "years": case "year": case "yrs": case "yr": case "y": return n * y; case "weeks": case "week": case "w": return n * w; case "days": case "day": case "d": return n * d; case "hours": case "hour": case "hrs": case "hr": case "h": return n * h; case "minutes": case "minute": case "mins": case "min": case "m": return n * m; case "seconds": case "second": case "secs": case "sec": case "s": return n * s; case "milliseconds": case "millisecond": case "msecs": case "msec": case "ms": return n; default: return void 0; } } function fmtShort(ms2) { var msAbs = Math.abs(ms2); if (msAbs >= d) { return Math.round(ms2 / d) + "d"; } if (msAbs >= h) { return Math.round(ms2 / h) + "h"; } if (msAbs >= m) { return Math.round(ms2 / m) + "m"; } if (msAbs >= s) { return Math.round(ms2 / s) + "s"; } return ms2 + "ms"; } function fmtLong(ms2) { var msAbs = Math.abs(ms2); if (msAbs >= d) { return plural(ms2, msAbs, d, "day"); } if (msAbs >= h) { return plural(ms2, msAbs, h, "hour"); } if (msAbs >= m) { return plural(ms2, msAbs, m, "minute"); } if (msAbs >= s) { return plural(ms2, msAbs, s, "second"); } return ms2 + " ms"; } function plural(ms2, msAbs, n, name) { var isPlural = msAbs >= n * 1.5; return Math.round(ms2 / n) + " " + name + (isPlural ? "s" : ""); } return ms; } var common; var hasRequiredCommon; function requireCommon() { if (hasRequiredCommon) return common; hasRequiredCommon = 1; function setup(env) { createDebug.debug = createDebug; createDebug.default = createDebug; createDebug.coerce = coerce; createDebug.disable = disable; createDebug.enable = enable; createDebug.enabled = enabled; createDebug.humanize = requireMs(); createDebug.destroy = destroy; Object.keys(env).forEach((key) => { createDebug[key] = env[key]; }); createDebug.names = []; createDebug.skips = []; createDebug.formatters = {}; function selectColor(namespace) { let hash = 0; for (let i = 0; i < namespace.length; i++) { hash = (hash << 5) - hash + namespace.charCodeAt(i); hash |= 0; } return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; } createDebug.selectColor = selectColor; function createDebug(namespace) { let prevTime; let enableOverride = null; let namespacesCache; let enabledCache; function debug2(...args) { if (!debug2.enabled) { return; } const self = debug2; const curr = Number( new Date()); const ms2 = curr - (prevTime || curr); self.diff = ms2; self.prev = prevTime; self.curr = curr; prevTime = curr; args[0] = createDebug.coerce(args[0]); if (typeof args[0] !== "string") { args.unshift("%O"); } let index = 0; args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { if (match === "%%") { return "%"; } index++; const formatter = createDebug.formatters[format]; if (typeof formatter === "function") { const val = args[index]; match = formatter.call(self, val); args.splice(index, 1); index--; } return match; }); createDebug.formatArgs.call(self, args); const logFn = self.log || createDebug.log; logFn.apply(self, args); } debug2.namespace = namespace; debug2.useColors = createDebug.useColors(); debug2.color = createDebug.selectColor(namespace); debug2.extend = extend; debug2.destroy = createDebug.destroy; Object.defineProperty(debug2, "enabled", { enumerable: true, configurable: false, get: () => { if (enableOverride !== null) { return enableOverride; } if (namespacesCache !== createDebug.namespaces) { namespacesCache = createDebug.namespaces; enabledCache = createDebug.enabled(namespace); } return enabledCache; }, set: (v) => { enableOverride = v; } }); if (typeof createDebug.init === "function") { createDebug.init(debug2); } return debug2; } function extend(namespace, delimiter) { const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); newDebug.log = this.log; return newDebug; } function enable(namespaces) { createDebug.save(namespaces); createDebug.namespaces = namespaces; createDebug.names = []; createDebug.skips = []; const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean); for (const ns of split) { if (ns[0] === "-") { createDebug.skips.push(ns.slice(1)); } else { createDebug.names.push(ns); } } } function matchesTemplate(search, template) { let searchIndex = 0; let templateIndex = 0; let starIndex = -1; let matchIndex = 0; while (searchIndex < search.length) { if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) { if (template[templateIndex] === "*") { starIndex = templateIndex; matchIndex = searchIndex; templateIndex++; } else { searchIndex++; templateIndex++; } } else if (starIndex !== -1) { templateIndex = starIndex + 1; matchIndex++; searchIndex = matchIndex; } else { return false; } } while (templateIndex < template.length && template[templateIndex] === "*") { templateIndex++; } return templateIndex === template.length; } function disable() { const namespaces = [ ...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace) ].join(","); createDebug.enable(""); return namespaces; } function enabled(name) { for (const skip of createDebug.skips) { if (matchesTemplate(name, skip)) { return false; } } for (const ns of createDebug.names) { if (matchesTemplate(name, ns)) { return true; } } return false; } function coerce(val) { if (val instanceof Error) { return val.stack || val.message; } return val; } function destroy() { console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } createDebug.enable(createDebug.load()); return createDebug; } common = setup; return common; } var hasRequiredBrowser; function requireBrowser() { if (hasRequiredBrowser) return browser.exports; hasRequiredBrowser = 1; (function(module, exports) { var define_process_env_default = {}; exports.formatArgs = formatArgs; exports.save = save; exports.load = load; exports.useColors = useColors; exports.storage = localstorage(); exports.destroy = (() => { let warned = false; return () => { if (!warned) { warned = true; console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); } }; })(); exports.colors = [ "#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33" ]; function useColors() { if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { return true; } if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { return false; } let m; return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } function formatArgs(args) { args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff); if (!this.useColors) { return; } const c2 = "color: " + this.color; args.splice(1, 0, c2, "color: inherit"); let index = 0; let lastC = 0; args[0].replace(/%[a-zA-Z%]/g, (match) => { if (match === "%%") { return; } index++; if (match === "%c") { lastC = index; } }); args.splice(lastC, 0, c2); } exports.log = console.debug || console.log || (() => { }); function save(namespaces) { try { if (namespaces) { exports.storage.setItem("debug", namespaces); } else { exports.storage.removeItem("debug"); } } catch (error) { } } function load() { let r; try { r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG"); } catch (error) { } if (!r && typeof process !== "undefined" && "env" in process) { r = define_process_env_default.DEBUG; } return r; } function localstorage() { try { return localStorage; } catch (error) { } } module.exports = requireCommon()(exports); const { formatters } = module.exports; formatters.j = function(v) { try { return JSON.stringify(v); } catch (error) { return "[UnexpectedJSONParseError]: " + error.message; } }; })(browser, browser.exports); return browser.exports; } var browserExports = requireBrowser(); const initDebug = getDefaultExportFromCjs(browserExports); const Signature = { LocalFileHeader: 67324752, DataDescriptor: 134695760, CentralFileHeader: 33639248, EndOfCentralDirectory: 101010256 }; const DataDescriptor = { get(array) { UINT16_LE.get(array, 6); return { signature: UINT32_LE.get(array, 0), compressedSize: UINT32_LE.get(array, 8), uncompressedSize: UINT32_LE.get(array, 12) }; }, len: 16 }; const LocalFileHeaderToken = { get(array) { const flags = UINT16_LE.get(array, 6); return { signature: UINT32_LE.get(array, 0), minVersion: UINT16_LE.get(array, 4), dataDescriptor: !!(flags & 8), compressedMethod: UINT16_LE.get(array, 8), compressedSize: UINT32_LE.get(array, 18), uncompressedSize: UINT32_LE.get(array, 22), filenameLength: UINT16_LE.get(array, 26), extraFieldLength: UINT16_LE.get(array, 28), filename: null }; }, len: 30 }; const EndOfCentralDirectoryRecordToken = { get(array) { return { signature: UINT32_LE.get(array, 0), nrOfThisDisk: UINT16_LE.get(array, 4), nrOfThisDiskWithTheStart: UINT16_LE.get(array, 6), nrOfEntriesOnThisDisk: UINT16_LE.get(array, 8), nrOfEntriesOfSize: UINT16_LE.get(array, 10), sizeOfCd: UINT32_LE.get(array, 12), offsetOfStartOfCd: UINT32_LE.get(array, 16), zipFileCommentLength: UINT16_LE.get(array, 20) }; }, len: 22 }; const FileHeader = { get(array) { const flags = UINT16_LE.get(array, 8); return { signature: UINT32_LE.get(array, 0), minVersion: UINT16_LE.get(array, 6), dataDescriptor: !!(flags & 8), compressedMethod: UINT16_LE.get(array, 10), compressedSize: UINT32_LE.get(array, 20), uncompressedSize: UINT32_LE.get(array, 24), filenameLength: UINT16_LE.get(array, 28), extraFieldLength: UINT16_LE.get(array, 30), fileCommentLength: UINT16_LE.get(array, 32), relativeOffsetOfLocalHeader: UINT32_LE.get(array, 42), filename: null }; }, len: 46 }; function signatureToArray(signature) { const signatureBytes = new Uint8Array(UINT32_LE.len); UINT32_LE.put(signatureBytes, 0, signature); return signatureBytes; } const debug = initDebug("tokenizer:inflate"); const syncBufferSize = 256 * 1024; const ddSignatureArray = signatureToArray(Signature.DataDescriptor); const eocdSignatureBytes = signatureToArray(Signature.EndOfCentralDirectory); class ZipHandler { constructor(tokenizer) { this.tokenizer = tokenizer; this.syncBuffer = new Uint8Array(syncBufferSize); } async isZip() { return await this.peekSignature() === Signature.LocalFileHeader; } peekSignature() { return this.tokenizer.peekToken(UINT32_LE); } async findEndOfCentralDirectoryLocator() { const randomReadTokenizer = this.tokenizer; const chunkLength = Math.min(16 * 1024, randomReadTokenizer.fileInfo.size); const buffer = this.syncBuffer.subarray(0, chunkLength); await this.tokenizer.readBuffer(buffer, { position: randomReadTokenizer.fileInfo.size - chunkLength }); for (let i = buffer.length - 4; i >= 0; i--) { if (buffer[i] === eocdSignatureBytes[0] && buffer[i + 1] === eocdSignatureBytes[1] && buffer[i + 2] === eocdSignatureBytes[2] && buffer[i + 3] === eocdSignatureBytes[3]) { return randomReadTokenizer.fileInfo.size - chunkLength + i; } } return -1; } async readCentralDirectory() { if (!this.tokenizer.supportsRandomAccess()) { debug("Cannot reading central-directory without random-read support"); return; } debug("Reading central-directory..."); const pos = this.tokenizer.position; const offset = await this.findEndOfCentralDirectoryLocator(); if (offset > 0) { debug("Central-directory 32-bit signature found"); const eocdHeader = await this.tokenizer.readToken(EndOfCentralDirectoryRecordToken, offset); const files = []; this.tokenizer.setPosition(eocdHeader.offsetOfStartOfCd); for (let n = 0; n < eocdHeader.nrOfEntriesOfSize; ++n) { const entry = await this.tokenizer.readToken(FileHeader); if (entry.signature !== Signature.CentralFileHeader) { throw new Error("Expected Central-File-Header signature"); } entry.filename = await this.tokenizer.readToken(new StringType(entry.filenameLength, "utf-8")); await this.tokenizer.ignore(entry.extraFieldLength); await this.tokenizer.ignore(entry.fileCommentLength); files.push(entry); debug(`Add central-directory file-entry: n=${n + 1}/${files.length}: filename=${files[n].filename}`); } this.tokenizer.setPosition(pos); return files; } this.tokenizer.setPosition(pos); } async unzip(fileCb) { const entries = await this.readCentralDirectory(); if (entries) { return this.iterateOverCentralDirectory(entries, fileCb); } let stop = false; do { const zipHeader = await this.readLocalFileHeader(); if (!zipHeader) break; const next = fileCb(zipHeader); stop = !!next.stop; let fileData = void 0; await this.tokenizer.ignore(zipHeader.extraFieldLength); if (zipHeader.dataDescriptor && zipHeader.compressedSize === 0) { const chunks = []; let len = syncBufferSize; debug("Compressed-file-size unknown, scanning for next data-descriptor-signature...."); let nextHeaderIndex = -1; while (nextHeaderIndex < 0 && len === syncBufferSize) { len = await this.tokenizer.peekBuffer(this.syncBuffer, { mayBeLess: true }); nextHeaderIndex = indexOf(this.syncBuffer.subarray(0, len), ddSignatureArray); const size = nextHeaderIndex >= 0 ? nextHeaderIndex : len; if (next.handler) { const data = new Uint8Array(size); await this.tokenizer.readBuffer(data); chunks.push(data); } else { await this.tokenizer.ignore(size); } } debug(`Found data-descriptor-signature at pos=${this.tokenizer.position}`); if (next.handler) { await this.inflate(zipHeader, mergeArrays(chunks), next.handler); } } else { if (next.handler) { debug(`Reading compressed-file-data: ${zipHeader.compressedSize} bytes`); fileData = new Uint8Array(zipHeader.compressedSize); await this.tokenizer.readBuffer(fileData); await this.inflate(zipHeader, fileData, next.handler); } else { debug(`Ignoring compressed-file-data: ${zipHeader.compressedSize} bytes`); await this.tokenizer.ignore(zipHeader.compressedSize); } } debug(`Reading data-descriptor at pos=${this.tokenizer.position}`); if (zipHeader.dataDescriptor) { const dataDescriptor = await this.tokenizer.readToken(DataDescriptor); if (dataDescriptor.signature !== 134695760) { throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - DataDescriptor.len}`); } } } while (!stop); } async iterateOverCentralDirectory(entries, fileCb) { for (const fileHeader of entries) { const next = fileCb(fileHeader); if (next.handler) { this.tokenizer.setPosition(fileHeader.relativeOffsetOfLocalHeader); const zipHeader = await this.readLocalFileHeader(); if (zipHeader) { await this.tokenizer.ignore(zipHeader.extraFieldLength); const fileData = new Uint8Array(fileHeader.compressedSize); await this.tokenizer.readBuffer(fileData); await this.inflate(zipHeader, fileData, next.handler); } } if (next.stop) break; } } inflate(zipHeader, fileData, cb) { if (zipHeader.compressedMethod === 0) { return cb(fileData); } debug(`Decompress filename=${zipHeader.filename}, compressed-size=${fileData.length}`); const uncompressedData = decompressSync(fileData); return cb(uncompressedData); } async readLocalFileHeader() { const signature = await this.tokenizer.peekToken(UINT32_LE); if (signature === Signature.LocalFileHeader) { const header = await this.tokenizer.readToken(LocalFileHeaderToken); header.filename = await this.tokenizer.readToken(new StringType(header.filenameLength, "utf-8")); return header; } if (signature === Signature.CentralFileHeader) { return false; } if (signature === 3759263696) { throw new Error("Encrypted ZIP"); } throw new Error("Unexpected signature"); } } function indexOf(buffer, portion) { const bufferLength = buffer.length; const portionLength = portion.length; if (portionLength > bufferLength) return -1; for (let i = 0; i <= bufferLength - portionLength; i++) { let found = true; for (let j = 0; j < portionLength; j++) { if (buffer[i + j] !== portion[j]) { found = false; break; } } if (found) { return i; } } return -1; } function mergeArrays(chunks) { const totalLength = chunks.reduce((acc, curr) => acc + curr.length, 0); const mergedArray = new Uint8Array(totalLength); let offset = 0; for (const chunk of chunks) { mergedArray.set(chunk, offset); offset += chunk.length; } return mergedArray; } ({ utf8: new globalThis.TextDecoder("utf8") }); new globalThis.TextEncoder(); Array.from({ length: 256 }, (_, index) => index.toString(16).padStart(2, "0")); function getUintBE(view) { const { byteLength } = view; if (byteLength === 6) { return view.getUint16(0) * 2 ** 32 + view.getUint32(2); } if (byteLength === 5) { return view.getUint8(0) * 2 ** 32 + view.getUint32(1); } if (byteLength === 4) { return view.getUint32(0); } if (byteLength === 3) { return view.getUint8(0) * 2 ** 16 + view.getUint16(1); } if (byteLength === 2) { return view.getUint16(0); } if (byteLength === 1) { return view.getUint8(0); } } function stringToBytes(string) { return [...string].map((character) => character.charCodeAt(0)); } function tarHeaderChecksumMatches(arrayBuffer, offset = 0) { const readSum = Number.parseInt(new StringType(6).get(arrayBuffer, 148).replace(/\0.*$/, "").trim(), 8); if (Number.isNaN(readSum)) { return false; } let sum = 8 * 32; for (let index = offset; index < offset + 148; index++) { sum += arrayBuffer[index]; } for (let index = offset + 156; index < offset + 512; index++) { sum += arrayBuffer[index]; } return readSum === sum; } const uint32SyncSafeToken = { get: (buffer, offset) => buffer[offset + 3] & 127 | buffer[offset + 2] << 7 | buffer[offset + 1] << 14 | buffer[offset] << 21, len: 4 }; const extensions = [ "jpg", "png", "apng", "gif", "webp", "flif", "xcf", "cr2", "cr3", "orf", "arw", "dng", "nef", "rw2", "raf", "tif", "bmp", "icns", "jxr", "psd", "indd", "zip", "tar", "rar", "gz", "bz2", "7z", "dmg", "mp4", "mid", "mkv", "webm", "mov", "avi", "mpg", "mp2", "mp3", "m4a", "oga", "ogg", "ogv", "opus", "flac", "wav", "spx", "amr", "pdf", "epub", "elf", "macho", "exe", "swf", "rtf", "wasm", "woff", "woff2", "eot", "ttf", "otf", "ttc", "ico", "flv", "ps", "xz", "sqlite", "nes", "crx", "xpi", "cab", "deb", "ar", "rpm", "Z", "lz", "cfb", "mxf", "mts", "blend", "bpg", "docx", "pptx", "xlsx", "3gp", "3g2", "j2c", "jp2", "jpm", "jpx", "mj2", "aif", "qcp", "odt", "ods", "odp", "xml", "mobi", "heic", "cur", "ktx", "ape", "wv", "dcm", "ics", "glb", "pcap", "dsf", "lnk", "alias", "voc", "ac3", "m4v", "m4p", "m4b", "f4v", "f4p", "f4b", "f4a", "mie", "asf", "ogm", "ogx", "mpc", "arrow", "shp", "aac", "mp1", "it", "s3m", "xm", "skp", "avif", "eps", "lzh", "pgp", "asar", "stl", "chm", "3mf", "zst", "jxl", "vcf", "jls", "pst", "dwg", "parquet", "class", "arj", "cpio", "ace", "avro", "icc", "fbx", "vsdx", "vtt", "apk", "drc", "lz4", "potx", "xltx", "dotx", "xltm", "ott", "ots", "otp", "odg", "otg", "xlsm", "docm", "dotm", "potm", "pptm", "jar", "rm", "ppsm", "ppsx" ]; const mimeTypes = [ "image/jpeg", "image/png", "image/gif", "image/webp", "image/flif", "image/x-xcf", "image/x-canon-cr2", "image/x-canon-cr3", "image/tiff", "image/bmp", "image/vnd.ms-photo", "image/vnd.adobe.photoshop", "application/x-indesign", "application/epub+zip", "application/x-xpinstall", "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "application/vnd.oasis.opendocument.text", "application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.presentation", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "application/zip", "application/x-tar", "application/x-rar-compressed", "application/gzip", "application/x-bzip2", "application/x-7z-compressed", "application/x-apple-diskimage", "application/vnd.apache.arrow.file", "video/mp4", "audio/midi", "video/matroska", "video/webm", "video/quicktime", "video/vnd.avi", "audio/wav", "audio/qcelp", "audio/x-ms-asf", "video/x-ms-asf", "application/vnd.ms-asf", "video/mpeg", "video/3gpp", "audio/mpeg", "audio/mp4", "video/ogg", "audio/ogg", "audio/ogg; codecs=opus", "application/ogg", "audio/flac", "audio/ape", "audio/wavpack", "audio/amr", "application/pdf", "application/x-elf", "application/x-mach-binary", "application/x-msdownload", "application/x-shockwave-flash", "application/rtf", "application/wasm", "font/woff", "font/woff2", "application/vnd.ms-fontobject", "font/ttf", "font/otf", "font/collection", "image/x-icon", "video/x-flv", "application/postscript", "application/eps", "application/x-xz", "application/x-sqlite3", "application/x-nintendo-nes-rom", "application/x-google-chrome-extension", "application/vnd.ms-cab-compressed", "application/x-deb", "application/x-unix-archive", "application/x-rpm", "application/x-compress", "application/x-lzip", "application/x-cfb", "application/x-mie", "application/mxf", "video/mp2t", "application/x-blender", "image/bpg", "image/j2c", "image/jp2", "image/jpx", "image/jpm", "image/mj2", "audio/aiff", "application/xml", "application/x-mobipocket-ebook", "image/heif", "image/heif-sequence", "image/heic", "image/heic-sequence", "image/icns", "image/ktx", "application/dicom", "audio/x-musepack", "text/calendar", "text/vcard", "text/vtt", "model/gltf-binary", "application/vnd.tcpdump.pcap", "audio/x-dsf", "application/x.ms.shortcut", "application/x.apple.alias", "audio/x-voc", "audio/vnd.dolby.dd-raw", "audio/x-m4a", "image/apng", "image/x-olympus-orf", "image/x-sony-arw", "image/x-adobe-dng", "image/x-nikon-nef", "image/x-panasonic-rw2", "image/x-fujifilm-raf", "video/x-m4v", "video/3gpp2", "application/x-esri-shape", "audio/aac", "audio/x-it", "audio/x-s3m", "audio/x-xm", "video/MP1S", "video/MP2P", "application/vnd.sketchup.skp", "image/avif", "application/x-lzh-compressed", "application/pgp-encrypted", "application/x-asar", "model/stl", "application/vnd.ms-htmlhelp", "model/3mf", "image/jxl", "application/zstd", "image/jls", "application/vnd.ms-outlook", "image/vnd.dwg", "application/vnd.apache.parquet", "application/java-vm", "application/x-arj", "application/x-cpio", "application/x-ace-compressed", "application/avro", "application/vnd.iccprofile", "application/x.autodesk.fbx", "application/vnd.visio", "application/vnd.android.package-archive", "application/vnd.google.draco", "application/x-lz4", "application/vnd.openxmlformats-officedocument.presentationml.template", "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "application/vnd.ms-excel.template.macroenabled.12", "application/vnd.oasis.opendocument.text-template", "application/vnd.oasis.opendocument.spreadsheet-template", "application/vnd.oasis.opendocument.presentation-template", "application/vnd.oasis.opendocument.graphics", "application/vnd.oasis.opendocument.graphics-template", "application/vnd.ms-excel.sheet.macroenabled.12", "application/vnd.ms-word.document.macroenabled.12", "application/vnd.ms-word.template.macroenabled.12", "application/vnd.ms-powerpoint.template.macroenabled.12", "application/vnd.ms-powerpoint.presentation.macroenabled.12", "application/java-archive", "application/vnd.rn-realmedia" ]; const reasonableDetectionSizeInBytes = 4100; async function fileTypeFromBuffer(input, options) { return new FileTypeParser(options).fromBuffer(input); } function getFileTypeFromMimeType(mimeType) { mimeType = mimeType.toLowerCase(); switch (mimeType) { case "application/epub+zip": return { ext: "epub", mime: mimeType }; case "application/vnd.oasis.opendocument.text": return { ext: "odt", mime: mimeType }; case "application/vnd.oasis.opendocument.text-template": return { ext: "ott", mime: mimeType }; case "application/vnd.oasis.opendocument.spreadsheet": return { ext: "ods", mime: mimeType }; case "application/vnd.oasis.opendocument.spreadsheet-template": return { ext: "ots", mime: mimeType }; case "application/vnd.oasis.opendocument.presentation": return { ext: "odp", mime: mimeType }; case "application/vnd.oasis.opendocument.presentation-template": return { ext: "otp", mime: mimeType }; case "application/vnd.oasis.opendocument.graphics": return { ext: "odg", mime: mimeType }; case "application/vnd.oasis.opendocument.graphics-template": return { ext: "otg", mime: mimeType }; case "application/vnd.openxmlformats-officedocument.presentationml.slideshow": return { ext: "ppsx", mime: mimeType }; case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": return { ext: "xlsx", mime: mimeType }; case "application/vnd.ms-excel.sheet.macroenabled": return { ext: "xlsm", mime: "application/vnd.ms-excel.sheet.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.spreadsheetml.template": return { ext: "xltx", mime: mimeType }; case "application/vnd.ms-excel.template.macroenabled": return { ext: "xltm", mime: "application/vnd.ms-excel.template.macroenabled.12" }; case "application/vnd.ms-powerpoint.slideshow.macroenabled": return { ext: "ppsm", mime: "application/vnd.ms-powerpoint.slideshow.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": return { ext: "docx", mime: mimeType }; case "application/vnd.ms-word.document.macroenabled": return { ext: "docm", mime: "application/vnd.ms-word.document.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.wordprocessingml.template": return { ext: "dotx", mime: mimeType }; case "application/vnd.ms-word.template.macroenabledtemplate": return { ext: "dotm", mime: "application/vnd.ms-word.template.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.presentationml.template": return { ext: "potx", mime: mimeType }; case "application/vnd.ms-powerpoint.template.macroenabled": return { ext: "potm", mime: "application/vnd.ms-powerpoint.template.macroenabled.12" }; case "application/vnd.openxmlformats-officedocument.presentationml.presentation": return { ext: "pptx", mime: mimeType }; case "application/vnd.ms-powerpoint.presentation.macroenabled": return { ext: "pptm", mime: "application/vnd.ms-powerpoint.presentation.macroenabled.12" }; case "application/vnd.ms-visio.drawing": return { ext: "vsdx", mime: "application/vnd.visio" }; case "application/vnd.ms-package.3dmanufacturing-3dmodel+xml": return { ext: "3mf", mime: "model/3mf" }; } } function _check(buffer, headers, options) { options = { offset: 0, ...options }; for (const [index, header] of headers.entries()) { if (options.mask) { if (header !== (options.mask[index] & buffer[index + options.offset])) { return false; } } else if (header !== buffer[index + options.offset]) { return false; } } return true; } class FileTypeParser { constructor(options) { this.options = { mpegOffsetTolerance: 0, ...options }; this.detectors = [ ...options?.customDetectors ?? [], { id: "core", detect: this.detectConfident }, { id: "core.imprecise", detect: this.detectImprecise } ]; this.tokenizerOptions = { abortSignal: options?.signal }; } async fromTokenizer(tokenizer) { const initialPosition = tokenizer.position; for (const detector of this.detectors) { const fileType = await detector.detect(tokenizer); if (fileType) { return fileType; } if (initialPosition !== tokenizer.position) { return void 0; } } } async fromBuffer(input) { if (!(input instanceof Uint8Array || input instanceof ArrayBuffer)) { throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof input}\``); } const buffer = input instanceof Uint8Array ? input : new Uint8Array(input); if (!(buffer?.length > 1)) { return; } return this.fromTokenizer(fromBuffer(buffer, this.tokenizerOptions)); } async fromBlob(blob) { return this.fromStream(blob.stream()); } async fromStream(stream) { const tokenizer = await fromWebStream(stream, this.tokenizerOptions); try { return await this.fromTokenizer(tokenizer); } finally { await tokenizer.close(); } } async toDetectionStream(stream, options) { const { sampleSize = reasonableDetectionSizeInBytes } = options; let detectedFileType; let firstChunk; const reader = stream.getReader({ mode: "byob" }); try { const { value: chunk, done } = await reader.read(new Uint8Array(sampleSize)); firstChunk = chunk; if (!done && chunk) { try { detectedFileType = await this.fromBuffer(chunk.subarray(0, sampleSize)); } catch (error) { if (!(error instanceof EndOfStreamError)) { throw error; } detectedFileType = void 0; } } firstChunk = chunk; } finally { reader.releaseLock(); } const transformStream = new TransformStream({ async start(controller) { controller.enqueue(firstChunk); }, transform(chunk, controller) { controller.enqueue(chunk); } }); const newStream = stream.pipeThrough(transformStream); newStream.fileType = detectedFileType; return newStream; } check(header, options) { return _check(this.buffer, header, options); } checkString(header, options) { return this.check(stringToBytes(header), options); } detectConfident = async (tokenizer) => { this.buffer = new Uint8Array(reasonableDetectionSizeInBytes); if (tokenizer.fileInfo.size === void 0) { tokenizer.fileInfo.size = Number.MAX_SAFE_INTEGER; } this.tokenizer = tokenizer; await tokenizer.peekBuffer(this.buffer, { length: 12, mayBeLess: true }); if (this.check([66, 77])) { return { ext: "bmp", mime: "image/bmp" }; } if (this.check([11, 119])) { return { ext: "ac3", mime: "audio/vnd.dolby.dd-raw" }; } if (this.check([120, 1])) { return { ext: "dmg", mime: "application/x-apple-diskimage" }; } if (this.check([77, 90])) { return { ext: "exe", mime: "application/x-msdownload" }; } if (this.check([37, 33])) { await tokenizer.peekBuffer(this.buffer, { length: 24, mayBeLess: true }); if (this.checkString("PS-Adobe-", { offset: 2 }) && this.checkString(" EPSF-", { offset: 14 })) { return { ext: "eps", mime: "application/eps" }; } return { ext: "ps", mime: "application/postscript" }; } if (this.check([31, 160]) || this.check([31, 157])) { return { ext: "Z", mime: "application/x-compress" }; } if (this.check([199, 113])) { return { ext: "cpio", mime: "application/x-cpio" }; } if (this.check([96, 234])) { return { ext: "arj", mime: "application/x-arj" }; } if (this.check([239, 187, 191])) { this.tokenizer.ignore(3); return this.detectConfident(tokenizer); } if (this.check([71, 73, 70])) { return { ext: "gif", mime: "image/gif" }; } if (this.check([73, 73, 188])) { return { ext: "jxr", mime: "image/vnd.ms-photo" }; } if (this.check([31, 139, 8])) { return { ext: "gz", mime: "application/gzip" }; } if (this.check([66, 90, 104])) { return { ext: "bz2", mime: "application/x-bzip2" }; } if (this.checkString("ID3")) { await tokenizer.ignore(6); const id3HeaderLength = await tokenizer.readToken(uint32SyncSafeToken); if (tokenizer.position + id3HeaderLength > tokenizer.fileInfo.size) { return { ext: "mp3", mime: "audio/mpeg" }; } await tokenizer.ignore(id3HeaderLength); return this.fromTokenizer(tokenizer); } if (this.checkString("MP+")) { return { ext: "mpc", mime: "audio/x-musepack" }; } if ((this.buffer[0] === 67 || this.buffer[0] === 70) && this.check([87, 83], { offset: 1 })) { return { ext: "swf", mime: "application/x-shockwave-flash" }; } if (this.check([255, 216, 255])) { if (this.check([247], { offset: 3 })) { return { ext: "jls", mime: "image/jls" }; } return { ext: "jpg", mime: "image/jpeg" }; } if (this.check([79, 98, 106, 1])) { return { ext: "avro", mime: "application/avro" }; } if (this.checkString("FLIF")) { return { ext: "flif", mime: "image/flif" }; } if (this.checkString("8BPS")) { return { ext: "psd", mime: "image/vnd.adobe.photoshop" }; } if (this.checkString("MPCK")) { return { ext: "mpc", mime: "audio/x-musepack" }; } if (this.checkString("FORM")) { return { ext: "aif", mime: "audio/aiff" }; } if (this.checkString("icns", { offset: 0 })) { return { ext: "icns", mime: "image/icns" }; } if (this.check([80, 75, 3, 4])) { let fileType; await new ZipHandler(tokenizer).unzip((zipHeader) => { switch (zipHeader.filename) { case "META-INF/mozilla.rsa": fileType = { ext: "xpi", mime: "application/x-xpinstall" }; return { stop: true }; case "META-INF/MANIFEST.MF": fileType = { ext: "jar", mime: "application/java-archive" }; return { stop: true }; case "mimetype": return { async handler(fileData) { const mimeType = new TextDecoder("utf-8").decode(fileData).trim(); fileType = getFileTypeFromMimeType(mimeType); }, stop: true }; case "[Content_Types].xml": return { async handler(fileData) { let xmlContent = new TextDecoder("utf-8").decode(fileData); const endPos = xmlContent.indexOf('.main+xml"'); if (endPos === -1) { const mimeType = "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"; if (xmlContent.includes(`ContentType="${mimeType}"`)) { fileType = getFileTypeFromMimeType(mimeType); } } else { xmlContent = xmlContent.slice(0, Math.max(0, endPos)); const firstPos = xmlContent.lastIndexOf('"'); const mimeType = xmlContent.slice(Math.max(0, firstPos + 1)); fileType = getFileTypeFromMimeType(mimeType); } }, stop: true }; default: if (/classes\d*\.dex/.test(zipHeader.filename)) { fileType = { ext: "apk", mime: "application/vnd.android.package-archive" }; return { stop: true }; } return {}; } }); return fileType ?? { ext: "zip", mime: "application/zip" }; } if (this.checkString("OggS")) { await tokenizer.ignore(28); const type = new Uint8Array(8); await tokenizer.readBuffer(type); if (_check(type, [79, 112, 117, 115, 72, 101, 97, 100])) { return { ext: "opus", mime: "audio/ogg; codecs=opus" }; } if (_check(type, [128, 116, 104, 101, 111, 114, 97])) { return { ext: "ogv", mime: "video/ogg" }; } if (_check(type, [1, 118, 105, 100, 101, 111, 0])) { return { ext: "ogm", mime: "video/ogg" }; } if (_check(type, [127, 70, 76, 65, 67])) { return { ext: "oga", mime: "audio/ogg" }; } if (_check(type, [83, 112, 101, 101, 120, 32, 32])) { return { ext: "spx", mime: "audio/ogg" }; } if (_check(type, [1, 118, 111, 114, 98, 105, 115])) { return { ext: "ogg", mime: "audio/ogg" }; } return { ext: "ogx", mime: "application/ogg" }; } if (this.check([80, 75]) && (this.buffer[2] === 3 || this.buffer[2] === 5 || this.buffer[2] === 7) && (this.buffer[3] === 4 || this.buffer[3] === 6 || this.buffer[3] === 8)) { return { ext: "zip", mime: "application/zip" }; } if (this.checkString("MThd")) { return { ext: "mid", mime: "audio/midi" }; } if (this.checkString("wOFF") && (this.check([0, 1, 0, 0], { offset: 4 }) || this.checkString("OTTO", { offset: 4 }))) { return { ext: "woff", mime: "font/woff" }; } if (this.checkString("wOF2") && (this.check([0, 1, 0, 0], { offset: 4 }) || this.checkString("OTTO", { offset: 4 }))) { return { ext: "woff2", mime: "font/woff2" }; } if (this.check([212, 195, 178, 161]) || this.check([161, 178, 195, 212])) { return { ext: "pcap", mime: "application/vnd.tcpdump.pcap" }; } if (this.checkString("DSD ")) { return { ext: "dsf", mime: "audio/x-dsf" }; } if (this.checkString("LZIP")) { return { ext: "lz", mime: "application/x-lzip" }; } if (this.checkString("fLaC")) { return { ext: "flac", mime: "audio/flac" }; } if (this.check([66, 80, 71, 251])) { return { ext: "bpg", mime: "image/bpg" }; } if (this.checkString("wvpk")) { return { ext: "wv", mime: "audio/wavpack" }; } if (this.checkString("%PDF")) { return { ext: "pdf", mime: "application/pdf" }; } if (this.check([0, 97, 115, 109])) { return { ext: "wasm", mime: "application/wasm" }; } if (this.check([73, 73])) { const fileType = await this.readTiffHeader(false); if (fileType) { return fileType; } } if (this.check([77, 77])) { const fileType = await this.readTiffHeader(true); if (fileType) { return fileType; } } if (this.checkString("MAC ")) { return { ext: "ape", mime: "audio/ape" }; } if (this.check([26, 69, 223, 163])) { async function readField() { const msb = await tokenizer.peekNumber(UINT8); let mask = 128; let ic = 0; while ((msb & mask) === 0 && mask !== 0) { ++ic; mask >>= 1; } const id = new Uint8Array(ic + 1); await tokenizer.readBuffer(id); return id; } async function readElement() { const idField = await readField(); const lengthField = await readField(); lengthField[0] ^= 128 >> lengthField.length - 1; const nrLength = Math.min(6, lengthField.length); const idView = new DataView(idField.buffer); const lengthView = new DataView(lengthField.buffer, lengthField.length - nrLength, nrLength); return { id: getUintBE(idView), len: getUintBE(lengthView) }; } async function readChildren(children) { while (children > 0) { const element = await readElement(); if (element.id === 17026) { const rawValue = await tokenizer.readToken(new StringType(element.len)); return rawValue.replaceAll(/\00.*$/g, ""); } await tokenizer.ignore(element.len); --children; } } const re = await readElement(); const documentType = await readChildren(re.len); switch (documentType) { case "webm": return { ext: "webm", mime: "video/webm" }; case "matroska": return { ext: "mkv", mime: "video/matroska" }; default: return; } } if (this.checkString("SQLi")) { return { ext: "sqlite", mime: "application/x-sqlite3" }; } if (this.check([78, 69, 83, 26])) { return { ext: "nes", mime: "application/x-nintendo-nes-rom" }; } if (this.checkString("Cr24")) { return { ext: "crx", mime: "application/x-google-chrome-extension" }; } if (this.checkString("MSCF") || this.checkString("ISc(")) { return { ext: "cab", mime: "application/vnd.ms-cab-compressed" }; } if (this.check([237, 171, 238, 219])) { return { ext: "rpm", mime: "application/x-rpm" }; } if (this.check([197, 208, 211, 198])) { return { ext: "eps", mime: "application/eps" }; } if (this.check([40, 181, 47, 253])) { return { ext: "zst", mime: "application/zstd" }; } if (this.check([127, 69, 76, 70])) { return { ext: "elf", mime: "application/x-elf" }; } if (this.check([33, 66, 68, 78])) { return { ext: "pst", mime: "application/vnd.ms-outlook" }; } if (this.checkString("PAR1") || this.checkString("PARE")) { return { ext: "parquet", mime: "application/vnd.apache.parquet" }; } if (this.checkString("ttcf")) { return { ext: "ttc", mime: "font/collection" }; } if (this.check([207, 250, 237, 254])) { return { ext: "macho", mime: "application/x-mach-binary" }; } if (this.check([4, 34, 77, 24])) { return { ext: "lz4", mime: "application/x-lz4" }; } if (this.check([79, 84, 84, 79, 0])) { return { ext: "otf", mime: "font/otf" }; } if (this.checkString("#!AMR")) { return { ext: "amr", mime: "audio/amr" }; } if (this.checkString("{\\rtf")) { return { ext: "rtf", mime: "application/rtf" }; } if (this.check([70, 76, 86, 1])) { return { ext: "flv", mime: "video/x-flv" }; } if (this.checkString("IMPM")) { return { ext: "it", mime: "audio/x-it" }; } if (this.checkString("-lh0-", { offset: 2 }) || this.checkString("-lh1-", { offset: 2 }) || this.checkString("-lh2-", { offset: 2 }) || this.checkString("-lh3-", { offset: 2 }) || this.checkString("-lh4-", { offset: 2 }) || this.checkString("-lh5-", { offset: 2 }) || this.checkString("-lh6-", { offset: 2 }) || this.checkString("-lh7-", { offset: 2 }) || this.checkString("-lzs-", { offset: 2 }) || this.checkString("-lz4-", { offset: 2 }) || this.checkString("-lz5-", { offset: 2 }) || this.checkString("-lhd-", { offset: 2 })) { return { ext: "lzh", mime: "application/x-lzh-compressed" }; } if (this.check([0, 0, 1, 186])) { if (this.check([33], { offset: 4, mask: [241] })) { return { ext: "mpg", mime: "video/MP1S" }; } if (this.check([68], { offset: 4, mask: [196] })) { return { ext: "mpg", mime: "video/MP2P" }; } } if (this.checkString("ITSF")) { return { ext: "chm", mime: "application/vnd.ms-htmlhelp" }; } if (this.check([202, 254, 186, 190])) { return { ext: "class", mime: "application/java-vm" }; } if (this.checkString(".RMF")) { return { ext: "rm", mime: "application/vnd.rn-realmedia" }; } if (this.checkString("DRACO")) { return { ext: "drc", mime: "application/vnd.google.draco" }; } if (this.check([253, 55, 122, 88, 90, 0])) { return { ext: "xz", mime: "application/x-xz" }; } if (this.checkString("<?xml ")) { return { ext: "xml", mime: "application/xml" }; } if (this.check([55, 122, 188, 175, 39, 28])) { return { ext: "7z", mime: "application/x-7z-compressed" }; } if (this.check([82, 97, 114, 33, 26, 7]) && (this.buffer[6] === 0 || this.buffer[6] === 1)) { return { ext: "rar", mime: "application/x-rar-compressed" }; } if (this.checkString("solid ")) { return { ext: "stl", mime: "model/stl" }; } if (this.checkString("AC")) { const version = new StringType(4, "latin1").get(this.buffer, 2); if (version.match("^d*") && version >= 1e3 && version <= 1050) { return { ext: "dwg", mime: "image/vnd.dwg" }; } } if (this.checkString("070707")) { return { ext: "cpio", mime: "application/x-cpio" }; } if (this.checkString("BLENDER")) { return { ext: "blend", mime: "application/x-blender" }; } if (this.checkString("!<arch>")) { await tokenizer.ignore(8); const string = await tokenizer.readToken(new StringType(13, "ascii")); if (string === "debian-binary") { return { ext: "deb", mime: "application/x-deb" }; } return { ext: "ar", mime: "application/x-unix-archive" }; } if (this.checkString("WEBVTT") && ["\n", "\r", " ", " ", "\0"].some((char7) => this.checkString(char7, { offset: 6 }))) { return { ext: "vtt", mime: "text/vtt" }; } if (this.check([137, 80, 78, 71, 13, 10, 26, 10])) { await tokenizer.ignore(8); async function readChunkHeader() { return { length: await tokenizer.readToken(INT32_BE), type: await tokenizer.readToken(new StringType(4, "latin1")) }; } do { const chunk = await readChunkHeader(); if (chunk.length < 0) { return; } switch (chunk.type) { case "IDAT": return { ext: "png", mime: "image/png" }; case "acTL": return { ext: "apng", mime: "image/apng" }; default: await tokenizer.ignore(chunk.length + 4); } } while (tokenizer.position + 8 < tokenizer.fileInfo.size); return { ext: "png", mime: "image/png" }; } if (this.check([65, 82, 82, 79, 87, 49, 0, 0])) { return { ext: "arrow", mime: "application/vnd.apache.arrow.file" }; } if (this.check([103, 108, 84, 70, 2, 0, 0, 0])) { return { ext: "glb", mime: "model/gltf-binary" }; } if (this.check([102, 114, 101, 101], { offset: 4 }) || this.check([109, 100, 97, 116], { offset: 4 }) || this.check([109, 111, 111, 118], { offset: 4 }) || this.check([119, 105, 100, 101], { offset: 4 })) { return { ext: "mov", mime: "video/quicktime" }; } if (this.check([73, 73, 82, 79, 8, 0, 0, 0, 24])) { return { ext: "orf", mime: "image/x-olympus-orf" }; } if (this.checkString("gimp xcf ")) { return { ext: "xcf", mime: "image/x-xcf" }; } if (this.checkString("ftyp", { offset: 4 }) && (this.buffer[8] & 96) !== 0) { const brandMajor = new StringType(4, "latin1").get(this.buffer, 8).replace("\0", " ").trim(); switch (brandMajor) { case "avif": case "avis": return { ext: "avif", mime: "image/avif" }; case "mif1": return { ext: "heic", mime: "image/heif" }; case "msf1": return { ext: "heic", mime: "image/heif-sequence" }; case "heic": case "heix": return { ext: "heic", mime: "image/heic" }; case "hevc": case "hevx": return { ext: "heic", mime: "image/heic-sequence" }; case "qt": return { ext: "mov", mime: "video/quicktime" }; case "M4V": case "M4VH": case "M4VP": return { ext: "m4v", mime: "video/x-m4v" }; case "M4P": return { ext: "m4p", mime: "video/mp4" }; case "M4B": return { ext: "m4b", mime: "audio/mp4" }; case "M4A": return { ext: "m4a", mime: "audio/x-m4a" }; case "F4V": return { ext: "f4v", mime: "video/mp4" }; case "F4P": return { ext: "f4p", mime: "video/mp4" }; case "F4A": return { ext: "f4a", mime: "audio/mp4" }; case "F4B": return { ext: "f4b", mime: "audio/mp4" }; case "crx": return { ext: "cr3", mime: "image/x-canon-cr3" }; default: if (brandMajor.startsWith("3g")) { if (brandMajor.startsWith("3g2")) { return { ext: "3g2", mime: "video/3gpp2" }; } return { ext: "3gp", mime: "video/3gpp" }; } return { ext: "mp4", mime: "video/mp4" }; } } if (this.check([82, 73, 70, 70])) { if (this.checkString("WEBP", { offset: 8 })) { return { ext: "webp", mime: "image/webp" }; } if (this.check([65, 86, 73], { offset: 8 })) { return { ext: "avi", mime: "video/vnd.avi" }; } if (this.check([87, 65, 86, 69], { offset: 8 })) { return { ext: "wav", mime: "audio/wav" }; } if (this.check([81, 76, 67, 77], { offset: 8 })) { return { ext: "qcp", mime: "audio/qcelp" }; } } if (this.check([73, 73, 85, 0, 24, 0, 0, 0, 136, 231, 116, 216])) { return { ext: "rw2", mime: "image/x-panasonic-rw2" }; } if (this.check([48, 38, 178, 117, 142, 102, 207, 17, 166, 217])) { async function readHeader() { const guid = new Uint8Array(16); await tokenizer.readBuffer(guid); return { id: guid, size: Number(await tokenizer.readToken(UINT64_LE)) }; } await tokenizer.ignore(30); while (tokenizer.position + 24 < tokenizer.fileInfo.size) { const header = await readHeader(); let payload = header.size - 24; if (_check(header.id, [145, 7, 220, 183, 183, 169, 207, 17, 142, 230, 0, 192, 12, 32, 83, 101])) { const typeId = new Uint8Array(16); payload -= await tokenizer.readBuffer(typeId); if (_check(typeId, [64, 158, 105, 248, 77, 91, 207, 17, 168, 253, 0, 128, 95, 92, 68, 43])) { return { ext: "asf", mime: "audio/x-ms-asf" }; } if (_check(typeId, [192, 239, 25, 188, 77, 91, 207, 17, 168, 253, 0, 128, 95, 92, 68, 43])) { return { ext: "asf", mime: "video/x-ms-asf" }; } break; } await tokenizer.ignore(payload); } return { ext: "asf", mime: "application/vnd.ms-asf" }; } if (this.check([171, 75, 84, 88, 32, 49, 49, 187, 13, 10, 26, 10])) { return { ext: "ktx", mime: "image/ktx" }; } if ((this.check([126, 16, 4]) || this.check([126, 24, 4])) && this.check([48, 77, 73, 69], { offset: 4 })) { return { ext: "mie", mime: "application/x-mie" }; } if (this.check([39, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], { offset: 2 })) { return { ext: "shp", mime: "application/x-esri-shape" }; } if (this.check([255, 79, 255, 81])) { return { ext: "j2c", mime: "image/j2c" }; } if (this.check([0, 0, 0, 12, 106, 80, 32, 32, 13, 10, 135, 10])) { await tokenizer.ignore(20); const type = await tokenizer.readToken(new StringType(4, "ascii")); switch (type) { case "jp2 ": return { ext: "jp2", mime: "image/jp2" }; case "jpx ": return { ext: "jpx", mime: "image/jpx" }; case "jpm ": return { ext: "jpm", mime: "image/jpm" }; case "mjp2": return { ext: "mj2", mime: "image/mj2" }; default: return; } } if (this.check([255, 10]) || this.check([0, 0, 0, 12, 74, 88, 76, 32, 13, 10, 135, 10])) { return { ext: "jxl", mime: "image/jxl" }; } if (this.check([254, 255])) { if (this.check([0, 60, 0, 63, 0, 120, 0, 109, 0, 108], { offset: 2 })) { return { ext: "xml", mime: "application/xml" }; } return void 0; } if (this.check([208, 207, 17, 224, 161, 177, 26, 225])) { return { ext: "cfb", mime: "application/x-cfb" }; } await tokenizer.peekBuffer(this.buffer, { length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true }); if (this.check([97, 99, 115, 112], { offset: 36 })) { return { ext: "icc", mime: "application/vnd.iccprofile" }; } if (this.checkString("**ACE", { offset: 7 }) && this.checkString("**", { offset: 12 })) { return { ext: "ace", mime: "application/x-ace-compressed" }; } if (this.checkString("BEGIN:")) { if (this.checkString("VCARD", { offset: 6 })) { return { ext: "vcf", mime: "text/vcard" }; } if (this.checkString("VCALENDAR", { offset: 6 })) { return { ext: "ics", mime: "text/calendar" }; } } if (this.checkString("FUJIFILMCCD-RAW")) { return { ext: "raf", mime: "image/x-fujifilm-raf" }; } if (this.checkString("Extended Module:")) { return { ext: "xm", mime: "audio/x-xm" }; } if (this.checkString("Creative Voice File")) { return { ext: "voc", mime: "audio/x-voc" }; } if (this.check([4, 0, 0, 0]) && this.buffer.length >= 16) { const jsonSize = new DataView(this.buffer.buffer).getUint32(12, true); if (jsonSize > 12 && this.buffer.length >= jsonSize + 16) { try { const header = new TextDecoder().decode(this.buffer.subarray(16, jsonSize + 16)); const json = JSON.parse(header); if (json.files) { return { ext: "asar", mime: "application/x-asar" }; } } catch { } } } if (this.check([6, 14, 43, 52, 2, 5, 1, 1, 13, 1, 2, 1, 1, 2])) { return { ext: "mxf", mime: "application/mxf" }; } if (this.checkString("SCRM", { offset: 44 })) { return { ext: "s3m", mime: "audio/x-s3m" }; } if (this.check([71]) && this.check([71], { offset: 188 })) { return { ext: "mts", mime: "video/mp2t" }; } if (this.check([71], { offset: 4 }) && this.check([71], { offset: 196 })) { return { ext: "mts", mime: "video/mp2t" }; } if (this.check([66, 79, 79, 75, 77, 79, 66, 73], { offset: 60 })) { return { ext: "mobi", mime: "application/x-mobipocket-ebook" }; } if (this.check([68, 73, 67, 77], { offset: 128 })) { return { ext: "dcm", mime: "application/dicom" }; } if (this.check([76, 0, 0, 0, 1, 20, 2, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, 0, 70])) { return { ext: "lnk", mime: "application/x.ms.shortcut" }; } if (this.check([98, 111, 111, 107, 0, 0, 0, 0, 109, 97, 114, 107, 0, 0, 0, 0])) { return { ext: "alias", mime: "application/x.apple.alias" }; } if (this.checkString("Kaydara FBX Binary \0")) { return { ext: "fbx", mime: "application/x.autodesk.fbx" }; } if (this.check([76, 80], { offset: 34 }) && (this.check([0, 0, 1], { offset: 8 }) || this.check([1, 0, 2], { offset: 8 }) || this.check([2, 0, 2], { offset: 8 }))) { return { ext: "eot", mime: "application/vnd.ms-fontobject" }; } if (this.check([6, 6, 237, 245, 216, 29, 70, 229, 189, 49, 239, 231, 254, 116, 183, 29])) { return { ext: "indd", mime: "application/x-indesign" }; } await tokenizer.peekBuffer(this.buffer, { length: Math.min(512, tokenizer.fileInfo.size), mayBeLess: true }); if (this.checkString("ustar", { offset: 257 }) && (this.checkString("\0", { offset: 262 }) || this.checkString(" ", { offset: 262 })) || this.check([0, 0, 0, 0, 0, 0], { offset: 257 }) && tarHeaderChecksumMatches(this.buffer)) { return { ext: "tar", mime: "application/x-tar" }; } if (this.check([255, 254])) { if (this.check([60, 0, 63, 0, 120, 0, 109, 0, 108, 0], { offset: 2 })) { return { ext: "xml", mime: "application/xml" }; } if (this.check([255, 14, 83, 0, 107, 0, 101, 0, 116, 0, 99, 0, 104, 0, 85, 0, 112, 0, 32, 0, 77, 0, 111, 0, 100, 0, 101, 0, 108, 0], { offset: 2 })) { return { ext: "skp", mime: "application/vnd.sketchup.skp" }; } return void 0; } if (this.checkString("-----BEGIN PGP MESSAGE-----")) { return { ext: "pgp", mime: "application/pgp-encrypted" }; } }; detectImprecise = async (tokenizer) => { this.buffer = new Uint8Array(reasonableDetectionSizeInBytes); await tokenizer.peekBuffer(this.buffer, { length: Math.min(8, tokenizer.fileInfo.size), mayBeLess: true }); if (this.check([0, 0, 1, 186]) || this.check([0, 0, 1, 179])) { return { ext: "mpg", mime: "video/mpeg" }; } if (this.check([0, 1, 0, 0, 0])) { return { ext: "ttf", mime: "font/ttf" }; } if (this.check([0, 0, 1, 0])) { return { ext: "ico", mime: "image/x-icon" }; } if (this.check([0, 0, 2, 0])) { return { ext: "cur", mime: "image/x-icon" }; } await tokenizer.peekBuffer(this.buffer, { length: Math.min(2 + this.options.mpegOffsetTolerance, tokenizer.fileInfo.size), mayBeLess: true }); if (this.buffer.length >= 2 + this.options.mpegOffsetTolerance) { for (let depth = 0; depth <= this.options.mpegOffsetTolerance; ++depth) { const type = this.scanMpeg(depth); if (type) { return type; } } } }; async readTiffTag(bigEndian) { const tagId = await this.tokenizer.readToken(bigEndian ? UINT16_BE : UINT16_LE); this.tokenizer.ignore(10); switch (tagId) { case 50341: return { ext: "arw", mime: "image/x-sony-arw" }; case 50706: return { ext: "dng", mime: "image/x-adobe-dng" }; } } async readTiffIFD(bigEndian) { const numberOfTags = await this.tokenizer.readToken(bigEndian ? UINT16_BE : UINT16_LE); for (let n = 0; n < numberOfTags; ++n) { const fileType = await this.readTiffTag(bigEndian); if (fileType) { return fileType; } } } async readTiffHeader(bigEndian) { const version = (bigEndian ? UINT16_BE : UINT16_LE).get(this.buffer, 2); const ifdOffset = (bigEndian ? UINT32_BE : UINT32_LE).get(this.buffer, 4); if (version === 42) { if (ifdOffset >= 6) { if (this.checkString("CR", { offset: 8 })) { return { ext: "cr2", mime: "image/x-canon-cr2" }; } if (ifdOffset >= 8) { const someId1 = (bigEndian ? UINT16_BE : UINT16_LE).get(this.buffer, 8); const someId2 = (bigEndian ? UINT16_BE : UINT16_LE).get(this.buffer, 10); if (someId1 === 28 && someId2 === 254 || someId1 === 31 && someId2 === 11) { return { ext: "nef", mime: "image/x-nikon-nef" }; } } } await this.tokenizer.ignore(ifdOffset); const fileType = await this.readTiffIFD(bigEndian); return fileType ?? { ext: "tif", mime: "image/tiff" }; } if (version === 43) { return { ext: "tif", mime: "image/tiff" }; } } scanMpeg(offset) { if (this.check([255, 224], { offset, mask: [255, 224] })) { if (this.check([16], { offset: offset + 1, mask: [22] })) { if (this.check([8], { offset: offset + 1, mask: [8] })) { return { ext: "aac", mime: "audio/aac" }; } return { ext: "aac", mime: "audio/aac" }; } if (this.check([2], { offset: offset + 1, mask: [6] })) { return { ext: "mp3", mime: "audio/mpeg" }; } if (this.check([4], { offset: offset + 1, mask: [6] })) { return { ext: "mp2", mime: "audio/mpeg" }; } if (this.check([6], { offset: offset + 1, mask: [6] })) { return { ext: "mp1", mime: "audio/mpeg" }; } } } } new Set(extensions); new Set(mimeTypes); const hookXorEnc = () => { return new Promise((resolve, reject) => { Promise.all([hookXorKey(), hookEncBinUrl(), hookViewerMeta()]).then(([{ key: encDetectorKey }, { url: binUrl }, { json: viewerMeta }]) => { origConsole.log("viewerMeta ", viewerMeta); origConsole.log("xor key ", encDetectorKey); origConsole.log("binUrl ", binUrl); const encBinUrls = makeEncBinUrls(binUrl, viewerMeta); origConsole.log("encBinUrls ", encBinUrls.length); const saveName = makeArtworkSaveName(viewerMeta); origConsole.log("makeArtworkSaveName ", saveName); resolve({ method: "xor", data: { urls: encBinUrls, key: encDetectorKey, zipFileName: saveName, download: () => downloadAndDecryptToZip(encBinUrls, encDetectorKey, `${saveName}.zip`).catch(origConsole.error) } }); }); }); }; function makeArtworkSaveName(viewerMeta) { let creator = ""; if (viewerMeta.meta_data.creator?.length > 0) { creator = viewerMeta.meta_data.creator.join(" "); } let publisher = ""; if (viewerMeta.meta_data.publisher) { publisher = viewerMeta.meta_data.publisher; } let title = ""; if (viewerMeta.meta_data.title) { title = viewerMeta.meta_data.title; } let no = ""; const NO = extractDlsiteId(window.location.href); if (NO) { no = NO; } return `[${no}] (${publisher})(${creator}) ${title}`; } function extractNumberOrKeepOriginal(str) { const match = str.match(/\d+/); return match ? match[0] : str; } function makeEncBinUrls(binUrlExample, viewerMeta) { const binUrls = []; viewerMeta.pages.forEach(({ src }, _i) => { const url = binUrlExample.replace(/\/((i-\d+)|cover)\.enc\b/, `/${src}`); binUrls.push({ url, name: `${_i}-${extractNumberOrKeepOriginal(src.replace(".enc", ""))}` }); }); return binUrls; } const hookXorKey = () => { return new Promise((resolve, reject) => { const origPostMessage = Worker.prototype.postMessage; Worker.prototype.postMessage = function(msg, ...rest) { if (msg && msg.param) { if (msg.param.key && msg.param.method === "xor") { Worker.prototype.postMessage = origPostMessage; resolve({ key: msg.param.key }); } } return origPostMessage.call(this, msg, ...rest); }; }); }; const hookEncBinUrl = () => { return new Promise((resolve, reject) => { registerRequestHook(/\/((i-\d+)|cover)\.enc\?Policy=/, (json, response, url) => { resolve({ url }); }, true); }); }; const hookViewerMeta = () => { return new Promise((resolve, reject) => { registerRequestHook(/\/viewer\-meta\.json\b/, (json, response, url) => { resolve({ json }); }, true); }); }; function xorDecrypt(data, keyHex) { const key = Uint8Array.from(keyHex.match(/.{1,2}/g).map((b) => parseInt(b, 16))); const keyLen = key.length; const result = new Uint8Array(data.length); for (let i = 0; i < data.length; i++) { result[i] = data[i] ^ key[i % keyLen]; } return result; } function downloadArrayBuffer(url) { return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open("GET", url, true); xhr.responseType = "arraybuffer"; xhr.onload = () => { if (xhr.status === 200) resolve(xhr.response); else reject(new Error(`下载失败: ${xhr.status} ${xhr.statusText}`)); }; xhr.onerror = () => reject(new Error("XHR 请求失败")); xhr.send(); }); } const downloadAndDecryptToZip = async (files, keyHex, outputZip, concurrency = 3) => { const zipFiles = {}; let successCount = 0; let failCount = 0; const runWithConcurrency = async (tasks, maxConcurrent) => { const results = []; const executing = new Set(); for (const task of tasks) { if (executing.size >= maxConcurrent) { await Promise.race(executing); } const taskPromise = runTask(task).finally(() => { executing.delete(taskPromise); }); executing.add(taskPromise); results.push(taskPromise); } return Promise.allSettled(results); }; const runTask = async ({ url, name }) => { try { origConsole.log(`下载中: ${name}`); _unsafeWindow.add_log?.(`下载中: ${name}`); const arrayBuffer = await downloadArrayBuffer(url); const encrypted = new Uint8Array(arrayBuffer); const decrypted = xorDecrypt(encrypted, keyHex); const type = await fileTypeFromBuffer(decrypted); const ext = type ? type.ext : "bin"; const finalName = name.endsWith(`.${ext}`) ? name : `${name}.${ext}`; zipFiles[finalName] = decrypted; successCount++; origConsole.log(`✓ 已完成: ${finalName} (${type?.mime || "未知类型"})`); _unsafeWindow.add_log?.(`✓ 已完成: ${finalName} (${type?.mime || "未知类型"})`); return { success: true, name: finalName }; } catch (err2) { failCount++; origConsole.error(`✗ 处理失败: ${name}`, err2); _unsafeWindow.add_log?.(`✗ 处理失败: ${name} (${err2.message})`); return { success: false, name, error: err2.message }; } }; await runWithConcurrency(files, concurrency); if (Object.keys(zipFiles).length === 0) { const errorMsg = "所有文件处理失败,无法创建ZIP"; origConsole.error(errorMsg); _unsafeWindow.add_log?.(errorMsg); throw new Error(errorMsg); } return new Promise((resolve, reject) => { zip(zipFiles, (err2, zipped) => { if (err2) { origConsole.error("ZIP 压缩失败", err2); _unsafeWindow.add_log?.("ZIP 压缩失败", err2); reject(err2); return; } const blob = new Blob([zipped], { type: "application/zip" }); const blobUrl = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = blobUrl; a.download = outputZip; const summary = `完成: ${successCount} 成功, ${failCount} 失败 -> ${outputZip}`; origConsole.log(summary); _unsafeWindow.add_log?.(summary); resolve({ save: () => { a.click(); setTimeout(() => URL.revokeObjectURL(blobUrl), 1e3); }, successCount, failCount, blobUrl }); }); }); }; function useLog() { const log_list = vue.ref([]); function add_log(text) { log_list.value.unshift(text); } _unsafeWindow.add_log = add_log; return { log_list, add_log }; } const _export_sfc = (sfc, props) => { const target = sfc.__vccOpts || sfc; for (const [key, val] of props) { target[key] = val; } return target; }; const _hoisted_1 = ["hide"]; const _hoisted_2 = { class: "button-area" }; const _hoisted_3 = { class: "log-area" }; const _hoisted_4 = { class: "log-line" }; const _sfc_main = { __name: "App", setup(__props) { const attaching = vue.ref(false); const downloading = vue.ref(false); const download_fin = vue.ref(false); let past_pathname = null; const panel_hide = vue.ref(true); const attached_seccess = vue.ref(false); const url_nums = vue.ref(1); const downloaded_nums = vue.ref(0); let download_func = null; let save_func = null; const { log_list, add_log } = useLog(); function start_download() { downloading.value = true; download_fin.value = false; download_func?.().then(({ save: save2 }) => { save_func = save2; download_fin.value = true; downloading.value = false; }); } function save() { save_func?.(); } const attach_enc_method = () => { if (attaching.value) return; attaching.value = true; Promise.race([hookXorEnc()]).then(({ method, data }) => { add_log("检测到加密方式:" + method); origConsole.log("检测到加密方式:", method, data); if (method === "xor") { const { urls, key, zipFileName, download, onProgress } = data; add_log("检测作品页数:" + urls.length); url_nums.value = urls.length; downloaded_nums.value = 0; add_log("检测xor key:" + key); add_log("检测作品名称:" + zipFileName); attached_seccess.value = true; panel_hide.value = false; download_func = download; } }).catch((e) => { origConsole.error(e); }).finally(() => { attaching.value = false; }); }; const locationUpdated = () => { if (past_pathname != window.location.pathname) { pathnameUpdated(); } }; const pathnameUpdated = () => { add_log("页面已切换"); origConsole.log("页面已切换"); attaching.value = false; downloading.value = false; download_fin.value = false; panel_hide.value = true; attached_seccess.value = false; past_pathname = null; url_nums.value = 1; downloaded_nums.value = 0; download_func = null; save_func = null; const no = extractDlsiteId(window.location.href); if (no) { origConsole.log(no); attach_enc_method(); } }; pathnameUpdated(); const _wr = function(type) { const orig = history[type]; return function() { const rv = orig.apply(this, arguments); const e = new Event(type); e.arguments = arguments; window.dispatchEvent(e); return rv; }; }; history.pushState = _wr("pushState"); window.addEventListener("pushState", function(e) { locationUpdated(); }); function findDeep2ndParentNode(dom) { if (dom && dom.parentNode && dom.parentNode.tagName != "BODY") { return findDeep2ndParentNode(dom.parentNode); } else { return dom; } } function bodyClickCallback(e) { const deep2ndParentNode = findDeep2ndParentNode(e.target); if (!deep2ndParentNode.getAttributeNames().includes("data-v-app")) { if (!panel_hide.value) { panel_hide.value = true; } } } vue.onMounted(() => { document.body.addEventListener("click", bodyClickCallback, { capture: false, passive: false, once: false }); }); vue.onUnmounted(() => { document.body.removeEventListener("click", bodyClickCallback); }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", { class: "plugin-area", hide: panel_hide.value, onMouseover: _cache[0] || (_cache[0] = ($event) => panel_hide.value = false), onWheel: _cache[1] || (_cache[1] = vue.withModifiers(() => { }, ["stop"])) }, [ _cache[2] || (_cache[2] = vue.createElementVNode("div", { class: "title" }, "DLsite-Play-Downloader-vue", -1)), vue.createElementVNode("div", _hoisted_2, [ !downloading.value && !download_fin.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), { key: 0, loading: attaching.value, disabled: !attached_seccess.value, dark: false, color: "var(--surface-on-surface-primary)", onClick: start_download, style: { "color": "white" } }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(attaching.value ? "检测加密方式中" : "开始下载"), 1) ]), _: 1 }, 8, ["loading", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElButton), { key: 1, loading: downloading.value, disabled: !download_fin.value, dark: false, color: "var(--surface-on-surface-primary)", onClick: save, style: { "color": "white" } }, { default: vue.withCtx(() => [ vue.createTextVNode(vue.toDisplayString(downloading.value ? "下载中" : "保存压缩文件"), 1) ]), _: 1 }, 8, ["loading", "disabled"])) ]), vue.createElementVNode("div", _hoisted_3, [ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(log_list), (log) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_4, vue.toDisplayString(log), 1); }), 256)) ]) ], 40, _hoisted_1); }; } }; const App = _export_sfc(_sfc_main, [["__scopeId", "data-v-9122b10d"]]); vue.createApp(App).mount( (() => { const app = document.createElement("div"); app.className = "dlsite-play-downloader-vue"; document.body.append(app); return app; })() ); })(Vue);