/** 
 * 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(e,define){define("util/main.min",["kendo.core.min"],e)}(function(){return function(){function e(e){return typeof e!==M}function t(e,t){var n=i(t);return H.round(e*n)/n}function i(e){return e?H.pow(10,e):1}function n(e,t,i){return H.max(H.min(e,i),t)}function s(e){return e*W}function r(e){return e/W}function a(e){return"number"==typeof e&&!isNaN(e)}function o(t,i){return e(t)?t:i}function d(e){return e*e}function l(e){var t,i=[];for(t in e)i.push(t+e[t]);return i.sort().join("")}function c(e){var t,i=2166136261;for(t=0;t<e.length;++t)i+=(i<<1)+(i<<4)+(i<<7)+(i<<8)+(i<<24),i^=e.charCodeAt(t);return i>>>0}function u(e){return c(l(e))}function h(e){var t,i=e.length,n=P,s=N;for(t=0;t<i;t++)s=H.max(s,e[t]),n=H.min(n,e[t]);return{min:n,max:s}}function p(e){return h(e).min}function f(e){return h(e).max}function m(e){return g(e).min}function v(e){return g(e).max}function g(e){var t,i,n,s=P,r=N;for(t=0,i=e.length;t<i;t++)n=e[t],null!==n&&isFinite(n)&&(s=H.min(s,n),r=H.max(r,n));return{min:s===P?void 0:s,max:r===N?void 0:r}}function b(e){if(e)return e[e.length-1]}function _(e,t){return e.push.apply(e,t),e}function y(e){return z.template(e,{useWithBlock:!1,paramName:"d"})}function k(t,i){return e(i)&&null!==i?" "+t+"='"+i+"' ":""}function w(e){var t,i="";for(t=0;t<e.length;t++)i+=k(e[t][0],e[t][1]);return i}function S(t){var i,n,s="";for(i=0;i<t.length;i++)n=t[i][1],e(n)&&(s+=t[i][0]+":"+n+";");if(""!==s)return s}function D(e){return"string"!=typeof e&&(e+="px"),e}function T(e){var t,i,n=[];if(e)for(t=z.toHyphens(e).split("-"),i=0;i<t.length;i++)n.push("k-pos-"+t[i]);return n.join(" ")}function C(t){return""===t||null===t||"none"===t||"transparent"===t||!e(t)}function x(e){for(var t={1:"i",10:"x",100:"c",2:"ii",20:"xx",200:"cc",3:"iii",30:"xxx",300:"ccc",4:"iv",40:"xl",400:"cd",5:"v",50:"l",500:"d",6:"vi",60:"lx",600:"dc",7:"vii",70:"lxx",700:"dcc",8:"viii",80:"lxxx",800:"dccc",9:"ix",90:"xc",900:"cm",1e3:"m"},i=[1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],n="";e>0;)e<i[0]?i.shift():(n+=t[i[0]],e-=i[0]);return n}function B(e){var t,i,n,s,r;for(e=e.toLowerCase(),t={i:1,v:5,x:10,l:50,c:100,d:500,m:1e3},i=0,n=0,s=0;s<e.length;++s){if(r=t[e.charAt(s)],!r)return null;i+=r,r>n&&(i-=2*n),n=r}return i}function R(e){var t=Object.create(null);return function(){var i,n="";for(i=arguments.length;--i>=0;)n+=":"+arguments[i];return n in t?t[n]:t[n]=e.apply(this,arguments)}}function F(e){for(var t,i,n=[],s=0,r=e.length;s<r;)t=e.charCodeAt(s++),t>=55296&&t<=56319&&s<r?(i=e.charCodeAt(s++),56320==(64512&i)?n.push(((1023&t)<<10)+(1023&i)+65536):(n.push(t),s--)):n.push(t);return n}function A(e){return e.map(function(e){var t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|1023&e),t+=String.fromCharCode(e)}).join("")}function E(e,t){function i(e,i){for(var n=[],s=0,r=0,a=0;s<e.length&&r<i.length;)t(e[s],i[r])<=0?n[a++]=e[s++]:n[a++]=i[r++];return s<e.length&&n.push.apply(n,e.slice(s)),r<i.length&&n.push.apply(n,i.slice(r)),n}return e.length<2?e.slice():function n(e){var t,s,r;return e.length<=1?e:(t=Math.floor(e.length/2),s=e.slice(0,t),r=e.slice(t),s=n(s),r=n(r),i(s,r))}(e)}var H=Math,z=window.kendo,I=z.deepExtend,W=H.PI/180,P=Number.MAX_VALUE,N=-Number.MAX_VALUE,M="undefined",L=Date.now;L||(L=function(){return(new Date).getTime()}),I(z,{util:{MAX_NUM:P,MIN_NUM:N,append:_,arrayLimits:h,arrayMin:p,arrayMax:f,defined:e,deg:r,hashKey:c,hashObject:u,isNumber:a,isTransparent:C,last:b,limitValue:n,now:L,objectKey:l,round:t,rad:s,renderAttr:k,renderAllAttr:w,renderPos:T,renderSize:D,renderStyle:S,renderTemplate:y,sparseArrayLimits:g,sparseArrayMin:m,sparseArrayMax:v,sqr:d,valueOrDefault:o,romanToArabic:B,arabicToRoman:x,memoize:R,ucs2encode:A,ucs2decode:F,mergeSort:E}}),z.drawing.util=z.util,z.dataviz.util=z.util}(),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}),function(e,define){define("util/text-metrics.min",["kendo.core.min","util/main.min"],e)}(function(){!function(e){function t(){return{width:0,height:0,baseline:0}}function i(e,t,i){return u.current.measure(e,t,i)}function n(e,t){var i=[];if(e.length>0&&document.fonts){try{i=e.map(function(e){return document.fonts.load(e)})}catch(n){r.logToConsole(n)}Promise.all(i).then(t,t)}else t()}var s=document,r=window.kendo,a=r.Class,o=r.util,d=o.defined,l=a.extend({init:function(e){this._size=e,this._length=0,this._map={}},put:function(e,t){var i=this,n=i._map,s={key:e,value:t};n[e]=s,i._head?(i._tail.newer=s,s.older=i._tail,i._tail=s):i._head=i._tail=s,i._length>=i._size?(n[i._head.key]=null,i._head=i._head.newer,i._head.older=null):i._length++},get:function(e){var t=this,i=t._map[e];if(i)return i===t._head&&i!==t._tail&&(t._head=i.newer,t._head.older=null),i!==t._tail&&(i.older&&(i.older.newer=i.newer,i.newer.older=i.older),i.older=t._tail,i.newer=null,t._tail.newer=i,t._tail=i),i.value}}),c=e("<div style='position: absolute !important; top: -4000px !important; width: auto !important; height: auto !important;padding: 0 !important; margin: 0 !important; border: 0 !important;line-height: normal !important; visibility: hidden !important; white-space: nowrap!important;' />")[0],u=a.extend({init:function(e){this._cache=new l(1e3),this._initOptions(e)},options:{baselineMarkerSize:1},measure:function(i,n,r){var a,l,u,h,p,f,m,v;if(!i)return t();if(a=o.objectKey(n),l=o.hashKey(i+a),u=this._cache.get(l),u)return u;h=t(),p=r?r:c,f=this._baselineMarker().cloneNode(!1);for(m in n)v=n[m],d(v)&&(p.style[m]=v);return e(p).text(i),p.appendChild(f),s.body.appendChild(p),(i+"").length&&(h.width=p.offsetWidth-this.options.baselineMarkerSize,h.height=p.offsetHeight,h.baseline=f.offsetTop+this.options.baselineMarkerSize),h.width>0&&h.height>0&&this._cache.put(l,h),p.parentNode.removeChild(p),h},_baselineMarker:function(){return e("<div class='k-baseline-marker' style='display: inline-block; vertical-align: baseline;width: "+this.options.baselineMarkerSize+"px; height: "+this.options.baselineMarkerSize+"px;overflow: hidden;' />")[0]}});u.current=new u,r.util.TextMetrics=u,r.util.LRUCache=l,r.util.loadFonts=n,r.util.measureText=i}(window.kendo.jQuery)},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}),function(e,define){define("util/base64.min",["util/main.min"],e)}(function(){return function(){function e(e){var i,n,s,a,o,d,l,c="",u=0;for(e=t(e);u<e.length;)i=e.charCodeAt(u++),n=e.charCodeAt(u++),s=e.charCodeAt(u++),a=i>>2,o=(3&i)<<4|n>>4,d=(15&n)<<2|s>>6,l=63&s,isNaN(n)?d=l=64:isNaN(s)&&(l=64),c=c+r.charAt(a)+r.charAt(o)+r.charAt(d)+r.charAt(l);return c}function t(e){var t,i,n="";for(t=0;t<e.length;t++)i=e.charCodeAt(t),i<128?n+=s(i):i<2048?(n+=s(192|i>>>6),n+=s(128|63&i)):i<65536&&(n+=s(224|i>>>12),n+=s(128|i>>>6&63),n+=s(128|63&i));return n}var i=window.kendo,n=i.deepExtend,s=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n(i.util,{encodeBase64:e,encodeUTF8:t})}(),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}),function(e,define){define("mixins/observers.min",["kendo.core.min"],e)}(function(){return function(e){var t=Math,i=window.kendo,n=i.deepExtend,s=e.inArray,r={observers:function(){return this._observers=this._observers||[]},addObserver:function(e){return this._observers?this._observers.push(e):this._observers=[e],this},removeObserver:function(e){var t=this.observers(),i=s(e,t);return i!=-1&&t.splice(i,1),this},trigger:function(e,t){var i,n,s=this._observers;if(s&&!this._suspended)for(n=0;n<s.length;n++)i=s[n],i[e]&&i[e](t);return this},optionsChange:function(e){e=e||{},e.element=this,this.trigger("optionsChange",e)},geometryChange:function(){this.trigger("geometryChange",{element:this})},suspend:function(){return this._suspended=(this._suspended||0)+1,this},resume:function(){return this._suspended=t.max((this._suspended||0)-1,0),this},_observerField:function(e,t){this[e]&&this[e].removeObserver(this),this[e]=t,t.addObserver(this)}};n(i,{mixins:{ObserversMixin:r}})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()}),function(e,define){define("kendo.gantt.min",["kendo.data.min","kendo.popup.min","kendo.window.min","kendo.resizable.min","kendo.gantt.list.min","kendo.gantt.timeline.min","kendo.grid.min","kendo.pdf.min"],e)}(function(){return function(e,t){function i(e){return"["+m.attr("uid")+(e?"='"+e+"']":"]")}function n(e){return delete e.name,delete e.prefix,delete e.remove,delete e.edit,delete e.add,delete e.navigate,e}function s(e){var t,i,n,s,r,a;if(e.filter("[name=end], [name=start]").length){for(t=e.attr("name"),i=m.widgetInstance(e,m.ui),n={},s=e;s!==window&&!r;)s=s.parent(),r=s.data("kendoEditable");return!(a=r?r.options.model:null)||(n.start=a.start,n.end=a.end,n[t]=i?i.value():m.parseDate(e.value()),n.start<=n.end)}return!0}function r(t,i){var n=t.parents("["+m.attr("role")+'="gantt"]'),s=[],r=a(n);t.attr(N,0),i&&r.each(function(t,i){s[t]=e(i).scrollTop()});try{t[0].setActive()}catch(o){t[0].focus()}i&&r.each(function(t,i){e(i).scrollTop(s[t])})}function a(t){return e(t).parentsUntil("body").filter(function(e,t){var i=m.getComputedStyles(t,["overflow"]);return"visible"!=i.overflow}).add(window)}var o,d,l,c,u,h,p,f,m=window.kendo,v="matchMedia"in window,g=m.support.browser,b=m.support.mobileOS,_=m.Observable,y=m.ui.Widget,k=m.data.DataSource,w=m.data.ObservableObject,S=m.data.ObservableArray,D=m.data.Query,T=e.isArray,C=e.inArray,x=m.isFunction,B=e.proxy,R=e.extend,F=e.isPlainObject,A=e.map,E=m._outerWidth,H=m._outerHeight,z=m.keys,I=3,W=".kendoGantt",P="p0",N="tabIndex",M="click",L="width",U="string",q={down:{origin:"bottom left",position:"top left"},up:{origin:"top left",position:"bottom left"}},O="aria-activedescendant",j="gantt_active_cell",G="action-option-focused",V=".",Q="Are you sure you want to delete this task?",K="Are you sure you want to delete this dependency?",X=m.template('<button class="#=styles.buttonToggle#" type="button"><span class="#=styles.iconToggle#">&nbps;</span></button>'),Y='<button class="#=styles.button# #=className#" type="button" #if (action) {#data-action="#=action#"#}#><span class="#=iconClass#"></span><span>#=text#</span></button>',J='<a class="#=className#" #=attr# href="\\#">#=text#</a>',Z=m.template('<li class="#=styles.currentView# #=styles.viewButtonDefault#"><a href="\\#" class="#=styles.link#">&nbps;</a></li>'),$=m.template('<ul class="#=styles.viewsWrapper#">#for(var view in views){#<li class="#=styles.viewButtonDefault# #=styles.viewButton#-#= view.toLowerCase() #" data-#=ns#name="#=view#"><a href="\\#" class="#=styles.link#">#=views[view].title#</a></li>#}#</ul>'),ee=m.template('<div class="#=styles.popupWrapper#"><ul class="#=styles.popupList#" role="listbox">#for(var i = 0, l = actions.length; i < l; i++){#<li class="#=styles.item#" data-action="#=actions[i].data#" role="option">#=actions[i].text#</span>#}#</ul></div>'),te=function(t,i){var n={name:i.field},s=i.model.fields[i.field].validation;s&&F(s)&&s.message&&(n[m.attr("dateCompare-msg")]=s.message),e('<input type="text" required '+m.attr("type")+'="date" '+m.attr("role")+'="datetimepicker" '+m.attr("bind")+'="value:'+i.field+'" '+m.attr("validate")+"='true' />").attr(n).appendTo(t),e("<span "+m.attr("for")+'="'+i.field+'" class="k-invalid-msg"/>').hide().appendTo(t)},ie=function(t,i){e('<a href="#" class="'+i.styles.button+'">'+i.messages.assignButton+"</a>").click(i.click).appendTo(t)},ne={wrapper:"k-widget k-gantt",rowHeight:"k-gantt-rowheight",listWrapper:"k-gantt-layout k-gantt-treelist",list:"k-gantt-treelist",timelineWrapper:"k-gantt-layout k-gantt-timeline",timeline:"k-gantt-timeline",splitBarWrapper:"k-splitbar k-state-default k-splitbar-horizontal k-splitbar-draggable-horizontal k-gantt-layout",splitBar:"k-splitbar",splitBarHover:"k-splitbar-horizontal-hover",popupWrapper:"k-list-container",popupList:"k-list k-reset",resizeHandle:"k-resize-handle",icon:"k-icon",item:"k-item",line:"k-line",buttonDelete:"k-gantt-delete",buttonCancel:"k-gantt-cancel",buttonSave:"k-gantt-update",buttonToggle:"k-gantt-toggle",primary:"k-primary",hovered:"k-state-hover",selected:"k-state-selected",focused:"k-state-focused",gridHeader:"k-grid-header",gridHeaderWrap:"k-grid-header-wrap",gridContent:"k-grid-content",popup:{form:"k-popup-edit-form",editForm:"k-gantt-edit-form",formContainer:"k-edit-form-container",resourcesFormContainer:"k-resources-form-container",message:"k-popup-message",buttonsContainer:"k-edit-buttons k-state-default",button:"k-button",editField:"k-edit-field",editLabel:"k-edit-label",resourcesField:"k-gantt-resources"},toolbar:{headerWrapper:"k-floatwrap k-header k-gantt-toolbar",footerWrapper:"k-floatwrap k-header k-gantt-toolbar",toolbar:"k-gantt-toolbar",expanded:"k-state-expanded",views:"k-gantt-views",viewsWrapper:"k-reset k-header k-gantt-views",actions:"k-gantt-actions",button:"k-button k-button-icontext",buttonToggle:"k-button k-button-icon k-gantt-toggle",iconPlus:"k-icon k-i-plus",iconPdf:"k-icon k-i-pdf",iconToggle:"k-icon k-i-gantt-toggle",viewButtonDefault:"k-state-default",viewButton:"k-view",currentView:"k-current-view",link:"k-link",pdfButton:"k-gantt-pdf",appendButton:"k-gantt-create"}},se=_.extend({init:function(e,t){_.fn.init.call(this),this.element=e,this.options=R(!0,{},this.options,t),this._popup()},options:{direction:"down",navigatable:!1},_current:function(e){var t=f.styles,i=this.list.find(V+t.focused),n=i[e]();n.length&&(i.removeClass(t.focused).removeAttr("id"),n.addClass(t.focused).attr("id",G),this.list.find("ul").removeAttr(O).attr(O,G))},_popup:function(){var t=this,i=f.styles,n="li"+V+i.item,s=V+i.toolbar.appendButton,r=this.options.messages.actions,a=this.options.navigatable;this.list=e(ee({styles:i,actions:[{data:"add",text:r.addChild},{data:"insert-before",text:r.insertBefore},{data:"insert-after",text:r.insertAfter}]})),this.element.append(this.list),this.popup=new m.ui.Popup(this.list,R({anchor:this.element.find(s),open:function(){t._adjustListWidth()},animation:this.options.animation},q[this.options.direction])),this.element.on(M+W,s,function(n){var s=e(this),r=s.attr(m.attr("action"));n.preventDefault(),r?t.trigger("command",{type:r}):(t.popup.open(),a&&t.list.find("li:first").addClass(i.focused).attr("id",G).end().find("ul").attr({TABINDEX:0,"aria-activedescendant":G}).focus())}),this.list.find(n).hover(function(){e(this).addClass(i.hovered)},function(){e(this).removeClass(i.hovered)}).end().on(M+W,n,function(){t.trigger("command",{type:e(this).attr(m.attr("action"))}),t.popup.close()}),a&&(this.popup.bind("close",function(){t.list.find(n).removeClass(i.focused).end().find("ul").attr(N,0),t.element.parents("["+m.attr("role")+'="gantt"]').find(V+i.gridContent+" > table:first").focus()}),this.list.find("ul").on("keydown"+W,function(e){var n=e.keyCode;switch(n){case z.UP:e.preventDefault(),t._current("prev");break;case z.DOWN:e.preventDefault(),t._current("next");break;case z.ENTER:t.list.find(V+i.focused).click();break;case z.ESC:e.preventDefault(),t.popup.close()}}))},_adjustListWidth:function(){var e,t,i=this.list,n=f.styles,s=i[0].style.width,r=this.element.find(V+n.toolbar.appendButton),a=E(i);!i.data(L)&&s||(e=window.getComputedStyle?window.getComputedStyle(r[0],null):0,t=e?parseFloat(e.width):E(r),e&&(g.mozilla||g.msie)&&(t+=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth)),s="border-box"!==i.css("box-sizing")?t-(E(i)-i.width()):t,a>s&&(s=a),i.css({fontFamily:r.css("font-family"),width:s}).data(L,s))},destroy:function(){clearTimeout(this._focusTimeout),this.popup.destroy(),this.element.off(W),this.list.off(W),this.unbind()}}),re=function(e,t){return function(i){var n,s;if(i=T(i)?{data:i}:i,n=i||{},s=n.data,n.data=s,!(n instanceof e)&&n instanceof k)throw Error("Incorrect DataSource type. Only "+t+" instances are supported");return n instanceof e?n:new e(n)}},ae=m.data.Model.define({id:"id",fields:{id:{type:"number"},predecessorId:{type:"number"},successorId:{type:"number"},type:{type:"number"}}}),oe=k.extend({init:function(e){k.fn.init.call(this,R(!0,{},{schema:{modelBase:ae,model:ae}},e))},successors:function(e){return this._dependencies("predecessorId",e)},predecessors:function(e){return this._dependencies("successorId",e)},dependencies:function(e){var t=this.predecessors(e),i=this.successors(e);return t.push.apply(t,i),t},_dependencies:function(e,t){var i=this.view(),n={field:e,operator:"eq",value:t};return i=new D(i).filter(n).toArray()}});oe.create=re(oe,"GanttDependencyDataSource"),d=m.data.Model.define({duration:function(){var e=this.end,t=this.start;return e-t},isMilestone:function(){return 0===this.duration()},_offset:function(e){var t,i,n=["start","end"];for(i=0;i<n.length;i++)t=new Date(this.get(n[i]).getTime()+e),this.set(n[i],t)},id:"id",fields:{id:{type:"number"},parentId:{type:"number",defaultValue:null,validation:{required:!0}},orderId:{type:"number",validation:{required:!0}},title:{type:"string",defaultValue:"New task"},start:{type:"date",validation:{required:!0}},end:{type:"date",validation:{required:!0,dateCompare:s,message:"End date should be after or equal to the start date"}},percentComplete:{type:"number",validation:{required:!0,min:0,max:1,step:.01}},summary:{type:"boolean"},expanded:{type:"boolean",defaultValue:!0}}}),l=k.extend({init:function(e){k.fn.init.call(this,R(!0,{},{schema:{modelBase:d,model:d}},e))},remove:function(e){var t=e.get("parentId"),i=this.taskAllChildren(e);return this._removeItems(i),e=k.fn.remove.call(this,e),this._childRemoved(t,e.get("orderId")),e},add:function(e){if(e)return e=this._toGanttTask(e),this.insert(this.taskSiblings(e).length,e)},insert:function(e,t){if(t)return t=this._toGanttTask(t),t.set("orderId",e),t=k.fn.insert.call(this,e,t),this._reorderSiblings(t,this.taskSiblings(t).length-1),this._resolveSummaryFields(this.taskParent(t)),t},taskChildren:function(e){var i,n=this.view(),s={field:"parentId",operator:"eq",value:null},r=this._sort&&this._sort.length?this._sort:{field:"orderId",dir:"asc"};if(e){if(i=e.get("id"),i===t||null===i||""===i)return[];s.value=i}return n=new D(n).filter(s).sort(r).toArray()},taskAllChildren:function(e){var t=[],i=this,n=function(e){var s=i.taskChildren(e);t.push.apply(t,s),A(s,n)};return e?n(e):t=this.view(),t},taskSiblings:function(e){if(!e)return null;var t=this.taskParent(e);return this.taskChildren(t)},taskParent:function(e){return e&&null!==e.get("parentId")?this.get(e.parentId):null},taskLevel:function(e){for(var t=0,i=this.taskParent(e);null!==i;)t+=1,i=this.taskParent(i);return t},taskTree:function(e){var t,i,n,s,r=[],a=this.taskChildren(e);for(i=0,n=a.length;i<n;i++)t=a[i],r.push(t),t.get("expanded")&&(s=this.taskTree(t),r.push.apply(r,s));return r},update:function(e,i){var n,s,r=this,a=function(e,t){var i,n,s=r.taskAllChildren(e);for(i=0,n=s.length;i<n;i++)s[i]._offset(t)},o=function(e){var t=e.field,i=e.sender;switch(t){case"start":r._resolveSummaryStart(r.taskParent(i)),a(i,i.get(t).getTime()-n.getTime());break;case"end":r._resolveSummaryEnd(r.taskParent(i));break;case"percentComplete":r._resolveSummaryPercentComplete(r.taskParent(i));break;case"orderId":r._reorderSiblings(i,n)}};i.parentId!==t&&(n=e.get("parentId"),n!==i.parentId&&(e.set("parentId",i.parentId),r._childRemoved(n,e.get("orderId")),e.set("orderId",r.taskSiblings(e).length-1),r._resolveSummaryFields(r.taskParent(e))),delete i.parentId),e.bind("change",o);for(s in i)n=e.get(s),e.set(s,i[s]);e.unbind("change",o)},_resolveSummaryFields:function(e){e&&(this._updateSummary(e),this.taskChildren(e).length&&(this._resolveSummaryStart(e),this._resolveSummaryEnd(e),this._resolveSummaryPercentComplete(e)))},_resolveSummaryStart:function(e){var t=this,i=function(e){var i,n,s,r=t.taskChildren(e),a=r[0].start.getTime();for(n=1,s=r.length;n<s;n++)i=r[n].start.getTime(),i<a&&(a=i);return new Date(a)};this._updateSummaryRecursive(e,"start",i)},_resolveSummaryEnd:function(e){var t=this,i=function(e){var i,n,s,r=t.taskChildren(e),a=r[0].end.getTime();for(n=1,s=r.length;n<s;n++)i=r[n].end.getTime(),i>a&&(a=i);return new Date(a)};this._updateSummaryRecursive(e,"end",i)},_resolveSummaryPercentComplete:function(e){var t=this,i=function(e){var i=t.taskChildren(e),n=new D(i).aggregate([{field:"percentComplete",aggregate:"average"}]);return n.percentComplete.average};this._updateSummaryRecursive(e,"percentComplete",i)},_updateSummaryRecursive:function(e,t,i){var n,s;e&&(n=i(e),e.set(t,n),s=this.taskParent(e),s&&this._updateSummaryRecursive(s,t,i))},_childRemoved:function(e,t){var i,n,s=null===e?null:this.get(e),r=this.taskChildren(s);for(i=t,n=r.length;i<n;i++)r[i].set("orderId",i);this._resolveSummaryFields(s)},_reorderSiblings:function(e,t){var i,n=e.get("orderId"),s=n>t,r=s?t:n,a=s?n:t,o=s?r:r+1,d=this.taskSiblings(e);for(a=Math.min(a,d.length-1),i=r;i<=a;i++)d[i]!==e&&(d[i].set("orderId",o),o+=1)},_updateSummary:function(e){if(null!==e){var t=this.taskChildren(e).length;e.set("summary",t>0)}},_toGanttTask:function(e){if(!(e instanceof d)){var t=e;e=this._createNewModel(),e.accept(t)}return e}}),l.create=re(l,"GanttDataSource"),R(!0,m.data,{GanttDataSource:l,GanttTask:d,GanttDependencyDataSource:oe,GanttDependency:ae}),c={desktop:{dateRange:te,resources:ie}},u=m.Observable.extend({init:function(e,t){m.Observable.fn.init.call(this),this.element=e,this.options=R(!0,{},this.options,t),this.createButton=this.options.createButton},fields:function(t,i){var n,s=this,r=this.options,a=r.messages.editor,o=r.resources,d=function(e){e.preventDefault(),o.editor(s.container.find(V+f.styles.popup.resourcesField),i)};return r.editable.template?n=e.map(i.fields,function(e,t){return{field:t}}):(n=[{field:"title",title:a.title},{field:"start",title:a.start,editor:t.dateRange},{field:"end",title:a.end,editor:t.dateRange},{field:"percentComplete",title:a.percentComplete,format:P}],i.get(o.field)&&n.push({field:o.field,title:a.resources,messages:a,editor:t.resources,click:d,styles:f.styles.popup})),n},_buildEditTemplate:function(e,t,i){var n,s,r,a,o=this.options.resources,d=this.options.editable.template,l=R({},m.Template,this.options.templateSettings),c=l.paramName,u=f.styles.popup,h="";if(d)typeof d===U&&(d=window.unescape(d)),h+=m.template(d,l)(e);else for(n=0,s=t.length;n<s;n++)r=t[n],h+='<div class="'+u.editLabel+'"><label for="'+r.field+'">'+(r.title||r.field||"")+"</label></div>",r.field===o.field&&(h+='<div class="'+u.resourcesField+'" style="display:none"></div>'),!e.editable||e.editable(r.field)?(i.push(r),h+="<div "+m.attr("container-for")+'="'+r.field+'" class="'+u.editField+'"></div>'):(a="#:",r.field?(r=m.expr(r.field,c),a+=r+"==null?'':"+r):a+="''",a+="#",a=m.template(a,l),h+='<div class="'+u.editField+'">'+a(e)+"</div>");return h}}),h=u.extend({destroy:function(){this.close(),this.unbind()},editTask:function(e){this.editable=this._createPopupEditor(e)},close:function(){var e=this,t=function(){e.editable&&(e.editable.destroy(),e.editable=null,e.container=null),e.popup&&(e.popup.destroy(),e.popup=null)};this.editable&&this.container.is(":visible")?(e.trigger("close",{window:e.container}),this.container.data("kendoWindow").bind("deactivate",t).close()):t()},showDialog:function(t){var i,n,s,r,a=t.buttons,o=f.styles.popup,d=m.format('<div class="{0}"><div class="{1}"><p class="{2}">{3}</p><div class="{4}">',o.form,o.formContainer,o.message,t.text,o.buttonsContainer);for(i=0,n=a.length;i<n;i++)d+=this.createButton(a[i]);d+="</div></div></div>",s=this.element,this.popup&&this.popup.destroy(),r=this.popup=e(d).appendTo(s).eq(0).on("click",V+o.button,function(t){t.preventDefault(),r.close();var i=e(t.currentTarget).index();a[i].click()}).kendoWindow({modal:!0,resizable:!1,draggable:!1,title:t.title,visible:!1,deactivate:function(){this.destroy(),s.focus()}}).getKendoWindow(),r.center().open()},_createPopupEditor:function(t){var i,n,s=this,r={},a=this.options.messages,o=f.styles,d=o.popup,l=m.format('<div {0}="{1}" class="{2} {3}"><div class="{4}">',m.attr("uid"),t.uid,d.form,d.editForm,d.formContainer),u=this.fields(c.desktop,t),h=[];return l+=this._buildEditTemplate(t,u,h),l+='<div class="'+d.buttonsContainer+'">',l+=this.createButton({name:"update",text:a.save,className:f.styles.primary}),l+=this.createButton({name:"cancel",text:a.cancel}),s.options.editable.destroy!==!1&&(l+=this.createButton({name:"delete",text:a.destroy})),l+="</div></div></div>",i=this.container=e(l).appendTo(this.element).eq(0).kendoWindow(R({modal:!0,resizable:!1,draggable:!0,title:a.editor.editorTitle,visible:!1,close:function(e){e.userTriggered&&s.trigger("cancel",{container:i,model:t})&&e.preventDefault()}},r)),n=i.kendoEditable({fields:h,model:t,clearContainer:!1,validateOnBlur:!0,target:s.options.target}).data("kendoEditable"),m.cycleForm(i),this.trigger("edit",{container:i,model:t})?s.trigger("cancel",{container:i,model:t}):(i.data("kendoWindow").center().open(),i.on(M+W,V+o.buttonCancel,function(e){e.preventDefault(),e.stopPropagation(),s.trigger("cancel",{container:i,model:t})}),i.on(M+W,V+o.buttonSave,function(e){var n,r,a,o,d;for(e.preventDefault(),e.stopPropagation(),n=s.fields(c.desktop,t),r={},o=0,d=n.length;o<d;o++)a=n[o].field,r[a]=t.get(a);s.trigger("save",{container:i,model:t,updateInfo:r})}),i.on(M+W,V+o.buttonDelete,function(e){e.preventDefault(),e.stopPropagation(),s.trigger("remove",{container:i,model:t})})),n}}),p=y.extend({init:function(e,t){y.fn.init.call(this,e,t),this.wrapper=this.element,this.model=this.options.model,this.resourcesField=this.options.resourcesField,this.createButton=this.options.createButton,this._initContainer(),this._attachHandlers()},events:["save"],open:function(){this.window.center().open()},close:function(){this.window.bind("deactivate",B(this.destroy,this)).close()},destroy:function(){this._dettachHandlers(),this.grid.destroy(),this.grid=null,this.window.destroy(),this.window=null,y.fn.destroy.call(this),m.destroy(this.wrapper),this.element=this.wrapper=null},_attachHandlers:function(){var t=f.styles,i=this.grid,n=this._cancelProxy=B(this._cancel,this);this.container.on(M+W,V+t.buttonCancel,this._cancelProxy),this._saveProxy=B(this._save,this),this.container.on(M+W,V+t.buttonSave,this._saveProxy),this.window.bind("close",function(e){e.userTriggered&&n(e)}),i.wrapper.on(M+W,"input[type='checkbox']",function(){var t=e(this),n=e(t).closest("tr"),s=i.dataSource.getByUid(n.attr(m.attr("uid"))),r=e(t).is(":checked")?1:"";s.set("value",r)})},_dettachHandlers:function(){this._cancelProxy=null,this._saveProxy=null,this.container.off(W),this.grid.wrapper.off()},_cancel:function(e){e.preventDefault(),this.close()},_save:function(e){e.preventDefault(),this._updateModel(),this.wrapper.is(V+f.styles.popup.resourcesField)||this.trigger("save",{container:this.wrapper,model:this.model}),this.close()},_initContainer:function(){var t=this,i=f.styles.popup,n=m.format('<div class="{0} {1}"><div class="{2} {3}"/></div>"',i.form,i.editForm,i.formContainer,i.resourcesFormContainer);n=e(n),this.container=n.find(V+i.resourcesFormContainer),this.window=n.kendoWindow({modal:!0,resizable:!1,draggable:!0,visible:!1,title:this.options.messages.resourcesEditorTitle,open:function(){t.grid.resize(!0)}}).data("kendoWindow"),this._resourceGrid(),this._createButtons()},_resourceGrid:function(){var t=this,i=this.options.messages,n=e('<div id="resources-grid"/>').appendTo(this.container);this.grid=new m.ui.Grid(n,{columns:[{field:"name",title:i.resourcesHeader,template:"<label><input type='checkbox' value='#=name#'# if (value > 0 && value !== null) {#checked='checked'# } #/>#=name#</labe>"},{field:"value",title:i.unitsHeader,template:function(e){var t=e.format,i=null!==e.value?e.value:"";return t?m.toString(i,t):i}}],height:280,sortable:!0,editable:!0,filterable:!0,dataSource:{data:t.options.data,schema:{model:{id:"id",fields:{id:{from:"id"},name:{from:"name",type:"string",editable:!1},value:{from:"value",type:"number",defaultValue:""},format:{from:"format",type:"string"}}}}},save:function(e){var t=!!e.values.value;e.container.parent().find("input[type='checkbox']").prop("checked",t)}})},_createButtons:function(){var e,t,i=this.options.buttons,n='<div class="'+f.styles.popup.buttonsContainer+'">';for(e=0,t=i.length;e<t;e++)n+=this.createButton(i[e]);n+="</div>",this.container.append(n)},_updateModel:function(){var e,t,i,n=[],s=this.grid.dataSource.data();for(t=0,i=s.length;t<i;t++)e=s[t].get("value"),null!==e&&e>0&&n.push(s[t]);this.model[this.resourcesField]=n}}),f=y.extend({init:function(e,t,i){T(t)&&(t={dataSource:t}),o={append:{text:"Add Task",action:"add",className:f.styles.toolbar.appendButton,iconClass:f.styles.toolbar.iconPlus},pdf:{text:"Export to PDF",className:f.styles.toolbar.pdfButton,iconClass:f.styles.toolbar.iconPdf}},y.fn.init.call(this,e,t),i&&(this._events=i),this._wrapper(),this._resources(),this.options.views&&this.options.views.length||(this.options.views=["day","week","month"]),this._timeline(),this._toolbar(),this._footer(),this._adjustDimensions(),this._preventRefresh=!0,this.view(this.timeline._selectedViewName),this._preventRefresh=!1,this._dataSource(),this._assignments(),this._dropDowns(),this._list(),this._dependencies(),this._resizable(),this._scrollable(),this._dataBind(),this._attachEvents(),this._createEditor(),m.notify(this)},events:["dataBinding","dataBound","add","edit","remove","cancel","save","change","navigate","moveStart","move","moveEnd","resizeStart","resize","resizeEnd","columnResize"],options:{name:"Gantt",autoBind:!0,navigatable:!1,selectable:!0,editable:!0,resizable:!1,columnResizeHandleWidth:I,columns:[],views:[],dataSource:{},dependencies:{},resources:{},assignments:{},taskTemplate:null,messages:{save:"Save",cancel:"Cancel",destroy:"Delete",deleteTaskConfirmation:Q,deleteDependencyConfirmation:K,deleteTaskWindowTitle:"Delete task",deleteDependencyWindowTitle:"Delete dependency",views:{day:"Day",week:"Week",month:"Month",year:"Year",start:"Start",end:"End"},actions:{append:"Add Task",addChild:"Add Child",insertBefore:"Add Above",insertAfter:"Add Below",pdf:"Export to PDF"},editor:{editorTitle:"Task",resourcesEditorTitle:"Resources",title:"Title",start:"Start",end:"End",percentComplete:"Complete",resources:"Resources",assignButton:"Assign",resourcesHeader:"Resources",unitsHeader:"Units"}},showWorkHours:!0,showWorkDays:!0,toolbar:null,workDayStart:new Date(1980,1,1,8,0,0),workDayEnd:new Date(1980,1,1,17,0,0),workWeekStart:1,workWeekEnd:5,hourSpan:1,snap:!0,height:600,listWidth:"30%",rowHeight:null},select:function(e){var i=this.list;return e?(i.select(e),t):i.select()},clearSelection:function(){this.list.clearSelection()},destroy:function(){y.fn.destroy.call(this),this.dataSource&&(this.dataSource.unbind("change",this._refreshHandler),this.dataSource.unbind("progress",this._progressHandler),this.dataSource.unbind("error",this._errorHandler)),this.dependencies&&(this.dependencies.unbind("change",this._dependencyRefreshHandler),this.dependencies.unbind("error",this._dependencyErrorHandler)),this.timeline&&(this.timeline.unbind(),this.timeline.destroy()),this.list&&(this.list.unbind(),this.list.destroy()),this.footerDropDown&&this.footerDropDown.destroy(),this.headerDropDown&&this.headerDropDown.destroy(),this._editor&&this._editor.destroy(),this._resizeDraggable&&this._resizeDraggable.destroy(),this.toolbar.off(W),v&&(this._mediaQuery.removeListener(this._mediaQueryHandler),this._mediaQuery=null),e(window).off("resize"+W,this._resizeHandler),e(this.wrapper).off(W),this.toolbar=null,this.footer=null},setOptions:function(t){var i,n=m.deepExtend({},this.options,t),s=this._events;t.views||(i=this.view().name,n.views=e.map(this.options.views,function(e){var t=F(e),n=t?"string"!=typeof e.type?e.title:e.type:e;return i===n?t?e.selected=!0:e={type:n,selected:!0}:t&&(e.selected=!1),e})),t.dataSource||(n.dataSource=this.dataSource),t.dependencies||(n.dependencies=this.dependencies),t.resources||(n.resources=this.resources),t.assignments||(n.assignments=this.assignments),this.destroy(),this.element.empty(),this.options=null,
this.init(this.element,n,s),y.fn._setEvents.call(this,n)},_attachEvents:function(){this._resizeHandler=B(this.resize,this,!1),e(window).on("resize"+W,this._resizeHandler)},_wrapper:function(){var e=f.styles,t=[e.icon,e.resizeHandle].join(" "),i=this.options,n=i.height,s=i.width;this.wrapper=this.element.addClass(e.wrapper).append("<div class='"+e.listWrapper+"'><div></div></div>").append("<div class='"+e.splitBarWrapper+"'><div class='"+t+"'></div></div>").append("<div class='"+e.timelineWrapper+"'><div></div></div>"),this.wrapper.find(V+e.list).width(i.listWidth),n&&this.wrapper.height(n),s&&this.wrapper.width(s),i.rowHeight&&this.wrapper.addClass(e.rowHeight)},_toolbar:function(){var t,i,n,s=this,r=f.styles,a=V+r.toolbar.views+" > li",o=V+r.toolbar.pdfButton,d=V+r.buttonToggle,l=V+r.gridContent,c=e(V+r.list),u=e(V+r.timeline),h=r.hovered,p=this.options.toolbar,g=e("<div class='"+r.toolbar.actions+"'>"),b=function(e){e.matches?c.css({display:"none","max-width":0}):(c.css({display:"inline-block",width:"30%","max-width":"none"}),u.css("display","inline-block"),s.refresh(),u.find(l).scrollTop(s.scrollTop)),s._resize()};x(p)||(p=typeof p===U?p:this._actions(p),p=B(m.template(p),this)),n=e(X({styles:r.toolbar})),i=e($({ns:m.ns,views:this.timeline.views,styles:r.toolbar})),g.append(p({})),t=e("<div class='"+r.toolbar.headerWrapper+"'>").append(n).append(i).append(g),i.find("li").length>1&&i.prepend(Z({styles:r.toolbar})),this.wrapper.prepend(t),this.toolbar=t,v&&(this._mediaQueryHandler=B(b,this),this._mediaQuery=window.matchMedia("(max-width: 480px)"),this._mediaQuery.addListener(this._mediaQueryHandler)),t.on(M+W,a,function(t){var n,a,o;t.preventDefault(),n=s.list,a=e(this).attr(m.attr("name")),o=i.find(V+r.toolbar.currentView),o.is(":visible")&&o.parent().toggleClass(r.toolbar.expanded),n.editable&&n.editable.trigger("validate")||s.trigger("navigate",{view:a})||s.view(a)}).on(M+W,o,function(e){e.preventDefault(),s.saveAsPDF()}).on(M+W,d,function(e){e.preventDefault(),c.is(":visible")?(c.css({display:"none",width:"0"}),u.css({display:"inline-block",width:"100%"}),s.refresh(),u.find(l).scrollTop(s.scrollTop)):(u.css({display:"none",width:0}),c.css({display:"inline-block",width:"100%","max-width":"none"}).find(l).scrollTop(s.scrollTop)),s._resize()}),this.wrapper.find(V+r.toolbar.toolbar+" li").hover(function(){e(this).addClass(h)},function(){e(this).removeClass(h)})},_actions:function(){var e,t,i=this.options,n=i.editable,s=i.toolbar,r="";if(!T(s)){if(!n||n.create===!1)return r;s=["append"]}for(e=0,t=s.length;e<t;e++)r+=this._createButton(s[e]);return r},_footer:function(){var t,i,n,s,r,a=this.options.editable;a&&a.create!==!1&&(t=f.styles.toolbar,i=this.options.messages.actions,n=e(m.template(Y)(R(!0,{styles:t},o.append,{text:i.append}))),s=e("<div class='"+t.actions+"'>").append(n),r=e("<div class='"+t.footerWrapper+"'>").append(s),this.wrapper.append(r),this.footer=r)},_createButton:function(e){var t=e.template||Y,i=this.options.messages.actions,n=typeof e===U?e:e.name||e.text,s=o[n]?o[n].className:"k-gantt-"+(n||"").replace(/\s/g,""),r={iconClass:"",action:"",text:n,className:s,styles:f.styles.toolbar};if(!(n||F(e)&&e.template))throw Error("Custom commands should have name specified");return r=R(!0,r,o[n],{text:i[n]}),F(e)&&(e.className&&C(r.className,e.className.split(" "))<0&&(e.className+=" "+r.className),r=R(!0,r,e)),m.template(t)(r)},_adjustDimensions:function(){var e=this.element,t=f.styles,i=V+t.list,n=V+t.timeline,s=V+t.splitBar,r=H(this.toolbar),a=this.footer?H(this.footer):0,o=e.height(),d=e.width(),l=E(e.find(s)),c=E(e.find(i));e.children([i,n,s].join(",")).height(o-(r+a)).end().children(n).width(d-(l+c)),d<c+l&&e.find(i).width(d-l)},_scrollTo:function(e){var t,n,s=this.timeline.view(),r=this.list,a=m.attr("uid"),o="string"==typeof e?e:e.closest("tr"+i()).attr(a),d=function(){0!==n.length&&t()};s.content.is(":visible")?(n=s.content.find(i(o)),t=function(){s._scrollTo(n)}):(n=r.content.find(i(o)),t=function(){n.get(0).scrollIntoView()}),d()},_dropDowns:function(){var e=this,t=V+f.styles.toolbar.actions,i=this.options.messages.actions,n=this.timeline,s=this.options.editable,r=function(t){var i,s=t.type,r=e.dataSource,a=r._createNewModel(),o=e.dataItem(e.select()),d=r.taskParent(o),l=n.view()._timeSlots()[0],c="add"===s?o:d,u=e.list.editable;u&&u.trigger("validate")||(a.set("title","New task"),c?(a.set("parentId",c.get("id")),a.set("start",c.get("start")),a.set("end",c.get("end"))):(a.set("start",l.start),a.set("end",l.end)),"add"!==s&&(i=o.get("orderId"),i="insert-before"===s?i:i+1),e._createTask(a,i))};s&&s.create!==!1&&(this.footerDropDown=new se(this.footer.children(t).eq(0),{messages:{actions:i},direction:"up",animation:{open:{effects:"slideIn:up"}},navigatable:e.options.navigatable}),this.headerDropDown=new se(this.toolbar.children(t).eq(0),{messages:{actions:i},navigatable:e.options.navigatable}),this.footerDropDown.bind("command",r),this.headerDropDown.bind("command",r))},_list:function(){var e,t,i=this,n=i.options.navigatable,s=f.styles,a=this.wrapper.find(V+s.list),o=a.find("> div"),d=this.wrapper.find(V+s.toolbar.actions+" > button"),l={columns:this.options.columns||[],dataSource:this.dataSource,selectable:this.options.selectable,editable:this.options.editable,resizable:this.options.resizable,columnResizeHandleWidth:this.options.columnResizeHandleWidth,listWidth:E(a),resourcesField:this.resources.field,rowHeight:this.options.rowHeight},c=l.columns,u=function(){n&&(i._current(i._cachedCurrent),r(i.list.content.find("table"),!0)),delete i._cachedCurrent};for(t=0;t<c.length;t++)e=c[t],e.field===this.resources.field&&"function"!=typeof e.editor&&(e.editor=B(this._createResourceEditor,this));this.list=new m.ui.GanttList(o,l),this.list.bind("render",function(){i._navigatable()},!0).bind("edit",function(e){i._cachedCurrent=e.cell,i.trigger("edit",{task:e.model,container:e.cell})&&e.preventDefault()}).bind("cancel",function(e){i.trigger("cancel",{task:e.model,container:e.cell})&&e.preventDefault(),u()}).bind("update",function(e){i._updateTask(e.task,e.updateInfo),u()}).bind("change",function(){i.trigger("change");var e=i.list.select();e.length?(d.removeAttr("data-action","add"),i.timeline.select("[data-uid='"+e.attr("data-uid")+"']")):(d.attr("data-action","add"),i.timeline.clearSelection())}).bind("columnResize",function(e){i.trigger("columnResize",{column:e.column,oldWidth:e.oldWidth,newWidth:e.newWidth})})},_timeline:function(){var e=this,i=f.styles,s=n(R(!0,{resourcesField:this.resources.field},this.options)),r=this.wrapper.find(V+i.timeline+" > div"),a=V+i.toolbar.currentView+" > "+V+i.toolbar.link;this.timeline=new m.ui.GanttTimeline(r,s),this.timeline.bind("navigate",function(t){var n=t.view.replace(/\./g,"\\.").toLowerCase(),s=e.toolbar.find(V+i.toolbar.views+" > li").removeClass(i.selected).end().find(V+i.toolbar.viewButton+"-"+n).addClass(i.selected).find(V+i.toolbar.link).text();e.toolbar.find(a).text(s),e.refresh()}).bind("moveStart",function(i){var n=e.list.editable;return n&&n.trigger("validate")?(i.preventDefault(),t):(e.trigger("moveStart",{task:i.task})&&i.preventDefault(),t)}).bind("move",function(t){var i=t.task,n=t.start,s=new Date(n.getTime()+i.duration());e.trigger("move",{task:i,start:n,end:s})&&t.preventDefault()}).bind("moveEnd",function(t){var i=t.task,n=t.start,s=new Date(n.getTime()+i.duration());e.trigger("moveEnd",{task:i,start:n,end:s})||e._updateTask(e.dataSource.getByUid(i.uid),{start:n,end:s})}).bind("resizeStart",function(i){var n=e.list.editable;return n&&n.trigger("validate")?(i.preventDefault(),t):(e.trigger("resizeStart",{task:i.task})&&i.preventDefault(),t)}).bind("resize",function(t){e.trigger("resize",{task:t.task,start:t.start,end:t.end})&&t.preventDefault()}).bind("resizeEnd",function(t){var i=t.task,n={};t.resizeStart?n.start=t.start:n.end=t.end,e.trigger("resizeEnd",{task:i,start:t.start,end:t.end})||e._updateTask(e.dataSource.getByUid(i.uid),n)}).bind("percentResizeStart",function(t){var i=e.list.editable;i&&i.trigger("validate")&&t.preventDefault()}).bind("percentResizeEnd",function(t){e._updateTask(e.dataSource.getByUid(t.task.uid),{percentComplete:t.percentComplete})}).bind("dependencyDragStart",function(t){var i=e.list.editable;i&&i.trigger("validate")&&t.preventDefault()}).bind("dependencyDragEnd",function(t){var i=e.dependencies._createNewModel({type:t.type,predecessorId:t.predecessor.id,successorId:t.successor.id});e._createDependency(i)}).bind("select",function(t){var i=e.list.editable;i&&i.trigger("validate"),e.select("[data-uid='"+t.uid+"']")}).bind("editTask",function(t){var i=e.list.editable;i&&i.trigger("validate")||e.editTask(t.uid)}).bind("clear",function(){e.clearSelection()}).bind("removeTask",function(t){var i=e.list.editable;i&&i.trigger("validate")||e.removeTask(e.dataSource.getByUid(t.uid))}).bind("removeDependency",function(t){var i=e.list.editable;i&&i.trigger("validate")||e.removeDependency(e.dependencies.getByUid(t.uid))})},_dataSource:function(){var e=this.options,t=e.dataSource;t=T(t)?{data:t}:t,this.dataSource&&this._refreshHandler?this.dataSource.unbind("change",this._refreshHandler).unbind("progress",this._progressHandler).unbind("error",this._errorHandler):(this._refreshHandler=B(this.refresh,this),this._progressHandler=B(this._requestStart,this),this._errorHandler=B(this._error,this)),this.dataSource=m.data.GanttDataSource.create(t).bind("change",this._refreshHandler).bind("progress",this._progressHandler).bind("error",this._errorHandler)},_dependencies:function(){var e=this.options.dependencies||{},t=T(e)?{data:e}:e;this.dependencies&&this._dependencyRefreshHandler?this.dependencies.unbind("change",this._dependencyRefreshHandler).unbind("error",this._dependencyErrorHandler):(this._dependencyRefreshHandler=B(this.refreshDependencies,this),this._dependencyErrorHandler=B(this._error,this)),this.dependencies=m.data.GanttDependencyDataSource.create(t).bind("change",this._dependencyRefreshHandler).bind("error",this._dependencyErrorHandler)},_resources:function(){var e=this.options.resources,t=e.dataSource||{};this.resources={field:"resources",dataTextField:"name",dataColorField:"color",dataFormatField:"format"},R(this.resources,e),this.resources.dataSource=m.data.DataSource.create(t)},_assignments:function(){var e=this.options.assignments,t=e.dataSource||{};this.assignments?this.assignments.dataSource.unbind("change",this._assignmentsRefreshHandler):this._assignmentsRefreshHandler=B(this.refresh,this),this.assignments={dataTaskIdField:"taskId",dataResourceIdField:"resourceId",dataValueField:"value"},R(this.assignments,e),this.assignments.dataSource=m.data.DataSource.create(t),this.assignments.dataSource.bind("change",this._assignmentsRefreshHandler)},_createEditor:function(){var e=this,i=this._editor=new h(this.wrapper,R({},this.options,{target:this,resources:{field:this.resources.field,editor:B(this._createResourceEditor,this)},createButton:B(this._createPopupButton,this)}));i.bind("cancel",function(i){var n=e.dataSource.getByUid(i.model.uid);return e.trigger("cancel",{container:i.container,task:n})?(i.preventDefault(),t):(e.cancelTask(),t)}).bind("edit",function(t){var i=e.dataSource.getByUid(t.model.uid);e.trigger("edit",{container:t.container,task:i})&&t.preventDefault()}).bind("save",function(t){var i=e.dataSource.getByUid(t.model.uid);e.saveTask(i,t.updateInfo)}).bind("remove",function(t){e.removeTask(t.model.uid)}).bind("close",e._onDialogClose)},_onDialogClose:function(){},_createResourceEditor:function(e,t){var i=this,n=t instanceof w?t:t.model,s=n.get("id"),r=this.options.messages,a=i.resources.field,o=this._resourceEditor=new p(e,{resourcesField:a,data:this._wrapResourceData(s),model:n,messages:R({},r.editor),buttons:[{name:"update",text:r.save,className:f.styles.primary},{name:"cancel",text:r.cancel}],createButton:B(this._createPopupButton,this),save:function(e){i._updateAssignments(e.model.get("id"),e.model.get(a))}});o.open()},_createPopupButton:function(e){var t=e.name||e.text,i={className:f.styles.popup.button+" k-gantt-"+(t||"").replace(/\s/g,""),text:t,attr:""};if(!(t||F(e)&&e.template))throw Error("Custom commands should have name specified");return F(e)&&(e.className&&(e.className+=" "+i.className),i=R(!0,i,e)),m.template(J)(i)},view:function(e){return this.timeline.view(e)},range:function(e){var t=this.dataSource,i=this.view(),n=this.timeline;return e&&(i.options.range={start:e.start,end:e.end},n._render(t.taskTree()),n._renderDependencies(this.dependencies.view())),{start:i.start,end:i.end}},date:function(e){var t=this.view();return e&&(t.options.date=e,t._scrollToDate(e)),t.options.date},dataItem:function(e){var t,i;return e?(t=this.list,i=t.content.find(e),t._modelFromElement(i)):null},setDataSource:function(e){this.options.dataSource=e,this._dataSource(),this.list._setDataSource(this.dataSource),this.options.autoBind&&e.fetch()},setDependenciesDataSource:function(e){this.options.dependencies=e,this._dependencies(),this.options.autoBind&&e.fetch()},items:function(){return this.wrapper.children(".k-task")},_updateAssignments:function(e,t){for(var i,n,s,r,a,o,d,l=this.assignments.dataSource,c=this.assignments.dataTaskIdField,u=this.assignments.dataResourceIdField,h=!1,p=new D(l.view()).filter({field:c,operator:"eq",value:e}).toArray();p.length;){for(i=p[0],r=0,a=t.length;r<a;r++)if(n=t[r],i.get(u)===n.get("id")){s=t[r].get("value"),this._updateAssignment(i,s),t.splice(r,1),h=!0;break}h||this._removeAssignment(i),h=!1,p.shift()}for(o=0,d=t.length;o<d;o++)n=t[o],this._createAssignment(n,e);l.sync()},cancelTask:function(){var e=this._editor,t=e.container;t&&e.close()},editTask:function(e){var t,i="string"==typeof e?this.dataSource.getByUid(e):e;i&&(t=this.dataSource._createNewModel(i.toJSON()),t.uid=i.uid,this.cancelTask(),this._editTask(t))},_editTask:function(e){this._editor.editTask(e)},saveTask:function(e,t){var i=this._editor,n=i.container,s=i.editable;n&&s&&s.end()&&this._updateTask(e,t)},_updateTask:function(e,t){var i=this.resources.field;this.trigger("save",{task:e,values:t})||(this._preventRefresh=!0,this.dataSource.update(e,t),t[i]&&this._updateAssignments(e.get("id"),t[i]),this._syncDataSource())},_updateAssignment:function(e,t){var i=this.assignments.dataValueField;e.set(i,t)},removeTask:function(e){var t=this,i="string"==typeof e?this.dataSource.getByUid(e):e;i&&this._taskConfirm(function(e){e||t._removeTask(i)},i)},_createTask:function(e,i){if(!this.trigger("add",{task:e,dependency:null})){var n=this.dataSource;this._preventRefresh=!0,i===t?n.add(e):n.insert(i,e),this._scrollToUid=e.uid,this._syncDataSource()}},_createDependency:function(e){this.trigger("add",{task:null,dependency:e})||(this._preventDependencyRefresh=!0,this.dependencies.add(e),this._preventDependencyRefresh=!1,this.dependencies.sync())},_createAssignment:function(e,t){var i=this.assignments,n=i.dataSource,s=i.dataTaskIdField,r=i.dataResourceIdField,a=i.dataValueField,o=n._createNewModel();o[s]=t,o[r]=e.get("id"),o[a]=e.get("value"),n.add(o)},removeDependency:function(e){var t=this,i="string"==typeof e?this.dependencies.getByUid(e):e;i&&this._dependencyConfirm(function(e){e||t._removeDependency(i)},i)},_removeTaskDependencies:function(e,t){this._preventDependencyRefresh=!0;for(var i=0,n=t.length;i<n;i++)this.dependencies.remove(t[i]);this._preventDependencyRefresh=!1,this.dependencies.sync()},_removeTaskAssignments:function(e){var t,i,n=this.assignments.dataSource,s=n.view(),r={field:this.assignments.dataTaskIdField,operator:"eq",value:e.get("id")};for(s=new D(s).filter(r).toArray(),this._preventRefresh=!0,t=0,i=s.length;t<i;t++)n.remove(s[t]);this._preventRefresh=!1,n.sync()},_removeTask:function(e){var t=this.dependencies.dependencies(e.id);this.trigger("remove",{task:e,dependencies:t})||(this._removeTaskDependencies(e,t),this._removeTaskAssignments(e),this._preventRefresh=!0,this.dataSource.remove(e)&&this._syncDataSource(),this._preventRefresh=!1)},_removeDependency:function(e){this.trigger("remove",{task:null,dependencies:[e]})||this.dependencies.remove(e)&&this.dependencies.sync()},_removeAssignment:function(e){this.assignments.dataSource.remove(e)},_taskConfirm:function(e,t){var i=this.options.messages;this._confirm(e,{model:t,text:i.deleteTaskConfirmation,title:i.deleteTaskWindowTitle})},_dependencyConfirm:function(e,t){var i=this.options.messages;this._confirm(e,{model:t,text:i.deleteDependencyConfirmation,title:i.deleteDependencyWindowTitle})},_confirm:function(e,t){var i,n,s=this.options.editable;s===!0||s.confirmation!==!1?(i=this.options.messages,n=[{name:"delete",text:i.destroy,className:f.styles.primary,click:function(){e()}},{name:"cancel",text:i.cancel,click:function(){e(!0)}}],this.showDialog(R(!0,{},t,{buttons:n}))):e()},showDialog:function(e){this._editor.showDialog(e)},refresh:function(){var e,t,n,s,r,a;this._preventRefresh||this.list.editable||(this._progress(!1),e=this.dataSource,t=e.taskTree(),n=this._scrollToUid,a=-1,this.current&&(r=this.current.closest("tr").attr(m.attr("uid")),a=this.current.index()),this.trigger("dataBinding")||(0!==this.resources.dataSource.data().length&&this._assignResources(t),this._editor&&this._editor.close(),this.clearSelection(),this.list._render(t),this.timeline._render(t),this.timeline._renderDependencies(this.dependencies.view()),n&&(this._scrollTo(n),this.select(i(n))),(n||r)&&a>=0&&(s=this.list.content.find("tr"+i(n||r)+" > td:eq("+a+")"),this._current(s)),this._scrollToUid=null,this.trigger("dataBound")))},refreshDependencies:function(){this._preventDependencyRefresh||this.trigger("dataBinding")||(this.timeline._renderDependencies(this.dependencies.view()),this.trigger("dataBound"))},_assignResources:function(e){var t,i,n=this.resources,s=this.assignments,r=function(){var e=s.dataSource.view(),t={field:s.dataTaskIdField};return e=new D(e).group(t).toArray()},a=r(),o=function(e,t){var i,s,r=e.get("id");for(m.setter(n.field)(e,new S([])),i=0,s=a.length;i<s;i++)a[i].value===r&&t(e,a[i].items)},d=function(e,t){var i,r,a,o,d,l,c,u;for(i=0,r=t.length;i<r;i++)a=t[i],o=n.dataSource.get(a.get(s.dataResourceIdField)),d=a.get(s.dataValueField),l=a.get(s.dataResourceIdField),c=o.get(n.dataFormatField)||P,u=m.toString(d,c),e[n.field].push(new w({id:l,name:o.get(n.dataTextField),color:o.get(n.dataColorField),value:d,formatedValue:u}))};for(t=0,i=e.length;t<i;t++)o(e[t],d)},_wrapResourceData:function(e){var t,i,n,s=this,r=[],a=this.resources.dataSource.view(),o=this.assignments.dataSource.view(),d=new D(o).filter({field:s.assignments.dataTaskIdField,operator:"eq",value:e}).toArray(),l=function(e){var t=null;return new D(d).filter({field:s.assignments.dataResourceIdField,operator:"eq",value:e}).select(function(e){t+=e.get(s.assignments.dataValueField)}),t};for(i=0,n=a.length;i<n;i++)t=a[i],r.push({id:t.get("id"),name:t.get(s.resources.dataTextField),format:t.get(s.resources.dataFormatField)||P,value:l(t.id)});return r},_syncDataSource:function(){this._preventRefresh=!1,this._requestStart(),this.dataSource.sync()},_requestStart:function(){this._progress(!0)},_error:function(){this._progress(!1)},_progress:function(e){m.ui.progress(this.element,e)},_resizable:function(){var t,i,n,s=this,r=this.wrapper,a=f.styles,o=V+a.gridContent,d=r.find(V+a.list),l=r.find(V+a.timeline);this._resizeDraggable=r.find(V+a.splitBar).height(d.height()).hover(function(){e(this).addClass(a.splitBarHover)},function(){e(this).removeClass(a.splitBarHover)}).end().kendoResizable({orientation:"horizontal",handle:V+a.splitBar,start:function(){t=d.width(),i=l.width(),n=l.find(o).scrollLeft()},resize:function(e){var a=e.x.initialDelta;m.support.isRtl(r)&&(a*=-1),t+a<0||i-a<0||(d.width(t+a),l.width(i-a),l.find(o).scrollLeft(n+a),s.timeline.view()._renderCurrentTime())}}).data("kendoResizable")},_scrollable:function(){var t=this,i=f.styles,n=V+i.gridContent,s=V+i.gridHeaderWrap,r=this.timeline.element.find(s),a=this.timeline.element.find(n),o=this.list.element.find(s),d=this.list.element.find(n);b&&d.css("overflow-y","auto"),a.on("scroll",function(){t.scrollTop=this.scrollTop,r.scrollLeft(this.scrollLeft),d.scrollTop(this.scrollTop)}),d.on("scroll",function(){o.scrollLeft(this.scrollLeft)}).on("DOMMouseScroll"+W+" mousewheel"+W,function(t){var i=a.scrollTop(),n=m.wheelDeltaY(t);n&&(t.preventDefault(),e(t.currentTarget).one("wheel"+W,!1),a.scrollTop(i+-n))})},_navigatable:function(){var n,s=this,a=this.options.navigatable,o=this.options.editable,d=this.list.header.find("table"),l=this.list.content.find("table"),c=f.styles,u=m.support.isRtl(this.wrapper),h=this.timeline.element.find(V+c.gridContent),p=d.add(l),v=i(),g={collapse:!1,expand:!0},b=function(e){var t=s.timeline.view()._timeSlots()[0].offsetWidth;h.scrollLeft(h.scrollLeft()+(e?-t:t))},_=function(e){var t=s.current.parent("tr"+i()),n=s.current.index(),a=t[e]();0!==s.select().length&&s.clearSelection(),0!==a.length?(s._current(a.children("td:eq("+n+")")),s._scrollTo(s.current)):s.current.is("td")&&"prev"==e?r(d):s.current.is("th")&&"next"==e&&r(l)},y=function(e){var t=s.current[e]();0!==t.length&&(s._current(t),n=s.current.index())},k=function(e){var t=s.dataItem(s.current);t.summary&&t.expanded!==e&&t.set("expanded",e)},w=function(){var e,t,i=s.options.editable;i&&i.destroy!==!1&&!s.list.editable&&(e=s.select(),t=m.attr("uid"),e.length&&s.removeTask(e.attr(t)))};return e(this.wrapper).on("mousedown"+W,"tr"+v+", div"+v+":not("+V+c.line+")",function(t){var n,d=e(t.currentTarget),l=e(t.target).is(":button,a,:input,a>.k-icon,textarea,span.k-icon,span.k-link,.k-input,.k-multiselect-wrap");t.ctrlKey||(a&&(n=d.is("tr")?e(t.target).closest("td"):s.list.content.find("tr"+i(d.attr(m.attr("uid")))+" > td:first"),s._current(n)),!a&&!o||l||(s._focusTimeout=setTimeout(function(){r(s.list.content.find("table"),!0)},2)))}),a!==!0?(l.on("keydown"+W,function(e){e.keyCode==z.DELETE&&w()}),t):(p.on("focus"+W,function(){var t=this===l.get(0)?"td":"th",i=s.select(),r=s.current||e(i.length?i:this).find(t+":eq("+(n||0)+")");s._current(r)}).on("blur"+W,function(){s._current(),this==d&&e(this).attr(N,-1)}).on("keydown"+W,function(t){var i,n=t.keyCode;if(s.current)switch(i=s.current.is("td"),n){case z.RIGHT:t.preventDefault(),t.altKey?b():t.ctrlKey?k(u?g.collapse:g.expand):y(u?"prev":"next");break;case z.LEFT:t.preventDefault(),t.altKey?b(!0):t.ctrlKey?k(u?g.expand:g.collapse):y(u?"next":"prev");break;case z.UP:t.preventDefault(),_("prev");break;case z.DOWN:t.preventDefault(),_("next");break;case z.SPACEBAR:t.preventDefault(),i&&s.select(s.current.closest("tr"));break;case z.ENTER:t.preventDefault(),i?s.options.editable&&s.options.editable.update!==!1&&(s._cachedCurrent=s.current,s.list._startEditHandler(s.current),e(this).one("keyup",function(e){e.stopPropagation()})):s.current.children("a.k-link").click();break;case z.ESC:t.stopPropagation();break;case z.DELETE:i&&w();break;default:n>=49&&n<=57&&s.view(s.timeline._viewByIndex(n-49))}}),t)},_current:function(t){var i,n=f.styles;this.current&&this.current.length&&this.current.removeClass(n.focused).removeAttr("id"),t&&t.length?(this.current=t.addClass(n.focused).attr("id",j),i=e(m._activeElement()),i.is("table")&&this.wrapper.find(i).length>0&&i.removeAttr(O).attr(O,j)):this.current=null},_dataBind:function(){var t,i=this;i.options.autoBind&&(this._preventRefresh=!0,this._preventDependencyRefresh=!0,t=e.map([this.dataSource,this.dependencies,this.resources.dataSource,this.assignments.dataSource],function(e){return e.fetch()}),e.when.apply(null,t).done(function(){i._preventRefresh=!1,i._preventDependencyRefresh=!1,i.refresh()}))},_resize:function(){this._adjustDimensions(),this.timeline.view()._adjustHeight(),this.timeline.view()._renderCurrentTime(),this.list._adjustHeight()}}),m.PDFMixin&&(m.PDFMixin.extend(f.fn),f.fn._drawPDF=function(){var e=f.styles,t="."+e.list,i=this.wrapper.find(t).width(),n=this.wrapper.clone();return n.find(t).css("width",i),this._drawPDFShadow({content:n},{avoidLinks:this.options.pdf.avoidLinks})}),m.ui.plugin(f),R(!0,f,{styles:ne})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,i){(i||t)()});
//# sourceMappingURL=kendo.gantt.min.js.map
