siteguide.js 0.8.2 → 0.8.3

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.
@@ -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: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}
1
+ :root{--sg-bg: var(--sg-mono-100);--sg-text: var(--sg-mono-900);--sg-line: var(--sg-mono-500);--sg-primary: #2e62d9;--sg-primary-hover: #2ca2fd;--sg-secondary: #2ca2fd;--sg-secondary-hover: #2ca2fd;--sg-danger: #ff3b30;--sg-success: #52b52f;--sg-attention: #ffa900;--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;--sg-padding-s: 8px;--sg-padding-m: 12px;--sg-padding-l: 16px;--sg-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(--sg-padding-m) var(--sg-padding-2l) 0;font-family:inherit}.siteguide-content{width:100%;padding:var(--sg-padding-m) var(--sg-padding-2l);overflow-y:auto;font-family:inherit}.siteguide-content::-webkit-scrollbar{width:4px}.siteguide-content::-webkit-scrollbar-thumb{background-color:var(--sg-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(--sg-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(--sg-padding-m);border-top:1px solid var(--sg-line);gap:var(--sg-padding-l);margin-top:auto}.siteguide-button{padding:var(--sg-padding-s) var(--sg-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(--sg-secondary)}.siteguide-button-secondary:hover{background-color:var(--sg-secondary-hover)}.siteguide-button-primary{background-color:var(--sg-primary)}.siteguide-button-primary:hover{background-color:var(--sg-primary-hover)}.siteguide-button-link{color:var(--sg-primary);background-color:transparent;cursor:pointer;transition:color .3s ease-out}.siteguide-button-link:hover{color:var(--sg-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(--sg-secondary-hover);color:#fff}.siteguide-host{z-index:1000001!important;position:relative;isolation:isolate}
package/dist/index.d.ts CHANGED
@@ -185,15 +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
+ get interaction(): HTMLElement | null;
189
189
  get activeStep(): TourStep | null;
190
190
  get activeStepIndex(): number | null;
191
191
  readonly popupRenderer: IRenderer;
192
192
  readonly highlightRenderer: IRenderer;
193
- readonly intersectionRenderer: IRenderer;
193
+ readonly interactionRenderer: IRenderer;
194
194
  private _popup;
195
195
  private _highlight;
196
- private _intersection;
196
+ private _interaction;
197
197
  private _stepList;
198
198
  private _activeStep;
199
199
  private _bodyResizeObserver;
@@ -258,6 +258,22 @@ export declare type TourConfig = {
258
258
  * @default ''
259
259
  */
260
260
  class?: string;
261
+ /**
262
+ * Tour buttons configuration
263
+ *
264
+ */
265
+ buttons?: {
266
+ /**
267
+ * Next button default text
268
+ * @default 'Next'
269
+ */
270
+ nextText?: string;
271
+ /**
272
+ * Prev button default text
273
+ * @default 'Back'
274
+ */
275
+ prevText?: string;
276
+ };
261
277
  /**
262
278
  * Add the way to allow close
263
279
  */
@@ -366,8 +382,6 @@ export declare type TourConfig = {
366
382
 
367
383
  export declare class TourStep {
368
384
  get isFirst(): boolean;
369
- get nextStep(): TourStep | null;
370
- get prevStep(): TourStep | null;
371
385
  get direction(): StepDirection;
372
386
  get hasHost(): boolean;
373
387
  get hostElement(): HTMLElement | null;
@@ -379,13 +393,10 @@ export declare class TourStep {
379
393
  private _hostElement;
380
394
  private _direction;
381
395
  private readonly _hostData;
382
- private readonly _popupRenderer;
383
- private readonly _highlightRenderer;
384
- private readonly _intersectionRenderer;
385
396
  constructor(tour: Tour, config: TourStepConfig);
386
397
  show(direction: StepDirection): Promise<void>;
387
398
  hide(): Promise<void>;
388
- private toggleZIndex;
399
+ private toggleHostClass;
389
400
  private resolveHostElement;
390
401
  }
391
402
 
package/dist/index.js CHANGED
@@ -1 +1 @@
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,$=(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 A=(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 $({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)=>A(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($({},d),{[m]:$($({},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 A(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 A(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],L=yield c.getOffsetParent==null?void 0:c.getOffsetParent(h);let P=L?L[S]:0;(!P||!(yield c.isElement==null?void 0:c.isElement(L)))&&(P=a.floating[S]||r.floating[p]);const I=_/2-w/2,F=P/2-m[p]/2-1,z=Z(g[b],F),C=Z(g[v],F),O=z,tt=P-m[p]-C,H=P/2-m[p]/2+I,at=ee(O,H,tt),ft=!l.arrow&&M(s)!=null&&H!==at&&r.reference[p]/2-(H<O?z:C)-m[p]/2<0,ht=ft?H<O?H-O:H-tt:0;return{[u]:d[u]+ht,data:$({[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 A(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:_}],L=m[b+1];if(L)return{data:{index:b+1,overflows:w},reset:{placement:L}};const P=w.map(C=>{const O=M(C.placement);return[C.placement,O&&f?C.overflows.slice(0,2).reduce((tt,H)=>tt+H,0):C.overflows[0],C.overflows]}).sort((C,O)=>C[1]-O[1]),F=((s=P.filter(C=>C[2].slice(0,M(C[0])?2:3).every(O=>O<=0))[0])==null?void 0:s[0])||P[0][0];return F!==a?{data:{index:b+1,overflows:w},reset:{placement:F}}:{}})}}};function he(e,t){return A(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 A(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($({},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 D(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}=k(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=D(e)?k(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 k(e){return R(e).getComputedStyle(e)}function lt(e){return D(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=k(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 D(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?D(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&&D(i)?R(i):i;let u=g,p=mt(u);for(;p&&i&&d!==u;){const m=q(p),x=p.getBoundingClientRect(),b=k(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 k(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(D(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||!D(n)||U(n)?!1:k(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=>D(c)&&K(c)!=="body"),o=null;const s=k(e).position==="fixed";let r=s?j(e):e;for(;D(r)&&!U(r);){const c=k(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 k(e).position==="static"}function Dt(e,t){if(!B(e)||k(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(D(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 A(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 k(e).direction==="rtl"}const Ee={convertOffsetParentRelativeRectToViewportRelativeRect:xe,getDocumentElement:W,getClippingRect:Se,getOffsetParent:jt,getElementRects:Pe,getClientRects:ye,getDimensions:Ce,getScale:q,isElement:D,isRTL:Te},Re=de,Oe=fe,$e=le,Ae=(e,t,n)=>{const i=new Map,o=$({platform:Ee},n),s=X($({},o.platform),{_c:i});return re(e,t,X($({},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 L=[`${n.config.classPrefix}-button`,(I=w.class)!=null?I:""];V(w.type)||w.type==="secondary"?L.push(`${n.config.classPrefix}-button-secondary`):w.type==="primary"?L.push(`${n.config.classPrefix}-button-primary`):w.type==="link"&&L.push(`${n.config.classPrefix}-button-link`),!V(w.class)&&w.class!==""&&L.push(w.class);const P=T("button",L);P.innerHTML=n.config.translateFn(w.text),P.onclick=F=>{w.action.call(n)},r.appendChild(P)}),!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 A(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.interaction.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 A(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=$({},e);return gt(e)&&gt(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,L,P,I,F,z,C;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:(P=(L=t.progress)==null?void 0:L.disable)!=null?P:!0,text:"Step {{currentStep}} of {{totalSteps}}"},interaction:{disable:(F=(I=t.interaction)==null?void 0:I.disable)!=null?F:!1},keyboardControl:(z=t.keyboardControl)!=null?z:!1,translateFn:(C=t.translateFn)!=null?C:O=>O}}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.interaction.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 A(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;
1
+ "use strict";var Kt=Object.defineProperty,Xt=Object.defineProperties;var Gt=Object.getOwnPropertyDescriptors;var it=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable;var Pt=Math.pow,dt=(e,t,n)=>t in e?Kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))Ct.call(t,n)&&dt(e,n,t[n]);if(it)for(var n of it(t))Tt.call(t,n)&&dt(e,n,t[n]);return e},Q=(e,t)=>Xt(e,Gt(t));var Et=(e,t)=>{var n={};for(var i in e)Ct.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&it)for(var i of it(e))t.indexOf(i)<0&&Tt.call(e,i)&&(n[i]=e[i]);return n};var b=(e,t,n)=>dt(e,typeof t!="symbol"?t+"":t,n);var D=(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"],Lt=["start","end"],Ot=Jt.reduce((e,t)=>e.concat(t,t+"-"+Lt[0],t+"-"+Lt[1]),[]),Z=Math.min,U=Math.max,st=Math.round,B=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 U(e,Z(t,n))}function ct(e,t){return typeof e=="function"?e(t):e}function et(e){return e.split("-")[0]}function M(e){return e.split("-")[1]}function ee(e){return e==="x"?"y":"x"}function xt(e){return e==="y"?"height":"width"}function yt(e){return["top","bottom"].includes(et(e))?"y":"x"}function wt(e){return ee(yt(e))}function ne(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 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 A({top:0,right:0,bottom:0,left:0},e)}function Bt(e){return typeof e!="number"?oe(e):{top:e,right:e,bottom:e,left:e}}function rt(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 $t(e,t,n){let{reference:i,floating:o}=e;const s=yt(t),r=wt(t),c=xt(r),a=et(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 se=(e,t,n)=>D(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}=$t(l,i,a),g=i,d={},u=0;for(let p=0;p<c.length;p++){const{name:m,fn:x}=c[p],{x:_,y:w,data:S,reset:v}=yield x({x:h,y:f,initialPlacement:i,placement:g,strategy:o,middlewareData:d,rects:l,platform:r,elements:{reference:e,floating:t}});h=_!=null?_:h,f=w!=null?w:f,d=Q(A({},d),{[m]:A(A({},d[m]),S)}),v&&u<=50&&(u++,typeof v=="object"&&(v.placement&&(g=v.placement),v.rects&&(l=v.rects===!0?yield r.getElementRects({reference:e,floating:t,strategy:o}):v.rects),{x:h,y:f}=$t(l,g,a)),p=-1)}return{x:h,y:f,placement:g,strategy:o,middlewareData:d}});function re(e,t){return D(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}=ct(t,e),u=Bt(d),m=c[g?f==="floating"?"reference":"floating":f],x=rt(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})),_=f==="floating"?{x:i,y:o,width:r.floating.width,height:r.floating.height}:r.reference,w=yield s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating),S=(yield s.isElement==null?void 0:s.isElement(w))?(yield s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},v=rt(s.convertOffsetParentRelativeRectToViewportRelativeRect?yield s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:_,offsetParent:w,strategy:a}):_);return{top:(x.top-v.top+u.top)/S.y,bottom:(v.bottom-x.bottom+u.bottom)/S.y,left:(x.left-v.left+u.left)/S.x,right:(v.right-x.right+u.right)/S.x}})}const ce=e=>({name:"arrow",options:e,fn(n){return D(this,null,function*(){const{x:i,y:o,placement:s,rects:r,platform:c,elements:a,middlewareData:l}=n,{element:h,padding:f=0}=ct(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",_=x?"top":"left",w=x?"bottom":"right",S=x?"clientHeight":"clientWidth",v=r.reference[p]+r.reference[u]-d[u]-r.floating[p],y=d[u]-r.reference[u],T=yield c.getOffsetParent==null?void 0:c.getOffsetParent(h);let P=T?T[S]:0;(!P||!(yield c.isElement==null?void 0:c.isElement(T)))&&(P=a.floating[S]||r.floating[p]);const z=v/2-y/2,H=P/2-m[p]/2-1,I=Z(g[_],H),C=Z(g[w],H),O=I,Y=P-m[p]-C,$=P/2-m[p]/2+z,q=te(O,$,Y),J=!l.arrow&&M(s)!=null&&$!==q&&r.reference[p]/2-($<O?I:C)-m[p]/2<0,ht=J?$<O?$-O:$-Y:0;return{[u]:d[u]+ht,data:A({[u]:q,centerOffset:$-q-ht},J&&{alignmentOffset:ht}),reset:J}})}});function le(e,t,n){return(e?[...n.filter(o=>M(o)===e),...n.filter(o=>M(o)!==e)]:n.filter(o=>et(o)===o)).filter(o=>e?M(o)===e||(t?ie(o)!==o:!1):!0)}const ae=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,fn(n){return D(this,null,function*(){var i,o,s;const{rects:r,middlewareData:c,placement:a,platform:l,elements:h}=n,I=ct(e,n),{crossAxis:f=!1,alignment:g,allowedPlacements:d=Ot,autoAlignment:u=!0}=I,p=Et(I,["crossAxis","alignment","allowedPlacements","autoAlignment"]),m=g!==void 0||d===Ot?le(g||null,u,d):d,x=yield re(n,p),_=((i=c.autoPlacement)==null?void 0:i.index)||0,w=m[_];if(w==null)return{};const S=ne(w,r,yield l.isRTL==null?void 0:l.isRTL(h.floating));if(a!==w)return{reset:{placement:m[0]}};const v=[x[et(w)],x[S[0]],x[S[1]]],y=[...((o=c.autoPlacement)==null?void 0:o.overflows)||[],{placement:w,overflows:v}],T=m[_+1];if(T)return{data:{index:_+1,overflows:y},reset:{placement:T}};const P=y.map(C=>{const O=M(C.placement);return[C.placement,O&&f?C.overflows.slice(0,2).reduce((Y,$)=>Y+$,0):C.overflows[0],C.overflows]}).sort((C,O)=>C[1]-O[1]),H=((s=P.filter(C=>C[2].slice(0,M(C[0])?2:3).every(O=>O<=0))[0])==null?void 0:s[0])||P[0][0];return H!==a?{data:{index:_+1,overflows:y},reset:{placement:H}}:{}})}}};function fe(e,t){return D(this,null,function*(){const{placement:n,platform:i,elements:o}=e,s=yield i.isRTL==null?void 0:i.isRTL(o.floating),r=et(n),c=M(n),a=yt(n)==="y",l=["left","top"].includes(r)?-1:1,h=s&&a?-1:1,f=ct(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 he=function(e){return e===void 0&&(e=0),{name:"offset",options:e,fn(n){return D(this,null,function*(){var i,o;const{x:s,y:r,placement:c,middlewareData:a}=n,l=yield fe(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:Q(A({},l),{placement:c})}})}}};function lt(){return typeof window!="undefined"}function G(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 lt()?e instanceof Node||e instanceof R(e).Node:!1}function k(e){return lt()?e instanceof Element||e instanceof R(e).Element:!1}function F(e){return lt()?e instanceof HTMLElement||e instanceof R(e).HTMLElement:!1}function At(e){return!lt()||typeof ShadowRoot=="undefined"?!1:e instanceof ShadowRoot||e instanceof R(e).ShadowRoot}function nt(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=N(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function de(e){return["table","td","th"].includes(G(e))}function at(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch(n){return!1}})}function vt(e){const t=bt(),n=k(e)?N(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 ue(e){let t=j(e);for(;F(t)&&!X(t);){if(vt(t))return t;if(at(t))return null;t=j(t)}return null}function bt(){return typeof CSS=="undefined"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function X(e){return["html","body","#document"].includes(G(e))}function N(e){return R(e).getComputedStyle(e)}function ft(e){return k(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function j(e){if(G(e)==="html")return e;const t=e.assignedSlot||e.parentNode||At(e)&&e.host||W(e);return At(t)?t.host:t}function Ht(e){const t=j(e);return X(t)?e.ownerDocument?e.ownerDocument.body:e.body:F(t)&&nt(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||[],nt(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=N(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=F(e),s=o?e.offsetWidth:n,r=o?e.offsetHeight:i,c=st(n)!==s||st(i)!==r;return c&&(n=s,i=r),{width:n,height:i,$:c}}function Vt(e){return k(e)?e:e.contextElement}function K(e){const t=Vt(e);if(!F(t))return B(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:s}=Mt(t);let r=(s?st(n.width):n.width)/i,c=(s?st(n.height):n.height)/o;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const ge=B(0);function Wt(e){const t=R(e);return!bt()||!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!==R(e)?!1:t}function tt(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Vt(e);let r=B(1);t&&(i?k(i)&&(r=K(i)):r=K(e));const c=pe(s,n,i)?Wt(s):B(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&&k(i)?R(i):i;let u=g,p=mt(u);for(;p&&i&&d!==u;){const m=K(p),x=p.getBoundingClientRect(),_=N(p),w=x.left+(p.clientLeft+parseFloat(_.paddingLeft))*m.x,S=x.top+(p.clientTop+parseFloat(_.paddingTop))*m.y;a*=m.x,l*=m.y,h*=m.x,f*=m.y,a+=w,l+=S,u=R(p),p=mt(u)}}return rt({width:h,height:f,x:a,y:l})}function _t(e,t){const n=ft(e).scrollLeft;return t?t.left+n:tt(W(e)).left+n}function zt(e,t,n){n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=i.left+t.scrollLeft-(n?0:_t(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=W(i),c=t?at(t.floating):!1;if(i===r||c&&s)return n;let a={scrollLeft:0,scrollTop:0},l=B(1);const h=B(0),f=F(i);if((f||!f&&!s)&&((G(i)!=="body"||nt(r))&&(a=ft(i)),F(i))){const d=tt(i);l=K(i),h.x=d.x+i.clientLeft,h.y=d.y+i.clientTop}const g=r&&!f&&!s?zt(r,a,!0):B(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 xe(e){return Array.from(e.getClientRects())}function ye(e){const t=W(e),n=ft(e),i=e.ownerDocument.body,o=U(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=U(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let r=-n.scrollLeft+_t(e);const c=-n.scrollTop;return N(i).direction==="rtl"&&(r+=U(t.clientWidth,i.clientWidth)-o),{width:o,height:s,x:r,y:c}}function we(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=bt();(!l||l&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}return{width:s,height:r,x:c,y:a}}function ve(e,t){const n=tt(e,!0,t==="fixed"),i=n.top+e.clientTop,o=n.left+e.clientLeft,s=F(e)?K(e):B(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 Dt(e,t,n){let i;if(t==="viewport")i=we(e,n);else if(t==="document")i=ye(W(e));else if(k(t))i=ve(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 rt(i)}function It(e,t){const n=j(e);return n===t||!k(n)||X(n)?!1:N(n).position==="fixed"||It(n,t)}function be(e,t){const n=t.get(e);if(n)return n;let i=pt(e,[],!1).filter(c=>k(c)&&G(c)!=="body"),o=null;const s=N(e).position==="fixed";let r=s?j(e):e;for(;k(r)&&!X(r);){const c=N(r),a=vt(r);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||nt(r)&&!a&&It(e,r))?i=i.filter(h=>h!==r):o=c,r=j(r)}return t.set(e,i),i}function _e(e){let{element:t,boundary:n,rootBoundary:i,strategy:o}=e;const r=[...n==="clippingAncestors"?at(t)?[]:be(t,this._c):[].concat(n),i],c=r[0],a=r.reduce((l,h)=>{const f=Dt(t,h,o);return l.top=U(f.top,l.top),l.right=Z(f.right,l.right),l.bottom=Z(f.bottom,l.bottom),l.left=U(f.left,l.left),l},Dt(t,c,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}=Mt(e);return{width:t,height:n}}function Ce(e,t,n){const i=F(t),o=W(t),s=n==="fixed",r=tt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=B(0);if(i||!i&&!s)if((G(t)!=="body"||nt(o))&&(c=ft(t)),i){const g=tt(t,!0,s,t);a.x=g.x+t.clientLeft,a.y=g.y+t.clientTop}else o&&(a.x=_t(o));const l=o&&!i&&!s?zt(o,c):B(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 N(e).position==="static"}function kt(e,t){if(!F(e)||N(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(at(e))return n;if(!F(e)){let o=j(e);for(;o&&!X(o);){if(k(o)&&!ut(o))return o;o=j(o)}return n}let i=kt(e,t);for(;i&&de(i)&&ut(i);)i=kt(i,t);return i&&X(i)&&ut(i)&&!vt(i)?n:i||ue(e)||n}const Te=function(e){return D(this,null,function*(){const t=this.getOffsetParent||jt,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 N(e).direction==="rtl"}const Ee={convertOffsetParentRelativeRectToViewportRelativeRect:me,getDocumentElement:W,getClippingRect:_e,getOffsetParent:jt,getElementRects:Te,getClientRects:xe,getDimensions:Se,getScale:K,isElement:k,isRTL:Pe},Le=he,Oe=ae,Re=ce,$e=(e,t,n)=>{const i=new Map,o=A({platform:Ee},n),s=Q(A({},o.platform),{_c:i});return se(e,t,Q(A({},o),{platform:s}))};function V(e){return e===null||typeof e=="undefined"}function L(e){return!V(e)}function Nt(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 St(e){return Yt(e)?"fixed":"absolute"}class Ae{renderContent(t,n,i){t.querySelector(`.${i.classPrefix}-content`).appendChild(n.node)}}function E(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,c,a;const o=t.querySelector(`.${i.classPrefix}-content`);if(n.imgSrc){const l=E("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=E("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 ke(e,t,n){var c,a,l,h,f,g,d,u,p,m,x,_,w,S,v;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 y=E("div",[(l=n.config.arrow.class)!=null?l:"",`${n.config.classPrefix}-arrow`]);e.appendChild(y)}(h=t.customization)!=null&&h.class&&e.classList.add(t.customization.class);const i=E("div",[`${n.config.classPrefix}-header`,`${(g=(f=t.customization)==null?void 0:f.headerClass)!=null?g:""}`]);e.appendChild(i);const o=E("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=E("div",[`${n.config.classPrefix}-content`,`${(x=(m=t.customization)==null?void 0:m.contentClass)!=null?x:""}`]);e.appendChild(s);const r=E("div",[`${n.config.classPrefix}-footer`,`${(w=(_=t.customization)==null?void 0:_.footerClass)!=null?w:""}`]);if(V(t.buttonList)&&(t.buttonList=Ne(n)),t.buttonList.forEach(y=>{var z;const T=[`${n.config.classPrefix}-button`,(z=y.class)!=null?z:""];V(y.type)||y.type==="secondary"?T.push(`${n.config.classPrefix}-button-secondary`):y.type==="primary"?T.push(`${n.config.classPrefix}-button-primary`):y.type==="link"&&T.push(`${n.config.classPrefix}-button-link`),!V(y.class)&&y.class!==""&&T.push(y.class);const P=E("button",T);P.innerHTML=n.config.translateFn(y.text),P.onclick=H=>{y.action.call(n)},r.appendChild(P)}),!n.config.progress.disable&&n.config.progress.text&&L(n.activeStepIndex)){const y=E("p",[`${n.config.classPrefix}-progress`,`${(v=(S=t.customization)==null?void 0:S.progressClass)!=null?v:""}`]);y.innerHTML=n.config.translateFn(Be(n.config.progress.text,n.activeStepIndex+1,n.stepList.length)),r.appendChild(y)}e.appendChild(r)}function Ne(e){return[{text:e.config.buttons.prevText,action:e.prev},{text:e.config.buttons.nextText,type:"primary",action:e.next}]}function Be(e,t,n){return e.replace("{{currentStep}}",t.toString()).replace("{{totalSteps}}",n.toString())}class Fe{constructor(){b(this,"_renderContentStrategy",new Map);b(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=St(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"?Nt(0):Nt(400)).then(()=>{t.style.display="flex",this.updatePosition(t,n),t.classList.add(n.tour.config.animationClass)})}updatePosition(t,n){L(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=L(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*Pt(c,2))/2+n.tour.config.highlight.padding;s.push(Le(a)),(n.popupData.position==="auto"||V(r))&&s.push(Oe()),!n.tour.config.arrow.disable&&L(o)&&s.push(Re({element:o})),$e(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&&L(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 De),this._renderContentStrategy.set("custom",new Ae)}}class He{render(t,n){return new Promise(i=>{n.hostElement&&(t.style.position=St(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 Me{render(t,n){return new Promise(i=>{n.hostElement&&(t.style.position=St(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%)";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`}}class qt{constructor(t,n){b(this,"popupData");b(this,"tour");b(this,"_index");b(this,"_hostElement",null);b(this,"_direction","toNext");b(this,"_hostData");var i;this.popupData=n.popup,this.tour=t,this._index=(i=n.index)!=null?i:null,this._hostData=n.host}get isFirst(){return this.tour.stepList.indexOf(this)===0}get direction(){return this._direction}get hasHost(){return L(this._hostElement)}get hostElement(){return this._hostElement}get index(){return this._index}set index(t){this._index=t}show(t){return D(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.tour.popupRenderer.render(this.tour.popup,this)];!this.tour.config.interaction.disable&&L(this.tour.interaction)&&n.push(this.tour.interactionRenderer.render(this.tour.interaction,this)),!this.tour.config.highlight.disable&&!V(this.tour.highlight)&&n.push(this.tour.highlightRenderer.render(this.tour.highlight,this)),this.tour.config.highlight.disable&&L(this.tour.highlight)&&this.tour.highlightRenderer.render(this.tour.highlight,{}),yield Promise.all(n),this.toggleHostClass(!0)})}hide(){return D(this,null,function*(){this.toggleHostClass(!1)})}toggleHostClass(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 Ut(e,t){const n=A({},e);return gt(e)&&gt(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){const t=E("button",[`${e}-close`]);return t.innerHTML="✖",t}class We{constructor(){b(this,"_activeTour",null)}get isActive(){return L(this.activeTour)}get activeTour(){return this._activeTour}setActiveTour(t){this._activeTour=t}}const ot=new We;class ze{constructor(t){b(this,"popupRenderer",new Fe);b(this,"highlightRenderer",new He);b(this,"interactionRenderer",new Me);b(this,"_popup",null);b(this,"_highlight",null);b(this,"_interaction",null);b(this,"_stepList",[]);b(this,"_activeStep",null);b(this,"_bodyResizeObserver");b(this,"_config");b(this,"closeOnEsc",t=>{t.key==="Escape"&&this.complete()});b(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,_,w,S,v,y,T,P,z,H,I,C,O,Y,$,q;this._bodyResizeObserver=this.getBodyResizeObserver(),this._config={classPrefix:(n=t.classPrefix)!=null?n:"siteguide",class:"",buttons:{nextText:(o=(i=t.buttons)==null?void 0:i.nextText)!=null?o:"Next",prevText:(r=(s=t.buttons)==null?void 0:s.prevText)!=null?r:"Back"},animationClass:(c=t.animationClass)!=null?c:"siteguide-animation",close:{button:(l=(a=t.close)==null?void 0:a.button)!=null?l:!0,clickout:(f=(h=t.close)==null?void 0:h.clickout)!=null?f:!1,esc:(d=(g=t.close)==null?void 0:g.esc)!=null?d:!0},scrollTo:(u=t.scrollTo)!=null?u:{behavior:"smooth",block:"center",inline:"center"},closeIcon:(m=t.closeIcon)!=null?m:Ve((p=t.classPrefix)!=null?p:"siteguide"),arrow:{disable:(_=(x=t.arrow)==null?void 0:x.disable)!=null?_:!1,class:(S=(w=t.arrow)==null?void 0:w.class)!=null?S:""},highlight:{disable:(y=(v=t.highlight)==null?void 0:v.disable)!=null?y:!1,padding:(P=(T=t.highlight)==null?void 0:T.padding)!=null?P:8,class:(H=(z=t.highlight)==null?void 0:z.class)!=null?H:""},progress:{disable:(C=(I=t.progress)==null?void 0:I.disable)!=null?C:!0,text:"Step {{currentStep}} of {{totalSteps}}"},interaction:{disable:(Y=(O=t.interaction)==null?void 0:O.disable)!=null?Y:!1},keyboardControl:($=t.keyboardControl)!=null?$:!1,translateFn:(q=t.translateFn)!=null?q:J=>J}}get stepList(){return this._stepList}get config(){return this._config}get popup(){return this._popup}get highlight(){return this._highlight}get interaction(){return this._interaction}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 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(){ot.isActive||(this.config.close.esc&&document.addEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.addEventListener("keydown",this.keyboardControl),ot.setActiveTour(this),this._popup=E("div",[this._config.classPrefix]),document.body.appendChild(this._popup),this._config.highlight.disable||(this._highlight=E("div",[this._config.highlight.class,`${this._config.classPrefix}-highlight`]),document.body.appendChild(this._highlight)),this._config.interaction.disable||(this._interaction=E("div",["siteguide-intersection"]),document.body.appendChild(this._interaction)),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,ot.setActiveTour(null),this.config.close.esc&&document.removeEventListener("keydown",this.closeOnEsc),this.config.keyboardControl&&document.removeEventListener("keydown",this.keyboardControl)}prev(){const t=L(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 D(this,null,function*(){var n,i,o;const t=L(this._activeStep)?this._stepList.indexOf(this._activeStep)+1:this._stepList.indexOf(this._stepList[0]);if(t>=this._stepList.length){this.complete();return}L((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=Ut(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&&(L(this._popup)&&this.popupRenderer.updatePosition(this._popup,this._activeStep),L(this._highlight)&&!this.config.highlight.disable&&this.highlightRenderer.updatePosition(this._highlight,this._activeStep))});return t.observe(document.body),t}}const Ie=ot;exports.Siteguide=Ie;exports.Tour=ze;exports.TourStep=qt;exports.createElement=E;