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/CHANGELOG.md +436 -0
- package/LICENSE +21 -0
- package/README.md +323 -2
- package/dist/compat-introjs.cjs +7 -0
- package/dist/compat-introjs.d.cts +118 -0
- package/dist/compat-introjs.d.ts +118 -0
- package/dist/compat-introjs.global.js +7 -0
- package/dist/compat-introjs.js +7 -0
- package/dist/hints.cjs +7 -0
- package/dist/hints.d.cts +131 -0
- package/dist/hints.d.ts +131 -0
- package/dist/hints.global.js +7 -0
- package/dist/hints.js +7 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +613 -0
- package/dist/index.d.ts +613 -0
- package/dist/index.global.js +7 -0
- package/dist/index.js +7 -0
- package/dist/inject-styles.cjs +680 -0
- package/dist/inject-styles.d.cts +20 -0
- package/dist/inject-styles.d.ts +20 -0
- package/dist/inject-styles.js +680 -0
- package/dist/locales.cjs +7 -0
- package/dist/locales.d.cts +28 -0
- package/dist/locales.d.ts +28 -0
- package/dist/locales.global.js +7 -0
- package/dist/locales.js +7 -0
- package/dist/styles.css +673 -0
- package/dist/types-M-1II5wP.d.cts +257 -0
- package/dist/types-M-1II5wP.d.ts +257 -0
- package/package.json +195 -4
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { S as StepInput, T as TourOptionsInput, P as Placement } from './types-M-1II5wP.js';
|
|
2
|
+
import { MarkerAnchor } from './hints.js';
|
|
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 };
|
|
@@ -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 TourKitIntroJs=(()=>{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});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;return pe(je);})();
|
|
7
|
+
//# sourceMappingURL=compat-introjs.global.js.map
|
|
@@ -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
|
+
function gt(n){return{get:t=>n.get(t)??null,set:(t,e)=>{n.set(t,e)},remove:t=>{n.delete(t)}}}var Fe=gt(new Map),oe=gt(new Map),re=gt(new Map);function Rt(n,t){return{get(e){try{return n().getItem(e)??t.get(e)}catch{return t.get(e)}},set(e,i){try{n().setItem(e,i),t.remove(e)}catch{t.set(e,i)}},remove(e){t.remove(e);try{n().removeItem(e)}catch{}}}}function I(n="local"){return n==="local"?Rt(()=>window.localStorage,oe):n==="session"?Rt(()=>window.sessionStorage,re):n}var N=class{constructor(){this._listeners=new Map}on(t,e){let i=this._listeners.get(t);return i||(i=new Set,this._listeners.set(t,i)),i.add(e),()=>this.off(t,e)}once(t,e){let i=this.on(t,(async o=>{i(),await e(o)}));return i}off(t,e){this._listeners.get(t)?.delete(e)}async emit(t,e){let i=this._listeners.get(t);if(i)for(let o of[...i])try{await o(e)}catch(r){console.error(`[tourkit] "${String(t)}" handler failed`,r)}}removeAll(){this._listeners.clear()}};function A(n,t){if(!n)return null;if(typeof n=="function")return n();if(typeof n!="string")return n;let e=t??(typeof document<"u"?document:null);return e?e.querySelector(n):null}async function Lt(n,t,e){try{return await t()}catch(i){return console.error(`[tourkit] step ${n} failed`,i),e}}var X=class{constructor(t,e=()=>{}){this._delegate=t;this._getScope=e;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 e=this._queue.then(t,t);return this._queue=e.catch(()=>{}),e}start(t,e=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(e,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),e=this._steps[t];if(!e)return;this._index=t;let i=A(e.target,this._getScope());await this._delegate.showStep({index:t,step:e,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 e=this._steps[t];if(!e)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:e,cancel:()=>{r=!0}}),r)return!1;let s={index:t,step:e,target:A(e.target,this._getScope())};if(e.onBeforeShow){let a=e.onBeforeShow;if(await Lt("onBeforeShow",()=>a(s),void 0)===!1)return!1}if(this._index=t,await this._delegate.showStep(s,o),e.onShown){let a=e.onShown;await Lt("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 _t="Got it",se={next:"Next",back:"Back",done:"Done",skip:"Close",stepOf:"{step} of {total}",stepAnnouncement:"Step {step} of {total}",dontShowAgain:"Don't show this again",hintDismiss:_t},vt={block:"center",behavior:"smooth",padding:24};function Q(){return{steps:[],labels:{...se},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:{...Mt},scroll:{...vt},allowHTML:!1}}var Mt={timeoutMs:1e4,onTimeout:"float"};function bt(n,t){return t===!1?!1:t===void 0?n===!1?!1:{...n}:{...n===!1?Mt:n,...t}}function yt(n,t){return{...n,...t,labels:{...n.labels,...t.labels},buttons:{...n.buttons,...t.buttons},overlay:{...n.overlay,...t.overlay},scroll:{...n.scroll,...t.scroll},waitForTarget:bt(n.waitForTarget,t.waitForTarget)}}function H(n,t,e){return n.replace("{step}",String(t)).replace("{total}",String(e))}function g(n,t={},e=[]){let i=document.createElement(n);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 e)o!=null&&i.append(o);return i}var ae="http://www.w3.org/2000/svg";function tt(n,t={}){let e=document.createElementNS(ae,n);for(let[i,o]of Object.entries(t))e.setAttribute(i,o);return e}function W(n,t,e,i){if(!e){n.textContent=t;return}n.innerHTML=i?i(t):t}function et(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}var le=16;function O(n){return typeof requestAnimationFrame=="function"?requestAnimationFrame(n):setTimeout(()=>n(ce()),le)}function ce(){return typeof performance<"u"?performance.now():Date.now()}function $(n){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(n);return}clearTimeout(n)}function D(n){if(typeof n.checkVisibility=="function")return!n.checkVisibility({checkVisibilityCSS:!0,visibilityProperty:!0});let t=getComputedStyle(n);return t.display==="none"||t.visibility==="hidden"}var Nt=0;function V(n){return Nt+=1,`tk-${n}-${Nt}`}function nt(n){let t=0,e=()=>{t||(t=O(()=>{t=0,n()}))};window.addEventListener("scroll",e,{capture:!0,passive:!0}),window.addEventListener("resize",e,{passive:!0});let i;return typeof ResizeObserver<"u"&&(i=new ResizeObserver(e),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",e,{capture:!0}),window.removeEventListener("resize",e),i?.disconnect(),t&&$(t)}}}function S(){let n=document.documentElement;return{x:0,y:0,width:n.clientWidth||window.innerWidth,height:n.clientHeight||window.innerHeight}}function z(n){let t=n.getBoundingClientRect();return{x:t.left,y:t.top,width:t.width,height:t.height}}function kt(n,t){return{x:n.x-t,y:n.y-t,width:n.width+t*2,height:n.height+t*2}}function it(n){return{x:n.x+n.width/2,y:n.y+n.height/2,width:0,height:0}}function R(n,t){return n===null||t===null?n===t:n.x===t.x&&n.y===t.y&&n.width===t.width&&n.height===t.height}function F(n,t,e){return n+(t-n)*e}function $t(n,t,e){return{x:F(n.x,t.x,e),y:F(n.y,t.y,e),width:F(n.width,t.width,e),height:F(n.height,t.height,e)}}function B(n,t,e){return Math.min(Math.max(n,t),e<t?t:e)}function Dt(n){return n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2}var ue={gap:14,viewportPadding:8,arrowInset:14,rtl:!1},de=/^(center|(top|bottom|left|right)(-(start|center|end))?)$/;function K(n){return typeof n=="string"&&de.test(n)}function pe(n){if(n==="center")return{side:"center",align:void 0};let[t,e]=n.split("-");return{side:t,align:e}}function he(n,t,e){switch(n){case"top":return t.y-e.y;case"bottom":return e.y+e.height-(t.y+t.height);case"left":return t.x-e.x;case"right":return e.x+e.width-(t.x+t.width)}}function Ft(n,t,e,i,o){let r=(n==="top"||n==="bottom"?e.height:e.width)+o.gap+o.viewportPadding;return he(n,t,i)>=r}function zt(n,t,e){let i=(o,r,s)=>B(o+(r-s)/2,o+e.viewportPadding,o+r-s-e.viewportPadding);return{side:"center",align:"center",x:i(t.x,t.width,n.width),y:i(t.y,t.height,n.height),arrow:null}}function ot(n,t,e,i,o,r){let s={...ue,...r};if(!t||n==="center")return zt(e,i,s);let{side:a,align:d}=pe(n),h="center";if(a!=="center"&&Ft(a,t,e,i,s))h=a;else{let L=o.filter(M=>M!==a).find(M=>Ft(M,t,e,i,s));L&&(h=L)}if(h==="center")return zt(e,i,s);let c=h==="top"||h==="bottom",f=h==="top"?t.y-s.gap-e.height:h==="bottom"?t.y+t.height+s.gap:h==="left"?t.x-s.gap-e.width:t.x+t.width+s.gap,m=c?t.x:t.y,p=c?t.width:t.height,v=c?e.width:e.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,J=B(E-y,s.arrowInset,v-s.arrowInset);return{side:h,align:b,x:c?y:f,y:c?f:y,arrow:J}}function fe(n,t){let e=n.getBoundingClientRect(),i=S();return e.top>=i.y+t&&e.left>=i.x&&e.bottom<=i.y+i.height-t&&e.right<=i.x+i.width}function U(n,t){if(t.block==="off"||typeof n.scrollIntoView!="function"||fe(n,t.padding))return;let e=n.style,i=e?.scrollMargin??"";e&&t.padding>0&&(e.scrollMargin=`${t.padding}px`);try{n.scrollIntoView({block:t.block,inline:"nearest",behavior:t.behavior})}finally{e&&t.padding>0&&(e.scrollMargin=i)}}var Bt='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Wt(){let n=document.activeElement;return()=>{n instanceof HTMLElement&&n.isConnected&&n.focus({preventScroll:!0})}}function me(n){return n.isConnected?n===document.activeElement?!0:typeof n.checkVisibility=="function"?n.checkVisibility({checkVisibilityCSS:!0,visibilityProperty:!0}):n.offsetParent!==null||getComputedStyle(n).position==="fixed":!1}function qt(n){let t=[],e=i=>{i instanceof HTMLElement&&i.matches(Bt)&&t.push(i);for(let o of i.querySelectorAll("*"))o.matches(Bt)&&t.push(o),o.shadowRoot&&e(o.shadowRoot)};return e(n),t.filter(me)}function ge(){let n=document.activeElement;for(;n?.shadowRoot?.activeElement;)n=n.shadowRoot.activeElement;return n instanceof HTMLElement?n:null}var G=[];function rt(n,t){let e={};G.push(e);let i=o=>{if(o.key!=="Tab"||G[G.length-1]!==e)return;let r=qt(n),s=t?.();if(s&&s!==n&&!n.contains(s)&&s.isConnected&&r.push(...qt(s)),r.length===0){o.preventDefault(),n.focus();return}let a=ge(),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(e);o!==-1&&G.splice(o,1)}}var j=new Map,Vt="tk-tour-active";var Kt="tk-hints-open";function st(n){if(typeof document>"u")return()=>{};let t=(j.get(n)??0)+1;j.set(n,t),t===1&&document.body.classList.add(n);let e=!1;return()=>{if(e)return;e=!0;let i=(j.get(n)??1)-1;if(i>0){j.set(n,i);return}j.delete(n),document.body.classList.remove(n)}}var xt="data-hint",Ut="data-hint-position",Gt="data-hint-placement",_e="data-hint-id",ve=/^(top|middle|bottom)-(start|center|end|left|right)$/;function be(n){let t=n.getAttribute(Ut);if(t!==null){if(ve.test(t))return t.replace("-left","-start").replace("-right","-end");console.warn(`[tourkit] unknown ${Ut}="${t}"; using the default anchor.`)}}function at(n){return n===void 0&&typeof document>"u"?(console.warn("[tourkit] fromHintAttributes() found no document; returning no hints."),[]):Array.from((n??document).querySelectorAll(`[${xt}]`)).filter(t=>t.getAttribute(xt)&&!D(t)).map(t=>{let e=t.getAttribute(Gt);return e!==null&&!K(e)&&console.warn(`[tourkit] unknown ${Gt}="${e}"; using the default.`),{target:t,content:t.getAttribute(xt),id:t.getAttribute(_e)??void 0,markerPosition:be(t),placement:K(e)?e:void 0}})}function jt(n,t,e){let[i,o]=t.split("-"),r=o;return e&&r!=="center"&&(r=r==="start"?"end":"start"),{x:r==="start"?n.x:r==="end"?n.x+n.width:n.x+n.width/2,y:i==="top"?n.y:i==="bottom"?n.y+n.height:n.y+n.height/2}}function wt(n={}){let t=new N,e=n.placementPrecedence??["bottom","top","right","left"],i=n.markerPosition??"middle-end",o=n.marker?.pulse??!0,r=n.popover?.button??!0,s=n.popover?.buttonLabel??n.labels?.hintDismiss??_t,a=n.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(n.rememberDismissed?.storage),E=()=>{if(!n.rememberDismissed)return new Set;try{let l=y().get(n.rememberDismissed.key);return new Set(l?JSON.parse(l):[])}catch{return new Set}},J=()=>{if(!n.rememberDismissed)return;let l=E();for(let u of d)u.dismissed?l.add(u.id):l.delete(u.id);y().set(n.rememberDismissed.key,JSON.stringify([...l]))},ht=()=>h!==null&&getComputedStyle(h).direction==="rtl",L=l=>{let u=m[l],_=d[l];if(!u||!_)return;let k=A(_.target,n.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,ht());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=ot(d[f].placement,u,_,S(),e,{gap:10,rtl:ht()});c.style.left=`${Math.round(k.x)}px`,c.style.top=`${Math.round(k.y)}px`,c.style.visibility=""},Z=()=>{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})},Pt=(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,n.root);T&&U(T,{...vt,...n.scroll}),Z()}f=l,k.setAttribute("aria-expanded","true"),k.setAttribute("aria-controls",b);let w=g("div",{className:"tk-hint-popover__content"});W(w,_.content,n.allowHTML??!1,n.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=rt(c),(c.querySelector(".tk-hint-popover__button")??c).focus({preventScroll:!0}),n.hostClasses!==!1&&(C=st(Kt)),t.emit("open",{index:l,hint:_})},Y=(l,u)=>{d[l]&&(m[l]?.classList.toggle("tk-hint--hidden",!u),!u&&f===l&&P())},It=(l,u,_)=>({...l,id:u,markerPosition:l.markerPosition??i,placement:l.placement??n.placement??"bottom",dismissed:_.has(u)}),ie=()=>{let l=new Set(d.map(k=>k.id)),u=d.length,_=String(u);for(;l.has(_);)u+=1,_=String(u);return _},Ht=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(),Pt(d.indexOf(l))}}},[o?g("span",{className:"tk-hint__pulse",attrs:{"aria-hidden":"true"}}):null]),ft=()=>{m.forEach((l,u)=>l?.setAttribute("data-hint-index",String(u)))},mt=()=>{p?.setElements(d.map(l=>A(l.target,n.root)))},q={render(){if(h||typeof document>"u")return q;let l=n.hints?.length?n.hints:at(n.root),u=E();d=l.map((w,T)=>It(w,w.id??String(T),u)),h=g("div",{className:"tk-root tk-root--visible tk-hints"}),n.theme&&(h.dataset.tkTheme=n.theme),n.zIndex!==void 0&&h.style.setProperty("--tk-z",String(n.zIndex)),m=d.map(w=>{let T=Ht(w);return h.append(T),T}),ft(),(n.container??document.body).append(h),p=nt(Z),mt(),Z();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=It(l,l.id??ie(),E());d.push(u);let _=Ht(u);m.push(_),h.append(_),ft(),mt();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),ft(),mt()},open:Pt,close:P,show(l){let u=d[l];u&&(u.dismissed&&(u.dismissed=!1,J()),Y(l,!0),L(l))},hide:l=>Y(l,!1),hideAll(){d.forEach((l,u)=>Y(u,!1))},dismiss(l){let u=d[l];!u||u.dismissed||(u.dismissed=!0,Y(l,!1),J(),t.emit("dismiss",{index:l,hint:u}))},refresh:Z,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 lt=class{constructor(t,e,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=tt("svg",{class:`tk-overlay${i?` ${i}`:""}`,"aria-hidden":"true"}),this._path=tt("path",{class:"tk-overlay__path","fill-rule":"evenodd"}),this._path.addEventListener("click",()=>{this._options.clickToExit&&e.onBackdropClick()}),this._ring=tt("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,e=Q().overlay;t.color!==e.color?this.el.style.setProperty("--tk-overlay-color",t.color):this.el.style.removeProperty("--tk-overlay-color"),t.opacity!==e.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,e,i=[]){let o=t??it(S()),r=t?this._radiusFor(t):0,s=this._current??it(S()),a=this._current?this._currentRadius:0;if(this._stage=o,this._radius=r,this._extras=i,this._cancelAnimation(),!e||!this._current||this._options.transitionMs<=0||et()){this._paint(o,r);return}let d=performance.now(),h=this._options.transitionMs,c=f=>{let m=B((f-d)/h,0,1),p=Dt(m);this._paint($t(s,o,p),F(a,r,p)),m<1?this._frame=O(c):this._frame=0};this._frame=O(c)}refresh(t,e=[]){let i=t??it(S()),o=t?this._radiusFor(t):0,r=ye(this._extras,e)&&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=e,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,e){this._current=t,this._currentRadius=e;let i=S();this._paintedViewport=i;let o=`M0 0H${i.width}V${i.height}H0Z`,r=Jt(t,e),s=this._extras.map(d=>Jt(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 ye(n,t){return n.length===t.length&&n.every((e,i)=>R(e,t[i]??null))}function Jt(n,t){let e=Math.max(0,Math.min(t,n.width/2,n.height/2)),{x:i,y:o,width:r,height:s}=n;return r<=0||s<=0?`M${i} ${o}h0v0h0Z`:`M${i+e} ${o}h${r-2*e}a${e} ${e} 0 0 1 ${e} ${e}v${s-2*e}a${e} ${e} 0 0 1 ${-e} ${e}h${-(r-2*e)}a${e} ${e} 0 0 1 ${-e} ${-e}v${-(s-2*e)}a${e} ${e} 0 0 1 ${e} ${-e}Z`}function Zt(){let n=document.documentElement,t=window.innerWidth-n.clientWidth,e=n.style.overflow,i=n.style.paddingRight;if(t>0){let o=parseFloat(getComputedStyle(n).paddingRight)||0;n.style.paddingRight=`${o+t}px`}return n.style.overflow="hidden",()=>{n.style.overflow=e,n.style.paddingRight=i}}var Yt=7,ke=["top","bottom","left","right","center"],ct=class{constructor(t,e){this._options=t;this._callbacks=e;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=rt(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,e){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,e)));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,e)})),r.progress){let b=Math.round((o+1)/e*100);this._body.append(g("div",{className:"tk-tooltip__progress",attrs:{role:"progressbar","aria-label":H(r.labels.stepAnnouncement,o+1,e),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":b,"aria-valuetext":H(r.labels.stepOf,o+1,e)}},Array.from({length:e},(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&&e>1&&c.append(g("div",{className:"tk-tooltip__bullets"},Array.from({length:e},(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,e),"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&&e>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===e-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,e){if(!this._ctx)return;let i=this._ctx.step.placement,o=e?.size??this.measure(),r=ot(i,t,o,e?.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 ke)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-Yt)}px`,this._arrow.style.top=""):(this._arrow.style.top=`${Math.round(r.arrow-Yt)}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(e){console.error("[tourkit] renderStep cleanup failed",e)}}};var xe=180,Xt=n=>n.width===0&&n.height===0;function we(n){return n instanceof HTMLElement?n.isContentEditable||n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement:!1}var ut=class{constructor(t,e){this._options=t;this._hooks=e;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=Wt();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 lt(t.overlay,{onBackdropClick:()=>this._hooks.onExitRequest()},t.classes?.overlay),this._tooltip=new ct(t,{onNext:()=>this._hooks.onNext(),onBack:()=>this._hooks.onBack(),onSkip:()=>this._hooks.onSkip(),onBullet:e=>this._hooks.onGoTo(e),isShowOnceChecked:()=>this._hooks.isShowOnceChecked(),onShowOnceChange:e=>this._hooks.onShowOnceChange(e)}),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=nt(()=>this._sync()),O(()=>this._root?.classList.add("tk-root--visible"))}showStep(t,e){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"),et()||await new Promise(e=>setTimeout(e,xe)),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 e of Array.from(t.children))e!==this._root&&(this._inerted.push({el:e,hadInert:e.hasAttribute("inert")}),e.setAttribute("inert",""))}}_releaseInert(){if(this._modalApplied){this._modalApplied=!1;for(let{el:t,hadInert:e}of this._inerted)e||t.removeAttribute("inert");this._inerted=[]}}_syncScrollLock(){let t=this._ctx?.step.lockScroll??this._options.lockScroll;t!==(this._releaseScrollLock!==null)&&(t?this._releaseScrollLock=Zt():(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=st(Vt):(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 e=A(this._ctx.step.target,this._options.root),i=e&&e.isConnected?e: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 e=z(t);return Xt(e)?null:e}_stageRect(){let t=this._targetRect();return t?kt(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=>!Xt(t)).map(t=>kt(t,this._options.overlay.padding))}_sync(){if(!this._ctx||!this._overlay||!this._tooltip)return;let t=this._stageRect(),e=this._extraStages();if(this._targetWatch&&t){this._stopTargetWatch(),this._presentAwaitedTarget();return}let i=this._tooltip.measure(),o=S();this._overlay.refresh(t,e),this._tooltip.position(t,{size:i,viewport:o}),this._updateGuards(t,e)}_presentAwaitedTarget(){let t=this._ctx;if(!t||!this._overlay||!this._tooltip)return;t.target&&U(t.target,{...this._options.scroll,...t.step.scroll});let e=this._stageRect(),i=this._extraStages();this._overlay.setStage(e,!0,i),this._tooltip.position(e),this._updateGuards(e,i),this._bindAdvance(),this._announce(t,!0)}_startTargetWatch(t){if(this._stopTargetWatch(),typeof MutationObserver>"u")return;let e=0,i=new MutationObserver(()=>{e||(e=O(()=>{e=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(),e&&$(e),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,e){if(!this._root||!this._tooltip)return;let o=this._ctx?.step.disableInteraction??this._options.disableInteraction?[...t?[t]:[],...e]:[];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,e=!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(e&&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=e=>{let i=document.activeElement,o=this._root?.contains(i)??!1;if(e.key==="Escape"){if(e.defaultPrevented||!this._options.exitOnEsc||!o&&we(i))return;e.preventDefault(),this._hooks.onExitRequest();return}if(!this._options.keyboard)return;let r=i===document.body||i===null;if(!(!o&&!r))switch(e.key){case"ArrowRight":e.preventDefault(),this._hooks.onNext();break;case"ArrowLeft":e.preventDefault(),this._hooks.onBack();break;case"Home":e.preventDefault(),this._hooks.onGoTo(0);break;case"End":e.preventDefault(),this._hooks.onGoTo(this._hooks.getTotal()-1);break}};document.addEventListener("keydown",t),this._stopKeyboard=()=>document.removeEventListener("keydown",t)}};function Se(n,t){let e=n.getAttribute(t);if(e!==null){if(K(e))return e;console.warn(`[tourkit] unknown ${t}="${e}"; falling back to the tour default.`)}}function Et(n,t){return n.filter(e=>!!e.content||!!(e.renderStep??t.renderStep)).map(e=>({...e,placement:e.placement??(e.target?t.placement:"center"),disableInteraction:e.disableInteraction??t.disableInteraction,lockScroll:e.lockScroll??t.lockScroll,waitForTarget:bt(t.waitForTarget,e.waitForTarget)}))}var St="data-tour";function Ee(n){return n===void 0?St:/^data-[a-z0-9-]*[a-z0-9]$/.test(n)?n:(console.warn(`[tourkit] invalid data attribute "${n}"; expected a lowercase name starting with "data-". Using "${St}".`),St)}function Te(n){return{content:n,title:`${n}-title`,step:`${n}-step`,group:`${n}-group`,placement:`${n}-placement`,noInteraction:`${n}-no-interaction`,lockScroll:`${n}-lock-scroll`,advanceOn:`${n}-advance-on`,wait:`${n}-wait`,highlight:`${n}-highlight`}}function Ae(n,t){let e=n.getAttribute(t);if(e!==null)return e===""||e==="click"?!0:{event:e}}function Oe(n,t){let e=n.getAttribute(t);if(e===null)return;if(e==="false"||e==="off")return!1;if(e==="")return{};let i=Number(e);if(Number.isFinite(i)&&i>=0)return{timeoutMs:i};console.warn(`[tourkit] unknown ${t}="${e}"; using the tour default.`)}function Ce(n,t){let e=n.getAttribute(t);if(e===null)return;let i=e.split(",").map(o=>o.trim()).filter(Boolean);return i.length?i:void 0}function Qt(n,t={}){if(n===void 0&&typeof document>"u")return console.warn("[tourkit] fromDataAttributes() found no document; returning no steps."),[];let e=Te(Ee(t.attribute)),i=Array.from((n??document).querySelectorAll(`[${e.content}]`)),o=new Map,r=[];for(let c of i){if(t.group!==void 0&&c.getAttribute(e.group)!==t.group||D(c))continue;let f=c.getAttribute(e.content);if(!f)continue;let m={target:c,content:f,title:c.getAttribute(e.title)??void 0,placement:Se(c,e.placement),disableInteraction:c.hasAttribute(e.noInteraction)?!0:void 0,lockScroll:c.hasAttribute(e.lockScroll)?!0:void 0,highlight:Ce(c,e.highlight),waitForTarget:Oe(c,e.wait),advanceOn:Ae(c,e.advanceOn)},p=parseInt(c.getAttribute(e.step)??"",10);Number.isFinite(p)&&p>0?(o.has(p-1)&&console.warn(`[tourkit] duplicate ${e.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 Pe="1",Ie=()=>typeof window<"u"&&typeof document<"u";function He(n,t){let e=I(t).get(n);if(e===null)return null;let i=parseInt(e,10);return Number.isFinite(i)&&i>=0?i:null}var dt=new Set;function te(n={}){let t=yt(Q(),n),e=!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===Pe||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 ut(t,{getTotal:()=>a.steps.length,onNext:()=>{a.next()},onBack:()=>{a.back()},onSkip:()=>{a.skip()},onGoTo:p=>{a.goTo(p)},onExitRequest:()=>{a.exit(!1)},isShowOnceChecked:()=>e,onShowOnceChange:p=>{e=p,t.showOnce&&(p?o():i().remove(t.showOnce.key))}}),a=new X(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(),dt.delete(m)});let c=()=>t.steps.length>0?t.steps:Qt(t.root,{attribute:t.dataAttribute}),f=()=>{let p=Et(c(),t);if(p.length===0){a.exit(!0);return}a.setSteps(p),a.reshow()},m={async start(p){if(!Ie())return console.warn("[tourkit] start() is a no-op outside the browser."),!1;if(t.showOnce&&(e=r(),e))return!1;let v=[...dt].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=He(y,E)??0}let C=Et(c(),t),b=await a.start(C,x);return b&&dt.add(m),b},exit(p=!1){return a.exit(p)},complete(){return a.complete()},destroy(){s.destroyNow(),a.forceIdle(),a.events.removeAll(),dt.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=yt(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 Re={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 At(n){if(n)return Re[n]??n}function Le(n){if(!n)return;let[t,e]=n.split("-");return`${t==="top"||t==="bottom"?t:"middle"}-${e==="left"||e==="start"?"start":e==="right"||e==="end"?"end":"center"}`}function Me(n){return{target:n.element??void 0,title:n.title,content:n.intro??"",placement:At(n.position),disableInteraction:n.disableInteraction,classes:n.tooltipClass?{tooltip:n.tooltipClass}:void 0}}function ne(n,t){let e=new Map,i=[];for(let s of Array.from(n.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:At(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?e.set(d-1,{input:a,number:d,element:s}):i.push({input:a,number:0,element:s})}let o=[],r=e.size?Math.max(...e.keys())+1:0;for(let s=0;s<Math.max(r,e.size+i.length);s++){let a=e.get(s);if(a)e.delete(s),o.push(a);else if(i.length){let d=i.shift();d.number=s+1,o.push(d)}}return o.push(...[...e.entries()].sort(([s],[a])=>s-a).map(([,s])=>s)),o}function Qn(n=document,t){return ne(n,t).map(e=>e.input)}function Ne(n){let t={},e={},i={},o={},r={};n.steps&&(t.steps=n.steps.map(Me)),typeof n.nextLabel=="string"&&(e.next=n.nextLabel),typeof n.prevLabel=="string"&&(e.back=n.prevLabel),typeof n.doneLabel=="string"&&(e.done=n.doneLabel),typeof n.skipLabel=="string"&&(e.skip=n.skipLabel),typeof n.stepNumbersOfLabel=="string"&&(e.stepOf=`{step} ${n.stepNumbersOfLabel} {total}`),typeof n.dontShowAgainLabel=="string"&&(e.dontShowAgain=n.dontShowAgainLabel),typeof n.nextToDone=="boolean"&&(i.doneOnLast=n.nextToDone),n.hidePrev===!0&&(i.hideBackOnFirst=!0),n.hideNext===!0&&(i.hideNextOnLast=!0,i.doneOnLast=!1),n.showButtons===!1&&(i.next=!1,i.back=!1),typeof n.exitOnOverlayClick=="boolean"&&(o.clickToExit=n.exitOnOverlayClick),typeof n.overlayOpacity=="number"&&(o.opacity=n.overlayOpacity),typeof n.helperElementPadding=="number"&&(o.padding=n.helperElementPadding),(n.scrollToElement===!1||n.scrollTo==="off")&&(r.block="off"),typeof n.scrollPadding=="number"&&(r.padding=n.scrollPadding),typeof n.tooltipPosition=="string"&&(t.placement=At(n.tooltipPosition)),Array.isArray(n.positionPrecedence)&&(t.placementPrecedence=n.positionPrecedence),typeof n.showBullets=="boolean"&&(t.bullets=n.showBullets),typeof n.showProgress=="boolean"&&(t.progress=n.showProgress),typeof n.showStepNumbers=="boolean"&&(t.stepNumbers=n.showStepNumbers),typeof n.keyboardNavigation=="boolean"&&(t.keyboard=n.keyboardNavigation),typeof n.exitOnEsc=="boolean"&&(t.exitOnEsc=n.exitOnEsc),typeof n.disableInteraction=="boolean"&&(t.disableInteraction=n.disableInteraction),t.allowHTML=typeof n.tooltipRenderAsHtml=="boolean"?n.tooltipRenderAsHtml:!0,typeof n.sanitize=="function"&&(t.sanitize=n.sanitize);let s={};return typeof n.tooltipClass=="string"&&(s.tooltip=n.tooltipClass),typeof n.buttonClass=="string"&&(s.button=n.buttonClass),typeof n.highlightClass=="string"&&(s.overlay=n.highlightClass),n.dontShowAgain===!0&&(t.showOnce={key:typeof n.dontShowAgainCookie=="string"?n.dontShowAgainCookie:"tk-dont-show-again",checkbox:!0}),Object.keys(e).length&&(t.labels=e),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 $e="tk-dont-show-again",De="1",pt=class n{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,e){return this.setOptions({[t]:e})}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(e=>this.addStep(e)),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 n;return t._raw={...this._raw,steps:this._raw.steps?[...this._raw.steps]:void 0},this._callbacks.forEach((e,i)=>t._callbacks.set(i,e)),t}setDontShowAgain(t){let e=typeof this._raw.dontShowAgainCookie=="string"?this._raw.dontShowAgainCookie:$e,i=I("local");return t?i.set(e,De):i.remove(e),this}async start(){if(this._raw.isActive===!1)return this;this._tour?.isActive&&await this._tour.exit(!0);let t=Ne(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=ne(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 e=te(t);return this._tour=e,this._wireCallbacks(e),await e.start(),this}_wireCallbacks(t){let e=i=>this._callbacks.get(i);t.on("beforeStepChange",async i=>{let o=e("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=>{e("change")?.call(this,i.target),e("afterchange")?.call(this,i.target)}),t.on("complete",({reason:i})=>{let o=t.index,r=t.steps.length-1;if(i==="skipped"){e("skip")?.call(this,o),o===r&&e("complete")?.call(this,o,"skip");return}e("complete")?.call(this,o,this._programmaticNext?"end":"done")}),t.on("beforeExit",async i=>{await e("beforeexit")?.call(this)===!1&&i.cancel()}),t.on("exit",()=>{e("exit")?.call(this)}),t.on("start",()=>{e("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 e=this._stepNumbers.indexOf(t);return e>=0&&await this._tour?.goTo(e),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,e){if(typeof e!="function")throw new Error(`Provided callback for on${t} was not a function`);return this._callbacks.set(t,e),this}},Tt=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=at(this._root).map(e=>({...e,markerPosition:Le(e.markerPosition)}));return this._hints=wt({hints:t}),this._hints.on("open",e=>{this._callbacks.get("hintclick")?.call(this,e.hint.target,e.hint,e.index)}),this._hints.on("dismiss",e=>{this._callbacks.get("hintclose")?.call(this,e.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,e)=>this._hints.show(e)):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,e)=>this.hideHint(e)),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}},ee=!1;function Ot(){ee||(ee=!0,console.warn("[tourkit/compat-introjs] Compatibility mode: consider migrating to createTour()/createHints()."))}function Ct(n){return Ot(),new pt(n)}Ct.tour=n=>(Ot(),new pt(n));Ct.hint=n=>(Ot(),new Tt(n));var ti=Ct;export{Tt as CompatHints,pt as CompatTour,ti as default,Qn as fromIntroDataAttributes,Ct as introJs,Le as mapIntroHintPosition,Ne as mapIntroOptions,At as mapIntroPosition};
|
|
7
|
+
//# sourceMappingURL=compat-introjs.js.map
|
package/dist/hints.cjs
ADDED
|
@@ -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 K=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var ke=(e,t)=>{for(var n in t)K(e,n,{get:t[n],enumerable:!0})},Pe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _e(t))!Te.call(e,s)&&s!==n&&K(e,s,{get:()=>t[s],enumerable:!(r=Se(t,s))||r.enumerable});return e};var Ae=e=>Pe(K({},"__esModule",{value:!0}),e);var Ke={};ke(Ke,{createHints:()=>we,fromHintAttributes:()=>j,markerAnchorPoint:()=>J});module.exports=Ae(Ke);var N=class{constructor(){this._listeners=new Map}on(t,n){let r=this._listeners.get(t);return r||(r=new Set,this._listeners.set(t,r)),r.add(n),()=>this.off(t,n)}once(t,n){let r=this.on(t,(async s=>{r(),await n(s)}));return r}off(t,n){this._listeners.get(t)?.delete(n)}async emit(t,n){let r=this._listeners.get(t);if(r)for(let s of[...r])try{await s(n)}catch(a){console.error(`[tourkit] "${String(t)}" handler failed`,a)}}removeAll(){this._listeners.clear()}};function D(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}var Z="Got it";var ee={block:"center",behavior:"smooth",padding:24};function B(e){return{get:t=>e.get(t)??null,set:(t,n)=>{e.set(t,n)},remove:t=>{e.delete(t)}}}var je=B(new Map),He=B(new Map),Me=B(new Map);function te(e,t){return{get(n){try{return e().getItem(n)??t.get(n)}catch{return t.get(n)}},set(n,r){try{e().setItem(n,r),t.remove(n)}catch{t.set(n,r)}},remove(n){t.remove(n);try{e().removeItem(n)}catch{}}}}function ne(e="local"){return e==="local"?te(()=>window.localStorage,He):e==="session"?te(()=>window.sessionStorage,Me):e}function T(e,t={},n=[]){let r=document.createElement(e);if(t.className&&(r.className=t.className),t.text!==void 0&&(r.textContent=t.text),t.attrs)for(let[s,a]of Object.entries(t.attrs))a===void 0||a===!1||r.setAttribute(s,a===!0?"":String(a));if(t.on)for(let[s,a]of Object.entries(t.on))a&&r.addEventListener(s,a);for(let s of n)s!=null&&r.append(s);return r}function ie(e,t,n,r){if(!n){e.textContent=t;return}e.innerHTML=r?r(t):t}var Re=16;function oe(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(()=>e(Le()),Re)}function Le(){return typeof performance<"u"?performance.now():Date.now()}function se(e){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(e);return}clearTimeout(e)}function ae(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 re=0;function le(e){return re+=1,`tk-${e}-${re}`}function ce(e){let t=0,n=()=>{t||(t=oe(()=>{t=0,e()}))};window.addEventListener("scroll",n,{capture:!0,passive:!0}),window.addEventListener("resize",n,{passive:!0});let r;return typeof ResizeObserver<"u"&&(r=new ResizeObserver(n),r.observe(document.documentElement)),{setElements(s){if(r){r.disconnect(),r.observe(document.documentElement);for(let a of s)a&&r.observe(a)}},stop(){window.removeEventListener("scroll",n,{capture:!0}),window.removeEventListener("resize",n),r?.disconnect(),t&&se(t)}}}function F(){let e=document.documentElement;return{x:0,y:0,width:e.clientWidth||window.innerWidth,height:e.clientHeight||window.innerHeight}}function U(e){let t=e.getBoundingClientRect();return{x:t.left,y:t.top,width:t.width,height:t.height}}function q(e,t,n){return Math.min(Math.max(e,t),n<t?t:n)}var Oe={gap:14,viewportPadding:8,arrowInset:14,rtl:!1},Ce=/^(center|(top|bottom|left|right)(-(start|center|end))?)$/;function W(e){return typeof e=="string"&&Ce.test(e)}function Ie(e){if(e==="center")return{side:"center",align:void 0};let[t,n]=e.split("-");return{side:t,align:n}}function Ne(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 ue(e,t,n,r,s){let a=(e==="top"||e==="bottom"?n.height:n.width)+s.gap+s.viewportPadding;return Ne(e,t,r)>=a}function de(e,t,n){let r=(s,a,m)=>q(s+(a-m)/2,s+n.viewportPadding,s+a-m-n.viewportPadding);return{side:"center",align:"center",x:r(t.x,t.width,e.width),y:r(t.y,t.height,e.height),arrow:null}}function me(e,t,n,r,s,a){let m={...Oe,...a};if(!t||e==="center")return de(n,r,m);let{side:b,align:l}=Ie(e),u="center";if(b!=="center"&&ue(b,t,n,r,m))u=b;else{let k=s.filter(P=>P!==b).find(P=>ue(P,t,n,r,m));k&&(u=k)}if(u==="center")return de(n,r,m);let d=u==="top"||u==="bottom",h=u==="top"?t.y-m.gap-n.height:u==="bottom"?t.y+t.height+m.gap:u==="left"?t.x-m.gap-n.width:t.x+t.width+m.gap,g=d?t.x:t.y,x=d?t.width:t.height,w=d?n.width:n.height,E=d?r.x:r.y,A=d?r.width:r.height,y=l??"center";m.rtl&&d&&y!=="center"&&(y=y==="start"?"end":"start");let S=y==="start"?g:y==="end"?g+x-w:g+(x-w)/2;S=q(S,E+m.viewportPadding,E+A-w-m.viewportPadding);let H=g+x/2,O=q(H-S,m.arrowInset,w-m.arrowInset);return{side:u,align:y,x:d?S:h,y:d?h:S,arrow:O}}function De(e,t){let n=e.getBoundingClientRect(),r=F();return n.top>=r.y+t&&n.left>=r.x&&n.bottom<=r.y+r.height-t&&n.right<=r.x+r.width}function fe(e,t){if(t.block==="off"||typeof e.scrollIntoView!="function"||De(e,t.padding))return;let n=e.style,r=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=r)}}var pe='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Fe(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 he(e){let t=[],n=r=>{r instanceof HTMLElement&&r.matches(pe)&&t.push(r);for(let s of r.querySelectorAll("*"))s.matches(pe)&&t.push(s),s.shadowRoot&&n(s.shadowRoot)};return n(e),t.filter(Fe)}function qe(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e instanceof HTMLElement?e:null}var R=[];function ge(e,t){let n={};R.push(n);let r=s=>{if(s.key!=="Tab"||R[R.length-1]!==n)return;let a=he(e),m=t?.();if(m&&m!==e&&!e.contains(m)&&m.isConnected&&a.push(...he(m)),a.length===0){s.preventDefault(),e.focus();return}let b=qe(),l=b?a.indexOf(b):-1,u=l===-1?s.shiftKey?a[a.length-1]:a[0]:a[(l+(s.shiftKey?-1:1)+a.length)%a.length];s.preventDefault(),u.focus()};return document.addEventListener("keydown",r,!0),()=>{document.removeEventListener("keydown",r,!0);let s=R.indexOf(n);s!==-1&&R.splice(s,1)}}var L=new Map;var ve="tk-hints-open";function be(e){if(typeof document>"u")return()=>{};let t=(L.get(e)??0)+1;L.set(e,t),t===1&&document.body.classList.add(e);let n=!1;return()=>{if(n)return;n=!0;let r=(L.get(e)??1)-1;if(r>0){L.set(e,r);return}L.delete(e),document.body.classList.remove(e)}}var G="data-hint",ye="data-hint-position",xe="data-hint-placement",$e="data-hint-id",Ve=/^(top|middle|bottom)-(start|center|end|left|right)$/;function ze(e){let t=e.getAttribute(ye);if(t!==null){if(Ve.test(t))return t.replace("-left","-start").replace("-right","-end");console.warn(`[tourkit] unknown ${ye}="${t}"; using the default anchor.`)}}function j(e){return e===void 0&&typeof document>"u"?(console.warn("[tourkit] fromHintAttributes() found no document; returning no hints."),[]):Array.from((e??document).querySelectorAll(`[${G}]`)).filter(t=>t.getAttribute(G)&&!ae(t)).map(t=>{let n=t.getAttribute(xe);return n!==null&&!W(n)&&console.warn(`[tourkit] unknown ${xe}="${n}"; using the default.`),{target:t,content:t.getAttribute(G),id:t.getAttribute($e)??void 0,markerPosition:ze(t),placement:W(n)?n:void 0}})}function J(e,t,n){let[r,s]=t.split("-"),a=s;return n&&a!=="center"&&(a=a==="start"?"end":"start"),{x:a==="start"?e.x:a==="end"?e.x+e.width:e.x+e.width/2,y:r==="top"?e.y:r==="bottom"?e.y+e.height:e.y+e.height/2}}function we(e={}){let t=new N,n=e.placementPrecedence??["bottom","top","right","left"],r=e.markerPosition??"middle-end",s=e.marker?.pulse??!0,a=e.popover?.button??!0,m=e.popover?.buttonLabel??e.labels?.hintDismiss??Z,b=e.scroll!==void 0,l=[],u=null,d=null,h=null,g=[],x=null,w=null,E=null,A=null,y=le("hint-popover"),S=()=>ne(e.rememberDismissed?.storage),H=()=>{if(!e.rememberDismissed)return new Set;try{let i=S().get(e.rememberDismissed.key);return new Set(i?JSON.parse(i):[])}catch{return new Set}},O=()=>{if(!e.rememberDismissed)return;let i=H();for(let o of l)o.dismissed?i.add(o.id):i.delete(o.id);S().set(e.rememberDismissed.key,JSON.stringify([...i]))},$=()=>u!==null&&getComputedStyle(u).direction==="rtl",k=i=>{let o=g[i],c=l[i];if(!o||!c)return;let f=D(c.target,e.root);if(!f||!f.isConnected){o.style.display="none";return}let p=U(f);if(p.width===0&&p.height===0){o.style.display="none";return}c.dismissed||(o.style.display="");let v=J(p,c.markerPosition,$());o.style.left=`${Math.round(v.x)}px`,o.style.top=`${Math.round(v.y)}px`},P=()=>{if(!d||h===null)return;let i=g[h];if(!i)return;let o=U(i);d.style.visibility="hidden";let c={width:d.offsetWidth,height:d.offsetHeight},f=me(l[h].placement,o,c,F(),n,{gap:10,rtl:$()});d.style.left=`${Math.round(f.x)}px`,d.style.top=`${Math.round(f.y)}px`,d.style.visibility=""},C=()=>{l.forEach((i,o)=>k(o)),P()},_=()=>{if(h===null)return;let i=g[h];i?.setAttribute("aria-expanded","false"),i?.removeAttribute("aria-controls"),h=null,E?.(),E=null,d?.remove(),d=null,A?.(),A=null,i?.focus({preventScroll:!0})},Q=(i,o)=>{let c=l[i],f=g[i];if(!c||!f||c.dismissed||!u)return;if(h===i){_();return}if(_(),o?.scroll??b){let v=D(c.target,e.root);v&&fe(v,{...ee,...e.scroll}),C()}h=i,f.setAttribute("aria-expanded","true"),f.setAttribute("aria-controls",y);let p=T("div",{className:"tk-hint-popover__content"});ie(p,c.content,e.allowHTML??!1,e.sanitize),d=T("div",{className:"tk-hint-popover",attrs:{role:"dialog","aria-label":c.content,id:y,tabindex:-1}},[p,a?T("button",{className:"tk-button tk-button--primary tk-hint-popover__button",text:m,attrs:{type:"button"},on:{click:()=>M.dismiss(i)}}):null]),u.append(d),P(),E=ge(d),(d.querySelector(".tk-hint-popover__button")??d).focus({preventScroll:!0}),e.hostClasses!==!1&&(A=be(ve)),t.emit("open",{index:i,hint:c})},I=(i,o)=>{l[i]&&(g[i]?.classList.toggle("tk-hint--hidden",!o),!o&&h===i&&_())},X=(i,o,c)=>({...i,id:o,markerPosition:i.markerPosition??r,placement:i.placement??e.placement??"bottom",dismissed:c.has(o)}),Ee=()=>{let i=new Set(l.map(f=>f.id)),o=l.length,c=String(o);for(;i.has(c);)o+=1,c=String(o);return c},Y=i=>T("button",{className:`tk-hint${i.dismissed?" tk-hint--hidden":""}${s?"":" tk-hint--static"}`,attrs:{type:"button","aria-label":i.content,"aria-expanded":"false","aria-haspopup":"dialog"},on:{click:o=>{o.stopPropagation(),Q(l.indexOf(i))}}},[s?T("span",{className:"tk-hint__pulse",attrs:{"aria-hidden":"true"}}):null]),V=()=>{g.forEach((i,o)=>i?.setAttribute("data-hint-index",String(o)))},z=()=>{x?.setElements(l.map(i=>D(i.target,e.root)))},M={render(){if(u||typeof document>"u")return M;let i=e.hints?.length?e.hints:j(e.root),o=H();l=i.map((p,v)=>X(p,p.id??String(v),o)),u=T("div",{className:"tk-root tk-root--visible tk-hints"}),e.theme&&(u.dataset.tkTheme=e.theme),e.zIndex!==void 0&&u.style.setProperty("--tk-z",String(e.zIndex)),g=l.map(p=>{let v=Y(p);return u.append(v),v}),V(),(e.container??document.body).append(u),x=ce(C),z(),C();let c=p=>{d&&!d.contains(p.target)&&_()},f=p=>{p.key==="Escape"&&!p.defaultPrevented&&_()};return document.addEventListener("click",c),document.addEventListener("keydown",f),w=()=>{document.removeEventListener("click",c),document.removeEventListener("keydown",f)},M},add(i){if(typeof document>"u")return-1;u||M.render();let o=X(i,i.id??Ee(),H());l.push(o);let c=Y(o);g.push(c),u.append(c),V(),z();let f=l.length-1;return k(f),f},remove(i){let o=typeof i=="number"?i:l.findIndex(p=>p.id===i);if(!l[o])return;h===o&&_(),l.splice(o,1);let[f]=g.splice(o,1);f?.remove(),h!==null&&o<h&&(h-=1),V(),z()},open:Q,close:_,show(i){let o=l[i];o&&(o.dismissed&&(o.dismissed=!1,O()),I(i,!0),k(i))},hide:i=>I(i,!1),hideAll(){l.forEach((i,o)=>I(o,!1))},dismiss(i){let o=l[i];!o||o.dismissed||(o.dismissed=!0,I(i,!1),O(),t.emit("dismiss",{index:i,hint:o}))},refresh:C,destroy(){E?.(),E=null,_(),x?.stop(),x=null,w?.(),w=null,u?.remove(),u=null,g=[],l=[],h=null,t.removeAll()},get hints(){return l},on:(i,o)=>t.on(i,o),once:(i,o)=>t.once(i,o)};return M}0&&(module.exports={createHints,fromHintAttributes,markerAnchorPoint});
|
|
7
|
+
//# sourceMappingURL=hints.cjs.map
|
package/dist/hints.d.cts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { a as TargetRef, P as Placement, L as Labels, b as Side, c as ScrollOptions, d as StorageKind } from './types-M-1II5wP.cjs';
|
|
2
|
+
|
|
3
|
+
/** Axis-aligned rectangle in viewport coordinates. */
|
|
4
|
+
interface Rect {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type MarkerAnchor = `${"top" | "middle" | "bottom"}-${"start" | "center" | "end"}`;
|
|
12
|
+
interface HintInput {
|
|
13
|
+
target: TargetRef;
|
|
14
|
+
content: string;
|
|
15
|
+
/** Stable identity used for dismiss persistence; defaults to the list index. */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Where the marker dot sits on the target. */
|
|
18
|
+
markerPosition?: MarkerAnchor;
|
|
19
|
+
/** Popover placement relative to the marker. */
|
|
20
|
+
placement?: Placement;
|
|
21
|
+
}
|
|
22
|
+
interface Hint extends HintInput {
|
|
23
|
+
id: string;
|
|
24
|
+
markerPosition: MarkerAnchor;
|
|
25
|
+
placement: Placement;
|
|
26
|
+
dismissed: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface HintsOptions {
|
|
29
|
+
hints?: HintInput[];
|
|
30
|
+
container?: Element;
|
|
31
|
+
/**
|
|
32
|
+
* Scope for resolving string selectors and scanning `[data-hint]`.
|
|
33
|
+
* Pass a `ShadowRoot` to hint elements inside a web component.
|
|
34
|
+
*/
|
|
35
|
+
root?: Document | ShadowRoot | Element;
|
|
36
|
+
marker?: {
|
|
37
|
+
pulse?: boolean;
|
|
38
|
+
};
|
|
39
|
+
/** `buttonLabel` overrides `labels.hintDismiss` for this instance. */
|
|
40
|
+
popover?: {
|
|
41
|
+
button?: boolean;
|
|
42
|
+
buttonLabel?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Label set, shared with tours: `createHints({ labels: ru })`. Only the
|
|
46
|
+
* hint-related entries are used (`hintDismiss`).
|
|
47
|
+
*/
|
|
48
|
+
labels?: Partial<Labels>;
|
|
49
|
+
placement?: Placement;
|
|
50
|
+
placementPrecedence?: Side[];
|
|
51
|
+
markerPosition?: MarkerAnchor;
|
|
52
|
+
/**
|
|
53
|
+
* Scroll the hint's target into view when a popover is opened. Off by
|
|
54
|
+
* default: a click on a visible marker must not move the page. Turn it on
|
|
55
|
+
* for programmatic `open(i)` calls, where the marker may be off screen.
|
|
56
|
+
*/
|
|
57
|
+
scroll?: Partial<ScrollOptions>;
|
|
58
|
+
/**
|
|
59
|
+
* Mark `<body>` with `tk-hints-open` while a popover is open, so host CSS
|
|
60
|
+
* can react (dim its own chrome, pause animations).
|
|
61
|
+
*/
|
|
62
|
+
hostClasses?: boolean;
|
|
63
|
+
/** Render popover content as HTML (off by default, XSS-safe). */
|
|
64
|
+
allowHTML?: boolean;
|
|
65
|
+
/** Sanitizer applied to popover HTML when `allowHTML` is on (e.g. DOMPurify). */
|
|
66
|
+
sanitize?: (html: string) => string;
|
|
67
|
+
/** Persist dismissed hints under this key so they stay hidden after reload. */
|
|
68
|
+
rememberDismissed?: {
|
|
69
|
+
key: string;
|
|
70
|
+
storage?: StorageKind;
|
|
71
|
+
};
|
|
72
|
+
theme?: string;
|
|
73
|
+
zIndex?: number;
|
|
74
|
+
}
|
|
75
|
+
/** Per-call overrides for `Hints.open`. */
|
|
76
|
+
interface HintOpenOptions {
|
|
77
|
+
/** Scroll the target into view first (default: the instance's `scroll` policy). */
|
|
78
|
+
scroll?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** Type alias on purpose: closed `keyof` union, typos fail to compile. */
|
|
81
|
+
type HintsEvents = {
|
|
82
|
+
open: (e: {
|
|
83
|
+
index: number;
|
|
84
|
+
hint: Hint;
|
|
85
|
+
}) => void | Promise<void>;
|
|
86
|
+
dismiss: (e: {
|
|
87
|
+
index: number;
|
|
88
|
+
hint: Hint;
|
|
89
|
+
}) => void | Promise<void>;
|
|
90
|
+
};
|
|
91
|
+
interface Hints {
|
|
92
|
+
/** Mounts markers (scans `[data-hint]` when no hints are configured). */
|
|
93
|
+
render(): Hints;
|
|
94
|
+
/**
|
|
95
|
+
* Adds a hint at runtime (renders the instance first when needed).
|
|
96
|
+
* A persisted dismissal for the same `id` is respected.
|
|
97
|
+
* Returns the index of the new hint.
|
|
98
|
+
*/
|
|
99
|
+
add(input: HintInput): number;
|
|
100
|
+
/** Removes a hint by index or id; an open popover for it is closed. */
|
|
101
|
+
remove(ref: number | string): void;
|
|
102
|
+
/**
|
|
103
|
+
* Opens the hint's popover (calling it for the open hint closes it).
|
|
104
|
+
* `{ scroll: true }` brings an off-screen marker into view first — the
|
|
105
|
+
* popover of a marker clamped at the edge would otherwise open outside
|
|
106
|
+
* the viewport.
|
|
107
|
+
*/
|
|
108
|
+
open(index: number, options?: HintOpenOptions): void;
|
|
109
|
+
close(): void;
|
|
110
|
+
/** Shows the marker; a dismissed hint is revived (its dismissal is cleared). */
|
|
111
|
+
show(index: number): void;
|
|
112
|
+
hide(index: number): void;
|
|
113
|
+
hideAll(): void;
|
|
114
|
+
/** Hides the hint permanently (persisted with `rememberDismissed`). */
|
|
115
|
+
dismiss(index: number): void;
|
|
116
|
+
refresh(): void;
|
|
117
|
+
destroy(): void;
|
|
118
|
+
readonly hints: ReadonlyArray<Hint>;
|
|
119
|
+
on<E extends keyof HintsEvents & string>(event: E, handler: HintsEvents[E]): () => void;
|
|
120
|
+
once<E extends keyof HintsEvents & string>(event: E, handler: HintsEvents[E]): () => void;
|
|
121
|
+
}
|
|
122
|
+
/** Collects hints declared in HTML via `data-hint*` attributes. */
|
|
123
|
+
declare function fromHintAttributes(root?: ParentNode): HintInput[];
|
|
124
|
+
/** Marker anchor point on the target rect; start/end are logical (RTL-aware). */
|
|
125
|
+
declare function markerAnchorPoint(rect: Rect, anchor: MarkerAnchor, rtl: boolean): {
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
};
|
|
129
|
+
declare function createHints(options?: HintsOptions): Hints;
|
|
130
|
+
|
|
131
|
+
export { type Hint, type HintInput, type Hints, type HintsEvents, type HintsOptions, type MarkerAnchor, createHints, fromHintAttributes, markerAnchorPoint };
|