@trailguide/core 0.0.2 → 0.1.0

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 Wt = Object.defineProperty;
2
- var Mt = (t, e, n) => e in t ? Wt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var I = (t, e, n) => Mt(t, typeof e != "symbol" ? e + "" : e, n);
4
- const J = Math.min, X = Math.max, nt = Math.round, k = (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
- }), qt = {
7
+ }), jt = {
8
8
  left: "right",
9
9
  right: "left",
10
10
  bottom: "top",
11
11
  top: "bottom"
12
- }, _t = {
12
+ }, Yt = {
13
13
  start: "end",
14
14
  end: "start"
15
15
  };
16
- function ut(t, e, n) {
17
- return X(t, J(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 Et(t) {
28
+ function $t(t) {
29
29
  return t === "x" ? "y" : "x";
30
30
  }
31
- function pt(t) {
31
+ function wt(t) {
32
32
  return t === "y" ? "height" : "width";
33
33
  }
34
- const Ht = /* @__PURE__ */ new Set(["top", "bottom"]);
35
- function V(t) {
36
- return Ht.has(H(t)) ? "y" : "x";
34
+ const Kt = /* @__PURE__ */ new Set(["top", "bottom"]);
35
+ function _(t) {
36
+ return Kt.has(X(t)) ? "y" : "x";
37
37
  }
38
- function gt(t) {
39
- return Et(V(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 = gt(t), s = pt(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 [dt(t), e, dt(e)];
47
+ function Jt(t) {
48
+ const e = rt(t);
49
+ return [mt(t), e, mt(e)];
50
50
  }
51
- function dt(t) {
52
- return t.replace(/start|end/g, (e) => _t[e]);
51
+ function mt(t) {
52
+ return t.replace(/start|end/g, (e) => Yt[e]);
53
53
  }
54
- const yt = ["left", "right"], xt = ["right", "left"], Yt = ["top", "bottom"], zt = ["bottom", "top"];
55
- function Kt(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 ? xt : yt : e ? yt : xt;
59
+ return n ? e ? Tt : At : e ? At : Tt;
60
60
  case "left":
61
61
  case "right":
62
- return e ? Yt : zt;
62
+ return e ? Ut : Qt;
63
63
  default:
64
64
  return [];
65
65
  }
66
66
  }
67
- function Ut(t, e, n, i) {
68
- const o = tt(t);
69
- let s = Kt(H(t), n === "start", i);
70
- return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(dt)))), 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) => qt[e]);
72
+ function rt(t) {
73
+ return t.replace(/left|right|bottom|top/g, (e) => jt[e]);
74
74
  }
75
- function Gt(t) {
75
+ function ee(t) {
76
76
  return {
77
77
  top: 0,
78
78
  right: 0,
@@ -81,15 +81,15 @@ function Gt(t) {
81
81
  ...t
82
82
  };
83
83
  }
84
- function Tt(t) {
85
- return typeof t != "number" ? Gt(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,14 +107,14 @@ 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 = V(e), r = gt(e), l = pt(r), c = H(e), a = s === "y", d = i.x + i.width / 2 - o.width / 2, u = i.y + i.height / 2 - o.height / 2, p = i[l] / 2 - o[l] / 2;
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
116
  let f;
117
- switch (c) {
117
+ switch (a) {
118
118
  case "top":
119
119
  f = {
120
120
  x: d,
@@ -145,17 +145,17 @@ function vt(t, e, n) {
145
145
  y: i.y
146
146
  };
147
147
  }
148
- switch (tt(e)) {
148
+ switch (et(e)) {
149
149
  case "start":
150
- f[r] -= p * (n && a ? -1 : 1);
150
+ f[r] -= h * (n && c ? -1 : 1);
151
151
  break;
152
152
  case "end":
153
- f[r] += p * (n && a ? -1 : 1);
153
+ f[r] += h * (n && c ? -1 : 1);
154
154
  break;
155
155
  }
156
156
  return f;
157
157
  }
158
- async function Jt(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 Jt(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
171
  elementContext: u = "floating",
172
- altBoundary: p = !1,
172
+ altBoundary: h = !1,
173
173
  padding: f = 0
174
- } = Z(e, t), h = Tt(f), m = l[p ? u === "floating" ? "reference" : "floating" : u], w = st(await s.getClippingRect({
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
- })), y = u === "floating" ? {
178
+ strategy: a
179
+ })), w = u === "floating" ? {
180
180
  x: i,
181
181
  y: o,
182
182
  width: r.floating.width,
@@ -187,55 +187,55 @@ async function Jt(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
- rect: y,
192
+ rect: w,
193
193
  offsetParent: x,
194
- strategy: c
195
- }) : y);
194
+ strategy: a
195
+ }) : w);
196
196
  return {
197
- top: (w.top - E.top + h.top) / v.y,
198
- bottom: (E.bottom - w.bottom + h.bottom) / v.y,
199
- left: (w.left - E.left + h.left) / v.x,
200
- right: (E.right - w.right + h.right) / v.x
197
+ top: (y.top - E.top + p.top) / v.y,
198
+ bottom: (E.bottom - y.bottom + p.bottom) / v.y,
199
+ left: (y.left - E.left + p.left) / v.x,
200
+ right: (E.right - y.right + p.right) / v.x
201
201
  };
202
202
  }
203
- const Qt = 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
216
  y: u
217
- } = vt(a, i, c), p = i, f = {}, h = 0;
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 {
221
- name: w,
222
- fn: y
221
+ name: y,
222
+ fn: w
223
223
  } = l[m], {
224
224
  x,
225
225
  y: v,
226
226
  data: E,
227
227
  reset: A
228
- } = await y({
228
+ } = await w({
229
229
  x: d,
230
230
  y: u,
231
231
  initialPlacement: i,
232
- placement: p,
232
+ placement: h,
233
233
  strategy: o,
234
234
  middlewareData: f,
235
- rects: a,
235
+ rects: c,
236
236
  platform: {
237
237
  ...r,
238
- detectOverflow: (g = r.detectOverflow) != null ? g : Jt
238
+ detectOverflow: (g = r.detectOverflow) != null ? g : ie
239
239
  },
240
240
  elements: {
241
241
  reference: t,
@@ -244,27 +244,27 @@ const Qt = async (t, e, n) => {
244
244
  });
245
245
  d = x ?? d, u = v ?? u, f = {
246
246
  ...f,
247
- [w]: {
248
- ...f[w],
247
+ [y]: {
248
+ ...f[y],
249
249
  ...E
250
250
  }
251
- }, A && h <= 50 && (h++, typeof A == "object" && (A.placement && (p = 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
257
  y: u
258
- } = vt(a, p, c)), m = -1);
258
+ } = Ct(c, h, a)), m = -1);
259
259
  }
260
260
  return {
261
261
  x: d,
262
262
  y: u,
263
- placement: p,
263
+ placement: h,
264
264
  strategy: o,
265
265
  middlewareData: f
266
266
  };
267
- }, Zt = (t) => ({
267
+ }, oe = (t) => ({
268
268
  name: "arrow",
269
269
  options: t,
270
270
  async fn(e) {
@@ -275,33 +275,33 @@ const Qt = 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 u = Tt(d), p = {
285
+ const u = Lt(d), h = {
286
286
  x: n,
287
287
  y: i
288
- }, f = gt(o), h = pt(f), g = await r.getDimensions(a), m = f === "y", w = m ? "top" : "left", y = m ? "bottom" : "right", x = m ? "clientHeight" : "clientWidth", v = s.reference[h] + s.reference[f] - p[f] - s.floating[h], E = p[f] - s.reference[f], A = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(a));
289
- let W = A ? A[x] : 0;
290
- (!W || !await (r.isElement == null ? void 0 : r.isElement(A))) && (W = l.floating[x] || s.floating[h]);
291
- const K = v / 2 - E / 2, M = W / 2 - g[h] / 2 - 1, P = J(u[w], M), U = J(u[y], M), q = P, G = W - g[h] - U, S = W / 2 - g[h] / 2 + K, _ = ut(q, S, G), D = !c.arrow && tt(o) != null && S !== _ && s.reference[h] / 2 - (S < q ? P : U) - g[h] / 2 < 0, T = D ? S < q ? S - q : S - G : 0;
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
+ let M = A ? A[x] : 0;
290
+ (!M || !await (r.isElement == null ? void 0 : r.isElement(A))) && (M = l.floating[x] || s.floating[p]);
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
- [f]: p[f] + T,
293
+ [f]: h[f] + I,
294
294
  data: {
295
- [f]: _,
296
- centerOffset: S - _ - 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
- }), te = function(t) {
304
+ }), se = function(t) {
305
305
  return t === void 0 && (t = {}), {
306
306
  name: "flip",
307
307
  options: t,
@@ -312,87 +312,87 @@ const Qt = 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
319
  crossAxis: u = !0,
320
- fallbackPlacements: p,
320
+ fallbackPlacements: h,
321
321
  fallbackStrategy: f = "bestFit",
322
- fallbackAxisSideDirection: h = "none",
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 w = H(o), y = V(l), x = H(l) === l, v = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), E = p || (x || !g ? [ot(l)] : jt(l)), A = h !== "none";
329
- !p && A && E.push(...Ut(l, g, h, v));
330
- const W = [l, ...E], K = await c.detectOverflow(e, m), M = [];
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 && M.push(K[w]), u) {
333
- const S = Xt(o, r, v);
334
- M.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
- overflows: M
339
- }], !M.every((S) => S <= 0)) {
340
- var U, q;
341
- const S = (((U = s.flip) == null ? void 0 : U.index) || 0) + 1, _ = W[S];
342
- if (_ && (!(u === "alignment" ? y !== V(_) : !1) || // We leave the current main axis only if every placement on that axis
338
+ overflows: N
339
+ }], !N.every((S) => S <= 0)) {
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) => V(O.placement) === y ? 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,
348
348
  overflows: P
349
349
  },
350
350
  reset: {
351
- placement: _
351
+ placement: W
352
352
  }
353
353
  };
354
- let D = (q = P.filter((T) => T.overflows[0] <= 0).sort((T, O) => T.overflows[1] - O.overflows[1])[0]) == null ? void 0 : q.placement;
355
- if (!D)
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
356
  switch (f) {
357
357
  case "bestFit": {
358
- var G;
359
- const T = (G = P.filter((O) => {
358
+ var U;
359
+ const I = (U = P.filter((k) => {
360
360
  if (A) {
361
- const B = V(O.placement);
362
- return B === y || // Create a bias to the `y` side axis due to horizontal
361
+ const B = _(k.placement);
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, Nt) => B + Nt, 0)]).sort((O, B) => O[1] - B[1])[0]) == null ? void 0 : G[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
- }, ee = /* @__PURE__ */ new Set(["left", "top"]);
386
- async function ie(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 = V(n) === "y", a = ee.has(r) ? -1 : 1, d = s && c ? -1 : 1, u = 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
- mainAxis: p,
393
+ mainAxis: h,
394
394
  crossAxis: f,
395
- alignmentAxis: h
395
+ alignmentAxis: p
396
396
  } = typeof u == "number" ? {
397
397
  mainAxis: u,
398
398
  crossAxis: 0,
@@ -402,15 +402,15 @@ async function ie(t, e) {
402
402
  crossAxis: u.crossAxis || 0,
403
403
  alignmentAxis: u.alignmentAxis
404
404
  };
405
- return l && typeof h == "number" && (f = l === "end" ? h * -1 : h), c ? {
405
+ return l && typeof p == "number" && (f = l === "end" ? p * -1 : p), a ? {
406
406
  x: f * d,
407
- y: p * a
407
+ y: h * c
408
408
  } : {
409
- x: p * a,
409
+ x: h * c,
410
410
  y: f * d
411
411
  };
412
412
  }
413
- const ne = 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 ne = function(t) {
421
421
  y: s,
422
422
  placement: r,
423
423
  middlewareData: l
424
- } = e, c = await ie(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
- }, oe = function(t) {
435
+ }, ae = function(t) {
436
436
  return t === void 0 && (t = {}), {
437
437
  name: "shift",
438
438
  options: t,
@@ -445,36 +445,36 @@ const ne = function(t) {
445
445
  } = e, {
446
446
  mainAxis: r = !0,
447
447
  crossAxis: l = !1,
448
- limiter: c = {
449
- fn: (w) => {
448
+ limiter: a = {
449
+ fn: (y) => {
450
450
  let {
451
- x: y,
451
+ x: w,
452
452
  y: x
453
- } = w;
453
+ } = y;
454
454
  return {
455
- x: y,
455
+ x: w,
456
456
  y: x
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
- }, u = await s.detectOverflow(e, a), p = V(H(o)), f = Et(p);
465
- let h = d[f], g = d[p];
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 w = f === "y" ? "top" : "left", y = f === "y" ? "bottom" : "right", x = h + u[w], v = h - u[y];
468
- h = ut(x, h, 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 w = p === "y" ? "top" : "left", y = p === "y" ? "bottom" : "right", x = g + u[w], v = g - u[y];
472
- g = ut(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
- [f]: h,
477
- [p]: g
476
+ [f]: p,
477
+ [h]: g
478
478
  });
479
479
  return {
480
480
  ...m,
@@ -483,56 +483,56 @@ const ne = function(t) {
483
483
  y: m.y - i,
484
484
  enabled: {
485
485
  [f]: r,
486
- [p]: l
486
+ [h]: l
487
487
  }
488
488
  }
489
489
  };
490
490
  }
491
491
  };
492
492
  };
493
- function rt() {
493
+ function ct() {
494
494
  return typeof window < "u";
495
495
  }
496
- function z(t) {
497
- return Ot(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 = (Ot(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 Ot(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 R(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 $(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 bt(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 se = /* @__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
- } = L(t);
527
- return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !se.has(o);
526
+ } = $(t);
527
+ return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !ue.has(o);
528
528
  }
529
- const re = /* @__PURE__ */ new Set(["table", "td", "th"]);
530
- function le(t) {
531
- return re.has(z(t));
529
+ const fe = /* @__PURE__ */ new Set(["table", "td", "th"]);
530
+ function de(t) {
531
+ return fe.has(K(t));
532
532
  }
533
- const ce = [":popover-open", ":modal"];
534
- function lt(t) {
535
- return ce.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 ae = ["transform", "translate", "scale", "rotate", "perspective"], fe = ["transform", "translate", "scale", "rotate", "perspective", "filter"], ue = ["paint", "layout", "strict", "content"];
544
- function mt(t) {
545
- const e = wt(), n = R(t) ? L(t) : t;
546
- return ae.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) || fe.some((i) => (n.willChange || "").includes(i)) || ue.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 de(t) {
549
- let e = N(t);
550
- for (; $(e) && !Y(e); ) {
551
- if (mt(e))
548
+ function ye(t) {
549
+ let e = q(t);
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
- e = N(e);
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 he = /* @__PURE__ */ new Set(["html", "body", "#document"]);
562
+ const we = /* @__PURE__ */ new Set(["html", "body", "#document"]);
563
563
  function Y(t) {
564
- return he.has(z(t));
564
+ return we.has(K(t));
565
565
  }
566
- function L(t) {
567
- return C(t).getComputedStyle(t);
566
+ function $(t) {
567
+ return T(t).getComputedStyle(t);
568
568
  }
569
- function ct(t) {
570
- return R(t) ? {
569
+ function ut(t) {
570
+ return O(t) ? {
571
571
  scrollLeft: t.scrollLeft,
572
572
  scrollTop: t.scrollTop
573
573
  } : {
@@ -575,185 +575,185 @@ function ct(t) {
575
575
  scrollTop: t.scrollY
576
576
  };
577
577
  }
578
- function N(t) {
579
- if (z(t) === "html")
578
+ function q(t) {
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
- bt(t) && t.host || // Fallback.
586
- F(t)
585
+ Et(t) && t.host || // Fallback.
586
+ D(t)
587
587
  );
588
- return bt(e) ? e.host : e;
588
+ return Et(e) ? e.host : e;
589
589
  }
590
- function Rt(t) {
591
- const e = N(t);
592
- return Y(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : $(e) && et(e) ? e : Rt(e);
590
+ function Pt(t) {
591
+ const e = q(t);
592
+ return Y(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : R(e) && it(e) ? e : Pt(e);
593
593
  }
594
- function Lt(t, e, n) {
594
+ function Ft(t, e, n) {
595
595
  var i;
596
596
  e === void 0 && (e = []);
597
- const o = Rt(t), s = o === ((i = t.ownerDocument) == null ? void 0 : i.body), r = C(o);
598
- return s ? (ht(r), e.concat(r, r.visualViewport || [], et(o) ? o : [], [])) : e.concat(o, Lt(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 ht(t) {
600
+ function yt(t) {
601
601
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
602
602
  }
603
- function kt(t) {
604
- const e = L(t);
603
+ function Dt(t) {
604
+ const e = $(t);
605
605
  let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
606
- const o = $(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 $t(t) {
614
- return R(t) ? t : t.contextElement;
613
+ function Bt(t) {
614
+ return O(t) ? t : t.contextElement;
615
615
  }
616
616
  function j(t) {
617
- const e = $t(t);
618
- if (!$(e))
619
- return k(1);
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
- } = kt(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 pe = /* @__PURE__ */ k(0);
632
- function Pt(t) {
633
- const e = C(t);
634
- return !wt() || !e.visualViewport ? pe : {
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 ge(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 = $t(t);
645
- let r = k(1);
646
- e && (i ? R(i) && (r = j(i)) : r = j(t));
647
- const l = ge(s, n, i) ? Pt(s) : k(0);
648
- let c = (o.left + l.x) / r.x, a = (o.top + l.y) / r.y, d = o.width / r.x, u = 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 p = C(s), f = i && R(i) ? C(i) : i;
651
- let h = p, g = ht(h);
652
- for (; g && i && f !== h; ) {
653
- const m = j(g), w = g.getBoundingClientRect(), y = L(g), x = w.left + (g.clientLeft + parseFloat(y.paddingLeft)) * m.x, v = w.top + (g.clientTop + parseFloat(y.paddingTop)) * m.y;
654
- c *= m.x, a *= m.y, d *= m.x, u *= m.y, c += x, a += v, h = C(g), g = ht(h);
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
659
  height: u,
660
- x: c,
661
- y: a
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 me(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 = k(1);
689
- const d = k(0), u = $(i);
690
- if ((u || !u && !s) && ((z(i) !== "body" || et(r)) && (c = ct(i)), $(i))) {
691
- const f = Q(i);
692
- a = j(i), d.x = f.x + i.clientLeft, d.y = f.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 p = r && !u && !s ? Dt(r, c) : k(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 + p.x,
699
- y: n.y * a.y - c.scrollTop * a.y + d.y + p.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 ye(t) {
706
- const e = F(t), n = ct(t), i = t.ownerDocument.body, o = X(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = X(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
- return L(i).direction === "rtl" && (r += X(e.clientWidth, i.clientWidth) - o), {
709
+ return $(i).direction === "rtl" && (r += z(e.clientWidth, i.clientWidth) - o), {
710
710
  width: o,
711
711
  height: s,
712
712
  x: r,
713
713
  y: l
714
714
  };
715
715
  }
716
- const St = 25;
717
- function xe(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, u = d.body, p = getComputedStyle(u), f = d.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, h = Math.abs(i.clientWidth - u.clientWidth - f);
728
- h <= St && (s -= h);
729
- } else a <= St && (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 be(t, e) {
739
- const n = Q(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = $(t) ? j(t) : k(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 At(t, e, n) {
747
+ function kt(t, e, n) {
748
748
  let i;
749
749
  if (e === "viewport")
750
- i = xe(t, n);
750
+ i = Te(t, n);
751
751
  else if (e === "document")
752
- i = ye(F(t));
753
- else if (R(e))
754
- i = be(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 At(t, e, n) {
761
761
  height: e.height
762
762
  };
763
763
  }
764
- return st(i);
764
+ return lt(i);
765
765
  }
766
- function It(t, e) {
767
- const n = N(t);
768
- return n === e || !R(n) || Y(n) ? !1 : L(n).position === "fixed" || It(n, e);
766
+ function Mt(t, e) {
767
+ const n = q(t);
768
+ return n === e || !O(n) || Y(n) ? !1 : $(n).position === "fixed" || Mt(n, e);
769
769
  }
770
- function Se(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 = Lt(t, []).filter((l) => R(l) && z(l) !== "body"), o = null;
775
- const s = L(t).position === "fixed";
776
- let r = s ? N(t) : t;
777
- for (; R(r) && !Y(r); ) {
778
- const l = L(r), c = mt(r);
779
- !c && l.position === "fixed" && (o = null), (s ? !c && !o : !c && l.position === "static" && !!o && ve.has(o.position) || et(r) && !c && It(t, r)) ? i = i.filter((d) => d !== r) : o = l, r = N(r);
774
+ let i = Ft(t, []).filter((l) => O(l) && K(l) !== "body"), o = null;
775
+ const s = $(t).position === "fixed";
776
+ let r = s ? q(t) : t;
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 Ae(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) ? [] : Se(e, this._c) : [].concat(n), i], l = r[0], c = r.reduce((a, d) => {
791
- const u = At(e, d, o);
792
- return a.top = X(u.top, a.top), a.right = J(u.right, a.right), a.bottom = J(u.bottom, a.bottom), a.left = X(u.left, a.left), a;
793
- }, At(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 Ce(t) {
801
+ function Oe(t) {
802
802
  const {
803
803
  width: e,
804
804
  height: n
805
- } = kt(t);
805
+ } = Dt(t);
806
806
  return {
807
807
  width: e,
808
808
  height: n
809
809
  };
810
810
  }
811
- function Ee(t, e, n) {
812
- const 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 = k(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 ((z(e) !== "body" || et(o)) && (l = ct(e)), i) {
823
- const f = Q(e, !0, s, e);
824
- c.x = f.x + e.clientLeft, c.y = f.y + e.clientTop;
825
- } else o && a();
826
- s && !i && o && a();
827
- const d = o && !i && !s ? Dt(o, l) : k(0), u = r.left + l.scrollLeft - c.x - d.x, p = 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
829
  x: u,
830
- y: p,
830
+ y: h,
831
831
  width: r.width,
832
832
  height: r.height
833
833
  };
834
834
  }
835
- function ft(t) {
836
- return L(t).position === "static";
835
+ function dt(t) {
836
+ return $(t).position === "static";
837
837
  }
838
- function Ct(t, e) {
839
- if (!$(t) || L(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 Ft(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 (!$(t)) {
851
- let o = N(t);
850
+ if (!R(t)) {
851
+ let o = q(t);
852
852
  for (; o && !Y(o); ) {
853
- if (R(o) && !ft(o))
853
+ if (O(o) && !dt(o))
854
854
  return o;
855
- o = N(o);
855
+ o = q(o);
856
856
  }
857
857
  return n;
858
858
  }
859
- let i = Ct(t, e);
860
- for (; i && le(i) && ft(i); )
861
- i = Ct(i, e);
862
- return i && Y(i) && ft(i) && !mt(i) ? n : i || de(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 Te = async function(t) {
865
- const e = this.getOffsetParent || Ft, 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: Ee(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,107 +873,142 @@ const Te = async function(t) {
873
873
  }
874
874
  };
875
875
  };
876
- function Oe(t) {
877
- return L(t).direction === "rtl";
878
- }
879
- const Re = {
880
- convertOffsetParentRelativeRectToViewportRelativeRect: me,
881
- getDocumentElement: F,
882
- getClippingRect: Ae,
883
- getOffsetParent: Ft,
884
- getElementRects: Te,
885
- getClientRects: we,
886
- getDimensions: Ce,
876
+ function Re(t) {
877
+ return $(t).direction === "rtl";
878
+ }
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
887
  getScale: j,
888
- isElement: R,
889
- isRTL: Oe
890
- }, Le = ne, ke = oe, $e = te, Pe = Zt, De = (t, e, n) => {
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: Re,
892
+ platform: Pe,
893
893
  ...n
894
894
  }, s = {
895
895
  ...o.platform,
896
896
  _c: i
897
897
  };
898
- return Qt(t, e, {
898
+ return ne(t, e, {
899
899
  ...o,
900
900
  platform: s
901
901
  });
902
902
  };
903
- function Bt(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 Vt(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 Ie(t) {
914
+ function Me(t) {
915
915
  t.scrollIntoView({
916
916
  behavior: "smooth",
917
917
  block: "center",
918
918
  inline: "center"
919
919
  });
920
920
  }
921
- function it(t, e, n) {
921
+ function Ne(t) {
922
+ const e = document.createElement("div");
923
+ return e.textContent = t, e.innerHTML;
924
+ }
925
+ function nt(t, e, n) {
922
926
  const i = document.createElement(t);
923
927
  return e && (i.className = e), n && n.appendChild(i), i;
924
928
  }
925
- class Fe {
929
+ function Ve() {
930
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
931
+ }
932
+ let ht = null;
933
+ function We() {
934
+ return ht || (ht = Ve()), ht;
935
+ }
936
+ async function He(t, e) {
937
+ if (!t.endpoint) return;
938
+ const n = {
939
+ ...e,
940
+ user_id: t.userId,
941
+ session_id: We(),
942
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
943
+ };
944
+ try {
945
+ const i = await fetch(t.endpoint, {
946
+ method: "POST",
947
+ headers: { "Content-Type": "application/json" },
948
+ body: JSON.stringify(n)
949
+ });
950
+ t.debug && (i.ok ? console.log("[Trailguide Analytics]", n) : console.error(`[Trailguide Analytics] Server error: ${i.status}`));
951
+ } catch (i) {
952
+ t.debug && console.error("[Trailguide Analytics] Failed:", i);
953
+ }
954
+ }
955
+ class Xe {
926
956
  constructor(e = {}) {
927
- I(this, "trail", null);
928
- I(this, "currentStepIndex", 0);
929
- I(this, "isActive", !1);
930
- I(this, "options", {});
957
+ C(this, "trail", null);
958
+ C(this, "currentStepIndex", 0);
959
+ C(this, "isActive", !1);
960
+ C(this, "options", {});
931
961
  // DOM elements
932
- I(this, "overlay", null);
933
- I(this, "tooltip", null);
934
- I(this, "arrowEl", null);
962
+ C(this, "overlay", null);
963
+ C(this, "tooltip", null);
964
+ C(this, "arrowEl", null);
935
965
  // Cleanup functions
936
- I(this, "cleanupFns", []);
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);
937
971
  this.options = e;
938
972
  }
939
973
  start(e) {
940
- this.trail = e, this.currentStepIndex = 0, this.isActive = !0, this.createOverlay(), this.showStep(), this.bindKeyboard();
974
+ this.trail = e, this.currentStepIndex = 0, this.isActive = !0, this.createOverlay(), this.showStep(), this.bindKeyboard(), this.emitAnalytics("trail_started");
941
975
  }
942
976
  stop() {
943
- 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();
944
979
  }
945
980
  next() {
946
- !this.trail || !this.isActive || (this.currentStepIndex < this.trail.steps.length - 1 ? (this.currentStepIndex++, this.showStep()) : this.complete());
981
+ !this.trail || !this.isActive || (this.emitAnalytics("step_completed"), this.currentStepIndex < this.trail.steps.length - 1 ? (this.currentStepIndex++, this.showStep()) : this.complete());
947
982
  }
948
983
  prev() {
949
984
  !this.trail || !this.isActive || this.currentStepIndex > 0 && (this.currentStepIndex--, this.showStep());
950
985
  }
951
986
  skip() {
952
987
  var e, n;
953
- this.isActive = !1, this.cleanup(), (n = (e = this.options).onSkip) == null || n.call(e);
988
+ this.emitAnalytics("trail_skipped"), this.isActive = !1, this.cleanup(), (n = (e = this.options).onSkip) == null || n.call(e);
954
989
  }
955
990
  goToStep(e) {
956
991
  !this.trail || !this.isActive || e >= 0 && e < this.trail.steps.length && (this.currentStepIndex = e, this.showStep());
957
992
  }
958
993
  complete() {
959
994
  var e, n;
960
- this.isActive = !1, this.cleanup(), (n = (e = this.options).onComplete) == null || n.call(e);
995
+ this.emitAnalytics("trail_completed"), this.isActive = !1, this.cleanup(), (n = (e = this.options).onComplete) == null || n.call(e);
961
996
  }
962
997
  createOverlay() {
963
- var n, i, o;
964
- this.overlay = it("div", "trailguide-overlay"), document.body.appendChild(this.overlay);
965
- const e = it("div", "trailguide-spotlight", this.overlay);
998
+ var i, o, s;
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`;
966
1001
  e.innerHTML = `
967
1002
  <svg width="100%" height="100%">
968
1003
  <defs>
969
- <mask id="trailguide-mask">
1004
+ <mask id="${n}">
970
1005
  <rect x="0" y="0" width="100%" height="100%" fill="white" />
971
1006
  <rect class="trailguide-cutout" rx="4" fill="black" />
972
1007
  </mask>
973
1008
  </defs>
974
- <rect x="0" y="0" width="100%" height="100%" fill="rgba(0,0,0,0.5)" mask="url(#trailguide-mask)" />
1009
+ <rect x="0" y="0" width="100%" height="100%" mask="url(#${n})" />
975
1010
  </svg>
976
- `, 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 = `
977
1012
  <div class="trailguide-tooltip-content">
978
1013
  <div class="trailguide-tooltip-header">
979
1014
  <h3 class="trailguide-tooltip-title"></h3>
@@ -989,22 +1024,43 @@ class Fe {
989
1024
  </div>
990
1025
  <div class="trailguide-tooltip-arrow"></div>
991
1026
  </div>
992
- `, document.body.appendChild(this.tooltip), this.arrowEl = this.tooltip.querySelector(".trailguide-tooltip-arrow"), (n = this.tooltip.querySelector(".trailguide-tooltip-close")) == null || n.addEventListener("click", () => this.skip()), (i = this.tooltip.querySelector(".trailguide-btn-prev")) == null || i.addEventListener("click", () => this.prev()), (o = this.tooltip.querySelector(".trailguide-btn-next")) == null || o.addEventListener("click", () => this.next());
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());
993
1028
  }
994
1029
  showStep() {
1030
+ var l, a;
995
1031
  if (!this.trail || !this.overlay || !this.tooltip) return;
996
- const e = this.trail.steps[this.currentStepIndex];
997
- if (!e) return;
998
- const n = Bt(e.target);
999
- if (!n || !Vt(n)) {
1000
- console.warn(`[Trailguide] Target not found or not visible: ${e.target}`);
1032
+ this.stepTimerId !== null && (clearTimeout(this.stepTimerId), this.stepTimerId = null), this.stepCleanupFns.forEach((c) => c()), this.stepCleanupFns = [], this.tooltip.style.transform = "";
1033
+ const e = this.overlay.querySelector(".trailguide-spotlight"), n = this.overlay.querySelector(".trailguide-highlight");
1034
+ e && (e.style.display = ""), n && (n.style.display = "");
1035
+ const i = this.trail.steps[this.currentStepIndex];
1036
+ if (!i) return;
1037
+ this.emitAnalytics("step_viewed");
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);
1001
1046
  return;
1002
1047
  }
1003
- Ie(n), setTimeout(() => {
1004
- var i, o;
1005
- this.updateSpotlight(n), this.updateTooltip(e, n), (o = (i = this.options).onStepChange) == null || o.call(i, e, 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));
1006
1051
  }, 100);
1007
1052
  }
1053
+ showErrorState(e) {
1054
+ var u, h;
1055
+ if (!this.tooltip || !this.trail) return;
1056
+ const n = (u = this.overlay) == null ? void 0 : u.querySelector(".trailguide-spotlight"), i = (h = this.overlay) == null ? void 0 : h.querySelector(".trailguide-highlight");
1057
+ n && (n.style.display = "none"), i && (i.style.display = "none");
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;
1059
+ o && (o.textContent = "Element Not Found"), s && (s.innerHTML = `
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>
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>
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%)";
1063
+ }
1008
1064
  updateSpotlight(e) {
1009
1065
  if (!this.overlay) return;
1010
1066
  const n = e.getBoundingClientRect(), i = 8, o = this.overlay.querySelector(".trailguide-cutout");
@@ -1016,26 +1072,26 @@ class Fe {
1016
1072
  const l = e.getBoundingClientRect();
1017
1073
  o && (o.setAttribute("x", String(l.left - i)), o.setAttribute("y", String(l.top - i)), o.setAttribute("width", String(l.width + i * 2)), o.setAttribute("height", String(l.height + i * 2))), s && (s.style.top = `${l.top - i}px`, s.style.left = `${l.left - i}px`, s.style.width = `${l.width + i * 2}px`, s.style.height = `${l.height + i * 2}px`);
1018
1074
  };
1019
- window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), this.cleanupFns.push(() => {
1075
+ window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), this.stepCleanupFns.push(() => {
1020
1076
  window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
1021
1077
  });
1022
1078
  }
1023
1079
  async updateTooltip(e, n) {
1024
1080
  if (!this.tooltip || !this.trail || !this.arrowEl) return;
1025
- 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");
1026
- 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");
1027
- const { x: d, y: u, middlewareData: p } = 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, {
1028
1084
  placement: e.placement,
1029
1085
  middleware: [
1030
- Le(12),
1031
- $e(),
1032
- ke({ padding: 8 }),
1033
- Pe({ element: this.arrowEl })
1086
+ Fe(12),
1087
+ Be(),
1088
+ De({ padding: 8 }),
1089
+ _e({ element: this.arrowEl })
1034
1090
  ]
1035
1091
  });
1036
- if (this.tooltip.style.left = `${d}px`, this.tooltip.style.top = `${u}px`, p.arrow && this.arrowEl) {
1037
- const { x: f, y: h } = p.arrow;
1038
- this.arrowEl.style.left = f != null ? `${f}px` : "", this.arrowEl.style.top = h != null ? `${h}px` : "";
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;
1094
+ this.arrowEl.style.left = p != null ? `${p}px` : "", this.arrowEl.style.top = g != null ? `${g}px` : "";
1039
1095
  }
1040
1096
  }
1041
1097
  bindKeyboard() {
@@ -1058,26 +1114,77 @@ class Fe {
1058
1114
  }
1059
1115
  cleanup() {
1060
1116
  var e, n;
1061
- 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;
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;
1118
+ }
1119
+ emitAnalytics(e) {
1120
+ if (!this.options.analytics || !this.trail) return;
1121
+ const n = this.trail.steps[this.currentStepIndex], i = this.options.analytics.trailId || this.trail.id;
1122
+ He(this.options.analytics, {
1123
+ event_type: e,
1124
+ trail_id: i,
1125
+ step_id: n == null ? void 0 : n.id,
1126
+ step_index: this.currentStepIndex
1127
+ });
1062
1128
  }
1063
1129
  }
1064
1130
  let b = null;
1065
- function Ne(t, e) {
1066
- return b && b.stop(), b = new Fe(e), b.start(t), b;
1131
+ function Ye(t, e) {
1132
+ return b && b.stop(), b = new Xe(e), b.start(t), b;
1067
1133
  }
1068
- function We() {
1069
- b == null || b.stop();
1134
+ function Ke() {
1135
+ b == null || b.stop(), b = null;
1070
1136
  }
1071
- function Me() {
1137
+ function Ge() {
1072
1138
  b == null || b.next();
1073
1139
  }
1074
- function qe() {
1140
+ function Je() {
1075
1141
  b == null || b.prev();
1076
1142
  }
1077
- function _e() {
1078
- b == null || b.skip();
1079
- }
1080
- function He(t) {
1143
+ function Ue() {
1144
+ b == null || b.skip(), b = null;
1145
+ }
1146
+ const Qe = {
1147
+ // Backgrounds
1148
+ bgBase: "#0f172a",
1149
+ bgCard: "#1e293b",
1150
+ bgGlass: "rgba(255,255,255,0.06)",
1151
+ bgInput: "rgba(255,255,255,0.03)",
1152
+ // Text
1153
+ textPrimary: "#f8fafc",
1154
+ textSecondary: "#e2e8f0",
1155
+ textTertiary: "#cbd5e1",
1156
+ textMuted: "#94a3b8",
1157
+ textFaint: "#64748b",
1158
+ // Borders
1159
+ borderSubtle: "rgba(255,255,255,0.06)",
1160
+ borderPanel: "rgba(255,255,255,0.08)",
1161
+ borderControl: "rgba(255,255,255,0.1)",
1162
+ // Brand / accent
1163
+ accent: "#1a91a2",
1164
+ accentBg: "rgba(26,145,162,0.15)",
1165
+ accentBorder: "rgba(26,145,162,0.3)",
1166
+ // Error / recording
1167
+ error: "#ef4444",
1168
+ errorBg: "rgba(239,68,68,0.1)",
1169
+ errorBorder: "rgba(239,68,68,0.3)",
1170
+ errorLight: "rgba(248,113,113,0.1)",
1171
+ errorText: "#fca5a5",
1172
+ // Success
1173
+ success: "#10b981",
1174
+ successBg: "rgba(16,185,129,0.1)",
1175
+ successBorder: "rgba(16,185,129,0.3)",
1176
+ successText: "#6ee7b7",
1177
+ // Warning
1178
+ warningBg: "rgba(234,179,8,0.1)",
1179
+ // Disabled
1180
+ disabled: "#9ca3af",
1181
+ disabledBg: "#4b5563",
1182
+ // Shadows
1183
+ shadowLight: "0 4px 12px rgba(0,0,0,0.15)",
1184
+ shadowMedium: "0 4px 20px rgba(0,0,0,0.4)",
1185
+ shadowOverlay: "rgba(0,0,0,0.3)"
1186
+ };
1187
+ function Ze(t) {
1081
1188
  const e = [], n = [];
1082
1189
  return t.id || e.push({
1083
1190
  stepId: "",
@@ -1104,8 +1211,8 @@ function He(t) {
1104
1211
  });
1105
1212
  return;
1106
1213
  }
1107
- const s = Bt(i.target);
1108
- s ? Vt(s) || n.push({
1214
+ const s = Vt(i.target);
1215
+ s ? Wt(s) || n.push({
1109
1216
  stepId: i.id,
1110
1217
  stepIndex: o,
1111
1218
  type: "hidden_target",
@@ -1117,7 +1224,7 @@ function He(t) {
1117
1224
  type: "missing_target",
1118
1225
  message: `Step ${o + 1} ("${i.title}"): Target element not found`,
1119
1226
  selector: i.target
1120
- }), i.target && Be(i.target) && n.push({
1227
+ }), i.target && ze(i.target) && n.push({
1121
1228
  stepId: i.id,
1122
1229
  stepIndex: o,
1123
1230
  type: "unstable_selector",
@@ -1130,10 +1237,10 @@ function He(t) {
1130
1237
  warnings: n
1131
1238
  });
1132
1239
  }
1133
- function Be(t) {
1240
+ function ze(t) {
1134
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));
1135
1242
  }
1136
- function Xe(t) {
1243
+ function ti(t) {
1137
1244
  if (t.valid && t.warnings.length === 0) {
1138
1245
  console.log("%c✓ Trail validation passed", "color: green; font-weight: bold");
1139
1246
  return;
@@ -1144,16 +1251,78 @@ function Xe(t) {
1144
1251
  console.warn(`Step ${e.stepIndex + 1}: ${e.message}`), e.selector && console.warn(` Selector: ${e.selector}`);
1145
1252
  }), console.groupEnd());
1146
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
+ };
1147
1314
  export {
1148
- Fe as Trailguide,
1149
- Bt as findElement,
1150
- Vt as isElementVisible,
1151
- Xe as logValidationResults,
1152
- Me as next,
1153
- qe as prev,
1154
- Ie as scrollToElement,
1155
- _e as skip,
1156
- Ne as start,
1157
- We as stop,
1158
- He 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
1159
1328
  };