@annotorious/react 3.0.0-rc.6 → 3.0.0-rc.8
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.d.ts +15 -15
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/AnnotoriousPlugin.d.ts +1 -1
- package/dist/AnnotoriousPlugin.d.ts.map +1 -1
- package/dist/AnnotoriousPopup.d.ts +1 -1
- package/dist/AnnotoriousPopup.d.ts.map +1 -1
- package/dist/ImageAnnotator.d.ts +2 -2
- package/dist/ImageAnnotator.d.ts.map +1 -1
- package/dist/annotorious-react.es.js +26 -44
- package/dist/annotorious-react.es.js.map +1 -1
- package/dist/annotorious-react.es10.js +29 -3
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js +36 -27
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js +16 -20
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js +4 -54
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js +8 -17
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +152 -21
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +6 -2
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js +20708 -2
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js +30 -3924
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +2 -29
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +2 -2
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es20.js +30 -36
- package/dist/annotorious-react.es20.js.map +1 -1
- package/dist/annotorious-react.es21.js +597 -14
- package/dist/annotorious-react.es21.js.map +1 -1
- package/dist/annotorious-react.es22.js +2 -4
- package/dist/annotorious-react.es22.js.map +1 -1
- package/dist/annotorious-react.es23.js +2 -8
- package/dist/annotorious-react.es23.js.map +1 -1
- package/dist/annotorious-react.es3.js.map +1 -1
- package/dist/annotorious-react.es4.js +2 -2
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es5.js +12 -9
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es8.js +79 -57
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js +3922 -10
- package/dist/annotorious-react.es9.js.map +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/annotorious-react.es24.js +0 -156
- package/dist/annotorious-react.es24.js.map +0 -1
- package/dist/annotorious-react.es25.js +0 -9
- package/dist/annotorious-react.es25.js.map +0 -1
- package/dist/annotorious-react.es26.js +0 -5
- package/dist/annotorious-react.es26.js.map +0 -1
- package/dist/annotorious-react.es27.js +0 -33
- package/dist/annotorious-react.es27.js.map +0 -1
- package/dist/annotorious-react.es28.js +0 -602
- package/dist/annotorious-react.es28.js.map +0 -1
- package/dist/annotorious-react.es29.js +0 -20133
- package/dist/annotorious-react.es29.js.map +0 -1
- package/dist/annotorious-react.es30.js +0 -35
- package/dist/annotorious-react.es30.js.map +0 -1
- package/dist/annotorious-react.es31.js +0 -5
- package/dist/annotorious-react.es31.js.map +0 -1
- package/dist/annotorious-react.es32.js +0 -5
- package/dist/annotorious-react.es32.js.map +0 -1
- package/dist/annotorious-react.es33.js +0 -19
- package/dist/annotorious-react.es33.js.map +0 -1
- package/dist/annotorious-react.es34.js +0 -20
- package/dist/annotorious-react.es34.js.map +0 -1
- package/dist/annotorious-react.es35.js +0 -30
- package/dist/annotorious-react.es35.js.map +0 -1
- package/dist/annotorious-react.es36.js +0 -24
- package/dist/annotorious-react.es36.js.map +0 -1
- package/dist/annotorious-react.es37.js +0 -19
- package/dist/annotorious-react.es37.js.map +0 -1
- package/dist/annotorious-react.es38.js +0 -7
- package/dist/annotorious-react.es38.js.map +0 -1
- package/dist/annotorious-react.es39.js +0 -11
- package/dist/annotorious-react.es39.js.map +0 -1
- package/dist/annotorious-react.es40.js +0 -10
- package/dist/annotorious-react.es40.js.map +0 -1
|
@@ -1,3929 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (t == null)
|
|
28
|
-
return U;
|
|
29
|
-
const n = t.subscribe(...e);
|
|
30
|
-
return n.unsubscribe ? () => n.unsubscribe() : n;
|
|
31
|
-
}
|
|
32
|
-
function he(t, e, n) {
|
|
33
|
-
t.$$.on_destroy.push(De(e, n));
|
|
34
|
-
}
|
|
35
|
-
function en(t, e, n, o) {
|
|
36
|
-
if (t) {
|
|
37
|
-
const r = Ue(t, e, n, o);
|
|
38
|
-
return t[0](r);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function Ue(t, e, n, o) {
|
|
42
|
-
return t[1] && o ? Qe(n.ctx.slice(), t[1](o(e))) : n.ctx;
|
|
43
|
-
}
|
|
44
|
-
function nn(t, e, n, o) {
|
|
45
|
-
if (t[2] && o) {
|
|
46
|
-
const r = t[2](o(n));
|
|
47
|
-
if (e.dirty === void 0)
|
|
48
|
-
return r;
|
|
49
|
-
if (typeof r == "object") {
|
|
50
|
-
const i = [], a = Math.max(e.dirty.length, r.length);
|
|
51
|
-
for (let s = 0; s < a; s += 1)
|
|
52
|
-
i[s] = e.dirty[s] | r[s];
|
|
53
|
-
return i;
|
|
54
|
-
}
|
|
55
|
-
return e.dirty | r;
|
|
56
|
-
}
|
|
57
|
-
return e.dirty;
|
|
58
|
-
}
|
|
59
|
-
function on(t, e, n, o, r, i) {
|
|
60
|
-
if (r) {
|
|
61
|
-
const a = Ue(e, n, o, i);
|
|
62
|
-
t.p(a, r);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
function rn(t) {
|
|
66
|
-
if (t.ctx.length > 32) {
|
|
67
|
-
const e = [], n = t.ctx.length / 32;
|
|
68
|
-
for (let o = 0; o < n; o++)
|
|
69
|
-
e[o] = -1;
|
|
70
|
-
return e;
|
|
71
|
-
}
|
|
72
|
-
return -1;
|
|
73
|
-
}
|
|
74
|
-
function lt(t, e) {
|
|
75
|
-
t.appendChild(e);
|
|
76
|
-
}
|
|
77
|
-
function _(t, e, n) {
|
|
78
|
-
t.insertBefore(e, n || null);
|
|
79
|
-
}
|
|
80
|
-
function Y(t) {
|
|
81
|
-
t.parentNode && t.parentNode.removeChild(t);
|
|
82
|
-
}
|
|
83
|
-
function ie(t, e) {
|
|
84
|
-
for (let n = 0; n < t.length; n += 1)
|
|
85
|
-
t[n] && t[n].d(e);
|
|
86
|
-
}
|
|
87
|
-
function R(t) {
|
|
88
|
-
return document.createElementNS("http://www.w3.org/2000/svg", t);
|
|
89
|
-
}
|
|
90
|
-
function Ge(t) {
|
|
91
|
-
return document.createTextNode(t);
|
|
92
|
-
}
|
|
93
|
-
function tt() {
|
|
94
|
-
return Ge(" ");
|
|
95
|
-
}
|
|
96
|
-
function at() {
|
|
97
|
-
return Ge("");
|
|
98
|
-
}
|
|
99
|
-
function z(t, e, n, o) {
|
|
100
|
-
return t.addEventListener(e, n, o), () => t.removeEventListener(e, n, o);
|
|
101
|
-
}
|
|
102
|
-
function u(t, e, n) {
|
|
103
|
-
n == null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n);
|
|
104
|
-
}
|
|
105
|
-
function an(t) {
|
|
106
|
-
return Array.from(t.childNodes);
|
|
107
|
-
}
|
|
108
|
-
function pe(t, e, n) {
|
|
109
|
-
t.classList[n ? "add" : "remove"](e);
|
|
110
|
-
}
|
|
111
|
-
function sn(t, e, { bubbles: n = !1, cancelable: o = !1 } = {}) {
|
|
112
|
-
const r = document.createEvent("CustomEvent");
|
|
113
|
-
return r.initCustomEvent(t, n, o, e), r;
|
|
114
|
-
}
|
|
115
|
-
let _t;
|
|
116
|
-
function Yt(t) {
|
|
117
|
-
_t = t;
|
|
118
|
-
}
|
|
119
|
-
function Fe() {
|
|
120
|
-
if (!_t)
|
|
121
|
-
throw new Error("Function called outside component initialization");
|
|
122
|
-
return _t;
|
|
123
|
-
}
|
|
124
|
-
function Mt(t) {
|
|
125
|
-
Fe().$$.on_mount.push(t);
|
|
126
|
-
}
|
|
127
|
-
function At() {
|
|
128
|
-
const t = Fe();
|
|
129
|
-
return (e, n, { cancelable: o = !1 } = {}) => {
|
|
130
|
-
const r = t.$$.callbacks[e];
|
|
131
|
-
if (r) {
|
|
132
|
-
const i = sn(e, n, { cancelable: o });
|
|
133
|
-
return r.slice().forEach((a) => {
|
|
134
|
-
a.call(t, i);
|
|
135
|
-
}), !i.defaultPrevented;
|
|
136
|
-
}
|
|
137
|
-
return !0;
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
function Et(t, e) {
|
|
141
|
-
const n = t.$$.callbacks[e.type];
|
|
142
|
-
n && n.slice().forEach((o) => o.call(this, e));
|
|
143
|
-
}
|
|
144
|
-
const xt = [], Ut = [];
|
|
145
|
-
let vt = [];
|
|
146
|
-
const ge = [], ln = /* @__PURE__ */ Promise.resolve();
|
|
147
|
-
let ee = !1;
|
|
148
|
-
function dn() {
|
|
149
|
-
ee || (ee = !0, ln.then(He));
|
|
150
|
-
}
|
|
151
|
-
function ne(t) {
|
|
152
|
-
vt.push(t);
|
|
153
|
-
}
|
|
154
|
-
const zt = /* @__PURE__ */ new Set();
|
|
155
|
-
let mt = 0;
|
|
156
|
-
function He() {
|
|
157
|
-
if (mt !== 0)
|
|
158
|
-
return;
|
|
159
|
-
const t = _t;
|
|
160
|
-
do {
|
|
161
|
-
try {
|
|
162
|
-
for (; mt < xt.length; ) {
|
|
163
|
-
const e = xt[mt];
|
|
164
|
-
mt++, Yt(e), cn(e.$$);
|
|
165
|
-
}
|
|
166
|
-
} catch (e) {
|
|
167
|
-
throw xt.length = 0, mt = 0, e;
|
|
168
|
-
}
|
|
169
|
-
for (Yt(null), xt.length = 0, mt = 0; Ut.length; )
|
|
170
|
-
Ut.pop()();
|
|
171
|
-
for (let e = 0; e < vt.length; e += 1) {
|
|
172
|
-
const n = vt[e];
|
|
173
|
-
zt.has(n) || (zt.add(n), n());
|
|
174
|
-
}
|
|
175
|
-
vt.length = 0;
|
|
176
|
-
} while (xt.length);
|
|
177
|
-
for (; ge.length; )
|
|
178
|
-
ge.pop()();
|
|
179
|
-
ee = !1, zt.clear(), Yt(t);
|
|
180
|
-
}
|
|
181
|
-
function cn(t) {
|
|
182
|
-
if (t.fragment !== null) {
|
|
183
|
-
t.update(), it(t.before_update);
|
|
184
|
-
const e = t.dirty;
|
|
185
|
-
t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(ne);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function un(t) {
|
|
189
|
-
const e = [], n = [];
|
|
190
|
-
vt.forEach((o) => t.indexOf(o) === -1 ? e.push(o) : n.push(o)), n.forEach((o) => o()), vt = e;
|
|
191
|
-
}
|
|
192
|
-
const Dt = /* @__PURE__ */ new Set();
|
|
193
|
-
let ut;
|
|
194
|
-
function ot() {
|
|
195
|
-
ut = {
|
|
196
|
-
r: 0,
|
|
197
|
-
c: [],
|
|
198
|
-
p: ut
|
|
199
|
-
// parent group
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
function rt() {
|
|
203
|
-
ut.r || it(ut.c), ut = ut.p;
|
|
204
|
-
}
|
|
205
|
-
function N(t, e) {
|
|
206
|
-
t && t.i && (Dt.delete(t), t.i(e));
|
|
207
|
-
}
|
|
208
|
-
function k(t, e, n, o) {
|
|
209
|
-
if (t && t.o) {
|
|
210
|
-
if (Dt.has(t))
|
|
211
|
-
return;
|
|
212
|
-
Dt.add(t), ut.c.push(() => {
|
|
213
|
-
Dt.delete(t), o && (n && t.d(1), o());
|
|
214
|
-
}), t.o(e);
|
|
215
|
-
} else
|
|
216
|
-
o && o();
|
|
217
|
-
}
|
|
218
|
-
function pt(t) {
|
|
219
|
-
t && t.c();
|
|
220
|
-
}
|
|
221
|
-
function dt(t, e, n, o) {
|
|
222
|
-
const { fragment: r, after_update: i } = t.$$;
|
|
223
|
-
r && r.m(e, n), o || ne(() => {
|
|
224
|
-
const a = t.$$.on_mount.map(ke).filter(H);
|
|
225
|
-
t.$$.on_destroy ? t.$$.on_destroy.push(...a) : it(a), t.$$.on_mount = [];
|
|
226
|
-
}), i.forEach(ne);
|
|
227
|
-
}
|
|
228
|
-
function ct(t, e) {
|
|
229
|
-
const n = t.$$;
|
|
230
|
-
n.fragment !== null && (un(n.after_update), it(n.on_destroy), n.fragment && n.fragment.d(e), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
231
|
-
}
|
|
232
|
-
function hn(t, e) {
|
|
233
|
-
t.$$.dirty[0] === -1 && (xt.push(t), dn(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
234
|
-
}
|
|
235
|
-
function et(t, e, n, o, r, i, a, s = [-1]) {
|
|
236
|
-
const l = _t;
|
|
237
|
-
Yt(t);
|
|
238
|
-
const d = t.$$ = {
|
|
239
|
-
fragment: null,
|
|
240
|
-
ctx: [],
|
|
241
|
-
// state
|
|
242
|
-
props: i,
|
|
243
|
-
update: U,
|
|
244
|
-
not_equal: r,
|
|
245
|
-
bound: ue(),
|
|
246
|
-
// lifecycle
|
|
247
|
-
on_mount: [],
|
|
248
|
-
on_destroy: [],
|
|
249
|
-
on_disconnect: [],
|
|
250
|
-
before_update: [],
|
|
251
|
-
after_update: [],
|
|
252
|
-
context: new Map(e.context || (l ? l.$$.context : [])),
|
|
253
|
-
// everything else
|
|
254
|
-
callbacks: ue(),
|
|
255
|
-
dirty: s,
|
|
256
|
-
skip_bound: !1,
|
|
257
|
-
root: e.target || l.$$.root
|
|
258
|
-
};
|
|
259
|
-
a && a(d.root);
|
|
260
|
-
let p = !1;
|
|
261
|
-
if (d.ctx = n ? n(t, e.props || {}, (c, g, ...h) => {
|
|
262
|
-
const m = h.length ? h[0] : g;
|
|
263
|
-
return d.ctx && r(d.ctx[c], d.ctx[c] = m) && (!d.skip_bound && d.bound[c] && d.bound[c](m), p && hn(t, c)), g;
|
|
264
|
-
}) : [], d.update(), p = !0, it(d.before_update), d.fragment = o ? o(d.ctx) : !1, e.target) {
|
|
265
|
-
if (e.hydrate) {
|
|
266
|
-
const c = an(e.target);
|
|
267
|
-
d.fragment && d.fragment.l(c), c.forEach(Y);
|
|
268
|
-
} else
|
|
269
|
-
d.fragment && d.fragment.c();
|
|
270
|
-
e.intro && N(t.$$.fragment), dt(t, e.target, e.anchor, e.customElement), He();
|
|
271
|
-
}
|
|
272
|
-
Yt(l);
|
|
273
|
-
}
|
|
274
|
-
class nt {
|
|
275
|
-
$destroy() {
|
|
276
|
-
ct(this, 1), this.$destroy = U;
|
|
277
|
-
}
|
|
278
|
-
$on(e, n) {
|
|
279
|
-
if (!H(n))
|
|
280
|
-
return U;
|
|
281
|
-
const o = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
282
|
-
return o.push(n), () => {
|
|
283
|
-
const r = o.indexOf(n);
|
|
284
|
-
r !== -1 && o.splice(r, 1);
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
$set(e) {
|
|
288
|
-
this.$$set && !tn(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
var G = /* @__PURE__ */ ((t) => (t.ELLIPSE = "ELLIPSE", t.POLYGON = "POLYGON", t.RECTANGLE = "RECTANGLE", t))(G || {});
|
|
292
|
-
const ae = {}, se = (t, e) => ae[t] = e, oe = (t) => ae[t.type].area(t), pn = (t, e, n) => ae[t.type].intersects(t, e, n), Gt = (t) => {
|
|
293
|
-
let e = 1 / 0, n = 1 / 0, o = -1 / 0, r = -1 / 0;
|
|
294
|
-
return t.forEach(([i, a]) => {
|
|
295
|
-
e = Math.min(e, i), n = Math.min(n, a), o = Math.max(o, i), r = Math.max(r, a);
|
|
296
|
-
}), { minX: e, minY: n, maxX: o, maxY: r };
|
|
297
|
-
}, gn = {
|
|
298
|
-
area: (t) => Math.PI * t.geometry.rx * t.geometry.ry,
|
|
299
|
-
intersects: (t, e, n) => {
|
|
300
|
-
const { cx: o, cy: r, rx: i, ry: a } = t.geometry, s = 0, l = Math.cos(s), d = Math.sin(s), p = e - o, c = n - r, g = l * p + d * c, h = d * p - l * c;
|
|
301
|
-
return g * g / (i * i) + h * h / (a * a) <= 1;
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
se(G.ELLIPSE, gn);
|
|
305
|
-
const fn = {
|
|
306
|
-
area: (t) => {
|
|
307
|
-
const { points: e } = t.geometry;
|
|
308
|
-
let n = 0, o = e.length - 1;
|
|
309
|
-
for (let r = 0; r < e.length; r++)
|
|
310
|
-
n += (e[o][0] + e[r][0]) * (e[o][1] - e[r][1]), o = r;
|
|
311
|
-
return Math.abs(0.5 * n);
|
|
312
|
-
},
|
|
313
|
-
intersects: (t, e, n) => {
|
|
314
|
-
const { points: o } = t.geometry;
|
|
315
|
-
let r = !1;
|
|
316
|
-
for (let i = 0, a = o.length - 1; i < o.length; a = i++) {
|
|
317
|
-
const s = o[i][0], l = o[i][1], d = o[a][0], p = o[a][1];
|
|
318
|
-
l > n != p > n && e < (d - s) * (n - l) / (p - l) + s && (r = !r);
|
|
319
|
-
}
|
|
320
|
-
return r;
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
se(G.POLYGON, fn);
|
|
324
|
-
const mn = {
|
|
325
|
-
area: (t) => t.geometry.w * t.geometry.h,
|
|
326
|
-
intersects: (t, e, n) => e >= t.geometry.x && e <= t.geometry.x + t.geometry.w && n >= t.geometry.y && n <= t.geometry.y + t.geometry.h
|
|
327
|
-
};
|
|
328
|
-
se(G.RECTANGLE, mn);
|
|
329
|
-
const yn = (t, e = !1) => {
|
|
330
|
-
const n = typeof t == "string" ? t : t.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, r = [...n.matchAll(o)][0], [i, a, s, l, d, p, c] = r;
|
|
331
|
-
if (a !== "xywh")
|
|
332
|
-
throw new Error("Unsupported MediaFragment: " + n);
|
|
333
|
-
if (s && s !== "pixel")
|
|
334
|
-
throw new Error(`Unsupported MediaFragment unit: ${s}`);
|
|
335
|
-
const [g, h, m, x] = [l, d, p, c].map(parseFloat);
|
|
336
|
-
return {
|
|
337
|
-
type: G.RECTANGLE,
|
|
338
|
-
geometry: {
|
|
339
|
-
x: g,
|
|
340
|
-
y: h,
|
|
341
|
-
w: m,
|
|
342
|
-
h: x,
|
|
343
|
-
bounds: {
|
|
344
|
-
minX: g,
|
|
345
|
-
minY: e ? h - x : h,
|
|
346
|
-
maxX: g + m,
|
|
347
|
-
maxY: e ? h : h + x
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
}, wn = (t) => {
|
|
352
|
-
const { x: e, y: n, w: o, h: r } = t;
|
|
353
|
-
return {
|
|
354
|
-
type: "FragmentSelector",
|
|
355
|
-
conformsTo: "http://www.w3.org/TR/media-frags/",
|
|
356
|
-
value: `xywh=pixel:${e},${n},${o},${r}`
|
|
357
|
-
};
|
|
358
|
-
}, Pe = "http://www.w3.org/2000/svg", fe = (t) => {
|
|
359
|
-
const e = (o) => {
|
|
360
|
-
Array.from(o.attributes).forEach((r) => {
|
|
361
|
-
r.name.startsWith("on") && o.removeAttribute(r.name);
|
|
362
|
-
});
|
|
363
|
-
}, n = t.getElementsByTagName("script");
|
|
364
|
-
return Array.from(n).reverse().forEach((o) => o.parentNode.removeChild(o)), Array.from(t.querySelectorAll("*")).forEach(e), t;
|
|
365
|
-
}, $n = (t) => {
|
|
366
|
-
const e = new XMLSerializer().serializeToString(t.documentElement).replace("<svg>", `<svg xmlns="${Pe}">`);
|
|
367
|
-
return new DOMParser().parseFromString(e, "image/svg+xml").documentElement;
|
|
368
|
-
}, xn = (t) => {
|
|
369
|
-
const e = new DOMParser().parseFromString(t, "image/svg+xml"), n = e.lookupPrefix(Pe), o = e.lookupNamespaceURI(null);
|
|
370
|
-
return n || o ? fe(e).firstChild : fe($n(e)).firstChild;
|
|
371
|
-
}, bn = (t) => {
|
|
372
|
-
const [e, n, o] = t.match(/(<polygon points=["|'])([^("|')]*)/) || [];
|
|
373
|
-
if (!o)
|
|
374
|
-
return;
|
|
375
|
-
const r = o.split(" ").map((i) => i.split(",").map(parseFloat));
|
|
376
|
-
return {
|
|
377
|
-
type: G.POLYGON,
|
|
378
|
-
geometry: {
|
|
379
|
-
points: r,
|
|
380
|
-
bounds: Gt(r)
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
}, En = (t) => {
|
|
384
|
-
const e = xn(t), n = parseFloat(e.getAttribute("cx")), o = parseFloat(e.getAttribute("cy")), r = parseFloat(e.getAttribute("rx")), i = parseFloat(e.getAttribute("ry")), a = {
|
|
385
|
-
minX: n - r,
|
|
386
|
-
minY: o - i,
|
|
387
|
-
maxX: n + r,
|
|
388
|
-
maxY: o + i
|
|
389
|
-
};
|
|
390
|
-
return {
|
|
391
|
-
type: G.ELLIPSE,
|
|
392
|
-
geometry: {
|
|
393
|
-
cx: n,
|
|
394
|
-
cy: o,
|
|
395
|
-
rx: r,
|
|
396
|
-
ry: i,
|
|
397
|
-
bounds: a
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
}, vn = (t) => {
|
|
401
|
-
const e = typeof t == "string" ? t : t.value;
|
|
402
|
-
if (e.includes("<polygon points="))
|
|
403
|
-
return bn(e);
|
|
404
|
-
if (e.includes("<ellipse "))
|
|
405
|
-
return En(e);
|
|
406
|
-
}, An = (t) => {
|
|
407
|
-
let e;
|
|
408
|
-
if (t.type === G.POLYGON) {
|
|
409
|
-
const n = t.geometry, { points: o } = n;
|
|
410
|
-
e = `<svg><polygon points="${o.map((r) => r.join(",")).join(" ")}" /></svg>`;
|
|
411
|
-
} else if (t.type === G.ELLIPSE) {
|
|
412
|
-
const n = t.geometry;
|
|
413
|
-
e = `<svg><ellipse cx="${n.cx}" cy="${n.cy}" rx="${n.rx}" ry="${n.ry}" /></svg>`;
|
|
414
|
-
}
|
|
415
|
-
if (e)
|
|
416
|
-
return { type: "SvgSelector", value: e };
|
|
417
|
-
throw `Unsupported shape type: ${t.type}`;
|
|
418
|
-
};
|
|
419
|
-
let Nt;
|
|
420
|
-
const Tn = new Uint8Array(16);
|
|
421
|
-
function Sn() {
|
|
422
|
-
if (!Nt && (Nt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Nt))
|
|
423
|
-
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
424
|
-
return Nt(Tn);
|
|
425
|
-
}
|
|
426
|
-
const j = [];
|
|
427
|
-
for (let t = 0; t < 256; ++t)
|
|
428
|
-
j.push((t + 256).toString(16).slice(1));
|
|
429
|
-
function On(t, e = 0) {
|
|
430
|
-
return j[t[e + 0]] + j[t[e + 1]] + j[t[e + 2]] + j[t[e + 3]] + "-" + j[t[e + 4]] + j[t[e + 5]] + "-" + j[t[e + 6]] + j[t[e + 7]] + "-" + j[t[e + 8]] + j[t[e + 9]] + "-" + j[t[e + 10]] + j[t[e + 11]] + j[t[e + 12]] + j[t[e + 13]] + j[t[e + 14]] + j[t[e + 15]];
|
|
431
|
-
}
|
|
432
|
-
const Ln = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), me = {
|
|
433
|
-
randomUUID: Ln
|
|
434
|
-
};
|
|
435
|
-
function je(t, e, n) {
|
|
436
|
-
if (me.randomUUID && !e && !t)
|
|
437
|
-
return me.randomUUID();
|
|
438
|
-
t = t || {};
|
|
439
|
-
const o = t.random || (t.rng || Sn)();
|
|
440
|
-
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, e) {
|
|
441
|
-
n = n || 0;
|
|
442
|
-
for (let r = 0; r < 16; ++r)
|
|
443
|
-
e[n + r] = o[r];
|
|
444
|
-
return e;
|
|
445
|
-
}
|
|
446
|
-
return On(o);
|
|
447
|
-
}
|
|
448
|
-
var ye = Object.prototype.hasOwnProperty;
|
|
449
|
-
function ht(t, e) {
|
|
450
|
-
var n, o;
|
|
451
|
-
if (t === e)
|
|
452
|
-
return !0;
|
|
453
|
-
if (t && e && (n = t.constructor) === e.constructor) {
|
|
454
|
-
if (n === Date)
|
|
455
|
-
return t.getTime() === e.getTime();
|
|
456
|
-
if (n === RegExp)
|
|
457
|
-
return t.toString() === e.toString();
|
|
458
|
-
if (n === Array) {
|
|
459
|
-
if ((o = t.length) === e.length)
|
|
460
|
-
for (; o-- && ht(t[o], e[o]); )
|
|
461
|
-
;
|
|
462
|
-
return o === -1;
|
|
463
|
-
}
|
|
464
|
-
if (!n || typeof t == "object") {
|
|
465
|
-
o = 0;
|
|
466
|
-
for (n in t)
|
|
467
|
-
if (ye.call(t, n) && ++o && !ye.call(e, n) || !(n in e) || !ht(t[n], e[n]))
|
|
468
|
-
return !1;
|
|
469
|
-
return Object.keys(e).length === o;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
return t !== t && e !== e;
|
|
473
|
-
}
|
|
474
|
-
function qt() {
|
|
475
|
-
}
|
|
476
|
-
function Yn(t, e) {
|
|
477
|
-
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
478
|
-
}
|
|
479
|
-
const yt = [];
|
|
480
|
-
function le(t, e = qt) {
|
|
481
|
-
let n;
|
|
482
|
-
const o = /* @__PURE__ */ new Set();
|
|
483
|
-
function r(s) {
|
|
484
|
-
if (Yn(t, s) && (t = s, n)) {
|
|
485
|
-
const l = !yt.length;
|
|
486
|
-
for (const d of o)
|
|
487
|
-
d[1](), yt.push(d, t);
|
|
488
|
-
if (l) {
|
|
489
|
-
for (let d = 0; d < yt.length; d += 2)
|
|
490
|
-
yt[d][0](yt[d + 1]);
|
|
491
|
-
yt.length = 0;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
function i(s) {
|
|
496
|
-
r(s(t));
|
|
497
|
-
}
|
|
498
|
-
function a(s, l = qt) {
|
|
499
|
-
const d = [s, l];
|
|
500
|
-
return o.add(d), o.size === 1 && (n = e(r) || qt), s(t), () => {
|
|
501
|
-
o.delete(d), o.size === 0 && n && (n(), n = null);
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
return { set: r, update: i, subscribe: a };
|
|
505
|
-
}
|
|
506
|
-
const _n = (t) => {
|
|
507
|
-
const { subscribe: e, set: n } = le(null);
|
|
508
|
-
let o = null;
|
|
509
|
-
return e((r) => o = r), t.observe(({ changes: r }) => {
|
|
510
|
-
if (o) {
|
|
511
|
-
r.deleted.some((a) => a.id === o) && n(null);
|
|
512
|
-
const i = r.updated.find(({ oldValue: a }) => a.id === o);
|
|
513
|
-
i && n(i.newValue.id);
|
|
514
|
-
}
|
|
515
|
-
}), {
|
|
516
|
-
get current() {
|
|
517
|
-
return o;
|
|
518
|
-
},
|
|
519
|
-
subscribe: e,
|
|
520
|
-
set: n
|
|
521
|
-
};
|
|
522
|
-
};
|
|
523
|
-
var ze = /* @__PURE__ */ ((t) => (t.EDIT = "EDIT", t.SELECT = "SELECT", t.NONE = "NONE", t))(ze || {});
|
|
524
|
-
const Wt = { selected: [] }, Mn = (t, e = "EDIT") => {
|
|
525
|
-
const { subscribe: n, set: o } = le(Wt);
|
|
526
|
-
let r = Wt;
|
|
527
|
-
n((c) => r = c);
|
|
528
|
-
const i = () => o(Wt), a = () => {
|
|
529
|
-
var c;
|
|
530
|
-
return ((c = r.selected) == null ? void 0 : c.length) === 0;
|
|
531
|
-
}, s = (c) => {
|
|
532
|
-
if (r.selected.length === 0)
|
|
533
|
-
return !1;
|
|
534
|
-
const g = typeof c == "string" ? c : c.id;
|
|
535
|
-
return r.selected.some((h) => h.id === g);
|
|
536
|
-
}, l = (c, g) => {
|
|
537
|
-
const h = t.getAnnotation(c);
|
|
538
|
-
if (h) {
|
|
539
|
-
const m = Bn(h, e);
|
|
540
|
-
o(m === "EDIT" ? { selected: [{ id: c, editable: !0 }], pointerEvent: g } : m === "SELECT" ? { selected: [{ id: c }], pointerEvent: g } : { selected: [], pointerEvent: g });
|
|
541
|
-
} else
|
|
542
|
-
console.warn("Invalid selection: " + c);
|
|
543
|
-
}, d = (c, g = !0) => {
|
|
544
|
-
const h = Array.isArray(c) ? c : [c], m = h.map((x) => t.getAnnotation(x)).filter((x) => x);
|
|
545
|
-
o({ selected: m.map(({ id: x }) => ({ id: x, editable: g })) }), m.length !== h.length && console.warn("Invalid selection", c);
|
|
546
|
-
}, p = (c) => {
|
|
547
|
-
if (r.selected.length === 0)
|
|
548
|
-
return !1;
|
|
549
|
-
const { selected: g } = r;
|
|
550
|
-
g.filter(({ id: h }) => c.includes(h)).length > 0 && o({ selected: g.filter(({ id: h }) => !c.includes(h)) });
|
|
551
|
-
};
|
|
552
|
-
return t.observe(({ changes: c }) => p(c.deleted.map((g) => g.id))), {
|
|
553
|
-
clear: i,
|
|
554
|
-
clickSelect: l,
|
|
555
|
-
get selected() {
|
|
556
|
-
return r ? [...r.selected] : null;
|
|
557
|
-
},
|
|
558
|
-
get pointerEvent() {
|
|
559
|
-
return r ? r.pointerEvent : null;
|
|
560
|
-
},
|
|
561
|
-
isEmpty: a,
|
|
562
|
-
isSelected: s,
|
|
563
|
-
setSelected: d,
|
|
564
|
-
subscribe: n
|
|
565
|
-
};
|
|
566
|
-
}, Bn = (t, e) => typeof e == "function" ? e(t) || "EDIT" : e || "EDIT", Xn = [];
|
|
567
|
-
for (let t = 0; t < 256; ++t)
|
|
568
|
-
Xn.push((t + 256).toString(16).slice(1));
|
|
569
|
-
typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
570
|
-
const Cn = (t, e) => {
|
|
571
|
-
const n = new Set(t.bodies.map((o) => o.id));
|
|
572
|
-
return e.bodies.filter((o) => !n.has(o.id));
|
|
573
|
-
}, In = (t, e) => {
|
|
574
|
-
const n = new Set(e.bodies.map((o) => o.id));
|
|
575
|
-
return t.bodies.filter((o) => !n.has(o.id));
|
|
576
|
-
}, Rn = (t, e) => e.bodies.map((n) => {
|
|
577
|
-
const o = t.bodies.find((r) => r.id === n.id);
|
|
578
|
-
return { newBody: n, oldBody: o && !ht(o, n) ? o : void 0 };
|
|
579
|
-
}).filter(({ oldBody: n }) => n), Nn = (t, e) => !ht(t.target, e.target), qe = (t, e) => {
|
|
580
|
-
const n = Cn(t, e), o = In(t, e), r = Rn(t, e);
|
|
581
|
-
return {
|
|
582
|
-
oldValue: t,
|
|
583
|
-
newValue: e,
|
|
584
|
-
bodiesCreated: n.length > 0 ? n : void 0,
|
|
585
|
-
bodiesDeleted: o.length > 0 ? o : void 0,
|
|
586
|
-
bodiesUpdated: r.length > 0 ? r : void 0,
|
|
587
|
-
targetUpdated: Nn(t, e) ? { oldTarget: t.target, newTarget: e.target } : void 0
|
|
588
|
-
};
|
|
589
|
-
};
|
|
590
|
-
var D = /* @__PURE__ */ ((t) => (t.LOCAL = "LOCAL", t.REMOTE = "REMOTE", t))(D || {});
|
|
591
|
-
const Vn = (t, e) => {
|
|
592
|
-
var n, o;
|
|
593
|
-
const { changes: r, origin: i } = e;
|
|
594
|
-
if (!(!t.options.origin || t.options.origin === i))
|
|
595
|
-
return !1;
|
|
596
|
-
if (t.options.ignore) {
|
|
597
|
-
const { ignore: a } = t.options, s = (l) => (l == null ? void 0 : l.length) > 0;
|
|
598
|
-
if (!(s(r.created) || s(r.deleted))) {
|
|
599
|
-
const l = (n = r.updated) == null ? void 0 : n.some((p) => s(p.bodiesCreated) || s(p.bodiesDeleted) || s(p.bodiesUpdated)), d = (o = r.updated) == null ? void 0 : o.some((p) => p.targetUpdated);
|
|
600
|
-
if (a === "BODY_ONLY" && l && !d || a === "TARGET_ONLY" && d && !l)
|
|
601
|
-
return !1;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
if (t.options.annotations) {
|
|
605
|
-
const a = /* @__PURE__ */ new Set([
|
|
606
|
-
...r.created.map((s) => s.id),
|
|
607
|
-
...r.deleted.map((s) => s.id),
|
|
608
|
-
...r.updated.map(({ oldValue: s }) => s.id)
|
|
609
|
-
]);
|
|
610
|
-
return !!(Array.isArray(t.options.annotations) ? t.options.annotations : [t.options.annotations]).find((s) => a.has(s));
|
|
611
|
-
} else
|
|
612
|
-
return !0;
|
|
613
|
-
}, kn = (t, e) => {
|
|
614
|
-
const n = new Set((t.created || []).map((c) => c.id)), o = new Set((t.updated || []).map(({ newValue: c }) => c.id)), r = new Set((e.created || []).map((c) => c.id)), i = new Set((e.deleted || []).map((c) => c.id)), a = new Set((e.updated || []).map(({ oldValue: c }) => c.id)), s = new Set((e.updated || []).filter(({ oldValue: c }) => n.has(c.id) || o.has(c.id)).map(({ oldValue: c }) => c.id)), l = [
|
|
615
|
-
...(t.created || []).filter((c) => !i.has(c.id)).map((c) => a.has(c.id) ? e.updated.find(({ oldValue: g }) => g.id === c.id).newValue : c),
|
|
616
|
-
...e.created || []
|
|
617
|
-
], d = [
|
|
618
|
-
...(t.deleted || []).filter((c) => !r.has(c.id)),
|
|
619
|
-
...(e.deleted || []).filter((c) => !n.has(c.id))
|
|
620
|
-
], p = [
|
|
621
|
-
...(t.updated || []).filter(({ newValue: c }) => !i.has(c.id)).map((c) => {
|
|
622
|
-
const { oldValue: g, newValue: h } = c;
|
|
623
|
-
if (a.has(h.id)) {
|
|
624
|
-
const m = e.updated.find((x) => x.oldValue.id === h.id).newValue;
|
|
625
|
-
return qe(g, m);
|
|
626
|
-
} else
|
|
627
|
-
return c;
|
|
628
|
-
}),
|
|
629
|
-
...(e.updated || []).filter(({ oldValue: c }) => !s.has(c.id))
|
|
630
|
-
];
|
|
631
|
-
return { created: l, deleted: d, updated: p };
|
|
632
|
-
}, Dn = (t) => t.id !== void 0, Un = () => {
|
|
633
|
-
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = [], o = (f, b = {}) => n.push({ onChange: f, options: b }), r = (f) => {
|
|
634
|
-
const b = n.findIndex((w) => w.onChange == f);
|
|
635
|
-
b > -1 && n.splice(b, 1);
|
|
636
|
-
}, i = (f, b) => {
|
|
637
|
-
const w = {
|
|
638
|
-
origin: f,
|
|
639
|
-
changes: {
|
|
640
|
-
created: b.created || [],
|
|
641
|
-
updated: b.updated || [],
|
|
642
|
-
deleted: b.deleted || []
|
|
643
|
-
},
|
|
644
|
-
state: [...t.values()]
|
|
645
|
-
};
|
|
646
|
-
n.forEach((S) => {
|
|
647
|
-
Vn(S, w) && S.onChange(w);
|
|
648
|
-
});
|
|
649
|
-
}, a = (f, b = D.LOCAL) => {
|
|
650
|
-
if (t.get(f.id))
|
|
651
|
-
throw Error(`Cannot add annotation ${f.id} - exists already`);
|
|
652
|
-
t.set(f.id, f), f.bodies.forEach((w) => e.set(w.id, f.id)), i(b, { created: [f] });
|
|
653
|
-
}, s = (f, b) => {
|
|
654
|
-
const w = typeof f == "string" ? b : f, S = typeof f == "string" ? f : f.id, M = t.get(S);
|
|
655
|
-
if (M) {
|
|
656
|
-
const C = qe(M, w);
|
|
657
|
-
return S === w.id ? t.set(S, w) : (t.delete(S), t.set(w.id, w)), M.bodies.forEach((K) => e.delete(K.id)), w.bodies.forEach((K) => e.set(K.id, w.id)), C;
|
|
658
|
-
} else
|
|
659
|
-
console.warn(`Cannot update annotation ${S} - does not exist`);
|
|
660
|
-
}, l = (f, b = D.LOCAL, w = D.LOCAL) => {
|
|
661
|
-
const S = Dn(b) ? w : b, M = s(f, b);
|
|
662
|
-
M && i(S, { updated: [M] });
|
|
663
|
-
}, d = (f, b = D.LOCAL) => {
|
|
664
|
-
const w = f.reduce((S, M) => {
|
|
665
|
-
const C = s(M);
|
|
666
|
-
return C ? [...S, C] : S;
|
|
667
|
-
}, []);
|
|
668
|
-
w.length > 0 && i(b, { updated: w });
|
|
669
|
-
}, p = (f, b = D.LOCAL) => {
|
|
670
|
-
const w = t.get(f.annotation);
|
|
671
|
-
if (w) {
|
|
672
|
-
const S = {
|
|
673
|
-
...w,
|
|
674
|
-
bodies: [...w.bodies, f]
|
|
675
|
-
};
|
|
676
|
-
t.set(w.id, S), e.set(f.id, S.id), i(b, { updated: [{
|
|
677
|
-
oldValue: w,
|
|
678
|
-
newValue: S,
|
|
679
|
-
bodiesCreated: [f]
|
|
680
|
-
}] });
|
|
681
|
-
} else
|
|
682
|
-
console.warn(`Attempt to add body to missing annotation: ${f.annotation}`);
|
|
683
|
-
}, c = () => [...t.values()], g = (f = D.LOCAL) => {
|
|
684
|
-
const b = [...t.values()];
|
|
685
|
-
t.clear(), e.clear(), i(f, { deleted: b });
|
|
686
|
-
}, h = (f, b = !0, w = D.LOCAL) => {
|
|
687
|
-
if (b) {
|
|
688
|
-
const S = [...t.values()];
|
|
689
|
-
t.clear(), e.clear(), f.forEach((M) => {
|
|
690
|
-
t.set(M.id, M), M.bodies.forEach((C) => e.set(C.id, M.id));
|
|
691
|
-
}), i(w, { created: f, deleted: S });
|
|
692
|
-
} else {
|
|
693
|
-
const S = f.reduce((M, C) => {
|
|
694
|
-
const K = t.get(C.id);
|
|
695
|
-
return K ? [...M, K] : M;
|
|
696
|
-
}, []);
|
|
697
|
-
if (S.length > 0)
|
|
698
|
-
throw Error(`Bulk insert would overwrite the following annotations: ${S.map((M) => M.id).join(", ")}`);
|
|
699
|
-
f.forEach((M) => {
|
|
700
|
-
t.set(M.id, M), M.bodies.forEach((C) => e.set(C.id, M.id));
|
|
701
|
-
}), i(w, { created: f });
|
|
702
|
-
}
|
|
703
|
-
}, m = (f) => {
|
|
704
|
-
const b = typeof f == "string" ? f : f.id, w = t.get(b);
|
|
705
|
-
if (w)
|
|
706
|
-
return t.delete(b), w.bodies.forEach((S) => e.delete(S.id)), w;
|
|
707
|
-
console.warn(`Attempt to delete missing annotation: ${b}`);
|
|
708
|
-
}, x = (f, b = D.LOCAL) => {
|
|
709
|
-
const w = m(f);
|
|
710
|
-
w && i(b, { deleted: [w] });
|
|
711
|
-
}, A = (f, b = D.LOCAL) => {
|
|
712
|
-
const w = f.reduce((S, M) => {
|
|
713
|
-
const C = m(M);
|
|
714
|
-
return C ? [...S, C] : S;
|
|
715
|
-
}, []);
|
|
716
|
-
w.length > 0 && i(b, { deleted: w });
|
|
717
|
-
}, $ = (f, b = D.LOCAL) => {
|
|
718
|
-
const w = t.get(f.annotation);
|
|
719
|
-
if (w) {
|
|
720
|
-
const S = w.bodies.find((M) => M.id === f.id);
|
|
721
|
-
if (S) {
|
|
722
|
-
e.delete(S.id);
|
|
723
|
-
const M = {
|
|
724
|
-
...w,
|
|
725
|
-
bodies: w.bodies.filter((C) => C.id !== f.id)
|
|
726
|
-
};
|
|
727
|
-
t.set(w.id, M), i(b, { updated: [{
|
|
728
|
-
oldValue: w,
|
|
729
|
-
newValue: M,
|
|
730
|
-
bodiesDeleted: [S]
|
|
731
|
-
}] });
|
|
732
|
-
} else
|
|
733
|
-
console.warn(`Attempt to delete missing body ${f.id} from annotation ${f.annotation}`);
|
|
734
|
-
} else
|
|
735
|
-
console.warn(`Attempt to delete body from missing annotation ${f.annotation}`);
|
|
736
|
-
}, y = (f) => {
|
|
737
|
-
const b = t.get(f);
|
|
738
|
-
return b ? { ...b } : void 0;
|
|
739
|
-
}, E = (f) => {
|
|
740
|
-
const b = e.get(f);
|
|
741
|
-
if (b) {
|
|
742
|
-
const w = y(b).bodies.find((S) => S.id === f);
|
|
743
|
-
if (w)
|
|
744
|
-
return w;
|
|
745
|
-
console.error(`Store integrity error: body ${f} in index, but not in annotation`);
|
|
746
|
-
} else
|
|
747
|
-
console.warn(`Attempt to retrieve missing body: ${f}`);
|
|
748
|
-
}, v = (f, b) => {
|
|
749
|
-
if (f.annotation !== b.annotation)
|
|
750
|
-
throw "Annotation integrity violation: annotation ID must be the same when updating bodies";
|
|
751
|
-
const w = t.get(f.annotation);
|
|
752
|
-
if (w) {
|
|
753
|
-
const S = w.bodies.find((C) => C.id === f.id), M = {
|
|
754
|
-
...w,
|
|
755
|
-
bodies: w.bodies.map((C) => C.id === S.id ? b : C)
|
|
756
|
-
};
|
|
757
|
-
return t.set(w.id, M), S.id !== b.id && (e.delete(S.id), e.set(b.id, M.id)), {
|
|
758
|
-
oldValue: w,
|
|
759
|
-
newValue: M,
|
|
760
|
-
bodiesUpdated: [{ oldBody: S, newBody: b }]
|
|
761
|
-
};
|
|
762
|
-
} else
|
|
763
|
-
console.warn(`Attempt to add body to missing annotation ${f.annotation}`);
|
|
764
|
-
}, X = (f, b, w = D.LOCAL) => {
|
|
765
|
-
const S = v(f, b);
|
|
766
|
-
i(w, { updated: [S] });
|
|
767
|
-
}, I = (f, b = D.LOCAL) => {
|
|
768
|
-
const w = f.map((S) => v({ id: S.id, annotation: S.annotation }, S));
|
|
769
|
-
i(b, { updated: w });
|
|
770
|
-
}, V = (f) => {
|
|
771
|
-
const b = t.get(f.annotation);
|
|
772
|
-
if (b) {
|
|
773
|
-
const w = {
|
|
774
|
-
...b,
|
|
775
|
-
target: {
|
|
776
|
-
...b.target,
|
|
777
|
-
...f
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
return t.set(b.id, w), {
|
|
781
|
-
oldValue: b,
|
|
782
|
-
newValue: w,
|
|
783
|
-
targetUpdated: {
|
|
784
|
-
oldTarget: b.target,
|
|
785
|
-
newTarget: f
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
} else
|
|
789
|
-
console.warn(`Attempt to update target on missing annotation: ${f.annotation}`);
|
|
790
|
-
};
|
|
791
|
-
return {
|
|
792
|
-
addAnnotation: a,
|
|
793
|
-
addBody: p,
|
|
794
|
-
all: c,
|
|
795
|
-
bulkAddAnnotation: h,
|
|
796
|
-
bulkDeleteAnnotation: A,
|
|
797
|
-
bulkUpdateAnnotation: d,
|
|
798
|
-
bulkUpdateBodies: I,
|
|
799
|
-
bulkUpdateTargets: (f, b = D.LOCAL) => {
|
|
800
|
-
const w = f.map(V).filter((S) => S);
|
|
801
|
-
w.length > 0 && i(b, { updated: w });
|
|
802
|
-
},
|
|
803
|
-
clear: g,
|
|
804
|
-
deleteAnnotation: x,
|
|
805
|
-
deleteBody: $,
|
|
806
|
-
getAnnotation: y,
|
|
807
|
-
getBody: E,
|
|
808
|
-
observe: o,
|
|
809
|
-
unobserve: r,
|
|
810
|
-
updateAnnotation: l,
|
|
811
|
-
updateBody: X,
|
|
812
|
-
updateTarget: (f, b = D.LOCAL) => {
|
|
813
|
-
const w = V(f);
|
|
814
|
-
w && i(b, { updated: [w] });
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
}, Gn = (t) => ({
|
|
818
|
-
...t,
|
|
819
|
-
subscribe: (e) => {
|
|
820
|
-
const n = (o) => e(o.state);
|
|
821
|
-
return t.observe(n), e(t.all()), () => t.unobserve(n);
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
let Fn = () => ({
|
|
825
|
-
emit(t, ...e) {
|
|
826
|
-
let n = this.events[t] || [];
|
|
827
|
-
for (let o = 0, r = n.length; o < r; o++)
|
|
828
|
-
n[o](...e);
|
|
829
|
-
},
|
|
830
|
-
events: {},
|
|
831
|
-
on(t, e) {
|
|
832
|
-
var n;
|
|
833
|
-
return (n = this.events[t]) != null && n.push(e) || (this.events[t] = [e]), () => {
|
|
834
|
-
var o;
|
|
835
|
-
this.events[t] = (o = this.events[t]) == null ? void 0 : o.filter((r) => e !== r);
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
const Hn = 250, Pn = (t) => {
|
|
840
|
-
const e = Fn(), n = [];
|
|
841
|
-
let o = -1, r = !1, i = 0;
|
|
842
|
-
const a = (h) => {
|
|
843
|
-
if (!r) {
|
|
844
|
-
const { changes: m } = h, x = performance.now();
|
|
845
|
-
if (x - i > Hn)
|
|
846
|
-
n.splice(o + 1), n.push(m), o = n.length - 1;
|
|
847
|
-
else {
|
|
848
|
-
const A = n.length - 1;
|
|
849
|
-
n[A] = kn(n[A], m);
|
|
850
|
-
}
|
|
851
|
-
i = x;
|
|
852
|
-
}
|
|
853
|
-
r = !1;
|
|
854
|
-
};
|
|
855
|
-
t.observe(a, { origin: D.LOCAL });
|
|
856
|
-
const s = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkDeleteAnnotation(h), l = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkAddAnnotation(h, !1), d = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkUpdateAnnotation(h.map(({ oldValue: m }) => m)), p = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkUpdateAnnotation(h.map(({ newValue: m }) => m)), c = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkAddAnnotation(h, !1), g = (h) => (h == null ? void 0 : h.length) > 0 && t.bulkDeleteAnnotation(h);
|
|
857
|
-
return {
|
|
858
|
-
canRedo: () => n.length - 1 > o,
|
|
859
|
-
canUndo: () => o > -1,
|
|
860
|
-
destroy: () => t.unobserve(a),
|
|
861
|
-
on: (h, m) => e.on(h, m),
|
|
862
|
-
redo: () => {
|
|
863
|
-
if (n.length - 1 > o) {
|
|
864
|
-
r = !0;
|
|
865
|
-
const { created: h, updated: m, deleted: x } = n[o + 1];
|
|
866
|
-
l(h), p(m), g(x), e.emit("redo", n[o + 1]), o += 1;
|
|
867
|
-
}
|
|
868
|
-
},
|
|
869
|
-
undo: () => {
|
|
870
|
-
if (o > -1) {
|
|
871
|
-
r = !0;
|
|
872
|
-
const { created: h, updated: m, deleted: x } = n[o];
|
|
873
|
-
s(h), d(m), c(x), e.emit("undo", n[o]), o -= 1;
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
};
|
|
877
|
-
}, jn = () => {
|
|
878
|
-
const { subscribe: t, set: e } = le([]);
|
|
879
|
-
return {
|
|
880
|
-
subscribe: t,
|
|
881
|
-
set: e
|
|
882
|
-
};
|
|
883
|
-
}, zn = (t, e, n, o) => {
|
|
884
|
-
const { store: r, selection: i, hover: a, viewport: s } = t, l = /* @__PURE__ */ new Map();
|
|
885
|
-
let d = [], p, c;
|
|
886
|
-
const g = ($, y) => {
|
|
887
|
-
l.has($) ? l.get($).push(y) : l.set($, [y]);
|
|
888
|
-
}, h = ($, y) => {
|
|
889
|
-
const E = l.get($);
|
|
890
|
-
E && E.indexOf(y) > 0 && E.splice(E.indexOf(y), 1);
|
|
891
|
-
}, m = ($, y, E) => {
|
|
892
|
-
l.has($) && setTimeout(() => {
|
|
893
|
-
l.get($).forEach((v) => {
|
|
894
|
-
if (n) {
|
|
895
|
-
const X = Array.isArray(y) ? y.map((V) => n.serialize(V)) : n.serialize(y), I = E ? E instanceof PointerEvent ? E : n.serialize(E) : void 0;
|
|
896
|
-
v(X, I);
|
|
897
|
-
} else
|
|
898
|
-
v(y, E);
|
|
899
|
-
});
|
|
900
|
-
}, 1);
|
|
901
|
-
}, x = () => {
|
|
902
|
-
const { selected: $ } = i, y = $.map(({ id: E }) => r.getAnnotation(E));
|
|
903
|
-
y.forEach((E) => {
|
|
904
|
-
const v = d.find((X) => X.id === E.id);
|
|
905
|
-
(!v || !ht(v, E)) && m("updateAnnotation", E, v);
|
|
906
|
-
}), d = d.map((E) => y.find(({ id: v }) => v === E.id) || E);
|
|
907
|
-
};
|
|
908
|
-
i.subscribe(({ selected: $ }) => {
|
|
909
|
-
if (!(d.length === 0 && $.length === 0)) {
|
|
910
|
-
if (d.length === 0 && $.length > 0)
|
|
911
|
-
d = $.map(({ id: y }) => r.getAnnotation(y));
|
|
912
|
-
else if (d.length > 0 && $.length === 0)
|
|
913
|
-
d.forEach((y) => {
|
|
914
|
-
const E = r.getAnnotation(y.id);
|
|
915
|
-
E && !ht(E, y) && m("updateAnnotation", E, y);
|
|
916
|
-
}), d = [];
|
|
917
|
-
else {
|
|
918
|
-
const y = new Set(d.map((v) => v.id)), E = new Set($.map(({ id: v }) => v));
|
|
919
|
-
d.filter((v) => !E.has(v.id)).forEach((v) => {
|
|
920
|
-
const X = r.getAnnotation(v.id);
|
|
921
|
-
X && !ht(X, v) && m("updateAnnotation", X, v);
|
|
922
|
-
}), d = [
|
|
923
|
-
// Remove annotations that were deselected
|
|
924
|
-
...d.filter((v) => E.has(v.id)),
|
|
925
|
-
// Add editable annotations that were selected
|
|
926
|
-
...$.filter(({ id: v }) => !y.has(v)).map(({ id: v }) => r.getAnnotation(v))
|
|
927
|
-
];
|
|
928
|
-
}
|
|
929
|
-
m("selectionChanged", d);
|
|
930
|
-
}
|
|
931
|
-
}), a.subscribe(($) => {
|
|
932
|
-
!p && $ ? m("mouseEnterAnnotation", r.getAnnotation($)) : p && !$ ? m("mouseLeaveAnnotation", r.getAnnotation(p)) : p && $ && (m("mouseLeaveAnnotation", r.getAnnotation(p)), m("mouseEnterAnnotation", r.getAnnotation($))), p = $;
|
|
933
|
-
}), s == null || s.subscribe(($) => m("viewportIntersect", $.map(r.getAnnotation))), r.observe(($) => {
|
|
934
|
-
o && (c && clearTimeout(c), c = setTimeout(x, 1e3));
|
|
935
|
-
const { created: y, deleted: E } = $.changes;
|
|
936
|
-
y.forEach((v) => m("createAnnotation", v)), E.forEach((v) => m("deleteAnnotation", v)), $.changes.updated.filter((v) => [
|
|
937
|
-
...v.bodiesCreated || [],
|
|
938
|
-
...v.bodiesDeleted || [],
|
|
939
|
-
...v.bodiesUpdated || []
|
|
940
|
-
].length > 0).forEach(({ oldValue: v, newValue: X }) => {
|
|
941
|
-
const I = d.find((V) => V.id === v.id) || v;
|
|
942
|
-
d = d.map((V) => V.id === v.id ? X : V), m("updateAnnotation", X, I);
|
|
943
|
-
});
|
|
944
|
-
}, { origin: D.LOCAL }), r.observe(($) => {
|
|
945
|
-
if (d) {
|
|
946
|
-
const y = new Set(d.map((v) => v.id)), E = $.changes.updated.filter(({ newValue: v }) => y.has(v.id)).map(({ newValue: v }) => v);
|
|
947
|
-
E.length > 0 && (d = d.map((v) => E.find((X) => X.id === v.id) || v));
|
|
948
|
-
}
|
|
949
|
-
}, { origin: D.REMOTE });
|
|
950
|
-
const A = ($) => (y) => {
|
|
951
|
-
const { created: E, deleted: v, updated: X } = y;
|
|
952
|
-
E.forEach((I) => m("createAnnotation", I)), v.forEach((I) => m("deleteAnnotation", I)), $ ? X.forEach((I) => m("updateAnnotation", I.oldValue, I.newValue)) : X.forEach((I) => m("updateAnnotation", I.newValue, I.oldValue));
|
|
953
|
-
};
|
|
954
|
-
return e.on("undo", A(!0)), e.on("redo", A(!1)), { on: g, off: h, emit: m };
|
|
955
|
-
}, qn = (t) => (e) => e.reduce((n, o) => {
|
|
956
|
-
const { parsed: r, error: i } = t.parse(o);
|
|
957
|
-
return i ? {
|
|
958
|
-
parsed: n.parsed,
|
|
959
|
-
failed: [...n.failed, o]
|
|
960
|
-
} : {
|
|
961
|
-
parsed: [...n.parsed, r],
|
|
962
|
-
failed: n.failed
|
|
963
|
-
};
|
|
964
|
-
}, { parsed: [], failed: [] }), Wn = (t, e, n) => {
|
|
965
|
-
const { store: o, selection: r } = t, i = (A) => {
|
|
966
|
-
if (n) {
|
|
967
|
-
const { parsed: $, error: y } = n.parse(A);
|
|
968
|
-
$ ? o.addAnnotation($, D.REMOTE) : console.error(y);
|
|
969
|
-
} else
|
|
970
|
-
o.addAnnotation(A, D.REMOTE);
|
|
971
|
-
}, a = () => r.clear(), s = () => o.clear(), l = (A) => {
|
|
972
|
-
const $ = o.getAnnotation(A);
|
|
973
|
-
return n && $ ? n.serialize($) : $;
|
|
974
|
-
}, d = () => n ? o.all().map(n.serialize) : o.all(), p = () => {
|
|
975
|
-
var A;
|
|
976
|
-
const $ = (((A = r.selected) == null ? void 0 : A.map((y) => y.id)) || []).map((y) => o.getAnnotation(y));
|
|
977
|
-
return n ? $.map(n.serialize) : $;
|
|
978
|
-
}, c = (A) => fetch(A).then(($) => $.json()).then(($) => (h($), $)), g = (A) => {
|
|
979
|
-
if (typeof A == "string") {
|
|
980
|
-
const $ = o.getAnnotation(A);
|
|
981
|
-
return o.deleteAnnotation(A), n ? n.serialize($) : $;
|
|
982
|
-
} else {
|
|
983
|
-
const $ = n ? n.parse(A).parsed : A;
|
|
984
|
-
return o.deleteAnnotation($), A;
|
|
985
|
-
}
|
|
986
|
-
}, h = (A) => {
|
|
987
|
-
if (n) {
|
|
988
|
-
const { parsed: $, failed: y } = qn(n)(A);
|
|
989
|
-
y.length > 0 && console.warn(`Discarded ${y.length} invalid annotations`, y), o.bulkAddAnnotation($, !0, D.REMOTE);
|
|
990
|
-
} else
|
|
991
|
-
o.bulkAddAnnotation(A, !0, D.REMOTE);
|
|
992
|
-
}, m = (A) => {
|
|
993
|
-
A ? r.setSelected(A) : r.clear();
|
|
994
|
-
}, x = (A) => {
|
|
995
|
-
if (n) {
|
|
996
|
-
const $ = n.parse(A).parsed, y = n.serialize(o.getAnnotation($.id));
|
|
997
|
-
return o.updateAnnotation($), y;
|
|
998
|
-
} else {
|
|
999
|
-
const $ = o.getAnnotation(A.id);
|
|
1000
|
-
return o.updateAnnotation(A), $;
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
return {
|
|
1004
|
-
addAnnotation: i,
|
|
1005
|
-
cancelSelected: a,
|
|
1006
|
-
canRedo: e.canRedo,
|
|
1007
|
-
canUndo: e.canUndo,
|
|
1008
|
-
clearAnnotations: s,
|
|
1009
|
-
getAnnotationById: l,
|
|
1010
|
-
getAnnotations: d,
|
|
1011
|
-
getSelected: p,
|
|
1012
|
-
loadAnnotations: c,
|
|
1013
|
-
redo: e.redo,
|
|
1014
|
-
removeAnnotation: g,
|
|
1015
|
-
setAnnotations: h,
|
|
1016
|
-
setSelected: m,
|
|
1017
|
-
undo: e.undo,
|
|
1018
|
-
updateAnnotation: x
|
|
1019
|
-
};
|
|
1020
|
-
};
|
|
1021
|
-
let Kn = (t) => crypto.getRandomValues(new Uint8Array(t)), Jn = (t, e, n) => {
|
|
1022
|
-
let o = (2 << Math.log(t.length - 1) / Math.LN2) - 1, r = -~(1.6 * o * e / t.length);
|
|
1023
|
-
return (i = e) => {
|
|
1024
|
-
let a = "";
|
|
1025
|
-
for (; ; ) {
|
|
1026
|
-
let s = n(r), l = r;
|
|
1027
|
-
for (; l--; )
|
|
1028
|
-
if (a += t[s[l] & o] || "", a.length === i)
|
|
1029
|
-
return a;
|
|
1030
|
-
}
|
|
1031
|
-
};
|
|
1032
|
-
}, Zn = (t, e = 21) => Jn(t, e, Kn), Qn = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
|
|
1033
|
-
const to = () => ({ isGuest: !0, id: Zn("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() }), eo = (t) => {
|
|
1034
|
-
const e = JSON.stringify(t);
|
|
1035
|
-
let n = 0;
|
|
1036
|
-
for (let o = 0, r = e.length; o < r; o++) {
|
|
1037
|
-
let i = e.charCodeAt(o);
|
|
1038
|
-
n = (n << 5) - n + i, n |= 0;
|
|
1039
|
-
}
|
|
1040
|
-
return `${n}`;
|
|
1041
|
-
}, no = (t, e) => (Array.isArray(t) ? t : [t]).map((n) => {
|
|
1042
|
-
const { id: o, type: r, purpose: i, value: a, created: s, creator: l, ...d } = n;
|
|
1043
|
-
return {
|
|
1044
|
-
id: o || `temp-${eo(n)}`,
|
|
1045
|
-
annotation: e,
|
|
1046
|
-
type: r,
|
|
1047
|
-
purpose: i,
|
|
1048
|
-
value: a,
|
|
1049
|
-
created: s,
|
|
1050
|
-
creator: l ? typeof l == "object" ? { ...l } : l : void 0,
|
|
1051
|
-
...d
|
|
1052
|
-
};
|
|
1053
|
-
}), oo = (t) => t.map((e) => {
|
|
1054
|
-
var n;
|
|
1055
|
-
const o = { ...e };
|
|
1056
|
-
return delete o.annotation, (n = o.id) != null && n.startsWith("temp-") && delete o.id, o;
|
|
1057
|
-
});
|
|
1058
|
-
Qn();
|
|
1059
|
-
const $r = (t, e = !1) => ({ parse: (n) => ro(n, e), serialize: (n) => io(n, t) }), ro = (t, e = !1) => {
|
|
1060
|
-
const n = t.id || je(), { body: o, ...r } = t, i = no(o, n), a = Array.isArray(t.target) ? t.target[0] : t.target, s = Array.isArray(a.selector) ? a.selector[0] : a.selector, l = s.type === "FragmentSelector" ? yn(s, e) : s.type === "SvgSelector" ? vn(s) : void 0;
|
|
1061
|
-
return l ? {
|
|
1062
|
-
parsed: {
|
|
1063
|
-
...r,
|
|
1064
|
-
id: n,
|
|
1065
|
-
bodies: i,
|
|
1066
|
-
target: {
|
|
1067
|
-
...r.target,
|
|
1068
|
-
annotation: n,
|
|
1069
|
-
selector: l
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
} : {
|
|
1073
|
-
error: Error(`Unknown selector type: ${s.type}`)
|
|
1074
|
-
};
|
|
1075
|
-
}, io = (t, e) => {
|
|
1076
|
-
const n = t.target.selector, o = n.type == G.RECTANGLE ? wn(n.geometry) : An(n);
|
|
1077
|
-
return {
|
|
1078
|
-
...t,
|
|
1079
|
-
"@context": "http://www.w3.org/ns/anno.jsonld",
|
|
1080
|
-
id: t.id,
|
|
1081
|
-
type: "Annotation",
|
|
1082
|
-
body: oo(t.bodies),
|
|
1083
|
-
target: {
|
|
1084
|
-
source: e,
|
|
1085
|
-
selector: o
|
|
1086
|
-
}
|
|
1087
|
-
};
|
|
1088
|
-
};
|
|
1089
|
-
function we(t, e, n) {
|
|
1090
|
-
const o = t.slice();
|
|
1091
|
-
return o[11] = e[n], o[13] = n, o;
|
|
1092
|
-
}
|
|
1093
|
-
function $e(t) {
|
|
1094
|
-
let e, n, o, r, i;
|
|
1095
|
-
return {
|
|
1096
|
-
c() {
|
|
1097
|
-
e = R("rect"), u(e, "class", "a9s-corner-handle"), u(e, "x", n = /*point*/
|
|
1098
|
-
t[11][0] - /*handleSize*/
|
|
1099
|
-
t[3] / 2), u(e, "y", o = /*point*/
|
|
1100
|
-
t[11][1] - /*handleSize*/
|
|
1101
|
-
t[3] / 2), u(
|
|
1102
|
-
e,
|
|
1103
|
-
"height",
|
|
1104
|
-
/*handleSize*/
|
|
1105
|
-
t[3]
|
|
1106
|
-
), u(
|
|
1107
|
-
e,
|
|
1108
|
-
"width",
|
|
1109
|
-
/*handleSize*/
|
|
1110
|
-
t[3]
|
|
1111
|
-
);
|
|
1112
|
-
},
|
|
1113
|
-
m(a, s) {
|
|
1114
|
-
_(a, e, s), r || (i = z(e, "pointerdown", function() {
|
|
1115
|
-
H(
|
|
1116
|
-
/*grab*/
|
|
1117
|
-
t[10](O(
|
|
1118
|
-
/*idx*/
|
|
1119
|
-
t[13]
|
|
1120
|
-
))
|
|
1121
|
-
) && t[10](O(
|
|
1122
|
-
/*idx*/
|
|
1123
|
-
t[13]
|
|
1124
|
-
)).apply(this, arguments);
|
|
1125
|
-
}), r = !0);
|
|
1126
|
-
},
|
|
1127
|
-
p(a, s) {
|
|
1128
|
-
t = a, s & /*geom, handleSize*/
|
|
1129
|
-
24 && n !== (n = /*point*/
|
|
1130
|
-
t[11][0] - /*handleSize*/
|
|
1131
|
-
t[3] / 2) && u(e, "x", n), s & /*geom, handleSize*/
|
|
1132
|
-
24 && o !== (o = /*point*/
|
|
1133
|
-
t[11][1] - /*handleSize*/
|
|
1134
|
-
t[3] / 2) && u(e, "y", o), s & /*handleSize*/
|
|
1135
|
-
8 && u(
|
|
1136
|
-
e,
|
|
1137
|
-
"height",
|
|
1138
|
-
/*handleSize*/
|
|
1139
|
-
t[3]
|
|
1140
|
-
), s & /*handleSize*/
|
|
1141
|
-
8 && u(
|
|
1142
|
-
e,
|
|
1143
|
-
"width",
|
|
1144
|
-
/*handleSize*/
|
|
1145
|
-
t[3]
|
|
1146
|
-
);
|
|
1147
|
-
},
|
|
1148
|
-
d(a) {
|
|
1149
|
-
a && Y(e), r = !1, i();
|
|
1150
|
-
}
|
|
1151
|
-
};
|
|
1152
|
-
}
|
|
1153
|
-
function ao(t) {
|
|
1154
|
-
let e, n, o, r, i, a, s, l, d, p, c = (
|
|
1155
|
-
/*geom*/
|
|
1156
|
-
t[4].points
|
|
1157
|
-
), g = [];
|
|
1158
|
-
for (let h = 0; h < c.length; h += 1)
|
|
1159
|
-
g[h] = $e(we(t, c, h));
|
|
1160
|
-
return {
|
|
1161
|
-
c() {
|
|
1162
|
-
e = R("polygon"), r = tt(), i = R("polygon"), s = tt();
|
|
1163
|
-
for (let h = 0; h < g.length; h += 1)
|
|
1164
|
-
g[h].c();
|
|
1165
|
-
l = at(), u(e, "class", "a9s-outer"), u(e, "style", n = /*computedStyle*/
|
|
1166
|
-
t[1] ? "display:none;" : void 0), u(e, "points", o = /*geom*/
|
|
1167
|
-
t[4].points.map(xe).join(" ")), u(i, "class", "a9s-inner a9s-shape-handle"), u(
|
|
1168
|
-
i,
|
|
1169
|
-
"style",
|
|
1170
|
-
/*computedStyle*/
|
|
1171
|
-
t[1]
|
|
1172
|
-
), u(i, "points", a = /*geom*/
|
|
1173
|
-
t[4].points.map(be).join(" "));
|
|
1174
|
-
},
|
|
1175
|
-
m(h, m) {
|
|
1176
|
-
_(h, e, m), _(h, r, m), _(h, i, m), _(h, s, m);
|
|
1177
|
-
for (let x = 0; x < g.length; x += 1)
|
|
1178
|
-
g[x] && g[x].m(h, m);
|
|
1179
|
-
_(h, l, m), d || (p = [
|
|
1180
|
-
z(e, "pointerdown", function() {
|
|
1181
|
-
H(
|
|
1182
|
-
/*grab*/
|
|
1183
|
-
t[10](O.SHAPE)
|
|
1184
|
-
) && t[10](O.SHAPE).apply(this, arguments);
|
|
1185
|
-
}),
|
|
1186
|
-
z(i, "pointerdown", function() {
|
|
1187
|
-
H(
|
|
1188
|
-
/*grab*/
|
|
1189
|
-
t[10](O.SHAPE)
|
|
1190
|
-
) && t[10](O.SHAPE).apply(this, arguments);
|
|
1191
|
-
})
|
|
1192
|
-
], d = !0);
|
|
1193
|
-
},
|
|
1194
|
-
p(h, m) {
|
|
1195
|
-
if (t = h, m & /*computedStyle*/
|
|
1196
|
-
2 && n !== (n = /*computedStyle*/
|
|
1197
|
-
t[1] ? "display:none;" : void 0) && u(e, "style", n), m & /*geom*/
|
|
1198
|
-
16 && o !== (o = /*geom*/
|
|
1199
|
-
t[4].points.map(xe).join(" ")) && u(e, "points", o), m & /*computedStyle*/
|
|
1200
|
-
2 && u(
|
|
1201
|
-
i,
|
|
1202
|
-
"style",
|
|
1203
|
-
/*computedStyle*/
|
|
1204
|
-
t[1]
|
|
1205
|
-
), m & /*geom*/
|
|
1206
|
-
16 && a !== (a = /*geom*/
|
|
1207
|
-
t[4].points.map(be).join(" ")) && u(i, "points", a), m & /*geom, handleSize, grab, Handle*/
|
|
1208
|
-
1048) {
|
|
1209
|
-
c = /*geom*/
|
|
1210
|
-
t[4].points;
|
|
1211
|
-
let x;
|
|
1212
|
-
for (x = 0; x < c.length; x += 1) {
|
|
1213
|
-
const A = we(t, c, x);
|
|
1214
|
-
g[x] ? g[x].p(A, m) : (g[x] = $e(A), g[x].c(), g[x].m(l.parentNode, l));
|
|
1215
|
-
}
|
|
1216
|
-
for (; x < g.length; x += 1)
|
|
1217
|
-
g[x].d(1);
|
|
1218
|
-
g.length = c.length;
|
|
1219
|
-
}
|
|
1220
|
-
},
|
|
1221
|
-
d(h) {
|
|
1222
|
-
h && Y(e), h && Y(r), h && Y(i), h && Y(s), ie(g, h), h && Y(l), d = !1, it(p);
|
|
1223
|
-
}
|
|
1224
|
-
};
|
|
1225
|
-
}
|
|
1226
|
-
function so(t) {
|
|
1227
|
-
let e, n;
|
|
1228
|
-
return e = new Ke({
|
|
1229
|
-
props: {
|
|
1230
|
-
shape: (
|
|
1231
|
-
/*shape*/
|
|
1232
|
-
t[0]
|
|
1233
|
-
),
|
|
1234
|
-
transform: (
|
|
1235
|
-
/*transform*/
|
|
1236
|
-
t[2]
|
|
1237
|
-
),
|
|
1238
|
-
editor: (
|
|
1239
|
-
/*editor*/
|
|
1240
|
-
t[5]
|
|
1241
|
-
),
|
|
1242
|
-
$$slots: {
|
|
1243
|
-
default: [
|
|
1244
|
-
ao,
|
|
1245
|
-
({ grab: o }) => ({ 10: o }),
|
|
1246
|
-
({ grab: o }) => o ? 1024 : 0
|
|
1247
|
-
]
|
|
1248
|
-
},
|
|
1249
|
-
$$scope: { ctx: t }
|
|
1250
|
-
}
|
|
1251
|
-
}), e.$on(
|
|
1252
|
-
"change",
|
|
1253
|
-
/*change_handler*/
|
|
1254
|
-
t[7]
|
|
1255
|
-
), e.$on(
|
|
1256
|
-
"grab",
|
|
1257
|
-
/*grab_handler*/
|
|
1258
|
-
t[8]
|
|
1259
|
-
), e.$on(
|
|
1260
|
-
"release",
|
|
1261
|
-
/*release_handler*/
|
|
1262
|
-
t[9]
|
|
1263
|
-
), {
|
|
1264
|
-
c() {
|
|
1265
|
-
pt(e.$$.fragment);
|
|
1266
|
-
},
|
|
1267
|
-
m(o, r) {
|
|
1268
|
-
dt(e, o, r), n = !0;
|
|
1269
|
-
},
|
|
1270
|
-
p(o, [r]) {
|
|
1271
|
-
const i = {};
|
|
1272
|
-
r & /*shape*/
|
|
1273
|
-
1 && (i.shape = /*shape*/
|
|
1274
|
-
o[0]), r & /*transform*/
|
|
1275
|
-
4 && (i.transform = /*transform*/
|
|
1276
|
-
o[2]), r & /*$$scope, geom, handleSize, grab, computedStyle*/
|
|
1277
|
-
17434 && (i.$$scope = { dirty: r, ctx: o }), e.$set(i);
|
|
1278
|
-
},
|
|
1279
|
-
i(o) {
|
|
1280
|
-
n || (N(e.$$.fragment, o), n = !0);
|
|
1281
|
-
},
|
|
1282
|
-
o(o) {
|
|
1283
|
-
k(e.$$.fragment, o), n = !1;
|
|
1284
|
-
},
|
|
1285
|
-
d(o) {
|
|
1286
|
-
ct(e, o);
|
|
1287
|
-
}
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
const xe = (t) => t.join(","), be = (t) => t.join(",");
|
|
1291
|
-
function lo(t, e, n) {
|
|
1292
|
-
let o, r, { shape: i } = e, { computedStyle: a = void 0 } = e, { transform: s } = e, { viewportScale: l = 1 } = e;
|
|
1293
|
-
const d = (h, m, x) => {
|
|
1294
|
-
let A;
|
|
1295
|
-
m === O.SHAPE ? A = h.geometry.points.map(([y, E]) => [y + x[0], E + x[1]]) : A = h.geometry.points.map(([y, E], v) => m === O(v) ? [y + x[0], E + x[1]] : [y, E]);
|
|
1296
|
-
const $ = Gt(A);
|
|
1297
|
-
return { ...h, geometry: { points: A, bounds: $ } };
|
|
1298
|
-
};
|
|
1299
|
-
function p(h) {
|
|
1300
|
-
Et.call(this, t, h);
|
|
1301
|
-
}
|
|
1302
|
-
function c(h) {
|
|
1303
|
-
Et.call(this, t, h);
|
|
1304
|
-
}
|
|
1305
|
-
function g(h) {
|
|
1306
|
-
Et.call(this, t, h);
|
|
1307
|
-
}
|
|
1308
|
-
return t.$$set = (h) => {
|
|
1309
|
-
"shape" in h && n(0, i = h.shape), "computedStyle" in h && n(1, a = h.computedStyle), "transform" in h && n(2, s = h.transform), "viewportScale" in h && n(6, l = h.viewportScale);
|
|
1310
|
-
}, t.$$.update = () => {
|
|
1311
|
-
t.$$.dirty & /*shape*/
|
|
1312
|
-
1 && n(4, o = i.geometry), t.$$.dirty & /*viewportScale*/
|
|
1313
|
-
64 && n(3, r = 10 / l);
|
|
1314
|
-
}, [
|
|
1315
|
-
i,
|
|
1316
|
-
a,
|
|
1317
|
-
s,
|
|
1318
|
-
r,
|
|
1319
|
-
o,
|
|
1320
|
-
d,
|
|
1321
|
-
l,
|
|
1322
|
-
p,
|
|
1323
|
-
c,
|
|
1324
|
-
g
|
|
1325
|
-
];
|
|
1326
|
-
}
|
|
1327
|
-
class co extends nt {
|
|
1328
|
-
constructor(e) {
|
|
1329
|
-
super(), et(this, e, lo, so, W, {
|
|
1330
|
-
shape: 0,
|
|
1331
|
-
computedStyle: 1,
|
|
1332
|
-
transform: 2,
|
|
1333
|
-
viewportScale: 6
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
function uo(t) {
|
|
1338
|
-
let e, n, o, r, i, a, s, l, d, p, c, g, h, m, x, A, $, y, E, v, X, I, V, f, b, w, S, M, C, K, gt, ft, Tt, L, q, F, Q, P, st, Bt, Ht, J, Xt, Ct, Pt, Z, It, Rt, jt, ce;
|
|
1339
|
-
return {
|
|
1340
|
-
c() {
|
|
1341
|
-
e = R("rect"), s = tt(), l = R("rect"), h = tt(), m = R("rect"), y = tt(), E = R("rect"), V = tt(), f = R("rect"), M = tt(), C = R("rect"), Tt = tt(), L = R("rect"), Q = tt(), P = R("rect"), Ht = tt(), J = R("rect"), Pt = tt(), Z = R("rect"), u(e, "class", "a9s-outer"), u(e, "style", n = /*computedStyle*/
|
|
1342
|
-
t[1] ? "display:none;" : void 0), u(e, "x", o = /*geom*/
|
|
1343
|
-
t[4].x), u(e, "y", r = /*geom*/
|
|
1344
|
-
t[4].y), u(e, "width", i = /*geom*/
|
|
1345
|
-
t[4].w), u(e, "height", a = /*geom*/
|
|
1346
|
-
t[4].h), u(l, "class", "a9s-inner a9s-shape-handle"), u(
|
|
1347
|
-
l,
|
|
1348
|
-
"style",
|
|
1349
|
-
/*computedStyle*/
|
|
1350
|
-
t[1]
|
|
1351
|
-
), u(l, "x", d = /*geom*/
|
|
1352
|
-
t[4].x), u(l, "y", p = /*geom*/
|
|
1353
|
-
t[4].y), u(l, "width", c = /*geom*/
|
|
1354
|
-
t[4].w), u(l, "height", g = /*geom*/
|
|
1355
|
-
t[4].h), u(m, "class", "a9s-edge-handle a9s-edge-handle-top"), u(m, "x", x = /*geom*/
|
|
1356
|
-
t[4].x), u(m, "y", A = /*geom*/
|
|
1357
|
-
t[4].y), u(m, "height", 1), u(m, "width", $ = /*geom*/
|
|
1358
|
-
t[4].w), u(E, "class", "a9s-edge-handle a9s-edge-handle-right"), u(E, "x", v = /*geom*/
|
|
1359
|
-
t[4].x + /*geom*/
|
|
1360
|
-
t[4].w), u(E, "y", X = /*geom*/
|
|
1361
|
-
t[4].y), u(E, "height", I = /*geom*/
|
|
1362
|
-
t[4].h), u(E, "width", 1), u(f, "class", "a9s-edge-handle a9s-edge-handle-bottom"), u(f, "x", b = /*geom*/
|
|
1363
|
-
t[4].x), u(f, "y", w = /*geom*/
|
|
1364
|
-
t[4].y + /*geom*/
|
|
1365
|
-
t[4].h), u(f, "height", 1), u(f, "width", S = /*geom*/
|
|
1366
|
-
t[4].w), u(C, "class", "a9s-edge-handle a9s-edge-handle-left"), u(C, "x", K = /*geom*/
|
|
1367
|
-
t[4].x), u(C, "y", gt = /*geom*/
|
|
1368
|
-
t[4].y), u(C, "height", ft = /*geom*/
|
|
1369
|
-
t[4].h), u(C, "width", 1), u(L, "class", "a9s-corner-handle a9s-corner-handle-topleft"), u(L, "x", q = /*geom*/
|
|
1370
|
-
t[4].x - /*handleSize*/
|
|
1371
|
-
t[3] / 2), u(L, "y", F = /*geom*/
|
|
1372
|
-
t[4].y - /*handleSize*/
|
|
1373
|
-
t[3] / 2), u(
|
|
1374
|
-
L,
|
|
1375
|
-
"height",
|
|
1376
|
-
/*handleSize*/
|
|
1377
|
-
t[3]
|
|
1378
|
-
), u(
|
|
1379
|
-
L,
|
|
1380
|
-
"width",
|
|
1381
|
-
/*handleSize*/
|
|
1382
|
-
t[3]
|
|
1383
|
-
), u(P, "class", "a9s-corner-handle a9s-corner-handle-topright"), u(P, "x", st = /*geom*/
|
|
1384
|
-
t[4].x + /*geom*/
|
|
1385
|
-
t[4].w - /*handleSize*/
|
|
1386
|
-
t[3] / 2), u(P, "y", Bt = /*geom*/
|
|
1387
|
-
t[4].y - /*handleSize*/
|
|
1388
|
-
t[3] / 2), u(
|
|
1389
|
-
P,
|
|
1390
|
-
"height",
|
|
1391
|
-
/*handleSize*/
|
|
1392
|
-
t[3]
|
|
1393
|
-
), u(
|
|
1394
|
-
P,
|
|
1395
|
-
"width",
|
|
1396
|
-
/*handleSize*/
|
|
1397
|
-
t[3]
|
|
1398
|
-
), u(J, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), u(J, "x", Xt = /*geom*/
|
|
1399
|
-
t[4].x + /*geom*/
|
|
1400
|
-
t[4].w - /*handleSize*/
|
|
1401
|
-
t[3] / 2), u(J, "y", Ct = /*geom*/
|
|
1402
|
-
t[4].y + /*geom*/
|
|
1403
|
-
t[4].h - /*handleSize*/
|
|
1404
|
-
t[3] / 2), u(
|
|
1405
|
-
J,
|
|
1406
|
-
"height",
|
|
1407
|
-
/*handleSize*/
|
|
1408
|
-
t[3]
|
|
1409
|
-
), u(
|
|
1410
|
-
J,
|
|
1411
|
-
"width",
|
|
1412
|
-
/*handleSize*/
|
|
1413
|
-
t[3]
|
|
1414
|
-
), u(Z, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), u(Z, "x", It = /*geom*/
|
|
1415
|
-
t[4].x - /*handleSize*/
|
|
1416
|
-
t[3] / 2), u(Z, "y", Rt = /*geom*/
|
|
1417
|
-
t[4].y + /*geom*/
|
|
1418
|
-
t[4].h - /*handleSize*/
|
|
1419
|
-
t[3] / 2), u(
|
|
1420
|
-
Z,
|
|
1421
|
-
"height",
|
|
1422
|
-
/*handleSize*/
|
|
1423
|
-
t[3]
|
|
1424
|
-
), u(
|
|
1425
|
-
Z,
|
|
1426
|
-
"width",
|
|
1427
|
-
/*handleSize*/
|
|
1428
|
-
t[3]
|
|
1429
|
-
);
|
|
1430
|
-
},
|
|
1431
|
-
m(B, T) {
|
|
1432
|
-
_(B, e, T), _(B, s, T), _(B, l, T), _(B, h, T), _(B, m, T), _(B, y, T), _(B, E, T), _(B, V, T), _(B, f, T), _(B, M, T), _(B, C, T), _(B, Tt, T), _(B, L, T), _(B, Q, T), _(B, P, T), _(B, Ht, T), _(B, J, T), _(B, Pt, T), _(B, Z, T), jt || (ce = [
|
|
1433
|
-
z(e, "pointerdown", function() {
|
|
1434
|
-
H(
|
|
1435
|
-
/*grab*/
|
|
1436
|
-
t[10](O.SHAPE)
|
|
1437
|
-
) && t[10](O.SHAPE).apply(this, arguments);
|
|
1438
|
-
}),
|
|
1439
|
-
z(l, "pointerdown", function() {
|
|
1440
|
-
H(
|
|
1441
|
-
/*grab*/
|
|
1442
|
-
t[10](O.SHAPE)
|
|
1443
|
-
) && t[10](O.SHAPE).apply(this, arguments);
|
|
1444
|
-
}),
|
|
1445
|
-
z(m, "pointerdown", function() {
|
|
1446
|
-
H(
|
|
1447
|
-
/*grab*/
|
|
1448
|
-
t[10](O.TOP)
|
|
1449
|
-
) && t[10](O.TOP).apply(this, arguments);
|
|
1450
|
-
}),
|
|
1451
|
-
z(E, "pointerdown", function() {
|
|
1452
|
-
H(
|
|
1453
|
-
/*grab*/
|
|
1454
|
-
t[10](O.RIGHT)
|
|
1455
|
-
) && t[10](O.RIGHT).apply(this, arguments);
|
|
1456
|
-
}),
|
|
1457
|
-
z(f, "pointerdown", function() {
|
|
1458
|
-
H(
|
|
1459
|
-
/*grab*/
|
|
1460
|
-
t[10](O.BOTTOM)
|
|
1461
|
-
) && t[10](O.BOTTOM).apply(this, arguments);
|
|
1462
|
-
}),
|
|
1463
|
-
z(C, "pointerdown", function() {
|
|
1464
|
-
H(
|
|
1465
|
-
/*grab*/
|
|
1466
|
-
t[10](O.LEFT)
|
|
1467
|
-
) && t[10](O.LEFT).apply(this, arguments);
|
|
1468
|
-
}),
|
|
1469
|
-
z(L, "pointerdown", function() {
|
|
1470
|
-
H(
|
|
1471
|
-
/*grab*/
|
|
1472
|
-
t[10](O.TOP_LEFT)
|
|
1473
|
-
) && t[10](O.TOP_LEFT).apply(this, arguments);
|
|
1474
|
-
}),
|
|
1475
|
-
z(P, "pointerdown", function() {
|
|
1476
|
-
H(
|
|
1477
|
-
/*grab*/
|
|
1478
|
-
t[10](O.TOP_RIGHT)
|
|
1479
|
-
) && t[10](O.TOP_RIGHT).apply(this, arguments);
|
|
1480
|
-
}),
|
|
1481
|
-
z(J, "pointerdown", function() {
|
|
1482
|
-
H(
|
|
1483
|
-
/*grab*/
|
|
1484
|
-
t[10](O.BOTTOM_RIGHT)
|
|
1485
|
-
) && t[10](O.BOTTOM_RIGHT).apply(this, arguments);
|
|
1486
|
-
}),
|
|
1487
|
-
z(Z, "pointerdown", function() {
|
|
1488
|
-
H(
|
|
1489
|
-
/*grab*/
|
|
1490
|
-
t[10](O.BOTTOM_LEFT)
|
|
1491
|
-
) && t[10](O.BOTTOM_LEFT).apply(this, arguments);
|
|
1492
|
-
})
|
|
1493
|
-
], jt = !0);
|
|
1494
|
-
},
|
|
1495
|
-
p(B, T) {
|
|
1496
|
-
t = B, T & /*computedStyle*/
|
|
1497
|
-
2 && n !== (n = /*computedStyle*/
|
|
1498
|
-
t[1] ? "display:none;" : void 0) && u(e, "style", n), T & /*geom*/
|
|
1499
|
-
16 && o !== (o = /*geom*/
|
|
1500
|
-
t[4].x) && u(e, "x", o), T & /*geom*/
|
|
1501
|
-
16 && r !== (r = /*geom*/
|
|
1502
|
-
t[4].y) && u(e, "y", r), T & /*geom*/
|
|
1503
|
-
16 && i !== (i = /*geom*/
|
|
1504
|
-
t[4].w) && u(e, "width", i), T & /*geom*/
|
|
1505
|
-
16 && a !== (a = /*geom*/
|
|
1506
|
-
t[4].h) && u(e, "height", a), T & /*computedStyle*/
|
|
1507
|
-
2 && u(
|
|
1508
|
-
l,
|
|
1509
|
-
"style",
|
|
1510
|
-
/*computedStyle*/
|
|
1511
|
-
t[1]
|
|
1512
|
-
), T & /*geom*/
|
|
1513
|
-
16 && d !== (d = /*geom*/
|
|
1514
|
-
t[4].x) && u(l, "x", d), T & /*geom*/
|
|
1515
|
-
16 && p !== (p = /*geom*/
|
|
1516
|
-
t[4].y) && u(l, "y", p), T & /*geom*/
|
|
1517
|
-
16 && c !== (c = /*geom*/
|
|
1518
|
-
t[4].w) && u(l, "width", c), T & /*geom*/
|
|
1519
|
-
16 && g !== (g = /*geom*/
|
|
1520
|
-
t[4].h) && u(l, "height", g), T & /*geom*/
|
|
1521
|
-
16 && x !== (x = /*geom*/
|
|
1522
|
-
t[4].x) && u(m, "x", x), T & /*geom*/
|
|
1523
|
-
16 && A !== (A = /*geom*/
|
|
1524
|
-
t[4].y) && u(m, "y", A), T & /*geom*/
|
|
1525
|
-
16 && $ !== ($ = /*geom*/
|
|
1526
|
-
t[4].w) && u(m, "width", $), T & /*geom*/
|
|
1527
|
-
16 && v !== (v = /*geom*/
|
|
1528
|
-
t[4].x + /*geom*/
|
|
1529
|
-
t[4].w) && u(E, "x", v), T & /*geom*/
|
|
1530
|
-
16 && X !== (X = /*geom*/
|
|
1531
|
-
t[4].y) && u(E, "y", X), T & /*geom*/
|
|
1532
|
-
16 && I !== (I = /*geom*/
|
|
1533
|
-
t[4].h) && u(E, "height", I), T & /*geom*/
|
|
1534
|
-
16 && b !== (b = /*geom*/
|
|
1535
|
-
t[4].x) && u(f, "x", b), T & /*geom*/
|
|
1536
|
-
16 && w !== (w = /*geom*/
|
|
1537
|
-
t[4].y + /*geom*/
|
|
1538
|
-
t[4].h) && u(f, "y", w), T & /*geom*/
|
|
1539
|
-
16 && S !== (S = /*geom*/
|
|
1540
|
-
t[4].w) && u(f, "width", S), T & /*geom*/
|
|
1541
|
-
16 && K !== (K = /*geom*/
|
|
1542
|
-
t[4].x) && u(C, "x", K), T & /*geom*/
|
|
1543
|
-
16 && gt !== (gt = /*geom*/
|
|
1544
|
-
t[4].y) && u(C, "y", gt), T & /*geom*/
|
|
1545
|
-
16 && ft !== (ft = /*geom*/
|
|
1546
|
-
t[4].h) && u(C, "height", ft), T & /*geom, handleSize*/
|
|
1547
|
-
24 && q !== (q = /*geom*/
|
|
1548
|
-
t[4].x - /*handleSize*/
|
|
1549
|
-
t[3] / 2) && u(L, "x", q), T & /*geom, handleSize*/
|
|
1550
|
-
24 && F !== (F = /*geom*/
|
|
1551
|
-
t[4].y - /*handleSize*/
|
|
1552
|
-
t[3] / 2) && u(L, "y", F), T & /*handleSize*/
|
|
1553
|
-
8 && u(
|
|
1554
|
-
L,
|
|
1555
|
-
"height",
|
|
1556
|
-
/*handleSize*/
|
|
1557
|
-
t[3]
|
|
1558
|
-
), T & /*handleSize*/
|
|
1559
|
-
8 && u(
|
|
1560
|
-
L,
|
|
1561
|
-
"width",
|
|
1562
|
-
/*handleSize*/
|
|
1563
|
-
t[3]
|
|
1564
|
-
), T & /*geom, handleSize*/
|
|
1565
|
-
24 && st !== (st = /*geom*/
|
|
1566
|
-
t[4].x + /*geom*/
|
|
1567
|
-
t[4].w - /*handleSize*/
|
|
1568
|
-
t[3] / 2) && u(P, "x", st), T & /*geom, handleSize*/
|
|
1569
|
-
24 && Bt !== (Bt = /*geom*/
|
|
1570
|
-
t[4].y - /*handleSize*/
|
|
1571
|
-
t[3] / 2) && u(P, "y", Bt), T & /*handleSize*/
|
|
1572
|
-
8 && u(
|
|
1573
|
-
P,
|
|
1574
|
-
"height",
|
|
1575
|
-
/*handleSize*/
|
|
1576
|
-
t[3]
|
|
1577
|
-
), T & /*handleSize*/
|
|
1578
|
-
8 && u(
|
|
1579
|
-
P,
|
|
1580
|
-
"width",
|
|
1581
|
-
/*handleSize*/
|
|
1582
|
-
t[3]
|
|
1583
|
-
), T & /*geom, handleSize*/
|
|
1584
|
-
24 && Xt !== (Xt = /*geom*/
|
|
1585
|
-
t[4].x + /*geom*/
|
|
1586
|
-
t[4].w - /*handleSize*/
|
|
1587
|
-
t[3] / 2) && u(J, "x", Xt), T & /*geom, handleSize*/
|
|
1588
|
-
24 && Ct !== (Ct = /*geom*/
|
|
1589
|
-
t[4].y + /*geom*/
|
|
1590
|
-
t[4].h - /*handleSize*/
|
|
1591
|
-
t[3] / 2) && u(J, "y", Ct), T & /*handleSize*/
|
|
1592
|
-
8 && u(
|
|
1593
|
-
J,
|
|
1594
|
-
"height",
|
|
1595
|
-
/*handleSize*/
|
|
1596
|
-
t[3]
|
|
1597
|
-
), T & /*handleSize*/
|
|
1598
|
-
8 && u(
|
|
1599
|
-
J,
|
|
1600
|
-
"width",
|
|
1601
|
-
/*handleSize*/
|
|
1602
|
-
t[3]
|
|
1603
|
-
), T & /*geom, handleSize*/
|
|
1604
|
-
24 && It !== (It = /*geom*/
|
|
1605
|
-
t[4].x - /*handleSize*/
|
|
1606
|
-
t[3] / 2) && u(Z, "x", It), T & /*geom, handleSize*/
|
|
1607
|
-
24 && Rt !== (Rt = /*geom*/
|
|
1608
|
-
t[4].y + /*geom*/
|
|
1609
|
-
t[4].h - /*handleSize*/
|
|
1610
|
-
t[3] / 2) && u(Z, "y", Rt), T & /*handleSize*/
|
|
1611
|
-
8 && u(
|
|
1612
|
-
Z,
|
|
1613
|
-
"height",
|
|
1614
|
-
/*handleSize*/
|
|
1615
|
-
t[3]
|
|
1616
|
-
), T & /*handleSize*/
|
|
1617
|
-
8 && u(
|
|
1618
|
-
Z,
|
|
1619
|
-
"width",
|
|
1620
|
-
/*handleSize*/
|
|
1621
|
-
t[3]
|
|
1622
|
-
);
|
|
1623
|
-
},
|
|
1624
|
-
d(B) {
|
|
1625
|
-
B && Y(e), B && Y(s), B && Y(l), B && Y(h), B && Y(m), B && Y(y), B && Y(E), B && Y(V), B && Y(f), B && Y(M), B && Y(C), B && Y(Tt), B && Y(L), B && Y(Q), B && Y(P), B && Y(Ht), B && Y(J), B && Y(Pt), B && Y(Z), jt = !1, it(ce);
|
|
1626
|
-
}
|
|
1627
|
-
};
|
|
1628
|
-
}
|
|
1629
|
-
function ho(t) {
|
|
1630
|
-
let e, n;
|
|
1631
|
-
return e = new Ke({
|
|
1632
|
-
props: {
|
|
1633
|
-
shape: (
|
|
1634
|
-
/*shape*/
|
|
1635
|
-
t[0]
|
|
1636
|
-
),
|
|
1637
|
-
transform: (
|
|
1638
|
-
/*transform*/
|
|
1639
|
-
t[2]
|
|
1640
|
-
),
|
|
1641
|
-
editor: (
|
|
1642
|
-
/*editor*/
|
|
1643
|
-
t[5]
|
|
1644
|
-
),
|
|
1645
|
-
$$slots: {
|
|
1646
|
-
default: [
|
|
1647
|
-
uo,
|
|
1648
|
-
({ grab: o }) => ({ 10: o }),
|
|
1649
|
-
({ grab: o }) => o ? 1024 : 0
|
|
1650
|
-
]
|
|
1651
|
-
},
|
|
1652
|
-
$$scope: { ctx: t }
|
|
1653
|
-
}
|
|
1654
|
-
}), e.$on(
|
|
1655
|
-
"grab",
|
|
1656
|
-
/*grab_handler*/
|
|
1657
|
-
t[7]
|
|
1658
|
-
), e.$on(
|
|
1659
|
-
"change",
|
|
1660
|
-
/*change_handler*/
|
|
1661
|
-
t[8]
|
|
1662
|
-
), e.$on(
|
|
1663
|
-
"release",
|
|
1664
|
-
/*release_handler*/
|
|
1665
|
-
t[9]
|
|
1666
|
-
), {
|
|
1667
|
-
c() {
|
|
1668
|
-
pt(e.$$.fragment);
|
|
1669
|
-
},
|
|
1670
|
-
m(o, r) {
|
|
1671
|
-
dt(e, o, r), n = !0;
|
|
1672
|
-
},
|
|
1673
|
-
p(o, [r]) {
|
|
1674
|
-
const i = {};
|
|
1675
|
-
r & /*shape*/
|
|
1676
|
-
1 && (i.shape = /*shape*/
|
|
1677
|
-
o[0]), r & /*transform*/
|
|
1678
|
-
4 && (i.transform = /*transform*/
|
|
1679
|
-
o[2]), r & /*$$scope, geom, handleSize, grab, computedStyle*/
|
|
1680
|
-
3098 && (i.$$scope = { dirty: r, ctx: o }), e.$set(i);
|
|
1681
|
-
},
|
|
1682
|
-
i(o) {
|
|
1683
|
-
n || (N(e.$$.fragment, o), n = !0);
|
|
1684
|
-
},
|
|
1685
|
-
o(o) {
|
|
1686
|
-
k(e.$$.fragment, o), n = !1;
|
|
1687
|
-
},
|
|
1688
|
-
d(o) {
|
|
1689
|
-
ct(e, o);
|
|
1690
|
-
}
|
|
1691
|
-
};
|
|
1692
|
-
}
|
|
1693
|
-
function po(t, e, n) {
|
|
1694
|
-
let o, r, { shape: i } = e, { computedStyle: a = void 0 } = e, { transform: s } = e, { viewportScale: l = 1 } = e;
|
|
1695
|
-
const d = (h, m, x) => {
|
|
1696
|
-
const A = h.geometry.bounds;
|
|
1697
|
-
let [$, y] = [A.minX, A.minY], [E, v] = [A.maxX, A.maxY];
|
|
1698
|
-
const [X, I] = x;
|
|
1699
|
-
if (m === O.SHAPE)
|
|
1700
|
-
$ += X, E += X, y += I, v += I;
|
|
1701
|
-
else {
|
|
1702
|
-
switch (m) {
|
|
1703
|
-
case O.TOP:
|
|
1704
|
-
case O.TOP_LEFT:
|
|
1705
|
-
case O.TOP_RIGHT: {
|
|
1706
|
-
y += I;
|
|
1707
|
-
break;
|
|
1708
|
-
}
|
|
1709
|
-
case O.BOTTOM:
|
|
1710
|
-
case O.BOTTOM_LEFT:
|
|
1711
|
-
case O.BOTTOM_RIGHT: {
|
|
1712
|
-
v += I;
|
|
1713
|
-
break;
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
switch (m) {
|
|
1717
|
-
case O.LEFT:
|
|
1718
|
-
case O.TOP_LEFT:
|
|
1719
|
-
case O.BOTTOM_LEFT: {
|
|
1720
|
-
$ += X;
|
|
1721
|
-
break;
|
|
1722
|
-
}
|
|
1723
|
-
case O.RIGHT:
|
|
1724
|
-
case O.TOP_RIGHT:
|
|
1725
|
-
case O.BOTTOM_RIGHT: {
|
|
1726
|
-
E += X;
|
|
1727
|
-
break;
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
const V = Math.min($, E), f = Math.min(y, v), b = Math.abs(E - $), w = Math.abs(v - y);
|
|
1732
|
-
return {
|
|
1733
|
-
...h,
|
|
1734
|
-
geometry: {
|
|
1735
|
-
x: V,
|
|
1736
|
-
y: f,
|
|
1737
|
-
w: b,
|
|
1738
|
-
h: w,
|
|
1739
|
-
bounds: {
|
|
1740
|
-
minX: V,
|
|
1741
|
-
minY: f,
|
|
1742
|
-
maxX: V + b,
|
|
1743
|
-
maxY: f + w
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
};
|
|
1748
|
-
function p(h) {
|
|
1749
|
-
Et.call(this, t, h);
|
|
1750
|
-
}
|
|
1751
|
-
function c(h) {
|
|
1752
|
-
Et.call(this, t, h);
|
|
1753
|
-
}
|
|
1754
|
-
function g(h) {
|
|
1755
|
-
Et.call(this, t, h);
|
|
1756
|
-
}
|
|
1757
|
-
return t.$$set = (h) => {
|
|
1758
|
-
"shape" in h && n(0, i = h.shape), "computedStyle" in h && n(1, a = h.computedStyle), "transform" in h && n(2, s = h.transform), "viewportScale" in h && n(6, l = h.viewportScale);
|
|
1759
|
-
}, t.$$.update = () => {
|
|
1760
|
-
t.$$.dirty & /*shape*/
|
|
1761
|
-
1 && n(4, o = i.geometry), t.$$.dirty & /*viewportScale*/
|
|
1762
|
-
64 && n(3, r = 10 / l);
|
|
1763
|
-
}, [
|
|
1764
|
-
i,
|
|
1765
|
-
a,
|
|
1766
|
-
s,
|
|
1767
|
-
r,
|
|
1768
|
-
o,
|
|
1769
|
-
d,
|
|
1770
|
-
l,
|
|
1771
|
-
p,
|
|
1772
|
-
c,
|
|
1773
|
-
g
|
|
1774
|
-
];
|
|
1775
|
-
}
|
|
1776
|
-
class go extends nt {
|
|
1777
|
-
constructor(e) {
|
|
1778
|
-
super(), et(this, e, po, ho, W, {
|
|
1779
|
-
shape: 0,
|
|
1780
|
-
computedStyle: 1,
|
|
1781
|
-
transform: 2,
|
|
1782
|
-
viewportScale: 6
|
|
1783
|
-
});
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
const We = /* @__PURE__ */ new Map([
|
|
1787
|
-
[G.RECTANGLE, go],
|
|
1788
|
-
[G.POLYGON, co]
|
|
1789
|
-
]), Ee = (t) => We.get(t.type), fo = (t, e) => We.set(t, e), O = (t) => `HANDLE-${t}`;
|
|
1790
|
-
O.SHAPE = "SHAPE";
|
|
1791
|
-
O.TOP = "TOP";
|
|
1792
|
-
O.RIGHT = "RIGHT";
|
|
1793
|
-
O.BOTTOM = "BOTTOM";
|
|
1794
|
-
O.LEFT = "LEFT";
|
|
1795
|
-
O.TOP_LEFT = "TOP_LEFT";
|
|
1796
|
-
O.TOP_RIGHT = "TOP_RIGHT";
|
|
1797
|
-
O.BOTTOM_RIGHT = "BOTTOM_RIGHT";
|
|
1798
|
-
O.BOTTOM_LEFT = "BOTTOM_LEFT";
|
|
1799
|
-
const mo = (t) => ({}), ve = (t) => ({ grab: (
|
|
1800
|
-
/*onGrab*/
|
|
1801
|
-
t[0]
|
|
1802
|
-
) });
|
|
1803
|
-
function yo(t) {
|
|
1804
|
-
let e, n, o, r;
|
|
1805
|
-
const i = (
|
|
1806
|
-
/*#slots*/
|
|
1807
|
-
t[7].default
|
|
1808
|
-
), a = en(
|
|
1809
|
-
i,
|
|
1810
|
-
t,
|
|
1811
|
-
/*$$scope*/
|
|
1812
|
-
t[6],
|
|
1813
|
-
ve
|
|
1814
|
-
);
|
|
1815
|
-
return {
|
|
1816
|
-
c() {
|
|
1817
|
-
e = R("g"), a && a.c(), u(e, "class", "a9s-annotation selected");
|
|
1818
|
-
},
|
|
1819
|
-
m(s, l) {
|
|
1820
|
-
_(s, e, l), a && a.m(e, null), n = !0, o || (r = [
|
|
1821
|
-
z(
|
|
1822
|
-
e,
|
|
1823
|
-
"pointerup",
|
|
1824
|
-
/*onRelease*/
|
|
1825
|
-
t[2]
|
|
1826
|
-
),
|
|
1827
|
-
z(
|
|
1828
|
-
e,
|
|
1829
|
-
"pointermove",
|
|
1830
|
-
/*onPointerMove*/
|
|
1831
|
-
t[1]
|
|
1832
|
-
)
|
|
1833
|
-
], o = !0);
|
|
1834
|
-
},
|
|
1835
|
-
p(s, [l]) {
|
|
1836
|
-
a && a.p && (!n || l & /*$$scope*/
|
|
1837
|
-
64) && on(
|
|
1838
|
-
a,
|
|
1839
|
-
i,
|
|
1840
|
-
s,
|
|
1841
|
-
/*$$scope*/
|
|
1842
|
-
s[6],
|
|
1843
|
-
n ? nn(
|
|
1844
|
-
i,
|
|
1845
|
-
/*$$scope*/
|
|
1846
|
-
s[6],
|
|
1847
|
-
l,
|
|
1848
|
-
mo
|
|
1849
|
-
) : rn(
|
|
1850
|
-
/*$$scope*/
|
|
1851
|
-
s[6]
|
|
1852
|
-
),
|
|
1853
|
-
ve
|
|
1854
|
-
);
|
|
1855
|
-
},
|
|
1856
|
-
i(s) {
|
|
1857
|
-
n || (N(a, s), n = !0);
|
|
1858
|
-
},
|
|
1859
|
-
o(s) {
|
|
1860
|
-
k(a, s), n = !1;
|
|
1861
|
-
},
|
|
1862
|
-
d(s) {
|
|
1863
|
-
s && Y(e), a && a.d(s), o = !1, it(r);
|
|
1864
|
-
}
|
|
1865
|
-
};
|
|
1866
|
-
}
|
|
1867
|
-
function wo(t, e, n) {
|
|
1868
|
-
let { $$slots: o = {}, $$scope: r } = e;
|
|
1869
|
-
const i = At();
|
|
1870
|
-
let { shape: a } = e, { editor: s } = e, { transform: l } = e, d = null, p, c = null;
|
|
1871
|
-
const g = (x) => (A) => {
|
|
1872
|
-
d = x, p = l.elementToImage(A.offsetX, A.offsetY), c = a, A.target.setPointerCapture(A.pointerId), i("grab");
|
|
1873
|
-
}, h = (x) => {
|
|
1874
|
-
if (d) {
|
|
1875
|
-
const [A, $] = l.elementToImage(x.offsetX, x.offsetY), y = [A - p[0], $ - p[1]];
|
|
1876
|
-
n(3, a = s(c, d, y)), i("change", a);
|
|
1877
|
-
}
|
|
1878
|
-
}, m = (x) => {
|
|
1879
|
-
x.target.releasePointerCapture(x.pointerId), d = null, c = a, i("release");
|
|
1880
|
-
};
|
|
1881
|
-
return t.$$set = (x) => {
|
|
1882
|
-
"shape" in x && n(3, a = x.shape), "editor" in x && n(4, s = x.editor), "transform" in x && n(5, l = x.transform), "$$scope" in x && n(6, r = x.$$scope);
|
|
1883
|
-
}, [g, h, m, a, s, l, r, o];
|
|
1884
|
-
}
|
|
1885
|
-
class Ke extends nt {
|
|
1886
|
-
constructor(e) {
|
|
1887
|
-
super(), et(this, e, wo, yo, W, { shape: 3, editor: 4, transform: 5 });
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
const Ft = (t, e) => {
|
|
1891
|
-
const n = typeof e == "function" ? e(t) : e;
|
|
1892
|
-
if (n) {
|
|
1893
|
-
const { fill: o, fillOpacity: r } = n;
|
|
1894
|
-
let i = "";
|
|
1895
|
-
return o && (i += `fill:${o};stroke:${o};`), i += `fill-opacity:${r || "0.25"};`, i;
|
|
1896
|
-
}
|
|
1897
|
-
};
|
|
1898
|
-
function $o(t, e, n) {
|
|
1899
|
-
let o;
|
|
1900
|
-
const r = At();
|
|
1901
|
-
let { annotation: i } = e, { editor: a } = e, { style: s = void 0 } = e, { target: l } = e, { transform: d } = e, { viewportScale: p } = e, c;
|
|
1902
|
-
return Mt(() => (n(6, c = new a({
|
|
1903
|
-
target: l,
|
|
1904
|
-
props: {
|
|
1905
|
-
shape: i.target.selector,
|
|
1906
|
-
computedStyle: o,
|
|
1907
|
-
transform: d,
|
|
1908
|
-
viewportScale: p
|
|
1909
|
-
}
|
|
1910
|
-
})), c.$on("change", (g) => {
|
|
1911
|
-
c.$$set({ shape: g.detail }), r("change", g.detail);
|
|
1912
|
-
}), c.$on("grab", (g) => r("grab", g.detail)), c.$on("release", (g) => r("release", g.detail)), () => {
|
|
1913
|
-
c.$destroy();
|
|
1914
|
-
})), t.$$set = (g) => {
|
|
1915
|
-
"annotation" in g && n(0, i = g.annotation), "editor" in g && n(1, a = g.editor), "style" in g && n(2, s = g.style), "target" in g && n(3, l = g.target), "transform" in g && n(4, d = g.transform), "viewportScale" in g && n(5, p = g.viewportScale);
|
|
1916
|
-
}, t.$$.update = () => {
|
|
1917
|
-
t.$$.dirty & /*annotation, style*/
|
|
1918
|
-
5 && (o = Ft(i, s)), t.$$.dirty & /*annotation, editorComponent*/
|
|
1919
|
-
65 && i && (c == null || c.$set({ shape: i.target.selector })), t.$$.dirty & /*editorComponent, transform*/
|
|
1920
|
-
80 && c && c.$set({ transform: d }), t.$$.dirty & /*editorComponent, viewportScale*/
|
|
1921
|
-
96 && c && c.$set({ viewportScale: p });
|
|
1922
|
-
}, [i, a, s, l, d, p, c];
|
|
1923
|
-
}
|
|
1924
|
-
class xo extends nt {
|
|
1925
|
-
constructor(e) {
|
|
1926
|
-
super(), et(this, e, $o, null, W, {
|
|
1927
|
-
annotation: 0,
|
|
1928
|
-
editor: 1,
|
|
1929
|
-
style: 2,
|
|
1930
|
-
target: 3,
|
|
1931
|
-
transform: 4,
|
|
1932
|
-
viewportScale: 5
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
function bo(t, e, n) {
|
|
1937
|
-
const o = At();
|
|
1938
|
-
let { drawingMode: r } = e, { target: i } = e, { tool: a } = e, { transform: s } = e, { viewportScale: l } = e, d;
|
|
1939
|
-
return Mt(() => {
|
|
1940
|
-
const p = i.closest("svg"), c = [], g = (h, m, x) => {
|
|
1941
|
-
p.addEventListener(h, m, x), c.push(() => p.removeEventListener(h, m, x));
|
|
1942
|
-
};
|
|
1943
|
-
return n(5, d = new a({
|
|
1944
|
-
target: i,
|
|
1945
|
-
props: {
|
|
1946
|
-
addEventListener: g,
|
|
1947
|
-
drawingMode: r,
|
|
1948
|
-
transform: s,
|
|
1949
|
-
viewportScale: l
|
|
1950
|
-
}
|
|
1951
|
-
})), d.$on("create", (h) => o("create", h.detail)), () => {
|
|
1952
|
-
c.forEach((h) => h()), d.$destroy();
|
|
1953
|
-
};
|
|
1954
|
-
}), t.$$set = (p) => {
|
|
1955
|
-
"drawingMode" in p && n(0, r = p.drawingMode), "target" in p && n(1, i = p.target), "tool" in p && n(2, a = p.tool), "transform" in p && n(3, s = p.transform), "viewportScale" in p && n(4, l = p.viewportScale);
|
|
1956
|
-
}, t.$$.update = () => {
|
|
1957
|
-
t.$$.dirty & /*toolComponent, transform*/
|
|
1958
|
-
40 && d && d.$set({ transform: s }), t.$$.dirty & /*toolComponent, viewportScale*/
|
|
1959
|
-
48 && d && d.$set({ viewportScale: l });
|
|
1960
|
-
}, [r, i, a, s, l, d];
|
|
1961
|
-
}
|
|
1962
|
-
class Eo extends nt {
|
|
1963
|
-
constructor(e) {
|
|
1964
|
-
super(), et(this, e, bo, null, W, {
|
|
1965
|
-
drawingMode: 0,
|
|
1966
|
-
target: 1,
|
|
1967
|
-
tool: 2,
|
|
1968
|
-
transform: 3,
|
|
1969
|
-
viewportScale: 4
|
|
1970
|
-
});
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
function Ae(t) {
|
|
1974
|
-
let e, n;
|
|
1975
|
-
return {
|
|
1976
|
-
c() {
|
|
1977
|
-
e = R("rect"), n = R("rect"), u(e, "class", "a9s-outer"), u(
|
|
1978
|
-
e,
|
|
1979
|
-
"x",
|
|
1980
|
-
/*x*/
|
|
1981
|
-
t[1]
|
|
1982
|
-
), u(
|
|
1983
|
-
e,
|
|
1984
|
-
"y",
|
|
1985
|
-
/*y*/
|
|
1986
|
-
t[2]
|
|
1987
|
-
), u(
|
|
1988
|
-
e,
|
|
1989
|
-
"width",
|
|
1990
|
-
/*w*/
|
|
1991
|
-
t[3]
|
|
1992
|
-
), u(
|
|
1993
|
-
e,
|
|
1994
|
-
"height",
|
|
1995
|
-
/*h*/
|
|
1996
|
-
t[4]
|
|
1997
|
-
), u(n, "class", "a9s-inner"), u(
|
|
1998
|
-
n,
|
|
1999
|
-
"x",
|
|
2000
|
-
/*x*/
|
|
2001
|
-
t[1]
|
|
2002
|
-
), u(
|
|
2003
|
-
n,
|
|
2004
|
-
"y",
|
|
2005
|
-
/*y*/
|
|
2006
|
-
t[2]
|
|
2007
|
-
), u(
|
|
2008
|
-
n,
|
|
2009
|
-
"width",
|
|
2010
|
-
/*w*/
|
|
2011
|
-
t[3]
|
|
2012
|
-
), u(
|
|
2013
|
-
n,
|
|
2014
|
-
"height",
|
|
2015
|
-
/*h*/
|
|
2016
|
-
t[4]
|
|
2017
|
-
);
|
|
2018
|
-
},
|
|
2019
|
-
m(o, r) {
|
|
2020
|
-
_(o, e, r), _(o, n, r);
|
|
2021
|
-
},
|
|
2022
|
-
p(o, r) {
|
|
2023
|
-
r & /*x*/
|
|
2024
|
-
2 && u(
|
|
2025
|
-
e,
|
|
2026
|
-
"x",
|
|
2027
|
-
/*x*/
|
|
2028
|
-
o[1]
|
|
2029
|
-
), r & /*y*/
|
|
2030
|
-
4 && u(
|
|
2031
|
-
e,
|
|
2032
|
-
"y",
|
|
2033
|
-
/*y*/
|
|
2034
|
-
o[2]
|
|
2035
|
-
), r & /*w*/
|
|
2036
|
-
8 && u(
|
|
2037
|
-
e,
|
|
2038
|
-
"width",
|
|
2039
|
-
/*w*/
|
|
2040
|
-
o[3]
|
|
2041
|
-
), r & /*h*/
|
|
2042
|
-
16 && u(
|
|
2043
|
-
e,
|
|
2044
|
-
"height",
|
|
2045
|
-
/*h*/
|
|
2046
|
-
o[4]
|
|
2047
|
-
), r & /*x*/
|
|
2048
|
-
2 && u(
|
|
2049
|
-
n,
|
|
2050
|
-
"x",
|
|
2051
|
-
/*x*/
|
|
2052
|
-
o[1]
|
|
2053
|
-
), r & /*y*/
|
|
2054
|
-
4 && u(
|
|
2055
|
-
n,
|
|
2056
|
-
"y",
|
|
2057
|
-
/*y*/
|
|
2058
|
-
o[2]
|
|
2059
|
-
), r & /*w*/
|
|
2060
|
-
8 && u(
|
|
2061
|
-
n,
|
|
2062
|
-
"width",
|
|
2063
|
-
/*w*/
|
|
2064
|
-
o[3]
|
|
2065
|
-
), r & /*h*/
|
|
2066
|
-
16 && u(
|
|
2067
|
-
n,
|
|
2068
|
-
"height",
|
|
2069
|
-
/*h*/
|
|
2070
|
-
o[4]
|
|
2071
|
-
);
|
|
2072
|
-
},
|
|
2073
|
-
d(o) {
|
|
2074
|
-
o && Y(e), o && Y(n);
|
|
2075
|
-
}
|
|
2076
|
-
};
|
|
2077
|
-
}
|
|
2078
|
-
function vo(t) {
|
|
2079
|
-
let e, n = (
|
|
2080
|
-
/*origin*/
|
|
2081
|
-
t[0] && Ae(t)
|
|
2082
|
-
);
|
|
2083
|
-
return {
|
|
2084
|
-
c() {
|
|
2085
|
-
e = R("g"), n && n.c(), u(e, "class", "a9s-annotation a9s-rubberband");
|
|
2086
|
-
},
|
|
2087
|
-
m(o, r) {
|
|
2088
|
-
_(o, e, r), n && n.m(e, null);
|
|
2089
|
-
},
|
|
2090
|
-
p(o, [r]) {
|
|
2091
|
-
o[0] ? n ? n.p(o, r) : (n = Ae(o), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
|
|
2092
|
-
},
|
|
2093
|
-
i: U,
|
|
2094
|
-
o: U,
|
|
2095
|
-
d(o) {
|
|
2096
|
-
o && Y(e), n && n.d();
|
|
2097
|
-
}
|
|
2098
|
-
};
|
|
2099
|
-
}
|
|
2100
|
-
function Ao(t, e, n) {
|
|
2101
|
-
const o = At();
|
|
2102
|
-
let { addEventListener: r } = e, { drawingMode: i } = e, { transform: a } = e, s, l, d, p, c, g, h;
|
|
2103
|
-
const m = (y) => {
|
|
2104
|
-
s = performance.now(), i === "drag" && (n(0, l = a.elementToImage(y.offsetX, y.offsetY)), d = l, n(1, p = l[0]), n(2, c = l[1]), n(3, g = 1), n(4, h = 1));
|
|
2105
|
-
}, x = (y) => {
|
|
2106
|
-
l && (d = a.elementToImage(y.offsetX, y.offsetY), n(1, p = Math.min(d[0], l[0])), n(2, c = Math.min(d[1], l[1])), n(3, g = Math.abs(d[0] - l[0])), n(4, h = Math.abs(d[1] - l[1])));
|
|
2107
|
-
}, A = (y) => {
|
|
2108
|
-
const E = performance.now() - s;
|
|
2109
|
-
if (i === "click") {
|
|
2110
|
-
if (E > 300)
|
|
2111
|
-
return;
|
|
2112
|
-
y.stopPropagation(), l ? $() : (n(0, l = a.elementToImage(y.offsetX, y.offsetY)), d = l, n(1, p = l[0]), n(2, c = l[1]), n(3, g = 1), n(4, h = 1));
|
|
2113
|
-
} else
|
|
2114
|
-
l && (E > 300 || g * h > 100 ? (y.stopPropagation(), $()) : (n(0, l = null), d = null));
|
|
2115
|
-
}, $ = () => {
|
|
2116
|
-
if (g * h > 15) {
|
|
2117
|
-
const y = {
|
|
2118
|
-
type: G.RECTANGLE,
|
|
2119
|
-
geometry: {
|
|
2120
|
-
bounds: {
|
|
2121
|
-
minX: p,
|
|
2122
|
-
minY: c,
|
|
2123
|
-
maxX: p + g,
|
|
2124
|
-
maxY: c + h
|
|
2125
|
-
},
|
|
2126
|
-
x: p,
|
|
2127
|
-
y: c,
|
|
2128
|
-
w: g,
|
|
2129
|
-
h
|
|
2130
|
-
}
|
|
2131
|
-
};
|
|
2132
|
-
o("create", y);
|
|
2133
|
-
}
|
|
2134
|
-
n(0, l = null), d = null;
|
|
2135
|
-
};
|
|
2136
|
-
return Mt(() => {
|
|
2137
|
-
r("pointerdown", m), r("pointermove", x), r("pointerup", A, !0);
|
|
2138
|
-
}), t.$$set = (y) => {
|
|
2139
|
-
"addEventListener" in y && n(5, r = y.addEventListener), "drawingMode" in y && n(6, i = y.drawingMode), "transform" in y && n(7, a = y.transform);
|
|
2140
|
-
}, [l, p, c, g, h, r, i, a];
|
|
2141
|
-
}
|
|
2142
|
-
class To extends nt {
|
|
2143
|
-
constructor(e) {
|
|
2144
|
-
super(), et(this, e, Ao, vo, W, {
|
|
2145
|
-
addEventListener: 5,
|
|
2146
|
-
drawingMode: 6,
|
|
2147
|
-
transform: 7
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
const Kt = (t, e) => {
|
|
2152
|
-
const n = Math.abs(e[0] - t[0]), o = Math.abs(e[1] - t[1]);
|
|
2153
|
-
return Math.sqrt(Math.pow(n, 2) + Math.pow(o, 2));
|
|
2154
|
-
}, wt = [];
|
|
2155
|
-
function So(t, e = U) {
|
|
2156
|
-
let n;
|
|
2157
|
-
const o = /* @__PURE__ */ new Set();
|
|
2158
|
-
function r(s) {
|
|
2159
|
-
if (W(t, s) && (t = s, n)) {
|
|
2160
|
-
const l = !wt.length;
|
|
2161
|
-
for (const d of o)
|
|
2162
|
-
d[1](), wt.push(d, t);
|
|
2163
|
-
if (l) {
|
|
2164
|
-
for (let d = 0; d < wt.length; d += 2)
|
|
2165
|
-
wt[d][0](wt[d + 1]);
|
|
2166
|
-
wt.length = 0;
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
|
-
function i(s) {
|
|
2171
|
-
r(s(t));
|
|
2172
|
-
}
|
|
2173
|
-
function a(s, l = U) {
|
|
2174
|
-
const d = [s, l];
|
|
2175
|
-
return o.add(d), o.size === 1 && (n = e(r) || U), s(t), () => {
|
|
2176
|
-
o.delete(d), o.size === 0 && n && (n(), n = null);
|
|
2177
|
-
};
|
|
2178
|
-
}
|
|
2179
|
-
return { set: r, update: i, subscribe: a };
|
|
2180
|
-
}
|
|
2181
|
-
const Oo = (t, e) => {
|
|
2182
|
-
const { naturalWidth: n, naturalHeight: o } = t;
|
|
2183
|
-
if (!n && !o) {
|
|
2184
|
-
const { width: r, height: i } = t;
|
|
2185
|
-
e.setAttribute("viewBox", `0 0 ${r} ${i}`), t.addEventListener("load", (a) => {
|
|
2186
|
-
const s = a.target;
|
|
2187
|
-
e.setAttribute("viewBox", `0 0 ${s.naturalWidth} ${s.naturalHeight}`);
|
|
2188
|
-
});
|
|
2189
|
-
} else
|
|
2190
|
-
e.setAttribute("viewBox", `0 0 ${n} ${o}`);
|
|
2191
|
-
}, Lo = (t, e) => {
|
|
2192
|
-
Oo(t, e);
|
|
2193
|
-
const { subscribe: n, set: o } = So(1);
|
|
2194
|
-
let r;
|
|
2195
|
-
return window.ResizeObserver && (r = new ResizeObserver(() => {
|
|
2196
|
-
const i = e.getBoundingClientRect(), { width: a, height: s } = e.viewBox.baseVal, l = Math.max(
|
|
2197
|
-
i.width / a,
|
|
2198
|
-
i.height / s
|
|
2199
|
-
);
|
|
2200
|
-
o(l);
|
|
2201
|
-
}), r.observe(e.parentElement)), { destroy: () => {
|
|
2202
|
-
r && r.disconnect();
|
|
2203
|
-
}, subscribe: n };
|
|
2204
|
-
};
|
|
2205
|
-
function Jt(t) {
|
|
2206
|
-
const e = t.slice(), n = (
|
|
2207
|
-
/*isClosable*/
|
|
2208
|
-
(e[2] ? (
|
|
2209
|
-
/*points*/
|
|
2210
|
-
e[0]
|
|
2211
|
-
) : [
|
|
2212
|
-
.../*points*/
|
|
2213
|
-
e[0],
|
|
2214
|
-
/*cursor*/
|
|
2215
|
-
e[1]
|
|
2216
|
-
]).map((o) => o.join(",")).join(" ")
|
|
2217
|
-
);
|
|
2218
|
-
return e[15] = n, e;
|
|
2219
|
-
}
|
|
2220
|
-
function Te(t) {
|
|
2221
|
-
let e, n, o, r, i, a = (
|
|
2222
|
-
/*isClosable*/
|
|
2223
|
-
t[2] && Se(t)
|
|
2224
|
-
);
|
|
2225
|
-
return {
|
|
2226
|
-
c() {
|
|
2227
|
-
e = R("polygon"), o = R("polygon"), a && a.c(), i = at(), u(e, "class", "a9s-outer"), u(e, "points", n = /*coords*/
|
|
2228
|
-
t[15]), u(o, "class", "a9s-inner"), u(o, "points", r = /*coords*/
|
|
2229
|
-
t[15]);
|
|
2230
|
-
},
|
|
2231
|
-
m(s, l) {
|
|
2232
|
-
_(s, e, l), _(s, o, l), a && a.m(s, l), _(s, i, l);
|
|
2233
|
-
},
|
|
2234
|
-
p(s, l) {
|
|
2235
|
-
l & /*isClosable, points, cursor*/
|
|
2236
|
-
7 && n !== (n = /*coords*/
|
|
2237
|
-
s[15]) && u(e, "points", n), l & /*isClosable, points, cursor*/
|
|
2238
|
-
7 && r !== (r = /*coords*/
|
|
2239
|
-
s[15]) && u(o, "points", r), /*isClosable*/
|
|
2240
|
-
s[2] ? a ? a.p(s, l) : (a = Se(s), a.c(), a.m(i.parentNode, i)) : a && (a.d(1), a = null);
|
|
2241
|
-
},
|
|
2242
|
-
d(s) {
|
|
2243
|
-
s && Y(e), s && Y(o), a && a.d(s), s && Y(i);
|
|
2244
|
-
}
|
|
2245
|
-
};
|
|
2246
|
-
}
|
|
2247
|
-
function Se(t) {
|
|
2248
|
-
let e, n, o;
|
|
2249
|
-
return {
|
|
2250
|
-
c() {
|
|
2251
|
-
e = R("rect"), u(e, "class", "a9s-corner-handle"), u(e, "x", n = /*points*/
|
|
2252
|
-
t[0][0][0] - /*handleSize*/
|
|
2253
|
-
t[3] / 2), u(e, "y", o = /*points*/
|
|
2254
|
-
t[0][0][1] - /*handleSize*/
|
|
2255
|
-
t[3] / 2), u(
|
|
2256
|
-
e,
|
|
2257
|
-
"height",
|
|
2258
|
-
/*handleSize*/
|
|
2259
|
-
t[3]
|
|
2260
|
-
), u(
|
|
2261
|
-
e,
|
|
2262
|
-
"width",
|
|
2263
|
-
/*handleSize*/
|
|
2264
|
-
t[3]
|
|
2265
|
-
);
|
|
2266
|
-
},
|
|
2267
|
-
m(r, i) {
|
|
2268
|
-
_(r, e, i);
|
|
2269
|
-
},
|
|
2270
|
-
p(r, i) {
|
|
2271
|
-
i & /*points, handleSize*/
|
|
2272
|
-
9 && n !== (n = /*points*/
|
|
2273
|
-
r[0][0][0] - /*handleSize*/
|
|
2274
|
-
r[3] / 2) && u(e, "x", n), i & /*points, handleSize*/
|
|
2275
|
-
9 && o !== (o = /*points*/
|
|
2276
|
-
r[0][0][1] - /*handleSize*/
|
|
2277
|
-
r[3] / 2) && u(e, "y", o), i & /*handleSize*/
|
|
2278
|
-
8 && u(
|
|
2279
|
-
e,
|
|
2280
|
-
"height",
|
|
2281
|
-
/*handleSize*/
|
|
2282
|
-
r[3]
|
|
2283
|
-
), i & /*handleSize*/
|
|
2284
|
-
8 && u(
|
|
2285
|
-
e,
|
|
2286
|
-
"width",
|
|
2287
|
-
/*handleSize*/
|
|
2288
|
-
r[3]
|
|
2289
|
-
);
|
|
2290
|
-
},
|
|
2291
|
-
d(r) {
|
|
2292
|
-
r && Y(e);
|
|
2293
|
-
}
|
|
2294
|
-
};
|
|
2295
|
-
}
|
|
2296
|
-
function Yo(t) {
|
|
2297
|
-
let e, n = (
|
|
2298
|
-
/*cursor*/
|
|
2299
|
-
t[1] && Te(Jt(t))
|
|
2300
|
-
);
|
|
2301
|
-
return {
|
|
2302
|
-
c() {
|
|
2303
|
-
e = R("g"), n && n.c(), u(e, "class", "a9s-annotation a9s-rubberband");
|
|
2304
|
-
},
|
|
2305
|
-
m(o, r) {
|
|
2306
|
-
_(o, e, r), n && n.m(e, null);
|
|
2307
|
-
},
|
|
2308
|
-
p(o, [r]) {
|
|
2309
|
-
o[1] ? n ? n.p(Jt(o), r) : (n = Te(Jt(o)), n.c(), n.m(e, null)) : n && (n.d(1), n = null);
|
|
2310
|
-
},
|
|
2311
|
-
i: U,
|
|
2312
|
-
o: U,
|
|
2313
|
-
d(o) {
|
|
2314
|
-
o && Y(e), n && n.d();
|
|
2315
|
-
}
|
|
2316
|
-
};
|
|
2317
|
-
}
|
|
2318
|
-
const _o = 20;
|
|
2319
|
-
function Mo(t, e, n) {
|
|
2320
|
-
let o;
|
|
2321
|
-
const r = At();
|
|
2322
|
-
let { addEventListener: i } = e, { drawingMode: a } = e, { transform: s } = e, { viewportScale: l = 1 } = e, d, p = [], c = null, g = !1;
|
|
2323
|
-
const h = (y) => {
|
|
2324
|
-
const { timeStamp: E, offsetX: v, offsetY: X } = y;
|
|
2325
|
-
if (d = { timeStamp: E, offsetX: v, offsetY: X }, a === "drag" && p.length === 0) {
|
|
2326
|
-
const I = s.elementToImage(y.offsetX, y.offsetY);
|
|
2327
|
-
p.push(I), n(1, c = I);
|
|
2328
|
-
}
|
|
2329
|
-
}, m = (y) => {
|
|
2330
|
-
if (p.length > 0 && (n(1, c = s.elementToImage(y.offsetX, y.offsetY)), p.length > 2)) {
|
|
2331
|
-
const E = Kt(c, p[0]) * l;
|
|
2332
|
-
n(2, g = E < _o);
|
|
2333
|
-
}
|
|
2334
|
-
}, x = (y) => {
|
|
2335
|
-
if (a === "click") {
|
|
2336
|
-
const E = y.timeStamp - d.timeStamp, v = Kt([d.offsetX, d.offsetY], [y.offsetX, y.offsetY]);
|
|
2337
|
-
if (E > 300 || v > 15)
|
|
2338
|
-
return;
|
|
2339
|
-
if (g)
|
|
2340
|
-
$();
|
|
2341
|
-
else if (p.length === 0) {
|
|
2342
|
-
const X = s.elementToImage(y.offsetX, y.offsetY);
|
|
2343
|
-
p.push(X), n(1, c = X);
|
|
2344
|
-
} else
|
|
2345
|
-
p.push(c);
|
|
2346
|
-
} else {
|
|
2347
|
-
if (p.length === 1 && Kt(p[0], c) <= 4) {
|
|
2348
|
-
n(0, p = []), n(1, c = null);
|
|
2349
|
-
return;
|
|
2350
|
-
}
|
|
2351
|
-
y.stopImmediatePropagation(), g ? $() : p.push(c);
|
|
2352
|
-
}
|
|
1
|
+
import w from "openseadragon";
|
|
2
|
+
const L = (i, h) => {
|
|
3
|
+
const e = i.element.getBoundingClientRect(), { minX: n, minY: l, maxX: t, maxY: c } = h.target.selector.geometry.bounds, s = i.viewport.imageToViewerElementCoordinates(new w.Point(n, l)), x = i.viewport.imageToViewerElementCoordinates(new w.Point(t, c));
|
|
4
|
+
return {
|
|
5
|
+
x: s.x + e.x,
|
|
6
|
+
right: x.x + e.x,
|
|
7
|
+
y: s.y + e.y,
|
|
8
|
+
bottom: x.y + e.y,
|
|
9
|
+
width: x.x - s.x,
|
|
10
|
+
height: x.y - s.y
|
|
11
|
+
};
|
|
12
|
+
}, T = (i, h, e, n = 5) => {
|
|
13
|
+
const l = i.element.getBoundingClientRect(), t = L(i, h), c = t.y - l.y, s = l.right - t.x, x = l.bottom - t.bottom, d = t.x - l.left, o = e.firstElementChild.getBoundingClientRect(), g = c / o.height, y = s / o.width, a = x / o.height, r = d / o.width, $ = () => {
|
|
14
|
+
e.style.left = `${t.x}px`, e.style.top = `${t.y - n - o.height}px`;
|
|
15
|
+
}, f = () => {
|
|
16
|
+
e.style.left = `${t.right - o.width}px`, e.style.top = `${t.y - n - o.height}px`;
|
|
17
|
+
}, B = () => {
|
|
18
|
+
e.style.left = `${t.x - o.width - n}px`, e.style.top = `${t.y}px`;
|
|
19
|
+
}, v = () => {
|
|
20
|
+
e.style.left = `${t.right + n}px`, e.style.top = `${t.y}px`;
|
|
21
|
+
}, R = () => {
|
|
22
|
+
e.style.left = `${t.x - o.width - n}px`, e.style.top = `${t.bottom - o.height}px`;
|
|
23
|
+
}, C = () => {
|
|
24
|
+
e.style.left = `${t.x + t.width + n}px`, e.style.top = `${t.bottom - o.height}px`;
|
|
25
|
+
}, E = () => {
|
|
26
|
+
e.style.left = `${t.x}px`, e.style.top = `${t.bottom + n}px`;
|
|
2353
27
|
}, A = () => {
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
};
|
|
2358
|
-
oe(E) > 4 && (n(0, p = []), n(1, c = null), r("create", E));
|
|
2359
|
-
}, $ = () => {
|
|
2360
|
-
const y = {
|
|
2361
|
-
type: G.POLYGON,
|
|
2362
|
-
geometry: {
|
|
2363
|
-
bounds: Gt(p),
|
|
2364
|
-
points: [...p]
|
|
2365
|
-
}
|
|
2366
|
-
};
|
|
2367
|
-
n(0, p = []), n(1, c = null), r("create", y);
|
|
2368
|
-
};
|
|
2369
|
-
return Mt(() => {
|
|
2370
|
-
i("pointerdown", h, !0), i("pointermove", m), i("pointerup", x, !0), i("dblclick", A, !0);
|
|
2371
|
-
}), t.$$set = (y) => {
|
|
2372
|
-
"addEventListener" in y && n(4, i = y.addEventListener), "drawingMode" in y && n(5, a = y.drawingMode), "transform" in y && n(6, s = y.transform), "viewportScale" in y && n(7, l = y.viewportScale);
|
|
2373
|
-
}, t.$$.update = () => {
|
|
2374
|
-
t.$$.dirty & /*viewportScale*/
|
|
2375
|
-
128 && n(3, o = 10 / l);
|
|
2376
|
-
}, [
|
|
2377
|
-
p,
|
|
2378
|
-
c,
|
|
2379
|
-
g,
|
|
2380
|
-
o,
|
|
2381
|
-
i,
|
|
2382
|
-
a,
|
|
2383
|
-
s,
|
|
2384
|
-
l
|
|
2385
|
-
];
|
|
2386
|
-
}
|
|
2387
|
-
class Bo extends nt {
|
|
2388
|
-
constructor(e) {
|
|
2389
|
-
super(), et(this, e, Mo, Yo, W, {
|
|
2390
|
-
addEventListener: 4,
|
|
2391
|
-
drawingMode: 5,
|
|
2392
|
-
transform: 6,
|
|
2393
|
-
viewportScale: 7
|
|
2394
|
-
});
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
const de = /* @__PURE__ */ new Map([
|
|
2398
|
-
["rectangle", { tool: To }],
|
|
2399
|
-
["polygon", { tool: Bo }]
|
|
2400
|
-
]), re = () => [...de.keys()], Je = (t) => de.get(t), Xo = (t, e, n) => de.set(t, { tool: e, opts: n });
|
|
2401
|
-
function Co(t) {
|
|
2402
|
-
let e, n, o, r, i;
|
|
2403
|
-
return {
|
|
2404
|
-
c() {
|
|
2405
|
-
e = R("g"), n = R("ellipse"), r = R("ellipse"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
|
|
2406
|
-
t[1] ? "display:none;" : void 0), u(
|
|
2407
|
-
n,
|
|
2408
|
-
"cx",
|
|
2409
|
-
/*cx*/
|
|
2410
|
-
t[2]
|
|
2411
|
-
), u(
|
|
2412
|
-
n,
|
|
2413
|
-
"cy",
|
|
2414
|
-
/*cy*/
|
|
2415
|
-
t[3]
|
|
2416
|
-
), u(
|
|
2417
|
-
n,
|
|
2418
|
-
"rx",
|
|
2419
|
-
/*rx*/
|
|
2420
|
-
t[4]
|
|
2421
|
-
), u(
|
|
2422
|
-
n,
|
|
2423
|
-
"ry",
|
|
2424
|
-
/*ry*/
|
|
2425
|
-
t[5]
|
|
2426
|
-
), u(r, "class", "a9s-inner"), u(
|
|
2427
|
-
r,
|
|
2428
|
-
"style",
|
|
2429
|
-
/*computedStyle*/
|
|
2430
|
-
t[1]
|
|
2431
|
-
), u(
|
|
2432
|
-
r,
|
|
2433
|
-
"cx",
|
|
2434
|
-
/*cx*/
|
|
2435
|
-
t[2]
|
|
2436
|
-
), u(
|
|
2437
|
-
r,
|
|
2438
|
-
"cy",
|
|
2439
|
-
/*cy*/
|
|
2440
|
-
t[3]
|
|
2441
|
-
), u(
|
|
2442
|
-
r,
|
|
2443
|
-
"rx",
|
|
2444
|
-
/*rx*/
|
|
2445
|
-
t[4]
|
|
2446
|
-
), u(
|
|
2447
|
-
r,
|
|
2448
|
-
"ry",
|
|
2449
|
-
/*ry*/
|
|
2450
|
-
t[5]
|
|
2451
|
-
), u(e, "data-id", i = /*annotation*/
|
|
2452
|
-
t[0].id);
|
|
2453
|
-
},
|
|
2454
|
-
m(a, s) {
|
|
2455
|
-
_(a, e, s), lt(e, n), lt(e, r);
|
|
2456
|
-
},
|
|
2457
|
-
p(a, [s]) {
|
|
2458
|
-
s & /*computedStyle*/
|
|
2459
|
-
2 && o !== (o = /*computedStyle*/
|
|
2460
|
-
a[1] ? "display:none;" : void 0) && u(n, "style", o), s & /*computedStyle*/
|
|
2461
|
-
2 && u(
|
|
2462
|
-
r,
|
|
2463
|
-
"style",
|
|
2464
|
-
/*computedStyle*/
|
|
2465
|
-
a[1]
|
|
2466
|
-
), s & /*annotation*/
|
|
2467
|
-
1 && i !== (i = /*annotation*/
|
|
2468
|
-
a[0].id) && u(e, "data-id", i);
|
|
2469
|
-
},
|
|
2470
|
-
i: U,
|
|
2471
|
-
o: U,
|
|
2472
|
-
d(a) {
|
|
2473
|
-
a && Y(e);
|
|
2474
|
-
}
|
|
2475
|
-
};
|
|
2476
|
-
}
|
|
2477
|
-
function Io(t, e, n) {
|
|
2478
|
-
let o, { annotation: r } = e, { geom: i } = e, { style: a = void 0 } = e;
|
|
2479
|
-
const { cx: s, cy: l, rx: d, ry: p } = i;
|
|
2480
|
-
return t.$$set = (c) => {
|
|
2481
|
-
"annotation" in c && n(0, r = c.annotation), "geom" in c && n(6, i = c.geom), "style" in c && n(7, a = c.style);
|
|
2482
|
-
}, t.$$.update = () => {
|
|
2483
|
-
t.$$.dirty & /*annotation, style*/
|
|
2484
|
-
129 && n(1, o = Ft(r, a));
|
|
2485
|
-
}, [r, o, s, l, d, p, i, a];
|
|
2486
|
-
}
|
|
2487
|
-
class Ro extends nt {
|
|
2488
|
-
constructor(e) {
|
|
2489
|
-
super(), et(this, e, Io, Co, W, { annotation: 0, geom: 6, style: 7 });
|
|
2490
|
-
}
|
|
2491
|
-
}
|
|
2492
|
-
function No(t) {
|
|
2493
|
-
let e, n, o, r, i;
|
|
2494
|
-
return {
|
|
2495
|
-
c() {
|
|
2496
|
-
e = R("g"), n = R("polygon"), r = R("polygon"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
|
|
2497
|
-
t[1] ? "display:none;" : void 0), u(
|
|
2498
|
-
n,
|
|
2499
|
-
"points",
|
|
2500
|
-
/*points*/
|
|
2501
|
-
t[2].map(Vo).join(" ")
|
|
2502
|
-
), u(r, "class", "a9s-inner"), u(
|
|
2503
|
-
r,
|
|
2504
|
-
"style",
|
|
2505
|
-
/*computedStyle*/
|
|
2506
|
-
t[1]
|
|
2507
|
-
), u(
|
|
2508
|
-
r,
|
|
2509
|
-
"points",
|
|
2510
|
-
/*points*/
|
|
2511
|
-
t[2].map(ko).join(" ")
|
|
2512
|
-
), u(e, "data-id", i = /*annotation*/
|
|
2513
|
-
t[0].id);
|
|
2514
|
-
},
|
|
2515
|
-
m(a, s) {
|
|
2516
|
-
_(a, e, s), lt(e, n), lt(e, r);
|
|
2517
|
-
},
|
|
2518
|
-
p(a, [s]) {
|
|
2519
|
-
s & /*computedStyle*/
|
|
2520
|
-
2 && o !== (o = /*computedStyle*/
|
|
2521
|
-
a[1] ? "display:none;" : void 0) && u(n, "style", o), s & /*computedStyle*/
|
|
2522
|
-
2 && u(
|
|
2523
|
-
r,
|
|
2524
|
-
"style",
|
|
2525
|
-
/*computedStyle*/
|
|
2526
|
-
a[1]
|
|
2527
|
-
), s & /*annotation*/
|
|
2528
|
-
1 && i !== (i = /*annotation*/
|
|
2529
|
-
a[0].id) && u(e, "data-id", i);
|
|
2530
|
-
},
|
|
2531
|
-
i: U,
|
|
2532
|
-
o: U,
|
|
2533
|
-
d(a) {
|
|
2534
|
-
a && Y(e);
|
|
2535
|
-
}
|
|
2536
|
-
};
|
|
2537
|
-
}
|
|
2538
|
-
const Vo = (t) => t.join(","), ko = (t) => t.join(",");
|
|
2539
|
-
function Do(t, e, n) {
|
|
2540
|
-
let o, { annotation: r } = e, { geom: i } = e, { style: a = void 0 } = e;
|
|
2541
|
-
const { points: s } = i;
|
|
2542
|
-
return t.$$set = (l) => {
|
|
2543
|
-
"annotation" in l && n(0, r = l.annotation), "geom" in l && n(3, i = l.geom), "style" in l && n(4, a = l.style);
|
|
2544
|
-
}, t.$$.update = () => {
|
|
2545
|
-
t.$$.dirty & /*annotation, style*/
|
|
2546
|
-
17 && n(1, o = Ft(r, a));
|
|
2547
|
-
}, [r, o, s, i, a];
|
|
2548
|
-
}
|
|
2549
|
-
class Uo extends nt {
|
|
2550
|
-
constructor(e) {
|
|
2551
|
-
super(), et(this, e, Do, No, W, { annotation: 0, geom: 3, style: 4 });
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
function Go(t) {
|
|
2555
|
-
let e, n, o, r, i;
|
|
2556
|
-
return {
|
|
2557
|
-
c() {
|
|
2558
|
-
e = R("g"), n = R("rect"), r = R("rect"), u(n, "class", "a9s-outer"), u(n, "style", o = /*computedStyle*/
|
|
2559
|
-
t[5] ? "display:none;" : void 0), u(
|
|
2560
|
-
n,
|
|
2561
|
-
"x",
|
|
2562
|
-
/*x*/
|
|
2563
|
-
t[4]
|
|
2564
|
-
), u(
|
|
2565
|
-
n,
|
|
2566
|
-
"y",
|
|
2567
|
-
/*y*/
|
|
2568
|
-
t[3]
|
|
2569
|
-
), u(
|
|
2570
|
-
n,
|
|
2571
|
-
"width",
|
|
2572
|
-
/*w*/
|
|
2573
|
-
t[2]
|
|
2574
|
-
), u(
|
|
2575
|
-
n,
|
|
2576
|
-
"height",
|
|
2577
|
-
/*h*/
|
|
2578
|
-
t[1]
|
|
2579
|
-
), u(r, "class", "a9s-inner"), u(
|
|
2580
|
-
r,
|
|
2581
|
-
"style",
|
|
2582
|
-
/*computedStyle*/
|
|
2583
|
-
t[5]
|
|
2584
|
-
), u(
|
|
2585
|
-
r,
|
|
2586
|
-
"x",
|
|
2587
|
-
/*x*/
|
|
2588
|
-
t[4]
|
|
2589
|
-
), u(
|
|
2590
|
-
r,
|
|
2591
|
-
"y",
|
|
2592
|
-
/*y*/
|
|
2593
|
-
t[3]
|
|
2594
|
-
), u(
|
|
2595
|
-
r,
|
|
2596
|
-
"width",
|
|
2597
|
-
/*w*/
|
|
2598
|
-
t[2]
|
|
2599
|
-
), u(
|
|
2600
|
-
r,
|
|
2601
|
-
"height",
|
|
2602
|
-
/*h*/
|
|
2603
|
-
t[1]
|
|
2604
|
-
), u(e, "data-id", i = /*annotation*/
|
|
2605
|
-
t[0].id);
|
|
2606
|
-
},
|
|
2607
|
-
m(a, s) {
|
|
2608
|
-
_(a, e, s), lt(e, n), lt(e, r);
|
|
2609
|
-
},
|
|
2610
|
-
p(a, [s]) {
|
|
2611
|
-
s & /*computedStyle*/
|
|
2612
|
-
32 && o !== (o = /*computedStyle*/
|
|
2613
|
-
a[5] ? "display:none;" : void 0) && u(n, "style", o), s & /*x*/
|
|
2614
|
-
16 && u(
|
|
2615
|
-
n,
|
|
2616
|
-
"x",
|
|
2617
|
-
/*x*/
|
|
2618
|
-
a[4]
|
|
2619
|
-
), s & /*y*/
|
|
2620
|
-
8 && u(
|
|
2621
|
-
n,
|
|
2622
|
-
"y",
|
|
2623
|
-
/*y*/
|
|
2624
|
-
a[3]
|
|
2625
|
-
), s & /*w*/
|
|
2626
|
-
4 && u(
|
|
2627
|
-
n,
|
|
2628
|
-
"width",
|
|
2629
|
-
/*w*/
|
|
2630
|
-
a[2]
|
|
2631
|
-
), s & /*h*/
|
|
2632
|
-
2 && u(
|
|
2633
|
-
n,
|
|
2634
|
-
"height",
|
|
2635
|
-
/*h*/
|
|
2636
|
-
a[1]
|
|
2637
|
-
), s & /*computedStyle*/
|
|
2638
|
-
32 && u(
|
|
2639
|
-
r,
|
|
2640
|
-
"style",
|
|
2641
|
-
/*computedStyle*/
|
|
2642
|
-
a[5]
|
|
2643
|
-
), s & /*x*/
|
|
2644
|
-
16 && u(
|
|
2645
|
-
r,
|
|
2646
|
-
"x",
|
|
2647
|
-
/*x*/
|
|
2648
|
-
a[4]
|
|
2649
|
-
), s & /*y*/
|
|
2650
|
-
8 && u(
|
|
2651
|
-
r,
|
|
2652
|
-
"y",
|
|
2653
|
-
/*y*/
|
|
2654
|
-
a[3]
|
|
2655
|
-
), s & /*w*/
|
|
2656
|
-
4 && u(
|
|
2657
|
-
r,
|
|
2658
|
-
"width",
|
|
2659
|
-
/*w*/
|
|
2660
|
-
a[2]
|
|
2661
|
-
), s & /*h*/
|
|
2662
|
-
2 && u(
|
|
2663
|
-
r,
|
|
2664
|
-
"height",
|
|
2665
|
-
/*h*/
|
|
2666
|
-
a[1]
|
|
2667
|
-
), s & /*annotation*/
|
|
2668
|
-
1 && i !== (i = /*annotation*/
|
|
2669
|
-
a[0].id) && u(e, "data-id", i);
|
|
2670
|
-
},
|
|
2671
|
-
i: U,
|
|
2672
|
-
o: U,
|
|
2673
|
-
d(a) {
|
|
2674
|
-
a && Y(e);
|
|
2675
|
-
}
|
|
2676
|
-
};
|
|
2677
|
-
}
|
|
2678
|
-
function Fo(t, e, n) {
|
|
2679
|
-
let o, r, i, a, s, { annotation: l } = e, { geom: d } = e, { style: p = void 0 } = e;
|
|
2680
|
-
return t.$$set = (c) => {
|
|
2681
|
-
"annotation" in c && n(0, l = c.annotation), "geom" in c && n(6, d = c.geom), "style" in c && n(7, p = c.style);
|
|
2682
|
-
}, t.$$.update = () => {
|
|
2683
|
-
t.$$.dirty & /*annotation, style*/
|
|
2684
|
-
129 && n(5, o = Ft(l, p)), t.$$.dirty & /*geom*/
|
|
2685
|
-
64 && n(4, { x: r, y: i, w: a, h: s } = d, r, (n(3, i), n(6, d)), (n(2, a), n(6, d)), (n(1, s), n(6, d)));
|
|
2686
|
-
}, [l, s, a, i, r, o, d, p];
|
|
2687
|
-
}
|
|
2688
|
-
class Ho extends nt {
|
|
2689
|
-
constructor(e) {
|
|
2690
|
-
super(), et(this, e, Fo, Go, W, { annotation: 0, geom: 6, style: 7 });
|
|
2691
|
-
}
|
|
2692
|
-
}
|
|
2693
|
-
const Po = (t) => ({
|
|
2694
|
-
elementToImage: (e, n) => {
|
|
2695
|
-
const o = t.getBoundingClientRect(), r = t.createSVGPoint();
|
|
2696
|
-
r.x = e + o.x, r.y = n + o.y;
|
|
2697
|
-
const { x: i, y: a } = r.matrixTransform(t.getScreenCTM().inverse());
|
|
2698
|
-
return [i, a];
|
|
2699
|
-
}
|
|
2700
|
-
}), jo = 250, zo = (t, e) => {
|
|
2701
|
-
const n = At();
|
|
2702
|
-
let o;
|
|
2703
|
-
return { onPointerDown: () => o = performance.now(), onPointerUp: (r) => {
|
|
2704
|
-
if (performance.now() - o < jo) {
|
|
2705
|
-
const { x: i, y: a } = qo(r, t), s = e.getAt(i, a);
|
|
2706
|
-
s ? n("click", { originalEvent: r, annotation: s }) : n("click", { originalEvent: r });
|
|
2707
|
-
}
|
|
2708
|
-
} };
|
|
2709
|
-
}, qo = (t, e) => {
|
|
2710
|
-
const n = e.createSVGPoint(), o = e.getBoundingClientRect(), r = t.clientX - o.x, i = t.clientY - o.y, { left: a, top: s } = e.getBoundingClientRect();
|
|
2711
|
-
return n.x = r + a, n.y = i + s, n.matrixTransform(e.getScreenCTM().inverse());
|
|
2712
|
-
};
|
|
2713
|
-
function Oe(t, e, n) {
|
|
2714
|
-
const o = t.slice();
|
|
2715
|
-
return o[29] = e[n], o;
|
|
2716
|
-
}
|
|
2717
|
-
function Le(t, e, n) {
|
|
2718
|
-
const o = t.slice();
|
|
2719
|
-
return o[32] = e[n], o;
|
|
2720
|
-
}
|
|
2721
|
-
function Zt(t) {
|
|
2722
|
-
const e = t.slice(), n = (
|
|
2723
|
-
/*annotation*/
|
|
2724
|
-
e[32].target.selector
|
|
2725
|
-
);
|
|
2726
|
-
return e[35] = n, e;
|
|
2727
|
-
}
|
|
2728
|
-
function Ye(t) {
|
|
2729
|
-
let e = (
|
|
2730
|
-
/*annotation*/
|
|
2731
|
-
t[32].id
|
|
2732
|
-
), n, o, r = _e(t);
|
|
2733
|
-
return {
|
|
2734
|
-
c() {
|
|
2735
|
-
r.c(), n = at();
|
|
2736
|
-
},
|
|
2737
|
-
m(i, a) {
|
|
2738
|
-
r.m(i, a), _(i, n, a), o = !0;
|
|
2739
|
-
},
|
|
2740
|
-
p(i, a) {
|
|
2741
|
-
a[0] & /*$store*/
|
|
2742
|
-
8192 && W(e, e = /*annotation*/
|
|
2743
|
-
i[32].id) ? (ot(), k(r, 1, 1, U), rt(), r = _e(i), r.c(), N(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
|
|
2744
|
-
},
|
|
2745
|
-
i(i) {
|
|
2746
|
-
o || (N(r), o = !0);
|
|
2747
|
-
},
|
|
2748
|
-
o(i) {
|
|
2749
|
-
k(r), o = !1;
|
|
2750
|
-
},
|
|
2751
|
-
d(i) {
|
|
2752
|
-
i && Y(n), r.d(i);
|
|
2753
|
-
}
|
|
2754
|
-
};
|
|
2755
|
-
}
|
|
2756
|
-
function Wo(t) {
|
|
2757
|
-
let e, n;
|
|
2758
|
-
return e = new Uo({
|
|
2759
|
-
props: {
|
|
2760
|
-
annotation: (
|
|
2761
|
-
/*annotation*/
|
|
2762
|
-
t[32]
|
|
2763
|
-
),
|
|
2764
|
-
geom: (
|
|
2765
|
-
/*selector*/
|
|
2766
|
-
t[35].geometry
|
|
2767
|
-
),
|
|
2768
|
-
style: (
|
|
2769
|
-
/*style*/
|
|
2770
|
-
t[1]
|
|
2771
|
-
)
|
|
2772
|
-
}
|
|
2773
|
-
}), {
|
|
2774
|
-
c() {
|
|
2775
|
-
pt(e.$$.fragment);
|
|
2776
|
-
},
|
|
2777
|
-
m(o, r) {
|
|
2778
|
-
dt(e, o, r), n = !0;
|
|
2779
|
-
},
|
|
2780
|
-
p(o, r) {
|
|
2781
|
-
const i = {};
|
|
2782
|
-
r[0] & /*$store*/
|
|
2783
|
-
8192 && (i.annotation = /*annotation*/
|
|
2784
|
-
o[32]), r[0] & /*$store*/
|
|
2785
|
-
8192 && (i.geom = /*selector*/
|
|
2786
|
-
o[35].geometry), r[0] & /*style*/
|
|
2787
|
-
2 && (i.style = /*style*/
|
|
2788
|
-
o[1]), e.$set(i);
|
|
2789
|
-
},
|
|
2790
|
-
i(o) {
|
|
2791
|
-
n || (N(e.$$.fragment, o), n = !0);
|
|
2792
|
-
},
|
|
2793
|
-
o(o) {
|
|
2794
|
-
k(e.$$.fragment, o), n = !1;
|
|
2795
|
-
},
|
|
2796
|
-
d(o) {
|
|
2797
|
-
ct(e, o);
|
|
2798
|
-
}
|
|
2799
|
-
};
|
|
2800
|
-
}
|
|
2801
|
-
function Ko(t) {
|
|
2802
|
-
let e, n;
|
|
2803
|
-
return e = new Ho({
|
|
2804
|
-
props: {
|
|
2805
|
-
annotation: (
|
|
2806
|
-
/*annotation*/
|
|
2807
|
-
t[32]
|
|
2808
|
-
),
|
|
2809
|
-
geom: (
|
|
2810
|
-
/*selector*/
|
|
2811
|
-
t[35].geometry
|
|
2812
|
-
),
|
|
2813
|
-
style: (
|
|
2814
|
-
/*style*/
|
|
2815
|
-
t[1]
|
|
2816
|
-
)
|
|
2817
|
-
}
|
|
2818
|
-
}), {
|
|
2819
|
-
c() {
|
|
2820
|
-
pt(e.$$.fragment);
|
|
2821
|
-
},
|
|
2822
|
-
m(o, r) {
|
|
2823
|
-
dt(e, o, r), n = !0;
|
|
2824
|
-
},
|
|
2825
|
-
p(o, r) {
|
|
2826
|
-
const i = {};
|
|
2827
|
-
r[0] & /*$store*/
|
|
2828
|
-
8192 && (i.annotation = /*annotation*/
|
|
2829
|
-
o[32]), r[0] & /*$store*/
|
|
2830
|
-
8192 && (i.geom = /*selector*/
|
|
2831
|
-
o[35].geometry), r[0] & /*style*/
|
|
2832
|
-
2 && (i.style = /*style*/
|
|
2833
|
-
o[1]), e.$set(i);
|
|
2834
|
-
},
|
|
2835
|
-
i(o) {
|
|
2836
|
-
n || (N(e.$$.fragment, o), n = !0);
|
|
2837
|
-
},
|
|
2838
|
-
o(o) {
|
|
2839
|
-
k(e.$$.fragment, o), n = !1;
|
|
2840
|
-
},
|
|
2841
|
-
d(o) {
|
|
2842
|
-
ct(e, o);
|
|
2843
|
-
}
|
|
2844
|
-
};
|
|
2845
|
-
}
|
|
2846
|
-
function Jo(t) {
|
|
2847
|
-
let e, n;
|
|
2848
|
-
return e = new Ro({
|
|
2849
|
-
props: {
|
|
2850
|
-
annotation: (
|
|
2851
|
-
/*annotation*/
|
|
2852
|
-
t[32]
|
|
2853
|
-
),
|
|
2854
|
-
geom: (
|
|
2855
|
-
/*selector*/
|
|
2856
|
-
t[35].geometry
|
|
2857
|
-
),
|
|
2858
|
-
style: (
|
|
2859
|
-
/*style*/
|
|
2860
|
-
t[1]
|
|
2861
|
-
)
|
|
2862
|
-
}
|
|
2863
|
-
}), {
|
|
2864
|
-
c() {
|
|
2865
|
-
pt(e.$$.fragment);
|
|
2866
|
-
},
|
|
2867
|
-
m(o, r) {
|
|
2868
|
-
dt(e, o, r), n = !0;
|
|
2869
|
-
},
|
|
2870
|
-
p(o, r) {
|
|
2871
|
-
const i = {};
|
|
2872
|
-
r[0] & /*$store*/
|
|
2873
|
-
8192 && (i.annotation = /*annotation*/
|
|
2874
|
-
o[32]), r[0] & /*$store*/
|
|
2875
|
-
8192 && (i.geom = /*selector*/
|
|
2876
|
-
o[35].geometry), r[0] & /*style*/
|
|
2877
|
-
2 && (i.style = /*style*/
|
|
2878
|
-
o[1]), e.$set(i);
|
|
2879
|
-
},
|
|
2880
|
-
i(o) {
|
|
2881
|
-
n || (N(e.$$.fragment, o), n = !0);
|
|
2882
|
-
},
|
|
2883
|
-
o(o) {
|
|
2884
|
-
k(e.$$.fragment, o), n = !1;
|
|
2885
|
-
},
|
|
2886
|
-
d(o) {
|
|
2887
|
-
ct(e, o);
|
|
2888
|
-
}
|
|
2889
|
-
};
|
|
2890
|
-
}
|
|
2891
|
-
function _e(t) {
|
|
2892
|
-
let e, n, o, r;
|
|
2893
|
-
const i = [Jo, Ko, Wo], a = [];
|
|
2894
|
-
function s(l, d) {
|
|
2895
|
-
return (
|
|
2896
|
-
/*selector*/
|
|
2897
|
-
l[35].type === G.ELLIPSE ? 0 : (
|
|
2898
|
-
/*selector*/
|
|
2899
|
-
l[35].type === G.RECTANGLE ? 1 : (
|
|
2900
|
-
/*selector*/
|
|
2901
|
-
l[35].type === G.POLYGON ? 2 : -1
|
|
2902
|
-
)
|
|
2903
|
-
)
|
|
2904
|
-
);
|
|
2905
|
-
}
|
|
2906
|
-
return ~(e = s(t)) && (n = a[e] = i[e](t)), {
|
|
2907
|
-
c() {
|
|
2908
|
-
n && n.c(), o = at();
|
|
2909
|
-
},
|
|
2910
|
-
m(l, d) {
|
|
2911
|
-
~e && a[e].m(l, d), _(l, o, d), r = !0;
|
|
2912
|
-
},
|
|
2913
|
-
p(l, d) {
|
|
2914
|
-
let p = e;
|
|
2915
|
-
e = s(l), e === p ? ~e && a[e].p(l, d) : (n && (ot(), k(a[p], 1, 1, () => {
|
|
2916
|
-
a[p] = null;
|
|
2917
|
-
}), rt()), ~e ? (n = a[e], n ? n.p(l, d) : (n = a[e] = i[e](l), n.c()), N(n, 1), n.m(o.parentNode, o)) : n = null);
|
|
2918
|
-
},
|
|
2919
|
-
i(l) {
|
|
2920
|
-
r || (N(n), r = !0);
|
|
2921
|
-
},
|
|
2922
|
-
o(l) {
|
|
2923
|
-
k(n), r = !1;
|
|
2924
|
-
},
|
|
2925
|
-
d(l) {
|
|
2926
|
-
~e && a[e].d(l), l && Y(o);
|
|
2927
|
-
}
|
|
2928
|
-
};
|
|
2929
|
-
}
|
|
2930
|
-
function Me(t) {
|
|
2931
|
-
let e = !/*isEditable*/
|
|
2932
|
-
t[7](
|
|
2933
|
-
/*annotation*/
|
|
2934
|
-
t[32]
|
|
2935
|
-
), n, o, r = e && Ye(Zt(t));
|
|
2936
|
-
return {
|
|
2937
|
-
c() {
|
|
2938
|
-
r && r.c(), n = at();
|
|
2939
|
-
},
|
|
2940
|
-
m(i, a) {
|
|
2941
|
-
r && r.m(i, a), _(i, n, a), o = !0;
|
|
2942
|
-
},
|
|
2943
|
-
p(i, a) {
|
|
2944
|
-
a[0] & /*isEditable, $store*/
|
|
2945
|
-
8320 && (e = !/*isEditable*/
|
|
2946
|
-
i[7](
|
|
2947
|
-
/*annotation*/
|
|
2948
|
-
i[32]
|
|
2949
|
-
)), e ? r ? (r.p(Zt(i), a), a[0] & /*isEditable, $store*/
|
|
2950
|
-
8320 && N(r, 1)) : (r = Ye(Zt(i)), r.c(), N(r, 1), r.m(n.parentNode, n)) : r && (ot(), k(r, 1, 1, () => {
|
|
2951
|
-
r = null;
|
|
2952
|
-
}), rt());
|
|
2953
|
-
},
|
|
2954
|
-
i(i) {
|
|
2955
|
-
o || (N(r), o = !0);
|
|
2956
|
-
},
|
|
2957
|
-
o(i) {
|
|
2958
|
-
k(r), o = !1;
|
|
2959
|
-
},
|
|
2960
|
-
d(i) {
|
|
2961
|
-
r && r.d(i), i && Y(n);
|
|
2962
|
-
}
|
|
2963
|
-
};
|
|
2964
|
-
}
|
|
2965
|
-
function Be(t) {
|
|
2966
|
-
let e, n, o, r;
|
|
2967
|
-
const i = [Qo, Zo], a = [];
|
|
2968
|
-
function s(l, d) {
|
|
2969
|
-
return (
|
|
2970
|
-
/*editableAnnotations*/
|
|
2971
|
-
l[6] ? 0 : (
|
|
2972
|
-
/*tool*/
|
|
2973
|
-
l[12] && /*drawingEnabled*/
|
|
2974
|
-
l[0] ? 1 : -1
|
|
2975
|
-
)
|
|
2976
|
-
);
|
|
2977
|
-
}
|
|
2978
|
-
return ~(e = s(t)) && (n = a[e] = i[e](t)), {
|
|
2979
|
-
c() {
|
|
2980
|
-
n && n.c(), o = at();
|
|
2981
|
-
},
|
|
2982
|
-
m(l, d) {
|
|
2983
|
-
~e && a[e].m(l, d), _(l, o, d), r = !0;
|
|
2984
|
-
},
|
|
2985
|
-
p(l, d) {
|
|
2986
|
-
let p = e;
|
|
2987
|
-
e = s(l), e === p ? ~e && a[e].p(l, d) : (n && (ot(), k(a[p], 1, 1, () => {
|
|
2988
|
-
a[p] = null;
|
|
2989
|
-
}), rt()), ~e ? (n = a[e], n ? n.p(l, d) : (n = a[e] = i[e](l), n.c()), N(n, 1), n.m(o.parentNode, o)) : n = null);
|
|
2990
|
-
},
|
|
2991
|
-
i(l) {
|
|
2992
|
-
r || (N(n), r = !0);
|
|
2993
|
-
},
|
|
2994
|
-
o(l) {
|
|
2995
|
-
k(n), r = !1;
|
|
2996
|
-
},
|
|
2997
|
-
d(l) {
|
|
2998
|
-
~e && a[e].d(l), l && Y(o);
|
|
2999
|
-
}
|
|
3000
|
-
};
|
|
3001
|
-
}
|
|
3002
|
-
function Zo(t) {
|
|
3003
|
-
let e = (
|
|
3004
|
-
/*toolName*/
|
|
3005
|
-
t[2]
|
|
3006
|
-
), n, o, r = Xe(t);
|
|
3007
|
-
return {
|
|
3008
|
-
c() {
|
|
3009
|
-
r.c(), n = at();
|
|
3010
|
-
},
|
|
3011
|
-
m(i, a) {
|
|
3012
|
-
r.m(i, a), _(i, n, a), o = !0;
|
|
3013
|
-
},
|
|
3014
|
-
p(i, a) {
|
|
3015
|
-
a[0] & /*toolName*/
|
|
3016
|
-
4 && W(e, e = /*toolName*/
|
|
3017
|
-
i[2]) ? (ot(), k(r, 1, 1, U), rt(), r = Xe(i), r.c(), N(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
|
|
3018
|
-
},
|
|
3019
|
-
i(i) {
|
|
3020
|
-
o || (N(r), o = !0);
|
|
3021
|
-
},
|
|
3022
|
-
o(i) {
|
|
3023
|
-
k(r), o = !1;
|
|
3024
|
-
},
|
|
3025
|
-
d(i) {
|
|
3026
|
-
i && Y(n), r.d(i);
|
|
3027
|
-
}
|
|
3028
|
-
};
|
|
3029
|
-
}
|
|
3030
|
-
function Qo(t) {
|
|
3031
|
-
let e, n, o = (
|
|
3032
|
-
/*editableAnnotations*/
|
|
3033
|
-
t[6]
|
|
3034
|
-
), r = [];
|
|
3035
|
-
for (let a = 0; a < o.length; a += 1)
|
|
3036
|
-
r[a] = Ie(Oe(t, o, a));
|
|
3037
|
-
const i = (a) => k(r[a], 1, 1, () => {
|
|
3038
|
-
r[a] = null;
|
|
3039
|
-
});
|
|
3040
|
-
return {
|
|
3041
|
-
c() {
|
|
3042
|
-
for (let a = 0; a < r.length; a += 1)
|
|
3043
|
-
r[a].c();
|
|
3044
|
-
e = at();
|
|
3045
|
-
},
|
|
3046
|
-
m(a, s) {
|
|
3047
|
-
for (let l = 0; l < r.length; l += 1)
|
|
3048
|
-
r[l] && r[l].m(a, s);
|
|
3049
|
-
_(a, e, s), n = !0;
|
|
3050
|
-
},
|
|
3051
|
-
p(a, s) {
|
|
3052
|
-
if (s[0] & /*editableAnnotations, drawingEl, style, transform, $scale, onChangeSelected*/
|
|
3053
|
-
279634) {
|
|
3054
|
-
o = /*editableAnnotations*/
|
|
3055
|
-
a[6];
|
|
3056
|
-
let l;
|
|
3057
|
-
for (l = 0; l < o.length; l += 1) {
|
|
3058
|
-
const d = Oe(a, o, l);
|
|
3059
|
-
r[l] ? (r[l].p(d, s), N(r[l], 1)) : (r[l] = Ie(d), r[l].c(), N(r[l], 1), r[l].m(e.parentNode, e));
|
|
3060
|
-
}
|
|
3061
|
-
for (ot(), l = o.length; l < r.length; l += 1)
|
|
3062
|
-
i(l);
|
|
3063
|
-
rt();
|
|
3064
|
-
}
|
|
3065
|
-
},
|
|
3066
|
-
i(a) {
|
|
3067
|
-
if (!n) {
|
|
3068
|
-
for (let s = 0; s < o.length; s += 1)
|
|
3069
|
-
N(r[s]);
|
|
3070
|
-
n = !0;
|
|
3071
|
-
}
|
|
3072
|
-
},
|
|
3073
|
-
o(a) {
|
|
3074
|
-
r = r.filter(Boolean);
|
|
3075
|
-
for (let s = 0; s < r.length; s += 1)
|
|
3076
|
-
k(r[s]);
|
|
3077
|
-
n = !1;
|
|
3078
|
-
},
|
|
3079
|
-
d(a) {
|
|
3080
|
-
ie(r, a), a && Y(e);
|
|
3081
|
-
}
|
|
3082
|
-
};
|
|
3083
|
-
}
|
|
3084
|
-
function Xe(t) {
|
|
3085
|
-
let e, n;
|
|
3086
|
-
return e = new Eo({
|
|
3087
|
-
props: {
|
|
3088
|
-
target: (
|
|
3089
|
-
/*drawingEl*/
|
|
3090
|
-
t[4]
|
|
3091
|
-
),
|
|
3092
|
-
tool: (
|
|
3093
|
-
/*tool*/
|
|
3094
|
-
t[12]
|
|
3095
|
-
),
|
|
3096
|
-
drawingMode: (
|
|
3097
|
-
/*drawingMode*/
|
|
3098
|
-
t[11]
|
|
3099
|
-
),
|
|
3100
|
-
transform: (
|
|
3101
|
-
/*transform*/
|
|
3102
|
-
t[10]
|
|
3103
|
-
),
|
|
3104
|
-
viewportScale: (
|
|
3105
|
-
/*$scale*/
|
|
3106
|
-
t[14]
|
|
3107
|
-
)
|
|
3108
|
-
}
|
|
3109
|
-
}), e.$on(
|
|
3110
|
-
"create",
|
|
3111
|
-
/*onSelectionCreated*/
|
|
3112
|
-
t[17]
|
|
3113
|
-
), {
|
|
3114
|
-
c() {
|
|
3115
|
-
pt(e.$$.fragment);
|
|
3116
|
-
},
|
|
3117
|
-
m(o, r) {
|
|
3118
|
-
dt(e, o, r), n = !0;
|
|
3119
|
-
},
|
|
3120
|
-
p(o, r) {
|
|
3121
|
-
const i = {};
|
|
3122
|
-
r[0] & /*drawingEl*/
|
|
3123
|
-
16 && (i.target = /*drawingEl*/
|
|
3124
|
-
o[4]), r[0] & /*tool*/
|
|
3125
|
-
4096 && (i.tool = /*tool*/
|
|
3126
|
-
o[12]), r[0] & /*drawingMode*/
|
|
3127
|
-
2048 && (i.drawingMode = /*drawingMode*/
|
|
3128
|
-
o[11]), r[0] & /*transform*/
|
|
3129
|
-
1024 && (i.transform = /*transform*/
|
|
3130
|
-
o[10]), r[0] & /*$scale*/
|
|
3131
|
-
16384 && (i.viewportScale = /*$scale*/
|
|
3132
|
-
o[14]), e.$set(i);
|
|
3133
|
-
},
|
|
3134
|
-
i(o) {
|
|
3135
|
-
n || (N(e.$$.fragment, o), n = !0);
|
|
3136
|
-
},
|
|
3137
|
-
o(o) {
|
|
3138
|
-
k(e.$$.fragment, o), n = !1;
|
|
3139
|
-
},
|
|
3140
|
-
d(o) {
|
|
3141
|
-
ct(e, o);
|
|
3142
|
-
}
|
|
3143
|
-
};
|
|
3144
|
-
}
|
|
3145
|
-
function Ce(t) {
|
|
3146
|
-
let e, n;
|
|
3147
|
-
return e = new xo({
|
|
3148
|
-
props: {
|
|
3149
|
-
target: (
|
|
3150
|
-
/*drawingEl*/
|
|
3151
|
-
t[4]
|
|
3152
|
-
),
|
|
3153
|
-
editor: Ee(
|
|
3154
|
-
/*editable*/
|
|
3155
|
-
t[29].target.selector
|
|
3156
|
-
),
|
|
3157
|
-
annotation: (
|
|
3158
|
-
/*editable*/
|
|
3159
|
-
t[29]
|
|
3160
|
-
),
|
|
3161
|
-
style: (
|
|
3162
|
-
/*style*/
|
|
3163
|
-
t[1]
|
|
3164
|
-
),
|
|
3165
|
-
transform: (
|
|
3166
|
-
/*transform*/
|
|
3167
|
-
t[10]
|
|
3168
|
-
),
|
|
3169
|
-
viewportScale: (
|
|
3170
|
-
/*$scale*/
|
|
3171
|
-
t[14]
|
|
3172
|
-
)
|
|
3173
|
-
}
|
|
3174
|
-
}), e.$on("change", function() {
|
|
3175
|
-
H(
|
|
3176
|
-
/*onChangeSelected*/
|
|
3177
|
-
t[18](
|
|
3178
|
-
/*editable*/
|
|
3179
|
-
t[29]
|
|
3180
|
-
)
|
|
3181
|
-
) && t[18](
|
|
3182
|
-
/*editable*/
|
|
3183
|
-
t[29]
|
|
3184
|
-
).apply(this, arguments);
|
|
3185
|
-
}), {
|
|
3186
|
-
c() {
|
|
3187
|
-
pt(e.$$.fragment);
|
|
3188
|
-
},
|
|
3189
|
-
m(o, r) {
|
|
3190
|
-
dt(e, o, r), n = !0;
|
|
3191
|
-
},
|
|
3192
|
-
p(o, r) {
|
|
3193
|
-
t = o;
|
|
3194
|
-
const i = {};
|
|
3195
|
-
r[0] & /*drawingEl*/
|
|
3196
|
-
16 && (i.target = /*drawingEl*/
|
|
3197
|
-
t[4]), r[0] & /*editableAnnotations*/
|
|
3198
|
-
64 && (i.editor = Ee(
|
|
3199
|
-
/*editable*/
|
|
3200
|
-
t[29].target.selector
|
|
3201
|
-
)), r[0] & /*editableAnnotations*/
|
|
3202
|
-
64 && (i.annotation = /*editable*/
|
|
3203
|
-
t[29]), r[0] & /*style*/
|
|
3204
|
-
2 && (i.style = /*style*/
|
|
3205
|
-
t[1]), r[0] & /*transform*/
|
|
3206
|
-
1024 && (i.transform = /*transform*/
|
|
3207
|
-
t[10]), r[0] & /*$scale*/
|
|
3208
|
-
16384 && (i.viewportScale = /*$scale*/
|
|
3209
|
-
t[14]), e.$set(i);
|
|
3210
|
-
},
|
|
3211
|
-
i(o) {
|
|
3212
|
-
n || (N(e.$$.fragment, o), n = !0);
|
|
3213
|
-
},
|
|
3214
|
-
o(o) {
|
|
3215
|
-
k(e.$$.fragment, o), n = !1;
|
|
3216
|
-
},
|
|
3217
|
-
d(o) {
|
|
3218
|
-
ct(e, o);
|
|
3219
|
-
}
|
|
3220
|
-
};
|
|
3221
|
-
}
|
|
3222
|
-
function Ie(t) {
|
|
3223
|
-
let e = (
|
|
3224
|
-
/*editable*/
|
|
3225
|
-
t[29].id
|
|
3226
|
-
), n, o, r = Ce(t);
|
|
3227
|
-
return {
|
|
3228
|
-
c() {
|
|
3229
|
-
r.c(), n = at();
|
|
3230
|
-
},
|
|
3231
|
-
m(i, a) {
|
|
3232
|
-
r.m(i, a), _(i, n, a), o = !0;
|
|
3233
|
-
},
|
|
3234
|
-
p(i, a) {
|
|
3235
|
-
a[0] & /*editableAnnotations*/
|
|
3236
|
-
64 && W(e, e = /*editable*/
|
|
3237
|
-
i[29].id) ? (ot(), k(r, 1, 1, U), rt(), r = Ce(i), r.c(), N(r, 1), r.m(n.parentNode, n)) : r.p(i, a);
|
|
3238
|
-
},
|
|
3239
|
-
i(i) {
|
|
3240
|
-
o || (N(r), o = !0);
|
|
3241
|
-
},
|
|
3242
|
-
o(i) {
|
|
3243
|
-
k(r), o = !1;
|
|
3244
|
-
},
|
|
3245
|
-
d(i) {
|
|
3246
|
-
i && Y(n), r.d(i);
|
|
3247
|
-
}
|
|
3248
|
-
};
|
|
3249
|
-
}
|
|
3250
|
-
function tr(t) {
|
|
3251
|
-
let e, n, o, r, i, a, s = (
|
|
3252
|
-
/*$store*/
|
|
3253
|
-
t[13]
|
|
3254
|
-
), l = [];
|
|
3255
|
-
for (let c = 0; c < s.length; c += 1)
|
|
3256
|
-
l[c] = Me(Le(t, s, c));
|
|
3257
|
-
const d = (c) => k(l[c], 1, 1, () => {
|
|
3258
|
-
l[c] = null;
|
|
3259
|
-
});
|
|
3260
|
-
let p = (
|
|
3261
|
-
/*drawingEl*/
|
|
3262
|
-
t[4] && Be(t)
|
|
3263
|
-
);
|
|
3264
|
-
return {
|
|
3265
|
-
c() {
|
|
3266
|
-
e = R("svg"), n = R("g");
|
|
3267
|
-
for (let c = 0; c < l.length; c += 1)
|
|
3268
|
-
l[c].c();
|
|
3269
|
-
o = R("g"), p && p.c(), u(o, "class", "drawing"), u(e, "class", "a9s-annotationlayer"), pe(
|
|
3270
|
-
e,
|
|
3271
|
-
"drawing",
|
|
3272
|
-
/*tool*/
|
|
3273
|
-
t[12]
|
|
3274
|
-
);
|
|
3275
|
-
},
|
|
3276
|
-
m(c, g) {
|
|
3277
|
-
_(c, e, g), lt(e, n);
|
|
3278
|
-
for (let h = 0; h < l.length; h += 1)
|
|
3279
|
-
l[h] && l[h].m(n, null);
|
|
3280
|
-
lt(e, o), p && p.m(o, null), t[25](o), t[26](e), r = !0, i || (a = [
|
|
3281
|
-
z(e, "pointerup", function() {
|
|
3282
|
-
H(
|
|
3283
|
-
/*onPointerUp*/
|
|
3284
|
-
t[8]
|
|
3285
|
-
) && t[8].apply(this, arguments);
|
|
3286
|
-
}),
|
|
3287
|
-
z(e, "pointerdown", function() {
|
|
3288
|
-
H(
|
|
3289
|
-
/*onPointerDown*/
|
|
3290
|
-
t[9]
|
|
3291
|
-
) && t[9].apply(this, arguments);
|
|
3292
|
-
})
|
|
3293
|
-
], i = !0);
|
|
3294
|
-
},
|
|
3295
|
-
p(c, g) {
|
|
3296
|
-
if (t = c, g[0] & /*$store, style, isEditable*/
|
|
3297
|
-
8322) {
|
|
3298
|
-
s = /*$store*/
|
|
3299
|
-
t[13];
|
|
3300
|
-
let h;
|
|
3301
|
-
for (h = 0; h < s.length; h += 1) {
|
|
3302
|
-
const m = Le(t, s, h);
|
|
3303
|
-
l[h] ? (l[h].p(m, g), N(l[h], 1)) : (l[h] = Me(m), l[h].c(), N(l[h], 1), l[h].m(n, null));
|
|
3304
|
-
}
|
|
3305
|
-
for (ot(), h = s.length; h < l.length; h += 1)
|
|
3306
|
-
d(h);
|
|
3307
|
-
rt();
|
|
3308
|
-
}
|
|
3309
|
-
t[4] ? p ? (p.p(t, g), g[0] & /*drawingEl*/
|
|
3310
|
-
16 && N(p, 1)) : (p = Be(t), p.c(), N(p, 1), p.m(o, null)) : p && (ot(), k(p, 1, 1, () => {
|
|
3311
|
-
p = null;
|
|
3312
|
-
}), rt()), (!r || g[0] & /*tool*/
|
|
3313
|
-
4096) && pe(
|
|
3314
|
-
e,
|
|
3315
|
-
"drawing",
|
|
3316
|
-
/*tool*/
|
|
3317
|
-
t[12]
|
|
3318
|
-
);
|
|
3319
|
-
},
|
|
3320
|
-
i(c) {
|
|
3321
|
-
if (!r) {
|
|
3322
|
-
for (let g = 0; g < s.length; g += 1)
|
|
3323
|
-
N(l[g]);
|
|
3324
|
-
N(p), r = !0;
|
|
3325
|
-
}
|
|
3326
|
-
},
|
|
3327
|
-
o(c) {
|
|
3328
|
-
l = l.filter(Boolean);
|
|
3329
|
-
for (let g = 0; g < l.length; g += 1)
|
|
3330
|
-
k(l[g]);
|
|
3331
|
-
k(p), r = !1;
|
|
3332
|
-
},
|
|
3333
|
-
d(c) {
|
|
3334
|
-
c && Y(e), ie(l, c), p && p.d(), t[25](null), t[26](null), i = !1, it(a);
|
|
3335
|
-
}
|
|
3336
|
-
};
|
|
3337
|
-
}
|
|
3338
|
-
function er(t, e, n) {
|
|
3339
|
-
let o, r, i, a, s, l, d, p, c, g, h = U, m = () => (h(), h = De(f, (L) => n(14, g = L)), f);
|
|
3340
|
-
t.$$.on_destroy.push(() => h());
|
|
3341
|
-
let { drawingEnabled: x } = e, { image: A } = e, { preferredDrawingMode: $ } = e, { state: y } = e, { style: E = void 0 } = e, { toolName: v = re().length > 0 ? re()[0] : void 0 } = e, { user: X } = e, I, V, f;
|
|
3342
|
-
Mt(() => m(n(5, f = Lo(A, V))));
|
|
3343
|
-
const { selection: b, store: w } = y;
|
|
3344
|
-
he(t, b, (L) => n(24, p = L)), he(t, w, (L) => n(13, c = L));
|
|
3345
|
-
let S = null, M = null;
|
|
3346
|
-
const C = (L) => {
|
|
3347
|
-
w.unobserve(S);
|
|
3348
|
-
const q = L.filter(({ editable: F }) => F).map(({ id: F }) => F);
|
|
3349
|
-
q.length > 0 ? (n(6, M = q.map((F) => w.getAnnotation(F))), S = (F) => {
|
|
3350
|
-
const { updated: Q } = F.changes;
|
|
3351
|
-
n(6, M = Q.map((P) => P.newValue));
|
|
3352
|
-
}, w.observe(S, { annotations: q })) : n(6, M = null);
|
|
3353
|
-
}, K = (L) => {
|
|
3354
|
-
const q = je(), F = {
|
|
3355
|
-
id: q,
|
|
3356
|
-
bodies: [],
|
|
3357
|
-
target: {
|
|
3358
|
-
annotation: q,
|
|
3359
|
-
selector: L.detail,
|
|
3360
|
-
creator: X,
|
|
3361
|
-
created: /* @__PURE__ */ new Date()
|
|
3362
|
-
}
|
|
3363
|
-
};
|
|
3364
|
-
w.addAnnotation(F), b.setSelected(F.id);
|
|
3365
|
-
}, gt = (L) => (q) => {
|
|
3366
|
-
var F;
|
|
3367
|
-
const { target: Q } = L, P = 10 * 60 * 1e3, st = ((F = Q.creator) == null ? void 0 : F.id) !== X.id || !Q.created || (/* @__PURE__ */ new Date()).getTime() - Q.created.getTime() > P;
|
|
3368
|
-
w.updateTarget({
|
|
3369
|
-
...Q,
|
|
3370
|
-
selector: q.detail,
|
|
3371
|
-
created: st ? Q.created : /* @__PURE__ */ new Date(),
|
|
3372
|
-
updated: st ? /* @__PURE__ */ new Date() : null,
|
|
3373
|
-
updatedBy: st ? X : null
|
|
3374
|
-
});
|
|
3375
|
-
};
|
|
3376
|
-
function ft(L) {
|
|
3377
|
-
Ut[L ? "unshift" : "push"](() => {
|
|
3378
|
-
I = L, n(4, I);
|
|
3379
|
-
});
|
|
3380
|
-
}
|
|
3381
|
-
function Tt(L) {
|
|
3382
|
-
Ut[L ? "unshift" : "push"](() => {
|
|
3383
|
-
V = L, n(3, V);
|
|
3384
|
-
});
|
|
3385
|
-
}
|
|
3386
|
-
return t.$$set = (L) => {
|
|
3387
|
-
"drawingEnabled" in L && n(0, x = L.drawingEnabled), "image" in L && n(19, A = L.image), "preferredDrawingMode" in L && n(20, $ = L.preferredDrawingMode), "state" in L && n(21, y = L.state), "style" in L && n(1, E = L.style), "toolName" in L && n(2, v = L.toolName), "user" in L && n(22, X = L.user);
|
|
3388
|
-
}, t.$$.update = () => {
|
|
3389
|
-
t.$$.dirty[0] & /*toolName*/
|
|
3390
|
-
4 && n(12, { tool: o, opts: r } = Je(v), o, (n(23, r), n(2, v))), t.$$.dirty[0] & /*opts, preferredDrawingMode*/
|
|
3391
|
-
9437184 && n(11, i = (r == null ? void 0 : r.drawingMode) || $), t.$$.dirty[0] & /*svgEl*/
|
|
3392
|
-
8 && n(10, a = Po(V)), t.$$.dirty[0] & /*svgEl*/
|
|
3393
|
-
8 && n(9, { onPointerDown: s, onPointerUp: l } = zo(V, w), s, (n(8, l), n(3, V))), t.$$.dirty[0] & /*$selection*/
|
|
3394
|
-
16777216 && n(7, d = (L) => p.selected.find((q) => q.id === L.id && q.editable)), t.$$.dirty[0] & /*$selection*/
|
|
3395
|
-
16777216 && C(p.selected);
|
|
3396
|
-
}, [
|
|
3397
|
-
x,
|
|
3398
|
-
E,
|
|
3399
|
-
v,
|
|
3400
|
-
V,
|
|
3401
|
-
I,
|
|
3402
|
-
f,
|
|
3403
|
-
M,
|
|
3404
|
-
d,
|
|
3405
|
-
l,
|
|
3406
|
-
s,
|
|
3407
|
-
a,
|
|
3408
|
-
i,
|
|
3409
|
-
o,
|
|
3410
|
-
c,
|
|
3411
|
-
g,
|
|
3412
|
-
b,
|
|
3413
|
-
w,
|
|
3414
|
-
K,
|
|
3415
|
-
gt,
|
|
3416
|
-
A,
|
|
3417
|
-
$,
|
|
3418
|
-
y,
|
|
3419
|
-
X,
|
|
3420
|
-
r,
|
|
3421
|
-
p,
|
|
3422
|
-
ft,
|
|
3423
|
-
Tt
|
|
3424
|
-
];
|
|
3425
|
-
}
|
|
3426
|
-
class nr extends nt {
|
|
3427
|
-
constructor(e) {
|
|
3428
|
-
super(), et(
|
|
3429
|
-
this,
|
|
3430
|
-
e,
|
|
3431
|
-
er,
|
|
3432
|
-
tr,
|
|
3433
|
-
W,
|
|
3434
|
-
{
|
|
3435
|
-
drawingEnabled: 0,
|
|
3436
|
-
image: 19,
|
|
3437
|
-
preferredDrawingMode: 20,
|
|
3438
|
-
state: 21,
|
|
3439
|
-
style: 1,
|
|
3440
|
-
toolName: 2,
|
|
3441
|
-
user: 22
|
|
3442
|
-
},
|
|
3443
|
-
null,
|
|
3444
|
-
[-1, -1]
|
|
3445
|
-
);
|
|
3446
|
-
}
|
|
3447
|
-
}
|
|
3448
|
-
function or(t, e, n, o, r) {
|
|
3449
|
-
Ze(t, e, n || 0, o || t.length - 1, r || rr);
|
|
3450
|
-
}
|
|
3451
|
-
function Ze(t, e, n, o, r) {
|
|
3452
|
-
for (; o > n; ) {
|
|
3453
|
-
if (o - n > 600) {
|
|
3454
|
-
var i = o - n + 1, a = e - n + 1, s = Math.log(i), l = 0.5 * Math.exp(2 * s / 3), d = 0.5 * Math.sqrt(s * l * (i - l) / i) * (a - i / 2 < 0 ? -1 : 1), p = Math.max(n, Math.floor(e - a * l / i + d)), c = Math.min(o, Math.floor(e + (i - a) * l / i + d));
|
|
3455
|
-
Ze(t, e, p, c, r);
|
|
3456
|
-
}
|
|
3457
|
-
var g = t[e], h = n, m = o;
|
|
3458
|
-
for (St(t, n, e), r(t[o], g) > 0 && St(t, n, o); h < m; ) {
|
|
3459
|
-
for (St(t, h, m), h++, m--; r(t[h], g) < 0; )
|
|
3460
|
-
h++;
|
|
3461
|
-
for (; r(t[m], g) > 0; )
|
|
3462
|
-
m--;
|
|
3463
|
-
}
|
|
3464
|
-
r(t[n], g) === 0 ? St(t, n, m) : (m++, St(t, m, o)), m <= e && (n = m + 1), e <= m && (o = m - 1);
|
|
3465
|
-
}
|
|
3466
|
-
}
|
|
3467
|
-
function St(t, e, n) {
|
|
3468
|
-
var o = t[e];
|
|
3469
|
-
t[e] = t[n], t[n] = o;
|
|
3470
|
-
}
|
|
3471
|
-
function rr(t, e) {
|
|
3472
|
-
return t < e ? -1 : t > e ? 1 : 0;
|
|
3473
|
-
}
|
|
3474
|
-
class ir {
|
|
3475
|
-
constructor(e = 9) {
|
|
3476
|
-
this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4)), this.clear();
|
|
3477
|
-
}
|
|
3478
|
-
all() {
|
|
3479
|
-
return this._all(this.data, []);
|
|
3480
|
-
}
|
|
3481
|
-
search(e) {
|
|
3482
|
-
let n = this.data;
|
|
3483
|
-
const o = [];
|
|
3484
|
-
if (!kt(e, n))
|
|
3485
|
-
return o;
|
|
3486
|
-
const r = this.toBBox, i = [];
|
|
3487
|
-
for (; n; ) {
|
|
3488
|
-
for (let a = 0; a < n.children.length; a++) {
|
|
3489
|
-
const s = n.children[a], l = n.leaf ? r(s) : s;
|
|
3490
|
-
kt(e, l) && (n.leaf ? o.push(s) : te(e, l) ? this._all(s, o) : i.push(s));
|
|
3491
|
-
}
|
|
3492
|
-
n = i.pop();
|
|
3493
|
-
}
|
|
3494
|
-
return o;
|
|
3495
|
-
}
|
|
3496
|
-
collides(e) {
|
|
3497
|
-
let n = this.data;
|
|
3498
|
-
if (!kt(e, n))
|
|
3499
|
-
return !1;
|
|
3500
|
-
const o = [];
|
|
3501
|
-
for (; n; ) {
|
|
3502
|
-
for (let r = 0; r < n.children.length; r++) {
|
|
3503
|
-
const i = n.children[r], a = n.leaf ? this.toBBox(i) : i;
|
|
3504
|
-
if (kt(e, a)) {
|
|
3505
|
-
if (n.leaf || te(e, a))
|
|
3506
|
-
return !0;
|
|
3507
|
-
o.push(i);
|
|
3508
|
-
}
|
|
3509
|
-
}
|
|
3510
|
-
n = o.pop();
|
|
3511
|
-
}
|
|
3512
|
-
return !1;
|
|
3513
|
-
}
|
|
3514
|
-
load(e) {
|
|
3515
|
-
if (!(e && e.length))
|
|
3516
|
-
return this;
|
|
3517
|
-
if (e.length < this._minEntries) {
|
|
3518
|
-
for (let o = 0; o < e.length; o++)
|
|
3519
|
-
this.insert(e[o]);
|
|
3520
|
-
return this;
|
|
3521
|
-
}
|
|
3522
|
-
let n = this._build(e.slice(), 0, e.length - 1, 0);
|
|
3523
|
-
if (!this.data.children.length)
|
|
3524
|
-
this.data = n;
|
|
3525
|
-
else if (this.data.height === n.height)
|
|
3526
|
-
this._splitRoot(this.data, n);
|
|
3527
|
-
else {
|
|
3528
|
-
if (this.data.height < n.height) {
|
|
3529
|
-
const o = this.data;
|
|
3530
|
-
this.data = n, n = o;
|
|
3531
|
-
}
|
|
3532
|
-
this._insert(n, this.data.height - n.height - 1, !0);
|
|
3533
|
-
}
|
|
3534
|
-
return this;
|
|
3535
|
-
}
|
|
3536
|
-
insert(e) {
|
|
3537
|
-
return e && this._insert(e, this.data.height - 1), this;
|
|
3538
|
-
}
|
|
3539
|
-
clear() {
|
|
3540
|
-
return this.data = bt([]), this;
|
|
3541
|
-
}
|
|
3542
|
-
remove(e, n) {
|
|
3543
|
-
if (!e)
|
|
3544
|
-
return this;
|
|
3545
|
-
let o = this.data;
|
|
3546
|
-
const r = this.toBBox(e), i = [], a = [];
|
|
3547
|
-
let s, l, d;
|
|
3548
|
-
for (; o || i.length; ) {
|
|
3549
|
-
if (o || (o = i.pop(), l = i[i.length - 1], s = a.pop(), d = !0), o.leaf) {
|
|
3550
|
-
const p = ar(e, o.children, n);
|
|
3551
|
-
if (p !== -1)
|
|
3552
|
-
return o.children.splice(p, 1), i.push(o), this._condense(i), this;
|
|
3553
|
-
}
|
|
3554
|
-
!d && !o.leaf && te(o, r) ? (i.push(o), a.push(s), s = 0, l = o, o = o.children[0]) : l ? (s++, o = l.children[s], d = !1) : o = null;
|
|
3555
|
-
}
|
|
3556
|
-
return this;
|
|
3557
|
-
}
|
|
3558
|
-
toBBox(e) {
|
|
3559
|
-
return e;
|
|
3560
|
-
}
|
|
3561
|
-
compareMinX(e, n) {
|
|
3562
|
-
return e.minX - n.minX;
|
|
3563
|
-
}
|
|
3564
|
-
compareMinY(e, n) {
|
|
3565
|
-
return e.minY - n.minY;
|
|
3566
|
-
}
|
|
3567
|
-
toJSON() {
|
|
3568
|
-
return this.data;
|
|
3569
|
-
}
|
|
3570
|
-
fromJSON(e) {
|
|
3571
|
-
return this.data = e, this;
|
|
3572
|
-
}
|
|
3573
|
-
_all(e, n) {
|
|
3574
|
-
const o = [];
|
|
3575
|
-
for (; e; )
|
|
3576
|
-
e.leaf ? n.push(...e.children) : o.push(...e.children), e = o.pop();
|
|
3577
|
-
return n;
|
|
3578
|
-
}
|
|
3579
|
-
_build(e, n, o, r) {
|
|
3580
|
-
const i = o - n + 1;
|
|
3581
|
-
let a = this._maxEntries, s;
|
|
3582
|
-
if (i <= a)
|
|
3583
|
-
return s = bt(e.slice(n, o + 1)), $t(s, this.toBBox), s;
|
|
3584
|
-
r || (r = Math.ceil(Math.log(i) / Math.log(a)), a = Math.ceil(i / Math.pow(a, r - 1))), s = bt([]), s.leaf = !1, s.height = r;
|
|
3585
|
-
const l = Math.ceil(i / a), d = l * Math.ceil(Math.sqrt(a));
|
|
3586
|
-
Re(e, n, o, d, this.compareMinX);
|
|
3587
|
-
for (let p = n; p <= o; p += d) {
|
|
3588
|
-
const c = Math.min(p + d - 1, o);
|
|
3589
|
-
Re(e, p, c, l, this.compareMinY);
|
|
3590
|
-
for (let g = p; g <= c; g += l) {
|
|
3591
|
-
const h = Math.min(g + l - 1, c);
|
|
3592
|
-
s.children.push(this._build(e, g, h, r - 1));
|
|
3593
|
-
}
|
|
3594
|
-
}
|
|
3595
|
-
return $t(s, this.toBBox), s;
|
|
3596
|
-
}
|
|
3597
|
-
_chooseSubtree(e, n, o, r) {
|
|
3598
|
-
for (; r.push(n), !(n.leaf || r.length - 1 === o); ) {
|
|
3599
|
-
let i = 1 / 0, a = 1 / 0, s;
|
|
3600
|
-
for (let l = 0; l < n.children.length; l++) {
|
|
3601
|
-
const d = n.children[l], p = Qt(d), c = dr(e, d) - p;
|
|
3602
|
-
c < a ? (a = c, i = p < i ? p : i, s = d) : c === a && p < i && (i = p, s = d);
|
|
3603
|
-
}
|
|
3604
|
-
n = s || n.children[0];
|
|
3605
|
-
}
|
|
3606
|
-
return n;
|
|
3607
|
-
}
|
|
3608
|
-
_insert(e, n, o) {
|
|
3609
|
-
const r = o ? e : this.toBBox(e), i = [], a = this._chooseSubtree(r, this.data, n, i);
|
|
3610
|
-
for (a.children.push(e), Lt(a, r); n >= 0 && i[n].children.length > this._maxEntries; )
|
|
3611
|
-
this._split(i, n), n--;
|
|
3612
|
-
this._adjustParentBBoxes(r, i, n);
|
|
3613
|
-
}
|
|
3614
|
-
// split overflowed node into two
|
|
3615
|
-
_split(e, n) {
|
|
3616
|
-
const o = e[n], r = o.children.length, i = this._minEntries;
|
|
3617
|
-
this._chooseSplitAxis(o, i, r);
|
|
3618
|
-
const a = this._chooseSplitIndex(o, i, r), s = bt(o.children.splice(a, o.children.length - a));
|
|
3619
|
-
s.height = o.height, s.leaf = o.leaf, $t(o, this.toBBox), $t(s, this.toBBox), n ? e[n - 1].children.push(s) : this._splitRoot(o, s);
|
|
3620
|
-
}
|
|
3621
|
-
_splitRoot(e, n) {
|
|
3622
|
-
this.data = bt([e, n]), this.data.height = e.height + 1, this.data.leaf = !1, $t(this.data, this.toBBox);
|
|
3623
|
-
}
|
|
3624
|
-
_chooseSplitIndex(e, n, o) {
|
|
3625
|
-
let r, i = 1 / 0, a = 1 / 0;
|
|
3626
|
-
for (let s = n; s <= o - n; s++) {
|
|
3627
|
-
const l = Ot(e, 0, s, this.toBBox), d = Ot(e, s, o, this.toBBox), p = cr(l, d), c = Qt(l) + Qt(d);
|
|
3628
|
-
p < i ? (i = p, r = s, a = c < a ? c : a) : p === i && c < a && (a = c, r = s);
|
|
3629
|
-
}
|
|
3630
|
-
return r || o - n;
|
|
3631
|
-
}
|
|
3632
|
-
// sorts node children by the best axis for split
|
|
3633
|
-
_chooseSplitAxis(e, n, o) {
|
|
3634
|
-
const r = e.leaf ? this.compareMinX : sr, i = e.leaf ? this.compareMinY : lr, a = this._allDistMargin(e, n, o, r), s = this._allDistMargin(e, n, o, i);
|
|
3635
|
-
a < s && e.children.sort(r);
|
|
3636
|
-
}
|
|
3637
|
-
// total margin of all possible split distributions where each node is at least m full
|
|
3638
|
-
_allDistMargin(e, n, o, r) {
|
|
3639
|
-
e.children.sort(r);
|
|
3640
|
-
const i = this.toBBox, a = Ot(e, 0, n, i), s = Ot(e, o - n, o, i);
|
|
3641
|
-
let l = Vt(a) + Vt(s);
|
|
3642
|
-
for (let d = n; d < o - n; d++) {
|
|
3643
|
-
const p = e.children[d];
|
|
3644
|
-
Lt(a, e.leaf ? i(p) : p), l += Vt(a);
|
|
3645
|
-
}
|
|
3646
|
-
for (let d = o - n - 1; d >= n; d--) {
|
|
3647
|
-
const p = e.children[d];
|
|
3648
|
-
Lt(s, e.leaf ? i(p) : p), l += Vt(s);
|
|
3649
|
-
}
|
|
3650
|
-
return l;
|
|
3651
|
-
}
|
|
3652
|
-
_adjustParentBBoxes(e, n, o) {
|
|
3653
|
-
for (let r = o; r >= 0; r--)
|
|
3654
|
-
Lt(n[r], e);
|
|
3655
|
-
}
|
|
3656
|
-
_condense(e) {
|
|
3657
|
-
for (let n = e.length - 1, o; n >= 0; n--)
|
|
3658
|
-
e[n].children.length === 0 ? n > 0 ? (o = e[n - 1].children, o.splice(o.indexOf(e[n]), 1)) : this.clear() : $t(e[n], this.toBBox);
|
|
3659
|
-
}
|
|
3660
|
-
}
|
|
3661
|
-
function ar(t, e, n) {
|
|
3662
|
-
if (!n)
|
|
3663
|
-
return e.indexOf(t);
|
|
3664
|
-
for (let o = 0; o < e.length; o++)
|
|
3665
|
-
if (n(t, e[o]))
|
|
3666
|
-
return o;
|
|
3667
|
-
return -1;
|
|
3668
|
-
}
|
|
3669
|
-
function $t(t, e) {
|
|
3670
|
-
Ot(t, 0, t.children.length, e, t);
|
|
3671
|
-
}
|
|
3672
|
-
function Ot(t, e, n, o, r) {
|
|
3673
|
-
r || (r = bt(null)), r.minX = 1 / 0, r.minY = 1 / 0, r.maxX = -1 / 0, r.maxY = -1 / 0;
|
|
3674
|
-
for (let i = e; i < n; i++) {
|
|
3675
|
-
const a = t.children[i];
|
|
3676
|
-
Lt(r, t.leaf ? o(a) : a);
|
|
3677
|
-
}
|
|
3678
|
-
return r;
|
|
3679
|
-
}
|
|
3680
|
-
function Lt(t, e) {
|
|
3681
|
-
return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;
|
|
3682
|
-
}
|
|
3683
|
-
function sr(t, e) {
|
|
3684
|
-
return t.minX - e.minX;
|
|
3685
|
-
}
|
|
3686
|
-
function lr(t, e) {
|
|
3687
|
-
return t.minY - e.minY;
|
|
3688
|
-
}
|
|
3689
|
-
function Qt(t) {
|
|
3690
|
-
return (t.maxX - t.minX) * (t.maxY - t.minY);
|
|
3691
|
-
}
|
|
3692
|
-
function Vt(t) {
|
|
3693
|
-
return t.maxX - t.minX + (t.maxY - t.minY);
|
|
3694
|
-
}
|
|
3695
|
-
function dr(t, e) {
|
|
3696
|
-
return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));
|
|
3697
|
-
}
|
|
3698
|
-
function cr(t, e) {
|
|
3699
|
-
const n = Math.max(t.minX, e.minX), o = Math.max(t.minY, e.minY), r = Math.min(t.maxX, e.maxX), i = Math.min(t.maxY, e.maxY);
|
|
3700
|
-
return Math.max(0, r - n) * Math.max(0, i - o);
|
|
3701
|
-
}
|
|
3702
|
-
function te(t, e) {
|
|
3703
|
-
return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;
|
|
3704
|
-
}
|
|
3705
|
-
function kt(t, e) {
|
|
3706
|
-
return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;
|
|
3707
|
-
}
|
|
3708
|
-
function bt(t) {
|
|
3709
|
-
return {
|
|
3710
|
-
children: t,
|
|
3711
|
-
height: 1,
|
|
3712
|
-
leaf: !0,
|
|
3713
|
-
minX: 1 / 0,
|
|
3714
|
-
minY: 1 / 0,
|
|
3715
|
-
maxX: -1 / 0,
|
|
3716
|
-
maxY: -1 / 0
|
|
3717
|
-
};
|
|
3718
|
-
}
|
|
3719
|
-
function Re(t, e, n, o, r) {
|
|
3720
|
-
const i = [e, n];
|
|
3721
|
-
for (; i.length; ) {
|
|
3722
|
-
if (n = i.pop(), e = i.pop(), n - e <= o)
|
|
3723
|
-
continue;
|
|
3724
|
-
const a = e + Math.ceil((n - e) / o / 2) * o;
|
|
3725
|
-
or(t, a, e, n, r), i.push(e, a, a, n);
|
|
3726
|
-
}
|
|
3727
|
-
}
|
|
3728
|
-
const ur = () => {
|
|
3729
|
-
const t = new ir(), e = /* @__PURE__ */ new Map(), n = () => [...e.values()], o = () => {
|
|
3730
|
-
t.clear(), e.clear();
|
|
3731
|
-
}, r = (a) => {
|
|
3732
|
-
const { minX: s, minY: l, maxX: d, maxY: p } = a.selector.geometry.bounds, c = { minX: s, minY: l, maxX: d, maxY: p, target: a };
|
|
3733
|
-
t.insert(c), e.set(a.annotation, c);
|
|
3734
|
-
}, i = (a) => {
|
|
3735
|
-
const s = e.get(a.annotation);
|
|
3736
|
-
t.remove(s), e.delete(a.annotation);
|
|
3737
|
-
};
|
|
3738
|
-
return {
|
|
3739
|
-
all: n,
|
|
3740
|
-
clear: o,
|
|
3741
|
-
getAt: (a, s) => {
|
|
3742
|
-
const l = t.search({
|
|
3743
|
-
minX: a,
|
|
3744
|
-
minY: s,
|
|
3745
|
-
maxX: a,
|
|
3746
|
-
maxY: s
|
|
3747
|
-
}).map((d) => d.target).filter((d) => d.selector.type === G.RECTANGLE || pn(d.selector, a, s));
|
|
3748
|
-
if (l.length > 0)
|
|
3749
|
-
return l.sort((d, p) => oe(d.selector) - oe(p.selector)), l[0];
|
|
3750
|
-
},
|
|
3751
|
-
getIntersecting: (a, s, l, d) => t.search({
|
|
3752
|
-
minX: a,
|
|
3753
|
-
minY: s,
|
|
3754
|
-
maxX: a + l,
|
|
3755
|
-
maxY: s + d
|
|
3756
|
-
}).map((p) => p.target),
|
|
3757
|
-
insert: r,
|
|
3758
|
-
remove: i,
|
|
3759
|
-
set: (a, s = !0) => {
|
|
3760
|
-
s && o();
|
|
3761
|
-
const l = a.map((d) => {
|
|
3762
|
-
const { minX: p, minY: c, maxX: g, maxY: h } = d.selector.geometry.bounds;
|
|
3763
|
-
return { minX: p, minY: c, maxX: g, maxY: h, target: d };
|
|
3764
|
-
});
|
|
3765
|
-
l.forEach((d) => e.set(d.target.annotation, d)), t.load(l);
|
|
3766
|
-
},
|
|
3767
|
-
size: () => t.all().length,
|
|
3768
|
-
update: (a, s) => {
|
|
3769
|
-
i(a), r(s);
|
|
3770
|
-
}
|
|
3771
|
-
};
|
|
3772
|
-
}, hr = (t) => {
|
|
3773
|
-
const e = Un(), n = ur(), o = Mn(e, t.pointerSelectAction), r = _n(e), i = jn();
|
|
3774
|
-
return e.observe(({ changes: a }) => {
|
|
3775
|
-
n.set(a.created.map((s) => s.target), !1), a.deleted.forEach((s) => n.remove(s.target)), a.updated.forEach(({ oldValue: s, newValue: l }) => n.update(s.target, l.target));
|
|
3776
|
-
}), {
|
|
3777
|
-
store: {
|
|
3778
|
-
...e,
|
|
3779
|
-
getAt: (a, s) => {
|
|
3780
|
-
const l = n.getAt(a, s);
|
|
3781
|
-
return l ? e.getAnnotation(l.annotation) : void 0;
|
|
3782
|
-
},
|
|
3783
|
-
getIntersecting: (a, s, l, d) => n.getIntersecting(a, s, l, d).map((p) => e.getAnnotation(p.annotation))
|
|
3784
|
-
},
|
|
3785
|
-
selection: o,
|
|
3786
|
-
hover: r,
|
|
3787
|
-
viewport: i
|
|
3788
|
-
};
|
|
3789
|
-
}, pr = (t) => {
|
|
3790
|
-
const e = hr(t);
|
|
3791
|
-
return {
|
|
3792
|
-
...e,
|
|
3793
|
-
store: Gn(e.store)
|
|
3794
|
-
};
|
|
3795
|
-
}, gr = (t) => {
|
|
3796
|
-
let e, n;
|
|
3797
|
-
if (t.nodeName === "CANVAS")
|
|
3798
|
-
e = t, n = e.getContext("2d", { willReadFrequently: !0 });
|
|
3799
|
-
else {
|
|
3800
|
-
const r = t;
|
|
3801
|
-
e = document.createElement("canvas"), e.width = r.width, e.height = r.height, n = e.getContext("2d", { willReadFrequently: !0 }), n.drawImage(r, 0, 0, r.width, r.height);
|
|
3802
|
-
}
|
|
3803
|
-
let o = 0;
|
|
3804
|
-
for (let r = 1; r < 10; r++)
|
|
3805
|
-
for (let i = 1; i < 10; i++) {
|
|
3806
|
-
const a = Math.round(i * e.width / 10), s = Math.round(r * e.height / 10), l = n.getImageData(a, s, 1, 1).data, d = (0.299 * l[0] + 0.587 * l[1] + 0.114 * l[2]) / 255;
|
|
3807
|
-
o += d;
|
|
3808
|
-
}
|
|
3809
|
-
return o / 81;
|
|
3810
|
-
}, fr = (t) => {
|
|
3811
|
-
const e = gr(t), n = e > 0.6 ? "dark" : "light";
|
|
3812
|
-
return console.log(`[Annotorious] Image brightness: ${e.toFixed(1)}. Setting ${n} theme.`), n;
|
|
3813
|
-
}, Ne = (t, e, n) => e.setAttribute("data-theme", n === "auto" ? fr(t) : n), mr = (t) => ({
|
|
3814
|
-
...t,
|
|
3815
|
-
drawingEnabled: t.drawingEnabled === void 0 ? !0 : t.drawingEnabled,
|
|
3816
|
-
drawingMode: t.drawingMode || "drag",
|
|
3817
|
-
pointerSelectAction: t.pointerSelectAction || ze.EDIT,
|
|
3818
|
-
theme: t.theme || "light"
|
|
3819
|
-
}), Ve = navigator.userAgent.indexOf("Mac OS X") !== -1, yr = (t, e) => {
|
|
3820
|
-
const n = e || document, o = (a) => {
|
|
3821
|
-
a.key === "Z" && a.ctrlKey ? t.undo() : a.key === "Y" && a.ctrlKey && t.redo();
|
|
3822
|
-
}, r = (a) => {
|
|
3823
|
-
a.key === "z" && a.metaKey && (a.shiftKey ? t.redo() : t.undo());
|
|
3824
|
-
}, i = () => {
|
|
3825
|
-
Ve ? n.removeEventListener("keydown", r) : n.removeEventListener("keydown", o);
|
|
3826
|
-
};
|
|
3827
|
-
return Ve ? n.addEventListener("keydown", r) : n.addEventListener("keydown", o), {
|
|
3828
|
-
destroy: i
|
|
3829
|
-
};
|
|
3830
|
-
}, xr = (t, e = {}) => {
|
|
3831
|
-
if (!t)
|
|
3832
|
-
throw "Missing argument: image";
|
|
3833
|
-
const n = typeof t == "string" ? document.getElementById(t) : t, o = mr(e), r = pr(o), { selection: i, store: a } = r, s = Pn(a), l = zn(
|
|
3834
|
-
r,
|
|
3835
|
-
s,
|
|
3836
|
-
o.adapter,
|
|
3837
|
-
o.autoSave
|
|
3838
|
-
), d = document.createElement("DIV");
|
|
3839
|
-
d.style.position = "relative", d.style.display = "inline-block", n.style.display = "block", n.parentNode.insertBefore(d, n), d.appendChild(n);
|
|
3840
|
-
const p = yr(s);
|
|
3841
|
-
let c = to();
|
|
3842
|
-
Ne(n, d, o.theme);
|
|
3843
|
-
const g = new nr({
|
|
3844
|
-
target: d,
|
|
3845
|
-
props: {
|
|
3846
|
-
drawingEnabled: o.drawingEnabled,
|
|
3847
|
-
image: n,
|
|
3848
|
-
preferredDrawingMode: o.drawingMode,
|
|
3849
|
-
state: r,
|
|
3850
|
-
style: o.style,
|
|
3851
|
-
user: c
|
|
3852
|
-
}
|
|
3853
|
-
});
|
|
3854
|
-
g.$on("click", (f) => {
|
|
3855
|
-
const { originalEvent: b, annotation: w } = f.detail;
|
|
3856
|
-
w ? i.clickSelect(w.id, b) : i.isEmpty() || i.clear();
|
|
3857
|
-
});
|
|
3858
|
-
const h = Wn(r, s, o.adapter), m = () => {
|
|
3859
|
-
g.$destroy(), d.parentNode.insertBefore(n, d), d.parentNode.removeChild(d), p.destroy(), s.destroy();
|
|
3860
|
-
}, x = () => c, A = (f, b, w) => Xo(f, b, w), $ = (f, b) => fo(f, b), y = (f) => {
|
|
3861
|
-
if (!Je(f))
|
|
3862
|
-
throw `No drawing tool named ${f}`;
|
|
3863
|
-
g.$set({ toolName: f });
|
|
3864
|
-
}, E = (f) => g.$set({ drawingEnabled: f }), v = (f) => {
|
|
3865
|
-
console.warn("Filter not implemented yet");
|
|
3866
|
-
}, X = (f) => g.$set({ style: f }), I = (f) => Ne(n, d, f), V = (f) => {
|
|
3867
|
-
c = f, g.$set({ user: f });
|
|
3868
|
-
};
|
|
3869
|
-
return {
|
|
3870
|
-
...h,
|
|
3871
|
-
destroy: m,
|
|
3872
|
-
getUser: x,
|
|
3873
|
-
listDrawingTools: re,
|
|
3874
|
-
on: l.on,
|
|
3875
|
-
off: l.off,
|
|
3876
|
-
registerDrawingTool: A,
|
|
3877
|
-
registerShapeEditor: $,
|
|
3878
|
-
setDrawingEnabled: E,
|
|
3879
|
-
setDrawingTool: y,
|
|
3880
|
-
setFilter: v,
|
|
3881
|
-
setStyle: X,
|
|
3882
|
-
setTheme: I,
|
|
3883
|
-
setUser: V,
|
|
3884
|
-
state: r
|
|
3885
|
-
};
|
|
28
|
+
e.style.left = `${t.right - o.width}px`, e.style.top = `${t.bottom + n}px`;
|
|
29
|
+
}, b = [g, y, a, r], m = b.indexOf(Math.max(...b));
|
|
30
|
+
m === 0 ? y > r ? $() : f() : m === 1 ? g > a ? C() : v() : m === 2 ? y > r ? E() : A() : g > a ? R() : B();
|
|
3886
31
|
};
|
|
3887
|
-
let wr = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
|
|
3888
|
-
wr();
|
|
3889
32
|
export {
|
|
3890
|
-
|
|
3891
|
-
xo as EditorMount,
|
|
3892
|
-
O as Handle,
|
|
3893
|
-
co as PolygonEditor,
|
|
3894
|
-
go as RectangleEditor,
|
|
3895
|
-
mn as RectangleUtil,
|
|
3896
|
-
To as RubberbandRectangle,
|
|
3897
|
-
nr as SVGAnnotationLayer,
|
|
3898
|
-
G as ShapeType,
|
|
3899
|
-
Eo as ToolMount,
|
|
3900
|
-
$r as W3CImageFormat,
|
|
3901
|
-
zo as addEventListeners,
|
|
3902
|
-
Gt as boundsFromPoints,
|
|
3903
|
-
oe as computeArea,
|
|
3904
|
-
xr as createImageAnnotator,
|
|
3905
|
-
hr as createImageAnnotatorState,
|
|
3906
|
-
Po as createSVGTransform,
|
|
3907
|
-
pr as createSvelteImageAnnotatorState,
|
|
3908
|
-
fr as detectTheme,
|
|
3909
|
-
Kt as distance,
|
|
3910
|
-
Lo as enableResponsive,
|
|
3911
|
-
mr as fillDefaults,
|
|
3912
|
-
Ee as getEditor,
|
|
3913
|
-
Je as getTool,
|
|
3914
|
-
yr as initKeyboardCommands,
|
|
3915
|
-
pn as intersects,
|
|
3916
|
-
re as listDrawingTools,
|
|
3917
|
-
yn as parseFragmentSelector,
|
|
3918
|
-
vn as parseSVGSelector,
|
|
3919
|
-
ro as parseW3CImageAnnotation,
|
|
3920
|
-
fo as registerEditor,
|
|
3921
|
-
se as registerShapeUtil,
|
|
3922
|
-
Xo as registerTool,
|
|
3923
|
-
gr as sampleBrightness,
|
|
3924
|
-
wn as serializeFragmentSelector,
|
|
3925
|
-
An as serializeSVGSelector,
|
|
3926
|
-
io as serializeW3CImageAnnotation,
|
|
3927
|
-
Ne as setTheme
|
|
33
|
+
T as setPosition
|
|
3928
34
|
};
|
|
3929
35
|
//# sourceMappingURL=annotorious-react.es18.js.map
|