@annotorious/react 3.7.19 → 3.7.20

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