@annotorious/annotorious 3.0.0-rc.7 → 3.0.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/annotorious.es.js +1305 -1583
- package/dist/annotorious.es.js.map +1 -1
- package/dist/annotorious.js +1 -1
- package/dist/annotorious.js.map +1 -1
- package/dist/index.d.ts +1 -7
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -4
- package/src/index.ts +24 -16
package/dist/annotorious.es.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
function
|
|
1
|
+
function F() {
|
|
2
2
|
}
|
|
3
|
-
function
|
|
3
|
+
function $t(e, t) {
|
|
4
4
|
for (const n in t)
|
|
5
5
|
e[n] = t[n];
|
|
6
6
|
return e;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Nt(e) {
|
|
9
9
|
return e();
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function ft() {
|
|
12
12
|
return /* @__PURE__ */ Object.create(null);
|
|
13
13
|
}
|
|
14
14
|
function ie(e) {
|
|
15
|
-
e.forEach(
|
|
15
|
+
e.forEach(Nt);
|
|
16
16
|
}
|
|
17
17
|
function j(e) {
|
|
18
18
|
return typeof e == "function";
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function J(e, t) {
|
|
21
21
|
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function en(e) {
|
|
24
24
|
return Object.keys(e).length === 0;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Vt(e, ...t) {
|
|
27
27
|
if (e == null)
|
|
28
|
-
return
|
|
28
|
+
return F;
|
|
29
29
|
const n = e.subscribe(...t);
|
|
30
30
|
return n.unsubscribe ? () => n.unsubscribe() : n;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
e.$$.on_destroy.push(
|
|
32
|
+
function dt(e, t, n) {
|
|
33
|
+
e.$$.on_destroy.push(Vt(t, n));
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function tn(e, t, n, o) {
|
|
36
36
|
if (e) {
|
|
37
|
-
const i =
|
|
37
|
+
const i = Gt(e, t, n, o);
|
|
38
38
|
return e[0](i);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
return e[1] && o ?
|
|
41
|
+
function Gt(e, t, n, o) {
|
|
42
|
+
return e[1] && o ? $t(n.ctx.slice(), e[1](o(t))) : n.ctx;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function nn(e, t, n, o) {
|
|
45
45
|
if (e[2] && o) {
|
|
46
46
|
const i = e[2](o(n));
|
|
47
47
|
if (t.dirty === void 0)
|
|
@@ -56,13 +56,13 @@ function rn(e, t, n, o) {
|
|
|
56
56
|
}
|
|
57
57
|
return t.dirty;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function on(e, t, n, o, i, s) {
|
|
60
60
|
if (i) {
|
|
61
|
-
const r =
|
|
61
|
+
const r = Gt(t, n, o, s);
|
|
62
62
|
e.p(r, i);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function sn(e) {
|
|
66
66
|
if (e.ctx.length > 32) {
|
|
67
67
|
const t = [], n = e.ctx.length / 32;
|
|
68
68
|
for (let o = 0; o < n; o++)
|
|
@@ -74,62 +74,62 @@ function an(e) {
|
|
|
74
74
|
function re(e, t) {
|
|
75
75
|
e.appendChild(t);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function I(e, t, n) {
|
|
78
78
|
e.insertBefore(t, n || null);
|
|
79
79
|
}
|
|
80
80
|
function k(e) {
|
|
81
81
|
e.parentNode && e.parentNode.removeChild(e);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function st(e, t) {
|
|
84
84
|
for (let n = 0; n < e.length; n += 1)
|
|
85
85
|
e[n] && e[n].d(t);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function R(e) {
|
|
88
88
|
return document.createElementNS("http://www.w3.org/2000/svg", e);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Ft(e) {
|
|
91
91
|
return document.createTextNode(e);
|
|
92
92
|
}
|
|
93
93
|
function $() {
|
|
94
|
-
return
|
|
94
|
+
return Ft(" ");
|
|
95
95
|
}
|
|
96
96
|
function se() {
|
|
97
|
-
return
|
|
97
|
+
return Ft("");
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function K(e, t, n, o) {
|
|
100
100
|
return e.addEventListener(t, n, o), () => e.removeEventListener(t, n, o);
|
|
101
101
|
}
|
|
102
102
|
function f(e, t, n) {
|
|
103
103
|
n == null ? e.removeAttribute(t) : e.getAttribute(t) !== n && e.setAttribute(t, n);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function rn(e) {
|
|
106
106
|
return Array.from(e.childNodes);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function ht(e, t, n) {
|
|
109
109
|
e.classList[n ? "add" : "remove"](t);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function ln(e, t, { bubbles: n = !1, cancelable: o = !1 } = {}) {
|
|
112
112
|
const i = document.createEvent("CustomEvent");
|
|
113
113
|
return i.initCustomEvent(e, n, o, t), i;
|
|
114
114
|
}
|
|
115
115
|
let Ie;
|
|
116
|
-
function
|
|
116
|
+
function ke(e) {
|
|
117
117
|
Ie = e;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function Ht() {
|
|
120
120
|
if (!Ie)
|
|
121
121
|
throw new Error("Function called outside component initialization");
|
|
122
122
|
return Ie;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
124
|
+
function Be(e) {
|
|
125
|
+
Ht().$$.on_mount.push(e);
|
|
126
126
|
}
|
|
127
127
|
function Se() {
|
|
128
|
-
const e =
|
|
128
|
+
const e = Ht();
|
|
129
129
|
return (t, n, { cancelable: o = !1 } = {}) => {
|
|
130
130
|
const i = e.$$.callbacks[t];
|
|
131
131
|
if (i) {
|
|
132
|
-
const s =
|
|
132
|
+
const s = ln(t, n, { cancelable: o });
|
|
133
133
|
return i.slice().forEach((r) => {
|
|
134
134
|
r.call(e, s);
|
|
135
135
|
}), !s.defaultPrevented;
|
|
@@ -141,19 +141,19 @@ function Ae(e, t) {
|
|
|
141
141
|
const n = e.$$.callbacks[t.type];
|
|
142
142
|
n && n.slice().forEach((o) => o.call(this, t));
|
|
143
143
|
}
|
|
144
|
-
const be = [],
|
|
144
|
+
const be = [], Ge = [];
|
|
145
145
|
let Te = [];
|
|
146
|
-
const
|
|
147
|
-
let
|
|
148
|
-
function
|
|
149
|
-
|
|
146
|
+
const mt = [], an = /* @__PURE__ */ Promise.resolve();
|
|
147
|
+
let tt = !1;
|
|
148
|
+
function cn() {
|
|
149
|
+
tt || (tt = !0, an.then(zt));
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function nt(e) {
|
|
152
152
|
Te.push(e);
|
|
153
153
|
}
|
|
154
154
|
const Ke = /* @__PURE__ */ new Set();
|
|
155
155
|
let pe = 0;
|
|
156
|
-
function
|
|
156
|
+
function zt() {
|
|
157
157
|
if (pe !== 0)
|
|
158
158
|
return;
|
|
159
159
|
const e = Ie;
|
|
@@ -161,55 +161,55 @@ function Jt() {
|
|
|
161
161
|
try {
|
|
162
162
|
for (; pe < be.length; ) {
|
|
163
163
|
const t = be[pe];
|
|
164
|
-
pe++,
|
|
164
|
+
pe++, ke(t), un(t.$$);
|
|
165
165
|
}
|
|
166
166
|
} catch (t) {
|
|
167
167
|
throw be.length = 0, pe = 0, t;
|
|
168
168
|
}
|
|
169
|
-
for (
|
|
170
|
-
|
|
169
|
+
for (ke(null), be.length = 0, pe = 0; Ge.length; )
|
|
170
|
+
Ge.pop()();
|
|
171
171
|
for (let t = 0; t < Te.length; t += 1) {
|
|
172
172
|
const n = Te[t];
|
|
173
173
|
Ke.has(n) || (Ke.add(n), n());
|
|
174
174
|
}
|
|
175
175
|
Te.length = 0;
|
|
176
176
|
} while (be.length);
|
|
177
|
-
for (;
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
for (; mt.length; )
|
|
178
|
+
mt.pop()();
|
|
179
|
+
tt = !1, Ke.clear(), ke(e);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function un(e) {
|
|
182
182
|
if (e.fragment !== null) {
|
|
183
183
|
e.update(), ie(e.before_update);
|
|
184
184
|
const t = e.dirty;
|
|
185
|
-
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(
|
|
185
|
+
e.dirty = [-1], e.fragment && e.fragment.p(e.ctx, t), e.after_update.forEach(nt);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function fn(e) {
|
|
189
189
|
const t = [], n = [];
|
|
190
190
|
Te.forEach((o) => e.indexOf(o) === -1 ? t.push(o) : n.push(o)), n.forEach((o) => o()), Te = t;
|
|
191
191
|
}
|
|
192
192
|
const Ve = /* @__PURE__ */ new Set();
|
|
193
|
-
let
|
|
193
|
+
let fe;
|
|
194
194
|
function ne() {
|
|
195
|
-
|
|
195
|
+
fe = {
|
|
196
196
|
r: 0,
|
|
197
197
|
c: [],
|
|
198
|
-
p:
|
|
198
|
+
p: fe
|
|
199
199
|
// parent group
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
function oe() {
|
|
203
|
-
|
|
203
|
+
fe.r || ie(fe.c), fe = fe.p;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function C(e, t) {
|
|
206
206
|
e && e.i && (Ve.delete(e), e.i(t));
|
|
207
207
|
}
|
|
208
208
|
function N(e, t, n, o) {
|
|
209
209
|
if (e && e.o) {
|
|
210
210
|
if (Ve.has(e))
|
|
211
211
|
return;
|
|
212
|
-
Ve.add(e),
|
|
212
|
+
Ve.add(e), fe.c.push(() => {
|
|
213
213
|
Ve.delete(e), o && (n && e.d(1), o());
|
|
214
214
|
}), e.o(t);
|
|
215
215
|
} else
|
|
@@ -220,29 +220,29 @@ function he(e) {
|
|
|
220
220
|
}
|
|
221
221
|
function le(e, t, n, o) {
|
|
222
222
|
const { fragment: i, after_update: s } = e.$$;
|
|
223
|
-
i && i.m(t, n), o ||
|
|
224
|
-
const r = e.$$.on_mount.map(
|
|
223
|
+
i && i.m(t, n), o || nt(() => {
|
|
224
|
+
const r = e.$$.on_mount.map(Nt).filter(j);
|
|
225
225
|
e.$$.on_destroy ? e.$$.on_destroy.push(...r) : ie(r), e.$$.on_mount = [];
|
|
226
|
-
}), s.forEach(
|
|
226
|
+
}), s.forEach(nt);
|
|
227
227
|
}
|
|
228
228
|
function ae(e, t) {
|
|
229
229
|
const n = e.$$;
|
|
230
|
-
n.fragment !== null && (
|
|
230
|
+
n.fragment !== null && (fn(n.after_update), ie(n.on_destroy), n.fragment && n.fragment.d(t), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
e.$$.dirty[0] === -1 && (be.push(e),
|
|
232
|
+
function dn(e, t) {
|
|
233
|
+
e.$$.dirty[0] === -1 && (be.push(e), cn(), e.$$.dirty.fill(0)), e.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
234
234
|
}
|
|
235
235
|
function ee(e, t, n, o, i, s, r, a = [-1]) {
|
|
236
236
|
const l = Ie;
|
|
237
|
-
|
|
238
|
-
const
|
|
237
|
+
ke(e);
|
|
238
|
+
const c = e.$$ = {
|
|
239
239
|
fragment: null,
|
|
240
240
|
ctx: [],
|
|
241
241
|
// state
|
|
242
242
|
props: s,
|
|
243
|
-
update:
|
|
243
|
+
update: F,
|
|
244
244
|
not_equal: i,
|
|
245
|
-
bound:
|
|
245
|
+
bound: ft(),
|
|
246
246
|
// lifecycle
|
|
247
247
|
on_mount: [],
|
|
248
248
|
on_destroy: [],
|
|
@@ -251,33 +251,33 @@ function ee(e, t, n, o, i, s, r, a = [-1]) {
|
|
|
251
251
|
after_update: [],
|
|
252
252
|
context: new Map(t.context || (l ? l.$$.context : [])),
|
|
253
253
|
// everything else
|
|
254
|
-
callbacks:
|
|
254
|
+
callbacks: ft(),
|
|
255
255
|
dirty: a,
|
|
256
256
|
skip_bound: !1,
|
|
257
257
|
root: t.target || l.$$.root
|
|
258
258
|
};
|
|
259
|
-
r && r(
|
|
259
|
+
r && r(c.root);
|
|
260
260
|
let h = !1;
|
|
261
|
-
if (
|
|
262
|
-
const
|
|
263
|
-
return
|
|
264
|
-
}) : [],
|
|
261
|
+
if (c.ctx = n ? n(e, t.props || {}, (u, m, ...d) => {
|
|
262
|
+
const g = d.length ? d[0] : m;
|
|
263
|
+
return c.ctx && i(c.ctx[u], c.ctx[u] = g) && (!c.skip_bound && c.bound[u] && c.bound[u](g), h && dn(e, u)), m;
|
|
264
|
+
}) : [], c.update(), h = !0, ie(c.before_update), c.fragment = o ? o(c.ctx) : !1, t.target) {
|
|
265
265
|
if (t.hydrate) {
|
|
266
|
-
const
|
|
267
|
-
|
|
266
|
+
const u = rn(t.target);
|
|
267
|
+
c.fragment && c.fragment.l(u), u.forEach(k);
|
|
268
268
|
} else
|
|
269
|
-
|
|
270
|
-
t.intro &&
|
|
269
|
+
c.fragment && c.fragment.c();
|
|
270
|
+
t.intro && C(e.$$.fragment), le(e, t.target, t.anchor, t.customElement), zt();
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
ke(l);
|
|
273
273
|
}
|
|
274
274
|
class te {
|
|
275
275
|
$destroy() {
|
|
276
|
-
ae(this, 1), this.$destroy =
|
|
276
|
+
ae(this, 1), this.$destroy = F;
|
|
277
277
|
}
|
|
278
278
|
$on(t, n) {
|
|
279
279
|
if (!j(n))
|
|
280
|
-
return
|
|
280
|
+
return F;
|
|
281
281
|
const o = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
|
|
282
282
|
return o.push(n), () => {
|
|
283
283
|
const i = o.indexOf(n);
|
|
@@ -285,24 +285,24 @@ class te {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
$set(t) {
|
|
288
|
-
this.$$set && !
|
|
288
|
+
this.$$set && !en(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
var
|
|
292
|
-
const
|
|
291
|
+
var z = /* @__PURE__ */ ((e) => (e.ELLIPSE = "ELLIPSE", e.POLYGON = "POLYGON", e.RECTANGLE = "RECTANGLE", e))(z || {});
|
|
292
|
+
const rt = {}, lt = (e, t) => rt[e] = t, ot = (e) => rt[e.type].area(e), hn = (e, t, n) => rt[e.type].intersects(e, t, n), Fe = (e) => {
|
|
293
293
|
let t = 1 / 0, n = 1 / 0, o = -1 / 0, i = -1 / 0;
|
|
294
294
|
return e.forEach(([s, r]) => {
|
|
295
295
|
t = Math.min(t, s), n = Math.min(n, r), o = Math.max(o, s), i = Math.max(i, r);
|
|
296
296
|
}), { minX: t, minY: n, maxX: o, maxY: i };
|
|
297
|
-
},
|
|
297
|
+
}, mn = {
|
|
298
298
|
area: (e) => Math.PI * e.geometry.rx * e.geometry.ry,
|
|
299
299
|
intersects: (e, t, n) => {
|
|
300
|
-
const { cx: o, cy: i, rx: s, ry: r } = e.geometry, a = 0, l = Math.cos(a),
|
|
301
|
-
return
|
|
300
|
+
const { cx: o, cy: i, rx: s, ry: r } = e.geometry, a = 0, l = Math.cos(a), c = Math.sin(a), h = t - o, u = n - i, m = l * h + c * u, d = c * h - l * u;
|
|
301
|
+
return m * m / (s * s) + d * d / (r * r) <= 1;
|
|
302
302
|
}
|
|
303
303
|
};
|
|
304
|
-
|
|
305
|
-
const
|
|
304
|
+
lt(z.ELLIPSE, mn);
|
|
305
|
+
const gn = {
|
|
306
306
|
area: (e) => {
|
|
307
307
|
const { points: t } = e.geometry;
|
|
308
308
|
let n = 0, o = t.length - 1;
|
|
@@ -314,81 +314,81 @@ const _n = {
|
|
|
314
314
|
const { points: o } = e.geometry;
|
|
315
315
|
let i = !1;
|
|
316
316
|
for (let s = 0, r = o.length - 1; s < o.length; r = s++) {
|
|
317
|
-
const a = o[s][0], l = o[s][1],
|
|
318
|
-
l > n != h > n && t < (
|
|
317
|
+
const a = o[s][0], l = o[s][1], c = o[r][0], h = o[r][1];
|
|
318
|
+
l > n != h > n && t < (c - a) * (n - l) / (h - l) + a && (i = !i);
|
|
319
319
|
}
|
|
320
320
|
return i;
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
|
-
|
|
324
|
-
const
|
|
323
|
+
lt(z.POLYGON, gn);
|
|
324
|
+
const pn = {
|
|
325
325
|
area: (e) => e.geometry.w * e.geometry.h,
|
|
326
326
|
intersects: (e, t, n) => t >= e.geometry.x && t <= e.geometry.x + e.geometry.w && n >= e.geometry.y && n <= e.geometry.y + e.geometry.h
|
|
327
327
|
};
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, a, l,
|
|
328
|
+
lt(z.RECTANGLE, pn);
|
|
329
|
+
const yn = (e, t = !1) => {
|
|
330
|
+
const n = typeof e == "string" ? e : e.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, i = [...n.matchAll(o)][0], [s, r, a, l, c, h, u] = i;
|
|
331
331
|
if (r !== "xywh")
|
|
332
332
|
throw new Error("Unsupported MediaFragment: " + n);
|
|
333
333
|
if (a && a !== "pixel")
|
|
334
334
|
throw new Error(`Unsupported MediaFragment unit: ${a}`);
|
|
335
|
-
const [
|
|
335
|
+
const [m, d, g, _] = [l, c, h, u].map(parseFloat);
|
|
336
336
|
return {
|
|
337
|
-
type:
|
|
337
|
+
type: z.RECTANGLE,
|
|
338
338
|
geometry: {
|
|
339
|
-
x:
|
|
340
|
-
y:
|
|
341
|
-
w:
|
|
342
|
-
h:
|
|
339
|
+
x: m,
|
|
340
|
+
y: d,
|
|
341
|
+
w: g,
|
|
342
|
+
h: _,
|
|
343
343
|
bounds: {
|
|
344
|
-
minX:
|
|
345
|
-
minY: t ?
|
|
346
|
-
maxX:
|
|
347
|
-
maxY: t ?
|
|
344
|
+
minX: m,
|
|
345
|
+
minY: t ? d - _ : d,
|
|
346
|
+
maxX: m + g,
|
|
347
|
+
maxY: t ? d : d + _
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
};
|
|
351
|
-
},
|
|
351
|
+
}, _n = (e) => {
|
|
352
352
|
const { x: t, y: n, w: o, h: i } = e;
|
|
353
353
|
return {
|
|
354
354
|
type: "FragmentSelector",
|
|
355
355
|
conformsTo: "http://www.w3.org/TR/media-frags/",
|
|
356
356
|
value: `xywh=pixel:${t},${n},${o},${i}`
|
|
357
357
|
};
|
|
358
|
-
},
|
|
358
|
+
}, jt = "http://www.w3.org/2000/svg", gt = (e) => {
|
|
359
359
|
const t = (o) => {
|
|
360
360
|
Array.from(o.attributes).forEach((i) => {
|
|
361
361
|
i.name.startsWith("on") && o.removeAttribute(i.name);
|
|
362
362
|
});
|
|
363
363
|
}, n = e.getElementsByTagName("script");
|
|
364
364
|
return Array.from(n).reverse().forEach((o) => o.parentNode.removeChild(o)), Array.from(e.querySelectorAll("*")).forEach(t), e;
|
|
365
|
-
},
|
|
366
|
-
const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${
|
|
365
|
+
}, wn = (e) => {
|
|
366
|
+
const o = new XMLSerializer().serializeToString(e.documentElement).replace("<svg>", `<svg xmlns="${jt}">`);
|
|
367
367
|
return new DOMParser().parseFromString(o, "image/svg+xml").documentElement;
|
|
368
|
-
},
|
|
369
|
-
const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(
|
|
370
|
-
return o || i ?
|
|
371
|
-
},
|
|
368
|
+
}, bn = (e) => {
|
|
369
|
+
const n = new DOMParser().parseFromString(e, "image/svg+xml"), o = n.lookupPrefix(jt), i = n.lookupNamespaceURI(null);
|
|
370
|
+
return o || i ? gt(n).firstChild : gt(wn(n)).firstChild;
|
|
371
|
+
}, En = (e) => {
|
|
372
372
|
const [t, n, o] = e.match(/(<polygon points=["|'])([^("|')]*)/) || [];
|
|
373
373
|
if (!o)
|
|
374
374
|
return;
|
|
375
375
|
const i = o.split(" ").map((s) => s.split(",").map(parseFloat));
|
|
376
376
|
return {
|
|
377
|
-
type:
|
|
377
|
+
type: z.POLYGON,
|
|
378
378
|
geometry: {
|
|
379
379
|
points: i,
|
|
380
380
|
bounds: Fe(i)
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
|
-
},
|
|
384
|
-
const t =
|
|
383
|
+
}, An = (e) => {
|
|
384
|
+
const t = bn(e), n = parseFloat(t.getAttribute("cx")), o = parseFloat(t.getAttribute("cy")), i = parseFloat(t.getAttribute("rx")), s = parseFloat(t.getAttribute("ry")), r = {
|
|
385
385
|
minX: n - i,
|
|
386
386
|
minY: o - s,
|
|
387
387
|
maxX: n + i,
|
|
388
388
|
maxY: o + s
|
|
389
389
|
};
|
|
390
390
|
return {
|
|
391
|
-
type:
|
|
391
|
+
type: z.ELLIPSE,
|
|
392
392
|
geometry: {
|
|
393
393
|
cx: n,
|
|
394
394
|
cy: o,
|
|
@@ -397,18 +397,18 @@ const bn = (e, t = !1) => {
|
|
|
397
397
|
bounds: r
|
|
398
398
|
}
|
|
399
399
|
};
|
|
400
|
-
},
|
|
400
|
+
}, Tn = (e) => {
|
|
401
401
|
const t = typeof e == "string" ? e : e.value;
|
|
402
402
|
if (t.includes("<polygon points="))
|
|
403
|
-
return
|
|
403
|
+
return En(t);
|
|
404
404
|
if (t.includes("<ellipse "))
|
|
405
|
-
return
|
|
406
|
-
},
|
|
405
|
+
return An(t);
|
|
406
|
+
}, Sn = (e) => {
|
|
407
407
|
let t;
|
|
408
|
-
if (e.type ===
|
|
408
|
+
if (e.type === z.POLYGON) {
|
|
409
409
|
const n = e.geometry, { points: o } = n;
|
|
410
410
|
t = `<svg><polygon points="${o.map((i) => i.join(",")).join(" ")}" /></svg>`;
|
|
411
|
-
} else if (e.type ===
|
|
411
|
+
} else if (e.type === z.ELLIPSE) {
|
|
412
412
|
const n = e.geometry;
|
|
413
413
|
t = `<svg><ellipse cx="${n.cx}" cy="${n.cy}" rx="${n.rx}" ry="${n.ry}" /></svg>`;
|
|
414
414
|
}
|
|
@@ -416,37 +416,37 @@ const bn = (e, t = !1) => {
|
|
|
416
416
|
return { type: "SvgSelector", value: t };
|
|
417
417
|
throw `Unsupported shape type: ${e.type}`;
|
|
418
418
|
};
|
|
419
|
-
let
|
|
420
|
-
const
|
|
421
|
-
function
|
|
422
|
-
if (!
|
|
419
|
+
let Ce;
|
|
420
|
+
const Mn = new Uint8Array(16);
|
|
421
|
+
function vn() {
|
|
422
|
+
if (!Ce && (Ce = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Ce))
|
|
423
423
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
424
|
-
return
|
|
424
|
+
return Ce(Mn);
|
|
425
425
|
}
|
|
426
426
|
const q = [];
|
|
427
427
|
for (let e = 0; e < 256; ++e)
|
|
428
428
|
q.push((e + 256).toString(16).slice(1));
|
|
429
|
-
function
|
|
429
|
+
function Ln(e, t = 0) {
|
|
430
430
|
return q[e[t + 0]] + q[e[t + 1]] + q[e[t + 2]] + q[e[t + 3]] + "-" + q[e[t + 4]] + q[e[t + 5]] + "-" + q[e[t + 6]] + q[e[t + 7]] + "-" + q[e[t + 8]] + q[e[t + 9]] + "-" + q[e[t + 10]] + q[e[t + 11]] + q[e[t + 12]] + q[e[t + 13]] + q[e[t + 14]] + q[e[t + 15]];
|
|
431
431
|
}
|
|
432
|
-
const
|
|
433
|
-
randomUUID:
|
|
432
|
+
const On = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), pt = {
|
|
433
|
+
randomUUID: On
|
|
434
434
|
};
|
|
435
|
-
function
|
|
436
|
-
if (
|
|
437
|
-
return
|
|
435
|
+
function qt(e, t, n) {
|
|
436
|
+
if (pt.randomUUID && !t && !e)
|
|
437
|
+
return pt.randomUUID();
|
|
438
438
|
e = e || {};
|
|
439
|
-
const o = e.random || (e.rng ||
|
|
439
|
+
const o = e.random || (e.rng || vn)();
|
|
440
440
|
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
|
|
441
441
|
n = n || 0;
|
|
442
442
|
for (let i = 0; i < 16; ++i)
|
|
443
443
|
t[n + i] = o[i];
|
|
444
444
|
return t;
|
|
445
445
|
}
|
|
446
|
-
return
|
|
446
|
+
return Ln(o);
|
|
447
447
|
}
|
|
448
|
-
var
|
|
449
|
-
function
|
|
448
|
+
var yt = Object.prototype.hasOwnProperty;
|
|
449
|
+
function de(e, t) {
|
|
450
450
|
var n, o;
|
|
451
451
|
if (e === t)
|
|
452
452
|
return !0;
|
|
@@ -457,37 +457,37 @@ function fe(e, t) {
|
|
|
457
457
|
return e.toString() === t.toString();
|
|
458
458
|
if (n === Array) {
|
|
459
459
|
if ((o = e.length) === t.length)
|
|
460
|
-
for (; o-- &&
|
|
460
|
+
for (; o-- && de(e[o], t[o]); )
|
|
461
461
|
;
|
|
462
462
|
return o === -1;
|
|
463
463
|
}
|
|
464
464
|
if (!n || typeof e == "object") {
|
|
465
465
|
o = 0;
|
|
466
466
|
for (n in e)
|
|
467
|
-
if (
|
|
467
|
+
if (yt.call(e, n) && ++o && !yt.call(t, n) || !(n in t) || !de(e[n], t[n]))
|
|
468
468
|
return !1;
|
|
469
469
|
return Object.keys(t).length === o;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
return e !== e && t !== t;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function We() {
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function kn(e, t) {
|
|
477
477
|
return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function";
|
|
478
478
|
}
|
|
479
479
|
const ye = [];
|
|
480
|
-
function
|
|
480
|
+
function at(e, t = We) {
|
|
481
481
|
let n;
|
|
482
482
|
const o = /* @__PURE__ */ new Set();
|
|
483
483
|
function i(a) {
|
|
484
|
-
if (
|
|
484
|
+
if (kn(e, a) && (e = a, n)) {
|
|
485
485
|
const l = !ye.length;
|
|
486
|
-
for (const
|
|
487
|
-
|
|
486
|
+
for (const c of o)
|
|
487
|
+
c[1](), ye.push(c, e);
|
|
488
488
|
if (l) {
|
|
489
|
-
for (let
|
|
490
|
-
ye[
|
|
489
|
+
for (let c = 0; c < ye.length; c += 2)
|
|
490
|
+
ye[c][0](ye[c + 1]);
|
|
491
491
|
ye.length = 0;
|
|
492
492
|
}
|
|
493
493
|
}
|
|
@@ -495,16 +495,16 @@ function ut(e, t = Ze) {
|
|
|
495
495
|
function s(a) {
|
|
496
496
|
i(a(e));
|
|
497
497
|
}
|
|
498
|
-
function r(a, l =
|
|
499
|
-
const
|
|
500
|
-
return o.add(
|
|
501
|
-
o.delete(
|
|
498
|
+
function r(a, l = We) {
|
|
499
|
+
const c = [a, l];
|
|
500
|
+
return o.add(c), o.size === 1 && (n = t(i) || We), a(e), () => {
|
|
501
|
+
o.delete(c), o.size === 0 && n && (n(), n = null);
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
return { set: i, update: s, subscribe: r };
|
|
505
505
|
}
|
|
506
|
-
const
|
|
507
|
-
const { subscribe: t, set: n } =
|
|
506
|
+
const In = (e) => {
|
|
507
|
+
const { subscribe: t, set: n } = at(null);
|
|
508
508
|
let o = null;
|
|
509
509
|
return t((i) => o = i), e.observe(({ changes: i }) => {
|
|
510
510
|
if (o) {
|
|
@@ -520,36 +520,36 @@ const Pn = (e) => {
|
|
|
520
520
|
set: n
|
|
521
521
|
};
|
|
522
522
|
};
|
|
523
|
-
var
|
|
524
|
-
const
|
|
525
|
-
const { subscribe: n, set: o } =
|
|
526
|
-
let i =
|
|
527
|
-
n((
|
|
528
|
-
const s = () => o(
|
|
529
|
-
var
|
|
530
|
-
return ((
|
|
531
|
-
}, a = (
|
|
523
|
+
var Kt = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(Kt || {});
|
|
524
|
+
const Je = { selected: [] }, Bn = (e, t = "EDIT") => {
|
|
525
|
+
const { subscribe: n, set: o } = at(Je);
|
|
526
|
+
let i = Je;
|
|
527
|
+
n((u) => i = u);
|
|
528
|
+
const s = () => o(Je), r = () => {
|
|
529
|
+
var u;
|
|
530
|
+
return ((u = i.selected) == null ? void 0 : u.length) === 0;
|
|
531
|
+
}, a = (u) => {
|
|
532
532
|
if (i.selected.length === 0)
|
|
533
533
|
return !1;
|
|
534
|
-
const
|
|
535
|
-
return i.selected.some((
|
|
536
|
-
}, l = (
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
539
|
-
const
|
|
540
|
-
o(
|
|
534
|
+
const m = typeof u == "string" ? u : u.id;
|
|
535
|
+
return i.selected.some((d) => d.id === m);
|
|
536
|
+
}, l = (u, m) => {
|
|
537
|
+
const d = e.getAnnotation(u);
|
|
538
|
+
if (d) {
|
|
539
|
+
const g = Pn(d, t);
|
|
540
|
+
o(g === "EDIT" ? { selected: [{ id: u, editable: !0 }], pointerEvent: m } : g === "SELECT" ? { selected: [{ id: u }], pointerEvent: m } : { selected: [], pointerEvent: m });
|
|
541
541
|
} else
|
|
542
|
-
console.warn("Invalid selection: " +
|
|
543
|
-
},
|
|
544
|
-
const
|
|
545
|
-
o({ selected:
|
|
546
|
-
}, h = (
|
|
542
|
+
console.warn("Invalid selection: " + u);
|
|
543
|
+
}, c = (u, m = !0) => {
|
|
544
|
+
const d = Array.isArray(u) ? u : [u], g = d.map((_) => e.getAnnotation(_)).filter((_) => _);
|
|
545
|
+
o({ selected: g.map(({ id: _ }) => ({ id: _, editable: m })) }), g.length !== d.length && console.warn("Invalid selection", u);
|
|
546
|
+
}, h = (u) => {
|
|
547
547
|
if (i.selected.length === 0)
|
|
548
548
|
return !1;
|
|
549
|
-
const { selected:
|
|
550
|
-
|
|
549
|
+
const { selected: m } = i;
|
|
550
|
+
m.filter(({ id: d }) => u.includes(d)).length > 0 && o({ selected: m.filter(({ id: d }) => !u.includes(d)) });
|
|
551
551
|
};
|
|
552
|
-
return e.observe(({ changes:
|
|
552
|
+
return e.observe(({ changes: u }) => h(u.deleted.map((m) => m.id))), {
|
|
553
553
|
clear: s,
|
|
554
554
|
clickSelect: l,
|
|
555
555
|
get selected() {
|
|
@@ -560,35 +560,35 @@ const Qe = { selected: [] }, Rn = (e, t = "EDIT") => {
|
|
|
560
560
|
},
|
|
561
561
|
isEmpty: r,
|
|
562
562
|
isSelected: a,
|
|
563
|
-
setSelected:
|
|
563
|
+
setSelected: c,
|
|
564
564
|
subscribe: n
|
|
565
565
|
};
|
|
566
|
-
},
|
|
566
|
+
}, Pn = (e, t) => typeof t == "function" ? t(e) || "EDIT" : t || "EDIT", Yn = [];
|
|
567
567
|
for (let e = 0; e < 256; ++e)
|
|
568
|
-
|
|
568
|
+
Yn.push((e + 256).toString(16).slice(1));
|
|
569
569
|
typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
570
|
-
const
|
|
570
|
+
const Xn = (e, t) => {
|
|
571
571
|
const n = new Set(e.bodies.map((o) => o.id));
|
|
572
572
|
return t.bodies.filter((o) => !n.has(o.id));
|
|
573
|
-
},
|
|
573
|
+
}, Dn = (e, t) => {
|
|
574
574
|
const n = new Set(t.bodies.map((o) => o.id));
|
|
575
575
|
return e.bodies.filter((o) => !n.has(o.id));
|
|
576
|
-
},
|
|
576
|
+
}, Rn = (e, t) => t.bodies.map((n) => {
|
|
577
577
|
const o = e.bodies.find((i) => i.id === n.id);
|
|
578
|
-
return { newBody: n, oldBody: o && !
|
|
579
|
-
}).filter(({ oldBody: n }) => n),
|
|
580
|
-
const n =
|
|
578
|
+
return { newBody: n, oldBody: o && !de(o, n) ? o : void 0 };
|
|
579
|
+
}).filter(({ oldBody: n }) => n), Cn = (e, t) => !de(e.target, t.target), Wt = (e, t) => {
|
|
580
|
+
const n = Xn(e, t), o = Dn(e, t), i = Rn(e, t);
|
|
581
581
|
return {
|
|
582
582
|
oldValue: e,
|
|
583
583
|
newValue: t,
|
|
584
584
|
bodiesCreated: n.length > 0 ? n : void 0,
|
|
585
585
|
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
586
586
|
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
587
|
-
targetUpdated:
|
|
587
|
+
targetUpdated: Cn(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
|
|
588
588
|
};
|
|
589
589
|
};
|
|
590
|
-
var
|
|
591
|
-
const
|
|
590
|
+
var V = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(V || {});
|
|
591
|
+
const Un = (e, t) => {
|
|
592
592
|
var n, o;
|
|
593
593
|
const { changes: i, origin: s } = t;
|
|
594
594
|
if (!(!e.options.origin || e.options.origin === s))
|
|
@@ -596,8 +596,8 @@ const Vn = (e, t) => {
|
|
|
596
596
|
if (e.options.ignore) {
|
|
597
597
|
const { ignore: r } = e.options, a = (l) => (l == null ? void 0 : l.length) > 0;
|
|
598
598
|
if (!(a(i.created) || a(i.deleted))) {
|
|
599
|
-
const l = (n = i.updated) == null ? void 0 : n.some((h) => a(h.bodiesCreated) || a(h.bodiesDeleted) || a(h.bodiesUpdated)),
|
|
600
|
-
if (r === "BODY_ONLY" && l && !
|
|
599
|
+
const l = (n = i.updated) == null ? void 0 : n.some((h) => a(h.bodiesCreated) || a(h.bodiesDeleted) || a(h.bodiesUpdated)), c = (o = i.updated) == null ? void 0 : o.some((h) => h.targetUpdated);
|
|
600
|
+
if (r === "BODY_ONLY" && l && !c || r === "TARGET_ONLY" && c && !l)
|
|
601
601
|
return !1;
|
|
602
602
|
}
|
|
603
603
|
}
|
|
@@ -610,218 +610,218 @@ const Vn = (e, t) => {
|
|
|
610
610
|
return !!(Array.isArray(e.options.annotations) ? e.options.annotations : [e.options.annotations]).find((a) => r.has(a));
|
|
611
611
|
} else
|
|
612
612
|
return !0;
|
|
613
|
-
},
|
|
614
|
-
const n = new Set((e.created || []).map((
|
|
615
|
-
...(e.created || []).filter((
|
|
613
|
+
}, Nn = (e, t) => {
|
|
614
|
+
const n = new Set((e.created || []).map((u) => u.id)), o = new Set((e.updated || []).map(({ newValue: u }) => u.id)), i = new Set((t.created || []).map((u) => u.id)), s = new Set((t.deleted || []).map((u) => u.id)), r = new Set((t.updated || []).map(({ oldValue: u }) => u.id)), a = new Set((t.updated || []).filter(({ oldValue: u }) => n.has(u.id) || o.has(u.id)).map(({ oldValue: u }) => u.id)), l = [
|
|
615
|
+
...(e.created || []).filter((u) => !s.has(u.id)).map((u) => r.has(u.id) ? t.updated.find(({ oldValue: m }) => m.id === u.id).newValue : u),
|
|
616
616
|
...t.created || []
|
|
617
|
-
],
|
|
618
|
-
...(e.deleted || []).filter((
|
|
619
|
-
...(t.deleted || []).filter((
|
|
617
|
+
], c = [
|
|
618
|
+
...(e.deleted || []).filter((u) => !i.has(u.id)),
|
|
619
|
+
...(t.deleted || []).filter((u) => !n.has(u.id))
|
|
620
620
|
], h = [
|
|
621
|
-
...(e.updated || []).filter(({ newValue:
|
|
622
|
-
const { oldValue:
|
|
623
|
-
if (r.has(
|
|
624
|
-
const
|
|
625
|
-
return
|
|
621
|
+
...(e.updated || []).filter(({ newValue: u }) => !s.has(u.id)).map((u) => {
|
|
622
|
+
const { oldValue: m, newValue: d } = u;
|
|
623
|
+
if (r.has(d.id)) {
|
|
624
|
+
const g = t.updated.find((_) => _.oldValue.id === d.id).newValue;
|
|
625
|
+
return Wt(m, g);
|
|
626
626
|
} else
|
|
627
|
-
return
|
|
627
|
+
return u;
|
|
628
628
|
}),
|
|
629
|
-
...(t.updated || []).filter(({ oldValue:
|
|
629
|
+
...(t.updated || []).filter(({ oldValue: u }) => !a.has(u.id))
|
|
630
630
|
];
|
|
631
|
-
return { created: l, deleted:
|
|
632
|
-
},
|
|
633
|
-
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
}, s = (
|
|
637
|
-
const
|
|
638
|
-
origin:
|
|
631
|
+
return { created: l, deleted: c, updated: h };
|
|
632
|
+
}, Vn = (e) => e.id !== void 0, Gn = () => {
|
|
633
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], o = (p, E = {}) => n.push({ onChange: p, options: E }), i = (p) => {
|
|
634
|
+
const E = n.findIndex((b) => b.onChange == p);
|
|
635
|
+
E > -1 && n.splice(E, 1);
|
|
636
|
+
}, s = (p, E) => {
|
|
637
|
+
const b = {
|
|
638
|
+
origin: p,
|
|
639
639
|
changes: {
|
|
640
|
-
created:
|
|
641
|
-
updated:
|
|
642
|
-
deleted:
|
|
640
|
+
created: E.created || [],
|
|
641
|
+
updated: E.updated || [],
|
|
642
|
+
deleted: E.deleted || []
|
|
643
643
|
},
|
|
644
644
|
state: [...e.values()]
|
|
645
645
|
};
|
|
646
646
|
n.forEach((v) => {
|
|
647
|
-
|
|
647
|
+
Un(v, b) && v.onChange(b);
|
|
648
648
|
});
|
|
649
|
-
}, r = (
|
|
650
|
-
if (e.get(
|
|
651
|
-
throw Error(`Cannot add annotation ${
|
|
652
|
-
e.set(
|
|
653
|
-
}, a = (
|
|
654
|
-
const
|
|
655
|
-
if (
|
|
656
|
-
const
|
|
657
|
-
return v ===
|
|
649
|
+
}, r = (p, E = V.LOCAL) => {
|
|
650
|
+
if (e.get(p.id))
|
|
651
|
+
throw Error(`Cannot add annotation ${p.id} - exists already`);
|
|
652
|
+
e.set(p.id, p), p.bodies.forEach((b) => t.set(b.id, p.id)), s(E, { created: [p] });
|
|
653
|
+
}, a = (p, E) => {
|
|
654
|
+
const b = typeof p == "string" ? E : p, v = typeof p == "string" ? p : p.id, B = e.get(v);
|
|
655
|
+
if (B) {
|
|
656
|
+
const D = Wt(B, b);
|
|
657
|
+
return v === b.id ? e.set(v, b) : (e.delete(v), e.set(b.id, b)), B.bodies.forEach((Z) => t.delete(Z.id)), b.bodies.forEach((Z) => t.set(Z.id, b.id)), D;
|
|
658
658
|
} else
|
|
659
659
|
console.warn(`Cannot update annotation ${v} - does not exist`);
|
|
660
|
-
}, l = (
|
|
661
|
-
const v =
|
|
662
|
-
|
|
663
|
-
},
|
|
664
|
-
const
|
|
665
|
-
const
|
|
666
|
-
return
|
|
660
|
+
}, l = (p, E = V.LOCAL, b = V.LOCAL) => {
|
|
661
|
+
const v = Vn(E) ? b : E, B = a(p, E);
|
|
662
|
+
B && s(v, { updated: [B] });
|
|
663
|
+
}, c = (p, E = V.LOCAL) => {
|
|
664
|
+
const b = p.reduce((v, B) => {
|
|
665
|
+
const D = a(B);
|
|
666
|
+
return D ? [...v, D] : v;
|
|
667
667
|
}, []);
|
|
668
|
-
|
|
669
|
-
}, h = (
|
|
670
|
-
const
|
|
671
|
-
if (
|
|
668
|
+
b.length > 0 && s(E, { updated: b });
|
|
669
|
+
}, h = (p, E = V.LOCAL) => {
|
|
670
|
+
const b = e.get(p.annotation);
|
|
671
|
+
if (b) {
|
|
672
672
|
const v = {
|
|
673
|
-
...
|
|
674
|
-
bodies: [...
|
|
673
|
+
...b,
|
|
674
|
+
bodies: [...b.bodies, p]
|
|
675
675
|
};
|
|
676
|
-
e.set(
|
|
677
|
-
oldValue:
|
|
676
|
+
e.set(b.id, v), t.set(p.id, v.id), s(E, { updated: [{
|
|
677
|
+
oldValue: b,
|
|
678
678
|
newValue: v,
|
|
679
|
-
bodiesCreated: [
|
|
679
|
+
bodiesCreated: [p]
|
|
680
680
|
}] });
|
|
681
681
|
} else
|
|
682
|
-
console.warn(`Attempt to add body to missing annotation: ${
|
|
683
|
-
},
|
|
684
|
-
const
|
|
685
|
-
e.clear(), t.clear(), s(
|
|
686
|
-
},
|
|
687
|
-
if (
|
|
682
|
+
console.warn(`Attempt to add body to missing annotation: ${p.annotation}`);
|
|
683
|
+
}, u = () => [...e.values()], m = (p = V.LOCAL) => {
|
|
684
|
+
const E = [...e.values()];
|
|
685
|
+
e.clear(), t.clear(), s(p, { deleted: E });
|
|
686
|
+
}, d = (p, E = !0, b = V.LOCAL) => {
|
|
687
|
+
if (E) {
|
|
688
688
|
const v = [...e.values()];
|
|
689
|
-
e.clear(), t.clear(),
|
|
690
|
-
e.set(
|
|
691
|
-
}), s(
|
|
689
|
+
e.clear(), t.clear(), p.forEach((B) => {
|
|
690
|
+
e.set(B.id, B), B.bodies.forEach((D) => t.set(D.id, B.id));
|
|
691
|
+
}), s(b, { created: p, deleted: v });
|
|
692
692
|
} else {
|
|
693
|
-
const v =
|
|
694
|
-
const Z = e.get(
|
|
695
|
-
return Z ? [...
|
|
693
|
+
const v = p.reduce((B, D) => {
|
|
694
|
+
const Z = e.get(D.id);
|
|
695
|
+
return Z ? [...B, Z] : B;
|
|
696
696
|
}, []);
|
|
697
697
|
if (v.length > 0)
|
|
698
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${v.map((
|
|
699
|
-
|
|
700
|
-
e.set(
|
|
701
|
-
}), s(
|
|
702
|
-
}
|
|
703
|
-
},
|
|
704
|
-
const
|
|
705
|
-
if (
|
|
706
|
-
return e.delete(
|
|
707
|
-
console.warn(`Attempt to delete missing annotation: ${
|
|
708
|
-
},
|
|
709
|
-
const
|
|
710
|
-
|
|
711
|
-
},
|
|
712
|
-
const
|
|
713
|
-
const
|
|
714
|
-
return
|
|
698
|
+
throw Error(`Bulk insert would overwrite the following annotations: ${v.map((B) => B.id).join(", ")}`);
|
|
699
|
+
p.forEach((B) => {
|
|
700
|
+
e.set(B.id, B), B.bodies.forEach((D) => t.set(D.id, B.id));
|
|
701
|
+
}), s(b, { created: p });
|
|
702
|
+
}
|
|
703
|
+
}, g = (p) => {
|
|
704
|
+
const E = typeof p == "string" ? p : p.id, b = e.get(E);
|
|
705
|
+
if (b)
|
|
706
|
+
return e.delete(E), b.bodies.forEach((v) => t.delete(v.id)), b;
|
|
707
|
+
console.warn(`Attempt to delete missing annotation: ${E}`);
|
|
708
|
+
}, _ = (p, E = V.LOCAL) => {
|
|
709
|
+
const b = g(p);
|
|
710
|
+
b && s(E, { deleted: [b] });
|
|
711
|
+
}, A = (p, E = V.LOCAL) => {
|
|
712
|
+
const b = p.reduce((v, B) => {
|
|
713
|
+
const D = g(B);
|
|
714
|
+
return D ? [...v, D] : v;
|
|
715
715
|
}, []);
|
|
716
|
-
|
|
717
|
-
},
|
|
718
|
-
const
|
|
719
|
-
if (
|
|
720
|
-
const v =
|
|
716
|
+
b.length > 0 && s(E, { deleted: b });
|
|
717
|
+
}, w = (p, E = V.LOCAL) => {
|
|
718
|
+
const b = e.get(p.annotation);
|
|
719
|
+
if (b) {
|
|
720
|
+
const v = b.bodies.find((B) => B.id === p.id);
|
|
721
721
|
if (v) {
|
|
722
722
|
t.delete(v.id);
|
|
723
|
-
const
|
|
724
|
-
...
|
|
725
|
-
bodies:
|
|
723
|
+
const B = {
|
|
724
|
+
...b,
|
|
725
|
+
bodies: b.bodies.filter((D) => D.id !== p.id)
|
|
726
726
|
};
|
|
727
|
-
e.set(
|
|
728
|
-
oldValue:
|
|
729
|
-
newValue:
|
|
727
|
+
e.set(b.id, B), s(E, { updated: [{
|
|
728
|
+
oldValue: b,
|
|
729
|
+
newValue: B,
|
|
730
730
|
bodiesDeleted: [v]
|
|
731
731
|
}] });
|
|
732
732
|
} else
|
|
733
|
-
console.warn(`Attempt to delete missing body ${
|
|
733
|
+
console.warn(`Attempt to delete missing body ${p.id} from annotation ${p.annotation}`);
|
|
734
734
|
} else
|
|
735
|
-
console.warn(`Attempt to delete body from missing annotation ${
|
|
736
|
-
},
|
|
737
|
-
const
|
|
738
|
-
return
|
|
739
|
-
},
|
|
740
|
-
const
|
|
741
|
-
if (
|
|
742
|
-
const
|
|
743
|
-
if (
|
|
744
|
-
return
|
|
745
|
-
console.error(`Store integrity error: body ${
|
|
735
|
+
console.warn(`Attempt to delete body from missing annotation ${p.annotation}`);
|
|
736
|
+
}, y = (p) => {
|
|
737
|
+
const E = e.get(p);
|
|
738
|
+
return E ? { ...E } : void 0;
|
|
739
|
+
}, T = (p) => {
|
|
740
|
+
const E = t.get(p);
|
|
741
|
+
if (E) {
|
|
742
|
+
const b = y(E).bodies.find((v) => v.id === p);
|
|
743
|
+
if (b)
|
|
744
|
+
return b;
|
|
745
|
+
console.error(`Store integrity error: body ${p} in index, but not in annotation`);
|
|
746
746
|
} else
|
|
747
|
-
console.warn(`Attempt to retrieve missing body: ${
|
|
748
|
-
}, S = (
|
|
749
|
-
if (
|
|
747
|
+
console.warn(`Attempt to retrieve missing body: ${p}`);
|
|
748
|
+
}, S = (p, E) => {
|
|
749
|
+
if (p.annotation !== E.annotation)
|
|
750
750
|
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
const v =
|
|
754
|
-
...
|
|
755
|
-
bodies:
|
|
751
|
+
const b = e.get(p.annotation);
|
|
752
|
+
if (b) {
|
|
753
|
+
const v = b.bodies.find((D) => D.id === p.id), B = {
|
|
754
|
+
...b,
|
|
755
|
+
bodies: b.bodies.map((D) => D.id === v.id ? E : D)
|
|
756
756
|
};
|
|
757
|
-
return e.set(
|
|
758
|
-
oldValue:
|
|
759
|
-
newValue:
|
|
760
|
-
bodiesUpdated: [{ oldBody: v, newBody:
|
|
757
|
+
return e.set(b.id, B), v.id !== E.id && (t.delete(v.id), t.set(E.id, B.id)), {
|
|
758
|
+
oldValue: b,
|
|
759
|
+
newValue: B,
|
|
760
|
+
bodiesUpdated: [{ oldBody: v, newBody: E }]
|
|
761
761
|
};
|
|
762
762
|
} else
|
|
763
|
-
console.warn(`Attempt to add body to missing annotation ${
|
|
764
|
-
},
|
|
765
|
-
const v = S(
|
|
766
|
-
s(
|
|
767
|
-
},
|
|
768
|
-
const
|
|
769
|
-
s(
|
|
770
|
-
},
|
|
771
|
-
const
|
|
772
|
-
if (
|
|
773
|
-
const
|
|
774
|
-
...
|
|
763
|
+
console.warn(`Attempt to add body to missing annotation ${p.annotation}`);
|
|
764
|
+
}, P = (p, E, b = V.LOCAL) => {
|
|
765
|
+
const v = S(p, E);
|
|
766
|
+
s(b, { updated: [v] });
|
|
767
|
+
}, X = (p, E = V.LOCAL) => {
|
|
768
|
+
const b = p.map((v) => S({ id: v.id, annotation: v.annotation }, v));
|
|
769
|
+
s(E, { updated: b });
|
|
770
|
+
}, U = (p) => {
|
|
771
|
+
const E = e.get(p.annotation);
|
|
772
|
+
if (E) {
|
|
773
|
+
const b = {
|
|
774
|
+
...E,
|
|
775
775
|
target: {
|
|
776
|
-
...
|
|
777
|
-
...
|
|
776
|
+
...E.target,
|
|
777
|
+
...p
|
|
778
778
|
}
|
|
779
779
|
};
|
|
780
|
-
return e.set(
|
|
781
|
-
oldValue:
|
|
782
|
-
newValue:
|
|
780
|
+
return e.set(E.id, b), {
|
|
781
|
+
oldValue: E,
|
|
782
|
+
newValue: b,
|
|
783
783
|
targetUpdated: {
|
|
784
|
-
oldTarget:
|
|
785
|
-
newTarget:
|
|
784
|
+
oldTarget: E.target,
|
|
785
|
+
newTarget: p
|
|
786
786
|
}
|
|
787
787
|
};
|
|
788
788
|
} else
|
|
789
|
-
console.warn(`Attempt to update target on missing annotation: ${
|
|
789
|
+
console.warn(`Attempt to update target on missing annotation: ${p.annotation}`);
|
|
790
790
|
};
|
|
791
791
|
return {
|
|
792
792
|
addAnnotation: r,
|
|
793
793
|
addBody: h,
|
|
794
|
-
all:
|
|
795
|
-
bulkAddAnnotation:
|
|
796
|
-
bulkDeleteAnnotation:
|
|
797
|
-
bulkUpdateAnnotation:
|
|
798
|
-
bulkUpdateBodies:
|
|
799
|
-
bulkUpdateTargets: (
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
},
|
|
803
|
-
clear:
|
|
804
|
-
deleteAnnotation:
|
|
805
|
-
deleteBody:
|
|
806
|
-
getAnnotation:
|
|
807
|
-
getBody:
|
|
794
|
+
all: u,
|
|
795
|
+
bulkAddAnnotation: d,
|
|
796
|
+
bulkDeleteAnnotation: A,
|
|
797
|
+
bulkUpdateAnnotation: c,
|
|
798
|
+
bulkUpdateBodies: X,
|
|
799
|
+
bulkUpdateTargets: (p, E = V.LOCAL) => {
|
|
800
|
+
const b = p.map(U).filter((v) => v);
|
|
801
|
+
b.length > 0 && s(E, { updated: b });
|
|
802
|
+
},
|
|
803
|
+
clear: m,
|
|
804
|
+
deleteAnnotation: _,
|
|
805
|
+
deleteBody: w,
|
|
806
|
+
getAnnotation: y,
|
|
807
|
+
getBody: T,
|
|
808
808
|
observe: o,
|
|
809
809
|
unobserve: i,
|
|
810
810
|
updateAnnotation: l,
|
|
811
|
-
updateBody:
|
|
812
|
-
updateTarget: (
|
|
813
|
-
const
|
|
814
|
-
|
|
811
|
+
updateBody: P,
|
|
812
|
+
updateTarget: (p, E = V.LOCAL) => {
|
|
813
|
+
const b = U(p);
|
|
814
|
+
b && s(E, { updated: [b] });
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
|
-
},
|
|
817
|
+
}, Fn = (e) => ({
|
|
818
818
|
...e,
|
|
819
819
|
subscribe: (t) => {
|
|
820
820
|
const n = (o) => t(o.state);
|
|
821
821
|
return e.observe(n), t(e.all()), () => e.unobserve(n);
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
|
-
let
|
|
824
|
+
let Hn = () => ({
|
|
825
825
|
emit(e, ...t) {
|
|
826
826
|
let n = this.events[e] || [];
|
|
827
827
|
for (let o = 0, i = n.length; o < i; o++)
|
|
@@ -836,123 +836,123 @@ let qn = () => ({
|
|
|
836
836
|
};
|
|
837
837
|
}
|
|
838
838
|
});
|
|
839
|
-
const
|
|
840
|
-
const t =
|
|
839
|
+
const zn = 250, jn = (e) => {
|
|
840
|
+
const t = Hn(), n = [];
|
|
841
841
|
let o = -1, i = !1, s = 0;
|
|
842
|
-
const r = (
|
|
842
|
+
const r = (d) => {
|
|
843
843
|
if (!i) {
|
|
844
|
-
const { changes:
|
|
845
|
-
if (
|
|
846
|
-
n.splice(o + 1), n.push(
|
|
844
|
+
const { changes: g } = d, _ = performance.now();
|
|
845
|
+
if (_ - s > zn)
|
|
846
|
+
n.splice(o + 1), n.push(g), o = n.length - 1;
|
|
847
847
|
else {
|
|
848
|
-
const
|
|
849
|
-
n[
|
|
848
|
+
const A = n.length - 1;
|
|
849
|
+
n[A] = Nn(n[A], g);
|
|
850
850
|
}
|
|
851
|
-
s =
|
|
851
|
+
s = _;
|
|
852
852
|
}
|
|
853
853
|
i = !1;
|
|
854
854
|
};
|
|
855
|
-
e.observe(r, { origin:
|
|
856
|
-
const a = (
|
|
855
|
+
e.observe(r, { origin: V.LOCAL });
|
|
856
|
+
const a = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkDeleteAnnotation(d), l = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkAddAnnotation(d, !1), c = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkUpdateAnnotation(d.map(({ oldValue: g }) => g)), h = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkUpdateAnnotation(d.map(({ newValue: g }) => g)), u = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkAddAnnotation(d, !1), m = (d) => (d == null ? void 0 : d.length) > 0 && e.bulkDeleteAnnotation(d);
|
|
857
857
|
return {
|
|
858
858
|
canRedo: () => n.length - 1 > o,
|
|
859
859
|
canUndo: () => o > -1,
|
|
860
860
|
destroy: () => e.unobserve(r),
|
|
861
|
-
on: (
|
|
861
|
+
on: (d, g) => t.on(d, g),
|
|
862
862
|
redo: () => {
|
|
863
863
|
if (n.length - 1 > o) {
|
|
864
864
|
i = !0;
|
|
865
|
-
const { created:
|
|
866
|
-
l(
|
|
865
|
+
const { created: d, updated: g, deleted: _ } = n[o + 1];
|
|
866
|
+
l(d), h(g), m(_), t.emit("redo", n[o + 1]), o += 1;
|
|
867
867
|
}
|
|
868
868
|
},
|
|
869
869
|
undo: () => {
|
|
870
870
|
if (o > -1) {
|
|
871
871
|
i = !0;
|
|
872
|
-
const { created:
|
|
873
|
-
a(
|
|
872
|
+
const { created: d, updated: g, deleted: _ } = n[o];
|
|
873
|
+
a(d), c(g), u(_), t.emit("undo", n[o]), o -= 1;
|
|
874
874
|
}
|
|
875
875
|
}
|
|
876
876
|
};
|
|
877
|
-
},
|
|
878
|
-
const { subscribe: e, set: t } =
|
|
877
|
+
}, qn = () => {
|
|
878
|
+
const { subscribe: e, set: t } = at([]);
|
|
879
879
|
return {
|
|
880
880
|
subscribe: e,
|
|
881
881
|
set: t
|
|
882
882
|
};
|
|
883
|
-
},
|
|
883
|
+
}, Kn = (e, t, n, o) => {
|
|
884
884
|
const { store: i, selection: s, hover: r, viewport: a } = e, l = /* @__PURE__ */ new Map();
|
|
885
|
-
let
|
|
886
|
-
const
|
|
887
|
-
l.has(
|
|
888
|
-
},
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
},
|
|
892
|
-
l.has(
|
|
893
|
-
l.get(
|
|
885
|
+
let c = [], h, u;
|
|
886
|
+
const m = (w, y) => {
|
|
887
|
+
l.has(w) ? l.get(w).push(y) : l.set(w, [y]);
|
|
888
|
+
}, d = (w, y) => {
|
|
889
|
+
const T = l.get(w);
|
|
890
|
+
T && T.indexOf(y) > 0 && T.splice(T.indexOf(y), 1);
|
|
891
|
+
}, g = (w, y, T) => {
|
|
892
|
+
l.has(w) && setTimeout(() => {
|
|
893
|
+
l.get(w).forEach((S) => {
|
|
894
894
|
if (n) {
|
|
895
|
-
const
|
|
896
|
-
S(
|
|
895
|
+
const P = Array.isArray(y) ? y.map((U) => n.serialize(U)) : n.serialize(y), X = T ? T instanceof PointerEvent ? T : n.serialize(T) : void 0;
|
|
896
|
+
S(P, X);
|
|
897
897
|
} else
|
|
898
|
-
S(
|
|
898
|
+
S(y, T);
|
|
899
899
|
});
|
|
900
900
|
}, 1);
|
|
901
|
-
},
|
|
902
|
-
const { selected:
|
|
903
|
-
|
|
904
|
-
const S =
|
|
905
|
-
(!S || !
|
|
906
|
-
}),
|
|
907
|
-
};
|
|
908
|
-
s.subscribe(({ selected:
|
|
909
|
-
if (!(
|
|
910
|
-
if (
|
|
911
|
-
|
|
912
|
-
else if (
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
}),
|
|
901
|
+
}, _ = () => {
|
|
902
|
+
const { selected: w } = s, y = w.map(({ id: T }) => i.getAnnotation(T));
|
|
903
|
+
y.forEach((T) => {
|
|
904
|
+
const S = c.find((P) => P.id === T.id);
|
|
905
|
+
(!S || !de(S, T)) && g("updateAnnotation", T, S);
|
|
906
|
+
}), c = c.map((T) => y.find(({ id: P }) => P === T.id) || T);
|
|
907
|
+
};
|
|
908
|
+
s.subscribe(({ selected: w }) => {
|
|
909
|
+
if (!(c.length === 0 && w.length === 0)) {
|
|
910
|
+
if (c.length === 0 && w.length > 0)
|
|
911
|
+
c = w.map(({ id: y }) => i.getAnnotation(y));
|
|
912
|
+
else if (c.length > 0 && w.length === 0)
|
|
913
|
+
c.forEach((y) => {
|
|
914
|
+
const T = i.getAnnotation(y.id);
|
|
915
|
+
T && !de(T, y) && g("updateAnnotation", T, y);
|
|
916
|
+
}), c = [];
|
|
917
917
|
else {
|
|
918
|
-
const
|
|
919
|
-
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
}),
|
|
918
|
+
const y = new Set(c.map((S) => S.id)), T = new Set(w.map(({ id: S }) => S));
|
|
919
|
+
c.filter((S) => !T.has(S.id)).forEach((S) => {
|
|
920
|
+
const P = i.getAnnotation(S.id);
|
|
921
|
+
P && !de(P, S) && g("updateAnnotation", P, S);
|
|
922
|
+
}), c = [
|
|
923
923
|
// Remove annotations that were deselected
|
|
924
|
-
...
|
|
924
|
+
...c.filter((S) => T.has(S.id)),
|
|
925
925
|
// Add editable annotations that were selected
|
|
926
|
-
...
|
|
926
|
+
...w.filter(({ id: S }) => !y.has(S)).map(({ id: S }) => i.getAnnotation(S))
|
|
927
927
|
];
|
|
928
928
|
}
|
|
929
|
-
|
|
930
|
-
}
|
|
931
|
-
}), r.subscribe((
|
|
932
|
-
!h &&
|
|
933
|
-
}), a == null || a.subscribe((
|
|
934
|
-
o && (
|
|
935
|
-
const { created:
|
|
936
|
-
|
|
929
|
+
g("selectionChanged", c);
|
|
930
|
+
}
|
|
931
|
+
}), r.subscribe((w) => {
|
|
932
|
+
!h && w ? g("mouseEnterAnnotation", i.getAnnotation(w)) : h && !w ? g("mouseLeaveAnnotation", i.getAnnotation(h)) : h && w && (g("mouseLeaveAnnotation", i.getAnnotation(h)), g("mouseEnterAnnotation", i.getAnnotation(w))), h = w;
|
|
933
|
+
}), a == null || a.subscribe((w) => g("viewportIntersect", w.map(i.getAnnotation))), i.observe((w) => {
|
|
934
|
+
o && (u && clearTimeout(u), u = setTimeout(_, 1e3));
|
|
935
|
+
const { created: y, deleted: T } = w.changes;
|
|
936
|
+
y.forEach((S) => g("createAnnotation", S)), T.forEach((S) => g("deleteAnnotation", S)), w.changes.updated.filter((S) => [
|
|
937
937
|
...S.bodiesCreated || [],
|
|
938
938
|
...S.bodiesDeleted || [],
|
|
939
939
|
...S.bodiesUpdated || []
|
|
940
|
-
].length > 0).forEach(({ oldValue: S, newValue:
|
|
941
|
-
const
|
|
942
|
-
|
|
940
|
+
].length > 0).forEach(({ oldValue: S, newValue: P }) => {
|
|
941
|
+
const X = c.find((U) => U.id === S.id) || S;
|
|
942
|
+
c = c.map((U) => U.id === S.id ? P : U), g("updateAnnotation", P, X);
|
|
943
943
|
});
|
|
944
|
-
}, { origin:
|
|
945
|
-
if (
|
|
946
|
-
const
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
}, { origin:
|
|
950
|
-
const
|
|
951
|
-
const { created:
|
|
952
|
-
|
|
953
|
-
};
|
|
954
|
-
return t.on("undo",
|
|
955
|
-
},
|
|
944
|
+
}, { origin: V.LOCAL }), i.observe((w) => {
|
|
945
|
+
if (c) {
|
|
946
|
+
const y = new Set(c.map((S) => S.id)), T = w.changes.updated.filter(({ newValue: S }) => y.has(S.id)).map(({ newValue: S }) => S);
|
|
947
|
+
T.length > 0 && (c = c.map((S) => T.find((X) => X.id === S.id) || S));
|
|
948
|
+
}
|
|
949
|
+
}, { origin: V.REMOTE });
|
|
950
|
+
const A = (w) => (y) => {
|
|
951
|
+
const { created: T, deleted: S, updated: P } = y;
|
|
952
|
+
T.forEach((X) => g("createAnnotation", X)), S.forEach((X) => g("deleteAnnotation", X)), w ? P.forEach((X) => g("updateAnnotation", X.oldValue, X.newValue)) : P.forEach((X) => g("updateAnnotation", X.newValue, X.oldValue));
|
|
953
|
+
};
|
|
954
|
+
return t.on("undo", A(!0)), t.on("redo", A(!1)), { on: m, off: d, emit: g };
|
|
955
|
+
}, Wn = (e) => (t) => t.reduce((n, o) => {
|
|
956
956
|
const { parsed: i, error: s } = e.parse(o);
|
|
957
957
|
return s ? {
|
|
958
958
|
parsed: n.parsed,
|
|
@@ -961,43 +961,43 @@ const Wn = 250, Jn = (e) => {
|
|
|
961
961
|
parsed: [...n.parsed, i],
|
|
962
962
|
failed: n.failed
|
|
963
963
|
};
|
|
964
|
-
}, { parsed: [], failed: [] }),
|
|
965
|
-
const { store: o, selection: i } = e, s = (
|
|
964
|
+
}, { parsed: [], failed: [] }), Jn = (e, t, n) => {
|
|
965
|
+
const { store: o, selection: i } = e, s = (A) => {
|
|
966
966
|
if (n) {
|
|
967
|
-
const { parsed:
|
|
968
|
-
|
|
967
|
+
const { parsed: w, error: y } = n.parse(A);
|
|
968
|
+
w ? o.addAnnotation(w, V.REMOTE) : console.error(y);
|
|
969
969
|
} else
|
|
970
|
-
o.addAnnotation(
|
|
971
|
-
}, r = () => i.clear(), a = () => o.clear(), l = (
|
|
972
|
-
const
|
|
973
|
-
return n &&
|
|
974
|
-
},
|
|
975
|
-
var
|
|
976
|
-
const
|
|
977
|
-
return n ?
|
|
978
|
-
},
|
|
979
|
-
if (typeof
|
|
980
|
-
const
|
|
981
|
-
return o.deleteAnnotation(
|
|
970
|
+
o.addAnnotation(A, V.REMOTE);
|
|
971
|
+
}, r = () => i.clear(), a = () => o.clear(), l = (A) => {
|
|
972
|
+
const w = o.getAnnotation(A);
|
|
973
|
+
return n && w ? n.serialize(w) : w;
|
|
974
|
+
}, c = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
|
|
975
|
+
var A;
|
|
976
|
+
const w = (((A = i.selected) == null ? void 0 : A.map((y) => y.id)) || []).map((y) => o.getAnnotation(y));
|
|
977
|
+
return n ? w.map(n.serialize) : w;
|
|
978
|
+
}, u = (A) => fetch(A).then((w) => w.json()).then((w) => (d(w), w)), m = (A) => {
|
|
979
|
+
if (typeof A == "string") {
|
|
980
|
+
const w = o.getAnnotation(A);
|
|
981
|
+
return o.deleteAnnotation(A), n ? n.serialize(w) : w;
|
|
982
982
|
} else {
|
|
983
|
-
const
|
|
984
|
-
return o.deleteAnnotation(
|
|
983
|
+
const w = n ? n.parse(A).parsed : A;
|
|
984
|
+
return o.deleteAnnotation(w), A;
|
|
985
985
|
}
|
|
986
|
-
},
|
|
986
|
+
}, d = (A) => {
|
|
987
987
|
if (n) {
|
|
988
|
-
const { parsed:
|
|
989
|
-
|
|
988
|
+
const { parsed: w, failed: y } = Wn(n)(A);
|
|
989
|
+
y.length > 0 && console.warn(`Discarded ${y.length} invalid annotations`, y), o.bulkAddAnnotation(w, !0, V.REMOTE);
|
|
990
990
|
} else
|
|
991
|
-
o.bulkAddAnnotation(
|
|
992
|
-
},
|
|
993
|
-
|
|
994
|
-
},
|
|
991
|
+
o.bulkAddAnnotation(A, !0, V.REMOTE);
|
|
992
|
+
}, g = (A) => {
|
|
993
|
+
A ? i.setSelected(A) : i.clear();
|
|
994
|
+
}, _ = (A) => {
|
|
995
995
|
if (n) {
|
|
996
|
-
const
|
|
997
|
-
return o.updateAnnotation(
|
|
996
|
+
const w = n.parse(A).parsed, y = n.serialize(o.getAnnotation(w.id));
|
|
997
|
+
return o.updateAnnotation(w), y;
|
|
998
998
|
} else {
|
|
999
|
-
const
|
|
1000
|
-
return o.updateAnnotation(
|
|
999
|
+
const w = o.getAnnotation(A.id);
|
|
1000
|
+
return o.updateAnnotation(A), w;
|
|
1001
1001
|
}
|
|
1002
1002
|
};
|
|
1003
1003
|
return {
|
|
@@ -1007,18 +1007,18 @@ const Wn = 250, Jn = (e) => {
|
|
|
1007
1007
|
canUndo: t.canUndo,
|
|
1008
1008
|
clearAnnotations: a,
|
|
1009
1009
|
getAnnotationById: l,
|
|
1010
|
-
getAnnotations:
|
|
1010
|
+
getAnnotations: c,
|
|
1011
1011
|
getSelected: h,
|
|
1012
|
-
loadAnnotations:
|
|
1012
|
+
loadAnnotations: u,
|
|
1013
1013
|
redo: t.redo,
|
|
1014
|
-
removeAnnotation:
|
|
1015
|
-
setAnnotations:
|
|
1016
|
-
setSelected:
|
|
1014
|
+
removeAnnotation: m,
|
|
1015
|
+
setAnnotations: d,
|
|
1016
|
+
setSelected: g,
|
|
1017
1017
|
undo: t.undo,
|
|
1018
|
-
updateAnnotation:
|
|
1018
|
+
updateAnnotation: _
|
|
1019
1019
|
};
|
|
1020
1020
|
};
|
|
1021
|
-
let
|
|
1021
|
+
let Zn = (e) => crypto.getRandomValues(new Uint8Array(e)), Qn = (e, t, n) => {
|
|
1022
1022
|
let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * t / e.length);
|
|
1023
1023
|
return (s = t) => {
|
|
1024
1024
|
let r = "";
|
|
@@ -1029,8 +1029,8 @@ let $n = (e) => crypto.getRandomValues(new Uint8Array(e)), eo = (e, t, n) => {
|
|
|
1029
1029
|
return r;
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
|
-
},
|
|
1033
|
-
const
|
|
1032
|
+
}, xn = (e, t = 21) => Qn(e, t, Zn), $n = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
|
|
1033
|
+
const eo = () => ({ isGuest: !0, id: xn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), to = (e) => {
|
|
1034
1034
|
const t = JSON.stringify(e);
|
|
1035
1035
|
let n = 0;
|
|
1036
1036
|
for (let o = 0, i = t.length; o < i; o++) {
|
|
@@ -1038,26 +1038,26 @@ const oo = () => ({ isGuest: !0, id: to("1234567890abcdefghijklmnopqrstuvwxyzABC
|
|
|
1038
1038
|
n = (n << 5) - n + s, n |= 0;
|
|
1039
1039
|
}
|
|
1040
1040
|
return `${n}`;
|
|
1041
|
-
},
|
|
1042
|
-
const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...
|
|
1041
|
+
}, no = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
|
|
1042
|
+
const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...c } = n;
|
|
1043
1043
|
return {
|
|
1044
|
-
id: o || `temp-${
|
|
1044
|
+
id: o || `temp-${to(n)}`,
|
|
1045
1045
|
annotation: t,
|
|
1046
1046
|
type: i,
|
|
1047
1047
|
purpose: s,
|
|
1048
1048
|
value: r,
|
|
1049
1049
|
created: a,
|
|
1050
1050
|
creator: l ? typeof l == "object" ? { ...l } : l : void 0,
|
|
1051
|
-
...
|
|
1051
|
+
...c
|
|
1052
1052
|
};
|
|
1053
|
-
}),
|
|
1053
|
+
}), oo = (e) => e.map((t) => {
|
|
1054
1054
|
var n;
|
|
1055
1055
|
const o = { ...t };
|
|
1056
1056
|
return delete o.annotation, (n = o.id) != null && n.startsWith("temp-") && delete o.id, o;
|
|
1057
1057
|
});
|
|
1058
|
-
|
|
1059
|
-
const
|
|
1060
|
-
const n = e.id ||
|
|
1058
|
+
$n();
|
|
1059
|
+
const _i = (e, t = !1) => ({ parse: (i) => io(i, t), serialize: (i) => so(i, e) }), io = (e, t = !1) => {
|
|
1060
|
+
const n = e.id || qt(), { body: o, ...i } = e, s = no(o, n), r = Array.isArray(e.target) ? e.target[0] : e.target, a = Array.isArray(r.selector) ? r.selector[0] : r.selector, l = a.type === "FragmentSelector" ? yn(a, t) : a.type === "SvgSelector" ? Tn(a) : void 0;
|
|
1061
1061
|
return l ? {
|
|
1062
1062
|
parsed: {
|
|
1063
1063
|
...i,
|
|
@@ -1072,29 +1072,29 @@ const Di = (e, t = !1) => ({ parse: (i) => lo(i, t), serialize: (i) => ao(i, e)
|
|
|
1072
1072
|
} : {
|
|
1073
1073
|
error: Error(`Unknown selector type: ${a.type}`)
|
|
1074
1074
|
};
|
|
1075
|
-
},
|
|
1076
|
-
const n = e.target.selector, o = n.type ==
|
|
1075
|
+
}, so = (e, t) => {
|
|
1076
|
+
const n = e.target.selector, o = n.type == z.RECTANGLE ? _n(n.geometry) : Sn(n);
|
|
1077
1077
|
return {
|
|
1078
1078
|
...e,
|
|
1079
1079
|
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1080
1080
|
id: e.id,
|
|
1081
1081
|
type: "Annotation",
|
|
1082
|
-
body:
|
|
1082
|
+
body: oo(e.bodies),
|
|
1083
1083
|
target: {
|
|
1084
1084
|
source: t,
|
|
1085
1085
|
selector: o
|
|
1086
1086
|
}
|
|
1087
1087
|
};
|
|
1088
1088
|
};
|
|
1089
|
-
function
|
|
1089
|
+
function _t(e, t, n) {
|
|
1090
1090
|
const o = e.slice();
|
|
1091
1091
|
return o[11] = t[n], o[13] = n, o;
|
|
1092
1092
|
}
|
|
1093
|
-
function
|
|
1093
|
+
function wt(e) {
|
|
1094
1094
|
let t, n, o, i, s;
|
|
1095
1095
|
return {
|
|
1096
1096
|
c() {
|
|
1097
|
-
t =
|
|
1097
|
+
t = R("rect"), f(t, "class", "a9s-corner-handle"), f(t, "x", n = /*point*/
|
|
1098
1098
|
e[11][0] - /*handleSize*/
|
|
1099
1099
|
e[3] / 2), f(t, "y", o = /*point*/
|
|
1100
1100
|
e[11][1] - /*handleSize*/
|
|
@@ -1111,14 +1111,14 @@ function At(e) {
|
|
|
1111
1111
|
);
|
|
1112
1112
|
},
|
|
1113
1113
|
m(r, a) {
|
|
1114
|
-
|
|
1114
|
+
I(r, t, a), i || (s = K(t, "pointerdown", function() {
|
|
1115
1115
|
j(
|
|
1116
1116
|
/*grab*/
|
|
1117
|
-
e[10](
|
|
1117
|
+
e[10](L(
|
|
1118
1118
|
/*idx*/
|
|
1119
1119
|
e[13]
|
|
1120
1120
|
))
|
|
1121
|
-
) && e[10](
|
|
1121
|
+
) && e[10](L(
|
|
1122
1122
|
/*idx*/
|
|
1123
1123
|
e[13]
|
|
1124
1124
|
)).apply(this, arguments);
|
|
@@ -1150,82 +1150,82 @@ function At(e) {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
};
|
|
1152
1152
|
}
|
|
1153
|
-
function
|
|
1154
|
-
let t, n, o, i, s, r, a, l,
|
|
1153
|
+
function ro(e) {
|
|
1154
|
+
let t, n, o, i, s, r, a, l, c, h, u = (
|
|
1155
1155
|
/*geom*/
|
|
1156
1156
|
e[4].points
|
|
1157
|
-
),
|
|
1158
|
-
for (let
|
|
1159
|
-
|
|
1157
|
+
), m = [];
|
|
1158
|
+
for (let d = 0; d < u.length; d += 1)
|
|
1159
|
+
m[d] = wt(_t(e, u, d));
|
|
1160
1160
|
return {
|
|
1161
1161
|
c() {
|
|
1162
|
-
t =
|
|
1163
|
-
for (let
|
|
1164
|
-
|
|
1162
|
+
t = R("polygon"), i = $(), s = R("polygon"), a = $();
|
|
1163
|
+
for (let d = 0; d < m.length; d += 1)
|
|
1164
|
+
m[d].c();
|
|
1165
1165
|
l = se(), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
|
|
1166
1166
|
e[1] ? "display:none;" : void 0), f(t, "points", o = /*geom*/
|
|
1167
|
-
e[4].points.map(
|
|
1167
|
+
e[4].points.map(bt).join(" ")), f(s, "class", "a9s-inner a9s-shape-handle"), f(
|
|
1168
1168
|
s,
|
|
1169
1169
|
"style",
|
|
1170
1170
|
/*computedStyle*/
|
|
1171
1171
|
e[1]
|
|
1172
1172
|
), f(s, "points", r = /*geom*/
|
|
1173
|
-
e[4].points.map(
|
|
1174
|
-
},
|
|
1175
|
-
m(
|
|
1176
|
-
|
|
1177
|
-
for (let
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1173
|
+
e[4].points.map(Et).join(" "));
|
|
1174
|
+
},
|
|
1175
|
+
m(d, g) {
|
|
1176
|
+
I(d, t, g), I(d, i, g), I(d, s, g), I(d, a, g);
|
|
1177
|
+
for (let _ = 0; _ < m.length; _ += 1)
|
|
1178
|
+
m[_] && m[_].m(d, g);
|
|
1179
|
+
I(d, l, g), c || (h = [
|
|
1180
|
+
K(t, "pointerdown", function() {
|
|
1181
1181
|
j(
|
|
1182
1182
|
/*grab*/
|
|
1183
|
-
e[10](
|
|
1184
|
-
) && e[10](
|
|
1183
|
+
e[10](L.SHAPE)
|
|
1184
|
+
) && e[10](L.SHAPE).apply(this, arguments);
|
|
1185
1185
|
}),
|
|
1186
|
-
|
|
1186
|
+
K(s, "pointerdown", function() {
|
|
1187
1187
|
j(
|
|
1188
1188
|
/*grab*/
|
|
1189
|
-
e[10](
|
|
1190
|
-
) && e[10](
|
|
1189
|
+
e[10](L.SHAPE)
|
|
1190
|
+
) && e[10](L.SHAPE).apply(this, arguments);
|
|
1191
1191
|
})
|
|
1192
|
-
],
|
|
1192
|
+
], c = !0);
|
|
1193
1193
|
},
|
|
1194
|
-
p(
|
|
1195
|
-
if (e =
|
|
1194
|
+
p(d, g) {
|
|
1195
|
+
if (e = d, g & /*computedStyle*/
|
|
1196
1196
|
2 && n !== (n = /*computedStyle*/
|
|
1197
|
-
e[1] ? "display:none;" : void 0) && f(t, "style", n),
|
|
1197
|
+
e[1] ? "display:none;" : void 0) && f(t, "style", n), g & /*geom*/
|
|
1198
1198
|
16 && o !== (o = /*geom*/
|
|
1199
|
-
e[4].points.map(
|
|
1199
|
+
e[4].points.map(bt).join(" ")) && f(t, "points", o), g & /*computedStyle*/
|
|
1200
1200
|
2 && f(
|
|
1201
1201
|
s,
|
|
1202
1202
|
"style",
|
|
1203
1203
|
/*computedStyle*/
|
|
1204
1204
|
e[1]
|
|
1205
|
-
),
|
|
1205
|
+
), g & /*geom*/
|
|
1206
1206
|
16 && r !== (r = /*geom*/
|
|
1207
|
-
e[4].points.map(
|
|
1207
|
+
e[4].points.map(Et).join(" ")) && f(s, "points", r), g & /*geom, handleSize, grab, Handle*/
|
|
1208
1208
|
1048) {
|
|
1209
|
-
|
|
1209
|
+
u = /*geom*/
|
|
1210
1210
|
e[4].points;
|
|
1211
|
-
let
|
|
1212
|
-
for (
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1211
|
+
let _;
|
|
1212
|
+
for (_ = 0; _ < u.length; _ += 1) {
|
|
1213
|
+
const A = _t(e, u, _);
|
|
1214
|
+
m[_] ? m[_].p(A, g) : (m[_] = wt(A), m[_].c(), m[_].m(l.parentNode, l));
|
|
1215
1215
|
}
|
|
1216
|
-
for (;
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
for (; _ < m.length; _ += 1)
|
|
1217
|
+
m[_].d(1);
|
|
1218
|
+
m.length = u.length;
|
|
1219
1219
|
}
|
|
1220
1220
|
},
|
|
1221
|
-
d(
|
|
1222
|
-
|
|
1221
|
+
d(d) {
|
|
1222
|
+
d && k(t), d && k(i), d && k(s), d && k(a), st(m, d), d && k(l), c = !1, ie(h);
|
|
1223
1223
|
}
|
|
1224
1224
|
};
|
|
1225
1225
|
}
|
|
1226
|
-
function
|
|
1226
|
+
function lo(e) {
|
|
1227
1227
|
let t, n;
|
|
1228
|
-
return t = new
|
|
1228
|
+
return t = new Zt({
|
|
1229
1229
|
props: {
|
|
1230
1230
|
shape: (
|
|
1231
1231
|
/*shape*/
|
|
@@ -1241,7 +1241,7 @@ function uo(e) {
|
|
|
1241
1241
|
),
|
|
1242
1242
|
$$slots: {
|
|
1243
1243
|
default: [
|
|
1244
|
-
|
|
1244
|
+
ro,
|
|
1245
1245
|
({ grab: o }) => ({ 10: o }),
|
|
1246
1246
|
({ grab: o }) => o ? 1024 : 0
|
|
1247
1247
|
]
|
|
@@ -1277,7 +1277,7 @@ function uo(e) {
|
|
|
1277
1277
|
17434 && (s.$$scope = { dirty: i, ctx: o }), t.$set(s);
|
|
1278
1278
|
},
|
|
1279
1279
|
i(o) {
|
|
1280
|
-
n || (
|
|
1280
|
+
n || (C(t.$$.fragment, o), n = !0);
|
|
1281
1281
|
},
|
|
1282
1282
|
o(o) {
|
|
1283
1283
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -1287,26 +1287,26 @@ function uo(e) {
|
|
|
1287
1287
|
}
|
|
1288
1288
|
};
|
|
1289
1289
|
}
|
|
1290
|
-
const
|
|
1291
|
-
function
|
|
1290
|
+
const bt = (e) => e.join(","), Et = (e) => e.join(",");
|
|
1291
|
+
function ao(e, t, n) {
|
|
1292
1292
|
let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
|
|
1293
|
-
const
|
|
1294
|
-
let
|
|
1295
|
-
|
|
1296
|
-
const
|
|
1297
|
-
return { ...
|
|
1293
|
+
const c = (d, g, _) => {
|
|
1294
|
+
let A;
|
|
1295
|
+
g === L.SHAPE ? A = d.geometry.points.map(([y, T]) => [y + _[0], T + _[1]]) : A = d.geometry.points.map(([y, T], S) => g === L(S) ? [y + _[0], T + _[1]] : [y, T]);
|
|
1296
|
+
const w = Fe(A);
|
|
1297
|
+
return { ...d, geometry: { points: A, bounds: w } };
|
|
1298
1298
|
};
|
|
1299
|
-
function h(
|
|
1300
|
-
Ae.call(this, e,
|
|
1299
|
+
function h(d) {
|
|
1300
|
+
Ae.call(this, e, d);
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1303
|
-
Ae.call(this, e,
|
|
1302
|
+
function u(d) {
|
|
1303
|
+
Ae.call(this, e, d);
|
|
1304
1304
|
}
|
|
1305
|
-
function
|
|
1306
|
-
Ae.call(this, e,
|
|
1305
|
+
function m(d) {
|
|
1306
|
+
Ae.call(this, e, d);
|
|
1307
1307
|
}
|
|
1308
|
-
return e.$$set = (
|
|
1309
|
-
"shape" in
|
|
1308
|
+
return e.$$set = (d) => {
|
|
1309
|
+
"shape" in d && n(0, s = d.shape), "computedStyle" in d && n(1, r = d.computedStyle), "transform" in d && n(2, a = d.transform), "viewportScale" in d && n(6, l = d.viewportScale);
|
|
1310
1310
|
}, e.$$.update = () => {
|
|
1311
1311
|
e.$$.dirty & /*shape*/
|
|
1312
1312
|
1 && n(4, o = s.geometry), e.$$.dirty & /*viewportScale*/
|
|
@@ -1317,16 +1317,16 @@ function fo(e, t, n) {
|
|
|
1317
1317
|
a,
|
|
1318
1318
|
i,
|
|
1319
1319
|
o,
|
|
1320
|
-
|
|
1320
|
+
c,
|
|
1321
1321
|
l,
|
|
1322
1322
|
h,
|
|
1323
|
-
|
|
1324
|
-
|
|
1323
|
+
u,
|
|
1324
|
+
m
|
|
1325
1325
|
];
|
|
1326
1326
|
}
|
|
1327
|
-
class
|
|
1327
|
+
class co extends te {
|
|
1328
1328
|
constructor(t) {
|
|
1329
|
-
super(), ee(this, t,
|
|
1329
|
+
super(), ee(this, t, ao, lo, J, {
|
|
1330
1330
|
shape: 0,
|
|
1331
1331
|
computedStyle: 1,
|
|
1332
1332
|
transform: 2,
|
|
@@ -1334,11 +1334,11 @@ class ho extends te {
|
|
|
1334
1334
|
});
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1338
|
-
let t, n, o, i, s, r, a, l,
|
|
1337
|
+
function uo(e) {
|
|
1338
|
+
let t, n, o, i, s, r, a, l, c, h, u, m, d, g, _, A, w, y, T, S, P, X, U, p, E, b, v, B, D, Z, me, ge, Me, O, W, G, ce, H, ue, Pe, ze, Q, Ye, Xe, je, x, De, Re, qe, ut;
|
|
1339
1339
|
return {
|
|
1340
1340
|
c() {
|
|
1341
|
-
t =
|
|
1341
|
+
t = R("rect"), a = $(), l = R("rect"), d = $(), g = R("rect"), y = $(), T = R("rect"), U = $(), p = R("rect"), B = $(), D = R("rect"), Me = $(), O = R("rect"), ce = $(), H = R("rect"), ze = $(), Q = R("rect"), je = $(), x = R("rect"), f(t, "class", "a9s-outer"), f(t, "style", n = /*computedStyle*/
|
|
1342
1342
|
e[1] ? "display:none;" : void 0), f(t, "x", o = /*geom*/
|
|
1343
1343
|
e[4].x), f(t, "y", i = /*geom*/
|
|
1344
1344
|
e[4].y), f(t, "width", s = /*geom*/
|
|
@@ -1348,57 +1348,57 @@ function go(e) {
|
|
|
1348
1348
|
"style",
|
|
1349
1349
|
/*computedStyle*/
|
|
1350
1350
|
e[1]
|
|
1351
|
-
), f(l, "x",
|
|
1351
|
+
), f(l, "x", c = /*geom*/
|
|
1352
1352
|
e[4].x), f(l, "y", h = /*geom*/
|
|
1353
|
-
e[4].y), f(l, "width",
|
|
1354
|
-
e[4].w), f(l, "height",
|
|
1355
|
-
e[4].h), f(
|
|
1356
|
-
e[4].x), f(
|
|
1357
|
-
e[4].y), f(
|
|
1358
|
-
e[4].w), f(
|
|
1353
|
+
e[4].y), f(l, "width", u = /*geom*/
|
|
1354
|
+
e[4].w), f(l, "height", m = /*geom*/
|
|
1355
|
+
e[4].h), f(g, "class", "a9s-edge-handle a9s-edge-handle-top"), f(g, "x", _ = /*geom*/
|
|
1356
|
+
e[4].x), f(g, "y", A = /*geom*/
|
|
1357
|
+
e[4].y), f(g, "height", 1), f(g, "width", w = /*geom*/
|
|
1358
|
+
e[4].w), f(T, "class", "a9s-edge-handle a9s-edge-handle-right"), f(T, "x", S = /*geom*/
|
|
1359
1359
|
e[4].x + /*geom*/
|
|
1360
|
-
e[4].w), f(
|
|
1361
|
-
e[4].y), f(
|
|
1362
|
-
e[4].h), f(
|
|
1363
|
-
e[4].x), f(
|
|
1360
|
+
e[4].w), f(T, "y", P = /*geom*/
|
|
1361
|
+
e[4].y), f(T, "height", X = /*geom*/
|
|
1362
|
+
e[4].h), f(T, "width", 1), f(p, "class", "a9s-edge-handle a9s-edge-handle-bottom"), f(p, "x", E = /*geom*/
|
|
1363
|
+
e[4].x), f(p, "y", b = /*geom*/
|
|
1364
1364
|
e[4].y + /*geom*/
|
|
1365
|
-
e[4].h), f(
|
|
1366
|
-
e[4].w), f(
|
|
1367
|
-
e[4].x), f(
|
|
1368
|
-
e[4].y), f(
|
|
1369
|
-
e[4].h), f(
|
|
1365
|
+
e[4].h), f(p, "height", 1), f(p, "width", v = /*geom*/
|
|
1366
|
+
e[4].w), f(D, "class", "a9s-edge-handle a9s-edge-handle-left"), f(D, "x", Z = /*geom*/
|
|
1367
|
+
e[4].x), f(D, "y", me = /*geom*/
|
|
1368
|
+
e[4].y), f(D, "height", ge = /*geom*/
|
|
1369
|
+
e[4].h), f(D, "width", 1), f(O, "class", "a9s-corner-handle a9s-corner-handle-topleft"), f(O, "x", W = /*geom*/
|
|
1370
1370
|
e[4].x - /*handleSize*/
|
|
1371
|
-
e[3] / 2), f(
|
|
1371
|
+
e[3] / 2), f(O, "y", G = /*geom*/
|
|
1372
1372
|
e[4].y - /*handleSize*/
|
|
1373
1373
|
e[3] / 2), f(
|
|
1374
|
-
|
|
1374
|
+
O,
|
|
1375
1375
|
"height",
|
|
1376
1376
|
/*handleSize*/
|
|
1377
1377
|
e[3]
|
|
1378
1378
|
), f(
|
|
1379
|
-
|
|
1379
|
+
O,
|
|
1380
1380
|
"width",
|
|
1381
1381
|
/*handleSize*/
|
|
1382
1382
|
e[3]
|
|
1383
|
-
), f(
|
|
1383
|
+
), f(H, "class", "a9s-corner-handle a9s-corner-handle-topright"), f(H, "x", ue = /*geom*/
|
|
1384
1384
|
e[4].x + /*geom*/
|
|
1385
1385
|
e[4].w - /*handleSize*/
|
|
1386
|
-
e[3] / 2), f(
|
|
1386
|
+
e[3] / 2), f(H, "y", Pe = /*geom*/
|
|
1387
1387
|
e[4].y - /*handleSize*/
|
|
1388
1388
|
e[3] / 2), f(
|
|
1389
|
-
|
|
1389
|
+
H,
|
|
1390
1390
|
"height",
|
|
1391
1391
|
/*handleSize*/
|
|
1392
1392
|
e[3]
|
|
1393
1393
|
), f(
|
|
1394
|
-
|
|
1394
|
+
H,
|
|
1395
1395
|
"width",
|
|
1396
1396
|
/*handleSize*/
|
|
1397
1397
|
e[3]
|
|
1398
|
-
), f(Q, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), f(Q, "x",
|
|
1398
|
+
), f(Q, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), f(Q, "x", Ye = /*geom*/
|
|
1399
1399
|
e[4].x + /*geom*/
|
|
1400
1400
|
e[4].w - /*handleSize*/
|
|
1401
|
-
e[3] / 2), f(Q, "y",
|
|
1401
|
+
e[3] / 2), f(Q, "y", Xe = /*geom*/
|
|
1402
1402
|
e[4].y + /*geom*/
|
|
1403
1403
|
e[4].h - /*handleSize*/
|
|
1404
1404
|
e[3] / 2), f(
|
|
@@ -1411,9 +1411,9 @@ function go(e) {
|
|
|
1411
1411
|
"width",
|
|
1412
1412
|
/*handleSize*/
|
|
1413
1413
|
e[3]
|
|
1414
|
-
), f(x, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), f(x, "x",
|
|
1414
|
+
), f(x, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), f(x, "x", De = /*geom*/
|
|
1415
1415
|
e[4].x - /*handleSize*/
|
|
1416
|
-
e[3] / 2), f(x, "y",
|
|
1416
|
+
e[3] / 2), f(x, "y", Re = /*geom*/
|
|
1417
1417
|
e[4].y + /*geom*/
|
|
1418
1418
|
e[4].h - /*handleSize*/
|
|
1419
1419
|
e[3] / 2), f(
|
|
@@ -1428,72 +1428,72 @@ function go(e) {
|
|
|
1428
1428
|
e[3]
|
|
1429
1429
|
);
|
|
1430
1430
|
},
|
|
1431
|
-
m(
|
|
1432
|
-
|
|
1433
|
-
|
|
1431
|
+
m(Y, M) {
|
|
1432
|
+
I(Y, t, M), I(Y, a, M), I(Y, l, M), I(Y, d, M), I(Y, g, M), I(Y, y, M), I(Y, T, M), I(Y, U, M), I(Y, p, M), I(Y, B, M), I(Y, D, M), I(Y, Me, M), I(Y, O, M), I(Y, ce, M), I(Y, H, M), I(Y, ze, M), I(Y, Q, M), I(Y, je, M), I(Y, x, M), qe || (ut = [
|
|
1433
|
+
K(t, "pointerdown", function() {
|
|
1434
1434
|
j(
|
|
1435
1435
|
/*grab*/
|
|
1436
|
-
e[10](
|
|
1437
|
-
) && e[10](
|
|
1436
|
+
e[10](L.SHAPE)
|
|
1437
|
+
) && e[10](L.SHAPE).apply(this, arguments);
|
|
1438
1438
|
}),
|
|
1439
|
-
|
|
1439
|
+
K(l, "pointerdown", function() {
|
|
1440
1440
|
j(
|
|
1441
1441
|
/*grab*/
|
|
1442
|
-
e[10](
|
|
1443
|
-
) && e[10](
|
|
1442
|
+
e[10](L.SHAPE)
|
|
1443
|
+
) && e[10](L.SHAPE).apply(this, arguments);
|
|
1444
1444
|
}),
|
|
1445
|
-
|
|
1445
|
+
K(g, "pointerdown", function() {
|
|
1446
1446
|
j(
|
|
1447
1447
|
/*grab*/
|
|
1448
|
-
e[10](
|
|
1449
|
-
) && e[10](
|
|
1448
|
+
e[10](L.TOP)
|
|
1449
|
+
) && e[10](L.TOP).apply(this, arguments);
|
|
1450
1450
|
}),
|
|
1451
|
-
|
|
1451
|
+
K(T, "pointerdown", function() {
|
|
1452
1452
|
j(
|
|
1453
1453
|
/*grab*/
|
|
1454
|
-
e[10](
|
|
1455
|
-
) && e[10](
|
|
1454
|
+
e[10](L.RIGHT)
|
|
1455
|
+
) && e[10](L.RIGHT).apply(this, arguments);
|
|
1456
1456
|
}),
|
|
1457
|
-
|
|
1457
|
+
K(p, "pointerdown", function() {
|
|
1458
1458
|
j(
|
|
1459
1459
|
/*grab*/
|
|
1460
|
-
e[10](
|
|
1461
|
-
) && e[10](
|
|
1460
|
+
e[10](L.BOTTOM)
|
|
1461
|
+
) && e[10](L.BOTTOM).apply(this, arguments);
|
|
1462
1462
|
}),
|
|
1463
|
-
|
|
1463
|
+
K(D, "pointerdown", function() {
|
|
1464
1464
|
j(
|
|
1465
1465
|
/*grab*/
|
|
1466
|
-
e[10](
|
|
1467
|
-
) && e[10](
|
|
1466
|
+
e[10](L.LEFT)
|
|
1467
|
+
) && e[10](L.LEFT).apply(this, arguments);
|
|
1468
1468
|
}),
|
|
1469
|
-
|
|
1469
|
+
K(O, "pointerdown", function() {
|
|
1470
1470
|
j(
|
|
1471
1471
|
/*grab*/
|
|
1472
|
-
e[10](
|
|
1473
|
-
) && e[10](
|
|
1472
|
+
e[10](L.TOP_LEFT)
|
|
1473
|
+
) && e[10](L.TOP_LEFT).apply(this, arguments);
|
|
1474
1474
|
}),
|
|
1475
|
-
|
|
1475
|
+
K(H, "pointerdown", function() {
|
|
1476
1476
|
j(
|
|
1477
1477
|
/*grab*/
|
|
1478
|
-
e[10](
|
|
1479
|
-
) && e[10](
|
|
1478
|
+
e[10](L.TOP_RIGHT)
|
|
1479
|
+
) && e[10](L.TOP_RIGHT).apply(this, arguments);
|
|
1480
1480
|
}),
|
|
1481
|
-
|
|
1481
|
+
K(Q, "pointerdown", function() {
|
|
1482
1482
|
j(
|
|
1483
1483
|
/*grab*/
|
|
1484
|
-
e[10](
|
|
1485
|
-
) && e[10](
|
|
1484
|
+
e[10](L.BOTTOM_RIGHT)
|
|
1485
|
+
) && e[10](L.BOTTOM_RIGHT).apply(this, arguments);
|
|
1486
1486
|
}),
|
|
1487
|
-
|
|
1487
|
+
K(x, "pointerdown", function() {
|
|
1488
1488
|
j(
|
|
1489
1489
|
/*grab*/
|
|
1490
|
-
e[10](
|
|
1491
|
-
) && e[10](
|
|
1490
|
+
e[10](L.BOTTOM_LEFT)
|
|
1491
|
+
) && e[10](L.BOTTOM_LEFT).apply(this, arguments);
|
|
1492
1492
|
})
|
|
1493
|
-
],
|
|
1493
|
+
], qe = !0);
|
|
1494
1494
|
},
|
|
1495
|
-
p(
|
|
1496
|
-
e =
|
|
1495
|
+
p(Y, M) {
|
|
1496
|
+
e = Y, M & /*computedStyle*/
|
|
1497
1497
|
2 && n !== (n = /*computedStyle*/
|
|
1498
1498
|
e[1] ? "display:none;" : void 0) && f(t, "style", n), M & /*geom*/
|
|
1499
1499
|
16 && o !== (o = /*geom*/
|
|
@@ -1510,85 +1510,85 @@ function go(e) {
|
|
|
1510
1510
|
/*computedStyle*/
|
|
1511
1511
|
e[1]
|
|
1512
1512
|
), M & /*geom*/
|
|
1513
|
-
16 &&
|
|
1514
|
-
e[4].x) && f(l, "x",
|
|
1513
|
+
16 && c !== (c = /*geom*/
|
|
1514
|
+
e[4].x) && f(l, "x", c), M & /*geom*/
|
|
1515
1515
|
16 && h !== (h = /*geom*/
|
|
1516
1516
|
e[4].y) && f(l, "y", h), M & /*geom*/
|
|
1517
|
-
16 &&
|
|
1518
|
-
e[4].w) && f(l, "width",
|
|
1519
|
-
16 &&
|
|
1520
|
-
e[4].h) && f(l, "height",
|
|
1521
|
-
16 && w !== (w = /*geom*/
|
|
1522
|
-
e[4].x) && f(m, "x", w), M & /*geom*/
|
|
1523
|
-
16 && b !== (b = /*geom*/
|
|
1524
|
-
e[4].y) && f(m, "y", b), M & /*geom*/
|
|
1517
|
+
16 && u !== (u = /*geom*/
|
|
1518
|
+
e[4].w) && f(l, "width", u), M & /*geom*/
|
|
1519
|
+
16 && m !== (m = /*geom*/
|
|
1520
|
+
e[4].h) && f(l, "height", m), M & /*geom*/
|
|
1525
1521
|
16 && _ !== (_ = /*geom*/
|
|
1526
|
-
e[4].
|
|
1522
|
+
e[4].x) && f(g, "x", _), M & /*geom*/
|
|
1523
|
+
16 && A !== (A = /*geom*/
|
|
1524
|
+
e[4].y) && f(g, "y", A), M & /*geom*/
|
|
1525
|
+
16 && w !== (w = /*geom*/
|
|
1526
|
+
e[4].w) && f(g, "width", w), M & /*geom*/
|
|
1527
1527
|
16 && S !== (S = /*geom*/
|
|
1528
1528
|
e[4].x + /*geom*/
|
|
1529
|
-
e[4].w) && f(
|
|
1530
|
-
16 &&
|
|
1531
|
-
e[4].y) && f(
|
|
1532
|
-
16 &&
|
|
1533
|
-
e[4].h) && f(
|
|
1534
|
-
16 && T !== (T = /*geom*/
|
|
1535
|
-
e[4].x) && f(y, "x", T), M & /*geom*/
|
|
1529
|
+
e[4].w) && f(T, "x", S), M & /*geom*/
|
|
1530
|
+
16 && P !== (P = /*geom*/
|
|
1531
|
+
e[4].y) && f(T, "y", P), M & /*geom*/
|
|
1532
|
+
16 && X !== (X = /*geom*/
|
|
1533
|
+
e[4].h) && f(T, "height", X), M & /*geom*/
|
|
1536
1534
|
16 && E !== (E = /*geom*/
|
|
1535
|
+
e[4].x) && f(p, "x", E), M & /*geom*/
|
|
1536
|
+
16 && b !== (b = /*geom*/
|
|
1537
1537
|
e[4].y + /*geom*/
|
|
1538
|
-
e[4].h) && f(
|
|
1538
|
+
e[4].h) && f(p, "y", b), M & /*geom*/
|
|
1539
1539
|
16 && v !== (v = /*geom*/
|
|
1540
|
-
e[4].w) && f(
|
|
1540
|
+
e[4].w) && f(p, "width", v), M & /*geom*/
|
|
1541
1541
|
16 && Z !== (Z = /*geom*/
|
|
1542
|
-
e[4].x) && f(
|
|
1543
|
-
16 && ge !== (ge = /*geom*/
|
|
1544
|
-
e[4].y) && f(Y, "y", ge), M & /*geom*/
|
|
1542
|
+
e[4].x) && f(D, "x", Z), M & /*geom*/
|
|
1545
1543
|
16 && me !== (me = /*geom*/
|
|
1546
|
-
e[4].
|
|
1547
|
-
|
|
1544
|
+
e[4].y) && f(D, "y", me), M & /*geom*/
|
|
1545
|
+
16 && ge !== (ge = /*geom*/
|
|
1546
|
+
e[4].h) && f(D, "height", ge), M & /*geom, handleSize*/
|
|
1547
|
+
24 && W !== (W = /*geom*/
|
|
1548
1548
|
e[4].x - /*handleSize*/
|
|
1549
|
-
e[3] / 2) && f(
|
|
1550
|
-
24 &&
|
|
1549
|
+
e[3] / 2) && f(O, "x", W), M & /*geom, handleSize*/
|
|
1550
|
+
24 && G !== (G = /*geom*/
|
|
1551
1551
|
e[4].y - /*handleSize*/
|
|
1552
|
-
e[3] / 2) && f(
|
|
1552
|
+
e[3] / 2) && f(O, "y", G), M & /*handleSize*/
|
|
1553
1553
|
8 && f(
|
|
1554
|
-
|
|
1554
|
+
O,
|
|
1555
1555
|
"height",
|
|
1556
1556
|
/*handleSize*/
|
|
1557
1557
|
e[3]
|
|
1558
1558
|
), M & /*handleSize*/
|
|
1559
1559
|
8 && f(
|
|
1560
|
-
|
|
1560
|
+
O,
|
|
1561
1561
|
"width",
|
|
1562
1562
|
/*handleSize*/
|
|
1563
1563
|
e[3]
|
|
1564
1564
|
), M & /*geom, handleSize*/
|
|
1565
|
-
24 &&
|
|
1565
|
+
24 && ue !== (ue = /*geom*/
|
|
1566
1566
|
e[4].x + /*geom*/
|
|
1567
1567
|
e[4].w - /*handleSize*/
|
|
1568
|
-
e[3] / 2) && f(
|
|
1568
|
+
e[3] / 2) && f(H, "x", ue), M & /*geom, handleSize*/
|
|
1569
1569
|
24 && Pe !== (Pe = /*geom*/
|
|
1570
1570
|
e[4].y - /*handleSize*/
|
|
1571
|
-
e[3] / 2) && f(
|
|
1571
|
+
e[3] / 2) && f(H, "y", Pe), M & /*handleSize*/
|
|
1572
1572
|
8 && f(
|
|
1573
|
-
|
|
1573
|
+
H,
|
|
1574
1574
|
"height",
|
|
1575
1575
|
/*handleSize*/
|
|
1576
1576
|
e[3]
|
|
1577
1577
|
), M & /*handleSize*/
|
|
1578
1578
|
8 && f(
|
|
1579
|
-
|
|
1579
|
+
H,
|
|
1580
1580
|
"width",
|
|
1581
1581
|
/*handleSize*/
|
|
1582
1582
|
e[3]
|
|
1583
1583
|
), M & /*geom, handleSize*/
|
|
1584
|
-
24 &&
|
|
1584
|
+
24 && Ye !== (Ye = /*geom*/
|
|
1585
1585
|
e[4].x + /*geom*/
|
|
1586
1586
|
e[4].w - /*handleSize*/
|
|
1587
|
-
e[3] / 2) && f(Q, "x",
|
|
1588
|
-
24 &&
|
|
1587
|
+
e[3] / 2) && f(Q, "x", Ye), M & /*geom, handleSize*/
|
|
1588
|
+
24 && Xe !== (Xe = /*geom*/
|
|
1589
1589
|
e[4].y + /*geom*/
|
|
1590
1590
|
e[4].h - /*handleSize*/
|
|
1591
|
-
e[3] / 2) && f(Q, "y",
|
|
1591
|
+
e[3] / 2) && f(Q, "y", Xe), M & /*handleSize*/
|
|
1592
1592
|
8 && f(
|
|
1593
1593
|
Q,
|
|
1594
1594
|
"height",
|
|
@@ -1601,13 +1601,13 @@ function go(e) {
|
|
|
1601
1601
|
/*handleSize*/
|
|
1602
1602
|
e[3]
|
|
1603
1603
|
), M & /*geom, handleSize*/
|
|
1604
|
-
24 && Ue !== (Ue = /*geom*/
|
|
1605
|
-
e[4].x - /*handleSize*/
|
|
1606
|
-
e[3] / 2) && f(x, "x", Ue), M & /*geom, handleSize*/
|
|
1607
1604
|
24 && De !== (De = /*geom*/
|
|
1605
|
+
e[4].x - /*handleSize*/
|
|
1606
|
+
e[3] / 2) && f(x, "x", De), M & /*geom, handleSize*/
|
|
1607
|
+
24 && Re !== (Re = /*geom*/
|
|
1608
1608
|
e[4].y + /*geom*/
|
|
1609
1609
|
e[4].h - /*handleSize*/
|
|
1610
|
-
e[3] / 2) && f(x, "y",
|
|
1610
|
+
e[3] / 2) && f(x, "y", Re), M & /*handleSize*/
|
|
1611
1611
|
8 && f(
|
|
1612
1612
|
x,
|
|
1613
1613
|
"height",
|
|
@@ -1621,14 +1621,14 @@ function go(e) {
|
|
|
1621
1621
|
e[3]
|
|
1622
1622
|
);
|
|
1623
1623
|
},
|
|
1624
|
-
d(
|
|
1625
|
-
|
|
1624
|
+
d(Y) {
|
|
1625
|
+
Y && k(t), Y && k(a), Y && k(l), Y && k(d), Y && k(g), Y && k(y), Y && k(T), Y && k(U), Y && k(p), Y && k(B), Y && k(D), Y && k(Me), Y && k(O), Y && k(ce), Y && k(H), Y && k(ze), Y && k(Q), Y && k(je), Y && k(x), qe = !1, ie(ut);
|
|
1626
1626
|
}
|
|
1627
1627
|
};
|
|
1628
1628
|
}
|
|
1629
|
-
function
|
|
1629
|
+
function fo(e) {
|
|
1630
1630
|
let t, n;
|
|
1631
|
-
return t = new
|
|
1631
|
+
return t = new Zt({
|
|
1632
1632
|
props: {
|
|
1633
1633
|
shape: (
|
|
1634
1634
|
/*shape*/
|
|
@@ -1644,7 +1644,7 @@ function mo(e) {
|
|
|
1644
1644
|
),
|
|
1645
1645
|
$$slots: {
|
|
1646
1646
|
default: [
|
|
1647
|
-
|
|
1647
|
+
uo,
|
|
1648
1648
|
({ grab: o }) => ({ 10: o }),
|
|
1649
1649
|
({ grab: o }) => o ? 1024 : 0
|
|
1650
1650
|
]
|
|
@@ -1680,7 +1680,7 @@ function mo(e) {
|
|
|
1680
1680
|
3098 && (s.$$scope = { dirty: i, ctx: o }), t.$set(s);
|
|
1681
1681
|
},
|
|
1682
1682
|
i(o) {
|
|
1683
|
-
n || (
|
|
1683
|
+
n || (C(t.$$.fragment, o), n = !0);
|
|
1684
1684
|
},
|
|
1685
1685
|
o(o) {
|
|
1686
1686
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -1690,72 +1690,72 @@ function mo(e) {
|
|
|
1690
1690
|
}
|
|
1691
1691
|
};
|
|
1692
1692
|
}
|
|
1693
|
-
function
|
|
1693
|
+
function ho(e, t, n) {
|
|
1694
1694
|
let o, i, { shape: s } = t, { computedStyle: r = void 0 } = t, { transform: a } = t, { viewportScale: l = 1 } = t;
|
|
1695
|
-
const
|
|
1696
|
-
const
|
|
1697
|
-
let [
|
|
1698
|
-
const [
|
|
1699
|
-
if (
|
|
1700
|
-
|
|
1695
|
+
const c = (d, g, _) => {
|
|
1696
|
+
const A = d.geometry.bounds;
|
|
1697
|
+
let [w, y] = [A.minX, A.minY], [T, S] = [A.maxX, A.maxY];
|
|
1698
|
+
const [P, X] = _;
|
|
1699
|
+
if (g === L.SHAPE)
|
|
1700
|
+
w += P, T += P, y += X, S += X;
|
|
1701
1701
|
else {
|
|
1702
|
-
switch (
|
|
1703
|
-
case
|
|
1704
|
-
case
|
|
1705
|
-
case
|
|
1706
|
-
|
|
1702
|
+
switch (g) {
|
|
1703
|
+
case L.TOP:
|
|
1704
|
+
case L.TOP_LEFT:
|
|
1705
|
+
case L.TOP_RIGHT: {
|
|
1706
|
+
y += X;
|
|
1707
1707
|
break;
|
|
1708
1708
|
}
|
|
1709
|
-
case
|
|
1710
|
-
case
|
|
1711
|
-
case
|
|
1712
|
-
S +=
|
|
1709
|
+
case L.BOTTOM:
|
|
1710
|
+
case L.BOTTOM_LEFT:
|
|
1711
|
+
case L.BOTTOM_RIGHT: {
|
|
1712
|
+
S += X;
|
|
1713
1713
|
break;
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
|
-
switch (
|
|
1717
|
-
case
|
|
1718
|
-
case
|
|
1719
|
-
case
|
|
1720
|
-
|
|
1716
|
+
switch (g) {
|
|
1717
|
+
case L.LEFT:
|
|
1718
|
+
case L.TOP_LEFT:
|
|
1719
|
+
case L.BOTTOM_LEFT: {
|
|
1720
|
+
w += P;
|
|
1721
1721
|
break;
|
|
1722
1722
|
}
|
|
1723
|
-
case
|
|
1724
|
-
case
|
|
1725
|
-
case
|
|
1726
|
-
|
|
1723
|
+
case L.RIGHT:
|
|
1724
|
+
case L.TOP_RIGHT:
|
|
1725
|
+
case L.BOTTOM_RIGHT: {
|
|
1726
|
+
T += P;
|
|
1727
1727
|
break;
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
|
1731
|
-
const
|
|
1731
|
+
const U = Math.min(w, T), p = Math.min(y, S), E = Math.abs(T - w), b = Math.abs(S - y);
|
|
1732
1732
|
return {
|
|
1733
|
-
...
|
|
1733
|
+
...d,
|
|
1734
1734
|
geometry: {
|
|
1735
|
-
x:
|
|
1736
|
-
y,
|
|
1737
|
-
w:
|
|
1738
|
-
h:
|
|
1735
|
+
x: U,
|
|
1736
|
+
y: p,
|
|
1737
|
+
w: E,
|
|
1738
|
+
h: b,
|
|
1739
1739
|
bounds: {
|
|
1740
|
-
minX:
|
|
1741
|
-
minY:
|
|
1742
|
-
maxX:
|
|
1743
|
-
maxY:
|
|
1740
|
+
minX: U,
|
|
1741
|
+
minY: p,
|
|
1742
|
+
maxX: U + E,
|
|
1743
|
+
maxY: p + b
|
|
1744
1744
|
}
|
|
1745
1745
|
}
|
|
1746
1746
|
};
|
|
1747
1747
|
};
|
|
1748
|
-
function h(
|
|
1749
|
-
Ae.call(this, e,
|
|
1748
|
+
function h(d) {
|
|
1749
|
+
Ae.call(this, e, d);
|
|
1750
1750
|
}
|
|
1751
|
-
function
|
|
1752
|
-
Ae.call(this, e,
|
|
1751
|
+
function u(d) {
|
|
1752
|
+
Ae.call(this, e, d);
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1755
|
-
Ae.call(this, e,
|
|
1754
|
+
function m(d) {
|
|
1755
|
+
Ae.call(this, e, d);
|
|
1756
1756
|
}
|
|
1757
|
-
return e.$$set = (
|
|
1758
|
-
"shape" in
|
|
1757
|
+
return e.$$set = (d) => {
|
|
1758
|
+
"shape" in d && n(0, s = d.shape), "computedStyle" in d && n(1, r = d.computedStyle), "transform" in d && n(2, a = d.transform), "viewportScale" in d && n(6, l = d.viewportScale);
|
|
1759
1759
|
}, e.$$.update = () => {
|
|
1760
1760
|
e.$$.dirty & /*shape*/
|
|
1761
1761
|
1 && n(4, o = s.geometry), e.$$.dirty & /*viewportScale*/
|
|
@@ -1766,16 +1766,16 @@ function po(e, t, n) {
|
|
|
1766
1766
|
a,
|
|
1767
1767
|
i,
|
|
1768
1768
|
o,
|
|
1769
|
-
|
|
1769
|
+
c,
|
|
1770
1770
|
l,
|
|
1771
1771
|
h,
|
|
1772
|
-
|
|
1773
|
-
|
|
1772
|
+
u,
|
|
1773
|
+
m
|
|
1774
1774
|
];
|
|
1775
1775
|
}
|
|
1776
|
-
class
|
|
1776
|
+
class mo extends te {
|
|
1777
1777
|
constructor(t) {
|
|
1778
|
-
super(), ee(this, t,
|
|
1778
|
+
super(), ee(this, t, ho, fo, J, {
|
|
1779
1779
|
shape: 0,
|
|
1780
1780
|
computedStyle: 1,
|
|
1781
1781
|
transform: 2,
|
|
@@ -1783,48 +1783,48 @@ class yo extends te {
|
|
|
1783
1783
|
});
|
|
1784
1784
|
}
|
|
1785
1785
|
}
|
|
1786
|
-
const
|
|
1787
|
-
[
|
|
1788
|
-
[
|
|
1789
|
-
]),
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
const
|
|
1786
|
+
const Jt = /* @__PURE__ */ new Map([
|
|
1787
|
+
[z.RECTANGLE, mo],
|
|
1788
|
+
[z.POLYGON, co]
|
|
1789
|
+
]), At = (e) => Jt.get(e.type), go = (e, t) => Jt.set(e, t), L = (e) => `HANDLE-${e}`;
|
|
1790
|
+
L.SHAPE = "SHAPE";
|
|
1791
|
+
L.TOP = "TOP";
|
|
1792
|
+
L.RIGHT = "RIGHT";
|
|
1793
|
+
L.BOTTOM = "BOTTOM";
|
|
1794
|
+
L.LEFT = "LEFT";
|
|
1795
|
+
L.TOP_LEFT = "TOP_LEFT";
|
|
1796
|
+
L.TOP_RIGHT = "TOP_RIGHT";
|
|
1797
|
+
L.BOTTOM_RIGHT = "BOTTOM_RIGHT";
|
|
1798
|
+
L.BOTTOM_LEFT = "BOTTOM_LEFT";
|
|
1799
|
+
const po = (e) => ({}), Tt = (e) => ({ grab: (
|
|
1800
1800
|
/*onGrab*/
|
|
1801
1801
|
e[0]
|
|
1802
1802
|
) });
|
|
1803
|
-
function
|
|
1803
|
+
function yo(e) {
|
|
1804
1804
|
let t, n, o, i;
|
|
1805
1805
|
const s = (
|
|
1806
1806
|
/*#slots*/
|
|
1807
1807
|
e[7].default
|
|
1808
|
-
), r =
|
|
1808
|
+
), r = tn(
|
|
1809
1809
|
s,
|
|
1810
1810
|
e,
|
|
1811
1811
|
/*$$scope*/
|
|
1812
1812
|
e[6],
|
|
1813
|
-
|
|
1813
|
+
Tt
|
|
1814
1814
|
);
|
|
1815
1815
|
return {
|
|
1816
1816
|
c() {
|
|
1817
|
-
t =
|
|
1817
|
+
t = R("g"), r && r.c(), f(t, "class", "a9s-annotation selected");
|
|
1818
1818
|
},
|
|
1819
1819
|
m(a, l) {
|
|
1820
|
-
|
|
1821
|
-
|
|
1820
|
+
I(a, t, l), r && r.m(t, null), n = !0, o || (i = [
|
|
1821
|
+
K(
|
|
1822
1822
|
t,
|
|
1823
1823
|
"pointerup",
|
|
1824
1824
|
/*onRelease*/
|
|
1825
1825
|
e[2]
|
|
1826
1826
|
),
|
|
1827
|
-
|
|
1827
|
+
K(
|
|
1828
1828
|
t,
|
|
1829
1829
|
"pointermove",
|
|
1830
1830
|
/*onPointerMove*/
|
|
@@ -1834,27 +1834,27 @@ function bo(e) {
|
|
|
1834
1834
|
},
|
|
1835
1835
|
p(a, [l]) {
|
|
1836
1836
|
r && r.p && (!n || l & /*$$scope*/
|
|
1837
|
-
64) &&
|
|
1837
|
+
64) && on(
|
|
1838
1838
|
r,
|
|
1839
1839
|
s,
|
|
1840
1840
|
a,
|
|
1841
1841
|
/*$$scope*/
|
|
1842
1842
|
a[6],
|
|
1843
|
-
n ?
|
|
1843
|
+
n ? nn(
|
|
1844
1844
|
s,
|
|
1845
1845
|
/*$$scope*/
|
|
1846
1846
|
a[6],
|
|
1847
1847
|
l,
|
|
1848
|
-
|
|
1849
|
-
) :
|
|
1848
|
+
po
|
|
1849
|
+
) : sn(
|
|
1850
1850
|
/*$$scope*/
|
|
1851
1851
|
a[6]
|
|
1852
1852
|
),
|
|
1853
|
-
|
|
1853
|
+
Tt
|
|
1854
1854
|
);
|
|
1855
1855
|
},
|
|
1856
1856
|
i(a) {
|
|
1857
|
-
n || (
|
|
1857
|
+
n || (C(r, a), n = !0);
|
|
1858
1858
|
},
|
|
1859
1859
|
o(a) {
|
|
1860
1860
|
N(r, a), n = !1;
|
|
@@ -1864,30 +1864,30 @@ function bo(e) {
|
|
|
1864
1864
|
}
|
|
1865
1865
|
};
|
|
1866
1866
|
}
|
|
1867
|
-
function
|
|
1867
|
+
function _o(e, t, n) {
|
|
1868
1868
|
let { $$slots: o = {}, $$scope: i } = t;
|
|
1869
1869
|
const s = Se();
|
|
1870
|
-
let { shape: r } = t, { editor: a } = t, { transform: l } = t,
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1873
|
-
},
|
|
1874
|
-
if (
|
|
1875
|
-
const [
|
|
1876
|
-
n(3, r = a(
|
|
1877
|
-
}
|
|
1878
|
-
},
|
|
1879
|
-
|
|
1880
|
-
};
|
|
1881
|
-
return e.$$set = (
|
|
1882
|
-
"shape" in
|
|
1883
|
-
}, [
|
|
1884
|
-
}
|
|
1885
|
-
class
|
|
1870
|
+
let { shape: r } = t, { editor: a } = t, { transform: l } = t, c = null, h, u = null;
|
|
1871
|
+
const m = (_) => (A) => {
|
|
1872
|
+
c = _, h = l.elementToImage(A.offsetX, A.offsetY), u = r, A.target.setPointerCapture(A.pointerId), s("grab");
|
|
1873
|
+
}, d = (_) => {
|
|
1874
|
+
if (c) {
|
|
1875
|
+
const [A, w] = l.elementToImage(_.offsetX, _.offsetY), y = [A - h[0], w - h[1]];
|
|
1876
|
+
n(3, r = a(u, c, y)), s("change", r);
|
|
1877
|
+
}
|
|
1878
|
+
}, g = (_) => {
|
|
1879
|
+
_.target.releasePointerCapture(_.pointerId), c = null, u = r, s("release");
|
|
1880
|
+
};
|
|
1881
|
+
return e.$$set = (_) => {
|
|
1882
|
+
"shape" in _ && n(3, r = _.shape), "editor" in _ && n(4, a = _.editor), "transform" in _ && n(5, l = _.transform), "$$scope" in _ && n(6, i = _.$$scope);
|
|
1883
|
+
}, [m, d, g, r, a, l, i, o];
|
|
1884
|
+
}
|
|
1885
|
+
class Zt extends te {
|
|
1886
1886
|
constructor(t) {
|
|
1887
|
-
super(), ee(this, t,
|
|
1887
|
+
super(), ee(this, t, _o, yo, J, { shape: 3, editor: 4, transform: 5 });
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
|
-
const
|
|
1890
|
+
const He = (e, t) => {
|
|
1891
1891
|
const n = typeof t == "function" ? t(e) : t;
|
|
1892
1892
|
if (n) {
|
|
1893
1893
|
const { fill: o, fillOpacity: i } = n;
|
|
@@ -1895,35 +1895,35 @@ const je = (e, t) => {
|
|
|
1895
1895
|
return o && (s += `fill:${o};stroke:${o};`), s += `fill-opacity:${i || "0.25"};`, s;
|
|
1896
1896
|
}
|
|
1897
1897
|
};
|
|
1898
|
-
function
|
|
1898
|
+
function wo(e, t, n) {
|
|
1899
1899
|
let o;
|
|
1900
1900
|
const i = Se();
|
|
1901
|
-
let { annotation: s } = t, { editor: r } = t, { style: a = void 0 } = t, { target: l } = t, { transform:
|
|
1902
|
-
return
|
|
1901
|
+
let { annotation: s } = t, { editor: r } = t, { style: a = void 0 } = t, { target: l } = t, { transform: c } = t, { viewportScale: h } = t, u;
|
|
1902
|
+
return Be(() => (n(6, u = new r({
|
|
1903
1903
|
target: l,
|
|
1904
1904
|
props: {
|
|
1905
1905
|
shape: s.target.selector,
|
|
1906
1906
|
computedStyle: o,
|
|
1907
|
-
transform:
|
|
1907
|
+
transform: c,
|
|
1908
1908
|
viewportScale: h
|
|
1909
1909
|
}
|
|
1910
|
-
})),
|
|
1911
|
-
|
|
1912
|
-
}),
|
|
1913
|
-
|
|
1914
|
-
})), e.$$set = (
|
|
1915
|
-
"annotation" in
|
|
1910
|
+
})), u.$on("change", (m) => {
|
|
1911
|
+
u.$$set({ shape: m.detail }), i("change", m.detail);
|
|
1912
|
+
}), u.$on("grab", (m) => i("grab", m.detail)), u.$on("release", (m) => i("release", m.detail)), () => {
|
|
1913
|
+
u.$destroy();
|
|
1914
|
+
})), e.$$set = (m) => {
|
|
1915
|
+
"annotation" in m && n(0, s = m.annotation), "editor" in m && n(1, r = m.editor), "style" in m && n(2, a = m.style), "target" in m && n(3, l = m.target), "transform" in m && n(4, c = m.transform), "viewportScale" in m && n(5, h = m.viewportScale);
|
|
1916
1916
|
}, e.$$.update = () => {
|
|
1917
1917
|
e.$$.dirty & /*annotation, style*/
|
|
1918
|
-
5 && (o =
|
|
1919
|
-
65 && s && (
|
|
1920
|
-
80 &&
|
|
1921
|
-
96 &&
|
|
1922
|
-
}, [s, r, a, l,
|
|
1918
|
+
5 && (o = He(s, a)), e.$$.dirty & /*annotation, editorComponent*/
|
|
1919
|
+
65 && s && (u == null || u.$set({ shape: s.target.selector })), e.$$.dirty & /*editorComponent, transform*/
|
|
1920
|
+
80 && u && u.$set({ transform: c }), e.$$.dirty & /*editorComponent, viewportScale*/
|
|
1921
|
+
96 && u && u.$set({ viewportScale: h });
|
|
1922
|
+
}, [s, r, a, l, c, h, u];
|
|
1923
1923
|
}
|
|
1924
|
-
class
|
|
1924
|
+
class bo extends te {
|
|
1925
1925
|
constructor(t) {
|
|
1926
|
-
super(), ee(this, t,
|
|
1926
|
+
super(), ee(this, t, wo, null, J, {
|
|
1927
1927
|
annotation: 0,
|
|
1928
1928
|
editor: 1,
|
|
1929
1929
|
style: 2,
|
|
@@ -1933,35 +1933,35 @@ class To extends te {
|
|
|
1933
1933
|
});
|
|
1934
1934
|
}
|
|
1935
1935
|
}
|
|
1936
|
-
function
|
|
1936
|
+
function Eo(e, t, n) {
|
|
1937
1937
|
const o = Se();
|
|
1938
|
-
let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: a } = t, { viewportScale: l } = t,
|
|
1939
|
-
return
|
|
1940
|
-
const h = s.closest("svg"),
|
|
1941
|
-
h.addEventListener(
|
|
1938
|
+
let { drawingMode: i } = t, { target: s } = t, { tool: r } = t, { transform: a } = t, { viewportScale: l } = t, c;
|
|
1939
|
+
return Be(() => {
|
|
1940
|
+
const h = s.closest("svg"), u = [], m = (d, g, _) => {
|
|
1941
|
+
h.addEventListener(d, g, _), u.push(() => h.removeEventListener(d, g, _));
|
|
1942
1942
|
};
|
|
1943
|
-
return n(5,
|
|
1943
|
+
return n(5, c = new r({
|
|
1944
1944
|
target: s,
|
|
1945
1945
|
props: {
|
|
1946
|
-
addEventListener:
|
|
1946
|
+
addEventListener: m,
|
|
1947
1947
|
drawingMode: i,
|
|
1948
1948
|
transform: a,
|
|
1949
1949
|
viewportScale: l
|
|
1950
1950
|
}
|
|
1951
|
-
})),
|
|
1952
|
-
|
|
1951
|
+
})), c.$on("create", (d) => o("create", d.detail)), () => {
|
|
1952
|
+
u.forEach((d) => d()), c.$destroy();
|
|
1953
1953
|
};
|
|
1954
1954
|
}), e.$$set = (h) => {
|
|
1955
1955
|
"drawingMode" in h && n(0, i = h.drawingMode), "target" in h && n(1, s = h.target), "tool" in h && n(2, r = h.tool), "transform" in h && n(3, a = h.transform), "viewportScale" in h && n(4, l = h.viewportScale);
|
|
1956
1956
|
}, e.$$.update = () => {
|
|
1957
1957
|
e.$$.dirty & /*toolComponent, transform*/
|
|
1958
|
-
40 &&
|
|
1959
|
-
48 &&
|
|
1960
|
-
}, [i, s, r, a, l,
|
|
1958
|
+
40 && c && c.$set({ transform: a }), e.$$.dirty & /*toolComponent, viewportScale*/
|
|
1959
|
+
48 && c && c.$set({ viewportScale: l });
|
|
1960
|
+
}, [i, s, r, a, l, c];
|
|
1961
1961
|
}
|
|
1962
|
-
class
|
|
1962
|
+
class Ao extends te {
|
|
1963
1963
|
constructor(t) {
|
|
1964
|
-
super(), ee(this, t,
|
|
1964
|
+
super(), ee(this, t, Eo, null, J, {
|
|
1965
1965
|
drawingMode: 0,
|
|
1966
1966
|
target: 1,
|
|
1967
1967
|
tool: 2,
|
|
@@ -1970,11 +1970,11 @@ class Mo extends te {
|
|
|
1970
1970
|
});
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
|
-
function
|
|
1973
|
+
function St(e) {
|
|
1974
1974
|
let t, n;
|
|
1975
1975
|
return {
|
|
1976
1976
|
c() {
|
|
1977
|
-
t =
|
|
1977
|
+
t = R("rect"), n = R("rect"), f(t, "class", "a9s-outer"), f(
|
|
1978
1978
|
t,
|
|
1979
1979
|
"x",
|
|
1980
1980
|
/*x*/
|
|
@@ -2017,7 +2017,7 @@ function Ot(e) {
|
|
|
2017
2017
|
);
|
|
2018
2018
|
},
|
|
2019
2019
|
m(o, i) {
|
|
2020
|
-
|
|
2020
|
+
I(o, t, i), I(o, n, i);
|
|
2021
2021
|
},
|
|
2022
2022
|
p(o, i) {
|
|
2023
2023
|
i & /*x*/
|
|
@@ -2075,95 +2075,95 @@ function Ot(e) {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
};
|
|
2077
2077
|
}
|
|
2078
|
-
function
|
|
2078
|
+
function To(e) {
|
|
2079
2079
|
let t, n = (
|
|
2080
2080
|
/*origin*/
|
|
2081
|
-
e[0] &&
|
|
2081
|
+
e[0] && St(e)
|
|
2082
2082
|
);
|
|
2083
2083
|
return {
|
|
2084
2084
|
c() {
|
|
2085
|
-
t =
|
|
2085
|
+
t = R("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
|
|
2086
2086
|
},
|
|
2087
2087
|
m(o, i) {
|
|
2088
|
-
|
|
2088
|
+
I(o, t, i), n && n.m(t, null);
|
|
2089
2089
|
},
|
|
2090
2090
|
p(o, [i]) {
|
|
2091
2091
|
/*origin*/
|
|
2092
|
-
o[0] ? n ? n.p(o, i) : (n =
|
|
2092
|
+
o[0] ? n ? n.p(o, i) : (n = St(o), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
|
|
2093
2093
|
},
|
|
2094
|
-
i:
|
|
2095
|
-
o:
|
|
2094
|
+
i: F,
|
|
2095
|
+
o: F,
|
|
2096
2096
|
d(o) {
|
|
2097
2097
|
o && k(t), n && n.d();
|
|
2098
2098
|
}
|
|
2099
2099
|
};
|
|
2100
2100
|
}
|
|
2101
|
-
function
|
|
2101
|
+
function So(e, t, n) {
|
|
2102
2102
|
const o = Se();
|
|
2103
|
-
let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, a, l,
|
|
2104
|
-
const
|
|
2105
|
-
a = performance.now(), s === "drag" && (n(0, l = r.elementToImage(
|
|
2106
|
-
},
|
|
2107
|
-
l && (
|
|
2108
|
-
},
|
|
2109
|
-
const
|
|
2103
|
+
let { addEventListener: i } = t, { drawingMode: s } = t, { transform: r } = t, a, l, c, h, u, m, d;
|
|
2104
|
+
const g = (y) => {
|
|
2105
|
+
a = performance.now(), s === "drag" && (n(0, l = r.elementToImage(y.offsetX, y.offsetY)), c = l, n(1, h = l[0]), n(2, u = l[1]), n(3, m = 1), n(4, d = 1));
|
|
2106
|
+
}, _ = (y) => {
|
|
2107
|
+
l && (c = r.elementToImage(y.offsetX, y.offsetY), n(1, h = Math.min(c[0], l[0])), n(2, u = Math.min(c[1], l[1])), n(3, m = Math.abs(c[0] - l[0])), n(4, d = Math.abs(c[1] - l[1])));
|
|
2108
|
+
}, A = (y) => {
|
|
2109
|
+
const T = performance.now() - a;
|
|
2110
2110
|
if (s === "click") {
|
|
2111
|
-
if (
|
|
2111
|
+
if (T > 300)
|
|
2112
2112
|
return;
|
|
2113
|
-
|
|
2113
|
+
y.stopPropagation(), l ? w() : (n(0, l = r.elementToImage(y.offsetX, y.offsetY)), c = l, n(1, h = l[0]), n(2, u = l[1]), n(3, m = 1), n(4, d = 1));
|
|
2114
2114
|
} else
|
|
2115
|
-
l && (
|
|
2116
|
-
},
|
|
2117
|
-
if (
|
|
2118
|
-
const
|
|
2119
|
-
type:
|
|
2115
|
+
l && (T > 300 || m * d > 100 ? (y.stopPropagation(), w()) : (n(0, l = null), c = null));
|
|
2116
|
+
}, w = () => {
|
|
2117
|
+
if (m * d > 15) {
|
|
2118
|
+
const y = {
|
|
2119
|
+
type: z.RECTANGLE,
|
|
2120
2120
|
geometry: {
|
|
2121
2121
|
bounds: {
|
|
2122
2122
|
minX: h,
|
|
2123
|
-
minY:
|
|
2124
|
-
maxX: h +
|
|
2125
|
-
maxY:
|
|
2123
|
+
minY: u,
|
|
2124
|
+
maxX: h + m,
|
|
2125
|
+
maxY: u + d
|
|
2126
2126
|
},
|
|
2127
2127
|
x: h,
|
|
2128
|
-
y:
|
|
2129
|
-
w:
|
|
2130
|
-
h:
|
|
2128
|
+
y: u,
|
|
2129
|
+
w: m,
|
|
2130
|
+
h: d
|
|
2131
2131
|
}
|
|
2132
2132
|
};
|
|
2133
|
-
o("create",
|
|
2133
|
+
o("create", y);
|
|
2134
2134
|
}
|
|
2135
|
-
n(0, l = null),
|
|
2135
|
+
n(0, l = null), c = null;
|
|
2136
2136
|
};
|
|
2137
|
-
return
|
|
2138
|
-
i("pointerdown",
|
|
2139
|
-
}), e.$$set = (
|
|
2140
|
-
"addEventListener" in
|
|
2141
|
-
}, [l, h,
|
|
2137
|
+
return Be(() => {
|
|
2138
|
+
i("pointerdown", g), i("pointermove", _), i("pointerup", A, !0);
|
|
2139
|
+
}), e.$$set = (y) => {
|
|
2140
|
+
"addEventListener" in y && n(5, i = y.addEventListener), "drawingMode" in y && n(6, s = y.drawingMode), "transform" in y && n(7, r = y.transform);
|
|
2141
|
+
}, [l, h, u, m, d, i, s, r];
|
|
2142
2142
|
}
|
|
2143
|
-
class
|
|
2143
|
+
class Mo extends te {
|
|
2144
2144
|
constructor(t) {
|
|
2145
|
-
super(), ee(this, t,
|
|
2145
|
+
super(), ee(this, t, So, To, J, {
|
|
2146
2146
|
addEventListener: 5,
|
|
2147
2147
|
drawingMode: 6,
|
|
2148
2148
|
transform: 7
|
|
2149
2149
|
});
|
|
2150
2150
|
}
|
|
2151
2151
|
}
|
|
2152
|
-
const
|
|
2152
|
+
const Ze = (e, t) => {
|
|
2153
2153
|
const n = Math.abs(t[0] - e[0]), o = Math.abs(t[1] - e[1]);
|
|
2154
2154
|
return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
|
|
2155
2155
|
}, _e = [];
|
|
2156
|
-
function
|
|
2156
|
+
function vo(e, t = F) {
|
|
2157
2157
|
let n;
|
|
2158
2158
|
const o = /* @__PURE__ */ new Set();
|
|
2159
2159
|
function i(a) {
|
|
2160
|
-
if (
|
|
2160
|
+
if (J(e, a) && (e = a, n)) {
|
|
2161
2161
|
const l = !_e.length;
|
|
2162
|
-
for (const
|
|
2163
|
-
|
|
2162
|
+
for (const c of o)
|
|
2163
|
+
c[1](), _e.push(c, e);
|
|
2164
2164
|
if (l) {
|
|
2165
|
-
for (let
|
|
2166
|
-
_e[
|
|
2165
|
+
for (let c = 0; c < _e.length; c += 2)
|
|
2166
|
+
_e[c][0](_e[c + 1]);
|
|
2167
2167
|
_e.length = 0;
|
|
2168
2168
|
}
|
|
2169
2169
|
}
|
|
@@ -2171,15 +2171,15 @@ function ko(e, t = z) {
|
|
|
2171
2171
|
function s(a) {
|
|
2172
2172
|
i(a(e));
|
|
2173
2173
|
}
|
|
2174
|
-
function r(a, l =
|
|
2175
|
-
const
|
|
2176
|
-
return o.add(
|
|
2177
|
-
o.delete(
|
|
2174
|
+
function r(a, l = F) {
|
|
2175
|
+
const c = [a, l];
|
|
2176
|
+
return o.add(c), o.size === 1 && (n = t(i) || F), a(e), () => {
|
|
2177
|
+
o.delete(c), o.size === 0 && n && (n(), n = null);
|
|
2178
2178
|
};
|
|
2179
2179
|
}
|
|
2180
2180
|
return { set: i, update: s, subscribe: r };
|
|
2181
2181
|
}
|
|
2182
|
-
const
|
|
2182
|
+
const Lo = (e, t) => {
|
|
2183
2183
|
const { naturalWidth: n, naturalHeight: o } = e;
|
|
2184
2184
|
if (!n && !o) {
|
|
2185
2185
|
const { width: i, height: s } = e;
|
|
@@ -2189,21 +2189,21 @@ const Bo = (e, t) => {
|
|
|
2189
2189
|
});
|
|
2190
2190
|
} else
|
|
2191
2191
|
t.setAttribute("viewBox", `0 0 ${n} ${o}`);
|
|
2192
|
-
},
|
|
2193
|
-
|
|
2194
|
-
const { subscribe: n, set: o } =
|
|
2192
|
+
}, Oo = (e, t) => {
|
|
2193
|
+
Lo(e, t);
|
|
2194
|
+
const { subscribe: n, set: o } = vo(1);
|
|
2195
2195
|
let i;
|
|
2196
2196
|
return window.ResizeObserver && (i = new ResizeObserver(() => {
|
|
2197
|
-
const r = t.getBoundingClientRect(), { width: a, height: l } = t.viewBox.baseVal,
|
|
2197
|
+
const r = t.getBoundingClientRect(), { width: a, height: l } = t.viewBox.baseVal, c = Math.max(
|
|
2198
2198
|
r.width / a,
|
|
2199
2199
|
r.height / l
|
|
2200
2200
|
);
|
|
2201
|
-
o(
|
|
2201
|
+
o(c);
|
|
2202
2202
|
}), i.observe(t.parentElement)), { destroy: () => {
|
|
2203
2203
|
i && i.disconnect();
|
|
2204
2204
|
}, subscribe: n };
|
|
2205
|
-
},
|
|
2206
|
-
function
|
|
2205
|
+
}, wi = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
2206
|
+
function Qe(e) {
|
|
2207
2207
|
const t = e.slice(), n = (
|
|
2208
2208
|
/*isClosable*/
|
|
2209
2209
|
(t[2] ? (
|
|
@@ -2218,19 +2218,19 @@ function $e(e) {
|
|
|
2218
2218
|
);
|
|
2219
2219
|
return t[15] = n, t;
|
|
2220
2220
|
}
|
|
2221
|
-
function
|
|
2221
|
+
function Mt(e) {
|
|
2222
2222
|
let t, n, o, i, s, r = (
|
|
2223
2223
|
/*isClosable*/
|
|
2224
|
-
e[2] &&
|
|
2224
|
+
e[2] && vt(e)
|
|
2225
2225
|
);
|
|
2226
2226
|
return {
|
|
2227
2227
|
c() {
|
|
2228
|
-
t =
|
|
2228
|
+
t = R("polygon"), o = R("polygon"), r && r.c(), s = se(), f(t, "class", "a9s-outer"), f(t, "points", n = /*coords*/
|
|
2229
2229
|
e[15]), f(o, "class", "a9s-inner"), f(o, "points", i = /*coords*/
|
|
2230
2230
|
e[15]);
|
|
2231
2231
|
},
|
|
2232
2232
|
m(a, l) {
|
|
2233
|
-
|
|
2233
|
+
I(a, t, l), I(a, o, l), r && r.m(a, l), I(a, s, l);
|
|
2234
2234
|
},
|
|
2235
2235
|
p(a, l) {
|
|
2236
2236
|
l & /*isClosable, points, cursor*/
|
|
@@ -2238,18 +2238,18 @@ function Lt(e) {
|
|
|
2238
2238
|
a[15]) && f(t, "points", n), l & /*isClosable, points, cursor*/
|
|
2239
2239
|
7 && i !== (i = /*coords*/
|
|
2240
2240
|
a[15]) && f(o, "points", i), /*isClosable*/
|
|
2241
|
-
a[2] ? r ? r.p(a, l) : (r =
|
|
2241
|
+
a[2] ? r ? r.p(a, l) : (r = vt(a), r.c(), r.m(s.parentNode, s)) : r && (r.d(1), r = null);
|
|
2242
2242
|
},
|
|
2243
2243
|
d(a) {
|
|
2244
2244
|
a && k(t), a && k(o), r && r.d(a), a && k(s);
|
|
2245
2245
|
}
|
|
2246
2246
|
};
|
|
2247
2247
|
}
|
|
2248
|
-
function
|
|
2248
|
+
function vt(e) {
|
|
2249
2249
|
let t, n, o;
|
|
2250
2250
|
return {
|
|
2251
2251
|
c() {
|
|
2252
|
-
t =
|
|
2252
|
+
t = R("rect"), f(t, "class", "a9s-corner-handle"), f(t, "x", n = /*points*/
|
|
2253
2253
|
e[0][0][0] - /*handleSize*/
|
|
2254
2254
|
e[3] / 2), f(t, "y", o = /*points*/
|
|
2255
2255
|
e[0][0][1] - /*handleSize*/
|
|
@@ -2266,7 +2266,7 @@ function kt(e) {
|
|
|
2266
2266
|
);
|
|
2267
2267
|
},
|
|
2268
2268
|
m(i, s) {
|
|
2269
|
-
|
|
2269
|
+
I(i, t, s);
|
|
2270
2270
|
},
|
|
2271
2271
|
p(i, s) {
|
|
2272
2272
|
s & /*points, handleSize*/
|
|
@@ -2294,91 +2294,91 @@ function kt(e) {
|
|
|
2294
2294
|
}
|
|
2295
2295
|
};
|
|
2296
2296
|
}
|
|
2297
|
-
function
|
|
2297
|
+
function ko(e) {
|
|
2298
2298
|
let t, n = (
|
|
2299
2299
|
/*cursor*/
|
|
2300
|
-
e[1] &&
|
|
2300
|
+
e[1] && Mt(Qe(e))
|
|
2301
2301
|
);
|
|
2302
2302
|
return {
|
|
2303
2303
|
c() {
|
|
2304
|
-
t =
|
|
2304
|
+
t = R("g"), n && n.c(), f(t, "class", "a9s-annotation a9s-rubberband");
|
|
2305
2305
|
},
|
|
2306
2306
|
m(o, i) {
|
|
2307
|
-
|
|
2307
|
+
I(o, t, i), n && n.m(t, null);
|
|
2308
2308
|
},
|
|
2309
2309
|
p(o, [i]) {
|
|
2310
2310
|
/*cursor*/
|
|
2311
|
-
o[1] ? n ? n.p(
|
|
2311
|
+
o[1] ? n ? n.p(Qe(o), i) : (n = Mt(Qe(o)), n.c(), n.m(t, null)) : n && (n.d(1), n = null);
|
|
2312
2312
|
},
|
|
2313
|
-
i:
|
|
2314
|
-
o:
|
|
2313
|
+
i: F,
|
|
2314
|
+
o: F,
|
|
2315
2315
|
d(o) {
|
|
2316
2316
|
o && k(t), n && n.d();
|
|
2317
2317
|
}
|
|
2318
2318
|
};
|
|
2319
2319
|
}
|
|
2320
|
-
const
|
|
2321
|
-
function
|
|
2320
|
+
const Io = 20;
|
|
2321
|
+
function Bo(e, t, n) {
|
|
2322
2322
|
let o;
|
|
2323
2323
|
const i = Se();
|
|
2324
|
-
let { addEventListener: s } = t, { drawingMode: r } = t, { transform: a } = t, { viewportScale: l = 1 } = t,
|
|
2325
|
-
const
|
|
2326
|
-
const { timeStamp:
|
|
2327
|
-
if (
|
|
2328
|
-
const
|
|
2329
|
-
h.push(
|
|
2330
|
-
}
|
|
2331
|
-
},
|
|
2332
|
-
if (h.length > 0 && (n(1,
|
|
2333
|
-
const
|
|
2334
|
-
n(2,
|
|
2335
|
-
}
|
|
2336
|
-
},
|
|
2324
|
+
let { addEventListener: s } = t, { drawingMode: r } = t, { transform: a } = t, { viewportScale: l = 1 } = t, c, h = [], u = null, m = !1;
|
|
2325
|
+
const d = (y) => {
|
|
2326
|
+
const { timeStamp: T, offsetX: S, offsetY: P } = y;
|
|
2327
|
+
if (c = { timeStamp: T, offsetX: S, offsetY: P }, r === "drag" && h.length === 0) {
|
|
2328
|
+
const X = a.elementToImage(y.offsetX, y.offsetY);
|
|
2329
|
+
h.push(X), n(1, u = X);
|
|
2330
|
+
}
|
|
2331
|
+
}, g = (y) => {
|
|
2332
|
+
if (h.length > 0 && (n(1, u = a.elementToImage(y.offsetX, y.offsetY)), h.length > 2)) {
|
|
2333
|
+
const T = Ze(u, h[0]) * l;
|
|
2334
|
+
n(2, m = T < Io);
|
|
2335
|
+
}
|
|
2336
|
+
}, _ = (y) => {
|
|
2337
2337
|
if (r === "click") {
|
|
2338
|
-
const
|
|
2339
|
-
if (
|
|
2338
|
+
const T = y.timeStamp - c.timeStamp, S = Ze([c.offsetX, c.offsetY], [y.offsetX, y.offsetY]);
|
|
2339
|
+
if (T > 300 || S > 15)
|
|
2340
2340
|
return;
|
|
2341
|
-
if (
|
|
2342
|
-
|
|
2341
|
+
if (m)
|
|
2342
|
+
w();
|
|
2343
2343
|
else if (h.length === 0) {
|
|
2344
|
-
const
|
|
2345
|
-
h.push(
|
|
2344
|
+
const P = a.elementToImage(y.offsetX, y.offsetY);
|
|
2345
|
+
h.push(P), n(1, u = P);
|
|
2346
2346
|
} else
|
|
2347
|
-
h.push(
|
|
2347
|
+
h.push(u);
|
|
2348
2348
|
} else {
|
|
2349
|
-
if (h.length === 1 &&
|
|
2350
|
-
n(0, h = []), n(1,
|
|
2349
|
+
if (h.length === 1 && Ze(h[0], u) <= 4) {
|
|
2350
|
+
n(0, h = []), n(1, u = null);
|
|
2351
2351
|
return;
|
|
2352
2352
|
}
|
|
2353
|
-
|
|
2353
|
+
y.stopImmediatePropagation(), m ? w() : h.push(u);
|
|
2354
2354
|
}
|
|
2355
|
-
},
|
|
2356
|
-
const
|
|
2357
|
-
type:
|
|
2358
|
-
geometry: { bounds: Fe(
|
|
2355
|
+
}, A = () => {
|
|
2356
|
+
const y = [...h, u], T = {
|
|
2357
|
+
type: z.POLYGON,
|
|
2358
|
+
geometry: { bounds: Fe(y), points: y }
|
|
2359
2359
|
};
|
|
2360
|
-
|
|
2361
|
-
},
|
|
2362
|
-
const
|
|
2363
|
-
type:
|
|
2360
|
+
ot(T) > 4 && (n(0, h = []), n(1, u = null), i("create", T));
|
|
2361
|
+
}, w = () => {
|
|
2362
|
+
const y = {
|
|
2363
|
+
type: z.POLYGON,
|
|
2364
2364
|
geometry: {
|
|
2365
2365
|
bounds: Fe(h),
|
|
2366
2366
|
points: [...h]
|
|
2367
2367
|
}
|
|
2368
2368
|
};
|
|
2369
|
-
n(0, h = []), n(1,
|
|
2369
|
+
n(0, h = []), n(1, u = null), i("create", y);
|
|
2370
2370
|
};
|
|
2371
|
-
return
|
|
2372
|
-
s("pointerdown",
|
|
2373
|
-
}), e.$$set = (
|
|
2374
|
-
"addEventListener" in
|
|
2371
|
+
return Be(() => {
|
|
2372
|
+
s("pointerdown", d, !0), s("pointermove", g), s("pointerup", _, !0), s("dblclick", A, !0);
|
|
2373
|
+
}), e.$$set = (y) => {
|
|
2374
|
+
"addEventListener" in y && n(4, s = y.addEventListener), "drawingMode" in y && n(5, r = y.drawingMode), "transform" in y && n(6, a = y.transform), "viewportScale" in y && n(7, l = y.viewportScale);
|
|
2375
2375
|
}, e.$$.update = () => {
|
|
2376
2376
|
e.$$.dirty & /*viewportScale*/
|
|
2377
2377
|
128 && n(3, o = 10 / l);
|
|
2378
2378
|
}, [
|
|
2379
2379
|
h,
|
|
2380
|
-
|
|
2381
|
-
|
|
2380
|
+
u,
|
|
2381
|
+
m,
|
|
2382
2382
|
o,
|
|
2383
2383
|
s,
|
|
2384
2384
|
r,
|
|
@@ -2386,9 +2386,9 @@ function Ro(e, t, n) {
|
|
|
2386
2386
|
l
|
|
2387
2387
|
];
|
|
2388
2388
|
}
|
|
2389
|
-
class
|
|
2389
|
+
class Po extends te {
|
|
2390
2390
|
constructor(t) {
|
|
2391
|
-
super(), ee(this, t,
|
|
2391
|
+
super(), ee(this, t, Bo, ko, J, {
|
|
2392
2392
|
addEventListener: 4,
|
|
2393
2393
|
drawingMode: 5,
|
|
2394
2394
|
transform: 6,
|
|
@@ -2396,15 +2396,15 @@ class Yo extends te {
|
|
|
2396
2396
|
});
|
|
2397
2397
|
}
|
|
2398
2398
|
}
|
|
2399
|
-
const
|
|
2400
|
-
["rectangle", { tool:
|
|
2401
|
-
["polygon", { tool:
|
|
2402
|
-
]),
|
|
2403
|
-
function
|
|
2399
|
+
const ct = /* @__PURE__ */ new Map([
|
|
2400
|
+
["rectangle", { tool: Mo }],
|
|
2401
|
+
["polygon", { tool: Po }]
|
|
2402
|
+
]), it = () => [...ct.keys()], Qt = (e) => ct.get(e), Yo = (e, t, n) => ct.set(e, { tool: t, opts: n });
|
|
2403
|
+
function Xo(e) {
|
|
2404
2404
|
let t, n, o, i, s;
|
|
2405
2405
|
return {
|
|
2406
2406
|
c() {
|
|
2407
|
-
t =
|
|
2407
|
+
t = R("g"), n = R("ellipse"), i = R("ellipse"), f(n, "class", "a9s-outer"), f(n, "style", o = /*computedStyle*/
|
|
2408
2408
|
e[1] ? "display:none;" : void 0), f(
|
|
2409
2409
|
n,
|
|
2410
2410
|
"cx",
|
|
@@ -2454,7 +2454,7 @@ function Do(e) {
|
|
|
2454
2454
|
e[0].id);
|
|
2455
2455
|
},
|
|
2456
2456
|
m(r, a) {
|
|
2457
|
-
|
|
2457
|
+
I(r, t, a), re(t, n), re(t, i);
|
|
2458
2458
|
},
|
|
2459
2459
|
p(r, [a]) {
|
|
2460
2460
|
a & /*computedStyle*/
|
|
@@ -2469,38 +2469,38 @@ function Do(e) {
|
|
|
2469
2469
|
1 && s !== (s = /*annotation*/
|
|
2470
2470
|
r[0].id) && f(t, "data-id", s);
|
|
2471
2471
|
},
|
|
2472
|
-
i:
|
|
2473
|
-
o:
|
|
2472
|
+
i: F,
|
|
2473
|
+
o: F,
|
|
2474
2474
|
d(r) {
|
|
2475
2475
|
r && k(t);
|
|
2476
2476
|
}
|
|
2477
2477
|
};
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2479
|
+
function Do(e, t, n) {
|
|
2480
2480
|
let o, { annotation: i } = t, { geom: s } = t, { style: r = void 0 } = t;
|
|
2481
|
-
const { cx: a, cy: l, rx:
|
|
2482
|
-
return e.$$set = (
|
|
2483
|
-
"annotation" in
|
|
2481
|
+
const { cx: a, cy: l, rx: c, ry: h } = s;
|
|
2482
|
+
return e.$$set = (u) => {
|
|
2483
|
+
"annotation" in u && n(0, i = u.annotation), "geom" in u && n(6, s = u.geom), "style" in u && n(7, r = u.style);
|
|
2484
2484
|
}, e.$$.update = () => {
|
|
2485
2485
|
e.$$.dirty & /*annotation, style*/
|
|
2486
|
-
129 && n(1, o =
|
|
2487
|
-
}, [i, o, a, l,
|
|
2486
|
+
129 && n(1, o = He(i, r));
|
|
2487
|
+
}, [i, o, a, l, c, h, s, r];
|
|
2488
2488
|
}
|
|
2489
|
-
class
|
|
2489
|
+
class Ro extends te {
|
|
2490
2490
|
constructor(t) {
|
|
2491
|
-
super(), ee(this, t,
|
|
2491
|
+
super(), ee(this, t, Do, Xo, J, { annotation: 0, geom: 6, style: 7 });
|
|
2492
2492
|
}
|
|
2493
2493
|
}
|
|
2494
|
-
function
|
|
2494
|
+
function Co(e) {
|
|
2495
2495
|
let t, n, o, i, s;
|
|
2496
2496
|
return {
|
|
2497
2497
|
c() {
|
|
2498
|
-
t =
|
|
2498
|
+
t = R("g"), n = R("polygon"), i = R("polygon"), f(n, "class", "a9s-outer"), f(n, "style", o = /*computedStyle*/
|
|
2499
2499
|
e[1] ? "display:none;" : void 0), f(
|
|
2500
2500
|
n,
|
|
2501
2501
|
"points",
|
|
2502
2502
|
/*points*/
|
|
2503
|
-
e[2].map(
|
|
2503
|
+
e[2].map(Uo).join(" ")
|
|
2504
2504
|
), f(i, "class", "a9s-inner"), f(
|
|
2505
2505
|
i,
|
|
2506
2506
|
"style",
|
|
@@ -2510,12 +2510,12 @@ function Go(e) {
|
|
|
2510
2510
|
i,
|
|
2511
2511
|
"points",
|
|
2512
2512
|
/*points*/
|
|
2513
|
-
e[2].map(
|
|
2513
|
+
e[2].map(No).join(" ")
|
|
2514
2514
|
), f(t, "data-id", s = /*annotation*/
|
|
2515
2515
|
e[0].id);
|
|
2516
2516
|
},
|
|
2517
2517
|
m(r, a) {
|
|
2518
|
-
|
|
2518
|
+
I(r, t, a), re(t, n), re(t, i);
|
|
2519
2519
|
},
|
|
2520
2520
|
p(r, [a]) {
|
|
2521
2521
|
a & /*computedStyle*/
|
|
@@ -2530,34 +2530,34 @@ function Go(e) {
|
|
|
2530
2530
|
1 && s !== (s = /*annotation*/
|
|
2531
2531
|
r[0].id) && f(t, "data-id", s);
|
|
2532
2532
|
},
|
|
2533
|
-
i:
|
|
2534
|
-
o:
|
|
2533
|
+
i: F,
|
|
2534
|
+
o: F,
|
|
2535
2535
|
d(r) {
|
|
2536
2536
|
r && k(t);
|
|
2537
2537
|
}
|
|
2538
2538
|
};
|
|
2539
2539
|
}
|
|
2540
|
-
const
|
|
2541
|
-
function
|
|
2540
|
+
const Uo = (e) => e.join(","), No = (e) => e.join(",");
|
|
2541
|
+
function Vo(e, t, n) {
|
|
2542
2542
|
let o, { annotation: i } = t, { geom: s } = t, { style: r = void 0 } = t;
|
|
2543
2543
|
const { points: a } = s;
|
|
2544
2544
|
return e.$$set = (l) => {
|
|
2545
2545
|
"annotation" in l && n(0, i = l.annotation), "geom" in l && n(3, s = l.geom), "style" in l && n(4, r = l.style);
|
|
2546
2546
|
}, e.$$.update = () => {
|
|
2547
2547
|
e.$$.dirty & /*annotation, style*/
|
|
2548
|
-
17 && n(1, o =
|
|
2548
|
+
17 && n(1, o = He(i, r));
|
|
2549
2549
|
}, [i, o, a, s, r];
|
|
2550
2550
|
}
|
|
2551
|
-
class
|
|
2551
|
+
class Go extends te {
|
|
2552
2552
|
constructor(t) {
|
|
2553
|
-
super(), ee(this, t,
|
|
2553
|
+
super(), ee(this, t, Vo, Co, J, { annotation: 0, geom: 3, style: 4 });
|
|
2554
2554
|
}
|
|
2555
2555
|
}
|
|
2556
|
-
function
|
|
2556
|
+
function Fo(e) {
|
|
2557
2557
|
let t, n, o, i, s;
|
|
2558
2558
|
return {
|
|
2559
2559
|
c() {
|
|
2560
|
-
t =
|
|
2560
|
+
t = R("g"), n = R("rect"), i = R("rect"), f(n, "class", "a9s-outer"), f(n, "style", o = /*computedStyle*/
|
|
2561
2561
|
e[5] ? "display:none;" : void 0), f(
|
|
2562
2562
|
n,
|
|
2563
2563
|
"x",
|
|
@@ -2607,7 +2607,7 @@ function jo(e) {
|
|
|
2607
2607
|
e[0].id);
|
|
2608
2608
|
},
|
|
2609
2609
|
m(r, a) {
|
|
2610
|
-
|
|
2610
|
+
I(r, t, a), re(t, n), re(t, i);
|
|
2611
2611
|
},
|
|
2612
2612
|
p(r, [a]) {
|
|
2613
2613
|
a & /*computedStyle*/
|
|
@@ -2670,84 +2670,84 @@ function jo(e) {
|
|
|
2670
2670
|
1 && s !== (s = /*annotation*/
|
|
2671
2671
|
r[0].id) && f(t, "data-id", s);
|
|
2672
2672
|
},
|
|
2673
|
-
i:
|
|
2674
|
-
o:
|
|
2673
|
+
i: F,
|
|
2674
|
+
o: F,
|
|
2675
2675
|
d(r) {
|
|
2676
2676
|
r && k(t);
|
|
2677
2677
|
}
|
|
2678
2678
|
};
|
|
2679
2679
|
}
|
|
2680
|
-
function
|
|
2681
|
-
let o, i, s, r, a, { annotation: l } = t, { geom:
|
|
2682
|
-
return e.$$set = (
|
|
2683
|
-
"annotation" in
|
|
2680
|
+
function Ho(e, t, n) {
|
|
2681
|
+
let o, i, s, r, a, { annotation: l } = t, { geom: c } = t, { style: h = void 0 } = t;
|
|
2682
|
+
return e.$$set = (u) => {
|
|
2683
|
+
"annotation" in u && n(0, l = u.annotation), "geom" in u && n(6, c = u.geom), "style" in u && n(7, h = u.style);
|
|
2684
2684
|
}, e.$$.update = () => {
|
|
2685
2685
|
e.$$.dirty & /*annotation, style*/
|
|
2686
|
-
129 && n(5, o =
|
|
2687
|
-
64 && n(4, { x: i, y: s, w: r, h: a } =
|
|
2688
|
-
}, [l, a, r, s, i, o,
|
|
2686
|
+
129 && n(5, o = He(l, h)), e.$$.dirty & /*geom*/
|
|
2687
|
+
64 && n(4, { x: i, y: s, w: r, h: a } = c, i, (n(3, s), n(6, c)), (n(2, r), n(6, c)), (n(1, a), n(6, c)));
|
|
2688
|
+
}, [l, a, r, s, i, o, c, h];
|
|
2689
2689
|
}
|
|
2690
|
-
class
|
|
2690
|
+
class zo extends te {
|
|
2691
2691
|
constructor(t) {
|
|
2692
|
-
super(), ee(this, t,
|
|
2692
|
+
super(), ee(this, t, Ho, Fo, J, { annotation: 0, geom: 6, style: 7 });
|
|
2693
2693
|
}
|
|
2694
2694
|
}
|
|
2695
|
-
const
|
|
2695
|
+
const bi = {
|
|
2696
2696
|
elementToImage: (e, t) => [e, t]
|
|
2697
|
-
},
|
|
2697
|
+
}, jo = (e) => ({
|
|
2698
2698
|
elementToImage: (t, n) => {
|
|
2699
2699
|
const o = e.getBoundingClientRect(), i = e.createSVGPoint();
|
|
2700
2700
|
i.x = t + o.x, i.y = n + o.y;
|
|
2701
2701
|
const { x: s, y: r } = i.matrixTransform(e.getScreenCTM().inverse());
|
|
2702
2702
|
return [s, r];
|
|
2703
2703
|
}
|
|
2704
|
-
}),
|
|
2704
|
+
}), qo = 250, Ko = (e, t) => {
|
|
2705
2705
|
const n = Se();
|
|
2706
2706
|
let o;
|
|
2707
2707
|
return { onPointerDown: () => o = performance.now(), onPointerUp: (r) => {
|
|
2708
|
-
if (performance.now() - o <
|
|
2709
|
-
const { x: l, y:
|
|
2708
|
+
if (performance.now() - o < qo) {
|
|
2709
|
+
const { x: l, y: c } = Wo(r, e), h = t.getAt(l, c);
|
|
2710
2710
|
h ? n("click", { originalEvent: r, annotation: h }) : n("click", { originalEvent: r });
|
|
2711
2711
|
}
|
|
2712
2712
|
} };
|
|
2713
|
-
},
|
|
2713
|
+
}, Wo = (e, t) => {
|
|
2714
2714
|
const n = t.createSVGPoint(), o = t.getBoundingClientRect(), i = e.clientX - o.x, s = e.clientY - o.y, { left: r, top: a } = t.getBoundingClientRect();
|
|
2715
2715
|
return n.x = i + r, n.y = s + a, n.matrixTransform(t.getScreenCTM().inverse());
|
|
2716
2716
|
};
|
|
2717
|
-
function
|
|
2717
|
+
function Lt(e, t, n) {
|
|
2718
2718
|
const o = e.slice();
|
|
2719
2719
|
return o[29] = t[n], o;
|
|
2720
2720
|
}
|
|
2721
|
-
function
|
|
2721
|
+
function Ot(e, t, n) {
|
|
2722
2722
|
const o = e.slice();
|
|
2723
2723
|
return o[32] = t[n], o;
|
|
2724
2724
|
}
|
|
2725
|
-
function
|
|
2725
|
+
function xe(e) {
|
|
2726
2726
|
const t = e.slice(), n = (
|
|
2727
2727
|
/*annotation*/
|
|
2728
2728
|
t[32].target.selector
|
|
2729
2729
|
);
|
|
2730
2730
|
return t[35] = n, t;
|
|
2731
2731
|
}
|
|
2732
|
-
function
|
|
2732
|
+
function kt(e) {
|
|
2733
2733
|
let t = (
|
|
2734
2734
|
/*annotation*/
|
|
2735
2735
|
e[32].id
|
|
2736
|
-
), n, o, i =
|
|
2736
|
+
), n, o, i = It(e);
|
|
2737
2737
|
return {
|
|
2738
2738
|
c() {
|
|
2739
2739
|
i.c(), n = se();
|
|
2740
2740
|
},
|
|
2741
2741
|
m(s, r) {
|
|
2742
|
-
i.m(s, r),
|
|
2742
|
+
i.m(s, r), I(s, n, r), o = !0;
|
|
2743
2743
|
},
|
|
2744
2744
|
p(s, r) {
|
|
2745
2745
|
r[0] & /*$store*/
|
|
2746
|
-
8192 &&
|
|
2747
|
-
s[32].id) ? (ne(), N(i, 1, 1,
|
|
2746
|
+
8192 && J(t, t = /*annotation*/
|
|
2747
|
+
s[32].id) ? (ne(), N(i, 1, 1, F), oe(), i = It(s), i.c(), C(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
|
|
2748
2748
|
},
|
|
2749
2749
|
i(s) {
|
|
2750
|
-
o || (
|
|
2750
|
+
o || (C(i), o = !0);
|
|
2751
2751
|
},
|
|
2752
2752
|
o(s) {
|
|
2753
2753
|
N(i), o = !1;
|
|
@@ -2757,9 +2757,9 @@ function Ct(e) {
|
|
|
2757
2757
|
}
|
|
2758
2758
|
};
|
|
2759
2759
|
}
|
|
2760
|
-
function
|
|
2760
|
+
function Jo(e) {
|
|
2761
2761
|
let t, n;
|
|
2762
|
-
return t = new
|
|
2762
|
+
return t = new Go({
|
|
2763
2763
|
props: {
|
|
2764
2764
|
annotation: (
|
|
2765
2765
|
/*annotation*/
|
|
@@ -2792,7 +2792,7 @@ function xo(e) {
|
|
|
2792
2792
|
o[1]), t.$set(s);
|
|
2793
2793
|
},
|
|
2794
2794
|
i(o) {
|
|
2795
|
-
n || (
|
|
2795
|
+
n || (C(t.$$.fragment, o), n = !0);
|
|
2796
2796
|
},
|
|
2797
2797
|
o(o) {
|
|
2798
2798
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -2802,9 +2802,9 @@ function xo(e) {
|
|
|
2802
2802
|
}
|
|
2803
2803
|
};
|
|
2804
2804
|
}
|
|
2805
|
-
function
|
|
2805
|
+
function Zo(e) {
|
|
2806
2806
|
let t, n;
|
|
2807
|
-
return t = new
|
|
2807
|
+
return t = new zo({
|
|
2808
2808
|
props: {
|
|
2809
2809
|
annotation: (
|
|
2810
2810
|
/*annotation*/
|
|
@@ -2837,7 +2837,7 @@ function $o(e) {
|
|
|
2837
2837
|
o[1]), t.$set(s);
|
|
2838
2838
|
},
|
|
2839
2839
|
i(o) {
|
|
2840
|
-
n || (
|
|
2840
|
+
n || (C(t.$$.fragment, o), n = !0);
|
|
2841
2841
|
},
|
|
2842
2842
|
o(o) {
|
|
2843
2843
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -2847,9 +2847,9 @@ function $o(e) {
|
|
|
2847
2847
|
}
|
|
2848
2848
|
};
|
|
2849
2849
|
}
|
|
2850
|
-
function
|
|
2850
|
+
function Qo(e) {
|
|
2851
2851
|
let t, n;
|
|
2852
|
-
return t = new
|
|
2852
|
+
return t = new Ro({
|
|
2853
2853
|
props: {
|
|
2854
2854
|
annotation: (
|
|
2855
2855
|
/*annotation*/
|
|
@@ -2882,7 +2882,7 @@ function ei(e) {
|
|
|
2882
2882
|
o[1]), t.$set(s);
|
|
2883
2883
|
},
|
|
2884
2884
|
i(o) {
|
|
2885
|
-
n || (
|
|
2885
|
+
n || (C(t.$$.fragment, o), n = !0);
|
|
2886
2886
|
},
|
|
2887
2887
|
o(o) {
|
|
2888
2888
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -2892,17 +2892,17 @@ function ei(e) {
|
|
|
2892
2892
|
}
|
|
2893
2893
|
};
|
|
2894
2894
|
}
|
|
2895
|
-
function
|
|
2895
|
+
function It(e) {
|
|
2896
2896
|
let t, n, o, i;
|
|
2897
|
-
const s = [
|
|
2898
|
-
function a(l,
|
|
2897
|
+
const s = [Qo, Zo, Jo], r = [];
|
|
2898
|
+
function a(l, c) {
|
|
2899
2899
|
return (
|
|
2900
2900
|
/*selector*/
|
|
2901
|
-
l[35].type ===
|
|
2901
|
+
l[35].type === z.ELLIPSE ? 0 : (
|
|
2902
2902
|
/*selector*/
|
|
2903
|
-
l[35].type ===
|
|
2903
|
+
l[35].type === z.RECTANGLE ? 1 : (
|
|
2904
2904
|
/*selector*/
|
|
2905
|
-
l[35].type ===
|
|
2905
|
+
l[35].type === z.POLYGON ? 2 : -1
|
|
2906
2906
|
)
|
|
2907
2907
|
)
|
|
2908
2908
|
);
|
|
@@ -2911,17 +2911,17 @@ function Pt(e) {
|
|
|
2911
2911
|
c() {
|
|
2912
2912
|
n && n.c(), o = se();
|
|
2913
2913
|
},
|
|
2914
|
-
m(l,
|
|
2915
|
-
~t && r[t].m(l,
|
|
2914
|
+
m(l, c) {
|
|
2915
|
+
~t && r[t].m(l, c), I(l, o, c), i = !0;
|
|
2916
2916
|
},
|
|
2917
|
-
p(l,
|
|
2917
|
+
p(l, c) {
|
|
2918
2918
|
let h = t;
|
|
2919
|
-
t = a(l), t === h ? ~t && r[t].p(l,
|
|
2919
|
+
t = a(l), t === h ? ~t && r[t].p(l, c) : (n && (ne(), N(r[h], 1, 1, () => {
|
|
2920
2920
|
r[h] = null;
|
|
2921
|
-
}), oe()), ~t ? (n = r[t], n ? n.p(l,
|
|
2921
|
+
}), oe()), ~t ? (n = r[t], n ? n.p(l, c) : (n = r[t] = s[t](l), n.c()), C(n, 1), n.m(o.parentNode, o)) : n = null);
|
|
2922
2922
|
},
|
|
2923
2923
|
i(l) {
|
|
2924
|
-
i || (
|
|
2924
|
+
i || (C(n), i = !0);
|
|
2925
2925
|
},
|
|
2926
2926
|
o(l) {
|
|
2927
2927
|
N(n), i = !1;
|
|
@@ -2931,18 +2931,18 @@ function Pt(e) {
|
|
|
2931
2931
|
}
|
|
2932
2932
|
};
|
|
2933
2933
|
}
|
|
2934
|
-
function
|
|
2934
|
+
function Bt(e) {
|
|
2935
2935
|
let t = !/*isEditable*/
|
|
2936
2936
|
e[7](
|
|
2937
2937
|
/*annotation*/
|
|
2938
2938
|
e[32]
|
|
2939
|
-
), n, o, i = t &&
|
|
2939
|
+
), n, o, i = t && kt(xe(e));
|
|
2940
2940
|
return {
|
|
2941
2941
|
c() {
|
|
2942
2942
|
i && i.c(), n = se();
|
|
2943
2943
|
},
|
|
2944
2944
|
m(s, r) {
|
|
2945
|
-
i && i.m(s, r),
|
|
2945
|
+
i && i.m(s, r), I(s, n, r), o = !0;
|
|
2946
2946
|
},
|
|
2947
2947
|
p(s, r) {
|
|
2948
2948
|
r[0] & /*isEditable, $store*/
|
|
@@ -2950,13 +2950,13 @@ function Rt(e) {
|
|
|
2950
2950
|
s[7](
|
|
2951
2951
|
/*annotation*/
|
|
2952
2952
|
s[32]
|
|
2953
|
-
)), t ? i ? (i.p(
|
|
2954
|
-
8320 &&
|
|
2953
|
+
)), t ? i ? (i.p(xe(s), r), r[0] & /*isEditable, $store*/
|
|
2954
|
+
8320 && C(i, 1)) : (i = kt(xe(s)), i.c(), C(i, 1), i.m(n.parentNode, n)) : i && (ne(), N(i, 1, 1, () => {
|
|
2955
2955
|
i = null;
|
|
2956
2956
|
}), oe());
|
|
2957
2957
|
},
|
|
2958
2958
|
i(s) {
|
|
2959
|
-
o || (
|
|
2959
|
+
o || (C(i), o = !0);
|
|
2960
2960
|
},
|
|
2961
2961
|
o(s) {
|
|
2962
2962
|
N(i), o = !1;
|
|
@@ -2966,10 +2966,10 @@ function Rt(e) {
|
|
|
2966
2966
|
}
|
|
2967
2967
|
};
|
|
2968
2968
|
}
|
|
2969
|
-
function
|
|
2969
|
+
function Pt(e) {
|
|
2970
2970
|
let t, n, o, i;
|
|
2971
|
-
const s = [
|
|
2972
|
-
function a(l,
|
|
2971
|
+
const s = [$o, xo], r = [];
|
|
2972
|
+
function a(l, c) {
|
|
2973
2973
|
return (
|
|
2974
2974
|
/*editableAnnotations*/
|
|
2975
2975
|
l[6] ? 0 : (
|
|
@@ -2983,17 +2983,17 @@ function Yt(e) {
|
|
|
2983
2983
|
c() {
|
|
2984
2984
|
n && n.c(), o = se();
|
|
2985
2985
|
},
|
|
2986
|
-
m(l,
|
|
2987
|
-
~t && r[t].m(l,
|
|
2986
|
+
m(l, c) {
|
|
2987
|
+
~t && r[t].m(l, c), I(l, o, c), i = !0;
|
|
2988
2988
|
},
|
|
2989
|
-
p(l,
|
|
2989
|
+
p(l, c) {
|
|
2990
2990
|
let h = t;
|
|
2991
|
-
t = a(l), t === h ? ~t && r[t].p(l,
|
|
2991
|
+
t = a(l), t === h ? ~t && r[t].p(l, c) : (n && (ne(), N(r[h], 1, 1, () => {
|
|
2992
2992
|
r[h] = null;
|
|
2993
|
-
}), oe()), ~t ? (n = r[t], n ? n.p(l,
|
|
2993
|
+
}), oe()), ~t ? (n = r[t], n ? n.p(l, c) : (n = r[t] = s[t](l), n.c()), C(n, 1), n.m(o.parentNode, o)) : n = null);
|
|
2994
2994
|
},
|
|
2995
2995
|
i(l) {
|
|
2996
|
-
i || (
|
|
2996
|
+
i || (C(n), i = !0);
|
|
2997
2997
|
},
|
|
2998
2998
|
o(l) {
|
|
2999
2999
|
N(n), i = !1;
|
|
@@ -3003,25 +3003,25 @@ function Yt(e) {
|
|
|
3003
3003
|
}
|
|
3004
3004
|
};
|
|
3005
3005
|
}
|
|
3006
|
-
function
|
|
3006
|
+
function xo(e) {
|
|
3007
3007
|
let t = (
|
|
3008
3008
|
/*toolName*/
|
|
3009
3009
|
e[2]
|
|
3010
|
-
), n, o, i =
|
|
3010
|
+
), n, o, i = Yt(e);
|
|
3011
3011
|
return {
|
|
3012
3012
|
c() {
|
|
3013
3013
|
i.c(), n = se();
|
|
3014
3014
|
},
|
|
3015
3015
|
m(s, r) {
|
|
3016
|
-
i.m(s, r),
|
|
3016
|
+
i.m(s, r), I(s, n, r), o = !0;
|
|
3017
3017
|
},
|
|
3018
3018
|
p(s, r) {
|
|
3019
3019
|
r[0] & /*toolName*/
|
|
3020
|
-
4 &&
|
|
3021
|
-
s[2]) ? (ne(), N(i, 1, 1,
|
|
3020
|
+
4 && J(t, t = /*toolName*/
|
|
3021
|
+
s[2]) ? (ne(), N(i, 1, 1, F), oe(), i = Yt(s), i.c(), C(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
|
|
3022
3022
|
},
|
|
3023
3023
|
i(s) {
|
|
3024
|
-
o || (
|
|
3024
|
+
o || (C(i), o = !0);
|
|
3025
3025
|
},
|
|
3026
3026
|
o(s) {
|
|
3027
3027
|
N(i), o = !1;
|
|
@@ -3031,13 +3031,13 @@ function ti(e) {
|
|
|
3031
3031
|
}
|
|
3032
3032
|
};
|
|
3033
3033
|
}
|
|
3034
|
-
function
|
|
3034
|
+
function $o(e) {
|
|
3035
3035
|
let t, n, o = (
|
|
3036
3036
|
/*editableAnnotations*/
|
|
3037
3037
|
e[6]
|
|
3038
3038
|
), i = [];
|
|
3039
3039
|
for (let r = 0; r < o.length; r += 1)
|
|
3040
|
-
i[r] =
|
|
3040
|
+
i[r] = Dt(Lt(e, o, r));
|
|
3041
3041
|
const s = (r) => N(i[r], 1, 1, () => {
|
|
3042
3042
|
i[r] = null;
|
|
3043
3043
|
});
|
|
@@ -3050,7 +3050,7 @@ function ni(e) {
|
|
|
3050
3050
|
m(r, a) {
|
|
3051
3051
|
for (let l = 0; l < i.length; l += 1)
|
|
3052
3052
|
i[l] && i[l].m(r, a);
|
|
3053
|
-
|
|
3053
|
+
I(r, t, a), n = !0;
|
|
3054
3054
|
},
|
|
3055
3055
|
p(r, a) {
|
|
3056
3056
|
if (a[0] & /*editableAnnotations, drawingEl, style, transform, $scale, onChangeSelected*/
|
|
@@ -3059,8 +3059,8 @@ function ni(e) {
|
|
|
3059
3059
|
r[6];
|
|
3060
3060
|
let l;
|
|
3061
3061
|
for (l = 0; l < o.length; l += 1) {
|
|
3062
|
-
const
|
|
3063
|
-
i[l] ? (i[l].p(
|
|
3062
|
+
const c = Lt(r, o, l);
|
|
3063
|
+
i[l] ? (i[l].p(c, a), C(i[l], 1)) : (i[l] = Dt(c), i[l].c(), C(i[l], 1), i[l].m(t.parentNode, t));
|
|
3064
3064
|
}
|
|
3065
3065
|
for (ne(), l = o.length; l < i.length; l += 1)
|
|
3066
3066
|
s(l);
|
|
@@ -3070,7 +3070,7 @@ function ni(e) {
|
|
|
3070
3070
|
i(r) {
|
|
3071
3071
|
if (!n) {
|
|
3072
3072
|
for (let a = 0; a < o.length; a += 1)
|
|
3073
|
-
|
|
3073
|
+
C(i[a]);
|
|
3074
3074
|
n = !0;
|
|
3075
3075
|
}
|
|
3076
3076
|
},
|
|
@@ -3081,13 +3081,13 @@ function ni(e) {
|
|
|
3081
3081
|
n = !1;
|
|
3082
3082
|
},
|
|
3083
3083
|
d(r) {
|
|
3084
|
-
|
|
3084
|
+
st(i, r), r && k(t);
|
|
3085
3085
|
}
|
|
3086
3086
|
};
|
|
3087
3087
|
}
|
|
3088
|
-
function
|
|
3088
|
+
function Yt(e) {
|
|
3089
3089
|
let t, n;
|
|
3090
|
-
return t = new
|
|
3090
|
+
return t = new Ao({
|
|
3091
3091
|
props: {
|
|
3092
3092
|
target: (
|
|
3093
3093
|
/*drawingEl*/
|
|
@@ -3136,7 +3136,7 @@ function Ut(e) {
|
|
|
3136
3136
|
o[14]), t.$set(s);
|
|
3137
3137
|
},
|
|
3138
3138
|
i(o) {
|
|
3139
|
-
n || (
|
|
3139
|
+
n || (C(t.$$.fragment, o), n = !0);
|
|
3140
3140
|
},
|
|
3141
3141
|
o(o) {
|
|
3142
3142
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -3146,15 +3146,15 @@ function Ut(e) {
|
|
|
3146
3146
|
}
|
|
3147
3147
|
};
|
|
3148
3148
|
}
|
|
3149
|
-
function
|
|
3149
|
+
function Xt(e) {
|
|
3150
3150
|
let t, n;
|
|
3151
|
-
return t = new
|
|
3151
|
+
return t = new bo({
|
|
3152
3152
|
props: {
|
|
3153
3153
|
target: (
|
|
3154
3154
|
/*drawingEl*/
|
|
3155
3155
|
e[4]
|
|
3156
3156
|
),
|
|
3157
|
-
editor:
|
|
3157
|
+
editor: At(
|
|
3158
3158
|
/*editable*/
|
|
3159
3159
|
e[29].target.selector
|
|
3160
3160
|
),
|
|
@@ -3199,7 +3199,7 @@ function Dt(e) {
|
|
|
3199
3199
|
i[0] & /*drawingEl*/
|
|
3200
3200
|
16 && (s.target = /*drawingEl*/
|
|
3201
3201
|
e[4]), i[0] & /*editableAnnotations*/
|
|
3202
|
-
64 && (s.editor =
|
|
3202
|
+
64 && (s.editor = At(
|
|
3203
3203
|
/*editable*/
|
|
3204
3204
|
e[29].target.selector
|
|
3205
3205
|
)), i[0] & /*editableAnnotations*/
|
|
@@ -3213,7 +3213,7 @@ function Dt(e) {
|
|
|
3213
3213
|
e[14]), t.$set(s);
|
|
3214
3214
|
},
|
|
3215
3215
|
i(o) {
|
|
3216
|
-
n || (
|
|
3216
|
+
n || (C(t.$$.fragment, o), n = !0);
|
|
3217
3217
|
},
|
|
3218
3218
|
o(o) {
|
|
3219
3219
|
N(t.$$.fragment, o), n = !1;
|
|
@@ -3223,25 +3223,25 @@ function Dt(e) {
|
|
|
3223
3223
|
}
|
|
3224
3224
|
};
|
|
3225
3225
|
}
|
|
3226
|
-
function
|
|
3226
|
+
function Dt(e) {
|
|
3227
3227
|
let t = (
|
|
3228
3228
|
/*editable*/
|
|
3229
3229
|
e[29].id
|
|
3230
|
-
), n, o, i =
|
|
3230
|
+
), n, o, i = Xt(e);
|
|
3231
3231
|
return {
|
|
3232
3232
|
c() {
|
|
3233
3233
|
i.c(), n = se();
|
|
3234
3234
|
},
|
|
3235
3235
|
m(s, r) {
|
|
3236
|
-
i.m(s, r),
|
|
3236
|
+
i.m(s, r), I(s, n, r), o = !0;
|
|
3237
3237
|
},
|
|
3238
3238
|
p(s, r) {
|
|
3239
3239
|
r[0] & /*editableAnnotations*/
|
|
3240
|
-
64 &&
|
|
3241
|
-
s[29].id) ? (ne(), N(i, 1, 1,
|
|
3240
|
+
64 && J(t, t = /*editable*/
|
|
3241
|
+
s[29].id) ? (ne(), N(i, 1, 1, F), oe(), i = Xt(s), i.c(), C(i, 1), i.m(n.parentNode, n)) : i.p(s, r);
|
|
3242
3242
|
},
|
|
3243
3243
|
i(s) {
|
|
3244
|
-
o || (
|
|
3244
|
+
o || (C(i), o = !0);
|
|
3245
3245
|
},
|
|
3246
3246
|
o(s) {
|
|
3247
3247
|
N(i), o = !1;
|
|
@@ -3251,44 +3251,44 @@ function Xt(e) {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
};
|
|
3253
3253
|
}
|
|
3254
|
-
function
|
|
3254
|
+
function ei(e) {
|
|
3255
3255
|
let t, n, o, i, s, r, a = (
|
|
3256
3256
|
/*$store*/
|
|
3257
3257
|
e[13]
|
|
3258
3258
|
), l = [];
|
|
3259
|
-
for (let
|
|
3260
|
-
l[
|
|
3261
|
-
const
|
|
3262
|
-
l[
|
|
3259
|
+
for (let u = 0; u < a.length; u += 1)
|
|
3260
|
+
l[u] = Bt(Ot(e, a, u));
|
|
3261
|
+
const c = (u) => N(l[u], 1, 1, () => {
|
|
3262
|
+
l[u] = null;
|
|
3263
3263
|
});
|
|
3264
3264
|
let h = (
|
|
3265
3265
|
/*drawingEl*/
|
|
3266
|
-
e[4] &&
|
|
3266
|
+
e[4] && Pt(e)
|
|
3267
3267
|
);
|
|
3268
3268
|
return {
|
|
3269
3269
|
c() {
|
|
3270
|
-
t =
|
|
3271
|
-
for (let
|
|
3272
|
-
l[
|
|
3273
|
-
o =
|
|
3270
|
+
t = R("svg"), n = R("g");
|
|
3271
|
+
for (let u = 0; u < l.length; u += 1)
|
|
3272
|
+
l[u].c();
|
|
3273
|
+
o = R("g"), h && h.c(), f(o, "class", "drawing"), f(t, "class", "a9s-annotationlayer"), ht(
|
|
3274
3274
|
t,
|
|
3275
3275
|
"drawing",
|
|
3276
3276
|
/*tool*/
|
|
3277
3277
|
e[12]
|
|
3278
3278
|
);
|
|
3279
3279
|
},
|
|
3280
|
-
m(
|
|
3281
|
-
|
|
3282
|
-
for (let
|
|
3283
|
-
l[
|
|
3280
|
+
m(u, m) {
|
|
3281
|
+
I(u, t, m), re(t, n);
|
|
3282
|
+
for (let d = 0; d < l.length; d += 1)
|
|
3283
|
+
l[d] && l[d].m(n, null);
|
|
3284
3284
|
re(t, o), h && h.m(o, null), e[25](o), e[26](t), i = !0, s || (r = [
|
|
3285
|
-
|
|
3285
|
+
K(t, "pointerup", function() {
|
|
3286
3286
|
j(
|
|
3287
3287
|
/*onPointerUp*/
|
|
3288
3288
|
e[8]
|
|
3289
3289
|
) && e[8].apply(this, arguments);
|
|
3290
3290
|
}),
|
|
3291
|
-
|
|
3291
|
+
K(t, "pointerdown", function() {
|
|
3292
3292
|
j(
|
|
3293
3293
|
/*onPointerDown*/
|
|
3294
3294
|
e[9]
|
|
@@ -3296,146 +3296,146 @@ function oi(e) {
|
|
|
3296
3296
|
})
|
|
3297
3297
|
], s = !0);
|
|
3298
3298
|
},
|
|
3299
|
-
p(
|
|
3300
|
-
if (e =
|
|
3299
|
+
p(u, m) {
|
|
3300
|
+
if (e = u, m[0] & /*$store, style, isEditable*/
|
|
3301
3301
|
8322) {
|
|
3302
3302
|
a = /*$store*/
|
|
3303
3303
|
e[13];
|
|
3304
|
-
let
|
|
3305
|
-
for (
|
|
3306
|
-
const
|
|
3307
|
-
l[
|
|
3304
|
+
let d;
|
|
3305
|
+
for (d = 0; d < a.length; d += 1) {
|
|
3306
|
+
const g = Ot(e, a, d);
|
|
3307
|
+
l[d] ? (l[d].p(g, m), C(l[d], 1)) : (l[d] = Bt(g), l[d].c(), C(l[d], 1), l[d].m(n, null));
|
|
3308
3308
|
}
|
|
3309
|
-
for (ne(),
|
|
3310
|
-
d
|
|
3309
|
+
for (ne(), d = a.length; d < l.length; d += 1)
|
|
3310
|
+
c(d);
|
|
3311
3311
|
oe();
|
|
3312
3312
|
}
|
|
3313
3313
|
/*drawingEl*/
|
|
3314
|
-
e[4] ? h ? (h.p(e,
|
|
3315
|
-
16 &&
|
|
3314
|
+
e[4] ? h ? (h.p(e, m), m[0] & /*drawingEl*/
|
|
3315
|
+
16 && C(h, 1)) : (h = Pt(e), h.c(), C(h, 1), h.m(o, null)) : h && (ne(), N(h, 1, 1, () => {
|
|
3316
3316
|
h = null;
|
|
3317
|
-
}), oe()), (!i ||
|
|
3318
|
-
4096) &&
|
|
3317
|
+
}), oe()), (!i || m[0] & /*tool*/
|
|
3318
|
+
4096) && ht(
|
|
3319
3319
|
t,
|
|
3320
3320
|
"drawing",
|
|
3321
3321
|
/*tool*/
|
|
3322
3322
|
e[12]
|
|
3323
3323
|
);
|
|
3324
3324
|
},
|
|
3325
|
-
i(
|
|
3325
|
+
i(u) {
|
|
3326
3326
|
if (!i) {
|
|
3327
|
-
for (let
|
|
3328
|
-
|
|
3329
|
-
|
|
3327
|
+
for (let m = 0; m < a.length; m += 1)
|
|
3328
|
+
C(l[m]);
|
|
3329
|
+
C(h), i = !0;
|
|
3330
3330
|
}
|
|
3331
3331
|
},
|
|
3332
|
-
o(
|
|
3332
|
+
o(u) {
|
|
3333
3333
|
l = l.filter(Boolean);
|
|
3334
|
-
for (let
|
|
3335
|
-
N(l[
|
|
3334
|
+
for (let m = 0; m < l.length; m += 1)
|
|
3335
|
+
N(l[m]);
|
|
3336
3336
|
N(h), i = !1;
|
|
3337
3337
|
},
|
|
3338
|
-
d(
|
|
3339
|
-
|
|
3340
|
-
}
|
|
3341
|
-
};
|
|
3342
|
-
}
|
|
3343
|
-
function
|
|
3344
|
-
let o, i, s, r, a, l,
|
|
3345
|
-
e.$$.on_destroy.push(() =>
|
|
3346
|
-
let { drawingEnabled:
|
|
3347
|
-
|
|
3348
|
-
const { selection:
|
|
3349
|
-
|
|
3350
|
-
let v = null,
|
|
3351
|
-
const
|
|
3352
|
-
|
|
3353
|
-
const
|
|
3354
|
-
|
|
3355
|
-
const { updated: ce } =
|
|
3356
|
-
n(6,
|
|
3357
|
-
},
|
|
3358
|
-
}, Z = (
|
|
3359
|
-
const
|
|
3360
|
-
id:
|
|
3338
|
+
d(u) {
|
|
3339
|
+
u && k(t), st(l, u), h && h.d(), e[25](null), e[26](null), s = !1, ie(r);
|
|
3340
|
+
}
|
|
3341
|
+
};
|
|
3342
|
+
}
|
|
3343
|
+
function ti(e, t, n) {
|
|
3344
|
+
let o, i, s, r, a, l, c, h, u, m, d = F, g = () => (d(), d = Vt(p, (O) => n(14, m = O)), p);
|
|
3345
|
+
e.$$.on_destroy.push(() => d());
|
|
3346
|
+
let { drawingEnabled: _ } = t, { image: A } = t, { preferredDrawingMode: w } = t, { state: y } = t, { style: T = void 0 } = t, { toolName: S = it().length > 0 ? it()[0] : void 0 } = t, { user: P } = t, X, U, p;
|
|
3347
|
+
Be(() => g(n(5, p = Oo(A, U))));
|
|
3348
|
+
const { selection: E, store: b } = y;
|
|
3349
|
+
dt(e, E, (O) => n(24, h = O)), dt(e, b, (O) => n(13, u = O));
|
|
3350
|
+
let v = null, B = null;
|
|
3351
|
+
const D = (O) => {
|
|
3352
|
+
b.unobserve(v);
|
|
3353
|
+
const W = O.filter(({ editable: G }) => G).map(({ id: G }) => G);
|
|
3354
|
+
W.length > 0 ? (n(6, B = W.map((G) => b.getAnnotation(G))), v = (G) => {
|
|
3355
|
+
const { updated: ce } = G.changes;
|
|
3356
|
+
n(6, B = ce.map((H) => H.newValue));
|
|
3357
|
+
}, b.observe(v, { annotations: W })) : n(6, B = null);
|
|
3358
|
+
}, Z = (O) => {
|
|
3359
|
+
const W = qt(), G = {
|
|
3360
|
+
id: W,
|
|
3361
3361
|
bodies: [],
|
|
3362
3362
|
target: {
|
|
3363
|
-
annotation:
|
|
3364
|
-
selector:
|
|
3365
|
-
creator:
|
|
3363
|
+
annotation: W,
|
|
3364
|
+
selector: O.detail,
|
|
3365
|
+
creator: P,
|
|
3366
3366
|
created: /* @__PURE__ */ new Date()
|
|
3367
3367
|
}
|
|
3368
3368
|
};
|
|
3369
|
-
|
|
3370
|
-
},
|
|
3371
|
-
var
|
|
3372
|
-
const { target:
|
|
3373
|
-
|
|
3374
|
-
...
|
|
3375
|
-
selector:
|
|
3376
|
-
created:
|
|
3377
|
-
updated:
|
|
3378
|
-
updatedBy:
|
|
3369
|
+
b.addAnnotation(G), E.setSelected(G.id);
|
|
3370
|
+
}, me = (O) => (W) => {
|
|
3371
|
+
var ue;
|
|
3372
|
+
const { target: G } = O, ce = 10 * 60 * 1e3, H = ((ue = G.creator) == null ? void 0 : ue.id) !== P.id || !G.created || (/* @__PURE__ */ new Date()).getTime() - G.created.getTime() > ce;
|
|
3373
|
+
b.updateTarget({
|
|
3374
|
+
...G,
|
|
3375
|
+
selector: W.detail,
|
|
3376
|
+
created: H ? G.created : /* @__PURE__ */ new Date(),
|
|
3377
|
+
updated: H ? /* @__PURE__ */ new Date() : null,
|
|
3378
|
+
updatedBy: H ? P : null
|
|
3379
3379
|
});
|
|
3380
3380
|
};
|
|
3381
|
-
function
|
|
3382
|
-
|
|
3383
|
-
|
|
3381
|
+
function ge(O) {
|
|
3382
|
+
Ge[O ? "unshift" : "push"](() => {
|
|
3383
|
+
X = O, n(4, X);
|
|
3384
3384
|
});
|
|
3385
3385
|
}
|
|
3386
|
-
function Me(
|
|
3387
|
-
|
|
3388
|
-
|
|
3386
|
+
function Me(O) {
|
|
3387
|
+
Ge[O ? "unshift" : "push"](() => {
|
|
3388
|
+
U = O, n(3, U);
|
|
3389
3389
|
});
|
|
3390
3390
|
}
|
|
3391
|
-
return e.$$set = (
|
|
3392
|
-
"drawingEnabled" in
|
|
3391
|
+
return e.$$set = (O) => {
|
|
3392
|
+
"drawingEnabled" in O && n(0, _ = O.drawingEnabled), "image" in O && n(19, A = O.image), "preferredDrawingMode" in O && n(20, w = O.preferredDrawingMode), "state" in O && n(21, y = O.state), "style" in O && n(1, T = O.style), "toolName" in O && n(2, S = O.toolName), "user" in O && n(22, P = O.user);
|
|
3393
3393
|
}, e.$$.update = () => {
|
|
3394
3394
|
e.$$.dirty[0] & /*toolName*/
|
|
3395
|
-
4 && n(12, { tool: o, opts: i } =
|
|
3396
|
-
9437184 && n(11, s = (i == null ? void 0 : i.drawingMode) ||
|
|
3397
|
-
8 && n(10, r =
|
|
3398
|
-
8 && n(9, { onPointerDown: a, onPointerUp: l } =
|
|
3399
|
-
16777216 && n(7,
|
|
3400
|
-
16777216 &&
|
|
3395
|
+
4 && n(12, { tool: o, opts: i } = Qt(S), o, (n(23, i), n(2, S))), e.$$.dirty[0] & /*opts, preferredDrawingMode*/
|
|
3396
|
+
9437184 && n(11, s = (i == null ? void 0 : i.drawingMode) || w), e.$$.dirty[0] & /*svgEl*/
|
|
3397
|
+
8 && n(10, r = jo(U)), e.$$.dirty[0] & /*svgEl*/
|
|
3398
|
+
8 && n(9, { onPointerDown: a, onPointerUp: l } = Ko(U, b), a, (n(8, l), n(3, U))), e.$$.dirty[0] & /*$selection*/
|
|
3399
|
+
16777216 && n(7, c = (O) => h.selected.find((W) => W.id === O.id && W.editable)), e.$$.dirty[0] & /*$selection*/
|
|
3400
|
+
16777216 && D(h.selected);
|
|
3401
3401
|
}, [
|
|
3402
|
-
|
|
3403
|
-
|
|
3402
|
+
_,
|
|
3403
|
+
T,
|
|
3404
3404
|
S,
|
|
3405
|
+
U,
|
|
3405
3406
|
X,
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
d,
|
|
3407
|
+
p,
|
|
3408
|
+
B,
|
|
3409
|
+
c,
|
|
3410
3410
|
l,
|
|
3411
3411
|
a,
|
|
3412
3412
|
r,
|
|
3413
3413
|
s,
|
|
3414
3414
|
o,
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
T,
|
|
3415
|
+
u,
|
|
3416
|
+
m,
|
|
3418
3417
|
E,
|
|
3419
|
-
Z,
|
|
3420
|
-
ge,
|
|
3421
3418
|
b,
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3419
|
+
Z,
|
|
3420
|
+
me,
|
|
3421
|
+
A,
|
|
3422
|
+
w,
|
|
3423
|
+
y,
|
|
3424
|
+
P,
|
|
3425
3425
|
i,
|
|
3426
3426
|
h,
|
|
3427
|
-
|
|
3427
|
+
ge,
|
|
3428
3428
|
Me
|
|
3429
3429
|
];
|
|
3430
3430
|
}
|
|
3431
|
-
class
|
|
3431
|
+
class ni extends te {
|
|
3432
3432
|
constructor(t) {
|
|
3433
3433
|
super(), ee(
|
|
3434
3434
|
this,
|
|
3435
3435
|
t,
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3436
|
+
ti,
|
|
3437
|
+
ei,
|
|
3438
|
+
J,
|
|
3439
3439
|
{
|
|
3440
3440
|
drawingEnabled: 0,
|
|
3441
3441
|
image: 19,
|
|
@@ -3450,33 +3450,33 @@ class si extends te {
|
|
|
3450
3450
|
);
|
|
3451
3451
|
}
|
|
3452
3452
|
}
|
|
3453
|
-
function
|
|
3454
|
-
|
|
3453
|
+
function oi(e, t, n, o, i) {
|
|
3454
|
+
xt(e, t, n || 0, o || e.length - 1, i || ii);
|
|
3455
3455
|
}
|
|
3456
|
-
function
|
|
3456
|
+
function xt(e, t, n, o, i) {
|
|
3457
3457
|
for (; o > n; ) {
|
|
3458
3458
|
if (o - n > 600) {
|
|
3459
|
-
var s = o - n + 1, r = t - n + 1, a = Math.log(s), l = 0.5 * Math.exp(2 * a / 3),
|
|
3460
|
-
|
|
3459
|
+
var s = o - n + 1, r = t - n + 1, a = Math.log(s), l = 0.5 * Math.exp(2 * a / 3), c = 0.5 * Math.sqrt(a * l * (s - l) / s) * (r - s / 2 < 0 ? -1 : 1), h = Math.max(n, Math.floor(t - r * l / s + c)), u = Math.min(o, Math.floor(t + (s - r) * l / s + c));
|
|
3460
|
+
xt(e, t, h, u, i);
|
|
3461
3461
|
}
|
|
3462
|
-
var
|
|
3463
|
-
for (ve(e, n, t), i(e[o],
|
|
3464
|
-
for (ve(e,
|
|
3465
|
-
|
|
3466
|
-
for (; i(e[
|
|
3467
|
-
|
|
3462
|
+
var m = e[t], d = n, g = o;
|
|
3463
|
+
for (ve(e, n, t), i(e[o], m) > 0 && ve(e, n, o); d < g; ) {
|
|
3464
|
+
for (ve(e, d, g), d++, g--; i(e[d], m) < 0; )
|
|
3465
|
+
d++;
|
|
3466
|
+
for (; i(e[g], m) > 0; )
|
|
3467
|
+
g--;
|
|
3468
3468
|
}
|
|
3469
|
-
i(e[n],
|
|
3469
|
+
i(e[n], m) === 0 ? ve(e, n, g) : (g++, ve(e, g, o)), g <= t && (n = g + 1), t <= g && (o = g - 1);
|
|
3470
3470
|
}
|
|
3471
3471
|
}
|
|
3472
3472
|
function ve(e, t, n) {
|
|
3473
3473
|
var o = e[t];
|
|
3474
3474
|
e[t] = e[n], e[n] = o;
|
|
3475
3475
|
}
|
|
3476
|
-
function
|
|
3476
|
+
function ii(e, t) {
|
|
3477
3477
|
return e < t ? -1 : e > t ? 1 : 0;
|
|
3478
3478
|
}
|
|
3479
|
-
class
|
|
3479
|
+
class si {
|
|
3480
3480
|
constructor(t = 9) {
|
|
3481
3481
|
this._maxEntries = Math.max(4, t), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
|
|
3482
3482
|
}
|
|
@@ -3486,13 +3486,13 @@ class ai {
|
|
|
3486
3486
|
search(t) {
|
|
3487
3487
|
let n = this.data;
|
|
3488
3488
|
const o = [];
|
|
3489
|
-
if (!
|
|
3489
|
+
if (!Ne(t, n))
|
|
3490
3490
|
return o;
|
|
3491
3491
|
const i = this.toBBox, s = [];
|
|
3492
3492
|
for (; n; ) {
|
|
3493
3493
|
for (let r = 0; r < n.children.length; r++) {
|
|
3494
3494
|
const a = n.children[r], l = n.leaf ? i(a) : a;
|
|
3495
|
-
|
|
3495
|
+
Ne(t, l) && (n.leaf ? o.push(a) : et(t, l) ? this._all(a, o) : s.push(a));
|
|
3496
3496
|
}
|
|
3497
3497
|
n = s.pop();
|
|
3498
3498
|
}
|
|
@@ -3500,14 +3500,14 @@ class ai {
|
|
|
3500
3500
|
}
|
|
3501
3501
|
collides(t) {
|
|
3502
3502
|
let n = this.data;
|
|
3503
|
-
if (!
|
|
3503
|
+
if (!Ne(t, n))
|
|
3504
3504
|
return !1;
|
|
3505
3505
|
const o = [];
|
|
3506
3506
|
for (; n; ) {
|
|
3507
3507
|
for (let i = 0; i < n.children.length; i++) {
|
|
3508
3508
|
const s = n.children[i], r = n.leaf ? this.toBBox(s) : s;
|
|
3509
|
-
if (
|
|
3510
|
-
if (n.leaf ||
|
|
3509
|
+
if (Ne(t, r)) {
|
|
3510
|
+
if (n.leaf || et(t, r))
|
|
3511
3511
|
return !0;
|
|
3512
3512
|
o.push(s);
|
|
3513
3513
|
}
|
|
@@ -3549,14 +3549,14 @@ class ai {
|
|
|
3549
3549
|
return this;
|
|
3550
3550
|
let o = this.data;
|
|
3551
3551
|
const i = this.toBBox(t), s = [], r = [];
|
|
3552
|
-
let a, l,
|
|
3552
|
+
let a, l, c;
|
|
3553
3553
|
for (; o || s.length; ) {
|
|
3554
|
-
if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(),
|
|
3555
|
-
const h =
|
|
3554
|
+
if (o || (o = s.pop(), l = s[s.length - 1], a = r.pop(), c = !0), o.leaf) {
|
|
3555
|
+
const h = ri(t, o.children, n);
|
|
3556
3556
|
if (h !== -1)
|
|
3557
3557
|
return o.children.splice(h, 1), s.push(o), this._condense(s), this;
|
|
3558
3558
|
}
|
|
3559
|
-
!
|
|
3559
|
+
!c && !o.leaf && et(o, i) ? (s.push(o), r.push(a), a = 0, l = o, o = o.children[0]) : l ? (a++, o = l.children[a], c = !1) : o = null;
|
|
3560
3560
|
}
|
|
3561
3561
|
return this;
|
|
3562
3562
|
}
|
|
@@ -3587,14 +3587,14 @@ class ai {
|
|
|
3587
3587
|
if (s <= r)
|
|
3588
3588
|
return a = Ee(t.slice(n, o + 1)), we(a, this.toBBox), a;
|
|
3589
3589
|
i || (i = Math.ceil(Math.log(s) / Math.log(r)), r = Math.ceil(s / Math.pow(r, i - 1))), a = Ee([]), a.leaf = !1, a.height = i;
|
|
3590
|
-
const l = Math.ceil(s / r),
|
|
3591
|
-
|
|
3592
|
-
for (let h = n; h <= o; h +=
|
|
3593
|
-
const
|
|
3594
|
-
|
|
3595
|
-
for (let
|
|
3596
|
-
const
|
|
3597
|
-
a.children.push(this._build(t,
|
|
3590
|
+
const l = Math.ceil(s / r), c = l * Math.ceil(Math.sqrt(r));
|
|
3591
|
+
Rt(t, n, o, c, this.compareMinX);
|
|
3592
|
+
for (let h = n; h <= o; h += c) {
|
|
3593
|
+
const u = Math.min(h + c - 1, o);
|
|
3594
|
+
Rt(t, h, u, l, this.compareMinY);
|
|
3595
|
+
for (let m = h; m <= u; m += l) {
|
|
3596
|
+
const d = Math.min(m + l - 1, u);
|
|
3597
|
+
a.children.push(this._build(t, m, d, i - 1));
|
|
3598
3598
|
}
|
|
3599
3599
|
}
|
|
3600
3600
|
return we(a, this.toBBox), a;
|
|
@@ -3603,8 +3603,8 @@ class ai {
|
|
|
3603
3603
|
for (; i.push(n), !(n.leaf || i.length - 1 === o); ) {
|
|
3604
3604
|
let s = 1 / 0, r = 1 / 0, a;
|
|
3605
3605
|
for (let l = 0; l < n.children.length; l++) {
|
|
3606
|
-
const
|
|
3607
|
-
|
|
3606
|
+
const c = n.children[l], h = $e(c), u = ci(t, c) - h;
|
|
3607
|
+
u < r ? (r = u, s = h < s ? h : s, a = c) : u === r && h < s && (s = h, a = c);
|
|
3608
3608
|
}
|
|
3609
3609
|
n = a || n.children[0];
|
|
3610
3610
|
}
|
|
@@ -3612,7 +3612,7 @@ class ai {
|
|
|
3612
3612
|
}
|
|
3613
3613
|
_insert(t, n, o) {
|
|
3614
3614
|
const i = o ? t : this.toBBox(t), s = [], r = this._chooseSubtree(i, this.data, n, s);
|
|
3615
|
-
for (r.children.push(t),
|
|
3615
|
+
for (r.children.push(t), Oe(r, i); n >= 0 && s[n].children.length > this._maxEntries; )
|
|
3616
3616
|
this._split(s, n), n--;
|
|
3617
3617
|
this._adjustParentBBoxes(i, s, n);
|
|
3618
3618
|
}
|
|
@@ -3629,41 +3629,41 @@ class ai {
|
|
|
3629
3629
|
_chooseSplitIndex(t, n, o) {
|
|
3630
3630
|
let i, s = 1 / 0, r = 1 / 0;
|
|
3631
3631
|
for (let a = n; a <= o - n; a++) {
|
|
3632
|
-
const l =
|
|
3633
|
-
h < s ? (s = h, i = a, r =
|
|
3632
|
+
const l = Le(t, 0, a, this.toBBox), c = Le(t, a, o, this.toBBox), h = ui(l, c), u = $e(l) + $e(c);
|
|
3633
|
+
h < s ? (s = h, i = a, r = u < r ? u : r) : h === s && u < r && (r = u, i = a);
|
|
3634
3634
|
}
|
|
3635
3635
|
return i || o - n;
|
|
3636
3636
|
}
|
|
3637
3637
|
// sorts node children by the best axis for split
|
|
3638
3638
|
_chooseSplitAxis(t, n, o) {
|
|
3639
|
-
const i = t.leaf ? this.compareMinX :
|
|
3639
|
+
const i = t.leaf ? this.compareMinX : li, s = t.leaf ? this.compareMinY : ai, r = this._allDistMargin(t, n, o, i), a = this._allDistMargin(t, n, o, s);
|
|
3640
3640
|
r < a && t.children.sort(i);
|
|
3641
3641
|
}
|
|
3642
3642
|
// total margin of all possible split distributions where each node is at least m full
|
|
3643
3643
|
_allDistMargin(t, n, o, i) {
|
|
3644
3644
|
t.children.sort(i);
|
|
3645
|
-
const s = this.toBBox, r =
|
|
3646
|
-
let l =
|
|
3647
|
-
for (let
|
|
3648
|
-
const h = t.children[
|
|
3649
|
-
|
|
3645
|
+
const s = this.toBBox, r = Le(t, 0, n, s), a = Le(t, o - n, o, s);
|
|
3646
|
+
let l = Ue(r) + Ue(a);
|
|
3647
|
+
for (let c = n; c < o - n; c++) {
|
|
3648
|
+
const h = t.children[c];
|
|
3649
|
+
Oe(r, t.leaf ? s(h) : h), l += Ue(r);
|
|
3650
3650
|
}
|
|
3651
|
-
for (let
|
|
3652
|
-
const h = t.children[
|
|
3653
|
-
|
|
3651
|
+
for (let c = o - n - 1; c >= n; c--) {
|
|
3652
|
+
const h = t.children[c];
|
|
3653
|
+
Oe(a, t.leaf ? s(h) : h), l += Ue(a);
|
|
3654
3654
|
}
|
|
3655
3655
|
return l;
|
|
3656
3656
|
}
|
|
3657
3657
|
_adjustParentBBoxes(t, n, o) {
|
|
3658
3658
|
for (let i = o; i >= 0; i--)
|
|
3659
|
-
|
|
3659
|
+
Oe(n[i], t);
|
|
3660
3660
|
}
|
|
3661
3661
|
_condense(t) {
|
|
3662
3662
|
for (let n = t.length - 1, o; n >= 0; n--)
|
|
3663
3663
|
t[n].children.length === 0 ? n > 0 ? (o = t[n - 1].children, o.splice(o.indexOf(t[n]), 1)) : this.clear() : we(t[n], this.toBBox);
|
|
3664
3664
|
}
|
|
3665
3665
|
}
|
|
3666
|
-
function
|
|
3666
|
+
function ri(e, t, n) {
|
|
3667
3667
|
if (!n)
|
|
3668
3668
|
return t.indexOf(e);
|
|
3669
3669
|
for (let o = 0; o < t.length; o++)
|
|
@@ -3672,42 +3672,42 @@ function ci(e, t, n) {
|
|
|
3672
3672
|
return -1;
|
|
3673
3673
|
}
|
|
3674
3674
|
function we(e, t) {
|
|
3675
|
-
|
|
3675
|
+
Le(e, 0, e.children.length, t, e);
|
|
3676
3676
|
}
|
|
3677
|
-
function
|
|
3677
|
+
function Le(e, t, n, o, i) {
|
|
3678
3678
|
i || (i = Ee(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;
|
|
3679
3679
|
for (let s = t; s < n; s++) {
|
|
3680
3680
|
const r = e.children[s];
|
|
3681
|
-
|
|
3681
|
+
Oe(i, e.leaf ? o(r) : r);
|
|
3682
3682
|
}
|
|
3683
3683
|
return i;
|
|
3684
3684
|
}
|
|
3685
|
-
function
|
|
3685
|
+
function Oe(e, t) {
|
|
3686
3686
|
return e.minX = Math.min(e.minX, t.minX), e.minY = Math.min(e.minY, t.minY), e.maxX = Math.max(e.maxX, t.maxX), e.maxY = Math.max(e.maxY, t.maxY), e;
|
|
3687
3687
|
}
|
|
3688
|
-
function
|
|
3688
|
+
function li(e, t) {
|
|
3689
3689
|
return e.minX - t.minX;
|
|
3690
3690
|
}
|
|
3691
|
-
function
|
|
3691
|
+
function ai(e, t) {
|
|
3692
3692
|
return e.minY - t.minY;
|
|
3693
3693
|
}
|
|
3694
|
-
function
|
|
3694
|
+
function $e(e) {
|
|
3695
3695
|
return (e.maxX - e.minX) * (e.maxY - e.minY);
|
|
3696
3696
|
}
|
|
3697
|
-
function
|
|
3697
|
+
function Ue(e) {
|
|
3698
3698
|
return e.maxX - e.minX + (e.maxY - e.minY);
|
|
3699
3699
|
}
|
|
3700
|
-
function
|
|
3700
|
+
function ci(e, t) {
|
|
3701
3701
|
return (Math.max(t.maxX, e.maxX) - Math.min(t.minX, e.minX)) * (Math.max(t.maxY, e.maxY) - Math.min(t.minY, e.minY));
|
|
3702
3702
|
}
|
|
3703
|
-
function
|
|
3703
|
+
function ui(e, t) {
|
|
3704
3704
|
const n = Math.max(e.minX, t.minX), o = Math.max(e.minY, t.minY), i = Math.min(e.maxX, t.maxX), s = Math.min(e.maxY, t.maxY);
|
|
3705
3705
|
return Math.max(0, i - n) * Math.max(0, s - o);
|
|
3706
3706
|
}
|
|
3707
|
-
function
|
|
3707
|
+
function et(e, t) {
|
|
3708
3708
|
return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
|
|
3709
3709
|
}
|
|
3710
|
-
function
|
|
3710
|
+
function Ne(e, t) {
|
|
3711
3711
|
return t.minX <= e.maxX && t.minY <= e.maxY && t.maxX >= e.minX && t.maxY >= e.minY;
|
|
3712
3712
|
}
|
|
3713
3713
|
function Ee(e) {
|
|
@@ -3721,83 +3721,83 @@ function Ee(e) {
|
|
|
3721
3721
|
maxY: -1 / 0
|
|
3722
3722
|
};
|
|
3723
3723
|
}
|
|
3724
|
-
function
|
|
3724
|
+
function Rt(e, t, n, o, i) {
|
|
3725
3725
|
const s = [t, n];
|
|
3726
3726
|
for (; s.length; ) {
|
|
3727
3727
|
if (n = s.pop(), t = s.pop(), n - t <= o)
|
|
3728
3728
|
continue;
|
|
3729
3729
|
const r = t + Math.ceil((n - t) / o / 2) * o;
|
|
3730
|
-
|
|
3730
|
+
oi(e, r, t, n, i), s.push(t, r, r, n);
|
|
3731
3731
|
}
|
|
3732
3732
|
}
|
|
3733
|
-
const
|
|
3734
|
-
const e = new
|
|
3733
|
+
const fi = () => {
|
|
3734
|
+
const e = new si(), t = /* @__PURE__ */ new Map(), n = () => [...t.values()], o = () => {
|
|
3735
3735
|
e.clear(), t.clear();
|
|
3736
|
-
}, i = (
|
|
3737
|
-
const { minX:
|
|
3738
|
-
e.insert(
|
|
3739
|
-
}, s = (
|
|
3740
|
-
const
|
|
3741
|
-
e.remove(
|
|
3736
|
+
}, i = (u) => {
|
|
3737
|
+
const { minX: m, minY: d, maxX: g, maxY: _ } = u.selector.geometry.bounds, A = { minX: m, minY: d, maxX: g, maxY: _, target: u };
|
|
3738
|
+
e.insert(A), t.set(u.annotation, A);
|
|
3739
|
+
}, s = (u) => {
|
|
3740
|
+
const m = t.get(u.annotation);
|
|
3741
|
+
e.remove(m), t.delete(u.annotation);
|
|
3742
3742
|
};
|
|
3743
3743
|
return {
|
|
3744
3744
|
all: n,
|
|
3745
3745
|
clear: o,
|
|
3746
|
-
getAt: (
|
|
3747
|
-
const
|
|
3748
|
-
minX:
|
|
3749
|
-
minY:
|
|
3750
|
-
maxX:
|
|
3751
|
-
maxY:
|
|
3752
|
-
}).map((
|
|
3753
|
-
if (
|
|
3754
|
-
return
|
|
3755
|
-
},
|
|
3756
|
-
getIntersecting: (
|
|
3757
|
-
minX:
|
|
3758
|
-
minY:
|
|
3759
|
-
maxX:
|
|
3760
|
-
maxY:
|
|
3761
|
-
}).map((
|
|
3746
|
+
getAt: (u, m) => {
|
|
3747
|
+
const g = e.search({
|
|
3748
|
+
minX: u,
|
|
3749
|
+
minY: m,
|
|
3750
|
+
maxX: u,
|
|
3751
|
+
maxY: m
|
|
3752
|
+
}).map((_) => _.target).filter((_) => _.selector.type === z.RECTANGLE || hn(_.selector, u, m));
|
|
3753
|
+
if (g.length > 0)
|
|
3754
|
+
return g.sort((_, A) => ot(_.selector) - ot(A.selector)), g[0];
|
|
3755
|
+
},
|
|
3756
|
+
getIntersecting: (u, m, d, g) => e.search({
|
|
3757
|
+
minX: u,
|
|
3758
|
+
minY: m,
|
|
3759
|
+
maxX: u + d,
|
|
3760
|
+
maxY: m + g
|
|
3761
|
+
}).map((_) => _.target),
|
|
3762
3762
|
insert: i,
|
|
3763
3763
|
remove: s,
|
|
3764
|
-
set: (
|
|
3765
|
-
|
|
3766
|
-
const
|
|
3767
|
-
const { minX:
|
|
3768
|
-
return { minX:
|
|
3764
|
+
set: (u, m = !0) => {
|
|
3765
|
+
m && o();
|
|
3766
|
+
const d = u.map((g) => {
|
|
3767
|
+
const { minX: _, minY: A, maxX: w, maxY: y } = g.selector.geometry.bounds;
|
|
3768
|
+
return { minX: _, minY: A, maxX: w, maxY: y, target: g };
|
|
3769
3769
|
});
|
|
3770
|
-
|
|
3770
|
+
d.forEach((g) => t.set(g.target.annotation, g)), e.load(d);
|
|
3771
3771
|
},
|
|
3772
3772
|
size: () => e.all().length,
|
|
3773
|
-
update: (
|
|
3774
|
-
s(
|
|
3773
|
+
update: (u, m) => {
|
|
3774
|
+
s(u), i(m);
|
|
3775
3775
|
}
|
|
3776
3776
|
};
|
|
3777
|
-
},
|
|
3778
|
-
const t =
|
|
3777
|
+
}, di = (e) => {
|
|
3778
|
+
const t = Gn(), n = fi(), o = Bn(t, e.pointerSelectAction), i = In(t), s = qn();
|
|
3779
3779
|
return t.observe(({ changes: l }) => {
|
|
3780
|
-
n.set(l.created.map((
|
|
3780
|
+
n.set(l.created.map((c) => c.target), !1), l.deleted.forEach((c) => n.remove(c.target)), l.updated.forEach(({ oldValue: c, newValue: h }) => n.update(c.target, h.target));
|
|
3781
3781
|
}), {
|
|
3782
3782
|
store: {
|
|
3783
3783
|
...t,
|
|
3784
|
-
getAt: (l,
|
|
3785
|
-
const h = n.getAt(l,
|
|
3784
|
+
getAt: (l, c) => {
|
|
3785
|
+
const h = n.getAt(l, c);
|
|
3786
3786
|
return h ? t.getAnnotation(h.annotation) : void 0;
|
|
3787
3787
|
},
|
|
3788
|
-
getIntersecting: (l,
|
|
3788
|
+
getIntersecting: (l, c, h, u) => n.getIntersecting(l, c, h, u).map((m) => t.getAnnotation(m.annotation))
|
|
3789
3789
|
},
|
|
3790
3790
|
selection: o,
|
|
3791
3791
|
hover: i,
|
|
3792
3792
|
viewport: s
|
|
3793
3793
|
};
|
|
3794
|
-
},
|
|
3795
|
-
const t =
|
|
3794
|
+
}, hi = (e) => {
|
|
3795
|
+
const t = di(e);
|
|
3796
3796
|
return {
|
|
3797
3797
|
...t,
|
|
3798
|
-
store:
|
|
3798
|
+
store: Fn(t.store)
|
|
3799
3799
|
};
|
|
3800
|
-
},
|
|
3800
|
+
}, mi = (e) => {
|
|
3801
3801
|
let t, n;
|
|
3802
3802
|
if (e.nodeName === "CANVAS")
|
|
3803
3803
|
t = e, n = t.getContext("2d", { willReadFrequently: !0 });
|
|
@@ -3808,406 +3808,128 @@ const gi = () => {
|
|
|
3808
3808
|
let o = 0;
|
|
3809
3809
|
for (let i = 1; i < 10; i++)
|
|
3810
3810
|
for (let s = 1; s < 10; s++) {
|
|
3811
|
-
const r = Math.round(s * t.width / 10), a = Math.round(i * t.height / 10), l = n.getImageData(r, a, 1, 1).data,
|
|
3812
|
-
o +=
|
|
3811
|
+
const r = Math.round(s * t.width / 10), a = Math.round(i * t.height / 10), l = n.getImageData(r, a, 1, 1).data, c = (0.299 * l[0] + 0.587 * l[1] + 0.114 * l[2]) / 255;
|
|
3812
|
+
o += c;
|
|
3813
3813
|
}
|
|
3814
3814
|
return o / 81;
|
|
3815
|
-
},
|
|
3816
|
-
const t =
|
|
3815
|
+
}, gi = (e) => {
|
|
3816
|
+
const t = mi(e), n = t > 0.6 ? "dark" : "light";
|
|
3817
3817
|
return console.log(`[Annotorious] Image brightness: ${t.toFixed(1)}. Setting ${n} theme.`), n;
|
|
3818
|
-
},
|
|
3818
|
+
}, Ct = (e, t, n) => t.setAttribute("data-theme", n === "auto" ? gi(e) : n), pi = (e) => ({
|
|
3819
3819
|
...e,
|
|
3820
3820
|
drawingEnabled: e.drawingEnabled === void 0 ? !0 : e.drawingEnabled,
|
|
3821
3821
|
drawingMode: e.drawingMode || "drag",
|
|
3822
|
-
pointerSelectAction: e.pointerSelectAction ||
|
|
3822
|
+
pointerSelectAction: e.pointerSelectAction || Kt.EDIT,
|
|
3823
3823
|
theme: e.theme || "light"
|
|
3824
|
-
}),
|
|
3824
|
+
}), Ut = navigator.userAgent.indexOf("Mac OS X") !== -1, yi = (e, t) => {
|
|
3825
3825
|
const n = t || document, o = (r) => {
|
|
3826
3826
|
r.key === "Z" && r.ctrlKey ? e.undo() : r.key === "Y" && r.ctrlKey && e.redo();
|
|
3827
3827
|
}, i = (r) => {
|
|
3828
3828
|
r.key === "z" && r.metaKey && (r.shiftKey ? e.redo() : e.undo());
|
|
3829
3829
|
}, s = () => {
|
|
3830
|
-
|
|
3830
|
+
Ut ? n.removeEventListener("keydown", i) : n.removeEventListener("keydown", o);
|
|
3831
3831
|
};
|
|
3832
|
-
return
|
|
3832
|
+
return Ut ? n.addEventListener("keydown", i) : n.addEventListener("keydown", o), {
|
|
3833
3833
|
destroy: s
|
|
3834
3834
|
};
|
|
3835
3835
|
};
|
|
3836
|
-
const
|
|
3836
|
+
const Ei = (e, t = {}) => {
|
|
3837
3837
|
if (!e)
|
|
3838
3838
|
throw "Missing argument: image";
|
|
3839
|
-
const n = typeof e == "string" ? document.getElementById(e) : e, o =
|
|
3839
|
+
const n = typeof e == "string" ? document.getElementById(e) : e, o = pi(t), i = hi(o), { selection: s, store: r } = i, a = jn(r), l = Kn(
|
|
3840
3840
|
i,
|
|
3841
3841
|
a,
|
|
3842
3842
|
o.adapter,
|
|
3843
3843
|
o.autoSave
|
|
3844
|
-
),
|
|
3845
|
-
|
|
3846
|
-
const h =
|
|
3847
|
-
let
|
|
3848
|
-
|
|
3849
|
-
const
|
|
3850
|
-
target:
|
|
3844
|
+
), c = document.createElement("DIV");
|
|
3845
|
+
c.style.position = "relative", c.style.display = "inline-block", n.style.display = "block", n.parentNode.insertBefore(c, n), c.appendChild(n);
|
|
3846
|
+
const h = yi(a);
|
|
3847
|
+
let u = eo();
|
|
3848
|
+
Ct(n, c, o.theme);
|
|
3849
|
+
const m = new ni({
|
|
3850
|
+
target: c,
|
|
3851
3851
|
props: {
|
|
3852
3852
|
drawingEnabled: o.drawingEnabled,
|
|
3853
3853
|
image: n,
|
|
3854
3854
|
preferredDrawingMode: o.drawingMode,
|
|
3855
3855
|
state: i,
|
|
3856
3856
|
style: o.style,
|
|
3857
|
-
user:
|
|
3857
|
+
user: u
|
|
3858
3858
|
}
|
|
3859
3859
|
});
|
|
3860
|
-
|
|
3861
|
-
const { originalEvent:
|
|
3862
|
-
|
|
3860
|
+
m.$on("click", (p) => {
|
|
3861
|
+
const { originalEvent: E, annotation: b } = p.detail;
|
|
3862
|
+
b ? s.clickSelect(b.id, E) : s.isEmpty() || s.clear();
|
|
3863
3863
|
});
|
|
3864
|
-
const
|
|
3865
|
-
|
|
3866
|
-
},
|
|
3867
|
-
if (!
|
|
3868
|
-
throw `No drawing tool named ${
|
|
3869
|
-
|
|
3870
|
-
},
|
|
3864
|
+
const d = Jn(i, a, o.adapter), g = () => {
|
|
3865
|
+
m.$destroy(), c.parentNode.insertBefore(n, c), c.parentNode.removeChild(c), h.destroy(), a.destroy();
|
|
3866
|
+
}, _ = () => u, A = (p, E, b) => Yo(p, E, b), w = (p, E) => go(p, E), y = (p) => {
|
|
3867
|
+
if (!Qt(p))
|
|
3868
|
+
throw `No drawing tool named ${p}`;
|
|
3869
|
+
m.$set({ toolName: p });
|
|
3870
|
+
}, T = (p) => m.$set({ drawingEnabled: p }), S = (p) => {
|
|
3871
3871
|
console.warn("Filter not implemented yet");
|
|
3872
|
-
},
|
|
3873
|
-
|
|
3872
|
+
}, P = (p) => m.$set({ style: p }), X = (p) => Ct(n, c, p), U = (p) => {
|
|
3873
|
+
u = p, m.$set({ user: p });
|
|
3874
3874
|
};
|
|
3875
3875
|
return {
|
|
3876
|
-
...
|
|
3877
|
-
destroy:
|
|
3878
|
-
getUser:
|
|
3879
|
-
listDrawingTools:
|
|
3876
|
+
...d,
|
|
3877
|
+
destroy: g,
|
|
3878
|
+
getUser: _,
|
|
3879
|
+
listDrawingTools: it,
|
|
3880
3880
|
on: l.on,
|
|
3881
3881
|
off: l.off,
|
|
3882
|
-
registerDrawingTool:
|
|
3883
|
-
registerShapeEditor:
|
|
3884
|
-
setDrawingEnabled:
|
|
3885
|
-
setDrawingTool:
|
|
3882
|
+
registerDrawingTool: A,
|
|
3883
|
+
registerShapeEditor: w,
|
|
3884
|
+
setDrawingEnabled: T,
|
|
3885
|
+
setDrawingTool: y,
|
|
3886
3886
|
setFilter: S,
|
|
3887
|
-
setStyle:
|
|
3888
|
-
setTheme:
|
|
3889
|
-
setUser:
|
|
3887
|
+
setStyle: P,
|
|
3888
|
+
setTheme: X,
|
|
3889
|
+
setUser: U,
|
|
3890
3890
|
state: i
|
|
3891
3891
|
};
|
|
3892
3892
|
};
|
|
3893
|
-
var Ei = /* @__PURE__ */ ((e) => (e.EDIT = "EDIT", e.SELECT = "SELECT", e.NONE = "NONE", e))(Ei || {});
|
|
3894
|
-
const Vi = (e) => {
|
|
3895
|
-
const { creator: t, updatedBy: n } = e.target, o = e.bodies.reduce((i, s) => [...i, s.creator, s.updatedBy], []);
|
|
3896
|
-
return [
|
|
3897
|
-
t,
|
|
3898
|
-
n,
|
|
3899
|
-
...o
|
|
3900
|
-
].filter((i) => i);
|
|
3901
|
-
}, zi = (e, t, n, o) => ({
|
|
3902
|
-
id: dt(),
|
|
3903
|
-
annotation: e.id,
|
|
3904
|
-
created: n || /* @__PURE__ */ new Date(),
|
|
3905
|
-
creator: o,
|
|
3906
|
-
...t
|
|
3907
|
-
});
|
|
3908
|
-
var zt = Object.prototype.hasOwnProperty;
|
|
3909
|
-
function He(e, t) {
|
|
3910
|
-
var n, o;
|
|
3911
|
-
if (e === t)
|
|
3912
|
-
return !0;
|
|
3913
|
-
if (e && t && (n = e.constructor) === t.constructor) {
|
|
3914
|
-
if (n === Date)
|
|
3915
|
-
return e.getTime() === t.getTime();
|
|
3916
|
-
if (n === RegExp)
|
|
3917
|
-
return e.toString() === t.toString();
|
|
3918
|
-
if (n === Array) {
|
|
3919
|
-
if ((o = e.length) === t.length)
|
|
3920
|
-
for (; o-- && He(e[o], t[o]); )
|
|
3921
|
-
;
|
|
3922
|
-
return o === -1;
|
|
3923
|
-
}
|
|
3924
|
-
if (!n || typeof e == "object") {
|
|
3925
|
-
o = 0;
|
|
3926
|
-
for (n in e)
|
|
3927
|
-
if (zt.call(e, n) && ++o && !zt.call(t, n) || !(n in t) || !He(e[n], t[n]))
|
|
3928
|
-
return !1;
|
|
3929
|
-
return Object.keys(t).length === o;
|
|
3930
|
-
}
|
|
3931
|
-
}
|
|
3932
|
-
return e !== e && t !== t;
|
|
3933
|
-
}
|
|
3934
|
-
const Ai = (e, t) => {
|
|
3935
|
-
const n = new Set(e.bodies.map((o) => o.id));
|
|
3936
|
-
return t.bodies.filter((o) => !n.has(o.id));
|
|
3937
|
-
}, Ti = (e, t) => {
|
|
3938
|
-
const n = new Set(t.bodies.map((o) => o.id));
|
|
3939
|
-
return e.bodies.filter((o) => !n.has(o.id));
|
|
3940
|
-
}, Si = (e, t) => t.bodies.map((n) => {
|
|
3941
|
-
const o = e.bodies.find((i) => i.id === n.id);
|
|
3942
|
-
return { newBody: n, oldBody: o && !He(o, n) ? o : void 0 };
|
|
3943
|
-
}).filter(({ oldBody: n }) => n), Mi = (e, t) => !He(e.target, t.target), Fi = (e, t) => {
|
|
3944
|
-
const n = Ai(e, t), o = Ti(e, t), i = Si(e, t);
|
|
3945
|
-
return {
|
|
3946
|
-
oldValue: e,
|
|
3947
|
-
newValue: t,
|
|
3948
|
-
bodiesCreated: n.length > 0 ? n : void 0,
|
|
3949
|
-
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
3950
|
-
bodiesUpdated: i.length > 0 ? i : void 0,
|
|
3951
|
-
targetUpdated: Mi(e, t) ? { oldTarget: e.target, newTarget: t.target } : void 0
|
|
3952
|
-
};
|
|
3953
|
-
};
|
|
3954
|
-
var ke = /* @__PURE__ */ ((e) => (e.LOCAL = "LOCAL", e.REMOTE = "REMOTE", e))(ke || {});
|
|
3955
|
-
let vi = () => ({
|
|
3956
|
-
emit(e, ...t) {
|
|
3957
|
-
let n = this.events[e] || [];
|
|
3958
|
-
for (let o = 0, i = n.length; o < i; o++)
|
|
3959
|
-
n[o](...t);
|
|
3960
|
-
},
|
|
3961
|
-
events: {},
|
|
3962
|
-
on(e, t) {
|
|
3963
|
-
var n;
|
|
3964
|
-
return (n = this.events[e]) != null && n.push(t) || (this.events[e] = [t]), () => {
|
|
3965
|
-
var o;
|
|
3966
|
-
this.events[e] = (o = this.events[e]) == null ? void 0 : o.filter((i) => t !== i);
|
|
3967
|
-
};
|
|
3968
|
-
}
|
|
3969
|
-
});
|
|
3970
|
-
const Hi = (e) => (t) => t.map((n) => e.serialize(n)), Oi = (e) => (t) => t.reduce((n, o) => {
|
|
3971
|
-
const { parsed: i, error: s } = e.parse(o);
|
|
3972
|
-
return s ? {
|
|
3973
|
-
parsed: n.parsed,
|
|
3974
|
-
failed: [...n.failed, o]
|
|
3975
|
-
} : {
|
|
3976
|
-
parsed: [...n.parsed, i],
|
|
3977
|
-
failed: n.failed
|
|
3978
|
-
};
|
|
3979
|
-
}, { parsed: [], failed: [] }), ji = (e, t, n) => {
|
|
3980
|
-
const { store: o, selection: i } = e, s = (b) => {
|
|
3981
|
-
if (n) {
|
|
3982
|
-
const { parsed: _, error: p } = n.parse(b);
|
|
3983
|
-
_ ? o.addAnnotation(_, ke.REMOTE) : console.error(p);
|
|
3984
|
-
} else
|
|
3985
|
-
o.addAnnotation(b, ke.REMOTE);
|
|
3986
|
-
}, r = () => i.clear(), a = () => o.clear(), l = (b) => {
|
|
3987
|
-
const _ = o.getAnnotation(b);
|
|
3988
|
-
return n && _ ? n.serialize(_) : _;
|
|
3989
|
-
}, d = () => n ? o.all().map(n.serialize) : o.all(), h = () => {
|
|
3990
|
-
var p;
|
|
3991
|
-
const _ = (((p = i.selected) == null ? void 0 : p.map((A) => A.id)) || []).map((A) => o.getAnnotation(A));
|
|
3992
|
-
return n ? _.map(n.serialize) : _;
|
|
3993
|
-
}, c = (b) => fetch(b).then((_) => _.json()).then((_) => (u(_), _)), g = (b) => {
|
|
3994
|
-
if (typeof b == "string") {
|
|
3995
|
-
const _ = o.getAnnotation(b);
|
|
3996
|
-
return o.deleteAnnotation(b), n ? n.serialize(_) : _;
|
|
3997
|
-
} else {
|
|
3998
|
-
const _ = n ? n.parse(b).parsed : b;
|
|
3999
|
-
return o.deleteAnnotation(_), b;
|
|
4000
|
-
}
|
|
4001
|
-
}, u = (b) => {
|
|
4002
|
-
if (n) {
|
|
4003
|
-
const { parsed: _, failed: p } = Oi(n)(b);
|
|
4004
|
-
p.length > 0 && console.warn(`Discarded ${p.length} invalid annotations`, p), o.bulkAddAnnotation(_, !0, ke.REMOTE);
|
|
4005
|
-
} else
|
|
4006
|
-
o.bulkAddAnnotation(b, !0, ke.REMOTE);
|
|
4007
|
-
}, m = (b) => {
|
|
4008
|
-
b ? i.setSelected(b) : i.clear();
|
|
4009
|
-
}, w = (b) => {
|
|
4010
|
-
if (n) {
|
|
4011
|
-
const _ = n.parse(b).parsed, p = n.serialize(o.getAnnotation(_.id));
|
|
4012
|
-
return o.updateAnnotation(_), p;
|
|
4013
|
-
} else {
|
|
4014
|
-
const _ = o.getAnnotation(b.id);
|
|
4015
|
-
return o.updateAnnotation(b), _;
|
|
4016
|
-
}
|
|
4017
|
-
};
|
|
4018
|
-
return {
|
|
4019
|
-
addAnnotation: s,
|
|
4020
|
-
cancelSelected: r,
|
|
4021
|
-
canRedo: t.canRedo,
|
|
4022
|
-
canUndo: t.canUndo,
|
|
4023
|
-
clearAnnotations: a,
|
|
4024
|
-
getAnnotationById: l,
|
|
4025
|
-
getAnnotations: d,
|
|
4026
|
-
getSelected: h,
|
|
4027
|
-
loadAnnotations: c,
|
|
4028
|
-
redo: t.redo,
|
|
4029
|
-
removeAnnotation: g,
|
|
4030
|
-
setAnnotations: u,
|
|
4031
|
-
setSelected: m,
|
|
4032
|
-
undo: t.undo,
|
|
4033
|
-
updateAnnotation: w
|
|
4034
|
-
};
|
|
4035
|
-
};
|
|
4036
|
-
let Li = (e) => crypto.getRandomValues(new Uint8Array(e)), ki = (e, t, n) => {
|
|
4037
|
-
let o = (2 << Math.log(e.length - 1) / Math.LN2) - 1, i = -~(1.6 * o * t / e.length);
|
|
4038
|
-
return (s = t) => {
|
|
4039
|
-
let r = "";
|
|
4040
|
-
for (; ; ) {
|
|
4041
|
-
let a = n(i), l = i;
|
|
4042
|
-
for (; l--; )
|
|
4043
|
-
if (r += e[a[l] & o] || "", r.length === s)
|
|
4044
|
-
return r;
|
|
4045
|
-
}
|
|
4046
|
-
};
|
|
4047
|
-
}, Bi = (e, t = 21) => ki(e, t, Li), Ii = (e = 21) => crypto.getRandomValues(new Uint8Array(e)).reduce((t, n) => (n &= 63, n < 36 ? t += n.toString(36) : n < 62 ? t += (n - 26).toString(36).toUpperCase() : n > 62 ? t += "-" : t += "_", t), "");
|
|
4048
|
-
const qi = () => ({ isGuest: !0, id: Bi("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), Ci = (e) => {
|
|
4049
|
-
const t = JSON.stringify(e);
|
|
4050
|
-
let n = 0;
|
|
4051
|
-
for (let o = 0, i = t.length; o < i; o++) {
|
|
4052
|
-
let s = t.charCodeAt(o);
|
|
4053
|
-
n = (n << 5) - n + s, n |= 0;
|
|
4054
|
-
}
|
|
4055
|
-
return `${n}`;
|
|
4056
|
-
}, Wi = (e, t) => (Array.isArray(e) ? e : [e]).map((n) => {
|
|
4057
|
-
const { id: o, type: i, purpose: s, value: r, created: a, creator: l, ...d } = n;
|
|
4058
|
-
return {
|
|
4059
|
-
id: o || `temp-${Ci(n)}`,
|
|
4060
|
-
annotation: t,
|
|
4061
|
-
type: i,
|
|
4062
|
-
purpose: s,
|
|
4063
|
-
value: r,
|
|
4064
|
-
created: a,
|
|
4065
|
-
creator: l ? typeof l == "object" ? { ...l } : l : void 0,
|
|
4066
|
-
...d
|
|
4067
|
-
};
|
|
4068
|
-
}), Ji = (e) => e.map((t) => {
|
|
4069
|
-
var o;
|
|
4070
|
-
const n = { ...t };
|
|
4071
|
-
return delete n.annotation, (o = n.id) != null && o.startsWith("temp-") && delete n.id, n;
|
|
4072
|
-
}), Pi = [
|
|
4073
|
-
"#ff7c00",
|
|
4074
|
-
// orange
|
|
4075
|
-
"#1ac938",
|
|
4076
|
-
// green
|
|
4077
|
-
"#e8000b",
|
|
4078
|
-
// red
|
|
4079
|
-
"#8b2be2",
|
|
4080
|
-
// purple
|
|
4081
|
-
"#9f4800",
|
|
4082
|
-
// brown
|
|
4083
|
-
"#f14cc1",
|
|
4084
|
-
// pink
|
|
4085
|
-
"#ffc400",
|
|
4086
|
-
// khaki
|
|
4087
|
-
"#00d7ff",
|
|
4088
|
-
// cyan
|
|
4089
|
-
"#023eff"
|
|
4090
|
-
// blue
|
|
4091
|
-
], Ri = () => {
|
|
4092
|
-
const e = [...Pi];
|
|
4093
|
-
return { assignRandomColor: () => {
|
|
4094
|
-
const o = Math.floor(Math.random() * e.length), i = e[o];
|
|
4095
|
-
return e.splice(o, 1), i;
|
|
4096
|
-
}, releaseColor: (o) => e.push(o) };
|
|
4097
|
-
}, Yi = () => {
|
|
4098
|
-
const e = Ri();
|
|
4099
|
-
return { addUser: (o, i) => {
|
|
4100
|
-
const s = e.assignRandomColor();
|
|
4101
|
-
return {
|
|
4102
|
-
label: i.name || i.id,
|
|
4103
|
-
avatar: i.avatar,
|
|
4104
|
-
color: s
|
|
4105
|
-
};
|
|
4106
|
-
}, removeUser: (o) => e.releaseColor(o.appearance.color) };
|
|
4107
|
-
}, Ui = (e, t) => e.every((n) => e.includes(n)) && t.every((n) => e.includes(n)), Ki = Ii(), Zi = (e = Yi()) => {
|
|
4108
|
-
const t = vi(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = (c, g) => {
|
|
4109
|
-
if (n.has(c)) {
|
|
4110
|
-
console.warn("Attempt to add user that is already present", c, g);
|
|
4111
|
-
return;
|
|
4112
|
-
}
|
|
4113
|
-
const u = e.addUser(c, g);
|
|
4114
|
-
n.set(c, {
|
|
4115
|
-
...g,
|
|
4116
|
-
presenceKey: c,
|
|
4117
|
-
appearance: u
|
|
4118
|
-
});
|
|
4119
|
-
}, s = (c) => {
|
|
4120
|
-
const g = n.get(c);
|
|
4121
|
-
if (!g) {
|
|
4122
|
-
console.warn("Attempt to remove user that is not present", c);
|
|
4123
|
-
return;
|
|
4124
|
-
}
|
|
4125
|
-
e.removeUser(g), n.delete(c);
|
|
4126
|
-
}, r = (c) => {
|
|
4127
|
-
const g = new Set(c.map((w) => w.presenceKey)), u = c.filter(({ presenceKey: w }) => !n.has(w)), m = Array.from(n.values()).filter((w) => !g.has(w.presenceKey));
|
|
4128
|
-
u.forEach(({ presenceKey: w, user: b }) => i(w, b)), m.forEach((w) => {
|
|
4129
|
-
const { presenceKey: b } = w;
|
|
4130
|
-
o.has(b) && t.emit("selectionChange", w, null), s(b);
|
|
4131
|
-
}), (u.length > 0 || m.length > 0) && t.emit("presence", d());
|
|
4132
|
-
}, a = (c, g) => {
|
|
4133
|
-
const u = n.get(c);
|
|
4134
|
-
if (!u) {
|
|
4135
|
-
console.warn("Activity notification from user that is not present");
|
|
4136
|
-
return;
|
|
4137
|
-
}
|
|
4138
|
-
const m = o.get(c);
|
|
4139
|
-
(!m || !Ui(m, g)) && (o.set(c, g), t.emit("selectionChange", u, g));
|
|
4140
|
-
}, l = (c, g) => {
|
|
4141
|
-
const u = n.get(c);
|
|
4142
|
-
if (!u) {
|
|
4143
|
-
console.warn("Selection change for user that is not present", c);
|
|
4144
|
-
return;
|
|
4145
|
-
}
|
|
4146
|
-
g ? o.set(c, g) : o.delete(c), t.emit("selectionChange", u, g);
|
|
4147
|
-
}, d = () => [...Array.from(n.values())];
|
|
4148
|
-
return {
|
|
4149
|
-
getPresentUsers: d,
|
|
4150
|
-
notifyActivity: a,
|
|
4151
|
-
on: (c, g) => t.on(c, g),
|
|
4152
|
-
syncUsers: r,
|
|
4153
|
-
updateSelection: l
|
|
4154
|
-
};
|
|
4155
|
-
};
|
|
4156
3893
|
export {
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
Mo as ToolMount,
|
|
4171
|
-
Di as W3CImageFormat,
|
|
4172
|
-
Zo as addEventListeners,
|
|
3894
|
+
Zt as Editor,
|
|
3895
|
+
bo as EditorMount,
|
|
3896
|
+
L as Handle,
|
|
3897
|
+
bi as IdentityTransform,
|
|
3898
|
+
co as PolygonEditor,
|
|
3899
|
+
mo as RectangleEditor,
|
|
3900
|
+
pn as RectangleUtil,
|
|
3901
|
+
Mo as RubberbandRectangle,
|
|
3902
|
+
ni as SVGAnnotationLayer,
|
|
3903
|
+
z as ShapeType,
|
|
3904
|
+
Ao as ToolMount,
|
|
3905
|
+
_i as W3CImageFormat,
|
|
3906
|
+
Ko as addEventListeners,
|
|
4173
3907
|
Fe as boundsFromPoints,
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
Wi as parseW3CBodies,
|
|
4201
|
-
lo as parseW3CImageAnnotation,
|
|
4202
|
-
_o as registerEditor,
|
|
4203
|
-
ct as registerShapeUtil,
|
|
4204
|
-
Uo as registerTool,
|
|
4205
|
-
yi as sampleBrightness,
|
|
4206
|
-
Hi as serializeAll,
|
|
4207
|
-
En as serializeFragmentSelector,
|
|
4208
|
-
On as serializeSVGSelector,
|
|
4209
|
-
Ji as serializeW3CBodies,
|
|
4210
|
-
ao as serializeW3CImageAnnotation,
|
|
4211
|
-
Gt as setTheme
|
|
3908
|
+
ot as computeArea,
|
|
3909
|
+
Ei as createImageAnnotator,
|
|
3910
|
+
di as createImageAnnotatorState,
|
|
3911
|
+
jo as createSVGTransform,
|
|
3912
|
+
hi as createSvelteImageAnnotatorState,
|
|
3913
|
+
gi as detectTheme,
|
|
3914
|
+
Ze as distance,
|
|
3915
|
+
Oo as enableResponsive,
|
|
3916
|
+
pi as fillDefaults,
|
|
3917
|
+
At as getEditor,
|
|
3918
|
+
Qt as getTool,
|
|
3919
|
+
yi as initKeyboardCommands,
|
|
3920
|
+
hn as intersects,
|
|
3921
|
+
wi as isTouch,
|
|
3922
|
+
it as listDrawingTools,
|
|
3923
|
+
yn as parseFragmentSelector,
|
|
3924
|
+
Tn as parseSVGSelector,
|
|
3925
|
+
io as parseW3CImageAnnotation,
|
|
3926
|
+
go as registerEditor,
|
|
3927
|
+
lt as registerShapeUtil,
|
|
3928
|
+
Yo as registerTool,
|
|
3929
|
+
mi as sampleBrightness,
|
|
3930
|
+
_n as serializeFragmentSelector,
|
|
3931
|
+
Sn as serializeSVGSelector,
|
|
3932
|
+
so as serializeW3CImageAnnotation,
|
|
3933
|
+
Ct as setTheme
|
|
4212
3934
|
};
|
|
4213
3935
|
//# sourceMappingURL=annotorious.es.js.map
|