vue-book-reader
Version:
<div align="center"> <img width=250 src="https://raw.githubusercontent.com/jinhuan138/vue--book-reader/master/public/logo.png" /> <h1>VueReader</h1> </div>
1,242 lines (1,240 loc) • 19.1 MB
JavaScript
(function(global2, factory) {
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["vue-book-reader"] = {}, global2.Vue));
})(this, function(exports2, vue) {
"use strict";var __accessCheck = (obj, member, msg) => {
if (!member.has(obj))
throw TypeError("Cannot " + msg);
};
var __privateGet = (obj, member, getter) => {
__accessCheck(obj, member, "read from private field");
return getter ? getter.call(obj) : member.get(obj);
};
var __privateAdd = (obj, member, value) => {
if (member.has(obj))
throw TypeError("Cannot add the same private member more than once");
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
};
var __privateSet = (obj, member, value, setter) => {
__accessCheck(obj, member, "write to private field");
setter ? setter.call(obj, value) : member.set(obj, value);
return value;
};
var __privateWrapper = (obj, member, setter, getter) => ({
set _(value) {
__privateSet(obj, member, value, setter);
},
get _() {
return __privateGet(obj, member, getter);
}
});
var __privateMethod = (obj, member, method) => {
__accessCheck(obj, member, "access private method");
return method;
};
var _a, _fakeWorkerId, _isWorkerDisabled, _workerPorts, _resolve, resolve_fn, _mainThreadWorkerMessageHandler, mainThreadWorkerMessageHandler_get;
var __vite_style__ = document.createElement("style");
__vite_style__.textContent = "\n.reader[data-v-8392fe11] {\r\n position: absolute;\r\n inset: 50px 50px 20px;\n}\n.viewHolder[data-v-8392fe11] {\r\n height: 100%;\r\n width: 100%;\r\n position: relative;\n}\n#viewer[data-v-8392fe11] {\r\n height: 100%;\n}\r\n\r\n/* ↓ */\n.tocAreaButton .expansion[data-v-300395c2]::before {\r\n transform: rotate(-45deg) translateX(2.5px);\n}\n.tocAreaButton .expansion[data-v-300395c2]::after {\r\n transform: rotate(45deg) translateX(-2.5px);\n}\r\n\r\n/* ↑ */\n.tocAreaButton .open[data-v-300395c2]::before {\r\n transform: rotate(45deg) translateX(2.5px);\n}\n.tocAreaButton .open[data-v-300395c2]::after {\r\n transform: rotate(-45deg) translateX(-2.5px);\n}\n.tocAreaButton[data-v-300395c2] {\r\n user-select: none;\r\n appearance: none;\r\n background: none;\r\n border: none;\r\n display: block;\r\n font-family: sans-serif;\r\n width: 100%;\r\n font-size: 0.9em;\r\n text-align: left;\r\n padding: 0.9em 1em;\r\n border-bottom: 1px solid #ddd;\r\n color: #aaa;\r\n box-sizing: border-box;\r\n outline: none;\r\n cursor: pointer;\r\n position: relative;\n}\n.tocAreaButton[data-v-300395c2]:hover {\r\n background: rgba(0, 0, 0, 0.05);\n}\n.tocAreaButton[data-v-300395c2]:active {\r\n background: rgba(0, 0, 0, 0.1);\n}\n.active[data-v-300395c2] {\r\n color: #1565c0;\r\n border-bottom: 2px solid #1565c0;\n}\r\n\r\n/* 二级目录 */\n.tocAreaButton .expansion[data-v-300395c2] {\r\n cursor: pointer;\r\n transform: translateY(-50%);\r\n top: 50%;\r\n right: 12px;\r\n position: absolute;\r\n width: 10px;\r\n background-color: #a2a5b4;\r\n transition:\r\n transform 0.3s ease-in-out,\r\n top 0.3s ease-in-out;\n}\n.tocAreaButton .expansion[data-v-300395c2]::after,\r\n.tocAreaButton .expansion[data-v-300395c2]::before {\r\n content: '';\r\n position: absolute;\r\n width: 6px;\r\n height: 2px;\r\n background-color: currentcolor;\r\n border-radius: 2px;\r\n transition:\r\n transform 0.3s ease-in-out,\r\n top 0.3s ease-in-out;\n}\r\n\r\n/* container */\n.container[data-v-a2442a4b] {\r\n overflow: hidden;\r\n position: relative;\r\n height: 100%;\n}\n.containerExpanded[data-v-a2442a4b] {\r\n transform: translateX(256px);\n}\n.readerArea[data-v-a2442a4b] {\r\n position: relative;\r\n z-index: 1;\r\n height: 100%;\r\n width: 100%;\r\n background-color: #fff;\r\n transition: all 0.3s ease;\n}\n.container .titleArea[data-v-a2442a4b] {\r\n position: absolute;\r\n top: 20px;\r\n left: 50px;\r\n right: 50px;\r\n text-align: center;\r\n color: #999;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\n}\r\n\r\n/* toc */\n.tocBackground[data-v-a2442a4b] {\r\n position: absolute;\r\n left: 256px;\r\n top: 0;\r\n bottom: 0;\r\n right: 0;\r\n z-index: 1;\n}\n.tocArea[data-v-a2442a4b] {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n bottom: 0;\r\n z-index: 0;\r\n width: 256px;\r\n overflow-y: auto;\r\n -webkit-overflow-scrolling: touch;\r\n background: #f2f2f2;\r\n padding: 10px 0;\n}\r\n\r\n/* 滚动条 */\n.tocArea[data-v-a2442a4b]::-webkit-scrollbar {\r\n width: 5px;\r\n height: 5px;\n}\n.tocArea[data-v-a2442a4b]::-webkit-scrollbar-thumb:vertical {\r\n height: 5px;\r\n background-color: rgba(0, 0, 0, 0.1);\r\n border-radius: 0.5rem;\n}\r\n\r\n/* tocButton */\n.tocButton[data-v-a2442a4b] {\r\n background: none;\r\n border: none;\r\n width: 32px;\r\n height: 32px;\r\n position: absolute;\r\n top: 10px;\r\n left: 10px;\r\n border-radius: 2px;\r\n outline: none;\r\n cursor: pointer;\n}\n.tocButtonBar[data-v-a2442a4b] {\r\n position: absolute;\r\n width: 60%;\r\n background: #ccc;\r\n height: 2px;\r\n left: 50%;\r\n margin: -1px -30%;\r\n top: 50%;\r\n transition: all 0.5s ease;\n}\n.tocButtonExpanded[data-v-a2442a4b] {\r\n background: #f2f2f2;\n}\r\n\r\n/* 翻页 */\n.arrow[data-v-a2442a4b] {\r\n outline: none;\r\n border: none;\r\n background: none;\r\n position: absolute;\r\n top: 50%;\r\n margin-top: -32px;\r\n font-size: 64px;\r\n padding: 0 10px;\r\n color: #e2e2e2;\r\n font-family: arial, sans-serif;\r\n cursor: pointer;\r\n user-select: none;\r\n appearance: none;\r\n font-weight: normal;\n}\n.arrow[data-v-a2442a4b]:hover {\r\n color: #777;\n}\n.arrow[data-v-a2442a4b]:disabled {\r\n cursor: not-allowed;\r\n color: #e2e2e2;\n}\n.prev[data-v-a2442a4b] {\r\n left: 1px;\n}\n.next[data-v-a2442a4b] {\r\n right: 1px;\n}\r\n\r\n/* loading */\n.loadingView[data-v-a2442a4b] {\r\n position: absolute;\r\n top: 50%;\r\n left: 10%;\r\n right: 10%;\r\n color: #ccc;\r\n text-align: center;\r\n margin-top: -0.5em;\n}\r\n\r\n/* errorView */\n.errorView[data-v-a2442a4b] {\r\n position: absolute;\r\n top: 50%;\r\n left: 10%;\r\n right: 10%;\r\n color: #c00;\r\n text-align: center;\r\n margin-top: -.5em;\n}\r\n";
document.head.appendChild(__vite_style__);
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
var check = function(it2) {
return it2 && it2.Math === Math && it2;
};
var globalThis_1 = (
// eslint-disable-next-line es/no-global-this -- safe
check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || // eslint-disable-next-line no-restricted-globals -- safe
check(typeof self == "object" && self) || check(typeof commonjsGlobal == "object" && commonjsGlobal) || check(typeof commonjsGlobal == "object" && commonjsGlobal) || // eslint-disable-next-line no-new-func -- fallback
/* @__PURE__ */ function() {
return this;
}() || Function("return this")()
);
var objectGetOwnPropertyDescriptor = {};
var fails$a = function(exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
var fails$9 = fails$a;
var descriptors = !fails$9(function() {
return Object.defineProperty({}, 1, { get: function() {
return 7;
} })[1] !== 7;
});
var fails$8 = fails$a;
var functionBindNative = !fails$8(function() {
var test2 = (function() {
}).bind();
return typeof test2 != "function" || test2.hasOwnProperty("prototype");
});
var NATIVE_BIND$2 = functionBindNative;
var call$7 = Function.prototype.call;
var functionCall = NATIVE_BIND$2 ? call$7.bind(call$7) : function() {
return call$7.apply(call$7, arguments);
};
var objectPropertyIsEnumerable = {};
var $propertyIsEnumerable = {}.propertyIsEnumerable;
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V2) {
var descriptor = getOwnPropertyDescriptor$1(this, V2);
return !!descriptor && descriptor.enumerable;
} : $propertyIsEnumerable;
var createPropertyDescriptor$2 = function(bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value
};
};
var NATIVE_BIND$1 = functionBindNative;
var FunctionPrototype$1 = Function.prototype;
var call$6 = FunctionPrototype$1.call;
var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$6, call$6);
var functionUncurryThis = NATIVE_BIND$1 ? uncurryThisWithBind : function(fn) {
return function() {
return call$6.apply(fn, arguments);
};
};
var uncurryThis$d = functionUncurryThis;
var toString$2 = uncurryThis$d({}.toString);
var stringSlice$1 = uncurryThis$d("".slice);
var classofRaw$2 = function(it2) {
return stringSlice$1(toString$2(it2), 8, -1);
};
var uncurryThis$c = functionUncurryThis;
var fails$7 = fails$a;
var classof$2 = classofRaw$2;
var $Object$3 = Object;
var split = uncurryThis$c("".split);
var indexedObject = fails$7(function() {
return !$Object$3("z").propertyIsEnumerable(0);
}) ? function(it2) {
return classof$2(it2) === "String" ? split(it2, "") : $Object$3(it2);
} : $Object$3;
var isNullOrUndefined$3 = function(it2) {
return it2 === null || it2 === void 0;
};
var isNullOrUndefined$2 = isNullOrUndefined$3;
var $TypeError$7 = TypeError;
var requireObjectCoercible$4 = function(it2) {
if (isNullOrUndefined$2(it2))
throw new $TypeError$7("Can't call method on " + it2);
return it2;
};
var IndexedObject = indexedObject;
var requireObjectCoercible$3 = requireObjectCoercible$4;
var toIndexedObject$3 = function(it2) {
return IndexedObject(requireObjectCoercible$3(it2));
};
var documentAll = typeof document == "object" && document.all;
var isCallable$b = typeof documentAll == "undefined" && documentAll !== void 0 ? function(argument) {
return typeof argument == "function" || argument === documentAll;
} : function(argument) {
return typeof argument == "function";
};
var isCallable$a = isCallable$b;
var isObject$5 = function(it2) {
return typeof it2 == "object" ? it2 !== null : isCallable$a(it2);
};
var globalThis$b = globalThis_1;
var isCallable$9 = isCallable$b;
var aFunction = function(argument) {
return isCallable$9(argument) ? argument : void 0;
};
var getBuiltIn$3 = function(namespace, method) {
return arguments.length < 2 ? aFunction(globalThis$b[namespace]) : globalThis$b[namespace] && globalThis$b[namespace][method];
};
var uncurryThis$b = functionUncurryThis;
var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
var globalThis$a = globalThis_1;
var navigator$1 = globalThis$a.navigator;
var userAgent$1 = navigator$1 && navigator$1.userAgent;
var environmentUserAgent = userAgent$1 ? String(userAgent$1) : "";
var globalThis$9 = globalThis_1;
var userAgent = environmentUserAgent;
var process$1 = globalThis$9.process;
var Deno = globalThis$9.Deno;
var versions = process$1 && process$1.versions || Deno && Deno.version;
var v8 = versions && versions.v8;
var match, version$1;
if (v8) {
match = v8.split(".");
version$1 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
}
if (!version$1 && userAgent) {
match = userAgent.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = userAgent.match(/Chrome\/(\d+)/);
if (match)
version$1 = +match[1];
}
}
var environmentV8Version = version$1;
var V8_VERSION = environmentV8Version;
var fails$6 = fails$a;
var globalThis$8 = globalThis_1;
var $String$3 = globalThis$8.String;
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$6(function() {
var symbol = Symbol("symbol detection");
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
});
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
var useSymbolAsUid = NATIVE_SYMBOL$1 && !Symbol.sham && typeof Symbol.iterator == "symbol";
var getBuiltIn$2 = getBuiltIn$3;
var isCallable$8 = isCallable$b;
var isPrototypeOf$1 = objectIsPrototypeOf;
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
var $Object$2 = Object;
var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function(it2) {
return typeof it2 == "symbol";
} : function(it2) {
var $Symbol = getBuiltIn$2("Symbol");
return isCallable$8($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it2));
};
var $String$2 = String;
var tryToString$3 = function(argument) {
try {
return $String$2(argument);
} catch (error) {
return "Object";
}
};
var isCallable$7 = isCallable$b;
var tryToString$2 = tryToString$3;
var $TypeError$6 = TypeError;
var aCallable$5 = function(argument) {
if (isCallable$7(argument))
return argument;
throw new $TypeError$6(tryToString$2(argument) + " is not a function");
};
var aCallable$4 = aCallable$5;
var isNullOrUndefined$1 = isNullOrUndefined$3;
var getMethod$3 = function(V2, P2) {
var func = V2[P2];
return isNullOrUndefined$1(func) ? void 0 : aCallable$4(func);
};
var call$5 = functionCall;
var isCallable$6 = isCallable$b;
var isObject$4 = isObject$5;
var $TypeError$5 = TypeError;
var ordinaryToPrimitive$1 = function(input, pref) {
var fn, val;
if (pref === "string" && isCallable$6(fn = input.toString) && !isObject$4(val = call$5(fn, input)))
return val;
if (isCallable$6(fn = input.valueOf) && !isObject$4(val = call$5(fn, input)))
return val;
if (pref !== "string" && isCallable$6(fn = input.toString) && !isObject$4(val = call$5(fn, input)))
return val;
throw new $TypeError$5("Can't convert object to primitive value");
};
var sharedStore = { exports: {} };
var globalThis$7 = globalThis_1;
var defineProperty$1 = Object.defineProperty;
var defineGlobalProperty$3 = function(key, value) {
try {
defineProperty$1(globalThis$7, key, { value, configurable: true, writable: true });
} catch (error) {
globalThis$7[key] = value;
}
return value;
};
var globalThis$6 = globalThis_1;
var defineGlobalProperty$2 = defineGlobalProperty$3;
var SHARED = "__core-js_shared__";
var store$3 = sharedStore.exports = globalThis$6[SHARED] || defineGlobalProperty$2(SHARED, {});
(store$3.versions || (store$3.versions = [])).push({
version: "3.45.1",
mode: "global",
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
license: "https://github.com/zloirock/core-js/blob/v3.45.1/LICENSE",
source: "https://github.com/zloirock/core-js"
});
var sharedStoreExports = sharedStore.exports;
var store$2 = sharedStoreExports;
var shared$3 = function(key, value) {
return store$2[key] || (store$2[key] = value || {});
};
var requireObjectCoercible$2 = requireObjectCoercible$4;
var $Object$1 = Object;
var toObject$1 = function(argument) {
return $Object$1(requireObjectCoercible$2(argument));
};
var uncurryThis$a = functionUncurryThis;
var toObject = toObject$1;
var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
var hasOwnProperty_1 = Object.hasOwn || function hasOwn2(it2, key) {
return hasOwnProperty(toObject(it2), key);
};
var uncurryThis$9 = functionUncurryThis;
var id = 0;
var postfix = Math.random();
var toString$1 = uncurryThis$9(1.1.toString);
var uid$3 = function(key) {
return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString$1(++id + postfix, 36);
};
var globalThis$5 = globalThis_1;
var shared$2 = shared$3;
var hasOwn$6 = hasOwnProperty_1;
var uid$2 = uid$3;
var NATIVE_SYMBOL = symbolConstructorDetection;
var USE_SYMBOL_AS_UID = useSymbolAsUid;
var Symbol$1 = globalThis$5.Symbol;
var WellKnownSymbolsStore = shared$2("wks");
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1["for"] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$2;
var wellKnownSymbol$5 = function(name) {
if (!hasOwn$6(WellKnownSymbolsStore, name)) {
WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$6(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name);
}
return WellKnownSymbolsStore[name];
};
var call$4 = functionCall;
var isObject$3 = isObject$5;
var isSymbol$1 = isSymbol$2;
var getMethod$2 = getMethod$3;
var ordinaryToPrimitive = ordinaryToPrimitive$1;
var wellKnownSymbol$4 = wellKnownSymbol$5;
var $TypeError$4 = TypeError;
var TO_PRIMITIVE = wellKnownSymbol$4("toPrimitive");
var toPrimitive$1 = function(input, pref) {
if (!isObject$3(input) || isSymbol$1(input))
return input;
var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
var result;
if (exoticToPrim) {
if (pref === void 0)
pref = "default";
result = call$4(exoticToPrim, input, pref);
if (!isObject$3(result) || isSymbol$1(result))
return result;
throw new $TypeError$4("Can't convert object to primitive value");
}
if (pref === void 0)
pref = "number";
return ordinaryToPrimitive(input, pref);
};
var toPrimitive = toPrimitive$1;
var isSymbol = isSymbol$2;
var toPropertyKey$3 = function(argument) {
var key = toPrimitive(argument, "string");
return isSymbol(key) ? key : key + "";
};
var globalThis$4 = globalThis_1;
var isObject$2 = isObject$5;
var document$1 = globalThis$4.document;
var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
var documentCreateElement = function(it2) {
return EXISTS$1 ? document$1.createElement(it2) : {};
};
var DESCRIPTORS$6 = descriptors;
var fails$5 = fails$a;
var createElement = documentCreateElement;
var ie8DomDefine = !DESCRIPTORS$6 && !fails$5(function() {
return Object.defineProperty(createElement("div"), "a", {
get: function() {
return 7;
}
}).a !== 7;
});
var DESCRIPTORS$5 = descriptors;
var call$3 = functionCall;
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
var createPropertyDescriptor$1 = createPropertyDescriptor$2;
var toIndexedObject$2 = toIndexedObject$3;
var toPropertyKey$2 = toPropertyKey$3;
var hasOwn$5 = hasOwnProperty_1;
var IE8_DOM_DEFINE$1 = ie8DomDefine;
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor2(O2, P2) {
O2 = toIndexedObject$2(O2);
P2 = toPropertyKey$2(P2);
if (IE8_DOM_DEFINE$1)
try {
return $getOwnPropertyDescriptor$1(O2, P2);
} catch (error) {
}
if (hasOwn$5(O2, P2))
return createPropertyDescriptor$1(!call$3(propertyIsEnumerableModule.f, O2, P2), O2[P2]);
};
var objectDefineProperty = {};
var DESCRIPTORS$4 = descriptors;
var fails$4 = fails$a;
var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$4(function() {
return Object.defineProperty(function() {
}, "prototype", {
value: 42,
writable: false
}).prototype !== 42;
});
var isObject$1 = isObject$5;
var $String$1 = String;
var $TypeError$3 = TypeError;
var anObject$5 = function(argument) {
if (isObject$1(argument))
return argument;
throw new $TypeError$3($String$1(argument) + " is not an object");
};
var DESCRIPTORS$3 = descriptors;
var IE8_DOM_DEFINE = ie8DomDefine;
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
var anObject$4 = anObject$5;
var toPropertyKey$1 = toPropertyKey$3;
var $TypeError$2 = TypeError;
var $defineProperty = Object.defineProperty;
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var ENUMERABLE = "enumerable";
var CONFIGURABLE$1 = "configurable";
var WRITABLE = "writable";
objectDefineProperty.f = DESCRIPTORS$3 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty2(O2, P2, Attributes2) {
anObject$4(O2);
P2 = toPropertyKey$1(P2);
anObject$4(Attributes2);
if (typeof O2 === "function" && P2 === "prototype" && "value" in Attributes2 && WRITABLE in Attributes2 && !Attributes2[WRITABLE]) {
var current = $getOwnPropertyDescriptor(O2, P2);
if (current && current[WRITABLE]) {
O2[P2] = Attributes2.value;
Attributes2 = {
configurable: CONFIGURABLE$1 in Attributes2 ? Attributes2[CONFIGURABLE$1] : current[CONFIGURABLE$1],
enumerable: ENUMERABLE in Attributes2 ? Attributes2[ENUMERABLE] : current[ENUMERABLE],
writable: false
};
}
}
return $defineProperty(O2, P2, Attributes2);
} : $defineProperty : function defineProperty2(O2, P2, Attributes2) {
anObject$4(O2);
P2 = toPropertyKey$1(P2);
anObject$4(Attributes2);
if (IE8_DOM_DEFINE)
try {
return $defineProperty(O2, P2, Attributes2);
} catch (error) {
}
if ("get" in Attributes2 || "set" in Attributes2)
throw new $TypeError$2("Accessors not supported");
if ("value" in Attributes2)
O2[P2] = Attributes2.value;
return O2;
};
var DESCRIPTORS$2 = descriptors;
var definePropertyModule$2 = objectDefineProperty;
var createPropertyDescriptor = createPropertyDescriptor$2;
var createNonEnumerableProperty$2 = DESCRIPTORS$2 ? function(object, key, value) {
return definePropertyModule$2.f(object, key, createPropertyDescriptor(1, value));
} : function(object, key, value) {
object[key] = value;
return object;
};
var makeBuiltIn$2 = { exports: {} };
var DESCRIPTORS$1 = descriptors;
var hasOwn$4 = hasOwnProperty_1;
var FunctionPrototype = Function.prototype;
var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
var EXISTS = hasOwn$4(FunctionPrototype, "name");
var PROPER = EXISTS && (function something() {
}).name === "something";
var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || DESCRIPTORS$1 && getDescriptor(FunctionPrototype, "name").configurable);
var functionName = {
EXISTS,
PROPER,
CONFIGURABLE
};
var uncurryThis$8 = functionUncurryThis;
var isCallable$5 = isCallable$b;
var store$1 = sharedStoreExports;
var functionToString = uncurryThis$8(Function.toString);
if (!isCallable$5(store$1.inspectSource)) {
store$1.inspectSource = function(it2) {
return functionToString(it2);
};
}
var inspectSource$1 = store$1.inspectSource;
var globalThis$3 = globalThis_1;
var isCallable$4 = isCallable$b;
var WeakMap$2 = globalThis$3.WeakMap;
var weakMapBasicDetection = isCallable$4(WeakMap$2) && /native code/.test(String(WeakMap$2));
var shared$1 = shared$3;
var uid$1 = uid$3;
var keys = shared$1("keys");
var sharedKey$1 = function(key) {
return keys[key] || (keys[key] = uid$1(key));
};
var hiddenKeys$3 = {};
var NATIVE_WEAK_MAP = weakMapBasicDetection;
var globalThis$2 = globalThis_1;
var isObject = isObject$5;
var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
var hasOwn$3 = hasOwnProperty_1;
var shared = sharedStoreExports;
var sharedKey = sharedKey$1;
var hiddenKeys$2 = hiddenKeys$3;
var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
var TypeError$1 = globalThis$2.TypeError;
var WeakMap$1 = globalThis$2.WeakMap;
var set$1, get$1, has$1;
var enforce = function(it2) {
return has$1(it2) ? get$1(it2) : set$1(it2, {});
};
var getterFor = function(TYPE) {
return function(it2) {
var state;
if (!isObject(it2) || (state = get$1(it2)).type !== TYPE) {
throw new TypeError$1("Incompatible receiver, " + TYPE + " required");
}
return state;
};
};
if (NATIVE_WEAK_MAP || shared.state) {
var store = shared.state || (shared.state = new WeakMap$1());
store.get = store.get;
store.has = store.has;
store.set = store.set;
set$1 = function(it2, metadata) {
if (store.has(it2))
throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it2;
store.set(it2, metadata);
return metadata;
};
get$1 = function(it2) {
return store.get(it2) || {};
};
has$1 = function(it2) {
return store.has(it2);
};
} else {
var STATE = sharedKey("state");
hiddenKeys$2[STATE] = true;
set$1 = function(it2, metadata) {
if (hasOwn$3(it2, STATE))
throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
metadata.facade = it2;
createNonEnumerableProperty$1(it2, STATE, metadata);
return metadata;
};
get$1 = function(it2) {
return hasOwn$3(it2, STATE) ? it2[STATE] : {};
};
has$1 = function(it2) {
return hasOwn$3(it2, STATE);
};
}
var internalState = {
set: set$1,
get: get$1,
has: has$1,
enforce,
getterFor
};
var uncurryThis$7 = functionUncurryThis;
var fails$3 = fails$a;
var isCallable$3 = isCallable$b;
var hasOwn$2 = hasOwnProperty_1;
var DESCRIPTORS = descriptors;
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
var inspectSource = inspectSource$1;
var InternalStateModule = internalState;
var enforceInternalState = InternalStateModule.enforce;
var getInternalState = InternalStateModule.get;
var $String = String;
var defineProperty = Object.defineProperty;
var stringSlice = uncurryThis$7("".slice);
var replace = uncurryThis$7("".replace);
var join = uncurryThis$7([].join);
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails$3(function() {
return defineProperty(function() {
}, "length", { value: 8 }).length !== 8;
});
var TEMPLATE = String(String).split("String");
var makeBuiltIn$1 = makeBuiltIn$2.exports = function(value, name, options) {
if (stringSlice($String(name), 0, 7) === "Symbol(") {
name = "[" + replace($String(name), /^Symbol\(([^)]*)\).*$/, "$1") + "]";
}
if (options && options.getter)
name = "get " + name;
if (options && options.setter)
name = "set " + name;
if (!hasOwn$2(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
if (DESCRIPTORS)
defineProperty(value, "name", { value: name, configurable: true });
else
value.name = name;
}
if (CONFIGURABLE_LENGTH && options && hasOwn$2(options, "arity") && value.length !== options.arity) {
defineProperty(value, "length", { value: options.arity });
}
try {
if (options && hasOwn$2(options, "constructor") && options.constructor) {
if (DESCRIPTORS)
defineProperty(value, "prototype", { writable: false });
} else if (value.prototype)
value.prototype = void 0;
} catch (error) {
}
var state = enforceInternalState(value);
if (!hasOwn$2(state, "source")) {
state.source = join(TEMPLATE, typeof name == "string" ? name : "");
}
return value;
};
Function.prototype.toString = makeBuiltIn$1(function toString2() {
return isCallable$3(this) && getInternalState(this).source || inspectSource(this);
}, "toString");
var makeBuiltInExports = makeBuiltIn$2.exports;
var isCallable$2 = isCallable$b;
var definePropertyModule$1 = objectDefineProperty;
var makeBuiltIn = makeBuiltInExports;
var defineGlobalProperty$1 = defineGlobalProperty$3;
var defineBuiltIn$1 = function(O2, key, value, options) {
if (!options)
options = {};
var simple = options.enumerable;
var name = options.name !== void 0 ? options.name : key;
if (isCallable$2(value))
makeBuiltIn(value, name, options);
if (options.global) {
if (simple)
O2[key] = value;
else
defineGlobalProperty$1(key, value);
} else {
try {
if (!options.unsafe)
delete O2[key];
else if (O2[key])
simple = true;
} catch (error) {
}
if (simple)
O2[key] = value;
else
definePropertyModule$1.f(O2, key, {
value,
enumerable: false,
configurable: !options.nonConfigurable,
writable: !options.nonWritable
});
}
return O2;
};
var objectGetOwnPropertyNames = {};
var ceil = Math.ceil;
var floor = Math.floor;
var mathTrunc = Math.trunc || function trunc2(x2) {
var n2 = +x2;
return (n2 > 0 ? floor : ceil)(n2);
};
var trunc = mathTrunc;
var toIntegerOrInfinity$2 = function(argument) {
var number = +argument;
return number !== number || number === 0 ? 0 : trunc(number);
};
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
var max = Math.max;
var min$1 = Math.min;
var toAbsoluteIndex$1 = function(index, length) {
var integer = toIntegerOrInfinity$1(index);
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
};
var toIntegerOrInfinity = toIntegerOrInfinity$2;
var min = Math.min;
var toLength$1 = function(argument) {
var len = toIntegerOrInfinity(argument);
return len > 0 ? min(len, 9007199254740991) : 0;
};
var toLength = toLength$1;
var lengthOfArrayLike$2 = function(obj) {
return toLength(obj.length);
};
var toIndexedObject$1 = toIndexedObject$3;
var toAbsoluteIndex = toAbsoluteIndex$1;
var lengthOfArrayLike$1 = lengthOfArrayLike$2;
var createMethod = function(IS_INCLUDES) {
return function($this, el, fromIndex) {
var O2 = toIndexedObject$1($this);
var length = lengthOfArrayLike$1(O2);
if (length === 0)
return !IS_INCLUDES && -1;
var index = toAbsoluteIndex(fromIndex, length);
var value;
if (IS_INCLUDES && el !== el)
while (length > index) {
value = O2[index++];
if (value !== value)
return true;
}
else
for (; length > index; index++) {
if ((IS_INCLUDES || index in O2) && O2[index] === el)
return IS_INCLUDES || index || 0;
}
return !IS_INCLUDES && -1;
};
};
var arrayIncludes = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: createMethod(true),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: createMethod(false)
};
var uncurryThis$6 = functionUncurryThis;
var hasOwn$1 = hasOwnProperty_1;
var toIndexedObject = toIndexedObject$3;
var indexOf = arrayIncludes.indexOf;
var hiddenKeys$1 = hiddenKeys$3;
var push$2 = uncurryThis$6([].push);
var objectKeysInternal = function(object, names) {
var O2 = toIndexedObject(object);
var i2 = 0;
var result = [];
var key;
for (key in O2)
!hasOwn$1(hiddenKeys$1, key) && hasOwn$1(O2, key) && push$2(result, key);
while (names.length > i2)
if (hasOwn$1(O2, key = names[i2++])) {
~indexOf(result, key) || push$2(result, key);
}
return result;
};
var enumBugKeys$1 = [
"constructor",
"hasOwnProperty",
"isPrototypeOf",
"propertyIsEnumerable",
"toLocaleString",
"toString",
"valueOf"
];
var internalObjectKeys = objectKeysInternal;
var enumBugKeys = enumBugKeys$1;
var hiddenKeys = enumBugKeys.concat("length", "prototype");
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O2) {
return internalObjectKeys(O2, hiddenKeys);
};
var objectGetOwnPropertySymbols = {};
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
var getBuiltIn$1 = getBuiltIn$3;
var uncurryThis$5 = functionUncurryThis;
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
var anObject$3 = anObject$5;
var concat = uncurryThis$5([].concat);
var ownKeys$1 = getBuiltIn$1("Reflect", "ownKeys") || function ownKeys2(it2) {
var keys2 = getOwnPropertyNamesModule.f(anObject$3(it2));
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
return getOwnPropertySymbols ? concat(keys2, getOwnPropertySymbols(it2)) : keys2;
};
var hasOwn = hasOwnProperty_1;
var ownKeys = ownKeys$1;
var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
var definePropertyModule = objectDefineProperty;
var copyConstructorProperties$1 = function(target, source, exceptions) {
var keys2 = ownKeys(source);
var defineProperty2 = definePropertyModule.f;
var getOwnPropertyDescriptor2 = getOwnPropertyDescriptorModule.f;
for (var i2 = 0; i2 < keys2.length; i2++) {
var key = keys2[i2];
if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
defineProperty2(target, key, getOwnPropertyDescriptor2(source, key));
}
}
};
var fails$2 = fails$a;
var isCallable$1 = isCallable$b;
var replacement = /#|\.prototype\./;
var isForced$1 = function(feature, detection) {
var value = data[normalize(feature)];
return value === POLYFILL ? true : value === NATIVE ? false : isCallable$1(detection) ? fails$2(detection) : !!detection;
};
var normalize = isForced$1.normalize = function(string) {
return String(string).replace(replacement, ".").toLowerCase();
};
var data = isForced$1.data = {};
var NATIVE = isForced$1.NATIVE = "N";
var POLYFILL = isForced$1.POLYFILL = "P";
var isForced_1 = isForced$1;
var globalThis$1 = globalThis_1;
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
var createNonEnumerableProperty = createNonEnumerableProperty$2;
var defineBuiltIn = defineBuiltIn$1;
var defineGlobalProperty = defineGlobalProperty$3;
var copyConstructorProperties = copyConstructorProperties$1;
var isForced = isForced_1;
var _export = function(options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
if (GLOBAL) {
target = globalThis$1;
} else if (STATIC) {
target = globalThis$1[TARGET] || defineGlobalProperty(TARGET, {});
} else {
target = globalThis$1[TARGET] && globalThis$1[TARGET].prototype;
}
if (target)
for (key in source) {
sourceProperty = source[key];
if (options.dontCallGetSet) {
descriptor = getOwnPropertyDescriptor(target, key);
targetProperty = descriptor && descriptor.value;
} else
targetProperty = target[key];
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
if (!FORCED && targetProperty !== void 0) {
if (typeof sourceProperty == typeof targetProperty)
continue;
copyConstructorProperties(sourceProperty, targetProperty);
}
if (options.sham || targetProperty && targetProperty.sham) {
createNonEnumerableProperty(sourceProperty, "sham", true);
}
defineBuiltIn(target, key, sourceProperty, options);
}
};
var classofRaw$1 = classofRaw$2;
var uncurryThis$4 = functionUncurryThis;
var functionUncurryThisClause = function(fn) {
if (classofRaw$1(fn) === "Function")
return uncurryThis$4(fn);
};
var uncurryThis$3 = functionUncurryThisClause;
var aCallable$3 = aCallable$5;
var NATIVE_BIND = functionBindNative;
var bind$1 = uncurryThis$3(uncurryThis$3.bind);
var functionBindContext = function(fn, that) {
aCallable$3(fn);
return that === void 0 ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
return fn.apply(that, arguments);
};
};
var iterators = {};
var wellKnownSymbol$3 = wellKnownSymbol$5;
var Iterators$1 = iterators;
var ITERATOR$1 = wellKnownSymbol$3("iterator");
var ArrayPrototype = Array.prototype;
var isArrayIteratorMethod$1 = function(it2) {
return it2 !== void 0 && (Iterators$1.Array === it2 || ArrayPrototype[ITERATOR$1] === it2);
};
var wellKnownSymbol$2 = wellKnownSymbol$5;
var TO_STRING_TAG$1 = wellKnownSymbol$2("toStringTag");
var test = {};
test[TO_STRING_TAG$1] = "z";
var toStringTagSupport = String(test) === "[object z]";
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
var isCallable = isCallable$b;
var classofRaw = classofRaw$2;
var wellKnownSymbol$1 = wellKnownSymbol$5;
var TO_STRING_TAG = wellKnownSymbol$1("toStringTag");
var $Object = Object;
var CORRECT_ARGUMENTS = classofRaw(/* @__PURE__ */ function() {
return arguments;
}()) === "Arguments";
var tryGet = function(it2, key) {
try {
return it2[key];
} catch (error) {
}
};
var classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function(it2) {
var O2, tag, result;
return it2 === void 0 ? "Undefined" : it2 === null ? "Null" : typeof (tag = tryGet(O2 = $Object(it2), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O2) : (result = classofRaw(O2)) === "Object" && isCallable(O2.callee) ? "Arguments" : result;
};
var classof = classof$1;
var getMethod$1 = getMethod$3;
var isNullOrUndefined = isNullOrUndefined$3;
var Iterators = iterators;
var wellKnownSymbol = wellKnownSymbol$5;
var ITERATOR = wellKnownSymbol("iterator");
var getIteratorMethod$2 = function(it2) {
if (!isNullOrUndefined(it2))
return getMethod$1(it2, ITERATOR) || getMethod$1(it2, "@@iterator") || Iterators[classof(it2)];
};
var call$2 = functionCall;
var aCallable$2 = aCallable$5;
var anObject$2 = anObject$5;
var tryToString$1 = tryToString$3;
var getIteratorMethod$1 = getIteratorMethod$2;
var $TypeError$1 = TypeError;
var getIterator$1 = function(argument, usingIterator) {
var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
if (aCallable$2(iteratorMethod))
return anObject$2(call$2(iteratorMethod, argument));
throw new $TypeError$1(tryToString$1(argument) + " is not iterable");
};
var call$1 = functionCall;
var anObject$1 = anObject$5;
var getMethod = getMethod$3;
var iteratorClose$1 = function(iterator, kind, value) {
var innerResult, innerError;
anObject$1(iterator);
try {
innerResult = getMethod(iterator, "return");
if (!innerResult) {
if (kind === "throw")
throw value;
return value;
}
innerResult = call$1(innerResult, iterator);
} catch (error) {
innerError = true;
innerResult = error;
}
if (kind === "throw")
throw value;
if (innerError)
throw innerResult;
anObject$1(innerResult);
return value;
};
var bind = functionBindContext;
var call = functionCall;
var anObject = anObject$5;
var tryToString = tryToString$3;
var isArrayIteratorMethod = isArrayIteratorMethod$1;
var lengthOfArrayLike = lengthOfArrayLike$2;
var isPrototypeOf = objectIsPrototypeOf;
var getIterator = getIterator$1;
var getIteratorMethod = getIteratorMethod$2;
var iteratorClose = iteratorClose$1;
var $TypeError = TypeError;
var Result = function(stopped, result) {
this.stopped = stopped;
this.result = result;
};
var ResultPrototype = Result.prototype;
var iterate$2 = function(iterable, unboundFunction, options) {
var that = options && options.that;
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
var IS_RECORD = !!(options && options.IS_RECORD);
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
var INTERRUPTED = !!(options && options.INTERRUPTED);
var fn = bind(unboundFunction, that);
var iterator, iterFn, index, length, result, next, step;
var stop = function(condition) {
if (iterator)
iteratorClose(iterator, "normal");
return new Result(true, condition);
};
var callFn = function(value) {
if (AS_ENTRIES) {
anObject(value);
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
}
return INTERRUPTED ? fn(value, stop) : fn(value);
};
if (IS_RECORD) {
iterator = iterable.iterator;
} else if (IS_ITERATOR) {
iterator = iterable;
} else {
iterFn = getIteratorMethod(iterable);
if (!iterFn)
throw new $TypeError(tryToString(iterable) + " is not iterable");
if (isArrayIteratorMethod(iterFn)) {
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
result = callFn(iterable[index]);
if (result && isPrototypeOf(ResultPrototype, result))
return result;
}
return new Result(false);
}
iterator = getIterator(iterable, iterFn);
}
next = IS_RECORD ? iterable.next : iterator.next;
while (!(step = call(next, iterator)).done) {
try {
result = callFn(step.value);
} catch (error) {
iteratorClose(iterator, "throw", error);
}
if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result))
return result;
}
return new Result(false);
};
var uncurryThis$2 = functionUncurryThis;
var MapPrototype = Map.prototype;
var mapHelpers = {
// eslint-disable-next-line es/no-map -- safe
Map,
set: uncurryThis$2(MapPrototype.set),
get: uncurryThis$2(MapPrototype.get),
has: uncurryThis$2(MapPrototype.has),
remove: uncurryThis$2(MapPrototype["delete"]),
proto: MapPrototype
};
var $$2 = _export;
var uncurryThis$1 = functionUncurryThis;
var aCallable$1 = aCallable$5;
var requireObjectCoercible$1 = requireObjectCoercible$4;
var iterate$1 = iterate$2;
var MapHelpers = mapHelpers;
var fails$1 = fails$a;
var Map$1 = MapHelpers.Map;
var has = MapHelpers.has;
var get = MapHelpers.get;
var set = MapHelpers.set;
var push$1 = uncurryThis$1([].push);
var DOES_NOT_WORK_WITH_PRIMITIVES$1 = fails$1(function() {
return Map$1.groupBy("ab", function(it2) {
return it2;
}).get("a").length !== 1;
});
$$2({ target: "Map", stat: true, forced: DOES_NOT_WORK_WITH_PRIMITIVES$1 }, {
groupBy: function groupBy(items, callbackfn) {
requireObjectCoercible$1(items);
aCallable$1(callbackfn);
var map = new Map$1();
var k2 = 0;
iterate$1(items, function(value) {
var key = callbackfn(value, k2++);
if (!has(map, key))
set(map, key, [value]);
else
push$1(get(map, key), value);
});
return map;
}
});
var $$1 = _export;
var getBuiltIn = getBuiltIn$3;
var uncurryThis = functionUncurryThis;
var aCallable = aCallable$5;
var requireObjectCoercible = requireObjectCoercible$4;
var toPropertyKey = toPropertyKey$3;
var iterate = iterate$2;
var fails = fails$a;
var nativeGroupBy = Object.groupBy;
var create = getBuiltIn("Object", "create");
var push = uncurryThis([].push);
var DOES_NOT_WORK_WITH_PRIMITIVES = !nativeGroupBy || fails(function() {
return nativeGroupBy("ab", function(it2) {
return it2;
}).a.length !== 1;
});
$$1({ target: "Object", stat: true, forced: DOES_NOT_WORK_WITH_PRIMITIVES }, {
groupBy: function groupBy(items, callbackfn) {
requireObjectCoercible(items);
aCallable(callbackfn);
var obj = create(null);
var k2 = 0;
iterate(items, function(value) {
var key = toPropertyKey(callbackfn(value, k2++));
if (key in obj)
push(obj[key], value);
else
obj[key] = [value];
});
return obj;
}
});
function keyListener(el, fn) {
el.addEventListener(
"keyup",
(e2) => {
if (e2.key === "ArrowUp" || e2.key === "ArrowRight") {
fn("next");
} else if (e2.key === "ArrowDown" || e2.key === "ArrowLeft") {
fn("prev");
}
},
false
);
}
function wheelListener(el, fn) {
const threshold = 750;
const allowedTime = 50;
let dist = 0;
let isScrolling;
el.addEventListener("wheel", (e2) => {
if (e2.ignore)
return;
e2.ignore = true;
clearTimeout(isScrolling);
dist += e2.deltaY;
isScrolling = setTimeout(() => {
if (Math.abs(dist) >= threshold) {
let direction = Math.sign(dist) > 0 ? "next" : "prev";
fn(direction);
dist = 0;
}
dist = 0;
}, allowedTime);
});
}
function swipListener(document2, fn) {
const threshold = 50;
const allowedTime = 500;
const restraint = 200;
let startX;
let startY;
let startTime;
document2.addEventListener(
"touchstart",
(e2) => {
if (e2.ignore)
return;
e2.ignore = true;
startX = e2.changedTouches[0].pageX;
startY = e2.changedTouches[0].pageY;
startTime = Date.now();
},
false
);
document2.addEventListener(
"touchend",
(e2) => {
var _a2, _b;
if (e2.ignore)
return;
e2.ignore = true;
const distX = e2.changedTouches[0].pageX - startX;
const distY = e2.changedTouches[0].pageY - startY;
const elapsedTime = Date.now() - startTime;
if (elapsedTime <= allowedTime) {
if (Math.abs(distX) >= threshold && Math.abs(distY) <= restraint)
fn(distX < 0 ? "next" : "prev");
else if (Math.abs(distY) >= threshold && Math.abs(distX) <= restraint)
fn(distY < 0 ? "up" : "down");
else {
(_b = (_a2 = document2 == null ? void 0 : document2.defaultView) == null ? void 0 : _a2.getSelection()) == null ? void 0 : _b.removeAllRanges();
document2.dispatchEvent(
new MouseEvent("click", {
clientX: startX,
clientY: startY
})
);
e2.preventDefault();
}
}
},
false
);
}
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const _hoisted_1$2 = { class: "reader" };
const _hoisted_2$2 = { class: "viewHolder" };
const _hoisted_3$1 = { key: 0 };
const _sfc_main$2 = {
__name: "BookView",
props: {
url: {
type: [String, File]
},
location: {
type: [String, Number]
},
tocChanged: Function,
getRendition: Function
},
emits: ["update:location"],
setup(__props, { expose: __expose, emit: __emit }) {
window.Promise.withResolvers = function() {
let resolve, reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { resolve, reject, promise };
};
const props = __props;
const { tocChanged, getRendition } = props;
const { url, location: location2 } = vue.toRefs(props);
const emit = __emit;
let view$1 = null;
const viewer = vue.ref(null);
const isLoaded = vue.ref(false);
const isError = vue.ref(false);
const getCSS = ({ spacing, justify, hyphenate }) => `
@namespace epub "http://www.idpf.org/2007/ops";
html {
color-scheme: light dark;
}
/* https://github.com/whatwg/html/issues/5426 */
@media (prefers-color-scheme: dark) {
a:link {
color: lightblue;
}
}
p, li, blockquote, dd {
line-height: ${spacing};
text-align: ${justify ? "justify" : "start"};
-webkit-hyphens: ${hyphenate ? "auto" : "manual"};
hyphens: ${hyphenate ? "auto" : "manual"};
-webkit-hyphenate-limit-before: 3;
-webkit-hyphenate-limit-after: 2;
-webkit-hyphenate-limit-lines: 2;
hanging-punctuation: allow-end last;
widows: 2;
}
/* prevent the above from overriding the align attribute */
[align="left"] { text-align: left; }
[align="right"] { text-align: right; }
[align="center"] { text-align: center; }
[align="justify"] { text-align: justify; }
pre {
white-space: pre-wrap !important;
}
aside[epub|type~="endnote"],
aside[epub|type~="footnote"],
aside[epub|type~="note"],
aside[epub|type~="rearnote"] {
display: none;
}
`;
const initBook = async () => {
Promise.resolve().then(() => view).then(async (res) => {
view$1 = document.createElement("foliate-view");
viewer.value.append(view$1);
if (url.value) {
view$1 && view$1.close();
try {
await view$1.open(url.value);
initReader();
} catch (error) {
console.error("Error opening book:", error);
isError.value = true;
}
}
}).catch((error) => {
console.error("Error opening book:", error);
});
};
const initReader = () => {
var _a2, _b;
isLoaded.value = true;
const { book } = view$1;
(_b = (_a2 = view$1.renderer).setStyles) == null ? void 0 : _b.call(
_a2,
getCSS({
spacing: 1.4,
justify: true,
hyphenate: true
})
);
registerEvents();
view$1.addEventListener("load", () => {
getRendition(view$1);
});
tocChanged && tocChanged(book.toc);
if (location2.value) {
view$1 == null ? void 0 : view$1.goTo(location2.value);
} else {
view$1.renderer.next();
}
};
const flipPage = (direction) => {
if (direction === "next")
ne