@recogito/text-annotator 3.0.0-rc.31 → 3.0.0-rc.32
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.
|
@@ -5,8 +5,8 @@ const P = {
|
|
|
5
5
|
fill: "rgb(0, 128, 255)",
|
|
6
6
|
fillOpacity: 0.45
|
|
7
7
|
}, Kt = (t, e, n, o, i) => {
|
|
8
|
-
var
|
|
9
|
-
const r = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((
|
|
8
|
+
var s, a;
|
|
9
|
+
const r = n ? typeof n == "function" ? n(t.annotation, t.state, i) || ((s = t.state) != null && s.selected ? ot : P) : n : (a = t.state) != null && a.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;
|
|
@@ -71,31 +71,31 @@ const P = {
|
|
|
71
71
|
startOffset: o,
|
|
72
72
|
endContainer: i,
|
|
73
73
|
endOffset: r
|
|
74
|
-
} = t,
|
|
75
|
-
const
|
|
76
|
-
return l.nodeName === "CANVAS" ? l :
|
|
77
|
-
}),
|
|
74
|
+
} = t, s = Array.from(e.childNodes).map((l) => {
|
|
75
|
+
const g = l.cloneNode(!0);
|
|
76
|
+
return l.nodeName === "CANVAS" ? l : g;
|
|
77
|
+
}), a = wt(n, e), u = wt(i, e), h = () => {
|
|
78
78
|
const l = e;
|
|
79
|
-
l.replaceChildren(...
|
|
80
|
-
const
|
|
81
|
-
return t.setStart(
|
|
79
|
+
l.replaceChildren(...s);
|
|
80
|
+
const g = xt(a, l), f = xt(u, l);
|
|
81
|
+
return t.setStart(g, o), t.setEnd(f, r), t;
|
|
82
82
|
}, m = (l) => {
|
|
83
|
-
const
|
|
84
|
-
return l.surroundContents(
|
|
83
|
+
const g = document.createElement("SPAN");
|
|
84
|
+
return l.surroundContents(g), g;
|
|
85
85
|
};
|
|
86
86
|
if (n === i)
|
|
87
87
|
throw "Not implemented";
|
|
88
88
|
{
|
|
89
89
|
const l = document.createRange();
|
|
90
90
|
l.selectNodeContents(n), l.setStart(n, o);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
const
|
|
91
|
+
const g = m(l), f = document.createRange();
|
|
92
|
+
f.selectNode(i), f.setEnd(i, r);
|
|
93
|
+
const x = m(f), p = ne(t).reverse().map((d) => {
|
|
94
94
|
var y;
|
|
95
95
|
const c = document.createElement("SPAN");
|
|
96
96
|
return (y = d.parentNode) == null || y.insertBefore(c, d), c.appendChild(d), c;
|
|
97
97
|
});
|
|
98
|
-
return { unwrap:
|
|
98
|
+
return { unwrap: h, nodes: [g, ...p, x] };
|
|
99
99
|
}
|
|
100
100
|
}, ne = (t) => {
|
|
101
101
|
const {
|
|
@@ -103,30 +103,30 @@ const P = {
|
|
|
103
103
|
startContainer: n,
|
|
104
104
|
endContainer: o
|
|
105
105
|
} = t, i = document.createNodeIterator(e, NodeFilter.SHOW_TEXT);
|
|
106
|
-
let r = i.nextNode(),
|
|
107
|
-
const
|
|
106
|
+
let r = i.nextNode(), s = !1;
|
|
107
|
+
const a = [];
|
|
108
108
|
for (; r != null; )
|
|
109
|
-
r === o && (
|
|
110
|
-
return
|
|
109
|
+
r === o && (s = !1), s && a.push(r), r === n && (s = !0), r = i.nextNode();
|
|
110
|
+
return a;
|
|
111
111
|
}, In = (t) => {
|
|
112
112
|
const { startContainer: e, endContainer: n } = t;
|
|
113
113
|
if (e === n)
|
|
114
114
|
return Array.from(t.getClientRects());
|
|
115
115
|
{
|
|
116
|
-
const { unwrap: o, nodes: i } = ee(t), r = i.reduce((
|
|
116
|
+
const { unwrap: o, nodes: i } = ee(t), r = i.reduce((s, a) => [...s, ...a.getClientRects()], []);
|
|
117
117
|
return o(), r;
|
|
118
118
|
}
|
|
119
119
|
}, oe = (t, e, n = 10, o) => {
|
|
120
120
|
const i = o ? t.startContainer.parentElement.closest(o) : e, r = document.createRange();
|
|
121
121
|
r.setStart(i, 0), r.setEnd(t.startContainer, t.startOffset);
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const u = pt(
|
|
122
|
+
const s = pt(r).textContent, a = document.createRange();
|
|
123
|
+
a.setStart(t.endContainer, t.endOffset), i === document.body ? a.setEnd(i, i.childNodes.length) : a.setEndAfter(i);
|
|
124
|
+
const u = pt(a).textContent;
|
|
125
125
|
return {
|
|
126
|
-
prefix:
|
|
126
|
+
prefix: s.substring(s.length - n),
|
|
127
127
|
suffix: u.substring(0, n)
|
|
128
128
|
};
|
|
129
|
-
}, ie = /^\s*$/, re = (t) => ie.test(t.toString()),
|
|
129
|
+
}, ie = /^\s*$/, re = (t) => ie.test(t.toString()), H = (t) => t.every((e) => e.range instanceof Range && !e.range.collapsed), se = (t, e) => {
|
|
130
130
|
const n = (r) => Math.round(r * 10) / 10, o = {
|
|
131
131
|
top: n(t.top),
|
|
132
132
|
bottom: n(t.bottom),
|
|
@@ -158,18 +158,18 @@ const P = {
|
|
|
158
158
|
return e;
|
|
159
159
|
let o = [...e], i = !1;
|
|
160
160
|
for (const r of e) {
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
o = o.map((
|
|
161
|
+
const s = se(n, r);
|
|
162
|
+
if (s === "inline-adjacent") {
|
|
163
|
+
o = o.map((a) => a === r ? ae(n, r) : a), i = !0;
|
|
164
164
|
break;
|
|
165
|
-
} else if (
|
|
166
|
-
o = o.map((
|
|
165
|
+
} else if (s === "inline-contains") {
|
|
166
|
+
o = o.map((a) => a === r ? n : a), i = !0;
|
|
167
167
|
break;
|
|
168
|
-
} else if (
|
|
168
|
+
} else if (s === "inline-is-contained") {
|
|
169
169
|
i = !0;
|
|
170
170
|
break;
|
|
171
|
-
} else if (
|
|
172
|
-
n.width < r.width && (o = o.map((
|
|
171
|
+
} else if (s === "block-contains" || s === "block-is-contained") {
|
|
172
|
+
n.width < r.width && (o = o.map((a) => a === r ? n : a)), i = !0;
|
|
173
173
|
break;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -177,52 +177,52 @@ const P = {
|
|
|
177
177
|
}, []), le = (t, e, n) => {
|
|
178
178
|
const o = document.createRange(), i = n ? t.startContainer.parentElement.closest(n) : e;
|
|
179
179
|
o.setStart(i, 0), o.setEnd(t.startContainer, t.startOffset);
|
|
180
|
-
const r = pt(o).textContent,
|
|
181
|
-
return n ? { quote:
|
|
180
|
+
const r = pt(o).textContent, s = t.toString(), a = r.length || 0, u = a + s.length;
|
|
181
|
+
return n ? { quote: s, start: a, end: u, range: t, offsetReference: i } : { quote: s, start: a, end: u, range: t };
|
|
182
182
|
}, Dt = (t, e) => {
|
|
183
183
|
var m, l;
|
|
184
184
|
const { start: n, end: o } = t, i = t.offsetReference || e, r = document.createNodeIterator(
|
|
185
185
|
e,
|
|
186
186
|
NodeFilter.SHOW_TEXT,
|
|
187
|
-
(
|
|
188
|
-
var
|
|
189
|
-
return (
|
|
187
|
+
(g) => {
|
|
188
|
+
var f;
|
|
189
|
+
return (f = g.parentElement) != null && f.closest(D) ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
190
190
|
}
|
|
191
191
|
);
|
|
192
|
-
let
|
|
193
|
-
const
|
|
192
|
+
let s = 0;
|
|
193
|
+
const a = document.createRange();
|
|
194
194
|
let u = r.nextNode();
|
|
195
195
|
u === null && console.error("Could not revive annotation target. Content missing.");
|
|
196
|
-
let
|
|
196
|
+
let h = !i;
|
|
197
197
|
for (; u !== null; ) {
|
|
198
|
-
if (
|
|
199
|
-
const
|
|
200
|
-
if (
|
|
201
|
-
|
|
198
|
+
if (h || (h = i == null ? void 0 : i.contains(u)), h) {
|
|
199
|
+
const g = ((m = u.textContent) == null ? void 0 : m.length) || 0;
|
|
200
|
+
if (s + g > n) {
|
|
201
|
+
a.setStart(u, n - s);
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
s += g;
|
|
205
205
|
}
|
|
206
206
|
u = r.nextNode();
|
|
207
207
|
}
|
|
208
208
|
for (; u !== null; ) {
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
|
|
209
|
+
const g = ((l = u.textContent) == null ? void 0 : l.length) || 0;
|
|
210
|
+
if (s + g >= o) {
|
|
211
|
+
a.setEnd(u, o - s);
|
|
212
212
|
break;
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
s += g, u = r.nextNode();
|
|
215
215
|
}
|
|
216
216
|
return {
|
|
217
217
|
...t,
|
|
218
|
-
range:
|
|
218
|
+
range: a
|
|
219
219
|
};
|
|
220
|
-
}, it = (t, e) =>
|
|
220
|
+
}, it = (t, e) => H(t.selector) ? t : {
|
|
221
221
|
...t,
|
|
222
222
|
selector: t.selector.map((n) => n.range instanceof Range && !n.range.collapsed ? n : Dt(n, e))
|
|
223
|
-
}, rt = (t, e) =>
|
|
224
|
-
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n,
|
|
225
|
-
return { top: e, left: n, minX: r, minY:
|
|
223
|
+
}, rt = (t, e) => H(t.target.selector) ? t : { ...t, target: it(t.target, e) }, de = (t) => {
|
|
224
|
+
const { top: e, left: n } = t.getBoundingClientRect(), { innerWidth: o, innerHeight: i } = window, r = -n, s = -e, a = o - n, u = i - e;
|
|
225
|
+
return { top: e, left: n, minX: r, minY: s, maxX: a, maxY: u };
|
|
226
226
|
}, ue = (t) => {
|
|
227
227
|
let e = /* @__PURE__ */ new Set();
|
|
228
228
|
return (o) => {
|
|
@@ -230,47 +230,47 @@ const P = {
|
|
|
230
230
|
(e.size !== i.length || i.some((r) => !e.has(r))) && t.set(i), e = new Set(i);
|
|
231
231
|
};
|
|
232
232
|
}, vt = (t, e, n, o) => {
|
|
233
|
-
const { store: i, selection: r, hover:
|
|
234
|
-
let
|
|
233
|
+
const { store: i, selection: r, hover: s } = e;
|
|
234
|
+
let a, u, h;
|
|
235
235
|
const m = ue(n), l = (T) => {
|
|
236
|
-
const { x:
|
|
237
|
-
|
|
236
|
+
const { x: M, y: b } = t.getBoundingClientRect(), w = i.getAt(T.clientX - M, T.clientY - b);
|
|
237
|
+
w && (!u || u(w)) ? s.current !== w.id && (t.classList.add("hovered"), s.set(w.id)) : s.current && (t.classList.remove("hovered"), s.set(null));
|
|
238
238
|
};
|
|
239
239
|
t.addEventListener("pointermove", l);
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
const jt =
|
|
240
|
+
const g = (T = !1) => {
|
|
241
|
+
h && h.clear();
|
|
242
|
+
const M = de(t), { minX: b, minY: w, maxX: A, maxY: S } = M, R = u ? i.getIntersecting(b, w, A, S).filter(({ annotation: _ }) => u(_)) : i.getIntersecting(b, w, A, S), O = r.selected.map(({ id: _ }) => _), $ = R.map(({ annotation: _, rects: qt }) => {
|
|
243
|
+
const jt = O.includes(_.id), Gt = _.id === s.current;
|
|
244
244
|
return { annotation: _, rects: qt, state: { selected: jt, hover: Gt } };
|
|
245
245
|
});
|
|
246
|
-
o.redraw(
|
|
247
|
-
},
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
|
|
246
|
+
o.redraw($, M, a, h, T), setTimeout(() => m(R.map(({ annotation: _ }) => _)), 1);
|
|
247
|
+
}, f = (T) => {
|
|
248
|
+
h = T, g();
|
|
249
|
+
}, x = (T) => {
|
|
250
|
+
a = T, g();
|
|
251
251
|
}, v = (T) => {
|
|
252
|
-
u = T,
|
|
253
|
-
},
|
|
254
|
-
i.observe(
|
|
255
|
-
const d = r.subscribe(() =>
|
|
252
|
+
u = T, g(!1);
|
|
253
|
+
}, p = () => g();
|
|
254
|
+
i.observe(p);
|
|
255
|
+
const d = r.subscribe(() => g()), c = () => g(!0);
|
|
256
256
|
document.addEventListener("scroll", c, { capture: !0, passive: !0 });
|
|
257
257
|
const y = bt(() => {
|
|
258
|
-
i.recalculatePositions(),
|
|
258
|
+
i.recalculatePositions(), h && h.reset(), g();
|
|
259
259
|
});
|
|
260
260
|
window.addEventListener("resize", y);
|
|
261
261
|
const C = new ResizeObserver(y);
|
|
262
262
|
C.observe(t);
|
|
263
263
|
const L = { attributes: !0, childList: !0, subtree: !0 }, E = new MutationObserver((T) => {
|
|
264
|
-
T.every((b) => b.target === t || t.contains(b.target)) ||
|
|
264
|
+
T.every((b) => b.target === t || t.contains(b.target)) || g(!0);
|
|
265
265
|
});
|
|
266
266
|
return E.observe(document.body, L), {
|
|
267
267
|
destroy: () => {
|
|
268
|
-
t.removeEventListener("pointermove", l), o.destroy(), i.unobserve(
|
|
268
|
+
t.removeEventListener("pointermove", l), o.destroy(), i.unobserve(p), d(), document.removeEventListener("scroll", c), window.removeEventListener("resize", y), C.disconnect(), E.disconnect();
|
|
269
269
|
},
|
|
270
|
-
redraw:
|
|
271
|
-
setStyle:
|
|
270
|
+
redraw: g,
|
|
271
|
+
setStyle: x,
|
|
272
272
|
setFilter: v,
|
|
273
|
-
setPainter:
|
|
273
|
+
setPainter: f,
|
|
274
274
|
setVisible: o.setVisible
|
|
275
275
|
};
|
|
276
276
|
}, he = () => {
|
|
@@ -282,35 +282,35 @@ const P = {
|
|
|
282
282
|
t.classList.add("r6o-annotatable");
|
|
283
283
|
const e = he(), n = e.getContext("2d");
|
|
284
284
|
t.insertBefore(e, t.firstChild);
|
|
285
|
-
const o = (
|
|
286
|
-
const { width: l, height:
|
|
287
|
-
n.clearRect(-0.5, -0.5, l + 1,
|
|
288
|
-
const { top:
|
|
289
|
-
[...
|
|
290
|
-
const { annotation: { target: { created: c } } } =
|
|
285
|
+
const o = (a, u, h, m) => requestAnimationFrame(() => {
|
|
286
|
+
const { width: l, height: g } = e;
|
|
287
|
+
n.clearRect(-0.5, -0.5, l + 1, g + 1), m && m.clear();
|
|
288
|
+
const { top: f, left: x } = u;
|
|
289
|
+
[...a].sort((p, d) => {
|
|
290
|
+
const { annotation: { target: { created: c } } } = p, { annotation: { target: { created: y } } } = d;
|
|
291
291
|
return c.getTime() - y.getTime();
|
|
292
|
-
}).forEach((
|
|
292
|
+
}).forEach((p) => {
|
|
293
293
|
var L;
|
|
294
|
-
const d =
|
|
295
|
-
x: E +
|
|
296
|
-
y: B +
|
|
294
|
+
const d = h ? typeof h == "function" ? h(p.annotation, p.state) : h : (L = p.state) != null && L.selected ? ot : P, c = m && m.paint(p, u) || d, y = p.rects.map(({ x: E, y: B, width: T, height: M }) => ({
|
|
295
|
+
x: E + x,
|
|
296
|
+
y: B + f,
|
|
297
297
|
width: T,
|
|
298
|
-
height:
|
|
298
|
+
height: M
|
|
299
299
|
}));
|
|
300
300
|
n.fillStyle = c.fill, n.globalAlpha = c.fillOpacity || 1;
|
|
301
301
|
const C = 5;
|
|
302
302
|
if (y.forEach(
|
|
303
|
-
({ x: E, y: B, width: T, height:
|
|
303
|
+
({ x: E, y: B, width: T, height: M }) => n.fillRect(
|
|
304
304
|
E,
|
|
305
305
|
B - C / 2,
|
|
306
306
|
T,
|
|
307
|
-
|
|
307
|
+
M + C
|
|
308
308
|
)
|
|
309
309
|
), c.underlineColor) {
|
|
310
310
|
n.globalAlpha = 1, n.strokeStyle = c.underlineColor, n.lineWidth = c.underlineThickness ?? 1;
|
|
311
311
|
const E = C / 2 + (c.underlineOffset ?? 0);
|
|
312
|
-
y.forEach(({ x: B, y: T, width:
|
|
313
|
-
n.beginPath(), n.moveTo(B, T + b + E), n.lineTo(B +
|
|
312
|
+
y.forEach(({ x: B, y: T, width: M, height: b }) => {
|
|
313
|
+
n.beginPath(), n.moveTo(B, T + b + E), n.lineTo(B + M, T + b + E), n.stroke();
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
});
|
|
@@ -321,7 +321,7 @@ const P = {
|
|
|
321
321
|
destroy: () => {
|
|
322
322
|
t.removeChild(e), window.removeEventListener("resize", i);
|
|
323
323
|
},
|
|
324
|
-
setVisible: (
|
|
324
|
+
setVisible: (a) => {
|
|
325
325
|
console.log("setVisible not implemented on Canvas renderer");
|
|
326
326
|
},
|
|
327
327
|
redraw: o
|
|
@@ -343,19 +343,19 @@ var me = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
|
343
343
|
var e = t.toString(16);
|
|
344
344
|
return e.length < 2 ? "0" + e : e;
|
|
345
345
|
}, Xt = function(t) {
|
|
346
|
-
var e = t.r, n = t.g, o = t.b, i = t.a, r = Math.max(e, n, o),
|
|
347
|
-
return { h: 60 * (
|
|
348
|
-
},
|
|
346
|
+
var e = t.r, n = t.g, o = t.b, i = t.a, r = Math.max(e, n, o), s = r - Math.min(e, n, o), a = s ? r === e ? (n - o) / s : r === n ? 2 + (o - e) / s : 4 + (e - n) / s : 0;
|
|
347
|
+
return { h: 60 * (a < 0 ? a + 6 : a), s: r ? s / r * 100 : 0, v: r / 255 * 100, a: i };
|
|
348
|
+
}, Ht = function(t) {
|
|
349
349
|
var e = t.h, n = t.s, o = t.v, i = t.a;
|
|
350
350
|
e = e / 360 * 6, n /= 100, o /= 100;
|
|
351
|
-
var r = Math.floor(e),
|
|
352
|
-
return { r: 255 * [o,
|
|
351
|
+
var r = Math.floor(e), s = o * (1 - n), a = o * (1 - (e - r) * n), u = o * (1 - (1 - e + r) * n), h = r % 6;
|
|
352
|
+
return { r: 255 * [o, a, s, s, u, o][h], g: 255 * [u, o, o, a, s, s][h], b: 255 * [s, s, u, o, o, a][h], a: i };
|
|
353
353
|
}, Et = function(t) {
|
|
354
354
|
return { h: _t(t.h), s: k(t.s, 0, 100), l: k(t.l, 0, 100), a: k(t.a) };
|
|
355
355
|
}, St = function(t) {
|
|
356
356
|
return { h: I(t.h), s: I(t.s), l: I(t.l), a: I(t.a, 3) };
|
|
357
357
|
}, Ct = function(t) {
|
|
358
|
-
return
|
|
358
|
+
return Ht((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 }));
|
|
359
359
|
var e, n, o;
|
|
360
360
|
}, Q = function(t) {
|
|
361
361
|
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 };
|
|
@@ -377,15 +377,15 @@ var me = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
|
377
377
|
}, "rgb"], [function(t) {
|
|
378
378
|
var e = t.h, n = t.s, o = t.l, i = t.a, r = i === void 0 ? 1 : i;
|
|
379
379
|
if (!X(e) || !X(n) || !X(o)) return null;
|
|
380
|
-
var
|
|
381
|
-
return Ct(
|
|
380
|
+
var s = Et({ h: Number(e), s: Number(n), l: Number(o), a: Number(r) });
|
|
381
|
+
return Ct(s);
|
|
382
382
|
}, "hsl"], [function(t) {
|
|
383
383
|
var e = t.h, n = t.s, o = t.v, i = t.a, r = i === void 0 ? 1 : i;
|
|
384
384
|
if (!X(e) || !X(n) || !X(o)) return null;
|
|
385
|
-
var
|
|
386
|
-
return { h: _t(
|
|
385
|
+
var s = function(a) {
|
|
386
|
+
return { h: _t(a.h), s: k(a.s, 0, 100), v: k(a.v, 0, 100), a: k(a.a) };
|
|
387
387
|
}({ h: Number(e), s: Number(n), v: Number(o), a: Number(r) });
|
|
388
|
-
return
|
|
388
|
+
return Ht(s);
|
|
389
389
|
}, "hsv"]] }, Bt = function(t, e) {
|
|
390
390
|
for (var n = 0; n < e.length; n++) {
|
|
391
391
|
var o = e[n][0](t);
|
|
@@ -415,8 +415,8 @@ var me = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, X = function(t) {
|
|
|
415
415
|
}, t.prototype.isLight = function() {
|
|
416
416
|
return ct(this.rgba) >= 0.5;
|
|
417
417
|
}, t.prototype.toHex = function() {
|
|
418
|
-
return e = st(this.rgba), n = e.r, o = e.g, i = e.b,
|
|
419
|
-
var e, n, o, i, r,
|
|
418
|
+
return e = st(this.rgba), n = e.r, o = e.g, i = e.b, s = (r = e.a) < 1 ? J(I(255 * r)) : "", "#" + J(n) + J(o) + J(i) + s;
|
|
419
|
+
var e, n, o, i, r, s;
|
|
420
420
|
}, t.prototype.toRgb = function() {
|
|
421
421
|
return st(this.rgba);
|
|
422
422
|
}, t.prototype.toRgbString = function() {
|
|
@@ -474,20 +474,20 @@ const Ee = (t) => [
|
|
|
474
474
|
setVisible: (r) => {
|
|
475
475
|
console.log("setVisible not implemented on CSS Custom Highlights renderer");
|
|
476
476
|
},
|
|
477
|
-
redraw: (r,
|
|
477
|
+
redraw: (r, s, a, u) => {
|
|
478
478
|
u && u.clear();
|
|
479
|
-
const
|
|
480
|
-
Array.from(e).filter((l) => !
|
|
479
|
+
const h = new Set(r.map((l) => l.annotation.id));
|
|
480
|
+
Array.from(e).filter((l) => !h.has(l));
|
|
481
481
|
const m = r.map((l) => {
|
|
482
|
-
var
|
|
483
|
-
const
|
|
484
|
-
return `::highlight(_${l.annotation.id}) { ${Ee(
|
|
482
|
+
var x;
|
|
483
|
+
const g = a ? typeof a == "function" ? a(l.annotation, l.state) : a : (x = l.state) != null && x.selected ? ot : P, f = u && u.paint(l, s) || g;
|
|
484
|
+
return `::highlight(_${l.annotation.id}) { ${Ee(f)} }`;
|
|
485
485
|
});
|
|
486
486
|
t.innerHTML = m.join(`
|
|
487
487
|
`), CSS.highlights.clear(), r.forEach(({ annotation: l }) => {
|
|
488
|
-
const
|
|
489
|
-
CSS.highlights.set(`_${l.id}`,
|
|
490
|
-
}), e =
|
|
488
|
+
const g = l.target.selector.map((x) => x.range), f = new Highlight(...g);
|
|
489
|
+
CSS.highlights.set(`_${l.id}`, f);
|
|
490
|
+
}), e = h;
|
|
491
491
|
}
|
|
492
492
|
};
|
|
493
493
|
}, Ce = (t, e, n) => vt(t, e, n, Se());
|
|
@@ -524,25 +524,25 @@ const Le = (t, e) => {
|
|
|
524
524
|
destroy: () => {
|
|
525
525
|
e.remove();
|
|
526
526
|
},
|
|
527
|
-
redraw: (
|
|
528
|
-
const
|
|
529
|
-
if (!
|
|
530
|
-
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
527
|
+
redraw: (s, a, u, h, m) => {
|
|
528
|
+
const g = !(mt(n, s) && m);
|
|
529
|
+
if (!h && !g) return;
|
|
530
|
+
g && (e.innerHTML = "");
|
|
531
|
+
const f = s.reduce((x, { rects: v }) => [...x, ...v], []);
|
|
532
|
+
s.forEach((x) => {
|
|
533
|
+
x.rects.map((v) => {
|
|
534
|
+
const p = Le(v, f), d = Kt(x, a, u, h, p);
|
|
535
|
+
if (g) {
|
|
536
536
|
const c = document.createElement("span");
|
|
537
|
-
c.className = "r6o-annotation", c.dataset.annotation =
|
|
537
|
+
c.className = "r6o-annotation", c.dataset.annotation = x.annotation.id, c.style.left = `${v.x}px`, c.style.top = `${v.y}px`, c.style.width = `${v.width}px`, c.style.height = `${v.height}px`;
|
|
538
538
|
const y = Y((d == null ? void 0 : d.fill) || P.fill).alpha((d == null ? void 0 : d.fillOpacity) === void 0 ? P.fillOpacity : d.fillOpacity).toHex();
|
|
539
539
|
c.style.backgroundColor = y, 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);
|
|
540
540
|
}
|
|
541
541
|
});
|
|
542
|
-
}), n =
|
|
542
|
+
}), n = s;
|
|
543
543
|
},
|
|
544
|
-
setVisible: (
|
|
545
|
-
|
|
544
|
+
setVisible: (s) => {
|
|
545
|
+
s ? e.classList.remove("hidden") : e.classList.add("hidden");
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
548
|
}, Te = (t, e, n) => vt(t, e, n, Be(t));
|
|
@@ -562,7 +562,7 @@ var Oe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(cryp
|
|
|
562
562
|
const Mt = {
|
|
563
563
|
randomUUID: Oe
|
|
564
564
|
};
|
|
565
|
-
function
|
|
565
|
+
function $t(t, e, n) {
|
|
566
566
|
if (Mt.randomUUID && !e && !t)
|
|
567
567
|
return Mt.randomUUID();
|
|
568
568
|
t = t || {};
|
|
@@ -595,40 +595,40 @@ function dt() {
|
|
|
595
595
|
function Ie(t, e) {
|
|
596
596
|
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
597
597
|
}
|
|
598
|
-
const
|
|
598
|
+
const F = [];
|
|
599
599
|
function yt(t, e = dt) {
|
|
600
600
|
let n;
|
|
601
601
|
const o = /* @__PURE__ */ new Set();
|
|
602
|
-
function i(
|
|
603
|
-
if (Ie(t,
|
|
604
|
-
const u = !
|
|
605
|
-
for (const
|
|
606
|
-
|
|
602
|
+
function i(a) {
|
|
603
|
+
if (Ie(t, a) && (t = a, n)) {
|
|
604
|
+
const u = !F.length;
|
|
605
|
+
for (const h of o)
|
|
606
|
+
h[1](), F.push(h, t);
|
|
607
607
|
if (u) {
|
|
608
|
-
for (let
|
|
609
|
-
|
|
610
|
-
|
|
608
|
+
for (let h = 0; h < F.length; h += 2)
|
|
609
|
+
F[h][0](F[h + 1]);
|
|
610
|
+
F.length = 0;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
}
|
|
614
|
-
function r(
|
|
615
|
-
i(
|
|
614
|
+
function r(a) {
|
|
615
|
+
i(a(t));
|
|
616
616
|
}
|
|
617
|
-
function a
|
|
618
|
-
const
|
|
619
|
-
return o.add(
|
|
620
|
-
o.delete(
|
|
617
|
+
function s(a, u = dt) {
|
|
618
|
+
const h = [a, u];
|
|
619
|
+
return o.add(h), o.size === 1 && (n = e(i, r) || dt), a(t), () => {
|
|
620
|
+
o.delete(h), o.size === 0 && n && (n(), n = null);
|
|
621
621
|
};
|
|
622
622
|
}
|
|
623
|
-
return { set: i, update: r, subscribe:
|
|
623
|
+
return { set: i, update: r, subscribe: s };
|
|
624
624
|
}
|
|
625
625
|
const Ve = (t) => {
|
|
626
626
|
const { subscribe: e, set: n } = yt();
|
|
627
627
|
let o;
|
|
628
628
|
return e((i) => o = i), t.observe(({ changes: i }) => {
|
|
629
629
|
if (o) {
|
|
630
|
-
(i.deleted || []).some((
|
|
631
|
-
const r = (i.updated || []).find(({ oldValue:
|
|
630
|
+
(i.deleted || []).some((s) => s.id === o) && n(void 0);
|
|
631
|
+
const r = (i.updated || []).find(({ oldValue: s }) => s.id === o);
|
|
632
632
|
r && n(r.newValue.id);
|
|
633
633
|
}
|
|
634
634
|
}), {
|
|
@@ -644,36 +644,36 @@ const ut = { selected: [] }, ke = (t, e = "EDIT") => {
|
|
|
644
644
|
const { subscribe: n, set: o } = yt(ut);
|
|
645
645
|
let i = ut;
|
|
646
646
|
n((l) => i = l);
|
|
647
|
-
const r = () => o(ut),
|
|
647
|
+
const r = () => o(ut), s = () => {
|
|
648
648
|
var l;
|
|
649
649
|
return ((l = i.selected) == null ? void 0 : l.length) === 0;
|
|
650
|
-
},
|
|
650
|
+
}, a = (l) => {
|
|
651
651
|
if (i.selected.length === 0)
|
|
652
652
|
return !1;
|
|
653
|
-
const
|
|
654
|
-
return i.selected.some((
|
|
655
|
-
}, u = (l,
|
|
656
|
-
const
|
|
657
|
-
if (
|
|
658
|
-
const
|
|
659
|
-
o(
|
|
653
|
+
const g = typeof l == "string" ? l : l.id;
|
|
654
|
+
return i.selected.some((f) => f.id === g);
|
|
655
|
+
}, u = (l, g) => {
|
|
656
|
+
const f = t.getAnnotation(l);
|
|
657
|
+
if (f) {
|
|
658
|
+
const x = It(f, e);
|
|
659
|
+
o(x === "EDIT" ? { selected: [{ id: l, editable: !0 }], pointerEvent: g } : x === "SELECT" ? { selected: [{ id: l }], pointerEvent: g } : { selected: [], pointerEvent: g });
|
|
660
660
|
} else
|
|
661
661
|
console.warn("Invalid selection: " + l);
|
|
662
|
-
},
|
|
663
|
-
const
|
|
662
|
+
}, h = (l, g) => {
|
|
663
|
+
const f = Array.isArray(l) ? l : [l], x = f.map((v) => t.getAnnotation(v)).filter(Boolean);
|
|
664
664
|
o({
|
|
665
|
-
selected:
|
|
666
|
-
const
|
|
667
|
-
return { id: v.id, editable:
|
|
665
|
+
selected: x.map((v) => {
|
|
666
|
+
const p = g === void 0 ? It(v, e) === "EDIT" : g;
|
|
667
|
+
return { id: v.id, editable: p };
|
|
668
668
|
})
|
|
669
|
-
}),
|
|
669
|
+
}), x.length !== f.length && console.warn("Invalid selection", l);
|
|
670
670
|
}, m = (l) => {
|
|
671
671
|
if (i.selected.length === 0)
|
|
672
672
|
return !1;
|
|
673
|
-
const { selected:
|
|
674
|
-
|
|
673
|
+
const { selected: g } = i;
|
|
674
|
+
g.filter(({ id: f }) => l.includes(f)).length > 0 && o({ selected: g.filter(({ id: f }) => !l.includes(f)) });
|
|
675
675
|
};
|
|
676
|
-
return t.observe(({ changes: l }) => m((l.deleted || []).map((
|
|
676
|
+
return t.observe(({ changes: l }) => m((l.deleted || []).map((g) => g.id))), {
|
|
677
677
|
clear: r,
|
|
678
678
|
clickSelect: u,
|
|
679
679
|
get selected() {
|
|
@@ -682,9 +682,9 @@ const ut = { selected: [] }, ke = (t, e = "EDIT") => {
|
|
|
682
682
|
get pointerEvent() {
|
|
683
683
|
return i ? i.pointerEvent : null;
|
|
684
684
|
},
|
|
685
|
-
isEmpty:
|
|
686
|
-
isSelected:
|
|
687
|
-
setSelected:
|
|
685
|
+
isEmpty: s,
|
|
686
|
+
isSelected: a,
|
|
687
|
+
setSelected: h,
|
|
688
688
|
subscribe: n
|
|
689
689
|
};
|
|
690
690
|
}, It = (t, e) => typeof e == "function" ? e(t) || "EDIT" : e || "EDIT";
|
|
@@ -704,7 +704,7 @@ var Xe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(cryp
|
|
|
704
704
|
const Vt = {
|
|
705
705
|
randomUUID: Xe
|
|
706
706
|
};
|
|
707
|
-
function
|
|
707
|
+
function He(t, e, n) {
|
|
708
708
|
if (Vt.randomUUID && !e && !t)
|
|
709
709
|
return Vt.randomUUID();
|
|
710
710
|
t = t || {};
|
|
@@ -712,29 +712,29 @@ function $e(t, e, n) {
|
|
|
712
712
|
return o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, Ye(o);
|
|
713
713
|
}
|
|
714
714
|
const Vn = (t, e, n, o) => ({
|
|
715
|
-
id:
|
|
715
|
+
id: He(),
|
|
716
716
|
annotation: t.id,
|
|
717
717
|
created: n || /* @__PURE__ */ new Date(),
|
|
718
718
|
creator: o,
|
|
719
719
|
...e
|
|
720
|
-
}),
|
|
720
|
+
}), $e = (t, e) => {
|
|
721
721
|
const n = new Set(t.bodies.map((o) => o.id));
|
|
722
722
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
723
723
|
}, Pe = (t, e) => {
|
|
724
724
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
725
725
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
726
|
-
},
|
|
726
|
+
}, Fe = (t, e) => e.bodies.map((n) => {
|
|
727
727
|
const o = t.bodies.find((i) => i.id === n.id);
|
|
728
728
|
return { newBody: n, oldBody: o && !q(o, n) ? o : void 0 };
|
|
729
|
-
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })),
|
|
730
|
-
const n =
|
|
729
|
+
}).filter(({ oldBody: n }) => n).map(({ oldBody: n, newBody: o }) => ({ oldBody: n, newBody: o })), ze = (t, e) => !q(t.target, e.target), Pt = (t, e) => {
|
|
730
|
+
const n = $e(t, e), o = Pe(t, e), i = Fe(t, e);
|
|
731
731
|
return {
|
|
732
732
|
oldValue: t,
|
|
733
733
|
newValue: e,
|
|
734
734
|
bodiesCreated: n.length > 0 ? n : void 0,
|
|
735
735
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
736
736
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
737
|
-
targetUpdated:
|
|
737
|
+
targetUpdated: ze(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
738
738
|
};
|
|
739
739
|
};
|
|
740
740
|
var N = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(N || {});
|
|
@@ -744,138 +744,138 @@ const We = (t, e) => {
|
|
|
744
744
|
if (!(!t.options.origin || t.options.origin === r))
|
|
745
745
|
return !1;
|
|
746
746
|
if (t.options.ignore) {
|
|
747
|
-
const { ignore:
|
|
748
|
-
if (!(
|
|
749
|
-
const u = (n = i.updated) == null ? void 0 : n.some((m) =>
|
|
750
|
-
if (
|
|
747
|
+
const { ignore: s } = t.options, a = (u) => u && u.length > 0;
|
|
748
|
+
if (!(a(i.created) || a(i.deleted))) {
|
|
749
|
+
const u = (n = i.updated) == null ? void 0 : n.some((m) => a(m.bodiesCreated) || a(m.bodiesDeleted) || a(m.bodiesUpdated)), h = (o = i.updated) == null ? void 0 : o.some((m) => m.targetUpdated);
|
|
750
|
+
if (s === "BODY_ONLY" && u && !h || s === "TARGET_ONLY" && h && !u)
|
|
751
751
|
return !1;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
754
|
if (t.options.annotations) {
|
|
755
|
-
const
|
|
756
|
-
...(i.created || []).map((
|
|
757
|
-
...(i.deleted || []).map((
|
|
758
|
-
...(i.updated || []).map(({ oldValue:
|
|
755
|
+
const s = /* @__PURE__ */ new Set([
|
|
756
|
+
...(i.created || []).map((a) => a.id),
|
|
757
|
+
...(i.deleted || []).map((a) => a.id),
|
|
758
|
+
...(i.updated || []).map(({ oldValue: a }) => a.id)
|
|
759
759
|
]);
|
|
760
|
-
return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((
|
|
760
|
+
return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((a) => s.has(a));
|
|
761
761
|
} else
|
|
762
762
|
return !0;
|
|
763
763
|
}, qe = (t, e) => {
|
|
764
|
-
const n = new Set((t.created || []).map((l) => l.id)), o = new Set((t.updated || []).map(({ newValue: l }) => l.id)), i = new Set((e.created || []).map((l) => l.id)), r = new Set((e.deleted || []).map((l) => l.id)),
|
|
765
|
-
...(t.created || []).filter((l) => !r.has(l.id)).map((l) =>
|
|
764
|
+
const n = new Set((t.created || []).map((l) => l.id)), o = new Set((t.updated || []).map(({ newValue: l }) => l.id)), i = new Set((e.created || []).map((l) => l.id)), r = new Set((e.deleted || []).map((l) => l.id)), s = new Set((e.updated || []).map(({ oldValue: l }) => l.id)), a = new Set((e.updated || []).filter(({ oldValue: l }) => n.has(l.id) || o.has(l.id)).map(({ oldValue: l }) => l.id)), u = [
|
|
765
|
+
...(t.created || []).filter((l) => !r.has(l.id)).map((l) => s.has(l.id) ? e.updated.find(({ oldValue: g }) => g.id === l.id).newValue : l),
|
|
766
766
|
...e.created || []
|
|
767
|
-
],
|
|
767
|
+
], h = [
|
|
768
768
|
...(t.deleted || []).filter((l) => !i.has(l.id)),
|
|
769
769
|
...(e.deleted || []).filter((l) => !n.has(l.id))
|
|
770
770
|
], m = [
|
|
771
771
|
...(t.updated || []).filter(({ newValue: l }) => !r.has(l.id)).map((l) => {
|
|
772
|
-
const { oldValue:
|
|
773
|
-
if (
|
|
774
|
-
const
|
|
775
|
-
return Pt(
|
|
772
|
+
const { oldValue: g, newValue: f } = l;
|
|
773
|
+
if (s.has(f.id)) {
|
|
774
|
+
const x = e.updated.find((v) => v.oldValue.id === f.id).newValue;
|
|
775
|
+
return Pt(g, x);
|
|
776
776
|
} else
|
|
777
777
|
return l;
|
|
778
778
|
}),
|
|
779
|
-
...(e.updated || []).filter(({ oldValue: l }) => !
|
|
779
|
+
...(e.updated || []).filter(({ oldValue: l }) => !a.has(l.id))
|
|
780
780
|
];
|
|
781
|
-
return { created: u, deleted:
|
|
781
|
+
return { created: u, deleted: h, updated: m };
|
|
782
782
|
}, je = (t) => t.id !== void 0, Ge = () => {
|
|
783
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (b,
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
}, r = (b,
|
|
783
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (b, w = {}) => n.push({ onChange: b, options: w }), i = (b) => {
|
|
784
|
+
const w = n.findIndex((A) => A.onChange == b);
|
|
785
|
+
w > -1 && n.splice(w, 1);
|
|
786
|
+
}, r = (b, w) => {
|
|
787
787
|
const A = {
|
|
788
788
|
origin: b,
|
|
789
789
|
changes: {
|
|
790
|
-
created:
|
|
791
|
-
updated:
|
|
792
|
-
deleted:
|
|
790
|
+
created: w.created || [],
|
|
791
|
+
updated: w.updated || [],
|
|
792
|
+
deleted: w.deleted || []
|
|
793
793
|
},
|
|
794
794
|
state: [...t.values()]
|
|
795
795
|
};
|
|
796
796
|
n.forEach((S) => {
|
|
797
797
|
We(S, A) && S.onChange(A);
|
|
798
798
|
});
|
|
799
|
-
},
|
|
799
|
+
}, s = (b, w = N.LOCAL) => {
|
|
800
800
|
if (t.get(b.id))
|
|
801
801
|
throw Error(`Cannot add annotation ${b.id} - exists already`);
|
|
802
|
-
t.set(b.id, b), b.bodies.forEach((A) => e.set(A.id, b.id)), r(
|
|
803
|
-
},
|
|
804
|
-
const A = typeof b == "string" ?
|
|
802
|
+
t.set(b.id, b), b.bodies.forEach((A) => e.set(A.id, b.id)), r(w, { created: [b] });
|
|
803
|
+
}, a = (b, w) => {
|
|
804
|
+
const A = typeof b == "string" ? w : b, S = typeof b == "string" ? b : b.id, R = t.get(S);
|
|
805
805
|
if (R) {
|
|
806
|
-
const
|
|
807
|
-
return S === A.id ? t.set(S, A) : (t.delete(S), t.set(A.id, A)), R.bodies.forEach((
|
|
806
|
+
const O = Pt(R, A);
|
|
807
|
+
return S === A.id ? t.set(S, A) : (t.delete(S), t.set(A.id, A)), R.bodies.forEach(($) => e.delete($.id)), A.bodies.forEach(($) => e.set($.id, A.id)), O;
|
|
808
808
|
} else
|
|
809
809
|
console.warn(`Cannot update annotation ${S} - does not exist`);
|
|
810
|
-
}, u = (b,
|
|
811
|
-
const S = je(
|
|
810
|
+
}, u = (b, w = N.LOCAL, A = N.LOCAL) => {
|
|
811
|
+
const S = je(w) ? A : w, R = a(b, w);
|
|
812
812
|
R && r(S, { updated: [R] });
|
|
813
|
-
},
|
|
813
|
+
}, h = (b, w = N.LOCAL) => {
|
|
814
814
|
const A = b.reduce((S, R) => {
|
|
815
|
-
const
|
|
816
|
-
return
|
|
815
|
+
const O = a(R);
|
|
816
|
+
return O ? [...S, O] : S;
|
|
817
817
|
}, []);
|
|
818
|
-
A.length > 0 && r(
|
|
819
|
-
}, m = (b,
|
|
818
|
+
A.length > 0 && r(w, { updated: A });
|
|
819
|
+
}, m = (b, w = N.LOCAL) => {
|
|
820
820
|
const A = t.get(b.annotation);
|
|
821
821
|
if (A) {
|
|
822
822
|
const S = {
|
|
823
823
|
...A,
|
|
824
824
|
bodies: [...A.bodies, b]
|
|
825
825
|
};
|
|
826
|
-
t.set(A.id, S), e.set(b.id, S.id), r(
|
|
826
|
+
t.set(A.id, S), e.set(b.id, S.id), r(w, { updated: [{
|
|
827
827
|
oldValue: A,
|
|
828
828
|
newValue: S,
|
|
829
829
|
bodiesCreated: [b]
|
|
830
830
|
}] });
|
|
831
831
|
} else
|
|
832
832
|
console.warn(`Attempt to add body to missing annotation: ${b.annotation}`);
|
|
833
|
-
}, l = () => [...t.values()],
|
|
834
|
-
const
|
|
835
|
-
t.clear(), e.clear(), r(b, { deleted:
|
|
836
|
-
},
|
|
837
|
-
if (
|
|
833
|
+
}, l = () => [...t.values()], g = (b = N.LOCAL) => {
|
|
834
|
+
const w = [...t.values()];
|
|
835
|
+
t.clear(), e.clear(), r(b, { deleted: w });
|
|
836
|
+
}, f = (b, w = !0, A = N.LOCAL) => {
|
|
837
|
+
if (w) {
|
|
838
838
|
const S = [...t.values()];
|
|
839
839
|
t.clear(), e.clear(), b.forEach((R) => {
|
|
840
|
-
t.set(R.id, R), R.bodies.forEach((
|
|
840
|
+
t.set(R.id, R), R.bodies.forEach((O) => e.set(O.id, R.id));
|
|
841
841
|
}), r(A, { created: b, deleted: S });
|
|
842
842
|
} else {
|
|
843
|
-
const S = b.reduce((R,
|
|
844
|
-
const
|
|
845
|
-
return
|
|
843
|
+
const S = b.reduce((R, O) => {
|
|
844
|
+
const $ = t.get(O.id);
|
|
845
|
+
return $ ? [...R, $] : R;
|
|
846
846
|
}, []);
|
|
847
847
|
if (S.length > 0)
|
|
848
848
|
throw Error(`Bulk insert would overwrite the following annotations: ${S.map((R) => R.id).join(", ")}`);
|
|
849
849
|
b.forEach((R) => {
|
|
850
|
-
t.set(R.id, R), R.bodies.forEach((
|
|
850
|
+
t.set(R.id, R), R.bodies.forEach((O) => e.set(O.id, R.id));
|
|
851
851
|
}), r(A, { created: b });
|
|
852
852
|
}
|
|
853
|
-
},
|
|
854
|
-
const
|
|
853
|
+
}, x = (b) => {
|
|
854
|
+
const w = typeof b == "string" ? b : b.id, A = t.get(w);
|
|
855
855
|
if (A)
|
|
856
|
-
return t.delete(
|
|
857
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
858
|
-
}, v = (b,
|
|
859
|
-
const A =
|
|
860
|
-
A && r(
|
|
861
|
-
},
|
|
856
|
+
return t.delete(w), A.bodies.forEach((S) => e.delete(S.id)), A;
|
|
857
|
+
console.warn(`Attempt to delete missing annotation: ${w}`);
|
|
858
|
+
}, v = (b, w = N.LOCAL) => {
|
|
859
|
+
const A = x(b);
|
|
860
|
+
A && r(w, { deleted: [A] });
|
|
861
|
+
}, p = (b, w = N.LOCAL) => {
|
|
862
862
|
const A = b.reduce((S, R) => {
|
|
863
|
-
const
|
|
864
|
-
return
|
|
863
|
+
const O = x(R);
|
|
864
|
+
return O ? [...S, O] : S;
|
|
865
865
|
}, []);
|
|
866
|
-
A.length > 0 && r(
|
|
866
|
+
A.length > 0 && r(w, { deleted: A });
|
|
867
867
|
}, d = (b) => {
|
|
868
|
-
const
|
|
869
|
-
if (
|
|
870
|
-
const A =
|
|
868
|
+
const w = t.get(b.annotation);
|
|
869
|
+
if (w) {
|
|
870
|
+
const A = w.bodies.find((S) => S.id === b.id);
|
|
871
871
|
if (A) {
|
|
872
872
|
e.delete(A.id);
|
|
873
873
|
const S = {
|
|
874
|
-
...
|
|
875
|
-
bodies:
|
|
874
|
+
...w,
|
|
875
|
+
bodies: w.bodies.filter((R) => R.id !== b.id)
|
|
876
876
|
};
|
|
877
|
-
return t.set(
|
|
878
|
-
oldValue:
|
|
877
|
+
return t.set(w.id, S), {
|
|
878
|
+
oldValue: w,
|
|
879
879
|
newValue: S,
|
|
880
880
|
bodiesDeleted: [A]
|
|
881
881
|
};
|
|
@@ -883,61 +883,61 @@ const We = (t, e) => {
|
|
|
883
883
|
console.warn(`Attempt to delete missing body ${b.id} from annotation ${b.annotation}`);
|
|
884
884
|
} else
|
|
885
885
|
console.warn(`Attempt to delete body from missing annotation ${b.annotation}`);
|
|
886
|
-
}, c = (b,
|
|
886
|
+
}, c = (b, w = N.LOCAL) => {
|
|
887
887
|
const A = d(b);
|
|
888
|
-
A && r(
|
|
889
|
-
}, y = (b,
|
|
888
|
+
A && r(w, { updated: [A] });
|
|
889
|
+
}, y = (b, w = N.LOCAL) => {
|
|
890
890
|
const A = b.map((S) => d(S)).filter(Boolean);
|
|
891
|
-
A.length > 0 && r(
|
|
891
|
+
A.length > 0 && r(w, { updated: A });
|
|
892
892
|
}, C = (b) => {
|
|
893
|
-
const
|
|
894
|
-
return
|
|
893
|
+
const w = t.get(b);
|
|
894
|
+
return w ? { ...w } : void 0;
|
|
895
895
|
}, L = (b) => {
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
const A = C(
|
|
896
|
+
const w = e.get(b);
|
|
897
|
+
if (w) {
|
|
898
|
+
const A = C(w).bodies.find((S) => S.id === b);
|
|
899
899
|
if (A)
|
|
900
900
|
return A;
|
|
901
901
|
console.error(`Store integrity error: body ${b} in index, but not in annotation`);
|
|
902
902
|
} else
|
|
903
903
|
console.warn(`Attempt to retrieve missing body: ${b}`);
|
|
904
|
-
}, E = (b,
|
|
905
|
-
if (b.annotation !==
|
|
904
|
+
}, E = (b, w) => {
|
|
905
|
+
if (b.annotation !== w.annotation)
|
|
906
906
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
907
907
|
const A = t.get(b.annotation);
|
|
908
908
|
if (A) {
|
|
909
|
-
const S = A.bodies.find((
|
|
909
|
+
const S = A.bodies.find((O) => O.id === b.id), R = {
|
|
910
910
|
...A,
|
|
911
|
-
bodies: A.bodies.map((
|
|
911
|
+
bodies: A.bodies.map((O) => O.id === S.id ? w : O)
|
|
912
912
|
};
|
|
913
|
-
return t.set(A.id, R), S.id !==
|
|
913
|
+
return t.set(A.id, R), S.id !== w.id && (e.delete(S.id), e.set(w.id, R.id)), {
|
|
914
914
|
oldValue: A,
|
|
915
915
|
newValue: R,
|
|
916
|
-
bodiesUpdated: [{ oldBody: S, newBody:
|
|
916
|
+
bodiesUpdated: [{ oldBody: S, newBody: w }]
|
|
917
917
|
};
|
|
918
918
|
} else
|
|
919
919
|
console.warn(`Attempt to add body to missing annotation ${b.annotation}`);
|
|
920
|
-
}, B = (b,
|
|
921
|
-
const S = E(b,
|
|
920
|
+
}, B = (b, w, A = N.LOCAL) => {
|
|
921
|
+
const S = E(b, w);
|
|
922
922
|
S && r(A, { updated: [S] });
|
|
923
|
-
}, T = (b,
|
|
923
|
+
}, T = (b, w = N.LOCAL) => {
|
|
924
924
|
const A = b.map((S) => E({ id: S.id, annotation: S.annotation }, S)).filter(Boolean);
|
|
925
|
-
r(
|
|
926
|
-
},
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
925
|
+
r(w, { updated: A });
|
|
926
|
+
}, M = (b) => {
|
|
927
|
+
const w = t.get(b.annotation);
|
|
928
|
+
if (w) {
|
|
929
929
|
const A = {
|
|
930
|
-
...
|
|
930
|
+
...w,
|
|
931
931
|
target: {
|
|
932
|
-
...
|
|
932
|
+
...w.target,
|
|
933
933
|
...b
|
|
934
934
|
}
|
|
935
935
|
};
|
|
936
|
-
return t.set(
|
|
937
|
-
oldValue:
|
|
936
|
+
return t.set(w.id, A), {
|
|
937
|
+
oldValue: w,
|
|
938
938
|
newValue: A,
|
|
939
939
|
targetUpdated: {
|
|
940
|
-
oldTarget:
|
|
940
|
+
oldTarget: w.target,
|
|
941
941
|
newTarget: b
|
|
942
942
|
}
|
|
943
943
|
};
|
|
@@ -945,19 +945,19 @@ const We = (t, e) => {
|
|
|
945
945
|
console.warn(`Attempt to update target on missing annotation: ${b.annotation}`);
|
|
946
946
|
};
|
|
947
947
|
return {
|
|
948
|
-
addAnnotation:
|
|
948
|
+
addAnnotation: s,
|
|
949
949
|
addBody: m,
|
|
950
950
|
all: l,
|
|
951
|
-
bulkAddAnnotation:
|
|
952
|
-
bulkDeleteAnnotation:
|
|
951
|
+
bulkAddAnnotation: f,
|
|
952
|
+
bulkDeleteAnnotation: p,
|
|
953
953
|
bulkDeleteBodies: y,
|
|
954
|
-
bulkUpdateAnnotation:
|
|
954
|
+
bulkUpdateAnnotation: h,
|
|
955
955
|
bulkUpdateBodies: T,
|
|
956
|
-
bulkUpdateTargets: (b,
|
|
957
|
-
const A = b.map((S) =>
|
|
958
|
-
A.length > 0 && r(
|
|
956
|
+
bulkUpdateTargets: (b, w = N.LOCAL) => {
|
|
957
|
+
const A = b.map((S) => M(S)).filter(Boolean);
|
|
958
|
+
A.length > 0 && r(w, { updated: A });
|
|
959
959
|
},
|
|
960
|
-
clear:
|
|
960
|
+
clear: g,
|
|
961
961
|
deleteAnnotation: v,
|
|
962
962
|
deleteBody: c,
|
|
963
963
|
getAnnotation: C,
|
|
@@ -966,9 +966,9 @@ const We = (t, e) => {
|
|
|
966
966
|
unobserve: i,
|
|
967
967
|
updateAnnotation: u,
|
|
968
968
|
updateBody: B,
|
|
969
|
-
updateTarget: (b,
|
|
970
|
-
const A =
|
|
971
|
-
A && r(
|
|
969
|
+
updateTarget: (b, w = N.LOCAL) => {
|
|
970
|
+
const A = M(b);
|
|
971
|
+
A && r(w, { updated: [A] });
|
|
972
972
|
}
|
|
973
973
|
};
|
|
974
974
|
};
|
|
@@ -989,38 +989,38 @@ let Ke = () => ({
|
|
|
989
989
|
const Qe = 250, Je = (t) => {
|
|
990
990
|
const e = Ke(), n = [];
|
|
991
991
|
let o = -1, i = !1, r = 0;
|
|
992
|
-
const
|
|
992
|
+
const s = (f) => {
|
|
993
993
|
if (!i) {
|
|
994
|
-
const { changes:
|
|
994
|
+
const { changes: x } = f, v = performance.now();
|
|
995
995
|
if (v - r > Qe)
|
|
996
|
-
n.splice(o + 1), n.push(
|
|
996
|
+
n.splice(o + 1), n.push(x), o = n.length - 1;
|
|
997
997
|
else {
|
|
998
|
-
const
|
|
999
|
-
n[
|
|
998
|
+
const p = n.length - 1;
|
|
999
|
+
n[p] = qe(n[p], x);
|
|
1000
1000
|
}
|
|
1001
1001
|
r = v;
|
|
1002
1002
|
}
|
|
1003
1003
|
i = !1;
|
|
1004
1004
|
};
|
|
1005
|
-
t.observe(
|
|
1006
|
-
const
|
|
1005
|
+
t.observe(s, { origin: N.LOCAL });
|
|
1006
|
+
const a = (f) => f && f.length > 0 && t.bulkDeleteAnnotation(f), u = (f) => f && f.length > 0 && t.bulkAddAnnotation(f, !1), h = (f) => f && f.length > 0 && t.bulkUpdateAnnotation(f.map(({ oldValue: x }) => x)), m = (f) => f && f.length > 0 && t.bulkUpdateAnnotation(f.map(({ newValue: x }) => x)), l = (f) => f && f.length > 0 && t.bulkAddAnnotation(f, !1), g = (f) => f && f.length > 0 && t.bulkDeleteAnnotation(f);
|
|
1007
1007
|
return {
|
|
1008
1008
|
canRedo: () => n.length - 1 > o,
|
|
1009
1009
|
canUndo: () => o > -1,
|
|
1010
|
-
destroy: () => t.unobserve(
|
|
1011
|
-
on: (
|
|
1010
|
+
destroy: () => t.unobserve(s),
|
|
1011
|
+
on: (f, x) => e.on(f, x),
|
|
1012
1012
|
redo: () => {
|
|
1013
1013
|
if (n.length - 1 > o) {
|
|
1014
1014
|
i = !0;
|
|
1015
|
-
const { created:
|
|
1016
|
-
u(
|
|
1015
|
+
const { created: f, updated: x, deleted: v } = n[o + 1];
|
|
1016
|
+
u(f), m(x), g(v), e.emit("redo", n[o + 1]), o += 1;
|
|
1017
1017
|
}
|
|
1018
1018
|
},
|
|
1019
1019
|
undo: () => {
|
|
1020
1020
|
if (o > -1) {
|
|
1021
1021
|
i = !0;
|
|
1022
|
-
const { created:
|
|
1023
|
-
|
|
1022
|
+
const { created: f, updated: x, deleted: v } = n[o];
|
|
1023
|
+
a(f), h(x), l(v), e.emit("undo", n[o]), o -= 1;
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
};
|
|
@@ -1031,73 +1031,73 @@ const Qe = 250, Je = (t) => {
|
|
|
1031
1031
|
set: e
|
|
1032
1032
|
};
|
|
1033
1033
|
}, tn = (t, e, n, o) => {
|
|
1034
|
-
const { store: i, selection: r, hover:
|
|
1035
|
-
let
|
|
1036
|
-
const l = (v,
|
|
1037
|
-
u.has(v) ? u.get(v).push(
|
|
1038
|
-
},
|
|
1034
|
+
const { store: i, selection: r, hover: s, viewport: a } = t, u = /* @__PURE__ */ new Map();
|
|
1035
|
+
let h = [], m;
|
|
1036
|
+
const l = (v, p) => {
|
|
1037
|
+
u.has(v) ? u.get(v).push(p) : u.set(v, [p]);
|
|
1038
|
+
}, g = (v, p) => {
|
|
1039
1039
|
const d = u.get(v);
|
|
1040
1040
|
if (d) {
|
|
1041
|
-
const c = d.indexOf(
|
|
1041
|
+
const c = d.indexOf(p);
|
|
1042
1042
|
c !== -1 && d.splice(c, 1);
|
|
1043
1043
|
}
|
|
1044
|
-
},
|
|
1044
|
+
}, f = (v, p, d) => {
|
|
1045
1045
|
u.has(v) && setTimeout(() => {
|
|
1046
1046
|
u.get(v).forEach((c) => {
|
|
1047
1047
|
if (n) {
|
|
1048
|
-
const y = Array.isArray(
|
|
1048
|
+
const y = Array.isArray(p) ? p.map((L) => n.serialize(L)) : n.serialize(p), C = d ? d instanceof PointerEvent ? d : n.serialize(d) : void 0;
|
|
1049
1049
|
c(y, C);
|
|
1050
1050
|
} else
|
|
1051
|
-
c(
|
|
1051
|
+
c(p, d);
|
|
1052
1052
|
});
|
|
1053
1053
|
}, 1);
|
|
1054
1054
|
};
|
|
1055
1055
|
r.subscribe(({ selected: v }) => {
|
|
1056
|
-
if (!(
|
|
1057
|
-
if (
|
|
1058
|
-
|
|
1059
|
-
else if (
|
|
1060
|
-
|
|
1061
|
-
const d = i.getAnnotation(
|
|
1062
|
-
d && !q(d,
|
|
1063
|
-
}),
|
|
1056
|
+
if (!(h.length === 0 && v.length === 0)) {
|
|
1057
|
+
if (h.length === 0 && v.length > 0)
|
|
1058
|
+
h = v.map(({ id: p }) => i.getAnnotation(p));
|
|
1059
|
+
else if (h.length > 0 && v.length === 0)
|
|
1060
|
+
h.forEach((p) => {
|
|
1061
|
+
const d = i.getAnnotation(p.id);
|
|
1062
|
+
d && !q(d, p) && f("updateAnnotation", d, p);
|
|
1063
|
+
}), h = [];
|
|
1064
1064
|
else {
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1065
|
+
const p = new Set(h.map((c) => c.id)), d = new Set(v.map(({ id: c }) => c));
|
|
1066
|
+
h.filter((c) => !d.has(c.id)).forEach((c) => {
|
|
1067
1067
|
const y = i.getAnnotation(c.id);
|
|
1068
|
-
y && !q(y, c) &&
|
|
1069
|
-
}),
|
|
1068
|
+
y && !q(y, c) && f("updateAnnotation", y, c);
|
|
1069
|
+
}), h = [
|
|
1070
1070
|
// Remove annotations that were deselected
|
|
1071
|
-
...
|
|
1071
|
+
...h.filter((c) => d.has(c.id)),
|
|
1072
1072
|
// Add editable annotations that were selected
|
|
1073
|
-
...v.filter(({ id: c }) => !
|
|
1073
|
+
...v.filter(({ id: c }) => !p.has(c)).map(({ id: c }) => i.getAnnotation(c))
|
|
1074
1074
|
];
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1076
|
+
f("selectionChanged", h);
|
|
1077
1077
|
}
|
|
1078
|
-
}),
|
|
1079
|
-
!m && v ?
|
|
1080
|
-
}),
|
|
1081
|
-
const { created:
|
|
1082
|
-
(
|
|
1078
|
+
}), s.subscribe((v) => {
|
|
1079
|
+
!m && v ? f("mouseEnterAnnotation", i.getAnnotation(v)) : m && !v ? f("mouseLeaveAnnotation", i.getAnnotation(m)) : m && v && (f("mouseLeaveAnnotation", i.getAnnotation(m)), f("mouseEnterAnnotation", i.getAnnotation(v))), m = v;
|
|
1080
|
+
}), a == null || a.subscribe((v) => f("viewportIntersect", v.map((p) => i.getAnnotation(p)))), i.observe((v) => {
|
|
1081
|
+
const { created: p, deleted: d } = v.changes;
|
|
1082
|
+
(p || []).forEach((c) => f("createAnnotation", c)), (d || []).forEach((c) => f("deleteAnnotation", c)), (v.changes.updated || []).filter((c) => [
|
|
1083
1083
|
...c.bodiesCreated || [],
|
|
1084
1084
|
...c.bodiesDeleted || [],
|
|
1085
1085
|
...c.bodiesUpdated || []
|
|
1086
1086
|
].length > 0).forEach(({ oldValue: c, newValue: y }) => {
|
|
1087
|
-
const C =
|
|
1088
|
-
|
|
1087
|
+
const C = h.find((L) => L.id === c.id) || c;
|
|
1088
|
+
h = h.map((L) => L.id === c.id ? y : L), f("updateAnnotation", y, C);
|
|
1089
1089
|
});
|
|
1090
1090
|
}, { origin: N.LOCAL }), i.observe((v) => {
|
|
1091
|
-
if (
|
|
1092
|
-
const
|
|
1093
|
-
d.length > 0 && (
|
|
1091
|
+
if (h) {
|
|
1092
|
+
const p = new Set(h.map((c) => c.id)), d = (v.changes.updated || []).filter(({ newValue: c }) => p.has(c.id)).map(({ newValue: c }) => c);
|
|
1093
|
+
d.length > 0 && (h = h.map((c) => d.find((C) => C.id === c.id) || c));
|
|
1094
1094
|
}
|
|
1095
1095
|
}, { origin: N.REMOTE });
|
|
1096
|
-
const
|
|
1097
|
-
const { updated: d } =
|
|
1098
|
-
v ? (d || []).forEach((c) =>
|
|
1096
|
+
const x = (v) => (p) => {
|
|
1097
|
+
const { updated: d } = p;
|
|
1098
|
+
v ? (d || []).forEach((c) => f("updateAnnotation", c.oldValue, c.newValue)) : (d || []).forEach((c) => f("updateAnnotation", c.newValue, c.oldValue));
|
|
1099
1099
|
};
|
|
1100
|
-
return e.on("undo",
|
|
1100
|
+
return e.on("undo", x(!0)), e.on("redo", x(!1)), { on: l, off: g, emit: f };
|
|
1101
1101
|
}, en = (t) => (e) => e.reduce((n, o) => {
|
|
1102
1102
|
const { parsed: i, error: r } = t.parse(o);
|
|
1103
1103
|
return r ? {
|
|
@@ -1110,60 +1110,60 @@ const Qe = 250, Je = (t) => {
|
|
|
1110
1110
|
...n
|
|
1111
1111
|
};
|
|
1112
1112
|
}, { parsed: [], failed: [] }), nn = (t, e, n) => {
|
|
1113
|
-
const { store: o, selection: i } = t, r = (
|
|
1113
|
+
const { store: o, selection: i } = t, r = (p) => {
|
|
1114
1114
|
if (n) {
|
|
1115
|
-
const { parsed: d, error: c } = n.parse(
|
|
1115
|
+
const { parsed: d, error: c } = n.parse(p);
|
|
1116
1116
|
d ? o.addAnnotation(d, N.REMOTE) : console.error(c);
|
|
1117
1117
|
} else
|
|
1118
|
-
o.addAnnotation(
|
|
1119
|
-
},
|
|
1120
|
-
const d = o.getAnnotation(
|
|
1118
|
+
o.addAnnotation(p, N.REMOTE);
|
|
1119
|
+
}, s = () => i.clear(), a = () => o.clear(), u = (p) => {
|
|
1120
|
+
const d = o.getAnnotation(p);
|
|
1121
1121
|
return n && d ? n.serialize(d) : d;
|
|
1122
|
-
},
|
|
1123
|
-
var
|
|
1124
|
-
const d = (((
|
|
1122
|
+
}, h = () => n ? o.all().map(n.serialize) : o.all(), m = () => {
|
|
1123
|
+
var p;
|
|
1124
|
+
const d = (((p = i.selected) == null ? void 0 : p.map((c) => c.id)) || []).map((c) => o.getAnnotation(c)).filter(Boolean);
|
|
1125
1125
|
return n ? d.map(n.serialize) : d;
|
|
1126
|
-
}, l = (
|
|
1127
|
-
if (typeof
|
|
1128
|
-
const d = o.getAnnotation(
|
|
1129
|
-
if (o.deleteAnnotation(
|
|
1126
|
+
}, l = (p, d = !0) => fetch(p).then((c) => c.json()).then((c) => (f(c, d), c)), g = (p) => {
|
|
1127
|
+
if (typeof p == "string") {
|
|
1128
|
+
const d = o.getAnnotation(p);
|
|
1129
|
+
if (o.deleteAnnotation(p), d)
|
|
1130
1130
|
return n ? n.serialize(d) : d;
|
|
1131
1131
|
} else {
|
|
1132
|
-
const d = n ? n.parse(
|
|
1132
|
+
const d = n ? n.parse(p).parsed : p;
|
|
1133
1133
|
if (d)
|
|
1134
|
-
return o.deleteAnnotation(d),
|
|
1134
|
+
return o.deleteAnnotation(d), p;
|
|
1135
1135
|
}
|
|
1136
|
-
},
|
|
1136
|
+
}, f = (p, d = !0) => {
|
|
1137
1137
|
if (n) {
|
|
1138
|
-
const { parsed: c, failed: y } = en(n)(
|
|
1138
|
+
const { parsed: c, failed: y } = en(n)(p);
|
|
1139
1139
|
y.length > 0 && console.warn(`Discarded ${y.length} invalid annotations`, y), o.bulkAddAnnotation(c, d, N.REMOTE);
|
|
1140
1140
|
} else
|
|
1141
|
-
o.bulkAddAnnotation(
|
|
1142
|
-
},
|
|
1143
|
-
|
|
1144
|
-
}, v = (
|
|
1141
|
+
o.bulkAddAnnotation(p, d, N.REMOTE);
|
|
1142
|
+
}, x = (p, d) => {
|
|
1143
|
+
p ? i.setSelected(p, d) : i.clear();
|
|
1144
|
+
}, v = (p) => {
|
|
1145
1145
|
if (n) {
|
|
1146
|
-
const d = n.parse(
|
|
1146
|
+
const d = n.parse(p).parsed, c = n.serialize(o.getAnnotation(d.id));
|
|
1147
1147
|
return o.updateAnnotation(d), c;
|
|
1148
1148
|
} else {
|
|
1149
|
-
const d = o.getAnnotation(
|
|
1150
|
-
return o.updateAnnotation(
|
|
1149
|
+
const d = o.getAnnotation(p.id);
|
|
1150
|
+
return o.updateAnnotation(p), d;
|
|
1151
1151
|
}
|
|
1152
1152
|
};
|
|
1153
1153
|
return {
|
|
1154
1154
|
addAnnotation: r,
|
|
1155
|
-
cancelSelected:
|
|
1155
|
+
cancelSelected: s,
|
|
1156
1156
|
canRedo: e.canRedo,
|
|
1157
1157
|
canUndo: e.canUndo,
|
|
1158
|
-
clearAnnotations:
|
|
1158
|
+
clearAnnotations: a,
|
|
1159
1159
|
getAnnotationById: u,
|
|
1160
|
-
getAnnotations:
|
|
1160
|
+
getAnnotations: h,
|
|
1161
1161
|
getSelected: m,
|
|
1162
1162
|
loadAnnotations: l,
|
|
1163
1163
|
redo: e.redo,
|
|
1164
|
-
removeAnnotation:
|
|
1165
|
-
setAnnotations:
|
|
1166
|
-
setSelected:
|
|
1164
|
+
removeAnnotation: g,
|
|
1165
|
+
setAnnotations: f,
|
|
1166
|
+
setSelected: x,
|
|
1167
1167
|
undo: e.undo,
|
|
1168
1168
|
updateAnnotation: v
|
|
1169
1169
|
};
|
|
@@ -1171,11 +1171,11 @@ const Qe = 250, Je = (t) => {
|
|
|
1171
1171
|
let rn = (t) => crypto.getRandomValues(new Uint8Array(t)), sn = (t, e, n) => {
|
|
1172
1172
|
let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * e / t.length);
|
|
1173
1173
|
return (r = e) => {
|
|
1174
|
-
let
|
|
1174
|
+
let s = "";
|
|
1175
1175
|
for (; ; ) {
|
|
1176
|
-
let
|
|
1176
|
+
let a = n(i), u = i;
|
|
1177
1177
|
for (; u--; )
|
|
1178
|
-
if (
|
|
1178
|
+
if (s += t[a[u] & o] || "", s.length === r) return s;
|
|
1179
1179
|
}
|
|
1180
1180
|
};
|
|
1181
1181
|
}, an = (t, e = 21) => sn(t, e, rn), cn = (t = 21) => {
|
|
@@ -1192,27 +1192,27 @@ const ln = () => ({ isGuest: !0, id: an("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1192
1192
|
n = (n << 5) - n + r, n |= 0;
|
|
1193
1193
|
}
|
|
1194
1194
|
return `${n}`;
|
|
1195
|
-
},
|
|
1196
|
-
const { id: o, type: i, purpose: r, value:
|
|
1195
|
+
}, Ft = (t) => t ? typeof t == "object" ? { ...t } : t : void 0, un = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1196
|
+
const { id: o, type: i, purpose: r, value: s, created: a, modified: u, creator: h, ...m } = n;
|
|
1197
1197
|
return {
|
|
1198
1198
|
id: o || `temp-${dn(n)}`,
|
|
1199
1199
|
annotation: e,
|
|
1200
1200
|
type: i,
|
|
1201
1201
|
purpose: r,
|
|
1202
|
-
value:
|
|
1203
|
-
creator:
|
|
1204
|
-
created:
|
|
1202
|
+
value: s,
|
|
1203
|
+
creator: Ft(h),
|
|
1204
|
+
created: a ? new Date(a) : void 0,
|
|
1205
1205
|
updated: u ? new Date(u) : void 0,
|
|
1206
1206
|
...m
|
|
1207
1207
|
};
|
|
1208
1208
|
}), hn = (t) => t.map((e) => {
|
|
1209
1209
|
var n;
|
|
1210
|
-
const { annotation: o, created: i, updated: r, ...
|
|
1211
|
-
...
|
|
1210
|
+
const { annotation: o, created: i, updated: r, ...s } = e, a = {
|
|
1211
|
+
...s,
|
|
1212
1212
|
created: i == null ? void 0 : i.toISOString(),
|
|
1213
1213
|
modified: r == null ? void 0 : r.toISOString()
|
|
1214
1214
|
};
|
|
1215
|
-
return (n =
|
|
1215
|
+
return (n = a.id) != null && n.startsWith("temp-") && delete a.id, a;
|
|
1216
1216
|
});
|
|
1217
1217
|
cn();
|
|
1218
1218
|
const Un = (t, e) => ({
|
|
@@ -1225,27 +1225,27 @@ const Un = (t, e) => ({
|
|
|
1225
1225
|
created: o,
|
|
1226
1226
|
modified: i,
|
|
1227
1227
|
target: r
|
|
1228
|
-
} = t,
|
|
1229
|
-
creator:
|
|
1228
|
+
} = t, s = Array.isArray(r) ? r : [r], a = {
|
|
1229
|
+
creator: Ft(n),
|
|
1230
1230
|
created: o ? new Date(o) : void 0,
|
|
1231
1231
|
updated: i ? new Date(i) : void 0,
|
|
1232
1232
|
annotation: e,
|
|
1233
1233
|
selector: []
|
|
1234
1234
|
};
|
|
1235
|
-
for (const u of
|
|
1236
|
-
const m = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((l,
|
|
1237
|
-
switch (
|
|
1235
|
+
for (const u of s) {
|
|
1236
|
+
const m = (Array.isArray(u.selector) ? u.selector : [u.selector]).reduce((l, g) => {
|
|
1237
|
+
switch (g.type) {
|
|
1238
1238
|
case "TextQuoteSelector":
|
|
1239
|
-
l.quote =
|
|
1239
|
+
l.quote = g.exact;
|
|
1240
1240
|
break;
|
|
1241
1241
|
case "TextPositionSelector":
|
|
1242
|
-
l.start =
|
|
1242
|
+
l.start = g.start, l.end = g.end;
|
|
1243
1243
|
break;
|
|
1244
1244
|
}
|
|
1245
1245
|
return l;
|
|
1246
1246
|
}, {});
|
|
1247
1247
|
if (fn(m))
|
|
1248
|
-
|
|
1248
|
+
a.selector.push({ id: u.id, ...m });
|
|
1249
1249
|
else {
|
|
1250
1250
|
const l = [
|
|
1251
1251
|
m.start ? void 0 : "TextPositionSelector",
|
|
@@ -1254,44 +1254,44 @@ const Un = (t, e) => ({
|
|
|
1254
1254
|
return { error: Error(`Missing selector types: ${l.join(" and ")} for annotation: ${t.id}`) };
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
return { parsed:
|
|
1257
|
+
return { parsed: a };
|
|
1258
1258
|
}, pn = (t) => {
|
|
1259
|
-
const e = t.id ||
|
|
1259
|
+
const e = t.id || $t(), {
|
|
1260
1260
|
creator: n,
|
|
1261
1261
|
created: o,
|
|
1262
1262
|
modified: i,
|
|
1263
1263
|
body: r,
|
|
1264
|
-
...
|
|
1265
|
-
} = t,
|
|
1264
|
+
...s
|
|
1265
|
+
} = t, a = un(r, e), u = gn(t);
|
|
1266
1266
|
return "error" in u ? { error: u.error } : {
|
|
1267
1267
|
parsed: {
|
|
1268
|
-
...
|
|
1268
|
+
...s,
|
|
1269
1269
|
id: e,
|
|
1270
|
-
bodies:
|
|
1270
|
+
bodies: a,
|
|
1271
1271
|
target: u.parsed
|
|
1272
1272
|
}
|
|
1273
1273
|
};
|
|
1274
1274
|
}, mn = (t, e, n) => {
|
|
1275
1275
|
const { bodies: o, target: i, ...r } = t, {
|
|
1276
|
-
selector:
|
|
1277
|
-
creator:
|
|
1276
|
+
selector: s,
|
|
1277
|
+
creator: a,
|
|
1278
1278
|
created: u,
|
|
1279
|
-
updated:
|
|
1279
|
+
updated: h,
|
|
1280
1280
|
...m
|
|
1281
|
-
} = i, l =
|
|
1282
|
-
const { quote:
|
|
1281
|
+
} = i, l = s.map((g) => {
|
|
1282
|
+
const { quote: f, start: x, end: v, range: p } = g, { prefix: d, suffix: c } = oe(p, n), y = [{
|
|
1283
1283
|
type: "TextQuoteSelector",
|
|
1284
|
-
exact:
|
|
1284
|
+
exact: f,
|
|
1285
1285
|
prefix: d,
|
|
1286
1286
|
suffix: c
|
|
1287
1287
|
}, {
|
|
1288
1288
|
type: "TextPositionSelector",
|
|
1289
|
-
start:
|
|
1289
|
+
start: x,
|
|
1290
1290
|
end: v
|
|
1291
1291
|
}];
|
|
1292
1292
|
return {
|
|
1293
1293
|
...m,
|
|
1294
|
-
id:
|
|
1294
|
+
id: g.id,
|
|
1295
1295
|
source: e,
|
|
1296
1296
|
selector: y
|
|
1297
1297
|
};
|
|
@@ -1302,27 +1302,27 @@ const Un = (t, e) => ({
|
|
|
1302
1302
|
id: t.id,
|
|
1303
1303
|
type: "Annotation",
|
|
1304
1304
|
body: hn(t.bodies),
|
|
1305
|
-
creator:
|
|
1305
|
+
creator: a,
|
|
1306
1306
|
created: u == null ? void 0 : u.toISOString(),
|
|
1307
|
-
modified:
|
|
1307
|
+
modified: h == null ? void 0 : h.toISOString(),
|
|
1308
1308
|
target: l
|
|
1309
1309
|
};
|
|
1310
1310
|
};
|
|
1311
1311
|
function bn(t, e, n, o, i) {
|
|
1312
|
-
|
|
1312
|
+
zt(t, e, n || 0, o || t.length - 1, i || vn);
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1314
|
+
function zt(t, e, n, o, i) {
|
|
1315
1315
|
for (; o > n; ) {
|
|
1316
1316
|
if (o - n > 600) {
|
|
1317
|
-
var r = o - n + 1,
|
|
1318
|
-
|
|
1317
|
+
var r = o - n + 1, s = e - n + 1, a = Math.log(r), u = 0.5 * Math.exp(2 * a / 3), h = 0.5 * Math.sqrt(a * u * (r - u) / r) * (s - r / 2 < 0 ? -1 : 1), m = Math.max(n, Math.floor(e - s * u / r + h)), l = Math.min(o, Math.floor(e + (r - s) * u / r + h));
|
|
1318
|
+
zt(t, e, m, l, i);
|
|
1319
1319
|
}
|
|
1320
|
-
var
|
|
1321
|
-
for (j(t, n, e), i(t[o],
|
|
1322
|
-
for (j(t,
|
|
1323
|
-
for (; i(t[
|
|
1320
|
+
var g = t[e], f = n, x = o;
|
|
1321
|
+
for (j(t, n, e), i(t[o], g) > 0 && j(t, n, o); f < x; ) {
|
|
1322
|
+
for (j(t, f, x), f++, x--; i(t[f], g) < 0; ) f++;
|
|
1323
|
+
for (; i(t[x], g) > 0; ) x--;
|
|
1324
1324
|
}
|
|
1325
|
-
i(t[n],
|
|
1325
|
+
i(t[n], g) === 0 ? j(t, n, x) : (x++, j(t, x, o)), x <= e && (n = x + 1), e <= x && (o = x - 1);
|
|
1326
1326
|
}
|
|
1327
1327
|
}
|
|
1328
1328
|
function j(t, e, n) {
|
|
@@ -1345,9 +1345,9 @@ class yn {
|
|
|
1345
1345
|
if (!nt(e, n)) return o;
|
|
1346
1346
|
const i = this.toBBox, r = [];
|
|
1347
1347
|
for (; n; ) {
|
|
1348
|
-
for (let
|
|
1349
|
-
const
|
|
1350
|
-
nt(e, u) && (n.leaf ? o.push(
|
|
1348
|
+
for (let s = 0; s < n.children.length; s++) {
|
|
1349
|
+
const a = n.children[s], u = n.leaf ? i(a) : a;
|
|
1350
|
+
nt(e, u) && (n.leaf ? o.push(a) : gt(e, u) ? this._all(a, o) : r.push(a));
|
|
1351
1351
|
}
|
|
1352
1352
|
n = r.pop();
|
|
1353
1353
|
}
|
|
@@ -1359,9 +1359,9 @@ class yn {
|
|
|
1359
1359
|
const o = [];
|
|
1360
1360
|
for (; n; ) {
|
|
1361
1361
|
for (let i = 0; i < n.children.length; i++) {
|
|
1362
|
-
const r = n.children[i],
|
|
1363
|
-
if (nt(e,
|
|
1364
|
-
if (n.leaf || gt(e,
|
|
1362
|
+
const r = n.children[i], s = n.leaf ? this.toBBox(r) : r;
|
|
1363
|
+
if (nt(e, s)) {
|
|
1364
|
+
if (n.leaf || gt(e, s)) return !0;
|
|
1365
1365
|
o.push(r);
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
@@ -1399,15 +1399,15 @@ class yn {
|
|
|
1399
1399
|
remove(e, n) {
|
|
1400
1400
|
if (!e) return this;
|
|
1401
1401
|
let o = this.data;
|
|
1402
|
-
const i = this.toBBox(e), r = [],
|
|
1403
|
-
let
|
|
1402
|
+
const i = this.toBBox(e), r = [], s = [];
|
|
1403
|
+
let a, u, h;
|
|
1404
1404
|
for (; o || r.length; ) {
|
|
1405
|
-
if (o || (o = r.pop(), u = r[r.length - 1],
|
|
1405
|
+
if (o || (o = r.pop(), u = r[r.length - 1], a = s.pop(), h = !0), o.leaf) {
|
|
1406
1406
|
const m = wn(e, o.children, n);
|
|
1407
1407
|
if (m !== -1)
|
|
1408
1408
|
return o.children.splice(m, 1), r.push(o), this._condense(r), this;
|
|
1409
1409
|
}
|
|
1410
|
-
!
|
|
1410
|
+
!h && !o.leaf && gt(o, i) ? (r.push(o), s.push(a), a = 0, u = o, o = o.children[0]) : u ? (a++, o = u.children[a], h = !1) : o = null;
|
|
1411
1411
|
}
|
|
1412
1412
|
return this;
|
|
1413
1413
|
}
|
|
@@ -1434,36 +1434,36 @@ class yn {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
_build(e, n, o, i) {
|
|
1436
1436
|
const r = o - n + 1;
|
|
1437
|
-
let
|
|
1438
|
-
if (r <=
|
|
1439
|
-
return
|
|
1440
|
-
i || (i = Math.ceil(Math.log(r) / Math.log(
|
|
1441
|
-
const u = Math.ceil(r /
|
|
1442
|
-
Ut(e, n, o,
|
|
1443
|
-
for (let m = n; m <= o; m +=
|
|
1444
|
-
const l = Math.min(m +
|
|
1437
|
+
let s = this._maxEntries, a;
|
|
1438
|
+
if (r <= s)
|
|
1439
|
+
return a = W(e.slice(n, o + 1)), z(a, this.toBBox), a;
|
|
1440
|
+
i || (i = Math.ceil(Math.log(r) / Math.log(s)), s = Math.ceil(r / Math.pow(s, i - 1))), a = W([]), a.leaf = !1, a.height = i;
|
|
1441
|
+
const u = Math.ceil(r / s), h = u * Math.ceil(Math.sqrt(s));
|
|
1442
|
+
Ut(e, n, o, h, this.compareMinX);
|
|
1443
|
+
for (let m = n; m <= o; m += h) {
|
|
1444
|
+
const l = Math.min(m + h - 1, o);
|
|
1445
1445
|
Ut(e, m, l, u, this.compareMinY);
|
|
1446
|
-
for (let
|
|
1447
|
-
const
|
|
1448
|
-
|
|
1446
|
+
for (let g = m; g <= l; g += u) {
|
|
1447
|
+
const f = Math.min(g + u - 1, l);
|
|
1448
|
+
a.children.push(this._build(e, g, f, i - 1));
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
|
-
return
|
|
1451
|
+
return z(a, this.toBBox), a;
|
|
1452
1452
|
}
|
|
1453
1453
|
_chooseSubtree(e, n, o, i) {
|
|
1454
1454
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
1455
|
-
let r = 1 / 0,
|
|
1455
|
+
let r = 1 / 0, s = 1 / 0, a;
|
|
1456
1456
|
for (let u = 0; u < n.children.length; u++) {
|
|
1457
|
-
const
|
|
1458
|
-
l <
|
|
1457
|
+
const h = n.children[u], m = ft(h), l = En(e, h) - m;
|
|
1458
|
+
l < s ? (s = l, r = m < r ? m : r, a = h) : l === s && m < r && (r = m, a = h);
|
|
1459
1459
|
}
|
|
1460
|
-
n =
|
|
1460
|
+
n = a || n.children[0];
|
|
1461
1461
|
}
|
|
1462
1462
|
return n;
|
|
1463
1463
|
}
|
|
1464
1464
|
_insert(e, n, o) {
|
|
1465
|
-
const i = o ? e : this.toBBox(e), r = [],
|
|
1466
|
-
for (
|
|
1465
|
+
const i = o ? e : this.toBBox(e), r = [], s = this._chooseSubtree(i, this.data, n, r);
|
|
1466
|
+
for (s.children.push(e), K(s, i); n >= 0 && r[n].children.length > this._maxEntries; )
|
|
1467
1467
|
this._split(r, n), n--;
|
|
1468
1468
|
this._adjustParentBBoxes(i, r, n);
|
|
1469
1469
|
}
|
|
@@ -1471,38 +1471,38 @@ class yn {
|
|
|
1471
1471
|
_split(e, n) {
|
|
1472
1472
|
const o = e[n], i = o.children.length, r = this._minEntries;
|
|
1473
1473
|
this._chooseSplitAxis(o, r, i);
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1474
|
+
const s = this._chooseSplitIndex(o, r, i), a = W(o.children.splice(s, o.children.length - s));
|
|
1475
|
+
a.height = o.height, a.leaf = o.leaf, z(o, this.toBBox), z(a, this.toBBox), n ? e[n - 1].children.push(a) : this._splitRoot(o, a);
|
|
1476
1476
|
}
|
|
1477
1477
|
_splitRoot(e, n) {
|
|
1478
|
-
this.data = W([e, n]), this.data.height = e.height + 1, this.data.leaf = !1,
|
|
1478
|
+
this.data = W([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, z(this.data, this.toBBox);
|
|
1479
1479
|
}
|
|
1480
1480
|
_chooseSplitIndex(e, n, o) {
|
|
1481
|
-
let i, r = 1 / 0,
|
|
1482
|
-
for (let
|
|
1483
|
-
const u = G(e, 0,
|
|
1484
|
-
m < r ? (r = m, i =
|
|
1481
|
+
let i, r = 1 / 0, s = 1 / 0;
|
|
1482
|
+
for (let a = n; a <= o - n; a++) {
|
|
1483
|
+
const u = G(e, 0, a, this.toBBox), h = G(e, a, o, this.toBBox), m = Sn(u, h), l = ft(u) + ft(h);
|
|
1484
|
+
m < r ? (r = m, i = a, s = l < s ? l : s) : m === r && l < s && (s = l, i = a);
|
|
1485
1485
|
}
|
|
1486
1486
|
return i || o - n;
|
|
1487
1487
|
}
|
|
1488
1488
|
// sorts node children by the best axis for split
|
|
1489
1489
|
_chooseSplitAxis(e, n, o) {
|
|
1490
|
-
const i = e.leaf ? this.compareMinX : xn, r = e.leaf ? this.compareMinY : An,
|
|
1491
|
-
|
|
1490
|
+
const i = e.leaf ? this.compareMinX : xn, r = e.leaf ? this.compareMinY : An, s = this._allDistMargin(e, n, o, i), a = this._allDistMargin(e, n, o, r);
|
|
1491
|
+
s < a && e.children.sort(i);
|
|
1492
1492
|
}
|
|
1493
1493
|
// total margin of all possible split distributions where each node is at least m full
|
|
1494
1494
|
_allDistMargin(e, n, o, i) {
|
|
1495
1495
|
e.children.sort(i);
|
|
1496
|
-
const r = this.toBBox,
|
|
1497
|
-
let u = et(
|
|
1498
|
-
for (let
|
|
1499
|
-
const m = e.children[
|
|
1500
|
-
K(a, e.leaf ? r(m) : m), u += et(a);
|
|
1501
|
-
}
|
|
1502
|
-
for (let f = o - n - 1; f >= n; f--) {
|
|
1503
|
-
const m = e.children[f];
|
|
1496
|
+
const r = this.toBBox, s = G(e, 0, n, r), a = G(e, o - n, o, r);
|
|
1497
|
+
let u = et(s) + et(a);
|
|
1498
|
+
for (let h = n; h < o - n; h++) {
|
|
1499
|
+
const m = e.children[h];
|
|
1504
1500
|
K(s, e.leaf ? r(m) : m), u += et(s);
|
|
1505
1501
|
}
|
|
1502
|
+
for (let h = o - n - 1; h >= n; h--) {
|
|
1503
|
+
const m = e.children[h];
|
|
1504
|
+
K(a, e.leaf ? r(m) : m), u += et(a);
|
|
1505
|
+
}
|
|
1506
1506
|
return u;
|
|
1507
1507
|
}
|
|
1508
1508
|
_adjustParentBBoxes(e, n, o) {
|
|
@@ -1511,7 +1511,7 @@ class yn {
|
|
|
1511
1511
|
}
|
|
1512
1512
|
_condense(e) {
|
|
1513
1513
|
for (let n = e.length - 1, o; n >= 0; n--)
|
|
1514
|
-
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() :
|
|
1514
|
+
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : z(e[n], this.toBBox);
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
1517
1517
|
function wn(t, e, n) {
|
|
@@ -1520,14 +1520,14 @@ function wn(t, e, n) {
|
|
|
1520
1520
|
if (n(t, e[o])) return o;
|
|
1521
1521
|
return -1;
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1523
|
+
function z(t, e) {
|
|
1524
1524
|
G(t, 0, t.children.length, e, t);
|
|
1525
1525
|
}
|
|
1526
1526
|
function G(t, e, n, o, i) {
|
|
1527
1527
|
i || (i = W(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
1528
1528
|
for (let r = e; r < n; r++) {
|
|
1529
|
-
const
|
|
1530
|
-
K(i, t.leaf ? o(
|
|
1529
|
+
const s = t.children[r];
|
|
1530
|
+
K(i, t.leaf ? o(s) : s);
|
|
1531
1531
|
}
|
|
1532
1532
|
return i;
|
|
1533
1533
|
}
|
|
@@ -1574,41 +1574,41 @@ function Ut(t, e, n, o, i) {
|
|
|
1574
1574
|
const r = [e, n];
|
|
1575
1575
|
for (; r.length; ) {
|
|
1576
1576
|
if (n = r.pop(), e = r.pop(), n - e <= o) continue;
|
|
1577
|
-
const
|
|
1578
|
-
bn(t,
|
|
1577
|
+
const s = e + Math.ceil((n - e) / o / 2) * o;
|
|
1578
|
+
bn(t, s, e, n, i), r.push(e, s, s, n);
|
|
1579
1579
|
}
|
|
1580
1580
|
}
|
|
1581
1581
|
const Cn = (t, e) => {
|
|
1582
1582
|
const n = new yn(), o = /* @__PURE__ */ new Map(), i = (d, c) => {
|
|
1583
1583
|
const y = d.selector.flatMap((L) => {
|
|
1584
|
-
const E =
|
|
1584
|
+
const E = H([L]) ? L.range : Dt(L, e).range;
|
|
1585
1585
|
return Array.from(E.getClientRects());
|
|
1586
1586
|
}), C = ce(y).map(({ left: L, top: E, right: B, bottom: T }) => new DOMRect(L - c.left, E - c.top, B - L, T - E));
|
|
1587
1587
|
return C.map((L) => {
|
|
1588
|
-
const { x: E, y: B, width: T, height:
|
|
1588
|
+
const { x: E, y: B, width: T, height: M } = L;
|
|
1589
1589
|
return {
|
|
1590
1590
|
minX: E,
|
|
1591
1591
|
minY: B,
|
|
1592
1592
|
maxX: E + T,
|
|
1593
|
-
maxY: B +
|
|
1593
|
+
maxY: B + M,
|
|
1594
1594
|
annotation: {
|
|
1595
1595
|
id: d.annotation,
|
|
1596
1596
|
rects: C
|
|
1597
1597
|
}
|
|
1598
1598
|
};
|
|
1599
1599
|
});
|
|
1600
|
-
}, r = () => [...o.values()],
|
|
1600
|
+
}, r = () => [...o.values()], s = () => {
|
|
1601
1601
|
n.clear(), o.clear();
|
|
1602
|
-
},
|
|
1602
|
+
}, a = (d) => {
|
|
1603
1603
|
const c = i(d, e.getBoundingClientRect());
|
|
1604
1604
|
c.forEach((y) => n.insert(y)), o.set(d.annotation, c);
|
|
1605
1605
|
}, u = (d) => {
|
|
1606
1606
|
const c = o.get(d.annotation);
|
|
1607
1607
|
c && (c.forEach((y) => n.remove(y)), o.delete(d.annotation));
|
|
1608
|
-
},
|
|
1609
|
-
u(d),
|
|
1608
|
+
}, h = (d) => {
|
|
1609
|
+
u(d), a(d);
|
|
1610
1610
|
}, m = (d, c = !0) => {
|
|
1611
|
-
c &&
|
|
1611
|
+
c && s();
|
|
1612
1612
|
const y = e.getBoundingClientRect(), C = d.map((E) => ({ target: E, rects: i(E, y) }));
|
|
1613
1613
|
C.forEach(({ target: E, rects: B }) => o.set(E.annotation, B));
|
|
1614
1614
|
const L = C.flatMap(({ rects: E }) => E);
|
|
@@ -1622,8 +1622,8 @@ const Cn = (t, e) => {
|
|
|
1622
1622
|
}), C = (L) => L.annotation.rects.reduce((E, B) => E + B.width * B.height, 0);
|
|
1623
1623
|
if (y.length > 0)
|
|
1624
1624
|
return y.sort((L, E) => C(L) - C(E)), y[0].annotation.id;
|
|
1625
|
-
},
|
|
1626
|
-
const c =
|
|
1625
|
+
}, g = (d) => {
|
|
1626
|
+
const c = f(d);
|
|
1627
1627
|
if (c.length === 0)
|
|
1628
1628
|
return;
|
|
1629
1629
|
let y = c[0].left, C = c[0].top, L = c[0].right, E = c[0].bottom;
|
|
@@ -1632,80 +1632,80 @@ const Cn = (t, e) => {
|
|
|
1632
1632
|
y = Math.min(y, T.left), C = Math.min(C, T.top), L = Math.max(L, T.right), E = Math.max(E, T.bottom);
|
|
1633
1633
|
}
|
|
1634
1634
|
return new DOMRect(y, C, L - y, E - C);
|
|
1635
|
-
},
|
|
1635
|
+
}, f = (d) => {
|
|
1636
1636
|
const c = o.get(d);
|
|
1637
1637
|
return c ? c[0].annotation.rects : [];
|
|
1638
1638
|
};
|
|
1639
1639
|
return {
|
|
1640
1640
|
all: r,
|
|
1641
|
-
clear:
|
|
1641
|
+
clear: s,
|
|
1642
1642
|
getAt: l,
|
|
1643
|
-
getAnnotationBounds:
|
|
1644
|
-
getAnnotationRects:
|
|
1643
|
+
getAnnotationBounds: g,
|
|
1644
|
+
getAnnotationRects: f,
|
|
1645
1645
|
getIntersecting: (d, c, y, C) => {
|
|
1646
1646
|
const L = n.search({ minX: d, minY: c, maxX: y, maxY: C }), E = new Set(L.map((B) => B.annotation.id));
|
|
1647
1647
|
return Array.from(E).map((B) => ({
|
|
1648
1648
|
annotation: t.getAnnotation(B),
|
|
1649
|
-
rects:
|
|
1649
|
+
rects: f(B)
|
|
1650
1650
|
})).filter((B) => !!B.annotation);
|
|
1651
1651
|
},
|
|
1652
|
-
insert:
|
|
1652
|
+
insert: a,
|
|
1653
1653
|
recalculate: () => m(t.all().map((d) => d.target), !0),
|
|
1654
1654
|
remove: u,
|
|
1655
1655
|
set: m,
|
|
1656
1656
|
size: () => n.all().length,
|
|
1657
|
-
update:
|
|
1657
|
+
update: h
|
|
1658
1658
|
};
|
|
1659
1659
|
}, Ln = (t, e) => {
|
|
1660
|
-
const n = Ge(), o = Cn(n, t), i = ke(n, e), r = Ve(n),
|
|
1661
|
-
const d = rt(v, t), c =
|
|
1662
|
-
return c && n.addAnnotation(d,
|
|
1663
|
-
}, u = (v,
|
|
1664
|
-
const c = v.map((C) => rt(C, t)), y = c.filter((C) =>
|
|
1665
|
-
return y.length > 0 ? (console.warn("Could not revive all targets for these annotations:", y), n.bulkAddAnnotation(c,
|
|
1666
|
-
},
|
|
1667
|
-
const d = v.map((y) => rt(y, t)), c = d.filter((y) =>
|
|
1660
|
+
const n = Ge(), o = Cn(n, t), i = ke(n, e), r = Ve(n), s = Ze(), a = (v, p = N.LOCAL) => {
|
|
1661
|
+
const d = rt(v, t), c = H(d.target.selector);
|
|
1662
|
+
return c && n.addAnnotation(d, p), c;
|
|
1663
|
+
}, u = (v, p = !0, d = N.LOCAL) => {
|
|
1664
|
+
const c = v.map((C) => rt(C, t)), y = c.filter((C) => !H(C.target.selector));
|
|
1665
|
+
return y.length > 0 ? (console.warn("Could not revive all targets for these annotations:", y), n.bulkAddAnnotation(c, p, d), y) : (n.bulkAddAnnotation(c, p, d), []);
|
|
1666
|
+
}, h = (v, p = N.LOCAL) => {
|
|
1667
|
+
const d = v.map((y) => rt(y, t)), c = d.filter((y) => !H(y.target.selector));
|
|
1668
1668
|
return c.length > 0 && console.warn("Could not revive all targets for these annotations:", c), d.forEach((y) => {
|
|
1669
|
-
n.getAnnotation(y.id) ? n.updateAnnotation(y,
|
|
1669
|
+
n.getAnnotation(y.id) ? n.updateAnnotation(y, p) : n.addAnnotation(y, p);
|
|
1670
1670
|
}), c;
|
|
1671
|
-
}, m = (v,
|
|
1671
|
+
}, m = (v, p = N.LOCAL) => {
|
|
1672
1672
|
const d = it(v, t);
|
|
1673
|
-
n.updateTarget(d,
|
|
1674
|
-
}, l = (v,
|
|
1673
|
+
n.updateTarget(d, p);
|
|
1674
|
+
}, l = (v, p = N.LOCAL) => {
|
|
1675
1675
|
const d = v.map((c) => it(c, t));
|
|
1676
|
-
n.bulkUpdateTargets(d,
|
|
1677
|
-
},
|
|
1678
|
-
const d = o.getAt(v,
|
|
1676
|
+
n.bulkUpdateTargets(d, p);
|
|
1677
|
+
}, g = (v, p) => {
|
|
1678
|
+
const d = o.getAt(v, p);
|
|
1679
1679
|
return d ? n.getAnnotation(d) : void 0;
|
|
1680
|
-
},
|
|
1680
|
+
}, f = (v, p, d, c = 5) => {
|
|
1681
1681
|
const y = o.getAnnotationRects(v);
|
|
1682
1682
|
if (y.length !== 0) {
|
|
1683
|
-
if (
|
|
1684
|
-
const C = y.find(({ top: L, right: E, bottom: B, left: T }) =>
|
|
1683
|
+
if (p && d) {
|
|
1684
|
+
const C = y.find(({ top: L, right: E, bottom: B, left: T }) => p >= T - c && p <= E + c && d >= L - c && d <= B + c);
|
|
1685
1685
|
if (C) return C;
|
|
1686
1686
|
}
|
|
1687
1687
|
return o.getAnnotationBounds(v);
|
|
1688
1688
|
}
|
|
1689
|
-
},
|
|
1689
|
+
}, x = () => o.recalculate();
|
|
1690
1690
|
return n.observe(({ changes: v }) => {
|
|
1691
|
-
const
|
|
1692
|
-
(
|
|
1691
|
+
const p = (v.deleted || []).filter((y) => H(y.target.selector)), d = (v.created || []).filter((y) => H(y.target.selector)), c = (v.updated || []).filter((y) => H(y.newValue.target.selector));
|
|
1692
|
+
(p == null ? void 0 : p.length) > 0 && p.forEach((y) => o.remove(y.target)), d.length > 0 && o.set(d.map((y) => y.target), !1), (c == null ? void 0 : c.length) > 0 && c.forEach(({ newValue: y }) => o.update(y.target));
|
|
1693
1693
|
}), {
|
|
1694
1694
|
store: {
|
|
1695
1695
|
...n,
|
|
1696
|
-
addAnnotation:
|
|
1696
|
+
addAnnotation: a,
|
|
1697
1697
|
bulkAddAnnotation: u,
|
|
1698
1698
|
bulkUpdateTargets: l,
|
|
1699
|
-
bulkUpsertAnnotations:
|
|
1700
|
-
getAnnotationBounds:
|
|
1701
|
-
getAt:
|
|
1699
|
+
bulkUpsertAnnotations: h,
|
|
1700
|
+
getAnnotationBounds: f,
|
|
1701
|
+
getAt: g,
|
|
1702
1702
|
getIntersecting: o.getIntersecting,
|
|
1703
|
-
recalculatePositions:
|
|
1703
|
+
recalculatePositions: x,
|
|
1704
1704
|
updateTarget: m
|
|
1705
1705
|
},
|
|
1706
1706
|
selection: i,
|
|
1707
1707
|
hover: r,
|
|
1708
|
-
viewport:
|
|
1708
|
+
viewport: s
|
|
1709
1709
|
};
|
|
1710
1710
|
}, Bn = () => {
|
|
1711
1711
|
const t = document.createElement("canvas");
|
|
@@ -1715,27 +1715,27 @@ const Cn = (t, e) => {
|
|
|
1715
1715
|
}, Tn = (t, e, n = {}) => {
|
|
1716
1716
|
const o = Bn(), i = o.getContext("2d");
|
|
1717
1717
|
t.appendChild(o);
|
|
1718
|
-
const r = /* @__PURE__ */ new Map(),
|
|
1719
|
-
return e.on("selectionChange", (l,
|
|
1720
|
-
|
|
1718
|
+
const r = /* @__PURE__ */ new Map(), s = (l) => Array.from(r.entries()).filter(([g, f]) => f.presenceKey === l.presenceKey).map(([g, f]) => g);
|
|
1719
|
+
return e.on("selectionChange", (l, g) => {
|
|
1720
|
+
s(l).forEach((x) => r.delete(x)), g && g.forEach((x) => r.set(x, l));
|
|
1721
1721
|
}), {
|
|
1722
1722
|
clear: () => {
|
|
1723
|
-
const { width: l, height:
|
|
1724
|
-
i.clearRect(-0.5, -0.5, l + 1,
|
|
1723
|
+
const { width: l, height: g } = o;
|
|
1724
|
+
i.clearRect(-0.5, -0.5, l + 1, g + 1);
|
|
1725
1725
|
},
|
|
1726
1726
|
destroy: () => {
|
|
1727
1727
|
o.remove();
|
|
1728
1728
|
},
|
|
1729
|
-
paint: (l,
|
|
1729
|
+
paint: (l, g, f) => {
|
|
1730
1730
|
n.font && (i.font = n.font);
|
|
1731
|
-
const
|
|
1732
|
-
if (
|
|
1733
|
-
const { height: v } = l.rects[0],
|
|
1734
|
-
i.fillStyle =
|
|
1735
|
-
const c = i.measureText(
|
|
1736
|
-
return i.fillRect(
|
|
1737
|
-
fill:
|
|
1738
|
-
fillOpacity:
|
|
1731
|
+
const x = r.get(l.annotation.id);
|
|
1732
|
+
if (x) {
|
|
1733
|
+
const { height: v } = l.rects[0], p = l.rects[0].x + g.left, d = l.rects[0].y + g.top;
|
|
1734
|
+
i.fillStyle = x.appearance.color, i.fillRect(p - 2, d - 2.5, 2, v + 5);
|
|
1735
|
+
const c = i.measureText(x.appearance.label), y = c.width + 6, C = c.actualBoundingBoxAscent + c.actualBoundingBoxDescent + 8, L = c.fontBoundingBoxAscent ? 8 : 6.5;
|
|
1736
|
+
return i.fillRect(p - 2, d - 2.5 - C, y, C), i.fillStyle = "#fff", i.fillText(x.appearance.label, p + 1, d - L), {
|
|
1737
|
+
fill: x.appearance.color,
|
|
1738
|
+
fillOpacity: f ? 0.45 : 0.18
|
|
1739
1739
|
};
|
|
1740
1740
|
}
|
|
1741
1741
|
},
|
|
@@ -1751,17 +1751,17 @@ const Cn = (t, e) => {
|
|
|
1751
1751
|
const { overflowY: e } = window.getComputedStyle(t);
|
|
1752
1752
|
return e !== "visible" && e !== "hidden" && t.scrollHeight > t.clientHeight ? t : Wt(t.parentElement);
|
|
1753
1753
|
}, Rn = (t, e) => (n) => {
|
|
1754
|
-
const o = typeof n == "string" ? n : n.id, i = (
|
|
1755
|
-
const
|
|
1754
|
+
const o = typeof n == "string" ? n : n.id, i = (s) => {
|
|
1755
|
+
const a = r.getBoundingClientRect(), u = r.clientHeight, h = r.clientWidth, m = s.selector[0].range.getBoundingClientRect(), { width: l, height: g } = e.getAnnotationBounds(o), f = m.top - a.top, x = m.left - a.left, v = r.parentElement ? r.scrollTop : 0, p = r.parentElement ? r.scrollLeft : 0, d = f + v - (u - g) / 2, c = x + p - (h - l) / 2;
|
|
1756
1756
|
r.scroll({ top: d, left: c, behavior: "smooth" });
|
|
1757
1757
|
}, r = Wt(t);
|
|
1758
1758
|
if (r) {
|
|
1759
|
-
const
|
|
1760
|
-
if (
|
|
1761
|
-
return i(
|
|
1759
|
+
const s = e.getAnnotation(o), { range: a } = s.target.selector[0];
|
|
1760
|
+
if (a && !a.collapsed)
|
|
1761
|
+
return i(s.target), !0;
|
|
1762
1762
|
{
|
|
1763
|
-
const u = it(
|
|
1764
|
-
if (
|
|
1763
|
+
const u = it(s.target, t), { range: h } = u.selector[0];
|
|
1764
|
+
if (h && !h.collapsed)
|
|
1765
1765
|
return i(u), !0;
|
|
1766
1766
|
}
|
|
1767
1767
|
}
|
|
@@ -1770,92 +1770,96 @@ const Cn = (t, e) => {
|
|
|
1770
1770
|
...t,
|
|
1771
1771
|
annotationEnabled: t.annotationEnabled === void 0 ? e.annotationEnabled : t.annotationEnabled
|
|
1772
1772
|
}), Mn = (t, e, n, o) => {
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1773
|
+
let i;
|
|
1774
|
+
const r = (c) => i = c;
|
|
1775
|
+
let s;
|
|
1776
|
+
const a = (c) => s = c, { store: u, selection: h } = e;
|
|
1777
|
+
let m, l = !1, g;
|
|
1778
|
+
const f = (c) => {
|
|
1779
|
+
var C;
|
|
1780
|
+
if (!l) return;
|
|
1781
|
+
!((C = c.target.parentElement) != null && C.closest(D)) ? m = {
|
|
1782
|
+
annotation: $t(),
|
|
1782
1783
|
selector: [],
|
|
1783
|
-
creator:
|
|
1784
|
+
creator: i,
|
|
1784
1785
|
created: /* @__PURE__ */ new Date()
|
|
1785
|
-
} :
|
|
1786
|
+
} : m = void 0;
|
|
1786
1787
|
};
|
|
1787
|
-
n && t.addEventListener("selectstart",
|
|
1788
|
-
const
|
|
1789
|
-
var
|
|
1790
|
-
const
|
|
1791
|
-
if (!!((
|
|
1792
|
-
|
|
1788
|
+
n && t.addEventListener("selectstart", f);
|
|
1789
|
+
const x = bt((c) => {
|
|
1790
|
+
var T, M;
|
|
1791
|
+
const y = document.getSelection();
|
|
1792
|
+
if (!!((M = (T = y.anchorNode) == null ? void 0 : T.parentElement) != null && M.closest(D))) {
|
|
1793
|
+
m = void 0;
|
|
1793
1794
|
return;
|
|
1794
1795
|
}
|
|
1795
|
-
if (
|
|
1796
|
-
const
|
|
1797
|
-
if (re(
|
|
1798
|
-
const
|
|
1799
|
-
(
|
|
1800
|
-
var
|
|
1801
|
-
return
|
|
1802
|
-
})) && (
|
|
1803
|
-
...
|
|
1804
|
-
selector:
|
|
1796
|
+
if (c.timeStamp - ((g == null ? void 0 : g.timeStamp) || c.timeStamp) < 1e3 && !m && f(g), y.isCollapsed || !l || !m) return;
|
|
1797
|
+
const L = y.getRangeAt(0);
|
|
1798
|
+
if (re(L)) return;
|
|
1799
|
+
const E = Zt(L.cloneRange());
|
|
1800
|
+
(E.length !== m.selector.length || E.some((b, w) => {
|
|
1801
|
+
var A;
|
|
1802
|
+
return b.toString() !== ((A = m.selector[w]) == null ? void 0 : A.quote);
|
|
1803
|
+
})) && (m = {
|
|
1804
|
+
...m,
|
|
1805
|
+
selector: E.map((b) => le(b, t, o)),
|
|
1805
1806
|
updated: /* @__PURE__ */ new Date()
|
|
1806
|
-
},
|
|
1807
|
-
id:
|
|
1807
|
+
}, u.getAnnotation(m.annotation) ? u.updateTarget(m, N.LOCAL) : (h.clear(), u.addAnnotation({
|
|
1808
|
+
id: m.annotation,
|
|
1808
1809
|
bodies: [],
|
|
1809
|
-
target:
|
|
1810
|
-
}),
|
|
1810
|
+
target: m
|
|
1811
|
+
}), h.clickSelect(m.annotation, g)));
|
|
1811
1812
|
});
|
|
1812
|
-
n && document.addEventListener("selectionchange",
|
|
1813
|
-
const
|
|
1814
|
-
const { target:
|
|
1815
|
-
|
|
1813
|
+
n && document.addEventListener("selectionchange", x);
|
|
1814
|
+
const v = (c) => {
|
|
1815
|
+
const { target: y, timeStamp: C, offsetX: L, offsetY: E, type: B } = c;
|
|
1816
|
+
g = { ...c, target: y, timeStamp: C, offsetX: L, offsetY: E, type: B }, l = c.button === 0;
|
|
1816
1817
|
};
|
|
1817
|
-
t.addEventListener("pointerdown",
|
|
1818
|
-
const
|
|
1819
|
-
var
|
|
1820
|
-
if (!!((
|
|
1818
|
+
t.addEventListener("pointerdown", v);
|
|
1819
|
+
const p = (c) => {
|
|
1820
|
+
var E;
|
|
1821
|
+
if (!!((E = c.target.parentElement) != null && E.closest(D)) || !l)
|
|
1821
1822
|
return;
|
|
1822
|
-
const
|
|
1823
|
-
const { x:
|
|
1824
|
-
if (
|
|
1825
|
-
const { selected:
|
|
1826
|
-
(
|
|
1827
|
-
} else
|
|
1828
|
-
},
|
|
1829
|
-
document.getSelection().isCollapsed &&
|
|
1823
|
+
const C = () => {
|
|
1824
|
+
const { x: B, y: T } = t.getBoundingClientRect(), M = u.getAt(c.clientX - B, c.clientY - T);
|
|
1825
|
+
if (M && (!s || s(M))) {
|
|
1826
|
+
const { selected: w } = h;
|
|
1827
|
+
(w.length !== 1 || w[0].id !== M.id) && h.clickSelect(M.id, c);
|
|
1828
|
+
} else h.isEmpty() || h.clear();
|
|
1829
|
+
}, L = c.timeStamp - g.timeStamp;
|
|
1830
|
+
document.getSelection().isCollapsed && L < 300 ? (m = void 0, C()) : m && h.clickSelect(m.annotation, c);
|
|
1830
1831
|
};
|
|
1831
|
-
return document.addEventListener("pointerup",
|
|
1832
|
+
return document.addEventListener("pointerup", p), {
|
|
1832
1833
|
destroy: () => {
|
|
1833
|
-
t.removeEventListener("selectstart",
|
|
1834
|
+
t.removeEventListener("selectstart", f), document.removeEventListener("selectionchange", x), t.removeEventListener("pointerdown", v), document.removeEventListener("pointerup", p);
|
|
1834
1835
|
},
|
|
1835
|
-
|
|
1836
|
+
setFilter: a,
|
|
1837
|
+
setUser: r
|
|
1836
1838
|
};
|
|
1837
1839
|
}, kt = "SPANS", kn = (t, e = {}) => {
|
|
1838
1840
|
te(t);
|
|
1839
1841
|
const n = Nn(e, {
|
|
1840
1842
|
annotationEnabled: !0
|
|
1841
|
-
}), o = Ln(t, n.pointerAction), { selection: i, viewport: r } = o,
|
|
1842
|
-
let
|
|
1843
|
+
}), o = Ln(t, n.pointerAction), { selection: i, viewport: r } = o, s = o.store, a = Je(s), u = tn(o, a, n.adapter);
|
|
1844
|
+
let h = ln();
|
|
1843
1845
|
const m = n.renderer === "CSS_HIGHLIGHTS" ? CSS.highlights ? "CSS_HIGHLIGHTS" : kt : n.renderer || kt, l = m === "SPANS" ? Te(t, o, r) : m === "CSS_HIGHLIGHTS" ? Ce(t, o, r) : m === "CANVAS" ? pe(t, o, r) : void 0;
|
|
1844
1846
|
if (!l)
|
|
1845
1847
|
throw `Unknown renderer implementation: ${m}`;
|
|
1846
1848
|
console.debug(`Using ${m} renderer`), n.style && l.setStyle(n.style);
|
|
1847
|
-
const
|
|
1848
|
-
return
|
|
1849
|
-
...nn(o,
|
|
1849
|
+
const g = Mn(t, o, n.annotationEnabled, n.offsetReferenceSelector);
|
|
1850
|
+
return g.setUser(h), {
|
|
1851
|
+
...nn(o, a, n.adapter),
|
|
1850
1852
|
destroy: () => {
|
|
1851
|
-
l.destroy(),
|
|
1853
|
+
l.destroy(), g.destroy(), a.destroy();
|
|
1852
1854
|
},
|
|
1853
1855
|
element: t,
|
|
1854
|
-
getUser: () =>
|
|
1855
|
-
setFilter: (E) =>
|
|
1856
|
+
getUser: () => h,
|
|
1857
|
+
setFilter: (E) => {
|
|
1858
|
+
l.setFilter(E), g.setFilter(E);
|
|
1859
|
+
},
|
|
1856
1860
|
setStyle: (E) => l.setStyle(E),
|
|
1857
1861
|
setUser: (E) => {
|
|
1858
|
-
|
|
1862
|
+
h = E, g.setUser(E);
|
|
1859
1863
|
},
|
|
1860
1864
|
setSelected: (E) => {
|
|
1861
1865
|
E ? i.setSelected(E) : i.clear();
|
|
@@ -1866,7 +1870,7 @@ const Cn = (t, e) => {
|
|
|
1866
1870
|
setVisible: (E) => l.setVisible(E),
|
|
1867
1871
|
on: u.on,
|
|
1868
1872
|
off: u.off,
|
|
1869
|
-
scrollIntoView: Rn(t,
|
|
1873
|
+
scrollIntoView: Rn(t, s),
|
|
1870
1874
|
state: o
|
|
1871
1875
|
};
|
|
1872
1876
|
};
|
|
@@ -1892,7 +1896,7 @@ export {
|
|
|
1892
1896
|
In as getClientRectsPonyfill,
|
|
1893
1897
|
oe as getQuoteContext,
|
|
1894
1898
|
pt as getRangeAnnotatableContents,
|
|
1895
|
-
|
|
1899
|
+
H as isRevived,
|
|
1896
1900
|
re as isWhitespaceOrEmpty,
|
|
1897
1901
|
ce as mergeClientRects,
|
|
1898
1902
|
Kt as paint,
|