@soomo/text-annotator 3.0.0-staging.19 → 3.0.0-staging.20
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.
|
@@ -4,29 +4,29 @@ const P = {
|
|
|
4
4
|
}, ot = {
|
|
5
5
|
fill: "rgb(0, 128, 255)",
|
|
6
6
|
fillOpacity: 0.45
|
|
7
|
-
},
|
|
7
|
+
}, Kt = (t, e, n, o, i) => {
|
|
8
8
|
var a, s;
|
|
9
9
|
const r = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((a = t.state) != null && a.selected ? ot : P) : n : (s = t.state) != null && s.selected ? ot : P;
|
|
10
10
|
return o && o.paint(t, e) || r;
|
|
11
|
-
},
|
|
11
|
+
}, Yt = "not-annotatable", D = `.${Yt}`, Qt = (t) => {
|
|
12
12
|
var n;
|
|
13
13
|
const e = t.commonAncestorContainer;
|
|
14
|
-
return e instanceof HTMLElement ? !e.closest(
|
|
15
|
-
},
|
|
14
|
+
return e instanceof HTMLElement ? !e.closest(D) : !((n = e.parentElement) != null && n.closest(D));
|
|
15
|
+
}, Jt = function* (t) {
|
|
16
16
|
const e = document.createNodeIterator(
|
|
17
17
|
t.commonAncestorContainer,
|
|
18
18
|
NodeFilter.SHOW_ELEMENT,
|
|
19
|
-
(o) => o instanceof HTMLElement && o.classList.contains(
|
|
19
|
+
(o) => o instanceof HTMLElement && o.classList.contains(Yt) && !o.parentElement.closest(D) && t.intersectsNode(o) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
|
|
20
20
|
);
|
|
21
21
|
let n;
|
|
22
22
|
for (; n = e.nextNode(); )
|
|
23
23
|
n instanceof HTMLElement && (yield n);
|
|
24
|
-
},
|
|
25
|
-
if (!
|
|
24
|
+
}, Zt = (t) => {
|
|
25
|
+
if (!Qt(t))
|
|
26
26
|
return [];
|
|
27
27
|
const e = [];
|
|
28
28
|
let n = null;
|
|
29
|
-
for (const o of
|
|
29
|
+
for (const o of Jt(t)) {
|
|
30
30
|
let i;
|
|
31
31
|
n ? (i = document.createRange(), i.setStartAfter(n), i.setEndBefore(o)) : (i = t.cloneRange(), i.setEndBefore(o)), i.collapsed || e.push(i), n = o;
|
|
32
32
|
}
|
|
@@ -35,23 +35,23 @@ const P = {
|
|
|
35
35
|
o.setStartAfter(n), o.collapsed || e.push(o);
|
|
36
36
|
}
|
|
37
37
|
return e.length > 0 ? e : [t];
|
|
38
|
-
},
|
|
38
|
+
}, pt = (t) => {
|
|
39
39
|
const e = t.cloneContents();
|
|
40
|
-
return e.querySelectorAll(
|
|
41
|
-
},
|
|
40
|
+
return e.querySelectorAll(D).forEach((n) => n.remove()), e;
|
|
41
|
+
}, te = (t) => {
|
|
42
42
|
t.addEventListener("click", (e) => {
|
|
43
43
|
// Allow clicks within not-annotatable elements
|
|
44
|
-
!e.target.closest(
|
|
44
|
+
!e.target.closest(D) && !e.target.closest("a") && e.preventDefault();
|
|
45
45
|
});
|
|
46
|
-
},
|
|
46
|
+
}, bt = (t, e = 10) => {
|
|
47
47
|
let n;
|
|
48
48
|
return (...o) => {
|
|
49
49
|
clearTimeout(n), n = setTimeout(() => t.apply(void 0, o), e);
|
|
50
50
|
};
|
|
51
|
-
},
|
|
51
|
+
}, On = (t) => {
|
|
52
52
|
const e = t.cloneContents();
|
|
53
|
-
return e.querySelectorAll(
|
|
54
|
-
},
|
|
53
|
+
return e.querySelectorAll(D).forEach((n) => n.remove()), e;
|
|
54
|
+
}, wt = (t, e) => {
|
|
55
55
|
const n = document.createNodeIterator(e);
|
|
56
56
|
let o = 0, i = n.nextNode();
|
|
57
57
|
for (; i !== null; ) {
|
|
@@ -59,13 +59,13 @@ const P = {
|
|
|
59
59
|
return o;
|
|
60
60
|
o += 1, i = n.nextNode();
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, xt = (t, e) => {
|
|
63
63
|
const n = document.createNodeIterator(e);
|
|
64
64
|
let o = null;
|
|
65
65
|
for (let i = 0; i < t + 1; i++)
|
|
66
66
|
o = n.nextNode();
|
|
67
67
|
return o;
|
|
68
|
-
},
|
|
68
|
+
}, ee = (t) => {
|
|
69
69
|
const {
|
|
70
70
|
commonAncestorContainer: e,
|
|
71
71
|
startContainer: n,
|
|
@@ -75,10 +75,10 @@ const P = {
|
|
|
75
75
|
} = t, a = Array.from(e.childNodes).map((c) => {
|
|
76
76
|
const p = c.cloneNode(!0);
|
|
77
77
|
return c.nodeName === "CANVAS" ? c : p;
|
|
78
|
-
}), s =
|
|
78
|
+
}), s = wt(n, e), u = wt(i, e), f = () => {
|
|
79
79
|
const c = e;
|
|
80
80
|
c.replaceChildren(...a);
|
|
81
|
-
const p =
|
|
81
|
+
const p = xt(s, c), g = xt(u, c);
|
|
82
82
|
return t.setStart(p, o), t.setEnd(g, r), t;
|
|
83
83
|
}, m = (c) => {
|
|
84
84
|
const p = document.createElement("SPAN");
|
|
@@ -91,14 +91,14 @@ const P = {
|
|
|
91
91
|
c.selectNodeContents(n), c.setStart(n, o);
|
|
92
92
|
const p = m(c), g = document.createRange();
|
|
93
93
|
g.selectNode(i), g.setEnd(i, r);
|
|
94
|
-
const
|
|
94
|
+
const w = m(g), h = ne(t).reverse().map((d) => {
|
|
95
95
|
var b;
|
|
96
96
|
const l = document.createElement("SPAN");
|
|
97
97
|
return (b = d.parentNode) == null || b.insertBefore(l, d), l.appendChild(d), l;
|
|
98
98
|
});
|
|
99
|
-
return { unwrap: f, nodes: [p, ...h,
|
|
99
|
+
return { unwrap: f, nodes: [p, ...h, w] };
|
|
100
100
|
}
|
|
101
|
-
},
|
|
101
|
+
}, ne = (t) => {
|
|
102
102
|
const {
|
|
103
103
|
commonAncestorContainer: e,
|
|
104
104
|
startContainer: n,
|
|
@@ -109,25 +109,25 @@ const P = {
|
|
|
109
109
|
for (; r != null; )
|
|
110
110
|
r === o && (a = !1), a && s.push(r), r === n && (a = !0), r = i.nextNode();
|
|
111
111
|
return s;
|
|
112
|
-
},
|
|
112
|
+
}, In = (t) => {
|
|
113
113
|
const { startContainer: e, endContainer: n } = t;
|
|
114
114
|
if (e === n)
|
|
115
115
|
return Array.from(t.getClientRects());
|
|
116
116
|
{
|
|
117
|
-
const { unwrap: o, nodes: i } =
|
|
117
|
+
const { unwrap: o, nodes: i } = ee(t), r = i.reduce((a, s) => [...a, ...s.getClientRects()], []);
|
|
118
118
|
return o(), r;
|
|
119
119
|
}
|
|
120
|
-
},
|
|
120
|
+
}, oe = (t, e, n = 10, o) => {
|
|
121
121
|
const i = o ? t.startContainer.parentElement.closest(o) : e, r = document.createRange();
|
|
122
122
|
r.setStart(i, 0), r.setEnd(t.startContainer, t.startOffset);
|
|
123
|
-
const a =
|
|
123
|
+
const a = pt(r).textContent, s = document.createRange();
|
|
124
124
|
s.setStart(t.endContainer, t.endOffset), i === document.body ? s.setEnd(i, i.childNodes.length) : s.setEndAfter(i);
|
|
125
|
-
const u =
|
|
125
|
+
const u = pt(s).textContent;
|
|
126
126
|
return {
|
|
127
127
|
prefix: a.substring(a.length - n),
|
|
128
128
|
suffix: u.substring(0, n)
|
|
129
129
|
};
|
|
130
|
-
},
|
|
130
|
+
}, ie = /^\s*$/, re = (t) => ie.test(t.toString()), $ = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), se = (t, e) => {
|
|
131
131
|
const n = (r) => Math.round(r * 10) / 10, o = {
|
|
132
132
|
top: n(t.top),
|
|
133
133
|
bottom: n(t.bottom),
|
|
@@ -151,17 +151,17 @@ const P = {
|
|
|
151
151
|
return "block-contains";
|
|
152
152
|
} else if (o.top >= i.top && o.bottom <= i.bottom && o.left >= i.left && o.right <= i.right)
|
|
153
153
|
return "block-is-contained";
|
|
154
|
-
},
|
|
154
|
+
}, ae = (t, e) => {
|
|
155
155
|
const n = Math.min(t.left, e.left), o = Math.max(t.right, e.right), i = Math.min(t.top, e.top), r = Math.max(t.bottom, e.bottom);
|
|
156
156
|
return new DOMRect(n, i, o - n, r - i);
|
|
157
|
-
},
|
|
157
|
+
}, ce = (t) => t.reduce((e, n) => {
|
|
158
158
|
if (n.width === 0 || n.height === 0)
|
|
159
159
|
return e;
|
|
160
160
|
let o = [...e], i = !1;
|
|
161
161
|
for (const r of e) {
|
|
162
|
-
const a =
|
|
162
|
+
const a = se(n, r);
|
|
163
163
|
if (a === "inline-adjacent") {
|
|
164
|
-
o = o.map((s) => s === r ?
|
|
164
|
+
o = o.map((s) => s === r ? ae(n, r) : s), i = !0;
|
|
165
165
|
break;
|
|
166
166
|
} else if (a === "inline-contains") {
|
|
167
167
|
o = o.map((s) => s === r ? n : s), i = !0;
|
|
@@ -175,19 +175,19 @@ const P = {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
return i ? o : [...o, n];
|
|
178
|
-
}, []),
|
|
178
|
+
}, []), le = (t, e, n) => {
|
|
179
179
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
180
180
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
181
|
-
const r =
|
|
181
|
+
const r = pt(o).textContent, a = t.toString(), s = r.length || 0, u = s + a.length;
|
|
182
182
|
return n ? { quote: a, start: s, end: u, range: t, offsetReference: i } : { quote: a, start: s, end: u, range: t };
|
|
183
|
-
},
|
|
183
|
+
}, Dt = (t, e) => {
|
|
184
184
|
var m, c;
|
|
185
185
|
const { start: n, end: o } = t, i = t.offsetReference || e, r = document.createNodeIterator(
|
|
186
186
|
e,
|
|
187
187
|
NodeFilter.SHOW_TEXT,
|
|
188
188
|
(p) => {
|
|
189
189
|
var g;
|
|
190
|
-
return (g = p.parentElement) != null && g.closest(
|
|
190
|
+
return (g = p.parentElement) != null && g.closest(D) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
191
191
|
}
|
|
192
192
|
);
|
|
193
193
|
let a = 0;
|
|
@@ -220,42 +220,42 @@ const P = {
|
|
|
220
220
|
};
|
|
221
221
|
}, it = (t, e) => $(t.selector) ? t : {
|
|
222
222
|
...t,
|
|
223
|
-
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n :
|
|
224
|
-
}, rt = (t, e) => $(t.target.selector) ? t : { ...t, target: it(t.target, e) },
|
|
223
|
+
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : Dt(n, e))
|
|
224
|
+
}, rt = (t, e) => $(t.target.selector) ? t : { ...t, target: it(t.target, e) }, de = (t) => {
|
|
225
225
|
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, a = -e, s = o - n, u = i - e;
|
|
226
226
|
return { top: e, left: n, minX: r, minY: a, maxX: s, maxY: u };
|
|
227
|
-
},
|
|
227
|
+
}, ue = (t) => {
|
|
228
228
|
let e = /* @__PURE__ */ new Set();
|
|
229
229
|
return (o) => {
|
|
230
230
|
const i = o.map((r) => r.id);
|
|
231
231
|
(e.size !== i.length || i.some((r) => !e.has(r))) && t.set(i), e = new Set(i);
|
|
232
232
|
};
|
|
233
|
-
},
|
|
233
|
+
}, vt = (t, e, n, o) => {
|
|
234
234
|
const { store: i, selection: r, hover: a } = e;
|
|
235
235
|
let s, u, f;
|
|
236
|
-
const m =
|
|
237
|
-
const { x:
|
|
236
|
+
const m = ue(n), c = (T) => {
|
|
237
|
+
const { x: O, y: v } = t.getBoundingClientRect(), x = i.getAt(T.clientX - O, T.clientY - v);
|
|
238
238
|
x && (!u || u(x)) ? a.current !== x.id && (t.classList.add("hovered"), a.set(x.id)) : a.current && (t.classList.remove("hovered"), a.set(null));
|
|
239
239
|
};
|
|
240
240
|
t.addEventListener("pointermove", c);
|
|
241
241
|
const p = (T = !1) => {
|
|
242
242
|
f && f.clear();
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
return { annotation:
|
|
243
|
+
const O = de(t), { minX: v, minY: x, maxX: A, maxY: E } = O, R = u ? i.getIntersecting(v, x, A, E).filter(({ annotation: _ }) => u(_)) : i.getIntersecting(v, x, A, E), M = r.selected.map(({ id: _ }) => _), H = R.map(({ annotation: _, rects: qt }) => {
|
|
244
|
+
const jt = M.includes(_.id), Gt = _.id === a.current;
|
|
245
|
+
return { annotation: _, rects: qt, state: { selected: jt, hover: Gt } };
|
|
246
246
|
});
|
|
247
|
-
o.redraw(H,
|
|
247
|
+
o.redraw(H, O, s, f, T), setTimeout(() => m(R.map(({ annotation: _ }) => _)), 1);
|
|
248
248
|
}, g = (T) => {
|
|
249
249
|
f = T, p();
|
|
250
|
-
}, y = (T) => {
|
|
251
|
-
s = T, p();
|
|
252
250
|
}, w = (T) => {
|
|
251
|
+
s = T, p();
|
|
252
|
+
}, y = (T) => {
|
|
253
253
|
u = T, p(!1);
|
|
254
254
|
}, h = () => p();
|
|
255
255
|
i.observe(h);
|
|
256
256
|
const d = r.subscribe(() => p()), l = () => p(!0);
|
|
257
257
|
document.addEventListener("scroll", l, { capture: !0, passive: !0 });
|
|
258
|
-
const b =
|
|
258
|
+
const b = bt(() => {
|
|
259
259
|
i.recalculatePositions(), f && f.reset(), p();
|
|
260
260
|
});
|
|
261
261
|
window.addEventListener("resize", b);
|
|
@@ -269,54 +269,54 @@ const P = {
|
|
|
269
269
|
t.removeEventListener("pointermove", c), o.destroy(), i.unobserve(h), d(), document.removeEventListener("scroll", l), window.removeEventListener("resize", b), S.disconnect(), C.disconnect();
|
|
270
270
|
},
|
|
271
271
|
redraw: p,
|
|
272
|
-
setStyle:
|
|
273
|
-
setFilter:
|
|
272
|
+
setStyle: w,
|
|
273
|
+
setFilter: y,
|
|
274
274
|
setPainter: g,
|
|
275
275
|
setVisible: o.setVisible
|
|
276
276
|
};
|
|
277
|
-
},
|
|
277
|
+
}, he = () => {
|
|
278
278
|
const t = document.createElement("canvas");
|
|
279
279
|
return t.width = window.innerWidth, t.height = window.innerHeight, t.className = "r6o-highlight-layer bg", t;
|
|
280
|
-
},
|
|
280
|
+
}, fe = (t, e) => {
|
|
281
281
|
t.width = window.innerWidth, t.height = window.innerHeight;
|
|
282
|
-
},
|
|
282
|
+
}, ge = (t) => {
|
|
283
283
|
t.classList.add("r6o-annotatable");
|
|
284
|
-
const e =
|
|
284
|
+
const e = he(), n = e.getContext("2d");
|
|
285
285
|
t.insertBefore(e, t.firstChild);
|
|
286
286
|
const o = (s, u, f, m) => requestAnimationFrame(() => {
|
|
287
287
|
const { width: c, height: p } = e;
|
|
288
288
|
n.clearRect(-0.5, -0.5, c + 1, p + 1), m && m.clear();
|
|
289
|
-
const { top: g, left:
|
|
289
|
+
const { top: g, left: w } = u;
|
|
290
290
|
[...s].sort((h, d) => {
|
|
291
291
|
const { annotation: { target: { created: l } } } = h, { annotation: { target: { created: b } } } = d;
|
|
292
292
|
return l.getTime() - b.getTime();
|
|
293
293
|
}).forEach((h) => {
|
|
294
294
|
var L;
|
|
295
|
-
const d = f ? typeof f == "function" ? f(h.annotation, h.state) : f : (L = h.state) != null && L.selected ? ot : P, l = m && m.paint(h, u) || d, b = h.rects.map(({ x: C, y: B, width: T, height:
|
|
296
|
-
x: C +
|
|
295
|
+
const d = f ? typeof f == "function" ? f(h.annotation, h.state) : f : (L = h.state) != null && L.selected ? ot : P, l = m && m.paint(h, u) || d, b = h.rects.map(({ x: C, y: B, width: T, height: O }) => ({
|
|
296
|
+
x: C + w,
|
|
297
297
|
y: B + g,
|
|
298
298
|
width: T,
|
|
299
|
-
height:
|
|
299
|
+
height: O
|
|
300
300
|
}));
|
|
301
301
|
n.fillStyle = l.fill, n.globalAlpha = l.fillOpacity || 1;
|
|
302
302
|
const S = 5;
|
|
303
303
|
if (b.forEach(
|
|
304
|
-
({ x: C, y: B, width: T, height:
|
|
304
|
+
({ x: C, y: B, width: T, height: O }) => n.fillRect(
|
|
305
305
|
C,
|
|
306
306
|
B - S / 2,
|
|
307
307
|
T,
|
|
308
|
-
|
|
308
|
+
O + S
|
|
309
309
|
)
|
|
310
310
|
), l.underlineColor) {
|
|
311
311
|
n.globalAlpha = 1, n.strokeStyle = l.underlineColor, n.lineWidth = l.underlineThickness ?? 1;
|
|
312
312
|
const C = S / 2 + (l.underlineOffset ?? 0);
|
|
313
|
-
b.forEach(({ x: B, y: T, width:
|
|
314
|
-
n.beginPath(), n.moveTo(B, T + v + C), n.lineTo(B +
|
|
313
|
+
b.forEach(({ x: B, y: T, width: O, height: v }) => {
|
|
314
|
+
n.beginPath(), n.moveTo(B, T + v + C), n.lineTo(B + O, T + v + C), n.stroke();
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
|
-
}), i =
|
|
319
|
-
|
|
318
|
+
}), i = bt(() => {
|
|
319
|
+
fe(e);
|
|
320
320
|
});
|
|
321
321
|
return window.addEventListener("resize", i), {
|
|
322
322
|
destroy: () => {
|
|
@@ -327,100 +327,100 @@ const P = {
|
|
|
327
327
|
},
|
|
328
328
|
redraw: o
|
|
329
329
|
};
|
|
330
|
-
},
|
|
331
|
-
var
|
|
330
|
+
}, pe = (t, e, n) => vt(t, e, n, ge(t));
|
|
331
|
+
var me = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
332
332
|
return typeof t == "string" ? t.length > 0 : typeof t == "number";
|
|
333
|
-
},
|
|
333
|
+
}, I = function(t, e, n) {
|
|
334
334
|
return e === void 0 && (e = 0), n === void 0 && (n = Math.pow(10, e)), Math.round(n * t) / n + 0;
|
|
335
335
|
}, k = function(t, e, n) {
|
|
336
336
|
return e === void 0 && (e = 0), n === void 0 && (n = 1), t > n ? n : t > e ? t : e;
|
|
337
|
-
},
|
|
337
|
+
}, _t = function(t) {
|
|
338
338
|
return (t = isFinite(t) ? t % 360 : 0) > 0 ? t : t + 360;
|
|
339
|
-
},
|
|
339
|
+
}, At = function(t) {
|
|
340
340
|
return { r: k(t.r, 0, 255), g: k(t.g, 0, 255), b: k(t.b, 0, 255), a: k(t.a) };
|
|
341
341
|
}, st = function(t) {
|
|
342
|
-
return { r:
|
|
343
|
-
},
|
|
342
|
+
return { r: I(t.r), g: I(t.g), b: I(t.b), a: I(t.a, 3) };
|
|
343
|
+
}, be = /^#([0-9a-f]{3,8})$/i, J = function(t) {
|
|
344
344
|
var e = t.toString(16);
|
|
345
345
|
return e.length < 2 ? "0" + e : e;
|
|
346
|
-
},
|
|
346
|
+
}, Xt = function(t) {
|
|
347
347
|
var e = t.r, n = t.g, o = t.b, i = t.a, r = Math.max(e, n, o), a = r - Math.min(e, n, o), s = a ? r === e ? (n - o) / a : r === n ? 2 + (o - e) / a : 4 + (e - n) / a : 0;
|
|
348
348
|
return { h: 60 * (s < 0 ? s + 6 : s), s: r ? a / r * 100 : 0, v: r / 255 * 100, a: i };
|
|
349
|
-
},
|
|
349
|
+
}, $t = function(t) {
|
|
350
350
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
351
351
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
352
352
|
var r = Math.floor(e), a = o * (1 - n), s = o * (1 - (e - r) * n), u = o * (1 - (1 - e + r) * n), f = r % 6;
|
|
353
353
|
return { r: 255 * [o, s, a, a, u, o][f], g: 255 * [u, o, o, s, a, a][f], b: 255 * [a, a, u, o, o, s][f], a: i };
|
|
354
|
-
}, xt = function(t) {
|
|
355
|
-
return { h: kt(t.h), s: k(t.s, 0, 100), l: k(t.l, 0, 100), a: k(t.a) };
|
|
356
|
-
}, At = function(t) {
|
|
357
|
-
return { h: M(t.h), s: M(t.s), l: M(t.l), a: M(t.a, 3) };
|
|
358
354
|
}, Et = function(t) {
|
|
359
|
-
return
|
|
355
|
+
return { h: _t(t.h), s: k(t.s, 0, 100), l: k(t.l, 0, 100), a: k(t.a) };
|
|
356
|
+
}, St = function(t) {
|
|
357
|
+
return { h: I(t.h), s: I(t.s), l: I(t.l), a: I(t.a, 3) };
|
|
358
|
+
}, Ct = function(t) {
|
|
359
|
+
return $t((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 }));
|
|
360
360
|
var e, n, o;
|
|
361
361
|
}, Q = function(t) {
|
|
362
|
-
return { h: (e =
|
|
362
|
+
return { h: (e = Xt(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 };
|
|
363
363
|
var e, n, o, i;
|
|
364
|
-
},
|
|
365
|
-
var e =
|
|
366
|
-
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 ?
|
|
364
|
+
}, ve = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, ye = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, we = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, xe = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i, Lt = { string: [[function(t) {
|
|
365
|
+
var e = be.exec(t);
|
|
366
|
+
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 ? I(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 ? I(parseInt(t.substr(6, 2), 16) / 255, 2) : 1 } : null : null;
|
|
367
367
|
}, "hex"], [function(t) {
|
|
368
|
-
var e =
|
|
369
|
-
return e ? e[2] !== e[4] || e[4] !== e[6] ? null :
|
|
368
|
+
var e = we.exec(t) || xe.exec(t);
|
|
369
|
+
return e ? e[2] !== e[4] || e[4] !== e[6] ? null : At({ 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;
|
|
370
370
|
}, "rgb"], [function(t) {
|
|
371
|
-
var e =
|
|
371
|
+
var e = ve.exec(t) || ye.exec(t);
|
|
372
372
|
if (!e)
|
|
373
373
|
return null;
|
|
374
|
-
var n, o, i =
|
|
375
|
-
return
|
|
374
|
+
var n, o, i = Et({ h: (n = e[1], o = e[2], o === void 0 && (o = "deg"), Number(n) * (me[o] || 1)), s: Number(e[3]), l: Number(e[4]), a: e[5] === void 0 ? 1 : Number(e[5]) / (e[6] ? 100 : 1) });
|
|
375
|
+
return Ct(i);
|
|
376
376
|
}, "hsl"]], object: [[function(t) {
|
|
377
377
|
var e = t.r, n = t.g, o = t.b, i = t.a, r = i === void 0 ? 1 : i;
|
|
378
|
-
return X(e) && X(n) && X(o) ?
|
|
378
|
+
return X(e) && X(n) && X(o) ? At({ r: Number(e), g: Number(n), b: Number(o), a: Number(r) }) : null;
|
|
379
379
|
}, "rgb"], [function(t) {
|
|
380
380
|
var e = t.h, n = t.s, o = t.l, i = t.a, r = i === void 0 ? 1 : i;
|
|
381
381
|
if (!X(e) || !X(n) || !X(o))
|
|
382
382
|
return null;
|
|
383
|
-
var a =
|
|
384
|
-
return
|
|
383
|
+
var a = Et({ h: Number(e), s: Number(n), l: Number(o), a: Number(r) });
|
|
384
|
+
return Ct(a);
|
|
385
385
|
}, "hsl"], [function(t) {
|
|
386
386
|
var e = t.h, n = t.s, o = t.v, i = t.a, r = i === void 0 ? 1 : i;
|
|
387
387
|
if (!X(e) || !X(n) || !X(o))
|
|
388
388
|
return null;
|
|
389
389
|
var a = function(s) {
|
|
390
|
-
return { h:
|
|
390
|
+
return { h: _t(s.h), s: k(s.s, 0, 100), v: k(s.v, 0, 100), a: k(s.a) };
|
|
391
391
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(r) });
|
|
392
|
-
return
|
|
393
|
-
}, "hsv"]] },
|
|
392
|
+
return $t(a);
|
|
393
|
+
}, "hsv"]] }, Bt = function(t, e) {
|
|
394
394
|
for (var n = 0; n < e.length; n++) {
|
|
395
395
|
var o = e[n][0](t);
|
|
396
396
|
if (o)
|
|
397
397
|
return [o, e[n][1]];
|
|
398
398
|
}
|
|
399
399
|
return [null, void 0];
|
|
400
|
-
},
|
|
401
|
-
return typeof t == "string" ?
|
|
400
|
+
}, Ae = function(t) {
|
|
401
|
+
return typeof t == "string" ? Bt(t.trim(), Lt.string) : typeof t == "object" && t !== null ? Bt(t, Lt.object) : [null, void 0];
|
|
402
402
|
}, at = function(t, e) {
|
|
403
403
|
var n = Q(t);
|
|
404
404
|
return { h: n.h, s: k(n.s + 100 * e, 0, 100), l: n.l, a: n.a };
|
|
405
405
|
}, ct = function(t) {
|
|
406
406
|
return (299 * t.r + 587 * t.g + 114 * t.b) / 1e3 / 255;
|
|
407
|
-
},
|
|
407
|
+
}, Tt = function(t, e) {
|
|
408
408
|
var n = Q(t);
|
|
409
409
|
return { h: n.h, s: n.s, l: k(n.l + 100 * e, 0, 100), a: n.a };
|
|
410
|
-
},
|
|
410
|
+
}, Rt = function() {
|
|
411
411
|
function t(e) {
|
|
412
|
-
this.parsed =
|
|
412
|
+
this.parsed = Ae(e)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 };
|
|
413
413
|
}
|
|
414
414
|
return t.prototype.isValid = function() {
|
|
415
415
|
return this.parsed !== null;
|
|
416
416
|
}, t.prototype.brightness = function() {
|
|
417
|
-
return
|
|
417
|
+
return I(ct(this.rgba), 2);
|
|
418
418
|
}, t.prototype.isDark = function() {
|
|
419
419
|
return ct(this.rgba) < 0.5;
|
|
420
420
|
}, t.prototype.isLight = function() {
|
|
421
421
|
return ct(this.rgba) >= 0.5;
|
|
422
422
|
}, t.prototype.toHex = function() {
|
|
423
|
-
return e = st(this.rgba), n = e.r, o = e.g, i = e.b, a = (r = e.a) < 1 ? J(
|
|
423
|
+
return e = st(this.rgba), n = e.r, o = e.g, i = e.b, a = (r = e.a) < 1 ? J(I(255 * r)) : "", "#" + J(n) + J(o) + J(i) + a;
|
|
424
424
|
var e, n, o, i, r, a;
|
|
425
425
|
}, t.prototype.toRgb = function() {
|
|
426
426
|
return st(this.rgba);
|
|
@@ -428,12 +428,12 @@ var fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
|
428
428
|
return e = st(this.rgba), n = e.r, o = e.g, i = e.b, (r = e.a) < 1 ? "rgba(" + n + ", " + o + ", " + i + ", " + r + ")" : "rgb(" + n + ", " + o + ", " + i + ")";
|
|
429
429
|
var e, n, o, i, r;
|
|
430
430
|
}, t.prototype.toHsl = function() {
|
|
431
|
-
return
|
|
431
|
+
return St(Q(this.rgba));
|
|
432
432
|
}, t.prototype.toHslString = function() {
|
|
433
|
-
return e =
|
|
433
|
+
return e = St(Q(this.rgba)), n = e.h, o = e.s, i = e.l, (r = e.a) < 1 ? "hsla(" + n + ", " + o + "%, " + i + "%, " + r + ")" : "hsl(" + n + ", " + o + "%, " + i + "%)";
|
|
434
434
|
var e, n, o, i, r;
|
|
435
435
|
}, t.prototype.toHsv = function() {
|
|
436
|
-
return e =
|
|
436
|
+
return e = Xt(this.rgba), { h: I(e.h), s: I(e.s), v: I(e.v), a: I(e.a, 3) };
|
|
437
437
|
var e;
|
|
438
438
|
}, t.prototype.invert = function() {
|
|
439
439
|
return Y({ r: 255 - (e = this.rgba).r, g: 255 - e.g, b: 255 - e.b, a: e.a });
|
|
@@ -445,30 +445,30 @@ var fe = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
|
445
445
|
}, t.prototype.grayscale = function() {
|
|
446
446
|
return Y(at(this.rgba, -1));
|
|
447
447
|
}, t.prototype.lighten = function(e) {
|
|
448
|
-
return e === void 0 && (e = 0.1), Y(
|
|
448
|
+
return e === void 0 && (e = 0.1), Y(Tt(this.rgba, e));
|
|
449
449
|
}, t.prototype.darken = function(e) {
|
|
450
|
-
return e === void 0 && (e = 0.1), Y(
|
|
450
|
+
return e === void 0 && (e = 0.1), Y(Tt(this.rgba, -e));
|
|
451
451
|
}, t.prototype.rotate = function(e) {
|
|
452
452
|
return e === void 0 && (e = 15), this.hue(this.hue() + e);
|
|
453
453
|
}, t.prototype.alpha = function(e) {
|
|
454
|
-
return typeof e == "number" ? Y({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) :
|
|
454
|
+
return typeof e == "number" ? Y({ r: (n = this.rgba).r, g: n.g, b: n.b, a: e }) : I(this.rgba.a, 3);
|
|
455
455
|
var n;
|
|
456
456
|
}, t.prototype.hue = function(e) {
|
|
457
457
|
var n = Q(this.rgba);
|
|
458
|
-
return typeof e == "number" ? Y({ h: e, s: n.s, l: n.l, a: n.a }) :
|
|
458
|
+
return typeof e == "number" ? Y({ h: e, s: n.s, l: n.l, a: n.a }) : I(n.h);
|
|
459
459
|
}, t.prototype.isEqual = function(e) {
|
|
460
460
|
return this.toHex() === Y(e).toHex();
|
|
461
461
|
}, t;
|
|
462
462
|
}(), Y = function(t) {
|
|
463
|
-
return t instanceof
|
|
463
|
+
return t instanceof Rt ? t : new Rt(t);
|
|
464
464
|
};
|
|
465
|
-
const
|
|
465
|
+
const Ee = (t) => [
|
|
466
466
|
`background-color:${Y((t == null ? void 0 : t.fill) || P.fill).alpha((t == null ? void 0 : t.fillOpacity) === void 0 ? P.fillOpacity : t.fillOpacity).toHex()}`,
|
|
467
467
|
t != null && t.underlineThickness ? "text-decoration:underline" : void 0,
|
|
468
468
|
t != null && t.underlineColor ? `text-decoration-color:${t.underlineColor}` : void 0,
|
|
469
469
|
t != null && t.underlineOffset ? `text-underline-offset:${t.underlineOffset}px` : void 0,
|
|
470
470
|
t != null && t.underlineThickness ? `text-decoration-thickness:${t.underlineThickness}px` : void 0
|
|
471
|
-
].filter(Boolean).join(";"),
|
|
471
|
+
].filter(Boolean).join(";"), Se = () => {
|
|
472
472
|
const t = document.createElement("style");
|
|
473
473
|
document.getElementsByTagName("head")[0].appendChild(t);
|
|
474
474
|
let e = /* @__PURE__ */ new Set();
|
|
@@ -484,20 +484,20 @@ const ye = (t) => [
|
|
|
484
484
|
const f = new Set(r.map((c) => c.annotation.id));
|
|
485
485
|
Array.from(e).filter((c) => !f.has(c));
|
|
486
486
|
const m = r.map((c) => {
|
|
487
|
-
var
|
|
488
|
-
const p = s ? typeof s == "function" ? s(c.annotation, c.state) : s : (
|
|
489
|
-
return `::highlight(_${c.annotation.id}) { ${
|
|
487
|
+
var w;
|
|
488
|
+
const p = s ? typeof s == "function" ? s(c.annotation, c.state) : s : (w = c.state) != null && w.selected ? ot : P, g = u && u.paint(c, a) || p;
|
|
489
|
+
return `::highlight(_${c.annotation.id}) { ${Ee(g)} }`;
|
|
490
490
|
});
|
|
491
491
|
t.innerHTML = m.join(`
|
|
492
492
|
`), CSS.highlights.clear(), r.forEach(({ annotation: c }) => {
|
|
493
|
-
const p = c.target.selector.map((
|
|
493
|
+
const p = c.target.selector.map((w) => w.range), g = new Highlight(...p);
|
|
494
494
|
CSS.highlights.set(`_${c.id}`, g);
|
|
495
495
|
}), e = f;
|
|
496
496
|
}
|
|
497
497
|
};
|
|
498
|
-
},
|
|
499
|
-
var
|
|
500
|
-
function
|
|
498
|
+
}, Ce = (t, e, n) => vt(t, e, n, Se());
|
|
499
|
+
var Nt = Object.prototype.hasOwnProperty;
|
|
500
|
+
function mt(t, e) {
|
|
501
501
|
var n, o;
|
|
502
502
|
if (t === e)
|
|
503
503
|
return !0;
|
|
@@ -508,24 +508,24 @@ function gt(t, e) {
|
|
|
508
508
|
return t.toString() === e.toString();
|
|
509
509
|
if (n === Array) {
|
|
510
510
|
if ((o = t.length) === e.length)
|
|
511
|
-
for (; o-- &&
|
|
511
|
+
for (; o-- && mt(t[o], e[o]); )
|
|
512
512
|
;
|
|
513
513
|
return o === -1;
|
|
514
514
|
}
|
|
515
515
|
if (!n || typeof t == "object") {
|
|
516
516
|
o = 0;
|
|
517
517
|
for (n in t)
|
|
518
|
-
if (
|
|
518
|
+
if (Nt.call(t, n) && ++o && !Nt.call(e, n) || !(n in e) || !mt(t[n], e[n]))
|
|
519
519
|
return !1;
|
|
520
520
|
return Object.keys(e).length === o;
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
return t !== t && e !== e;
|
|
524
524
|
}
|
|
525
|
-
const
|
|
525
|
+
const Le = (t, e) => {
|
|
526
526
|
const n = (o, i) => o.x <= i.x + i.width && o.x + o.width >= i.x && o.y <= i.y + i.height && o.y + o.height >= i.y;
|
|
527
527
|
return e.filter((o) => t !== o && n(t, o) && o.width > t.width).length;
|
|
528
|
-
},
|
|
528
|
+
}, Be = (t) => {
|
|
529
529
|
t.classList.add("r6o-annotatable");
|
|
530
530
|
const e = document.createElement("div");
|
|
531
531
|
e.className = "r6o-span-highlight-layer", t.insertBefore(e, t.firstChild);
|
|
@@ -535,17 +535,17 @@ const Ee = (t, e) => {
|
|
|
535
535
|
e.remove();
|
|
536
536
|
},
|
|
537
537
|
redraw: (a, s, u, f, m) => {
|
|
538
|
-
const p = !(
|
|
538
|
+
const p = !(mt(n, a) && m);
|
|
539
539
|
if (!f && !p)
|
|
540
540
|
return;
|
|
541
541
|
p && (e.innerHTML = "");
|
|
542
|
-
const g = a.reduce((
|
|
543
|
-
a.forEach((
|
|
544
|
-
|
|
545
|
-
const h =
|
|
542
|
+
const g = a.reduce((w, { rects: y }) => [...w, ...y], []);
|
|
543
|
+
a.forEach((w) => {
|
|
544
|
+
w.rects.map((y) => {
|
|
545
|
+
const h = Le(y, g), d = Kt(w, s, u, f, h);
|
|
546
546
|
if (p) {
|
|
547
547
|
const l = document.createElement("span");
|
|
548
|
-
l.className = "r6o-annotation", l.dataset.annotation =
|
|
548
|
+
l.className = "r6o-annotation", l.dataset.annotation = w.annotation.id, l.style.left = `${y.x}px`, l.style.top = `${y.y}px`, l.style.width = `${y.width}px`, l.style.height = `${y.height}px`;
|
|
549
549
|
const b = Y((d == null ? void 0 : d.fill) || P.fill).alpha((d == null ? void 0 : d.fillOpacity) === void 0 ? P.fillOpacity : d.fillOpacity).toHex();
|
|
550
550
|
l.style.backgroundColor = b, d.underlineStyle && (l.style.borderStyle = d.underlineStyle), d.underlineColor && (l.style.borderColor = d.underlineColor), d.underlineThickness && (l.style.borderBottomWidth = `${d.underlineThickness}px`), d.underlineOffset && (l.style.paddingBottom = `${d.underlineOffset}px`), e.appendChild(l);
|
|
551
551
|
}
|
|
@@ -556,31 +556,31 @@ const Ee = (t, e) => {
|
|
|
556
556
|
a ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
557
557
|
}
|
|
558
558
|
};
|
|
559
|
-
},
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
559
|
+
}, Te = (t, e, n) => vt(t, e, n, Be(t));
|
|
560
|
+
var V = [];
|
|
561
|
+
for (var lt = 0; lt < 256; ++lt)
|
|
562
|
+
V.push((lt + 256).toString(16).slice(1));
|
|
563
|
+
function Re(t, e = 0) {
|
|
564
|
+
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();
|
|
565
|
+
}
|
|
566
|
+
var Z, Ne = new Uint8Array(16);
|
|
567
|
+
function Me() {
|
|
563
568
|
if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z))
|
|
564
569
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
565
|
-
return Z(
|
|
570
|
+
return Z(Ne);
|
|
566
571
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
function Te(t, e = 0) {
|
|
571
|
-
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]];
|
|
572
|
-
}
|
|
573
|
-
const Re = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Rt = {
|
|
574
|
-
randomUUID: Re
|
|
572
|
+
var Oe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
573
|
+
const Mt = {
|
|
574
|
+
randomUUID: Oe
|
|
575
575
|
};
|
|
576
|
-
function
|
|
577
|
-
if (
|
|
578
|
-
return
|
|
576
|
+
function Ht(t, e, n) {
|
|
577
|
+
if (Mt.randomUUID && !e && !t)
|
|
578
|
+
return Mt.randomUUID();
|
|
579
579
|
t = t || {};
|
|
580
|
-
|
|
581
|
-
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128,
|
|
580
|
+
var o = t.random || (t.rng || Me)();
|
|
581
|
+
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Re(o);
|
|
582
582
|
}
|
|
583
|
-
var
|
|
583
|
+
var Ot = Object.prototype.hasOwnProperty;
|
|
584
584
|
function q(t, e) {
|
|
585
585
|
var n, o;
|
|
586
586
|
if (t === e)
|
|
@@ -599,24 +599,24 @@ function q(t, e) {
|
|
|
599
599
|
if (!n || typeof t == "object") {
|
|
600
600
|
o = 0;
|
|
601
601
|
for (n in t)
|
|
602
|
-
if (
|
|
602
|
+
if (Ot.call(t, n) && ++o && !Ot.call(e, n) || !(n in e) || !q(t[n], e[n]))
|
|
603
603
|
return !1;
|
|
604
604
|
return Object.keys(e).length === o;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
return t !== t && e !== e;
|
|
608
608
|
}
|
|
609
|
-
function
|
|
609
|
+
function dt() {
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function Ie(t, e) {
|
|
612
612
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
613
613
|
}
|
|
614
614
|
const z = [];
|
|
615
|
-
function
|
|
615
|
+
function yt(t, e = dt) {
|
|
616
616
|
let n;
|
|
617
617
|
const o = /* @__PURE__ */ new Set();
|
|
618
618
|
function i(s) {
|
|
619
|
-
if (
|
|
619
|
+
if (Ie(t, s) && (t = s, n)) {
|
|
620
620
|
const u = !z.length;
|
|
621
621
|
for (const f of o)
|
|
622
622
|
f[1](), z.push(f, t);
|
|
@@ -630,16 +630,16 @@ function bt(t, e = lt) {
|
|
|
630
630
|
function r(s) {
|
|
631
631
|
i(s(t));
|
|
632
632
|
}
|
|
633
|
-
function a(s, u =
|
|
633
|
+
function a(s, u = dt) {
|
|
634
634
|
const f = [s, u];
|
|
635
|
-
return o.add(f), o.size === 1 && (n = e(i, r) ||
|
|
635
|
+
return o.add(f), o.size === 1 && (n = e(i, r) || dt), s(t), () => {
|
|
636
636
|
o.delete(f), o.size === 0 && n && (n(), n = null);
|
|
637
637
|
};
|
|
638
638
|
}
|
|
639
639
|
return { set: i, update: r, subscribe: a };
|
|
640
640
|
}
|
|
641
|
-
const
|
|
642
|
-
const { subscribe: e, set: n } =
|
|
641
|
+
const Ve = (t) => {
|
|
642
|
+
const { subscribe: e, set: n } = yt();
|
|
643
643
|
let o;
|
|
644
644
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
645
645
|
if (o) {
|
|
@@ -655,12 +655,12 @@ const Oe = (t) => {
|
|
|
655
655
|
set: n
|
|
656
656
|
};
|
|
657
657
|
};
|
|
658
|
-
var
|
|
659
|
-
const
|
|
660
|
-
const { subscribe: n, set: o } =
|
|
661
|
-
let i =
|
|
658
|
+
var Ue = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(Ue || {});
|
|
659
|
+
const ut = { selected: [] }, ke = (t, e = "EDIT") => {
|
|
660
|
+
const { subscribe: n, set: o } = yt(ut);
|
|
661
|
+
let i = ut;
|
|
662
662
|
n((c) => i = c);
|
|
663
|
-
const r = () => o(
|
|
663
|
+
const r = () => o(ut), a = () => {
|
|
664
664
|
var c;
|
|
665
665
|
return ((c = i.selected) == null ? void 0 : c.length) === 0;
|
|
666
666
|
}, s = (c) => {
|
|
@@ -671,13 +671,18 @@ const dt = { selected: [] }, Me = (t, e = "EDIT") => {
|
|
|
671
671
|
}, u = (c, p) => {
|
|
672
672
|
const g = t.getAnnotation(c);
|
|
673
673
|
if (g) {
|
|
674
|
-
const
|
|
675
|
-
o(
|
|
674
|
+
const w = It(g, e);
|
|
675
|
+
o(w === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: p } : w === "SELECT" ? { selected: [{ id: c }], pointerEvent: p } : { selected: [], pointerEvent: p });
|
|
676
676
|
} else
|
|
677
677
|
console.warn("Invalid selection: " + c);
|
|
678
|
-
}, f = (c, p
|
|
679
|
-
const g = Array.isArray(c) ? c : [c],
|
|
680
|
-
o({
|
|
678
|
+
}, f = (c, p) => {
|
|
679
|
+
const g = Array.isArray(c) ? c : [c], w = g.map((y) => t.getAnnotation(y)).filter(Boolean);
|
|
680
|
+
o({
|
|
681
|
+
selected: w.map((y) => {
|
|
682
|
+
const h = p === void 0 ? It(y, e) === "EDIT" : p;
|
|
683
|
+
return { id: y.id, editable: h };
|
|
684
|
+
})
|
|
685
|
+
}), w.length !== g.length && console.warn("Invalid selection", c);
|
|
681
686
|
}, m = (c) => {
|
|
682
687
|
if (i.selected.length === 0)
|
|
683
688
|
return !1;
|
|
@@ -698,58 +703,58 @@ const dt = { selected: [] }, Me = (t, e = "EDIT") => {
|
|
|
698
703
|
setSelected: f,
|
|
699
704
|
subscribe: n
|
|
700
705
|
};
|
|
701
|
-
},
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
706
|
+
}, It = (t, e) => typeof e == "function" ? e(t) || "EDIT" : e || "EDIT";
|
|
707
|
+
var U = [];
|
|
708
|
+
for (var ht = 0; ht < 256; ++ht)
|
|
709
|
+
U.push((ht + 256).toString(16).slice(1));
|
|
710
|
+
function Ye(t, e = 0) {
|
|
711
|
+
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();
|
|
712
|
+
}
|
|
713
|
+
var tt, De = new Uint8Array(16);
|
|
714
|
+
function _e() {
|
|
705
715
|
if (!tt && (tt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !tt))
|
|
706
716
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
707
|
-
return tt(
|
|
717
|
+
return tt(De);
|
|
708
718
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
function Ye(t, e = 0) {
|
|
713
|
-
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]];
|
|
714
|
-
}
|
|
715
|
-
const _e = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ot = {
|
|
716
|
-
randomUUID: _e
|
|
719
|
+
var Xe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
720
|
+
const Vt = {
|
|
721
|
+
randomUUID: Xe
|
|
717
722
|
};
|
|
718
|
-
function
|
|
719
|
-
if (
|
|
720
|
-
return
|
|
723
|
+
function $e(t, e, n) {
|
|
724
|
+
if (Vt.randomUUID && !e && !t)
|
|
725
|
+
return Vt.randomUUID();
|
|
721
726
|
t = t || {};
|
|
722
|
-
|
|
727
|
+
var o = t.random || (t.rng || _e)();
|
|
723
728
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Ye(o);
|
|
724
729
|
}
|
|
725
|
-
const
|
|
726
|
-
id:
|
|
730
|
+
const Vn = (t, e, n, o) => ({
|
|
731
|
+
id: $e(),
|
|
727
732
|
annotation: t.id,
|
|
728
733
|
created: n || /* @__PURE__ */ new Date(),
|
|
729
734
|
creator: o,
|
|
730
735
|
...e
|
|
731
|
-
}),
|
|
736
|
+
}), He = (t, e) => {
|
|
732
737
|
const n = new Set(t.bodies.map((o) => o.id));
|
|
733
738
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
734
|
-
},
|
|
739
|
+
}, Pe = (t, e) => {
|
|
735
740
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
736
741
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
737
|
-
},
|
|
742
|
+
}, ze = (t, e) => e.bodies.map((n) => {
|
|
738
743
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
739
744
|
return { newBody: n, oldBody: o && !q(o, n) ? o : void 0 };
|
|
740
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })),
|
|
741
|
-
const n =
|
|
745
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), Fe = (t, e) => !q(t.target, e.target), Pt = (t, e) => {
|
|
746
|
+
const n = He(t, e), o = Pe(t, e), i = ze(t, e);
|
|
742
747
|
return {
|
|
743
748
|
oldValue: t,
|
|
744
749
|
newValue: e,
|
|
745
750
|
bodiesCreated: n.length > 0 ? n : void 0,
|
|
746
751
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
747
752
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
748
|
-
targetUpdated:
|
|
753
|
+
targetUpdated: Fe(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
749
754
|
};
|
|
750
755
|
};
|
|
751
756
|
var N = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(N || {});
|
|
752
|
-
const
|
|
757
|
+
const We = (t, e) => {
|
|
753
758
|
var n, o;
|
|
754
759
|
const { changes: i, origin: r } = e;
|
|
755
760
|
if (!(!t.options.origin || t.options.origin === r))
|
|
@@ -771,7 +776,7 @@ const ze = (t, e) => {
|
|
|
771
776
|
return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((s) => a.has(s));
|
|
772
777
|
} else
|
|
773
778
|
return !0;
|
|
774
|
-
},
|
|
779
|
+
}, qe = (t, e) => {
|
|
775
780
|
const n = new Set((t.created || []).map((c) => c.id)), o = new Set((t.updated || []).map(({ newValue: c }) => c.id)), i = new Set((e.created || []).map((c) => c.id)), r = new Set((e.deleted || []).map((c) => c.id)), a = new Set((e.updated || []).map(({ oldValue: c }) => c.id)), s = new Set((e.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), u = [
|
|
776
781
|
...(t.created || []).filter((c) => !r.has(c.id)).map((c) => a.has(c.id) ? e.updated.find(({ oldValue: p }) => p.id === c.id).newValue : c),
|
|
777
782
|
...e.created || []
|
|
@@ -782,15 +787,15 @@ const ze = (t, e) => {
|
|
|
782
787
|
...(t.updated || []).filter(({ newValue: c }) => !r.has(c.id)).map((c) => {
|
|
783
788
|
const { oldValue: p, newValue: g } = c;
|
|
784
789
|
if (a.has(g.id)) {
|
|
785
|
-
const
|
|
786
|
-
return
|
|
790
|
+
const w = e.updated.find((y) => y.oldValue.id === g.id).newValue;
|
|
791
|
+
return Pt(p, w);
|
|
787
792
|
} else
|
|
788
793
|
return c;
|
|
789
794
|
}),
|
|
790
795
|
...(e.updated || []).filter(({ oldValue: c }) => !s.has(c.id))
|
|
791
796
|
];
|
|
792
797
|
return { created: u, deleted: f, updated: m };
|
|
793
|
-
},
|
|
798
|
+
}, je = (t) => t.id !== void 0, Ge = () => {
|
|
794
799
|
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (v, x = {}) => n.push({ onChange: v, options: x }), i = (v) => {
|
|
795
800
|
const x = n.findIndex((A) => A.onChange == v);
|
|
796
801
|
x > -1 && n.splice(x, 1);
|
|
@@ -805,7 +810,7 @@ const ze = (t, e) => {
|
|
|
805
810
|
state: [...t.values()]
|
|
806
811
|
};
|
|
807
812
|
n.forEach((E) => {
|
|
808
|
-
|
|
813
|
+
We(E, A) && E.onChange(A);
|
|
809
814
|
});
|
|
810
815
|
}, a = (v, x = N.LOCAL) => {
|
|
811
816
|
if (t.get(v.id))
|
|
@@ -814,17 +819,17 @@ const ze = (t, e) => {
|
|
|
814
819
|
}, s = (v, x) => {
|
|
815
820
|
const A = typeof v == "string" ? x : v, E = typeof v == "string" ? v : v.id, R = t.get(E);
|
|
816
821
|
if (R) {
|
|
817
|
-
const
|
|
818
|
-
return E === A.id ? t.set(E, A) : (t.delete(E), t.set(A.id, A)), R.bodies.forEach((H) => e.delete(H.id)), A.bodies.forEach((H) => e.set(H.id, A.id)),
|
|
822
|
+
const M = Pt(R, A);
|
|
823
|
+
return E === A.id ? t.set(E, A) : (t.delete(E), t.set(A.id, A)), R.bodies.forEach((H) => e.delete(H.id)), A.bodies.forEach((H) => e.set(H.id, A.id)), M;
|
|
819
824
|
} else
|
|
820
825
|
console.warn(`Cannot update annotation ${E} - does not exist`);
|
|
821
826
|
}, u = (v, x = N.LOCAL, A = N.LOCAL) => {
|
|
822
|
-
const E =
|
|
827
|
+
const E = je(x) ? A : x, R = s(v, x);
|
|
823
828
|
R && r(E, { updated: [R] });
|
|
824
829
|
}, f = (v, x = N.LOCAL) => {
|
|
825
830
|
const A = v.reduce((E, R) => {
|
|
826
|
-
const
|
|
827
|
-
return
|
|
831
|
+
const M = s(R);
|
|
832
|
+
return M ? [...E, M] : E;
|
|
828
833
|
}, []);
|
|
829
834
|
A.length > 0 && r(x, { updated: A });
|
|
830
835
|
}, m = (v, x = N.LOCAL) => {
|
|
@@ -848,31 +853,31 @@ const ze = (t, e) => {
|
|
|
848
853
|
if (x) {
|
|
849
854
|
const E = [...t.values()];
|
|
850
855
|
t.clear(), e.clear(), v.forEach((R) => {
|
|
851
|
-
t.set(R.id, R), R.bodies.forEach((
|
|
856
|
+
t.set(R.id, R), R.bodies.forEach((M) => e.set(M.id, R.id));
|
|
852
857
|
}), r(A, { created: v, deleted: E });
|
|
853
858
|
} else {
|
|
854
|
-
const E = v.reduce((R,
|
|
855
|
-
const H = t.get(
|
|
859
|
+
const E = v.reduce((R, M) => {
|
|
860
|
+
const H = t.get(M.id);
|
|
856
861
|
return H ? [...R, H] : R;
|
|
857
862
|
}, []);
|
|
858
863
|
if (E.length > 0)
|
|
859
864
|
throw Error(`Bulk insert would overwrite the following annotations: ${E.map((R) => R.id).join(", ")}`);
|
|
860
865
|
v.forEach((R) => {
|
|
861
|
-
t.set(R.id, R), R.bodies.forEach((
|
|
866
|
+
t.set(R.id, R), R.bodies.forEach((M) => e.set(M.id, R.id));
|
|
862
867
|
}), r(A, { created: v });
|
|
863
868
|
}
|
|
864
|
-
},
|
|
869
|
+
}, w = (v) => {
|
|
865
870
|
const x = typeof v == "string" ? v : v.id, A = t.get(x);
|
|
866
871
|
if (A)
|
|
867
872
|
return t.delete(x), A.bodies.forEach((E) => e.delete(E.id)), A;
|
|
868
873
|
console.warn(`Attempt to delete missing annotation: ${x}`);
|
|
869
|
-
},
|
|
870
|
-
const A =
|
|
874
|
+
}, y = (v, x = N.LOCAL) => {
|
|
875
|
+
const A = w(v);
|
|
871
876
|
A && r(x, { deleted: [A] });
|
|
872
877
|
}, h = (v, x = N.LOCAL) => {
|
|
873
878
|
const A = v.reduce((E, R) => {
|
|
874
|
-
const
|
|
875
|
-
return
|
|
879
|
+
const M = w(R);
|
|
880
|
+
return M ? [...E, M] : E;
|
|
876
881
|
}, []);
|
|
877
882
|
A.length > 0 && r(x, { deleted: A });
|
|
878
883
|
}, d = (v) => {
|
|
@@ -917,9 +922,9 @@ const ze = (t, e) => {
|
|
|
917
922
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
918
923
|
const A = t.get(v.annotation);
|
|
919
924
|
if (A) {
|
|
920
|
-
const E = A.bodies.find((
|
|
925
|
+
const E = A.bodies.find((M) => M.id === v.id), R = {
|
|
921
926
|
...A,
|
|
922
|
-
bodies: A.bodies.map((
|
|
927
|
+
bodies: A.bodies.map((M) => M.id === E.id ? x : M)
|
|
923
928
|
};
|
|
924
929
|
return t.set(A.id, R), E.id !== x.id && (e.delete(E.id), e.set(x.id, R.id)), {
|
|
925
930
|
oldValue: A,
|
|
@@ -934,7 +939,7 @@ const ze = (t, e) => {
|
|
|
934
939
|
}, T = (v, x = N.LOCAL) => {
|
|
935
940
|
const A = v.map((E) => C({ id: E.id, annotation: E.annotation }, E)).filter(Boolean);
|
|
936
941
|
r(x, { updated: A });
|
|
937
|
-
},
|
|
942
|
+
}, O = (v) => {
|
|
938
943
|
const x = t.get(v.annotation);
|
|
939
944
|
if (x) {
|
|
940
945
|
const A = {
|
|
@@ -965,11 +970,11 @@ const ze = (t, e) => {
|
|
|
965
970
|
bulkUpdateAnnotation: f,
|
|
966
971
|
bulkUpdateBodies: T,
|
|
967
972
|
bulkUpdateTargets: (v, x = N.LOCAL) => {
|
|
968
|
-
const A = v.map((E) =>
|
|
973
|
+
const A = v.map((E) => O(E)).filter(Boolean);
|
|
969
974
|
A.length > 0 && r(x, { updated: A });
|
|
970
975
|
},
|
|
971
976
|
clear: p,
|
|
972
|
-
deleteAnnotation:
|
|
977
|
+
deleteAnnotation: y,
|
|
973
978
|
deleteBody: l,
|
|
974
979
|
getAnnotation: S,
|
|
975
980
|
getBody: L,
|
|
@@ -978,12 +983,12 @@ const ze = (t, e) => {
|
|
|
978
983
|
updateAnnotation: u,
|
|
979
984
|
updateBody: B,
|
|
980
985
|
updateTarget: (v, x = N.LOCAL) => {
|
|
981
|
-
const A =
|
|
986
|
+
const A = O(v);
|
|
982
987
|
A && r(x, { updated: [A] });
|
|
983
988
|
}
|
|
984
989
|
};
|
|
985
990
|
};
|
|
986
|
-
let
|
|
991
|
+
let Ke = () => ({
|
|
987
992
|
emit(t, ...e) {
|
|
988
993
|
for (let n = 0, o = this.events[t] || [], i = o.length; n < i; n++)
|
|
989
994
|
o[n](...e);
|
|
@@ -997,61 +1002,61 @@ let je = () => ({
|
|
|
997
1002
|
};
|
|
998
1003
|
}
|
|
999
1004
|
});
|
|
1000
|
-
const
|
|
1001
|
-
const e =
|
|
1005
|
+
const Qe = 250, Je = (t) => {
|
|
1006
|
+
const e = Ke(), n = [];
|
|
1002
1007
|
let o = -1, i = !1, r = 0;
|
|
1003
1008
|
const a = (g) => {
|
|
1004
1009
|
if (!i) {
|
|
1005
|
-
const { changes:
|
|
1006
|
-
if (
|
|
1007
|
-
n.splice(o + 1), n.push(
|
|
1010
|
+
const { changes: w } = g, y = performance.now();
|
|
1011
|
+
if (y - r > Qe)
|
|
1012
|
+
n.splice(o + 1), n.push(w), o = n.length - 1;
|
|
1008
1013
|
else {
|
|
1009
1014
|
const h = n.length - 1;
|
|
1010
|
-
n[h] =
|
|
1015
|
+
n[h] = qe(n[h], w);
|
|
1011
1016
|
}
|
|
1012
|
-
r =
|
|
1017
|
+
r = y;
|
|
1013
1018
|
}
|
|
1014
1019
|
i = !1;
|
|
1015
1020
|
};
|
|
1016
1021
|
t.observe(a, { origin: N.LOCAL });
|
|
1017
|
-
const s = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g), u = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), f = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ oldValue:
|
|
1022
|
+
const s = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g), u = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), f = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ oldValue: w }) => w)), m = (g) => g && g.length > 0 && t.bulkUpdateAnnotation(g.map(({ newValue: w }) => w)), c = (g) => g && g.length > 0 && t.bulkAddAnnotation(g, !1), p = (g) => g && g.length > 0 && t.bulkDeleteAnnotation(g);
|
|
1018
1023
|
return {
|
|
1019
1024
|
canRedo: () => n.length - 1 > o,
|
|
1020
1025
|
canUndo: () => o > -1,
|
|
1021
1026
|
destroy: () => t.unobserve(a),
|
|
1022
|
-
on: (g,
|
|
1027
|
+
on: (g, w) => e.on(g, w),
|
|
1023
1028
|
redo: () => {
|
|
1024
1029
|
if (n.length - 1 > o) {
|
|
1025
1030
|
i = !0;
|
|
1026
|
-
const { created: g, updated:
|
|
1027
|
-
u(g), m(
|
|
1031
|
+
const { created: g, updated: w, deleted: y } = n[o + 1];
|
|
1032
|
+
u(g), m(w), p(y), e.emit("redo", n[o + 1]), o += 1;
|
|
1028
1033
|
}
|
|
1029
1034
|
},
|
|
1030
1035
|
undo: () => {
|
|
1031
1036
|
if (o > -1) {
|
|
1032
1037
|
i = !0;
|
|
1033
|
-
const { created: g, updated:
|
|
1034
|
-
s(g), f(
|
|
1038
|
+
const { created: g, updated: w, deleted: y } = n[o];
|
|
1039
|
+
s(g), f(w), c(y), e.emit("undo", n[o]), o -= 1;
|
|
1035
1040
|
}
|
|
1036
1041
|
}
|
|
1037
1042
|
};
|
|
1038
|
-
},
|
|
1039
|
-
const { subscribe: t, set: e } =
|
|
1043
|
+
}, Ze = () => {
|
|
1044
|
+
const { subscribe: t, set: e } = yt([]);
|
|
1040
1045
|
return {
|
|
1041
1046
|
subscribe: t,
|
|
1042
1047
|
set: e
|
|
1043
1048
|
};
|
|
1044
|
-
},
|
|
1049
|
+
}, tn = (t, e, n, o) => {
|
|
1045
1050
|
const { store: i, selection: r, hover: a, viewport: s } = t, u = /* @__PURE__ */ new Map();
|
|
1046
1051
|
let f = [], m;
|
|
1047
|
-
const c = (
|
|
1048
|
-
u.has(
|
|
1049
|
-
}, p = (
|
|
1050
|
-
const d = u.get(
|
|
1052
|
+
const c = (y, h) => {
|
|
1053
|
+
u.has(y) ? u.get(y).push(h) : u.set(y, [h]);
|
|
1054
|
+
}, p = (y, h) => {
|
|
1055
|
+
const d = u.get(y);
|
|
1051
1056
|
d && d.indexOf(h) > 0 && d.splice(d.indexOf(h), 1);
|
|
1052
|
-
}, g = (
|
|
1053
|
-
u.has(
|
|
1054
|
-
u.get(
|
|
1057
|
+
}, g = (y, h, d) => {
|
|
1058
|
+
u.has(y) && setTimeout(() => {
|
|
1059
|
+
u.get(y).forEach((l) => {
|
|
1055
1060
|
if (n) {
|
|
1056
1061
|
const b = Array.isArray(h) ? h.map((L) => n.serialize(L)) : n.serialize(h), S = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;
|
|
1057
1062
|
l(b, S);
|
|
@@ -1060,17 +1065,17 @@ const Ge = 250, Ke = (t) => {
|
|
|
1060
1065
|
});
|
|
1061
1066
|
}, 1);
|
|
1062
1067
|
};
|
|
1063
|
-
r.subscribe(({ selected:
|
|
1064
|
-
if (!(f.length === 0 &&
|
|
1065
|
-
if (f.length === 0 &&
|
|
1066
|
-
f =
|
|
1067
|
-
else if (f.length > 0 &&
|
|
1068
|
+
r.subscribe(({ selected: y }) => {
|
|
1069
|
+
if (!(f.length === 0 && y.length === 0)) {
|
|
1070
|
+
if (f.length === 0 && y.length > 0)
|
|
1071
|
+
f = y.map(({ id: h }) => i.getAnnotation(h));
|
|
1072
|
+
else if (f.length > 0 && y.length === 0)
|
|
1068
1073
|
f.forEach((h) => {
|
|
1069
1074
|
const d = i.getAnnotation(h.id);
|
|
1070
1075
|
d && !q(d, h) && g("updateAnnotation", d, h);
|
|
1071
1076
|
}), f = [];
|
|
1072
1077
|
else {
|
|
1073
|
-
const h = new Set(f.map((l) => l.id)), d = new Set(
|
|
1078
|
+
const h = new Set(f.map((l) => l.id)), d = new Set(y.map(({ id: l }) => l));
|
|
1074
1079
|
f.filter((l) => !d.has(l.id)).forEach((l) => {
|
|
1075
1080
|
const b = i.getAnnotation(l.id);
|
|
1076
1081
|
b && !q(b, l) && g("updateAnnotation", b, l);
|
|
@@ -1078,16 +1083,16 @@ const Ge = 250, Ke = (t) => {
|
|
|
1078
1083
|
// Remove annotations that were deselected
|
|
1079
1084
|
...f.filter((l) => d.has(l.id)),
|
|
1080
1085
|
// Add editable annotations that were selected
|
|
1081
|
-
...
|
|
1086
|
+
...y.filter(({ id: l }) => !h.has(l)).map(({ id: l }) => i.getAnnotation(l))
|
|
1082
1087
|
];
|
|
1083
1088
|
}
|
|
1084
1089
|
g("selectionChanged", f);
|
|
1085
1090
|
}
|
|
1086
|
-
}), a.subscribe((
|
|
1087
|
-
!m &&
|
|
1088
|
-
}), s == null || s.subscribe((
|
|
1089
|
-
const { created: h, deleted: d } =
|
|
1090
|
-
(h || []).forEach((l) => g("createAnnotation", l)), (d || []).forEach((l) => g("deleteAnnotation", l)), (
|
|
1091
|
+
}), a.subscribe((y) => {
|
|
1092
|
+
!m && y ? g("mouseEnterAnnotation", i.getAnnotation(y)) : m && !y ? g("mouseLeaveAnnotation", i.getAnnotation(m)) : m && y && (g("mouseLeaveAnnotation", i.getAnnotation(m)), g("mouseEnterAnnotation", i.getAnnotation(y))), m = y;
|
|
1093
|
+
}), s == null || s.subscribe((y) => g("viewportIntersect", y.map((h) => i.getAnnotation(h)))), i.observe((y) => {
|
|
1094
|
+
const { created: h, deleted: d } = y.changes;
|
|
1095
|
+
(h || []).forEach((l) => g("createAnnotation", l)), (d || []).forEach((l) => g("deleteAnnotation", l)), (y.changes.updated || []).filter((l) => [
|
|
1091
1096
|
...l.bodiesCreated || [],
|
|
1092
1097
|
...l.bodiesDeleted || [],
|
|
1093
1098
|
...l.bodiesUpdated || []
|
|
@@ -1095,18 +1100,18 @@ const Ge = 250, Ke = (t) => {
|
|
|
1095
1100
|
const S = f.find((L) => L.id === l.id) || l;
|
|
1096
1101
|
f = f.map((L) => L.id === l.id ? b : L), g("updateAnnotation", b, S);
|
|
1097
1102
|
});
|
|
1098
|
-
}, { origin: N.LOCAL }), i.observe((
|
|
1103
|
+
}, { origin: N.LOCAL }), i.observe((y) => {
|
|
1099
1104
|
if (f) {
|
|
1100
|
-
const h = new Set(f.map((l) => l.id)), d = (
|
|
1105
|
+
const h = new Set(f.map((l) => l.id)), d = (y.changes.updated || []).filter(({ newValue: l }) => h.has(l.id)).map(({ newValue: l }) => l);
|
|
1101
1106
|
d.length > 0 && (f = f.map((l) => d.find((S) => S.id === l.id) || l));
|
|
1102
1107
|
}
|
|
1103
1108
|
}, { origin: N.REMOTE });
|
|
1104
|
-
const
|
|
1109
|
+
const w = (y) => (h) => {
|
|
1105
1110
|
const { updated: d } = h;
|
|
1106
|
-
|
|
1111
|
+
y ? (d || []).forEach((l) => g("updateAnnotation", l.oldValue, l.newValue)) : (d || []).forEach((l) => g("updateAnnotation", l.newValue, l.oldValue));
|
|
1107
1112
|
};
|
|
1108
|
-
return e.on("undo",
|
|
1109
|
-
},
|
|
1113
|
+
return e.on("undo", w(!0)), e.on("redo", w(!1)), { on: c, off: p, emit: g };
|
|
1114
|
+
}, en = (t) => (e) => e.reduce((n, o) => {
|
|
1110
1115
|
const { parsed: i, error: r } = t.parse(o);
|
|
1111
1116
|
return r ? {
|
|
1112
1117
|
parsed: n.parsed,
|
|
@@ -1117,7 +1122,7 @@ const Ge = 250, Ke = (t) => {
|
|
|
1117
1122
|
} : {
|
|
1118
1123
|
...n
|
|
1119
1124
|
};
|
|
1120
|
-
}, { parsed: [], failed: [] }),
|
|
1125
|
+
}, { parsed: [], failed: [] }), nn = (t, e, n) => {
|
|
1121
1126
|
const { store: o, selection: i } = t, r = (h) => {
|
|
1122
1127
|
if (n) {
|
|
1123
1128
|
const { parsed: d, error: l } = n.parse(h);
|
|
@@ -1143,13 +1148,13 @@ const Ge = 250, Ke = (t) => {
|
|
|
1143
1148
|
}
|
|
1144
1149
|
}, g = (h, d = !0) => {
|
|
1145
1150
|
if (n) {
|
|
1146
|
-
const { parsed: l, failed: b } =
|
|
1151
|
+
const { parsed: l, failed: b } = en(n)(h);
|
|
1147
1152
|
b.length > 0 && console.warn(`Discarded ${b.length} invalid annotations`, b), o.bulkAddAnnotation(l, d, N.REMOTE);
|
|
1148
1153
|
} else
|
|
1149
1154
|
o.bulkAddAnnotation(h, d, N.REMOTE);
|
|
1155
|
+
}, w = (h, d) => {
|
|
1156
|
+
h ? i.setSelected(h, d) : i.clear();
|
|
1150
1157
|
}, y = (h) => {
|
|
1151
|
-
h ? i.setSelected(h) : i.clear();
|
|
1152
|
-
}, w = (h) => {
|
|
1153
1158
|
if (n) {
|
|
1154
1159
|
const d = n.parse(h).parsed, l = n.serialize(o.getAnnotation(d.id));
|
|
1155
1160
|
return o.updateAnnotation(d), l;
|
|
@@ -1171,12 +1176,12 @@ const Ge = 250, Ke = (t) => {
|
|
|
1171
1176
|
redo: e.redo,
|
|
1172
1177
|
removeAnnotation: p,
|
|
1173
1178
|
setAnnotations: g,
|
|
1174
|
-
setSelected:
|
|
1179
|
+
setSelected: w,
|
|
1175
1180
|
undo: e.undo,
|
|
1176
|
-
updateAnnotation:
|
|
1181
|
+
updateAnnotation: y
|
|
1177
1182
|
};
|
|
1178
|
-
},
|
|
1179
|
-
let
|
|
1183
|
+
}, on = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
1184
|
+
let rn = (t) => crypto.getRandomValues(new Uint8Array(t)), sn = (t, e, n) => {
|
|
1180
1185
|
let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * e / t.length);
|
|
1181
1186
|
return (r = e) => {
|
|
1182
1187
|
let a = "";
|
|
@@ -1187,13 +1192,13 @@ let nn = (t) => crypto.getRandomValues(new Uint8Array(t)), on = (t, e, n) => {
|
|
|
1187
1192
|
return a;
|
|
1188
1193
|
}
|
|
1189
1194
|
};
|
|
1190
|
-
},
|
|
1195
|
+
}, an = (t, e = 21) => sn(t, e, rn), cn = (t = 21) => {
|
|
1191
1196
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t));
|
|
1192
1197
|
for (; t--; )
|
|
1193
|
-
e +=
|
|
1198
|
+
e += on[n[t] & 63];
|
|
1194
1199
|
return e;
|
|
1195
1200
|
};
|
|
1196
|
-
const
|
|
1201
|
+
const ln = () => ({ isGuest: !0, id: an("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), dn = (t) => {
|
|
1197
1202
|
const e = JSON.stringify(t);
|
|
1198
1203
|
let n = 0;
|
|
1199
1204
|
for (let o = 0, i = e.length; o < i; o++) {
|
|
@@ -1201,20 +1206,20 @@ const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1201
1206
|
n = (n << 5) - n + r, n |= 0;
|
|
1202
1207
|
}
|
|
1203
1208
|
return `${n}`;
|
|
1204
|
-
},
|
|
1209
|
+
}, zt = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, un = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1205
1210
|
const { id: o, type: i, purpose: r, value: a, created: s, modified: u, creator: f, ...m } = n;
|
|
1206
1211
|
return {
|
|
1207
|
-
id: o || `temp-${
|
|
1212
|
+
id: o || `temp-${dn(n)}`,
|
|
1208
1213
|
annotation: e,
|
|
1209
1214
|
type: i,
|
|
1210
1215
|
purpose: r,
|
|
1211
1216
|
value: a,
|
|
1212
|
-
creator:
|
|
1217
|
+
creator: zt(f),
|
|
1213
1218
|
created: s ? new Date(s) : void 0,
|
|
1214
1219
|
updated: u ? new Date(u) : void 0,
|
|
1215
1220
|
...m
|
|
1216
1221
|
};
|
|
1217
|
-
}),
|
|
1222
|
+
}), hn = (t) => t.map((e) => {
|
|
1218
1223
|
var n;
|
|
1219
1224
|
const { annotation: o, created: i, updated: r, ...a } = e, s = {
|
|
1220
1225
|
...a,
|
|
@@ -1223,11 +1228,11 @@ const an = () => ({ isGuest: !0, id: rn("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1223
1228
|
};
|
|
1224
1229
|
return (n = s.id) != null && n.startsWith("temp-") && delete s.id, s;
|
|
1225
1230
|
});
|
|
1226
|
-
|
|
1227
|
-
const
|
|
1228
|
-
parse: (n) =>
|
|
1229
|
-
serialize: (n) =>
|
|
1230
|
-
}),
|
|
1231
|
+
cn();
|
|
1232
|
+
const Un = (t, e) => ({
|
|
1233
|
+
parse: (n) => pn(n),
|
|
1234
|
+
serialize: (n) => mn(n, t, e)
|
|
1235
|
+
}), fn = (t) => t.quote !== void 0 && t.start !== void 0 && t.end !== void 0, gn = (t) => {
|
|
1231
1236
|
const {
|
|
1232
1237
|
id: e,
|
|
1233
1238
|
creator: n,
|
|
@@ -1238,7 +1243,7 @@ const Mn = (t, e) => ({
|
|
|
1238
1243
|
if (a.length === 0)
|
|
1239
1244
|
return { error: Error(`No targets found for annotation: ${t.id}`) };
|
|
1240
1245
|
const s = {
|
|
1241
|
-
creator:
|
|
1246
|
+
creator: zt(n),
|
|
1242
1247
|
created: o ? new Date(o) : void 0,
|
|
1243
1248
|
updated: i ? new Date(i) : void 0,
|
|
1244
1249
|
annotation: e,
|
|
@@ -1257,7 +1262,7 @@ const Mn = (t, e) => ({
|
|
|
1257
1262
|
}
|
|
1258
1263
|
return c;
|
|
1259
1264
|
}, {});
|
|
1260
|
-
if (
|
|
1265
|
+
if (fn(m))
|
|
1261
1266
|
s.selector.push({ id: u.id, ...m });
|
|
1262
1267
|
else {
|
|
1263
1268
|
const c = [
|
|
@@ -1268,14 +1273,14 @@ const Mn = (t, e) => ({
|
|
|
1268
1273
|
}
|
|
1269
1274
|
}
|
|
1270
1275
|
return { parsed: s };
|
|
1271
|
-
},
|
|
1272
|
-
const e = t.id ||
|
|
1276
|
+
}, pn = (t) => {
|
|
1277
|
+
const e = t.id || Ht(), {
|
|
1273
1278
|
creator: n,
|
|
1274
1279
|
created: o,
|
|
1275
1280
|
modified: i,
|
|
1276
1281
|
body: r,
|
|
1277
1282
|
...a
|
|
1278
|
-
} = t, s =
|
|
1283
|
+
} = t, s = un(r, e), u = gn(t);
|
|
1279
1284
|
return "error" in u ? { error: u.error } : {
|
|
1280
1285
|
parsed: {
|
|
1281
1286
|
...a,
|
|
@@ -1284,7 +1289,7 @@ const Mn = (t, e) => ({
|
|
|
1284
1289
|
target: u.parsed
|
|
1285
1290
|
}
|
|
1286
1291
|
};
|
|
1287
|
-
},
|
|
1292
|
+
}, mn = (t, e, n) => {
|
|
1288
1293
|
const { bodies: o, target: i, ...r } = t, {
|
|
1289
1294
|
selector: a,
|
|
1290
1295
|
creator: s,
|
|
@@ -1292,15 +1297,15 @@ const Mn = (t, e) => ({
|
|
|
1292
1297
|
updated: f,
|
|
1293
1298
|
...m
|
|
1294
1299
|
} = i, c = a.map((p) => {
|
|
1295
|
-
const { quote: g, start:
|
|
1300
|
+
const { quote: g, start: w, end: y, range: h } = p, { prefix: d, suffix: l } = oe(h, n), b = [{
|
|
1296
1301
|
type: "TextQuoteSelector",
|
|
1297
1302
|
exact: g,
|
|
1298
1303
|
prefix: d,
|
|
1299
1304
|
suffix: l
|
|
1300
1305
|
}, {
|
|
1301
1306
|
type: "TextPositionSelector",
|
|
1302
|
-
start:
|
|
1303
|
-
end:
|
|
1307
|
+
start: w,
|
|
1308
|
+
end: y
|
|
1304
1309
|
}];
|
|
1305
1310
|
return {
|
|
1306
1311
|
...m,
|
|
@@ -1314,40 +1319,40 @@ const Mn = (t, e) => ({
|
|
|
1314
1319
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1315
1320
|
id: t.id,
|
|
1316
1321
|
type: "Annotation",
|
|
1317
|
-
body:
|
|
1322
|
+
body: hn(t.bodies),
|
|
1318
1323
|
creator: s,
|
|
1319
1324
|
created: u == null ? void 0 : u.toISOString(),
|
|
1320
1325
|
modified: f == null ? void 0 : f.toISOString(),
|
|
1321
1326
|
target: c
|
|
1322
1327
|
};
|
|
1323
1328
|
};
|
|
1324
|
-
function
|
|
1325
|
-
|
|
1329
|
+
function bn(t, e, n, o, i) {
|
|
1330
|
+
Ft(t, e, n || 0, o || t.length - 1, i || vn);
|
|
1326
1331
|
}
|
|
1327
|
-
function
|
|
1332
|
+
function Ft(t, e, n, o, i) {
|
|
1328
1333
|
for (; o > n; ) {
|
|
1329
1334
|
if (o - n > 600) {
|
|
1330
1335
|
var r = o - n + 1, a = e - n + 1, s = Math.log(r), u = 0.5 * Math.exp(2 * s / 3), f = 0.5 * Math.sqrt(s * u * (r - u) / r) * (a - r / 2 < 0 ? -1 : 1), m = Math.max(n, Math.floor(e - a * u / r + f)), c = Math.min(o, Math.floor(e + (r - a) * u / r + f));
|
|
1331
|
-
|
|
1336
|
+
Ft(t, e, m, c, i);
|
|
1332
1337
|
}
|
|
1333
|
-
var p = t[e], g = n,
|
|
1334
|
-
for (j(t, n, e), i(t[o], p) > 0 && j(t, n, o); g <
|
|
1335
|
-
for (j(t, g,
|
|
1338
|
+
var p = t[e], g = n, w = o;
|
|
1339
|
+
for (j(t, n, e), i(t[o], p) > 0 && j(t, n, o); g < w; ) {
|
|
1340
|
+
for (j(t, g, w), g++, w--; i(t[g], p) < 0; )
|
|
1336
1341
|
g++;
|
|
1337
|
-
for (; i(t[
|
|
1338
|
-
|
|
1342
|
+
for (; i(t[w], p) > 0; )
|
|
1343
|
+
w--;
|
|
1339
1344
|
}
|
|
1340
|
-
i(t[n], p) === 0 ? j(t, n,
|
|
1345
|
+
i(t[n], p) === 0 ? j(t, n, w) : (w++, j(t, w, o)), w <= e && (n = w + 1), e <= w && (o = w - 1);
|
|
1341
1346
|
}
|
|
1342
1347
|
}
|
|
1343
1348
|
function j(t, e, n) {
|
|
1344
1349
|
var o = t[e];
|
|
1345
1350
|
t[e] = t[n], t[n] = o;
|
|
1346
1351
|
}
|
|
1347
|
-
function
|
|
1352
|
+
function vn(t, e) {
|
|
1348
1353
|
return t < e ? -1 : t > e ? 1 : 0;
|
|
1349
1354
|
}
|
|
1350
|
-
class
|
|
1355
|
+
class yn {
|
|
1351
1356
|
constructor(e = 9) {
|
|
1352
1357
|
this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
|
|
1353
1358
|
}
|
|
@@ -1363,7 +1368,7 @@ class bn {
|
|
|
1363
1368
|
for (; n; ) {
|
|
1364
1369
|
for (let a = 0; a < n.children.length; a++) {
|
|
1365
1370
|
const s = n.children[a], u = n.leaf ? i(s) : s;
|
|
1366
|
-
nt(e, u) && (n.leaf ? o.push(s) :
|
|
1371
|
+
nt(e, u) && (n.leaf ? o.push(s) : gt(e, u) ? this._all(s, o) : r.push(s));
|
|
1367
1372
|
}
|
|
1368
1373
|
n = r.pop();
|
|
1369
1374
|
}
|
|
@@ -1378,7 +1383,7 @@ class bn {
|
|
|
1378
1383
|
for (let i = 0; i < n.children.length; i++) {
|
|
1379
1384
|
const r = n.children[i], a = n.leaf ? this.toBBox(r) : r;
|
|
1380
1385
|
if (nt(e, a)) {
|
|
1381
|
-
if (n.leaf ||
|
|
1386
|
+
if (n.leaf || gt(e, a))
|
|
1382
1387
|
return !0;
|
|
1383
1388
|
o.push(r);
|
|
1384
1389
|
}
|
|
@@ -1423,11 +1428,11 @@ class bn {
|
|
|
1423
1428
|
let s, u, f;
|
|
1424
1429
|
for (; o || r.length; ) {
|
|
1425
1430
|
if (o || (o = r.pop(), u = r[r.length - 1], s = a.pop(), f = !0), o.leaf) {
|
|
1426
|
-
const m =
|
|
1431
|
+
const m = wn(e, o.children, n);
|
|
1427
1432
|
if (m !== -1)
|
|
1428
1433
|
return o.children.splice(m, 1), r.push(o), this._condense(r), this;
|
|
1429
1434
|
}
|
|
1430
|
-
!f && !o.leaf &&
|
|
1435
|
+
!f && !o.leaf && gt(o, i) ? (r.push(o), a.push(s), s = 0, u = o, o = o.children[0]) : u ? (s++, o = u.children[s], f = !1) : o = null;
|
|
1431
1436
|
}
|
|
1432
1437
|
return this;
|
|
1433
1438
|
}
|
|
@@ -1459,10 +1464,10 @@ class bn {
|
|
|
1459
1464
|
return s = W(e.slice(n, o + 1)), F(s, this.toBBox), s;
|
|
1460
1465
|
i || (i = Math.ceil(Math.log(r) / Math.log(a)), a = Math.ceil(r / Math.pow(a, i - 1))), s = W([]), s.leaf = !1, s.height = i;
|
|
1461
1466
|
const u = Math.ceil(r / a), f = u * Math.ceil(Math.sqrt(a));
|
|
1462
|
-
|
|
1467
|
+
Ut(e, n, o, f, this.compareMinX);
|
|
1463
1468
|
for (let m = n; m <= o; m += f) {
|
|
1464
1469
|
const c = Math.min(m + f - 1, o);
|
|
1465
|
-
|
|
1470
|
+
Ut(e, m, c, u, this.compareMinY);
|
|
1466
1471
|
for (let p = m; p <= c; p += u) {
|
|
1467
1472
|
const g = Math.min(p + u - 1, c);
|
|
1468
1473
|
s.children.push(this._build(e, p, g, i - 1));
|
|
@@ -1474,7 +1479,7 @@ class bn {
|
|
|
1474
1479
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1475
1480
|
let r = 1 / 0, a = 1 / 0, s;
|
|
1476
1481
|
for (let u = 0; u < n.children.length; u++) {
|
|
1477
|
-
const f = n.children[u], m =
|
|
1482
|
+
const f = n.children[u], m = ft(f), c = En(e, f) - m;
|
|
1478
1483
|
c < a ? (a = c, r = m < r ? m : r, s = f) : c === a && m < r && (r = m, s = f);
|
|
1479
1484
|
}
|
|
1480
1485
|
n = s || n.children[0];
|
|
@@ -1500,14 +1505,14 @@ class bn {
|
|
|
1500
1505
|
_chooseSplitIndex(e, n, o) {
|
|
1501
1506
|
let i, r = 1 / 0, a = 1 / 0;
|
|
1502
1507
|
for (let s = n; s <= o - n; s++) {
|
|
1503
|
-
const u = G(e, 0, s, this.toBBox), f = G(e, s, o, this.toBBox), m =
|
|
1508
|
+
const u = G(e, 0, s, this.toBBox), f = G(e, s, o, this.toBBox), m = Sn(u, f), c = ft(u) + ft(f);
|
|
1504
1509
|
m < r ? (r = m, i = s, a = c < a ? c : a) : m === r && c < a && (a = c, i = s);
|
|
1505
1510
|
}
|
|
1506
1511
|
return i || o - n;
|
|
1507
1512
|
}
|
|
1508
1513
|
// sorts node children by the best axis for split
|
|
1509
1514
|
_chooseSplitAxis(e, n, o) {
|
|
1510
|
-
const i = e.leaf ? this.compareMinX :
|
|
1515
|
+
const i = e.leaf ? this.compareMinX : xn, r = e.leaf ? this.compareMinY : An, a = this._allDistMargin(e, n, o, i), s = this._allDistMargin(e, n, o, r);
|
|
1511
1516
|
a < s && e.children.sort(i);
|
|
1512
1517
|
}
|
|
1513
1518
|
// total margin of all possible split distributions where each node is at least m full
|
|
@@ -1534,7 +1539,7 @@ class bn {
|
|
|
1534
1539
|
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : F(e[n], this.toBBox);
|
|
1535
1540
|
}
|
|
1536
1541
|
}
|
|
1537
|
-
function
|
|
1542
|
+
function wn(t, e, n) {
|
|
1538
1543
|
if (!n)
|
|
1539
1544
|
return e.indexOf(t);
|
|
1540
1545
|
for (let o = 0; o < e.length; o++)
|
|
@@ -1556,26 +1561,26 @@ function G(t, e, n, o, i) {
|
|
|
1556
1561
|
function K(t, e) {
|
|
1557
1562
|
return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
|
|
1558
1563
|
}
|
|
1559
|
-
function
|
|
1564
|
+
function xn(t, e) {
|
|
1560
1565
|
return t.minX - e.minX;
|
|
1561
1566
|
}
|
|
1562
|
-
function
|
|
1567
|
+
function An(t, e) {
|
|
1563
1568
|
return t.minY - e.minY;
|
|
1564
1569
|
}
|
|
1565
|
-
function
|
|
1570
|
+
function ft(t) {
|
|
1566
1571
|
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
1567
1572
|
}
|
|
1568
1573
|
function et(t) {
|
|
1569
1574
|
return t.maxX - t.minX + (t.maxY - t.minY);
|
|
1570
1575
|
}
|
|
1571
|
-
function
|
|
1576
|
+
function En(t, e) {
|
|
1572
1577
|
return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
|
|
1573
1578
|
}
|
|
1574
|
-
function
|
|
1579
|
+
function Sn(t, e) {
|
|
1575
1580
|
const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), i = Math.min(t.maxX, e.maxX), r = Math.min(t.maxY, e.maxY);
|
|
1576
1581
|
return Math.max(0, i - n) * Math.max(0, r - o);
|
|
1577
1582
|
}
|
|
1578
|
-
function
|
|
1583
|
+
function gt(t, e) {
|
|
1579
1584
|
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
1580
1585
|
}
|
|
1581
1586
|
function nt(t, e) {
|
|
@@ -1592,28 +1597,28 @@ function W(t) {
|
|
|
1592
1597
|
maxY: -1 / 0
|
|
1593
1598
|
};
|
|
1594
1599
|
}
|
|
1595
|
-
function
|
|
1600
|
+
function Ut(t, e, n, o, i) {
|
|
1596
1601
|
const r = [e, n];
|
|
1597
1602
|
for (; r.length; ) {
|
|
1598
1603
|
if (n = r.pop(), e = r.pop(), n - e <= o)
|
|
1599
1604
|
continue;
|
|
1600
1605
|
const a = e + Math.ceil((n - e) / o / 2) * o;
|
|
1601
|
-
|
|
1606
|
+
bn(t, a, e, n, i), r.push(e, a, a, n);
|
|
1602
1607
|
}
|
|
1603
1608
|
}
|
|
1604
|
-
const
|
|
1605
|
-
const n = new
|
|
1609
|
+
const Cn = (t, e) => {
|
|
1610
|
+
const n = new yn(), o = /* @__PURE__ */ new Map(), i = (d, l) => {
|
|
1606
1611
|
const b = d.selector.flatMap((L) => {
|
|
1607
|
-
const C = $([L]) ? L.range :
|
|
1612
|
+
const C = $([L]) ? L.range : Dt(L, e).range;
|
|
1608
1613
|
return Array.from(C.getClientRects());
|
|
1609
|
-
}), S =
|
|
1614
|
+
}), S = ce(b).map(({ left: L, top: C, right: B, bottom: T }) => new DOMRect(L - l.left, C - l.top, B - L, T - C));
|
|
1610
1615
|
return S.map((L) => {
|
|
1611
|
-
const { x: C, y: B, width: T, height:
|
|
1616
|
+
const { x: C, y: B, width: T, height: O } = L;
|
|
1612
1617
|
return {
|
|
1613
1618
|
minX: C,
|
|
1614
1619
|
minY: B,
|
|
1615
1620
|
maxX: C + T,
|
|
1616
|
-
maxY: B +
|
|
1621
|
+
maxY: B + O,
|
|
1617
1622
|
annotation: {
|
|
1618
1623
|
id: d.annotation,
|
|
1619
1624
|
rects: S
|
|
@@ -1679,40 +1684,40 @@ const En = (t, e) => {
|
|
|
1679
1684
|
size: () => n.all().length,
|
|
1680
1685
|
update: f
|
|
1681
1686
|
};
|
|
1682
|
-
},
|
|
1683
|
-
const n =
|
|
1684
|
-
const d = rt(
|
|
1687
|
+
}, Ln = (t, e) => {
|
|
1688
|
+
const n = Ge(), o = Cn(n, t), i = ke(n, e), r = Ve(n), a = Ze(), s = (y, h = N.LOCAL) => {
|
|
1689
|
+
const d = rt(y, t), l = $(d.target.selector);
|
|
1685
1690
|
return l && n.addAnnotation(d, h), l;
|
|
1686
|
-
}, u = (
|
|
1687
|
-
const l =
|
|
1691
|
+
}, u = (y, h = !0, d = N.LOCAL) => {
|
|
1692
|
+
const l = y.map((S) => rt(S, t)), b = l.filter((S) => !$(S.target.selector));
|
|
1688
1693
|
return b.length > 0 ? (console.warn("Could not revive all targets for these annotations:", b), n.bulkAddAnnotation(l, h, d), b) : (n.bulkAddAnnotation(l, h, d), []);
|
|
1689
|
-
}, f = (
|
|
1690
|
-
const d =
|
|
1694
|
+
}, f = (y, h = N.LOCAL) => {
|
|
1695
|
+
const d = y.map((b) => rt(b, t)), l = d.filter((b) => !$(b.target.selector));
|
|
1691
1696
|
return l.length > 0 && console.warn("Could not revive all targets for these annotations:", l), d.forEach((b) => {
|
|
1692
1697
|
n.getAnnotation(b.id) ? n.updateAnnotation(b, h) : n.addAnnotation(b, h);
|
|
1693
1698
|
}), l;
|
|
1694
|
-
}, m = (
|
|
1695
|
-
const d = it(
|
|
1699
|
+
}, m = (y, h = N.LOCAL) => {
|
|
1700
|
+
const d = it(y, t);
|
|
1696
1701
|
n.updateTarget(d, h);
|
|
1697
|
-
}, c = (
|
|
1698
|
-
const d =
|
|
1702
|
+
}, c = (y, h = N.LOCAL) => {
|
|
1703
|
+
const d = y.map((l) => it(l, t));
|
|
1699
1704
|
n.bulkUpdateTargets(d, h);
|
|
1700
|
-
}, p = (
|
|
1701
|
-
const d = o.getAt(
|
|
1705
|
+
}, p = (y, h) => {
|
|
1706
|
+
const d = o.getAt(y, h);
|
|
1702
1707
|
return d ? n.getAnnotation(d) : void 0;
|
|
1703
|
-
}, g = (
|
|
1704
|
-
const b = o.getAnnotationRects(
|
|
1708
|
+
}, g = (y, h, d, l = 5) => {
|
|
1709
|
+
const b = o.getAnnotationRects(y);
|
|
1705
1710
|
if (b.length !== 0) {
|
|
1706
1711
|
if (h && d) {
|
|
1707
1712
|
const S = b.find(({ top: L, right: C, bottom: B, left: T }) => h >= T - l && h <= C + l && d >= L - l && d <= B + l);
|
|
1708
1713
|
if (S)
|
|
1709
1714
|
return S;
|
|
1710
1715
|
}
|
|
1711
|
-
return o.getAnnotationBounds(
|
|
1716
|
+
return o.getAnnotationBounds(y);
|
|
1712
1717
|
}
|
|
1713
|
-
},
|
|
1714
|
-
return n.observe(({ changes:
|
|
1715
|
-
const h = (
|
|
1718
|
+
}, w = () => o.recalculate();
|
|
1719
|
+
return n.observe(({ changes: y }) => {
|
|
1720
|
+
const h = (y.created || []).filter((b) => $(b.target.selector)), d = (y.deleted || []).filter((b) => $(b.target.selector)), l = (y.updated || []).filter((b) => $(b.newValue.target.selector));
|
|
1716
1721
|
h.length > 0 && o.set(h.map((b) => b.target), !1), (d == null ? void 0 : d.length) > 0 && d.forEach((b) => o.remove(b.target)), (l == null ? void 0 : l.length) > 0 && l.forEach(({ newValue: b }) => o.update(b.target));
|
|
1717
1722
|
}), {
|
|
1718
1723
|
store: {
|
|
@@ -1724,24 +1729,24 @@ const En = (t, e) => {
|
|
|
1724
1729
|
getAnnotationBounds: g,
|
|
1725
1730
|
getAt: p,
|
|
1726
1731
|
getIntersecting: o.getIntersecting,
|
|
1727
|
-
recalculatePositions:
|
|
1732
|
+
recalculatePositions: w,
|
|
1728
1733
|
updateTarget: m
|
|
1729
1734
|
},
|
|
1730
1735
|
selection: i,
|
|
1731
1736
|
hover: r,
|
|
1732
1737
|
viewport: a
|
|
1733
1738
|
};
|
|
1734
|
-
},
|
|
1739
|
+
}, Bn = () => {
|
|
1735
1740
|
const t = document.createElement("canvas");
|
|
1736
1741
|
t.width = 2 * window.innerWidth, t.height = 2 * window.innerHeight, t.className = "r6o-highlight-layer presence";
|
|
1737
1742
|
const e = t.getContext("2d");
|
|
1738
1743
|
return e.scale(2, 2), e.translate(0.5, 0.5), t;
|
|
1739
|
-
},
|
|
1740
|
-
const o =
|
|
1744
|
+
}, Tn = (t, e, n = {}) => {
|
|
1745
|
+
const o = Bn(), i = o.getContext("2d");
|
|
1741
1746
|
t.appendChild(o);
|
|
1742
1747
|
const r = /* @__PURE__ */ new Map(), a = (c) => Array.from(r.entries()).filter(([p, g]) => g.presenceKey === c.presenceKey).map(([p, g]) => p);
|
|
1743
1748
|
return e.on("selectionChange", (c, p) => {
|
|
1744
|
-
a(c).forEach((
|
|
1749
|
+
a(c).forEach((w) => r.delete(w)), p && p.forEach((w) => r.set(w, c));
|
|
1745
1750
|
}), {
|
|
1746
1751
|
clear: () => {
|
|
1747
1752
|
const { width: c, height: p } = o;
|
|
@@ -1752,13 +1757,13 @@ const En = (t, e) => {
|
|
|
1752
1757
|
},
|
|
1753
1758
|
paint: (c, p, g) => {
|
|
1754
1759
|
n.font && (i.font = n.font);
|
|
1755
|
-
const
|
|
1756
|
-
if (
|
|
1757
|
-
const { height:
|
|
1758
|
-
i.fillStyle =
|
|
1759
|
-
const l = i.measureText(
|
|
1760
|
-
return i.fillRect(h - 2, d - 2.5 - S, b, S), i.fillStyle = "#fff", i.fillText(
|
|
1761
|
-
fill:
|
|
1760
|
+
const w = r.get(c.annotation.id);
|
|
1761
|
+
if (w) {
|
|
1762
|
+
const { height: y } = c.rects[0], h = c.rects[0].x + p.left, d = c.rects[0].y + p.top;
|
|
1763
|
+
i.fillStyle = w.appearance.color, i.fillRect(h - 2, d - 2.5, 2, y + 5);
|
|
1764
|
+
const l = i.measureText(w.appearance.label), b = l.width + 6, S = l.actualBoundingBoxAscent + l.actualBoundingBoxDescent + 8, L = l.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1765
|
+
return i.fillRect(h - 2, d - 2.5 - S, b, S), i.fillStyle = "#fff", i.fillText(w.appearance.label, h + 1, d - L), {
|
|
1766
|
+
fill: w.appearance.color,
|
|
1762
1767
|
fillOpacity: g ? 0.45 : 0.18
|
|
1763
1768
|
};
|
|
1764
1769
|
}
|
|
@@ -1769,32 +1774,32 @@ const En = (t, e) => {
|
|
|
1769
1774
|
c.scale(2, 2), c.translate(0.5, 0.5);
|
|
1770
1775
|
}
|
|
1771
1776
|
};
|
|
1772
|
-
},
|
|
1777
|
+
}, Wt = (t) => {
|
|
1773
1778
|
if (t === null)
|
|
1774
1779
|
return document.scrollingElement;
|
|
1775
1780
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
1776
|
-
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t :
|
|
1777
|
-
},
|
|
1778
|
-
const o = (
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
},
|
|
1782
|
-
if (
|
|
1783
|
-
const
|
|
1784
|
-
if (
|
|
1785
|
-
return
|
|
1781
|
+
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : Wt(t.parentElement);
|
|
1782
|
+
}, Rn = (t, e) => (n) => {
|
|
1783
|
+
const o = typeof n == "string" ? n : n.id, i = (a) => {
|
|
1784
|
+
const s = r.getBoundingClientRect(), u = r.clientHeight, f = r.clientWidth, m = a.selector[0].range.getBoundingClientRect(), { width: c, height: p } = e.getAnnotationBounds(o), g = m.top - s.top, w = m.left - s.left, y = r.parentElement ? r.scrollTop : 0, h = r.parentElement ? r.scrollLeft : 0, d = g + y - (u - p) / 2, l = w + h - (f - c) / 2;
|
|
1785
|
+
r.scroll({ top: d, left: l, behavior: "smooth" });
|
|
1786
|
+
}, r = Wt(t);
|
|
1787
|
+
if (r) {
|
|
1788
|
+
const a = e.getAnnotation(o), { range: s } = a.target.selector[0];
|
|
1789
|
+
if (s && !s.collapsed)
|
|
1790
|
+
return i(a.target), !0;
|
|
1786
1791
|
{
|
|
1787
|
-
const
|
|
1788
|
-
if (
|
|
1789
|
-
return
|
|
1792
|
+
const u = it(a.target, t), { range: f } = u.selector[0];
|
|
1793
|
+
if (f && !f.collapsed)
|
|
1794
|
+
return i(u), !0;
|
|
1790
1795
|
}
|
|
1791
1796
|
}
|
|
1792
1797
|
return !1;
|
|
1793
|
-
},
|
|
1798
|
+
}, Nn = (t, e) => ({
|
|
1794
1799
|
...t,
|
|
1795
1800
|
annotationEnabled: t.annotationEnabled ?? e.annotationEnabled,
|
|
1796
1801
|
user: t.user || e.user
|
|
1797
|
-
}),
|
|
1802
|
+
}), Mn = (t, e, n, o) => {
|
|
1798
1803
|
const { store: i, selection: r } = e;
|
|
1799
1804
|
let a, s;
|
|
1800
1805
|
const u = (h) => a = h;
|
|
@@ -1803,33 +1808,33 @@ const En = (t, e) => {
|
|
|
1803
1808
|
var l;
|
|
1804
1809
|
if (!f)
|
|
1805
1810
|
return;
|
|
1806
|
-
!((l = h.target.parentElement) != null && l.closest(
|
|
1807
|
-
annotation:
|
|
1811
|
+
!((l = h.target.parentElement) != null && l.closest(D)) ? s = {
|
|
1812
|
+
annotation: Ht(),
|
|
1808
1813
|
selector: [],
|
|
1809
1814
|
creator: a,
|
|
1810
1815
|
created: /* @__PURE__ */ new Date()
|
|
1811
1816
|
} : s = void 0;
|
|
1812
1817
|
};
|
|
1813
1818
|
n && t.addEventListener("selectstart", c);
|
|
1814
|
-
const p =
|
|
1819
|
+
const p = bt((h) => {
|
|
1815
1820
|
var C, B;
|
|
1816
1821
|
const d = document.getSelection();
|
|
1817
|
-
if (!!((B = (C = d.anchorNode) == null ? void 0 : C.parentElement) != null && B.closest(
|
|
1822
|
+
if (!!((B = (C = d.anchorNode) == null ? void 0 : C.parentElement) != null && B.closest(D))) {
|
|
1818
1823
|
s = void 0;
|
|
1819
1824
|
return;
|
|
1820
1825
|
}
|
|
1821
1826
|
if (h.timeStamp - ((m == null ? void 0 : m.timeStamp) || h.timeStamp) < 1e3 && !s && c(m), d.isCollapsed || !f || !s)
|
|
1822
1827
|
return;
|
|
1823
1828
|
const b = d.getRangeAt(0);
|
|
1824
|
-
if (
|
|
1829
|
+
if (re(b))
|
|
1825
1830
|
return;
|
|
1826
|
-
const S =
|
|
1827
|
-
(S.length !== s.selector.length || S.some((T,
|
|
1831
|
+
const S = Zt(b.cloneRange());
|
|
1832
|
+
(S.length !== s.selector.length || S.some((T, O) => {
|
|
1828
1833
|
var v;
|
|
1829
|
-
return T.toString() !== ((v = s.selector[
|
|
1834
|
+
return T.toString() !== ((v = s.selector[O]) == null ? void 0 : v.quote);
|
|
1830
1835
|
})) && (s = {
|
|
1831
1836
|
...s,
|
|
1832
|
-
selector: S.map((T) =>
|
|
1837
|
+
selector: S.map((T) => le(T, t, o)),
|
|
1833
1838
|
updated: /* @__PURE__ */ new Date()
|
|
1834
1839
|
}, i.getAnnotation(s.annotation) ? i.updateTarget(s, N.LOCAL) : (i.addAnnotation({
|
|
1835
1840
|
id: s.annotation,
|
|
@@ -1843,9 +1848,9 @@ const En = (t, e) => {
|
|
|
1843
1848
|
m = { ...h, target: d, timeStamp: l, offsetX: b, offsetY: S, type: L }, f = h.button === 0;
|
|
1844
1849
|
};
|
|
1845
1850
|
t.addEventListener("pointerdown", g);
|
|
1846
|
-
const
|
|
1851
|
+
const w = (h) => {
|
|
1847
1852
|
var S;
|
|
1848
|
-
if (!!((S = h.target.parentElement) != null && S.closest(
|
|
1853
|
+
if (!!((S = h.target.parentElement) != null && S.closest(D)) || !f)
|
|
1849
1854
|
return;
|
|
1850
1855
|
const l = () => {
|
|
1851
1856
|
const { x: L, y: C } = t.getBoundingClientRect(), B = i.getAt(h.clientX - L, h.clientY - C);
|
|
@@ -1857,29 +1862,29 @@ const En = (t, e) => {
|
|
|
1857
1862
|
}, b = h.timeStamp - m.timeStamp;
|
|
1858
1863
|
document.getSelection().isCollapsed && b < 300 ? (s = void 0, l()) : s && r.clickSelect(s.annotation, h);
|
|
1859
1864
|
};
|
|
1860
|
-
return document.addEventListener("pointerup",
|
|
1865
|
+
return document.addEventListener("pointerup", w), {
|
|
1861
1866
|
destroy: () => {
|
|
1862
|
-
t.removeEventListener("selectstart", c), document.removeEventListener("selectionchange", p), t.removeEventListener("pointerdown", g), document.removeEventListener("pointerup",
|
|
1867
|
+
t.removeEventListener("selectstart", c), document.removeEventListener("selectionchange", p), t.removeEventListener("pointerdown", g), document.removeEventListener("pointerup", w);
|
|
1863
1868
|
},
|
|
1864
1869
|
setUser: u
|
|
1865
1870
|
};
|
|
1866
|
-
},
|
|
1867
|
-
|
|
1868
|
-
const n =
|
|
1871
|
+
}, kt = "SPANS", kn = (t, e = {}) => {
|
|
1872
|
+
te(t);
|
|
1873
|
+
const n = Nn(e, {
|
|
1869
1874
|
annotationEnabled: !0,
|
|
1870
|
-
user:
|
|
1871
|
-
}), o =
|
|
1875
|
+
user: ln()
|
|
1876
|
+
}), o = Ln(t, n.pointerAction), { selection: i, viewport: r } = o, a = o.store, s = Je(a), u = tn(o, s, n.adapter);
|
|
1872
1877
|
let f = n.user;
|
|
1873
|
-
const m = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" :
|
|
1878
|
+
const m = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : kt : n.renderer || kt, c = m === "SPANS" ? Te(t, o, r) : m === "CSS_HIGHLIGHTS" ? Ce(t, o, r) : m === "CANVAS" ? pe(t, o, r) : void 0;
|
|
1874
1879
|
if (!c)
|
|
1875
1880
|
throw `Unknown renderer implementation: ${m}`;
|
|
1876
1881
|
console.debug(`Using ${m} renderer`), n.style && c.setStyle(n.style);
|
|
1877
|
-
const p =
|
|
1882
|
+
const p = Mn(t, o, n.annotationEnabled, n.offsetReferenceSelector);
|
|
1878
1883
|
p.setUser(f);
|
|
1879
|
-
const g =
|
|
1884
|
+
const g = nn(o, s, n.adapter), w = () => f, y = (b) => {
|
|
1880
1885
|
f = b, p.setUser(b);
|
|
1881
1886
|
}, h = (b) => {
|
|
1882
|
-
b && (c.setPainter(
|
|
1887
|
+
b && (c.setPainter(Tn(t, b, n.presence)), b.on("selectionChange", () => c.redraw()));
|
|
1883
1888
|
}, d = (b) => {
|
|
1884
1889
|
b ? i.setSelected(b) : i.clear();
|
|
1885
1890
|
};
|
|
@@ -1889,53 +1894,53 @@ const En = (t, e) => {
|
|
|
1889
1894
|
c.destroy(), p.destroy(), s.destroy();
|
|
1890
1895
|
},
|
|
1891
1896
|
element: t,
|
|
1892
|
-
getUser:
|
|
1897
|
+
getUser: w,
|
|
1893
1898
|
setFilter: c.setFilter.bind(c),
|
|
1894
1899
|
setStyle: c.setStyle.bind(c),
|
|
1895
1900
|
redraw: c.redraw.bind(c),
|
|
1896
|
-
setUser:
|
|
1901
|
+
setUser: y,
|
|
1897
1902
|
setSelected: d,
|
|
1898
1903
|
setPresenceProvider: h,
|
|
1899
1904
|
setVisible: c.setVisible.bind(c),
|
|
1900
1905
|
on: u.on,
|
|
1901
1906
|
off: u.off,
|
|
1902
|
-
scrollIntoView:
|
|
1907
|
+
scrollIntoView: Rn(t, a),
|
|
1903
1908
|
state: o
|
|
1904
1909
|
};
|
|
1905
1910
|
};
|
|
1906
1911
|
export {
|
|
1907
1912
|
ot as DEFAULT_SELECTED_STYLE,
|
|
1908
1913
|
P as DEFAULT_STYLE,
|
|
1909
|
-
|
|
1910
|
-
|
|
1914
|
+
Yt as NOT_ANNOTATABLE_CLASS,
|
|
1915
|
+
D as NOT_ANNOTATABLE_SELECTOR,
|
|
1911
1916
|
N as Origin,
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1917
|
+
Ue as PointerSelectAction,
|
|
1918
|
+
Un as W3CTextFormat,
|
|
1919
|
+
te as cancelSingleClickEvents,
|
|
1920
|
+
Vn as createBody,
|
|
1921
|
+
pe as createCanvasRenderer,
|
|
1922
|
+
Ce as createHighlightsRenderer,
|
|
1923
|
+
Se as createRenderer,
|
|
1924
|
+
Te as createSpansRenderer,
|
|
1925
|
+
kn as createTextAnnotator,
|
|
1926
|
+
Ln as createTextAnnotatorState,
|
|
1927
|
+
bt as debounce,
|
|
1928
|
+
Nn as fillDefaults,
|
|
1929
|
+
On as getAnnotatableFragment,
|
|
1930
|
+
In as getClientRectsPonyfill,
|
|
1931
|
+
oe as getQuoteContext,
|
|
1932
|
+
pt as getRangeAnnotatableContents,
|
|
1928
1933
|
$ as isRevived,
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
+
re as isWhitespaceOrEmpty,
|
|
1935
|
+
ce as mergeClientRects,
|
|
1936
|
+
Kt as paint,
|
|
1937
|
+
pn as parseW3CTextAnnotation,
|
|
1938
|
+
le as rangeToSelector,
|
|
1934
1939
|
rt as reviveAnnotation,
|
|
1935
|
-
|
|
1940
|
+
Dt as reviveSelector,
|
|
1936
1941
|
it as reviveTarget,
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1942
|
+
mn as serializeW3CTextAnnotation,
|
|
1943
|
+
Zt as splitAnnotatableRanges,
|
|
1944
|
+
ie as whitespaceOrEmptyRegex
|
|
1940
1945
|
};
|
|
1941
1946
|
//# sourceMappingURL=text-annotator.es.js.map
|