axentix
Version:
Axentix is a framework mixing fully customizable components & utility-first classes, leaving the design choice to the developer.
1,005 lines • 81.4 kB
JavaScript
var Po = Object.defineProperty;
var Bi = (o) => {
throw TypeError(o);
}, ti = Math.pow, zo = (o, i, t) => i in o ? Po(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
var f = (o, i, t) => zo(o, typeof i != "symbol" ? i + "" : i, t), fi = (o, i, t) => i.has(o) || Bi("Cannot " + t);
var e = (o, i, t) => (fi(o, i, "read from private field"), t ? t.call(o) : i.get(o)), a = (o, i, t) => i.has(o) ? Bi("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(o) : i.set(o, t), n = (o, i, t, s) => (fi(o, i, "write to private field"), s ? s.call(o, t) : i.set(o, t), t), l = (o, i, t) => (fi(o, i, "access private method"), t);
var mi = (o, i, t, s) => ({
set _(r) {
n(o, i, r, t);
},
get _() {
return e(o, i, s);
}
});
const $n = "2.4.1", x = [], ct = {
components: [],
plugins: [],
prefix: "ax",
mode: ""
}, ht = (o) => `--${ct.prefix}-${o}`, Ee = (o) => ct.components.find((i) => i.name === o).class, Fi = () => {
const o = ct.components.filter((t) => t.dataDetection), i = ct.plugins.filter((t) => t.dataDetection);
return [...o, ...i].map((t) => t.name);
}, Ho = () => {
const o = ct.components.filter(
(t) => t.autoInit && t.autoInit.enabled
), i = ct.plugins.filter((t) => t.autoInit && t.autoInit.enabled);
return [...o, ...i].reduce((t, s) => (t[s.name] = document.querySelectorAll(s.autoInit.selector), t), {});
}, Ui = (o, i) => {
if (!o.name || !o.class) {
console.error(`[Axentix] Error registering ${i} : Missing required parameters.`);
return;
}
if (ct[i].some((t) => t.name === o.name)) {
console.error(`[Axentix] Error registering ${i} : Already exist.`);
return;
}
o.autoInit && (o.autoInit.selector = o.autoInit.selector += ":not(.no-axentix-init)"), ct[i].push(o);
}, Y = (o) => {
Ui(o, "components");
}, qn = (o) => {
Ui(o, "plugins");
}, Pn = () => {
window && (window.Axentix || (window.Axentix = {}), [...ct.components, ...ct.plugins].forEach((o) => {
window.Axentix[o.name] = o.class;
}));
}, Bo = (o) => o.replace(/[\w]([A-Z])/g, (i) => i[0] + "-" + i[1]).toLowerCase(), No = (o, i = "") => {
const t = Bo(o);
return i ? i + "-" + t : t;
}, Wo = (o, i, t, s, r = "") => {
const h = i[0].toUpperCase() + i.slice(1).toLowerCase();
Fi().includes(h) && t !== "Collapsible" && h !== "Sidenav" && (o[i] = Ee(h).getDefaultOptions());
const c = r ? r + "-" + i : i, p = ji(o[i], t, s, c);
if (!(Object.keys(p).length === 0 && o.constructor === Object)) return p;
}, ji = (o, i, t, s = "") => Object.keys(o).reduce((r, h) => {
if (typeof o[h] == "object" && o[h] !== null) {
const c = Wo(o, h, i, t, s);
c && (r[h] = c);
} else if (o[h] !== null) {
const c = "data-" + i.toLowerCase() + "-" + No(h, s);
if (t.hasAttribute(c)) {
const p = t.getAttribute(c);
r[h] = typeof o[h] == "number" ? Number(p) : p, typeof o[h] == "boolean" && (r[h] = p === "true");
}
}
return r;
}, {}), Vo = (o, i) => {
const t = Object.assign({}, Ee(o).getDefaultOptions());
return ji(t, o, i);
}, Xo = () => {
document.querySelectorAll("[data-ax]").forEach((i) => {
let t = i.dataset.ax;
if (t = t[0].toUpperCase() + t.slice(1).toLowerCase(), !Fi().includes(t)) {
console.error(
`[Axentix] Error: ${t} component doesn't exist.
Did you forget to register him ?`,
i
);
return;
}
try {
const s = Ee(t);
new s(`#${i.id}`);
} catch (s) {
console.error("[Axentix] Data: Unable to load " + t, s);
}
});
}, Yo = () => {
try {
new Axentix.Axentix("all");
} catch (o) {
console.error("[Axentix] Unable to auto init.", o);
}
};
document.addEventListener("DOMContentLoaded", () => {
document.documentElement.dataset.axentix && Yo(), Xo();
});
const oi = (...o) => o.reduce((i, t) => {
for (let s in t)
i[s] = typeof t[s] == "object" && t[s] !== null ? oi(i[s], t[s]) : t[s];
return i;
}, {}), V = (o, i, t) => oi(Ee(o).getDefaultOptions(), Vo(o, t), i), $i = (o, i = document.createElement("div")) => (o[0].parentElement.insertBefore(i, o[0]), o.forEach((s) => i.appendChild(s)), i), Fo = (o) => o.replaceWith(...o.childNodes), d = (o, i, t) => {
const s = new CustomEvent("ax." + i, {
detail: t || {},
bubbles: !0
});
o.dispatchEvent(s);
}, Uo = () => (
// @ts-ignore
"ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0
), jo = () => !!window.PointerEvent && "maxTouchPoints" in window.navigator && window.navigator.maxTouchPoints >= 0, qi = () => Uo() ? "touch" : jo() ? "pointer" : "mouse", di = (o) => x.filter((i) => i.type === o).map((i) => i.instance), pi = (o) => {
const i = x.find((t) => t.type !== "Toast" && "#" + t.instance.el.id === o);
return i ? i.instance : !1;
}, Pi = () => Math.random().toString().split(".")[1], zn = () => x, Hn = (o) => pi(o).sync(), Bn = () => x.map((o) => o.instance.sync()), Nn = (o) => pi(o).reset(), Wn = () => x.map((o) => o.instance.reset()), Vn = (o) => pi(o).destroy(), Xn = () => x.map((o) => o.instance.destroy()), Gi = (o, i, t, s) => {
const r = o && i ? document.querySelector(`.ax-overlay[data-target="${t}"]`) : document.createElement("div");
return r.classList.add("ax-overlay"), r.style.transitionDuration = s + "ms", r.dataset.target = t, r;
}, ni = (o, i, t, s, r) => {
o && (s ? (i.addEventListener("click", t), document.body.appendChild(i), setTimeout(() => {
i.classList.add("active");
}, 50)) : (i.classList.remove("active"), setTimeout(() => {
i.removeEventListener("click", t), document.body.removeChild(i);
}, r)));
}, Qe = (o, i = '[data-target="{ID}"]') => Array.from(document.querySelectorAll(i.replace("{ID}", o))), Ni = (o) => o.targetTouches && o.targetTouches.length >= 1 ? o.targetTouches[0].clientY : o.changedTouches && o.changedTouches.length >= 1 ? o.changedTouches[0].pageY : o.clientY, De = (o) => o.targetTouches && o.targetTouches.length >= 1 ? o.targetTouches[0].clientX : o.changedTouches && o.changedTouches.length >= 1 ? o.changedTouches[0].pageX : o.clientX, Go = () => window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
class G {
constructor() {
f(this, "el");
}
removeListeners() {
}
setupListeners() {
}
setup() {
}
preventDbInstance(i) {
if (i && pi(i)) throw new Error(`Instance already exist on ${i}`);
}
sync() {
d(this.el, "component.sync"), this.removeListeners(), this.setupListeners();
}
reset() {
d(this.el, "component.reset"), this.removeListeners(), this.setup();
}
destroy() {
d(this.el, "component.destroy"), this.removeListeners();
const i = x.findIndex((t) => t.instance.el.id === this.el.id);
x.splice(i, 1);
}
}
const Zo = {
animationDuration: 500,
height: "",
backToOpposite: !0,
enableTouch: !0,
indicators: {
enabled: !1,
isFlat: !1,
customClasses: ""
},
autoplay: {
enabled: !0,
interval: 5e3,
side: "right"
}
};
var Pt, Et, L, zt, Ce, Ht, Te, Bt, F, Ie, Nt, Dt, Ct, Wt, Vt, Xt, Yt, ut, je, Ge, P, Ze, C, u, _i, Ki, vi, $t, ei, Ji, Qi, ts, es, is, yi, ii, gi;
class Zi extends G {
constructor(t, s) {
super();
a(this, u);
f(this, "options");
f(this, "activeIndex");
a(this, Pt, 0);
a(this, Et, !1);
a(this, L);
a(this, zt, 0);
a(this, Ce, 0);
a(this, Ht, !1);
a(this, Te, !1);
a(this, Bt, !1);
a(this, F, 0);
a(this, Ie, 0);
a(this, Nt);
a(this, Dt);
a(this, Ct);
a(this, Wt);
a(this, Vt);
a(this, Xt);
a(this, Yt);
a(this, ut);
a(this, je, 0);
a(this, Ge, 0);
a(this, P);
a(this, Ze);
a(this, C);
try {
this.preventDbInstance(t), x.push({ type: "Caroulix", instance: this }), this.el = document.querySelector(t), this.options = V("Caroulix", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Caroulix init error", r);
}
}
setup() {
d(this.el, "caroulix.setup"), this.options.autoplay.side = this.options.autoplay.side.toLowerCase(), ["right", "left"].includes(this.options.autoplay.side) || (this.options.autoplay.side = "right"), this.activeIndex = 0, n(this, Pt, 0), n(this, Et, !1), n(this, C, qi()), n(this, L, l(this, u, _i).call(this)), this.options.indicators.enabled && l(this, u, es).call(this);
const s = this.el.querySelector(".active");
s ? this.activeIndex = e(this, L).indexOf(s) : e(this, L)[0].classList.add("active"), l(this, u, Ki).call(this), e(this, zt) === 0 && l(this, u, ei).call(this), this.setupListeners(), this.options.autoplay.enabled && this.play();
}
setupListeners() {
n(this, Nt, l(this, u, ei).bind(this)), window.addEventListener("resize", e(this, Nt)), e(this, Ct) && (n(this, Wt, this.next.bind(this, 1)), e(this, Ct).addEventListener("click", e(this, Wt))), e(this, Dt) && (n(this, Vt, this.prev.bind(this, 1)), e(this, Dt).addEventListener("click", e(this, Vt))), this.options.enableTouch && (n(this, Xt, l(this, u, Ji).bind(this)), n(this, Yt, l(this, u, Qi).bind(this)), n(this, ut, l(this, u, ts).bind(this)), this.el.addEventListener(
`${e(this, C)}${e(this, C) === "touch" ? "start" : "down"}`,
e(this, Xt)
), this.el.addEventListener(`${e(this, C)}move`, e(this, Yt)), this.el.addEventListener(
`${e(this, C)}${e(this, C) === "touch" ? "end" : "up"}`,
e(this, ut)
), this.el.addEventListener(
e(this, C) === "pointer" ? "pointerleave" : "mouseleave",
e(this, ut)
));
}
removeListeners() {
window.removeEventListener("resize", e(this, Nt)), n(this, Nt, void 0), e(this, Ct) && (e(this, Ct).removeEventListener("click", e(this, Wt)), n(this, Wt, void 0)), e(this, Dt) && (e(this, Dt).removeEventListener("click", e(this, Vt)), n(this, Vt, void 0)), this.options.enableTouch && (this.el.removeEventListener(
`${e(this, C)}${e(this, C) === "pointer" ? "down" : "start"}`,
e(this, Xt)
), this.el.removeEventListener(`${e(this, C)}move`, e(this, Yt)), this.el.removeEventListener(
`${e(this, C)}${e(this, C) === "touch" ? "end" : "up"}`,
e(this, ut)
), this.el.removeEventListener(
e(this, C) === "pointer" ? "pointerleave" : "mouseleave",
e(this, ut)
), n(this, Xt, void 0), n(this, Yt, void 0), n(this, ut, void 0));
}
goTo(t) {
if (t === this.activeIndex) return;
(t > this.activeIndex ? "right" : "left") === "left" ? this.prev(Math.abs(this.activeIndex - t)) : this.next(Math.abs(this.activeIndex - t)), this.options.indicators.enabled && l(this, u, yi).call(this);
}
play() {
this.options.autoplay.enabled && (this.stop(), n(this, Ze, setInterval(() => {
this.options.autoplay.side === "right" ? this.next(1, !1) : this.prev(1, !1);
}, this.options.autoplay.interval)));
}
stop() {
this.options.autoplay.enabled && clearInterval(e(this, Ze));
}
next(t = 1, s = !0) {
e(this, Ht) || this.activeIndex === e(this, L).length - 1 && !this.options.backToOpposite || (d(this.el, "caroulix.next", { step: t }), n(this, Et, !0), s && this.options.autoplay.enabled && this.stop(), this.activeIndex < e(this, L).length - 1 ? this.activeIndex += t : this.options.backToOpposite && (this.activeIndex = 0), l(this, u, gi).call(this), l(this, u, $t).call(this), s && this.options.autoplay.enabled && this.play());
}
prev(t = 1, s = !0) {
e(this, Ht) || this.activeIndex === 0 && !this.options.backToOpposite || (d(this.el, "caroulix.prev", { step: t }), n(this, Et, !0), s && this.options.autoplay.enabled && this.stop(), this.activeIndex > 0 ? this.activeIndex -= t : this.options.backToOpposite && (this.activeIndex = e(this, L).length - 1), l(this, u, gi).call(this), l(this, u, $t).call(this), s && this.options.autoplay.enabled && this.play());
}
}
Pt = new WeakMap(), Et = new WeakMap(), L = new WeakMap(), zt = new WeakMap(), Ce = new WeakMap(), Ht = new WeakMap(), Te = new WeakMap(), Bt = new WeakMap(), F = new WeakMap(), Ie = new WeakMap(), Nt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap(), Wt = new WeakMap(), Vt = new WeakMap(), Xt = new WeakMap(), Yt = new WeakMap(), ut = new WeakMap(), je = new WeakMap(), Ge = new WeakMap(), P = new WeakMap(), Ze = new WeakMap(), C = new WeakMap(), u = new WeakSet(), _i = function() {
return Array.from(this.el.children).reduce((t, s) => (s.classList.contains("caroulix-item") && t.push(s), s.classList.contains("caroulix-prev") && n(this, Dt, s), s.classList.contains("caroulix-next") && n(this, Ct, s), t), []);
}, Ki = function() {
n(this, zt, 0), n(this, Ce, 0), e(this, L).forEach((t) => {
const s = t.querySelector("img, video");
s && (mi(this, zt)._++, s.complete ? l(this, u, vi).call(this, s, !0) : (s.loadRef = l(this, u, vi).bind(this, s), s.addEventListener("load", s.loadRef)));
});
}, vi = function(t, s) {
mi(this, Ce)._++, s || (t.removeEventListener("load", t.loadRef), t.loadRef = void 0), e(this, zt) == e(this, Ce) && (l(this, u, ei).call(this), l(this, u, $t).call(this, !0));
}, $t = function(t = !1) {
const s = this.el.getBoundingClientRect().width;
e(this, L).forEach((h, c) => {
h.style.transform = `translateX(${s * c - s * this.activeIndex - e(this, Pt)}px)`;
}), this.options.indicators.enabled && l(this, u, yi).call(this), e(this, L).find((h) => h.classList.contains("active")).classList.remove("active"), e(this, L)[this.activeIndex].classList.add("active"), setTimeout(() => {
n(this, Et, !1);
}, this.options.animationDuration), t && setTimeout(() => l(this, u, ii).call(this, this.options.animationDuration), 50);
}, ei = function() {
if (n(this, Ht, !0), this.el.style.transitionDuration = "", this.options.autoplay.enabled && this.play(), this.options.height)
this.el.style.height = this.options.height;
else {
const t = e(this, L).map((r) => r.offsetHeight), s = Math.max(...t);
this.el.style.height = s + "px";
}
l(this, u, $t).call(this), setTimeout(() => {
this.el.style.transitionDuration = this.options.animationDuration + "ms", n(this, Ht, !1);
}, 50);
}, Ji = function(t) {
t.target.closest(".caroulix-arrow") || t.target.closest(".caroulix-indicators") || e(this, Et) || (t.type !== "touchstart" && t.preventDefault(), this.options.autoplay.enabled && this.stop(), l(this, u, ii).call(this, 0), n(this, Bt, !0), n(this, Te, !1), n(this, F, 0), n(this, Ie, 0), n(this, je, De(t)), n(this, Ge, Ni(t)));
}, Qi = function(t) {
if (!e(this, Bt) || e(this, Te)) return;
let s = De(t), r = Ni(t);
if (n(this, F, e(this, je) - s), n(this, Ie, Math.abs(e(this, Ge) - r)), t.type === "touchmove" && e(this, Ie) > Math.abs(e(this, F)))
return n(this, Te, !0), n(this, F, 0), !1;
t.cancelable && t.preventDefault(), n(this, Pt, e(this, F)), l(this, u, $t).call(this);
}, ts = function(t) {
if (!(t.target.closest(".caroulix-arrow") || t.target.closest(".caroulix-indicators")) && (t.cancelable && t.preventDefault(), e(this, Bt))) {
l(this, u, ii).call(this, this.options.animationDuration);
let s = this.el.getBoundingClientRect().width;
n(this, Bt, !1);
const r = s * 15 / 100;
this.activeIndex !== e(this, L).length - 1 && e(this, F) > r ? this.next() : this.activeIndex !== 0 && e(this, F) < -r && this.prev(), n(this, F, 0), n(this, Pt, 0), l(this, u, $t).call(this), this.options.autoplay.enabled && this.play();
}
}, es = function() {
n(this, P, document.createElement("ul")), e(this, P).classList.add("caroulix-indicators"), this.options.indicators.isFlat && e(this, P).classList.add("caroulix-flat"), this.options.indicators.customClasses && (e(this, P).className = `${e(this, P).className} ${this.options.indicators.customClasses}`);
for (let t = 0; t < e(this, L).length; t++) {
const s = document.createElement("li");
s.triggerRef = l(this, u, is).bind(this, t), s.addEventListener("click", s.triggerRef), e(this, P).appendChild(s);
}
this.el.appendChild(e(this, P));
}, is = function(t, s) {
s.preventDefault(), t !== this.activeIndex && this.goTo(t);
}, yi = function() {
Array.from(e(this, P).children).forEach((t) => t.removeAttribute("class")), e(this, P).children[this.activeIndex].classList.add("active");
}, ii = function(t) {
this.el.style.transitionDuration = t + "ms";
}, gi = function() {
d(this.el, "caroulix.slide", {
nextElement: e(this, L)[this.activeIndex],
currentElement: e(this, L)[e(this, L).findIndex((t) => t.classList.contains("active"))]
});
}, f(Zi, "getDefaultOptions", () => Zo);
Y({
class: Zi,
name: "Caroulix",
dataDetection: !0,
autoInit: {
enabled: !0,
selector: ".caroulix"
}
});
const _o = {
animationDuration: 300,
sidenav: {
activeClass: !0,
activeWhenOpen: !0,
autoClose: !0
}
};
var Ft, Ae, Ut, z, ft, Se, jt, Gt, U, w, os, ns, rs, bi, as, xi, ls;
class ss extends G {
constructor(t, s) {
super();
a(this, w);
f(this, "options");
a(this, Ft);
a(this, Ae);
a(this, Ut, !0);
a(this, z, !1);
a(this, ft, !1);
a(this, Se, !1);
a(this, jt);
a(this, Gt);
a(this, U);
try {
this.preventDbInstance(t), x.push({ type: "Collapsible", instance: this }), this.el = document.querySelector(t), this.options = V("Collapsible", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Collapsible init error", r);
}
}
setup() {
d(this.el, "collapsible.setup"), n(this, Ft, Qe(this.el.id)), n(this, Ut, !0), n(this, z, !!this.el.classList.contains("active")), n(this, ft, !1), n(this, U, ""), n(this, Se, !1), this.setupListeners(), this.el.style.transitionDuration = this.options.animationDuration + "ms", l(this, w, ns).call(this), n(this, Se, !!this.el.querySelector(".active")), this.options.sidenav.activeClass && l(this, w, rs).call(this), e(this, z) && this.open(), n(this, Ut, !1);
}
setupListeners() {
n(this, jt, l(this, w, ls).bind(this)), e(this, Ft).forEach((t) => t.addEventListener("click", e(this, jt))), n(this, Gt, l(this, w, os).bind(this)), window.addEventListener("resize", e(this, Gt));
}
removeListeners() {
e(this, Ft).forEach((t) => t.removeEventListener("click", e(this, jt))), n(this, jt, void 0), window.removeEventListener("resize", e(this, Gt)), n(this, Gt, void 0);
}
/** Open collapsible */
open() {
e(this, z) && !e(this, Ut) || (d(this.el, "collapsible.open"), n(this, z, !0), n(this, ft, !0), this.el.style.display = "block", l(this, w, xi).call(this), this.el.style.maxHeight = this.el.scrollHeight + "px", this.options.sidenav.activeWhenOpen && l(this, w, bi).call(this, !0), this.options.sidenav.autoClose && l(this, w, as).call(this), setTimeout(() => {
n(this, ft, !1);
}, this.options.animationDuration));
}
/** Close collapsible */
close() {
e(this, z) && (d(this.el, "collapsible.close"), n(this, ft, !0), this.el.style.maxHeight = "", l(this, w, xi).call(this), this.options.sidenav.activeWhenOpen && l(this, w, bi).call(this, !1), setTimeout(() => {
this.el.style.display = "", n(this, ft, !1), n(this, z, !1);
}, this.options.animationDuration));
}
}
Ft = new WeakMap(), Ae = new WeakMap(), Ut = new WeakMap(), z = new WeakMap(), ft = new WeakMap(), Se = new WeakMap(), jt = new WeakMap(), Gt = new WeakMap(), U = new WeakMap(), w = new WeakSet(), os = function() {
e(this, z) && !e(this, U) && (this.el.style.maxHeight = this.el.scrollHeight + "px");
}, ns = function() {
const t = this.el.closest(".sidenav");
t && (n(this, U, t.id), n(this, Ae, e(this, Ft).filter((s) => {
var r;
return ((r = s.closest(".sidenav")) == null ? void 0 : r.id) === t.id;
})));
}, rs = function() {
!e(this, Se) || !e(this, U) || (e(this, Ae).forEach((t) => t.classList.add("active")), this.el.classList.add("active"), this.open(), n(this, z, !0));
}, /** Enable / disable active state to trigger when collapsible is in sidenav */
bi = function(t) {
e(this, U) && e(this, Ae).forEach((s) => {
t ? s.classList.add("active") : s.classList.remove("active");
});
}, as = function() {
!e(this, Ut) && e(this, U) && di("Collapsible").forEach((t) => {
e(t, U) === e(this, U) && t.el.id !== this.el.id && t.close();
});
}, xi = function() {
this.el.style.overflow = "hidden", setTimeout(() => {
this.el.style.overflow = "";
}, this.options.animationDuration);
}, ls = function(t) {
t.preventDefault(), !e(this, ft) && (e(this, z) ? this.close() : this.open());
}, f(ss, "getDefaultOptions", () => _o);
Y({
class: ss,
name: "Collapsible",
dataDetection: !0,
autoInit: {
enabled: !0,
selector: ".collapsible"
}
});
const Ko = {
overlay: !0,
bodyScrolling: !1,
animationDuration: 300
};
var ke, Z, _, Zt, Re, K, Oe, mt, _t, Me, O, cs, Li, ds, wi, ps;
class hs extends G {
constructor(t, s) {
super();
a(this, O);
f(this, "options");
a(this, ke);
a(this, Z, !1);
a(this, _, !1);
a(this, Zt, !1);
a(this, Re, !1);
a(this, K);
a(this, Oe);
a(this, mt);
a(this, _t);
a(this, Me);
try {
this.preventDbInstance(t), x.push({ type: "Sidenav", instance: this }), this.el = document.querySelector(t), this.options = V("Sidenav", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Sidenav init error", r);
}
}
setup() {
d(this.el, "sidenav.setup"), n(this, ke, Qe(this.el.id)), n(this, Z, !1), n(this, _, !1), n(this, Me, window.innerWidth), n(this, Zt, this.el.classList.contains("sidenav-fixed"));
const t = di("Sidenav").find((s) => e(s, Zt));
n(this, Re, t && t.el === this.el), n(this, K, document.querySelector('.layout, [class*="layout-"]')), e(this, K) && e(this, Re) && l(this, O, Li).call(this), this.setupListeners(), this.options.overlay && n(this, Oe, Gi(
e(this, Z),
this.options.overlay,
this.el.id,
this.options.animationDuration
)), e(this, K) && e(this, Zt) && l(this, O, ds).call(this), this.el.style.transitionDuration = this.options.animationDuration + "ms";
}
setupListeners() {
n(this, mt, l(this, O, ps).bind(this)), e(this, ke).forEach((t) => t.addEventListener("click", e(this, mt))), n(this, _t, l(this, O, cs).bind(this)), window.addEventListener("resize", e(this, _t));
}
removeListeners() {
e(this, ke).forEach((t) => t.removeEventListener("click", e(this, mt))), n(this, mt, void 0), window.removeEventListener("resize", e(this, _t)), n(this, _t, void 0);
}
destroy() {
d(this.el, "component.destroy"), this.removeListeners(), e(this, K) && l(this, O, Li).call(this);
const t = x.findIndex((s) => s.instance.el.id === this.el.id);
x.splice(t, 1);
}
/** Open Sidenav */
open() {
e(this, Z) || e(this, _) || (d(this.el, "sidenav.open"), n(this, Z, !0), n(this, _, !0), this.el.classList.add("active"), ni(
this.options.overlay,
e(this, Oe),
e(this, mt),
!0,
this.options.animationDuration
), l(this, O, wi).call(this, !1), setTimeout(() => {
n(this, _, !1), d(this.el, "sidenav.opened");
}, this.options.animationDuration));
}
/** Close Sidenav */
close() {
!e(this, Z) || e(this, _) || (n(this, _, !0), d(this.el, "sidenav.close"), this.el.classList.remove("active"), ni(
this.options.overlay,
e(this, Oe),
e(this, mt),
!1,
this.options.animationDuration
), setTimeout(() => {
l(this, O, wi).call(this, !0), n(this, Z, !1), n(this, _, !1), d(this.el, "sidenav.closed");
}, this.options.animationDuration));
}
}
ke = new WeakMap(), Z = new WeakMap(), _ = new WeakMap(), Zt = new WeakMap(), Re = new WeakMap(), K = new WeakMap(), Oe = new WeakMap(), mt = new WeakMap(), _t = new WeakMap(), Me = new WeakMap(), O = new WeakSet(), cs = function(t) {
const r = t.target.innerWidth;
e(this, Me) !== r && this.close(), n(this, Me, r);
}, Li = function() {
["layout-sidenav-right", "layout-sidenav-both"].forEach(
(t) => e(this, K).classList.remove(t)
);
}, ds = function() {
if (!e(this, Re)) return;
const t = Array.from(document.querySelectorAll(".sidenav")).filter(
(c) => c.classList.contains("sidenav-fixed")
), { sidenavsRight: s, sidenavsLeft: r } = t.reduce(
(c, p) => (p.classList.contains("sidenav-right") ? c.sidenavsRight.push(p) : c.sidenavsLeft.push(p), c),
{ sidenavsRight: [], sidenavsLeft: [] }
), h = r.length > 0 && s.length > 0;
s.length > 0 && !h ? e(this, K).classList.add("layout-sidenav-right") : h && e(this, K).classList.add("layout-sidenav-both");
}, wi = function(t) {
this.options.bodyScrolling || (document.body.style.overflow = t ? "" : "hidden");
}, ps = function(t) {
t.preventDefault(), !(e(this, Zt) && window.innerWidth >= 960) && (e(this, Z) ? this.close() : this.open());
}, f(hs, "getDefaultOptions", () => Ko);
Y({
class: hs,
name: "Sidenav",
dataDetection: !0,
autoInit: {
enabled: !0,
selector: ".sidenav"
}
});
const Jo = {
animationDuration: 300,
animationType: "none",
hover: !1,
autoClose: !0,
preventViewport: !1,
closeOnClick: !0
};
var J, Kt, Q, j, Jt, Qt, te, M, fs, ms, vs, ys, Ei;
class us extends G {
constructor(t, s) {
super();
a(this, M);
f(this, "options");
a(this, J);
a(this, Kt);
a(this, Q, !1);
a(this, j, !1);
a(this, Jt);
a(this, Qt);
a(this, te);
try {
this.preventDbInstance(t), x.push({ type: "Dropdown", instance: this }), this.el = document.querySelector(t), this.options = V("Dropdown", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Dropdown init error", r);
}
}
setup() {
d(this.el, "dropdown.setup"), n(this, J, this.el.querySelector(".dropdown-content")), n(this, Kt, Qe(this.el.id)[0]), n(this, Q, !1), n(this, j, !!this.el.classList.contains("active")), this.options.hover ? this.el.classList.add("active-hover") : this.setupListeners(), this.options.preventViewport && this.el.classList.add("dropdown-vp"), l(this, M, fs).call(this);
}
setupListeners() {
this.options.hover || (n(this, Qt, l(this, M, vs).bind(this)), e(this, Kt).addEventListener("click", e(this, Qt)), n(this, Jt, l(this, M, ms).bind(this)), document.addEventListener("click", e(this, Jt), !0), n(this, te, l(this, M, Ei).bind(this)), this.options.preventViewport && window.addEventListener("scroll", e(this, te)));
}
removeListeners() {
this.options.hover || (e(this, Kt).removeEventListener("click", e(this, Qt)), n(this, Qt, void 0), document.removeEventListener("click", e(this, Jt), !0), n(this, Jt, void 0), this.options.preventViewport && window.removeEventListener("scroll", e(this, te)), n(this, te, void 0));
}
/** Open dropdown */
open() {
e(this, j) || (d(this.el, "dropdown.open"), e(this, J).style.display = "flex", this.options.preventViewport && l(this, M, Ei).call(this), setTimeout(() => {
this.el.classList.add("active"), n(this, j, !0);
}, 10), this.options.autoClose && l(this, M, ys).call(this), this.options.animationType !== "none" ? (n(this, Q, !0), setTimeout(() => {
n(this, Q, !1), d(this.el, "dropdown.opened");
}, this.options.animationDuration)) : d(this.el, "dropdown.opened"));
}
/** Close dropdown */
close() {
e(this, j) && (d(this.el, "dropdown.close"), this.el.classList.remove("active"), this.options.animationType !== "none" ? (n(this, Q, !0), setTimeout(() => {
e(this, J).style.display = "", n(this, Q, !1), n(this, j, !1), d(this.el, "dropdown.closed");
}, this.options.animationDuration)) : (e(this, J).style.display = "", n(this, j, !1), d(this.el, "dropdown.closed")));
}
}
J = new WeakMap(), Kt = new WeakMap(), Q = new WeakMap(), j = new WeakMap(), Jt = new WeakMap(), Qt = new WeakMap(), te = new WeakMap(), M = new WeakSet(), fs = function() {
const t = ["none", "fade"];
this.options.animationType = this.options.animationType.toLowerCase(), t.includes(this.options.animationType) || (this.options.animationType = "none"), this.options.animationType === "fade" && !this.options.hover && (e(this, J).style.transitionDuration = this.options.animationDuration + "ms", this.el.classList.add("dropdown-anim-fade"));
}, ms = function(t) {
t.target === e(this, Kt) || e(this, Q) || !e(this, j) || !this.options.closeOnClick && t.target.closest(".dropdown-content") || this.close();
}, vs = function(t) {
t.preventDefault(), !e(this, Q) && (e(this, j) ? this.close() : this.open());
}, ys = function() {
di("Dropdown").forEach((t) => {
t.el.id !== this.el.id && t.close();
});
}, Ei = function() {
const t = e(this, J).getBoundingClientRect(), s = t.height - (t.bottom - (window.innerHeight || document.documentElement.clientHeight)) - 10;
e(this, J).style.maxHeight = s + "px";
}, f(us, "getDefaultOptions", () => Jo);
Y({
class: us,
name: "Dropdown",
dataDetection: !0,
autoInit: {
enabled: !0,
selector: ".dropdown"
}
});
const Qo = {
animationDuration: 300,
hover: !0,
direction: "top",
position: "bottom-right",
offsetX: "1rem",
offsetY: "1.5rem"
};
var vt, tt, $e, Tt, ee, ie, se, oe, X, bs, xs, Ls, ws, Es;
class gs extends G {
constructor(t, s) {
super();
a(this, X);
f(this, "options");
a(this, vt, !1);
a(this, tt, !1);
a(this, $e);
a(this, Tt);
a(this, ee);
a(this, ie);
a(this, se);
a(this, oe);
try {
this.preventDbInstance(t), x.push({ type: "Fab", instance: this }), this.el = document.querySelector(t), this.options = V("Fab", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Fab init error", r);
}
}
setup() {
d(this.el, "fab.setup"), n(this, vt, !1), n(this, tt, !1), n(this, $e, Qe(this.el.id)[0]), n(this, Tt, this.el.querySelector(".fab-menu")), l(this, X, bs).call(this), this.setupListeners(), this.el.style.transitionDuration = this.options.animationDuration + "ms", l(this, X, xs).call(this);
}
setupListeners() {
this.options.hover ? (n(this, ee, this.open.bind(this)), n(this, ie, this.close.bind(this)), this.el.addEventListener("mouseenter", e(this, ee)), this.el.addEventListener("mouseleave", e(this, ie))) : (n(this, oe, l(this, X, Es).bind(this)), this.el.addEventListener("click", e(this, oe))), n(this, se, l(this, X, ws).bind(this)), document.addEventListener("click", e(this, se), !0);
}
removeListeners() {
this.options.hover ? (this.el.removeEventListener("mouseenter", e(this, ee)), this.el.removeEventListener("mouseleave", e(this, ie)), n(this, ee, void 0), n(this, ie, void 0)) : (this.el.removeEventListener("click", e(this, oe)), n(this, oe, void 0)), document.removeEventListener("click", e(this, se), !0), n(this, se, void 0);
}
/** Open fab */
open() {
e(this, tt) || (d(this.el, "fab.open"), n(this, vt, !0), n(this, tt, !0), this.el.classList.add("active"), setTimeout(() => {
n(this, vt, !1);
}, this.options.animationDuration));
}
/** Close fab */
close() {
e(this, tt) && (d(this.el, "fab.close"), n(this, vt, !0), n(this, tt, !1), this.el.classList.remove("active"), setTimeout(() => {
n(this, vt, !1);
}, this.options.animationDuration));
}
}
vt = new WeakMap(), tt = new WeakMap(), $e = new WeakMap(), Tt = new WeakMap(), ee = new WeakMap(), ie = new WeakMap(), se = new WeakMap(), oe = new WeakMap(), X = new WeakSet(), bs = function() {
["right", "left", "top", "bottom"].includes(this.options.direction) || (this.options.direction = "top"), ["top-right", "top-left", "bottom-right", "bottom-left"].includes(this.options.position) || (this.options.position = "bottom-right");
}, xs = function() {
this.options.position.split("-")[0] === "top" ? this.el.style.top = this.options.offsetY : this.el.style.bottom = this.options.offsetY, this.options.position.split("-")[1] === "right" ? this.el.style.right = this.options.offsetX : this.el.style.left = this.options.offsetX, (this.options.direction === "right" || this.options.direction === "left") && this.el.classList.add("fab-dir-x"), l(this, X, Ls).call(this);
}, Ls = function() {
if (this.options.direction === "top" || this.options.direction === "bottom") {
const t = e(this, $e).clientHeight;
this.options.direction === "top" ? e(this, Tt).style.bottom = t + "px" : e(this, Tt).style.top = t + "px";
} else {
const t = e(this, $e).clientWidth;
this.options.direction === "right" ? e(this, Tt).style.left = t + "px" : e(this, Tt).style.right = t + "px";
}
}, ws = function(t) {
!this.el.contains(t.target) && e(this, tt) && this.close();
}, Es = function(t) {
t.preventDefault(), !e(this, vt) && (e(this, tt) ? this.close() : this.open());
}, f(gs, "getDefaultOptions", () => Qo);
Y({
class: gs,
name: "Fab",
dataDetection: !0,
autoInit: {
enabled: !0,
selector: ".fab:not(i)"
}
});
const tn = {
animationDuration: 400,
overlayClass: "grey dark-4",
offset: 150,
mobileOffset: 80,
caption: ""
};
var ne, re, ae, le, he, A, qe, Pe, T, It, At, et, _e, it, St, st, b, Cs, Ts, Is, As, Ss, ks, Rs, Os, Ms, $s, hi, qs, Ps;
class Ds extends G {
constructor(t, s) {
super();
a(this, b);
f(this, "options");
a(this, ne);
a(this, re);
a(this, ae);
a(this, le);
a(this, he);
a(this, A);
a(this, qe);
a(this, Pe);
a(this, T);
a(this, It, 0);
a(this, At, 0);
a(this, et, !1);
a(this, _e, !1);
a(this, it);
a(this, St, !1);
a(this, st, !1);
a(this, hi, () => {
e(this, et) && this.close();
});
try {
this.preventDbInstance(t), x.push({ type: "Lightbox", instance: this }), this.el = document.querySelector(t), this.options = V("Lightbox", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Lightbox init error", r);
}
}
setup() {
d(this.el, "lightbox.setup"), this.el.style.transitionDuration = this.options.animationDuration + "ms", n(this, it, $i([this.el])), this.setupListeners();
}
setupListeners() {
n(this, ne, l(this, b, Ps).bind(this)), this.el.addEventListener("click", e(this, ne)), n(this, ae, l(this, b, Ms).bind(this)), n(this, le, l(this, b, $s).bind(this)), n(this, he, e(this, hi).bind(this)), n(this, re, l(this, b, Os).bind(this)), window.addEventListener("keyup", e(this, ae)), window.addEventListener("scroll", e(this, le)), window.addEventListener("resize", e(this, he)), this.el.addEventListener("transitionend", e(this, re));
}
removeListeners() {
this.el.removeEventListener("click", e(this, ne)), this.el.removeEventListener("transitionend", e(this, re)), window.removeEventListener("keyup", e(this, ae)), window.removeEventListener("scroll", e(this, le)), window.removeEventListener("resize", e(this, he)), n(this, ne, void 0), n(this, ae, void 0), n(this, le, void 0), n(this, he, void 0), n(this, re, void 0);
}
/** Open lightbox */
open() {
n(this, st, !0);
let t, s;
e(this, St) ? t = s = e(this, it).getBoundingClientRect() : t = s = this.el.getBoundingClientRect(), n(this, St, !1), l(this, b, Cs).call(this), l(this, b, Ts).call(this);
const r = window.innerHeight / 2, h = window.innerWidth / 2;
n(this, T, t), this.el.style.width = e(this, T).width + "px", this.el.style.height = e(this, T).height + "px", this.el.style.top = "0", this.el.style.left = "0";
const c = r + window.scrollY - (s.top + window.scrollY), p = h + window.scrollX - (s.left + window.scrollX);
l(this, b, Ss).call(this), e(this, it).style.position = "relative", setTimeout(() => {
d(this.el, "lightbox.open"), n(this, et, !0), this.el.classList.contains("responsive-media") && (n(this, _e, !0), this.el.classList.remove("responsive-media")), this.el.classList.add("active"), e(this, it).style.width = e(this, T).width + "px", e(this, it).style.height = e(this, T).height + "px", this.el.style.width = e(this, At) + "px", this.el.style.height = e(this, It) + "px", this.el.style.top = c - e(this, It) / 2 + "px", this.el.style.left = p - e(this, At) / 2 + "px";
}, 50);
}
/** Close lightbox */
close(t) {
t != null && t.key && t.key !== "Escape" || (n(this, et, !1), n(this, St, !0), n(this, st, !1), d(this.el, "lightbox.close"), l(this, b, Is).call(this), this.el.style.position = "absolute", this.el.style.top = "0px", this.el.style.left = "0px", this.el.style.width = e(this, T).width + "px", this.el.style.height = e(this, T).height + "px");
}
}
ne = new WeakMap(), re = new WeakMap(), ae = new WeakMap(), le = new WeakMap(), he = new WeakMap(), A = new WeakMap(), qe = new WeakMap(), Pe = new WeakMap(), T = new WeakMap(), It = new WeakMap(), At = new WeakMap(), et = new WeakMap(), _e = new WeakMap(), it = new WeakMap(), St = new WeakMap(), st = new WeakMap(), b = new WeakSet(), Cs = function() {
if (!e(this, A)) {
if (l(this, b, ks).call(this), n(this, A, document.createElement("div")), e(this, A).style.transitionDuration = this.options.animationDuration + "ms", e(this, A).className = "lightbox-overlay " + this.options.overlayClass, e(this, it).appendChild(e(this, A)), this.options.caption) {
const t = document.createElement("p");
t.className = "lightbox-caption", t.innerHTML = this.options.caption, e(this, A).appendChild(t);
}
n(this, qe, this.close.bind(this)), e(this, A).addEventListener("click", e(this, qe));
}
}, Ts = function() {
setTimeout(() => {
e(this, A).style.opacity = "1";
}, 50);
}, Is = function() {
e(this, A).style.opacity = "0";
}, As = function() {
e(this, A).removeEventListener("click", e(this, qe)), e(this, A).remove(), n(this, A, null);
}, Ss = function() {
const t = window.innerWidth >= 960 ? this.options.offset : this.options.mobileOffset;
window.innerWidth / window.innerHeight >= e(this, T).width / e(this, T).height ? (n(this, It, window.innerHeight - t), n(this, At, e(this, It) * e(this, T).width / e(this, T).height)) : (n(this, At, window.innerWidth - t), n(this, It, e(this, At) * e(this, T).height / e(this, T).width));
}, ks = function() {
n(this, Pe, []);
for (let t = this.el; t && t !== document; t = t.parentNode) {
const s = window.getComputedStyle(t);
(s.overflow === "hidden" || s.overflowX === "hidden" || s.overflowY === "hidden") && (e(this, Pe).push(t), t !== document.body && t.style.setProperty("overflow", "visible", "important"), document.body.style.overflowX = "hidden");
}
}, Rs = function() {
e(this, Pe).forEach((t) => t.style.overflow = ""), document.body.style.overflowX = "";
}, Os = function(t) {
!t.propertyName.includes("width") && !t.propertyName.includes("height") || (e(this, St) ? (l(this, b, qs).call(this), n(this, St, !1), n(this, et, !1), d(this.el, "lightbox.closed")) : e(this, st) && (n(this, st, !1), d(this.el, "lightbox.opened")));
}, Ms = function(t) {
t.key === "Escape" && (e(this, st) || e(this, et)) && this.close();
}, $s = function() {
(e(this, et) || e(this, st)) && this.close();
}, hi = new WeakMap(), qs = function() {
this.el.classList.remove("active"), l(this, b, As).call(this), l(this, b, Rs).call(this), e(this, _e) && this.el.classList.add("responsive-media"), e(this, it).removeAttribute("style"), this.el.style.position = "", this.el.style.left = "", this.el.style.top = "", this.el.style.width = "", this.el.style.height = "", this.el.style.transform = "";
}, Ps = function() {
if (e(this, st) || e(this, et)) {
this.close();
return;
}
this.open();
}, f(Ds, "getDefaultOptions", () => tn);
Y({
class: Ds,
name: "Lightbox",
dataDetection: !0,
autoInit: {
enabled: !0,
selector: ".lightbox"
}
});
const en = {
overlay: !0,
bodyScrolling: !1,
animationDuration: 400
};
var ze, ot, yt, gt, wt, Di, Hs, Bs;
class zs extends G {
constructor(t, s) {
super();
a(this, wt);
f(this, "options");
f(this, "overlayElement");
a(this, ze);
a(this, ot, !1);
a(this, yt, !1);
a(this, gt);
try {
this.preventDbInstance(t), x.push({ type: "Modal", instance: this }), this.el = document.querySelector(t), this.options = V("Modal", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Modal init error", r);
}
}
setup() {
d(this.el, "modal.setup"), n(this, ze, Qe(this.el.id)), n(this, ot, !!this.el.classList.contains("active")), n(this, yt, !1), this.setupListeners(), this.options.overlay && (this.overlayElement = Gi(
e(this, ot),
this.options.overlay,
this.el.id,
this.options.animationDuration
)), this.el.style.transitionDuration = this.options.animationDuration + "ms", this.el.style.animationDuration = this.options.animationDuration + "ms";
}
setupListeners() {
n(this, gt, l(this, wt, Bs).bind(this)), e(this, ze).forEach((t) => t.addEventListener("click", e(this, gt)));
}
removeListeners() {
e(this, ze).forEach((t) => t.removeEventListener("click", e(this, gt))), n(this, gt, void 0);
}
/** Open Modal */
open() {
e(this, ot) || (d(this.el, "modal.open"), n(this, ot, !0), n(this, yt, !0), l(this, wt, Hs).call(this), this.el.style.display = "block", ni(
this.options.overlay,
this.overlayElement,
e(this, gt),
!0,
this.options.animationDuration
), l(this, wt, Di).call(this, !1), setTimeout(() => {
this.el.classList.add("active");
}, 50), setTimeout(() => {
n(this, yt, !1), d(this.el, "modal.opened");
}, this.options.animationDuration));
}
/** Close Modal */
close() {
e(this, ot) && (d(this.el, "modal.close"), n(this, yt, !0), this.el.classList.remove("active"), ni(
this.options.overlay,
this.overlayElement,
e(this, gt),
!1,
this.options.animationDuration
), setTimeout(() => {
this.el.style.display = "", n(this, yt, !1), n(this, ot, !1), l(this, wt, Di).call(this, !0), d(this.el, "modal.closed");
}, this.options.animationDuration));
}
}
ze = new WeakMap(), ot = new WeakMap(), yt = new WeakMap(), gt = new WeakMap(), wt = new WeakSet(), Di = function(t) {
this.options.bodyScrolling || (document.body.style.overflow = t ? "" : "hidden");
}, Hs = function() {
const t = document.querySelectorAll(".modal.active").length + 1;
this.options.overlay && (this.overlayElement.style.zIndex = String(800 + t * 10 - 2)), this.el.style.zIndex = String(800 + t * 10);
}, Bs = function(t) {
t.preventDefault(), !e(this, yt) && (e(this, ot) ? this.close() : this.open());
}, f(zs, "getDefaultOptions", () => en);
Y({
class: zs,
name: "Modal",
dataDetection: !0,
autoInit: {
enabled: !0,
selector: ".modal"
}
});
const sn = {
animationDuration: 300,
animationType: "none",
disableActiveBar: !1,
caroulix: {
animationDuration: 300,
backToOpposite: !1,
enableTouch: !1,
autoplay: {
enabled: !1
}
}
};
var H, D, B, S, He, Be, ce, de, pe, kt, ue, nt, fe, Ne, me, N, g, Ws, Vs, Xs, Ys, Fs, Ci, Ti, Us, js, Gs, Zs, _s;
class Ns extends G {
constructor(t, s) {
super();
a(this, g);
f(this, "options");
a(this, H);
a(this, D);
a(this, B);
a(this, S, 0);
a(this, He);
a(this, Be);
a(this, ce);
a(this, de);
a(this, pe);
a(this, kt);
a(this, ue);
a(this, nt);
a(this, fe);
a(this, Ne, !1);
a(this, me);
a(this, N, !1);
try {
this.preventDbInstance(t), x.push({ type: "Tab", instance: this }), this.el = document.querySelector(t), this.options = V("Tab", s, this.el), this.setup();
} catch (r) {
console.error("[Axentix] Tab init error", r);
}
}
setup() {
d(this.el, "tab.setup"), ["none", "slide"].includes(this.options.animationType) || (this.options.animationType = "none"), n(this, N, !1), n(this, H, this.el.querySelector(".tab-arrow")), n(this, D, this.el.querySelectorAll(".tab-menu .tab-link")), n(this, B, this.el.querySelector(".tab-menu")), n(this, S, 0), n(this, nt, l(this, g, Xs).call(this)), e(this, H) && (l(this, g, Ti).call(this), n(this, He, this.el.querySelector(".tab-arrow .tab-prev")), n(this, Be, this.el.querySelector(".tab-arrow .tab-next"))), this.setupListeners(), e(this, B).style.transitionDuration = this.options.animationDuration + "ms", this.options.animationType === "slide" ? l(this, g, Fs).call(this) : this.updateActiveElement();
}
setupListeners() {
e(this, D).forEach((t) => {
t.listenerRef = l(this, g, Gs).bind(this, t), t.addEventListener("click", t.listenerRef);
}), n(this, ue, l(this, g, Ws).bind(this)), window.addEventListener("resize", e(this, ue)), e(this, H) && (n(this, pe, l(this, g, Ti).bind(this)), window.addEventListener("resize", e(this, pe)), n(this, ce, l(this, g, Us).bind(this)), n(this, de, l(this, g, js).bind(this)), e(this, He).addEventListener("click", e(this, ce)), e(this, Be).addEventListener("click", e(this, de)));
}
removeListeners() {
e(this, D).forEach((t) => {
t.removeEventListener("click", t.listenerRef), t.listenerRef = void 0;
}), window.removeEventListener("resize", e(this, ue)), n(this, ue, void 0), e(this, H) && (window.removeEventListener("resize", e(this, pe)), n(this, pe, void 0), e(this, He).removeEventListener("click", e(this, ce)), e(this, Be).removeEventListener("click", e(this, de)), n(this, ce, void 0), n(this, de, void 0)), e(this, kt) && (this.el.removeEventListener("ax.caroulix.slide", e(this, kt)), n(this, kt, void 0));
}
/** Select tab */
select(t) {
if (e(this, N)) return;
n(this, N, !0);
const s = this.el.querySelector('.tab-menu a[href="#' + t + '"]');
if (n(this, S, Array.from(e(this, D)).findIndex((r) => r.children[0] === s)), d(s, "tab.select", { currentIndex: e(this, S) }), l(this, g, Ci).call(this, s.parentElement), e(this, Ne)) {
e(this, nt).forEach((h) => h.id === t ? h.classList.add("active") : "");
const r = Ee("Caroulix");
n(this, me, new r(
"#" + e(this, fe).id,
this.options.caroulix,
this.el,
!0
)), n(this, kt, l(this, g, Vs).bind(this)), this.el.addEventListener("ax.caroulix.slide", e(this, kt)), n(this, Ne, !1), n(this, N, !1);
return;
}
if (this.options.animationType === "slide") {
const r = e(this, nt).findIndex((h) => h.id === t);
e(this, me).goTo(r), setTimeout(() => {
n(this, N, !1);
}, this.options.animationDuration);
} else
l(this, g, Ys).call(this), e(this, nt).forEach((r) => {
r.id === t && (r.style.display = "block");
}), n(this, N, !1);
}
/** Detect active element & update component */
updateActiveElement() {
let t;
e(this, D).forEach((r, h) => {
r.classList.contains("active") && (t = r, n(this, S, h));
}), t || (t = e(this, D).item(0), n(this, S, 0));
const s = t.children[0].getAttribute("href");
this.select(s.split("#")[1]);
}
/** Go to previous tab */
prev(t = 1) {
if (e(this, N)) return;
const s = l(this, g, Zs).call(this, t);
n(this, S, s), d(this.el, "tab.prev", { step: t });
const r = e(this, D)[s].children[0].getAttribute("href");
this.select(r.split("#")[1]);
}
/** Go to next tab */
next(t = 1) {
if (e(this, N)) return;
const s = l(this, g, _s).call(this, t);
n(this, S, s), d(this.el, "tab.next", { step: t });
const r = e(this, D)[s].children[0].getAttribute("href");
this.select(r.split("#")[1]);
}
}
H = new WeakMap(), D = new WeakMap(), B = new WeakMap(), S = new WeakMap(), He = new WeakMap(), Be = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), pe = new WeakMap(), kt = new WeakMap(), ue = new WeakMap(), nt = new WeakMap(), fe = new WeakMap(), Ne = new WeakMap(), me = new WeakMap(), N = new WeakMap(), g = new WeakSet(), Ws = function() {
this.updateActiveElement();
for (let t = 100; t < 500; t += 100)
setTimeout(() => {
this.updateActiveElement();
}, t);
}, Vs = function() {
e(this, S) !== e(this, me).activeIndex && (n(this, S, e(this, me).activeIndex), l(this, g, Ci).call(this, e(this, D)[e(this, S)]));
}, Xs = function() {
return Array.from(e(this, D)).map((t) => {
const s = t.children[0].getAttribute("href");
return this.el.querySelector(s);
});
}, Ys = function() {
e(this, nt).forEach((t) => t.style.display = "none");
}, Fs = function() {
e(this, nt).forEach((s) => s.classList.add("caroulix-item")), n(this, fe, $i(e(this, nt))), e(this, fe).classList.add("caroulix");
const t = Math.random().toString().split(".")[1];
e(this, fe).id = "tab-caroulix-" + t, n(this, Ne, !0), this.options.animationDuration !== 300 && (this.options.caroulix.animationDuration = this.options.animationDuration), this.updateActiveElement();
}, Ci = function(t) {
if (e(this, D).forEach((s) => s.classList.remove("active")), !this.options.disableActiveBar) {
const s = t.getBoundingClientRect(), r = s.left, h = e(this, B).getBoundingClientRect().left, c = r - h + e(this, B).scrollLeft, p = s.width, y = e(this, B).clientWidth - c - p;
e(this, B).style.setProperty(ht("tab-bar-left-offset"), Math.floor(c) + "px"), e(this, B).style.setProperty(ht("tab-bar-right-offset"), Math.ceil(y) + "px");
}
t.classList.add("active");
}, Ti = function() {
const t = Array.from(e(this, D)).reduce((r, h) => (r += h.clientWidth, r), 0), s = e(this, H).clientWidth;
t > s ? e(this, H).classList.contains("tab-arrow-show") || e(this, H).classList.add("tab-arrow-show") : e(this, H).classList.contains("tab-arrow-show") && e(this, H).classList.remove("tab-arrow-show");
}, Us = function(t) {
t.preventDefault(), e(this, B).scrollLeft -= 40;
}, js = function(t) {
t.preventDefault(), e(this, B).scrollLeft += 40;
}, Gs = function(t, s) {
if (s.preventDefault(), e(this, N) || t.classList.contains("active")) return;
const r = t.children[0].getAttribute("href");
this.select(r.split("#")[1]);
}, Zs = function(t) {
let s = 0, r = e(this, S);
for (let h = 0; h < t; h++)
r > 0 ? (s = r - 1, r--) : (r = e(this, D).length - 1, s = r);
return s;
}, _s = function(t) {
let s = 0, r = e(this, S);
for (let h = 0; h < t; h++)
r < e(this, D).length - 1 ? (s = r + 1, r++) : (r = 0, s = r);
return s;
},