@recogito/text-annotator 3.0.0-rc.49 → 3.0.0-rc.50
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/utils/index.d.ts +3 -3
- package/dist/src/utils/isNotAnnotatable.d.ts +4 -0
- package/dist/src/utils/splitAnnotatableRanges.d.ts +0 -2
- package/dist/text-annotator.es.js +584 -589
- 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 +7 -8
- package/dist/src/utils/getAnnotatableFragment.d.ts +0 -5
|
@@ -1,21 +1,75 @@
|
|
|
1
|
-
const
|
|
1
|
+
const se = "not-annotatable", Z = `.${se}`, nt = (t) => {
|
|
2
2
|
var n;
|
|
3
|
+
return !!(t instanceof HTMLElement ? t.closest(Z) : (n = t.parentElement) == null ? void 0 : n.closest(Z));
|
|
4
|
+
}, Le = (t) => {
|
|
3
5
|
const e = t.commonAncestorContainer;
|
|
4
|
-
return
|
|
5
|
-
}, Te =
|
|
6
|
+
return !nt(e);
|
|
7
|
+
}, Te = (t) => t.addEventListener("click", (e) => {
|
|
8
|
+
// Allow clicks within not-annotatable elements
|
|
9
|
+
!e.target.closest(Z) && !e.target.closest("a") && e.preventDefault();
|
|
10
|
+
}), wt = (t) => ({
|
|
11
|
+
...t,
|
|
12
|
+
type: t.type,
|
|
13
|
+
x: t.x,
|
|
14
|
+
y: t.y,
|
|
15
|
+
clientX: t.clientX,
|
|
16
|
+
clientY: t.clientY,
|
|
17
|
+
offsetX: t.offsetX,
|
|
18
|
+
offsetY: t.offsetY,
|
|
19
|
+
screenX: t.screenX,
|
|
20
|
+
screenY: t.screenY,
|
|
21
|
+
isPrimary: t.isPrimary,
|
|
22
|
+
altKey: t.altKey,
|
|
23
|
+
ctrlKey: t.ctrlKey,
|
|
24
|
+
metaKey: t.metaKey,
|
|
25
|
+
shiftKey: t.shiftKey,
|
|
26
|
+
button: t.button,
|
|
27
|
+
buttons: t.buttons,
|
|
28
|
+
currentTarget: t.currentTarget,
|
|
29
|
+
target: t.target,
|
|
30
|
+
defaultPrevented: t.defaultPrevented,
|
|
31
|
+
detail: t.detail,
|
|
32
|
+
eventPhase: t.eventPhase,
|
|
33
|
+
pointerId: t.pointerId,
|
|
34
|
+
pointerType: t.pointerType,
|
|
35
|
+
timeStamp: t.timeStamp
|
|
36
|
+
}), dt = (t) => ({
|
|
37
|
+
...t,
|
|
38
|
+
type: t.type,
|
|
39
|
+
key: t.key,
|
|
40
|
+
code: t.code,
|
|
41
|
+
location: t.location,
|
|
42
|
+
repeat: t.repeat,
|
|
43
|
+
altKey: t.altKey,
|
|
44
|
+
ctrlKey: t.ctrlKey,
|
|
45
|
+
metaKey: t.metaKey,
|
|
46
|
+
shiftKey: t.shiftKey,
|
|
47
|
+
currentTarget: t.currentTarget,
|
|
48
|
+
target: t.target,
|
|
49
|
+
defaultPrevented: t.defaultPrevented,
|
|
50
|
+
detail: t.detail,
|
|
51
|
+
timeStamp: t.timeStamp
|
|
52
|
+
}), Oe = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Me = (t) => {
|
|
53
|
+
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
54
|
+
}, Vt = (t, e = 10) => {
|
|
55
|
+
let n;
|
|
56
|
+
return (...o) => {
|
|
57
|
+
clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);
|
|
58
|
+
};
|
|
59
|
+
}, Re = function* (t) {
|
|
6
60
|
const e = document.createNodeIterator(
|
|
7
61
|
t.commonAncestorContainer,
|
|
8
62
|
NodeFilter.SHOW_ELEMENT,
|
|
9
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
63
|
+
(o) => o instanceof HTMLElement && o.classList.contains(se) && !o.parentElement.closest(Z) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
10
64
|
);
|
|
11
65
|
let n;
|
|
12
66
|
for (; n = e.nextNode(); )
|
|
13
67
|
n instanceof HTMLElement && (yield n);
|
|
14
|
-
},
|
|
68
|
+
}, Be = (t) => {
|
|
15
69
|
if (!Le(t)) return [];
|
|
16
70
|
const e = [];
|
|
17
71
|
let n = null;
|
|
18
|
-
for (const o of
|
|
72
|
+
for (const o of Re(t)) {
|
|
19
73
|
let i;
|
|
20
74
|
n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
|
|
21
75
|
}
|
|
@@ -24,33 +78,20 @@ const ce = "not-annotatable", H = `.${ce}`, Le = (t) => {
|
|
|
24
78
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
25
79
|
}
|
|
26
80
|
return e.length > 0 ? e : [t];
|
|
27
|
-
},
|
|
28
|
-
const e = t.cloneContents();
|
|
29
|
-
return e.querySelectorAll(H).forEach((n) => n.remove()), e;
|
|
30
|
-
}, Me = (t) => t.addEventListener("click", (e) => {
|
|
31
|
-
// Allow clicks within not-annotatable elements
|
|
32
|
-
!e.target.closest(H) && !e.target.closest("a") && e.preventDefault();
|
|
33
|
-
}), Re = /mac/i.test(navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform), Be = (t) => {
|
|
34
|
-
!t.hasAttribute("tabindex") && t.tabIndex < 0 && t.setAttribute("tabindex", "-1"), t.classList.add("no-focus-outline");
|
|
35
|
-
}, Dt = (t, e = 10) => {
|
|
36
|
-
let n;
|
|
37
|
-
return (...o) => {
|
|
38
|
-
clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);
|
|
39
|
-
};
|
|
40
|
-
}, vo = (t) => {
|
|
81
|
+
}, _t = (t) => {
|
|
41
82
|
const e = t.cloneContents();
|
|
42
|
-
return e.querySelectorAll(
|
|
83
|
+
return e.querySelectorAll(Z).forEach((n) => n.remove()), e;
|
|
43
84
|
}, ke = (t, e, n = 10, o) => {
|
|
44
85
|
const i = o ? t.startContainer.parentElement.closest(o) : e, s = document.createRange();
|
|
45
86
|
s.setStart(i, 0), s.setEnd(t.startContainer, t.startOffset);
|
|
46
|
-
const a =
|
|
87
|
+
const a = _t(s).textContent, r = document.createRange();
|
|
47
88
|
r.setStart(t.endContainer, t.endOffset), i === document.body ? r.setEnd(i, i.childNodes.length) : r.setEndAfter(i);
|
|
48
|
-
const l =
|
|
89
|
+
const l = _t(r).textContent;
|
|
49
90
|
return {
|
|
50
91
|
prefix: a.substring(a.length - n),
|
|
51
92
|
suffix: l.substring(0, n)
|
|
52
93
|
};
|
|
53
|
-
},
|
|
94
|
+
}, F = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), Ie = /^\s*$/, _e = (t) => Ie.test(t.toString()), Ne = (t, e) => {
|
|
54
95
|
const n = (s) => Math.round(s * 10) / 10, o = {
|
|
55
96
|
top: n(t.top),
|
|
56
97
|
bottom: n(t.bottom),
|
|
@@ -101,16 +142,16 @@ const ce = "not-annotatable", H = `.${ce}`, Le = (t) => {
|
|
|
101
142
|
}, []), Ke = (t, e, n) => {
|
|
102
143
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
103
144
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
104
|
-
const s =
|
|
145
|
+
const s = _t(o).textContent, a = t.toString(), r = s.length || 0, l = r + a.length;
|
|
105
146
|
return n ? { quote: a, start: r, end: l, range: t, offsetReference: i } : { quote: a, start: r, end: l, range: t };
|
|
106
|
-
},
|
|
147
|
+
}, re = (t, e) => {
|
|
107
148
|
var u, h;
|
|
108
149
|
const { start: n, end: o } = t, i = t.offsetReference || e, s = document.createNodeIterator(
|
|
109
150
|
e,
|
|
110
151
|
NodeFilter.SHOW_TEXT,
|
|
111
152
|
(g) => {
|
|
112
153
|
var p;
|
|
113
|
-
return (p = g.parentElement) != null && p.closest(
|
|
154
|
+
return (p = g.parentElement) != null && p.closest(Z) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
114
155
|
}
|
|
115
156
|
);
|
|
116
157
|
let a = 0;
|
|
@@ -141,84 +182,42 @@ const ce = "not-annotatable", H = `.${ce}`, Le = (t) => {
|
|
|
141
182
|
...t,
|
|
142
183
|
range: r
|
|
143
184
|
};
|
|
144
|
-
},
|
|
185
|
+
}, yt = (t, e) => F(t.selector) ? t : {
|
|
145
186
|
...t,
|
|
146
|
-
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
147
|
-
},
|
|
187
|
+
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : re(n, e))
|
|
188
|
+
}, vt = (t, e) => F(t.target.selector) ? t : { ...t, target: yt(t.target, e) }, Ye = (t, e) => {
|
|
148
189
|
const n = t.cloneRange();
|
|
149
190
|
return e.contains(n.startContainer) || n.setStart(e, 0), e.contains(n.endContainer) || n.setEnd(e, e.childNodes.length), n;
|
|
150
|
-
},
|
|
151
|
-
...t,
|
|
152
|
-
type: t.type,
|
|
153
|
-
x: t.x,
|
|
154
|
-
y: t.y,
|
|
155
|
-
clientX: t.clientX,
|
|
156
|
-
clientY: t.clientY,
|
|
157
|
-
offsetX: t.offsetX,
|
|
158
|
-
offsetY: t.offsetY,
|
|
159
|
-
screenX: t.screenX,
|
|
160
|
-
screenY: t.screenY,
|
|
161
|
-
isPrimary: t.isPrimary,
|
|
162
|
-
altKey: t.altKey,
|
|
163
|
-
ctrlKey: t.ctrlKey,
|
|
164
|
-
metaKey: t.metaKey,
|
|
165
|
-
shiftKey: t.shiftKey,
|
|
166
|
-
button: t.button,
|
|
167
|
-
buttons: t.buttons,
|
|
168
|
-
currentTarget: t.currentTarget,
|
|
169
|
-
target: t.target,
|
|
170
|
-
defaultPrevented: t.defaultPrevented,
|
|
171
|
-
detail: t.detail,
|
|
172
|
-
eventPhase: t.eventPhase,
|
|
173
|
-
pointerId: t.pointerId,
|
|
174
|
-
pointerType: t.pointerType,
|
|
175
|
-
timeStamp: t.timeStamp
|
|
176
|
-
}), ut = (t) => ({
|
|
177
|
-
...t,
|
|
178
|
-
type: t.type,
|
|
179
|
-
key: t.key,
|
|
180
|
-
code: t.code,
|
|
181
|
-
location: t.location,
|
|
182
|
-
repeat: t.repeat,
|
|
183
|
-
altKey: t.altKey,
|
|
184
|
-
ctrlKey: t.ctrlKey,
|
|
185
|
-
metaKey: t.metaKey,
|
|
186
|
-
shiftKey: t.shiftKey,
|
|
187
|
-
currentTarget: t.currentTarget,
|
|
188
|
-
target: t.target,
|
|
189
|
-
defaultPrevented: t.defaultPrevented,
|
|
190
|
-
detail: t.detail,
|
|
191
|
-
timeStamp: t.timeStamp
|
|
192
|
-
}), de = (t) => {
|
|
191
|
+
}, ae = (t) => {
|
|
193
192
|
if (t === null)
|
|
194
193
|
return document.scrollingElement;
|
|
195
194
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
196
|
-
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
195
|
+
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : ae(t.parentElement);
|
|
197
196
|
}, De = (t, e) => (n) => {
|
|
198
197
|
const o = typeof n == "string" ? n : n.id, i = (a) => {
|
|
199
198
|
const r = s.getBoundingClientRect(), l = s.clientHeight, f = s.clientWidth, u = a.selector[0].range.getBoundingClientRect(), { width: h, height: g } = e.getAnnotationBounds(o), p = u.top - r.top, v = u.left - r.left, y = s.parentElement ? s.scrollTop : 0, m = s.parentElement ? s.scrollLeft : 0, d = p + y - (l - g) / 2, c = v + m - (f - h) / 2;
|
|
200
199
|
s.scroll({ top: d, left: c, behavior: "smooth" });
|
|
201
|
-
}, s =
|
|
200
|
+
}, s = ae(t);
|
|
202
201
|
if (s) {
|
|
203
202
|
const a = e.getAnnotation(o), { range: r } = a.target.selector[0];
|
|
204
203
|
if (r && !r.collapsed)
|
|
205
204
|
return i(a.target), !0;
|
|
206
205
|
{
|
|
207
|
-
const l =
|
|
206
|
+
const l = yt(a.target, t), { range: f } = l.selector[0];
|
|
208
207
|
if (f && !f.collapsed)
|
|
209
208
|
return i(l), !0;
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
return !1;
|
|
213
|
-
},
|
|
212
|
+
}, W = {
|
|
214
213
|
fill: "rgb(0, 128, 255)",
|
|
215
214
|
fillOpacity: 0.18
|
|
216
|
-
},
|
|
215
|
+
}, bt = {
|
|
217
216
|
fill: "rgb(0, 128, 255)",
|
|
218
217
|
fillOpacity: 0.45
|
|
219
218
|
}, Xe = (t, e, n, o, i) => {
|
|
220
219
|
var a, r;
|
|
221
|
-
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ?
|
|
220
|
+
const s = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ? bt : W) : n : (r = t.state) != null && r.selected ? bt : W;
|
|
222
221
|
return o && o.paint(t, e) || s;
|
|
223
222
|
}, Pe = (t) => {
|
|
224
223
|
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, s = -n, a = -e, r = o - n, l = i - e;
|
|
@@ -229,21 +228,21 @@ const ce = "not-annotatable", H = `.${ce}`, Le = (t) => {
|
|
|
229
228
|
const i = o.map((s) => s.id);
|
|
230
229
|
(e.size !== i.length || i.some((s) => !e.has(s))) && t.set(i), e = new Set(i);
|
|
231
230
|
};
|
|
232
|
-
},
|
|
231
|
+
}, Kt = (t, e, n, o) => {
|
|
233
232
|
const { store: i, selection: s, hover: a } = e;
|
|
234
233
|
let r, l, f;
|
|
235
234
|
const u = $e(n), h = (E) => {
|
|
236
|
-
const { x: R, y:
|
|
237
|
-
|
|
235
|
+
const { x: R, y: w } = t.getBoundingClientRect(), A = i.getAt(E.clientX - R, E.clientY - w, l);
|
|
236
|
+
A ? a.current !== A.id && (t.classList.add("hovered"), a.set(A.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
|
|
238
237
|
};
|
|
239
238
|
t.addEventListener("pointermove", h);
|
|
240
239
|
const g = (E = !1) => {
|
|
241
240
|
f && f.clear();
|
|
242
|
-
const R = Pe(t), { minX:
|
|
243
|
-
const
|
|
244
|
-
return { annotation:
|
|
241
|
+
const R = Pe(t), { minX: w, minY: A, maxX: x, maxY: C } = R, k = l ? i.getIntersecting(w, A, x, C).filter(({ annotation: Y }) => l(Y)) : i.getIntersecting(w, A, x, C), M = s.selected.map(({ id: Y }) => Y), D = k.map(({ annotation: Y, rects: Ee }) => {
|
|
242
|
+
const Se = M.includes(Y.id), Ce = Y.id === a.current;
|
|
243
|
+
return { annotation: Y, rects: Ee, state: { selected: Se, hover: Ce } };
|
|
245
244
|
});
|
|
246
|
-
o.redraw(
|
|
245
|
+
o.redraw(D, R, r, f, E), setTimeout(() => u(k.map(({ annotation: Y }) => Y)), 1);
|
|
247
246
|
}, p = (E) => {
|
|
248
247
|
f = E, g();
|
|
249
248
|
}, v = (E) => {
|
|
@@ -254,18 +253,18 @@ const ce = "not-annotatable", H = `.${ce}`, Le = (t) => {
|
|
|
254
253
|
i.observe(m);
|
|
255
254
|
const d = s.subscribe(() => g()), c = () => g(!0);
|
|
256
255
|
document.addEventListener("scroll", c, { capture: !0, passive: !0 });
|
|
257
|
-
const
|
|
256
|
+
const b = Vt(() => {
|
|
258
257
|
i.recalculatePositions(), f && f.reset(), g();
|
|
259
258
|
});
|
|
260
|
-
window.addEventListener("resize",
|
|
261
|
-
const S = new ResizeObserver(
|
|
259
|
+
window.addEventListener("resize", b);
|
|
260
|
+
const S = new ResizeObserver(b);
|
|
262
261
|
S.observe(t);
|
|
263
262
|
const T = { attributes: !0, childList: !0, subtree: !0 }, L = new MutationObserver((E) => {
|
|
264
|
-
E.every((
|
|
263
|
+
E.every((w) => w.target === t || t.contains(w.target)) || g(!0);
|
|
265
264
|
});
|
|
266
265
|
return L.observe(document.body, T), {
|
|
267
266
|
destroy: () => {
|
|
268
|
-
t.removeEventListener("pointermove", h), o.destroy(), i.unobserve(m), d(), document.removeEventListener("scroll", c), window.removeEventListener("resize",
|
|
267
|
+
t.removeEventListener("pointermove", h), o.destroy(), i.unobserve(m), d(), document.removeEventListener("scroll", c), window.removeEventListener("resize", b), S.disconnect(), L.disconnect();
|
|
269
268
|
},
|
|
270
269
|
redraw: g,
|
|
271
270
|
setStyle: v,
|
|
@@ -287,27 +286,27 @@ const ce = "not-annotatable", H = `.${ce}`, Le = (t) => {
|
|
|
287
286
|
n.clearRect(-0.5, -0.5, h + 1, g + 1), u && u.clear();
|
|
288
287
|
const { top: p, left: v } = l;
|
|
289
288
|
[...r].sort((m, d) => {
|
|
290
|
-
const { annotation: { target: { created: c } } } = m, { annotation: { target: { created:
|
|
291
|
-
return c.getTime() -
|
|
289
|
+
const { annotation: { target: { created: c } } } = m, { annotation: { target: { created: b } } } = d;
|
|
290
|
+
return c.getTime() - b.getTime();
|
|
292
291
|
}).forEach((m) => {
|
|
293
292
|
var S;
|
|
294
|
-
const d = f ? typeof f == "function" ? f(m.annotation, m.state) : f : (S = m.state) != null && S.selected ?
|
|
293
|
+
const d = f ? typeof f == "function" ? f(m.annotation, m.state) : f : (S = m.state) != null && S.selected ? bt : W, c = u && u.paint(m, l) || d, b = m.rects.map(({ x: T, y: L, width: O, height: E }) => ({
|
|
295
294
|
x: T + v,
|
|
296
295
|
y: L + p,
|
|
297
296
|
width: O,
|
|
298
297
|
height: E
|
|
299
298
|
}));
|
|
300
|
-
if (n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1,
|
|
299
|
+
if (n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1, b.forEach(
|
|
301
300
|
({ x: T, y: L, width: O, height: E }) => n.fillRect(T, L, O, E)
|
|
302
301
|
), c.underlineColor) {
|
|
303
302
|
n.globalAlpha = 1, n.strokeStyle = c.underlineColor, n.lineWidth = c.underlineThickness ?? 1;
|
|
304
303
|
const T = c.underlineOffset ?? 0;
|
|
305
|
-
|
|
304
|
+
b.forEach(({ x: L, y: O, width: E, height: R }) => {
|
|
306
305
|
n.beginPath(), n.moveTo(L, O + R + T), n.lineTo(L + E, O + R + T), n.stroke();
|
|
307
306
|
});
|
|
308
307
|
}
|
|
309
308
|
});
|
|
310
|
-
}), i =
|
|
309
|
+
}), i = Vt(() => {
|
|
311
310
|
je(e);
|
|
312
311
|
});
|
|
313
312
|
return window.addEventListener("resize", i), {
|
|
@@ -319,139 +318,139 @@ const ce = "not-annotatable", H = `.${ce}`, Le = (t) => {
|
|
|
319
318
|
},
|
|
320
319
|
redraw: o
|
|
321
320
|
};
|
|
322
|
-
}, Fe = (t, e, n) =>
|
|
323
|
-
var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) },
|
|
321
|
+
}, Fe = (t, e, n) => Kt(t, e, n, ze(t));
|
|
322
|
+
var We = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, j = function(t) {
|
|
324
323
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
325
|
-
},
|
|
324
|
+
}, N = function(t, e, n) {
|
|
326
325
|
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
|
|
327
326
|
}, X = function(t, e, n) {
|
|
328
327
|
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
|
|
329
|
-
},
|
|
328
|
+
}, ce = function(t) {
|
|
330
329
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
331
|
-
},
|
|
330
|
+
}, Xt = function(t) {
|
|
332
331
|
return { r: X(t.r, 0, 255), g: X(t.g, 0, 255), b: X(t.b, 0, 255), a: X(t.a) };
|
|
333
|
-
},
|
|
334
|
-
return { r:
|
|
335
|
-
}, qe = /^#([0-9a-f]{3,8})$/i,
|
|
332
|
+
}, At = function(t) {
|
|
333
|
+
return { r: N(t.r), g: N(t.g), b: N(t.b), a: N(t.a, 3) };
|
|
334
|
+
}, qe = /^#([0-9a-f]{3,8})$/i, ut = function(t) {
|
|
336
335
|
var e = t.toString(16);
|
|
337
336
|
return e.length < 2 ? "0" + e : e;
|
|
338
|
-
},
|
|
337
|
+
}, le = function(t) {
|
|
339
338
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = Math.max(e, n, o), a = s - Math.min(e, n, o), r = a ? s === e ? (n - o) / a : s === n ? 2 + (o - e) / a : 4 + (e - n) / a : 0;
|
|
340
339
|
return { h: 60 * (r < 0 ? r + 6 : r), s: s ? a / s * 100 : 0, v: s / 255 * 100, a: i };
|
|
341
|
-
},
|
|
340
|
+
}, de = function(t) {
|
|
342
341
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
343
342
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
344
343
|
var s = Math.floor(e), a = o * (1 - n), r = o * (1 - (e - s) * n), l = o * (1 - (1 - e + s) * n), f = s % 6;
|
|
345
344
|
return { r: 255 * [o, r, a, a, l, o][f], g: 255 * [l, o, o, r, a, a][f], b: 255 * [a, a, l, o, o, r][f], a: i };
|
|
346
|
-
},
|
|
347
|
-
return { h:
|
|
348
|
-
},
|
|
349
|
-
return { h:
|
|
350
|
-
},
|
|
351
|
-
return
|
|
345
|
+
}, Pt = function(t) {
|
|
346
|
+
return { h: ce(t.h), s: X(t.s, 0, 100), l: X(t.l, 0, 100), a: X(t.a) };
|
|
347
|
+
}, $t = function(t) {
|
|
348
|
+
return { h: N(t.h), s: N(t.s), l: N(t.l), a: N(t.a, 3) };
|
|
349
|
+
}, Ht = function(t) {
|
|
350
|
+
return de((n = (e = t).s, { h: e.h, s: (n *= ((o = e.l) < 50 ? o : 100 - o) / 100) > 0 ? 2 * n / (o + n) * 100 : 0, v: o + n, a: e.a }));
|
|
352
351
|
var e, n, o;
|
|
353
352
|
}, st = function(t) {
|
|
354
|
-
return { h: (e =
|
|
353
|
+
return { h: (e = le(t)).h, s: (i = (200 - (n = e.s)) * (o = e.v) / 100) > 0 && i < 200 ? n * o / 100 / (i <= 100 ? i : 200 - i) * 100 : 0, l: i / 2, a: e.a };
|
|
355
354
|
var e, n, o, i;
|
|
356
|
-
}, Ge = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Qe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Je = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ze = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,
|
|
355
|
+
}, Ge = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Qe = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Je = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Ze = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, jt = { string: [[function(t) {
|
|
357
356
|
var e = qe.exec(t);
|
|
358
|
-
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ?
|
|
357
|
+
return e ? (t = e[1]).length <= 4 ? { r: parseInt(t[0] + t[0], 16), g: parseInt(t[1] + t[1], 16), b: parseInt(t[2] + t[2], 16), a: t.length === 4 ? N(parseInt(t[3] + t[3], 16) / 255, 2) : 1 } : t.length === 6 || t.length === 8 ? { r: parseInt(t.substr(0, 2), 16), g: parseInt(t.substr(2, 2), 16), b: parseInt(t.substr(4, 2), 16), a: t.length === 8 ? N(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
359
358
|
}, "hex"], [function(t) {
|
|
360
359
|
var e = Je.exec(t) || Ze.exec(t);
|
|
361
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null :
|
|
360
|
+
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : Xt({ r: Number(e[1]) / (e[2] ? 100 / 255 : 1), g: Number(e[3]) / (e[4] ? 100 / 255 : 1), b: Number(e[5]) / (e[6] ? 100 / 255 : 1), a: e[7] === void 0 ? 1 : Number(e[7]) / (e[8] ? 100 : 1) }) : null;
|
|
362
361
|
}, "rgb"], [function(t) {
|
|
363
362
|
var e = Ge.exec(t) || Qe.exec(t);
|
|
364
363
|
if (!e) return null;
|
|
365
|
-
var n, o, i =
|
|
366
|
-
return
|
|
364
|
+
var n, o, i = Pt({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (We[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
|
|
365
|
+
return Ht(i);
|
|
367
366
|
}, "hsl"]], object: [[function(t) {
|
|
368
367
|
var e = t.r, n = t.g, o = t.b, i = t.a, s = i === void 0 ? 1 : i;
|
|
369
|
-
return
|
|
368
|
+
return j(e) && j(n) && j(o) ? Xt({ r: Number(e), g: Number(n), b: Number(o), a: Number(s) }) : null;
|
|
370
369
|
}, "rgb"], [function(t) {
|
|
371
370
|
var e = t.h, n = t.s, o = t.l, i = t.a, s = i === void 0 ? 1 : i;
|
|
372
|
-
if (!
|
|
373
|
-
var a =
|
|
374
|
-
return
|
|
371
|
+
if (!j(e) || !j(n) || !j(o)) return null;
|
|
372
|
+
var a = Pt({ h: Number(e), s: Number(n), l: Number(o), a: Number(s) });
|
|
373
|
+
return Ht(a);
|
|
375
374
|
}, "hsl"], [function(t) {
|
|
376
375
|
var e = t.h, n = t.s, o = t.v, i = t.a, s = i === void 0 ? 1 : i;
|
|
377
|
-
if (!
|
|
376
|
+
if (!j(e) || !j(n) || !j(o)) return null;
|
|
378
377
|
var a = function(r) {
|
|
379
|
-
return { h:
|
|
378
|
+
return { h: ce(r.h), s: X(r.s, 0, 100), v: X(r.v, 0, 100), a: X(r.a) };
|
|
380
379
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(s) });
|
|
381
|
-
return
|
|
382
|
-
}, "hsv"]] },
|
|
380
|
+
return de(a);
|
|
381
|
+
}, "hsv"]] }, zt = function(t, e) {
|
|
383
382
|
for (var n = 0; n < e.length; n++) {
|
|
384
383
|
var o = e[n][0](t);
|
|
385
384
|
if (o) return [o, e[n][1]];
|
|
386
385
|
}
|
|
387
386
|
return [null, void 0];
|
|
388
387
|
}, tn = function(t) {
|
|
389
|
-
return typeof t == "string" ?
|
|
390
|
-
},
|
|
388
|
+
return typeof t == "string" ? zt(t.trim(), jt.string) : typeof t == "object" && t !== null ? zt(t, jt.object) : [null, void 0];
|
|
389
|
+
}, xt = function(t, e) {
|
|
391
390
|
var n = st(t);
|
|
392
391
|
return { h: n.h, s: X(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
393
|
-
},
|
|
392
|
+
}, Et = function(t) {
|
|
394
393
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
395
|
-
},
|
|
394
|
+
}, Ft = function(t, e) {
|
|
396
395
|
var n = st(t);
|
|
397
396
|
return { h: n.h, s: n.s, l: X(n.l + 100 * e, 0, 100), a: n.a };
|
|
398
|
-
},
|
|
397
|
+
}, Wt = function() {
|
|
399
398
|
function t(e) {
|
|
400
399
|
this.parsed = tn(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
401
400
|
}
|
|
402
401
|
return t.prototype.isValid = function() {
|
|
403
402
|
return this.parsed !== null;
|
|
404
403
|
}, t.prototype.brightness = function() {
|
|
405
|
-
return
|
|
404
|
+
return N(Et(this.rgba), 2);
|
|
406
405
|
}, t.prototype.isDark = function() {
|
|
407
|
-
return
|
|
406
|
+
return Et(this.rgba) < 0.5;
|
|
408
407
|
}, t.prototype.isLight = function() {
|
|
409
|
-
return
|
|
408
|
+
return Et(this.rgba) >= 0.5;
|
|
410
409
|
}, t.prototype.toHex = function() {
|
|
411
|
-
return e =
|
|
410
|
+
return e = At(this.rgba), n = e.r, o = e.g, i = e.b, a = (s = e.a) < 1 ? ut(N(255 * s)) : "", "#" + ut(n) + ut(o) + ut(i) + a;
|
|
412
411
|
var e, n, o, i, s, a;
|
|
413
412
|
}, t.prototype.toRgb = function() {
|
|
414
|
-
return
|
|
413
|
+
return At(this.rgba);
|
|
415
414
|
}, t.prototype.toRgbString = function() {
|
|
416
|
-
return e =
|
|
415
|
+
return e = At(this.rgba), n = e.r, o = e.g, i = e.b, (s = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + s + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
417
416
|
var e, n, o, i, s;
|
|
418
417
|
}, t.prototype.toHsl = function() {
|
|
419
|
-
return
|
|
418
|
+
return $t(st(this.rgba));
|
|
420
419
|
}, t.prototype.toHslString = function() {
|
|
421
|
-
return e =
|
|
420
|
+
return e = $t(st(this.rgba)), n = e.h, o = e.s, i = e.l, (s = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + s + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
|
|
422
421
|
var e, n, o, i, s;
|
|
423
422
|
}, t.prototype.toHsv = function() {
|
|
424
|
-
return e =
|
|
423
|
+
return e = le(this.rgba), { h: N(e.h), s: N(e.s), v: N(e.v), a: N(e.a, 3) };
|
|
425
424
|
var e;
|
|
426
425
|
}, t.prototype.invert = function() {
|
|
427
426
|
return $({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
428
427
|
var e;
|
|
429
428
|
}, t.prototype.saturate = function(e) {
|
|
430
|
-
return e === void 0 && (e = 0.1), $(
|
|
429
|
+
return e === void 0 && (e = 0.1), $(xt(this.rgba, e));
|
|
431
430
|
}, t.prototype.desaturate = function(e) {
|
|
432
|
-
return e === void 0 && (e = 0.1), $(
|
|
431
|
+
return e === void 0 && (e = 0.1), $(xt(this.rgba, -e));
|
|
433
432
|
}, t.prototype.grayscale = function() {
|
|
434
|
-
return $(
|
|
433
|
+
return $(xt(this.rgba, -1));
|
|
435
434
|
}, t.prototype.lighten = function(e) {
|
|
436
|
-
return e === void 0 && (e = 0.1), $(
|
|
435
|
+
return e === void 0 && (e = 0.1), $(Ft(this.rgba, e));
|
|
437
436
|
}, t.prototype.darken = function(e) {
|
|
438
|
-
return e === void 0 && (e = 0.1), $(
|
|
437
|
+
return e === void 0 && (e = 0.1), $(Ft(this.rgba, -e));
|
|
439
438
|
}, t.prototype.rotate = function(e) {
|
|
440
439
|
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
441
440
|
}, t.prototype.alpha = function(e) {
|
|
442
|
-
return typeof e == "number" ? $({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) :
|
|
441
|
+
return typeof e == "number" ? $({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : N(this.rgba.a, 3);
|
|
443
442
|
var n;
|
|
444
443
|
}, t.prototype.hue = function(e) {
|
|
445
444
|
var n = st(this.rgba);
|
|
446
|
-
return typeof e == "number" ? $({ h: e, s: n.s, l: n.l, a: n.a }) :
|
|
445
|
+
return typeof e == "number" ? $({ h: e, s: n.s, l: n.l, a: n.a }) : N(n.h);
|
|
447
446
|
}, t.prototype.isEqual = function(e) {
|
|
448
447
|
return this.toHex() === $(e).toHex();
|
|
449
448
|
}, t;
|
|
450
449
|
}(), $ = function(t) {
|
|
451
|
-
return t instanceof
|
|
450
|
+
return t instanceof Wt ? t : new Wt(t);
|
|
452
451
|
};
|
|
453
452
|
const en = (t) => [
|
|
454
|
-
`background-color:${$((t == null ? void 0 : t.fill) ||
|
|
453
|
+
`background-color:${$((t == null ? void 0 : t.fill) || W.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? W.fillOpacity : t.fillOpacity).toHex()}`,
|
|
455
454
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
456
455
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
457
456
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
@@ -473,7 +472,7 @@ const en = (t) => [
|
|
|
473
472
|
Array.from(e).filter((h) => !f.has(h));
|
|
474
473
|
const u = s.map((h) => {
|
|
475
474
|
var v;
|
|
476
|
-
const g = r ? typeof r == "function" ? r(h.annotation, h.state) : r : (v = h.state) != null && v.selected ?
|
|
475
|
+
const g = r ? typeof r == "function" ? r(h.annotation, h.state) : r : (v = h.state) != null && v.selected ? bt : W, p = l && l.paint(h, a) || g;
|
|
477
476
|
return `::highlight(_${h.annotation.id}) { ${en(p)} }`;
|
|
478
477
|
});
|
|
479
478
|
t.innerHTML = u.join(`
|
|
@@ -483,9 +482,9 @@ const en = (t) => [
|
|
|
483
482
|
}), e = f;
|
|
484
483
|
}
|
|
485
484
|
};
|
|
486
|
-
}, on = (t, e, n) =>
|
|
487
|
-
var
|
|
488
|
-
function
|
|
485
|
+
}, on = (t, e, n) => Kt(t, e, n, nn());
|
|
486
|
+
var qt = Object.prototype.hasOwnProperty;
|
|
487
|
+
function Nt(t, e) {
|
|
489
488
|
var n, o;
|
|
490
489
|
if (t === e) return !0;
|
|
491
490
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -493,13 +492,13 @@ function Kt(t, e) {
|
|
|
493
492
|
if (n === RegExp) return t.toString() === e.toString();
|
|
494
493
|
if (n === Array) {
|
|
495
494
|
if ((o = t.length) === e.length)
|
|
496
|
-
for (; o-- &&
|
|
495
|
+
for (; o-- && Nt(t[o], e[o]); ) ;
|
|
497
496
|
return o === -1;
|
|
498
497
|
}
|
|
499
498
|
if (!n || typeof t == "object") {
|
|
500
499
|
o = 0;
|
|
501
500
|
for (n in t)
|
|
502
|
-
if (
|
|
501
|
+
if (qt.call(t, n) && ++o && !qt.call(e, n) || !(n in e) || !Nt(t[n], e[n])) return !1;
|
|
503
502
|
return Object.keys(e).length === o;
|
|
504
503
|
}
|
|
505
504
|
}
|
|
@@ -518,7 +517,7 @@ const sn = (t, e) => {
|
|
|
518
517
|
e.remove();
|
|
519
518
|
},
|
|
520
519
|
redraw: (a, r, l, f, u) => {
|
|
521
|
-
const g = !(
|
|
520
|
+
const g = !(Nt(n, a) && u);
|
|
522
521
|
if (!f && !g) return;
|
|
523
522
|
g && (e.innerHTML = ""), [...a].sort((v, y) => {
|
|
524
523
|
const { annotation: { target: { created: m } } } = v, { annotation: { target: { created: d } } } = y;
|
|
@@ -528,7 +527,7 @@ const sn = (t, e) => {
|
|
|
528
527
|
const m = sn(y, a), d = Xe(v, r, l, f, m);
|
|
529
528
|
if (g) {
|
|
530
529
|
const c = document.createElement("span");
|
|
531
|
-
c.className = "r6o-annotation", c.dataset.annotation = v.annotation.id, c.style.left = `${y.x}px`, c.style.top = `${y.y}px`, c.style.width = `${y.width}px`, c.style.height = `${y.height}px`, c.style.backgroundColor = $((d == null ? void 0 : d.fill) ||
|
|
530
|
+
c.className = "r6o-annotation", c.dataset.annotation = v.annotation.id, c.style.left = `${y.x}px`, c.style.top = `${y.y}px`, c.style.width = `${y.width}px`, c.style.height = `${y.height}px`, c.style.backgroundColor = $((d == null ? void 0 : d.fill) || W.fill).alpha((d == null ? void 0 : d.fillOpacity) === void 0 ? W.fillOpacity : d.fillOpacity).toHex(), d.underlineStyle && (c.style.borderStyle = d.underlineStyle), d.underlineColor && (c.style.borderColor = d.underlineColor), d.underlineThickness && (c.style.borderBottomWidth = `${d.underlineThickness}px`), d.underlineOffset && (c.style.paddingBottom = `${d.underlineOffset}px`), e.appendChild(c);
|
|
532
531
|
}
|
|
533
532
|
});
|
|
534
533
|
}), n = a;
|
|
@@ -537,32 +536,32 @@ const sn = (t, e) => {
|
|
|
537
536
|
a ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
538
537
|
}
|
|
539
538
|
};
|
|
540
|
-
}, an = (t, e, n) =>
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
V.push((Tt + 256).toString(16).slice(1));
|
|
539
|
+
}, an = (t, e, n) => Kt(t, e, n, rn(t)), U = [];
|
|
540
|
+
for (let t = 0; t < 256; ++t)
|
|
541
|
+
U.push((t + 256).toString(16).slice(1));
|
|
544
542
|
function cn(t, e = 0) {
|
|
545
|
-
return (
|
|
543
|
+
return (U[t[e + 0]] + U[t[e + 1]] + U[t[e + 2]] + U[t[e + 3]] + "-" + U[t[e + 4]] + U[t[e + 5]] + "-" + U[t[e + 6]] + U[t[e + 7]] + "-" + U[t[e + 8]] + U[t[e + 9]] + "-" + U[t[e + 10]] + U[t[e + 11]] + U[t[e + 12]] + U[t[e + 13]] + U[t[e + 14]] + U[t[e + 15]]).toLowerCase();
|
|
546
544
|
}
|
|
547
|
-
|
|
545
|
+
let St;
|
|
546
|
+
const ln = new Uint8Array(16);
|
|
548
547
|
function dn() {
|
|
549
|
-
if (!
|
|
550
|
-
|
|
551
|
-
|
|
548
|
+
if (!St) {
|
|
549
|
+
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
550
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
551
|
+
St = crypto.getRandomValues.bind(crypto);
|
|
552
|
+
}
|
|
553
|
+
return St(ln);
|
|
552
554
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
randomUUID
|
|
556
|
-
|
|
557
|
-
function pe(t, e, n) {
|
|
558
|
-
if (Zt.randomUUID && !e && !t)
|
|
559
|
-
return Zt.randomUUID();
|
|
555
|
+
const un = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Gt = { randomUUID: un };
|
|
556
|
+
function ue(t, e, n) {
|
|
557
|
+
if (Gt.randomUUID && !e && !t)
|
|
558
|
+
return Gt.randomUUID();
|
|
560
559
|
t = t || {};
|
|
561
|
-
|
|
560
|
+
const o = t.random || (t.rng || dn)();
|
|
562
561
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, cn(o);
|
|
563
562
|
}
|
|
564
|
-
var
|
|
565
|
-
function
|
|
563
|
+
var Qt = Object.prototype.hasOwnProperty;
|
|
564
|
+
function q(t, e) {
|
|
566
565
|
var n, o;
|
|
567
566
|
if (t === e) return !0;
|
|
568
567
|
if (t && e && (n = t.constructor) === e.constructor) {
|
|
@@ -570,52 +569,52 @@ function G(t, e) {
|
|
|
570
569
|
if (n === RegExp) return t.toString() === e.toString();
|
|
571
570
|
if (n === Array) {
|
|
572
571
|
if ((o = t.length) === e.length)
|
|
573
|
-
for (; o-- &&
|
|
572
|
+
for (; o-- && q(t[o], e[o]); ) ;
|
|
574
573
|
return o === -1;
|
|
575
574
|
}
|
|
576
575
|
if (!n || typeof t == "object") {
|
|
577
576
|
o = 0;
|
|
578
577
|
for (n in t)
|
|
579
|
-
if (
|
|
578
|
+
if (Qt.call(t, n) && ++o && !Qt.call(e, n) || !(n in e) || !q(t[n], e[n])) return !1;
|
|
580
579
|
return Object.keys(e).length === o;
|
|
581
580
|
}
|
|
582
581
|
}
|
|
583
582
|
return t !== t && e !== e;
|
|
584
583
|
}
|
|
585
|
-
function
|
|
584
|
+
function Ct() {
|
|
586
585
|
}
|
|
587
586
|
function fn(t, e) {
|
|
588
587
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
589
588
|
}
|
|
590
|
-
const
|
|
591
|
-
function
|
|
589
|
+
const G = [];
|
|
590
|
+
function Yt(t, e = Ct) {
|
|
592
591
|
let n;
|
|
593
592
|
const o = /* @__PURE__ */ new Set();
|
|
594
593
|
function i(r) {
|
|
595
594
|
if (fn(t, r) && (t = r, n)) {
|
|
596
|
-
const l = !
|
|
595
|
+
const l = !G.length;
|
|
597
596
|
for (const f of o)
|
|
598
|
-
f[1](),
|
|
597
|
+
f[1](), G.push(f, t);
|
|
599
598
|
if (l) {
|
|
600
|
-
for (let f = 0; f <
|
|
601
|
-
|
|
602
|
-
|
|
599
|
+
for (let f = 0; f < G.length; f += 2)
|
|
600
|
+
G[f][0](G[f + 1]);
|
|
601
|
+
G.length = 0;
|
|
603
602
|
}
|
|
604
603
|
}
|
|
605
604
|
}
|
|
606
605
|
function s(r) {
|
|
607
606
|
i(r(t));
|
|
608
607
|
}
|
|
609
|
-
function a(r, l =
|
|
608
|
+
function a(r, l = Ct) {
|
|
610
609
|
const f = [r, l];
|
|
611
|
-
return o.add(f), o.size === 1 && (n = e(i, s) ||
|
|
610
|
+
return o.add(f), o.size === 1 && (n = e(i, s) || Ct), r(t), () => {
|
|
612
611
|
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
613
612
|
};
|
|
614
613
|
}
|
|
615
614
|
return { set: i, update: s, subscribe: a };
|
|
616
615
|
}
|
|
617
616
|
const hn = (t) => {
|
|
618
|
-
const { subscribe: e, set: n } =
|
|
617
|
+
const { subscribe: e, set: n } = Yt();
|
|
619
618
|
let o;
|
|
620
619
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
621
620
|
if (o) {
|
|
@@ -632,12 +631,12 @@ const hn = (t) => {
|
|
|
632
631
|
};
|
|
633
632
|
};
|
|
634
633
|
var pn = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(pn || {});
|
|
635
|
-
const
|
|
636
|
-
const { subscribe: o, set: i } =
|
|
637
|
-
let s = e, a =
|
|
634
|
+
const ft = { selected: [] }, gn = (t, e, n) => {
|
|
635
|
+
const { subscribe: o, set: i } = Yt(ft);
|
|
636
|
+
let s = e, a = ft;
|
|
638
637
|
o((v) => a = v);
|
|
639
638
|
const r = () => {
|
|
640
|
-
|
|
639
|
+
q(a, ft) || i(ft);
|
|
641
640
|
}, l = () => {
|
|
642
641
|
var v;
|
|
643
642
|
return ((v = a.selected) == null ? void 0 : v.length) === 0;
|
|
@@ -652,7 +651,7 @@ const pt = { selected: [] }, gn = (t, e, n) => {
|
|
|
652
651
|
console.warn("Invalid selection: " + v);
|
|
653
652
|
return;
|
|
654
653
|
}
|
|
655
|
-
switch (
|
|
654
|
+
switch (Jt(m, s)) {
|
|
656
655
|
case "EDIT":
|
|
657
656
|
i({ selected: [{ id: v, editable: !0 }], event: y });
|
|
658
657
|
break;
|
|
@@ -666,8 +665,8 @@ const pt = { selected: [] }, gn = (t, e, n) => {
|
|
|
666
665
|
const m = Array.isArray(v) ? v : [v], d = m.map((c) => t.getAnnotation(c)).filter((c) => !!c);
|
|
667
666
|
i({
|
|
668
667
|
selected: d.map((c) => {
|
|
669
|
-
const
|
|
670
|
-
return { id: c.id, editable:
|
|
668
|
+
const b = y === void 0 ? Jt(c, s) === "EDIT" : y;
|
|
669
|
+
return { id: c.id, editable: b };
|
|
671
670
|
})
|
|
672
671
|
}), d.length !== m.length && console.warn("Invalid selection", v);
|
|
673
672
|
}, g = (v) => {
|
|
@@ -696,31 +695,31 @@ const pt = { selected: [] }, gn = (t, e, n) => {
|
|
|
696
695
|
subscribe: o,
|
|
697
696
|
userSelect: u
|
|
698
697
|
};
|
|
699
|
-
},
|
|
700
|
-
var
|
|
701
|
-
for (var
|
|
702
|
-
|
|
698
|
+
}, Jt = (t, e, n) => typeof e == "function" ? e(t) : e || "EDIT";
|
|
699
|
+
var V = [];
|
|
700
|
+
for (var Lt = 0; Lt < 256; ++Lt)
|
|
701
|
+
V.push((Lt + 256).toString(16).slice(1));
|
|
703
702
|
function mn(t, e = 0) {
|
|
704
|
-
return (
|
|
703
|
+
return (V[t[e + 0]] + V[t[e + 1]] + V[t[e + 2]] + V[t[e + 3]] + "-" + V[t[e + 4]] + V[t[e + 5]] + "-" + V[t[e + 6]] + V[t[e + 7]] + "-" + V[t[e + 8]] + V[t[e + 9]] + "-" + V[t[e + 10]] + V[t[e + 11]] + V[t[e + 12]] + V[t[e + 13]] + V[t[e + 14]] + V[t[e + 15]]).toLowerCase();
|
|
705
704
|
}
|
|
706
|
-
var
|
|
705
|
+
var ht, yn = new Uint8Array(16);
|
|
707
706
|
function bn() {
|
|
708
|
-
if (!
|
|
707
|
+
if (!ht && (ht = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ht))
|
|
709
708
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
710
|
-
return
|
|
709
|
+
return ht(yn);
|
|
711
710
|
}
|
|
712
711
|
var wn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
713
|
-
const
|
|
712
|
+
const Zt = {
|
|
714
713
|
randomUUID: wn
|
|
715
714
|
};
|
|
716
|
-
function
|
|
717
|
-
if (
|
|
718
|
-
return
|
|
715
|
+
function fe(t, e, n) {
|
|
716
|
+
if (Zt.randomUUID && !e && !t)
|
|
717
|
+
return Zt.randomUUID();
|
|
719
718
|
t = t || {};
|
|
720
719
|
var o = t.random || (t.rng || bn)();
|
|
721
720
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, mn(o);
|
|
722
721
|
}
|
|
723
|
-
const
|
|
722
|
+
const Tt = (t) => {
|
|
724
723
|
const e = (n) => {
|
|
725
724
|
const o = { ...n };
|
|
726
725
|
return n.created && typeof n.created == "string" && (o.created = new Date(n.created)), n.updated && typeof n.updated == "string" && (o.updated = new Date(n.updated)), o;
|
|
@@ -730,8 +729,8 @@ const Rt = (t) => {
|
|
|
730
729
|
bodies: (t.bodies || []).map(e),
|
|
731
730
|
target: e(t.target)
|
|
732
731
|
};
|
|
733
|
-
},
|
|
734
|
-
id:
|
|
732
|
+
}, vo = (t, e, n, o) => ({
|
|
733
|
+
id: fe(),
|
|
735
734
|
annotation: typeof t == "string" ? t : t.id,
|
|
736
735
|
created: n || /* @__PURE__ */ new Date(),
|
|
737
736
|
creator: o,
|
|
@@ -744,8 +743,8 @@ const Rt = (t) => {
|
|
|
744
743
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
745
744
|
}, xn = (t, e) => e.bodies.map((n) => {
|
|
746
745
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
747
|
-
return { newBody: n, oldBody: o && !
|
|
748
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), En = (t, e) => !
|
|
746
|
+
return { newBody: n, oldBody: o && !q(o, n) ? o : void 0 };
|
|
747
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), En = (t, e) => !q(t.target, e.target), he = (t, e) => {
|
|
749
748
|
const n = vn(t, e), o = An(t, e), i = xn(t, e);
|
|
750
749
|
return {
|
|
751
750
|
oldValue: t,
|
|
@@ -756,7 +755,7 @@ const Rt = (t) => {
|
|
|
756
755
|
targetUpdated: En(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
757
756
|
};
|
|
758
757
|
};
|
|
759
|
-
var
|
|
758
|
+
var B = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t.SILENT = "SILENT", t))(B || {});
|
|
760
759
|
const Sn = (t, e) => {
|
|
761
760
|
var n, o;
|
|
762
761
|
const { changes: i, origin: s } = e;
|
|
@@ -791,15 +790,15 @@ const Sn = (t, e) => {
|
|
|
791
790
|
const { oldValue: g, newValue: p } = h;
|
|
792
791
|
if (a.has(p.id)) {
|
|
793
792
|
const v = e.updated.find((y) => y.oldValue.id === p.id).newValue;
|
|
794
|
-
return
|
|
793
|
+
return he(g, v);
|
|
795
794
|
} else
|
|
796
795
|
return h;
|
|
797
796
|
}),
|
|
798
797
|
...(e.updated || []).filter(({ oldValue: h }) => !r.has(h.id))
|
|
799
798
|
];
|
|
800
799
|
return { created: l, deleted: f, updated: u };
|
|
801
|
-
},
|
|
802
|
-
const e = t.id === void 0 ?
|
|
800
|
+
}, Ot = (t) => {
|
|
801
|
+
const e = t.id === void 0 ? fe() : t.id;
|
|
803
802
|
return {
|
|
804
803
|
...t,
|
|
805
804
|
id: e,
|
|
@@ -813,175 +812,175 @@ const Sn = (t, e) => {
|
|
|
813
812
|
}
|
|
814
813
|
};
|
|
815
814
|
}, Ln = (t) => t.id !== void 0, Tn = () => {
|
|
816
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (
|
|
817
|
-
n.push({ onChange:
|
|
818
|
-
}, i = (
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
}, s = (
|
|
822
|
-
const
|
|
823
|
-
origin:
|
|
815
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (w, A = {}) => {
|
|
816
|
+
n.push({ onChange: w, options: A });
|
|
817
|
+
}, i = (w) => {
|
|
818
|
+
const A = n.findIndex((x) => x.onChange == w);
|
|
819
|
+
A > -1 && n.splice(A, 1);
|
|
820
|
+
}, s = (w, A) => {
|
|
821
|
+
const x = {
|
|
822
|
+
origin: w,
|
|
824
823
|
changes: {
|
|
825
|
-
created:
|
|
826
|
-
updated:
|
|
827
|
-
deleted:
|
|
824
|
+
created: A.created || [],
|
|
825
|
+
updated: A.updated || [],
|
|
826
|
+
deleted: A.deleted || []
|
|
828
827
|
},
|
|
829
828
|
state: [...t.values()]
|
|
830
829
|
};
|
|
831
830
|
n.forEach((C) => {
|
|
832
|
-
Sn(C,
|
|
831
|
+
Sn(C, x) && C.onChange(x);
|
|
833
832
|
});
|
|
834
|
-
}, a = (
|
|
835
|
-
if (
|
|
836
|
-
throw Error(`Cannot add annotation ${
|
|
833
|
+
}, a = (w, A = B.LOCAL) => {
|
|
834
|
+
if (w.id && t.get(w.id))
|
|
835
|
+
throw Error(`Cannot add annotation ${w.id} - exists already`);
|
|
837
836
|
{
|
|
838
|
-
const
|
|
839
|
-
t.set(
|
|
837
|
+
const x = Ot(w);
|
|
838
|
+
t.set(x.id, x), x.bodies.forEach((C) => e.set(C.id, x.id)), s(A, { created: [x] });
|
|
840
839
|
}
|
|
841
|
-
}, r = (
|
|
842
|
-
const
|
|
843
|
-
if (
|
|
844
|
-
const M =
|
|
845
|
-
return C ===
|
|
840
|
+
}, r = (w, A) => {
|
|
841
|
+
const x = Ot(typeof w == "string" ? A : w), C = typeof w == "string" ? w : w.id, k = C && t.get(C);
|
|
842
|
+
if (k) {
|
|
843
|
+
const M = he(k, x);
|
|
844
|
+
return C === x.id ? t.set(C, x) : (t.delete(C), t.set(x.id, x)), k.bodies.forEach((D) => e.delete(D.id)), x.bodies.forEach((D) => e.set(D.id, x.id)), M;
|
|
846
845
|
} else
|
|
847
846
|
console.warn(`Cannot update annotation ${C} - does not exist`);
|
|
848
|
-
}, l = (
|
|
849
|
-
const C = Ln(
|
|
850
|
-
|
|
851
|
-
}, f = (
|
|
852
|
-
const
|
|
853
|
-
const M = r(
|
|
847
|
+
}, l = (w, A = B.LOCAL, x = B.LOCAL) => {
|
|
848
|
+
const C = Ln(A) ? x : A, k = r(w, A);
|
|
849
|
+
k && s(C, { updated: [k] });
|
|
850
|
+
}, f = (w, A = B.LOCAL) => {
|
|
851
|
+
const x = w.reduce((C, k) => {
|
|
852
|
+
const M = r(k);
|
|
854
853
|
return M ? [...C, M] : C;
|
|
855
854
|
}, []);
|
|
856
|
-
|
|
857
|
-
}, u = (
|
|
858
|
-
const
|
|
859
|
-
if (
|
|
855
|
+
x.length > 0 && s(A, { updated: x });
|
|
856
|
+
}, u = (w, A = B.LOCAL) => {
|
|
857
|
+
const x = t.get(w.annotation);
|
|
858
|
+
if (x) {
|
|
860
859
|
const C = {
|
|
861
|
-
...
|
|
862
|
-
bodies: [...
|
|
860
|
+
...x,
|
|
861
|
+
bodies: [...x.bodies, w]
|
|
863
862
|
};
|
|
864
|
-
t.set(
|
|
865
|
-
oldValue:
|
|
863
|
+
t.set(x.id, C), e.set(w.id, C.id), s(A, { updated: [{
|
|
864
|
+
oldValue: x,
|
|
866
865
|
newValue: C,
|
|
867
|
-
bodiesCreated: [
|
|
866
|
+
bodiesCreated: [w]
|
|
868
867
|
}] });
|
|
869
868
|
} else
|
|
870
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
871
|
-
}, h = () => [...t.values()], g = (
|
|
872
|
-
const
|
|
873
|
-
t.clear(), e.clear(), s(
|
|
874
|
-
}, p = (
|
|
875
|
-
const C =
|
|
876
|
-
if (
|
|
877
|
-
const
|
|
869
|
+
console.warn(`Attempt to add body to missing annotation: ${w.annotation}`);
|
|
870
|
+
}, h = () => [...t.values()], g = (w = B.LOCAL) => {
|
|
871
|
+
const A = [...t.values()];
|
|
872
|
+
t.clear(), e.clear(), s(w, { deleted: A });
|
|
873
|
+
}, p = (w, A = !0, x = B.LOCAL) => {
|
|
874
|
+
const C = w.map(Ot);
|
|
875
|
+
if (A) {
|
|
876
|
+
const k = [...t.values()];
|
|
878
877
|
t.clear(), e.clear(), C.forEach((M) => {
|
|
879
|
-
t.set(M.id, M), M.bodies.forEach((
|
|
880
|
-
}), s(
|
|
878
|
+
t.set(M.id, M), M.bodies.forEach((D) => e.set(D.id, M.id));
|
|
879
|
+
}), s(x, { created: C, deleted: k });
|
|
881
880
|
} else {
|
|
882
|
-
const
|
|
883
|
-
const
|
|
884
|
-
return
|
|
881
|
+
const k = w.reduce((M, D) => {
|
|
882
|
+
const Y = D.id && t.get(D.id);
|
|
883
|
+
return Y ? [...M, Y] : M;
|
|
885
884
|
}, []);
|
|
886
|
-
if (
|
|
887
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${
|
|
885
|
+
if (k.length > 0)
|
|
886
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${k.map((M) => M.id).join(", ")}`);
|
|
888
887
|
C.forEach((M) => {
|
|
889
|
-
t.set(M.id, M), M.bodies.forEach((
|
|
890
|
-
}), s(
|
|
888
|
+
t.set(M.id, M), M.bodies.forEach((D) => e.set(D.id, M.id));
|
|
889
|
+
}), s(x, { created: C });
|
|
891
890
|
}
|
|
892
|
-
}, v = (
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
return t.delete(
|
|
896
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
897
|
-
}, y = (
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
}, m = (
|
|
901
|
-
const
|
|
902
|
-
const M = v(
|
|
891
|
+
}, v = (w) => {
|
|
892
|
+
const A = typeof w == "string" ? w : w.id, x = t.get(A);
|
|
893
|
+
if (x)
|
|
894
|
+
return t.delete(A), x.bodies.forEach((C) => e.delete(C.id)), x;
|
|
895
|
+
console.warn(`Attempt to delete missing annotation: ${A}`);
|
|
896
|
+
}, y = (w, A = B.LOCAL) => {
|
|
897
|
+
const x = v(w);
|
|
898
|
+
x && s(A, { deleted: [x] });
|
|
899
|
+
}, m = (w, A = B.LOCAL) => {
|
|
900
|
+
const x = w.reduce((C, k) => {
|
|
901
|
+
const M = v(k);
|
|
903
902
|
return M ? [...C, M] : C;
|
|
904
903
|
}, []);
|
|
905
|
-
|
|
906
|
-
}, d = (
|
|
907
|
-
const
|
|
908
|
-
if (
|
|
909
|
-
const
|
|
910
|
-
if (
|
|
911
|
-
e.delete(
|
|
904
|
+
x.length > 0 && s(A, { deleted: x });
|
|
905
|
+
}, d = (w) => {
|
|
906
|
+
const A = t.get(w.annotation);
|
|
907
|
+
if (A) {
|
|
908
|
+
const x = A.bodies.find((C) => C.id === w.id);
|
|
909
|
+
if (x) {
|
|
910
|
+
e.delete(x.id);
|
|
912
911
|
const C = {
|
|
913
|
-
...
|
|
914
|
-
bodies:
|
|
912
|
+
...A,
|
|
913
|
+
bodies: A.bodies.filter((k) => k.id !== w.id)
|
|
915
914
|
};
|
|
916
|
-
return t.set(
|
|
917
|
-
oldValue:
|
|
915
|
+
return t.set(A.id, C), {
|
|
916
|
+
oldValue: A,
|
|
918
917
|
newValue: C,
|
|
919
|
-
bodiesDeleted: [
|
|
918
|
+
bodiesDeleted: [x]
|
|
920
919
|
};
|
|
921
920
|
} else
|
|
922
|
-
console.warn(`Attempt to delete missing body ${
|
|
921
|
+
console.warn(`Attempt to delete missing body ${w.id} from annotation ${w.annotation}`);
|
|
923
922
|
} else
|
|
924
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
925
|
-
}, c = (
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
},
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
}, S = (
|
|
932
|
-
const
|
|
933
|
-
return
|
|
934
|
-
}, T = (
|
|
935
|
-
const
|
|
936
|
-
if (
|
|
937
|
-
const
|
|
938
|
-
if (
|
|
939
|
-
return
|
|
940
|
-
console.error(`Store integrity error: body ${
|
|
923
|
+
console.warn(`Attempt to delete body from missing annotation ${w.annotation}`);
|
|
924
|
+
}, c = (w, A = B.LOCAL) => {
|
|
925
|
+
const x = d(w);
|
|
926
|
+
x && s(A, { updated: [x] });
|
|
927
|
+
}, b = (w, A = B.LOCAL) => {
|
|
928
|
+
const x = w.map((C) => d(C)).filter(Boolean);
|
|
929
|
+
x.length > 0 && s(A, { updated: x });
|
|
930
|
+
}, S = (w) => {
|
|
931
|
+
const A = t.get(w);
|
|
932
|
+
return A ? { ...A } : void 0;
|
|
933
|
+
}, T = (w) => {
|
|
934
|
+
const A = e.get(w);
|
|
935
|
+
if (A) {
|
|
936
|
+
const x = S(A).bodies.find((C) => C.id === w);
|
|
937
|
+
if (x)
|
|
938
|
+
return x;
|
|
939
|
+
console.error(`Store integrity error: body ${w} in index, but not in annotation`);
|
|
941
940
|
} else
|
|
942
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
943
|
-
}, L = (
|
|
944
|
-
if (
|
|
941
|
+
console.warn(`Attempt to retrieve missing body: ${w}`);
|
|
942
|
+
}, L = (w, A) => {
|
|
943
|
+
if (w.annotation !== A.annotation)
|
|
945
944
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
const C =
|
|
949
|
-
...
|
|
950
|
-
bodies:
|
|
945
|
+
const x = t.get(w.annotation);
|
|
946
|
+
if (x) {
|
|
947
|
+
const C = x.bodies.find((M) => M.id === w.id), k = {
|
|
948
|
+
...x,
|
|
949
|
+
bodies: x.bodies.map((M) => M.id === C.id ? A : M)
|
|
951
950
|
};
|
|
952
|
-
return t.set(
|
|
953
|
-
oldValue:
|
|
954
|
-
newValue:
|
|
955
|
-
bodiesUpdated: [{ oldBody: C, newBody:
|
|
951
|
+
return t.set(x.id, k), C.id !== A.id && (e.delete(C.id), e.set(A.id, k.id)), {
|
|
952
|
+
oldValue: x,
|
|
953
|
+
newValue: k,
|
|
954
|
+
bodiesUpdated: [{ oldBody: C, newBody: A }]
|
|
956
955
|
};
|
|
957
956
|
} else
|
|
958
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
959
|
-
}, O = (
|
|
960
|
-
const C = L(
|
|
961
|
-
C && s(
|
|
962
|
-
}, E = (
|
|
963
|
-
const
|
|
964
|
-
s(
|
|
965
|
-
}, R = (
|
|
966
|
-
const
|
|
967
|
-
if (
|
|
968
|
-
const
|
|
969
|
-
...
|
|
957
|
+
console.warn(`Attempt to add body to missing annotation ${w.annotation}`);
|
|
958
|
+
}, O = (w, A, x = B.LOCAL) => {
|
|
959
|
+
const C = L(w, A);
|
|
960
|
+
C && s(x, { updated: [C] });
|
|
961
|
+
}, E = (w, A = B.LOCAL) => {
|
|
962
|
+
const x = w.map((C) => L({ id: C.id, annotation: C.annotation }, C)).filter(Boolean);
|
|
963
|
+
s(A, { updated: x });
|
|
964
|
+
}, R = (w) => {
|
|
965
|
+
const A = t.get(w.annotation);
|
|
966
|
+
if (A) {
|
|
967
|
+
const x = {
|
|
968
|
+
...A,
|
|
970
969
|
target: {
|
|
971
|
-
...
|
|
972
|
-
...
|
|
970
|
+
...A.target,
|
|
971
|
+
...w
|
|
973
972
|
}
|
|
974
973
|
};
|
|
975
|
-
return t.set(
|
|
976
|
-
oldValue:
|
|
977
|
-
newValue:
|
|
974
|
+
return t.set(A.id, x), {
|
|
975
|
+
oldValue: A,
|
|
976
|
+
newValue: x,
|
|
978
977
|
targetUpdated: {
|
|
979
|
-
oldTarget:
|
|
980
|
-
newTarget:
|
|
978
|
+
oldTarget: A.target,
|
|
979
|
+
newTarget: w
|
|
981
980
|
}
|
|
982
981
|
};
|
|
983
982
|
} else
|
|
984
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
983
|
+
console.warn(`Attempt to update target on missing annotation: ${w.annotation}`);
|
|
985
984
|
};
|
|
986
985
|
return {
|
|
987
986
|
addAnnotation: a,
|
|
@@ -989,12 +988,12 @@ const Sn = (t, e) => {
|
|
|
989
988
|
all: h,
|
|
990
989
|
bulkAddAnnotation: p,
|
|
991
990
|
bulkDeleteAnnotation: m,
|
|
992
|
-
bulkDeleteBodies:
|
|
991
|
+
bulkDeleteBodies: b,
|
|
993
992
|
bulkUpdateAnnotation: f,
|
|
994
993
|
bulkUpdateBodies: E,
|
|
995
|
-
bulkUpdateTargets: (
|
|
996
|
-
const
|
|
997
|
-
|
|
994
|
+
bulkUpdateTargets: (w, A = B.LOCAL) => {
|
|
995
|
+
const x = w.map((C) => R(C)).filter(Boolean);
|
|
996
|
+
x.length > 0 && s(A, { updated: x });
|
|
998
997
|
},
|
|
999
998
|
clear: g,
|
|
1000
999
|
deleteAnnotation: y,
|
|
@@ -1005,9 +1004,9 @@ const Sn = (t, e) => {
|
|
|
1005
1004
|
unobserve: i,
|
|
1006
1005
|
updateAnnotation: l,
|
|
1007
1006
|
updateBody: O,
|
|
1008
|
-
updateTarget: (
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1007
|
+
updateTarget: (w, A = B.LOCAL) => {
|
|
1008
|
+
const x = R(w);
|
|
1009
|
+
x && s(A, { updated: [x] });
|
|
1011
1010
|
}
|
|
1012
1011
|
};
|
|
1013
1012
|
};
|
|
@@ -1041,7 +1040,7 @@ const Mn = 250, Rn = (t) => {
|
|
|
1041
1040
|
}
|
|
1042
1041
|
i = !1;
|
|
1043
1042
|
};
|
|
1044
|
-
t.observe(a, { origin:
|
|
1043
|
+
t.observe(a, { origin: B.LOCAL });
|
|
1045
1044
|
const r = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p), l = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), f = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ oldValue: v }) => v)), u = (p) => p && p.length > 0 && t.bulkUpdateAnnotation(p.map(({ newValue: v }) => v)), h = (p) => p && p.length > 0 && t.bulkAddAnnotation(p, !1), g = (p) => p && p.length > 0 && t.bulkDeleteAnnotation(p);
|
|
1046
1045
|
return {
|
|
1047
1046
|
canRedo: () => n.length - 1 > o,
|
|
@@ -1064,7 +1063,7 @@ const Mn = 250, Rn = (t) => {
|
|
|
1064
1063
|
}
|
|
1065
1064
|
};
|
|
1066
1065
|
}, Bn = () => {
|
|
1067
|
-
const { subscribe: t, set: e } =
|
|
1066
|
+
const { subscribe: t, set: e } = Yt([]);
|
|
1068
1067
|
return {
|
|
1069
1068
|
subscribe: t,
|
|
1070
1069
|
set: e
|
|
@@ -1084,8 +1083,8 @@ const Mn = 250, Rn = (t) => {
|
|
|
1084
1083
|
l.has(y) && setTimeout(() => {
|
|
1085
1084
|
l.get(y).forEach((c) => {
|
|
1086
1085
|
if (n) {
|
|
1087
|
-
const
|
|
1088
|
-
c(
|
|
1086
|
+
const b = Array.isArray(m) ? m.map((T) => n.serialize(T)) : n.serialize(m), S = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;
|
|
1087
|
+
c(b, S);
|
|
1089
1088
|
} else
|
|
1090
1089
|
c(m, d);
|
|
1091
1090
|
});
|
|
@@ -1098,13 +1097,13 @@ const Mn = 250, Rn = (t) => {
|
|
|
1098
1097
|
else if (f.length > 0 && y.length === 0)
|
|
1099
1098
|
f.forEach((m) => {
|
|
1100
1099
|
const d = a.getAnnotation(m.id);
|
|
1101
|
-
d && !
|
|
1100
|
+
d && !q(d, m) && p("updateAnnotation", d, m);
|
|
1102
1101
|
}), f = [];
|
|
1103
1102
|
else {
|
|
1104
1103
|
const m = new Set(f.map((c) => c.id)), d = new Set(y.map(({ id: c }) => c));
|
|
1105
1104
|
f.filter((c) => !d.has(c.id)).forEach((c) => {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1105
|
+
const b = a.getAnnotation(c.id);
|
|
1106
|
+
b && !q(b, c) && p("updateAnnotation", b, c);
|
|
1108
1107
|
}), f = [
|
|
1109
1108
|
// Remove annotations that were deselected
|
|
1110
1109
|
...f.filter((c) => d.has(c.id)),
|
|
@@ -1122,16 +1121,16 @@ const Mn = 250, Rn = (t) => {
|
|
|
1122
1121
|
...c.bodiesCreated || [],
|
|
1123
1122
|
...c.bodiesDeleted || [],
|
|
1124
1123
|
...c.bodiesUpdated || []
|
|
1125
|
-
].length > 0).forEach(({ oldValue: c, newValue:
|
|
1124
|
+
].length > 0).forEach(({ oldValue: c, newValue: b }) => {
|
|
1126
1125
|
const S = f.find((T) => T.id === c.id) || c;
|
|
1127
|
-
f = f.map((T) => T.id === c.id ?
|
|
1126
|
+
f = f.map((T) => T.id === c.id ? b : T), p("updateAnnotation", b, S);
|
|
1128
1127
|
});
|
|
1129
|
-
}, { origin:
|
|
1128
|
+
}, { origin: B.LOCAL }), a.observe((y) => {
|
|
1130
1129
|
if (f) {
|
|
1131
1130
|
const m = new Set(f.map((c) => c.id)), d = (y.changes.updated || []).filter(({ newValue: c }) => m.has(c.id)).map(({ newValue: c }) => c);
|
|
1132
1131
|
d.length > 0 && (f = f.map((c) => d.find((S) => S.id === c.id) || c));
|
|
1133
1132
|
}
|
|
1134
|
-
}, { origin:
|
|
1133
|
+
}, { origin: B.REMOTE });
|
|
1135
1134
|
const v = (y) => (m) => {
|
|
1136
1135
|
const { updated: d } = m;
|
|
1137
1136
|
y ? (d || []).forEach((c) => p("updateAnnotation", c.oldValue, c.newValue)) : (d || []).forEach((c) => p("updateAnnotation", c.newValue, c.oldValue));
|
|
@@ -1151,18 +1150,18 @@ const Mn = 250, Rn = (t) => {
|
|
|
1151
1150
|
}, { parsed: [], failed: [] }), _n = (t, e, n) => {
|
|
1152
1151
|
const { store: o, selection: i } = t, s = (d) => {
|
|
1153
1152
|
if (n) {
|
|
1154
|
-
const { parsed: c, error:
|
|
1155
|
-
c ? o.addAnnotation(c,
|
|
1153
|
+
const { parsed: c, error: b } = n.parse(d);
|
|
1154
|
+
c ? o.addAnnotation(c, B.REMOTE) : console.error(b);
|
|
1156
1155
|
} else
|
|
1157
|
-
o.addAnnotation(
|
|
1156
|
+
o.addAnnotation(Tt(d), B.REMOTE);
|
|
1158
1157
|
}, a = () => i.clear(), r = () => o.clear(), l = (d) => {
|
|
1159
1158
|
const c = o.getAnnotation(d);
|
|
1160
1159
|
return n && c ? n.serialize(c) : c;
|
|
1161
1160
|
}, f = () => n ? o.all().map(n.serialize) : o.all(), u = () => {
|
|
1162
1161
|
var d;
|
|
1163
|
-
const c = (((d = i.selected) == null ? void 0 : d.map((
|
|
1162
|
+
const c = (((d = i.selected) == null ? void 0 : d.map((b) => b.id)) || []).map((b) => o.getAnnotation(b)).filter(Boolean);
|
|
1164
1163
|
return n ? c.map(n.serialize) : c;
|
|
1165
|
-
}, h = (d, c = !0) => fetch(d).then((
|
|
1164
|
+
}, h = (d, c = !0) => fetch(d).then((b) => b.json()).then((b) => (p(b, c), b)), g = (d) => {
|
|
1166
1165
|
if (typeof d == "string") {
|
|
1167
1166
|
const c = o.getAnnotation(d);
|
|
1168
1167
|
if (o.deleteAnnotation(d), c)
|
|
@@ -1174,21 +1173,21 @@ const Mn = 250, Rn = (t) => {
|
|
|
1174
1173
|
}
|
|
1175
1174
|
}, p = (d, c = !0) => {
|
|
1176
1175
|
if (n) {
|
|
1177
|
-
const
|
|
1178
|
-
T.length > 0 && console.warn(`Discarded ${T.length} invalid annotations`, T), o.bulkAddAnnotation(S, c,
|
|
1176
|
+
const b = n.parseAll || In(n), { parsed: S, failed: T } = b(d);
|
|
1177
|
+
T.length > 0 && console.warn(`Discarded ${T.length} invalid annotations`, T), o.bulkAddAnnotation(S, c, B.REMOTE);
|
|
1179
1178
|
} else
|
|
1180
|
-
o.bulkAddAnnotation(d.map(
|
|
1179
|
+
o.bulkAddAnnotation(d.map(Tt), c, B.REMOTE);
|
|
1181
1180
|
}, v = (d, c) => {
|
|
1182
1181
|
d ? i.setSelected(d, c) : i.clear();
|
|
1183
1182
|
}, y = (d) => {
|
|
1184
1183
|
i.clear(), i.setUserSelectAction(d);
|
|
1185
1184
|
}, m = (d) => {
|
|
1186
1185
|
if (n) {
|
|
1187
|
-
const c = n.parse(d).parsed,
|
|
1188
|
-
return o.updateAnnotation(c),
|
|
1186
|
+
const c = n.parse(d).parsed, b = n.serialize(o.getAnnotation(c.id));
|
|
1187
|
+
return o.updateAnnotation(c), b;
|
|
1189
1188
|
} else {
|
|
1190
1189
|
const c = o.getAnnotation(d.id);
|
|
1191
|
-
return o.updateAnnotation(
|
|
1190
|
+
return o.updateAnnotation(Tt(d)), c;
|
|
1192
1191
|
}
|
|
1193
1192
|
};
|
|
1194
1193
|
return {
|
|
@@ -1234,7 +1233,7 @@ const Dn = () => ({ isGuest: !0, id: Kn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1234
1233
|
n = (n << 5) - n + s, n |= 0;
|
|
1235
1234
|
}
|
|
1236
1235
|
return `${n}`;
|
|
1237
|
-
},
|
|
1236
|
+
}, pe = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, Pn = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1238
1237
|
const { id: o, type: i, purpose: s, value: a, created: r, modified: l, creator: f, ...u } = n;
|
|
1239
1238
|
return {
|
|
1240
1239
|
id: o || `temp-${Xn(n)}`,
|
|
@@ -1242,7 +1241,7 @@ const Dn = () => ({ isGuest: !0, id: Kn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1242
1241
|
type: i,
|
|
1243
1242
|
purpose: s,
|
|
1244
1243
|
value: a,
|
|
1245
|
-
creator:
|
|
1244
|
+
creator: pe(f),
|
|
1246
1245
|
created: r ? new Date(r) : void 0,
|
|
1247
1246
|
updated: l ? new Date(l) : void 0,
|
|
1248
1247
|
...u
|
|
@@ -1257,7 +1256,7 @@ const Dn = () => ({ isGuest: !0, id: Kn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1257
1256
|
return (n = r.id) != null && n.startsWith("temp-") && delete r.id, r;
|
|
1258
1257
|
});
|
|
1259
1258
|
Yn();
|
|
1260
|
-
const
|
|
1259
|
+
const Ao = (t, e) => ({
|
|
1261
1260
|
parse: (n) => zn(n),
|
|
1262
1261
|
serialize: (n) => Fn(n, t, e)
|
|
1263
1262
|
}), Hn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, jn = (t) => {
|
|
@@ -1268,7 +1267,7 @@ const xo = (t, e) => ({
|
|
|
1268
1267
|
modified: i,
|
|
1269
1268
|
target: s
|
|
1270
1269
|
} = t, a = Array.isArray(s) ? s : [s], r = {
|
|
1271
|
-
creator:
|
|
1270
|
+
creator: pe(n),
|
|
1272
1271
|
created: o ? new Date(o) : void 0,
|
|
1273
1272
|
updated: i ? new Date(i) : void 0,
|
|
1274
1273
|
annotation: e,
|
|
@@ -1298,7 +1297,7 @@ const xo = (t, e) => ({
|
|
|
1298
1297
|
}
|
|
1299
1298
|
return { parsed: r };
|
|
1300
1299
|
}, zn = (t) => {
|
|
1301
|
-
const e = t.id ||
|
|
1300
|
+
const e = t.id || ue(), {
|
|
1302
1301
|
creator: n,
|
|
1303
1302
|
created: o,
|
|
1304
1303
|
modified: i,
|
|
@@ -1321,7 +1320,7 @@ const xo = (t, e) => ({
|
|
|
1321
1320
|
updated: f,
|
|
1322
1321
|
...u
|
|
1323
1322
|
} = i, h = a.map((g) => {
|
|
1324
|
-
const { quote: p, start: v, end: y, range: m } = g, { prefix: d, suffix: c } = ke(m, n),
|
|
1323
|
+
const { quote: p, start: v, end: y, range: m } = g, { prefix: d, suffix: c } = ke(m, n), b = [{
|
|
1325
1324
|
type: "TextQuoteSelector",
|
|
1326
1325
|
exact: p,
|
|
1327
1326
|
prefix: d,
|
|
@@ -1335,7 +1334,7 @@ const xo = (t, e) => ({
|
|
|
1335
1334
|
...u,
|
|
1336
1335
|
id: g.id,
|
|
1337
1336
|
source: e,
|
|
1338
|
-
selector:
|
|
1337
|
+
selector: b
|
|
1339
1338
|
};
|
|
1340
1339
|
});
|
|
1341
1340
|
return {
|
|
@@ -1350,22 +1349,22 @@ const xo = (t, e) => ({
|
|
|
1350
1349
|
target: h
|
|
1351
1350
|
};
|
|
1352
1351
|
};
|
|
1353
|
-
function
|
|
1352
|
+
function ge(t, e, n = 0, o = t.length - 1, i = Wn) {
|
|
1354
1353
|
for (; o > n; ) {
|
|
1355
1354
|
if (o - n > 600) {
|
|
1356
1355
|
const l = o - n + 1, f = e - n + 1, u = Math.log(l), h = 0.5 * Math.exp(2 * u / 3), g = 0.5 * Math.sqrt(u * h * (l - h) / l) * (f - l / 2 < 0 ? -1 : 1), p = Math.max(n, Math.floor(e - f * h / l + g)), v = Math.min(o, Math.floor(e + (l - f) * h / l + g));
|
|
1357
|
-
|
|
1356
|
+
ge(t, e, p, v, i);
|
|
1358
1357
|
}
|
|
1359
1358
|
const s = t[e];
|
|
1360
1359
|
let a = n, r = o;
|
|
1361
|
-
for (
|
|
1362
|
-
for (
|
|
1360
|
+
for (tt(t, n, e), i(t[o], s) > 0 && tt(t, n, o); a < r; ) {
|
|
1361
|
+
for (tt(t, a, r), a++, r--; i(t[a], s) < 0; ) a++;
|
|
1363
1362
|
for (; i(t[r], s) > 0; ) r--;
|
|
1364
1363
|
}
|
|
1365
|
-
i(t[n], s) === 0 ?
|
|
1364
|
+
i(t[n], s) === 0 ? tt(t, n, r) : (r++, tt(t, r, o)), r <= e && (n = r + 1), e <= r && (o = r - 1);
|
|
1366
1365
|
}
|
|
1367
1366
|
}
|
|
1368
|
-
function
|
|
1367
|
+
function tt(t, e, n) {
|
|
1369
1368
|
const o = t[e];
|
|
1370
1369
|
t[e] = t[n], t[n] = o;
|
|
1371
1370
|
}
|
|
@@ -1382,12 +1381,12 @@ class qn {
|
|
|
1382
1381
|
search(e) {
|
|
1383
1382
|
let n = this.data;
|
|
1384
1383
|
const o = [];
|
|
1385
|
-
if (!
|
|
1384
|
+
if (!gt(e, n)) return o;
|
|
1386
1385
|
const i = this.toBBox, s = [];
|
|
1387
1386
|
for (; n; ) {
|
|
1388
1387
|
for (let a = 0; a < n.children.length; a++) {
|
|
1389
1388
|
const r = n.children[a], l = n.leaf ? i(r) : r;
|
|
1390
|
-
|
|
1389
|
+
gt(e, l) && (n.leaf ? o.push(r) : Rt(e, l) ? this._all(r, o) : s.push(r));
|
|
1391
1390
|
}
|
|
1392
1391
|
n = s.pop();
|
|
1393
1392
|
}
|
|
@@ -1395,13 +1394,13 @@ class qn {
|
|
|
1395
1394
|
}
|
|
1396
1395
|
collides(e) {
|
|
1397
1396
|
let n = this.data;
|
|
1398
|
-
if (!
|
|
1397
|
+
if (!gt(e, n)) return !1;
|
|
1399
1398
|
const o = [];
|
|
1400
1399
|
for (; n; ) {
|
|
1401
1400
|
for (let i = 0; i < n.children.length; i++) {
|
|
1402
1401
|
const s = n.children[i], a = n.leaf ? this.toBBox(s) : s;
|
|
1403
|
-
if (
|
|
1404
|
-
if (n.leaf ||
|
|
1402
|
+
if (gt(e, a)) {
|
|
1403
|
+
if (n.leaf || Rt(e, a)) return !0;
|
|
1405
1404
|
o.push(s);
|
|
1406
1405
|
}
|
|
1407
1406
|
}
|
|
@@ -1434,7 +1433,7 @@ class qn {
|
|
|
1434
1433
|
return e && this._insert(e, this.data.height - 1), this;
|
|
1435
1434
|
}
|
|
1436
1435
|
clear() {
|
|
1437
|
-
return this.data =
|
|
1436
|
+
return this.data = J([]), this;
|
|
1438
1437
|
}
|
|
1439
1438
|
remove(e, n) {
|
|
1440
1439
|
if (!e) return this;
|
|
@@ -1447,7 +1446,7 @@ class qn {
|
|
|
1447
1446
|
if (u !== -1)
|
|
1448
1447
|
return o.children.splice(u, 1), s.push(o), this._condense(s), this;
|
|
1449
1448
|
}
|
|
1450
|
-
!f && !o.leaf &&
|
|
1449
|
+
!f && !o.leaf && Rt(o, i) ? (s.push(o), a.push(r), r = 0, l = o, o = o.children[0]) : l ? (r++, o = l.children[r], f = !1) : o = null;
|
|
1451
1450
|
}
|
|
1452
1451
|
return this;
|
|
1453
1452
|
}
|
|
@@ -1476,25 +1475,25 @@ class qn {
|
|
|
1476
1475
|
const s = o - n + 1;
|
|
1477
1476
|
let a = this._maxEntries, r;
|
|
1478
1477
|
if (s <= a)
|
|
1479
|
-
return r =
|
|
1480
|
-
i || (i = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, i - 1))), r =
|
|
1478
|
+
return r = J(e.slice(n, o + 1)), Q(r, this.toBBox), r;
|
|
1479
|
+
i || (i = Math.ceil(Math.log(s) / Math.log(a)), a = Math.ceil(s / Math.pow(a, i - 1))), r = J([]), r.leaf = !1, r.height = i;
|
|
1481
1480
|
const l = Math.ceil(s / a), f = l * Math.ceil(Math.sqrt(a));
|
|
1482
|
-
|
|
1481
|
+
te(e, n, o, f, this.compareMinX);
|
|
1483
1482
|
for (let u = n; u <= o; u += f) {
|
|
1484
1483
|
const h = Math.min(u + f - 1, o);
|
|
1485
|
-
|
|
1484
|
+
te(e, u, h, l, this.compareMinY);
|
|
1486
1485
|
for (let g = u; g <= h; g += l) {
|
|
1487
1486
|
const p = Math.min(g + l - 1, h);
|
|
1488
1487
|
r.children.push(this._build(e, g, p, i - 1));
|
|
1489
1488
|
}
|
|
1490
1489
|
}
|
|
1491
|
-
return
|
|
1490
|
+
return Q(r, this.toBBox), r;
|
|
1492
1491
|
}
|
|
1493
1492
|
_chooseSubtree(e, n, o, i) {
|
|
1494
1493
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1495
1494
|
let s = 1 / 0, a = 1 / 0, r;
|
|
1496
1495
|
for (let l = 0; l < n.children.length; l++) {
|
|
1497
|
-
const f = n.children[l], u =
|
|
1496
|
+
const f = n.children[l], u = Mt(f), h = Zn(e, f) - u;
|
|
1498
1497
|
h < a ? (a = h, s = u < s ? u : s, r = f) : h === a && u < s && (s = u, r = f);
|
|
1499
1498
|
}
|
|
1500
1499
|
n = r || n.children[0];
|
|
@@ -1511,16 +1510,16 @@ class qn {
|
|
|
1511
1510
|
_split(e, n) {
|
|
1512
1511
|
const o = e[n], i = o.children.length, s = this._minEntries;
|
|
1513
1512
|
this._chooseSplitAxis(o, s, i);
|
|
1514
|
-
const a = this._chooseSplitIndex(o, s, i), r =
|
|
1515
|
-
r.height = o.height, r.leaf = o.leaf,
|
|
1513
|
+
const a = this._chooseSplitIndex(o, s, i), r = J(o.children.splice(a, o.children.length - a));
|
|
1514
|
+
r.height = o.height, r.leaf = o.leaf, Q(o, this.toBBox), Q(r, this.toBBox), n ? e[n - 1].children.push(r) : this._splitRoot(o, r);
|
|
1516
1515
|
}
|
|
1517
1516
|
_splitRoot(e, n) {
|
|
1518
|
-
this.data =
|
|
1517
|
+
this.data = J([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, Q(this.data, this.toBBox);
|
|
1519
1518
|
}
|
|
1520
1519
|
_chooseSplitIndex(e, n, o) {
|
|
1521
1520
|
let i, s = 1 / 0, a = 1 / 0;
|
|
1522
1521
|
for (let r = n; r <= o - n; r++) {
|
|
1523
|
-
const l = ot(e, 0, r, this.toBBox), f = ot(e, r, o, this.toBBox), u = to(l, f), h =
|
|
1522
|
+
const l = ot(e, 0, r, this.toBBox), f = ot(e, r, o, this.toBBox), u = to(l, f), h = Mt(l) + Mt(f);
|
|
1524
1523
|
u < s ? (s = u, i = r, a = h < a ? h : a) : u === s && h < a && (a = h, i = r);
|
|
1525
1524
|
}
|
|
1526
1525
|
return i || o - n;
|
|
@@ -1534,14 +1533,14 @@ class qn {
|
|
|
1534
1533
|
_allDistMargin(e, n, o, i) {
|
|
1535
1534
|
e.children.sort(i);
|
|
1536
1535
|
const s = this.toBBox, a = ot(e, 0, n, s), r = ot(e, o - n, o, s);
|
|
1537
|
-
let l =
|
|
1536
|
+
let l = pt(a) + pt(r);
|
|
1538
1537
|
for (let f = n; f < o - n; f++) {
|
|
1539
1538
|
const u = e.children[f];
|
|
1540
|
-
it(a, e.leaf ? s(u) : u), l +=
|
|
1539
|
+
it(a, e.leaf ? s(u) : u), l += pt(a);
|
|
1541
1540
|
}
|
|
1542
1541
|
for (let f = o - n - 1; f >= n; f--) {
|
|
1543
1542
|
const u = e.children[f];
|
|
1544
|
-
it(r, e.leaf ? s(u) : u), l +=
|
|
1543
|
+
it(r, e.leaf ? s(u) : u), l += pt(r);
|
|
1545
1544
|
}
|
|
1546
1545
|
return l;
|
|
1547
1546
|
}
|
|
@@ -1551,7 +1550,7 @@ class qn {
|
|
|
1551
1550
|
}
|
|
1552
1551
|
_condense(e) {
|
|
1553
1552
|
for (let n = e.length - 1, o; n >= 0; n--)
|
|
1554
|
-
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() :
|
|
1553
|
+
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : Q(e[n], this.toBBox);
|
|
1555
1554
|
}
|
|
1556
1555
|
}
|
|
1557
1556
|
function Gn(t, e, n) {
|
|
@@ -1560,11 +1559,11 @@ function Gn(t, e, n) {
|
|
|
1560
1559
|
if (n(t, e[o])) return o;
|
|
1561
1560
|
return -1;
|
|
1562
1561
|
}
|
|
1563
|
-
function
|
|
1562
|
+
function Q(t, e) {
|
|
1564
1563
|
ot(t, 0, t.children.length, e, t);
|
|
1565
1564
|
}
|
|
1566
1565
|
function ot(t, e, n, o, i) {
|
|
1567
|
-
i || (i =
|
|
1566
|
+
i || (i = J(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
1568
1567
|
for (let s = e; s < n; s++) {
|
|
1569
1568
|
const a = t.children[s];
|
|
1570
1569
|
it(i, t.leaf ? o(a) : a);
|
|
@@ -1580,10 +1579,10 @@ function Qn(t, e) {
|
|
|
1580
1579
|
function Jn(t, e) {
|
|
1581
1580
|
return t.minY - e.minY;
|
|
1582
1581
|
}
|
|
1583
|
-
function
|
|
1582
|
+
function Mt(t) {
|
|
1584
1583
|
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
1585
1584
|
}
|
|
1586
|
-
function
|
|
1585
|
+
function pt(t) {
|
|
1587
1586
|
return t.maxX - t.minX + (t.maxY - t.minY);
|
|
1588
1587
|
}
|
|
1589
1588
|
function Zn(t, e) {
|
|
@@ -1593,13 +1592,13 @@ function to(t, e) {
|
|
|
1593
1592
|
const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), s = Math.min(t.maxY, e.maxY);
|
|
1594
1593
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
1595
1594
|
}
|
|
1596
|
-
function
|
|
1595
|
+
function Rt(t, e) {
|
|
1597
1596
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1598
1597
|
}
|
|
1599
|
-
function
|
|
1598
|
+
function gt(t, e) {
|
|
1600
1599
|
return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
|
|
1601
1600
|
}
|
|
1602
|
-
function
|
|
1601
|
+
function J(t) {
|
|
1603
1602
|
return {
|
|
1604
1603
|
children: t,
|
|
1605
1604
|
height: 1,
|
|
@@ -1610,20 +1609,20 @@ function Z(t) {
|
|
|
1610
1609
|
maxY: -1 / 0
|
|
1611
1610
|
};
|
|
1612
1611
|
}
|
|
1613
|
-
function
|
|
1612
|
+
function te(t, e, n, o, i) {
|
|
1614
1613
|
const s = [e, n];
|
|
1615
1614
|
for (; s.length; ) {
|
|
1616
1615
|
if (n = s.pop(), e = s.pop(), n - e <= o) continue;
|
|
1617
1616
|
const a = e + Math.ceil((n - e) / o / 2) * o;
|
|
1618
|
-
|
|
1617
|
+
ge(t, a, e, n, i), s.push(e, a, a, n);
|
|
1619
1618
|
}
|
|
1620
1619
|
}
|
|
1621
1620
|
const eo = (t, e) => {
|
|
1622
1621
|
const n = new qn(), o = /* @__PURE__ */ new Map(), i = (d, c) => {
|
|
1623
|
-
const
|
|
1624
|
-
const L =
|
|
1622
|
+
const b = d.selector.flatMap((T) => {
|
|
1623
|
+
const L = F([T]) ? T.range : re(T, e).range;
|
|
1625
1624
|
return Array.from(L.getClientRects());
|
|
1626
|
-
}), S = Ve(
|
|
1625
|
+
}), S = Ve(b).map(({ left: T, top: L, right: O, bottom: E }) => new DOMRect(T - c.left, L - c.top, O - T, E - L));
|
|
1627
1626
|
return S.map((T) => {
|
|
1628
1627
|
const { x: L, y: O, width: E, height: R } = T;
|
|
1629
1628
|
return {
|
|
@@ -1641,36 +1640,36 @@ const eo = (t, e) => {
|
|
|
1641
1640
|
n.clear(), o.clear();
|
|
1642
1641
|
}, r = (d) => {
|
|
1643
1642
|
const c = i(d, e.getBoundingClientRect());
|
|
1644
|
-
c.forEach((
|
|
1643
|
+
c.forEach((b) => n.insert(b)), o.set(d.annotation, c);
|
|
1645
1644
|
}, l = (d) => {
|
|
1646
1645
|
const c = o.get(d.annotation);
|
|
1647
|
-
c && (c.forEach((
|
|
1646
|
+
c && (c.forEach((b) => n.remove(b)), o.delete(d.annotation));
|
|
1648
1647
|
}, f = (d) => {
|
|
1649
1648
|
l(d), r(d);
|
|
1650
1649
|
}, u = (d, c = !0) => {
|
|
1651
1650
|
c && a();
|
|
1652
|
-
const
|
|
1651
|
+
const b = e.getBoundingClientRect(), S = d.map((L) => ({ target: L, rects: i(L, b) }));
|
|
1653
1652
|
S.forEach(({ target: L, rects: O }) => o.set(L.annotation, O));
|
|
1654
1653
|
const T = S.flatMap(({ rects: L }) => L);
|
|
1655
1654
|
n.load(T);
|
|
1656
|
-
}, h = (d, c,
|
|
1655
|
+
}, h = (d, c, b = !1) => {
|
|
1657
1656
|
const S = n.search({
|
|
1658
1657
|
minX: d,
|
|
1659
1658
|
minY: c,
|
|
1660
1659
|
maxX: d,
|
|
1661
1660
|
maxY: c
|
|
1662
1661
|
}), T = (L) => L.annotation.rects.reduce((O, E) => O + E.width * E.height, 0);
|
|
1663
|
-
return S.length > 0 ? (S.sort((L, O) => T(L) - T(O)),
|
|
1662
|
+
return S.length > 0 ? (S.sort((L, O) => T(L) - T(O)), b ? S.map((L) => L.annotation.id) : [S[0].annotation.id]) : [];
|
|
1664
1663
|
}, g = (d) => {
|
|
1665
1664
|
const c = p(d);
|
|
1666
1665
|
if (c.length === 0)
|
|
1667
1666
|
return;
|
|
1668
|
-
let
|
|
1667
|
+
let b = c[0].left, S = c[0].top, T = c[0].right, L = c[0].bottom;
|
|
1669
1668
|
for (let O = 1; O < c.length; O++) {
|
|
1670
1669
|
const E = c[O];
|
|
1671
|
-
|
|
1670
|
+
b = Math.min(b, E.left), S = Math.min(S, E.top), T = Math.max(T, E.right), L = Math.max(L, E.bottom);
|
|
1672
1671
|
}
|
|
1673
|
-
return new DOMRect(
|
|
1672
|
+
return new DOMRect(b, S, T - b, L - S);
|
|
1674
1673
|
}, p = (d) => {
|
|
1675
1674
|
const c = o.get(d);
|
|
1676
1675
|
return c ? c[0].annotation.rects : [];
|
|
@@ -1681,8 +1680,8 @@ const eo = (t, e) => {
|
|
|
1681
1680
|
getAt: h,
|
|
1682
1681
|
getAnnotationBounds: g,
|
|
1683
1682
|
getAnnotationRects: p,
|
|
1684
|
-
getIntersecting: (d, c,
|
|
1685
|
-
const T = n.search({ minX: d, minY: c, maxX:
|
|
1683
|
+
getIntersecting: (d, c, b, S) => {
|
|
1684
|
+
const T = n.search({ minX: d, minY: c, maxX: b, maxY: S }), L = new Set(T.map((O) => O.annotation.id));
|
|
1686
1685
|
return Array.from(L).map((O) => ({
|
|
1687
1686
|
annotation: t.getAnnotation(O),
|
|
1688
1687
|
rects: p(O)
|
|
@@ -1698,39 +1697,39 @@ const eo = (t, e) => {
|
|
|
1698
1697
|
}, no = (t, e) => {
|
|
1699
1698
|
const n = Tn(), o = eo(n, t), i = gn(n);
|
|
1700
1699
|
i.setUserSelectAction(e);
|
|
1701
|
-
const s = hn(n), a = Bn(), r = (m, d =
|
|
1702
|
-
const c =
|
|
1703
|
-
return
|
|
1704
|
-
}, l = (m, d = !0, c =
|
|
1705
|
-
const
|
|
1706
|
-
return S.length > 0 ? (console.warn("Could not revive all targets for these annotations:", S), n.bulkAddAnnotation(
|
|
1707
|
-
}, f = (m, d =
|
|
1708
|
-
const c = m.map((S) =>
|
|
1709
|
-
return
|
|
1700
|
+
const s = hn(n), a = Bn(), r = (m, d = B.LOCAL) => {
|
|
1701
|
+
const c = vt(m, t), b = F(c.target.selector);
|
|
1702
|
+
return b && n.addAnnotation(c, d), b;
|
|
1703
|
+
}, l = (m, d = !0, c = B.LOCAL) => {
|
|
1704
|
+
const b = m.map((T) => vt(T, t)), S = b.filter((T) => !F(T.target.selector));
|
|
1705
|
+
return S.length > 0 ? (console.warn("Could not revive all targets for these annotations:", S), n.bulkAddAnnotation(b, d, c), S) : (n.bulkAddAnnotation(b, d, c), []);
|
|
1706
|
+
}, f = (m, d = B.LOCAL) => {
|
|
1707
|
+
const c = m.map((S) => vt(S, t)), b = c.filter((S) => !F(S.target.selector));
|
|
1708
|
+
return b.length > 0 && console.warn("Could not revive all targets for these annotations:", b), c.forEach((S) => {
|
|
1710
1709
|
n.getAnnotation(S.id) ? n.updateAnnotation(S, d) : n.addAnnotation(S, d);
|
|
1711
|
-
}),
|
|
1712
|
-
}, u = (m, d =
|
|
1713
|
-
const c =
|
|
1710
|
+
}), b;
|
|
1711
|
+
}, u = (m, d = B.LOCAL) => {
|
|
1712
|
+
const c = yt(m, t);
|
|
1714
1713
|
n.updateTarget(c, d);
|
|
1715
|
-
}, h = (m, d =
|
|
1716
|
-
const c = m.map((
|
|
1714
|
+
}, h = (m, d = B.LOCAL) => {
|
|
1715
|
+
const c = m.map((b) => yt(b, t));
|
|
1717
1716
|
n.bulkUpdateTargets(c, d);
|
|
1718
1717
|
}, g = (m, d, c) => {
|
|
1719
|
-
const
|
|
1718
|
+
const b = o.getAt(m, d, !!c).map((T) => n.getAnnotation(T)), S = c ? b.filter(c) : b;
|
|
1720
1719
|
return S.length > 0 ? S[0] : void 0;
|
|
1721
|
-
}, p = (m, d, c,
|
|
1720
|
+
}, p = (m, d, c, b = 5) => {
|
|
1722
1721
|
const S = o.getAnnotationRects(m);
|
|
1723
1722
|
if (S.length !== 0) {
|
|
1724
1723
|
if (d && c) {
|
|
1725
|
-
const T = S.find(({ top: L, right: O, bottom: E, left: R }) => d >= R -
|
|
1724
|
+
const T = S.find(({ top: L, right: O, bottom: E, left: R }) => d >= R - b && d <= O + b && c >= L - b && c <= E + b);
|
|
1726
1725
|
if (T) return T;
|
|
1727
1726
|
}
|
|
1728
1727
|
return o.getAnnotationBounds(m);
|
|
1729
1728
|
}
|
|
1730
1729
|
}, v = (m) => o.getAnnotationRects(m), y = () => o.recalculate();
|
|
1731
1730
|
return n.observe(({ changes: m }) => {
|
|
1732
|
-
const d = (m.deleted || []).filter((S) =>
|
|
1733
|
-
(d == null ? void 0 : d.length) > 0 && d.forEach((S) => o.remove(S.target)), c.length > 0 && o.set(c.map((S) => S.target), !1), (
|
|
1731
|
+
const d = (m.deleted || []).filter((S) => F(S.target.selector)), c = (m.created || []).filter((S) => F(S.target.selector)), b = (m.updated || []).filter((S) => F(S.newValue.target.selector));
|
|
1732
|
+
(d == null ? void 0 : d.length) > 0 && d.forEach((S) => o.remove(S.target)), c.length > 0 && o.set(c.map((S) => S.target), !1), (b == null ? void 0 : b.length) > 0 && b.forEach(({ newValue: S }) => o.update(S.target));
|
|
1734
1733
|
}), {
|
|
1735
1734
|
store: {
|
|
1736
1735
|
...n,
|
|
@@ -1774,8 +1773,8 @@ const eo = (t, e) => {
|
|
|
1774
1773
|
if (p) {
|
|
1775
1774
|
const { height: v } = u.rects[0], y = u.rects[0].x + h.left, m = u.rects[0].y + h.top;
|
|
1776
1775
|
o.fillStyle = p.appearance.color, o.fillRect(y - 2, m - 2.5, 2, v + 5);
|
|
1777
|
-
const d = o.measureText(p.appearance.label), c = d.width + 6,
|
|
1778
|
-
return o.fillRect(y - 2, m - 2.5 -
|
|
1776
|
+
const d = o.measureText(p.appearance.label), c = d.width + 6, b = d.actualBoundingBoxAscent + d.actualBoundingBoxDescent + 8, S = d.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1777
|
+
return o.fillRect(y - 2, m - 2.5 - b, c, b), o.fillStyle = "#fff", o.fillText(p.appearance.label, y + 1, m - S), {
|
|
1779
1778
|
fill: p.appearance.color,
|
|
1780
1779
|
fillOpacity: g ? 0.45 : 0.18
|
|
1781
1780
|
};
|
|
@@ -1787,19 +1786,19 @@ const eo = (t, e) => {
|
|
|
1787
1786
|
u.scale(2, 2), u.translate(0.5, 0.5);
|
|
1788
1787
|
}
|
|
1789
1788
|
};
|
|
1790
|
-
},
|
|
1791
|
-
function
|
|
1789
|
+
}, Bt = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1;
|
|
1790
|
+
function kt(t, e, n, o) {
|
|
1792
1791
|
t.addEventListener ? t.addEventListener(e, n, o) : t.attachEvent && t.attachEvent("on".concat(e), n);
|
|
1793
1792
|
}
|
|
1794
|
-
function
|
|
1793
|
+
function et(t, e, n, o) {
|
|
1795
1794
|
t.removeEventListener ? t.removeEventListener(e, n, o) : t.detachEvent && t.detachEvent("on".concat(e), n);
|
|
1796
1795
|
}
|
|
1797
|
-
function
|
|
1796
|
+
function me(t, e) {
|
|
1798
1797
|
const n = e.slice(0, e.length - 1);
|
|
1799
1798
|
for (let o = 0; o < n.length; o++) n[o] = t[n[o].toLowerCase()];
|
|
1800
1799
|
return n;
|
|
1801
1800
|
}
|
|
1802
|
-
function
|
|
1801
|
+
function ye(t) {
|
|
1803
1802
|
typeof t != "string" && (t = ""), t = t.replace(/\s/g, "");
|
|
1804
1803
|
const e = t.split(",");
|
|
1805
1804
|
let n = e.lastIndexOf("");
|
|
@@ -1859,14 +1858,14 @@ const at = {
|
|
|
1859
1858
|
".": 190,
|
|
1860
1859
|
"/": 191,
|
|
1861
1860
|
"`": 192,
|
|
1862
|
-
"-":
|
|
1863
|
-
"=":
|
|
1864
|
-
";":
|
|
1861
|
+
"-": Bt ? 173 : 189,
|
|
1862
|
+
"=": Bt ? 61 : 187,
|
|
1863
|
+
";": Bt ? 59 : 186,
|
|
1865
1864
|
"'": 222,
|
|
1866
1865
|
"[": 219,
|
|
1867
1866
|
"]": 221,
|
|
1868
1867
|
"\\": 220
|
|
1869
|
-
},
|
|
1868
|
+
}, H = {
|
|
1870
1869
|
// shiftKey
|
|
1871
1870
|
"⇧": 16,
|
|
1872
1871
|
shift: 16,
|
|
@@ -1882,7 +1881,7 @@ const at = {
|
|
|
1882
1881
|
"⌘": 91,
|
|
1883
1882
|
cmd: 91,
|
|
1884
1883
|
command: 91
|
|
1885
|
-
},
|
|
1884
|
+
}, Ut = {
|
|
1886
1885
|
16: "shiftKey",
|
|
1887
1886
|
18: "altKey",
|
|
1888
1887
|
17: "ctrlKey",
|
|
@@ -1891,7 +1890,7 @@ const at = {
|
|
|
1891
1890
|
ctrlKey: 17,
|
|
1892
1891
|
altKey: 18,
|
|
1893
1892
|
metaKey: 91
|
|
1894
|
-
},
|
|
1893
|
+
}, K = {
|
|
1895
1894
|
16: !1,
|
|
1896
1895
|
18: !1,
|
|
1897
1896
|
17: !1,
|
|
@@ -1899,13 +1898,13 @@ const at = {
|
|
|
1899
1898
|
}, _ = {};
|
|
1900
1899
|
for (let t = 1; t < 20; t++)
|
|
1901
1900
|
at["f".concat(t)] = 111 + t;
|
|
1902
|
-
let I = [], rt = null,
|
|
1903
|
-
const
|
|
1904
|
-
function
|
|
1905
|
-
|
|
1901
|
+
let I = [], rt = null, be = "all";
|
|
1902
|
+
const z = /* @__PURE__ */ new Map(), lt = (t) => at[t.toLowerCase()] || H[t.toLowerCase()] || t.toUpperCase().charCodeAt(0), ro = (t) => Object.keys(at).find((e) => at[e] === t), ao = (t) => Object.keys(H).find((e) => H[e] === t);
|
|
1903
|
+
function we(t) {
|
|
1904
|
+
be = t || "all";
|
|
1906
1905
|
}
|
|
1907
1906
|
function ct() {
|
|
1908
|
-
return
|
|
1907
|
+
return be || "all";
|
|
1909
1908
|
}
|
|
1910
1909
|
function co() {
|
|
1911
1910
|
return I.slice(0);
|
|
@@ -1953,34 +1952,34 @@ function po(t, e) {
|
|
|
1953
1952
|
let {
|
|
1954
1953
|
element: r
|
|
1955
1954
|
} = a;
|
|
1956
|
-
return
|
|
1955
|
+
return Dt(r);
|
|
1957
1956
|
}) : o++;
|
|
1958
|
-
ct() === t &&
|
|
1957
|
+
ct() === t && we(e || "all");
|
|
1959
1958
|
}
|
|
1960
1959
|
function go(t) {
|
|
1961
1960
|
let e = t.keyCode || t.which || t.charCode;
|
|
1962
1961
|
const n = I.indexOf(e);
|
|
1963
|
-
if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in
|
|
1964
|
-
|
|
1965
|
-
for (const o in
|
|
1962
|
+
if (n >= 0 && I.splice(n, 1), t.key && t.key.toLowerCase() === "meta" && I.splice(0, I.length), (e === 93 || e === 224) && (e = 91), e in K) {
|
|
1963
|
+
K[e] = !1;
|
|
1964
|
+
for (const o in H) H[o] === e && (P[o] = !1);
|
|
1966
1965
|
}
|
|
1967
1966
|
}
|
|
1968
|
-
function
|
|
1967
|
+
function ve(t) {
|
|
1969
1968
|
if (typeof t > "u")
|
|
1970
1969
|
Object.keys(_).forEach((i) => {
|
|
1971
|
-
Array.isArray(_[i]) && _[i].forEach((s) =>
|
|
1972
|
-
}),
|
|
1970
|
+
Array.isArray(_[i]) && _[i].forEach((s) => mt(s)), delete _[i];
|
|
1971
|
+
}), Dt(null);
|
|
1973
1972
|
else if (Array.isArray(t))
|
|
1974
1973
|
t.forEach((i) => {
|
|
1975
|
-
i.key &&
|
|
1974
|
+
i.key && mt(i);
|
|
1976
1975
|
});
|
|
1977
1976
|
else if (typeof t == "object")
|
|
1978
|
-
t.key &&
|
|
1977
|
+
t.key && mt(t);
|
|
1979
1978
|
else if (typeof t == "string") {
|
|
1980
1979
|
for (var e = arguments.length, n = new Array(e > 1 ? e - 1 : 0), o = 1; o < e; o++)
|
|
1981
1980
|
n[o - 1] = arguments[o];
|
|
1982
1981
|
let [i, s] = n;
|
|
1983
|
-
typeof i == "function" && (s = i, i = ""),
|
|
1982
|
+
typeof i == "function" && (s = i, i = ""), mt({
|
|
1984
1983
|
key: t,
|
|
1985
1984
|
scope: i,
|
|
1986
1985
|
method: s,
|
|
@@ -1988,55 +1987,55 @@ function Ee(t) {
|
|
|
1988
1987
|
});
|
|
1989
1988
|
}
|
|
1990
1989
|
}
|
|
1991
|
-
const
|
|
1990
|
+
const mt = (t) => {
|
|
1992
1991
|
let {
|
|
1993
1992
|
key: e,
|
|
1994
1993
|
scope: n,
|
|
1995
1994
|
method: o,
|
|
1996
1995
|
splitKey: i = "+"
|
|
1997
1996
|
} = t;
|
|
1998
|
-
|
|
1997
|
+
ye(e).forEach((a) => {
|
|
1999
1998
|
const r = a.split(i), l = r.length, f = r[l - 1], u = f === "*" ? "*" : lt(f);
|
|
2000
1999
|
if (!_[u]) return;
|
|
2001
2000
|
n || (n = ct());
|
|
2002
|
-
const h = l > 1 ?
|
|
2001
|
+
const h = l > 1 ? me(H, r) : [], g = [];
|
|
2003
2002
|
_[u] = _[u].filter((p) => {
|
|
2004
2003
|
const y = (o ? p.method === o : !0) && p.scope === n && so(p.mods, h);
|
|
2005
2004
|
return y && g.push(p.element), !y;
|
|
2006
|
-
}), g.forEach((p) =>
|
|
2005
|
+
}), g.forEach((p) => Dt(p));
|
|
2007
2006
|
});
|
|
2008
2007
|
};
|
|
2009
|
-
function
|
|
2008
|
+
function ee(t, e, n, o) {
|
|
2010
2009
|
if (e.element !== o)
|
|
2011
2010
|
return;
|
|
2012
2011
|
let i;
|
|
2013
2012
|
if (e.scope === n || e.scope === "all") {
|
|
2014
2013
|
i = e.mods.length > 0;
|
|
2015
|
-
for (const s in
|
|
2016
|
-
Object.prototype.hasOwnProperty.call(
|
|
2017
|
-
(e.mods.length === 0 && !
|
|
2014
|
+
for (const s in K)
|
|
2015
|
+
Object.prototype.hasOwnProperty.call(K, s) && (!K[s] && e.mods.indexOf(+s) > -1 || K[s] && e.mods.indexOf(+s) === -1) && (i = !1);
|
|
2016
|
+
(e.mods.length === 0 && !K[16] && !K[18] && !K[17] && !K[91] || i || e.shortcut === "*") && (e.keys = [], e.keys = e.keys.concat(I), e.method(t, e) === !1 && (t.preventDefault ? t.preventDefault() : t.returnValue = !1, t.stopPropagation && t.stopPropagation(), t.cancelBubble && (t.cancelBubble = !0)));
|
|
2018
2017
|
}
|
|
2019
2018
|
}
|
|
2020
|
-
function
|
|
2019
|
+
function ne(t, e) {
|
|
2021
2020
|
const n = _["*"];
|
|
2022
2021
|
let o = t.keyCode || t.which || t.charCode;
|
|
2023
2022
|
if (!P.filter.call(this, t)) return;
|
|
2024
2023
|
if ((o === 93 || o === 224) && (o = 91), I.indexOf(o) === -1 && o !== 229 && I.push(o), ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach((r) => {
|
|
2025
|
-
const l =
|
|
2024
|
+
const l = Ut[r];
|
|
2026
2025
|
t[r] && I.indexOf(l) === -1 ? I.push(l) : !t[r] && I.indexOf(l) > -1 ? I.splice(I.indexOf(l), 1) : r === "metaKey" && t[r] && I.length === 3 && (t.ctrlKey || t.shiftKey || t.altKey || (I = I.slice(I.indexOf(l))));
|
|
2027
|
-
}), o in
|
|
2028
|
-
|
|
2029
|
-
for (const r in
|
|
2030
|
-
|
|
2026
|
+
}), o in K) {
|
|
2027
|
+
K[o] = !0;
|
|
2028
|
+
for (const r in H)
|
|
2029
|
+
H[r] === o && (P[r] = !0);
|
|
2031
2030
|
if (!n) return;
|
|
2032
2031
|
}
|
|
2033
|
-
for (const r in
|
|
2034
|
-
Object.prototype.hasOwnProperty.call(
|
|
2035
|
-
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18),
|
|
2032
|
+
for (const r in K)
|
|
2033
|
+
Object.prototype.hasOwnProperty.call(K, r) && (K[r] = t[Ut[r]]);
|
|
2034
|
+
t.getModifierState && !(t.altKey && !t.ctrlKey) && t.getModifierState("AltGraph") && (I.indexOf(17) === -1 && I.push(17), I.indexOf(18) === -1 && I.push(18), K[17] = !0, K[18] = !0);
|
|
2036
2035
|
const i = ct();
|
|
2037
2036
|
if (n)
|
|
2038
2037
|
for (let r = 0; r < n.length; r++)
|
|
2039
|
-
n[r].scope === i && (t.type === "keydown" && n[r].keydown || t.type === "keyup" && n[r].keyup) &&
|
|
2038
|
+
n[r].scope === i && (t.type === "keydown" && n[r].keydown || t.type === "keyup" && n[r].keyup) && ee(t, n[r], i, e);
|
|
2040
2039
|
if (!(o in _)) return;
|
|
2041
2040
|
const s = _[o], a = s.length;
|
|
2042
2041
|
for (let r = 0; r < a; r++)
|
|
@@ -2046,15 +2045,15 @@ function se(t, e) {
|
|
|
2046
2045
|
} = l, u = l.key.split(f), h = [];
|
|
2047
2046
|
for (let g = 0; g < u.length; g++)
|
|
2048
2047
|
h.push(lt(u[g]));
|
|
2049
|
-
h.sort().join("") === I.sort().join("") &&
|
|
2048
|
+
h.sort().join("") === I.sort().join("") && ee(t, l, i, e);
|
|
2050
2049
|
}
|
|
2051
2050
|
}
|
|
2052
2051
|
function P(t, e, n) {
|
|
2053
2052
|
I = [];
|
|
2054
|
-
const o =
|
|
2053
|
+
const o = ye(t);
|
|
2055
2054
|
let i = [], s = "all", a = document, r = 0, l = !1, f = !0, u = "+", h = !1, g = !1;
|
|
2056
|
-
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (a = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (f = e.keydown), e.capture !== void 0 && (h = e.capture), typeof e.splitKey == "string" && (u = e.splitKey), e.single === !0 && (g = !0)), typeof e == "string" && (s = e), g &&
|
|
2057
|
-
t = o[r].split(u), i = [], t.length > 1 && (i =
|
|
2055
|
+
for (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]" && (e.scope && (s = e.scope), e.element && (a = e.element), e.keyup && (l = e.keyup), e.keydown !== void 0 && (f = e.keydown), e.capture !== void 0 && (h = e.capture), typeof e.splitKey == "string" && (u = e.splitKey), e.single === !0 && (g = !0)), typeof e == "string" && (s = e), g && ve(t, s); r < o.length; r++)
|
|
2056
|
+
t = o[r].split(u), i = [], t.length > 1 && (i = me(H, t)), t = t[t.length - 1], t = t === "*" ? "*" : lt(t), t in _ || (_[t] = []), _[t].push({
|
|
2058
2057
|
keyup: l,
|
|
2059
2058
|
keydown: f,
|
|
2060
2059
|
scope: s,
|
|
@@ -2066,19 +2065,19 @@ function P(t, e, n) {
|
|
|
2066
2065
|
element: a
|
|
2067
2066
|
});
|
|
2068
2067
|
if (typeof a < "u" && window) {
|
|
2069
|
-
if (!
|
|
2068
|
+
if (!z.has(a)) {
|
|
2070
2069
|
const p = function() {
|
|
2071
2070
|
let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2072
|
-
return
|
|
2071
|
+
return ne(y, a);
|
|
2073
2072
|
}, v = function() {
|
|
2074
2073
|
let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : window.event;
|
|
2075
|
-
|
|
2074
|
+
ne(y, a), go(y);
|
|
2076
2075
|
};
|
|
2077
|
-
|
|
2076
|
+
z.set(a, {
|
|
2078
2077
|
keydownListener: p,
|
|
2079
2078
|
keyupListenr: v,
|
|
2080
2079
|
capture: h
|
|
2081
|
-
}),
|
|
2080
|
+
}), kt(a, "keydown", p, h), kt(a, "keyup", v, h);
|
|
2082
2081
|
}
|
|
2083
2082
|
if (!rt) {
|
|
2084
2083
|
const p = () => {
|
|
@@ -2087,7 +2086,7 @@ function P(t, e, n) {
|
|
|
2087
2086
|
rt = {
|
|
2088
2087
|
listener: p,
|
|
2089
2088
|
capture: h
|
|
2090
|
-
},
|
|
2089
|
+
}, kt(window, "focus", p, h);
|
|
2091
2090
|
}
|
|
2092
2091
|
}
|
|
2093
2092
|
}
|
|
@@ -2099,7 +2098,7 @@ function mo(t) {
|
|
|
2099
2098
|
});
|
|
2100
2099
|
});
|
|
2101
2100
|
}
|
|
2102
|
-
function
|
|
2101
|
+
function Dt(t) {
|
|
2103
2102
|
const e = Object.values(_).flat();
|
|
2104
2103
|
if (e.findIndex((o) => {
|
|
2105
2104
|
let {
|
|
@@ -2111,27 +2110,27 @@ function $t(t) {
|
|
|
2111
2110
|
keydownListener: o,
|
|
2112
2111
|
keyupListenr: i,
|
|
2113
2112
|
capture: s
|
|
2114
|
-
} =
|
|
2115
|
-
o && i && (
|
|
2113
|
+
} = z.get(t) || {};
|
|
2114
|
+
o && i && (et(t, "keyup", i, s), et(t, "keydown", o, s), z.delete(t));
|
|
2116
2115
|
}
|
|
2117
|
-
if ((e.length <= 0 ||
|
|
2116
|
+
if ((e.length <= 0 || z.size <= 0) && (Object.keys(z).forEach((i) => {
|
|
2118
2117
|
const {
|
|
2119
2118
|
keydownListener: s,
|
|
2120
2119
|
keyupListenr: a,
|
|
2121
2120
|
capture: r
|
|
2122
|
-
} =
|
|
2123
|
-
s && a && (
|
|
2124
|
-
}),
|
|
2121
|
+
} = z.get(i) || {};
|
|
2122
|
+
s && a && (et(i, "keyup", a, r), et(i, "keydown", s, r), z.delete(i));
|
|
2123
|
+
}), z.clear(), Object.keys(_).forEach((i) => delete _[i]), rt)) {
|
|
2125
2124
|
const {
|
|
2126
2125
|
listener: i,
|
|
2127
2126
|
capture: s
|
|
2128
2127
|
} = rt;
|
|
2129
|
-
|
|
2128
|
+
et(window, "focus", i, s), rt = null;
|
|
2130
2129
|
}
|
|
2131
2130
|
}
|
|
2132
|
-
const
|
|
2131
|
+
const It = {
|
|
2133
2132
|
getPressedKeyString: lo,
|
|
2134
|
-
setScope:
|
|
2133
|
+
setScope: we,
|
|
2135
2134
|
getScope: ct,
|
|
2136
2135
|
deleteScope: po,
|
|
2137
2136
|
getPressedKeyCodes: co,
|
|
@@ -2139,20 +2138,20 @@ const Ut = {
|
|
|
2139
2138
|
isPressed: ho,
|
|
2140
2139
|
filter: fo,
|
|
2141
2140
|
trigger: mo,
|
|
2142
|
-
unbind:
|
|
2141
|
+
unbind: ve,
|
|
2143
2142
|
keyMap: at,
|
|
2144
|
-
modifier:
|
|
2145
|
-
modifierMap:
|
|
2143
|
+
modifier: H,
|
|
2144
|
+
modifierMap: Ut
|
|
2146
2145
|
};
|
|
2147
|
-
for (const t in
|
|
2148
|
-
Object.prototype.hasOwnProperty.call(
|
|
2146
|
+
for (const t in It)
|
|
2147
|
+
Object.prototype.hasOwnProperty.call(It, t) && (P[t] = It[t]);
|
|
2149
2148
|
if (typeof window < "u") {
|
|
2150
2149
|
const t = window.hotkeys;
|
|
2151
2150
|
P.noConflict = (e) => (e && window.hotkeys === P && (window.hotkeys = t), P), window.hotkeys = P;
|
|
2152
2151
|
}
|
|
2153
|
-
const
|
|
2154
|
-
...
|
|
2155
|
-
|
|
2152
|
+
const oe = 300, Ae = ["up", "down", "left", "right"], xe = Oe ? "⌘+a" : "ctrl+a", yo = [
|
|
2153
|
+
...Ae.map((t) => `shift+${t}`),
|
|
2154
|
+
xe
|
|
2156
2155
|
], bo = (t, e, n, o) => {
|
|
2157
2156
|
let i;
|
|
2158
2157
|
const s = (E) => i = E;
|
|
@@ -2160,42 +2159,37 @@ const re = 300, Se = ["up", "down", "left", "right"], Ce = Re ? "⌘+a" : "ctrl+
|
|
|
2160
2159
|
const r = (E) => a = E, { store: l, selection: f } = e;
|
|
2161
2160
|
let u, h, g, p = !1;
|
|
2162
2161
|
const v = (E) => {
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
return;
|
|
2166
|
-
u = !((b = E.target.parentElement) != null && b.closest(H)) ? {
|
|
2167
|
-
annotation: pe(),
|
|
2162
|
+
p = !1, h !== !1 && (u = nt(E.target) ? void 0 : {
|
|
2163
|
+
annotation: ue(),
|
|
2168
2164
|
selector: [],
|
|
2169
2165
|
creator: i,
|
|
2170
2166
|
created: /* @__PURE__ */ new Date()
|
|
2171
|
-
}
|
|
2172
|
-
}, y =
|
|
2173
|
-
var N, D;
|
|
2167
|
+
});
|
|
2168
|
+
}, y = Vt((E) => {
|
|
2174
2169
|
const R = document.getSelection();
|
|
2175
|
-
if (
|
|
2170
|
+
if (nt(R.anchorNode)) {
|
|
2176
2171
|
u = void 0;
|
|
2177
2172
|
return;
|
|
2178
2173
|
}
|
|
2179
|
-
const
|
|
2180
|
-
if ((g == null ? void 0 : g.type) === "pointerdown" && (
|
|
2174
|
+
const w = E.timeStamp - ((g == null ? void 0 : g.timeStamp) || E.timeStamp);
|
|
2175
|
+
if ((g == null ? void 0 : g.type) === "pointerdown" && (w < 1e3 && !u || R.isCollapsed && w < oe) && v(g || E), !u) return;
|
|
2181
2176
|
if (R.isCollapsed) {
|
|
2182
2177
|
l.getAnnotation(u.annotation) && (f.clear(), l.deleteAnnotation(u.annotation));
|
|
2183
2178
|
return;
|
|
2184
2179
|
}
|
|
2185
|
-
const A = R.getRangeAt(0),
|
|
2186
|
-
if (_e(
|
|
2187
|
-
const
|
|
2188
|
-
(
|
|
2189
|
-
var
|
|
2190
|
-
return
|
|
2180
|
+
const A = R.getRangeAt(0), x = Ye(A, t);
|
|
2181
|
+
if (_e(x)) return;
|
|
2182
|
+
const C = Be(x.cloneRange());
|
|
2183
|
+
(C.length !== u.selector.length || C.some((M, D) => {
|
|
2184
|
+
var Y;
|
|
2185
|
+
return M.toString() !== ((Y = u.selector[D]) == null ? void 0 : Y.quote);
|
|
2191
2186
|
})) && (u = {
|
|
2192
2187
|
...u,
|
|
2193
|
-
selector:
|
|
2188
|
+
selector: C.map((M) => Ke(M, t, o)),
|
|
2194
2189
|
updated: /* @__PURE__ */ new Date()
|
|
2195
|
-
}, l.getAnnotation(u.annotation)
|
|
2190
|
+
}, l.getAnnotation(u.annotation) ? l.updateTarget(u, B.LOCAL) : f.clear());
|
|
2196
2191
|
}), m = (E) => {
|
|
2197
|
-
|
|
2198
|
-
p || (b = E.target.parentElement) != null && b.closest(H) || (g = Et(E), h = g.button === 0);
|
|
2192
|
+
p || nt(E.target) || (g = wt(E), h = g.button === 0);
|
|
2199
2193
|
}, d = () => {
|
|
2200
2194
|
l.getAnnotation(u.annotation) ? l.updateTarget(u) : l.addAnnotation({
|
|
2201
2195
|
id: u.annotation,
|
|
@@ -2203,46 +2197,46 @@ const re = 300, Se = ["up", "down", "left", "right"], Ce = Re ? "⌘+a" : "ctrl+
|
|
|
2203
2197
|
target: u
|
|
2204
2198
|
});
|
|
2205
2199
|
}, c = (E) => {
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
},
|
|
2200
|
+
if (p || nt(E.target) || !h) return;
|
|
2201
|
+
const R = () => {
|
|
2202
|
+
const { x: A, y: x } = t.getBoundingClientRect(), C = E.target instanceof Node && t.contains(E.target) && l.getAt(E.clientX - A, E.clientY - x, a);
|
|
2203
|
+
if (C) {
|
|
2204
|
+
const { selected: k } = f;
|
|
2205
|
+
(k.length !== 1 || k[0].id !== C.id) && f.userSelect(C.id, E);
|
|
2206
|
+
} else
|
|
2207
|
+
f.clear();
|
|
2208
|
+
}, w = E.timeStamp - g.timeStamp;
|
|
2215
2209
|
setTimeout(() => {
|
|
2216
|
-
const
|
|
2217
|
-
|
|
2210
|
+
const A = document.getSelection();
|
|
2211
|
+
A != null && A.isCollapsed && w < oe ? (u = void 0, R()) : u && u.selector.length > 0 && (f.clear(), d(), f.userSelect(u.annotation, wt(E)));
|
|
2218
2212
|
});
|
|
2219
|
-
},
|
|
2213
|
+
}, b = (E) => {
|
|
2220
2214
|
p = !0;
|
|
2221
2215
|
const R = document.getSelection();
|
|
2222
|
-
R != null && R.isCollapsed || ((!u || u.selector.length === 0) && y(E), d(), f.userSelect(u.annotation,
|
|
2216
|
+
R != null && R.isCollapsed || ((!u || u.selector.length === 0) && y(E), d(), f.userSelect(u.annotation, wt(E)));
|
|
2223
2217
|
}, S = (E) => {
|
|
2224
|
-
E.key === "Shift" && u && (document.getSelection().isCollapsed || (f.clear(), d(), f.userSelect(u.annotation,
|
|
2218
|
+
E.key === "Shift" && u && (document.getSelection().isCollapsed || (f.clear(), d(), f.userSelect(u.annotation, dt(E))));
|
|
2225
2219
|
}, T = (E) => {
|
|
2226
2220
|
const R = () => setTimeout(() => {
|
|
2227
2221
|
(u == null ? void 0 : u.selector.length) > 0 && (f.clear(), l.addAnnotation({
|
|
2228
2222
|
id: u.annotation,
|
|
2229
2223
|
bodies: [],
|
|
2230
2224
|
target: u
|
|
2231
|
-
}), f.userSelect(u.annotation,
|
|
2225
|
+
}), f.userSelect(u.annotation, dt(E))), document.removeEventListener("selectionchange", R);
|
|
2232
2226
|
}, 100);
|
|
2233
2227
|
document.addEventListener("selectionchange", R), v(E);
|
|
2234
2228
|
};
|
|
2235
2229
|
P(yo.join(","), { element: t, keydown: !0, keyup: !1 }, (E) => {
|
|
2236
|
-
E.repeat || (g =
|
|
2237
|
-
}), P(
|
|
2238
|
-
g =
|
|
2230
|
+
E.repeat || (g = dt(E));
|
|
2231
|
+
}), P(xe, { keydown: !0, keyup: !1 }, (E) => {
|
|
2232
|
+
g = dt(E), T(E);
|
|
2239
2233
|
});
|
|
2240
2234
|
const L = (E) => {
|
|
2241
2235
|
E.repeat || E.target !== t && E.target !== document.body || (u = void 0, f.clear());
|
|
2242
2236
|
};
|
|
2243
|
-
return P(
|
|
2237
|
+
return P(Ae.join(","), { keydown: !0, keyup: !1 }, L), t.addEventListener("pointerdown", m), document.addEventListener("pointerup", c), document.addEventListener("contextmenu", b), n && (t.addEventListener("keyup", S), t.addEventListener("selectstart", v), document.addEventListener("selectionchange", y)), {
|
|
2244
2238
|
destroy: () => {
|
|
2245
|
-
t.removeEventListener("pointerdown", m), document.removeEventListener("pointerup", c), document.removeEventListener("contextmenu",
|
|
2239
|
+
t.removeEventListener("pointerdown", m), document.removeEventListener("pointerup", c), document.removeEventListener("contextmenu", b), t.removeEventListener("keyup", S), t.removeEventListener("selectstart", v), document.removeEventListener("selectionchange", y), P.unbind();
|
|
2246
2240
|
},
|
|
2247
2241
|
setFilter: r,
|
|
2248
2242
|
setUser: s
|
|
@@ -2251,14 +2245,14 @@ const re = 300, Se = ["up", "down", "left", "right"], Ce = Re ? "⌘+a" : "ctrl+
|
|
|
2251
2245
|
...t,
|
|
2252
2246
|
annotatingEnabled: t.annotatingEnabled ?? e.annotatingEnabled,
|
|
2253
2247
|
user: t.user || e.user
|
|
2254
|
-
}),
|
|
2255
|
-
|
|
2248
|
+
}), ie = "SPANS", xo = (t, e = {}) => {
|
|
2249
|
+
Te(t), Me(t);
|
|
2256
2250
|
const n = wo(e, {
|
|
2257
2251
|
annotatingEnabled: !0,
|
|
2258
2252
|
user: Dn()
|
|
2259
2253
|
}), o = no(t, n.userSelectAction), { selection: i, viewport: s } = o, a = o.store, r = Rn(a), l = kn(o, r, n.adapter);
|
|
2260
2254
|
let f = n.user;
|
|
2261
|
-
const u = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" :
|
|
2255
|
+
const u = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : ie : n.renderer || ie, h = u === "SPANS" ? an(t, o, s) : u === "CSS_HIGHLIGHTS" ? on(t, o, s) : u === "CANVAS" ? Fe(t, o, s) : void 0;
|
|
2262
2256
|
if (!h)
|
|
2263
2257
|
throw `Unknown renderer implementation: ${u}`;
|
|
2264
2258
|
console.debug(`Using ${u} renderer`), n.style && h.setStyle(n.style);
|
|
@@ -2291,44 +2285,45 @@ const re = 300, Se = ["up", "down", "left", "right"], Ce = Re ? "⌘+a" : "ctrl+
|
|
|
2291
2285
|
};
|
|
2292
2286
|
};
|
|
2293
2287
|
export {
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2288
|
+
bt as DEFAULT_SELECTED_STYLE,
|
|
2289
|
+
W as DEFAULT_STYLE,
|
|
2290
|
+
se as NOT_ANNOTATABLE_CLASS,
|
|
2291
|
+
Z as NOT_ANNOTATABLE_SELECTOR,
|
|
2292
|
+
B as Origin,
|
|
2299
2293
|
bo as SelectionHandler,
|
|
2300
2294
|
pn as UserSelectAction,
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2295
|
+
Ao as W3CTextFormat,
|
|
2296
|
+
Te as cancelSingleClickEvents,
|
|
2297
|
+
dt as cloneKeyboardEvent,
|
|
2298
|
+
wt as clonePointerEvent,
|
|
2299
|
+
vo as createBody,
|
|
2306
2300
|
Fe as createCanvasRenderer,
|
|
2307
2301
|
on as createHighlightsRenderer,
|
|
2308
2302
|
io as createPresencePainter,
|
|
2309
2303
|
nn as createRenderer,
|
|
2310
2304
|
an as createSpansRenderer,
|
|
2311
|
-
|
|
2305
|
+
xo as createTextAnnotator,
|
|
2312
2306
|
no as createTextAnnotatorState,
|
|
2313
|
-
|
|
2307
|
+
Vt as debounce,
|
|
2314
2308
|
wo as fillDefaults,
|
|
2315
|
-
vo as getAnnotatableFragment,
|
|
2316
2309
|
ke as getQuoteContext,
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2310
|
+
_t as getRangeAnnotatableContents,
|
|
2311
|
+
Oe as isMac,
|
|
2312
|
+
nt as isNotAnnotatable,
|
|
2313
|
+
Le as isRangeAnnotatable,
|
|
2314
|
+
F as isRevived,
|
|
2320
2315
|
_e as isWhitespaceOrEmpty,
|
|
2321
2316
|
Ve as mergeClientRects,
|
|
2322
2317
|
Xe as paint,
|
|
2323
2318
|
zn as parseW3CTextAnnotation,
|
|
2324
|
-
|
|
2319
|
+
Me as programmaticallyFocusable,
|
|
2325
2320
|
Ke as rangeToSelector,
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2321
|
+
vt as reviveAnnotation,
|
|
2322
|
+
re as reviveSelector,
|
|
2323
|
+
yt as reviveTarget,
|
|
2329
2324
|
De as scrollIntoView,
|
|
2330
2325
|
Fn as serializeW3CTextAnnotation,
|
|
2331
|
-
|
|
2326
|
+
Be as splitAnnotatableRanges,
|
|
2332
2327
|
Ye as trimRangeToContainer,
|
|
2333
2328
|
Ie as whitespaceOrEmptyRegex
|
|
2334
2329
|
};
|