@annotorious/react 3.7.19 → 3.7.21

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.
@@ -1,270 +1,273 @@
1
- import { evaluate as Y, rectToClientRect as $, getPaddingObject as H, getSide as M, getSideAxis as j, getOppositePlacement as Q, getExpandedPlacements as U, getOppositeAxisPlacements as Z, getAlignmentSides as tt, clamp as _, min as X, max as z, getAlignment as I, getOppositeAxis as et, getAlignmentAxis as q, getAxisLength as G } from "./annotorious-react.es24.js";
2
- function W(o, c, l) {
1
+ import { evaluate as X, rectToClientRect as _, getPaddingObject as z, getSide as F, getSideAxis as V, getOppositePlacement as J, getExpandedPlacements as K, getOppositeAxisPlacements as Q, getAlignmentSides as Z, clamp as $, getAlignmentAxis as N, getAlignment as H, min as Y, max as W, getOppositeAxis as tt, getAxisLength as U } from "./annotorious-react.es24.js";
2
+ function I(n, c, l) {
3
3
  let {
4
4
  reference: e,
5
- floating: s
6
- } = o;
7
- const t = j(c), a = q(c), r = G(a), d = M(c), g = t === "y", u = e.x + e.width / 2 - s.width / 2, n = e.y + e.height / 2 - s.height / 2, m = e[r] / 2 - s[r] / 2;
8
- let i;
5
+ floating: i
6
+ } = n;
7
+ const t = V(c), r = N(c), f = U(r), d = F(c), u = t === "y", x = e.x + e.width / 2 - i.width / 2, o = e.y + e.height / 2 - i.height / 2, m = e[f] / 2 - i[f] / 2;
8
+ let s;
9
9
  switch (d) {
10
10
  case "top":
11
- i = {
12
- x: u,
13
- y: e.y - s.height
11
+ s = {
12
+ x,
13
+ y: e.y - i.height
14
14
  };
15
15
  break;
16
16
  case "bottom":
17
- i = {
18
- x: u,
17
+ s = {
18
+ x,
19
19
  y: e.y + e.height
20
20
  };
21
21
  break;
22
22
  case "right":
23
- i = {
23
+ s = {
24
24
  x: e.x + e.width,
25
- y: n
25
+ y: o
26
26
  };
27
27
  break;
28
28
  case "left":
29
- i = {
30
- x: e.x - s.width,
31
- y: n
29
+ s = {
30
+ x: e.x - i.width,
31
+ y: o
32
32
  };
33
33
  break;
34
34
  default:
35
- i = {
35
+ s = {
36
36
  x: e.x,
37
37
  y: e.y
38
38
  };
39
39
  }
40
- switch (I(c)) {
40
+ switch (H(c)) {
41
41
  case "start":
42
- i[a] -= m * (l && g ? -1 : 1);
42
+ s[r] -= m * (l && u ? -1 : 1);
43
43
  break;
44
44
  case "end":
45
- i[a] += m * (l && g ? -1 : 1);
45
+ s[r] += m * (l && u ? -1 : 1);
46
46
  break;
47
47
  }
48
- return i;
48
+ return s;
49
49
  }
50
- const ct = async (o, c, l) => {
51
- const {
52
- placement: e = "bottom",
53
- strategy: s = "absolute",
54
- middleware: t = [],
55
- platform: a
56
- } = l, r = t.filter(Boolean), d = await (a.isRTL == null ? void 0 : a.isRTL(c));
57
- let g = await a.getElementRects({
58
- reference: o,
59
- floating: c,
60
- strategy: s
61
- }), {
62
- x: u,
63
- y: n
64
- } = W(g, e, d), m = e, i = {}, f = 0;
65
- for (let h = 0; h < r.length; h++) {
66
- const {
67
- name: x,
68
- fn: v
69
- } = r[h], {
70
- x: p,
71
- y: A,
72
- data: R,
73
- reset: w
74
- } = await v({
75
- x: u,
76
- y: n,
77
- initialPlacement: e,
78
- placement: m,
79
- strategy: s,
80
- middlewareData: i,
81
- rects: g,
82
- platform: a,
83
- elements: {
84
- reference: o,
85
- floating: c
86
- }
87
- });
88
- u = p ?? u, n = A ?? n, i = {
89
- ...i,
90
- [x]: {
91
- ...i[x],
92
- ...R
93
- }
94
- }, w && f <= 50 && (f++, typeof w == "object" && (w.placement && (m = w.placement), w.rects && (g = w.rects === !0 ? await a.getElementRects({
95
- reference: o,
96
- floating: c,
97
- strategy: s
98
- }) : w.rects), {
99
- x: u,
100
- y: n
101
- } = W(g, m, d)), h = -1);
102
- }
103
- return {
104
- x: u,
105
- y: n,
106
- placement: m,
107
- strategy: s,
108
- middlewareData: i
109
- };
110
- };
111
- async function J(o, c) {
50
+ async function et(n, c) {
112
51
  var l;
113
52
  c === void 0 && (c = {});
114
53
  const {
115
54
  x: e,
116
- y: s,
55
+ y: i,
117
56
  platform: t,
118
- rects: a,
119
- elements: r,
57
+ rects: r,
58
+ elements: f,
120
59
  strategy: d
121
- } = o, {
122
- boundary: g = "clippingAncestors",
123
- rootBoundary: u = "viewport",
124
- elementContext: n = "floating",
60
+ } = n, {
61
+ boundary: u = "clippingAncestors",
62
+ rootBoundary: x = "viewport",
63
+ elementContext: o = "floating",
125
64
  altBoundary: m = !1,
126
- padding: i = 0
127
- } = Y(c, o), f = H(i), x = r[m ? n === "floating" ? "reference" : "floating" : n], v = $(await t.getClippingRect({
128
- element: (l = await (t.isElement == null ? void 0 : t.isElement(x))) == null || l ? x : x.contextElement || await (t.getDocumentElement == null ? void 0 : t.getDocumentElement(r.floating)),
129
- boundary: g,
130
- rootBoundary: u,
65
+ padding: s = 0
66
+ } = X(c, n), a = z(s), p = f[m ? o === "floating" ? "reference" : "floating" : o], w = _(await t.getClippingRect({
67
+ element: (l = await (t.isElement == null ? void 0 : t.isElement(p))) == null || l ? p : p.contextElement || await (t.getDocumentElement == null ? void 0 : t.getDocumentElement(f.floating)),
68
+ boundary: u,
69
+ rootBoundary: x,
131
70
  strategy: d
132
- })), p = n === "floating" ? {
71
+ })), A = o === "floating" ? {
133
72
  x: e,
134
- y: s,
135
- width: a.floating.width,
136
- height: a.floating.height
137
- } : a.reference, A = await (t.getOffsetParent == null ? void 0 : t.getOffsetParent(r.floating)), R = await (t.isElement == null ? void 0 : t.isElement(A)) ? await (t.getScale == null ? void 0 : t.getScale(A)) || {
73
+ y: i,
74
+ width: r.floating.width,
75
+ height: r.floating.height
76
+ } : r.reference, h = await (t.getOffsetParent == null ? void 0 : t.getOffsetParent(f.floating)), y = await (t.isElement == null ? void 0 : t.isElement(h)) ? await (t.getScale == null ? void 0 : t.getScale(h)) || {
138
77
  x: 1,
139
78
  y: 1
140
79
  } : {
141
80
  x: 1,
142
81
  y: 1
143
- }, w = $(t.convertOffsetParentRelativeRectToViewportRelativeRect ? await t.convertOffsetParentRelativeRectToViewportRelativeRect({
144
- elements: r,
145
- rect: p,
146
- offsetParent: A,
82
+ }, O = _(t.convertOffsetParentRelativeRectToViewportRelativeRect ? await t.convertOffsetParentRelativeRectToViewportRelativeRect({
83
+ elements: f,
84
+ rect: A,
85
+ offsetParent: h,
147
86
  strategy: d
148
- }) : p);
87
+ }) : A);
149
88
  return {
150
- top: (v.top - w.top + f.top) / R.y,
151
- bottom: (w.bottom - v.bottom + f.bottom) / R.y,
152
- left: (v.left - w.left + f.left) / R.x,
153
- right: (w.right - v.right + f.right) / R.x
89
+ top: (w.top - O.top + a.top) / y.y,
90
+ bottom: (O.bottom - w.bottom + a.bottom) / y.y,
91
+ left: (w.left - O.left + a.left) / y.x,
92
+ right: (O.right - w.right + a.right) / y.x
154
93
  };
155
94
  }
156
- const lt = (o) => ({
95
+ const nt = 50, lt = async (n, c, l) => {
96
+ const {
97
+ placement: e = "bottom",
98
+ strategy: i = "absolute",
99
+ middleware: t = [],
100
+ platform: r
101
+ } = l, f = r.detectOverflow ? r : {
102
+ ...r,
103
+ detectOverflow: et
104
+ }, d = await (r.isRTL == null ? void 0 : r.isRTL(c));
105
+ let u = await r.getElementRects({
106
+ reference: n,
107
+ floating: c,
108
+ strategy: i
109
+ }), {
110
+ x,
111
+ y: o
112
+ } = I(u, e, d), m = e, s = 0;
113
+ const a = {};
114
+ for (let g = 0; g < t.length; g++) {
115
+ const p = t[g];
116
+ if (!p)
117
+ continue;
118
+ const {
119
+ name: w,
120
+ fn: A
121
+ } = p, {
122
+ x: h,
123
+ y,
124
+ data: O,
125
+ reset: b
126
+ } = await A({
127
+ x,
128
+ y: o,
129
+ initialPlacement: e,
130
+ placement: m,
131
+ strategy: i,
132
+ middlewareData: a,
133
+ rects: u,
134
+ platform: f,
135
+ elements: {
136
+ reference: n,
137
+ floating: c
138
+ }
139
+ });
140
+ x = h ?? x, o = y ?? o, a[w] = {
141
+ ...a[w],
142
+ ...O
143
+ }, b && s < nt && (s++, typeof b == "object" && (b.placement && (m = b.placement), b.rects && (u = b.rects === !0 ? await r.getElementRects({
144
+ reference: n,
145
+ floating: c,
146
+ strategy: i
147
+ }) : b.rects), {
148
+ x,
149
+ y: o
150
+ } = I(u, m, d)), g = -1);
151
+ }
152
+ return {
153
+ x,
154
+ y: o,
155
+ placement: m,
156
+ strategy: i,
157
+ middlewareData: a
158
+ };
159
+ }, rt = (n) => ({
157
160
  name: "arrow",
158
- options: o,
161
+ options: n,
159
162
  async fn(c) {
160
163
  const {
161
164
  x: l,
162
165
  y: e,
163
- placement: s,
166
+ placement: i,
164
167
  rects: t,
165
- platform: a,
166
- elements: r,
168
+ platform: r,
169
+ elements: f,
167
170
  middlewareData: d
168
171
  } = c, {
169
- element: g,
170
- padding: u = 0
171
- } = Y(o, c) || {};
172
- if (g == null)
172
+ element: u,
173
+ padding: x = 0
174
+ } = X(n, c) || {};
175
+ if (u == null)
173
176
  return {};
174
- const n = H(u), m = {
177
+ const o = z(x), m = {
175
178
  x: l,
176
179
  y: e
177
- }, i = q(s), f = G(i), h = await a.getDimensions(g), x = i === "y", v = x ? "top" : "left", p = x ? "bottom" : "right", A = x ? "clientHeight" : "clientWidth", R = t.reference[f] + t.reference[i] - m[i] - t.floating[f], w = m[i] - t.reference[i], S = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(g));
178
- let D = S ? S[A] : 0;
179
- (!D || !await (a.isElement == null ? void 0 : a.isElement(S))) && (D = r.floating[A] || t.floating[f]);
180
- const F = R / 2 - w / 2, T = D / 2 - h[f] / 2 - 1, y = X(n[v], T), L = X(n[p], T), E = y, B = D - h[f] - L, b = D / 2 - h[f] / 2 + F, k = _(E, b, B), C = !d.arrow && I(s) != null && b !== k && t.reference[f] / 2 - (b < E ? y : L) - h[f] / 2 < 0, P = C ? b < E ? b - E : b - B : 0;
180
+ }, s = N(i), a = U(s), g = await r.getDimensions(u), p = s === "y", w = p ? "top" : "left", A = p ? "bottom" : "right", h = p ? "clientHeight" : "clientWidth", y = t.reference[a] + t.reference[s] - m[s] - t.floating[a], O = m[s] - t.reference[s], b = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(u));
181
+ let E = b ? b[h] : 0;
182
+ (!E || !await (r.isElement == null ? void 0 : r.isElement(b))) && (E = f.floating[h] || t.floating[a]);
183
+ const j = y / 2 - O / 2, T = E / 2 - g[a] / 2 - 1, v = Y(o[w], T), L = Y(o[A], T), D = v, B = E - g[a] - L, R = E / 2 - g[a] / 2 + j, k = $(D, R, B), S = !d.arrow && H(i) != null && R !== k && t.reference[a] / 2 - (R < D ? v : L) - g[a] / 2 < 0, P = S ? R < D ? R - D : R - B : 0;
181
184
  return {
182
- [i]: m[i] + P,
185
+ [s]: m[s] + P,
183
186
  data: {
184
- [i]: k,
185
- centerOffset: b - k - P,
186
- ...C && {
187
+ [s]: k,
188
+ centerOffset: R - k - P,
189
+ ...S && {
187
190
  alignmentOffset: P
188
191
  }
189
192
  },
190
- reset: C
193
+ reset: S
191
194
  };
192
195
  }
193
- }), at = function(o) {
194
- return o === void 0 && (o = {}), {
196
+ }), at = function(n) {
197
+ return n === void 0 && (n = {}), {
195
198
  name: "flip",
196
- options: o,
199
+ options: n,
197
200
  async fn(c) {
198
201
  var l, e;
199
202
  const {
200
- placement: s,
203
+ placement: i,
201
204
  middlewareData: t,
202
- rects: a,
203
- initialPlacement: r,
205
+ rects: r,
206
+ initialPlacement: f,
204
207
  platform: d,
205
- elements: g
208
+ elements: u
206
209
  } = c, {
207
- mainAxis: u = !0,
208
- crossAxis: n = !0,
210
+ mainAxis: x = !0,
211
+ crossAxis: o = !0,
209
212
  fallbackPlacements: m,
210
- fallbackStrategy: i = "bestFit",
211
- fallbackAxisSideDirection: f = "none",
212
- flipAlignment: h = !0,
213
- ...x
214
- } = Y(o, c);
213
+ fallbackStrategy: s = "bestFit",
214
+ fallbackAxisSideDirection: a = "none",
215
+ flipAlignment: g = !0,
216
+ ...p
217
+ } = X(n, c);
215
218
  if ((l = t.arrow) != null && l.alignmentOffset)
216
219
  return {};
217
- const v = M(s), p = j(r), A = M(r) === r, R = await (d.isRTL == null ? void 0 : d.isRTL(g.floating)), w = m || (A || !h ? [Q(r)] : U(r)), S = f !== "none";
218
- !m && S && w.push(...Z(r, h, f, R));
219
- const D = [r, ...w], F = await J(c, x), T = [];
220
- let y = ((e = t.flip) == null ? void 0 : e.overflows) || [];
221
- if (u && T.push(F[v]), n) {
222
- const b = tt(s, a, R);
223
- T.push(F[b[0]], F[b[1]]);
220
+ const w = F(i), A = V(f), h = F(f) === f, y = await (d.isRTL == null ? void 0 : d.isRTL(u.floating)), O = m || (h || !g ? [J(f)] : K(f)), b = a !== "none";
221
+ !m && b && O.push(...Q(f, g, a, y));
222
+ const E = [f, ...O], j = await d.detectOverflow(c, p), T = [];
223
+ let v = ((e = t.flip) == null ? void 0 : e.overflows) || [];
224
+ if (x && T.push(j[w]), o) {
225
+ const R = Z(i, r, y);
226
+ T.push(j[R[0]], j[R[1]]);
224
227
  }
225
- if (y = [...y, {
226
- placement: s,
228
+ if (v = [...v, {
229
+ placement: i,
227
230
  overflows: T
228
- }], !T.every((b) => b <= 0)) {
229
- var L, E;
230
- const b = (((L = t.flip) == null ? void 0 : L.index) || 0) + 1, k = D[b];
231
- if (k && (!(n === "alignment" ? p !== j(k) : !1) || // We leave the current main axis only if every placement on that axis
231
+ }], !T.every((R) => R <= 0)) {
232
+ var L, D;
233
+ const R = (((L = t.flip) == null ? void 0 : L.index) || 0) + 1, k = E[R];
234
+ if (k && (!(o === "alignment" ? A !== V(k) : !1) || // We leave the current main axis only if every placement on that axis
232
235
  // overflows the main axis.
233
- y.every((O) => j(O.placement) === p ? O.overflows[0] > 0 : !0)))
236
+ v.every((C) => V(C.placement) === A ? C.overflows[0] > 0 : !0)))
234
237
  return {
235
238
  data: {
236
- index: b,
237
- overflows: y
239
+ index: R,
240
+ overflows: v
238
241
  },
239
242
  reset: {
240
243
  placement: k
241
244
  }
242
245
  };
243
- let C = (E = y.filter((P) => P.overflows[0] <= 0).sort((P, O) => P.overflows[1] - O.overflows[1])[0]) == null ? void 0 : E.placement;
244
- if (!C)
245
- switch (i) {
246
+ let S = (D = v.filter((P) => P.overflows[0] <= 0).sort((P, C) => P.overflows[1] - C.overflows[1])[0]) == null ? void 0 : D.placement;
247
+ if (!S)
248
+ switch (s) {
246
249
  case "bestFit": {
247
250
  var B;
248
- const P = (B = y.filter((O) => {
249
- if (S) {
250
- const V = j(O.placement);
251
- return V === p || // Create a bias to the `y` side axis due to horizontal
251
+ const P = (B = v.filter((C) => {
252
+ if (b) {
253
+ const M = V(C.placement);
254
+ return M === A || // Create a bias to the `y` side axis due to horizontal
252
255
  // reading directions favoring greater width.
253
- V === "y";
256
+ M === "y";
254
257
  }
255
258
  return !0;
256
- }).map((O) => [O.placement, O.overflows.filter((V) => V > 0).reduce((V, N) => V + N, 0)]).sort((O, V) => O[1] - V[1])[0]) == null ? void 0 : B[0];
257
- P && (C = P);
259
+ }).map((C) => [C.placement, C.overflows.filter((M) => M > 0).reduce((M, G) => M + G, 0)]).sort((C, M) => C[1] - M[1])[0]) == null ? void 0 : B[0];
260
+ P && (S = P);
258
261
  break;
259
262
  }
260
263
  case "initialPlacement":
261
- C = r;
264
+ S = f;
262
265
  break;
263
266
  }
264
- if (s !== C)
267
+ if (i !== S)
265
268
  return {
266
269
  reset: {
267
- placement: C
270
+ placement: S
268
271
  }
269
272
  };
270
273
  }
@@ -272,186 +275,187 @@ const lt = (o) => ({
272
275
  }
273
276
  };
274
277
  };
275
- function K(o) {
276
- const c = X(...o.map((t) => t.left)), l = X(...o.map((t) => t.top)), e = z(...o.map((t) => t.right)), s = z(...o.map((t) => t.bottom));
278
+ function q(n) {
279
+ const c = Y(...n.map((t) => t.left)), l = Y(...n.map((t) => t.top)), e = W(...n.map((t) => t.right)), i = W(...n.map((t) => t.bottom));
277
280
  return {
278
281
  x: c,
279
282
  y: l,
280
283
  width: e - c,
281
- height: s - l
284
+ height: i - l
282
285
  };
283
286
  }
284
- function nt(o) {
285
- const c = o.slice().sort((s, t) => s.y - t.y), l = [];
287
+ function it(n) {
288
+ const c = n.slice().sort((i, t) => i.y - t.y), l = [];
286
289
  let e = null;
287
- for (let s = 0; s < c.length; s++) {
288
- const t = c[s];
290
+ for (let i = 0; i < c.length; i++) {
291
+ const t = c[i];
289
292
  !e || t.y - e.y > e.height / 2 ? l.push([t]) : l[l.length - 1].push(t), e = t;
290
293
  }
291
- return l.map((s) => $(K(s)));
294
+ return l.map((i) => _(q(i)));
292
295
  }
293
- const rt = function(o) {
294
- return o === void 0 && (o = {}), {
296
+ const ft = function(n) {
297
+ return n === void 0 && (n = {}), {
295
298
  name: "inline",
296
- options: o,
299
+ options: n,
297
300
  async fn(c) {
298
301
  const {
299
302
  placement: l,
300
303
  elements: e,
301
- rects: s,
304
+ rects: i,
302
305
  platform: t,
303
- strategy: a
306
+ strategy: r
304
307
  } = c, {
305
- padding: r = 2,
308
+ padding: f = 2,
306
309
  x: d,
307
- y: g
308
- } = Y(o, c), u = Array.from(await (t.getClientRects == null ? void 0 : t.getClientRects(e.reference)) || []), n = nt(u), m = $(K(u)), i = H(r);
309
- function f() {
310
- if (n.length === 2 && n[0].left > n[1].right && d != null && g != null)
311
- return n.find((x) => d > x.left - i.left && d < x.right + i.right && g > x.top - i.top && g < x.bottom + i.bottom) || m;
312
- if (n.length >= 2) {
313
- if (j(l) === "y") {
314
- const y = n[0], L = n[n.length - 1], E = M(l) === "top", B = y.top, b = L.bottom, k = E ? y.left : L.left, C = E ? y.right : L.right, P = C - k, O = b - B;
310
+ y: u
311
+ } = X(n, c), x = Array.from(await (t.getClientRects == null ? void 0 : t.getClientRects(e.reference)) || []), o = it(x), m = _(q(x)), s = z(f);
312
+ function a() {
313
+ if (o.length === 2 && o[0].left > o[1].right && d != null && u != null)
314
+ return o.find((p) => d > p.left - s.left && d < p.right + s.right && u > p.top - s.top && u < p.bottom + s.bottom) || m;
315
+ if (o.length >= 2) {
316
+ if (V(l) === "y") {
317
+ const v = o[0], L = o[o.length - 1], D = F(l) === "top", B = v.top, R = L.bottom, k = D ? v.left : L.left, S = D ? v.right : L.right, P = S - k, C = R - B;
315
318
  return {
316
319
  top: B,
317
- bottom: b,
320
+ bottom: R,
318
321
  left: k,
319
- right: C,
322
+ right: S,
320
323
  width: P,
321
- height: O,
324
+ height: C,
322
325
  x: k,
323
326
  y: B
324
327
  };
325
328
  }
326
- const x = M(l) === "left", v = z(...n.map((y) => y.right)), p = X(...n.map((y) => y.left)), A = n.filter((y) => x ? y.left === p : y.right === v), R = A[0].top, w = A[A.length - 1].bottom, S = p, D = v, F = D - S, T = w - R;
329
+ const p = F(l) === "left", w = W(...o.map((v) => v.right)), A = Y(...o.map((v) => v.left)), h = o.filter((v) => p ? v.left === A : v.right === w), y = h[0].top, O = h[h.length - 1].bottom, b = A, E = w, j = E - b, T = O - y;
327
330
  return {
328
- top: R,
329
- bottom: w,
330
- left: S,
331
- right: D,
332
- width: F,
331
+ top: y,
332
+ bottom: O,
333
+ left: b,
334
+ right: E,
335
+ width: j,
333
336
  height: T,
334
- x: S,
335
- y: R
337
+ x: b,
338
+ y
336
339
  };
337
340
  }
338
341
  return m;
339
342
  }
340
- const h = await t.getElementRects({
343
+ const g = await t.getElementRects({
341
344
  reference: {
342
- getBoundingClientRect: f
345
+ getBoundingClientRect: a
343
346
  },
344
347
  floating: e.floating,
345
- strategy: a
348
+ strategy: r
346
349
  });
347
- return s.reference.x !== h.reference.x || s.reference.y !== h.reference.y || s.reference.width !== h.reference.width || s.reference.height !== h.reference.height ? {
350
+ return i.reference.x !== g.reference.x || i.reference.y !== g.reference.y || i.reference.width !== g.reference.width || i.reference.height !== g.reference.height ? {
348
351
  reset: {
349
- rects: h
352
+ rects: g
350
353
  }
351
354
  } : {};
352
355
  }
353
356
  };
354
- }, it = /* @__PURE__ */ new Set(["left", "top"]);
355
- async function ot(o, c) {
357
+ }, ot = /* @__PURE__ */ new Set(["left", "top"]);
358
+ async function st(n, c) {
356
359
  const {
357
360
  placement: l,
358
361
  platform: e,
359
- elements: s
360
- } = o, t = await (e.isRTL == null ? void 0 : e.isRTL(s.floating)), a = M(l), r = I(l), d = j(l) === "y", g = it.has(a) ? -1 : 1, u = t && d ? -1 : 1, n = Y(c, o);
362
+ elements: i
363
+ } = n, t = await (e.isRTL == null ? void 0 : e.isRTL(i.floating)), r = F(l), f = H(l), d = V(l) === "y", u = ot.has(r) ? -1 : 1, x = t && d ? -1 : 1, o = X(c, n);
361
364
  let {
362
365
  mainAxis: m,
363
- crossAxis: i,
364
- alignmentAxis: f
365
- } = typeof n == "number" ? {
366
- mainAxis: n,
366
+ crossAxis: s,
367
+ alignmentAxis: a
368
+ } = typeof o == "number" ? {
369
+ mainAxis: o,
367
370
  crossAxis: 0,
368
371
  alignmentAxis: null
369
372
  } : {
370
- mainAxis: n.mainAxis || 0,
371
- crossAxis: n.crossAxis || 0,
372
- alignmentAxis: n.alignmentAxis
373
+ mainAxis: o.mainAxis || 0,
374
+ crossAxis: o.crossAxis || 0,
375
+ alignmentAxis: o.alignmentAxis
373
376
  };
374
- return r && typeof f == "number" && (i = r === "end" ? f * -1 : f), d ? {
375
- x: i * u,
376
- y: m * g
377
+ return f && typeof a == "number" && (s = f === "end" ? a * -1 : a), d ? {
378
+ x: s * x,
379
+ y: m * u
377
380
  } : {
378
- x: m * g,
379
- y: i * u
381
+ x: m * u,
382
+ y: s * x
380
383
  };
381
384
  }
382
- const ft = function(o) {
383
- return o === void 0 && (o = 0), {
385
+ const mt = function(n) {
386
+ return n === void 0 && (n = 0), {
384
387
  name: "offset",
385
- options: o,
388
+ options: n,
386
389
  async fn(c) {
387
390
  var l, e;
388
391
  const {
389
- x: s,
392
+ x: i,
390
393
  y: t,
391
- placement: a,
392
- middlewareData: r
393
- } = c, d = await ot(c, o);
394
- return a === ((l = r.offset) == null ? void 0 : l.placement) && (e = r.arrow) != null && e.alignmentOffset ? {} : {
395
- x: s + d.x,
394
+ placement: r,
395
+ middlewareData: f
396
+ } = c, d = await st(c, n);
397
+ return r === ((l = f.offset) == null ? void 0 : l.placement) && (e = f.arrow) != null && e.alignmentOffset ? {} : {
398
+ x: i + d.x,
396
399
  y: t + d.y,
397
400
  data: {
398
401
  ...d,
399
- placement: a
402
+ placement: r
400
403
  }
401
404
  };
402
405
  }
403
406
  };
404
- }, mt = function(o) {
405
- return o === void 0 && (o = {}), {
407
+ }, dt = function(n) {
408
+ return n === void 0 && (n = {}), {
406
409
  name: "shift",
407
- options: o,
410
+ options: n,
408
411
  async fn(c) {
409
412
  const {
410
413
  x: l,
411
414
  y: e,
412
- placement: s
415
+ placement: i,
416
+ platform: t
413
417
  } = c, {
414
- mainAxis: t = !0,
415
- crossAxis: a = !1,
416
- limiter: r = {
417
- fn: (x) => {
418
+ mainAxis: r = !0,
419
+ crossAxis: f = !1,
420
+ limiter: d = {
421
+ fn: (w) => {
418
422
  let {
419
- x: v,
420
- y: p
421
- } = x;
423
+ x: A,
424
+ y: h
425
+ } = w;
422
426
  return {
423
- x: v,
424
- y: p
427
+ x: A,
428
+ y: h
425
429
  };
426
430
  }
427
431
  },
428
- ...d
429
- } = Y(o, c), g = {
432
+ ...u
433
+ } = X(n, c), x = {
430
434
  x: l,
431
435
  y: e
432
- }, u = await J(c, d), n = j(M(s)), m = et(n);
433
- let i = g[m], f = g[n];
434
- if (t) {
435
- const x = m === "y" ? "top" : "left", v = m === "y" ? "bottom" : "right", p = i + u[x], A = i - u[v];
436
- i = _(p, i, A);
436
+ }, o = await t.detectOverflow(c, u), m = V(F(i)), s = tt(m);
437
+ let a = x[s], g = x[m];
438
+ if (r) {
439
+ const w = s === "y" ? "top" : "left", A = s === "y" ? "bottom" : "right", h = a + o[w], y = a - o[A];
440
+ a = $(h, a, y);
437
441
  }
438
- if (a) {
439
- const x = n === "y" ? "top" : "left", v = n === "y" ? "bottom" : "right", p = f + u[x], A = f - u[v];
440
- f = _(p, f, A);
442
+ if (f) {
443
+ const w = m === "y" ? "top" : "left", A = m === "y" ? "bottom" : "right", h = g + o[w], y = g - o[A];
444
+ g = $(h, g, y);
441
445
  }
442
- const h = r.fn({
446
+ const p = d.fn({
443
447
  ...c,
444
- [m]: i,
445
- [n]: f
448
+ [s]: a,
449
+ [m]: g
446
450
  });
447
451
  return {
448
- ...h,
452
+ ...p,
449
453
  data: {
450
- x: h.x - l,
451
- y: h.y - e,
454
+ x: p.x - l,
455
+ y: p.y - e,
452
456
  enabled: {
453
- [m]: t,
454
- [n]: a
457
+ [s]: r,
458
+ [m]: f
455
459
  }
456
460
  }
457
461
  };
@@ -459,13 +463,13 @@ const ft = function(o) {
459
463
  };
460
464
  };
461
465
  export {
462
- lt as arrow,
463
- ct as computePosition,
464
- J as detectOverflow,
466
+ rt as arrow,
467
+ lt as computePosition,
468
+ et as detectOverflow,
465
469
  at as flip,
466
- rt as inline,
467
- ft as offset,
468
- $ as rectToClientRect,
469
- mt as shift
470
+ ft as inline,
471
+ mt as offset,
472
+ _ as rectToClientRect,
473
+ dt as shift
470
474
  };
471
475
  //# sourceMappingURL=annotorious-react.es25.js.map