{"version":3,"file":"ngx-bootstrap-carousel.mjs","sources":["../tmp-esm2022/carousel.config.js","../tmp-esm2022/utils.js","../tmp-esm2022/carousel.component.js","../tmp-esm2022/slide.component.js","../tmp-esm2022/carousel.module.js","../tmp-esm2022/ngx-bootstrap-carousel.js"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport * as i0 from \"@angular/core\";\nexport class CarouselConfig {\n constructor() {\n /* Default interval of auto changing of slides */\n this.interval = 5000;\n /* Is loop of auto changing of slides can be paused */\n this.noPause = false;\n /* Is slides can wrap from the last to the first slide */\n this.noWrap = false;\n /* Show carousel-indicators */\n this.showIndicators = true;\n /* Slides can be paused on focus */\n this.pauseOnFocus = false;\n /* If `true` - carousel indicators indicate slides chunks works ONLY if singleSlideOffset = FALSE */\n this.indicatorsByChunk = false;\n /* If value more then 1 — carousel works in multilist mode */\n this.itemsPerSlide = 1;\n /* If `true` — carousel shifts by one element. By default carousel shifts by number\n of visible elements (itemsPerSlide field) */\n this.singleSlideOffset = false;\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.0.2\", ngImport: i0, type: CarouselConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }\n static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: \"12.0.0\", version: \"20.0.2\", ngImport: i0, type: CarouselConfig, providedIn: 'root' }); }\n}\ni0.ɵɵngDeclareClassMetadata({ minVersion: \"12.0.0\", version: \"20.0.2\", ngImport: i0, type: CarouselConfig, decorators: [{\n type: Injectable,\n args: [{\n providedIn: 'root'\n }]\n }] });\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2Fyb3VzZWwuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2Nhcm91c2VsL2Nhcm91c2VsLmNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQ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oZSBsYXN0IHRvIHRoZSBmaXJzdCBzbGlkZSAqL1xuICBub1dyYXAgPSBmYWxzZTtcblxuICAvKiBTaG93IGNhcm91c2VsLWluZGljYXRvcnMgKi9cbiAgc2hvd0luZGljYXRvcnMgPSB0cnVlO1xuXG4gIC8qIFNsaWRlcyBjYW4gYmUgcGF1c2VkIG9uIGZvY3VzICovXG4gIHBhdXNlT25Gb2N1cyA9IGZhbHNlO1xuXG4gIC8qIElmIGB0cnVlYCAtIGNhcm91c2VsIGluZGljYXRvcnMgaW5kaWNhdGUgc2xpZGVzIGNodW5rcyB3b3JrcyBPTkxZIGlmIHNpbmdsZVNsaWRlT2Zmc2V0ID0gRkFMU0UgKi9cbiAgaW5kaWNhdG9yc0J5Q2h1bmsgPSBmYWxzZTtcblxuICAvKiBJZiB2YWx1ZSBtb3JlIHRoZW4gMSDigJQgY2Fyb3VzZWwgd29ya3MgaW4gbXVsdGlsaXN0IG1vZGUgKi9cbiAgaXRlbXNQZXJTbGlkZSA9IDE7XG5cbiAgLyogSWYgYHRydWVgIOKAlCBjYXJvdXNlbCBzaGlmdHMgYnkgb25lIGVsZW1lbnQuIEJ5IGRlZmF1bHQgY2Fyb3VzZWwgc2hpZnRzIGJ5IG51bWJlclxuICAgIG9mIHZpc2libGUgZWxlbWVudHMgKGl0ZW1zUGVyU2xpZGUgZmllbGQpICovXG4gIHNpbmdsZVNsaWRlT2Zmc2V0ID0gZmFsc2U7XG59XG4iXX0=","/**\n * Returns the index of the last element in the array where predicate is true, and -1\n * otherwise.\n * @param array The source array to search in\n * @param predicate find calls predicate once for each element of the array, in descending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.\n */\nexport function findLastIndex(array, predicate) {\n let l = array.length;\n while (l--) {\n if (predicate(array[l], l, array)) {\n return l;\n }\n }\n return -1;\n}\nexport function chunkByNumber(array, size) {\n const out = [];\n const n = Math.ceil(array.length / size);\n let i = 0;\n while (i < n) {\n const chunk = array.splice(0, i === n - 1 && size < array.length ? array.length : size);\n out.push(chunk);\n i++;\n }\n return out;\n}\nexport function isNumber(value) {\n return typeof value === 'number' || Object.prototype.toString.call(value) === '[object Number]';\n}\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2Fyb3VzZWwvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7R0FPRztBQUNILE1BQU0sVUFBVSxhQUFhLENBQUksS0FBVSxFQUFFLFNBQXlEO0lBQ3BHLElBQUksQ0FBQyxHQUFHLEtBQUssQ0FBQyxNQUFNLENBQUM7SUFFckIsT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDO1FBQ1gsSUFBSSxTQUFTLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsRUFBRSxLQUFLLENBQUMsRUFBRSxDQUFDO1lBQ2xDLE9BQU8sQ0FBQyxDQUFDO1FBQ1gsQ0FBQztJQUNILENBQUM7SUFFRCxPQUFPLENBQUMsQ0FBQyxDQUFDO0FBQ1osQ0FBQztBQUVELE1BQU0sVUFBVSxhQUFhLENBQUksS0FBVSxFQUFFLElBQVk7SUFDdkQsTUFBTSxHQUFHLEdBQUcsRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLEdBQUcsSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsTUFBTSxHQUFHLElBQUksQ0FBQyxDQUFDO0lBQ3pDLElBQUksQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUVWLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFBRSxDQUFDO1FBQ2IsTUFBTSxLQUFLLEdBQUcsS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDLEVBQUUsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQU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ZXhwb3J0IGZ1bmN0aW9uIGZpbmRMYXN0SW5kZXg8VD4oYXJyYXk6IFRbXSwgcHJlZGljYXRlOiAodmFsdWU6IFQsIGluZGV4OiBudW1iZXIsIG9iajogVFtdKSA9PiBib29sZWFuKTogbnVtYmVyIHtcbiAgbGV0IGwgPSBhcnJheS5sZW5ndGg7XG5cbiAgd2hpbGUgKGwtLSkge1xuICAgIGlmIChwcmVkaWNhdGUoYXJyYXlbbF0sIGwsIGFycmF5KSkge1xuICAgICAgcmV0dXJuIGw7XG4gICAgfVxuICB9XG5cbiAgcmV0dXJuIC0xO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY2h1bmtCeU51bWJlcjxUPihhcnJheTogVFtdLCBzaXplOiBudW1iZXIpOiBUW11bXSB7XG4gIGNvbnN0IG91dCA9IFtdO1xuICBjb25zdCBuID0gTWF0aC5jZWlsKGFycmF5Lmxlbmd0aCAvIHNpemUpO1xuICBsZXQgaSA9IDA7XG5cbiAgd2hpbGUgKGkgPCBuKSB7XG4gICAgY29uc3QgY2h1bmsgPSBhcnJheS5zcGxpY2UoMCwgaSA9PT0gbiAtIDEgJiYgc2l6ZSA8IGFycmF5Lmxlbmd0aCA/IGFycmF5Lmxlbmd0aCA6IHNpemUpO1xuXG4gICAgb3V0LnB1c2goY2h1bmspO1xuICAgIGkrKztcbiAgfVxuXG4gIHJldHVybiBvdXQ7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBpc051bWJlcih2YWx1ZT86IHVua25vd24pOiB2YWx1ZSBpcyBudW1iZXIge1xuICByZXR1cm4gdHlwZW9mIHZhbHVlID09PSAnbnVtYmVyJyB8fCBPYmplY3QucHJvdG90eXBlLnRvU3RyaW5nLmNhbGwodmFsdWUpID09PSAnW29iamVjdCBOdW1iZXJdJztcbn1cbiJdfQ==","/***\n * pause (not yet supported) (?string='hover') - event group name which pauses\n * the cycling of the carousel, if hover pauses on mouseenter and resumes on\n * mouseleave keyboard (not yet supported) (?boolean=true) - if false\n * carousel will not react to keyboard events\n * note: swiping not yet supported\n */\n/****\n * Problems:\n * 1) if we set an active slide via model changes, .active class remains on a\n * current slide.\n * 2) if we have only one slide, we shouldn't show prev/next nav buttons\n * 3) if first or last slide is active and noWrap is true, there should be\n * \"disabled\" class on the nav buttons.\n * 4) default interval should be equal 5000\n */\nimport { Component, EventEmitter, Input, NgZone, Output, Inject, PLATFORM_ID } from '@angular/core';\nimport { isPlatformBrowser, NgIf, NgFor, NgStyle } from '@angular/common';\nimport { LinkedList, getBsVer } from 'ngx-bootstrap/utils';\nimport { CarouselConfig } from './carousel.config';\nimport { findLastIndex, chunkByNumber, isNumber } from './utils';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"./carousel.config\";\nexport var Direction;\n(function (Direction) {\n Direction[Direction[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n Direction[Direction[\"NEXT\"] = 1] = \"NEXT\";\n Direction[Direction[\"PREV\"] = 2] = \"PREV\";\n})(Direction || (Direction = {}));\nlet _currentId = 1;\n/**\n * Base element to create carousel\n */\nexport class CarouselComponent {\n /** Index of currently displayed slide(started for 0) */\n set activeSlide(index) {\n if (this.multilist) {\n return;\n }\n if (isNumber(index)) {\n this.customActiveSlide = index;\n }\n if (this._slides.length && index !== this._currentActiveSlide) {\n this._select(index);\n }\n }\n get activeSlide() {\n return this._currentActiveSlide || 0;\n }\n /**\n * Delay of item cycling in milliseconds. If false, carousel won't cycle\n * automatically.\n */\n get interval() {\n return this._interval;\n }\n set interval(value) {\n this._interval = value;\n this.restartTimer();\n }\n get slides() {\n return this._slides.toArray();\n }\n get isFirstSlideVisible() {\n const indexes = this.getVisibleIndexes();\n if (!indexes || (indexes instanceof Array && !indexes.length)) {\n return false;\n }\n return indexes.includes(0);\n }\n get isLastSlideVisible() {\n const indexes = this.getVisibleIndexes();\n if (!indexes || (indexes instanceof Array && !indexes.length)) {\n return false;\n }\n return indexes.includes(this._slides.length - 1);\n }\n get _bsVer() {\n return getBsVer();\n }\n constructor(config, ngZone, platformId) {\n this.ngZone = ngZone;\n this.platformId = platformId;\n /* If `true` — carousel will not cycle continuously and will have hard stops (prevent looping) */\n this.noWrap = false;\n /* If `true` — will disable pausing on carousel mouse hover */\n this.noPause = false;\n /* If `true` — carousel-indicators are visible */\n this.showIndicators = true;\n /* If `true` - autoplay will be stopped on focus */\n this.pauseOnFocus = false;\n /* If `true` - carousel indicators indicate slides chunks\n works ONLY if singleSlideOffset = FALSE */\n this.indicatorsByChunk = false;\n /* If value more then 1 — carousel works in multilist mode */\n this.itemsPerSlide = 1;\n /* If `true` — carousel shifts by one element. By default carousel shifts by number\n of visible elements (itemsPerSlide field) */\n this.singleSlideOffset = false;\n /** Turn on/off animation. Animation doesn't work for multilist carousel */\n this.isAnimated = false;\n /** Will be emitted when active slide has been changed. Part of two-way-bindable [(activeSlide)] property */\n this.activeSlideChange = new EventEmitter(false);\n /** Will be emitted when active slides has been changed in multilist mode */\n this.slideRangeChange = new EventEmitter();\n /* Index to start display slides from it */\n this.startFromIndex = 0;\n this._interval = 5000;\n this._slides = new LinkedList();\n this._currentVisibleSlidesIndex = 0;\n this.isPlaying = false;\n this.destroyed = false;\n this.currentId = 0;\n this.getActive = (slide) => slide.active;\n this.makeSlidesConsistent = (slides) => {\n slides.forEach((slide, index) => slide.item.order = index);\n };\n Object.assign(this, config);\n this.currentId = _currentId++;\n }\n ngAfterViewInit() {\n setTimeout(() => {\n if (this.singleSlideOffset) {\n this.indicatorsByChunk = false;\n }\n if (this.multilist) {\n this._chunkedSlides = chunkByNumber(this.mapSlidesAndIndexes(), this.itemsPerSlide);\n this.selectInitialSlides();\n }\n if (this.customActiveSlide && !this.multilist) {\n this._select(this.customActiveSlide);\n }\n }, 0);\n }\n ngOnDestroy() {\n this.destroyed = true;\n }\n /**\n * Adds new slide. If this slide is first in collection - set it as active\n * and starts auto changing\n * @param slide\n */\n addSlide(slide) {\n this._slides.add(slide);\n if (this.multilist && this._slides.length <= this.itemsPerSlide) {\n slide.active = true;\n }\n if (!this.multilist && this.isAnimated) {\n slide.isAnimated = true;\n }\n if (!this.multilist && this._slides.length === 1) {\n this._currentActiveSlide = undefined;\n if (!this.customActiveSlide) {\n this.activeSlide = 0;\n }\n this.play();\n }\n if (this.multilist && this._slides.length > this.itemsPerSlide) {\n this.play();\n }\n }\n /**\n * Removes specified slide. If this slide is active - will roll to another\n * slide\n * @param slide\n */\n removeSlide(slide) {\n const remIndex = this._slides.indexOf(slide);\n if (this._currentActiveSlide === remIndex) {\n // removing of active slide\n let nextSlideIndex;\n if (this._slides.length > 1) {\n // if this slide last - will roll to first slide, if noWrap flag is\n // FALSE or to previous, if noWrap is TRUE in case, if this slide in\n // middle of collection, index of next slide is same to removed\n nextSlideIndex = !this.isLast(remIndex)\n ? remIndex\n : this.noWrap ? remIndex - 1 : 0;\n }\n this._slides.remove(remIndex);\n // prevents exception with changing some value after checking\n setTimeout(() => {\n this._select(nextSlideIndex);\n }, 0);\n }\n else {\n this._slides.remove(remIndex);\n const currentSlideIndex = this.getCurrentSlideIndex();\n setTimeout(() => {\n // after removing, need to actualize index of current active slide\n this._currentActiveSlide = currentSlideIndex;\n this.activeSlideChange.emit(this._currentActiveSlide);\n }, 0);\n }\n }\n nextSlideFromInterval(force = false) {\n this.move(Direction.NEXT, force);\n }\n /**\n * Rolling to next slide\n * @param force: {boolean} if true - will ignore noWrap flag\n */\n nextSlide(force = false) {\n if (this.isPlaying) {\n this.restartTimer();\n }\n this.move(Direction.NEXT, force);\n }\n /**\n * Rolling to previous slide\n * @param force: {boolean} if true - will ignore noWrap flag\n */\n previousSlide(force = false) {\n if (this.isPlaying) {\n this.restartTimer();\n }\n this.move(Direction.PREV, force);\n }\n getFirstVisibleIndex() {\n return this.slides.findIndex(this.getActive);\n }\n getLastVisibleIndex() {\n return findLastIndex(this.slides, this.getActive);\n }\n move(direction, force = false) {\n const firstVisibleIndex = this.getFirstVisibleIndex();\n const lastVisibleIndex = this.getLastVisibleIndex();\n if (this.noWrap) {\n if (direction === Direction.NEXT &&\n this.isLast(lastVisibleIndex) ||\n direction === Direction.PREV &&\n firstVisibleIndex === 0) {\n return;\n }\n }\n if (!this.multilist) {\n this.activeSlide = this.findNextSlideIndex(direction, force) || 0;\n }\n else {\n this.moveMultilist(direction);\n }\n }\n /**\n * Swith slides by enter, space and arrows keys\n * @internal\n */\n keydownPress(event) {\n if (event.keyCode === 13 || event.key === 'Enter' || event.keyCode === 32 || event.key === 'Space') {\n this.nextSlide();\n event.preventDefault();\n return;\n }\n if (event.keyCode === 37 || event.key === 'LeftArrow') {\n this.previousSlide();\n return;\n }\n if (event.keyCode === 39 || event.key === 'RightArrow') {\n this.nextSlide();\n return;\n }\n }\n /**\n * Play on mouse leave\n * @internal\n */\n onMouseLeave() {\n if (!this.pauseOnFocus) {\n this.play();\n }\n }\n /**\n * Play on mouse up\n * @internal\n */\n onMouseUp() {\n if (!this.pauseOnFocus) {\n this.play();\n }\n }\n /**\n * When slides on focus autoplay is stopped(optional)\n * @internal\n */\n pauseFocusIn() {\n if (this.pauseOnFocus) {\n this.isPlaying = false;\n this.resetTimer();\n }\n }\n /**\n * When slides out of focus autoplay is started\n * @internal\n */\n pauseFocusOut() {\n this.play();\n }\n /**\n * Rolling to specified slide\n * @param index: {number} index of slide, which must be shown\n */\n selectSlide(index) {\n if (this.isPlaying) {\n this.restartTimer();\n }\n if (!this.multilist) {\n this.activeSlide = this.indicatorsByChunk ? index * this.itemsPerSlide : index;\n }\n else {\n this.selectSlideRange(this.indicatorsByChunk ? index * this.itemsPerSlide : index);\n }\n }\n /**\n * Starts a auto changing of slides\n */\n play() {\n if (!this.isPlaying) {\n this.isPlaying = true;\n this.restartTimer();\n }\n }\n /**\n * Stops a auto changing of slides\n */\n pause() {\n if (!this.noPause) {\n this.isPlaying = false;\n this.resetTimer();\n }\n }\n /**\n * Finds and returns index of currently displayed slide\n */\n getCurrentSlideIndex() {\n return this._slides.findIndex(this.getActive);\n }\n /**\n * Defines, whether the specified index is last in collection\n * @param index\n */\n isLast(index) {\n return index + 1 >= this._slides.length;\n }\n /**\n * Defines, whether the specified index is first in collection\n * @param index\n */\n isFirst(index) {\n return index === 0;\n }\n indicatorsSlides() {\n return this.slides.filter((slide, index) => !this.indicatorsByChunk || index % this.itemsPerSlide === 0);\n }\n selectInitialSlides() {\n const startIndex = this.startFromIndex <= this._slides.length\n ? this.startFromIndex\n : 0;\n this.hideSlides();\n if (this.singleSlideOffset) {\n this._slidesWithIndexes = this.mapSlidesAndIndexes();\n if (this._slides.length - startIndex < this.itemsPerSlide) {\n const slidesToAppend = this._slidesWithIndexes.slice(0, startIndex);\n this._slidesWithIndexes = [\n ...this._slidesWithIndexes,\n ...slidesToAppend\n ]\n .slice(slidesToAppend.length)\n .slice(0, this.itemsPerSlide);\n }\n else {\n this._slidesWithIndexes = this._slidesWithIndexes.slice(startIndex, startIndex + this.itemsPerSlide);\n }\n this._slidesWithIndexes.forEach((slide) => slide.item.active = true);\n this.makeSlidesConsistent(this._slidesWithIndexes);\n }\n else {\n this.selectRangeByNestedIndex(startIndex);\n }\n this.slideRangeChange.emit(this.getVisibleIndexes());\n }\n /**\n * Defines next slide index, depending of direction\n * @param direction: Direction(UNKNOWN|PREV|NEXT)\n * @param force: {boolean} if TRUE - will ignore noWrap flag, else will\n * return undefined if next slide require wrapping\n */\n findNextSlideIndex(direction, force) {\n let nextSlideIndex = 0;\n if (!force &&\n (this.isLast(this.activeSlide) &&\n direction !== Direction.PREV &&\n this.noWrap)) {\n return;\n }\n switch (direction) {\n case Direction.NEXT:\n // if this is last slide, not force, looping is disabled\n // and need to going forward - select current slide, as a next\n if (typeof this._currentActiveSlide === 'undefined') {\n nextSlideIndex = 0;\n break;\n }\n if (!this.isLast(this._currentActiveSlide)) {\n nextSlideIndex = this._currentActiveSlide + 1;\n break;\n }\n nextSlideIndex = !force && this.noWrap ? this._currentActiveSlide : 0;\n break;\n case Direction.PREV:\n // if this is first slide, not force, looping is disabled\n // and need to going backward - select current slide, as a next\n if (typeof this._currentActiveSlide === 'undefined') {\n nextSlideIndex = 0;\n break;\n }\n if (this._currentActiveSlide > 0) {\n nextSlideIndex = this._currentActiveSlide - 1;\n break;\n }\n if (!force && this.noWrap) {\n nextSlideIndex = this._currentActiveSlide;\n break;\n }\n nextSlideIndex = this._slides.length - 1;\n break;\n default:\n throw new Error('Unknown direction');\n }\n return nextSlideIndex;\n }\n mapSlidesAndIndexes() {\n return this.slides\n .slice()\n .map((slide, index) => {\n return {\n index,\n item: slide\n };\n });\n }\n selectSlideRange(index) {\n if (this.isIndexInRange(index)) {\n return;\n }\n this.hideSlides();\n if (!this.singleSlideOffset) {\n this.selectRangeByNestedIndex(index);\n }\n else {\n const startIndex = this.isIndexOnTheEdges(index)\n ? index\n : index - this.itemsPerSlide + 1;\n const endIndex = this.isIndexOnTheEdges(index)\n ? index + this.itemsPerSlide\n : index + 1;\n this._slidesWithIndexes = this.mapSlidesAndIndexes().slice(startIndex, endIndex);\n this.makeSlidesConsistent(this._slidesWithIndexes);\n this._slidesWithIndexes.forEach((slide) => slide.item.active = true);\n }\n this.slideRangeChange.emit(this.getVisibleIndexes());\n }\n selectRangeByNestedIndex(index) {\n if (!this._chunkedSlides) {\n return;\n }\n const selectedRange = this._chunkedSlides\n .map((slidesList, i) => {\n return {\n index: i,\n list: slidesList\n };\n })\n .find((slidesList) => {\n return slidesList.list.find(slide => slide.index === index) !== undefined;\n });\n if (!selectedRange) {\n return;\n }\n this._currentVisibleSlidesIndex = selectedRange.index;\n this._chunkedSlides[selectedRange.index].forEach((slide) => {\n slide.item.active = true;\n });\n }\n isIndexOnTheEdges(index) {\n return (index + 1 - this.itemsPerSlide <= 0 ||\n index + this.itemsPerSlide <= this._slides.length);\n }\n isIndexInRange(index) {\n if (this.singleSlideOffset && this._slidesWithIndexes) {\n const visibleIndexes = this._slidesWithIndexes.map((slide) => slide.index);\n return visibleIndexes.indexOf(index) >= 0;\n }\n return (index <= this.getLastVisibleIndex() &&\n index >= this.getFirstVisibleIndex());\n }\n hideSlides() {\n this.slides.forEach((slide) => slide.active = false);\n }\n isVisibleSlideListLast() {\n if (!this._chunkedSlides) {\n return false;\n }\n return this._currentVisibleSlidesIndex === this._chunkedSlides.length - 1;\n }\n isVisibleSlideListFirst() {\n return this._currentVisibleSlidesIndex === 0;\n }\n moveSliderByOneItem(direction) {\n let firstVisibleIndex;\n let lastVisibleIndex;\n let indexToHide;\n let indexToShow;\n if (this.noWrap) {\n firstVisibleIndex = this.getFirstVisibleIndex();\n lastVisibleIndex = this.getLastVisibleIndex();\n indexToHide = direction === Direction.NEXT\n ? firstVisibleIndex\n : lastVisibleIndex;\n indexToShow = direction !== Direction.NEXT\n ? firstVisibleIndex - 1\n : !this.isLast(lastVisibleIndex)\n ? lastVisibleIndex + 1 : 0;\n const slideToHide = this._slides.get(indexToHide);\n if (slideToHide) {\n slideToHide.active = false;\n }\n const slideToShow = this._slides.get(indexToShow);\n if (slideToShow) {\n slideToShow.active = true;\n }\n const slidesToReorder = this.mapSlidesAndIndexes().filter((slide) => slide.item.active);\n this.makeSlidesConsistent(slidesToReorder);\n if (this.singleSlideOffset) {\n this._slidesWithIndexes = slidesToReorder;\n }\n this.slideRangeChange.emit(this.getVisibleIndexes());\n return;\n }\n if (!this._slidesWithIndexes || !this._slidesWithIndexes[0]) {\n return;\n }\n let index;\n firstVisibleIndex = this._slidesWithIndexes[0].index;\n lastVisibleIndex = this._slidesWithIndexes[this._slidesWithIndexes.length - 1].index;\n if (direction === Direction.NEXT) {\n this._slidesWithIndexes.shift();\n index = this.isLast(lastVisibleIndex)\n ? 0\n : lastVisibleIndex + 1;\n const item = this._slides.get(index);\n if (item) {\n this._slidesWithIndexes.push({ index, item });\n }\n }\n else {\n this._slidesWithIndexes.pop();\n index = this.isFirst(firstVisibleIndex)\n ? this._slides.length - 1\n : firstVisibleIndex - 1;\n const item = this._slides.get(index);\n if (item) {\n this._slidesWithIndexes = [{ index, item }, ...this._slidesWithIndexes];\n }\n }\n this.hideSlides();\n this._slidesWithIndexes.forEach(slide => slide.item.active = true);\n this.makeSlidesConsistent(this._slidesWithIndexes);\n this.slideRangeChange.emit(this._slidesWithIndexes.map((slide) => slide.index));\n }\n moveMultilist(direction) {\n if (this.singleSlideOffset) {\n this.moveSliderByOneItem(direction);\n }\n else {\n this.hideSlides();\n if (this.noWrap) {\n this._currentVisibleSlidesIndex = direction === Direction.NEXT\n ? this._currentVisibleSlidesIndex + 1\n : this._currentVisibleSlidesIndex - 1;\n }\n else if (direction === Direction.NEXT) {\n this._currentVisibleSlidesIndex = this.isVisibleSlideListLast()\n ? 0\n : this._currentVisibleSlidesIndex + 1;\n }\n else {\n if (this.isVisibleSlideListFirst()) {\n this._currentVisibleSlidesIndex = this._chunkedSlides\n ? this._chunkedSlides.length - 1\n : 0;\n }\n else {\n this._currentVisibleSlidesIndex = this._currentVisibleSlidesIndex - 1;\n }\n }\n if (this._chunkedSlides) {\n this._chunkedSlides[this._currentVisibleSlidesIndex].forEach((slide) => slide.item.active = true);\n }\n this.slideRangeChange.emit(this.getVisibleIndexes());\n }\n }\n getVisibleIndexes() {\n if (!this.singleSlideOffset && this._chunkedSlides) {\n return this._chunkedSlides[this._currentVisibleSlidesIndex]\n .map((slide) => slide.index);\n }\n if (this._slidesWithIndexes) {\n return this._slidesWithIndexes.map((slide) => slide.index);\n }\n }\n /**\n * Sets a slide, which specified through index, as active\n * @param index\n */\n _select(index) {\n if (isNaN(index)) {\n this.pause();\n return;\n }\n if (!this.multilist && typeof this._currentActiveSlide !== 'undefined') {\n const currentSlide = this._slides.get(this._currentActiveSlide);\n if (typeof currentSlide !== 'undefined') {\n currentSlide.active = false;\n }\n }\n const nextSlide = this._slides.get(index);\n if (typeof nextSlide !== 'undefined') {\n this._currentActiveSlide = index;\n nextSlide.active = true;\n this.activeSlide = index;\n this.activeSlideChange.emit(index);\n }\n }\n /**\n * Starts loop of auto changing of slides\n */\n restartTimer() {\n this.resetTimer();\n const interval = +this.interval;\n if (!isNaN(interval) && interval > 0 && isPlatformBrowser(this.platformId)) {\n this.currentInterval = this.ngZone.runOutsideAngular(() => {\n return window.setInterval(() => {\n const nInterval = +this.interval;\n this.ngZone.run(() => {\n if (this.isPlaying &&\n !isNaN(this.interval) &&\n nInterval > 0 &&\n this.slides.length) {\n this.nextSlideFromInterval();\n }\n else {\n this.pause();\n }\n });\n }, interval);\n });\n }\n }\n get multilist() {\n return this.itemsPerSlide > 1;\n }\n /**\n * Stops loop of auto changing of slides\n */\n resetTimer() {\n if (this.currentInterval) {\n clearInterval(this.currentInterval);\n this.currentInterval = void 0;\n }\n }\n checkDisabledClass(buttonType) {\n if (buttonType === 'prev') {\n return (this.activeSlide === 0 && this.noWrap && !this.multilist) || (this.isFirstSlideVisible && this.noWrap && this.multilist);\n }\n return (this.isLast(this.activeSlide) && this.noWrap && !this.multilist) || (this.isLastSlideVisible && this.noWrap && this.multilist);\n }\n static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: \"12.0.0\", version: \"20.0.2\", ngImport: i0, type: CarouselComponent, deps: [{ token: i1.CarouselConfig }, { token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component }); }\n static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: \"14.0.0\", version: \"20.0.2\", type: CarouselComponent, isStandalone: true, selector: \"carousel\", inputs: { noWrap: \"noWrap\", noPause: \"noPause\", showIndicators: \"showIndicators\", pauseOnFocus: \"pauseOnFocus\", indicatorsByChunk: \"indicatorsByChunk\", itemsPerSlide: \"itemsPerSlide\", singleSlideOffset: \"singleSlideOffset\", isAnimated: \"isAnimated\", activeSlide: \"activeSlide\", startFromIndex: \"startFromIndex\", interval: \"interval\" }, outputs: { activeSlideChange: \"activeSlideChange\", slideRangeChange: \"slideRangeChange\" }, ngImport: i0, template: \"