siteguide.js 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/siteguide.css +1 -1
- package/dist/index.d.ts +54 -16
- package/dist/index.js +1 -21
- package/dist/index.mjs +461 -449
- package/package.json +1 -1
package/dist/css/siteguide.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--sg-bg: var(--sg-mono-100);--sg-text: var(--sg-mono-900);--sg-line: var(--sg-mono-500);--primary: #2e62d9;--primary-hover: #2ca2fd;--secondary: #2ca2fd;--secondary-hover: #2ca2fd;--sg-mono-900: #101828;--sg-mono-800: #4c525e;--sg-mono-700: #7c8089;--sg-mono-600: #acaeb5;--sg-mono-500: #d5d6d9;--sg-mono-400: #e6e7e8;--sg-mono-300: #f4f4f5;--sg-mono-200: #f9f9fa;--sg-mono-100: #fff;--padding-s: 8px;--padding-m: 12px;--padding-l: 16px;--padding-2l: 20px;--sg-text-xs: 12px;--sg-text-s: 14px;--sg-text-m: 16px;--sg-text-l: 18px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.siteguide{color:var(--sg-text);box-sizing:border-box;font-family:Inter,sans-serif;font-size:var(--sg-text-m);width:280px;min-height:150px;background-color:var(--sg-bg);border-radius:8px;border:1px solid var(--sg-line);display:flex;flex-direction:column;position:absolute;box-shadow:0 10px 10px #0001;z-index:
|
|
1
|
+
:root{--sg-bg: var(--sg-mono-100);--sg-text: var(--sg-mono-900);--sg-line: var(--sg-mono-500);--primary: #2e62d9;--primary-hover: #2ca2fd;--secondary: #2ca2fd;--secondary-hover: #2ca2fd;--sg-mono-900: #101828;--sg-mono-800: #4c525e;--sg-mono-700: #7c8089;--sg-mono-600: #acaeb5;--sg-mono-500: #d5d6d9;--sg-mono-400: #e6e7e8;--sg-mono-300: #f4f4f5;--sg-mono-200: #f9f9fa;--sg-mono-100: #fff;--padding-s: 8px;--padding-m: 12px;--padding-l: 16px;--padding-2l: 20px;--sg-text-xs: 12px;--sg-text-s: 14px;--sg-text-m: 16px;--sg-text-l: 18px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.siteguide{color:var(--sg-text);box-sizing:border-box;font-family:Inter,sans-serif;font-size:var(--sg-text-m);width:280px;min-height:150px;background-color:var(--sg-bg);border-radius:8px;border:1px solid var(--sg-line);display:flex;flex-direction:column;position:absolute;box-shadow:0 10px 10px #0001;z-index:1000003!important;max-height:400px}.siteguide-animation{animation:fadeIn .3s ease-out}.siteguide-arrow{position:absolute;width:10px;height:10px;background-color:inherit}.siteguide-intersection{border-radius:4px;opacity:0;z-index:1000002!important;position:absolute}.siteguide-highlight{box-shadow:0 0 #212121cc,0 0 0 5000px #21212180;border:2px solid var(--sg-mono-900);border-radius:4px;opacity:1;z-index:1000000;position:absolute;transition:all .3s ease-out;pointer-events:none}.siteguide-header{display:flex;align-items:center;width:100%;padding:var(--padding-m) var(--padding-2l) 0;font-family:inherit}.siteguide-content{width:100%;padding:var(--padding-m) var(--padding-2l);overflow-y:auto;font-family:inherit}.siteguide-content::-webkit-scrollbar{width:4px}.siteguide-content::-webkit-scrollbar-thumb{background-color:var(--primary);border-radius:4px}.siteguide-title{display:block;font-size:var(--sg-text-l);font-weight:800;color:var(--sg-text);font-family:inherit}.siteguide-image{width:100%;height:auto;border-radius:4px;object-fit:cover;margin-bottom:var(--padding-m)}.siteguide-description{font-size:14px;font-weight:400;color:var(--sg-text);font-family:inherit}.siteguide-footer{width:100%;display:flex;align-items:center;justify-content:space-between;padding:var(--padding-m);border-top:1px solid var(--sg-line);gap:var(--padding-l);margin-top:auto}.siteguide-button{padding:var(--padding-s) var(--padding-l);border-radius:4px;cursor:pointer;font-size:14px;line-height:20px;transition:background-color .3s ease-out;color:var(--sg-mono-100);border:none;font-family:inherit}.siteguide-button-secondary{background-color:var(--secondary)}.siteguide-button-secondary:hover{background-color:var(--secondary-hover)}.siteguide-button-primary{background-color:var(--primary)}.siteguide-button-primary:hover{background-color:var(--primary-hover)}.siteguide-button-link{color:var(--primary);background-color:transparent;cursor:pointer;transition:color .3s ease-out}.siteguide-button-link:hover{color:var(--primary-hover)}.siteguide-progress{font-family:inherit;font-size:var(--sg-text-s);color:var(--sg-mono-800)}.siteguide-close{width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:transparent;border-radius:4px;cursor:pointer;position:absolute;top:10px;right:10px;transition:color .3s ease-out,background-color .3s ease-out;border:none;border-width:0}.siteguide-close:hover{background-color:var(--secondary-hover);color:#fff}.siteguide-host{z-index:1000001!important;position:relative;isolation:isolate}
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ declare interface IRenderer {
|
|
|
48
48
|
updatePosition(popup: HTMLElement, step: TourStep): void;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export declare type PopupCloseIconElement =
|
|
51
|
+
export declare type PopupCloseIconElement = HTMLElement;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Represents the customization options for a popup
|
|
@@ -66,10 +66,6 @@ export declare type PopupCustomization = {
|
|
|
66
66
|
* The CSS class to apply to the popup title
|
|
67
67
|
*/
|
|
68
68
|
titleClass?: string;
|
|
69
|
-
/**
|
|
70
|
-
* The CSS class to apply to the popup close button
|
|
71
|
-
*/
|
|
72
|
-
closeButtonClass?: string;
|
|
73
69
|
/**
|
|
74
70
|
* The CSS class to apply to the popup content
|
|
75
71
|
*/
|
|
@@ -153,6 +149,10 @@ export declare type SharedPopupData = {
|
|
|
153
149
|
* A collection of button configurations for the popup
|
|
154
150
|
*/
|
|
155
151
|
buttonList?: TourButtonConfig[];
|
|
152
|
+
/**
|
|
153
|
+
* Next step will be achieved only if this function returns true
|
|
154
|
+
*/
|
|
155
|
+
allowNext?: () => Promise<boolean>;
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
export declare const Siteguide: {
|
|
@@ -185,12 +185,15 @@ export declare class Tour {
|
|
|
185
185
|
get config(): RequiredTourConfig;
|
|
186
186
|
get popup(): HTMLElement | null;
|
|
187
187
|
get highlight(): HTMLElement | null;
|
|
188
|
+
get intersection(): HTMLElement | null;
|
|
188
189
|
get activeStep(): TourStep | null;
|
|
189
190
|
get activeStepIndex(): number | null;
|
|
190
191
|
readonly popupRenderer: IRenderer;
|
|
191
192
|
readonly highlightRenderer: IRenderer;
|
|
193
|
+
readonly intersectionRenderer: IRenderer;
|
|
192
194
|
private _popup;
|
|
193
195
|
private _highlight;
|
|
196
|
+
private _intersection;
|
|
194
197
|
private _stepList;
|
|
195
198
|
private _activeStep;
|
|
196
199
|
private _bodyResizeObserver;
|
|
@@ -202,9 +205,13 @@ export declare class Tour {
|
|
|
202
205
|
start(): void;
|
|
203
206
|
complete(): void;
|
|
204
207
|
prev(): void;
|
|
205
|
-
next(): void
|
|
208
|
+
next(): Promise<void>;
|
|
209
|
+
goTo(index: number): void;
|
|
206
210
|
setConfig(config: TourConfig): void;
|
|
211
|
+
private changeStepTo;
|
|
207
212
|
private getBodyResizeObserver;
|
|
213
|
+
private closeOnEsc;
|
|
214
|
+
private keyboardControl;
|
|
208
215
|
}
|
|
209
216
|
|
|
210
217
|
/**
|
|
@@ -252,15 +259,25 @@ export declare type TourConfig = {
|
|
|
252
259
|
*/
|
|
253
260
|
class?: string;
|
|
254
261
|
/**
|
|
255
|
-
*
|
|
256
|
-
* @default true
|
|
262
|
+
* Add the way to allow close
|
|
257
263
|
*/
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
+
close?: {
|
|
265
|
+
/**
|
|
266
|
+
* Indicates if the tour popup can be closed by click header button
|
|
267
|
+
* @default true
|
|
268
|
+
*/
|
|
269
|
+
button?: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* Indicates if the tour popup can be closed by click outside a popup
|
|
272
|
+
* @default false
|
|
273
|
+
*/
|
|
274
|
+
clickout?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Indicates if the tour popup can be closed by click escape key
|
|
277
|
+
* @default true
|
|
278
|
+
*/
|
|
279
|
+
esc?: boolean;
|
|
280
|
+
};
|
|
264
281
|
/**
|
|
265
282
|
* Specifies if the tour should scroll to the current step and how to scroll
|
|
266
283
|
* Can be a boolean to enable or disable scrolling, or an object with options for scrollIntoView
|
|
@@ -270,7 +287,7 @@ export declare type TourConfig = {
|
|
|
270
287
|
/**
|
|
271
288
|
* The element or HTML to use as the close icon
|
|
272
289
|
*/
|
|
273
|
-
closeIcon?:
|
|
290
|
+
closeIcon?: HTMLElement;
|
|
274
291
|
/**
|
|
275
292
|
* Arrow configuration
|
|
276
293
|
*/
|
|
@@ -287,7 +304,7 @@ export declare type TourConfig = {
|
|
|
287
304
|
class?: string;
|
|
288
305
|
};
|
|
289
306
|
/**
|
|
290
|
-
* Configuration for the
|
|
307
|
+
* Configuration for the highlight
|
|
291
308
|
*/
|
|
292
309
|
highlight?: {
|
|
293
310
|
/**
|
|
@@ -306,6 +323,9 @@ export declare type TourConfig = {
|
|
|
306
323
|
*/
|
|
307
324
|
class?: string;
|
|
308
325
|
};
|
|
326
|
+
/**
|
|
327
|
+
* Configuration for the progress
|
|
328
|
+
*/
|
|
309
329
|
progress?: {
|
|
310
330
|
/**
|
|
311
331
|
* Disable tour progress display
|
|
@@ -318,6 +338,21 @@ export declare type TourConfig = {
|
|
|
318
338
|
*/
|
|
319
339
|
text?: string;
|
|
320
340
|
};
|
|
341
|
+
/**
|
|
342
|
+
* Configuration for the intersection
|
|
343
|
+
*/
|
|
344
|
+
intersection: {
|
|
345
|
+
/**
|
|
346
|
+
* Disabling interaction with host element
|
|
347
|
+
* @default false
|
|
348
|
+
*/
|
|
349
|
+
disable?: boolean;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Control tour from keyboard arrows
|
|
353
|
+
* @default false
|
|
354
|
+
*/
|
|
355
|
+
keyboardControl?: boolean;
|
|
321
356
|
/**
|
|
322
357
|
* The class to apply to the tour popup animation
|
|
323
358
|
* @default 'siteguide-animation'
|
|
@@ -346,8 +381,11 @@ export declare class TourStep {
|
|
|
346
381
|
private readonly _hostData;
|
|
347
382
|
private readonly _popupRenderer;
|
|
348
383
|
private readonly _highlightRenderer;
|
|
384
|
+
private readonly _intersectionRenderer;
|
|
349
385
|
constructor(tour: Tour, config: TourStepConfig);
|
|
350
386
|
show(direction: StepDirection): Promise<void>;
|
|
387
|
+
hide(): Promise<void>;
|
|
388
|
+
private toggleZIndex;
|
|
351
389
|
private resolveHostElement;
|
|
352
390
|
}
|
|
353
391
|
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
"use strict";var Kt=Object.defineProperty,Xt=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var et=Object.getOwnPropertySymbols;var St=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var Lt=Math.pow,ut=(e,t,n)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))St.call(t,n)&&ut(e,n,t[n]);if(et)for(var n of et(t))Ct.call(t,n)&&ut(e,n,t[n]);return e},X=(e,t)=>Xt(e,Gt(t));var Pt=(e,t)=>{var n={};for(var i in e)St.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&et)for(var i of et(e))t.indexOf(i)<0&&Ct.call(e,i)&&(n[i]=e[i]);return n};var S=(e,t,n)=>ut(e,typeof t!="symbol"?t+"":t,n);var F=(e,t,n)=>new Promise((i,o)=>{var s=a=>{try{l(n.next(a))}catch(c){o(c)}},r=a=>{try{l(n.throw(a))}catch(c){o(c)}},l=a=>a.done?i(a.value):Promise.resolve(a.value).then(s,r);l((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Jt=["top","right","bottom","left"],Tt=["start","end"],Ot=Jt.reduce((e,t)=>e.concat(t,t+"-"+Tt[0],t+"-"+Tt[1]),[]),G=Math.min,Y=Math.max,it=Math.round,D=e=>({x:e,y:e}),Qt={left:"right",right:"left",bottom:"top",top:"bottom"},Zt={start:"end",end:"start"};function te(e,t,n){return Y(e,G(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Q(e){return e.split("-")[0]}function N(e){return e.split("-")[1]}function ee(e){return e==="x"?"y":"x"}function xt(e){return e==="y"?"height":"width"}function wt(e){return["top","bottom"].includes(Q(e))?"y":"x"}function yt(e){return ee(wt(e))}function ne(e,t,n){n===void 0&&(n=!1);const i=N(e),o=yt(e),s=xt(o);let r=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Rt(r)),[r,Rt(r)]}function ie(e){return e.replace(/start|end/g,t=>Zt[t])}function Rt(e){return e.replace(/left|right|bottom|top/g,t=>Qt[t])}function oe(e){return O({top:0,right:0,bottom:0,left:0},e)}function Mt(e){return typeof e!="number"?oe(e):{top:e,right:e,bottom:e,left:e}}function ot(e){const{x:t,y:n,width:i,height:o}=e;return{width:i,height:o,top:n,left:t,right:t+i,bottom:n+o,x:t,y:n}}function Et(e,t,n){let{reference:i,floating:o}=e;const s=wt(t),r=yt(t),l=xt(r),a=Q(t),c=s==="y",h=i.x+i.width/2-o.width/2,f=i.y+i.height/2-o.height/2,g=i[l]/2-o[l]/2;let u;switch(a){case"top":u={x:h,y:i.y-o.height};break;case"bottom":u={x:h,y:i.y+i.height};break;case"right":u={x:i.x+i.width,y:f};break;case"left":u={x:i.x-o.width,y:f};break;default:u={x:i.x,y:i.y}}switch(N(t)){case"start":u[r]-=g*(n&&c?-1:1);break;case"end":u[r]+=g*(n&&c?-1:1);break}return u}const se=(e,t,n)=>F(exports,null,function*(){const{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=n,l=s.filter(Boolean),a=yield r.isRTL==null?void 0:r.isRTL(t);let c=yield r.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:f}=Et(c,i,a),g=i,u={},d=0;for(let p=0;p<l.length;p++){const{name:m,fn:w}=l[p],{x:_,y,data:b,reset:v}=yield w({x:h,y:f,initialPlacement:i,placement:g,strategy:o,middlewareData:u,rects:c,platform:r,elements:{reference:e,floating:t}});h=_!=null?_:h,f=y!=null?y:f,u=X(O({},u),{[m]:O(O({},u[m]),b)}),v&&d<=50&&(d++,typeof v=="object"&&(v.placement&&(g=v.placement),v.rects&&(c=v.rects===!0?yield r.getElementRects({reference:e,floating:t,strategy:o}):v.rects),{x:h,y:f}=Et(c,g,a)),p=-1)}return{x:h,y:f,placement:g,strategy:o,middlewareData:u}});function re(e,t){return F(this,null,function*(){var n;t===void 0&&(t={});const{x:i,y:o,platform:s,rects:r,elements:l,strategy:a}=e,{boundary:c="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:g=!1,padding:u=0}=st(t,e),d=Mt(u),m=l[g?f==="floating"?"reference":"floating":f],w=ot(yield s.getClippingRect({element:(n=yield s.isElement==null?void 0:s.isElement(m))==null||n?m:m.contextElement||(yield s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:h,strategy:a})),_=f==="floating"?{x:i,y:o,width:r.floating.width,height:r.floating.height}:r.reference,y=yield s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating),b=(yield s.isElement==null?void 0:s.isElement(y))?(yield s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},v=ot(s.convertOffsetParentRelativeRectToViewportRelativeRect?yield s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:y,strategy:a}):_);return{top:(w.top-v.top+d.top)/b.y,bottom:(v.bottom-w.bottom+d.bottom)/b.y,left:(w.left-v.left+d.left)/b.x,right:(v.right-w.right+d.right)/b.x}})}const le=e=>({name:"arrow",options:e,fn(n){return F(this,null,function*(){const{x:i,y:o,placement:s,rects:r,platform:l,elements:a,middlewareData:c}=n,{element:h,padding:f=0}=st(e,n)||{};if(h==null)return{};const g=Mt(f),u={x:i,y:o},d=yt(s),p=xt(d),m=yield l.getDimensions(h),w=d==="y",_=w?"top":"left",y=w?"bottom":"right",b=w?"clientHeight":"clientWidth",v=r.reference[p]+r.reference[d]-u[d]-r.floating[p],$=u[d]-r.reference[d],M=yield l.getOffsetParent==null?void 0:l.getOffsetParent(h);let x=M?M[b]:0;(!x||!(yield l.isElement==null?void 0:l.isElement(M)))&&(x=a.floating[b]||r.floating[p]);const W=v/2-$/2,H=x/2-m[p]/2-1,z=G(g[_],H),C=G(g[y],H),A=z,tt=x-m[p]-C,B=x/2-m[p]/2+W,at=te(A,B,tt),ft=!c.arrow&&N(s)!=null&&B!==at&&r.reference[p]/2-(B<A?z:C)-m[p]/2<0,ht=ft?B<A?B-A:B-tt:0;return{[d]:u[d]+ht,data:O({[d]:at,centerOffset:B-at-ht},ft&&{alignmentOffset:ht}),reset:ft}})}});function ce(e,t,n){return(e?[...n.filter(o=>N(o)===e),...n.filter(o=>N(o)!==e)]:n.filter(o=>Q(o)===o)).filter(o=>e?N(o)===e||(t?ie(o)!==o:!1):!0)}const ae=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,fn(n){return F(this,null,function*(){var i,o,s;const{rects:r,middlewareData:l,placement:a,platform:c,elements:h}=n,z=st(e,n),{crossAxis:f=!1,alignment:g,allowedPlacements:u=Ot,autoAlignment:d=!0}=z,p=Pt(z,["crossAxis","alignment","allowedPlacements","autoAlignment"]),m=g!==void 0||u===Ot?ce(g||null,d,u):u,w=yield re(n,p),_=((i=l.autoPlacement)==null?void 0:i.index)||0,y=m[_];if(y==null)return{};const b=ne(y,r,yield c.isRTL==null?void 0:c.isRTL(h.floating));if(a!==y)return{reset:{placement:m[0]}};const v=[w[Q(y)],w[b[0]],w[b[1]]],$=[...((o=l.autoPlacement)==null?void 0:o.overflows)||[],{placement:y,overflows:v}],M=m[_+1];if(M)return{data:{index:_+1,overflows:$},reset:{placement:M}};const x=$.map(C=>{const A=N(C.placement);return[C.placement,A&&f?C.overflows.slice(0,2).reduce((tt,B)=>tt+B,0):C.overflows[0],C.overflows]}).sort((C,A)=>C[1]-A[1]),H=((s=x.filter(C=>C[2].slice(0,N(C[0])?2:3).every(A=>A<=0))[0])==null?void 0:s[0])||x[0][0];return H!==a?{data:{index:_+1,overflows:$},reset:{placement:H}}:{}})}}};function fe(e,t){return F(this,null,function*(){const{placement:n,platform:i,elements:o}=e,s=yield i.isRTL==null?void 0:i.isRTL(o.floating),r=Q(n),l=N(n),a=wt(n)==="y",c=["left","top"].includes(r)?-1:1,h=s&&a?-1:1,f=st(t,e);let{mainAxis:g,crossAxis:u,alignmentAxis:d}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof d=="number"&&(u=l==="end"?d*-1:d),a?{x:u*h,y:g*c}:{x:g*c,y:u*h}})}const he=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return F(this,null,function*(){var i,o;const{x:s,y:r,placement:l,middlewareData:a}=n,c=yield fe(n,e);return l===((i=a.offset)==null?void 0:i.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:s+c.x,y:r+c.y,data:X(O({},c),{placement:l})}})}}};function rt(){return typeof window!="undefined"}function K(e){return Ht(e)?(e.nodeName||"").toLowerCase():"#document"}function T(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function V(e){var t;return(t=(Ht(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ht(e){return rt()?e instanceof Node||e instanceof T(e).Node:!1}function R(e){return rt()?e instanceof Element||e instanceof T(e).Element:!1}function k(e){return rt()?e instanceof HTMLElement||e instanceof T(e).HTMLElement:!1}function $t(e){return!rt()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof T(e).ShadowRoot}function Z(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=E(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function ue(e){return["table","td","th"].includes(K(e))}function lt(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(n){return!1}})}function vt(e){const t=_t(),n=R(e)?E(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function de(e){let t=j(e);for(;k(t)&&!U(t);){if(vt(t))return t;if(lt(t))return null;t=j(t)}return null}function _t(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function U(e){return["html","body","#document"].includes(K(e))}function E(e){return T(e).getComputedStyle(e)}function ct(e){return R(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function j(e){if(K(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$t(e)&&e.host||V(e);return $t(t)?t.host:t}function Bt(e){const t=j(e);return U(t)?e.ownerDocument?e.ownerDocument.body:e.body:k(t)&&Z(t)?t:Bt(t)}function pt(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Bt(e),s=o===((i=e.ownerDocument)==null?void 0:i.body),r=T(o);if(s){const l=mt(r);return t.concat(r,r.visualViewport||[],Z(o)?o:[],l&&n?pt(l):[])}return t.concat(o,pt(o,[],n))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ft(e){const t=E(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=k(e),s=o?e.offsetWidth:n,r=o?e.offsetHeight:i,l=it(n)!==s||it(i)!==r;return l&&(n=s,i=r),{width:n,height:i,$:l}}function Nt(e){return R(e)?e:e.contextElement}function q(e){const t=Nt(e);if(!k(t))return D(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:s}=Ft(t);let r=(s?it(n.width):n.width)/i,l=(s?it(n.height):n.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const ge=D(0);function Vt(e){const t=T(e);return!_t()||!t.visualViewport?ge:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function pe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==T(e)?!1:t}function J(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Nt(e);let r=D(1);t&&(i?R(i)&&(r=q(i)):r=q(e));const l=pe(s,n,i)?Vt(s):D(0);let a=(o.left+l.x)/r.x,c=(o.top+l.y)/r.y,h=o.width/r.x,f=o.height/r.y;if(s){const g=T(s),u=i&&R(i)?T(i):i;let d=g,p=mt(d);for(;p&&i&&u!==d;){const m=q(p),w=p.getBoundingClientRect(),_=E(p),y=w.left+(p.clientLeft+parseFloat(_.paddingLeft))*m.x,b=w.top+(p.clientTop+parseFloat(_.paddingTop))*m.y;a*=m.x,c*=m.y,h*=m.x,f*=m.y,a+=y,c+=b,d=T(p),p=mt(d)}}return ot({width:h,height:f,x:a,y:c})}function bt(e,t){const n=ct(e).scrollLeft;return t?t.left+n:J(V(e)).left+n}function Wt(e,t,n){n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=i.left+t.scrollLeft-(n?0:bt(e,i)),s=i.top+t.scrollTop;return{x:o,y:s}}function me(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const s=o==="fixed",r=V(i),l=t?lt(t.floating):!1;if(i===r||l&&s)return n;let a={scrollLeft:0,scrollTop:0},c=D(1);const h=D(0),f=k(i);if((f||!f&&!s)&&((K(i)!=="body"||Z(r))&&(a=ct(i)),k(i))){const u=J(i);c=q(i),h.x=u.x+i.clientLeft,h.y=u.y+i.clientTop}const g=r&&!f&&!s?Wt(r,a,!0):D(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+h.x+g.x,y:n.y*c.y-a.scrollTop*c.y+h.y+g.y}}function xe(e){return Array.from(e.getClientRects())}function we(e){const t=V(e),n=ct(e),i=e.ownerDocument.body,o=Y(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=Y(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let r=-n.scrollLeft+bt(e);const l=-n.scrollTop;return E(i).direction==="rtl"&&(r+=Y(t.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:l}}function ye(e,t){const n=T(e),i=V(e),o=n.visualViewport;let s=i.clientWidth,r=i.clientHeight,l=0,a=0;if(o){s=o.width,r=o.height;const c=_t();(!c||c&&t==="fixed")&&(l=o.offsetLeft,a=o.offsetTop)}return{width:s,height:r,x:l,y:a}}function ve(e,t){const n=J(e,!0,t==="fixed"),i=n.top+e.clientTop,o=n.left+e.clientLeft,s=k(e)?q(e):D(1),r=e.clientWidth*s.x,l=e.clientHeight*s.y,a=o*s.x,c=i*s.y;return{width:r,height:l,x:a,y:c}}function At(e,t,n){let i;if(t==="viewport")i=ye(e,n);else if(t==="document")i=we(V(e));else if(R(t))i=ve(t,n);else{const o=Vt(e);i={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ot(i)}function zt(e,t){const n=j(e);return n===t||!R(n)||U(n)?!1:E(n).position==="fixed"||zt(n,t)}function _e(e,t){const n=t.get(e);if(n)return n;let i=pt(e,[],!1).filter(l=>R(l)&&K(l)!=="body"),o=null;const s=E(e).position==="fixed";let r=s?j(e):e;for(;R(r)&&!U(r);){const l=E(r),a=vt(r);!a&&l.position==="fixed"&&(o=null),(s?!a&&!o:!a&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Z(r)&&!a&&zt(e,r))?i=i.filter(h=>h!==r):o=l,r=j(r)}return t.set(e,i),i}function be(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const r=[...n==="clippingAncestors"?lt(t)?[]:_e(t,this._c):[].concat(n),i],l=r[0],a=r.reduce((c,h)=>{const f=At(t,h,o);return c.top=Y(f.top,c.top),c.right=G(f.right,c.right),c.bottom=G(f.bottom,c.bottom),c.left=Y(f.left,c.left),c},At(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Se(e){const{width:t,height:n}=Ft(e);return{width:t,height:n}}function Ce(e,t,n){const i=k(t),o=V(t),s=n==="fixed",r=J(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=D(0);if(i||!i&&!s)if((K(t)!=="body"||Z(o))&&(l=ct(t)),i){const g=J(t,!0,s,t);a.x=g.x+t.clientLeft,a.y=g.y+t.clientTop}else o&&(a.x=bt(o));const c=o&&!i&&!s?Wt(o,l):D(0),h=r.left+l.scrollLeft-a.x-c.x,f=r.top+l.scrollTop-a.y-c.y;return{x:h,y:f,width:r.width,height:r.height}}function dt(e){return E(e).position==="static"}function Dt(e,t){if(!k(e)||E(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function It(e,t){const n=T(e);if(lt(e))return n;if(!k(e)){let o=j(e);for(;o&&!U(o);){if(R(o)&&!dt(o))return o;o=j(o)}return n}let i=Dt(e,t);for(;i&&ue(i)&&dt(i);)i=Dt(i,t);return i&&U(i)&&dt(i)&&!vt(i)?n:i||de(e)||n}const Le=function(e){return F(this,null,function*(){const t=this.getOffsetParent||It,n=this.getDimensions,i=yield n(e.floating);return{reference:Ce(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};function Pe(e){return E(e).direction==="rtl"}const Te={convertOffsetParentRelativeRectToViewportRelativeRect:me,getDocumentElement:V,getClippingRect:be,getOffsetParent:It,getElementRects:Le,getClientRects:xe,getDimensions:Se,getScale:q,isElement:R,isRTL:Pe},Oe=he,Re=ae,Ee=le,$e=(e,t,n)=>{const i=new Map,o=O({platform:Te},n),s=X(O({},o.platform),{_c:i});return se(e,t,X(O({},o),{platform:s}))};function I(e){return e===null||typeof e=="undefined"}function P(e){return!I(e)}function kt(e){return new Promise(t=>setTimeout(t,e))}function jt(e){var i;const t=e.parentElement;return!t||t.nodeName==="HTML"?!1:((i=document.defaultView)==null?void 0:i.getComputedStyle(e,null).getPropertyValue("position"))==="fixed"?!0:jt(t)}function Yt(e){return jt(e)?"fixed":"absolute"}class Ae{renderContent(t,n,i){t.querySelector(`.${i.classPrefix}-content`).appendChild(n.node)}}function L(e,t){const n=document.createElement(e);return t&&t.length>0&&(t=t.filter(i=>i),n.classList.add(...t)),n}class De{renderContent(t,n,i){var s,r,l,a;const o=t.querySelector(`.${i.classPrefix}-content`);if(n.imgSrc){const c=L("img",[`${i.classPrefix}-image`,`${(r=(s=n.customization)==null?void 0:s.imageClass)!=null?r:""}`]);c.src=n.imgSrc,o.appendChild(c)}if(n.text){const c=L("p",[`${i.classPrefix}-description`,`${(a=(l=n.customization)==null?void 0:l.descriptionClass)!=null?a:""}`]);c.innerHTML=i.translateFn(n.text),o.appendChild(c)}}}function ke(e,t,n){var l,a,c,h,f,g,u,d,p,m,w,_,y,b,v,$,M;if(e.innerHTML="",e.className=`${(l=n.config.class)!=null?l:""} ${n.config.classPrefix} ${n.config.animationClass}`,!n.config.arrow.disable&&((a=n.activeStep)!=null&&a.hasHost)){const x=L("div",[(c=n.config.arrow.class)!=null?c:"",`${n.config.classPrefix}-arrow`]);e.appendChild(x)}(h=t.customization)!=null&&h.class&&e.classList.add(t.customization.class);const i=L("div",[`${n.config.classPrefix}-header`,`${(g=(f=t.customization)==null?void 0:f.headerClass)!=null?g:""}`]);e.appendChild(i);const o=L("h1",[`${n.config.classPrefix}-title`,`${(d=(u=t.customization)==null?void 0:u.titleClass)!=null?d:""}`]);if(o.innerHTML=n.config.translateFn((p=t.title)!=null?p:""),i.appendChild(o),n.config.allowClose){const x=L("button",[`${n.config.classPrefix}-close`,`${(w=(m=t.customization)==null?void 0:m.closeButtonClass)!=null?w:""}`]);Me(x,n.config.closeIcon),x.onclick=n.complete.bind(n),i.appendChild(x)}const s=L("div",[`${n.config.classPrefix}-content`,`${(y=(_=t.customization)==null?void 0:_.contentClass)!=null?y:""}`]);e.appendChild(s);const r=L("div",[`${n.config.classPrefix}-footer`,`${(v=(b=t.customization)==null?void 0:b.footerClass)!=null?v:""}`]);if(I(t.buttonList)&&(t.buttonList=He(n)),t.buttonList.forEach(x=>{var z;const W=[`${n.config.classPrefix}-button`,(z=x.class)!=null?z:""];I(x.type)||x.type==="secondary"?W.push(`${n.config.classPrefix}-button-secondary`):x.type==="primary"?W.push(`${n.config.classPrefix}-button-primary`):x.type==="link"&&W.push(`${n.config.classPrefix}-button-link`),!I(x.class)&&x.class!==""&&W.push(x.class);const H=L("button",W);H.innerHTML=n.config.translateFn(x.text),H.onclick=C=>{x.action.call(n)},r.appendChild(H)}),!n.config.progress.disable&&n.config.progress.text&&P(n.activeStepIndex)){const x=L("p",[`${n.config.classPrefix}-progress`,`${(M=($=t.customization)==null?void 0:$.progressClass)!=null?M:""}`]);x.innerHTML=Be(n.config.progress.text,n.activeStepIndex+1,n.stepList.length),r.appendChild(x)}e.appendChild(r)}function Me(e,t){t instanceof HTMLElement?e.appendChild(t):e.innerHTML=t.innerHTML}function He(e){return[{text:"Back",action:e.prev},{text:"Next",type:"primary",action:e.next}]}function Be(e,t,n){return e.replace("{{currentStep}}",t.toString()).replace("{{totalSteps}}",n.toString())}class Fe{constructor(){S(this,"_renderContentStrategy",new Map);S(this,"_staticSides",{top:"bottom",right:"left",bottom:"top",left:"right"});this.setUpStrategies()}render(t,n){return new Promise(i=>{var o,s;if(!this._renderContentStrategy.has(n.popupData.type))throw new Error("Missing popup creator strategy");t.style.display="none",t.classList.remove(n.tour.config.animationClass),n.hostElement?t.style.position=Yt(n.hostElement):t.style.position="fixed",ke(t,n.popupData,n.tour),(o=this._renderContentStrategy.get(n.popupData.type))==null||o.renderContent(t,n.popupData,n.tour.config),(s=n.hostElement)==null||s.scrollIntoView(n.tour.config.scrollTo),i()}).then(()=>n.isFirst&&n.direction==="toNext"?kt(0):kt(400)).then(()=>{t.style.display="flex",this.updatePosition(t,n),t.classList.add(n.tour.config.animationClass)})}updatePosition(t,n){P(n.hostElement)?this.renderFloatingPopup(t,n):this.renderCenterPopup(t)}renderFloatingPopup(t,n){var c;const i=t.style.position==="fixed"?window.scrollY||document.documentElement.scrollTop:0,o=t.querySelector(`.${n.tour.config.classPrefix}-arrow`),s=[],r=P(n.popupData.position)&&n.popupData.position!=="auto"?n.popupData.position:void 0,l=(c=o==null?void 0:o.offsetWidth)!=null?c:10,a=Math.sqrt(2*Lt(l,2))/2+n.tour.config.highlight.padding;s.push(Oe(a)),(n.popupData.position==="auto"||I(r))&&s.push(Re()),!n.tour.config.arrow.disable&&P(o)&&s.push(Ee({element:o})),$e(n.hostElement,t,{placement:r,middleware:[...s]}).then(({x:h,y:f,middlewareData:g,placement:u})=>{Object.assign(t.style,{top:`${f-i}px`,left:`${h}px`,marginTop:"0",marginLeft:"0"});const d=u.split("-")[0],p=this._staticSides[d];if(g.arrow&&P(o)){const{x:m,y:w}=g.arrow;Object.assign(o.style,{left:m!=null?`${m}px`:"",top:w!=null?`${w}px`:"",right:"",bottom:"",[p]:`${-l/2}px`,transform:"rotate(45deg)"})}})}renderCenterPopup(t){Object.assign(t.style,{top:"50%",left:"50%",marginTop:`-${t.clientHeight/2}px`,marginLeft:`-${t.clientWidth/2}px`})}setUpStrategies(){this._renderContentStrategy.set("text",new De),this._renderContentStrategy.set("custom",new Ae)}}class Ne{render(t,n){return new Promise(i=>{n.hostElement&&(t.style.position=Yt(n.hostElement)),i()}).then(()=>{this.updatePosition(t,n)})}updatePosition(t,n){var r,l;if(!n.hostElement){t.style.width="0",t.style.height="0",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.opacity="0";return}const i=n.hostElement.getBoundingClientRect(),o=(l=(r=n.tour.config.highlight)==null?void 0:r.padding)!=null?l:8,s=t.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;t.style.transform="",t.style.left=`${i.left-o}px`,t.style.top=`${i.top+s-o}px`,t.style.width=`${i.width+2*o}px`,t.style.height=`${i.height+2*o}px`,t.style.opacity="1"}}class qt{constructor(t,n){S(this,"popupData");S(this,"tour");S(this,"_index");S(this,"_hostElement",null);S(this,"_direction","toNext");S(this,"_hostData");S(this,"_popupRenderer");S(this,"_highlightRenderer");var i;this.popupData=n.popup,this.tour=t,this._index=(i=n.index)!=null?i:null,this._hostData=n.host,this._popupRenderer=t.popupRenderer,this._highlightRenderer=t.highlightRenderer}get isFirst(){return this._index===0}get nextStep(){var t;return(t=this.tour.stepList[this.tour.stepList.indexOf(this)+1])!=null?t:null}get prevStep(){var t;return(t=this.tour.stepList[this.tour.stepList.indexOf(this)-1])!=null?t:null}get direction(){return this._direction}get hasHost(){return P(this._hostElement)}get hostElement(){return this._hostElement}get index(){return this._index}set index(t){this._index=t}show(t){return F(this,null,function*(){var i;if(I(this.tour.popup))return;this._direction=t,this._hostData&&(this._hostElement=this.resolveHostElement(typeof this._hostData=="function"?this._hostData():(i=this._hostData)!=null?i:null));const n=[this._popupRenderer.render(this.tour.popup,this)];!this.tour.config.highlight.disable&&!I(this.tour.highlight)&&n.push(this._highlightRenderer.render(this.tour.highlight,this)),this.tour.config.highlight.disable&&P(this.tour.highlight)&&this._highlightRenderer.render(this.tour.highlight,{}),yield Promise.all(n)})}resolveHostElement(t){return typeof this._hostData=="string"?document.querySelector(this._hostData):t}}function gt(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Ut(e,t){const n=O({},e);return gt(e)&>(t)&&Object.keys(t).forEach(i=>{const o=i,s=i;gt(t[o])?(s in e||Object.assign(n,{[s]:{}}),n[s]=Ut(e[s],t[o])):Object.assign(n,{[s]:t[o]})}),n}function Ve(e){return{innerHTML:`
|
|
2
|
-
<svg
|
|
3
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
-
fill="none"
|
|
5
|
-
viewBox="0 0 162 162"
|
|
6
|
-
class="${e}-close-icon"
|
|
7
|
-
>
|
|
8
|
-
<path
|
|
9
|
-
stroke-linecap="round"
|
|
10
|
-
stroke-width="17"
|
|
11
|
-
stroke="black"
|
|
12
|
-
d="M9.01074 8.98926L153.021 153"
|
|
13
|
-
></path>
|
|
14
|
-
<path
|
|
15
|
-
stroke-linecap="round"
|
|
16
|
-
stroke-width="17"
|
|
17
|
-
stroke="black"
|
|
18
|
-
d="M9.01074 153L153.021 8.98926"
|
|
19
|
-
></path>
|
|
20
|
-
</svg>
|
|
21
|
-
`}}class We{constructor(){S(this,"_activeTour",null)}get isActive(){return P(this.activeTour)}get activeTour(){return this._activeTour}setActiveTour(t){this._activeTour=t}}const nt=new We;class ze{constructor(t){S(this,"popupRenderer",new Fe);S(this,"highlightRenderer",new Ne);S(this,"_popup",null);S(this,"_highlight",null);S(this,"_stepList",[]);S(this,"_activeStep",null);S(this,"_bodyResizeObserver");S(this,"_config");var n,i,o,s,r,l,a,c,h,f,g,u,d,p,m,w,_,y,b,v;this._bodyResizeObserver=this.getBodyResizeObserver(),this._config={classPrefix:(n=t.classPrefix)!=null?n:"siteguide",class:"",animationClass:(i=t.animationClass)!=null?i:"siteguide-animation",allowClose:(o=t.allowClose)!=null?o:!0,scrollTo:(s=t.scrollTo)!=null?s:{behavior:"smooth",block:"center",inline:"center"},allowClickoutClose:(r=t.allowClickoutClose)!=null?r:!1,closeIcon:(a=t.closeIcon)!=null?a:Ve((l=t.classPrefix)!=null?l:"siteguide"),arrow:{disable:(h=(c=t.arrow)==null?void 0:c.disable)!=null?h:!1,class:(g=(f=t.arrow)==null?void 0:f.class)!=null?g:""},highlight:{disable:(d=(u=t.highlight)==null?void 0:u.disable)!=null?d:!1,padding:(m=(p=t.highlight)==null?void 0:p.padding)!=null?m:8,class:(_=(w=t.highlight)==null?void 0:w.class)!=null?_:""},progress:{disable:(b=(y=t.progress)==null?void 0:y.disable)!=null?b:!0,text:"Step {{currentStep}} of {{totalSteps}}"},translateFn:(v=t.translateFn)!=null?v:$=>$}}get stepList(){return this._stepList}get config(){return this._config}get popup(){return this._popup}get highlight(){return this._highlight}get activeStep(){return this._activeStep}get activeStepIndex(){return this._activeStep?this.stepList.indexOf(this._activeStep):null}addStep(t){if(I(t.index)){const i=this._stepList.reduce((o,s)=>s.index!==null&&s.index!==void 0&&s.index>o?s.index:o,-1);t.index=i+1}const n=new qt(this,t);this._stepList.push(n),this._stepList.sort((i,o)=>i.index-o.index)}addSteps(t){t.forEach(n=>this.addStep(n))}removeStep(t){this._stepList=this._stepList.filter(n=>t!==n.index)}start(){P(nt.activeTour)||(nt.setActiveTour(this),this._popup=L("div",[this._config.classPrefix]),document.body.appendChild(this._popup),this._config.highlight.disable||(this._highlight=L("div",[this._config.highlight.class,`${this._config.classPrefix}-highlight`]),document.body.appendChild(this._highlight)),this.next())}complete(){this._popup&&document.body.removeChild(this._popup),this._highlight&&document.body.removeChild(this._highlight),this._activeStep=null,nt.setActiveTour(null)}prev(){const t=P(this._activeStep)?this._stepList.indexOf(this._activeStep)-1:this._stepList.indexOf(this._stepList[this._stepList.length-1]);if(t<0){this.complete();return}this._activeStep=this._stepList[t],this._activeStep.show("fromBack")}next(){const t=P(this._activeStep)?this._stepList.indexOf(this._activeStep)+1:this._stepList.indexOf(this._stepList[0]);if(t>=this._stepList.length){this.complete();return}this._activeStep=this._stepList[t],this._activeStep.show("toNext")}setConfig(t){this._config=Ut(this._config,t)}getBodyResizeObserver(){const t=new ResizeObserver(()=>{this._activeStep&&(P(this._popup)&&this.popupRenderer.updatePosition(this._popup,this._activeStep),P(this._highlight)&&!this.config.highlight.disable&&this.highlightRenderer.updatePosition(this._highlight,this._activeStep))});return t.observe(document.body),t}}const Ie=nt;exports.Siteguide=Ie;exports.Tour=ze;exports.TourStep=qt;exports.createElement=L;
|
|
1
|
+
"use strict";var Xt=Object.defineProperty,Zt=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var et=Object.getOwnPropertySymbols;var St=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable;var Lt=Math.pow,dt=(e,t,n)=>t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))St.call(t,n)&&dt(e,n,t[n]);if(et)for(var n of et(t))Ct.call(t,n)&&dt(e,n,t[n]);return e},X=(e,t)=>Zt(e,Gt(t));var Pt=(e,t)=>{var n={};for(var i in e)St.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&et)for(var i of et(e))t.indexOf(i)<0&&Ct.call(e,i)&&(n[i]=e[i]);return n};var y=(e,t,n)=>dt(e,typeof t!="symbol"?t+"":t,n);var $=(e,t,n)=>new Promise((i,o)=>{var s=a=>{try{c(n.next(a))}catch(l){o(l)}},r=a=>{try{c(n.throw(a))}catch(l){o(l)}},c=a=>a.done?i(a.value):Promise.resolve(a.value).then(s,r);c((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Jt=["top","right","bottom","left"],Tt=["start","end"],Et=Jt.reduce((e,t)=>e.concat(t,t+"-"+Tt[0],t+"-"+Tt[1]),[]),Z=Math.min,Y=Math.max,it=Math.round,N=e=>({x:e,y:e}),Qt={left:"right",right:"left",bottom:"top",top:"bottom"},te={start:"end",end:"start"};function ee(e,t,n){return Y(e,Z(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function J(e){return e.split("-")[0]}function M(e){return e.split("-")[1]}function ne(e){return e==="x"?"y":"x"}function xt(e){return e==="y"?"height":"width"}function yt(e){return["top","bottom"].includes(J(e))?"y":"x"}function wt(e){return ne(yt(e))}function ie(e,t,n){n===void 0&&(n=!1);const i=M(e),o=wt(e),s=xt(o);let r=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Rt(r)),[r,Rt(r)]}function oe(e){return e.replace(/start|end/g,t=>te[t])}function Rt(e){return e.replace(/left|right|bottom|top/g,t=>Qt[t])}function se(e){return O({top:0,right:0,bottom:0,left:0},e)}function Bt(e){return typeof e!="number"?se(e):{top:e,right:e,bottom:e,left:e}}function ot(e){const{x:t,y:n,width:i,height:o}=e;return{width:i,height:o,top:n,left:t,right:t+i,bottom:n+o,x:t,y:n}}function Ot(e,t,n){let{reference:i,floating:o}=e;const s=yt(t),r=wt(t),c=xt(r),a=J(t),l=s==="y",h=i.x+i.width/2-o.width/2,f=i.y+i.height/2-o.height/2,g=i[c]/2-o[c]/2;let d;switch(a){case"top":d={x:h,y:i.y-o.height};break;case"bottom":d={x:h,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:f};break;case"left":d={x:i.x-o.width,y:f};break;default:d={x:i.x,y:i.y}}switch(M(t)){case"start":d[r]-=g*(n&&l?-1:1);break;case"end":d[r]+=g*(n&&l?-1:1);break}return d}const re=(e,t,n)=>$(exports,null,function*(){const{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:r}=n,c=s.filter(Boolean),a=yield r.isRTL==null?void 0:r.isRTL(t);let l=yield r.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:f}=Ot(l,i,a),g=i,d={},u=0;for(let p=0;p<c.length;p++){const{name:m,fn:x}=c[p],{x:b,y:v,data:S,reset:_}=yield x({x:h,y:f,initialPlacement:i,placement:g,strategy:o,middlewareData:d,rects:l,platform:r,elements:{reference:e,floating:t}});h=b!=null?b:h,f=v!=null?v:f,d=X(O({},d),{[m]:O(O({},d[m]),S)}),_&&u<=50&&(u++,typeof _=="object"&&(_.placement&&(g=_.placement),_.rects&&(l=_.rects===!0?yield r.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:h,y:f}=Ot(l,g,a)),p=-1)}return{x:h,y:f,placement:g,strategy:o,middlewareData:d}});function ce(e,t){return $(this,null,function*(){var n;t===void 0&&(t={});const{x:i,y:o,platform:s,rects:r,elements:c,strategy:a}=e,{boundary:l="clippingAncestors",rootBoundary:h="viewport",elementContext:f="floating",altBoundary:g=!1,padding:d=0}=st(t,e),u=Bt(d),m=c[g?f==="floating"?"reference":"floating":f],x=ot(yield s.getClippingRect({element:(n=yield s.isElement==null?void 0:s.isElement(m))==null||n?m:m.contextElement||(yield s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:l,rootBoundary:h,strategy:a})),b=f==="floating"?{x:i,y:o,width:r.floating.width,height:r.floating.height}:r.reference,v=yield s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating),S=(yield s.isElement==null?void 0:s.isElement(v))?(yield s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},_=ot(s.convertOffsetParentRelativeRectToViewportRelativeRect?yield s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:v,strategy:a}):b);return{top:(x.top-_.top+u.top)/S.y,bottom:(_.bottom-x.bottom+u.bottom)/S.y,left:(x.left-_.left+u.left)/S.x,right:(_.right-x.right+u.right)/S.x}})}const le=e=>({name:"arrow",options:e,fn(n){return $(this,null,function*(){const{x:i,y:o,placement:s,rects:r,platform:c,elements:a,middlewareData:l}=n,{element:h,padding:f=0}=st(e,n)||{};if(h==null)return{};const g=Bt(f),d={x:i,y:o},u=wt(s),p=xt(u),m=yield c.getDimensions(h),x=u==="y",b=x?"top":"left",v=x?"bottom":"right",S=x?"clientHeight":"clientWidth",_=r.reference[p]+r.reference[u]-d[u]-r.floating[p],w=d[u]-r.reference[u],C=yield c.getOffsetParent==null?void 0:c.getOffsetParent(h);let L=C?C[S]:0;(!L||!(yield c.isElement==null?void 0:c.isElement(C)))&&(L=a.floating[S]||r.floating[p]);const I=_/2-w/2,F=L/2-m[p]/2-1,z=Z(g[b],F),P=Z(g[v],F),k=z,tt=L-m[p]-P,H=L/2-m[p]/2+I,at=ee(k,H,tt),ft=!l.arrow&&M(s)!=null&&H!==at&&r.reference[p]/2-(H<k?z:P)-m[p]/2<0,ht=ft?H<k?H-k:H-tt:0;return{[u]:d[u]+ht,data:O({[u]:at,centerOffset:H-at-ht},ft&&{alignmentOffset:ht}),reset:ft}})}});function ae(e,t,n){return(e?[...n.filter(o=>M(o)===e),...n.filter(o=>M(o)!==e)]:n.filter(o=>J(o)===o)).filter(o=>e?M(o)===e||(t?oe(o)!==o:!1):!0)}const fe=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,fn(n){return $(this,null,function*(){var i,o,s;const{rects:r,middlewareData:c,placement:a,platform:l,elements:h}=n,z=st(e,n),{crossAxis:f=!1,alignment:g,allowedPlacements:d=Et,autoAlignment:u=!0}=z,p=Pt(z,["crossAxis","alignment","allowedPlacements","autoAlignment"]),m=g!==void 0||d===Et?ae(g||null,u,d):d,x=yield ce(n,p),b=((i=c.autoPlacement)==null?void 0:i.index)||0,v=m[b];if(v==null)return{};const S=ie(v,r,yield l.isRTL==null?void 0:l.isRTL(h.floating));if(a!==v)return{reset:{placement:m[0]}};const _=[x[J(v)],x[S[0]],x[S[1]]],w=[...((o=c.autoPlacement)==null?void 0:o.overflows)||[],{placement:v,overflows:_}],C=m[b+1];if(C)return{data:{index:b+1,overflows:w},reset:{placement:C}};const L=w.map(P=>{const k=M(P.placement);return[P.placement,k&&f?P.overflows.slice(0,2).reduce((tt,H)=>tt+H,0):P.overflows[0],P.overflows]}).sort((P,k)=>P[1]-k[1]),F=((s=L.filter(P=>P[2].slice(0,M(P[0])?2:3).every(k=>k<=0))[0])==null?void 0:s[0])||L[0][0];return F!==a?{data:{index:b+1,overflows:w},reset:{placement:F}}:{}})}}};function he(e,t){return $(this,null,function*(){const{placement:n,platform:i,elements:o}=e,s=yield i.isRTL==null?void 0:i.isRTL(o.floating),r=J(n),c=M(n),a=yt(n)==="y",l=["left","top"].includes(r)?-1:1,h=s&&a?-1:1,f=st(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:u}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof u=="number"&&(d=c==="end"?u*-1:u),a?{x:d*h,y:g*l}:{x:g*l,y:d*h}})}const de=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return $(this,null,function*(){var i,o;const{x:s,y:r,placement:c,middlewareData:a}=n,l=yield he(n,e);return c===((i=a.offset)==null?void 0:i.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:s+l.x,y:r+l.y,data:X(O({},l),{placement:c})}})}}};function rt(){return typeof window!="undefined"}function K(e){return Ft(e)?(e.nodeName||"").toLowerCase():"#document"}function R(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function W(e){var t;return(t=(Ft(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ft(e){return rt()?e instanceof Node||e instanceof R(e).Node:!1}function A(e){return rt()?e instanceof Element||e instanceof R(e).Element:!1}function B(e){return rt()?e instanceof HTMLElement||e instanceof R(e).HTMLElement:!1}function $t(e){return!rt()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}function Q(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=D(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function ue(e){return["table","td","th"].includes(K(e))}function ct(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(n){return!1}})}function vt(e){const t=_t(),n=A(e)?D(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function ge(e){let t=j(e);for(;B(t)&&!U(t);){if(vt(t))return t;if(ct(t))return null;t=j(t)}return null}function _t(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function U(e){return["html","body","#document"].includes(K(e))}function D(e){return R(e).getComputedStyle(e)}function lt(e){return A(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function j(e){if(K(e)==="html")return e;const t=e.assignedSlot||e.parentNode||$t(e)&&e.host||W(e);return $t(t)?t.host:t}function Ht(e){const t=j(e);return U(t)?e.ownerDocument?e.ownerDocument.body:e.body:B(t)&&Q(t)?t:Ht(t)}function pt(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ht(e),s=o===((i=e.ownerDocument)==null?void 0:i.body),r=R(o);if(s){const c=mt(r);return t.concat(r,r.visualViewport||[],Q(o)?o:[],c&&n?pt(c):[])}return t.concat(o,pt(o,[],n))}function mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Mt(e){const t=D(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=B(e),s=o?e.offsetWidth:n,r=o?e.offsetHeight:i,c=it(n)!==s||it(i)!==r;return c&&(n=s,i=r),{width:n,height:i,$:c}}function Vt(e){return A(e)?e:e.contextElement}function q(e){const t=Vt(e);if(!B(t))return N(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:s}=Mt(t);let r=(s?it(n.width):n.width)/i,c=(s?it(n.height):n.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const pe=N(0);function Wt(e){const t=R(e);return!_t()||!t.visualViewport?pe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function me(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==R(e)?!1:t}function G(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Vt(e);let r=N(1);t&&(i?A(i)&&(r=q(i)):r=q(e));const c=me(s,n,i)?Wt(s):N(0);let a=(o.left+c.x)/r.x,l=(o.top+c.y)/r.y,h=o.width/r.x,f=o.height/r.y;if(s){const g=R(s),d=i&&A(i)?R(i):i;let u=g,p=mt(u);for(;p&&i&&d!==u;){const m=q(p),x=p.getBoundingClientRect(),b=D(p),v=x.left+(p.clientLeft+parseFloat(b.paddingLeft))*m.x,S=x.top+(p.clientTop+parseFloat(b.paddingTop))*m.y;a*=m.x,l*=m.y,h*=m.x,f*=m.y,a+=v,l+=S,u=R(p),p=mt(u)}}return ot({width:h,height:f,x:a,y:l})}function bt(e,t){const n=lt(e).scrollLeft;return t?t.left+n:G(W(e)).left+n}function It(e,t,n){n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=i.left+t.scrollLeft-(n?0:bt(e,i)),s=i.top+t.scrollTop;return{x:o,y:s}}function xe(e){let{elements:t,rect:n,offsetParent:i,strategy:o}=e;const s=o==="fixed",r=W(i),c=t?ct(t.floating):!1;if(i===r||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=N(1);const h=N(0),f=B(i);if((f||!f&&!s)&&((K(i)!=="body"||Q(r))&&(a=lt(i)),B(i))){const d=G(i);l=q(i),h.x=d.x+i.clientLeft,h.y=d.y+i.clientTop}const g=r&&!f&&!s?It(r,a,!0):N(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+h.x+g.x,y:n.y*l.y-a.scrollTop*l.y+h.y+g.y}}function ye(e){return Array.from(e.getClientRects())}function we(e){const t=W(e),n=lt(e),i=e.ownerDocument.body,o=Y(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=Y(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let r=-n.scrollLeft+bt(e);const c=-n.scrollTop;return D(i).direction==="rtl"&&(r+=Y(t.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:c}}function ve(e,t){const n=R(e),i=W(e),o=n.visualViewport;let s=i.clientWidth,r=i.clientHeight,c=0,a=0;if(o){s=o.width,r=o.height;const l=_t();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}return{width:s,height:r,x:c,y:a}}function _e(e,t){const n=G(e,!0,t==="fixed"),i=n.top+e.clientTop,o=n.left+e.clientLeft,s=B(e)?q(e):N(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,l=i*s.y;return{width:r,height:c,x:a,y:l}}function At(e,t,n){let i;if(t==="viewport")i=ve(e,n);else if(t==="document")i=we(W(e));else if(A(t))i=_e(t,n);else{const o=Wt(e);i={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ot(i)}function zt(e,t){const n=j(e);return n===t||!A(n)||U(n)?!1:D(n).position==="fixed"||zt(n,t)}function be(e,t){const n=t.get(e);if(n)return n;let i=pt(e,[],!1).filter(c=>A(c)&&K(c)!=="body"),o=null;const s=D(e).position==="fixed";let r=s?j(e):e;for(;A(r)&&!U(r);){const c=D(r),a=vt(r);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Q(r)&&!a&&zt(e,r))?i=i.filter(h=>h!==r):o=c,r=j(r)}return t.set(e,i),i}function Se(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const r=[...n==="clippingAncestors"?ct(t)?[]:be(t,this._c):[].concat(n),i],c=r[0],a=r.reduce((l,h)=>{const f=At(t,h,o);return l.top=Y(f.top,l.top),l.right=Z(f.right,l.right),l.bottom=Z(f.bottom,l.bottom),l.left=Y(f.left,l.left),l},At(t,c,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Ce(e){const{width:t,height:n}=Mt(e);return{width:t,height:n}}function Le(e,t,n){const i=B(t),o=W(t),s=n==="fixed",r=G(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=N(0);if(i||!i&&!s)if((K(t)!=="body"||Q(o))&&(c=lt(t)),i){const g=G(t,!0,s,t);a.x=g.x+t.clientLeft,a.y=g.y+t.clientTop}else o&&(a.x=bt(o));const l=o&&!i&&!s?It(o,c):N(0),h=r.left+c.scrollLeft-a.x-l.x,f=r.top+c.scrollTop-a.y-l.y;return{x:h,y:f,width:r.width,height:r.height}}function ut(e){return D(e).position==="static"}function Dt(e,t){if(!B(e)||D(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return W(e)===n&&(n=n.ownerDocument.body),n}function jt(e,t){const n=R(e);if(ct(e))return n;if(!B(e)){let o=j(e);for(;o&&!U(o);){if(A(o)&&!ut(o))return o;o=j(o)}return n}let i=Dt(e,t);for(;i&&ue(i)&&ut(i);)i=Dt(i,t);return i&&U(i)&&ut(i)&&!vt(i)?n:i||ge(e)||n}const Pe=function(e){return $(this,null,function*(){const t=this.getOffsetParent||jt,n=this.getDimensions,i=yield n(e.floating);return{reference:Le(e.reference,yield t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}})};function Te(e){return D(e).direction==="rtl"}const Ee={convertOffsetParentRelativeRectToViewportRelativeRect:xe,getDocumentElement:W,getClippingRect:Se,getOffsetParent:jt,getElementRects:Pe,getClientRects:ye,getDimensions:Ce,getScale:q,isElement:A,isRTL:Te},Re=de,Oe=fe,$e=le,Ae=(e,t,n)=>{const i=new Map,o=O({platform:Ee},n),s=X(O({},o.platform),{_c:i});return re(e,t,X(O({},o),{platform:s}))};function V(e){return e===null||typeof e=="undefined"}function E(e){return!V(e)}function kt(e){return new Promise(t=>setTimeout(t,e))}function Yt(e){var i;const t=e.parentElement;return!t||t.nodeName==="HTML"?!1:((i=document.defaultView)==null?void 0:i.getComputedStyle(e,null).getPropertyValue("position"))==="fixed"?!0:Yt(t)}function qt(e){return Yt(e)?"fixed":"absolute"}class De{renderContent(t,n,i){t.querySelector(`.${i.classPrefix}-content`).appendChild(n.node)}}function T(e,t){const n=document.createElement(e);return t&&t.length>0&&(t=t.filter(i=>i),n.classList.add(...t)),n}class ke{renderContent(t,n,i){var s,r,c,a;const o=t.querySelector(`.${i.classPrefix}-content`);if(n.imgSrc){const l=T("img",[`${i.classPrefix}-image`,`${(r=(s=n.customization)==null?void 0:s.imageClass)!=null?r:""}`]);l.src=n.imgSrc,o.appendChild(l)}if(n.text){const l=T("p",[`${i.classPrefix}-description`,`${(a=(c=n.customization)==null?void 0:c.descriptionClass)!=null?a:""}`]);l.innerHTML=i.translateFn(n.text),o.appendChild(l)}}}function Ne(e,t,n){var c,a,l,h,f,g,d,u,p,m,x,b,v,S,_;if(e.innerHTML="",e.className=`${(c=n.config.class)!=null?c:""} ${n.config.classPrefix} ${n.config.animationClass}`,!n.config.arrow.disable&&((a=n.activeStep)!=null&&a.hasHost)){const w=T("div",[(l=n.config.arrow.class)!=null?l:"",`${n.config.classPrefix}-arrow`]);e.appendChild(w)}(h=t.customization)!=null&&h.class&&e.classList.add(t.customization.class);const i=T("div",[`${n.config.classPrefix}-header`,`${(g=(f=t.customization)==null?void 0:f.headerClass)!=null?g:""}`]);e.appendChild(i);const o=T("h1",[`${n.config.classPrefix}-title`,`${(u=(d=t.customization)==null?void 0:d.titleClass)!=null?u:""}`]);o.innerHTML=n.config.translateFn((p=t.title)!=null?p:""),i.appendChild(o),n.config.close.button&&(n.config.closeIcon.onclick=n.complete.bind(n),i.appendChild(n.config.closeIcon));const s=T("div",[`${n.config.classPrefix}-content`,`${(x=(m=t.customization)==null?void 0:m.contentClass)!=null?x:""}`]);e.appendChild(s);const r=T("div",[`${n.config.classPrefix}-footer`,`${(v=(b=t.customization)==null?void 0:b.footerClass)!=null?v:""}`]);if(V(t.buttonList)&&(t.buttonList=Be(n)),t.buttonList.forEach(w=>{var I;const C=[`${n.config.classPrefix}-button`,(I=w.class)!=null?I:""];V(w.type)||w.type==="secondary"?C.push(`${n.config.classPrefix}-button-secondary`):w.type==="primary"?C.push(`${n.config.classPrefix}-button-primary`):w.type==="link"&&C.push(`${n.config.classPrefix}-button-link`),!V(w.class)&&w.class!==""&&C.push(w.class);const L=T("button",C);L.innerHTML=n.config.translateFn(w.text),L.onclick=F=>{w.action.call(n)},r.appendChild(L)}),!n.config.progress.disable&&n.config.progress.text&&E(n.activeStepIndex)){const w=T("p",[`${n.config.classPrefix}-progress`,`${(_=(S=t.customization)==null?void 0:S.progressClass)!=null?_:""}`]);w.innerHTML=n.config.translateFn(Fe(n.config.progress.text,n.activeStepIndex+1,n.stepList.length)),r.appendChild(w)}e.appendChild(r)}function Be(e){return[{text:"Back",action:e.prev},{text:"Next",type:"primary",action:e.next}]}function Fe(e,t,n){return e.replace("{{currentStep}}",t.toString()).replace("{{totalSteps}}",n.toString())}class He{constructor(){y(this,"_renderContentStrategy",new Map);y(this,"_staticSides",{top:"bottom",right:"left",bottom:"top",left:"right"});this.setUpStrategies()}render(t,n){return new Promise(i=>{var o,s;if(!this._renderContentStrategy.has(n.popupData.type))throw new Error("Missing popup creator strategy");t.style.display="none",t.classList.remove(n.tour.config.animationClass),n.hostElement?t.style.position=qt(n.hostElement):t.style.position="fixed",Ne(t,n.popupData,n.tour),(o=this._renderContentStrategy.get(n.popupData.type))==null||o.renderContent(t,n.popupData,n.tour.config),(s=n.hostElement)==null||s.scrollIntoView(n.tour.config.scrollTo),i()}).then(()=>n.isFirst&&n.direction==="toNext"?kt(0):kt(400)).then(()=>{t.style.display="flex",this.updatePosition(t,n),t.classList.add(n.tour.config.animationClass)})}updatePosition(t,n){E(n.hostElement)?this.renderFloatingPopup(t,n):this.renderCenterPopup(t)}renderFloatingPopup(t,n){var l;const i=t.style.position==="fixed"?window.scrollY||document.documentElement.scrollTop:0,o=t.querySelector(`.${n.tour.config.classPrefix}-arrow`),s=[],r=E(n.popupData.position)&&n.popupData.position!=="auto"?n.popupData.position:void 0,c=(l=o==null?void 0:o.offsetWidth)!=null?l:10,a=Math.sqrt(2*Lt(c,2))/2+n.tour.config.highlight.padding;s.push(Re(a)),(n.popupData.position==="auto"||V(r))&&s.push(Oe()),!n.tour.config.arrow.disable&&E(o)&&s.push($e({element:o})),Ae(n.hostElement,t,{placement:r,middleware:[...s]}).then(({x:h,y:f,middlewareData:g,placement:d})=>{Object.assign(t.style,{top:`${f-i}px`,left:`${h}px`,marginTop:"0",marginLeft:"0"});const u=d.split("-")[0],p=this._staticSides[u];if(g.arrow&&E(o)){const{x:m,y:x}=g.arrow;Object.assign(o.style,{left:m!=null?`${m}px`:"",top:x!=null?`${x}px`:"",right:"",bottom:"",[p]:`${-c/2}px`,transform:"rotate(45deg)"})}})}renderCenterPopup(t){Object.assign(t.style,{top:"50%",left:"50%",marginTop:`-${t.clientHeight/2}px`,marginLeft:`-${t.clientWidth/2}px`})}setUpStrategies(){this._renderContentStrategy.set("text",new ke),this._renderContentStrategy.set("custom",new De)}}class Nt{render(t,n){return new Promise(i=>{n.hostElement&&(t.style.position=qt(n.hostElement)),i()}).then(()=>{this.updatePosition(t,n)})}updatePosition(t,n){var r,c;if(!n.hostElement){t.style.width="0",t.style.height="0",t.style.top="50%",t.style.left="50%",t.style.transform="translate(-50%, -50%)",t.style.opacity="0";return}const i=n.hostElement.getBoundingClientRect(),o=(c=(r=n.tour.config.highlight)==null?void 0:r.padding)!=null?c:8,s=t.style.position==="fixed"?0:window.scrollY||document.documentElement.scrollTop;t.style.transform="",t.style.left=`${i.left-o}px`,t.style.top=`${i.top+s-o}px`,t.style.width=`${i.width+2*o}px`,t.style.height=`${i.height+2*o}px`,t.style.opacity="1"}}class Ut{constructor(t,n){y(this,"popupData");y(this,"tour");y(this,"_index");y(this,"_hostElement",null);y(this,"_direction","toNext");y(this,"_hostData");y(this,"_popupRenderer");y(this,"_highlightRenderer");y(this,"_intersectionRenderer");var i;this.popupData=n.popup,this.tour=t,this._index=(i=n.index)!=null?i:null,this._hostData=n.host,this._popupRenderer=t.popupRenderer,this._highlightRenderer=t.highlightRenderer,this._intersectionRenderer=t.intersectionRenderer}get isFirst(){return this._index===0}get nextStep(){var t;return(t=this.tour.stepList[this.tour.stepList.indexOf(this)+1])!=null?t:null}get prevStep(){var t;return(t=this.tour.stepList[this.tour.stepList.indexOf(this)-1])!=null?t:null}get direction(){return this._direction}get hasHost(){return E(this._hostElement)}get hostElement(){return this._hostElement}get index(){return this._index}set index(t){this._index=t}show(t){return $(this,null,function*(){var i;if(V(this.tour.popup))return;this._direction=t,this._hostData&&(this._hostElement=this.resolveHostElement(typeof this._hostData=="function"?this._hostData():(i=this._hostData)!=null?i:null));const n=[this._popupRenderer.render(this.tour.popup,this)];this.tour.config.intersection.disable&&E(this.tour.intersection)&&n.push(this._intersectionRenderer.render(this.tour.intersection,this)),!this.tour.config.highlight.disable&&!V(this.tour.highlight)&&n.push(this._highlightRenderer.render(this.tour.highlight,this)),this.tour.config.highlight.disable&&E(this.tour.highlight)&&this._highlightRenderer.render(this.tour.highlight,{}),yield Promise.all(n),this.toggleZIndex(!0)})}hide(){return $(this,null,function*(){this.toggleZIndex(!1)})}toggleZIndex(t){V(this._hostElement)||(t?this._hostElement.classList.add("siteguide-host"):this._hostElement.classList.remove("siteguide-host"))}resolveHostElement(t){return typeof this._hostData=="string"?document.querySelector(this._hostData):t}}function gt(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Kt(e,t){const n=O({},e);return gt(e)&>(t)&&Object.keys(t).forEach(i=>{const o=i,s=i;gt(t[o])?(s in e||Object.assign(n,{[s]:{}}),n[s]=Kt(e[s],t[o])):Object.assign(n,{[s]:t[o]})}),n}function Me(e){const t=T("button",[`${e}-close`]);return t.innerHTML="✖",t}class Ve{constructor(){y(this,"_activeTour",null)}get isActive(){return E(this.activeTour)}get activeTour(){return this._activeTour}setActiveTour(t){this._activeTour=t}}const nt=new Ve;class We{constructor(t){y(this,"popupRenderer",new He);y(this,"highlightRenderer",new Nt);y(this,"intersectionRenderer",new Nt);y(this,"_popup",null);y(this,"_highlight",null);y(this,"_intersection",null);y(this,"_stepList",[]);y(this,"_activeStep",null);y(this,"_bodyResizeObserver");y(this,"_config");y(this,"closeOnEsc",t=>{t.key==="Escape"&&this.complete()});y(this,"keyboardControl",t=>{t.key==="ArrowRight"?this.next():t.key==="ArrowLeft"&&this.prev()});var n,i,o,s,r,c,a,l,h,f,g,d,u,p,m,x,b,v,S,_,w,C,L,I,F,z;this._bodyResizeObserver=this.getBodyResizeObserver(),this._config={classPrefix:(n=t.classPrefix)!=null?n:"siteguide",class:"",animationClass:(i=t.animationClass)!=null?i:"siteguide-animation",close:{button:(s=(o=t.close)==null?void 0:o.button)!=null?s:!0,clickout:(c=(r=t.close)==null?void 0:r.clickout)!=null?c:!1,esc:(l=(a=t.close)==null?void 0:a.esc)!=null?l:!0},scrollTo:(h=t.scrollTo)!=null?h:{behavior:"smooth",block:"center",inline:"center"},closeIcon:(g=t.closeIcon)!=null?g:Me((f=t.classPrefix)!=null?f:"siteguide"),arrow:{disable:(u=(d=t.arrow)==null?void 0:d.disable)!=null?u:!1,class:(m=(p=t.arrow)==null?void 0:p.class)!=null?m:""},highlight:{disable:(b=(x=t.highlight)==null?void 0:x.disable)!=null?b:!1,padding:(S=(v=t.highlight)==null?void 0:v.padding)!=null?S:8,class:(w=(_=t.highlight)==null?void 0:_.class)!=null?w:""},progress:{disable:(L=(C=t.progress)==null?void 0:C.disable)!=null?L:!0,text:"Step {{currentStep}} of {{totalSteps}}"},intersection:{disable:(I=t.intersection.disable)!=null?I:!1},keyboardControl:(F=t.keyboardControl)!=null?F:!1,translateFn:(z=t.translateFn)!=null?z:P=>P}}get stepList(){return this._stepList}get config(){return this._config}get popup(){return this._popup}get highlight(){return this._highlight}get intersection(){return this._intersection}get activeStep(){return this._activeStep}get activeStepIndex(){return this._activeStep?this.stepList.indexOf(this._activeStep):null}addStep(t){if(V(t.index)){const i=this._stepList.reduce((o,s)=>s.index!==null&&s.index!==void 0&&s.index>o?s.index:o,-1);t.index=i+1}const n=new Ut(this,t);this._stepList.push(n),this._stepList.sort((i,o)=>i.index-o.index)}addSteps(t){t.forEach(n=>this.addStep(n))}removeStep(t){this._stepList=this._stepList.filter(n=>t!==n.index)}start(){nt.isActive||(this.config.close.esc&&document.addEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.addEventListener("keydown",this.keyboardControl),nt.setActiveTour(this),this._popup=T("div",[this._config.classPrefix]),document.body.appendChild(this._popup),this._config.highlight.disable||(this._highlight=T("div",[this._config.highlight.class,`${this._config.classPrefix}-highlight`]),document.body.appendChild(this._highlight)),this._config.intersection.disable&&(this._intersection=T("div",["siteguide-intersection"]),document.body.appendChild(this._intersection)),this.next())}complete(){var t;this._popup&&document.body.removeChild(this._popup),this._highlight&&document.body.removeChild(this._highlight),(t=this._activeStep)==null||t.hide(),this._activeStep=null,nt.setActiveTour(null),this.config.close.esc&&document.removeEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.removeEventListener("keydown",this.keyboardControl)}prev(){const t=E(this._activeStep)?this._stepList.indexOf(this._activeStep)-1:this._stepList.indexOf(this._stepList[this._stepList.length-1]);if(t<0){this.complete();return}this.changeStepTo(t,"fromBack")}next(){return $(this,null,function*(){var n,i,o;const t=E(this._activeStep)?this._stepList.indexOf(this._activeStep)+1:this._stepList.indexOf(this._stepList[0]);if(t>=this._stepList.length){this.complete();return}E((n=this._activeStep)==null?void 0:n.popupData.allowNext)&&!((o=yield(i=this._activeStep)==null?void 0:i.popupData.allowNext.call(this))==null||o)||this.changeStepTo(t,"toNext")})}goTo(t){var n;if(t>this._stepList.length-1){console.error("Provided index was larger than steps amount");return}this.changeStepTo(t,t>((n=this.activeStepIndex)!=null?n:-1)?"toNext":"fromBack")}setConfig(t){this._config=Kt(this._config,t)}changeStepTo(t,n){var i;(i=this._activeStep)==null||i.hide(),this._activeStep=this._stepList[t],this._activeStep.show(n)}getBodyResizeObserver(){const t=new ResizeObserver(()=>{this._activeStep&&(E(this._popup)&&this.popupRenderer.updatePosition(this._popup,this._activeStep),E(this._highlight)&&!this.config.highlight.disable&&this.highlightRenderer.updatePosition(this._highlight,this._activeStep))});return t.observe(document.body),t}}const Ie=nt;exports.Siteguide=Ie;exports.Tour=We;exports.TourStep=Ut;exports.createElement=T;
|