Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@losting/timeline

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@losting/timeline - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

318

dist/timeline.es.js

@@ -11,3 +11,3 @@ var $t = Object.defineProperty;

e instanceof WeakSet ? e.add(n) : e.set(n, t);
}, z = (n, e, t, a) => (ct(n, e, "write to private field"), a ? a.call(n, t) : e.set(n, t), t);
}, F = (n, e, t, a) => (ct(n, e, "write to private field"), a ? a.call(n, t) : e.set(n, t), t);
function gt(n) {

@@ -29,42 +29,42 @@ return { all: n = n || /* @__PURE__ */ new Map(), on: function(e, t) {

}
var et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, dt = "Expected a function", ft = 0 / 0, pt = "[object Symbol]", xt = /^\s+|\s+$/g, Mt = /^[-+]0x[0-9a-f]+$/i, yt = /^0b[01]+$/i, bt = /^0o[0-7]+$/i, Ct = parseInt, Dt = typeof et == "object" && et && et.Object === Object && et, Ot = typeof self == "object" && self && self.Object === Object && self, wt = Dt || Ot || Function("return this")(), Tt = Object.prototype, St = Tt.toString, _t = Math.max, kt = Math.min, at = function() {
var et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, mt = "Expected a function", ft = 0 / 0, pt = "[object Symbol]", xt = /^\s+|\s+$/g, Mt = /^[-+]0x[0-9a-f]+$/i, yt = /^0b[01]+$/i, bt = /^0o[0-7]+$/i, Ct = parseInt, Dt = typeof et == "object" && et && et.Object === Object && et, Ot = typeof self == "object" && self && self.Object === Object && self, wt = Dt || Ot || Function("return this")(), Tt = Object.prototype, St = Tt.toString, _t = Math.max, kt = Math.min, at = function() {
return wt.Date.now();
};
function Yt(n, e, t) {
var a, l, h, d, u, y, f = 0, b = !1, c = !1, M = !0;
var a, l, h, m, u, y, f = 0, b = !1, c = !1, M = !0;
if (typeof n != "function")
throw new TypeError(dt);
e = ut(e) || 0, st(t) && (b = !!t.leading, c = "maxWait" in t, h = c ? _t(ut(t.maxWait) || 0, e) : h, M = "trailing" in t ? !!t.trailing : M);
throw new TypeError(mt);
e = ut(e) || 0, rt(t) && (b = !!t.leading, c = "maxWait" in t, h = c ? _t(ut(t.maxWait) || 0, e) : h, M = "trailing" in t ? !!t.trailing : M);
function o(D) {
var E = a, B = l;
return a = l = void 0, f = D, d = n.apply(B, E), d;
var E = a, z = l;
return a = l = void 0, f = D, m = n.apply(z, E), m;
}
function g(D) {
return f = D, u = setTimeout(F, e), b ? o(D) : d;
return f = D, u = setTimeout(J, e), b ? o(D) : m;
}
function x(D) {
var E = D - y, B = D - f, T = e - E;
return c ? kt(T, h - B) : T;
var E = D - y, z = D - f, T = e - E;
return c ? kt(T, h - z) : T;
}
function I(D) {
var E = D - y, B = D - f;
return y === void 0 || E >= e || E < 0 || c && B >= h;
function W(D) {
var E = D - y, z = D - f;
return y === void 0 || E >= e || E < 0 || c && z >= h;
}
function F() {
function J() {
var D = at();
if (I(D))
return W(D);
u = setTimeout(F, x(D));
if (W(D))
return q(D);
u = setTimeout(J, x(D));
}
function W(D) {
return u = void 0, M && a ? o(D) : (a = l = void 0, d);
function q(D) {
return u = void 0, M && a ? o(D) : (a = l = void 0, m);
}
function H() {
function I() {
u !== void 0 && clearTimeout(u), f = 0, a = y = l = u = void 0;
}
function rt() {
return u === void 0 ? d : W(at());
function nt() {
return u === void 0 ? m : q(at());
}
function N() {
var D = at(), E = I(D);
function B() {
var D = at(), E = W(D);
if (a = arguments, l = this, y = D, E) {

@@ -74,7 +74,7 @@ if (u === void 0)

if (c)
return u = setTimeout(F, e), o(y);
return u = setTimeout(J, e), o(y);
}
return u === void 0 && (u = setTimeout(F, e)), d;
return u === void 0 && (u = setTimeout(J, e)), m;
}
return N.cancel = H, N.flush = rt, N;
return B.cancel = I, B.flush = nt, B;
}

@@ -84,4 +84,4 @@ function At(n, e, t) {

if (typeof n != "function")
throw new TypeError(dt);
return st(t) && (a = "leading" in t ? !!t.leading : a, l = "trailing" in t ? !!t.trailing : l), Yt(n, e, {
throw new TypeError(mt);
return rt(t) && (a = "leading" in t ? !!t.leading : a, l = "trailing" in t ? !!t.trailing : l), Yt(n, e, {
leading: a,

@@ -92,3 +92,3 @@ maxWait: e,

}
function st(n) {
function rt(n) {
var e = typeof n;

@@ -108,5 +108,5 @@ return !!n && (e == "object" || e == "function");

return ft;
if (st(n)) {
if (rt(n)) {
var e = typeof n.valueOf == "function" ? n.valueOf() : n;
n = st(e) ? e + "" : e;
n = rt(e) ? e + "" : e;
}

@@ -119,3 +119,3 @@ if (typeof n != "string")

}
var lt = At, mt = { exports: {} };
var lt = At, dt = { exports: {} };
(function(n, e) {

@@ -125,30 +125,30 @@ (function(t, a) {

})(et, function() {
var t = 1e3, a = 6e4, l = 36e5, h = "millisecond", d = "second", u = "minute", y = "hour", f = "day", b = "week", c = "month", M = "quarter", o = "year", g = "date", x = "Invalid Date", I = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, F = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, W = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(m) {
var r = ["th", "st", "nd", "rd"], i = m % 100;
return "[" + m + (r[(i - 20) % 10] || r[i] || r[0]) + "]";
} }, H = function(m, r, i) {
var $ = String(m);
return !$ || $.length >= r ? m : "" + Array(r + 1 - $.length).join(i) + m;
}, rt = { s: H, z: function(m) {
var r = -m.utcOffset(), i = Math.abs(r), $ = Math.floor(i / 60), s = i % 60;
return (r <= 0 ? "+" : "-") + H($, 2, "0") + ":" + H(s, 2, "0");
}, m: function m(r, i) {
var t = 1e3, a = 6e4, l = 36e5, h = "millisecond", m = "second", u = "minute", y = "hour", f = "day", b = "week", c = "month", M = "quarter", o = "year", g = "date", x = "Invalid Date", W = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, J = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, q = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(d) {
var r = ["th", "st", "nd", "rd"], i = d % 100;
return "[" + d + (r[(i - 20) % 10] || r[i] || r[0]) + "]";
} }, I = function(d, r, i) {
var $ = String(d);
return !$ || $.length >= r ? d : "" + Array(r + 1 - $.length).join(i) + d;
}, nt = { s: I, z: function(d) {
var r = -d.utcOffset(), i = Math.abs(r), $ = Math.floor(i / 60), s = i % 60;
return (r <= 0 ? "+" : "-") + I($, 2, "0") + ":" + I(s, 2, "0");
}, m: function d(r, i) {
if (r.date() < i.date())
return -m(i, r);
return -d(i, r);
var $ = 12 * (i.year() - r.year()) + (i.month() - r.month()), s = r.clone().add($, c), p = i - s < 0, v = r.clone().add($ + (p ? -1 : 1), c);
return +(-($ + (i - s) / (p ? s - v : v - s)) || 0);
}, a: function(m) {
return m < 0 ? Math.ceil(m) || 0 : Math.floor(m);
}, p: function(m) {
return { M: c, y: o, w: b, d: f, D: g, h: y, m: u, s: d, ms: h, Q: M }[m] || String(m || "").toLowerCase().replace(/s$/, "");
}, u: function(m) {
return m === void 0;
} }, N = "en", D = {};
D[N] = W;
var E = function(m) {
return m instanceof nt;
}, B = function m(r, i, $) {
}, a: function(d) {
return d < 0 ? Math.ceil(d) || 0 : Math.floor(d);
}, p: function(d) {
return { M: c, y: o, w: b, d: f, D: g, h: y, m: u, s: m, ms: h, Q: M }[d] || String(d || "").toLowerCase().replace(/s$/, "");
}, u: function(d) {
return d === void 0;
} }, B = "en", D = {};
D[B] = q;
var E = function(d) {
return d instanceof it;
}, z = function d(r, i, $) {
var s;
if (!r)
return N;
return B;
if (typeof r == "string") {

@@ -159,3 +159,3 @@ var p = r.toLowerCase();

if (!s && v.length > 1)
return m(v[0]);
return d(v[0]);
} else {

@@ -165,17 +165,17 @@ var C = r.name;

}
return !$ && s && (N = s), s || !$ && N;
}, T = function(m, r) {
if (E(m))
return m.clone();
return !$ && s && (B = s), s || !$ && B;
}, T = function(d, r) {
if (E(d))
return d.clone();
var i = typeof r == "object" ? r : {};
return i.date = m, i.args = arguments, new nt(i);
}, O = rt;
O.l = B, O.i = E, O.w = function(m, r) {
return T(m, { locale: r.$L, utc: r.$u, x: r.$x, $offset: r.$offset });
return i.date = d, i.args = arguments, new it(i);
}, O = nt;
O.l = z, O.i = E, O.w = function(d, r) {
return T(d, { locale: r.$L, utc: r.$u, x: r.$x, $offset: r.$offset });
};
var nt = function() {
function m(i) {
this.$L = B(i.locale, null, !0), this.parse(i);
var it = function() {
function d(i) {
this.$L = z(i.locale, null, !0), this.parse(i);
}
var r = m.prototype;
var r = d.prototype;
return r.parse = function(i) {

@@ -191,3 +191,3 @@ this.$d = function($) {

if (typeof s == "string" && !/Z$/i.test(s)) {
var v = s.match(I);
var v = s.match(W);
if (v) {

@@ -226,3 +226,3 @@ var C = v[2] - 1 || 0, S = (v[7] || "0").substring(0, 3);

return O.w(s.toDate()[P].apply(s.toDate("s"), (p ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(A)), s);
}, w = this.$W, Y = this.$M, V = this.$D, R = "set" + (this.$u ? "UTC" : "");
}, w = this.$W, Y = this.$M, V = this.$D, N = "set" + (this.$u ? "UTC" : "");
switch (v) {

@@ -238,9 +238,9 @@ case o:

case g:
return S(R + "Hours", 0);
return S(N + "Hours", 0);
case y:
return S(R + "Minutes", 1);
return S(N + "Minutes", 1);
case u:
return S(R + "Seconds", 2);
case d:
return S(R + "Milliseconds", 3);
return S(N + "Seconds", 2);
case m:
return S(N + "Milliseconds", 3);
default:

@@ -252,3 +252,3 @@ return this.clone();

}, r.$set = function(i, $) {
var s, p = O.p(i), v = "set" + (this.$u ? "UTC" : ""), C = (s = {}, s[f] = v + "Date", s[g] = v + "Date", s[c] = v + "Month", s[o] = v + "FullYear", s[y] = v + "Hours", s[u] = v + "Minutes", s[d] = v + "Seconds", s[h] = v + "Milliseconds", s)[p], S = p === f ? this.$D + ($ - this.$W) : $;
var s, p = O.p(i), v = "set" + (this.$u ? "UTC" : ""), C = (s = {}, s[f] = v + "Date", s[g] = v + "Date", s[c] = v + "Month", s[o] = v + "FullYear", s[y] = v + "Hours", s[u] = v + "Minutes", s[m] = v + "Seconds", s[h] = v + "Milliseconds", s)[p], S = p === f ? this.$D + ($ - this.$W) : $;
if (p === c || p === o) {

@@ -279,3 +279,3 @@ var w = this.clone().set(g, 1);

return C(7);
var S = (s = {}, s[u] = a, s[y] = l, s[d] = t, s)[v] || 1, w = this.$d.getTime() + i * S;
var S = (s = {}, s[u] = a, s[y] = l, s[m] = t, s)[v] || 1, w = this.$d.getTime() + i * S;
return O.w(w, this);

@@ -288,11 +288,11 @@ }, r.subtract = function(i, $) {

return s.invalidDate || x;
var p = i || "YYYY-MM-DDTHH:mm:ssZ", v = O.z(this), C = this.$H, S = this.$m, w = this.$M, Y = s.weekdays, V = s.months, R = function(A, X, ot, it) {
return A && (A[X] || A($, p)) || ot[X].slice(0, it);
var p = i || "YYYY-MM-DDTHH:mm:ssZ", v = O.z(this), C = this.$H, S = this.$m, w = this.$M, Y = s.weekdays, V = s.months, N = function(A, X, ot, st) {
return A && (A[X] || A($, p)) || ot[X].slice(0, st);
}, L = function(A) {
return O.s(C % 12 || 12, A, "0");
}, tt = s.meridiem || function(A, X, ot) {
var it = A < 12 ? "AM" : "PM";
return ot ? it.toLowerCase() : it;
}, P = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: w + 1, MM: O.s(w + 1, 2, "0"), MMM: R(s.monthsShort, w, V, 3), MMMM: R(V, w), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: R(s.weekdaysMin, this.$W, Y, 2), ddd: R(s.weekdaysShort, this.$W, Y, 3), dddd: Y[this.$W], H: String(C), HH: O.s(C, 2, "0"), h: L(1), hh: L(2), a: tt(C, S, !0), A: tt(C, S, !1), m: String(S), mm: O.s(S, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: v };
return p.replace(F, function(A, X) {
var st = A < 12 ? "AM" : "PM";
return ot ? st.toLowerCase() : st;
}, P = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: w + 1, MM: O.s(w + 1, 2, "0"), MMM: N(s.monthsShort, w, V, 3), MMMM: N(V, w), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: N(s.weekdaysMin, this.$W, Y, 2), ddd: N(s.weekdaysShort, this.$W, Y, 3), dddd: Y[this.$W], H: String(C), HH: O.s(C, 2, "0"), h: L(1), hh: L(2), a: tt(C, S, !0), A: tt(C, S, !1), m: String(S), mm: O.s(S, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: v };
return p.replace(J, function(A, X) {
return X || P[A] || v.replace(":", "");

@@ -304,3 +304,3 @@ });

var p, v = O.p($), C = T(i), S = (C.utcOffset() - this.utcOffset()) * a, w = this - C, Y = O.m(this, C);
return Y = (p = {}, p[o] = Y / 12, p[c] = Y, p[M] = Y / 3, p[b] = (w - S) / 6048e5, p[f] = (w - S) / 864e5, p[y] = w / l, p[u] = w / a, p[d] = w / t, p)[v] || w, s ? Y : O.a(Y);
return Y = (p = {}, p[o] = Y / 12, p[c] = Y, p[M] = Y / 3, p[b] = (w - S) / 6048e5, p[f] = (w - S) / 864e5, p[y] = w / l, p[u] = w / a, p[m] = w / t, p)[v] || w, s ? Y : O.a(Y);
}, r.daysInMonth = function() {

@@ -313,3 +313,3 @@ return this.endOf(c).$D;

return this.$L;
var s = this.clone(), p = B(i, $, !0);
var s = this.clone(), p = z(i, $, !0);
return p && (s.$L = p), s;

@@ -326,18 +326,18 @@ }, r.clone = function() {

return this.$d.toUTCString();
}, m;
}(), ht = nt.prototype;
return T.prototype = ht, [["$ms", h], ["$s", d], ["$m", u], ["$H", y], ["$W", f], ["$M", c], ["$y", o], ["$D", g]].forEach(function(m) {
ht[m[1]] = function(r) {
return this.$g(r, m[0], m[1]);
}, d;
}(), ht = it.prototype;
return T.prototype = ht, [["$ms", h], ["$s", m], ["$m", u], ["$H", y], ["$W", f], ["$M", c], ["$y", o], ["$D", g]].forEach(function(d) {
ht[d[1]] = function(r) {
return this.$g(r, d[0], d[1]);
};
}), T.extend = function(m, r) {
return m.$i || (m(r, nt, T), m.$i = !0), T;
}, T.locale = B, T.isDayjs = E, T.unix = function(m) {
return T(1e3 * m);
}, T.en = D[N], T.Ls = D, T.p = {}, T;
}), T.extend = function(d, r) {
return d.$i || (d(r, it, T), d.$i = !0), T;
}, T.locale = z, T.isDayjs = E, T.unix = function(d) {
return T(1e3 * d);
}, T.en = D[B], T.Ls = D, T.p = {}, T;
});
})(mt);
const J = mt.exports, _ = (n, e = "MM/DD HH:mm") => J(n * 1e3).format(e), Wt = (n = Math.floor(Date.now() / 1e3)) => {
const e = n * 1e3, t = J(e).year(), a = J(e).month(), l = J(e).date(), h = J(e).day(), d = new Date(t, a, l - h).getTime();
return Math.floor(d / 1e3);
})(dt);
const U = dt.exports, _ = (n, e = "MM/DD HH:mm") => U(n * 1e3).format(e), Wt = (n = Math.floor(Date.now() / 1e3)) => {
const e = n * 1e3, t = U(e).year(), a = U(e).month(), l = U(e).date(), h = U(e).day(), m = new Date(t, a, l - h).getTime();
return Math.floor(m / 1e3);
};

@@ -351,3 +351,3 @@ function Et({

scaleHeight: h,
startTime: d,
startTime: m,
drawLine: u,

@@ -358,3 +358,3 @@ drawText: y

for (let f = 0; f < a; f++) {
const b = f * l + n / 2, c = Math.ceil(d + f * t);
const b = f * l + n / 2, c = Math.ceil(m + f * t);
if (c % 10 === 0) {

@@ -376,5 +376,5 @@ u(b, h.height5), y(b, h.height5 + 13, `${_(c, "HH:mm:ss")}`);

if (t === 10) {
const f = +_(d, "s") % 10, b = f / e;
const f = +_(m, "s") % 10, b = f / e;
for (let c = 0; c < a; c++) {
const M = c * l - b - n / 2, o = Math.ceil(d + c * t - f);
const M = c * l - b - n / 2, o = Math.ceil(m + c * t - f);
if (o % 60 === 0) {

@@ -392,5 +392,5 @@ u(M, h.height4), y(M, h.height5 + 13, `${_(o, "HH:mm")}`);

if (t === 30) {
const f = +_(d, "s") % 30, b = f / e;
const f = +_(m, "s") % 30, b = f / e;
for (let c = 0; c < a; c++) {
const M = c * l - b - n / 2, o = Math.ceil(d + c * t - f);
const M = c * l - b - n / 2, o = Math.ceil(m + c * t - f);
if (o % (60 * 5) === 0) {

@@ -408,5 +408,5 @@ u(M, h.height4), y(M, h.height5 + 13, `${_(o, "HH:mm")}`);

if (t === 60) {
const f = +_(d, "s") % 60, b = f / e;
const f = +_(m, "s") % 60, b = f / e;
for (let c = 0; c < a; c++) {
const M = c * l - b - n / 2, o = Math.ceil(d + c * t - f);
const M = c * l - b - n / 2, o = Math.ceil(m + c * t - f);
if (o % (60 * 60) === 0) {

@@ -428,5 +428,5 @@ u(M, h.height5), y(M, h.height5 + 13, `${_(o)}`);

if (t === 120) {
const f = _(d, "m:s").split(":"), c = (+f[0] * 60 + +f[1]) % 120, M = c / e;
const f = _(m, "m:s").split(":"), c = (+f[0] * 60 + +f[1]) % 120, M = c / e;
for (let o = 0; o < a; o++) {
const g = o * l - M - n / 2, x = Math.ceil(d + o * t - c);
const g = o * l - M - n / 2, x = Math.ceil(m + o * t - c);
if (x % (60 * 30) === 0) {

@@ -448,5 +448,5 @@ u(g, h.height5), y(g, h.height5 + 13, `${_(x)}`);

if (t === 300) {
const f = _(d, "m:s").split(":"), c = (+f[0] * 60 + +f[1]) % 300, M = c / e;
const f = _(m, "m:s").split(":"), c = (+f[0] * 60 + +f[1]) % 300, M = c / e;
for (let o = 0; o < a; o++) {
const g = o * l - M - n / 2, x = Math.ceil(d + o * t - c);
const g = o * l - M - n / 2, x = Math.ceil(m + o * t - c);
if (x % (60 * 60) === 0) {

@@ -468,5 +468,5 @@ u(g, h.height5), y(g, h.height5 + 13, `${_(x)}`);

if (t === 7200) {
const f = _(d, "H:m:s").split(":"), c = (+f[0] * 3600 + +f[1] * 60 + +f[2]) % 7200, M = c / e;
const f = _(m, "H:m:s").split(":"), c = (+f[0] * 3600 + +f[1] * 60 + +f[2]) % 7200, M = c / e;
for (let o = 0; o < a; o++) {
const g = o * l - M - n / 2, x = Math.ceil(d + o * t - c);
const g = o * l - M - n / 2, x = Math.ceil(m + o * t - c);
if (x % (3600 * 24) === 0) {

@@ -488,5 +488,5 @@ u(g, h.height5), y(g, h.height5 + 13, `${_(x, "MM/DD HH:mm")}`);

if (t === 86400) {
const f = _(d, "H:m:s").split(":"), c = (+f[0] * 3600 + +f[1] * 60 + +f[2]) % 86400, M = c / e;
const f = _(m, "H:m:s").split(":"), c = (+f[0] * 3600 + +f[1] * 60 + +f[2]) % 86400, M = c / e;
for (let o = 0; o < a; o++) {
const g = o * l - M - n / 2, x = Math.ceil(d + o * t - c);
const g = o * l - M - n / 2, x = Math.ceil(m + o * t - c);
if (_(x, "D") === "1") {

@@ -504,3 +504,3 @@ u(g, h.height5), y(g, h.height5 + 13, `${_(x, "YYYY/MM/DD")}`);

if (t === 604800) {
const f = d - Wt(d), b = f / e, c = new Array(a).fill(!1), M = (o) => {
const f = m - Wt(m), b = f / e, c = new Array(a).fill(!1), M = (o) => {
for (let g = o; g > o - 7; g--)

@@ -512,8 +512,8 @@ if (c[g])

for (let o = 0; o < a; o++) {
const g = o * l - b, x = Math.ceil(d + o * t - f);
if (J(x * 1e3).month() === 0 && (J(x * 1e3).date() > 0 || J(x * 1e3).date() <= 31) && M(o)) {
const g = o * l - b, x = Math.ceil(m + o * t - f);
if (U(x * 1e3).month() === 0 && (U(x * 1e3).date() > 0 || U(x * 1e3).date() <= 31) && M(o)) {
c[o] = !0, u(g, h.height5), y(g, h.height5 + 13, `${_(x, "YYYY/MM/DD")}`);
continue;
}
if (J(x * 1e3).day() === 0) {
if (U(x * 1e3).day() === 0) {
u(g, h.height1);

@@ -538,13 +538,14 @@ continue;

maxZoom: 9,
minZoom: 1
minZoom: 1,
timeFormat: "YYYY/MM/DD HH:mm:ss"
};
var q, U, Z, K, G;
class Bt {
var G, R, Z, K, H;
class zt {
constructor(e, t) {
j(this, "$canvas");
j(this, "canvasContext");
Q(this, q, void 0);
Q(this, G, void 0);
j(this, "currentTime");
j(this, "areas");
Q(this, U, void 0);
Q(this, R, void 0);
Q(this, Z, void 0);

@@ -559,27 +560,28 @@ j(this, "scaleSpacing");

j(this, "areaBgColor");
Q(this, G, void 0);
Q(this, H, void 0);
j(this, "fps");
j(this, "timeFormat");
if (!e)
throw new Error("canvas id is required!");
this.$canvas = document.getElementById(e), this.canvasContext = this.$canvas.getContext("2d");
const { fill: a, width: l, height: h, bgColor: d, textColor: u, scaleColor: y, areaBgColor: f, pointColor: b, pointWidth: c, scaleSpacing: M, fps: o, zoom: g, maxZoom: x, minZoom: I } = { ...Zt, ...t };
if (g < I || g > x || g % 1 !== 0)
throw new Error(`zoom must be minZoom ~ maxZoom(${I} ~1 ${x}), and must be an integer`);
const { fill: a, width: l, height: h, bgColor: m, textColor: u, scaleColor: y, areaBgColor: f, pointColor: b, pointWidth: c, scaleSpacing: M, fps: o, zoom: g, maxZoom: x, minZoom: W, timeFormat: J } = { ...Zt, ...t };
if (g < W || g > x || g % 1 !== 0)
throw new Error(`zoom must be minZoom ~ maxZoom(${W} ~1 ${x}), and must be an integer`);
if (x < 1 || x > 9 || x % 1 !== 0)
throw new Error("maxZoom must be 1 ~ 9, and must be an integer");
if (I < 1 || I > 9 || I % 1 !== 0)
if (W < 1 || W > 9 || W % 1 !== 0)
throw new Error("minZoom must be 1 ~ 9, and must be an integer");
if (x < I)
if (x < W)
throw new Error("maxZoom must be greater than minZoom");
if (a) {
const W = this.$canvas.parentElement;
this.$canvas.width = W.clientWidth, this.$canvas.height = W.clientHeight, new ResizeObserver(lt(this._onParentResize.bind(this), 200)).observe(W);
const I = this.$canvas.parentElement;
this.$canvas.width = I.clientWidth, this.$canvas.height = I.clientHeight, new ResizeObserver(lt(this._onParentResize.bind(this), 200)).observe(I);
} else
l && (this.$canvas.width = l), h && (this.$canvas.height = h);
z(this, G, !1), z(this, q, gt()), this.currentTime = 0;
const F = [1, 10, 30, 60, 120, 300, 7200, 86400, 604800];
z(this, U, []);
for (let W = I - 1; W < x; W++)
k(this, U).push(F[W]);
z(this, Z, F[g - 1]), this.scaleSpacing = M, z(this, K, {
F(this, H, !1), F(this, G, gt()), this.currentTime = 0;
const q = [1, 10, 30, 60, 120, 300, 7200, 86400, 604800];
F(this, R, []);
for (let I = W - 1; I < x; I++)
k(this, R).push(q[I]);
F(this, Z, q[g - 1]), this.scaleSpacing = M, F(this, K, {
height6: this.$canvas.height / 2,

@@ -591,11 +593,11 @@ height5: this.$canvas.height / 3,

height1: this.$canvas.height / 10
}), this.bgColor = d, this.pointWidth = c, this.pointColor = b, this.textColor = u, this.scaleColor = y, this.areaBgColor = f, this.fps = o;
}), this.bgColor = m, this.pointWidth = c, this.pointColor = b, this.textColor = u, this.scaleColor = y, this.areaBgColor = f, this.fps = o, this.timeFormat = J;
}
draw({ currentTime: e, areas: t, _privateFlag: a } = {}) {
if (k(this, G) && !a)
if (k(this, H) && !a)
return;
this.currentTime = e || Math.floor(Date.now() / 1e3), this.areas = t || [];
const l = Math.ceil(this.$canvas.width / this.scaleSpacing), h = l * k(this, Z), d = this.currentTime - h / 2, u = this.currentTime + h / 2, y = this.$canvas.width / 2, f = h / this.$canvas.width;
const l = Math.ceil(this.$canvas.width / this.scaleSpacing), h = l * k(this, Z), m = this.currentTime - h / 2, u = this.currentTime + h / 2, y = this.$canvas.width / 2, f = h / this.$canvas.width;
this.clear(), this.drawArea(0, 0, this.$canvas.width, this.$canvas.height, this.bgColor), this.areas.forEach((b) => {
const c = b.startTime < d ? 0 : Math.floor((b.startTime - d) / f), M = b.endTime > u ? this.$canvas.width : Math.floor((b.endTime - d) / f);
const c = b.startTime < m ? 0 : Math.floor((b.startTime - m) / f), M = b.endTime > u ? this.$canvas.width : Math.floor((b.endTime - m) / f);
this.drawArea(c, 0, M, this.$canvas.height, b.bgColor || this.areaBgColor);

@@ -609,9 +611,9 @@ }), Et.bind(this)({

screenScaleCount: l,
startTime: d,
startTime: m,
drawLine: this.drawLine.bind(this),
drawText: this.drawText.bind(this)
}), this.drawTimelineScale(k(this, Z)), this.drawLine(y - this.pointWidth / 2, this.$canvas.height, this.pointWidth, this.pointColor), this.drawArea(y - 54, 4, y + 54, 18, this.pointColor), this.drawText(y, 6, `${_(this.currentTime, "YYYY/MM/DD HH:mm:ss")}`, this.textColor, "center", "top"), this.$canvas.onwheel = this._onZoom.bind(this), this.$canvas.onmousedown = this._onDrag.bind(this);
}), this.drawTimelineScale(k(this, Z)), this.drawLine(y - this.pointWidth / 2, this.$canvas.height, this.pointWidth, this.pointColor), this.drawArea(y - 54, 4, y + 54, 18, this.pointColor), this.drawText(y, 6, `${_(this.currentTime, this.timeFormat)}`, this.textColor, "center", "top"), this.$canvas.onwheel = this._onZoom.bind(this), this.$canvas.onmousedown = this._onDrag.bind(this);
}
_onDrag({ clientX: e }) {
z(this, G, !0);
F(this, H, !0);
let t = 0;

@@ -626,3 +628,3 @@ document.onmousemove = lt((a) => {

}, k(this, Z) === 1 ? 100 : 1e3 / this.fps), document.onmouseup = () => {
document.onmousemove = null, document.onmouseup = null, z(this, G, !1), this.emit("timeUpdate", this.currentTime);
document.onmousemove = null, document.onmouseup = null, F(this, H, !1), this.emit("timeUpdate", this.currentTime);
};

@@ -632,8 +634,8 @@ }

e.preventDefault();
const t = k(this, U).findIndex((a) => a === k(this, Z));
e.deltaY < 0 && t > 0 ? (z(this, Z, k(this, U)[t - 1]), this.draw({
const t = k(this, R).findIndex((a) => a === k(this, Z));
e.deltaY < 0 && t > 0 ? (F(this, Z, k(this, R)[t - 1]), this.draw({
currentTime: this.currentTime,
areas: this.areas,
_privateFlag: !0
})) : e.deltaY > 0 && t < k(this, U).length - 1 && (z(this, Z, k(this, U)[t + 1]), this.draw({
})) : e.deltaY > 0 && t < k(this, R).length - 1 && (F(this, Z, k(this, R)[t + 1]), this.draw({
currentTime: this.currentTime,

@@ -646,3 +648,3 @@ areas: this.areas,

const e = this.$canvas.parentNode;
!e || (this.$canvas.width = e.clientWidth, this.$canvas.height = e.clientHeight, z(this, K, {
!e || (this.$canvas.width = e.clientWidth, this.$canvas.height = e.clientHeight, F(this, K, {
height6: this.$canvas.height / 2,

@@ -698,4 +700,4 @@ height5: this.$canvas.height / 3,

}
drawText(e, t, a, l = this.textColor, h = "center", d = "alphabetic") {
this.canvasContext.beginPath(), this.canvasContext.font = "11px Arial", this.canvasContext.fillStyle = l, this.canvasContext.textAlign = h, this.canvasContext.textBaseline = d, this.canvasContext.fillText(a, e, t);
drawText(e, t, a, l = this.textColor, h = "center", m = "alphabetic") {
this.canvasContext.beginPath(), this.canvasContext.font = "11px Arial", this.canvasContext.fillStyle = l, this.canvasContext.textAlign = h, this.canvasContext.textBaseline = m, this.canvasContext.fillText(a, e, t);
}

@@ -706,14 +708,14 @@ drawArea(e, t, a, l, h) {

on(e, t) {
k(this, q).on(e, t);
k(this, G).on(e, t);
}
off(e, t) {
k(this, q).off(e, t);
k(this, G).off(e, t);
}
emit(...e) {
k(this, q).emit(...e);
k(this, G).emit(...e);
}
}
q = new WeakMap(), U = new WeakMap(), Z = new WeakMap(), K = new WeakMap(), G = new WeakMap();
G = new WeakMap(), R = new WeakMap(), Z = new WeakMap(), K = new WeakMap(), H = new WeakMap();
export {
Bt as default
zt as default
};

@@ -1,1 +0,1 @@

var Zt=Object.defineProperty;var zt=(S,w,Y)=>w in S?Zt(S,w,{enumerable:!0,configurable:!0,writable:!0,value:Y}):S[w]=Y;var E=(S,w,Y)=>(zt(S,typeof w!="symbol"?w+"":w,Y),Y),$t=(S,w,Y)=>{if(!w.has(S))throw TypeError("Cannot "+Y)};var j=(S,w,Y)=>($t(S,w,"read from private field"),Y?Y.call(S):w.get(S)),et=(S,w,Y)=>{if(w.has(S))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(S):w.set(S,Y)},N=(S,w,Y,nt)=>($t(S,w,"write to private field"),nt?nt.call(S,Y):w.set(S,Y),Y);var $timeline=function(){var P,J,Z,K,Q;"use strict";function S(r){return{all:r=r||new Map,on:function(e,t){var c=r.get(e);c?c.push(t):r.set(e,[t])},off:function(e,t){var c=r.get(e);c&&(t?c.splice(c.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var c=r.get(e);c&&c.slice().map(function(l){l(t)}),(c=r.get("*"))&&c.slice().map(function(l){l(e,t)})}}}var w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Y="Expected a function",nt=0/0,vt="[object Symbol]",gt=/^\s+|\s+$/g,pt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,Mt=/^0o[0-7]+$/i,yt=parseInt,bt=typeof w=="object"&&w&&w.Object===Object&&w,Ct=typeof self=="object"&&self&&self.Object===Object&&self,Dt=bt||Ct||Function("return this")(),Ot=Object.prototype,wt=Ot.toString,Tt=Math.max,St=Math.min,ht=function(){return Dt.Date.now()};function _t(r,e,t){var c,l,a,d,u,y,f=0,b=!1,h=!1,M=!0;if(typeof r!="function")throw new TypeError(Y);e=ut(e)||0,rt(t)&&(b=!!t.leading,h="maxWait"in t,a=h?Tt(ut(t.maxWait)||0,e):a,M="trailing"in t?!!t.trailing:M);function o(D){var F=c,R=l;return c=l=void 0,f=D,d=r.apply(R,F),d}function g(D){return f=D,u=setTimeout(V,e),b?o(D):d}function x(D){var F=D-y,R=D-f,_=e-F;return h?St(_,a-R):_}function z(D){var F=D-y,R=D-f;return y===void 0||F>=e||F<0||h&&R>=a}function V(){var D=ht();if(z(D))return B(D);u=setTimeout(V,x(D))}function B(D){return u=void 0,M&&c?o(D):(c=l=void 0,d)}function L(){u!==void 0&&clearTimeout(u),f=0,c=y=l=u=void 0}function ct(){return u===void 0?d:B(ht())}function X(){var D=ht(),F=z(D);if(c=arguments,l=this,y=D,F){if(u===void 0)return g(y);if(h)return u=setTimeout(V,e),o(y)}return u===void 0&&(u=setTimeout(V,e)),d}return X.cancel=L,X.flush=ct,X}function kt(r,e,t){var c=!0,l=!0;if(typeof r!="function")throw new TypeError(Y);return rt(t)&&(c="leading"in t?!!t.leading:c,l="trailing"in t?!!t.trailing:l),_t(r,e,{leading:c,maxWait:e,trailing:l})}function rt(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function Yt(r){return!!r&&typeof r=="object"}function At(r){return typeof r=="symbol"||Yt(r)&&wt.call(r)==vt}function ut(r){if(typeof r=="number")return r;if(At(r))return nt;if(rt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=rt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(gt,"");var t=xt.test(r);return t||Mt.test(r)?yt(r.slice(2),t?2:8):pt.test(r)?nt:+r}var lt=kt,dt={exports:{}};(function(r,e){(function(t,c){r.exports=c()})(w,function(){var t=1e3,c=6e4,l=36e5,a="millisecond",d="second",u="minute",y="hour",f="day",b="week",h="month",M="quarter",o="year",g="date",x="Invalid Date",z=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,V=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,B={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(m){var s=["th","st","nd","rd"],n=m%100;return"["+m+(s[(n-20)%10]||s[n]||s[0])+"]"}},L=function(m,s,n){var $=String(m);return!$||$.length>=s?m:""+Array(s+1-$.length).join(n)+m},ct={s:L,z:function(m){var s=-m.utcOffset(),n=Math.abs(s),$=Math.floor(n/60),i=n%60;return(s<=0?"+":"-")+L($,2,"0")+":"+L(i,2,"0")},m:function m(s,n){if(s.date()<n.date())return-m(n,s);var $=12*(n.year()-s.year())+(n.month()-s.month()),i=s.clone().add($,h),p=n-i<0,v=s.clone().add($+(p?-1:1),h);return+(-($+(n-i)/(p?i-v:v-i))||0)},a:function(m){return m<0?Math.ceil(m)||0:Math.floor(m)},p:function(m){return{M:h,y:o,w:b,d:f,D:g,h:y,m:u,s:d,ms:a,Q:M}[m]||String(m||"").toLowerCase().replace(/s$/,"")},u:function(m){return m===void 0}},X="en",D={};D[X]=B;var F=function(m){return m instanceof ot},R=function m(s,n,$){var i;if(!s)return X;if(typeof s=="string"){var p=s.toLowerCase();D[p]&&(i=p),n&&(D[p]=n,i=p);var v=s.split("-");if(!i&&v.length>1)return m(v[0])}else{var C=s.name;D[C]=s,i=C}return!$&&i&&(X=i),i||!$&&X},_=function(m,s){if(F(m))return m.clone();var n=typeof s=="object"?s:{};return n.date=m,n.args=arguments,new ot(n)},O=ct;O.l=R,O.i=F,O.w=function(m,s){return _(m,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var ot=function(){function m(n){this.$L=R(n.locale,null,!0),this.parse(n)}var s=m.prototype;return s.parse=function(n){this.$d=function($){var i=$.date,p=$.utc;if(i===null)return new Date(NaN);if(O.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var v=i.match(z);if(v){var C=v[2]-1||0,k=(v[7]||"0").substring(0,3);return p?new Date(Date.UTC(v[1],C,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)):new Date(v[1],C,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)}}return new Date(i)}(n),this.$x=n.x||{},this.init()},s.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},s.$utils=function(){return O},s.isValid=function(){return this.$d.toString()!==x},s.isSame=function(n,$){var i=_(n);return this.startOf($)<=i&&i<=this.endOf($)},s.isAfter=function(n,$){return _(n)<this.startOf($)},s.isBefore=function(n,$){return this.endOf($)<_(n)},s.$g=function(n,$,i){return O.u(n)?this[$]:this.set(i,n)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(n,$){var i=this,p=!!O.u($)||$,v=O.p(n),C=function(tt,W){var H=O.w(i.$u?Date.UTC(i.$y,W,tt):new Date(i.$y,W,tt),i);return p?H:H.endOf(f)},k=function(tt,W){return O.w(i.toDate()[tt].apply(i.toDate("s"),(p?[0,0,0,0]:[23,59,59,999]).slice(W)),i)},T=this.$W,I=this.$M,G=this.$D,q="set"+(this.$u?"UTC":"");switch(v){case o:return p?C(1,0):C(31,11);case h:return p?C(1,I):C(0,I+1);case b:var it=this.$locale().weekStart||0,st=(T<it?T+7:T)-it;return C(p?G-st:G+(6-st),I);case f:case g:return k(q+"Hours",0);case y:return k(q+"Minutes",1);case u:return k(q+"Seconds",2);case d:return k(q+"Milliseconds",3);default:return this.clone()}},s.endOf=function(n){return this.startOf(n,!1)},s.$set=function(n,$){var i,p=O.p(n),v="set"+(this.$u?"UTC":""),C=(i={},i[f]=v+"Date",i[g]=v+"Date",i[h]=v+"Month",i[o]=v+"FullYear",i[y]=v+"Hours",i[u]=v+"Minutes",i[d]=v+"Seconds",i[a]=v+"Milliseconds",i)[p],k=p===f?this.$D+($-this.$W):$;if(p===h||p===o){var T=this.clone().set(g,1);T.$d[C](k),T.init(),this.$d=T.set(g,Math.min(this.$D,T.daysInMonth())).$d}else C&&this.$d[C](k);return this.init(),this},s.set=function(n,$){return this.clone().$set(n,$)},s.get=function(n){return this[O.p(n)]()},s.add=function(n,$){var i,p=this;n=Number(n);var v=O.p($),C=function(I){var G=_(p);return O.w(G.date(G.date()+Math.round(I*n)),p)};if(v===h)return this.set(h,this.$M+n);if(v===o)return this.set(o,this.$y+n);if(v===f)return C(1);if(v===b)return C(7);var k=(i={},i[u]=c,i[y]=l,i[d]=t,i)[v]||1,T=this.$d.getTime()+n*k;return O.w(T,this)},s.subtract=function(n,$){return this.add(-1*n,$)},s.format=function(n){var $=this,i=this.$locale();if(!this.isValid())return i.invalidDate||x;var p=n||"YYYY-MM-DDTHH:mm:ssZ",v=O.z(this),C=this.$H,k=this.$m,T=this.$M,I=i.weekdays,G=i.months,q=function(W,H,ft,at){return W&&(W[H]||W($,p))||ft[H].slice(0,at)},it=function(W){return O.s(C%12||12,W,"0")},st=i.meridiem||function(W,H,ft){var at=W<12?"AM":"PM";return ft?at.toLowerCase():at},tt={YY:String(this.$y).slice(-2),YYYY:this.$y,M:T+1,MM:O.s(T+1,2,"0"),MMM:q(i.monthsShort,T,G,3),MMMM:q(G,T),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:q(i.weekdaysMin,this.$W,I,2),ddd:q(i.weekdaysShort,this.$W,I,3),dddd:I[this.$W],H:String(C),HH:O.s(C,2,"0"),h:it(1),hh:it(2),a:st(C,k,!0),A:st(C,k,!1),m:String(k),mm:O.s(k,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:v};return p.replace(V,function(W,H){return H||tt[W]||v.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(n,$,i){var p,v=O.p($),C=_(n),k=(C.utcOffset()-this.utcOffset())*c,T=this-C,I=O.m(this,C);return I=(p={},p[o]=I/12,p[h]=I,p[M]=I/3,p[b]=(T-k)/6048e5,p[f]=(T-k)/864e5,p[y]=T/l,p[u]=T/c,p[d]=T/t,p)[v]||T,i?I:O.a(I)},s.daysInMonth=function(){return this.endOf(h).$D},s.$locale=function(){return D[this.$L]},s.locale=function(n,$){if(!n)return this.$L;var i=this.clone(),p=R(n,$,!0);return p&&(i.$L=p),i},s.clone=function(){return O.w(this.$d,this)},s.toDate=function(){return new Date(this.valueOf())},s.toJSON=function(){return this.isValid()?this.toISOString():null},s.toISOString=function(){return this.$d.toISOString()},s.toString=function(){return this.$d.toUTCString()},m}(),mt=ot.prototype;return _.prototype=mt,[["$ms",a],["$s",d],["$m",u],["$H",y],["$W",f],["$M",h],["$y",o],["$D",g]].forEach(function(m){mt[m[1]]=function(s){return this.$g(s,m[0],m[1])}}),_.extend=function(m,s){return m.$i||(m(s,ot,_),m.$i=!0),_},_.locale=R,_.isDayjs=F,_.unix=function(m){return _(1e3*m)},_.en=D[X],_.Ls=D,_.p={},_})})(dt);const U=dt.exports,A=(r,e="MM/DD HH:mm")=>U(r*1e3).format(e),jt=(r=Math.floor(Date.now()/1e3))=>{const e=r*1e3,t=U(e).year(),c=U(e).month(),l=U(e).date(),a=U(e).day(),d=new Date(t,c,l-a).getTime();return Math.floor(d/1e3)};function It({pointWidth:r,timePerPixel:e,timeSpacing:t,screenScaleCount:c,scaleSpacing:l,scaleHeight:a,startTime:d,drawLine:u,drawText:y}){if(t===1){for(let f=0;f<c;f++){const b=f*l+r/2,h=Math.ceil(d+f*t);if(h%10===0){u(b,a.height5),y(b,a.height5+13,`${A(h,"HH:mm:ss")}`);continue}if(h%5===0){u(b,a.height3);continue}if(h%1===0){u(b,a.height1);continue}}return}if(t===10){const f=+A(d,"s")%10,b=f/e;for(let h=0;h<c;h++){const M=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%60===0){u(M,a.height4),y(M,a.height5+13,`${A(o,"HH:mm")}`);continue}if(o%10===0){u(M,a.height1);continue}}return}if(t===30){const f=+A(d,"s")%30,b=f/e;for(let h=0;h<c;h++){const M=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%300===0){u(M,a.height4),y(M,a.height5+13,`${A(o,"HH:mm")}`);continue}if(o%30===0){u(M,a.height1);continue}}return}if(t===60){const f=+A(d,"s")%60,b=f/e;for(let h=0;h<c;h++){const M=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%3600===0){u(M,a.height5),y(M,a.height5+13,`${A(o)}`);continue}if(o%300===0){u(M,a.height3),o%600===0&&y(M,a.height5+13,`${A(o,"HH:mm")}`);continue}if(o%60===0){u(M,a.height1);continue}}return}if(t===120){const f=A(d,"m:s").split(":"),h=(+f[0]*60+ +f[1])%120,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(d+o*t-h);if(x%1800===0){u(g,a.height5),y(g,a.height5+13,`${A(x)}`);continue}if(x%600===0){u(g,a.height3);continue}if(x%120===0){u(g,a.height1);continue}}return}if(t===300){const f=A(d,"m:s").split(":"),h=(+f[0]*60+ +f[1])%300,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(d+o*t-h);if(x%3600===0){u(g,a.height5),y(g,a.height5+13,`${A(x)}`);continue}if(x%1800===0){u(g,a.height3);continue}if(x%300===0){u(g,a.height1);continue}}return}if(t===7200){const f=A(d,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%7200,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(d+o*t-h);if(x%86400===0){u(g,a.height5),y(g,a.height5+13,`${A(x,"MM/DD HH:mm")}`);continue}if(x%43200===0){u(g,a.height3);continue}if(x%7200===0){u(g,a.height1);continue}}return}if(t===86400){const f=A(d,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%86400,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(d+o*t-h);if(A(x,"D")==="1"){u(g,a.height5),y(g,a.height5+13,`${A(x,"YYYY/MM/DD")}`);continue}if(x%86400===57600){u(g,a.height1);continue}}return}if(t===604800){const f=d-jt(d),b=f/e,h=new Array(c).fill(!1),M=o=>{for(let g=o;g>o-7;g--)if(h[g])return!1;return!0};for(let o=0;o<c;o++){const g=o*l-b,x=Math.ceil(d+o*t-f);if(U(x*1e3).month()===0&&(U(x*1e3).date()>0||U(x*1e3).date()<=31)&&M(o)){h[o]=!0,u(g,a.height5),y(g,a.height5+13,`${A(x,"YYYY/MM/DD")}`);continue}if(U(x*1e3).day()===0){u(g,a.height1);continue}}return}}const Wt={fill:!1,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",scaleColor:"#ffffff",areaBgColor:"#ffffff55",pointColor:"#00aeec",pointWidth:3,scaleSpacing:7,fps:60,zoom:2,maxZoom:9,minZoom:1};class Et{constructor(e,t){E(this,"$canvas");E(this,"canvasContext");et(this,P,void 0);E(this,"currentTime");E(this,"areas");et(this,J,void 0);et(this,Z,void 0);E(this,"scaleSpacing");E(this,"bgColor");et(this,K,void 0);E(this,"pointWidth");E(this,"pointColor");E(this,"textColor");E(this,"scaleColor");E(this,"areaBgColor");et(this,Q,void 0);E(this,"fps");if(!e)throw new Error("canvas id is required!");this.$canvas=document.getElementById(e),this.canvasContext=this.$canvas.getContext("2d");const{fill:c,width:l,height:a,bgColor:d,textColor:u,scaleColor:y,areaBgColor:f,pointColor:b,pointWidth:h,scaleSpacing:M,fps:o,zoom:g,maxZoom:x,minZoom:z}={...Wt,...t};if(g<z||g>x||g%1!==0)throw new Error(`zoom must be minZoom ~ maxZoom(${z} ~1 ${x}), and must be an integer`);if(x<1||x>9||x%1!==0)throw new Error("maxZoom must be 1 ~ 9, and must be an integer");if(z<1||z>9||z%1!==0)throw new Error("minZoom must be 1 ~ 9, and must be an integer");if(x<z)throw new Error("maxZoom must be greater than minZoom");if(c){const B=this.$canvas.parentElement;this.$canvas.width=B.clientWidth,this.$canvas.height=B.clientHeight,new ResizeObserver(lt(this._onParentResize.bind(this),200)).observe(B)}else l&&(this.$canvas.width=l),a&&(this.$canvas.height=a);N(this,Q,!1),N(this,P,S()),this.currentTime=0;const V=[1,10,30,60,120,300,7200,86400,604800];N(this,J,[]);for(let B=z-1;B<x;B++)j(this,J).push(V[B]);N(this,Z,V[g-1]),this.scaleSpacing=M,N(this,K,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.bgColor=d,this.pointWidth=h,this.pointColor=b,this.textColor=u,this.scaleColor=y,this.areaBgColor=f,this.fps=o}draw({currentTime:e,areas:t,_privateFlag:c}={}){if(j(this,Q)&&!c)return;this.currentTime=e||Math.floor(Date.now()/1e3),this.areas=t||[];const l=Math.ceil(this.$canvas.width/this.scaleSpacing),a=l*j(this,Z),d=this.currentTime-a/2,u=this.currentTime+a/2,y=this.$canvas.width/2,f=a/this.$canvas.width;this.clear(),this.drawArea(0,0,this.$canvas.width,this.$canvas.height,this.bgColor),this.areas.forEach(b=>{const h=b.startTime<d?0:Math.floor((b.startTime-d)/f),M=b.endTime>u?this.$canvas.width:Math.floor((b.endTime-d)/f);this.drawArea(h,0,M,this.$canvas.height,b.bgColor||this.areaBgColor)}),It.bind(this)({pointWidth:this.pointWidth,timePerPixel:f,scaleHeight:j(this,K),scaleSpacing:this.scaleSpacing,timeSpacing:j(this,Z),screenScaleCount:l,startTime:d,drawLine:this.drawLine.bind(this),drawText:this.drawText.bind(this)}),this.drawTimelineScale(j(this,Z)),this.drawLine(y-this.pointWidth/2,this.$canvas.height,this.pointWidth,this.pointColor),this.drawArea(y-54,4,y+54,18,this.pointColor),this.drawText(y,6,`${A(this.currentTime,"YYYY/MM/DD HH:mm:ss")}`,this.textColor,"center","top"),this.$canvas.onwheel=this._onZoom.bind(this),this.$canvas.onmousedown=this._onDrag.bind(this)}_onDrag({clientX:e}){N(this,Q,!0);let t=0;document.onmousemove=lt(c=>{const l=c.clientX-e,a=this.currentTime-j(this,Z)/this.scaleSpacing*(l-t);t=l,this.draw({currentTime:Math.round(a),areas:this.areas,_privateFlag:!0})},j(this,Z)===1?100:1e3/this.fps),document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,N(this,Q,!1),this.emit("timeUpdate",this.currentTime)}}_onZoom(e){e.preventDefault();const t=j(this,J).findIndex(c=>c===j(this,Z));e.deltaY<0&&t>0?(N(this,Z,j(this,J)[t-1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0})):e.deltaY>0&&t<j(this,J).length-1&&(N(this,Z,j(this,J)[t+1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0}))}_onParentResize(){const e=this.$canvas.parentNode;!e||(this.$canvas.width=e.clientWidth,this.$canvas.height=e.clientHeight,N(this,K,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.draw({currentTime:this.currentTime,areas:this.areas}))}clear(){this.canvasContext&&this.canvasContext.clearRect(0,0,this.$canvas.width,this.$canvas.height),this.$canvas&&(this.$canvas.onwheel=null,this.$canvas.onmousedown=null)}drawTimelineScale(e){let t="";switch(e){case 1:t="1s";break;case 10:t="10s";break;case 30:t="30s";break;case 60:t="1min";break;case 120:t="2min";break;case 300:t="5min";break;case 7200:t="2hour";break;case 86400:t="1day";break;case 604800:t="1week";break}this.drawText(this.scaleSpacing+12,9,`${t}`,this.textColor,"left","middle"),this.canvasContext.beginPath(),this.canvasContext.moveTo(5,6),this.canvasContext.lineTo(5,10),this.canvasContext.lineTo(this.scaleSpacing+7,10),this.canvasContext.lineTo(this.scaleSpacing+7,6),this.canvasContext.strokeStyle=this.scaleColor,this.canvasContext.lineWidth=1.5,this.canvasContext.stroke()}drawLine(e,t,c=1,l=this.scaleColor){this.canvasContext.beginPath(),this.canvasContext.moveTo(e,this.$canvas.height),this.canvasContext.lineTo(e,this.$canvas.height-t),this.canvasContext.closePath(),this.canvasContext.strokeStyle=l,this.canvasContext.lineWidth=c,this.canvasContext.stroke()}drawText(e,t,c,l=this.textColor,a="center",d="alphabetic"){this.canvasContext.beginPath(),this.canvasContext.font="11px Arial",this.canvasContext.fillStyle=l,this.canvasContext.textAlign=a,this.canvasContext.textBaseline=d,this.canvasContext.fillText(c,e,t)}drawArea(e,t,c,l,a){this.canvasContext.beginPath(),this.canvasContext.rect(e,t,c-e,l-t),this.canvasContext.fillStyle=a,this.canvasContext.fill()}on(e,t){j(this,P).on(e,t)}off(e,t){j(this,P).off(e,t)}emit(...e){j(this,P).emit(...e)}}return P=new WeakMap,J=new WeakMap,Z=new WeakMap,K=new WeakMap,Q=new WeakMap,Et}();
var Zt=Object.defineProperty;var Ft=(S,w,Y)=>w in S?Zt(S,w,{enumerable:!0,configurable:!0,writable:!0,value:Y}):S[w]=Y;var E=(S,w,Y)=>(Ft(S,typeof w!="symbol"?w+"":w,Y),Y),$t=(S,w,Y)=>{if(!w.has(S))throw TypeError("Cannot "+Y)};var j=(S,w,Y)=>($t(S,w,"read from private field"),Y?Y.call(S):w.get(S)),et=(S,w,Y)=>{if(w.has(S))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(S):w.set(S,Y)},N=(S,w,Y,nt)=>($t(S,w,"write to private field"),nt?nt.call(S,Y):w.set(S,Y),Y);var $timeline=function(){var P,J,F,L,Q;"use strict";function S(r){return{all:r=r||new Map,on:function(e,t){var c=r.get(e);c?c.push(t):r.set(e,[t])},off:function(e,t){var c=r.get(e);c&&(t?c.splice(c.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var c=r.get(e);c&&c.slice().map(function(l){l(t)}),(c=r.get("*"))&&c.slice().map(function(l){l(e,t)})}}}var w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Y="Expected a function",nt=0/0,vt="[object Symbol]",gt=/^\s+|\s+$/g,pt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,Mt=/^0o[0-7]+$/i,yt=parseInt,bt=typeof w=="object"&&w&&w.Object===Object&&w,Ct=typeof self=="object"&&self&&self.Object===Object&&self,Dt=bt||Ct||Function("return this")(),Ot=Object.prototype,wt=Ot.toString,Tt=Math.max,St=Math.min,ct=function(){return Dt.Date.now()};function _t(r,e,t){var c,l,a,m,u,y,f=0,b=!1,h=!1,M=!0;if(typeof r!="function")throw new TypeError(Y);e=ut(e)||0,rt(t)&&(b=!!t.leading,h="maxWait"in t,a=h?Tt(ut(t.maxWait)||0,e):a,M="trailing"in t?!!t.trailing:M);function o(D){var B=c,R=l;return c=l=void 0,f=D,m=r.apply(R,B),m}function g(D){return f=D,u=setTimeout(q,e),b?o(D):m}function x(D){var B=D-y,R=D-f,_=e-B;return h?St(_,a-R):_}function z(D){var B=D-y,R=D-f;return y===void 0||B>=e||B<0||h&&R>=a}function q(){var D=ct();if(z(D))return K(D);u=setTimeout(q,x(D))}function K(D){return u=void 0,M&&c?o(D):(c=l=void 0,m)}function Z(){u!==void 0&&clearTimeout(u),f=0,c=y=l=u=void 0}function ot(){return u===void 0?m:K(ct())}function V(){var D=ct(),B=z(D);if(c=arguments,l=this,y=D,B){if(u===void 0)return g(y);if(h)return u=setTimeout(q,e),o(y)}return u===void 0&&(u=setTimeout(q,e)),m}return V.cancel=Z,V.flush=ot,V}function kt(r,e,t){var c=!0,l=!0;if(typeof r!="function")throw new TypeError(Y);return rt(t)&&(c="leading"in t?!!t.leading:c,l="trailing"in t?!!t.trailing:l),_t(r,e,{leading:c,maxWait:e,trailing:l})}function rt(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function Yt(r){return!!r&&typeof r=="object"}function At(r){return typeof r=="symbol"||Yt(r)&&wt.call(r)==vt}function ut(r){if(typeof r=="number")return r;if(At(r))return nt;if(rt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=rt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(gt,"");var t=xt.test(r);return t||Mt.test(r)?yt(r.slice(2),t?2:8):pt.test(r)?nt:+r}var lt=kt,mt={exports:{}};(function(r,e){(function(t,c){r.exports=c()})(w,function(){var t=1e3,c=6e4,l=36e5,a="millisecond",m="second",u="minute",y="hour",f="day",b="week",h="month",M="quarter",o="year",g="date",x="Invalid Date",z=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,q=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,K={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(d){var s=["th","st","nd","rd"],n=d%100;return"["+d+(s[(n-20)%10]||s[n]||s[0])+"]"}},Z=function(d,s,n){var $=String(d);return!$||$.length>=s?d:""+Array(s+1-$.length).join(n)+d},ot={s:Z,z:function(d){var s=-d.utcOffset(),n=Math.abs(s),$=Math.floor(n/60),i=n%60;return(s<=0?"+":"-")+Z($,2,"0")+":"+Z(i,2,"0")},m:function d(s,n){if(s.date()<n.date())return-d(n,s);var $=12*(n.year()-s.year())+(n.month()-s.month()),i=s.clone().add($,h),p=n-i<0,v=s.clone().add($+(p?-1:1),h);return+(-($+(n-i)/(p?i-v:v-i))||0)},a:function(d){return d<0?Math.ceil(d)||0:Math.floor(d)},p:function(d){return{M:h,y:o,w:b,d:f,D:g,h:y,m:u,s:m,ms:a,Q:M}[d]||String(d||"").toLowerCase().replace(/s$/,"")},u:function(d){return d===void 0}},V="en",D={};D[V]=K;var B=function(d){return d instanceof at},R=function d(s,n,$){var i;if(!s)return V;if(typeof s=="string"){var p=s.toLowerCase();D[p]&&(i=p),n&&(D[p]=n,i=p);var v=s.split("-");if(!i&&v.length>1)return d(v[0])}else{var C=s.name;D[C]=s,i=C}return!$&&i&&(V=i),i||!$&&V},_=function(d,s){if(B(d))return d.clone();var n=typeof s=="object"?s:{};return n.date=d,n.args=arguments,new at(n)},O=ot;O.l=R,O.i=B,O.w=function(d,s){return _(d,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var at=function(){function d(n){this.$L=R(n.locale,null,!0),this.parse(n)}var s=d.prototype;return s.parse=function(n){this.$d=function($){var i=$.date,p=$.utc;if(i===null)return new Date(NaN);if(O.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var v=i.match(z);if(v){var C=v[2]-1||0,k=(v[7]||"0").substring(0,3);return p?new Date(Date.UTC(v[1],C,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)):new Date(v[1],C,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)}}return new Date(i)}(n),this.$x=n.x||{},this.init()},s.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},s.$utils=function(){return O},s.isValid=function(){return this.$d.toString()!==x},s.isSame=function(n,$){var i=_(n);return this.startOf($)<=i&&i<=this.endOf($)},s.isAfter=function(n,$){return _(n)<this.startOf($)},s.isBefore=function(n,$){return this.endOf($)<_(n)},s.$g=function(n,$,i){return O.u(n)?this[$]:this.set(i,n)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(n,$){var i=this,p=!!O.u($)||$,v=O.p(n),C=function(tt,W){var H=O.w(i.$u?Date.UTC(i.$y,W,tt):new Date(i.$y,W,tt),i);return p?H:H.endOf(f)},k=function(tt,W){return O.w(i.toDate()[tt].apply(i.toDate("s"),(p?[0,0,0,0]:[23,59,59,999]).slice(W)),i)},T=this.$W,I=this.$M,G=this.$D,X="set"+(this.$u?"UTC":"");switch(v){case o:return p?C(1,0):C(31,11);case h:return p?C(1,I):C(0,I+1);case b:var it=this.$locale().weekStart||0,st=(T<it?T+7:T)-it;return C(p?G-st:G+(6-st),I);case f:case g:return k(X+"Hours",0);case y:return k(X+"Minutes",1);case u:return k(X+"Seconds",2);case m:return k(X+"Milliseconds",3);default:return this.clone()}},s.endOf=function(n){return this.startOf(n,!1)},s.$set=function(n,$){var i,p=O.p(n),v="set"+(this.$u?"UTC":""),C=(i={},i[f]=v+"Date",i[g]=v+"Date",i[h]=v+"Month",i[o]=v+"FullYear",i[y]=v+"Hours",i[u]=v+"Minutes",i[m]=v+"Seconds",i[a]=v+"Milliseconds",i)[p],k=p===f?this.$D+($-this.$W):$;if(p===h||p===o){var T=this.clone().set(g,1);T.$d[C](k),T.init(),this.$d=T.set(g,Math.min(this.$D,T.daysInMonth())).$d}else C&&this.$d[C](k);return this.init(),this},s.set=function(n,$){return this.clone().$set(n,$)},s.get=function(n){return this[O.p(n)]()},s.add=function(n,$){var i,p=this;n=Number(n);var v=O.p($),C=function(I){var G=_(p);return O.w(G.date(G.date()+Math.round(I*n)),p)};if(v===h)return this.set(h,this.$M+n);if(v===o)return this.set(o,this.$y+n);if(v===f)return C(1);if(v===b)return C(7);var k=(i={},i[u]=c,i[y]=l,i[m]=t,i)[v]||1,T=this.$d.getTime()+n*k;return O.w(T,this)},s.subtract=function(n,$){return this.add(-1*n,$)},s.format=function(n){var $=this,i=this.$locale();if(!this.isValid())return i.invalidDate||x;var p=n||"YYYY-MM-DDTHH:mm:ssZ",v=O.z(this),C=this.$H,k=this.$m,T=this.$M,I=i.weekdays,G=i.months,X=function(W,H,ft,ht){return W&&(W[H]||W($,p))||ft[H].slice(0,ht)},it=function(W){return O.s(C%12||12,W,"0")},st=i.meridiem||function(W,H,ft){var ht=W<12?"AM":"PM";return ft?ht.toLowerCase():ht},tt={YY:String(this.$y).slice(-2),YYYY:this.$y,M:T+1,MM:O.s(T+1,2,"0"),MMM:X(i.monthsShort,T,G,3),MMMM:X(G,T),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:X(i.weekdaysMin,this.$W,I,2),ddd:X(i.weekdaysShort,this.$W,I,3),dddd:I[this.$W],H:String(C),HH:O.s(C,2,"0"),h:it(1),hh:it(2),a:st(C,k,!0),A:st(C,k,!1),m:String(k),mm:O.s(k,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:v};return p.replace(q,function(W,H){return H||tt[W]||v.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(n,$,i){var p,v=O.p($),C=_(n),k=(C.utcOffset()-this.utcOffset())*c,T=this-C,I=O.m(this,C);return I=(p={},p[o]=I/12,p[h]=I,p[M]=I/3,p[b]=(T-k)/6048e5,p[f]=(T-k)/864e5,p[y]=T/l,p[u]=T/c,p[m]=T/t,p)[v]||T,i?I:O.a(I)},s.daysInMonth=function(){return this.endOf(h).$D},s.$locale=function(){return D[this.$L]},s.locale=function(n,$){if(!n)return this.$L;var i=this.clone(),p=R(n,$,!0);return p&&(i.$L=p),i},s.clone=function(){return O.w(this.$d,this)},s.toDate=function(){return new Date(this.valueOf())},s.toJSON=function(){return this.isValid()?this.toISOString():null},s.toISOString=function(){return this.$d.toISOString()},s.toString=function(){return this.$d.toUTCString()},d}(),dt=at.prototype;return _.prototype=dt,[["$ms",a],["$s",m],["$m",u],["$H",y],["$W",f],["$M",h],["$y",o],["$D",g]].forEach(function(d){dt[d[1]]=function(s){return this.$g(s,d[0],d[1])}}),_.extend=function(d,s){return d.$i||(d(s,at,_),d.$i=!0),_},_.locale=R,_.isDayjs=B,_.unix=function(d){return _(1e3*d)},_.en=D[V],_.Ls=D,_.p={},_})})(mt);const U=mt.exports,A=(r,e="MM/DD HH:mm")=>U(r*1e3).format(e),jt=(r=Math.floor(Date.now()/1e3))=>{const e=r*1e3,t=U(e).year(),c=U(e).month(),l=U(e).date(),a=U(e).day(),m=new Date(t,c,l-a).getTime();return Math.floor(m/1e3)};function It({pointWidth:r,timePerPixel:e,timeSpacing:t,screenScaleCount:c,scaleSpacing:l,scaleHeight:a,startTime:m,drawLine:u,drawText:y}){if(t===1){for(let f=0;f<c;f++){const b=f*l+r/2,h=Math.ceil(m+f*t);if(h%10===0){u(b,a.height5),y(b,a.height5+13,`${A(h,"HH:mm:ss")}`);continue}if(h%5===0){u(b,a.height3);continue}if(h%1===0){u(b,a.height1);continue}}return}if(t===10){const f=+A(m,"s")%10,b=f/e;for(let h=0;h<c;h++){const M=h*l-b-r/2,o=Math.ceil(m+h*t-f);if(o%60===0){u(M,a.height4),y(M,a.height5+13,`${A(o,"HH:mm")}`);continue}if(o%10===0){u(M,a.height1);continue}}return}if(t===30){const f=+A(m,"s")%30,b=f/e;for(let h=0;h<c;h++){const M=h*l-b-r/2,o=Math.ceil(m+h*t-f);if(o%300===0){u(M,a.height4),y(M,a.height5+13,`${A(o,"HH:mm")}`);continue}if(o%30===0){u(M,a.height1);continue}}return}if(t===60){const f=+A(m,"s")%60,b=f/e;for(let h=0;h<c;h++){const M=h*l-b-r/2,o=Math.ceil(m+h*t-f);if(o%3600===0){u(M,a.height5),y(M,a.height5+13,`${A(o)}`);continue}if(o%300===0){u(M,a.height3),o%600===0&&y(M,a.height5+13,`${A(o,"HH:mm")}`);continue}if(o%60===0){u(M,a.height1);continue}}return}if(t===120){const f=A(m,"m:s").split(":"),h=(+f[0]*60+ +f[1])%120,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(m+o*t-h);if(x%1800===0){u(g,a.height5),y(g,a.height5+13,`${A(x)}`);continue}if(x%600===0){u(g,a.height3);continue}if(x%120===0){u(g,a.height1);continue}}return}if(t===300){const f=A(m,"m:s").split(":"),h=(+f[0]*60+ +f[1])%300,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(m+o*t-h);if(x%3600===0){u(g,a.height5),y(g,a.height5+13,`${A(x)}`);continue}if(x%1800===0){u(g,a.height3);continue}if(x%300===0){u(g,a.height1);continue}}return}if(t===7200){const f=A(m,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%7200,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(m+o*t-h);if(x%86400===0){u(g,a.height5),y(g,a.height5+13,`${A(x,"MM/DD HH:mm")}`);continue}if(x%43200===0){u(g,a.height3);continue}if(x%7200===0){u(g,a.height1);continue}}return}if(t===86400){const f=A(m,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%86400,M=h/e;for(let o=0;o<c;o++){const g=o*l-M-r/2,x=Math.ceil(m+o*t-h);if(A(x,"D")==="1"){u(g,a.height5),y(g,a.height5+13,`${A(x,"YYYY/MM/DD")}`);continue}if(x%86400===57600){u(g,a.height1);continue}}return}if(t===604800){const f=m-jt(m),b=f/e,h=new Array(c).fill(!1),M=o=>{for(let g=o;g>o-7;g--)if(h[g])return!1;return!0};for(let o=0;o<c;o++){const g=o*l-b,x=Math.ceil(m+o*t-f);if(U(x*1e3).month()===0&&(U(x*1e3).date()>0||U(x*1e3).date()<=31)&&M(o)){h[o]=!0,u(g,a.height5),y(g,a.height5+13,`${A(x,"YYYY/MM/DD")}`);continue}if(U(x*1e3).day()===0){u(g,a.height1);continue}}return}}const Wt={fill:!1,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",scaleColor:"#ffffff",areaBgColor:"#ffffff55",pointColor:"#00aeec",pointWidth:3,scaleSpacing:7,fps:60,zoom:2,maxZoom:9,minZoom:1,timeFormat:"YYYY/MM/DD HH:mm:ss"};class Et{constructor(e,t){E(this,"$canvas");E(this,"canvasContext");et(this,P,void 0);E(this,"currentTime");E(this,"areas");et(this,J,void 0);et(this,F,void 0);E(this,"scaleSpacing");E(this,"bgColor");et(this,L,void 0);E(this,"pointWidth");E(this,"pointColor");E(this,"textColor");E(this,"scaleColor");E(this,"areaBgColor");et(this,Q,void 0);E(this,"fps");E(this,"timeFormat");if(!e)throw new Error("canvas id is required!");this.$canvas=document.getElementById(e),this.canvasContext=this.$canvas.getContext("2d");const{fill:c,width:l,height:a,bgColor:m,textColor:u,scaleColor:y,areaBgColor:f,pointColor:b,pointWidth:h,scaleSpacing:M,fps:o,zoom:g,maxZoom:x,minZoom:z,timeFormat:q}={...Wt,...t};if(g<z||g>x||g%1!==0)throw new Error(`zoom must be minZoom ~ maxZoom(${z} ~1 ${x}), and must be an integer`);if(x<1||x>9||x%1!==0)throw new Error("maxZoom must be 1 ~ 9, and must be an integer");if(z<1||z>9||z%1!==0)throw new Error("minZoom must be 1 ~ 9, and must be an integer");if(x<z)throw new Error("maxZoom must be greater than minZoom");if(c){const Z=this.$canvas.parentElement;this.$canvas.width=Z.clientWidth,this.$canvas.height=Z.clientHeight,new ResizeObserver(lt(this._onParentResize.bind(this),200)).observe(Z)}else l&&(this.$canvas.width=l),a&&(this.$canvas.height=a);N(this,Q,!1),N(this,P,S()),this.currentTime=0;const K=[1,10,30,60,120,300,7200,86400,604800];N(this,J,[]);for(let Z=z-1;Z<x;Z++)j(this,J).push(K[Z]);N(this,F,K[g-1]),this.scaleSpacing=M,N(this,L,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.bgColor=m,this.pointWidth=h,this.pointColor=b,this.textColor=u,this.scaleColor=y,this.areaBgColor=f,this.fps=o,this.timeFormat=q}draw({currentTime:e,areas:t,_privateFlag:c}={}){if(j(this,Q)&&!c)return;this.currentTime=e||Math.floor(Date.now()/1e3),this.areas=t||[];const l=Math.ceil(this.$canvas.width/this.scaleSpacing),a=l*j(this,F),m=this.currentTime-a/2,u=this.currentTime+a/2,y=this.$canvas.width/2,f=a/this.$canvas.width;this.clear(),this.drawArea(0,0,this.$canvas.width,this.$canvas.height,this.bgColor),this.areas.forEach(b=>{const h=b.startTime<m?0:Math.floor((b.startTime-m)/f),M=b.endTime>u?this.$canvas.width:Math.floor((b.endTime-m)/f);this.drawArea(h,0,M,this.$canvas.height,b.bgColor||this.areaBgColor)}),It.bind(this)({pointWidth:this.pointWidth,timePerPixel:f,scaleHeight:j(this,L),scaleSpacing:this.scaleSpacing,timeSpacing:j(this,F),screenScaleCount:l,startTime:m,drawLine:this.drawLine.bind(this),drawText:this.drawText.bind(this)}),this.drawTimelineScale(j(this,F)),this.drawLine(y-this.pointWidth/2,this.$canvas.height,this.pointWidth,this.pointColor),this.drawArea(y-54,4,y+54,18,this.pointColor),this.drawText(y,6,`${A(this.currentTime,this.timeFormat)}`,this.textColor,"center","top"),this.$canvas.onwheel=this._onZoom.bind(this),this.$canvas.onmousedown=this._onDrag.bind(this)}_onDrag({clientX:e}){N(this,Q,!0);let t=0;document.onmousemove=lt(c=>{const l=c.clientX-e,a=this.currentTime-j(this,F)/this.scaleSpacing*(l-t);t=l,this.draw({currentTime:Math.round(a),areas:this.areas,_privateFlag:!0})},j(this,F)===1?100:1e3/this.fps),document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,N(this,Q,!1),this.emit("timeUpdate",this.currentTime)}}_onZoom(e){e.preventDefault();const t=j(this,J).findIndex(c=>c===j(this,F));e.deltaY<0&&t>0?(N(this,F,j(this,J)[t-1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0})):e.deltaY>0&&t<j(this,J).length-1&&(N(this,F,j(this,J)[t+1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0}))}_onParentResize(){const e=this.$canvas.parentNode;!e||(this.$canvas.width=e.clientWidth,this.$canvas.height=e.clientHeight,N(this,L,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.draw({currentTime:this.currentTime,areas:this.areas}))}clear(){this.canvasContext&&this.canvasContext.clearRect(0,0,this.$canvas.width,this.$canvas.height),this.$canvas&&(this.$canvas.onwheel=null,this.$canvas.onmousedown=null)}drawTimelineScale(e){let t="";switch(e){case 1:t="1s";break;case 10:t="10s";break;case 30:t="30s";break;case 60:t="1min";break;case 120:t="2min";break;case 300:t="5min";break;case 7200:t="2hour";break;case 86400:t="1day";break;case 604800:t="1week";break}this.drawText(this.scaleSpacing+12,9,`${t}`,this.textColor,"left","middle"),this.canvasContext.beginPath(),this.canvasContext.moveTo(5,6),this.canvasContext.lineTo(5,10),this.canvasContext.lineTo(this.scaleSpacing+7,10),this.canvasContext.lineTo(this.scaleSpacing+7,6),this.canvasContext.strokeStyle=this.scaleColor,this.canvasContext.lineWidth=1.5,this.canvasContext.stroke()}drawLine(e,t,c=1,l=this.scaleColor){this.canvasContext.beginPath(),this.canvasContext.moveTo(e,this.$canvas.height),this.canvasContext.lineTo(e,this.$canvas.height-t),this.canvasContext.closePath(),this.canvasContext.strokeStyle=l,this.canvasContext.lineWidth=c,this.canvasContext.stroke()}drawText(e,t,c,l=this.textColor,a="center",m="alphabetic"){this.canvasContext.beginPath(),this.canvasContext.font="11px Arial",this.canvasContext.fillStyle=l,this.canvasContext.textAlign=a,this.canvasContext.textBaseline=m,this.canvasContext.fillText(c,e,t)}drawArea(e,t,c,l,a){this.canvasContext.beginPath(),this.canvasContext.rect(e,t,c-e,l-t),this.canvasContext.fillStyle=a,this.canvasContext.fill()}on(e,t){j(this,P).on(e,t)}off(e,t){j(this,P).off(e,t)}emit(...e){j(this,P).emit(...e)}}return P=new WeakMap,J=new WeakMap,F=new WeakMap,L=new WeakMap,Q=new WeakMap,Et}();

@@ -1,1 +0,1 @@

var Zt=Object.defineProperty;var zt=(T,C,Y)=>C in T?Zt(T,C,{enumerable:!0,configurable:!0,writable:!0,value:Y}):T[C]=Y;var E=(T,C,Y)=>(zt(T,typeof C!="symbol"?C+"":C,Y),Y),$t=(T,C,Y)=>{if(!C.has(T))throw TypeError("Cannot "+Y)};var A=(T,C,Y)=>($t(T,C,"read from private field"),Y?Y.call(T):C.get(T)),et=(T,C,Y)=>{if(C.has(T))throw TypeError("Cannot add the same private member more than once");C instanceof WeakSet?C.add(T):C.set(T,Y)},N=(T,C,Y,nt)=>($t(T,C,"write to private field"),nt?nt.call(T,Y):C.set(T,Y),Y);(function(T,C){typeof exports=="object"&&typeof module<"u"?module.exports=C():typeof define=="function"&&define.amd?define(C):(T=typeof globalThis<"u"?globalThis:T||self,T.$timeline=C())})(this,function(){var P,J,Z,K,Q;"use strict";function T(r){return{all:r=r||new Map,on:function(e,t){var c=r.get(e);c?c.push(t):r.set(e,[t])},off:function(e,t){var c=r.get(e);c&&(t?c.splice(c.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var c=r.get(e);c&&c.slice().map(function(l){l(t)}),(c=r.get("*"))&&c.slice().map(function(l){l(e,t)})}}}var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Y="Expected a function",nt=0/0,vt="[object Symbol]",gt=/^\s+|\s+$/g,pt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,yt=/^0o[0-7]+$/i,Mt=parseInt,bt=typeof C=="object"&&C&&C.Object===Object&&C,Ct=typeof self=="object"&&self&&self.Object===Object&&self,Dt=bt||Ct||Function("return this")(),Ot=Object.prototype,wt=Ot.toString,Tt=Math.max,St=Math.min,ht=function(){return Dt.Date.now()};function _t(r,e,t){var c,l,a,d,u,M,f=0,b=!1,h=!1,y=!0;if(typeof r!="function")throw new TypeError(Y);e=ut(e)||0,rt(t)&&(b=!!t.leading,h="maxWait"in t,a=h?Tt(ut(t.maxWait)||0,e):a,y="trailing"in t?!!t.trailing:y);function o(O){var F=c,R=l;return c=l=void 0,f=O,d=r.apply(R,F),d}function g(O){return f=O,u=setTimeout(V,e),b?o(O):d}function x(O){var F=O-M,R=O-f,_=e-F;return h?St(_,a-R):_}function z(O){var F=O-M,R=O-f;return M===void 0||F>=e||F<0||h&&R>=a}function V(){var O=ht();if(z(O))return B(O);u=setTimeout(V,x(O))}function B(O){return u=void 0,y&&c?o(O):(c=l=void 0,d)}function L(){u!==void 0&&clearTimeout(u),f=0,c=M=l=u=void 0}function ct(){return u===void 0?d:B(ht())}function X(){var O=ht(),F=z(O);if(c=arguments,l=this,M=O,F){if(u===void 0)return g(M);if(h)return u=setTimeout(V,e),o(M)}return u===void 0&&(u=setTimeout(V,e)),d}return X.cancel=L,X.flush=ct,X}function kt(r,e,t){var c=!0,l=!0;if(typeof r!="function")throw new TypeError(Y);return rt(t)&&(c="leading"in t?!!t.leading:c,l="trailing"in t?!!t.trailing:l),_t(r,e,{leading:c,maxWait:e,trailing:l})}function rt(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function Yt(r){return!!r&&typeof r=="object"}function jt(r){return typeof r=="symbol"||Yt(r)&&wt.call(r)==vt}function ut(r){if(typeof r=="number")return r;if(jt(r))return nt;if(rt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=rt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(gt,"");var t=xt.test(r);return t||yt.test(r)?Mt(r.slice(2),t?2:8):pt.test(r)?nt:+r}var lt=kt,dt={exports:{}};(function(r,e){(function(t,c){r.exports=c()})(C,function(){var t=1e3,c=6e4,l=36e5,a="millisecond",d="second",u="minute",M="hour",f="day",b="week",h="month",y="quarter",o="year",g="date",x="Invalid Date",z=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,V=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,B={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(m){var s=["th","st","nd","rd"],n=m%100;return"["+m+(s[(n-20)%10]||s[n]||s[0])+"]"}},L=function(m,s,n){var $=String(m);return!$||$.length>=s?m:""+Array(s+1-$.length).join(n)+m},ct={s:L,z:function(m){var s=-m.utcOffset(),n=Math.abs(s),$=Math.floor(n/60),i=n%60;return(s<=0?"+":"-")+L($,2,"0")+":"+L(i,2,"0")},m:function m(s,n){if(s.date()<n.date())return-m(n,s);var $=12*(n.year()-s.year())+(n.month()-s.month()),i=s.clone().add($,h),p=n-i<0,v=s.clone().add($+(p?-1:1),h);return+(-($+(n-i)/(p?i-v:v-i))||0)},a:function(m){return m<0?Math.ceil(m)||0:Math.floor(m)},p:function(m){return{M:h,y:o,w:b,d:f,D:g,h:M,m:u,s:d,ms:a,Q:y}[m]||String(m||"").toLowerCase().replace(/s$/,"")},u:function(m){return m===void 0}},X="en",O={};O[X]=B;var F=function(m){return m instanceof ot},R=function m(s,n,$){var i;if(!s)return X;if(typeof s=="string"){var p=s.toLowerCase();O[p]&&(i=p),n&&(O[p]=n,i=p);var v=s.split("-");if(!i&&v.length>1)return m(v[0])}else{var D=s.name;O[D]=s,i=D}return!$&&i&&(X=i),i||!$&&X},_=function(m,s){if(F(m))return m.clone();var n=typeof s=="object"?s:{};return n.date=m,n.args=arguments,new ot(n)},w=ct;w.l=R,w.i=F,w.w=function(m,s){return _(m,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var ot=function(){function m(n){this.$L=R(n.locale,null,!0),this.parse(n)}var s=m.prototype;return s.parse=function(n){this.$d=function($){var i=$.date,p=$.utc;if(i===null)return new Date(NaN);if(w.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var v=i.match(z);if(v){var D=v[2]-1||0,k=(v[7]||"0").substring(0,3);return p?new Date(Date.UTC(v[1],D,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)):new Date(v[1],D,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)}}return new Date(i)}(n),this.$x=n.x||{},this.init()},s.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},s.$utils=function(){return w},s.isValid=function(){return this.$d.toString()!==x},s.isSame=function(n,$){var i=_(n);return this.startOf($)<=i&&i<=this.endOf($)},s.isAfter=function(n,$){return _(n)<this.startOf($)},s.isBefore=function(n,$){return this.endOf($)<_(n)},s.$g=function(n,$,i){return w.u(n)?this[$]:this.set(i,n)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(n,$){var i=this,p=!!w.u($)||$,v=w.p(n),D=function(tt,W){var H=w.w(i.$u?Date.UTC(i.$y,W,tt):new Date(i.$y,W,tt),i);return p?H:H.endOf(f)},k=function(tt,W){return w.w(i.toDate()[tt].apply(i.toDate("s"),(p?[0,0,0,0]:[23,59,59,999]).slice(W)),i)},S=this.$W,I=this.$M,G=this.$D,q="set"+(this.$u?"UTC":"");switch(v){case o:return p?D(1,0):D(31,11);case h:return p?D(1,I):D(0,I+1);case b:var it=this.$locale().weekStart||0,st=(S<it?S+7:S)-it;return D(p?G-st:G+(6-st),I);case f:case g:return k(q+"Hours",0);case M:return k(q+"Minutes",1);case u:return k(q+"Seconds",2);case d:return k(q+"Milliseconds",3);default:return this.clone()}},s.endOf=function(n){return this.startOf(n,!1)},s.$set=function(n,$){var i,p=w.p(n),v="set"+(this.$u?"UTC":""),D=(i={},i[f]=v+"Date",i[g]=v+"Date",i[h]=v+"Month",i[o]=v+"FullYear",i[M]=v+"Hours",i[u]=v+"Minutes",i[d]=v+"Seconds",i[a]=v+"Milliseconds",i)[p],k=p===f?this.$D+($-this.$W):$;if(p===h||p===o){var S=this.clone().set(g,1);S.$d[D](k),S.init(),this.$d=S.set(g,Math.min(this.$D,S.daysInMonth())).$d}else D&&this.$d[D](k);return this.init(),this},s.set=function(n,$){return this.clone().$set(n,$)},s.get=function(n){return this[w.p(n)]()},s.add=function(n,$){var i,p=this;n=Number(n);var v=w.p($),D=function(I){var G=_(p);return w.w(G.date(G.date()+Math.round(I*n)),p)};if(v===h)return this.set(h,this.$M+n);if(v===o)return this.set(o,this.$y+n);if(v===f)return D(1);if(v===b)return D(7);var k=(i={},i[u]=c,i[M]=l,i[d]=t,i)[v]||1,S=this.$d.getTime()+n*k;return w.w(S,this)},s.subtract=function(n,$){return this.add(-1*n,$)},s.format=function(n){var $=this,i=this.$locale();if(!this.isValid())return i.invalidDate||x;var p=n||"YYYY-MM-DDTHH:mm:ssZ",v=w.z(this),D=this.$H,k=this.$m,S=this.$M,I=i.weekdays,G=i.months,q=function(W,H,ft,at){return W&&(W[H]||W($,p))||ft[H].slice(0,at)},it=function(W){return w.s(D%12||12,W,"0")},st=i.meridiem||function(W,H,ft){var at=W<12?"AM":"PM";return ft?at.toLowerCase():at},tt={YY:String(this.$y).slice(-2),YYYY:this.$y,M:S+1,MM:w.s(S+1,2,"0"),MMM:q(i.monthsShort,S,G,3),MMMM:q(G,S),D:this.$D,DD:w.s(this.$D,2,"0"),d:String(this.$W),dd:q(i.weekdaysMin,this.$W,I,2),ddd:q(i.weekdaysShort,this.$W,I,3),dddd:I[this.$W],H:String(D),HH:w.s(D,2,"0"),h:it(1),hh:it(2),a:st(D,k,!0),A:st(D,k,!1),m:String(k),mm:w.s(k,2,"0"),s:String(this.$s),ss:w.s(this.$s,2,"0"),SSS:w.s(this.$ms,3,"0"),Z:v};return p.replace(V,function(W,H){return H||tt[W]||v.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(n,$,i){var p,v=w.p($),D=_(n),k=(D.utcOffset()-this.utcOffset())*c,S=this-D,I=w.m(this,D);return I=(p={},p[o]=I/12,p[h]=I,p[y]=I/3,p[b]=(S-k)/6048e5,p[f]=(S-k)/864e5,p[M]=S/l,p[u]=S/c,p[d]=S/t,p)[v]||S,i?I:w.a(I)},s.daysInMonth=function(){return this.endOf(h).$D},s.$locale=function(){return O[this.$L]},s.locale=function(n,$){if(!n)return this.$L;var i=this.clone(),p=R(n,$,!0);return p&&(i.$L=p),i},s.clone=function(){return w.w(this.$d,this)},s.toDate=function(){return new Date(this.valueOf())},s.toJSON=function(){return this.isValid()?this.toISOString():null},s.toISOString=function(){return this.$d.toISOString()},s.toString=function(){return this.$d.toUTCString()},m}(),mt=ot.prototype;return _.prototype=mt,[["$ms",a],["$s",d],["$m",u],["$H",M],["$W",f],["$M",h],["$y",o],["$D",g]].forEach(function(m){mt[m[1]]=function(s){return this.$g(s,m[0],m[1])}}),_.extend=function(m,s){return m.$i||(m(s,ot,_),m.$i=!0),_},_.locale=R,_.isDayjs=F,_.unix=function(m){return _(1e3*m)},_.en=O[X],_.Ls=O,_.p={},_})})(dt);const U=dt.exports,j=(r,e="MM/DD HH:mm")=>U(r*1e3).format(e),At=(r=Math.floor(Date.now()/1e3))=>{const e=r*1e3,t=U(e).year(),c=U(e).month(),l=U(e).date(),a=U(e).day(),d=new Date(t,c,l-a).getTime();return Math.floor(d/1e3)};function It({pointWidth:r,timePerPixel:e,timeSpacing:t,screenScaleCount:c,scaleSpacing:l,scaleHeight:a,startTime:d,drawLine:u,drawText:M}){if(t===1){for(let f=0;f<c;f++){const b=f*l+r/2,h=Math.ceil(d+f*t);if(h%10===0){u(b,a.height5),M(b,a.height5+13,`${j(h,"HH:mm:ss")}`);continue}if(h%5===0){u(b,a.height3);continue}if(h%1===0){u(b,a.height1);continue}}return}if(t===10){const f=+j(d,"s")%10,b=f/e;for(let h=0;h<c;h++){const y=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%60===0){u(y,a.height4),M(y,a.height5+13,`${j(o,"HH:mm")}`);continue}if(o%10===0){u(y,a.height1);continue}}return}if(t===30){const f=+j(d,"s")%30,b=f/e;for(let h=0;h<c;h++){const y=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%(60*5)===0){u(y,a.height4),M(y,a.height5+13,`${j(o,"HH:mm")}`);continue}if(o%30===0){u(y,a.height1);continue}}return}if(t===60){const f=+j(d,"s")%60,b=f/e;for(let h=0;h<c;h++){const y=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%(60*60)===0){u(y,a.height5),M(y,a.height5+13,`${j(o)}`);continue}if(o%(60*5)===0){u(y,a.height3),o%(60*10)===0&&M(y,a.height5+13,`${j(o,"HH:mm")}`);continue}if(o%60===0){u(y,a.height1);continue}}return}if(t===120){const f=j(d,"m:s").split(":"),h=(+f[0]*60+ +f[1])%120,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(x%(60*30)===0){u(g,a.height5),M(g,a.height5+13,`${j(x)}`);continue}if(x%(60*10)===0){u(g,a.height3);continue}if(x%(60*2)===0){u(g,a.height1);continue}}return}if(t===300){const f=j(d,"m:s").split(":"),h=(+f[0]*60+ +f[1])%300,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(x%(60*60)===0){u(g,a.height5),M(g,a.height5+13,`${j(x)}`);continue}if(x%(60*30)===0){u(g,a.height3);continue}if(x%(60*5)===0){u(g,a.height1);continue}}return}if(t===7200){const f=j(d,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%7200,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(x%(3600*24)===0){u(g,a.height5),M(g,a.height5+13,`${j(x,"MM/DD HH:mm")}`);continue}if(x%(3600*12)===0){u(g,a.height3);continue}if(x%7200===0){u(g,a.height1);continue}}return}if(t===86400){const f=j(d,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%86400,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(j(x,"D")==="1"){u(g,a.height5),M(g,a.height5+13,`${j(x,"YYYY/MM/DD")}`);continue}if(x%86400===57600){u(g,a.height1);continue}}return}if(t===604800){const f=d-At(d),b=f/e,h=new Array(c).fill(!1),y=o=>{for(let g=o;g>o-7;g--)if(h[g])return!1;return!0};for(let o=0;o<c;o++){const g=o*l-b,x=Math.ceil(d+o*t-f);if(U(x*1e3).month()===0&&(U(x*1e3).date()>0||U(x*1e3).date()<=31)&&y(o)){h[o]=!0,u(g,a.height5),M(g,a.height5+13,`${j(x,"YYYY/MM/DD")}`);continue}if(U(x*1e3).day()===0){u(g,a.height1);continue}}return}}const Wt={fill:!1,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",scaleColor:"#ffffff",areaBgColor:"#ffffff55",pointColor:"#00aeec",pointWidth:3,scaleSpacing:7,fps:60,zoom:2,maxZoom:9,minZoom:1};class Et{constructor(e,t){E(this,"$canvas");E(this,"canvasContext");et(this,P,void 0);E(this,"currentTime");E(this,"areas");et(this,J,void 0);et(this,Z,void 0);E(this,"scaleSpacing");E(this,"bgColor");et(this,K,void 0);E(this,"pointWidth");E(this,"pointColor");E(this,"textColor");E(this,"scaleColor");E(this,"areaBgColor");et(this,Q,void 0);E(this,"fps");if(!e)throw new Error("canvas id is required!");this.$canvas=document.getElementById(e),this.canvasContext=this.$canvas.getContext("2d");const{fill:c,width:l,height:a,bgColor:d,textColor:u,scaleColor:M,areaBgColor:f,pointColor:b,pointWidth:h,scaleSpacing:y,fps:o,zoom:g,maxZoom:x,minZoom:z}={...Wt,...t};if(g<z||g>x||g%1!==0)throw new Error(`zoom must be minZoom ~ maxZoom(${z} ~1 ${x}), and must be an integer`);if(x<1||x>9||x%1!==0)throw new Error("maxZoom must be 1 ~ 9, and must be an integer");if(z<1||z>9||z%1!==0)throw new Error("minZoom must be 1 ~ 9, and must be an integer");if(x<z)throw new Error("maxZoom must be greater than minZoom");if(c){const B=this.$canvas.parentElement;this.$canvas.width=B.clientWidth,this.$canvas.height=B.clientHeight,new ResizeObserver(lt(this._onParentResize.bind(this),200)).observe(B)}else l&&(this.$canvas.width=l),a&&(this.$canvas.height=a);N(this,Q,!1),N(this,P,T()),this.currentTime=0;const V=[1,10,30,60,120,300,7200,86400,604800];N(this,J,[]);for(let B=z-1;B<x;B++)A(this,J).push(V[B]);N(this,Z,V[g-1]),this.scaleSpacing=y,N(this,K,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.bgColor=d,this.pointWidth=h,this.pointColor=b,this.textColor=u,this.scaleColor=M,this.areaBgColor=f,this.fps=o}draw({currentTime:e,areas:t,_privateFlag:c}={}){if(A(this,Q)&&!c)return;this.currentTime=e||Math.floor(Date.now()/1e3),this.areas=t||[];const l=Math.ceil(this.$canvas.width/this.scaleSpacing),a=l*A(this,Z),d=this.currentTime-a/2,u=this.currentTime+a/2,M=this.$canvas.width/2,f=a/this.$canvas.width;this.clear(),this.drawArea(0,0,this.$canvas.width,this.$canvas.height,this.bgColor),this.areas.forEach(b=>{const h=b.startTime<d?0:Math.floor((b.startTime-d)/f),y=b.endTime>u?this.$canvas.width:Math.floor((b.endTime-d)/f);this.drawArea(h,0,y,this.$canvas.height,b.bgColor||this.areaBgColor)}),It.bind(this)({pointWidth:this.pointWidth,timePerPixel:f,scaleHeight:A(this,K),scaleSpacing:this.scaleSpacing,timeSpacing:A(this,Z),screenScaleCount:l,startTime:d,drawLine:this.drawLine.bind(this),drawText:this.drawText.bind(this)}),this.drawTimelineScale(A(this,Z)),this.drawLine(M-this.pointWidth/2,this.$canvas.height,this.pointWidth,this.pointColor),this.drawArea(M-54,4,M+54,18,this.pointColor),this.drawText(M,6,`${j(this.currentTime,"YYYY/MM/DD HH:mm:ss")}`,this.textColor,"center","top"),this.$canvas.onwheel=this._onZoom.bind(this),this.$canvas.onmousedown=this._onDrag.bind(this)}_onDrag({clientX:e}){N(this,Q,!0);let t=0;document.onmousemove=lt(c=>{const l=c.clientX-e,a=this.currentTime-A(this,Z)/this.scaleSpacing*(l-t);t=l,this.draw({currentTime:Math.round(a),areas:this.areas,_privateFlag:!0})},A(this,Z)===1?100:1e3/this.fps),document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,N(this,Q,!1),this.emit("timeUpdate",this.currentTime)}}_onZoom(e){e.preventDefault();const t=A(this,J).findIndex(c=>c===A(this,Z));e.deltaY<0&&t>0?(N(this,Z,A(this,J)[t-1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0})):e.deltaY>0&&t<A(this,J).length-1&&(N(this,Z,A(this,J)[t+1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0}))}_onParentResize(){const e=this.$canvas.parentNode;!e||(this.$canvas.width=e.clientWidth,this.$canvas.height=e.clientHeight,N(this,K,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.draw({currentTime:this.currentTime,areas:this.areas}))}clear(){this.canvasContext&&this.canvasContext.clearRect(0,0,this.$canvas.width,this.$canvas.height),this.$canvas&&(this.$canvas.onwheel=null,this.$canvas.onmousedown=null)}drawTimelineScale(e){let t="";switch(e){case 1:t="1s";break;case 10:t="10s";break;case 30:t="30s";break;case 60:t="1min";break;case 120:t="2min";break;case 300:t="5min";break;case 7200:t="2hour";break;case 86400:t="1day";break;case 604800:t="1week";break}this.drawText(this.scaleSpacing+12,9,`${t}`,this.textColor,"left","middle"),this.canvasContext.beginPath(),this.canvasContext.moveTo(5,6),this.canvasContext.lineTo(5,10),this.canvasContext.lineTo(this.scaleSpacing+7,10),this.canvasContext.lineTo(this.scaleSpacing+7,6),this.canvasContext.strokeStyle=this.scaleColor,this.canvasContext.lineWidth=1.5,this.canvasContext.stroke()}drawLine(e,t,c=1,l=this.scaleColor){this.canvasContext.beginPath(),this.canvasContext.moveTo(e,this.$canvas.height),this.canvasContext.lineTo(e,this.$canvas.height-t),this.canvasContext.closePath(),this.canvasContext.strokeStyle=l,this.canvasContext.lineWidth=c,this.canvasContext.stroke()}drawText(e,t,c,l=this.textColor,a="center",d="alphabetic"){this.canvasContext.beginPath(),this.canvasContext.font="11px Arial",this.canvasContext.fillStyle=l,this.canvasContext.textAlign=a,this.canvasContext.textBaseline=d,this.canvasContext.fillText(c,e,t)}drawArea(e,t,c,l,a){this.canvasContext.beginPath(),this.canvasContext.rect(e,t,c-e,l-t),this.canvasContext.fillStyle=a,this.canvasContext.fill()}on(e,t){A(this,P).on(e,t)}off(e,t){A(this,P).off(e,t)}emit(...e){A(this,P).emit(...e)}}return P=new WeakMap,J=new WeakMap,Z=new WeakMap,K=new WeakMap,Q=new WeakMap,Et});
var Zt=Object.defineProperty;var Ft=(T,C,Y)=>C in T?Zt(T,C,{enumerable:!0,configurable:!0,writable:!0,value:Y}):T[C]=Y;var E=(T,C,Y)=>(Ft(T,typeof C!="symbol"?C+"":C,Y),Y),$t=(T,C,Y)=>{if(!C.has(T))throw TypeError("Cannot "+Y)};var A=(T,C,Y)=>($t(T,C,"read from private field"),Y?Y.call(T):C.get(T)),et=(T,C,Y)=>{if(C.has(T))throw TypeError("Cannot add the same private member more than once");C instanceof WeakSet?C.add(T):C.set(T,Y)},N=(T,C,Y,nt)=>($t(T,C,"write to private field"),nt?nt.call(T,Y):C.set(T,Y),Y);(function(T,C){typeof exports=="object"&&typeof module<"u"?module.exports=C():typeof define=="function"&&define.amd?define(C):(T=typeof globalThis<"u"?globalThis:T||self,T.$timeline=C())})(this,function(){var P,J,F,L,Q;"use strict";function T(r){return{all:r=r||new Map,on:function(e,t){var c=r.get(e);c?c.push(t):r.set(e,[t])},off:function(e,t){var c=r.get(e);c&&(t?c.splice(c.indexOf(t)>>>0,1):r.set(e,[]))},emit:function(e,t){var c=r.get(e);c&&c.slice().map(function(l){l(t)}),(c=r.get("*"))&&c.slice().map(function(l){l(e,t)})}}}var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Y="Expected a function",nt=0/0,vt="[object Symbol]",gt=/^\s+|\s+$/g,pt=/^[-+]0x[0-9a-f]+$/i,xt=/^0b[01]+$/i,yt=/^0o[0-7]+$/i,Mt=parseInt,bt=typeof C=="object"&&C&&C.Object===Object&&C,Ct=typeof self=="object"&&self&&self.Object===Object&&self,Dt=bt||Ct||Function("return this")(),Ot=Object.prototype,wt=Ot.toString,Tt=Math.max,St=Math.min,ct=function(){return Dt.Date.now()};function _t(r,e,t){var c,l,a,d,u,M,f=0,b=!1,h=!1,y=!0;if(typeof r!="function")throw new TypeError(Y);e=ut(e)||0,rt(t)&&(b=!!t.leading,h="maxWait"in t,a=h?Tt(ut(t.maxWait)||0,e):a,y="trailing"in t?!!t.trailing:y);function o(O){var B=c,R=l;return c=l=void 0,f=O,d=r.apply(R,B),d}function g(O){return f=O,u=setTimeout(q,e),b?o(O):d}function x(O){var B=O-M,R=O-f,_=e-B;return h?St(_,a-R):_}function z(O){var B=O-M,R=O-f;return M===void 0||B>=e||B<0||h&&R>=a}function q(){var O=ct();if(z(O))return K(O);u=setTimeout(q,x(O))}function K(O){return u=void 0,y&&c?o(O):(c=l=void 0,d)}function Z(){u!==void 0&&clearTimeout(u),f=0,c=M=l=u=void 0}function ot(){return u===void 0?d:K(ct())}function V(){var O=ct(),B=z(O);if(c=arguments,l=this,M=O,B){if(u===void 0)return g(M);if(h)return u=setTimeout(q,e),o(M)}return u===void 0&&(u=setTimeout(q,e)),d}return V.cancel=Z,V.flush=ot,V}function kt(r,e,t){var c=!0,l=!0;if(typeof r!="function")throw new TypeError(Y);return rt(t)&&(c="leading"in t?!!t.leading:c,l="trailing"in t?!!t.trailing:l),_t(r,e,{leading:c,maxWait:e,trailing:l})}function rt(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}function Yt(r){return!!r&&typeof r=="object"}function jt(r){return typeof r=="symbol"||Yt(r)&&wt.call(r)==vt}function ut(r){if(typeof r=="number")return r;if(jt(r))return nt;if(rt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=rt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(gt,"");var t=xt.test(r);return t||yt.test(r)?Mt(r.slice(2),t?2:8):pt.test(r)?nt:+r}var lt=kt,dt={exports:{}};(function(r,e){(function(t,c){r.exports=c()})(C,function(){var t=1e3,c=6e4,l=36e5,a="millisecond",d="second",u="minute",M="hour",f="day",b="week",h="month",y="quarter",o="year",g="date",x="Invalid Date",z=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,q=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,K={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(m){var s=["th","st","nd","rd"],n=m%100;return"["+m+(s[(n-20)%10]||s[n]||s[0])+"]"}},Z=function(m,s,n){var $=String(m);return!$||$.length>=s?m:""+Array(s+1-$.length).join(n)+m},ot={s:Z,z:function(m){var s=-m.utcOffset(),n=Math.abs(s),$=Math.floor(n/60),i=n%60;return(s<=0?"+":"-")+Z($,2,"0")+":"+Z(i,2,"0")},m:function m(s,n){if(s.date()<n.date())return-m(n,s);var $=12*(n.year()-s.year())+(n.month()-s.month()),i=s.clone().add($,h),p=n-i<0,v=s.clone().add($+(p?-1:1),h);return+(-($+(n-i)/(p?i-v:v-i))||0)},a:function(m){return m<0?Math.ceil(m)||0:Math.floor(m)},p:function(m){return{M:h,y:o,w:b,d:f,D:g,h:M,m:u,s:d,ms:a,Q:y}[m]||String(m||"").toLowerCase().replace(/s$/,"")},u:function(m){return m===void 0}},V="en",O={};O[V]=K;var B=function(m){return m instanceof at},R=function m(s,n,$){var i;if(!s)return V;if(typeof s=="string"){var p=s.toLowerCase();O[p]&&(i=p),n&&(O[p]=n,i=p);var v=s.split("-");if(!i&&v.length>1)return m(v[0])}else{var D=s.name;O[D]=s,i=D}return!$&&i&&(V=i),i||!$&&V},_=function(m,s){if(B(m))return m.clone();var n=typeof s=="object"?s:{};return n.date=m,n.args=arguments,new at(n)},w=ot;w.l=R,w.i=B,w.w=function(m,s){return _(m,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var at=function(){function m(n){this.$L=R(n.locale,null,!0),this.parse(n)}var s=m.prototype;return s.parse=function(n){this.$d=function($){var i=$.date,p=$.utc;if(i===null)return new Date(NaN);if(w.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var v=i.match(z);if(v){var D=v[2]-1||0,k=(v[7]||"0").substring(0,3);return p?new Date(Date.UTC(v[1],D,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)):new Date(v[1],D,v[3]||1,v[4]||0,v[5]||0,v[6]||0,k)}}return new Date(i)}(n),this.$x=n.x||{},this.init()},s.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},s.$utils=function(){return w},s.isValid=function(){return this.$d.toString()!==x},s.isSame=function(n,$){var i=_(n);return this.startOf($)<=i&&i<=this.endOf($)},s.isAfter=function(n,$){return _(n)<this.startOf($)},s.isBefore=function(n,$){return this.endOf($)<_(n)},s.$g=function(n,$,i){return w.u(n)?this[$]:this.set(i,n)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(n,$){var i=this,p=!!w.u($)||$,v=w.p(n),D=function(tt,W){var H=w.w(i.$u?Date.UTC(i.$y,W,tt):new Date(i.$y,W,tt),i);return p?H:H.endOf(f)},k=function(tt,W){return w.w(i.toDate()[tt].apply(i.toDate("s"),(p?[0,0,0,0]:[23,59,59,999]).slice(W)),i)},S=this.$W,I=this.$M,G=this.$D,X="set"+(this.$u?"UTC":"");switch(v){case o:return p?D(1,0):D(31,11);case h:return p?D(1,I):D(0,I+1);case b:var it=this.$locale().weekStart||0,st=(S<it?S+7:S)-it;return D(p?G-st:G+(6-st),I);case f:case g:return k(X+"Hours",0);case M:return k(X+"Minutes",1);case u:return k(X+"Seconds",2);case d:return k(X+"Milliseconds",3);default:return this.clone()}},s.endOf=function(n){return this.startOf(n,!1)},s.$set=function(n,$){var i,p=w.p(n),v="set"+(this.$u?"UTC":""),D=(i={},i[f]=v+"Date",i[g]=v+"Date",i[h]=v+"Month",i[o]=v+"FullYear",i[M]=v+"Hours",i[u]=v+"Minutes",i[d]=v+"Seconds",i[a]=v+"Milliseconds",i)[p],k=p===f?this.$D+($-this.$W):$;if(p===h||p===o){var S=this.clone().set(g,1);S.$d[D](k),S.init(),this.$d=S.set(g,Math.min(this.$D,S.daysInMonth())).$d}else D&&this.$d[D](k);return this.init(),this},s.set=function(n,$){return this.clone().$set(n,$)},s.get=function(n){return this[w.p(n)]()},s.add=function(n,$){var i,p=this;n=Number(n);var v=w.p($),D=function(I){var G=_(p);return w.w(G.date(G.date()+Math.round(I*n)),p)};if(v===h)return this.set(h,this.$M+n);if(v===o)return this.set(o,this.$y+n);if(v===f)return D(1);if(v===b)return D(7);var k=(i={},i[u]=c,i[M]=l,i[d]=t,i)[v]||1,S=this.$d.getTime()+n*k;return w.w(S,this)},s.subtract=function(n,$){return this.add(-1*n,$)},s.format=function(n){var $=this,i=this.$locale();if(!this.isValid())return i.invalidDate||x;var p=n||"YYYY-MM-DDTHH:mm:ssZ",v=w.z(this),D=this.$H,k=this.$m,S=this.$M,I=i.weekdays,G=i.months,X=function(W,H,ft,ht){return W&&(W[H]||W($,p))||ft[H].slice(0,ht)},it=function(W){return w.s(D%12||12,W,"0")},st=i.meridiem||function(W,H,ft){var ht=W<12?"AM":"PM";return ft?ht.toLowerCase():ht},tt={YY:String(this.$y).slice(-2),YYYY:this.$y,M:S+1,MM:w.s(S+1,2,"0"),MMM:X(i.monthsShort,S,G,3),MMMM:X(G,S),D:this.$D,DD:w.s(this.$D,2,"0"),d:String(this.$W),dd:X(i.weekdaysMin,this.$W,I,2),ddd:X(i.weekdaysShort,this.$W,I,3),dddd:I[this.$W],H:String(D),HH:w.s(D,2,"0"),h:it(1),hh:it(2),a:st(D,k,!0),A:st(D,k,!1),m:String(k),mm:w.s(k,2,"0"),s:String(this.$s),ss:w.s(this.$s,2,"0"),SSS:w.s(this.$ms,3,"0"),Z:v};return p.replace(q,function(W,H){return H||tt[W]||v.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(n,$,i){var p,v=w.p($),D=_(n),k=(D.utcOffset()-this.utcOffset())*c,S=this-D,I=w.m(this,D);return I=(p={},p[o]=I/12,p[h]=I,p[y]=I/3,p[b]=(S-k)/6048e5,p[f]=(S-k)/864e5,p[M]=S/l,p[u]=S/c,p[d]=S/t,p)[v]||S,i?I:w.a(I)},s.daysInMonth=function(){return this.endOf(h).$D},s.$locale=function(){return O[this.$L]},s.locale=function(n,$){if(!n)return this.$L;var i=this.clone(),p=R(n,$,!0);return p&&(i.$L=p),i},s.clone=function(){return w.w(this.$d,this)},s.toDate=function(){return new Date(this.valueOf())},s.toJSON=function(){return this.isValid()?this.toISOString():null},s.toISOString=function(){return this.$d.toISOString()},s.toString=function(){return this.$d.toUTCString()},m}(),mt=at.prototype;return _.prototype=mt,[["$ms",a],["$s",d],["$m",u],["$H",M],["$W",f],["$M",h],["$y",o],["$D",g]].forEach(function(m){mt[m[1]]=function(s){return this.$g(s,m[0],m[1])}}),_.extend=function(m,s){return m.$i||(m(s,at,_),m.$i=!0),_},_.locale=R,_.isDayjs=B,_.unix=function(m){return _(1e3*m)},_.en=O[V],_.Ls=O,_.p={},_})})(dt);const U=dt.exports,j=(r,e="MM/DD HH:mm")=>U(r*1e3).format(e),At=(r=Math.floor(Date.now()/1e3))=>{const e=r*1e3,t=U(e).year(),c=U(e).month(),l=U(e).date(),a=U(e).day(),d=new Date(t,c,l-a).getTime();return Math.floor(d/1e3)};function It({pointWidth:r,timePerPixel:e,timeSpacing:t,screenScaleCount:c,scaleSpacing:l,scaleHeight:a,startTime:d,drawLine:u,drawText:M}){if(t===1){for(let f=0;f<c;f++){const b=f*l+r/2,h=Math.ceil(d+f*t);if(h%10===0){u(b,a.height5),M(b,a.height5+13,`${j(h,"HH:mm:ss")}`);continue}if(h%5===0){u(b,a.height3);continue}if(h%1===0){u(b,a.height1);continue}}return}if(t===10){const f=+j(d,"s")%10,b=f/e;for(let h=0;h<c;h++){const y=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%60===0){u(y,a.height4),M(y,a.height5+13,`${j(o,"HH:mm")}`);continue}if(o%10===0){u(y,a.height1);continue}}return}if(t===30){const f=+j(d,"s")%30,b=f/e;for(let h=0;h<c;h++){const y=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%(60*5)===0){u(y,a.height4),M(y,a.height5+13,`${j(o,"HH:mm")}`);continue}if(o%30===0){u(y,a.height1);continue}}return}if(t===60){const f=+j(d,"s")%60,b=f/e;for(let h=0;h<c;h++){const y=h*l-b-r/2,o=Math.ceil(d+h*t-f);if(o%(60*60)===0){u(y,a.height5),M(y,a.height5+13,`${j(o)}`);continue}if(o%(60*5)===0){u(y,a.height3),o%(60*10)===0&&M(y,a.height5+13,`${j(o,"HH:mm")}`);continue}if(o%60===0){u(y,a.height1);continue}}return}if(t===120){const f=j(d,"m:s").split(":"),h=(+f[0]*60+ +f[1])%120,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(x%(60*30)===0){u(g,a.height5),M(g,a.height5+13,`${j(x)}`);continue}if(x%(60*10)===0){u(g,a.height3);continue}if(x%(60*2)===0){u(g,a.height1);continue}}return}if(t===300){const f=j(d,"m:s").split(":"),h=(+f[0]*60+ +f[1])%300,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(x%(60*60)===0){u(g,a.height5),M(g,a.height5+13,`${j(x)}`);continue}if(x%(60*30)===0){u(g,a.height3);continue}if(x%(60*5)===0){u(g,a.height1);continue}}return}if(t===7200){const f=j(d,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%7200,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(x%(3600*24)===0){u(g,a.height5),M(g,a.height5+13,`${j(x,"MM/DD HH:mm")}`);continue}if(x%(3600*12)===0){u(g,a.height3);continue}if(x%7200===0){u(g,a.height1);continue}}return}if(t===86400){const f=j(d,"H:m:s").split(":"),h=(+f[0]*3600+ +f[1]*60+ +f[2])%86400,y=h/e;for(let o=0;o<c;o++){const g=o*l-y-r/2,x=Math.ceil(d+o*t-h);if(j(x,"D")==="1"){u(g,a.height5),M(g,a.height5+13,`${j(x,"YYYY/MM/DD")}`);continue}if(x%86400===57600){u(g,a.height1);continue}}return}if(t===604800){const f=d-At(d),b=f/e,h=new Array(c).fill(!1),y=o=>{for(let g=o;g>o-7;g--)if(h[g])return!1;return!0};for(let o=0;o<c;o++){const g=o*l-b,x=Math.ceil(d+o*t-f);if(U(x*1e3).month()===0&&(U(x*1e3).date()>0||U(x*1e3).date()<=31)&&y(o)){h[o]=!0,u(g,a.height5),M(g,a.height5+13,`${j(x,"YYYY/MM/DD")}`);continue}if(U(x*1e3).day()===0){u(g,a.height1);continue}}return}}const Wt={fill:!1,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",scaleColor:"#ffffff",areaBgColor:"#ffffff55",pointColor:"#00aeec",pointWidth:3,scaleSpacing:7,fps:60,zoom:2,maxZoom:9,minZoom:1,timeFormat:"YYYY/MM/DD HH:mm:ss"};class Et{constructor(e,t){E(this,"$canvas");E(this,"canvasContext");et(this,P,void 0);E(this,"currentTime");E(this,"areas");et(this,J,void 0);et(this,F,void 0);E(this,"scaleSpacing");E(this,"bgColor");et(this,L,void 0);E(this,"pointWidth");E(this,"pointColor");E(this,"textColor");E(this,"scaleColor");E(this,"areaBgColor");et(this,Q,void 0);E(this,"fps");E(this,"timeFormat");if(!e)throw new Error("canvas id is required!");this.$canvas=document.getElementById(e),this.canvasContext=this.$canvas.getContext("2d");const{fill:c,width:l,height:a,bgColor:d,textColor:u,scaleColor:M,areaBgColor:f,pointColor:b,pointWidth:h,scaleSpacing:y,fps:o,zoom:g,maxZoom:x,minZoom:z,timeFormat:q}={...Wt,...t};if(g<z||g>x||g%1!==0)throw new Error(`zoom must be minZoom ~ maxZoom(${z} ~1 ${x}), and must be an integer`);if(x<1||x>9||x%1!==0)throw new Error("maxZoom must be 1 ~ 9, and must be an integer");if(z<1||z>9||z%1!==0)throw new Error("minZoom must be 1 ~ 9, and must be an integer");if(x<z)throw new Error("maxZoom must be greater than minZoom");if(c){const Z=this.$canvas.parentElement;this.$canvas.width=Z.clientWidth,this.$canvas.height=Z.clientHeight,new ResizeObserver(lt(this._onParentResize.bind(this),200)).observe(Z)}else l&&(this.$canvas.width=l),a&&(this.$canvas.height=a);N(this,Q,!1),N(this,P,T()),this.currentTime=0;const K=[1,10,30,60,120,300,7200,86400,604800];N(this,J,[]);for(let Z=z-1;Z<x;Z++)A(this,J).push(K[Z]);N(this,F,K[g-1]),this.scaleSpacing=y,N(this,L,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.bgColor=d,this.pointWidth=h,this.pointColor=b,this.textColor=u,this.scaleColor=M,this.areaBgColor=f,this.fps=o,this.timeFormat=q}draw({currentTime:e,areas:t,_privateFlag:c}={}){if(A(this,Q)&&!c)return;this.currentTime=e||Math.floor(Date.now()/1e3),this.areas=t||[];const l=Math.ceil(this.$canvas.width/this.scaleSpacing),a=l*A(this,F),d=this.currentTime-a/2,u=this.currentTime+a/2,M=this.$canvas.width/2,f=a/this.$canvas.width;this.clear(),this.drawArea(0,0,this.$canvas.width,this.$canvas.height,this.bgColor),this.areas.forEach(b=>{const h=b.startTime<d?0:Math.floor((b.startTime-d)/f),y=b.endTime>u?this.$canvas.width:Math.floor((b.endTime-d)/f);this.drawArea(h,0,y,this.$canvas.height,b.bgColor||this.areaBgColor)}),It.bind(this)({pointWidth:this.pointWidth,timePerPixel:f,scaleHeight:A(this,L),scaleSpacing:this.scaleSpacing,timeSpacing:A(this,F),screenScaleCount:l,startTime:d,drawLine:this.drawLine.bind(this),drawText:this.drawText.bind(this)}),this.drawTimelineScale(A(this,F)),this.drawLine(M-this.pointWidth/2,this.$canvas.height,this.pointWidth,this.pointColor),this.drawArea(M-54,4,M+54,18,this.pointColor),this.drawText(M,6,`${j(this.currentTime,this.timeFormat)}`,this.textColor,"center","top"),this.$canvas.onwheel=this._onZoom.bind(this),this.$canvas.onmousedown=this._onDrag.bind(this)}_onDrag({clientX:e}){N(this,Q,!0);let t=0;document.onmousemove=lt(c=>{const l=c.clientX-e,a=this.currentTime-A(this,F)/this.scaleSpacing*(l-t);t=l,this.draw({currentTime:Math.round(a),areas:this.areas,_privateFlag:!0})},A(this,F)===1?100:1e3/this.fps),document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,N(this,Q,!1),this.emit("timeUpdate",this.currentTime)}}_onZoom(e){e.preventDefault();const t=A(this,J).findIndex(c=>c===A(this,F));e.deltaY<0&&t>0?(N(this,F,A(this,J)[t-1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0})):e.deltaY>0&&t<A(this,J).length-1&&(N(this,F,A(this,J)[t+1]),this.draw({currentTime:this.currentTime,areas:this.areas,_privateFlag:!0}))}_onParentResize(){const e=this.$canvas.parentNode;!e||(this.$canvas.width=e.clientWidth,this.$canvas.height=e.clientHeight,N(this,L,{height6:this.$canvas.height/2,height5:this.$canvas.height/3,height4:this.$canvas.height/4,height3:this.$canvas.height/5,height2:this.$canvas.height/8,height1:this.$canvas.height/10}),this.draw({currentTime:this.currentTime,areas:this.areas}))}clear(){this.canvasContext&&this.canvasContext.clearRect(0,0,this.$canvas.width,this.$canvas.height),this.$canvas&&(this.$canvas.onwheel=null,this.$canvas.onmousedown=null)}drawTimelineScale(e){let t="";switch(e){case 1:t="1s";break;case 10:t="10s";break;case 30:t="30s";break;case 60:t="1min";break;case 120:t="2min";break;case 300:t="5min";break;case 7200:t="2hour";break;case 86400:t="1day";break;case 604800:t="1week";break}this.drawText(this.scaleSpacing+12,9,`${t}`,this.textColor,"left","middle"),this.canvasContext.beginPath(),this.canvasContext.moveTo(5,6),this.canvasContext.lineTo(5,10),this.canvasContext.lineTo(this.scaleSpacing+7,10),this.canvasContext.lineTo(this.scaleSpacing+7,6),this.canvasContext.strokeStyle=this.scaleColor,this.canvasContext.lineWidth=1.5,this.canvasContext.stroke()}drawLine(e,t,c=1,l=this.scaleColor){this.canvasContext.beginPath(),this.canvasContext.moveTo(e,this.$canvas.height),this.canvasContext.lineTo(e,this.$canvas.height-t),this.canvasContext.closePath(),this.canvasContext.strokeStyle=l,this.canvasContext.lineWidth=c,this.canvasContext.stroke()}drawText(e,t,c,l=this.textColor,a="center",d="alphabetic"){this.canvasContext.beginPath(),this.canvasContext.font="11px Arial",this.canvasContext.fillStyle=l,this.canvasContext.textAlign=a,this.canvasContext.textBaseline=d,this.canvasContext.fillText(c,e,t)}drawArea(e,t,c,l,a){this.canvasContext.beginPath(),this.canvasContext.rect(e,t,c-e,l-t),this.canvasContext.fillStyle=a,this.canvasContext.fill()}on(e,t){A(this,P).on(e,t)}off(e,t){A(this,P).off(e,t)}emit(...e){A(this,P).emit(...e)}}return P=new WeakMap,J=new WeakMap,F=new WeakMap,L=new WeakMap,Q=new WeakMap,Et});
{
"name": "@losting/timeline",
"version": "2.1.0",
"version": "2.2.0",
"description": "canvas timeline",

@@ -43,9 +43,9 @@ "type": "module",

"@types/lodash.throttle": "^4.1.7",
"dayjs": "^1.11.6",
"dayjs": "^1.11.7",
"lodash.throttle": "^4.1.1",
"mitt": "^3.0.0",
"release-it": "^15.5.0",
"typescript": "^4.8.4",
"vite": "^3.2.3"
"release-it": "^15.10.1",
"typescript": "^4.9.5",
"vite": "^3.2.6"
}
}
<!--
* @Author: losting
* @Date: 2022-05-07 15:31:25
* @LastEditTime: 2022-11-14 17:51:32
* @LastEditTime: 2023-02-21 10:27:02
* @LastEditors: thelostword

@@ -9,7 +9,8 @@ * @Description:

-->
中文 | [English](./README_EN.md)
# timeline
canvas 时间轴,支持缩放、拖拽、无限滚动
![preview](./example/demo.png)
Canvas 时间轴,支持缩放、拖拽、无限滚动
![预览图](./example/demo.png)
### 使用 es module
### es module
``` shell

@@ -89,7 +90,7 @@ npm install @losting/timeline

| fps | number | 60 | 帧数 |
| zoom | number | 2 | 初始缩放值,`minZoom` ~ `maxZoom` 之间(包含)的正整数 |
| maxZoom | number | 9 | 最大缩放限制,1~9之间的正整数 |
| minZoom | number | 1 | 最小缩放限制,1~9之间的正整数 |
| zoom | integer | 2 | 初始缩放值,`minZoom` ~ `maxZoom` 之间(包含)的正整数 |
| maxZoom | integer | 9 | 最大缩放限制,1~9之间的整数 |
| minZoom | integer | 1 | 最小缩放限制,1~9之间的整数 |
| timeFormat | string | YYYY/MM/DD HH:mm:ss | 时间格式 |
### 事件

@@ -96,0 +97,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc