@annotorious/svelte 3.0.0-rc.1 → 3.0.0-rc.10

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.
Files changed (33) hide show
  1. package/dist/annotorious-svelte.es.js +14 -6
  2. package/dist/annotorious-svelte.es.js.map +1 -1
  3. package/dist/annotorious-svelte.es10.js +120 -2
  4. package/dist/annotorious-svelte.es10.js.map +1 -1
  5. package/dist/annotorious-svelte.es11.js +2 -2
  6. package/dist/annotorious-svelte.es11.js.map +1 -1
  7. package/dist/annotorious-svelte.es12.js +20 -0
  8. package/dist/annotorious-svelte.es12.js.map +1 -0
  9. package/dist/annotorious-svelte.es13.js +7 -0
  10. package/dist/annotorious-svelte.es13.js.map +1 -0
  11. package/dist/annotorious-svelte.es14.js +11 -0
  12. package/dist/annotorious-svelte.es14.js.map +1 -0
  13. package/dist/annotorious-svelte.es15.js +10 -0
  14. package/dist/annotorious-svelte.es15.js.map +1 -0
  15. package/dist/annotorious-svelte.es2.js +1 -1
  16. package/dist/annotorious-svelte.es3.js +2 -110
  17. package/dist/annotorious-svelte.es3.js.map +1 -1
  18. package/dist/annotorious-svelte.es4.js +9 -123
  19. package/dist/annotorious-svelte.es4.js.map +1 -1
  20. package/dist/annotorious-svelte.es5.js +1204 -223
  21. package/dist/annotorious-svelte.es5.js.map +1 -1
  22. package/dist/annotorious-svelte.es6.js +108 -7
  23. package/dist/annotorious-svelte.es6.js.map +1 -1
  24. package/dist/annotorious-svelte.es7.js +125 -2
  25. package/dist/annotorious-svelte.es7.js.map +1 -1
  26. package/dist/annotorious-svelte.es8.js +238 -20518
  27. package/dist/annotorious-svelte.es8.js.map +1 -1
  28. package/dist/annotorious-svelte.es9.js +22148 -115
  29. package/dist/annotorious-svelte.es9.js.map +1 -1
  30. package/dist/index.d.ts +11 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/package.json +7 -2
  33. package/src/index.ts +53 -5
