ngx-bootstrap
Version:
Native Angular Bootstrap Components
15 lines (13 loc) • 106 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs/operators"),require("ngx-bootstrap/chronos"),require("ngx-bootstrap/positioning"),require("@angular/animations"),require("rxjs"),require("ngx-bootstrap/mini-ngrx"),require("ngx-bootstrap/component-loader"),require("@angular/forms"),require("@angular/common"),require("ngx-bootstrap/tooltip"),require("ngx-bootstrap/utils")):"function"==typeof define&&define.amd?define("ngx-bootstrap/datepicker",["exports","@angular/core","rxjs/operators","ngx-bootstrap/chronos","ngx-bootstrap/positioning","@angular/animations","rxjs","ngx-bootstrap/mini-ngrx","ngx-bootstrap/component-loader","@angular/forms","@angular/common","ngx-bootstrap/tooltip","ngx-bootstrap/utils"],t):t(((e=e||self)["ngx-bootstrap"]=e["ngx-bootstrap"]||{},e["ngx-bootstrap"].datepicker={}),e.ng.core,e.rxjs.operators,e.chronos,e.positioning,e.ng.animations,e.rxjs,e.miniNgrx,e.componentLoader,e.ng.forms,e.ng.common,e.tooltip,e.utils)}(this,(function(e,t,n,a,i,s,o,r,c,d,l,p,h){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function f(e,t){function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function y(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function b(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var a,i,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(a=s.next()).done;)o.push(a.value)}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var g=function(){function e(){this.adaptivePosition=!1,this.useUtc=!1,this.isAnimated=!1,this.returnFocusToInput=!1,this.containerClass="theme-green",this.displayMonths=1,this.showWeekNumbers=!0,this.dateInputFormat="L",this.rangeSeparator=" - ",this.rangeInputFormat="L",this.monthTitle="MMMM",this.yearTitle="YYYY",this.dayLabel="D",this.monthLabel="MMMM",this.yearLabel="YYYY",this.weekNumbers="w",this.showTodayButton=!1,this.showClearButton=!1,this.todayPosition="center",this.clearPosition="right"}return e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵprov=t["ɵɵdefineInjectable"]({factory:function(){return new e},token:e,providedIn:"root"}),e}();var m=s.trigger("datepickerAnimation",[s.state("animated-down",s.style({height:"*",overflow:"hidden"})),s.transition("* => animated-down",[s.style({height:0,overflow:"hidden"}),s.animate("220ms cubic-bezier(0, 0, 0.2, 1)")]),s.state("animated-up",s.style({height:"*",overflow:"hidden"})),s.transition("* => animated-up",[s.style({height:"*",overflow:"hidden"}),s.animate("220ms cubic-bezier(0, 0, 0.2, 1)")]),s.transition("* => unanimated",s.animate("0s"))]),v=function(){function e(){this.customRanges=[],this.chosenRange=[]}return Object.defineProperty(e.prototype,"minDate",{set:function(e){this._effects.setMinDate(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxDate",{set:function(e){this._effects.setMaxDate(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"daysDisabled",{set:function(e){this._effects.setDaysDisabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"datesDisabled",{set:function(e){this._effects.setDatesDisabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"datesEnabled",{set:function(e){this._effects.setDatesEnabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisabled",{set:function(e){this._effects.setDisabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateCustomClasses",{set:function(e){this._effects.setDateCustomClasses(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateTooltipTexts",{set:function(e){this._effects.setDateTooltipTexts(e)},enumerable:!0,configurable:!0}),e.prototype.setViewMode=function(e){},e.prototype.navigateTo=function(e){},e.prototype.dayHoverHandler=function(e){},e.prototype.weekHoverHandler=function(e){},e.prototype.monthHoverHandler=function(e){},e.prototype.yearHoverHandler=function(e){},e.prototype.daySelectHandler=function(e){},e.prototype.monthSelectHandler=function(e){},e.prototype.yearSelectHandler=function(e){},e.prototype.setRangeOnCalendar=function(e){},e.prototype.setToday=function(){},e.prototype.clearDate=function(){},e.prototype._stopPropagation=function(e){e.stopPropagation()},e}();var D=function(){function e(){}return e.prototype.calculate=function(){return{type:e.CALCULATE}},e.prototype.format=function(){return{type:e.FORMAT}},e.prototype.flag=function(){return{type:e.FLAG}},e.prototype.select=function(t){return{type:e.SELECT,payload:t}},e.prototype.changeViewMode=function(t){return{type:e.CHANGE_VIEWMODE,payload:t}},e.prototype.navigateTo=function(t){return{type:e.NAVIGATE_TO,payload:t}},e.prototype.navigateStep=function(t){return{type:e.NAVIGATE_OFFSET,payload:t}},e.prototype.setOptions=function(t){return{type:e.SET_OPTIONS,payload:t}},e.prototype.selectRange=function(t){return{type:e.SELECT_RANGE,payload:t}},e.prototype.hoverDay=function(t){return{type:e.HOVER,payload:t.isHovered?t.cell.date:null}},e.prototype.minDate=function(t){return{type:e.SET_MIN_DATE,payload:t}},e.prototype.maxDate=function(t){return{type:e.SET_MAX_DATE,payload:t}},e.prototype.daysDisabled=function(t){return{type:e.SET_DAYSDISABLED,payload:t}},e.prototype.datesDisabled=function(t){return{type:e.SET_DATESDISABLED,payload:t}},e.prototype.datesEnabled=function(t){return{type:e.SET_DATESENABLED,payload:t}},e.prototype.isDisabled=function(t){return{type:e.SET_IS_DISABLED,payload:t}},e.prototype.setDateCustomClasses=function(t){return{type:e.SET_DATE_CUSTOM_CLASSES,payload:t}},e.prototype.setDateTooltipTexts=function(t){return{type:e.SET_DATE_TOOLTIP_TEXTS,payload:t}},e.prototype.setLocale=function(t){return{type:e.SET_LOCALE,payload:t}},e.CALCULATE="[datepicker] calculate dates matrix",e.FORMAT="[datepicker] format datepicker values",e.FLAG="[datepicker] set flags",e.SELECT="[datepicker] select date",e.NAVIGATE_OFFSET="[datepicker] shift view date",e.NAVIGATE_TO="[datepicker] change view date",e.SET_OPTIONS="[datepicker] update render options",e.HOVER="[datepicker] hover date",e.CHANGE_VIEWMODE="[datepicker] switch view mode",e.SET_MIN_DATE="[datepicker] set min date",e.SET_MAX_DATE="[datepicker] set max date",e.SET_DAYSDISABLED="[datepicker] set days disabled",e.SET_DATESDISABLED="[datepicker] set dates disabled",e.SET_DATESENABLED="[datepicker] set dates enabled",e.SET_IS_DISABLED="[datepicker] set is disabled",e.SET_DATE_CUSTOM_CLASSES="[datepicker] set date custom classes",e.SET_DATE_TOOLTIP_TEXTS="[datepicker] set date tooltip texts",e.SET_LOCALE="[datepicker] set datepicker locale",e.SELECT_RANGE="[daterangepicker] select dates range",e.decorators=[{type:t.Injectable}],e}();var _=function(){function e(){this._defaultLocale="en",this._locale=new o.BehaviorSubject(this._defaultLocale),this._localeChange=this._locale.asObservable()}return Object.defineProperty(e.prototype,"locale",{get:function(){return this._locale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localeChange",{get:function(){return this._localeChange},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentLocale",{get:function(){return this._locale.getValue()},enumerable:!0,configurable:!0}),e.prototype.use=function(e){e!==this.currentLocale&&this._locale.next(e)},e.decorators=[{type:t.Injectable}],e}();var k=function(){function e(e,t){this._actions=e,this._localeService=t,this._subs=[]}return e.prototype.init=function(e){return this._store=e,this},e.prototype.setValue=function(e){this._store.dispatch(this._actions.select(e))},e.prototype.setRangeValue=function(e){this._store.dispatch(this._actions.selectRange(e))},e.prototype.setMinDate=function(e){return this._store.dispatch(this._actions.minDate(e)),this},e.prototype.setMaxDate=function(e){return this._store.dispatch(this._actions.maxDate(e)),this},e.prototype.setDaysDisabled=function(e){return this._store.dispatch(this._actions.daysDisabled(e)),this},e.prototype.setDatesDisabled=function(e){return this._store.dispatch(this._actions.datesDisabled(e)),this},e.prototype.setDatesEnabled=function(e){return this._store.dispatch(this._actions.datesEnabled(e)),this},e.prototype.setDisabled=function(e){return this._store.dispatch(this._actions.isDisabled(e)),this},e.prototype.setDateCustomClasses=function(e){return this._store.dispatch(this._actions.setDateCustomClasses(e)),this},e.prototype.setDateTooltipTexts=function(e){return this._store.dispatch(this._actions.setDateTooltipTexts(e)),this},e.prototype.setOptions=function(e){var t=Object.assign({locale:this._localeService.currentLocale},e);return this._store.dispatch(this._actions.setOptions(t)),this},e.prototype.setBindings=function(e){return e.daysCalendar=this._store.select((function(e){return e.flaggedMonths})).pipe(n.filter((function(e){return!!e}))),e.monthsCalendar=this._store.select((function(e){return e.flaggedMonthsCalendar})).pipe(n.filter((function(e){return!!e}))),e.yearsCalendar=this._store.select((function(e){return e.yearsCalendarFlagged})).pipe(n.filter((function(e){return!!e}))),e.viewMode=this._store.select((function(e){return e.view.mode})),e.options=this._store.select((function(e){return e.showWeekNumbers})).pipe(n.map((function(e){return{showWeekNumbers:e}}))),this},e.prototype.setEventHandlers=function(e){var t=this;return e.setViewMode=function(e){t._store.dispatch(t._actions.changeViewMode(e))},e.navigateTo=function(e){t._store.dispatch(t._actions.navigateStep(e.step))},e.dayHoverHandler=function(e){var n=e.cell;n.isOtherMonth||n.isDisabled||(t._store.dispatch(t._actions.hoverDay(e)),n.isHovered=e.isHovered)},e.monthHoverHandler=function(e){e.cell.isHovered=e.isHovered},e.yearHoverHandler=function(e){e.cell.isHovered=e.isHovered},this},e.prototype.registerDatepickerSideEffects=function(){var e=this;return this._subs.push(this._store.select((function(e){return e.view})).subscribe((function(t){e._store.dispatch(e._actions.calculate())}))),this._subs.push(this._store.select((function(e){return e.monthsModel})).pipe(n.filter((function(e){return!!e}))).subscribe((function(t){return e._store.dispatch(e._actions.format())}))),this._subs.push(this._store.select((function(e){return e.formattedMonths})).pipe(n.filter((function(e){return!!e}))).subscribe((function(t){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._store.select((function(e){return e.selectedDate})).pipe(n.filter((function(e){return!!e}))).subscribe((function(t){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._store.select((function(e){return e.selectedRange})).pipe(n.filter((function(e){return!!e}))).subscribe((function(t){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._store.select((function(e){return e.monthsCalendar})).subscribe((function(){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._store.select((function(e){return e.yearsCalendarModel})).pipe(n.filter((function(e){return!!e}))).subscribe((function(){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._store.select((function(e){return e.hoveredDate})).pipe(n.filter((function(e){return!!e}))).subscribe((function(t){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._store.select((function(e){return e.dateCustomClasses})).pipe(n.filter((function(e){return!!e}))).subscribe((function(t){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._store.select((function(e){return e.dateTooltipTexts})).pipe(n.filter((function(e){return!!e}))).subscribe((function(t){return e._store.dispatch(e._actions.flag())}))),this._subs.push(this._localeService.localeChange.subscribe((function(t){return e._store.dispatch(e._actions.setLocale(t))}))),this},e.prototype.destroy=function(){var e,t;try{for(var n=y(this._subs),a=n.next();!a.done;a=n.next()){a.value.unsubscribe()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.decorators=[{type:t.Injectable}],e.ctorParameters=function(){return[{type:D},{type:_}]},e}();var w={date:new Date,mode:"day"},C=Object.assign(new g,{locale:"en",view:w,selectedRange:[],monthViewOptions:{width:7,height:6}});function x(e,t,n){var i=t&&a.isBefore(a.endOf(e,"month"),t,"day"),s=n&&a.isAfter(a.startOf(e,"month"),n,"day");return i||s}function S(e,t,n){var i=t&&a.isBefore(a.endOf(e,"year"),t,"day"),s=n&&a.isAfter(a.startOf(e,"year"),n,"day");return i||s}function M(e,t){void 0===t&&(t=0);var n=e&&e.yearsCalendarModel&&e.yearsCalendarModel[t];return n&&n.years&&n.years[0]&&n.years[0][0]&&n.years[0][0].date}function I(e,t){for(var n=e.initialDate,i=new Array(e.height),s=0;s<e.height;s++){i[s]=new Array(e.width);for(var o=0;o<e.width;o++)i[s][o]=t(n),n=a.shiftDate(n,e.shift)}return i}function E(e,t){var n=a.getFirstDayOfMonth(e),i=function(e,t){if(a.isFirstDayOfWeek(e,t.firstDayOfWeek))return e;var n=function(e,t){if(0===t)return e;var n=e-t%7;return n<0?n+7:n}(a.getDay(e),t.firstDayOfWeek);return a.shiftDate(e,{day:-n})}(n,t);return{daysMatrix:I({width:t.width,height:t.height,initialDate:i,shift:{day:1}},(function(e){return e})),month:n}}function T(e){var t=a.getLocale(e),n=t.weekdaysShort(),i=t.firstDayOfWeek();return function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}(n.slice(i),n.slice(0,i))}function O(e,t){return e.weeks.forEach((function(n){n.days.forEach((function(i,s){var o,r,c=!a.isSameMonth(i.date,e.month),d=!c&&a.isSameDay(i.date,t.hoveredDate),l=!c&&t.selectedRange&&a.isSameDay(i.date,t.selectedRange[0]),p=!c&&t.selectedRange&&a.isSameDay(i.date,t.selectedRange[1]),h=!c&&a.isSameDay(i.date,t.selectedDate)||l||p,u=!c&&t.selectedRange&&function(e,t,n){if(!e||!t[0])return!1;if(t[1])return e>t[0]&&e<=t[1];if(n)return e>t[0]&&e<=n;return!1}(i.date,t.selectedRange,t.hoveredDate),f=t.isDisabled||a.isBefore(i.date,t.minDate,"day")||a.isAfter(i.date,t.maxDate,"day")||a.isDisabledDay(i.date,t.daysDisabled)||(o=i.date,!!((r=t.datesDisabled)&&a.isArray(r)&&r.length)&&r.some((function(e){return a.isSame(o,e,"date")})))||function(e,t){return!!(t&&a.isArray(t)&&t.length)&&!t.some((function(t){return a.isSame(e,t,"date")}))}(i.date,t.datesEnabled),y=new Date,b=!c&&a.isSameDay(i.date,y),g=t.dateCustomClasses&&t.dateCustomClasses.map((function(e){return a.isSameDay(i.date,e.date)?e.classes:[]})).reduce((function(e,t){return e.concat(t)}),[]).join(" ")||"",m=t.dateTooltipTexts&&t.dateTooltipTexts.map((function(e){return a.isSameDay(i.date,e.date)?e.tooltipText:""})).reduce((function(e,t){return e.concat(t)}),[]).join(" ")||"",v=Object.assign({},i,{isOtherMonth:c,isHovered:d,isSelected:h,isSelectionStart:l,isSelectionEnd:p,isInRange:u,isDisabled:f,isToday:b,customClasses:g,tooltipText:m});i.isOtherMonth===v.isOtherMonth&&i.isHovered===v.isHovered&&i.isSelected===v.isSelected&&i.isSelectionStart===v.isSelectionStart&&i.isSelectionEnd===v.isSelectionEnd&&i.isDisabled===v.isDisabled&&i.isInRange===v.isInRange&&i.customClasses===v.customClasses&&i.tooltipText===v.tooltipText||(n.days[s]=v)}))})),e.hideLeftArrow=t.isDisabled||t.monthIndex>0&&t.monthIndex!==t.displayMonths,e.hideRightArrow=t.isDisabled||t.monthIndex<t.displayMonths&&t.monthIndex+1!==t.displayMonths,e.disableLeftArrow=x(a.shiftDate(e.month,{month:-1}),t.minDate,t.maxDate),e.disableRightArrow=x(a.shiftDate(e.month,{month:1}),t.minDate,t.maxDate),e}function R(e,t){return!t||e>=t}var P={month:1};function A(e,t){return{months:I({width:3,height:4,initialDate:a.startOf(e,"year"),shift:P},(function(e){return{date:e,label:a.formatDate(e,t.monthLabel,t.locale)}})),monthTitle:"",yearTitle:a.formatDate(e,t.yearTitle,t.locale)}}var H=-1*(Math.floor(8)-1),V={year:1};function F(e,t,n){var i=I({width:4,height:4,initialDate:function(e,t){if(t&&e.getFullYear()>=t.getFullYear()&&e.getFullYear()<t.getFullYear()+16)return t;return a.shiftDate(e,{year:H})}(e,n),shift:V},(function(e){return{date:e,label:a.formatDate(e,t.yearLabel,t.locale)}}));return{years:i,monthTitle:"",yearTitle:function(e,t){var n=a.formatDate(e[0][0].date,t.yearTitle,t.locale),i=a.formatDate(e[3][3].date,t.yearTitle,t.locale);return n+" - "+i}(i,t)}}function L(e,t){switch(void 0===e&&(e=C),t.type){case D.CALCULATE:return function(e){var t=e.displayOneMonthRange&&Y(e.view.date,e.minDate,e.maxDate)?1:e.displayMonths,n=e.view.date;if("day"===e.view.mode){e.showPreviousMonth&&0===e.selectedRange.length&&(n=a.shiftDate(n,{month:-1})),e.monthViewOptions.firstDayOfWeek=a.getLocale(e.locale).firstDayOfWeek();for(var i=new Array(t),s=0;s<t;s++)i[s]=E(n,e.monthViewOptions),n=a.shiftDate(n,{month:1});return Object.assign({},e,{monthsModel:i})}if("month"===e.view.mode){for(var o=new Array(t),r=0;r<t;r++)o[r]=A(n,$(e)),n=a.shiftDate(n,{year:1});return Object.assign({},e,{monthsCalendar:o})}if("year"===e.view.mode){var c=new Array(t);for(r=0;r<t;r++)c[r]=F(n,$(e),"year"===e.minMode?M(e,r):void 0),n=a.shiftDate(n,{year:16});return Object.assign({},e,{yearsCalendarModel:c})}return e}(e);case D.FORMAT:return function(e,t){if("day"===e.view.mode){var n=e.monthsModel.map((function(t,n){return function(e,t,n){return{month:e.month,monthTitle:a.formatDate(e.month,t.monthTitle,t.locale),yearTitle:a.formatDate(e.month,t.yearTitle,t.locale),weekNumbers:(i=e.daysMatrix,s=t.weekNumbers,o=t.locale,i.map((function(e){return e[0]?a.formatDate(e[0],s,o):""}))),weekdays:T(t.locale),weeks:e.daysMatrix.map((function(e,i){return{days:e.map((function(e,s){return{date:e,label:a.formatDate(e,t.dayLabel,t.locale),monthIndex:n,weekIndex:i,dayIndex:s}}))}}))};var i,s,o}(t,$(e),n)}));return Object.assign({},e,{formattedMonths:n})}var i=e.displayMonths,s=e.view.date;if("month"===e.view.mode){for(var o=new Array(i),r=0;r<i;r++)o[r]=A(s,$(e)),s=a.shiftDate(s,{year:1});return Object.assign({},e,{monthsCalendar:o})}if("year"===e.view.mode){var c=new Array(i);for(r=0;r<i;r++)c[r]=F(s,$(e)),s=a.shiftDate(s,{year:16});return Object.assign({},e,{yearsCalendarModel:c})}return e}(e);case D.FLAG:return function(e,t){var n=Y(e.view.date,e.minDate,e.maxDate)?1:e.displayMonths;if("day"===e.view.mode){var i=e.formattedMonths.map((function(t,a){return O(t,{isDisabled:e.isDisabled,minDate:e.minDate,maxDate:e.maxDate,daysDisabled:e.daysDisabled,datesDisabled:e.datesDisabled,datesEnabled:e.datesEnabled,hoveredDate:e.hoveredDate,selectedDate:e.selectedDate,selectedRange:e.selectedRange,displayMonths:n,dateCustomClasses:e.dateCustomClasses,dateTooltipTexts:e.dateTooltipTexts,monthIndex:a})}));return Object.assign({},e,{flaggedMonths:i})}if("month"===e.view.mode){var s=e.monthsCalendar.map((function(t,i){return s=t,o={isDisabled:e.isDisabled,minDate:e.minDate,maxDate:e.maxDate,hoveredMonth:e.hoveredMonth,selectedDate:e.selectedDate,selectedRange:e.selectedRange,displayMonths:n,monthIndex:i},s.months.forEach((function(e,t){e.forEach((function(e,n){var i,r=a.isSameMonth(e.date,o.hoveredMonth),c=o.isDisabled||x(e.date,o.minDate,o.maxDate);!o.selectedDate&&o.selectedRange?(i=a.isSameMonth(e.date,o.selectedRange[0]))||(i=a.isSameMonth(e.date,o.selectedRange[1])):i=a.isSameMonth(e.date,o.selectedDate);var d=Object.assign(e,{isHovered:r,isDisabled:c,isSelected:i});e.isHovered===d.isHovered&&e.isDisabled===d.isDisabled&&e.isSelected===d.isSelected||(s.months[t][n]=d)}))})),s.hideLeftArrow=o.monthIndex>0&&o.monthIndex!==o.displayMonths,s.hideRightArrow=o.monthIndex<o.displayMonths&&o.monthIndex+1!==o.displayMonths,s.disableLeftArrow=S(a.shiftDate(s.months[0][0].date,{year:-1}),o.minDate,o.maxDate),s.disableRightArrow=S(a.shiftDate(s.months[0][0].date,{year:1}),o.minDate,o.maxDate),s;var s,o}));return Object.assign({},e,{flaggedMonthsCalendar:s})}if("year"===e.view.mode){var o=e.yearsCalendarModel.map((function(t,i){return function(e,t){e.years.forEach((function(n,i){n.forEach((function(n,s){var o,r=a.isSameYear(n.date,t.hoveredYear),c=t.isDisabled||S(n.date,t.minDate,t.maxDate);!t.selectedDate&&t.selectedRange?(o=a.isSameYear(n.date,t.selectedRange[0]))||(o=a.isSameYear(n.date,t.selectedRange[1])):o=a.isSameYear(n.date,t.selectedDate);var d=Object.assign(n,{isHovered:r,isDisabled:c,isSelected:o});n.isHovered===d.isHovered&&n.isDisabled===d.isDisabled&&n.isSelected===d.isSelected||(e.years[i][s]=d)}))})),e.hideLeftArrow=t.yearIndex>0&&t.yearIndex!==t.displayMonths,e.hideRightArrow=t.yearIndex<t.displayMonths&&t.yearIndex+1!==t.displayMonths,e.disableLeftArrow=S(a.shiftDate(e.years[0][0].date,{year:-1}),t.minDate,t.maxDate);var n=e.years.length-1,i=e.years[n].length-1;return e.disableRightArrow=S(a.shiftDate(e.years[n][i].date,{year:1}),t.minDate,t.maxDate),e}(t,{isDisabled:e.isDisabled,minDate:e.minDate,maxDate:e.maxDate,hoveredYear:e.hoveredYear,selectedDate:e.selectedDate,selectedRange:e.selectedRange,displayMonths:n,yearIndex:i})}));return Object.assign({},e,{yearsCalendarFlagged:o})}return e}(e);case D.NAVIGATE_OFFSET:return function(e,t){var n={view:{mode:e.view.mode,date:j(e,t)}};return Object.assign({},e,n)}(e,t);case D.NAVIGATE_TO:var n=t.payload,i=a.setFullDate(e.view.date,n.unit),s=void 0,o=void 0;return s=R(n.viewMode,e.minMode)?{view:{date:i,mode:o=n.viewMode}}:{selectedDate:i,view:{date:i,mode:o=e.view.mode}},Object.assign({},e,s);case D.CHANGE_VIEWMODE:if(!R(t.payload,e.minMode))return e;s={view:{date:i=e.view.date,mode:o=t.payload}};return Object.assign({},e,s);case D.HOVER:return Object.assign({},e,{hoveredDate:t.payload});case D.SELECT:s={selectedDate:t.payload,view:e.view},o=e.view.mode,i=B(t.payload||e.view.date,e.minDate,e.maxDate);return s.view={mode:o,date:i},Object.assign({},e,s);case D.SET_OPTIONS:o=(s=t.payload).minMode?s.minMode:e.view.mode,i=B(a.isDateValid(s.value)&&s.value||a.isArray(s.value)&&a.isDateValid(s.value[0])&&s.value[0]||e.view.date,s.minDate,s.maxDate);return s.view={mode:o,date:i},s.value&&(a.isArray(s.value)&&(s.selectedRange=s.value),s.value instanceof Date&&(s.selectedDate=s.value)),Object.assign({},e,s);case D.SELECT_RANGE:s={selectedRange:t.payload,view:e.view},o=e.view.mode,i=B(t.payload&&t.payload[0]||e.view.date,e.minDate,e.maxDate);return s.view={mode:o,date:i},Object.assign({},e,s);case D.SET_MIN_DATE:return Object.assign({},e,{minDate:t.payload});case D.SET_MAX_DATE:return Object.assign({},e,{maxDate:t.payload});case D.SET_IS_DISABLED:return Object.assign({},e,{isDisabled:t.payload});case D.SET_DATE_CUSTOM_CLASSES:return Object.assign({},e,{dateCustomClasses:t.payload});case D.SET_DATE_TOOLTIP_TEXTS:return Object.assign({},e,{dateTooltipTexts:t.payload});default:return e}}function j(e,t){if("year"===e.view.mode&&"year"===e.minMode){var n=M(e,0),i=a.shiftDate(n,{year:-H});return a.shiftDate(i,t.payload)}return a.shiftDate(a.startOf(e.view.date,"month"),t.payload)}function $(e){return{locale:e.locale,monthTitle:e.monthTitle,yearTitle:e.yearTitle,dayLabel:e.dayLabel,monthLabel:e.monthLabel,yearLabel:e.yearLabel,weekNumbers:e.weekNumbers}}function B(e,t,n){var i=Array.isArray(e)?e[0]:e;return t&&a.isAfter(t,i,"day")?t:n&&a.isBefore(n,i,"day")?n:i}function Y(e,t,n){return!(!n||!a.isSame(n,e,"day"))||!(!t||!n||t.getMonth()!==n.getMonth())}var N=function(e){function n(){var t=new o.BehaviorSubject({type:"[datepicker] dispatcher init"}),n=new r.MiniState(C,t,L);return e.call(this,t,L,n)||this}return f(n,e),n.decorators=[{type:t.Injectable}],n.ctorParameters=function(){return[]},n}(r.MiniStore),z=function(e){function s(n,a,i,s,o,r,c){var d=e.call(this)||this;return d._config=a,d._store=i,d._element=s,d._actions=o,d._positionService=c,d.valueChange=new t.EventEmitter,d.animationState="void",d._subs=[],d._effects=r,n.setStyle(s.nativeElement,"display","block"),n.setStyle(s.nativeElement,"position","absolute"),d}return f(s,e),Object.defineProperty(s.prototype,"value",{set:function(e){this._effects.setValue(e)},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){var e=this;this._positionService.setOptions({modifiers:{flip:{enabled:this._config.adaptivePosition}},allowedPositions:["top","bottom"]}),this._positionService.event$.pipe(n.take(1)).subscribe((function(){e._positionService.disable(),e._config.isAnimated?e.animationState=e.isTopPosition?"animated-up":"animated-down":e.animationState="unanimated"})),this.isOtherMonthsActive=this._config.selectFromOtherMonth,this.containerClass=this._config.containerClass,this.showTodayBtn=this._config.showTodayButton,this.todayPos=this._config.todayPosition,this.clearPos=this._config.clearPosition,this.showClearBtn=this._config.showClearButton,this._effects.init(this._store).setOptions(this._config).setBindings(this).setEventHandlers(this).registerDatepickerSideEffects(),this._subs.push(this._store.select((function(e){return e.selectedDate})).subscribe((function(t){return e.valueChange.emit(t)})))},Object.defineProperty(s.prototype,"isTopPosition",{get:function(){return this._element.nativeElement.classList.contains("top")},enumerable:!0,configurable:!0}),s.prototype.positionServiceEnable=function(){this._positionService.enable()},s.prototype.daySelectHandler=function(e){e&&((this.isOtherMonthsActive?e.isDisabled:e.isOtherMonth||e.isDisabled)||this._store.dispatch(this._actions.select(e.date)))},s.prototype.monthSelectHandler=function(e){e&&!e.isDisabled&&this._store.dispatch(this._actions.navigateTo({unit:{month:a.getMonth(e.date),year:a.getFullYear(e.date)},viewMode:"day"}))},s.prototype.yearSelectHandler=function(e){e&&!e.isDisabled&&this._store.dispatch(this._actions.navigateTo({unit:{year:a.getFullYear(e.date)},viewMode:"month"}))},s.prototype.setToday=function(){this._store.dispatch(this._actions.select(new Date))},s.prototype.clearDate=function(){this._store.dispatch(this._actions.select(void 0))},s.prototype.ngOnDestroy=function(){var e,t;try{for(var n=y(this._subs),a=n.next();!a.done;a=n.next()){a.value.unsubscribe()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._effects.destroy()},s.decorators=[{type:t.Component,args:[{selector:"bs-datepicker-container",providers:[N,k],template:'\x3c!-- days calendar view mode --\x3e\n<div class="bs-datepicker" [ngClass]="containerClass" *ngIf="viewMode | async">\n <div class="bs-datepicker-container"\n [@datepickerAnimation]="animationState"\n (@datepickerAnimation.done)="positionServiceEnable()">\n \x3c!--calendars--\x3e\n <div class="bs-calendar-container" [ngSwitch]="viewMode | async" role="application">\n \x3c!--days calendar--\x3e\n <div *ngSwitchCase="\'day\'" class="bs-media-container">\n <bs-days-calendar-view\n *ngFor="let calendar of daysCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n [options]="options | async"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="dayHoverHandler($event)"\n (onHoverWeek)="weekHoverHandler($event)"\n (onSelect)="daySelectHandler($event)">\n </bs-days-calendar-view>\n </div>\n\n \x3c!--months calendar--\x3e\n <div *ngSwitchCase="\'month\'" class="bs-media-container">\n <bs-month-calendar-view\n *ngFor="let calendar of monthsCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="monthHoverHandler($event)"\n (onSelect)="monthSelectHandler($event)">\n </bs-month-calendar-view>\n </div>\n\n \x3c!--years calendar--\x3e\n <div *ngSwitchCase="\'year\'" class="bs-media-container">\n <bs-years-calendar-view\n *ngFor="let calendar of yearsCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="yearHoverHandler($event)"\n (onSelect)="yearSelectHandler($event)">\n </bs-years-calendar-view>\n </div>\n </div>\n\n \x3c!--applycancel buttons--\x3e\n <div class="bs-datepicker-buttons" *ngIf="false">\n <button class="btn btn-success" type="button">Apply</button>\n <button class="btn btn-default" type="button">Cancel</button>\n </div>\n\n <div class="bs-datepicker-buttons" *ngIf="showTodayBtn || showClearBtn">\n <div class="btn-today-wrapper"\n [class.today-left]="todayPos === \'left\'"\n [class.today-right]="todayPos === \'right\'"\n [class.today-center]="todayPos === \'center\'"\n *ngIf="showTodayBtn">\n <button class="btn btn-success" (click)="setToday()">Today</button>\n </div>\n\n <div class="btn-clear-wrapper"\n [class.clear-left]="clearPos === \'left\'"\n [class.clear-right]="clearPos === \'right\'"\n [class.clear-center]="clearPos === \'center\'"\n *ngIf="showClearBtn">\n <button class="btn btn-success" (click)="clearDate()">Clear</button>\n </div>\n </div>\n\n </div>\n\n \x3c!--custom dates or date ranges picker--\x3e\n <div class="bs-datepicker-custom-range" *ngIf="customRanges?.length > 0">\n <bs-custom-date-view\n [selectedRange]="chosenRange"\n [ranges]="customRanges"\n (onSelect)="setRangeOnCalendar($event)">\n </bs-custom-date-view>\n </div>\n</div>\n',host:{class:"bottom","(click)":"_stopPropagation($event)",role:"dialog","aria-label":"calendar"},animations:[m]}]}],s.ctorParameters=function(){return[{type:t.Renderer2},{type:g},{type:N},{type:t.ElementRef},{type:D},{type:k},{type:i.PositioningService}]},s}(v);var W=function(){function e(e,n,a,i,s){this._config=e,this._elementRef=n,this._renderer=a,this.placement="bottom",this.triggers="click",this.outsideClick=!0,this.container="body",this.outsideEsc=!0,this.bsValueChange=new t.EventEmitter,this._subs=[],this._dateInputFormat$=new o.Subject,Object.assign(this,this._config),this._datepicker=s.createLoader(n,i,a),this.onShown=this._datepicker.onShown,this.onHidden=this._datepicker.onHidden,this.isOpen$=new o.BehaviorSubject(this.isOpen)}return Object.defineProperty(e.prototype,"isOpen",{get:function(){return this._datepicker.isShown},set:function(e){this.isOpen$.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bsValue",{set:function(e){this._bsValue&&e&&this._bsValue.getTime()===e.getTime()||(this._bsValue=e,this.bsValueChange.emit(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bsConfig",{get:function(){return this._bsConfig},set:function(e){this._bsConfig=e,this.setConfig(),this._dateInputFormat$.next(e&&e.dateInputFormat)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dateInputFormat$",{get:function(){return this._dateInputFormat$},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.isDestroy$=new o.Subject,this._datepicker.listen({outsideClick:this.outsideClick,outsideEsc:this.outsideEsc,triggers:this.triggers,show:function(){return e.show()}}),this.setConfig()},e.prototype.ngOnChanges=function(e){this._datepickerRef&&this._datepickerRef.instance&&(e.minDate&&(this._datepickerRef.instance.minDate=this.minDate),e.maxDate&&(this._datepickerRef.instance.maxDate=this.maxDate),e.daysDisabled&&(this._datepickerRef.instance.daysDisabled=this.daysDisabled),e.datesDisabled&&(this._datepickerRef.instance.datesDisabled=this.datesDisabled),e.datesEnabled&&(this._datepickerRef.instance.datesEnabled=this.datesEnabled),e.isDisabled&&(this._datepickerRef.instance.isDisabled=this.isDisabled),e.dateCustomClasses&&(this._datepickerRef.instance.dateCustomClasses=this.dateCustomClasses),e.dateTooltipTexts&&(this._datepickerRef.instance.dateTooltipTexts=this.dateTooltipTexts))},e.prototype.ngAfterViewInit=function(){var e=this;this.isOpen$.pipe(n.filter((function(t){return t!==e.isOpen})),n.takeUntil(this.isDestroy$)).subscribe((function(){return e.toggle()}))},e.prototype.show=function(){var e=this;this._datepicker.isShown||(this.setConfig(),this._datepickerRef=this._datepicker.provide({provide:g,useValue:this._config}).attach(z).to(this.container).position({attachment:this.placement}).show({placement:this.placement}),this._subs.push(this.bsValueChange.subscribe((function(t){e._datepickerRef.instance.value=t}))),this._subs.push(this._datepickerRef.instance.valueChange.subscribe((function(t){e.bsValue=t,e.hide()}))))},e.prototype.hide=function(){var e,t;this.isOpen&&this._datepicker.hide();try{for(var n=y(this._subs),a=n.next();!a.done;a=n.next()){a.value.unsubscribe()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._config.returnFocusToInput&&this._renderer.selectRootElement(this._elementRef.nativeElement).focus()},e.prototype.toggle=function(){if(this.isOpen)return this.hide();this.show()},e.prototype.setConfig=function(){this._config=Object.assign({},this._config,this.bsConfig,{value:this._bsValue,isDisabled:this.isDisabled,minDate:this.minDate||this.bsConfig&&this.bsConfig.minDate,maxDate:this.maxDate||this.bsConfig&&this.bsConfig.maxDate,daysDisabled:this.daysDisabled||this.bsConfig&&this.bsConfig.daysDisabled,dateCustomClasses:this.dateCustomClasses||this.bsConfig&&this.bsConfig.dateCustomClasses,dateTooltipTexts:this.dateTooltipTexts||this.bsConfig&&this.bsConfig.dateTooltipTexts,datesDisabled:this.datesDisabled||this.bsConfig&&this.bsConfig.datesDisabled,datesEnabled:this.datesEnabled||this.bsConfig&&this.bsConfig.datesEnabled,minMode:this.minMode||this.bsConfig&&this.bsConfig.minMode})},e.prototype.ngOnDestroy=function(){this._datepicker.dispose(),this.isOpen$.next(!1),this.isDestroy$&&(this.isDestroy$.next(),this.isDestroy$.complete())},e.decorators=[{type:t.Directive,args:[{selector:"[bsDatepicker]",exportAs:"bsDatepicker"}]}],e.ctorParameters=function(){return[{type:g},{type:t.ElementRef},{type:t.Renderer2},{type:t.ViewContainerRef},{type:c.ComponentLoaderFactory}]},e.propDecorators={placement:[{type:t.Input}],triggers:[{type:t.Input}],outsideClick:[{type:t.Input}],container:[{type:t.Input}],outsideEsc:[{type:t.Input}],isOpen:[{type:t.Input}],onShown:[{type:t.Output}],onHidden:[{type:t.Output}],bsValue:[{type:t.Input}],bsConfig:[{type:t.Input}],isDisabled:[{type:t.Input}],minDate:[{type:t.Input}],maxDate:[{type:t.Input}],minMode:[{type:t.Input}],daysDisabled:[{type:t.Input}],datesDisabled:[{type:t.Input}],datesEnabled:[{type:t.Input}],dateCustomClasses:[{type:t.Input}],dateTooltipTexts:[{type:t.Input}],bsValueChange:[{type:t.Output}]},e}();var G=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return f(n,e),n.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],n.ɵprov=t["ɵɵdefineInjectable"]({factory:function(){return new n},token:n,providedIn:"root"}),n}(g),U=function(e){function n(t,n,a,i,s,o,r){var c=e.call(this,t,n,a,i,s,o,r)||this;return t.setStyle(i.nativeElement,"display","inline-block"),t.setStyle(i.nativeElement,"position","static"),c}return f(n,e),n.decorators=[{type:t.Component,args:[{selector:"bs-datepicker-inline-container",providers:[N,k],template:'\x3c!-- days calendar view mode --\x3e\n<div class="bs-datepicker" [ngClass]="containerClass" *ngIf="viewMode | async">\n <div class="bs-datepicker-container"\n [@datepickerAnimation]="animationState"\n (@datepickerAnimation.done)="positionServiceEnable()">\n \x3c!--calendars--\x3e\n <div class="bs-calendar-container" [ngSwitch]="viewMode | async" role="application">\n \x3c!--days calendar--\x3e\n <div *ngSwitchCase="\'day\'" class="bs-media-container">\n <bs-days-calendar-view\n *ngFor="let calendar of daysCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n [options]="options | async"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="dayHoverHandler($event)"\n (onHoverWeek)="weekHoverHandler($event)"\n (onSelect)="daySelectHandler($event)">\n </bs-days-calendar-view>\n </div>\n\n \x3c!--months calendar--\x3e\n <div *ngSwitchCase="\'month\'" class="bs-media-container">\n <bs-month-calendar-view\n *ngFor="let calendar of monthsCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="monthHoverHandler($event)"\n (onSelect)="monthSelectHandler($event)">\n </bs-month-calendar-view>\n </div>\n\n \x3c!--years calendar--\x3e\n <div *ngSwitchCase="\'year\'" class="bs-media-container">\n <bs-years-calendar-view\n *ngFor="let calendar of yearsCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="yearHoverHandler($event)"\n (onSelect)="yearSelectHandler($event)">\n </bs-years-calendar-view>\n </div>\n </div>\n\n \x3c!--applycancel buttons--\x3e\n <div class="bs-datepicker-buttons" *ngIf="false">\n <button class="btn btn-success" type="button">Apply</button>\n <button class="btn btn-default" type="button">Cancel</button>\n </div>\n\n <div class="bs-datepicker-buttons" *ngIf="showTodayBtn || showClearBtn">\n <div class="btn-today-wrapper"\n [class.today-left]="todayPos === \'left\'"\n [class.today-right]="todayPos === \'right\'"\n [class.today-center]="todayPos === \'center\'"\n *ngIf="showTodayBtn">\n <button class="btn btn-success" (click)="setToday()">Today</button>\n </div>\n\n <div class="btn-clear-wrapper"\n [class.clear-left]="clearPos === \'left\'"\n [class.clear-right]="clearPos === \'right\'"\n [class.clear-center]="clearPos === \'center\'"\n *ngIf="showClearBtn">\n <button class="btn btn-success" (click)="clearDate()">Clear</button>\n </div>\n </div>\n\n </div>\n\n \x3c!--custom dates or date ranges picker--\x3e\n <div class="bs-datepicker-custom-range" *ngIf="customRanges?.length > 0">\n <bs-custom-date-view\n [selectedRange]="chosenRange"\n [ranges]="customRanges"\n (onSelect)="setRangeOnCalendar($event)">\n </bs-custom-date-view>\n </div>\n</div>\n',host:{"(click)":"_stopPropagation($event)"},animations:[m]}]}],n.ctorParameters=function(){return[{type:t.Renderer2},{type:g},{type:N},{type:t.ElementRef},{type:D},{type:k},{type:i.PositioningService}]},n}(z),q=function(){function e(e,n,a,i,s){this._config=e,this._elementRef=n,this.bsValueChange=new t.EventEmitter,this._subs=[],Object.assign(this,this._config),this._datepicker=s.createLoader(n,i,a)}return Object.defineProperty(e.prototype,"bsValue",{set:function(e){this._bsValue!==e&&(this._bsValue=e,this.bsValueChange.emit(e))},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this;this.setConfig(),this._subs.push(this.bsValueChange.subscribe((function(t){e._datepickerRef.instance.value=t}))),this._subs.push(this._datepickerRef.instance.valueChange.subscribe((function(t){e.bsValue=t})))},e.prototype.ngOnChanges=function(e){this._datepickerRef&&this._datepickerRef.instance&&(e.minDate&&(this._datepickerRef.instance.minDate=this.minDate,this.setConfig()),e.maxDate&&(this._datepickerRef.instance.maxDate=this.maxDate,this.setConfig()),e.datesDisabled&&(this._datepickerRef.instance.datesDisabled=this.datesDisabled,this.setConfig()),e.datesEnabled&&(this._datepickerRef.instance.datesEnabled=this.datesEnabled,this._datepickerRef.instance.value=this._bsValue),e.isDisabled&&(this._datepickerRef.instance.isDisabled=this.isDisabled,this.setConfig()),e.dateCustomClasses&&(this._datepickerRef.instance.dateCustomClasses=this.dateCustomClasses,this.setConfig()),e.dateTooltipTexts&&(this._datepickerRef.instance.dateTooltipTexts=this.dateTooltipTexts,this.setConfig()))},e.prototype.setConfig=function(){this._datepicker&&this._datepicker.hide(),this._config=Object.assign({},this._config,this.bsConfig,{value:this._bsValue,isDisabled:this.isDisabled,minDate:this.minDate||this.bsConfig&&this.bsConfig.minDate,maxDate:this.maxDate||this.bsConfig&&this.bsConfig.maxDate,dateCustomClasses:this.dateCustomClasses||this.bsConfig&&this.bsConfig.dateCustomClasses,dateTooltipTexts:this.dateTooltipTexts||this.bsConfig&&this.bsConfig.dateTooltipTexts,datesDisabled:this.datesDisabled||this.bsConfig&&this.bsConfig.datesDisabled,datesEnabled:this.datesEnabled||this.bsConfig&&this.bsConfig.datesEnabled}),this._datepickerRef=this._datepicker.provide({provide:g,useValue:this._config}).attach(U).to(this._elementRef).show()},e.prototype.ngOnDestroy=function(){this._datepicker.dispose()},e.decorators=[{type:t.Directive,args:[{selector:"bs-datepicker-inline",exportAs:"bsDatepickerInline"}]}],e.ctorParameters=function(){return[{type:G},{type:t.ElementRef},{type:t.Renderer2},{type:t.ViewContainerRef},{type:c.ComponentLoaderFactory}]},e.propDecorators={bsValue:[{type:t.Input}],bsConfig:[{type:t.Input}],isDisabled:[{type:t.Input}],minDate:[{type:t.Input}],maxDate:[{type:t.Input}],dateCustomClasses:[{type:t.Input}],dateTooltipTexts:[{type:t.Input}],datesEnabled:[{type:t.Input}],datesDisabled:[{type:t.Input}],bsValueChange:[{type:t.Output}]},e}();var Z=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.displayMonths=2,t.isAnimated=!1,t}return f(n,e),n.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],n.ɵprov=t["ɵɵdefineInjectable"]({factory:function(){return new n},token:n,providedIn:"root"}),n}(g);var K=function(e){function s(n,a,i,s,o,r,c){var d=e.call(this)||this;return d._config=a,d._store=i,d._element=s,d._actions=o,d._positionService=c,d.valueChange=new t.EventEmitter,d.animationState="void",d._rangeStack=[],d.chosenRange=[],d._subs=[],d._effects=r,d.customRanges=d._config.ranges,n.setStyle(s.nativeElement,"display","block"),n.setStyle(s.nativeElement,"position","absolute"),d}return f(s,e),Object.defineProperty(s.prototype,"value",{set:function(e){this._effects.setRangeValue(e)},enumerable:!0,configurable:!0}),s.prototype.ngOnInit=function(){var e=this;this._positionService.setOptions({modifiers:{flip:{enabled:this._config.adaptivePosition}},allowedPositions:["top","bottom"]}),this._positionService.event$.pipe(n.take(1)).subscribe((function(){e._positionService.disable(),e._config.isAnimated?e.animationState=e.isTopPosition?"animated-up":"animated-down":e.animationState="unanimated"})),this.containerClass=this._config.containerClass,this.isOtherMonthsActive=this._config.selectFromOtherMonth,this._effects.init(this._store).setOptions(this._config).setBindings(this).setEventHandlers(this).registerDatepickerSideEffects(),this._subs.push(this._store.select((function(e){return e.selectedRange})).subscribe((function(t){e.valueChange.emit(t),e.chosenRange=t})))},Object.defineProperty(s.prototype,"isTopPosition",{get:function(){return this._element.nativeElement.classList.contains("top")},enumerable:!0,configurable:!0}),s.prototype.positionServiceEnable=function(){this._positionService.enable()},s.prototype.daySelectHandler=function(e){e&&((this.isOtherMonthsActive?e.isDisabled:e.isOtherMonth||e.isDisabled)||this.rangesProcessing(e))},s.prototype.monthSelectHandler=function(e){if(e)if(e.isSelected=!0,"month"===this._config.minMode)this.rangesProcessing(e);else{if(e.isDisabled)return;this._store.dispatch(this._actions.navigateTo({unit:{month:a.getMonth(e.date),year:a.getFullYear(e.date)},viewMode:"day"}))}},s.prototype.yearSelectHandler=function(e){if(e)if(e.isSelected=!0,"year"===this._config.minMode)this.rangesProcessing(e);else{if(e.isDisabled)return;this._store.dispatch(this._actions.navigateTo({unit:{year:a.getFullYear(e.date)},viewMode:"month"}))}},s.prototype.rangesProcessing=function(e){1===this._rangeStack.length&&(this._rangeStack=e.date>=this._rangeStack[0]?[this._rangeStack[0],e.date]:[e.date]),0===this._rangeStack.length&&(this._rangeStack=[e.date],this._config.maxDateRange&&this.setMaxDateRangeOnCalendar(e.date)),this._store.dispatch(this._actions.selectRange(this._rangeStack)),2===this._rangeStack.length&&(this._rangeStack=[])},s.prototype.ngOnDestroy=function(){var e,t;try{for(var n=y(this._subs),a=n.next();!a.done;a=n.next()){a.value.unsubscribe()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._effects.destroy()},s.prototype.setRangeOnCalendar=function(e){this._rangeStack=null===e?[]:e.value instanceof Date?[e.value]:e.value,this._store.dispatch(this._actions.selectRange(this._rangeStack))},s.prototype.setMaxDateRangeOnCalendar=function(e){var t=new Date(e);t.setDate(e.getDate()+this._config.maxDateRange),this._effects.setMaxDate(t)},s.decorators=[{type:t.Component,args:[{selector:"bs-daterangepicker-container",providers:[N,k],template:'\x3c!-- days calendar view mode --\x3e\n<div class="bs-datepicker" [ngClass]="containerClass" *ngIf="viewMode | async">\n <div class="bs-datepicker-container"\n [@datepickerAnimation]="animationState"\n (@datepickerAnimation.done)="positionServiceEnable()">\n \x3c!--calendars--\x3e\n <div class="bs-calendar-container" [ngSwitch]="viewMode | async" role="application">\n \x3c!--days calendar--\x3e\n <div *ngSwitchCase="\'day\'" class="bs-media-container">\n <bs-days-calendar-view\n *ngFor="let calendar of daysCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n [options]="options | async"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="dayHoverHandler($event)"\n (onHoverWeek)="weekHoverHandler($event)"\n (onSelect)="daySelectHandler($event)">\n </bs-days-calendar-view>\n </div>\n\n \x3c!--months calendar--\x3e\n <div *ngSwitchCase="\'month\'" class="bs-media-container">\n <bs-month-calendar-view\n *ngFor="let calendar of monthsCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="monthHoverHandler($event)"\n (onSelect)="monthSelectHandler($event)">\n </bs-month-calendar-view>\n </div>\n\n \x3c!--years calendar--\x3e\n <div *ngSwitchCase="\'year\'" class="bs-media-container">\n <bs-years-calendar-view\n *ngFor="let calendar of yearsCalendar | async"\n [class.bs-datepicker-multiple]="(daysCalendar | async)?.length > 1"\n [calendar]="calendar"\n (onNavigate)="navigateTo($event)"\n (onViewMode)="setViewMode($event)"\n (onHover)="yearHoverHandler($event)"\n (onSelect)="yearSelectHandler($event)">\n </bs-years-calendar-view>\n </div>\n </div>\n\n \x3c!--applycancel buttons--\x3e\n <div class="bs-datepicker-buttons" *ngIf="false">\n <button class="btn btn-success" type="button">Apply</button>\n <button class="btn btn-default" type="button">Cancel</button>\n </div>\n\n <div class="bs-datepicker-buttons" *ngIf="showTodayBtn || showClearBtn">\n <div class="btn-today-wrapper"\n [class.today-left]="todayPos === \'left\'"\n [class.today-right]="todayPos === \'right\'"\n [class.today-center]="todayPos === \'center\'"\n *ngIf="showTodayBtn">\n <button class="btn btn-success" (click)="setToday()">Today</button>\n </div>\n\n <div class="btn-clear-wrapper"\n [class.clear-left]="clearPos === \'left\'"\n [class.clear-right]="clearPos === \'right\'"\n [class.clear-center]="clearPos === \'center\'"\n *ngIf="showClearBtn">\n <button class="btn btn-success" (click)="clearDate()">Clear</button>\n </div>\n </div>\n\n </div>\n\n \x3c!--custom dates or date ranges picker--\x3e\n <div class="bs-datepicker-custom-range" *ngIf="customRanges?.length > 0">\n <bs-custom-date-view\n [selectedRange]="chosenRange"\n [ranges]="customRanges"\n (onSelect)="setRangeOnCalendar($event)">\n </bs-custom-date-view>\n </div>\n</div>\n',host:{class:"bottom","(click)":"_stopPropagation($event)",role:"dialog","aria-label":"calendar"},animations:[m]}]}],s.ctorParameters=function(){return[{type:t.Renderer2},{type:g},{type:N},{type:t.ElementRef},{type:D},{type:k}