@konnectio/core
Version:
Konnectio Core Frontend Integration.
1,331 lines (1,327 loc) • 431 kB
JavaScript
import { d as defineComponent, F as Fragment, Q as Comment, R as Text, U as h, V as getCurrentInstance, W as resolveComponent, r as ref, c as computed$1, D as watch, o as onMounted, h as createElementBlock, b as openBlock, a as createBlock, i as createCommentVNode, w as withCtx, v as renderList, e as createBaseVNode, j as withModifiers, f as createVNode, g as unref, n as normalizeClass, u as useI18n, s as storeToRefs, X as inject, N as resolveDirective, A as createSlots, E as withDirectives, t as toDisplayString, Y as reactive, Z as onUnmounted, K as normalizeStyle, q as renderSlot, $ as nextTick, G as vShow, x as createTextVNode, a0 as mergeModels, y as useSlots, a1 as useModel, T as Transition, z as isRef, _ as _mitt } from "./mitt-CWSmi8M-.js";
import { I as Icon, _ as _export_sfc, b as useHotelStore, g as useEventStore, u as useAvailabilityStore, f as useUtilityStore, T as TextField, K as convertDescription, B as BookingLayout, r as capitalized, m as daysBetweenDates, p as showPrice, s as showDate, x as InputField, J as BookingHeaderLayout, P as emitter, w as getUserLanguage, y as useApplyGiftCardStore, e as Clickable, z as usePaymentStore } from "./SelectField.vue_vue_type_style_index_0_lang-Cev1TH7y.js";
import { B as Base$1, a as Checkbox, _ as _sfc_main$c } from "./CheckoutWindow-CF2-eaiR.js";
import { A as ActionField } from "./ActionField-BsmMIhW6.js";
import { E as Element$1 } from "./Field.vue_vue_type_style_index_0_scoped_6ef33e68_lang-NEWgHGKm.js";
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-DaMA6jEr.js";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __values$1(s) {
var i = typeof Symbol == "function" && Symbol.iterator, t = i && s[i], e = 0;
if (t) return t.call(s);
if (s && typeof s.length == "number") return {
next: function() {
return s && e >= s.length && (s = void 0), {
value: s && s[e++],
done: !s
};
}
};
throw new TypeError(i ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read$1(s, i) {
var t = typeof Symbol == "function" && s[Symbol.iterator];
if (!t) return s;
var e = t.call(s), n, r = [], l;
try {
for (; (i === void 0 || i-- > 0) && !(n = e.next()).done; ) r.push(n.value);
} catch (u) {
l = {
error: u
};
} finally {
try {
n && !n.done && (t = e.return) && t.call(e);
} finally {
if (l) throw l.error;
}
}
return r;
}
function __spread$1() {
for (var s = [], i = 0; i < arguments.length; i++) s = s.concat(__read$1(arguments[i]));
return s;
}
var isUndefined = function(s) {
return typeof s > "u";
}, ComponentEvent = /* @__PURE__ */ function() {
function s(t, e) {
var n, r;
if (this._canceled = !1, e)
try {
for (var l = __values$1(Object.keys(e)), u = l.next(); !u.done; u = l.next()) {
var d = u.value;
this[d] = e[d];
}
} catch (f) {
n = {
error: f
};
} finally {
try {
u && !u.done && (r = l.return) && r.call(l);
} finally {
if (n) throw n.error;
}
}
this.eventType = t;
}
var i = s.prototype;
return i.stop = function() {
this._canceled = !0;
}, i.isCanceled = function() {
return this._canceled;
}, s;
}(), Component = /* @__PURE__ */ function() {
function s() {
this._eventHandler = {};
}
var i = s.prototype;
return i.trigger = function(t) {
for (var e = [], n = 1; n < arguments.length; n++)
e[n - 1] = arguments[n];
var r = t instanceof ComponentEvent ? t.eventType : t, l = __spread$1(this._eventHandler[r] || []);
return l.length <= 0 ? this : (t instanceof ComponentEvent ? (t.currentTarget = this, l.forEach(function(u) {
u(t);
})) : l.forEach(function(u) {
u.apply(void 0, __spread$1(e));
}), this);
}, i.once = function(t, e) {
var n = this;
if (typeof t == "object" && isUndefined(e)) {
var r = t;
for (var l in r)
this.once(l, r[l]);
return this;
} else if (typeof t == "string" && typeof e == "function") {
var u = function() {
for (var d = [], f = 0; f < arguments.length; f++)
d[f] = arguments[f];
e.apply(void 0, __spread$1(d)), n.off(t, u);
};
this.on(t, u);
}
return this;
}, i.hasOn = function(t) {
return !!this._eventHandler[t];
}, i.on = function(t, e) {
if (typeof t == "object" && isUndefined(e)) {
var n = t;
for (var r in n)
this.on(r, n[r]);
return this;
} else if (typeof t == "string" && typeof e == "function") {
var l = this._eventHandler[t];
isUndefined(l) && (this._eventHandler[t] = [], l = this._eventHandler[t]), l.push(e);
}
return this;
}, i.off = function(t, e) {
if (isUndefined(t))
return this._eventHandler = {}, this;
if (isUndefined(e)) {
if (typeof t == "string")
return delete this._eventHandler[t], this;
var n = t;
for (var r in n)
this.off(r, n[r]);
return this;
}
var l = this._eventHandler[t];
if (l) {
for (var u = l.length, d = 0; d < u; ++d)
if (l[d] === e) {
l.splice(d, 1), u <= 1 && delete this._eventHandler[t];
break;
}
}
return this;
}, s.VERSION = "3.0.5", s;
}(), ComponentEvent$1 = ComponentEvent;
function some(s, i) {
for (var t = s.length, e = 0; e < t; ++e)
if (i(s[e], e))
return !0;
return !1;
}
function find$1(s, i) {
for (var t = s.length, e = 0; e < t; ++e)
if (i(s[e], e))
return s[e];
return null;
}
function getUserAgentString(s) {
var i = s;
if (typeof i > "u") {
if (typeof navigator > "u" || !navigator)
return "";
i = navigator.userAgent || "";
}
return i.toLowerCase();
}
function execRegExp(s, i) {
try {
return new RegExp(s, "g").exec(i);
} catch {
return null;
}
}
function hasUserAgentData() {
if (typeof navigator > "u" || !navigator || !navigator.userAgentData)
return !1;
var s = navigator.userAgentData, i = s.brands || s.uaList;
return !!(i && i.length);
}
function findVersion(s, i) {
var t = execRegExp("(" + s + ")((?:\\/|\\s|:)([0-9|\\.|_]+))", i);
return t ? t[3] : "";
}
function convertVersion(s) {
return s.replace(/_/g, ".");
}
function findPreset(s, i) {
var t = null, e = "-1";
return some(s, function(n) {
var r = execRegExp("(" + n.test + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", i);
return !r || n.brand ? !1 : (t = n, e = r[3] || "-1", n.versionAlias ? e = n.versionAlias : n.versionTest && (e = findVersion(n.versionTest.toLowerCase(), i) || e), e = convertVersion(e), !0);
}), {
preset: t,
version: e
};
}
function findPresetBrand(s, i) {
var t = {
brand: "",
version: "-1"
};
return some(s, function(e) {
var n = findBrand(i, e);
return n ? (t.brand = e.id, t.version = e.versionAlias || n.version, t.version !== "-1") : !1;
}), t;
}
function findBrand(s, i) {
return find$1(s, function(t) {
var e = t.brand;
return execRegExp("" + i.test, e.toLowerCase());
});
}
var BROWSER_PRESETS = [{
test: "phantomjs",
id: "phantomjs"
}, {
test: "whale",
id: "whale"
}, {
test: "edgios|edge|edg",
id: "edge"
}, {
test: "msie|trident|windows phone",
id: "ie",
versionTest: "iemobile|msie|rv"
}, {
test: "miuibrowser",
id: "miui browser"
}, {
test: "samsungbrowser",
id: "samsung internet"
}, {
test: "samsung",
id: "samsung internet",
versionTest: "version"
}, {
test: "chrome|crios",
id: "chrome"
}, {
test: "firefox|fxios",
id: "firefox"
}, {
test: "android",
id: "android browser",
versionTest: "version"
}, {
test: "safari|iphone|ipad|ipod",
id: "safari",
versionTest: "version"
}], CHROMIUM_PRESETS = [{
test: "(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",
id: "chrome",
versionTest: "chrome"
}, {
test: "chromium",
id: "chrome"
}, {
test: "whale",
id: "chrome",
versionAlias: "-1",
brand: !0
}], WEBKIT_PRESETS = [{
test: "applewebkit",
id: "webkit",
versionTest: "applewebkit|safari"
}], WEBVIEW_PRESETS = [{
test: "(?=(iphone|ipad))(?!(.*version))",
id: "webview"
}, {
test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",
id: "webview"
}, {
// test webview
test: "webview",
id: "webview"
}], OS_PRESETS = [{
test: "windows phone",
id: "windows phone"
}, {
test: "windows 2000",
id: "window",
versionAlias: "5.0"
}, {
test: "windows nt",
id: "window"
}, {
test: "win32|windows",
id: "window"
}, {
test: "iphone|ipad|ipod",
id: "ios",
versionTest: "iphone os|cpu os"
}, {
test: "macos|macintel|mac os x",
id: "mac"
}, {
test: "android|linux armv81",
id: "android"
}, {
test: "tizen",
id: "tizen"
}, {
test: "webos|web0s",
id: "webos"
}];
function isWebView(s) {
return !!findPreset(WEBVIEW_PRESETS, s).preset;
}
function getLegacyAgent(s) {
var i = getUserAgentString(s), t = !!/mobi/g.exec(i), e = {
name: "unknown",
version: "-1",
majorVersion: -1,
webview: isWebView(i),
chromium: !1,
chromiumVersion: "-1",
webkit: !1,
webkitVersion: "-1"
}, n = {
name: "unknown",
version: "-1",
majorVersion: -1
}, r = findPreset(BROWSER_PRESETS, i), l = r.preset, u = r.version, d = findPreset(OS_PRESETS, i), f = d.preset, _ = d.version, g = findPreset(CHROMIUM_PRESETS, i);
if (e.chromium = !!g.preset, e.chromiumVersion = g.version, !e.chromium) {
var y = findPreset(WEBKIT_PRESETS, i);
e.webkit = !!y.preset, e.webkitVersion = y.version;
}
return f && (n.name = f.id, n.version = _, n.majorVersion = parseInt(_, 10)), l && (e.name = l.id, e.version = u, e.webview && n.name === "ios" && e.name !== "safari" && (e.webview = !1)), e.majorVersion = parseInt(e.version, 10), {
browser: e,
os: n,
isMobile: t,
isHints: !1
};
}
function getClientHintsAgent(s) {
var i = navigator.userAgentData, t = (i.uaList || i.brands).slice(), e = i.mobile || !1, n = t[0], r = (i.platform || navigator.platform).toLowerCase(), l = {
name: n.brand,
version: n.version,
majorVersion: -1,
webkit: !1,
webkitVersion: "-1",
chromium: !1,
chromiumVersion: "-1",
webview: !!findPresetBrand(WEBVIEW_PRESETS, t).brand || isWebView(getUserAgentString())
}, u = {
name: "unknown",
version: "-1",
majorVersion: -1
};
l.webkit = !l.chromium && some(WEBKIT_PRESETS, function(y) {
return findBrand(t, y);
});
var d = findPresetBrand(CHROMIUM_PRESETS, t);
if (l.chromium = !!d.brand, l.chromiumVersion = d.version || "-1", !l.chromium) {
var f = findPresetBrand(WEBKIT_PRESETS, t);
l.webkit = !!f.brand, l.webkitVersion = f.version || "-1";
}
var _ = find$1(OS_PRESETS, function(y) {
return new RegExp("" + y.test, "g").exec(r);
});
u.name = _ ? _.id : "";
{
var g = findPresetBrand(BROWSER_PRESETS, t);
l.name = g.brand || l.name, l.version = g.brand && s ? s.uaFullVersion : g.version;
}
return l.webkit && (u.name = e ? "ios" : "mac"), u.name === "ios" && l.webview && (l.version = "-1"), u.version = convertVersion(u.version), l.version = convertVersion(l.version), u.majorVersion = parseInt(u.version, 10), l.majorVersion = parseInt(l.version, 10), {
browser: l,
os: u,
isMobile: e,
isHints: !0
};
}
function agent(s) {
return hasUserAgentData() ? getClientHintsAgent() : getLegacyAgent(s);
}
function keys(s) {
return Object.keys(s);
}
var OBSERVERS_PATH = "__observers__", COMPUTED_PATH = "__computed__", CFCS_DETECTED_DEPENDENCIES_VERSION = 1, CFCS_DETECTED_DEPENDENCIES = "__CFCS_DETECTED_DEPENDENCIES__", extendStatics$5 = function(s, i) {
return extendStatics$5 = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(t, e) {
t.__proto__ = e;
} || function(t, e) {
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
}, extendStatics$5(s, i);
};
function __extends$5(s, i) {
if (typeof i != "function" && i !== null) throw new TypeError("Class extends value " + String(i) + " is not a constructor or null");
extendStatics$5(s, i);
function t() {
this.constructor = s;
}
s.prototype = i === null ? Object.create(i) : (t.prototype = i.prototype, new t());
}
function getDetectedStack() {
Object[CFCS_DETECTED_DEPENDENCIES] = Object[CFCS_DETECTED_DEPENDENCIES] || {};
var s = Object[CFCS_DETECTED_DEPENDENCIES];
return s[CFCS_DETECTED_DEPENDENCIES_VERSION] = s[CFCS_DETECTED_DEPENDENCIES_VERSION] || [], s[CFCS_DETECTED_DEPENDENCIES_VERSION];
}
function getCurrentDetected() {
var s = getDetectedStack();
return s[s.length - 1];
}
function detectDependencies(s) {
var i = getDetectedStack(), t = [], e = {
host: s,
observers: t,
push: function(n) {
s !== n && t.indexOf(n) === -1 && t.push(n);
}
};
return i.push(e), e;
}
function endDetectDependencies() {
var s = getDetectedStack();
return s.pop();
}
var Observer = /* @__PURE__ */ function() {
function s(t) {
this._emitter = new Component(), this._current = t;
}
var i = s.prototype;
return Object.defineProperty(i, "current", {
/**
* return the current value.
*/
get: function() {
var t = getCurrentDetected();
return t?.push(this), this._current;
},
set: function(t) {
this._setCurrent(t);
},
enumerable: !1,
configurable: !0
}), i.subscribe = function(t) {
return this.current, this._emitter.on("update", t), this;
}, i.unsubscribe = function(t) {
return this._emitter.off("update", t), this;
}, i._setCurrent = function(t) {
var e = this._current, n = t !== e;
this._current = t, n && this._emitter.trigger("update", t, e);
}, i.toString = function() {
return "".concat(this.current);
}, i.valueOf = function() {
return this.current;
}, s;
}(), ComputedObserver = /* @__PURE__ */ function(s) {
__extends$5(i, s);
function i(e) {
var n = s.call(this) || this;
return n._computedCallback = e, n._registered = [], n._onCheckUpdate = function() {
n._setCurrent(n.current);
}, n._current = n.current, n;
}
var t = i.prototype;
return Object.defineProperty(t, "current", {
get: function() {
var e = this;
detectDependencies(this);
var n = this._computedCallback(), r = endDetectDependencies();
return this._registered.forEach(function(l) {
l.unsubscribe(e._onCheckUpdate);
}), r.observers.forEach(function(l) {
l.subscribe(e._onCheckUpdate);
}), this._registered = r.observers, n;
},
enumerable: !1,
configurable: !0
}), i;
}(Observer);
function injectObserve(s, i, t) {
t === void 0 && (t = i);
var e = {
configurable: !0,
get: function() {
return getObserver(this, t).current;
},
set: function(n) {
getObserver(this, t, n).current = n;
}
};
Object.defineProperty(s, i, e), t !== i && Object.defineProperty(s, t, {
configurable: !0,
get: function() {
return getObserver(this, t).current;
}
});
}
function Observe() {
for (var s = [], i = 0; i < arguments.length; i++)
s[i] = arguments[i];
return s.length > 1 ? injectObserve(s[0], s[1]) : function(t, e) {
return injectObserve(t, e, s[0]);
};
}
function injectReactiveSubscribe(s) {
s.subscribe = function(i, t) {
this[i], getObserver(this, i).subscribe(t);
}, s.unsubscribe = function(i, t) {
var e = this;
if (!i) {
keys(getObservers(this)).forEach(function(n) {
e.unsubscribe(n);
});
return;
}
i in this && getObserver(this, i).unsubscribe(t);
};
}
function ReactiveSubscribe(s) {
var i = s.prototype;
injectReactiveSubscribe(i);
}
function observe(s) {
return new Observer(s);
}
function computed(s) {
return new ComputedObserver(s);
}
function defineObservers(s) {
var i = {};
return Object.defineProperty(s, OBSERVERS_PATH, {
get: function() {
return i;
}
}), i;
}
function getObservers(s, i) {
var t, e;
s[OBSERVERS_PATH] || defineObservers(s);
var n = s[OBSERVERS_PATH];
if (!i) {
var r = (e = (t = s?.constructor) === null || t === void 0 ? void 0 : t.prototype) === null || e === void 0 ? void 0 : e[COMPUTED_PATH];
r && r.forEach(function(l) {
!(l in n) && l in s && s[l];
});
}
return n;
}
function getObserver(s, i, t) {
var e = getObservers(s);
return e[i] || (e[i] = observe(t)), e[i];
}
function Computed(s, i, t) {
var e = t.get;
function n() {
var u = getObservers(this, !0);
return i in u || (u[i] = computed(e.bind(this))), getObserver(this, i).current;
}
var r = {
configurable: !0,
get: n
};
s[COMPUTED_PATH] || (s[COMPUTED_PATH] = []);
var l = s[COMPUTED_PATH];
return l.indexOf(i) === -1 && l.push(i), Object.defineProperty(s, i, r), r;
}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var extendStatics$4 = function(s, i) {
return extendStatics$4 = Object.setPrototypeOf || {
__proto__: []
} instanceof Array && function(t, e) {
t.__proto__ = e;
} || function(t, e) {
for (var n in e) e.hasOwnProperty(n) && (t[n] = e[n]);
}, extendStatics$4(s, i);
};
function __extends$4(s, i) {
extendStatics$4(s, i);
function t() {
this.constructor = s;
}
s.prototype = i === null ? Object.create(i) : (t.prototype = i.prototype, new t());
}
var __assign$3 = function() {
return __assign$3 = Object.assign || function(i) {
for (var t, e = 1, n = arguments.length; e < n; e++) {
t = arguments[e];
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (i[r] = t[r]);
}
return i;
}, __assign$3.apply(this, arguments);
};
function __decorate(s, i, t, e) {
var n = arguments.length, r = n < 3 ? i : e === null ? e = Object.getOwnPropertyDescriptor(i, t) : e, l;
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") r = Reflect.decorate(s, i, t, e);
else for (var u = s.length - 1; u >= 0; u--) (l = s[u]) && (r = (n < 3 ? l(r) : n > 3 ? l(i, t, r) : l(i, t)) || r);
return n > 3 && r && Object.defineProperty(i, t, r), r;
}
var win;
typeof window > "u" ? win = {
navigator: {
userAgent: ""
}
} : win = window;
var DIRECTION_NONE = 1, DIRECTION_LEFT = 2, DIRECTION_RIGHT = 4, DIRECTION_HORIZONTAL = 6, DIRECTION_UP = 8, DIRECTION_DOWN = 16, DIRECTION_VERTICAL = 24, DIRECTION_ALL = 30, MOUSE_LEFT = "left", MOUSE_RIGHT = "right", MOUSE_MIDDLE = "middle", MOUSE_BUTTON_CODE_MAP = {
1: MOUSE_LEFT,
2: MOUSE_MIDDLE,
3: MOUSE_RIGHT
}, ANY = "any", NONE = "none", SHIFT = "shift", CTRL = "ctrl", ALT = "alt", META = "meta", VELOCITY_INTERVAL = 16, IOS_EDGE_THRESHOLD = 30, IS_IOS_SAFARI = "ontouchstart" in win && agent().browser.name === "safari", TRANSFORM = function() {
if (typeof document > "u")
return "";
for (var s = (document.head || document.getElementsByTagName("head")[0]).style, i = ["transform", "webkitTransform", "msTransform", "mozTransform"], t = 0, e = i.length; t < e; t++)
if (i[t] in s)
return i[t];
return "";
}(), PREVENT_DRAG_CSSPROPS = {
"-webkit-user-select": "none",
"-ms-user-select": "none",
"-moz-user-select": "none",
"user-select": "none",
"-webkit-user-drag": "none"
}, toArray$2 = function(s) {
for (var i = [], t = 0, e = s.length; t < e; t++)
i.push(s[t]);
return i;
}, $ = function(s, i) {
i === void 0 && (i = !1);
var t;
if (typeof s == "string") {
var e = s.match(/^<([a-z]+)\s*([^>]*)>/);
if (e) {
var n = document.createElement("div");
n.innerHTML = s, t = toArray$2(n.childNodes);
} else
t = toArray$2(document.querySelectorAll(s));
i || (t = t.length >= 1 ? t[0] : void 0);
} else s === win ? t = s : "value" in s || "current" in s ? t = s.value || s.current : s.nodeName && (s.nodeType === 1 || s.nodeType === 9) ? t = s : "jQuery" in win && s instanceof jQuery || s.constructor.prototype.jquery ? t = i ? s.toArray() : s.get(0) : Array.isArray(s) && (t = s.map(function(r) {
return $(r);
}), i || (t = t.length >= 1 ? t[0] : void 0));
return t;
}, raf$1 = win.requestAnimationFrame || win.webkitRequestAnimationFrame, caf$1 = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;
if (raf$1 && !caf$1) {
var keyInfo_1 = {}, oldraf_1 = raf$1;
raf$1 = function(s) {
var i = function(e) {
keyInfo_1[t] && s(e);
}, t = oldraf_1(i);
return keyInfo_1[t] = !0, t;
}, caf$1 = function(s) {
delete keyInfo_1[s];
};
} else raf$1 && caf$1 || (raf$1 = function(s) {
return win.setTimeout(function() {
s(win.performance && win.performance.now && win.performance.now() || (/* @__PURE__ */ new Date()).getTime());
}, 16);
}, caf$1 = win.clearTimeout);
var requestAnimationFrame$2 = function(s) {
return raf$1(s);
}, cancelAnimationFrame$1 = function(s) {
caf$1(s);
}, map = function(s, i) {
var t = {};
for (var e in s)
e && (t[e] = i(s[e], e));
return t;
}, filter = function(s, i) {
var t = {};
for (var e in s)
e && i(s[e], e) && (t[e] = s[e]);
return t;
}, every = function(s, i) {
for (var t in s)
if (t && !i(s[t], t))
return !1;
return !0;
}, equal = function(s, i) {
return every(s, function(t, e) {
return t === i[e];
});
}, roundNumFunc = {}, roundNumber = function(s, i) {
return roundNumFunc[i] || (roundNumFunc[i] = getRoundFunc(i)), roundNumFunc[i](s);
}, roundNumbers = function(s, i) {
return !s || !i ? s : map(s, function(t, e) {
return roundNumber(t, typeof i == "number" ? i : i[e]);
});
}, getDecimalPlace = function(s) {
if (!isFinite(s))
return 0;
var i = "".concat(s);
if (i.indexOf("e") >= 0) {
for (var t = 0, e = 1; Math.round(s * e) / e !== s; )
e *= 10, t++;
return t;
}
return i.indexOf(".") >= 0 ? i.length - i.indexOf(".") - 1 : 0;
}, inversePow = function(s) {
return 1 / Math.pow(10, s);
}, getRoundFunc = function(s) {
var i = s < 1 ? Math.pow(10, getDecimalPlace(s)) : 1;
return function(t) {
return s === 0 ? 0 : Math.round(Math.round(t / s) * s * i) / i;
};
}, getAngle = function(s, i) {
return Math.atan2(i, s) * 180 / Math.PI;
}, isCssPropsFromAxes = function(s) {
var i = !0;
return Object.keys(PREVENT_DRAG_CSSPROPS).forEach(function(t) {
(!s || s[t] !== PREVENT_DRAG_CSSPROPS[t]) && (i = !1);
}), i;
}, getDirection$1 = function(s, i) {
return s && i ? DIRECTION_ALL : s ? DIRECTION_HORIZONTAL : i ? DIRECTION_VERTICAL : DIRECTION_NONE;
}, useDirection = function(s, i, t) {
return t ? !!(i === DIRECTION_ALL || i & s && t & s) : !!(i & s);
}, setCssProps = function(s, i, t) {
var e, n = (e = {}, e[DIRECTION_NONE] = "auto", e[DIRECTION_ALL] = "none", e[DIRECTION_VERTICAL] = "pan-x", e[DIRECTION_HORIZONTAL] = "pan-y", e), r = {};
if (s && s.style) {
var l = i.touchAction ? i.touchAction : n[t], u = __assign$3(__assign$3({}, PREVENT_DRAG_CSSPROPS), {
"touch-action": s.style["touch-action"] === "none" ? "none" : l
});
Object.keys(u).forEach(function(d) {
r[d] = s.style[d];
}), Object.keys(u).forEach(function(d) {
s.style[d] = u[d];
});
}
return r;
}, revertCssProps = function(s, i) {
s && s.style && i && Object.keys(i).forEach(function(t) {
s.style[t] = i[t];
});
}, EventManager = /* @__PURE__ */ function() {
function s(t) {
this._axes = t, this.holdingCount = 0;
}
var i = s.prototype;
return i.hold = function(t, e) {
var n = this._getRoundPos(t).roundPos;
this._axes.trigger(new ComponentEvent$1("hold", {
pos: n,
input: e.input || null,
inputEvent: e.event || null,
isTrusted: !0
}));
}, i.triggerRelease = function(t) {
var e = this._getRoundPos(t.destPos, t.depaPos), n = e.roundPos, r = e.roundDepa;
t.destPos = n, t.depaPos = r, t.setTo = this._createUserControll(t.destPos, t.duration), this._axes.trigger(new ComponentEvent$1("release", __assign$3(__assign$3({}, t), {
bounceRatio: this._getBounceRatio(n)
})));
}, i.triggerChange = function(t, e, n, r) {
var l = this;
r === void 0 && (r = !1);
var u = this.animationManager, d = u.axisManager, f = u.getEventInfo(), _ = this._getRoundPos(t, e), g = _.roundPos, y = _.roundDepa, p = d.moveTo(g, y), m = n?.event || f?.event || null, b = {
pos: p.pos,
delta: p.delta,
bounceRatio: this._getBounceRatio(p.pos),
holding: r,
inputEvent: m,
isTrusted: !!m,
input: n?.input || f?.input || null,
set: m ? this._createUserControll(p.pos) : function() {
}
// eslint-disable-line @typescript-eslint/no-empty-function
}, P = new ComponentEvent$1("change", b);
return this._axes.trigger(P), Object.keys(p.pos).forEach(function(v) {
var E = p.pos[v];
getObserver(l._axes, v, E).current = E;
}), m && d.set(b.set().destPos), !P.isCanceled();
}, i.triggerAnimationStart = function(t) {
var e = this._getRoundPos(t.destPos, t.depaPos), n = e.roundPos, r = e.roundDepa;
t.destPos = n, t.depaPos = r, t.setTo = this._createUserControll(t.destPos, t.duration);
var l = new ComponentEvent$1("animationStart", t);
return this._axes.trigger(l), !l.isCanceled();
}, i.triggerAnimationEnd = function(t) {
t === void 0 && (t = !1), this._axes.trigger(new ComponentEvent$1("animationEnd", {
isTrusted: t
}));
}, i.triggerFinish = function(t) {
t === void 0 && (t = !1), this._axes.trigger(new ComponentEvent$1("finish", {
isTrusted: t
}));
}, i.setAnimationManager = function(t) {
this.animationManager = t;
}, i.destroy = function() {
this._axes.off();
}, i._createUserControll = function(t, e) {
e === void 0 && (e = 0);
var n = {
destPos: __assign$3({}, t),
duration: e
};
return function(r, l) {
return r && (n.destPos = __assign$3({}, r)), l !== void 0 && (n.duration = l), n;
};
}, i._getRoundPos = function(t, e) {
var n = this._axes.options.round;
return {
roundPos: roundNumbers(t, n),
roundDepa: roundNumbers(e, n)
};
}, i._getBounceRatio = function(t) {
return this._axes.axisManager.map(t, function(e, n) {
return e < n.range[0] && n.bounce[0] !== 0 ? (n.range[0] - e) / n.bounce[0] : e > n.range[1] && n.bounce[1] !== 0 ? (e - n.range[1]) / n.bounce[1] : 0;
});
}, __decorate([Observe], s.prototype, "holdingCount", void 0), s;
}(), InterruptManager = /* @__PURE__ */ function() {
function s(t) {
this._options = t, this._prevented = !1;
}
var i = s.prototype;
return i.isInterrupting = function() {
return this._options.interruptable || this._prevented;
}, i.isInterrupted = function() {
return !this._options.interruptable && this._prevented;
}, i.setInterrupt = function(t) {
this._options.interruptable || (this._prevented = t);
}, s;
}(), getInsidePosition = function(s, i, t, e) {
var n = s, r = [t[0] ? i[0] : e ? i[0] - e[0] : i[0], t[1] ? i[1] : e ? i[1] + e[1] : i[1]];
return n = Math.max(r[0], n), n = Math.min(r[1], n), n;
}, isOutside = function(s, i) {
return s < i[0] || s > i[1];
}, isEndofBounce = function(s, i, t, e) {
return !e[0] && s === i[0] - t[0] || !e[1] && s === i[1] + t[1];
}, getDuration = function(s, i) {
var t = Math.sqrt(s / i * 2);
return t < 100 ? 0 : t;
}, isCircularable = function(s, i, t) {
return t[1] && s > i[1] || t[0] && s < i[0];
}, getCirculatedPos = function(s, i, t) {
var e = s, n = i[0], r = i[1], l = r - n;
return t[1] && s > r && (e = (e - r) % l + n), t[0] && s < n && (e = (e - n) % l + r), e;
}, AxisManager = /* @__PURE__ */ function() {
function s(t) {
var e = this;
this._axis = t, this._complementOptions(), this._pos = Object.keys(this._axis).reduce(function(n, r) {
return n[r] = e._axis[r].startPos, n;
}, {});
}
var i = s.prototype;
return i.getDelta = function(t, e) {
var n = this.get(t);
return map(this.get(e), function(r, l) {
return r - n[l];
});
}, i.get = function(t) {
var e = this;
return t && Array.isArray(t) ? t.reduce(function(n, r) {
return r && r in e._pos && (n[r] = e._pos[r]), n;
}, {}) : __assign$3(__assign$3({}, this._pos), t || {});
}, i.moveTo = function(t, e) {
e === void 0 && (e = this._pos);
var n = map(this._pos, function(r, l) {
return l in t && l in e ? t[l] - e[l] : 0;
});
return this.set(this.map(t, function(r, l) {
return l ? getCirculatedPos(r, l.range, l.circular) : 0;
})), {
pos: __assign$3({}, this._pos),
delta: n
};
}, i.set = function(t) {
for (var e in t)
e && e in this._pos && (this._pos[e] = t[e]);
}, i.every = function(t, e) {
var n = this._axis;
return every(t, function(r, l) {
return e(r, n[l], l);
});
}, i.filter = function(t, e) {
var n = this._axis;
return filter(t, function(r, l) {
return e(r, n[l], l);
});
}, i.map = function(t, e) {
var n = this._axis;
return map(t, function(r, l) {
return e(r, n[l], l);
});
}, i.isOutside = function(t) {
return !this.every(t ? this.get(t) : this._pos, function(e, n) {
return !isOutside(e, n.range);
});
}, i.getAxisOptions = function(t) {
return this._axis[t];
}, i.setAxis = function(t) {
var e = this;
Object.keys(t).forEach(function(n) {
if (!e._axis[n])
throw new Error("Axis ".concat(n, " does not exist in Axes instance"));
e._axis[n] = __assign$3(__assign$3({}, e._axis[n]), t[n]);
}), this._complementOptions();
}, i._complementOptions = function() {
var t = this;
Object.keys(this._axis).forEach(function(e) {
t._axis[e] = __assign$3({
range: [0, 100],
startPos: t._axis[e].range[0],
bounce: [0, 0],
circular: [!1, !1]
}, t._axis[e]), ["bounce", "circular"].forEach(function(n) {
var r = t._axis, l = r[e][n];
/string|number|boolean/.test(typeof l) && (r[e][n] = [l, l]);
});
});
}, s;
}(), SUPPORT_TOUCH = "ontouchstart" in win, SUPPORT_POINTER = "PointerEvent" in win, SUPPORT_MSPOINTER = "MSPointerEvent" in win, SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER, isValidKey = function(s, i) {
return !!(!i || i.indexOf(ANY) > -1 || i.indexOf(NONE) > -1 && !s.shiftKey && !s.ctrlKey && !s.altKey && !s.metaKey || i.indexOf(SHIFT) > -1 && s.shiftKey || i.indexOf(CTRL) > -1 && s.ctrlKey || i.indexOf(ALT) > -1 && s.altKey || i.indexOf(META) > -1 && s.metaKey);
}, EventInput = /* @__PURE__ */ function() {
function s() {
var t = this;
this._stopContextMenu = function(e) {
e.preventDefault(), win.removeEventListener("contextmenu", t._stopContextMenu);
};
}
var i = s.prototype;
return i.extendEvent = function(t) {
var e, n = this.prevEvent, r = this._getCenter(t), l = n ? this._getMovement(t) : {
x: 0,
y: 0
}, u = n ? this._getScale(t) : 1, d = n ? getAngle(r.x - n.center.x, r.y - n.center.y) : 0, f = n ? n.deltaX + l.x : l.x, _ = n ? n.deltaY + l.y : l.y, g = l.x, y = l.y, p = this._latestInterval, m = Date.now(), b = p ? m - p.timestamp : 0, P = n ? n.velocityX : 0, v = n ? n.velocityY : 0;
return (!p || b >= VELOCITY_INTERVAL) && (p && (e = [(f - p.deltaX) / b, (_ - p.deltaY) / b], P = e[0], v = e[1]), this._latestInterval = {
timestamp: m,
deltaX: f,
deltaY: _
}), {
srcEvent: t,
scale: u,
angle: d,
center: r,
deltaX: f,
deltaY: _,
offsetX: g,
offsetY: y,
velocityX: P,
velocityY: v,
preventSystemEvent: !0
};
}, i._getDistance = function(t, e) {
var n = e.clientX - t.clientX, r = e.clientY - t.clientY;
return Math.sqrt(n * n + r * r);
}, i._getButton = function(t) {
var e = {
1: MOUSE_LEFT,
2: MOUSE_RIGHT,
4: MOUSE_MIDDLE
}, n = this._isTouchEvent(t) ? MOUSE_LEFT : e[t.buttons];
return n || null;
}, i._isTouchEvent = function(t) {
return t.type && t.type.indexOf("touch") > -1;
}, i._isValidButton = function(t, e) {
return e.indexOf(t) > -1;
}, i._isValidEvent = function(t, e, n) {
return (!e || isValidKey(t, e)) && (!n || this._isValidButton(this._getButton(t), n));
}, i._preventMouseButton = function(t, e) {
e === MOUSE_RIGHT ? win.addEventListener("contextmenu", this._stopContextMenu) : e === MOUSE_MIDDLE && t.preventDefault();
}, s;
}(), MouseEventInput = /* @__PURE__ */ function(s) {
__extends$4(i, s);
function i() {
var e = s !== null && s.apply(this, arguments) || this;
return e.start = ["mousedown"], e.move = ["mousemove"], e.end = ["mouseup"], e;
}
var t = i.prototype;
return t.onEventStart = function(e, n, r) {
var l = this._getButton(e);
return this._isValidEvent(e, n, r) ? (this._preventMouseButton(e, l), this.extendEvent(e)) : null;
}, t.onEventMove = function(e, n, r) {
return this._isValidEvent(e, n, r) ? this.extendEvent(e) : null;
}, t.onEventEnd = function() {
}, t.onRelease = function() {
this.prevEvent = null;
}, t.getTouches = function(e, n) {
return n && this._isValidButton(MOUSE_BUTTON_CODE_MAP[e.which], n) && this.end.indexOf(e.type) === -1 ? 1 : 0;
}, t._getScale = function() {
return 1;
}, t._getCenter = function(e) {
return {
x: e.clientX,
y: e.clientY
};
}, t._getMovement = function(e) {
var n = this.prevEvent.srcEvent;
return {
x: e.clientX - n.clientX,
y: e.clientY - n.clientY
};
}, i;
}(EventInput), TouchEventInput = /* @__PURE__ */ function(s) {
__extends$4(i, s);
function i() {
var e = s !== null && s.apply(this, arguments) || this;
return e.start = ["touchstart"], e.move = ["touchmove"], e.end = ["touchend", "touchcancel"], e;
}
var t = i.prototype;
return t.onEventStart = function(e, n) {
return this._baseTouches = e.touches, this._isValidEvent(e, n) ? this.extendEvent(e) : null;
}, t.onEventMove = function(e, n) {
return this._isValidEvent(e, n) ? this.extendEvent(e) : null;
}, t.onEventEnd = function(e) {
this._baseTouches = e.touches;
}, t.onRelease = function() {
this.prevEvent = null, this._baseTouches = null;
}, t.getTouches = function(e) {
return e.touches.length;
}, t._getScale = function(e) {
return e.touches.length !== 2 || this._baseTouches.length < 2 ? null : this._getDistance(e.touches[0], e.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]);
}, t._getCenter = function(e) {
return {
x: e.touches[0].clientX,
y: e.touches[0].clientY
};
}, t._getMovement = function(e) {
var n = this.prevEvent.srcEvent;
return e.touches[0].identifier !== n.touches[0].identifier ? {
x: 0,
y: 0
} : {
x: e.touches[0].clientX - n.touches[0].clientX,
y: e.touches[0].clientY - n.touches[0].clientY
};
}, i;
}(EventInput), PointerEventInput = /* @__PURE__ */ function(s) {
__extends$4(i, s);
function i() {
var e = s !== null && s.apply(this, arguments) || this;
return e.start = SUPPORT_POINTER ? ["pointerdown"] : ["MSPointerDown"], e.move = SUPPORT_POINTER ? ["pointermove"] : ["MSPointerMove"], e.end = SUPPORT_POINTER ? ["pointerup", "pointercancel"] : ["MSPointerUp", "MSPointerCancel"], e._firstInputs = [], e._recentInputs = [], e;
}
var t = i.prototype;
return t.onEventStart = function(e, n, r) {
var l = this._getButton(e);
return this._isValidEvent(e, n, r) ? (this._preventMouseButton(e, l), this._updatePointerEvent(e), this.extendEvent(e)) : null;
}, t.onEventMove = function(e, n, r) {
return this._isValidEvent(e, n, r) ? (this._updatePointerEvent(e), this.extendEvent(e)) : null;
}, t.onEventEnd = function(e) {
this._removePointerEvent(e);
}, t.onRelease = function() {
this.prevEvent = null, this._firstInputs = [], this._recentInputs = [];
}, t.getTouches = function() {
return this._recentInputs.length;
}, t._getScale = function() {
return this._recentInputs.length !== 2 ? null : this._getDistance(this._recentInputs[0], this._recentInputs[1]) / this._getDistance(this._firstInputs[0], this._firstInputs[1]);
}, t._getCenter = function(e) {
return {
x: e.clientX,
y: e.clientY
};
}, t._getMovement = function(e) {
var n = this.prevEvent.srcEvent;
return e.pointerId !== n.pointerId ? {
x: 0,
y: 0
} : {
x: e.clientX - n.clientX,
y: e.clientY - n.clientY
};
}, t._updatePointerEvent = function(e) {
var n = this, r = !1;
this._recentInputs.forEach(function(l, u) {
l.pointerId === e.pointerId && (r = !0, n._recentInputs[u] = e);
}), r || (this._firstInputs.push(e), this._recentInputs.push(e));
}, t._removePointerEvent = function(e) {
this._firstInputs = this._firstInputs.filter(function(n) {
return n.pointerId !== e.pointerId;
}), this._recentInputs = this._recentInputs.filter(function(n) {
return n.pointerId !== e.pointerId;
});
}, i;
}(EventInput), TouchMouseEventInput = /* @__PURE__ */ function(s) {
__extends$4(i, s);
function i() {
var e = s !== null && s.apply(this, arguments) || this;
return e.start = ["mousedown", "touchstart"], e.move = ["mousemove", "touchmove"], e.end = ["mouseup", "touchend", "touchcancel"], e;
}
var t = i.prototype;
return t.onEventStart = function(e, n, r) {
var l = this._getButton(e);
return this._isTouchEvent(e) && (this._baseTouches = e.touches), this._isValidEvent(e, n, r) ? (this._preventMouseButton(e, l), this.extendEvent(e)) : null;
}, t.onEventMove = function(e, n, r) {
return this._isValidEvent(e, n, r) ? this.extendEvent(e) : null;
}, t.onEventEnd = function(e) {
this._isTouchEvent(e) && (this._baseTouches = e.touches);
}, t.onRelease = function() {
this.prevEvent = null, this._baseTouches = null;
}, t.getTouches = function(e, n) {
return this._isTouchEvent(e) ? e.touches.length : this._isValidButton(MOUSE_BUTTON_CODE_MAP[e.which], n) && this.end.indexOf(e.type) === -1 ? 1 : 0;
}, t._getScale = function(e) {
return this._isTouchEvent(e) ? e.touches.length !== 2 || this._baseTouches.length < 2 ? 1 : this._getDistance(e.touches[0], e.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]) : this.prevEvent.scale;
}, t._getCenter = function(e) {
return this._isTouchEvent(e) ? {
x: e.touches[0].clientX,
y: e.touches[0].clientY
} : {
x: e.clientX,
y: e.clientY
};
}, t._getMovement = function(e) {
var n = this, r = this.prevEvent.srcEvent, l = [e, r].map(function(f) {
return n._isTouchEvent(f) ? {
id: f.touches[0].identifier,
x: f.touches[0].clientX,
y: f.touches[0].clientY
} : {
id: null,
x: f.clientX,
y: f.clientY
};
}), u = l[0], d = l[1];
return u.id === d.id ? {
x: u.x - d.x,
y: u.y - d.y
} : {
x: 0,
y: 0
};
}, i;
}(EventInput), toAxis = function(s, i) {
return i.reduce(function(t, e, n) {
return s[n] && (t[s[n]] = e), t;
}, {});
}, convertInputType = function(s) {
s === void 0 && (s = []);
var i = !1, t = !1, e = !1;
return s.forEach(function(n) {
switch (n) {
case "mouse":
t = !0;
break;
case "touch":
i = SUPPORT_TOUCH;
break;
case "pointer":
e = SUPPORT_POINTER_EVENTS;
}
}), e ? new PointerEventInput() : i && t ? new TouchMouseEventInput() : i ? new TouchEventInput() : t ? new MouseEventInput() : null;
};
function getAddEventOptions(s) {
return s.indexOf("touch") > -1 ? {
passive: !1
} : !1;
}
var InputObserver = /* @__PURE__ */ function() {
function s(t) {
var e = t.options, n = t.interruptManager, r = t.eventManager, l = t.axisManager, u = t.animationManager;
this._isOutside = !1, this._moveDistance = null, this._isStopped = !1, this.options = e, this._interruptManager = n, this._eventManager = r, this._axisManager = l, this._animationManager = u;
}
var i = s.prototype;
return i.get = function(t) {
return this._axisManager.get(t.axes);
}, i.hold = function(t, e) {
if (!(this._interruptManager.isInterrupted() || !t.axes.length)) {
var n = {
input: t,
event: e
};
this._isStopped = !1, this._interruptManager.setInterrupt(!0), this._animationManager.stopAnimation(n), ++this._eventManager.holdingCount, this._moveDistance || this._eventManager.hold(this._axisManager.get(), n), this._isOutside = this._axisManager.isOutside(t.axes), this._moveDistance = this._axisManager.get(t.axes);
}
}, i.change = function(t, e, n, r) {
if (!(this._isStopped || !this._interruptManager.isInterrupting() || this._axisManager.every(n, function(y) {
return y === 0;
}))) {
var l = e.srcEvent ? e.srcEvent : e;
if (!l.__childrenAxesAlreadyChanged) {
var u = this._moveDistance || this._axisManager.get(t.axes), d;
d = map(u, function(y, p) {
return y + (n[p] || 0);
}), this._moveDistance && (this._moveDistance = this._axisManager.map(d, function(y, p) {
var m = p.circular, b = p.range;
return m && (m[0] || m[1]) ? getCirculatedPos(y, b, m) : y;
})), this._isOutside && this._axisManager.every(u, function(y, p) {
return !isOutside(y, p.range);
}) && (this._isOutside = !1), u = this._atOutside(u), d = this._atOutside(d), (!this.options.nested || !this._isEndofAxis(n, u, d)) && (l.__childrenAxesAlreadyChanged = !0);
var f = {
input: t,
event: e
};
if (r) {
var _ = this._animationManager.getDuration(d, u);
this._animationManager.animateTo(d, _, f);
} else {
var g = !this._eventManager.triggerChange(d, u, f, !0);
g && (this._isStopped = !0, this._moveDistance = null, this._animationManager.finish(!1));
}
}
}
}, i.release = function(t, e, n, r) {
if (!(this._isStopped || !this._interruptManager.isInterrupting() || !this._moveDistance)) {
var l = e.srcEvent ? e.srcEvent : e;
l.__childrenAxesAlreadyReleased && (n = n.map(function() {
return 0;
}));
var u = this._axisManager.get(t.axes), d = this._axisManager.get(), f = this._animationManager.getDisplacement(n), _ = toAxis(t.axes, f), g = this._axisManager.get(this._axisManager.map(_, function(v, E, T) {
return E.circular && (E.circular[0] || E.circular[1]) ? u[T] + v : getInsidePosition(u[T] + v, E.range, E.circular, E.bounce);
}));
l.__childrenAxesAlreadyReleased = !0;
var y = this._animationManager.getDuration(g, u, r);
y === 0 && (g = __assign$3({}, d));
var p = {
depaPos: d,
destPos: g,
duration: y,
delta: this._axisManager.getDelta(d, g),
inputEvent: e,
input: t,
isTrusted: !0
};
--this._eventManager.holdingCount, this._eventManager.triggerRelease(p), this._eventManager.holdingCount === 0 && (this._moveDistance = null);
var m = this._animationManager.getUserControl(p), b = equal(m.destPos, d), P = {
input: t,
event: e
};
b || m.duration === 0 ? (b || this._eventManager.triggerChange(m.destPos, d, P, !0), this._interruptManager.setInterrupt(!1), this._axisManager.isOutside() ? this._animationManager.restore(P) : this._eventManager.triggerFinish(!0)) : this._animationManager.animateTo(m.destPos, m.duration, P);
}
}, i._atOutside = function(t) {
var e = this;
return this._isOutside ? this._axisManager.map(t, function(n, r) {
var l = r.range[0] - r.bounce[0], u = r.range[1] + r.bounce[1];
return n > u ? u : n < l ? l : n;
}) : this._axisManager.map(t, function(n, r) {
var l = r.range[0], u = r.range[1], d = r.bounce, f = r.circular;
return f[0] && n < l || f[1] && n > u ? n : n < l ? l - e._animationManager.interpolate(l - n, d[0]) : n > u ? u + e._animationManager.interpolate(n - u, d[1]) : n;
});
}, i._isEndofAxis = function(t, e, n) {
return this._axisManager.every(e, function(r, l, u) {
return t[u] === 0 || e[u] === n[u] && isEndofBounce(r, l.range, l.bounce, l.circular);
});
}, s;
}(), clamp$1 = function(s, i, t) {
return Math.max(Math.min(s, t), i);
}, AnimationManager = /* @__PURE__ */ function() {
function s(t) {
var e = t.options, n = t.interruptManager, r = t.eventManager, l = t.axisManager;
this._options = e, this.interruptManager = n, this.eventManager = r, this.axisManager = l, this.animationEnd = this.animationEnd.bind(this);
}
var i = s.prototype;
return i.getDuration = function(t, e, n) {
var r = this, l;
if (typeof n < "u")
l = n;
else {
var u = map(e, function(d, f) {
return getDuration(Math.abs(d - t[f]), r._options.deceleration);
});
l = Object.keys(u).reduce(function(d, f) {
return Math.max(d, u[f]);
}, -1 / 0);
}
return clamp$1(l, this._options.minimumDuration, this._options.maximumDuration);
}, i.getDisplacement = function(t) {
var e = Math.pow(t.reduce(function(r, l) {
return r + l * l;
}, 0), 1 / t.length), n = Math.abs(e / -this._options.deceleration);
return t.map(function(r) {
return r / 2 * n;
});
}, i.stopAnimation = function(t) {
if (this._animateParam) {
var e = this.axisManager.get(), n = this.axisManager.map(e, function(r, l) {
return getCirculatedPos(r, l.range, l.circular);
});
every(n, function(r, l) {
return e[l] === r;
}) || this.eventManager.triggerChange(n, e, t, !!t), this._animateParam = null, this._raf && cancelAnimationFrame$1(this._raf), this._raf = null, this.eventManager.triggerAnimationEnd(!!t?.event);
}
}, i.getEventInfo = function() {
return this._animateParam && this._animateParam.input && this._animateParam.inputEvent ? {
input: this._animateParam.input,
event: this._animateParam.inputEvent
} : null;
}, i.restore = function(t) {
var e = this.axisManager.get(), n = this.axisManager.map(e, function(r, l) {
return Math.min(l.range[1], Math.max(l.range[0], r));
});
this.stopAnimation(), this.animateTo(n, this.getDuration(e, n), t);
}, i.animationEnd = function() {
var t = this.getEventInfo();
this._animateParam = null;
var e = this.axisManager.filter(this.axisManager.get(), function(n, r) {
return isCircularable(n, r.range, r.circular);
});
Object.keys(e).length > 0 && this.setTo(this.axisManager.map(e, function(n, r) {
return getCirculatedPos(n, r.range, r.circular);
})), this.interruptManager.setInterrupt(!1), this.eventManager.triggerAnimationEnd(!!t), this.axisManager.isOutside() ? this.restore(t) : this.finish(!!t);
}, i.finish = function(t) {
this._animateParam = null, this.interruptManager.setInterrupt(!1), this.eventManager.triggerFinish(t);
}, i.getUserControl = function(t) {
var e = t.setTo();
return e.destPos = this.axisManager.get(e.destPos), e.duration = clamp$1(e.duration, this._options.minimumDuration, this._options.maximumDuration), e;
}, i.animateTo = function(t, e, n) {
var r = this;
this.stopAnimation();
var l = this._createAnimationParam(t, e, n), u = __assign$3({}, l.depaPos), d = this.eventManager.triggerAnimationStart(l), f = this.getUserControl(l);
if (!d && this.axisManager.every(f.destPos, function(g, y) {
return isCircularable(g, y.range, y.circular);
}) && console.warn("You can't stop the 'animation' event when 'circular' is true."), d && !equal(f.destPos, u)) {
var _ = n?.event || null;
this._animateLoop({
depaPos: u,
destPos: f.destPos,
duration: f.duration,
delta: this.axisManager.getDelta(u, f.destPos),
isTrusted: !!_,
inputEvent: _,
input: n?.input || null
}, function() {
return r.animationEnd();
});
}
}, i.setTo = function(t, e) {
e === void 0 && (e = 0);
var n = Object.keys(t), r = this.axisManager.get(n);
if (equal(t, r))
return this;
this.interruptManager.setInterrupt(!0);
var l = filter(t, function(u, d) {
return r[d] !== u;
});
return Object.keys(l).length ? (l = this.axisManager.map(l, function(u, d) {
var f = d.range, _ = d.circular;
return _ && (_[0] || _[1]) ? u