sitetourkit 0.0.0-stage → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,324 @@
1
- # Temporary Holding Version
1
+ # TourKit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/deecalov/tourkit/actions/workflows/ci.yml/badge.svg)](https://github.com/deecalov/tourkit/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/sitetourkit)](https://www.npmjs.com/package/sitetourkit)
5
+ [![bundle size](https://img.shields.io/badge/core-10.7%20KB%20brotli-blue)](#)
6
+ [![license](https://img.shields.io/badge/license-MIT-green)](LICENSE)
7
+
8
+ Lightweight, dependency-free product tours and onboarding walkthroughs.
9
+ MIT-licensed, accessible, framework-agnostic.
10
+
11
+ - **SVG spotlight** instead of z-index hacks — works inside `transform`/`filter` stacking contexts, never mutates your DOM.
12
+ - **Async targets (SPA-ready)**: steps wait for lazily mounted elements and the spotlight flows to them when they appear (`waitForTarget`); no "element not found" failures.
13
+ - **Interactive steps**: `advanceOn` moves the tour forward when the user clicks the highlighted element; `highlight()` spotlights anything without a tour.
14
+ - **Viewport-based positioning** with flip / shift / arrow and graceful fallback to a centered dialog.
15
+ - **Accessible by default**: real `<button>`s, focus trap and restore, `aria-live` step announcements, full keyboard support, `prefers-reduced-motion`, Windows High Contrast (forced-colors), opt-in modal mode (`inert`) and scroll locking. Steps that allow interacting with the target include it in the Tab cycle — including targets inside open shadow roots.
16
+ - **XSS-safe by default**: step content is rendered as plain text unless you opt in with `allowHTML` (with an optional `sanitize` hook). CSP-friendly: external CSS or `injectStyles({ nonce })`.
17
+ - **Fits anywhere**: shadow DOM via `root`, `<script>` tags via per-entry global builds, and a DOM-free `TourEngine` for custom UIs.
18
+ - **Small**: core ~10.7 KB brotli + ~3.8 KB CSS (brotli), zero runtime dependencies, ESM / CJS / IIFE (global) builds, SSR-safe imports. Optional entries: hints, intro.js migration adapter, locales, style injector.
19
+
20
+ ## Comparison
21
+
22
+ | | TourKit | driver.js | Shepherd.js | intro.js |
23
+ | ---------------------------------------- | ----------------------------- | --------------------- | ----------------- | ----------------------------- |
24
+ | License | **MIT** | MIT | AGPL / commercial | AGPL / commercial |
25
+ | Core size (compressed) | ~10.7 KB | ~5 KB | ~25 KB | ~29 KB |
26
+ | Waits for async targets | **Yes** | No | No | No |
27
+ | Hints (beacons) | **Yes** | No | No | Yes |
28
+ | Show-once / progress persistence | **Yes** | No | No | Cookie-based |
29
+ | Accessibility (axe serious violations) | **0** | 4* | 2* | 7* |
30
+ | Works in transform/filter contexts | **Yes** | Yes | Partial | No |
31
+ | Tracks targets in scrolled containers | **Yes, 0 px error**\*\* | No (static overlay)** | not benched | No (drifts ~1200 px)** |
32
+ | Layouts per frame while window-scrolling | **1**\*\* | 4\*\* | not benched | 0 (page-coordinate drawing)** |
33
+ | Host DOM untouched | **Yes** (opt-in `inert` only) | No (classes) | No | No (classes/z-index) |
34
+ | intro.js migration adapter | **Yes** | — | — | — |
35
+
36
+ \* third-party audit data, 2026. \*\* measured on our public bench stand
37
+ (Playwright + CDP, all three libraries as black boxes through their public
38
+ APIs) — methodology and full numbers in
39
+ [`docs/tourkit-vs-introjs-benchmark.md`](docs/tourkit-vs-introjs-benchmark.md).
40
+
41
+ ## Quick start
42
+
43
+ ```bash
44
+ npm install sitetourkit
45
+ ```
46
+
47
+ TourKit is published on npm as `sitetourkit`.
48
+
49
+ ```ts
50
+ import { createTour } from "sitetourkit";
51
+ import "sitetourkit/styles.css"; // or: import { injectStyles } from "sitetourkit/inject-styles"
52
+
53
+ const tour = createTour({
54
+ steps: [
55
+ { title: "Welcome!", content: "A floating step without a target." },
56
+ { target: "#save", title: "Saving", content: "Click here to save.", placement: "bottom-start" },
57
+ { target: () => document.querySelector(".chart"), content: "Charts are built automatically." },
58
+ // SPA: the panel may not exist yet — the step floats, then anchors when it mounts.
59
+ { target: "#lazy-panel", content: "Click the panel to continue.", advanceOn: true },
60
+ ],
61
+ });
62
+
63
+ tour.on("complete", ({ reason }) => console.log(reason)); // "finished" | "skipped"
64
+ await tour.start();
65
+ ```
66
+
67
+ ### Async targets and interactive steps (v0.5)
68
+
69
+ ```ts
70
+ createTour({
71
+ waitForTarget: { timeoutMs: 8000, onTimeout: "skip" }, // per-tour default; per-step override or `false`
72
+ steps: [
73
+ { target: "#mounted-later", content: "Appears when ready", advanceOn: { event: "click" } },
74
+ ],
75
+ });
76
+
77
+ import { highlight } from "sitetourkit";
78
+ const spot = highlight("#export-button"); // standalone spotlight, no tooltip
79
+ spot.move("#next-thing");
80
+ spot.destroy(); // or Esc / backdrop click
81
+
82
+ tour.complete(); // programmatic completion: reason "finished", showOnce marked
83
+ ```
84
+
85
+ Modal onboarding: `createTour({ modal: true, ... })` sets `aria-modal` and
86
+ makes everything outside the tour `inert` (restored on exit) — the one
87
+ deliberate opt-in exception to the "never mutate the host DOM" rule. The
88
+ highlighted target is not interactive in this mode.
89
+
90
+ ### Declarative steps
91
+
92
+ ```html
93
+ <button data-tour="Click to save" data-tour-title="Saving" data-tour-step="2">Save</button>
94
+ ```
95
+
96
+ ```ts
97
+ createTour().start(); // scans [data-tour] when no steps are configured
98
+ ```
99
+
100
+ ### Hints (v0.2)
101
+
102
+ ```ts
103
+ import { createHints } from "sitetourkit/hints";
104
+
105
+ const hints = createHints({
106
+ rememberDismissed: { key: "hints:main" }, // dismissed hints stay hidden
107
+ hints: [{ target: "#export", content: "Export to Excel", markerPosition: "top-end" }],
108
+ }).render(); // or declaratively via [data-hint] attributes
109
+
110
+ hints.add({ target: "#new-feature", content: "Just shipped!", id: "nf" }); // dynamic (v0.5)
111
+ hints.remove("nf");
112
+ ```
113
+
114
+ ### Show once (v0.2)
115
+
116
+ ```ts
117
+ createTour({ showOnce: { key: "tour:onboarding", checkbox: true }, steps }); // once per user
118
+ ```
119
+
120
+ ### Migration from intro.js
121
+
122
+ `sitetourkit/compat-introjs` is a **migration adapter**, not a 100% drop-in
123
+ replacement. It maps the intro.js option names, callbacks, `data-intro`
124
+ attributes and 1-based step numbers onto TourKit:
125
+
126
+ ```ts
127
+ import { introJs } from "sitetourkit/compat-introjs";
128
+ introJs
129
+ .tour()
130
+ .setOptions({ steps: [{ element: "#a", intro: "Text" }] })
131
+ .start();
132
+ ```
133
+
134
+ Matched intro.js behaviors: boundary button hiding (`hidePrev`/`hideNext`),
135
+ `goToStepNumber()` by explicit `data-step` number, completion reasons
136
+ (`"done"` / `"end"` / `"skip"`), no `oncomplete` when closing mid-tour,
137
+ HTML step content by default, restart semantics of repeated `start()`,
138
+ `getOption` / `getSteps` / `getStep` / `clone` / `setDontShowAgain`.
139
+
140
+ Known gaps (use the native API instead): `onhighlight*` callbacks, floating
141
+ helper layer options (`helperLayer*`), per-hint programmatic `addHint()`,
142
+ `hideHintDialog()`, cookie-based persistence (localStorage is used). The
143
+ adapter renders step content as HTML (intro.js contract) — pass
144
+ `tooltipRenderAsHtml: false`, or a `sanitize` function, for untrusted data.
145
+
146
+ ### Custom content, multi-spotlight, multi-page, MVC
147
+
148
+ ```ts
149
+ createTour({
150
+ persistProgress: { key: "tour:orders" }, // resumes across page loads
151
+ steps: [
152
+ { target: "#a", content: "", renderStep: (ctx, host) => host.append(buildForm()) },
153
+ { target: "#b", content: "Both cards", highlight: ["#c", "#d"] }, // extra cutouts
154
+ ],
155
+ });
156
+
157
+ import { de } from "sitetourkit/locales"; // ar, de, es, fr, it, ja, pl, ptBR, ru, tr, zhCN
158
+ import { bindTriggers } from "sitetourkit";
159
+ bindTriggers(document, { labels: de }); // [data-tour-trigger] buttons just work
160
+ ```
161
+
162
+ ### Shadow DOM, script tags and headless (v0.6)
163
+
164
+ ```ts
165
+ // Web components: string selectors are resolved inside the given root.
166
+ createTour({ root: document.querySelector("my-widget")!.shadowRoot!, steps });
167
+
168
+ // Modal onboarding with the page frozen behind it.
169
+ createTour({ modal: true, lockScroll: true, steps });
170
+
171
+ // Untrusted HTML content.
172
+ createTour({ allowHTML: true, sanitize: (html) => DOMPurify.sanitize(html), steps });
173
+
174
+ // Your own UI on top of the DOM-free engine.
175
+ import { TourEngine, type EngineDelegate } from "sitetourkit";
176
+ new TourEngine(myDelegate).start(steps);
177
+ ```
178
+
179
+ Script-tag builds, one global per entry: `dist/index.global.js` (`TourKit`),
180
+ `dist/hints.global.js` (`TourKitHints`), `dist/compat-introjs.global.js`
181
+ (`TourKitIntroJs`), `dist/locales.global.js` (`TourKitLocales`).
182
+
183
+ ### Host integration (v0.7)
184
+
185
+ An app with its own chrome — toasts, dialogs, hotkeys — needs to know when a
186
+ tour is running, and it needs the tour not to steal keys the app has already
187
+ handled.
188
+
189
+ ```css
190
+ /* While a tour runs, drop your notification stack below its tooltip. */
191
+ body.tk-tour-active .my-toasts {
192
+ z-index: 40;
193
+ }
194
+ body.tk-highlight-active .my-hint-markers {
195
+ visibility: hidden;
196
+ }
197
+ body.tk-hints-open .my-sidebar {
198
+ pointer-events: none;
199
+ }
200
+ ```
201
+
202
+ `tk-tour-active`, `tk-highlight-active` and `tk-hints-open` are set on `<body>`
203
+ for as long as a tour, a standalone `highlight()` or a hint popover is
204
+ mounted. They are reference-counted, so overlapping instances do not strip
205
+ each other's flag. Opt out with `hostClasses: false`.
206
+
207
+ `Esc` that your page already handled (`event.defaultPrevented`) is ignored by
208
+ the tour, `highlight()` and hints — a dialog opened on top of an interactive
209
+ step closes without ending the tour. Navigation keys are exempt: apps often
210
+ `preventDefault()` arrows to stop the page from scrolling.
211
+
212
+ Switching tours from a menu needs no teardown boilerplate:
213
+
214
+ ```ts
215
+ await nextTour.start({ replace: true }); // waits for any running tour to exit
216
+ ```
217
+
218
+ **Layering with your own dialogs.** The tour stays deliberately below host
219
+ modals when a step is interactive (`advanceOn`): the dialog the user is asked
220
+ to open must render on top of the spotlight. Set `--tk-z` (or `zIndex`) under
221
+ your modal layer and do **not** enable `modal: true` — its `inert` treatment
222
+ would block your own dialog. A layout that works in production:
223
+ `fx/confetti 4000 > toasts 90 > app modals 60 > tour 50 > toasts while touring 40`.
224
+
225
+ **Markup collisions.** `data-tour` is a generic name; if your page already uses
226
+ it, a `createTour()` without `steps` would scan _your_ attributes and build a
227
+ tour out of them. Rename the whole family in one option:
228
+
229
+ ```ts
230
+ createTour({ dataAttribute: "data-tk-step", steps: [] }); // scans data-tk-step*
231
+ bindTriggers(document, { dataAttribute: "data-tk-step" }); // [data-tk-step-trigger]
232
+ ```
233
+
234
+ ### Vendoring without a bundler
235
+
236
+ Every entry is self-contained — no shared `chunk-*.js`, no hashed filenames —
237
+ so `dist` can be copied into `wwwroot/vendor/tourkit/` and referenced
238
+ directly. Copy what you use:
239
+
240
+ | File | Needed for |
241
+ | --------------------------- | ------------------------------------------------------------ |
242
+ | `styles.css` | always (or call `injectStyles()` instead) |
243
+ | `index.global.js` | tours, `highlight()`, `bindTriggers` (`window.TourKit`) |
244
+ | `hints.global.js` | hints (`window.TourKitHints`) |
245
+ | `locales.global.js` | bundled label sets (`window.TourKitLocales`) |
246
+ | `compat-introjs.global.js` | the intro.js migration adapter (`window.TourKitIntroJs`) |
247
+ | `index.js`, `hints.js`, ... | the same entries as ES modules, for `<script type="module">` |
248
+
249
+ Loading two entries on one page duplicates a few KB of shared internals; that
250
+ is the deliberate trade for stable, individually copyable filenames.
251
+
252
+ ## API surface
253
+
254
+ `createTour(options)` returns a `Tour`:
255
+
256
+ | Member | Description |
257
+ | ------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
258
+ | `start(opts?)` / `exit(force?)` / `complete()` / `destroy()` | lifecycle; `start({ replace: true })` ends other running tours first, `complete()` finishes with `reason: "finished"` |
259
+ | `next()` / `back()` / `goTo(i)` | navigation (0-based) |
260
+ | `refresh(rescanSteps?)` | re-sync geometry / re-read steps |
261
+ | `index`, `steps`, `isActive` | state |
262
+ | `setOptions(patch)` | update options; an active tour re-renders the current step live |
263
+ | `on(event, cb)` / `once(event, cb)` | `start`, `beforeStepChange`, `stepChange`, `beforeExit`, `exit`, `complete` — cancellable via `e.cancel()` |
264
+
265
+ Event order on finishing or skipping: `beforeExit` (cancellable guard) →
266
+ `complete` → `exit`. A cancelled `beforeExit` keeps the tour active and no
267
+ `complete` is reported.
268
+
269
+ Buttons: `buttons.doneOnLast` turns Next into Done on the last step;
270
+ `buttons.hideBackOnFirst` / `buttons.hideNextOnLast` hide the boundary
271
+ buttons instead of rendering them disabled.
272
+
273
+ Keyboard: `Esc` exit (ignored when the host already handled that `Esc`),
274
+ `←`/`→` navigate, `Home`/`End` jump, `Tab` cycles inside the dialog (plus the
275
+ highlighted target when interaction is allowed).
276
+
277
+ Multi-page tours: `getPersistedProgress(key, storage?)` reports the saved step
278
+ index without touching the storage format, so a host can offer "continue where
279
+ you left off" before building the tour.
280
+
281
+ Auto-update tracks scrolling in any container, window/element resizes and
282
+ document layout shifts. Pure CSS `transform` changes or sibling reordering
283
+ that leave every observed size untouched are not detectable — call
284
+ `tour.refresh()` after such mutations.
285
+
286
+ Theming: the default look is light (matches light host pages); a dark graphite variant is available via `theme: "dark"`, and `theme: "auto"` follows `prefers-color-scheme`. Customize with CSS custom properties on `.tk-root` (`--tk-accent`, `--tk-surface`, ...). The active breadcrumb is a large circle showing the step number. Mobile-ready: the tooltip clamps to the viewport, controls grow on coarse pointers.
287
+
288
+ ## Development
289
+
290
+ Use Node.js 22.13 or newer; CI uses Node.js 22 LTS. The library package,
291
+ configuration and commands live at the repository root.
292
+
293
+ ```bash
294
+ npm ci
295
+ npm run dev # demo with live reload
296
+ npm test # unit tests
297
+ npm run build # ESM / CJS / global builds, declarations and CSS
298
+ npm run site:build # landing, demo and documentation in site/
299
+ ```
300
+
301
+ Install Playwright browsers before running browser tests:
302
+
303
+ ```bash
304
+ npx playwright install chromium firefox webkit
305
+ npm run test:e2e
306
+ ```
307
+
308
+ On Linux, use `npx playwright install --with-deps chromium firefox webkit`.
309
+ Visual baselines are platform-specific; see
310
+ [Contributing](CONTRIBUTING.md) and the [release checklist](docs/tourkit-release-checklist.md).
311
+
312
+ | Path | Purpose |
313
+ | ------------------- | ------------------------------------------------------------------- |
314
+ | `src/` | Library implementation and styles |
315
+ | `tests/` | Unit, integration and Playwright tests |
316
+ | `demo/`, `landing/` | Demo playground and landing page |
317
+ | `docs-site/` | User guide and generated API documentation configuration |
318
+ | `docs/` | Design, integration, migration, benchmark and release documentation |
319
+ | `bench/` | Reproducible comparison stand and recorded results |
320
+ | `.github/` | CI, releases, Pages, dependency updates and issue templates |
321
+
322
+ ## License
323
+
324
+ MIT
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * TourKit v0.7.1 | MIT License
3
+ * Dependency-free product tours. Independently implemented; contains no
4
+ * Intro.js source code. Not affiliated with Intro.js.
5
+ */
6
+ "use strict";var bt=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ce=Object.prototype.hasOwnProperty;var ue=(e,t)=>{for(var n in t)bt(e,n,{get:t[n],enumerable:!0})},de=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of le(t))!ce.call(e,o)&&o!==n&&bt(e,o,{get:()=>t[o],enumerable:!(i=ae(t,o))||i.enumerable});return e};var pe=e=>de(bt({},"__esModule",{value:!0}),e);var je={};ue(je,{CompatHints:()=>ht,CompatTour:()=>J,default:()=>Ge,fromIntroDataAttributes:()=>Ve,introJs:()=>mt,mapIntroHintPosition:()=>ie,mapIntroOptions:()=>re,mapIntroPosition:()=>ft});module.exports=pe(je);function yt(e){return{get:t=>e.get(t)??null,set:(t,n)=>{e.set(t,n)},remove:t=>{e.delete(t)}}}var Ze=yt(new Map),he=yt(new Map),fe=yt(new Map);function Lt(e,t){return{get(n){try{return e().getItem(n)??t.get(n)}catch{return t.get(n)}},set(n,i){try{e().setItem(n,i),t.remove(n)}catch{t.set(n,i)}},remove(n){t.remove(n);try{e().removeItem(n)}catch{}}}}function I(e="local"){return e==="local"?Lt(()=>window.localStorage,he):e==="session"?Lt(()=>window.sessionStorage,fe):e}var N=class{constructor(){this._listeners=new Map}on(t,n){let i=this._listeners.get(t);return i||(i=new Set,this._listeners.set(t,i)),i.add(n),()=>this.off(t,n)}once(t,n){let i=this.on(t,(async o=>{i(),await n(o)}));return i}off(t,n){this._listeners.get(t)?.delete(n)}async emit(t,n){let i=this._listeners.get(t);if(i)for(let o of[...i])try{await o(n)}catch(r){console.error(`[tourkit] "${String(t)}" handler failed`,r)}}removeAll(){this._listeners.clear()}};function A(e,t){if(!e)return null;if(typeof e=="function")return e();if(typeof e!="string")return e;let n=t??(typeof document<"u"?document:null);return n?n.querySelector(e):null}async function Mt(e,t,n){try{return await t()}catch(i){return console.error(`[tourkit] step ${e} failed`,i),n}}var Q=class{constructor(t,n=()=>{}){this._delegate=t;this._getScope=n;this.events=new N;this._state="idle";this._steps=[];this._queue=Promise.resolve()}get state(){return this._state}get index(){return this._index}get steps(){return this._steps}get isActive(){return this._state==="active"}setSteps(t){this._steps=t}_enqueue(t){let n=this._queue.then(t,t);return this._queue=n.catch(()=>{}),n}start(t,n=0){return this._enqueue(async()=>{if(this._state!=="idle"||t.length===0)return!1;this._steps=t,await this.events.emit("start",{steps:this._steps}),await this._delegate.mount(),this._state="active";let i=Math.min(Math.max(n,0),t.length-1);return await this._goTo(i)?!0:(await this._exit(!0),!1)})}next(){return this._enqueue(async()=>{if(!(this._state!=="active"||this._index===void 0)){if(this._index>=this._steps.length-1){await this._complete("finished");return}await this._goTo(this._index+1)}})}back(){return this._enqueue(async()=>{this._state!=="active"||this._index===void 0||this._index<=0||await this._goTo(this._index-1)})}goTo(t){return this._enqueue(async()=>{this._state==="active"&&(t<0||t>=this._steps.length||t===this._index||await this._goTo(t))})}skip(){return this._enqueue(async()=>this._state!=="active"?!1:(await this._complete("skipped"),this._state==="idle"))}complete(){return this._enqueue(async()=>this._state!=="active"?!1:(await this._complete("finished"),this._state==="idle"))}exit(t=!1){return this._enqueue(()=>this._exit(t))}reshow(){return this._enqueue(async()=>{if(this._state!=="active"||this._index===void 0)return;let t=Math.min(this._index,this._steps.length-1),n=this._steps[t];if(!n)return;this._index=t;let i=A(n.target,this._getScope());await this._delegate.showStep({index:t,step:n,target:i},"forward")})}forceIdle(){this._state="idle",this._index=void 0,this._queue=Promise.resolve()}async _complete(t){await this._requestExit()&&(await this.events.emit("complete",{reason:t}),await this._teardown())}async _goTo(t){let n=this._steps[t];if(!n)return!1;let i=this._index,o=i===void 0||t>=i?"forward":"backward",r=!1;if(await this.events.emit("beforeStepChange",{from:i,to:t,direction:o,step:n,cancel:()=>{r=!0}}),r)return!1;let s={index:t,step:n,target:A(n.target,this._getScope())};if(n.onBeforeShow){let a=n.onBeforeShow;if(await Mt("onBeforeShow",()=>a(s),void 0)===!1)return!1}if(this._index=t,await this._delegate.showStep(s,o),n.onShown){let a=n.onShown;await Mt("onShown",()=>a(s),void 0)}return await this.events.emit("stepChange",s),!0}async _exit(t){return this._state==="idle"||!t&&!await this._requestExit()?!1:(await this._teardown(),!0)}async _requestExit(){let t=!1;return await this.events.emit("beforeExit",{cancel:()=>{t=!0}}),!t}async _teardown(){await this._delegate.unmount(),this._index=void 0,this._state="idle",await this.events.emit("exit",{})}};var kt="Got it",me={next:"Next",back:"Back",done:"Done",skip:"Close",stepOf:"{step} of {total}",stepAnnouncement:"Step {step} of {total}",dontShowAgain:"Don't show this again",hintDismiss:kt},xt={block:"center",behavior:"smooth",padding:24};function tt(){return{steps:[],labels:{...me},buttons:{next:!0,back:!0,skip:!0,doneOnLast:!0,hideBackOnFirst:!1,hideNextOnLast:!1},bullets:!0,progress:!1,stepNumbers:!1,placement:"bottom",placementPrecedence:["bottom","top","right","left"],overlay:{opacity:.5,color:"#05070a",padding:8,radius:8,clickToExit:!0,transitionMs:300},keyboard:!0,exitOnEsc:!0,disableInteraction:!1,hostClasses:!0,lockScroll:!1,modal:!1,waitForTarget:{...Nt},scroll:{...xt},allowHTML:!1}}var Nt={timeoutMs:1e4,onTimeout:"float"};function wt(e,t){return t===!1?!1:t===void 0?e===!1?!1:{...e}:{...e===!1?Nt:e,...t}}function St(e,t){return{...e,...t,labels:{...e.labels,...t.labels},buttons:{...e.buttons,...t.buttons},overlay:{...e.overlay,...t.overlay},scroll:{...e.scroll,...t.scroll},waitForTarget:wt(e.waitForTarget,t.waitForTarget)}}function H(e,t,n){return e.replace("{step}",String(t)).replace("{total}",String(n))}function g(e,t={},n=[]){let i=document.createElement(e);if(t.className&&(i.className=t.className),t.text!==void 0&&(i.textContent=t.text),t.attrs)for(let[o,r]of Object.entries(t.attrs))r===void 0||r===!1||i.setAttribute(o,r===!0?"":String(r));if(t.on)for(let[o,r]of Object.entries(t.on))r&&i.addEventListener(o,r);for(let o of n)o!=null&&i.append(o);return i}var ge="http://www.w3.org/2000/svg";function et(e,t={}){let n=document.createElementNS(ge,e);for(let[i,o]of Object.entries(t))n.setAttribute(i,o);return n}function W(e,t,n,i){if(!n){e.textContent=t;return}e.innerHTML=i?i(t):t}function nt(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}var _e=16;function O(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(()=>e(ve()),_e)}function ve(){return typeof performance<"u"?performance.now():Date.now()}function $(e){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(e);return}clearTimeout(e)}function D(e){if(typeof e.checkVisibility=="function")return!e.checkVisibility({checkVisibilityCSS:!0,visibilityProperty:!0});let t=getComputedStyle(e);return t.display==="none"||t.visibility==="hidden"}var $t=0;function V(e){return $t+=1,`tk-${e}-${$t}`}function it(e){let t=0,n=()=>{t||(t=O(()=>{t=0,e()}))};window.addEventListener("scroll",n,{capture:!0,passive:!0}),window.addEventListener("resize",n,{passive:!0});let i;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(n),i.observe(document.documentElement)),{setElements(o){if(i){i.disconnect(),i.observe(document.documentElement);for(let r of o)r&&i.observe(r)}},stop(){window.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("resize",n),i?.disconnect(),t&&$(t)}}}function S(){let e=document.documentElement;return{x:0,y:0,width:e.clientWidth||window.innerWidth,height:e.clientHeight||window.innerHeight}}function z(e){let t=e.getBoundingClientRect();return{x:t.left,y:t.top,width:t.width,height:t.height}}function Et(e,t){return{x:e.x-t,y:e.y-t,width:e.width+t*2,height:e.height+t*2}}function ot(e){return{x:e.x+e.width/2,y:e.y+e.height/2,width:0,height:0}}function R(e,t){return e===null||t===null?e===t:e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function F(e,t,n){return e+(t-e)*n}function Dt(e,t,n){return{x:F(e.x,t.x,n),y:F(e.y,t.y,n),width:F(e.width,t.width,n),height:F(e.height,t.height,n)}}function B(e,t,n){return Math.min(Math.max(e,t),n<t?t:n)}function Ft(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}var be={gap:14,viewportPadding:8,arrowInset:14,rtl:!1},ye=/^(center|(top|bottom|left|right)(-(start|center|end))?)$/;function K(e){return typeof e=="string"&&ye.test(e)}function ke(e){if(e==="center")return{side:"center",align:void 0};let[t,n]=e.split("-");return{side:t,align:n}}function xe(e,t,n){switch(e){case"top":return t.y-n.y;case"bottom":return n.y+n.height-(t.y+t.height);case"left":return t.x-n.x;case"right":return n.x+n.width-(t.x+t.width)}}function zt(e,t,n,i,o){let r=(e==="top"||e==="bottom"?n.height:n.width)+o.gap+o.viewportPadding;return xe(e,t,i)>=r}function Bt(e,t,n){let i=(o,r,s)=>B(o+(r-s)/2,o+n.viewportPadding,o+r-s-n.viewportPadding);return{side:"center",align:"center",x:i(t.x,t.width,e.width),y:i(t.y,t.height,e.height),arrow:null}}function rt(e,t,n,i,o,r){let s={...be,...r};if(!t||e==="center")return Bt(n,i,s);let{side:a,align:d}=ke(e),h="center";if(a!=="center"&&zt(a,t,n,i,s))h=a;else{let L=o.filter(M=>M!==a).find(M=>zt(M,t,n,i,s));L&&(h=L)}if(h==="center")return Bt(n,i,s);let c=h==="top"||h==="bottom",f=h==="top"?t.y-s.gap-n.height:h==="bottom"?t.y+t.height+s.gap:h==="left"?t.x-s.gap-n.width:t.x+t.width+s.gap,m=c?t.x:t.y,p=c?t.width:t.height,v=c?n.width:n.height,x=c?i.x:i.y,C=c?i.width:i.height,b=d??"center";s.rtl&&c&&b!=="center"&&(b=b==="start"?"end":"start");let y=b==="start"?m:b==="end"?m+p-v:m+(p-v)/2;y=B(y,x+s.viewportPadding,x+C-v-s.viewportPadding);let E=m+p/2,Z=B(E-y,s.arrowInset,v-s.arrowInset);return{side:h,align:b,x:c?y:f,y:c?f:y,arrow:Z}}function we(e,t){let n=e.getBoundingClientRect(),i=S();return n.top>=i.y+t&&n.left>=i.x&&n.bottom<=i.y+i.height-t&&n.right<=i.x+i.width}function U(e,t){if(t.block==="off"||typeof e.scrollIntoView!="function"||we(e,t.padding))return;let n=e.style,i=n?.scrollMargin??"";n&&t.padding>0&&(n.scrollMargin=`${t.padding}px`);try{e.scrollIntoView({block:t.block,inline:"nearest",behavior:t.behavior})}finally{n&&t.padding>0&&(n.scrollMargin=i)}}var qt='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Vt(){let e=document.activeElement;return()=>{e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:!0})}}function Se(e){return e.isConnected?e===document.activeElement?!0:typeof e.checkVisibility=="function"?e.checkVisibility({checkVisibilityCSS:!0,visibilityProperty:!0}):e.offsetParent!==null||getComputedStyle(e).position==="fixed":!1}function Wt(e){let t=[],n=i=>{i instanceof HTMLElement&&i.matches(qt)&&t.push(i);for(let o of i.querySelectorAll("*"))o.matches(qt)&&t.push(o),o.shadowRoot&&n(o.shadowRoot)};return n(e),t.filter(Se)}function Ee(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement?e:null}var G=[];function st(e,t){let n={};G.push(n);let i=o=>{if(o.key!=="Tab"||G[G.length-1]!==n)return;let r=Wt(e),s=t?.();if(s&&s!==e&&!e.contains(s)&&s.isConnected&&r.push(...Wt(s)),r.length===0){o.preventDefault(),e.focus();return}let a=Ee(),d=a?r.indexOf(a):-1,h=d===-1?o.shiftKey?r[r.length-1]:r[0]:r[(d+(o.shiftKey?-1:1)+r.length)%r.length];o.preventDefault(),h.focus()};return document.addEventListener("keydown",i,!0),()=>{document.removeEventListener("keydown",i,!0);let o=G.indexOf(n);o!==-1&&G.splice(o,1)}}var j=new Map,Kt="tk-tour-active";var Ut="tk-hints-open";function at(e){if(typeof document>"u")return()=>{};let t=(j.get(e)??0)+1;j.set(e,t),t===1&&document.body.classList.add(e);let n=!1;return()=>{if(n)return;n=!0;let i=(j.get(e)??1)-1;if(i>0){j.set(e,i);return}j.delete(e),document.body.classList.remove(e)}}var Tt="data-hint",Gt="data-hint-position",jt="data-hint-placement",Te="data-hint-id",Ae=/^(top|middle|bottom)-(start|center|end|left|right)$/;function Oe(e){let t=e.getAttribute(Gt);if(t!==null){if(Ae.test(t))return t.replace("-left","-start").replace("-right","-end");console.warn(`[tourkit] unknown ${Gt}="${t}"; using the default anchor.`)}}function lt(e){return e===void 0&&typeof document>"u"?(console.warn("[tourkit] fromHintAttributes() found no document; returning no hints."),[]):Array.from((e??document).querySelectorAll(`[${Tt}]`)).filter(t=>t.getAttribute(Tt)&&!D(t)).map(t=>{let n=t.getAttribute(jt);return n!==null&&!K(n)&&console.warn(`[tourkit] unknown ${jt}="${n}"; using the default.`),{target:t,content:t.getAttribute(Tt),id:t.getAttribute(Te)??void 0,markerPosition:Oe(t),placement:K(n)?n:void 0}})}function Jt(e,t,n){let[i,o]=t.split("-"),r=o;return n&&r!=="center"&&(r=r==="start"?"end":"start"),{x:r==="start"?e.x:r==="end"?e.x+e.width:e.x+e.width/2,y:i==="top"?e.y:i==="bottom"?e.y+e.height:e.y+e.height/2}}function At(e={}){let t=new N,n=e.placementPrecedence??["bottom","top","right","left"],i=e.markerPosition??"middle-end",o=e.marker?.pulse??!0,r=e.popover?.button??!0,s=e.popover?.buttonLabel??e.labels?.hintDismiss??kt,a=e.scroll!==void 0,d=[],h=null,c=null,f=null,m=[],p=null,v=null,x=null,C=null,b=V("hint-popover"),y=()=>I(e.rememberDismissed?.storage),E=()=>{if(!e.rememberDismissed)return new Set;try{let l=y().get(e.rememberDismissed.key);return new Set(l?JSON.parse(l):[])}catch{return new Set}},Z=()=>{if(!e.rememberDismissed)return;let l=E();for(let u of d)u.dismissed?l.add(u.id):l.delete(u.id);y().set(e.rememberDismissed.key,JSON.stringify([...l]))},gt=()=>h!==null&&getComputedStyle(h).direction==="rtl",L=l=>{let u=m[l],_=d[l];if(!u||!_)return;let k=A(_.target,e.root);if(!k||!k.isConnected){u.style.display="none";return}let w=z(k);if(w.width===0&&w.height===0){u.style.display="none";return}_.dismissed||(u.style.display="");let T=Jt(w,_.markerPosition,gt());u.style.left=`${Math.round(T.x)}px`,u.style.top=`${Math.round(T.y)}px`},M=()=>{if(!c||f===null)return;let l=m[f];if(!l)return;let u=z(l);c.style.visibility="hidden";let _={width:c.offsetWidth,height:c.offsetHeight},k=rt(d[f].placement,u,_,S(),n,{gap:10,rtl:gt()});c.style.left=`${Math.round(k.x)}px`,c.style.top=`${Math.round(k.y)}px`,c.style.visibility=""},Y=()=>{d.forEach((l,u)=>L(u)),M()},P=()=>{if(f===null)return;let l=m[f];l?.setAttribute("aria-expanded","false"),l?.removeAttribute("aria-controls"),f=null,x?.(),x=null,c?.remove(),c=null,C?.(),C=null,l?.focus({preventScroll:!0})},It=(l,u)=>{let _=d[l],k=m[l];if(!_||!k||_.dismissed||!h)return;if(f===l){P();return}if(P(),u?.scroll??a){let T=A(_.target,e.root);T&&U(T,{...xt,...e.scroll}),Y()}f=l,k.setAttribute("aria-expanded","true"),k.setAttribute("aria-controls",b);let w=g("div",{className:"tk-hint-popover__content"});W(w,_.content,e.allowHTML??!1,e.sanitize),c=g("div",{className:"tk-hint-popover",attrs:{role:"dialog","aria-label":_.content,id:b,tabindex:-1}},[w,r?g("button",{className:"tk-button tk-button--primary tk-hint-popover__button",text:s,attrs:{type:"button"},on:{click:()=>q.dismiss(l)}}):null]),h.append(c),M(),x=st(c),(c.querySelector(".tk-hint-popover__button")??c).focus({preventScroll:!0}),e.hostClasses!==!1&&(C=at(Ut)),t.emit("open",{index:l,hint:_})},X=(l,u)=>{d[l]&&(m[l]?.classList.toggle("tk-hint--hidden",!u),!u&&f===l&&P())},Ht=(l,u,_)=>({...l,id:u,markerPosition:l.markerPosition??i,placement:l.placement??e.placement??"bottom",dismissed:_.has(u)}),se=()=>{let l=new Set(d.map(k=>k.id)),u=d.length,_=String(u);for(;l.has(_);)u+=1,_=String(u);return _},Rt=l=>g("button",{className:`tk-hint${l.dismissed?" tk-hint--hidden":""}${o?"":" tk-hint--static"}`,attrs:{type:"button","aria-label":l.content,"aria-expanded":"false","aria-haspopup":"dialog"},on:{click:u=>{u.stopPropagation(),It(d.indexOf(l))}}},[o?g("span",{className:"tk-hint__pulse",attrs:{"aria-hidden":"true"}}):null]),_t=()=>{m.forEach((l,u)=>l?.setAttribute("data-hint-index",String(u)))},vt=()=>{p?.setElements(d.map(l=>A(l.target,e.root)))},q={render(){if(h||typeof document>"u")return q;let l=e.hints?.length?e.hints:lt(e.root),u=E();d=l.map((w,T)=>Ht(w,w.id??String(T),u)),h=g("div",{className:"tk-root tk-root--visible tk-hints"}),e.theme&&(h.dataset.tkTheme=e.theme),e.zIndex!==void 0&&h.style.setProperty("--tk-z",String(e.zIndex)),m=d.map(w=>{let T=Rt(w);return h.append(T),T}),_t(),(e.container??document.body).append(h),p=it(Y),vt(),Y();let _=w=>{c&&!c.contains(w.target)&&P()},k=w=>{w.key==="Escape"&&!w.defaultPrevented&&P()};return document.addEventListener("click",_),document.addEventListener("keydown",k),v=()=>{document.removeEventListener("click",_),document.removeEventListener("keydown",k)},q},add(l){if(typeof document>"u")return-1;h||q.render();let u=Ht(l,l.id??se(),E());d.push(u);let _=Rt(u);m.push(_),h.append(_),_t(),vt();let k=d.length-1;return L(k),k},remove(l){let u=typeof l=="number"?l:d.findIndex(w=>w.id===l);if(!d[u])return;f===u&&P(),d.splice(u,1);let[k]=m.splice(u,1);k?.remove(),f!==null&&u<f&&(f-=1),_t(),vt()},open:It,close:P,show(l){let u=d[l];u&&(u.dismissed&&(u.dismissed=!1,Z()),X(l,!0),L(l))},hide:l=>X(l,!1),hideAll(){d.forEach((l,u)=>X(u,!1))},dismiss(l){let u=d[l];!u||u.dismissed||(u.dismissed=!0,X(l,!1),Z(),t.emit("dismiss",{index:l,hint:u}))},refresh:Y,destroy(){x?.(),x=null,P(),p?.stop(),p=null,v?.(),v=null,h?.remove(),h=null,m=[],d=[],f=null,t.removeAll()},get hints(){return d},on:(l,u)=>t.on(l,u),once:(l,u)=>t.once(l,u)};return q}var ct=class{constructor(t,n,i){this._current=null;this._stage=null;this._extras=[];this._radius=0;this._currentRadius=0;this._frame=0;this._paintedViewport=null;this._options=t,this.el=et("svg",{class:`tk-overlay${i?` ${i}`:""}`,"aria-hidden":"true"}),this._path=et("path",{class:"tk-overlay__path","fill-rule":"evenodd"}),this._path.addEventListener("click",()=>{this._options.clickToExit&&n.onBackdropClick()}),this._ring=et("path",{class:"tk-overlay__ring"}),this.el.append(this._path,this._ring),this._applyOptionStyles()}setOptions(t){this._options=t,this._applyOptionStyles()}_applyOptionStyles(){let t=this._options,n=tt().overlay;t.color!==n.color?this.el.style.setProperty("--tk-overlay-color",t.color):this.el.style.removeProperty("--tk-overlay-color"),t.opacity!==n.opacity?this.el.style.setProperty("--tk-overlay-opacity",String(t.opacity)):this.el.style.removeProperty("--tk-overlay-opacity"),this._path.style.cursor=t.clickToExit?"pointer":""}setStage(t,n,i=[]){let o=t??ot(S()),r=t?this._radiusFor(t):0,s=this._current??ot(S()),a=this._current?this._currentRadius:0;if(this._stage=o,this._radius=r,this._extras=i,this._cancelAnimation(),!n||!this._current||this._options.transitionMs<=0||nt()){this._paint(o,r);return}let d=performance.now(),h=this._options.transitionMs,c=f=>{let m=B((f-d)/h,0,1),p=Ft(m);this._paint(Dt(s,o,p),F(a,r,p)),m<1?this._frame=O(c):this._frame=0};this._frame=O(c)}refresh(t,n=[]){let i=t??ot(S()),o=t?this._radiusFor(t):0,r=Ce(this._extras,n)&&R(this._paintedViewport,S());if(this._frame!==0){if(r&&R(this._stage,i)&&this._radius===o)return;this._cancelAnimation()}else if(r&&R(this._current,i)&&this._currentRadius===o)return;this._stage=i,this._radius=o,this._extras=n,this._paint(i,o)}destroy(){this._cancelAnimation(),this.el.remove()}_radiusFor(t){return Math.min(this._options.radius,t.width/2,t.height/2)}_cancelAnimation(){this._frame&&($(this._frame),this._frame=0)}_paint(t,n){this._current=t,this._currentRadius=n;let i=S();this._paintedViewport=i;let o=`M0 0H${i.width}V${i.height}H0Z`,r=Zt(t,n),s=this._extras.map(d=>Zt(d,this._radiusFor(d))).join(" ");this._path.setAttribute("d",`${o} ${r}${s?` ${s}`:""}`);let a=[t.width>0&&t.height>0?r:"",s].filter(Boolean).join(" ");this._ring.setAttribute("d",a)}};function Ce(e,t){return e.length===t.length&&e.every((n,i)=>R(n,t[i]??null))}function Zt(e,t){let n=Math.max(0,Math.min(t,e.width/2,e.height/2)),{x:i,y:o,width:r,height:s}=e;return r<=0||s<=0?`M${i} ${o}h0v0h0Z`:`M${i+n} ${o}h${r-2*n}a${n} ${n} 0 0 1 ${n} ${n}v${s-2*n}a${n} ${n} 0 0 1 ${-n} ${n}h${-(r-2*n)}a${n} ${n} 0 0 1 ${-n} ${-n}v${-(s-2*n)}a${n} ${n} 0 0 1 ${n} ${-n}Z`}function Yt(){let e=document.documentElement,t=window.innerWidth-e.clientWidth,n=e.style.overflow,i=e.style.paddingRight;if(t>0){let o=parseFloat(getComputedStyle(e).paddingRight)||0;e.style.paddingRight=`${o+t}px`}return e.style.overflow="hidden",()=>{e.style.overflow=n,e.style.paddingRight=i}}var Xt=7,Pe=["top","bottom","left","right","center"],ut=class{constructor(t,n){this._options=t;this._callbacks=n;this._titleId=V("title");this._contentId=V("content");this._ctx=null;this._placement=null;this._contentCleanup=null;this._rtl=!1;this._arrow=g("div",{className:"tk-tooltip__arrow",attrs:{"aria-hidden":"true"}}),this._body=g("div",{className:"tk-tooltip__body"}),this.el=g("div",{className:"tk-tooltip",attrs:{role:"dialog",tabindex:-1,"aria-describedby":this._contentId}},[this._arrow,this._body]),this._releaseTrap=st(this.el,()=>{let i=this._ctx;return!i?.target||this._options.modal||(i.step.disableInteraction??this._options.disableInteraction)?null:i.target})}get placement(){return this._placement}setOptions(t){this._options=t}syncContext(t){this._ctx=t}render(t,n){this._runContentCleanup(),this._ctx=t;let{step:i,index:o}=t,r=this._options;this._rtl=this.el.isConnected&&getComputedStyle(this.el).direction==="rtl",this._placement=null,this.el.className=["tk-tooltip",r.classes?.tooltip??"",i.classes?.tooltip??""].filter(Boolean).join(" "),this._body.replaceChildren();let s=g("h2",{className:"tk-tooltip__title",attrs:{id:this._titleId}});i.title&&W(s,i.title,r.allowHTML,r.sanitize),i.title?(this.el.setAttribute("aria-labelledby",this._titleId),this.el.removeAttribute("aria-label")):(this.el.removeAttribute("aria-labelledby"),this.el.setAttribute("aria-label",H(r.labels.stepAnnouncement,o+1,n)));let a=g("div",{className:"tk-tooltip__header"},[i.title?s:null]);r.buttons.skip&&a.append(g("button",{className:"tk-tooltip__close",text:"\xD7",attrs:{type:"button","aria-label":r.labels.skip},on:{click:()=>this._callbacks.onSkip()}})),this._body.append(a);let d=g("div",{className:"tk-tooltip__content",attrs:{id:this._contentId}}),h=i.renderStep??r.renderStep;if(h)try{let b=h(t,d);typeof b=="function"&&(this._contentCleanup=b)}catch(b){console.error("[tourkit] renderStep failed",b)}else W(d,i.content,r.allowHTML,r.sanitize);if(this._body.append(d),r.showOnce?.checkbox&&this._body.append(g("label",{className:"tk-tooltip__once"},[g("input",{className:"tk-tooltip__once-box",attrs:{type:"checkbox",checked:this._callbacks.isShowOnceChecked()?"":void 0},on:{change:b=>this._callbacks.onShowOnceChange(b.target.checked)}}),g("span",{text:r.labels.dontShowAgain})])),r.stepNumbers&&this._body.append(g("div",{className:"tk-tooltip__step-number",text:H(r.labels.stepOf,o+1,n)})),r.progress){let b=Math.round((o+1)/n*100);this._body.append(g("div",{className:"tk-tooltip__progress",attrs:{role:"progressbar","aria-label":H(r.labels.stepAnnouncement,o+1,n),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":b,"aria-valuetext":H(r.labels.stepOf,o+1,n)}},Array.from({length:n},(y,E)=>g("span",{className:["tk-tooltip__progress-seg",E<o?"tk-tooltip__progress-seg--done":"",E===o?"tk-tooltip__progress-seg--current":""].filter(Boolean).join(" ")}))))}let c=g("div",{className:"tk-tooltip__footer"});r.bullets&&n>1&&c.append(g("div",{className:"tk-tooltip__bullets"},Array.from({length:n},(b,y)=>g("button",{className:`tk-tooltip__bullet${y===o?" tk-tooltip__bullet--active":""}`,text:y===o?String(y+1):void 0,attrs:{type:"button","aria-label":H(r.labels.stepAnnouncement,y+1,n),"aria-current":y===o?"step":void 0},on:{click:()=>this._callbacks.onBullet(y)}}))));let f=g("div",{className:"tk-tooltip__actions"}),m=r.classes?.button?` ${r.classes.button}`:"";r.buttons.back&&n>1&&!(r.buttons.hideBackOnFirst&&o===0)&&f.append(g("button",{className:`tk-button tk-button--ghost${m}`,text:r.labels.back,attrs:{type:"button",disabled:o===0?"":void 0},on:{click:()=>this._callbacks.onBack()}}));let v=o===n-1,x=v&&r.buttons.doneOnLast;r.buttons.next&&!(r.buttons.hideNextOnLast&&v&&!x)&&f.append(g("button",{className:`tk-button tk-button--primary${m}`,text:x?r.labels.done:r.labels.next,attrs:{type:"button","data-tk-action":x?"done":"next",disabled:v&&!r.buttons.doneOnLast?"":void 0},on:{click:()=>this._callbacks.onNext()}})),(f.childElementCount>0||c.childElementCount>0)&&(c.append(f),this._body.append(c))}measure(){return{width:this.el.offsetWidth,height:this.el.offsetHeight}}position(t,n){if(!this._ctx)return;let i=this._ctx.step.placement,o=n?.size??this.measure(),r=rt(i,t,o,n?.viewport??S(),this._options.placementPrecedence,{rtl:this._rtl}),s=this._placement;if(this._placement=r,!(s!==null&&s.side===r.side&&s.align===r.align&&s.x===r.x&&s.y===r.y&&s.arrow===r.arrow)){for(let a of Pe)this.el.classList.toggle(`tk-tooltip--${a}`,r.side===a);this.el.style.left=`${Math.round(r.x)}px`,this.el.style.top=`${Math.round(r.y)}px`,r.arrow===null?this._arrow.style.display="none":(this._arrow.style.display="",this._arrow.dataset.side=r.side,r.side==="top"||r.side==="bottom"?(this._arrow.style.left=`${Math.round(r.arrow-Xt)}px`,this._arrow.style.top=""):(this._arrow.style.top=`${Math.round(r.arrow-Xt)}px`,this._arrow.style.left=""))}}focus(){(this.el.querySelector(".tk-button--primary:not([disabled])")??this.el).focus({preventScroll:!0})}destroy(){this._runContentCleanup(),this._releaseTrap(),this.el.remove()}_runContentCleanup(){let t=this._contentCleanup;if(this._contentCleanup=null,!!t)try{t()}catch(n){console.error("[tourkit] renderStep cleanup failed",n)}}};var Ie=180,Qt=e=>e.width===0&&e.height===0;function He(e){return e instanceof HTMLElement?e.isContentEditable||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement:!1}var dt=class{constructor(t,n){this._options=t;this._hooks=n;this._root=null;this._overlay=null;this._tooltip=null;this._guards=[];this._live=null;this._ctx=null;this._autoUpdater=null;this._stopKeyboard=null;this._restoreFocus=null;this._guardStages=[];this._targetWatch=null;this._advance=null;this._inerted=[];this._modalApplied=!1;this._releaseScrollLock=null;this._releaseHostClass=null}setOptions(t){this._options=t,this._tooltip?.setOptions(t),this._overlay?.setOptions(t.overlay),this._root&&(t.theme?this._root.dataset.tkTheme=t.theme:delete this._root.dataset.tkTheme,t.zIndex!==void 0?this._root.style.setProperty("--tk-z",String(t.zIndex)):this._root.style.removeProperty("--tk-z"),this._overlay&&this._overlay.el.setAttribute("class",`tk-overlay${t.classes?.overlay?` ${t.classes.overlay}`:""}`),t.modal?(this._tooltip?.el.setAttribute("aria-modal","true"),this._applyInert()):(this._tooltip?.el.removeAttribute("aria-modal"),this._releaseInert()),this._syncScrollLock(),this._syncHostClass(),this._stopKeyboard?.(),this._stopKeyboard=null,this._bindKeyboard())}mount(){if(this._root)return;this._restoreFocus=Vt();let t=this._options;this._root=g("div",{className:"tk-root"}),t.theme&&(this._root.dataset.tkTheme=t.theme),t.zIndex!==void 0&&this._root.style.setProperty("--tk-z",String(t.zIndex)),this._overlay=new ct(t.overlay,{onBackdropClick:()=>this._hooks.onExitRequest()},t.classes?.overlay),this._tooltip=new ut(t,{onNext:()=>this._hooks.onNext(),onBack:()=>this._hooks.onBack(),onSkip:()=>this._hooks.onSkip(),onBullet:n=>this._hooks.onGoTo(n),isShowOnceChecked:()=>this._hooks.isShowOnceChecked(),onShowOnceChange:n=>this._hooks.onShowOnceChange(n)}),this._live=g("div",{className:"tk-live",attrs:{"aria-live":"polite",role:"status"}}),this._root.append(this._overlay.el,this._tooltip.el,this._live),(t.container??document.body).append(this._root),t.modal&&(this._tooltip.el.setAttribute("aria-modal","true"),this._applyInert()),this._bindKeyboard(),this._syncHostClass(),this._autoUpdater=it(()=>this._sync()),O(()=>this._root?.classList.add("tk-root--visible"))}showStep(t,n){if(!this._root||!this._overlay||!this._tooltip)return;this._stopTargetWatch(),this._ctx=t,this._syncScrollLock(),t.target&&U(t.target,{...this._options.scroll,...t.step.scroll});let i=this._stageRect(),o=this._extraStages();this._overlay.setStage(i,!0,o),this._tooltip.render(t,this._hooks.getTotal()),this._tooltip.position(i),this._updateGuards(i,o),this._announce(t),this._tooltip.focus(),this._autoUpdater?.setElements([t.target,...this._extraTargets(),this._tooltip.el]),this._bindAdvance(),i===null&&t.step.target!==void 0&&t.step.waitForTarget!==!1&&this._startTargetWatch(t.step.waitForTarget)}refresh(){this._sync()}async unmount(){let t=this._root;t&&(this._teardownListeners(),t.classList.remove("tk-root--visible"),nt()||await new Promise(n=>setTimeout(n,Ie)),this._removeDom(),this._restoreFocus?.(),this._restoreFocus=null)}destroyNow(){this._teardownListeners(),this._removeDom(),this._restoreFocus?.(),this._restoreFocus=null}_teardownListeners(){this._stopTargetWatch(),this._unbindAdvance(),this._releaseInert(),this._releaseScroll(),this._autoUpdater?.stop(),this._autoUpdater=null,this._stopKeyboard?.(),this._stopKeyboard=null}_applyInert(){if(this._modalApplied||!this._root)return;this._modalApplied=!0;let t=this._root.parentElement;if(t){this._inerted=[];for(let n of Array.from(t.children))n!==this._root&&(this._inerted.push({el:n,hadInert:n.hasAttribute("inert")}),n.setAttribute("inert",""))}}_releaseInert(){if(this._modalApplied){this._modalApplied=!1;for(let{el:t,hadInert:n}of this._inerted)n||t.removeAttribute("inert");this._inerted=[]}}_syncScrollLock(){let t=this._ctx?.step.lockScroll??this._options.lockScroll;t!==(this._releaseScrollLock!==null)&&(t?this._releaseScrollLock=Yt():(this._releaseScrollLock?.(),this._releaseScrollLock=null))}_releaseScroll(){this._releaseScrollLock?.(),this._releaseScrollLock=null}_syncHostClass(){let t=this._root!==null&&this._options.hostClasses;t!==(this._releaseHostClass!==null)&&(t?this._releaseHostClass=at(Kt):(this._releaseHostClass?.(),this._releaseHostClass=null))}_removeDom(){this._overlay?.destroy(),this._tooltip?.destroy(),this._root?.remove(),this._root=null,this._syncHostClass(),this._overlay=null,this._tooltip=null,this._guards=[],this._guardStages=[],this._live=null,this._ctx=null}_liveTarget(){if(!this._ctx)return null;let t=this._ctx.target;if(t&&t.isConnected)return t;let n=A(this._ctx.step.target,this._options.root),i=n&&n.isConnected?n:null;return i!==t&&(this._ctx={...this._ctx,target:i},this._tooltip?.syncContext(this._ctx),this._autoUpdater?.setElements([i,...this._extraTargets(),...this._tooltip?[this._tooltip.el]:[]]),i&&!this._targetWatch&&this._bindAdvance()),i}_targetRect(){let t=this._liveTarget();if(!t)return null;let n=z(t);return Qt(n)?null:n}_stageRect(){let t=this._targetRect();return t?Et(t,this._options.overlay.padding):null}_extraTargets(){return(this._ctx?.step.highlight??[]).map(t=>A(t,this._options.root)).filter(t=>t!==null&&t.isConnected)}_extraStages(){return this._extraTargets().map(t=>z(t)).filter(t=>!Qt(t)).map(t=>Et(t,this._options.overlay.padding))}_sync(){if(!this._ctx||!this._overlay||!this._tooltip)return;let t=this._stageRect(),n=this._extraStages();if(this._targetWatch&&t){this._stopTargetWatch(),this._presentAwaitedTarget();return}let i=this._tooltip.measure(),o=S();this._overlay.refresh(t,n),this._tooltip.position(t,{size:i,viewport:o}),this._updateGuards(t,n)}_presentAwaitedTarget(){let t=this._ctx;if(!t||!this._overlay||!this._tooltip)return;t.target&&U(t.target,{...this._options.scroll,...t.step.scroll});let n=this._stageRect(),i=this._extraStages();this._overlay.setStage(n,!0,i),this._tooltip.position(n),this._updateGuards(n,i),this._bindAdvance(),this._announce(t,!0)}_startTargetWatch(t){if(this._stopTargetWatch(),typeof MutationObserver>"u")return;let n=0,i=new MutationObserver(()=>{n||(n=O(()=>{n=0,this._sync()}))});i.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden"]});let o=window.setTimeout(()=>{let r=t.onTimeout==="skip";this._stopTargetWatch(),r&&this._hooks.onNext()},t.timeoutMs);this._targetWatch={stop:()=>{i.disconnect(),n&&$(n),window.clearTimeout(o)}}}_stopTargetWatch(){this._targetWatch?.stop(),this._targetWatch=null}_bindAdvance(){this._unbindAdvance();let t=this._ctx;if(!t?.step.advanceOn||!t.target)return;if(this._options.modal||(t.step.disableInteraction??this._options.disableInteraction)){console.warn("[tourkit] advanceOn needs an interactive target; disableInteraction/modal blocks the event.");return}let i=t.step.advanceOn,o=i===!0?"click":i.event??"click",r=()=>{this._unbindAdvance(),this._hooks.onNext()};t.target.addEventListener(o,r,{capture:!0}),this._advance={el:t.target,event:o,handler:r}}_unbindAdvance(){this._advance&&(this._advance.el.removeEventListener(this._advance.event,this._advance.handler,{capture:!0}),this._advance=null)}_updateGuards(t,n){if(!this._root||!this._tooltip)return;let o=this._ctx?.step.disableInteraction??this._options.disableInteraction?[...t?[t]:[],...n]:[];if(!(this._guardStages.length===o.length&&this._guardStages.every((r,s)=>R(r,o[s]??null)))){for(this._guardStages=o;this._guards.length<o.length;){let r=g("div",{className:"tk-interaction-guard",attrs:{"aria-hidden":"true"}});this._tooltip.el.before(r),this._guards.push(r)}for(;this._guards.length>o.length;)this._guards.pop().remove();o.forEach((r,s)=>{let a=this._guards[s];a.style.left=`${r.x}px`,a.style.top=`${r.y}px`,a.style.width=`${r.width}px`,a.style.height=`${r.height}px`})}}_announce(t,n=!1){let i=this._live;if(!i)return;let o=this._hooks.getTotal(),r=H(this._options.labels.stepAnnouncement,t.index+1,o),s=t.step.title?`: ${t.step.title}`:"",a=`${r}${s}`;if(n&&i.textContent===a){i.textContent="",O(()=>{this._live===i&&(i.textContent=a)});return}i.textContent=a}_bindKeyboard(){if(!this._options.keyboard&&!this._options.exitOnEsc)return;let t=n=>{let i=document.activeElement,o=this._root?.contains(i)??!1;if(n.key==="Escape"){if(n.defaultPrevented||!this._options.exitOnEsc||!o&&He(i))return;n.preventDefault(),this._hooks.onExitRequest();return}if(!this._options.keyboard)return;let r=i===document.body||i===null;if(!(!o&&!r))switch(n.key){case"ArrowRight":n.preventDefault(),this._hooks.onNext();break;case"ArrowLeft":n.preventDefault(),this._hooks.onBack();break;case"Home":n.preventDefault(),this._hooks.onGoTo(0);break;case"End":n.preventDefault(),this._hooks.onGoTo(this._hooks.getTotal()-1);break}};document.addEventListener("keydown",t),this._stopKeyboard=()=>document.removeEventListener("keydown",t)}};function Re(e,t){let n=e.getAttribute(t);if(n!==null){if(K(n))return n;console.warn(`[tourkit] unknown ${t}="${n}"; falling back to the tour default.`)}}function Ct(e,t){return e.filter(n=>!!n.content||!!(n.renderStep??t.renderStep)).map(n=>({...n,placement:n.placement??(n.target?t.placement:"center"),disableInteraction:n.disableInteraction??t.disableInteraction,lockScroll:n.lockScroll??t.lockScroll,waitForTarget:wt(t.waitForTarget,n.waitForTarget)}))}var Ot="data-tour";function Le(e){return e===void 0?Ot:/^data-[a-z0-9-]*[a-z0-9]$/.test(e)?e:(console.warn(`[tourkit] invalid data attribute "${e}"; expected a lowercase name starting with "data-". Using "${Ot}".`),Ot)}function Me(e){return{content:e,title:`${e}-title`,step:`${e}-step`,group:`${e}-group`,placement:`${e}-placement`,noInteraction:`${e}-no-interaction`,lockScroll:`${e}-lock-scroll`,advanceOn:`${e}-advance-on`,wait:`${e}-wait`,highlight:`${e}-highlight`}}function Ne(e,t){let n=e.getAttribute(t);if(n!==null)return n===""||n==="click"?!0:{event:n}}function $e(e,t){let n=e.getAttribute(t);if(n===null)return;if(n==="false"||n==="off")return!1;if(n==="")return{};let i=Number(n);if(Number.isFinite(i)&&i>=0)return{timeoutMs:i};console.warn(`[tourkit] unknown ${t}="${n}"; using the tour default.`)}function De(e,t){let n=e.getAttribute(t);if(n===null)return;let i=n.split(",").map(o=>o.trim()).filter(Boolean);return i.length?i:void 0}function te(e,t={}){if(e===void 0&&typeof document>"u")return console.warn("[tourkit] fromDataAttributes() found no document; returning no steps."),[];let n=Me(Le(t.attribute)),i=Array.from((e??document).querySelectorAll(`[${n.content}]`)),o=new Map,r=[];for(let c of i){if(t.group!==void 0&&c.getAttribute(n.group)!==t.group||D(c))continue;let f=c.getAttribute(n.content);if(!f)continue;let m={target:c,content:f,title:c.getAttribute(n.title)??void 0,placement:Re(c,n.placement),disableInteraction:c.hasAttribute(n.noInteraction)?!0:void 0,lockScroll:c.hasAttribute(n.lockScroll)?!0:void 0,highlight:De(c,n.highlight),waitForTarget:$e(c,n.wait),advanceOn:Ne(c,n.advanceOn)},p=parseInt(c.getAttribute(n.step)??"",10);Number.isFinite(p)&&p>0?(o.has(p-1)&&console.warn(`[tourkit] duplicate ${n.step}="${p}"; the later element wins.`),o.set(p-1,m)):r.push(m)}let s=o.size+r.length,a=o.size?Math.max(...o.keys())+1:0,d=[];for(let c=0;c<Math.max(s,a)&&(o.size||r.length);c++){let f=o.get(c);f?(o.delete(c),d.push(f)):r.length&&d.push(r.shift())}let h=[...o.entries()].sort(([c],[f])=>c-f).map(([,c])=>c);return d.push(...h),d}var Fe="1",ze=()=>typeof window<"u"&&typeof document<"u";function Be(e,t){let n=I(t).get(e);if(n===null)return null;let i=parseInt(n,10);return Number.isFinite(i)&&i>=0?i:null}var pt=new Set;function ee(e={}){let t=St(tt(),e),n=!1,i=()=>I(t.showOnce?.storage),o=()=>{t.showOnce&&i().set(t.showOnce.key,JSON.stringify({v:1,t:Date.now()}))},r=()=>{let p=t.showOnce;if(!p)return!1;let v=i().get(p.key);if(v===null)return!1;if(v===Fe||p.ttlMs===void 0)return!0;let x;try{x=JSON.parse(v).t}catch{return!0}return typeof x!="number"||Date.now()-x<p.ttlMs?!0:(i().remove(p.key),!1)},s=new dt(t,{getTotal:()=>a.steps.length,onNext:()=>{a.next()},onBack:()=>{a.back()},onSkip:()=>{a.skip()},onGoTo:p=>{a.goTo(p)},onExitRequest:()=>{a.exit(!1)},isShowOnceChecked:()=>n,onShowOnceChange:p=>{n=p,t.showOnce&&(p?o():i().remove(t.showOnce.key))}}),a=new Q(s,()=>t.root);a.events.on("complete",()=>o());let d=()=>I(t.persistProgress?.storage),h=()=>{t.persistProgress&&d().remove(t.persistProgress.key)};a.events.on("stepChange",({index:p})=>{t.persistProgress&&d().set(t.persistProgress.key,String(p))}),a.events.on("exit",()=>{h(),pt.delete(m)});let c=()=>t.steps.length>0?t.steps:te(t.root,{attribute:t.dataAttribute}),f=()=>{let p=Ct(c(),t);if(p.length===0){a.exit(!0);return}a.setSteps(p),a.reshow()},m={async start(p){if(!ze())return console.warn("[tourkit] start() is a no-op outside the browser."),!1;if(t.showOnce&&(n=r(),n))return!1;let v=[...pt].filter(y=>y!==m);v.length>0&&(p?.replace?await Promise.all(v.map(y=>y.exit(!0))):console.warn("[tourkit] another tour is already running; exit it first (or use start({ replace: true })) to avoid two overlays and two focus traps."));let x=0;if(t.persistProgress){let{key:y,storage:E}=t.persistProgress;x=Be(y,E)??0}let C=Ct(c(),t),b=await a.start(C,x);return b&&pt.add(m),b},exit(p=!1){return a.exit(p)},complete(){return a.complete()},destroy(){s.destroyNow(),a.forceIdle(),a.events.removeAll(),pt.delete(m)},next:()=>a.next(),back:()=>a.back(),goTo:p=>a.goTo(p),refresh(p=!1){a.isActive&&(p?f():s.refresh())},get index(){return a.index},get steps(){return a.steps},get isActive(){return a.isActive},setOptions(p){return t=St(t,p),s.setOptions(t),a.isActive&&f(),m},on:(p,v)=>a.events.on(p,v),once:(p,v)=>a.events.once(p,v)};return m}var qe={top:"top",bottom:"bottom",left:"left",right:"right",floating:"center","top-left-aligned":"top-start","top-middle-aligned":"top","top-right-aligned":"top-end","bottom-left-aligned":"bottom-start","bottom-middle-aligned":"bottom","bottom-right-aligned":"bottom-end"};function ft(e){if(e)return qe[e]??e}function ie(e){if(!e)return;let[t,n]=e.split("-");return`${t==="top"||t==="bottom"?t:"middle"}-${n==="left"||n==="start"?"start":n==="right"||n==="end"?"end":"center"}`}function We(e){return{target:e.element??void 0,title:e.title,content:e.intro??"",placement:ft(e.position),disableInteraction:e.disableInteraction,classes:e.tooltipClass?{tooltip:e.tooltipClass}:void 0}}function oe(e,t){let n=new Map,i=[];for(let s of Array.from(e.querySelectorAll("[data-intro]"))){if(t&&s.getAttribute("data-intro-group")!==t||D(s))continue;let a={target:s,content:s.getAttribute("data-intro")??"",title:s.getAttribute("data-title")??void 0,placement:ft(s.getAttribute("data-position")),disableInteraction:s.hasAttribute("data-disable-interaction")?!0:void 0},d=parseInt(s.getAttribute("data-step")??"",10);Number.isFinite(d)&&d>0?n.set(d-1,{input:a,number:d,element:s}):i.push({input:a,number:0,element:s})}let o=[],r=n.size?Math.max(...n.keys())+1:0;for(let s=0;s<Math.max(r,n.size+i.length);s++){let a=n.get(s);if(a)n.delete(s),o.push(a);else if(i.length){let d=i.shift();d.number=s+1,o.push(d)}}return o.push(...[...n.entries()].sort(([s],[a])=>s-a).map(([,s])=>s)),o}function Ve(e=document,t){return oe(e,t).map(n=>n.input)}function re(e){let t={},n={},i={},o={},r={};e.steps&&(t.steps=e.steps.map(We)),typeof e.nextLabel=="string"&&(n.next=e.nextLabel),typeof e.prevLabel=="string"&&(n.back=e.prevLabel),typeof e.doneLabel=="string"&&(n.done=e.doneLabel),typeof e.skipLabel=="string"&&(n.skip=e.skipLabel),typeof e.stepNumbersOfLabel=="string"&&(n.stepOf=`{step} ${e.stepNumbersOfLabel} {total}`),typeof e.dontShowAgainLabel=="string"&&(n.dontShowAgain=e.dontShowAgainLabel),typeof e.nextToDone=="boolean"&&(i.doneOnLast=e.nextToDone),e.hidePrev===!0&&(i.hideBackOnFirst=!0),e.hideNext===!0&&(i.hideNextOnLast=!0,i.doneOnLast=!1),e.showButtons===!1&&(i.next=!1,i.back=!1),typeof e.exitOnOverlayClick=="boolean"&&(o.clickToExit=e.exitOnOverlayClick),typeof e.overlayOpacity=="number"&&(o.opacity=e.overlayOpacity),typeof e.helperElementPadding=="number"&&(o.padding=e.helperElementPadding),(e.scrollToElement===!1||e.scrollTo==="off")&&(r.block="off"),typeof e.scrollPadding=="number"&&(r.padding=e.scrollPadding),typeof e.tooltipPosition=="string"&&(t.placement=ft(e.tooltipPosition)),Array.isArray(e.positionPrecedence)&&(t.placementPrecedence=e.positionPrecedence),typeof e.showBullets=="boolean"&&(t.bullets=e.showBullets),typeof e.showProgress=="boolean"&&(t.progress=e.showProgress),typeof e.showStepNumbers=="boolean"&&(t.stepNumbers=e.showStepNumbers),typeof e.keyboardNavigation=="boolean"&&(t.keyboard=e.keyboardNavigation),typeof e.exitOnEsc=="boolean"&&(t.exitOnEsc=e.exitOnEsc),typeof e.disableInteraction=="boolean"&&(t.disableInteraction=e.disableInteraction),t.allowHTML=typeof e.tooltipRenderAsHtml=="boolean"?e.tooltipRenderAsHtml:!0,typeof e.sanitize=="function"&&(t.sanitize=e.sanitize);let s={};return typeof e.tooltipClass=="string"&&(s.tooltip=e.tooltipClass),typeof e.buttonClass=="string"&&(s.button=e.buttonClass),typeof e.highlightClass=="string"&&(s.overlay=e.highlightClass),e.dontShowAgain===!0&&(t.showOnce={key:typeof e.dontShowAgainCookie=="string"?e.dontShowAgainCookie:"tk-dont-show-again",checkbox:!0}),Object.keys(n).length&&(t.labels=n),Object.keys(i).length&&(t.buttons=i),Object.keys(o).length&&(t.overlay=o),Object.keys(r).length&&(t.scroll=r),Object.keys(s).length&&(t.classes=s),t}var Ke="tk-dont-show-again",Ue="1",J=class e{constructor(t){this._raw={};this._tour=null;this._callbacks=new Map;this._stepNumbers=[];this._introSteps=[];this._programmaticNext=!1;this.onbeforechange=t=>this._registerCallback("beforechange",t);this.onBeforeChange=this.onbeforechange;this.onchange=t=>this._registerCallback("change",t);this.onChange=this.onchange;this.onafterchange=t=>this._registerCallback("afterchange",t);this.onAfterChange=this.onafterchange;this.oncomplete=t=>this._registerCallback("complete",t);this.onComplete=this.oncomplete;this.onexit=t=>this._registerCallback("exit",t);this.onExit=this.onexit;this.onskip=t=>this._registerCallback("skip",t);this.onSkip=this.onskip;this.onbeforeexit=t=>this._registerCallback("beforeexit",t);this.onBeforeExit=this.onbeforeexit;this.onstart=t=>this._registerCallback("start",t);this.onStart=this.onstart;this._root=typeof t=="string"?document.querySelector(t)??document:t??document}setOptions(t){return this._raw={...this._raw,...t},this}setOption(t,n){return this.setOptions({[t]:n})}getOption(t){return this._raw[t]}getOptions(){return{...this._raw}}addStep(t){return this._raw.steps=[...this._raw.steps??[],t],this}addSteps(t){return t.forEach(n=>this.addStep(n)),this}setSteps(t){return this._raw.steps=t,this}getSteps(){return this._introSteps.length?[...this._introSteps]:[...this._raw.steps??[]]}getStep(t){return this.getSteps()[t]}clone(){let t=new e;return t._raw={...this._raw,steps:this._raw.steps?[...this._raw.steps]:void 0},this._callbacks.forEach((n,i)=>t._callbacks.set(i,n)),t}setDontShowAgain(t){let n=typeof this._raw.dontShowAgainCookie=="string"?this._raw.dontShowAgainCookie:Ke,i=I("local");return t?i.set(n,Ue):i.remove(n),this}async start(){if(this._raw.isActive===!1)return this;this._tour?.isActive&&await this._tour.exit(!0);let t=re(this._raw);if(t.steps?.length){let i=this._raw.steps??[];this._stepNumbers=i.map((o,r)=>o.step??r+1),this._introSteps=[...i]}else{let i=oe(this._root,typeof this._raw.group=="string"?this._raw.group:void 0);t.steps=i.map(o=>o.input),this._stepNumbers=i.map(o=>o.number),this._introSteps=i.map(o=>({element:o.element,intro:o.input.content,title:o.input.title,step:o.number}))}let n=ee(t);return this._tour=n,this._wireCallbacks(n),await n.start(),this}_wireCallbacks(t){let n=i=>this._callbacks.get(i);t.on("beforeStepChange",async i=>{let o=n("beforechange");if(!o)return;let r=typeof i.step.target=="function"?i.step.target():i.step.target,s=typeof r=="string"?document.querySelector(r):r??null;await o.call(this,s,i.to,i.direction)===!1&&i.direction==="forward"&&i.cancel()}),t.on("stepChange",i=>{n("change")?.call(this,i.target),n("afterchange")?.call(this,i.target)}),t.on("complete",({reason:i})=>{let o=t.index,r=t.steps.length-1;if(i==="skipped"){n("skip")?.call(this,o),o===r&&n("complete")?.call(this,o,"skip");return}n("complete")?.call(this,o,this._programmaticNext?"end":"done")}),t.on("beforeExit",async i=>{await n("beforeexit")?.call(this)===!1&&i.cancel()}),t.on("exit",()=>{n("exit")?.call(this)}),t.on("start",()=>{n("start")?.call(this)})}async exit(t){return await this._tour?.exit(t),this}async nextStep(){this._programmaticNext=!0;try{await this._tour?.next()}finally{this._programmaticNext=!1}return this}async previousStep(){return await this._tour?.back(),this}async goToStep(t){return await this._tour?.goTo(t-1),this}async goToStepNumber(t){let n=this._stepNumbers.indexOf(t);return n>=0&&await this._tour?.goTo(n),this}getCurrentStep(){return this._tour?.index}currentStep(){return this.getCurrentStep()}isActive(){return this._tour?.isActive??this._raw.isActive!==!1}hasStarted(){return this._tour?.isActive??!1}refresh(t){return this._tour?.refresh(t),this}_registerCallback(t,n){if(typeof n!="function")throw new Error(`Provided callback for on${t} was not a function`);return this._callbacks.set(t,n),this}},ht=class{constructor(t){this._hints=null;this._callbacks=new Map;this.render=()=>this.addHints();this.destroy=()=>this.removeHints();this.onHintClick=this.onhintclick;this.onHintClose=this.onhintclose;this.onHintsAdded=this.onhintsadded;this._root=typeof t=="string"?document.querySelector(t)??document:t??document}addHints(){if(this._hints)return this;let t=lt(this._root).map(n=>({...n,markerPosition:ie(n.markerPosition)}));return this._hints=At({hints:t}),this._hints.on("open",n=>{this._callbacks.get("hintclick")?.call(this,n.hint.target,n.hint,n.index)}),this._hints.on("dismiss",n=>{this._callbacks.get("hintclose")?.call(this,n.index)}),this._hints.render(),this._callbacks.get("hintsadded")?.call(this),this}showHint(t){return this._hints?.show(t),this}showHints(){return this._hints?this._hints.hints.forEach((t,n)=>this._hints.show(n)):this.addHints(),this}hideHint(t){return this._hints?.hide(t),this._callbacks.get("hintclose")?.call(this,t),this}hideHints(){return this._hints?.hints.forEach((t,n)=>this.hideHint(n)),this}showHintDialog(t){return this._hints?.open(t),this}removeHint(t){return this._hints?.hide(t),this}removeHints(){return this._hints?.destroy(),this._hints=null,this}onhintclick(t){return this._callbacks.set("hintclick",t),this}onhintclose(t){return this._callbacks.set("hintclose",t),this}onhintsadded(t){return this._callbacks.set("hintsadded",t),this}},ne=!1;function Pt(){ne||(ne=!0,console.warn("[tourkit/compat-introjs] Compatibility mode: consider migrating to createTour()/createHints()."))}function mt(e){return Pt(),new J(e)}mt.tour=e=>(Pt(),new J(e));mt.hint=e=>(Pt(),new ht(e));var Ge=mt;0&&(module.exports={CompatHints,CompatTour,fromIntroDataAttributes,introJs,mapIntroHintPosition,mapIntroOptions,mapIntroPosition});
7
+ //# sourceMappingURL=compat-introjs.cjs.map
@@ -0,0 +1,118 @@
1
+ import { S as StepInput, T as TourOptionsInput, P as Placement } from './types-M-1II5wP.cjs';
2
+ import { MarkerAnchor } from './hints.cjs';
3
+
4
+ declare function mapIntroPosition(position?: string | null): Placement | undefined;
5
+ /**
6
+ * intro.js hint anchors (`top-middle`, `middle-right`, ...) → MarkerAnchor.
7
+ * Already-normalized TourKit anchors pass through unchanged, so the mapper is
8
+ * safe to apply to values the native scanner has canonicalized.
9
+ */
10
+ declare function mapIntroHintPosition(position?: string | null): MarkerAnchor | undefined;
11
+ interface IntroStep {
12
+ element?: string | Element | null;
13
+ intro?: string;
14
+ title?: string;
15
+ position?: string;
16
+ tooltipClass?: string;
17
+ disableInteraction?: boolean;
18
+ /** Explicit intro.js step number (`data-step` equivalent), 1-based. */
19
+ step?: number;
20
+ }
21
+ /** Scans intro.js-style `data-intro` / `data-step` / ... attributes. */
22
+ declare function fromIntroDataAttributes(root?: ParentNode, group?: string): StepInput[];
23
+ type IntroOptions = Record<string, unknown> & {
24
+ steps?: IntroStep[];
25
+ };
26
+ /** Maps the intro.js options object onto TourOptionsInput. */
27
+ declare function mapIntroOptions(raw: IntroOptions): TourOptionsInput;
28
+ type AnyCallback = (...args: unknown[]) => unknown;
29
+ declare class CompatTour {
30
+ private _raw;
31
+ private _tour;
32
+ private readonly _callbacks;
33
+ private readonly _root;
34
+ /** intro.js step numbers (1-based, may be sparse) parallel to tour steps. */
35
+ private _stepNumbers;
36
+ /** Steps in intro.js shape, as resolved by the last `start()`. */
37
+ private _introSteps;
38
+ /** Distinguishes programmatic `nextStep()` ("end") from a Done click ("done"). */
39
+ private _programmaticNext;
40
+ constructor(elementOrSelector?: string | Element);
41
+ setOptions(options: IntroOptions): this;
42
+ setOption(key: string, value: unknown): this;
43
+ getOption(key: string): unknown;
44
+ getOptions(): IntroOptions;
45
+ addStep(step: IntroStep): this;
46
+ addSteps(steps: IntroStep[]): this;
47
+ setSteps(steps: IntroStep[]): this;
48
+ /** Steps in intro.js shape as resolved by the last `start()` (or the raw options). */
49
+ getSteps(): IntroStep[];
50
+ getStep(index: number): IntroStep | undefined;
51
+ /** New instance with the same options and callbacks (intro.js `clone()`). */
52
+ clone(): CompatTour;
53
+ /** Persists/clears the "don't show again" flag (intro.js cookie equivalent). */
54
+ setDontShowAgain(value: boolean): this;
55
+ start(): Promise<this>;
56
+ private _wireCallbacks;
57
+ exit(force?: boolean): Promise<this>;
58
+ nextStep(): Promise<this>;
59
+ previousStep(): Promise<this>;
60
+ /** intro.js numbering is 1-based. */
61
+ goToStep(step: number): Promise<this>;
62
+ /** Jumps to the step with an explicit intro.js number (`data-step` / `step`). */
63
+ goToStepNumber(step: number): Promise<this>;
64
+ getCurrentStep(): number | undefined;
65
+ currentStep(): number | undefined;
66
+ isActive(): boolean;
67
+ hasStarted(): boolean;
68
+ refresh(refreshSteps?: boolean): this;
69
+ private _registerCallback;
70
+ onbeforechange: (callback: AnyCallback) => this;
71
+ onBeforeChange: (callback: AnyCallback) => this;
72
+ onchange: (callback: AnyCallback) => this;
73
+ onChange: (callback: AnyCallback) => this;
74
+ onafterchange: (callback: AnyCallback) => this;
75
+ onAfterChange: (callback: AnyCallback) => this;
76
+ oncomplete: (callback: AnyCallback) => this;
77
+ onComplete: (callback: AnyCallback) => this;
78
+ onexit: (callback: AnyCallback) => this;
79
+ onExit: (callback: AnyCallback) => this;
80
+ onskip: (callback: AnyCallback) => this;
81
+ onSkip: (callback: AnyCallback) => this;
82
+ onbeforeexit: (callback: AnyCallback) => this;
83
+ onBeforeExit: (callback: AnyCallback) => this;
84
+ onstart: (callback: AnyCallback) => this;
85
+ onStart: (callback: AnyCallback) => this;
86
+ }
87
+ declare class CompatHints {
88
+ private _hints;
89
+ private readonly _root;
90
+ private readonly _callbacks;
91
+ constructor(elementOrSelector?: string | Element);
92
+ /** intro.js `addHints()`: renders hints from `data-hint` attributes. */
93
+ addHints(): this;
94
+ render: () => this;
95
+ showHint(index: number): this;
96
+ showHints(): this;
97
+ hideHint(index: number): this;
98
+ hideHints(): this;
99
+ showHintDialog(index: number): this;
100
+ /** Permanently hides a single hint (marker removed from the cycle). */
101
+ removeHint(index: number): this;
102
+ removeHints(): this;
103
+ destroy: () => this;
104
+ onhintclick(callback: AnyCallback): this;
105
+ onHintClick: (callback: AnyCallback) => this;
106
+ onhintclose(callback: AnyCallback): this;
107
+ onHintClose: (callback: AnyCallback) => this;
108
+ onhintsadded(callback: AnyCallback): this;
109
+ onHintsAdded: (callback: AnyCallback) => this;
110
+ }
111
+ /** intro.js-style entry point: `introJs()`, `introJs.tour()`, `introJs.hint()`. */
112
+ declare function introJs(elementOrSelector?: string | Element): CompatTour;
113
+ declare namespace introJs {
114
+ var tour: (elementOrSelector?: string | Element) => CompatTour;
115
+ var hint: (elementOrSelector?: string | Element) => CompatHints;
116
+ }
117
+
118
+ export { CompatHints, CompatTour, introJs as default, fromIntroDataAttributes, introJs, mapIntroHintPosition, mapIntroOptions, mapIntroPosition };