@liuqinhang/taplu 0.1.0-dev.4 → 0.1.0-dev.5
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/dist/controller.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/renderer/driver.d.ts.map +1 -1
- package/dist/taplu.cjs +4 -4
- package/dist/taplu.cjs.map +1 -1
- package/dist/taplu.css +1 -1
- package/dist/taplu.iife.js +5 -5
- package/dist/taplu.iife.js.map +1 -1
- package/dist/taplu.mjs +542 -502
- package/dist/taplu.mjs.map +1 -1
- package/dist/types.d.ts +24 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/taplu.mjs
CHANGED
|
@@ -14,12 +14,12 @@ function pr(t, e) {
|
|
|
14
14
|
continue;
|
|
15
15
|
}
|
|
16
16
|
if (o === '"' || o === "'") {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
n.push({ kind: "value", value: t.slice(r + 1,
|
|
17
|
+
const f = t.indexOf(o, r + 1);
|
|
18
|
+
if (f < 0) throw new Error("字符串未闭合");
|
|
19
|
+
n.push({ kind: "value", value: t.slice(r + 1, f) }), r = f + 1;
|
|
20
20
|
continue;
|
|
21
21
|
}
|
|
22
|
-
const i = fr.find((
|
|
22
|
+
const i = fr.find((f) => t.startsWith(f, r));
|
|
23
23
|
if (i) {
|
|
24
24
|
n.push({ kind: "op", value: i }), r += i.length;
|
|
25
25
|
continue;
|
|
@@ -71,46 +71,46 @@ function hr(t, e = {}) {
|
|
|
71
71
|
const n = pr(t, e);
|
|
72
72
|
let r = 0;
|
|
73
73
|
const o = () => n[r], i = () => n[r++], a = () => {
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
74
|
+
const v = i();
|
|
75
|
+
if (!v) throw new Error("表达式不完整");
|
|
76
|
+
if (v.kind === "paren" && v.value === "(") {
|
|
77
|
+
const u = c(), y = i();
|
|
78
78
|
if (!y || y.kind !== "paren" || y.value !== ")") throw new Error("括号未闭合");
|
|
79
|
-
return
|
|
79
|
+
return u;
|
|
80
80
|
}
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
if (
|
|
81
|
+
if (v.kind !== "value") throw new Error(`意外的符号:${String(v.value)}`);
|
|
82
|
+
const m = o();
|
|
83
|
+
if (m && m.kind === "op" && !["&&", "||", "!"].includes(m.value)) {
|
|
84
84
|
i();
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
87
|
-
return mr(
|
|
85
|
+
const u = i();
|
|
86
|
+
if (!u || u.kind !== "value") throw new Error("比较缺少右值");
|
|
87
|
+
return mr(v.value, m.value, u.value);
|
|
88
88
|
}
|
|
89
|
-
return !!
|
|
89
|
+
return !!v.value;
|
|
90
90
|
}, s = () => {
|
|
91
|
-
const
|
|
92
|
-
return
|
|
91
|
+
const v = o();
|
|
92
|
+
return v && v.kind === "op" && v.value === "!" ? (i(), !s()) : a();
|
|
93
93
|
}, l = () => {
|
|
94
|
-
let
|
|
94
|
+
let v = s();
|
|
95
95
|
for (; ; ) {
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
96
|
+
const m = o();
|
|
97
|
+
if (!m || m.kind !== "op" || m.value !== "&&") return v;
|
|
98
98
|
i();
|
|
99
|
-
const
|
|
100
|
-
|
|
99
|
+
const u = s();
|
|
100
|
+
v = v && u;
|
|
101
101
|
}
|
|
102
102
|
}, c = () => {
|
|
103
|
-
let
|
|
103
|
+
let v = l();
|
|
104
104
|
for (; ; ) {
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
105
|
+
const m = o();
|
|
106
|
+
if (!m || m.kind !== "op" || m.value !== "||") return v;
|
|
107
107
|
i();
|
|
108
|
-
const
|
|
109
|
-
|
|
108
|
+
const u = l();
|
|
109
|
+
v = v || u;
|
|
110
110
|
}
|
|
111
|
-
},
|
|
111
|
+
}, f = c();
|
|
112
112
|
if (r !== n.length) throw new Error("表达式存在多余内容");
|
|
113
|
-
return
|
|
113
|
+
return f;
|
|
114
114
|
} catch {
|
|
115
115
|
return !1;
|
|
116
116
|
}
|
|
@@ -226,12 +226,12 @@ function rn(t, e) {
|
|
|
226
226
|
if (!o) return [];
|
|
227
227
|
const i = bt(n, "*"), a = Math.min(i.length, _r), s = [], l = [];
|
|
228
228
|
for (let c = 0; c < a; c += 1) {
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
231
|
-
const
|
|
232
|
-
|
|
229
|
+
const f = i[c];
|
|
230
|
+
if (!f) continue;
|
|
231
|
+
const v = kr(f);
|
|
232
|
+
v && (v === o ? s.push(f) : v.includes(o) && l.push({ element: f, length: v.length }));
|
|
233
233
|
}
|
|
234
|
-
return l.sort((c,
|
|
234
|
+
return l.sort((c, f) => c.length - f.length), s.length > 0 ? s : l.map((c) => c.element);
|
|
235
235
|
}
|
|
236
236
|
case "path":
|
|
237
237
|
case "css":
|
|
@@ -270,23 +270,23 @@ function Tt(t, e = {}) {
|
|
|
270
270
|
const n = (o = e.root) != null ? o : document, r = [];
|
|
271
271
|
for (const c of Ar((i = t.candidates) != null ? i : [])) {
|
|
272
272
|
r.push(St(c));
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
273
|
+
const f = rn(c, n);
|
|
274
|
+
if (f.length === 0) {
|
|
275
275
|
(a = e.onDebug) == null || a.call(e, `未命中 ${St(c)}`);
|
|
276
276
|
continue;
|
|
277
277
|
}
|
|
278
|
-
if (!$r(t,
|
|
279
|
-
(s = e.onDebug) == null || s.call(e, `命中 ${
|
|
278
|
+
if (!$r(t, f.length)) {
|
|
279
|
+
(s = e.onDebug) == null || s.call(e, `命中 ${f.length} 个,超出 match 约定 ${St(c)}`);
|
|
280
280
|
continue;
|
|
281
281
|
}
|
|
282
|
-
const
|
|
283
|
-
(
|
|
282
|
+
const v = f.find(
|
|
283
|
+
(m) => Lr(m) && Cr(m, t.expect)
|
|
284
284
|
);
|
|
285
|
-
if (!
|
|
285
|
+
if (!v) {
|
|
286
286
|
(l = e.onDebug) == null || l.call(e, `命中但不符合 expect 或不可见 ${St(c)}`);
|
|
287
287
|
continue;
|
|
288
288
|
}
|
|
289
|
-
return { element:
|
|
289
|
+
return { element: v, hitLevel: r.length - 1, triedSelectors: r };
|
|
290
290
|
}
|
|
291
291
|
return { element: null, hitLevel: -1, triedSelectors: r };
|
|
292
292
|
}
|
|
@@ -296,32 +296,32 @@ function Ir(t, e = {}) {
|
|
|
296
296
|
return o.element || n <= 0 ? Promise.resolve(o) : new Promise((s) => {
|
|
297
297
|
var y;
|
|
298
298
|
const l = Date.now();
|
|
299
|
-
let c,
|
|
300
|
-
const
|
|
301
|
-
c !== void 0 && clearTimeout(c),
|
|
302
|
-
},
|
|
299
|
+
let c, f;
|
|
300
|
+
const v = (h) => {
|
|
301
|
+
c !== void 0 && clearTimeout(c), f == null || f.disconnect(), s(h);
|
|
302
|
+
}, m = () => {
|
|
303
303
|
const h = Tt(t, e);
|
|
304
304
|
if (h.element) {
|
|
305
|
-
|
|
305
|
+
v(h);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
308
|
if (Date.now() - l >= n) {
|
|
309
|
-
|
|
309
|
+
v(h);
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
c = setTimeout(
|
|
313
|
-
},
|
|
314
|
-
if (typeof MutationObserver != "undefined" &&
|
|
315
|
-
|
|
312
|
+
c = setTimeout(m, r);
|
|
313
|
+
}, u = (y = e.root) != null ? y : document;
|
|
314
|
+
if (typeof MutationObserver != "undefined" && u) {
|
|
315
|
+
f = new MutationObserver(() => {
|
|
316
316
|
const h = Tt(t, e);
|
|
317
|
-
h.element &&
|
|
317
|
+
h.element && v(h);
|
|
318
318
|
});
|
|
319
319
|
try {
|
|
320
|
-
|
|
320
|
+
f.observe(u, { childList: !0, subtree: !0 });
|
|
321
321
|
} catch {
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
|
-
|
|
324
|
+
m();
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
327
|
const Ne = 500;
|
|
@@ -366,32 +366,32 @@ const Tr = 3e3, Re = {
|
|
|
366
366
|
function Pr(t = {}) {
|
|
367
367
|
var vt, mt, ht, gt;
|
|
368
368
|
const e = (vt = t.store) != null ? vt : Mr(), n = (mt = t.renderer) != null ? mt : null, r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map(), i = (ht = t.continuation) != null ? ht : xr({ windowMs: t.continueWindowMs });
|
|
369
|
-
let a = null, s = 0, l = !1, c = [],
|
|
370
|
-
const
|
|
369
|
+
let a = null, s = 0, l = !1, c = [], f = { ...(gt = t.context) != null ? gt : {} }, v = null, m = 0;
|
|
370
|
+
const u = 500, y = () => {
|
|
371
371
|
var d, w;
|
|
372
372
|
return (w = (d = t.router) == null ? void 0 : d.getRoute()) != null ? w : "";
|
|
373
373
|
}, h = t.debug === !0, g = (d) => {
|
|
374
374
|
h && console.info(`[TapLu] ${d}`);
|
|
375
375
|
};
|
|
376
|
-
function
|
|
377
|
-
for (const
|
|
376
|
+
function k(d) {
|
|
377
|
+
for (const C of r)
|
|
378
378
|
try {
|
|
379
|
-
|
|
380
|
-
} catch (
|
|
381
|
-
console.error("[TapLu] 监听器执行出错",
|
|
379
|
+
C(d);
|
|
380
|
+
} catch (T) {
|
|
381
|
+
console.error("[TapLu] 监听器执行出错", T);
|
|
382
382
|
}
|
|
383
383
|
const w = o.get(d.type);
|
|
384
384
|
if (!w) return;
|
|
385
|
-
const b =
|
|
386
|
-
for (const
|
|
385
|
+
const b = D(d);
|
|
386
|
+
for (const C of w)
|
|
387
387
|
try {
|
|
388
|
-
|
|
389
|
-
} catch (
|
|
390
|
-
console.error("[TapLu] 监听器执行出错",
|
|
388
|
+
C(...b);
|
|
389
|
+
} catch (T) {
|
|
390
|
+
console.error("[TapLu] 监听器执行出错", T);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
|
-
function
|
|
394
|
-
var
|
|
393
|
+
function B(d, w) {
|
|
394
|
+
var T;
|
|
395
395
|
if (typeof d == "function") {
|
|
396
396
|
const H = d;
|
|
397
397
|
return r.add(H), () => {
|
|
@@ -400,17 +400,17 @@ function Pr(t = {}) {
|
|
|
400
400
|
}
|
|
401
401
|
if (typeof d != "string" || typeof w != "function") return () => {
|
|
402
402
|
};
|
|
403
|
-
const b = w,
|
|
404
|
-
return
|
|
405
|
-
|
|
403
|
+
const b = w, C = (T = o.get(d)) != null ? T : /* @__PURE__ */ new Set();
|
|
404
|
+
return C.add(b), o.set(d, C), () => {
|
|
405
|
+
C.delete(b), C.size === 0 && o.delete(d);
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function I(d, w) {
|
|
409
409
|
if (typeof d != "string" || typeof w != "function") return;
|
|
410
410
|
const b = o.get(d);
|
|
411
411
|
b && (b.delete(w), b.size === 0 && o.delete(d));
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function D(d) {
|
|
414
414
|
switch (d.type) {
|
|
415
415
|
case "change":
|
|
416
416
|
return [d.state];
|
|
@@ -428,10 +428,10 @@ function Pr(t = {}) {
|
|
|
428
428
|
return [];
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function p(d) {
|
|
432
432
|
var b;
|
|
433
433
|
const w = d instanceof Error ? d : new Error(String(d));
|
|
434
|
-
(b = t.onError) == null || b.call(t, w),
|
|
434
|
+
(b = t.onError) == null || b.call(t, w), k({ type: "error", error: w });
|
|
435
435
|
}
|
|
436
436
|
function x() {
|
|
437
437
|
var w, b;
|
|
@@ -467,63 +467,65 @@ function Pr(t = {}) {
|
|
|
467
467
|
try {
|
|
468
468
|
e.saveProgress(w);
|
|
469
469
|
} catch (b) {
|
|
470
|
-
|
|
470
|
+
p(b);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
-
function
|
|
474
|
-
var
|
|
473
|
+
function M(d, w) {
|
|
474
|
+
var C, T, H, P, j;
|
|
475
475
|
if (!a) return;
|
|
476
476
|
const b = {
|
|
477
477
|
flowKey: a.key,
|
|
478
478
|
stepVersion: a.version,
|
|
479
479
|
stepId: d.step.id,
|
|
480
|
-
route: (
|
|
480
|
+
route: (T = (C = t.router) == null ? void 0 : C.getRoute()) != null ? T : "",
|
|
481
481
|
triedSelectors: d.triedSelectors,
|
|
482
482
|
hitLevel: d.hitLevel,
|
|
483
483
|
snapshot: (H = d.step.target) == null ? void 0 : H.snapshot,
|
|
484
484
|
at: Date.now()
|
|
485
485
|
};
|
|
486
|
-
(P = t.onMiss) == null || P.call(t, b),
|
|
486
|
+
(P = t.onMiss) == null || P.call(t, b), k({ type: "miss", report: b });
|
|
487
487
|
try {
|
|
488
488
|
(j = e.reportMiss) == null || j.call(e, b);
|
|
489
489
|
} catch (ot) {
|
|
490
|
-
|
|
490
|
+
p(ot);
|
|
491
491
|
}
|
|
492
492
|
g(`锚点未命中:${d.step.id}(${w})`);
|
|
493
493
|
}
|
|
494
494
|
function N(d) {
|
|
495
|
-
var b,
|
|
495
|
+
var b, C, T, H, P;
|
|
496
496
|
if (!a) return;
|
|
497
497
|
const w = {
|
|
498
498
|
flowKey: a.key,
|
|
499
499
|
flowVersion: a.version,
|
|
500
500
|
stepId: d.step.id,
|
|
501
|
-
route: (
|
|
501
|
+
route: (C = (b = t.router) == null ? void 0 : b.getRoute()) != null ? C : "",
|
|
502
502
|
hitLevel: d.hitLevel,
|
|
503
|
-
candidateCount: (H = (
|
|
503
|
+
candidateCount: (H = (T = d.step.target) == null ? void 0 : T.candidates.length) != null ? H : 0,
|
|
504
504
|
at: Date.now()
|
|
505
505
|
};
|
|
506
|
-
|
|
506
|
+
k({ type: "hit", report: w });
|
|
507
507
|
try {
|
|
508
508
|
(P = e.reportHit) == null || P.call(e, w);
|
|
509
509
|
} catch (j) {
|
|
510
|
-
|
|
510
|
+
p(j);
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
function L(d) {
|
|
514
|
-
var
|
|
515
|
-
const w = a, b = (
|
|
516
|
-
l = !1, _(), n == null || n.hide(), $(
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
514
|
+
var T;
|
|
515
|
+
const w = a, b = (T = w == null ? void 0 : w.key) != null ? T : "";
|
|
516
|
+
l = !1, _(), n == null || n.hide(), $(
|
|
517
|
+
d === "done" ? "done" : d === "skipped" ? "skipped" : d === "closed" ? "closed" : "started"
|
|
518
|
+
), k({ type: "end", flowKey: b, reason: d }), k({ type: "change", state: x() });
|
|
519
|
+
const C = v;
|
|
520
|
+
v = null, d === "done" && w && S(C ? { ...w, next: [C] } : w);
|
|
521
|
+
}
|
|
522
|
+
function S(d) {
|
|
523
|
+
var T;
|
|
524
|
+
const b = ((T = d.next) != null ? T : [])[0];
|
|
523
525
|
if (!b) return;
|
|
524
|
-
const
|
|
525
|
-
if (!b.route || Xt(b.route,
|
|
526
|
-
g(`本页继续 ${b.flowKey}`),
|
|
526
|
+
const C = y();
|
|
527
|
+
if (!b.route || Xt(b.route, C)) {
|
|
528
|
+
g(`本页继续 ${b.flowKey}`), R(b.flowKey);
|
|
527
529
|
return;
|
|
528
530
|
}
|
|
529
531
|
i.write({
|
|
@@ -533,34 +535,34 @@ function Pr(t = {}) {
|
|
|
533
535
|
at: Date.now()
|
|
534
536
|
}), g(`已写入续播便签:${b.flowKey}(等待路由 ${b.route})`);
|
|
535
537
|
}
|
|
536
|
-
async function
|
|
538
|
+
async function W(d) {
|
|
537
539
|
var w;
|
|
538
540
|
try {
|
|
539
541
|
const b = await e.loadFlow(d);
|
|
540
542
|
if (((w = b == null ? void 0 : b.start) == null ? void 0 : w.once) === !1) return !1;
|
|
541
|
-
const
|
|
542
|
-
return
|
|
543
|
+
const C = await e.getProgress(d), T = C == null ? void 0 : C.status;
|
|
544
|
+
return T === "done" || T === "skipped" || T === "closed";
|
|
543
545
|
} catch (b) {
|
|
544
|
-
return
|
|
546
|
+
return p(b), !1;
|
|
545
547
|
}
|
|
546
548
|
}
|
|
547
|
-
async function
|
|
549
|
+
async function R(d) {
|
|
548
550
|
try {
|
|
549
551
|
const w = await e.loadFlow(d);
|
|
550
|
-
return w ? Y(w) : (
|
|
552
|
+
return w ? Y(w) : (p(new Error(`未找到引导流程 ${d}`)), !1);
|
|
551
553
|
} catch (w) {
|
|
552
|
-
return
|
|
554
|
+
return p(w), !1;
|
|
553
555
|
}
|
|
554
556
|
}
|
|
555
|
-
function
|
|
557
|
+
function E(d, w) {
|
|
556
558
|
var Ie, Me, Te;
|
|
557
559
|
const b = d.advance;
|
|
558
560
|
if (!b || b.mode !== "action" || !b.action) return;
|
|
559
|
-
const
|
|
560
|
-
if (
|
|
561
|
+
const C = b.action, T = (Ie = C.timeoutMs) != null ? Ie : 2e4, H = C.event === "navigate" ? (Me = Re.navigate) != null ? Me : [] : (Te = Re[C.event]) != null ? Te : [], P = [];
|
|
562
|
+
if (C.event === "navigate")
|
|
561
563
|
P.push(window);
|
|
562
564
|
else {
|
|
563
|
-
const X =
|
|
565
|
+
const X = C.target && C.target !== "@self" ? C.target : null, G = X ? Tt({ candidates: [{ kind: "css", expr: X }] }, { root: t.root }).element : w.element;
|
|
564
566
|
G && P.push(G);
|
|
565
567
|
}
|
|
566
568
|
let j, ot = !1, wt = !1;
|
|
@@ -575,7 +577,7 @@ function Pr(t = {}) {
|
|
|
575
577
|
const $e = () => {
|
|
576
578
|
j = setTimeout(() => {
|
|
577
579
|
var G, Pe;
|
|
578
|
-
const X = (G =
|
|
580
|
+
const X = (G = C.onTimeout) != null ? G : "skip";
|
|
579
581
|
if (X === "hint" && !ot) {
|
|
580
582
|
ot = !0, (Pe = n == null ? void 0 : n.nudge) == null || Pe.call(n, "请先点击高亮的锚点区域"), $e();
|
|
581
583
|
return;
|
|
@@ -584,8 +586,8 @@ function Pr(t = {}) {
|
|
|
584
586
|
L("error");
|
|
585
587
|
return;
|
|
586
588
|
}
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
+
z();
|
|
590
|
+
}, T);
|
|
589
591
|
};
|
|
590
592
|
for (const X of P)
|
|
591
593
|
for (const G of H) X.addEventListener(G, yt);
|
|
@@ -594,8 +596,8 @@ function Pr(t = {}) {
|
|
|
594
596
|
function A(d) {
|
|
595
597
|
var H;
|
|
596
598
|
if (!a || !l) return;
|
|
597
|
-
if (
|
|
598
|
-
|
|
599
|
+
if (m += 1, m > u) {
|
|
600
|
+
p(new Error(`步骤切换次数超过 ${u},疑似分支互相跳转`)), L("error");
|
|
599
601
|
return;
|
|
600
602
|
}
|
|
601
603
|
const w = a.steps;
|
|
@@ -604,11 +606,11 @@ function Pr(t = {}) {
|
|
|
604
606
|
return;
|
|
605
607
|
}
|
|
606
608
|
_(), s = d;
|
|
607
|
-
const b = w[d],
|
|
609
|
+
const b = w[d], C = (P) => {
|
|
608
610
|
var wt, it;
|
|
609
611
|
const j = (wt = b.onMiss) != null ? wt : "skip";
|
|
610
612
|
if (!P.element && b.target) {
|
|
611
|
-
if (
|
|
613
|
+
if (M(P, "全部候选落空"), j === "abort" || t.continueOnMiss === !1) {
|
|
612
614
|
L("error");
|
|
613
615
|
return;
|
|
614
616
|
}
|
|
@@ -618,7 +620,7 @@ function Pr(t = {}) {
|
|
|
618
620
|
return;
|
|
619
621
|
}
|
|
620
622
|
}
|
|
621
|
-
if (P.element && P.hitLevel >= 0 && N(P), $("started"),
|
|
623
|
+
if (P.element && P.hitLevel >= 0 && N(P), $("started"), k({ type: "step", state: x(), resolved: P }), k({ type: "change", state: x() }), !n) return;
|
|
622
624
|
n.mount();
|
|
623
625
|
const ot = {
|
|
624
626
|
index: d,
|
|
@@ -628,34 +630,34 @@ function Pr(t = {}) {
|
|
|
628
630
|
theme: a == null ? void 0 : a.theme,
|
|
629
631
|
onNext: F,
|
|
630
632
|
onPrev: U,
|
|
631
|
-
onSkip:
|
|
633
|
+
onSkip: z,
|
|
632
634
|
onClose: () => L("closed")
|
|
633
635
|
};
|
|
634
|
-
n.show(P, ot),
|
|
636
|
+
n.show(P, ot), E(b, P);
|
|
635
637
|
};
|
|
636
638
|
if (!b.target) {
|
|
637
|
-
|
|
639
|
+
C({ step: b, element: null, hitLevel: -2, triedSelectors: [] });
|
|
638
640
|
return;
|
|
639
641
|
}
|
|
640
|
-
const
|
|
641
|
-
Ir(b.target, { root: t.root, timeoutMs:
|
|
642
|
+
const T = (H = t.waitForElementMs) != null ? H : Tr;
|
|
643
|
+
Ir(b.target, { root: t.root, timeoutMs: T, onDebug: g }).then(
|
|
642
644
|
(P) => {
|
|
643
|
-
!l || (a == null ? void 0 : a.steps[s]) !== b ||
|
|
645
|
+
!l || (a == null ? void 0 : a.steps[s]) !== b || C({
|
|
644
646
|
step: b,
|
|
645
647
|
element: P.element,
|
|
646
648
|
hitLevel: P.hitLevel,
|
|
647
649
|
triedSelectors: P.triedSelectors
|
|
648
650
|
});
|
|
649
651
|
},
|
|
650
|
-
(P) =>
|
|
652
|
+
(P) => p(P)
|
|
651
653
|
);
|
|
652
654
|
}
|
|
653
655
|
function F() {
|
|
654
656
|
if (!l || !a) return;
|
|
655
|
-
const d = a.steps[s], w = d ? gr(d.next,
|
|
657
|
+
const d = a.steps[s], w = d ? gr(d.next, f) : null;
|
|
656
658
|
if (w) {
|
|
657
659
|
if (w.flowKey) {
|
|
658
|
-
|
|
660
|
+
v = {
|
|
659
661
|
flowKey: w.flowKey,
|
|
660
662
|
...w.route ? { route: w.route } : {},
|
|
661
663
|
...w.carryState === !0 ? { carryState: !0 } : {}
|
|
@@ -663,7 +665,7 @@ function Pr(t = {}) {
|
|
|
663
665
|
return;
|
|
664
666
|
}
|
|
665
667
|
if (w.stepId) {
|
|
666
|
-
const b = a.steps.findIndex((
|
|
668
|
+
const b = a.steps.findIndex((C) => C.id === w.stepId);
|
|
667
669
|
if (b >= 0) {
|
|
668
670
|
g(`分支命中:跳到步骤 ${w.stepId}`), A(b);
|
|
669
671
|
return;
|
|
@@ -683,7 +685,7 @@ function Pr(t = {}) {
|
|
|
683
685
|
function U() {
|
|
684
686
|
l && (s <= 0 || A(s - 1));
|
|
685
687
|
}
|
|
686
|
-
function
|
|
688
|
+
function z() {
|
|
687
689
|
if (!(!l || !a)) {
|
|
688
690
|
if (s >= a.steps.length - 1) {
|
|
689
691
|
L("skipped");
|
|
@@ -693,27 +695,27 @@ function Pr(t = {}) {
|
|
|
693
695
|
}
|
|
694
696
|
}
|
|
695
697
|
function Y(d) {
|
|
696
|
-
return !d.steps || d.steps.length === 0 ? (
|
|
698
|
+
return !d.steps || d.steps.length === 0 ? (p(new Error(`引导流程 ${d.key} 没有步骤`)), !1) : (a = d, s = 0, l = !0, v = null, m = 0, k({ type: "change", state: x() }), A(0), !0);
|
|
697
699
|
}
|
|
698
700
|
async function pt() {
|
|
699
701
|
var w;
|
|
700
702
|
if (l) return !1;
|
|
701
703
|
const d = i.read();
|
|
702
|
-
return !d || !Xt(d.route, y()) ? !1 : (i.clear(), g(`续播 ${d.flowKey}(便签来源路由 ${(w = d.route) != null ? w : "任意页"})`),
|
|
704
|
+
return !d || !Xt(d.route, y()) ? !1 : (i.clear(), g(`续播 ${d.flowKey}(便签来源路由 ${(w = d.route) != null ? w : "任意页"})`), R(d.flowKey));
|
|
703
705
|
}
|
|
704
706
|
let Z = null;
|
|
705
707
|
return t.autoResume !== !1 && t.router && (Z = t.router.onChange((d) => {
|
|
706
708
|
if (l) return;
|
|
707
709
|
const w = i.read();
|
|
708
|
-
!w || !Xt(w.route, d) || (g(`路由切换至 ${d},自动续播 ${w.flowKey}`), i.clear(),
|
|
710
|
+
!w || !Xt(w.route, d) || (g(`路由切换至 ${d},自动续播 ${w.flowKey}`), i.clear(), R(w.flowKey));
|
|
709
711
|
})), {
|
|
710
712
|
async start(d) {
|
|
711
713
|
const w = d != null ? d : a == null ? void 0 : a.key;
|
|
712
|
-
return w ?
|
|
714
|
+
return w ? R(w) : await pt() ? !0 : (p(new Error("start() 需要 flowKey 参数;续播请调用 resume()")), !1);
|
|
713
715
|
},
|
|
714
716
|
async startOnce(d) {
|
|
715
717
|
const w = d != null ? d : a == null ? void 0 : a.key;
|
|
716
|
-
return w ? await
|
|
718
|
+
return w ? await W(w) ? (g(`跳过 ${w}:本设备已看过(如需重看,先调用 resetProgress('${w}'))`), !1) : R(w) : (p(new Error("startOnce() 需要 flowKey 参数")), !1);
|
|
717
719
|
},
|
|
718
720
|
resume: pt,
|
|
719
721
|
pending() {
|
|
@@ -724,7 +726,7 @@ function Pr(t = {}) {
|
|
|
724
726
|
},
|
|
725
727
|
next: F,
|
|
726
728
|
prev: U,
|
|
727
|
-
skipStep:
|
|
729
|
+
skipStep: z,
|
|
728
730
|
skip() {
|
|
729
731
|
l && L("skipped");
|
|
730
732
|
},
|
|
@@ -741,14 +743,14 @@ function Pr(t = {}) {
|
|
|
741
743
|
const d = e.getProgress(a.key);
|
|
742
744
|
return d instanceof Promise ? null : d;
|
|
743
745
|
} catch (d) {
|
|
744
|
-
return
|
|
746
|
+
return p(d), null;
|
|
745
747
|
}
|
|
746
748
|
},
|
|
747
749
|
setContext(d) {
|
|
748
|
-
|
|
750
|
+
f = { ...f, ...d };
|
|
749
751
|
},
|
|
750
752
|
getContext() {
|
|
751
|
-
return { ...
|
|
753
|
+
return { ...f };
|
|
752
754
|
},
|
|
753
755
|
resetProgress(d) {
|
|
754
756
|
var b;
|
|
@@ -762,12 +764,12 @@ function Pr(t = {}) {
|
|
|
762
764
|
status: "started",
|
|
763
765
|
updatedAt: Date.now()
|
|
764
766
|
});
|
|
765
|
-
} catch (
|
|
766
|
-
|
|
767
|
+
} catch (C) {
|
|
768
|
+
p(C);
|
|
767
769
|
}
|
|
768
770
|
},
|
|
769
|
-
on:
|
|
770
|
-
off:
|
|
771
|
+
on: B,
|
|
772
|
+
off: I
|
|
771
773
|
};
|
|
772
774
|
}
|
|
773
775
|
function on(t, e, n) {
|
|
@@ -888,7 +890,7 @@ function Nt(t) {
|
|
|
888
890
|
function re(t, e = {}) {
|
|
889
891
|
t.config = { animate: !0, duration: 400, allowClose: !0, allowScroll: !0, overlayClickBehavior: "close", overlayOpacity: 0.7, smoothScroll: !1, disableActiveInteraction: !1, advanceOnClick: !1, skipMissingElement: !1, waitForElement: 0, showProgress: !1, stagePadding: 10, stageRadius: 5, popoverOffset: 10, showButtons: ["next", "previous", "close"], disableButtons: [], overlayColor: "#000", ...e };
|
|
890
892
|
}
|
|
891
|
-
function
|
|
893
|
+
function K(t, e, n) {
|
|
892
894
|
let r = e || t.state;
|
|
893
895
|
return { config: t.config, state: r, driver: t.driver, index: r.activeIndex, ...n ? { reason: n } : {} };
|
|
894
896
|
}
|
|
@@ -987,10 +989,10 @@ function kt(t) {
|
|
|
987
989
|
for (let s = Ke(t); s && !(s === document.body || s === document.documentElement); s = Ke(s)) {
|
|
988
990
|
let l = getComputedStyle(s);
|
|
989
991
|
if (!Yr(l, i)) continue;
|
|
990
|
-
let c = Jr(l),
|
|
991
|
-
if (
|
|
992
|
-
let
|
|
993
|
-
|
|
992
|
+
let c = Jr(l), f = (l.overflow || "").split(" "), v = c || Lt(l.overflowX) || Lt(f[0]), m = c || Lt(l.overflowY) || Lt((a = f[1]) != null ? a : f[0]);
|
|
993
|
+
if (v || m) {
|
|
994
|
+
let u = s.getBoundingClientRect(), y = u.left + s.clientLeft, h = u.top + s.clientTop, g = y + (s.clientWidth || u.width), k = h + (s.clientHeight || u.height);
|
|
995
|
+
v && (e = At(e, y, g), r = At(r, y, g)), m && (n = At(n, h, k), o = At(o, h, k));
|
|
994
996
|
}
|
|
995
997
|
if (Gr(s, ":modal, :popover-open")) break;
|
|
996
998
|
i = l.position;
|
|
@@ -1050,14 +1052,14 @@ function He(t, e, n, r, o, i, a) {
|
|
|
1050
1052
|
}
|
|
1051
1053
|
function Vt(t, e, n) {
|
|
1052
1054
|
var U;
|
|
1053
|
-
let { align: r, side: o } = n, i = n.centered ? "over" : o, a = n.padding, { style: s, classList: l } = t.wrapper, { width: c, height:
|
|
1054
|
-
i === "top" && g ? x =
|
|
1055
|
-
let
|
|
1056
|
-
s[
|
|
1057
|
-
},
|
|
1058
|
-
i === "over" ? (
|
|
1055
|
+
let { align: r, side: o } = n, i = n.centered ? "over" : o, a = n.padding, { style: s, classList: l } = t.wrapper, { width: c, height: f } = t.wrapper.getBoundingClientRect(), v = c + n.offset, m = f + n.offset, u = t.arrow.getBoundingClientRect(), y = kt(e), h = y.top - m, g = h >= 0, k = window.innerHeight - (y.bottom + m), B = k >= 0, I = y.left - v, D = I >= 0, p = window.innerWidth - (y.right + v), x = p >= 0, _ = u.width, $ = () => He(r, y.top, y.height, f, window.innerHeight, a, _), M = () => He(r, y.left, y.width, c, window.innerWidth, a, _), N = !g && !B && !D && !x, L = i;
|
|
1056
|
+
i === "top" && g ? x = D = B = !1 : i === "bottom" && B ? x = D = g = !1 : i === "left" && D ? x = g = B = !1 : i === "right" && x && (D = g = B = !1);
|
|
1057
|
+
let S = (z, Y) => {
|
|
1058
|
+
s[z] = Y === void 0 ? "auto" : `${Y}px`;
|
|
1059
|
+
}, W = window.innerWidth / 2 - c / 2, R = window.innerWidth - c - _, E = window.innerHeight - f - _;
|
|
1060
|
+
i === "over" ? (S("left", W), S("right"), S("top", window.innerHeight / 2 - f / 2), S("bottom")) : N ? (S("left", W), S("right"), S("bottom", 10), S("top")) : D ? (S("left", Math.min(I, R)), S("top", $()), S("bottom"), S("right"), L = "left") : x ? (S("right", Math.min(p, R)), S("top", $()), S("bottom"), S("left"), L = "right") : g ? (S("top", Math.min(h, E)), S("left", M()), S("bottom"), S("right"), L = "top") : B && (S("left", M()), S("bottom", Math.min(k, E)), S("top"), S("right"), L = "bottom"), ro(t, N ? "over" : L, r, y);
|
|
1059
1061
|
let A = `driver-popover-side-${L}`, F = `driver-popover-align-${r}`;
|
|
1060
|
-
[...l].filter((
|
|
1062
|
+
[...l].filter((z) => z.startsWith("driver-popover-side-") || z.startsWith("driver-popover-align-")).filter((z) => z !== A && z !== F).forEach((z) => l.remove(z)), l.contains(A) || l.add(A), l.contains(F) || l.add(F), (U = n.onPositioned) == null || U.call(n);
|
|
1061
1063
|
}
|
|
1062
1064
|
function qe(t, e, n, r, o, i = 10) {
|
|
1063
1065
|
let a = r - n;
|
|
@@ -1134,12 +1136,12 @@ function lo(t, e) {
|
|
|
1134
1136
|
function Sn(t, e) {
|
|
1135
1137
|
let { title: n, description: r, showButtons: o, disableButtons: i, showProgress: a, nextBtnText: s, prevBtnText: l, progressText: c } = e;
|
|
1136
1138
|
et(t.nextButton, s), et(t.previousButton, l), et(t.progress, c), t.closeButton.setAttribute("aria-label", e.closeBtnLabel), t.nextButton.classList.toggle("driver-popover-done-btn", !!e.doneButton), n && et(t.title, n), J(t.title, !!n), r && et(t.description, r), J(t.description, !!r);
|
|
1137
|
-
let
|
|
1138
|
-
J(t.closeButton, o.includes("close")), J(t.footer,
|
|
1139
|
-
let
|
|
1140
|
-
|
|
1141
|
-
let
|
|
1142
|
-
|
|
1139
|
+
let f = o.includes("next") || o.includes("previous") || a;
|
|
1140
|
+
J(t.closeButton, o.includes("close")), J(t.footer, f), J(t.progress, a), J(t.nextButton, o.includes("next")), J(t.previousButton, o.includes("previous")), xt(t.nextButton, i.includes("next")), xt(t.previousButton, i.includes("previous")), xt(t.closeButton, i.includes("close")), ao(t, e), lo(t, e);
|
|
1141
|
+
let v = t.wrapper;
|
|
1142
|
+
v.classList.remove(...je.get(v) || []);
|
|
1143
|
+
let m = (e.popoverClass || "").split(/\s+/).filter(Boolean);
|
|
1144
|
+
v.classList.add(...m), je.set(v, m);
|
|
1143
1145
|
}
|
|
1144
1146
|
function co(t, e) {
|
|
1145
1147
|
var n;
|
|
@@ -1157,12 +1159,12 @@ function fo(t, e) {
|
|
|
1157
1159
|
ge(t).appendChild(n.wrapper);
|
|
1158
1160
|
let r = n.wrapper;
|
|
1159
1161
|
return r.className = "driver-popover", Sn(n, e), r.style.display = "block", r.style.left = "", r.style.top = "", r.style.bottom = "", r.style.right = "", r.id = "driver-popover-content", r.setAttribute("role", "dialog"), r.setAttribute("aria-labelledby", "driver-popover-title"), n.arrow.className = "driver-popover-arrow", pn(n.wrapper, (i) => {
|
|
1160
|
-
var s, l, c,
|
|
1162
|
+
var s, l, c, f;
|
|
1161
1163
|
let a = i.target instanceof Element ? i.target : (s = i.target) == null ? void 0 : s.parentElement;
|
|
1162
1164
|
if (a) {
|
|
1163
1165
|
if (a.closest(".driver-popover-next-btn")) return (l = e.onNextClick) == null ? void 0 : l.call(e);
|
|
1164
1166
|
if (a.closest(".driver-popover-prev-btn")) return (c = e.onPrevClick) == null ? void 0 : c.call(e);
|
|
1165
|
-
if (a.closest(".driver-popover-close-btn")) return (
|
|
1167
|
+
if (a.closest(".driver-popover-close-btn")) return (f = e.onCloseClick) == null ? void 0 : f.call(e);
|
|
1166
1168
|
}
|
|
1167
1169
|
}, (i) => n.description.contains(i) || n.title.contains(i) ? !1 : !!i.closest(".driver-popover-prev-btn, .driver-popover-next-btn, .driver-popover-close-btn")), (o = e.onRender) == null || o.call(e, n), Vt(n, t, e.position), Cn(n, t, e.position), e.scrollIntoView !== !1 && hn(r, e.smoothScroll, { block: "nearest", inline: "nearest" }), e.keepFocus || po(n), n;
|
|
1168
1170
|
}
|
|
@@ -1227,17 +1229,17 @@ function Ye(t, e, n) {
|
|
|
1227
1229
|
return e > t.x && e < t.x + t.width && n > t.y && n < t.y + t.height;
|
|
1228
1230
|
}
|
|
1229
1231
|
function ho(t, e) {
|
|
1230
|
-
let n = (l, c) => e.some((
|
|
1232
|
+
let n = (l, c) => e.some((f) => Ye(f, l, c)), r = (l, c) => [...new Set([t, ...e].flatMap((f) => [f[l], f[l] + f[c]]))].sort((f, v) => f - v), o = r("x", "width"), i = r("y", "height"), a = "";
|
|
1231
1233
|
o.forEach((l, c) => {
|
|
1232
|
-
i.forEach((
|
|
1233
|
-
let
|
|
1234
|
-
n(y, h) && !Ye(t, y, h) && (a += `M${l},${
|
|
1234
|
+
i.forEach((f, v) => {
|
|
1235
|
+
let m = o[c + 1] - l, u = i[v + 1] - f, y = l + m / 2, h = f + u / 2;
|
|
1236
|
+
n(y, h) && !Ye(t, y, h) && (a += `M${l},${f}h${m}v${u}h-${m}z`);
|
|
1235
1237
|
});
|
|
1236
1238
|
});
|
|
1237
1239
|
let s = t.radius;
|
|
1238
1240
|
for (let l of [0, 1]) for (let c of [0, 1]) {
|
|
1239
|
-
let
|
|
1240
|
-
s && n(
|
|
1241
|
+
let f = t.x + l * t.width, v = t.y + c * t.height, m = l ? -s : s, u = c ? -s : s;
|
|
1242
|
+
s && n(f + m / 2, v + u / 2) && (a += `M${f},${v}h${m}a${s},${s} 0 0 ${l ^ c} ${-m},${u}z`);
|
|
1241
1243
|
}
|
|
1242
1244
|
return a;
|
|
1243
1245
|
}
|
|
@@ -1306,28 +1308,28 @@ function Eo(t, e, n) {
|
|
|
1306
1308
|
if (!r) return;
|
|
1307
1309
|
let o = /* @__PURE__ */ new Set(), i, a = () => {
|
|
1308
1310
|
if (n.aborted) return;
|
|
1309
|
-
let
|
|
1310
|
-
o.forEach((
|
|
1311
|
-
!
|
|
1312
|
-
}),
|
|
1313
|
-
|
|
1314
|
-
}), o =
|
|
1315
|
-
let
|
|
1316
|
-
|
|
1311
|
+
let f = new Set(Tn(r));
|
|
1312
|
+
o.forEach((u) => {
|
|
1313
|
+
!f.has(u) && u.classList.contains("driver-allowed-element") && u.classList.remove(ct);
|
|
1314
|
+
}), f.forEach((u) => {
|
|
1315
|
+
u.classList.contains("driver-allowed-element") || u.classList.add(ct);
|
|
1316
|
+
}), o = f;
|
|
1317
|
+
let v = t.state.activeElement, m = !!v && !V(v) && Ot(v);
|
|
1318
|
+
v && m !== v.classList.contains("driver-active-element-raised") && (v.classList.toggle(Rt, m), Qe(t, !0));
|
|
1317
1319
|
}, s = () => {
|
|
1318
1320
|
i === void 0 && (i = window.requestAnimationFrame(() => {
|
|
1319
1321
|
i = void 0, a(), Qe(t);
|
|
1320
1322
|
}));
|
|
1321
|
-
}, l = new MutationObserver((
|
|
1322
|
-
let
|
|
1323
|
-
|
|
1323
|
+
}, l = new MutationObserver((f) => {
|
|
1324
|
+
let v = !1;
|
|
1325
|
+
f.forEach((m) => {
|
|
1324
1326
|
var y;
|
|
1325
|
-
let
|
|
1326
|
-
(y =
|
|
1327
|
-
}),
|
|
1328
|
-
}), c = typeof r == "function" || [r].flat().some((
|
|
1327
|
+
let u = m.target;
|
|
1328
|
+
(y = u.closest) != null && y.call(u, ".driver-layer, .driver-overlay, .driver-popover") || (v = !0, m.attributeName === "class" && o.has(u) && !u.classList.contains("driver-allowed-element") && u.classList.add(ct));
|
|
1329
|
+
}), v && s();
|
|
1330
|
+
}), c = typeof r == "function" || [r].flat().some((f) => typeof f == "string");
|
|
1329
1331
|
a(), l.observe(document.body, { childList: !0, subtree: !0, attributes: !0, ...c ? {} : { attributeFilter: ["class"] } }), t.state.__syncAllowedElements = a, n.addEventListener("abort", () => {
|
|
1330
|
-
l.disconnect(), i !== void 0 && window.cancelAnimationFrame(i), o.forEach((
|
|
1332
|
+
l.disconnect(), i !== void 0 && window.cancelAnimationFrame(i), o.forEach((f) => f.classList.remove(ct)), t.state.__syncAllowedElements === a && (t.state.__syncAllowedElements = void 0);
|
|
1331
1333
|
});
|
|
1332
1334
|
}
|
|
1333
1335
|
function Pn(t, e, n) {
|
|
@@ -1382,9 +1384,9 @@ function $o(t, e) {
|
|
|
1382
1384
|
return { index: e, hasNext: Wt(t, e + 1, 1) !== void 0, hasPrevious: Wt(t, e - 1, -1) !== void 0 };
|
|
1383
1385
|
}
|
|
1384
1386
|
function _e(t, e = {}, n) {
|
|
1385
|
-
var s, l, c,
|
|
1386
|
-
let r = t.config, o = e.showButtons || r.showButtons, i = r.progressText || "{{current}} of {{total}}", a = { showProgress: (l = (s = e.showProgress) != null ? s : r.showProgress) != null ? l : !1, prevBtnText: (c = e.prevBtnText) != null ? c : r.prevBtnText || "Previous", closeBtnLabel: (
|
|
1387
|
-
return n ? { ...a, showButtons: Ao.filter((y) => (y !== "close" || r.allowClose) && (!o || o.includes(y))), disableButtons: [...r.disableButtons || [], ...n.hasPrevious ? [] : ["previous"]], progressText: On(t, e.progressText || i, n.index), nextBtnText: n.hasNext ? (
|
|
1387
|
+
var s, l, c, f, v, m, u;
|
|
1388
|
+
let r = t.config, o = e.showButtons || r.showButtons, i = r.progressText || "{{current}} of {{total}}", a = { showProgress: (l = (s = e.showProgress) != null ? s : r.showProgress) != null ? l : !1, prevBtnText: (c = e.prevBtnText) != null ? c : r.prevBtnText || "Previous", closeBtnLabel: (f = e.closeBtnLabel) != null ? f : r.closeBtnLabel || "Close", popoverClass: e.popoverClass || r.popoverClass || "" };
|
|
1389
|
+
return n ? { ...a, showButtons: Ao.filter((y) => (y !== "close" || r.allowClose) && (!o || o.includes(y))), disableButtons: [...r.disableButtons || [], ...n.hasPrevious ? [] : ["previous"]], progressText: On(t, e.progressText || i, n.index), nextBtnText: n.hasNext ? (v = e.nextBtnText) != null ? v : r.nextBtnText || "Next" : e.doneBtnText || r.doneBtnText || "Done" } : { ...a, showButtons: o || [], disableButtons: e.disableButtons || r.disableButtons || [], progressText: (m = e.progressText) != null ? m : i, nextBtnText: (u = e.nextBtnText) != null ? u : r.nextBtnText || "Next" };
|
|
1388
1390
|
}
|
|
1389
1391
|
function Ft(t, e) {
|
|
1390
1392
|
let n = (t.config.steps || [])[e], r = n.popover || {}, o = $o(t, e), i = _e(t, r, o);
|
|
@@ -1407,7 +1409,7 @@ function Wn(t, e, n) {
|
|
|
1407
1409
|
return { side: ((o = n.popover) == null ? void 0 : o.side) || "bottom", align: ((i = n.popover) == null ? void 0 : i.align) || "start", offset: r + (t.config.popoverOffset || 0), padding: r, centered: V(e), onPositioned: () => {
|
|
1408
1410
|
var s;
|
|
1409
1411
|
let a = ((s = n.popover) == null ? void 0 : s.onPopoverPositioned) || t.config.onPopoverPositioned;
|
|
1410
|
-
a && t.state.popover && a(t.state.popover,
|
|
1412
|
+
a && t.state.popover && a(t.state.popover, K(t));
|
|
1411
1413
|
} };
|
|
1412
1414
|
}
|
|
1413
1415
|
function Mo(t, e) {
|
|
@@ -1429,10 +1431,10 @@ function zn(t, e, n) {
|
|
|
1429
1431
|
var l;
|
|
1430
1432
|
t.state.__destroyReason = "close";
|
|
1431
1433
|
let s = Rn(t, n);
|
|
1432
|
-
return s ? s((l = t.state.activeElement) != null ? l : e, n,
|
|
1434
|
+
return s ? s((l = t.state.activeElement) != null ? l : e, n, K(t)) : t.tour.requestClose();
|
|
1433
1435
|
}, onRender: (s) => {
|
|
1434
1436
|
var l;
|
|
1435
|
-
t.state.popover = s, (l = r.onPopoverRender || t.config.onPopoverRender) == null || l(s,
|
|
1437
|
+
t.state.popover = s, (l = r.onPopoverRender || t.config.onPopoverRender) == null || l(s, K(t));
|
|
1436
1438
|
}, position: Wn(t, e, n) };
|
|
1437
1439
|
}
|
|
1438
1440
|
function Hn(t, e, n) {
|
|
@@ -1498,7 +1500,7 @@ function Xn(t, e, n, r) {
|
|
|
1498
1500
|
if (!i || !(o != null && o.wait)) return;
|
|
1499
1501
|
(s = o.waitController) == null || s.abort();
|
|
1500
1502
|
let a = new AbortController();
|
|
1501
|
-
o.waitController = a, i(r, e, { ...
|
|
1503
|
+
o.waitController = a, i(r, e, { ...K(t), index: n, signal: a.signal });
|
|
1502
1504
|
}
|
|
1503
1505
|
function le(t) {
|
|
1504
1506
|
let e = Ut(t);
|
|
@@ -1506,14 +1508,14 @@ function le(t) {
|
|
|
1506
1508
|
}
|
|
1507
1509
|
function Bo(t, e, n, r) {
|
|
1508
1510
|
let o = t.state.__activation, i, a = () => {
|
|
1509
|
-
c.disconnect(), window.clearTimeout(
|
|
1510
|
-
}, s = (
|
|
1511
|
-
a(), ee(t), r(
|
|
1511
|
+
c.disconnect(), window.clearTimeout(f), i !== void 0 && window.cancelAnimationFrame(i);
|
|
1512
|
+
}, s = (v) => {
|
|
1513
|
+
a(), ee(t), r(v), o && ne(t, o);
|
|
1512
1514
|
}, l = () => {
|
|
1513
1515
|
i = void 0, dt(e.element) && s(!0);
|
|
1514
1516
|
}, c = new MutationObserver(() => {
|
|
1515
1517
|
i != null || (i = window.requestAnimationFrame(l));
|
|
1516
|
-
}),
|
|
1518
|
+
}), f = xn(n) ? void 0 : window.setTimeout(() => s(!1), n);
|
|
1517
1519
|
ee(t, a), c.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0 });
|
|
1518
1520
|
}
|
|
1519
1521
|
function No(t, e) {
|
|
@@ -1524,7 +1526,7 @@ function No(t, e) {
|
|
|
1524
1526
|
}
|
|
1525
1527
|
let i = t.state.__activation;
|
|
1526
1528
|
if (le(t), typeof r == "string") return;
|
|
1527
|
-
let a = r(void 0, n, { ...
|
|
1529
|
+
let a = r(void 0, n, { ...K(t), index: e, cause: "timeout" }), s = !t.state.isInitialized || !ut(t, i) || pe(t);
|
|
1528
1530
|
a === !1 || s || t.tour.drive(e, !0);
|
|
1529
1531
|
}
|
|
1530
1532
|
function ce(t, e) {
|
|
@@ -1548,46 +1550,46 @@ function Ro(t, e) {
|
|
|
1548
1550
|
function Oo(t, e) {
|
|
1549
1551
|
let { step: n } = e, { signal: r } = e.controller;
|
|
1550
1552
|
if (!n.element) return;
|
|
1551
|
-
let o, i, a = !1, s = (
|
|
1552
|
-
window.clearTimeout(i), i = void 0, a = !1, t.ui.rebind(t,
|
|
1553
|
+
let o, i, a = !1, s = (u) => {
|
|
1554
|
+
window.clearTimeout(i), i = void 0, a = !1, t.ui.rebind(t, u), ln(t, e) || le(t);
|
|
1553
1555
|
}, l = () => {
|
|
1554
|
-
let
|
|
1555
|
-
if (!
|
|
1556
|
+
let u = dt(n.element);
|
|
1557
|
+
if (!u || !u.isConnected) return !1;
|
|
1556
1558
|
let y = t.state.activeElement;
|
|
1557
|
-
s(
|
|
1559
|
+
s(u);
|
|
1558
1560
|
let h = O(t, n, "onElementReplaced");
|
|
1559
|
-
return h &&
|
|
1560
|
-
}, c = (
|
|
1561
|
+
return h && u !== y && h(u, n, { ...K(t), signal: r }), !0;
|
|
1562
|
+
}, c = (u) => {
|
|
1561
1563
|
a = !0, le(t);
|
|
1562
1564
|
let y = ce(t, n);
|
|
1563
1565
|
if (typeof y == "function") {
|
|
1564
|
-
y(
|
|
1566
|
+
y(u, n, { ...K(t), cause: "removed" });
|
|
1565
1567
|
return;
|
|
1566
1568
|
}
|
|
1567
1569
|
y !== "stay" && Ro(t, y);
|
|
1568
|
-
},
|
|
1570
|
+
}, f = () => {
|
|
1569
1571
|
var h, g;
|
|
1570
1572
|
o = void 0;
|
|
1571
|
-
let
|
|
1572
|
-
if (r.aborted || !
|
|
1573
|
-
if (
|
|
1574
|
-
(a || i !== void 0) && s(
|
|
1573
|
+
let u = t.state.activeElement;
|
|
1574
|
+
if (r.aborted || !u || V(u)) return;
|
|
1575
|
+
if (u.isConnected) {
|
|
1576
|
+
(a || i !== void 0) && s(u);
|
|
1575
1577
|
return;
|
|
1576
1578
|
}
|
|
1577
1579
|
if (We(t, e) || l() || a || i || ce(t, n) === "stay") return;
|
|
1578
1580
|
let y = (g = (h = O(t, n, "waitForRemovedElement")) != null ? h : O(t, n, "waitForElement")) != null ? g : 0;
|
|
1579
1581
|
if (y <= 0) {
|
|
1580
|
-
c(
|
|
1582
|
+
c(u);
|
|
1581
1583
|
return;
|
|
1582
1584
|
}
|
|
1583
1585
|
Kt(t, "missing"), i = xn(y) ? -1 : window.setTimeout(() => {
|
|
1584
|
-
i = void 0, !(r.aborted || We(t, e) || l()) && c(
|
|
1585
|
-
}, y), Xn(t, n, t.state.activeIndex,
|
|
1586
|
-
},
|
|
1587
|
-
o === void 0 && (o = window.requestAnimationFrame(
|
|
1588
|
-
},
|
|
1589
|
-
|
|
1590
|
-
|
|
1586
|
+
i = void 0, !(r.aborted || We(t, e) || l()) && c(u);
|
|
1587
|
+
}, y), Xn(t, n, t.state.activeIndex, u);
|
|
1588
|
+
}, v = () => {
|
|
1589
|
+
o === void 0 && (o = window.requestAnimationFrame(f));
|
|
1590
|
+
}, m = new MutationObserver(v);
|
|
1591
|
+
m.observe(document.documentElement, { childList: !0, subtree: !0 }), e.recheck = v, r.addEventListener("abort", () => {
|
|
1592
|
+
m.disconnect(), window.clearTimeout(i), o !== void 0 && window.cancelAnimationFrame(o);
|
|
1591
1593
|
});
|
|
1592
1594
|
}
|
|
1593
1595
|
function Do(t, e) {
|
|
@@ -1597,81 +1599,81 @@ function Do(t, e) {
|
|
|
1597
1599
|
}
|
|
1598
1600
|
function Wo(t, e, n, r) {
|
|
1599
1601
|
let { signal: o } = n.controller, { types: i, when: a } = me(e), s = () => zr(t, n.step) && qt(t), l = (h) => {
|
|
1600
|
-
let g = t.state.__advanceClick,
|
|
1601
|
-
return !g ||
|
|
1602
|
-
}, c = (h) => s() || l(h),
|
|
1602
|
+
let g = t.state.__advanceClick, k = h;
|
|
1603
|
+
return !g || k.detail < 2 || k.timeStamp - g.timeStamp > 500 ? !1 : Math.abs(k.clientX - g.clientX) < 8 && Math.abs(k.clientY - g.clientY) < 8;
|
|
1604
|
+
}, c = (h) => s() || l(h), f = (h) => {
|
|
1603
1605
|
if (!a) return !0;
|
|
1604
1606
|
let g = t.state.activeElement;
|
|
1605
|
-
return !!g && a(g, n.step, { ...
|
|
1606
|
-
},
|
|
1607
|
+
return !!g && a(g, n.step, { ...K(t), event: h });
|
|
1608
|
+
}, v, m, u = (h) => {
|
|
1607
1609
|
var g;
|
|
1608
|
-
|
|
1610
|
+
v === h && (window.clearTimeout(m), v = void 0, m = void 0, De(n, !1), !o.aborted && (!t.consumed.has(h) && f(h) && (Nt(h.type) && (t.state.__advanceClick = h), r()), (g = n.recheck) == null || g.call(n)));
|
|
1609
1611
|
}, y = (h) => {
|
|
1610
|
-
Do(h, t.state.activeElement) && (Nt(h.type) && c(h) || (
|
|
1612
|
+
Do(h, t.state.activeElement) && (Nt(h.type) && c(h) || (v = h, De(n, !0), window.clearTimeout(m), m = window.setTimeout(() => u(h), 0)));
|
|
1611
1613
|
};
|
|
1612
|
-
for (let h of i) window.addEventListener(h, y, { capture: !0, signal: o }), window.addEventListener(h,
|
|
1613
|
-
o.addEventListener("abort", () => window.clearTimeout(
|
|
1614
|
+
for (let h of i) window.addEventListener(h, y, { capture: !0, signal: o }), window.addEventListener(h, u, { signal: o });
|
|
1615
|
+
o.addEventListener("abort", () => window.clearTimeout(m));
|
|
1614
1616
|
}
|
|
1615
1617
|
let lt;
|
|
1616
1618
|
function Fo(t, e) {
|
|
1617
|
-
let n = Hr(t, e, { drive: g, next: o, moveNext: i, movePrevious: a, close: () =>
|
|
1619
|
+
let n = Hr(t, e, { drive: g, next: o, moveNext: i, movePrevious: a, close: () => I("close"), destroy: I, refreshPopover: y }), r = () => I("replaced", !1);
|
|
1618
1620
|
function o() {
|
|
1619
|
-
let { element:
|
|
1621
|
+
let { element: p, step: x } = Ut(n), _ = Lo(n, x);
|
|
1620
1622
|
if (!x || !_) {
|
|
1621
1623
|
jt(x) || i();
|
|
1622
1624
|
return;
|
|
1623
1625
|
}
|
|
1624
|
-
nt(n, 1) && (n.state.__destroyReason = "done"), _(
|
|
1626
|
+
nt(n, 1) && (n.state.__destroyReason = "done"), _(p, x, K(n));
|
|
1625
1627
|
}
|
|
1626
1628
|
function i() {
|
|
1627
|
-
let
|
|
1628
|
-
if (
|
|
1629
|
-
let _ =
|
|
1630
|
-
x[_] ? g(_) :
|
|
1629
|
+
let p = n.state.activeIndex, x = n.config.steps || [];
|
|
1630
|
+
if (p === void 0) return;
|
|
1631
|
+
let _ = p + 1;
|
|
1632
|
+
x[_] ? g(_) : I("done");
|
|
1631
1633
|
}
|
|
1632
1634
|
function a() {
|
|
1633
|
-
let
|
|
1634
|
-
if (
|
|
1635
|
-
let _ =
|
|
1636
|
-
x[_] ? g(_) :
|
|
1635
|
+
let p = n.state.activeIndex, x = n.config.steps || [];
|
|
1636
|
+
if (p === void 0) return;
|
|
1637
|
+
let _ = p - 1;
|
|
1638
|
+
x[_] ? g(_) : I("api");
|
|
1637
1639
|
}
|
|
1638
|
-
function s(
|
|
1639
|
-
if (!(n.config.steps || [])[
|
|
1640
|
-
|
|
1640
|
+
function s(p) {
|
|
1641
|
+
if (!(n.config.steps || [])[p]) {
|
|
1642
|
+
I("api");
|
|
1641
1643
|
return;
|
|
1642
1644
|
}
|
|
1643
|
-
h(), g(
|
|
1645
|
+
h(), g(p);
|
|
1644
1646
|
}
|
|
1645
1647
|
function l() {
|
|
1646
|
-
let
|
|
1647
|
-
!
|
|
1648
|
+
let p = n.state.__activation;
|
|
1649
|
+
!p || Et(n) || tn(n, p);
|
|
1648
1650
|
}
|
|
1649
1651
|
let c = /* @__PURE__ */ new WeakSet();
|
|
1650
|
-
function
|
|
1652
|
+
function f(p, x) {
|
|
1651
1653
|
var L;
|
|
1652
1654
|
let { types: _ } = me(x);
|
|
1653
|
-
if (!(e.blocksInteraction && O(n,
|
|
1654
|
-
let $ = n.state.activeIndex,
|
|
1655
|
-
if (c.has(
|
|
1656
|
-
c.add(
|
|
1655
|
+
if (!(e.blocksInteraction && O(n, p, "disableActiveInteraction")) || !_.length || !_.every(Nt)) return;
|
|
1656
|
+
let $ = n.state.activeIndex, M = $ !== void 0 && ((L = n.config.steps) == null ? void 0 : L[$]) || p;
|
|
1657
|
+
if (c.has(M)) return;
|
|
1658
|
+
c.add(M);
|
|
1657
1659
|
let N = $ === void 0 ? "The highlight" : `Step ${$ + 1}`;
|
|
1658
1660
|
console.warn(`[driver.js] ${N} can't complete: disableActiveInteraction blocks its advanceOn events.`);
|
|
1659
1661
|
}
|
|
1660
|
-
function
|
|
1661
|
-
if (!ut(n,
|
|
1662
|
-
let { step: x } =
|
|
1663
|
-
e.trackAllowed(n, x,
|
|
1662
|
+
function v(p) {
|
|
1663
|
+
if (!ut(n, p)) return;
|
|
1664
|
+
let { step: x } = p;
|
|
1665
|
+
e.trackAllowed(n, x, p.controller.signal), Oo(n, p);
|
|
1664
1666
|
let _ = un(n, x);
|
|
1665
|
-
|
|
1667
|
+
f(x, _), _ && Wo(n, _, p, () => tn(n, p));
|
|
1666
1668
|
}
|
|
1667
|
-
function p
|
|
1669
|
+
function m(p) {
|
|
1668
1670
|
let x = n.state.__activation;
|
|
1669
|
-
x && (x.popoverPatch =
|
|
1671
|
+
x && (x.popoverPatch = p ? { ...x.popoverPatch, ...p } : void 0, y());
|
|
1670
1672
|
}
|
|
1671
|
-
function
|
|
1673
|
+
function u(p) {
|
|
1672
1674
|
var _, $;
|
|
1673
1675
|
let x = n.state.__activation;
|
|
1674
|
-
!x || (x.feedback || "") ===
|
|
1676
|
+
!x || (x.feedback || "") === p || (x.feedback = p, y(), e.announce(n, (($ = (_ = n.state.popover) == null ? void 0 : _.feedback) == null ? void 0 : $.textContent) || ""));
|
|
1675
1677
|
}
|
|
1676
1678
|
function y() {
|
|
1677
1679
|
e.refreshPopover(n);
|
|
@@ -1679,75 +1681,75 @@ function Fo(t, e) {
|
|
|
1679
1681
|
function h() {
|
|
1680
1682
|
n.state.isInitialized || (lt && lt !== r && lt(), lt = r, n.state.isInitialized = !0, e.mount(n));
|
|
1681
1683
|
}
|
|
1682
|
-
function g(
|
|
1684
|
+
function g(p = 0, x = !1) {
|
|
1683
1685
|
var N, L;
|
|
1684
1686
|
Gt(n), n.state.__destroyReason = void 0;
|
|
1685
1687
|
let _ = n.config.steps;
|
|
1686
1688
|
if (!_) {
|
|
1687
|
-
console.error("No steps to drive through"),
|
|
1689
|
+
console.error("No steps to drive through"), I("api");
|
|
1688
1690
|
return;
|
|
1689
1691
|
}
|
|
1690
|
-
if (!_[
|
|
1691
|
-
|
|
1692
|
+
if (!_[p]) {
|
|
1693
|
+
I("api");
|
|
1692
1694
|
return;
|
|
1693
1695
|
}
|
|
1694
|
-
let $ = _[
|
|
1695
|
-
if (!x &&
|
|
1696
|
-
((L = Bt(n)) == null ? void 0 : L.index) ===
|
|
1697
|
-
|
|
1698
|
-
}), Xn(n, Ft(n,
|
|
1696
|
+
let $ = _[p], M = (N = O(n, $, "waitForElement")) != null ? N : 0;
|
|
1697
|
+
if (!x && M > 0 && $.element && !dt($.element)) {
|
|
1698
|
+
((L = Bt(n)) == null ? void 0 : L.index) === p ? Kt(n, "initial") : n.state.activeStep ? Kt(n, "next") : (e.endInitialWait(n), e.showInitialWait(n, p)), Bo(n, $, M, (S) => {
|
|
1699
|
+
S ? g(p, !0) : No(n, p);
|
|
1700
|
+
}), Xn(n, Ft(n, p), p);
|
|
1699
1701
|
return;
|
|
1700
1702
|
}
|
|
1701
1703
|
if (e.endInitialWait(n), Bn(n, $)) {
|
|
1702
|
-
let
|
|
1703
|
-
_[
|
|
1704
|
+
let S = n.state.activeIndex, W = typeof S == "number" && p < S ? -1 : 1;
|
|
1705
|
+
_[p + W] ? g(p + W) : W === 1 && I("done");
|
|
1704
1706
|
return;
|
|
1705
1707
|
}
|
|
1706
|
-
an(n,
|
|
1708
|
+
an(n, p, !1), k(Ft(n, p));
|
|
1707
1709
|
}
|
|
1708
|
-
function
|
|
1709
|
-
let x = on(n,
|
|
1710
|
-
e.highlight(n,
|
|
1710
|
+
function k(p) {
|
|
1711
|
+
let x = on(n, p);
|
|
1712
|
+
e.highlight(n, p), v(x);
|
|
1711
1713
|
}
|
|
1712
|
-
function
|
|
1714
|
+
function B() {
|
|
1713
1715
|
lt === r && (lt = void 0), e.detach(n), Gt(n), sn(n), e.unmount(n);
|
|
1714
|
-
let
|
|
1715
|
-
return n.state = {},
|
|
1716
|
+
let p = n.state;
|
|
1717
|
+
return n.state = {}, p;
|
|
1716
1718
|
}
|
|
1717
|
-
function
|
|
1718
|
-
var U,
|
|
1719
|
+
function I(p, x = !0) {
|
|
1720
|
+
var U, z, Y, pt, Z, vt, mt, ht, gt, d;
|
|
1719
1721
|
if (!n.state.isInitialized) return;
|
|
1720
|
-
|
|
1721
|
-
let _ = !!n.state.__activeElement || !!n.state.__activeStep, $ = _ ? n.state.__activeElement : n.state.activeElement,
|
|
1722
|
-
if (x &&
|
|
1723
|
-
n.state.__destroyReason =
|
|
1722
|
+
p === "api" && (p = (U = n.state.__destroyReason) != null ? U : "api");
|
|
1723
|
+
let _ = !!n.state.__activeElement || !!n.state.__activeStep, $ = _ ? n.state.__activeElement : n.state.activeElement, M = (vt = (pt = (Y = n.state.__activeStep) != null ? Y : (z = Bt(n)) == null ? void 0 : z.step) != null ? pt : n.state.activeStep) != null ? vt : (Z = n.state.__activation) == null ? void 0 : Z.step, N = V($) ? void 0 : $, L = document.activeElement, S = !L || L === document.body || (mt = n.state.popover) != null && mt.wrapper.contains(L) ? n.state.__activeOnDestroyed : void 0, W = n.config.onDestroyStarted, R = (d = (ht = rt(n)) != null ? ht : n.state.activeStep) != null ? d : (gt = n.state.__activation) == null ? void 0 : gt.step;
|
|
1724
|
+
if (x && W && R) {
|
|
1725
|
+
n.state.__destroyReason = p, W(N, R, K(n, void 0, p));
|
|
1724
1726
|
return;
|
|
1725
1727
|
}
|
|
1726
|
-
let
|
|
1727
|
-
|
|
1728
|
+
let E = (M == null ? void 0 : M.onDeselected) || n.config.onDeselected, A = n.config.onDestroyed, F = B();
|
|
1729
|
+
M && (_ && E && E(N, M, K(n, F, p)), A == null || A(N, M, K(n, F, p))), S && e.restoreFocus(S);
|
|
1728
1730
|
}
|
|
1729
|
-
let
|
|
1730
|
-
h(), g(
|
|
1731
|
-
}, setConfig: (
|
|
1732
|
-
n.state.isInitialized ?
|
|
1733
|
-
}, getConfig: ((
|
|
1734
|
-
let
|
|
1731
|
+
let D = { isActive: () => n.state.isInitialized || !1, refresh: () => e.refresh(n), drive: (p = 0) => {
|
|
1732
|
+
h(), g(p);
|
|
1733
|
+
}, setConfig: (p) => re(n, p), setSteps: (p) => {
|
|
1734
|
+
n.state.isInitialized ? B() : n.state = {}, re(n, { ...n.config, steps: p });
|
|
1735
|
+
}, getConfig: ((p) => p ? n.config[p] : n.config), getState: (p) => p ? n.state[p] : n.state, getActiveIndex: () => n.state.activeIndex, isFirstStep: () => nt(n, -1), isLastStep: () => nt(n, 1), getActiveStep: () => n.state.activeStep, getActiveElement: () => n.state.activeElement, getPreviousElement: () => n.state.previousElement, getPreviousStep: () => n.state.previousStep, getNextStep: () => {
|
|
1736
|
+
let p = n.config.steps || [], x = n.state.activeIndex;
|
|
1735
1737
|
if (x === void 0) return;
|
|
1736
1738
|
let _ = Wt(n, x + 1, 1);
|
|
1737
|
-
return _ === void 0 ? void 0 :
|
|
1738
|
-
}, moveNext: i, movePrevious: a, moveTo: s, hasNextStep: () => n.state.activeIndex !== void 0 && !nt(n, 1), hasPreviousStep: () => n.state.activeIndex !== void 0 && !nt(n, -1), highlight: (
|
|
1739
|
-
h(), Gt(n), e.endInitialWait(n), n.state.__destroyReason = void 0,
|
|
1740
|
-
}, updatePopover:
|
|
1741
|
-
typeof
|
|
1739
|
+
return _ === void 0 ? void 0 : p[_];
|
|
1740
|
+
}, moveNext: i, movePrevious: a, moveTo: s, hasNextStep: () => n.state.activeIndex !== void 0 && !nt(n, 1), hasPreviousStep: () => n.state.activeIndex !== void 0 && !nt(n, -1), highlight: (p) => {
|
|
1741
|
+
h(), Gt(n), e.endInitialWait(n), n.state.__destroyReason = void 0, k(Io({ ...p, popover: p.popover ? { showButtons: [], showProgress: !1, progressText: "", ...p.popover } : void 0 }));
|
|
1742
|
+
}, updatePopover: m, advance: l, nudge: (p) => {
|
|
1743
|
+
typeof p == "object" && m(p), u(typeof p == "string" ? p : ""), e.nudge(n);
|
|
1742
1744
|
}, destroy: () => {
|
|
1743
|
-
|
|
1745
|
+
I("api", !1);
|
|
1744
1746
|
} };
|
|
1745
|
-
return n.driver =
|
|
1747
|
+
return n.driver = D, D;
|
|
1746
1748
|
}
|
|
1747
1749
|
function Ko(t, e, n) {
|
|
1748
|
-
let r = t.state.__activation, o = () => !ut(t, r), i = t.state.__activeStep, a = t.state.__activeElement || (i ? void 0 : e), s = n.onHighlightStarted || t.config.onHighlightStarted, l = n.onHighlighted || t.config.onHighlighted, c = (i == null ? void 0 : i.onDeselected) || t.config.onDeselected,
|
|
1749
|
-
if (!(i && i !== n && c && (c(V(a) ? void 0 : a, i,
|
|
1750
|
-
t.state.__previousStep = i, t.state.__previousElement = a, t.state.__activeStep = n, t.state.__activeElement =
|
|
1750
|
+
let r = t.state.__activation, o = () => !ut(t, r), i = t.state.__activeStep, a = t.state.__activeElement || (i ? void 0 : e), s = n.onHighlightStarted || t.config.onHighlightStarted, l = n.onHighlighted || t.config.onHighlighted, c = (i == null ? void 0 : i.onDeselected) || t.config.onDeselected, f = r == null ? void 0 : r.controller.signal, v = K(t);
|
|
1751
|
+
if (!(i && i !== n && c && (c(V(a) ? void 0 : a, i, v), o())) && !(s && (s(V(e) ? void 0 : e, n, { ...v, signal: f }), o()))) return t.state.previousStep = i, t.state.previousElement = a, t.state.activeStep = n, t.state.activeElement = e, (m) => {
|
|
1752
|
+
t.state.__previousStep = i, t.state.__previousElement = a, t.state.__activeStep = n, t.state.__activeElement = m, l && l(V(e) ? void 0 : m, n, { ...K(t), signal: f });
|
|
1751
1753
|
};
|
|
1752
1754
|
}
|
|
1753
1755
|
function zo(t, e, n) {
|
|
@@ -1802,22 +1804,22 @@ function jo(t, e, n) {
|
|
|
1802
1804
|
if (!a) return;
|
|
1803
1805
|
let s = t.state.previousElement || e, l = s !== e && i, c = !1;
|
|
1804
1806
|
oo(t.state.popover);
|
|
1805
|
-
let
|
|
1806
|
-
if (!Oe(t,
|
|
1807
|
-
let
|
|
1808
|
-
if (n.popover &&
|
|
1807
|
+
let f = () => {
|
|
1808
|
+
if (!Oe(t, f)) return;
|
|
1809
|
+
let m = Date.now() - o, u = r - m <= r / 2, y = zo(t, n, e);
|
|
1810
|
+
if (n.popover && u && !c && l && (se(t, y, n), c = !0), t.config.animate && m < r) go(t, m, r, s, y);
|
|
1809
1811
|
else {
|
|
1810
|
-
if (ye(t, y), a(y), !Oe(t,
|
|
1812
|
+
if (ye(t, y), a(y), !Oe(t, f)) return;
|
|
1811
1813
|
To(t, y, n);
|
|
1812
1814
|
let h = Nr(t);
|
|
1813
1815
|
de(t, y), h && Jn(t);
|
|
1814
1816
|
return;
|
|
1815
1817
|
}
|
|
1816
|
-
window.requestAnimationFrame(
|
|
1818
|
+
window.requestAnimationFrame(f);
|
|
1817
1819
|
};
|
|
1818
|
-
Br(t,
|
|
1819
|
-
let
|
|
1820
|
-
|
|
1820
|
+
Br(t, f), window.requestAnimationFrame(f), Ee(t);
|
|
1821
|
+
let v = O(t, n, "scrollIntoView");
|
|
1822
|
+
v !== !1 && hn(e, t.config.smoothScroll, typeof v == "object" ? v : void 0), !l && n.popover && se(t, e, n), ke(t), Zn(t, e, n);
|
|
1821
1823
|
}
|
|
1822
1824
|
const Ht = /* @__PURE__ */ new WeakMap();
|
|
1823
1825
|
function Uo(t, e) {
|
|
@@ -1920,7 +1922,7 @@ function ii(t, e) {
|
|
|
1920
1922
|
let o = Se(t, e.composedPath());
|
|
1921
1923
|
if (o === "popover") return;
|
|
1922
1924
|
let i = t.state.activeElement;
|
|
1923
|
-
r(V(i) ? void 0 : i, n, { ...
|
|
1925
|
+
r(V(i) ? void 0 : i, n, { ...K(t), event: e, region: o }) === !1 && nr(t, e);
|
|
1924
1926
|
}
|
|
1925
1927
|
function si(t) {
|
|
1926
1928
|
let e = new AbortController(), n = !1, r = (s) => {
|
|
@@ -2008,8 +2010,8 @@ function vi(t) {
|
|
|
2008
2010
|
let e = (c) => pi(t, c), n = (c) => {
|
|
2009
2011
|
fi(t, c), ui(t, c);
|
|
2010
2012
|
}, r = (c) => di(t, c), o = () => _t(t), i = (c) => {
|
|
2011
|
-
var
|
|
2012
|
-
c.target instanceof Node && ((
|
|
2013
|
+
var f;
|
|
2014
|
+
c.target instanceof Node && ((f = t.state.popover) != null && f.wrapper.contains(c.target)) || _t(t);
|
|
2013
2015
|
};
|
|
2014
2016
|
t.state.__events = { onKeyup: e, onKeydown: n, onKeydownCapture: r, onResize: o, onScroll: i }, typeof ResizeObserver < "u" && (t.state.__resizeObserver = new ResizeObserver(() => ci(t)));
|
|
2015
2017
|
let a = new MutationObserver(() => _t(t));
|
|
@@ -2054,7 +2056,7 @@ function cr(t) {
|
|
|
2054
2056
|
jt(n) || t.tour.movePrevious();
|
|
2055
2057
|
return;
|
|
2056
2058
|
}
|
|
2057
|
-
r(e, n,
|
|
2059
|
+
r(e, n, K(t));
|
|
2058
2060
|
}
|
|
2059
2061
|
function wi(t) {
|
|
2060
2062
|
var n;
|
|
@@ -2067,7 +2069,7 @@ function wi(t) {
|
|
|
2067
2069
|
if (typeof e == "function") {
|
|
2068
2070
|
t.state.__destroyReason = "overlay";
|
|
2069
2071
|
let r = (n = rt(t)) != null ? n : t.state.activeStep;
|
|
2070
|
-
r && e(t.state.__activeElement, r,
|
|
2072
|
+
r && e(t.state.__activeElement, r, K(t));
|
|
2071
2073
|
return;
|
|
2072
2074
|
}
|
|
2073
2075
|
e === "nextStep" && sr(t) && t.tour.next();
|
|
@@ -2179,88 +2181,126 @@ function Ri(t, e, n) {
|
|
|
2179
2181
|
}
|
|
2180
2182
|
o.childElementCount !== 0 && ((i = t.footer) != null && i.parentElement ? t.footer.parentElement.insertBefore(o, t.footer) : t.wrapper.appendChild(o));
|
|
2181
2183
|
}
|
|
2182
|
-
function Oi(t
|
|
2184
|
+
function Oi(t, e, n) {
|
|
2185
|
+
var i;
|
|
2186
|
+
(i = t.wrapper.querySelector(".taplu-skip")) == null || i.remove();
|
|
2187
|
+
const r = document.createElement("button");
|
|
2188
|
+
r.type = "button", r.className = "taplu-skip", r.textContent = e, r.addEventListener("click", (a) => {
|
|
2189
|
+
a.preventDefault(), n();
|
|
2190
|
+
});
|
|
2191
|
+
const o = t.footer;
|
|
2192
|
+
o != null && o.parentElement ? o.parentElement.insertBefore(r, o) : t.wrapper.appendChild(r);
|
|
2193
|
+
}
|
|
2194
|
+
function Di(t = {}) {
|
|
2183
2195
|
const e = t.allowHtml === !0;
|
|
2184
|
-
let n = null, r = null, o = null;
|
|
2185
|
-
function
|
|
2196
|
+
let n = null, r = null, o = null, i = !1, a = !1;
|
|
2197
|
+
function s(u) {
|
|
2198
|
+
if (!a) {
|
|
2199
|
+
a = !0;
|
|
2200
|
+
try {
|
|
2201
|
+
u.onClose();
|
|
2202
|
+
} finally {
|
|
2203
|
+
a = !1;
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
function l() {
|
|
2186
2208
|
return { ...t.theme, ...o == null ? void 0 : o.theme };
|
|
2187
2209
|
}
|
|
2188
|
-
function
|
|
2210
|
+
function c() {
|
|
2189
2211
|
var u;
|
|
2190
2212
|
return (u = r == null ? void 0 : r.step.allow) != null ? u : {};
|
|
2191
2213
|
}
|
|
2192
|
-
function
|
|
2214
|
+
function f() {
|
|
2193
2215
|
return n || (n = Pi({ steps: [], animate: !0, duration: 220, showButtons: [] })), n;
|
|
2194
2216
|
}
|
|
2195
|
-
function
|
|
2196
|
-
var
|
|
2217
|
+
function v(u) {
|
|
2218
|
+
var h;
|
|
2197
2219
|
if (!o || u !== "outside") return;
|
|
2198
|
-
const
|
|
2199
|
-
if (
|
|
2200
|
-
if (
|
|
2220
|
+
const y = (h = c().clickOutside) != null ? h : "ignore";
|
|
2221
|
+
if (y === "block") return !1;
|
|
2222
|
+
if (y === "skip")
|
|
2201
2223
|
return o.onSkip(), !1;
|
|
2202
2224
|
}
|
|
2203
|
-
function
|
|
2204
|
-
var
|
|
2205
|
-
const
|
|
2206
|
-
|
|
2207
|
-
const
|
|
2208
|
-
title:
|
|
2209
|
-
description:
|
|
2210
|
-
side: (
|
|
2225
|
+
function m(u) {
|
|
2226
|
+
var _, $, M, N, L, S, W, R, E;
|
|
2227
|
+
const y = u.step, h = (_ = y.content) != null ? _ : {}, g = ($ = o == null ? void 0 : o.index) != null ? $ : 0, k = (M = o == null ? void 0 : o.total) != null ? M : 1, B = g >= k - 1, I = (N = y.allow) != null ? N : {}, D = (L = y.advance) != null ? L : { mode: "click" }, p = [];
|
|
2228
|
+
I.previous !== !1 && g > 0 && p.push("previous"), D.mode !== "action" && p.push("next"), I.close !== !1 && p.push("close");
|
|
2229
|
+
const x = {
|
|
2230
|
+
title: h.title,
|
|
2231
|
+
description: h.body,
|
|
2232
|
+
side: (W = Bi[(S = y.placement) != null ? S : "auto"]) != null ? W : void 0,
|
|
2211
2233
|
align: "center",
|
|
2212
|
-
showButtons:
|
|
2213
|
-
showProgress:
|
|
2214
|
-
progressText:
|
|
2215
|
-
nextBtnText:
|
|
2234
|
+
showButtons: p,
|
|
2235
|
+
showProgress: k > 1,
|
|
2236
|
+
progressText: k > 1 ? `${g + 1} / ${k}` : "",
|
|
2237
|
+
nextBtnText: B ? "完成" : "下一步",
|
|
2216
2238
|
prevBtnText: "上一步",
|
|
2217
2239
|
closeBtnLabel: "关闭",
|
|
2218
2240
|
onNextClick: () => o == null ? void 0 : o.onNext(),
|
|
2219
2241
|
onPrevClick: () => o == null ? void 0 : o.onPrev(),
|
|
2220
2242
|
onCloseClick: () => o == null ? void 0 : o.onClose(),
|
|
2221
|
-
onPopoverRender: (
|
|
2243
|
+
onPopoverRender: (A) => {
|
|
2244
|
+
var F;
|
|
2245
|
+
Ri(A, h.blocks, e), I.skip === !0 && Oi(A, (F = y.skipBtnText) != null ? F : "跳过", () => o == null ? void 0 : o.onSkip());
|
|
2246
|
+
}
|
|
2222
2247
|
};
|
|
2223
2248
|
return {
|
|
2224
|
-
element: (
|
|
2225
|
-
popover:
|
|
2249
|
+
element: (R = u.element) != null ? R : void 0,
|
|
2250
|
+
popover: x,
|
|
2226
2251
|
disableActiveInteraction: !1,
|
|
2227
|
-
scrollIntoView: ((E =
|
|
2228
|
-
data: { stepId:
|
|
2252
|
+
scrollIntoView: ((E = y.highlight) == null ? void 0 : E.scrollIntoView) !== !1,
|
|
2253
|
+
data: { stepId: y.id, hitLevel: u.hitLevel }
|
|
2229
2254
|
};
|
|
2230
2255
|
}
|
|
2231
2256
|
return {
|
|
2232
2257
|
mount() {
|
|
2233
|
-
|
|
2258
|
+
f();
|
|
2234
2259
|
},
|
|
2235
|
-
show(u,
|
|
2236
|
-
var
|
|
2237
|
-
r = u, o =
|
|
2238
|
-
const
|
|
2260
|
+
show(u, y) {
|
|
2261
|
+
var p, x, _, $, M, N, L, S, W;
|
|
2262
|
+
r = u, o = y;
|
|
2263
|
+
const h = f(), g = u.step, k = (p = g.highlight) != null ? p : {}, B = (x = g.allow) != null ? x : {}, I = l(), D = {
|
|
2239
2264
|
animate: !0,
|
|
2240
2265
|
duration: 220,
|
|
2241
2266
|
smoothScroll: !0,
|
|
2242
|
-
allowClose:
|
|
2267
|
+
allowClose: B.close !== !1,
|
|
2243
2268
|
allowScroll: !1,
|
|
2244
|
-
allowKeyboardControl:
|
|
2245
|
-
overlayColor: (
|
|
2269
|
+
allowKeyboardControl: B.keyboard !== !1,
|
|
2270
|
+
overlayColor: ($ = (_ = k.maskColor) != null ? _ : I.overlayColor) != null ? $ : "rgb(9, 16, 29)",
|
|
2246
2271
|
// driver.js 仅支持遮罩整体透明度,mask:false 时置为 0
|
|
2247
|
-
overlayOpacity:
|
|
2248
|
-
stagePadding: (
|
|
2249
|
-
stageRadius: (
|
|
2272
|
+
overlayOpacity: k.mask === !1 ? 0 : (M = I.overlayOpacity) != null ? M : 0.6,
|
|
2273
|
+
stagePadding: (L = (N = k.padding) != null ? N : I.stagePadding) != null ? L : 8,
|
|
2274
|
+
stageRadius: (W = (S = k.radius) != null ? S : I.stageRadius) != null ? W : 12,
|
|
2250
2275
|
overlayClickBehavior: "none",
|
|
2251
2276
|
showButtons: [],
|
|
2252
|
-
onInteraction: (
|
|
2277
|
+
onInteraction: (R, E, A) => v(A.region),
|
|
2278
|
+
// ESC 由 driver.js 内部直接销毁,不经过 onCloseClick;× 按钮会同时触发两者。
|
|
2279
|
+
// 因此这里按「是否我们自己收掉的」判断,避免漏通知又不重复通知。
|
|
2253
2280
|
onDestroyed: () => {
|
|
2254
|
-
|
|
2281
|
+
const R = o, E = !i && r !== null;
|
|
2282
|
+
r = null, E && R && s(R);
|
|
2255
2283
|
}
|
|
2256
2284
|
};
|
|
2257
|
-
|
|
2285
|
+
h.setConfig(D), h.highlight(m(u));
|
|
2258
2286
|
},
|
|
2259
2287
|
hide() {
|
|
2260
|
-
|
|
2288
|
+
i = !0;
|
|
2289
|
+
try {
|
|
2290
|
+
n != null && n.isActive() && n.destroy();
|
|
2291
|
+
} finally {
|
|
2292
|
+
i = !1;
|
|
2293
|
+
}
|
|
2294
|
+
r = null, o = null;
|
|
2261
2295
|
},
|
|
2262
2296
|
destroy() {
|
|
2263
|
-
|
|
2297
|
+
i = !0;
|
|
2298
|
+
try {
|
|
2299
|
+
n != null && n.isActive() && n.destroy();
|
|
2300
|
+
} finally {
|
|
2301
|
+
i = !1;
|
|
2302
|
+
}
|
|
2303
|
+
n = null, r = null, o = null;
|
|
2264
2304
|
},
|
|
2265
2305
|
/** 超时提醒之类的小气泡提示 */
|
|
2266
2306
|
nudge(u) {
|
|
@@ -2272,8 +2312,8 @@ function Oi(t = {}) {
|
|
|
2272
2312
|
}
|
|
2273
2313
|
};
|
|
2274
2314
|
}
|
|
2275
|
-
const
|
|
2276
|
-
function
|
|
2315
|
+
const Wi = 1800 * 1e3, It = 50;
|
|
2316
|
+
function Fi() {
|
|
2277
2317
|
const t = /* @__PURE__ */ new Map();
|
|
2278
2318
|
return {
|
|
2279
2319
|
getItem: (e) => {
|
|
@@ -2288,7 +2328,7 @@ function Wi() {
|
|
|
2288
2328
|
}
|
|
2289
2329
|
};
|
|
2290
2330
|
}
|
|
2291
|
-
function
|
|
2331
|
+
function Ki(t) {
|
|
2292
2332
|
if (t) return t;
|
|
2293
2333
|
try {
|
|
2294
2334
|
if (typeof window != "undefined" && window.sessionStorage) {
|
|
@@ -2297,55 +2337,55 @@ function Fi(t) {
|
|
|
2297
2337
|
}
|
|
2298
2338
|
} catch {
|
|
2299
2339
|
}
|
|
2300
|
-
return
|
|
2340
|
+
return Fi();
|
|
2301
2341
|
}
|
|
2302
|
-
function
|
|
2303
|
-
var c,
|
|
2304
|
-
const e =
|
|
2305
|
-
for (const
|
|
2342
|
+
function ls(t = {}) {
|
|
2343
|
+
var c, f, v;
|
|
2344
|
+
const e = Ki(t.storage), n = (c = t.keyPrefix) != null ? c : "taplu:", r = (f = t.ttlMs) != null ? f : Wi, o = `${n}progress`, i = /* @__PURE__ */ new Map();
|
|
2345
|
+
for (const m of (v = t.flows) != null ? v : []) i.set(m.key, m);
|
|
2306
2346
|
function a() {
|
|
2307
2347
|
try {
|
|
2308
|
-
const
|
|
2309
|
-
if (!
|
|
2310
|
-
const
|
|
2311
|
-
return !
|
|
2348
|
+
const m = e.getItem(o);
|
|
2349
|
+
if (!m) return { v: 1, progress: {}, misses: [], hits: [] };
|
|
2350
|
+
const u = JSON.parse(m);
|
|
2351
|
+
return !u || typeof u != "object" || !u.progress ? { v: 1, progress: {}, misses: [], hits: [] } : {
|
|
2312
2352
|
v: 1,
|
|
2313
|
-
progress:
|
|
2314
|
-
misses: Array.isArray(
|
|
2315
|
-
hits: Array.isArray(
|
|
2353
|
+
progress: u.progress,
|
|
2354
|
+
misses: Array.isArray(u.misses) ? u.misses : [],
|
|
2355
|
+
hits: Array.isArray(u.hits) ? u.hits : []
|
|
2316
2356
|
};
|
|
2317
2357
|
} catch {
|
|
2318
2358
|
return { v: 1, progress: {}, misses: [], hits: [] };
|
|
2319
2359
|
}
|
|
2320
2360
|
}
|
|
2321
|
-
function s(
|
|
2361
|
+
function s(m) {
|
|
2322
2362
|
try {
|
|
2323
|
-
e.setItem(o, JSON.stringify(
|
|
2363
|
+
e.setItem(o, JSON.stringify(m));
|
|
2324
2364
|
} catch {
|
|
2325
2365
|
}
|
|
2326
2366
|
}
|
|
2327
|
-
function l(
|
|
2328
|
-
return !
|
|
2367
|
+
function l(m) {
|
|
2368
|
+
return !m || r > 0 && Date.now() - m.updatedAt > r ? null : m;
|
|
2329
2369
|
}
|
|
2330
2370
|
return {
|
|
2331
|
-
loadFlow(
|
|
2332
|
-
var
|
|
2333
|
-
return (
|
|
2371
|
+
loadFlow(m) {
|
|
2372
|
+
var u;
|
|
2373
|
+
return (u = i.get(m)) != null ? u : null;
|
|
2334
2374
|
},
|
|
2335
|
-
getProgress(
|
|
2336
|
-
return l(a().progress[
|
|
2375
|
+
getProgress(m) {
|
|
2376
|
+
return l(a().progress[m]);
|
|
2337
2377
|
},
|
|
2338
|
-
saveProgress(
|
|
2339
|
-
const
|
|
2340
|
-
|
|
2378
|
+
saveProgress(m) {
|
|
2379
|
+
const u = a();
|
|
2380
|
+
u.progress[m.flowKey] = m, s(u);
|
|
2341
2381
|
},
|
|
2342
|
-
reportMiss(
|
|
2343
|
-
const
|
|
2344
|
-
|
|
2382
|
+
reportMiss(m) {
|
|
2383
|
+
const u = a();
|
|
2384
|
+
u.misses.push(m), u.misses.length > It && u.misses.splice(0, u.misses.length - It), s(u);
|
|
2345
2385
|
},
|
|
2346
|
-
reportHit(
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2386
|
+
reportHit(m) {
|
|
2387
|
+
const u = a();
|
|
2388
|
+
u.hits.push(m), u.hits.length > It && u.hits.splice(0, u.hits.length - It), s(u);
|
|
2349
2389
|
},
|
|
2350
2390
|
get misses() {
|
|
2351
2391
|
return a().misses;
|
|
@@ -2353,13 +2393,13 @@ function as(t = {}) {
|
|
|
2353
2393
|
get hits() {
|
|
2354
2394
|
return a().hits;
|
|
2355
2395
|
},
|
|
2356
|
-
addFlow(
|
|
2357
|
-
i.set(
|
|
2396
|
+
addFlow(m) {
|
|
2397
|
+
i.set(m.key, m);
|
|
2358
2398
|
}
|
|
2359
2399
|
};
|
|
2360
2400
|
}
|
|
2361
|
-
const
|
|
2362
|
-
function
|
|
2401
|
+
const zi = 200;
|
|
2402
|
+
function Hi() {
|
|
2363
2403
|
const t = /* @__PURE__ */ new Map();
|
|
2364
2404
|
return {
|
|
2365
2405
|
getItem: (e) => {
|
|
@@ -2374,7 +2414,7 @@ function zi() {
|
|
|
2374
2414
|
}
|
|
2375
2415
|
};
|
|
2376
2416
|
}
|
|
2377
|
-
function
|
|
2417
|
+
function qi(t) {
|
|
2378
2418
|
if (t) return t;
|
|
2379
2419
|
try {
|
|
2380
2420
|
if (typeof window != "undefined" && window.localStorage) {
|
|
@@ -2383,12 +2423,12 @@ function Hi(t) {
|
|
|
2383
2423
|
}
|
|
2384
2424
|
} catch {
|
|
2385
2425
|
}
|
|
2386
|
-
return
|
|
2426
|
+
return Hi();
|
|
2387
2427
|
}
|
|
2388
2428
|
const Mt = { v: 1, progress: {}, misses: [], hits: [] };
|
|
2389
|
-
function
|
|
2390
|
-
var
|
|
2391
|
-
const e =
|
|
2429
|
+
function cs(t = {}) {
|
|
2430
|
+
var v, m, u, y;
|
|
2431
|
+
const e = qi(t.storage), n = (v = t.keyPrefix) != null ? v : "taplu:local:", r = (m = t.ttlMs) != null ? m : 0, o = t.resetOnVersionChange !== !1, i = (u = t.maxReports) != null ? u : zi, a = `${n}data`, s = /* @__PURE__ */ new Map();
|
|
2392
2432
|
for (const h of (y = t.flows) != null ? y : []) s.set(h.key, h);
|
|
2393
2433
|
function l() {
|
|
2394
2434
|
try {
|
|
@@ -2411,7 +2451,7 @@ function ls(t = {}) {
|
|
|
2411
2451
|
} catch {
|
|
2412
2452
|
}
|
|
2413
2453
|
}
|
|
2414
|
-
function
|
|
2454
|
+
function f(h) {
|
|
2415
2455
|
if (!h || r > 0 && Date.now() - h.updatedAt > r) return null;
|
|
2416
2456
|
const g = s.get(h.flowKey);
|
|
2417
2457
|
return g && o && h.flowVersion !== g.version ? null : h;
|
|
@@ -2422,7 +2462,7 @@ function ls(t = {}) {
|
|
|
2422
2462
|
return (g = s.get(h)) != null ? g : null;
|
|
2423
2463
|
},
|
|
2424
2464
|
getProgress(h) {
|
|
2425
|
-
return
|
|
2465
|
+
return f(l().progress[h]);
|
|
2426
2466
|
},
|
|
2427
2467
|
saveProgress(h) {
|
|
2428
2468
|
const g = l();
|
|
@@ -2455,12 +2495,12 @@ function ls(t = {}) {
|
|
|
2455
2495
|
}
|
|
2456
2496
|
};
|
|
2457
2497
|
}
|
|
2458
|
-
function
|
|
2498
|
+
function Vi(t) {
|
|
2459
2499
|
return t.replace(/\/+$/, "");
|
|
2460
2500
|
}
|
|
2461
|
-
function
|
|
2501
|
+
function us(t) {
|
|
2462
2502
|
var a;
|
|
2463
|
-
const e =
|
|
2503
|
+
const e = Vi(t.baseUrl), n = (a = t.fetch) != null ? a : ((s, l) => {
|
|
2464
2504
|
const c = globalThis.fetch;
|
|
2465
2505
|
return c ? c(s, l) : Promise.reject(new Error("当前环境没有 fetch,请通过 options.fetch 注入"));
|
|
2466
2506
|
});
|
|
@@ -2518,7 +2558,7 @@ function cs(t) {
|
|
|
2518
2558
|
}
|
|
2519
2559
|
};
|
|
2520
2560
|
}
|
|
2521
|
-
function
|
|
2561
|
+
function ds() {
|
|
2522
2562
|
const t = () => typeof window == "undefined" || !window.location ? "" : `${window.location.pathname}${window.location.search}`;
|
|
2523
2563
|
return {
|
|
2524
2564
|
getRoute: t,
|
|
@@ -2532,7 +2572,7 @@ function us() {
|
|
|
2532
2572
|
}
|
|
2533
2573
|
};
|
|
2534
2574
|
}
|
|
2535
|
-
function
|
|
2575
|
+
function fs(t) {
|
|
2536
2576
|
const e = /* @__PURE__ */ new Set();
|
|
2537
2577
|
return {
|
|
2538
2578
|
getRoute: () => t,
|
|
@@ -2541,15 +2581,15 @@ function ds(t) {
|
|
|
2541
2581
|
}
|
|
2542
2582
|
};
|
|
2543
2583
|
}
|
|
2544
|
-
const
|
|
2584
|
+
const ji = {
|
|
2545
2585
|
attr: 100,
|
|
2546
2586
|
id: 80,
|
|
2547
2587
|
name: 70,
|
|
2548
2588
|
text: 60,
|
|
2549
2589
|
path: 30,
|
|
2550
2590
|
css: 25
|
|
2551
|
-
},
|
|
2552
|
-
function
|
|
2591
|
+
}, Ui = 40, Xi = 160, ur = (t) => (t != null ? t : "").replace(/\s+/g, " ").trim();
|
|
2592
|
+
function Gi(t) {
|
|
2553
2593
|
var n;
|
|
2554
2594
|
let e = "";
|
|
2555
2595
|
for (const r of Array.from(t.childNodes))
|
|
@@ -2576,7 +2616,7 @@ function en(t, e) {
|
|
|
2576
2616
|
}
|
|
2577
2617
|
return n.length > 0 ? n.join(" > ") : null;
|
|
2578
2618
|
}
|
|
2579
|
-
function
|
|
2619
|
+
function Ji(t, e, n) {
|
|
2580
2620
|
let r;
|
|
2581
2621
|
try {
|
|
2582
2622
|
r = rn(t, n);
|
|
@@ -2587,54 +2627,54 @@ function Gi(t, e, n) {
|
|
|
2587
2627
|
}
|
|
2588
2628
|
function dr(t, e = {}) {
|
|
2589
2629
|
var h, g;
|
|
2590
|
-
const n = (h = e.root) != null ? h : t.ownerDocument, r = (g = e.maxTextLength) != null ? g :
|
|
2591
|
-
if (!
|
|
2592
|
-
const
|
|
2593
|
-
|
|
2630
|
+
const n = (h = e.root) != null ? h : t.ownerDocument, r = (g = e.maxTextLength) != null ? g : Ui, o = { ...ji, ...e.weights }, i = [], a = [], s = (k, B) => {
|
|
2631
|
+
if (!B) return;
|
|
2632
|
+
const I = { kind: k, expr: B, weight: o[k] }, D = Ji(I, t, n);
|
|
2633
|
+
D.usable && (i.some((p) => p.kind === k && p.expr === B) || (i.push(I), a.push(D.unique)));
|
|
2594
2634
|
}, l = t.getAttribute("data-guide");
|
|
2595
2635
|
l && s("attr", `data-guide="${l}"`);
|
|
2596
2636
|
const c = t.getAttribute("id");
|
|
2597
2637
|
c && !Ae(c) && s("id", c);
|
|
2598
|
-
const
|
|
2599
|
-
|
|
2600
|
-
const
|
|
2601
|
-
if (
|
|
2602
|
-
const
|
|
2603
|
-
|
|
2638
|
+
const f = t.getAttribute("name");
|
|
2639
|
+
f && s("name", f);
|
|
2640
|
+
const v = Gi(t);
|
|
2641
|
+
if (v && v.length <= r && s("text", v), e.includePath !== !1) {
|
|
2642
|
+
const k = en(t, n);
|
|
2643
|
+
k && s("path", k);
|
|
2604
2644
|
}
|
|
2605
2645
|
if (i.length === 0) {
|
|
2606
|
-
const
|
|
2607
|
-
|
|
2646
|
+
const k = en(t, n);
|
|
2647
|
+
k && i.push({ kind: "path", expr: k, weight: o.path });
|
|
2608
2648
|
}
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2649
|
+
const m = { candidates: i }, u = ur(t.outerHTML).slice(0, Xi);
|
|
2650
|
+
u && (m.snapshot = u);
|
|
2611
2651
|
const y = { tag: t.tagName.toLowerCase() };
|
|
2612
|
-
return
|
|
2652
|
+
return v && v.length <= r && (y.textIncludes = v), m.expect = y, i.length > 0 && a.every(Boolean) && (m.match = { min: 1, max: 1 }), m;
|
|
2613
2653
|
}
|
|
2614
|
-
function
|
|
2654
|
+
function ps(t, e = {}, n = {}) {
|
|
2615
2655
|
return { ...{
|
|
2616
|
-
id:
|
|
2656
|
+
id: Yi(t),
|
|
2617
2657
|
target: dr(t, n),
|
|
2618
2658
|
placement: "auto",
|
|
2619
2659
|
content: { title: "", body: "" }
|
|
2620
2660
|
}, ...e };
|
|
2621
2661
|
}
|
|
2622
|
-
function
|
|
2662
|
+
function Yi(t) {
|
|
2623
2663
|
const e = t.getAttribute("data-guide");
|
|
2624
2664
|
if (e) return e.replace(/[^\w-]+/g, "-");
|
|
2625
2665
|
const n = t.getAttribute("id");
|
|
2626
2666
|
return n && !Ae(n) ? n.replace(/[^\w-]+/g, "-") : t.tagName.toLowerCase();
|
|
2627
2667
|
}
|
|
2628
2668
|
let tt = null;
|
|
2629
|
-
function
|
|
2669
|
+
function vs() {
|
|
2630
2670
|
return tt !== null;
|
|
2631
2671
|
}
|
|
2632
|
-
const nn = "taplu-picker-style",
|
|
2672
|
+
const nn = "taplu-picker-style", Zi = "var(--taplu-primary, #2563eb)", Qi = "点击要高亮的锚点元素;按住 Alt 选择具体子元素;Esc 取消", ts = `
|
|
2633
2673
|
[data-taplu-picker] { box-sizing: border-box; }
|
|
2634
2674
|
[data-taplu-picker="box"] {
|
|
2635
2675
|
position: fixed; left: 0; top: 0; width: 0; height: 0;
|
|
2636
2676
|
pointer-events: none; z-index: 2147483000;
|
|
2637
|
-
border: 2px solid ${
|
|
2677
|
+
border: 2px solid ${Zi}; border-radius: 6px;
|
|
2638
2678
|
background: rgba(37, 99, 235, 0.12);
|
|
2639
2679
|
box-shadow: 0 0 0 200vmax rgba(15, 23, 42, 0.18);
|
|
2640
2680
|
transition: left 60ms linear, top 60ms linear, width 60ms linear, height 60ms linear;
|
|
@@ -2654,76 +2694,76 @@ const nn = "taplu-picker-style", Yi = "var(--taplu-primary, #2563eb)", Zi = "点
|
|
|
2654
2694
|
color: #93c5fd; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
2655
2695
|
}
|
|
2656
2696
|
`;
|
|
2657
|
-
function
|
|
2697
|
+
function es(t) {
|
|
2658
2698
|
var n;
|
|
2659
2699
|
if (t.getElementById(nn)) return;
|
|
2660
2700
|
const e = t.createElement("style");
|
|
2661
|
-
e.id = nn, e.textContent =
|
|
2701
|
+
e.id = nn, e.textContent = ts, ((n = t.head) != null ? n : t.documentElement).appendChild(e);
|
|
2662
2702
|
}
|
|
2663
|
-
function
|
|
2664
|
-
var $,
|
|
2703
|
+
function ms(t = {}) {
|
|
2704
|
+
var $, M, N, L, S, W, R;
|
|
2665
2705
|
const e = ($ = t.doc) != null ? $ : typeof document == "undefined" ? null : document;
|
|
2666
2706
|
if (!e) return Promise.resolve(null);
|
|
2667
|
-
tt == null || tt(),
|
|
2668
|
-
const n = (N = (
|
|
2707
|
+
tt == null || tt(), es(e);
|
|
2708
|
+
const n = (N = (M = e.defaultView) == null ? void 0 : M.Element) != null ? N : Element, r = (E) => E && E instanceof n ? E : null, o = e.createElement("div");
|
|
2669
2709
|
o.setAttribute("data-taplu-picker", "box");
|
|
2670
2710
|
const i = e.createElement("div");
|
|
2671
|
-
i.setAttribute("data-taplu-picker", "hint"), i.textContent = (L = t.hint) != null ? L :
|
|
2711
|
+
i.setAttribute("data-taplu-picker", "hint"), i.textContent = (L = t.hint) != null ? L : Qi;
|
|
2672
2712
|
const a = e.createElement("code");
|
|
2673
2713
|
i.appendChild(a);
|
|
2674
|
-
const s = (
|
|
2714
|
+
const s = (S = e.body) != null ? S : e.documentElement;
|
|
2675
2715
|
s.appendChild(o), s.appendChild(i);
|
|
2676
|
-
let l = null, c = !1,
|
|
2716
|
+
let l = null, c = !1, f = () => {
|
|
2677
2717
|
};
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
}),
|
|
2718
|
+
const v = new Promise((E) => {
|
|
2719
|
+
f = E;
|
|
2720
|
+
}), m = e.documentElement.style.cursor;
|
|
2681
2721
|
e.documentElement.style.cursor = "crosshair";
|
|
2682
|
-
const
|
|
2722
|
+
const u = (E) => {
|
|
2683
2723
|
var A;
|
|
2684
|
-
return ((A = r(
|
|
2685
|
-
}, y = (
|
|
2686
|
-
if (!
|
|
2724
|
+
return ((A = r(E)) == null ? void 0 : A.closest("[data-taplu-picker]")) !== null;
|
|
2725
|
+
}, y = (E) => {
|
|
2726
|
+
if (!E) {
|
|
2687
2727
|
o.style.width = "0px", o.style.height = "0px", a.textContent = "";
|
|
2688
2728
|
return;
|
|
2689
2729
|
}
|
|
2690
|
-
const A =
|
|
2691
|
-
o.style.left = `${Math.round(A.left)}px`, o.style.top = `${Math.round(A.top)}px`, o.style.width = `${Math.round(A.width)}px`, o.style.height = `${Math.round(A.height)}px`, a.textContent = `已选:${
|
|
2692
|
-
}, h = (
|
|
2730
|
+
const A = E.getBoundingClientRect();
|
|
2731
|
+
o.style.left = `${Math.round(A.left)}px`, o.style.top = `${Math.round(A.top)}px`, o.style.width = `${Math.round(A.width)}px`, o.style.height = `${Math.round(A.height)}px`, a.textContent = `已选:${os(E)}`;
|
|
2732
|
+
}, h = (E) => {
|
|
2693
2733
|
var F;
|
|
2694
|
-
if (
|
|
2695
|
-
const A = r(
|
|
2734
|
+
if (u(E.target)) return;
|
|
2735
|
+
const A = r(E.target);
|
|
2696
2736
|
A !== l && (l = A, y(A), (F = t.onHover) == null || F.call(t, A));
|
|
2697
|
-
}, g = () => y(l),
|
|
2737
|
+
}, g = () => y(l), k = (E) => {
|
|
2698
2738
|
var U;
|
|
2699
|
-
if (
|
|
2700
|
-
|
|
2701
|
-
const A = (U = r(
|
|
2739
|
+
if (u(E.target)) return;
|
|
2740
|
+
E.preventDefault(), E.stopPropagation();
|
|
2741
|
+
const A = (U = r(E.target)) != null ? U : l;
|
|
2702
2742
|
if (!A) return;
|
|
2703
|
-
const F =
|
|
2743
|
+
const F = rs(A, { escalate: !E.altKey });
|
|
2704
2744
|
x({ element: F, target: dr(F, t) });
|
|
2705
|
-
},
|
|
2706
|
-
|
|
2707
|
-
},
|
|
2708
|
-
|
|
2709
|
-
},
|
|
2710
|
-
var
|
|
2711
|
-
e.removeEventListener("mousemove", h, !0), e.removeEventListener("click",
|
|
2745
|
+
}, B = (E) => {
|
|
2746
|
+
E.key === "Escape" && (E.preventDefault(), E.stopPropagation(), x(null));
|
|
2747
|
+
}, I = (E) => {
|
|
2748
|
+
E.preventDefault(), x(null);
|
|
2749
|
+
}, D = () => {
|
|
2750
|
+
var E, A;
|
|
2751
|
+
e.removeEventListener("mousemove", h, !0), e.removeEventListener("click", k, !0), e.removeEventListener("contextmenu", I, !0), e.removeEventListener("scroll", g, !0), e.removeEventListener("keydown", B, !0), (E = e.defaultView) == null || E.removeEventListener("resize", g), (A = t.signal) == null || A.removeEventListener("abort", p), e.documentElement.style.cursor = m, o.remove(), i.remove(), l = null, tt === _ && (tt = null);
|
|
2712
2752
|
};
|
|
2713
|
-
function
|
|
2753
|
+
function p() {
|
|
2714
2754
|
x(null);
|
|
2715
2755
|
}
|
|
2716
|
-
function x(
|
|
2717
|
-
c || (c = !0,
|
|
2756
|
+
function x(E) {
|
|
2757
|
+
c || (c = !0, D(), f(E));
|
|
2718
2758
|
}
|
|
2719
2759
|
const _ = () => x(null);
|
|
2720
|
-
return tt = _, e.addEventListener("mousemove", h, !0), e.addEventListener("click",
|
|
2760
|
+
return tt = _, e.addEventListener("mousemove", h, !0), e.addEventListener("click", k, !0), e.addEventListener("contextmenu", I, !0), e.addEventListener("scroll", g, !0), e.addEventListener("keydown", B, !0), (W = e.defaultView) == null || W.addEventListener("resize", g), (R = t.signal) == null || R.addEventListener("abort", p), v;
|
|
2721
2761
|
}
|
|
2722
|
-
const
|
|
2723
|
-
function
|
|
2762
|
+
const ns = 4;
|
|
2763
|
+
function rs(t, e = {}) {
|
|
2724
2764
|
var o;
|
|
2725
2765
|
if (e.escalate === !1 || t.getAttribute("data-guide")) return t;
|
|
2726
|
-
const n = (o = e.maxDepth) != null ? o :
|
|
2766
|
+
const n = (o = e.maxDepth) != null ? o : ns;
|
|
2727
2767
|
let r = t.parentElement;
|
|
2728
2768
|
for (let i = 0; r && i < n; i += 1) {
|
|
2729
2769
|
if (r.getAttribute("data-guide")) return r;
|
|
@@ -2731,7 +2771,7 @@ function ns(t, e = {}) {
|
|
|
2731
2771
|
}
|
|
2732
2772
|
return t;
|
|
2733
2773
|
}
|
|
2734
|
-
function
|
|
2774
|
+
function os(t) {
|
|
2735
2775
|
var i;
|
|
2736
2776
|
const e = t.tagName.toLowerCase(), n = t.getAttribute("id");
|
|
2737
2777
|
if (n) return `${e}#${n}`;
|
|
@@ -2740,7 +2780,7 @@ function rs(t) {
|
|
|
2740
2780
|
const o = ((i = t.textContent) != null ? i : "").replace(/\s+/g, " ").trim();
|
|
2741
2781
|
return o.length > 0 && o.length <= 20 ? `${e}「${o}」` : e;
|
|
2742
2782
|
}
|
|
2743
|
-
function
|
|
2783
|
+
function is(t, e) {
|
|
2744
2784
|
return {
|
|
2745
2785
|
flowKey: t,
|
|
2746
2786
|
stepId: e,
|
|
@@ -2752,13 +2792,13 @@ function os(t, e) {
|
|
|
2752
2792
|
lastAt: 0
|
|
2753
2793
|
};
|
|
2754
2794
|
}
|
|
2755
|
-
function
|
|
2795
|
+
function hs(t, e = {}) {
|
|
2756
2796
|
var a;
|
|
2757
2797
|
const n = /* @__PURE__ */ new Map(), r = (s, l) => {
|
|
2758
|
-
const c = `${s}\0${l}`,
|
|
2759
|
-
if (
|
|
2760
|
-
const
|
|
2761
|
-
return n.set(c,
|
|
2798
|
+
const c = `${s}\0${l}`, f = n.get(c);
|
|
2799
|
+
if (f) return f;
|
|
2800
|
+
const v = is(s, l);
|
|
2801
|
+
return n.set(c, v), v;
|
|
2762
2802
|
};
|
|
2763
2803
|
for (const s of t) {
|
|
2764
2804
|
const l = r(s.flowKey, s.stepId);
|
|
@@ -2770,48 +2810,48 @@ function ms(t, e = {}) {
|
|
|
2770
2810
|
}), i = (s) => s.missed * 100 + s.degraded * 10 + (s.worstLevel > 1 ? 1 : 0);
|
|
2771
2811
|
return o.sort((s, l) => i(l) - i(s) || l.lastAt - s.lastAt || s.stepId.localeCompare(l.stepId)), o.slice(0, (a = e.limit) != null ? a : 50);
|
|
2772
2812
|
}
|
|
2773
|
-
function
|
|
2813
|
+
function gs(t) {
|
|
2774
2814
|
return t < 0 ? "未命中" : t === 0 ? "首选命中" : `第 ${t + 1} 顺位`;
|
|
2775
2815
|
}
|
|
2776
|
-
const
|
|
2777
|
-
function
|
|
2778
|
-
return { name:
|
|
2816
|
+
const ss = "TapLu", as = "0.1.0-dev.5";
|
|
2817
|
+
function ws() {
|
|
2818
|
+
return { name: ss, version: as };
|
|
2779
2819
|
}
|
|
2780
|
-
function
|
|
2820
|
+
function ys(t = {}) {
|
|
2781
2821
|
var e;
|
|
2782
|
-
return Pr({ ...t, renderer: (e = t.renderer) != null ? e :
|
|
2822
|
+
return Pr({ ...t, renderer: (e = t.renderer) != null ? e : Di() });
|
|
2783
2823
|
}
|
|
2784
2824
|
export {
|
|
2785
|
-
|
|
2786
|
-
|
|
2825
|
+
ss as NAME,
|
|
2826
|
+
ds as createBrowserRouter,
|
|
2787
2827
|
xr as createContinuationStore,
|
|
2788
|
-
|
|
2828
|
+
ys as createFromRenderer,
|
|
2789
2829
|
Pr as createGuide,
|
|
2790
|
-
|
|
2791
|
-
|
|
2830
|
+
us as createHttpStore,
|
|
2831
|
+
cs as createLocalStore,
|
|
2792
2832
|
Mr as createMemoryStore,
|
|
2793
|
-
|
|
2794
|
-
|
|
2833
|
+
ls as createSessionStore,
|
|
2834
|
+
fs as createStaticRouter,
|
|
2795
2835
|
dr as describeTarget,
|
|
2796
|
-
|
|
2836
|
+
Di as driverRenderer,
|
|
2797
2837
|
hr as evaluateCondition,
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2838
|
+
gs as hitLevelLabel,
|
|
2839
|
+
ws as info,
|
|
2840
|
+
vs as isPicking,
|
|
2801
2841
|
Lr as isVisible,
|
|
2802
2842
|
Ae as looksGeneratedId,
|
|
2803
2843
|
gr as matchBranch,
|
|
2804
2844
|
Cr as matchesExpect,
|
|
2805
2845
|
Mr as memoryStore,
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2846
|
+
ms as pickElement,
|
|
2847
|
+
Di as renderer,
|
|
2848
|
+
rs as resolvePickTarget,
|
|
2809
2849
|
Tt as resolveTarget,
|
|
2810
2850
|
Xt as routeMatches,
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2851
|
+
Yi as suggestStepId,
|
|
2852
|
+
hs as summarizeHits,
|
|
2853
|
+
ps as toStep,
|
|
2854
|
+
as as version,
|
|
2815
2855
|
Ir as waitForTarget
|
|
2816
2856
|
};
|
|
2817
2857
|
//# sourceMappingURL=taplu.mjs.map
|