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

@losting/timeline

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@losting/timeline - npm Package Compare versions

Comparing version 3.0.3 to 4.0.0

index.d.ts

823

dist/timeline.es.js

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

var Ft = Object.defineProperty;
var Ct = (a, t, s) => t in a ? Ft(a, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[t] = s;
var V = (a, t, s) => (Ct(a, typeof t != "symbol" ? t + "" : t, s), s), gt = (a, t, s) => {
var xt = Object.defineProperty;
var St = (a, t, e) => t in a ? xt(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
var G = (a, t, e) => (St(a, typeof t != "symbol" ? t + "" : t, e), e), dt = (a, t, e) => {
if (!t.has(a))
throw TypeError("Cannot " + s);
throw TypeError("Cannot " + e);
};
var f = (a, t, s) => (gt(a, t, "read from private field"), s ? s.call(a) : t.get(a)), F = (a, t, s) => {
var c = (a, t, e) => (dt(a, t, "read from private field"), e ? e.call(a) : t.get(a)), S = (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, s);
}, L = (a, t, s, r) => (gt(a, t, "write to private field"), r ? r.call(a, s) : t.set(a, s), s);
var H = (a, t, s) => (gt(a, t, "access private method"), s);
function Ht(a) {
return { all: a = a || /* @__PURE__ */ new Map(), on: function(t, s) {
var r = a.get(t);
r ? r.push(s) : a.set(t, [s]);
}, off: function(t, s) {
var r = a.get(t);
r && (s ? r.splice(r.indexOf(s) >>> 0, 1) : a.set(t, []));
}, emit: function(t, s) {
var r = a.get(t);
r && r.slice().map(function(l) {
l(s);
}), (r = a.get("*")) && r.slice().map(function(l) {
l(t, s);
t instanceof WeakSet ? t.add(a) : t.set(a, e);
}, L = (a, t, e, o) => (dt(a, t, "write to private field"), o ? o.call(a, e) : t.set(a, e), e);
var I = (a, t, e) => (dt(a, t, "access private method"), e);
function Ft(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]);
}, off: function(t, e) {
var o = a.get(t);
o && (e ? o.splice(o.indexOf(e) >>> 0, 1) : a.set(t, []));
}, emit: function(t, e) {
var o = a.get(t);
o && o.slice().map(function(m) {
m(e);
}), (o = a.get("*")) && o.slice().map(function(m) {
m(t, e);
});
} };
}
var Ot = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Lt(a) {
var Ct = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Ht(a) {
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
}
var Yt = { exports: {} };
var Mt = { exports: {} };
(function(a, t) {
(function(s, r) {
a.exports = r();
})(Ot, function() {
var s = 1e3, r = 6e4, l = 36e5, g = "millisecond", $ = "second", p = "minute", v = "hour", x = "day", b = "week", Y = "month", S = "quarter", _ = "year", W = "date", Q = "Invalid Date", ft = /^(\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, lt = { 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(o) {
var n = ["th", "st", "nd", "rd"], e = o % 100;
return "[" + o + (n[(e - 20) % 10] || n[e] || n[0]) + "]";
} }, P = function(o, n, e) {
var h = String(o);
return !h || h.length >= n ? o : "" + Array(n + 1 - h.length).join(e) + o;
}, J = { s: P, z: function(o) {
var n = -o.utcOffset(), e = Math.abs(n), h = Math.floor(e / 60), i = e % 60;
return (n <= 0 ? "+" : "-") + P(h, 2, "0") + ":" + P(i, 2, "0");
}, m: function o(n, e) {
if (n.date() < e.date())
return -o(e, n);
var h = 12 * (e.year() - n.year()) + (e.month() - n.month()), i = n.clone().add(h, Y), u = e - i < 0, c = n.clone().add(h + (u ? -1 : 1), Y);
return +(-(h + (e - i) / (u ? i - c : c - i)) || 0);
}, a: function(o) {
return o < 0 ? Math.ceil(o) || 0 : Math.floor(o);
}, p: function(o) {
return { M: Y, y: _, w: b, d: x, D: W, h: v, m: p, s: $, ms: g, Q: S }[o] || String(o || "").toLowerCase().replace(/s$/, "");
}, u: function(o) {
return o === void 0;
} }, k = "en", j = {};
j[k] = lt;
var dt = function(o) {
return o instanceof et;
}, tt = function o(n, e, h) {
var i;
(function(e, o) {
a.exports = o();
})(Ct, function() {
var e = 1e3, o = 6e4, m = 36e5, d = "millisecond", g = "second", v = "minute", p = "hour", y = "day", Y = "week", M = "month", k = "quarter", F = "year", A = "date", K = "Invalid Date", lt = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, mt = /\[([^\]]+)]|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 n = ["th", "st", "nd", "rd"], i = h % 100;
return "[" + h + (n[(i - 20) % 10] || n[i] || n[0]) + "]";
} }, R = function(h, n, i) {
var r = String(h);
return !r || r.length >= n ? h : "" + Array(n + 1 - r.length).join(i) + h;
}, U = { s: R, z: function(h) {
var n = -h.utcOffset(), i = Math.abs(n), r = Math.floor(i / 60), s = i % 60;
return (n <= 0 ? "+" : "-") + R(r, 2, "0") + ":" + R(s, 2, "0");
}, m: function h(n, i) {
if (n.date() < i.date())
return -h(i, n);
var r = 12 * (i.year() - n.year()) + (i.month() - n.month()), s = n.clone().add(r, M), u = i - s < 0, l = n.clone().add(r + (u ? -1 : 1), M);
return +(-(r + (i - s) / (u ? s - l : l - s)) || 0);
}, a: function(h) {
return h < 0 ? Math.ceil(h) || 0 : Math.floor(h);
}, p: function(h) {
return { M, y: F, w: Y, d: y, D: A, h: p, m: v, s: g, ms: d, Q: k }[h] || String(h || "").toLowerCase().replace(/s$/, "");
}, u: function(h) {
return h === void 0;
} }, E = "en", _ = {};
_[E] = tt;
var $t = "$isDayjsObject", ft = function(h) {
return h instanceof it || !(!h || !h[$t]);
}, et = function h(n, i, r) {
var s;
if (!n)
return k;
return E;
if (typeof n == "string") {
var u = n.toLowerCase();
j[u] && (i = u), e && (j[u] = e, i = u);
var c = n.split("-");
if (!i && c.length > 1)
return o(c[0]);
_[u] && (s = u), i && (_[u] = i, s = u);
var l = n.split("-");
if (!s && l.length > 1)
return h(l[0]);
} else {
var m = n.name;
j[m] = n, i = m;
var $ = n.name;
_[$] = n, s = $;
}
return !h && i && (k = i), i || !h && k;
}, y = function(o, n) {
if (dt(o))
return o.clone();
var e = typeof n == "object" ? n : {};
return e.date = o, e.args = arguments, new et(e);
}, d = J;
d.l = tt, d.i = dt, d.w = function(o, n) {
return y(o, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
return !r && s && (E = s), s || !r && E;
}, w = function(h, n) {
if (ft(h))
return h.clone();
var i = typeof n == "object" ? n : {};
return i.date = h, i.args = arguments, new it(i);
}, f = U;
f.l = et, f.i = ft, f.w = function(h, n) {
return w(h, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
};
var et = function() {
function o(e) {
this.$L = tt(e.locale, null, !0), this.parse(e);
var it = function() {
function h(i) {
this.$L = et(i.locale, null, !0), this.parse(i), this.$x = this.$x || i.x || {}, this[$t] = !0;
}
var n = o.prototype;
return n.parse = function(e) {
this.$d = function(h) {
var i = h.date, u = h.utc;
if (i === null)
var n = h.prototype;
return n.parse = function(i) {
this.$d = function(r) {
var s = r.date, u = r.utc;
if (s === null)
return /* @__PURE__ */ new Date(NaN);
if (d.u(i))
if (f.u(s))
return /* @__PURE__ */ new Date();
if (i instanceof Date)
return new Date(i);
if (typeof i == "string" && !/Z$/i.test(i)) {
var c = i.match(ft);
if (c) {
var m = c[2] - 1 || 0, w = (c[7] || "0").substring(0, 3);
return u ? new Date(Date.UTC(c[1], m, c[3] || 1, c[4] || 0, c[5] || 0, c[6] || 0, w)) : new Date(c[1], m, c[3] || 1, c[4] || 0, c[5] || 0, c[6] || 0, w);
if (s instanceof Date)
return new Date(s);
if (typeof s == "string" && !/Z$/i.test(s)) {
var l = s.match(lt);
if (l) {
var $ = l[2] - 1 || 0, T = (l[7] || "0").substring(0, 3);
return u ? new Date(Date.UTC(l[1], $, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, T)) : new Date(l[1], $, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, T);
}
}
return new Date(i);
}(e), this.$x = e.x || {}, this.init();
return new Date(s);
}(i), 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();
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 d;
return f;
}, n.isValid = function() {
return this.$d.toString() !== Q;
}, n.isSame = function(e, h) {
var i = y(e);
return this.startOf(h) <= i && i <= this.endOf(h);
}, n.isAfter = function(e, h) {
return y(e) < this.startOf(h);
}, n.isBefore = function(e, h) {
return this.endOf(h) < y(e);
}, n.$g = function(e, h, i) {
return d.u(e) ? this[h] : this.set(i, e);
return this.$d.toString() !== K;
}, n.isSame = function(i, r) {
var s = w(i);
return this.startOf(r) <= s && s <= this.endOf(r);
}, n.isAfter = function(i, r) {
return w(i) < this.startOf(r);
}, n.isBefore = function(i, r) {
return this.endOf(r) < w(i);
}, n.$g = function(i, r, s) {
return f.u(i) ? this[r] : this.set(s, i);
}, n.unix = function() {

@@ -129,93 +129,175 @@ return Math.floor(this.valueOf() / 1e3);

return this.$d.getTime();
}, n.startOf = function(e, h) {
var i = this, u = !!d.u(h) || h, c = d.p(e), m = function(U, C) {
var I = d.w(i.$u ? Date.UTC(i.$y, C, U) : new Date(i.$y, C, U), i);
return u ? I : I.endOf(x);
}, w = function(U, C) {
return d.w(i.toDate()[U].apply(i.toDate("s"), (u ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(C)), i);
}, M = this.$W, T = this.$M, z = this.$D, E = "set" + (this.$u ? "UTC" : "");
switch (c) {
case _:
return u ? m(1, 0) : m(31, 11);
}, n.startOf = function(i, r) {
var s = this, u = !!f.u(r) || r, l = f.p(i), $ = function(z, C) {
var P = f.w(s.$u ? Date.UTC(s.$y, C, z) : new Date(s.$y, C, z), s);
return u ? P : P.endOf(y);
}, T = function(z, C) {
return f.w(s.toDate()[z].apply(s.toDate("s"), (u ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(C)), s);
}, b = this.$W, x = this.$M, O = this.$D, Z = "set" + (this.$u ? "UTC" : "");
switch (l) {
case F:
return u ? $(1, 0) : $(31, 11);
case M:
return u ? $(1, x) : $(0, x + 1);
case Y:
return u ? m(1, T) : m(0, T + 1);
case b:
var R = this.$locale().weekStart || 0, q = (M < R ? M + 7 : M) - R;
return m(u ? z - q : z + (6 - q), T);
case x:
case W:
return w(E + "Hours", 0);
var j = this.$locale().weekStart || 0, q = (b < j ? b + 7 : b) - j;
return $(u ? O - q : O + (6 - q), x);
case y:
case A:
return T(Z + "Hours", 0);
case p:
return T(Z + "Minutes", 1);
case v:
return w(E + "Minutes", 1);
case p:
return w(E + "Seconds", 2);
case $:
return w(E + "Milliseconds", 3);
return T(Z + "Seconds", 2);
case g:
return T(Z + "Milliseconds", 3);
default:
return this.clone();
}
}, n.endOf = function(e) {
return this.startOf(e, !1);
}, n.$set = function(e, h) {
var i, u = d.p(e), c = "set" + (this.$u ? "UTC" : ""), m = (i = {}, i[x] = c + "Date", i[W] = c + "Date", i[Y] = c + "Month", i[_] = c + "FullYear", i[v] = c + "Hours", i[p] = c + "Minutes", i[$] = c + "Seconds", i[g] = c + "Milliseconds", i)[u], w = u === x ? this.$D + (h - this.$W) : h;
if (u === Y || u === _) {
var M = this.clone().set(W, 1);
M.$d[m](w), M.init(), this.$d = M.set(W, Math.min(this.$D, M.daysInMonth())).$d;
}, n.endOf = function(i) {
return this.startOf(i, !1);
}, n.$set = function(i, r) {
var s, u = f.p(i), l = "set" + (this.$u ? "UTC" : ""), $ = (s = {}, s[y] = l + "Date", s[A] = l + "Date", s[M] = l + "Month", s[F] = l + "FullYear", s[p] = l + "Hours", s[v] = l + "Minutes", s[g] = l + "Seconds", s[d] = l + "Milliseconds", s)[u], T = u === y ? this.$D + (r - this.$W) : r;
if (u === M || u === F) {
var b = this.clone().set(A, 1);
b.$d[$](T), b.init(), this.$d = b.set(A, Math.min(this.$D, b.daysInMonth())).$d;
} else
m && this.$d[m](w);
$ && this.$d[$](T);
return this.init(), this;
}, n.set = function(e, h) {
return this.clone().$set(e, h);
}, n.get = function(e) {
return this[d.p(e)]();
}, n.add = function(e, h) {
var i, u = this;
e = Number(e);
var c = d.p(h), m = function(T) {
var z = y(u);
return d.w(z.date(z.date() + Math.round(T * e)), u);
}, n.set = function(i, r) {
return this.clone().$set(i, r);
}, n.get = function(i) {
return this[f.p(i)]();
}, n.add = function(i, r) {
var s, u = this;
i = Number(i);
var l = f.p(r), $ = function(x) {
var O = w(u);
return f.w(O.date(O.date() + Math.round(x * i)), u);
};
if (c === Y)
return this.set(Y, this.$M + e);
if (c === _)
return this.set(_, this.$y + e);
if (c === x)
return m(1);
if (c === b)
return m(7);
var w = (i = {}, i[p] = r, i[v] = l, i[$] = s, i)[c] || 1, M = this.$d.getTime() + e * w;
return d.w(M, this);
}, n.subtract = function(e, h) {
return this.add(-1 * e, h);
}, n.format = function(e) {
var h = this, i = this.$locale();
if (l === M)
return this.set(M, this.$M + i);
if (l === F)
return this.set(F, this.$y + i);
if (l === y)
return $(1);
if (l === Y)
return $(7);
var T = (s = {}, s[v] = o, s[p] = m, s[g] = e, s)[l] || 1, b = this.$d.getTime() + i * T;
return f.w(b, this);
}, n.subtract = function(i, r) {
return this.add(-1 * i, r);
}, n.format = function(i) {
var r = this, s = this.$locale();
if (!this.isValid())
return i.invalidDate || Q;
var u = e || "YYYY-MM-DDTHH:mm:ssZ", c = d.z(this), m = this.$H, w = this.$m, M = this.$M, T = i.weekdays, z = i.months, E = function(C, I, mt, it) {
return C && (C[I] || C(h, u)) || mt[I].slice(0, it);
}, R = function(C) {
return d.s(m % 12 || 12, C, "0");
}, q = i.meridiem || function(C, I, mt) {
var it = C < 12 ? "AM" : "PM";
return mt ? it.toLowerCase() : it;
}, U = { YY: String(this.$y).slice(-2), YYYY: d.s(this.$y, 4, "0"), M: M + 1, MM: d.s(M + 1, 2, "0"), MMM: E(i.monthsShort, M, z, 3), MMMM: E(z, M), D: this.$D, DD: d.s(this.$D, 2, "0"), d: String(this.$W), dd: E(i.weekdaysMin, this.$W, T, 2), ddd: E(i.weekdaysShort, this.$W, T, 3), dddd: T[this.$W], H: String(m), HH: d.s(m, 2, "0"), h: R(1), hh: R(2), a: q(m, w, !0), A: q(m, w, !1), m: String(w), mm: d.s(w, 2, "0"), s: String(this.$s), ss: d.s(this.$s, 2, "0"), SSS: d.s(this.$ms, 3, "0"), Z: c };
return u.replace(K, function(C, I) {
return I || U[C] || c.replace(":", "");
return s.invalidDate || K;
var u = i || "YYYY-MM-DDTHH:mm:ssZ", l = f.z(this), $ = this.$H, T = this.$m, b = this.$M, x = s.weekdays, O = s.months, Z = s.meridiem, j = function(C, P, V, st) {
return C && (C[P] || C(r, u)) || V[P].slice(0, st);
}, q = function(C) {
return f.s($ % 12 || 12, C, "0");
}, z = Z || function(C, P, V) {
var st = C < 12 ? "AM" : "PM";
return V ? st.toLowerCase() : st;
};
return u.replace(mt, function(C, P) {
return P || function(V) {
switch (V) {
case "YY":
return String(r.$y).slice(-2);
case "YYYY":
return f.s(r.$y, 4, "0");
case "M":
return b + 1;
case "MM":
return f.s(b + 1, 2, "0");
case "MMM":
return j(s.monthsShort, b, O, 3);
case "MMMM":
return j(O, b);
case "D":
return r.$D;
case "DD":
return f.s(r.$D, 2, "0");
case "d":
return String(r.$W);
case "dd":
return j(s.weekdaysMin, r.$W, x, 2);
case "ddd":
return j(s.weekdaysShort, r.$W, x, 3);
case "dddd":
return x[r.$W];
case "H":
return String($);
case "HH":
return f.s($, 2, "0");
case "h":
return q(1);
case "hh":
return q(2);
case "a":
return z($, T, !0);
case "A":
return z($, T, !1);
case "m":
return String(T);
case "mm":
return f.s(T, 2, "0");
case "s":
return String(r.$s);
case "ss":
return f.s(r.$s, 2, "0");
case "SSS":
return f.s(r.$ms, 3, "0");
case "Z":
return l;
}
return null;
}(C) || l.replace(":", "");
});
}, n.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, n.diff = function(e, h, i) {
var u, c = d.p(h), m = y(e), w = (m.utcOffset() - this.utcOffset()) * r, M = this - m, T = d.m(this, m);
return T = (u = {}, u[_] = T / 12, u[Y] = T, u[S] = T / 3, u[b] = (M - w) / 6048e5, u[x] = (M - w) / 864e5, u[v] = M / l, u[p] = M / r, u[$] = M / s, u)[c] || M, i ? T : d.a(T);
}, n.diff = function(i, r, s) {
var u, l = this, $ = f.p(r), T = w(i), b = (T.utcOffset() - this.utcOffset()) * o, x = this - T, O = function() {
return f.m(l, T);
};
switch ($) {
case F:
u = O() / 12;
break;
case M:
u = O();
break;
case k:
u = O() / 3;
break;
case Y:
u = (x - b) / 6048e5;
break;
case y:
u = (x - b) / 864e5;
break;
case p:
u = x / m;
break;
case v:
u = x / o;
break;
case g:
u = x / e;
break;
default:
u = x;
}
return s ? u : f.a(u);
}, n.daysInMonth = function() {
return this.endOf(Y).$D;
return this.endOf(M).$D;
}, n.$locale = function() {
return j[this.$L];
}, n.locale = function(e, h) {
if (!e)
return _[this.$L];
}, n.locale = function(i, r) {
if (!i)
return this.$L;
var i = this.clone(), u = tt(e, h, !0);
return u && (i.$L = u), i;
var s = this.clone(), u = et(i, r, !0);
return u && (s.$L = u), s;
}, n.clone = function() {
return d.w(this.$d, this);
return f.w(this.$d, this);
}, n.toDate = function() {

@@ -229,38 +311,38 @@ return new Date(this.valueOf());

return this.$d.toUTCString();
}, o;
}(), pt = et.prototype;
return y.prototype = pt, [["$ms", g], ["$s", $], ["$m", p], ["$H", v], ["$W", x], ["$M", Y], ["$y", _], ["$D", W]].forEach(function(o) {
pt[o[1]] = function(n) {
return this.$g(n, o[0], o[1]);
}, h;
}(), pt = it.prototype;
return w.prototype = pt, [["$ms", d], ["$s", g], ["$m", v], ["$H", p], ["$W", y], ["$M", M], ["$y", F], ["$D", A]].forEach(function(h) {
pt[h[1]] = function(n) {
return this.$g(n, h[0], h[1]);
};
}), y.extend = function(o, n) {
return o.$i || (o(n, et, y), o.$i = !0), y;
}, y.locale = tt, y.isDayjs = dt, y.unix = function(o) {
return y(1e3 * o);
}, y.en = j[k], y.Ls = j, y.p = {}, y;
}), w.extend = function(h, n) {
return h.$i || (h(n, it, w), h.$i = !0), w;
}, w.locale = et, w.isDayjs = ft, w.unix = function(h) {
return w(1e3 * h);
}, w.en = _[E], w.Ls = _, w.p = {}, w;
});
})(Yt);
var _t = Yt.exports;
const Et = /* @__PURE__ */ Lt(_t), $t = (a, t = "MM/DD HH:mm") => Et(a).format(t), Mt = (a, t) => {
let s, r = 0;
return (...l) => {
const g = Date.now(), $ = g - r;
!r || $ >= t ? (r = g, a.apply(void 0, l)) : s || (s = setTimeout(() => {
r = g, a.apply(void 0, l), s = null;
}, t - $));
})(Mt);
var Ot = Mt.exports;
const Lt = /* @__PURE__ */ Ht(Ot), gt = (a, t = "MM/DD HH:mm") => Lt(a).format(t), vt = (a, t) => {
let e, o = 0;
return (...m) => {
const d = Date.now(), g = d - o;
!o || g >= t ? (o = d, a.apply(void 0, m)) : e || (e = setTimeout(() => {
o = d, a.apply(void 0, m), e = null;
}, t - g));
};
}, At = (a, t) => {
const s = document.createElement("canvas");
s.width = s.height = 1;
const r = s.getContext("2d");
r.fillStyle = a, r.fillRect(0, 0, 1, 1);
const l = r.getImageData(0, 0, 1, 1).data;
return `rgba(${l[0]}, ${l[1]}, ${l[2]}, ${t})`;
}, Wt = ({ xCenterPoint: a, cfg: t, timePerPixel: s, timeSpacing: r, currentTime: l, $canvas: g, screenScaleCount: $, scaleHeight: p, startTime: v, drawLine: x, drawText: b, drawArea: Y }) => {
const S = ({ space: _, scaleFormat: W, bgFormat: Q, currentFormat: ft }) => {
b({
x: g.width - a / 10,
}, _t = (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 m = o.getImageData(0, 0, 1, 1).data;
return `rgba(${m[0]}, ${m[1]}, ${m[2]}, ${t})`;
}, Et = ({ xCenterPoint: a, cfg: t, timePerPixel: e, timeSpacing: o, currentTime: m, $canvas: d, screenScaleCount: g, scaleHeight: v, startTime: p, drawLine: y, drawText: Y, drawArea: M }) => {
const k = ({ space: A, scaleTimeFormat: K, bgTimeFormat: lt, pointerTimeFormat: mt }) => {
Y({
x: d.width - a / 10,
y: 6,
text: $t(l, Q),
fontSize: `${g.height - 5}px`,
text: gt(m, lt),
fontSize: `${d.height - 5}px`,
align: "right",

@@ -270,10 +352,10 @@ baseLine: "top",

});
const K = v % r, lt = K / s;
for (let P = 0; P < $; P++) {
const J = P * t.scaleSpacing - lt - t.pointWidth / 2, k = v + P * r - K;
if (k % (r * _) === 0) {
x({ x: J, y: p.long }), b({
x: J,
y: g.height - p.long - 5,
text: $t(k, W),
const tt = p % o, R = tt / e;
for (let U = 0; U < g; U++) {
const E = U * t.scaleSpacing - R - t.pointerWidth / 2, _ = p + U * o - tt;
if (_ % (o * A) === 0) {
y({ x: E, y: v.long }), Y({
x: E,
y: d.height - v.long - 5,
text: gt(_, K),
baseLine: "bottom"

@@ -283,25 +365,30 @@ });

}
x({ x: J, y: p.short });
y({ x: E, y: v.short });
}
x({
x: a - t.pointWidth / 2,
y: g.height,
width: t.pointWidth,
color: t.pointColor
y({
x: a - t.pointerWidth / 2,
y: d.height,
width: t.pointerWidth,
color: t.pointerColor
}), M({
startX: a - t.pointerDisplayWidth / 2,
startY: 4,
endX: a + t.pointerDisplayWidth / 2,
endY: 4 + t.pointerDisplayHeight,
bgColor: t.pointerColor
}), Y({
startX: a - 50,
startY: 4,
endX: a + 50,
endY: 18,
bgColor: t.pointColor
}), b({
x: a,
y: 6,
text: $t(l, ft),
y: t.pointerDisplayHeight / 2 + 5,
text: gt(m, mt),
align: "center",
baseLine: "top"
baseLine: "middle"
});
};
r < 100 ? S({ space: 10, scaleFormat: "mm:ss:SSS", bgFormat: "YYYY/MM/DD", currentFormat: "HH:mm:ss:SSS" }) : r < 1e3 ? S({ space: 10, scaleFormat: "mm:ss", bgFormat: "YYYY/MM/DD", currentFormat: "HH:mm:ss:SSS" }) : r < 1e4 ? S({ space: 10, scaleFormat: "mm:ss", bgFormat: "YYYY/MM/DD", currentFormat: "HH:mm:ss" }) : r < 6e4 ? S({ space: 12, scaleFormat: "HH:mm:ss", bgFormat: "YYYY/MM/DD", currentFormat: "HH:mm:ss" }) : r < 6e5 ? S({ space: 10, scaleFormat: "HH:mm:ss", bgFormat: "YYYY/MM/DD", currentFormat: "HH:mm:ss" }) : r < 36e5 ? S({ space: 12, scaleFormat: "MM/DD HH:mm", bgFormat: "YYYY/MM", currentFormat: "MM/DD HH:mm:ss" }) : r < 864e5 ? S({ space: 12, scaleFormat: "MM/DD HH:mm", bgFormat: "YYYY/MM", currentFormat: "YYYY/MM/DD HH:mm" }) : r < 6048e5 ? S({ space: 10, scaleFormat: "YYYY/MM/DD", bgFormat: "YYYY", currentFormat: "YYYY/MM/DD" }) : S({ space: 10, scaleFormat: "YYYY/MM/DD", bgFormat: "YYYY", currentFormat: "YYYY/MM/DD" });
}, Pt = {
}, F = t.thresholdsConfig[o];
F && k({
space: F.space,
scaleTimeFormat: F.scaleTimeFormat,
bgTimeFormat: F.bgTimeFormat,
pointerTimeFormat: F.pointerTimeFormat
});
}, Wt = {
fill: !0,

@@ -311,71 +398,133 @@ width: 1e3,

bgColor: "rgba(0,0,0,0.5)",
areaBgColor: "#ffffff55",
textColor: "#ffffff",
fontFamily: "Arial",
scaleColor: "#ffffff",
pointColor: "#00aeec",
pointWidth: 3,
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]
timeSpacingList: [10, 100, 1e3, 1e4, 6e4, 6e5, 36e5, 864e5, 6048e5],
// scaleHeight: ,
// bgTextColor: ,
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
}
}
};
var Z, O, A, D, X, N, nt, Dt, rt, wt, at, xt, ot, yt, ht, bt, ct, St, G, vt, B, st, ut, Tt;
class zt {
constructor(t, s) {
var B, H, W, D, X, N, nt, Tt, rt, Dt, at, yt, ot, wt, ht, bt, ct, Q, J, ut, Yt;
class At {
constructor(t, e) {
// 拖拽
F(this, nt);
S(this, nt);
// 缩放
F(this, rt);
S(this, rt);
// 父元素size变化
F(this, at);
S(this, at);
// 清空画布
F(this, ot);
S(this, ot);
// 绘制比例尺
F(this, ht);
S(this, ht);
S(this, ut);
G(this, "$canvas");
G(this, "$canvasParent");
G(this, "ctx");
G(this, "cfg");
S(this, B, Ft());
S(this, H, 0);
S(this, W, void 0);
S(this, D, void 0);
S(this, X, void 0);
S(this, N, !1);
// 绘制线条
F(this, ct);
S(this, ct, ({ x: t, y: e, width: o = 1, color: m = 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 = m, this.ctx.lineWidth = o, this.ctx.stroke();
});
// 绘制文字
F(this, G);
S(this, Q, ({ x: t, y: e, text: o, color: m = this.cfg.textColor, fontSize: d = "11px", align: g = "center", baseLine: v = "alphabetic" }) => {
this.ctx.beginPath(), this.ctx.font = `${d} ${this.cfg.fontFamily}`, this.ctx.fillStyle = m, this.ctx.textAlign = g, this.ctx.textBaseline = v, this.ctx.fillText(o, t, e);
});
// 绘制区域
F(this, B);
F(this, ut);
V(this, "$canvas");
V(this, "ctx");
V(this, "$canvasParent");
V(this, "cfg");
F(this, Z, Ht());
F(this, O, 0);
F(this, A, void 0);
F(this, D, void 0);
// 刻度高度
F(this, X, void 0);
// 是否在拖拽中
F(this, N, !1);
S(this, J, ({ startX: t, startY: e, endX: o, endY: m, bgColor: d }) => {
this.ctx.beginPath(), this.ctx.rect(t, e, o - t, m - e), this.ctx.fillStyle = d, 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 = { ...Pt, ...s };
const { fill: r, width: l, height: g, zoom: $, timeSpacingList: p, scaleHeight: v, textColor: x, bgTextColor: b } = this.cfg;
if (b || (this.cfg.bgTextColor = At(x, 0.18)), $ < 0 || $ >= p.length || $ % 1 !== 0)
throw new Error(`zoom must be 0 ~ ${p.length - 1}, and must be an integer`);
if (r) {
const Y = this.$canvas.parentElement;
this.$canvasParent = Y, this.$canvas.width = Y.clientWidth, this.$canvas.height = Y.clientHeight, new ResizeObserver(Mt(H(this, at, xt).bind(this), 200)).observe(Y);
typeof t == "string" ? this.$canvas = document.querySelector(t) : this.$canvas = t, this.ctx = this.$canvas.getContext("2d"), this.cfg = { ...Wt, ...e }, e != null && e.pointColor && (this.cfg.pointerColor = e.pointColor), e != null && e.pointWidth && (this.cfg.pointerWidth = e.pointWidth);
const { fill: o, width: m, height: d, zoom: g, timeSpacingList: v, scaleHeight: p, textColor: y, bgTextColor: Y } = this.cfg;
if (Y || (this.cfg.bgTextColor = _t(y, 0.18)), g < 0 || g >= v.length || g % 1 !== 0)
throw new Error(`zoom must be 0 ~ ${v.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(vt(I(this, at, yt).bind(this), 200)).observe(M);
} else
l && (this.$canvas.width = l), g && (this.$canvas.height = g);
L(this, D, p[$]), v != null && v.long && (v != null && v.short) ? L(this, X, v) : L(this, X, {
this.$canvas.width = m, this.$canvas.height = d;
L(this, D, v[g]), p != null && p.long && (p != null && p.short) ? L(this, X, p) : L(this, X, {
long: this.$canvas.height / 3,
// 1/3高度
medium: this.$canvas.height / 6,
// 1/6高度
short: this.$canvas.height / 10
// 1/10高度
}), this.draw(), this.$canvas.addEventListener("wheel", H(this, rt, wt).bind(this), { passive: !1 }), this.$canvas.addEventListener("mousedown", H(this, nt, Dt).bind(this));
}), this.draw(), this.$canvas.addEventListener("wheel", I(this, rt, Dt).bind(this), { passive: !1 }), this.$canvas.addEventListener("mousedown", I(this, nt, Tt).bind(this));
}
// 绘制时间轴
draw({ currentTime: t, areas: s, _privateFlag: r } = {}) {
if (f(this, N) && !r)
draw({ currentTime: t, areas: e, _privateFlag: o } = {}) {
if (c(this, N) && !o)
return;
L(this, O, t || Date.now()), L(this, A, s || []);
const l = Math.ceil(this.$canvas.width / this.cfg.scaleSpacing), g = l * f(this, D), $ = f(this, O) - g / 2, p = f(this, O) + g / 2, v = this.$canvas.width / 2, x = g / this.$canvas.width;
H(this, ot, yt).call(this), H(this, B, st).call(this, {
L(this, H, t || Date.now()), L(this, W, e || []);
const m = Math.ceil(this.$canvas.width / this.cfg.scaleSpacing), d = m * c(this, D), g = c(this, H) - d / 2, v = c(this, H) + d / 2, p = this.$canvas.width / 2, y = d / this.$canvas.width;
I(this, ot, wt).call(this), c(this, J).call(this, {
startX: 0,

@@ -386,84 +535,81 @@ startY: 0,

bgColor: this.cfg.bgColor
}), f(this, A).forEach((b) => {
const Y = b.startTime <= $ ? 0 : Math.round((b.startTime - $) / x), S = b.endTime >= p ? this.$canvas.width : Math.round((b.endTime - $) / x);
Y < this.$canvas.width && S > 0 && H(this, B, st).call(this, {
startX: Y,
}), c(this, W).forEach((Y) => {
const M = Y.startTime <= g ? 0 : Math.round((Y.startTime - g) / y), k = Y.endTime >= v ? this.$canvas.width : Math.round((Y.endTime - g) / y);
M < this.$canvas.width && k > 0 && c(this, J).call(this, {
startX: M,
startY: 0,
endX: S,
endX: k,
endY: this.$canvas.height,
bgColor: b.bgColor || this.cfg.areaBgColor
bgColor: Y.bgColor || this.cfg.areaBgColor
});
}), Wt.bind(this)({
xCenterPoint: v,
screenScaleCount: l,
startTime: $,
timePerPixel: x,
scaleHeight: f(this, X),
timeSpacing: f(this, D),
currentTime: f(this, O),
}), Et.bind(this)({
xCenterPoint: p,
screenScaleCount: m,
startTime: g,
timePerPixel: y,
scaleHeight: c(this, X),
timeSpacing: c(this, D),
currentTime: c(this, H),
$canvas: this.$canvas,
cfg: this.cfg,
drawLine: H(this, ct, St).bind(this),
drawText: H(this, G, vt).bind(this),
drawArea: H(this, B, st).bind(this)
}), H(this, ht, bt).call(this);
drawLine: c(this, ct).bind(this),
drawText: c(this, Q).bind(this),
drawArea: c(this, J).bind(this)
}), I(this, ht, bt).call(this);
}
// 获取当前时间
getCurrentTime() {
return f(this, O);
return c(this, H);
}
on(t, s) {
f(this, Z).on(t, s);
on(t, e) {
c(this, B).on(t, e);
}
off(t, s) {
f(this, Z).off(t, s);
off(t, e) {
c(this, B).off(t, e);
}
}
Z = new WeakMap(), O = new WeakMap(), A = new WeakMap(), D = new WeakMap(), X = new WeakMap(), N = new WeakMap(), nt = new WeakSet(), Dt = function(t) {
B = new WeakMap(), H = new WeakMap(), W = new WeakMap(), D = new WeakMap(), X = new WeakMap(), N = new WeakMap(), nt = new WeakSet(), Tt = function(t) {
L(this, N, !0);
let s = 0, r = f(this, O);
const l = Mt(({ offsetX: p }) => {
if (!f(this, N))
let e = 0, o = c(this, H);
const m = vt(({ offsetX: v }) => {
if (!c(this, N))
return;
const v = p - t.offsetX;
r = Math.round(f(this, O) - f(this, D) / this.cfg.scaleSpacing * (v - s)), s = v, this.draw({
currentTime: r,
areas: f(this, A),
const p = v - t.offsetX;
o = Math.round(c(this, H) - c(this, D) / this.cfg.scaleSpacing * (p - e)), e = p, this.draw({
currentTime: o,
areas: c(this, W),
_privateFlag: !0
});
}, 1e3 / this.cfg.fps), g = ({ offsetX: p, offsetY: v }) => {
(p < 3 || p > this.$canvas.width - 3 || v < 3 || v > this.$canvas.height - 3) && (this.$canvas.removeEventListener("mousemove", l), this.$canvas.removeEventListener("mousemove", g));
}, $ = () => {
this.$canvas.removeEventListener("mousemove", l), this.$canvas.removeEventListener("mousemove", g), document.removeEventListener("mouseup", $), L(this, N, !1), H(this, ut, Tt).call(this, "dragged", r);
}, 1e3 / this.cfg.fps), d = ({ offsetX: v, offsetY: p }) => {
(v < 3 || v > this.$canvas.width - 3 || p < 3 || p > this.$canvas.height - 3) && (this.$canvas.removeEventListener("mousemove", m), this.$canvas.removeEventListener("mousemove", d));
}, g = () => {
this.$canvas.removeEventListener("mousemove", m), this.$canvas.removeEventListener("mousemove", d), document.removeEventListener("mouseup", g), L(this, N, !1), I(this, ut, Yt).call(this, "dragged", o);
};
this.$canvas.addEventListener("mousemove", l), this.$canvas.addEventListener("mousemove", g), document.addEventListener("mouseup", $);
}, rt = new WeakSet(), wt = function(t) {
this.$canvas.addEventListener("mousemove", m), this.$canvas.addEventListener("mousemove", d), document.addEventListener("mouseup", g);
}, rt = new WeakSet(), Dt = function(t) {
t.preventDefault();
const s = this.cfg.timeSpacingList.findIndex((r) => r === f(this, D));
t.deltaY < 0 && s > 0 ? (L(this, D, this.cfg.timeSpacingList[s - 1]), this.draw({
currentTime: f(this, O),
areas: f(this, A),
const e = this.cfg.timeSpacingList.findIndex((o) => o === c(this, D));
t.deltaY < 0 && e > 0 ? (L(this, D, this.cfg.timeSpacingList[e - 1]), this.draw({
currentTime: c(this, H),
areas: c(this, W),
_privateFlag: !0
})) : t.deltaY > 0 && s < this.cfg.timeSpacingList.length - 1 && (L(this, D, this.cfg.timeSpacingList[s + 1]), this.draw({
currentTime: f(this, O),
areas: f(this, A),
})) : t.deltaY > 0 && e < this.cfg.timeSpacingList.length - 1 && (L(this, D, this.cfg.timeSpacingList[e + 1]), this.draw({
currentTime: c(this, H),
areas: c(this, W),
_privateFlag: !0
}));
}, at = new WeakSet(), xt = function() {
}, at = new WeakSet(), yt = function() {
this.$canvasParent && (this.$canvas.width = this.$canvasParent.clientWidth, this.$canvas.height = this.$canvasParent.clientHeight, this.cfg.scaleHeight || L(this, X, {
long: this.$canvas.height / 3,
// 1/3高度
medium: this.$canvas.height / 6,
// 1/6高度
short: this.$canvas.height / 10
// 1/10高度
}), this.draw({
currentTime: f(this, O),
areas: f(this, A)
currentTime: c(this, H),
areas: c(this, W)
}));
}, ot = new WeakSet(), yt = function() {
}, ot = new WeakSet(), wt = function() {
this.ctx.clearRect(0, 0, this.$canvas.width, this.$canvas.height);
}, ht = new WeakSet(), bt = function() {
const t = () => f(this, D) < 1e3 ? `${f(this, D)}ms` : f(this, D) < 6e4 ? `${Math.round(f(this, D) / 100) / 10}sec` : f(this, D) < 36e5 ? `${Math.round(f(this, D) / 100 / 60) / 10}min` : f(this, D) < 864e5 ? `${Math.round(f(this, D) / 100 / 60 / 60) / 10}hours` : f(this, D) < 6048e5 ? `${Math.round(f(this, D) / 100 / 60 / 60 / 24) / 10}days` : `${Math.round(f(this, D) / 100 / 60 / 60 / 24 / 7) / 10}weeks`;
H(this, G, vt).call(this, {
const t = () => c(this, D) < 1e3 ? `${c(this, D)}ms` : c(this, D) < 6e4 ? `${Math.round(c(this, D) / 100) / 10}sec` : c(this, D) < 36e5 ? `${Math.round(c(this, D) / 100 / 60) / 10}min` : c(this, D) < 864e5 ? `${Math.round(c(this, D) / 100 / 60 / 60) / 10}hours` : c(this, D) < 6048e5 ? `${Math.round(c(this, D) / 100 / 60 / 60 / 24) / 10}days` : `${Math.round(c(this, D) / 100 / 60 / 60 / 24 / 7) / 10}weeks`;
c(this, Q).call(this, {
x: this.cfg.scaleSpacing + 12,

@@ -475,13 +621,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();
}, ct = new WeakSet(), St = function({ x: t, y: s, width: r = 1, color: l = this.cfg.scaleColor }) {
this.ctx.beginPath(), this.ctx.moveTo(t, this.$canvas.height), this.ctx.lineTo(t, this.$canvas.height - s), this.ctx.closePath(), this.ctx.strokeStyle = l, this.ctx.lineWidth = r, this.ctx.stroke();
}, G = new WeakSet(), vt = function({ x: t, y: s, text: r, color: l = this.cfg.textColor, fontSize: g = "11px", align: $ = "center", baseLine: p = "alphabetic" }) {
this.ctx.beginPath(), this.ctx.font = `${g} Arial`, this.ctx.fillStyle = l, this.ctx.textAlign = $, this.ctx.textBaseline = p, this.ctx.fillText(r, t, s);
}, B = new WeakSet(), st = function({ startX: t, startY: s, endX: r, endY: l, bgColor: g }) {
this.ctx.beginPath(), this.ctx.rect(t, s, r - t, l - s), this.ctx.fillStyle = g, this.ctx.fill();
}, ut = new WeakSet(), Tt = function(...t) {
f(this, Z).emit(...t);
}, ct = new WeakMap(), Q = new WeakMap(), J = new WeakMap(), ut = new WeakSet(), Yt = function(...t) {
c(this, B).emit(...t);
};
export {
zt as default
At as default,
gt as format
};

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

var $timeline=function(){var J,_,P,w,U,Z,it,xt,st,bt,nt,St,rt,Tt,at,Ft,ot,Ct,G,Dt,R,mt,ht,Ht;"use strict";var Pt=Object.defineProperty;var kt=(M,p,x)=>p in M?Pt(M,p,{enumerable:!0,configurable:!0,writable:!0,value:x}):M[p]=x;var et=(M,p,x)=>(kt(M,typeof p!="symbol"?p+"":p,x),x),Yt=(M,p,x)=>{if(!p.has(M))throw TypeError("Cannot "+x)};var u=(M,p,x)=>(Yt(M,p,"read from private field"),x?x.call(M):p.get(M)),O=(M,p,x)=>{if(p.has(M))throw TypeError("Cannot add the same private member more than once");p instanceof WeakSet?p.add(M):p.set(M,x)},A=(M,p,x,V)=>(Yt(M,p,"write to private field"),V?V.call(M,x):p.set(M,x),x);var E=(M,p,x)=>(Yt(M,p,"access private method"),x);function M(l){return{all:l=l||new Map,on:function(n,r){var s=l.get(n);s?s.push(r):l.set(n,[r])},off:function(n,r){var s=l.get(n);s&&(r?s.splice(s.indexOf(r)>>>0,1):l.set(n,[]))},emit:function(n,r){var s=l.get(n);s&&s.slice().map(function(f){f(r)}),(s=l.get("*"))&&s.slice().map(function(f){f(n,r)})}}}var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var V={exports:{}};(function(l,n){(function(r,s){l.exports=s()})(p,function(){var r=1e3,s=6e4,f=36e5,g="millisecond",$="second",Y="minute",v="hour",S="day",F="week",y="month",C="quarter",W="year",z="date",ct="Invalid Date",$t=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ut=/\[([^\]]+)]|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,vt={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(a){var i=["th","st","nd","rd"],t=a%100;return"["+a+(i[(t-20)%10]||i[t]||i[0])+"]"}},I=function(a,i,t){var o=String(a);return!o||o.length>=i?a:""+Array(i+1-o.length).join(t)+a},Q={s:I,z:function(a){var i=-a.utcOffset(),t=Math.abs(i),o=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+I(o,2,"0")+":"+I(e,2,"0")},m:function a(i,t){if(i.date()<t.date())return-a(t,i);var o=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(o,y),c=t-e<0,h=i.clone().add(o+(c?-1:1),y);return+(-(o+(t-e)/(c?e-h:h-e))||0)},a:function(a){return a<0?Math.ceil(a)||0:Math.floor(a)},p:function(a){return{M:y,y:W,w:F,d:S,D:z,h:v,m:Y,s:$,ms:g,Q:C}[a]||String(a||"").toLowerCase().replace(/s$/,"")},u:function(a){return a===void 0}},j="en",B={};B[j]=vt;var pt=function(a){return a instanceof lt},ft=function a(i,t,o){var e;if(!i)return j;if(typeof i=="string"){var c=i.toLowerCase();B[c]&&(e=c),t&&(B[c]=t,e=c);var h=i.split("-");if(!e&&h.length>1)return a(h[0])}else{var m=i.name;B[m]=i,e=m}return!o&&e&&(j=e),e||!o&&j},T=function(a,i){if(pt(a))return a.clone();var t=typeof i=="object"?i:{};return t.date=a,t.args=arguments,new lt(t)},d=Q;d.l=ft,d.i=pt,d.w=function(a,i){return T(a,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var lt=function(){function a(t){this.$L=ft(t.locale,null,!0),this.parse(t)}var i=a.prototype;return i.parse=function(t){this.$d=function(o){var e=o.date,c=o.utc;if(e===null)return new Date(NaN);if(d.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var h=e.match($t);if(h){var m=h[2]-1||0,b=(h[7]||"0").substring(0,3);return c?new Date(Date.UTC(h[1],m,h[3]||1,h[4]||0,h[5]||0,h[6]||0,b)):new Date(h[1],m,h[3]||1,h[4]||0,h[5]||0,h[6]||0,b)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return d},i.isValid=function(){return this.$d.toString()!==ct},i.isSame=function(t,o){var e=T(t);return this.startOf(o)<=e&&e<=this.endOf(o)},i.isAfter=function(t,o){return T(t)<this.startOf(o)},i.isBefore=function(t,o){return this.endOf(o)<T(t)},i.$g=function(t,o,e){return d.u(t)?this[o]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,o){var e=this,c=!!d.u(o)||o,h=d.p(t),m=function(q,L){var N=d.w(e.$u?Date.UTC(e.$y,L,q):new Date(e.$y,L,q),e);return c?N:N.endOf(S)},b=function(q,L){return d.w(e.toDate()[q].apply(e.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(L)),e)},D=this.$W,H=this.$M,X=this.$D,k="set"+(this.$u?"UTC":"");switch(h){case W:return c?m(1,0):m(31,11);case y:return c?m(1,H):m(0,H+1);case F:var K=this.$locale().weekStart||0,tt=(D<K?D+7:D)-K;return m(c?X-tt:X+(6-tt),H);case S:case z:return b(k+"Hours",0);case v:return b(k+"Minutes",1);case Y:return b(k+"Seconds",2);case $:return b(k+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,o){var e,c=d.p(t),h="set"+(this.$u?"UTC":""),m=(e={},e[S]=h+"Date",e[z]=h+"Date",e[y]=h+"Month",e[W]=h+"FullYear",e[v]=h+"Hours",e[Y]=h+"Minutes",e[$]=h+"Seconds",e[g]=h+"Milliseconds",e)[c],b=c===S?this.$D+(o-this.$W):o;if(c===y||c===W){var D=this.clone().set(z,1);D.$d[m](b),D.init(),this.$d=D.set(z,Math.min(this.$D,D.daysInMonth())).$d}else m&&this.$d[m](b);return this.init(),this},i.set=function(t,o){return this.clone().$set(t,o)},i.get=function(t){return this[d.p(t)]()},i.add=function(t,o){var e,c=this;t=Number(t);var h=d.p(o),m=function(H){var X=T(c);return d.w(X.date(X.date()+Math.round(H*t)),c)};if(h===y)return this.set(y,this.$M+t);if(h===W)return this.set(W,this.$y+t);if(h===S)return m(1);if(h===F)return m(7);var b=(e={},e[Y]=s,e[v]=f,e[$]=r,e)[h]||1,D=this.$d.getTime()+t*b;return d.w(D,this)},i.subtract=function(t,o){return this.add(-1*t,o)},i.format=function(t){var o=this,e=this.$locale();if(!this.isValid())return e.invalidDate||ct;var c=t||"YYYY-MM-DDTHH:mm:ssZ",h=d.z(this),m=this.$H,b=this.$m,D=this.$M,H=e.weekdays,X=e.months,k=function(L,N,Mt,dt){return L&&(L[N]||L(o,c))||Mt[N].slice(0,dt)},K=function(L){return d.s(m%12||12,L,"0")},tt=e.meridiem||function(L,N,Mt){var dt=L<12?"AM":"PM";return Mt?dt.toLowerCase():dt},q={YY:String(this.$y).slice(-2),YYYY:d.s(this.$y,4,"0"),M:D+1,MM:d.s(D+1,2,"0"),MMM:k(e.monthsShort,D,X,3),MMMM:k(X,D),D:this.$D,DD:d.s(this.$D,2,"0"),d:String(this.$W),dd:k(e.weekdaysMin,this.$W,H,2),ddd:k(e.weekdaysShort,this.$W,H,3),dddd:H[this.$W],H:String(m),HH:d.s(m,2,"0"),h:K(1),hh:K(2),a:tt(m,b,!0),A:tt(m,b,!1),m:String(b),mm:d.s(b,2,"0"),s:String(this.$s),ss:d.s(this.$s,2,"0"),SSS:d.s(this.$ms,3,"0"),Z:h};return c.replace(ut,function(L,N){return N||q[L]||h.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,o,e){var c,h=d.p(o),m=T(t),b=(m.utcOffset()-this.utcOffset())*s,D=this-m,H=d.m(this,m);return H=(c={},c[W]=H/12,c[y]=H,c[C]=H/3,c[F]=(D-b)/6048e5,c[S]=(D-b)/864e5,c[v]=D/f,c[Y]=D/s,c[$]=D/r,c)[h]||D,e?H:d.a(H)},i.daysInMonth=function(){return this.endOf(y).$D},i.$locale=function(){return B[this.$L]},i.locale=function(t,o){if(!t)return this.$L;var e=this.clone(),c=ft(t,o,!0);return c&&(e.$L=c),e},i.clone=function(){return d.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},a}(),yt=lt.prototype;return T.prototype=yt,[["$ms",g],["$s",$],["$m",Y],["$H",v],["$W",S],["$M",y],["$y",W],["$D",z]].forEach(function(a){yt[a[1]]=function(i){return this.$g(i,a[0],a[1])}}),T.extend=function(a,i){return a.$i||(a(i,lt,T),a.$i=!0),T},T.locale=ft,T.isDayjs=pt,T.unix=function(a){return T(1e3*a)},T.en=B[j],T.Ls=B,T.p={},T})})(V);var Ot=V.exports;const Lt=x(Ot),gt=(l,n="MM/DD HH:mm")=>Lt(l).format(n),wt=(l,n)=>{let r,s=0;return(...f)=>{const g=Date.now(),$=g-s;!s||$>=n?(s=g,l.apply(void 0,f)):r||(r=setTimeout(()=>{s=g,l.apply(void 0,f),r=null},n-$))}},_t=(l,n)=>{const r=document.createElement("canvas");r.width=r.height=1;const s=r.getContext("2d");s.fillStyle=l,s.fillRect(0,0,1,1);const f=s.getImageData(0,0,1,1).data;return`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${n})`},Et=({xCenterPoint:l,cfg:n,timePerPixel:r,timeSpacing:s,currentTime:f,$canvas:g,screenScaleCount:$,scaleHeight:Y,startTime:v,drawLine:S,drawText:F,drawArea:y})=>{const C=({space:W,scaleFormat:z,bgFormat:ct,currentFormat:$t})=>{F({x:g.width-l/10,y:6,text:gt(f,ct),fontSize:`${g.height-5}px`,align:"right",baseLine:"top",color:n.bgTextColor});const ut=v%s,vt=ut/r;for(let I=0;I<$;I++){const Q=I*n.scaleSpacing-vt-n.pointWidth/2,j=v+I*s-ut;if(j%(s*W)===0){S({x:Q,y:Y.long}),F({x:Q,y:g.height-Y.long-5,text:gt(j,z),baseLine:"bottom"});continue}S({x:Q,y:Y.short})}S({x:l-n.pointWidth/2,y:g.height,width:n.pointWidth,color:n.pointColor}),y({startX:l-50,startY:4,endX:l+50,endY:18,bgColor:n.pointColor}),F({x:l,y:6,text:gt(f,$t),align:"center",baseLine:"top"})};s<100?C({space:10,scaleFormat:"mm:ss:SSS",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss:SSS"}):s<1e3?C({space:10,scaleFormat:"mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss:SSS"}):s<1e4?C({space:10,scaleFormat:"mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss"}):s<6e4?C({space:12,scaleFormat:"HH:mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss"}):s<6e5?C({space:10,scaleFormat:"HH:mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss"}):s<36e5?C({space:12,scaleFormat:"MM/DD HH:mm",bgFormat:"YYYY/MM",currentFormat:"MM/DD HH:mm:ss"}):s<864e5?C({space:12,scaleFormat:"MM/DD HH:mm",bgFormat:"YYYY/MM",currentFormat:"YYYY/MM/DD HH:mm"}):s<6048e5?C({space:10,scaleFormat:"YYYY/MM/DD",bgFormat:"YYYY",currentFormat:"YYYY/MM/DD"}):C({space:10,scaleFormat:"YYYY/MM/DD",bgFormat:"YYYY",currentFormat:"YYYY/MM/DD"})},At={fill:!0,width:1e3,height:60,bgColor:"rgba(0,0,0,0.5)",areaBgColor:"#ffffff55",textColor:"#ffffff",scaleColor:"#ffffff",pointColor:"#00aeec",pointWidth:3,scaleSpacing:7,fps:60,zoom:3,timeSpacingList:[10,100,1e3,1e4,6e4,6e5,36e5,864e5,6048e5]};class Wt{constructor(n,r){O(this,it);O(this,st);O(this,nt);O(this,rt);O(this,at);O(this,ot);O(this,G);O(this,R);O(this,ht);et(this,"$canvas");et(this,"ctx");et(this,"$canvasParent");et(this,"cfg");O(this,J,M());O(this,_,0);O(this,P,void 0);O(this,w,void 0);O(this,U,void 0);O(this,Z,!1);if(!n)throw new Error("canvas Element Or Element ID is required!");typeof n=="string"?this.$canvas=document.querySelector(n):this.$canvas=n,this.ctx=this.$canvas.getContext("2d"),this.cfg={...At,...r};const{fill:s,width:f,height:g,zoom:$,timeSpacingList:Y,scaleHeight:v,textColor:S,bgTextColor:F}=this.cfg;if(F||(this.cfg.bgTextColor=_t(S,.18)),$<0||$>=Y.length||$%1!==0)throw new Error(`zoom must be 0 ~ ${Y.length-1}, and must be an integer`);if(s){const y=this.$canvas.parentElement;this.$canvasParent=y,this.$canvas.width=y.clientWidth,this.$canvas.height=y.clientHeight,new ResizeObserver(wt(E(this,nt,St).bind(this),200)).observe(y)}else f&&(this.$canvas.width=f),g&&(this.$canvas.height=g);A(this,w,Y[$]),v!=null&&v.long&&(v!=null&&v.short)?A(this,U,v):A(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",E(this,st,bt).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",E(this,it,xt).bind(this))}draw({currentTime:n,areas:r,_privateFlag:s}={}){if(u(this,Z)&&!s)return;A(this,_,n||Date.now()),A(this,P,r||[]);const f=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),g=f*u(this,w),$=u(this,_)-g/2,Y=u(this,_)+g/2,v=this.$canvas.width/2,S=g/this.$canvas.width;E(this,rt,Tt).call(this),E(this,R,mt).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),u(this,P).forEach(F=>{const y=F.startTime<=$?0:Math.round((F.startTime-$)/S),C=F.endTime>=Y?this.$canvas.width:Math.round((F.endTime-$)/S);y<this.$canvas.width&&C>0&&E(this,R,mt).call(this,{startX:y,startY:0,endX:C,endY:this.$canvas.height,bgColor:F.bgColor||this.cfg.areaBgColor})}),Et.bind(this)({xCenterPoint:v,screenScaleCount:f,startTime:$,timePerPixel:S,scaleHeight:u(this,U),timeSpacing:u(this,w),currentTime:u(this,_),$canvas:this.$canvas,cfg:this.cfg,drawLine:E(this,ot,Ct).bind(this),drawText:E(this,G,Dt).bind(this),drawArea:E(this,R,mt).bind(this)}),E(this,at,Ft).call(this)}getCurrentTime(){return u(this,_)}on(n,r){u(this,J).on(n,r)}off(n,r){u(this,J).off(n,r)}}return J=new WeakMap,_=new WeakMap,P=new WeakMap,w=new WeakMap,U=new WeakMap,Z=new WeakMap,it=new WeakSet,xt=function(n){A(this,Z,!0);let r=0,s=u(this,_);const f=wt(({offsetX:Y})=>{if(!u(this,Z))return;const v=Y-n.offsetX;s=Math.round(u(this,_)-u(this,w)/this.cfg.scaleSpacing*(v-r)),r=v,this.draw({currentTime:s,areas:u(this,P),_privateFlag:!0})},1e3/this.cfg.fps),g=({offsetX:Y,offsetY:v})=>{(Y<3||Y>this.$canvas.width-3||v<3||v>this.$canvas.height-3)&&(this.$canvas.removeEventListener("mousemove",f),this.$canvas.removeEventListener("mousemove",g))},$=()=>{this.$canvas.removeEventListener("mousemove",f),this.$canvas.removeEventListener("mousemove",g),document.removeEventListener("mouseup",$),A(this,Z,!1),E(this,ht,Ht).call(this,"dragged",s)};this.$canvas.addEventListener("mousemove",f),this.$canvas.addEventListener("mousemove",g),document.addEventListener("mouseup",$)},st=new WeakSet,bt=function(n){n.preventDefault();const r=this.cfg.timeSpacingList.findIndex(s=>s===u(this,w));n.deltaY<0&&r>0?(A(this,w,this.cfg.timeSpacingList[r-1]),this.draw({currentTime:u(this,_),areas:u(this,P),_privateFlag:!0})):n.deltaY>0&&r<this.cfg.timeSpacingList.length-1&&(A(this,w,this.cfg.timeSpacingList[r+1]),this.draw({currentTime:u(this,_),areas:u(this,P),_privateFlag:!0}))},nt=new WeakSet,St=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||A(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:u(this,_),areas:u(this,P)}))},rt=new WeakSet,Tt=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},at=new WeakSet,Ft=function(){const n=()=>u(this,w)<1e3?`${u(this,w)}ms`:u(this,w)<6e4?`${Math.round(u(this,w)/100)/10}sec`:u(this,w)<36e5?`${Math.round(u(this,w)/100/60)/10}min`:u(this,w)<864e5?`${Math.round(u(this,w)/100/60/60)/10}hours`:u(this,w)<6048e5?`${Math.round(u(this,w)/100/60/60/24)/10}days`:`${Math.round(u(this,w)/100/60/60/24/7)/10}weeks`;E(this,G,Dt).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:n(),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()},ot=new WeakSet,Ct=function({x:n,y:r,width:s=1,color:f=this.cfg.scaleColor}){this.ctx.beginPath(),this.ctx.moveTo(n,this.$canvas.height),this.ctx.lineTo(n,this.$canvas.height-r),this.ctx.closePath(),this.ctx.strokeStyle=f,this.ctx.lineWidth=s,this.ctx.stroke()},G=new WeakSet,Dt=function({x:n,y:r,text:s,color:f=this.cfg.textColor,fontSize:g="11px",align:$="center",baseLine:Y="alphabetic"}){this.ctx.beginPath(),this.ctx.font=`${g} Arial`,this.ctx.fillStyle=f,this.ctx.textAlign=$,this.ctx.textBaseline=Y,this.ctx.fillText(s,n,r)},R=new WeakSet,mt=function({startX:n,startY:r,endX:s,endY:f,bgColor:g}){this.ctx.beginPath(),this.ctx.rect(n,r,s-n,f-r),this.ctx.fillStyle=g,this.ctx.fill()},ht=new WeakSet,Ht=function(...n){u(this,J).emit(...n)},Wt}();
var $timeline=function(d){"use strict";var kt=Object.defineProperty;var At=(d,M,w)=>M in d?kt(d,M,{enumerable:!0,configurable:!0,writable:!0,value:w}):d[M]=w;var et=(d,M,w)=>(At(d,typeof M!="symbol"?M+"":M,w),w),Mt=(d,M,w)=>{if(!M.has(d))throw TypeError("Cannot "+w)};var h=(d,M,w)=>(Mt(d,M,"read from private field"),w?w.call(d):M.get(d)),H=(d,M,w)=>{if(M.has(d))throw TypeError("Cannot add the same private member more than once");M instanceof WeakSet?M.add(d):M.set(d,w)},W=(d,M,w,it)=>(Mt(d,M,"write to private field"),it?it.call(d,w):M.set(d,w),w);var B=(d,M,w)=>(Mt(d,M,"access private method"),w);var J,_,A,D,X,N,nt,wt,rt,St,at,Yt,ot,xt,ht,Ft,ct,G,R,ut,Ct;function M(m){return{all:m=m||new Map,on:function(s,n){var a=m.get(s);a?a.push(n):m.set(s,[n])},off:function(s,n){var a=m.get(s);a&&(n?a.splice(a.indexOf(n)>>>0,1):m.set(s,[]))},emit:function(s,n){var a=m.get(s);a&&a.slice().map(function(l){l(n)}),(a=m.get("*"))&&a.slice().map(function(l){l(s,n)})}}}var w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function it(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var Tt={exports:{}};(function(m,s){(function(n,a){m.exports=a()})(w,function(){var n=1e3,a=6e4,l=36e5,g="millisecond",$="second",T="minute",p="hour",S="day",F="week",y="month",j="quarter",O="year",z="date",lt="Invalid Date",$t=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,vt=/\[([^\]]+)]|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,mt={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(o){var i=["th","st","nd","rd"],t=o%100;return"["+o+(i[(t-20)%10]||i[t]||i[0])+"]"}},Q=function(o,i,t){var r=String(o);return!r||r.length>=i?o:""+Array(i+1-r.length).join(t)+o},q={s:Q,z:function(o){var i=-o.utcOffset(),t=Math.abs(i),r=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+Q(r,2,"0")+":"+Q(e,2,"0")},m:function o(i,t){if(i.date()<t.date())return-o(t,i);var r=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(r,y),c=t-e<0,u=i.clone().add(r+(c?-1:1),y);return+(-(r+(t-e)/(c?e-u:u-e))||0)},a:function(o){return o<0?Math.ceil(o)||0:Math.floor(o)},p:function(o){return{M:y,y:O,w:F,d:S,D:z,h:p,m:T,s:$,ms:g,Q:j}[o]||String(o||"").toLowerCase().replace(/s$/,"")},u:function(o){return o===void 0}},P="en",k={};k[P]=mt;var yt="$isDayjsObject",pt=function(o){return o instanceof dt||!(!o||!o[yt])},ft=function o(i,t,r){var e;if(!i)return P;if(typeof i=="string"){var c=i.toLowerCase();k[c]&&(e=c),t&&(k[c]=t,e=c);var u=i.split("-");if(!e&&u.length>1)return o(u[0])}else{var v=i.name;k[v]=i,e=v}return!r&&e&&(P=e),e||!r&&P},Y=function(o,i){if(pt(o))return o.clone();var t=typeof i=="object"?i:{};return t.date=o,t.args=arguments,new dt(t)},f=q;f.l=ft,f.i=pt,f.w=function(o,i){return Y(o,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var dt=function(){function o(t){this.$L=ft(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[yt]=!0}var i=o.prototype;return i.parse=function(t){this.$d=function(r){var e=r.date,c=r.utc;if(e===null)return new Date(NaN);if(f.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var u=e.match($t);if(u){var v=u[2]-1||0,b=(u[7]||"0").substring(0,3);return c?new Date(Date.UTC(u[1],v,u[3]||1,u[4]||0,u[5]||0,u[6]||0,b)):new Date(u[1],v,u[3]||1,u[4]||0,u[5]||0,u[6]||0,b)}}return new Date(e)}(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return f},i.isValid=function(){return this.$d.toString()!==lt},i.isSame=function(t,r){var e=Y(t);return this.startOf(r)<=e&&e<=this.endOf(r)},i.isAfter=function(t,r){return Y(t)<this.startOf(r)},i.isBefore=function(t,r){return this.endOf(r)<Y(t)},i.$g=function(t,r,e){return f.u(t)?this[r]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,r){var e=this,c=!!f.u(r)||r,u=f.p(t),v=function(Z,L){var I=f.w(e.$u?Date.UTC(e.$y,L,Z):new Date(e.$y,L,Z),e);return c?I:I.endOf(S)},b=function(Z,L){return f.w(e.toDate()[Z].apply(e.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(L)),e)},x=this.$W,C=this.$M,E=this.$D,V="set"+(this.$u?"UTC":"");switch(u){case O:return c?v(1,0):v(31,11);case y:return c?v(1,C):v(0,C+1);case F:var U=this.$locale().weekStart||0,K=(x<U?x+7:x)-U;return v(c?E-K:E+(6-K),C);case S:case z:return b(V+"Hours",0);case p:return b(V+"Minutes",1);case T:return b(V+"Seconds",2);case $:return b(V+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,r){var e,c=f.p(t),u="set"+(this.$u?"UTC":""),v=(e={},e[S]=u+"Date",e[z]=u+"Date",e[y]=u+"Month",e[O]=u+"FullYear",e[p]=u+"Hours",e[T]=u+"Minutes",e[$]=u+"Seconds",e[g]=u+"Milliseconds",e)[c],b=c===S?this.$D+(r-this.$W):r;if(c===y||c===O){var x=this.clone().set(z,1);x.$d[v](b),x.init(),this.$d=x.set(z,Math.min(this.$D,x.daysInMonth())).$d}else v&&this.$d[v](b);return this.init(),this},i.set=function(t,r){return this.clone().$set(t,r)},i.get=function(t){return this[f.p(t)]()},i.add=function(t,r){var e,c=this;t=Number(t);var u=f.p(r),v=function(C){var E=Y(c);return f.w(E.date(E.date()+Math.round(C*t)),c)};if(u===y)return this.set(y,this.$M+t);if(u===O)return this.set(O,this.$y+t);if(u===S)return v(1);if(u===F)return v(7);var b=(e={},e[T]=a,e[p]=l,e[$]=n,e)[u]||1,x=this.$d.getTime()+t*b;return f.w(x,this)},i.subtract=function(t,r){return this.add(-1*t,r)},i.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||lt;var c=t||"YYYY-MM-DDTHH:mm:ssZ",u=f.z(this),v=this.$H,b=this.$m,x=this.$M,C=e.weekdays,E=e.months,V=e.meridiem,U=function(L,I,tt,gt){return L&&(L[I]||L(r,c))||tt[I].slice(0,gt)},K=function(L){return f.s(v%12||12,L,"0")},Z=V||function(L,I,tt){var gt=L<12?"AM":"PM";return tt?gt.toLowerCase():gt};return c.replace(vt,function(L,I){return I||function(tt){switch(tt){case"YY":return String(r.$y).slice(-2);case"YYYY":return f.s(r.$y,4,"0");case"M":return x+1;case"MM":return f.s(x+1,2,"0");case"MMM":return U(e.monthsShort,x,E,3);case"MMMM":return U(E,x);case"D":return r.$D;case"DD":return f.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return U(e.weekdaysMin,r.$W,C,2);case"ddd":return U(e.weekdaysShort,r.$W,C,3);case"dddd":return C[r.$W];case"H":return String(v);case"HH":return f.s(v,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return Z(v,b,!0);case"A":return Z(v,b,!1);case"m":return String(b);case"mm":return f.s(b,2,"0");case"s":return String(r.$s);case"ss":return f.s(r.$s,2,"0");case"SSS":return f.s(r.$ms,3,"0");case"Z":return u}return null}(L)||u.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,r,e){var c,u=this,v=f.p(r),b=Y(t),x=(b.utcOffset()-this.utcOffset())*a,C=this-b,E=function(){return f.m(u,b)};switch(v){case O:c=E()/12;break;case y:c=E();break;case j:c=E()/3;break;case F:c=(C-x)/6048e5;break;case S:c=(C-x)/864e5;break;case p:c=C/l;break;case T:c=C/a;break;case $:c=C/n;break;default:c=C}return e?c:f.a(c)},i.daysInMonth=function(){return this.endOf(y).$D},i.$locale=function(){return k[this.$L]},i.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),c=ft(t,r,!0);return c&&(e.$L=c),e},i.clone=function(){return f.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},o}(),bt=dt.prototype;return Y.prototype=bt,[["$ms",g],["$s",$],["$m",T],["$H",p],["$W",S],["$M",y],["$y",O],["$D",z]].forEach(function(o){bt[o[1]]=function(i){return this.$g(i,o[0],o[1])}}),Y.extend=function(o,i){return o.$i||(o(i,dt,Y),o.$i=!0),Y},Y.locale=ft,Y.isDayjs=pt,Y.unix=function(o){return Y(1e3*o)},Y.en=k[P],Y.Ls=k,Y.p={},Y})})(Tt);var Ht=Tt.exports;const Ot=it(Ht),st=(m,s="MM/DD HH:mm")=>Ot(m).format(s),Dt=(m,s)=>{let n,a=0;return(...l)=>{const g=Date.now(),$=g-a;!a||$>=s?(a=g,m.apply(void 0,l)):n||(n=setTimeout(()=>{a=g,m.apply(void 0,l),n=null},s-$))}},Lt=(m,s)=>{const n=document.createElement("canvas");n.width=n.height=1;const a=n.getContext("2d");a.fillStyle=m,a.fillRect(0,0,1,1);const l=a.getImageData(0,0,1,1).data;return`rgba(${l[0]}, ${l[1]}, ${l[2]}, ${s})`},_t=({xCenterPoint:m,cfg:s,timePerPixel:n,timeSpacing:a,currentTime:l,$canvas:g,screenScaleCount:$,scaleHeight:T,startTime:p,drawLine:S,drawText:F,drawArea:y})=>{const j=({space:z,scaleTimeFormat:lt,bgTimeFormat:$t,pointerTimeFormat:vt})=>{F({x:g.width-m/10,y:6,text:st(l,$t),fontSize:`${g.height-5}px`,align:"right",baseLine:"top",color:s.bgTextColor});const mt=p%a,Q=mt/n;for(let q=0;q<$;q++){const P=q*s.scaleSpacing-Q-s.pointerWidth/2,k=p+q*a-mt;if(k%(a*z)===0){S({x:P,y:T.long}),F({x:P,y:g.height-T.long-5,text:st(k,lt),baseLine:"bottom"});continue}S({x:P,y:T.short})}S({x:m-s.pointerWidth/2,y:g.height,width:s.pointerWidth,color:s.pointerColor}),y({startX:m-s.pointerDisplayWidth/2,startY:4,endX:m+s.pointerDisplayWidth/2,endY:4+s.pointerDisplayHeight,bgColor:s.pointerColor}),F({x:m,y:s.pointerDisplayHeight/2+5,text:st(l,vt),align:"center",baseLine:"middle"})},O=s.thresholdsConfig[a];O&&j({space:O.space,scaleTimeFormat:O.scaleTimeFormat,bgTimeFormat:O.bgTimeFormat,pointerTimeFormat:O.pointerTimeFormat})},Et={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 Wt{constructor(s,n){H(this,nt);H(this,rt);H(this,at);H(this,ot);H(this,ht);H(this,ut);et(this,"$canvas");et(this,"$canvasParent");et(this,"ctx");et(this,"cfg");H(this,J,M());H(this,_,0);H(this,A,void 0);H(this,D,void 0);H(this,X,void 0);H(this,N,!1);H(this,ct,({x:s,y:n,width:a=1,color:l=this.cfg.scaleColor})=>{this.ctx.beginPath(),this.ctx.moveTo(s,this.$canvas.height),this.ctx.lineTo(s,this.$canvas.height-n),this.ctx.closePath(),this.ctx.strokeStyle=l,this.ctx.lineWidth=a,this.ctx.stroke()});H(this,G,({x:s,y:n,text:a,color:l=this.cfg.textColor,fontSize:g="11px",align:$="center",baseLine:T="alphabetic"})=>{this.ctx.beginPath(),this.ctx.font=`${g} ${this.cfg.fontFamily}`,this.ctx.fillStyle=l,this.ctx.textAlign=$,this.ctx.textBaseline=T,this.ctx.fillText(a,s,n)});H(this,R,({startX:s,startY:n,endX:a,endY:l,bgColor:g})=>{this.ctx.beginPath(),this.ctx.rect(s,n,a-s,l-n),this.ctx.fillStyle=g,this.ctx.fill()});if(!s)throw new Error("canvas Element Or Element ID is required!");typeof s=="string"?this.$canvas=document.querySelector(s):this.$canvas=s,this.ctx=this.$canvas.getContext("2d"),this.cfg={...Et,...n},n!=null&&n.pointColor&&(this.cfg.pointerColor=n.pointColor),n!=null&&n.pointWidth&&(this.cfg.pointerWidth=n.pointWidth);const{fill:a,width:l,height:g,zoom:$,timeSpacingList:T,scaleHeight:p,textColor:S,bgTextColor:F}=this.cfg;if(F||(this.cfg.bgTextColor=Lt(S,.18)),$<0||$>=T.length||$%1!==0)throw new Error(`zoom must be 0 ~ ${T.length-1}, and must be an integer`);if(a){const y=this.$canvas.parentElement;this.$canvasParent=y,this.$canvas.width=y.clientWidth,this.$canvas.height=y.clientHeight,new ResizeObserver(Dt(B(this,at,Yt).bind(this),200)).observe(y)}else this.$canvas.width=l,this.$canvas.height=g;W(this,D,T[$]),p!=null&&p.long&&(p!=null&&p.short)?W(this,X,p):W(this,X,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",B(this,rt,St).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",B(this,nt,wt).bind(this))}draw({currentTime:s,areas:n,_privateFlag:a}={}){if(h(this,N)&&!a)return;W(this,_,s||Date.now()),W(this,A,n||[]);const l=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),g=l*h(this,D),$=h(this,_)-g/2,T=h(this,_)+g/2,p=this.$canvas.width/2,S=g/this.$canvas.width;B(this,ot,xt).call(this),h(this,R).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),h(this,A).forEach(F=>{const y=F.startTime<=$?0:Math.round((F.startTime-$)/S),j=F.endTime>=T?this.$canvas.width:Math.round((F.endTime-$)/S);y<this.$canvas.width&&j>0&&h(this,R).call(this,{startX:y,startY:0,endX:j,endY:this.$canvas.height,bgColor:F.bgColor||this.cfg.areaBgColor})}),_t.bind(this)({xCenterPoint:p,screenScaleCount:l,startTime:$,timePerPixel:S,scaleHeight:h(this,X),timeSpacing:h(this,D),currentTime:h(this,_),$canvas:this.$canvas,cfg:this.cfg,drawLine:h(this,ct).bind(this),drawText:h(this,G).bind(this),drawArea:h(this,R).bind(this)}),B(this,ht,Ft).call(this)}getCurrentTime(){return h(this,_)}on(s,n){h(this,J).on(s,n)}off(s,n){h(this,J).off(s,n)}}return J=new WeakMap,_=new WeakMap,A=new WeakMap,D=new WeakMap,X=new WeakMap,N=new WeakMap,nt=new WeakSet,wt=function(s){W(this,N,!0);let n=0,a=h(this,_);const l=Dt(({offsetX:T})=>{if(!h(this,N))return;const p=T-s.offsetX;a=Math.round(h(this,_)-h(this,D)/this.cfg.scaleSpacing*(p-n)),n=p,this.draw({currentTime:a,areas:h(this,A),_privateFlag:!0})},1e3/this.cfg.fps),g=({offsetX:T,offsetY:p})=>{(T<3||T>this.$canvas.width-3||p<3||p>this.$canvas.height-3)&&(this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",g))},$=()=>{this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",g),document.removeEventListener("mouseup",$),W(this,N,!1),B(this,ut,Ct).call(this,"dragged",a)};this.$canvas.addEventListener("mousemove",l),this.$canvas.addEventListener("mousemove",g),document.addEventListener("mouseup",$)},rt=new WeakSet,St=function(s){s.preventDefault();const n=this.cfg.timeSpacingList.findIndex(a=>a===h(this,D));s.deltaY<0&&n>0?(W(this,D,this.cfg.timeSpacingList[n-1]),this.draw({currentTime:h(this,_),areas:h(this,A),_privateFlag:!0})):s.deltaY>0&&n<this.cfg.timeSpacingList.length-1&&(W(this,D,this.cfg.timeSpacingList[n+1]),this.draw({currentTime:h(this,_),areas:h(this,A),_privateFlag:!0}))},at=new WeakSet,Yt=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||W(this,X,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:h(this,_),areas:h(this,A)}))},ot=new WeakSet,xt=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},ht=new WeakSet,Ft=function(){const s=()=>h(this,D)<1e3?`${h(this,D)}ms`:h(this,D)<6e4?`${Math.round(h(this,D)/100)/10}sec`:h(this,D)<36e5?`${Math.round(h(this,D)/100/60)/10}min`:h(this,D)<864e5?`${Math.round(h(this,D)/100/60/60)/10}hours`:h(this,D)<6048e5?`${Math.round(h(this,D)/100/60/60/24)/10}days`:`${Math.round(h(this,D)/100/60/60/24/7)/10}weeks`;h(this,G).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:s(),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()},ct=new WeakMap,G=new WeakMap,R=new WeakMap,ut=new WeakSet,Ct=function(...s){h(this,J).emit(...s)},d.default=Wt,d.format=st,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),d}({});

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

(function($,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):($=typeof globalThis<"u"?globalThis:$||self,$.$timeline=d())})(this,function(){var J,_,P,w,U,Z,it,xt,st,bt,nt,St,rt,Tt,at,Ft,ot,Ct,G,Dt,R,mt,ht,Ht;"use strict";var Pt=Object.defineProperty;var kt=($,d,x)=>d in $?Pt($,d,{enumerable:!0,configurable:!0,writable:!0,value:x}):$[d]=x;var et=($,d,x)=>(kt($,typeof d!="symbol"?d+"":d,x),x),Yt=($,d,x)=>{if(!d.has($))throw TypeError("Cannot "+x)};var u=($,d,x)=>(Yt($,d,"read from private field"),x?x.call($):d.get($)),O=($,d,x)=>{if(d.has($))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add($):d.set($,x)},A=($,d,x,V)=>(Yt($,d,"write to private field"),V?V.call($,x):d.set($,x),x);var E=($,d,x)=>(Yt($,d,"access private method"),x);function $(l){return{all:l=l||new Map,on:function(n,r){var s=l.get(n);s?s.push(r):l.set(n,[r])},off:function(n,r){var s=l.get(n);s&&(r?s.splice(s.indexOf(r)>>>0,1):l.set(n,[]))},emit:function(n,r){var s=l.get(n);s&&s.slice().map(function(f){f(r)}),(s=l.get("*"))&&s.slice().map(function(f){f(n,r)})}}}var d=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var V={exports:{}};(function(l,n){(function(r,s){l.exports=s()})(d,function(){var r=1e3,s=6e4,f=36e5,v="millisecond",p="second",Y="minute",M="hour",S="day",F="week",y="month",C="quarter",W="year",z="date",ct="Invalid Date",$t=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ut=/\[([^\]]+)]|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,vt={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(a){var i=["th","st","nd","rd"],t=a%100;return"["+a+(i[(t-20)%10]||i[t]||i[0])+"]"}},I=function(a,i,t){var o=String(a);return!o||o.length>=i?a:""+Array(i+1-o.length).join(t)+a},Q={s:I,z:function(a){var i=-a.utcOffset(),t=Math.abs(i),o=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+I(o,2,"0")+":"+I(e,2,"0")},m:function a(i,t){if(i.date()<t.date())return-a(t,i);var o=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(o,y),c=t-e<0,h=i.clone().add(o+(c?-1:1),y);return+(-(o+(t-e)/(c?e-h:h-e))||0)},a:function(a){return a<0?Math.ceil(a)||0:Math.floor(a)},p:function(a){return{M:y,y:W,w:F,d:S,D:z,h:M,m:Y,s:p,ms:v,Q:C}[a]||String(a||"").toLowerCase().replace(/s$/,"")},u:function(a){return a===void 0}},j="en",B={};B[j]=vt;var pt=function(a){return a instanceof lt},ft=function a(i,t,o){var e;if(!i)return j;if(typeof i=="string"){var c=i.toLowerCase();B[c]&&(e=c),t&&(B[c]=t,e=c);var h=i.split("-");if(!e&&h.length>1)return a(h[0])}else{var g=i.name;B[g]=i,e=g}return!o&&e&&(j=e),e||!o&&j},T=function(a,i){if(pt(a))return a.clone();var t=typeof i=="object"?i:{};return t.date=a,t.args=arguments,new lt(t)},m=Q;m.l=ft,m.i=pt,m.w=function(a,i){return T(a,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var lt=function(){function a(t){this.$L=ft(t.locale,null,!0),this.parse(t)}var i=a.prototype;return i.parse=function(t){this.$d=function(o){var e=o.date,c=o.utc;if(e===null)return new Date(NaN);if(m.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var h=e.match($t);if(h){var g=h[2]-1||0,b=(h[7]||"0").substring(0,3);return c?new Date(Date.UTC(h[1],g,h[3]||1,h[4]||0,h[5]||0,h[6]||0,b)):new Date(h[1],g,h[3]||1,h[4]||0,h[5]||0,h[6]||0,b)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return m},i.isValid=function(){return this.$d.toString()!==ct},i.isSame=function(t,o){var e=T(t);return this.startOf(o)<=e&&e<=this.endOf(o)},i.isAfter=function(t,o){return T(t)<this.startOf(o)},i.isBefore=function(t,o){return this.endOf(o)<T(t)},i.$g=function(t,o,e){return m.u(t)?this[o]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,o){var e=this,c=!!m.u(o)||o,h=m.p(t),g=function(q,L){var N=m.w(e.$u?Date.UTC(e.$y,L,q):new Date(e.$y,L,q),e);return c?N:N.endOf(S)},b=function(q,L){return m.w(e.toDate()[q].apply(e.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(L)),e)},D=this.$W,H=this.$M,X=this.$D,k="set"+(this.$u?"UTC":"");switch(h){case W:return c?g(1,0):g(31,11);case y:return c?g(1,H):g(0,H+1);case F:var K=this.$locale().weekStart||0,tt=(D<K?D+7:D)-K;return g(c?X-tt:X+(6-tt),H);case S:case z:return b(k+"Hours",0);case M:return b(k+"Minutes",1);case Y:return b(k+"Seconds",2);case p:return b(k+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,o){var e,c=m.p(t),h="set"+(this.$u?"UTC":""),g=(e={},e[S]=h+"Date",e[z]=h+"Date",e[y]=h+"Month",e[W]=h+"FullYear",e[M]=h+"Hours",e[Y]=h+"Minutes",e[p]=h+"Seconds",e[v]=h+"Milliseconds",e)[c],b=c===S?this.$D+(o-this.$W):o;if(c===y||c===W){var D=this.clone().set(z,1);D.$d[g](b),D.init(),this.$d=D.set(z,Math.min(this.$D,D.daysInMonth())).$d}else g&&this.$d[g](b);return this.init(),this},i.set=function(t,o){return this.clone().$set(t,o)},i.get=function(t){return this[m.p(t)]()},i.add=function(t,o){var e,c=this;t=Number(t);var h=m.p(o),g=function(H){var X=T(c);return m.w(X.date(X.date()+Math.round(H*t)),c)};if(h===y)return this.set(y,this.$M+t);if(h===W)return this.set(W,this.$y+t);if(h===S)return g(1);if(h===F)return g(7);var b=(e={},e[Y]=s,e[M]=f,e[p]=r,e)[h]||1,D=this.$d.getTime()+t*b;return m.w(D,this)},i.subtract=function(t,o){return this.add(-1*t,o)},i.format=function(t){var o=this,e=this.$locale();if(!this.isValid())return e.invalidDate||ct;var c=t||"YYYY-MM-DDTHH:mm:ssZ",h=m.z(this),g=this.$H,b=this.$m,D=this.$M,H=e.weekdays,X=e.months,k=function(L,N,Mt,dt){return L&&(L[N]||L(o,c))||Mt[N].slice(0,dt)},K=function(L){return m.s(g%12||12,L,"0")},tt=e.meridiem||function(L,N,Mt){var dt=L<12?"AM":"PM";return Mt?dt.toLowerCase():dt},q={YY:String(this.$y).slice(-2),YYYY:m.s(this.$y,4,"0"),M:D+1,MM:m.s(D+1,2,"0"),MMM:k(e.monthsShort,D,X,3),MMMM:k(X,D),D:this.$D,DD:m.s(this.$D,2,"0"),d:String(this.$W),dd:k(e.weekdaysMin,this.$W,H,2),ddd:k(e.weekdaysShort,this.$W,H,3),dddd:H[this.$W],H:String(g),HH:m.s(g,2,"0"),h:K(1),hh:K(2),a:tt(g,b,!0),A:tt(g,b,!1),m:String(b),mm:m.s(b,2,"0"),s:String(this.$s),ss:m.s(this.$s,2,"0"),SSS:m.s(this.$ms,3,"0"),Z:h};return c.replace(ut,function(L,N){return N||q[L]||h.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,o,e){var c,h=m.p(o),g=T(t),b=(g.utcOffset()-this.utcOffset())*s,D=this-g,H=m.m(this,g);return H=(c={},c[W]=H/12,c[y]=H,c[C]=H/3,c[F]=(D-b)/6048e5,c[S]=(D-b)/864e5,c[M]=D/f,c[Y]=D/s,c[p]=D/r,c)[h]||D,e?H:m.a(H)},i.daysInMonth=function(){return this.endOf(y).$D},i.$locale=function(){return B[this.$L]},i.locale=function(t,o){if(!t)return this.$L;var e=this.clone(),c=ft(t,o,!0);return c&&(e.$L=c),e},i.clone=function(){return m.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},a}(),yt=lt.prototype;return T.prototype=yt,[["$ms",v],["$s",p],["$m",Y],["$H",M],["$W",S],["$M",y],["$y",W],["$D",z]].forEach(function(a){yt[a[1]]=function(i){return this.$g(i,a[0],a[1])}}),T.extend=function(a,i){return a.$i||(a(i,lt,T),a.$i=!0),T},T.locale=ft,T.isDayjs=pt,T.unix=function(a){return T(1e3*a)},T.en=B[j],T.Ls=B,T.p={},T})})(V);var Ot=V.exports;const Lt=x(Ot),gt=(l,n="MM/DD HH:mm")=>Lt(l).format(n),wt=(l,n)=>{let r,s=0;return(...f)=>{const v=Date.now(),p=v-s;!s||p>=n?(s=v,l.apply(void 0,f)):r||(r=setTimeout(()=>{s=v,l.apply(void 0,f),r=null},n-p))}},_t=(l,n)=>{const r=document.createElement("canvas");r.width=r.height=1;const s=r.getContext("2d");s.fillStyle=l,s.fillRect(0,0,1,1);const f=s.getImageData(0,0,1,1).data;return`rgba(${f[0]}, ${f[1]}, ${f[2]}, ${n})`},Et=({xCenterPoint:l,cfg:n,timePerPixel:r,timeSpacing:s,currentTime:f,$canvas:v,screenScaleCount:p,scaleHeight:Y,startTime:M,drawLine:S,drawText:F,drawArea:y})=>{const C=({space:W,scaleFormat:z,bgFormat:ct,currentFormat:$t})=>{F({x:v.width-l/10,y:6,text:gt(f,ct),fontSize:`${v.height-5}px`,align:"right",baseLine:"top",color:n.bgTextColor});const ut=M%s,vt=ut/r;for(let I=0;I<p;I++){const Q=I*n.scaleSpacing-vt-n.pointWidth/2,j=M+I*s-ut;if(j%(s*W)===0){S({x:Q,y:Y.long}),F({x:Q,y:v.height-Y.long-5,text:gt(j,z),baseLine:"bottom"});continue}S({x:Q,y:Y.short})}S({x:l-n.pointWidth/2,y:v.height,width:n.pointWidth,color:n.pointColor}),y({startX:l-50,startY:4,endX:l+50,endY:18,bgColor:n.pointColor}),F({x:l,y:6,text:gt(f,$t),align:"center",baseLine:"top"})};s<100?C({space:10,scaleFormat:"mm:ss:SSS",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss:SSS"}):s<1e3?C({space:10,scaleFormat:"mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss:SSS"}):s<1e4?C({space:10,scaleFormat:"mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss"}):s<6e4?C({space:12,scaleFormat:"HH:mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss"}):s<6e5?C({space:10,scaleFormat:"HH:mm:ss",bgFormat:"YYYY/MM/DD",currentFormat:"HH:mm:ss"}):s<36e5?C({space:12,scaleFormat:"MM/DD HH:mm",bgFormat:"YYYY/MM",currentFormat:"MM/DD HH:mm:ss"}):s<864e5?C({space:12,scaleFormat:"MM/DD HH:mm",bgFormat:"YYYY/MM",currentFormat:"YYYY/MM/DD HH:mm"}):s<6048e5?C({space:10,scaleFormat:"YYYY/MM/DD",bgFormat:"YYYY",currentFormat:"YYYY/MM/DD"}):C({space:10,scaleFormat:"YYYY/MM/DD",bgFormat:"YYYY",currentFormat:"YYYY/MM/DD"})},At={fill:!0,width:1e3,height:60,bgColor:"rgba(0,0,0,0.5)",areaBgColor:"#ffffff55",textColor:"#ffffff",scaleColor:"#ffffff",pointColor:"#00aeec",pointWidth:3,scaleSpacing:7,fps:60,zoom:3,timeSpacingList:[10,100,1e3,1e4,6e4,6e5,36e5,864e5,6048e5]};class Wt{constructor(n,r){O(this,it);O(this,st);O(this,nt);O(this,rt);O(this,at);O(this,ot);O(this,G);O(this,R);O(this,ht);et(this,"$canvas");et(this,"ctx");et(this,"$canvasParent");et(this,"cfg");O(this,J,$());O(this,_,0);O(this,P,void 0);O(this,w,void 0);O(this,U,void 0);O(this,Z,!1);if(!n)throw new Error("canvas Element Or Element ID is required!");typeof n=="string"?this.$canvas=document.querySelector(n):this.$canvas=n,this.ctx=this.$canvas.getContext("2d"),this.cfg={...At,...r};const{fill:s,width:f,height:v,zoom:p,timeSpacingList:Y,scaleHeight:M,textColor:S,bgTextColor:F}=this.cfg;if(F||(this.cfg.bgTextColor=_t(S,.18)),p<0||p>=Y.length||p%1!==0)throw new Error(`zoom must be 0 ~ ${Y.length-1}, and must be an integer`);if(s){const y=this.$canvas.parentElement;this.$canvasParent=y,this.$canvas.width=y.clientWidth,this.$canvas.height=y.clientHeight,new ResizeObserver(wt(E(this,nt,St).bind(this),200)).observe(y)}else f&&(this.$canvas.width=f),v&&(this.$canvas.height=v);A(this,w,Y[p]),M!=null&&M.long&&(M!=null&&M.short)?A(this,U,M):A(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",E(this,st,bt).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",E(this,it,xt).bind(this))}draw({currentTime:n,areas:r,_privateFlag:s}={}){if(u(this,Z)&&!s)return;A(this,_,n||Date.now()),A(this,P,r||[]);const f=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),v=f*u(this,w),p=u(this,_)-v/2,Y=u(this,_)+v/2,M=this.$canvas.width/2,S=v/this.$canvas.width;E(this,rt,Tt).call(this),E(this,R,mt).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),u(this,P).forEach(F=>{const y=F.startTime<=p?0:Math.round((F.startTime-p)/S),C=F.endTime>=Y?this.$canvas.width:Math.round((F.endTime-p)/S);y<this.$canvas.width&&C>0&&E(this,R,mt).call(this,{startX:y,startY:0,endX:C,endY:this.$canvas.height,bgColor:F.bgColor||this.cfg.areaBgColor})}),Et.bind(this)({xCenterPoint:M,screenScaleCount:f,startTime:p,timePerPixel:S,scaleHeight:u(this,U),timeSpacing:u(this,w),currentTime:u(this,_),$canvas:this.$canvas,cfg:this.cfg,drawLine:E(this,ot,Ct).bind(this),drawText:E(this,G,Dt).bind(this),drawArea:E(this,R,mt).bind(this)}),E(this,at,Ft).call(this)}getCurrentTime(){return u(this,_)}on(n,r){u(this,J).on(n,r)}off(n,r){u(this,J).off(n,r)}}return J=new WeakMap,_=new WeakMap,P=new WeakMap,w=new WeakMap,U=new WeakMap,Z=new WeakMap,it=new WeakSet,xt=function(n){A(this,Z,!0);let r=0,s=u(this,_);const f=wt(({offsetX:Y})=>{if(!u(this,Z))return;const M=Y-n.offsetX;s=Math.round(u(this,_)-u(this,w)/this.cfg.scaleSpacing*(M-r)),r=M,this.draw({currentTime:s,areas:u(this,P),_privateFlag:!0})},1e3/this.cfg.fps),v=({offsetX:Y,offsetY:M})=>{(Y<3||Y>this.$canvas.width-3||M<3||M>this.$canvas.height-3)&&(this.$canvas.removeEventListener("mousemove",f),this.$canvas.removeEventListener("mousemove",v))},p=()=>{this.$canvas.removeEventListener("mousemove",f),this.$canvas.removeEventListener("mousemove",v),document.removeEventListener("mouseup",p),A(this,Z,!1),E(this,ht,Ht).call(this,"dragged",s)};this.$canvas.addEventListener("mousemove",f),this.$canvas.addEventListener("mousemove",v),document.addEventListener("mouseup",p)},st=new WeakSet,bt=function(n){n.preventDefault();const r=this.cfg.timeSpacingList.findIndex(s=>s===u(this,w));n.deltaY<0&&r>0?(A(this,w,this.cfg.timeSpacingList[r-1]),this.draw({currentTime:u(this,_),areas:u(this,P),_privateFlag:!0})):n.deltaY>0&&r<this.cfg.timeSpacingList.length-1&&(A(this,w,this.cfg.timeSpacingList[r+1]),this.draw({currentTime:u(this,_),areas:u(this,P),_privateFlag:!0}))},nt=new WeakSet,St=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||A(this,U,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:u(this,_),areas:u(this,P)}))},rt=new WeakSet,Tt=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},at=new WeakSet,Ft=function(){const n=()=>u(this,w)<1e3?`${u(this,w)}ms`:u(this,w)<6e4?`${Math.round(u(this,w)/100)/10}sec`:u(this,w)<36e5?`${Math.round(u(this,w)/100/60)/10}min`:u(this,w)<864e5?`${Math.round(u(this,w)/100/60/60)/10}hours`:u(this,w)<6048e5?`${Math.round(u(this,w)/100/60/60/24)/10}days`:`${Math.round(u(this,w)/100/60/60/24/7)/10}weeks`;E(this,G,Dt).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:n(),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()},ot=new WeakSet,Ct=function({x:n,y:r,width:s=1,color:f=this.cfg.scaleColor}){this.ctx.beginPath(),this.ctx.moveTo(n,this.$canvas.height),this.ctx.lineTo(n,this.$canvas.height-r),this.ctx.closePath(),this.ctx.strokeStyle=f,this.ctx.lineWidth=s,this.ctx.stroke()},G=new WeakSet,Dt=function({x:n,y:r,text:s,color:f=this.cfg.textColor,fontSize:v="11px",align:p="center",baseLine:Y="alphabetic"}){this.ctx.beginPath(),this.ctx.font=`${v} Arial`,this.ctx.fillStyle=f,this.ctx.textAlign=p,this.ctx.textBaseline=Y,this.ctx.fillText(s,n,r)},R=new WeakSet,mt=function({startX:n,startY:r,endX:s,endY:f,bgColor:v}){this.ctx.beginPath(),this.ctx.rect(n,r,s-n,f-r),this.ctx.fillStyle=v,this.ctx.fill()},ht=new WeakSet,Ht=function(...n){u(this,J).emit(...n)},Wt});
(function(m,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(m=typeof globalThis<"u"?globalThis:m||self,d(m.$timeline={}))})(this,function(m){"use strict";var kt=Object.defineProperty;var At=(m,d,w)=>d in m?kt(m,d,{enumerable:!0,configurable:!0,writable:!0,value:w}):m[d]=w;var et=(m,d,w)=>(At(m,typeof d!="symbol"?d+"":d,w),w),Mt=(m,d,w)=>{if(!d.has(m))throw TypeError("Cannot "+w)};var h=(m,d,w)=>(Mt(m,d,"read from private field"),w?w.call(m):d.get(m)),H=(m,d,w)=>{if(d.has(m))throw TypeError("Cannot add the same private member more than once");d instanceof WeakSet?d.add(m):d.set(m,w)},W=(m,d,w,it)=>(Mt(m,d,"write to private field"),it?it.call(m,w):d.set(m,w),w);var B=(m,d,w)=>(Mt(m,d,"access private method"),w);var J,_,A,D,X,N,nt,wt,rt,St,at,Yt,ot,xt,ht,Ft,ct,G,R,ut,Ct;function d(f){return{all:f=f||new Map,on:function(s,n){var a=f.get(s);a?a.push(n):f.set(s,[n])},off:function(s,n){var a=f.get(s);a&&(n?a.splice(a.indexOf(n)>>>0,1):f.set(s,[]))},emit:function(s,n){var a=f.get(s);a&&a.slice().map(function(l){l(n)}),(a=f.get("*"))&&a.slice().map(function(l){l(s,n)})}}}var w=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function it(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}var Tt={exports:{}};(function(f,s){(function(n,a){f.exports=a()})(w,function(){var n=1e3,a=6e4,l=36e5,$="millisecond",p="second",T="minute",M="hour",S="day",F="week",y="month",j="quarter",O="year",z="date",lt="Invalid Date",$t=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,pt=/\[([^\]]+)]|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,ft={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(o){var i=["th","st","nd","rd"],t=o%100;return"["+o+(i[(t-20)%10]||i[t]||i[0])+"]"}},Q=function(o,i,t){var r=String(o);return!r||r.length>=i?o:""+Array(i+1-r.length).join(t)+o},q={s:Q,z:function(o){var i=-o.utcOffset(),t=Math.abs(i),r=Math.floor(t/60),e=t%60;return(i<=0?"+":"-")+Q(r,2,"0")+":"+Q(e,2,"0")},m:function o(i,t){if(i.date()<t.date())return-o(t,i);var r=12*(t.year()-i.year())+(t.month()-i.month()),e=i.clone().add(r,y),c=t-e<0,u=i.clone().add(r+(c?-1:1),y);return+(-(r+(t-e)/(c?e-u:u-e))||0)},a:function(o){return o<0?Math.ceil(o)||0:Math.floor(o)},p:function(o){return{M:y,y:O,w:F,d:S,D:z,h:M,m:T,s:p,ms:$,Q:j}[o]||String(o||"").toLowerCase().replace(/s$/,"")},u:function(o){return o===void 0}},P="en",k={};k[P]=ft;var yt="$isDayjsObject",vt=function(o){return o instanceof dt||!(!o||!o[yt])},mt=function o(i,t,r){var e;if(!i)return P;if(typeof i=="string"){var c=i.toLowerCase();k[c]&&(e=c),t&&(k[c]=t,e=c);var u=i.split("-");if(!e&&u.length>1)return o(u[0])}else{var v=i.name;k[v]=i,e=v}return!r&&e&&(P=e),e||!r&&P},Y=function(o,i){if(vt(o))return o.clone();var t=typeof i=="object"?i:{};return t.date=o,t.args=arguments,new dt(t)},g=q;g.l=mt,g.i=vt,g.w=function(o,i){return Y(o,{locale:i.$L,utc:i.$u,x:i.$x,$offset:i.$offset})};var dt=function(){function o(t){this.$L=mt(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[yt]=!0}var i=o.prototype;return i.parse=function(t){this.$d=function(r){var e=r.date,c=r.utc;if(e===null)return new Date(NaN);if(g.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var u=e.match($t);if(u){var v=u[2]-1||0,b=(u[7]||"0").substring(0,3);return c?new Date(Date.UTC(u[1],v,u[3]||1,u[4]||0,u[5]||0,u[6]||0,b)):new Date(u[1],v,u[3]||1,u[4]||0,u[5]||0,u[6]||0,b)}}return new Date(e)}(t),this.init()},i.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},i.$utils=function(){return g},i.isValid=function(){return this.$d.toString()!==lt},i.isSame=function(t,r){var e=Y(t);return this.startOf(r)<=e&&e<=this.endOf(r)},i.isAfter=function(t,r){return Y(t)<this.startOf(r)},i.isBefore=function(t,r){return this.endOf(r)<Y(t)},i.$g=function(t,r,e){return g.u(t)?this[r]:this.set(e,t)},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this.$d.getTime()},i.startOf=function(t,r){var e=this,c=!!g.u(r)||r,u=g.p(t),v=function(Z,L){var I=g.w(e.$u?Date.UTC(e.$y,L,Z):new Date(e.$y,L,Z),e);return c?I:I.endOf(S)},b=function(Z,L){return g.w(e.toDate()[Z].apply(e.toDate("s"),(c?[0,0,0,0]:[23,59,59,999]).slice(L)),e)},x=this.$W,C=this.$M,E=this.$D,V="set"+(this.$u?"UTC":"");switch(u){case O:return c?v(1,0):v(31,11);case y:return c?v(1,C):v(0,C+1);case F:var U=this.$locale().weekStart||0,K=(x<U?x+7:x)-U;return v(c?E-K:E+(6-K),C);case S:case z:return b(V+"Hours",0);case M:return b(V+"Minutes",1);case T:return b(V+"Seconds",2);case p:return b(V+"Milliseconds",3);default:return this.clone()}},i.endOf=function(t){return this.startOf(t,!1)},i.$set=function(t,r){var e,c=g.p(t),u="set"+(this.$u?"UTC":""),v=(e={},e[S]=u+"Date",e[z]=u+"Date",e[y]=u+"Month",e[O]=u+"FullYear",e[M]=u+"Hours",e[T]=u+"Minutes",e[p]=u+"Seconds",e[$]=u+"Milliseconds",e)[c],b=c===S?this.$D+(r-this.$W):r;if(c===y||c===O){var x=this.clone().set(z,1);x.$d[v](b),x.init(),this.$d=x.set(z,Math.min(this.$D,x.daysInMonth())).$d}else v&&this.$d[v](b);return this.init(),this},i.set=function(t,r){return this.clone().$set(t,r)},i.get=function(t){return this[g.p(t)]()},i.add=function(t,r){var e,c=this;t=Number(t);var u=g.p(r),v=function(C){var E=Y(c);return g.w(E.date(E.date()+Math.round(C*t)),c)};if(u===y)return this.set(y,this.$M+t);if(u===O)return this.set(O,this.$y+t);if(u===S)return v(1);if(u===F)return v(7);var b=(e={},e[T]=a,e[M]=l,e[p]=n,e)[u]||1,x=this.$d.getTime()+t*b;return g.w(x,this)},i.subtract=function(t,r){return this.add(-1*t,r)},i.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||lt;var c=t||"YYYY-MM-DDTHH:mm:ssZ",u=g.z(this),v=this.$H,b=this.$m,x=this.$M,C=e.weekdays,E=e.months,V=e.meridiem,U=function(L,I,tt,gt){return L&&(L[I]||L(r,c))||tt[I].slice(0,gt)},K=function(L){return g.s(v%12||12,L,"0")},Z=V||function(L,I,tt){var gt=L<12?"AM":"PM";return tt?gt.toLowerCase():gt};return c.replace(pt,function(L,I){return I||function(tt){switch(tt){case"YY":return String(r.$y).slice(-2);case"YYYY":return g.s(r.$y,4,"0");case"M":return x+1;case"MM":return g.s(x+1,2,"0");case"MMM":return U(e.monthsShort,x,E,3);case"MMMM":return U(E,x);case"D":return r.$D;case"DD":return g.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return U(e.weekdaysMin,r.$W,C,2);case"ddd":return U(e.weekdaysShort,r.$W,C,3);case"dddd":return C[r.$W];case"H":return String(v);case"HH":return g.s(v,2,"0");case"h":return K(1);case"hh":return K(2);case"a":return Z(v,b,!0);case"A":return Z(v,b,!1);case"m":return String(b);case"mm":return g.s(b,2,"0");case"s":return String(r.$s);case"ss":return g.s(r.$s,2,"0");case"SSS":return g.s(r.$ms,3,"0");case"Z":return u}return null}(L)||u.replace(":","")})},i.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},i.diff=function(t,r,e){var c,u=this,v=g.p(r),b=Y(t),x=(b.utcOffset()-this.utcOffset())*a,C=this-b,E=function(){return g.m(u,b)};switch(v){case O:c=E()/12;break;case y:c=E();break;case j:c=E()/3;break;case F:c=(C-x)/6048e5;break;case S:c=(C-x)/864e5;break;case M:c=C/l;break;case T:c=C/a;break;case p:c=C/n;break;default:c=C}return e?c:g.a(c)},i.daysInMonth=function(){return this.endOf(y).$D},i.$locale=function(){return k[this.$L]},i.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),c=mt(t,r,!0);return c&&(e.$L=c),e},i.clone=function(){return g.w(this.$d,this)},i.toDate=function(){return new Date(this.valueOf())},i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toISOString=function(){return this.$d.toISOString()},i.toString=function(){return this.$d.toUTCString()},o}(),bt=dt.prototype;return Y.prototype=bt,[["$ms",$],["$s",p],["$m",T],["$H",M],["$W",S],["$M",y],["$y",O],["$D",z]].forEach(function(o){bt[o[1]]=function(i){return this.$g(i,o[0],o[1])}}),Y.extend=function(o,i){return o.$i||(o(i,dt,Y),o.$i=!0),Y},Y.locale=mt,Y.isDayjs=vt,Y.unix=function(o){return Y(1e3*o)},Y.en=k[P],Y.Ls=k,Y.p={},Y})})(Tt);var Ht=Tt.exports;const Ot=it(Ht),st=(f,s="MM/DD HH:mm")=>Ot(f).format(s),Dt=(f,s)=>{let n,a=0;return(...l)=>{const $=Date.now(),p=$-a;!a||p>=s?(a=$,f.apply(void 0,l)):n||(n=setTimeout(()=>{a=$,f.apply(void 0,l),n=null},s-p))}},Lt=(f,s)=>{const n=document.createElement("canvas");n.width=n.height=1;const a=n.getContext("2d");a.fillStyle=f,a.fillRect(0,0,1,1);const l=a.getImageData(0,0,1,1).data;return`rgba(${l[0]}, ${l[1]}, ${l[2]}, ${s})`},_t=({xCenterPoint:f,cfg:s,timePerPixel:n,timeSpacing:a,currentTime:l,$canvas:$,screenScaleCount:p,scaleHeight:T,startTime:M,drawLine:S,drawText:F,drawArea:y})=>{const j=({space:z,scaleTimeFormat:lt,bgTimeFormat:$t,pointerTimeFormat:pt})=>{F({x:$.width-f/10,y:6,text:st(l,$t),fontSize:`${$.height-5}px`,align:"right",baseLine:"top",color:s.bgTextColor});const ft=M%a,Q=ft/n;for(let q=0;q<p;q++){const P=q*s.scaleSpacing-Q-s.pointerWidth/2,k=M+q*a-ft;if(k%(a*z)===0){S({x:P,y:T.long}),F({x:P,y:$.height-T.long-5,text:st(k,lt),baseLine:"bottom"});continue}S({x:P,y:T.short})}S({x:f-s.pointerWidth/2,y:$.height,width:s.pointerWidth,color:s.pointerColor}),y({startX:f-s.pointerDisplayWidth/2,startY:4,endX:f+s.pointerDisplayWidth/2,endY:4+s.pointerDisplayHeight,bgColor:s.pointerColor}),F({x:f,y:s.pointerDisplayHeight/2+5,text:st(l,pt),align:"center",baseLine:"middle"})},O=s.thresholdsConfig[a];O&&j({space:O.space,scaleTimeFormat:O.scaleTimeFormat,bgTimeFormat:O.bgTimeFormat,pointerTimeFormat:O.pointerTimeFormat})},Et={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 Wt{constructor(s,n){H(this,nt);H(this,rt);H(this,at);H(this,ot);H(this,ht);H(this,ut);et(this,"$canvas");et(this,"$canvasParent");et(this,"ctx");et(this,"cfg");H(this,J,d());H(this,_,0);H(this,A,void 0);H(this,D,void 0);H(this,X,void 0);H(this,N,!1);H(this,ct,({x:s,y:n,width:a=1,color:l=this.cfg.scaleColor})=>{this.ctx.beginPath(),this.ctx.moveTo(s,this.$canvas.height),this.ctx.lineTo(s,this.$canvas.height-n),this.ctx.closePath(),this.ctx.strokeStyle=l,this.ctx.lineWidth=a,this.ctx.stroke()});H(this,G,({x:s,y:n,text:a,color:l=this.cfg.textColor,fontSize:$="11px",align:p="center",baseLine:T="alphabetic"})=>{this.ctx.beginPath(),this.ctx.font=`${$} ${this.cfg.fontFamily}`,this.ctx.fillStyle=l,this.ctx.textAlign=p,this.ctx.textBaseline=T,this.ctx.fillText(a,s,n)});H(this,R,({startX:s,startY:n,endX:a,endY:l,bgColor:$})=>{this.ctx.beginPath(),this.ctx.rect(s,n,a-s,l-n),this.ctx.fillStyle=$,this.ctx.fill()});if(!s)throw new Error("canvas Element Or Element ID is required!");typeof s=="string"?this.$canvas=document.querySelector(s):this.$canvas=s,this.ctx=this.$canvas.getContext("2d"),this.cfg={...Et,...n},n!=null&&n.pointColor&&(this.cfg.pointerColor=n.pointColor),n!=null&&n.pointWidth&&(this.cfg.pointerWidth=n.pointWidth);const{fill:a,width:l,height:$,zoom:p,timeSpacingList:T,scaleHeight:M,textColor:S,bgTextColor:F}=this.cfg;if(F||(this.cfg.bgTextColor=Lt(S,.18)),p<0||p>=T.length||p%1!==0)throw new Error(`zoom must be 0 ~ ${T.length-1}, and must be an integer`);if(a){const y=this.$canvas.parentElement;this.$canvasParent=y,this.$canvas.width=y.clientWidth,this.$canvas.height=y.clientHeight,new ResizeObserver(Dt(B(this,at,Yt).bind(this),200)).observe(y)}else this.$canvas.width=l,this.$canvas.height=$;W(this,D,T[p]),M!=null&&M.long&&(M!=null&&M.short)?W(this,X,M):W(this,X,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw(),this.$canvas.addEventListener("wheel",B(this,rt,St).bind(this),{passive:!1}),this.$canvas.addEventListener("mousedown",B(this,nt,wt).bind(this))}draw({currentTime:s,areas:n,_privateFlag:a}={}){if(h(this,N)&&!a)return;W(this,_,s||Date.now()),W(this,A,n||[]);const l=Math.ceil(this.$canvas.width/this.cfg.scaleSpacing),$=l*h(this,D),p=h(this,_)-$/2,T=h(this,_)+$/2,M=this.$canvas.width/2,S=$/this.$canvas.width;B(this,ot,xt).call(this),h(this,R).call(this,{startX:0,startY:0,endX:this.$canvas.width,endY:this.$canvas.height,bgColor:this.cfg.bgColor}),h(this,A).forEach(F=>{const y=F.startTime<=p?0:Math.round((F.startTime-p)/S),j=F.endTime>=T?this.$canvas.width:Math.round((F.endTime-p)/S);y<this.$canvas.width&&j>0&&h(this,R).call(this,{startX:y,startY:0,endX:j,endY:this.$canvas.height,bgColor:F.bgColor||this.cfg.areaBgColor})}),_t.bind(this)({xCenterPoint:M,screenScaleCount:l,startTime:p,timePerPixel:S,scaleHeight:h(this,X),timeSpacing:h(this,D),currentTime:h(this,_),$canvas:this.$canvas,cfg:this.cfg,drawLine:h(this,ct).bind(this),drawText:h(this,G).bind(this),drawArea:h(this,R).bind(this)}),B(this,ht,Ft).call(this)}getCurrentTime(){return h(this,_)}on(s,n){h(this,J).on(s,n)}off(s,n){h(this,J).off(s,n)}}J=new WeakMap,_=new WeakMap,A=new WeakMap,D=new WeakMap,X=new WeakMap,N=new WeakMap,nt=new WeakSet,wt=function(s){W(this,N,!0);let n=0,a=h(this,_);const l=Dt(({offsetX:T})=>{if(!h(this,N))return;const M=T-s.offsetX;a=Math.round(h(this,_)-h(this,D)/this.cfg.scaleSpacing*(M-n)),n=M,this.draw({currentTime:a,areas:h(this,A),_privateFlag:!0})},1e3/this.cfg.fps),$=({offsetX:T,offsetY:M})=>{(T<3||T>this.$canvas.width-3||M<3||M>this.$canvas.height-3)&&(this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",$))},p=()=>{this.$canvas.removeEventListener("mousemove",l),this.$canvas.removeEventListener("mousemove",$),document.removeEventListener("mouseup",p),W(this,N,!1),B(this,ut,Ct).call(this,"dragged",a)};this.$canvas.addEventListener("mousemove",l),this.$canvas.addEventListener("mousemove",$),document.addEventListener("mouseup",p)},rt=new WeakSet,St=function(s){s.preventDefault();const n=this.cfg.timeSpacingList.findIndex(a=>a===h(this,D));s.deltaY<0&&n>0?(W(this,D,this.cfg.timeSpacingList[n-1]),this.draw({currentTime:h(this,_),areas:h(this,A),_privateFlag:!0})):s.deltaY>0&&n<this.cfg.timeSpacingList.length-1&&(W(this,D,this.cfg.timeSpacingList[n+1]),this.draw({currentTime:h(this,_),areas:h(this,A),_privateFlag:!0}))},at=new WeakSet,Yt=function(){this.$canvasParent&&(this.$canvas.width=this.$canvasParent.clientWidth,this.$canvas.height=this.$canvasParent.clientHeight,this.cfg.scaleHeight||W(this,X,{long:this.$canvas.height/3,medium:this.$canvas.height/6,short:this.$canvas.height/10}),this.draw({currentTime:h(this,_),areas:h(this,A)}))},ot=new WeakSet,xt=function(){this.ctx.clearRect(0,0,this.$canvas.width,this.$canvas.height)},ht=new WeakSet,Ft=function(){const s=()=>h(this,D)<1e3?`${h(this,D)}ms`:h(this,D)<6e4?`${Math.round(h(this,D)/100)/10}sec`:h(this,D)<36e5?`${Math.round(h(this,D)/100/60)/10}min`:h(this,D)<864e5?`${Math.round(h(this,D)/100/60/60)/10}hours`:h(this,D)<6048e5?`${Math.round(h(this,D)/100/60/60/24)/10}days`:`${Math.round(h(this,D)/100/60/60/24/7)/10}weeks`;h(this,G).call(this,{x:this.cfg.scaleSpacing+12,y:9,text:s(),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()},ct=new WeakMap,G=new WeakMap,R=new WeakMap,ut=new WeakSet,Ct=function(...s){h(this,J).emit(...s)},m.default=Wt,m.format=st,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
{
"name": "@losting/timeline",
"version": "3.0.3",
"version": "4.0.0",
"description": "Canvas timeline supports zooming, dragging, infinite scrolling, and custom control levels.",
"type": "module",
"main": "./dist/timeline.iife.js",
"main": "./dist/timeline.umd.js",
"module": "./dist/timeline.es.js",
"types": "./types/timeline.d.ts",
"types": "./index.d.ts",
"exports": {
".": {
"import": "./dist/timeline.es.js",
"require": "./dist/timeline.umd.js",
"types": "./index.d.ts"
}
},
"scripts": {

@@ -16,8 +23,7 @@ "dev": "vite",

"files": [
"dist",
"index.d.ts",
"LICENSE",
"dist",
"types/timeline.d.ts",
"README.md",
"example/demo.png",
"index.html"
"example/demo.png"
],

@@ -43,8 +49,8 @@ "keywords": [

"devDependencies": {
"dayjs": "^1.11.8",
"mitt": "^3.0.0",
"release-it": "^15.11.0",
"typescript": "^5.1.3",
"vite": "^4.3.9"
"dayjs": "^1.11.11",
"mitt": "^3.0.1",
"release-it": "^17.2.1",
"typescript": "^5.4.5",
"vite": "^5.1.6"
}
}

@@ -5,3 +5,3 @@ 简体中文 | [English](./README_EN.md)

![预览图](./example/demo.png)
[演示地址](https://thelostword.github.io/timeline/)
<a href="https://thelostword.github.io/timeline/" target="_blank">演示地址</a>

@@ -75,7 +75,10 @@ ## 如何使用

| textColor | string | 否 | #ffffff | 文字颜色 |
| fontFamily | string | 否 | Arial | 字体 |
| scaleColor | string | 否 | #ffffff | 刻度颜色 |
| scaleSpacing | number | 否 | 7 | 刻度间距 |
| areaBgColor | string | 否 | #ffffff55 | 阴影区域背景颜色 |
| pointColor | string | 否 | #00aeec | 当前时间指针颜色 |
| pointWidth | number | 否 | 3 | 当前时间指针宽度 |
| pointerColor | string | 否 | #00aeec | 当前时间指针颜色 |
| pointerWidth | number | 否 | 3 | 当前时间指针宽度 |
| pointerDisplayWidth | number | 否 | 100 | 当前时间显示区域宽度 |
| pointerDisplayHeight | number | 否 | 14 | 当前时间显示区域高度 |
| fps | number | 否 | 60 | 帧数 |

@@ -85,5 +88,4 @@ | zoom | integer | 否 | 3 | 初始缩放值,`0` ~ `timeSpacingList.length - 1` 之间(包含)的正整数。 对应 `timeSpacingList` 的索引值 |

| scaleHeight | object | 否 | `{ long: this.$canvas.height / 3, short: this.$canvas.height / 10 }` | 刻度高度,如果设置此项,则long、short必填 |
| ~~maxZoom~~ | - | - | - | 已移除,设置 `timeSpacingList` 替代 |
| ~~minZoom~~ | - | - | - | 已移除,设置 `timeSpacingList` 替代 |
| ~~timeFormat~~ | - | - | - | 已移除
| bgTextColor | string | 否 | rgba(`textColor`, .18) | 背景文字的颜色 |
| thresholdsConfig | Object | 否 | [见默认配置文件](./src/config.ts) | 对应缩放阈值的配置, 当 `timeSpacingList` 配置时,该选项必填 |

@@ -114,35 +116,2 @@ ### Events

## 版本升级 v2.X -> v3.X
``` html
<canvas id="Timeline"></canvas>
<script>
// -------- v2 -----------
const timeline = new Timeline('Timeline', {
fill: false,
width: 1000,
height: 60,
});
timeline.on('timeUpdate', (timestamp) => {
// ...
})
// ---------> v3 --------------
const timeline = new Timeline('#Timeline', {
// ...
// 注意这里时间戳由秒全部变为毫秒
});
// OR
const timeline = new Timeline(document.querySelector('#Timeline'), {
// ...
});
timeline.on('dragged', (timestamp) => {
// ...
})
</script>
```
> 其他变更请参考上述文档
## License

@@ -149,0 +118,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc