!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/common"),require("@angular/core")):"function"==typeof define&&define.amd?define("pm-calendar",["exports","@angular/common","@angular/core"],t):t(e["pm-calendar"]={},e.ng.common,e.ng.core)}(this,function(e,t,r){"use strict";var n="fr",a={months:{full:{fr:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"],en:["January","February","March","April","May","June","July","August","September","October","November","December"]},"short":{fr:["Jan","Fev","Mar","Avr","Mai","Jui","Jul","Aou","Sep","Oct","Nov","Dec"],en:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}},days:{full:{fr:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],en:["Sunday","Monday","Thuesday","Wednesday","Thursday","Friday","Saturday"]},"short":{fr:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],en:["Sun","Mon","Thu","Wed","Thu","Fri","Sat"]}}};function x(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}var i=(o.prototype.getDays=function(){return this.days},o.prototype.getWeekNumber=function(){return this.week_number},o.prototype.getMonthNumber=function(){return this.month_number},o);function o(e,t,r){this.month_number=e,this.week_number=t,this.days=r}var l=(s.prototype.getWeeks=function(){return this.weeks},s.prototype.getFullMonth=function(e){return void 0===e&&(e=n),a.months.full[e][this.month_number]},s.prototype.getMonth=function(e){return void 0===e&&(e=n),a.months["short"][e][this.month_number]},s.prototype.getMonthNumber=function(){return this.month_number},s.prototype.getYear=function(){return this.year},s);function s(e,t,r){this.year=e,this.month_number=t,this.weeks=r}var c=(d.prototype.getClasses=function(){return this.classes},d.prototype.addClass=function(e){this.classes.indexOf(e)<0&&this.classes.push(e)},d.prototype.removeClass=function(e){var t=this.classes.indexOf(e);-1<t&&this.classes.splice(t,1)},d.prototype.setClasses=function(e){this.classes=e},d.prototype.getWeekNumber=function(){return this.week_number},d.prototype.getObjDate=function(){return this.date},d);function d(e,t,r){void 0===r&&(r=[]),this.week_number=e,this.date=t,this.classes=r}var u=(h.prototype.getFirstDayOfWeek=function(e,t){for(var r=new Date(e,t);0<r.getDay();)r.setDate(r.getDate()-1);return r},h.prototype.getWeekDays=function(e,t,r){var n=[],a=this.getFirstDayOfWeek(t,r);a.setDate(a.getDate()+7*e);for(var o=0;o<7;){var s=new Date(a.getTime()),i=s.getMonth()==r?e:-1,l=new c(i,s);n.push(l),a.setDate(a.getDate()+1),o++}return n},h.prototype.getMonthDays=function(e,t){for(var r=new Date(e,t,1),n=[],a=0;r.getMonth()==t;a++){var o=this.getWeekDays(a,e,t),s=new i(t,a,o);n.push(s),r=o[o.length-1].getObjDate()}return n},h.prototype.getMonthsFromTo=function(e,t){for(var r=[],n=e.getMonth(),a=e.getFullYear(),o=new Date(e.getFullYear(),e.getMonth());o.getTime()<t.getTime();){o.setTime(new Date(a,n).getTime());var s=this.getMonthDays(a,n),i=new l(a,n,s);r.push(i),0==(n=(n+1)%11)&&a++}return r},h);function h(){}var y=(p.prototype.getMonths=function(){return this.months},p.prototype.getDay=function(e){var t,r,n,a,o,s;try{for(var i=x(this.months),l=i.next();!l.done;l=i.next()){var c=l.value;try{for(var d=x(c.getWeeks()),u=d.next();!u.done;u=d.next()){var h=u.value;try{for(var y=x(h.getDays()),p=y.next();!p.done;p=y.next()){var f=p.value;if(-1!==f.getWeekNumber()){var g=new Date(e.getFullYear(),e.getMonth(),e.getDate()),m=f.getObjDate();if(new Date(m.getUTCFullYear(),m.getMonth(),m.getDate()).getTime()==g.getTime())return f}}}catch(v){o={error:v}}finally{try{p&&!p.done&&(s=y["return"])&&s.call(y)}finally{if(o)throw o.error}}}}catch(D){n={error:D}}finally{try{u&&!u.done&&(a=d["return"])&&a.call(d)}finally{if(n)throw n.error}}}}catch(w){t={error:w}}finally{try{l&&!l.done&&(r=i["return"])&&r.call(i)}finally{if(t)throw t.error}}return!1},p.prototype.getDaysInInterval=function(e,t){var r,n,a,o,s,i,l=[];try{for(var c=x(this.months),d=c.next();!d.done;d=c.next()){var u=d.value;try{for(var h=x(u.getWeeks()),y=h.next();!y.done;y=h.next()){var p=y.value;try{for(var f=x(p.getDays()),g=f.next();!g.done;g=f.next()){var m=g.value,v=new Date(e.getFullYear(),e.getMonth(),e.getDate()),D=new Date(t.getFullYear(),t.getMonth(),t.getDate()),w=m.getObjDate(),b=new Date(w.getUTCFullYear(),w.getMonth(),w.getDate());b.getTime()>=v.getTime()&&b.getTime()<=D.getTime()&&l.push(m)}}catch(M){s={error:M}}finally{try{g&&!g.done&&(i=f["return"])&&i.call(f)}finally{if(s)throw s.error}}}}catch(_){a={error:_}}finally{try{y&&!y.done&&(o=h["return"])&&o.call(h)}finally{if(a)throw a.error}}}}catch(k){r={error:k}}finally{try{d&&!d.done&&(n=c["return"])&&n.call(c)}finally{if(r)throw r.error}}return l},p);function p(e,t){this.months=(new u).getMonthsFromTo(e,t)}var f=(g.prototype.generateCalendar=function(e,t,r){if(!r)throw new Error("This method is reserved to CalendarComponent");return this.calendar_months=new y(e,t),this.triggerCalendarReady(),this.calendar_months},g.prototype.getDay=function(e){return this.calendar_months.getDay(e)},g.prototype.getDaysInInterval=function(e,t){return this.calendar_months.getDaysInInterval(e,t)},g.prototype.triggerDaySelect=function(e,t){var r,n;if(!t)throw new Error("This method is reserved to DayComponent");try{for(var a=x(this.actions_date_selected),o=a.next();!o.done;o=a.next())(0,o.value)(e)}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=a["return"])&&n.call(a)}finally{if(r)throw r.error}}},g.prototype.onDateSelected=function(e){this.actions_date_selected.push(e)},g.prototype.triggerCalendarReady=function(){var e,t;try{for(var r=x(this.actions_calendar_selected),n=r.next();!n.done;n=r.next())(0,n.value)()}catch(a){e={error:a}}finally{try{n&&!n.done&&(t=r["return"])&&t.call(r)}finally{if(e)throw e.error}}},g.prototype.onCalendarReady=function(e){this.actions_calendar_selected.push(e)},g.prototype.clearEvents=function(){this.actions_date_selected=[]},g.decorators=[{type:r.Injectable}],g);function g(){this.actions_date_selected=[],this.actions_calendar_selected=[]}var m=(v.prototype.ngOnInit=function(){if(!this.datestart||!this.dateend)throw new Error("You must define [datestart] and [dateend] in pm-calendar component !");this.displayed_months=this.calendarService.generateCalendar(this.datestart,this.dateend,this),null==this.lang&&(this.lang=n),this.str_days=a.days.full[this.lang]},v.decorators=[{type:r.Component,args:[{selector:"pm-calendar",template:'<div *ngFor="let month of displayed_months.getMonths()" class=\'months\'>\n    <h4> {{ month.getFullMonth() }} {{ month.getYear() }} </h4>\n    <div class=\'dtable\'>\n        <div class=\'dhead\'>\n            <div class=\'dhcol\' *ngFor="let str_day of str_days">\n                {{ str_day }}\n            </div>\n        </div>\n        <app-week\n            class="drow"\n            *ngFor="let week of month.getWeeks()"\n            [week]="week"\n        ></app-week>\n    </div>\n</div>',styles:[".dhead{display:flex}.dhcol{width:100px}.drow{display:flex}"]}]}],v.ctorParameters=function(){return[{type:f}]},v.propDecorators={datestart:[{type:r.Input}],dateend:[{type:r.Input}],lang:[{type:r.Input}]},v);function v(e){this.calendarService=e,this.now=new Date}var D=(w.decorators=[{type:r.Component,args:[{selector:"app-week",template:'<app-day \n    class=\'dcol\'\n    *ngFor="let day of week.getDays()"\n    [class.disabled]="day.getObjDate().getMonth() != week.getMonthNumber()"\n    [day]="day"\n></app-day>',styles:[".dcol{width:100px}.dcol.disabled{background-color:grey}"]}]}],w.propDecorators={week:[{type:r.Input}]},w);function w(){}var b=(M.prototype.dayClicked=function(e){this.calendarService.triggerDaySelect(e,this)},M.decorators=[{type:r.Component,args:[{selector:"app-day",template:'\x3c!-- click action is important for the onDateSelected event trigger. Don\'t remove it --\x3e\n<div (click)="dayClicked(day)" [ngClass]="day.getClasses()">\n    {{ day.getObjDate().toLocaleDateString() }}\n</div>',styles:[""]}]}],M.ctorParameters=function(){return[{type:f}]},M.propDecorators={day:[{type:r.Input}]},M);function M(e){this.calendarService=e}var _=(k.decorators=[{type:r.NgModule,args:[{imports:[t.CommonModule],declarations:[m,D,b],exports:[m],providers:[f]}]}],k);function k(){}e.PmCalendarModule=_,e.CalendarService=f,e.DayCalendar=c,e.ɵa=m,e.ɵc=b,e.ɵb=D,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=pm-calendar.umd.min.js.map