@trailguide/core 0.0.3 → 0.1.1

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,78 +1,78 @@
1
- var Nt = Object.defineProperty;
2
- var Vt = (t, e, n) => e in t ? Nt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var k = (t, e, n) => Vt(t, typeof e != "symbol" ? e + "" : e, n);
4
- const U = Math.min, z = Math.max, nt = Math.round, R = (t) => ({
1
+ var Xt = Object.defineProperty;
2
+ var zt = (t, e, n) => e in t ? Xt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var C = (t, e, n) => zt(t, typeof e != "symbol" ? e + "" : e, n);
4
+ const Q = Math.min, z = Math.max, st = Math.round, L = (t) => ({
5
5
  x: t,
6
6
  y: t
7
- }), Wt = {
7
+ }), jt = {
8
8
  left: "right",
9
9
  right: "left",
10
10
  bottom: "top",
11
11
  top: "bottom"
12
- }, Ht = {
12
+ }, Yt = {
13
13
  start: "end",
14
14
  end: "start"
15
15
  };
16
- function dt(t, e, n) {
17
- return z(t, U(e, n));
16
+ function gt(t, e, n) {
17
+ return z(t, Q(e, n));
18
18
  }
19
- function Z(t, e) {
19
+ function tt(t, e) {
20
20
  return typeof t == "function" ? t(e) : t;
21
21
  }
22
- function H(t) {
22
+ function X(t) {
23
23
  return t.split("-")[0];
24
24
  }
25
- function tt(t) {
25
+ function et(t) {
26
26
  return t.split("-")[1];
27
27
  }
28
- function Tt(t) {
28
+ function $t(t) {
29
29
  return t === "x" ? "y" : "x";
30
30
  }
31
- function gt(t) {
31
+ function wt(t) {
32
32
  return t === "y" ? "height" : "width";
33
33
  }
34
- const zt = /* @__PURE__ */ new Set(["top", "bottom"]);
34
+ const Kt = /* @__PURE__ */ new Set(["top", "bottom"]);
35
35
  function _(t) {
36
- return zt.has(H(t)) ? "y" : "x";
36
+ return Kt.has(X(t)) ? "y" : "x";
37
37
  }
38
- function mt(t) {
39
- return Tt(_(t));
38
+ function xt(t) {
39
+ return $t(_(t));
40
40
  }
41
- function Xt(t, e, n) {
41
+ function Gt(t, e, n) {
42
42
  n === void 0 && (n = !1);
43
- const i = tt(t), o = mt(t), s = gt(o);
43
+ const i = et(t), o = xt(t), s = wt(o);
44
44
  let r = o === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
45
- return e.reference[s] > e.floating[s] && (r = ot(r)), [r, ot(r)];
45
+ return e.reference[s] > e.floating[s] && (r = rt(r)), [r, rt(r)];
46
46
  }
47
- function jt(t) {
48
- const e = ot(t);
49
- return [ht(t), e, ht(e)];
47
+ function Jt(t) {
48
+ const e = rt(t);
49
+ return [mt(t), e, mt(e)];
50
50
  }
51
- function ht(t) {
52
- return t.replace(/start|end/g, (e) => Ht[e]);
51
+ function mt(t) {
52
+ return t.replace(/start|end/g, (e) => Yt[e]);
53
53
  }
54
- const xt = ["left", "right"], bt = ["right", "left"], Yt = ["top", "bottom"], Kt = ["bottom", "top"];
55
- function Gt(t, e, n) {
54
+ const At = ["left", "right"], Tt = ["right", "left"], Ut = ["top", "bottom"], Qt = ["bottom", "top"];
55
+ function Zt(t, e, n) {
56
56
  switch (t) {
57
57
  case "top":
58
58
  case "bottom":
59
- return n ? e ? bt : xt : e ? xt : bt;
59
+ return n ? e ? Tt : At : e ? At : Tt;
60
60
  case "left":
61
61
  case "right":
62
- return e ? Yt : Kt;
62
+ return e ? Ut : Qt;
63
63
  default:
64
64
  return [];
65
65
  }
66
66
  }
67
- function Jt(t, e, n, i) {
68
- const o = tt(t);
69
- let s = Gt(H(t), n === "start", i);
70
- return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(ht)))), s;
67
+ function te(t, e, n, i) {
68
+ const o = et(t);
69
+ let s = Zt(X(t), n === "start", i);
70
+ return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(mt)))), s;
71
71
  }
72
- function ot(t) {
73
- return t.replace(/left|right|bottom|top/g, (e) => Wt[e]);
72
+ function rt(t) {
73
+ return t.replace(/left|right|bottom|top/g, (e) => jt[e]);
74
74
  }
75
- function Ut(t) {
75
+ function ee(t) {
76
76
  return {
77
77
  top: 0,
78
78
  right: 0,
@@ -81,15 +81,15 @@ function Ut(t) {
81
81
  ...t
82
82
  };
83
83
  }
84
- function Ot(t) {
85
- return typeof t != "number" ? Ut(t) : {
84
+ function Lt(t) {
85
+ return typeof t != "number" ? ee(t) : {
86
86
  top: t,
87
87
  right: t,
88
88
  bottom: t,
89
89
  left: t
90
90
  };
91
91
  }
92
- function st(t) {
92
+ function lt(t) {
93
93
  const {
94
94
  x: e,
95
95
  y: n,
@@ -107,55 +107,55 @@ function st(t) {
107
107
  y: n
108
108
  };
109
109
  }
110
- function vt(t, e, n) {
110
+ function Ct(t, e, n) {
111
111
  let {
112
112
  reference: i,
113
113
  floating: o
114
114
  } = t;
115
- const s = _(e), r = mt(e), l = gt(r), c = H(e), a = s === "y", d = i.x + i.width / 2 - o.width / 2, f = i.y + i.height / 2 - o.height / 2, h = i[l] / 2 - o[l] / 2;
116
- let u;
117
- switch (c) {
115
+ const s = _(e), r = xt(e), l = wt(r), a = X(e), c = s === "y", d = i.x + i.width / 2 - o.width / 2, u = i.y + i.height / 2 - o.height / 2, h = i[l] / 2 - o[l] / 2;
116
+ let f;
117
+ switch (a) {
118
118
  case "top":
119
- u = {
119
+ f = {
120
120
  x: d,
121
121
  y: i.y - o.height
122
122
  };
123
123
  break;
124
124
  case "bottom":
125
- u = {
125
+ f = {
126
126
  x: d,
127
127
  y: i.y + i.height
128
128
  };
129
129
  break;
130
130
  case "right":
131
- u = {
131
+ f = {
132
132
  x: i.x + i.width,
133
- y: f
133
+ y: u
134
134
  };
135
135
  break;
136
136
  case "left":
137
- u = {
137
+ f = {
138
138
  x: i.x - o.width,
139
- y: f
139
+ y: u
140
140
  };
141
141
  break;
142
142
  default:
143
- u = {
143
+ f = {
144
144
  x: i.x,
145
145
  y: i.y
146
146
  };
147
147
  }
148
- switch (tt(e)) {
148
+ switch (et(e)) {
149
149
  case "start":
150
- u[r] -= h * (n && a ? -1 : 1);
150
+ f[r] -= h * (n && c ? -1 : 1);
151
151
  break;
152
152
  case "end":
153
- u[r] += h * (n && a ? -1 : 1);
153
+ f[r] += h * (n && c ? -1 : 1);
154
154
  break;
155
155
  }
156
- return u;
156
+ return f;
157
157
  }
158
- async function Qt(t, e) {
158
+ async function ie(t, e) {
159
159
  var n;
160
160
  e === void 0 && (e = {});
161
161
  const {
@@ -164,19 +164,19 @@ async function Qt(t, e) {
164
164
  platform: s,
165
165
  rects: r,
166
166
  elements: l,
167
- strategy: c
167
+ strategy: a
168
168
  } = t, {
169
- boundary: a = "clippingAncestors",
169
+ boundary: c = "clippingAncestors",
170
170
  rootBoundary: d = "viewport",
171
- elementContext: f = "floating",
171
+ elementContext: u = "floating",
172
172
  altBoundary: h = !1,
173
- padding: u = 0
174
- } = Z(e, t), p = Ot(u), m = l[h ? f === "floating" ? "reference" : "floating" : f], y = st(await s.getClippingRect({
173
+ padding: f = 0
174
+ } = tt(e, t), p = Lt(f), m = l[h ? u === "floating" ? "reference" : "floating" : u], y = lt(await s.getClippingRect({
175
175
  element: (n = await (s.isElement == null ? void 0 : s.isElement(m))) == null || n ? m : m.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
176
- boundary: a,
176
+ boundary: c,
177
177
  rootBoundary: d,
178
- strategy: c
179
- })), w = f === "floating" ? {
178
+ strategy: a
179
+ })), w = u === "floating" ? {
180
180
  x: i,
181
181
  y: o,
182
182
  width: r.floating.width,
@@ -187,11 +187,11 @@ async function Qt(t, e) {
187
187
  } : {
188
188
  x: 1,
189
189
  y: 1
190
- }, E = st(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
190
+ }, E = lt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
191
191
  elements: l,
192
192
  rect: w,
193
193
  offsetParent: x,
194
- strategy: c
194
+ strategy: a
195
195
  }) : w);
196
196
  return {
197
197
  top: (y.top - E.top + p.top) / v.y,
@@ -200,21 +200,21 @@ async function Qt(t, e) {
200
200
  right: (E.right - y.right + p.right) / v.x
201
201
  };
202
202
  }
203
- const Zt = async (t, e, n) => {
203
+ const ne = async (t, e, n) => {
204
204
  const {
205
205
  placement: i = "bottom",
206
206
  strategy: o = "absolute",
207
207
  middleware: s = [],
208
208
  platform: r
209
- } = n, l = s.filter(Boolean), c = await (r.isRTL == null ? void 0 : r.isRTL(e));
210
- let a = await r.getElementRects({
209
+ } = n, l = s.filter(Boolean), a = await (r.isRTL == null ? void 0 : r.isRTL(e));
210
+ let c = await r.getElementRects({
211
211
  reference: t,
212
212
  floating: e,
213
213
  strategy: o
214
214
  }), {
215
215
  x: d,
216
- y: f
217
- } = vt(a, i, c), h = i, u = {}, p = 0;
216
+ y: u
217
+ } = Ct(c, i, a), h = i, f = {}, p = 0;
218
218
  for (let m = 0; m < l.length; m++) {
219
219
  var g;
220
220
  const {
@@ -227,44 +227,44 @@ const Zt = async (t, e, n) => {
227
227
  reset: A
228
228
  } = await w({
229
229
  x: d,
230
- y: f,
230
+ y: u,
231
231
  initialPlacement: i,
232
232
  placement: h,
233
233
  strategy: o,
234
- middlewareData: u,
235
- rects: a,
234
+ middlewareData: f,
235
+ rects: c,
236
236
  platform: {
237
237
  ...r,
238
- detectOverflow: (g = r.detectOverflow) != null ? g : Qt
238
+ detectOverflow: (g = r.detectOverflow) != null ? g : ie
239
239
  },
240
240
  elements: {
241
241
  reference: t,
242
242
  floating: e
243
243
  }
244
244
  });
245
- d = x ?? d, f = v ?? f, u = {
246
- ...u,
245
+ d = x ?? d, u = v ?? u, f = {
246
+ ...f,
247
247
  [y]: {
248
- ...u[y],
248
+ ...f[y],
249
249
  ...E
250
250
  }
251
- }, A && p <= 50 && (p++, typeof A == "object" && (A.placement && (h = A.placement), A.rects && (a = A.rects === !0 ? await r.getElementRects({
251
+ }, A && p <= 50 && (p++, typeof A == "object" && (A.placement && (h = A.placement), A.rects && (c = A.rects === !0 ? await r.getElementRects({
252
252
  reference: t,
253
253
  floating: e,
254
254
  strategy: o
255
255
  }) : A.rects), {
256
256
  x: d,
257
- y: f
258
- } = vt(a, h, c)), m = -1);
257
+ y: u
258
+ } = Ct(c, h, a)), m = -1);
259
259
  }
260
260
  return {
261
261
  x: d,
262
- y: f,
262
+ y: u,
263
263
  placement: h,
264
264
  strategy: o,
265
- middlewareData: u
265
+ middlewareData: f
266
266
  };
267
- }, te = (t) => ({
267
+ }, oe = (t) => ({
268
268
  name: "arrow",
269
269
  options: t,
270
270
  async fn(e) {
@@ -275,33 +275,33 @@ const Zt = async (t, e, n) => {
275
275
  rects: s,
276
276
  platform: r,
277
277
  elements: l,
278
- middlewareData: c
278
+ middlewareData: a
279
279
  } = e, {
280
- element: a,
280
+ element: c,
281
281
  padding: d = 0
282
- } = Z(t, e) || {};
283
- if (a == null)
282
+ } = tt(t, e) || {};
283
+ if (c == null)
284
284
  return {};
285
- const f = Ot(d), h = {
285
+ const u = Lt(d), h = {
286
286
  x: n,
287
287
  y: i
288
- }, u = mt(o), p = gt(u), g = await r.getDimensions(a), m = u === "y", y = m ? "top" : "left", w = m ? "bottom" : "right", x = m ? "clientHeight" : "clientWidth", v = s.reference[p] + s.reference[u] - h[u] - s.floating[p], E = h[u] - s.reference[u], A = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
288
+ }, f = xt(o), p = wt(f), g = await r.getDimensions(c), m = f === "y", y = m ? "top" : "left", w = m ? "bottom" : "right", x = m ? "clientHeight" : "clientWidth", v = s.reference[p] + s.reference[f] - h[f] - s.floating[p], E = h[f] - s.reference[f], A = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c));
289
289
  let M = A ? A[x] : 0;
290
290
  (!M || !await (r.isElement == null ? void 0 : r.isElement(A))) && (M = l.floating[x] || s.floating[p]);
291
- const K = v / 2 - E / 2, N = M / 2 - g[p] / 2 - 1, P = U(f[y], N), G = U(f[w], N), V = P, J = M - g[p] - G, S = M / 2 - g[p] / 2 + K, W = dt(V, S, J), D = !c.arrow && tt(o) != null && S !== W && s.reference[p] / 2 - (S < V ? P : G) - g[p] / 2 < 0, T = D ? S < V ? S - V : S - J : 0;
291
+ const G = v / 2 - E / 2, N = M / 2 - g[p] / 2 - 1, P = Q(u[y], N), J = Q(u[w], N), V = P, U = M - g[p] - J, S = M / 2 - g[p] / 2 + G, W = gt(V, S, U), F = !a.arrow && et(o) != null && S !== W && s.reference[p] / 2 - (S < V ? P : J) - g[p] / 2 < 0, I = F ? S < V ? S - V : S - U : 0;
292
292
  return {
293
- [u]: h[u] + T,
293
+ [f]: h[f] + I,
294
294
  data: {
295
- [u]: W,
296
- centerOffset: S - W - T,
297
- ...D && {
298
- alignmentOffset: T
295
+ [f]: W,
296
+ centerOffset: S - W - I,
297
+ ...F && {
298
+ alignmentOffset: I
299
299
  }
300
300
  },
301
- reset: D
301
+ reset: F
302
302
  };
303
303
  }
304
- }), ee = function(t) {
304
+ }), se = function(t) {
305
305
  return t === void 0 && (t = {}), {
306
306
  name: "flip",
307
307
  options: t,
@@ -312,36 +312,36 @@ const Zt = async (t, e, n) => {
312
312
  middlewareData: s,
313
313
  rects: r,
314
314
  initialPlacement: l,
315
- platform: c,
316
- elements: a
315
+ platform: a,
316
+ elements: c
317
317
  } = e, {
318
318
  mainAxis: d = !0,
319
- crossAxis: f = !0,
319
+ crossAxis: u = !0,
320
320
  fallbackPlacements: h,
321
- fallbackStrategy: u = "bestFit",
321
+ fallbackStrategy: f = "bestFit",
322
322
  fallbackAxisSideDirection: p = "none",
323
323
  flipAlignment: g = !0,
324
324
  ...m
325
- } = Z(t, e);
325
+ } = tt(t, e);
326
326
  if ((n = s.arrow) != null && n.alignmentOffset)
327
327
  return {};
328
- const y = H(o), w = _(l), x = H(l) === l, v = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), E = h || (x || !g ? [ot(l)] : jt(l)), A = p !== "none";
329
- !h && A && E.push(...Jt(l, g, p, v));
330
- const M = [l, ...E], K = await c.detectOverflow(e, m), N = [];
328
+ const y = X(o), w = _(l), x = X(l) === l, v = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), E = h || (x || !g ? [rt(l)] : Jt(l)), A = p !== "none";
329
+ !h && A && E.push(...te(l, g, p, v));
330
+ const M = [l, ...E], G = await a.detectOverflow(e, m), N = [];
331
331
  let P = ((i = s.flip) == null ? void 0 : i.overflows) || [];
332
- if (d && N.push(K[y]), f) {
333
- const S = Xt(o, r, v);
334
- N.push(K[S[0]], K[S[1]]);
332
+ if (d && N.push(G[y]), u) {
333
+ const S = Gt(o, r, v);
334
+ N.push(G[S[0]], G[S[1]]);
335
335
  }
336
336
  if (P = [...P, {
337
337
  placement: o,
338
338
  overflows: N
339
339
  }], !N.every((S) => S <= 0)) {
340
- var G, V;
341
- const S = (((G = s.flip) == null ? void 0 : G.index) || 0) + 1, W = M[S];
342
- if (W && (!(f === "alignment" ? w !== _(W) : !1) || // We leave the current main axis only if every placement on that axis
340
+ var J, V;
341
+ const S = (((J = s.flip) == null ? void 0 : J.index) || 0) + 1, W = M[S];
342
+ if (W && (!(u === "alignment" ? w !== _(W) : !1) || // We leave the current main axis only if every placement on that axis
343
343
  // overflows the main axis.
344
- P.every((O) => _(O.placement) === w ? O.overflows[0] > 0 : !0)))
344
+ P.every((k) => _(k.placement) === w ? k.overflows[0] > 0 : !0)))
345
345
  return {
346
346
  data: {
347
347
  index: S,
@@ -351,66 +351,66 @@ const Zt = async (t, e, n) => {
351
351
  placement: W
352
352
  }
353
353
  };
354
- let D = (V = P.filter((T) => T.overflows[0] <= 0).sort((T, O) => T.overflows[1] - O.overflows[1])[0]) == null ? void 0 : V.placement;
355
- if (!D)
356
- switch (u) {
354
+ let F = (V = P.filter((I) => I.overflows[0] <= 0).sort((I, k) => I.overflows[1] - k.overflows[1])[0]) == null ? void 0 : V.placement;
355
+ if (!F)
356
+ switch (f) {
357
357
  case "bestFit": {
358
- var J;
359
- const T = (J = P.filter((O) => {
358
+ var U;
359
+ const I = (U = P.filter((k) => {
360
360
  if (A) {
361
- const B = _(O.placement);
361
+ const B = _(k.placement);
362
362
  return B === w || // Create a bias to the `y` side axis due to horizontal
363
363
  // reading directions favoring greater width.
364
364
  B === "y";
365
365
  }
366
366
  return !0;
367
- }).map((O) => [O.placement, O.overflows.filter((B) => B > 0).reduce((B, Mt) => B + Mt, 0)]).sort((O, B) => O[1] - B[1])[0]) == null ? void 0 : J[0];
368
- T && (D = T);
367
+ }).map((k) => [k.placement, k.overflows.filter((B) => B > 0).reduce((B, Ht) => B + Ht, 0)]).sort((k, B) => k[1] - B[1])[0]) == null ? void 0 : U[0];
368
+ I && (F = I);
369
369
  break;
370
370
  }
371
371
  case "initialPlacement":
372
- D = l;
372
+ F = l;
373
373
  break;
374
374
  }
375
- if (o !== D)
375
+ if (o !== F)
376
376
  return {
377
377
  reset: {
378
- placement: D
378
+ placement: F
379
379
  }
380
380
  };
381
381
  }
382
382
  return {};
383
383
  }
384
384
  };
385
- }, ie = /* @__PURE__ */ new Set(["left", "top"]);
386
- async function ne(t, e) {
385
+ }, re = /* @__PURE__ */ new Set(["left", "top"]);
386
+ async function le(t, e) {
387
387
  const {
388
388
  placement: n,
389
389
  platform: i,
390
390
  elements: o
391
- } = t, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = H(n), l = tt(n), c = _(n) === "y", a = ie.has(r) ? -1 : 1, d = s && c ? -1 : 1, f = Z(e, t);
391
+ } = t, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = X(n), l = et(n), a = _(n) === "y", c = re.has(r) ? -1 : 1, d = s && a ? -1 : 1, u = tt(e, t);
392
392
  let {
393
393
  mainAxis: h,
394
- crossAxis: u,
394
+ crossAxis: f,
395
395
  alignmentAxis: p
396
- } = typeof f == "number" ? {
397
- mainAxis: f,
396
+ } = typeof u == "number" ? {
397
+ mainAxis: u,
398
398
  crossAxis: 0,
399
399
  alignmentAxis: null
400
400
  } : {
401
- mainAxis: f.mainAxis || 0,
402
- crossAxis: f.crossAxis || 0,
403
- alignmentAxis: f.alignmentAxis
401
+ mainAxis: u.mainAxis || 0,
402
+ crossAxis: u.crossAxis || 0,
403
+ alignmentAxis: u.alignmentAxis
404
404
  };
405
- return l && typeof p == "number" && (u = l === "end" ? p * -1 : p), c ? {
406
- x: u * d,
407
- y: h * a
405
+ return l && typeof p == "number" && (f = l === "end" ? p * -1 : p), a ? {
406
+ x: f * d,
407
+ y: h * c
408
408
  } : {
409
- x: h * a,
410
- y: u * d
409
+ x: h * c,
410
+ y: f * d
411
411
  };
412
412
  }
413
- const oe = function(t) {
413
+ const ce = function(t) {
414
414
  return t === void 0 && (t = 0), {
415
415
  name: "offset",
416
416
  options: t,
@@ -421,18 +421,18 @@ const oe = function(t) {
421
421
  y: s,
422
422
  placement: r,
423
423
  middlewareData: l
424
- } = e, c = await ne(e, t);
424
+ } = e, a = await le(e, t);
425
425
  return r === ((n = l.offset) == null ? void 0 : n.placement) && (i = l.arrow) != null && i.alignmentOffset ? {} : {
426
- x: o + c.x,
427
- y: s + c.y,
426
+ x: o + a.x,
427
+ y: s + a.y,
428
428
  data: {
429
- ...c,
429
+ ...a,
430
430
  placement: r
431
431
  }
432
432
  };
433
433
  }
434
434
  };
435
- }, se = function(t) {
435
+ }, ae = function(t) {
436
436
  return t === void 0 && (t = {}), {
437
437
  name: "shift",
438
438
  options: t,
@@ -445,7 +445,7 @@ const oe = function(t) {
445
445
  } = e, {
446
446
  mainAxis: r = !0,
447
447
  crossAxis: l = !1,
448
- limiter: c = {
448
+ limiter: a = {
449
449
  fn: (y) => {
450
450
  let {
451
451
  x: w,
@@ -457,23 +457,23 @@ const oe = function(t) {
457
457
  };
458
458
  }
459
459
  },
460
- ...a
461
- } = Z(t, e), d = {
460
+ ...c
461
+ } = tt(t, e), d = {
462
462
  x: n,
463
463
  y: i
464
- }, f = await s.detectOverflow(e, a), h = _(H(o)), u = Tt(h);
465
- let p = d[u], g = d[h];
464
+ }, u = await s.detectOverflow(e, c), h = _(X(o)), f = $t(h);
465
+ let p = d[f], g = d[h];
466
466
  if (r) {
467
- const y = u === "y" ? "top" : "left", w = u === "y" ? "bottom" : "right", x = p + f[y], v = p - f[w];
468
- p = dt(x, p, v);
467
+ const y = f === "y" ? "top" : "left", w = f === "y" ? "bottom" : "right", x = p + u[y], v = p - u[w];
468
+ p = gt(x, p, v);
469
469
  }
470
470
  if (l) {
471
- const y = h === "y" ? "top" : "left", w = h === "y" ? "bottom" : "right", x = g + f[y], v = g - f[w];
472
- g = dt(x, g, v);
471
+ const y = h === "y" ? "top" : "left", w = h === "y" ? "bottom" : "right", x = g + u[y], v = g - u[w];
472
+ g = gt(x, g, v);
473
473
  }
474
- const m = c.fn({
474
+ const m = a.fn({
475
475
  ...e,
476
- [u]: p,
476
+ [f]: p,
477
477
  [h]: g
478
478
  });
479
479
  return {
@@ -482,7 +482,7 @@ const oe = function(t) {
482
482
  x: m.x - n,
483
483
  y: m.y - i,
484
484
  enabled: {
485
- [u]: r,
485
+ [f]: r,
486
486
  [h]: l
487
487
  }
488
488
  }
@@ -490,49 +490,49 @@ const oe = function(t) {
490
490
  }
491
491
  };
492
492
  };
493
- function rt() {
493
+ function ct() {
494
494
  return typeof window < "u";
495
495
  }
496
- function Y(t) {
497
- return kt(t) ? (t.nodeName || "").toLowerCase() : "#document";
496
+ function K(t) {
497
+ return Rt(t) ? (t.nodeName || "").toLowerCase() : "#document";
498
498
  }
499
- function C(t) {
499
+ function T(t) {
500
500
  var e;
501
501
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
502
502
  }
503
- function F(t) {
503
+ function D(t) {
504
504
  var e;
505
- return (e = (kt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
505
+ return (e = (Rt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
506
506
  }
507
- function kt(t) {
508
- return rt() ? t instanceof Node || t instanceof C(t).Node : !1;
507
+ function Rt(t) {
508
+ return ct() ? t instanceof Node || t instanceof T(t).Node : !1;
509
509
  }
510
- function L(t) {
511
- return rt() ? t instanceof Element || t instanceof C(t).Element : !1;
510
+ function O(t) {
511
+ return ct() ? t instanceof Element || t instanceof T(t).Element : !1;
512
512
  }
513
- function I(t) {
514
- return rt() ? t instanceof HTMLElement || t instanceof C(t).HTMLElement : !1;
513
+ function R(t) {
514
+ return ct() ? t instanceof HTMLElement || t instanceof T(t).HTMLElement : !1;
515
515
  }
516
- function St(t) {
517
- return !rt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof C(t).ShadowRoot;
516
+ function Et(t) {
517
+ return !ct() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof T(t).ShadowRoot;
518
518
  }
519
- const re = /* @__PURE__ */ new Set(["inline", "contents"]);
520
- function et(t) {
519
+ const ue = /* @__PURE__ */ new Set(["inline", "contents"]);
520
+ function it(t) {
521
521
  const {
522
522
  overflow: e,
523
523
  overflowX: n,
524
524
  overflowY: i,
525
525
  display: o
526
526
  } = $(t);
527
- return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !re.has(o);
527
+ return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !ue.has(o);
528
528
  }
529
- const le = /* @__PURE__ */ new Set(["table", "td", "th"]);
530
- function ce(t) {
531
- return le.has(Y(t));
529
+ const fe = /* @__PURE__ */ new Set(["table", "td", "th"]);
530
+ function de(t) {
531
+ return fe.has(K(t));
532
532
  }
533
- const ae = [":popover-open", ":modal"];
534
- function lt(t) {
535
- return ae.some((e) => {
533
+ const he = [":popover-open", ":modal"];
534
+ function at(t) {
535
+ return he.some((e) => {
536
536
  try {
537
537
  return t.matches(e);
538
538
  } catch {
@@ -540,34 +540,34 @@ function lt(t) {
540
540
  }
541
541
  });
542
542
  }
543
- const fe = ["transform", "translate", "scale", "rotate", "perspective"], ue = ["transform", "translate", "scale", "rotate", "perspective", "filter"], de = ["paint", "layout", "strict", "content"];
544
- function yt(t) {
545
- const e = wt(), n = L(t) ? $(t) : t;
546
- return fe.some((i) => n[i] ? n[i] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ue.some((i) => (n.willChange || "").includes(i)) || de.some((i) => (n.contain || "").includes(i));
543
+ const pe = ["transform", "translate", "scale", "rotate", "perspective"], ge = ["transform", "translate", "scale", "rotate", "perspective", "filter"], me = ["paint", "layout", "strict", "content"];
544
+ function bt(t) {
545
+ const e = vt(), n = O(t) ? $(t) : t;
546
+ return pe.some((i) => n[i] ? n[i] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !e && (n.filter ? n.filter !== "none" : !1) || ge.some((i) => (n.willChange || "").includes(i)) || me.some((i) => (n.contain || "").includes(i));
547
547
  }
548
- function he(t) {
548
+ function ye(t) {
549
549
  let e = q(t);
550
- for (; I(e) && !j(e); ) {
551
- if (yt(e))
550
+ for (; R(e) && !Y(e); ) {
551
+ if (bt(e))
552
552
  return e;
553
- if (lt(e))
553
+ if (at(e))
554
554
  return null;
555
555
  e = q(e);
556
556
  }
557
557
  return null;
558
558
  }
559
- function wt() {
559
+ function vt() {
560
560
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
561
561
  }
562
- const pe = /* @__PURE__ */ new Set(["html", "body", "#document"]);
563
- function j(t) {
564
- return pe.has(Y(t));
562
+ const we = /* @__PURE__ */ new Set(["html", "body", "#document"]);
563
+ function Y(t) {
564
+ return we.has(K(t));
565
565
  }
566
566
  function $(t) {
567
- return C(t).getComputedStyle(t);
567
+ return T(t).getComputedStyle(t);
568
568
  }
569
- function ct(t) {
570
- return L(t) ? {
569
+ function ut(t) {
570
+ return O(t) ? {
571
571
  scrollLeft: t.scrollLeft,
572
572
  scrollTop: t.scrollTop
573
573
  } : {
@@ -576,135 +576,135 @@ function ct(t) {
576
576
  };
577
577
  }
578
578
  function q(t) {
579
- if (Y(t) === "html")
579
+ if (K(t) === "html")
580
580
  return t;
581
581
  const e = (
582
582
  // Step into the shadow DOM of the parent of a slotted node.
583
583
  t.assignedSlot || // DOM Element detected.
584
584
  t.parentNode || // ShadowRoot detected.
585
- St(t) && t.host || // Fallback.
586
- F(t)
585
+ Et(t) && t.host || // Fallback.
586
+ D(t)
587
587
  );
588
- return St(e) ? e.host : e;
588
+ return Et(e) ? e.host : e;
589
589
  }
590
- function Lt(t) {
590
+ function Pt(t) {
591
591
  const e = q(t);
592
- return j(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : I(e) && et(e) ? e : Lt(e);
592
+ return Y(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : R(e) && it(e) ? e : Pt(e);
593
593
  }
594
- function $t(t, e, n) {
594
+ function Ft(t, e, n) {
595
595
  var i;
596
596
  e === void 0 && (e = []);
597
- const o = Lt(t), s = o === ((i = t.ownerDocument) == null ? void 0 : i.body), r = C(o);
598
- return s ? (pt(r), e.concat(r, r.visualViewport || [], et(o) ? o : [], [])) : e.concat(o, $t(o, []));
597
+ const o = Pt(t), s = o === ((i = t.ownerDocument) == null ? void 0 : i.body), r = T(o);
598
+ return s ? (yt(r), e.concat(r, r.visualViewport || [], it(o) ? o : [], [])) : e.concat(o, Ft(o, []));
599
599
  }
600
- function pt(t) {
600
+ function yt(t) {
601
601
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
602
602
  }
603
- function Rt(t) {
603
+ function Dt(t) {
604
604
  const e = $(t);
605
605
  let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
606
- const o = I(t), s = o ? t.offsetWidth : n, r = o ? t.offsetHeight : i, l = nt(n) !== s || nt(i) !== r;
606
+ const o = R(t), s = o ? t.offsetWidth : n, r = o ? t.offsetHeight : i, l = st(n) !== s || st(i) !== r;
607
607
  return l && (n = s, i = r), {
608
608
  width: n,
609
609
  height: i,
610
610
  $: l
611
611
  };
612
612
  }
613
- function It(t) {
614
- return L(t) ? t : t.contextElement;
613
+ function Bt(t) {
614
+ return O(t) ? t : t.contextElement;
615
615
  }
616
- function X(t) {
617
- const e = It(t);
618
- if (!I(e))
619
- return R(1);
616
+ function j(t) {
617
+ const e = Bt(t);
618
+ if (!R(e))
619
+ return L(1);
620
620
  const n = e.getBoundingClientRect(), {
621
621
  width: i,
622
622
  height: o,
623
623
  $: s
624
- } = Rt(e);
625
- let r = (s ? nt(n.width) : n.width) / i, l = (s ? nt(n.height) : n.height) / o;
624
+ } = Dt(e);
625
+ let r = (s ? st(n.width) : n.width) / i, l = (s ? st(n.height) : n.height) / o;
626
626
  return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
627
627
  x: r,
628
628
  y: l
629
629
  };
630
630
  }
631
- const ge = /* @__PURE__ */ R(0);
632
- function Pt(t) {
633
- const e = C(t);
634
- return !wt() || !e.visualViewport ? ge : {
631
+ const xe = /* @__PURE__ */ L(0);
632
+ function _t(t) {
633
+ const e = T(t);
634
+ return !vt() || !e.visualViewport ? xe : {
635
635
  x: e.visualViewport.offsetLeft,
636
636
  y: e.visualViewport.offsetTop
637
637
  };
638
638
  }
639
- function me(t, e, n) {
640
- return e === void 0 && (e = !1), !n || e && n !== C(t) ? !1 : e;
639
+ function be(t, e, n) {
640
+ return e === void 0 && (e = !1), !n || e && n !== T(t) ? !1 : e;
641
641
  }
642
- function Q(t, e, n, i) {
642
+ function Z(t, e, n, i) {
643
643
  e === void 0 && (e = !1), n === void 0 && (n = !1);
644
- const o = t.getBoundingClientRect(), s = It(t);
645
- let r = R(1);
646
- e && (i ? L(i) && (r = X(i)) : r = X(t));
647
- const l = me(s, n, i) ? Pt(s) : R(0);
648
- let c = (o.left + l.x) / r.x, a = (o.top + l.y) / r.y, d = o.width / r.x, f = o.height / r.y;
644
+ const o = t.getBoundingClientRect(), s = Bt(t);
645
+ let r = L(1);
646
+ e && (i ? O(i) && (r = j(i)) : r = j(t));
647
+ const l = be(s, n, i) ? _t(s) : L(0);
648
+ let a = (o.left + l.x) / r.x, c = (o.top + l.y) / r.y, d = o.width / r.x, u = o.height / r.y;
649
649
  if (s) {
650
- const h = C(s), u = i && L(i) ? C(i) : i;
651
- let p = h, g = pt(p);
652
- for (; g && i && u !== p; ) {
653
- const m = X(g), y = g.getBoundingClientRect(), w = $(g), x = y.left + (g.clientLeft + parseFloat(w.paddingLeft)) * m.x, v = y.top + (g.clientTop + parseFloat(w.paddingTop)) * m.y;
654
- c *= m.x, a *= m.y, d *= m.x, f *= m.y, c += x, a += v, p = C(g), g = pt(p);
650
+ const h = T(s), f = i && O(i) ? T(i) : i;
651
+ let p = h, g = yt(p);
652
+ for (; g && i && f !== p; ) {
653
+ const m = j(g), y = g.getBoundingClientRect(), w = $(g), x = y.left + (g.clientLeft + parseFloat(w.paddingLeft)) * m.x, v = y.top + (g.clientTop + parseFloat(w.paddingTop)) * m.y;
654
+ a *= m.x, c *= m.y, d *= m.x, u *= m.y, a += x, c += v, p = T(g), g = yt(p);
655
655
  }
656
656
  }
657
- return st({
657
+ return lt({
658
658
  width: d,
659
- height: f,
660
- x: c,
661
- y: a
659
+ height: u,
660
+ x: a,
661
+ y: c
662
662
  });
663
663
  }
664
- function at(t, e) {
665
- const n = ct(t).scrollLeft;
666
- return e ? e.left + n : Q(F(t)).left + n;
664
+ function ft(t, e) {
665
+ const n = ut(t).scrollLeft;
666
+ return e ? e.left + n : Z(D(t)).left + n;
667
667
  }
668
- function Dt(t, e) {
669
- const n = t.getBoundingClientRect(), i = n.left + e.scrollLeft - at(t, n), o = n.top + e.scrollTop;
668
+ function qt(t, e) {
669
+ const n = t.getBoundingClientRect(), i = n.left + e.scrollLeft - ft(t, n), o = n.top + e.scrollTop;
670
670
  return {
671
671
  x: i,
672
672
  y: o
673
673
  };
674
674
  }
675
- function ye(t) {
675
+ function ve(t) {
676
676
  let {
677
677
  elements: e,
678
678
  rect: n,
679
679
  offsetParent: i,
680
680
  strategy: o
681
681
  } = t;
682
- const s = o === "fixed", r = F(i), l = e ? lt(e.floating) : !1;
682
+ const s = o === "fixed", r = D(i), l = e ? at(e.floating) : !1;
683
683
  if (i === r || l && s)
684
684
  return n;
685
- let c = {
685
+ let a = {
686
686
  scrollLeft: 0,
687
687
  scrollTop: 0
688
- }, a = R(1);
689
- const d = R(0), f = I(i);
690
- if ((f || !f && !s) && ((Y(i) !== "body" || et(r)) && (c = ct(i)), I(i))) {
691
- const u = Q(i);
692
- a = X(i), d.x = u.x + i.clientLeft, d.y = u.y + i.clientTop;
688
+ }, c = L(1);
689
+ const d = L(0), u = R(i);
690
+ if ((u || !u && !s) && ((K(i) !== "body" || it(r)) && (a = ut(i)), R(i))) {
691
+ const f = Z(i);
692
+ c = j(i), d.x = f.x + i.clientLeft, d.y = f.y + i.clientTop;
693
693
  }
694
- const h = r && !f && !s ? Dt(r, c) : R(0);
694
+ const h = r && !u && !s ? qt(r, a) : L(0);
695
695
  return {
696
- width: n.width * a.x,
697
- height: n.height * a.y,
698
- x: n.x * a.x - c.scrollLeft * a.x + d.x + h.x,
699
- y: n.y * a.y - c.scrollTop * a.y + d.y + h.y
696
+ width: n.width * c.x,
697
+ height: n.height * c.y,
698
+ x: n.x * c.x - a.scrollLeft * c.x + d.x + h.x,
699
+ y: n.y * c.y - a.scrollTop * c.y + d.y + h.y
700
700
  };
701
701
  }
702
- function we(t) {
702
+ function Se(t) {
703
703
  return Array.from(t.getClientRects());
704
704
  }
705
- function xe(t) {
706
- const e = F(t), n = ct(t), i = t.ownerDocument.body, o = z(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = z(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
707
- let r = -n.scrollLeft + at(t);
705
+ function Ae(t) {
706
+ const e = D(t), n = ut(t), i = t.ownerDocument.body, o = z(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = z(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
707
+ let r = -n.scrollLeft + ft(t);
708
708
  const l = -n.scrollTop;
709
709
  return $(i).direction === "rtl" && (r += z(e.clientWidth, i.clientWidth) - o), {
710
710
  width: o,
@@ -713,47 +713,47 @@ function xe(t) {
713
713
  y: l
714
714
  };
715
715
  }
716
- const At = 25;
717
- function be(t, e) {
718
- const n = C(t), i = F(t), o = n.visualViewport;
719
- let s = i.clientWidth, r = i.clientHeight, l = 0, c = 0;
716
+ const It = 25;
717
+ function Te(t, e) {
718
+ const n = T(t), i = D(t), o = n.visualViewport;
719
+ let s = i.clientWidth, r = i.clientHeight, l = 0, a = 0;
720
720
  if (o) {
721
721
  s = o.width, r = o.height;
722
- const d = wt();
723
- (!d || d && e === "fixed") && (l = o.offsetLeft, c = o.offsetTop);
722
+ const d = vt();
723
+ (!d || d && e === "fixed") && (l = o.offsetLeft, a = o.offsetTop);
724
724
  }
725
- const a = at(i);
726
- if (a <= 0) {
727
- const d = i.ownerDocument, f = d.body, h = getComputedStyle(f), u = d.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, p = Math.abs(i.clientWidth - f.clientWidth - u);
728
- p <= At && (s -= p);
729
- } else a <= At && (s += a);
725
+ const c = ft(i);
726
+ if (c <= 0) {
727
+ const d = i.ownerDocument, u = d.body, h = getComputedStyle(u), f = d.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, p = Math.abs(i.clientWidth - u.clientWidth - f);
728
+ p <= It && (s -= p);
729
+ } else c <= It && (s += c);
730
730
  return {
731
731
  width: s,
732
732
  height: r,
733
733
  x: l,
734
- y: c
734
+ y: a
735
735
  };
736
736
  }
737
- const ve = /* @__PURE__ */ new Set(["absolute", "fixed"]);
738
- function Se(t, e) {
739
- const n = Q(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = I(t) ? X(t) : R(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = o * s.x, a = i * s.y;
737
+ const Ce = /* @__PURE__ */ new Set(["absolute", "fixed"]);
738
+ function Ee(t, e) {
739
+ const n = Z(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = R(t) ? j(t) : L(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, a = o * s.x, c = i * s.y;
740
740
  return {
741
741
  width: r,
742
742
  height: l,
743
- x: c,
744
- y: a
743
+ x: a,
744
+ y: c
745
745
  };
746
746
  }
747
- function Ct(t, e, n) {
747
+ function kt(t, e, n) {
748
748
  let i;
749
749
  if (e === "viewport")
750
- i = be(t, n);
750
+ i = Te(t, n);
751
751
  else if (e === "document")
752
- i = xe(F(t));
753
- else if (L(e))
754
- i = Se(e, n);
752
+ i = Ae(D(t));
753
+ else if (O(e))
754
+ i = Ee(e, n);
755
755
  else {
756
- const o = Pt(t);
756
+ const o = _t(t);
757
757
  i = {
758
758
  x: e.x - o.x,
759
759
  y: e.y - o.y,
@@ -761,110 +761,110 @@ function Ct(t, e, n) {
761
761
  height: e.height
762
762
  };
763
763
  }
764
- return st(i);
764
+ return lt(i);
765
765
  }
766
- function Ft(t, e) {
766
+ function Mt(t, e) {
767
767
  const n = q(t);
768
- return n === e || !L(n) || j(n) ? !1 : $(n).position === "fixed" || Ft(n, e);
768
+ return n === e || !O(n) || Y(n) ? !1 : $(n).position === "fixed" || Mt(n, e);
769
769
  }
770
- function Ae(t, e) {
770
+ function Ie(t, e) {
771
771
  const n = e.get(t);
772
772
  if (n)
773
773
  return n;
774
- let i = $t(t, []).filter((l) => L(l) && Y(l) !== "body"), o = null;
774
+ let i = Ft(t, []).filter((l) => O(l) && K(l) !== "body"), o = null;
775
775
  const s = $(t).position === "fixed";
776
776
  let r = s ? q(t) : t;
777
- for (; L(r) && !j(r); ) {
778
- const l = $(r), c = yt(r);
779
- !c && l.position === "fixed" && (o = null), (s ? !c && !o : !c && l.position === "static" && !!o && ve.has(o.position) || et(r) && !c && Ft(t, r)) ? i = i.filter((d) => d !== r) : o = l, r = q(r);
777
+ for (; O(r) && !Y(r); ) {
778
+ const l = $(r), a = bt(r);
779
+ !a && l.position === "fixed" && (o = null), (s ? !a && !o : !a && l.position === "static" && !!o && Ce.has(o.position) || it(r) && !a && Mt(t, r)) ? i = i.filter((d) => d !== r) : o = l, r = q(r);
780
780
  }
781
781
  return e.set(t, i), i;
782
782
  }
783
- function Ce(t) {
783
+ function ke(t) {
784
784
  let {
785
785
  element: e,
786
786
  boundary: n,
787
787
  rootBoundary: i,
788
788
  strategy: o
789
789
  } = t;
790
- const r = [...n === "clippingAncestors" ? lt(e) ? [] : Ae(e, this._c) : [].concat(n), i], l = r[0], c = r.reduce((a, d) => {
791
- const f = Ct(e, d, o);
792
- return a.top = z(f.top, a.top), a.right = U(f.right, a.right), a.bottom = U(f.bottom, a.bottom), a.left = z(f.left, a.left), a;
793
- }, Ct(e, l, o));
790
+ const r = [...n === "clippingAncestors" ? at(e) ? [] : Ie(e, this._c) : [].concat(n), i], l = r[0], a = r.reduce((c, d) => {
791
+ const u = kt(e, d, o);
792
+ return c.top = z(u.top, c.top), c.right = Q(u.right, c.right), c.bottom = Q(u.bottom, c.bottom), c.left = z(u.left, c.left), c;
793
+ }, kt(e, l, o));
794
794
  return {
795
- width: c.right - c.left,
796
- height: c.bottom - c.top,
797
- x: c.left,
798
- y: c.top
795
+ width: a.right - a.left,
796
+ height: a.bottom - a.top,
797
+ x: a.left,
798
+ y: a.top
799
799
  };
800
800
  }
801
- function Ee(t) {
801
+ function Oe(t) {
802
802
  const {
803
803
  width: e,
804
804
  height: n
805
- } = Rt(t);
805
+ } = Dt(t);
806
806
  return {
807
807
  width: e,
808
808
  height: n
809
809
  };
810
810
  }
811
- function Te(t, e, n) {
812
- const i = I(e), o = F(e), s = n === "fixed", r = Q(t, !0, s, e);
811
+ function $e(t, e, n) {
812
+ const i = R(e), o = D(e), s = n === "fixed", r = Z(t, !0, s, e);
813
813
  let l = {
814
814
  scrollLeft: 0,
815
815
  scrollTop: 0
816
816
  };
817
- const c = R(0);
818
- function a() {
819
- c.x = at(o);
817
+ const a = L(0);
818
+ function c() {
819
+ a.x = ft(o);
820
820
  }
821
821
  if (i || !i && !s)
822
- if ((Y(e) !== "body" || et(o)) && (l = ct(e)), i) {
823
- const u = Q(e, !0, s, e);
824
- c.x = u.x + e.clientLeft, c.y = u.y + e.clientTop;
825
- } else o && a();
826
- s && !i && o && a();
827
- const d = o && !i && !s ? Dt(o, l) : R(0), f = r.left + l.scrollLeft - c.x - d.x, h = r.top + l.scrollTop - c.y - d.y;
822
+ if ((K(e) !== "body" || it(o)) && (l = ut(e)), i) {
823
+ const f = Z(e, !0, s, e);
824
+ a.x = f.x + e.clientLeft, a.y = f.y + e.clientTop;
825
+ } else o && c();
826
+ s && !i && o && c();
827
+ const d = o && !i && !s ? qt(o, l) : L(0), u = r.left + l.scrollLeft - a.x - d.x, h = r.top + l.scrollTop - a.y - d.y;
828
828
  return {
829
- x: f,
829
+ x: u,
830
830
  y: h,
831
831
  width: r.width,
832
832
  height: r.height
833
833
  };
834
834
  }
835
- function ft(t) {
835
+ function dt(t) {
836
836
  return $(t).position === "static";
837
837
  }
838
- function Et(t, e) {
839
- if (!I(t) || $(t).position === "fixed")
838
+ function Ot(t, e) {
839
+ if (!R(t) || $(t).position === "fixed")
840
840
  return null;
841
841
  if (e)
842
842
  return e(t);
843
843
  let n = t.offsetParent;
844
- return F(t) === n && (n = n.ownerDocument.body), n;
844
+ return D(t) === n && (n = n.ownerDocument.body), n;
845
845
  }
846
- function Bt(t, e) {
847
- const n = C(t);
848
- if (lt(t))
846
+ function Nt(t, e) {
847
+ const n = T(t);
848
+ if (at(t))
849
849
  return n;
850
- if (!I(t)) {
850
+ if (!R(t)) {
851
851
  let o = q(t);
852
- for (; o && !j(o); ) {
853
- if (L(o) && !ft(o))
852
+ for (; o && !Y(o); ) {
853
+ if (O(o) && !dt(o))
854
854
  return o;
855
855
  o = q(o);
856
856
  }
857
857
  return n;
858
858
  }
859
- let i = Et(t, e);
860
- for (; i && ce(i) && ft(i); )
861
- i = Et(i, e);
862
- return i && j(i) && ft(i) && !yt(i) ? n : i || he(t) || n;
859
+ let i = Ot(t, e);
860
+ for (; i && de(i) && dt(i); )
861
+ i = Ot(i, e);
862
+ return i && Y(i) && dt(i) && !bt(i) ? n : i || ye(t) || n;
863
863
  }
864
- const Oe = async function(t) {
865
- const e = this.getOffsetParent || Bt, n = this.getDimensions, i = await n(t.floating);
864
+ const Le = async function(t) {
865
+ const e = this.getOffsetParent || Nt, n = this.getDimensions, i = await n(t.floating);
866
866
  return {
867
- reference: Te(t.reference, await e(t.floating), t.strategy),
867
+ reference: $e(t.reference, await e(t.floating), t.strategy),
868
868
  floating: {
869
869
  x: 0,
870
870
  y: 0,
@@ -873,72 +873,72 @@ const Oe = async function(t) {
873
873
  }
874
874
  };
875
875
  };
876
- function ke(t) {
876
+ function Re(t) {
877
877
  return $(t).direction === "rtl";
878
878
  }
879
- const Le = {
880
- convertOffsetParentRelativeRectToViewportRelativeRect: ye,
881
- getDocumentElement: F,
882
- getClippingRect: Ce,
883
- getOffsetParent: Bt,
884
- getElementRects: Oe,
885
- getClientRects: we,
886
- getDimensions: Ee,
887
- getScale: X,
888
- isElement: L,
889
- isRTL: ke
890
- }, $e = oe, Re = se, Ie = ee, Pe = te, De = (t, e, n) => {
879
+ const Pe = {
880
+ convertOffsetParentRelativeRectToViewportRelativeRect: ve,
881
+ getDocumentElement: D,
882
+ getClippingRect: ke,
883
+ getOffsetParent: Nt,
884
+ getElementRects: Le,
885
+ getClientRects: Se,
886
+ getDimensions: Oe,
887
+ getScale: j,
888
+ isElement: O,
889
+ isRTL: Re
890
+ }, Fe = ce, De = ae, Be = se, _e = oe, qe = (t, e, n) => {
891
891
  const i = /* @__PURE__ */ new Map(), o = {
892
- platform: Le,
892
+ platform: Pe,
893
893
  ...n
894
894
  }, s = {
895
895
  ...o.platform,
896
896
  _c: i
897
897
  };
898
- return Zt(t, e, {
898
+ return ne(t, e, {
899
899
  ...o,
900
900
  platform: s
901
901
  });
902
902
  };
903
- function _t(t) {
903
+ function Vt(t) {
904
904
  try {
905
905
  return document.querySelector(t);
906
906
  } catch {
907
907
  return console.warn(`[Trailguide] Invalid selector: ${t}`), null;
908
908
  }
909
909
  }
910
- function qt(t) {
910
+ function Wt(t) {
911
911
  const e = t.getBoundingClientRect(), n = window.getComputedStyle(t);
912
912
  return e.width > 0 && e.height > 0 && n.visibility !== "hidden" && n.display !== "none" && n.opacity !== "0";
913
913
  }
914
- function Fe(t) {
914
+ function Me(t) {
915
915
  t.scrollIntoView({
916
- behavior: "smooth",
916
+ behavior: "instant",
917
917
  block: "center",
918
- inline: "center"
918
+ inline: "nearest"
919
919
  });
920
920
  }
921
- function Be(t) {
921
+ function Ne(t) {
922
922
  const e = document.createElement("div");
923
923
  return e.textContent = t, e.innerHTML;
924
924
  }
925
- function it(t, e, n) {
925
+ function nt(t, e, n) {
926
926
  const i = document.createElement(t);
927
927
  return e && (i.className = e), n && n.appendChild(i), i;
928
928
  }
929
- function _e() {
929
+ function Ve() {
930
930
  return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
931
931
  }
932
- let ut = null;
933
- function qe() {
934
- return ut || (ut = _e()), ut;
932
+ let ht = null;
933
+ function We() {
934
+ return ht || (ht = Ve()), ht;
935
935
  }
936
- async function Me(t, e) {
936
+ async function He(t, e) {
937
937
  if (!t.endpoint) return;
938
938
  const n = {
939
939
  ...e,
940
940
  user_id: t.userId,
941
- session_id: qe(),
941
+ session_id: We(),
942
942
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
943
943
  };
944
944
  try {
@@ -952,27 +952,30 @@ async function Me(t, e) {
952
952
  t.debug && console.error("[Trailguide Analytics] Failed:", i);
953
953
  }
954
954
  }
955
- class Ne {
955
+ class Xe {
956
956
  constructor(e = {}) {
957
- k(this, "trail", null);
958
- k(this, "currentStepIndex", 0);
959
- k(this, "isActive", !1);
960
- k(this, "options", {});
957
+ C(this, "trail", null);
958
+ C(this, "currentStepIndex", 0);
959
+ C(this, "isActive", !1);
960
+ C(this, "options", {});
961
961
  // DOM elements
962
- k(this, "overlay", null);
963
- k(this, "tooltip", null);
964
- k(this, "arrowEl", null);
962
+ C(this, "overlay", null);
963
+ C(this, "tooltip", null);
964
+ C(this, "arrowEl", null);
965
965
  // Cleanup functions
966
- k(this, "cleanupFns", []);
967
- k(this, "stepCleanupFns", []);
968
- k(this, "instanceId", `trailguide-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`);
966
+ C(this, "cleanupFns", []);
967
+ C(this, "stepCleanupFns", []);
968
+ C(this, "instanceId", `trailguide-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`);
969
+ // Bug fix: cancel pending step transition timers to prevent stale callbacks
970
+ C(this, "stepTimerId", null);
969
971
  this.options = e;
970
972
  }
971
973
  start(e) {
972
974
  this.trail = e, this.currentStepIndex = 0, this.isActive = !0, this.createOverlay(), this.showStep(), this.bindKeyboard(), this.emitAnalytics("trail_started");
973
975
  }
974
976
  stop() {
975
- this.isActive = !1, this.cleanup();
977
+ var e, n;
978
+ this.isActive ? (this.emitAnalytics("trail_abandoned"), this.isActive = !1, this.cleanup(), (n = (e = this.options).onAbandoned) == null || n.call(e)) : this.cleanup();
976
979
  }
977
980
  next() {
978
981
  !this.trail || !this.isActive || (this.emitAnalytics("step_completed"), this.currentStepIndex < this.trail.steps.length - 1 ? (this.currentStepIndex++, this.showStep()) : this.complete());
@@ -993,8 +996,8 @@ class Ne {
993
996
  }
994
997
  createOverlay() {
995
998
  var i, o, s;
996
- this.overlay = it("div", "trailguide-overlay"), document.body.appendChild(this.overlay);
997
- const e = it("div", "trailguide-spotlight", this.overlay), n = `${this.instanceId}-mask`;
999
+ this.overlay = nt("div", "trailguide-overlay"), document.body.appendChild(this.overlay);
1000
+ const e = nt("div", "trailguide-spotlight", this.overlay), n = `${this.instanceId}-mask`;
998
1001
  e.innerHTML = `
999
1002
  <svg width="100%" height="100%">
1000
1003
  <defs>
@@ -1005,7 +1008,7 @@ class Ne {
1005
1008
  </defs>
1006
1009
  <rect x="0" y="0" width="100%" height="100%" mask="url(#${n})" />
1007
1010
  </svg>
1008
- `, it("div", "trailguide-highlight", this.overlay), this.tooltip = it("div", "trailguide-tooltip"), this.tooltip.innerHTML = `
1011
+ `, nt("div", "trailguide-highlight", this.overlay), this.tooltip = nt("div", "trailguide-tooltip"), this.tooltip.innerHTML = `
1009
1012
  <div class="trailguide-tooltip-content">
1010
1013
  <div class="trailguide-tooltip-header">
1011
1014
  <h3 class="trailguide-tooltip-title"></h3>
@@ -1024,33 +1027,39 @@ class Ne {
1024
1027
  `, document.body.appendChild(this.tooltip), this.arrowEl = this.tooltip.querySelector(".trailguide-tooltip-arrow"), (i = this.tooltip.querySelector(".trailguide-tooltip-close")) == null || i.addEventListener("click", () => this.skip()), (o = this.tooltip.querySelector(".trailguide-btn-prev")) == null || o.addEventListener("click", () => this.prev()), (s = this.tooltip.querySelector(".trailguide-btn-next")) == null || s.addEventListener("click", () => this.next());
1025
1028
  }
1026
1029
  showStep() {
1030
+ var l, a;
1027
1031
  if (!this.trail || !this.overlay || !this.tooltip) return;
1028
- this.stepCleanupFns.forEach((s) => s()), this.stepCleanupFns = [], this.tooltip.style.transform = "";
1032
+ this.stepTimerId !== null && (clearTimeout(this.stepTimerId), this.stepTimerId = null), this.stepCleanupFns.forEach((c) => c()), this.stepCleanupFns = [], this.tooltip.style.transform = "";
1029
1033
  const e = this.overlay.querySelector(".trailguide-spotlight"), n = this.overlay.querySelector(".trailguide-highlight");
1030
1034
  e && (e.style.display = ""), n && (n.style.display = "");
1031
1035
  const i = this.trail.steps[this.currentStepIndex];
1032
1036
  if (!i) return;
1033
1037
  this.emitAnalytics("step_viewed");
1034
- const o = _t(i.target);
1035
- if (!o || !qt(o)) {
1036
- console.warn(`[Trailguide] Target not found or not visible: ${i.target}`), this.showErrorState(i);
1038
+ const o = Vt(i.target), s = !o, r = o ? !Wt(o) : !1;
1039
+ if (s || r) {
1040
+ if (i.optional) {
1041
+ this.currentStepIndex < this.trail.steps.length - 1 ? (this.currentStepIndex++, this.showStep()) : this.complete();
1042
+ return;
1043
+ }
1044
+ const c = s ? "element_not_found" : "element_not_visible";
1045
+ (a = (l = this.options).onError) == null || a.call(l, i, c), console.warn(`[Trailguide] Target not found or not visible: ${i.target}`), this.showErrorState(i);
1037
1046
  return;
1038
1047
  }
1039
- Fe(o), setTimeout(() => {
1040
- var s, r;
1041
- this.updateSpotlight(o), this.updateTooltip(i, o), (r = (s = this.options).onStepChange) == null || r.call(s, i, this.currentStepIndex);
1048
+ Me(o), this.stepTimerId = setTimeout(() => {
1049
+ var c, d;
1050
+ this.stepTimerId = null, this.isActive && (this.updateSpotlight(o), this.updateTooltip(i, o), (d = (c = this.options).onStepChange) == null || d.call(c, i, this.currentStepIndex));
1042
1051
  }, 100);
1043
1052
  }
1044
1053
  showErrorState(e) {
1045
- var f, h;
1054
+ var u, h;
1046
1055
  if (!this.tooltip || !this.trail) return;
1047
- const n = (f = this.overlay) == null ? void 0 : f.querySelector(".trailguide-spotlight"), i = (h = this.overlay) == null ? void 0 : h.querySelector(".trailguide-highlight");
1056
+ const n = (u = this.overlay) == null ? void 0 : u.querySelector(".trailguide-spotlight"), i = (h = this.overlay) == null ? void 0 : h.querySelector(".trailguide-highlight");
1048
1057
  n && (n.style.display = "none"), i && (i.style.display = "none");
1049
- const o = this.tooltip.querySelector(".trailguide-tooltip-title"), s = this.tooltip.querySelector(".trailguide-tooltip-body"), r = this.tooltip.querySelector(".trailguide-tooltip-progress"), l = this.tooltip.querySelector(".trailguide-btn-prev"), c = this.tooltip.querySelector(".trailguide-btn-next"), a = this.currentStepIndex === 0, d = this.currentStepIndex === this.trail.steps.length - 1;
1058
+ const o = this.tooltip.querySelector(".trailguide-tooltip-title"), s = this.tooltip.querySelector(".trailguide-tooltip-body"), r = this.tooltip.querySelector(".trailguide-tooltip-progress"), l = this.tooltip.querySelector(".trailguide-btn-prev"), a = this.tooltip.querySelector(".trailguide-btn-next"), c = this.currentStepIndex === 0, d = this.currentStepIndex === this.trail.steps.length - 1;
1050
1059
  o && (o.textContent = "Element Not Found"), s && (s.innerHTML = `
1051
- <p style="color: #ef4444; margin: 0 0 8px 0;">Could not find: <code style="background: #fee2e2; padding: 2px 6px; border-radius: 4px; font-size: 12px;">${Be(e.target)}</code></p>
1060
+ <p style="color: #ef4444; margin: 0 0 8px 0;">Could not find: <code style="background: #fee2e2; padding: 2px 6px; border-radius: 4px; font-size: 12px;">${Ne(e.target)}</code></p>
1052
1061
  <p style="margin: 0; font-size: 13px; color: #6b7280;">The target element doesn't exist on this page. Press <kbd style="background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 11px;">Esc</kbd> to close or skip to the next step.</p>
1053
- `), r && (r.textContent = `${this.currentStepIndex + 1} of ${this.trail.steps.length}`), l && (l.style.display = a ? "none" : "block"), c && (c.textContent = d ? "Close" : "Skip Step"), this.tooltip.style.left = "50%", this.tooltip.style.top = "50%", this.tooltip.style.transform = "translate(-50%, -50%)";
1062
+ `), r && (r.textContent = `${this.currentStepIndex + 1} of ${this.trail.steps.length}`), l && (l.style.display = c ? "none" : "block"), a && (a.textContent = d ? "Close" : "Skip Step"), this.tooltip.style.left = "50%", this.tooltip.style.top = "50%", this.tooltip.style.transform = "translate(-50%, -50%)";
1054
1063
  }
1055
1064
  updateSpotlight(e) {
1056
1065
  if (!this.overlay) return;
@@ -1069,19 +1078,19 @@ class Ne {
1069
1078
  }
1070
1079
  async updateTooltip(e, n) {
1071
1080
  if (!this.tooltip || !this.trail || !this.arrowEl) return;
1072
- const i = this.currentStepIndex === 0, o = this.currentStepIndex === this.trail.steps.length - 1, s = this.tooltip.querySelector(".trailguide-tooltip-title"), r = this.tooltip.querySelector(".trailguide-tooltip-body"), l = this.tooltip.querySelector(".trailguide-tooltip-progress"), c = this.tooltip.querySelector(".trailguide-btn-prev"), a = this.tooltip.querySelector(".trailguide-btn-next");
1073
- s && (s.textContent = e.title), r && (r.textContent = e.content), l && (l.textContent = `${this.currentStepIndex + 1} of ${this.trail.steps.length}`), c && (c.style.display = i ? "none" : "block"), a && (a.textContent = o ? "Finish" : "Next");
1074
- const { x: d, y: f, placement: h, middlewareData: u } = await De(n, this.tooltip, {
1081
+ const i = this.currentStepIndex === 0, o = this.currentStepIndex === this.trail.steps.length - 1, s = this.tooltip.querySelector(".trailguide-tooltip-title"), r = this.tooltip.querySelector(".trailguide-tooltip-body"), l = this.tooltip.querySelector(".trailguide-tooltip-progress"), a = this.tooltip.querySelector(".trailguide-btn-prev"), c = this.tooltip.querySelector(".trailguide-btn-next");
1082
+ s && (s.textContent = e.title), r && (r.textContent = e.content), l && (l.textContent = `${this.currentStepIndex + 1} of ${this.trail.steps.length}`), a && (a.style.display = i ? "none" : "block"), c && (c.textContent = o ? "Finish" : "Next");
1083
+ const { x: d, y: u, placement: h, middlewareData: f } = await qe(n, this.tooltip, {
1075
1084
  placement: e.placement,
1076
1085
  middleware: [
1077
- $e(12),
1078
- Ie(),
1079
- Re({ padding: 8 }),
1080
- Pe({ element: this.arrowEl })
1086
+ Fe(12),
1087
+ Be(),
1088
+ De({ padding: 8 }),
1089
+ _e({ element: this.arrowEl })
1081
1090
  ]
1082
1091
  });
1083
- if (this.tooltip.style.left = `${d}px`, this.tooltip.style.top = `${f}px`, this.tooltip.dataset.placement = h, u.arrow && this.arrowEl) {
1084
- const { x: p, y: g } = u.arrow;
1092
+ if (!(!this.tooltip || !this.isActive) && (this.tooltip.style.left = `${d}px`, this.tooltip.style.top = `${u}px`, this.tooltip.dataset.placement = h, f.arrow && this.arrowEl)) {
1093
+ const { x: p, y: g } = f.arrow;
1085
1094
  this.arrowEl.style.left = p != null ? `${p}px` : "", this.arrowEl.style.top = g != null ? `${g}px` : "";
1086
1095
  }
1087
1096
  }
@@ -1105,12 +1114,12 @@ class Ne {
1105
1114
  }
1106
1115
  cleanup() {
1107
1116
  var e, n;
1108
- this.stepCleanupFns.forEach((i) => i()), this.stepCleanupFns = [], this.cleanupFns.forEach((i) => i()), this.cleanupFns = [], (e = this.overlay) == null || e.remove(), (n = this.tooltip) == null || n.remove(), this.overlay = null, this.tooltip = null, this.arrowEl = null;
1117
+ this.stepTimerId !== null && (clearTimeout(this.stepTimerId), this.stepTimerId = null), this.stepCleanupFns.forEach((i) => i()), this.stepCleanupFns = [], this.cleanupFns.forEach((i) => i()), this.cleanupFns = [], (e = this.overlay) == null || e.remove(), (n = this.tooltip) == null || n.remove(), this.overlay = null, this.tooltip = null, this.arrowEl = null;
1109
1118
  }
1110
1119
  emitAnalytics(e) {
1111
1120
  if (!this.options.analytics || !this.trail) return;
1112
1121
  const n = this.trail.steps[this.currentStepIndex], i = this.options.analytics.trailId || this.trail.id;
1113
- Me(this.options.analytics, {
1122
+ He(this.options.analytics, {
1114
1123
  event_type: e,
1115
1124
  trail_id: i,
1116
1125
  step_id: n == null ? void 0 : n.id,
@@ -1119,22 +1128,22 @@ class Ne {
1119
1128
  }
1120
1129
  }
1121
1130
  let b = null;
1122
- function He(t, e) {
1123
- return b && b.stop(), b = new Ne(e), b.start(t), b;
1131
+ function Ye(t, e) {
1132
+ return b && b.stop(), b = new Xe(e), b.start(t), b;
1124
1133
  }
1125
- function ze() {
1134
+ function Ke() {
1126
1135
  b == null || b.stop(), b = null;
1127
1136
  }
1128
- function Xe() {
1137
+ function Ge() {
1129
1138
  b == null || b.next();
1130
1139
  }
1131
- function je() {
1140
+ function Je() {
1132
1141
  b == null || b.prev();
1133
1142
  }
1134
- function Ye() {
1143
+ function Ue() {
1135
1144
  b == null || b.skip(), b = null;
1136
1145
  }
1137
- const Ke = {
1146
+ const Qe = {
1138
1147
  // Backgrounds
1139
1148
  bgBase: "#0f172a",
1140
1149
  bgCard: "#1e293b",
@@ -1175,7 +1184,7 @@ const Ke = {
1175
1184
  shadowMedium: "0 4px 20px rgba(0,0,0,0.4)",
1176
1185
  shadowOverlay: "rgba(0,0,0,0.3)"
1177
1186
  };
1178
- function Ge(t) {
1187
+ function Ze(t) {
1179
1188
  const e = [], n = [];
1180
1189
  return t.id || e.push({
1181
1190
  stepId: "",
@@ -1202,8 +1211,8 @@ function Ge(t) {
1202
1211
  });
1203
1212
  return;
1204
1213
  }
1205
- const s = _t(i.target);
1206
- s ? qt(s) || n.push({
1214
+ const s = Vt(i.target);
1215
+ s ? Wt(s) || n.push({
1207
1216
  stepId: i.id,
1208
1217
  stepIndex: o,
1209
1218
  type: "hidden_target",
@@ -1215,7 +1224,7 @@ function Ge(t) {
1215
1224
  type: "missing_target",
1216
1225
  message: `Step ${o + 1} ("${i.title}"): Target element not found`,
1217
1226
  selector: i.target
1218
- }), i.target && Ve(i.target) && n.push({
1227
+ }), i.target && ze(i.target) && n.push({
1219
1228
  stepId: i.id,
1220
1229
  stepIndex: o,
1221
1230
  type: "unstable_selector",
@@ -1228,10 +1237,10 @@ function Ge(t) {
1228
1237
  warnings: n
1229
1238
  });
1230
1239
  }
1231
- function Ve(t) {
1240
+ function ze(t) {
1232
1241
  return t.startsWith("#") || t.includes("[data-") ? !1 : !!(t.includes(":nth-child") || t.includes(":nth-of-type") || /^\.[a-z]+-[a-z0-9]+$/i.test(t));
1233
1242
  }
1234
- function Je(t) {
1243
+ function ti(t) {
1235
1244
  if (t.valid && t.warnings.length === 0) {
1236
1245
  console.log("%c✓ Trail validation passed", "color: green; font-weight: bold");
1237
1246
  return;
@@ -1242,17 +1251,78 @@ function Je(t) {
1242
1251
  console.warn(`Step ${e.stepIndex + 1}: ${e.message}`), e.selector && console.warn(` Selector: ${e.selector}`);
1243
1252
  }), console.groupEnd());
1244
1253
  }
1254
+ const St = "trailguide:";
1255
+ function pt(t) {
1256
+ return `${St}completed:${t}`;
1257
+ }
1258
+ function ot(t) {
1259
+ return `${St}progress:${t}`;
1260
+ }
1261
+ function H() {
1262
+ try {
1263
+ return typeof window < "u" ? window.localStorage : null;
1264
+ } catch {
1265
+ return null;
1266
+ }
1267
+ }
1268
+ const ei = {
1269
+ /** Returns true if the user has completed or skipped this tour */
1270
+ hasCompleted(t) {
1271
+ var e;
1272
+ return ((e = H()) == null ? void 0 : e.getItem(pt(t))) === "true";
1273
+ },
1274
+ /** Marks the tour as completed so it won't auto-show again */
1275
+ markCompleted(t) {
1276
+ var e;
1277
+ (e = H()) == null || e.setItem(pt(t), "true");
1278
+ },
1279
+ /** Returns the last step index the user reached, or null if no progress saved */
1280
+ getProgress(t) {
1281
+ var i;
1282
+ const e = (i = H()) == null ? void 0 : i.getItem(ot(t));
1283
+ if (e == null) return null;
1284
+ const n = parseInt(e, 10);
1285
+ return isNaN(n) ? null : n;
1286
+ },
1287
+ /** Saves the user's current step so they can resume later */
1288
+ saveProgress(t, e) {
1289
+ var n;
1290
+ (n = H()) == null || n.setItem(ot(t), String(e));
1291
+ },
1292
+ /** Clears saved progress (but keeps the completion flag) */
1293
+ clearProgress(t) {
1294
+ var e;
1295
+ (e = H()) == null || e.removeItem(ot(t));
1296
+ },
1297
+ /** Clears both completion and progress state for this tour */
1298
+ reset(t) {
1299
+ const e = H();
1300
+ e == null || e.removeItem(pt(t)), e == null || e.removeItem(ot(t));
1301
+ },
1302
+ /** Clears all Trailguide state from localStorage */
1303
+ resetAll() {
1304
+ const t = H();
1305
+ if (!t) return;
1306
+ const e = [];
1307
+ for (let n = 0; n < t.length; n++) {
1308
+ const i = t.key(n);
1309
+ i != null && i.startsWith(St) && e.push(i);
1310
+ }
1311
+ e.forEach((n) => t.removeItem(n));
1312
+ }
1313
+ };
1245
1314
  export {
1246
- Ne as Trailguide,
1247
- _t as findElement,
1248
- qt as isElementVisible,
1249
- Je as logValidationResults,
1250
- Xe as next,
1251
- je as prev,
1252
- Fe as scrollToElement,
1253
- Ye as skip,
1254
- He as start,
1255
- ze as stop,
1256
- Ke as theme,
1257
- Ge as validateTrail
1315
+ Xe as Trailguide,
1316
+ Vt as findElement,
1317
+ Wt as isElementVisible,
1318
+ ti as logValidationResults,
1319
+ Ge as next,
1320
+ Je as prev,
1321
+ Me as scrollToElement,
1322
+ Ue as skip,
1323
+ Ye as start,
1324
+ Ke as stop,
1325
+ Qe as theme,
1326
+ ei as tourStorage,
1327
+ Ze as validateTrail
1258
1328
  };