@luisgb2212/table-customizable
Version:
Vue3 Datatable - fully customizable & easy to use datatable library
738 lines • 139 kB
JavaScript
import { defineComponent as Ce, onBeforeUnmount as Xe, onMounted as Te, openBlock as I, createElementBlock as N, createElementVNode as P, withModifiers as _e, normalizeClass as j, toDisplayString as Z, Fragment as le, createCommentVNode as G, ref as ae, watch as fe, createVNode as de, renderList as me, normalizeStyle as je, createTextVNode as qe, withDirectives as he, vModelText as De, vModelSelect as Le, vShow as Qe, nextTick as Ae, createStaticVNode as et, useSlots as tt, computed as be, vModelCheckbox as nt, unref as it, renderSlot as ot } from "vue";
var ze = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function st(V) {
return V && V.__esModule && Object.prototype.hasOwnProperty.call(V, "default") ? V.default : V;
}
var Ve = { exports: {} };
/*!
*
* litepicker.umd.js
* Litepicker v2.0.12 (https://github.com/wakirin/Litepicker)
* Package: litepicker (https://www.npmjs.com/package/litepicker)
* License: MIT (https://github.com/wakirin/Litepicker/blob/master/LICENCE.md)
* Copyright 2019-2021 Rinat G.
*
* Hash: 504eef9c08cb42543660
*
*/
(function(V, Q) {
(function(k, L) {
V.exports = L();
})(window, function() {
return function(k) {
var L = {};
function r(p) {
if (L[p])
return L[p].exports;
var i = L[p] = { i: p, l: !1, exports: {} };
return k[p].call(i.exports, i, i.exports, r), i.l = !0, i.exports;
}
return r.m = k, r.c = L, r.d = function(p, i, t) {
r.o(p, i) || Object.defineProperty(p, i, { enumerable: !0, get: t });
}, r.r = function(p) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(p, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(p, "__esModule", { value: !0 });
}, r.t = function(p, i) {
if (1 & i && (p = r(p)), 8 & i || 4 & i && typeof p == "object" && p && p.__esModule)
return p;
var t = /* @__PURE__ */ Object.create(null);
if (r.r(t), Object.defineProperty(t, "default", { enumerable: !0, value: p }), 2 & i && typeof p != "string")
for (var u in p)
r.d(t, u, function(e) {
return p[e];
}.bind(null, u));
return t;
}, r.n = function(p) {
var i = p && p.__esModule ? function() {
return p.default;
} : function() {
return p;
};
return r.d(i, "a", i), i;
}, r.o = function(p, i) {
return Object.prototype.hasOwnProperty.call(p, i);
}, r.p = "", r(r.s = 4);
}([function(k, L, r) {
Object.defineProperty(L, "__esModule", { value: !0 });
var p = function() {
function i(t, u, e) {
t === void 0 && (t = null), u === void 0 && (u = null), e === void 0 && (e = "en-US"), this.dateInstance = typeof u == "object" && u !== null ? u.parse(t instanceof i ? t.clone().toJSDate() : t) : typeof u == "string" ? i.parseDateTime(t, u, e) : t ? i.parseDateTime(t) : i.parseDateTime(new Date()), this.lang = e;
}
return i.parseDateTime = function(t, u, e) {
if (u === void 0 && (u = "YYYY-MM-DD"), e === void 0 && (e = "en-US"), !t)
return new Date(NaN);
if (t instanceof Date)
return new Date(t);
if (t instanceof i)
return t.clone().toJSDate();
if (/^-?\d{10,}$/.test(t))
return i.getDateZeroTime(new Date(Number(t)));
if (typeof t == "string") {
for (var m = [], h = null; (h = i.regex.exec(u)) != null; )
h[1] !== "\\" && m.push(h);
if (m.length) {
var x = { year: null, month: null, shortMonth: null, longMonth: null, day: null, value: "" };
m[0].index > 0 && (x.value += ".*?");
for (var d = 0, o = Object.entries(m); d < o.length; d++) {
var n = o[d], f = n[0], b = n[1], a = Number(f), s = i.formatPatterns(b[0], e), c = s.group, g = s.pattern;
x[c] = a + 1, x.value += g, x.value += ".*?";
}
var y = new RegExp("^" + x.value + "$");
if (y.test(t)) {
var v = y.exec(t), w = Number(v[x.year]), M = null;
x.month ? M = Number(v[x.month]) - 1 : x.shortMonth ? M = i.shortMonths(e).indexOf(v[x.shortMonth]) : x.longMonth && (M = i.longMonths(e).indexOf(v[x.longMonth]));
var E = Number(v[x.day]) || 1;
return new Date(w, M, E, 0, 0, 0, 0);
}
}
}
return i.getDateZeroTime(new Date(t));
}, i.convertArray = function(t, u) {
return t.map(function(e) {
return e instanceof Array ? e.map(function(m) {
return new i(m, u);
}) : new i(e, u);
});
}, i.getDateZeroTime = function(t) {
return new Date(t.getFullYear(), t.getMonth(), t.getDate(), 0, 0, 0, 0);
}, i.shortMonths = function(t) {
return i.MONTH_JS.map(function(u) {
return new Date(2019, u).toLocaleString(t, { month: "short" });
});
}, i.longMonths = function(t) {
return i.MONTH_JS.map(function(u) {
return new Date(2019, u).toLocaleString(t, { month: "long" });
});
}, i.formatPatterns = function(t, u) {
switch (t) {
case "YY":
case "YYYY":
return { group: "year", pattern: "(\\d{" + t.length + "})" };
case "M":
return { group: "month", pattern: "(\\d{1,2})" };
case "MM":
return { group: "month", pattern: "(\\d{2})" };
case "MMM":
return { group: "shortMonth", pattern: "(" + i.shortMonths(u).join("|") + ")" };
case "MMMM":
return { group: "longMonth", pattern: "(" + i.longMonths(u).join("|") + ")" };
case "D":
return { group: "day", pattern: "(\\d{1,2})" };
case "DD":
return { group: "day", pattern: "(\\d{2})" };
}
}, i.prototype.toJSDate = function() {
return this.dateInstance;
}, i.prototype.toLocaleString = function(t, u) {
return this.dateInstance.toLocaleString(t, u);
}, i.prototype.toDateString = function() {
return this.dateInstance.toDateString();
}, i.prototype.getSeconds = function() {
return this.dateInstance.getSeconds();
}, i.prototype.getDay = function() {
return this.dateInstance.getDay();
}, i.prototype.getTime = function() {
return this.dateInstance.getTime();
}, i.prototype.getDate = function() {
return this.dateInstance.getDate();
}, i.prototype.getMonth = function() {
return this.dateInstance.getMonth();
}, i.prototype.getFullYear = function() {
return this.dateInstance.getFullYear();
}, i.prototype.setMonth = function(t) {
return this.dateInstance.setMonth(t);
}, i.prototype.setHours = function(t, u, e, m) {
t === void 0 && (t = 0), u === void 0 && (u = 0), e === void 0 && (e = 0), m === void 0 && (m = 0), this.dateInstance.setHours(t, u, e, m);
}, i.prototype.setSeconds = function(t) {
return this.dateInstance.setSeconds(t);
}, i.prototype.setDate = function(t) {
return this.dateInstance.setDate(t);
}, i.prototype.setFullYear = function(t) {
return this.dateInstance.setFullYear(t);
}, i.prototype.getWeek = function(t) {
var u = new Date(this.timestamp()), e = (this.getDay() + (7 - t)) % 7;
u.setDate(u.getDate() - e);
var m = u.getTime();
return u.setMonth(0, 1), u.getDay() !== t && u.setMonth(0, 1 + (4 - u.getDay() + 7) % 7), 1 + Math.ceil((m - u.getTime()) / 6048e5);
}, i.prototype.clone = function() {
return new i(this.toJSDate());
}, i.prototype.isBetween = function(t, u, e) {
switch (e === void 0 && (e = "()"), e) {
default:
case "()":
return this.timestamp() > t.getTime() && this.timestamp() < u.getTime();
case "[)":
return this.timestamp() >= t.getTime() && this.timestamp() < u.getTime();
case "(]":
return this.timestamp() > t.getTime() && this.timestamp() <= u.getTime();
case "[]":
return this.timestamp() >= t.getTime() && this.timestamp() <= u.getTime();
}
}, i.prototype.isBefore = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
case "second":
case "seconds":
return t.getTime() > this.getTime();
case "day":
case "days":
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() > new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime();
case "month":
case "months":
return new Date(t.getFullYear(), t.getMonth(), 1).getTime() > new Date(this.getFullYear(), this.getMonth(), 1).getTime();
case "year":
case "years":
return t.getFullYear() > this.getFullYear();
}
throw new Error("isBefore: Invalid unit!");
}, i.prototype.isSameOrBefore = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
case "second":
case "seconds":
return t.getTime() >= this.getTime();
case "day":
case "days":
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() >= new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime();
case "month":
case "months":
return new Date(t.getFullYear(), t.getMonth(), 1).getTime() >= new Date(this.getFullYear(), this.getMonth(), 1).getTime();
}
throw new Error("isSameOrBefore: Invalid unit!");
}, i.prototype.isAfter = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
case "second":
case "seconds":
return this.getTime() > t.getTime();
case "day":
case "days":
return new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime() > new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
case "month":
case "months":
return new Date(this.getFullYear(), this.getMonth(), 1).getTime() > new Date(t.getFullYear(), t.getMonth(), 1).getTime();
case "year":
case "years":
return this.getFullYear() > t.getFullYear();
}
throw new Error("isAfter: Invalid unit!");
}, i.prototype.isSameOrAfter = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
case "second":
case "seconds":
return this.getTime() >= t.getTime();
case "day":
case "days":
return new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime() >= new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
case "month":
case "months":
return new Date(this.getFullYear(), this.getMonth(), 1).getTime() >= new Date(t.getFullYear(), t.getMonth(), 1).getTime();
}
throw new Error("isSameOrAfter: Invalid unit!");
}, i.prototype.isSame = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
case "second":
case "seconds":
return this.getTime() === t.getTime();
case "day":
case "days":
return new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime() === new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
case "month":
case "months":
return new Date(this.getFullYear(), this.getMonth(), 1).getTime() === new Date(t.getFullYear(), t.getMonth(), 1).getTime();
}
throw new Error("isSame: Invalid unit!");
}, i.prototype.add = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
case "second":
case "seconds":
this.setSeconds(this.getSeconds() + t);
break;
case "day":
case "days":
this.setDate(this.getDate() + t);
break;
case "month":
case "months":
this.setMonth(this.getMonth() + t);
}
return this;
}, i.prototype.subtract = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
case "second":
case "seconds":
this.setSeconds(this.getSeconds() - t);
break;
case "day":
case "days":
this.setDate(this.getDate() - t);
break;
case "month":
case "months":
this.setMonth(this.getMonth() - t);
}
return this;
}, i.prototype.diff = function(t, u) {
switch (u === void 0 && (u = "seconds"), u) {
default:
case "second":
case "seconds":
return this.getTime() - t.getTime();
case "day":
case "days":
return Math.round((this.timestamp() - t.getTime()) / 864e5);
case "month":
case "months":
}
}, i.prototype.format = function(t, u) {
if (u === void 0 && (u = "en-US"), typeof t == "object")
return t.output(this.clone().toJSDate());
for (var e = "", m = [], h = null; (h = i.regex.exec(t)) != null; )
h[1] !== "\\" && m.push(h);
if (m.length) {
m[0].index > 0 && (e += t.substring(0, m[0].index));
for (var x = 0, d = Object.entries(m); x < d.length; x++) {
var o = d[x], n = o[0], f = o[1], b = Number(n);
e += this.formatTokens(f[0], u), m[b + 1] && (e += t.substring(f.index + f[0].length, m[b + 1].index)), b === m.length - 1 && (e += t.substring(f.index + f[0].length));
}
}
return e.replace(/\\/g, "");
}, i.prototype.timestamp = function() {
return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0, 0).getTime();
}, i.prototype.formatTokens = function(t, u) {
switch (t) {
case "YY":
return String(this.getFullYear()).slice(-2);
case "YYYY":
return String(this.getFullYear());
case "M":
return String(this.getMonth() + 1);
case "MM":
return ("0" + (this.getMonth() + 1)).slice(-2);
case "MMM":
return i.shortMonths(u)[this.getMonth()];
case "MMMM":
return i.longMonths(u)[this.getMonth()];
case "D":
return String(this.getDate());
case "DD":
return ("0" + this.getDate()).slice(-2);
default:
return "";
}
}, i.regex = /(\\)?(Y{2,4}|M{1,4}|D{1,2}|d{1,4})/g, i.MONTH_JS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], i;
}();
L.DateTime = p;
}, function(k, L, r) {
var p, i = this && this.__extends || (p = function(d, o) {
return (p = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, f) {
n.__proto__ = f;
} || function(n, f) {
for (var b in f)
f.hasOwnProperty(b) && (n[b] = f[b]);
})(d, o);
}, function(d, o) {
function n() {
this.constructor = d;
}
p(d, o), d.prototype = o === null ? Object.create(o) : (n.prototype = o.prototype, new n());
}), t = this && this.__spreadArrays || function() {
for (var d = 0, o = 0, n = arguments.length; o < n; o++)
d += arguments[o].length;
var f = Array(d), b = 0;
for (o = 0; o < n; o++)
for (var a = arguments[o], s = 0, c = a.length; s < c; s++, b++)
f[b] = a[s];
return f;
};
Object.defineProperty(L, "__esModule", { value: !0 });
var u = r(5), e = r(0), m = r(3), h = r(2), x = function(d) {
function o(n) {
var f = d.call(this, n) || this;
return f.preventClick = !1, f.bindEvents(), f;
}
return i(o, d), o.prototype.scrollToDate = function(n) {
if (this.options.scrollToDate) {
var f = this.options.startDate instanceof e.DateTime ? this.options.startDate.clone() : null, b = this.options.endDate instanceof e.DateTime ? this.options.endDate.clone() : null;
!this.options.startDate || n && n !== this.options.element ? n && this.options.endDate && n === this.options.elementEnd && (b.setDate(1), this.options.numberOfMonths > 1 && b.isAfter(f) && b.setMonth(b.getMonth() - (this.options.numberOfMonths - 1)), this.calendars[0] = b.clone()) : (f.setDate(1), this.calendars[0] = f.clone());
}
}, o.prototype.bindEvents = function() {
document.addEventListener("click", this.onClick.bind(this), !0), this.ui = document.createElement("div"), this.ui.className = m.litepicker, this.ui.style.display = "none", this.ui.addEventListener("mouseenter", this.onMouseEnter.bind(this), !0), this.ui.addEventListener("mouseleave", this.onMouseLeave.bind(this), !1), this.options.autoRefresh ? (this.options.element instanceof HTMLElement && this.options.element.addEventListener("keyup", this.onInput.bind(this), !0), this.options.elementEnd instanceof HTMLElement && this.options.elementEnd.addEventListener("keyup", this.onInput.bind(this), !0)) : (this.options.element instanceof HTMLElement && this.options.element.addEventListener("change", this.onInput.bind(this), !0), this.options.elementEnd instanceof HTMLElement && this.options.elementEnd.addEventListener("change", this.onInput.bind(this), !0)), this.options.parentEl ? this.options.parentEl instanceof HTMLElement ? this.options.parentEl.appendChild(this.ui) : document.querySelector(this.options.parentEl).appendChild(this.ui) : this.options.inlineMode ? this.options.element instanceof HTMLInputElement ? this.options.element.parentNode.appendChild(this.ui) : this.options.element.appendChild(this.ui) : document.body.appendChild(this.ui), this.updateInput(), this.init(), typeof this.options.setup == "function" && this.options.setup.call(this, this), this.render(), this.options.inlineMode && this.show();
}, o.prototype.updateInput = function() {
if (this.options.element instanceof HTMLInputElement) {
var n = this.options.startDate, f = this.options.endDate;
if (this.options.singleMode && n)
this.options.element.value = n.format(this.options.format, this.options.lang);
else if (!this.options.singleMode && n && f) {
var b = n.format(this.options.format, this.options.lang), a = f.format(this.options.format, this.options.lang);
this.options.elementEnd instanceof HTMLInputElement ? (this.options.element.value = b, this.options.elementEnd.value = a) : this.options.element.value = "" + b + this.options.delimiter + a;
}
n || f || (this.options.element.value = "", this.options.elementEnd instanceof HTMLInputElement && (this.options.elementEnd.value = ""));
}
}, o.prototype.isSamePicker = function(n) {
return n.closest("." + m.litepicker) === this.ui;
}, o.prototype.shouldShown = function(n) {
return !n.disabled && (n === this.options.element || this.options.elementEnd && n === this.options.elementEnd);
}, o.prototype.shouldResetDatePicked = function() {
return this.options.singleMode || this.datePicked.length === 2;
}, o.prototype.shouldSwapDatePicked = function() {
return this.datePicked.length === 2 && this.datePicked[0].getTime() > this.datePicked[1].getTime();
}, o.prototype.shouldCheckLockDays = function() {
return this.options.disallowLockDaysInRange && this.datePicked.length === 2;
}, o.prototype.onClick = function(n) {
var f = n.target;
if (n.target.shadowRoot && (f = n.composedPath()[0]), f && this.ui)
if (this.shouldShown(f))
this.show(f);
else if (f.closest("." + m.litepicker) || !this.isShowning()) {
if (this.isSamePicker(f))
if (this.emit("before:click", f), this.preventClick)
this.preventClick = !1;
else {
if (f.classList.contains(m.dayItem)) {
if (n.preventDefault(), f.classList.contains(m.isLocked))
return;
if (this.shouldResetDatePicked() && (this.datePicked.length = 0), this.datePicked[this.datePicked.length] = new e.DateTime(f.dataset.time), this.shouldSwapDatePicked()) {
var b = this.datePicked[1].clone();
this.datePicked[1] = this.datePicked[0].clone(), this.datePicked[0] = b.clone();
}
return this.shouldCheckLockDays() && h.rangeIsLocked(this.datePicked, this.options) && (this.emit("error:range", this.datePicked), this.datePicked.length = 0), this.render(), this.emit.apply(this, t(["preselect"], t(this.datePicked).map(function(g) {
return g.clone();
}))), void (this.options.autoApply && (this.options.singleMode && this.datePicked.length ? (this.setDate(this.datePicked[0]), this.hide()) : this.options.singleMode || this.datePicked.length !== 2 || (this.setDateRange(this.datePicked[0], this.datePicked[1]), this.hide())));
}
if (f.classList.contains(m.buttonPreviousMonth)) {
n.preventDefault();
var a = 0, s = this.options.switchingMonths || this.options.numberOfMonths;
if (this.options.splitView) {
var c = f.closest("." + m.monthItem);
a = h.findNestedMonthItem(c), s = 1;
}
return this.calendars[a].setMonth(this.calendars[a].getMonth() - s), this.gotoDate(this.calendars[a], a), void this.emit("change:month", this.calendars[a], a);
}
if (f.classList.contains(m.buttonNextMonth))
return n.preventDefault(), a = 0, s = this.options.switchingMonths || this.options.numberOfMonths, this.options.splitView && (c = f.closest("." + m.monthItem), a = h.findNestedMonthItem(c), s = 1), this.calendars[a].setMonth(this.calendars[a].getMonth() + s), this.gotoDate(this.calendars[a], a), void this.emit("change:month", this.calendars[a], a);
f.classList.contains(m.buttonCancel) && (n.preventDefault(), this.hide(), this.emit("button:cancel")), f.classList.contains(m.buttonApply) && (n.preventDefault(), this.options.singleMode && this.datePicked.length ? this.setDate(this.datePicked[0]) : this.options.singleMode || this.datePicked.length !== 2 || this.setDateRange(this.datePicked[0], this.datePicked[1]), this.hide(), this.emit("button:apply", this.options.startDate, this.options.endDate));
}
} else
this.hide();
}, o.prototype.showTooltip = function(n, f) {
var b = this.ui.querySelector("." + m.containerTooltip);
b.style.visibility = "visible", b.innerHTML = f;
var a = this.ui.getBoundingClientRect(), s = b.getBoundingClientRect(), c = n.getBoundingClientRect(), g = c.top, y = c.left;
if (this.options.inlineMode && this.options.parentEl) {
var v = this.ui.parentNode.getBoundingClientRect();
g -= v.top, y -= v.left;
} else
g -= a.top, y -= a.left;
g -= s.height, y -= s.width / 2, y += c.width / 2, b.style.top = g + "px", b.style.left = y + "px", this.emit("tooltip", b, n);
}, o.prototype.hideTooltip = function() {
this.ui.querySelector("." + m.containerTooltip).style.visibility = "hidden";
}, o.prototype.shouldAllowMouseEnter = function(n) {
return !this.options.singleMode && !n.classList.contains(m.isLocked);
}, o.prototype.shouldAllowRepick = function() {
return this.options.elementEnd && this.options.allowRepick && this.options.startDate && this.options.endDate;
}, o.prototype.isDayItem = function(n) {
return n.classList.contains(m.dayItem);
}, o.prototype.onMouseEnter = function(n) {
var f = this, b = n.target;
if (this.isDayItem(b) && this.shouldAllowMouseEnter(b)) {
if (this.shouldAllowRepick() && (this.triggerElement === this.options.element ? this.datePicked[0] = this.options.endDate.clone() : this.triggerElement === this.options.elementEnd && (this.datePicked[0] = this.options.startDate.clone())), this.datePicked.length !== 1)
return;
var a = this.ui.querySelector("." + m.dayItem + '[data-time="' + this.datePicked[0].getTime() + '"]'), s = this.datePicked[0].clone(), c = new e.DateTime(b.dataset.time), g = !1;
if (s.getTime() > c.getTime()) {
var y = s.clone();
s = c.clone(), c = y.clone(), g = !0;
}
if (Array.prototype.slice.call(this.ui.querySelectorAll("." + m.dayItem)).forEach(function(se) {
var Y = new e.DateTime(se.dataset.time), C = f.renderDay(Y);
Y.isBetween(s, c) && C.classList.add(m.isInRange), se.className = C.className;
}), b.classList.add(m.isEndDate), g ? (a && a.classList.add(m.isFlipped), b.classList.add(m.isFlipped)) : (a && a.classList.remove(m.isFlipped), b.classList.remove(m.isFlipped)), this.options.showTooltip) {
var v = c.diff(s, "day") + 1;
if (typeof this.options.tooltipNumber == "function" && (v = this.options.tooltipNumber.call(this, v)), v > 0) {
var w = this.pluralSelector(v), M = v + " " + (this.options.tooltipText[w] ? this.options.tooltipText[w] : "[" + w + "]");
this.showTooltip(b, M);
var E = window.navigator.userAgent, F = /(iphone|ipad)/i.test(E), X = /OS 1([0-2])/i.test(E);
F && X && b.dispatchEvent(new Event("click"));
} else
this.hideTooltip();
}
}
}, o.prototype.onMouseLeave = function(n) {
n.target, this.options.allowRepick && (!this.options.allowRepick || this.options.startDate || this.options.endDate) && (this.datePicked.length = 0, this.render());
}, o.prototype.onInput = function(n) {
var f = this.parseInput(), b = f[0], a = f[1], s = this.options.format;
if (this.options.elementEnd ? b instanceof e.DateTime && a instanceof e.DateTime && b.format(s) === this.options.element.value && a.format(s) === this.options.elementEnd.value : this.options.singleMode ? b instanceof e.DateTime && b.format(s) === this.options.element.value : b instanceof e.DateTime && a instanceof e.DateTime && "" + b.format(s) + this.options.delimiter + a.format(s) === this.options.element.value) {
if (a && b.getTime() > a.getTime()) {
var c = b.clone();
b = a.clone(), a = c.clone();
}
this.options.startDate = new e.DateTime(b, this.options.format, this.options.lang), a && (this.options.endDate = new e.DateTime(a, this.options.format, this.options.lang)), this.updateInput(), this.render();
var g = b.clone(), y = 0;
(this.options.elementEnd ? b.format(s) === n.target.value : n.target.value.startsWith(b.format(s))) || (g = a.clone(), y = this.options.numberOfMonths - 1), this.emit("selected", this.getStartDate(), this.getEndDate()), this.gotoDate(g, y);
}
}, o;
}(u.Calendar);
L.Litepicker = x;
}, function(k, L, r) {
Object.defineProperty(L, "__esModule", { value: !0 }), L.findNestedMonthItem = function(p) {
for (var i = p.parentNode.childNodes, t = 0; t < i.length; t += 1)
if (i.item(t) === p)
return t;
return 0;
}, L.dateIsLocked = function(p, i, t) {
var u = !1;
return i.lockDays.length && (u = i.lockDays.filter(function(e) {
return e instanceof Array ? p.isBetween(e[0], e[1], i.lockDaysInclusivity) : e.isSame(p, "day");
}).length), u || typeof i.lockDaysFilter != "function" || (u = i.lockDaysFilter.call(this, p.clone(), null, t)), u;
}, L.rangeIsLocked = function(p, i) {
var t = !1;
return i.lockDays.length && (t = i.lockDays.filter(function(u) {
if (u instanceof Array) {
var e = p[0].toDateString() === u[0].toDateString() && p[1].toDateString() === u[1].toDateString();
return u[0].isBetween(p[0], p[1], i.lockDaysInclusivity) || u[1].isBetween(p[0], p[1], i.lockDaysInclusivity) || e;
}
return u.isBetween(p[0], p[1], i.lockDaysInclusivity);
}).length), t || typeof i.lockDaysFilter != "function" || (t = i.lockDaysFilter.call(this, p[0].clone(), p[1].clone(), p)), t;
};
}, function(k, L, r) {
var p = r(8);
typeof p == "string" && (p = [[k.i, p, ""]]);
var i = { insert: function(t) {
var u = document.querySelector("head"), e = window._lastElementInsertedByStyleLoader;
window.disableLitepickerStyles || (e ? e.nextSibling ? u.insertBefore(t, e.nextSibling) : u.appendChild(t) : u.insertBefore(t, u.firstChild), window._lastElementInsertedByStyleLoader = t);
}, singleton: !1 };
r(10)(p, i), p.locals && (k.exports = p.locals);
}, function(k, L, r) {
Object.defineProperty(L, "__esModule", { value: !0 });
var p = r(1);
L.Litepicker = p.Litepicker, r(11), window.Litepicker = p.Litepicker, L.default = p.Litepicker;
}, function(k, L, r) {
var p, i = this && this.__extends || (p = function(x, d) {
return (p = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(o, n) {
o.__proto__ = n;
} || function(o, n) {
for (var f in n)
n.hasOwnProperty(f) && (o[f] = n[f]);
})(x, d);
}, function(x, d) {
function o() {
this.constructor = x;
}
p(x, d), x.prototype = d === null ? Object.create(d) : (o.prototype = d.prototype, new o());
});
Object.defineProperty(L, "__esModule", { value: !0 });
var t = r(6), u = r(0), e = r(3), m = r(2), h = function(x) {
function d(o) {
return x.call(this, o) || this;
}
return i(d, x), d.prototype.render = function() {
var o = this;
this.emit("before:render", this.ui);
var n = document.createElement("div");
n.className = e.containerMain;
var f = document.createElement("div");
f.className = e.containerMonths, e["columns" + this.options.numberOfColumns] && (f.classList.remove(e.columns2, e.columns3, e.columns4), f.classList.add(e["columns" + this.options.numberOfColumns])), this.options.splitView && f.classList.add(e.splitView), this.options.showWeekNumbers && f.classList.add(e.showWeekNumbers);
for (var b = this.calendars[0].clone(), a = b.getMonth(), s = b.getMonth() + this.options.numberOfMonths, c = 0, g = a; g < s; g += 1) {
var y = b.clone();
y.setDate(1), y.setHours(0, 0, 0, 0), this.options.splitView ? y = this.calendars[c].clone() : y.setMonth(g), f.appendChild(this.renderMonth(y, c)), c += 1;
}
if (this.ui.innerHTML = "", n.appendChild(f), this.options.resetButton) {
var v = void 0;
typeof this.options.resetButton == "function" ? v = this.options.resetButton.call(this) : ((v = document.createElement("button")).type = "button", v.className = e.resetButton, v.innerHTML = this.options.buttonText.reset), v.addEventListener("click", function(w) {
w.preventDefault(), o.clearSelection();
}), n.querySelector("." + e.monthItem + ":last-child").querySelector("." + e.monthItemHeader).appendChild(v);
}
this.ui.appendChild(n), this.options.autoApply && !this.options.footerHTML || this.ui.appendChild(this.renderFooter()), this.options.showTooltip && this.ui.appendChild(this.renderTooltip()), this.ui.dataset.plugins = (this.options.plugins || []).join("|"), this.emit("render", this.ui);
}, d.prototype.renderMonth = function(o, n) {
var f = this, b = o.clone(), a = 32 - new Date(b.getFullYear(), b.getMonth(), 32).getDate(), s = document.createElement("div");
s.className = e.monthItem;
var c = document.createElement("div");
c.className = e.monthItemHeader;
var g = document.createElement("div");
if (this.options.dropdowns.months) {
var y = document.createElement("select");
y.className = e.monthItemName;
for (var v = 0; v < 12; v += 1) {
var w = document.createElement("option"), M = new u.DateTime(new Date(o.getFullYear(), v, 2, 0, 0, 0)), E = new u.DateTime(new Date(o.getFullYear(), v, 1, 0, 0, 0));
w.value = String(v), w.text = M.toLocaleString(this.options.lang, { month: "long" }), w.disabled = this.options.minDate && E.isBefore(new u.DateTime(this.options.minDate), "month") || this.options.maxDate && E.isAfter(new u.DateTime(this.options.maxDate), "month"), w.selected = E.getMonth() === o.getMonth(), y.appendChild(w);
}
y.addEventListener("change", function(ie) {
var R = ie.target, te = 0;
if (f.options.splitView) {
var ne = R.closest("." + e.monthItem);
te = m.findNestedMonthItem(ne);
}
f.calendars[te].setMonth(Number(R.value)), f.render(), f.emit("change:month", f.calendars[te], te, ie);
}), g.appendChild(y);
} else
(M = document.createElement("strong")).className = e.monthItemName, M.innerHTML = o.toLocaleString(this.options.lang, { month: "long" }), g.appendChild(M);
if (this.options.dropdowns.years) {
var F = document.createElement("select");
F.className = e.monthItemYear;
var X = this.options.dropdowns.minYear, se = this.options.dropdowns.maxYear ? this.options.dropdowns.maxYear : new Date().getFullYear();
for (o.getFullYear() > se && ((w = document.createElement("option")).value = String(o.getFullYear()), w.text = String(o.getFullYear()), w.selected = !0, w.disabled = !0, F.appendChild(w)), v = se; v >= X; v -= 1) {
var w = document.createElement("option"), Y = new u.DateTime(new Date(v, 0, 1, 0, 0, 0));
w.value = String(v), w.text = String(v), w.disabled = this.options.minDate && Y.isBefore(new u.DateTime(this.options.minDate), "year") || this.options.maxDate && Y.isAfter(new u.DateTime(this.options.maxDate), "year"), w.selected = o.getFullYear() === v, F.appendChild(w);
}
if (o.getFullYear() < X && ((w = document.createElement("option")).value = String(o.getFullYear()), w.text = String(o.getFullYear()), w.selected = !0, w.disabled = !0, F.appendChild(w)), this.options.dropdowns.years === "asc") {
var C = Array.prototype.slice.call(F.childNodes).reverse();
F.innerHTML = "", C.forEach(function(ie) {
ie.innerHTML = ie.value, F.appendChild(ie);
});
}
F.addEventListener("change", function(ie) {
var R = ie.target, te = 0;
if (f.options.splitView) {
var ne = R.closest("." + e.monthItem);
te = m.findNestedMonthItem(ne);
}
f.calendars[te].setFullYear(Number(R.value)), f.render(), f.emit("change:year", f.calendars[te], te, ie);
}), g.appendChild(F);
} else {
var T = document.createElement("span");
T.className = e.monthItemYear, T.innerHTML = String(o.getFullYear()), g.appendChild(T);
}
var $ = document.createElement("button");
$.type = "button", $.className = e.buttonPreviousMonth, $.innerHTML = this.options.buttonText.previousMonth;
var S = document.createElement("button");
S.type = "button", S.className = e.buttonNextMonth, S.innerHTML = this.options.buttonText.nextMonth, c.appendChild($), c.appendChild(g), c.appendChild(S), this.options.minDate && b.isSameOrBefore(new u.DateTime(this.options.minDate), "month") && s.classList.add(e.noPreviousMonth), this.options.maxDate && b.isSameOrAfter(new u.DateTime(this.options.maxDate), "month") && s.classList.add(e.noNextMonth);
var H = document.createElement("div");
H.className = e.monthItemWeekdaysRow, this.options.showWeekNumbers && (H.innerHTML = "<div>W</div>");
for (var B = 1; B <= 7; B += 1) {
var q = 3 + this.options.firstDay + B, W = document.createElement("div");
W.innerHTML = this.weekdayName(q), W.title = this.weekdayName(q, "long"), H.appendChild(W);
}
var U = document.createElement("div");
U.className = e.containerDays;
var ee = this.calcSkipDays(b);
this.options.showWeekNumbers && ee && U.appendChild(this.renderWeekNumber(b));
for (var z = 0; z < ee; z += 1) {
var ue = document.createElement("div");
U.appendChild(ue);
}
for (z = 1; z <= a; z += 1)
b.setDate(z), this.options.showWeekNumbers && b.getDay() === this.options.firstDay && U.appendChild(this.renderWeekNumber(b)), U.appendChild(this.renderDay(b));
return s.appendChild(c), s.appendChild(H), s.appendChild(U), this.emit("render:month", s, o), s;
}, d.prototype.renderDay = function(o) {
o.setHours();
var n = document.createElement("div");
if (n.className = e.dayItem, n.innerHTML = String(o.getDate()), n.dataset.time = String(o.getTime()), o.toDateString() === new Date().toDateString() && n.classList.add(e.isToday), this.datePicked.length)
this.datePicked[0].toDateString() === o.toDateString() && (n.classList.add(e.isStartDate), this.options.singleMode && n.classList.add(e.isEndDate)), this.datePicked.length === 2 && this.datePicked[1].toDateString() === o.toDateString() && n.classList.add(e.isEndDate), this.datePicked.length === 2 && o.isBetween(this.datePicked[0], this.datePicked[1]) && n.classList.add(e.isInRange);
else if (this.options.startDate) {
var f = this.options.startDate, b = this.options.endDate;
f.toDateString() === o.toDateString() && (n.classList.add(e.isStartDate), this.options.singleMode && n.classList.add(e.isEndDate)), b && b.toDateString() === o.toDateString() && n.classList.add(e.isEndDate), f && b && o.isBetween(f, b) && n.classList.add(e.isInRange);
}
if (this.options.minDate && o.isBefore(new u.DateTime(this.options.minDate)) && n.classList.add(e.isLocked), this.options.maxDate && o.isAfter(new u.DateTime(this.options.maxDate)) && n.classList.add(e.isLocked), this.options.minDays > 1 && this.datePicked.length === 1) {
var a = this.options.minDays - 1, s = this.datePicked[0].clone().subtract(a, "day"), c = this.datePicked[0].clone().add(a, "day");
o.isBetween(s, this.datePicked[0], "(]") && n.classList.add(e.isLocked), o.isBetween(this.datePicked[0], c, "[)") && n.classList.add(e.isLocked);
}
if (this.options.maxDays && this.datePicked.length === 1) {
var g = this.options.maxDays;
s = this.datePicked[0].clone().subtract(g, "day"), c = this.datePicked[0].clone().add(g, "day"), o.isSameOrBefore(s) && n.classList.add(e.isLocked), o.isSameOrAfter(c) && n.classList.add(e.isLocked);
}
return this.options.selectForward && this.datePicked.length === 1 && o.isBefore(this.datePicked[0]) && n.classList.add(e.isLocked), this.options.selectBackward && this.datePicked.length === 1 && o.isAfter(this.datePicked[0]) && n.classList.add(e.isLocked), m.dateIsLocked(o, this.options, this.datePicked) && n.classList.add(e.isLocked), this.options.highlightedDays.length && this.options.highlightedDays.filter(function(y) {
return y instanceof Array ? o.isBetween(y[0], y[1], "[]") : y.isSame(o, "day");
}).length && n.classList.add(e.isHighlighted), n.tabIndex = n.classList.contains("is-locked") ? -1 : 0, this.emit("render:day", n, o), n;
}, d.prototype.renderFooter = function() {
var o = document.createElement("div");
if (o.className = e.containerFooter, this.options.footerHTML ? o.innerHTML = this.options.footerHTML : o.innerHTML = `
<span class="` + e.previewDateRange + `"></span>
<button type="button" class="` + e.buttonCancel + '">' + this.options.buttonText.cancel + `</button>
<button type="button" class="` + e.buttonApply + '">' + this.options.buttonText.apply + `</button>
`, this.options.singleMode) {
if (this.datePicked.length === 1) {
var n = this.datePicked[0].format(this.options.format, this.options.lang);
o.querySelector("." + e.previewDateRange).innerHTML = n;
}
} else if (this.datePicked.length === 1 && o.querySelector("." + e.buttonApply).setAttribute("disabled", ""), this.datePicked.length === 2) {
n = this.datePicked[0].format(this.options.format, this.options.lang);
var f = this.datePicked[1].format(this.options.format, this.options.lang);
o.querySelector("." + e.previewDateRange).innerHTML = "" + n + this.options.delimiter + f;
}
return this.emit("render:footer", o), o;
}, d.prototype.renderWeekNumber = function(o) {
var n = document.createElement("div"), f = o.getWeek(this.options.firstDay);
return n.className = e.weekNumber, n.innerHTML = f === 53 && o.getMonth() === 0 ? "53 / 1" : f, n;
}, d.prototype.renderTooltip = function() {
var o = document.createElement("div");
return o.className = e.containerTooltip, o;
}, d.prototype.weekdayName = function(o, n) {
return n === void 0 && (n = "short"), new Date(1970, 0, o, 12, 0, 0, 0).toLocaleString(this.options.lang, { weekday: n });
}, d.prototype.calcSkipDays = function(o) {
var n = o.getDay() - this.options.firstDay;
return n < 0 && (n += 7), n;
}, d;
}(t.LPCore);
L.Calendar = h;
}, function(k, L, r) {
var p, i = this && this.__extends || (p = function(x, d) {
return (p = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(o, n) {
o.__proto__ = n;
} || function(o, n) {
for (var f in n)
n.hasOwnProperty(f) && (o[f] = n[f]);
})(x, d);
}, function(x, d) {
function o() {
this.constructor = x;
}
p(x, d), x.prototype = d === null ? Object.create(d) : (o.prototype = d.prototype, new o());
}), t = this && this.__assign || function() {
return (t = Object.assign || function(x) {
for (var d, o = 1, n = arguments.length; o < n; o++)
for (var f in d = arguments[o])
Object.prototype.hasOwnProperty.call(d, f) && (x[f] = d[f]);
return x;
}).apply(this, arguments);
};
Object.defineProperty(L, "__esModule", { value: !0 });
var u = r(7), e = r(0), m = r(1), h = function(x) {
function d(o) {
var n = x.call(this) || this;
n.datePicked = [], n.calendars = [], n.options = { element: null, elementEnd: null, parentEl: null, firstDay: 1, format: "YYYY-MM-DD", lang: "en-US", delimiter: " - ", numberOfMonths: 1, numberOfColumns: 1, startDate: null, endDate: null, zIndex: 9999, position: "auto", selectForward: !1, selectBackward: !1, splitView: !1, inlineMode: !1, singleMode: !0, autoApply: !0, allowRepick: !1, showWeekNumbers: !1, showTooltip: !0, scrollToDate: !0, mobileFriendly: !0, resetButton: !1, autoRefresh: !1, lockDaysFormat: "YYYY-MM-DD", lockDays: [], disallowLockDaysInRange: !1, lockDaysInclusivity: "[]", highlightedDaysFormat: "YYYY-MM-DD", highlightedDays: [], dropdowns: { minYear: 1990, maxYear: null, months: !1, years: !1 }, buttonText: { apply: "Apply", cancel: "Cancel", previousMonth: '<svg width="11" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M7.919 0l2.748 2.667L5.333 8l5.334 5.333L7.919 16 0 8z" fill-rule="nonzero"/></svg>', nextMonth: '<svg width="11" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.748 16L0 13.333 5.333 8 0 2.667 2.748 0l7.919 8z" fill-rule="nonzero"/></svg>', reset: `<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"/>
</svg>` }, tooltipText: { one: "day", other: "days" } }, n.options = t(t({}, n.options), o.element.dataset), Object.keys(n.options).forEach(function(X) {
n.options[X] !== "true" && n.options[X] !== "false" || (n.options[X] = n.options[X] === "true");
});
var f = t(t({}, n.options.dropdowns), o.dropdowns), b = t(t({}, n.options.buttonText), o.buttonText), a = t(t({}, n.options.tooltipText), o.tooltipText);
n.options = t(t({}, n.options), o), n.options.dropdowns = t({}, f), n.options.buttonText = t({}, b), n.options.tooltipText = t({}, a), n.options.elementEnd || (n.options.allowRepick = !1), n.options.lockDays.length && (n.options.lockDays = e.DateTime.convertArray(n.options.lockDays, n.options.lockDaysFormat)), n.options.highlightedDays.length && (n.options.highlightedDays = e.DateTime.convertArray(n.options.highlightedDays, n.options.highlightedDaysFormat));
var s = n.parseInput(), c = s[0], g = s[1];
n.options.startDate && (n.options.singleMode || n.options.endDate) && (c = new e.DateTime(n.options.startDate, n.options.format, n.options.lang)), c && n.options.endDate && (g = new e.DateTime(n.options.endDate, n.options.format, n.options.lang)), c instanceof e.DateTime && !isNaN(c.getTime()) && (n.options.startDate = c), n.options.startDate && g instanceof e.DateTime && !isNaN(g.getTime()) && (n.options.endDate = g), !n.options.singleMode || n.options.startDate instanceof e.DateTime || (n.options.startDate = null), n.options.singleMode || n.options.startDate instanceof e.DateTime && n.options.endDate instanceof e.DateTime || (n.options.startDate = null, n.options.endDate = null);
for (var y = 0; y < n.options.numberOfMonths; y += 1) {
var v = n.options.startDate instanceof e.DateTime ? n.options.startDate.clone() : new e.DateTime();
if (!n.options.startDate && (y === 0 || n.options.splitView)) {
var w = n.options.maxDate ? new e.DateTime(n.options.maxDate) : null, M = n.options.minDate ? new e.DateTime(n.options.minDate) : null, E = n.options.numberOfMonths - 1;
M && w && v.isAfter(w) ? (v = M.clone()).setDate(1) : !M && w && v.isAfter(w) && ((v = w.clone()).setDate(1), v.setMonth(v.getMonth() - E));
}
v.setDate(1), v.setMonth(v.getMonth() + y), n.calendars[y] = v;
}
if (n.options.showTooltip)
if (n.options.tooltipPluralSelector)
n.pluralSelector = n.options.tooltipPluralSelector;
else
try {
var F = new Intl.PluralRules(n.options.lang);
n.pluralSelector = F.select.bind(F);
} catch {
n.pluralSelector = function(se) {
return Math.abs(se) === 0 ? "one" : "other";
};
}
return n;
}
return i(d, x), d.add = function(o, n) {
m.Litepicker.prototype[o] = n;
}, d.prototype.DateTime = function(o, n) {
return o ? new e.DateTime(o, n) : new e.DateTime();
}, d.prototype.init = function() {
var o = this;
this.options.plugins && this.options.plugins.length && this.options.plugins.forEach(function(n) {
m.Litepicker.prototype.hasOwnProperty(n) ? m.Litepicker.prototype[n].init.call(o, o) : console.warn("Litepicker: plugin \xAB" + n + "\xBB not found.");
});
}, d.prototype.parseInput = function() {
var o = this.options.delimiter, n = new RegExp("" + o), f = this.options.element instanceof HTMLInputElement ? this.options.element.value.split(o) : [];
if (this.options.elementEnd) {
if (this.options.element instanceof HTMLInputElement && this.options.element.value.length && this.options.elementEnd instanceof HTMLInputElement && this.options.elementEnd.value.length)
return [new e.DateTime(this.options.element.value, this.options.format), new e.DateTime(this.options.elementEnd.value, this.options.format)];
} else if (this.options.singleMode) {
if (this.options.element instanceof HTMLInputElement && this.options.element.value.length)
return [new e.DateTime(this.options.element.value, this.options.format)];
} else if (this.options.element instanceof HTMLInputElement && n.test(this.options.element.value) && f.length && f.length % 2 == 0) {
var b = f.slice(0, f.length / 2).join(o), a = f.slice(