@shiva004/surveys 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,564 +1,407 @@
1
- import { jsxs as r, jsx as e, Fragment as ae } from "react/jsx-runtime";
2
- import ge, { useState as y, useMemo as Y, useRef as _, useCallback as L, useLayoutEffect as xe, useEffect as B, useContext as je, useSyncExternalStore as Ce, createContext as Te } from "react";
3
- import { createPortal as ve } from "react-dom";
4
- const q = ({ label: t, value: a, color: n = "#7c3aed" }) => /* @__PURE__ */ r("div", { className: "stat", style: { borderTopColor: n }, children: [
5
- /* @__PURE__ */ e("div", { className: "stat-label", children: t }),
6
- /* @__PURE__ */ e("div", { className: "stat-value", children: a })
7
- ] }), fe = ({ items: t, value: a, onChange: n }) => /* @__PURE__ */ e("div", { className: "tabs", children: t.map((s) => /* @__PURE__ */ e("button", { type: "button", className: s.id === a ? "tab active" : "tab", onClick: () => n(s.id), children: s.label }, s.id)) }), K = ({ pct: t, color: a = "#7c3aed" }) => /* @__PURE__ */ e("div", { className: "bar", children: /* @__PURE__ */ e("div", { className: "bar-fill", style: { width: `${Math.max(0, Math.min(100, t))}%`, background: a } }) }), ee = ({ title: t, subtitle: a, actions: n, children: s }) => /* @__PURE__ */ r("section", { children: [
8
- /* @__PURE__ */ r("div", { className: "page-head", children: [
9
- /* @__PURE__ */ r("div", { children: [
10
- /* @__PURE__ */ e("h2", { children: t }),
11
- a && /* @__PURE__ */ e("p", { className: "muted", children: a })
12
- ] }),
13
- /* @__PURE__ */ e("div", { className: "actions", children: n })
14
- ] }),
15
- s
16
- ] }), be = (t) => () => {
17
- t |= 0, t = t + 1831565813 | 0;
18
- let a = Math.imul(t ^ t >>> 15, 1 | t);
19
- return a = a + Math.imul(a ^ a >>> 7, 61 | a) ^ a, ((a ^ a >>> 14) >>> 0) / 4294967296;
20
- }, Z = (t) => `${t}_${Math.random().toString(36).slice(2, 8)}`, Ie = ["/home", "/pricing", "/features", "/docs", "/signup", "/dashboard", "/checkout"], Me = [["/home", 0.55], ["/pricing", 0.15], ["/features", 0.15], ["/docs", 0.15]], Ee = {
21
- "/home": [["/pricing", 0.3], ["/features", 0.3], ["/docs", 0.1], ["/signup", 0.1], ["EXIT", 0.2]],
22
- "/pricing": [["/signup", 0.3], ["/features", 0.15], ["/home", 0.1], ["EXIT", 0.45]],
23
- "/features": [["/pricing", 0.3], ["/signup", 0.15], ["/docs", 0.15], ["EXIT", 0.4]],
24
- "/docs": [["/features", 0.2], ["/signup", 0.15], ["/home", 0.1], ["EXIT", 0.55]],
25
- "/signup": [["/dashboard", 0.6], ["EXIT", 0.4]],
26
- "/dashboard": [["/checkout", 0.25], ["/docs", 0.15], ["/features", 0.1], ["EXIT", 0.5]],
27
- "/checkout": [["EXIT", 1]]
28
- }, he = (t, a) => {
29
- let n = 0;
30
- for (const [s, i] of t)
31
- if (n += i, a < n) return s;
32
- return t[t.length - 1][0];
33
- };
34
- function we(t, a) {
35
- return Array.from({ length: t }, () => {
36
- let n = he(Me, a());
37
- const s = [n];
38
- for (; s.length < 8; ) {
39
- const i = he(Ee[n], a());
40
- if (i === "EXIT") break;
41
- s.push(i), n = i;
42
- }
43
- return s;
44
- });
45
- }
46
- const Ae = () => we(400, be(42));
47
- function Pe(t) {
48
- const a = /* @__PURE__ */ new Map(), n = (s) => (a.has(s) || a.set(s, { views: 0, entries: 0, bounces: 0, exits: 0 }), a.get(s));
49
- for (const s of t)
50
- s.forEach((i) => {
51
- n(i).views += 1;
52
- }), n(s[0]).entries += 1, s.length === 1 && (n(s[0]).bounces += 1), n(s[s.length - 1]).exits += 1;
53
- return [...a.entries()].map(([s, i]) => ({
54
- page: s,
55
- views: i.views,
56
- bounceRate: i.entries ? i.bounces / i.entries * 100 : 0,
57
- exitRate: i.views ? i.exits / i.views * 100 : 0
58
- })).sort((s, i) => i.views - s.views);
59
- }
60
- function Re(t, a = 8) {
61
- const n = /* @__PURE__ */ new Map();
62
- for (const s of t) {
63
- const i = s.slice(0, 4), m = i.join(">"), f = n.get(m) ?? { steps: i, users: 0, conv: 0 };
64
- f.users += 1, s.includes("/signup") && (f.conv += 1), n.set(m, f);
65
- }
66
- return [...n.values()].map((s) => ({ steps: s.steps, users: s.users, convRate: s.conv / s.users * 100 })).sort((s, i) => i.users - s.users).slice(0, a);
67
- }
68
- function $e(t) {
69
- const a = /* @__PURE__ */ new Map();
70
- for (const n of t)
71
- for (let s = 0; s < n.length - 1; s++) {
72
- const i = a.get(n[s]) ?? /* @__PURE__ */ new Map();
73
- i.set(n[s + 1], (i.get(n[s + 1]) ?? 0) + 1), a.set(n[s], i);
74
- }
75
- return [...a.entries()].map(([n, s]) => {
76
- const i = [...s.values()].reduce((m, f) => m + f, 0);
77
- return {
78
- from: n,
79
- total: i,
80
- destinations: [...s.entries()].map(([m, f]) => ({ to: m, pct: f / i * 100 })).sort((m, f) => f.pct - m.pct)
81
- };
82
- }).sort((n, s) => s.total - n.total);
1
+ import { jsxs as n, jsx as e, Fragment as V } from "react/jsx-runtime";
2
+ import ue, { useState as j, useEffect as $, useMemo as ae, useCallback as F, useRef as B, useLayoutEffect as oe, useContext as me, useSyncExternalStore as pe, createContext as ge } from "react";
3
+ import { createPortal as le } from "react-dom";
4
+ const fe = ["Ease of use", "Performance", "Design & appearance", "Features", "Navigation", "Something else"], ve = ["", "Poor", "Fair", "Good", "Very good", "Excellent"];
5
+ function we({ rating: t, onRate: a }) {
6
+ const [i, s] = j(0), o = i || t;
7
+ return /* @__PURE__ */ n(V, { children: [
8
+ /* @__PURE__ */ e("div", { className: "rating", role: "radiogroup", "aria-label": "Star rating", onMouseLeave: () => s(0), children: [1, 2, 3, 4, 5].map((u) => /* @__PURE__ */ e(
9
+ "button",
10
+ {
11
+ type: "button",
12
+ role: "radio",
13
+ "aria-checked": t === u,
14
+ "aria-label": `${u} star${u > 1 ? "s" : ""}`,
15
+ className: `star ${u <= o ? "active" : ""}`,
16
+ onMouseEnter: () => s(u),
17
+ onFocus: () => s(u),
18
+ onBlur: () => s(0),
19
+ onClick: () => a(u),
20
+ children: "★"
21
+ },
22
+ u
23
+ )) }),
24
+ /* @__PURE__ */ e("div", { className: "hint", children: o ? `${o} out of 5 · ${ve[o]}` : "Select a rating to continue" })
25
+ ] });
83
26
  }
84
- const Le = (t, a) => t.length ? t.filter((n) => n.some((s) => a.includes(s))).length / t.length * 100 : 0, qe = {
85
- id: "jm1",
86
- name: "New customer journey",
87
- stages: [
88
- { id: "st1", name: "Awareness", emotion: "curious", pages: ["/home"] },
89
- { id: "st2", name: "Consideration", emotion: "analytical", pages: ["/pricing", "/features"] },
90
- { id: "st3", name: "Sign up", emotion: "confident", pages: ["/signup"] },
91
- { id: "st4", name: "Activation", emotion: "engaged", pages: ["/dashboard"] },
92
- { id: "st5", name: "Purchase", emotion: "satisfied", pages: ["/checkout"] }
93
- ]
94
- }, Oe = [
95
- { id: "nav", label: "Navigation Analysis" },
96
- { id: "paths", label: "Paths" },
97
- { id: "flows", label: "Userflows" },
98
- { id: "maps", label: "Journey Maps" }
99
- ], ue = { curious: "#adc6ff", analytical: "#7c3aed", confident: "#4edea3", engaged: "#d2bbff", satisfied: "#ffcc6b", cautious: "#ffb4ab" }, _e = (t) => t.split("/").filter(Boolean).pop() ?? t, Fe = (t) => t > 25 ? "#ffb4ab" : t > 15 ? "#ffcc6b" : "#4edea3", De = () => {
100
- var u;
101
- const [t, a] = y("nav"), [n, s] = y(Ae), [i, m] = y(qe), f = Y(() => Pe(n), [n]), g = Y(() => Re(n), [n]), w = Y(() => $e(n), [n]), c = f.reduce((h, l) => h + l.views, 0), d = n.length, o = n.filter((h) => h.length === 1).length;
102
- return /* @__PURE__ */ r(
103
- ee,
104
- {
105
- title: "User Journey",
106
- subtitle: "One stream of page views feeds every view below.",
107
- actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => s((h) => [...h, ...we(50, Math.random)]), children: "+ Simulate 50 sessions" }),
108
- children: [
109
- /* @__PURE__ */ r("div", { className: "stats", children: [
110
- /* @__PURE__ */ e(q, { label: "Sessions", value: d.toLocaleString(), color: "#6366f1" }),
111
- /* @__PURE__ */ e(q, { label: "Page views", value: c.toLocaleString(), color: "#0ea5e9" }),
112
- /* @__PURE__ */ e(q, { label: "Bounce rate", value: `${d ? (o / d * 100).toFixed(1) : 0}%`, color: "#f59e0b" }),
113
- /* @__PURE__ */ e(q, { label: "Top page", value: ((u = f[0]) == null ? void 0 : u.page) ?? "—", color: "#10b981" })
114
- ] }),
115
- /* @__PURE__ */ e(fe, { items: Oe, value: t, onChange: a }),
116
- t === "nav" && /* @__PURE__ */ r("table", { className: "table", children: [
117
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
118
- /* @__PURE__ */ e("th", { children: "Page" }),
119
- /* @__PURE__ */ e("th", { children: "Views" }),
120
- /* @__PURE__ */ e("th", { children: "Share" }),
121
- /* @__PURE__ */ e("th", { children: "Bounce rate" }),
122
- /* @__PURE__ */ e("th", { children: "Exit rate" })
123
- ] }) }),
124
- /* @__PURE__ */ e("tbody", { children: f.map((h) => /* @__PURE__ */ r("tr", { children: [
125
- /* @__PURE__ */ e("td", { className: "mono", children: h.page }),
126
- /* @__PURE__ */ e("td", { className: "mono", children: h.views }),
127
- /* @__PURE__ */ e("td", { style: { minWidth: 120 }, children: /* @__PURE__ */ e(K, { pct: h.views / c * 100 }) }),
128
- /* @__PURE__ */ r("td", { className: "mono", style: { color: Fe(h.bounceRate) }, children: [
129
- h.bounceRate.toFixed(1),
130
- "%"
131
- ] }),
132
- /* @__PURE__ */ r("td", { className: "mono", children: [
133
- h.exitRate.toFixed(1),
134
- "%"
135
- ] })
136
- ] }, h.page)) })
137
- ] }),
138
- t === "paths" && /* @__PURE__ */ e("div", { className: "grid", children: g.map((h, l) => /* @__PURE__ */ r("div", { className: "card", children: [
139
- /* @__PURE__ */ r("div", { className: "row", children: [
140
- /* @__PURE__ */ r("span", { className: "pill passive", children: [
141
- "#",
142
- l + 1
143
- ] }),
144
- /* @__PURE__ */ e("span", { className: "grow" }),
145
- /* @__PURE__ */ r("span", { className: "mono small", children: [
146
- h.convRate.toFixed(1),
147
- "% reach signup"
148
- ] })
149
- ] }),
150
- /* @__PURE__ */ e("div", { className: "steps", title: h.steps.join(" → "), children: h.steps.map((k, v) => /* @__PURE__ */ r(ge.Fragment, { children: [
151
- v > 0 && /* @__PURE__ */ e("span", { className: "muted", children: "→" }),
152
- /* @__PURE__ */ e("span", { className: "chip static", children: _e(k) })
153
- ] }, v)) }),
154
- /* @__PURE__ */ r("div", { className: "small muted", children: [
155
- h.users,
156
- " users"
157
- ] }),
158
- /* @__PURE__ */ e(K, { pct: h.convRate, color: "#10b981" })
159
- ] }, h.steps.join(">"))) }),
160
- t === "flows" && /* @__PURE__ */ e("div", { className: "grid", children: w.map((h) => /* @__PURE__ */ r("div", { className: "card", children: [
161
- /* @__PURE__ */ r("div", { className: "row", children: [
162
- /* @__PURE__ */ e("strong", { className: "mono", children: h.from }),
163
- /* @__PURE__ */ e("span", { className: "grow" }),
164
- /* @__PURE__ */ r("span", { className: "small muted", children: [
165
- h.total,
166
- " transitions"
167
- ] })
168
- ] }),
169
- h.destinations.slice(0, 4).map((l) => /* @__PURE__ */ r("div", { children: [
170
- /* @__PURE__ */ r("div", { className: "row small", children: [
171
- /* @__PURE__ */ r("span", { className: "mono", children: [
172
- "→ ",
173
- l.to
174
- ] }),
175
- /* @__PURE__ */ e("span", { className: "grow" }),
176
- /* @__PURE__ */ r("span", { className: "mono", children: [
177
- l.pct.toFixed(0),
178
- "%"
179
- ] })
180
- ] }),
181
- /* @__PURE__ */ e(K, { pct: l.pct })
182
- ] }, l.to))
183
- ] }, h.from)) }),
184
- t === "maps" && /* @__PURE__ */ e(Je, { map: i, setMap: m, sessions: n })
185
- ]
186
- }
187
- );
188
- }, Je = ({ map: t, setMap: a, sessions: n }) => {
189
- const [s, i] = y(""), [m, f] = y("curious"), [g, w] = y([]), [c, d] = y(""), o = () => {
190
- if (!s.trim()) return d("Stage name is required.");
191
- if (g.length === 0) return d("Pick at least one touchpoint page.");
192
- const u = { id: Z("st"), name: s.trim(), emotion: m, pages: g };
193
- a({ ...t, stages: [...t.stages, u] }), i(""), w([]), d("");
194
- };
195
- return /* @__PURE__ */ r("div", { className: "stack", children: [
196
- /* @__PURE__ */ e("input", { className: "input", value: t.name, onChange: (u) => a({ ...t, name: u.target.value }), "aria-label": "Journey name" }),
197
- /* @__PURE__ */ r("div", { className: "stages", children: [
198
- t.stages.map((u, h) => {
199
- const l = Le(n, u.pages), k = ue[u.emotion] ?? "#7c3aed";
200
- return /* @__PURE__ */ r("div", { className: "card stage", children: [
201
- /* @__PURE__ */ r("div", { className: "row", children: [
202
- /* @__PURE__ */ e("span", { className: "badge", style: { background: `${k}30`, color: k }, children: h + 1 }),
203
- /* @__PURE__ */ e("strong", { children: u.name }),
204
- /* @__PURE__ */ e("span", { className: "grow" }),
205
- /* @__PURE__ */ e("button", { className: "btn danger", "aria-label": `Remove ${u.name}`, onClick: () => a({ ...t, stages: t.stages.filter((v) => v.id !== u.id) }), children: "✕" })
206
- ] }),
207
- u.pages.map((v) => /* @__PURE__ */ r("div", { className: "small mono muted", children: [
208
- "✓ ",
209
- v
210
- ] }, v)),
211
- /* @__PURE__ */ r("div", { className: "small", style: { color: k }, children: [
212
- "Emotion: ",
213
- u.emotion
214
- ] }),
215
- /* @__PURE__ */ e(K, { pct: l }),
216
- /* @__PURE__ */ r("div", { className: "small mono muted", children: [
217
- l.toFixed(0),
218
- "% reach"
219
- ] })
220
- ] }, u.id);
221
- }),
222
- t.stages.length === 0 && /* @__PURE__ */ e("div", { className: "muted", children: "No stages yet. Add one below." })
27
+ function be({ onClose: t }) {
28
+ const [a, i] = j(1), [s, o] = j(0), [u, T] = j([]), [g, N] = j(""), d = (l) => T((h) => h.includes(l) ? h.filter((b) => b !== l) : [...h, l]);
29
+ return /* @__PURE__ */ e("div", { className: "overlay", onClick: (l) => {
30
+ l.target === l.currentTarget && t();
31
+ }, children: /* @__PURE__ */ n("div", { className: "modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "survey-title", children: [
32
+ /* @__PURE__ */ e("button", { className: "close", onClick: t, "aria-label": "Close survey", children: "×" }),
33
+ /* @__PURE__ */ e("div", { className: "progress", children: [1, 2, 3, 4].map((l) => /* @__PURE__ */ e("span", { className: l <= a ? "done" : "" }, l)) }),
34
+ a === 1 && /* @__PURE__ */ n(V, { children: [
35
+ /* @__PURE__ */ e("div", { className: "label", children: "Step 01 / 04 · Quick rating" }),
36
+ /* @__PURE__ */ e("h2", { id: "survey-title", children: "How was your experience?" }),
37
+ /* @__PURE__ */ e("p", { className: "desc", children: "Your feedback helps us make things better." }),
38
+ /* @__PURE__ */ e(we, { rating: s, onRate: o }),
39
+ /* @__PURE__ */ n("div", { className: "actions", children: [
40
+ /* @__PURE__ */ e("button", { className: "btn secondary", onClick: t, children: "Cancel" }),
41
+ /* @__PURE__ */ e("button", { className: "btn", disabled: !s, onClick: () => i(2), children: "Next →" })
42
+ ] })
223
43
  ] }),
224
- /* @__PURE__ */ r("div", { className: "card form", children: [
225
- /* @__PURE__ */ e("strong", { children: "Add stage" }),
226
- /* @__PURE__ */ r("div", { className: "row", children: [
227
- /* @__PURE__ */ e("input", { className: "input", placeholder: "Stage name", value: s, onChange: (u) => i(u.target.value) }),
228
- /* @__PURE__ */ e("select", { className: "input slim", value: m, onChange: (u) => f(u.target.value), children: Object.keys(ue).map((u) => /* @__PURE__ */ e("option", { children: u }, u)) })
229
- ] }),
230
- /* @__PURE__ */ e("div", { className: "scale", children: Ie.map((u) => /* @__PURE__ */ e("button", { type: "button", className: g.includes(u) ? "chip active" : "chip", onClick: () => w((h) => h.includes(u) ? h.filter((l) => l !== u) : [...h, u]), children: u }, u)) }),
231
- /* @__PURE__ */ r("div", { className: "row", children: [
232
- /* @__PURE__ */ e("span", { className: "grow" }),
233
- c && /* @__PURE__ */ e("span", { className: "error", children: c }),
234
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: o, children: "+ Add stage" })
44
+ a === 2 && /* @__PURE__ */ n(V, { children: [
45
+ /* @__PURE__ */ e("div", { className: "label", children: "Step 02 / 04 · What matters?" }),
46
+ /* @__PURE__ */ e("h2", { id: "survey-title", children: "What would you like us to improve?" }),
47
+ /* @__PURE__ */ e("p", { className: "desc", children: "Choose all that apply." }),
48
+ /* @__PURE__ */ e("div", { className: "choices", children: fe.map((l) => /* @__PURE__ */ n("label", { className: `choice ${u.includes(l) ? "checked" : ""}`, children: [
49
+ /* @__PURE__ */ e("input", { type: "checkbox", checked: u.includes(l), onChange: () => d(l) }),
50
+ l
51
+ ] }, l)) }),
52
+ /* @__PURE__ */ n("div", { className: "actions", children: [
53
+ /* @__PURE__ */ e("button", { className: "btn secondary", onClick: () => i(1), children: "← Back" }),
54
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => i(3), children: "Next →" })
235
55
  ] })
56
+ ] }),
57
+ a === 3 && /* @__PURE__ */ n(V, { children: [
58
+ /* @__PURE__ */ e("div", { className: "label", children: "Step 03 / 04 · Your thoughts" }),
59
+ /* @__PURE__ */ e("h2", { id: "survey-title", children: "Anything else you'd like to share?" }),
60
+ /* @__PURE__ */ e("p", { className: "desc", children: "Comments are optional." }),
61
+ /* @__PURE__ */ e(
62
+ "textarea",
63
+ {
64
+ className: "field",
65
+ placeholder: "Share your thoughts, ideas, or suggestions...",
66
+ value: g,
67
+ onChange: (l) => N(l.target.value)
68
+ }
69
+ ),
70
+ /* @__PURE__ */ n("div", { className: "actions", children: [
71
+ /* @__PURE__ */ e("button", { className: "btn secondary", onClick: () => i(2), children: "← Back" }),
72
+ /* @__PURE__ */ e("button", { className: "btn", onClick: () => i(4), children: "Submit →" })
73
+ ] })
74
+ ] }),
75
+ a === 4 && /* @__PURE__ */ n("div", { className: "success", children: [
76
+ /* @__PURE__ */ e("div", { className: "success-mark", children: "✓" }),
77
+ /* @__PURE__ */ e("div", { className: "label", children: "Step 04 / 04 · Completed" }),
78
+ /* @__PURE__ */ e("h2", { id: "survey-title", children: "Thank you for your feedback!" }),
79
+ /* @__PURE__ */ n("p", { children: [
80
+ "This is a preview, so your response (",
81
+ s,
82
+ " ★) isn't sent anywhere."
83
+ ] }),
84
+ /* @__PURE__ */ e("button", { className: "btn", onClick: t, children: "Done" })
236
85
  ] })
86
+ ] }) });
87
+ }
88
+ const ye = () => {
89
+ const [t, a] = j(!1);
90
+ return $(() => {
91
+ if (!t) return;
92
+ const i = (o) => {
93
+ o.key === "Escape" && a(!1);
94
+ };
95
+ document.addEventListener("keydown", i);
96
+ const s = document.body.style.overflow;
97
+ return document.body.style.overflow = "hidden", () => {
98
+ document.removeEventListener("keydown", i), document.body.style.overflow = s;
99
+ };
100
+ }, [t]), /* @__PURE__ */ n("div", { className: "fb-root", children: [
101
+ /* @__PURE__ */ e("main", { className: "page", children: /* @__PURE__ */ e("button", { className: "btn", onClick: () => a(!0), children: "Preview Feedback" }) }),
102
+ t && /* @__PURE__ */ e(be, { onClose: () => a(!1) })
237
103
  ] });
238
- }, oe = (t) => new Date(Date.UTC(2026, 10, 6) - t * 864e5).toISOString(), Be = [
104
+ }, se = {
105
+ login: { name: "login.logger.log", lines: [
106
+ { t: "09:14:02", l: "INFO", m: "Login request received for user=jdoe@example.com", d: { meaning: "Normal event. The login flow started.", fix: "Nothing to do." } },
107
+ { t: "09:14:02", l: "DEBUG", m: "Validating credentials payload (fields: email, password)", d: { meaning: "Extra detail for developers while tracing a request.", fix: "Nothing to do." } },
108
+ { t: "09:14:03", l: "DEBUG", m: "Looking up user record in users table", d: { meaning: "Shows which step the app is on. Useful to see where a flow stops.", fix: "Nothing to do." } },
109
+ { t: "09:14:04", l: "WARN", m: "Password attempt 2 of 3 for user=jdoe@example.com", d: { meaning: "Something unusual, but the app kept going. A third failure will lock the account.", fix: "Ask the user to reset the password if this repeats." } },
110
+ { t: "09:14:05", l: "ERROR", m: "Authentication failed: invalid credentials (HTTP 401)", d: { meaning: "The login was rejected. The server answered 401, so the email or password did not match.", fix: "Check the typed credentials, then confirm the account exists and is not locked.", stack: `AuthError: invalid credentials
111
+ at AuthService.verify (auth.service.js:88:15)
112
+ at async login (login.controller.js:42:9)` } },
113
+ { t: "09:14:35", l: "INFO", m: "Retry allowed after 30s cooldown", d: { meaning: "Normal event. The user may try again.", fix: "Nothing to do." } },
114
+ { t: "09:14:51", l: "WARN", m: "Session cookie missing SameSite attribute", d: { meaning: "Login works, but some browsers may block the cookie later.", fix: "Set SameSite=Lax (or Strict) when the cookie is created." } },
115
+ { t: "09:15:10", l: "INFO", m: "Login succeeded for user=jdoe@example.com session=a91f3c", d: { meaning: "Normal event. The login worked on the retry.", fix: "Nothing to do." } },
116
+ { t: "09:15:42", l: "ERROR", m: "Token refresh failed: network timeout after 5000ms", d: { meaning: "The app could not reach the auth server in time, so the session may expire.", fix: "Check the Network tab for the refresh request and the server response time.", stack: `TimeoutError: 5000ms exceeded
117
+ at refreshToken (token.service.js:57:11)` } }
118
+ ] },
119
+ console: { name: "console.log", lines: [
120
+ { t: "09:10:11", l: "INFO", m: "[vite] connected.", d: { meaning: "Normal event. The dev server connected.", fix: "Nothing to do." } },
121
+ { t: "09:10:12", l: "WARN", m: 'Warning: Each child in a list should have a unique "key" prop.', d: { meaning: "React warns that list items have no stable key. The page works, but updates may be slow or glitchy.", fix: "Add a unique key prop to each item rendered in the list." } },
122
+ { t: "09:10:14", l: "ERROR", m: "Uncaught TypeError: Cannot read properties of undefined (reading 'name')", d: { meaning: "The code read .name from a value that was undefined, so the component crashed.", fix: "Open the file and line in the stack trace, and check why the value is missing.", stack: `TypeError: Cannot read properties of undefined (reading 'name')
123
+ at ProfileCard (ProfileCard.jsx:14:28)
124
+ at renderWithHooks (react-dom.js:1482:18)` } },
125
+ { t: "09:10:14", l: "DEBUG", m: "Rendering <ProfileCard /> props={ user: undefined }", d: { meaning: "This line shows the cause: user was undefined when the card rendered.", fix: "Make sure the profile request finished before rendering." } },
126
+ { t: "09:10:15", l: "ERROR", m: "GET /api/profile 500 (Internal Server Error)", d: { meaning: "The server failed while handling the request. This explains the missing user above.", fix: "Check the server logs for this request and its error.", stack: `GET /api/profile
127
+ Status: 500
128
+ Request-Id: req_7f2c9` } },
129
+ { t: "09:10:19", l: "WARN", m: "Deprecated API: componentWillMount will be removed", d: { meaning: "Still works today, but will break in a future upgrade.", fix: "Move the logic to componentDidMount or a useEffect hook." } },
130
+ { t: "09:10:21", l: "INFO", m: "Route changed: /login → /dashboard", d: { meaning: "Normal event.", fix: "Nothing to do." } }
131
+ ] },
132
+ debug: { name: "app.debug.log", lines: [
133
+ { t: "09:00:01", l: "INFO", m: "Application initialized successfully", d: { meaning: "Normal event.", fix: "Nothing to do." } },
134
+ { t: "09:00:02", l: "DEBUG", m: "Config loaded from /etc/app/config.json", d: { meaning: "Developer detail.", fix: "Nothing to do." } },
135
+ { t: "09:00:04", l: "WARN", m: "Image resource took longer than expected (assets/profile.webp)", d: { meaning: "A slow asset. The page still loads.", fix: "Compress the image or serve it from a CDN." } }
136
+ ] }
137
+ }, Ne = ["ALL", "ERROR", "WARN", "INFO", "DEBUG"], Y = [
239
138
  {
240
- id: "s1",
241
- name: "Q4 Product Satisfaction",
242
- description: "How do users feel about the product right now?",
243
- status: "active",
244
- target: 100,
245
- createdAt: oe(30),
246
- questions: [
247
- { id: "s1q1", type: "nps", text: "How likely are you to recommend us to a colleague?", required: !0 },
248
- { id: "s1q2", type: "rating", text: "How satisfied are you with the product?", required: !0 },
249
- { id: "s1q3", type: "multiple_choice", text: "Which feature do you use most?", required: !1, options: ["Feature Flags", "Experiments", "Segments", "Audit Log"] },
250
- { id: "s1q4", type: "open_text", text: "What is one thing we should improve?", required: !1 }
251
- ]
139
+ target: "titlebar",
140
+ place: "bottom",
141
+ title: "Meet the Log Viewer",
142
+ body: "The Log Viewer shows what your application recorded while it ran. When something breaks, it is the first place to look to find out what happened and why.",
143
+ enter: (t) => {
144
+ t.setFile("login"), t.setLevel("ALL"), t.setQuery(""), t.setSel(null);
145
+ }
252
146
  },
253
147
  {
254
- id: "s2",
255
- name: "Onboarding Experience",
256
- description: "First-week feedback from new accounts.",
257
- status: "draft",
258
- target: 50,
259
- createdAt: oe(5),
260
- questions: [
261
- { id: "s2q1", type: "nps", text: "How likely are you to recommend our onboarding?", required: !0 },
262
- { id: "s2q2", type: "open_text", text: "What was confusing?", required: !1 }
263
- ]
148
+ target: "files",
149
+ place: "right",
150
+ title: "Open a log file",
151
+ body: "Every log file lives in this list. Click one to open it. Each file records a different part of the app: login activity, browser console output, or general debug messages. The number shows how many lines it holds.",
152
+ enter: (t) => {
153
+ t.setFile("login"), t.setLevel("ALL"), t.setSel(null);
154
+ }
155
+ },
156
+ {
157
+ target: "logpane",
158
+ place: "top",
159
+ title: "Inspect login.logger.log",
160
+ body: "This file records every step of the login flow, one line per event: a line number, the time, a level, and a message. Read it top to bottom to follow what happened in order. Click any line to see more about it.",
161
+ enter: (t) => {
162
+ t.setFile("login"), t.setLevel("ALL"), t.setQuery(""), t.setSel(null);
163
+ }
164
+ },
165
+ {
166
+ target: "filters",
167
+ place: "bottom",
168
+ title: "Find console errors fast",
169
+ body: "Open console.log, which holds what the browser console printed, then press the Error filter. Only the red lines are left, such as an uncaught TypeError or a failed request. The search box narrows it down further.",
170
+ enter: (t) => {
171
+ t.setFile("console"), t.setLevel("ERROR"), t.setQuery(""), t.setSel(null);
172
+ }
173
+ },
174
+ {
175
+ target: "details",
176
+ place: "left",
177
+ title: "Read errors and warnings",
178
+ body: "Select a line and its details appear here: what the message means, a suggested fix, and the stack trace showing the exact file and line. Levels tell you how serious a line is.",
179
+ legend: !0,
180
+ enter: (t) => {
181
+ t.setFile("login"), t.setLevel("ALL"), t.setQuery(""), t.setSel(4);
182
+ }
183
+ },
184
+ {
185
+ target: "summary",
186
+ place: "bottom",
187
+ title: "Debug problems with it",
188
+ body: "Use these counters to see how healthy a session was. Start with the errors, read the warnings around them, then follow the debug lines before an error to find the cause. Fix it, reload, and check that the error is gone.",
189
+ enter: (t) => {
190
+ t.setFile("console"), t.setLevel("ALL"), t.setQuery(""), t.setSel(2);
191
+ }
264
192
  }
265
- ], me = ["Love the rollout controls", "Dashboards load slowly", "Needs better docs", "Great support", "Too many clicks to create a flag"];
266
- function We() {
267
- const t = be(7);
268
- return Array.from({ length: 36 }, (a, n) => {
269
- const s = Math.min(10, Math.floor(t() * t() * 4 + t() * 8 + 3));
270
- return {
271
- id: `r${n}`,
272
- surveyId: "s1",
273
- userId: `user_${100 + n}`,
274
- createdAt: oe(Math.floor(t() * 28)),
275
- answers: [
276
- { questionId: "s1q1", value: s },
277
- { questionId: "s1q2", value: Math.max(1, Math.min(5, Math.round(s / 2))) },
278
- { questionId: "s1q3", value: ["Feature Flags", "Experiments", "Segments", "Audit Log"][Math.floor(t() * 4)] },
279
- { questionId: "s1q4", value: me[Math.floor(t() * me.length)] }
280
- ]
193
+ ];
194
+ function ke({ step: t, total: a, onNext: i, onBack: s, onClose: o }) {
195
+ const u = Y[t], T = B(null), [g, N] = j(null), [d, l] = j({ w: 340, h: 260 }), [h, b] = j({ w: window.innerWidth, h: window.innerHeight }), m = F(() => {
196
+ const r = document.querySelector(`[data-tour="${u.target}"]`);
197
+ if (b({ w: window.innerWidth, h: window.innerHeight }), !r) {
198
+ N(null);
199
+ return;
200
+ }
201
+ const f = r.getBoundingClientRect(), S = 8, M = Math.max(4, f.left - S), y = Math.max(4, f.top - S), P = Math.min(window.innerWidth - 8, f.width + S * 2) - Math.max(0, 4 - (f.left - S)), A = Math.min(f.height + S * 2, window.innerHeight - 8);
202
+ N({ x: M, y, w: P, h: A });
203
+ }, [u.target]);
204
+ $(() => {
205
+ const f = [setTimeout(() => {
206
+ const S = document.querySelector(`[data-tour="${u.target}"]`);
207
+ S && S.scrollIntoView({ block: "center", behavior: "smooth" });
208
+ }, 60), ...[0, 120, 300, 550, 800].map((S) => setTimeout(m, S))];
209
+ return () => f.forEach(clearTimeout);
210
+ }, [t, m, u.target]), $(() => (window.addEventListener("resize", m), window.addEventListener("scroll", m, !0), () => {
211
+ window.removeEventListener("resize", m), window.removeEventListener("scroll", m, !0);
212
+ }), [m]), oe(() => {
213
+ T.current && l({ w: T.current.offsetWidth, h: T.current.offsetHeight });
214
+ }, [t, h.w]), $(() => {
215
+ const r = (f) => {
216
+ f.key === "ArrowRight" ? (f.preventDefault(), i()) : f.key === "ArrowLeft" ? (f.preventDefault(), s()) : f.key === "Escape" && o();
281
217
  };
282
- });
283
- }
284
- const pe = (t) => t >= 9 ? "promoter" : t >= 7 ? "passive" : "detractor";
285
- function le(t) {
286
- if (t.length === 0) return null;
287
- const a = t.filter((s) => s >= 9).length, n = t.filter((s) => s <= 6).length;
288
- return {
289
- score: Math.round((a - n) / t.length * 100),
290
- promoters: a,
291
- passives: t.length - a - n,
292
- detractors: n,
293
- total: t.length
294
- };
295
- }
296
- function ce(t, a) {
297
- const n = t.questions.find((s) => s.type === "nps");
298
- return n ? a.filter((s) => s.surveyId === t.id).map((s) => {
299
- var i;
300
- return (i = s.answers.find((m) => m.questionId === n.id)) == null ? void 0 : i.value;
301
- }).filter((s) => typeof s == "number") : [];
302
- }
303
- const He = ["nps", "rating", "multiple_choice", "open_text"], ye = (t) => new Date(t).toLocaleDateString(void 0, { day: "2-digit", month: "short", year: "numeric" }), Xe = () => {
304
- const [t, a] = y(Be), [n, s] = y(We), [i, m] = y({ name: "list" }), f = (o) => t.find((u) => u.id === o), g = () => m({ name: "list" });
305
- if (i.name === "create")
306
- return /* @__PURE__ */ e(
307
- Ue,
308
- {
309
- onCancel: g,
310
- onSave: (o) => {
311
- a((u) => [o, ...u]), g();
312
- }
313
- }
314
- );
315
- if (i.name === "take") {
316
- const o = f(i.id);
317
- return o ? /* @__PURE__ */ e(
318
- Ve,
319
- {
320
- survey: o,
321
- onCancel: g,
322
- onSubmit: (u) => {
323
- s((h) => [{ id: Z("r"), surveyId: o.id, userId: `user_${900 + h.length}`, createdAt: (/* @__PURE__ */ new Date()).toISOString(), answers: u }, ...h]), m({ name: "results", id: o.id });
324
- }
325
- }
326
- ) : null;
327
- }
328
- if (i.name === "results") {
329
- const o = f(i.id);
330
- return o ? /* @__PURE__ */ e(Ye, { survey: o, responses: n.filter((u) => u.surveyId === o.id), onBack: g, onTake: () => m({ name: "take", id: o.id }) }) : null;
218
+ return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
219
+ }, [i, s, o]), $(() => {
220
+ var r;
221
+ (r = T.current) == null || r.focus({ preventScroll: !0 });
222
+ }, [t]);
223
+ const p = g || { x: h.w / 2, y: h.h / 2, w: 0, h: 0 }, q = `polygon(0 0, 0 100%, ${p.x}px 100%, ${p.x}px ${p.y}px, ${p.x + p.w}px ${p.y}px, ${p.x + p.w}px ${p.y + p.h}px, ${p.x}px ${p.y + p.h}px, ${p.x}px 100%, 100% 100%, 100% 0)`, w = 14, k = 16, O = h.w < 700, E = Math.min(360, h.w - w * 2), c = d.h;
224
+ let W = { left: (h.w - E) / 2, top: Math.max(w, (h.h - c) / 2) };
225
+ if (g) {
226
+ const r = g.x + g.w / 2 - E / 2, f = g.y + g.h / 2 - c / 2, S = (I) => Math.min(Math.max(w, I), h.w - E - w), M = (I) => Math.min(Math.max(w, I), h.h - c - w), y = {
227
+ right: { ok: g.x + g.w + k + E <= h.w - w, left: g.x + g.w + k, top: M(f) },
228
+ left: { ok: g.x - k - E >= w, left: g.x - k - E, top: M(f) },
229
+ bottom: { ok: g.y + g.h + k + c <= h.h - w, left: S(r), top: g.y + g.h + k },
230
+ top: { ok: g.y - k - c >= w, left: S(r), top: g.y - k - c }
231
+ }, A = (O ? ["bottom", "top"] : [u.place, "right", "left", "bottom", "top"]).find((I) => y[I].ok);
232
+ W = A ? { left: y[A].left, top: y[A].top } : { left: O ? (h.w - E) / 2 : h.w - E - w, top: h.h - c - w };
331
233
  }
332
- const w = n.length, c = t.filter((o) => o.status === "active").length, d = le(t.flatMap((o) => ce(o, n)));
333
- return /* @__PURE__ */ r(
334
- ee,
335
- {
336
- title: "Surveys",
337
- subtitle: "Create, run and measure user surveys.",
338
- actions: /* @__PURE__ */ e("button", { className: "btn primary", onClick: () => m({ name: "create" }), children: "+ Create Survey" }),
339
- children: [
340
- /* @__PURE__ */ r("div", { className: "stats", children: [
341
- /* @__PURE__ */ e(q, { label: "Total surveys", value: t.length, color: "#6366f1" }),
342
- /* @__PURE__ */ e(q, { label: "Active", value: c, color: "#10b981" }),
343
- /* @__PURE__ */ e(q, { label: "Total responses", value: w }),
344
- /* @__PURE__ */ e(q, { label: "Overall NPS", value: d ? d.score : "—", color: "#f59e0b" })
234
+ const D = t === 0, x = t === a - 1;
235
+ return /* @__PURE__ */ n("div", { className: "tour-root", role: "dialog", "aria-modal": "true", "aria-labelledby": "tour-title", children: [
236
+ /* @__PURE__ */ e("div", { className: "tour-dim", style: { clipPath: q, WebkitClipPath: q }, onClick: (r) => r.stopPropagation() }),
237
+ g && /* @__PURE__ */ e("div", { className: "tour-ring", style: { left: g.x, top: g.y, width: g.w, height: g.h } }),
238
+ /* @__PURE__ */ n("div", { className: "tour-tip", ref: T, tabIndex: -1, style: { width: E, left: W.left, top: W.top }, children: [
239
+ /* @__PURE__ */ n("div", { className: "tip-head", children: [
240
+ /* @__PURE__ */ n("span", { className: "counter", "aria-live": "polite", children: [
241
+ t + 1,
242
+ "/",
243
+ a
345
244
  ] }),
346
- /* @__PURE__ */ r("table", { className: "table", children: [
347
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
348
- /* @__PURE__ */ e("th", { children: "Survey" }),
349
- /* @__PURE__ */ e("th", { children: "Status" }),
350
- /* @__PURE__ */ e("th", { children: "Progress" }),
351
- /* @__PURE__ */ e("th", { children: "NPS" }),
352
- /* @__PURE__ */ e("th", { children: "Created" }),
353
- /* @__PURE__ */ e("th", {})
354
- ] }) }),
355
- /* @__PURE__ */ e("tbody", { children: t.map((o) => {
356
- const u = n.filter((l) => l.surveyId === o.id).length, h = le(ce(o, n));
357
- return /* @__PURE__ */ r("tr", { children: [
358
- /* @__PURE__ */ r("td", { children: [
359
- /* @__PURE__ */ e("strong", { children: o.name }),
360
- /* @__PURE__ */ r("div", { className: "muted small", children: [
361
- o.questions.length,
362
- " questions"
363
- ] })
364
- ] }),
365
- /* @__PURE__ */ e("td", { children: /* @__PURE__ */ e(
366
- "select",
367
- {
368
- className: "input slim",
369
- value: o.status,
370
- onChange: (l) => a((k) => k.map((v) => v.id === o.id ? { ...v, status: l.target.value } : v)),
371
- children: ["draft", "active", "paused", "closed"].map((l) => /* @__PURE__ */ e("option", { children: l }, l))
372
- }
373
- ) }),
374
- /* @__PURE__ */ r("td", { style: { minWidth: 140 }, children: [
375
- /* @__PURE__ */ r("div", { className: "small mono", children: [
376
- u,
377
- " / ",
378
- o.target
379
- ] }),
380
- /* @__PURE__ */ e(K, { pct: u / o.target * 100 })
381
- ] }),
382
- /* @__PURE__ */ e("td", { className: "mono", children: h ? h.score : "—" }),
383
- /* @__PURE__ */ e("td", { className: "muted small", children: ye(o.createdAt) }),
384
- /* @__PURE__ */ r("td", { className: "right", children: [
385
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => m({ name: "results", id: o.id }), children: "Results" }),
386
- " ",
387
- /* @__PURE__ */ e("button", { className: "btn", disabled: o.status !== "active", title: o.status !== "active" ? "Set status to active to collect answers" : "", onClick: () => m({ name: "take", id: o.id }), children: "Take" }),
388
- " ",
389
- /* @__PURE__ */ e(
390
- "button",
391
- {
392
- className: "btn danger",
393
- onClick: () => {
394
- window.confirm(`Delete "${o.name}" and its responses?`) && (a((l) => l.filter((k) => k.id !== o.id)), s((l) => l.filter((k) => k.surveyId !== o.id)));
395
- },
396
- children: "Delete"
397
- }
398
- )
399
- ] })
400
- ] }, o.id);
401
- }) })
402
- ] })
403
- ]
404
- }
405
- );
406
- }, Ue = ({ onSave: t, onCancel: a }) => {
407
- const [n, s] = y(""), [i, m] = y(""), [f, g] = y(100), [w, c] = y([{ id: Z("q"), type: "nps", text: "How likely are you to recommend us?", required: !0 }]), [d, o] = y(""), u = (l, k) => c((v) => v.map((I) => I.id === l ? { ...I, ...k } : I)), h = () => {
408
- if (!n.trim()) return o("Survey name is required.");
409
- if (w.length === 0) return o("Add at least one question.");
410
- if (w.some((l) => !l.text.trim())) return o("Every question needs text.");
411
- if (w.some((l) => l.type === "multiple_choice" && (l.options ?? []).filter((k) => k.trim()).length < 2)) return o("Multiple choice needs at least two options.");
412
- t({
413
- id: Z("s"),
414
- name: n.trim(),
415
- description: i.trim(),
416
- status: "active",
417
- target: f,
418
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
419
- questions: w.map((l) => ({ ...l, text: l.text.trim(), options: l.type === "multiple_choice" ? (l.options ?? []).filter((k) => k.trim()) : void 0 }))
420
- });
421
- };
422
- return /* @__PURE__ */ r(ee, { title: "Create Survey", subtitle: "Build a new survey.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: a, children: "Back" }), children: [
423
- /* @__PURE__ */ r("div", { className: "card form", children: [
424
- /* @__PURE__ */ r("label", { children: [
425
- "Name",
426
- /* @__PURE__ */ e("input", { className: "input", value: n, onChange: (l) => s(l.target.value), placeholder: "e.g. Q1 Product Satisfaction" })
245
+ /* @__PURE__ */ e("button", { className: "xbtn", onClick: o, "aria-label": "Close tutorial", children: "×" })
427
246
  ] }),
428
- /* @__PURE__ */ r("label", { children: [
429
- "Description",
430
- /* @__PURE__ */ e("input", { className: "input", value: i, onChange: (l) => m(l.target.value) })
431
- ] }),
432
- /* @__PURE__ */ r("label", { children: [
433
- "Target responses",
434
- /* @__PURE__ */ e("input", { className: "input narrow", type: "number", min: 1, value: f, onChange: (l) => g(Math.max(1, parseInt(l.target.value, 10) || 1)) })
435
- ] })
436
- ] }),
437
- /* @__PURE__ */ r("h3", { children: [
438
- "Questions (",
439
- w.length,
440
- ")"
441
- ] }),
442
- w.map((l, k) => /* @__PURE__ */ r("div", { className: "card form", children: [
443
- /* @__PURE__ */ r("div", { className: "row", children: [
444
- /* @__PURE__ */ r("strong", { children: [
445
- "Q",
446
- k + 1
447
- ] }),
448
- /* @__PURE__ */ e("select", { className: "input slim", value: l.type, onChange: (v) => u(l.id, { type: v.target.value, options: v.target.value === "multiple_choice" ? ["Option 1", "Option 2"] : void 0 }), children: He.map((v) => /* @__PURE__ */ e("option", { value: v, children: v.replace("_", " ") }, v)) }),
449
- /* @__PURE__ */ r("label", { className: "inline", children: [
450
- /* @__PURE__ */ e("input", { type: "checkbox", checked: l.required, onChange: (v) => u(l.id, { required: v.target.checked }) }),
451
- " required"
247
+ /* @__PURE__ */ n("div", { className: "tip-body", children: [
248
+ /* @__PURE__ */ e("h2", { id: "tour-title", children: u.title }),
249
+ /* @__PURE__ */ e("p", { children: u.body }),
250
+ u.legend && /* @__PURE__ */ n("div", { className: "legend", children: [
251
+ /* @__PURE__ */ e("span", { className: "lvl ERROR", children: "ERROR" }),
252
+ /* @__PURE__ */ e("span", { className: "lvl WARN", children: "WARN" }),
253
+ /* @__PURE__ */ e("span", { className: "lvl INFO", children: "INFO" }),
254
+ /* @__PURE__ */ e("span", { className: "lvl DEBUG", children: "DEBUG" })
452
255
  ] }),
453
- /* @__PURE__ */ e("span", { className: "grow" }),
454
- /* @__PURE__ */ e("button", { className: "btn danger", onClick: () => c((v) => v.filter((I) => I.id !== l.id)), children: "Remove" })
256
+ u.legend && /* @__PURE__ */ e("p", { style: { marginTop: 8, fontSize: 12, color: "#a1a1aa" }, children: "ERROR: something failed. WARN: something unusual, but it kept going. INFO: normal events. DEBUG: developer detail." })
257
+ ] }, t),
258
+ /* @__PURE__ */ e("div", { className: "dots", children: Array.from({ length: a }, (r, f) => /* @__PURE__ */ e("i", { className: f <= t ? "on" : "" }, f)) }),
259
+ /* @__PURE__ */ n("div", { className: "tip-foot", children: [
260
+ /* @__PURE__ */ e("button", { className: "btn ghost", onClick: s, disabled: D, children: "← Back" }),
261
+ /* @__PURE__ */ e("span", { className: "sp" }),
262
+ x && /* @__PURE__ */ e("button", { className: "btn", onClick: o, children: "Finish" }),
263
+ /* @__PURE__ */ e("button", { className: x ? "btn ghost" : "btn", onClick: i, disabled: x, children: "Next →" })
455
264
  ] }),
456
- /* @__PURE__ */ e("input", { className: "input", value: l.text, onChange: (v) => u(l.id, { text: v.target.value }), placeholder: "Enter your question…" }),
457
- l.type === "multiple_choice" && /* @__PURE__ */ r("div", { className: "stack", children: [
458
- (l.options ?? []).map((v, I) => /* @__PURE__ */ e("input", { className: "input slim", value: v, onChange: (P) => u(l.id, { options: (l.options ?? []).map((R, p) => p === I ? P.target.value : R) }) }, I)),
459
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => u(l.id, { options: [...l.options ?? [], `Option ${(l.options ?? []).length + 1}`] }), children: "+ Add option" })
265
+ /* @__PURE__ */ n("div", { className: "kbd", children: [
266
+ /* @__PURE__ */ e("kbd", { children: "←" }),
267
+ " ",
268
+ /* @__PURE__ */ e("kbd", { children: "→" }),
269
+ " to navigate · ",
270
+ /* @__PURE__ */ e("kbd", { children: "Esc" }),
271
+ " to close"
460
272
  ] })
461
- ] }, l.id)),
462
- /* @__PURE__ */ r("div", { className: "row", children: [
463
- /* @__PURE__ */ e("button", { className: "btn", onClick: () => c((l) => [...l, { id: Z("q"), type: "rating", text: "", required: !1 }]), children: "+ Add question" }),
464
- /* @__PURE__ */ e("span", { className: "grow" }),
465
- d && /* @__PURE__ */ e("span", { className: "error", children: d }),
466
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: h, children: "Create Survey" })
467
273
  ] })
468
274
  ] });
469
- }, Ve = ({ survey: t, onSubmit: a, onCancel: n }) => {
470
- const [s, i] = y({}), [m, f] = y(""), g = (c, d) => i((o) => ({ ...o, [c]: d })), w = () => {
471
- const c = t.questions.find((d) => d.required && (s[d.id] === void 0 || s[d.id] === ""));
472
- if (c) return f(`"${c.text}" is required.`);
473
- f(""), a(t.questions.filter((d) => s[d.id] !== void 0 && s[d.id] !== "").map((d) => ({ questionId: d.id, value: s[d.id] })));
275
+ }
276
+ let re = !1;
277
+ const Se = ({ autoStart: t = !0 }) => {
278
+ const [a, i] = j("login"), [s, o] = j("ALL"), [u, T] = j(""), [g, N] = j(null), [d, l] = j(!1), [h, b] = j(0), m = { setFile: i, setLevel: o, setQuery: T, setSel: N }, p = se[a].lines, q = ae(
279
+ () => p.map((r, f) => ({ ...r, i: f })).filter((r) => (s === "ALL" || r.l === s) && r.m.toLowerCase().includes(u.toLowerCase())),
280
+ [p, s, u]
281
+ ), w = (r) => p.filter((f) => f.l === r).length, k = g != null ? p[g] : null, O = F((r) => {
282
+ b(r), Y[r].enter(m);
283
+ }, []), E = () => {
284
+ O(0), l(!0);
285
+ }, c = F(() => b((r) => r >= Y.length - 1 ? r : (Y[r + 1].enter(m), r + 1)), []), W = F(() => b((r) => r <= 0 ? r : (Y[r - 1].enter(m), r - 1)), []), D = F(() => l(!1), []);
286
+ $(() => {
287
+ if (!t || re) return;
288
+ const r = setTimeout(() => {
289
+ re = !0, E();
290
+ }, 600);
291
+ return () => clearTimeout(r);
292
+ }, []);
293
+ const x = (r) => {
294
+ i(r), o("ALL"), T(""), N(null);
474
295
  };
475
- return /* @__PURE__ */ r(ee, { title: t.name, subtitle: t.description || "Answer the questions below.", actions: /* @__PURE__ */ e("button", { className: "btn", onClick: n, children: "Cancel" }), children: [
476
- t.questions.map((c, d) => /* @__PURE__ */ r("div", { className: "card form", children: [
477
- /* @__PURE__ */ r("strong", { children: [
478
- d + 1,
479
- ". ",
480
- c.text,
481
- c.required && /* @__PURE__ */ e("span", { className: "error", children: " *" })
296
+ return /* @__PURE__ */ e("div", { className: "lg-root", children: /* @__PURE__ */ n("div", { className: "app", children: [
297
+ /* @__PURE__ */ n("div", { className: "top", children: [
298
+ /* @__PURE__ */ n("div", { className: "brand", children: [
299
+ "pulse",
300
+ /* @__PURE__ */ e("span", { children: ".logs" })
482
301
  ] }),
483
- c.type === "nps" && /* @__PURE__ */ e("div", { className: "scale", children: Array.from({ length: 11 }, (o, u) => /* @__PURE__ */ e("button", { className: s[c.id] === u ? "chip active" : "chip", onClick: () => g(c.id, u), children: u }, u)) }),
484
- c.type === "rating" && /* @__PURE__ */ e("div", { className: "scale", children: [1, 2, 3, 4, 5].map((o) => /* @__PURE__ */ r("button", { className: s[c.id] === o ? "chip active" : "chip", onClick: () => g(c.id, o), children: [
485
- o,
486
- " ★"
487
- ] }, o)) }),
488
- c.type === "multiple_choice" && /* @__PURE__ */ e("div", { className: "scale", children: (c.options ?? []).map((o) => /* @__PURE__ */ e("button", { className: s[c.id] === o ? "chip active" : "chip", onClick: () => g(c.id, o), children: o }, o)) }),
489
- c.type === "open_text" && /* @__PURE__ */ e("textarea", { className: "input", rows: 2, value: String(s[c.id] ?? ""), onChange: (o) => g(c.id, o.target.value) })
490
- ] }, c.id)),
491
- /* @__PURE__ */ r("div", { className: "row", children: [
492
- /* @__PURE__ */ e("span", { className: "grow" }),
493
- m && /* @__PURE__ */ e("span", { className: "error", children: m }),
494
- /* @__PURE__ */ e("button", { className: "btn primary", onClick: w, children: "Submit response" })
495
- ] })
496
- ] });
497
- }, Ye = ({ survey: t, responses: a, onBack: n, onTake: s }) => {
498
- const i = Y(() => le(ce(t, a)), [t, a]), m = t.questions.find((g) => g.type === "nps"), f = (g) => i ? Math.round(g / i.total * 100) : 0;
499
- return /* @__PURE__ */ r(
500
- ee,
501
- {
502
- title: t.name,
503
- subtitle: `${a.length} responses`,
504
- actions: /* @__PURE__ */ r(ae, { children: [
505
- /* @__PURE__ */ e("button", { className: "btn", onClick: n, children: "Back" }),
506
- /* @__PURE__ */ e("button", { className: "btn primary", disabled: t.status !== "active", onClick: s, children: "Take survey" })
302
+ /* @__PURE__ */ e("button", { className: "btn", onClick: E, children: "▶ Start tutorial" })
303
+ ] }),
304
+ /* @__PURE__ */ n("div", { className: "viewer", children: [
305
+ /* @__PURE__ */ n("div", { className: "titlebar", "data-tour": "titlebar", children: [
306
+ /* @__PURE__ */ n("div", { children: [
307
+ /* @__PURE__ */ e("h1", { children: "Log Viewer" }),
308
+ /* @__PURE__ */ e("small", { children: "Inspect application errors, warnings and debug output" })
309
+ ] }),
310
+ /* @__PURE__ */ e("span", { className: "badge", children: "SAMPLE DATA" })
507
311
  ] }),
508
- children: [
509
- /* @__PURE__ */ r("div", { className: "stats", children: [
510
- /* @__PURE__ */ e(q, { label: "NPS", value: i ? i.score : "—", color: "#f59e0b" }),
511
- /* @__PURE__ */ e(q, { label: "Promoters", value: i ? `${f(i.promoters)}%` : "—", color: "#4edea3" }),
512
- /* @__PURE__ */ e(q, { label: "Passives", value: i ? `${f(i.passives)}%` : "—", color: "#ffcc6b" }),
513
- /* @__PURE__ */ e(q, { label: "Detractors", value: i ? `${f(i.detractors)}%` : "—", color: "#ffb4ab" })
312
+ /* @__PURE__ */ n("div", { className: "layout", children: [
313
+ /* @__PURE__ */ n("aside", { className: "files", "data-tour": "files", children: [
314
+ /* @__PURE__ */ e("h3", { children: "Log files" }),
315
+ Object.entries(se).map(([r, f]) => /* @__PURE__ */ n("button", { className: `file mono ${a === r ? "on" : ""}`, onClick: () => x(r), children: [
316
+ /* @__PURE__ */ e("span", { children: "📄" }),
317
+ f.name,
318
+ /* @__PURE__ */ e("span", { className: "n", children: f.lines.length })
319
+ ] }, r))
514
320
  ] }),
515
- /* @__PURE__ */ r("table", { className: "table", children: [
516
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
517
- /* @__PURE__ */ e("th", { children: "User" }),
518
- /* @__PURE__ */ e("th", { children: "NPS" }),
519
- t.questions.filter((g) => g.type !== "nps").map((g) => /* @__PURE__ */ e("th", { children: g.text }, g.id)),
520
- /* @__PURE__ */ e("th", { children: "Date" })
521
- ] }) }),
522
- /* @__PURE__ */ r("tbody", { children: [
523
- a.length === 0 && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 9, className: "muted", children: "No responses yet." }) }),
524
- a.map((g) => {
525
- var c;
526
- const w = m ? (c = g.answers.find((d) => d.questionId === m.id)) == null ? void 0 : c.value : void 0;
527
- return /* @__PURE__ */ r("tr", { children: [
528
- /* @__PURE__ */ e("td", { className: "mono", children: g.userId }),
529
- /* @__PURE__ */ e("td", { children: typeof w == "number" ? /* @__PURE__ */ r("span", { className: `pill ${pe(w)}`, children: [
530
- w,
531
- " · ",
532
- pe(w)
533
- ] }) : "—" }),
534
- t.questions.filter((d) => d.type !== "nps").map((d) => {
535
- var o;
536
- return /* @__PURE__ */ e("td", { children: String(((o = g.answers.find((u) => u.questionId === d.id)) == null ? void 0 : o.value) ?? "—") }, d.id);
537
- }),
538
- /* @__PURE__ */ e("td", { className: "muted small", children: ye(g.createdAt) })
539
- ] }, g.id);
540
- })
321
+ /* @__PURE__ */ n("section", { className: "main", children: [
322
+ /* @__PURE__ */ n("div", { className: "summary", "data-tour": "summary", children: [
323
+ /* @__PURE__ */ n("div", { className: "stat e", children: [
324
+ /* @__PURE__ */ e("b", { children: w("ERROR") }),
325
+ /* @__PURE__ */ e("span", { children: "Errors" })
326
+ ] }),
327
+ /* @__PURE__ */ n("div", { className: "stat w", children: [
328
+ /* @__PURE__ */ e("b", { children: w("WARN") }),
329
+ /* @__PURE__ */ e("span", { children: "Warnings" })
330
+ ] }),
331
+ /* @__PURE__ */ n("div", { className: "stat", children: [
332
+ /* @__PURE__ */ e("b", { children: p.length }),
333
+ /* @__PURE__ */ e("span", { children: "Total lines" })
334
+ ] })
335
+ ] }),
336
+ /* @__PURE__ */ n("div", { className: "filters", "data-tour": "filters", children: [
337
+ Ne.map((r) => /* @__PURE__ */ n("button", { className: `chip ${s === r ? "on" : ""}`, onClick: () => {
338
+ o(r), N(null);
339
+ }, children: [
340
+ r === "ALL" ? "All" : r[0] + r.slice(1).toLowerCase(),
341
+ r !== "ALL" && ` (${w(r)})`
342
+ ] }, r)),
343
+ /* @__PURE__ */ e("input", { className: "search", placeholder: "Search logs…", value: u, onChange: (r) => T(r.target.value), "aria-label": "Search logs" })
344
+ ] }),
345
+ /* @__PURE__ */ n("div", { className: "logpane mono", "data-tour": "logpane", children: [
346
+ /* @__PURE__ */ n("div", { className: "head", children: [
347
+ se[a].name,
348
+ " · ",
349
+ q.length,
350
+ " line",
351
+ q.length !== 1 && "s"
352
+ ] }),
353
+ q.length === 0 && /* @__PURE__ */ e("div", { className: "empty", children: "No lines match this filter." }),
354
+ q.map((r) => /* @__PURE__ */ n("button", { className: `line ${g === r.i ? "sel" : ""}`, onClick: () => N(r.i), children: [
355
+ /* @__PURE__ */ e("span", { className: "ln", children: r.i + 1 }),
356
+ /* @__PURE__ */ e("span", { className: "ts", children: r.t }),
357
+ /* @__PURE__ */ e("span", { className: `lvl ${r.l}`, children: r.l }),
358
+ /* @__PURE__ */ e("span", { className: "msg", "data-lvl": r.l, children: r.m })
359
+ ] }, r.i))
360
+ ] })
361
+ ] }),
362
+ /* @__PURE__ */ n("aside", { className: "details", "data-tour": "details", children: [
363
+ /* @__PURE__ */ e("h3", { children: "Details" }),
364
+ !k && /* @__PURE__ */ e("div", { className: "placeholder", children: "Select a log line to see what it means and how to fix it." }),
365
+ k && /* @__PURE__ */ n(V, { children: [
366
+ /* @__PURE__ */ n("div", { className: "box", children: [
367
+ /* @__PURE__ */ e("b", { children: "Message" }),
368
+ /* @__PURE__ */ e("span", { className: `lvl ${k.l}`, style: { marginRight: 6 }, children: k.l }),
369
+ k.m
370
+ ] }),
371
+ /* @__PURE__ */ n("div", { className: "box", children: [
372
+ /* @__PURE__ */ e("b", { children: "What it means" }),
373
+ k.d.meaning
374
+ ] }),
375
+ /* @__PURE__ */ n("div", { className: "box", children: [
376
+ /* @__PURE__ */ e("b", { children: "Suggested fix" }),
377
+ k.d.fix
378
+ ] }),
379
+ k.d.stack && /* @__PURE__ */ n("div", { className: "box", children: [
380
+ /* @__PURE__ */ e("b", { children: "Stack trace" }),
381
+ /* @__PURE__ */ e("pre", { className: "mono", children: k.d.stack })
382
+ ] })
541
383
  ] })
542
384
  ] })
543
- ]
544
- }
545
- );
546
- }, ht = () => {
547
- const [t, a] = y("survey");
548
- return /* @__PURE__ */ r("div", { className: "shell", children: [
549
- /* @__PURE__ */ r("header", { className: "topbar", children: [
385
+ ] })
386
+ ] }),
387
+ d && /* @__PURE__ */ e(ke, { step: h, total: Y.length, onNext: c, onBack: W, onClose: D })
388
+ ] }) });
389
+ }, xe = ({ items: t, value: a, onChange: i }) => /* @__PURE__ */ e("div", { className: "tabs", children: t.map((s) => /* @__PURE__ */ e("button", { type: "button", className: s.id === a ? "tab active" : "tab", onClick: () => i(s.id), children: s.label }, s.id)) }), Be = () => {
390
+ const [t, a] = j("logs");
391
+ return /* @__PURE__ */ n("div", { className: "shell", children: [
392
+ /* @__PURE__ */ n("header", { className: "topbar", children: [
550
393
  /* @__PURE__ */ e("strong", { children: "POC" }),
551
- /* @__PURE__ */ e(fe, { items: [{ id: "survey", label: "Survey" }, { id: "journey", label: "User Journey" }], value: t, onChange: a })
394
+ /* @__PURE__ */ e(xe, { items: [{ id: "logs", label: "Logs" }, { id: "feedback", label: "Feedback" }], value: t, onChange: a })
552
395
  ] }),
553
- /* @__PURE__ */ e("main", { children: t === "survey" ? /* @__PURE__ */ e(Xe, {}) : /* @__PURE__ */ e(De, {}) })
396
+ /* @__PURE__ */ e("main", { children: t === "logs" ? /* @__PURE__ */ e(Se, {}) : /* @__PURE__ */ e(ye, {}) })
554
397
  ] });
555
- }, X = (t, a) => {
398
+ }, G = (t, a) => {
556
399
  try {
557
400
  return t();
558
401
  } catch {
559
402
  return a;
560
403
  }
561
- }, re = (t) => Math.random().toString(36).slice(2, 2 + t), z = () => location.pathname + location.hash, Qe = ".sj, [data-sj-ignore]", Ge = () => ({
404
+ }, ne = (t) => Math.random().toString(36).slice(2, 2 + t), X = () => location.pathname + location.hash, je = ".sj, [data-sj-ignore]", Te = () => ({
562
405
  pages: {},
563
406
  scrollMs: 0,
564
407
  clicks: 0,
@@ -571,11 +414,11 @@ const He = ["nps", "rating", "multiple_choice", "open_text"], ye = (t) => new Da
571
414
  drops: {},
572
415
  log: []
573
416
  });
574
- class ze {
417
+ class Ee {
575
418
  constructor(a) {
576
- this.getCfg = a, this.activeStep = null, this.q = [], this.version = 0, this.subs = /* @__PURE__ */ new Set(), this.navSubs = /* @__PURE__ */ new Set(), this.overrides = {}, this.prev = "", this.booted = !1, this.scrolling = !1, this.scrollTimer = 0, this.lastMove = 0, this.subscribe = (n) => (this.subs.add(n), () => {
577
- this.subs.delete(n);
578
- }), this.getVersion = () => this.version, this.uid = X(() => localStorage.getItem("sjU") || (localStorage.setItem("sjU", re(10)), localStorage.getItem("sjU")), "anon"), this.sid = X(() => sessionStorage.getItem("sjS") || (sessionStorage.setItem("sjS", re(8)), sessionStorage.getItem("sjS")), re(8)), this.state = { ...Ge(), ...X(() => JSON.parse(sessionStorage.getItem("sjState") || "null"), null) };
419
+ this.getCfg = a, this.activeStep = null, this.q = [], this.version = 0, this.subs = /* @__PURE__ */ new Set(), this.navSubs = /* @__PURE__ */ new Set(), this.overrides = {}, this.prev = "", this.booted = !1, this.scrolling = !1, this.scrollTimer = 0, this.lastMove = 0, this.subscribe = (i) => (this.subs.add(i), () => {
420
+ this.subs.delete(i);
421
+ }), this.getVersion = () => this.version, this.uid = G(() => localStorage.getItem("sjU") || (localStorage.setItem("sjU", ne(10)), localStorage.getItem("sjU")), "anon"), this.sid = G(() => sessionStorage.getItem("sjS") || (sessionStorage.setItem("sjS", ne(8)), sessionStorage.getItem("sjS")), ne(8)), this.state = { ...Te(), ...G(() => JSON.parse(sessionStorage.getItem("sjState") || "null"), null) };
579
422
  }
580
423
  get cfg() {
581
424
  return { ...this.getCfg(), ...this.overrides };
@@ -592,24 +435,24 @@ class ze {
592
435
  };
593
436
  }
594
437
  /* ---- data ---- */
595
- page(a = z()) {
438
+ page(a = X()) {
596
439
  return this.state.pages[a] || (this.state.pages[a] = { ms: 0, scrollMs: 0, depth: 0, clicks: 0, views: 0, m: {} });
597
440
  }
598
441
  save() {
599
- X(() => sessionStorage.setItem("sjState", JSON.stringify({ ...this.state, log: this.state.log.slice(0, 40) })), void 0);
442
+ G(() => sessionStorage.setItem("sjState", JSON.stringify({ ...this.state, log: this.state.log.slice(0, 40) })), void 0);
600
443
  }
601
- bin(a, n, s) {
602
- const i = z(), m = document.documentElement.scrollWidth || 1, f = this.state.heat[i] || (this.state.heat[i] = {}), g = Math.round(a / m * 100) + "," + (n / 20 | 0);
603
- f[g] = (f[g] || 0) + s;
444
+ bin(a, i, s) {
445
+ const o = X(), u = document.documentElement.scrollWidth || 1, T = this.state.heat[o] || (this.state.heat[o] = {}), g = Math.round(a / u * 100) + "," + (i / 20 | 0);
446
+ T[g] = (T[g] || 0) + s;
604
447
  }
605
- track(a, n = {}) {
606
- const s = { sid: this.sid, uid: this.uid, type: a, t: Date.now(), page: z(), ...n };
448
+ track(a, i = {}) {
449
+ const s = { sid: this.sid, uid: this.uid, type: a, t: Date.now(), page: X(), ...i };
607
450
  this.q.push(s), this.state.log.unshift(s), this.state.log.length > 60 && this.state.log.pop();
608
- const i = this.cfg.onEvent;
609
- i && X(() => i(s), void 0);
451
+ const o = this.cfg.onEvent;
452
+ o && G(() => o(s), void 0);
610
453
  }
611
454
  payload(a) {
612
- const n = this.state;
455
+ const i = this.state;
613
456
  return JSON.stringify({
614
457
  sessionId: this.sid,
615
458
  userId: this.uid,
@@ -619,114 +462,114 @@ class ze {
619
462
  doc: [document.documentElement.scrollWidth, document.documentElement.scrollHeight],
620
463
  events: a,
621
464
  summary: {
622
- pages: n.pages,
623
- scrollMs: n.scrollMs,
624
- clicks: n.clicks,
625
- nav: n.nav,
626
- tour: { started: n.started, completed: n.completed, skipped: n.skipped, drops: n.drops, steps: n.steps },
627
- heat: n.heat
465
+ pages: i.pages,
466
+ scrollMs: i.scrollMs,
467
+ clicks: i.clicks,
468
+ nav: i.nav,
469
+ tour: { started: i.started, completed: i.completed, skipped: i.skipped, drops: i.drops, steps: i.steps },
470
+ heat: i.heat
628
471
  }
629
472
  });
630
473
  }
631
474
  flush(a = !1) {
632
475
  if (this.save(), !this.q.length) return;
633
- const n = this.q;
476
+ const i = this.q;
634
477
  this.q = [];
635
478
  const s = this.cfg;
636
479
  if (!s.endpoint) {
637
- this.state.log.unshift({ type: "flush (dry-run)", t: Date.now(), n: `${n.length} events` });
480
+ this.state.log.unshift({ type: "flush (dry-run)", t: Date.now(), n: `${i.length} events` });
638
481
  return;
639
482
  }
640
- const i = this.payload(n);
641
- a && navigator.sendBeacon && navigator.sendBeacon(s.endpoint, new Blob([i], { type: "application/json" })) || fetch(s.endpoint, { method: "POST", body: i, keepalive: !0, headers: { "Content-Type": "application/json", ...s.headers || {} } }).then((m) => {
642
- if (!m.ok) throw new Error("bad status");
483
+ const o = this.payload(i);
484
+ a && navigator.sendBeacon && navigator.sendBeacon(s.endpoint, new Blob([o], { type: "application/json" })) || fetch(s.endpoint, { method: "POST", body: o, keepalive: !0, headers: { "Content-Type": "application/json", ...s.headers || {} } }).then((u) => {
485
+ if (!u.ok) throw new Error("bad status");
643
486
  }).catch(() => {
644
- this.q = n.concat(this.q).slice(-500);
487
+ this.q = i.concat(this.q).slice(-500);
645
488
  });
646
489
  }
647
490
  /* ---- tour funnel ---- */
648
- tourStart(a, n) {
649
- n || this.state.started++, this.track(n ? "tour_resume" : "tour_start", { steps: a });
491
+ tourStart(a, i) {
492
+ i || this.state.started++, this.track(i ? "tour_resume" : "tour_start", { steps: a });
650
493
  }
651
- stepView(a, n, s) {
652
- const i = this.state.steps[a] || (this.state.steps[a] = { views: 0, ms: 0, title: n });
653
- i.views++, this.activeStep = a, this.track("step_view", { step: a, title: n, total: s }), this.save();
494
+ stepView(a, i, s) {
495
+ const o = this.state.steps[a] || (this.state.steps[a] = { views: 0, ms: 0, title: i });
496
+ o.views++, this.activeStep = a, this.track("step_view", { step: a, title: i, total: s }), this.save();
654
497
  }
655
- tourEnd(a, n, s, i) {
656
- a === "complete" ? (this.state.completed++, this.track("tour_complete", { steps: i })) : (this.state.skipped++, this.state.drops[n] = (this.state.drops[n] || 0) + 1, this.track("tour_skip", { step: n, title: s })), this.activeStep = null, X(() => sessionStorage.removeItem("sjTour"), void 0), X(() => localStorage.setItem("sjDone", a), void 0), this.flush();
498
+ tourEnd(a, i, s, o) {
499
+ a === "complete" ? (this.state.completed++, this.track("tour_complete", { steps: o })) : (this.state.skipped++, this.state.drops[i] = (this.state.drops[i] || 0) + 1, this.track("tour_skip", { step: i, title: s })), this.activeStep = null, G(() => sessionStorage.removeItem("sjTour"), void 0), G(() => localStorage.setItem("sjDone", a), void 0), this.flush();
657
500
  }
658
501
  /* ---- passive listeners; returns a cleanup function (safe under React StrictMode) ---- */
659
502
  attach() {
660
503
  const a = this.state;
661
- this.prev = z();
662
- let n = performance.now();
504
+ this.prev = X();
505
+ let i = performance.now();
663
506
  this.booted || (this.booted = !0, this.page().views++, this.track("session_start", { ua: navigator.userAgent.slice(0, 60), ref: document.referrer }));
664
- const s = [], i = (c, d, o, u) => {
665
- c.addEventListener(d, o, u), s.push(() => c.removeEventListener(d, o, u));
666
- }, m = window.setInterval(() => {
667
- const c = performance.now(), d = c - n;
668
- if (n = c, document.hidden) return;
669
- const o = this.page();
670
- o.ms += d, this.scrolling && (o.scrollMs += d, a.scrollMs += d), this.activeStep !== null && a.steps[this.activeStep] && (a.steps[this.activeStep].ms += d);
671
- }, 250), f = window.setInterval(() => this.emit(), 500), g = window.setInterval(() => this.flush(), this.cfg.flushMs || 5e3);
507
+ const s = [], o = (d, l, h, b) => {
508
+ d.addEventListener(l, h, b), s.push(() => d.removeEventListener(l, h, b));
509
+ }, u = window.setInterval(() => {
510
+ const d = performance.now(), l = d - i;
511
+ if (i = d, document.hidden) return;
512
+ const h = this.page();
513
+ h.ms += l, this.scrolling && (h.scrollMs += l, a.scrollMs += l), this.activeStep !== null && a.steps[this.activeStep] && (a.steps[this.activeStep].ms += l);
514
+ }, 250), T = window.setInterval(() => this.emit(), 500), g = window.setInterval(() => this.flush(), this.cfg.flushMs || 5e3);
672
515
  s.push(() => {
673
- clearInterval(m), clearInterval(f), clearInterval(g);
674
- }), i(window, "scroll", () => {
516
+ clearInterval(u), clearInterval(T), clearInterval(g);
517
+ }), o(window, "scroll", () => {
675
518
  this.scrolling = !0, clearTimeout(this.scrollTimer), this.scrollTimer = window.setTimeout(() => {
676
519
  this.scrolling = !1;
677
520
  }, 160);
678
- const c = this.page(), d = Math.min(100, Math.round((scrollY + innerHeight) / document.documentElement.scrollHeight * 100));
679
- d > c.depth && (c.depth = d, [25, 50, 75, 100].forEach((o) => {
680
- d >= o && !c.m[o] && (c.m[o] = 1, this.track("scroll_depth", { pct: o }));
521
+ const d = this.page(), l = Math.min(100, Math.round((scrollY + innerHeight) / document.documentElement.scrollHeight * 100));
522
+ l > d.depth && (d.depth = l, [25, 50, 75, 100].forEach((h) => {
523
+ l >= h && !d.m[h] && (d.m[h] = 1, this.track("scroll_depth", { pct: h }));
681
524
  }));
682
- }, { passive: !0 }), i(window, "mousemove", (c) => {
683
- const d = Date.now();
684
- d - this.lastMove > 120 && (this.lastMove = d, this.bin(c.pageX, c.pageY, 1));
685
- }, { passive: !0 }), i(document, "click", (c) => {
686
- const d = c.target;
687
- if (!d || !d.closest || d.closest(Qe)) return;
688
- a.clicks++, this.page().clicks++, this.bin(c.pageX, c.pageY, 6);
689
- const o = d.id ? "#" + d.id : d.tagName.toLowerCase() + (typeof d.className == "string" && d.className ? "." + d.className.trim().split(/\s+/)[0] : "");
690
- this.track("click", { sel: o, x: c.pageX, y: c.pageY, text: (d.textContent || "").trim().slice(0, 30), step: this.activeStep });
691
- const u = d.closest("a[href]");
692
- u && !u.getAttribute("href").startsWith("#") && (this.track("navigate_out", { to: u.href }), this.flush(!0));
525
+ }, { passive: !0 }), o(window, "mousemove", (d) => {
526
+ const l = Date.now();
527
+ l - this.lastMove > 120 && (this.lastMove = l, this.bin(d.pageX, d.pageY, 1));
528
+ }, { passive: !0 }), o(document, "click", (d) => {
529
+ const l = d.target;
530
+ if (!l || !l.closest || l.closest(je)) return;
531
+ a.clicks++, this.page().clicks++, this.bin(d.pageX, d.pageY, 6);
532
+ const h = l.id ? "#" + l.id : l.tagName.toLowerCase() + (typeof l.className == "string" && l.className ? "." + l.className.trim().split(/\s+/)[0] : "");
533
+ this.track("click", { sel: h, x: d.pageX, y: d.pageY, text: (l.textContent || "").trim().slice(0, 30), step: this.activeStep });
534
+ const b = l.closest("a[href]");
535
+ b && !b.getAttribute("href").startsWith("#") && (this.track("navigate_out", { to: b.href }), this.flush(!0));
693
536
  }, !0);
694
- const w = () => {
695
- const c = z();
696
- c !== this.prev && (a.nav++, this.track("navigate", { from: this.prev, to: c }), this.prev = c, this.page().views++, this.navSubs.forEach((d) => d()));
537
+ const N = () => {
538
+ const d = X();
539
+ d !== this.prev && (a.nav++, this.track("navigate", { from: this.prev, to: d }), this.prev = d, this.page().views++, this.navSubs.forEach((l) => l()));
697
540
  };
698
- return ["pushState", "replaceState"].forEach((c) => {
699
- const d = history[c];
700
- history[c] = function(...o) {
701
- const u = d.apply(this, o);
702
- return setTimeout(w), u;
541
+ return ["pushState", "replaceState"].forEach((d) => {
542
+ const l = history[d];
543
+ history[d] = function(...h) {
544
+ const b = l.apply(this, h);
545
+ return setTimeout(N), b;
703
546
  }, s.push(() => {
704
- history[c] = d;
547
+ history[d] = l;
705
548
  });
706
- }), i(window, "popstate", w), i(window, "hashchange", w), i(document, "visibilitychange", () => {
549
+ }), o(window, "popstate", N), o(window, "hashchange", N), o(document, "visibilitychange", () => {
707
550
  document.hidden && this.flush(!0);
708
- }), i(window, "pagehide", () => {
709
- const c = this.activeStep;
710
- c !== null && (this.track("tour_abandon", { step: c }), a.drops[c] = (a.drops[c] || 0) + 1, X(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: c, t: Date.now() })), void 0)), this.flush(!0);
711
- }), () => s.forEach((c) => c());
551
+ }), o(window, "pagehide", () => {
552
+ const d = this.activeStep;
553
+ d !== null && (this.track("tour_abandon", { step: d }), a.drops[d] = (a.drops[d] || 0) + 1, G(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: d, t: Date.now() })), void 0)), this.flush(!0);
554
+ }), () => s.forEach((d) => d());
712
555
  }
713
556
  }
714
- const ie = (t) => !!t && t.isConnected && t.getClientRects().length > 0;
715
- function Ke(t) {
557
+ const te = (t) => !!t && t.isConnected && t.getClientRects().length > 0;
558
+ function Ce(t) {
716
559
  var s;
717
- const a = t.dataset, n = (t.getAttribute("aria-label") || t.getAttribute("title") || t.textContent || "").trim().replace(/\s+/g, " ");
560
+ const a = t.dataset, i = (t.getAttribute("aria-label") || t.getAttribute("title") || t.textContent || "").trim().replace(/\s+/g, " ");
718
561
  return {
719
562
  el: t,
720
- title: a.sjTitle || t.getAttribute("aria-label") || ((s = t.querySelector("h1,h2,h3")) == null ? void 0 : s.textContent) || n.slice(0, 28) || t.tagName.toLowerCase(),
721
- body: a.sjBody || n.slice(0, 140),
563
+ title: a.sjTitle || t.getAttribute("aria-label") || ((s = t.querySelector("h1,h2,h3")) == null ? void 0 : s.textContent) || i.slice(0, 28) || t.tagName.toLowerCase(),
564
+ body: a.sjBody || i.slice(0, 140),
722
565
  placement: a.sjPlace || "auto"
723
566
  };
724
567
  }
725
- function Ze(t) {
568
+ function Le(t) {
726
569
  const a = (s) => !s.page || s.page === location.pathname;
727
- let n;
570
+ let i;
728
571
  if (t.steps)
729
- n = t.steps.map((s) => ({
572
+ i = t.steps.map((s) => ({
730
573
  ...s,
731
574
  placement: s.placement ?? "auto",
732
575
  el: s.target && a(s) ? document.querySelector(s.target) : null,
@@ -734,90 +577,90 @@ function Ze(t) {
734
577
  }));
735
578
  else {
736
579
  let s = [...document.querySelectorAll("[data-sj-title],[data-sj-step]")];
737
- s.length || (s = [...document.querySelectorAll("header,nav,main>section,footer")].slice(0, 6)), n = s.filter(ie).sort((i, m) => (+(i.dataset.sjStep || 0) || 99) - (+(m.dataset.sjStep || 0) || 99)).map(Ke);
580
+ s.length || (s = [...document.querySelectorAll("header,nav,main>section,footer")].slice(0, 6)), i = s.filter(te).sort((o, u) => (+(o.dataset.sjStep || 0) || 99) - (+(u.dataset.sjStep || 0) || 99)).map(Ce);
738
581
  }
739
- return t.welcome && n.unshift({ ...t.welcome, el: null, placement: "auto", welcome: !0 }), t.outro && n.push({ ...t.outro, el: null, placement: "auto", outro: !0 }), n;
582
+ return t.welcome && i.unshift({ ...t.welcome, el: null, placement: "auto", welcome: !0 }), t.outro && i.push({ ...t.outro, el: null, placement: "auto", outro: !0 }), i;
740
583
  }
741
- const se = (t, a, n) => Math.max(a, Math.min(n, t)), et = ({ open: t, anim: a, theme: n, steps: s, index: i, startLabel: m, tracker: f, onNext: g, onBack: w, onSkip: c, onTheme: d }) => {
742
- const o = _(null), u = _(null), h = _(0), [l, k] = y(null), v = s[i], I = L(() => {
743
- const x = o.current;
744
- if (!t || !v || !x) return;
745
- const T = innerWidth, M = innerHeight, E = 12, A = 16;
746
- let N = { x: T / 2, y: M / 2, w: 0, h: 0 }, D = !0;
747
- if (ie(v.el)) {
748
- const C = v.el.getBoundingClientRect(), H = Math.max(C.left - 8, 0), S = Math.max(C.top - 8, 0);
749
- N = { x: H, y: S, w: Math.min(C.right + 8, T) - H, h: Math.min(C.bottom + 8, M) - S }, D = !1;
584
+ const Z = (t, a, i) => Math.max(a, Math.min(i, t)), Re = ({ open: t, anim: a, theme: i, steps: s, index: o, startLabel: u, tracker: T, onNext: g, onBack: N, onSkip: d, onTheme: l }) => {
585
+ const h = B(null), b = B(null), m = B(0), [p, q] = j(null), w = s[o], k = F(() => {
586
+ const x = h.current;
587
+ if (!t || !w || !x) return;
588
+ const r = innerWidth, f = innerHeight, S = 12, M = 16;
589
+ let y = { x: r / 2, y: f / 2, w: 0, h: 0 }, P = !0;
590
+ if (te(w.el)) {
591
+ const R = w.el.getBoundingClientRect(), U = Math.max(R.left - 8, 0), C = Math.max(R.top - 8, 0);
592
+ y = { x: U, y: C, w: Math.min(R.right + 8, r) - U, h: Math.min(R.bottom + 8, f) - C }, P = !1;
750
593
  }
751
- const $ = x.offsetWidth, O = x.offsetHeight;
752
- let W = (T - $) / 2, J = (M - O) / 2, Q = "c", b = 0, j = 0;
753
- if (!D) {
754
- const C = N.x + N.w / 2, H = N.y + N.h / 2, S = {
755
- top: { x: C - $ / 2, y: N.y - O - A, ok: N.y - O - A >= E },
756
- bottom: { x: C - $ / 2, y: N.y + N.h + A, ok: N.y + N.h + A + O <= M - E },
757
- left: { x: N.x - $ - A, y: H - O / 2, ok: N.x - $ - A >= E },
758
- right: { x: N.x + N.w + A, y: H - O / 2, ok: N.x + N.w + A + $ <= T - E }
759
- }, G = v.placement !== "auto" && v.placement in S ? v.placement : "bottom", ke = { top: "bottom", bottom: "top", left: "right", right: "left" }[G], te = (v.placement === "auto" ? ["bottom", "top", "right", "left"] : [G, ke, "bottom", "top", "right", "left"]).find((Se) => S[Se].ok);
760
- te ? (W = S[te].x, J = S[te].y, Q = te) : (J = M - O - E, Q = "in"), W = se(W, E, T - $ - E), J = se(J, E, M - O - E), b = se(C - W, 22, $ - 22), j = se(H - J, 22, O - 22);
594
+ const A = x.offsetWidth, I = x.offsetHeight;
595
+ let J = (r - A) / 2, H = (f - I) / 2, z = "c", v = 0, L = 0;
596
+ if (!P) {
597
+ const R = y.x + y.w / 2, U = y.y + y.h / 2, C = {
598
+ top: { x: R - A / 2, y: y.y - I - M, ok: y.y - I - M >= S },
599
+ bottom: { x: R - A / 2, y: y.y + y.h + M, ok: y.y + y.h + M + I <= f - S },
600
+ left: { x: y.x - A - M, y: U - I / 2, ok: y.x - A - M >= S },
601
+ right: { x: y.x + y.w + M, y: U - I / 2, ok: y.x + y.w + M + A <= r - S }
602
+ }, Q = w.placement !== "auto" && w.placement in C ? w.placement : "bottom", de = { top: "bottom", bottom: "top", left: "right", right: "left" }[Q], K = (w.placement === "auto" ? ["bottom", "top", "right", "left"] : [Q, de, "bottom", "top", "right", "left"]).find((he) => C[he].ok);
603
+ K ? (J = C[K].x, H = C[K].y, z = K) : (H = f - I - S, z = "in"), J = Z(J, S, r - A - S), H = Z(H, S, f - I - S), v = Z(R - J, 22, A - 22), L = Z(U - H, 22, I - 22);
761
604
  }
762
- k({ hole: N, centered: D, x: Math.round(W), y: Math.round(J), side: Q, ax: b, ay: j, vw: T, vh: M });
763
- }, [t, v]), P = L(() => {
764
- cancelAnimationFrame(h.current), h.current = requestAnimationFrame(I);
765
- }, [I]);
766
- if (xe(() => {
605
+ q({ hole: y, centered: P, x: Math.round(J), y: Math.round(H), side: z, ax: v, ay: L, vw: r, vh: f });
606
+ }, [t, w]), O = F(() => {
607
+ cancelAnimationFrame(m.current), m.current = requestAnimationFrame(k);
608
+ }, [k]);
609
+ if (oe(() => {
767
610
  if (!t) return;
768
- I();
769
- const x = window.setTimeout(I, 380), T = window.setTimeout(I, 700);
611
+ k();
612
+ const x = window.setTimeout(k, 380), r = window.setTimeout(k, 700);
770
613
  return () => {
771
- clearTimeout(x), clearTimeout(T);
614
+ clearTimeout(x), clearTimeout(r);
772
615
  };
773
- }, [t, i, I]), B(() => {
616
+ }, [t, o, k]), $(() => {
774
617
  if (!t) return;
775
- addEventListener("scroll", P, { passive: !0 }), addEventListener("resize", P);
776
- const x = f.onNavigate(P);
618
+ addEventListener("scroll", O, { passive: !0 }), addEventListener("resize", O);
619
+ const x = T.onNavigate(O);
777
620
  return () => {
778
- removeEventListener("scroll", P), removeEventListener("resize", P), x(), cancelAnimationFrame(h.current);
621
+ removeEventListener("scroll", O), removeEventListener("resize", O), x(), cancelAnimationFrame(m.current);
779
622
  };
780
- }, [t, P, f]), B(() => {
623
+ }, [t, O, T]), $(() => {
781
624
  var x;
782
- t && v && ((x = u.current) == null || x.focus({ preventScroll: !0 }));
783
- }, [t, i, v]), !v) return null;
784
- const R = i === s.length - 1, p = l, U = p ? [
785
- [0, 0, p.vw, p.hole.y],
786
- [p.hole.y + p.hole.h, 0, p.vw, p.vh - p.hole.y - p.hole.h],
787
- [p.hole.y, 0, p.hole.x, p.hole.h],
788
- [p.hole.y, p.hole.x + p.hole.w, p.vw - p.hole.x - p.hole.w, p.hole.h]
789
- ] : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], F = (x) => Math.max(0, x) + "px";
790
- return ve(
791
- /* @__PURE__ */ r("div", { className: `sj${t ? " on" : ""}${a ? " anim" : ""}`, "data-theme": n, "data-sj-ignore": !0, children: [
792
- U.map(([x, T, M, E], A) => /* @__PURE__ */ e("div", { className: "sj-p", style: { top: F(x), left: F(T), width: F(M), height: F(E) } }, A)),
793
- /* @__PURE__ */ e("div", { className: "sj-ring", style: p ? { top: p.hole.y, left: p.hole.x, width: F(p.hole.w), height: F(p.hole.h), opacity: p.centered ? 0 : 1 } : { opacity: 0 } }),
794
- /* @__PURE__ */ r(
625
+ t && w && ((x = b.current) == null || x.focus({ preventScroll: !0 }));
626
+ }, [t, o, w]), !w) return null;
627
+ const E = o === s.length - 1, c = p, W = c ? [
628
+ [0, 0, c.vw, c.hole.y],
629
+ [c.hole.y + c.hole.h, 0, c.vw, c.vh - c.hole.y - c.hole.h],
630
+ [c.hole.y, 0, c.hole.x, c.hole.h],
631
+ [c.hole.y, c.hole.x + c.hole.w, c.vw - c.hole.x - c.hole.w, c.hole.h]
632
+ ] : [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], D = (x) => Math.max(0, x) + "px";
633
+ return le(
634
+ /* @__PURE__ */ n("div", { className: `sj${t ? " on" : ""}${a ? " anim" : ""}`, "data-theme": i, "data-sj-ignore": !0, children: [
635
+ W.map(([x, r, f, S], M) => /* @__PURE__ */ e("div", { className: "sj-p", style: { top: D(x), left: D(r), width: D(f), height: D(S) } }, M)),
636
+ /* @__PURE__ */ e("div", { className: "sj-ring", style: c ? { top: c.hole.y, left: c.hole.x, width: D(c.hole.w), height: D(c.hole.h), opacity: c.centered ? 0 : 1 } : { opacity: 0 } }),
637
+ /* @__PURE__ */ n(
795
638
  "div",
796
639
  {
797
- ref: o,
640
+ ref: h,
798
641
  className: "sj-pop",
799
642
  role: "dialog",
800
643
  "aria-modal": "true",
801
644
  "aria-live": "polite",
802
- "data-side": (p == null ? void 0 : p.side) ?? "c",
803
- style: { transform: p ? `translate(${p.x}px,${p.y}px)` : void 0, "--ax": ((p == null ? void 0 : p.ax) ?? 0) + "px", "--ay": ((p == null ? void 0 : p.ay) ?? 0) + "px" },
645
+ "data-side": (c == null ? void 0 : c.side) ?? "c",
646
+ style: { transform: c ? `translate(${c.x}px,${c.y}px)` : void 0, "--ax": ((c == null ? void 0 : c.ax) ?? 0) + "px", "--ay": ((c == null ? void 0 : c.ay) ?? 0) + "px" },
804
647
  children: [
805
648
  /* @__PURE__ */ e("i", { className: "sj-arr" }),
806
- /* @__PURE__ */ e("div", { className: "sj-bar", children: /* @__PURE__ */ e("b", { style: { width: Math.round((i + 1) / s.length * 100) + "%" } }) }),
807
- /* @__PURE__ */ r("div", { className: "sj-hd", children: [
808
- /* @__PURE__ */ e("span", { children: v.welcome ? "Welcome" : `Step ${i + 1} of ${s.length}` }),
809
- /* @__PURE__ */ r("span", { children: [
810
- /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Switch light or dark theme", onClick: d, children: "◐" }),
811
- /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Close tour", onClick: c, children: "×" })
649
+ /* @__PURE__ */ e("div", { className: "sj-bar", children: /* @__PURE__ */ e("b", { style: { width: Math.round((o + 1) / s.length * 100) + "%" } }) }),
650
+ /* @__PURE__ */ n("div", { className: "sj-hd", children: [
651
+ /* @__PURE__ */ e("span", { children: w.welcome ? "Welcome" : `Step ${o + 1} of ${s.length}` }),
652
+ /* @__PURE__ */ n("span", { children: [
653
+ /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Switch light or dark theme", onClick: l, children: "◐" }),
654
+ /* @__PURE__ */ e("button", { className: "sj-x", "aria-label": "Close tour", onClick: d, children: "×" })
812
655
  ] })
813
656
  ] }),
814
- /* @__PURE__ */ e("h3", { children: v.title }),
815
- /* @__PURE__ */ e("p", { children: v.body }),
816
- /* @__PURE__ */ r("div", { className: "sj-ft", children: [
817
- /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: R ? "hidden" : "visible" }, onClick: c, children: "Skip" }),
818
- /* @__PURE__ */ r("span", { children: [
819
- /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: i ? "visible" : "hidden" }, onClick: w, children: "Back" }),
820
- /* @__PURE__ */ e("button", { ref: u, className: "sj-b", onClick: g, children: v.welcome ? m || "Start tour" : R ? "Finish" : "Next" })
657
+ /* @__PURE__ */ e("h3", { children: w.title }),
658
+ /* @__PURE__ */ e("p", { children: w.body }),
659
+ /* @__PURE__ */ n("div", { className: "sj-ft", children: [
660
+ /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: E ? "hidden" : "visible" }, onClick: d, children: "Skip" }),
661
+ /* @__PURE__ */ n("span", { children: [
662
+ /* @__PURE__ */ e("button", { className: "sj-g", style: { visibility: o ? "visible" : "hidden" }, onClick: N, children: "Back" }),
663
+ /* @__PURE__ */ e("button", { ref: b, className: "sj-b", onClick: g, children: w.welcome ? u || "Start tour" : E ? "Finish" : "Next" })
821
664
  ] })
822
665
  ] })
823
666
  ]
@@ -826,143 +669,143 @@ const se = (t, a, n) => Math.max(a, Math.min(n, t)), et = ({ open: t, anim: a, t
826
669
  ] }),
827
670
  document.body
828
671
  );
829
- }, tt = ({ tracker: t }) => {
830
- const a = _(null);
831
- return B(() => {
832
- const n = () => {
833
- const i = a.current;
834
- if (!i) return;
835
- const m = i.getContext("2d");
836
- if (!m) return;
837
- const f = document.documentElement.scrollWidth, g = t.state.heat[location.pathname + location.hash] || {};
838
- i.width = innerWidth, i.height = innerHeight, m.globalCompositeOperation = "lighter";
839
- for (const w in g) {
840
- const [c, d] = w.split(",").map(Number), o = c / 100 * f - scrollX, u = d * 20 + 10 - scrollY;
841
- if (o < -40 || u < -40 || o > innerWidth + 40 || u > innerHeight + 40) continue;
842
- const h = Math.min(1, g[w] / 6), l = m.createRadialGradient(o, u, 0, o, u, 34);
843
- l.addColorStop(0, `rgba(255,70,50,${0.5 * h + 0.1})`), l.addColorStop(1, "rgba(255,70,50,0)"), m.fillStyle = l, m.fillRect(o - 34, u - 34, 68, 68);
672
+ }, Me = ({ tracker: t }) => {
673
+ const a = B(null);
674
+ return $(() => {
675
+ const i = () => {
676
+ const o = a.current;
677
+ if (!o) return;
678
+ const u = o.getContext("2d");
679
+ if (!u) return;
680
+ const T = document.documentElement.scrollWidth, g = t.state.heat[location.pathname + location.hash] || {};
681
+ o.width = innerWidth, o.height = innerHeight, u.globalCompositeOperation = "lighter";
682
+ for (const N in g) {
683
+ const [d, l] = N.split(",").map(Number), h = d / 100 * T - scrollX, b = l * 20 + 10 - scrollY;
684
+ if (h < -40 || b < -40 || h > innerWidth + 40 || b > innerHeight + 40) continue;
685
+ const m = Math.min(1, g[N] / 6), p = u.createRadialGradient(h, b, 0, h, b, 34);
686
+ p.addColorStop(0, `rgba(255,70,50,${0.5 * m + 0.1})`), p.addColorStop(1, "rgba(255,70,50,0)"), u.fillStyle = p, u.fillRect(h - 34, b - 34, 68, 68);
844
687
  }
845
688
  };
846
- n();
847
- const s = window.setInterval(n, 250);
848
- return addEventListener("scroll", n, { passive: !0 }), addEventListener("resize", n), () => {
849
- clearInterval(s), removeEventListener("scroll", n), removeEventListener("resize", n);
689
+ i();
690
+ const s = window.setInterval(i, 250);
691
+ return addEventListener("scroll", i, { passive: !0 }), addEventListener("resize", i), () => {
692
+ clearInterval(s), removeEventListener("scroll", i), removeEventListener("resize", i);
850
693
  };
851
- }, [t]), ve(/* @__PURE__ */ e("canvas", { ref: a, className: "sj-heat", "data-sj-ignore": !0 }), document.body);
852
- }, Ne = Te(null);
853
- function de() {
854
- const t = je(Ne);
694
+ }, [t]), le(/* @__PURE__ */ e("canvas", { ref: a, className: "sj-heat", "data-sj-ignore": !0 }), document.body);
695
+ }, ce = ge(null);
696
+ function ie() {
697
+ const t = me(ce);
855
698
  if (!t) throw new Error("useJourney must be used inside <JourneyProvider>");
856
699
  return t;
857
700
  }
858
- function st() {
859
- const { tracker: t } = de();
860
- return Ce(t.subscribe, t.getVersion, t.getVersion), t.state;
701
+ function Ae() {
702
+ const { tracker: t } = ie();
703
+ return pe(t.subscribe, t.getVersion, t.getVersion), t.state;
861
704
  }
862
- const V = (t, a) => {
705
+ const _ = (t, a) => {
863
706
  try {
864
707
  return t();
865
708
  } catch {
866
709
  return a;
867
710
  }
868
- }, nt = ({ config: t, children: a }) => {
869
- const n = _(t ?? {});
870
- n.current = t ?? {};
871
- const s = Y(() => new ze(() => n.current), []), [i, m] = y(() => V(() => localStorage.getItem("sjTheme"), null) ?? (t == null ? void 0 : t.theme) ?? "auto"), [f, g] = y(() => V(() => matchMedia("(prefers-color-scheme:dark)").matches, !1));
872
- B(() => {
873
- const b = matchMedia("(prefers-color-scheme:dark)"), j = () => g(b.matches);
874
- return b.addEventListener("change", j), () => b.removeEventListener("change", j);
711
+ }, Ie = ({ config: t, children: a }) => {
712
+ const i = B(t ?? {});
713
+ i.current = t ?? {};
714
+ const s = ae(() => new Ee(() => i.current), []), [o, u] = j(() => _(() => localStorage.getItem("sjTheme"), null) ?? (t == null ? void 0 : t.theme) ?? "auto"), [T, g] = j(() => _(() => matchMedia("(prefers-color-scheme:dark)").matches, !1));
715
+ $(() => {
716
+ const v = matchMedia("(prefers-color-scheme:dark)"), L = () => g(v.matches);
717
+ return v.addEventListener("change", L), () => v.removeEventListener("change", L);
875
718
  }, []);
876
- const w = i === "auto" ? f ? "dark" : "light" : i;
877
- B(() => {
878
- document.documentElement.setAttribute("data-sj-theme", w);
879
- }, [w]);
880
- const c = L((b) => {
881
- m(b), V(() => localStorage.setItem("sjTheme", b), void 0), s.track("theme", { theme: b });
719
+ const N = o === "auto" ? T ? "dark" : "light" : o;
720
+ $(() => {
721
+ document.documentElement.setAttribute("data-sj-theme", N);
722
+ }, [N]);
723
+ const d = F((v) => {
724
+ u(v), _(() => localStorage.setItem("sjTheme", v), void 0), s.track("theme", { theme: v });
882
725
  }, [s]);
883
- B(() => s.attach(), [s]);
884
- const [d, o] = y(!1), [u, h] = y([]), [l, k] = y(-1), [v, I] = y(!1), P = _([]), R = _(-1), p = _(!1), U = _(!1), F = _(0), x = L((b) => {
885
- if (!p.current) return;
886
- const j = P.current[R.current];
887
- s.tourEnd(b, R.current, (j == null ? void 0 : j.title) ?? "", P.current.length), p.current = !1, o(!1);
888
- }, [s]), T = L((b, j = 0) => {
889
- const C = P.current, H = n.current;
890
- if (b < 0 && (b = 0), b >= C.length) return x("complete");
891
- const S = C[b];
892
- if (S.page && S.page !== location.pathname) {
893
- V(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: b, t: Date.now(), go: 1 })), void 0), s.track("step_navigate", { step: b, to: S.page }), s.flush(!0), location.href = S.page;
726
+ $(() => s.attach(), [s]);
727
+ const [l, h] = j(!1), [b, m] = j([]), [p, q] = j(-1), [w, k] = j(!1), O = B([]), E = B(-1), c = B(!1), W = B(!1), D = B(0), x = F((v) => {
728
+ if (!c.current) return;
729
+ const L = O.current[E.current];
730
+ s.tourEnd(v, E.current, (L == null ? void 0 : L.title) ?? "", O.current.length), c.current = !1, h(!1);
731
+ }, [s]), r = F((v, L = 0) => {
732
+ const R = O.current, U = i.current;
733
+ if (v < 0 && (v = 0), v >= R.length) return x("complete");
734
+ const C = R[v];
735
+ if (C.page && C.page !== location.pathname) {
736
+ _(() => sessionStorage.setItem("sjTour", JSON.stringify({ i: v, t: Date.now(), go: 1 })), void 0), s.track("step_navigate", { step: v, to: C.page }), s.flush(!0), location.href = C.page;
894
737
  return;
895
738
  }
896
- if (S.wait && !S.el && S.target && (S.el = document.querySelector(S.target)), S.target && !ie(S.el)) {
897
- if (j < (H.waitMs ?? 2500) / 100) {
739
+ if (C.wait && !C.el && C.target && (C.el = document.querySelector(C.target)), C.target && !te(C.el)) {
740
+ if (L < (U.waitMs ?? 2500) / 100) {
898
741
  window.setTimeout(() => {
899
- p.current && T(b, j + 1);
742
+ c.current && r(v, L + 1);
900
743
  }, 100);
901
744
  return;
902
745
  }
903
- s.track("step_missing", { step: b, target: S.target });
904
- const G = b >= R.current ? 1 : -1;
905
- return T(b + (b + G < 0 ? 1 : G), 0);
746
+ s.track("step_missing", { step: v, target: C.target });
747
+ const Q = v >= E.current ? 1 : -1;
748
+ return r(v + (v + Q < 0 ? 1 : Q), 0);
906
749
  }
907
- R.current = b, k(b), s.stepView(b, S.title, C.length), U.current && (I(!0), clearTimeout(F.current), F.current = window.setTimeout(() => I(!1), 520)), ie(S.el) && S.el.scrollIntoView({ block: "center", behavior: U.current ? "smooth" : "auto" }), U.current || requestAnimationFrame(() => {
908
- U.current = !0;
750
+ E.current = v, q(v), s.stepView(v, C.title, R.length), W.current && (k(!0), clearTimeout(D.current), D.current = window.setTimeout(() => k(!1), 520)), te(C.el) && C.el.scrollIntoView({ block: "center", behavior: W.current ? "smooth" : "auto" }), W.current || requestAnimationFrame(() => {
751
+ W.current = !0;
909
752
  });
910
- }, [x, s]), M = L((b = 0, j = !1) => {
911
- const C = Ze(n.current);
912
- C.length && (P.current = C, h(C), p.current = !0, U.current = !1, o(!0), s.tourStart(C.length, j), T(b));
913
- }, [T, s]), E = L(() => M(0), [M]), A = L(() => x("skip"), [x]), N = L(() => {
914
- p.current && (s.track("step_next", { step: R.current }), T(R.current + 1));
915
- }, [T, s]), D = L(() => {
916
- p.current && T(R.current - 1);
917
- }, [T]);
918
- B(() => {
919
- const b = V(() => JSON.parse(sessionStorage.getItem("sjTour") || "null"), null), j = n.current;
920
- let C;
921
- return b && Date.now() - b.t < 3e5 ? C = window.setTimeout(() => M(b.i, !0), 400) : j.autoStart !== !1 && !(j.once && V(() => localStorage.getItem("sjDone"), null)) && (C = window.setTimeout(() => M(0), 600)), () => clearTimeout(C);
922
- }, [M]), B(() => () => {
923
- p.current = !1;
924
- }, []), B(() => {
925
- if (!d) return;
926
- const b = (j) => {
927
- j.key === "Escape" ? x("skip") : j.key === "ArrowRight" ? N() : j.key === "ArrowLeft" && D();
753
+ }, [x, s]), f = F((v = 0, L = !1) => {
754
+ const R = Le(i.current);
755
+ R.length && (O.current = R, m(R), c.current = !0, W.current = !1, h(!0), s.tourStart(R.length, L), r(v));
756
+ }, [r, s]), S = F(() => f(0), [f]), M = F(() => x("skip"), [x]), y = F(() => {
757
+ c.current && (s.track("step_next", { step: E.current }), r(E.current + 1));
758
+ }, [r, s]), P = F(() => {
759
+ c.current && r(E.current - 1);
760
+ }, [r]);
761
+ $(() => {
762
+ const v = _(() => JSON.parse(sessionStorage.getItem("sjTour") || "null"), null), L = i.current;
763
+ let R;
764
+ return v && Date.now() - v.t < 3e5 ? R = window.setTimeout(() => f(v.i, !0), 400) : L.autoStart !== !1 && !(L.once && _(() => localStorage.getItem("sjDone"), null)) && (R = window.setTimeout(() => f(0), 600)), () => clearTimeout(R);
765
+ }, [f]), $(() => () => {
766
+ c.current = !1;
767
+ }, []), $(() => {
768
+ if (!l) return;
769
+ const v = (L) => {
770
+ L.key === "Escape" ? x("skip") : L.key === "ArrowRight" ? y() : L.key === "ArrowLeft" && P();
928
771
  };
929
- return addEventListener("keydown", b), () => removeEventListener("keydown", b);
930
- }, [d, x, N, D]);
931
- const [$, O] = y(!1), W = L(() => O((b) => !b), []), J = L((b) => s.configure(b), [s]), Q = Y(() => ({
772
+ return addEventListener("keydown", v), () => removeEventListener("keydown", v);
773
+ }, [l, x, y, P]);
774
+ const [A, I] = j(!1), J = F(() => I((v) => !v), []), H = F((v) => s.configure(v), [s]), z = ae(() => ({
932
775
  tracker: s,
933
- theme: i,
934
- resolvedTheme: w,
935
- setTheme: c,
936
- open: d,
937
- start: E,
938
- stop: A,
939
- next: N,
940
- back: D,
941
- heat: $,
942
- toggleHeat: W,
943
- configure: J
944
- }), [s, i, w, c, d, E, A, N, D, $, W, J]);
945
- return /* @__PURE__ */ r(Ne.Provider, { value: Q, children: [
776
+ theme: o,
777
+ resolvedTheme: N,
778
+ setTheme: d,
779
+ open: l,
780
+ start: S,
781
+ stop: M,
782
+ next: y,
783
+ back: P,
784
+ heat: A,
785
+ toggleHeat: J,
786
+ configure: H
787
+ }), [s, o, N, d, l, S, M, y, P, A, J, H]);
788
+ return /* @__PURE__ */ n(ce.Provider, { value: z, children: [
946
789
  a,
947
- u.length > 0 && /* @__PURE__ */ e(
948
- et,
790
+ b.length > 0 && /* @__PURE__ */ e(
791
+ Re,
949
792
  {
950
- open: d,
951
- anim: v,
952
- theme: w,
953
- steps: u,
954
- index: l,
793
+ open: l,
794
+ anim: w,
795
+ theme: N,
796
+ steps: b,
797
+ index: p,
955
798
  startLabel: t == null ? void 0 : t.startLabel,
956
799
  tracker: s,
957
- onNext: N,
958
- onBack: D,
959
- onSkip: A,
960
- onTheme: () => c(w === "dark" ? "light" : "dark")
800
+ onNext: y,
801
+ onBack: P,
802
+ onSkip: M,
803
+ onTheme: () => d(N === "dark" ? "light" : "dark")
961
804
  }
962
805
  ),
963
- $ && /* @__PURE__ */ e(tt, { tracker: s })
806
+ A && /* @__PURE__ */ e(Me, { tracker: s })
964
807
  ] });
965
- }, ne = (t) => t < 6e4 ? (t / 1e3).toFixed(1) + "s" : Math.floor(t / 6e4) + "m " + Math.round(t % 6e4 / 1e3) + "s", at = `import { JourneyProvider } from '@shiva004/surveys';
808
+ }, ee = (t) => t < 6e4 ? (t / 1e3).toFixed(1) + "s" : Math.floor(t / 6e4) + "m " + Math.round(t % 6e4 / 1e3) + "s", Fe = `import { JourneyProvider } from '@shiva004/surveys';
966
809
 
967
810
  <JourneyProvider
968
811
  config={{
@@ -978,70 +821,70 @@ const V = (t, a) => {
978
821
  }}
979
822
  >
980
823
  <App />
981
- </JourneyProvider>`, it = ({ open: t, onClose: a }) => {
982
- const { toggleHeat: n, configure: s } = de(), i = st(), [m, f] = y("m"), g = location.pathname + location.hash, w = i.pages[g] || { ms: 0, depth: 0 }, c = i.started ? Math.round(i.completed / i.started * 100) + "%" : "–", d = [["Time on page", ne(w.ms)], ["Scrolling", ne(i.scrollMs)], ["Scroll depth", w.depth + "%"], ["Clicks", i.clicks], ["Completion", c], ["Navigations", i.nav]], o = Object.entries(i.steps).sort((h, l) => +h[0] - +l[0]), u = Math.max(1, ...o.map((h) => h[1].ms));
983
- return /* @__PURE__ */ r("aside", { className: `nw-ins${t ? " open" : ""}`, "data-sj-ignore": !0, "aria-label": "Journey insights", children: [
984
- /* @__PURE__ */ r("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
824
+ </JourneyProvider>`, Oe = ({ open: t, onClose: a }) => {
825
+ const { toggleHeat: i, configure: s } = ie(), o = Ae(), [u, T] = j("m"), g = location.pathname + location.hash, N = o.pages[g] || { ms: 0, depth: 0 }, d = o.started ? Math.round(o.completed / o.started * 100) + "%" : "–", l = [["Time on page", ee(N.ms)], ["Scrolling", ee(o.scrollMs)], ["Scroll depth", N.depth + "%"], ["Clicks", o.clicks], ["Completion", d], ["Navigations", o.nav]], h = Object.entries(o.steps).sort((m, p) => +m[0] - +p[0]), b = Math.max(1, ...h.map((m) => m[1].ms));
826
+ return /* @__PURE__ */ n("aside", { className: `nw-ins${t ? " open" : ""}`, "data-sj-ignore": !0, "aria-label": "Journey insights", children: [
827
+ /* @__PURE__ */ n("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
985
828
  /* @__PURE__ */ e("strong", { children: "Journey insights" }),
986
829
  /* @__PURE__ */ e("button", { className: "nw-x", onClick: a, "aria-label": "Close", children: "×" })
987
830
  ] }),
988
- /* @__PURE__ */ e("div", { className: "nw-tabs", children: [["m", "Metrics"], ["e", "Events"], ["c", "Embed"]].map(([h, l]) => /* @__PURE__ */ e("button", { className: m === h ? "on" : "", onClick: () => f(h), children: l }, h)) }),
989
- m === "m" && /* @__PURE__ */ r(ae, { children: [
990
- /* @__PURE__ */ e("div", { className: "nw-kpis", children: d.map(([h, l]) => /* @__PURE__ */ r("div", { className: "nw-kpi", children: [
991
- /* @__PURE__ */ e("small", { children: h }),
992
- /* @__PURE__ */ e("b", { children: l })
993
- ] }, h)) }),
831
+ /* @__PURE__ */ e("div", { className: "nw-tabs", children: [["m", "Metrics"], ["e", "Events"], ["c", "Embed"]].map(([m, p]) => /* @__PURE__ */ e("button", { className: u === m ? "on" : "", onClick: () => T(m), children: p }, m)) }),
832
+ u === "m" && /* @__PURE__ */ n(V, { children: [
833
+ /* @__PURE__ */ e("div", { className: "nw-kpis", children: l.map(([m, p]) => /* @__PURE__ */ n("div", { className: "nw-kpi", children: [
834
+ /* @__PURE__ */ e("small", { children: m }),
835
+ /* @__PURE__ */ e("b", { children: p })
836
+ ] }, m)) }),
994
837
  /* @__PURE__ */ e("h4", { children: "Time per page" }),
995
- Object.entries(i.pages).map(([h, l]) => /* @__PURE__ */ r("div", { className: "nw-row", children: [
996
- /* @__PURE__ */ e("span", { children: h }),
997
- /* @__PURE__ */ r("span", { children: [
998
- ne(l.ms),
838
+ Object.entries(o.pages).map(([m, p]) => /* @__PURE__ */ n("div", { className: "nw-row", children: [
839
+ /* @__PURE__ */ e("span", { children: m }),
840
+ /* @__PURE__ */ n("span", { children: [
841
+ ee(p.ms),
999
842
  " · ",
1000
- l.depth,
843
+ p.depth,
1001
844
  "% deep"
1002
845
  ] })
1003
- ] }, h)),
846
+ ] }, m)),
1004
847
  /* @__PURE__ */ e("h4", { children: "Walkthrough funnel and drop-offs" }),
1005
- o.length ? o.map(([h, l]) => /* @__PURE__ */ r(ge.Fragment, { children: [
1006
- /* @__PURE__ */ r("div", { className: "nw-row", children: [
1007
- /* @__PURE__ */ r("span", { children: [
1008
- +h + 1,
848
+ h.length ? h.map(([m, p]) => /* @__PURE__ */ n(ue.Fragment, { children: [
849
+ /* @__PURE__ */ n("div", { className: "nw-row", children: [
850
+ /* @__PURE__ */ n("span", { children: [
851
+ +m + 1,
1009
852
  ". ",
1010
- l.title
853
+ p.title
1011
854
  ] }),
1012
- /* @__PURE__ */ r("span", { children: [
1013
- l.views,
855
+ /* @__PURE__ */ n("span", { children: [
856
+ p.views,
1014
857
  "× · ",
1015
- ne(l.ms),
1016
- i.drops[+h] ? /* @__PURE__ */ r(ae, { children: [
858
+ ee(p.ms),
859
+ o.drops[+m] ? /* @__PURE__ */ n(V, { children: [
1017
860
  " · ",
1018
- /* @__PURE__ */ r("b", { className: "nw-warn", children: [
1019
- i.drops[+h],
861
+ /* @__PURE__ */ n("b", { className: "nw-warn", children: [
862
+ o.drops[+m],
1020
863
  " dropped"
1021
864
  ] })
1022
865
  ] }) : null
1023
866
  ] })
1024
867
  ] }),
1025
- /* @__PURE__ */ e("div", { className: "nw-meter", children: /* @__PURE__ */ e("i", { style: { width: Math.round(l.ms / u * 100) + "%" } }) })
1026
- ] }, h)) : /* @__PURE__ */ r("div", { className: "nw-row", children: [
868
+ /* @__PURE__ */ e("div", { className: "nw-meter", children: /* @__PURE__ */ e("i", { style: { width: Math.round(p.ms / b * 100) + "%" } }) })
869
+ ] }, m)) : /* @__PURE__ */ n("div", { className: "nw-row", children: [
1027
870
  /* @__PURE__ */ e("span", { children: "No tour data yet" }),
1028
871
  /* @__PURE__ */ e("span", {})
1029
872
  ] }),
1030
873
  /* @__PURE__ */ e("h4", { children: "Heatmap" }),
1031
- /* @__PURE__ */ e("button", { className: "nw-btn", onClick: n, children: "Toggle heatmap overlay" })
874
+ /* @__PURE__ */ e("button", { className: "nw-btn", onClick: i, children: "Toggle heatmap overlay" })
1032
875
  ] }),
1033
- m === "e" && i.log.slice(0, 30).map((h, l) => /* @__PURE__ */ r("div", { className: "nw-row", children: [
1034
- /* @__PURE__ */ e("span", { children: h.type }),
1035
- /* @__PURE__ */ r("span", { children: [
1036
- String(h.title || h.sel || h.pct || h.n || h.to || h.theme || ""),
876
+ u === "e" && o.log.slice(0, 30).map((m, p) => /* @__PURE__ */ n("div", { className: "nw-row", children: [
877
+ /* @__PURE__ */ e("span", { children: m.type }),
878
+ /* @__PURE__ */ n("span", { children: [
879
+ String(m.title || m.sel || m.pct || m.n || m.to || m.theme || ""),
1037
880
  " · ",
1038
- new Date(h.t).toLocaleTimeString()
881
+ new Date(m.t).toLocaleTimeString()
1039
882
  ] })
1040
- ] }, `${h.t}-${l}`)),
1041
- m === "c" && /* @__PURE__ */ r(ae, { children: [
883
+ ] }, `${m.t}-${p}`)),
884
+ u === "c" && /* @__PURE__ */ n(V, { children: [
1042
885
  /* @__PURE__ */ e("h4", { children: "Install in a React app" }),
1043
- /* @__PURE__ */ e("pre", { children: at }),
1044
- /* @__PURE__ */ r("p", { children: [
886
+ /* @__PURE__ */ e("pre", { children: Fe }),
887
+ /* @__PURE__ */ n("p", { children: [
1045
888
  "No ",
1046
889
  /* @__PURE__ */ e("code", { children: "steps" }),
1047
890
  "? Add ",
@@ -1057,8 +900,8 @@ const V = (t, a) => {
1057
900
  " continues the tour after navigating."
1058
901
  ] }),
1059
902
  /* @__PURE__ */ e("h4", { children: "Backend endpoint" }),
1060
- /* @__PURE__ */ e("input", { placeholder: "/api/journey/events", onChange: (h) => s({ endpoint: h.target.value.trim() }) }),
1061
- /* @__PURE__ */ r("p", { children: [
903
+ /* @__PURE__ */ e("input", { placeholder: "/api/journey/events", onChange: (m) => s({ endpoint: m.target.value.trim() }) }),
904
+ /* @__PURE__ */ n("p", { children: [
1062
905
  "Run ",
1063
906
  /* @__PURE__ */ e("code", { children: "node server.js" }),
1064
907
  ", open ",
@@ -1067,82 +910,82 @@ const V = (t, a) => {
1067
910
  ] })
1068
911
  ] })
1069
912
  ] });
1070
- }, rt = () => {
1071
- const { start: t, setTheme: a, resolvedTheme: n } = de(), [s, i] = y(!1);
1072
- return /* @__PURE__ */ r("div", { className: "nw", id: "top", children: [
1073
- /* @__PURE__ */ r("header", { className: "nw-head", "data-sj-step": 1, "data-sj-title": "Main navigation", "data-sj-body": "Jump between Features, Pricing and Contact from here. It stays visible as you scroll.", "data-sj-place": "bottom", children: [
1074
- /* @__PURE__ */ r("a", { className: "nw-logo", href: "#top", children: [
913
+ }, $e = () => {
914
+ const { start: t, setTheme: a, resolvedTheme: i } = ie(), [s, o] = j(!1);
915
+ return /* @__PURE__ */ n("div", { className: "nw", id: "top", children: [
916
+ /* @__PURE__ */ n("header", { className: "nw-head", "data-sj-step": 1, "data-sj-title": "Main navigation", "data-sj-body": "Jump between Features, Pricing and Contact from here. It stays visible as you scroll.", "data-sj-place": "bottom", children: [
917
+ /* @__PURE__ */ n("a", { className: "nw-logo", href: "#top", children: [
1075
918
  /* @__PURE__ */ e("i", { children: "◆" }),
1076
919
  " Northwind"
1077
920
  ] }),
1078
- /* @__PURE__ */ r("nav", { className: "nw-nav", children: [
921
+ /* @__PURE__ */ n("nav", { className: "nw-nav", children: [
1079
922
  /* @__PURE__ */ e("a", { href: "#features", children: "Features" }),
1080
923
  /* @__PURE__ */ e("a", { href: "#pricing", children: "Pricing" }),
1081
924
  /* @__PURE__ */ e("a", { href: "#contact", children: "Contact" })
1082
925
  ] }),
1083
926
  /* @__PURE__ */ e("button", { className: "nw-btn", id: "srch", "data-sj-step": 2, "data-sj-title": "Search", "data-sj-body": "Find any page or help article instantly.", "data-sj-place": "left", children: "Search" })
1084
927
  ] }),
1085
- /* @__PURE__ */ r("main", { className: "nw-wrap", children: [
1086
- /* @__PURE__ */ r("section", { className: "nw-hero", children: [
928
+ /* @__PURE__ */ n("main", { className: "nw-wrap", children: [
929
+ /* @__PURE__ */ n("section", { className: "nw-hero", children: [
1087
930
  /* @__PURE__ */ e("h1", { children: "Ship products people actually finish onboarding." }),
1088
931
  /* @__PURE__ */ e("p", { children: "Northwind is a sample site. The walkthrough reads each element’s position at runtime, so the same component fits any layout." }),
1089
- /* @__PURE__ */ r("div", { className: "nw-acts", children: [
932
+ /* @__PURE__ */ n("div", { className: "nw-acts", children: [
1090
933
  /* @__PURE__ */ e("a", { className: "nw-btn p", href: "#pricing", "data-sj-step": 3, "data-sj-title": "Primary action", "data-sj-body": "Start here. This button takes new visitors straight to the plans. You can click it while it is highlighted.", "data-sj-place": "right", children: "Get started" }),
1091
934
  /* @__PURE__ */ e("a", { className: "nw-btn", href: "#features", children: "See features" })
1092
935
  ] })
1093
936
  ] }),
1094
- /* @__PURE__ */ r("section", { id: "features", "data-sj-step": 4, "data-sj-title": "Feature overview", "data-sj-body": "Three things Northwind does best. Large sections are fitted to the screen automatically.", "data-sj-place": "top", children: [
937
+ /* @__PURE__ */ n("section", { id: "features", "data-sj-step": 4, "data-sj-title": "Feature overview", "data-sj-body": "Three things Northwind does best. Large sections are fitted to the screen automatically.", "data-sj-place": "top", children: [
1095
938
  /* @__PURE__ */ e("h2", { children: "Features" }),
1096
- /* @__PURE__ */ r("div", { className: "nw-grid", children: [
1097
- /* @__PURE__ */ r("div", { className: "nw-card", children: [
939
+ /* @__PURE__ */ n("div", { className: "nw-grid", children: [
940
+ /* @__PURE__ */ n("div", { className: "nw-card", children: [
1098
941
  /* @__PURE__ */ e("h3", { children: "Live analytics" }),
1099
942
  /* @__PURE__ */ e("p", { children: "Page time, scroll depth and clicks, collected as people browse." })
1100
943
  ] }),
1101
- /* @__PURE__ */ r("div", { className: "nw-card", children: [
944
+ /* @__PURE__ */ n("div", { className: "nw-card", children: [
1102
945
  /* @__PURE__ */ e("h3", { children: "Heatmaps" }),
1103
946
  /* @__PURE__ */ e("p", { children: "See where attention gathers and where it never reaches." })
1104
947
  ] }),
1105
- /* @__PURE__ */ r("div", { className: "nw-card", children: [
948
+ /* @__PURE__ */ n("div", { className: "nw-card", children: [
1106
949
  /* @__PURE__ */ e("h3", { children: "Guided tours" }),
1107
950
  /* @__PURE__ */ e("p", { children: "Spotlight any element with a popup that repositions itself." })
1108
951
  ] })
1109
952
  ] })
1110
953
  ] }),
1111
- /* @__PURE__ */ r("section", { id: "pricing", children: [
954
+ /* @__PURE__ */ n("section", { id: "pricing", children: [
1112
955
  /* @__PURE__ */ e("h2", { children: "Pricing" }),
1113
- /* @__PURE__ */ r("div", { className: "nw-grid", children: [
1114
- /* @__PURE__ */ r("div", { className: "nw-card", children: [
956
+ /* @__PURE__ */ n("div", { className: "nw-grid", children: [
957
+ /* @__PURE__ */ n("div", { className: "nw-card", children: [
1115
958
  /* @__PURE__ */ e("h3", { children: "Starter" }),
1116
959
  /* @__PURE__ */ e("div", { className: "nw-big", children: "$0" }),
1117
960
  /* @__PURE__ */ e("p", { children: "For side projects." })
1118
961
  ] }),
1119
- /* @__PURE__ */ r("div", { className: "nw-card", children: [
962
+ /* @__PURE__ */ n("div", { className: "nw-card", children: [
1120
963
  /* @__PURE__ */ e("h3", { children: "Team" }),
1121
964
  /* @__PURE__ */ e("div", { className: "nw-big", children: "$29" }),
1122
965
  /* @__PURE__ */ e("p", { children: "For growing teams." })
1123
966
  ] }),
1124
- /* @__PURE__ */ r("div", { className: "nw-card hot", "data-sj-step": 5, "data-sj-title": "Recommended plan", "data-sj-body": "Most teams pick this one. The popup flips sides on its own when there is no room.", "data-sj-place": "left", children: [
967
+ /* @__PURE__ */ n("div", { className: "nw-card hot", "data-sj-step": 5, "data-sj-title": "Recommended plan", "data-sj-body": "Most teams pick this one. The popup flips sides on its own when there is no room.", "data-sj-place": "left", children: [
1125
968
  /* @__PURE__ */ e("h3", { children: "Scale" }),
1126
969
  /* @__PURE__ */ e("div", { className: "nw-big", children: "$99" }),
1127
970
  /* @__PURE__ */ e("p", { children: "Unlimited journeys and exports." })
1128
971
  ] })
1129
972
  ] })
1130
973
  ] }),
1131
- /* @__PURE__ */ r("section", { id: "contact", children: [
974
+ /* @__PURE__ */ n("section", { id: "contact", children: [
1132
975
  /* @__PURE__ */ e("h2", { children: "Contact" }),
1133
976
  /* @__PURE__ */ e("div", { className: "nw-card", children: /* @__PURE__ */ e("p", { children: "hello@northwind.example: we reply within a day." }) })
1134
977
  ] })
1135
978
  ] }),
1136
979
  /* @__PURE__ */ e("footer", { className: "nw-foot", "data-sj-step": 6, "data-sj-title": "Footer and help", "data-sj-body": "Legal links, support and contact details live down here.", "data-sj-place": "top", children: "© Northwind · Privacy · Terms · Status" }),
1137
- /* @__PURE__ */ r("div", { className: "nw-dock", "data-sj-ignore": !0, children: [
980
+ /* @__PURE__ */ n("div", { className: "nw-dock", "data-sj-ignore": !0, children: [
1138
981
  /* @__PURE__ */ e("button", { onClick: t, children: "▶ Tour" }),
1139
- /* @__PURE__ */ e("button", { onClick: () => a(n === "dark" ? "light" : "dark"), children: "◐ Theme" }),
1140
- /* @__PURE__ */ e("button", { onClick: () => i((m) => !m), children: "▤ Insights" })
982
+ /* @__PURE__ */ e("button", { onClick: () => a(i === "dark" ? "light" : "dark"), children: "◐ Theme" }),
983
+ /* @__PURE__ */ e("button", { onClick: () => o((u) => !u), children: "▤ Insights" })
1141
984
  ] }),
1142
- /* @__PURE__ */ e(it, { open: s, onClose: () => i(!1) })
985
+ /* @__PURE__ */ e(Oe, { open: s, onClose: () => o(!1) })
1143
986
  ] });
1144
- }, ut = ({ endpoint: t, config: a }) => /* @__PURE__ */ e(
1145
- nt,
987
+ }, He = ({ endpoint: t, config: a }) => /* @__PURE__ */ e(
988
+ Ie,
1146
989
  {
1147
990
  config: {
1148
991
  endpoint: t ?? new URLSearchParams(location.search).get("api") ?? "",
@@ -1151,24 +994,16 @@ const V = (t, a) => {
1151
994
  outro: { title: "You’re all set", body: "Open Insights to see the time, scroll depth, clicks and heatmap this session just generated." },
1152
995
  ...a
1153
996
  },
1154
- children: /* @__PURE__ */ e(rt, {})
997
+ children: /* @__PURE__ */ e($e, {})
1155
998
  }
1156
999
  );
1157
1000
  export {
1158
- De as JourneyApp,
1159
- nt as JourneyProvider,
1160
- ze as JourneyTracker,
1161
- Xe as SurveyApp,
1162
- ht as SurveyJourneyApp,
1163
- ut as WalkthroughDemo,
1164
- $e as flowStats,
1165
- Pe as navigationStats,
1166
- pe as npsCategory,
1167
- le as npsOf,
1168
- ce as npsScores,
1169
- Re as pathStats,
1170
- we as simulate,
1171
- Le as stageReach,
1172
- de as useJourney,
1173
- st as useJourneyStats
1001
+ ye as FeedbackApp,
1002
+ Ie as JourneyProvider,
1003
+ Ee as JourneyTracker,
1004
+ Se as LogsApp,
1005
+ Be as LogsFeedbackApp,
1006
+ He as WalkthroughDemo,
1007
+ ie as useJourney,
1008
+ Ae as useJourneyStats
1174
1009
  };