@@ -1,316 +1,1297 @@
1
- function g() {
1
+ function wt() {
2
2
  }
3
- function B(t, n) {
4
- for (const e in n)
5
- t[e] = n[e];
3
+ function Jt(t, n) {
4
+ for (const r in n)
5
+ t[r] = n[r];
6
6
  return t;
7
7
  }
8
- function S(t) {
8
+ function kt(t) {
9
9
  return t();
10
10
  }
11
- function N() {
11
+ function _t() {
12
12
  return /* @__PURE__ */ Object.create(null);
13
13
  }
14
- function p(t) {
15
- t.forEach(S);
14
+ function z(t) {
15
+ t.forEach(kt);
16
16
  }
17
- function E(t) {
17
+ function P(t) {
18
18
  return typeof t == "function";
19
19
  }
20
- function V(t, n) {
20
+ function Et(t, n) {
21
21
  return t != t ? n == n : t !== n || t && typeof t == "object" || typeof t == "function";
22
22
  }
23
- function F(t) {
23
+ function Kt(t) {
24
24
  return Object.keys(t).length === 0;
25
25
  }
26
- function P(t, ...n) {
27
- if (t == null)
28
- return g;
29
- const e = t.subscribe(...n);
30
- return e.unsubscribe ? () => e.unsubscribe() : e;
31
- }
32
- function W(t, n, e) {
33
- t.$$.on_destroy.push(P(n, e));
34
- }
35
- function X(t, n, e, r) {
26
+ function Zt(t, n, r, o) {
36
27
  if (t) {
37
- const o = L(t, n, e, r);
38
- return t[0](o);
28
+ const s = jt(t, n, r, o);
29
+ return t[0](s);
39
30
  }
40
31
  }
41
- function L(t, n, e, r) {
42
- return t[1] && r ? B(e.ctx.slice(), t[1](r(n))) : e.ctx;
32
+ function jt(t, n, r, o) {
33
+ return t[1] && o ? Jt(r.ctx.slice(), t[1](o(n))) : r.ctx;
43
34
  }
44
- function Y(t, n, e, r) {
45
- if (t[2] && r) {
46
- const o = t[2](r(e));
35
+ function Qt(t, n, r, o) {
36
+ if (t[2] && o) {
37
+ const s = t[2](o(r));
47
38
  if (n.dirty === void 0)
48
- return o;
49
- if (typeof o == "object") {
50
- const c = [], i = Math.max(n.dirty.length, o.length);
51
- for (let s = 0; s < i; s += 1)
52
- c[s] = n.dirty[s] | o[s];
53
- return c;
39
+ return s;
40
+ if (typeof s == "object") {
41
+ const a = [], c = Math.max(n.dirty.length, s.length);
42
+ for (let l = 0; l < c; l += 1)
43
+ a[l] = n.dirty[l] | s[l];
44
+ return a;
54
45
  }
55
- return n.dirty | o;
46
+ return n.dirty | s;
56
47
  }
57
48
  return n.dirty;
58
49
  }
59
- function Z(t, n, e, r, o, c) {
60
- if (o) {
61
- const i = L(n, e, r, c);
62
- t.p(i, o);
50
+ function Mt(t, n, r, o, s, a) {
51
+ if (s) {
52
+ const c = jt(n, r, o, a);
53
+ t.p(c, s);
63
54
  }
64
55
  }
65
- function tt(t) {
56
+ function Yt(t) {
66
57
  if (t.ctx.length > 32) {
67
- const n = [], e = t.ctx.length / 32;
68
- for (let r = 0; r < e; r++)
69
- n[r] = -1;
58
+ const n = [], r = t.ctx.length / 32;
59
+ for (let o = 0; o < r; o++)
60
+ n[o] = -1;
70
61
  return n;
71
62
  }
72
63
  return -1;
73
64
  }
74
- function nt(t) {
75
- return t && E(t.destroy) ? t.destroy : g;
76
- }
77
- function et(t, n) {
78
- t.appendChild(n);
65
+ function T(t, n, r) {
66
+ t.insertBefore(n, r || null);
79
67
  }
80
- function rt(t, n, e) {
81
- t.insertBefore(n, e || null);
82
- }
83
- function T(t) {
68
+ function w(t) {
84
69
  t.parentNode && t.parentNode.removeChild(t);
85
70
  }
86
- function ot(t) {
87
- return document.createElement(t);
71
+ function tn(t, n) {
72
+ for (let r = 0; r < t.length; r += 1)
73
+ t[r] && t[r].d(n);
74
+ }
75
+ function L(t) {
76
+ return document.createElementNS("http://www.w3.org/2000/svg", t);
88
77
  }
89
- function q(t) {
78
+ function Xt(t) {
90
79
  return document.createTextNode(t);
91
80
  }
92
- function ut() {
93
- return q("");
81
+ function C() {
82
+ return Xt(" ");
94
83
  }
95
- function it(t, n, e, r) {
96
- return t.addEventListener(n, e, r), () => t.removeEventListener(n, e, r);
84
+ function nn() {
85
+ return Xt("");
97
86
  }
98
- function ct(t, n, e) {
99
- e == null ? t.removeAttribute(n) : t.getAttribute(n) !== e && t.setAttribute(n, e);
87
+ function A(t, n, r, o) {
88
+ return t.addEventListener(n, r, o), () => t.removeEventListener(n, r, o);
100
89
  }
101
- function D(t) {
90
+ function e(t, n, r) {
91
+ r == null ? t.removeAttribute(n) : t.getAttribute(n) !== r && t.setAttribute(n, r);
92
+ }
93
+ function rn(t) {
102
94
  return Array.from(t.childNodes);
103
95
  }
104
- function ft(t, n) {
105
- n = "" + n, t.data !== n && (t.data = n);
96
+ function on(t, n, { bubbles: r = !1, cancelable: o = !1 } = {}) {
97
+ const s = document.createEvent("CustomEvent");
98
+ return s.initCustomEvent(t, r, o, n), s;
106
99
  }
107
- let m;
108
- function h(t) {
109
- m = t;
100
+ let Z;
101
+ function K(t) {
102
+ Z = t;
110
103
  }
111
- function v() {
112
- if (!m)
104
+ function en() {
105
+ if (!Z)
113
106
  throw new Error("Function called outside component initialization");
114
- return m;
115
- }
116
- function st(t) {
117
- v().$$.on_mount.push(t);
107
+ return Z;
118
108
  }
119
- function lt(t, n) {
120
- return v().$$.context.set(t, n), n;
109
+ function sn() {
110
+ const t = en();
111
+ return (n, r, { cancelable: o = !1 } = {}) => {
112
+ const s = t.$$.callbacks[n];
113
+ if (s) {
114
+ const a = on(n, r, { cancelable: o });
115
+ return s.slice().forEach((c) => {
116
+ c.call(t, a);
117
+ }), !a.defaultPrevented;
118
+ }
119
+ return !0;
120
+ };
121
121
  }
122
- function at(t) {
123
- return v().$$.context.get(t);
122
+ function q(t, n) {
123
+ const r = t.$$.callbacks[n.type];
124
+ r && r.slice().forEach((o) => o.call(this, n));
124
125
  }
125
- const d = [], O = [];
126
- let _ = [];
127
- const M = [], G = /* @__PURE__ */ Promise.resolve();
128
- let b = !1;
129
- function H() {
130
- b || (b = !0, G.then(z));
126
+ const W = [], It = [];
127
+ let J = [];
128
+ const Ft = [], an = /* @__PURE__ */ Promise.resolve();
129
+ let xt = !1;
130
+ function cn() {
131
+ xt || (xt = !0, an.then(Dt));
131
132
  }
132
- function w(t) {
133
- _.push(t);
133
+ function Tt(t) {
134
+ J.push(t);
134
135
  }
135
- const $ = /* @__PURE__ */ new Set();
136
- let a = 0;
137
- function z() {
138
- if (a !== 0)
136
+ const $t = /* @__PURE__ */ new Set();
137
+ let V = 0;
138
+ function Dt() {
139
+ if (V !== 0)
139
140
  return;
140
- const t = m;
141
+ const t = Z;
141
142
  do {
142
143
  try {
143
- for (; a < d.length; ) {
144
- const n = d[a];
145
- a++, h(n), I(n.$$);
144
+ for (; V < W.length; ) {
145
+ const n = W[V];
146
+ V++, K(n), ln(n.$$);
146
147
  }
147
148
  } catch (n) {
148
- throw d.length = 0, a = 0, n;
149
+ throw W.length = 0, V = 0, n;
149
150
  }
150
- for (h(null), d.length = 0, a = 0; O.length; )
151
- O.pop()();
152
- for (let n = 0; n < _.length; n += 1) {
153
- const e = _[n];
154
- $.has(e) || ($.add(e), e());
151
+ for (K(null), W.length = 0, V = 0; It.length; )
152
+ It.pop()();
153
+ for (let n = 0; n < J.length; n += 1) {
154
+ const r = J[n];
155
+ $t.has(r) || ($t.add(r), r());
155
156
  }
156
- _.length = 0;
157
- } while (d.length);
158
- for (; M.length; )
159
- M.pop()();
160
- b = !1, $.clear(), h(t);
157
+ J.length = 0;
158
+ } while (W.length);
159
+ for (; Ft.length; )
160
+ Ft.pop()();
161
+ xt = !1, $t.clear(), K(t);
161
162
  }
162
- function I(t) {
163
+ function ln(t) {
163
164
  if (t.fragment !== null) {
164
- t.update(), p(t.before_update);
165
+ t.update(), z(t.before_update);
165
166
  const n = t.dirty;
166
- t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, n), t.after_update.forEach(w);
167
+ t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, n), t.after_update.forEach(Tt);
167
168
  }
168
169
  }
169
- function J(t) {
170
- const n = [], e = [];
171
- _.forEach((r) => t.indexOf(r) === -1 ? n.push(r) : e.push(r)), e.forEach((r) => r()), _ = n;
172
- }
173
- const x = /* @__PURE__ */ new Set();
174
- let l;
175
- function dt() {
176
- l = {
177
- r: 0,
178
- c: [],
179
- p: l
180
- // parent group
181
- };
170
+ function un(t) {
171
+ const n = [], r = [];
172
+ J.forEach((o) => t.indexOf(o) === -1 ? n.push(o) : r.push(o)), r.forEach((o) => o()), J = n;
182
173
  }
183
- function _t() {
184
- l.r || p(l.c), l = l.p;
185
- }
186
- function K(t, n) {
187
- t && t.i && (x.delete(t), t.i(n));
174
+ const ut = /* @__PURE__ */ new Set();
175
+ let pn;
176
+ function pt(t, n) {
177
+ t && t.i && (ut.delete(t), t.i(n));
188
178
  }
189
- function ht(t, n, e, r) {
179
+ function Ot(t, n, r, o) {
190
180
  if (t && t.o) {
191
- if (x.has(t))
181
+ if (ut.has(t))
192
182
  return;
193
- x.add(t), l.c.push(() => {
194
- x.delete(t), r && (e && t.d(1), r());
183
+ ut.add(t), pn.c.push(() => {
184
+ ut.delete(t), o && (r && t.d(1), o());
195
185
  }), t.o(n);
196
186
  } else
197
- r && r();
198
- }
199
- function Q(t, n, e, r) {
200
- const { fragment: o, after_update: c } = t.$$;
201
- o && o.m(n, e), r || w(() => {
202
- const i = t.$$.on_mount.map(S).filter(E);
203
- t.$$.on_destroy ? t.$$.on_destroy.push(...i) : p(i), t.$$.on_mount = [];
204
- }), c.forEach(w);
205
- }
206
- function R(t, n) {
207
- const e = t.$$;
208
- e.fragment !== null && (J(e.after_update), p(e.on_destroy), e.fragment && e.fragment.d(n), e.on_destroy = e.fragment = null, e.ctx = []);
209
- }
210
- function U(t, n) {
211
- t.$$.dirty[0] === -1 && (d.push(t), H(), t.$$.dirty.fill(0)), t.$$.dirty[n / 31 | 0] |= 1 << n % 31;
212
- }
213
- function gt(t, n, e, r, o, c, i, s = [-1]) {
214
- const y = m;
215
- h(t);
216
- const u = t.$$ = {
187
+ o && o();
188
+ }
189
+ function zt(t) {
190
+ t && t.c();
191
+ }
192
+ function bt(t, n, r, o) {
193
+ const { fragment: s, after_update: a } = t.$$;
194
+ s && s.m(n, r), o || Tt(() => {
195
+ const c = t.$$.on_mount.map(kt).filter(P);
196
+ t.$$.on_destroy ? t.$$.on_destroy.push(...c) : z(c), t.$$.on_mount = [];
197
+ }), a.forEach(Tt);
198
+ }
199
+ function St(t, n) {
200
+ const r = t.$$;
201
+ r.fragment !== null && (un(r.after_update), z(r.on_destroy), r.fragment && r.fragment.d(n), r.on_destroy = r.fragment = null, r.ctx = []);
202
+ }
203
+ function hn(t, n) {
204
+ t.$$.dirty[0] === -1 && (W.push(t), cn(), t.$$.dirty.fill(0)), t.$$.dirty[n / 31 | 0] |= 1 << n % 31;
205
+ }
206
+ function vt(t, n, r, o, s, a, c, l = [-1]) {
207
+ const u = Z;
208
+ K(t);
209
+ const d = t.$$ = {
217
210
  fragment: null,
218
211
  ctx: [],
219
212
  // state
220
- props: c,
221
- update: g,
222
- not_equal: o,
223
- bound: N(),
213
+ props: a,
214
+ update: wt,
215
+ not_equal: s,
216
+ bound: _t(),
224
217
  // lifecycle
225
218
  on_mount: [],
226
219
  on_destroy: [],
227
220
  on_disconnect: [],
228
221
  before_update: [],
229
222
  after_update: [],
230
- context: new Map(n.context || (y ? y.$$.context : [])),
223
+ context: new Map(n.context || (u ? u.$$.context : [])),
231
224
  // everything else
232
- callbacks: N(),
233
- dirty: s,
225
+ callbacks: _t(),
226
+ dirty: l,
234
227
  skip_bound: !1,
235
- root: n.target || y.$$.root
228
+ root: n.target || u.$$.root
236
229
  };
237
- i && i(u.root);
238
- let k = !1;
239
- if (u.ctx = e ? e(t, n.props || {}, (f, j, ...C) => {
240
- const A = C.length ? C[0] : j;
241
- return u.ctx && o(u.ctx[f], u.ctx[f] = A) && (!u.skip_bound && u.bound[f] && u.bound[f](A), k && U(t, f)), j;
242
- }) : [], u.update(), k = !0, p(u.before_update), u.fragment = r ? r(u.ctx) : !1, n.target) {
230
+ c && c(d.root);
231
+ let x = !1;
232
+ if (d.ctx = r ? r(t, n.props || {}, ($, g, ...i) => {
233
+ const m = i.length ? i[0] : g;
234
+ return d.ctx && s(d.ctx[$], d.ctx[$] = m) && (!d.skip_bound && d.bound[$] && d.bound[$](m), x && hn(t, $)), g;
235
+ }) : [], d.update(), x = !0, z(d.before_update), d.fragment = o ? o(d.ctx) : !1, n.target) {
243
236
  if (n.hydrate) {
244
- const f = D(n.target);
245
- u.fragment && u.fragment.l(f), f.forEach(T);
237
+ const $ = rn(n.target);
238
+ d.fragment && d.fragment.l($), $.forEach(w);
246
239
  } else
247
- u.fragment && u.fragment.c();
248
- n.intro && K(t.$$.fragment), Q(t, n.target, n.anchor, n.customElement), z();
240
+ d.fragment && d.fragment.c();
241
+ n.intro && pt(t.$$.fragment), bt(t, n.target, n.anchor, n.customElement), Dt();
249
242
  }
250
- h(y);
243
+ K(u);
251
244
  }
252
- class mt {
245
+ class Pt {
253
246
  $destroy() {
254
- R(this, 1), this.$destroy = g;
247
+ St(this, 1), this.$destroy = wt;
255
248
  }
256
- $on(n, e) {
257
- if (!E(e))
258
- return g;
259
- const r = this.$$.callbacks[n] || (this.$$.callbacks[n] = []);
260
- return r.push(e), () => {
261
- const o = r.indexOf(e);
262
- o !== -1 && r.splice(o, 1);
249
+ $on(n, r) {
250
+ if (!P(r))
251
+ return wt;
252
+ const o = this.$$.callbacks[n] || (this.$$.callbacks[n] = []);
253
+ return o.push(r), () => {
254
+ const s = o.indexOf(r);
255
+ s !== -1 && o.splice(s, 1);
263
256
  };
264
257
  }
265
258
  $set(n) {
266
- this.$$set && !F(n) && (this.$$.skip_bound = !0, this.$$set(n), this.$$.skip_bound = !1);
259
+ this.$$set && !Kt(n) && (this.$$.skip_bound = !0, this.$$set(n), this.$$.skip_bound = !1);
260
+ }
261
+ }
262
+ var U = /* @__PURE__ */ ((t) => (t.ELLIPSE = "ELLIPSE", t.POLYGON = "POLYGON", t.RECTANGLE = "RECTANGLE", t))(U || {});
263
+ const At = (t, n) => n, Vt = (t) => {
264
+ let n = 1 / 0, r = 1 / 0, o = -1 / 0, s = -1 / 0;
265
+ return t.forEach(([a, c]) => {
266
+ n = Math.min(n, a), r = Math.min(r, c), o = Math.max(o, a), s = Math.max(s, c);
267
+ }), { minX: n, minY: r, maxX: o, maxY: s };
268
+ }, fn = {
269
+ area: (t) => Math.PI * t.geometry.rx * t.geometry.ry,
270
+ intersects: (t, n, r) => {
271
+ const { cx: o, cy: s, rx: a, ry: c } = t.geometry, l = 0, u = Math.cos(l), d = Math.sin(l), x = n - o, $ = r - s, g = u * x + d * $, i = d * x - u * $;
272
+ return g * g / (a * a) + i * i / (c * c) <= 1;
273
+ }
274
+ };
275
+ At(U.ELLIPSE, fn);
276
+ const dn = {
277
+ area: (t) => {
278
+ const { points: n } = t.geometry;
279
+ let r = 0, o = n.length - 1;
280
+ for (let s = 0; s < n.length; s++)
281
+ r += (n[o][0] + n[s][0]) * (n[o][1] - n[s][1]), o = s;
282
+ return Math.abs(0.5 * r);
283
+ },
284
+ intersects: (t, n, r) => {
285
+ const { points: o } = t.geometry;
286
+ let s = !1;
287
+ for (let a = 0, c = o.length - 1; a < o.length; c = a++) {
288
+ const l = o[a][0], u = o[a][1], d = o[c][0], x = o[c][1];
289
+ u > r != x > r && n < (d - l) * (r - u) / (x - u) + l && (s = !s);
290
+ }
291
+ return s;
292
+ }
293
+ };
294
+ At(U.POLYGON, dn);
295
+ const mn = {
296
+ area: (t) => t.geometry.w * t.geometry.h,
297
+ intersects: (t, n, r) => n >= t.geometry.x && n <= t.geometry.x + t.geometry.w && r >= t.geometry.y && r <= t.geometry.y + t.geometry.h
298
+ };
299
+ At(U.RECTANGLE, mn);
300
+ const yn = (t, n = !1) => {
301
+ const r = typeof t == "string" ? t : t.value, o = /^(xywh)=(pixel|percent)?:?(.+?),(.+?),(.+?),(.+)*/g, s = [...r.matchAll(o)][0], [a, c, l, u, d, x, $] = s;
302
+ if (c !== "xywh")
303
+ throw new Error("Unsupported MediaFragment: " + r);
304
+ if (l && l !== "pixel")
305
+ throw new Error(`Unsupported MediaFragment unit: ${l}`);
306
+ const [g, i, m, h] = [u, d, x, $].map(parseFloat);
307
+ return {
308
+ type: U.RECTANGLE,
309
+ geometry: {
310
+ x: g,
311
+ y: i,
312
+ w: m,
313
+ h,
314
+ bounds: {
315
+ minX: g,
316
+ minY: n ? i - h : i,
317
+ maxX: g + m,
318
+ maxY: n ? i : i + h
319
+ }
320
+ }
321
+ };
322
+ }, gn = (t) => {
323
+ const { x: n, y: r, w: o, h: s } = t;
324
+ return {
325
+ type: "FragmentSelector",
326
+ conformsTo: "http://www.w3.org/TR/media-frags/",
327
+ value: `xywh=pixel:${n},${r},${o},${s}`
328
+ };
329
+ }, Wt = "http://www.w3.org/2000/svg", Gt = (t) => {
330
+ const n = (o) => {
331
+ Array.from(o.attributes).forEach((s) => {
332
+ s.name.startsWith("on") && o.removeAttribute(s.name);
333
+ });
334
+ }, r = t.getElementsByTagName("script");
335
+ return Array.from(r).reverse().forEach((o) => o.parentNode.removeChild(o)), Array.from(t.querySelectorAll("*")).forEach(n), t;
336
+ }, $n = (t) => {
337
+ const n = new XMLSerializer().serializeToString(t.documentElement).replace("<svg>", `<svg xmlns="${Wt}">`);
338
+ return new DOMParser().parseFromString(n, "image/svg+xml").documentElement;
339
+ }, wn = (t) => {
340
+ const n = new DOMParser().parseFromString(t, "image/svg+xml"), r = n.lookupPrefix(Wt), o = n.lookupNamespaceURI(null);
341
+ return r || o ? Gt(n).firstChild : Gt($n(n)).firstChild;
342
+ }, xn = (t) => {
343
+ const [n, r, o] = t.match(/(<polygon points=["|'])([^("|')]*)/) || [];
344
+ if (!o)
345
+ return;
346
+ const s = o.split(" ").map((a) => a.split(",").map(parseFloat));
347
+ return {
348
+ type: U.POLYGON,
349
+ geometry: {
350
+ points: s,
351
+ bounds: Vt(s)
352
+ }
353
+ };
354
+ }, Tn = (t) => {
355
+ const n = wn(t), r = parseFloat(n.getAttribute("cx")), o = parseFloat(n.getAttribute("cy")), s = parseFloat(n.getAttribute("rx")), a = parseFloat(n.getAttribute("ry")), c = {
356
+ minX: r - s,
357
+ minY: o - a,
358
+ maxX: r + s,
359
+ maxY: o + a
360
+ };
361
+ return {
362
+ type: U.ELLIPSE,
363
+ geometry: {
364
+ cx: r,
365
+ cy: o,
366
+ rx: s,
367
+ ry: a,
368
+ bounds: c
369
+ }
370
+ };
371
+ }, En = (t) => {
372
+ const n = typeof t == "string" ? t : t.value;
373
+ if (n.includes("<polygon points="))
374
+ return xn(n);
375
+ if (n.includes("<ellipse "))
376
+ return Tn(n);
377
+ }, On = (t) => {
378
+ let n;
379
+ if (t.type === U.POLYGON) {
380
+ const r = t.geometry, { points: o } = r;
381
+ n = `<svg><polygon points="${o.map((s) => s.join(",")).join(" ")}" /></svg>`;
382
+ } else if (t.type === U.ELLIPSE) {
383
+ const r = t.geometry;
384
+ n = `<svg><ellipse cx="${r.cx}" cy="${r.cy}" rx="${r.rx}" ry="${r.ry}" /></svg>`;
385
+ }
386
+ if (n)
387
+ return { type: "SvgSelector", value: n };
388
+ throw `Unsupported shape type: ${t.type}`;
389
+ };
390
+ let lt;
391
+ const bn = new Uint8Array(16);
392
+ function Sn() {
393
+ if (!lt && (lt = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !lt))
394
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
395
+ return lt(bn);
396
+ }
397
+ const b = [];
398
+ for (let t = 0; t < 256; ++t)
399
+ b.push((t + 256).toString(16).slice(1));
400
+ function vn(t, n = 0) {
401
+ return b[t[n + 0]] + b[t[n + 1]] + b[t[n + 2]] + b[t[n + 3]] + "-" + b[t[n + 4]] + b[t[n + 5]] + "-" + b[t[n + 6]] + b[t[n + 7]] + "-" + b[t[n + 8]] + b[t[n + 9]] + "-" + b[t[n + 10]] + b[t[n + 11]] + b[t[n + 12]] + b[t[n + 13]] + b[t[n + 14]] + b[t[n + 15]];
402
+ }
403
+ const Pn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ht = {
404
+ randomUUID: Pn
405
+ };
406
+ function An(t, n, r) {
407
+ if (Ht.randomUUID && !n && !t)
408
+ return Ht.randomUUID();
409
+ t = t || {};
410
+ const o = t.random || (t.rng || Sn)();
411
+ if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, n) {
412
+ r = r || 0;
413
+ for (let s = 0; s < 16; ++s)
414
+ n[r + s] = o[s];
415
+ return n;
416
+ }
417
+ return vn(o);
418
+ }
419
+ const Ln = [];
420
+ for (let t = 0; t < 256; ++t)
421
+ Ln.push((t + 256).toString(16).slice(1));
422
+ typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
423
+ let _n = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((n, r) => (r &= 63, r < 36 ? n += r.toString(36) : r < 62 ? n += (r - 26).toString(36).toUpperCase() : r > 62 ? n += "-" : n += "_", n), "");
424
+ const In = (t) => {
425
+ const n = JSON.stringify(t);
426
+ let r = 0;
427
+ for (let o = 0, s = n.length; o < s; o++) {
428
+ let a = n.charCodeAt(o);
429
+ r = (r << 5) - r + a, r |= 0;
430
+ }
431
+ return `${r}`;
432
+ }, Fn = (t, n) => (Array.isArray(t) ? t : [t]).map((r) => {
433
+ const { id: o, type: s, purpose: a, value: c, created: l, creator: u, ...d } = r;
434
+ return {
435
+ id: o || `temp-${In(r)}`,
436
+ annotation: n,
437
+ type: s,
438
+ purpose: a,
439
+ value: c,
440
+ created: l,
441
+ creator: u ? typeof u == "object" ? { ...u } : u : void 0,
442
+ ...d
443
+ };
444
+ }), Gn = (t) => t.map((n) => {
445
+ var r;
446
+ const o = { ...n };
447
+ return delete o.annotation, (r = o.id) != null && r.startsWith("temp-") && delete o.id, o;
448
+ });
449
+ _n();
450
+ const qn = (t, n = !1) => ({ parse: (r) => Hn(r, n), serialize: (r) => Rn(r, t) }), Hn = (t, n = !1) => {
451
+ const r = t.id || An(), { body: o, ...s } = t, a = Fn(o, r), c = Array.isArray(t.target) ? t.target[0] : t.target, l = Array.isArray(c.selector) ? c.selector[0] : c.selector, u = l.type === "FragmentSelector" ? yn(l, n) : l.type === "SvgSelector" ? En(l) : void 0;
452
+ return u ? {
453
+ parsed: {
454
+ ...s,
455
+ id: r,
456
+ bodies: a,
457
+ target: {
458
+ ...s.target,
459
+ annotation: r,
460
+ selector: u
461
+ }
462
+ }
463
+ } : {
464
+ error: Error(`Unknown selector type: ${l.type}`)
465
+ };
466
+ }, Rn = (t, n) => {
467
+ const r = t.target.selector, o = r.type == U.RECTANGLE ? gn(r.geometry) : On(r);
468
+ return {
469
+ ...t,
470
+ "@context": "http://www.w3.org/ns/anno.jsonld",
471
+ id: t.id,
472
+ type: "Annotation",
473
+ body: Gn(t.bodies),
474
+ target: {
475
+ source: n,
476
+ selector: o
477
+ }
478
+ };
479
+ };
480
+ function Rt(t, n, r) {
481
+ const o = t.slice();
482
+ return o[11] = n[r], o[13] = r, o;
483
+ }
484
+ function Ut(t) {
485
+ let n, r, o, s, a;
486
+ return {
487
+ c() {
488
+ n = L("rect"), e(n, "class", "a9s-corner-handle"), e(n, "x", r = /*point*/
489
+ t[11][0] - /*handleSize*/
490
+ t[3] / 2), e(n, "y", o = /*point*/
491
+ t[11][1] - /*handleSize*/
492
+ t[3] / 2), e(
493
+ n,
494
+ "height",
495
+ /*handleSize*/
496
+ t[3]
497
+ ), e(
498
+ n,
499
+ "width",
500
+ /*handleSize*/
501
+ t[3]
502
+ );
503
+ },
504
+ m(c, l) {
505
+ T(c, n, l), s || (a = A(n, "pointerdown", function() {
506
+ P(
507
+ /*grab*/
508
+ t[10](f(
509
+ /*idx*/
510
+ t[13]
511
+ ))
512
+ ) && t[10](f(
513
+ /*idx*/
514
+ t[13]
515
+ )).apply(this, arguments);
516
+ }), s = !0);
517
+ },
518
+ p(c, l) {
519
+ t = c, l & /*geom, handleSize*/
520
+ 24 && r !== (r = /*point*/
521
+ t[11][0] - /*handleSize*/
522
+ t[3] / 2) && e(n, "x", r), l & /*geom, handleSize*/
523
+ 24 && o !== (o = /*point*/
524
+ t[11][1] - /*handleSize*/
525
+ t[3] / 2) && e(n, "y", o), l & /*handleSize*/
526
+ 8 && e(
527
+ n,
528
+ "height",
529
+ /*handleSize*/
530
+ t[3]
531
+ ), l & /*handleSize*/
532
+ 8 && e(
533
+ n,
534
+ "width",
535
+ /*handleSize*/
536
+ t[3]
537
+ );
538
+ },
539
+ d(c) {
540
+ c && w(n), s = !1, a();
541
+ }
542
+ };
543
+ }
544
+ function Un(t) {
545
+ let n, r, o, s, a, c, l, u, d, x, $ = (
546
+ /*geom*/
547
+ t[4].points
548
+ ), g = [];
549
+ for (let i = 0; i < $.length; i += 1)
550
+ g[i] = Ut(Rt(t, $, i));
551
+ return {
552
+ c() {
553
+ n = L("polygon"), s = C(), a = L("polygon"), l = C();
554
+ for (let i = 0; i < g.length; i += 1)
555
+ g[i].c();
556
+ u = nn(), e(n, "class", "a9s-outer"), e(n, "style", r = /*computedStyle*/
557
+ t[1] ? "display:none;" : void 0), e(n, "points", o = /*geom*/
558
+ t[4].points.map(Nt).join(" ")), e(a, "class", "a9s-inner a9s-shape-handle"), e(
559
+ a,
560
+ "style",
561
+ /*computedStyle*/
562
+ t[1]
563
+ ), e(a, "points", c = /*geom*/
564
+ t[4].points.map(Ct).join(" "));
565
+ },
566
+ m(i, m) {
567
+ T(i, n, m), T(i, s, m), T(i, a, m), T(i, l, m);
568
+ for (let h = 0; h < g.length; h += 1)
569
+ g[h] && g[h].m(i, m);
570
+ T(i, u, m), d || (x = [
571
+ A(n, "pointerdown", function() {
572
+ P(
573
+ /*grab*/
574
+ t[10](f.SHAPE)
575
+ ) && t[10](f.SHAPE).apply(this, arguments);
576
+ }),
577
+ A(a, "pointerdown", function() {
578
+ P(
579
+ /*grab*/
580
+ t[10](f.SHAPE)
581
+ ) && t[10](f.SHAPE).apply(this, arguments);
582
+ })
583
+ ], d = !0);
584
+ },
585
+ p(i, m) {
586
+ if (t = i, m & /*computedStyle*/
587
+ 2 && r !== (r = /*computedStyle*/
588
+ t[1] ? "display:none;" : void 0) && e(n, "style", r), m & /*geom*/
589
+ 16 && o !== (o = /*geom*/
590
+ t[4].points.map(Nt).join(" ")) && e(n, "points", o), m & /*computedStyle*/
591
+ 2 && e(
592
+ a,
593
+ "style",
594
+ /*computedStyle*/
595
+ t[1]
596
+ ), m & /*geom*/
597
+ 16 && c !== (c = /*geom*/
598
+ t[4].points.map(Ct).join(" ")) && e(a, "points", c), m & /*geom, handleSize, grab, Handle*/
599
+ 1048) {
600
+ $ = /*geom*/
601
+ t[4].points;
602
+ let h;
603
+ for (h = 0; h < $.length; h += 1) {
604
+ const E = Rt(t, $, h);
605
+ g[h] ? g[h].p(E, m) : (g[h] = Ut(E), g[h].c(), g[h].m(u.parentNode, u));
606
+ }
607
+ for (; h < g.length; h += 1)
608
+ g[h].d(1);
609
+ g.length = $.length;
610
+ }
611
+ },
612
+ d(i) {
613
+ i && w(n), i && w(s), i && w(a), i && w(l), tn(g, i), i && w(u), d = !1, z(x);
614
+ }
615
+ };
616
+ }
617
+ function Nn(t) {
618
+ let n, r;
619
+ return n = new qt({
620
+ props: {
621
+ shape: (
622
+ /*shape*/
623
+ t[0]
624
+ ),
625
+ transform: (
626
+ /*transform*/
627
+ t[2]
628
+ ),
629
+ editor: (
630
+ /*editor*/
631
+ t[5]
632
+ ),
633
+ $$slots: {
634
+ default: [
635
+ Un,
636
+ ({ grab: o }) => ({ 10: o }),
637
+ ({ grab: o }) => o ? 1024 : 0
638
+ ]
639
+ },
640
+ $$scope: { ctx: t }
641
+ }
642
+ }), n.$on(
643
+ "change",
644
+ /*change_handler*/
645
+ t[7]
646
+ ), n.$on(
647
+ "grab",
648
+ /*grab_handler*/
649
+ t[8]
650
+ ), n.$on(
651
+ "release",
652
+ /*release_handler*/
653
+ t[9]
654
+ ), {
655
+ c() {
656
+ zt(n.$$.fragment);
657
+ },
658
+ m(o, s) {
659
+ bt(n, o, s), r = !0;
660
+ },
661
+ p(o, [s]) {
662
+ const a = {};
663
+ s & /*shape*/
664
+ 1 && (a.shape = /*shape*/
665
+ o[0]), s & /*transform*/
666
+ 4 && (a.transform = /*transform*/
667
+ o[2]), s & /*$$scope, geom, handleSize, grab, computedStyle*/
668
+ 17434 && (a.$$scope = { dirty: s, ctx: o }), n.$set(a);
669
+ },
670
+ i(o) {
671
+ r || (pt(n.$$.fragment, o), r = !0);
672
+ },
673
+ o(o) {
674
+ Ot(n.$$.fragment, o), r = !1;
675
+ },
676
+ d(o) {
677
+ St(n, o);
678
+ }
679
+ };
680
+ }
681
+ const Nt = (t) => t.join(","), Ct = (t) => t.join(",");
682
+ function Cn(t, n, r) {
683
+ let o, s, { shape: a } = n, { computedStyle: c = void 0 } = n, { transform: l } = n, { viewportScale: u = 1 } = n;
684
+ const d = (i, m, h) => {
685
+ let E;
686
+ m === f.SHAPE ? E = i.geometry.points.map(([v, O]) => [v + h[0], O + h[1]]) : E = i.geometry.points.map(([v, O], N) => m === f(N) ? [v + h[0], O + h[1]] : [v, O]);
687
+ const _ = Vt(E);
688
+ return { ...i, geometry: { points: E, bounds: _ } };
689
+ };
690
+ function x(i) {
691
+ q.call(this, t, i);
692
+ }
693
+ function $(i) {
694
+ q.call(this, t, i);
695
+ }
696
+ function g(i) {
697
+ q.call(this, t, i);
698
+ }
699
+ return t.$$set = (i) => {
700
+ "shape" in i && r(0, a = i.shape), "computedStyle" in i && r(1, c = i.computedStyle), "transform" in i && r(2, l = i.transform), "viewportScale" in i && r(6, u = i.viewportScale);
701
+ }, t.$$.update = () => {
702
+ t.$$.dirty & /*shape*/
703
+ 1 && r(4, o = a.geometry), t.$$.dirty & /*viewportScale*/
704
+ 64 && r(3, s = 10 / u);
705
+ }, [
706
+ a,
707
+ c,
708
+ l,
709
+ s,
710
+ o,
711
+ d,
712
+ u,
713
+ x,
714
+ $,
715
+ g
716
+ ];
717
+ }
718
+ class Bn extends Pt {
719
+ constructor(n) {
720
+ super(), vt(this, n, Cn, Nn, Et, {
721
+ shape: 0,
722
+ computedStyle: 1,
723
+ transform: 2,
724
+ viewportScale: 6
725
+ });
726
+ }
727
+ }
728
+ function kn(t) {
729
+ let n, r, o, s, a, c, l, u, d, x, $, g, i, m, h, E, _, v, O, N, B, k, j, S, X, D, Q, ht, R, M, Y, tt, ft, I, nt, rt, dt, F, ot, et, mt, G, st, at, yt, H, it, ct, gt, Lt;
730
+ return {
731
+ c() {
732
+ n = L("rect"), l = C(), u = L("rect"), i = C(), m = L("rect"), v = C(), O = L("rect"), j = C(), S = L("rect"), ht = C(), R = L("rect"), ft = C(), I = L("rect"), dt = C(), F = L("rect"), mt = C(), G = L("rect"), yt = C(), H = L("rect"), e(n, "class", "a9s-outer"), e(n, "style", r = /*computedStyle*/
733
+ t[1] ? "display:none;" : void 0), e(n, "x", o = /*geom*/
734
+ t[4].x), e(n, "y", s = /*geom*/
735
+ t[4].y), e(n, "width", a = /*geom*/
736
+ t[4].w), e(n, "height", c = /*geom*/
737
+ t[4].h), e(u, "class", "a9s-inner a9s-shape-handle"), e(
738
+ u,
739
+ "style",
740
+ /*computedStyle*/
741
+ t[1]
742
+ ), e(u, "x", d = /*geom*/
743
+ t[4].x), e(u, "y", x = /*geom*/
744
+ t[4].y), e(u, "width", $ = /*geom*/
745
+ t[4].w), e(u, "height", g = /*geom*/
746
+ t[4].h), e(m, "class", "a9s-edge-handle a9s-edge-handle-top"), e(m, "x", h = /*geom*/
747
+ t[4].x), e(m, "y", E = /*geom*/
748
+ t[4].y), e(m, "height", 1), e(m, "width", _ = /*geom*/
749
+ t[4].w), e(O, "class", "a9s-edge-handle a9s-edge-handle-right"), e(O, "x", N = /*geom*/
750
+ t[4].x + /*geom*/
751
+ t[4].w), e(O, "y", B = /*geom*/
752
+ t[4].y), e(O, "height", k = /*geom*/
753
+ t[4].h), e(O, "width", 1), e(S, "class", "a9s-edge-handle a9s-edge-handle-bottom"), e(S, "x", X = /*geom*/
754
+ t[4].x), e(S, "y", D = /*geom*/
755
+ t[4].y + /*geom*/
756
+ t[4].h), e(S, "height", 1), e(S, "width", Q = /*geom*/
757
+ t[4].w), e(R, "class", "a9s-edge-handle a9s-edge-handle-left"), e(R, "x", M = /*geom*/
758
+ t[4].x), e(R, "y", Y = /*geom*/
759
+ t[4].y), e(R, "height", tt = /*geom*/
760
+ t[4].h), e(R, "width", 1), e(I, "class", "a9s-corner-handle a9s-corner-handle-topleft"), e(I, "x", nt = /*geom*/
761
+ t[4].x - /*handleSize*/
762
+ t[3] / 2), e(I, "y", rt = /*geom*/
763
+ t[4].y - /*handleSize*/
764
+ t[3] / 2), e(
765
+ I,
766
+ "height",
767
+ /*handleSize*/
768
+ t[3]
769
+ ), e(
770
+ I,
771
+ "width",
772
+ /*handleSize*/
773
+ t[3]
774
+ ), e(F, "class", "a9s-corner-handle a9s-corner-handle-topright"), e(F, "x", ot = /*geom*/
775
+ t[4].x + /*geom*/
776
+ t[4].w - /*handleSize*/
777
+ t[3] / 2), e(F, "y", et = /*geom*/
778
+ t[4].y - /*handleSize*/
779
+ t[3] / 2), e(
780
+ F,
781
+ "height",
782
+ /*handleSize*/
783
+ t[3]
784
+ ), e(
785
+ F,
786
+ "width",
787
+ /*handleSize*/
788
+ t[3]
789
+ ), e(G, "class", "a9s-corner-handle a9s-corner-handle-bottomright"), e(G, "x", st = /*geom*/
790
+ t[4].x + /*geom*/
791
+ t[4].w - /*handleSize*/
792
+ t[3] / 2), e(G, "y", at = /*geom*/
793
+ t[4].y + /*geom*/
794
+ t[4].h - /*handleSize*/
795
+ t[3] / 2), e(
796
+ G,
797
+ "height",
798
+ /*handleSize*/
799
+ t[3]
800
+ ), e(
801
+ G,
802
+ "width",
803
+ /*handleSize*/
804
+ t[3]
805
+ ), e(H, "class", "a9s-corner-handle a9s-corner-handle-bottomleft"), e(H, "x", it = /*geom*/
806
+ t[4].x - /*handleSize*/
807
+ t[3] / 2), e(H, "y", ct = /*geom*/
808
+ t[4].y + /*geom*/
809
+ t[4].h - /*handleSize*/
810
+ t[3] / 2), e(
811
+ H,
812
+ "height",
813
+ /*handleSize*/
814
+ t[3]
815
+ ), e(
816
+ H,
817
+ "width",
818
+ /*handleSize*/
819
+ t[3]
820
+ );
821
+ },
822
+ m(y, p) {
823
+ T(y, n, p), T(y, l, p), T(y, u, p), T(y, i, p), T(y, m, p), T(y, v, p), T(y, O, p), T(y, j, p), T(y, S, p), T(y, ht, p), T(y, R, p), T(y, ft, p), T(y, I, p), T(y, dt, p), T(y, F, p), T(y, mt, p), T(y, G, p), T(y, yt, p), T(y, H, p), gt || (Lt = [
824
+ A(n, "pointerdown", function() {
825
+ P(
826
+ /*grab*/
827
+ t[10](f.SHAPE)
828
+ ) && t[10](f.SHAPE).apply(this, arguments);
829
+ }),
830
+ A(u, "pointerdown", function() {
831
+ P(
832
+ /*grab*/
833
+ t[10](f.SHAPE)
834
+ ) && t[10](f.SHAPE).apply(this, arguments);
835
+ }),
836
+ A(m, "pointerdown", function() {
837
+ P(
838
+ /*grab*/
839
+ t[10](f.TOP)
840
+ ) && t[10](f.TOP).apply(this, arguments);
841
+ }),
842
+ A(O, "pointerdown", function() {
843
+ P(
844
+ /*grab*/
845
+ t[10](f.RIGHT)
846
+ ) && t[10](f.RIGHT).apply(this, arguments);
847
+ }),
848
+ A(S, "pointerdown", function() {
849
+ P(
850
+ /*grab*/
851
+ t[10](f.BOTTOM)
852
+ ) && t[10](f.BOTTOM).apply(this, arguments);
853
+ }),
854
+ A(R, "pointerdown", function() {
855
+ P(
856
+ /*grab*/
857
+ t[10](f.LEFT)
858
+ ) && t[10](f.LEFT).apply(this, arguments);
859
+ }),
860
+ A(I, "pointerdown", function() {
861
+ P(
862
+ /*grab*/
863
+ t[10](f.TOP_LEFT)
864
+ ) && t[10](f.TOP_LEFT).apply(this, arguments);
865
+ }),
866
+ A(F, "pointerdown", function() {
867
+ P(
868
+ /*grab*/
869
+ t[10](f.TOP_RIGHT)
870
+ ) && t[10](f.TOP_RIGHT).apply(this, arguments);
871
+ }),
872
+ A(G, "pointerdown", function() {
873
+ P(
874
+ /*grab*/
875
+ t[10](f.BOTTOM_RIGHT)
876
+ ) && t[10](f.BOTTOM_RIGHT).apply(this, arguments);
877
+ }),
878
+ A(H, "pointerdown", function() {
879
+ P(
880
+ /*grab*/
881
+ t[10](f.BOTTOM_LEFT)
882
+ ) && t[10](f.BOTTOM_LEFT).apply(this, arguments);
883
+ })
884
+ ], gt = !0);
885
+ },
886
+ p(y, p) {
887
+ t = y, p & /*computedStyle*/
888
+ 2 && r !== (r = /*computedStyle*/
889
+ t[1] ? "display:none;" : void 0) && e(n, "style", r), p & /*geom*/
890
+ 16 && o !== (o = /*geom*/
891
+ t[4].x) && e(n, "x", o), p & /*geom*/
892
+ 16 && s !== (s = /*geom*/
893
+ t[4].y) && e(n, "y", s), p & /*geom*/
894
+ 16 && a !== (a = /*geom*/
895
+ t[4].w) && e(n, "width", a), p & /*geom*/
896
+ 16 && c !== (c = /*geom*/
897
+ t[4].h) && e(n, "height", c), p & /*computedStyle*/
898
+ 2 && e(
899
+ u,
900
+ "style",
901
+ /*computedStyle*/
902
+ t[1]
903
+ ), p & /*geom*/
904
+ 16 && d !== (d = /*geom*/
905
+ t[4].x) && e(u, "x", d), p & /*geom*/
906
+ 16 && x !== (x = /*geom*/
907
+ t[4].y) && e(u, "y", x), p & /*geom*/
908
+ 16 && $ !== ($ = /*geom*/
909
+ t[4].w) && e(u, "width", $), p & /*geom*/
910
+ 16 && g !== (g = /*geom*/
911
+ t[4].h) && e(u, "height", g), p & /*geom*/
912
+ 16 && h !== (h = /*geom*/
913
+ t[4].x) && e(m, "x", h), p & /*geom*/
914
+ 16 && E !== (E = /*geom*/
915
+ t[4].y) && e(m, "y", E), p & /*geom*/
916
+ 16 && _ !== (_ = /*geom*/
917
+ t[4].w) && e(m, "width", _), p & /*geom*/
918
+ 16 && N !== (N = /*geom*/
919
+ t[4].x + /*geom*/
920
+ t[4].w) && e(O, "x", N), p & /*geom*/
921
+ 16 && B !== (B = /*geom*/
922
+ t[4].y) && e(O, "y", B), p & /*geom*/
923
+ 16 && k !== (k = /*geom*/
924
+ t[4].h) && e(O, "height", k), p & /*geom*/
925
+ 16 && X !== (X = /*geom*/
926
+ t[4].x) && e(S, "x", X), p & /*geom*/
927
+ 16 && D !== (D = /*geom*/
928
+ t[4].y + /*geom*/
929
+ t[4].h) && e(S, "y", D), p & /*geom*/
930
+ 16 && Q !== (Q = /*geom*/
931
+ t[4].w) && e(S, "width", Q), p & /*geom*/
932
+ 16 && M !== (M = /*geom*/
933
+ t[4].x) && e(R, "x", M), p & /*geom*/
934
+ 16 && Y !== (Y = /*geom*/
935
+ t[4].y) && e(R, "y", Y), p & /*geom*/
936
+ 16 && tt !== (tt = /*geom*/
937
+ t[4].h) && e(R, "height", tt), p & /*geom, handleSize*/
938
+ 24 && nt !== (nt = /*geom*/
939
+ t[4].x - /*handleSize*/
940
+ t[3] / 2) && e(I, "x", nt), p & /*geom, handleSize*/
941
+ 24 && rt !== (rt = /*geom*/
942
+ t[4].y - /*handleSize*/
943
+ t[3] / 2) && e(I, "y", rt), p & /*handleSize*/
944
+ 8 && e(
945
+ I,
946
+ "height",
947
+ /*handleSize*/
948
+ t[3]
949
+ ), p & /*handleSize*/
950
+ 8 && e(
951
+ I,
952
+ "width",
953
+ /*handleSize*/
954
+ t[3]
955
+ ), p & /*geom, handleSize*/
956
+ 24 && ot !== (ot = /*geom*/
957
+ t[4].x + /*geom*/
958
+ t[4].w - /*handleSize*/
959
+ t[3] / 2) && e(F, "x", ot), p & /*geom, handleSize*/
960
+ 24 && et !== (et = /*geom*/
961
+ t[4].y - /*handleSize*/
962
+ t[3] / 2) && e(F, "y", et), p & /*handleSize*/
963
+ 8 && e(
964
+ F,
965
+ "height",
966
+ /*handleSize*/
967
+ t[3]
968
+ ), p & /*handleSize*/
969
+ 8 && e(
970
+ F,
971
+ "width",
972
+ /*handleSize*/
973
+ t[3]
974
+ ), p & /*geom, handleSize*/
975
+ 24 && st !== (st = /*geom*/
976
+ t[4].x + /*geom*/
977
+ t[4].w - /*handleSize*/
978
+ t[3] / 2) && e(G, "x", st), p & /*geom, handleSize*/
979
+ 24 && at !== (at = /*geom*/
980
+ t[4].y + /*geom*/
981
+ t[4].h - /*handleSize*/
982
+ t[3] / 2) && e(G, "y", at), p & /*handleSize*/
983
+ 8 && e(
984
+ G,
985
+ "height",
986
+ /*handleSize*/
987
+ t[3]
988
+ ), p & /*handleSize*/
989
+ 8 && e(
990
+ G,
991
+ "width",
992
+ /*handleSize*/
993
+ t[3]
994
+ ), p & /*geom, handleSize*/
995
+ 24 && it !== (it = /*geom*/
996
+ t[4].x - /*handleSize*/
997
+ t[3] / 2) && e(H, "x", it), p & /*geom, handleSize*/
998
+ 24 && ct !== (ct = /*geom*/
999
+ t[4].y + /*geom*/
1000
+ t[4].h - /*handleSize*/
1001
+ t[3] / 2) && e(H, "y", ct), p & /*handleSize*/
1002
+ 8 && e(
1003
+ H,
1004
+ "height",
1005
+ /*handleSize*/
1006
+ t[3]
1007
+ ), p & /*handleSize*/
1008
+ 8 && e(
1009
+ H,
1010
+ "width",
1011
+ /*handleSize*/
1012
+ t[3]
1013
+ );
1014
+ },
1015
+ d(y) {
1016
+ y && w(n), y && w(l), y && w(u), y && w(i), y && w(m), y && w(v), y && w(O), y && w(j), y && w(S), y && w(ht), y && w(R), y && w(ft), y && w(I), y && w(dt), y && w(F), y && w(mt), y && w(G), y && w(yt), y && w(H), gt = !1, z(Lt);
1017
+ }
1018
+ };
1019
+ }
1020
+ function jn(t) {
1021
+ let n, r;
1022
+ return n = new qt({
1023
+ props: {
1024
+ shape: (
1025
+ /*shape*/
1026
+ t[0]
1027
+ ),
1028
+ transform: (
1029
+ /*transform*/
1030
+ t[2]
1031
+ ),
1032
+ editor: (
1033
+ /*editor*/
1034
+ t[5]
1035
+ ),
1036
+ $$slots: {
1037
+ default: [
1038
+ kn,
1039
+ ({ grab: o }) => ({ 10: o }),
1040
+ ({ grab: o }) => o ? 1024 : 0
1041
+ ]
1042
+ },
1043
+ $$scope: { ctx: t }
1044
+ }
1045
+ }), n.$on(
1046
+ "grab",
1047
+ /*grab_handler*/
1048
+ t[7]
1049
+ ), n.$on(
1050
+ "change",
1051
+ /*change_handler*/
1052
+ t[8]
1053
+ ), n.$on(
1054
+ "release",
1055
+ /*release_handler*/
1056
+ t[9]
1057
+ ), {
1058
+ c() {
1059
+ zt(n.$$.fragment);
1060
+ },
1061
+ m(o, s) {
1062
+ bt(n, o, s), r = !0;
1063
+ },
1064
+ p(o, [s]) {
1065
+ const a = {};
1066
+ s & /*shape*/
1067
+ 1 && (a.shape = /*shape*/
1068
+ o[0]), s & /*transform*/
1069
+ 4 && (a.transform = /*transform*/
1070
+ o[2]), s & /*$$scope, geom, handleSize, grab, computedStyle*/
1071
+ 3098 && (a.$$scope = { dirty: s, ctx: o }), n.$set(a);
1072
+ },
1073
+ i(o) {
1074
+ r || (pt(n.$$.fragment, o), r = !0);
1075
+ },
1076
+ o(o) {
1077
+ Ot(n.$$.fragment, o), r = !1;
1078
+ },
1079
+ d(o) {
1080
+ St(n, o);
1081
+ }
1082
+ };
1083
+ }
1084
+ function Xn(t, n, r) {
1085
+ let o, s, { shape: a } = n, { computedStyle: c = void 0 } = n, { transform: l } = n, { viewportScale: u = 1 } = n;
1086
+ const d = (i, m, h) => {
1087
+ const E = i.geometry.bounds;
1088
+ let [_, v] = [E.minX, E.minY], [O, N] = [E.maxX, E.maxY];
1089
+ const [B, k] = h;
1090
+ if (m === f.SHAPE)
1091
+ _ += B, O += B, v += k, N += k;
1092
+ else {
1093
+ switch (m) {
1094
+ case f.TOP:
1095
+ case f.TOP_LEFT:
1096
+ case f.TOP_RIGHT: {
1097
+ v += k;
1098
+ break;
1099
+ }
1100
+ case f.BOTTOM:
1101
+ case f.BOTTOM_LEFT:
1102
+ case f.BOTTOM_RIGHT: {
1103
+ N += k;
1104
+ break;
1105
+ }
1106
+ }
1107
+ switch (m) {
1108
+ case f.LEFT:
1109
+ case f.TOP_LEFT:
1110
+ case f.BOTTOM_LEFT: {
1111
+ _ += B;
1112
+ break;
1113
+ }
1114
+ case f.RIGHT:
1115
+ case f.TOP_RIGHT:
1116
+ case f.BOTTOM_RIGHT: {
1117
+ O += B;
1118
+ break;
1119
+ }
1120
+ }
1121
+ }
1122
+ const j = Math.min(_, O), S = Math.min(v, N), X = Math.abs(O - _), D = Math.abs(N - v);
1123
+ return {
1124
+ ...i,
1125
+ geometry: {
1126
+ x: j,
1127
+ y: S,
1128
+ w: X,
1129
+ h: D,
1130
+ bounds: {
1131
+ minX: j,
1132
+ minY: S,
1133
+ maxX: j + X,
1134
+ maxY: S + D
1135
+ }
1136
+ }
1137
+ };
1138
+ };
1139
+ function x(i) {
1140
+ q.call(this, t, i);
1141
+ }
1142
+ function $(i) {
1143
+ q.call(this, t, i);
1144
+ }
1145
+ function g(i) {
1146
+ q.call(this, t, i);
1147
+ }
1148
+ return t.$$set = (i) => {
1149
+ "shape" in i && r(0, a = i.shape), "computedStyle" in i && r(1, c = i.computedStyle), "transform" in i && r(2, l = i.transform), "viewportScale" in i && r(6, u = i.viewportScale);
1150
+ }, t.$$.update = () => {
1151
+ t.$$.dirty & /*shape*/
1152
+ 1 && r(4, o = a.geometry), t.$$.dirty & /*viewportScale*/
1153
+ 64 && r(3, s = 10 / u);
1154
+ }, [
1155
+ a,
1156
+ c,
1157
+ l,
1158
+ s,
1159
+ o,
1160
+ d,
1161
+ u,
1162
+ x,
1163
+ $,
1164
+ g
1165
+ ];
1166
+ }
1167
+ class Dn extends Pt {
1168
+ constructor(n) {
1169
+ super(), vt(this, n, Xn, jn, Et, {
1170
+ shape: 0,
1171
+ computedStyle: 1,
1172
+ transform: 2,
1173
+ viewportScale: 6
1174
+ });
1175
+ }
1176
+ }
1177
+ U.RECTANGLE, U.POLYGON;
1178
+ const f = (t) => `HANDLE-${t}`;
1179
+ f.SHAPE = "SHAPE";
1180
+ f.TOP = "TOP";
1181
+ f.RIGHT = "RIGHT";
1182
+ f.BOTTOM = "BOTTOM";
1183
+ f.LEFT = "LEFT";
1184
+ f.TOP_LEFT = "TOP_LEFT";
1185
+ f.TOP_RIGHT = "TOP_RIGHT";
1186
+ f.BOTTOM_RIGHT = "BOTTOM_RIGHT";
1187
+ f.BOTTOM_LEFT = "BOTTOM_LEFT";
1188
+ const zn = (t) => ({}), Bt = (t) => ({ grab: (
1189
+ /*onGrab*/
1190
+ t[0]
1191
+ ) });
1192
+ function Vn(t) {
1193
+ let n, r, o, s;
1194
+ const a = (
1195
+ /*#slots*/
1196
+ t[7].default
1197
+ ), c = Zt(
1198
+ a,
1199
+ t,
1200
+ /*$$scope*/
1201
+ t[6],
1202
+ Bt
1203
+ );
1204
+ return {
1205
+ c() {
1206
+ n = L("g"), c && c.c(), e(n, "class", "a9s-annotation selected");
1207
+ },
1208
+ m(l, u) {
1209
+ T(l, n, u), c && c.m(n, null), r = !0, o || (s = [
1210
+ A(
1211
+ n,
1212
+ "pointerup",
1213
+ /*onRelease*/
1214
+ t[2]
1215
+ ),
1216
+ A(
1217
+ n,
1218
+ "pointermove",
1219
+ /*onPointerMove*/
1220
+ t[1]
1221
+ )
1222
+ ], o = !0);
1223
+ },
1224
+ p(l, [u]) {
1225
+ c && c.p && (!r || u & /*$$scope*/
1226
+ 64) && Mt(
1227
+ c,
1228
+ a,
1229
+ l,
1230
+ /*$$scope*/
1231
+ l[6],
1232
+ r ? Qt(
1233
+ a,
1234
+ /*$$scope*/
1235
+ l[6],
1236
+ u,
1237
+ zn
1238
+ ) : Yt(
1239
+ /*$$scope*/
1240
+ l[6]
1241
+ ),
1242
+ Bt
1243
+ );
1244
+ },
1245
+ i(l) {
1246
+ r || (pt(c, l), r = !0);
1247
+ },
1248
+ o(l) {
1249
+ Ot(c, l), r = !1;
1250
+ },
1251
+ d(l) {
1252
+ l && w(n), c && c.d(l), o = !1, z(s);
1253
+ }
1254
+ };
1255
+ }
1256
+ function Wn(t, n, r) {
1257
+ let { $$slots: o = {}, $$scope: s } = n;
1258
+ const a = sn();
1259
+ let { shape: c } = n, { editor: l } = n, { transform: u } = n, d = null, x, $ = null;
1260
+ const g = (h) => (E) => {
1261
+ d = h, x = u.elementToImage(E.offsetX, E.offsetY), $ = c, E.target.setPointerCapture(E.pointerId), a("grab");
1262
+ }, i = (h) => {
1263
+ if (d) {
1264
+ const [E, _] = u.elementToImage(h.offsetX, h.offsetY), v = [E - x[0], _ - x[1]];
1265
+ r(3, c = l($, d, v)), a("change", c);
1266
+ }
1267
+ }, m = (h) => {
1268
+ h.target.releasePointerCapture(h.pointerId), d = null, $ = c, a("release");
1269
+ };
1270
+ return t.$$set = (h) => {
1271
+ "shape" in h && r(3, c = h.shape), "editor" in h && r(4, l = h.editor), "transform" in h && r(5, u = h.transform), "$$scope" in h && r(6, s = h.$$scope);
1272
+ }, [g, i, m, c, l, u, s, o];
1273
+ }
1274
+ class qt extends Pt {
1275
+ constructor(n) {
1276
+ super(), vt(this, n, Wn, Vn, Et, { shape: 3, editor: 4, transform: 5 });
267
1277
  }
268
1278
  }
1279
+ navigator.userAgent.indexOf("Mac OS X");
269
1280
  export {
270
- mt as SvelteComponent,
271
- nt as action_destroyer,
272
- w as add_render_callback,
273
- et as append,
274
- B as assign,
275
- ct as attr,
276
- O as binding_callbacks,
277
- N as blank_object,
278
- _t as check_outros,
279
- D as children,
280
- W as component_subscribe,
281
- X as create_slot,
282
- m as current_component,
283
- R as destroy_component,
284
- T as detach,
285
- d as dirty_components,
286
- ot as element,
287
- ut as empty,
288
- z as flush,
289
- J as flush_render_callbacks,
290
- at as getContext,
291
- tt as get_all_dirty_from_scope,
292
- v as get_current_component,
293
- Y as get_slot_changes,
294
- dt as group_outros,
295
- gt as init,
296
- rt as insert,
297
- F as is_empty,
298
- E as is_function,
299
- it as listen,
300
- Q as mount_component,
301
- g as noop,
302
- st as onMount,
303
- S as run,
304
- p as run_all,
305
- V as safe_not_equal,
306
- H as schedule_update,
307
- lt as setContext,
308
- h as set_current_component,
309
- ft as set_data,
310
- P as subscribe,
311
- q as text,
312
- K as transition_in,
313
- ht as transition_out,
314
- Z as update_slot_base
1281
+ qt as Editor,
1282
+ f as Handle,
1283
+ Bn as PolygonEditor,
1284
+ Dn as RectangleEditor,
1285
+ mn as RectangleUtil,
1286
+ U as ShapeType,
1287
+ qn as W3CImageFormat,
1288
+ Vt as boundsFromPoints,
1289
+ yn as parseFragmentSelector,
1290
+ En as parseSVGSelector,
1291
+ Hn as parseW3CImageAnnotation,
1292
+ At as registerShapeUtil,
1293
+ gn as serializeFragmentSelector,
1294
+ On as serializeSVGSelector,
1295
+ Rn as serializeW3CImageAnnotation
315
1296
  };
316
1297
  //# sourceMappingURL=annotorious-svelte.es5.js.map