@losting/timeline
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -1,105 +0,93 @@ | ||
var kt = Object.defineProperty; | ||
var Xt = (a, t, e) => t in a ? kt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e; | ||
var et = (a, t, e) => (Xt(a, typeof t != "symbol" ? t + "" : t, e), e), yt = (a, t, e) => { | ||
if (!t.has(a)) | ||
throw TypeError("Cannot " + e); | ||
var Et = Object.defineProperty; | ||
var xt = (a) => { | ||
throw TypeError(a); | ||
}; | ||
var r = (a, t, e) => (yt(a, t, "read from private field"), e ? e.call(a) : t.get(a)), y = (a, t, e) => { | ||
if (t.has(a)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
t instanceof WeakSet ? t.add(a) : t.set(a, e); | ||
}, b = (a, t, e, o) => (yt(a, t, "write to private field"), o ? o.call(a, e) : t.set(a, e), e); | ||
var O = (a, t, e) => (yt(a, t, "access private method"), e); | ||
function zt(a) { | ||
var Wt = (a, t, e) => t in a ? Et(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e; | ||
var ht = (a, t, e) => Wt(a, typeof t != "symbol" ? t + "" : t, e), $t = (a, t, e) => t.has(a) || xt("Cannot " + e); | ||
var o = (a, t, e) => ($t(a, t, "read from private field"), e ? e.call(a) : t.get(a)), A = (a, t, e) => t.has(a) ? xt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e), z = (a, t, e, n) => ($t(a, t, "write to private field"), n ? n.call(a, e) : t.set(a, e), e), N = (a, t, e) => ($t(a, t, "access private method"), e); | ||
function Pt(a) { | ||
return { all: a = a || /* @__PURE__ */ new Map(), on: function(t, e) { | ||
var o = a.get(t); | ||
o ? o.push(e) : a.set(t, [e]); | ||
var n = a.get(t); | ||
n ? n.push(e) : a.set(t, [e]); | ||
}, off: function(t, e) { | ||
var o = a.get(t); | ||
o && (e ? o.splice(o.indexOf(e) >>> 0, 1) : a.set(t, [])); | ||
var n = a.get(t); | ||
n && (e ? n.splice(n.indexOf(e) >>> 0, 1) : a.set(t, [])); | ||
}, emit: function(t, e) { | ||
var o = a.get(t); | ||
o && o.slice().map(function(f) { | ||
f(e); | ||
}), (o = a.get("*")) && o.slice().map(function(f) { | ||
f(t, e); | ||
var n = a.get(t); | ||
n && n.slice().map(function(g) { | ||
g(e); | ||
}), (n = a.get("*")) && n.slice().map(function(g) { | ||
g(t, e); | ||
}); | ||
} }; | ||
} | ||
var At = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; | ||
function It(a) { | ||
var pt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; | ||
function Mt(a) { | ||
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a; | ||
} | ||
var Ft = { exports: {} }; | ||
var St = { exports: {} }; | ||
(function(a, t) { | ||
(function(e, o) { | ||
a.exports = o(); | ||
})(At, function() { | ||
var e = 1e3, o = 6e4, f = 36e5, m = "millisecond", g = "second", d = "minute", M = "hour", T = "day", S = "week", v = "month", G = "quarter", C = "year", z = "date", rt = "Invalid Date", Mt = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, Dt = /\[([^\]]+)]|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, at = { 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(c) { | ||
var n = ["th", "st", "nd", "rd"], i = c % 100; | ||
return "[" + c + (n[(i - 20) % 10] || n[i] || n[0]) + "]"; | ||
} }, Q = function(c, n, i) { | ||
var h = String(c); | ||
return !h || h.length >= n ? c : "" + Array(n + 1 - h.length).join(i) + c; | ||
}, Z = { s: Q, z: function(c) { | ||
var n = -c.utcOffset(), i = Math.abs(n), h = Math.floor(i / 60), s = i % 60; | ||
return (n <= 0 ? "+" : "-") + Q(h, 2, "0") + ":" + Q(s, 2, "0"); | ||
}, m: function c(n, i) { | ||
if (n.date() < i.date()) | ||
return -c(i, n); | ||
var h = 12 * (i.year() - n.year()) + (i.month() - n.month()), s = n.clone().add(h, v), u = i - s < 0, l = n.clone().add(h + (u ? -1 : 1), v); | ||
return +(-(h + (i - s) / (u ? s - l : l - s)) || 0); | ||
}, a: function(c) { | ||
return c < 0 ? Math.ceil(c) || 0 : Math.floor(c); | ||
}, p: function(c) { | ||
return { M: v, y: C, w: S, d: T, D: z, h: M, m: d, s: g, ms: m, Q: G }[c] || String(c || "").toLowerCase().replace(/s$/, ""); | ||
}, u: function(c) { | ||
return c === void 0; | ||
} }, k = "en", P = {}; | ||
P[k] = at; | ||
var xt = "$isDayjsObject", Tt = function(c) { | ||
return c instanceof ht || !(!c || !c[xt]); | ||
}, ot = function c(n, i, h) { | ||
(function(e, n) { | ||
a.exports = n(); | ||
})(pt, function() { | ||
var e = 1e3, n = 6e4, g = 36e5, p = "millisecond", l = "second", m = "minute", u = "hour", y = "day", H = "week", D = "month", S = "quarter", T = "year", v = "date", h = "Invalid Date", x = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, E = /\[([^\]]+)]|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, L = { 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(f) { | ||
var r = ["th", "st", "nd", "rd"], i = f % 100; | ||
return "[" + f + (r[(i - 20) % 10] || r[i] || r[0]) + "]"; | ||
} }, Y = function(f, r, i) { | ||
var c = String(f); | ||
return !c || c.length >= r ? f : "" + Array(r + 1 - c.length).join(i) + f; | ||
}, k = { s: Y, z: function(f) { | ||
var r = -f.utcOffset(), i = Math.abs(r), c = Math.floor(i / 60), s = i % 60; | ||
return (r <= 0 ? "+" : "-") + Y(c, 2, "0") + ":" + Y(s, 2, "0"); | ||
}, m: function f(r, i) { | ||
if (r.date() < i.date()) return -f(i, r); | ||
var c = 12 * (i.year() - r.year()) + (i.month() - r.month()), s = r.clone().add(c, D), d = i - s < 0, $ = r.clone().add(c + (d ? -1 : 1), D); | ||
return +(-(c + (i - s) / (d ? s - $ : $ - s)) || 0); | ||
}, a: function(f) { | ||
return f < 0 ? Math.ceil(f) || 0 : Math.floor(f); | ||
}, p: function(f) { | ||
return { M: D, y: T, w: H, d: y, D: v, h: u, m, s: l, ms: p, Q: S }[f] || String(f || "").toLowerCase().replace(/s$/, ""); | ||
}, u: function(f) { | ||
return f === void 0; | ||
} }, b = "en", W = {}; | ||
W[b] = L; | ||
var I = "$isDayjsObject", B = function(f) { | ||
return f instanceof lt || !(!f || !f[I]); | ||
}, j = function f(r, i, c) { | ||
var s; | ||
if (!n) | ||
return k; | ||
if (typeof n == "string") { | ||
var u = n.toLowerCase(); | ||
P[u] && (s = u), i && (P[u] = i, s = u); | ||
var l = n.split("-"); | ||
if (!s && l.length > 1) | ||
return c(l[0]); | ||
if (!r) return b; | ||
if (typeof r == "string") { | ||
var d = r.toLowerCase(); | ||
W[d] && (s = d), i && (W[d] = i, s = d); | ||
var $ = r.split("-"); | ||
if (!s && $.length > 1) return f($[0]); | ||
} else { | ||
var p = n.name; | ||
P[p] = n, s = p; | ||
var w = r.name; | ||
W[w] = r, s = w; | ||
} | ||
return !h && s && (k = s), s || !h && k; | ||
}, x = function(c, n) { | ||
if (Tt(c)) | ||
return c.clone(); | ||
var i = typeof n == "object" ? n : {}; | ||
return i.date = c, i.args = arguments, new ht(i); | ||
}, $ = Z; | ||
$.l = ot, $.i = Tt, $.w = function(c, n) { | ||
return x(c, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset }); | ||
return !c && s && (b = s), s || !c && b; | ||
}, O = function(f, r) { | ||
if (B(f)) return f.clone(); | ||
var i = typeof r == "object" ? r : {}; | ||
return i.date = f, i.args = arguments, new lt(i); | ||
}, M = k; | ||
M.l = j, M.i = B, M.w = function(f, r) { | ||
return O(f, { locale: r.$L, utc: r.$u, x: r.$x, $offset: r.$offset }); | ||
}; | ||
var ht = function() { | ||
function c(i) { | ||
this.$L = ot(i.locale, null, !0), this.parse(i), this.$x = this.$x || i.x || {}, this[xt] = !0; | ||
var lt = function() { | ||
function f(i) { | ||
this.$L = j(i.locale, null, !0), this.parse(i), this.$x = this.$x || i.x || {}, this[I] = !0; | ||
} | ||
var n = c.prototype; | ||
return n.parse = function(i) { | ||
this.$d = function(h) { | ||
var s = h.date, u = h.utc; | ||
if (s === null) | ||
return /* @__PURE__ */ new Date(NaN); | ||
if ($.u(s)) | ||
return /* @__PURE__ */ new Date(); | ||
if (s instanceof Date) | ||
return new Date(s); | ||
var r = f.prototype; | ||
return r.parse = function(i) { | ||
this.$d = function(c) { | ||
var s = c.date, d = c.utc; | ||
if (s === null) return /* @__PURE__ */ new Date(NaN); | ||
if (M.u(s)) return /* @__PURE__ */ new Date(); | ||
if (s instanceof Date) return new Date(s); | ||
if (typeof s == "string" && !/Z$/i.test(s)) { | ||
var l = s.match(Mt); | ||
if (l) { | ||
var p = l[2] - 1 || 0, w = (l[7] || "0").substring(0, 3); | ||
return u ? new Date(Date.UTC(l[1], p, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, w)) : new Date(l[1], p, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, w); | ||
var $ = s.match(x); | ||
if ($) { | ||
var w = $[2] - 1 || 0, _ = ($[7] || "0").substring(0, 3); | ||
return d ? new Date(Date.UTC($[1], w, $[3] || 1, $[4] || 0, $[5] || 0, $[6] || 0, _)) : new Date($[1], w, $[3] || 1, $[4] || 0, $[5] || 0, $[6] || 0, _); | ||
} | ||
@@ -109,242 +97,377 @@ } | ||
}(i), this.init(); | ||
}, n.init = function() { | ||
}, r.init = function() { | ||
var i = this.$d; | ||
this.$y = i.getFullYear(), this.$M = i.getMonth(), this.$D = i.getDate(), this.$W = i.getDay(), this.$H = i.getHours(), this.$m = i.getMinutes(), this.$s = i.getSeconds(), this.$ms = i.getMilliseconds(); | ||
}, n.$utils = function() { | ||
return $; | ||
}, n.isValid = function() { | ||
return this.$d.toString() !== rt; | ||
}, n.isSame = function(i, h) { | ||
var s = x(i); | ||
return this.startOf(h) <= s && s <= this.endOf(h); | ||
}, n.isAfter = function(i, h) { | ||
return x(i) < this.startOf(h); | ||
}, n.isBefore = function(i, h) { | ||
return this.endOf(h) < x(i); | ||
}, n.$g = function(i, h, s) { | ||
return $.u(i) ? this[h] : this.set(s, i); | ||
}, n.unix = function() { | ||
}, r.$utils = function() { | ||
return M; | ||
}, r.isValid = function() { | ||
return this.$d.toString() !== h; | ||
}, r.isSame = function(i, c) { | ||
var s = O(i); | ||
return this.startOf(c) <= s && s <= this.endOf(c); | ||
}, r.isAfter = function(i, c) { | ||
return O(i) < this.startOf(c); | ||
}, r.isBefore = function(i, c) { | ||
return this.endOf(c) < O(i); | ||
}, r.$g = function(i, c, s) { | ||
return M.u(i) ? this[c] : this.set(s, i); | ||
}, r.unix = function() { | ||
return Math.floor(this.valueOf() / 1e3); | ||
}, n.valueOf = function() { | ||
}, r.valueOf = function() { | ||
return this.$d.getTime(); | ||
}, n.startOf = function(i, h) { | ||
var s = this, u = !!$.u(h) || h, l = $.p(i), p = function(B, L) { | ||
var A = $.w(s.$u ? Date.UTC(s.$y, L, B) : new Date(s.$y, L, B), s); | ||
return u ? A : A.endOf(T); | ||
}, w = function(B, L) { | ||
return $.w(s.toDate()[B].apply(s.toDate("s"), (u ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(L)), s); | ||
}, Y = this.$W, F = this.$M, _ = this.$D, q = "set" + (this.$u ? "UTC" : ""); | ||
switch (l) { | ||
case C: | ||
return u ? p(1, 0) : p(31, 11); | ||
}, r.startOf = function(i, c) { | ||
var s = this, d = !!M.u(c) || c, $ = M.p(i), w = function(et, Z) { | ||
var G = M.w(s.$u ? Date.UTC(s.$y, Z, et) : new Date(s.$y, Z, et), s); | ||
return d ? G : G.endOf(y); | ||
}, _ = function(et, Z) { | ||
return M.w(s.toDate()[et].apply(s.toDate("s"), (d ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(Z)), s); | ||
}, P = this.$W, U = this.$M, R = this.$D, st = "set" + (this.$u ? "UTC" : ""); | ||
switch ($) { | ||
case T: | ||
return d ? w(1, 0) : w(31, 11); | ||
case D: | ||
return d ? w(1, U) : w(0, U + 1); | ||
case H: | ||
var tt = this.$locale().weekStart || 0, at = (P < tt ? P + 7 : P) - tt; | ||
return w(d ? R - at : R + (6 - at), U); | ||
case y: | ||
case v: | ||
return u ? p(1, F) : p(0, F + 1); | ||
case S: | ||
var R = this.$locale().weekStart || 0, K = (Y < R ? Y + 7 : Y) - R; | ||
return p(u ? _ - K : _ + (6 - K), F); | ||
case T: | ||
case z: | ||
return w(q + "Hours", 0); | ||
case M: | ||
return w(q + "Minutes", 1); | ||
case d: | ||
return w(q + "Seconds", 2); | ||
case g: | ||
return w(q + "Milliseconds", 3); | ||
return _(st + "Hours", 0); | ||
case u: | ||
return _(st + "Minutes", 1); | ||
case m: | ||
return _(st + "Seconds", 2); | ||
case l: | ||
return _(st + "Milliseconds", 3); | ||
default: | ||
return this.clone(); | ||
} | ||
}, n.endOf = function(i) { | ||
}, r.endOf = function(i) { | ||
return this.startOf(i, !1); | ||
}, n.$set = function(i, h) { | ||
var s, u = $.p(i), l = "set" + (this.$u ? "UTC" : ""), p = (s = {}, s[T] = l + "Date", s[z] = l + "Date", s[v] = l + "Month", s[C] = l + "FullYear", s[M] = l + "Hours", s[d] = l + "Minutes", s[g] = l + "Seconds", s[m] = l + "Milliseconds", s)[u], w = u === T ? this.$D + (h - this.$W) : h; | ||
if (u === v || u === C) { | ||
var Y = this.clone().set(z, 1); | ||
Y.$d[p](w), Y.init(), this.$d = Y.set(z, Math.min(this.$D, Y.daysInMonth())).$d; | ||
} else | ||
p && this.$d[p](w); | ||
}, r.$set = function(i, c) { | ||
var s, d = M.p(i), $ = "set" + (this.$u ? "UTC" : ""), w = (s = {}, s[y] = $ + "Date", s[v] = $ + "Date", s[D] = $ + "Month", s[T] = $ + "FullYear", s[u] = $ + "Hours", s[m] = $ + "Minutes", s[l] = $ + "Seconds", s[p] = $ + "Milliseconds", s)[d], _ = d === y ? this.$D + (c - this.$W) : c; | ||
if (d === D || d === T) { | ||
var P = this.clone().set(v, 1); | ||
P.$d[w](_), P.init(), this.$d = P.set(v, Math.min(this.$D, P.daysInMonth())).$d; | ||
} else w && this.$d[w](_); | ||
return this.init(), this; | ||
}, n.set = function(i, h) { | ||
return this.clone().$set(i, h); | ||
}, n.get = function(i) { | ||
return this[$.p(i)](); | ||
}, n.add = function(i, h) { | ||
var s, u = this; | ||
}, r.set = function(i, c) { | ||
return this.clone().$set(i, c); | ||
}, r.get = function(i) { | ||
return this[M.p(i)](); | ||
}, r.add = function(i, c) { | ||
var s, d = this; | ||
i = Number(i); | ||
var l = $.p(h), p = function(F) { | ||
var _ = x(u); | ||
return $.w(_.date(_.date() + Math.round(F * i)), u); | ||
var $ = M.p(c), w = function(U) { | ||
var R = O(d); | ||
return M.w(R.date(R.date() + Math.round(U * i)), d); | ||
}; | ||
if (l === v) | ||
return this.set(v, this.$M + i); | ||
if (l === C) | ||
return this.set(C, this.$y + i); | ||
if (l === T) | ||
return p(1); | ||
if (l === S) | ||
return p(7); | ||
var w = (s = {}, s[d] = o, s[M] = f, s[g] = e, s)[l] || 1, Y = this.$d.getTime() + i * w; | ||
return $.w(Y, this); | ||
}, n.subtract = function(i, h) { | ||
return this.add(-1 * i, h); | ||
}, n.format = function(i) { | ||
var h = this, s = this.$locale(); | ||
if (!this.isValid()) | ||
return s.invalidDate || rt; | ||
var u = i || "YYYY-MM-DDTHH:mm:ssZ", l = $.z(this), p = this.$H, w = this.$m, Y = this.$M, F = s.weekdays, _ = s.months, q = s.meridiem, R = function(L, A, tt, ct) { | ||
return L && (L[A] || L(h, u)) || tt[A].slice(0, ct); | ||
}, K = function(L) { | ||
return $.s(p % 12 || 12, L, "0"); | ||
}, B = q || function(L, A, tt) { | ||
var ct = L < 12 ? "AM" : "PM"; | ||
return tt ? ct.toLowerCase() : ct; | ||
if ($ === D) return this.set(D, this.$M + i); | ||
if ($ === T) return this.set(T, this.$y + i); | ||
if ($ === y) return w(1); | ||
if ($ === H) return w(7); | ||
var _ = (s = {}, s[m] = n, s[u] = g, s[l] = e, s)[$] || 1, P = this.$d.getTime() + i * _; | ||
return M.w(P, this); | ||
}, r.subtract = function(i, c) { | ||
return this.add(-1 * i, c); | ||
}, r.format = function(i) { | ||
var c = this, s = this.$locale(); | ||
if (!this.isValid()) return s.invalidDate || h; | ||
var d = i || "YYYY-MM-DDTHH:mm:ssZ", $ = M.z(this), w = this.$H, _ = this.$m, P = this.$M, U = s.weekdays, R = s.months, st = s.meridiem, tt = function(Z, G, ot, mt) { | ||
return Z && (Z[G] || Z(c, d)) || ot[G].slice(0, mt); | ||
}, at = function(Z) { | ||
return M.s(w % 12 || 12, Z, "0"); | ||
}, et = st || function(Z, G, ot) { | ||
var mt = Z < 12 ? "AM" : "PM"; | ||
return ot ? mt.toLowerCase() : mt; | ||
}; | ||
return u.replace(Dt, function(L, A) { | ||
return A || function(tt) { | ||
switch (tt) { | ||
return d.replace(E, function(Z, G) { | ||
return G || function(ot) { | ||
switch (ot) { | ||
case "YY": | ||
return String(h.$y).slice(-2); | ||
return String(c.$y).slice(-2); | ||
case "YYYY": | ||
return $.s(h.$y, 4, "0"); | ||
return M.s(c.$y, 4, "0"); | ||
case "M": | ||
return Y + 1; | ||
return P + 1; | ||
case "MM": | ||
return $.s(Y + 1, 2, "0"); | ||
return M.s(P + 1, 2, "0"); | ||
case "MMM": | ||
return R(s.monthsShort, Y, _, 3); | ||
return tt(s.monthsShort, P, R, 3); | ||
case "MMMM": | ||
return R(_, Y); | ||
return tt(R, P); | ||
case "D": | ||
return h.$D; | ||
return c.$D; | ||
case "DD": | ||
return $.s(h.$D, 2, "0"); | ||
return M.s(c.$D, 2, "0"); | ||
case "d": | ||
return String(h.$W); | ||
return String(c.$W); | ||
case "dd": | ||
return R(s.weekdaysMin, h.$W, F, 2); | ||
return tt(s.weekdaysMin, c.$W, U, 2); | ||
case "ddd": | ||
return R(s.weekdaysShort, h.$W, F, 3); | ||
return tt(s.weekdaysShort, c.$W, U, 3); | ||
case "dddd": | ||
return F[h.$W]; | ||
return U[c.$W]; | ||
case "H": | ||
return String(p); | ||
return String(w); | ||
case "HH": | ||
return $.s(p, 2, "0"); | ||
return M.s(w, 2, "0"); | ||
case "h": | ||
return K(1); | ||
return at(1); | ||
case "hh": | ||
return K(2); | ||
return at(2); | ||
case "a": | ||
return B(p, w, !0); | ||
return et(w, _, !0); | ||
case "A": | ||
return B(p, w, !1); | ||
return et(w, _, !1); | ||
case "m": | ||
return String(w); | ||
return String(_); | ||
case "mm": | ||
return $.s(w, 2, "0"); | ||
return M.s(_, 2, "0"); | ||
case "s": | ||
return String(h.$s); | ||
return String(c.$s); | ||
case "ss": | ||
return $.s(h.$s, 2, "0"); | ||
return M.s(c.$s, 2, "0"); | ||
case "SSS": | ||
return $.s(h.$ms, 3, "0"); | ||
return M.s(c.$ms, 3, "0"); | ||
case "Z": | ||
return l; | ||
return $; | ||
} | ||
return null; | ||
}(L) || l.replace(":", ""); | ||
}(Z) || $.replace(":", ""); | ||
}); | ||
}, n.utcOffset = function() { | ||
}, r.utcOffset = function() { | ||
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); | ||
}, n.diff = function(i, h, s) { | ||
var u, l = this, p = $.p(h), w = x(i), Y = (w.utcOffset() - this.utcOffset()) * o, F = this - w, _ = function() { | ||
return $.m(l, w); | ||
}, r.diff = function(i, c, s) { | ||
var d, $ = this, w = M.p(c), _ = O(i), P = (_.utcOffset() - this.utcOffset()) * n, U = this - _, R = function() { | ||
return M.m($, _); | ||
}; | ||
switch (p) { | ||
case C: | ||
u = _() / 12; | ||
switch (w) { | ||
case T: | ||
d = R() / 12; | ||
break; | ||
case v: | ||
u = _(); | ||
case D: | ||
d = R(); | ||
break; | ||
case G: | ||
u = _() / 3; | ||
break; | ||
case S: | ||
u = (F - Y) / 6048e5; | ||
d = R() / 3; | ||
break; | ||
case T: | ||
u = (F - Y) / 864e5; | ||
case H: | ||
d = (U - P) / 6048e5; | ||
break; | ||
case M: | ||
u = F / f; | ||
case y: | ||
d = (U - P) / 864e5; | ||
break; | ||
case d: | ||
u = F / o; | ||
case u: | ||
d = U / g; | ||
break; | ||
case g: | ||
u = F / e; | ||
case m: | ||
d = U / n; | ||
break; | ||
case l: | ||
d = U / e; | ||
break; | ||
default: | ||
u = F; | ||
d = U; | ||
} | ||
return s ? u : $.a(u); | ||
}, n.daysInMonth = function() { | ||
return this.endOf(v).$D; | ||
}, n.$locale = function() { | ||
return P[this.$L]; | ||
}, n.locale = function(i, h) { | ||
if (!i) | ||
return this.$L; | ||
var s = this.clone(), u = ot(i, h, !0); | ||
return u && (s.$L = u), s; | ||
}, n.clone = function() { | ||
return $.w(this.$d, this); | ||
}, n.toDate = function() { | ||
return s ? d : M.a(d); | ||
}, r.daysInMonth = function() { | ||
return this.endOf(D).$D; | ||
}, r.$locale = function() { | ||
return W[this.$L]; | ||
}, r.locale = function(i, c) { | ||
if (!i) return this.$L; | ||
var s = this.clone(), d = j(i, c, !0); | ||
return d && (s.$L = d), s; | ||
}, r.clone = function() { | ||
return M.w(this.$d, this); | ||
}, r.toDate = function() { | ||
return new Date(this.valueOf()); | ||
}, n.toJSON = function() { | ||
}, r.toJSON = function() { | ||
return this.isValid() ? this.toISOString() : null; | ||
}, n.toISOString = function() { | ||
}, r.toISOString = function() { | ||
return this.$d.toISOString(); | ||
}, n.toString = function() { | ||
}, r.toString = function() { | ||
return this.$d.toUTCString(); | ||
}, c; | ||
}(), Yt = ht.prototype; | ||
return x.prototype = Yt, [["$ms", m], ["$s", g], ["$m", d], ["$H", M], ["$W", T], ["$M", v], ["$y", C], ["$D", z]].forEach(function(c) { | ||
Yt[c[1]] = function(n) { | ||
return this.$g(n, c[0], c[1]); | ||
}, f; | ||
}(), Tt = lt.prototype; | ||
return O.prototype = Tt, [["$ms", p], ["$s", l], ["$m", m], ["$H", u], ["$W", y], ["$M", D], ["$y", T], ["$D", v]].forEach(function(f) { | ||
Tt[f[1]] = function(r) { | ||
return this.$g(r, f[0], f[1]); | ||
}; | ||
}), x.extend = function(c, n) { | ||
return c.$i || (c(n, ht, x), c.$i = !0), x; | ||
}, x.locale = ot, x.isDayjs = Tt, x.unix = function(c) { | ||
return x(1e3 * c); | ||
}, x.en = P[k], x.Ls = P, x.p = {}, x; | ||
}), O.extend = function(f, r) { | ||
return f.$i || (f(r, lt, O), f.$i = !0), O; | ||
}, O.locale = j, O.isDayjs = B, O.unix = function(f) { | ||
return O(1e3 * f); | ||
}, O.en = W[b], O.Ls = W, O.p = {}, O; | ||
}); | ||
})(Ft); | ||
var jt = Ft.exports; | ||
const Rt = /* @__PURE__ */ It(jt), bt = (a, t = "MM/DD HH:mm") => Rt(a).format(t), wt = (a, t) => { | ||
let e, o = 0; | ||
return (...f) => { | ||
const m = Date.now(), g = m - o; | ||
!o || g >= t ? (o = m, a.apply(void 0, f)) : e || (e = setTimeout(() => { | ||
o = m, a.apply(void 0, f), e = null; | ||
}, t - g)); | ||
})(St); | ||
var kt = St.exports; | ||
const Dt = /* @__PURE__ */ Mt(kt); | ||
var Yt = { exports: {} }; | ||
(function(a, t) { | ||
(function(e, n) { | ||
a.exports = n(); | ||
})(pt, function() { | ||
var e = "minute", n = /[+-]\d\d(?::?\d\d)?/g, g = /([+-]|\d\d)/g; | ||
return function(p, l, m) { | ||
var u = l.prototype; | ||
m.utc = function(h) { | ||
var x = { date: h, utc: !0, args: arguments }; | ||
return new l(x); | ||
}, u.utc = function(h) { | ||
var x = m(this.toDate(), { locale: this.$L, utc: !0 }); | ||
return h ? x.add(this.utcOffset(), e) : x; | ||
}, u.local = function() { | ||
return m(this.toDate(), { locale: this.$L, utc: !1 }); | ||
}; | ||
var y = u.parse; | ||
u.parse = function(h) { | ||
h.utc && (this.$u = !0), this.$utils().u(h.$offset) || (this.$offset = h.$offset), y.call(this, h); | ||
}; | ||
var H = u.init; | ||
u.init = function() { | ||
if (this.$u) { | ||
var h = this.$d; | ||
this.$y = h.getUTCFullYear(), this.$M = h.getUTCMonth(), this.$D = h.getUTCDate(), this.$W = h.getUTCDay(), this.$H = h.getUTCHours(), this.$m = h.getUTCMinutes(), this.$s = h.getUTCSeconds(), this.$ms = h.getUTCMilliseconds(); | ||
} else H.call(this); | ||
}; | ||
var D = u.utcOffset; | ||
u.utcOffset = function(h, x) { | ||
var E = this.$utils().u; | ||
if (E(h)) return this.$u ? 0 : E(this.$offset) ? D.call(this) : this.$offset; | ||
if (typeof h == "string" && (h = function(b) { | ||
b === void 0 && (b = ""); | ||
var W = b.match(n); | ||
if (!W) return null; | ||
var I = ("" + W[0]).match(g) || ["-", 0, 0], B = I[0], j = 60 * +I[1] + +I[2]; | ||
return j === 0 ? 0 : B === "+" ? j : -j; | ||
}(h), h === null)) return this; | ||
var L = Math.abs(h) <= 16 ? 60 * h : h, Y = this; | ||
if (x) return Y.$offset = L, Y.$u = h === 0, Y; | ||
if (h !== 0) { | ||
var k = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset(); | ||
(Y = this.local().add(L + k, e)).$offset = L, Y.$x.$localOffset = k; | ||
} else Y = this.utc(); | ||
return Y; | ||
}; | ||
var S = u.format; | ||
u.format = function(h) { | ||
var x = h || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : ""); | ||
return S.call(this, x); | ||
}, u.valueOf = function() { | ||
var h = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset()); | ||
return this.$d.valueOf() - 6e4 * h; | ||
}, u.isUTC = function() { | ||
return !!this.$u; | ||
}, u.toISOString = function() { | ||
return this.toDate().toISOString(); | ||
}, u.toString = function() { | ||
return this.toDate().toUTCString(); | ||
}; | ||
var T = u.toDate; | ||
u.toDate = function(h) { | ||
return h === "s" && this.$offset ? m(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : T.call(this); | ||
}; | ||
var v = u.diff; | ||
u.diff = function(h, x, E) { | ||
if (h && this.$u === h.$u) return v.call(this, h, x, E); | ||
var L = this.local(), Y = m(h).local(); | ||
return v.call(L, Y, x, E); | ||
}; | ||
}; | ||
}); | ||
})(Yt); | ||
var It = Yt.exports; | ||
const Ut = /* @__PURE__ */ Mt(It); | ||
var wt = { exports: {} }; | ||
(function(a, t) { | ||
(function(e, n) { | ||
a.exports = n(); | ||
})(pt, function() { | ||
var e = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, n = {}; | ||
return function(g, p, l) { | ||
var m, u = function(S, T, v) { | ||
v === void 0 && (v = {}); | ||
var h = new Date(S), x = function(E, L) { | ||
L === void 0 && (L = {}); | ||
var Y = L.timeZoneName || "short", k = E + "|" + Y, b = n[k]; | ||
return b || (b = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: E, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: Y }), n[k] = b), b; | ||
}(T, v); | ||
return x.formatToParts(h); | ||
}, y = function(S, T) { | ||
for (var v = u(S, T), h = [], x = 0; x < v.length; x += 1) { | ||
var E = v[x], L = E.type, Y = E.value, k = e[L]; | ||
k >= 0 && (h[k] = parseInt(Y, 10)); | ||
} | ||
var b = h[3], W = b === 24 ? 0 : b, I = h[0] + "-" + h[1] + "-" + h[2] + " " + W + ":" + h[4] + ":" + h[5] + ":000", B = +S; | ||
return (l.utc(I).valueOf() - (B -= B % 1e3)) / 6e4; | ||
}, H = p.prototype; | ||
H.tz = function(S, T) { | ||
S === void 0 && (S = m); | ||
var v, h = this.utcOffset(), x = this.toDate(), E = x.toLocaleString("en-US", { timeZone: S }), L = Math.round((x - new Date(E)) / 1e3 / 60), Y = 15 * -Math.round(x.getTimezoneOffset() / 15) - L; | ||
if (!Number(Y)) v = this.utcOffset(0, T); | ||
else if (v = l(E, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(Y, !0), T) { | ||
var k = v.utcOffset(); | ||
v = v.add(h - k, "minute"); | ||
} | ||
return v.$x.$timezone = S, v; | ||
}, H.offsetName = function(S) { | ||
var T = this.$x.$timezone || l.tz.guess(), v = u(this.valueOf(), T, { timeZoneName: S }).find(function(h) { | ||
return h.type.toLowerCase() === "timezonename"; | ||
}); | ||
return v && v.value; | ||
}; | ||
var D = H.startOf; | ||
H.startOf = function(S, T) { | ||
if (!this.$x || !this.$x.$timezone) return D.call(this, S, T); | ||
var v = l(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L }); | ||
return D.call(v, S, T).tz(this.$x.$timezone, !0); | ||
}, l.tz = function(S, T, v) { | ||
var h = v && T, x = v || T || m, E = y(+l(), x); | ||
if (typeof S != "string") return l(S).tz(x); | ||
var L = function(W, I, B) { | ||
var j = W - 60 * I * 1e3, O = y(j, B); | ||
if (I === O) return [j, I]; | ||
var M = y(j -= 60 * (O - I) * 1e3, B); | ||
return O === M ? [j, O] : [W - 60 * Math.min(O, M) * 1e3, Math.max(O, M)]; | ||
}(l.utc(S, h).valueOf(), E, x), Y = L[0], k = L[1], b = l(Y).utcOffset(k); | ||
return b.$x.$timezone = x, b; | ||
}, l.tz.guess = function() { | ||
return Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
}, l.tz.setDefault = function(S) { | ||
m = S; | ||
}; | ||
}; | ||
}); | ||
})(wt); | ||
var Xt = wt.exports; | ||
const At = /* @__PURE__ */ Mt(Xt); | ||
Dt.extend(Ut); | ||
Dt.extend(At); | ||
const gt = (a, t = "MM/DD HH:mm Z", e) => Dt(a).tz(e).format(t), vt = (a, t) => { | ||
let e, n = 0; | ||
return (...g) => { | ||
const p = Date.now(), l = p - n; | ||
!n || l >= t ? (n = p, a.apply(void 0, g)) : e || (e = setTimeout(() => { | ||
n = p, a.apply(void 0, g), e = null; | ||
}, t - l)); | ||
}; | ||
}, St = (a) => { | ||
const [t, e] = [a[0], a[1]], o = e.clientX - t.clientX, f = e.clientY - t.clientY; | ||
return Math.sqrt(o * o + f * f); | ||
}, Bt = (a, t) => { | ||
}, yt = (a) => { | ||
const [t, e] = [a[0], a[1]], n = e.clientX - t.clientX, g = e.clientY - t.clientY; | ||
return Math.sqrt(n * n + g * g); | ||
}, Zt = (a, t) => { | ||
const e = document.createElement("canvas"); | ||
e.width = e.height = 1; | ||
const o = e.getContext("2d"); | ||
o.fillStyle = a, o.fillRect(0, 0, 1, 1); | ||
const f = o.getImageData(0, 0, 1, 1).data; | ||
return `rgba(${f[0]}, ${f[1]}, ${f[2]}, ${t})`; | ||
}, Nt = ({ xCenterPoint: a, cfg: t, timePerPixel: e, timeSpacing: o, currentTime: f, $canvas: m, screenScaleCount: g, scaleHeight: d, startTime: M, drawLine: T, drawText: S, drawArea: v }) => { | ||
const G = ({ space: z, scaleTimeFormat: rt, bgTimeFormat: Mt, pointerTimeFormat: Dt }) => { | ||
S({ | ||
x: m.width - a / 10, | ||
const n = e.getContext("2d"); | ||
n.fillStyle = a, n.fillRect(0, 0, 1, 1); | ||
const g = n.getImageData(0, 0, 1, 1).data; | ||
return `rgba(${g[0]}, ${g[1]}, ${g[2]}, ${t})`; | ||
}, jt = ({ xCenterPoint: a, cfg: t, timePerPixel: e, timeSpacing: n, currentTime: g, $canvas: p, screenScaleCount: l, scaleHeight: m, startTime: u, drawLine: y, drawText: H, drawArea: D }) => { | ||
const S = ({ space: v, scaleTimeFormat: h, bgTimeFormat: x, pointerTimeFormat: E, timezone: L }) => { | ||
H({ | ||
x: p.width - a / 10, | ||
y: 6, | ||
text: bt(f, Mt), | ||
fontSize: `${m.height - 5}px`, | ||
text: gt(g, x, L), | ||
fontSize: `${p.height - 5}px`, | ||
align: "right", | ||
@@ -354,10 +477,10 @@ baseLine: "top", | ||
}); | ||
const at = M % o, Q = at / e; | ||
for (let Z = 0; Z < g; Z++) { | ||
const k = Z * t.scaleSpacing - Q - t.pointerWidth / 2, P = M + Z * o - at; | ||
if (P % (o * z) === 0) { | ||
T({ x: k, y: d.long }), S({ | ||
x: k, | ||
y: m.height - d.long - 5, | ||
text: bt(P, rt), | ||
const Y = u % n, k = Y / e; | ||
for (let b = 0; b < l; b++) { | ||
const W = b * t.scaleSpacing - k - t.pointerWidth / 2, I = u + b * n - Y; | ||
if (I % (n * v) === 0) { | ||
y({ x: W, y: m.long }), H({ | ||
x: W, | ||
y: p.height - m.long - 5, | ||
text: gt(I, h, L), | ||
baseLine: "bottom" | ||
@@ -367,10 +490,10 @@ }); | ||
} | ||
T({ x: k, y: d.short }); | ||
y({ x: W, y: m.short }); | ||
} | ||
T({ | ||
y({ | ||
x: a - t.pointerWidth / 2, | ||
y: m.height, | ||
y: p.height, | ||
width: t.pointerWidth, | ||
color: t.pointerColor | ||
}), v({ | ||
}), D({ | ||
startX: a - t.pointerDisplayWidth / 2, | ||
@@ -381,17 +504,18 @@ startY: 4, | ||
bgColor: t.pointerColor | ||
}), S({ | ||
}), H({ | ||
x: a, | ||
y: t.pointerDisplayHeight / 2 + 5, | ||
text: bt(f, Dt), | ||
text: gt(g, E, L), | ||
align: "center", | ||
baseLine: "middle" | ||
}); | ||
}, C = t.thresholdsConfig[o]; | ||
C && G({ | ||
space: C.space, | ||
scaleTimeFormat: C.scaleTimeFormat, | ||
bgTimeFormat: C.bgTimeFormat, | ||
pointerTimeFormat: C.pointerTimeFormat | ||
}, T = t.thresholdsConfig[n]; | ||
T && S({ | ||
space: T.space, | ||
scaleTimeFormat: T.scaleTimeFormat, | ||
bgTimeFormat: T.bgTimeFormat, | ||
pointerTimeFormat: T.pointerTimeFormat, | ||
timezone: t.timezone | ||
}); | ||
}, Ut = { | ||
}, Nt = { | ||
fill: !0, | ||
@@ -472,70 +596,54 @@ width: 1e3, | ||
}; | ||
var st, I, J, H, E, D, N, W, j, X, ut, Ht, lt, Ct, ft, Lt, dt, Ot, mt, _t, gt, Et, $t, Wt, vt, Pt, pt, nt, V, U, it; | ||
class qt { | ||
var ut, Q, nt, X, q, C, it, J, K, V, F, bt, Ot, Ct, Ht, Ft, Lt, zt, _t, dt, ft, rt, ct; | ||
class Bt { | ||
constructor(t, e) { | ||
// 拖拽 | ||
y(this, ut); | ||
// 缩放 | ||
y(this, lt); | ||
// 触摸事件监听器 | ||
y(this, ft); | ||
y(this, dt); | ||
y(this, mt); | ||
// 父元素size变化 | ||
y(this, gt); | ||
// 清空画布 | ||
y(this, $t); | ||
// 绘制比例尺 | ||
y(this, vt); | ||
y(this, U); | ||
et(this, "$canvas"); | ||
et(this, "$canvasParent"); | ||
et(this, "ctx"); | ||
et(this, "cfg"); | ||
y(this, st, void 0); | ||
y(this, I, void 0); | ||
y(this, J, zt()); | ||
y(this, H, 0); | ||
y(this, E, void 0); | ||
y(this, D, void 0); | ||
y(this, N, void 0); | ||
y(this, W, !1); | ||
y(this, j, null); | ||
y(this, X, null); | ||
A(this, F); | ||
ht(this, "$canvas"); | ||
ht(this, "$canvasParent"); | ||
ht(this, "ctx"); | ||
ht(this, "cfg"); | ||
A(this, ut); | ||
A(this, Q); | ||
A(this, nt, Pt()); | ||
A(this, X, 0); | ||
A(this, q); | ||
A(this, C); | ||
A(this, it); | ||
A(this, J, !1); | ||
A(this, K, null); | ||
A(this, V, null); | ||
// 绘制线条 | ||
y(this, pt, ({ x: t, y: e, width: o = 1, color: f = this.cfg.scaleColor }) => { | ||
this.ctx.beginPath(), this.ctx.moveTo(t, this.$canvas.height), this.ctx.lineTo(t, this.$canvas.height - e), this.ctx.closePath(), this.ctx.strokeStyle = f, this.ctx.lineWidth = o, this.ctx.stroke(); | ||
A(this, dt, ({ x: t, y: e, width: n = 1, color: g = this.cfg.scaleColor }) => { | ||
this.ctx.beginPath(), this.ctx.moveTo(t, this.$canvas.height), this.ctx.lineTo(t, this.$canvas.height - e), this.ctx.closePath(), this.ctx.strokeStyle = g, this.ctx.lineWidth = n, this.ctx.stroke(); | ||
}); | ||
// 绘制文字 | ||
y(this, nt, ({ x: t, y: e, text: o, color: f = this.cfg.textColor, fontSize: m = "11px", align: g = "center", baseLine: d = "alphabetic" }) => { | ||
this.ctx.beginPath(), this.ctx.font = `${m} ${this.cfg.fontFamily}`, this.ctx.fillStyle = f, this.ctx.textAlign = g, this.ctx.textBaseline = d, this.ctx.fillText(o, t, e); | ||
A(this, ft, ({ x: t, y: e, text: n, color: g = this.cfg.textColor, fontSize: p = "11px", align: l = "center", baseLine: m = "alphabetic" }) => { | ||
this.ctx.beginPath(), this.ctx.font = `${p} ${this.cfg.fontFamily}`, this.ctx.fillStyle = g, this.ctx.textAlign = l, this.ctx.textBaseline = m, this.ctx.fillText(n, t, e); | ||
}); | ||
// 绘制区域 | ||
y(this, V, ({ startX: t, startY: e, endX: o, endY: f, bgColor: m }) => { | ||
this.ctx.beginPath(), this.ctx.rect(t, e, o - t, f - e), this.ctx.fillStyle = m, this.ctx.fill(); | ||
A(this, rt, ({ startX: t, startY: e, endX: n, endY: g, bgColor: p }) => { | ||
this.ctx.beginPath(), this.ctx.rect(t, e, n - t, g - e), this.ctx.fillStyle = p, this.ctx.fill(); | ||
}); | ||
if (!t) | ||
throw new Error("canvas Element Or Element ID is required!"); | ||
typeof t == "string" ? this.$canvas = document.querySelector(t) : this.$canvas = t, this.ctx = this.$canvas.getContext("2d"), this.cfg = { ...Ut, ...e }, e != null && e.pointColor && (this.cfg.pointerColor = e.pointColor), e != null && e.pointWidth && (this.cfg.pointerWidth = e.pointWidth); | ||
const { fill: o, width: f, height: m, zoom: g, timeSpacingList: d, scaleHeight: M, textColor: T, bgTextColor: S } = this.cfg; | ||
if (S || (this.cfg.bgTextColor = Bt(T, 0.18)), g < 0 || g >= d.length || g % 1 !== 0) | ||
throw new Error(`zoom must be 0 ~ ${d.length - 1}, and must be an integer`); | ||
if (o) { | ||
const v = this.$canvas.parentElement; | ||
this.$canvasParent = v, this.$canvas.width = v.clientWidth, this.$canvas.height = v.clientHeight, new ResizeObserver(wt(O(this, gt, Et).bind(this), 200)).observe(v); | ||
if (!t) throw new Error("canvas Element Or Element ID is required!"); | ||
typeof t == "string" ? this.$canvas = document.querySelector(t) : this.$canvas = t, this.ctx = this.$canvas.getContext("2d"), this.cfg = { ...Nt, ...e }, e != null && e.pointColor && (this.cfg.pointerColor = e.pointColor), e != null && e.pointWidth && (this.cfg.pointerWidth = e.pointWidth); | ||
const { fill: n, width: g, height: p, zoom: l, timeSpacingList: m, scaleHeight: u, textColor: y, bgTextColor: H } = this.cfg; | ||
if (H || (this.cfg.bgTextColor = Zt(y, 0.18)), l < 0 || l >= m.length || l % 1 !== 0) | ||
throw new Error(`zoom must be 0 ~ ${m.length - 1}, and must be an integer`); | ||
if (n) { | ||
const D = this.$canvas.parentElement; | ||
this.$canvasParent = D, this.$canvas.width = D.clientWidth, this.$canvas.height = D.clientHeight, new ResizeObserver(vt(N(this, F, Lt).bind(this), 200)).observe(D); | ||
} else | ||
this.$canvas.width = f, this.$canvas.height = m; | ||
b(this, D, d[g]), M != null && M.long && (M != null && M.short) ? b(this, N, M) : b(this, N, { | ||
this.$canvas.width = g, this.$canvas.height = p; | ||
z(this, C, m[l]), u != null && u.long && (u != null && u.short) ? z(this, it, u) : z(this, it, { | ||
long: this.$canvas.height / 3, | ||
medium: this.$canvas.height / 6, | ||
short: this.$canvas.height / 10 | ||
}), this.draw(), this.$canvas.addEventListener("wheel", O(this, lt, Ct).bind(this), { passive: !1 }), this.$canvas.addEventListener("mousedown", O(this, ut, Ht).bind(this)), this.$canvas.addEventListener("touchstart", O(this, ft, Lt).bind(this), { passive: !1 }), this.$canvas.addEventListener("touchmove", wt(O(this, dt, Ot).bind(this), 1e3 / this.cfg.fps), { passive: !1 }), this.$canvas.addEventListener("touchend", O(this, mt, _t).bind(this)); | ||
}), this.draw(), this.$canvas.addEventListener("wheel", N(this, F, Ot).bind(this), { passive: !1 }), this.$canvas.addEventListener("mousedown", N(this, F, bt).bind(this)), this.$canvas.addEventListener("touchstart", N(this, F, Ct).bind(this), { passive: !1 }), this.$canvas.addEventListener("touchmove", vt(N(this, F, Ht).bind(this), 1e3 / this.cfg.fps), { passive: !1 }), this.$canvas.addEventListener("touchend", N(this, F, Ft).bind(this)); | ||
} | ||
// 绘制时间轴 | ||
draw({ currentTime: t, areas: e, _privateFlag: o } = {}) { | ||
if (r(this, W) && !o) | ||
return; | ||
b(this, H, t || Date.now()), b(this, E, e || []); | ||
const f = this.$canvas.width / 2, m = Math.ceil(this.$canvas.width / this.cfg.scaleSpacing), g = m * r(this, D), [d, M] = b(this, st, [r(this, H) - g / 2, r(this, H) + g / 2]); | ||
b(this, I, g / this.$canvas.width), O(this, $t, Wt).call(this), r(this, V).call(this, { | ||
draw({ currentTime: t, areas: e, _privateFlag: n } = {}) { | ||
if (o(this, J) && !n) return; | ||
z(this, X, t || Date.now()), z(this, q, e || []); | ||
const g = this.$canvas.width / 2, p = Math.ceil(this.$canvas.width / this.cfg.scaleSpacing), l = p * o(this, C), [m, u] = z(this, ut, [o(this, X) - l / 2, o(this, X) + l / 2]); | ||
z(this, Q, l / this.$canvas.width), N(this, F, zt).call(this), o(this, rt).call(this, { | ||
startX: 0, | ||
@@ -546,88 +654,88 @@ startY: 0, | ||
bgColor: this.cfg.bgColor | ||
}), r(this, E).forEach((T) => { | ||
const S = T.startTime <= d ? 0 : Math.round((T.startTime - d) / r(this, I)), v = T.endTime >= M ? this.$canvas.width : Math.round((T.endTime - d) / r(this, I)); | ||
S < this.$canvas.width && v > 0 && r(this, V).call(this, { | ||
startX: S, | ||
}), o(this, q).forEach((y) => { | ||
const H = y.startTime <= m ? 0 : Math.round((y.startTime - m) / o(this, Q)), D = y.endTime >= u ? this.$canvas.width : Math.round((y.endTime - m) / o(this, Q)); | ||
H < this.$canvas.width && D > 0 && o(this, rt).call(this, { | ||
startX: H, | ||
startY: 0, | ||
endX: v, | ||
endX: D, | ||
endY: this.$canvas.height, | ||
bgColor: T.bgColor || this.cfg.areaBgColor | ||
bgColor: y.bgColor || this.cfg.areaBgColor | ||
}); | ||
}), Nt.bind(this)({ | ||
xCenterPoint: f, | ||
screenScaleCount: m, | ||
startTime: d, | ||
timePerPixel: r(this, I), | ||
scaleHeight: r(this, N), | ||
timeSpacing: r(this, D), | ||
currentTime: r(this, H), | ||
}), jt.bind(this)({ | ||
xCenterPoint: g, | ||
screenScaleCount: p, | ||
startTime: m, | ||
timePerPixel: o(this, Q), | ||
scaleHeight: o(this, it), | ||
timeSpacing: o(this, C), | ||
currentTime: o(this, X), | ||
$canvas: this.$canvas, | ||
cfg: this.cfg, | ||
drawLine: r(this, pt).bind(this), | ||
drawText: r(this, nt).bind(this), | ||
drawArea: r(this, V).bind(this) | ||
}), O(this, vt, Pt).call(this); | ||
drawLine: o(this, dt).bind(this), | ||
drawText: o(this, ft).bind(this), | ||
drawArea: o(this, rt).bind(this) | ||
}), N(this, F, _t).call(this); | ||
} | ||
// 获取当前时间 | ||
getCurrentTime() { | ||
return r(this, H); | ||
return o(this, X); | ||
} | ||
// 获取时间范围 | ||
getTimeRange() { | ||
return r(this, st); | ||
return o(this, ut); | ||
} | ||
// 获取1px所占毫秒数 | ||
getMsPerPixel() { | ||
return r(this, I); | ||
return o(this, Q); | ||
} | ||
on(t, e) { | ||
r(this, J).on(t, e); | ||
o(this, nt).on(t, e); | ||
} | ||
off(t, e) { | ||
r(this, J).off(t, e); | ||
o(this, nt).off(t, e); | ||
} | ||
} | ||
st = new WeakMap(), I = new WeakMap(), J = new WeakMap(), H = new WeakMap(), E = new WeakMap(), D = new WeakMap(), N = new WeakMap(), W = new WeakMap(), j = new WeakMap(), X = new WeakMap(), ut = new WeakSet(), Ht = function(t) { | ||
b(this, W, !0); | ||
let e = t.clientX, o = r(this, H); | ||
const f = wt(({ clientX: d }) => { | ||
r(this, W) && (o = Math.round(r(this, H) - r(this, D) / this.cfg.scaleSpacing * (d - e)), e = d, this.draw({ | ||
currentTime: o, | ||
areas: r(this, E), | ||
ut = new WeakMap(), Q = new WeakMap(), nt = new WeakMap(), X = new WeakMap(), q = new WeakMap(), C = new WeakMap(), it = new WeakMap(), J = new WeakMap(), K = new WeakMap(), V = new WeakMap(), F = new WeakSet(), // 拖拽 | ||
bt = function(t) { | ||
z(this, J, !0); | ||
let e = t.clientX, n = o(this, X); | ||
const g = vt(({ clientX: m }) => { | ||
o(this, J) && (n = Math.round(o(this, X) - o(this, C) / this.cfg.scaleSpacing * (m - e)), e = m, this.draw({ | ||
currentTime: n, | ||
areas: o(this, q), | ||
_privateFlag: !0 | ||
})); | ||
}, 1e3 / this.cfg.fps), m = (d) => { | ||
const M = this.$canvas.getBoundingClientRect(), T = d.clientX - M.left, S = d.clientY - M.top, v = 3; | ||
(T < v || T > this.$canvas.width - v || S < v || S > this.$canvas.height - v) && (this.$canvas.removeEventListener("mousemove", f), this.$canvas.removeEventListener("mousemove", m)); | ||
}, g = () => { | ||
this.$canvas.removeEventListener("mousemove", f), this.$canvas.removeEventListener("mousemove", m), document.removeEventListener("mouseup", g), b(this, W, !1), O(this, U, it).call(this, "dragged", o); | ||
}, 1e3 / this.cfg.fps), p = (m) => { | ||
const u = this.$canvas.getBoundingClientRect(), y = m.clientX - u.left, H = m.clientY - u.top, D = 3; | ||
(y < D || y > this.$canvas.width - D || H < D || H > this.$canvas.height - D) && (this.$canvas.removeEventListener("mousemove", g), this.$canvas.removeEventListener("mousemove", p)); | ||
}, l = () => { | ||
this.$canvas.removeEventListener("mousemove", g), this.$canvas.removeEventListener("mousemove", p), document.removeEventListener("mouseup", l), z(this, J, !1), N(this, F, ct).call(this, "dragged", n); | ||
}; | ||
this.$canvas.addEventListener("mousemove", f), this.$canvas.addEventListener("mousemove", m), document.addEventListener("mouseup", g); | ||
}, lt = new WeakSet(), Ct = function(t) { | ||
this.$canvas.addEventListener("mousemove", g), this.$canvas.addEventListener("mousemove", p), document.addEventListener("mouseup", l); | ||
}, // 缩放 | ||
Ot = function(t) { | ||
t.preventDefault(); | ||
const e = this.cfg.timeSpacingList.findIndex((o) => o === r(this, D)); | ||
t.deltaY < 0 && e > 0 ? (b(this, D, this.cfg.timeSpacingList[e - 1]), this.draw({ | ||
currentTime: r(this, H), | ||
areas: r(this, E), | ||
const e = this.cfg.timeSpacingList.findIndex((n) => n === o(this, C)); | ||
t.deltaY < 0 && e > 0 ? (z(this, C, this.cfg.timeSpacingList[e - 1]), this.draw({ | ||
currentTime: o(this, X), | ||
areas: o(this, q), | ||
_privateFlag: !0 | ||
}), O(this, U, it).call(this, "zoom", e - 1)) : t.deltaY > 0 && e < this.cfg.timeSpacingList.length - 1 && (b(this, D, this.cfg.timeSpacingList[e + 1]), this.draw({ | ||
currentTime: r(this, H), | ||
areas: r(this, E), | ||
}), N(this, F, ct).call(this, "zoom", e - 1)) : t.deltaY > 0 && e < this.cfg.timeSpacingList.length - 1 && (z(this, C, this.cfg.timeSpacingList[e + 1]), this.draw({ | ||
currentTime: o(this, X), | ||
areas: o(this, q), | ||
_privateFlag: !0 | ||
}), O(this, U, it).call(this, "zoom", e + 1)); | ||
}, ft = new WeakSet(), Lt = function(t) { | ||
t.preventDefault(), b(this, W, !0), b(this, j, t.touches[0].clientX), t.touches.length === 2 && b(this, X, St(t.touches)); | ||
}, dt = new WeakSet(), Ot = function(t) { | ||
if (t.preventDefault(), !r(this, W)) | ||
return; | ||
if (t.touches.length === 2 && r(this, X) !== null) { | ||
const m = St(t.touches), g = Math.abs(r(this, X) - m) >= 35; | ||
if (!g) | ||
return; | ||
let d = this.cfg.timeSpacingList.findIndex((M) => M === r(this, D)); | ||
if (m < r(this, X) ? d += 1 : d -= 1, d < 0 || d > this.cfg.timeSpacingList.length - 1) | ||
return; | ||
b(this, D, this.cfg.timeSpacingList[d]), g && b(this, X, m), this.draw({ | ||
currentTime: r(this, H), | ||
areas: r(this, E), | ||
}), N(this, F, ct).call(this, "zoom", e + 1)); | ||
}, // 触摸事件监听器 | ||
Ct = function(t) { | ||
t.preventDefault(), z(this, J, !0), z(this, K, t.touches[0].clientX), t.touches.length === 2 && z(this, V, yt(t.touches)); | ||
}, Ht = function(t) { | ||
if (t.preventDefault(), !o(this, J)) return; | ||
if (t.touches.length === 2 && o(this, V) !== null) { | ||
const p = yt(t.touches), l = Math.abs(o(this, V) - p) >= 35; | ||
if (!l) return; | ||
let m = this.cfg.timeSpacingList.findIndex((u) => u === o(this, C)); | ||
if (p < o(this, V) ? m += 1 : m -= 1, m < 0 || m > this.cfg.timeSpacingList.length - 1) return; | ||
z(this, C, this.cfg.timeSpacingList[m]), l && z(this, V, p), this.draw({ | ||
currentTime: o(this, X), | ||
areas: o(this, q), | ||
_privateFlag: !0 | ||
@@ -637,14 +745,14 @@ }); | ||
} | ||
if (r(this, j) === null) | ||
return; | ||
const e = t.touches[0], o = e.clientX - r(this, j), f = Math.round(r(this, H) - r(this, D) / this.cfg.scaleSpacing * o); | ||
b(this, j, e.clientX), this.draw({ | ||
currentTime: f, | ||
areas: r(this, E), | ||
if (o(this, K) === null) return; | ||
const e = t.touches[0], n = e.clientX - o(this, K), g = Math.round(o(this, X) - o(this, C) / this.cfg.scaleSpacing * n); | ||
z(this, K, e.clientX), this.draw({ | ||
currentTime: g, | ||
areas: o(this, q), | ||
_privateFlag: !0 | ||
}); | ||
}, mt = new WeakSet(), _t = function(t) { | ||
r(this, W) && (b(this, W, !1), b(this, j, null), t.touches.length < 2 && b(this, X, null), O(this, U, it).call(this, "dragged", r(this, H))); | ||
}, gt = new WeakSet(), Et = function() { | ||
this.$canvasParent && (this.$canvas.width = this.$canvasParent.clientWidth, this.$canvas.height = this.$canvasParent.clientHeight, this.cfg.scaleHeight || b(this, N, { | ||
}, Ft = function(t) { | ||
o(this, J) && (z(this, J, !1), z(this, K, null), t.touches.length < 2 && z(this, V, null), N(this, F, ct).call(this, "dragged", o(this, X))); | ||
}, // 父元素size变化 | ||
Lt = function() { | ||
this.$canvasParent && (this.$canvas.width = this.$canvasParent.clientWidth, this.$canvas.height = this.$canvasParent.clientHeight, this.cfg.scaleHeight || z(this, it, { | ||
long: this.$canvas.height / 3, | ||
@@ -654,10 +762,12 @@ medium: this.$canvas.height / 6, | ||
}), this.draw({ | ||
currentTime: r(this, H), | ||
areas: r(this, E) | ||
currentTime: o(this, X), | ||
areas: o(this, q) | ||
})); | ||
}, $t = new WeakSet(), Wt = function() { | ||
}, // 清空画布 | ||
zt = function() { | ||
this.ctx.clearRect(0, 0, this.$canvas.width, this.$canvas.height); | ||
}, vt = new WeakSet(), Pt = function() { | ||
const t = () => r(this, D) < 1e3 ? `${r(this, D)}ms` : r(this, D) < 6e4 ? `${Math.round(r(this, D) / 100) / 10}sec` : r(this, D) < 36e5 ? `${Math.round(r(this, D) / 100 / 60) / 10}min` : r(this, D) < 864e5 ? `${Math.round(r(this, D) / 100 / 60 / 60) / 10}hours` : r(this, D) < 6048e5 ? `${Math.round(r(this, D) / 100 / 60 / 60 / 24) / 10}days` : `${Math.round(r(this, D) / 100 / 60 / 60 / 24 / 7) / 10}weeks`; | ||
r(this, nt).call(this, { | ||
}, // 绘制比例尺 | ||
_t = function() { | ||
const t = () => o(this, C) < 1e3 ? `${o(this, C)}ms` : o(this, C) < 6e4 ? `${Math.round(o(this, C) / 100) / 10}sec` : o(this, C) < 36e5 ? `${Math.round(o(this, C) / 100 / 60) / 10}min` : o(this, C) < 864e5 ? `${Math.round(o(this, C) / 100 / 60 / 60) / 10}hours` : o(this, C) < 6048e5 ? `${Math.round(o(this, C) / 100 / 60 / 60 / 24) / 10}days` : `${Math.round(o(this, C) / 100 / 60 / 60 / 24 / 7) / 10}weeks`; | ||
o(this, ft).call(this, { | ||
x: this.cfg.scaleSpacing + 12, | ||
@@ -669,8 +779,8 @@ y: 9, | ||
}), this.ctx.beginPath(), this.ctx.moveTo(5, 6), this.ctx.lineTo(5, 10), this.ctx.lineTo(this.cfg.scaleSpacing + 6, 10), this.ctx.lineTo(this.cfg.scaleSpacing + 6, 6), this.ctx.strokeStyle = this.cfg.scaleColor, this.ctx.lineWidth = 1.5, this.ctx.stroke(); | ||
}, pt = new WeakMap(), nt = new WeakMap(), V = new WeakMap(), U = new WeakSet(), it = function(...t) { | ||
r(this, J).emit(...t); | ||
}, dt = new WeakMap(), ft = new WeakMap(), rt = new WeakMap(), ct = function(...t) { | ||
o(this, nt).emit(...t); | ||
}; | ||
export { | ||
qt as default, | ||
bt as format | ||
Bt as default, | ||
gt as format | ||
}; |
@@ -1,1 +0,1 @@ | ||
var $timeline=function(v){"use strict";var Zt=Object.defineProperty;var qt=(v,D,x)=>D in v?Zt(v,D,{enumerable:!0,configurable:!0,writable:!0,value:x}):v[D]=x;var at=(v,D,x)=>(qt(v,typeof D!="symbol"?D+"":D,x),x),Ft=(v,D,x)=>{if(!D.has(v))throw TypeError("Cannot "+x)};var r=(v,D,x)=>(Ft(v,D,"read from private field"),x?x.call(v):D.get(v)),w=(v,D,x)=>{if(D.has(v))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(v):D.set(v,x)},S=(v,D,x,ht)=>(Ft(v,D,"write to private field"),ht?ht.call(v,x):D.set(v,x),x);var W=(v,D,x)=>(Ft(v,D,"access private method"),x);var tt,j,V,C,k,T,U,X,R,A,ut,_t,lt,Et,ft,Wt,dt,Pt,mt,kt,gt,Xt,$t,zt,vt,At,pt,et,G,Z,ot;function D(f){return{all:f=f||new Map,on:function(t,n){var o=f.get(t);o?o.push(n):f.set(t,[n])},off:function(t,n){var o=f.get(t);o&&(n?o.splice(o.indexOf(n)>>>0,1):f.set(t,[]))},emit:function(t,n){var o=f.get(t);o&&o.slice().map(function(l){l(n)}),(o=f.get("*"))&&o.slice().map(function(l){l(t,n)})}}}var x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ht(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var Ht={exports:{}};(function(f,t){(function(n,o){f.exports=o()})(x,function(){var n=1e3,o=6e4,l=36e5,m="millisecond",g="second",d="minute",b="hour",y="day",L="week",p="month",it="quarter",_="year",B="date",Mt="Invalid Date",St=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Yt=/\[([^\]]+)]|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,Dt={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(h){var s=["th","st","nd","rd"],e=h%100;return"["+h+(s[(e-20)%10]||s[e]||s[0])+"]"}},st=function(h,s,e){var a=String(h);return!a||a.length>=s?h:""+Array(s+1-a.length).join(e)+h},Q={s:st,z:function(h){var s=-h.utcOffset(),e=Math.abs(s),a=Math.floor(e/60),i=e%60;return(s<=0?"+":"-")+st(a,2,"0")+":"+st(i,2,"0")},m:function h(s,e){if(s.date()<e.date())return-h(e,s);var a=12*(e.year()-s.year())+(e.month()-s.month()),i=s.clone().add(a,p),c=e-i<0,u=s.clone().add(a+(c?-1:1),p);return+(-(a+(e-i)/(c?i-u:u-i))||0)},a:function(h){return h<0?Math.ceil(h)||0:Math.floor(h)},p:function(h){return{M:p,y:_,w:L,d:y,D:B,h:b,m:d,s:g,ms:m,Q:it}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(h){return h===void 0}},I="en",z={};z[I]=Dt;var Lt="$isDayjsObject",xt=function(h){return h instanceof bt||!(!h||!h[Lt])},Tt=function h(s,e,a){var i;if(!s)return I;if(typeof s=="string"){var c=s.toLowerCase();z[c]&&(i=c),e&&(z[c]=e,i=c);var u=s.split("-");if(!i&&u.length>1)return h(u[0])}else{var M=s.name;z[M]=s,i=M}return!a&&i&&(I=i),i||!a&&I},F=function(h,s){if(xt(h))return h.clone();var e=typeof s=="object"?s:{};return e.date=h,e.args=arguments,new bt(e)},$=Q;$.l=Tt,$.i=xt,$.w=function(h,s){return F(h,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var bt=function(){function h(e){this.$L=Tt(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[Lt]=!0}var s=h.prototype;return s.parse=function(e){this.$d=function(a){var i=a.date,c=a.utc;if(i===null)return new Date(NaN);if($.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var u=i.match(St);if(u){var M=u[2]-1||0,Y=(u[7]||"0").substring(0,3);return c?new Date(Date.UTC(u[1],M,u[3]||1,u[4]||0,u[5]||0,u[6]||0,Y)):new Date(u[1],M,u[3]||1,u[4]||0,u[5]||0,u[6]||0,Y)}}return new Date(i)}(e),this.init()},s.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},s.$utils=function(){return $},s.isValid=function(){return this.$d.toString()!==Mt},s.isSame=function(e,a){var i=F(e);return this.startOf(a)<=i&&i<=this.endOf(a)},s.isAfter=function(e,a){return F(e)<this.startOf(a)},s.isBefore=function(e,a){return this.endOf(a)<F(e)},s.$g=function(e,a,i){return $.u(e)?this[a]:this.set(i,e)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(e,a){var i=this,c=!!$.u(a)||a,u=$.p(e),M=function(J,E){var N=$.w(i.$u?Date.UTC(i.$y,E,J):new Date(i.$y,E,J),i);return c?N:N.endOf(y)},Y=function(J,E){return $.w(i.toDate()[J].apply(i.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(E)),i)},H=this.$W,O=this.$M,P=this.$D,K="set"+(this.$u?"UTC":"");switch(u){case _:return c?M(1,0):M(31,11);case p:return c?M(1,O):M(0,O+1);case L:var q=this.$locale().weekStart||0,nt=(H<q?H+7:H)-q;return M(c?P-nt:P+(6-nt),O);case y:case B:return Y(K+"Hours",0);case b:return Y(K+"Minutes",1);case d:return Y(K+"Seconds",2);case g:return Y(K+"Milliseconds",3);default:return this.clone()}},s.endOf=function(e){return this.startOf(e,!1)},s.$set=function(e,a){var i,c=$.p(e),u="set"+(this.$u?"UTC":""),M=(i={},i[y]=u+"Date",i[B]=u+"Date",i[p]=u+"Month",i[_]=u+"FullYear",i[b]=u+"Hours",i[d]=u+"Minutes",i[g]=u+"Seconds",i[m]=u+"Milliseconds",i)[c],Y=c===y?this.$D+(a-this.$W):a;if(c===p||c===_){var H=this.clone().set(B,1);H.$d[M](Y),H.init(),this.$d=H.set(B,Math.min(this.$D,H.daysInMonth())).$d}else M&&this.$d[M](Y);return this.init(),this},s.set=function(e,a){return this.clone().$set(e,a)},s.get=function(e){return this[$.p(e)]()},s.add=function(e,a){var i,c=this;e=Number(e);var u=$.p(a),M=function(O){var P=F(c);return $.w(P.date(P.date()+Math.round(O*e)),c)};if(u===p)return this.set(p,this.$M+e);if(u===_)return this.set(_,this.$y+e);if(u===y)return M(1);if(u===L)return M(7);var Y=(i={},i[d]=o,i[b]=l,i[g]=n,i)[u]||1,H=this.$d.getTime()+e*Y;return $.w(H,this)},s.subtract=function(e,a){return this.add(-1*e,a)},s.format=function(e){var a=this,i=this.$locale();if(!this.isValid())return i.invalidDate||Mt;var c=e||"YYYY-MM-DDTHH:mm:ssZ",u=$.z(this),M=this.$H,Y=this.$m,H=this.$M,O=i.weekdays,P=i.months,K=i.meridiem,q=function(E,N,rt,yt){return E&&(E[N]||E(a,c))||rt[N].slice(0,yt)},nt=function(E){return $.s(M%12||12,E,"0")},J=K||function(E,N,rt){var yt=E<12?"AM":"PM";return rt?yt.toLowerCase():yt};return c.replace(Yt,function(E,N){return N||function(rt){switch(rt){case"YY":return String(a.$y).slice(-2);case"YYYY":return $.s(a.$y,4,"0");case"M":return H+1;case"MM":return $.s(H+1,2,"0");case"MMM":return q(i.monthsShort,H,P,3);case"MMMM":return q(P,H);case"D":return a.$D;case"DD":return $.s(a.$D,2,"0");case"d":return String(a.$W);case"dd":return q(i.weekdaysMin,a.$W,O,2);case"ddd":return q(i.weekdaysShort,a.$W,O,3);case"dddd":return O[a.$W];case"H":return String(M);case"HH":return $.s(M,2,"0");case"h":return nt(1);case"hh":return nt(2);case"a":return J(M,Y,!0);case"A":return J(M,Y,!1);case"m":return String(Y);case"mm":return $.s(Y,2,"0");case"s":return String(a.$s);case"ss":return $.s(a.$s,2,"0");case"SSS":return $.s(a.$ms,3,"0");case"Z":return u}return null}(E)||u.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(e,a,i){var c,u=this,M=$.p(a),Y=F(e),H=(Y.utcOffset()-this.utcOffset())*o,O=this-Y,P=function(){return $.m(u,Y)};switch(M){case _:c=P()/12;break;case p:c=P();break;case it:c=P()/3;break;case L:c=(O-H)/6048e5;break;case y:c=(O-H)/864e5;break;case b:c=O/l;break;case d:c=O/o;break;case g:c=O/n;break;default:c=O}return i?c:$.a(c)},s.daysInMonth=function(){return this.endOf(p).$D},s.$locale=function(){return z[this.$L]},s.locale=function(e,a){if(!e)return this.$L;var i=this.clone(),c=Tt(e,a,!0);return c&&(i.$L=c),i},s.clone=function(){return $.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()},h}(),Ot=bt.prototype;return F.prototype=Ot,[["$ms",m],["$s",g],["$m",d],["$H",b],["$W",y],["$M",p],["$y",_],["$D",B]].forEach(function(h){Ot[h[1]]=function(s){return this.$g(s,h[0],h[1])}}),F.extend=function(h,s){return h.$i||(h(s,bt,F),h.$i=!0),F},F.locale=Tt,F.isDayjs=xt,F.unix=function(h){return F(1e3*h)},F.en=z[I],F.Ls=z,F.p={},F})})(Ht);var It=Ht.exports;const jt=ht(It),ct=(f,t="MM/DD HH:mm")=>jt(f).format(t),wt=(f,t)=>{let n,o=0;return(...l)=>{const m=Date.now(),g=m-o;!o||g>=t?(o=m,f.apply(void 0,l)):n||(n=setTimeout(()=>{o=m,f.apply(void 0,l),n=null},t-g))}},Ct=f=>{const[t,n]=[f[0],f[1]],o=n.clientX-t.clientX,l=n.clientY-t.clientY;return Math.sqrt(o*o+l*l)},Rt=(f,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const o=n.getContext("2d");o.fillStyle=f,o.fillRect(0,0,1,1);const l=o.getImageData(0,0,1,1).data;return`rgba(${l[0]}, ${l[1]}, ${l[2]}, ${t})`},Bt=({xCenterPoint:f,cfg:t,timePerPixel:n,timeSpacing:o,currentTime:l,$canvas:m,screenScaleCount:g,scaleHeight:d,startTime:b,drawLine:y,drawText:L,drawArea:p})=>{const it=({space:B,scaleTimeFormat:Mt,bgTimeFormat:St,pointerTimeFormat:Yt})=>{L({x:m.width-f/10,y:6,text:ct(l,St),fontSize:`${m.height-5}px`,align:"right",baseLine:"top",color:t.bgTextColor});const Dt=b%o,st=Dt/n;for(let Q=0;Q<g;Q++){const I=Q*t.scaleSpacing-st-t.pointerWidth/2,z=b+Q*o-Dt;if(z%(o*B)===0){y({x:I,y:d.long}),L({x:I,y:m.height-d.long-5,text:ct(z,Mt),baseLine:"bottom"});continue}y({x:I,y:d.short})}y({x:f-t.pointerWidth/2,y:m.height,width:t.pointerWidth,color:t.pointerColor}),p({startX:f-t.pointerDisplayWidth/2,startY:4,endX:f+t.pointerDisplayWidth/2,endY:4+t.pointerDisplayHeight,bgColor:t.pointerColor}),L({x:f,y:t.pointerDisplayHeight/2+5,text:ct(l,Yt),align:"center",baseLine:"middle"})},_=t.thresholdsConfig[o];_&&it({space:_.space,scaleTimeFormat:_.scaleTimeFormat,bgTimeFormat:_.bgTimeFormat,pointerTimeFormat:_.pointerTimeFormat})},Nt={fill:!0,width:1e3,height:60,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",fontFamily:"Arial",scaleColor:"#ffffff",scaleSpacing:7,areaBgColor:"#ffffff55",pointerColor:"#00aeec",pointerWidth:3,pointerDisplayWidth:100,pointerDisplayHeight:14,fps:60,zoom:3,timeSpacingList:[10,100,1e3,1e4,6e4,6e5,36e5,864e5,6048e5],thresholdsConfig:{10:{scaleTimeFormat:"mm:ss:SSS",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},100:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},1e3:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},1e4:{scaleTimeFormat:"HH:mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:12},6e4:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},6e5:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},36e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"MM/DD HH:mm",space:12},864e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"YYYY/MM/DD HH:mm",space:12},6048e5:{scaleTimeFormat:"YYYY/MM/DD",bgTimeFormat:"YYYY",pointerTimeFormat:"YYYY/MM/DD",space:10}}};class Ut{constructor(t,n){w(this,ut);w(this,lt);w(this,ft);w(this,dt);w(this,mt);w(this,gt);w(this,$t);w(this,vt);w(this,Z);at(this,"$canvas");at(this,"$canvasParent");at(this,"ctx");at(this,"cfg");w(this,tt,void 0);w(this,j,void 0);w(this,V,D());w(this,C,0);w(this,k,void 0);w(this,T,void 0);w(this,U,void 0);w(this,X,!1);w(this,R,null);w(this,A,null);w(this,pt,({x:t,y:n,width:o=1,color:l=this.cfg.scaleColor})=>{this.ctx.beginPath(),this.ctx.moveTo(t,this.$canvas.height),this.ctx.lineTo(t,this.$canvas.height-n),this.ctx.closePath(),this.ctx.strokeStyle=l,this.ctx.lineWidth=o,this.ctx.stroke()});w(this,et,({x:t,y:n,text:o,color:l=this.cfg.textColor,fontSize:m="11px",align:g="center",baseLine:d="alphabetic"})=>{this.ctx.beginPath(),this.ctx.font=`${m} ${this.cfg.fontFamily}`,this.ctx.fillStyle=l,this.ctx.textAlign=g,this.ctx.textBaseline=d,this.ctx.fillText(o,t,n)});w(this,G,({startX:t,startY:n,endX:o,endY:l,bgColor:m})=>{this.ctx.beginPath(),this.ctx.rect(t,n,o-t,l-n),this.ctx.fillStyle=m,this.ctx.fill()});if(!t)throw new Error("canvas Element Or Element ID is required!");typeof t=="string"?this.$canvas=document.querySelector(t):this.$canvas=t,this.ctx=this.$canvas.getContext("2d"),this.cfg={...Nt,...n},n!=null&&n.pointColor&&(this.cfg.pointerColor=n.pointColor),n!=null&&n.pointWidth&&(this.cfg.pointerWidth=n.pointWidth);const{fill:o,width:l,height:m,zoom:g,timeSpacingList:d,scaleHeight:b,textColor:y,bgTextColor:L}=this.cfg;if(L||(this.cfg.bgTextColor=Rt(y,.18)),g<0||g>=d.length||g%1!==0)throw new Error(`zoom must be 0 ~ ${d.length-1}, and must be an integer`);if(o){const p=this.$canvas.parentElement;this.$canvasParent=p,this.$canvas.width=p.clientWidth,this.$canvas.height=p.clientHeight,new ResizeObserver(wt(W(this,gt,Xt).bind(this),200)).observe(p)}else this.$canvas.width=l,this.$canvas.height=m;S(this,T,d[g]),b!=null&&b.long&&(b!=null&&b.short)?S(this,U,b):S(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",W(this,lt,Et).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",W(this,ut,_t).bind(this)),this.$canvas.addEventListener("touchstart",W(this,ft,Wt).bind(this),{passive:!1}),this.$canvas.addEventListener("touchmove",wt(W(this,dt,Pt).bind(this),1e3/this.cfg.fps),{passive:!1}),this.$canvas.addEventListener("touchend",W(this,mt,kt).bind(this))}draw({currentTime:t,areas:n,_privateFlag:o}={}){if(r(this,X)&&!o)return;S(this,C,t||Date.now()),S(this,k,n||[]);const l=this.$canvas.width/2,m=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),g=m*r(this,T),[d,b]=S(this,tt,[r(this,C)-g/2,r(this,C)+g/2]);S(this,j,g/this.$canvas.width),W(this,$t,zt).call(this),r(this,G).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),r(this,k).forEach(y=>{const L=y.startTime<=d?0:Math.round((y.startTime-d)/r(this,j)),p=y.endTime>=b?this.$canvas.width:Math.round((y.endTime-d)/r(this,j));L<this.$canvas.width&&p>0&&r(this,G).call(this,{startX:L,startY:0,endX:p,endY:this.$canvas.height,bgColor:y.bgColor||this.cfg.areaBgColor})}),Bt.bind(this)({xCenterPoint:l,screenScaleCount:m,startTime:d,timePerPixel:r(this,j),scaleHeight:r(this,U),timeSpacing:r(this,T),currentTime:r(this,C),$canvas:this.$canvas,cfg:this.cfg,drawLine:r(this,pt).bind(this),drawText:r(this,et).bind(this),drawArea:r(this,G).bind(this)}),W(this,vt,At).call(this)}getCurrentTime(){return r(this,C)}getTimeRange(){return r(this,tt)}getMsPerPixel(){return r(this,j)}on(t,n){r(this,V).on(t,n)}off(t,n){r(this,V).off(t,n)}}return tt=new WeakMap,j=new WeakMap,V=new WeakMap,C=new WeakMap,k=new WeakMap,T=new WeakMap,U=new WeakMap,X=new WeakMap,R=new WeakMap,A=new WeakMap,ut=new WeakSet,_t=function(t){S(this,X,!0);let n=t.clientX,o=r(this,C);const l=wt(({clientX:d})=>{r(this,X)&&(o=Math.round(r(this,C)-r(this,T)/this.cfg.scaleSpacing*(d-n)),n=d,this.draw({currentTime:o,areas:r(this,k),_privateFlag:!0}))},1e3/this.cfg.fps),m=d=>{const b=this.$canvas.getBoundingClientRect(),y=d.clientX-b.left,L=d.clientY-b.top,p=3;(y<p||y>this.$canvas.width-p||L<p||L>this.$canvas.height-p)&&(this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",m))},g=()=>{this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g),S(this,X,!1),W(this,Z,ot).call(this,"dragged",o)};this.$canvas.addEventListener("mousemove",l),this.$canvas.addEventListener("mousemove",m),document.addEventListener("mouseup",g)},lt=new WeakSet,Et=function(t){t.preventDefault();const n=this.cfg.timeSpacingList.findIndex(o=>o===r(this,T));t.deltaY<0&&n>0?(S(this,T,this.cfg.timeSpacingList[n-1]),this.draw({currentTime:r(this,C),areas:r(this,k),_privateFlag:!0}),W(this,Z,ot).call(this,"zoom",n-1)):t.deltaY>0&&n<this.cfg.timeSpacingList.length-1&&(S(this,T,this.cfg.timeSpacingList[n+1]),this.draw({currentTime:r(this,C),areas:r(this,k),_privateFlag:!0}),W(this,Z,ot).call(this,"zoom",n+1))},ft=new WeakSet,Wt=function(t){t.preventDefault(),S(this,X,!0),S(this,R,t.touches[0].clientX),t.touches.length===2&&S(this,A,Ct(t.touches))},dt=new WeakSet,Pt=function(t){if(t.preventDefault(),!r(this,X))return;if(t.touches.length===2&&r(this,A)!==null){const m=Ct(t.touches),g=Math.abs(r(this,A)-m)>=35;if(!g)return;let d=this.cfg.timeSpacingList.findIndex(b=>b===r(this,T));if(m<r(this,A)?d+=1:d-=1,d<0||d>this.cfg.timeSpacingList.length-1)return;S(this,T,this.cfg.timeSpacingList[d]),g&&S(this,A,m),this.draw({currentTime:r(this,C),areas:r(this,k),_privateFlag:!0});return}if(r(this,R)===null)return;const n=t.touches[0],o=n.clientX-r(this,R),l=Math.round(r(this,C)-r(this,T)/this.cfg.scaleSpacing*o);S(this,R,n.clientX),this.draw({currentTime:l,areas:r(this,k),_privateFlag:!0})},mt=new WeakSet,kt=function(t){r(this,X)&&(S(this,X,!1),S(this,R,null),t.touches.length<2&&S(this,A,null),W(this,Z,ot).call(this,"dragged",r(this,C)))},gt=new WeakSet,Xt=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||S(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:r(this,C),areas:r(this,k)}))},$t=new WeakSet,zt=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},vt=new WeakSet,At=function(){const t=()=>r(this,T)<1e3?`${r(this,T)}ms`:r(this,T)<6e4?`${Math.round(r(this,T)/100)/10}sec`:r(this,T)<36e5?`${Math.round(r(this,T)/100/60)/10}min`:r(this,T)<864e5?`${Math.round(r(this,T)/100/60/60)/10}hours`:r(this,T)<6048e5?`${Math.round(r(this,T)/100/60/60/24)/10}days`:`${Math.round(r(this,T)/100/60/60/24/7)/10}weeks`;r(this,et).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:t(),align:"left",baseLine:"middle"}),this.ctx.beginPath(),this.ctx.moveTo(5,6),this.ctx.lineTo(5,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,6),this.ctx.strokeStyle=this.cfg.scaleColor,this.ctx.lineWidth=1.5,this.ctx.stroke()},pt=new WeakMap,et=new WeakMap,G=new WeakMap,Z=new WeakSet,ot=function(...t){r(this,V).emit(...t)},v.default=Ut,v.format=ct,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),v}({}); | ||
var $timeline=function(S){"use strict";var Rt=Object.defineProperty;var Ot=S=>{throw TypeError(S)};var Bt=(S,H,W)=>H in S?Rt(S,H,{enumerable:!0,configurable:!0,writable:!0,value:W}):S[H]=W;var dt=(S,H,W)=>Bt(S,typeof H!="symbol"?H+"":H,W),xt=(S,H,W)=>H.has(S)||Ot("Cannot "+W);var a=(S,H,W)=>(xt(S,H,"read from private field"),W?W.call(S):H.get(S)),N=(S,H,W)=>H.has(S)?Ot("Cannot add the same private member more than once"):H instanceof WeakSet?H.add(S):H.set(S,W),E=(S,H,W,at)=>(xt(S,H,"write to private field"),at?at.call(S,W):H.set(S,W),W),q=(S,H,W)=>(xt(S,H,"access private method"),W);var ut,tt,ot,X,V,F,st,G,et,K,L,Ct,Ht,Ft,Lt,zt,_t,Et,Wt,vt,ft,ht,$t;function H(g){return{all:g=g||new Map,on:function(t,i){var r=g.get(t);r?r.push(i):g.set(t,[i])},off:function(t,i){var r=g.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):g.set(t,[]))},emit:function(t,i){var r=g.get(t);r&&r.slice().map(function($){$(i)}),(r=g.get("*"))&&r.slice().map(function($){$(t,i)})}}}var W=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function at(g){return g&&g.__esModule&&Object.prototype.hasOwnProperty.call(g,"default")?g.default:g}var yt={exports:{}};(function(g,t){(function(i,r){g.exports=r()})(W,function(){var i=1e3,r=6e4,$=36e5,p="millisecond",f="second",l="minute",c="hour",y="day",z="week",D="month",Y="quarter",T="year",v="date",o="Invalid Date",x=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|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,_={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(u){var n=["th","st","nd","rd"],e=u%100;return"["+u+(n[(e-20)%10]||n[e]||n[0])+"]"}},b=function(u,n,e){var h=String(u);return!h||h.length>=n?u:""+Array(n+1-h.length).join(e)+u},A={s:b,z:function(u){var n=-u.utcOffset(),e=Math.abs(n),h=Math.floor(e/60),s=e%60;return(n<=0?"+":"-")+b(h,2,"0")+":"+b(s,2,"0")},m:function u(n,e){if(n.date()<e.date())return-u(e,n);var h=12*(e.year()-n.year())+(e.month()-n.month()),s=n.clone().add(h,D),m=e-s<0,d=n.clone().add(h+(m?-1:1),D);return+(-(h+(e-s)/(m?s-d:d-s))||0)},a:function(u){return u<0?Math.ceil(u)||0:Math.floor(u)},p:function(u){return{M:D,y:T,w:z,d:y,D:v,h:c,m:l,s:f,ms:p,Q:Y}[u]||String(u||"").toLowerCase().replace(/s$/,"")},u:function(u){return u===void 0}},O="en",I={};I[O]=_;var Z="$isDayjsObject",Q=function(u){return u instanceof pt||!(!u||!u[Z])},B=function u(n,e,h){var s;if(!n)return O;if(typeof n=="string"){var m=n.toLowerCase();I[m]&&(s=m),e&&(I[m]=e,s=m);var d=n.split("-");if(!s&&d.length>1)return u(d[0])}else{var w=n.name;I[w]=n,s=w}return!h&&s&&(O=s),s||!h&&O},C=function(u,n){if(Q(u))return u.clone();var e=typeof n=="object"?n:{};return e.date=u,e.args=arguments,new pt(e)},M=A;M.l=B,M.i=Q,M.w=function(u,n){return C(u,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var pt=function(){function u(e){this.$L=B(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[Z]=!0}var n=u.prototype;return n.parse=function(e){this.$d=function(h){var s=h.date,m=h.utc;if(s===null)return new Date(NaN);if(M.u(s))return new Date;if(s instanceof Date)return new Date(s);if(typeof s=="string"&&!/Z$/i.test(s)){var d=s.match(x);if(d){var w=d[2]-1||0,P=(d[7]||"0").substring(0,3);return m?new Date(Date.UTC(d[1],w,d[3]||1,d[4]||0,d[5]||0,d[6]||0,P)):new Date(d[1],w,d[3]||1,d[4]||0,d[5]||0,d[6]||0,P)}}return new Date(s)}(e),this.init()},n.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},n.$utils=function(){return M},n.isValid=function(){return this.$d.toString()!==o},n.isSame=function(e,h){var s=C(e);return this.startOf(h)<=s&&s<=this.endOf(h)},n.isAfter=function(e,h){return C(e)<this.startOf(h)},n.isBefore=function(e,h){return this.endOf(h)<C(e)},n.$g=function(e,h,s){return M.u(e)?this[h]:this.set(s,e)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(e,h){var s=this,m=!!M.u(h)||h,d=M.p(e),w=function(rt,R){var it=M.w(s.$u?Date.UTC(s.$y,R,rt):new Date(s.$y,R,rt),s);return m?it:it.endOf(y)},P=function(rt,R){return M.w(s.toDate()[rt].apply(s.toDate("s"),(m?[0,0,0,0]:[23,59,59,999]).slice(R)),s)},U=this.$W,j=this.$M,J=this.$D,ct="set"+(this.$u?"UTC":"");switch(d){case T:return m?w(1,0):w(31,11);case D:return m?w(1,j):w(0,j+1);case z:var nt=this.$locale().weekStart||0,lt=(U<nt?U+7:U)-nt;return w(m?J-lt:J+(6-lt),j);case y:case v:return P(ct+"Hours",0);case c:return P(ct+"Minutes",1);case l:return P(ct+"Seconds",2);case f:return P(ct+"Milliseconds",3);default:return this.clone()}},n.endOf=function(e){return this.startOf(e,!1)},n.$set=function(e,h){var s,m=M.p(e),d="set"+(this.$u?"UTC":""),w=(s={},s[y]=d+"Date",s[v]=d+"Date",s[D]=d+"Month",s[T]=d+"FullYear",s[c]=d+"Hours",s[l]=d+"Minutes",s[f]=d+"Seconds",s[p]=d+"Milliseconds",s)[m],P=m===y?this.$D+(h-this.$W):h;if(m===D||m===T){var U=this.clone().set(v,1);U.$d[w](P),U.init(),this.$d=U.set(v,Math.min(this.$D,U.daysInMonth())).$d}else w&&this.$d[w](P);return this.init(),this},n.set=function(e,h){return this.clone().$set(e,h)},n.get=function(e){return this[M.p(e)]()},n.add=function(e,h){var s,m=this;e=Number(e);var d=M.p(h),w=function(j){var J=C(m);return M.w(J.date(J.date()+Math.round(j*e)),m)};if(d===D)return this.set(D,this.$M+e);if(d===T)return this.set(T,this.$y+e);if(d===y)return w(1);if(d===z)return w(7);var P=(s={},s[l]=r,s[c]=$,s[f]=i,s)[d]||1,U=this.$d.getTime()+e*P;return M.w(U,this)},n.subtract=function(e,h){return this.add(-1*e,h)},n.format=function(e){var h=this,s=this.$locale();if(!this.isValid())return s.invalidDate||o;var m=e||"YYYY-MM-DDTHH:mm:ssZ",d=M.z(this),w=this.$H,P=this.$m,U=this.$M,j=s.weekdays,J=s.months,ct=s.meridiem,nt=function(R,it,mt,Mt){return R&&(R[it]||R(h,m))||mt[it].slice(0,Mt)},lt=function(R){return M.s(w%12||12,R,"0")},rt=ct||function(R,it,mt){var Mt=R<12?"AM":"PM";return mt?Mt.toLowerCase():Mt};return m.replace(k,function(R,it){return it||function(mt){switch(mt){case"YY":return String(h.$y).slice(-2);case"YYYY":return M.s(h.$y,4,"0");case"M":return U+1;case"MM":return M.s(U+1,2,"0");case"MMM":return nt(s.monthsShort,U,J,3);case"MMMM":return nt(J,U);case"D":return h.$D;case"DD":return M.s(h.$D,2,"0");case"d":return String(h.$W);case"dd":return nt(s.weekdaysMin,h.$W,j,2);case"ddd":return nt(s.weekdaysShort,h.$W,j,3);case"dddd":return j[h.$W];case"H":return String(w);case"HH":return M.s(w,2,"0");case"h":return lt(1);case"hh":return lt(2);case"a":return rt(w,P,!0);case"A":return rt(w,P,!1);case"m":return String(P);case"mm":return M.s(P,2,"0");case"s":return String(h.$s);case"ss":return M.s(h.$s,2,"0");case"SSS":return M.s(h.$ms,3,"0");case"Z":return d}return null}(R)||d.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(e,h,s){var m,d=this,w=M.p(h),P=C(e),U=(P.utcOffset()-this.utcOffset())*r,j=this-P,J=function(){return M.m(d,P)};switch(w){case T:m=J()/12;break;case D:m=J();break;case Y:m=J()/3;break;case z:m=(j-U)/6048e5;break;case y:m=(j-U)/864e5;break;case c:m=j/$;break;case l:m=j/r;break;case f:m=j/i;break;default:m=j}return s?m:M.a(m)},n.daysInMonth=function(){return this.endOf(D).$D},n.$locale=function(){return I[this.$L]},n.locale=function(e,h){if(!e)return this.$L;var s=this.clone(),m=B(e,h,!0);return m&&(s.$L=m),s},n.clone=function(){return M.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},u}(),wt=pt.prototype;return C.prototype=wt,[["$ms",p],["$s",f],["$m",l],["$H",c],["$W",y],["$M",D],["$y",T],["$D",v]].forEach(function(u){wt[u[1]]=function(n){return this.$g(n,u[0],u[1])}}),C.extend=function(u,n){return u.$i||(u(n,pt,C),u.$i=!0),C},C.locale=B,C.isDayjs=Q,C.unix=function(u){return C(1e3*u)},C.en=I[O],C.Ls=I,C.p={},C})})(yt);var Pt=yt.exports;const Dt=at(Pt);var St={exports:{}};(function(g,t){(function(i,r){g.exports=r()})(W,function(){var i="minute",r=/[+-]\d\d(?::?\d\d)?/g,$=/([+-]|\d\d)/g;return function(p,f,l){var c=f.prototype;l.utc=function(o){var x={date:o,utc:!0,args:arguments};return new f(x)},c.utc=function(o){var x=l(this.toDate(),{locale:this.$L,utc:!0});return o?x.add(this.utcOffset(),i):x},c.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var y=c.parse;c.parse=function(o){o.utc&&(this.$u=!0),this.$utils().u(o.$offset)||(this.$offset=o.$offset),y.call(this,o)};var z=c.init;c.init=function(){if(this.$u){var o=this.$d;this.$y=o.getUTCFullYear(),this.$M=o.getUTCMonth(),this.$D=o.getUTCDate(),this.$W=o.getUTCDay(),this.$H=o.getUTCHours(),this.$m=o.getUTCMinutes(),this.$s=o.getUTCSeconds(),this.$ms=o.getUTCMilliseconds()}else z.call(this)};var D=c.utcOffset;c.utcOffset=function(o,x){var k=this.$utils().u;if(k(o))return this.$u?0:k(this.$offset)?D.call(this):this.$offset;if(typeof o=="string"&&(o=function(O){O===void 0&&(O="");var I=O.match(r);if(!I)return null;var Z=(""+I[0]).match($)||["-",0,0],Q=Z[0],B=60*+Z[1]+ +Z[2];return B===0?0:Q==="+"?B:-B}(o),o===null))return this;var _=Math.abs(o)<=16?60*o:o,b=this;if(x)return b.$offset=_,b.$u=o===0,b;if(o!==0){var A=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(b=this.local().add(_+A,i)).$offset=_,b.$x.$localOffset=A}else b=this.utc();return b};var Y=c.format;c.format=function(o){var x=o||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return Y.call(this,x)},c.valueOf=function(){var o=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*o},c.isUTC=function(){return!!this.$u},c.toISOString=function(){return this.toDate().toISOString()},c.toString=function(){return this.toDate().toUTCString()};var T=c.toDate;c.toDate=function(o){return o==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():T.call(this)};var v=c.diff;c.diff=function(o,x,k){if(o&&this.$u===o.$u)return v.call(this,o,x,k);var _=this.local(),b=l(o).local();return v.call(_,b,x,k)}}})})(St);var kt=St.exports;const It=at(kt);var Yt={exports:{}};(function(g,t){(function(i,r){g.exports=r()})(W,function(){var i={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function($,p,f){var l,c=function(Y,T,v){v===void 0&&(v={});var o=new Date(Y),x=function(k,_){_===void 0&&(_={});var b=_.timeZoneName||"short",A=k+"|"+b,O=r[A];return O||(O=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:k,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:b}),r[A]=O),O}(T,v);return x.formatToParts(o)},y=function(Y,T){for(var v=c(Y,T),o=[],x=0;x<v.length;x+=1){var k=v[x],_=k.type,b=k.value,A=i[_];A>=0&&(o[A]=parseInt(b,10))}var O=o[3],I=O===24?0:O,Z=o[0]+"-"+o[1]+"-"+o[2]+" "+I+":"+o[4]+":"+o[5]+":000",Q=+Y;return(f.utc(Z).valueOf()-(Q-=Q%1e3))/6e4},z=p.prototype;z.tz=function(Y,T){Y===void 0&&(Y=l);var v,o=this.utcOffset(),x=this.toDate(),k=x.toLocaleString("en-US",{timeZone:Y}),_=Math.round((x-new Date(k))/1e3/60),b=15*-Math.round(x.getTimezoneOffset()/15)-_;if(!Number(b))v=this.utcOffset(0,T);else if(v=f(k,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(b,!0),T){var A=v.utcOffset();v=v.add(o-A,"minute")}return v.$x.$timezone=Y,v},z.offsetName=function(Y){var T=this.$x.$timezone||f.tz.guess(),v=c(this.valueOf(),T,{timeZoneName:Y}).find(function(o){return o.type.toLowerCase()==="timezonename"});return v&&v.value};var D=z.startOf;z.startOf=function(Y,T){if(!this.$x||!this.$x.$timezone)return D.call(this,Y,T);var v=f(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return D.call(v,Y,T).tz(this.$x.$timezone,!0)},f.tz=function(Y,T,v){var o=v&&T,x=v||T||l,k=y(+f(),x);if(typeof Y!="string")return f(Y).tz(x);var _=function(I,Z,Q){var B=I-60*Z*1e3,C=y(B,Q);if(Z===C)return[B,Z];var M=y(B-=60*(C-Z)*1e3,Q);return C===M?[B,C]:[I-60*Math.min(C,M)*1e3,Math.max(C,M)]}(f.utc(Y,o).valueOf(),k,x),b=_[0],A=_[1],O=f(b).utcOffset(A);return O.$x.$timezone=x,O},f.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},f.tz.setDefault=function(Y){l=Y}}})})(Yt);var Ut=Yt.exports;const Xt=at(Ut);Dt.extend(It),Dt.extend(Xt);const gt=(g,t="MM/DD HH:mm Z",i)=>Dt(g).tz(i).format(t),Tt=(g,t)=>{let i,r=0;return(...$)=>{const p=Date.now(),f=p-r;!r||f>=t?(r=p,g.apply(void 0,$)):i||(i=setTimeout(()=>{r=p,g.apply(void 0,$),i=null},t-f))}},bt=g=>{const[t,i]=[g[0],g[1]],r=i.clientX-t.clientX,$=i.clientY-t.clientY;return Math.sqrt(r*r+$*$)},At=(g,t)=>{const i=document.createElement("canvas");i.width=i.height=1;const r=i.getContext("2d");r.fillStyle=g,r.fillRect(0,0,1,1);const $=r.getImageData(0,0,1,1).data;return`rgba(${$[0]}, ${$[1]}, ${$[2]}, ${t})`},Zt=({xCenterPoint:g,cfg:t,timePerPixel:i,timeSpacing:r,currentTime:$,$canvas:p,screenScaleCount:f,scaleHeight:l,startTime:c,drawLine:y,drawText:z,drawArea:D})=>{const Y=({space:v,scaleTimeFormat:o,bgTimeFormat:x,pointerTimeFormat:k,timezone:_})=>{z({x:p.width-g/10,y:6,text:gt($,x,_),fontSize:`${p.height-5}px`,align:"right",baseLine:"top",color:t.bgTextColor});const b=c%r,A=b/i;for(let O=0;O<f;O++){const I=O*t.scaleSpacing-A-t.pointerWidth/2,Z=c+O*r-b;if(Z%(r*v)===0){y({x:I,y:l.long}),z({x:I,y:p.height-l.long-5,text:gt(Z,o,_),baseLine:"bottom"});continue}y({x:I,y:l.short})}y({x:g-t.pointerWidth/2,y:p.height,width:t.pointerWidth,color:t.pointerColor}),D({startX:g-t.pointerDisplayWidth/2,startY:4,endX:g+t.pointerDisplayWidth/2,endY:4+t.pointerDisplayHeight,bgColor:t.pointerColor}),z({x:g,y:t.pointerDisplayHeight/2+5,text:gt($,k,_),align:"center",baseLine:"middle"})},T=t.thresholdsConfig[r];T&&Y({space:T.space,scaleTimeFormat:T.scaleTimeFormat,bgTimeFormat:T.bgTimeFormat,pointerTimeFormat:T.pointerTimeFormat,timezone:t.timezone})},jt={fill:!0,width:1e3,height:60,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",fontFamily:"Arial",scaleColor:"#ffffff",scaleSpacing:7,areaBgColor:"#ffffff55",pointerColor:"#00aeec",pointerWidth:3,pointerDisplayWidth:100,pointerDisplayHeight:14,fps:60,zoom:3,timeSpacingList:[10,100,1e3,1e4,6e4,6e5,36e5,864e5,6048e5],thresholdsConfig:{10:{scaleTimeFormat:"mm:ss:SSS",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},100:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},1e3:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},1e4:{scaleTimeFormat:"HH:mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:12},6e4:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},6e5:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},36e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"MM/DD HH:mm",space:12},864e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"YYYY/MM/DD HH:mm",space:12},6048e5:{scaleTimeFormat:"YYYY/MM/DD",bgTimeFormat:"YYYY",pointerTimeFormat:"YYYY/MM/DD",space:10}}};class Nt{constructor(t,i){N(this,L);dt(this,"$canvas");dt(this,"$canvasParent");dt(this,"ctx");dt(this,"cfg");N(this,ut);N(this,tt);N(this,ot,H());N(this,X,0);N(this,V);N(this,F);N(this,st);N(this,G,!1);N(this,et,null);N(this,K,null);N(this,vt,({x:t,y:i,width:r=1,color:$=this.cfg.scaleColor})=>{this.ctx.beginPath(),this.ctx.moveTo(t,this.$canvas.height),this.ctx.lineTo(t,this.$canvas.height-i),this.ctx.closePath(),this.ctx.strokeStyle=$,this.ctx.lineWidth=r,this.ctx.stroke()});N(this,ft,({x:t,y:i,text:r,color:$=this.cfg.textColor,fontSize:p="11px",align:f="center",baseLine:l="alphabetic"})=>{this.ctx.beginPath(),this.ctx.font=`${p} ${this.cfg.fontFamily}`,this.ctx.fillStyle=$,this.ctx.textAlign=f,this.ctx.textBaseline=l,this.ctx.fillText(r,t,i)});N(this,ht,({startX:t,startY:i,endX:r,endY:$,bgColor:p})=>{this.ctx.beginPath(),this.ctx.rect(t,i,r-t,$-i),this.ctx.fillStyle=p,this.ctx.fill()});if(!t)throw new Error("canvas Element Or Element ID is required!");typeof t=="string"?this.$canvas=document.querySelector(t):this.$canvas=t,this.ctx=this.$canvas.getContext("2d"),this.cfg={...jt,...i},i!=null&&i.pointColor&&(this.cfg.pointerColor=i.pointColor),i!=null&&i.pointWidth&&(this.cfg.pointerWidth=i.pointWidth);const{fill:r,width:$,height:p,zoom:f,timeSpacingList:l,scaleHeight:c,textColor:y,bgTextColor:z}=this.cfg;if(z||(this.cfg.bgTextColor=At(y,.18)),f<0||f>=l.length||f%1!==0)throw new Error(`zoom must be 0 ~ ${l.length-1}, and must be an integer`);if(r){const D=this.$canvas.parentElement;this.$canvasParent=D,this.$canvas.width=D.clientWidth,this.$canvas.height=D.clientHeight,new ResizeObserver(Tt(q(this,L,_t).bind(this),200)).observe(D)}else this.$canvas.width=$,this.$canvas.height=p;E(this,F,l[f]),c!=null&&c.long&&(c!=null&&c.short)?E(this,st,c):E(this,st,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",q(this,L,Ht).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",q(this,L,Ct).bind(this)),this.$canvas.addEventListener("touchstart",q(this,L,Ft).bind(this),{passive:!1}),this.$canvas.addEventListener("touchmove",Tt(q(this,L,Lt).bind(this),1e3/this.cfg.fps),{passive:!1}),this.$canvas.addEventListener("touchend",q(this,L,zt).bind(this))}draw({currentTime:t,areas:i,_privateFlag:r}={}){if(a(this,G)&&!r)return;E(this,X,t||Date.now()),E(this,V,i||[]);const $=this.$canvas.width/2,p=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),f=p*a(this,F),[l,c]=E(this,ut,[a(this,X)-f/2,a(this,X)+f/2]);E(this,tt,f/this.$canvas.width),q(this,L,Et).call(this),a(this,ht).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),a(this,V).forEach(y=>{const z=y.startTime<=l?0:Math.round((y.startTime-l)/a(this,tt)),D=y.endTime>=c?this.$canvas.width:Math.round((y.endTime-l)/a(this,tt));z<this.$canvas.width&&D>0&&a(this,ht).call(this,{startX:z,startY:0,endX:D,endY:this.$canvas.height,bgColor:y.bgColor||this.cfg.areaBgColor})}),Zt.bind(this)({xCenterPoint:$,screenScaleCount:p,startTime:l,timePerPixel:a(this,tt),scaleHeight:a(this,st),timeSpacing:a(this,F),currentTime:a(this,X),$canvas:this.$canvas,cfg:this.cfg,drawLine:a(this,vt).bind(this),drawText:a(this,ft).bind(this),drawArea:a(this,ht).bind(this)}),q(this,L,Wt).call(this)}getCurrentTime(){return a(this,X)}getTimeRange(){return a(this,ut)}getMsPerPixel(){return a(this,tt)}on(t,i){a(this,ot).on(t,i)}off(t,i){a(this,ot).off(t,i)}}return ut=new WeakMap,tt=new WeakMap,ot=new WeakMap,X=new WeakMap,V=new WeakMap,F=new WeakMap,st=new WeakMap,G=new WeakMap,et=new WeakMap,K=new WeakMap,L=new WeakSet,Ct=function(t){E(this,G,!0);let i=t.clientX,r=a(this,X);const $=Tt(({clientX:l})=>{a(this,G)&&(r=Math.round(a(this,X)-a(this,F)/this.cfg.scaleSpacing*(l-i)),i=l,this.draw({currentTime:r,areas:a(this,V),_privateFlag:!0}))},1e3/this.cfg.fps),p=l=>{const c=this.$canvas.getBoundingClientRect(),y=l.clientX-c.left,z=l.clientY-c.top,D=3;(y<D||y>this.$canvas.width-D||z<D||z>this.$canvas.height-D)&&(this.$canvas.removeEventListener("mousemove",$),this.$canvas.removeEventListener("mousemove",p))},f=()=>{this.$canvas.removeEventListener("mousemove",$),this.$canvas.removeEventListener("mousemove",p),document.removeEventListener("mouseup",f),E(this,G,!1),q(this,L,$t).call(this,"dragged",r)};this.$canvas.addEventListener("mousemove",$),this.$canvas.addEventListener("mousemove",p),document.addEventListener("mouseup",f)},Ht=function(t){t.preventDefault();const i=this.cfg.timeSpacingList.findIndex(r=>r===a(this,F));t.deltaY<0&&i>0?(E(this,F,this.cfg.timeSpacingList[i-1]),this.draw({currentTime:a(this,X),areas:a(this,V),_privateFlag:!0}),q(this,L,$t).call(this,"zoom",i-1)):t.deltaY>0&&i<this.cfg.timeSpacingList.length-1&&(E(this,F,this.cfg.timeSpacingList[i+1]),this.draw({currentTime:a(this,X),areas:a(this,V),_privateFlag:!0}),q(this,L,$t).call(this,"zoom",i+1))},Ft=function(t){t.preventDefault(),E(this,G,!0),E(this,et,t.touches[0].clientX),t.touches.length===2&&E(this,K,bt(t.touches))},Lt=function(t){if(t.preventDefault(),!a(this,G))return;if(t.touches.length===2&&a(this,K)!==null){const p=bt(t.touches),f=Math.abs(a(this,K)-p)>=35;if(!f)return;let l=this.cfg.timeSpacingList.findIndex(c=>c===a(this,F));if(p<a(this,K)?l+=1:l-=1,l<0||l>this.cfg.timeSpacingList.length-1)return;E(this,F,this.cfg.timeSpacingList[l]),f&&E(this,K,p),this.draw({currentTime:a(this,X),areas:a(this,V),_privateFlag:!0});return}if(a(this,et)===null)return;const i=t.touches[0],r=i.clientX-a(this,et),$=Math.round(a(this,X)-a(this,F)/this.cfg.scaleSpacing*r);E(this,et,i.clientX),this.draw({currentTime:$,areas:a(this,V),_privateFlag:!0})},zt=function(t){a(this,G)&&(E(this,G,!1),E(this,et,null),t.touches.length<2&&E(this,K,null),q(this,L,$t).call(this,"dragged",a(this,X)))},_t=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||E(this,st,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:a(this,X),areas:a(this,V)}))},Et=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},Wt=function(){const t=()=>a(this,F)<1e3?`${a(this,F)}ms`:a(this,F)<6e4?`${Math.round(a(this,F)/100)/10}sec`:a(this,F)<36e5?`${Math.round(a(this,F)/100/60)/10}min`:a(this,F)<864e5?`${Math.round(a(this,F)/100/60/60)/10}hours`:a(this,F)<6048e5?`${Math.round(a(this,F)/100/60/60/24)/10}days`:`${Math.round(a(this,F)/100/60/60/24/7)/10}weeks`;a(this,ft).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:t(),align:"left",baseLine:"middle"}),this.ctx.beginPath(),this.ctx.moveTo(5,6),this.ctx.lineTo(5,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,6),this.ctx.strokeStyle=this.cfg.scaleColor,this.ctx.lineWidth=1.5,this.ctx.stroke()},vt=new WeakMap,ft=new WeakMap,ht=new WeakMap,$t=function(...t){a(this,ot).emit(...t)},S.default=Nt,S.format=gt,Object.defineProperties(S,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),S}({}); |
@@ -1,1 +0,1 @@ | ||
(function(m,$){typeof exports=="object"&&typeof module<"u"?$(exports):typeof define=="function"&&define.amd?define(["exports"],$):(m=typeof globalThis<"u"?globalThis:m||self,$(m.$timeline={}))})(this,function(m){"use strict";var Zt=Object.defineProperty;var qt=(m,$,Y)=>$ in m?Zt(m,$,{enumerable:!0,configurable:!0,writable:!0,value:Y}):m[$]=Y;var at=(m,$,Y)=>(qt(m,typeof $!="symbol"?$+"":$,Y),Y),Ft=(m,$,Y)=>{if(!$.has(m))throw TypeError("Cannot "+Y)};var r=(m,$,Y)=>(Ft(m,$,"read from private field"),Y?Y.call(m):$.get(m)),w=(m,$,Y)=>{if($.has(m))throw TypeError("Cannot add the same private member more than once");$ instanceof WeakSet?$.add(m):$.set(m,Y)},x=(m,$,Y,ht)=>(Ft(m,$,"write to private field"),ht?ht.call(m,Y):$.set(m,Y),Y);var W=(m,$,Y)=>(Ft(m,$,"access private method"),Y);var tt,I,V,C,k,D,U,X,R,z,ut,_t,lt,Et,ft,Wt,dt,Pt,mt,kt,gt,Xt,$t,jt,vt,zt,pt,et,G,Z,ot;function $(f){return{all:f=f||new Map,on:function(t,n){var o=f.get(t);o?o.push(n):f.set(t,[n])},off:function(t,n){var o=f.get(t);o&&(n?o.splice(o.indexOf(n)>>>0,1):f.set(t,[]))},emit:function(t,n){var o=f.get(t);o&&o.slice().map(function(l){l(n)}),(o=f.get("*"))&&o.slice().map(function(l){l(t,n)})}}}var Y=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ht(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var Ht={exports:{}};(function(f,t){(function(n,o){f.exports=o()})(Y,function(){var n=1e3,o=6e4,l=36e5,g="millisecond",v="second",d="minute",y="hour",b="day",L="week",M="month",it="quarter",_="year",B="date",Mt="Invalid Date",xt=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,St=/\[([^\]]+)]|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,Tt={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(h){var s=["th","st","nd","rd"],e=h%100;return"["+h+(s[(e-20)%10]||s[e]||s[0])+"]"}},st=function(h,s,e){var a=String(h);return!a||a.length>=s?h:""+Array(s+1-a.length).join(e)+h},Q={s:st,z:function(h){var s=-h.utcOffset(),e=Math.abs(s),a=Math.floor(e/60),i=e%60;return(s<=0?"+":"-")+st(a,2,"0")+":"+st(i,2,"0")},m:function h(s,e){if(s.date()<e.date())return-h(e,s);var a=12*(e.year()-s.year())+(e.month()-s.month()),i=s.clone().add(a,M),c=e-i<0,u=s.clone().add(a+(c?-1:1),M);return+(-(a+(e-i)/(c?i-u:u-i))||0)},a:function(h){return h<0?Math.ceil(h)||0:Math.floor(h)},p:function(h){return{M,y:_,w:L,d:b,D:B,h:y,m:d,s:v,ms:g,Q:it}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(h){return h===void 0}},A="en",j={};j[A]=Tt;var Lt="$isDayjsObject",Yt=function(h){return h instanceof yt||!(!h||!h[Lt])},Dt=function h(s,e,a){var i;if(!s)return A;if(typeof s=="string"){var c=s.toLowerCase();j[c]&&(i=c),e&&(j[c]=e,i=c);var u=s.split("-");if(!i&&u.length>1)return h(u[0])}else{var T=s.name;j[T]=s,i=T}return!a&&i&&(A=i),i||!a&&A},F=function(h,s){if(Yt(h))return h.clone();var e=typeof s=="object"?s:{};return e.date=h,e.args=arguments,new yt(e)},p=Q;p.l=Dt,p.i=Yt,p.w=function(h,s){return F(h,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var yt=function(){function h(e){this.$L=Dt(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[Lt]=!0}var s=h.prototype;return s.parse=function(e){this.$d=function(a){var i=a.date,c=a.utc;if(i===null)return new Date(NaN);if(p.u(i))return new Date;if(i instanceof Date)return new Date(i);if(typeof i=="string"&&!/Z$/i.test(i)){var u=i.match(xt);if(u){var T=u[2]-1||0,S=(u[7]||"0").substring(0,3);return c?new Date(Date.UTC(u[1],T,u[3]||1,u[4]||0,u[5]||0,u[6]||0,S)):new Date(u[1],T,u[3]||1,u[4]||0,u[5]||0,u[6]||0,S)}}return new Date(i)}(e),this.init()},s.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},s.$utils=function(){return p},s.isValid=function(){return this.$d.toString()!==Mt},s.isSame=function(e,a){var i=F(e);return this.startOf(a)<=i&&i<=this.endOf(a)},s.isAfter=function(e,a){return F(e)<this.startOf(a)},s.isBefore=function(e,a){return this.endOf(a)<F(e)},s.$g=function(e,a,i){return p.u(e)?this[a]:this.set(i,e)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(e,a){var i=this,c=!!p.u(a)||a,u=p.p(e),T=function(J,E){var N=p.w(i.$u?Date.UTC(i.$y,E,J):new Date(i.$y,E,J),i);return c?N:N.endOf(b)},S=function(J,E){return p.w(i.toDate()[J].apply(i.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(E)),i)},H=this.$W,O=this.$M,P=this.$D,K="set"+(this.$u?"UTC":"");switch(u){case _:return c?T(1,0):T(31,11);case M:return c?T(1,O):T(0,O+1);case L:var q=this.$locale().weekStart||0,nt=(H<q?H+7:H)-q;return T(c?P-nt:P+(6-nt),O);case b:case B:return S(K+"Hours",0);case y:return S(K+"Minutes",1);case d:return S(K+"Seconds",2);case v:return S(K+"Milliseconds",3);default:return this.clone()}},s.endOf=function(e){return this.startOf(e,!1)},s.$set=function(e,a){var i,c=p.p(e),u="set"+(this.$u?"UTC":""),T=(i={},i[b]=u+"Date",i[B]=u+"Date",i[M]=u+"Month",i[_]=u+"FullYear",i[y]=u+"Hours",i[d]=u+"Minutes",i[v]=u+"Seconds",i[g]=u+"Milliseconds",i)[c],S=c===b?this.$D+(a-this.$W):a;if(c===M||c===_){var H=this.clone().set(B,1);H.$d[T](S),H.init(),this.$d=H.set(B,Math.min(this.$D,H.daysInMonth())).$d}else T&&this.$d[T](S);return this.init(),this},s.set=function(e,a){return this.clone().$set(e,a)},s.get=function(e){return this[p.p(e)]()},s.add=function(e,a){var i,c=this;e=Number(e);var u=p.p(a),T=function(O){var P=F(c);return p.w(P.date(P.date()+Math.round(O*e)),c)};if(u===M)return this.set(M,this.$M+e);if(u===_)return this.set(_,this.$y+e);if(u===b)return T(1);if(u===L)return T(7);var S=(i={},i[d]=o,i[y]=l,i[v]=n,i)[u]||1,H=this.$d.getTime()+e*S;return p.w(H,this)},s.subtract=function(e,a){return this.add(-1*e,a)},s.format=function(e){var a=this,i=this.$locale();if(!this.isValid())return i.invalidDate||Mt;var c=e||"YYYY-MM-DDTHH:mm:ssZ",u=p.z(this),T=this.$H,S=this.$m,H=this.$M,O=i.weekdays,P=i.months,K=i.meridiem,q=function(E,N,rt,bt){return E&&(E[N]||E(a,c))||rt[N].slice(0,bt)},nt=function(E){return p.s(T%12||12,E,"0")},J=K||function(E,N,rt){var bt=E<12?"AM":"PM";return rt?bt.toLowerCase():bt};return c.replace(St,function(E,N){return N||function(rt){switch(rt){case"YY":return String(a.$y).slice(-2);case"YYYY":return p.s(a.$y,4,"0");case"M":return H+1;case"MM":return p.s(H+1,2,"0");case"MMM":return q(i.monthsShort,H,P,3);case"MMMM":return q(P,H);case"D":return a.$D;case"DD":return p.s(a.$D,2,"0");case"d":return String(a.$W);case"dd":return q(i.weekdaysMin,a.$W,O,2);case"ddd":return q(i.weekdaysShort,a.$W,O,3);case"dddd":return O[a.$W];case"H":return String(T);case"HH":return p.s(T,2,"0");case"h":return nt(1);case"hh":return nt(2);case"a":return J(T,S,!0);case"A":return J(T,S,!1);case"m":return String(S);case"mm":return p.s(S,2,"0");case"s":return String(a.$s);case"ss":return p.s(a.$s,2,"0");case"SSS":return p.s(a.$ms,3,"0");case"Z":return u}return null}(E)||u.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(e,a,i){var c,u=this,T=p.p(a),S=F(e),H=(S.utcOffset()-this.utcOffset())*o,O=this-S,P=function(){return p.m(u,S)};switch(T){case _:c=P()/12;break;case M:c=P();break;case it:c=P()/3;break;case L:c=(O-H)/6048e5;break;case b:c=(O-H)/864e5;break;case y:c=O/l;break;case d:c=O/o;break;case v:c=O/n;break;default:c=O}return i?c:p.a(c)},s.daysInMonth=function(){return this.endOf(M).$D},s.$locale=function(){return j[this.$L]},s.locale=function(e,a){if(!e)return this.$L;var i=this.clone(),c=Dt(e,a,!0);return c&&(i.$L=c),i},s.clone=function(){return p.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()},h}(),Ot=yt.prototype;return F.prototype=Ot,[["$ms",g],["$s",v],["$m",d],["$H",y],["$W",b],["$M",M],["$y",_],["$D",B]].forEach(function(h){Ot[h[1]]=function(s){return this.$g(s,h[0],h[1])}}),F.extend=function(h,s){return h.$i||(h(s,yt,F),h.$i=!0),F},F.locale=Dt,F.isDayjs=Yt,F.unix=function(h){return F(1e3*h)},F.en=j[A],F.Ls=j,F.p={},F})})(Ht);var At=Ht.exports;const It=ht(At),ct=(f,t="MM/DD HH:mm")=>It(f).format(t),wt=(f,t)=>{let n,o=0;return(...l)=>{const g=Date.now(),v=g-o;!o||v>=t?(o=g,f.apply(void 0,l)):n||(n=setTimeout(()=>{o=g,f.apply(void 0,l),n=null},t-v))}},Ct=f=>{const[t,n]=[f[0],f[1]],o=n.clientX-t.clientX,l=n.clientY-t.clientY;return Math.sqrt(o*o+l*l)},Rt=(f,t)=>{const n=document.createElement("canvas");n.width=n.height=1;const o=n.getContext("2d");o.fillStyle=f,o.fillRect(0,0,1,1);const l=o.getImageData(0,0,1,1).data;return`rgba(${l[0]}, ${l[1]}, ${l[2]}, ${t})`},Bt=({xCenterPoint:f,cfg:t,timePerPixel:n,timeSpacing:o,currentTime:l,$canvas:g,screenScaleCount:v,scaleHeight:d,startTime:y,drawLine:b,drawText:L,drawArea:M})=>{const it=({space:B,scaleTimeFormat:Mt,bgTimeFormat:xt,pointerTimeFormat:St})=>{L({x:g.width-f/10,y:6,text:ct(l,xt),fontSize:`${g.height-5}px`,align:"right",baseLine:"top",color:t.bgTextColor});const Tt=y%o,st=Tt/n;for(let Q=0;Q<v;Q++){const A=Q*t.scaleSpacing-st-t.pointerWidth/2,j=y+Q*o-Tt;if(j%(o*B)===0){b({x:A,y:d.long}),L({x:A,y:g.height-d.long-5,text:ct(j,Mt),baseLine:"bottom"});continue}b({x:A,y:d.short})}b({x:f-t.pointerWidth/2,y:g.height,width:t.pointerWidth,color:t.pointerColor}),M({startX:f-t.pointerDisplayWidth/2,startY:4,endX:f+t.pointerDisplayWidth/2,endY:4+t.pointerDisplayHeight,bgColor:t.pointerColor}),L({x:f,y:t.pointerDisplayHeight/2+5,text:ct(l,St),align:"center",baseLine:"middle"})},_=t.thresholdsConfig[o];_&&it({space:_.space,scaleTimeFormat:_.scaleTimeFormat,bgTimeFormat:_.bgTimeFormat,pointerTimeFormat:_.pointerTimeFormat})},Nt={fill:!0,width:1e3,height:60,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",fontFamily:"Arial",scaleColor:"#ffffff",scaleSpacing:7,areaBgColor:"#ffffff55",pointerColor:"#00aeec",pointerWidth:3,pointerDisplayWidth:100,pointerDisplayHeight:14,fps:60,zoom:3,timeSpacingList:[10,100,1e3,1e4,6e4,6e5,36e5,864e5,6048e5],thresholdsConfig:{10:{scaleTimeFormat:"mm:ss:SSS",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},100:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},1e3:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},1e4:{scaleTimeFormat:"HH:mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:12},6e4:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},6e5:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},36e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"MM/DD HH:mm",space:12},864e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"YYYY/MM/DD HH:mm",space:12},6048e5:{scaleTimeFormat:"YYYY/MM/DD",bgTimeFormat:"YYYY",pointerTimeFormat:"YYYY/MM/DD",space:10}}};class Ut{constructor(t,n){w(this,ut);w(this,lt);w(this,ft);w(this,dt);w(this,mt);w(this,gt);w(this,$t);w(this,vt);w(this,Z);at(this,"$canvas");at(this,"$canvasParent");at(this,"ctx");at(this,"cfg");w(this,tt,void 0);w(this,I,void 0);w(this,V,$());w(this,C,0);w(this,k,void 0);w(this,D,void 0);w(this,U,void 0);w(this,X,!1);w(this,R,null);w(this,z,null);w(this,pt,({x:t,y:n,width:o=1,color:l=this.cfg.scaleColor})=>{this.ctx.beginPath(),this.ctx.moveTo(t,this.$canvas.height),this.ctx.lineTo(t,this.$canvas.height-n),this.ctx.closePath(),this.ctx.strokeStyle=l,this.ctx.lineWidth=o,this.ctx.stroke()});w(this,et,({x:t,y:n,text:o,color:l=this.cfg.textColor,fontSize:g="11px",align:v="center",baseLine:d="alphabetic"})=>{this.ctx.beginPath(),this.ctx.font=`${g} ${this.cfg.fontFamily}`,this.ctx.fillStyle=l,this.ctx.textAlign=v,this.ctx.textBaseline=d,this.ctx.fillText(o,t,n)});w(this,G,({startX:t,startY:n,endX:o,endY:l,bgColor:g})=>{this.ctx.beginPath(),this.ctx.rect(t,n,o-t,l-n),this.ctx.fillStyle=g,this.ctx.fill()});if(!t)throw new Error("canvas Element Or Element ID is required!");typeof t=="string"?this.$canvas=document.querySelector(t):this.$canvas=t,this.ctx=this.$canvas.getContext("2d"),this.cfg={...Nt,...n},n!=null&&n.pointColor&&(this.cfg.pointerColor=n.pointColor),n!=null&&n.pointWidth&&(this.cfg.pointerWidth=n.pointWidth);const{fill:o,width:l,height:g,zoom:v,timeSpacingList:d,scaleHeight:y,textColor:b,bgTextColor:L}=this.cfg;if(L||(this.cfg.bgTextColor=Rt(b,.18)),v<0||v>=d.length||v%1!==0)throw new Error(`zoom must be 0 ~ ${d.length-1}, and must be an integer`);if(o){const M=this.$canvas.parentElement;this.$canvasParent=M,this.$canvas.width=M.clientWidth,this.$canvas.height=M.clientHeight,new ResizeObserver(wt(W(this,gt,Xt).bind(this),200)).observe(M)}else this.$canvas.width=l,this.$canvas.height=g;x(this,D,d[v]),y!=null&&y.long&&(y!=null&&y.short)?x(this,U,y):x(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",W(this,lt,Et).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",W(this,ut,_t).bind(this)),this.$canvas.addEventListener("touchstart",W(this,ft,Wt).bind(this),{passive:!1}),this.$canvas.addEventListener("touchmove",wt(W(this,dt,Pt).bind(this),1e3/this.cfg.fps),{passive:!1}),this.$canvas.addEventListener("touchend",W(this,mt,kt).bind(this))}draw({currentTime:t,areas:n,_privateFlag:o}={}){if(r(this,X)&&!o)return;x(this,C,t||Date.now()),x(this,k,n||[]);const l=this.$canvas.width/2,g=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),v=g*r(this,D),[d,y]=x(this,tt,[r(this,C)-v/2,r(this,C)+v/2]);x(this,I,v/this.$canvas.width),W(this,$t,jt).call(this),r(this,G).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),r(this,k).forEach(b=>{const L=b.startTime<=d?0:Math.round((b.startTime-d)/r(this,I)),M=b.endTime>=y?this.$canvas.width:Math.round((b.endTime-d)/r(this,I));L<this.$canvas.width&&M>0&&r(this,G).call(this,{startX:L,startY:0,endX:M,endY:this.$canvas.height,bgColor:b.bgColor||this.cfg.areaBgColor})}),Bt.bind(this)({xCenterPoint:l,screenScaleCount:g,startTime:d,timePerPixel:r(this,I),scaleHeight:r(this,U),timeSpacing:r(this,D),currentTime:r(this,C),$canvas:this.$canvas,cfg:this.cfg,drawLine:r(this,pt).bind(this),drawText:r(this,et).bind(this),drawArea:r(this,G).bind(this)}),W(this,vt,zt).call(this)}getCurrentTime(){return r(this,C)}getTimeRange(){return r(this,tt)}getMsPerPixel(){return r(this,I)}on(t,n){r(this,V).on(t,n)}off(t,n){r(this,V).off(t,n)}}tt=new WeakMap,I=new WeakMap,V=new WeakMap,C=new WeakMap,k=new WeakMap,D=new WeakMap,U=new WeakMap,X=new WeakMap,R=new WeakMap,z=new WeakMap,ut=new WeakSet,_t=function(t){x(this,X,!0);let n=t.clientX,o=r(this,C);const l=wt(({clientX:d})=>{r(this,X)&&(o=Math.round(r(this,C)-r(this,D)/this.cfg.scaleSpacing*(d-n)),n=d,this.draw({currentTime:o,areas:r(this,k),_privateFlag:!0}))},1e3/this.cfg.fps),g=d=>{const y=this.$canvas.getBoundingClientRect(),b=d.clientX-y.left,L=d.clientY-y.top,M=3;(b<M||b>this.$canvas.width-M||L<M||L>this.$canvas.height-M)&&(this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",g))},v=()=>{this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",g),document.removeEventListener("mouseup",v),x(this,X,!1),W(this,Z,ot).call(this,"dragged",o)};this.$canvas.addEventListener("mousemove",l),this.$canvas.addEventListener("mousemove",g),document.addEventListener("mouseup",v)},lt=new WeakSet,Et=function(t){t.preventDefault();const n=this.cfg.timeSpacingList.findIndex(o=>o===r(this,D));t.deltaY<0&&n>0?(x(this,D,this.cfg.timeSpacingList[n-1]),this.draw({currentTime:r(this,C),areas:r(this,k),_privateFlag:!0}),W(this,Z,ot).call(this,"zoom",n-1)):t.deltaY>0&&n<this.cfg.timeSpacingList.length-1&&(x(this,D,this.cfg.timeSpacingList[n+1]),this.draw({currentTime:r(this,C),areas:r(this,k),_privateFlag:!0}),W(this,Z,ot).call(this,"zoom",n+1))},ft=new WeakSet,Wt=function(t){t.preventDefault(),x(this,X,!0),x(this,R,t.touches[0].clientX),t.touches.length===2&&x(this,z,Ct(t.touches))},dt=new WeakSet,Pt=function(t){if(t.preventDefault(),!r(this,X))return;if(t.touches.length===2&&r(this,z)!==null){const g=Ct(t.touches),v=Math.abs(r(this,z)-g)>=35;if(!v)return;let d=this.cfg.timeSpacingList.findIndex(y=>y===r(this,D));if(g<r(this,z)?d+=1:d-=1,d<0||d>this.cfg.timeSpacingList.length-1)return;x(this,D,this.cfg.timeSpacingList[d]),v&&x(this,z,g),this.draw({currentTime:r(this,C),areas:r(this,k),_privateFlag:!0});return}if(r(this,R)===null)return;const n=t.touches[0],o=n.clientX-r(this,R),l=Math.round(r(this,C)-r(this,D)/this.cfg.scaleSpacing*o);x(this,R,n.clientX),this.draw({currentTime:l,areas:r(this,k),_privateFlag:!0})},mt=new WeakSet,kt=function(t){r(this,X)&&(x(this,X,!1),x(this,R,null),t.touches.length<2&&x(this,z,null),W(this,Z,ot).call(this,"dragged",r(this,C)))},gt=new WeakSet,Xt=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||x(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:r(this,C),areas:r(this,k)}))},$t=new WeakSet,jt=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},vt=new WeakSet,zt=function(){const t=()=>r(this,D)<1e3?`${r(this,D)}ms`:r(this,D)<6e4?`${Math.round(r(this,D)/100)/10}sec`:r(this,D)<36e5?`${Math.round(r(this,D)/100/60)/10}min`:r(this,D)<864e5?`${Math.round(r(this,D)/100/60/60)/10}hours`:r(this,D)<6048e5?`${Math.round(r(this,D)/100/60/60/24)/10}days`:`${Math.round(r(this,D)/100/60/60/24/7)/10}weeks`;r(this,et).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:t(),align:"left",baseLine:"middle"}),this.ctx.beginPath(),this.ctx.moveTo(5,6),this.ctx.lineTo(5,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,6),this.ctx.strokeStyle=this.cfg.scaleColor,this.ctx.lineWidth=1.5,this.ctx.stroke()},pt=new WeakMap,et=new WeakMap,G=new WeakMap,Z=new WeakSet,ot=function(...t){r(this,V).emit(...t)},m.default=Ut,m.format=ct,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(D,Y){typeof exports=="object"&&typeof module<"u"?Y(exports):typeof define=="function"&&define.amd?define(["exports"],Y):(D=typeof globalThis<"u"?globalThis:D||self,Y(D.$timeline={}))})(this,function(D){"use strict";var Rt=Object.defineProperty;var Ot=D=>{throw TypeError(D)};var Bt=(D,Y,W)=>Y in D?Rt(D,Y,{enumerable:!0,configurable:!0,writable:!0,value:W}):D[Y]=W;var dt=(D,Y,W)=>Bt(D,typeof Y!="symbol"?Y+"":Y,W),xt=(D,Y,W)=>Y.has(D)||Ot("Cannot "+W);var a=(D,Y,W)=>(xt(D,Y,"read from private field"),W?W.call(D):Y.get(D)),N=(D,Y,W)=>Y.has(D)?Ot("Cannot add the same private member more than once"):Y instanceof WeakSet?Y.add(D):Y.set(D,W),E=(D,Y,W,at)=>(xt(D,Y,"write to private field"),at?at.call(D,W):Y.set(D,W),W),q=(D,Y,W)=>(xt(D,Y,"access private method"),W);var ut,tt,ot,X,V,F,st,G,et,K,L,Ct,Ht,Ft,Lt,zt,_t,Et,Wt,vt,ft,ht,$t;function Y(g){return{all:g=g||new Map,on:function(t,i){var r=g.get(t);r?r.push(i):g.set(t,[i])},off:function(t,i){var r=g.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):g.set(t,[]))},emit:function(t,i){var r=g.get(t);r&&r.slice().map(function($){$(i)}),(r=g.get("*"))&&r.slice().map(function($){$(t,i)})}}}var W=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function at(g){return g&&g.__esModule&&Object.prototype.hasOwnProperty.call(g,"default")?g.default:g}var yt={exports:{}};(function(g,t){(function(i,r){g.exports=r()})(W,function(){var i=1e3,r=6e4,$=36e5,p="millisecond",f="second",l="minute",c="hour",S="day",z="week",T="month",b="quarter",x="year",v="date",o="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|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,_={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(u){var n=["th","st","nd","rd"],e=u%100;return"["+u+(n[(e-20)%10]||n[e]||n[0])+"]"}},w=function(u,n,e){var h=String(u);return!h||h.length>=n?u:""+Array(n+1-h.length).join(e)+u},j={s:w,z:function(u){var n=-u.utcOffset(),e=Math.abs(n),h=Math.floor(e/60),s=e%60;return(n<=0?"+":"-")+w(h,2,"0")+":"+w(s,2,"0")},m:function u(n,e){if(n.date()<e.date())return-u(e,n);var h=12*(e.year()-n.year())+(e.month()-n.month()),s=n.clone().add(h,T),m=e-s<0,d=n.clone().add(h+(m?-1:1),T);return+(-(h+(e-s)/(m?s-d:d-s))||0)},a:function(u){return u<0?Math.ceil(u)||0:Math.floor(u)},p:function(u){return{M:T,y:x,w:z,d:S,D:v,h:c,m:l,s:f,ms:p,Q:b}[u]||String(u||"").toLowerCase().replace(/s$/,"")},u:function(u){return u===void 0}},C="en",I={};I[C]=_;var A="$isDayjsObject",Q=function(u){return u instanceof pt||!(!u||!u[A])},B=function u(n,e,h){var s;if(!n)return C;if(typeof n=="string"){var m=n.toLowerCase();I[m]&&(s=m),e&&(I[m]=e,s=m);var d=n.split("-");if(!s&&d.length>1)return u(d[0])}else{var O=n.name;I[O]=n,s=O}return!h&&s&&(C=s),s||!h&&C},H=function(u,n){if(Q(u))return u.clone();var e=typeof n=="object"?n:{};return e.date=u,e.args=arguments,new pt(e)},M=j;M.l=B,M.i=Q,M.w=function(u,n){return H(u,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var pt=function(){function u(e){this.$L=B(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[A]=!0}var n=u.prototype;return n.parse=function(e){this.$d=function(h){var s=h.date,m=h.utc;if(s===null)return new Date(NaN);if(M.u(s))return new Date;if(s instanceof Date)return new Date(s);if(typeof s=="string"&&!/Z$/i.test(s)){var d=s.match(y);if(d){var O=d[2]-1||0,P=(d[7]||"0").substring(0,3);return m?new Date(Date.UTC(d[1],O,d[3]||1,d[4]||0,d[5]||0,d[6]||0,P)):new Date(d[1],O,d[3]||1,d[4]||0,d[5]||0,d[6]||0,P)}}return new Date(s)}(e),this.init()},n.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},n.$utils=function(){return M},n.isValid=function(){return this.$d.toString()!==o},n.isSame=function(e,h){var s=H(e);return this.startOf(h)<=s&&s<=this.endOf(h)},n.isAfter=function(e,h){return H(e)<this.startOf(h)},n.isBefore=function(e,h){return this.endOf(h)<H(e)},n.$g=function(e,h,s){return M.u(e)?this[h]:this.set(s,e)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(e,h){var s=this,m=!!M.u(h)||h,d=M.p(e),O=function(rt,R){var it=M.w(s.$u?Date.UTC(s.$y,R,rt):new Date(s.$y,R,rt),s);return m?it:it.endOf(S)},P=function(rt,R){return M.w(s.toDate()[rt].apply(s.toDate("s"),(m?[0,0,0,0]:[23,59,59,999]).slice(R)),s)},U=this.$W,Z=this.$M,J=this.$D,ct="set"+(this.$u?"UTC":"");switch(d){case x:return m?O(1,0):O(31,11);case T:return m?O(1,Z):O(0,Z+1);case z:var nt=this.$locale().weekStart||0,lt=(U<nt?U+7:U)-nt;return O(m?J-lt:J+(6-lt),Z);case S:case v:return P(ct+"Hours",0);case c:return P(ct+"Minutes",1);case l:return P(ct+"Seconds",2);case f:return P(ct+"Milliseconds",3);default:return this.clone()}},n.endOf=function(e){return this.startOf(e,!1)},n.$set=function(e,h){var s,m=M.p(e),d="set"+(this.$u?"UTC":""),O=(s={},s[S]=d+"Date",s[v]=d+"Date",s[T]=d+"Month",s[x]=d+"FullYear",s[c]=d+"Hours",s[l]=d+"Minutes",s[f]=d+"Seconds",s[p]=d+"Milliseconds",s)[m],P=m===S?this.$D+(h-this.$W):h;if(m===T||m===x){var U=this.clone().set(v,1);U.$d[O](P),U.init(),this.$d=U.set(v,Math.min(this.$D,U.daysInMonth())).$d}else O&&this.$d[O](P);return this.init(),this},n.set=function(e,h){return this.clone().$set(e,h)},n.get=function(e){return this[M.p(e)]()},n.add=function(e,h){var s,m=this;e=Number(e);var d=M.p(h),O=function(Z){var J=H(m);return M.w(J.date(J.date()+Math.round(Z*e)),m)};if(d===T)return this.set(T,this.$M+e);if(d===x)return this.set(x,this.$y+e);if(d===S)return O(1);if(d===z)return O(7);var P=(s={},s[l]=r,s[c]=$,s[f]=i,s)[d]||1,U=this.$d.getTime()+e*P;return M.w(U,this)},n.subtract=function(e,h){return this.add(-1*e,h)},n.format=function(e){var h=this,s=this.$locale();if(!this.isValid())return s.invalidDate||o;var m=e||"YYYY-MM-DDTHH:mm:ssZ",d=M.z(this),O=this.$H,P=this.$m,U=this.$M,Z=s.weekdays,J=s.months,ct=s.meridiem,nt=function(R,it,mt,Mt){return R&&(R[it]||R(h,m))||mt[it].slice(0,Mt)},lt=function(R){return M.s(O%12||12,R,"0")},rt=ct||function(R,it,mt){var Mt=R<12?"AM":"PM";return mt?Mt.toLowerCase():Mt};return m.replace(k,function(R,it){return it||function(mt){switch(mt){case"YY":return String(h.$y).slice(-2);case"YYYY":return M.s(h.$y,4,"0");case"M":return U+1;case"MM":return M.s(U+1,2,"0");case"MMM":return nt(s.monthsShort,U,J,3);case"MMMM":return nt(J,U);case"D":return h.$D;case"DD":return M.s(h.$D,2,"0");case"d":return String(h.$W);case"dd":return nt(s.weekdaysMin,h.$W,Z,2);case"ddd":return nt(s.weekdaysShort,h.$W,Z,3);case"dddd":return Z[h.$W];case"H":return String(O);case"HH":return M.s(O,2,"0");case"h":return lt(1);case"hh":return lt(2);case"a":return rt(O,P,!0);case"A":return rt(O,P,!1);case"m":return String(P);case"mm":return M.s(P,2,"0");case"s":return String(h.$s);case"ss":return M.s(h.$s,2,"0");case"SSS":return M.s(h.$ms,3,"0");case"Z":return d}return null}(R)||d.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(e,h,s){var m,d=this,O=M.p(h),P=H(e),U=(P.utcOffset()-this.utcOffset())*r,Z=this-P,J=function(){return M.m(d,P)};switch(O){case x:m=J()/12;break;case T:m=J();break;case b:m=J()/3;break;case z:m=(Z-U)/6048e5;break;case S:m=(Z-U)/864e5;break;case c:m=Z/$;break;case l:m=Z/r;break;case f:m=Z/i;break;default:m=Z}return s?m:M.a(m)},n.daysInMonth=function(){return this.endOf(T).$D},n.$locale=function(){return I[this.$L]},n.locale=function(e,h){if(!e)return this.$L;var s=this.clone(),m=B(e,h,!0);return m&&(s.$L=m),s},n.clone=function(){return M.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},u}(),wt=pt.prototype;return H.prototype=wt,[["$ms",p],["$s",f],["$m",l],["$H",c],["$W",S],["$M",T],["$y",x],["$D",v]].forEach(function(u){wt[u[1]]=function(n){return this.$g(n,u[0],u[1])}}),H.extend=function(u,n){return u.$i||(u(n,pt,H),u.$i=!0),H},H.locale=B,H.isDayjs=Q,H.unix=function(u){return H(1e3*u)},H.en=I[C],H.Ls=I,H.p={},H})})(yt);var Pt=yt.exports;const Dt=at(Pt);var St={exports:{}};(function(g,t){(function(i,r){g.exports=r()})(W,function(){var i="minute",r=/[+-]\d\d(?::?\d\d)?/g,$=/([+-]|\d\d)/g;return function(p,f,l){var c=f.prototype;l.utc=function(o){var y={date:o,utc:!0,args:arguments};return new f(y)},c.utc=function(o){var y=l(this.toDate(),{locale:this.$L,utc:!0});return o?y.add(this.utcOffset(),i):y},c.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var S=c.parse;c.parse=function(o){o.utc&&(this.$u=!0),this.$utils().u(o.$offset)||(this.$offset=o.$offset),S.call(this,o)};var z=c.init;c.init=function(){if(this.$u){var o=this.$d;this.$y=o.getUTCFullYear(),this.$M=o.getUTCMonth(),this.$D=o.getUTCDate(),this.$W=o.getUTCDay(),this.$H=o.getUTCHours(),this.$m=o.getUTCMinutes(),this.$s=o.getUTCSeconds(),this.$ms=o.getUTCMilliseconds()}else z.call(this)};var T=c.utcOffset;c.utcOffset=function(o,y){var k=this.$utils().u;if(k(o))return this.$u?0:k(this.$offset)?T.call(this):this.$offset;if(typeof o=="string"&&(o=function(C){C===void 0&&(C="");var I=C.match(r);if(!I)return null;var A=(""+I[0]).match($)||["-",0,0],Q=A[0],B=60*+A[1]+ +A[2];return B===0?0:Q==="+"?B:-B}(o),o===null))return this;var _=Math.abs(o)<=16?60*o:o,w=this;if(y)return w.$offset=_,w.$u=o===0,w;if(o!==0){var j=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(w=this.local().add(_+j,i)).$offset=_,w.$x.$localOffset=j}else w=this.utc();return w};var b=c.format;c.format=function(o){var y=o||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return b.call(this,y)},c.valueOf=function(){var o=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*o},c.isUTC=function(){return!!this.$u},c.toISOString=function(){return this.toDate().toISOString()},c.toString=function(){return this.toDate().toUTCString()};var x=c.toDate;c.toDate=function(o){return o==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():x.call(this)};var v=c.diff;c.diff=function(o,y,k){if(o&&this.$u===o.$u)return v.call(this,o,y,k);var _=this.local(),w=l(o).local();return v.call(_,w,y,k)}}})})(St);var kt=St.exports;const It=at(kt);var Yt={exports:{}};(function(g,t){(function(i,r){g.exports=r()})(W,function(){var i={year:0,month:1,day:2,hour:3,minute:4,second:5},r={};return function($,p,f){var l,c=function(b,x,v){v===void 0&&(v={});var o=new Date(b),y=function(k,_){_===void 0&&(_={});var w=_.timeZoneName||"short",j=k+"|"+w,C=r[j];return C||(C=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:k,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:w}),r[j]=C),C}(x,v);return y.formatToParts(o)},S=function(b,x){for(var v=c(b,x),o=[],y=0;y<v.length;y+=1){var k=v[y],_=k.type,w=k.value,j=i[_];j>=0&&(o[j]=parseInt(w,10))}var C=o[3],I=C===24?0:C,A=o[0]+"-"+o[1]+"-"+o[2]+" "+I+":"+o[4]+":"+o[5]+":000",Q=+b;return(f.utc(A).valueOf()-(Q-=Q%1e3))/6e4},z=p.prototype;z.tz=function(b,x){b===void 0&&(b=l);var v,o=this.utcOffset(),y=this.toDate(),k=y.toLocaleString("en-US",{timeZone:b}),_=Math.round((y-new Date(k))/1e3/60),w=15*-Math.round(y.getTimezoneOffset()/15)-_;if(!Number(w))v=this.utcOffset(0,x);else if(v=f(k,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(w,!0),x){var j=v.utcOffset();v=v.add(o-j,"minute")}return v.$x.$timezone=b,v},z.offsetName=function(b){var x=this.$x.$timezone||f.tz.guess(),v=c(this.valueOf(),x,{timeZoneName:b}).find(function(o){return o.type.toLowerCase()==="timezonename"});return v&&v.value};var T=z.startOf;z.startOf=function(b,x){if(!this.$x||!this.$x.$timezone)return T.call(this,b,x);var v=f(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return T.call(v,b,x).tz(this.$x.$timezone,!0)},f.tz=function(b,x,v){var o=v&&x,y=v||x||l,k=S(+f(),y);if(typeof b!="string")return f(b).tz(y);var _=function(I,A,Q){var B=I-60*A*1e3,H=S(B,Q);if(A===H)return[B,A];var M=S(B-=60*(H-A)*1e3,Q);return H===M?[B,H]:[I-60*Math.min(H,M)*1e3,Math.max(H,M)]}(f.utc(b,o).valueOf(),k,y),w=_[0],j=_[1],C=f(w).utcOffset(j);return C.$x.$timezone=y,C},f.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},f.tz.setDefault=function(b){l=b}}})})(Yt);var Ut=Yt.exports;const Xt=at(Ut);Dt.extend(It),Dt.extend(Xt);const gt=(g,t="MM/DD HH:mm Z",i)=>Dt(g).tz(i).format(t),Tt=(g,t)=>{let i,r=0;return(...$)=>{const p=Date.now(),f=p-r;!r||f>=t?(r=p,g.apply(void 0,$)):i||(i=setTimeout(()=>{r=p,g.apply(void 0,$),i=null},t-f))}},bt=g=>{const[t,i]=[g[0],g[1]],r=i.clientX-t.clientX,$=i.clientY-t.clientY;return Math.sqrt(r*r+$*$)},jt=(g,t)=>{const i=document.createElement("canvas");i.width=i.height=1;const r=i.getContext("2d");r.fillStyle=g,r.fillRect(0,0,1,1);const $=r.getImageData(0,0,1,1).data;return`rgba(${$[0]}, ${$[1]}, ${$[2]}, ${t})`},At=({xCenterPoint:g,cfg:t,timePerPixel:i,timeSpacing:r,currentTime:$,$canvas:p,screenScaleCount:f,scaleHeight:l,startTime:c,drawLine:S,drawText:z,drawArea:T})=>{const b=({space:v,scaleTimeFormat:o,bgTimeFormat:y,pointerTimeFormat:k,timezone:_})=>{z({x:p.width-g/10,y:6,text:gt($,y,_),fontSize:`${p.height-5}px`,align:"right",baseLine:"top",color:t.bgTextColor});const w=c%r,j=w/i;for(let C=0;C<f;C++){const I=C*t.scaleSpacing-j-t.pointerWidth/2,A=c+C*r-w;if(A%(r*v)===0){S({x:I,y:l.long}),z({x:I,y:p.height-l.long-5,text:gt(A,o,_),baseLine:"bottom"});continue}S({x:I,y:l.short})}S({x:g-t.pointerWidth/2,y:p.height,width:t.pointerWidth,color:t.pointerColor}),T({startX:g-t.pointerDisplayWidth/2,startY:4,endX:g+t.pointerDisplayWidth/2,endY:4+t.pointerDisplayHeight,bgColor:t.pointerColor}),z({x:g,y:t.pointerDisplayHeight/2+5,text:gt($,k,_),align:"center",baseLine:"middle"})},x=t.thresholdsConfig[r];x&&b({space:x.space,scaleTimeFormat:x.scaleTimeFormat,bgTimeFormat:x.bgTimeFormat,pointerTimeFormat:x.pointerTimeFormat,timezone:t.timezone})},Zt={fill:!0,width:1e3,height:60,bgColor:"rgba(0,0,0,0.5)",textColor:"#ffffff",fontFamily:"Arial",scaleColor:"#ffffff",scaleSpacing:7,areaBgColor:"#ffffff55",pointerColor:"#00aeec",pointerWidth:3,pointerDisplayWidth:100,pointerDisplayHeight:14,fps:60,zoom:3,timeSpacingList:[10,100,1e3,1e4,6e4,6e5,36e5,864e5,6048e5],thresholdsConfig:{10:{scaleTimeFormat:"mm:ss:SSS",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},100:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss:SSS",space:10},1e3:{scaleTimeFormat:"mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},1e4:{scaleTimeFormat:"HH:mm:ss",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:12},6e4:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},6e5:{scaleTimeFormat:"HH:mm",bgTimeFormat:"YYYY/MM/DD",pointerTimeFormat:"HH:mm:ss",space:10},36e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"MM/DD HH:mm",space:12},864e5:{scaleTimeFormat:"MM/DD HH:mm",bgTimeFormat:"YYYY/MM",pointerTimeFormat:"YYYY/MM/DD HH:mm",space:12},6048e5:{scaleTimeFormat:"YYYY/MM/DD",bgTimeFormat:"YYYY",pointerTimeFormat:"YYYY/MM/DD",space:10}}};class Nt{constructor(t,i){N(this,L);dt(this,"$canvas");dt(this,"$canvasParent");dt(this,"ctx");dt(this,"cfg");N(this,ut);N(this,tt);N(this,ot,Y());N(this,X,0);N(this,V);N(this,F);N(this,st);N(this,G,!1);N(this,et,null);N(this,K,null);N(this,vt,({x:t,y:i,width:r=1,color:$=this.cfg.scaleColor})=>{this.ctx.beginPath(),this.ctx.moveTo(t,this.$canvas.height),this.ctx.lineTo(t,this.$canvas.height-i),this.ctx.closePath(),this.ctx.strokeStyle=$,this.ctx.lineWidth=r,this.ctx.stroke()});N(this,ft,({x:t,y:i,text:r,color:$=this.cfg.textColor,fontSize:p="11px",align:f="center",baseLine:l="alphabetic"})=>{this.ctx.beginPath(),this.ctx.font=`${p} ${this.cfg.fontFamily}`,this.ctx.fillStyle=$,this.ctx.textAlign=f,this.ctx.textBaseline=l,this.ctx.fillText(r,t,i)});N(this,ht,({startX:t,startY:i,endX:r,endY:$,bgColor:p})=>{this.ctx.beginPath(),this.ctx.rect(t,i,r-t,$-i),this.ctx.fillStyle=p,this.ctx.fill()});if(!t)throw new Error("canvas Element Or Element ID is required!");typeof t=="string"?this.$canvas=document.querySelector(t):this.$canvas=t,this.ctx=this.$canvas.getContext("2d"),this.cfg={...Zt,...i},i!=null&&i.pointColor&&(this.cfg.pointerColor=i.pointColor),i!=null&&i.pointWidth&&(this.cfg.pointerWidth=i.pointWidth);const{fill:r,width:$,height:p,zoom:f,timeSpacingList:l,scaleHeight:c,textColor:S,bgTextColor:z}=this.cfg;if(z||(this.cfg.bgTextColor=jt(S,.18)),f<0||f>=l.length||f%1!==0)throw new Error(`zoom must be 0 ~ ${l.length-1}, and must be an integer`);if(r){const T=this.$canvas.parentElement;this.$canvasParent=T,this.$canvas.width=T.clientWidth,this.$canvas.height=T.clientHeight,new ResizeObserver(Tt(q(this,L,_t).bind(this),200)).observe(T)}else this.$canvas.width=$,this.$canvas.height=p;E(this,F,l[f]),c!=null&&c.long&&(c!=null&&c.short)?E(this,st,c):E(this,st,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",q(this,L,Ht).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",q(this,L,Ct).bind(this)),this.$canvas.addEventListener("touchstart",q(this,L,Ft).bind(this),{passive:!1}),this.$canvas.addEventListener("touchmove",Tt(q(this,L,Lt).bind(this),1e3/this.cfg.fps),{passive:!1}),this.$canvas.addEventListener("touchend",q(this,L,zt).bind(this))}draw({currentTime:t,areas:i,_privateFlag:r}={}){if(a(this,G)&&!r)return;E(this,X,t||Date.now()),E(this,V,i||[]);const $=this.$canvas.width/2,p=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),f=p*a(this,F),[l,c]=E(this,ut,[a(this,X)-f/2,a(this,X)+f/2]);E(this,tt,f/this.$canvas.width),q(this,L,Et).call(this),a(this,ht).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),a(this,V).forEach(S=>{const z=S.startTime<=l?0:Math.round((S.startTime-l)/a(this,tt)),T=S.endTime>=c?this.$canvas.width:Math.round((S.endTime-l)/a(this,tt));z<this.$canvas.width&&T>0&&a(this,ht).call(this,{startX:z,startY:0,endX:T,endY:this.$canvas.height,bgColor:S.bgColor||this.cfg.areaBgColor})}),At.bind(this)({xCenterPoint:$,screenScaleCount:p,startTime:l,timePerPixel:a(this,tt),scaleHeight:a(this,st),timeSpacing:a(this,F),currentTime:a(this,X),$canvas:this.$canvas,cfg:this.cfg,drawLine:a(this,vt).bind(this),drawText:a(this,ft).bind(this),drawArea:a(this,ht).bind(this)}),q(this,L,Wt).call(this)}getCurrentTime(){return a(this,X)}getTimeRange(){return a(this,ut)}getMsPerPixel(){return a(this,tt)}on(t,i){a(this,ot).on(t,i)}off(t,i){a(this,ot).off(t,i)}}ut=new WeakMap,tt=new WeakMap,ot=new WeakMap,X=new WeakMap,V=new WeakMap,F=new WeakMap,st=new WeakMap,G=new WeakMap,et=new WeakMap,K=new WeakMap,L=new WeakSet,Ct=function(t){E(this,G,!0);let i=t.clientX,r=a(this,X);const $=Tt(({clientX:l})=>{a(this,G)&&(r=Math.round(a(this,X)-a(this,F)/this.cfg.scaleSpacing*(l-i)),i=l,this.draw({currentTime:r,areas:a(this,V),_privateFlag:!0}))},1e3/this.cfg.fps),p=l=>{const c=this.$canvas.getBoundingClientRect(),S=l.clientX-c.left,z=l.clientY-c.top,T=3;(S<T||S>this.$canvas.width-T||z<T||z>this.$canvas.height-T)&&(this.$canvas.removeEventListener("mousemove",$),this.$canvas.removeEventListener("mousemove",p))},f=()=>{this.$canvas.removeEventListener("mousemove",$),this.$canvas.removeEventListener("mousemove",p),document.removeEventListener("mouseup",f),E(this,G,!1),q(this,L,$t).call(this,"dragged",r)};this.$canvas.addEventListener("mousemove",$),this.$canvas.addEventListener("mousemove",p),document.addEventListener("mouseup",f)},Ht=function(t){t.preventDefault();const i=this.cfg.timeSpacingList.findIndex(r=>r===a(this,F));t.deltaY<0&&i>0?(E(this,F,this.cfg.timeSpacingList[i-1]),this.draw({currentTime:a(this,X),areas:a(this,V),_privateFlag:!0}),q(this,L,$t).call(this,"zoom",i-1)):t.deltaY>0&&i<this.cfg.timeSpacingList.length-1&&(E(this,F,this.cfg.timeSpacingList[i+1]),this.draw({currentTime:a(this,X),areas:a(this,V),_privateFlag:!0}),q(this,L,$t).call(this,"zoom",i+1))},Ft=function(t){t.preventDefault(),E(this,G,!0),E(this,et,t.touches[0].clientX),t.touches.length===2&&E(this,K,bt(t.touches))},Lt=function(t){if(t.preventDefault(),!a(this,G))return;if(t.touches.length===2&&a(this,K)!==null){const p=bt(t.touches),f=Math.abs(a(this,K)-p)>=35;if(!f)return;let l=this.cfg.timeSpacingList.findIndex(c=>c===a(this,F));if(p<a(this,K)?l+=1:l-=1,l<0||l>this.cfg.timeSpacingList.length-1)return;E(this,F,this.cfg.timeSpacingList[l]),f&&E(this,K,p),this.draw({currentTime:a(this,X),areas:a(this,V),_privateFlag:!0});return}if(a(this,et)===null)return;const i=t.touches[0],r=i.clientX-a(this,et),$=Math.round(a(this,X)-a(this,F)/this.cfg.scaleSpacing*r);E(this,et,i.clientX),this.draw({currentTime:$,areas:a(this,V),_privateFlag:!0})},zt=function(t){a(this,G)&&(E(this,G,!1),E(this,et,null),t.touches.length<2&&E(this,K,null),q(this,L,$t).call(this,"dragged",a(this,X)))},_t=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||E(this,st,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:a(this,X),areas:a(this,V)}))},Et=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},Wt=function(){const t=()=>a(this,F)<1e3?`${a(this,F)}ms`:a(this,F)<6e4?`${Math.round(a(this,F)/100)/10}sec`:a(this,F)<36e5?`${Math.round(a(this,F)/100/60)/10}min`:a(this,F)<864e5?`${Math.round(a(this,F)/100/60/60)/10}hours`:a(this,F)<6048e5?`${Math.round(a(this,F)/100/60/60/24)/10}days`:`${Math.round(a(this,F)/100/60/60/24/7)/10}weeks`;a(this,ft).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:t(),align:"left",baseLine:"middle"}),this.ctx.beginPath(),this.ctx.moveTo(5,6),this.ctx.lineTo(5,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,10),this.ctx.lineTo(this.cfg.scaleSpacing+6,6),this.ctx.strokeStyle=this.cfg.scaleColor,this.ctx.lineWidth=1.5,this.ctx.stroke()},vt=new WeakMap,ft=new WeakMap,ht=new WeakMap,$t=function(...t){a(this,ot).emit(...t)},D.default=Nt,D.format=gt,Object.defineProperties(D,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -5,2 +5,4 @@ declare namespace TL { | ||
type CommonType = { | ||
// 时区 | ||
timezone?: string, | ||
// 根据父容器自动填充 | ||
@@ -167,4 +169,4 @@ fill?: boolean, | ||
*/ | ||
export declare const format: (date: string | number | Date | null | undefined, fmt?: string) => string; | ||
export declare const format: (date: string | number | Date | null | undefined, fmt?: string, timezone?: string) => string; | ||
export default TL.TimeLine; |
{ | ||
"name": "@losting/timeline", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Canvas timeline supports zooming, dragging, infinite scrolling, and custom control levels.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -75,2 +75,3 @@ 简体中文 | [English](./README_EN.md) | ||
| fontFamily | string | 否 | Arial | 字体 | | ||
| timezone | string | 否 | - | 时间显示的时区。支持 IANA 时区格式(如:'Asia/Shanghai'、'America/New_York'、'Europe/London')或 UTC 偏移格式(如:'+04:00'、'-08:00') | | ||
| scaleColor | string | 否 | #ffffff | 刻度颜色 | | ||
@@ -118,2 +119,2 @@ | scaleSpacing | number | 否 | 7 | 刻度间距 | | ||
Copyright (c) 2022-present losting<https://www.github.com/thelostword> | ||
Copyright (c) 2022-present losting<https://www.github.com/thelostword> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
102830
1110