text: /*
  * Kendo UI v2015.1.429 (http://www.telerik.com/kendo-ui)
  * Copyright 2015 Telerik AD. All rights reserved.
  *
  * Kendo UI commercial licenses may be obtained at
  * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete
  * If you do not own a commercial license, this file shall be governed by the trial license terms.
  */
  !function(e,define){define(["./kendo.scheduler.view.min"],e)}(function(){return function(e){function t(e,t){return e.slice(t).concat(e.slice(0,t))}function n(e,t){for(var n=t.firstDay,i=new Date(e.getFullYear(),e.getMonth(),0,e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds());i.getDay()!=n;)o.date.setTime(i,-1*d);return i}function i(e,t,n){var i,o=t,r=n;return i=e,i>=o&&r>=i}var o=window.kendo,r=o.ui,a=r.SchedulerView,s=".kendoMonthView",l=e.extend,c=o.date.getDate,d=o.date.MS_PER_DAY,u=6,h=7,f=o.template('<span class="k-link k-nav-day">#:kendo.toString(date, "dd")#</span>'),p='<div role="gridcell" aria-selected="false" data-#=ns#uid="#=uid#"#if (resources[0]) { #style="background-color:#=resources[0].color #; border-color: #=resources[0].color#"class="k-event#=inverseColor ? " k-event-inverse" : ""#"#} else {#class="k-event"#}#><span class="k-event-actions"># if(data.tail || data.middle) {#<span class="k-icon k-i-arrow-w"></span>#}## if(data.isException()) {#<span class="k-icon k-i-exception"></span># } else if(data.isRecurring()) {#<span class="k-icon k-i-refresh"></span>#}#</span>{0}<span class="k-event-actions">#if (showDelete) {#<a href="\\#" class="k-link k-event-delete"><span class="k-icon k-si-close"></span></a>#}## if(data.head || data.middle) {#<span class="k-icon k-i-arrow-e"></span>#}#</span># if(resizable && !data.tail && !data.middle) {#<span class="k-resize-handle k-resize-w"></span>#}## if(resizable && !data.head && !data.middle) {#<span class="k-resize-handle k-resize-e"></span>#}#</div>',g=o.template('<div title="#=title.replace(/"/g,"&\\#34;")#"><div class="k-event-template">#:title#</div></div>'),m=o.template('<div style="width:#=width#px;left:#=left#px;top:#=top#px" class="k-more-events k-button"><span>...</span></div>');r.MonthView=a.extend({init:function(e,t){var n=this;a.fn.init.call(n,e,t),n.title=n.options.title,n.name="month",n._templates(),n._editable(),n._renderLayout(n.options.date),n._groups()},_updateDirection:function(e,t,n,i,o){var r,a,s,l,c;n&&(r=t[0].start,a=t[t.length-1].end,s=r.index===a.index,l=r.collectionIndex===a.collectionIndex,c=o?s&&l||l:s&&l,c&&(e.backward=i))},_changeViewPeriod:function(e,t,n){var i=n?7:1;return t&&(i*=-1),e.start=o.date.addDays(e.start,i),e.end=o.date.addDays(e.end,i),(!n||n&&this._isVerticallyGrouped())&&(e.groupIndex=t?this.groups.length-1:0),e.events=[],!0},_continuousSlot:function(e,t,n){var i=e.backward?0:t.length-1,o=this.groups[e.groupIndex];return o.continuousSlot(t[i].start,n)},_changeGroupContinuously:function(e,t,n,i){var o,r,a,s;return n||(o=e.groupIndex,r=this.groups.length-1,a=this._isVerticallyGrouped(),s=this.groups[o],!t&&a?(t=s[i?"lastSlot":"firstSlot"](),o+=i?-1:1):t&&!a&&(o=i?r:0),(0>o||o>r)&&(o=i?r:0,t=null),e.groupIndex=o),t},_normalizeHorizontalSelection:function(e,t,n){var i;return i=n?t[0].start:t[t.length-1].end},_normalizeVerticalSelection:function(e,t){var n;return n=e.backward?t[0].start:t[t.length-1].end},_templates:function(){var e=this.options,t=l({},o.Template,e.templateSettings);this.eventTemplate=this._eventTmpl(e.eventTemplate,p),this.dayTemplate=o.template(e.dayTemplate,t),this.groupHeaderTemplate=o.template(e.groupHeaderTemplate,t)},dateForTitle:function(){return o.format(this.options.selectedDateFormat,this._firstDayOfMonth,this._lastDayOfMonth)},shortDateForTitle:function(){return o.format(this.options.selectedShortDateFormat,this._firstDayOfMonth,this._lastDayOfMonth)},nextDate:function(){return o.date.nextDay(this._lastDayOfMonth)},previousDate:function(){return o.date.previousDay(this._firstDayOfMonth)},startDate:function(){return this._startDate},endDate:function(){return this._endDate},_renderLayout:function(t){var i=this;this._firstDayOfMonth=o.date.firstDayOfMonth(t),this._lastDayOfMonth=o.date.lastDayOfMonth(t),this._startDate=n(t,this.calendarInfo()),this.createLayout(this._layout()),this._content(),this.refreshLayout(),this.content.on("click"+s,".k-nav-day,.k-more-events",function(t){var n=e(t.currentTarget).offset(),o=i._slotByPosition(n.left,n.top);t.preventDefault(),i.trigger("navigate",{view:"day",date:o.startDate()})})},_editable:function(){this.options.editable&&!this._isMobilePhoneView()&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var t=this;t.element.on("click"+s,".k-scheduler-monthview .k-event a:has(.k-si-close)",function(n){t.trigger("remove",{uid:e(this).closest(".k-event").attr(o.attr("uid"))}),n.preventDefault()}),t.options.editable.create!==!1&&t.element.on("dblclick"+s,".k-scheduler-monthview .k-scheduler-content td",function(n){var i,o=e(n.currentTarget).offset(),r=t._slotByPosition(o.left,o.top);r&&(i=t._resourceBySlot(r),t.trigger("add",{eventInfo:l({isAllDay:!0,start:r.startDate(),end:r.startDate()},i)})),n.preventDefault()}),t.options.editable.update!==!1&&t.element.on("dblclick"+s,".k-scheduler-monthview .k-event",function(n){t.trigger("edit",{uid:e(this).closest(".k-event").attr(o.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var t=this;t.options.editable.create!==!1&&(t._addUserEvents=new o.UserEvents(t.element,{filter:".k-scheduler-monthview .k-scheduler-content td",tap:function(n){var i,o=e(n.target).offset(),r=t._slotByPosition(o.left,o.top);r&&(i=t._resourceBySlot(r),t.trigger("add",{eventInfo:l({isAllDay:!0,start:r.startDate(),end:r.startDate()},i)})),n.preventDefault()}})),t.options.editable.update!==!1&&(t._editUserEvents=new o.UserEvents(t.element,{filter:".k-scheduler-monthview .k-event",tap:function(n){0===e(n.event.target).closest("a:has(.k-si-close)").length&&(t.trigger("edit",{uid:e(n.target).closest(".k-event").attr(o.attr("uid"))}),n.preventDefault())}}))},selectionByElement:function(t){var n=e(t).offset();return this._slotByPosition(n.left,n.top)},_columnCountForLevel:function(e){var t=this.columnLevels[e];return t?t.length:0},_rowCountForLevel:function(e){var t=this.rowLevels[e];return t?t.length:0},_content:function(){var e,t="<tbody>",n=1,i=this.groupedResources;for(i.length&&this._isVerticallyGrouped()&&(n=this._rowCountForLevel(i.length-1)),e=0;n>e;e++)t+=this._createCalendar(e);t+="</tbody>",this.content.find("table").html(t)},_createCalendar:function(e){var t,n,i,r,a=this.startDate(),s=h*u,l=h,c=[a],d="",f=1,p=this._isVerticallyGrouped(),g=this.groupedResources;for(g.length&&(p||(f=this._columnCountForLevel(g.length-1))),this._slotIndices={},t=0,n=s/l;n>t;t++){for(d+="<tr>",c.push(a),i=t*l,r=0;f>r;r++)d+=this._createRow(a,i,l,p?e:r);a=o.date.addDays(a,l),d+="</tr>"}return this._weekStartDates=c,this._endDate=o.date.previousDay(a),d},_createRow:function(e,t,n,i){var r,a=this,s=a._firstDayOfMonth,l=a._lastDayOfMonth,d=a.dayTemplate,u="",h="",f=function(){return a._resourceBySlot({groupIndex:i})};for(r=0;n>r;r++)u="",o.date.isToday(e)&&(u+="k-today"),o.date.isInDateRange(e,s,l)||(u+=" k-other-month"),h+="<td ",""!==u&&(h+='class="'+u+'"'),h+=">",h+=d({date:e,resources:f}),h+="</td>",a._slotIndices[c(e).getTime()]=t+r,e=o.date.nextDay(e);return h},_layout:function(){var n,i,o,r=this.calendarInfo(),a=this._isMobile()?r.days.namesShort:r.days.names,s=t(a,r.firstDay),l=e.map(s,function(e){return{text:e}}),c=this.groupedResources;if(c.length)if(this._isVerticallyGrouped()){for(i=[],o=0;6>o;o++)i.push({text:"<div>&nbsp;</div>",className:"k-hidden k-slot-cell"});n=this._createRowsLayout(c,i,this.groupHeaderTemplate)}else l=this._createColumnsLayout(c,l,this.groupHeaderTemplate);return{columns:l,rows:n}},_createEventElement:function(t){var n,i=this.options,r=i.editable,a=this._isMobile();return t.showDelete=r&&r.destroy!==!1&&!a,t.resizable=r&&r.resize!==!1&&!a,t.ns=o.ns,t.resources=this.eventResources(t),t.inverseColor=t.resources&&t.resources[0]?this._shouldInverseResourceColor(t.resources[0]):!1,n=e(this.eventTemplate(t)),this.angular("compile",function(){return{elements:n,data:[{dataItem:t}]}}),n},_isInDateSlot:function(e){var t=this.groups[0],n=t.firstSlot().start,r=t.lastSlot().end-1,a=o.date.toUtcTime(e.start),s=o.date.toUtcTime(e.end);return(i(a,n,r)||i(s,n,r)||i(n,a,s)||i(r,a,s))&&(!i(s,n,n)||i(s,a,a)||e.isAllDay)},_slotIndex:function(e){return this._slotIndices[c(e).getTime()]},_positionMobileEvent:function(t,n,i){var r,s,l,c,d,u,h,f=t.start;t.start.offsetLeft>t.end.offsetLeft&&(f=t.end),r=t.start.index,s=r,l=3,c=a.collidingEvents(t.events(),r,s),c.push({element:n,start:r,end:s}),d=a.createRows(c),u=t.collection.at(r),h=u.container,h||(h=e(o.format('<div class="k-events-container" style="top:{0};left:{1};width:{2}"/>',f.offsetTop+f.firstChildTop+f.firstChildHeight-3+"px",f.offsetLeft+"px",f.offsetWidth+"px")),u.container=h,this.content[0].appendChild(h[0])),l>=d.length&&(t.addEvent({element:n,start:r,end:s,groupIndex:f.groupIndex}),i._continuousEvents.push({element:n,uid:n.attr(o.attr("uid")),start:t.start,end:t.end}),h[0].appendChild(n[0]))},_positionEvent:function(t,n,i){var r,s,l,c,d,u,h,f,p,g,v,_,w,y,b,x=this.options.eventHeight,k=t.start;for(t.start.offsetLeft>t.end.offsetLeft&&(k=t.end),r=t.start.index,s=t.end.index,l=k.eventCount,c=a.collidingEvents(t.events(),r,s),d=r!==s?5:4,c.push({element:n,start:r,end:s}),u=a.createRows(c),h=0,f=Math.min(u.length,l);f>h;h++)for(p=u[h].events,g=k.offsetTop+k.firstChildHeight+h*x+3*h+"px",v=0,_=p.length;_>v;v++)p[v].element[0].style.top=g;if(u.length>l)for(w=r;s>=w;w++){if(y=t.collection,b=y.at(w),b.more)return;b.more=e(m({ns:o.ns,start:w,end:w,width:b.clientWidth-2,left:b.offsetLeft+2,top:b.offsetTop+b.firstChildHeight+l*x+3*l})),this.content[0].appendChild(b.more[0])}else t.addEvent({element:n,start:r,end:s,groupIndex:k.groupIndex}),n[0].style.width=t.innerWidth()-d+"px",n[0].style.left=k.offsetLeft+2+"px",n[0].style.height=x+"px",i._continuousEvents.push({element:n,uid:n.attr(o.attr("uid")),start:t.start,end:t.end}),n.appendTo(this.content)},_slotByPosition:function(e,t){var n,i,o=this.content.offset();for(e-=o.left,t-=o.top,t+=this.content[0].scrollTop,e+=this.content[0].scrollLeft,e=Math.ceil(e),t=Math.ceil(t),n=0;this.groups.length>n;n++)if(i=this.groups[n].daySlotByPosition(e,t))return i;return null},_createResizeHint:function(e){var t=e.startSlot().offsetLeft,n=e.start.offsetTop,i=e.innerWidth(),o=e.start.clientHeight-2,r=a.fn._createResizeHint.call(this,t,n,i,o);r.appendTo(this.content),this._resizeHint=this._resizeHint.add(r)},_updateResizeHint:function(e,t,n,i){var r,a,s;for(this._removeResizeHint(),r=this.groups[t],a=r.ranges(n,i,!0,e.isAllDay),s=0;a.length>s;s++)this._createResizeHint(a[s]);this._resizeHint.find(".k-label-top,.k-label-bottom").text(""),this._resizeHint.first().addClass("k-first").find(".k-label-top").text(o.toString(o.timezone.toLocalDate(n),"M/dd")),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(o.toString(o.timezone.toLocalDate(i),"M/dd"))},_updateMoveHint:function(e,t,n){var i,r,a,s,l,c=o.date.toUtcTime(e.start)+n,d=c+e.duration(),u=this.groups[t],h=u.ranges(c,d,!0,e.isAllDay);for(this._removeMoveHint(),i=0;h.length>i;i++)r=h[i],a=r.startSlot(),s=r.endSlot(),l=this._createEventElement(e.clone({head:r.head,tail:r.tail})),l.css({left:a.offsetLeft+2,top:a.offsetTop+a.firstChildHeight,height:this.options.eventHeight,width:r.innerWidth()-(a.index!==s.index?5:4)}),l.addClass("k-event-drag-hint"),l.appendTo(this.content),this._moveHint=this._moveHint.add(l)},_groups:function(){var e,t,n,i,r,a,s,l,c,d,f,p,g,m,v,_,w,y=this._groupCount(),b=h,x=u;for(this.groups=[],e=0;y>e;e++)this._addResourceView(e);for(t=this.content[0].getElementsByTagName("tr"),n=0;y>n;n++)for(i=0,r=0,this._isVerticallyGrouped()&&(r=n),a=r*x;(r+1)*x>a;a++)for(s=this.groups[n],l=s.addDaySlotCollection(o.date.addDays(this.startDate(),i),o.date.addDays(this.startDate(),i+b)),c=t[a],d=c.children,f=0,c.setAttribute("role","row"),this._isVerticallyGrouped()||(f=n),p=f*b;(f+1)*b>p;p++)g=d[p],m=g.clientHeight,v=g.children.length?g.children[0].offsetHeight+3:0,_=o.date.toUtcTime(o.date.addDays(this.startDate(),i)),i++,w=Math.floor((m-v-this.options.moreButtonHeight)/(this.options.eventHeight+3)),g.setAttribute("role","gridcell"),g.setAttribute("aria-selected",!1),l.addDaySlot(g,_,_+o.date.MS_PER_DAY,w)},render:function(e){this.content.children(".k-event,.k-more-events,.k-events-container").remove(),this._groups(),e=new o.data.Query(e).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray();var t=this.groupedResources;t.length?this._renderGroups(e,t,0,1):this._renderEvents(e,0),this.refreshLayout(),this.trigger("activate")},_renderEvents:function(e,t){var n,i,o,r,a,s,l,c,d,u,h,f=this._isMobilePhoneView();for(i=0,o=e.length;o>i;i++)if(n=e[i],this._isInDateSlot(n))for(r=this.groups[t],r._continuousEvents||(r._continuousEvents=[]),a=r.slotRanges(n,!0),s=a.length,l=0;s>l;l++)c=a[l],d=n.start,u=n.end,s>1&&(0===l?u=c.end.endDate():l==s-1?d=c.start.startDate():(d=c.start.startDate(),u=c.end.endDate())),h=n.clone({start:d,end:u,head:c.head,tail:c.tail}),f?this._positionMobileEvent(c,this._createEventElement(h),r):this._positionEvent(c,this._createEventElement(h),r)},_renderGroups:function(e,t,n,i){var r,s,l,c,d=t[0];if(d)for(r=d.dataSource.view(),s=0;r.length>s;s++)l=this._resourceValue(d,r[s]),c=new o.data.Query(e).filter({field:d.field,operator:a.groupEqFilter(l)}).toArray(),t.length>1?n=this._renderGroups(c,t.slice(1),n++,i+1):this._renderEvents(c,n++);return n},_groupCount:function(){var e=this.groupedResources;return e.length?this._isVerticallyGrouped()?this._rowCountForLevel(e.length-1):this._columnCountForLevel(e.length)/this._columnOffsetForResource(e.length):1},_columnOffsetForResource:function(e){return this._columnCountForLevel(e)/this._columnCountForLevel(e-1)},destroy:function(){this.table&&this.table.removeClass("k-scheduler-monthview"),this.content&&this.content.off(s),this.element&&this.element.off(s),a.fn.destroy.call(this),this._isMobile()&&!this._isMobilePhoneView()&&this.options.editable&&(this.options.editable.create!==!1&&this._addUserEvents.destroy(),this.options.editable.update!==!1&&this._editUserEvents.destroy())},events:["remove","add","edit","navigate"],options:{title:"Month",name:"month",eventHeight:25,moreButtonHeight:13,editable:!0,selectedDateFormat:"{0:y}",selectedShortDateFormat:"{0:y}",groupHeaderTemplate:"#=text#",dayTemplate:f,eventTemplate:g}})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t){t()});