@trailguide/core 0.0.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.
- package/README.md +125 -0
- package/dist/dom.d.ts +5 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/trailguide.d.ts +32 -0
- package/dist/trailguide.d.ts.map +1 -0
- package/dist/trailguide.js +1090 -0
- package/dist/trailguide.umd.js +27 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,1090 @@
|
|
|
1
|
+
var Vt = Object.defineProperty;
|
|
2
|
+
var Mt = (t, e, n) => e in t ? Vt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var F = (t, e, n) => Mt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
const Q = Math.min, _ = Math.max, it = Math.round, k = (t) => ({
|
|
5
|
+
x: t,
|
|
6
|
+
y: t
|
|
7
|
+
}), Wt = {
|
|
8
|
+
left: "right",
|
|
9
|
+
right: "left",
|
|
10
|
+
bottom: "top",
|
|
11
|
+
top: "bottom"
|
|
12
|
+
}, Ht = {
|
|
13
|
+
start: "end",
|
|
14
|
+
end: "start"
|
|
15
|
+
};
|
|
16
|
+
function ut(t, e, n) {
|
|
17
|
+
return _(t, Q(e, n));
|
|
18
|
+
}
|
|
19
|
+
function Z(t, e) {
|
|
20
|
+
return typeof t == "function" ? t(e) : t;
|
|
21
|
+
}
|
|
22
|
+
function X(t) {
|
|
23
|
+
return t.split("-")[0];
|
|
24
|
+
}
|
|
25
|
+
function tt(t) {
|
|
26
|
+
return t.split("-")[1];
|
|
27
|
+
}
|
|
28
|
+
function Et(t) {
|
|
29
|
+
return t === "x" ? "y" : "x";
|
|
30
|
+
}
|
|
31
|
+
function pt(t) {
|
|
32
|
+
return t === "y" ? "height" : "width";
|
|
33
|
+
}
|
|
34
|
+
const It = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
35
|
+
function V(t) {
|
|
36
|
+
return It.has(X(t)) ? "y" : "x";
|
|
37
|
+
}
|
|
38
|
+
function gt(t) {
|
|
39
|
+
return Et(V(t));
|
|
40
|
+
}
|
|
41
|
+
function qt(t, e, n) {
|
|
42
|
+
n === void 0 && (n = !1);
|
|
43
|
+
const i = tt(t), o = gt(t), s = pt(o);
|
|
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)];
|
|
46
|
+
}
|
|
47
|
+
function Xt(t) {
|
|
48
|
+
const e = ot(t);
|
|
49
|
+
return [dt(t), e, dt(e)];
|
|
50
|
+
}
|
|
51
|
+
function dt(t) {
|
|
52
|
+
return t.replace(/start|end/g, (e) => Ht[e]);
|
|
53
|
+
}
|
|
54
|
+
const yt = ["left", "right"], xt = ["right", "left"], _t = ["top", "bottom"], jt = ["bottom", "top"];
|
|
55
|
+
function Yt(t, e, n) {
|
|
56
|
+
switch (t) {
|
|
57
|
+
case "top":
|
|
58
|
+
case "bottom":
|
|
59
|
+
return n ? e ? xt : yt : e ? yt : xt;
|
|
60
|
+
case "left":
|
|
61
|
+
case "right":
|
|
62
|
+
return e ? _t : jt;
|
|
63
|
+
default:
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function zt(t, e, n, i) {
|
|
68
|
+
const o = tt(t);
|
|
69
|
+
let s = Yt(X(t), n === "start", i);
|
|
70
|
+
return o && (s = s.map((r) => r + "-" + o), e && (s = s.concat(s.map(dt)))), s;
|
|
71
|
+
}
|
|
72
|
+
function ot(t) {
|
|
73
|
+
return t.replace(/left|right|bottom|top/g, (e) => Wt[e]);
|
|
74
|
+
}
|
|
75
|
+
function Kt(t) {
|
|
76
|
+
return {
|
|
77
|
+
top: 0,
|
|
78
|
+
right: 0,
|
|
79
|
+
bottom: 0,
|
|
80
|
+
left: 0,
|
|
81
|
+
...t
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function Ot(t) {
|
|
85
|
+
return typeof t != "number" ? Kt(t) : {
|
|
86
|
+
top: t,
|
|
87
|
+
right: t,
|
|
88
|
+
bottom: t,
|
|
89
|
+
left: t
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function st(t) {
|
|
93
|
+
const {
|
|
94
|
+
x: e,
|
|
95
|
+
y: n,
|
|
96
|
+
width: i,
|
|
97
|
+
height: o
|
|
98
|
+
} = t;
|
|
99
|
+
return {
|
|
100
|
+
width: i,
|
|
101
|
+
height: o,
|
|
102
|
+
top: n,
|
|
103
|
+
left: e,
|
|
104
|
+
right: e + i,
|
|
105
|
+
bottom: n + o,
|
|
106
|
+
x: e,
|
|
107
|
+
y: n
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function vt(t, e, n) {
|
|
111
|
+
let {
|
|
112
|
+
reference: i,
|
|
113
|
+
floating: o
|
|
114
|
+
} = t;
|
|
115
|
+
const s = V(e), r = gt(e), l = pt(r), c = X(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;
|
|
116
|
+
let f;
|
|
117
|
+
switch (c) {
|
|
118
|
+
case "top":
|
|
119
|
+
f = {
|
|
120
|
+
x: d,
|
|
121
|
+
y: i.y - o.height
|
|
122
|
+
};
|
|
123
|
+
break;
|
|
124
|
+
case "bottom":
|
|
125
|
+
f = {
|
|
126
|
+
x: d,
|
|
127
|
+
y: i.y + i.height
|
|
128
|
+
};
|
|
129
|
+
break;
|
|
130
|
+
case "right":
|
|
131
|
+
f = {
|
|
132
|
+
x: i.x + i.width,
|
|
133
|
+
y: u
|
|
134
|
+
};
|
|
135
|
+
break;
|
|
136
|
+
case "left":
|
|
137
|
+
f = {
|
|
138
|
+
x: i.x - o.width,
|
|
139
|
+
y: u
|
|
140
|
+
};
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
f = {
|
|
144
|
+
x: i.x,
|
|
145
|
+
y: i.y
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
switch (tt(e)) {
|
|
149
|
+
case "start":
|
|
150
|
+
f[r] -= p * (n && a ? -1 : 1);
|
|
151
|
+
break;
|
|
152
|
+
case "end":
|
|
153
|
+
f[r] += p * (n && a ? -1 : 1);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
return f;
|
|
157
|
+
}
|
|
158
|
+
async function Gt(t, e) {
|
|
159
|
+
var n;
|
|
160
|
+
e === void 0 && (e = {});
|
|
161
|
+
const {
|
|
162
|
+
x: i,
|
|
163
|
+
y: o,
|
|
164
|
+
platform: s,
|
|
165
|
+
rects: r,
|
|
166
|
+
elements: l,
|
|
167
|
+
strategy: c
|
|
168
|
+
} = t, {
|
|
169
|
+
boundary: a = "clippingAncestors",
|
|
170
|
+
rootBoundary: d = "viewport",
|
|
171
|
+
elementContext: u = "floating",
|
|
172
|
+
altBoundary: p = !1,
|
|
173
|
+
padding: f = 0
|
|
174
|
+
} = Z(e, t), h = Ot(f), m = l[p ? u === "floating" ? "reference" : "floating" : u], w = st(await s.getClippingRect({
|
|
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,
|
|
177
|
+
rootBoundary: d,
|
|
178
|
+
strategy: c
|
|
179
|
+
})), y = u === "floating" ? {
|
|
180
|
+
x: i,
|
|
181
|
+
y: o,
|
|
182
|
+
width: r.floating.width,
|
|
183
|
+
height: r.floating.height
|
|
184
|
+
} : r.reference, x = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), v = await (s.isElement == null ? void 0 : s.isElement(x)) ? await (s.getScale == null ? void 0 : s.getScale(x)) || {
|
|
185
|
+
x: 1,
|
|
186
|
+
y: 1
|
|
187
|
+
} : {
|
|
188
|
+
x: 1,
|
|
189
|
+
y: 1
|
|
190
|
+
}, E = st(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
191
|
+
elements: l,
|
|
192
|
+
rect: y,
|
|
193
|
+
offsetParent: x,
|
|
194
|
+
strategy: c
|
|
195
|
+
}) : y);
|
|
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
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
const Jt = async (t, e, n) => {
|
|
204
|
+
const {
|
|
205
|
+
placement: i = "bottom",
|
|
206
|
+
strategy: o = "absolute",
|
|
207
|
+
middleware: s = [],
|
|
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({
|
|
211
|
+
reference: t,
|
|
212
|
+
floating: e,
|
|
213
|
+
strategy: o
|
|
214
|
+
}), {
|
|
215
|
+
x: d,
|
|
216
|
+
y: u
|
|
217
|
+
} = vt(a, i, c), p = i, f = {}, h = 0;
|
|
218
|
+
for (let m = 0; m < l.length; m++) {
|
|
219
|
+
var g;
|
|
220
|
+
const {
|
|
221
|
+
name: w,
|
|
222
|
+
fn: y
|
|
223
|
+
} = l[m], {
|
|
224
|
+
x,
|
|
225
|
+
y: v,
|
|
226
|
+
data: E,
|
|
227
|
+
reset: A
|
|
228
|
+
} = await y({
|
|
229
|
+
x: d,
|
|
230
|
+
y: u,
|
|
231
|
+
initialPlacement: i,
|
|
232
|
+
placement: p,
|
|
233
|
+
strategy: o,
|
|
234
|
+
middlewareData: f,
|
|
235
|
+
rects: a,
|
|
236
|
+
platform: {
|
|
237
|
+
...r,
|
|
238
|
+
detectOverflow: (g = r.detectOverflow) != null ? g : Gt
|
|
239
|
+
},
|
|
240
|
+
elements: {
|
|
241
|
+
reference: t,
|
|
242
|
+
floating: e
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
d = x ?? d, u = v ?? u, f = {
|
|
246
|
+
...f,
|
|
247
|
+
[w]: {
|
|
248
|
+
...f[w],
|
|
249
|
+
...E
|
|
250
|
+
}
|
|
251
|
+
}, A && h <= 50 && (h++, typeof A == "object" && (A.placement && (p = A.placement), A.rects && (a = A.rects === !0 ? await r.getElementRects({
|
|
252
|
+
reference: t,
|
|
253
|
+
floating: e,
|
|
254
|
+
strategy: o
|
|
255
|
+
}) : A.rects), {
|
|
256
|
+
x: d,
|
|
257
|
+
y: u
|
|
258
|
+
} = vt(a, p, c)), m = -1);
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
x: d,
|
|
262
|
+
y: u,
|
|
263
|
+
placement: p,
|
|
264
|
+
strategy: o,
|
|
265
|
+
middlewareData: f
|
|
266
|
+
};
|
|
267
|
+
}, Qt = (t) => ({
|
|
268
|
+
name: "arrow",
|
|
269
|
+
options: t,
|
|
270
|
+
async fn(e) {
|
|
271
|
+
const {
|
|
272
|
+
x: n,
|
|
273
|
+
y: i,
|
|
274
|
+
placement: o,
|
|
275
|
+
rects: s,
|
|
276
|
+
platform: r,
|
|
277
|
+
elements: l,
|
|
278
|
+
middlewareData: c
|
|
279
|
+
} = e, {
|
|
280
|
+
element: a,
|
|
281
|
+
padding: d = 0
|
|
282
|
+
} = Z(t, e) || {};
|
|
283
|
+
if (a == null)
|
|
284
|
+
return {};
|
|
285
|
+
const u = Ot(d), p = {
|
|
286
|
+
x: n,
|
|
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, H = W / 2 - g[h] / 2 - 1, D = Q(u[w], H), G = Q(u[y], H), I = D, J = W - g[h] - G, S = W / 2 - g[h] / 2 + K, q = ut(I, S, J), $ = !c.arrow && tt(o) != null && S !== q && s.reference[h] / 2 - (S < I ? D : G) - g[h] / 2 < 0, O = $ ? S < I ? S - I : S - J : 0;
|
|
292
|
+
return {
|
|
293
|
+
[f]: p[f] + O,
|
|
294
|
+
data: {
|
|
295
|
+
[f]: q,
|
|
296
|
+
centerOffset: S - q - O,
|
|
297
|
+
...$ && {
|
|
298
|
+
alignmentOffset: O
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
reset: $
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}), Ut = function(t) {
|
|
305
|
+
return t === void 0 && (t = {}), {
|
|
306
|
+
name: "flip",
|
|
307
|
+
options: t,
|
|
308
|
+
async fn(e) {
|
|
309
|
+
var n, i;
|
|
310
|
+
const {
|
|
311
|
+
placement: o,
|
|
312
|
+
middlewareData: s,
|
|
313
|
+
rects: r,
|
|
314
|
+
initialPlacement: l,
|
|
315
|
+
platform: c,
|
|
316
|
+
elements: a
|
|
317
|
+
} = e, {
|
|
318
|
+
mainAxis: d = !0,
|
|
319
|
+
crossAxis: u = !0,
|
|
320
|
+
fallbackPlacements: p,
|
|
321
|
+
fallbackStrategy: f = "bestFit",
|
|
322
|
+
fallbackAxisSideDirection: h = "none",
|
|
323
|
+
flipAlignment: g = !0,
|
|
324
|
+
...m
|
|
325
|
+
} = Z(t, e);
|
|
326
|
+
if ((n = s.arrow) != null && n.alignmentOffset)
|
|
327
|
+
return {};
|
|
328
|
+
const w = X(o), y = V(l), x = X(l) === l, v = await (c.isRTL == null ? void 0 : c.isRTL(a.floating)), E = p || (x || !g ? [ot(l)] : Xt(l)), A = h !== "none";
|
|
329
|
+
!p && A && E.push(...zt(l, g, h, v));
|
|
330
|
+
const W = [l, ...E], K = await c.detectOverflow(e, m), H = [];
|
|
331
|
+
let D = ((i = s.flip) == null ? void 0 : i.overflows) || [];
|
|
332
|
+
if (d && H.push(K[w]), u) {
|
|
333
|
+
const S = qt(o, r, v);
|
|
334
|
+
H.push(K[S[0]], K[S[1]]);
|
|
335
|
+
}
|
|
336
|
+
if (D = [...D, {
|
|
337
|
+
placement: o,
|
|
338
|
+
overflows: H
|
|
339
|
+
}], !H.every((S) => S <= 0)) {
|
|
340
|
+
var G, I;
|
|
341
|
+
const S = (((G = s.flip) == null ? void 0 : G.index) || 0) + 1, q = W[S];
|
|
342
|
+
if (q && (!(u === "alignment" ? y !== V(q) : !1) || // We leave the current main axis only if every placement on that axis
|
|
343
|
+
// overflows the main axis.
|
|
344
|
+
D.every((L) => V(L.placement) === y ? L.overflows[0] > 0 : !0)))
|
|
345
|
+
return {
|
|
346
|
+
data: {
|
|
347
|
+
index: S,
|
|
348
|
+
overflows: D
|
|
349
|
+
},
|
|
350
|
+
reset: {
|
|
351
|
+
placement: q
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
let $ = (I = D.filter((O) => O.overflows[0] <= 0).sort((O, L) => O.overflows[1] - L.overflows[1])[0]) == null ? void 0 : I.placement;
|
|
355
|
+
if (!$)
|
|
356
|
+
switch (f) {
|
|
357
|
+
case "bestFit": {
|
|
358
|
+
var J;
|
|
359
|
+
const O = (J = D.filter((L) => {
|
|
360
|
+
if (A) {
|
|
361
|
+
const N = V(L.placement);
|
|
362
|
+
return N === y || // Create a bias to the `y` side axis due to horizontal
|
|
363
|
+
// reading directions favoring greater width.
|
|
364
|
+
N === "y";
|
|
365
|
+
}
|
|
366
|
+
return !0;
|
|
367
|
+
}).map((L) => [L.placement, L.overflows.filter((N) => N > 0).reduce((N, Nt) => N + Nt, 0)]).sort((L, N) => L[1] - N[1])[0]) == null ? void 0 : J[0];
|
|
368
|
+
O && ($ = O);
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
case "initialPlacement":
|
|
372
|
+
$ = l;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
if (o !== $)
|
|
376
|
+
return {
|
|
377
|
+
reset: {
|
|
378
|
+
placement: $
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
return {};
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}, Zt = /* @__PURE__ */ new Set(["left", "top"]);
|
|
386
|
+
async function te(t, e) {
|
|
387
|
+
const {
|
|
388
|
+
placement: n,
|
|
389
|
+
platform: i,
|
|
390
|
+
elements: o
|
|
391
|
+
} = t, s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)), r = X(n), l = tt(n), c = V(n) === "y", a = Zt.has(r) ? -1 : 1, d = s && c ? -1 : 1, u = Z(e, t);
|
|
392
|
+
let {
|
|
393
|
+
mainAxis: p,
|
|
394
|
+
crossAxis: f,
|
|
395
|
+
alignmentAxis: h
|
|
396
|
+
} = typeof u == "number" ? {
|
|
397
|
+
mainAxis: u,
|
|
398
|
+
crossAxis: 0,
|
|
399
|
+
alignmentAxis: null
|
|
400
|
+
} : {
|
|
401
|
+
mainAxis: u.mainAxis || 0,
|
|
402
|
+
crossAxis: u.crossAxis || 0,
|
|
403
|
+
alignmentAxis: u.alignmentAxis
|
|
404
|
+
};
|
|
405
|
+
return l && typeof h == "number" && (f = l === "end" ? h * -1 : h), c ? {
|
|
406
|
+
x: f * d,
|
|
407
|
+
y: p * a
|
|
408
|
+
} : {
|
|
409
|
+
x: p * a,
|
|
410
|
+
y: f * d
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
const ee = function(t) {
|
|
414
|
+
return t === void 0 && (t = 0), {
|
|
415
|
+
name: "offset",
|
|
416
|
+
options: t,
|
|
417
|
+
async fn(e) {
|
|
418
|
+
var n, i;
|
|
419
|
+
const {
|
|
420
|
+
x: o,
|
|
421
|
+
y: s,
|
|
422
|
+
placement: r,
|
|
423
|
+
middlewareData: l
|
|
424
|
+
} = e, c = await te(e, t);
|
|
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,
|
|
428
|
+
data: {
|
|
429
|
+
...c,
|
|
430
|
+
placement: r
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
}, ne = function(t) {
|
|
436
|
+
return t === void 0 && (t = {}), {
|
|
437
|
+
name: "shift",
|
|
438
|
+
options: t,
|
|
439
|
+
async fn(e) {
|
|
440
|
+
const {
|
|
441
|
+
x: n,
|
|
442
|
+
y: i,
|
|
443
|
+
placement: o,
|
|
444
|
+
platform: s
|
|
445
|
+
} = e, {
|
|
446
|
+
mainAxis: r = !0,
|
|
447
|
+
crossAxis: l = !1,
|
|
448
|
+
limiter: c = {
|
|
449
|
+
fn: (w) => {
|
|
450
|
+
let {
|
|
451
|
+
x: y,
|
|
452
|
+
y: x
|
|
453
|
+
} = w;
|
|
454
|
+
return {
|
|
455
|
+
x: y,
|
|
456
|
+
y: x
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
...a
|
|
461
|
+
} = Z(t, e), d = {
|
|
462
|
+
x: n,
|
|
463
|
+
y: i
|
|
464
|
+
}, u = await s.detectOverflow(e, a), p = V(X(o)), f = Et(p);
|
|
465
|
+
let h = d[f], g = d[p];
|
|
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);
|
|
469
|
+
}
|
|
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);
|
|
473
|
+
}
|
|
474
|
+
const m = c.fn({
|
|
475
|
+
...e,
|
|
476
|
+
[f]: h,
|
|
477
|
+
[p]: g
|
|
478
|
+
});
|
|
479
|
+
return {
|
|
480
|
+
...m,
|
|
481
|
+
data: {
|
|
482
|
+
x: m.x - n,
|
|
483
|
+
y: m.y - i,
|
|
484
|
+
enabled: {
|
|
485
|
+
[f]: r,
|
|
486
|
+
[p]: l
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
function rt() {
|
|
494
|
+
return typeof window < "u";
|
|
495
|
+
}
|
|
496
|
+
function z(t) {
|
|
497
|
+
return Lt(t) ? (t.nodeName || "").toLowerCase() : "#document";
|
|
498
|
+
}
|
|
499
|
+
function C(t) {
|
|
500
|
+
var e;
|
|
501
|
+
return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
|
|
502
|
+
}
|
|
503
|
+
function B(t) {
|
|
504
|
+
var e;
|
|
505
|
+
return (e = (Lt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
|
|
506
|
+
}
|
|
507
|
+
function Lt(t) {
|
|
508
|
+
return rt() ? t instanceof Node || t instanceof C(t).Node : !1;
|
|
509
|
+
}
|
|
510
|
+
function R(t) {
|
|
511
|
+
return rt() ? t instanceof Element || t instanceof C(t).Element : !1;
|
|
512
|
+
}
|
|
513
|
+
function P(t) {
|
|
514
|
+
return rt() ? t instanceof HTMLElement || t instanceof C(t).HTMLElement : !1;
|
|
515
|
+
}
|
|
516
|
+
function bt(t) {
|
|
517
|
+
return !rt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof C(t).ShadowRoot;
|
|
518
|
+
}
|
|
519
|
+
const ie = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
520
|
+
function et(t) {
|
|
521
|
+
const {
|
|
522
|
+
overflow: e,
|
|
523
|
+
overflowX: n,
|
|
524
|
+
overflowY: i,
|
|
525
|
+
display: o
|
|
526
|
+
} = T(t);
|
|
527
|
+
return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !ie.has(o);
|
|
528
|
+
}
|
|
529
|
+
const oe = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
530
|
+
function se(t) {
|
|
531
|
+
return oe.has(z(t));
|
|
532
|
+
}
|
|
533
|
+
const re = [":popover-open", ":modal"];
|
|
534
|
+
function lt(t) {
|
|
535
|
+
return re.some((e) => {
|
|
536
|
+
try {
|
|
537
|
+
return t.matches(e);
|
|
538
|
+
} catch {
|
|
539
|
+
return !1;
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
const le = ["transform", "translate", "scale", "rotate", "perspective"], ce = ["transform", "translate", "scale", "rotate", "perspective", "filter"], ae = ["paint", "layout", "strict", "content"];
|
|
544
|
+
function mt(t) {
|
|
545
|
+
const e = wt(), n = R(t) ? T(t) : t;
|
|
546
|
+
return le.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) || ce.some((i) => (n.willChange || "").includes(i)) || ae.some((i) => (n.contain || "").includes(i));
|
|
547
|
+
}
|
|
548
|
+
function fe(t) {
|
|
549
|
+
let e = M(t);
|
|
550
|
+
for (; P(e) && !Y(e); ) {
|
|
551
|
+
if (mt(e))
|
|
552
|
+
return e;
|
|
553
|
+
if (lt(e))
|
|
554
|
+
return null;
|
|
555
|
+
e = M(e);
|
|
556
|
+
}
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
function wt() {
|
|
560
|
+
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
561
|
+
}
|
|
562
|
+
const ue = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
563
|
+
function Y(t) {
|
|
564
|
+
return ue.has(z(t));
|
|
565
|
+
}
|
|
566
|
+
function T(t) {
|
|
567
|
+
return C(t).getComputedStyle(t);
|
|
568
|
+
}
|
|
569
|
+
function ct(t) {
|
|
570
|
+
return R(t) ? {
|
|
571
|
+
scrollLeft: t.scrollLeft,
|
|
572
|
+
scrollTop: t.scrollTop
|
|
573
|
+
} : {
|
|
574
|
+
scrollLeft: t.scrollX,
|
|
575
|
+
scrollTop: t.scrollY
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function M(t) {
|
|
579
|
+
if (z(t) === "html")
|
|
580
|
+
return t;
|
|
581
|
+
const e = (
|
|
582
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
583
|
+
t.assignedSlot || // DOM Element detected.
|
|
584
|
+
t.parentNode || // ShadowRoot detected.
|
|
585
|
+
bt(t) && t.host || // Fallback.
|
|
586
|
+
B(t)
|
|
587
|
+
);
|
|
588
|
+
return bt(e) ? e.host : e;
|
|
589
|
+
}
|
|
590
|
+
function Rt(t) {
|
|
591
|
+
const e = M(t);
|
|
592
|
+
return Y(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : P(e) && et(e) ? e : Rt(e);
|
|
593
|
+
}
|
|
594
|
+
function Tt(t, e, n) {
|
|
595
|
+
var i;
|
|
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, Tt(o, []));
|
|
599
|
+
}
|
|
600
|
+
function ht(t) {
|
|
601
|
+
return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
|
|
602
|
+
}
|
|
603
|
+
function kt(t) {
|
|
604
|
+
const e = T(t);
|
|
605
|
+
let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
|
|
606
|
+
const o = P(t), s = o ? t.offsetWidth : n, r = o ? t.offsetHeight : i, l = it(n) !== s || it(i) !== r;
|
|
607
|
+
return l && (n = s, i = r), {
|
|
608
|
+
width: n,
|
|
609
|
+
height: i,
|
|
610
|
+
$: l
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function Pt(t) {
|
|
614
|
+
return R(t) ? t : t.contextElement;
|
|
615
|
+
}
|
|
616
|
+
function j(t) {
|
|
617
|
+
const e = Pt(t);
|
|
618
|
+
if (!P(e))
|
|
619
|
+
return k(1);
|
|
620
|
+
const n = e.getBoundingClientRect(), {
|
|
621
|
+
width: i,
|
|
622
|
+
height: o,
|
|
623
|
+
$: s
|
|
624
|
+
} = kt(e);
|
|
625
|
+
let r = (s ? it(n.width) : n.width) / i, l = (s ? it(n.height) : n.height) / o;
|
|
626
|
+
return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
|
|
627
|
+
x: r,
|
|
628
|
+
y: l
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
const de = /* @__PURE__ */ k(0);
|
|
632
|
+
function Dt(t) {
|
|
633
|
+
const e = C(t);
|
|
634
|
+
return !wt() || !e.visualViewport ? de : {
|
|
635
|
+
x: e.visualViewport.offsetLeft,
|
|
636
|
+
y: e.visualViewport.offsetTop
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
function he(t, e, n) {
|
|
640
|
+
return e === void 0 && (e = !1), !n || e && n !== C(t) ? !1 : e;
|
|
641
|
+
}
|
|
642
|
+
function U(t, e, n, i) {
|
|
643
|
+
e === void 0 && (e = !1), n === void 0 && (n = !1);
|
|
644
|
+
const o = t.getBoundingClientRect(), s = Pt(t);
|
|
645
|
+
let r = k(1);
|
|
646
|
+
e && (i ? R(i) && (r = j(i)) : r = j(t));
|
|
647
|
+
const l = he(s, n, i) ? Dt(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;
|
|
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 = T(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);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return st({
|
|
658
|
+
width: d,
|
|
659
|
+
height: u,
|
|
660
|
+
x: c,
|
|
661
|
+
y: a
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
function at(t, e) {
|
|
665
|
+
const n = ct(t).scrollLeft;
|
|
666
|
+
return e ? e.left + n : U(B(t)).left + n;
|
|
667
|
+
}
|
|
668
|
+
function $t(t, e) {
|
|
669
|
+
const n = t.getBoundingClientRect(), i = n.left + e.scrollLeft - at(t, n), o = n.top + e.scrollTop;
|
|
670
|
+
return {
|
|
671
|
+
x: i,
|
|
672
|
+
y: o
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function pe(t) {
|
|
676
|
+
let {
|
|
677
|
+
elements: e,
|
|
678
|
+
rect: n,
|
|
679
|
+
offsetParent: i,
|
|
680
|
+
strategy: o
|
|
681
|
+
} = t;
|
|
682
|
+
const s = o === "fixed", r = B(i), l = e ? lt(e.floating) : !1;
|
|
683
|
+
if (i === r || l && s)
|
|
684
|
+
return n;
|
|
685
|
+
let c = {
|
|
686
|
+
scrollLeft: 0,
|
|
687
|
+
scrollTop: 0
|
|
688
|
+
}, a = k(1);
|
|
689
|
+
const d = k(0), u = P(i);
|
|
690
|
+
if ((u || !u && !s) && ((z(i) !== "body" || et(r)) && (c = ct(i)), P(i))) {
|
|
691
|
+
const f = U(i);
|
|
692
|
+
a = j(i), d.x = f.x + i.clientLeft, d.y = f.y + i.clientTop;
|
|
693
|
+
}
|
|
694
|
+
const p = r && !u && !s ? $t(r, c) : k(0);
|
|
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
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
function ge(t) {
|
|
703
|
+
return Array.from(t.getClientRects());
|
|
704
|
+
}
|
|
705
|
+
function me(t) {
|
|
706
|
+
const e = B(t), n = ct(t), i = t.ownerDocument.body, o = _(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), s = _(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
|
|
707
|
+
let r = -n.scrollLeft + at(t);
|
|
708
|
+
const l = -n.scrollTop;
|
|
709
|
+
return T(i).direction === "rtl" && (r += _(e.clientWidth, i.clientWidth) - o), {
|
|
710
|
+
width: o,
|
|
711
|
+
height: s,
|
|
712
|
+
x: r,
|
|
713
|
+
y: l
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
const St = 25;
|
|
717
|
+
function we(t, e) {
|
|
718
|
+
const n = C(t), i = B(t), o = n.visualViewport;
|
|
719
|
+
let s = i.clientWidth, r = i.clientHeight, l = 0, c = 0;
|
|
720
|
+
if (o) {
|
|
721
|
+
s = o.width, r = o.height;
|
|
722
|
+
const d = wt();
|
|
723
|
+
(!d || d && e === "fixed") && (l = o.offsetLeft, c = o.offsetTop);
|
|
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);
|
|
730
|
+
return {
|
|
731
|
+
width: s,
|
|
732
|
+
height: r,
|
|
733
|
+
x: l,
|
|
734
|
+
y: c
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
const ye = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
738
|
+
function xe(t, e) {
|
|
739
|
+
const n = U(t, !0, e === "fixed"), i = n.top + t.clientTop, o = n.left + t.clientLeft, s = P(t) ? j(t) : k(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = o * s.x, a = i * s.y;
|
|
740
|
+
return {
|
|
741
|
+
width: r,
|
|
742
|
+
height: l,
|
|
743
|
+
x: c,
|
|
744
|
+
y: a
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
function At(t, e, n) {
|
|
748
|
+
let i;
|
|
749
|
+
if (e === "viewport")
|
|
750
|
+
i = we(t, n);
|
|
751
|
+
else if (e === "document")
|
|
752
|
+
i = me(B(t));
|
|
753
|
+
else if (R(e))
|
|
754
|
+
i = xe(e, n);
|
|
755
|
+
else {
|
|
756
|
+
const o = Dt(t);
|
|
757
|
+
i = {
|
|
758
|
+
x: e.x - o.x,
|
|
759
|
+
y: e.y - o.y,
|
|
760
|
+
width: e.width,
|
|
761
|
+
height: e.height
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
return st(i);
|
|
765
|
+
}
|
|
766
|
+
function Ft(t, e) {
|
|
767
|
+
const n = M(t);
|
|
768
|
+
return n === e || !R(n) || Y(n) ? !1 : T(n).position === "fixed" || Ft(n, e);
|
|
769
|
+
}
|
|
770
|
+
function ve(t, e) {
|
|
771
|
+
const n = e.get(t);
|
|
772
|
+
if (n)
|
|
773
|
+
return n;
|
|
774
|
+
let i = Tt(t, []).filter((l) => R(l) && z(l) !== "body"), o = null;
|
|
775
|
+
const s = T(t).position === "fixed";
|
|
776
|
+
let r = s ? M(t) : t;
|
|
777
|
+
for (; R(r) && !Y(r); ) {
|
|
778
|
+
const l = T(r), c = mt(r);
|
|
779
|
+
!c && l.position === "fixed" && (o = null), (s ? !c && !o : !c && l.position === "static" && !!o && ye.has(o.position) || et(r) && !c && Ft(t, r)) ? i = i.filter((d) => d !== r) : o = l, r = M(r);
|
|
780
|
+
}
|
|
781
|
+
return e.set(t, i), i;
|
|
782
|
+
}
|
|
783
|
+
function be(t) {
|
|
784
|
+
let {
|
|
785
|
+
element: e,
|
|
786
|
+
boundary: n,
|
|
787
|
+
rootBoundary: i,
|
|
788
|
+
strategy: o
|
|
789
|
+
} = t;
|
|
790
|
+
const r = [...n === "clippingAncestors" ? lt(e) ? [] : ve(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 = _(u.top, a.top), a.right = Q(u.right, a.right), a.bottom = Q(u.bottom, a.bottom), a.left = _(u.left, a.left), a;
|
|
793
|
+
}, At(e, l, o));
|
|
794
|
+
return {
|
|
795
|
+
width: c.right - c.left,
|
|
796
|
+
height: c.bottom - c.top,
|
|
797
|
+
x: c.left,
|
|
798
|
+
y: c.top
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
function Se(t) {
|
|
802
|
+
const {
|
|
803
|
+
width: e,
|
|
804
|
+
height: n
|
|
805
|
+
} = kt(t);
|
|
806
|
+
return {
|
|
807
|
+
width: e,
|
|
808
|
+
height: n
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
function Ae(t, e, n) {
|
|
812
|
+
const i = P(e), o = B(e), s = n === "fixed", r = U(t, !0, s, e);
|
|
813
|
+
let l = {
|
|
814
|
+
scrollLeft: 0,
|
|
815
|
+
scrollTop: 0
|
|
816
|
+
};
|
|
817
|
+
const c = k(0);
|
|
818
|
+
function a() {
|
|
819
|
+
c.x = at(o);
|
|
820
|
+
}
|
|
821
|
+
if (i || !i && !s)
|
|
822
|
+
if ((z(e) !== "body" || et(o)) && (l = ct(e)), i) {
|
|
823
|
+
const f = U(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 ? $t(o, l) : k(0), u = r.left + l.scrollLeft - c.x - d.x, p = r.top + l.scrollTop - c.y - d.y;
|
|
828
|
+
return {
|
|
829
|
+
x: u,
|
|
830
|
+
y: p,
|
|
831
|
+
width: r.width,
|
|
832
|
+
height: r.height
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
function ft(t) {
|
|
836
|
+
return T(t).position === "static";
|
|
837
|
+
}
|
|
838
|
+
function Ct(t, e) {
|
|
839
|
+
if (!P(t) || T(t).position === "fixed")
|
|
840
|
+
return null;
|
|
841
|
+
if (e)
|
|
842
|
+
return e(t);
|
|
843
|
+
let n = t.offsetParent;
|
|
844
|
+
return B(t) === n && (n = n.ownerDocument.body), n;
|
|
845
|
+
}
|
|
846
|
+
function Bt(t, e) {
|
|
847
|
+
const n = C(t);
|
|
848
|
+
if (lt(t))
|
|
849
|
+
return n;
|
|
850
|
+
if (!P(t)) {
|
|
851
|
+
let o = M(t);
|
|
852
|
+
for (; o && !Y(o); ) {
|
|
853
|
+
if (R(o) && !ft(o))
|
|
854
|
+
return o;
|
|
855
|
+
o = M(o);
|
|
856
|
+
}
|
|
857
|
+
return n;
|
|
858
|
+
}
|
|
859
|
+
let i = Ct(t, e);
|
|
860
|
+
for (; i && se(i) && ft(i); )
|
|
861
|
+
i = Ct(i, e);
|
|
862
|
+
return i && Y(i) && ft(i) && !mt(i) ? n : i || fe(t) || n;
|
|
863
|
+
}
|
|
864
|
+
const Ce = async function(t) {
|
|
865
|
+
const e = this.getOffsetParent || Bt, n = this.getDimensions, i = await n(t.floating);
|
|
866
|
+
return {
|
|
867
|
+
reference: Ae(t.reference, await e(t.floating), t.strategy),
|
|
868
|
+
floating: {
|
|
869
|
+
x: 0,
|
|
870
|
+
y: 0,
|
|
871
|
+
width: i.width,
|
|
872
|
+
height: i.height
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
};
|
|
876
|
+
function Ee(t) {
|
|
877
|
+
return T(t).direction === "rtl";
|
|
878
|
+
}
|
|
879
|
+
const Oe = {
|
|
880
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: pe,
|
|
881
|
+
getDocumentElement: B,
|
|
882
|
+
getClippingRect: be,
|
|
883
|
+
getOffsetParent: Bt,
|
|
884
|
+
getElementRects: Ce,
|
|
885
|
+
getClientRects: ge,
|
|
886
|
+
getDimensions: Se,
|
|
887
|
+
getScale: j,
|
|
888
|
+
isElement: R,
|
|
889
|
+
isRTL: Ee
|
|
890
|
+
}, Le = ee, Re = ne, Te = Ut, ke = Qt, Pe = (t, e, n) => {
|
|
891
|
+
const i = /* @__PURE__ */ new Map(), o = {
|
|
892
|
+
platform: Oe,
|
|
893
|
+
...n
|
|
894
|
+
}, s = {
|
|
895
|
+
...o.platform,
|
|
896
|
+
_c: i
|
|
897
|
+
};
|
|
898
|
+
return Jt(t, e, {
|
|
899
|
+
...o,
|
|
900
|
+
platform: s
|
|
901
|
+
});
|
|
902
|
+
};
|
|
903
|
+
function De(t) {
|
|
904
|
+
try {
|
|
905
|
+
return document.querySelector(t);
|
|
906
|
+
} catch {
|
|
907
|
+
return console.warn(`[Trailguide] Invalid selector: ${t}`), null;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
function $e(t) {
|
|
911
|
+
const e = t.getBoundingClientRect(), n = window.getComputedStyle(t);
|
|
912
|
+
return e.width > 0 && e.height > 0 && n.visibility !== "hidden" && n.display !== "none" && n.opacity !== "0";
|
|
913
|
+
}
|
|
914
|
+
function Fe(t) {
|
|
915
|
+
t.scrollIntoView({
|
|
916
|
+
behavior: "smooth",
|
|
917
|
+
block: "center",
|
|
918
|
+
inline: "center"
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
function nt(t, e, n) {
|
|
922
|
+
const i = document.createElement(t);
|
|
923
|
+
return e && (i.className = e), n && n.appendChild(i), i;
|
|
924
|
+
}
|
|
925
|
+
class Be {
|
|
926
|
+
constructor(e = {}) {
|
|
927
|
+
F(this, "trail", null);
|
|
928
|
+
F(this, "currentStepIndex", 0);
|
|
929
|
+
F(this, "isActive", !1);
|
|
930
|
+
F(this, "options", {});
|
|
931
|
+
// DOM elements
|
|
932
|
+
F(this, "overlay", null);
|
|
933
|
+
F(this, "tooltip", null);
|
|
934
|
+
F(this, "arrowEl", null);
|
|
935
|
+
// Cleanup functions
|
|
936
|
+
F(this, "cleanupFns", []);
|
|
937
|
+
this.options = e;
|
|
938
|
+
}
|
|
939
|
+
start(e) {
|
|
940
|
+
this.trail = e, this.currentStepIndex = 0, this.isActive = !0, this.createOverlay(), this.showStep(), this.bindKeyboard();
|
|
941
|
+
}
|
|
942
|
+
stop() {
|
|
943
|
+
this.isActive = !1, this.cleanup();
|
|
944
|
+
}
|
|
945
|
+
next() {
|
|
946
|
+
!this.trail || !this.isActive || (this.currentStepIndex < this.trail.steps.length - 1 ? (this.currentStepIndex++, this.showStep()) : this.complete());
|
|
947
|
+
}
|
|
948
|
+
prev() {
|
|
949
|
+
!this.trail || !this.isActive || this.currentStepIndex > 0 && (this.currentStepIndex--, this.showStep());
|
|
950
|
+
}
|
|
951
|
+
skip() {
|
|
952
|
+
var e, n;
|
|
953
|
+
this.isActive = !1, this.cleanup(), (n = (e = this.options).onSkip) == null || n.call(e);
|
|
954
|
+
}
|
|
955
|
+
goToStep(e) {
|
|
956
|
+
!this.trail || !this.isActive || e >= 0 && e < this.trail.steps.length && (this.currentStepIndex = e, this.showStep());
|
|
957
|
+
}
|
|
958
|
+
complete() {
|
|
959
|
+
var e, n;
|
|
960
|
+
this.isActive = !1, this.cleanup(), (n = (e = this.options).onComplete) == null || n.call(e);
|
|
961
|
+
}
|
|
962
|
+
createOverlay() {
|
|
963
|
+
var n, i, o;
|
|
964
|
+
this.overlay = nt("div", "trailguide-overlay"), document.body.appendChild(this.overlay);
|
|
965
|
+
const e = nt("div", "trailguide-spotlight", this.overlay);
|
|
966
|
+
e.innerHTML = `
|
|
967
|
+
<svg width="100%" height="100%">
|
|
968
|
+
<defs>
|
|
969
|
+
<mask id="trailguide-mask">
|
|
970
|
+
<rect x="0" y="0" width="100%" height="100%" fill="white" />
|
|
971
|
+
<rect class="trailguide-cutout" rx="4" fill="black" />
|
|
972
|
+
</mask>
|
|
973
|
+
</defs>
|
|
974
|
+
<rect x="0" y="0" width="100%" height="100%" fill="rgba(0,0,0,0.5)" mask="url(#trailguide-mask)" />
|
|
975
|
+
</svg>
|
|
976
|
+
`, nt("div", "trailguide-highlight", this.overlay), this.tooltip = nt("div", "trailguide-tooltip"), this.tooltip.innerHTML = `
|
|
977
|
+
<div class="trailguide-tooltip-content">
|
|
978
|
+
<div class="trailguide-tooltip-header">
|
|
979
|
+
<h3 class="trailguide-tooltip-title"></h3>
|
|
980
|
+
<button class="trailguide-tooltip-close" aria-label="Skip tour">×</button>
|
|
981
|
+
</div>
|
|
982
|
+
<div class="trailguide-tooltip-body"></div>
|
|
983
|
+
<div class="trailguide-tooltip-footer">
|
|
984
|
+
<span class="trailguide-tooltip-progress"></span>
|
|
985
|
+
<div class="trailguide-tooltip-nav">
|
|
986
|
+
<button class="trailguide-btn trailguide-btn-secondary trailguide-btn-prev">Back</button>
|
|
987
|
+
<button class="trailguide-btn trailguide-btn-primary trailguide-btn-next">Next</button>
|
|
988
|
+
</div>
|
|
989
|
+
</div>
|
|
990
|
+
<div class="trailguide-tooltip-arrow"></div>
|
|
991
|
+
</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());
|
|
993
|
+
}
|
|
994
|
+
showStep() {
|
|
995
|
+
if (!this.trail || !this.overlay || !this.tooltip) return;
|
|
996
|
+
const e = this.trail.steps[this.currentStepIndex];
|
|
997
|
+
if (!e) return;
|
|
998
|
+
const n = De(e.target);
|
|
999
|
+
if (!n || !$e(n)) {
|
|
1000
|
+
console.warn(`[Trailguide] Target not found or not visible: ${e.target}`);
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
Fe(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);
|
|
1006
|
+
}, 100);
|
|
1007
|
+
}
|
|
1008
|
+
updateSpotlight(e) {
|
|
1009
|
+
if (!this.overlay) return;
|
|
1010
|
+
const n = e.getBoundingClientRect(), i = 8, o = this.overlay.querySelector(".trailguide-cutout");
|
|
1011
|
+
o && (o.setAttribute("x", String(n.left - i)), o.setAttribute("y", String(n.top - i)), o.setAttribute("width", String(n.width + i * 2)), o.setAttribute("height", String(n.height + i * 2)));
|
|
1012
|
+
const s = this.overlay.querySelector(".trailguide-highlight");
|
|
1013
|
+
s && (s.style.top = `${n.top - i}px`, s.style.left = `${n.left - i}px`, s.style.width = `${n.width + i * 2}px`, s.style.height = `${n.height + i * 2}px`);
|
|
1014
|
+
const r = () => {
|
|
1015
|
+
if (!this.isActive) return;
|
|
1016
|
+
const l = e.getBoundingClientRect();
|
|
1017
|
+
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
|
+
};
|
|
1019
|
+
window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), this.cleanupFns.push(() => {
|
|
1020
|
+
window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
async updateTooltip(e, n) {
|
|
1024
|
+
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 Pe(n, this.tooltip, {
|
|
1028
|
+
placement: e.placement,
|
|
1029
|
+
middleware: [
|
|
1030
|
+
Le(12),
|
|
1031
|
+
Te(),
|
|
1032
|
+
Re({ padding: 8 }),
|
|
1033
|
+
ke({ element: this.arrowEl })
|
|
1034
|
+
]
|
|
1035
|
+
});
|
|
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` : "";
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
bindKeyboard() {
|
|
1042
|
+
const e = (n) => {
|
|
1043
|
+
if (this.isActive)
|
|
1044
|
+
switch (n.key) {
|
|
1045
|
+
case "ArrowRight":
|
|
1046
|
+
case "Enter":
|
|
1047
|
+
this.next();
|
|
1048
|
+
break;
|
|
1049
|
+
case "ArrowLeft":
|
|
1050
|
+
this.prev();
|
|
1051
|
+
break;
|
|
1052
|
+
case "Escape":
|
|
1053
|
+
this.skip();
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
window.addEventListener("keydown", e), this.cleanupFns.push(() => window.removeEventListener("keydown", e));
|
|
1058
|
+
}
|
|
1059
|
+
cleanup() {
|
|
1060
|
+
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;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
let b = null;
|
|
1065
|
+
function Ve(t, e) {
|
|
1066
|
+
return b && b.stop(), b = new Be(e), b.start(t), b;
|
|
1067
|
+
}
|
|
1068
|
+
function Me() {
|
|
1069
|
+
b == null || b.stop();
|
|
1070
|
+
}
|
|
1071
|
+
function We() {
|
|
1072
|
+
b == null || b.next();
|
|
1073
|
+
}
|
|
1074
|
+
function He() {
|
|
1075
|
+
b == null || b.prev();
|
|
1076
|
+
}
|
|
1077
|
+
function Ie() {
|
|
1078
|
+
b == null || b.skip();
|
|
1079
|
+
}
|
|
1080
|
+
export {
|
|
1081
|
+
Be as Trailguide,
|
|
1082
|
+
De as findElement,
|
|
1083
|
+
$e as isElementVisible,
|
|
1084
|
+
We as next,
|
|
1085
|
+
He as prev,
|
|
1086
|
+
Fe as scrollToElement,
|
|
1087
|
+
Ie as skip,
|
|
1088
|
+
Ve as start,
|
|
1089
|
+
Me as stop
|
|
1090
|
+
};
|