@recogito/text-annotator 3.0.0-rc.23 → 3.0.0-rc.25
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/src/index.d.ts +1 -6
- package/dist/src/utils/cancelSingleClickEvents.d.ts +6 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/text-annotator.es.js +355 -336
- package/dist/text-annotator.es.js.map +1 -1
- package/dist/text-annotator.umd.js +2 -2
- package/dist/text-annotator.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
const
|
|
1
|
+
const H = {
|
|
2
2
|
fill: "rgb(0, 128, 255)",
|
|
3
3
|
fillOpacity: 0.18
|
|
4
|
-
},
|
|
4
|
+
}, et = {
|
|
5
5
|
fill: "rgb(0, 128, 255)",
|
|
6
6
|
fillOpacity: 0.45
|
|
7
|
-
},
|
|
8
|
-
var a;
|
|
9
|
-
const r = n ? typeof n == "function" ? n(t.annotation, t.state, i) : n : (
|
|
7
|
+
}, qt = (t, e, n, o, i) => {
|
|
8
|
+
var a, s;
|
|
9
|
+
const r = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ? et : H) : n : (s = t.state) != null && s.selected ? et : H;
|
|
10
10
|
return o && o.paint(t, e) || r;
|
|
11
|
-
},
|
|
12
|
-
let n;
|
|
13
|
-
return (...o) => {
|
|
14
|
-
clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);
|
|
15
|
-
};
|
|
16
|
-
}, It = "not-annotatable", Y = `.${It}`, Gt = (t) => {
|
|
11
|
+
}, It = "not-annotatable", k = `.${It}`, jt = (t) => {
|
|
17
12
|
var n;
|
|
18
13
|
const e = t.commonAncestorContainer;
|
|
19
|
-
return e instanceof HTMLElement ? !e.closest(
|
|
20
|
-
},
|
|
14
|
+
return e instanceof HTMLElement ? !e.closest(k) : !((n = e.parentElement) != null && n.closest(k));
|
|
15
|
+
}, Gt = function* (t) {
|
|
21
16
|
const e = document.createNodeIterator(
|
|
22
17
|
t.commonAncestorContainer,
|
|
23
18
|
NodeFilter.SHOW_ELEMENT,
|
|
24
|
-
(o) => o instanceof HTMLElement && o.classList.contains(It) && !o.parentElement.closest(
|
|
19
|
+
(o) => o instanceof HTMLElement && o.classList.contains(It) && !o.parentElement.closest(k) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
25
20
|
);
|
|
26
21
|
let n;
|
|
27
22
|
for (; n = e.nextNode(); )
|
|
28
23
|
n instanceof HTMLElement && (yield n);
|
|
29
|
-
},
|
|
30
|
-
if (!
|
|
24
|
+
}, Kt = (t) => {
|
|
25
|
+
if (!jt(t))
|
|
31
26
|
return [];
|
|
32
27
|
const e = [];
|
|
33
28
|
let n = null;
|
|
34
|
-
for (const o of
|
|
29
|
+
for (const o of Gt(t)) {
|
|
35
30
|
let i;
|
|
36
31
|
n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
|
|
37
32
|
}
|
|
@@ -40,12 +35,22 @@ const $ = {
|
|
|
40
35
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
41
36
|
}
|
|
42
37
|
return e.length > 0 ? e : [t];
|
|
43
|
-
},
|
|
38
|
+
}, ut = (t) => {
|
|
44
39
|
const e = t.cloneContents();
|
|
45
|
-
return e.querySelectorAll(
|
|
40
|
+
return e.querySelectorAll(k).forEach((n) => n.remove()), e;
|
|
41
|
+
}, Qt = (t) => {
|
|
42
|
+
t.addEventListener("click", (e) => {
|
|
43
|
+
// Allow clicks within not-annotatable elements
|
|
44
|
+
!e.target.closest(k) && !e.target.closest("a") && e.preventDefault();
|
|
45
|
+
});
|
|
46
|
+
}, ft = (t, e = 10) => {
|
|
47
|
+
let n;
|
|
48
|
+
return (...o) => {
|
|
49
|
+
clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);
|
|
50
|
+
};
|
|
46
51
|
}, Ln = (t) => {
|
|
47
52
|
const e = t.cloneContents();
|
|
48
|
-
return e.querySelectorAll(
|
|
53
|
+
return e.querySelectorAll(k).forEach((n) => n.remove()), e;
|
|
49
54
|
}, mt = (t, e) => {
|
|
50
55
|
const n = document.createNodeIterator(e);
|
|
51
56
|
let o = 0, i = n.nextNode();
|
|
@@ -67,29 +72,29 @@ const $ = {
|
|
|
67
72
|
startOffset: o,
|
|
68
73
|
endContainer: i,
|
|
69
74
|
endOffset: r
|
|
70
|
-
} = t, a = Array.from(e.childNodes).map((
|
|
71
|
-
const m =
|
|
72
|
-
return
|
|
75
|
+
} = t, a = Array.from(e.childNodes).map((l) => {
|
|
76
|
+
const m = l.cloneNode(!0);
|
|
77
|
+
return l.nodeName === "CANVAS" ? l : m;
|
|
73
78
|
}), s = mt(n, e), u = mt(i, e), f = () => {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const m = bt(s,
|
|
79
|
+
const l = e;
|
|
80
|
+
l.replaceChildren(...a);
|
|
81
|
+
const m = bt(s, l), p = bt(u, l);
|
|
77
82
|
return t.setStart(m, o), t.setEnd(p, r), t;
|
|
78
|
-
}, b = (
|
|
83
|
+
}, b = (l) => {
|
|
79
84
|
const m = document.createElement("SPAN");
|
|
80
|
-
return
|
|
85
|
+
return l.surroundContents(m), m;
|
|
81
86
|
};
|
|
82
87
|
if (n === i)
|
|
83
88
|
throw "Not implemented";
|
|
84
89
|
{
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
const m = b(
|
|
90
|
+
const l = document.createRange();
|
|
91
|
+
l.selectNodeContents(n), l.setStart(n, o);
|
|
92
|
+
const m = b(l), p = document.createRange();
|
|
88
93
|
p.selectNode(i), p.setEnd(i, r);
|
|
89
94
|
const w = b(p), h = Zt(t).reverse().map((d) => {
|
|
90
95
|
var y;
|
|
91
|
-
const
|
|
92
|
-
return (y = d.parentNode) == null || y.insertBefore(
|
|
96
|
+
const c = document.createElement("SPAN");
|
|
97
|
+
return (y = d.parentNode) == null || y.insertBefore(c, d), c.appendChild(d), c;
|
|
93
98
|
});
|
|
94
99
|
return { unwrap: f, nodes: [m, ...h, w] };
|
|
95
100
|
}
|
|
@@ -115,14 +120,14 @@ const $ = {
|
|
|
115
120
|
}, te = (t, e, n = 10, o) => {
|
|
116
121
|
const i = o ? t.startContainer.parentElement.closest(o) : e, r = document.createRange();
|
|
117
122
|
r.setStart(i, 0), r.setEnd(t.startContainer, t.startOffset);
|
|
118
|
-
const a =
|
|
123
|
+
const a = ut(r).textContent, s = document.createRange();
|
|
119
124
|
s.setStart(t.endContainer, t.endOffset), i === document.body ? s.setEnd(i, i.childNodes.length) : s.setEndAfter(i);
|
|
120
|
-
const u =
|
|
125
|
+
const u = ut(s).textContent;
|
|
121
126
|
return {
|
|
122
127
|
prefix: a.substring(a.length - n),
|
|
123
128
|
suffix: u.substring(0, n)
|
|
124
129
|
};
|
|
125
|
-
},
|
|
130
|
+
}, Y = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), ee = (t, e) => {
|
|
126
131
|
const n = (r) => Math.round(r * 10) / 10, o = {
|
|
127
132
|
top: n(t.top),
|
|
128
133
|
bottom: n(t.bottom),
|
|
@@ -173,16 +178,16 @@ const $ = {
|
|
|
173
178
|
}, []), ie = (t, e, n) => {
|
|
174
179
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
175
180
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
176
|
-
const r =
|
|
181
|
+
const r = ut(o).textContent, a = t.toString(), s = r.length || 0, u = s + a.length;
|
|
177
182
|
return n ? { quote: a, start: s, end: u, range: t, offsetReference: i } : { quote: a, start: s, end: u, range: t };
|
|
178
183
|
}, Mt = (t, e) => {
|
|
179
|
-
var b,
|
|
184
|
+
var b, l;
|
|
180
185
|
const { start: n, end: o } = t, i = t.offsetReference || e, r = document.createNodeIterator(
|
|
181
186
|
e,
|
|
182
187
|
NodeFilter.SHOW_TEXT,
|
|
183
188
|
(m) => {
|
|
184
189
|
var p;
|
|
185
|
-
return (p = m.parentElement) != null && p.closest(
|
|
190
|
+
return (p = m.parentElement) != null && p.closest(k) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
186
191
|
}
|
|
187
192
|
);
|
|
188
193
|
let a = 0;
|
|
@@ -202,7 +207,7 @@ const $ = {
|
|
|
202
207
|
u = r.nextNode();
|
|
203
208
|
}
|
|
204
209
|
for (; u !== null; ) {
|
|
205
|
-
const m = ((
|
|
210
|
+
const m = ((l = u.textContent) == null ? void 0 : l.length) || 0;
|
|
206
211
|
if (a + m >= o) {
|
|
207
212
|
s.setEnd(u, o - a);
|
|
208
213
|
break;
|
|
@@ -213,10 +218,10 @@ const $ = {
|
|
|
213
218
|
...t,
|
|
214
219
|
range: s
|
|
215
220
|
};
|
|
216
|
-
},
|
|
221
|
+
}, nt = (t, e) => Y(t.selector) ? t : {
|
|
217
222
|
...t,
|
|
218
223
|
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : Mt(n, e))
|
|
219
|
-
},
|
|
224
|
+
}, ot = (t, e) => Y(t.target.selector) ? t : { ...t, target: nt(t.target, e) }, re = (t) => {
|
|
220
225
|
var i;
|
|
221
226
|
const { startContainer: e, endContainer: n } = t;
|
|
222
227
|
if (e.nodeType === Node.TEXT_NODE && n.nodeType === Node.TEXT_NODE)
|
|
@@ -242,18 +247,18 @@ const $ = {
|
|
|
242
247
|
}, pt = (t, e, n, o) => {
|
|
243
248
|
const { store: i, selection: r, hover: a } = e;
|
|
244
249
|
let s, u, f;
|
|
245
|
-
const b = ae(n),
|
|
250
|
+
const b = ae(n), l = (g) => {
|
|
246
251
|
const { x: A, y: x } = t.getBoundingClientRect(), S = i.getAt(g.clientX - A, g.clientY - x);
|
|
247
252
|
S && (!u || u(S)) ? a.current !== S.id && (t.classList.add("hovered"), a.set(S.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
|
|
248
253
|
};
|
|
249
|
-
t.addEventListener("pointermove",
|
|
254
|
+
t.addEventListener("pointermove", l);
|
|
250
255
|
const m = (g = !1) => {
|
|
251
256
|
f && f.clear();
|
|
252
|
-
const A = se(t), { minX: x, minY: S, maxX: N, maxY: B } = A, _ = u ? i.getIntersecting(x, S, N, B).filter(({ annotation: X }) => u(X)) : i.getIntersecting(x, S, N, B),
|
|
253
|
-
const
|
|
254
|
-
return { annotation: X, rects:
|
|
257
|
+
const A = se(t), { minX: x, minY: S, maxX: N, maxY: B } = A, _ = u ? i.getIntersecting(x, S, N, B).filter(({ annotation: X }) => u(X)) : i.getIntersecting(x, S, N, B), $t = r.selected.map(({ id: X }) => X), Pt = _.map(({ annotation: X, rects: zt }) => {
|
|
258
|
+
const Ft = $t.includes(X.id), Wt = X.id === a.current;
|
|
259
|
+
return { annotation: X, rects: zt, state: { selected: Ft, hover: Wt, custom: {} } };
|
|
255
260
|
});
|
|
256
|
-
o.redraw(
|
|
261
|
+
o.redraw(Pt, A, s, f, g), setTimeout(() => b(_.map(({ annotation: X }) => X)), 1);
|
|
257
262
|
}, p = (g) => {
|
|
258
263
|
f = g, m();
|
|
259
264
|
}, w = (g) => {
|
|
@@ -262,20 +267,20 @@ const $ = {
|
|
|
262
267
|
u = g, m(!1);
|
|
263
268
|
}, h = () => m();
|
|
264
269
|
i.observe(h);
|
|
265
|
-
const d = r.subscribe(() => m()),
|
|
266
|
-
document.addEventListener("scroll",
|
|
270
|
+
const d = r.subscribe(() => m()), c = () => m(!0);
|
|
271
|
+
document.addEventListener("scroll", c, { capture: !0, passive: !0 });
|
|
267
272
|
const y = ft(() => {
|
|
268
273
|
i.recalculatePositions(), f && f.reset(), m();
|
|
269
274
|
});
|
|
270
275
|
window.addEventListener("resize", y);
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
const
|
|
276
|
+
const T = new ResizeObserver(y);
|
|
277
|
+
T.observe(t);
|
|
278
|
+
const C = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((g) => {
|
|
274
279
|
g.every((x) => x.target === t || t.contains(x.target)) || m(!0);
|
|
275
280
|
});
|
|
276
|
-
return E.observe(document.body,
|
|
281
|
+
return E.observe(document.body, C), {
|
|
277
282
|
destroy: () => {
|
|
278
|
-
t.removeEventListener("pointermove",
|
|
283
|
+
t.removeEventListener("pointermove", l), o.destroy(), i.unobserve(h), d(), document.removeEventListener("scroll", c), window.removeEventListener("resize", y), T.disconnect(), E.disconnect();
|
|
279
284
|
},
|
|
280
285
|
redraw: m,
|
|
281
286
|
setStyle: w,
|
|
@@ -283,33 +288,46 @@ const $ = {
|
|
|
283
288
|
setPainter: p,
|
|
284
289
|
setVisible: o.setVisible
|
|
285
290
|
};
|
|
286
|
-
},
|
|
291
|
+
}, le = () => {
|
|
287
292
|
const t = document.createElement("canvas");
|
|
288
293
|
return t.width = window.innerWidth, t.height = window.innerHeight, t.className = "r6o-highlight-layer bg", t;
|
|
289
|
-
},
|
|
294
|
+
}, ce = (t, e) => {
|
|
290
295
|
t.width = window.innerWidth, t.height = window.innerHeight;
|
|
291
296
|
}, de = (t) => {
|
|
292
297
|
t.classList.add("r6o-annotatable");
|
|
293
|
-
const e =
|
|
298
|
+
const e = le(), n = e.getContext("2d");
|
|
294
299
|
t.insertBefore(e, t.firstChild);
|
|
295
300
|
const o = (s, u, f, b) => requestAnimationFrame(() => {
|
|
296
|
-
const { width:
|
|
297
|
-
n.clearRect(-0.5, -0.5,
|
|
301
|
+
const { width: l, height: m } = e;
|
|
302
|
+
n.clearRect(-0.5, -0.5, l + 1, m + 1), b && b.clear();
|
|
298
303
|
const { top: p, left: w } = u;
|
|
299
304
|
s.forEach((v) => {
|
|
300
|
-
var
|
|
301
|
-
const h = f ? typeof f == "function" ? f(v.annotation, v.state) : f : (
|
|
305
|
+
var T;
|
|
306
|
+
const h = f ? typeof f == "function" ? f(v.annotation, v.state) : f : (T = v.state) != null && T.selected ? et : H, d = b && b.paint(v, u) || h, c = v.rects.map(({ x: C, y: E, width: R, height: g }) => ({
|
|
302
307
|
x: C + w,
|
|
303
|
-
y:
|
|
304
|
-
width:
|
|
305
|
-
height:
|
|
306
|
-
}));
|
|
307
|
-
n.fillStyle = d.fill, n.globalAlpha = d.fillOpacity || 1, l.forEach(({ x: C, y: T, width: E, height: R }) => n.fillRect(C, T - 2.5, E, R + 5)), d.underlineColor && (n.globalAlpha = 1, n.strokeStyle = d.underlineColor, l.forEach(({ x: C, y: T, width: E, height: R }) => {
|
|
308
|
-
n.beginPath(), n.moveTo(C, T + R + 4), n.lineTo(C + E, T + R + 4), n.stroke();
|
|
308
|
+
y: E + p,
|
|
309
|
+
width: R,
|
|
310
|
+
height: g
|
|
309
311
|
}));
|
|
312
|
+
n.fillStyle = d.fill, n.globalAlpha = d.fillOpacity || 1;
|
|
313
|
+
const y = 5;
|
|
314
|
+
if (c.forEach(
|
|
315
|
+
({ x: C, y: E, width: R, height: g }) => n.fillRect(
|
|
316
|
+
C,
|
|
317
|
+
E - y / 2,
|
|
318
|
+
R,
|
|
319
|
+
g + y
|
|
320
|
+
)
|
|
321
|
+
), d.underlineColor) {
|
|
322
|
+
n.globalAlpha = 1, n.strokeStyle = d.underlineColor, n.lineWidth = d.underlineThickness ?? 1;
|
|
323
|
+
const C = y / 2 + (d.underlineOffset ?? 0);
|
|
324
|
+
c.forEach(({ x: E, y: R, width: g, height: A }) => {
|
|
325
|
+
n.beginPath(), n.moveTo(E, R + A + C), n.lineTo(E + g, R + A + C), n.stroke();
|
|
326
|
+
});
|
|
327
|
+
}
|
|
310
328
|
});
|
|
311
329
|
}), i = ft(() => {
|
|
312
|
-
|
|
330
|
+
ce(e);
|
|
313
331
|
});
|
|
314
332
|
return window.addEventListener("resize", i), {
|
|
315
333
|
destroy: () => {
|
|
@@ -331,7 +349,7 @@ var he = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, D = function(t) {
|
|
|
331
349
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
332
350
|
}, vt = function(t) {
|
|
333
351
|
return { r: U(t.r, 0, 255), g: U(t.g, 0, 255), b: U(t.b, 0, 255), a: U(t.a) };
|
|
334
|
-
},
|
|
352
|
+
}, it = function(t) {
|
|
335
353
|
return { r: O(t.r), g: O(t.g), b: O(t.b), a: O(t.a, 3) };
|
|
336
354
|
}, fe = /^#([0-9a-f]{3,8})$/i, K = function(t) {
|
|
337
355
|
var e = t.toString(16);
|
|
@@ -392,10 +410,10 @@ var he = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, D = function(t) {
|
|
|
392
410
|
return [null, void 0];
|
|
393
411
|
}, ve = function(t) {
|
|
394
412
|
return typeof t == "string" ? Et(t.trim(), At.string) : typeof t == "object" && t !== null ? Et(t, At.object) : [null, void 0];
|
|
395
|
-
},
|
|
413
|
+
}, rt = function(t, e) {
|
|
396
414
|
var n = G(t);
|
|
397
415
|
return { h: n.h, s: U(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
398
|
-
},
|
|
416
|
+
}, st = function(t) {
|
|
399
417
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
400
418
|
}, St = function(t, e) {
|
|
401
419
|
var n = G(t);
|
|
@@ -407,18 +425,18 @@ var he = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, D = function(t) {
|
|
|
407
425
|
return t.prototype.isValid = function() {
|
|
408
426
|
return this.parsed !== null;
|
|
409
427
|
}, t.prototype.brightness = function() {
|
|
410
|
-
return O(
|
|
428
|
+
return O(st(this.rgba), 2);
|
|
411
429
|
}, t.prototype.isDark = function() {
|
|
412
|
-
return
|
|
430
|
+
return st(this.rgba) < 0.5;
|
|
413
431
|
}, t.prototype.isLight = function() {
|
|
414
|
-
return
|
|
432
|
+
return st(this.rgba) >= 0.5;
|
|
415
433
|
}, t.prototype.toHex = function() {
|
|
416
|
-
return e =
|
|
434
|
+
return e = it(this.rgba), n = e.r, o = e.g, i = e.b, a = (r = e.a) < 1 ? K(O(255 * r)) : "", "#" + K(n) + K(o) + K(i) + a;
|
|
417
435
|
var e, n, o, i, r, a;
|
|
418
436
|
}, t.prototype.toRgb = function() {
|
|
419
|
-
return
|
|
437
|
+
return it(this.rgba);
|
|
420
438
|
}, t.prototype.toRgbString = function() {
|
|
421
|
-
return e =
|
|
439
|
+
return e = it(this.rgba), n = e.r, o = e.g, i = e.b, (r = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + r + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
422
440
|
var e, n, o, i, r;
|
|
423
441
|
}, t.prototype.toHsl = function() {
|
|
424
442
|
return wt(G(this.rgba));
|
|
@@ -432,11 +450,11 @@ var he = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, D = function(t) {
|
|
|
432
450
|
return V({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
433
451
|
var e;
|
|
434
452
|
}, t.prototype.saturate = function(e) {
|
|
435
|
-
return e === void 0 && (e = 0.1), V(
|
|
453
|
+
return e === void 0 && (e = 0.1), V(rt(this.rgba, e));
|
|
436
454
|
}, t.prototype.desaturate = function(e) {
|
|
437
|
-
return e === void 0 && (e = 0.1), V(
|
|
455
|
+
return e === void 0 && (e = 0.1), V(rt(this.rgba, -e));
|
|
438
456
|
}, t.prototype.grayscale = function() {
|
|
439
|
-
return V(
|
|
457
|
+
return V(rt(this.rgba, -1));
|
|
440
458
|
}, t.prototype.lighten = function(e) {
|
|
441
459
|
return e === void 0 && (e = 0.1), V(St(this.rgba, e));
|
|
442
460
|
}, t.prototype.darken = function(e) {
|
|
@@ -456,7 +474,7 @@ var he = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, D = function(t) {
|
|
|
456
474
|
return t instanceof Ct ? t : new Ct(t);
|
|
457
475
|
};
|
|
458
476
|
const ye = (t) => [
|
|
459
|
-
`background-color:${V((t == null ? void 0 : t.fill) ||
|
|
477
|
+
`background-color:${V((t == null ? void 0 : t.fill) || H.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? H.fillOpacity : t.fillOpacity).toHex()}`,
|
|
460
478
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
461
479
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
462
480
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
@@ -474,23 +492,23 @@ const ye = (t) => [
|
|
|
474
492
|
},
|
|
475
493
|
redraw: (r, a, s, u) => {
|
|
476
494
|
u && u.clear();
|
|
477
|
-
const f = new Set(r.map((
|
|
478
|
-
Array.from(e).filter((
|
|
479
|
-
const b = r.map((
|
|
495
|
+
const f = new Set(r.map((l) => l.annotation.id));
|
|
496
|
+
Array.from(e).filter((l) => !f.has(l));
|
|
497
|
+
const b = r.map((l) => {
|
|
480
498
|
var w;
|
|
481
|
-
const m = s ? typeof s == "function" ? s(
|
|
482
|
-
return `::highlight(_${
|
|
499
|
+
const m = s ? typeof s == "function" ? s(l.annotation, l.state) : s : (w = l.state) != null && w.selected ? et : H, p = u && u.paint(l, a) || m;
|
|
500
|
+
return `::highlight(_${l.annotation.id}) { ${ye(p)} }`;
|
|
483
501
|
});
|
|
484
502
|
t.innerHTML = b.join(`
|
|
485
|
-
`), CSS.highlights.clear(), r.forEach(({ annotation:
|
|
486
|
-
const m =
|
|
487
|
-
CSS.highlights.set(`_${
|
|
503
|
+
`), CSS.highlights.clear(), r.forEach(({ annotation: l }) => {
|
|
504
|
+
const m = l.target.selector.map((w) => w.range), p = new Highlight(...m);
|
|
505
|
+
CSS.highlights.set(`_${l.id}`, p);
|
|
488
506
|
}), e = f;
|
|
489
507
|
}
|
|
490
508
|
};
|
|
491
509
|
}, xe = (t, e, n) => pt(t, e, n, we());
|
|
492
510
|
var Tt = Object.prototype.hasOwnProperty;
|
|
493
|
-
function
|
|
511
|
+
function ht(t, e) {
|
|
494
512
|
var n, o;
|
|
495
513
|
if (t === e)
|
|
496
514
|
return !0;
|
|
@@ -501,14 +519,14 @@ function ut(t, e) {
|
|
|
501
519
|
return t.toString() === e.toString();
|
|
502
520
|
if (n === Array) {
|
|
503
521
|
if ((o = t.length) === e.length)
|
|
504
|
-
for (; o-- &&
|
|
522
|
+
for (; o-- && ht(t[o], e[o]); )
|
|
505
523
|
;
|
|
506
524
|
return o === -1;
|
|
507
525
|
}
|
|
508
526
|
if (!n || typeof t == "object") {
|
|
509
527
|
o = 0;
|
|
510
528
|
for (n in t)
|
|
511
|
-
if (Tt.call(t, n) && ++o && !Tt.call(e, n) || !(n in e) || !
|
|
529
|
+
if (Tt.call(t, n) && ++o && !Tt.call(e, n) || !(n in e) || !ht(t[n], e[n]))
|
|
512
530
|
return !1;
|
|
513
531
|
return Object.keys(e).length === o;
|
|
514
532
|
}
|
|
@@ -528,7 +546,7 @@ const Ae = (t, e) => {
|
|
|
528
546
|
e.remove();
|
|
529
547
|
},
|
|
530
548
|
redraw: (a, s, u, f, b) => {
|
|
531
|
-
if (
|
|
549
|
+
if (ht(n, a) && b)
|
|
532
550
|
return;
|
|
533
551
|
e.innerHTML = "";
|
|
534
552
|
const m = a.reduce((p, { rects: w }) => [...p, ...w], []);
|
|
@@ -536,8 +554,8 @@ const Ae = (t, e) => {
|
|
|
536
554
|
const w = p.rects.map((v) => {
|
|
537
555
|
const h = document.createElement("span");
|
|
538
556
|
h.className = "r6o-annotation", h.dataset.annotation = p.annotation.id, h.style.left = `${v.x}px`, h.style.top = `${v.y}px`, h.style.width = `${v.width}px`, h.style.height = `${v.height}px`;
|
|
539
|
-
const d = Ae(v, m),
|
|
540
|
-
return h.style.backgroundColor = y,
|
|
557
|
+
const d = Ae(v, m), c = qt(p, s, u, f, d), y = V((c == null ? void 0 : c.fill) || H.fill).alpha((c == null ? void 0 : c.fillOpacity) === void 0 ? H.fillOpacity : c.fillOpacity).toHex();
|
|
558
|
+
return h.style.backgroundColor = y, c.underlineStyle && (h.style.borderStyle = c.underlineStyle), c.underlineColor && (h.style.borderColor = c.underlineColor), c.underlineThickness && (h.style.borderBottomWidth = `${c.underlineThickness}px`), c.underlineOffset && (h.style.paddingBottom = `${c.underlineOffset}px`), e.appendChild(h), h;
|
|
541
559
|
});
|
|
542
560
|
return { id: p.annotation.id, spans: w };
|
|
543
561
|
}), n = a;
|
|
@@ -596,33 +614,33 @@ function F(t, e) {
|
|
|
596
614
|
}
|
|
597
615
|
return t !== t && e !== e;
|
|
598
616
|
}
|
|
599
|
-
function
|
|
617
|
+
function at() {
|
|
600
618
|
}
|
|
601
619
|
function Le(t, e) {
|
|
602
620
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
603
621
|
}
|
|
604
|
-
const
|
|
605
|
-
function gt(t, e =
|
|
622
|
+
const $ = [];
|
|
623
|
+
function gt(t, e = at) {
|
|
606
624
|
let n;
|
|
607
625
|
const o = /* @__PURE__ */ new Set();
|
|
608
626
|
function i(s) {
|
|
609
627
|
if (Le(t, s) && (t = s, n)) {
|
|
610
|
-
const u =
|
|
628
|
+
const u = !$.length;
|
|
611
629
|
for (const f of o)
|
|
612
|
-
f[1](),
|
|
630
|
+
f[1](), $.push(f, t);
|
|
613
631
|
if (u) {
|
|
614
|
-
for (let f = 0; f <
|
|
615
|
-
|
|
616
|
-
|
|
632
|
+
for (let f = 0; f < $.length; f += 2)
|
|
633
|
+
$[f][0]($[f + 1]);
|
|
634
|
+
$.length = 0;
|
|
617
635
|
}
|
|
618
636
|
}
|
|
619
637
|
}
|
|
620
638
|
function r(s) {
|
|
621
639
|
i(s(t));
|
|
622
640
|
}
|
|
623
|
-
function a(s, u =
|
|
641
|
+
function a(s, u = at) {
|
|
624
642
|
const f = [s, u];
|
|
625
|
-
return o.add(f), o.size === 1 && (n = e(i, r) ||
|
|
643
|
+
return o.add(f), o.size === 1 && (n = e(i, r) || at), s(t), () => {
|
|
626
644
|
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
627
645
|
};
|
|
628
646
|
}
|
|
@@ -645,36 +663,36 @@ const Be = (t) => {
|
|
|
645
663
|
set: n
|
|
646
664
|
};
|
|
647
665
|
};
|
|
648
|
-
var
|
|
649
|
-
const
|
|
650
|
-
const { subscribe: n, set: o } = gt(
|
|
651
|
-
let i =
|
|
652
|
-
n((
|
|
653
|
-
const r = () => o(
|
|
654
|
-
var
|
|
655
|
-
return ((
|
|
656
|
-
}, s = (
|
|
666
|
+
var Oe = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(Oe || {});
|
|
667
|
+
const lt = { selected: [] }, Ie = (t, e = "EDIT") => {
|
|
668
|
+
const { subscribe: n, set: o } = gt(lt);
|
|
669
|
+
let i = lt;
|
|
670
|
+
n((l) => i = l);
|
|
671
|
+
const r = () => o(lt), a = () => {
|
|
672
|
+
var l;
|
|
673
|
+
return ((l = i.selected) == null ? void 0 : l.length) === 0;
|
|
674
|
+
}, s = (l) => {
|
|
657
675
|
if (i.selected.length === 0)
|
|
658
676
|
return !1;
|
|
659
|
-
const m = typeof
|
|
677
|
+
const m = typeof l == "string" ? l : l.id;
|
|
660
678
|
return i.selected.some((p) => p.id === m);
|
|
661
|
-
}, u = (
|
|
662
|
-
const p = t.getAnnotation(
|
|
679
|
+
}, u = (l, m) => {
|
|
680
|
+
const p = t.getAnnotation(l);
|
|
663
681
|
if (p) {
|
|
664
|
-
const w =
|
|
665
|
-
o(w === "EDIT" ? { selected: [{ id:
|
|
682
|
+
const w = Me(p, e);
|
|
683
|
+
o(w === "EDIT" ? { selected: [{ id: l, editable: !0 }], pointerEvent: m } : w === "SELECT" ? { selected: [{ id: l }], pointerEvent: m } : { selected: [], pointerEvent: m });
|
|
666
684
|
} else
|
|
667
|
-
console.warn("Invalid selection: " +
|
|
668
|
-
}, f = (
|
|
669
|
-
const p = Array.isArray(
|
|
670
|
-
o({ selected: w.map(({ id: v }) => ({ id: v, editable: m })) }), w.length !== p.length && console.warn("Invalid selection",
|
|
671
|
-
}, b = (
|
|
685
|
+
console.warn("Invalid selection: " + l);
|
|
686
|
+
}, f = (l, m = !0) => {
|
|
687
|
+
const p = Array.isArray(l) ? l : [l], w = p.map((v) => t.getAnnotation(v)).filter(Boolean);
|
|
688
|
+
o({ selected: w.map(({ id: v }) => ({ id: v, editable: m })) }), w.length !== p.length && console.warn("Invalid selection", l);
|
|
689
|
+
}, b = (l) => {
|
|
672
690
|
if (i.selected.length === 0)
|
|
673
691
|
return !1;
|
|
674
692
|
const { selected: m } = i;
|
|
675
|
-
m.filter(({ id: p }) =>
|
|
693
|
+
m.filter(({ id: p }) => l.includes(p)).length > 0 && o({ selected: m.filter(({ id: p }) => !l.includes(p)) });
|
|
676
694
|
};
|
|
677
|
-
return t.observe(({ changes:
|
|
695
|
+
return t.observe(({ changes: l }) => b((l.deleted || []).map((m) => m.id))), {
|
|
678
696
|
clear: r,
|
|
679
697
|
clickSelect: u,
|
|
680
698
|
get selected() {
|
|
@@ -688,32 +706,32 @@ const at = { selected: [] }, Oe = (t, e = "EDIT") => {
|
|
|
688
706
|
setSelected: f,
|
|
689
707
|
subscribe: n
|
|
690
708
|
};
|
|
691
|
-
},
|
|
709
|
+
}, Me = (t, e) => typeof e == "function" ? e(t) || "EDIT" : e || "EDIT";
|
|
692
710
|
let J;
|
|
693
|
-
const
|
|
694
|
-
function
|
|
711
|
+
const Ue = new Uint8Array(16);
|
|
712
|
+
function Ve() {
|
|
695
713
|
if (!J && (J = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !J))
|
|
696
714
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
697
|
-
return J(
|
|
715
|
+
return J(Ue);
|
|
698
716
|
}
|
|
699
717
|
const M = [];
|
|
700
718
|
for (let t = 0; t < 256; ++t)
|
|
701
719
|
M.push((t + 256).toString(16).slice(1));
|
|
702
|
-
function
|
|
720
|
+
function _e(t, e = 0) {
|
|
703
721
|
return M[t[e + 0]] + M[t[e + 1]] + M[t[e + 2]] + M[t[e + 3]] + "-" + M[t[e + 4]] + M[t[e + 5]] + "-" + M[t[e + 6]] + M[t[e + 7]] + "-" + M[t[e + 8]] + M[t[e + 9]] + "-" + M[t[e + 10]] + M[t[e + 11]] + M[t[e + 12]] + M[t[e + 13]] + M[t[e + 14]] + M[t[e + 15]];
|
|
704
722
|
}
|
|
705
|
-
const
|
|
706
|
-
randomUUID:
|
|
723
|
+
const Xe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Lt = {
|
|
724
|
+
randomUUID: Xe
|
|
707
725
|
};
|
|
708
|
-
function
|
|
726
|
+
function De(t, e, n) {
|
|
709
727
|
if (Lt.randomUUID && !e && !t)
|
|
710
728
|
return Lt.randomUUID();
|
|
711
729
|
t = t || {};
|
|
712
|
-
const o = t.random || (t.rng ||
|
|
713
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
730
|
+
const o = t.random || (t.rng || Ve)();
|
|
731
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, _e(o);
|
|
714
732
|
}
|
|
715
|
-
const
|
|
716
|
-
id:
|
|
733
|
+
const On = (t, e, n, o) => ({
|
|
734
|
+
id: De(),
|
|
717
735
|
annotation: t.id,
|
|
718
736
|
created: n || /* @__PURE__ */ new Date(),
|
|
719
737
|
creator: o,
|
|
@@ -724,18 +742,18 @@ const De = (t, e, n, o) => ({
|
|
|
724
742
|
}, Ye = (t, e) => {
|
|
725
743
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
726
744
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
727
|
-
},
|
|
745
|
+
}, He = (t, e) => e.bodies.map((n) => {
|
|
728
746
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
729
747
|
return { newBody: n, oldBody: o && !F(o, n) ? o : void 0 };
|
|
730
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })),
|
|
731
|
-
const n = ke(t, e), o = Ye(t, e), i =
|
|
748
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), $e = (t, e) => !F(t.target, e.target), Dt = (t, e) => {
|
|
749
|
+
const n = ke(t, e), o = Ye(t, e), i = He(t, e);
|
|
732
750
|
return {
|
|
733
751
|
oldValue: t,
|
|
734
752
|
newValue: e,
|
|
735
753
|
bodiesCreated: n.length > 0 ? n : void 0,
|
|
736
754
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
737
755
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
738
|
-
targetUpdated:
|
|
756
|
+
targetUpdated: $e(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
739
757
|
};
|
|
740
758
|
};
|
|
741
759
|
var L = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(L || {});
|
|
@@ -762,22 +780,22 @@ const Pe = (t, e) => {
|
|
|
762
780
|
} else
|
|
763
781
|
return !0;
|
|
764
782
|
}, ze = (t, e) => {
|
|
765
|
-
const n = new Set((t.created || []).map((
|
|
766
|
-
...(t.created || []).filter((
|
|
783
|
+
const n = new Set((t.created || []).map((l) => l.id)), o = new Set((t.updated || []).map(({ newValue: l }) => l.id)), i = new Set((e.created || []).map((l) => l.id)), r = new Set((e.deleted || []).map((l) => l.id)), a = new Set((e.updated || []).map(({ oldValue: l }) => l.id)), s = new Set((e.updated || []).filter(({ oldValue: l }) => n.has(l.id) || o.has(l.id)).map(({ oldValue: l }) => l.id)), u = [
|
|
784
|
+
...(t.created || []).filter((l) => !r.has(l.id)).map((l) => a.has(l.id) ? e.updated.find(({ oldValue: m }) => m.id === l.id).newValue : l),
|
|
767
785
|
...e.created || []
|
|
768
786
|
], f = [
|
|
769
|
-
...(t.deleted || []).filter((
|
|
770
|
-
...(e.deleted || []).filter((
|
|
787
|
+
...(t.deleted || []).filter((l) => !i.has(l.id)),
|
|
788
|
+
...(e.deleted || []).filter((l) => !n.has(l.id))
|
|
771
789
|
], b = [
|
|
772
|
-
...(t.updated || []).filter(({ newValue:
|
|
773
|
-
const { oldValue: m, newValue: p } =
|
|
790
|
+
...(t.updated || []).filter(({ newValue: l }) => !r.has(l.id)).map((l) => {
|
|
791
|
+
const { oldValue: m, newValue: p } = l;
|
|
774
792
|
if (a.has(p.id)) {
|
|
775
793
|
const w = e.updated.find((v) => v.oldValue.id === p.id).newValue;
|
|
776
|
-
return
|
|
794
|
+
return Dt(m, w);
|
|
777
795
|
} else
|
|
778
|
-
return
|
|
796
|
+
return l;
|
|
779
797
|
}),
|
|
780
|
-
...(e.updated || []).filter(({ oldValue:
|
|
798
|
+
...(e.updated || []).filter(({ oldValue: l }) => !s.has(l.id))
|
|
781
799
|
];
|
|
782
800
|
return { created: u, deleted: f, updated: b };
|
|
783
801
|
}, Fe = (t) => t.id !== void 0, We = () => {
|
|
@@ -804,7 +822,7 @@ const Pe = (t, e) => {
|
|
|
804
822
|
}, s = (g, A) => {
|
|
805
823
|
const x = typeof g == "string" ? A : g, S = typeof g == "string" ? g : g.id, N = t.get(S);
|
|
806
824
|
if (N) {
|
|
807
|
-
const B =
|
|
825
|
+
const B = Dt(N, x);
|
|
808
826
|
return S === x.id ? t.set(S, x) : (t.delete(S), t.set(x.id, x)), N.bodies.forEach((_) => e.delete(_.id)), x.bodies.forEach((_) => e.set(_.id, x.id)), B;
|
|
809
827
|
} else
|
|
810
828
|
console.warn(`Cannot update annotation ${S} - does not exist`);
|
|
@@ -831,7 +849,7 @@ const Pe = (t, e) => {
|
|
|
831
849
|
}] });
|
|
832
850
|
} else
|
|
833
851
|
console.warn(`Attempt to add body to missing annotation: ${g.annotation}`);
|
|
834
|
-
},
|
|
852
|
+
}, l = () => [...t.values()], m = (g = L.LOCAL) => {
|
|
835
853
|
const A = [...t.values()];
|
|
836
854
|
t.clear(), e.clear(), r(g, { deleted: A });
|
|
837
855
|
}, p = (g, A = !0, x = L.LOCAL) => {
|
|
@@ -884,19 +902,19 @@ const Pe = (t, e) => {
|
|
|
884
902
|
console.warn(`Attempt to delete missing body ${g.id} from annotation ${g.annotation}`);
|
|
885
903
|
} else
|
|
886
904
|
console.warn(`Attempt to delete body from missing annotation ${g.annotation}`);
|
|
887
|
-
},
|
|
905
|
+
}, c = (g) => {
|
|
888
906
|
const A = t.get(g);
|
|
889
907
|
return A ? { ...A } : void 0;
|
|
890
908
|
}, y = (g) => {
|
|
891
909
|
const A = e.get(g);
|
|
892
910
|
if (A) {
|
|
893
|
-
const x =
|
|
911
|
+
const x = c(A).bodies.find((S) => S.id === g);
|
|
894
912
|
if (x)
|
|
895
913
|
return x;
|
|
896
914
|
console.error(`Store integrity error: body ${g} in index, but not in annotation`);
|
|
897
915
|
} else
|
|
898
916
|
console.warn(`Attempt to retrieve missing body: ${g}`);
|
|
899
|
-
},
|
|
917
|
+
}, T = (g, A) => {
|
|
900
918
|
if (g.annotation !== A.annotation)
|
|
901
919
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
902
920
|
const x = t.get(g.annotation);
|
|
@@ -912,11 +930,11 @@ const Pe = (t, e) => {
|
|
|
912
930
|
};
|
|
913
931
|
} else
|
|
914
932
|
console.warn(`Attempt to add body to missing annotation ${g.annotation}`);
|
|
915
|
-
},
|
|
916
|
-
const S =
|
|
933
|
+
}, C = (g, A, x = L.LOCAL) => {
|
|
934
|
+
const S = T(g, A);
|
|
917
935
|
S && r(x, { updated: [S] });
|
|
918
936
|
}, E = (g, A = L.LOCAL) => {
|
|
919
|
-
const x = g.map((S) =>
|
|
937
|
+
const x = g.map((S) => T({ id: S.id, annotation: S.annotation }, S)).filter(Boolean);
|
|
920
938
|
r(A, { updated: x });
|
|
921
939
|
}, R = (g) => {
|
|
922
940
|
const A = t.get(g.annotation);
|
|
@@ -942,7 +960,7 @@ const Pe = (t, e) => {
|
|
|
942
960
|
return {
|
|
943
961
|
addAnnotation: a,
|
|
944
962
|
addBody: b,
|
|
945
|
-
all:
|
|
963
|
+
all: l,
|
|
946
964
|
bulkAddAnnotation: p,
|
|
947
965
|
bulkDeleteAnnotation: h,
|
|
948
966
|
bulkUpdateAnnotation: f,
|
|
@@ -954,12 +972,12 @@ const Pe = (t, e) => {
|
|
|
954
972
|
clear: m,
|
|
955
973
|
deleteAnnotation: v,
|
|
956
974
|
deleteBody: d,
|
|
957
|
-
getAnnotation:
|
|
975
|
+
getAnnotation: c,
|
|
958
976
|
getBody: y,
|
|
959
977
|
observe: o,
|
|
960
978
|
unobserve: i,
|
|
961
979
|
updateAnnotation: u,
|
|
962
|
-
updateBody:
|
|
980
|
+
updateBody: C,
|
|
963
981
|
updateTarget: (g, A = L.LOCAL) => {
|
|
964
982
|
const x = R(g);
|
|
965
983
|
x && r(A, { updated: [x] });
|
|
@@ -997,7 +1015,7 @@ const je = 250, Ge = (t) => {
|
|
|
997
1015
|
i = !1;
|
|
998
1016
|
};
|
|
999
1017
|
t.observe(a, { origin: L.LOCAL });
|
|
1000
|
-
const s = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), u = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), f = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: w }) => w)), b = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: w }) => w)),
|
|
1018
|
+
const s = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), u = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), f = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: w }) => w)), b = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: w }) => w)), l = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), m = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);
|
|
1001
1019
|
return {
|
|
1002
1020
|
canRedo: () => n.length - 1 > o,
|
|
1003
1021
|
canUndo: () => o > -1,
|
|
@@ -1014,7 +1032,7 @@ const je = 250, Ge = (t) => {
|
|
|
1014
1032
|
if (o > -1) {
|
|
1015
1033
|
i = !0;
|
|
1016
1034
|
const { created: p, updated: w, deleted: v } = n[o];
|
|
1017
|
-
s(p), f(w),
|
|
1035
|
+
s(p), f(w), l(v), e.emit("undo", n[o]), o -= 1;
|
|
1018
1036
|
}
|
|
1019
1037
|
}
|
|
1020
1038
|
};
|
|
@@ -1027,19 +1045,19 @@ const je = 250, Ge = (t) => {
|
|
|
1027
1045
|
}, Qe = (t, e, n, o) => {
|
|
1028
1046
|
const { store: i, selection: r, hover: a, viewport: s } = t, u = /* @__PURE__ */ new Map();
|
|
1029
1047
|
let f = [], b;
|
|
1030
|
-
const
|
|
1048
|
+
const l = (v, h) => {
|
|
1031
1049
|
u.has(v) ? u.get(v).push(h) : u.set(v, [h]);
|
|
1032
1050
|
}, m = (v, h) => {
|
|
1033
1051
|
const d = u.get(v);
|
|
1034
1052
|
d && d.indexOf(h) > 0 && d.splice(d.indexOf(h), 1);
|
|
1035
1053
|
}, p = (v, h, d) => {
|
|
1036
1054
|
u.has(v) && setTimeout(() => {
|
|
1037
|
-
u.get(v).forEach((
|
|
1055
|
+
u.get(v).forEach((c) => {
|
|
1038
1056
|
if (n) {
|
|
1039
|
-
const y = Array.isArray(h) ? h.map((
|
|
1040
|
-
|
|
1057
|
+
const y = Array.isArray(h) ? h.map((C) => n.serialize(C)) : n.serialize(h), T = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;
|
|
1058
|
+
c(y, T);
|
|
1041
1059
|
} else
|
|
1042
|
-
|
|
1060
|
+
c(h, d);
|
|
1043
1061
|
});
|
|
1044
1062
|
}, 1);
|
|
1045
1063
|
};
|
|
@@ -1053,15 +1071,15 @@ const je = 250, Ge = (t) => {
|
|
|
1053
1071
|
d && !F(d, h) && p("updateAnnotation", d, h);
|
|
1054
1072
|
}), f = [];
|
|
1055
1073
|
else {
|
|
1056
|
-
const h = new Set(f.map((
|
|
1057
|
-
f.filter((
|
|
1058
|
-
const y = i.getAnnotation(
|
|
1059
|
-
y && !F(y,
|
|
1074
|
+
const h = new Set(f.map((c) => c.id)), d = new Set(v.map(({ id: c }) => c));
|
|
1075
|
+
f.filter((c) => !d.has(c.id)).forEach((c) => {
|
|
1076
|
+
const y = i.getAnnotation(c.id);
|
|
1077
|
+
y && !F(y, c) && p("updateAnnotation", y, c);
|
|
1060
1078
|
}), f = [
|
|
1061
1079
|
// Remove annotations that were deselected
|
|
1062
|
-
...f.filter((
|
|
1080
|
+
...f.filter((c) => d.has(c.id)),
|
|
1063
1081
|
// Add editable annotations that were selected
|
|
1064
|
-
...v.filter(({ id:
|
|
1082
|
+
...v.filter(({ id: c }) => !h.has(c)).map(({ id: c }) => i.getAnnotation(c))
|
|
1065
1083
|
];
|
|
1066
1084
|
}
|
|
1067
1085
|
p("selectionChanged", f);
|
|
@@ -1070,25 +1088,25 @@ const je = 250, Ge = (t) => {
|
|
|
1070
1088
|
!b && v ? p("mouseEnterAnnotation", i.getAnnotation(v)) : b && !v ? p("mouseLeaveAnnotation", i.getAnnotation(b)) : b && v && (p("mouseLeaveAnnotation", i.getAnnotation(b)), p("mouseEnterAnnotation", i.getAnnotation(v))), b = v;
|
|
1071
1089
|
}), s == null || s.subscribe((v) => p("viewportIntersect", v.map((h) => i.getAnnotation(h)))), i.observe((v) => {
|
|
1072
1090
|
const { created: h, deleted: d } = v.changes;
|
|
1073
|
-
(h || []).forEach((
|
|
1074
|
-
...
|
|
1075
|
-
...
|
|
1076
|
-
...
|
|
1077
|
-
].length > 0).forEach(({ oldValue:
|
|
1078
|
-
const
|
|
1079
|
-
f = f.map((
|
|
1091
|
+
(h || []).forEach((c) => p("createAnnotation", c)), (d || []).forEach((c) => p("deleteAnnotation", c)), (v.changes.updated || []).filter((c) => [
|
|
1092
|
+
...c.bodiesCreated || [],
|
|
1093
|
+
...c.bodiesDeleted || [],
|
|
1094
|
+
...c.bodiesUpdated || []
|
|
1095
|
+
].length > 0).forEach(({ oldValue: c, newValue: y }) => {
|
|
1096
|
+
const T = f.find((C) => C.id === c.id) || c;
|
|
1097
|
+
f = f.map((C) => C.id === c.id ? y : C), p("updateAnnotation", y, T);
|
|
1080
1098
|
});
|
|
1081
1099
|
}, { origin: L.LOCAL }), i.observe((v) => {
|
|
1082
1100
|
if (f) {
|
|
1083
|
-
const h = new Set(f.map((
|
|
1084
|
-
d.length > 0 && (f = f.map((
|
|
1101
|
+
const h = new Set(f.map((c) => c.id)), d = (v.changes.updated || []).filter(({ newValue: c }) => h.has(c.id)).map(({ newValue: c }) => c);
|
|
1102
|
+
d.length > 0 && (f = f.map((c) => d.find((T) => T.id === c.id) || c));
|
|
1085
1103
|
}
|
|
1086
1104
|
}, { origin: L.REMOTE });
|
|
1087
1105
|
const w = (v) => (h) => {
|
|
1088
1106
|
const { updated: d } = h;
|
|
1089
|
-
v ? (d || []).forEach((
|
|
1107
|
+
v ? (d || []).forEach((c) => p("updateAnnotation", c.oldValue, c.newValue)) : (d || []).forEach((c) => p("updateAnnotation", c.newValue, c.oldValue));
|
|
1090
1108
|
};
|
|
1091
|
-
return e.on("undo", w(!0)), e.on("redo", w(!1)), { on:
|
|
1109
|
+
return e.on("undo", w(!0)), e.on("redo", w(!1)), { on: l, off: m, emit: p };
|
|
1092
1110
|
}, Je = (t) => (e) => e.reduce((n, o) => {
|
|
1093
1111
|
const { parsed: i, error: r } = t.parse(o);
|
|
1094
1112
|
return r ? {
|
|
@@ -1103,8 +1121,8 @@ const je = 250, Ge = (t) => {
|
|
|
1103
1121
|
}, { parsed: [], failed: [] }), Ze = (t, e, n) => {
|
|
1104
1122
|
const { store: o, selection: i } = t, r = (h) => {
|
|
1105
1123
|
if (n) {
|
|
1106
|
-
const { parsed: d, error:
|
|
1107
|
-
d ? o.addAnnotation(d, L.REMOTE) : console.error(
|
|
1124
|
+
const { parsed: d, error: c } = n.parse(h);
|
|
1125
|
+
d ? o.addAnnotation(d, L.REMOTE) : console.error(c);
|
|
1108
1126
|
} else
|
|
1109
1127
|
o.addAnnotation(h, L.REMOTE);
|
|
1110
1128
|
}, a = () => i.clear(), s = () => o.clear(), u = (h) => {
|
|
@@ -1112,9 +1130,9 @@ const je = 250, Ge = (t) => {
|
|
|
1112
1130
|
return n && d ? n.serialize(d) : d;
|
|
1113
1131
|
}, f = () => n ? o.all().map(n.serialize) : o.all(), b = () => {
|
|
1114
1132
|
var h;
|
|
1115
|
-
const d = (((h = i.selected) == null ? void 0 : h.map((
|
|
1133
|
+
const d = (((h = i.selected) == null ? void 0 : h.map((c) => c.id)) || []).map((c) => o.getAnnotation(c)).filter(Boolean);
|
|
1116
1134
|
return n ? d.map(n.serialize) : d;
|
|
1117
|
-
},
|
|
1135
|
+
}, l = (h, d = !0) => fetch(h).then((c) => c.json()).then((c) => (p(c, d), c)), m = (h) => {
|
|
1118
1136
|
if (typeof h == "string") {
|
|
1119
1137
|
const d = o.getAnnotation(h);
|
|
1120
1138
|
if (o.deleteAnnotation(h), d)
|
|
@@ -1126,16 +1144,16 @@ const je = 250, Ge = (t) => {
|
|
|
1126
1144
|
}
|
|
1127
1145
|
}, p = (h, d = !0) => {
|
|
1128
1146
|
if (n) {
|
|
1129
|
-
const { parsed:
|
|
1130
|
-
y.length > 0 && console.warn(`Discarded ${y.length} invalid annotations`, y), o.bulkAddAnnotation(
|
|
1147
|
+
const { parsed: c, failed: y } = Je(n)(h);
|
|
1148
|
+
y.length > 0 && console.warn(`Discarded ${y.length} invalid annotations`, y), o.bulkAddAnnotation(c, d, L.REMOTE);
|
|
1131
1149
|
} else
|
|
1132
1150
|
o.bulkAddAnnotation(h, d, L.REMOTE);
|
|
1133
1151
|
}, w = (h) => {
|
|
1134
1152
|
h ? i.setSelected(h) : i.clear();
|
|
1135
1153
|
}, v = (h) => {
|
|
1136
1154
|
if (n) {
|
|
1137
|
-
const d = n.parse(h).parsed,
|
|
1138
|
-
return o.updateAnnotation(d),
|
|
1155
|
+
const d = n.parse(h).parsed, c = n.serialize(o.getAnnotation(d.id));
|
|
1156
|
+
return o.updateAnnotation(d), c;
|
|
1139
1157
|
} else {
|
|
1140
1158
|
const d = o.getAnnotation(h.id);
|
|
1141
1159
|
return o.updateAnnotation(h), d;
|
|
@@ -1150,7 +1168,7 @@ const je = 250, Ge = (t) => {
|
|
|
1150
1168
|
getAnnotationById: u,
|
|
1151
1169
|
getAnnotations: f,
|
|
1152
1170
|
getSelected: b,
|
|
1153
|
-
loadAnnotations:
|
|
1171
|
+
loadAnnotations: l,
|
|
1154
1172
|
redo: e.redo,
|
|
1155
1173
|
removeAnnotation: m,
|
|
1156
1174
|
setAnnotations: p,
|
|
@@ -1184,7 +1202,7 @@ const sn = () => ({ isGuest: !0, id: on("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1184
1202
|
n = (n << 5) - n + r, n |= 0;
|
|
1185
1203
|
}
|
|
1186
1204
|
return `${n}`;
|
|
1187
|
-
},
|
|
1205
|
+
}, kt = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, ln = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1188
1206
|
const { id: o, type: i, purpose: r, value: a, created: s, creator: u, ...f } = n;
|
|
1189
1207
|
return {
|
|
1190
1208
|
id: o || `temp-${an(n)}`,
|
|
@@ -1193,16 +1211,16 @@ const sn = () => ({ isGuest: !0, id: on("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1193
1211
|
purpose: r,
|
|
1194
1212
|
value: a,
|
|
1195
1213
|
created: s ? new Date(s) : void 0,
|
|
1196
|
-
creator:
|
|
1214
|
+
creator: kt(u),
|
|
1197
1215
|
...f
|
|
1198
1216
|
};
|
|
1199
|
-
}),
|
|
1217
|
+
}), cn = (t) => t.map((e) => {
|
|
1200
1218
|
var n, o;
|
|
1201
1219
|
const i = { ...e };
|
|
1202
1220
|
return delete i.annotation, (n = i.id) != null && n.startsWith("temp-") && delete i.id, { ...i, created: (o = i.created) == null ? void 0 : o.toISOString() };
|
|
1203
1221
|
});
|
|
1204
1222
|
rn();
|
|
1205
|
-
const
|
|
1223
|
+
const In = (t, e) => ({
|
|
1206
1224
|
parse: (n) => hn(n),
|
|
1207
1225
|
serialize: (n) => fn(n, t, e)
|
|
1208
1226
|
}), dn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, un = (t) => {
|
|
@@ -1213,32 +1231,32 @@ const On = (t, e) => ({
|
|
|
1213
1231
|
modified: i,
|
|
1214
1232
|
target: r
|
|
1215
1233
|
} = t, a = Array.isArray(r) ? r : [r], s = {
|
|
1216
|
-
creator:
|
|
1234
|
+
creator: kt(n),
|
|
1217
1235
|
created: o ? new Date(o) : void 0,
|
|
1218
1236
|
updated: i ? new Date(i) : void 0,
|
|
1219
1237
|
annotation: e,
|
|
1220
1238
|
selector: []
|
|
1221
1239
|
};
|
|
1222
1240
|
for (const u of a) {
|
|
1223
|
-
const b = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((
|
|
1241
|
+
const b = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((l, m) => {
|
|
1224
1242
|
switch (m.type) {
|
|
1225
1243
|
case "TextQuoteSelector":
|
|
1226
|
-
|
|
1244
|
+
l.quote = m.exact;
|
|
1227
1245
|
break;
|
|
1228
1246
|
case "TextPositionSelector":
|
|
1229
|
-
|
|
1247
|
+
l.start = m.start, l.end = m.end;
|
|
1230
1248
|
break;
|
|
1231
1249
|
}
|
|
1232
|
-
return
|
|
1250
|
+
return l;
|
|
1233
1251
|
}, {});
|
|
1234
1252
|
if (dn(b))
|
|
1235
1253
|
s.selector.push({ id: u.id, ...b });
|
|
1236
1254
|
else {
|
|
1237
|
-
const
|
|
1255
|
+
const l = [
|
|
1238
1256
|
b.start ? void 0 : "TextPositionSelector",
|
|
1239
1257
|
b.quote ? void 0 : "TextQuoteSelector"
|
|
1240
1258
|
].filter(Boolean);
|
|
1241
|
-
return { error: Error(`Missing selector types: ${
|
|
1259
|
+
return { error: Error(`Missing selector types: ${l.join(" and ")} for annotation: ${t.id}`) };
|
|
1242
1260
|
}
|
|
1243
1261
|
}
|
|
1244
1262
|
return { parsed: s };
|
|
@@ -1249,7 +1267,7 @@ const On = (t, e) => ({
|
|
|
1249
1267
|
modified: i,
|
|
1250
1268
|
body: r,
|
|
1251
1269
|
...a
|
|
1252
|
-
} = t, s =
|
|
1270
|
+
} = t, s = ln(r, e), u = un(t);
|
|
1253
1271
|
return "error" in u ? { error: u.error } : {
|
|
1254
1272
|
parsed: {
|
|
1255
1273
|
...a,
|
|
@@ -1265,12 +1283,12 @@ const On = (t, e) => ({
|
|
|
1265
1283
|
created: u,
|
|
1266
1284
|
updated: f,
|
|
1267
1285
|
...b
|
|
1268
|
-
} = i,
|
|
1269
|
-
const { quote: p, start: w, end: v, range: h } = m, { prefix: d, suffix:
|
|
1286
|
+
} = i, l = a.map((m) => {
|
|
1287
|
+
const { quote: p, start: w, end: v, range: h } = m, { prefix: d, suffix: c } = te(h, n), y = [{
|
|
1270
1288
|
type: "TextQuoteSelector",
|
|
1271
1289
|
exact: p,
|
|
1272
1290
|
prefix: d,
|
|
1273
|
-
suffix:
|
|
1291
|
+
suffix: c
|
|
1274
1292
|
}, {
|
|
1275
1293
|
type: "TextPositionSelector",
|
|
1276
1294
|
start: w,
|
|
@@ -1288,21 +1306,21 @@ const On = (t, e) => ({
|
|
|
1288
1306
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1289
1307
|
id: t.id,
|
|
1290
1308
|
type: "Annotation",
|
|
1291
|
-
body:
|
|
1309
|
+
body: cn(t.bodies),
|
|
1292
1310
|
creator: s,
|
|
1293
1311
|
created: u == null ? void 0 : u.toISOString(),
|
|
1294
1312
|
modified: f == null ? void 0 : f.toISOString(),
|
|
1295
|
-
target:
|
|
1313
|
+
target: l
|
|
1296
1314
|
};
|
|
1297
1315
|
};
|
|
1298
1316
|
function pn(t, e, n, o, i) {
|
|
1299
|
-
|
|
1317
|
+
Yt(t, e, n || 0, o || t.length - 1, i || gn);
|
|
1300
1318
|
}
|
|
1301
|
-
function
|
|
1319
|
+
function Yt(t, e, n, o, i) {
|
|
1302
1320
|
for (; o > n; ) {
|
|
1303
1321
|
if (o - n > 600) {
|
|
1304
|
-
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), b = Math.max(n, Math.floor(e - a * u / r + f)),
|
|
1305
|
-
|
|
1322
|
+
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), b = Math.max(n, Math.floor(e - a * u / r + f)), l = Math.min(o, Math.floor(e + (r - a) * u / r + f));
|
|
1323
|
+
Yt(t, e, b, l, i);
|
|
1306
1324
|
}
|
|
1307
1325
|
var m = t[e], p = n, w = o;
|
|
1308
1326
|
for (W(t, n, e), i(t[o], m) > 0 && W(t, n, o); p < w; ) {
|
|
@@ -1337,7 +1355,7 @@ class mn {
|
|
|
1337
1355
|
for (; n; ) {
|
|
1338
1356
|
for (let a = 0; a < n.children.length; a++) {
|
|
1339
1357
|
const s = n.children[a], u = n.leaf ? i(s) : s;
|
|
1340
|
-
tt(e, u) && (n.leaf ? o.push(s) :
|
|
1358
|
+
tt(e, u) && (n.leaf ? o.push(s) : dt(e, u) ? this._all(s, o) : r.push(s));
|
|
1341
1359
|
}
|
|
1342
1360
|
n = r.pop();
|
|
1343
1361
|
}
|
|
@@ -1352,7 +1370,7 @@ class mn {
|
|
|
1352
1370
|
for (let i = 0; i < n.children.length; i++) {
|
|
1353
1371
|
const r = n.children[i], a = n.leaf ? this.toBBox(r) : r;
|
|
1354
1372
|
if (tt(e, a)) {
|
|
1355
|
-
if (n.leaf ||
|
|
1373
|
+
if (n.leaf || dt(e, a))
|
|
1356
1374
|
return !0;
|
|
1357
1375
|
o.push(r);
|
|
1358
1376
|
}
|
|
@@ -1401,7 +1419,7 @@ class mn {
|
|
|
1401
1419
|
if (b !== -1)
|
|
1402
1420
|
return o.children.splice(b, 1), r.push(o), this._condense(r), this;
|
|
1403
1421
|
}
|
|
1404
|
-
!f && !o.leaf &&
|
|
1422
|
+
!f && !o.leaf && dt(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;
|
|
1405
1423
|
}
|
|
1406
1424
|
return this;
|
|
1407
1425
|
}
|
|
@@ -1435,10 +1453,10 @@ class mn {
|
|
|
1435
1453
|
const u = Math.ceil(r / a), f = u * Math.ceil(Math.sqrt(a));
|
|
1436
1454
|
Bt(e, n, o, f, this.compareMinX);
|
|
1437
1455
|
for (let b = n; b <= o; b += f) {
|
|
1438
|
-
const
|
|
1439
|
-
Bt(e, b,
|
|
1440
|
-
for (let m = b; m <=
|
|
1441
|
-
const p = Math.min(m + u - 1,
|
|
1456
|
+
const l = Math.min(b + f - 1, o);
|
|
1457
|
+
Bt(e, b, l, u, this.compareMinY);
|
|
1458
|
+
for (let m = b; m <= l; m += u) {
|
|
1459
|
+
const p = Math.min(m + u - 1, l);
|
|
1442
1460
|
s.children.push(this._build(e, m, p, i - 1));
|
|
1443
1461
|
}
|
|
1444
1462
|
}
|
|
@@ -1448,8 +1466,8 @@ class mn {
|
|
|
1448
1466
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1449
1467
|
let r = 1 / 0, a = 1 / 0, s;
|
|
1450
1468
|
for (let u = 0; u < n.children.length; u++) {
|
|
1451
|
-
const f = n.children[u], b = ct(f),
|
|
1452
|
-
|
|
1469
|
+
const f = n.children[u], b = ct(f), l = wn(e, f) - b;
|
|
1470
|
+
l < a ? (a = l, r = b < r ? b : r, s = f) : l === a && b < r && (r = b, s = f);
|
|
1453
1471
|
}
|
|
1454
1472
|
n = s || n.children[0];
|
|
1455
1473
|
}
|
|
@@ -1474,8 +1492,8 @@ class mn {
|
|
|
1474
1492
|
_chooseSplitIndex(e, n, o) {
|
|
1475
1493
|
let i, r = 1 / 0, a = 1 / 0;
|
|
1476
1494
|
for (let s = n; s <= o - n; s++) {
|
|
1477
|
-
const u = q(e, 0, s, this.toBBox), f = q(e, s, o, this.toBBox), b = xn(u, f),
|
|
1478
|
-
b < r ? (r = b, i = s, a =
|
|
1495
|
+
const u = q(e, 0, s, this.toBBox), f = q(e, s, o, this.toBBox), b = xn(u, f), l = ct(u) + ct(f);
|
|
1496
|
+
b < r ? (r = b, i = s, a = l < a ? l : a) : b === r && l < a && (a = l, i = s);
|
|
1479
1497
|
}
|
|
1480
1498
|
return i || o - n;
|
|
1481
1499
|
}
|
|
@@ -1549,7 +1567,7 @@ function xn(t, e) {
|
|
|
1549
1567
|
const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), r = Math.min(t.maxY, e.maxY);
|
|
1550
1568
|
return Math.max(0, i - n) * Math.max(0, r - o);
|
|
1551
1569
|
}
|
|
1552
|
-
function
|
|
1570
|
+
function dt(t, e) {
|
|
1553
1571
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1554
1572
|
}
|
|
1555
1573
|
function tt(t, e) {
|
|
@@ -1576,13 +1594,13 @@ function Bt(t, e, n, o, i) {
|
|
|
1576
1594
|
}
|
|
1577
1595
|
}
|
|
1578
1596
|
const An = (t, e) => {
|
|
1579
|
-
const n = new mn(), o = /* @__PURE__ */ new Map(), i = (d,
|
|
1580
|
-
const y = d.selector.flatMap((
|
|
1581
|
-
const R =
|
|
1597
|
+
const n = new mn(), o = /* @__PURE__ */ new Map(), i = (d, c) => {
|
|
1598
|
+
const y = d.selector.flatMap((C) => {
|
|
1599
|
+
const R = C.range instanceof Range && !C.range.collapsed && C.range.startContainer.nodeType === Node.TEXT_NODE && C.range.endContainer.nodeType === Node.TEXT_NODE ? C.range : Mt(C, e).range;
|
|
1582
1600
|
return Array.from(R.getClientRects());
|
|
1583
|
-
}),
|
|
1584
|
-
return
|
|
1585
|
-
const { x: E, y: R, width: g, height: A } =
|
|
1601
|
+
}), T = oe(y).map(({ left: C, top: E, right: R, bottom: g }) => new DOMRect(C - c.left, E - c.top, R - C, g - E));
|
|
1602
|
+
return T.map((C) => {
|
|
1603
|
+
const { x: E, y: R, width: g, height: A } = C;
|
|
1586
1604
|
return {
|
|
1587
1605
|
minX: E,
|
|
1588
1606
|
minY: R,
|
|
@@ -1590,57 +1608,57 @@ const An = (t, e) => {
|
|
|
1590
1608
|
maxY: R + A,
|
|
1591
1609
|
annotation: {
|
|
1592
1610
|
id: d.annotation,
|
|
1593
|
-
rects:
|
|
1611
|
+
rects: T
|
|
1594
1612
|
}
|
|
1595
1613
|
};
|
|
1596
1614
|
});
|
|
1597
1615
|
}, r = () => [...o.values()], a = () => {
|
|
1598
1616
|
n.clear(), o.clear();
|
|
1599
1617
|
}, s = (d) => {
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1618
|
+
const c = i(d, e.getBoundingClientRect());
|
|
1619
|
+
c.forEach((y) => n.insert(y)), o.set(d.annotation, c);
|
|
1602
1620
|
}, u = (d) => {
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1621
|
+
const c = o.get(d.annotation);
|
|
1622
|
+
c && (c.forEach((y) => n.remove(y)), o.delete(d.annotation));
|
|
1605
1623
|
}, f = (d) => {
|
|
1606
1624
|
u(d), s(d);
|
|
1607
|
-
}, b = (d,
|
|
1608
|
-
|
|
1609
|
-
const y = e.getBoundingClientRect(),
|
|
1610
|
-
|
|
1611
|
-
const
|
|
1612
|
-
n.load(
|
|
1613
|
-
},
|
|
1625
|
+
}, b = (d, c = !0) => {
|
|
1626
|
+
c && a();
|
|
1627
|
+
const y = e.getBoundingClientRect(), T = d.map((E) => ({ target: E, rects: i(E, y) }));
|
|
1628
|
+
T.forEach(({ target: E, rects: R }) => o.set(E.annotation, R));
|
|
1629
|
+
const C = T.reduce((E, { rects: R }) => [...E, ...R], []);
|
|
1630
|
+
n.load(C);
|
|
1631
|
+
}, l = (d, c) => {
|
|
1614
1632
|
const y = n.search({
|
|
1615
1633
|
minX: d,
|
|
1616
|
-
minY:
|
|
1634
|
+
minY: c,
|
|
1617
1635
|
maxX: d,
|
|
1618
|
-
maxY:
|
|
1619
|
-
}),
|
|
1636
|
+
maxY: c
|
|
1637
|
+
}), T = (C) => C.annotation.rects.reduce((E, R) => E + R.width * R.height, 0);
|
|
1620
1638
|
if (y.length > 0)
|
|
1621
|
-
return y.sort((
|
|
1639
|
+
return y.sort((C, E) => T(C) - T(E)), y[0].annotation.id;
|
|
1622
1640
|
}, m = (d) => {
|
|
1623
|
-
const
|
|
1624
|
-
if (
|
|
1641
|
+
const c = p(d);
|
|
1642
|
+
if (c.length === 0)
|
|
1625
1643
|
return;
|
|
1626
|
-
let y =
|
|
1627
|
-
for (let R = 1; R <
|
|
1628
|
-
const g =
|
|
1629
|
-
y = Math.min(y, g.left),
|
|
1644
|
+
let y = c[0].left, T = c[0].top, C = c[0].right, E = c[0].bottom;
|
|
1645
|
+
for (let R = 1; R < c.length; R++) {
|
|
1646
|
+
const g = c[R];
|
|
1647
|
+
y = Math.min(y, g.left), T = Math.min(T, g.top), C = Math.max(C, g.right), E = Math.max(E, g.bottom);
|
|
1630
1648
|
}
|
|
1631
|
-
return new DOMRect(y,
|
|
1649
|
+
return new DOMRect(y, T, C - y, E - T);
|
|
1632
1650
|
}, p = (d) => {
|
|
1633
|
-
const
|
|
1634
|
-
return
|
|
1651
|
+
const c = o.get(d);
|
|
1652
|
+
return c ? c[0].annotation.rects : [];
|
|
1635
1653
|
};
|
|
1636
1654
|
return {
|
|
1637
1655
|
all: r,
|
|
1638
1656
|
clear: a,
|
|
1639
|
-
getAt:
|
|
1657
|
+
getAt: l,
|
|
1640
1658
|
getAnnotationBounds: m,
|
|
1641
1659
|
getAnnotationRects: p,
|
|
1642
|
-
getIntersecting: (d,
|
|
1643
|
-
const
|
|
1660
|
+
getIntersecting: (d, c, y, T) => {
|
|
1661
|
+
const C = n.search({ minX: d, minY: c, maxX: y, maxY: T }), E = new Set(C.reduce((R, g) => [...R, g.annotation.id], []));
|
|
1644
1662
|
return Array.from(E).map((R) => ({
|
|
1645
1663
|
annotation: t.getAnnotation(R),
|
|
1646
1664
|
rects: p(R)
|
|
@@ -1654,46 +1672,46 @@ const An = (t, e) => {
|
|
|
1654
1672
|
update: f
|
|
1655
1673
|
};
|
|
1656
1674
|
}, En = (t, e) => {
|
|
1657
|
-
const n = We(), o = An(n, t), i =
|
|
1658
|
-
const d =
|
|
1659
|
-
return
|
|
1675
|
+
const n = We(), o = An(n, t), i = Ie(n, e), r = Be(n), a = Ke(), s = (v, h = L.LOCAL) => {
|
|
1676
|
+
const d = ot(v, t), c = Y(d.target.selector);
|
|
1677
|
+
return c && n.addAnnotation(d, h), c;
|
|
1660
1678
|
}, u = (v, h = !0, d = L.LOCAL) => {
|
|
1661
|
-
const
|
|
1662
|
-
return y.length > 0 ? (console.warn("Could not revive all targets for these annotations:", y), n.bulkAddAnnotation(
|
|
1679
|
+
const c = v.map((T) => ot(T, t)), y = c.filter((T) => !Y(T.target.selector));
|
|
1680
|
+
return y.length > 0 ? (console.warn("Could not revive all targets for these annotations:", y), n.bulkAddAnnotation(c, h, d), y) : (n.bulkAddAnnotation(c, h, d), []);
|
|
1663
1681
|
}, f = (v, h = L.LOCAL) => {
|
|
1664
|
-
const d = v.map((y) =>
|
|
1665
|
-
return
|
|
1682
|
+
const d = v.map((y) => ot(y, t)), c = d.filter((y) => !Y(y.target.selector));
|
|
1683
|
+
return c.length > 0 && console.warn("Could not revive all targets for these annotations:", c), d.forEach((y) => {
|
|
1666
1684
|
n.getAnnotation(y.id) ? n.updateAnnotation(y, h) : n.addAnnotation(y, h);
|
|
1667
|
-
}),
|
|
1685
|
+
}), c;
|
|
1668
1686
|
}, b = (v, h = L.LOCAL) => {
|
|
1669
|
-
const d =
|
|
1687
|
+
const d = nt(v, t);
|
|
1670
1688
|
n.updateTarget(d, h);
|
|
1671
|
-
},
|
|
1672
|
-
const d = v.map((
|
|
1689
|
+
}, l = (v, h = L.LOCAL) => {
|
|
1690
|
+
const d = v.map((c) => nt(c, t));
|
|
1673
1691
|
n.bulkUpdateTargets(d, h);
|
|
1674
1692
|
}, m = (v, h) => {
|
|
1675
1693
|
const d = o.getAt(v, h);
|
|
1676
1694
|
return d ? n.getAnnotation(d) : void 0;
|
|
1677
|
-
}, p = (v, h, d,
|
|
1695
|
+
}, p = (v, h, d, c = 5) => {
|
|
1678
1696
|
const y = o.getAnnotationRects(v);
|
|
1679
1697
|
if (y.length !== 0) {
|
|
1680
1698
|
if (h && d) {
|
|
1681
|
-
const
|
|
1682
|
-
if (
|
|
1683
|
-
return
|
|
1699
|
+
const T = y.find(({ top: C, right: E, bottom: R, left: g }) => h >= g - c && h <= E + c && d >= C - c && d <= R + c);
|
|
1700
|
+
if (T)
|
|
1701
|
+
return T;
|
|
1684
1702
|
}
|
|
1685
1703
|
return o.getAnnotationBounds(v);
|
|
1686
1704
|
}
|
|
1687
1705
|
}, w = () => o.recalculate();
|
|
1688
1706
|
return n.observe(({ changes: v }) => {
|
|
1689
|
-
const h = (v.created || []).filter((y) =>
|
|
1690
|
-
h.length > 0 && o.set(h.map((y) => y.target), !1), (d == null ? void 0 : d.length) > 0 && d.forEach((y) => o.remove(y.target)), (
|
|
1707
|
+
const h = (v.created || []).filter((y) => Y(y.target.selector)), d = (v.deleted || []).filter((y) => Y(y.target.selector)), c = (v.updated || []).filter((y) => Y(y.newValue.target.selector));
|
|
1708
|
+
h.length > 0 && o.set(h.map((y) => y.target), !1), (d == null ? void 0 : d.length) > 0 && d.forEach((y) => o.remove(y.target)), (c == null ? void 0 : c.length) > 0 && c.forEach(({ newValue: y }) => o.update(y.target));
|
|
1691
1709
|
}), {
|
|
1692
1710
|
store: {
|
|
1693
1711
|
...n,
|
|
1694
1712
|
addAnnotation: s,
|
|
1695
1713
|
bulkAddAnnotation: u,
|
|
1696
|
-
bulkUpdateTargets:
|
|
1714
|
+
bulkUpdateTargets: l,
|
|
1697
1715
|
bulkUpsertAnnotations: f,
|
|
1698
1716
|
getAnnotationBounds: p,
|
|
1699
1717
|
getAt: m,
|
|
@@ -1713,25 +1731,25 @@ const An = (t, e) => {
|
|
|
1713
1731
|
}, Cn = (t, e, n = {}) => {
|
|
1714
1732
|
const o = Sn(), i = o.getContext("2d");
|
|
1715
1733
|
t.appendChild(o);
|
|
1716
|
-
const r = /* @__PURE__ */ new Map(), a = (
|
|
1717
|
-
return e.on("selectionChange", (
|
|
1718
|
-
a(
|
|
1734
|
+
const r = /* @__PURE__ */ new Map(), a = (l) => Array.from(r.entries()).filter(([m, p]) => p.presenceKey === l.presenceKey).map(([m, p]) => m);
|
|
1735
|
+
return e.on("selectionChange", (l, m) => {
|
|
1736
|
+
a(l).forEach((w) => r.delete(w)), m && m.forEach((w) => r.set(w, l));
|
|
1719
1737
|
}), {
|
|
1720
1738
|
clear: () => {
|
|
1721
|
-
const { width:
|
|
1722
|
-
i.clearRect(-0.5, -0.5,
|
|
1739
|
+
const { width: l, height: m } = o;
|
|
1740
|
+
i.clearRect(-0.5, -0.5, l + 1, m + 1);
|
|
1723
1741
|
},
|
|
1724
1742
|
destroy: () => {
|
|
1725
1743
|
o.remove();
|
|
1726
1744
|
},
|
|
1727
|
-
paint: (
|
|
1745
|
+
paint: (l, m, p) => {
|
|
1728
1746
|
n.font && (i.font = n.font);
|
|
1729
|
-
const w = r.get(
|
|
1747
|
+
const w = r.get(l.annotation.id);
|
|
1730
1748
|
if (w) {
|
|
1731
|
-
const { height: v } =
|
|
1749
|
+
const { height: v } = l.rects[0], h = l.rects[0].x + m.left, d = l.rects[0].y + m.top;
|
|
1732
1750
|
i.fillStyle = w.appearance.color, i.fillRect(h - 2, d - 2.5, 2, v + 5);
|
|
1733
|
-
const
|
|
1734
|
-
return i.fillRect(h - 2, d - 2.5 -
|
|
1751
|
+
const c = i.measureText(w.appearance.label), y = c.width + 6, T = c.actualBoundingBoxAscent + c.actualBoundingBoxDescent + 8, C = c.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1752
|
+
return i.fillRect(h - 2, d - 2.5 - T, y, T), i.fillStyle = "#fff", i.fillText(w.appearance.label, h + 1, d - C), {
|
|
1735
1753
|
fill: w.appearance.color,
|
|
1736
1754
|
fillOpacity: p ? 0.45 : 0.18
|
|
1737
1755
|
};
|
|
@@ -1739,8 +1757,8 @@ const An = (t, e) => {
|
|
|
1739
1757
|
},
|
|
1740
1758
|
reset: () => {
|
|
1741
1759
|
o.width = 2 * window.innerWidth, o.height = 2 * window.innerHeight;
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1760
|
+
const l = o.getContext("2d");
|
|
1761
|
+
l.scale(2, 2), l.translate(0.5, 0.5);
|
|
1744
1762
|
}
|
|
1745
1763
|
};
|
|
1746
1764
|
}, Ht = (t) => {
|
|
@@ -1750,7 +1768,7 @@ const An = (t, e) => {
|
|
|
1750
1768
|
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : Ht(t.parentElement);
|
|
1751
1769
|
}, Tn = (t, e) => (n) => {
|
|
1752
1770
|
const o = (r) => {
|
|
1753
|
-
const a = i.getBoundingClientRect(), s = i.clientHeight, u = i.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: b, height:
|
|
1771
|
+
const a = i.getBoundingClientRect(), s = i.clientHeight, u = i.clientWidth, f = r.selector[0].range.getBoundingClientRect(), { width: b, height: l } = e.getAnnotationBounds(n.id), m = f.top - a.top, p = f.left - a.left, w = i.parentElement ? i.scrollTop : 0, v = i.parentElement ? i.scrollLeft : 0, h = m + w - (s - l) / 2, d = p + v - (u - b) / 2;
|
|
1754
1772
|
i.scroll({ top: h, left: d, behavior: "smooth" });
|
|
1755
1773
|
}, i = Ht(t);
|
|
1756
1774
|
if (i) {
|
|
@@ -1758,7 +1776,7 @@ const An = (t, e) => {
|
|
|
1758
1776
|
if (a && !a.collapsed)
|
|
1759
1777
|
return o(r.target), !0;
|
|
1760
1778
|
{
|
|
1761
|
-
const s =
|
|
1779
|
+
const s = nt(r.target, t), { range: u } = s.selector[0];
|
|
1762
1780
|
if (u && !u.collapsed)
|
|
1763
1781
|
return o(s), !0;
|
|
1764
1782
|
}
|
|
@@ -1772,29 +1790,29 @@ const An = (t, e) => {
|
|
|
1772
1790
|
let a, s;
|
|
1773
1791
|
const u = (h) => a = h;
|
|
1774
1792
|
let f = !1, b;
|
|
1775
|
-
const
|
|
1776
|
-
var
|
|
1793
|
+
const l = (h) => {
|
|
1794
|
+
var c;
|
|
1777
1795
|
if (!f)
|
|
1778
1796
|
return;
|
|
1779
|
-
!((
|
|
1797
|
+
!((c = h.target.parentElement) != null && c.closest(k)) ? s = {
|
|
1780
1798
|
annotation: Xt(),
|
|
1781
1799
|
selector: [],
|
|
1782
1800
|
creator: a,
|
|
1783
1801
|
created: /* @__PURE__ */ new Date()
|
|
1784
1802
|
} : s = void 0;
|
|
1785
1803
|
};
|
|
1786
|
-
n && t.addEventListener("selectstart",
|
|
1804
|
+
n && t.addEventListener("selectstart", l);
|
|
1787
1805
|
const m = ft((h) => {
|
|
1788
1806
|
const d = document.getSelection();
|
|
1789
|
-
if (h.timeStamp - ((b == null ? void 0 : b.timeStamp) || h.timeStamp) < 1e3 && !s &&
|
|
1807
|
+
if (h.timeStamp - ((b == null ? void 0 : b.timeStamp) || h.timeStamp) < 1e3 && !s && l(b), d.isCollapsed || !f || !s)
|
|
1790
1808
|
return;
|
|
1791
|
-
const
|
|
1792
|
-
(
|
|
1809
|
+
const c = d.getRangeAt(0), y = re(c.cloneRange()), T = Kt(y);
|
|
1810
|
+
(T.length !== s.selector.length || T.some((E, R) => {
|
|
1793
1811
|
var g;
|
|
1794
1812
|
return E.toString() !== ((g = s.selector[R]) == null ? void 0 : g.quote);
|
|
1795
1813
|
})) && (s = {
|
|
1796
1814
|
...s,
|
|
1797
|
-
selector:
|
|
1815
|
+
selector: T.map((E) => ie(E, t, o))
|
|
1798
1816
|
}, i.getAnnotation(s.annotation) ? i.updateTarget(s, L.LOCAL) : (i.addAnnotation({
|
|
1799
1817
|
id: s.annotation,
|
|
1800
1818
|
bodies: [],
|
|
@@ -1803,50 +1821,50 @@ const An = (t, e) => {
|
|
|
1803
1821
|
});
|
|
1804
1822
|
n && document.addEventListener("selectionchange", m);
|
|
1805
1823
|
const p = (h) => {
|
|
1806
|
-
const { target: d, timeStamp:
|
|
1807
|
-
b = { ...h, target: d, timeStamp:
|
|
1824
|
+
const { target: d, timeStamp: c, offsetX: y, offsetY: T, type: C } = h;
|
|
1825
|
+
b = { ...h, target: d, timeStamp: c, offsetX: y, offsetY: T, type: C }, f = h.button === 0;
|
|
1808
1826
|
};
|
|
1809
1827
|
t.addEventListener("pointerdown", p);
|
|
1810
1828
|
const w = (h) => {
|
|
1811
|
-
var
|
|
1812
|
-
if (!!((
|
|
1829
|
+
var T;
|
|
1830
|
+
if (!!((T = h.target.parentElement) != null && T.closest(k)) || !f)
|
|
1813
1831
|
return;
|
|
1814
|
-
const
|
|
1815
|
-
const { x:
|
|
1832
|
+
const c = () => {
|
|
1833
|
+
const { x: C, y: E } = t.getBoundingClientRect(), R = i.getAt(h.clientX - C, h.clientY - E);
|
|
1816
1834
|
if (R) {
|
|
1817
1835
|
const { selected: g } = r;
|
|
1818
1836
|
(g.length !== 1 || g[0].id !== R.id) && r.clickSelect(R.id, h);
|
|
1819
1837
|
} else
|
|
1820
1838
|
r.isEmpty() || r.clear();
|
|
1821
1839
|
}, y = h.timeStamp - b.timeStamp;
|
|
1822
|
-
document.getSelection().isCollapsed && y < 300 ? (s = void 0,
|
|
1840
|
+
document.getSelection().isCollapsed && y < 300 ? (s = void 0, c()) : s && r.clickSelect(s.annotation, h);
|
|
1823
1841
|
};
|
|
1824
1842
|
return document.addEventListener("pointerup", w), {
|
|
1825
1843
|
destroy: () => {
|
|
1826
|
-
t.removeEventListener("selectstart",
|
|
1844
|
+
t.removeEventListener("selectstart", l), document.removeEventListener("selectionchange", m), t.removeEventListener("pointerdown", p), document.removeEventListener("pointerup", w);
|
|
1827
1845
|
},
|
|
1828
1846
|
setUser: u
|
|
1829
1847
|
};
|
|
1830
|
-
}, Ot = "SPANS",
|
|
1831
|
-
t
|
|
1848
|
+
}, Ot = "SPANS", Mn = (t, e = {}) => {
|
|
1849
|
+
Qt(t);
|
|
1832
1850
|
const n = Rn(e, {
|
|
1833
1851
|
annotationEnabled: !0
|
|
1834
1852
|
}), o = En(t, n.pointerAction), { selection: i, viewport: r } = o, a = o.store, s = Ge(a), u = Qe(o, s, n.adapter);
|
|
1835
1853
|
let f = sn();
|
|
1836
|
-
const b = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : Ot : n.renderer || Ot,
|
|
1837
|
-
if (!
|
|
1854
|
+
const b = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : Ot : n.renderer || Ot, l = b === "SPANS" ? Se(t, o, r) : b === "CSS_HIGHLIGHTS" ? xe(t, o, r) : b === "CANVAS" ? ue(t, o, r) : void 0;
|
|
1855
|
+
if (!l)
|
|
1838
1856
|
throw `Unknown renderer implementation: ${b}`;
|
|
1839
|
-
console.debug(`Using ${b} renderer`), n.style &&
|
|
1857
|
+
console.debug(`Using ${b} renderer`), n.style && l.setStyle(n.style);
|
|
1840
1858
|
const m = Nn(t, o, n.annotationEnabled, n.offsetReferenceSelector);
|
|
1841
1859
|
return m.setUser(f), {
|
|
1842
1860
|
...Ze(o, s, n.adapter),
|
|
1843
1861
|
destroy: () => {
|
|
1844
|
-
|
|
1862
|
+
l.destroy(), m.destroy(), s.destroy();
|
|
1845
1863
|
},
|
|
1846
1864
|
element: t,
|
|
1847
1865
|
getUser: () => f,
|
|
1848
|
-
setFilter: (E) =>
|
|
1849
|
-
setStyle: (E) =>
|
|
1866
|
+
setFilter: (E) => l.setFilter(E),
|
|
1867
|
+
setStyle: (E) => l.setStyle(E),
|
|
1850
1868
|
setUser: (E) => {
|
|
1851
1869
|
f = E, m.setUser(E);
|
|
1852
1870
|
},
|
|
@@ -1854,46 +1872,47 @@ const An = (t, e) => {
|
|
|
1854
1872
|
E ? i.setSelected(E) : i.clear();
|
|
1855
1873
|
},
|
|
1856
1874
|
setPresenceProvider: (E) => {
|
|
1857
|
-
E && (
|
|
1875
|
+
E && (l.setPainter(Cn(t, E, n.presence)), E.on("selectionChange", () => l.redraw()));
|
|
1858
1876
|
},
|
|
1859
|
-
setVisible: (E) =>
|
|
1877
|
+
setVisible: (E) => l.setVisible(E),
|
|
1860
1878
|
on: u.on,
|
|
1861
1879
|
off: u.off,
|
|
1862
1880
|
scrollIntoView: Tn(t, a),
|
|
1863
1881
|
state: o
|
|
1864
1882
|
};
|
|
1865
|
-
}
|
|
1883
|
+
};
|
|
1866
1884
|
export {
|
|
1867
|
-
|
|
1868
|
-
|
|
1885
|
+
et as DEFAULT_SELECTED_STYLE,
|
|
1886
|
+
H as DEFAULT_STYLE,
|
|
1869
1887
|
It as NOT_ANNOTATABLE_CLASS,
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1888
|
+
k as NOT_ANNOTATABLE_SELECTOR,
|
|
1889
|
+
L as Origin,
|
|
1890
|
+
Oe as PointerSelectAction,
|
|
1891
|
+
In as W3CTextFormat,
|
|
1892
|
+
Qt as cancelSingleClickEvents,
|
|
1893
|
+
On as createBody,
|
|
1875
1894
|
ue as createCanvasRenderer,
|
|
1876
1895
|
xe as createHighlightsRenderer,
|
|
1877
1896
|
we as createRenderer,
|
|
1878
1897
|
Se as createSpansRenderer,
|
|
1879
|
-
|
|
1898
|
+
Mn as createTextAnnotator,
|
|
1880
1899
|
En as createTextAnnotatorState,
|
|
1881
1900
|
ft as debounce,
|
|
1882
1901
|
Rn as fillDefaults,
|
|
1883
1902
|
Ln as getAnnotatableFragment,
|
|
1884
1903
|
Bn as getClientRectsPonyfill,
|
|
1885
1904
|
te as getQuoteContext,
|
|
1886
|
-
|
|
1887
|
-
|
|
1905
|
+
ut as getRangeAnnotatableContents,
|
|
1906
|
+
Y as isRevived,
|
|
1888
1907
|
oe as mergeClientRects,
|
|
1889
|
-
|
|
1908
|
+
qt as paint,
|
|
1890
1909
|
hn as parseW3CTextAnnotation,
|
|
1891
1910
|
ie as rangeToSelector,
|
|
1892
|
-
|
|
1911
|
+
ot as reviveAnnotation,
|
|
1893
1912
|
Mt as reviveSelector,
|
|
1894
|
-
|
|
1913
|
+
nt as reviveTarget,
|
|
1895
1914
|
fn as serializeW3CTextAnnotation,
|
|
1896
|
-
|
|
1915
|
+
Kt as splitAnnotatableRanges,
|
|
1897
1916
|
re as trimRange
|
|
1898
1917
|
};
|
|
1899
1918
|
//# sourceMappingURL=text-annotator.es.js.map
|