tsviewer 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BFButton-V2zgKAQA.mjs +72 -0
- package/dist/IconSelection-BGj1-2Pf.mjs +37 -0
- package/dist/TSAnnotationCanvas-DS-_o3gh.mjs +732 -0
- package/dist/TSAnnotationModal-BKwEWORY.mjs +4429 -0
- package/dist/TSFilterModal-DjKgP7Y2.mjs +238 -0
- package/dist/TSScrubber-BZo4SyGm.mjs +380 -0
- package/dist/TSViewerCanvas-CeGKq-zQ.mjs +5737 -0
- package/dist/TSViewerLayerWindow-laXtlKCp.mjs +262 -0
- package/dist/TSViewerToolbar-CQ4uNXil.mjs +555 -0
- package/dist/TsAnnotationDeleteDialog-CoPkyAmW.mjs +249 -0
- package/dist/_commonjsHelpers-DaMA6jEr.mjs +8 -0
- package/dist/base-CIy5gWpu.mjs +1413 -0
- package/dist/el-button-B2d_HO4x.mjs +769 -0
- package/dist/el-input-DNjlHApm.mjs +4667 -0
- package/dist/el-input-number-CAzspsnM.mjs +265 -0
- package/dist/el-overlay-_Fd7WVZL.mjs +517 -0
- package/dist/index-BtnXpu3W.mjs +902 -0
- package/dist/index-ClxLs_jS.mjs +22 -0
- package/dist/pathOr-DE7WGRqe.mjs +18 -0
- package/dist/request_composable-DV-ftNZG.mjs +212 -0
- package/dist/tsviewer.css +1 -1
- package/dist/tsviewer.es.js +4 -20932
- package/dist/tsviewer.umd.js +17 -17
- package/dist/useToken-CJWB6KGF.mjs +16 -0
- package/package.json +2 -2
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import "./base-CIy5gWpu.mjs";
|
|
2
|
+
import { E as F } from "./el-overlay-_Fd7WVZL.mjs";
|
|
3
|
+
import { I as g } from "./IconSelection-BGj1-2Pf.mjs";
|
|
4
|
+
import { a as y, b as k } from "./el-input-DNjlHApm.mjs";
|
|
5
|
+
import { E as S } from "./el-input-number-CAzspsnM.mjs";
|
|
6
|
+
import { resolveComponent as P, createBlock as u, openBlock as o, withCtx as i, createElementVNode as s, createVNode as r, createElementBlock as a, toDisplayString as c, createTextVNode as d, createCommentVNode as p, Fragment as _, renderList as v } from "vue";
|
|
7
|
+
import { e as N } from "./index-BtnXpu3W.mjs";
|
|
8
|
+
const H = {
|
|
9
|
+
name: "TimeseriesFilterModal",
|
|
10
|
+
components: {
|
|
11
|
+
"bf-button": () => import("./BFButton-V2zgKAQA.mjs"),
|
|
12
|
+
IconSelection: g
|
|
13
|
+
},
|
|
14
|
+
mixins: [],
|
|
15
|
+
watch: {},
|
|
16
|
+
computed: {
|
|
17
|
+
computeVisible0: function() {
|
|
18
|
+
switch (this.selectedFilter) {
|
|
19
|
+
case "lowpass":
|
|
20
|
+
return !0;
|
|
21
|
+
case "highpass":
|
|
22
|
+
return !0;
|
|
23
|
+
case "bandpass":
|
|
24
|
+
return !0;
|
|
25
|
+
default:
|
|
26
|
+
return !1;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
onSingleChannel: function() {
|
|
30
|
+
return this.onChannels.length == 1;
|
|
31
|
+
},
|
|
32
|
+
selectedChannels: function() {
|
|
33
|
+
return this.onChannels.length;
|
|
34
|
+
},
|
|
35
|
+
computeVisible1: function() {
|
|
36
|
+
switch (this.selectedFilter) {
|
|
37
|
+
case "lowpass":
|
|
38
|
+
return !1;
|
|
39
|
+
case "highpass":
|
|
40
|
+
return !1;
|
|
41
|
+
case "bandpass":
|
|
42
|
+
return !0;
|
|
43
|
+
default:
|
|
44
|
+
return !1;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
computeVisible2: function() {
|
|
48
|
+
switch (this.selectedFilter) {
|
|
49
|
+
case "bandstop":
|
|
50
|
+
return !0;
|
|
51
|
+
default:
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
computePlaceholder1: function(t) {
|
|
56
|
+
switch (this.selectedFilter) {
|
|
57
|
+
case "lowpass":
|
|
58
|
+
return "Low Pass Cutoff Frequency (Hz)";
|
|
59
|
+
case "highpass":
|
|
60
|
+
return "High Pass Cutoff Frequency (Hz)";
|
|
61
|
+
case "bandpass":
|
|
62
|
+
return "Low Pass Cutoff Frequency (Hz)";
|
|
63
|
+
default:
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
computePlaceholder2: function(t) {
|
|
68
|
+
switch (this.selectedFilter) {
|
|
69
|
+
case "bandpass":
|
|
70
|
+
return "High Pass Cutoff Frequency (Hz)";
|
|
71
|
+
default:
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
props: {
|
|
77
|
+
visible: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: !1
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
data: function() {
|
|
83
|
+
return {
|
|
84
|
+
selectedFilter: null,
|
|
85
|
+
filterOptions: [
|
|
86
|
+
{
|
|
87
|
+
label: "No Filter",
|
|
88
|
+
value: "clear"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
label: "Low Pass",
|
|
92
|
+
value: "lowpass"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
label: "High Pass",
|
|
96
|
+
value: "highpass"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: "Band Pass",
|
|
100
|
+
value: "bandpass"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: "Notch",
|
|
104
|
+
value: "bandstop"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
selectedNotch: null,
|
|
108
|
+
notchOptions: [
|
|
109
|
+
{
|
|
110
|
+
label: "50Hz",
|
|
111
|
+
value: 50
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
label: "60Hz",
|
|
115
|
+
value: 60
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
input0: null,
|
|
119
|
+
input1: null,
|
|
120
|
+
onChannels: []
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
methods: {
|
|
124
|
+
close: function() {
|
|
125
|
+
this.$emit("closeWindow");
|
|
126
|
+
},
|
|
127
|
+
handleChange: function() {
|
|
128
|
+
},
|
|
129
|
+
onButtonClick: function() {
|
|
130
|
+
},
|
|
131
|
+
submitForm: function(t) {
|
|
132
|
+
this.$emit("closeWindow");
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, E = { slot: "body" }, I = { class: "select-wrapper" }, z = {
|
|
136
|
+
key: 0,
|
|
137
|
+
class: "filter-input-wrapper"
|
|
138
|
+
}, B = {
|
|
139
|
+
key: 1,
|
|
140
|
+
class: "filter-input-wrapper"
|
|
141
|
+
}, O = { slot: "footer" }, U = { class: "button-wrapper" }, q = { class: "channels-selected" }, L = { key: 0 }, T = { key: 1 }, A = { class: "buttons" };
|
|
142
|
+
function D(t, l, h, M, W, n) {
|
|
143
|
+
const m = k, f = y, b = S, C = g, V = P("bf-button"), w = F;
|
|
144
|
+
return o(), u(w, {
|
|
145
|
+
class: "timeseries-filter-modal",
|
|
146
|
+
ref: "filter-modal",
|
|
147
|
+
title: "Set Filter",
|
|
148
|
+
modelValue: h.visible,
|
|
149
|
+
"onUpdate:modelValue": l[4] || (l[4] = (e) => h.visible = e),
|
|
150
|
+
onClose: n.close
|
|
151
|
+
}, {
|
|
152
|
+
default: i(() => [
|
|
153
|
+
s("div", E, [
|
|
154
|
+
s("div", I, [
|
|
155
|
+
r(f, {
|
|
156
|
+
modelValue: t.selectedFilter,
|
|
157
|
+
"onUpdate:modelValue": l[0] || (l[0] = (e) => t.selectedFilter = e),
|
|
158
|
+
placeholder: "Select"
|
|
159
|
+
}, {
|
|
160
|
+
default: i(() => [
|
|
161
|
+
(o(!0), a(_, null, v(t.filterOptions, (e) => (o(), u(m, {
|
|
162
|
+
key: e.value,
|
|
163
|
+
label: e.label,
|
|
164
|
+
value: e.value
|
|
165
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["modelValue"]),
|
|
169
|
+
n.computeVisible0 ? (o(), a("div", z, [
|
|
170
|
+
d(c(n.computePlaceholder1) + " ", 1),
|
|
171
|
+
r(b, {
|
|
172
|
+
class: "filterInput",
|
|
173
|
+
modelValue: t.input0,
|
|
174
|
+
"onUpdate:modelValue": l[1] || (l[1] = (e) => t.input0 = e),
|
|
175
|
+
"controls-position": "right",
|
|
176
|
+
precision: 2,
|
|
177
|
+
onChange: n.handleChange
|
|
178
|
+
}, null, 8, ["modelValue", "onChange"])
|
|
179
|
+
])) : p("", !0),
|
|
180
|
+
n.computeVisible1 ? (o(), a("div", B, [
|
|
181
|
+
d(c(n.computePlaceholder2) + " ", 1),
|
|
182
|
+
r(b, {
|
|
183
|
+
class: "filterInput",
|
|
184
|
+
modelValue: t.input1,
|
|
185
|
+
"onUpdate:modelValue": l[2] || (l[2] = (e) => t.input1 = e),
|
|
186
|
+
"controls-position": "right",
|
|
187
|
+
precision: 2,
|
|
188
|
+
onChange: n.handleChange
|
|
189
|
+
}, null, 8, ["modelValue", "onChange"])
|
|
190
|
+
])) : p("", !0),
|
|
191
|
+
n.computeVisible2 ? (o(), u(f, {
|
|
192
|
+
key: 2,
|
|
193
|
+
modelValue: t.selectedNotch,
|
|
194
|
+
"onUpdate:modelValue": l[3] || (l[3] = (e) => t.selectedNotch = e),
|
|
195
|
+
placeholder: "Select",
|
|
196
|
+
class: "filter-input-wrapper"
|
|
197
|
+
}, {
|
|
198
|
+
default: i(() => [
|
|
199
|
+
(o(!0), a(_, null, v(t.notchOptions, (e) => (o(), u(m, {
|
|
200
|
+
key: e.value,
|
|
201
|
+
label: e.label,
|
|
202
|
+
value: e.value
|
|
203
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
204
|
+
]),
|
|
205
|
+
_: 1
|
|
206
|
+
}, 8, ["modelValue"])) : p("", !0)
|
|
207
|
+
])
|
|
208
|
+
])
|
|
209
|
+
]),
|
|
210
|
+
footer: i(() => [
|
|
211
|
+
s("div", O, [
|
|
212
|
+
s("div", U, [
|
|
213
|
+
s("div", q, [
|
|
214
|
+
r(C, {
|
|
215
|
+
height: 24,
|
|
216
|
+
width: 24
|
|
217
|
+
}),
|
|
218
|
+
n.onSingleChannel ? (o(), a("div", L, " Adding to single channel ")) : (o(), a("div", T, " Adding to " + c(n.selectedChannels) + " Selected Channels ", 1))
|
|
219
|
+
]),
|
|
220
|
+
s("div", A, [
|
|
221
|
+
r(V, { onClick: n.submitForm }, {
|
|
222
|
+
default: i(() => l[5] || (l[5] = [
|
|
223
|
+
d("Set Filter ")
|
|
224
|
+
])),
|
|
225
|
+
_: 1,
|
|
226
|
+
__: [5]
|
|
227
|
+
}, 8, ["onClick"])
|
|
228
|
+
])
|
|
229
|
+
])
|
|
230
|
+
])
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}, 8, ["modelValue", "onClose"]);
|
|
234
|
+
}
|
|
235
|
+
const Y = /* @__PURE__ */ N(H, [["render", D], ["__scopeId", "data-v-99d3adec"]]);
|
|
236
|
+
export {
|
|
237
|
+
Y as default
|
|
238
|
+
};
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { ref as u, computed as N, watch as U, nextTick as E, onMounted as Ne, createElementBlock as Ie, openBlock as $e, createElementVNode as x, toDisplayString as K, normalizeStyle as Q } from "vue";
|
|
2
|
+
import { _ as ve, a as Y, b as Ue, c as ge, d as Ve, k as Oe, e as Le, u as Xe } from "./index-BtnXpu3W.mjs";
|
|
3
|
+
import { u as de } from "./useToken-CJWB6KGF.mjs";
|
|
4
|
+
import { _ as me, a as je, u as fe, b as he } from "./request_composable-DV-ftNZG.mjs";
|
|
5
|
+
function Se(g, c, l) {
|
|
6
|
+
return function() {
|
|
7
|
+
for (var t = [], p = 0, v = g, k = 0; k < c.length || p < arguments.length; ) {
|
|
8
|
+
var W;
|
|
9
|
+
k < c.length && (!ve(c[k]) || p >= arguments.length) ? W = c[k] : (W = arguments[p], p += 1), t[k] = W, ve(W) || (v -= 1), k += 1;
|
|
10
|
+
}
|
|
11
|
+
return v <= 0 ? l.apply(this, t) : me(v, Se(g, t, l));
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
var ze = /* @__PURE__ */ Y(function(c, l) {
|
|
15
|
+
return c === 1 ? Ue(l) : me(c, Se(c, [], l));
|
|
16
|
+
});
|
|
17
|
+
function Be(g, c) {
|
|
18
|
+
for (var l = 0, t = c.length, p = Array(t); l < t; )
|
|
19
|
+
p[l] = g(c[l]), l += 1;
|
|
20
|
+
return p;
|
|
21
|
+
}
|
|
22
|
+
var He = /* @__PURE__ */ function() {
|
|
23
|
+
function g(c, l) {
|
|
24
|
+
this.xf = l, this.f = c;
|
|
25
|
+
}
|
|
26
|
+
return g.prototype["@@transducer/init"] = ge.init, g.prototype["@@transducer/result"] = ge.result, g.prototype["@@transducer/step"] = function(c, l) {
|
|
27
|
+
return this.xf["@@transducer/step"](c, this.f(l));
|
|
28
|
+
}, g;
|
|
29
|
+
}(), qe = /* @__PURE__ */ Y(function(c, l) {
|
|
30
|
+
return new He(c, l);
|
|
31
|
+
}), Fe = /* @__PURE__ */ Y(
|
|
32
|
+
/* @__PURE__ */ Ve(["fantasy-land/map", "map"], qe, function(c, l) {
|
|
33
|
+
switch (Object.prototype.toString.call(l)) {
|
|
34
|
+
case "[object Function]":
|
|
35
|
+
return ze(l.length, function() {
|
|
36
|
+
return c.call(this, l.apply(this, arguments));
|
|
37
|
+
});
|
|
38
|
+
case "[object Object]":
|
|
39
|
+
return je(function(t, p) {
|
|
40
|
+
return t[p] = c(l[p]), t;
|
|
41
|
+
}, {}, Oe(l));
|
|
42
|
+
default:
|
|
43
|
+
return Be(c, l);
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
const Ge = { class: "timeseries-scrubber" }, Je = { class: "dateWrap" }, Ke = { class: "noselect" }, Qe = {
|
|
48
|
+
id: "scrubber",
|
|
49
|
+
noselect: ""
|
|
50
|
+
}, Ye = ["width", "height"], Ze = ["width", "height"], et = ["width", "height"], tt = {
|
|
51
|
+
__name: "TSScrubber",
|
|
52
|
+
props: {
|
|
53
|
+
ts_start: Number,
|
|
54
|
+
ts_end: Number,
|
|
55
|
+
cWidth: Number,
|
|
56
|
+
constants: Object,
|
|
57
|
+
start: Number,
|
|
58
|
+
duration: Number,
|
|
59
|
+
cursorLoc: Number,
|
|
60
|
+
labelWidth: Number,
|
|
61
|
+
config: Object,
|
|
62
|
+
activeViewer: Object
|
|
63
|
+
},
|
|
64
|
+
emits: ["setStart"],
|
|
65
|
+
setup(g, { expose: c, emit: l }) {
|
|
66
|
+
const t = g, p = l, v = Xe(), k = u(null), W = u(null), H = u(null), T = u(null), f = u(1), Z = u(28), C = u(30), V = u(!1), I = u(""), O = u("point"), ee = u(null), D = u([]), w = u([]), y = u([]), L = u(!1), te = u(0), ne = u(0), R = u(0), X = u(0), pe = N(() => oe(t.ts_start)), be = N(() => oe(t.ts_end)), _e = N(() => {
|
|
67
|
+
if (I.value !== "")
|
|
68
|
+
return I.value;
|
|
69
|
+
if (t.start > 0) {
|
|
70
|
+
const n = new Date(t.start / 1e3).toUTCString();
|
|
71
|
+
return n.substring(0, n.length - 3);
|
|
72
|
+
}
|
|
73
|
+
return "";
|
|
74
|
+
}), ae = N(() => ({
|
|
75
|
+
width: t.labelWidth + t.cWidth - 8 + 5 + "px",
|
|
76
|
+
height: "28px"
|
|
77
|
+
})), we = N(() => ({
|
|
78
|
+
width: t.labelWidth + t.cWidth - 8 + 5 + "px",
|
|
79
|
+
height: "30px"
|
|
80
|
+
})), Te = N(() => t.cWidth + t.labelWidth - 8 + 5), Ce = N(() => Math.floor((t.ts_end - t.ts_start) / t.cWidth));
|
|
81
|
+
U(() => t.start, () => {
|
|
82
|
+
A();
|
|
83
|
+
}), U(() => t.duration, () => {
|
|
84
|
+
A();
|
|
85
|
+
}), U(() => t.cWidth, () => {
|
|
86
|
+
A();
|
|
87
|
+
}), U(() => t.activeViewer, (n, e) => {
|
|
88
|
+
var a;
|
|
89
|
+
n && n !== e && (console.log("TSScrubber: ActiveViewer changed, resetting component state"), L.value = !0, se(), (a = n.content) != null && a.id ? E(() => {
|
|
90
|
+
B(), L.value = !1;
|
|
91
|
+
}) : L.value = !1);
|
|
92
|
+
}, { deep: !0 }), U(() => v.viewerChannels, (n, e) => {
|
|
93
|
+
var a, s;
|
|
94
|
+
n && n.length > 0 && !L.value && (!e || n.length !== e.length || ((a = n[0]) == null ? void 0 : a.id) !== ((s = e[0]) == null ? void 0 : s.id)) && (console.log("TSScrubber: Viewer channels changed, re-initializing segments"), z(), E(() => {
|
|
95
|
+
ie();
|
|
96
|
+
}));
|
|
97
|
+
}, { deep: !0 }), U(() => v.viewerAnnotations, (n, e) => {
|
|
98
|
+
var a, s;
|
|
99
|
+
n && n !== e && !L.value ? (console.log("TSScrubber: Viewer annotations changed independently, re-fetching annotations"), E(() => {
|
|
100
|
+
B();
|
|
101
|
+
})) : n && n.length > 0 && !e && ((s = (a = t.activeViewer) == null ? void 0 : a.content) != null && s.id) && (console.log("TSScrubber: Annotation layers now available, fetching annotations"), E(() => {
|
|
102
|
+
B();
|
|
103
|
+
}));
|
|
104
|
+
}, { deep: !0 });
|
|
105
|
+
const se = () => {
|
|
106
|
+
console.log("TSScrubber: Resetting component state"), D.value = [], z(), V.value = !1, I.value = "", O.value = "point", re();
|
|
107
|
+
}, z = () => {
|
|
108
|
+
console.log("TSScrubber: Resetting segment state"), y.value = new Array(5e3), y.value = y.value.fill(0, 0, 4999), w.value = [];
|
|
109
|
+
}, re = () => {
|
|
110
|
+
E(() => {
|
|
111
|
+
[W.value, H.value, T.value].forEach((e) => {
|
|
112
|
+
if (e) {
|
|
113
|
+
const a = e.getContext("2d");
|
|
114
|
+
a && a.clearRect(0, 0, e.width, e.height);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}, $ = (n, e, a) => e * (n + a), ye = () => {
|
|
119
|
+
const n = T.value.getContext("2d"), e = window.devicePixelRatio || 1, a = n.webkitBackingStorePixelRatio || n.mozBackingStorePixelRatio || n.msBackingStorePixelRatio || n.oBackingStorePixelRatio || n.backingStorePixelRatio || 1;
|
|
120
|
+
return e / a;
|
|
121
|
+
}, oe = (n) => {
|
|
122
|
+
if (n > 0)
|
|
123
|
+
return n = n / 1e3, n = new Date(n), ("0" + n.getUTCHours()).slice(-2) + ":" + ("0" + n.getUTCMinutes()).slice(-2) + ":" + ("0" + n.getUTCSeconds()).slice(-2);
|
|
124
|
+
}, xe = (n) => {
|
|
125
|
+
if (V.value) {
|
|
126
|
+
const a = (n.clientX - te.value) / t.cWidth * (t.ts_end - t.ts_start), s = ne.value + a;
|
|
127
|
+
p("setStart", s);
|
|
128
|
+
const r = new Date((a + t.ts_start) / 1e3);
|
|
129
|
+
I.value = r.toUTCString();
|
|
130
|
+
} else {
|
|
131
|
+
const e = T.value.getBoundingClientRect(), a = n.clientX - e.left, s = R.value + X.value, r = O.value;
|
|
132
|
+
a > R.value - 10 && a < s + 10 ? (O.value = "drag", T.value.setAttribute("dragme", !0), T.value.removeAttribute("resizeme")) : (O.value = "point", T.value.removeAttribute("dragme"), T.value.removeAttribute("resizeme"));
|
|
133
|
+
const o = a / t.cWidth * (t.ts_end - t.ts_start) + t.ts_start, m = new Date(o / 1e3).toUTCString();
|
|
134
|
+
I.value = m.substring(0, m.length - 3), r !== O.value && A();
|
|
135
|
+
}
|
|
136
|
+
}, ke = () => {
|
|
137
|
+
V.value = !1;
|
|
138
|
+
}, We = (n) => {
|
|
139
|
+
V.value = !0;
|
|
140
|
+
const e = T.value.getBoundingClientRect(), a = n.clientX - e.left;
|
|
141
|
+
te.value = n.clientX;
|
|
142
|
+
const s = a / Te.value * (t.ts_end - t.ts_start);
|
|
143
|
+
p("setStart", s + t.ts_start), ne.value = s + t.ts_start;
|
|
144
|
+
}, Re = () => {
|
|
145
|
+
V.value = !1;
|
|
146
|
+
}, Ae = () => {
|
|
147
|
+
I.value = "";
|
|
148
|
+
}, ie = () => {
|
|
149
|
+
var a;
|
|
150
|
+
if (!v.viewerChannels || v.viewerChannels.length === 0) {
|
|
151
|
+
console.warn("TSScrubber: Cannot init segment spans - no viewer channels available");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!t.ts_start || !t.ts_end) {
|
|
155
|
+
console.warn("TSScrubber: Cannot init segment spans - invalid time range");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!((a = t.config) != null && a.timeSeriesApi)) {
|
|
159
|
+
console.warn("TSScrubber: Cannot init segment spans - no timeSeriesApi configured");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
console.log(`TSScrubber: Initializing segment spans for ${v.viewerChannels.length} channels`), z();
|
|
163
|
+
const n = Math.min(t.constants.SEGMENTSPAN, t.ts_end - t.ts_start), e = v.viewerChannels;
|
|
164
|
+
for (let s = 0; s < e.length; s++)
|
|
165
|
+
le(e[s].id, s, t.ts_start, t.ts_start + n, 0);
|
|
166
|
+
}, le = async (n, e, a, s, r) => {
|
|
167
|
+
var o;
|
|
168
|
+
const i = t.constants.MAXRECURSION;
|
|
169
|
+
if (!((o = t.config) != null && o.timeSeriesApi)) {
|
|
170
|
+
console.warn("TSScrubber: Cannot request segment span - no timeSeriesApi configured");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!n) {
|
|
174
|
+
console.warn("TSScrubber: Cannot request segment span - no channel ID provided");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const m = await de(), _ = `${t.config.timeSeriesApi}/ts/retrieve/segments?session=${m}&channel=${n}&start=${a}&end=${s}`;
|
|
179
|
+
console.log(`TSScrubber: Fetching segments for channel ${n} (${e})`);
|
|
180
|
+
const b = await fe(_);
|
|
181
|
+
if (!v.viewerChannels[e] || v.viewerChannels[e].id !== n) {
|
|
182
|
+
console.warn("TSScrubber: Channel mismatch detected, ignoring segment response (likely package switched)");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
let h = new Array(b.length * 2), d = 0;
|
|
186
|
+
for (let M = 0; M < b.length; M++) {
|
|
187
|
+
h[d] = b[M][0], h[d + 1] = b[M][1], d = d + 2;
|
|
188
|
+
const J = Math.floor((b[M][0] - t.ts_start) / (t.ts_end - t.ts_start) * 5e3), De = Math.ceil((b[M][1] - t.ts_start) / (t.ts_end - t.ts_start) * 5e3);
|
|
189
|
+
y.value.fill(1, J, De);
|
|
190
|
+
}
|
|
191
|
+
let S = 0, j = !1, G = 0;
|
|
192
|
+
for (w.value = []; S < y.value.length - 1; ) {
|
|
193
|
+
if (!y.value[S] && !j) {
|
|
194
|
+
S++;
|
|
195
|
+
continue;
|
|
196
|
+
} else y.value[S] ? j || (G = S, j = !0) : (w.value = w.value.concat([G, S]), j = !1);
|
|
197
|
+
S++;
|
|
198
|
+
}
|
|
199
|
+
j && (w.value = w.value.concat([G, S])), w.value = w.value.concat([5e3]);
|
|
200
|
+
let Ee = h[0], P = v.viewerChannels[e];
|
|
201
|
+
if (!P || P.id !== n) {
|
|
202
|
+
console.warn("TSScrubber: Channel configuration mismatch, skipping update");
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
Ee < P.dataSegments[P.dataSegments.length - 1] && (h.shift(), h.shift()), P.dataSegments = P.dataSegments.concat(h.sort((M, J) => M - J)), v.updateChannelProperty(P.id, "dataSegments", P.dataSegments);
|
|
206
|
+
let ue = s - a;
|
|
207
|
+
a + ue < t.ts_end && r < i ? le(n, e, s, s + ue, r + 1) : F();
|
|
208
|
+
} catch (m) {
|
|
209
|
+
console.error(`TSScrubber: Error fetching segments for channel ${n}:`, m), he(m);
|
|
210
|
+
}
|
|
211
|
+
}, B = async () => {
|
|
212
|
+
var e, a, s, r, i;
|
|
213
|
+
const n = (a = (e = t.activeViewer) == null ? void 0 : e.content) == null ? void 0 : a.id;
|
|
214
|
+
if (!n) {
|
|
215
|
+
console.warn("TSScrubber: Cannot get annotations - no active viewer ID"), D.value = [];
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (!((s = t.config) != null && s.apiUrl)) {
|
|
219
|
+
console.warn("TSScrubber: Cannot get annotations - no API URL configured"), D.value = [];
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (!v.viewerAnnotations || v.viewerAnnotations.length === 0) {
|
|
223
|
+
console.log("TSScrubber: No annotation layers available, skipping annotation fetch"), D.value = [], A();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
try {
|
|
227
|
+
const o = await de(), m = Fe((S) => S.id, v.viewerAnnotations), _ = t.ts_end;
|
|
228
|
+
let h = `${t.config.apiUrl}/timeseries/${n}/annotations/window` + `?api_key=${o}&aggregation=count&start=${t.ts_start}&end=${t.ts_end}&period=${Ce.value}&mergePeriods=true`;
|
|
229
|
+
for (let S in m)
|
|
230
|
+
h = h + `&layerIds=${m[S]}`;
|
|
231
|
+
console.log(`TSScrubber: Fetching annotations for viewer ${n}`);
|
|
232
|
+
const d = await fe(h);
|
|
233
|
+
((i = (r = t.activeViewer) == null ? void 0 : r.content) == null ? void 0 : i.id) === n ? (D.value = d, A()) : console.log("TSScrubber: Ignoring annotation response - viewer changed during fetch");
|
|
234
|
+
} catch (o) {
|
|
235
|
+
console.error("TSScrubber: Error fetching annotations:", o), D.value = [], he(o), A();
|
|
236
|
+
}
|
|
237
|
+
}, A = () => {
|
|
238
|
+
q(), ce(), F();
|
|
239
|
+
}, q = () => {
|
|
240
|
+
E(() => {
|
|
241
|
+
const n = T.value;
|
|
242
|
+
if (!n) {
|
|
243
|
+
console.warn("iCanvas ref is missing, skipping render");
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const e = n.getContext("2d");
|
|
247
|
+
if (!e) {
|
|
248
|
+
console.warn("2D context is not available");
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
e.setTransform(f.value, 0, 0, f.value, 0, 0), e.clearRect(0, 0, t.cWidth, C.value), R.value = (t.start - t.ts_start) / (t.ts_end - t.ts_start) * t.cWidth + 0.5 | 0, X.value = t.duration / (t.ts_end - t.ts_start) * t.cWidth + 0.5 | 0, e.fillStyle = "rgb(80,80,80)", e.strokeStyle = "rgb(80,80,80)", e.strokeRect(R.value + 0.5, 0.5, X.value, C.value - 1), e.fillRect(R.value - 2, C.value / 2 - 5 | 0, 2, 10), e.fillRect(R.value + X.value + 1, C.value / 2 - 5 | 0, 2, 10);
|
|
252
|
+
const a = R.value + t.cursorLoc * X.value;
|
|
253
|
+
a > R.value + 0.5 && (e.strokeStyle = "red", e.beginPath(), e.moveTo(a, 0), e.lineTo(a, C.value - 1), e.stroke());
|
|
254
|
+
});
|
|
255
|
+
}, F = () => {
|
|
256
|
+
E(() => {
|
|
257
|
+
const n = W.value;
|
|
258
|
+
if (!n) {
|
|
259
|
+
console.warn("segmentsCanvas ref is missing, skipping renderSegments");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const e = n.getContext("2d");
|
|
263
|
+
if (!e) {
|
|
264
|
+
console.warn("Unable to get 2D context for segmentsCanvas, skipping renderSegments");
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
e.setTransform(f.value, 0, 0, f.value, 0, 0), e.fillStyle = e.createPattern(ee.value, "repeat"), e.clearRect(0, 0, t.cWidth, C.value);
|
|
268
|
+
for (let a = 1; a < w.value.length; a += 2) {
|
|
269
|
+
const s = t.cWidth * w.value[a] / 5e3, r = t.cWidth * w.value[a + 1] / 5e3;
|
|
270
|
+
e.fillRect(s, 2, r - s, C.value - 6);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}, ce = () => {
|
|
274
|
+
const n = H.value;
|
|
275
|
+
if (!n) {
|
|
276
|
+
console.warn("annotationCanvas ref is missing, skipping renderTimelimeLine");
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const e = n.getContext("2d");
|
|
280
|
+
if (!e) {
|
|
281
|
+
console.warn("Unable to get 2D context for annotationCanvas, skipping renderTimelimeLine");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
e.setTransform(f.value, 0, 0, f.value, 0, 0), e.clearRect(0, 0, t.cWidth, Z.value);
|
|
285
|
+
const a = t.ts_start, s = t.ts_end, r = D.value;
|
|
286
|
+
let i = 0;
|
|
287
|
+
const o = 0, m = Math.floor((Z.value - 2) / Object.keys(r).length - o), _ = v.viewerAnnotations;
|
|
288
|
+
let b = "rgb(0,0,0)";
|
|
289
|
+
for (const h in r)
|
|
290
|
+
if (r.hasOwnProperty(h)) {
|
|
291
|
+
for (let d = 0; d < _.length; d++)
|
|
292
|
+
if (_[d].id === parseInt(h)) {
|
|
293
|
+
i = d, b = _[d].color;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
Pe(e, a, s, o, m, r[h], i, b);
|
|
297
|
+
}
|
|
298
|
+
}, Pe = (n, e, a, s, r, i, o, m) => {
|
|
299
|
+
E(() => {
|
|
300
|
+
n.setTransform(f.value, 0, 0, f.value, 0, 0), n.fillStyle = m;
|
|
301
|
+
for (let _ = 0; _ < i.length; _++)
|
|
302
|
+
if (i[_].value > 0) {
|
|
303
|
+
const b = (i[_].start - e) / (a - e) * t.cWidth;
|
|
304
|
+
let d = (i[_].end - e) / (a - e) * t.cWidth - b;
|
|
305
|
+
d < 1 && (d = 1);
|
|
306
|
+
const S = 1 + o * (r - 1 + s) + o;
|
|
307
|
+
n.fillRect(b, S, d, r);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}, Me = () => {
|
|
311
|
+
const n = document.createElement("canvas"), e = n.getContext("2d", { antialias: !0 }), a = "rgb(220,220,220)", s = 5, r = s, i = s, o = 10;
|
|
312
|
+
return n.width = r, n.height = i, e.fillStyle = a, e.beginPath(), e.moveTo(0, i * (1 / o)), e.lineTo(r * (1 / o), 0), e.lineTo(0, 0), e.lineTo(0, i * (1 / o)), e.fill(), e.beginPath(), e.moveTo(r, i * (1 / o)), e.lineTo(r * (1 / o), i), e.lineTo(0, i), e.lineTo(0, i * ((o - 1) / o)), e.lineTo(r * ((o - 1) / o), 0), e.lineTo(r, 0), e.lineTo(r, i * (1 / o)), e.fill(), e.beginPath(), e.moveTo(r, i * ((o - 1) / o)), e.lineTo(r * ((o - 1) / o), i), e.lineTo(r, i), e.lineTo(r, i * ((o - 1) / o)), e.fill(), n;
|
|
313
|
+
};
|
|
314
|
+
return Ne(() => {
|
|
315
|
+
y.value = new Array(5e3), y.value = y.value.fill(0, 0, 4999), f.value = ye(), ee.value = Me(), q();
|
|
316
|
+
}), c({
|
|
317
|
+
getAnnotations: B,
|
|
318
|
+
initSegmentSpans: ie,
|
|
319
|
+
render: A,
|
|
320
|
+
renderViewPort: q,
|
|
321
|
+
renderSegments: F,
|
|
322
|
+
renderTimelimeLine: ce,
|
|
323
|
+
resetComponentState: se,
|
|
324
|
+
resetSegmentState: z,
|
|
325
|
+
clearCanvases: re
|
|
326
|
+
}), (n, e) => ($e(), Ie("div", Ge, [
|
|
327
|
+
x("div", Je, [
|
|
328
|
+
x("div", null, K(pe.value), 1),
|
|
329
|
+
x("div", null, K(_e.value), 1),
|
|
330
|
+
x("div", null, K(be.value), 1)
|
|
331
|
+
]),
|
|
332
|
+
x("div", Ke, [
|
|
333
|
+
x("div", Qe, [
|
|
334
|
+
x("div", {
|
|
335
|
+
id: "canvasWrap",
|
|
336
|
+
ref_key: "canvasWrap",
|
|
337
|
+
ref: k
|
|
338
|
+
}, [
|
|
339
|
+
x("canvas", {
|
|
340
|
+
id: "segmentsCanvas",
|
|
341
|
+
class: "canvas",
|
|
342
|
+
ref_key: "segmentsCanvas",
|
|
343
|
+
ref: W,
|
|
344
|
+
width: $(g.cWidth, f.value, 0),
|
|
345
|
+
height: $(C.value - 2, f.value, 0),
|
|
346
|
+
style: Q(ae.value)
|
|
347
|
+
}, null, 12, Ye),
|
|
348
|
+
x("canvas", {
|
|
349
|
+
id: "annotationCanvas",
|
|
350
|
+
class: "canvas",
|
|
351
|
+
ref_key: "annotationCanvas",
|
|
352
|
+
ref: H,
|
|
353
|
+
width: $(g.cWidth, f.value, 0),
|
|
354
|
+
height: $(C.value - 2, f.value, 0),
|
|
355
|
+
style: Q(ae.value)
|
|
356
|
+
}, null, 12, Ze),
|
|
357
|
+
x("canvas", {
|
|
358
|
+
id: "iCanvas",
|
|
359
|
+
class: "canvas",
|
|
360
|
+
ref_key: "iCanvas",
|
|
361
|
+
ref: T,
|
|
362
|
+
width: $(g.cWidth, f.value, 0),
|
|
363
|
+
height: $(C.value, f.value, 0),
|
|
364
|
+
onClick: e[0] || (e[0] = (...a) => n._onTap && n._onTap(...a)),
|
|
365
|
+
onMousemove: xe,
|
|
366
|
+
onMousedown: We,
|
|
367
|
+
onMouseup: ke,
|
|
368
|
+
onMouseenter: Re,
|
|
369
|
+
onMouseout: Ae,
|
|
370
|
+
style: Q(we.value)
|
|
371
|
+
}, null, 44, et)
|
|
372
|
+
], 512)
|
|
373
|
+
])
|
|
374
|
+
])
|
|
375
|
+
]));
|
|
376
|
+
}
|
|
377
|
+
}, ot = /* @__PURE__ */ Le(tt, [["__scopeId", "data-v-4f7f1867"]]);
|
|
378
|
+
export {
|
|
379
|
+
ot as default
|
|
380
|
+
};
|