/** 
 * Kendo UI v2016.3.1118 (http://www.telerik.com/kendo-ui)                                                                                                                                              
 * Copyright 2016 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(t,define){define("kendo.scheduler.timelineview.min",["kendo.scheduler.view.min"],t)}(function(){return function(t,e){function n(t){var e=new Date(1980,1,1,0,0,0);return u(e,g(t)),e}function i(t){var e=[],n=t.workWeekStart;for(e.push(n);t.workWeekEnd!=n;)n>6?n-=7:n++,e.push(n);return e}function o(t){var e,n=0;if(t.columns){for(e=0;e<t.columns.length;e++)n+=o(t.columns[e]);return t.colspan=n,n}return t.colspan=1,1}function r(t,e,n){var i,o,r,a;for(i=t.length-1;i>=0;i--)o=t[i].rectLeft,a=t[i].rectRight,r=o<=e&&a>=e,(r||o>=e&&a<=n||e<=o&&n>=o)&&(o<e&&(e=o),a>n&&(n=a));return s(t,e,n)}function s(t,e,n){var i,o,r=[];for(i=0;i<t.length;i++)o={rectLeft:t[i].rectLeft,rectRight:t[i].rectRight},(o.rectLeft<e&&o.rectRight>e||o.rectLeft>=e&&o.rectRight<=n)&&r.push(t[i]);return r}var a,l=window.kendo,d=l.ui,u=l.date.setTime,c=d.SchedulerView,h=l._outerWidth,f=l._outerHeight,_=t.extend,p=t.proxy,v=l.date.getDate,g=l.date.getMilliseconds,m=l.date.MS_PER_DAY,w=l.date.MS_PER_MINUTE,T="k-current-time",k="k-current-time-arrow",D="k-scheduler-header-wrap",y=.8666,S=".kendoTimelineView",C=l.template('<div><div class="k-event-template k-event-time">#:kendo.format("{0:t} - {1:t}", start, end)#</div><div class="k-event-template">${title}</div></div>'),V=l.template("<span class='k-link k-nav-day'>#=kendo.format('{0:m}', date)#</span>"),x='<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) {#<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) {#<span class="k-icon k-i-arrow-e"></span>#}#</span>#if(resizable && !data.tail){#<span class="k-resize-handle k-resize-w"></span>#}##if(resizable && !data.head){#<span class="k-resize-handle k-resize-e"></span>#}#</div>',R=l.Class.extend({init:function(t){this._view=t},_getTimeSlotByPosition:function(t,e,n){var i=this._view.groups[n];return i.timeSlotByPosition(t,e)},_hideHeaders:function(){var t=this._view;t.timesHeader.find("table tr:last").hide(),t.datesHeader.find("table tr:last").hide()},_setColspan:function(t){o(t)},_createRowsLayout:function(t,e,n){var i=this._view;return i._createRowsLayout(t,e,n)},_createVerticalColumnsLayout:function(t,e,n,i){return i},_createColumnsLayout:function(t,e,n){var i=this._view;return i._createColumnsLayout(t,e,n)},_getRowCount:function(){var t=this._view;return t._groupCount()},_getGroupsCount:function(){return 1},_addContent:function(t,e,n,i,o,r,s,a){var d,u,c,h,f=this._view,_="",p=f.options,v=function(e){var n,i="",o="",r=function(t){return function(){return f._resourceBySlot({groupIndex:t})}};return l.date.isToday(t[c])&&(o+="k-today"),(l.date.getMilliseconds(e)<l.date.getMilliseconds(p.workDayStart)||l.date.getMilliseconds(e)>=l.date.getMilliseconds(p.workDayEnd)||!f._isWorkDay(t[c]))&&(o+=" k-nonwork-hour"),i+="<td"+(""!==o?' class="'+o+'"':"")+">",n=l.date.getDate(t[c]),l.date.setTime(n,l.date.getMilliseconds(e)),i+=s({date:n,resources:r(a?d:u)}),i+="</td>"};for(d=0;d<i;d++){for(_+="<tr>",u=0;u<n;u++)for(c=0,h=e;c<h;c++)_+=f._forTimeRange(o,r,v);_+="</tr>"}return _},_addTimeSlotsCollections:function(t,e,n,i,o){var r,s,a,l,d,u,c,h,f,_,p,v,m=this._view,w=n.length;for(o&&(w=Math.floor(w/t)),r=0;r<t;r++)for(s=0,a=m.groups[r],o&&(s=r),d=s*w,u=0,o||(u=r),c=n[d].children,h=c.length/(o?1:t),f=h/e,_=0;_<e;_++)for(p=_*f+h*u,l=g(new Date((+m.startTime()))),v=0;v<f;v++)m._addTimeSlotToCollection(a,c,v,p,_,l,i),l+=i},_getVerticalGroupCount:function(t){return t},_getVerticalRowCount:function(t,e,n){var i=this._view;return i._isVerticallyGrouped()?t[e].maxRowCount:n},_renderEvent:function(t,e,n,i,o,r){var s,a=this._view,l=a._createEventElement(n.occurrence,e,o.head||n.head,o.tail||n.tail);l.appendTo(r).css({top:0,height:a.options.eventHeight}),s={start:n.occurrence._startTime||n.occurrence.start,end:n.occurrence._endTime||n.occurrence.end,element:l,uid:e.uid,slotRange:o,rowIndex:0,offsetTop:0},t.events[e.uid]=s,a.addContinuousEvent(i,o,l,e.isAllDay),a._arrangeRows(s,o,t)},_verticalCountForLevel:function(t){var e=this._view;return e._rowCountForLevel(t)},_horizontalCountForLevel:function(t){var e=this._view;return e._columnCountForLevel(t)},_updateCurrentVerticalTimeMarker:function(e,n){var i=this._view,o="<div class='"+T+"'></div>",r=i.datesHeader.find("."+D),s=Math.round(e[0].innerRect(n,new Date(n.getTime()+1),!1).left),a=t(o).prependTo(r).addClass(k+"-down");a.css({left:i._adjustLeftPosition(s-h(a)*y/2),top:r.find("tr:last").prev().position().top}),t(o).prependTo(i.content).css({left:i._adjustLeftPosition(s),width:"1px",height:i.content[0].scrollHeight-1,top:0})},_changeGroup:function(){return e},_prevGroupSlot:function(t,e,n){var i,o=this._view;return o._isVerticallyGrouped()?t:(i=e._collection(0,n),i.last())},_nextGroupSlot:function(t,e,n){var i,o=this._view;return o._isVerticallyGrouped()?t:(i=e._collection(0,n),i.first())},_verticalSlots:function(t,e){var n=this._view;return n._changeGroup(t,e)},_verticalMethod:function(t){return t?"leftSlot":"rightSlot"},_normalizeVerticalSelection:function(){return e},_horizontalSlots:function(t,e,n,i,o,r,s){var a=this._view,l={};return l.startSlot=e[n](i),l.endSlot=e[n](o),r||!a._isHorizontallyGrouped()||l.startSlot&&l.endSlot||(l.startSlot=l.endSlot=a._changeGroup(t,s)),l},_changeVerticalViewPeriod:function(){return!1},_changeHorizontalViewPeriod:function(t,e,n,i){var o=this._view;return!(t.startSlot&&t.endSlot||e||!o._changeViewPeriod(n,i,!1))},_updateDirection:function(t,e,n,i){var o=this._view;o._updateDirection(t,e,n,i,!0)},_createMoveHint:function(t,e){var n,i,o,r,s=this._view,a=t.start,l=s._createEventElement(e.occurrence,e.occurrence,!1,!1);l.addClass("k-event-drag-hint"),n=t.innerRect(e.occurrence.start,e.occurrence.end,s.options.snap),i=n.right-n.left-2,i<0&&(i=0),o=s._adjustLeftPosition(n.left),r={left:o,top:a.offsetTop,height:a.offsetHeight-2,width:i},l.css(r),s._moveHint=s._moveHint.add(l)},_adjustLeftPosition:function(t){var e=this._view;return e._isRtl&&(t-=e.content[0].scrollWidth-e.content[0].offsetWidth),t}}),H=l.Class.extend({init:function(t){this._view=t},_getTimeSlotByPosition:function(t,e,n){var i=this._view.groups[n];return i.timeSlotByPosition(t,e,!0)},_hideHeaders:function(){var t=this._view;t._isVerticallyGrouped()?t.times.find(".k-last").hide():(t.timesHeader.find("table tr").eq(2).hide(),t.datesHeader.find("table tr").eq(2).hide())},_setColspan:function(){},_createRowsLayout:function(t,e,n,i){var o=this._view;return o._createDateLayout(i,null,!0)},_createVerticalColumnsLayout:function(t,e,n){var i=this._view;return i._createColumnsLayout(t,null,n)},_createColumnsLayout:function(t,e,n,i){var o=this._view;return o._createColumnsLayout(t,e,n,i,!0)},_getRowCount:function(t){var e=this._view;return e._rowCountForLevel(t)},_getGroupsCount:function(){var t=this._view;return t._groupCount()},_addContent:function(t,e,n,i,o,r,s,a){var d,c,h,f,_=this._view,p="",v=_.options,g=function(e,n,i,o,r,a){var u,c="",f="",p=_._isVerticallyGrouped()?d:h,g=function(t){return function(){return _._resourceBySlot({groupIndex:t})}};return l.date.isToday(t[h])&&(f+="k-today"),(l.date.getMilliseconds(e)<l.date.getMilliseconds(v.workDayStart)||l.date.getMilliseconds(e)>=l.date.getMilliseconds(v.workDayEnd)||!_._isWorkDay(t[p]))&&(f+=" k-nonwork-hour"),c+="<td"+(""!==f?' class="'+f+'"':"")+">",u=l.date.getDate(t[h]),l.date.setTime(u,l.date.getMilliseconds(e)),c+=s({date:u,resources:g(a)}),c+="</td>"},m=new Date(o),T=_.options.minorTickCount,k=_.options.majorTick*w,D=k/T||1;for(c=0;c<i;c++){for(p+="<tr>",c%(i/_._dates.length)===0&&(d=c/(i/_._dates.length),m=new Date(_._dates[d]),l.date.setTime(m,l.date.getMilliseconds(o))),h=0,f=e;h<f;h++)if(p+=_._forTimeRange(m,r,g,a,n),a){u(m,D,!1);break}p+="</tr>"}return p},_addTimeSlotsCollections:function(t,e,n,i,o){var r,s,a,l,d,u,c,h,f,_,p,v,m=this._view,w=n.length;for(o&&(w/=e),r=0;r<e;r++)for(s=0,o&&(s=r),l=s*w,d=0,u=n[l].children,c=o?w:u.length/(e*t),h=u.length/e,a=g(new Date((+m.startTime()))),_=0;_<c;_++){for(o?(f=0,u=n[_+c*r].children):(f=r*h+t*_,d++),p=0;p<t;p++)v=m.groups[p],m._addTimeSlotToCollection(v,u,p,f,r,a,i);a+=i}},_getVerticalGroupCount:function(){var t=this._view;return t.content.find("tr").length},_getVerticalRowCount:function(t,e,n){return n},_renderEvent:function(t,e,n,i,o,r,s,a){var l,d,u,c,h,f=this._view,_=[];for(d=o.start.index;d<=o.end.index;d++)l=f._createEventElement(n.occurrence,e,d!==a,d!==s),l.appendTo(r).css({top:0,height:f.options.eventHeight}),u=i._timeSlotCollections[0]._slots[d],c=i.timeSlotRanges(u.start,u.end,!1)[0],h={start:d===s?n.occurrence._startTime||n.occurrence.start:u.start,end:d===a?n.occurrence._endTime||n.occurrence.end:u.end,element:l,uid:e.uid,slotRange:c,rowIndex:0,offsetTop:0},t.events[e.uid]=h,_.push(h),f.addContinuousEvent(i,c,l,e.isAllDay),f._arrangeRows(h,c,t);t.events[e.uid]=_},_verticalCountForLevel:function(t){var e=this._view;return e._columnCountForLevel(t)},_horizontalCountForLevel:function(t,e){var n=this._view;return n._columnCountForLevel(e)/n._columnCountForLevel(2)},_updateCurrentVerticalTimeMarker:function(e,n){var i=this._view,o=i.times.find("tr:first th:first"),r=i.times.find("tr:first th:last"),s="<div class='"+T+"'></div>",a=t(s).prependTo(i.times),l=Math.round(e[0].innerRect(n,new Date(n.getTime()+1),!1).top),d={};this._isRtl?(d.right=o.position().left+f(o)-f(r),a.addClass(k+"-left")):(d.left=r.position().left,a.addClass(k+"-right")),d.top=l-h(a)*y/2,a.css(d),t(s).prependTo(i.content).css({top:l,height:"1px",right:"1px",width:i.content[0].scrollWidth,left:0})},_changeGroup:function(t,e,n){var i=this._view;n||(t.groupIndex=e?i.groups.length-1:0)},_prevGroupSlot:function(t){return t},_nextGroupSlot:function(t){return t},_changeDate:function(t,e,n){var i,o,r=this._view,s=r.groups[t.groupIndex];if(e){if(i=s._getCollections(!1),o=n.index-1,o>=0)return i[0]._slots[o]}else if(i=s._getCollections(!1),o=n.index+1,i[0]&&i[0]._slots[o])return i[0]._slots[o]},_verticalSlots:function(t,e,n){return this._changeDate(t,e,n)},_verticalMethod:function(t,e){return e?t?"upSlot":"downSlot":t?"leftSlot":"rightSlot"},_normalizeVerticalSelection:function(t,n,i,o){var r=this._view;return o?e:r._normalizeVerticalSelection(t,n,i)},_horizontalSlots:function(t,e,n,i,o,r,s){var a=this._view,l=a._changeGroup(t,s),d={};return l?d.startSlot=d.endSlot=l:a._isVerticallyGrouped()||(d.startSlot=e[n](i),d.endSlot=e[n](o)),d},_changeVerticalViewPeriod:function(t,e,n,i){var o=this._view;return!(t.startSlot&&t.endSlot||e||!o._changeViewPeriod(n,i,o._isVerticallyGrouped()))},_changeHorizontalViewPeriod:function(t,e,n,i){var o=this._view;return!o._isVerticallyGrouped()&&!(t.startSlot&&t.endSlot||e||!o._changeViewPeriod(n,i,!1))},_updateDirection:function(t,e,n,i){var o=this._view;o._updateDirection(t,e,n,i,!o._isVerticallyGrouped())},_createMoveHint:function(t,e){var n,i,o,r,s=this._view,a=t.start,l=t.end;for(n=a.index;n<=l.index;n++)i=t.collection._slots[n],o=s._createEventElement(e.occurrence,e.occurrence,!1,!1),o.addClass("k-event-drag-hint"),r={left:i.offsetLeft+2,top:i.offsetTop,height:s.options.eventHeight,width:i.offsetWidth},o.css(r),s._moveHint=s._moveHint.add(o)},_adjustLeftPosition:function(t){var e=this._view;return e._isRtl&&!e._isVerticallyGrouped()&&(t-=e.content[0].scrollWidth-e.content[0].offsetWidth),t}});l.ui.scheduler.TimelineGroupedView=R,l.ui.scheduler.TimelineGroupedByDateView=H,a=c.extend({init:function(t,e){var n=this;c.fn.init.call(n,t,e),n._groupedView=n._getGroupedView(),n.title=n.options.title||n.options.name,n._workDays=i(n.options),n._templates(),n._editable(),n.calculateDateRange(),n._groups(),n._currentTime(!0)},name:"timeline",_getGroupedView:function(){return this._isGroupedByDate()?new l.ui.scheduler.TimelineGroupedByDateView(this):new l.ui.scheduler.TimelineGroupedView(this)},_getNextEventIndexBySlot:function(t,e,n){var i,o;if(this._isVerticallyGrouped())return l.ui.SchedulerView.fn._getNextEventIndexBySlot.call(this,t,e,n);for(i=0,o=0;o<e.length;o++)if(t.startDate()>e[o].start.startDate())i++;else{if(!(t.startDate().getTime()===e[o].start.startDate().getTime()&&n>e[o].start.groupIndex))break;i++}return i},_getSelectedSlot:function(t,e,n,i,o,r){return this._isVerticallyGrouped()?l.ui.SchedulerView.fn._getSelectedSlot.call(this,t,e,n,i,o,r):t},_getSortedEvents:function(e){return this._isVerticallyGrouped()?l.ui.SchedulerView.fn._getSortedEvents.call(this,e):e.sort(function(e,n){var i=e.start.startDate().getTime()-n.start.startDate().getTime();return 0===i&&(e.start.isDaySlot&&!n.start.isDaySlot&&(i=-1),!e.start.isDaySlot&&n.start.isDaySlot&&(i=1)),0===i&&(i=e.start.groupIndex-n.start.groupIndex),0===i&&(i=t(e.element).index()-t(n.element).index()),i})},_currentTimeMarkerUpdater:function(){this._updateCurrentTimeMarker(new Date)},_updateCurrentTimeMarker:function(e){var n,i,o,r,s,a,d,u,c,f,_,p,v,g=this.options;if(this.datesHeader.find("."+T).remove(),this.times.find("."+T).remove(),this.content.find("."+T).remove(),this._isInDateSlot({start:e,end:e}))for(g.currentTimeMarker.useLocalTimezone===!1&&(n=g.dataSource.options.schema.timezone,g.dataSource&&n&&(i=l.timezone.offset(e,n),e=l.timezone.convert(e,e.getTimezoneOffset(),i))),o=g.group&&"vertical"!=g.group.orientation?this.groups.length:1,r=0;r<o;r++){if(s=this.groups[r],!s)return;if(a=l.date.toUtcTime(e),d=s.timeSlotRanges(a,a+1),0===d.length)return;u=d[0].collection,c=u.slotByStartDate(e),c&&(this._isVerticallyGrouped()?this._groupedView._updateCurrentVerticalTimeMarker(d,e):(f="<div class='"+T+"'></div>",_=this.datesHeader.find("."+D),p=Math.round(d[0].innerRect(e,new Date(e.getTime()+1),!1).left),v=t(f).prependTo(_).addClass(k+"-down"),v.css({left:this._adjustLeftPosition(p-h(v)*y/2),top:_.find("tr:last").prev().position().top}),t(f).prependTo(this.content).css({left:this._adjustLeftPosition(p),width:"1px",height:this.content[0].scrollHeight-1,top:0})))}},_adjustLeftPosition:function(t){return this._groupedView._adjustLeftPosition(t)},_currentTime:function(t){var n=this,i=n.options.currentTimeMarker;i!==!1&&i.updateInterval!==e&&(n._currentTimeMarkerUpdater(),t&&(n._currentTimeUpdateTimer=setInterval(p(this._currentTimeMarkerUpdater,n),i.updateInterval)))},_editable:function(){this.options.editable&&(this._isMobile()?this._touchEditable():this._mouseEditable())},_mouseEditable:function(){var e=this;e.element.on("click"+S,".k-event a:has(.k-si-close)",function(n){e.trigger("remove",{uid:t(this).closest(".k-event").attr(l.attr("uid"))}),n.preventDefault()}),e.options.editable.create!==!1&&e.element.on("dblclick"+S,".k-scheduler-content td",function(t){var n,i=e._slotByPosition(t.pageX,t.pageY);i&&(n=e._resourceBySlot(i),e.trigger("add",{eventInfo:_({start:i.startDate(),end:i.endDate()},n)})),t.preventDefault()}),e.options.editable.update!==!1&&e.element.on("dblclick"+S,".k-event",function(n){e.trigger("edit",{uid:t(this).closest(".k-event").attr(l.attr("uid"))}),n.preventDefault()})},_touchEditable:function(){var n=this,i=0;l.support.mobileOS.android&&(i=5),n.options.editable.create!==!1&&(n._addUserEvents=new l.UserEvents(n.element,{threshold:i,filter:".k-scheduler-content td",tap:function(t){var i,o=t.x.location!==e?t.x.location:t.x,r=t.y.location!==e?t.y.location:t.y,s=n._slotByPosition(o,r);s&&(i=n._resourceBySlot(s),n.trigger("add",{eventInfo:_({start:s.startDate(),end:s.endDate()},i)})),t.preventDefault()}})),n.options.editable.update!==!1&&(n._editUserEvents=new l.UserEvents(n.element,{threshold:i,filter:".k-event",tap:function(e){var i=t(e.target).closest(".k-event");i.hasClass("k-event-active")||n.trigger("edit",{uid:i.attr(l.attr("uid"))}),e.preventDefault()}}))},_slotByPosition:function(t,e){var n,i,o,r=this.content,s=r.offset();for(t-=s.left,e-=s.top,this._isRtl?(o=l.support.browser,o.mozilla?(t+=r[0].scrollWidth-r[0].offsetWidth,t+=r[0].scrollLeft):o.msie?(t-=r.scrollLeft(),t+=r[0].scrollWidth-r[0].offsetWidth):o.webkit&&(t+=r[0].scrollLeft)):t+=r[0].scrollLeft,e+=r[0].scrollTop,t=Math.ceil(t),e=Math.ceil(e),i=0;i<this.groups.length;i++)if(n=this._groupedView._getTimeSlotByPosition(t,e,i))return n;return null},options:{name:"TimelineView",title:"Timeline",selectedDateFormat:"{0:D}",selectedShortDateFormat:"{0:d}",date:l.date.today(),startTime:l.date.today(),endTime:l.date.today(),showWorkHours:!1,minorTickCount:2,editable:!0,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,majorTick:60,eventHeight:25,eventMinWidth:0,columnWidth:100,groupHeaderTemplate:"#=text#",majorTimeHeaderTemplate:"#=kendo.toString(date, 't')#",slotTemplate:"&nbsp;",eventTemplate:C,dateHeaderTemplate:V,footer:{command:"workDay"},currentTimeMarker:{updateInterval:1e4,useLocalTimezone:!0},messages:{defaultRowText:"All events",showFullDay:"Show full day",showWorkDay:"Show business hours"}},events:["remove","add","edit"],_templates:function(){var t=this.options,e=_({},l.Template,t.templateSettings);this.eventTemplate=this._eventTmpl(t.eventTemplate,x),this.majorTimeHeaderTemplate=l.template(t.majorTimeHeaderTemplate,e),this.dateHeaderTemplate=l.template(t.dateHeaderTemplate,e),this.slotTemplate=l.template(t.slotTemplate,e),this.groupHeaderTemplate=l.template(t.groupHeaderTemplate,e)},_render:function(e){var n=this;e=e||[],n._dates=e,n._startDate=e[0],n._endDate=e[e.length-1||0],n._calculateSlotRanges(),n.createLayout(n._layout(e)),n._content(e),n._footer(),n._setContentWidth(),n.refreshLayout(),n.datesHeader.on("click"+S,".k-nav-day",function(e){var i=t(e.currentTarget).closest("th"),o=n._slotByPosition(i.offset().left,n.content.offset().top);n.trigger("navigate",{view:"timeline",date:o.startDate()})}),n._groupedView._hideHeaders()},_setContentWidth:function(){var t=this.content,e=t.width(),n=this.content.find("table"),i=n.find("tr:first").children().length,o=100,r=i*this.options.columnWidth;e<r&&(o=Math.ceil(r/e*100)),n.add(this.datesHeader.find("table")).css("width",o+"%")},_calculateSlotRanges:function(){var t,e,n,i,o=this._dates,r=this.startTime(),s=this.endTime();for(g(s)===g(l.date.getDate(s))&&(s=l.date.getDate(s),u(s,m-1)),s=g(s),r=g(r),t=[],e=0;e<o.length;e++)n=v(o[e]),u(n,r),i=v(o[e]),u(i,s),t.push({start:l.date.toUtcTime(n),end:l.date.toUtcTime(i)});this._slotRanges=t},_forTimeRange:function(t,e,i,o,r){var s,a,l,d,c,h,f,_,p,v,T,k,D,y,S,C,V,x;for(t=n(t),e=n(e),s=this,a=g(t),l=g(e),d=s.options.minorTickCount,c=s.options.majorTick*w,h=c/d||1,f=new Date((+t)),_=f.getDate(),v=0,k="",T=m/h,a!=l&&(a>l&&(l+=m),T=(l-a)/h),T=o?1:Math.round(T),r&&(T*=r);v<T;v++)D=v%(c/h),y=0===D,S=D<d-1,C=D===d-1,V=d,T%d!==0&&(x=T-(v+1)<d,y&&x&&(V=T%d)),k+=i(f,y,S,C,V,v%r),o||(r?v%r===r-1&&u(f,h,!1):u(f,h,!1));return l&&(p=g(f),_<f.getDate()&&(p+=m),p>l&&(f=new Date((+e)))),k},_layout:function(t){var e,n,i,o=[],r=[],s=this,a=[{text:s.options.messages.defaultRowText}],l=s._groupedView,d=[];for(e=0;e<s.options.minorTickCount;e++)d.push({text:"",className:"k-last",minorTicks:!0});for(this._forTimeRange(s.startTime(),s.endTime(),function(t,e,n,i,r){var a,u=s.majorTimeHeaderTemplate;e&&(a={text:u({date:t}),className:i?"k-slot-cell":"",columns:d.slice(0,r)},l._setColspan(a),o.push(a))}),n=0;n<t.length;n++)r.push({text:s.dateHeaderTemplate({date:t[n]}),className:"k-slot-cell",columns:o.slice(0)});return i=this.groupedResources,i.length&&("vertical"===this._groupOrientation()?(a=l._createRowsLayout(i,null,this.groupHeaderTemplate,r),r=l._createVerticalColumnsLayout(i,null,this.groupHeaderTemplate,r)):r=l._createColumnsLayout(i,r,this.groupHeaderTemplate,r)),{columns:r,rows:a}},_footer:function(){var e,n,i,o=this.options;o.footer!==!1&&(e='<div class="k-header k-scheduler-footer">',n=o.footer.command,n&&"workDay"===n?(e+='<ul class="k-reset k-header">',e+='<li class="k-state-default k-scheduler-fullday"><a href="#" class="k-link"><span class="k-icon k-i-clock"></span>',e+=(o.showWorkHours?o.messages.showFullDay:o.messages.showWorkDay)+"</a></li>",e+="</ul>"):e+="&nbsp;",e+="</div>",this.footer=t(e).appendTo(this.element),i=this,this.footer.on("click"+S,".k-scheduler-fullday",function(t){t.preventDefault(),i.trigger("navigate",{view:i.name||o.name,date:i.startDate(),isWorkDay:!o.showWorkHours})}))},_columnCountForLevel:function(t){var e=this.columnLevels[t];return e?e.length:0},_rowCountForLevel:function(t){var e=this.rowLevels[t];return e?e.length:0},_isWorkDay:function(t){var e,n=t.getDay(),i=this._workDays;for(e=0;e<i.length;e++)if(i[e]===n)return!0;return!1},_content:function(t){var e=this,n=e.startTime(),i=this.endTime(),o=1,r=1,s=t.length,a="",l=this.groupedResources,d=this.slotTemplate,u=!1;l.length&&(u="vertical"===e._groupOrientation(),u?(r=e._groupedView._getRowCount(this.rowLevels.length-1),o=e._groupedView._getGroupsCount()):o=e._groupCount()),a+="<tbody>",a+=e._groupedView._addContent(t,s,o,r,n,i,d,u),a+="</tbody>",this.content.find("table").append(a)},_groups:function(){var t,e,n,i,o=this._groupCount(),r=this._dates,s=r.length;for(this.groups=[],t=0;t<o;t++)e=this._addResourceView(t),n=r[0],i=r[r.length-1||0],e.addTimeSlotCollection(n,l.date.addDays(i,1));this._timeSlotGroups(o,s)},_isHorizontallyGrouped:function(){return this.groupedResources.length&&"horizontal"===this._groupOrientation()},_timeSlotGroups:function(t,e){var n=this._timeSlotInterval(),i=this._isVerticallyGrouped(),o=this.content.find("tr");o.attr("role","row"),this._groupedView._addTimeSlotsCollections(t,e,o,n,i)},_addTimeSlotToCollection:function(t,e,n,i,o,r,s){var a=e[n+i],l=t.getTimeSlotCollection(0),d=this._dates[o],u=Date.UTC(d.getFullYear(),d.getMonth(),d.getDate()),c=u+r,h=c+s;a.setAttribute("role","gridcell"),a.setAttribute("aria-selected",!1),l.addTimeSlot(a,c,h,!0)},startDate:function(){return this._startDate},endDate:function(){return this._endDate},startTime:function(){var t=this.options;return t.showWorkHours?t.workDayStart:t.startTime},endTime:function(){var t=this.options;return t.showWorkHours?t.workDayEnd:t.endTime},_timeSlotInterval:function(){var t=this.options;return t.majorTick/t.minorTickCount*w},nextDate:function(){return l.date.nextDay(this.endDate())},previousDate:function(){return l.date.previousDay(this.startDate())},calculateDateRange:function(){this._render([this.options.date])},render:function(t){var e,n,i,o,r;for(this._headerColumnCount=0,this._groups(),this.element.find(".k-event").remove(),t=new l.data.Query(t).sort([{field:"start",dir:"asc"},{field:"end",dir:"desc"}]).toArray(),e=[],this._eventsByResource(t,this.groupedResources,e),n=[],i=0,o=0;o<e.length;o++)r={groupIndex:o,maxRowCount:0,events:{}},n.push(r),this._renderEvents(e[o],o,r),i<r.maxRowCount&&(i=r.maxRowCount);this._setRowsHeight(n,e.length,i),this._positionEvents(n,e.length),this._currentTime(!1),this.trigger("activate")},_positionEvents:function(e,n){var i,o,r,s,a;for(i=0;i<n;i++){o=e[i].events;for(r in o)if(s=o[r],t.isArray(s))for(a=0;a<s.length;a++)this._positionEvent(s[a]);else this._positionEvent(s)}},_setRowsHeight:function(e,n,i){var o,r,s,a,l,d=this.options.eventHeight+2,u=this._getBottomRowOffset(),c=this._groupedView,h=c._getVerticalGroupCount(n);for(n=this._isVerticallyGrouped()?h:1,o=0;o<n;o++)r=c._getVerticalRowCount(e,o,i),r=r?r:1,s=(d+2)*r+u,a=t(this.times.find("tr")[o]),l=t(this.content.find("tr")[o]),a.height(s),l.height(s);this._setContentWidth(),this.refreshLayout(),this._refreshSlots()},_getBottomRowOffset:function(){var t,e,n=.5*this.options.eventHeight,i=this._isMobile();return i?(t=30,e=60):(t=15,e=30),n>e?n=e:n<t&&(n=t),n},_positionEvent:function(t){var e,n,i,o=this.options.eventHeight+2,r=t.slotRange.innerRect(t.start,t.end,!1),s=this._adjustLeftPosition(r.left),a=r.right-r.left-2;a<0&&(a=0),a<this.options.eventMinWidth&&(e=t.slotRange.collection,n=e._slots[e._slots.length-1],i=n.offsetLeft+n.offsetWidth,a=this.options.eventMinWidth,i<s+a&&(a=i-r.left-2)),t.element.css({top:t.slotRange.start.offsetTop+t.rowIndex*(o+2)+"px",left:s,width:a})},_refreshSlots:function(){for(var t=0;t<this.groups.length;t++)this.groups[t].refresh()},_eventsByResource:function(t,e,n){var i,o,r,s,a=e[0];if(a)for(i=a.dataSource.view(),o=0;o<i.length;o++)r=this._resourceValue(a,i[o]),s=new l.data.Query(t).filter({field:a.field,operator:c.groupEqFilter(r)}).toArray(),e.length>1?this._eventsByResource(s,e.slice(1),n):n.push(s);else n.push(t)},_isInDateSlot:function(t){var e=t.start,n=t.end,i=v(this._startDate),o=l.date.addDays(v(this._endDate),1);return e<o&&i<=n},_isInTimeSlot:function(t){var e,n=t._startTime||l.date.toUtcTime(t.start),i=t._endTime||l.date.toUtcTime(t.end),o=this._slotRanges;for(n===i&&(i+=1),e=0;e<o.length;e++)if(n<o[e].end&&o[e].start<i)return!0;return!1},_adjustEvent:function(t){var e,n=t.start,i=t.end,o=t._time("start"),r=t._time("end"),s=g(this.startTime()),a=g(this.endTime()),d=null,c=null,h=!1,f=!1;return t.isAllDay?(d=v(n),s>o&&(u(d,s),f=!0),c=v(i),a===g(v(this.endTime()))?c=l.date.addDays(c,1):(u(c,a),h=!0)):(a=0===a?m:a,s>o?(d=v(n),u(d,s),f=!0):a<o&&(d=v(n),d=l.date.addDays(d,1),u(d,s),f=!0),a<r?(c=v(i),u(c,a),h=!0):s>r&&(c=v(i),c=l.date.addDays(c,-1),u(c,a),h=!0)),e=t.clone({start:d?d:n,end:c?c:i,_startTime:d?l.date.toUtcTime(d):t._startTime,_endTime:c?l.date.toUtcTime(c):t._endTime,isAllDay:!1}),{occurrence:e,head:h,tail:f}},_renderEvents:function(t,e,n){var i,o,r,s,a,l,d,u,c,h,f;for(o=0,r=t.length;o<r;o++)i=t[o],this._isInDateSlot(i)&&(s=i.isAllDay||i.end.getTime()-i.start.getTime()>=m,a=this.content,(s||this._isInTimeSlot(i))&&(l=this._adjustEvent(i),d=this.groups[e],d._continuousEvents||(d._continuousEvents=[]),u=d.slotRanges(l.occurrence,!1),c=u[0],h=c.start.index,f=c.end.index,this._isInTimeSlot(l.occurrence)&&this._groupedView._renderEvent(n,i,l,d,c,a,h,f)))},addContinuousEvent:function(t,e,n,i){var o=t._continuousEvents;o.push({element:n,isAllDay:i,uid:n.attr(l.attr("uid")),start:e.start,end:e.end})},_createEventElement:function(e,n,i,o){var r,s,a=this.eventTemplate,d=this.options.editable,u=this._isMobile(),c=d&&d.destroy!==!1&&!u,h=d&&d.resize!==!1,f=n._time("start"),p=n._time("end"),v=n.start,g=n.end,m=this.eventResources(n);return n._startTime&&f!==l.date.getMilliseconds(n.start)&&(v=new Date(f),v=l.timezone.apply(v,"Etc/UTC")),n._endTime&&p!==l.date.getMilliseconds(n.end)&&(g=new Date(p),g=l.timezone.apply(g,"Etc/UTC")),r=_({},{ns:l.ns,resizable:h,showDelete:c,head:i,tail:o,singleDay:1==this._dates.length,resources:m,inverseColor:!(!m||!m[0])&&this._shouldInverseResourceColor(m[0])},n,{start:v,end:g}),s=t(a(r)),this.angular("compile",function(){return{elements:s,data:[{dataItem:r}]}}),s},_arrangeRows:function(t,e,n){var i,o,s,a,l,d,u=e.start.index,h=e.end.index,f=t.slotRange.innerRect(t.start,t.end,!1),_=f.right+this.options.eventMinWidth,p=r(e.events(),f.left,_);for(e.addEvent({slotIndex:u,start:u,end:h,rectLeft:f.left,rectRight:_,element:t.element,uid:t.uid}),p.push({start:u,end:h,uid:t.uid}),i=c.createRows(p),n.maxRowCount<i.length&&(n.maxRowCount=i.length),o=0,s=i.length;o<s;o++)for(a=i[o].events,l=0,d=a.length;l<d;l++)n.events[a[l].uid].rowIndex=o},_groupCount:function(){var t=this.groupedResources,e=this._groupedView;return t.length?"vertical"===this._groupOrientation()?e._verticalCountForLevel(t.length-1):e._horizontalCountForLevel(t.length-1,this.columnLevels.length-1):1},_updateEventForSelection:function(t){var e=this._adjustEvent(t.clone());return e.occurrence},_eventOptionsForMove:function(t){return t.isAllDay?{isAllDay:!1}:{}},_updateEventForResize:function(t){t.isAllDay&&t.set("isAllDay",!1)},_updateMoveHint:function(t,e,n){var i,o,r,s,a=this.groups[e],l=t.clone({start:t.start,end:t.end}),d=l.duration();for(l.start=new Date(l.start.getTime()+n),l.end=new Date(+l.start+d),i=this._adjustEvent(l),o=a.slotRanges(i.occurrence,!1),this._removeMoveHint(),r=0;r<o.length;r++)this._groupedView._createMoveHint(o[r],i);s=this.content,this._moveHint.appendTo(s)},_updateResizeHint:function(t,e,n,i){var o,r,s,a,d,u,h,f,_,p,v=this.groups[e],g=v.ranges(n,i,!1,!1);for(this._removeResizeHint(),o=0;o<g.length;o++)r=g[o],s=r.startSlot(),a=r.innerRect(n,i,!1),a.top=s.offsetTop,d=a.right-a.left,u=r.endSlot().offsetTop+s.offsetHeight-a.top,h=this._adjustLeftPosition(a.left),f=c.fn._createResizeHint.call(this,h,a.top,d,u),this._resizeHint=this._resizeHint.add(f);_="t",p=this.content,this._resizeHint.appendTo(p),this._resizeHint.find(".k-label-top,.k-label-bottom").text(""),this._resizeHint.first().addClass("k-first").find(".k-label-top").text(l.toString(l.timezone.toLocalDate(n),_)),this._resizeHint.last().addClass("k-last").find(".k-label-bottom").text(l.toString(l.timezone.toLocalDate(i),_))},selectionByElement:function(t){var e=t.offset();return this._slotByPosition(e.left,e.top)},_updateDirection:function(t,e,n,i,o){var r=e[0].start,s=e[e.length-1].end;n&&!o&&r.index===s.index&&r.collectionIndex===s.collectionIndex&&(t.backward=i)},_changeGroup:function(t,e){var n=e?"prevGroupSlot":"nextGroupSlot",i=this[n](t.start,t.groupIndex,!1);return i&&(t.groupIndex+=e?-1:1),this._groupedView._changeGroup(t,e,i),i},prevGroupSlot:function(t,e,n){var i=this.groups[e],o=i.ranges(t,t,n,!1)[0].start;if(!(e<=0))return this._groupedView._prevGroupSlot(o,i,n)},nextGroupSlot:function(t,e,n){var i=this.groups[e],o=i.ranges(t,t,n,!1)[0].start;if(!(e>=this.groups.length-1))return this._groupedView._nextGroupSlot(o,i,n)},_verticalSlots:function(t,e,n,i){var o=this._groupedView,r=o._verticalMethod(i,n),s=e[0].start,a=e[e.length-1].end,l=this.groups[t.groupIndex],d=o._normalizeVerticalSelection(t,e,i,n);return d&&(s=a=d),s=l[r](s),a=l[r](a),n||!this._isVerticallyGrouped()||s&&a||(s=a=o._verticalSlots(t,i,d)),{startSlot:s,endSlot:a}},_horizontalSlots:function(t,e,n,i){var o=i?"upSlot":"downSlot",r=e[0].start,s=e[e.length-1].end,a=this.groups[t.groupIndex],l={};return n?(l.startSlot=a[o](r),l.endSlot=a[o](s),n||!this._isHorizontallyGrouped()||r&&s||(l.startSlot=l.endSlot=this._changeGroup(t,i))):l=this._groupedView._horizontalSlots(t,a,o,r,s,n,i),l},_changeViewPeriod:function(t,e){var n,i=e?this.previousDate():this.nextDate(),o=t.start,r=t.end;return t.start=new Date(i),t.end=new Date(i),this._isHorizontallyGrouped()&&(t.groupIndex=e?this.groups.length-1:0),n=r-o,e?(r=g(this.endTime()),r=0===r?m:r,u(t.start,r-n),u(t.end,r)):(o=g(this.startTime()),u(t.start,o),u(t.end,o+n)),t.events=[],!0},move:function(t,e,n){var i,o,r,s,a,d=!1,u=this.groups[t.groupIndex],c=l.keys,h=this._groupedView,f=u.ranges(t.start,t.end,!1,!1);if(e===c.DOWN||e===c.UP){if(d=!0,r=e===c.UP,h._updateDirection(t,f,n,r),s=this._verticalSlots(t,f,n,r),h._changeVerticalViewPeriod(s,n,t,r))return d}else if((e===c.LEFT||e===c.RIGHT)&&(d=!0,r=e===c.LEFT,this._updateDirection(t,f,n,r,!1),s=this._horizontalSlots(t,f,n,r),h._changeHorizontalViewPeriod(s,n,t,r)))return d;return d&&(i=s.startSlot,o=s.endSlot,n?(a=t.backward,a&&i?t.start=i.startDate():!a&&o&&(t.end=o.endDate())):i&&o&&(t.start=i.startDate(),t.end=o.endDate()),t.events=[]),d},destroy:function(){var t=this;t.element&&t.element.off(S),t.footer&&t.footer.remove(),t._currentTimeUpdateTimer&&clearInterval(t._currentTimeUpdateTimer),c.fn.destroy.call(this),this._isMobile()&&t.options.editable&&(t.options.editable.create!==!1&&t._addUserEvents.destroy(),t.options.editable.update!==!1&&t._editUserEvents.destroy())}}),_(!0,d,{TimelineView:a,TimelineWeekView:a.extend({options:{name:"TimelineWeekView",title:"Timeline Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",majorTick:120},name:"timelineWeek",calculateDateRange:function(){var t,e,n=this.options.date,i=l.date.dayOfWeek(n,this.calendarInfo().firstDay,-1),o=[];for(t=0,e=7;t<e;t++)o.push(i),i=l.date.nextDay(i);this._render(o);
}}),TimelineWorkWeekView:a.extend({options:{name:"TimelineWorkWeekView",title:"Timeline Work Week",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",majorTick:120},name:"timelineWorkWeek",nextDate:function(){var t=l.date.dayOfWeek(l.date.nextDay(this.endDate()),this.calendarInfo().firstDay,1);return l.date.addDays(t,this._workDays[0])},previousDate:function(){var t=l.date.dayOfWeek(this.startDate(),this.calendarInfo().firstDay,-1),e=this._workDays;return l.date.addDays(t,e[e.length-1]-7)},calculateDateRange:function(){for(var t=this.options.date,e=l.date.dayOfWeek(t,this.options.workWeekStart,-1),n=l.date.dayOfWeek(e,this.options.workWeekEnd,1),i=[];e<=n;)i.push(e),e=l.date.nextDay(e);this._render(i)}}),TimelineMonthView:a.extend({options:{name:"TimelineMonthView",title:"Timeline Month",selectedDateFormat:"{0:D} - {1:D}",selectedShortDateFormat:"{0:d} - {1:d}",workDayStart:new Date(1980,1,1,0,0,0),workDayEnd:new Date(1980,1,1,23,59,59),footer:!1,majorTick:1440,minorTickCount:1},name:"timelineMonth",calculateDateRange:function(){var t,e,n=this.options.date,i=l.date.firstDayOfMonth(n),o=l.date.lastDayOfMonth(n),r=[];for(t=0,e=o.getDate();t<e;t++)r.push(i),i=l.date.nextDay(i);this._render(r)}})})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(t,e,n){(n||e)()});
//# sourceMappingURL=kendo.scheduler.timelineview.min.js.map
