UNPKG

ngx-joyride

Version:

[![npm version](https://badge.fury.io/js/ngx-joyride.svg)](https://badge.fury.io/js/ngx-joyride) [![Build Status](https://travis-ci.org/tnicola/ngx-joyride.svg?branch=master)](https://travis-ci.org/tnicola/ngx-joyride) [![codecov](https://codecov.io/gh/

17 lines (15 loc) 49.7 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("@angular/router"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("ngx-joyride",["exports","@angular/core","@angular/common","rxjs","@angular/router","rxjs/operators"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["ngx-joyride"]={},t.ng.core,t.ng.common,t.rxjs,t.ng.router,t.rxjs.operators)}(this,(function(t,e,i,o,r,n){"use strict";var s=function(){this.title=new o.ReplaySubject,this.text=new o.ReplaySubject},p="#3b5560",h="bottom",a=function(){},c={prev:o.of("prev"),next:o.of("next"),done:o.of("done"),close:o.of(null)},l=function(){function t(){this.themeColor=p,this.stepDefaultPosition=h,this.logsEnabled=!1,this.showCounter=!0,this.showPrevButton=!0,this.stepsOrder=[]}return t.prototype.setOptions=function(t){this.stepsOrder=t.steps,this.stepDefaultPosition=t.stepDefaultPosition?t.stepDefaultPosition:this.stepDefaultPosition,this.logsEnabled=void 0!==t.logsEnabled?t.logsEnabled:this.logsEnabled,this.showCounter=void 0!==t.showCounter?t.showCounter:this.showCounter,this.showPrevButton=void 0!==t.showPrevButton?t.showPrevButton:this.showPrevButton,this.themeColor=t.themeColor?t.themeColor:this.themeColor,this.firstStep=t.startWith,this.waitingTime=void 0!==t.waitingTime?t.waitingTime:1,void 0!==t.customTexts?this.setCustomText(t.customTexts):this.setCustomText(c)},t.prototype.getBackdropColor=function(){return this.hexToRgb(this.themeColor)},t.prototype.getThemeColor=function(){return this.themeColor},t.prototype.getStepDefaultPosition=function(){return this.stepDefaultPosition},t.prototype.getStepsOrder=function(){return this.stepsOrder},t.prototype.getFirstStep=function(){return this.firstStep},t.prototype.getWaitingTime=function(){return this.waitingTime},t.prototype.areLogsEnabled=function(){return this.logsEnabled},t.prototype.isCounterVisible=function(){return this.showCounter},t.prototype.isPrevButtonVisible=function(){return this.showPrevButton},t.prototype.getCustomTexts=function(){return this.customTexts},t.prototype.setCustomText=function(t){var e,i,o,r;e=t.prev?t.prev:c.prev,i=t.next?t.next:c.next,o=t.done?t.done:c.done,r=t.close?t.close:c.close,this.customTexts={prev:this.toObservable(e),next:this.toObservable(i),done:this.toObservable(o),close:this.toObservable(r)}},t.prototype.toObservable=function(t){return t instanceof o.Observable?t:o.of(t)},t.prototype.hexToRgb=function(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,o){return e+e+i+i+o+o}));var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?parseInt(e[1],16)+", "+parseInt(e[2],16)+", "+parseInt(e[3],16):null},t}();l.decorators=[{type:e.Injectable}];var d="ngx-joyride:::",u=function(){function t(t){this.optionService=t}return t.prototype.debug=function(t,e){void 0===e&&(e=""),this.optionService.areLogsEnabled()&&console.debug(d+t,e)},t.prototype.info=function(t,e){void 0===e&&(e=""),this.optionService.areLogsEnabled()&&console.info(d+t,e)},t.prototype.warn=function(t,e){void 0===e&&(e=""),this.optionService.areLogsEnabled()&&console.warn(d+t,e)},t.prototype.error=function(t,e){void 0===e&&(e=""),this.optionService.areLogsEnabled()&&console.error(d+t,e)},t}();u.decorators=[{type:e.Injectable}],u.ctorParameters=function(){return[{type:l}]}; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var f=function(t,e){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}Object.create;Object.create;var y,m=function(t){function e(i){var o=t.call(this,i)||this;return Object.setPrototypeOf(o,e.prototype),o}return g(e,t),e}(Error),v=function(t){function e(i){var o=t.call(this,i)||this;return Object.setPrototypeOf(o,e.prototype),o}return g(e,t),e}(Error),S=function(t){function e(i){var o=t.call(this,i)||this;return Object.setPrototypeOf(o,e.prototype),o}return g(e,t),e}(Error),b="@";(y=t.StepActionType||(t.StepActionType={})).NEXT="NEXT",y.PREV="PREV";var w=function(){function e(t,e){this.stepOptions=t,this.logger=e,this.tempSteps=[],this.currentStepIndex=-2,this.stepHasBeenModified=new o.Subject}return e.prototype.getFirstStepIndex=function(){var t=this.stepOptions.getFirstStep(),e=this.stepOptions.getStepsOrder().indexOf(t);return e<0&&(e=0,void 0!==t&&this.logger.warn("The step "+t+" does not exist. Check in your step list if it's present.")),e},e.prototype.init=function(){var t=this;this.logger.info("Initializing the steps array."),this.steps=[],this.currentStepIndex=this.getFirstStepIndex()-1,this.stepOptions.getStepsOrder().forEach((function(e){return t.steps.push({id:e,step:null})}))},e.prototype.addStep=function(t){if(this.tempSteps.filter((function(e){return e.name===t.name})).length>0){var e=this.tempSteps.findIndex((function(e){return e.name===t.name}));this.tempSteps[e]=t}else this.logger.info("Adding step "+t.name+" to the steps list."),this.tempSteps.push(t)},e.prototype.get=function(e){if(e===t.StepActionType.NEXT?this.currentStepIndex++:this.currentStepIndex--,this.currentStepIndex<0||this.currentStepIndex>=this.steps.length)throw new S("The first or last step of the tour cannot be found!");var i=this.getStepName(this.steps[this.currentStepIndex].id),o=this.tempSteps.findIndex((function(t){return t.name===i})),r=this.tempSteps[o];return this.steps[this.currentStepIndex].step=r,null==r&&this.logger.warn("Step "+this.steps[this.currentStepIndex].id+" not found in the DOM. Check if it's hidden by *ngIf directive."),r},e.prototype.getStepRoute=function(e){var i;return(i=e===t.StepActionType.NEXT?this.steps[this.currentStepIndex+1]?this.steps[this.currentStepIndex+1].id:null:this.steps[this.currentStepIndex-1]?this.steps[this.currentStepIndex-1].id:null)&&i.includes(b)?i.split(b)[1]:""},e.prototype.updatePosition=function(t,e){var i=this.getStepIndex(t);this.steps[i].step?(this.steps[i].step.position=e,this.stepHasBeenModified.next(this.steps[i].step)):this.logger.warn("Trying to modify the position of "+t+" to "+e+". Step not found!Is this step located in a different route?")},e.prototype.getStepNumber=function(t){return this.getStepIndex(t)+1},e.prototype.getStepsCount=function(){return this.stepOptions.getStepsOrder().length},e.prototype.getStepIndex=function(t){var e=this.steps.map((function(t){return t.id.includes(b)?t.id.split(b)[0]:t.id})).findIndex((function(e){return t===e}));if(-1===e)throw new m("The step with name: "+t+" does not exist in the step list.");return e},e.prototype.getStepName=function(t){return t&&t.includes(b)?t.split(b)[0]:t},e}();w.decorators=[{type:e.Injectable}],w.ctorParameters=function(){return[{type:l},{type:u}]};var C=function(){function t(t){this.platformId=t,this.fakeDocument={body:{},documentElement:{}},this.fakeWindow={document:this.fakeDocument,navigator:{}}}return t.prototype.getNativeWindow=function(){return i.isPlatformBrowser(this.platformId)?window:this.fakeWindow},t.prototype.getNativeDocument=function(){return i.isPlatformBrowser(this.platformId)?document:this.fakeDocument},t}();C.decorators=[{type:e.Injectable}],C.ctorParameters=function(){return[{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]};var x=function(){function t(){}return t.prototype.setPrevButton=function(t){this._prevButton=t},t.prototype.getPrevButton=function(){return this._prevButton},t.prototype.setNextButton=function(t){this._nextButton=t},t.prototype.getNextButton=function(){return this._nextButton},t.prototype.setDoneButton=function(t){this._doneButton=t},t.prototype.getDoneButton=function(){return this._doneButton},t.prototype.setCounter=function(t){this._counter=t},t.prototype.getCounter=function(){return this._counter},t}();x.decorators=[{type:e.Injectable}];var T="NO_POSITION",E=function(){function t(t,i,o,r,n,p){this.joyrideStepsContainer=t,this.viewContainerRef=i,this.domService=o,this.router=r,this.templateService=n,this.platformId=p,this.stepPosition=T,this.prev=new e.EventEmitter,this.next=new e.EventEmitter,this.done=new e.EventEmitter,this.subscriptions=[],this.windowRef=this.domService.getNativeWindow(),this.step=new s}return t.prototype.ngAfterViewInit=function(){if(i.isPlatformBrowser(this.platformId)){if(this.prevTemplate&&this.templateService.setPrevButton(this.prevTemplate),this.nextTemplate&&this.templateService.setNextButton(this.nextTemplate),this.doneTemplate&&this.templateService.setDoneButton(this.doneTemplate),this.counterTemplate&&this.templateService.setCounter(this.counterTemplate),this.step.position=this.stepPosition,this.step.targetViewContainer=this.viewContainerRef,this.setAsyncFields(this.step),this.step.stepContent=this.stepContent,this.step.stepContentParams=this.stepContentParams,this.step.nextClicked=this.next,this.step.prevCliked=this.prev,this.step.tourDone=this.done,!this.name)throw new m("All the steps should have the 'joyrideStep' property set with a custom name.");this.step.name=this.name,this.step.route="/"===this.router.url.substr(0,1)?this.router.url.substr(1):this.router.url,this.step.transformCssStyle=this.windowRef.getComputedStyle(this.viewContainerRef.element.nativeElement).transform,this.step.isElementOrAncestorFixed=this.isElementFixed(this.viewContainerRef.element)||this.isAncestorsFixed(this.viewContainerRef.element.nativeElement.parentElement),this.joyrideStepsContainer.addStep(this.step)}},t.prototype.ngOnChanges=function(t){(t.title||t.text)&&this.setAsyncFields(this.step)},t.prototype.isElementFixed=function(t){return"fixed"===this.windowRef.getComputedStyle(t.nativeElement).position},t.prototype.setAsyncFields=function(t){this.title instanceof o.Observable?this.subscriptions.push(this.title.subscribe((function(e){t.title.next(e)}))):t.title.next(this.title),this.text instanceof o.Observable?this.subscriptions.push(this.text.subscribe((function(e){t.text.next(e)}))):t.text.next(this.text)},t.prototype.isAncestorsFixed=function(t){if(!t||!t.parentElement)return!1;var e="fixed"===this.windowRef.getComputedStyle(t.parentElement).position;return"BODY"===t.nodeName?e:!!e||this.isAncestorsFixed(t.parentElement)},t.prototype.ngOnDestroy=function(){this.subscriptions.forEach((function(t){t.unsubscribe()}))},t}();E.decorators=[{type:e.Directive,args:[{selector:"joyrideStep, [joyrideStep]"}]}],E.ctorParameters=function(){return[{type:w},{type:e.ViewContainerRef},{type:C},{type:r.Router},{type:x},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]},E.propDecorators={name:[{type:e.Input,args:["joyrideStep"]}],nextStep:[{type:e.Input}],title:[{type:e.Input}],text:[{type:e.Input}],stepPosition:[{type:e.Input}],stepContent:[{type:e.Input}],stepContentParams:[{type:e.Input}],prevTemplate:[{type:e.Input}],nextTemplate:[{type:e.Input}],doneTemplate:[{type:e.Input}],counterTemplate:[{type:e.Input}],prev:[{type:e.Output}],next:[{type:e.Output}],done:[{type:e.Output}]};var P=function(){function t(t,e){if(this.DOMService=t,i.isPlatformBrowser(e)){this.setDocumentHeight();var o=t.getNativeDocument();o&&!o.elementsFromPoint&&(o.elementsFromPoint=this.elementsFromPoint.bind(this))}}return t.prototype.getElementFixedTop=function(t){return t.nativeElement.getBoundingClientRect().top},t.prototype.getElementFixedLeft=function(t){return t.nativeElement.getBoundingClientRect().left},t.prototype.getElementAbsoluteTop=function(t){var e=this.getScrollOffsets();return t.nativeElement.getBoundingClientRect().top+e.y},t.prototype.getElementAbsoluteLeft=function(t){var e=this.getScrollOffsets();return t.nativeElement.getBoundingClientRect().left+e.x},t.prototype.setDocumentHeight=function(){this.documentHeight=this.calculateDocumentHeight()},t.prototype.getDocumentHeight=function(){return this.documentHeight},t.prototype.isParentScrollable=function(t){return this.getFirstScrollableParent(t.nativeElement)!==this.DOMService.getNativeDocument().body},t.prototype.isElementBeyondOthers=function(t,e,i){var o=e?this.getElementFixedLeft(t):this.getElementAbsoluteLeft(t),r=e?this.getElementFixedTop(t):this.getElementAbsoluteTop(t),n=o+t.nativeElement.getBoundingClientRect().width-1,s=r+t.nativeElement.getBoundingClientRect().height-1,p=this.DOMService.getNativeDocument().elementsFromPoint(o,r),h=this.DOMService.getNativeDocument().elementsFromPoint(n,s);return 0===p.length&&0===h.length?1:this.getFirstElementWithoutKeyword(p,i)!==t.nativeElement||this.getFirstElementWithoutKeyword(h,i)!==t.nativeElement?2:3},t.prototype.scrollIntoView=function(t,e){var i=this.getFirstScrollableParent(t.nativeElement),o=e?this.getElementFixedTop(t):this.getElementAbsoluteTop(t);i!==this.DOMService.getNativeDocument().body?i.scrollTo?i.scrollTo(0,o-150):i.scrollTop=o-150:this.DOMService.getNativeWindow().scrollTo(0,o-150)},t.prototype.scrollToTheTop=function(t){var e=this.getFirstScrollableParent(t.nativeElement);e!==this.DOMService.getNativeDocument().body?e.scrollTo?e.scrollTo(0,0):e.scrollTop=0:this.DOMService.getNativeWindow().scrollTo(0,0)},t.prototype.scrollToTheBottom=function(t){var e=this.getFirstScrollableParent(t.nativeElement);e!==this.DOMService.getNativeDocument().body?e.scrollTo?e.scrollTo(0,this.DOMService.getNativeDocument().body.scrollHeight):e.scrollTop=e.scrollHeight-e.clientHeight:this.DOMService.getNativeWindow().scrollTo(0,this.DOMService.getNativeDocument().body.scrollHeight)},t.prototype.getFirstScrollableParent=function(t){var e=this,i=/(auto|scroll|overlay)/,o=function(t,i){return e.DOMService.getNativeWindow().getComputedStyle(t,null).getPropertyValue(i)},r=function(t){return t&&t!==e.DOMService.getNativeDocument().body?function(t){return i.test(o(t,"overflow")+o(t,"overflow-y")+o(t,"overflow-x"))}(t)?t:r(t.parentNode):e.DOMService.getNativeDocument().body};return r(t)},t.prototype.calculateDocumentHeight=function(){var t=this.DOMService.getNativeDocument();return Math.max(t.body.scrollHeight,t.documentElement.scrollHeight,t.body.offsetHeight,t.documentElement.offsetHeight,t.body.clientHeight,t.documentElement.clientHeight)},t.prototype.getScrollOffsets=function(){var t=this.DOMService.getNativeWindow(),e=this.DOMService.getNativeDocument();return null!=t.pageXOffset?{x:t.pageXOffset,y:t.pageYOffset}:"CSS1Compat"==e.compatMode?{x:e.documentElement.scrollLeft,y:e.documentElement.scrollTop}:{x:e.body.scrollLeft,y:e.body.scrollTop}},t.prototype.elementsFromPoint=function(t,e){var i=[],o=void 0;do{var r=this.DOMService.getNativeDocument().elementFromPoint(t,e);r&&o!==r?(o=r,i.push(o),o.style.pointerEvents="none"):o=!1}while(o);return i.forEach((function(t){return t.style.pointerEvents="all"})),i},t.prototype.getFirstElementWithoutKeyword=function(t,e){for(;t[0]&&t[0].classList.toString().includes(e);)t.shift();return t[0]},t}();P.decorators=[{type:e.Injectable}],P.ctorParameters=function(){return[{type:C},{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]}]};var k=function(){function t(t,e,i){this.documentService=t,this.optionsService=e,this.rendererFactory=i,this.lastXScroll=0,this.lastYScroll=0,this.setRenderer()}return t.prototype.setRenderer=function(){this.renderer=this.rendererFactory.createRenderer(null,null)},t.prototype.draw=function(t){this.elementRef=t.targetViewContainer,this.targetAbsoluteTop=this.getTargetTotalTop(t),this.targetAbsoluteLeft=this.getTargetTotalLeft(t),this.currentBackdropContainer=this.renderer.createElement("div"),this.renderer.addClass(this.currentBackdropContainer,"backdrop-container"),this.renderer.setStyle(this.currentBackdropContainer,"position","fixed"),this.renderer.setStyle(this.currentBackdropContainer,"top","0px"),this.renderer.setStyle(this.currentBackdropContainer,"left","0px"),this.renderer.setStyle(this.currentBackdropContainer,"width","100%"),this.renderer.setStyle(this.currentBackdropContainer,"height","100%"),this.renderer.setStyle(this.currentBackdropContainer,"z-index","1000"),this.renderer.setAttribute(this.currentBackdropContainer,"id","backdrop-"+t.name),this.backdropContent=this.renderer.createElement("div"),this.renderer.addClass(this.backdropContent,"backdrop-content"),this.renderer.setStyle(this.backdropContent,"position","relative"),this.renderer.setStyle(this.backdropContent,"height","100%"),this.renderer.setStyle(this.backdropContent,"display","flex"),this.renderer.setStyle(this.backdropContent,"flex-direction","column"),this.renderer.appendChild(this.currentBackdropContainer,this.backdropContent),this.backdropTop=this.renderer.createElement("div"),this.renderer.addClass(this.backdropTop,"joyride-backdrop"),this.renderer.addClass(this.backdropTop,"backdrop-top"),this.renderer.setStyle(this.backdropTop,"width","100%"),this.renderer.setStyle(this.backdropTop,"height",this.targetAbsoluteTop-this.lastYScroll+"px"),this.renderer.setStyle(this.backdropTop,"flex-shrink","0"),this.renderer.setStyle(this.backdropTop,"background-color","rgba("+this.optionsService.getBackdropColor()+", 0.7)"),this.renderer.appendChild(this.backdropContent,this.backdropTop),this.backdropMiddleContainer=this.renderer.createElement("div"),this.renderer.addClass(this.backdropMiddleContainer,"backdrop-middle-container"),this.renderer.setStyle(this.backdropMiddleContainer,"height",this.elementRef.element.nativeElement.offsetHeight+"px"),this.renderer.setStyle(this.backdropMiddleContainer,"width","100%"),this.renderer.setStyle(this.backdropMiddleContainer,"flex-shrink","0"),this.renderer.appendChild(this.backdropContent,this.backdropMiddleContainer),this.backdropMiddleContent=this.renderer.createElement("div"),this.renderer.addClass(this.backdropMiddleContent,"backdrop-middle-content"),this.renderer.setStyle(this.backdropMiddleContent,"display","flex"),this.renderer.setStyle(this.backdropMiddleContent,"width","100%"),this.renderer.setStyle(this.backdropMiddleContent,"height","100%"),this.renderer.appendChild(this.backdropMiddleContainer,this.backdropMiddleContent),this.leftBackdrop=this.renderer.createElement("div"),this.renderer.addClass(this.leftBackdrop,"joyride-backdrop"),this.renderer.addClass(this.leftBackdrop,"backdrop-left"),this.renderer.setStyle(this.leftBackdrop,"flex-shrink","0"),this.renderer.setStyle(this.leftBackdrop,"width",this.targetAbsoluteLeft-this.lastXScroll+"px"),this.renderer.setStyle(this.leftBackdrop,"background-color","rgba("+this.optionsService.getBackdropColor()+", 0.7)"),this.renderer.appendChild(this.backdropMiddleContent,this.leftBackdrop),this.targetBackdrop=this.renderer.createElement("div"),this.renderer.addClass(this.targetBackdrop,"backdrop-target"),this.renderer.setStyle(this.targetBackdrop,"flex-shrink","0"),this.renderer.setStyle(this.targetBackdrop,"width",this.elementRef.element.nativeElement.offsetWidth+"px"),this.renderer.appendChild(this.backdropMiddleContent,this.targetBackdrop),this.rightBackdrop=this.renderer.createElement("div"),this.renderer.addClass(this.rightBackdrop,"joyride-backdrop"),this.renderer.addClass(this.rightBackdrop,"backdrop-right"),this.renderer.setStyle(this.rightBackdrop,"width","100%"),this.renderer.setStyle(this.rightBackdrop,"background-color","rgba("+this.optionsService.getBackdropColor()+", 0.7)"),this.renderer.appendChild(this.backdropMiddleContent,this.rightBackdrop),this.backdropBottom=this.renderer.createElement("div"),this.renderer.addClass(this.backdropBottom,"joyride-backdrop"),this.renderer.addClass(this.backdropBottom,"backdrop-bottom"),this.renderer.setStyle(this.backdropBottom,"width","100%"),this.renderer.setStyle(this.backdropBottom,"height","100%"),this.renderer.setStyle(this.backdropBottom,"background-color","rgba("+this.optionsService.getBackdropColor()+", 0.7)"),this.renderer.appendChild(this.backdropContent,this.backdropBottom),this.removeLastBackdrop(),this.drawCurrentBackdrop(),this.lastBackdropContainer=this.currentBackdropContainer},t.prototype.remove=function(){this.removeLastBackdrop()},t.prototype.redrawTarget=function(t){this.targetAbsoluteLeft=this.getTargetTotalLeft(t),this.targetAbsoluteTop=this.getTargetTotalTop(t),this.handleVerticalScroll(t),this.handleHorizontalScroll(t)},t.prototype.getTargetTotalTop=function(t){var e=t.targetViewContainer;return t.isElementOrAncestorFixed?this.documentService.getElementFixedTop(e.element):this.documentService.getElementAbsoluteTop(e.element)},t.prototype.getTargetTotalLeft=function(t){var e=t.targetViewContainer;return t.isElementOrAncestorFixed?this.documentService.getElementFixedLeft(e.element):this.documentService.getElementAbsoluteLeft(e.element)},t.prototype.redraw=function(t,e){this.lastYScroll!==e.scrollY&&(this.lastYScroll=e.scrollY,this.elementRef&&this.handleVerticalScroll(t)),this.lastXScroll!==e.scrollX&&(this.lastXScroll=e.scrollX,this.elementRef&&this.handleHorizontalScroll(t))},t.prototype.handleHorizontalScroll=function(t){var e=t.isElementOrAncestorFixed?this.targetAbsoluteLeft:this.targetAbsoluteLeft-this.lastXScroll;e>=0?(this.renderer.setStyle(this.leftBackdrop,"width",e+"px"),this.renderer.setStyle(this.targetBackdrop,"width",this.elementRef.element.nativeElement.offsetWidth+"px")):this.handleTargetPartialWidth(e)},t.prototype.handleTargetPartialWidth=function(t){this.renderer.setStyle(this.leftBackdrop,"width","0px");var e=this.elementRef.element.nativeElement.offsetWidth+t;e>=0?this.renderer.setStyle(this.targetBackdrop,"width",e+"px"):this.renderer.setStyle(this.targetBackdrop,"width","0px")},t.prototype.handleVerticalScroll=function(t){var e=t.isElementOrAncestorFixed?this.targetAbsoluteTop:this.targetAbsoluteTop-this.lastYScroll;e>=0?(this.renderer.setStyle(this.backdropTop,"height",e+"px"),this.renderer.setStyle(this.backdropMiddleContainer,"height",this.elementRef.element.nativeElement.offsetHeight+"px")):this.handleTargetPartialHeight(e)},t.prototype.handleTargetPartialHeight=function(t){this.renderer.setStyle(this.backdropTop,"height","0px");var e=this.elementRef.element.nativeElement.offsetHeight+t;e>=0?this.renderer.setStyle(this.backdropMiddleContainer,"height",e+"px"):this.renderer.setStyle(this.backdropMiddleContainer,"height","0px")},t.prototype.removeLastBackdrop=function(){this.lastBackdropContainer&&(this.renderer.removeChild(document.body,this.lastBackdropContainer),this.lastBackdropContainer=void 0)},t.prototype.drawCurrentBackdrop=function(){this.renderer.appendChild(document.body,this.currentBackdropContainer)},t}();k.decorators=[{type:e.Injectable}],k.ctorParameters=function(){return[{type:P},{type:l},{type:e.RendererFactory2}]};var B=function(){},O=function(){function t(t,e){this.rendererFactory=t,this.DOMService=e,this.scrollEvent=new o.Subject,this.resizeEvent=new o.Subject,this.renderer=t.createRenderer(null,null)}return t.prototype.startListeningScrollEvents=function(){var t=this;this.scrollUnlisten=this.renderer.listen("document","scroll",(function(e){t.scrollEvent.next({scrollX:t.DOMService.getNativeWindow().pageXOffset,scrollY:t.DOMService.getNativeWindow().pageYOffset})}))},t.prototype.startListeningResizeEvents=function(){var t=this;this.resizeUnlisten=this.renderer.listen("window","resize",(function(e){t.resizeEvent.next(e)}))},t.prototype.stopListeningScrollEvents=function(){this.scrollUnlisten()},t.prototype.stopListeningResizeEvents=function(){this.resizeUnlisten()},t}();O.decorators=[{type:e.Injectable}],O.ctorParameters=function(){return[{type:e.RendererFactory2},{type:C}]};var _,j=200;(_=t.KEY_CODE||(t.KEY_CODE={}))[_.RIGHT_ARROW=39]="RIGHT_ARROW",_[_.LEFT_ARROW=37]="LEFT_ARROW",_[_.ESCAPE_KEY=27]="ESCAPE_KEY";var A=function(){function e(t,e,i,o,r,n,s,p){this.injector=t,this.stepsContainerService=e,this.eventListenerService=i,this.documentService=o,this.renderer=r,this.logger=n,this.optionsService=s,this.templateService=p,this.stepWidth=j,this.stepHeight=200,this.showArrow=!0,this.arrowSize=M,this.subscriptions=[]}return e.prototype.ngOnInit=function(){var t=this;this.joyrideStepService=this.injector.get(F),this.documentHeight=this.documentService.getDocumentHeight(),this.subscriptions.push(this.subscribeToResizeEvents()),this.title=this.step.title.asObservable(),this.text=this.step.text.asObservable(),this.setCustomTemplates(),this.setCustomTexts(),this.counter=this.getCounter(),this.isCounterVisible=this.optionsService.isCounterVisible(),this.isPrevButtonVisible=this.optionsService.isPrevButtonVisible(),this.themeColor=this.optionsService.getThemeColor(),this.text&&this.text.subscribe((function(e){return t.checkRedraw(e)})),this.title&&this.title.subscribe((function(e){return t.checkRedraw(e)}))},e.prototype.ngAfterViewInit=function(){if(this.isCustomized())this.renderer.setStyle(this.stepContainer.nativeElement,"max-width","90vw"),this.updateStepDimensions();else{this.renderer.setStyle(this.stepContainer.nativeElement,"max-width","400px");var t=this.getDimensionsByAspectRatio(this.stepContainer.nativeElement.clientWidth,this.stepContainer.nativeElement.clientHeight,1.212);t=this.adjustDimensions(t.width,t.height),this.stepWidth=t.width,this.stepHeight=t.height,this.renderer.setStyle(this.stepContainer.nativeElement,"width",this.stepWidth+"px"),this.renderer.setStyle(this.stepContainer.nativeElement,"height",this.stepHeight+"px")}this.drawStep()},e.prototype.checkRedraw=function(t){var e=this;null!=t&&setTimeout((function(){e.redrawStep()}),2)},e.prototype.isCustomized=function(){return this.step.stepContent||this.templateService.getCounter()||this.templateService.getPrevButton()||this.templateService.getNextButton()||this.templateService.getDoneButton()},e.prototype.setCustomTexts=function(){var t=this.optionsService.getCustomTexts();this.prevText=t.prev,this.nextText=t.next,this.doneText=t.done},e.prototype.drawStep=function(){var t=this.step.isElementOrAncestorFixed?"fixed":"absolute";this.renderer.setStyle(this.stepHolder.nativeElement,"position",t),this.renderer.setStyle(this.stepHolder.nativeElement,"transform",this.step.transformCssStyle),this.targetWidth=this.step.targetViewContainer.element.nativeElement.getBoundingClientRect().width,this.targetHeight=this.step.targetViewContainer.element.nativeElement.getBoundingClientRect().height,this.targetAbsoluteLeft="fixed"===t?this.documentService.getElementFixedLeft(this.step.targetViewContainer.element):this.documentService.getElementAbsoluteLeft(this.step.targetViewContainer.element),this.targetAbsoluteTop="fixed"===t?this.documentService.getElementFixedTop(this.step.targetViewContainer.element):this.documentService.getElementAbsoluteTop(this.step.targetViewContainer.element),this.setStepStyle()},e.prototype.getCounter=function(){var t=this.stepsContainerService.getStepNumber(this.step.name),e=this.stepsContainerService.getStepsCount();return this.counterData={step:t,total:e},t+"/"+e},e.prototype.setCustomTemplates=function(){this.customContent=this.step.stepContent,this.ctx=this.step.stepContentParams,this.customPrevButton=this.templateService.getPrevButton(),this.customNextButton=this.templateService.getNextButton(),this.customDoneButton=this.templateService.getDoneButton(),this.customCounter=this.templateService.getCounter()},e.prototype.keyEvent=function(e){console.log(e),e.keyCode===t.KEY_CODE.RIGHT_ARROW?this.isLastStep()?this.close():this.next():e.keyCode===t.KEY_CODE.LEFT_ARROW?this.prev():e.keyCode===t.KEY_CODE.ESCAPE_KEY&&this.close()},e.prototype.prev=function(){this.joyrideStepService.prev()},e.prototype.next=function(){this.joyrideStepService.next()},e.prototype.close=function(){this.joyrideStepService.close()},e.prototype.isFirstStep=function(){return 1===this.stepsContainerService.getStepNumber(this.step.name)},e.prototype.isLastStep=function(){return this.stepsContainerService.getStepNumber(this.step.name)===this.stepsContainerService.getStepsCount()},e.prototype.setStepStyle=function(){switch(this.step.position){case"top":this.setStyleTop();break;case"bottom":this.setStyleBottom();break;case"right":this.setStyleRight();break;case"left":this.setStyleLeft();break;case"center":this.setStyleCenter();break;default:this.setStyleBottom()}},e.prototype.setStyleTop=function(){this.stepsContainerService.updatePosition(this.step.name,"top"),this.topPosition=this.targetAbsoluteTop-H-this.stepHeight,this.stepAbsoluteTop=this.targetAbsoluteTop-H-this.stepHeight,this.arrowTopPosition=this.stepHeight,this.leftPosition=this.targetWidth/2-this.stepWidth/2+this.targetAbsoluteLeft,this.stepAbsoluteLeft=this.targetWidth/2-this.stepWidth/2+this.targetAbsoluteLeft,this.arrowLeftPosition=this.stepWidth/2-this.arrowSize,this.adjustLeftPosition(),this.adjustRightPosition(),this.arrowPosition="bottom",this.autofixTopPosition()},e.prototype.setStyleRight=function(){this.stepsContainerService.updatePosition(this.step.name,"right"),this.topPosition=this.targetAbsoluteTop+this.targetHeight/2-this.stepHeight/2,this.stepAbsoluteTop=this.targetAbsoluteTop+this.targetHeight/2-this.stepHeight/2,this.arrowTopPosition=this.stepHeight/2-this.arrowSize,this.leftPosition=this.targetAbsoluteLeft+this.targetWidth+H,this.stepAbsoluteLeft=this.targetAbsoluteLeft+this.targetWidth+H,this.arrowLeftPosition=-this.arrowSize,this.adjustTopPosition(),this.adjustBottomPosition(),this.arrowPosition="left",this.autofixRightPosition()},e.prototype.setStyleBottom=function(){this.stepsContainerService.updatePosition(this.step.name,"bottom"),this.topPosition=this.targetAbsoluteTop+this.targetHeight+H,this.stepAbsoluteTop=this.targetAbsoluteTop+this.targetHeight+H,this.arrowTopPosition=-this.arrowSize,this.arrowLeftPosition=this.stepWidth/2-this.arrowSize,this.leftPosition=this.targetWidth/2-this.stepWidth/2+this.targetAbsoluteLeft,this.stepAbsoluteLeft=this.targetWidth/2-this.stepWidth/2+this.targetAbsoluteLeft,this.adjustLeftPosition(),this.adjustRightPosition(),this.arrowPosition="top",this.autofixBottomPosition()},e.prototype.setStyleLeft=function(){this.stepsContainerService.updatePosition(this.step.name,"left"),this.topPosition=this.targetAbsoluteTop+this.targetHeight/2-this.stepHeight/2,this.stepAbsoluteTop=this.targetAbsoluteTop+this.targetHeight/2-this.stepHeight/2,this.arrowTopPosition=this.stepHeight/2-this.arrowSize,this.leftPosition=this.targetAbsoluteLeft-this.stepWidth-H,this.stepAbsoluteLeft=this.targetAbsoluteLeft-this.stepWidth-H,this.arrowLeftPosition=this.stepWidth,this.adjustTopPosition(),this.adjustBottomPosition(),this.arrowPosition="right",this.autofixLeftPosition()},e.prototype.setStyleCenter=function(){this.renderer.setStyle(this.stepHolder.nativeElement,"position","fixed"),this.renderer.setStyle(this.stepHolder.nativeElement,"top","50%"),this.renderer.setStyle(this.stepHolder.nativeElement,"left","50%"),this.updateStepDimensions(),this.renderer.setStyle(this.stepHolder.nativeElement,"transform","translate(-"+this.stepWidth/2+"px, -"+this.stepHeight/2+"px)"),this.showArrow=!1},e.prototype.adjustLeftPosition=function(){this.leftPosition<0&&(this.arrowLeftPosition=this.arrowLeftPosition+this.leftPosition-2,this.leftPosition=2)},e.prototype.adjustRightPosition=function(){var t=document.body.clientWidth;if(this.stepAbsoluteLeft+this.stepWidth>t){var e=this.leftPosition-(this.stepAbsoluteLeft+this.stepWidth+5-t),i=e-this.leftPosition;this.leftPosition=e,this.arrowLeftPosition=this.arrowLeftPosition-i}},e.prototype.adjustTopPosition=function(){this.stepAbsoluteTop<0&&(this.arrowTopPosition=this.arrowTopPosition+this.topPosition-2,this.topPosition=2)},e.prototype.adjustBottomPosition=function(){if(this.stepAbsoluteTop+this.stepHeight>this.documentHeight){var t=this.topPosition-(this.stepAbsoluteTop+this.stepHeight+5-this.documentHeight),e=t-this.topPosition;this.topPosition=t,this.arrowTopPosition=this.arrowTopPosition-e}},e.prototype.autofixTopPosition=function(){this.positionAlreadyFixed?this.logger.warn("No step positions found for this step. The step will be centered."):this.targetAbsoluteTop-this.stepHeight-this.arrowSize<0&&(this.positionAlreadyFixed=!0,this.setStyleRight())},e.prototype.autofixRightPosition=function(){this.targetAbsoluteLeft+this.targetWidth+this.stepWidth+this.arrowSize>document.body.clientWidth&&this.setStyleBottom()},e.prototype.autofixBottomPosition=function(){this.targetAbsoluteTop+this.stepHeight+this.arrowSize+this.targetHeight>this.documentHeight&&this.setStyleLeft()},e.prototype.autofixLeftPosition=function(){this.targetAbsoluteLeft-this.stepWidth-this.arrowSize<0&&this.setStyleTop()},e.prototype.subscribeToResizeEvents=function(){var t=this;return this.eventListenerService.resizeEvent.subscribe((function(){t.redrawStep()}))},e.prototype.redrawStep=function(){this.updateStepDimensions(),this.drawStep()},e.prototype.getDimensionsByAspectRatio=function(t,e,i){var o=(t+e)/(1+i);return{width:o*i,height:o}},e.prototype.adjustDimensions=function(t,e){var i=t,o=e;return t>400?o=t*e/(i=400):t<j&&(i=j,o=165.01650165016503),{width:i,height:o}},e.prototype.updateStepDimensions=function(){this.stepWidth=this.stepContainer.nativeElement.clientWidth,this.stepHeight=this.stepContainer.nativeElement.clientHeight},e.prototype.ngOnDestroy=function(){this.subscriptions.forEach((function(t){t.unsubscribe()}))},e}();A.decorators=[{type:e.Component,args:[{selector:"joyride-step",template:'<div #stepHolder class="joyride-step__holder" [id]="\'joyride-step-\' + step.name" [style.top.px]="topPosition" [style.left.px]="leftPosition">\r\n <joyride-arrow *ngIf="showArrow" class="joyride-step__arrow" [position]="arrowPosition" [style.top.px]="arrowTopPosition"\r\n [style.left.px]="arrowLeftPosition"></joyride-arrow>\r\n <div #stepContainer class="joyride-step__container">\r\n <joy-close-button class="joyride-step__close" (click)="close()"></joy-close-button>\r\n <div class="joyride-step__header">\r\n <div class="joyride-step__title" [style.color]="themeColor">{{ title | async }}</div>\r\n </div>\r\n <div class="joyride-step__body">\r\n <ng-container *ngTemplateOutlet="customContent ? customContent : defaultContent; context: ctx"></ng-container>\r\n <ng-template #defaultContent>\r\n {{ text | async }}\r\n </ng-template>\r\n </div>\r\n <div class="joyride-step__footer">\r\n <div *ngIf="isCounterVisible" class="joyride-step__counter-container">\r\n <ng-container *ngTemplateOutlet="customCounter ? customCounter : defaultCounter; context: counterData"></ng-container>\r\n <ng-template #defaultCounter>\r\n <div class="joyride-step__counter">{{ counter }}</div>\r\n </ng-template>\r\n </div>\r\n <div class="joyride-step__buttons-container">\r\n <div class="joyride-step__prev-container joyride-step__button" *ngIf="isPrevButtonVisible && !isFirstStep()" (click)="prev()">\r\n <ng-container *ngTemplateOutlet="customPrevButton ? customPrevButton : defaultPrevButton"></ng-container>\r\n <ng-template #defaultPrevButton>\r\n <joyride-button class="joyride-step__prev-button" [color]="themeColor">{{ prevText | async }}</joyride-button>\r\n </ng-template>\r\n </div>\r\n <div class="joyride-step__next-container joyride-step__button" *ngIf="!isLastStep(); else doneButton" (click)="next()">\r\n <ng-container *ngTemplateOutlet="customNextButton ? customNextButton : defaulNextButton"></ng-container>\r\n <ng-template #defaulNextButton>\r\n <joyride-button [color]="themeColor">{{ nextText | async }}</joyride-button>\r\n </ng-template>\r\n </div>\r\n <ng-template #doneButton>\r\n <div class="joyride-step__done-container joyride-step__button" (click)="close()">\r\n <ng-container *ngTemplateOutlet="customDoneButton ? customDoneButton : defaultDoneButton"></ng-container>\r\n <ng-template #defaultDoneButton>\r\n <joyride-button class="joyride-step__done-button" [color]="themeColor">{{ doneText | async }}</joyride-button>\r\n </ng-template>\r\n </div>\r\n </ng-template>\r\n </div>\r\n </div>\r\n </div>\r\n</div>',encapsulation:e.ViewEncapsulation.None,styles:[".joyride-step__holder{position:absolute;font-family:Arial,Helvetica,sans-serif;font-size:16px;z-index:1001}.joyride-step__arrow{position:absolute;left:40px;z-index:1002}.joyride-step__container{box-sizing:border-box;position:relative;color:#000;background-color:#fff;display:flex;flex-direction:column;justify-content:space-between;padding:10px;box-shadow:0 0 30px 1px #000}.joyride-step__header{display:flex;align-items:center;padding:8px}.joyride-step__title{font-weight:700;font-size:20px}.joyride-step__close{position:absolute;right:10px;top:10px;width:14px;height:14px;cursor:pointer}.joyride-step__body{text-align:left;padding:10px 8px}.joyride-step__footer{justify-content:space-between;align-items:center;padding-left:8px}.joyride-step__buttons-container,.joyride-step__footer{display:flex;flex-direction:row}.joyride-step__button:first-child{margin-right:2.5px}.joyride-step__button:last-child{margin-left:2.5px}.joyride-step__counter{font-weight:700;font-size:14px}.joyride-step__counter-container{margin-right:10px}"]}]}],A.ctorParameters=function(){return[{type:e.Injector},{type:w},{type:O},{type:P},{type:e.Renderer2},{type:u},{type:l},{type:x}]},A.propDecorators={step:[{type:e.Input}],stepHolder:[{type:e.ViewChild,args:["stepHolder",{static:!0}]}],stepContainer:[{type:e.ViewChild,args:["stepContainer",{static:!0}]}],keyEvent:[{type:e.HostListener,args:["window:keyup",["$event"]]}]};var D=function(){this.position="top"};D.decorators=[{type:e.Component,args:[{selector:"joyride-arrow",template:"<div [class.joyride-arrow__top]=\"position == 'top'\"\r\n [class.joyride-arrow__bottom]=\"position == 'bottom'\"\r\n [class.joyride-arrow__left]=\"position == 'left'\"\r\n [class.joyride-arrow__right]=\"position == 'right'\">\r\n</div>",encapsulation:e.ViewEncapsulation.None,styles:[".joyride-arrow__top{border-bottom:11px solid #fff}.joyride-arrow__bottom,.joyride-arrow__top{border-left:11px solid transparent;border-right:11px solid transparent}.joyride-arrow__bottom{border-top:11px solid #fff}.joyride-arrow__right{border-left:11px solid #fff}.joyride-arrow__left,.joyride-arrow__right{border-bottom:11px solid transparent;border-top:11px solid transparent}.joyride-arrow__left{border-right:11px solid #fff}"]}]}],D.propDecorators={position:[{type:e.Input}]};var I=function(){function t(){this.clicked=new e.EventEmitter}return t.prototype.onClick=function(){this.clicked.emit()},t}();I.decorators=[{type:e.Component,args:[{selector:"joyride-button",template:"<button (mouseleave)=\"hover=false\" (mouseover)=\"hover=true\"\r\n [ngStyle]=\"{'background-color': hover ? '#fff' : color, \r\n 'color': hover ? color : '#fff',\r\n 'border-color' : hover ? color : 'transparent'}\"\r\n class=\"joyride-button\" (click)=\"onClick()\">\r\n <ng-content></ng-content>\r\n</button>",styles:[".joyride-button{text-transform:uppercase;border:2px solid transparent;outline:none;padding:6px 12px;font-size:12px;font-weight:700;color:#fff;background-color:#3b5560;cursor:pointer}.joyride-button:hover{color:#3b5560;border:2px solid #3b5560;background-color:#fff}"]}]}],I.propDecorators={color:[{type:e.Input}],clicked:[{type:e.Output}]};var R=function(){};R.decorators=[{type:e.Component,args:[{selector:"joy-close-button",template:'<svg viewBox="0 0 25 25" xmlns="http://www.w3.org/2000/svg">\n <line x1="1" y1="24" \n x2="24" y2="1" \n stroke="black" \n stroke-width="3"/>\n <line x1="1" y1="1" \n x2="24" y2="24" \n stroke="black" \n stroke-width="3"/>\n </svg>'}]}];var L=function(){function t(t,e,i){this.componentFactoryResolver=t,this.appRef=e,this.injector=i,this.refMap={}}return t.prototype.draw=function(t){var e=this.componentFactoryResolver.resolveComponentFactory(A).create(this.injector);this.appRef.attachView(e.hostView);var i=e.hostView.rootNodes[0];document.body.appendChild(i);var o=e.instance;o.step=t,e.changeDetectorRef.detectChanges(),t.stepInstance=o,this.refMap[t.name]=e},t.prototype.remove=function(t){this.appRef.detachView(this.refMap[t.name].hostView),this.refMap[t.name].destroy()},t}();L.decorators=[{type:e.Injectable}],L.ctorParameters=function(){return[{type:e.ComponentFactoryResolver},{type:e.ApplicationRef},{type:e.Injector}]};var H=15,M=10,F=function(){function e(t,e,i,r,n,s,p,h,a){this.backDropService=t,this.eventListener=e,this.stepsContainerService=i,this.documentService=r,this.DOMService=n,this.stepDrawerService=s,this.optionsService=p,this.router=h,this.logger=a,this.winTopPosition=0,this.winBottomPosition=0,this.stepsObserver=new o.ReplaySubject,this.initViewportPositions(),this.subscribeToScrollEvents(),this.subscribeToResizeEvents()}return e.prototype.initViewportPositions=function(){this.winTopPosition=0,this.winBottomPosition=this.DOMService.getNativeWindow().innerHeight-20},e.prototype.subscribeToScrollEvents=function(){var t=this;this.eventListener.startListeningScrollEvents(),this.eventListener.scrollEvent.subscribe((function(e){t.winTopPosition=e.scrollY,t.winBottomPosition=t.winTopPosition+t.DOMService.getNativeWindow().innerHeight-20,t.currentStep&&t.backDropService.redraw(t.currentStep,e)}))},e.prototype.subscribeToResizeEvents=function(){var t=this;this.eventListener.resizeEvent.subscribe((function(){t.currentStep&&t.backDropService.redrawTarget(t.currentStep)}))},e.prototype.drawStep=function(t){t.position=t.position===T?this.optionsService.getStepDefaultPosition():t.position,this.stepDrawerService.draw(t)},e.prototype.startTour=function(){return this.stepsObserver=new o.ReplaySubject,this.stepsContainerService.init(),this.documentService.setDocumentHeight(),this.tryShowStep(t.StepActionType.NEXT),this.eventListener.startListeningResizeEvents(),this.subscribeToStepsUpdates(),this.stepsObserver.asObservable()},e.prototype.close=function(){this.removeCurrentStep(),this.notifyTourIsFinished(),this.DOMService.getNativeWindow().scrollTo(0,0),this.eventListener.stopListeningResizeEvents(),this.backDropService.remove()},e.prototype.prev=function(){this.removeCurrentStep(),this.currentStep.prevCliked.emit(),this.tryShowStep(t.StepActionType.PREV)},e.prototype.next=function(){this.removeCurrentStep(),this.currentStep.nextClicked.emit(),this.tryShowStep(t.StepActionType.NEXT)},e.prototype.navigateToStepPage=function(t){var e=this.stepsContainerService.getStepRoute(t);e&&this.router.navigate([e])},e.prototype.subscribeToStepsUpdates=function(){var t=this;this.stepsContainerService.stepHasBeenModified.subscribe((function(e){t.currentStep&&t.currentStep.name===e.name&&(t.currentStep=e)}))},e.prototype.tryShowStep=function(t){var e=this;this.navigateToStepPage(t);var i=this.optionsService.getWaitingTime();i>100&&this.backDropService.remove(),setTimeout((function(){try{e.showStep(t)}catch(i){if(i instanceof v)e.tryShowStep(t);else{if(!(i instanceof S))throw new Error(i);e.logger.error("Forcing the tour closure: First or Last step not found in the DOM."),e.close()}}}),i)},e.prototype.showStep=function(t){if(this.currentStep=this.stepsContainerService.get(t),null==this.currentStep)throw new v("");this.scrollIfElementBeyondOtherElements(),this.backDropService.draw(this.currentStep),this.drawStep(this.currentStep),this.scrollIfStepAndTargetAreNotVisible(),this.notifyStepClicked(t)},e.prototype.notifyStepClicked=function(t){var e={number:this.stepsContainerService.getStepNumber(this.currentStep.name),name:this.currentStep.name,route:this.currentStep.route,actionType:t};this.stepsObserver.next(e)},e.prototype.notifyTourIsFinished=function(){this.currentStep&&this.currentStep.tourDone.emit(),this.stepsObserver.complete()},e.prototype.removeCurrentStep=function(){this.currentStep&&this.stepDrawerService.remove(this.currentStep)},e.prototype.scrollIfStepAndTargetAreNotVisible=function(){this.scrollWhenTargetOrStepAreHiddenBottom(),this.scrollWhenTargetOrStepAreHiddenTop()},e.prototype.scrollWhenTargetOrStepAreHiddenBottom=function(){var t=this.getMaxTargetAndStepBottomPosition();t>this.winBottomPosition&&this.DOMService.getNativeWindow().scrollBy(0,t-this.winBottomPosition)},e.prototype.scrollWhenTargetOrStepAreHiddenTop=function(){var t=this.getMaxTargetAndStepTopPosition();t<this.winTopPosition&&this.DOMService.getNativeWindow().scrollBy(0,t-this.winTopPosition)},e.prototype.getMaxTargetAndStepBottomPosition=function(){var t=this.documentService.getElementAbsoluteTop(this.currentStep.targetViewContainer.element);return"top"===this.currentStep.position?t+this.currentStep.stepInstance.targetHeight:"bottom"===this.currentStep.position?t+this.currentStep.stepInstance.targetHeight+this.currentStep.stepInstance.stepHeight+M+H:"right"===this.currentStep.position||"left"===this.currentStep.position?Math.max(t+this.currentStep.stepInstance.targetHeight,t+this.currentStep.stepInstance.targetHeight/2+this.currentStep.stepInstance.stepHeight/2):void 0},e.prototype.getMaxTargetAndStepTopPosition=function(){var t=this.documentService.getElementAbsoluteTop(this.currentStep.targetViewContainer.element);return"top"===this.currentStep.position?t-(this.currentStep.stepInstance.stepHeight+M+H):"bottom"===this.currentStep.position?t:"right"===this.currentStep.position||"left"===this.currentStep.position?Math.min(t,t+this.currentStep.stepInstance.targetHeight/2-this.currentStep.stepInstance.stepHeight/2):void 0},e.prototype.scrollIfElementBeyondOtherElements=function(){2===this.isElementBeyondOthers()&&this.documentService.scrollToTheTop(this.currentStep.targetViewContainer.element),2===this.isElementBeyondOthers()&&this.documentService.scrollToTheBottom(this.currentStep.targetViewContainer.element),1===this.isElementBeyondOthers()&&this.documentService.isParentScrollable(this.currentStep.targetViewContainer.element)&&this.documentService.scrollIntoView(this.currentStep.targetViewContainer.element,this.currentStep.isElementOrAncestorFixed),1===this.isElementBeyondOthers()&&this.documentService.isParentScrollable(this.currentStep.targetViewContainer.element)&&this.currentStep.targetViewContainer.element.nativeElement.scrollIntoView()},e.prototype.isElementBeyondOthers=function(){return this.documentService.isElementBeyondOthers(this.currentStep.targetViewContainer.element,this.currentStep.isElementOrAncestorFixed,"backdrop")},e}();F.decorators=[{type:e.Injectable}],F.ctorParameters=function(){return[{type:k},{type:O},{type:w},{type:P},{type:C},{type:L},{type:l},{type:r.Router},{type:u}]};var N=function(){},W=function(){function t(t,e,i){this.platformId=t,this.stepService=e,this.optionsService=i,this.tourInProgress=!1}return t.prototype.startTour=function(t){var e=this;return i.isPlatformBrowser(this.platformId)?(this.tourInProgress||(this.tourInProgress=!0,t&&this.optionsService.setOptions(t),this.tour$=this.stepService.startTour().pipe(n.finalize((function(){return e.tourInProgress=!1}))),this.tour$.subscribe()),this.tour$):o.of(new N)},t.prototype.closeTour=function(){this.isTourInProgress()&&this.stepService.close()},t.prototype.isTourInProgress=function(){return this.tourInProgress},t}();W.decorators=[{type:e.Injectable}],W.ctorParameters=function(){return[{type:Object,decorators:[{type:e.Inject,args:[e.PLATFORM_ID]}]},{type:F},{type:l}]};var V=r.RouterModule.forChild([]),z=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[W,F,w,k,O,P,l,L,C,u,x]}},t.forChild=function(){return{ngModule:t,providers:[]}},t}();z.decorators=[{type:e.NgModule,args:[{imports:[i.CommonModule,V],declarations:[E,A,D,I,R],exports:[E]}]}],t.ARROW_SIZE=M,t.DEFAULT_DISTANCE_FROM_MARGIN_LEFT=2,t.DEFAULT_DISTANCE_FROM_MARGIN_TOP=2,t.DEFAULT_TEXTS=c,t.DEFAULT_THEME_COLOR=p,t.DEFAULT_TIMEOUT_BETWEEN_STEPS=1,t.DISTANCE_FROM_TARGET=H,t.DocumentService=P,t.DomRefService=C,t.EventListenerService=O,t.JoyrideArrowComponent=D,t.JoyrideBackdropService=k,t.JoyrideButtonComponent=I,t.JoyrideCloseButtonComponent=R,t.JoyrideDirective=E,t.JoyrideModule=z,t.JoyrideOptionsService=l,t.JoyrideService=W,t.JoyrideStepComponent=A,t.JoyrideStepService=F,t.JoyrideStepsContainerService=w,t.LoggerService=u,t.NO_POSITION=T,t.ObservableCustomTexts=a,t.STEP_DEFAULT_POSITION=h,t.Scroll=B,t.StepDrawerService=L,t.TemplatesService=x,t.routerModuleForChild=V,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=ngx-joyride.umd.min.js.map