@soomo/text-annotator 3.0.0-staging.13 → 3.0.0-staging.14
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.
|
@@ -72,31 +72,31 @@ const P = {
|
|
|
72
72
|
startOffset: o,
|
|
73
73
|
endContainer: i,
|
|
74
74
|
endOffset: r
|
|
75
|
-
} = t, a = Array.from(e.childNodes).map((
|
|
76
|
-
const p =
|
|
77
|
-
return
|
|
78
|
-
}), s = vt(n, e),
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const p = wt(s,
|
|
75
|
+
} = t, a = Array.from(e.childNodes).map((c) => {
|
|
76
|
+
const p = c.cloneNode(!0);
|
|
77
|
+
return c.nodeName === "CANVAS" ? c : p;
|
|
78
|
+
}), s = vt(n, e), u = vt(i, e), f = () => {
|
|
79
|
+
const c = e;
|
|
80
|
+
c.replaceChildren(...a);
|
|
81
|
+
const p = wt(s, c), g = wt(u, c);
|
|
82
82
|
return t.setStart(p, o), t.setEnd(g, r), t;
|
|
83
|
-
}, m = (
|
|
83
|
+
}, m = (c) => {
|
|
84
84
|
const p = document.createElement("SPAN");
|
|
85
|
-
return
|
|
85
|
+
return c.surroundContents(p), p;
|
|
86
86
|
};
|
|
87
87
|
if (n === i)
|
|
88
88
|
throw "Not implemented";
|
|
89
89
|
{
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
const p = m(
|
|
90
|
+
const c = document.createRange();
|
|
91
|
+
c.selectNodeContents(n), c.setStart(n, o);
|
|
92
|
+
const p = m(c), g = document.createRange();
|
|
93
93
|
g.selectNode(i), g.setEnd(i, r);
|
|
94
|
-
const
|
|
95
|
-
var
|
|
96
|
-
const
|
|
97
|
-
return (
|
|
94
|
+
const y = m(g), h = Zt(t).reverse().map((d) => {
|
|
95
|
+
var w;
|
|
96
|
+
const l = document.createElement("SPAN");
|
|
97
|
+
return (w = d.parentNode) == null || w.insertBefore(l, d), l.appendChild(d), l;
|
|
98
98
|
});
|
|
99
|
-
return { unwrap: f, nodes: [p, ...
|
|
99
|
+
return { unwrap: f, nodes: [p, ...h, y] };
|
|
100
100
|
}
|
|
101
101
|
}, Zt = (t) => {
|
|
102
102
|
const {
|
|
@@ -122,10 +122,10 @@ const P = {
|
|
|
122
122
|
r.setStart(i, 0), r.setEnd(t.startContainer, t.startOffset);
|
|
123
123
|
const a = ft(r).textContent, s = document.createRange();
|
|
124
124
|
s.setStart(t.endContainer, t.endOffset), i === document.body ? s.setEnd(i, i.childNodes.length) : s.setEndAfter(i);
|
|
125
|
-
const
|
|
125
|
+
const u = ft(s).textContent;
|
|
126
126
|
return {
|
|
127
127
|
prefix: a.substring(a.length - n),
|
|
128
|
-
suffix:
|
|
128
|
+
suffix: u.substring(0, n)
|
|
129
129
|
};
|
|
130
130
|
}, ee = /^\s*$/, ne = (t) => ee.test(t.toString()), $ = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), oe = (t, e) => {
|
|
131
131
|
const n = (r) => Math.round(r * 10) / 10, o = {
|
|
@@ -178,10 +178,10 @@ const P = {
|
|
|
178
178
|
}, []), se = (t, e, n) => {
|
|
179
179
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
180
180
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
181
|
-
const r = ft(o).textContent, a = t.toString(), s = r.length || 0,
|
|
182
|
-
return n ? { quote: a, start: s, end:
|
|
181
|
+
const r = ft(o).textContent, a = t.toString(), s = r.length || 0, u = s + a.length;
|
|
182
|
+
return n ? { quote: a, start: s, end: u, range: t, offsetReference: i } : { quote: a, start: s, end: u, range: t };
|
|
183
183
|
}, Ut = (t, e) => {
|
|
184
|
-
var m,
|
|
184
|
+
var m, c;
|
|
185
185
|
const { start: n, end: o } = t, i = t.offsetReference || e, r = document.createNodeIterator(
|
|
186
186
|
e,
|
|
187
187
|
NodeFilter.SHOW_TEXT,
|
|
@@ -192,27 +192,27 @@ const P = {
|
|
|
192
192
|
);
|
|
193
193
|
let a = 0;
|
|
194
194
|
const s = document.createRange();
|
|
195
|
-
let
|
|
196
|
-
|
|
195
|
+
let u = r.nextNode();
|
|
196
|
+
u === null && console.error("Could not revive annotation target. Content missing.");
|
|
197
197
|
let f = !i;
|
|
198
|
-
for (;
|
|
199
|
-
if (f || (f = i == null ? void 0 : i.contains(
|
|
200
|
-
const p = ((m =
|
|
198
|
+
for (; u !== null; ) {
|
|
199
|
+
if (f || (f = i == null ? void 0 : i.contains(u)), f) {
|
|
200
|
+
const p = ((m = u.textContent) == null ? void 0 : m.length) || 0;
|
|
201
201
|
if (a + p > n) {
|
|
202
|
-
s.setStart(
|
|
202
|
+
s.setStart(u, n - a);
|
|
203
203
|
break;
|
|
204
204
|
}
|
|
205
205
|
a += p;
|
|
206
206
|
}
|
|
207
|
-
|
|
207
|
+
u = r.nextNode();
|
|
208
208
|
}
|
|
209
|
-
for (;
|
|
210
|
-
const p = ((
|
|
209
|
+
for (; u !== null; ) {
|
|
210
|
+
const p = ((c = u.textContent) == null ? void 0 : c.length) || 0;
|
|
211
211
|
if (a + p >= o) {
|
|
212
|
-
s.setEnd(
|
|
212
|
+
s.setEnd(u, o - a);
|
|
213
213
|
break;
|
|
214
214
|
}
|
|
215
|
-
a += p,
|
|
215
|
+
a += p, u = r.nextNode();
|
|
216
216
|
}
|
|
217
217
|
return {
|
|
218
218
|
...t,
|
|
@@ -222,8 +222,8 @@ const P = {
|
|
|
222
222
|
...t,
|
|
223
223
|
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : Ut(n, e))
|
|
224
224
|
}, rt = (t, e) => $(t.target.selector) ? t : { ...t, target: it(t.target, e) }, ae = (t) => {
|
|
225
|
-
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, a = -e, s = o - n,
|
|
226
|
-
return { top: e, left: n, minX: r, minY: a, maxX: s, maxY:
|
|
225
|
+
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, a = -e, s = o - n, u = i - e;
|
|
226
|
+
return { top: e, left: n, minX: r, minY: a, maxX: s, maxY: u };
|
|
227
227
|
}, ce = (t) => {
|
|
228
228
|
let e = /* @__PURE__ */ new Set();
|
|
229
229
|
return (o) => {
|
|
@@ -232,45 +232,45 @@ const P = {
|
|
|
232
232
|
};
|
|
233
233
|
}, mt = (t, e, n, o) => {
|
|
234
234
|
const { store: i, selection: r, hover: a } = e;
|
|
235
|
-
let s,
|
|
236
|
-
const m = ce(n),
|
|
237
|
-
const { x: I, y: b } = t.getBoundingClientRect(),
|
|
238
|
-
|
|
235
|
+
let s, u, f;
|
|
236
|
+
const m = ce(n), c = (T) => {
|
|
237
|
+
const { x: I, y: b } = t.getBoundingClientRect(), x = i.getAt(T.clientX - I, T.clientY - b);
|
|
238
|
+
x && (!u || u(x)) ? a.current !== x.id && (t.classList.add("hovered"), a.set(x.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
|
|
239
239
|
};
|
|
240
|
-
t.addEventListener("pointermove",
|
|
240
|
+
t.addEventListener("pointermove", c);
|
|
241
241
|
const p = (T = !1) => {
|
|
242
242
|
f && f.clear();
|
|
243
|
-
const I = ae(t), { minX: b, minY:
|
|
243
|
+
const I = ae(t), { minX: b, minY: x, maxX: A, maxY: S } = I, R = u ? i.getIntersecting(b, x, A, S).filter(({ annotation: D }) => u(D)) : i.getIntersecting(b, x, A, S), O = r.selected.map(({ id: D }) => D), H = R.map(({ annotation: D, rects: zt }) => {
|
|
244
244
|
const Ft = O.includes(D.id), Wt = D.id === a.current;
|
|
245
|
-
return { annotation: D, rects: zt, state: { selected: Ft, hover: Wt
|
|
245
|
+
return { annotation: D, rects: zt, state: { selected: Ft, hover: Wt } };
|
|
246
246
|
});
|
|
247
247
|
o.redraw(H, I, s, f, T), setTimeout(() => m(R.map(({ annotation: D }) => D)), 1);
|
|
248
248
|
}, g = (T) => {
|
|
249
249
|
f = T, p();
|
|
250
|
-
},
|
|
250
|
+
}, y = (T) => {
|
|
251
251
|
s = T, p();
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
},
|
|
255
|
-
i.observe(
|
|
256
|
-
const d = r.subscribe(() => p()),
|
|
257
|
-
document.addEventListener("scroll",
|
|
258
|
-
const
|
|
252
|
+
}, v = (T) => {
|
|
253
|
+
u = T, p(!1);
|
|
254
|
+
}, h = () => p();
|
|
255
|
+
i.observe(h);
|
|
256
|
+
const d = r.subscribe(() => p()), l = () => p(!0);
|
|
257
|
+
document.addEventListener("scroll", l, { capture: !0, passive: !0 });
|
|
258
|
+
const w = pt(() => {
|
|
259
259
|
i.recalculatePositions(), f && f.reset(), p();
|
|
260
260
|
});
|
|
261
|
-
window.addEventListener("resize",
|
|
262
|
-
const C = new ResizeObserver(
|
|
261
|
+
window.addEventListener("resize", w);
|
|
262
|
+
const C = new ResizeObserver(w);
|
|
263
263
|
C.observe(t);
|
|
264
264
|
const L = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((T) => {
|
|
265
265
|
T.every((b) => b.target === t || t.contains(b.target)) || p(!0);
|
|
266
266
|
});
|
|
267
267
|
return E.observe(document.body, L), {
|
|
268
268
|
destroy: () => {
|
|
269
|
-
t.removeEventListener("pointermove",
|
|
269
|
+
t.removeEventListener("pointermove", c), o.destroy(), i.unobserve(h), d(), document.removeEventListener("scroll", l), window.removeEventListener("resize", w), C.disconnect(), E.disconnect();
|
|
270
270
|
},
|
|
271
271
|
redraw: p,
|
|
272
|
-
setStyle:
|
|
273
|
-
setFilter:
|
|
272
|
+
setStyle: y,
|
|
273
|
+
setFilter: v,
|
|
274
274
|
setPainter: g,
|
|
275
275
|
setVisible: o.setVisible
|
|
276
276
|
};
|
|
@@ -283,34 +283,34 @@ const P = {
|
|
|
283
283
|
t.classList.add("r6o-annotatable");
|
|
284
284
|
const e = le(), n = e.getContext("2d");
|
|
285
285
|
t.insertBefore(e, t.firstChild);
|
|
286
|
-
const o = (s,
|
|
287
|
-
const { width:
|
|
288
|
-
n.clearRect(-0.5, -0.5,
|
|
289
|
-
const { top: g, left:
|
|
290
|
-
[...s].sort((
|
|
291
|
-
const { annotation: { target: { created:
|
|
292
|
-
return
|
|
293
|
-
}).forEach((
|
|
286
|
+
const o = (s, u, f, m) => requestAnimationFrame(() => {
|
|
287
|
+
const { width: c, height: p } = e;
|
|
288
|
+
n.clearRect(-0.5, -0.5, c + 1, p + 1), m && m.clear();
|
|
289
|
+
const { top: g, left: y } = u;
|
|
290
|
+
[...s].sort((h, d) => {
|
|
291
|
+
const { annotation: { target: { created: l } } } = h, { annotation: { target: { created: w } } } = d;
|
|
292
|
+
return l.getTime() - w.getTime();
|
|
293
|
+
}).forEach((h) => {
|
|
294
294
|
var L;
|
|
295
|
-
const d = f ? typeof f == "function" ? f(
|
|
296
|
-
x: E +
|
|
295
|
+
const d = f ? typeof f == "function" ? f(h.annotation, h.state) : f : (L = h.state) != null && L.selected ? ot : P, l = m && m.paint(h, u) || d, w = h.rects.map(({ x: E, y: B, width: T, height: I }) => ({
|
|
296
|
+
x: E + y,
|
|
297
297
|
y: B + g,
|
|
298
298
|
width: T,
|
|
299
299
|
height: I
|
|
300
300
|
}));
|
|
301
|
-
n.fillStyle =
|
|
301
|
+
n.fillStyle = l.fill, n.globalAlpha = l.fillOpacity || 1;
|
|
302
302
|
const C = 5;
|
|
303
|
-
if (
|
|
303
|
+
if (w.forEach(
|
|
304
304
|
({ x: E, y: B, width: T, height: I }) => n.fillRect(
|
|
305
305
|
E,
|
|
306
306
|
B - C / 2,
|
|
307
307
|
T,
|
|
308
308
|
I + C
|
|
309
309
|
)
|
|
310
|
-
),
|
|
311
|
-
n.globalAlpha = 1, n.strokeStyle =
|
|
312
|
-
const E = C / 2 + (
|
|
313
|
-
|
|
310
|
+
), l.underlineColor) {
|
|
311
|
+
n.globalAlpha = 1, n.strokeStyle = l.underlineColor, n.lineWidth = l.underlineThickness ?? 1;
|
|
312
|
+
const E = C / 2 + (l.underlineOffset ?? 0);
|
|
313
|
+
w.forEach(({ x: B, y: T, width: I, height: b }) => {
|
|
314
314
|
n.beginPath(), n.moveTo(B, T + b + E), n.lineTo(B + I, T + b + E), n.stroke();
|
|
315
315
|
});
|
|
316
316
|
}
|
|
@@ -349,8 +349,8 @@ var fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
|
349
349
|
}, _t = function(t) {
|
|
350
350
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
351
351
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
352
|
-
var r = Math.floor(e), a = o * (1 - n), s = o * (1 - (e - r) * n),
|
|
353
|
-
return { r: 255 * [o, s, a, a,
|
|
352
|
+
var r = Math.floor(e), a = o * (1 - n), s = o * (1 - (e - r) * n), u = o * (1 - (1 - e + r) * n), f = r % 6;
|
|
353
|
+
return { r: 255 * [o, s, a, a, u, o][f], g: 255 * [u, o, o, s, a, a][f], b: 255 * [a, a, u, o, o, s][f], a: i };
|
|
354
354
|
}, xt = function(t) {
|
|
355
355
|
return { h: kt(t.h), s: k(t.s, 0, 100), l: k(t.l, 0, 100), a: k(t.a) };
|
|
356
356
|
}, At = function(t) {
|
|
@@ -479,19 +479,19 @@ const ye = (t) => [
|
|
|
479
479
|
setVisible: (r) => {
|
|
480
480
|
console.log("setVisible not implemented on CSS Custom Highlights renderer");
|
|
481
481
|
},
|
|
482
|
-
redraw: (r, a, s,
|
|
483
|
-
|
|
484
|
-
const f = new Set(r.map((
|
|
485
|
-
Array.from(e).filter((
|
|
486
|
-
const m = r.map((
|
|
487
|
-
var
|
|
488
|
-
const p = s ? typeof s == "function" ? s(
|
|
489
|
-
return `::highlight(_${
|
|
482
|
+
redraw: (r, a, s, u) => {
|
|
483
|
+
u && u.clear();
|
|
484
|
+
const f = new Set(r.map((c) => c.annotation.id));
|
|
485
|
+
Array.from(e).filter((c) => !f.has(c));
|
|
486
|
+
const m = r.map((c) => {
|
|
487
|
+
var y;
|
|
488
|
+
const p = s ? typeof s == "function" ? s(c.annotation, c.state) : s : (y = c.state) != null && y.selected ? ot : P, g = u && u.paint(c, a) || p;
|
|
489
|
+
return `::highlight(_${c.annotation.id}) { ${ye(g)} }`;
|
|
490
490
|
});
|
|
491
491
|
t.innerHTML = m.join(`
|
|
492
|
-
`), CSS.highlights.clear(), r.forEach(({ annotation:
|
|
493
|
-
const p =
|
|
494
|
-
CSS.highlights.set(`_${
|
|
492
|
+
`), CSS.highlights.clear(), r.forEach(({ annotation: c }) => {
|
|
493
|
+
const p = c.target.selector.map((y) => y.range), g = new Highlight(...p);
|
|
494
|
+
CSS.highlights.set(`_${c.id}`, g);
|
|
495
495
|
}), e = f;
|
|
496
496
|
}
|
|
497
497
|
};
|
|
@@ -534,19 +534,22 @@ const Ee = (t, e) => {
|
|
|
534
534
|
destroy: () => {
|
|
535
535
|
e.remove();
|
|
536
536
|
},
|
|
537
|
-
redraw: (a, s,
|
|
538
|
-
|
|
537
|
+
redraw: (a, s, u, f, m) => {
|
|
538
|
+
const p = !(gt(n, a) && m);
|
|
539
|
+
if (!f)
|
|
539
540
|
return;
|
|
540
|
-
e.innerHTML = "";
|
|
541
|
-
const
|
|
542
|
-
a.forEach((
|
|
543
|
-
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
541
|
+
p && (e.innerHTML = "");
|
|
542
|
+
const g = a.reduce((y, { rects: v }) => [...y, ...v], []);
|
|
543
|
+
a.forEach((y) => {
|
|
544
|
+
y.rects.map((v) => {
|
|
545
|
+
const h = Ee(v, g), d = qt(y, s, u, f, h);
|
|
546
|
+
if (p) {
|
|
547
|
+
const l = document.createElement("span");
|
|
548
|
+
l.className = "r6o-annotation", l.dataset.annotation = y.annotation.id, l.style.left = `${v.x}px`, l.style.top = `${v.y}px`, l.style.width = `${v.width}px`, l.style.height = `${v.height}px`;
|
|
549
|
+
const w = Y((d == null ? void 0 : d.fill) || P.fill).alpha((d == null ? void 0 : d.fillOpacity) === void 0 ? P.fillOpacity : d.fillOpacity).toHex();
|
|
550
|
+
l.style.backgroundColor = w, d.underlineStyle && (l.style.borderStyle = d.underlineStyle), d.underlineColor && (l.style.borderColor = d.underlineColor), d.underlineThickness && (l.style.borderBottomWidth = `${d.underlineThickness}px`), d.underlineOffset && (l.style.paddingBottom = `${d.underlineOffset}px`), e.appendChild(l);
|
|
551
|
+
}
|
|
548
552
|
});
|
|
549
|
-
return { id: g.annotation.id, spans: x };
|
|
550
553
|
}), n = a;
|
|
551
554
|
},
|
|
552
555
|
setVisible: (a) => {
|
|
@@ -614,10 +617,10 @@ function bt(t, e = lt) {
|
|
|
614
617
|
const o = /* @__PURE__ */ new Set();
|
|
615
618
|
function i(s) {
|
|
616
619
|
if (Ne(t, s) && (t = s, n)) {
|
|
617
|
-
const
|
|
620
|
+
const u = !z.length;
|
|
618
621
|
for (const f of o)
|
|
619
622
|
f[1](), z.push(f, t);
|
|
620
|
-
if (
|
|
623
|
+
if (u) {
|
|
621
624
|
for (let f = 0; f < z.length; f += 2)
|
|
622
625
|
z[f][0](z[f + 1]);
|
|
623
626
|
z.length = 0;
|
|
@@ -627,8 +630,8 @@ function bt(t, e = lt) {
|
|
|
627
630
|
function r(s) {
|
|
628
631
|
i(s(t));
|
|
629
632
|
}
|
|
630
|
-
function a(s,
|
|
631
|
-
const f = [s,
|
|
633
|
+
function a(s, u = lt) {
|
|
634
|
+
const f = [s, u];
|
|
632
635
|
return o.add(f), o.size === 1 && (n = e(i, r) || lt), s(t), () => {
|
|
633
636
|
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
634
637
|
};
|
|
@@ -656,34 +659,34 @@ var Ie = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE =
|
|
|
656
659
|
const dt = { selected: [] }, Me = (t, e = "EDIT") => {
|
|
657
660
|
const { subscribe: n, set: o } = bt(dt);
|
|
658
661
|
let i = dt;
|
|
659
|
-
n((
|
|
662
|
+
n((c) => i = c);
|
|
660
663
|
const r = () => o(dt), a = () => {
|
|
661
|
-
var
|
|
662
|
-
return ((
|
|
663
|
-
}, s = (
|
|
664
|
+
var c;
|
|
665
|
+
return ((c = i.selected) == null ? void 0 : c.length) === 0;
|
|
666
|
+
}, s = (c) => {
|
|
664
667
|
if (i.selected.length === 0)
|
|
665
668
|
return !1;
|
|
666
|
-
const p = typeof
|
|
669
|
+
const p = typeof c == "string" ? c : c.id;
|
|
667
670
|
return i.selected.some((g) => g.id === p);
|
|
668
|
-
},
|
|
669
|
-
const g = t.getAnnotation(
|
|
671
|
+
}, u = (c, p) => {
|
|
672
|
+
const g = t.getAnnotation(c);
|
|
670
673
|
if (g) {
|
|
671
|
-
const
|
|
672
|
-
o(
|
|
674
|
+
const y = Ve(g, e);
|
|
675
|
+
o(y === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: p } : y === "SELECT" ? { selected: [{ id: c }], pointerEvent: p } : { selected: [], pointerEvent: p });
|
|
673
676
|
} else
|
|
674
|
-
console.warn("Invalid selection: " +
|
|
675
|
-
}, f = (
|
|
676
|
-
const g = Array.isArray(
|
|
677
|
-
o({ selected:
|
|
678
|
-
}, m = (
|
|
677
|
+
console.warn("Invalid selection: " + c);
|
|
678
|
+
}, f = (c, p = !0) => {
|
|
679
|
+
const g = Array.isArray(c) ? c : [c], y = g.map((v) => t.getAnnotation(v)).filter(Boolean);
|
|
680
|
+
o({ selected: y.map(({ id: v }) => ({ id: v, editable: p })) }), y.length !== g.length && console.warn("Invalid selection", c);
|
|
681
|
+
}, m = (c) => {
|
|
679
682
|
if (i.selected.length === 0)
|
|
680
683
|
return !1;
|
|
681
684
|
const { selected: p } = i;
|
|
682
|
-
p.filter(({ id: g }) =>
|
|
685
|
+
p.filter(({ id: g }) => c.includes(g)).length > 0 && o({ selected: p.filter(({ id: g }) => !c.includes(g)) });
|
|
683
686
|
};
|
|
684
|
-
return t.observe(({ changes:
|
|
687
|
+
return t.observe(({ changes: c }) => m((c.deleted || []).map((p) => p.id))), {
|
|
685
688
|
clear: r,
|
|
686
|
-
clickSelect:
|
|
689
|
+
clickSelect: u,
|
|
687
690
|
get selected() {
|
|
688
691
|
return i ? [...i.selected] : null;
|
|
689
692
|
},
|
|
@@ -752,10 +755,10 @@ const ze = (t, e) => {
|
|
|
752
755
|
if (!(!t.options.origin || t.options.origin === r))
|
|
753
756
|
return !1;
|
|
754
757
|
if (t.options.ignore) {
|
|
755
|
-
const { ignore: a } = t.options, s = (
|
|
758
|
+
const { ignore: a } = t.options, s = (u) => u && u.length > 0;
|
|
756
759
|
if (!(s(i.created) || s(i.deleted))) {
|
|
757
|
-
const
|
|
758
|
-
if (a === "BODY_ONLY" &&
|
|
760
|
+
const u = (n = i.updated) == null ? void 0 : n.some((m) => s(m.bodiesCreated) || s(m.bodiesDeleted) || s(m.bodiesUpdated)), f = (o = i.updated) == null ? void 0 : o.some((m) => m.targetUpdated);
|
|
761
|
+
if (a === "BODY_ONLY" && u && !f || a === "TARGET_ONLY" && f && !u)
|
|
759
762
|
return !1;
|
|
760
763
|
}
|
|
761
764
|
}
|
|
@@ -769,80 +772,80 @@ const ze = (t, e) => {
|
|
|
769
772
|
} else
|
|
770
773
|
return !0;
|
|
771
774
|
}, Fe = (t, e) => {
|
|
772
|
-
const n = new Set((t.created || []).map((
|
|
773
|
-
...(t.created || []).filter((
|
|
775
|
+
const n = new Set((t.created || []).map((c) => c.id)), o = new Set((t.updated || []).map(({ newValue: c }) => c.id)), i = new Set((e.created || []).map((c) => c.id)), r = new Set((e.deleted || []).map((c) => c.id)), a = new Set((e.updated || []).map(({ oldValue: c }) => c.id)), s = new Set((e.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), u = [
|
|
776
|
+
...(t.created || []).filter((c) => !r.has(c.id)).map((c) => a.has(c.id) ? e.updated.find(({ oldValue: p }) => p.id === c.id).newValue : c),
|
|
774
777
|
...e.created || []
|
|
775
778
|
], f = [
|
|
776
|
-
...(t.deleted || []).filter((
|
|
777
|
-
...(e.deleted || []).filter((
|
|
779
|
+
...(t.deleted || []).filter((c) => !i.has(c.id)),
|
|
780
|
+
...(e.deleted || []).filter((c) => !n.has(c.id))
|
|
778
781
|
], m = [
|
|
779
|
-
...(t.updated || []).filter(({ newValue:
|
|
780
|
-
const { oldValue: p, newValue: g } =
|
|
782
|
+
...(t.updated || []).filter(({ newValue: c }) => !r.has(c.id)).map((c) => {
|
|
783
|
+
const { oldValue: p, newValue: g } = c;
|
|
781
784
|
if (a.has(g.id)) {
|
|
782
|
-
const
|
|
783
|
-
return Xt(p,
|
|
785
|
+
const y = e.updated.find((v) => v.oldValue.id === g.id).newValue;
|
|
786
|
+
return Xt(p, y);
|
|
784
787
|
} else
|
|
785
|
-
return
|
|
788
|
+
return c;
|
|
786
789
|
}),
|
|
787
|
-
...(e.updated || []).filter(({ oldValue:
|
|
790
|
+
...(e.updated || []).filter(({ oldValue: c }) => !s.has(c.id))
|
|
788
791
|
];
|
|
789
|
-
return { created:
|
|
792
|
+
return { created: u, deleted: f, updated: m };
|
|
790
793
|
}, We = (t) => t.id !== void 0, qe = () => {
|
|
791
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (b,
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
}, r = (b,
|
|
794
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (b, x = {}) => n.push({ onChange: b, options: x }), i = (b) => {
|
|
795
|
+
const x = n.findIndex((A) => A.onChange == b);
|
|
796
|
+
x > -1 && n.splice(x, 1);
|
|
797
|
+
}, r = (b, x) => {
|
|
795
798
|
const A = {
|
|
796
799
|
origin: b,
|
|
797
800
|
changes: {
|
|
798
|
-
created:
|
|
799
|
-
updated:
|
|
800
|
-
deleted:
|
|
801
|
+
created: x.created || [],
|
|
802
|
+
updated: x.updated || [],
|
|
803
|
+
deleted: x.deleted || []
|
|
801
804
|
},
|
|
802
805
|
state: [...t.values()]
|
|
803
806
|
};
|
|
804
807
|
n.forEach((S) => {
|
|
805
808
|
ze(S, A) && S.onChange(A);
|
|
806
809
|
});
|
|
807
|
-
}, a = (b,
|
|
810
|
+
}, a = (b, x = N.LOCAL) => {
|
|
808
811
|
if (t.get(b.id))
|
|
809
812
|
throw Error(`Cannot add annotation ${b.id} - exists already`);
|
|
810
|
-
t.set(b.id, b), b.bodies.forEach((A) => e.set(A.id, b.id)), r(
|
|
811
|
-
}, s = (b,
|
|
812
|
-
const A = typeof b == "string" ?
|
|
813
|
+
t.set(b.id, b), b.bodies.forEach((A) => e.set(A.id, b.id)), r(x, { created: [b] });
|
|
814
|
+
}, s = (b, x) => {
|
|
815
|
+
const A = typeof b == "string" ? x : b, S = typeof b == "string" ? b : b.id, R = t.get(S);
|
|
813
816
|
if (R) {
|
|
814
817
|
const O = Xt(R, A);
|
|
815
818
|
return S === A.id ? t.set(S, A) : (t.delete(S), t.set(A.id, A)), R.bodies.forEach((H) => e.delete(H.id)), A.bodies.forEach((H) => e.set(H.id, A.id)), O;
|
|
816
819
|
} else
|
|
817
820
|
console.warn(`Cannot update annotation ${S} - does not exist`);
|
|
818
|
-
},
|
|
819
|
-
const S = We(
|
|
821
|
+
}, u = (b, x = N.LOCAL, A = N.LOCAL) => {
|
|
822
|
+
const S = We(x) ? A : x, R = s(b, x);
|
|
820
823
|
R && r(S, { updated: [R] });
|
|
821
|
-
}, f = (b,
|
|
824
|
+
}, f = (b, x = N.LOCAL) => {
|
|
822
825
|
const A = b.reduce((S, R) => {
|
|
823
826
|
const O = s(R);
|
|
824
827
|
return O ? [...S, O] : S;
|
|
825
828
|
}, []);
|
|
826
|
-
A.length > 0 && r(
|
|
827
|
-
}, m = (b,
|
|
829
|
+
A.length > 0 && r(x, { updated: A });
|
|
830
|
+
}, m = (b, x = N.LOCAL) => {
|
|
828
831
|
const A = t.get(b.annotation);
|
|
829
832
|
if (A) {
|
|
830
833
|
const S = {
|
|
831
834
|
...A,
|
|
832
835
|
bodies: [...A.bodies, b]
|
|
833
836
|
};
|
|
834
|
-
t.set(A.id, S), e.set(b.id, S.id), r(
|
|
837
|
+
t.set(A.id, S), e.set(b.id, S.id), r(x, { updated: [{
|
|
835
838
|
oldValue: A,
|
|
836
839
|
newValue: S,
|
|
837
840
|
bodiesCreated: [b]
|
|
838
841
|
}] });
|
|
839
842
|
} else
|
|
840
843
|
console.warn(`Attempt to add body to missing annotation: ${b.annotation}`);
|
|
841
|
-
},
|
|
842
|
-
const
|
|
843
|
-
t.clear(), e.clear(), r(b, { deleted:
|
|
844
|
-
}, g = (b,
|
|
845
|
-
if (
|
|
844
|
+
}, c = () => [...t.values()], p = (b = N.LOCAL) => {
|
|
845
|
+
const x = [...t.values()];
|
|
846
|
+
t.clear(), e.clear(), r(b, { deleted: x });
|
|
847
|
+
}, g = (b, x = !0, A = N.LOCAL) => {
|
|
848
|
+
if (x) {
|
|
846
849
|
const S = [...t.values()];
|
|
847
850
|
t.clear(), e.clear(), b.forEach((R) => {
|
|
848
851
|
t.set(R.id, R), R.bodies.forEach((O) => e.set(O.id, R.id));
|
|
@@ -858,32 +861,32 @@ const ze = (t, e) => {
|
|
|
858
861
|
t.set(R.id, R), R.bodies.forEach((O) => e.set(O.id, R.id));
|
|
859
862
|
}), r(A, { created: b });
|
|
860
863
|
}
|
|
861
|
-
},
|
|
862
|
-
const
|
|
864
|
+
}, y = (b) => {
|
|
865
|
+
const x = typeof b == "string" ? b : b.id, A = t.get(x);
|
|
863
866
|
if (A)
|
|
864
|
-
return t.delete(
|
|
865
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
866
|
-
},
|
|
867
|
-
const A =
|
|
868
|
-
A && r(
|
|
869
|
-
},
|
|
867
|
+
return t.delete(x), A.bodies.forEach((S) => e.delete(S.id)), A;
|
|
868
|
+
console.warn(`Attempt to delete missing annotation: ${x}`);
|
|
869
|
+
}, v = (b, x = N.LOCAL) => {
|
|
870
|
+
const A = y(b);
|
|
871
|
+
A && r(x, { deleted: [A] });
|
|
872
|
+
}, h = (b, x = N.LOCAL) => {
|
|
870
873
|
const A = b.reduce((S, R) => {
|
|
871
|
-
const O =
|
|
874
|
+
const O = y(R);
|
|
872
875
|
return O ? [...S, O] : S;
|
|
873
876
|
}, []);
|
|
874
|
-
A.length > 0 && r(
|
|
877
|
+
A.length > 0 && r(x, { deleted: A });
|
|
875
878
|
}, d = (b) => {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
878
|
-
const A =
|
|
879
|
+
const x = t.get(b.annotation);
|
|
880
|
+
if (x) {
|
|
881
|
+
const A = x.bodies.find((S) => S.id === b.id);
|
|
879
882
|
if (A) {
|
|
880
883
|
e.delete(A.id);
|
|
881
884
|
const S = {
|
|
882
|
-
...
|
|
883
|
-
bodies:
|
|
885
|
+
...x,
|
|
886
|
+
bodies: x.bodies.filter((R) => R.id !== b.id)
|
|
884
887
|
};
|
|
885
|
-
return t.set(
|
|
886
|
-
oldValue:
|
|
888
|
+
return t.set(x.id, S), {
|
|
889
|
+
oldValue: x,
|
|
887
890
|
newValue: S,
|
|
888
891
|
bodiesDeleted: [A]
|
|
889
892
|
};
|
|
@@ -891,61 +894,61 @@ const ze = (t, e) => {
|
|
|
891
894
|
console.warn(`Attempt to delete missing body ${b.id} from annotation ${b.annotation}`);
|
|
892
895
|
} else
|
|
893
896
|
console.warn(`Attempt to delete body from missing annotation ${b.annotation}`);
|
|
894
|
-
},
|
|
897
|
+
}, l = (b, x = N.LOCAL) => {
|
|
895
898
|
const A = d(b);
|
|
896
|
-
A && r(
|
|
897
|
-
},
|
|
899
|
+
A && r(x, { updated: [A] });
|
|
900
|
+
}, w = (b, x = N.LOCAL) => {
|
|
898
901
|
const A = b.map((S) => d(S)).filter(Boolean);
|
|
899
|
-
A.length > 0 && r(
|
|
902
|
+
A.length > 0 && r(x, { updated: A });
|
|
900
903
|
}, C = (b) => {
|
|
901
|
-
const
|
|
902
|
-
return
|
|
904
|
+
const x = t.get(b);
|
|
905
|
+
return x ? { ...x } : void 0;
|
|
903
906
|
}, L = (b) => {
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
906
|
-
const A = C(
|
|
907
|
+
const x = e.get(b);
|
|
908
|
+
if (x) {
|
|
909
|
+
const A = C(x).bodies.find((S) => S.id === b);
|
|
907
910
|
if (A)
|
|
908
911
|
return A;
|
|
909
912
|
console.error(`Store integrity error: body ${b} in index, but not in annotation`);
|
|
910
913
|
} else
|
|
911
914
|
console.warn(`Attempt to retrieve missing body: ${b}`);
|
|
912
|
-
}, E = (b,
|
|
913
|
-
if (b.annotation !==
|
|
915
|
+
}, E = (b, x) => {
|
|
916
|
+
if (b.annotation !== x.annotation)
|
|
914
917
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
915
918
|
const A = t.get(b.annotation);
|
|
916
919
|
if (A) {
|
|
917
920
|
const S = A.bodies.find((O) => O.id === b.id), R = {
|
|
918
921
|
...A,
|
|
919
|
-
bodies: A.bodies.map((O) => O.id === S.id ?
|
|
922
|
+
bodies: A.bodies.map((O) => O.id === S.id ? x : O)
|
|
920
923
|
};
|
|
921
|
-
return t.set(A.id, R), S.id !==
|
|
924
|
+
return t.set(A.id, R), S.id !== x.id && (e.delete(S.id), e.set(x.id, R.id)), {
|
|
922
925
|
oldValue: A,
|
|
923
926
|
newValue: R,
|
|
924
|
-
bodiesUpdated: [{ oldBody: S, newBody:
|
|
927
|
+
bodiesUpdated: [{ oldBody: S, newBody: x }]
|
|
925
928
|
};
|
|
926
929
|
} else
|
|
927
930
|
console.warn(`Attempt to add body to missing annotation ${b.annotation}`);
|
|
928
|
-
}, B = (b,
|
|
929
|
-
const S = E(b,
|
|
931
|
+
}, B = (b, x, A = N.LOCAL) => {
|
|
932
|
+
const S = E(b, x);
|
|
930
933
|
S && r(A, { updated: [S] });
|
|
931
|
-
}, T = (b,
|
|
934
|
+
}, T = (b, x = N.LOCAL) => {
|
|
932
935
|
const A = b.map((S) => E({ id: S.id, annotation: S.annotation }, S)).filter(Boolean);
|
|
933
|
-
r(
|
|
936
|
+
r(x, { updated: A });
|
|
934
937
|
}, I = (b) => {
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
938
|
+
const x = t.get(b.annotation);
|
|
939
|
+
if (x) {
|
|
937
940
|
const A = {
|
|
938
|
-
...
|
|
941
|
+
...x,
|
|
939
942
|
target: {
|
|
940
|
-
...
|
|
943
|
+
...x.target,
|
|
941
944
|
...b
|
|
942
945
|
}
|
|
943
946
|
};
|
|
944
|
-
return t.set(
|
|
945
|
-
oldValue:
|
|
947
|
+
return t.set(x.id, A), {
|
|
948
|
+
oldValue: x,
|
|
946
949
|
newValue: A,
|
|
947
950
|
targetUpdated: {
|
|
948
|
-
oldTarget:
|
|
951
|
+
oldTarget: x.target,
|
|
949
952
|
newTarget: b
|
|
950
953
|
}
|
|
951
954
|
};
|
|
@@ -955,28 +958,28 @@ const ze = (t, e) => {
|
|
|
955
958
|
return {
|
|
956
959
|
addAnnotation: a,
|
|
957
960
|
addBody: m,
|
|
958
|
-
all:
|
|
961
|
+
all: c,
|
|
959
962
|
bulkAddAnnotation: g,
|
|
960
|
-
bulkDeleteAnnotation:
|
|
961
|
-
bulkDeleteBodies:
|
|
963
|
+
bulkDeleteAnnotation: h,
|
|
964
|
+
bulkDeleteBodies: w,
|
|
962
965
|
bulkUpdateAnnotation: f,
|
|
963
966
|
bulkUpdateBodies: T,
|
|
964
|
-
bulkUpdateTargets: (b,
|
|
967
|
+
bulkUpdateTargets: (b, x = N.LOCAL) => {
|
|
965
968
|
const A = b.map((S) => I(S)).filter(Boolean);
|
|
966
|
-
A.length > 0 && r(
|
|
969
|
+
A.length > 0 && r(x, { updated: A });
|
|
967
970
|
},
|
|
968
971
|
clear: p,
|
|
969
|
-
deleteAnnotation:
|
|
970
|
-
deleteBody:
|
|
972
|
+
deleteAnnotation: v,
|
|
973
|
+
deleteBody: l,
|
|
971
974
|
getAnnotation: C,
|
|
972
975
|
getBody: L,
|
|
973
976
|
observe: o,
|
|
974
977
|
unobserve: i,
|
|
975
|
-
updateAnnotation:
|
|
978
|
+
updateAnnotation: u,
|
|
976
979
|
updateBody: B,
|
|
977
|
-
updateTarget: (b,
|
|
980
|
+
updateTarget: (b, x = N.LOCAL) => {
|
|
978
981
|
const A = I(b);
|
|
979
|
-
A && r(
|
|
982
|
+
A && r(x, { updated: [A] });
|
|
980
983
|
}
|
|
981
984
|
};
|
|
982
985
|
};
|
|
@@ -999,36 +1002,36 @@ const Ge = 250, Ke = (t) => {
|
|
|
999
1002
|
let o = -1, i = !1, r = 0;
|
|
1000
1003
|
const a = (g) => {
|
|
1001
1004
|
if (!i) {
|
|
1002
|
-
const { changes:
|
|
1003
|
-
if (
|
|
1004
|
-
n.splice(o + 1), n.push(
|
|
1005
|
+
const { changes: y } = g, v = performance.now();
|
|
1006
|
+
if (v - r > Ge)
|
|
1007
|
+
n.splice(o + 1), n.push(y), o = n.length - 1;
|
|
1005
1008
|
else {
|
|
1006
|
-
const
|
|
1007
|
-
n[
|
|
1009
|
+
const h = n.length - 1;
|
|
1010
|
+
n[h] = Fe(n[h], y);
|
|
1008
1011
|
}
|
|
1009
|
-
r =
|
|
1012
|
+
r = v;
|
|
1010
1013
|
}
|
|
1011
1014
|
i = !1;
|
|
1012
1015
|
};
|
|
1013
1016
|
t.observe(a, { origin: N.LOCAL });
|
|
1014
|
-
const s = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g),
|
|
1017
|
+
const s = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g), u = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), f = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ oldValue: y }) => y)), m = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ newValue: y }) => y)), c = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), p = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g);
|
|
1015
1018
|
return {
|
|
1016
1019
|
canRedo: () => n.length - 1 > o,
|
|
1017
1020
|
canUndo: () => o > -1,
|
|
1018
1021
|
destroy: () => t.unobserve(a),
|
|
1019
|
-
on: (g,
|
|
1022
|
+
on: (g, y) => e.on(g, y),
|
|
1020
1023
|
redo: () => {
|
|
1021
1024
|
if (n.length - 1 > o) {
|
|
1022
1025
|
i = !0;
|
|
1023
|
-
const { created: g, updated:
|
|
1024
|
-
|
|
1026
|
+
const { created: g, updated: y, deleted: v } = n[o + 1];
|
|
1027
|
+
u(g), m(y), p(v), e.emit("redo", n[o + 1]), o += 1;
|
|
1025
1028
|
}
|
|
1026
1029
|
},
|
|
1027
1030
|
undo: () => {
|
|
1028
1031
|
if (o > -1) {
|
|
1029
1032
|
i = !0;
|
|
1030
|
-
const { created: g, updated:
|
|
1031
|
-
s(g), f(
|
|
1033
|
+
const { created: g, updated: y, deleted: v } = n[o];
|
|
1034
|
+
s(g), f(y), c(v), e.emit("undo", n[o]), o -= 1;
|
|
1032
1035
|
}
|
|
1033
1036
|
}
|
|
1034
1037
|
};
|
|
@@ -1039,70 +1042,70 @@ const Ge = 250, Ke = (t) => {
|
|
|
1039
1042
|
set: e
|
|
1040
1043
|
};
|
|
1041
1044
|
}, Je = (t, e, n, o) => {
|
|
1042
|
-
const { store: i, selection: r, hover: a, viewport: s } = t,
|
|
1045
|
+
const { store: i, selection: r, hover: a, viewport: s } = t, u = /* @__PURE__ */ new Map();
|
|
1043
1046
|
let f = [], m;
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
}, p = (
|
|
1047
|
-
const d =
|
|
1048
|
-
d && d.indexOf(
|
|
1049
|
-
}, g = (
|
|
1050
|
-
|
|
1051
|
-
|
|
1047
|
+
const c = (v, h) => {
|
|
1048
|
+
u.has(v) ? u.get(v).push(h) : u.set(v, [h]);
|
|
1049
|
+
}, p = (v, h) => {
|
|
1050
|
+
const d = u.get(v);
|
|
1051
|
+
d && d.indexOf(h) > 0 && d.splice(d.indexOf(h), 1);
|
|
1052
|
+
}, g = (v, h, d) => {
|
|
1053
|
+
u.has(v) && setTimeout(() => {
|
|
1054
|
+
u.get(v).forEach((l) => {
|
|
1052
1055
|
if (n) {
|
|
1053
|
-
const
|
|
1054
|
-
|
|
1056
|
+
const w = Array.isArray(h) ? h.map((L) => n.serialize(L)) : n.serialize(h), C = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;
|
|
1057
|
+
l(w, C);
|
|
1055
1058
|
} else
|
|
1056
|
-
|
|
1059
|
+
l(h, d);
|
|
1057
1060
|
});
|
|
1058
1061
|
}, 1);
|
|
1059
1062
|
};
|
|
1060
|
-
r.subscribe(({ selected:
|
|
1061
|
-
if (!(f.length === 0 &&
|
|
1062
|
-
if (f.length === 0 &&
|
|
1063
|
-
f =
|
|
1064
|
-
else if (f.length > 0 &&
|
|
1065
|
-
f.forEach((
|
|
1066
|
-
const d = i.getAnnotation(
|
|
1067
|
-
d && !q(d,
|
|
1063
|
+
r.subscribe(({ selected: v }) => {
|
|
1064
|
+
if (!(f.length === 0 && v.length === 0)) {
|
|
1065
|
+
if (f.length === 0 && v.length > 0)
|
|
1066
|
+
f = v.map(({ id: h }) => i.getAnnotation(h));
|
|
1067
|
+
else if (f.length > 0 && v.length === 0)
|
|
1068
|
+
f.forEach((h) => {
|
|
1069
|
+
const d = i.getAnnotation(h.id);
|
|
1070
|
+
d && !q(d, h) && g("updateAnnotation", d, h);
|
|
1068
1071
|
}), f = [];
|
|
1069
1072
|
else {
|
|
1070
|
-
const
|
|
1071
|
-
f.filter((
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1073
|
+
const h = new Set(f.map((l) => l.id)), d = new Set(v.map(({ id: l }) => l));
|
|
1074
|
+
f.filter((l) => !d.has(l.id)).forEach((l) => {
|
|
1075
|
+
const w = i.getAnnotation(l.id);
|
|
1076
|
+
w && !q(w, l) && g("updateAnnotation", w, l);
|
|
1074
1077
|
}), f = [
|
|
1075
1078
|
// Remove annotations that were deselected
|
|
1076
|
-
...f.filter((
|
|
1079
|
+
...f.filter((l) => d.has(l.id)),
|
|
1077
1080
|
// Add editable annotations that were selected
|
|
1078
|
-
...
|
|
1081
|
+
...v.filter(({ id: l }) => !h.has(l)).map(({ id: l }) => i.getAnnotation(l))
|
|
1079
1082
|
];
|
|
1080
1083
|
}
|
|
1081
1084
|
g("selectionChanged", f);
|
|
1082
1085
|
}
|
|
1083
|
-
}), a.subscribe((
|
|
1084
|
-
!m &&
|
|
1085
|
-
}), s == null || s.subscribe((
|
|
1086
|
-
const { created:
|
|
1087
|
-
(
|
|
1088
|
-
...
|
|
1089
|
-
...
|
|
1090
|
-
...
|
|
1091
|
-
].length > 0).forEach(({ oldValue:
|
|
1092
|
-
const C = f.find((L) => L.id ===
|
|
1093
|
-
f = f.map((L) => L.id ===
|
|
1086
|
+
}), a.subscribe((v) => {
|
|
1087
|
+
!m && v ? g("mouseEnterAnnotation", i.getAnnotation(v)) : m && !v ? g("mouseLeaveAnnotation", i.getAnnotation(m)) : m && v && (g("mouseLeaveAnnotation", i.getAnnotation(m)), g("mouseEnterAnnotation", i.getAnnotation(v))), m = v;
|
|
1088
|
+
}), s == null || s.subscribe((v) => g("viewportIntersect", v.map((h) => i.getAnnotation(h)))), i.observe((v) => {
|
|
1089
|
+
const { created: h, deleted: d } = v.changes;
|
|
1090
|
+
(h || []).forEach((l) => g("createAnnotation", l)), (d || []).forEach((l) => g("deleteAnnotation", l)), (v.changes.updated || []).filter((l) => [
|
|
1091
|
+
...l.bodiesCreated || [],
|
|
1092
|
+
...l.bodiesDeleted || [],
|
|
1093
|
+
...l.bodiesUpdated || []
|
|
1094
|
+
].length > 0).forEach(({ oldValue: l, newValue: w }) => {
|
|
1095
|
+
const C = f.find((L) => L.id === l.id) || l;
|
|
1096
|
+
f = f.map((L) => L.id === l.id ? w : L), g("updateAnnotation", w, C);
|
|
1094
1097
|
});
|
|
1095
|
-
}, { origin: N.LOCAL }), i.observe((
|
|
1098
|
+
}, { origin: N.LOCAL }), i.observe((v) => {
|
|
1096
1099
|
if (f) {
|
|
1097
|
-
const
|
|
1098
|
-
d.length > 0 && (f = f.map((
|
|
1100
|
+
const h = new Set(f.map((l) => l.id)), d = (v.changes.updated || []).filter(({ newValue: l }) => h.has(l.id)).map(({ newValue: l }) => l);
|
|
1101
|
+
d.length > 0 && (f = f.map((l) => d.find((C) => C.id === l.id) || l));
|
|
1099
1102
|
}
|
|
1100
1103
|
}, { origin: N.REMOTE });
|
|
1101
|
-
const
|
|
1102
|
-
const { updated: d } =
|
|
1103
|
-
|
|
1104
|
+
const y = (v) => (h) => {
|
|
1105
|
+
const { updated: d } = h;
|
|
1106
|
+
v ? (d || []).forEach((l) => g("updateAnnotation", l.oldValue, l.newValue)) : (d || []).forEach((l) => g("updateAnnotation", l.newValue, l.oldValue));
|
|
1104
1107
|
};
|
|
1105
|
-
return e.on("undo",
|
|
1108
|
+
return e.on("undo", y(!0)), e.on("redo", y(!1)), { on: c, off: p, emit: g };
|
|
1106
1109
|
}, Ze = (t) => (e) => e.reduce((n, o) => {
|
|
1107
1110
|
const { parsed: i, error: r } = t.parse(o);
|
|
1108
1111
|
return r ? {
|
|
@@ -1115,44 +1118,44 @@ const Ge = 250, Ke = (t) => {
|
|
|
1115
1118
|
...n
|
|
1116
1119
|
};
|
|
1117
1120
|
}, { parsed: [], failed: [] }), tn = (t, e, n) => {
|
|
1118
|
-
const { store: o, selection: i } = t, r = (
|
|
1121
|
+
const { store: o, selection: i } = t, r = (h) => {
|
|
1119
1122
|
if (n) {
|
|
1120
|
-
const { parsed: d, error:
|
|
1121
|
-
d ? o.addAnnotation(d, N.REMOTE) : console.error(
|
|
1123
|
+
const { parsed: d, error: l } = n.parse(h);
|
|
1124
|
+
d ? o.addAnnotation(d, N.REMOTE) : console.error(l);
|
|
1122
1125
|
} else
|
|
1123
|
-
o.addAnnotation(
|
|
1124
|
-
}, a = () => i.clear(), s = () => o.clear(),
|
|
1125
|
-
const d = o.getAnnotation(
|
|
1126
|
+
o.addAnnotation(h, N.REMOTE);
|
|
1127
|
+
}, a = () => i.clear(), s = () => o.clear(), u = (h) => {
|
|
1128
|
+
const d = o.getAnnotation(h);
|
|
1126
1129
|
return n && d ? n.serialize(d) : d;
|
|
1127
1130
|
}, f = () => n ? o.all().map(n.serialize) : o.all(), m = () => {
|
|
1128
|
-
var
|
|
1129
|
-
const d = (((
|
|
1131
|
+
var h;
|
|
1132
|
+
const d = (((h = i.selected) == null ? void 0 : h.map((l) => l.id)) || []).map((l) => o.getAnnotation(l)).filter(Boolean);
|
|
1130
1133
|
return n ? d.map(n.serialize) : d;
|
|
1131
|
-
},
|
|
1132
|
-
if (typeof
|
|
1133
|
-
const d = o.getAnnotation(
|
|
1134
|
-
if (o.deleteAnnotation(
|
|
1134
|
+
}, c = (h, d = !0) => fetch(h).then((l) => l.json()).then((l) => (g(l, d), l)), p = (h) => {
|
|
1135
|
+
if (typeof h == "string") {
|
|
1136
|
+
const d = o.getAnnotation(h);
|
|
1137
|
+
if (o.deleteAnnotation(h), d)
|
|
1135
1138
|
return n ? n.serialize(d) : d;
|
|
1136
1139
|
} else {
|
|
1137
|
-
const d = n ? n.parse(
|
|
1140
|
+
const d = n ? n.parse(h).parsed : h;
|
|
1138
1141
|
if (d)
|
|
1139
|
-
return o.deleteAnnotation(d),
|
|
1142
|
+
return o.deleteAnnotation(d), h;
|
|
1140
1143
|
}
|
|
1141
|
-
}, g = (
|
|
1144
|
+
}, g = (h, d = !0) => {
|
|
1142
1145
|
if (n) {
|
|
1143
|
-
const { parsed:
|
|
1144
|
-
|
|
1146
|
+
const { parsed: l, failed: w } = Ze(n)(h);
|
|
1147
|
+
w.length > 0 && console.warn(`Discarded ${w.length} invalid annotations`, w), o.bulkAddAnnotation(l, d, N.REMOTE);
|
|
1145
1148
|
} else
|
|
1146
|
-
o.bulkAddAnnotation(
|
|
1147
|
-
},
|
|
1148
|
-
|
|
1149
|
-
},
|
|
1149
|
+
o.bulkAddAnnotation(h, d, N.REMOTE);
|
|
1150
|
+
}, y = (h) => {
|
|
1151
|
+
h ? i.setSelected(h) : i.clear();
|
|
1152
|
+
}, v = (h) => {
|
|
1150
1153
|
if (n) {
|
|
1151
|
-
const d = n.parse(
|
|
1152
|
-
return o.updateAnnotation(d),
|
|
1154
|
+
const d = n.parse(h).parsed, l = n.serialize(o.getAnnotation(d.id));
|
|
1155
|
+
return o.updateAnnotation(d), l;
|
|
1153
1156
|
} else {
|
|
1154
|
-
const d = o.getAnnotation(
|
|
1155
|
-
return o.updateAnnotation(
|
|
1157
|
+
const d = o.getAnnotation(h.id);
|
|
1158
|
+
return o.updateAnnotation(h), d;
|
|
1156
1159
|
}
|
|
1157
1160
|
};
|
|
1158
1161
|
return {
|
|
@@ -1161,16 +1164,16 @@ const Ge = 250, Ke = (t) => {
|
|
|
1161
1164
|
canRedo: e.canRedo,
|
|
1162
1165
|
canUndo: e.canUndo,
|
|
1163
1166
|
clearAnnotations: s,
|
|
1164
|
-
getAnnotationById:
|
|
1167
|
+
getAnnotationById: u,
|
|
1165
1168
|
getAnnotations: f,
|
|
1166
1169
|
getSelected: m,
|
|
1167
|
-
loadAnnotations:
|
|
1170
|
+
loadAnnotations: c,
|
|
1168
1171
|
redo: e.redo,
|
|
1169
1172
|
removeAnnotation: p,
|
|
1170
1173
|
setAnnotations: g,
|
|
1171
|
-
setSelected:
|
|
1174
|
+
setSelected: y,
|
|
1172
1175
|
undo: e.undo,
|
|
1173
|
-
updateAnnotation:
|
|
1176
|
+
updateAnnotation: v
|
|
1174
1177
|
};
|
|
1175
1178
|
}, en = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1176
1179
|
let nn = (t) => crypto.getRandomValues(new Uint8Array(t)), on = (t, e, n) => {
|
|
@@ -1178,9 +1181,9 @@ let nn = (t) => crypto.getRandomValues(new Uint8Array(t)), on = (t, e, n) => {
|
|
|
1178
1181
|
return (r = e) => {
|
|
1179
1182
|
let a = "";
|
|
1180
1183
|
for (; ; ) {
|
|
1181
|
-
let s = n(i),
|
|
1182
|
-
for (;
|
|
1183
|
-
if (a += t[s[
|
|
1184
|
+
let s = n(i), u = i;
|
|
1185
|
+
for (; u--; )
|
|
1186
|
+
if (a += t[s[u] & o] || "", a.length === r)
|
|
1184
1187
|
return a;
|
|
1185
1188
|
}
|
|
1186
1189
|
};
|
|
@@ -1199,7 +1202,7 @@ const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1199
1202
|
}
|
|
1200
1203
|
return `${n}`;
|
|
1201
1204
|
}, $t = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, ln = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1202
|
-
const { id: o, type: i, purpose: r, value: a, created: s, modified:
|
|
1205
|
+
const { id: o, type: i, purpose: r, value: a, created: s, modified: u, creator: f, ...m } = n;
|
|
1203
1206
|
return {
|
|
1204
1207
|
id: o || `temp-${cn(n)}`,
|
|
1205
1208
|
annotation: e,
|
|
@@ -1208,7 +1211,7 @@ const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1208
1211
|
value: a,
|
|
1209
1212
|
creator: $t(f),
|
|
1210
1213
|
created: s ? new Date(s) : void 0,
|
|
1211
|
-
updated:
|
|
1214
|
+
updated: u ? new Date(u) : void 0,
|
|
1212
1215
|
...m
|
|
1213
1216
|
};
|
|
1214
1217
|
}), dn = (t) => t.map((e) => {
|
|
@@ -1242,26 +1245,26 @@ const Mn = (t, e) => ({
|
|
|
1242
1245
|
selector: [],
|
|
1243
1246
|
styleClass: a[0].styleClass
|
|
1244
1247
|
};
|
|
1245
|
-
for (const
|
|
1246
|
-
const m = (Array.isArray(
|
|
1248
|
+
for (const u of a) {
|
|
1249
|
+
const m = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((c, p) => {
|
|
1247
1250
|
switch (p.type) {
|
|
1248
1251
|
case "TextQuoteSelector":
|
|
1249
|
-
|
|
1252
|
+
c.quote = p.exact;
|
|
1250
1253
|
break;
|
|
1251
1254
|
case "TextPositionSelector":
|
|
1252
|
-
|
|
1255
|
+
c.start = p.start, c.end = p.end;
|
|
1253
1256
|
break;
|
|
1254
1257
|
}
|
|
1255
|
-
return
|
|
1258
|
+
return c;
|
|
1256
1259
|
}, {});
|
|
1257
1260
|
if (un(m))
|
|
1258
|
-
s.selector.push({ id:
|
|
1261
|
+
s.selector.push({ id: u.id, ...m });
|
|
1259
1262
|
else {
|
|
1260
|
-
const
|
|
1263
|
+
const c = [
|
|
1261
1264
|
m.start ? void 0 : "TextPositionSelector",
|
|
1262
1265
|
m.quote ? void 0 : "TextQuoteSelector"
|
|
1263
1266
|
].filter(Boolean);
|
|
1264
|
-
return { error: Error(`Missing selector types: ${
|
|
1267
|
+
return { error: Error(`Missing selector types: ${c.join(" and ")} for annotation: ${t.id}`) };
|
|
1265
1268
|
}
|
|
1266
1269
|
}
|
|
1267
1270
|
return { parsed: s };
|
|
@@ -1272,38 +1275,38 @@ const Mn = (t, e) => ({
|
|
|
1272
1275
|
modified: i,
|
|
1273
1276
|
body: r,
|
|
1274
1277
|
...a
|
|
1275
|
-
} = t, s = ln(r, e),
|
|
1276
|
-
return "error" in
|
|
1278
|
+
} = t, s = ln(r, e), u = hn(t);
|
|
1279
|
+
return "error" in u ? { error: u.error } : {
|
|
1277
1280
|
parsed: {
|
|
1278
1281
|
...a,
|
|
1279
1282
|
id: e,
|
|
1280
1283
|
bodies: s,
|
|
1281
|
-
target:
|
|
1284
|
+
target: u.parsed
|
|
1282
1285
|
}
|
|
1283
1286
|
};
|
|
1284
1287
|
}, gn = (t, e, n) => {
|
|
1285
1288
|
const { bodies: o, target: i, ...r } = t, {
|
|
1286
1289
|
selector: a,
|
|
1287
1290
|
creator: s,
|
|
1288
|
-
created:
|
|
1291
|
+
created: u,
|
|
1289
1292
|
updated: f,
|
|
1290
1293
|
...m
|
|
1291
|
-
} = i,
|
|
1292
|
-
const { quote: g, start:
|
|
1294
|
+
} = i, c = a.map((p) => {
|
|
1295
|
+
const { quote: g, start: y, end: v, range: h } = p, { prefix: d, suffix: l } = te(h, n), w = [{
|
|
1293
1296
|
type: "TextQuoteSelector",
|
|
1294
1297
|
exact: g,
|
|
1295
1298
|
prefix: d,
|
|
1296
|
-
suffix:
|
|
1299
|
+
suffix: l
|
|
1297
1300
|
}, {
|
|
1298
1301
|
type: "TextPositionSelector",
|
|
1299
|
-
start:
|
|
1300
|
-
end:
|
|
1302
|
+
start: y,
|
|
1303
|
+
end: v
|
|
1301
1304
|
}];
|
|
1302
1305
|
return {
|
|
1303
1306
|
...m,
|
|
1304
1307
|
id: p.id,
|
|
1305
1308
|
source: e,
|
|
1306
|
-
selector:
|
|
1309
|
+
selector: w
|
|
1307
1310
|
};
|
|
1308
1311
|
});
|
|
1309
1312
|
return {
|
|
@@ -1313,9 +1316,9 @@ const Mn = (t, e) => ({
|
|
|
1313
1316
|
type: "Annotation",
|
|
1314
1317
|
body: dn(t.bodies),
|
|
1315
1318
|
creator: s,
|
|
1316
|
-
created:
|
|
1319
|
+
created: u == null ? void 0 : u.toISOString(),
|
|
1317
1320
|
modified: f == null ? void 0 : f.toISOString(),
|
|
1318
|
-
target:
|
|
1321
|
+
target: c
|
|
1319
1322
|
};
|
|
1320
1323
|
};
|
|
1321
1324
|
function pn(t, e, n, o, i) {
|
|
@@ -1324,17 +1327,17 @@ function pn(t, e, n, o, i) {
|
|
|
1324
1327
|
function Ht(t, e, n, o, i) {
|
|
1325
1328
|
for (; o > n; ) {
|
|
1326
1329
|
if (o - n > 600) {
|
|
1327
|
-
var r = o - n + 1, a = e - n + 1, s = Math.log(r),
|
|
1328
|
-
Ht(t, e, m,
|
|
1330
|
+
var r = o - n + 1, a = e - n + 1, s = Math.log(r), u = 0.5 * Math.exp(2 * s / 3), f = 0.5 * Math.sqrt(s * u * (r - u) / r) * (a - r / 2 < 0 ? -1 : 1), m = Math.max(n, Math.floor(e - a * u / r + f)), c = Math.min(o, Math.floor(e + (r - a) * u / r + f));
|
|
1331
|
+
Ht(t, e, m, c, i);
|
|
1329
1332
|
}
|
|
1330
|
-
var p = t[e], g = n,
|
|
1331
|
-
for (j(t, n, e), i(t[o], p) > 0 && j(t, n, o); g <
|
|
1332
|
-
for (j(t, g,
|
|
1333
|
+
var p = t[e], g = n, y = o;
|
|
1334
|
+
for (j(t, n, e), i(t[o], p) > 0 && j(t, n, o); g < y; ) {
|
|
1335
|
+
for (j(t, g, y), g++, y--; i(t[g], p) < 0; )
|
|
1333
1336
|
g++;
|
|
1334
|
-
for (; i(t[
|
|
1335
|
-
|
|
1337
|
+
for (; i(t[y], p) > 0; )
|
|
1338
|
+
y--;
|
|
1336
1339
|
}
|
|
1337
|
-
i(t[n], p) === 0 ? j(t, n,
|
|
1340
|
+
i(t[n], p) === 0 ? j(t, n, y) : (y++, j(t, y, o)), y <= e && (n = y + 1), e <= y && (o = y - 1);
|
|
1338
1341
|
}
|
|
1339
1342
|
}
|
|
1340
1343
|
function j(t, e, n) {
|
|
@@ -1359,8 +1362,8 @@ class bn {
|
|
|
1359
1362
|
const i = this.toBBox, r = [];
|
|
1360
1363
|
for (; n; ) {
|
|
1361
1364
|
for (let a = 0; a < n.children.length; a++) {
|
|
1362
|
-
const s = n.children[a],
|
|
1363
|
-
nt(e,
|
|
1365
|
+
const s = n.children[a], u = n.leaf ? i(s) : s;
|
|
1366
|
+
nt(e, u) && (n.leaf ? o.push(s) : ht(e, u) ? this._all(s, o) : r.push(s));
|
|
1364
1367
|
}
|
|
1365
1368
|
n = r.pop();
|
|
1366
1369
|
}
|
|
@@ -1417,14 +1420,14 @@ class bn {
|
|
|
1417
1420
|
return this;
|
|
1418
1421
|
let o = this.data;
|
|
1419
1422
|
const i = this.toBBox(e), r = [], a = [];
|
|
1420
|
-
let s,
|
|
1423
|
+
let s, u, f;
|
|
1421
1424
|
for (; o || r.length; ) {
|
|
1422
|
-
if (o || (o = r.pop(),
|
|
1425
|
+
if (o || (o = r.pop(), u = r[r.length - 1], s = a.pop(), f = !0), o.leaf) {
|
|
1423
1426
|
const m = vn(e, o.children, n);
|
|
1424
1427
|
if (m !== -1)
|
|
1425
1428
|
return o.children.splice(m, 1), r.push(o), this._condense(r), this;
|
|
1426
1429
|
}
|
|
1427
|
-
!f && !o.leaf && ht(o, i) ? (r.push(o), a.push(s), s = 0,
|
|
1430
|
+
!f && !o.leaf && ht(o, i) ? (r.push(o), a.push(s), s = 0, u = o, o = o.children[0]) : u ? (s++, o = u.children[s], f = !1) : o = null;
|
|
1428
1431
|
}
|
|
1429
1432
|
return this;
|
|
1430
1433
|
}
|
|
@@ -1455,13 +1458,13 @@ class bn {
|
|
|
1455
1458
|
if (r <= a)
|
|
1456
1459
|
return s = W(e.slice(n, o + 1)), F(s, this.toBBox), s;
|
|
1457
1460
|
i || (i = Math.ceil(Math.log(r) / Math.log(a)), a = Math.ceil(r / Math.pow(a, i - 1))), s = W([]), s.leaf = !1, s.height = i;
|
|
1458
|
-
const
|
|
1461
|
+
const u = Math.ceil(r / a), f = u * Math.ceil(Math.sqrt(a));
|
|
1459
1462
|
It(e, n, o, f, this.compareMinX);
|
|
1460
1463
|
for (let m = n; m <= o; m += f) {
|
|
1461
|
-
const
|
|
1462
|
-
It(e, m,
|
|
1463
|
-
for (let p = m; p <=
|
|
1464
|
-
const g = Math.min(p +
|
|
1464
|
+
const c = Math.min(m + f - 1, o);
|
|
1465
|
+
It(e, m, c, u, this.compareMinY);
|
|
1466
|
+
for (let p = m; p <= c; p += u) {
|
|
1467
|
+
const g = Math.min(p + u - 1, c);
|
|
1465
1468
|
s.children.push(this._build(e, p, g, i - 1));
|
|
1466
1469
|
}
|
|
1467
1470
|
}
|
|
@@ -1470,9 +1473,9 @@ class bn {
|
|
|
1470
1473
|
_chooseSubtree(e, n, o, i) {
|
|
1471
1474
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1472
1475
|
let r = 1 / 0, a = 1 / 0, s;
|
|
1473
|
-
for (let
|
|
1474
|
-
const f = n.children[
|
|
1475
|
-
|
|
1476
|
+
for (let u = 0; u < n.children.length; u++) {
|
|
1477
|
+
const f = n.children[u], m = ut(f), c = xn(e, f) - m;
|
|
1478
|
+
c < a ? (a = c, r = m < r ? m : r, s = f) : c === a && m < r && (r = m, s = f);
|
|
1476
1479
|
}
|
|
1477
1480
|
n = s || n.children[0];
|
|
1478
1481
|
}
|
|
@@ -1497,8 +1500,8 @@ class bn {
|
|
|
1497
1500
|
_chooseSplitIndex(e, n, o) {
|
|
1498
1501
|
let i, r = 1 / 0, a = 1 / 0;
|
|
1499
1502
|
for (let s = n; s <= o - n; s++) {
|
|
1500
|
-
const
|
|
1501
|
-
m < r ? (r = m, i = s, a =
|
|
1503
|
+
const u = G(e, 0, s, this.toBBox), f = G(e, s, o, this.toBBox), m = An(u, f), c = ut(u) + ut(f);
|
|
1504
|
+
m < r ? (r = m, i = s, a = c < a ? c : a) : m === r && c < a && (a = c, i = s);
|
|
1502
1505
|
}
|
|
1503
1506
|
return i || o - n;
|
|
1504
1507
|
}
|
|
@@ -1511,16 +1514,16 @@ class bn {
|
|
|
1511
1514
|
_allDistMargin(e, n, o, i) {
|
|
1512
1515
|
e.children.sort(i);
|
|
1513
1516
|
const r = this.toBBox, a = G(e, 0, n, r), s = G(e, o - n, o, r);
|
|
1514
|
-
let
|
|
1517
|
+
let u = et(a) + et(s);
|
|
1515
1518
|
for (let f = n; f < o - n; f++) {
|
|
1516
1519
|
const m = e.children[f];
|
|
1517
|
-
K(a, e.leaf ? r(m) : m),
|
|
1520
|
+
K(a, e.leaf ? r(m) : m), u += et(a);
|
|
1518
1521
|
}
|
|
1519
1522
|
for (let f = o - n - 1; f >= n; f--) {
|
|
1520
1523
|
const m = e.children[f];
|
|
1521
|
-
K(s, e.leaf ? r(m) : m),
|
|
1524
|
+
K(s, e.leaf ? r(m) : m), u += et(s);
|
|
1522
1525
|
}
|
|
1523
|
-
return
|
|
1526
|
+
return u;
|
|
1524
1527
|
}
|
|
1525
1528
|
_adjustParentBBoxes(e, n, o) {
|
|
1526
1529
|
for (let i = o; i >= 0; i--)
|
|
@@ -1599,11 +1602,11 @@ function It(t, e, n, o, i) {
|
|
|
1599
1602
|
}
|
|
1600
1603
|
}
|
|
1601
1604
|
const En = (t, e) => {
|
|
1602
|
-
const n = new bn(), o = /* @__PURE__ */ new Map(), i = (d,
|
|
1603
|
-
const
|
|
1605
|
+
const n = new bn(), o = /* @__PURE__ */ new Map(), i = (d, l) => {
|
|
1606
|
+
const w = d.selector.flatMap((L) => {
|
|
1604
1607
|
const E = $([L]) ? L.range : Ut(L, e).range;
|
|
1605
1608
|
return Array.from(E.getClientRects());
|
|
1606
|
-
}), C = re(
|
|
1609
|
+
}), C = re(w).map(({ left: L, top: E, right: B, bottom: T }) => new DOMRect(L - l.left, E - l.top, B - L, T - E));
|
|
1607
1610
|
return C.map((L) => {
|
|
1608
1611
|
const { x: E, y: B, width: T, height: I } = L;
|
|
1609
1612
|
return {
|
|
@@ -1620,50 +1623,50 @@ const En = (t, e) => {
|
|
|
1620
1623
|
}, r = () => [...o.values()], a = () => {
|
|
1621
1624
|
n.clear(), o.clear();
|
|
1622
1625
|
}, s = (d) => {
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
},
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1626
|
+
const l = i(d, e.getBoundingClientRect());
|
|
1627
|
+
l.forEach((w) => n.insert(w)), o.set(d.annotation, l);
|
|
1628
|
+
}, u = (d) => {
|
|
1629
|
+
const l = o.get(d.annotation);
|
|
1630
|
+
l && (l.forEach((w) => n.remove(w)), o.delete(d.annotation));
|
|
1628
1631
|
}, f = (d) => {
|
|
1629
|
-
|
|
1630
|
-
}, m = (d,
|
|
1631
|
-
|
|
1632
|
-
const
|
|
1632
|
+
u(d), s(d);
|
|
1633
|
+
}, m = (d, l = !0) => {
|
|
1634
|
+
l && a();
|
|
1635
|
+
const w = e.getBoundingClientRect(), C = d.map((E) => ({ target: E, rects: i(E, w) }));
|
|
1633
1636
|
C.forEach(({ target: E, rects: B }) => o.set(E.annotation, B));
|
|
1634
1637
|
const L = C.reduce((E, { rects: B }) => [...E, ...B], []);
|
|
1635
1638
|
n.load(L);
|
|
1636
|
-
},
|
|
1637
|
-
const
|
|
1639
|
+
}, c = (d, l) => {
|
|
1640
|
+
const w = n.search({
|
|
1638
1641
|
minX: d,
|
|
1639
|
-
minY:
|
|
1642
|
+
minY: l,
|
|
1640
1643
|
maxX: d,
|
|
1641
|
-
maxY:
|
|
1644
|
+
maxY: l
|
|
1642
1645
|
}), C = (L) => L.annotation.rects.reduce((E, B) => E + B.width * B.height, 0);
|
|
1643
|
-
if (
|
|
1644
|
-
return
|
|
1646
|
+
if (w.length > 0)
|
|
1647
|
+
return w.sort((L, E) => C(L) - C(E)), w[0].annotation.id;
|
|
1645
1648
|
}, p = (d) => {
|
|
1646
|
-
const
|
|
1647
|
-
if (
|
|
1649
|
+
const l = g(d);
|
|
1650
|
+
if (l.length === 0)
|
|
1648
1651
|
return;
|
|
1649
|
-
let
|
|
1650
|
-
for (let B = 1; B <
|
|
1651
|
-
const T =
|
|
1652
|
-
|
|
1652
|
+
let w = l[0].left, C = l[0].top, L = l[0].right, E = l[0].bottom;
|
|
1653
|
+
for (let B = 1; B < l.length; B++) {
|
|
1654
|
+
const T = l[B];
|
|
1655
|
+
w = Math.min(w, T.left), C = Math.min(C, T.top), L = Math.max(L, T.right), E = Math.max(E, T.bottom);
|
|
1653
1656
|
}
|
|
1654
|
-
return new DOMRect(
|
|
1657
|
+
return new DOMRect(w, C, L - w, E - C);
|
|
1655
1658
|
}, g = (d) => {
|
|
1656
|
-
const
|
|
1657
|
-
return
|
|
1659
|
+
const l = o.get(d);
|
|
1660
|
+
return l ? l[0].annotation.rects : [];
|
|
1658
1661
|
};
|
|
1659
1662
|
return {
|
|
1660
1663
|
all: r,
|
|
1661
1664
|
clear: a,
|
|
1662
|
-
getAt:
|
|
1665
|
+
getAt: c,
|
|
1663
1666
|
getAnnotationBounds: p,
|
|
1664
1667
|
getAnnotationRects: g,
|
|
1665
|
-
getIntersecting: (d,
|
|
1666
|
-
const L = n.search({ minX: d, minY:
|
|
1668
|
+
getIntersecting: (d, l, w, C) => {
|
|
1669
|
+
const L = n.search({ minX: d, minY: l, maxX: w, maxY: C }), E = new Set(L.reduce((B, T) => [...B, T.annotation.id], []));
|
|
1667
1670
|
return Array.from(E).map((B) => ({
|
|
1668
1671
|
annotation: t.getAnnotation(B),
|
|
1669
1672
|
rects: g(B)
|
|
@@ -1671,57 +1674,57 @@ const En = (t, e) => {
|
|
|
1671
1674
|
},
|
|
1672
1675
|
insert: s,
|
|
1673
1676
|
recalculate: () => m(t.all().map((d) => d.target), !0),
|
|
1674
|
-
remove:
|
|
1677
|
+
remove: u,
|
|
1675
1678
|
set: m,
|
|
1676
1679
|
size: () => n.all().length,
|
|
1677
1680
|
update: f
|
|
1678
1681
|
};
|
|
1679
1682
|
}, Sn = (t, e) => {
|
|
1680
|
-
const n = qe(), o = En(n, t), i = Me(n, e), r = Oe(n), a = Qe(), s = (
|
|
1681
|
-
const d = rt(
|
|
1682
|
-
return
|
|
1683
|
-
},
|
|
1684
|
-
const
|
|
1685
|
-
return
|
|
1686
|
-
}, f = (
|
|
1687
|
-
const d =
|
|
1688
|
-
return
|
|
1689
|
-
n.getAnnotation(
|
|
1690
|
-
}),
|
|
1691
|
-
}, m = (
|
|
1692
|
-
const d = it(
|
|
1693
|
-
n.updateTarget(d,
|
|
1694
|
-
},
|
|
1695
|
-
const d =
|
|
1696
|
-
n.bulkUpdateTargets(d,
|
|
1697
|
-
}, p = (
|
|
1698
|
-
const d = o.getAt(
|
|
1683
|
+
const n = qe(), o = En(n, t), i = Me(n, e), r = Oe(n), a = Qe(), s = (v, h = N.LOCAL) => {
|
|
1684
|
+
const d = rt(v, t), l = $(d.target.selector);
|
|
1685
|
+
return l && n.addAnnotation(d, h), l;
|
|
1686
|
+
}, u = (v, h = !0, d = N.LOCAL) => {
|
|
1687
|
+
const l = v.map((C) => rt(C, t)), w = l.filter((C) => !$(C.target.selector));
|
|
1688
|
+
return w.length > 0 ? (console.warn("Could not revive all targets for these annotations:", w), n.bulkAddAnnotation(l, h, d), w) : (n.bulkAddAnnotation(l, h, d), []);
|
|
1689
|
+
}, f = (v, h = N.LOCAL) => {
|
|
1690
|
+
const d = v.map((w) => rt(w, t)), l = d.filter((w) => !$(w.target.selector));
|
|
1691
|
+
return l.length > 0 && console.warn("Could not revive all targets for these annotations:", l), d.forEach((w) => {
|
|
1692
|
+
n.getAnnotation(w.id) ? n.updateAnnotation(w, h) : n.addAnnotation(w, h);
|
|
1693
|
+
}), l;
|
|
1694
|
+
}, m = (v, h = N.LOCAL) => {
|
|
1695
|
+
const d = it(v, t);
|
|
1696
|
+
n.updateTarget(d, h);
|
|
1697
|
+
}, c = (v, h = N.LOCAL) => {
|
|
1698
|
+
const d = v.map((l) => it(l, t));
|
|
1699
|
+
n.bulkUpdateTargets(d, h);
|
|
1700
|
+
}, p = (v, h) => {
|
|
1701
|
+
const d = o.getAt(v, h);
|
|
1699
1702
|
return d ? n.getAnnotation(d) : void 0;
|
|
1700
|
-
}, g = (
|
|
1701
|
-
const
|
|
1702
|
-
if (
|
|
1703
|
-
if (
|
|
1704
|
-
const C =
|
|
1703
|
+
}, g = (v, h, d, l = 5) => {
|
|
1704
|
+
const w = o.getAnnotationRects(v);
|
|
1705
|
+
if (w.length !== 0) {
|
|
1706
|
+
if (h && d) {
|
|
1707
|
+
const C = w.find(({ top: L, right: E, bottom: B, left: T }) => h >= T - l && h <= E + l && d >= L - l && d <= B + l);
|
|
1705
1708
|
if (C)
|
|
1706
1709
|
return C;
|
|
1707
1710
|
}
|
|
1708
|
-
return o.getAnnotationBounds(
|
|
1711
|
+
return o.getAnnotationBounds(v);
|
|
1709
1712
|
}
|
|
1710
|
-
},
|
|
1711
|
-
return n.observe(({ changes:
|
|
1712
|
-
const
|
|
1713
|
-
|
|
1713
|
+
}, y = () => o.recalculate();
|
|
1714
|
+
return n.observe(({ changes: v }) => {
|
|
1715
|
+
const h = (v.created || []).filter((w) => $(w.target.selector)), d = (v.deleted || []).filter((w) => $(w.target.selector)), l = (v.updated || []).filter((w) => $(w.newValue.target.selector));
|
|
1716
|
+
h.length > 0 && o.set(h.map((w) => w.target), !1), (d == null ? void 0 : d.length) > 0 && d.forEach((w) => o.remove(w.target)), (l == null ? void 0 : l.length) > 0 && l.forEach(({ newValue: w }) => o.update(w.target));
|
|
1714
1717
|
}), {
|
|
1715
1718
|
store: {
|
|
1716
1719
|
...n,
|
|
1717
1720
|
addAnnotation: s,
|
|
1718
|
-
bulkAddAnnotation:
|
|
1719
|
-
bulkUpdateTargets:
|
|
1721
|
+
bulkAddAnnotation: u,
|
|
1722
|
+
bulkUpdateTargets: c,
|
|
1720
1723
|
bulkUpsertAnnotations: f,
|
|
1721
1724
|
getAnnotationBounds: g,
|
|
1722
1725
|
getAt: p,
|
|
1723
1726
|
getIntersecting: o.getIntersecting,
|
|
1724
|
-
recalculatePositions:
|
|
1727
|
+
recalculatePositions: y,
|
|
1725
1728
|
updateTarget: m
|
|
1726
1729
|
},
|
|
1727
1730
|
selection: i,
|
|
@@ -1736,34 +1739,34 @@ const En = (t, e) => {
|
|
|
1736
1739
|
}, Ln = (t, e, n = {}) => {
|
|
1737
1740
|
const o = Cn(), i = o.getContext("2d");
|
|
1738
1741
|
t.appendChild(o);
|
|
1739
|
-
const r = /* @__PURE__ */ new Map(), a = (
|
|
1740
|
-
return e.on("selectionChange", (
|
|
1741
|
-
a(
|
|
1742
|
+
const r = /* @__PURE__ */ new Map(), a = (c) => Array.from(r.entries()).filter(([p, g]) => g.presenceKey === c.presenceKey).map(([p, g]) => p);
|
|
1743
|
+
return e.on("selectionChange", (c, p) => {
|
|
1744
|
+
a(c).forEach((y) => r.delete(y)), p && p.forEach((y) => r.set(y, c));
|
|
1742
1745
|
}), {
|
|
1743
1746
|
clear: () => {
|
|
1744
|
-
const { width:
|
|
1745
|
-
i.clearRect(-0.5, -0.5,
|
|
1747
|
+
const { width: c, height: p } = o;
|
|
1748
|
+
i.clearRect(-0.5, -0.5, c + 1, p + 1);
|
|
1746
1749
|
},
|
|
1747
1750
|
destroy: () => {
|
|
1748
1751
|
o.remove();
|
|
1749
1752
|
},
|
|
1750
|
-
paint: (
|
|
1753
|
+
paint: (c, p, g) => {
|
|
1751
1754
|
n.font && (i.font = n.font);
|
|
1752
|
-
const
|
|
1753
|
-
if (
|
|
1754
|
-
const { height:
|
|
1755
|
-
i.fillStyle =
|
|
1756
|
-
const
|
|
1757
|
-
return i.fillRect(
|
|
1758
|
-
fill:
|
|
1755
|
+
const y = r.get(c.annotation.id);
|
|
1756
|
+
if (y) {
|
|
1757
|
+
const { height: v } = c.rects[0], h = c.rects[0].x + p.left, d = c.rects[0].y + p.top;
|
|
1758
|
+
i.fillStyle = y.appearance.color, i.fillRect(h - 2, d - 2.5, 2, v + 5);
|
|
1759
|
+
const l = i.measureText(y.appearance.label), w = l.width + 6, C = l.actualBoundingBoxAscent + l.actualBoundingBoxDescent + 8, L = l.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1760
|
+
return i.fillRect(h - 2, d - 2.5 - C, w, C), i.fillStyle = "#fff", i.fillText(y.appearance.label, h + 1, d - L), {
|
|
1761
|
+
fill: y.appearance.color,
|
|
1759
1762
|
fillOpacity: g ? 0.45 : 0.18
|
|
1760
1763
|
};
|
|
1761
1764
|
}
|
|
1762
1765
|
},
|
|
1763
1766
|
reset: () => {
|
|
1764
1767
|
o.width = 2 * window.innerWidth, o.height = 2 * window.innerHeight;
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1768
|
+
const c = o.getContext("2d");
|
|
1769
|
+
c.scale(2, 2), c.translate(0.5, 0.5);
|
|
1767
1770
|
}
|
|
1768
1771
|
};
|
|
1769
1772
|
}, Pt = (t) => {
|
|
@@ -1773,16 +1776,16 @@ const En = (t, e) => {
|
|
|
1773
1776
|
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : Pt(t.parentElement);
|
|
1774
1777
|
}, Bn = (t, e) => (n) => {
|
|
1775
1778
|
const o = (r) => {
|
|
1776
|
-
const a = i.getBoundingClientRect(), s = i.clientHeight,
|
|
1777
|
-
i.scroll({ top:
|
|
1779
|
+
const a = i.getBoundingClientRect(), s = i.clientHeight, u = i.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: m, height: c } = e.getAnnotationBounds(n.id), p = f.top - a.top, g = f.left - a.left, y = i.parentElement ? i.scrollTop : 0, v = i.parentElement ? i.scrollLeft : 0, h = p + y - (s - c) / 2, d = g + v - (u - m) / 2;
|
|
1780
|
+
i.scroll({ top: h, left: d, behavior: "smooth" });
|
|
1778
1781
|
}, i = Pt(t);
|
|
1779
1782
|
if (i) {
|
|
1780
1783
|
const r = e.getAnnotation(n.id), { range: a } = r.target.selector[0];
|
|
1781
1784
|
if (a && !a.collapsed)
|
|
1782
1785
|
return o(r.target), !0;
|
|
1783
1786
|
{
|
|
1784
|
-
const s = it(r.target, t), { range:
|
|
1785
|
-
if (
|
|
1787
|
+
const s = it(r.target, t), { range: u } = s.selector[0];
|
|
1788
|
+
if (u && !u.collapsed)
|
|
1786
1789
|
return o(s), !0;
|
|
1787
1790
|
}
|
|
1788
1791
|
}
|
|
@@ -1793,33 +1796,33 @@ const En = (t, e) => {
|
|
|
1793
1796
|
}), Rn = (t, e, n, o) => {
|
|
1794
1797
|
const { store: i, selection: r } = e;
|
|
1795
1798
|
let a, s;
|
|
1796
|
-
const
|
|
1799
|
+
const u = (h) => a = h;
|
|
1797
1800
|
let f = !1, m;
|
|
1798
|
-
const
|
|
1799
|
-
var
|
|
1801
|
+
const c = (h) => {
|
|
1802
|
+
var l;
|
|
1800
1803
|
if (!f)
|
|
1801
1804
|
return;
|
|
1802
|
-
!((
|
|
1805
|
+
!((l = h.target.parentElement) != null && l.closest(_)) ? s = {
|
|
1803
1806
|
annotation: Dt(),
|
|
1804
1807
|
selector: [],
|
|
1805
1808
|
creator: a,
|
|
1806
1809
|
created: /* @__PURE__ */ new Date()
|
|
1807
1810
|
} : s = void 0;
|
|
1808
1811
|
};
|
|
1809
|
-
n && t.addEventListener("selectstart",
|
|
1810
|
-
const p = pt((
|
|
1812
|
+
n && t.addEventListener("selectstart", c);
|
|
1813
|
+
const p = pt((h) => {
|
|
1811
1814
|
var E, B;
|
|
1812
1815
|
const d = document.getSelection();
|
|
1813
1816
|
if (!!((B = (E = d.anchorNode) == null ? void 0 : E.parentElement) != null && B.closest(_))) {
|
|
1814
1817
|
s = void 0;
|
|
1815
1818
|
return;
|
|
1816
1819
|
}
|
|
1817
|
-
if (
|
|
1820
|
+
if (h.timeStamp - ((m == null ? void 0 : m.timeStamp) || h.timeStamp) < 1e3 && !s && c(m), d.isCollapsed || !f || !s)
|
|
1818
1821
|
return;
|
|
1819
|
-
const
|
|
1820
|
-
if (ne(
|
|
1822
|
+
const w = d.getRangeAt(0);
|
|
1823
|
+
if (ne(w))
|
|
1821
1824
|
return;
|
|
1822
|
-
const C = Kt(
|
|
1825
|
+
const C = Kt(w.cloneRange());
|
|
1823
1826
|
(C.length !== s.selector.length || C.some((T, I) => {
|
|
1824
1827
|
var b;
|
|
1825
1828
|
return T.toString() !== ((b = s.selector[I]) == null ? void 0 : b.quote);
|
|
@@ -1833,51 +1836,51 @@ const En = (t, e) => {
|
|
|
1833
1836
|
}, N.LOCAL), r.clickSelect(s.annotation, m)));
|
|
1834
1837
|
});
|
|
1835
1838
|
n && document.addEventListener("selectionchange", p);
|
|
1836
|
-
const g = (
|
|
1837
|
-
const { target: d, timeStamp:
|
|
1838
|
-
m = { ...
|
|
1839
|
+
const g = (h) => {
|
|
1840
|
+
const { target: d, timeStamp: l, offsetX: w, offsetY: C, type: L } = h;
|
|
1841
|
+
m = { ...h, target: d, timeStamp: l, offsetX: w, offsetY: C, type: L }, f = h.button === 0;
|
|
1839
1842
|
};
|
|
1840
1843
|
t.addEventListener("pointerdown", g);
|
|
1841
|
-
const
|
|
1844
|
+
const y = (h) => {
|
|
1842
1845
|
var C;
|
|
1843
|
-
if (!!((C =
|
|
1846
|
+
if (!!((C = h.target.parentElement) != null && C.closest(_)) || !f)
|
|
1844
1847
|
return;
|
|
1845
|
-
const
|
|
1846
|
-
const { x: L, y: E } = t.getBoundingClientRect(), B = i.getAt(
|
|
1848
|
+
const l = () => {
|
|
1849
|
+
const { x: L, y: E } = t.getBoundingClientRect(), B = i.getAt(h.clientX - L, h.clientY - E);
|
|
1847
1850
|
if (B) {
|
|
1848
1851
|
const { selected: T } = r;
|
|
1849
|
-
(T.length !== 1 || T[0].id !== B.id) && r.clickSelect(B.id,
|
|
1852
|
+
(T.length !== 1 || T[0].id !== B.id) && r.clickSelect(B.id, h);
|
|
1850
1853
|
} else
|
|
1851
1854
|
r.isEmpty() || r.clear();
|
|
1852
|
-
},
|
|
1853
|
-
document.getSelection().isCollapsed &&
|
|
1855
|
+
}, w = h.timeStamp - m.timeStamp;
|
|
1856
|
+
document.getSelection().isCollapsed && w < 300 ? (s = void 0, l()) : s && r.clickSelect(s.annotation, h);
|
|
1854
1857
|
};
|
|
1855
|
-
return document.addEventListener("pointerup",
|
|
1858
|
+
return document.addEventListener("pointerup", y), {
|
|
1856
1859
|
destroy: () => {
|
|
1857
|
-
t.removeEventListener("selectstart",
|
|
1860
|
+
t.removeEventListener("selectstart", c), document.removeEventListener("selectionchange", p), t.removeEventListener("pointerdown", g), document.removeEventListener("pointerup", y);
|
|
1858
1861
|
},
|
|
1859
|
-
setUser:
|
|
1862
|
+
setUser: u
|
|
1860
1863
|
};
|
|
1861
1864
|
}, Mt = "SPANS", Vn = (t, e = {}) => {
|
|
1862
1865
|
Qt(t);
|
|
1863
1866
|
const n = Tn(e, {
|
|
1864
1867
|
annotationEnabled: !0
|
|
1865
|
-
}), o = Sn(t, n.pointerAction), { selection: i, viewport: r } = o, a = o.store, s = Ke(a),
|
|
1868
|
+
}), o = Sn(t, n.pointerAction), { selection: i, viewport: r } = o, a = o.store, s = Ke(a), u = Je(o, s, n.adapter);
|
|
1866
1869
|
let f = an();
|
|
1867
|
-
const m = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : Mt : n.renderer || Mt,
|
|
1868
|
-
if (!
|
|
1870
|
+
const m = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : Mt : n.renderer || Mt, c = m === "SPANS" ? Ce(t, o, r) : m === "CSS_HIGHLIGHTS" ? Ae(t, o, r) : m === "CANVAS" ? he(t, o, r) : void 0;
|
|
1871
|
+
if (!c)
|
|
1869
1872
|
throw `Unknown renderer implementation: ${m}`;
|
|
1870
|
-
console.debug(`Using ${m} renderer`), n.style &&
|
|
1873
|
+
console.debug(`Using ${m} renderer`), n.style && c.setStyle(n.style);
|
|
1871
1874
|
const p = Rn(t, o, n.annotationEnabled, n.offsetReferenceSelector);
|
|
1872
1875
|
return p.setUser(f), {
|
|
1873
1876
|
...tn(o, s, n.adapter),
|
|
1874
1877
|
destroy: () => {
|
|
1875
|
-
|
|
1878
|
+
c.destroy(), p.destroy(), s.destroy();
|
|
1876
1879
|
},
|
|
1877
1880
|
element: t,
|
|
1878
1881
|
getUser: () => f,
|
|
1879
|
-
setFilter: (E) =>
|
|
1880
|
-
setStyle: (E) =>
|
|
1882
|
+
setFilter: (E) => c.setFilter(E),
|
|
1883
|
+
setStyle: (E) => c.setStyle(E),
|
|
1881
1884
|
setUser: (E) => {
|
|
1882
1885
|
f = E, p.setUser(E);
|
|
1883
1886
|
},
|
|
@@ -1885,11 +1888,11 @@ const En = (t, e) => {
|
|
|
1885
1888
|
E ? i.setSelected(E) : i.clear();
|
|
1886
1889
|
},
|
|
1887
1890
|
setPresenceProvider: (E) => {
|
|
1888
|
-
E && (
|
|
1891
|
+
E && (c.setPainter(Ln(t, E, n.presence)), E.on("selectionChange", () => c.redraw()));
|
|
1889
1892
|
},
|
|
1890
|
-
setVisible: (E) =>
|
|
1891
|
-
on:
|
|
1892
|
-
off:
|
|
1893
|
+
setVisible: (E) => c.setVisible(E),
|
|
1894
|
+
on: u.on,
|
|
1895
|
+
off: u.off,
|
|
1893
1896
|
scrollIntoView: Bn(t, a),
|
|
1894
1897
|
state: o
|
|
1895
1898
|
};
|