UNPKG

@syncfusion/ej2-gantt

Version:
12 lines 1.24 MB
/*!
*  filename: ej2-gantt.umd.min.js
*  version : 30.2.5
*  Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
*  Use of this code is subject to the terms of our license.
*  A copy of the current license can be obtained at any time by e-mailing
*  licensing@syncfusion.com. Any infringement will be prosecuted under
*  applicable laws. 
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-treegrid"),require("@syncfusion/ej2-dropdowns"),require("@syncfusion/ej2-svg-base"),require("@syncfusion/ej2-layouts"),require("@syncfusion/ej2-navigations"),require("@syncfusion/ej2-richtexteditor"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-calendars"),require("@syncfusion/ej2-pdf-export")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-popups","@syncfusion/ej2-data","@syncfusion/ej2-grids","@syncfusion/ej2-treegrid","@syncfusion/ej2-dropdowns","@syncfusion/ej2-svg-base","@syncfusion/ej2-layouts","@syncfusion/ej2-navigations","@syncfusion/ej2-richtexteditor","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-calendars","@syncfusion/ej2-pdf-export"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Popups,e.ej2Data,e.ej2Grids,e.ej2Treegrid,e.ej2Dropdowns,e.ej2SvgBase,e.ej2Layouts,e.ej2Navigations,e.ej2Richtexteditor,e.ej2Inputs,e.ej2Buttons,e.ej2Calendars,e.ej2PdfExport)}(this,function(k,ne,F,D,w,T,U,N,L,V,h,B,A,W,re){"use strict";function S(e,t,i){for(var a=e;a&&(i?a.id!==t:!a.classList.contains(t));)a=a.parentElement;return a}function j(e){return ne.isNullOrUndefined(e.startDate)&&ne.isNullOrUndefined(e.endDate)&&ne.isNullOrUndefined(e.duration)?null:!(ne.isNullOrUndefined(e.startDate)||ne.isNullOrUndefined(e.endDate)||ne.isNullOrUndefined(e.duration))}function H(e){return!(!e.dataSource||e.dataSource instanceof D.DataManager||!("result"in e.dataSource))}function z(e){for(var t={},i=0,a=Object.keys(e);i<a.length;i++){var n=a[i];t[e[n]]=n}return t}function G(e){return!ne.isNullOrUndefined(e)&&"object"==typeof e&&0===Object.keys(e).length}function q(e){var t=e.getFullYear(),i=e.getMonth(),a=e.getDate(),n=e.getHours(),r=e.getMinutes(),s=e.getSeconds(),e=e.getMilliseconds();return Date.UTC(t,i,a,n,r,s,e)}function _(e){return e instanceof D.DataManager&&((e=e.adaptor)instanceof D.ODataAdaptor||e instanceof D.ODataV4Adaptor||e instanceof D.WebApiAdaptor||e instanceof D.WebMethodAdaptor||e instanceof D.CacheAdaptor||e instanceof D.RemoteSaveAdaptor||e instanceof D.UrlAdaptor)}function Z(e,t,i,a){if(i)for(var n=void 0,r=0;r<e.length;r++)n=s=t?e[parseInt(r.toString(),10)].taskData:ne.extend({},e[parseInt(r.toString(),10)].taskData,{},!0);else for(n=[],r=0;r<e.length;r++){!ne.isNullOrUndefined(a)&&a.timezone&&X(e[r],a);var s=t?e[parseInt(r.toString(),10)].taskData:ne.extend({},e[parseInt(r.toString(),10)].taskData,{},!0);n.push(s)}return n}function X(e,t){return e&&!ne.isNullOrUndefined(e.ganttProperties)&&(e.taskData[t.taskFields.startDate]=t.dateValidationModule.remove(e.ganttProperties.startDate,t.timezone),null!==t.taskFields.endDate&&(e.taskData[t.taskFields.endDate]=t.dateValidationModule.remove(e.ganttProperties.endDate,t.timezone)),t.taskFields.baselineEndDate||t.taskFields.baselineStartDate)&&(e.taskData[t.taskFields.baselineStartDate]=t.dateValidationModule.remove(e.ganttProperties.baselineStartDate,t.timezone),e.taskData[t.taskFields.baselineEndDate]=t.dateValidationModule.remove(e.ganttProperties.baselineEndDate,t.timezone)),null}function Y(e,t){for(var i,a=0;a<t.length;a++)i=new RegExp("\\{"+a+"\\}","gm"),e=e.replace(i,t[a].toString());return e}function K(e,t,i,a){for(var n=-1,r=0;r<i.length;r++)if(ne.getValue(t,i[r])===ne.getValue(t,e)&&ne.isNullOrUndefined(a)||!ne.isNullOrUndefined(a)&&ne.getValue(t,i[r])===ne.getValue(t,e)&&ne.getValue(a,i[r])===ne.getValue(a,e)){n=r;break}return n}function se(e){return 76*e/92}function oe(e){return 92*e/76}var Q=0;function $(){return Q++}(r=k.ConstraintType||(k.ConstraintType={}))[r.AsSoonAsPossible=0]="AsSoonAsPossible",r[r.AsLateAsPossible=1]="AsLateAsPossible",r[r.MustStartOn=2]="MustStartOn",r[r.MustFinishOn=3]="MustFinishOn",r[r.StartNoEarlierThan=4]="StartNoEarlierThan",r[r.StartNoLaterThan=5]="StartNoLaterThan",r[r.FinishNoEarlierThan=6]="FinishNoEarlierThan",r[r.FinishNoLaterThan=7]="FinishNoLaterThan";e.prototype.isValidateNonWorkDays=function(e){return!ne.isNullOrUndefined(e)&&e.isAutoSchedule&&(!this.parent.includeWeekend||0<this.parent.totalHolidayDates.length)||ne.isNullOrUndefined(e)&&(!this.parent.includeWeekend||0<this.parent.totalHolidayDates.length)},e.prototype.checkStartDate=function(e,t,i,a,n){if(ne.isNullOrUndefined(e))return null;var r=new Date(e.getTime()),s=this.parent.getCurrentDayStartTime(r),o=this.parent.getCurrentDayEndTime(r),l=new Date(e.getTime()),d=this.getSecondsInDecimal(l);if(i=ne.isNullOrUndefined(i)?!ne.isNullOrUndefined(t)&&t.isMilestone:i,d<s&&(!i||a))this.setTime(s,l);else if(d<s&&i)this.setTime(s,l);else if(d===o&&(!t||!i)||o<d)l.setDate(l.getDate()+1),s=this.parent.getCurrentDayStartTime(l),this.setTime(s,l);else if(s<d&&d<o){var h=this.parent.workingTimeRanges;0<this.parent.weekWorkingTime.length&&(h=this.parent.getWorkingRange(l));for(var p=0;p<h.length;p++){var u=h[p];if(d>=u.to&&h[p+1]&&d<h[p+1].from){(d!==u.to||t&&i)&&d===u.to||this.setTime(h[p+1].from,l);break}}}if(this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping))do{var c=new Date(l.getTime()),g=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(t)){s=this.parent.getCurrentDayStartTime(c),t&&(o=n?this.parent.getCurrentDayEndTime(t.baselineEndDate||c):this.parent.getCurrentDayEndTime(t.endDate?t.isAutoSchedule?t.endDate:t.autoEndDate:c));var f,m=!i||a?s:o;if(this.parent.includeWeekend||n||(f=new Date(l.getTime()),l=this.getNextWorkingDay(l),m=this.parent.getCurrentDayStartTime(l),f.getTime()===l.getTime())||i||this.setTime(m,l),!n)for(var y=0;y<g;y++){var D=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[y])),k=new Date(D.getTime());D.setHours(0,0,0,0),k.setHours(23,59,59,59),l.getTime()>=D.getTime()&&l.getTime()<k.getTime()&&(l.setDate(l.getDate()+1),m=this.parent.getCurrentDayStartTime(l),this.setTime(m,l))}}}while(c.getTime()!==l.getTime());return new Date(l.getTime())},e.prototype.getDateByConstraint=function(e,t,i,a){var n=e.ganttProperties||e,r=new Date(n.constraintDate),s=this.parent.isLoad;if(ne.isNullOrUndefined(a)&&(a=!0),(!r||!t)&&a)return null;switch(r=this.parent.assignTimeToDate(r,this.parent.getCurrentDayStartTime(r)),n.constraintType){case k.ConstraintType.AsSoonAsPossible:return s?t:(n.constraintDate=null,l=this.parent.getRecordByID(n.taskId).parentItem,n.predecessor&&0<n.predecessor.length?this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t)):l?this.parent.getRecordByID(l.taskId).ganttProperties.startDate:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));case k.ConstraintType.AsLateAsPossible:return s?t:(h=(l=this.parent.getRecordByID(n.taskId).parentItem)?this.parent.dateValidationModule.checkEndDate(this.parent.getRecordByID(l.taskId).ganttProperties.endDate):this.parent.dateValidationModule.checkEndDate(new Date(this.parent.projectEndDate)),this.parent.dateValidationModule.getStartDate(h,n.duration,n.durationUnit,n));case k.ConstraintType.MustStartOn:var o=r.getTime()!==n.startDate.getTime(),l=void 0,d=(this.parent.editModule&&this.parent.editModule.dialogModule&&(l=this.parent.editModule.dialogModule.dialogConstraintValue),ne.isNullOrUndefined(l)||2===l||3===l);return o&&!s&&d&&(this.parent.constraintViolationType="MustStartOn"),l=null,s?this.parent.dateValidationModule.checkStartDate(new Date(r)):this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t));case k.ConstraintType.MustFinishOn:var o=r.getTime()!==n.endDate.getTime(),d=new Date(r),h=(d.setDate(d.getDate()+1),this.parent.dateValidationModule.checkEndDate(d)),l=this.parent.dateValidationModule.getStartDate(h,n.duration,n.durationUnit,n);return o&&!s&&(this.parent.constraintViolationType="MustFinishOn"),i?t:l;case k.ConstraintType.StartNoEarlierThan:return r.getTime()<t.getTime()||!s?this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t)):this.parent.dateValidationModule.checkStartDate(new Date(r));case k.ConstraintType.StartNoLaterThan:return((o=r.getTime()!==n.startDate.getTime())&&!s&&(this.parent.constraintViolationType="StartNoLaterThan"),s)?n.predecessor&&0<n.predecessor.length?t:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)):this.parent.assignTimeToDate(t,this.parent.getCurrentDayStartTime(t));case k.ConstraintType.FinishNoEarlierThan:return r.getTime()<t.getTime()?this.parent.assignTimeToDate(t,this.parent.getCurrentDayEndTime(t)):((d=new Date(r)).setDate(d.getDate()+1),h=this.parent.dateValidationModule.checkEndDate(d),this.parent.dateValidationModule.getStartDate(h,n.duration,n.durationUnit,n));case k.ConstraintType.FinishNoLaterThan:return((o=r.getTime()!==n.endDate.getTime())&&!s&&(this.parent.constraintViolationType="FinishNoLaterThan"),s)?n.predecessor&&0<n.predecessor.length?t:this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)):this.parent.assignTimeToDate(t,this.parent.getCurrentDayEndTime(t));default:return t}},e.prototype.checkEndDate=function(e,t,i,a){if(ne.isNullOrUndefined(e))return null;h=0<this.parent.weekWorkingTime.length?(o=e,(!this.parent.includeWeekend&&t&&t.isAutoSchedule||this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.taskBarEditRecord&&!this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.isAutoSchedule)&&(o=this.getNextWorkingDay(e)),n=this.parent.getStartTime(o),this.parent.getEndTime(o)):(n=this.parent.defaultStartTime,this.parent.defaultEndTime);var n,r=new Date(e.getTime()),s=this.getSecondsInDecimal(r);if(h<s)this.setTime(h,r);else if(s<=n&&86400!==h&&!i){var o=this.parent.taskFields;this.parent.editModule&&this.parent.editModule.editedRecord&&!this.parent.editModule.editedRecord[o.startDate]&&this.parent.editModule.editedRecord[o.endDate]?r.setDate(r.getDate()):r.setDate(r.getDate()-1),h=this.parent.getCurrentDayEndTime(r),this.setTime(h,r)}else if(n<s&&s<h)for(var l=0;l<this.parent.workingTimeRanges.length;l++)if(s>this.parent.workingTimeRanges[l].to&&this.parent.workingTimeRanges[l+1]&&s<=this.parent.workingTimeRanges[l+1].from){this.setTime(this.parent.workingTimeRanges[l].to,r);break}if(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)ne.isNullOrUndefined(r)||86400===this.parent.defaultEndTime||(h=this.parent.getCurrentDayEndTime(e),this.setTime(h,r));else do{var d,h,p=new Date(r.getTime()),u=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(t)&&!a){this.parent.includeWeekend||(d=new Date(r.getTime()),r=this.getPreviousWorkingDay(r),h=this.parent.getCurrentDayEndTime(r),d.getTime()!==r.getTime()&&this.setTime(h,r));for(var c=0;c<u;c++){var g=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[c])),f=new Date(g.getTime()),m=new Date(r.getTime());m.setMinutes(r.getMilliseconds()-2),g.setHours(0,0,0,0),f.setHours(23,59,59,59),(r.getTime()>=g.getTime()&&r.getTime()<f.getTime()||m.getTime()>=g.getTime()&&m.getTime()<f.getTime())&&(r.setDate(r.getDate()-1),h=this.parent.getCurrentDayEndTime(r),r.getTime()===g.getTime()&&86400===h&&0===this.getSecondsInDecimal(r)||this.setTime(h,r))}}}while(p.getTime()!==r.getTime());return new Date(r.getTime())},e.prototype.checkBaselineStartDate=function(e,t){if(ne.isNullOrUndefined(e))return null;var i=this.parent.getCurrentDayStartTime(e),t=this.parent.getCurrentDayEndTime(t&&t.endDate?t.isAutoSchedule?t.endDate:t.autoEndDate:e),a=new Date(e.getTime()),n=this.getSecondsInDecimal(a);if(n<i)this.setTime(i,a);else if(t<n)a.setDate(a.getDate()+1),i=0<this.parent.weekWorkingTime.length?this.parent.getStartTime(a):this.parent.defaultStartTime,this.setTime(i,a);else if(i<n&&n<t)for(var r=0;r<this.parent.workingTimeRanges.length;r++)if(n>this.parent.workingTimeRanges[r].to&&this.parent.workingTimeRanges[r+1]&&n<this.parent.workingTimeRanges[r+1].from){this.setTime(this.parent.workingTimeRanges[r+1].from,a);break}return a},e.prototype.checkBaselineEndDate=function(e,t){if(ne.isNullOrUndefined(e))return null;var i=this.parent.getCurrentDayEndTime(e),a=this.parent.getCurrentDayStartTime(t&&t.startDate?t.isAutoSchedule?t.startDate:t.autoStartDate:e),n=new Date(e.getTime()),r=this.getSecondsInDecimal(n);if(i<r)this.setTime(i,n);else if(r<a&&!ne.isNullOrUndefined(t)&&!t.isMilestone)n.setDate(n.getDate()-1),i=this.parent.getCurrentDayEndTime(n),this.setTime(i,n);else if(a<r&&r<i)for(var s=0;s<this.parent.workingTimeRanges.length;s++)if(r>this.parent.workingTimeRanges[s].to&&this.parent.workingTimeRanges[s+1]&&r<=this.parent.workingTimeRanges[s+1].from){this.setTime(this.parent.workingTimeRanges[s].to,n);break}return t&&t.baselineStartDate&&n&&t.baselineStartDate.getTime()>n.getTime()&&n.setDate(n.getDate()+1),n},e.prototype.calculateStartDate=function(e,t){var i=e.ganttProperties,a=null;t?(ne.isNullOrUndefined(i.baselineEndDate)||ne.isNullOrUndefined(i.baselineDuration)||(a=this.getStartDate(i.baselineEndDate,i.baselineDuration,i.durationUnit,i,void 0,!0)),this.parent.setRecordValue("baselineStartDate",a,i,!0),this.parent.taskFields.baselineStartDate&&this.parent.dataOperation.updateMappingData(e,"baselineStartDate")):(ne.isNullOrUndefined(i.endDate)||ne.isNullOrUndefined(i.duration)||(a=this.getStartDate(i.endDate,i.duration,i.durationUnit,i)),this.parent.setRecordValue("startDate",a,i,!0),this.parent.taskFields.startDate&&this.parent.dataOperation.updateMappingData(e,"startDate"))},e.prototype.getFieldMappings=function(e){return{startdateField:e?"baselineStartDate":"startDate",enddateField:e?"baselineEndDate":"endDate",durationField:e?"baselineDuration":"duration"}},e.prototype.calculateEndDate=function(e,t){var i,a,n=e.ganttProperties,r=null,s=this.getFieldMappings(t),o=s.startdateField,l=s.enddateField,s=s.durationField;ne.isNullOrUndefined(n[o])?(r=e[this.parent.taskFields[l]],ne.isNullOrUndefined(r)||(a=this.parent.getCurrentDayEndTime(r),this.setTime(a,r))):(!ne.isNullOrUndefined(n[l])&&ne.isNullOrUndefined(n[s])&&(1===this.compareDates(n[o],n[l])&&(this.parent.setRecordValue(o,new Date(n[l].getTime()),n,!0),i=this.parent.getCurrentDayStartTime(n.isAutoSchedule&&!t?n.autoStartDate:n[o]),a=this.parent.getCurrentDayEndTime(n.isAutoSchedule&&!t?n.autoEndDate:n[l]),this.setTime(i,n[o])),this.calculateDuration(e,t)),ne.isNullOrUndefined(n[s])||(a=!t&&!ne.isNullOrUndefined(n.segments)&&1<n.segments.length?this.totalDuration(n.segments):n[s],r=this.getEndDate(n[o],a,n.durationUnit,n,!1,t))),this.parent.setRecordValue(l,r,n,!0),this.parent.taskFields[l]&&this.parent.dataOperation.updateMappingData(e,l)},e.prototype.totalDuration=function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].duration+e[i].offsetDuration;return t},e.prototype.calculateDuration=function(e,t){var i,a,n,r=e.ganttProperties,s=(i=!t&&!ne.isNullOrUndefined(r.segments)&&0<r.segments.length&&!ne.isNullOrUndefined(this.parent.editModule.taskbarEditModule)?this.parent.editModule.taskbarEditModule.sumOfDuration(r.segments):t||ne.isNullOrUndefined(this.parent.taskFields.milestone)||ne.isNullOrUndefined(r.startDate)||ne.isNullOrUndefined(r.endDate)||r.startDate.getTime()!==r.endDate.getTime()||!1!==e.taskData[this.parent.taskFields.milestone]?(i=t?r.baselineStartDate:r.startDate,s=t?r.baselineEndDate:r.endDate,o=r.durationUnit,a=!t&&r.isAutoSchedule,n=!t&&r.isMilestone,this.getDuration(i,s,o,a,n)):1,t?"baselineDuration":"duration"),o=(this.parent.setRecordValue(s,i,r,!0),t?this.parent.columnByField[this.parent.columnMapping.baselineDuration]:this.parent.columnByField[this.parent.columnMapping.duration]);ne.isNullOrUndefined(this.parent.editModule)||ne.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||ne.isNullOrUndefined(o)||(ne.isNullOrUndefined(o.edit)||ne.isNullOrUndefined(o.edit.read)||(a=this.parent.editModule.dialogModule.dialog,ne.isNullOrUndefined(a))||(n=(t?a.querySelector("#"+this.parent.element.id+"BaselineDuration"):a.querySelector("#"+this.parent.element.id+"Duration")).ej2_instances[0],ne.isNullOrUndefined(n))||n.value===i.toString()||(n.value=i.toString(),n.dataBind()),(this.parent.taskFields.duration||this.parent.taskFields.baselineDuration)&&(this.parent.dataOperation.updateMappingData(e,s),this.parent.taskFields.durationUnit)&&this.parent.dataOperation.updateMappingData(e,"durationUnit"))},e.prototype.getNonworkingTime=function(e,t,i,a,n){a=!!ne.isNullOrUndefined(a)||a;var r=n||this.parent.includeWeekend||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||!i?0:this.getWeekendCount(e,t),a=this.getNumberOfSeconds(e,t,a),s=!i||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||n?0:this.getHolidaysCount(e,t),a=(a-86400*r-86400*s)/86400,n=this.getNonWorkingSecondsOnDate(e,t,i,n);return(0<this.parent.weekWorkingTime.length?this.nonWorkingSeconds(e,t,i,a):a*(86400-this.parent.secondsPerDay))+86400*r+86400*s+n},e.prototype.nonWorkingSeconds=function(e,t,i,a,n){var r=e.getTime()>t.getTime()?new Date(t.getTime()):new Date(e.getTime()),s=e.getTime()>t.getTime()?new Date(e.getTime()):new Date(t.getTime()),o=0,l=0;if(n?(e=this.parent.getCurrentDayStartTime(r),t=this.parent.getCurrentDayEndTime(r),r.getHours()<t/3600&&r.getHours()>=e/3600||r.setDate(r.getDate()+1)):(r.setDate(r.getDate()+1),r.setHours(0,0,0,0),s.setHours(0,0,0,0)),!(0<a||ne.isNullOrUndefined(a)))return 0;for(;n&&r.getTime()<=s.getTime()||!n&&r.getTime()<s.getTime();){if(i){if(this.isOnHolidayOrWeekEnd(r,!0))for(;r.setDate(r.getDate()+1),this.isOnHolidayOrWeekEnd(r,!0););this.parent.includeWeekend||this.getNextWorkingDay(r)}if(r.getTime()<=s.getTime()){l++;var d=this.parent.getSecondsPerDay(r);if(o+=n?d:86400-d,r.setDate(r.getDate()+1),i){if(this.isOnHolidayOrWeekEnd(r,!0))for(;r.setDate(r.getDate()+1),this.isOnHolidayOrWeekEnd(r,!0););this.parent.includeWeekend||this.getNextWorkingDay(r)}}}return n&&(0<o?o/=l:o=this.parent.secondsPerDay),o},e.prototype.getDuration=function(e,t,i,a,n,r){if(void 0===r&&(r=!0),!e||!t)return null;var s=0,o=this.parent.getFormatedDate(e)===this.parent.getFormatedDate(t);if(0<this.parent.weekWorkingTime.length){for(var l=new Date(e),d=this.nonWorkingSeconds(e,t,a,void 0,!0),h=0;l<=t;){var p=this.parent.getFormatedDate(l),u=this.parent.getSecondsPerDay(l),c=new Date(l),g=new Date(l),p=(c.setHours(0,0,0,0),g.setHours(0,0,0,0),c.setSeconds(this.parent.getCurrentDayStartTime(l)),g.setSeconds(this.parent.getCurrentDayEndTime(l)),p===this.parent.getFormatedDate(e)&&c.setTime(e.getTime()),p===this.parent.getFormatedDate(t)&&g.setTime(t.getTime()),this.getTimeDifference(c,g,r)/1e3),c=this.getNonworkingTime(c,g,a,r);h+=Math.max(0,p-c)/u,l.setDate(l.getDate()+1)}n&&o||(s=this.calculateDurationValue(i,h,d))}else{d=this.parent.secondsPerDay;var f=this.getTimeDifference(e,t,r)/1e3,m=this.getNonworkingTime(e,t,a,r);n&&o||(s=this.calculateDurationValue(i,(f-m)/d,d))}return parseFloat(s.toString())},e.prototype.calculateDurationValue=function(e,t,i){return e&&"day"!==e?"minute"===e?t*(i/60):t*(i/3600):t},e.prototype.getDurationAsSeconds=function(e,t,i){i=0<this.parent.weekWorkingTime.length?this.parent.getSecondsPerDay(i):this.parent.secondsPerDay;return t&&"day"!==t.toLocaleLowerCase()?"hour"===t.toLocaleLowerCase()?3600*e:60*e:i*e},e.prototype.getEndDate=function(e,t,i,a,n,r){for(var s=new Date(e.getTime()),o=new Date(e.getTime()),l=new Date(e.getTime()),d=0<this.parent.weekWorkingTime.length&&(!i||"day"===i.toLocaleLowerCase())?this.calculateSecondDuration(t,l,d,e,!0):this.getDurationAsSeconds(t,i,e);0<d;)o.setSeconds(o.getSeconds()+d),0<(d-=d-this.getNonworkingTime(s,o,a.isAutoSchedule,!0,r))&&(o=this.checkStartDate(o,a,n,void 0,r)),s=new Date(o.getTime());return o},e.prototype.getStartDate=function(e,t,i,a,n,r){for(var s=new Date(e.getTime()),o=new Date(e.getTime()),e=new Date(s.getTime()),l=0<this.parent.weekWorkingTime.length?this.calculateSecondDuration(t,e,l,s,!1):this.getDurationAsSeconds(t,i,s);0<l;)o.setSeconds(o.getSeconds()-l),0<(l-=l-this.getNonworkingTime(o,s,a.isAutoSchedule,!0,r))&&(s=this.checkEndDate(o,a,r)),s=new Date(o.getTime());return n&&a.isMilestone&&(o.setDate(o.getDate()-1),e=this.parent.getCurrentDayEndTime(a.endDate?a.isAutoSchedule?a.endDate:a.autoEndDate:o),this.parent.dateValidationModule.setTime(e,o),o=this.parent.dateValidationModule.checkStartDate(o,a,!0)),o},e.prototype.calculateSecondDuration=function(e,t,i,a,n){if(e<1)i=this.parent.getSecondsPerDay(t)*e;else{i=0;var r=e,s=this.parent.getCurrentDayStartTime(t),o=this.parent.getCurrentDayEndTime(t);for(t.getHours()<o/3600&&t.getHours()>s/3600||!this.fromSegments||(n?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1));0<r;){if(this.isOnHolidayOrWeekEnd(t,!0))for(;n?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1),this.isOnHolidayOrWeekEnd(t,!0););this.parent.includeWeekend||(t=n?this.getNextWorkingDay(t):this.getPreviousWorkingDay(t));var l,d=this.parent.getSecondsPerDay(t),h=0;this.getSecondsInDecimal(a)===this.parent.getStartTime(a)||Number.isInteger(r)||(l=e.toString().split("."),d*=h=parseFloat("."+l[1]),r-=h),r<1&&(d*=r),i+=d,n?t.setDate(t.getDate()+1):t.setDate(t.getDate()-1),h||r--}}return i},e.prototype.getProjectStartDate=function(e,t){if(!ne.isNullOrUndefined(this.parent.cloneProjectStartDate))return"string"==typeof this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate)),s=this.checkStartDate(this.parent.cloneProjectStartDate),this.parent.cloneProjectStartDate=s,new Date(s.getTime());if(ne.isNullOrUndefined(this.parent.projectStartDate)){if(ne.isNullOrUndefined(t))return null;var i=this.parent.flatData,a=void 0;0<i.length?a=i[0].ganttProperties.startDate:(a=new Date).setHours(0,0,0,0);for(var n=1;n<i.length;n++){var r=i[n].ganttProperties.startDate;ne.isNullOrUndefined(r)||-1!==this.compareDates(r,a)||(a=r)}this.parent.cloneProjectStartDate=this.checkStartDate(a,e)}else{var s=this.getDateFromFormat(this.parent.projectStartDate);this.parent.cloneProjectStartDate=this.checkStartDate(s)}return new Date(this.parent.cloneProjectStartDate.getTime())},e.prototype.getValidStartDate=function(e,t,i){var a=null,n=i?e.baselineStartDate:t?e.autoStartDate:e.startDate,i=i?e.baselineEndDate:t?e.autoEndDate:e.endDate,t=!e.isAutoSchedule&&e.autoDuration?e.autoDuration:e.duration;if(ne.isNullOrUndefined(n))if(ne.isNullOrUndefined(i)){if(!ne.isNullOrUndefined(t)){t=this.parent.getTaskByUniqueID(e.uniqueID);if(this.parent.allowUnscheduledTasks&&t&&t.parentItem&&ne.isNullOrUndefined(n)&&ne.isNullOrUndefined(i)){for(var r=this.parent.getParentTask(t.parentItem);r&&!r.ganttProperties.startDate;)r=this.parent.getParentTask(r.parentItem);a=r&&r.ganttProperties.startDate?r.ganttProperties.startDate:this.parent.cloneProjectStartDate}else a=this.getProjectStartDate(e)}}else{a=new Date(i.getTime()),t=this.parent.getCurrentDayStartTime(a);this.setTime(t,a)}else a=new Date(n.getTime());return a},e.prototype.getValidEndDate=function(e,t,i){var a,n=null,r=i?e.baselineStartDate:t?e.autoStartDate:e.startDate,i=i?e.baselineEndDate:t?e.autoEndDate:e.endDate,t=t?e.autoDuration:e.duration;return ne.isNullOrUndefined(i)?ne.isNullOrUndefined(r)?ne.isNullOrUndefined(t)||(a=this.getValidStartDate(e))&&(n=this.getEndDate(a,t,e.durationUnit,e,!1)):e.isMilestone?n=this.checkStartDate(r):(n=new Date(r.getTime()),a=this.parent.getCurrentDayEndTime(i||n),this.setTime(a,n)):n=new Date(i.getTime()),n},e.prototype.getWorkingTime=function(e,t,i,a,n,r,s,o){var l;return ne.isNullOrUndefined(t.from)||ne.isNullOrUndefined(t.to)||(i.setHours(0,0,0,0),l=new Date(i.getTime()),i.setTime(i.getTime()+36e5*t.from),i=new Date(i.getTime()),24===t.to?l.setTime(l.getTime()+864e5):l.setTime(l.getTime()+36e5*t.to),l=(t=new Date(l.getTime())).getTime()-i.getTime(),i=this.getSecondsInDecimal(i),0===(t=this.getSecondsInDecimal(t))&&(t=86400),a+=l/1e3,0===n&&(this.parent.defaultStartTime=i,0<this.parent.weekWorkingTime.length)&&this.assignStartTime(e,i),n!==this[e.toLowerCase()+"TimeRangeLength"]-1&&""!==e||(this.parent.defaultEndTime=t,0<this.parent.weekWorkingTime.length&&this.assignEndTime(e,t)),0<n?""===e?(r.push(r[r.length-1]+i-s[n-1].to),s[n-1].to<i&&o.push({from:s[n-1].to,to:i,isWorking:!1,interval:i-s[n-1].to})):(this.parent[e.toLowerCase()+"NonWorkingHours"].push(this.parent[e.toLowerCase()+"NonWorkingHours"][this.parent[e.toLowerCase()+"NonWorkingHours"].length-1]+i-this.parent[e.toLowerCase()+"NonWorkingTimeRanges"][n-1].to),this.parent[e.toLowerCase()+"WorkingTimeRanges"][n-1].to<i&&this.parent[e.toLowerCase()+"NonWorkingTimeRanges"].push({from:this.parent[e.toLowerCase()+"WorkingTimeRanges"][n-1].to,to:i,isWorking:!1,interval:i-this.parent[e.toLowerCase()+"WorkingTimeRanges"][n-1].to})):(""===e?(r.push(0),o):(this.parent[e.toLowerCase()+"NonWorkingHours"].push(0),this.parent[e.toLowerCase()+"NonWorkingTimeRanges"])).push({from:0,to:i,isWorking:!1,interval:i}),(""===e?(s.push({from:i,to:t}),o):(this.parent[e.toLowerCase()+"WorkingTimeRanges"].push({from:i,to:t}),this.parent[e.toLowerCase()+"NonWorkingTimeRanges"])).push({from:i,to:t,isWorking:!0,interval:t-i})),a},e.prototype.assignStartTime=function(e,t){switch(e){case"Monday":this.parent.mondayDefaultStartTime=t;break;case"Tuesday":this.parent.tuesdayDefaultStartTime=t;break;case"Wednesday":this.parent.wednesdayDefaultStartTime=t;break;case"Thursday":this.parent.thursdayDefaultStartTime=t;break;case"Friday":this.parent.fridayDefaultStartTime=t;break;case"Saturday":this.parent.saturdayDefaultStartTime=t;break;case"Sunday":this.parent.sundayDefaultStartTime=t}},e.prototype.assignEndTime=function(e,t){switch(e){case"Monday":this.parent.mondayDefaultEndTime=t;break;case"Tuesday":this.parent.tuesdayDefaultEndTime=t;break;case"Wednesday":this.parent.wednesdayDefaultEndTime=t;break;case"Thursday":this.parent.thursdayDefaultEndTime=t;break;case"Friday":this.parent.fridayDefaultEndTime=t;break;case"Saturday":this.parent.saturdayDefaultEndTime=t;break;case"Sunday":this.parent.sundayDefaultEndTime=t}},e.prototype.calculateWeekWorkTime=function(e,t,i,a,n,r,s){for(var o=0,l=0;l<t.length;l++){var d=t[l];o+=this.getWorkingTime(e,d,i,a,l,n,r,s)}return this.parent[e.toLowerCase()+"DefaultStartTime"]/3600!=24&&this.parent[e.toLowerCase()+"NonWorkingTimeRanges"].push({from:this.parent[e.toLowerCase()+"DefaultEndTime"],to:86400,isWorking:!1,interval:86400-this.parent[e.toLowerCase()+"DefaultEndTime"]}),o},e.prototype.getSecondsPerDay=function(){for(var e=0,t=new Date("10/11/2018"),i=(this.parent.nonWorkingHours=[],this.parent.nonWorkingHours),a=(this.parent.workingTimeRanges=[],this.parent.workingTimeRanges=[],this.parent.workingTimeRanges),n=(this.parent.nonWorkingTimeRanges=[],this.parent.nonWorkingTimeRanges),r=0,s=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];r<s.length;r++)this[(m=s[r]).toLowerCase()+"TimeRangeLength"]=this.parent.dayWorkingTime.length;if(0<this.parent.weekWorkingTime.length){for(var o=0;o<this.parent.weekWorkingTime.length;o++)this[this.parent.weekWorkingTime[o].dayOfWeek.toLowerCase()+"TimeRangeLength"]=this.parent.weekWorkingTime[o].timeRange.length;for(var l=this.parent.weekWorkingTime,d=this.parent.dayWorkingTime,h=0,p=l;h<p.length;h++){var u,c=p[h];c.timeRange&&0<c.timeRange.length&&(u=this.calculateWeekWorkTime(c.dayOfWeek,c.timeRange,t,e,i,a,n),this.parent[c.dayOfWeek.toLowerCase()+"Seconds"]=u)}for(var g=0,f=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];g<f.length;g++){var m=f[g],y=this.parent[m.toLowerCase()+"DefaultStartTime"];ne.isNullOrUndefined(y)&&(y=this.calculateWeekWorkTime(m,d,t,e,i,a,n),this.parent[m.toLowerCase()+"Seconds"]=y)}}for(var D=this.parent.dayWorkingTime,k=D.length,b=0,w=0;w<k;w++){var T=D[w];b+=this.getWorkingTime("",T,t,e,w,i,a,n)}return this.parent.defaultEndTime/3600!=24&&n.push({from:this.parent.defaultEndTime,to:86400,isWorking:!1,interval:86400-this.parent.defaultEndTime}),e=b},e.prototype.getDurationValue=function(e){var t,i=null,a=null;return"string"==typeof e?(t=e.match(/(\d*\.*\d+|.+$)/g))&&t.length<=2&&(a=parseFloat(t[0].toString().trim()),t=t[1]?t[1].toString().trim().toLowerCase():null,-1!==ne.getValue("minute",this.parent.durationUnitEditText).indexOf(t)?i="minute":-1!==ne.getValue("hour",this.parent.durationUnitEditText).indexOf(t)?i="hour":-1!==ne.getValue("day",this.parent.durationUnitEditText).indexOf(t)&&(i="day")):(a=e,i=null),{duration:a,durationUnit:i}},e.prototype.getNextWorkingDay=function(e){var t=e.getDay();return-1!==this.parent.nonWorkingDayIndex.indexOf(t)?(e.setDate(e.getDate()+1),this.getNextWorkingDay(e)):e},e.prototype.getWeekendCount=function(e,t){var i=0,a=new Date(e.getTime()),n=new Date(t.getTime());for(a.setHours(0,0,0,0),a.setDate(a.getDate()+1),n.setHours(0,0,0,0);a.getTime()<n.getTime();)-1!==this.parent.nonWorkingDayIndex.indexOf(a.getDay())&&(i+=1),a.setDate(a.getDate()+1);return i},e.prototype.getNumberOfSeconds=function(e,t,i){var e=new Date(e.getTime()),t=new Date(t.getTime()),a=0;return e.setDate(e.getDate()+1),e.setHours(0,0,0,0),t.setHours(0,0,0,0),a=(a=e.getTime()<t.getTime()?this.getTimeDifference(e,t,i)/1e3:a)%86400!=0?a-a%86400+86400:a},e.prototype.getHolidaysCount=function(e,t){var i=0,a=this.parent.totalHolidayDates,n=new Date(e.getTime()),r=new Date(t.getTime());if(n.setDate(n.getDate()+1),n.setHours(0,0,0,0),r.setHours(0,0,0,0),n.getTime()<r.getTime())for(var s=0;s<a.length;s++){var o=this.getDateFromFormat(new Date(a[s]));n.getTime()<=o.getTime()&&r.getTime()>o.getTime()&&(!this.parent.includeWeekend&&-1===this.parent.nonWorkingDayIndex.indexOf(o.getDay())||this.parent.includeWeekend)&&(i+=1)}return i},e.prototype.getHolidayDates=function(){for(var e=this.parent.holidays,t=[],i=0;i<e.length;i++){var a=this.getDateFromFormat(e[i].from),n=this.getDateFromFormat(e[i].to);if(!ne.isNullOrUndefined(a)||!ne.isNullOrUndefined(n))if(ne.isNullOrUndefined(a)||ne.isNullOrUndefined(n)){var r=a||n;r.setHours(0,0,0,0),-1===t.indexOf(r.getTime())&&t.push(r.getTime())}else for(;a<=n;)a.setHours(0,0,0,0),-1===t.indexOf(a.getTime())&&t.push(a.getTime()),a.setDate(a.getDate()+1)}return t},e.prototype.isOnHolidayOrWeekEnd=function(e,t){if(t=ne.isNullOrUndefined(t)?this.parent.includeWeekend:t,!(t=this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?t:!0)&&-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay()))return!0;for(var i=this.parent.totalHolidayDates,a=0;a<i.length;a++){var n=this.getDateFromFormat(new Date(i[a])),r=new Date(n.getTime());if(n.setHours(0,0,0,0),r.setHours(23,59,59,59),e.getTime()>=n.getTime()&&e.getTime()<r.getTime())return!0}return!1},e.prototype.getNonWorkingSecondsOnDate=function(e,t,i,a){var n=this.getSecondsInDecimal(e),r=this.getSecondsInDecimal(t),s=-1,o=-1,l=0,d=!(!i||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||a)&&this.isOnHolidayOrWeekEnd(e,null),i=!(!i||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||a)&&this.isOnHolidayOrWeekEnd(t,null);if(0<this.parent.weekWorkingTime.length){for(var h=this.parent.getNonWorkingRange(e),p=0;p<h.length;p++)n>=(c=h[p]).from&&n<=c.to&&(s=p);for(var u=this.parent.getNonWorkingRange(t),p=0;p<u.length;p++)r>=(c=u[p]).from&&r<=c.to&&(o=p)}else{h=this.parent.nonWorkingTimeRanges,u=this.parent.nonWorkingTimeRanges;for(var c,p=0;p<h.length;p++)n>=(c=h[p]).from&&n<=c.to&&(s=p),r>=c.from&&r<=c.to&&(o=p)}if(e.getDate()!==t.getDate()||e.getMonth()!==t.getMonth()||e.getFullYear()!==t.getFullYear()){if(d)l+=86400-n;else for(p=s;p<h.length;p++)ne.isNullOrUndefined(h[p])||h[p].isWorking||(l+=p===s?h[p].to-n:h[p].interval);if(i)l+=r;else for(p=0;p<=o;p++)u[p].isWorking||(l+=p===o?r-u[p].from:u[p].interval)}else if(s!==o)if(i)l+=r-n;else for(p=s;p<=o;p++)ne.isNullOrUndefined(h[p])||h[p].isWorking||(l+=p===s?h[p].to-n:p===o?r-h[p].from:h[p].interval);else i?l+=r-n:h[s].isWorking||(l=r-n);return l},e.prototype.getPreviousWorkingDay=function(e){var t=e.getDay(),i=0===t?6:t-1,a=this.parent.getCurrentDayEndTime(e);return(-1!==this.parent.nonWorkingDayIndex.indexOf(t)||-1!==this.parent.nonWorkingDayIndex.indexOf(i)&&86400!==a&&0===this.getSecondsInDecimal(e))&&(e.setDate(e.getDate()-1),-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay()))?this.getPreviousWorkingDay(e):e},e.prototype.getNonWorkingDayIndex=function(){for(var e=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],t=e.length,i=(0===this.parent.workWeek.length&&(this.parent.workWeek=["Monday","Tuesday","Wednesday","Thursday","Friday"]),this.parent.workWeek.slice()),a=i.length,n=0;n<a;n++)i[n]=i[n].toLowerCase();this.parent.nonWorkingDayIndex=[];for(n=0;n<t;n++)-1===i.indexOf(e[n])&&this.parent.nonWorkingDayIndex.push(n)},e.prototype.setTime=function(e,t){var i=e/3600,a=(e-3600*(i=parseInt(i,10)))/60,a=parseInt(a,10);t.setHours(i,a,e-3600*i-60*a)},e.prototype.getTimeDifference=function(e,t,i){e=new Date(e.getTime()),t=new Date(t.getTime());return i&&this.updateDateWithTimeZone(e,t),t.getTime()-e.getTime()},e.prototype.updateDateWithTimeZone=function(e,t){var i,a,n,r,s=e.getTimezoneOffset(),o=t.getTimezoneOffset();s!==o&&((n=new Date((new Date).getFullYear(),0,1).getTimezoneOffset())!==s?(a=e,i=s):n!==o&&(a=t,i=o),n<0?(r=n-i,a.setTime(a.getTime()+60*r*1e3)):0<=n&&(r=i-n,a.setTime(a.getTime()-60*r*1e3)))},e.prototype.getSecondsInDecimal=function(e){return 60*e.getHours()*60+60*e.getMinutes()+e.getSeconds()+e.getMilliseconds()/1e3},e.prototype.offset=function(e,t){var i=e.getTimezoneOffset();try{var a=new Date(e.toLocaleString("en-US",{timeZone:t}));return isNaN(a.getTime())?0:(e.getTime()-a.getTime())/6e4+i}catch(e){return 0}},e.prototype.remove=function(e,t){return e=ne.isNullOrUndefined(e)?e:this.reverse(e,t,e.getTimezoneOffset())},e.prototype.reverse=function(e,t,i){"string"==typeof t&&(t=this.offset(e,t)),"string"==typeof i&&(i=this.offset(e,i));var a=e.getTimezoneOffset(),t=(e=new Date(e.getTime()+6e4*(t-i))).getTimezoneOffset();return new Date(e.getTime()+6e4*(t-a))},e.prototype.convert=function(e,t){var i=e.getTimezoneOffset(),t=this.offset(e,t),a=("string"==typeof i&&(i=this.offset(e,i)),"string"==typeof t&&(t=this.offset(e,t)),e.getTimezoneOffset()),i=(e=new Date(e.getTime()+6e4*(i-t))).getTimezoneOffset();return new Date(e.getTime()+6e4*(i-a))},e.prototype.getDateFromFormat=function(e,t){var i;return ne.isNullOrUndefined(e)?null:(e=e instanceof Date?new Date(e.getTime()):(i=this.parent.globalize.parseDate(e,{format:this.parent.getDateFormat(),type:"dateTime"}),ne.isNullOrUndefined(i)&&!isNaN(new Date(e).getTime())?new Date(e):i),!ne.isNullOrUndefined(this.parent.timezone)&&t?this.convert(e,this.parent.timezone):e)},e.prototype.compareDates=function(e,t){return ne.isNullOrUndefined(e)||ne.isNullOrUndefined(t)?!ne.isNullOrUndefined(e)&&ne.isNullOrUndefined(t)?1:ne.isNullOrUndefined(e)&&!ne.isNullOrUndefined(t)?-1:null:e.getTime()>t.getTime()?1:e.getTime()<t.getTime()?-1:0},e.prototype.getDurationString=function(e,t){var i="";return ne.isNullOrUndefined(e)||(i+=parseFloat(e.toFixed(2))+" ",ne.isNullOrUndefined(t))||(e=1!==e,"day"===t?i+=e?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===t?i+=e?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===t&&(i+=e?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))),i},e.prototype.getWorkString=function(e,t){var i="";return ne.isNullOrUndefined(e)||(i+=parseFloat(e).toFixed(2)+" ",ne.isNullOrUndefined(t))||(e=1!==e,"day"===t?i+=e?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===t?i+=e?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===t&&(i+=e?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))),i},e.prototype.calculateProjectDatesForValidatedTasks=function(e){var t,i=this,a="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,n="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,r=null,s=null,o=ne.getValue("dataOperation.dataArray",this.parent);a&&n||!o||0!==o.length?0<o.length&&(t=o.slice().sort(function(e,t){return new Date(e[i.parent.taskFields.startDate]).getTime()-new Date(t[i.parent.taskFields.startDate]).getTime()}),o=o.slice().sort(function(e,t){return new Date(t[i.parent.taskFields.endDate]).getTime()-new Date(e[i.parent.taskFields.endDate]).getTime()}),r=t[0][this.parent.taskFields.startDate],s=o[o.length-1][this.parent.taskFields.endDate]):(r=this.getDateFromFormat(new Date),s=this.getDateFromFormat(new Date(r.getTime()))),this.parent.cloneProjectStartDate=a?new Date(a.getTime()):"string"==typeof r?new Date(r):r,this.parent.cloneProjectEndDate=n?new Date(n.getTime()):"string"==typeof s?new Date(s):s},e.prototype.calculateProjectDates=function(e){var t,i,a,n,r,s,o,l,d,h=this;this.parent.isLoad&&this.parent.enablePersistence&&this.parent.cloneProjectStartDate&&this.parent.cloneProjectEndDate?(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate),this.parent.cloneProjectEndDate=this.getDateFromFormat(this.parent.cloneProjectEndDate)):(t="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,i="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,t=this.parent.timelineModule.isZooming&&this.parent.cloneProjectStartDate?this.getDateFromFormat(this.parent.cloneProjectStartDate):this.getDateFromFormat(t),i=this.parent.timelineModule.isZooming&&this.parent.cloneProjectEndDate?this.getDateFromFormat(this.parent.cloneProjectEndDate):this.getDateFromFormat(i),n=a=null,r=this.parent.flatData,s=this.parent.currentViewData,o=[],l=function(e){ne.isNullOrUndefined(e)||o.push(e)},d=function(e){0<e.length&&(e.sort(function(e,t){return e.getTime()-t.getTime()}),a=new Date(e[0].getTime()),n=1<e.length?new Date(e[e.length-1].getTime()):null)},(!t||!i)&&0<r.length||e||this.parent.timelineModule.isZoomToFit?((0<s.length&&this.parent.timelineModule.isZoomToFit&&this.parent.treeGrid.filterModule&&0<this.parent.treeGrid.filterModule.filteredResult.length?s:r).forEach(function(e){o=[];var t,e=e.ganttProperties,i=ne.isNullOrUndefined(e.startDate)&&ne.isNullOrUndefined(e.endDate)?t=null:(t=h.getValidStartDate(e),h.getValidEndDate(e));l(a),l(n),l(t),l(i),h.parent.renderBaseline&&!h.parent.timelineModule.isZoomToFit&&(l(e.baselineStartDate),l(e.baselineEndDate)),e.indicators&&0<e.indicators.length&&!h.parent.timelineModule.isZoomToFit&&e.indicators.forEach(function(e){l(h.getDateFromFormat(e.date))}),d(o)}),o=[],l(a),l(n),0<this.parent.eventMarkers.length&&!this.parent.timelineModule.isZoomToFit&&this.parent.eventMarkers.forEach(function(e,t){l(h.getDateFromFormat(e.day))}),0<this.parent.totalHolidayDates.length&&!this.parent.timelineModule.isZoomToFit&&this.parent.totalHolidayDates.forEach(function(e,t){l(new Date(e))}),d(o),a&&n||(a?a=ne.isNullOrUndefined(a)?this.getDateFromFormat(new Date):a:(a=ne.isNullOrUndefined(a)?this.getDateFromFormat(new Date):a).setHours(0,0,0,0),(n=this.getDateFromFormat(new Date(a.getTime()))).setDate(n.getDate()+20))):t&&i||0!==r.length||(a=this.getDateFromFormat(new Date),n=this.getDateFromFormat(new Date(a.getTime()))),e?(ne.setValue("minStartDate",a,e),ne.setValue("maxEndDate",n,e)):(this.prevProjectStartDate=this.parent.cloneProjectStartDate,this.parent.cloneProjectStartDate=a&&(this.parent.timelineModule.isZoomToFit||ne.isNullOrUndefined(t))?a:new Date(t.getTime()),this.parent.cloneProjectEndDate=n&&(this.parent.timelineModule.isZoomToFit||ne.isNullOrUndefined(i))?n:new Date(i.getTime())),this.parent.isProjectDateUpdated=!0)},e.prototype.splitTasksDuration=function(e){var t=0,i=e[0].startDate,e=e[e.length-1].endDate;return"Hour"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(i,e)/36e5):"Minutes"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(i,e)/6e4):t+=Math.ceil(this.getTimeDifference(i,e)/864e5),t};var J=e;function e(e){this.fromSegments=!1,this.mondayTimeRangeLength=0,this.tuesdayTimeRangeLength=0,this.wednesdayTimeRangeLength=0,this.thursdayTimeRangeLength=0,this.fridayTimeRangeLength=0,this.saturdayTimeRangeLength=0,this.sundayTimeRangeLength=0,this.parent=e}ee=function(e,t){return(ee=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};(function(e,t){function i(){this.constructor=e}ee(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)})(t,te=J),t.prototype.addEventListener=function(){this.parent.on("beforeDataManipulate",this.checkDataBinding.bind(this))},t.prototype.checkDataBinding=function(e){var t,i=this;e&&(this.parent.flatData=[],this.parent.currentViewData=[],this.parent.updatedRecords=[],this.dataArray=[],this.taskIds=[],this.parent.ids=[],this.recordIndex=0,this.hierarchyData=[],this.parent.predecessorsCollection=[],this.parent.treeGrid.parentData=[],this.parent.taskIds=[]),ne.isNullOrUndefined(this.parent.dataSource)?(this.parent.dataSource=[],this.parent.processTimeline(),this.parent.renderGantt(e)):this.parent.dataSource instanceof D.DataManager?this.initDataSource(e):(this.parent.dataSource instanceof Object&&H(this.parent)?(t=ne.getValue("result",this.parent.dataSource),this.dataArray=t):this.dataArray=this.parent.dataSource,this.processTimeline(),this.cloneDataSource(),this.parent.renderGantt(e),this.parent.flatData.map(function(e){i.parent.chartRowsModule.updateSegment(e.ganttProperties.segments,e.ganttProperties.taskId)})),this.parent.flatData.map(function(e){i.parent.chartRowsModule.updateSegment(e.ganttProperties.segments,e.ganttProperties.taskId)})},t.prototype.processTimeline=function(){this.parent.processTimeline(),this.parent.enableValidation||(this.parent.dataOperation.calculateProjectDatesForValidatedTasks(),this.parent.timelineModule.validateTimelineProp())},t.prototype.initDataSource=function(t){var i=this,e=this.parent.query instanceof D.Query?this.parent.query:new D.Query,a=(e.requiresCount(),this.parent.dataSource);this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(this.processTimeline(),this.parent.renderGantt(t)):a.executeQuery(e).then(function(e){i.dataArray=e.result,i.processTimeline(),i.parent.loadChildOnDemand&&(!i.parent.loadChildOnDemand||i.parent.taskFields.hasChildMapping)||i.cloneDataSource(),i.parent.renderGantt(t)}).catch(function(e){i.parent.processTimeline(),i.parent.renderGantt(t),i.parent.trigger("actionFailure",{error:e})})},t.prototype.constructDataSource=function(e){for(var t,i=new D.DataManager(e).executeLocal((new D.Query).group(this.parent.taskFields.parentID)),a=[],n=0;n<i.length;n++){var r=i[n];!ne.isNullOrUndefined(r.key)&&-1<(t=this.taskIds.indexOf(r.key.toString()))&&!ne.isNullOrUndefined(r.key)?e[t][this.parent.taskFields.child]=r.items:(-1!==t||this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&a.push.apply(a,r.items)}this.hierarchyData=this.dataReorder(e,a)},t.prototype.cloneDataSource=function(){var e,t,i,a=this.parent.taskFields.id,n=this.parent.taskFields.parentID,r=[];if(ne.isNullOrUndefined(a)||ne.isNullOrUndefined(n))r=this.dataArray;else{var s=[],n=void 0;this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&(n=JSON.parse(JSON.stringify(this.dataArray)));for(var o=0;o<this.dataArray.length;o++){var l=this.dataArray[o];l.parentItem&&delete l.parentItem,s.push(ne.extend({},{},l,!0)),ne.isNullOrUndefined(l[a])||this.taskIds.push(l[a].toString())}this.parent.taskFields.child||this.parent.setProperties({taskFields:{child:"Children"}},!0),ne.isNullOrUndefined(n)?this.constructDataSource(s):(this.constructDataSource(this.dataArray),this.dataArray=n),r=this.hierarchyData}this.parent.taskFields.segmentId&&(this.segmentCollection=new D.DataManager(this.parent.segmentData).executeLocal((new D.Query).group(this.parent.taskFields.segmentId)),this.parent.taskFields.segments||(this.parent.taskFields.segments="Segments")),"ProjectView"!==this.parent.viewType&&(n=ne.extend([],[],this.parent.resources,!0),this.constructResourceViewDataSource(n,r,e=[]),0<e.length&&(i=this.parent.resourceFields.name||"resourceName",(t={})[this.parent.resourceFields.id]=0,t[i]=this.parent.localeObj.getConstant("unassignedTask"),t[this.parent.taskFields.child]=e,n.push(t)),r=n),this.prepareDataSource(r)},t.prototype.constructResourceViewDataSource=function(s,o,l){for(var d=this,e=0;e<o.length;e++)!function(e){var a=o[e],n=null!==d.parent.taskFields.child?d.parent.taskFields.child:d.parent.taskFields.child="Children",e=a&&a[d.parent.taskFields.resourceInfo],r=d.parent.resourceFields.id;if(a[n]&&0!==a[n].length||!e||!e.length)(!a[n]||a[n]&&0===a[n].length)&&l.push(a);else if("string"==typeof e){d.isResourceString=!0;for(var t=e,i=0;i<s.length;i++)if(s[i][d.parent.resourceFields.name].toString()===t.toString()){s[i][n]?s[i][n].push(a):s[i][n]=[a];break}}else e.forEach(function(e){for(var t="object"==typeof e?e[r]:e,i=0;i<s.length;i++)if(s[i][r].toString()===t.toString()){s[i][n]?s[i][n].push(a):s[i][n]=[a];break}});a[d.parent.taskFields.child]&&a[d.parent.taskFields.child].length&&d.constructResourceViewDataSource(s,a[d.parent.taskFields.child],l)}(e)},t.prototype.prepareDataSource=function(e){this.prepareRecordCollection(e,0),this.parent.initialLoadData=ne.extend({},{},this.parent.flatData,!0),(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&(this.parent.dataMap=this.parent.flatData.reduce(function(e,t){return e.set(t.uniqueID,t),e},new Map)),"ResourceView"===this.parent.viewType&&this.calculateSharedTaskUniqueIds(),this.parent.taskFields.dependency&&this.parent.predecessorModule&&this.parent.predecessorModule.ensurePredecessorCollection()},t.prototype.calculateSharedTaskUniqueIds=function(){for(var r=this,e=0;e<this.parent.getTaskIds().length;e++)!function(e){var t=[];if(t[0]=r.parent.getTaskIds()[e][0],t[1]=r.parent.getTaskIds()[e].slice(1),"R"!==t[0]){var i=[],a=[];r.parent.flatData.filter(function(e){e.ganttProperties.taskId.toString()===t[1]&&0!==e.level&&(a.push(e.ganttProperties.rowUniqueID),i.push(e))});for(var n=0;n<i.length;n++)i[n].ganttProperties.sharedTaskUniqueIds=a}}(e)},t.prototype.prepareRecordCollection=function(s,o,l){for(var d=this,e=s.length,h=this,t=0;t<e;t++)!function(e){var t,i,a,n=s[e],e=(ne.isNullOrUndefined(h.parent.taskFields.segmentId)||0<(e=h.segmentCollection.filter(function(e){return e.key===n[d.parent.taskFields.id]})).length&&(n[h.parent.taskFields.segments]=e[0].items),h.parent.taskFields.hasChildMapping&&n.parentUniqueID&&(l=h.parent.getTaskByUniqueID(n.parentUniqueID)),!ne.isNullOrUndefined(h.parent.taskFields.constraintDate)&&!ne.isNullOrUndefined(h.parent.taskFields.constraintType)&&ne.isNullOrUndefined(n[h.parent.taskFields.constraintDate])&&ne.isNullOrUndefined(n[h.parent.taskFields.constraintType])&&(n[h.parent.taskFields.constraintType]=0,n[h.parent.taskFields.constraintDate]=ne.isNullOrUndefined(n[h.parent.taskFields.startDate])?n[h.parent.taskFields.endDate]:n[h.parent.taskFields.startDate]),h.createRecord(n,o,l,!0)),r=(h.parent.enableValidation&&h.parent.autoCalculateDateScheduling&&!(h.parent.isLoad&&h.parent.treeGrid.loadChildOnDemand&&h.parent.taskFields.hasChildMapping)||h.updateTaskLeftWidth(e),e.index=h.recordIndex++,h.parent.ids[e.index]=e.ganttProperties.rowUniqueID,h.parent.flatData.push(e),h.parent.setTaskIds(e),n[h.parent.taskFields.child]||n.taskData&&n.taskData[h.parent.taskFields.child]);"ResourceView"===h.parent.viewType&&ne.isNullOrUndefined(r)&&ne.isNullOrUndefined(e.parentItem)&&0===e.level&&(i=e.ganttProperties,h.parent.setRecordValue(i.isAutoSchedule?"startDate":"autoStartDate",null,(t=e).ganttProperties,!0),h.parent.setRecordValue(i.isAutoSchedule?"endDate":"autoEndDate",null,t.ganttProperties,!0),i=t.ganttProperties,h.parent.setRecordValue("isMilestone",!1,i,!0),i.isAutoSchedule&&h.calculateDuration(t),h.updateWorkWithDuration(t),a=i.work,h.parent.setRecordValue("work",a,i,!0),h.parent.setRecordValue("taskType","FixedDuration",i,!0),ne.isNullOrUndefined(h.parent.taskFields.type)||h.updateMappingData(t,"type"),h.parent.setRecordValue("progress",Math.floor(0),i,!0),h.parent.setRecordValue("totalProgress",0,i,!0),h.parent.setRecordValue("totalDuration",0,i,!0),i.isAutoSchedule||(h.parent.setRecordValue("autoDuration",h.calculateAutoDuration(i),i,!0),h.updateAutoWidthLeft(t)),h.parent.allowParentDependency||h.resetDependency(t),h.updateWidthLeft(t),h.updateTaskData(t)),h.parent.taskFields.hasChildMapping&&(l=null),!ne.isNullOrUndefined(r)&&0<r.length&&h.prepareRecordCollection(r,e.level+1,e)}(t)},t.prototype.addCustomFieldValue=function(e,t){var i=this.parent.ganttColumns,a=i.length;if(a)for(var n=0;n<a;n++)void 0===t[i[n].field]&&this.parent.setRecordValue(i[n].field,e[i[n].field],t)},t.prototype.getGanttUid=function(e){return e+this.uid++},t.prototype.createRecord=function(e,t,i,a){var n,r,s=this.parent.taskFields,o=this.parent.resourceFields,l=e[s.progress],d=null,h=null,p=e[s.notes],u=(l=100<(l=l&&parseFloat(l.toString())?parseFloat(l.toString()):0)?100:l,e[s.dependency]),c=this.getDateFromFormat(e[s.baselineStartDate],!0),g=this.getDateFromFormat(e[s.baselineEndDate],!0),f=(this.parent.loadChildOnDemand&&s.hasChildMapping&&!this.parent.enableVirtualization?(n=e,r=JSON.parse(JSON.stringify(e))):n={},{}),m="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[s.manual],o=(this.parent.setRecordValue("ganttProperties",f,n),e.ganttProperties&&e.ganttProperties.predecessor&&0<e.ganttProperties.predecessor.length&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.setRecordValue("predecessor",e.ganttProperties.predecessor,f,!0),ne.isNullOrUndefined(e[s.id])?ne.isNullOrUndefined(e[o.id])||(d=e[o.id],h=ne.isNullOrUndefined(e[o.name])&&"Unassigned Task"===e.resourceName?e.resourceName:e[o.name],this.addTaskData(n,e,!1)):("number"==typeof(d=e[s.id])||/^-?\d+$/.test(d)||(this.isTaskIDInteger=!1),h=e[s.name],!!(this.parent.loadChildOnDemand&&s.hasChildMapping&&e.taskData)?n.taskData=e.taskData:e.taskData&&e.ganttProperties?this.addTaskData(n,e.taskData,a):this.addTaskData(n,e,a)),this.parent.setRecordValue("taskId",d,f,!0),this.parent.setRecordValue("taskName",h,f,!0),this.parent&&s.parentID&&this.parent.setRecordValue("parentId",e[s.parentID],f,!0),this.addCustomFieldValue(e,n),this.parent.setRecordValue("isAutoSchedule",m,f,!0),!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed?this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),f,!0):e.ganttProperties&&this.parent.setRecordValue("resourceInfo",e.ganttProperties.resourceInfo,f,!0),this.parent.setRecordValue("isMilestone",!1,f,!0),this.parent.setRecordValue("indicators",e[s.indicators],f,!0),this.updateResourceName(n),!ne.isNullOrUndefined(e[s.child])&&0<e[s.child].length||e.taskData&&e.taskData[s.child]&&0<e.taskData[s.child].length?(this.parent.setRecordValue("hasChildRecords",!0,n),this.parent.setRecordValue("isMilestone",!1,f,!0),this.parent.allowParentDependency||this.resetDependency(n)):this.parent.loadChildOnDemand&&s.hasChildMapping&&n.taskData[s.hasChildMapping]?this.parent.setRecordValue("hasChildRecords",!0,n):this.parent.setRecordValue("hasChildRecords",!1,n),e[s.constraintType]),d=(n.hasChildRecords?o&&0!==o&&4!==o&&7!==o&&(e[s.constraintType]=0):o&&(o<0||7<o)&&(e[s.constraintType]=0),this.parent.setRecordValue("constraintType",e[s.constraintType],f,!0),this.parent.setRecordValue("constraintDate",e[s.constraintDate],f,!0),a||(this.parent.setRecordValue("baselineStartDate",this.checkBaselineStartDate(c,f),f,!0),e[s.baselineEndDate]?this.parent.setRecordValue("baselineEndDate",e[s.baselineEndDate],f,!0):this.parent.setRecordValue("baselineEndDate",this.checkBaselineEndDate(g,f),f,!0)),this.calculateScheduledValues(n,e,a),this.calculateScheduledValuesforBaseline(n,e,a),this.parent.setRecordValue("progress",l,f,!0),this.parent.setRecordValue("totalProgress",l,f,!0),e.ganttProperties&&e.ganttProperties.predecessorsName&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed?this.parent.setRecordValue("predecessorsName",e.ganttProperties.predecessorsName,f,!0):this.parent.setRecordValue("predecessorsName",u,f,!0),this.parent.setRecordValue("notes",p,f,!0),this.parent.setRecordValue("cssClass",e[s.cssClass],f,!0),this.parent.setRecordValue("parentItem",this.getCloneParent(i),n),this.parent.loadChildOnDemand&&s.hasChildMapping&&0<this.parent.currentViewData.length&&this.parent.setRecordValue("parentItem",n.parentItem,this.parent.currentViewData[this.taskIds.indexOf(e[s.id].toString())]),n.parentItem?n.parentItem.uniqueID:null);return this.parent.setRecordValue("parentUniqueID",d,n),"ResourceView"!==this.parent.viewType||ne.isNullOrUndefined(s.parentID)||ne.isNullOrUndefined(n.parentItem)||this.parent.setRecordValue("parentId",n.parentItem.taskId,f,!0),this.parent.setRecordValue("level",t,n),e.ganttProperties&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.loadChildOnDemand&&s.hasChildMapping&&e.uniqueID?this.parent.setRecordValue("uniqueID",e.uniqueID,n):this.parent.setRecordValue("uniqueID",this.getGanttUid(this.parent.element.id+"_data_"),n),this.parent.setRecordValue("uniqueID",n.uniqueID,f,!0),this.parent.setRecordValue("childRecords",[],n),this.parent.dataSource instanceof Object&&H(this.parent)&&!ne.isNullOrUndefined(s.child)&&this.parent.setRecordValue(s.child,[],n),n.hasChildRecords&&(this.parent.setRecordValue("autoStartDate",n.ganttProperties.startDate,f),this.parent.setRecordValue("autoEndDate",n.ganttProperties.endDate,f),this.parent.setRecordValue("autoDuration",n.ganttProperties.duration,f)),this.parent.setRecordValue("expanded",!n.hasChildRecords||!this.parent.collapseAllParentTasks,n),ne.isNullOrUndefined(r)?this.updateExpandStateMappingValue(n,e):this.updateExpandStateMappingValue(n,r),a||(this.parent.setRecordValue("width",this.calculateWidth(n),f,!0),this.parent.setRecordValue("left",this.calculateLeft(f,n),f,!0),this.parent.setRecordValue("progressWidth",this.getProgressWidth(f.width,l),f,!0),f.baselineEndDate&&f.baselineStartDate&&(this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(f),f,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(f),f,!0))),ne.isNullOrUndefined(s.work)&&this.updateWorkWithDuration(n),ne.isNullOrUndefined(s.manual)||this.parent.dataOperation.updateMappingData(n,"manual"),this.updateTaskData(n),u&&this.parent.predecessorsCollection.push(n),ne.isNullOrUndefined(i)||(i.childRecords.push(n),this.parent.dataSource instanceof Object&&H(this.parent)&&!ne.isNullOrUndefined(this.parent.taskFields.child)&&i[this.parent.taskFields.child].push(n.taskData)),"ProjectView"===this.parent.viewType?this.parent.setRecordValue("rowUniqueID",f.taskId.toString(),f,!0):(h=n.uniqueID.replace(this.parent.element.id+"_data_",""),this.parent.setRecordValue("rowUniqueID",h,n),this.parent.setRecordValue("rowUniqueID",h,f,!0),this.parent.setRecordValue("sharedTaskUniqueIds",[],f,!0)),this.parent.allowUnscheduledTasks&&n.ganttProperties.startDate&&(n.ganttProperties.endDate||n.ganttProperties.duration)&&(this.parent.setRecordValue("segments",this.setSegmentsInfo(n,!0),f,!0),this.parent.dataOperation.updateMappingData(n,"segments"),a||this.updateWidthLeft(n)),this.parent.chartRowsModule.updateSegment(n.ganttProperties.segments,n.ganttProperties.taskId),n},t.prototype.sortSegmentsData=function(e,t,i){var a=this;return t?e.sort(function(e,t){var i=a.parent.taskFields.startDate;return a.getDateFromFormat(e[i]).getTime()-a.getDateFromFormat(t[i]).getTime()}):e.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),e},t.prototype.setSegmentsInfo=function(e,t){var i,a=this,n=this.parent.taskFields,r=[],s=0,o=0,l=0,d=[this.parent.taskFields.duration,this.parent.taskFields.endDate,this.parent.taskFields.startDate,this.parent.taskFields.id],h=[];if(!ne.isNullOrUndefined(this.parent.taskFields.segments)&&(i=t?e.taskData[this.parent.taskFields.segments]:e.ganttProperties.segments,t||e.taskData[this.parent.taskFields.segments]&&0<e.taskData[this.parent.taskFields.segments].length&&e.taskData[this.parent.taskFields.segments].forEach(function(e){var t,i={};for(t in e)-1!==d.indexOf(t)?(t,e[t]):i[t]=e[t];a.customSegmentProperties.push(i)}),!ne.isNullOrUndefined(i))&&1<i.length){this.sortSegmentsData(i,t,e.ganttProperties);for(var p=0;p<i.length;p++){var u=i[p],c=t?u[n.startDate]:u.startDate,g=t?u[n.endDate]:u.endDate,f=t?u[n.duration]:u.duration,c=this.getDateFromFormat(c);if(c=this.checkStartDate(c,e.ganttProperties,!1),ne.isNullOrUndefined(f)){if((g=this.getDateFromFormat(g))&&(ne.isNullOrUndefined(f)||""===String(f))&&(m=void 0,m=0<this.parent.weekWorkingTime.length?this.parent.getEndTime(g):this.parent.defaultEndTime,0===g.getHours())&&86400!==m&&this.setTime(m,g),g=this.checkEndDate(g,e.ganttProperties,!1),f=this.getDuration(c,g,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),ne.isNullOrUndefined(r[p-1])||(l=(l+=this.getDuration(r[p-1].endDate,c,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone))<1?1:l),n.duration){if((o=e.ganttProperties.duration-s-l)<=0)continue;f=p===i.length-1||0<o&&o<f?o:f,g=this.getEndDate(c,f,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!n.duration&&n.endDate&&g&&(f=this.getDuration(c,g,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),0<r.length)&&g.getTime()<c.getTime()&&g.getTime()<=e.ganttProperties.endDate.getTime()){r[p-1].duration=this.getDuration(r[p-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}}else if(g=this.getEndDate(c,f,e.ganttProperties.durationUnit,e.ganttProperties,!1),n.duration){if((o=e.ganttProperties.duration-s)<=0)continue;f=p===i.length-1||0<o&&o<f?o:f,g=this.getEndDate(c,f,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!n.duration&&n.endDate&&g&&(g=!ne.isNullOrUndefined(e.ganttProperties.endDate)&&g.getTime()>=e.ganttProperties.endDate.getTime()&&p===i.length-1?e.ganttProperties.endDate:g,f=this.getDuration(c,g,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),0<r.length)&&g.getTime()<c.getTime()&&g.getTime()<=e.ganttProperties.endDate.getTime()){r[p-1].duration=this.getDuration(r[p-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}if(u={},!c||!g||!c||ne.isNullOrUndefined(f))break;if(s+=Number(f),u.startDate=c,u.endDate=g,u.duration=Number(f),u.width=0,u.left=0,u.segmentIndex=p,r.push(u),ne.isNullOrUndefined(r[p-1]))u.offsetDuration=0;else{c=void 0,c=ne.isNullOrUndefined(this.parent.timelineSettings.bottomTier)?e.ganttProperties.durationUnit:"Minutes"===this.parent.timelineSettings.bottomTier.unit?"minute":"Hour"===this.parent.timelineSettings.bottomTier.unit?"hour":e.ganttProperties.durationUnit,g=this.getDuration(r[p-1].endDate,r[p].startDate,c,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);if((u.offsetDuration=g)<1){if(0===this.parent.weekWorkingTime.length)u.startDate=this.getEndDate(r[p-1].endDate,1,e.ganttProperties.durationUnit,e.ganttProperties,!1);else{f=new Date(r[p-1].endDate.getTime());if(u.startDate=new Date(f.setHours(f.getHours()+24)),this.isOnHolidayOrWeekEnd(u.startDate,!0))for(;u.startDate.setDate(u.startDate.getDate()+1),this.isOnHolidayOrWeekEnd(u.startDate,!0););this.parent.includeWeekend||(u.startDate=this.getNextWorkingDay(u.startDate));var m=this.parent.getEndTime(r[p-1].endDate);this.getSecondsInDecimal(r[p-1].endDate)===m&&this.setTime(this.parent.getEndTime(u.startDate),u.startDate)}u.startDate=this.checkStartDate(u.startDate,e.ganttProperties,!1),u.endDate=this.getEndDate(u.startDate,u.duration,e.ganttProperties.durationUnit,e.ganttProperties,!1),u.endDate=(!n.duration&&n.endDate&&u.endDate>e.ganttProperties.endDate?e.ganttProperties:u).endDate,u.offsetDuration=1}}c=e[this.parent.taskFields.segments]||i;h.push(this.setSegmentTaskData(u,c[p]))}this.parent.setRecordValue("duration",s,e.ganttProperties,!0),ne.isNullOrUndefined(r[r.length-1])||this.parent.setRecordValue("endDate",r[r.length-1].endDate,e.ganttProperties,!0),ne.isNullOrUndefined(n.endDate)||ne.isNullOrUndefined(r[r.length-1])||this.parent.setRecordValue(this.parent.taskFields.endDate,r[r.length-1].endDate,e,!0),!t&&h&&0<h.length&&h.forEach(function(e,t){e=Object.assign({},e,a.customSegmentProperties[t]);h[t]=e}),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,h,e)}return 1<r.length?(this.parent.setRecordValue("segments",r,e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.segments,e.taskData[this.parent.taskFields.segments],e,!0)):r=null,r},t.prototype.setSegmentTaskData=function(e,t){var i=this.parent.taskFields,t=ne.extend({},{},t,!0);return ne.isNullOrUndefined(i.startDate)||(t[this.parent.taskFields.startDate]=e.startDate),ne.isNullOrUndefined(i.endDate)||(t[this.parent.taskFields.endDate]=e.endDate),ne.isNullOrUndefined(i.duration)||(t[this.parent.taskFields.duration]=Number(e.duration)),t},t.prototype.fetchResources=function(e){return this.parent.editModule&&this.parent.editModule.dialogModule&&(this.parent.editModule.dialogModule.isFromAddDialog||this.parent.editModule.dialogModule.isFromEditDialog)?this.parent.editModule.dialogModule.ganttResources:e.ganttProperties.resourceInfo},t.prototype.updateWorkWithDuration=function(e){if(this.parent.triggeredColumnName!==this.parent.taskFields.work||0===e.ganttProperties.duration||!ne.isNullOrUndefined(e.ganttProperties.resourceInfo)&&0===e.ganttProperties.resourceInfo.length||e.hasChildRecords){var t,i=this.fetchResources(e),a=0;if(!ne.isNullOrUndefined(i)&&0<i.length&&!e.hasChildRecords){for(var n,r=i.length,s=void 0,o=(0<this.parent.weekWorkingTime.length?this.parent.getSecondsPerDay(e.ganttProperties.startDate||e.ganttProperties.endDate):this.parent.secondsPerDay)/3600,l=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit),s=0;s<r;s++)a+=(t=0<(n=i[s][this.parent.resourceFields.unit])?o*n/100:0)*l;"minute"===e.ganttProperties.workUnit&&(a*=60),"day"===e.ganttProperties.workUnit&&(a/=o),a%1!=0&&(a=parseFloat(a.toFixed(2)))}else!e.hasChildRecords&&!ne.isNullOrUndefined(e.ganttProperties.work)&&!ne.isNullOrUndefined(e.ganttProperties.duration)&&0<e.ganttProperties.duration&&(a=e.ganttProperties.work);if(e.childRecords&&0<e.childRecords.length&&this.parent.isOnEdit){for(var d=0,h=0;h<e.childRecords.length;h++)d+=e.childRecords[h].ganttProperties.work;a+=d}"FixedUnit"===e.ganttProperties.taskType&&0===t&&(this.parent.setRecordValue("duration",a=0,e.ganttProperties,!0),ne.isNullOrUndefined(this.parent.taskFields.duration)||this.parent.setRecordValue(this.parent.taskFields.duration,0,e,!0)),this.parent.setRecordValue("work",a,e.ganttProperties,!0),ne.isNullOrUndefined(this.parent.taskFields.work)||this.parent.isLoad||this.parent.dataOperation.updateMappingData(e,"work")}},t.prototype.getCloneParent=function(e){var t;return ne.isNullOrUndefined(e)?null:((t={}).uniqueID=e.uniqueID,t.expanded=e.expanded,t.level=e.level,t.index=e.index,t.taskId=e.ganttProperties.rowUniqueID,t)},t.prototype.reUpdateResources=function(){if(0<this.parent.flatData.length)for(var e,t,i,a=0;a<this.parent.flatData.length;a++)e=this.parent.flatData[a].taskData,t=this.parent.flatData[a].ganttProperties,i=this.parent.flatData[a],this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),t,!0),this.updateResourceName(i)},t.prototype.addTaskData=function(e,t,i){var a,n=this,r=this.parent.taskFields,s=this.parent.dataSource;i&&(r.parentID||s instanceof D.DataManager&&s.dataSource.json&&s.dataSource.offline)&&r.parentID?(i=t[r.id],s=this.taskIds.indexOf(i.toString()),a=-1<s?this.dataArray[s]:{},ne.isNullOrUndefined(this.parent.taskFields.segmentId)||0<(r=this.segmentCollection.filter(function(e){return e.key===a[n.parent.taskFields.id]})).length&&(a[this.parent.taskFields.segments]=r[0].items),this.parent.setRecordValue("taskData",a,e)):this.parent.setRecordValue("taskData",t,e)},t.prototype.updateExpandStateMappingValue=function(e,t){var i,a=this.parent.taskFields.expandState,n=t[a];a&&e.hasChildRecords&&(ne.isNullOrUndefined(n)?ne.isNullOrUndefined(n)&&!this.parent.collapseAllParentTasks?i=!0:ne.isNullOrUndefined(n)&&this.parent.collapseAllParentTasks&&(i=!1):(i="true"===n.toString(),this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&t.expanded&&(i=!0)),this.parent.setRecordValue("taskData."+a,i,e),this.parent.setRecordValue(a,i,e),this.parent.setRecordValue("expanded",i,e))},t.prototype.setValidatedDates=function(e,t){var i=e.ganttProperties,a=this.parent.taskFields,n=t[a.duration],r=this.getDateFromFormat(t[a.startDate],!0),t=this.getDateFromFormat(t[a.endDate],!0),n=ne.isNullOrUndefined(n)||""===n?null:n;this.parent.setRecordValue("startDate",new Date(r.getTime()),i,!0),ne.isNullOrUndefined(n)||""===n?this.calculateDuration(e):this.updateDurationValue(n,i),this.parent.setRecordValue("endDate",new Date(t.getTime()),i,!0)},t.prototype.calculateScheduledValues=function(e,t,i){var a,n=this.parent.taskFields,r=e.ganttProperties,s=t[n.duration],s=ne.isNullOrUndefined(s)||""===s?null:s,o=r.startDate&&r.endDate?(a=this.getDateFromFormat(r.startDate,!0),this.getDateFromFormat(r.endDate,!0)):(a=this.getDateFromFormat(t[n.startDate],!0),this.getDateFromFormat(t[n.endDate],!0)),l=n.segments?t[n.segments]||e.taskData[n.segments]:null,d=!!n.milestone&&!!t[n.milestone],h=t[n.durationUnit]||"",h=(this.parent.setRecordValue("durationUnit",this.validateDurationUnitMapping(h),r,!0),ne.isNullOrUndefined(t[n.work])?0:parseFloat(t[n.work])),p=(this.parent.setRecordValue("workUnit",this.validateWorkUnitMapping(this.parent.workUnit),r,!0),t[n.type]||""),p=this.validateTaskTypeMapping(p);if(this.parent.setRecordValue("taskType",p,r,!0),t[this.parent.resourceFields.name]===this.parent.localeObj.getConstant("unassignedTask")&&this.parent.setRecordValue("taskType","FixedDuration",r,!0),i&&!this.parent.enableValidation&&a&&o)this.setValidatedDates(e,t);else{if(o||a||!ne.isNullOrUndefined(s)&&""!==s)a?this.calculateDateFromStartDate(a,o,s,e,i):o?this.calculateDateFromEndDate(o,s,e):ne.isNullOrUndefined(s)||""===s||(this.updateDurationValue(s,r),a=this.parent.allowUnscheduledTasks?null:this.getProjectStartDate(r,i),this.parent.setRecordValue("startDate",a,r,!0),this.parent.allowUnscheduledTasks?this.parent.setRecordValue("endDate",null,r,!0):this.calculateEndDate(e));else{if(this.parent.allowUnscheduledTasks)return;this.parent.setRecordValue("duration",1,r,!0),this.parent.setRecordValue("startDate",this.getProjectStartDate(r,i),r,!0),this.calculateEndDate(e)}this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&!e[this.parent.taskFields.dependency]&&(this.parent.setRecordValue("startDate",this.getDateByConstraint(r,r.startDate),r,!0),this.calculateEndDate(e),o=r.constraintType,s=r.startDate,a=r.endDate,i=this.parent.predecessorModule.getConstraintDate(o,s,a),this.parent.setRecordValue("constraintDate",i,r,!0))}if((!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&(ne.isNullOrUndefined(e.ganttProperties.startDate)||ne.isNullOrUndefined(this.parent.taskFields.startDate)||(e[this.parent.taskFields.startDate]=e.ganttProperties.startDate,e.taskData[this.parent.taskFields.startDate]=e.ganttProperties.startDate),ne.isNullOrUndefined(e.ganttProperties.endDate)||ne.isNullOrUndefined(this.parent.taskFields.endDate)||(e[this.parent.taskFields.endDate]=e.ganttProperties.endDate,e.taskData[this.parent.taskFields.endDate]=e.ganttProperties.endDate)),ne.isNullOrUndefined(n.work))n.type&&r.taskType&&this.parent.dataOperation.updateMappingData(e,"type");else{o=this.parent.taskFields.durationUnit&&t[n.durationUnit]?t[n.durationUnit]:this.parent.durationUnit;if(r.durationUnit=this.validateDurationUnitMapping(o),isNaN(h)||ne.isNullOrUndefined(h))this.parent.setRecordValue("work",0,r,!0),this.parent.setRecordValue("duration",0,r,!0),this.parent.setRecordValue("isMilestone",!0,r,!0),ne.isNullOrUndefined(this.parent.taskFields)||ne.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",r.startDate,r,!0);else{if(this.parent.setRecordValue("work",h,r,!0),!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed)switch(p){case"FixedDuration":(ne.isNullOrUndefined(e[this.parent.taskFields.resourceInfo])||ne.isNullOrUndefined(e.ganttProperties.resourceInfo)||0===e.ganttProperties.resourceInfo.length)&&0!==r.duration||this.updateWorkWithDuration(e);break;case"FixedWork":(ne.isNullOrUndefined(e[this.parent.taskFields.resourceInfo])||ne.isNullOrUndefined(e.ganttProperties.resourceInfo)||0===e.ganttProperties.resourceInfo.length)&&0!==r.work||this.updateDurationWithWork(e);break;case"FixedUnit":e.hasChildRecords||this.updateDurationWithWork(e)}ne.isNullOrUndefined(n.type)||this.parent.dataOperation.updateMappingData(e,"type"),0===r.duration?(this.parent.setRecordValue("isMilestone",!0,r,!0),ne.isNullOrUndefined(this.parent.taskFields)||ne.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",r.startDate,r,!0)):ne.isNullOrUndefined(r.startDate)||ne.isNullOrUndefined(r.duration)||(this.parent.setRecordValue("isMilestone",!1,r,!0),ne.isNullOrUndefined(this.parent.taskFields)||ne.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,e,!0),this.calculateEndDate(e))}this.parent.dataOperation.updateMappingData(e,"work")}ne.isNullOrUndefined(l)||this.parent.setRecordValue("segments",this.setSegmentsInfo(e,!0),r,!0),0===r.duration&&(this.parent.setRecordValue("isMilestone",!0,r,!0),ne.isNullOrUndefined(this.parent.taskFields)||ne.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",r.startDate,r,!0)),!ne.isNullOrUndefined(d)&&d&&(this.parent.setRecordValue("duration",0,r,!0),this.parent.setRecordValue("isMilestone",!0,r,!0),ne.isNullOrUndefined(this.parent.taskFields)||ne.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,e,!0),this.parent.setRecordValue("endDate",r.startDate,r,!0))},t.prototype.calculateScheduledValuesforBaseline=function(e,t,i){var a=this.parent.taskFields,n=e.ganttProperties,r=t[a.baselineDuration],r=ne.isNullOrUndefined(r)||""===r?null:r,s=this.getDateFromFormat(t[a.baselineStartDate],!0),t=this.getDateFromFormat(t[a.baselineEndDate],!0);s?this.calculateDateFromStartDateforBaseline(s,t,r,e,i):t?this.calculateDateFromEndDateforBaseline(t,r,e,!0):ne.isNullOrUndefined(r)||""===r||(this.updateDurationValue(r,n,!0),a=this.getProjectStartDate(n,i),this.parent.setRecordValue("baselineStartDate",a,n,!0),this.calculateEndDate(e,!0))},t.prototype.calculateDateFromStartDateforBaseline=function(e,t,i,a,n){var r=a.ganttProperties,s=!!(0===parseInt(i,10)||e&&t&&new Date(e.getTime())===new Date(t.getTime()))||null;this.parent.setRecordValue("baselineStartDate",this.checkStartDate(e,r,s,n,!0),r,!0),t||!ne.isNullOrUndefined(i)&&""!==i?ne.isNullOrUndefined(i)||t?ne.isNullOrUndefined(t)||!ne.isNullOrUndefined(i)&&""!==i?(this.updateDurationValue(i,r,!0),!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.setRecordValue("baselineEndDate",t,r,!0):this.calculateEndDate(a,!0)):(e=void 0,e=0<this.parent.weekWorkingTime.length&&t?this.parent.getEndTime(t):this.parent.defaultEndTime,t&&0===t.getHours()&&86400!==e&&this.setTime(e,t),(r.baselineStartDate&&t&&r.baselineStartDate.getTime()>t.getTime()||!ne.isNullOrUndefined(r.baselineStartDate)&&!ne.isNullOrUndefined(r.startDate)&&r.baselineStartDate.getTime()===r.startDate.getTime()&&!ne.isNullOrUndefined(t)&&!ne.isNullOrUndefined(r.endDate)&&t.toLocaleDateString()===r.endDate.toLocaleDateString()&&r.isMilestone)&&(t=r.baselineStartDate),this.parent.setRecordValue("baselineEndDate",this.checkBaselineEndDate(t,r),r,!0),1===this.compareDates(r.baselineStartDate,r.baselineEndDate)?(this.parent.setRecordValue("baselineEndDate",r.baselineStartDate,r,!0),this.parent.setRecordValue("baselineDuration",0,r,!0)):this.calculateDuration(a,!0)):(this.updateDurationValue(i,r,!0),this.calculateEndDate(a,!0)):(this.parent.setRecordValue("baselineDuration",1,r,!0),this.calculateEndDate(a,!0))},t.prototype.calculateDateFromEndDateforBaseline=function(e,t,i,a){var n=i.ganttProperties,r=0<this.parent.weekWorkingTime.length?this.parent.getEndTime(e):this.parent.defaultEndTime,r=(0===e.getHours()&&86400!==r&&this.setTime(r,e),0===parseInt(t,10)||null);this.parent.setRecordValue("baselineEndDate",this.checkEndDate(e,i.ganttProperties,r,!0),n,!0),ne.isNullOrUndefined(t)||""===t?(this.parent.setRecordValue("baselineDuration",1,n,!0),this.parent.setRecordValue("baselineStartDate",this.getStartDate(n.baselineEndDate,n.duration,n.durationUnit,n),n,!0)):ne.isNullOrUndefined(t)||""===t||(this.updateDurationValue(t,n,a),this.parent.setRecordValue("baselineStartDate",this.getStartDate(n.endDate,n.duration,n.durationUnit,n,!0),n,!0))},t.prototype.updateDurationWithWork=function(e){var t=e.ganttProperties,i=this.fetchResources(e);if(!ne.isNullOrUndefined(i)&&0<i.length){for(var a,n=ne.isNullOrUndefined(i)?0:i.length,r=0,s=(0<this.parent.weekWorkingTime.length?this.parent.getSecondsPerDay(e.ganttProperties.startDate||e.ganttProperties.endDate):this.parent.secondsPerDay)/3600,o=0,l=void 0,l=0;l<n;l++)r+=0<(a=i[l][this.parent.resourceFields.unit])?s*a/100:"FixedUnit"!==e.ganttProperties.taskType&&"FixedWork"!==t.taskType&&0!==t.duration?s:0;var d=this.getWorkInHour(t.work,t.workUnit);0<n&&0<r&&(o+=d/r),"FixedUnit"===t.taskType&&0===r&&(this.parent.setRecordValue("work",0,t,!0),this.parent.setRecordValue(this.parent.taskFields.work,0,e,!0)),"minute"===t.durationUnit&&(o=o*s*60),"hour"===t.durationUnit&&(o*=s),o%1!=0&&(o=parseFloat(o.toFixed(2))),ne.isNullOrUndefined(t.duration)||this.parent.setRecordValue("duration",o,t,!0),this.parent.dataOperation.updateMappingData(e,"duration")}},t.prototype.updateUnitWithWork=function(e){var t=e.ganttProperties,i=this.fetchResources(e),a=ne.isNullOrUndefined(i)?0:i.length,n=0<this.parent.weekWorkingTime.length?this.parent.getSecondsPerDay(e.ganttProperties.startDate||e.ganttProperties.endDate):this.parent.secondsPerDay,n=n/3600;if(0!==a){var r=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit),s=this.getWorkInHour(t.work,t.workUnit),s=0<r?s/(r*n)*100:0,o=0==s?0:0<s?s/a:100;o%1!=0&&(o=parseFloat(o.toFixed(2)));for(var l=0;l<a;l++)i[l][this.parent.resourceFields.unit]=o,this.parent.isLoad||ne.isNullOrUndefined(this.parent.editModule)||ne.isNullOrUndefined(this.parent.editModule.dialogModule)||this.parent.editModule.dialogModule.isEdit||ne.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||t.resourceInfo&&(t.resourceInfo[l][this.parent.resourceFields.unit]=o),this.parent.editModule&&this.parent.editModule.dialogModule&&!ne.isNullOrUndefined(this.parent.editModule.dialogModule.ganttResources[l])&&(this.parent.editModule.dialogModule.ganttResources[l][this.parent.resourceFields.unit]=o);this.updateResourceName(e)}},t.prototype.calculateDateFromEndDate=function(e,t,i){var a=i.ganttProperties,n=0<this.parent.weekWorkingTime.length?this.parent.getEndTime(e):this.parent.defaultEndTime,n=(0===e.getHours()&&86400!==n&&this.setTime(n,e),0===parseInt(t,10)||null);this.parent.setRecordValue("endDate",this.checkEndDate(e,i.ganttProperties,n),a,!0),ne.isNullOrUndefined(t)||""===t?this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("startDate",null,a,!0),this.parent.setRecordValue("duration",null,a,!0)):(this.parent.setRecordValue("duration",1,a,!0),this.parent.setRecordValue("startDate",this.getStartDate(a.endDate,a.duration,a.durationUnit,a),a,!0)):ne.isNullOrUndefined(t)||""===t||(this.updateDurationValue(t,a),this.parent.setRecordValue("startDate",this.getStartDate(a.endDate,a.duration,a.durationUnit,a),a,!0))},t.prototype.calculateDateFromStartDate=function(e,t,i,a,n){var r=a.ganttProperties,s=!!(0===parseInt(i,10)||e&&t&&new Date(e.getTime())===new Date(t.getTime()))||null;this.parent.setRecordValue("startDate",this.checkStartDate(e,r,s,n),r,!0),this.parent.isTreeGridRendered&&a&&this.updateTaskData(a),t||!ne.isNullOrUndefined(i)&&""!==i?ne.isNullOrUndefined(i)||t?t&&(ne.isNullOrUndefined(i)||""===i)?(e=void 0,e=0<this.parent.weekWorkingTime.length?this.parent.getEndTime(t):this.parent.defaultEndTime,0===t.getHours()&&86400!==e&&this.setTime(e,t),this.parent.setRecordValue("endDate",this.checkEndDate(t,a.ganttProperties),r,!0),1===this.compareDates(r.startDate,r.endDate)?(this.parent.setRecordValue("endDate",r.startDate,r,!0),this.parent.setRecordValue("isMilestone",!0,r,!0),this.parent.setRecordValue("duration",0,r,!0)):this.calculateDuration(a)):(this.updateDurationValue(i,r),!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(this.setTime(this.parent.getCurrentDayEndTime(t),t),this.parent.setRecordValue("endDate",t,r,!0)):this.calculateEndDate(a)):(this.updateDurationValue(i,r),this.calculateEndDate(a)):this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("endDate",null,r,!0),this.parent.setRecordValue("duration",null,r,!0)):(this.parent.setRecordValue("duration",1,r,!0),this.calculateEndDate(a))},t.prototype.getProgressWidth=function(e,t){return e*t/100},t.prototype.calculateWidth=function(e,t){var i=e.ganttProperties,a=t?i.autoStartDate:i.startDate,n=t?i.autoEndDate:i.endDate;return ne.isNullOrUndefined(a)&&ne.isNullOrUndefined(n)&&(a=this.getValidStartDate(i,t),n=this.getValidEndDate(i,t)),ne.isNullOrUndefined(a)||ne.isNullOrUndefined(n)?3:!i.isMilestone||e.hasChildRecords&&!i.isAutoSchedule?this.getTaskWidth(a,n,i):0},t.prototype.getTaskbarHeight=function(){var e=this.parent.rowHeight,t=this.parent.taskbarHeight;return t<e?t:e},t.prototype.calculateLeft=function(e,t,i){var a=null,n=-300,r=i?e.autoStartDate:e.startDate,s=i?e.autoEndDate:e.endDate,i=i?e.autoDuration:e.duration,o=e.isMilestone;return(r=t&&this.parent.allowUnscheduledTasks&&ne.isNullOrUndefined(r)&&ne.isNullOrUndefined(s)&&!ne.isNullOrUndefined(i)&&!t.hasChildRecords&&t.parentItem&&("Manual"===this.parent.taskMode||"Custom"===this.parent.taskMode&&t[this.parent.taskFields.manual])&&(i=this.parent.getParentTask(t.parentItem)).ganttProperties.startDate?i.ganttProperties.startDate:r)?a=new Date(r.getTime()):s?(a=new Date(s.getTime()),o=!ne.isNullOrUndefined(r)||!this.parent.allowUnscheduledTasks):a=this.getValidStartDate(e),n=ne.isNullOrUndefined(a)?n:this.getTaskLeft(a,o)},t.prototype.calculateAutoLeft=function(e){return this.getTaskLeft(e.autoStartDate,e.isMilestone)},t.prototype.calculateAutoDuration=function(e){return this.getDuration(e.autoStartDate,e.autoEndDate,e.durationUnit,!1,e.isMilestone)},t.prototype.calculateAutoWidth=function(e){return this.getTaskWidth(e.autoStartDate,e.autoEndDate)},t.prototype.calculateBaselineLeft=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i?(t.getTime()>i.getTime()&&(i=t),this.getTaskLeft(t,e.isMilestone)):0},t.prototype.calculateBaselineWidth=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i&&t.getTime()!==i.getTime()?(this.isBaseline=!0,t.getTime()>i.getTime()&&(i=e.baselineEndDate=t),this.getTaskWidth(t,i)):0},t.prototype.getTaskWidth=function(e,t,i){var a=new Date(e.getTime()),n=new Date(t.getTime()),r=("None"!==this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.bottomTier:this.parent.timelineModule.customTimelineSettings.topTier).unit,s=(this.parent.timelineModule.customTimelineSettings,!1),o=new Date(e.getTime()),l=0;if(ne.isNullOrUndefined(i)||"hour"!==i.durationUnit||(o=new Date(o.getTime()+60*i.duration*60*1e3)),(!ne.isNullOrUndefined(i)&&"minute"===i.durationUnit||!ne.isNullOrUndefined(i)&&"day"===i.durationUnit&&i.duration<1)&&(o=new Date(o.getTime()+60*i.duration*1e3)),this.isBaseline&&"Day"===r){var d=this.getDuration(a,n,"day",!0,!1);if(this.isBaseline=!1,0<d&&d<1)return d*this.parent.perDayWidth}if(0<this.parent.weekWorkingTime.length)for(var h=new Date(e.getTime()),p=e.getDate();p<=t.getDate();p++){var u=h.getDay(),c=void 0,g=this.parent.weekWorkingTime;switch(u){case 0:c="Sunday";break;case 1:c="Monday";break;case 2:c="Tuesday";break;case 3:c="Wednesday";break;case 4:c="Thursday";break;case 5:c="Friday";break;case 6:c="Saturday";break;default:c=""}for(var f=!0,m=0;m<g.length;m++)if(g[m][c]&&0<g[m][c].length)for(var f=!1,y=0;y<g[m][c].length;y++)l=l+g[m][c][y].to-g[m][c][y].from;if(f)for(var D=0;D<this.parent.dayWorkingTime.length;D++)l=l+this.parent.dayWorkingTime[D].to-this.parent.dayWorkingTime[D].from;h=new Date(h.setDate(h.getDate()+1)),this.parent.includeWeekend||(h=this.parent.dataOperation.getNextWorkingDay(h))}else for(m=0;m<this.parent.dayWorkingTime.length;m++)l=l+this.parent.dayWorkingTime[m].to-this.parent.dayWorkingTime[m].from;var k,b,w,T,d=o.getTime()-a.getTime();return!ne.isNullOrUndefined(i)&&"minute"===i.durationUnit&&i.duration<60*l||!ne.isNullOrUndefined(i)&&"day"===i.durationUnit&&!ne.isNullOrUndefined(i.duration)&&/^\d+\.\d+$/.test(i.duration.toString())?("Day"===r?(b=0<this.parent.weekWorkingTime.length?(k=this.parent.getStartTime(a),this.parent.getEndTime(n)):(k=this.parent.defaultStartTime,this.parent.defaultEndTime),(Math.floor(d/36e5%24)>=l||0==d)&&(s=!0),this.getSecondsInDecimal(a)===k&&s&&a.setHours(0,0,0,0),this.getSecondsInDecimal(n)===b&&s&&n.setHours(24),this.getSecondsInDecimal(n)===k&&n.setHours(0,0,0,0)):s=!0,a.getTime()===n.getTime()?this.parent.perDayWidth:s?!(this.parent.taskFields.duration&&"day"===i.durationUnit&&/^\d+\.\d+$/.test(i.duration.toString())&&"Day"===this.parent.timelineModule.bottomTier&&ne.isNullOrUndefined(i.segments))||(e=this.parent.holidays&&0<this.parent.holidays.length?this.getHolidaysCount(a,n):0,o=this.parent.includeWeekend?0:this.getWeekendCount(a,n),this.hasDSTTransition(a.getFullYear()))?this.getTimeDifference(a,n,!0)/864e5*this.parent.perDayWidth:this.parent.timelineSettings.showWeekend?(e+o+i.duration)*this.parent.perDayWidth:(e+i.duration)*this.parent.perDayWidth:(d=!1,s=a,o=n,e=i.duration,w=l,s=new Date(s),o=new Date(o),d=!(isNaN(s.getTime())||isNaN(o.getTime())||e<=0||w<=0)&&(s=new Date(s),e=e*w,T=Math.floor(e/w),e=e%w,s.setDate(s.getDate()+T),s.setHours(s.getHours()+e),s.getTime()!==o.getTime())&&1<Math.abs((s.getTime()-o.getTime())/864e5),"day"===i.durationUnit&&i.duration<1&&!d?i.duration*this.parent.perDayWidth:this.hasDSTTransition(a.getFullYear())||-180===a.getTimezoneOffset()?this.getTimeDifference(a,n,!0)/864e5*this.parent.perDayWidth:this.getTimeDifference(a,n)/(36e5*l)*this.parent.perDayWidth)):("Day"===r&&(b=0<this.parent.weekWorkingTime.length?(k=this.parent.getStartTime(a),this.parent.getEndTime(n)):(k=this.parent.defaultStartTime,this.parent.defaultEndTime),this.getSecondsInDecimal(a)===k&&a.setHours(0,0,0,0),this.getSecondsInDecimal(n)===b&&(n.setHours(24),n.setHours(0,0,0,0)),this.getSecondsInDecimal(n)===k)&&n.setHours(0,0,0,0),a.getTime()===n.getTime()?this.parent.perDayWidth:this.hasDSTTransition(a.getFullYear())?(T=w=0,this.parent.timelineSettings.showWeekend||0<(w=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(a,n))&&(T=864e5*w),(q(n)-q(a)-T)/6e4*(this.parent.perDayWidth/24)/60):(e=this.getTimeDifference(a,n)/864e5,this.parent.timelineSettings.showWeekend?e*this.parent.perDayWidth:(s=new Date(a.getTime()),(e-this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(s,n))*this.parent.perDayWidth)))},t.prototype.getDSTTransitions=function(e,t){function i(e,t){var i=new Date(Date.UTC(e,t+1,0));return new Date(Date.UTC(e,t,i.getUTCDate()-i.getUTCDay()))}function a(e,t){var t=new Intl.DateTimeFormat("en-US",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(e).match(/\d+/g).map(Number),e=t[0],i=t[1],a=t[2],n=t[3],r=t[4],t=t[5];return new Date(a,e-1,i,n,r,t)}var n=i(e,2),e=i(e,9);return{dstStart:a(n,t),dstEnd:a(e,t)}},t.prototype.hasDSTTransition=function(e){for(var t=0,i=11,a=new Date(e,t,1).getTimezoneOffset();t<=i;){var n=Math.floor((t+i)/2),r=new Date(e,n,1).getTimezoneOffset();if(r!==a)return!0;a<r?i=n-1:t=n+1}return!1},t.prototype.getTaskLeft=function(e,t,i){var a,n,r=!1,s=new Date(e.getTime()),o=("Day"===("None"!==this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.bottomTier:this.parent.timelineModule.customTimelineSettings.topTier).unit&&(n=o=void 0,n=0<this.parent.weekWorkingTime.length?(o=this.parent.getStartTime(s),this.parent.getEndTime(s)):(o=this.parent.defaultStartTime,this.parent.defaultEndTime),this.getSecondsInDecimal(s)===o?s.setHours(0,0,0,0):t&&this.getSecondsInDecimal(s)===n?(s.setHours(24),r=!0):this.getSecondsInDecimal(s)===n&&this.parent.allowUnscheduledTasks&&(s.setHours(22),r=!0)),this.parent.enableTimelineVirtualization&&(this.parent.isLoad||i)&&!this.parent.timelineModule.performedTimeSpanAction&&(a=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null),ne.isNullOrUndefined(a)?new Date(this.parent.timelineModule.timelineStartDate):new Date(this.parent.timelineModule.dateByLeftValue(a).toString()));return o?(t=void 0,this.hasDSTTransition(e.getFullYear()),this.hasDSTTransition(s.getFullYear())?this.parent.timelineSettings.showWeekend?(q(s)-q(o))/6e4*(this.parent.perDayWidth/24)/60:this.calculateLeftValue(o,s):(n=void 0,"Day"!==this.parent.timelineModule.bottomTier||this.getSecondsInDecimal(s)===this.parent.defaultStartTime||0===this.getSecondsInDecimal(s)||r||this.parent.isFromEventMarker?t=this.parent.timelineSettings.showWeekend?(s.getTime()-o.getTime())/864e5*this.parent.perDayWidth:this.calculateLeftValue(o,s):(i=new Date(e.getTime()),a=new Date(i.setHours(0,0,0,0)),n=this.getDuration(a,e,"day",!0,!1)*this.parent.perDayWidth,s.setHours(0,0,0,0),t=this.parent.timelineSettings.showWeekend?(s.getTime()-o.getTime())/864e5*this.parent.perDayWidth:this.calculateLeftValue(o,s),this.getSecondsInDecimal(e)!==this.parent.defaultStartTime&&"Day"===this.parent.timelineModule.bottomTier&&(t+=n)),t)):0},t.prototype.calculateLeftValue=function(e,t){var i=new Date(this.parent.timelineModule.timelineStartDate.getTime()),i=(t.setHours(0,0,0,0),this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(i,t)),t=this.hasDSTTransition(t.getFullYear())?q(t)-q(e):t.getTime()-e.getTime();return(t-24*i*60*60*1e3)/864e5*this.parent.perDayWidth},t.prototype.getSplitTaskWidth=function(e,t,i){var a,e=new Date(e.getTime()),t=new Date(this.getEndDate(e,t,i.ganttProperties.durationUnit,i.ganttProperties,!1).getTime());return"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(a=i=void 0,a=0<this.parent.weekWorkingTime.length?(i=this.parent.getStartTime(e),this.parent.getEndTime(t)):(i=this.parent.defaultStartTime,this.parent.defaultEndTime),this.getSecondsInDecimal(e)===i&&e.setHours(0,0,0,0),this.getSecondsInDecimal(t)===a&&t.setHours(24),this.getSecondsInDecimal(t)===i)&&t.setHours(0,0,0,0),this.parent.timelineSettings.showWeekend?this.getTimeDifference(e,t)/864e5*this.parent.perDayWidth:(a=new Date(e.getTime()),i=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(a,t),(t.getTime()-e.getTime()-24*i*60*60*1e3)/864e5*this.parent.perDayWidth)},t.prototype.getSplitTaskLeft=function(e,t){var i,a,n,r,e=new Date(e.getTime());return"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(i=r=void 0,i=0<this.parent.weekWorkingTime.length?(r=this.parent.getStartTime(e),this.parent.getStartTime(t)):r=this.parent.defaultStartTime,this.getSecondsInDecimal(e)===r&&e.setHours(0,0,0,0),this.getSecondsInDecimal(t)===i)&&t.setHours(0,0,0,0),t?(i=r=0,this.parent.timelineSettings.showWeekend||(a=new Date(t.getTime()),n=new Date(e.getTime()),0<(r=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(a,n))&&(i=864e5*r)),(e.getTime()-t.getTime()-i)/864e5*this.parent.perDayWidth):0},t.prototype.updateMappingData=function(e,t){var i=this.parent.columnMapping,a=e.ganttProperties;if((!ne.isNullOrUndefined(i[t])||"taskType"===t||"segments"===t)&&"predecessorName"!==t)if("resourceInfo"===t){var n=a.resourceInfo,r=this.parent.resourceFields,s=[],o=[];if(!ne.isNullOrUndefined(n))for(var l=0;l<n.length;l++){s.push(n[l][r.id]);var d=n[l][r.name],h=n[l][r.unit];100!==h&&(d+="["+h+"%]"),d&&o.push(d)}this.parent.setRecordValue("resourceNames",o.join(","),a,!0),this.isResourceString&&e.taskData[this.parent.taskFields.resourceInfo]&&e.taskData[this.parent.taskFields.resourceInfo][0]&&(e.taskData[this.parent.taskFields.resourceInfo]=e.taskData[this.parent.taskFields.resourceInfo][0][r.name]),this.updateTaskDataResource(e),this.parent.setRecordValue(i[t],o.join(","),e)}else"startDate"===t||"endDate"===t?this.setRecordDate(e,a[t],i[t]):"duration"===t?this.setRecordDuration(e,i[t]):"baselineStartDate"===t||"baselineEndDate"===t?this.setRecordDate(e,a[t],i[t]):"baselineDuration"===t?this.setRecordDuration(e,i[t],!0):"work"===t?(this.parent.setRecordValue("taskData."+i[t],a.work,e),this.parent.setRecordValue(i[t],a[t],e)):"type"===t?(this.parent.setRecordValue("taskData."+i[t],a.taskType,e),this.parent.setRecordValue(i[t],a.taskType,e)):"manual"===t?(this.parent.setRecordValue("taskData."+i[t],!a.isAutoSchedule,e),this.parent.setRecordValue(i[t],!a.isAutoSchedule,e)):"segments"===t?this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,this.segmentTaskData(e),e):(this.parent.setRecordValue("taskData."+i[t],a[t],e),this.parent.setRecordValue(i[t],a[t],e))},t.prototype.segmentTaskData=function(e){var i=this,t=e.ganttProperties.segments,a=this.parent.taskFields;if(ne.isNullOrUndefined(t))return null;for(var n=ne.extend([],[],e.taskData[a.segments],!0),r=0;r<t.length;r++)(this.parent.isEdit||this.parent.editModule&&this.parent.editModule.dialogModule&&ne.getValue("isEdit",this.parent.editModule.dialogModule)||this.parent.contextMenuModule&&ne.getValue("isEdit",this.parent.contextMenuModule))&&(n[r]={}),ne.isNullOrUndefined(a.startDate)||(n[r][this.parent.taskFields.startDate]=t[r].startDate),ne.isNullOrUndefined(a.endDate)||(n[r][this.parent.taskFields.endDate]=t[r].endDate),ne.isNullOrUndefined(a.duration)||(n[r][this.parent.taskFields.duration]=Number(t[r].duration));return 0<this.customSegmentProperties.length&&n&&0<n.length&&n.forEach(function(e,t){e=Object.assign({},e,i.customSegmentProperties[t]);n[t]=e}),n},t.prototype.updateTaskDataResource=function(e){var i=e.ganttProperties.resourceInfo,a=e.taskData[this.parent.taskFields.resourceInfo],n=this.parent.resourceFields;if(ne.isNullOrUndefined(a))e.taskData[this.parent.taskFields.resourceInfo]=i;else if(i&&i.length){for(var t=0;t<i.length;t++){var r=!1;if("string"==typeof a){if(a===i[t][n.name]){a=i[t][n.name],r=!0;break}}else for(var s=0;s<a.length;s++)if("number"==typeof a[s]||"string"==typeof a[s]){if(parseInt(a[s],10)===parseInt(i[t][n.id],10)){a[s]=i[t],r=!0;break}}else if(a[s][n.id]===i[t][n.id]&&"number"!=typeof a[s]){a[s]=ne.extend({},a[s],i[t],!0),r=!0;break}r||("string"==typeof a?a=i[t][n.name]:a.push(i[t]))}var o=[];if(!ne.isNullOrUndefined(a))if("string"!=typeof a){for(var l=0;l<a.length;l++)!function(t){i.filter(function(e){e[n.id]===a[t][n.id]&&-1===o.indexOf(a[t])&&o.push(a[t])})}(l);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,o,e)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,a,e)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],e)},t.prototype.setRecordDate=function(e,t,i){var a="string"==typeof t?new Date(t):t;ne.isNullOrUndefined(t)||(t=new Date(a.getTime())),this.parent.setRecordValue(i,t,e),ne.isNullOrUndefined(t)||(t=new Date(a.getTime())),this.parent.isLoad||this.parent.isDynamicData||this.parent.setRecordValue("taskData."+i,t,e),this.parent.isDynamicData=!1},t.prototype.getDurationInDay=function(e,t){return"day"===t?e:"hour"===t?e/(this.parent.secondsPerDay/3600):e/(this.parent.secondsPerDay/60)},t.prototype.setRecordDuration=function(e,t,i){var a,i=i?e.ganttProperties.baselineDuration:e.ganttProperties.duration,n=e.ganttProperties.durationUnit;ne.isNullOrUndefined(i)?(this.parent.setRecordValue(t,i,e),this.parent.setRecordValue("taskData."+t,i,e)):(this.parent.setRecordValue(t,i,e),a=ne.getValue(t,e.taskData),isNaN(a)&&ne.isNullOrUndefined(this.parent.taskFields.durationUnit)&&!ne.isNullOrUndefined(a)?this.parent.setRecordValue("taskData."+t,this.getDurationString(i,n),e):"string"==typeof a?this.parent.setRecordValue("taskData."+t,i.toString(),e):this.parent.setRecordValue("taskData."+t,i,e)),this.parent.taskFields.durationUnit&&(e.taskData[this.parent.taskFields.durationUnit]=e.ganttProperties.durationUnit)},t.prototype.setDataSource=function(e){for(var t,i=[],a=(t=Array.isArray(e)?e:t).length,n=0;n<a;n++){var r=e[n];i.push(r),ne.isNullOrUndefined(e[n][this.parent.taskFields.child])||this.setDataSource(e[n][this.parent.taskFields.child])}return i},t.prototype.setStartDate=function(t){var i=this;(ne.isNullOrUndefined(this.parent.taskFields.parentID)||ne.isNullOrUndefined(this.parent.taskFields.id)?this.parent.dataSource:this.setDataSource(this.parent.dataSource)).map(function(e){t.ganttProperties.taskId===e[i.parent.taskFields.id]&&(ne.isNullOrUndefined(i.parent.taskFields.startDate)||(t[i.parent.taskFields.startDate]=e[i.parent.taskFields.startDate]),ne.isNullOrUndefined(i.parent.taskFields.endDate)||(t[i.parent.taskFields.endDate]=e[i.parent.taskFields.endDate]))})},t.prototype.getWorkInHour=function(e,t){return"day"===t?e*(this.parent.secondsPerDay/3600):"minute"===t?e/60:e},t.prototype.updateTaskData=function(e){var t,i=this.parent.taskFields,a=e.ganttProperties;ne.isNullOrUndefined(e.taskData)||(t=e.taskData,i.id&&(this.parent.setRecordValue("taskData."+i.id,a.taskId,e),this.parent.setRecordValue(i.id,a.taskId,e)),i.name&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.name,a.taskName,e),this.parent.setRecordValue(i.name,a.taskName,e)),i.startDate&&this.setRecordDate(e,a.startDate,i.startDate),i.endDate&&this.setRecordDate(e,a.endDate,i.endDate),i.duration&&(ne.isNullOrUndefined(i.milestone)||!ne.isNullOrUndefined(i.milestone)&&!e.taskData[i.milestone])&&this.setRecordDuration(e,i.duration),i.durationUnit&&(t[i.durationUnit]=a.durationUnit),i.progress&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.progress,a.progress,e),this.parent.setRecordValue(i.progress,a.progress,e)),i.baselineStartDate&&this.setRecordDate(e,a.baselineStartDate,i.baselineStartDate),i.baselineEndDate&&this.setRecordDate(e,a.baselineEndDate,i.baselineEndDate),i.baselineDuration&&this.setRecordDuration(e,i.baselineDuration,!0),i.notes&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.notes,a.notes,e),this.parent.setRecordValue(i.notes,a.notes,e)),i.cssClass&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.cssClass,a.cssClass,e),this.parent.setRecordValue(i.cssClass,a.cssClass,e)),i.indicators&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.indicators,a.indicators,e),this.parent.setRecordValue(i.indicators,a.indicators,e)),i.parentID&&(t="ProjectView"===this.parent.viewType?a.parentId:t[i.parentID],this.parent.setRecordValue("taskData."+i.parentID,t,e),this.parent.setRecordValue(i.parentID,a.parentId,e)),i.work&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.work,a.work,e),this.parent.setRecordValue(i.work,a.work,e)),i.type&&(this.parent.setRecordValue("taskData."+i.type,a.taskType,e),this.parent.setRecordValue(i.type,a.taskType,e)),i.constraintDate&&this.setRecordDate(e,a.constraintDate,i.constraintDate),i.constraintType&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.constraintType,a.constraintType,e),this.parent.setRecordValue(i.constraintType,a.constraintType,e)))},t.prototype.setResourceInfo=function(e){var t=this;if(ne.isNullOrUndefined(e[this.parent.taskFields.resourceInfo]))return i;var i=(!this.parent.isLoad&&e.taskData&&this.parent.taskFields.resourceInfo in e.taskData?e.taskData:e)[this.parent.taskFields.resourceInfo],a=ne.isNullOrUndefined(this.parent.editModule)||ne.isNullOrUndefined(this.parent.editModule.dialogModule)||!this.parent.editModule.dialogModule.isAddNewResource?this.parent.resources:this.parent.editModule.dialogModule.ganttResources,n=this.parent.resourceFields.id,r=this.parent.resourceFields.unit,s=this.parent.resourceFields.group,o=[];if("string"==typeof i&&""!==i){var l=[],d=e[this.parent.taskFields.resourceInfo].split(",");d&&(a.forEach(function(e){d.includes(e[t.parent.resourceFields.name])&&l.push(e)}),e=ne.extend({},l[0]),o.push(e),ne.isNullOrUndefined(r)||ne.isNullOrUndefined(i[r])||(e[r]=i[r]),ne.isNullOrUndefined(s)||ne.isNullOrUndefined(i[s])||(e[s]=i[s]))}else for(var h=0;h<i.length;h++)!function(t){var e=a.filter(function(e){return"object"==typeof i[t]&&i[t][n]===e[n]||i[t]===e[n]}),e=ne.extend({},e[0]);o.push(e),ne.isNullOrUndefined(r)||ne.isNullOrUndefined(i[t][r])||(e[r]=i[t][r]),ne.isNullOrUndefined(s)||ne.isNullOrUndefined(i[t][s])||(e[s]=i[t][s])}(h);return this.updateResourceUnit(o),o},t.prototype.updateResourceUnit=function(e){var t=this.parent.resourceFields.unit;if(!ne.isNullOrUndefined(t))for(var i=e.length,a=void 0,a=0;a<i;a++)ne.isNullOrUndefined(e[a][t])&&(e[a][t]=100)},t.prototype.updateResourceName=function(e){var t=e.ganttProperties.resourceInfo,i=[],a=this.parent.taskFields;if(t&&0<t.length){var n=t.length;if("string"==typeof e.taskData[this.parent.taskFields.resourceInfo]){var r=s=e.taskData[this.parent.taskFields.resourceInfo];this.parent.setRecordValue("resourceNames",r,e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,r,e,!0)}else{var s=ne.extend([],[],e.taskData[this.parent.taskFields.resourceInfo],!0);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],e);for(var o=0;o<n;o++){var l=t[o],d=l[this.parent.resourceFields.name],h=l[this.parent.resourceFields.unit];100!==h&&(d+="["+h+"%]"),ne.isNullOrUndefined(d)||i.push(d),e.taskData&&(h=a.resourceInfo,s[o]&&(s[parseInt(o.toString(),10)],1)?e.taskData[h].push(s[o]):e.taskData[h].push(l[this.parent.resourceFields.id]))}this.parent.setRecordValue("resourceNames",i.join(","),e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,i.join(","),e,!0)}this.updateTaskDataResource(e)}},t.prototype.dataReorder=function(e,t){for(var i=[];0<e.length&&0<t.length;){var a=t.indexOf(e[0]);-1===a?e.shift():(i.push(e.shift()),t.splice(a,1))}return i},t.prototype.validateDurationUnitMapping=function(e){return"minute"===e||"minutes"===e||"m"===e||"min"===e?e="minute":"hour"===e||"hours"===e||"h"===e||"hr"===e?e="hour":"day"===e||"days"===e||"d"===e?e="day":ne.isNullOrUndefined(this.parent.durationUnit)||(e=this.parent.durationUnit.toLocaleLowerCase()),e},t.prototype.validateTaskTypeMapping=function(e){return e="FixedDuration"===e?"FixedDuration":"FixedUnit"===e?"FixedUnit":"FixedWork"===e?"FixedWork":this.parent.taskType},t.prototype.validateWorkUnitMapping=function(e){return e="minute"===e?"minute":"hour"===e?"hour":"day"===e?"day":this.parent.workUnit.toLocaleLowerCase()},t.prototype.updateDurationValue=function(e,t,i){e=this.getDurationValue(e);i&&!isNaN(ne.getValue("duration",e))?this.parent.setRecordValue("baselineDuration",ne.getValue("duration",e),t,!0):isNaN(ne.getValue("duration",e))||this.parent.setRecordValue("duration",ne.getValue("duration",e),t,!0),ne.isNullOrUndefined(ne.getValue("durationUnit",e))||this.parent.setRecordValue("durationUnit",ne.getValue("durationUnit",e),t,!0)},t.prototype.reUpdateGanttData=function(){if(0<this.parent.flatData.length){var e,t;this.parent.secondsPerDay=this.getSecondsPerDay();for(var i=0;i<this.parent.flatData.length;i++)e=this.parent.flatData[i].taskData,t=this.parent.flatData[i],ne.isNullOrUndefined(this.parent.taskFields.duration)||this.setRecordDuration(t,this.parent.taskFields.duration),this.parent.isLoad&&this.setStartDate(t),this.calculateScheduledValues(t,e,!1);this.updateGanttData()}},t.prototype._isInStartDateRange=function(e,t,i){var a=!1;return a=e.getTime()>=t.getTime()&&e.getTime()<i.getTime()?!0:a},t.prototype._isInEndDateRange=function(e,t,i){var a=!1;return a=e.getTime()>t.getTime()&&e.getTime()<=i.getTime()?!0:a},t.prototype.updateOverlappingValues=function(e){var t,o=this,l=e.childRecords,i=[];if(l.length<=1)e.ganttProperties.workTimelineRanges=[];else{l=this.setSortedChildTasks(e),this.updateOverlappingIndex(l);for(var a=this,n=1;n<l.length;n++)!function(r){var e=((t=l[r]).ganttProperties.segments||[{startDate:t.ganttProperties.startDate,endDate:t.ganttProperties.endDate}]).map(function(e){var t=e.startDate,e=e.endDate;return{startDate:new Date(t),endDate:new Date(e)}}),s=[];e.forEach(function(e){for(var a=new Date(e.startDate.getTime()),n=new Date(e.endDate.getTime()),t=0;t<r;t++){var i=l[t];(i.ganttProperties.segments||[{startDate:i.ganttProperties.startDate,endDate:i.ganttProperties.endDate}]).map(function(e){var t=e.startDate,e=e.endDate;return{startDate:new Date(t),endDate:new Date(e)}}).forEach(function(e){var t=e.startDate,e=e.endDate,i={};a&&n&&e&&(o._isInStartDateRange(a,t,e)||o._isInEndDateRange(n,t,e)||t.getTime()>=a.getTime()&&e.getTime()<=n.getTime())&&(t.getTime()>a.getTime()&&t.getTime()<n.getTime()&&e.getTime()>a.getTime()&&e.getTime()>=n.getTime()||a.getTime()===t.getTime()&&n.getTime()<=e.getTime()?(i.from=t,i.to=n):a.getTime()===t.getTime()&&n.getTime()>e.getTime()?(i.from=t,i.to=e):a.getTime()>t.getTime()&&n.getTime()>=e.getTime()?(i.from=a,i.to=e):a.getTime()>t.getTime()&&n.getTime()<e.getTime()?(i.from=a,i.to=n):t.getTime()>=a.getTime()&&e.getTime()<=n.getTime()&&(i.from=t,i.to=e),i.from)&&i.to&&s.push(i)})}}),i.push.apply(i,a.mergeRangeCollections(s))}(n);this.parent.setRecordValue("workTimelineRanges",this.mergeRangeCollections(i,!0),e.ganttProperties,!0),this.calculateRangeLeftWidth(e.ganttProperties.workTimelineRanges)}},t.prototype.updateOverlappingIndex=function(e){for(var t=0;t<e.length;t++)e[t].ganttProperties.eOverlapIndex=t},t.prototype.calculateRangeLeftWidth=function(e){for(var t=0;t<e.length;t++)e[t].left=this.getTaskLeft(e[t].from,!1),e[t].width=this.getTaskWidth(e[t].from,e[t].to)},t.prototype.mergeRangeCollections=function(e,t){for(var i,a,n,r,s=[],o={},l=new D.DataManager(e).executeLocal((new D.Query).sortBy(this.parent.taskFields.startDate,"Ascending")),d=0;d<l.length;d++)0===s.length&&0===d?s.push(l[d]):(i=(o=s[s.length-1]).from,a=o.to,n=(r=l[d]).from,r=r.to,i.getTime()===n.getTime()&&a.getTime()>=r.getTime()||i.getTime()<n.getTime()&&a.getTime()>=r.getTime()||(i.getTime()<=n.getTime()&&a.getTime()>=n.getTime()&&a.getTime()<r.getTime()||a.getTime()<n.getTime()&&this.checkStartDate(a).getTime()===n.getTime()?o.to=r:a.getTime()<n.getTime()&&this.checkStartDate(a).getTime()!==n.getTime()&&s.push(l[d])));return s=t?this.splitRangeCollection(s):s},t.prototype.setSortedChildTasks=function(e){return new D.DataManager(e.childRecords).executeLocal((new D.Query).sortBy(this.parent.taskFields.startDate,"Ascending"))},t.prototype.splitRangeCollection=function(e,t,i){var a=!this.parent.timelineModule.isSingleTier||"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier;return"Week"===a||"Month"===a||"Year"===a?e:"Day"===a||0===this.parent.workingTimeRanges[0].from&&86400===this.parent.workingTimeRanges[0].to?this.getRangeWithWeek(e,t,i):this.getRangeWithDay(e,t,i)},t.prototype.getRangeWithDay=function(e,t,i){for(var a=[],n=0;n<e.length;n++)a.push.apply(a,this.splitRangeForDayMode(e[parseInt(n.toString(),10)],t,i));return a},t.prototype.splitRangeForDayMode=function(e,t,i){var a=t||"from",n=i||"to",r=new Date(e[a]),s=new Date(e[n]),o=[],l={};if(r.getTime()<s.getTime())do{for(var d,h=new Date(r.getTime()),p=new Date(r.getTime()),u=this.parent.dataOperation.getSecondsInDecimal(r),c=-1,g=0;g<this.parent.workingTimeRanges.length;g++){var f=this.parent.workingTimeRanges[g];if(u>=f.from&&u<=f.to){c=g;break}}-1!==c&&(d=Math.round(this.parent.workingTimeRanges[c].to-u),p.setSeconds(p.getSeconds()+d))}while(p.getTime()<s.getTime()?(l={},e.task&&(l.task=ne.extend([],e.task)),l[a]=h,l[n]=p):(l={},e.task&&(l.task=ne.extend([],e.task)),l[a]=h,l[n]=s),l.isSplit=!0,o.push(l),(r=this.checkStartDate(p)).getTime()<s.getTime());else o.push(e);return o},t.prototype.getRangeWithWeek=function(e,t,i){for(var a=[],n=0;n<e.length;n++)a.push.apply(a,this.splitRangeForWeekMode(e[n],t,i));return a},t.prototype.splitRangeForWeekMode=function(e,t,i){var a,n,r,s,o=t||"from",l=i||"to",d=new Date(e[o]),h=new Date(e[o]),p=new Date(e[l]),u=!1,c=[],g={};if(h.setDate(h.getDate()+1),h.getTime()<p.getTime()){do{}while(this.parent.dataOperation.isOnHolidayOrWeekEnd(h,null)?(n=void(a=new Date(h.getTime())).setDate(h.getDate()-1),n=0<this.parent.weekWorkingTime.length?this.parent.getEndTime(a):this.parent.defaultEndTime,this.setTime(n,a),(g={})[o]=d,g.isSplit=!0,g[l]=new Date(a),e.task&&(g.task=ne.extend([],e.task,!0)),n=!this.parent.dataOperation.isOnHolidayOrWeekEnd(d,null),r=!this.parent.dataOperation.isOnHolidayOrWeekEnd(a,null),s=d.getTime()!==a.getTime(),n&&r&&s&&c.push(g),a.setDate(a.getDate()+1),d=this.checkStartDate(a),h=new Date(d.getTime()),u=!0):h.setDate(h.getDate()+1),h.getTime()<p.getTime());u?d.getTime()!==p.getTime()&&(g={},e.task&&(g.task=ne.extend([],e.task,!0)),g[o]=d,g[l]=p,g.isSplit=!0,c.push(g)):c.push(e)}else c.push(e);return c},t.prototype.updateGanttData=function(){this.systemTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone;var e=this.parent.flatData;if(e.length){for(var t=new Map,i=0,a=e;i<a.length;i++){var n=a[i];t.set(n.uniqueID,n)}for(var r=0,s=e.length;r<s;r++)this.updateTaskLeftWidth(e[r],t)}},t.prototype.shouldProcessUpdateWidth=function(){return!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&Boolean(this.parent.taskFields.hasChildMapping)},t.prototype.updateTaskLeftWidth=function(e,t){void 0===t&&(t=null);var i=e.ganttProperties,i=(e.hasChildRecords&&!this.shouldProcessUpdateWidth()||this.updateWidthLeft(e),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(i),i,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(i),i,!0),e.parentItem?null!=t?t.get(e.parentItem.uniqueID):this.parent.getParentTask(e.parentItem):null),t=i&&i.childRecords.slice(-1)[0]===e;i&&(t&&!e.hasChildRecords&&this.parent.enableValidation?((!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&"ResourceView"!==this.parent.viewType||this.updateParentItems(i),this.shouldProcessUpdateWidth()&&this.updateWidthLeft(i)):i&&!this.parent.enableValidation&&this.updateWidthLeft(i))},t.prototype.reUpdateGanttDataPosition=function(){for(var e=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.flatData,t=e.length,i=0;i<t;i++){var a=e[i],n=a.ganttProperties;this.updateWidthLeft(a),"Auto"!==this.parent.taskMode&&a.hasChildRecords&&this.updateAutoWidthLeft(a),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(n),n,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(n),n,!0),this.parent.dataOperation.updateTaskData(a)}},t.prototype.updateWidthLeft=function(e){var t=e.ganttProperties,i=0,a=0;if(!ne.isNullOrUndefined(t.segments)&&0<t.segments.length){for(var n=t.segments,r=0;r<n.length;r++){var s,o=n[r];0!==r||ne.isNullOrUndefined(t.startDate)||ne.isNullOrUndefined(o.startDate)||ne.isNullOrUndefined(o.startDate.getTime())||o.startDate.getTime()===t.startDate.getTime()||(o.startDate=t.startDate,s=this.parent.dataOperation.getEndDate(o.startDate,o.duration,t.durationUnit,t,!1),o.endDate=this.parent.dataOperation.checkEndDate(s,t,!1),this.parent.chartRowsModule.incrementSegments(n,0,e)),o.width=this.getSplitTaskWidth(o.startDate,o.duration,e),i+=o.width,o.showProgress=!1,o.progressWidth=-1,0!==r&&(s=new Date(t.startDate.getTime()),o.left=this.getSplitTaskLeft(o.startDate,s))}for(var l=this.parent.dataOperation.getProgressWidth(i,t.progress),d=!0,r=0;r<n.length;r++)d&&(l<=n[r].width?(n[r].progressWidth=l,d=!(n[r].showProgress=!0)):(n[r].progressWidth=n[r].width,l-=n[r].progressWidth),n[r].showProgress)&&(a=a+n[r].left+n[r].progressWidth);this.parent.setRecordValue("segments",t.segments,t,!0),this.parent.dataOperation.updateMappingData(e,"segments")}this.parent.setRecordValue("width",this.parent.dataOperation.calculateWidth(e),t,!0),this.parent.setRecordValue("left",this.parent.dataOperation.calculateLeft(t,e),t,!0),!ne.isNullOrUndefined(t.segments)&&0<t.segments.length?this.parent.setRecordValue("progressWidth",a,t,!0):this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.isAutoSchedule||!e.hasChildRecords?t.width:t.autoWidth,t.progress),t,!0)},t.prototype.updateAutoWidthLeft=function(e){var t=e.ganttProperties;this.parent.setRecordValue("autoWidth",this.calculateWidth(e,!0),t,!0),this.parent.setRecordValue("autoLeft",this.calculateLeft(t,e,!0),t,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.isAutoSchedule||!e.hasChildRecords?t.width:t.autoWidth,t.progress),t,!0)},t.prototype.getParentProgress=function(e){var t=0,i={},a=0<this.parent.weekWorkingTime.length?this.parent.getSecondsPerDay(e.ganttProperties.startDate||e.ganttProperties.endDate):this.parent.secondsPerDay;switch(e.ganttProperties.durationUnit){case"hour":t=e.ganttProperties.duration/(a/3600);break;case"minute":t=e.ganttProperties.duration/(a/60);break;default:t=e.ganttProperties.duration}return e.hasChildRecords?(ne.setValue("totalProgress",e.ganttProperties.totalProgress,i),ne.setValue("totalDuration",e.ganttProperties.totalDuration||0,i)):(ne.setValue("totalProgress",e.ganttProperties.progress*t,i),ne.setValue("totalDuration",t,i)),i},t.prototype.resetDependency=function(e){var t,i=this.parent.taskFields.dependency;ne.isNullOrUndefined(i)||(t=e.ganttProperties,this.parent.setRecordValue("predecessor",[],t,!0),this.parent.setRecordValue("predecessorsName",null,t,!0),this.parent.setRecordValue("taskData."+i,null,e),this.parent.setRecordValue(i,null,e))},t.prototype.isUnscheduledTask=function(e,t){for(var i=0,a=null,n=0,r=["startDate","endDate","duration"];n<r.length;n++){var s=r[n];e&&e[s]&&(i++,a=s)}return 1===i||0===i&&!ne.isNullOrUndefined(t)&&t.hasChildRecords?[!0,a]:[!1,null]},t.prototype.isFromManual=function(e){return!!(this.parent.allowUnscheduledTasks&&this.parent.editModule&&this.parent.oldRecords&&0<this.parent.oldRecords.length&&ne.isNullOrUndefined(e.ganttProperties.startDate)&&ne.isNullOrUndefined(e.ganttProperties.endDate)&&!ne.isNullOrUndefined(e.ganttProperties.duration)&&!e.hasChildRecords&&e.parentItem&&("Manual"===this.parent.taskMode||"Custom"===this.parent.taskMode&&e[this.parent.taskFields.manual]))},t.prototype.updateParentItems=function(e,t){var o=this,l=(l=t?e:this.parent.getParentTask(e))||e,d=!1,h=ne.isNullOrUndefined(l)?null:l.ganttProperties,t=this.isUnscheduledTask(h,l),p=t[0];t[1];if(this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)||"ResourceView"===this.parent.viewType){if(l&&l.childRecords&&0<l.childRecords.length){for(var u,i,a,n,e=h.isAutoSchedule?h.startDate:h.autoStartDate,t=h.isAutoSchedule?h.endDate:h.autoEndDate,c=l.childRecords,g=c.length,f=0,m=null,y=null,D=0,k=0,b=0,r=0,s=0,w=(c.some(function(e){var e=o.isUnscheduledTask(e.ganttProperties),t=e[0],e=e[1];return t&&"duration"===e?++s:t||++r,0<r&&0<s}),0<r&&0<s||void 0),T=this,v=0;v<g;v++)!function(t){if(u=T.parent.loadChildOnDemand&&T.parent.taskFields.hasChildMapping?T.parent.currentViewData.filter(function(e){return e.ganttProperties.taskId===c[t][o.parent.taskFields.id]})[0]:c[t],T.parent.isOnDelete&&u.isDelete)return 1===g&&"ProjectView"===T.parent.viewType&&(d=!0);var e=void 0,i=void 0,a=T.isUnscheduledTask(u.ganttProperties),n=a[0],a=a[1],r=void 0,s=(r=T.isFromManual(u)&&(s=T.parent.oldRecords.filter(function(e){return e.ganttProperties.uniqueID===u.ganttProperties.uniqueID})[0])?T.parent.getParentTask(s.parentItem):r)||u,r=r?r.ganttProperties:h,e=n&&"startDate"!==a&&"endDate"!==a&&!p?h.startDate:T.getValidStartDate(s.ganttProperties),a=(!l.hasChildRecords||r.isAutoSchedule||ne.isNullOrUndefined(s.ganttProperties.autoStartDate)||(e=s.ganttProperties.autoStartDate),i=n&&"startDate"!==a&&"endDate"!==a&&!p?T.getEndDate(h.startDate,s.ganttProperties.duration,s.ganttProperties.durationUnit,s.ganttProperties,!1):T.getValidEndDate(s.ganttProperties),!l.hasChildRecords||r.isAutoSchedule||ne.isNullOrUndefined(s.ganttProperties.autoEndDate)||(i=s.ganttProperties.autoEndDate),n&&"startDate"!==a&&"endDate"!==a&&(r=T.getDateFromFormat(i),s=T.getDateFromFormat(e),y<r&&(y=r),s<m)&&(m=s),w&&!n||ne.isNullOrUndefined(w)),s=(ne.isNullOrUndefined(m)&&a&&(m=T.getDateFromFormat(e)),ne.isNullOrUndefined(y)&&a&&(y=T.getDateFromFormat(i)),!ne.isNullOrUndefined(i)&&y&&1===T.compareDates(i,y)&&(y=T.getDateFromFormat(i)),!ne.isNullOrUndefined(e)&&m&&-1===T.compareDates(e,m)&&(m=T.getDateFromFormat(e)),!u.ganttProperties.isMilestone&&j(u.ganttProperties)?(r=T.getParentProgress(u),k+=ne.getValue("totalProgress",r),f+=ne.getValue("totalDuration",r),u[T.parent.taskFields.duration]<1&&(f=Number(f.toFixed(4)))):D++,u.ganttProperties.work);"string"==typeof s?(n=parseFloat(s),isNaN(n)||(b+=n)):"number"==typeof s&&(b+=s)}(v);d||(i=0<(n=this.parent.isOnDelete&&u.isDelete?g-D-1:g-D)&&0<f?Number((k/f).toFixed(2)):0,a=l.ganttProperties,n=!(0!=n||!m||!y||m.getTime()!==y.getTime()),0!==this.compareDates(e,m)&&(this.parent.setRecordValue(h.isAutoSchedule?"startDate":"autoStartDate",m,l.ganttProperties,!0),ne.isNullOrUndefined(h.autoDuration)?0===h.duration:0===h.autoDuration)&&l.isManual&&n&&l.hasChildRecords&&l.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("startDate",m,l.ganttProperties,!0),0!==this.compareDates(t,y)&&(this.parent.setRecordValue(h.isAutoSchedule?"endDate":"autoEndDate",y,l.ganttProperties,!0),ne.isNullOrUndefined(h.autoDuration)?0===h.duration:0===h.autoDuration)&&l.isManual&&n&&l.hasChildRecords&&l.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("endDate",y,l.ganttProperties,!0),this.parent.setRecordValue("isMilestone",n,a,!0),ne.isNullOrUndefined(this.parent.taskFields.milestone)||(this.updateMappingData(l,"milestone"),this.parent.setRecordValue(this.parent.taskFields.milestone,n,l,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.milestone,n,l,!0)),a.isAutoSchedule&&(this.isFromManual(u)?(1===l.childRecords.length&&(l.ganttProperties.duration=u.ganttProperties.duration),this.calculateEndDate(l)):this.calculateDuration(l)),this.updateWorkWithDuration(l),e=a.work,e=this.parent.isOnEdit?e:e+b,this.parent.setRecordValue("work",e,a,!0),this.parent.setRecordValue("taskType","FixedDuration",a,!0),ne.isNullOrUndefined(this.parent.taskFields.type)||this.updateMappingData(l,"type"),this.parent.setRecordValue("progress",Math.floor(i),a,!0),this.parent.setRecordValue("totalProgress",k,a,!0),this.parent.setRecordValue("totalDuration",f,a,!0),this.parent.setRecordValue("autoDuration",a.duration,a,!0),a.isAutoSchedule||(this.parent.setRecordValue("autoDuration",this.calculateAutoDuration(a),a,!0),this.updateAutoWidthLeft(l)),this.parent.allowParentDependency||this.resetDependency(l),this.updateWidthLeft(l),this.updateTaskData(l))}}else this.parent.setRecordValue("endDate",l.taskData[this.parent.taskFields.endDate],l.ganttProperties,!0);d&&1===l.childRecords.length&&0===l.ganttProperties.duration&&(this.parent.setRecordValue("isMilestone",!0,l.ganttProperties,!0),this.updateWidthLeft(l),this.updateTaskData(l));t=ne.isNullOrUndefined(l)?null:this.parent.getParentTask(l.parentItem);!t||(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&"ResourceView"!==this.parent.viewType||this.updateParentItems(t),d=!1};var ee,te,ie=t;function t(e){e=te.call(this,e)||this;return e.customSegmentProperties=[],e.isBaseline=!1,e.uid=0,e.isTaskIDInteger=!0,e.recordIndex=0,e.taskIds=[],e.hierarchyData=[],e.addEventListener(),e}var ae="e-gantt",le="e-gantt-single-timeline",de="e-chart-root-container",he="e-chart-rows-container",pe="e-device",ue="e-grid",ce="e-timeline-header-container",ge="e-timeline-header-table-container",fe="e-timeline-header-table-body",me="e-left-label-container",ye="e-left-label-inner-div",De="e-right-label-container",ke="e-right-label-inner-div",P="e-taskbar-main-container",be="e-task-label",we="e-gantt-child-taskbar-inner-div",Te="e-gantt-child-progressbar-inner-div",ve="e-gantt-child-critical-taskbar-inner-div",Se="e-gantt-child-critical-progressbar-inner-div",Pe="e-critical-milestone",Ce="e-baseline-bar",Re="e-baseline-gantt-milestone-container",Me="e-chart-row-cell",Oe="e-chart-row",xe="e-gantt-multi-taskbar",Ie="e-taskbar-left-resizer",Ee="e-taskbar-right-resizer",Fe="e-child-progress-resizer",Ue="e-progressbar-handler",Ne="e-progressbar-handler-element",Le="e-progressbar-handler-after",Ve="e-icon",Be="e-gantt-milestone",Ae="e-gantt-child-taskbar",We="e-gantt-child-progressbar",je="e-manualparent-main-container",He="e-gantt-manualparenttaskbar",ze="e-gantt-manualparent-milestone",Ge="e-gantt-child-manualtaskbar",qe="e-gantt-manualparenttaskbar-right",_e="e-gantt-parent-taskbar",Ze="e-gantt-parent-progressbar",Xe="e-gantt-unscheduled-task",Ye="e-left-resize-gripper",Ke="e-right-resize-gripper",Qe="e-progress-resize-gripper",l="e-label",$e="e-template-padding",Je="e-gantt-unscheduled-taskbar-left",et="e-gantt-unscheduled-taskbar-right",tt="e-connector-line-container",it="e-connector-line",at="e-critical-line",nt="e-critical-line-arrow",rt="e-connector-line-arrow",st="e-connector-line-z-index",ot="e-connectorpoint-left",lt="e-connectorpoint-right",dt="e-connectorpoint-left-hover",ht="e-connectorpoint-right-hover",pt="e-right-connectorpoint-outer-div",ut="e-connectorpoint-allow-block",ct="e-gantt-tooltip",p=".e-content",gt=".e-gridform",ft="e-edit",mt="e-active-parent-task",yt="e-active-child-task",Dt="e-active-connected-task",kt="e-predecessor-touch-mode",bt="e-rangecontainer",wt="e-rg-rangdiv",Tt="e-constraint-label",vt=(St.prototype.addEventListeners=function(){this.parent.on("grid-scroll",this.gridScrollHandler,this),ne.EventHandler.add(this.element,"scroll",this.onScroll,this),this.parent.treeGrid.grid.on("showGanttShimmer",this.updateShimmer,this),this.parent.treeGrid.grid.on("removeGanttShimmer",this.removeShimmer,this),this.parent.treeGrid.grid.on("virtualTransform",this.transformChange,this)},St.prototype.removeEventListeners=function(){ne.EventHandler.remove(this.element,"scroll",this.onScroll),this.parent.off("grid-scroll",this.gridScrollHandler),this.parent.treeGrid.grid.off("showGanttShimmer",this.updateShimmer),this.parent.treeGrid.grid.off("removeGanttShimmer",this.removeShimmer),this.parent.treeGrid.grid.off("virtualTransform",this.transformChange)},St.prototype.gridScrollHandler=function(e){this.element.scrollTop=ne.getValue("top",e),this.isFromTreeGrid=!0},St.prototype.updateContent=function(){var e=this.parent.element,e=Math.round(this.element.scrollLeft/e.offsetWidth);(this.previousCount!==e||this.parent.timelineModule.performedTimeSpanAction||this.parent.timelineModule.isZoomingAction)&&(this.parent.timelineModule.isZoomingAction=!1,this.deleteTableElements(),this.parent.timelineModule.createTimelineSeries(),"Vertical"!==this.parent.gridLines&&"Both"!==this.parent.gridLines||this.parent.renderChartVerticalLines(),this.parent.dayMarkersModule&&this.parent.dayMarkersModule.eventMarkerRender.renderEventMarkers(),this.parent.timelineModule.performedTimeSpanAction=!1,this.parent.dayMarkersModule&&(this.parent.dayMarkersModule.nonworkingDayRender.renderWeekends(),this.parent.dayMarkersModule.nonworkingDayRender.renderHolidays()),this.updateChartElementStyles(),this.previousCount=e,this.isSetScrollLeft)&&(this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft)},St.prototype.getTimelineLeft=function(){var e,t=this.parent.element,i=this.parent.timelineModule.wholeTimelineWidth>3*t.offsetWidth?this.parent.timelineModule.wholeTimelineWidth-3*t.offsetWidth:0;return(e=i<=(e=this.element.scrollLeft===(this.parent.enableRtl?-i:i)?this.element.scrollLeft:(e=this.parent.enableRtl?-this.element.scrollLeft:this.element.scrollLeft)>t.offsetWidth?e-t.offsetWidth:0)?i:e)<=t.offsetWidth&&this.isBackwardScrolled&&(e=0),e=this.parent.timelineModule.isZoomToFit||this.parent.timelineModule.isZooming?0:e},St.prototype.deleteTableElements=function(){for(var e=this.parent.element.getElementsByClassName("e-timeline-header-table-container");e[0].remove(),0<e.length;);this.parent.element.querySelector("#ganttContainerline-container")&&(this.parent.element.querySelector("#ganttContainerline-container").innerHTML=""),this.parent.element.querySelector(".e-nonworking-day-container")&&(this.parent.element.querySelector(".e-nonworking-day-container").outerHTML=null)},St.prototype.updateChartElementStyles=function(){var e,t,i=this.getTimelineLeft();this.parent.enableTimelineVirtualization&&(e=this.parent.connectorLineModule.dependencyViewContainer,t=this.parent.chartRowsModule.taskTable,this.parent.enableRtl?(e.style.left=i+"px",t.style.right=-i+"px"):(e.style.left=-i+"px",t.style.left=-i+"px"),t.style.width=this.parent.timelineModule.wholeTimelineWidth+"px")},St.prototype.updateTopPosition=function(){var e,t,i,a=this.parent.treeGrid.element.querySelector(".e-content").scrollTop;a=this.parent.virtualScrollModule&&this.parent.enableVirtualization?a-this.parent.virtualScrollModule.getTopPosition():a,ne.isNullOrUndefined(this.parent.dayMarkersModule)||(e=ne.getValue("nonworkingDayRender.holidayContainer",this.parent.dayMarkersModule),t=ne.getValue("nonworkingDayRender.weekendContainer",this.parent.dayMarkersModule),i=ne.getValue("eventMarkerRender.eventMarkersContainer",this.parent.dayMarkersModule),e&&(e.style.top=ne.formatUnit(a)),t&&(t.style.top=ne.formatUnit(a)),i&&(i.style.top=ne.formatUnit(a))),this.parent.chartVerticalLineContainer&&(this.parent.chartVerticalLineContainer.style.top=ne.formatUnit(a))},St.prototype.removeShimmer=function(){var i=this.parent;setTimeout(function(){if(i.hideMaskRow(),!i.allowTaskbarOverlap&&i.showOverAllocation){for(var e=0;e<i.currentViewData.length;e++){var t=i.chartRowsModule.ganttChartTableBody.childNodes[e];"none"!==t.style.display&&i.currentViewData[e].hasChildRecords&&!i.currentViewData[e].expanded&&(i.ganttChartModule.isExpandAll||i.ganttChartModule.isCollapseAll?i.treeGrid.getRowByIndex(e).style.height=t.style.height:i.treeGrid.getRows()[e].style.height=t.style.height)}i.contentHeight=(i.enableRtl?i.element.getElementsByClassName("e-content")[2]:i.element.getElementsByClassName("e-content")[0]).children[0].offsetHeight,i.element.getElementsByClassName("e-chart-rows-container")[0].style.height=i.contentHeight+"px"}},0)},St.prototype.transformChange=function(){this.parent.ganttChartModule.virtualRender.adjustTable(),this.parent.ganttChartModule.scrollObject.updateTopPosition()},St.prototype.updateShimmer=function(){var e=this.parent;setTimeout(function(){e.showMaskRow()},0)},St.prototype.updateSpinner=function(){var e=this.parent;this.parent.showSpinner(),window.clearTimeout(this.isScrolling),this.isScrolling=setTimeout(function(){e.hideSpinner()},200)},St.prototype.onScroll=function(){var e=this,t={};this.element.scrollTop!==this.previousScroll.top&&(this.isFromTreeGrid?this.isFromTreeGrid=!1:this.parent.notify("chartScroll",{top:this.element.scrollTop}),t.previousScrollTop=this.previousScroll.top,this.previousScroll.top=this.element.scrollTop,t.scrollTop=this.element.scrollTop,t.scrollDirection="Vertical",t.action="VerticalScroll",this.updateTopPosition()),this.element.scrollLeft!==this.previousScroll.left&&(this.isBackwardScrolled=this.element.scrollLeft<this.previousScroll.left&&!this.parent.enableRtl,this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,t.previousScrollLeft=this.previousScroll.left,this.previousScroll.left=this.element.scrollLeft,t.scrollLeft=this.element.scrollLeft,t.scrollDirection="Horizontal",t.action="HorizontalScroll",this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?(this.isSetScrollLeft=!0,this.parent.timelineModule.totalTimelineWidth>3*this.parent.element.offsetWidth&&this.updateContent(),this.parent.ganttChartModule.updateWidthAndHeight(),this.parent.element.getElementsByClassName("e-weekend-container")[0]&&(this.parent.element.getElementsByClassName("e-weekend-container")[0].style.height="100%"),this.parent.element.getElementsByClassName("e-holiday-container")[0]&&(this.parent.element.getElementsByClassName("e-holiday-container")[0].style.height="100%")):this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth<3*this.parent.element.offsetWidth&&this.parent.connectorLineModule.svgObject.setAttribute("width","100%")),this.parent.timelineModule.performedTimeSpanAction=!1,ne.isNullOrUndefined(t.scrollDirection)||!0!==this.parent.enableVirtualization&&!0!==this.parent.enableTimelineVirtualization||!this.parent.isToolBarClick&&!ne.isNullOrUndefined(this.parent.isToolBarClick)||(this.parent.isVirtualScroll=!0,(this.parent.showIndicator||ne.isNullOrUndefined(this.parent.showIndicator))&&(!this.parent.enableVirtualMaskRow&&this.parent.enableVirtualization&&"Spinner"===this.parent.loadingIndicator.indicatorType?this.updateSpinner():this.parent.enableTimelineVirtualization&&!this.parent.isRowSelected&&1e3<Math.abs(this.element.scrollLeft-t.previousScrollLeft)&&(this.parent.enableVirtualMaskRow||"Spinner"!==this.parent.loadingIndicator.indicatorType?(this.parent.showMaskRow(),setTimeout(function(){e.removeShimmer()},0)):this.updateSpinner()),this.parent.isRowSelected=!1)),this.isSetScrollLeft=!1,this.parent.isToolBarClick=!0,t.requestType="scroll",this.parent.trigger("actionComplete",t)},St.prototype.setHeight=function(e){this.element.style.height=ne.formatUnit(e)},St.prototype.setWidth=function(e){this.element.style.width=ne.formatUnit(e)},St.prototype.setScrollTop=function(e){this.element.scrollTop=e,this.parent.treeGrid.element.querySelector(".e-content").scrollTop=e},St.prototype.setScrollLeft=function(e,t){e=-1===t&&this.parent.enableRtl?-e:e,this.isSetScrollLeft=!0,this.element.scrollLeft=e,this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,this.parent.enableTimelineVirtualization||(this.previousScroll.left=this.element.scrollLeft)},St.prototype.destroy=function(){this.removeEventListeners()},St);function St(e){this.previousCount=-1,this.isSetScrollLeft=!1,this.previousScroll={top:0,left:0},this.parent=e,this.element=this.parent.ganttChartModule.scrollElement,this.addEventListeners()}Ct.prototype.renderWrapper=function(){this.wrapper=ne.createElement("div",{className:"e-virtualtable",styles:"position: absolute; transform: translate(0px, 0px);"}),this.parent.ganttChartModule.scrollElement.appendChild(this.wrapper),this.virtualTrack=ne.createElement("div",{className:"e-virtualtrack",styles:"position: relative; pointer-events: none; width: 100%;"}),this.parent.ganttChartModule.scrollElement.appendChild(this.virtualTrack),this.wrapper.appendChild(this.parent.ganttChartModule.chartBodyContent)},Ct.prototype.appendChildElements=function(e){this.wrapper.appendChild(e)},Ct.prototype.adjustTable=function(){var e,t,i,a=this.parent.treeGrid.getContent().querySelector(".e-content").querySelector(".e-virtualtable");this.parent.enableTimelineVirtualization?(i=document.getElementsByClassName("e-virtualtable")[1].style.transform,e=this.parent.treeGrid.element.getElementsByClassName("e-virtualtable")[0].style.transform,t=void 0,t=(""!==i?i:this.parent.ganttChartModule.scrollElement.getElementsByClassName("e-virtualtable")[0].style.transform).match(/translate.*\((.+)\)/)[1].split(", ")[0],i=e.match(/translate.*\((.+)\)/)[1].split(", ")[1],this.parent.ganttChartModule.virtualRender.wrapper.style.transform="translate("+t+", "+i+")"):this.parent.ganttChartModule.virtualRender.wrapper.style.transform=a.style.transform};var Pt=Ct;function Ct(e){this.parent=e}i.prototype.addEventListener=function(){this.parent.on("renderPanels",this.renderChartContainer,this),this.parent.on("recordsUpdated",this.renderChartElements,this),this.parent.on("dataReady",this.renderInitialContents,this),this.parent.on("tree-grid-created",this.renderChartContents,this),this.parent.on("destroy",this.destroy,this)},i.prototype.renderChartContents=function(){this.parent.notify("refreshDayMarkers",{}),this.wireEvents()},i.prototype.renderChartContainer=function(){this.chartElement=ne.createElement("div",{id:this.parent.element.id+"GanttChart",className:"e-gantt-chart"}),this.parent.chartPane.appendChild(this.chartElement),this.renderTimelineContainer(),this.renderBodyContainers()},i.prototype.renderInitialContents=function(){this.parent.timelineModule.createTimelineSeries()},i.prototype.renderOverAllocationContainer=function(){for(var e=0;e<this.parent.flatData.length;e++){var t=this.parent.flatData[e];0<t.childRecords.length&&this.parent.dataOperation.updateOverlappingValues(t)}var i=this.parent.element.querySelector("."+bt);i&&(i.innerHTML=""),0===this.parent.treeGrid.grid.filterSettings.columns.length&&this.renderRangeContainer(this.parent.currentViewData)},i.prototype.renderChartElements=function(){if(this.parent.isFromOnPropertyChange)this.rangeViewContainer.innerHTML="",this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff),this.parent.isFromOnPropertyChange=!1;else{this.parent.chartRowsModule.renderChartRows(),this.parent.predecessorModule&&this.parent.taskFields.dependency&&(this.parent.connectorLineIds=[],this.parent.updatedConnectorLineCollection=[],this.parent.predecessorModule.createConnectorLinesCollection()),this.parent.connectorLineModule.renderConnectorLines(this.parent.updatedConnectorLineCollection);for(var e,t=0;t<this.parent.chartRowsModule.ganttChartTableBody.children.length;t++)this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[4]?(this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[1].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[2].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[4].setAttribute("tabindex","-1")):"ProjectView"===this.parent.viewType?(e=this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(t.toString(),10)].children[0].children[1].children[1],ne.isNullOrUndefined(e)||this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[1].setAttribute("tabindex","-1")):this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(t.toString(),10)].children[0].children[1].children[0]&&this.parent.chartRowsModule.ganttChartTableBody.children[t].children[0].children[1].children[0].setAttribute("tabindex","-1");var i=this.parent.criticalPathModule;this.parent.enableCriticalPath&&i&&i.criticalPathCollection&&this.parent.criticalPathModule.criticalConnectorLine(i.criticalPathCollection,i.detailPredecessorCollection,this.parent.enableCriticalPath,i.predecessorCollectionTaskIds),this.parent.showOverAllocation&&this.renderOverAllocationContainer()}this.updateWidthAndHeight();i=this.parent.loadChildOnDemand&&(this.parent.isExpandPerformed||!ne.isNullOrUndefined(this.parent.isVirtualScroll)&&this.parent.isVirtualScroll);this.parent.isLoad&&!i&&this.parent.notify("selectRowByIndex",{}),this.parent.timelineModule.isZoomedToFit&&this.parent.timelineModule.processZoomToFit()},i.prototype.renderRangeContainer=function(e){var t,i,a,n=e.length;if(0===this.parent.treeGrid.grid.filterSettings.columns.length)for(t=0;t<n;t++)(a=(i=e[t]).ganttProperties.workTimelineRanges)&&this.renderRange(a,i)},i.prototype.getTopValue=function(e){var t,i=this.parent.getExpandedRecords(this.parent.currentViewData),a=i.indexOf(e);return e.parentItem&&-1===a&&(t=this.parent.getRecordByID(e.parentItem.taskId),a=i.indexOf(t)),e.expanded?(a+1)*this.parent.rowHeight:a*this.parent.rowHeight},i.prototype.getHierarchyChildRecords=function(e){for(var t=[],i=0,a=e;i<a.length;i++){var n=a[i];n.childRecords&&0<n.childRecords.length&&(t.push(n),this.collectHierarchyChildren(n.childRecords,t))}return t},i.prototype.collectHierarchyChildren=function(e,t){for(var i=0,a=e;i<a.length;i++){var n=a[i];n.childRecords&&0<n.childRecords.length&&(t.push(n),this.collectHierarchyChildren(n.childRecords,t))}},i.prototype.getRangeHeight=function(e){var t,i=Math.floor(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight);return!e.expanded&&e.hasChildRecords?this.calculateCollapsedRowHeight(i):(t=this.calculateHierarchyChildLength(e),this.calculateExpandedRowHeight(e.childRecords.length,t,i))},i.prototype.calculateCollapsedRowHeight=function(e){return this.parent.rowHeight-e},i.prototype.calculateHierarchyChildLength=function(e){if(!e.childRecords||0===e.childRecords.length)return 0;for(var t=0,i=0,a=this.getHierarchyChildRecords(e.childRecords);i<a.length;i++){var n=a[i];0!==n.childRecords.length&&n.expanded&&(t+=n.childRecords.length)}return t},i.prototype.calculateExpandedRowHeight=function(e,t,i){return(e+t)*this.parent.rowHeight-i},i.prototype.renderRange=function(e,t){var i=0,a=this.parent.currentViewData.indexOf(t),n=(i=!this.parent.allowTaskbarOverlap&&this.parent.enableMultiTaskbar?(o=t.parentItem?this.parent.getParentTask(t.parentItem):null,t.parentItem&&o&&!o.expanded&&t.hasChildRecords&&!t.expanded?this.parent.getRowByIndex(this.parent.getRootParent(t,0).index).offsetTop:(n=this.parent.getRowByIndex(a).offsetTop,t.expanded?n+this.parent.rowHeight:n)):this.getTopValue(t),this.rangeViewContainer.querySelector(".rangeContainer"+t.ganttProperties.rowUniqueID)),r=(n&&n.remove(),ne.createElement("div",{className:"rangeContainer"+t.ganttProperties.rowUniqueID,styles:"top:"+i+"px; position: absolute;"}));if((0!==t.level||t.expanded||!ne.isNullOrUndefined(t.parentItem)||this.parent.enableMultiTaskbar)&&(!(0<t.level&&t.expanded)||this.parent.getRecordByID(t.parentItem.taskId).expanded)){for(var s=0;s<e.length;s++){var o,l=void 0,d=this.parent.chartRowsModule.ganttChartTableBody.childNodes,d=(l=this.parent.allowTaskbarOverlap||t.expanded||!this.parent.enableMultiTaskbar?this.getRangeHeight(t):(a=(o=this.parent.getRootParent(t,0)).expanded?a:this.parent.currentViewData.indexOf(o),parseInt(d[a].style.height,10)-(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)),ne.createElement("div",{className:wt+" e-leftarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[s].left+e[s].width-5:e[s].left)+"px;\n                top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px;\n                height: "+(l+1)+"px; border-right: 0px;\n                z-index: "+("ProjectView"===this.parent.viewType?1<t.childRecords.length?t.childRecords.length+1:t.childRecords.length:6)})),l=ne.createElement("div",{className:wt+" e-rightarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[s].left:e[s].left+e[s].width-5)+"px;\n                top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px; height: "+(l+1)+"px;\n                border-left: 0px;\n                z-index: "+("ProjectView"===this.parent.viewType?1<t.childRecords.length?t.childRecords.length+1:t.childRecords.length:6)});r.appendChild(d),r.appendChild(l),this.rangeViewContainer.appendChild(r)}this.parent.ganttChartModule.chartBodyContent.appendChild(this.rangeViewContainer)}},i.prototype.renderTimelineContainer=function(){this.chartTimelineContainer=ne.createElement("div",{className:ce}),this.parent.enableRtl&&(this.chartTimelineContainer.style.borderLeftWidth="1px",this.chartTimelineContainer.style.borderRightWidth="0px"),this.chartTimelineContainer.setAttribute("role","presentation"),this.chartElement.appendChild(this.chartTimelineContainer)},i.prototype.renderBodyContainers=function(){this.chartBodyContainer=ne.createElement("div",{className:de}),this.chartElement.appendChild(this.chartBodyContainer),this.scrollElement=ne.createElement("div",{className:"e-chart-scroll-container e-content",styles:"position:relative;"}),this.chartBodyContainer.appendChild(this.scrollElement),this.chartBodyContent=ne.createElement("div",{className:he,styles:"position:relative; overflow:hidden "}),this.parent.virtualScrollModule&&this.parent.enableVirtualization||this.parent.enableTimelineVirtualization?this.parent.ganttChartModule.virtualRender.renderWrapper():this.scrollElement.appendChild(this.chartBodyContent),this.scrollObject=new vt(this.parent);var e=0;ne.isNullOrUndefined(this.parent.toolbarModule)||ne.isNullOrUndefined(this.parent.toolbarModule.element)||(e=this.parent.toolbarModule.element.offsetHeight),this.scrollObject.setHeight(this.parent.ganttHeight-this.chartTimelineContainer.offsetHeight-e)},i.prototype.updateWidthAndHeight=function(){var e=0===this.parent.contentHeight?1<this.parent.flatData.length?36:0:this.parent.contentHeight,t=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0];e>=t.offsetHeight||"auto"===this.parent.height||t.offsetHeight-e<36?this.chartBodyContent.style.height=ne.formatUnit(e):(e=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight,t.offsetHeight>=e?this.chartBodyContent.style.height=t.offsetHeight-17+"px":this.chartBodyContent.style.height=t.offsetHeight+"px"),this.parent.timelineModule.isZoomToFit&&this.parent.enableTimelineVirtualization?this.chartBodyContent.style.width=this.parent.enableTimelineVirtualization&&this.parent.timelineModule.totalTimelineWidth>3*this.parent.element.offsetWidth?ne.formatUnit(3*this.parent.element.offsetWidth):ne.formatUnit(this.parent.timelineModule.totalTimelineWidth-this.parent.timelineModule.clientWidthDifference):this.chartBodyContent.style.width=this.parent.enableTimelineVirtualization&&this.parent.timelineModule.totalTimelineWidth>3*this.parent.element.offsetWidth?ne.formatUnit(3*this.parent.element.offsetWidth):ne.formatUnit(this.parent.timelineModule.totalTimelineWidth),this.parent.timelineModule.isZoomedToFit&&this.parent.enableVirtualization&&(e=Math.abs(this.parent.timelineModule.totalTimelineWidth-this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].clientWidth),this.parent.ganttChartModule.chartBodyContent.style.width=ne.formatUnit(this.parent.timelineModule.totalTimelineWidth-e)),this.setVirtualHeight(),this.parent.notify("updateHeight",{}),this.parent.updateGridLineContainerHeight(),this.updateLastRowBottomWidth()},i.prototype.setVirtualHeight=function(){var e,t,i,a;this.parent.virtualScrollModule&&this.parent.enableVirtualization&&(ne.getValue("virtualTrack",this.parent.ganttChartModule.virtualRender).style.height=this.parent.treeGrid.element.getElementsByClassName("e-virtualtrack")[0].style.height,e=ne.getValue("wrapper",this.parent.ganttChartModule.virtualRender),t=this.parent.treeGrid.element.getElementsByClassName("e-virtualtable")[0].style.transform,a=document.getElementsByClassName("e-virtualtable")[1].style.transform,this.parent.enableTimelineVirtualization?(i=void 0,"translate(0px)"===t&&navigator.userAgent.includes("Firefox")&&(t="translate(0px, 0px)"),i=(""!==a?a:this.parent.ganttChartModule.scrollElement.getElementsByClassName("e-virtualtable")[0].style.transform).match(/translate.*\((.+)\)/)[1].split(", ")[0],a=t.match(/translate.*\((.+)\)/)[1].split(", ")[1],e.style.transform="translate("+i+", "+a+")"):e.style.transform=t)},i.prototype.updateLastRowBottomWidth=function(){var e,t;0<this.parent.currentViewData.length&&"auto"!==this.parent.height&&(e=(e=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.expandedRecords)[e.length-1],e=this.parent.currentViewData.indexOf(e),e=this.parent.getRowByIndex(e),(t=this.parent.chartRowsModule.ganttChartTableBody).querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow")&&ne.removeClass(t.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow"),"e-lastrow"),this.chartBodyContent.clientHeight<this.chartBodyContainer.clientHeight)&&e&&(ne.addClass(e.querySelectorAll("td"),"e-lastrow"),(t=0===this.parent.contentHeight?1<this.parent.flatData.length?36:0:this.parent.contentHeight)>=(e=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0]).offsetHeight||e.offsetHeight-t<36?this.chartBodyContent.style.height=ne.formatUnit(t):(t=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight,e.offsetHeight>=t?this.chartBodyContent.style.height=e.offsetHeight-17+"px":this.chartBodyContent.style.height=e.offsetHeight+"px"))},i.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("renderPanels",this.renderChartContainer),this.parent.off("recordsUpdated",this.renderChartElements),this.parent.off("dataReady",this.renderInitialContents),this.parent.off("tree-grid-created",this.renderChartContents),this.parent.off("destroy",this.destroy))},i.prototype.ganttChartMouseDown=function(e){var t,i=!1;"touchstart"===e.type&&e instanceof TouchEvent&&e.touches&&2===e.touches.length&&(this.initPinchDistance=this.calculatePinchDistance(e.touches[0],e.touches[1]),this.isPinching=!0),this.parent.allowTaskbarDragAndDrop&&this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&!this.isPinching&&("ChildDrag"!==(t=this.parent.editModule.taskbarEditModule.getTaskBarAction(e))&&"ParentDrag"!==t&&"MilestoneDrag"!==t&&"ManualParentDrag"!==t||(t={cancel:i,data:this.getRecordByTaskBar(e.target),target:e.target,chartRow:ne.closest(e.target,"tr")},this.parent.trigger("rowDragStartHelper",t),i=t.cancel)),i||this.isPinching||(3!==e.which&&this.parent.editSettings.allowTaskbarEditing&&(this.parent.notify("chartMouseDown",e),this.parent.element.tabIndex=0),t=!1,(t=this.parent.editSettings.allowTaskbarEditing&&(this.parent.element.querySelector(".e-left-resize-gripper")||this.parent.element.querySelector(".e-left-connectorpoint-outer-div"))?!0:t)&&2!==e.button)||this.parent.editSettings.allowEditing&&0<this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length&&this.parent.treeGrid.endEdit()},i.prototype.calculatePinchDistance=function(e,t){var i=t.clientX-e.clientX,t=t.clientY-e.clientY;return Math.sqrt(i*i+t*t)},i.prototype.ganttChartMouseClick=function(e){this.parent.autoFocusTasks&&this.scrollToTarget(e),this.parent.notify("chartMouseClick",e)},i.prototype.ganttChartMouseUp=function(e){var t,i;"touchend"===e.type&&(this.initPinchDistance=null,this.isPinching=!1,t=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div"),ne.isNullOrUndefined(t)||t.remove(),t=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar")||this.parent.chartPane.querySelector(".e-clone-taskbar"),ne.isNullOrUndefined(t)||t.parentElement.parentElement.remove(),t=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-gantt-false-line"),ne.isNullOrUndefined(t)||this.parent.editModule.taskbarEditModule.removeFalseLine(!0)),this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseUp",e),this.parent.editSettings.allowEditing||(t=!1,t=!!(this.parent.editSettings.allowTaskbarEditing&&ne.getValue("editModule.taskbarEditModule.isMouseDragged",this.parent)&&ne.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent))||t)||(t=e.target,i=e.target.classList.contains(P)||ne.closest(e.target,"."+P),!ne.closest(t,".e-gantt-parent-taskbar")||this.parent.editSettings.allowEditing||this.parent.isAdaptive?!i&&this.parent.autoFocusTasks&&this.scrollToTarget(e):this.chartExpandCollapseRequest(e))},i.prototype.scrollToTarget=function(e){var t=ne.closest(e.target,"tr");t&&this.parent.element.contains(t)&&(this.parent.element.querySelectorAll(".e-chart-rows-container")[0].contains(e.target)||this.parent.element.querySelectorAll(".e-gridcontent")[0].contains(e.target))&&0<this.parent.currentViewData.length&&(t=ne.getValue("rowIndex",ne.closest(e.target,"tr")),e=this.parent.currentViewData[t].ganttProperties.startDate,t=this.parent.currentViewData[t].ganttProperties.left,ne.isNullOrUndefined(e)||(e=this.parent.enableTimelineVirtualization?{}:this.parent.dataOperation.getTaskLeft(e,!1),this.parent.autoFocusTasks&&(this.parent.enableTimelineVirtualization?this.updateScrollLeft(t):this.updateScrollLeft(e))))},i.prototype.updateScrollLeft=function(e){e=this.scrollElement.scrollWidth<=(e=0<e?e:0)?this.scrollElement.scrollWidth:e,(this.scrollElement.offsetWidth+this.parent.ganttChartModule.scrollElement.scrollLeft<e||this.scrollElement.scrollLeft>e)&&this.scrollObject.setScrollLeft(e-50,this.parent.enableRtl?-1:0)},i.prototype.mouseUp=function(e){"touchend"===e.type&&(this.initPinchDistance=null,this.isPinching=!1),ne.isNullOrUndefined(this.parent.editModule)||ne.isNullOrUndefined(this.parent.editModule.taskbarEditModule)||this.parent.editModule.taskbarEditModule.removeFalseLine(!1);var t=this.parent.element.querySelector(".e-taskbar-resize-div");ne.isNullOrUndefined(t)||t.remove(),this.parent.allowTaskbarDragAndDrop&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&(this.parent.editModule.taskbarEditModule.previousLeftValue=0),this.parent.allowRowDragAndDrop&&(t=this.parent.element.querySelector(".e-ganttdrag"))&&t.remove(),this.isGanttElement||this.parent.notify("chartMouseUp",e),this.isGanttElement=!1},i.prototype.documentMouseUp=function(e){var t,i,a;"touchend"===e.type&&(this.initPinchDistance=null,this.isPinching=!1,this.previousPinchDistance=0),this.isGanttElement=!0,(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse"))&&!0===ne.getValue("isEditCollapse",this.parent.treeGrid)&&ne.setValue("isEditCollapse",!1,this.parent.treeGrid),this.parent.allowRowDragAndDrop&&(t=this.parent.element.querySelector(".e-ganttdrag"))&&t.remove(),this.parent.isDestroyed||3===e.which||(t=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div"),ne.isNullOrUndefined(t)||t.remove(),t=this.parent.element.getElementsByClassName("e-clone-taskbar")[0],ne.isNullOrUndefined(t)||t.parentElement.parentElement.remove(),t=!1,this.parent.editSettings.allowTaskbarEditing&&ne.getValue("editModule.taskbarEditModule.isMouseDragged",this.parent)&&ne.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)&&(t=!0),this.parent.notify("chartMouseUp",e),this.parent.showActiveElement&&(this.parent.showIndicator=!0,this.focusedElement)&&!e.target.classList.contains("e-split-bar")&&(this.focusedElement.tabIndex=0===this.focusedElement.tabIndex?-1:this.focusedElement.tabIndex,ne.removeClass([this.focusedElement],"e-active-container")),t||(i=e.target,a=e.target.classList.contains(P)||ne.closest(e.target,"."+P),ne.closest(i,".e-gantt-parent-taskbar")&&!this.parent.editSettings.allowEditing?this.chartExpandCollapseRequest(e):!a&&this.parent.autoFocusTasks&&this.scrollToTarget(e)),this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.removeFalseLine(!0),!ne.isNullOrUndefined(this.parent.onTaskbarClick)&&!t&&(i=e.target,a=ne.closest(i,".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone"))&&this.onTaskbarClick(e,i,a))},i.prototype.onTaskbarClick=function(e,t,i){var a,n=ne.closest(t,"tr"),n=(ne.isNullOrUndefined(n)||(a=ne.getValue("rowIndex",n)),this.getRecordByTarget(e));this.parent.trigger("onTaskbarClick",{data:n,taskbarElement:i,rowIndex:a,target:t})},i.prototype.ganttChartLeave=function(e){this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseLeave",e)},i.prototype.ganttChartMove=function(e){var t;if("touchmove"===e.type&&!0===this.isPinching&&e instanceof TouchEvent&&e.touches&&2===e.touches.length&&(t=this.calculatePinchDistance(e.touches[0],e.touches[1]),15<Math.abs(this.previousPinchDistance-t))&&(t>this.previousPinchDistance?this.parent.timelineModule.processZooming(!0):t<this.previousPinchDistance&&this.parent.timelineModule.processZooming(!1),this.previousPinchDistance=t),this.parent.editSettings.allowTaskbarEditing&&!1===this.isPinching){if(0<this.parent.element.getElementsByClassName("e-clone-taskbar").length&&!this.parent.enableRtl)if(("touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?e.changedTouches[0]:e).pageX<=this.parent.getOffsetRect(this.parent.ganttChartModule.chartElement).left)return;this.parent.notify("chartMouseMove",e),!ne.isNullOrUndefined(this.parent.taskFields.dependency)&&this.parent.connectorLineEditModule&&this.parent.connectorLineEditModule.updateConnectorLineEditElement(e)}},i.prototype.contextClick=function(e){this.parent.allowFiltering&&this.parent.filterModule&&this.parent.filterModule.closeFilterOnContextClick(e.srcElement),this.parent.allowTaskbarDragAndDrop&&(e=this.parent.chartPane.querySelector(".e-clone-taskbar"),ne.isNullOrUndefined(e)||e.parentElement.parentElement.remove())},i.prototype.mouseMoveHandler=function(e){if(!ne.isNullOrUndefined(this.parent.onMouseMove)&&(this.parent.flatData.length||e.target.classList.contains("e-header-cell-label")||e.target.classList.contains("e-headercell"))){var t=e.target,i={originalEvent:e},a=ne.closest(t,".e-chart-row-cell,.e-connector-line-container,.e-event-markers,.e-header-cell-label,.e-rowcell,.e-headercell,.e-indicator-span");if(a){var n,r=void 0,s=ne.closest(t,".e-rowcell,.e-chart-row-cell"),o=ne.closest(t,".e-rowcell,.e-headercell");if(s&&(r=this.parent.ganttChartModule.getRecordByTarget(e),i.data=r),o&&(s=ne.getValue("cellIndex",o),i.column=this.parent.treeGrid.columns[s]),ne.closest(t,".e-indicator-span")){var l=0,d=r.ganttProperties.indicators;if(1<d.length)for(l=0;l<d.length&&d[l].name!==a.innerText.trim();l++);i.indicator=d[l]}ne.closest(t,".e-connector-line-container")&&((n={}).target=a,i.predecessor=this.parent.tooltipModule.getPredecessorTooltipData(n)),ne.closest(t,".e-event-markers")&&((n={}).target=a,i.eventMarkers=this.parent.tooltipModule.getMarkerTooltipData(n)),t.classList.contains("e-header-cell-label")&&(i.date=new Date(t.dataset.content))}this.parent.trigger("onMouseMove",i)}},i.prototype.doubleClickHandler=function(e){var t=e.target,i=ne.closest(t,"tr"),a=ne.getValue("rowIndex",i),n=this.parent.ganttChartModule.getRecordByTarget(e),e=(this.parent.editSettings.allowEditing&&0<this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length&&this.parent.treeGrid.endEdit(),this.parent.notify("chartDblClick",e),{row:i,rowData:n,rowIndex:a,target:t});this.recordDoubleClick(e)},i.prototype.recordDoubleClick=function(e){this.parent.trigger("recordDoubleClick",e)},i.prototype.getRecordByTarget=function(e){var t,i=ne.closest(e.target,"div."+P);return ne.isNullOrUndefined(i)?(i=ne.closest(e.target,"tr"))&&(e=ne.getValue("rowIndex",ne.closest(e.target,"tr")),t=this.parent.currentViewData[e]):(e=i.getAttribute("rowUniqueId"),t=this.parent.getRecordByID(e)),t},i.prototype.getChartRows=function(){return null!==document.getElementById(this.parent.element.id+"GanttTaskTableBody")?document.getElementById(this.parent.element.id+"GanttTaskTableBody").querySelectorAll(".e-chart-row"):null},i.prototype.chartExpandCollapseRequest=function(e){var t,i,a;this.parent.enableMultiTaskbar||(i=e.target,t=ne.closest(i,".e-gantt-parent-taskbar"),e=this.getRecordByTarget(e),i=ne.closest(i,"tr"),a=ne.getValue("rowIndex",i),e={data:e,gridRow:this.parent.treeGrid.getRows()[a],chartRow:i,cancel:!1},this.isExpandCollapseFromChart=!0,t.classList.contains("e-row-expand")?this.collapseGanttRow(e):t.classList.contains("e-row-collapse")&&this.expandGanttRow(e))},i.prototype.reRenderConnectorLines=function(){this.parent.connectorLineModule.dependencyViewContainer.innerHTML="",this.parent.connectorLineIds=[],this.parent.updatedConnectorLineCollection=[],this.parent.predecessorModule.createConnectorLinesCollection(),this.parent.connectorLineModule.renderConnectorLines(this.parent.updatedConnectorLineCollection);var e=this.parent.criticalPathModule;this.parent.enableCriticalPath&&e&&e.criticalPathCollection&&e.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds)},i.prototype.collapseGanttRow=function(e){var t=this;this.parent.trigger("collapsing",e,function(e){t.isExpandCollapseFromChart&&!ne.getValue("cancel",e)&&t.collapsedGanttRow(e),t.isExpandCollapseFromChart=!1})},i.prototype.collapsedGanttRow=function(t){var i,e,a=this,n=this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.currentViewData.filter(function(e){return e.ganttProperties[a.parent.taskFields.id]===t.data[a.parent.taskFields.id]})[0]:ne.getValue("data",t);ne.isNullOrUndefined(t.gridRow)&&this.parent.enableVirtualization||ne.isNullOrUndefined(t.chartRow)?n&&(n.expanded=!1):(this.isExpandCollapseFromChart?(this.expandCollapseChartRows("collapse",ne.getValue("chartRow",t),n,null),i=this.parent.taskFields.id,this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(e=this.parent.treeGrid.getCurrentViewRecords().filter(function(e){return e[i]===t.data[i]})[0],this.parent.treeGrid.collapseRow(ne.getValue("gridRow",t),e)):this.parent.treeGrid.collapseRow(ne.getValue("gridRow",t),n),this.isExpandCollapseFromChart=!1):this.expandCollapseChartRows("collapse",ne.getValue("chartRow",t),n,null),"ResourceView"!==this.parent.viewType&&"ProjectView"!==this.parent.viewType||this.renderMultiTaskbar(n),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),ne.getValue("chartRow",t).setAttribute("aria-expanded","false"))},i.prototype.expandGanttRow=function(e){var t=this;this.parent.trigger("expanding",e,function(e){t.isExpandCollapseFromChart&&!ne.getValue("cancel",e)&&t.expandedGanttRow(e),t.isExpandCollapseFromChart=!1})},i.prototype.expandedGanttRow=function(t){var i,e,a=this,n=this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.currentViewData.filter(function(e){return e.ganttProperties.taskId===t.data[a.parent.taskFields.id]})[0]:ne.getValue("data",t);ne.isNullOrUndefined(t.gridRow)&&this.parent.enableVirtualization||ne.isNullOrUndefined(t.chartRow)?n&&(n.expanded=!0):(this.isExpandCollapseFromChart?(this.expandCollapseChartRows("expand",ne.getValue("chartRow",t),n,null),i=this.parent.taskFields.id,this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(e=this.parent.treeGrid.getCurrentViewRecords().filter(function(e){return e[i]===t.data[i]})[0],this.parent.treeGrid.expandRow(ne.getValue("gridRow",t),e)):this.parent.treeGrid.expandRow(ne.getValue("gridRow",t),n),this.isExpandCollapseFromChart=!1):(this.parent.isExpandCollapseLevelMethod||this.expandCollapseChartRows("expand",ne.getValue("chartRow",t),n,null),this.parent.isExpandCollapseLevelMethod=!1),"ResourceView"!==this.parent.viewType&&"ProjectView"!==this.parent.viewType||this.renderMultiTaskbar(n),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),ne.getValue("chartRow",t).setAttribute("aria-expanded","true"))},i.prototype.renderMultiTaskbar=function(e){this.parent.enableMultiTaskbar?this.parent.chartRowsModule.refreshRecords([e],!0):this.parent.showOverAllocation&&this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)},i.prototype.expandCollapseChartRows=function(e,t,i,a){var n;if("expand"===e){n="table-row",a||(i.expanded=!0);for(var r=t.querySelectorAll(".e-row-collapse"),s=0;s<r.length;s++)ne.addClass([r[s]],"e-row-expand"),ne.removeClass([r[s]],"e-row-collapse")}else if("collapse"===e){n="none",a||(i.expanded=!1);for(r=t.querySelectorAll(".e-row-expand"),s=0;s<r.length;s++)ne.addClass([r[s]],"e-row-collapse"),ne.removeClass([r[s]],"e-row-expand")}if(!this.parent.enableVirtualization){for(var o=i.childRecords,l=this.getChartRows(),d=[],h=0;h<l.length;h++)l[h].classList.contains("gridrowtaskId"+i.ganttProperties.rowUniqueID+"level"+(i.level+1))&&d.push(l[h]);for(h=0;h<d.length;h++)d[h].style.display=n,o[h].childRecords&&o[h].childRecords.length&&("collapse"===e||o[h].expanded||this.isExpandAll)&&this.expandCollapseChartRows(e,d[h],o[h],!0)}},i.prototype.expandCollapseAll=function(e){"expand"===e?(this.isExpandAll=!0,this.parent.treeGrid.expandAll()):(this.isCollapseAll=!0,this.parent.treeGrid.collapseAll(),this.isCollapseAll&&!this.parent.allowTaskbarOverlap&&(e=(this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2]:this.parent.element.getElementsByClassName("e-content")[0]).children[0].offsetHeight,this.parent.contentHeight=e,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")),this.isExpandAll=!1,this.isCollapseAll=!1},i.prototype.expandAtLevel=function(e){this.parent.treeGrid.expandAtLevel(e)},i.prototype.collapseAtLevel=function(e){this.parent.enableVirtualization&&(this.parent.isExpandCollapseLevelMethod=!0),this.parent.treeGrid.collapseAtLevel(e)},i.prototype.wireEvents=function(){var t,i=this,e=ne.Browser.isPointer,a=ne.Browser.touchStartEvent,n=ne.Browser.touchEndEvent,r=ne.Browser.touchMoveEvent,e=e?"pointerleave":"mouseleave";ne.EventHandler.add(this.parent.chartPane,a,this.ganttChartMouseDown,this),ne.EventHandler.add(this.parent.chartPane,e,this.ganttChartLeave,this),ne.EventHandler.add(this.parent.chartPane,r,this.ganttChartMove,this),ne.EventHandler.add(this.parent.chartPane,"wheel",this.onWheelZoom,this),this.parent.isAdaptive&&(ne.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"pointerdown",function(e){t?(clearTimeout(t),t=null,i.doubleClickHandler(e)):t=setTimeout(function(){t=null},200)},this),ne.EventHandler.add(this.parent.chartPane,w.click,this.ganttChartMouseClick,this),ne.EventHandler.add(this.parent.chartPane,n,this.ganttChartMouseUp,this)),this.parent.isAdaptive||(ne.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler,this),ne.EventHandler.add(this.parent.element,n,this.documentMouseUp,this),ne.EventHandler.add(document,n,this.mouseUp,this)),ne.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),ne.EventHandler.add(document.body,"contextmenu",this.contextClick,this),ne.EventHandler.add(document,"mouseup",this.contextClick,this)},i.prototype.unWireEvents=function(){var e=ne.Browser.isPointer,t=ne.Browser.touchStartEvent,i=ne.Browser.touchEndEvent,a=ne.Browser.touchMoveEvent,e=e?"pointerleave":"mouseleave";ne.isNullOrUndefined(this.parent.chartRowsModule.ganttChartTableBody)||ne.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,t,this.ganttChartMouseDown),ne.isNullOrUndefined(this.parent.chartPane)||(ne.EventHandler.remove(this.parent.chartPane,e,this.ganttChartLeave),ne.EventHandler.remove(this.parent.chartPane,a,this.ganttChartMove),ne.EventHandler.remove(this.parent.chartPane,"wheel",this.onWheelZoom),ne.EventHandler.remove(this.parent.chartPane,t,this.ganttChartMouseDown)),this.parent.isAdaptive&&!ne.isNullOrUndefined(this.parent.chartPane)&&(ne.EventHandler.remove(this.parent.chartPane,w.click,this.ganttChartMouseClick),ne.EventHandler.remove(this.parent.chartPane,i,this.ganttChartMouseUp)),this.parent.isAdaptive||(ne.isNullOrUndefined(this.parent.element)||ne.EventHandler.remove(this.parent.element,i,this.documentMouseUp),ne.isNullOrUndefined(document))||ne.EventHandler.remove(document,i,this.mouseUp),ne.isNullOrUndefined(this.parent.element)||ne.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),ne.isNullOrUndefined(document)||(ne.EventHandler.remove(document,"mouseup",this.contextClick),ne.isNullOrUndefined(document.body))||ne.EventHandler.remove(document.body,"contextmenu",this.contextClick),ne.isNullOrUndefined(this.parent.chartRowsModule.ganttChartTableBody)||ne.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler)},i.prototype.onWheelZoom=function(t){var i,a;t.ctrlKey&&(t.preventDefault(),i=t.deltaY<0,a=!1,Math.abs(t.deltaY)<75&&(a=!0),this.debounceTimeout&&(this.debounceTimeoutNext+20>this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeoutNext+20<=this.debounceTimeout||!this.debounceTimeoutNext)&&(this.debounceTimeoutNext=this.debounceTimeout),this.debounceTimeout=setTimeout(function(){var e=Math.abs(t.deltaY);(a?.5<e&&e<15:5<e&&e<=200)&&this.parent.timelineModule.processZooming(i)}.bind(this),100))},i.prototype.getRecordByTaskBar=function(e){return this.parent.flatData[this.getIndexByTaskBar(e)]},i.prototype.updateElement=function(e,t,i,a,n){if(this.parent.ganttColumns[parseInt(e.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.progress){for(var r=n.index;n.hasChildRecords&&(e=this.getNextElement(e,i,a)),t=this.parent.ganttColumns[parseInt(e.getAttribute("aria-colindex"),10)-1],r=this.parent.treeGrid.getRows().indexOf(e.parentElement),!t.allowEditing;);this.parent.treeGrid.saveCell(),this.parent.treeGrid.editCell(r,this.parent.ganttColumns[parseInt(e.getAttribute("aria-colindex"),10)-1].field)}return e},i.prototype.onTabAction=function(e){this.parent.treeGrid.grid.enableHeaderFocus=this.parent.enableHeaderFocus;var t=document.getElementsByClassName("e-toolbar-item"),i=this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit;if(this.parent.showActiveElement||i){var a=i?e.target.closest(".e-rowcell"):e.target,n=((a=0<this.parent.element.querySelectorAll(".e-focused").length?this.parent.element.querySelectorAll(".e-focused")[0]:a)&&!(a.classList.contains("e-toolbar-item")||a.classList.contains("e-input")||a.classList.contains("e-btn"))&&(this.currentToolbarIndex=-1),(a.closest(".e-rowcell")||a.closest(".e-chart-row"))&&this.parent.focusModule.setActiveElement(a),this.focusedRowIndex=a.closest(".e-rowcell")?a.parentElement.rowIndex:a.closest(".e-chart-row")?a.closest(".e-chart-row").rowIndex:-1,"tab"===e.action),r=this.getNextElement(a,n,i);if(r&&("noNextRow"===r||r.classList.contains("e-rowdragheader"))&&("noNextRow"===r&&0<this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length&&this.parent.treeGrid.saveCell(),r=null),r&&a.classList.contains("e-headercell")){var s=parseInt(r.getAttribute("aria-colindex"),10)-1;if("shiftTab"===e.action){for(;-1!==s&&!this.parent.treeGrid.columns[s].visible;)s-=1;if(-1!==s)s=this.parent.allowRowDragAndDrop?s+1:s,r=document.getElementsByClassName("e-columnheader")[0].childNodes[s];else for(var o=document.getElementsByClassName("e-toolbar-item").length-1;0<o;o--)if(!document.getElementsByClassName("e-toolbar-item")[o].classList.contains("e-hidden")){r=document.getElementsByClassName("e-toolbar-item")[o],this.currentToolbarIndex=o;break}}else{for(;!this.parent.treeGrid.columns[s].visible;)s+=1;s=this.parent.allowRowDragAndDrop?s+1:s,r=document.getElementsByClassName("e-columnheader")[0].childNodes[s]}}if(!(r=!r&&a.classList.contains("e-headercell")&&"tab"===e.action?document.getElementsByClassName("e-timeline-header-container")[0]:r)&&(a.classList.contains("e-headercell")||a.classList.contains("e-toolbar-item")||a.classList.contains("e-treegrid")||a.classList.contains("e-input")||a.classList.contains("e-btn"))&&this.parent.toolbarModule&&0<this.parent.toolbar.length){var l=-1!==this.currentToolbarIndex?"tab"===e.action?this.currentToolbarIndex+1:this.currentToolbarIndex-1:"shiftTab"===e.action?t.length-1:1,d=!1;if(-1!==l&&("shiftTab"===e.action||"tab"===e.action&&l<t.length))for(;t[l].classList.contains("e-hidden")?"tab"===e.action?l++:l--:((r=t[l]).setAttribute("tabindex","-1"),r.querySelector(".e-btn")===a&&("tab"===e.action?l++:l--,r=t[l]),r.querySelector(".e-btn")&&r.querySelector(".e-btn").setAttribute("tabindex","0"),d=!0,this.currentToolbarIndex=l),!d;);}if("tab"===e.action&&!r&&this.currentToolbarIndex===t.length-1&&(a.classList.contains("e-toolbar-item")||a.classList.contains("e-input")||a.classList.contains("e-btn")))for(o=0;o<this.parent.treeGrid.columns.length;o++)if(this.parent.treeGrid.columns[o].visible){r=document.getElementsByClassName("e-columnheader")[0].childNodes[o];break}if("shiftTab"!==e.action||r||a.classList.contains("e-headercell")||(r=document.getElementsByClassName("e-timeline-header-container")[0]),"shiftTab"===e.action&&a.classList.contains("e-timeline-header-container"))for(o=this.parent.treeGrid.columns.length;0<o;o--)if(this.parent.treeGrid.columns[o-1].visible){r=document.getElementsByClassName("e-columnheader")[0].childNodes[o-1];break}if(this.tempNextElement=r,ne.isNullOrUndefined(r)||ne.isNullOrUndefined(r.cellIndex)||(this.parent.allowRowDragAndDrop?(this.childrenIndex=r.cellIndex,this.nextElementIndex=r.cellIndex-1):(this.childrenIndex=r.cellIndex,this.nextElementIndex=r.cellIndex),-1===this.nextElementIndex||this.parent.ganttColumns[this.nextElementIndex].allowEditing||this.parent.ganttColumns[this.nextElementIndex].field===this.parent.taskFields.id?this.isEditableElement=!1:this.isEditableElement=!0),"noNextRow"===r)this.manageFocus(a,"remove",!0);else if("string"!=typeof r)if(a.closest(".e-chart-row-cell")&&r.closest(".e-rowcell")&&(this.preventScrollIntoView=!0),(a.classList.contains("e-rowcell")||a.closest(".e-chart-row-cell")||a.classList.contains("e-headercell")||a.closest(".e-segmented-taskbar")||a.classList.contains("e-timeline-header-container"))&&e.preventDefault(),n&&a.classList.contains("e-rowdragdrop"))this.parent.treeGrid.grid.notify("key-pressed",e);else{if(a.classList.contains("e-rowcell")&&r&&r.classList.contains("e-rowcell")||a.classList.contains("e-headercell"))if(n){if(this.parent.editSettings.allowNextRowEdit){var h=this.parent.currentViewData[this.focusedRowIndex],p=this.parent.ganttColumns[parseInt(r.getAttribute("aria-colindex"),10)-1].field;h.hasChildRecords?p===this.parent.taskFields.endDate||p===this.parent.taskFields.duration||p===this.parent.taskFields.dependency||p===this.parent.taskFields.progress||p===this.parent.taskFields.work||p===this.parent.taskFields.type||"taskType"===p?(this.parent.treeGrid.grid.endEdit(),this.parent.treeGrid.grid.notify("key-pressed",e)):p===this.parent.taskFields.name||p===this.parent.taskFields.startDate?this.parent.treeGrid.grid.notify("key-pressed",e):(this.parent.treeGrid.grid.notify("key-pressed",e),i&&this.parent.treeGrid.editCell(this.focusedRowIndex,p)):this.parent.treeGrid.grid.notify("key-pressed",e)}else if(!r||!r.classList.contains("e-headercell")&&!r.classList.contains("e-timeline-header-container")){a.classList.contains("e-headercell")&&this.manageFocus(a,"remove",!1);var u=r;if(!(g=this.parent.currentViewData[a.parentElement.rowIndex]).hasChildRecords||this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress&&this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].allowEditing||this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id||!a.classList.contains("e-editedbatchcell"))r&&!a.classList.contains("e-editedbatchcell")||this.parent.treeGrid.grid.notify("key-pressed",e);else{var c=void 0;for(u=this.updateElement(u,c,n,i,g);!this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].allowEditing;)u=this.getNextElement(u,n,i);u=this.updateElement(u,c,n,i,g)}}}else if(r&&!r.classList.contains("e-headercell")&&r.classList.contains("e-rowcell")&&!r.classList.contains("e-toolbar-item")){var g,u=r;if(!(g=this.parent.currentViewData[a.parentElement.rowIndex]).hasChildRecords||this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress&&this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].allowEditing||this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id||!a.classList.contains("e-editedbatchcell"))if(parseInt(u.parentElement.getAttribute("aria-rowindex"),10)-1!=0&&parseInt(u.getAttribute("aria-colindex"),10)-1==0&&this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].field===this.parent.taskFields.id&&a.classList.contains("e-editedbatchcell")){var f=a.parentElement.rowIndex,p=this.getNextRowElement(f,n,!0);if(u=this.getChildElement(p,n),!(h=this.parent.flatData[parseInt(p.getAttribute("aria-rowindex"),10)-1]).hasChildRecords||this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].allowEditing&&this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].field!==this.parent.taskFields.progress)this.parent.treeGrid.grid.notify("key-pressed",e);else{c=void 0;for(u=this.updateElement(u,c,n,i,h);!this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].allowEditing;)u=this.getNextElement(u,n,i);u=this.updateElement(u,c,n,i,h)}}else this.parent.treeGrid.grid.notify("key-pressed",e);else{var c=void 0;for(u=this.updateElement(u,c,n,i,g);!this.parent.ganttColumns[parseInt(u.getAttribute("aria-colindex"),10)-1].allowEditing;)u=this.getNextElement(u,n,i);u=this.updateElement(u,c,n,i,g)}}0<this.parent.element.querySelectorAll(".e-focused").length&&this.manageFocus(this.parent.element.querySelectorAll(".e-focused")[0],"remove",!1),this.parent.editModule&&this.parent.editModule.cellEditModule&&!ne.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn)||r&&(a.classList.contains("e-rowcell")?this.manageFocus(a,"remove",!1):this.manageFocus(a,"remove",!0),r.classList.contains("e-rowcell")&&a.nextElementSibling&&!a.classList.contains("e-timeline-header-container")||a.classList.contains("e-right-label-container")?(a.classList.contains("e-rowcell")||(this.parent.treeGrid.grid.notify("key-pressed",e),(p=ne.getValue("focusModule",this.parent.treeGrid.grid)).currentInfo.element=r,p.currentInfo.elementToFocus=r,p.content.matrix.current=[r.parentElement.rowIndex,r.cellIndex],this.parent.selectionModule&&(f=this.parent.enableVirtualization?this.parent.currentViewData[r.parentElement.rowIndex].index:r.parentElement.rowIndex,this.parent.selectionModule.selectRow(f),"Cell"!==this.parent.selectionSettings.mode)&&0<(h=this.parent.selectionModule.getSelectedRows()).length&&0<(c=h[0].querySelectorAll(".e-focus, .e-focused")).length&&ne.removeClass([c[0]],["e-focus","e-focused"])),this.manageFocus(r,"add",!1)):r&&(r.classList.contains("e-toolbar-item")||r.classList.contains("e-headercell")||r.classList.contains("e-rowcell"))?(this.manageFocus(a,"remove",!1),r.classList.contains("e-toolbar-item")||this.manageFocus(r,"add",!1),a.classList.contains("e-treegrid")&&e.preventDefault()):this.manageFocus(r,"add",!0),this.parent.focusModule.setActiveElement(r))}}},i.prototype.getNextElement=function(e,t,i){if(e.classList.contains("e-timeline-header-container")&&t)return r=this.getNextRowElement(-1,t,!0),this.getChildElement(r,t);var a=t?e.nextElementSibling:e.previousElementSibling;if(e.parentElement.classList.contains("e-taskbar-main-container")){if(this.parent.labelSettings.rightLabel&&t)return e.parentElement.nextElementSibling;if(!t&&this.parent.labelSettings.leftLabel)return e.parentElement.previousElementSibling}for(;a&&a.parentElement.classList.contains("e-row");){if(!a.matches(".e-hide")&&!a.matches(".e-rowdragdrop"))return a;a=t?a.nextElementSibling:a.previousElementSibling}if(ne.isNullOrUndefined(a)||!a.classList.contains("e-taskbar-main-container")&&!a.classList.contains("e-right-connectorpoint-outer-div")||(n=this.parent.currentViewData[this.focusedRowIndex],!ne.isNullOrUndefined(n.ganttProperties.segments)&&0<n.ganttProperties.segments.length&&(a=a.classList.contains("e-right-connectorpoint-outer-div")?a.parentElement.nextElementSibling:a.getElementsByClassName("e-gantt-child-taskbar-inner-div")[0])),this.validateNextElement(a))return a;var n=-1,r=null;if(e.classList.contains("e-rowcell")&&i&&this.parent.editSettings.allowNextRowEdit)return n=e.parentElement.rowIndex,r=this.getNextRowElement(n,t,!0),this.getChildElement(r,t);if(e.classList.contains("e-rowcell"))if(n=e.parentElement.rowIndex,t){if(r=this.parent.getRowByIndex(n),0<this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length)return r=this.getNextRowElement(n,t,!0),this.getChildElement(r,t);if(this.validateNextElement(r,"e-left-label-container"))return r.getElementsByClassName("e-left-label-container")[0];if(this.validateNextElement(r,"e-taskbar-main-container"))return r.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(r,"e-right-label-container"))return r.getElementsByClassName("e-right-label-container")[0]}else{if(r=this.getNextRowElement(n,t,!1),this.validateNextElement(r,"e-right-label-container"))return r.getElementsByClassName("e-right-label-container")[0];if(this.validateNextElement(r,"e-taskbar-main-container"))return r.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(r,"e-left-label-container"))return r.getElementsByClassName("e-left-label-container")[0]}else if(e.parentElement.classList.contains("e-chart-row-cell")||e.parentElement.parentElement.classList.contains("e-chart-row-cell"))return n=ne.closest(e,".e-chart-row").rowIndex,r=t?(!t&&this.parent.virtualScrollModule&&this.parent.enableVirtualization&&(i=this.parent.currentViewData[n],n=this.parent.flatData.indexOf(i)),this.getNextRowElement(n,t,!0)):this.parent.treeGrid.getRows()[n],this.getChildElement(r,t);return a=e,null},i.prototype.getNextRowElement=function(e,t,i){var a=this.parent.getExpandedRecords(this.parent.currentViewData),e=this.parent.currentViewData[e],e=a.indexOf(e),t=t?a[e+1]:a[e-1],a=this.parent.currentViewData.indexOf(t);return t?i?this.parent.treeGrid.getRows()[a]:this.parent.getRowByIndex(a):null},i.prototype.validateNextElement=function(e,t){return!((!e||!e.classList.contains("e-rowcell"))&&(e&&t?!(t=e.getElementsByClassName(t)[0])||!t.hasChildNodes():!e||ne.isNullOrUndefined(e)||!e.hasChildNodes()))},i.prototype.getChildElement=function(e,t){var i;if(!e)return"noNextRow";for(i=t?e.children[0]:e.children[e.children.length-1];i;){if(!i.matches(".e-hide")&&!i.matches(".e-rowdragdrop"))return i;i=t?i.nextElementSibling:i.previousElementSibling}return i},i.prototype.manageFocus=function(e,t,i,a){var n;i?(i=null,e.classList.contains("e-left-label-container")||e.classList.contains("e-right-label-container")?i=e.getElementsByTagName("span")[0]:(e.classList.contains("e-taskbar-main-container")||e.classList.contains("e-gantt-child-taskbar-inner-div"))&&(n=ne.closest(e,".e-chart-row").rowIndex,n=(n=this.parent.currentViewData[n]).hasChildRecords?n.ganttProperties.isAutoSchedule?"e-gantt-parent-taskbar":"e-manualparent-main-container":n.ganttProperties.isMilestone?"e-gantt-milestone":!ne.isNullOrUndefined(n.ganttProperties.segments)&&0<n.ganttProperties.segments.length?"e-segmented-taskbar":"e-gantt-child-taskbar",i=e.getElementsByClassName(n)[0],ne.isNullOrUndefined(i))&&(i=e),(e.classList.contains("e-right-label-temp-container")||e.classList.contains("e-left-label-temp-container")||e.classList.contains("e-indicator-span")||e.classList.contains("e-timeline-header-container"))&&("add"===t?(e.setAttribute("tabIndex","0"),ne.addClass([e],"e-active-container"),e.focus()):"downArrow"!==a&&"upArrow"!==a&&(ne.removeClass([e],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur())),"add"!==t||ne.isNullOrUndefined(i)?ne.isNullOrUndefined(i)||"downArrow"===a||"upArrow"===a||(ne.removeClass([i],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur()):(e.setAttribute("tabIndex","0"),ne.addClass([i],"e-active-container"),e.focus(),this.focusedElement=i)):"add"===t?(e.setAttribute("tabIndex","0"),ne.addClass([e],["e-focused","e-focus"]),this.preventScrollIntoView||e.scrollIntoView({block:"nearest",inline:"nearest"}),this.preventScrollIntoView=!1,e.focus()):(e.setAttribute("tabIndex","-1"),ne.removeClass([e],["e-focused","e-focus"]),e.blur())},i.prototype.getIndexByTaskBar=function(e){var t=e.classList.contains(P)?e:ne.closest(e,"div."+P);return ne.isNullOrUndefined(t)?(t=ne.closest(e,"tr."+Oe),[].slice.call(this.parent.chartRowsModule.ganttChartTableBody.childNodes).indexOf(t)):(e=t.getAttribute("rowUniqueId"),t=this.parent.getRecordByID(e),(!this.parent.enableVirtualization||!this.parent.enableMultiTaskbar)&&this.parent.pdfExportModule&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth&&this.parent.pdfExportModule.isPdfExport?this.parent.ids.indexOf(t.ganttProperties.taskId.toString()):this.parent.flatData.indexOf(t))},i.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.chartElement=null,this.rangeViewContainer=null,this.chartBodyContent=null,this.scrollElement=null,this.chartTimelineContainer=null,this.chartBodyContainer=null,ne.isNullOrUndefined(this.scrollObject)||(this.scrollObject.destroy(),this.scrollObject=null)};var Rt=i;function i(e){this.isExpandCollapseFromChart=!1,this.isExpandAll=!1,this.isCollapseAll=!1,this.debounceTimeoutNext=0,this.debounceTimeout=0,this.isGanttElement=!1,this.previousPinchDistance=0,this.currentToolbarIndex=-1,this.isPinching=!1,this.preventScrollIntoView=!1,this.parent=e,this.chartTimelineContainer=null,this.rangeViewContainer=ne.createElement("div",{className:bt}),this.rangeViewContainer.setAttribute("role","button"),this.rangeViewContainer.setAttribute("aria-label","RangeContainer"),this.virtualRender=new Pt(this.parent),this.addEventListener()}var Mt=function(){return(Mt=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Ot=(a.prototype.initProperties=function(){this.timelineStartDate=null,this.timelineEndDate=null,this.totalTimelineWidth=0,this.customTimelineSettings=null,this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!ne.isNullOrUndefined(this.parent.projectStartDate),this.parent.enablePersistence&&this.parent.isLoad&&(this.parent.timelineSettings=this.parent.currentZoomingLevel)},a.prototype.validateTimelineProp=function(){this.roundOffDays(),this.processTimelineProperty(),this.timelineWidthCalculation()},a.prototype.refreshTimeline=function(){this.initProperties(),this.processTimelineUnit(),this.parent.undoRedoModule&&(!this.parent.undoRedoModule||this.parent.undoRedoModule.isZoomingUndoRedoProgress)||this.parent.dataOperation.calculateProjectDates(),this.parent.isFromOnPropertyChange||this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff);var e=this.parent.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight;this.parent.element.getElementsByClassName("e-gridcontent")[0].style.height="calc(100% - "+e+"px)",this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].style.height="calc(100% - "+e+"px)"},a.prototype.refreshTimelineByTimeSpan=function(){this.validateTimelineProp(),(!this.parent.pdfExportModule||this.parent.pdfExportModule&&!this.parent.pdfExportModule.isPdfExport||this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&!this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth)&&(this.parent.ganttChartModule.chartTimelineContainer.innerHTML=""),this.createTimelineSeries()},a.prototype.updateChartByNewTimeline=function(){this.parent.chartRowsModule.refreshChartByTimeline();var e=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollLeft;this.parent.element.getElementsByClassName("e-timeline-header-container")[0].scrollLeft=e,this.parent.notify("refreshDayMarkers",{})},a.prototype.processZooming=function(e){this.parent.isReact&&this.parent.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.isZoomToFit=this.isZoomedToFit=!1,this.updateUndoRedo(e),this.parent.isProjectDateUpdated||this.parent.dateValidationModule.calculateProjectDates(),this.parent.zoomingProjectStartDate&&(this.parent.cloneProjectStartDate=this.parent.zoomingProjectStartDate,this.parent.cloneProjectEndDate=this.parent.zoomingProjectEndDate),this.parent.zoomingProjectStartDate=this.parent.zoomingProjectEndDate=null;var t=this.checkCurrentZoomingLevel(),i=(this.isZoomIn=e,this.isZooming=!0,this.getZoomLevel(t,e)),i=(this.updateToolbar(i,e),this.parent.zoomingLevels.findIndex(function(e){return e.level===i})),t={requestType:e?"beforeZoomIn":"beforeZoomOut",timeline:this.parent.zoomingLevels[i],cancel:!1};this.parent.trigger("actionBegin",t),t.cancel||(this.parent.showLoadingIndicator(),this.changeTimelineSettings(t.timeline)),this.isZooming=!1},a.prototype.updateUndoRedo=function(e){var e=e?"ZoomIn":"ZoomOut";this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent(e)&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(e={action:e,previousZoomingLevel:ne.extend({},{},this.parent.currentZoomingLevel,!0)}).previousZoomingLevel.bottomTier.format=this.customTimelineSettings.bottomTier.format,e.previousZoomingLevel.topTier.format=this.customTimelineSettings.topTier.format,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e)},a.prototype.getZoomLevel=function(e,t){var i=e+(t?1:-1);return this.parent.zoomingLevels.find(function(e){return e.level===i})?i:e},a.prototype.updateToolbar=function(e,t){this.parent.toolbarModule&&(t?(e===this.parent.zoomingLevels[this.parent.zoomingLevels.length-1].level&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1),this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!0)):(e===this.parent.zoomingLevels[0].level&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1),this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!0)))},a.prototype.changeTimelineSettings=function(i){var a=this,n=(this.isZoomToFit?this.isSingleTier="None"===this.customTimelineSettings.topTier.unit||"None"===this.customTimelineSettings.bottomTier.unit:this.isZoomIn||(this.isSingleTier="None"===i.topTier.unit||"None"===i.bottomTier.unit),this.isSingleTier?"None"===this.customTimelineSettings.topTier.unit?"topTier":"bottomTier":null),e=(Object.keys(this.customTimelineSettings).forEach(function(e){var t;e!==n?a.customTimelineSettings[e]="object"!=typeof i[e]||ne.isNullOrUndefined(i[e])?i[e]:Mt({},i[e]):"None"!==i[t="bottomTier"].unit&&(a.customTimelineSettings["topTier"===e?"bottomTier":"topTier"]=Mt({},i[t]))}),this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!ne.isNullOrUndefined(this.parent.projectStartDate),this.processTimelineUnit(),this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff),this.parent.criticalPathModule),e=(this.parent.enableCriticalPath&&e&&e.criticalPathCollection&&e.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds),(this.isZooming||this.isZoomToFit)&&(e={requestType:this.isZoomIn?"AfterZoomIn":this.isZoomToFit?"AfterZoomToProject":"AfterZoomOut",timeline:this.parent.currentZoomingLevel},this.parent.trigger("actionComplete",e),this.parent.hideLoadingIndicator()),"None"===this.topTier?"bottomTier":"topTier");this.parent.enableTimelineVirtualization&&(!this.parent.pdfExportModule||this.parent.pdfExportModule&&!this.parent.pdfExportModule.isPdfExport)&&(this.wholeTimelineWidth=this.calculateWidthBetweenTwoDate(e,this.parent.timelineModule.timelineStartDate,this.parent.timelineModule.timelineEndDate),this.wholeTimelineWidth<=this.totalTimelineWidth&&(this.wholeTimelineWidth=this.totalTimelineWidth),this.isZoomToFit?(this.clientWidthDifference=Math.abs(this.wholeTimelineWidth-this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].clientWidth)+1,this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth-this.clientWidthDifference+"px",ne.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack"))||(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth-this.clientWidthDifference+"px")):(this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth+"px",ne.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack"))||(this.parent.element.querySelectorAll(".e-timeline-header-container")[0].querySelector(".e-virtualtrack").style.width=this.wholeTimelineWidth+"px")),this.parent.ganttChartModule.updateWidthAndHeight())},a.prototype.processZoomToFit=function(){this.parent.isReact&&this.parent.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.isZoomToFit=!0,this.isZooming=!1,this.isZoomedToFit=!0;var e={},e=(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("ZoomToFit")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),e.action="ZoomToFit",e.previousTimelineStartDate=ne.extend([],[],[this.parent.cloneProjectStartDate],!0)[0],e.previousTimelineEndDate=ne.extend([],[],[this.parent.cloneProjectEndDate],!0)[0],e.previousZoomingLevel=ne.extend({},{},this.parent.currentZoomingLevel,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e),this.parent.zoomingProjectStartDate||(this.parent.zoomingProjectStartDate=this.parent.cloneProjectStartDate,this.parent.zoomingProjectEndDate=this.parent.cloneProjectEndDate),this.parent.zoomingProjectStartDate>this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=new Date(this.parent.allowUnscheduledTasks?this.parent.zoomingProjectStartDate:this.parent.cloneProjectStartDate)),ne.isNullOrUndefined(this.parent.projectStartDate)&&ne.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.dataOperation.calculateProjectDates(),0);this.parent.timelineSettings.showWeekend||(e=this.calculateNonWorkingDaysBetweenDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate));var t,i,a,n=(this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5,r=this.parent.ganttChartModule.chartElement.offsetWidth,s=r/(n-=e),o=this.parent.zoomingLevels.slice().sort(function(e,t){return e.perDayWidth||t.perDayWidth?e.perDayWidth<t.perDayWidth?1:-1:0});if(0!=s){for(var l=0;l<o.length;l++){if(i=o[l],l===o.length-1){t=o[l];break}if(a=o[l+1],s>=i.perDayWidth){t=o[l];break}if(s<i.perDayWidth&&s>a.perDayWidth){t=o[l+1];break}}var e=ne.extend({},{},t,!0),n=(ne.isNullOrUndefined(this.parent.projectStartDate)&&this.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,s,e.bottomTier.unit,t),ne.isNullOrUndefined(this.parent.projectEndDate)&&this.roundOffDateToZoom(this.parent.cloneProjectEndDate,!1,s,e.bottomTier.unit,t),this.calculateNumberOfTimelineCells(e)),d=this.parent.ganttChartModule.scrollElement.offsetHeight-17,h=this.parent.ganttChartModule.chartBodyContent.offsetHeight,r=(e.timelineUnitSize=Math.abs(r-(h<=d?0:17))/n,{requestType:"beforeZoomToProject",timeline:e});this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin",this.parent.controlId+"_zoomout"],!0),this.parent.trigger("actionBegin",r),r.cancel||(this.parent.showLoadingIndicator(),this.changeTimelineSettings(e),this.parent.isTimelineRoundOff=!!ne.isNullOrUndefined(this.parent.projectStartDate)),this.isZoomToFit=!1}},a.prototype.bottomTierCellWidthCalc=function(e,t,i){switch(e){case"Minutes":n=6e4*t.bottomTier.count;break;case"Hour":n=36e5*t.bottomTier.count;break;case"Week":n=6048e5*t.bottomTier.count;break;case"Day":n=864e5*t.bottomTier.count;break;case"Month":var a=new Date(i.getFullYear(),i.getMonth()+1,0).getDate(),n=t.bottomTier.count*(86400*a*1e3);break;case"Year":a=i.getFullYear()%400==0||i.getFullYear()%100!=0&&i.getFullYear()%4==0?366:365;n=t.bottomTier.count*(86400*a*1e3)}return n},a.prototype.roundOffDateToZoom=function(e,t,i,a,n){a=this.bottomTierCellWidthCalc(a,n,e);t?e.setTime(e.getTime()-a):e.setTime(e.getTime()+a)},a.prototype.calculateNumberOfTimelineCells=function(e){var t=new Date(this.parent.cloneProjectStartDate.getTime()),i=new Date(this.parent.cloneProjectEndDate.getTime()),a=(this.parent.dateValidationModule.updateDateWithTimeZone(t,i),0),t=(this.parent.timelineSettings.showWeekend||(a=this.calculateNonWorkingDaysBetweenDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate)),i=Math.abs((i.getTime()-t.getTime())/864e5),i-=a,e.bottomTier.count),a=e.bottomTier.unit;return"Day"===a?i/t:"Week"===a?i/t/7:"Month"===a?i/t/28:"Year"===a?i/t/336:"Hour"===a?24/t*i:1440/t*i},a.prototype.processTimelineUnit=function(){var e=["Year","Month","Week","Day","Hour","Minutes"];this.customTimelineSettings=this.customTimelineSettings||this.extendFunction(this.parent.timelineSettings,["timelineViewMode","timelineUnitSize","weekStartDay","weekendBackground"],{topTier:["unit","format","count","formatter"],bottomTier:["unit","format","count","formatter"]}),-1===e.indexOf(this.customTimelineSettings.topTier.unit)&&-1===e.indexOf(this.customTimelineSettings.bottomTier.unit)?(this.customTimelineSettings.topTier.unit=-1!==e.indexOf(this.customTimelineSettings.timelineViewMode)?this.customTimelineSettings.timelineViewMode:"Week",this.customTimelineSettings.bottomTier.unit=5!==e.indexOf(this.customTimelineSettings.topTier.unit)?e[e.indexOf(this.customTimelineSettings.topTier.unit)+1]:"None"):-1!==e.indexOf(this.customTimelineSettings.topTier.unit)&&-1!==e.indexOf(this.customTimelineSettings.bottomTier.unit)&&e.indexOf(this.customTimelineSettings.topTier.unit)>e.indexOf(this.customTimelineSettings.bottomTier.unit)?this.customTimelineSettings.bottomTier.unit=this.customTimelineSettings.topTier.unit:(this.customTimelineSettings.topTier.unit=-1===e.indexOf(this.customTimelineSettings.topTier.unit)?"None":this.customTimelineSettings.topTier.unit,this.customTimelineSettings.bottomTier.unit=-1===e.indexOf(this.customTimelineSettings.bottomTier.unit)?"None":this.customTimelineSettings.bottomTier.unit),this.topTier=this.customTimelineSettings.topTier.unit,this.bottomTier=this.customTimelineSettings.bottomTier.unit,this.previousIsSingleTier=this.isSingleTier,this.isSingleTier="None"===this.topTier||"None"===this.bottomTier},a.prototype.processTimelineProperty=function(){this.customTimelineSettings.topTier.count="None"===this.topTier?1:this.validateCount(this.customTimelineSettings.topTier.unit,this.customTimelineSettings.topTier.count,"topTier"),this.customTimelineSettings.bottomTier.count="None"===this.customTimelineSettings.bottomTier.unit?1:this.validateCount(this.customTimelineSettings.bottomTier.unit,this.customTimelineSettings.bottomTier.count,"bottomTier"),this.customTimelineSettings.bottomTier.format=this.validateFormat(this.customTimelineSettings.bottomTier.unit,this.customTimelineSettings.bottomTier.format),this.customTimelineSettings.topTier.format=this.validateFormat(this.topTier,this.customTimelineSettings.topTier.format),this.customTimelineSettings.weekStartDay=0<=this.customTimelineSettings.weekStartDay&&this.customTimelineSettings.weekStartDay<=6?this.customTimelineSettings.weekStartDay:0,this.parent.pdfExportModule&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth||this.checkCurrentZoomingLevel()},a.prototype.calculateZoomingLevelsPerDayWidth=function(){for(var e=this.parent.zoomingLevels,t=0;t<e.length;t++){var i=this.getPerDayWidth(e[t].timelineUnitSize,e[t].bottomTier.count,e[t].bottomTier.unit);e[t].perDayWidth=i}},a.prototype.checkCurrentZoomingLevel=function(){var e=("None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier:this.customTimelineSettings.topTier).count,t=("None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier:this.customTimelineSettings.topTier).unit,i="None"!==this.customTimelineSettings.bottomTier.unit?"bottomTier":"topTier",t=this.getCurrentZoomingLevel(t,e,i);return this.parent.toolbarModule&&(t===this.parent.zoomingLevels[this.parent.zoomingLevels.length-1].level?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):t===this.parent.zoomingLevels[0].level&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),this.parent.currentZoomingLevel=this.parent.zoomingLevels[t],t},a.prototype.getCurrentZoomingLevel=function(t,e,i){this.parent.zoomingLevels.length||(this.parent.zoomingLevels=this.parent.getZoomingLevels());for(var a,n,r,s,o,l,d=this.parent.zoomingLevels.filter(function(e){return"bottomTier"===i?e.bottomTier.unit===t:e.topTier.unit===t}),h=(0===d.length&&(l=this.getClosestUnit(t,"",!1),d=this.parent.zoomingLevels.filter(function(e){return"bottomTier"===i?e.bottomTier.unit===l:e.topTier.unit===l})),d.sort(function(e,t){return"bottomTier"===i?e.bottomTier.count&&t.bottomTier.count?e.bottomTier.count<t.bottomTier.count?1:-1:0:e.topTier.count&&t.topTier.count?e.topTier.count<t.topTier.count?1:-1:0})),p=0;p<h.length;p++){if(o=h[p],p===h.length-1){a=h[p].level;break}if(s=h[p+1],e>=o[""+i].count){n=h[p],a=1<(r=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===n.bottomTier.count:e.topTier.count===n.topTier.count})).length?this.checkCollectionsWidth(r):r[0].level;break}if(e<o[""+i].count&&e>s[""+i].count){n=h[p+1],a=1<(r=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===n.bottomTier.count:e.topTier.count===n.topTier.count})).length?this.checkCollectionsWidth(r):r[0].level;break}}return a},a.prototype.getClosestUnit=function(t,e,i){var a=["Year","Month","Week","Day","Hour","Minutes"],n=a.indexOf(t);return 0===n&&(i=!0),t=this.isZoomIn||i?a[n+1]:a[n-1],0===this.parent.zoomingLevels.filter(function(e){return e.bottomTier.unit===t}).length?("Year"===t&&(i=!0),e=t,this.getClosestUnit(t,e,i)):t},a.prototype.checkCollectionsWidth=function(e){for(var t,i,a,n=this.customTimelineSettings.timelineUnitSize,r=e.sort(function(e,t){return e.timelineUnitSize<t.timelineUnitSize?1:-1}),s=0;s<r.length;s++){if(a=r[s],s===r.length-1){t=r[s].level;break}if(i=r[s+1],n>=a.timelineUnitSize){t=r[s].level;break}if(n<a.timelineUnitSize&&n>i.timelineUnitSize){t=r[s+1].level;break}}return t},a.prototype.updateTimelineHeaderHeight=function(){var e;this.parent.timelineModule.isSingleTier?this.parent.element.classList.add(le):this.parent.element.classList.remove(le),this.previousIsSingleTier!==this.isSingleTier&&(e=0,ne.isNullOrUndefined(this.parent.toolbarModule)||ne.isNullOrUndefined(this.parent.toolbarModule.element)||(e=this.parent.toolbarModule.element.offsetHeight),this.parent.ganttChartModule.scrollObject.setHeight(this.parent.ganttHeight-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight-e),this.parent.treeGrid.height=this.parent.ganttHeight-e-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight)},a.prototype.dateByLeftValue=function(e,t,i){var a=new Date(this.parent.timelineModule.timelineStartDate.toString()),n=864e5/this.parent.perDayWidth,e=(this.parent.timelineSettings.showWeekend?a.setTime(a.getTime()+e*n):a=this.calculateDateExcludingNonWorkingDays(e,a),t&&!ne.isNullOrUndefined(i.predecessorsName)&&""!==i.predecessorsName&&(a.setDate(a.getDate()-1),n=this.parent.getCurrentDayEndTime(i.isAutoSchedule?i.autoEndDate:i.endDate),this.parent.dateValidationModule.setTime(n,a),a=this.parent.dateValidationModule.checkStartDate(a,i,!0)),"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier);return"Hour"!==e&&"Minutes"!==e&&(this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString()))&&!this.parent.isInDst(a)?a.setTime(a.getTime()+36e5):!this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString()))&&this.parent.isInDst(a)&&a.setTime(a.getTime()-36e5)),a},a.prototype.calculateDateExcludingNonWorkingDays=function(e,t){for(var i=864e5/this.parent.perDayWidth,a=this.parent.nonWorkingDayIndex,e=Math.ceil(e*i/864e5),i=7-a.length,n=Math.floor(e/i),r=e%i,s=new Date(t),o=(s.setDate(s.getDate()+7*n),0);o<r;)s.setDate(s.getDate()+1),-1===a.indexOf(s.getDay())&&o++;return s},a.prototype.createTimelineSeries=function(){var e,t,i,a,n,r=this.isSingleTier?1:2,s="None"===this.topTier?"bottomTier":"topTier";if(this.topTierCollection=[],this.bottomTierCollection=[],!0===this.restrictRender&&(this.updateTimelineHeaderHeight(),this.wholeTimelineWidth=this.calculateWidthBetweenTwoDate(s,this.parent.timelineModule.timelineStartDate,this.parent.timelineModule.timelineEndDate)),this.parent.enableTimelineVirtualization&&this.wholeTimelineWidth>3*this.parent.element.offsetWidth){for(var o=0;o<r;o++){(i=ne.createElement("table",{className:ge,styles:"display: block;"})).setAttribute("role","none");var l=ne.createElement("thead",{className:fe,styles:"display:block; border-collapse:collapse"}),d=this.createTimelineTemplate(s),h=ne.createElement("tr");Array.from(d.childNodes).forEach(function(e){h.appendChild(e)}),e=ne.createElement("td"),t=ne.createElement("div",{styles:"width: 20px"}),a=ne.createElement("div",{className:"e-virtualtable"}),n=ne.createElement("div",{className:"e-virtualtrack"}),e.appendChild(t),h.appendChild(e),a.appendChild(h),l.appendChild(a),l.appendChild(n),i.appendChild(l),this.parent.ganttChartModule.chartTimelineContainer.appendChild(i),h=null,this.restrictRender=!(s="bottomTier")}this.timelineVirtualizationStyles()}else{for(o=0;o<r;o++){(i=ne.createElement("table",{className:ge,styles:"display: block;"})).setAttribute("role","none"),l=ne.createElement("thead",{className:fe,styles:"display:block; border-collapse:collapse"});d=this.createTimelineTemplate(s);h=ne.createElement("tr"),Array.from(d.childNodes).forEach(function(e){h.appendChild(e)}),e=ne.createElement("td"),t=ne.createElement("div",{styles:"width: 20px"}),e.appendChild(t),h.appendChild(e),l.appendChild(h),i.appendChild(l),this.parent.ganttChartModule.chartTimelineContainer.appendChild(i),s="bottomTier",h=null}this.wholeTimelineWidth=this.totalTimelineWidth}},a.prototype.timelineVirtualizationStyles=function(){var e,t,i=0,a=this.wholeTimelineWidth;this.parent.enableTimelineVirtualization&&(i=this.parent.enableTimelineVirtualization&&!ne.isNullOrUndefined(this.parent.ganttChartModule.scrollObject.element.scrollLeft)&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():0,this.parent.enableRtl&&(i=-i),e=this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtable"),this.parent.undoRedoModule&&(!this.parent.undoRedoModule||this.parent.undoRedoModule.isZoomingUndoRedoProgress)||(e.style.transform="translate("+i+"px, 0px)"),(e=this.parent.element.querySelectorAll(".e-chart-scroll-container")[0].querySelector(".e-virtualtrack")).style.position="relative",e.style.width=a+"px",this.parent.ganttChartModule.scrollObject.isSetScrollLeft&&(e=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[0].querySelector(".e-virtualtable"),t=void 0,ne.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1])||(t=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1].querySelector(".e-virtualtable")),e.style.transform="translate("+i+"px, 0px)",ne.isNullOrUndefined(t)||(t.style.transform="translate("+i+"px, 0px)")),e=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[0].querySelector(".e-virtualtrack"),t=void 0,ne.isNullOrUndefined(this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1])||(t=this.parent.element.querySelectorAll(".e-timeline-header-table-container")[1].querySelector(".e-virtualtrack")),ne.isNullOrUndefined(t)||(t.style.position="relative",t.style.width=a+"px"),e.style.position="relative",e.style.width=a+"px",this.parent.connectorLineModule.svgObject.style.width=a+"px",this.parent.element.querySelector("."+ce).style.width="calc(100% - 17px)",this.parent.timelineModule.isZooming||this.parent.timelineModule.isZoomToFit)&&(this.parent.ganttChartModule.scrollElement.scrollLeft=0,this.isZoomingAction=!0,this.parent.ganttChartModule.scrollObject.updateChartElementStyles())},a.prototype.validateCount=function(e,t,i){var a,n=!ne.isNullOrUndefined(t)&&0<parseInt(t.toString(),10)?parseInt(t.toString(),10):1,r=Math.abs(this.timelineRoundOffEndDate.getTime()-this.timelineStartDate.getTime());switch(e){case"Year":n=n<=(a=Math.round(r/864e5/336))?n:0<a?a:1,"None"!==this.topTier&&"bottomTier"===i&&(n=this.validateBottomTierCount(e,n));break;case"Month":n=n<=(a=Math.round(r/864e5/28))?n:0<a?a+1:1,"None"!==this.topTier&&"bottomTier"===i&&(n=this.validateBottomTierCount(e,n));break;case"Week":n=n<=(a=Math.round(r/864e5/7))?n:0<a?a:1,"None"!==this.topTier&&"bottomTier"===i&&(n=this.validateBottomTierCount(e,n));break;case"Day":n=n<=(a=Math.round(r/864e5))?n:0<a?a:1,"None"!==this.topTier&&"bottomTier"===i&&(n=this.validateBottomTierCount(e,n));break;case"Hour":n=n<=(a=Math.round(r/36e5))?n:0<a?a:1,"None"!==this.topTier&&"bottomTier"===i&&(n=this.validateBottomTierCount(e,n));break;case"Minutes":n=n<=(a=Math.round(r/6e4))?n:0<a?a:1,"None"!==this.topTier&&"bottomTier"===i&&(n=this.validateBottomTierCount(e,n))}return t!==n&&this.isZooming&&this.parent.toolbarModule&&("bottomTier"===i||this.isSingleTier)&&(this.isZoomIn?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),n},a.prototype.validateBottomTierCount=function(e,t){var i;switch(e){case"Year":i=t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Month":i="Year"===this.topTier?t<=12*this.customTimelineSettings.topTier.count?t:12*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Week":i="Year"===this.topTier?t<=48*this.customTimelineSettings.topTier.count?t:48*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=4*this.customTimelineSettings.topTier.count?t:4*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Day":i="Year"===this.topTier?t<=336*this.customTimelineSettings.topTier.count?t:336*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=28*this.customTimelineSettings.topTier.count?t:28*this.customTimelineSettings.topTier.count:"Week"===this.topTier?t<=7*this.customTimelineSettings.topTier.count?t:7*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Hour":i="Year"===this.topTier?t<=8064*this.customTimelineSettings.topTier.count?t:8064*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=672*this.customTimelineSettings.topTier.count?t:672*this.customTimelineSettings.topTier.count:"Week"===this.topTier?t<=7*this.customTimelineSettings.topTier.count*24?t:7*this.customTimelineSettings.topTier.count*24:"Day"===this.topTier?t<=24*this.customTimelineSettings.topTier.count?t:24*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count;break;case"Minutes":i="Year"===this.topTier?t<=483840*this.customTimelineSettings.topTier.count?t:483840*this.customTimelineSettings.topTier.count:"Month"===this.topTier?t<=40320*this.customTimelineSettings.topTier.count?t:40320*this.customTimelineSettings.topTier.count:"Week"===this.topTier?t<=7*this.customTimelineSettings.topTier.count*24*60?t:7*this.customTimelineSettings.topTier.count*24*60:"Day"===this.topTier?t<=24*this.customTimelineSettings.topTier.count*60?t:24*this.customTimelineSettings.topTier.count*60:"Hour"===this.topTier?t<=60*this.customTimelineSettings.topTier.count?t:60*this.customTimelineSettings.topTier.count:t<=this.customTimelineSettings.topTier.count?t:this.customTimelineSettings.topTier.count}return i},a.prototype.validateFormat=function(e,t){var i;switch(e){case"Week":i=t||"MMM dd, yyyy";break;case"Day":case"None":i=t||"";break;case"Hour":i=t||"H";break;case"Month":i=t||"MMM yyyy";break;case"Year":i=t||"yyyy";break;case"Minutes":i=t||"m"}return i},a.prototype.extendFunction=function(t,e,i){for(var a=this,n={},r=0;r<e.length;r++)n[e[r]]=t[e[r]];return i&&Object.keys(i).forEach(function(e){n[e]=a.extendFunction(t[e],i[e],null)}),n},a.prototype.formatDateHeader=function(e,t,i){var a,t=new Date(t.getTime());return""===e?(a=this.parent.globalize.formatDate(t,{format:"E"}),"zh"===this.parent.locale?a=a.slice(1):"ar"!==this.parent.locale&&(a=a.slice(0,1))):(a=this.parent.globalize.formatDate(t,{format:e}),i&&(a=this.updateHourInFormat(e,a,i.getHours()).updatedFormat)),a},a.prototype.isDateAffectedByDST=function(e){for(var t=new Date(e),i=t.getTimezoneOffset(),a=1;a<=3;a++)if(new Date(t.getTime()-60*a*60*1e3).getTimezoneOffset()!==i)return!0;return!1},a.prototype.calculateIteration=function(e,t,i,a){var n,r;return e.setHours(t.getHours()),this.isFirstLoop&&this.parent.isInDst(t)&&this.isDateAffectedByDST(t)&&(e.setHours(e.getHours()-1),this.increaseIteration=!0),this.isFirstLoop=!1,e.setMinutes(t.getMinutes()),e.setSeconds(t.getSeconds()),e.setMilliseconds(t.getMilliseconds()),"Hour"===i?(r=t.getHours(),n=Math.ceil((24-r)/a)):"Minutes"===i&&(r=t.getHours(),i=t.getMinutes(),n=Math.ceil((1440-(60*r+i))/a)),this.increaseIteration&&(n+=1,this.increaseIteration=!1),{iterations:n,dummystartDate:e}},a.prototype.updateHourInFormat=function(e,t,i){var a,n=e.match(/(h{1,2})/)||e.match(/(H{1,2})/);return!n||(n=n[0],e=e.split(/[\s,:]+/),a=t.split(/[\s,:]+/),-1===(e=e.findIndex(function(e){return e.includes("h")||e.includes("H")})))||e>=a.length?{hasHour:!1,updatedFormat:t}:(i=function(e,t){for(var i=String(e);i.length<t;)i="0"+i;return i}(i,n.length),a[e]=i,{hasHour:!0,hourIndex:e,updatedFormat:a.join(" ")})},a.prototype.customFormat=function(e,t,i,a,n){return(n="string"==typeof n?ne.getValue(n,window):n)(e,t,i,a)},a.prototype.createTimelineTemplate=function(e){var t,i,a=!1,n=this.parent,r=ne.createElement("th"),s=("topTier"===e?n.timelineModule.customTimelineSettings.topTier:n.timelineModule.customTimelineSettings.bottomTier).unit,o=("topTier"===e?n.timelineModule.customTimelineSettings.topTier:n.timelineModule.customTimelineSettings.bottomTier).count,l=n.timelineModule.customTimelineSettings.topTier,d=n.timelineModule.customTimelineSettings.bottomTier,n=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null,h=this.parent.enableTimelineVirtualization&&!ne.isNullOrUndefined(n)?new Date(this.dateByLeftValue(n).toString()):new Date(this.parent.timelineModule.timelineStartDate.toString()),p=new Date(this.timelineRoundOffEndDate.toString()),u=[],c=new Set,g=0,f=3*this.parent.element.offsetWidth,m=this.parent.dataOperation.hasDSTTransition(h.getFullYear()),y=new Date(2e3,0,1,0,0,0,0),D=!1;this.isFirstLoop=!0;do{if(!this.parent.timelineSettings.showWeekend&&this.isNonWorkingDayHeader(s,e,h))t=Math.abs(this.getIncrement(h,o,s,a,!0)),i=h.getTime()+t,h.setTime(i);else{var k={};k.startDate=new Date(h.getTime());if("Month"!==s&&"Hour"!==s||"bottomTier"!==e||1===o||0!==u.length||(a=!0),("Hour"===s||"Minutes"===s&&60===o||"Hour"===l.unit&&"Minutes"===d.unit)&&m){var b=this.calculateIteration(y,h,s,o),w=b.iterations;y.setTime(b.dummystartDate.getTime());for(var T=0;T<w;T++){(k={}).startDate=new Date(h.getTime()),h.getHours()!==y.getHours()&&(this.applyDstHour=!0);var v=this.getHeaterTemplateString(new Date(h.toString()),s,e,!1,o,k,a,y),S=new Date(h.toString()),P=S.getTime(),P=(c.has(P)||(c.add(P),u.push(S)),this.getIncrement(h,o,s,a,!0)),S=P,C=("Minutes"!==s&&"Hour"!==s||(this.dstIncreaseHour&&(this.fromDummyDate=!0,S=this.getIncrement(y,o,s,a,!0),this.dstIncreaseHour=!1,this.fromDummyDate=!1),y.setTime(y.getTime()+S),this.inconsistenceDstApplied?(h.setTime(h.getTime()+P-18e5),this.inconsistenceDstApplied=!1):h.setTime(h.getTime()+P)),a=!1,T===w-1&&0!==h.getHours()&&h.setHours(0),23===h.getHours()&&h.getHours()!==y.getHours()&&h.setHours(h.getHours()-1),p<=h&&(v=this.getHeaterTemplateString(u[u.length-1],s,e,!0,o,k),D=!0),r.appendChild(v),"topTier"===e?this.topTierCollection:this.bottomTierCollection);if(k.endDate=new Date(h.getTime()),(this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.enableTimelineVirtualization?"topTier"===e?this.pdfExportTopTierCollection:this.pdfExportBottomTierCollection:C).push(k),g+=k.width,this.weekendEndDate=k.endDate>=p?p:k.endDate,D){D=!1;break}}this.applyDstHour=!1,"Hour"===s?Math.floor(w*o/24):"Minutes"===s&&Math.floor(w*o/1440),y=new Date(2e3,0,1,0,0,0,0)}else{if(v=this.getHeaterTemplateString(new Date(h.toString()),s,e,!1,o,k,a),u.push(new Date(h.toString())),i=a&&"Month"===s?this.calculateQuarterEndDate(h,o).getTime():(t=Math.abs(this.getIncrement(h,o,s,a,!0)),h.getTime()+t),a=!1,!this.parent.timelineSettings.showWeekend&&"Day"===s){for(var R=0,M=new Date(h);R<o;)M.setHours(0,0,0,0),M.setDate(M.getDate()+1),-1===this.parent.nonWorkingDayIndex.indexOf(M.getDay())&&R++;i=M.getTime()}h.setTime(i),!m||"Day"!==s&&"Month"!==s&&"Week"!==s||h.setHours(0,0,0,0),p<=h&&(v=this.getHeaterTemplateString(u[u.length-1],s,e,!0,o,k)),r.appendChild(v);C="topTier"===e?this.topTierCollection:this.bottomTierCollection;k.endDate=new Date(h.getTime()),(this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.enableTimelineVirtualization?"topTier"===e?this.pdfExportTopTierCollection:this.pdfExportBottomTierCollection:C).push(k),g+=k.width,this.weekendEndDate=k.endDate>=p?p:k.endDate}}}while((!this.parent.enableTimelineVirtualization||this.parent.pdfExportModule&&(!this.parent.pdfExportModule||this.parent.pdfExportModule.isPdfExport)||g<f)&&h<p);return r},a.prototype.isNonWorkingDayHeader=function(e,t,i){return("Day"===e||"Hour"===e||"Minutes"===e)&&-1!==this.parent.nonWorkingDayIndex.indexOf(i.getDay())},a.prototype.updateTimelineAfterZooming=function(e,t){var i,a=document.getElementsByClassName("e-chart-scroll-container e-content")[0];if(!ne.isNullOrUndefined(a)){var n=!this.parent.isLoad&&this.parent.splitterModule&&this.parent.splitterModule.splitterObject&&"Chart"===this.parent.splitterSettings.view?a.offsetWidth+this.parent.splitterModule.splitterObject.allPanes[0].offsetWidth:a.offsetWidth,a=a.offsetHeight,r=document.getElementsByClassName("e-chart-rows-container")[0].offsetHeight,s=Math.abs(this.timelineStartDate.getTime()-e.getTime());if(s/=864e5,i="None"===this.bottomTier?this.getPerDayWidth(this.customTimelineSettings.timelineUnitSize,this.customTimelineSettings.topTier.count,this.topTier):this.getPerDayWidth(this.customTimelineSettings.timelineUnitSize,this.customTimelineSettings.bottomTier.count,this.bottomTier),(a=a<r?i*s+17:i*s)<=n){r=n-a;if(this.parent.timelineSettings.showWeekend)r=Math.round(r/i),e.setDate(e.getDate()+r);else{for(var s=Math.floor(n*(864e5/i)/864e5),a=7-this.parent.nonWorkingDayIndex.length,o=s%a,l=7*Math.floor(s/a)+o,d=e.getDay();0<o;)-1===this.parent.nonWorkingDayIndex.indexOf(d=(d+1)%7)&&o--,l++;e.setDate(e.getDate()+l)}this.parent.timelineModule.timelineEndDate=e,t&&this.parent.updateProjectDates(this.timelineStartDate,this.timelineEndDate,this.parent.isTimelineRoundOff)}}},a.prototype.getTimelineRoundOffEndDate=function(e){var t="None"===this.topTier?this.bottomTier:this.topTier,e=new Date(e.toString());return this.parent.isTimelineRoundOff&&("Hour"===t?e.setMinutes(60):"Minutes"===t?e.setSeconds(60):e.setHours(24,0,0,0)),ne.isNullOrUndefined(this.parent.projectEndDate)&&this.updateTimelineAfterZooming(e,!1),e},a.prototype.getIncrement=function(e,t,i,a,n){var r=new Date(e.getTime()),s=new Date(e.getTime()),o=!1,l=new Date(r);switch(i){case"Year":var r=e,s=new Date(e.getFullYear()+(t-1),11,31),d=q(e),h=this.resetToNextYear(e,t),p=this.adjustForDST(r,s,h-d,s.getTime()-r.getTime()+864e5,n,!0);break;case"Month":r=e,s=new Date(e.getFullYear(),e.getMonth()+t,1);d=q(e),h=this.resetToNextMonth(e,t);p=this.adjustForDST(r,s,h-d,s.getTime()-r.getTime(),n,!0);break;case"Week":var u=this.parent.timelineModule.customTimelineSettings.weekStartDay,c=e.getDay()<u?u-e.getDay():6-e.getDay()+u,u=(t=0<c?t-1:0,s.setHours(24,0,0,0),c=e.getDay()<u&&0<c?c-1:c,s.setDate(s.getDate()+(c+7*t)),this.resetToNextDay(e)),d=q(e),h=u+24*(c+7*t)*60*60*1e3;p=this.adjustForDST(r,s,h-d,s.getTime()-r.getTime(),n,!0);break;case"Day":s.setHours(24,0,0,0);c=(h=(u=this.resetToNextDay(r))+24*(t-1)*60*60*1e3)-(d=q(r));p=s.getTime()-r.getTime()+864e5*(t-1),(g=new Date(r)).setTime(g.getTime()+p),p=this.adjustForDST(r,g,c,g.getTime()-r.getTime(),n,!0);break;case"Hour":s.setMinutes(60),s.setSeconds(0);u=(h=this.resetToNextHour(r)+60*(t-1)*60*1e3)-(d=q(r));p=s.getTime()-r.getTime()+36e5*(t-1);(g=new Date(r)).setTime(g.getTime()+p),a&&12===t&&0!==r.getHours()&&g.setHours(0,0,0,0);c=new Date(r);c.setHours(c.getHours()-t),-30==r.getTimezoneOffset()-c.getTimezoneOffset()&&(g.setMinutes(g.getMinutes()+30),this.inconsistenceDstApplied=!0),g.getHours()<l.getHours()+t&&(o=!0),p=this.adjustForDST(r,g,u,g.getTime()-r.getTime(),n,o);break;case"Minutes":s.setSeconds(60);var g,c=(h=this.resetToNextMinute(r)+60*(t-1)*1e3)-(d=q(r));p=s.getTime()-r.getTime()+6e4*(t-1),(g=new Date(r)).setTime(g.getTime()+p),g.getMinutes()<=l.getMinutes()&&(o=!0),p=this.adjustForDST(r,g,c,g.getTime()-r.getTime(),n,o)}return p},a.prototype.resetToNextYear=function(e,t){e=e.getFullYear()+t;return Date.UTC(e,0,1,0,0,0,0)},a.prototype.resetToNextMonth=function(e,t){var i=e.getFullYear(),e=e.getMonth();return Date.UTC(i,e+t,1,0,0,0,0)},a.prototype.resetToNextDay=function(e){var t=e.getFullYear(),i=e.getMonth(),e=e.getDate();return Date.UTC(t,i,e+1,0,0,0,0)},a.prototype.resetToNextHour=function(e){var t=e.getFullYear(),i=e.getMonth(),a=e.getDate(),e=e.getHours();return Date.UTC(t,i,a,e+1,0,0,0)},a.prototype.resetToNextMinute=function(e){var t=e.getFullYear(),i=e.getMonth(),a=e.getDate(),n=e.getHours(),e=e.getMinutes();return Date.UTC(t,i,a,n,e+1,0,0)},a.prototype.adjustForDST=function(e,t,i,a,n,r){if(this.parent.dataOperation.hasDSTTransition(e.getFullYear())&&!this.inconsistenceDstApplied){var s=a-i;if(t.getTimezoneOffset()>e.getTimezoneOffset()&&n)return this.dstIncreaseHour=!0,this.fromDummyDate?i:r?a+36e5:a;0<s?a-=s:s<0&&(a+=Math.abs(s))}return a},a.prototype.isWeekendHeaderCell=function(e,t,i){return!("Day"!==e&&"Hour"!==e&&"Minutes"!==e||1!==this.customTimelineSettings[t].count&&"Hour"!==e&&"Minutes"!==e||-1===this.parent.nonWorkingDayIndex.indexOf(i.getDay()))},a.prototype.calculateQuarterEndDate=function(e,t){var i=e.getMonth();return 3===t?0<=i&&i<=2?new Date(e.getFullYear(),3,1):3<=i&&i<=5?new Date(e.getFullYear(),6,1):6<=i&&i<=8?new Date(e.getFullYear(),9,1):new Date(e.getFullYear()+1,0,1):0<=i&&i<=5?new Date(e.getFullYear(),6,1):new Date(e.getFullYear()+1,0,1)},a.prototype.calculateTotalHours=function(e,t){var i=0;switch(e){case"Hour":i=+t;break;case"Day":i=24*t;break;case"Week":i=168*t;break;case"Minutes":i=t/60}return i},a.prototype.getHeaterTemplateString=function(e,t,i,a,n,r,s,o){var l=null,d=(ne.isNullOrUndefined(this.parent.timelineTemplate)||(l=this.parent.chartRowsModule.templateCompiler(this.parent.timelineTemplate)),("topTier"===i?this.parent.timelineModule.customTimelineSettings.topTier:this.parent.timelineModule.customTimelineSettings.bottomTier).format),h=("topTier"===i?this.parent.timelineModule.customTimelineSettings.topTier:this.parent.timelineModule.customTimelineSettings.bottomTier).formatter,p=this.getIncrement(e,n,t,s),u=(this.parent.timelineSettings.showWeekend||("Week"!==t&&"Month"!==t&&"Year"!==t||"topTier"!==i||"Day"!==this.parent.currentZoomingLevel.bottomTier.unit)&&"Hour"!==this.parent.currentZoomingLevel.bottomTier.unit&&!this.isZoomToFit||(c=new Date(e),u=new Date(e),(u=new Date(u.getTime()+p)).setHours(0,0,0,0),p-=24*this.calculateNonWorkingDaysBetweenDates(c,u)*60*60*1e3),c=Math.abs(p/864e5*this.parent.perDayWidth)),c=a?this.calculateWidthBetweenTwoDate(t,e,this.timelineRoundOffEndDate,r,a):s&&"Hour"!==t?this.calculateWidthBetweenTwoDate(t,e,this.calculateQuarterEndDate(e,n)):c,p=(this.isFirstLoop&&this.parent.isInDst(e)&&1===e.getHours()&&this.isDateAffectedByDST(e)&&(c+=this.parent.perDayWidth/24),this.isFirstLoop=!1,this.isWeekendHeaderCell(t,i,e)),g="topTier"===i?" e-gantt-top-cell-text":"",f=(s&&20===e.getHours()&&12===n&&"bottomTier"===i&&"Hour"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit&&e.setTime(e.getTime()-72e6),new Date(e));if(this.parent.timelineSettings.showWeekend)f=new Date(e);else if(this.isWeekend(f))for(;-1!==this.parent.nonWorkingDayIndex.indexOf(f.getDay());)f.setDate(f.getDate()+1);var m,s=ne.isNullOrUndefined(h)?this.parent.globalize.formatDate(f,{format:this.parent.getDateFormat()}):this.customFormat(f,d,i,t,h),n=this.applyDstHour?ne.isNullOrUndefined(h)?this.formatDateHeader(d,f,o):this.customFormat(f,d,i,t,h):ne.isNullOrUndefined(h)?this.formatDateHeader(d,f):this.customFormat(f,d,i,t,h),o=(ne.isNullOrUndefined(l)||(e=(m=l(ne.extend({},{date:s,tier:i,value:n}),this.parent,"TimelineTemplate",this.parent.chartRowsModule.getTemplateID("TimelineTemplate"),!1,void 0,null,this.parent.root))[0])instanceof HTMLElement&&(e.setAttribute("data-tier",i),e.setAttribute("date",s),e.setAttribute("value",n)),this.parent.timelineModule.isSingleTier?"e-timeline-single-header-cell":"e-timeline-top-header-cell"),d=ne.createElement("th",{className:o+(p?" e-weekend-header-cell":""),styles:"width:"+c+"px;"+(p&&this.customTimelineSettings.weekendBackground?"background-color:"+this.customTimelineSettings.weekendBackground+";":"")}),t=(d.tabIndex=-1,d.setAttribute("aria-label",this.parent.localeObj.getConstant("timelineCell")+" "+s),ne.createElement("div",{className:"e-header-cell-label"+g,styles:"width:"+(c-1)+"px;"}));return t.title=this.parent.timelineSettings.showTooltip?s:"",t.textContent=n,t.setAttribute("data-tier",i),this.parent.isReact&&!ne.isNullOrUndefined(m)&&0<m.length&&(m[0].style.width="100%",m[0].style.height="100%"),!ne.isNullOrUndefined(l)&&!ne.isNullOrUndefined(m)&&0<m.length?ne.append(m,d):d.append(t),d.outerHTML,!this.isSingleTier&&"topTier"!==i||a?(this.isSingleTier||"topTier"===i)&&a&&(this.totalTimelineWidth=this.totalTimelineWidth-u+c):this.totalTimelineWidth=this.totalTimelineWidth+c,r.value=n,r.isWeekend=p,r.width=c,d},a.prototype.calculateNonWorkingDaysBetweenDates=function(e,t){for(var t=Math.ceil((t.getTime()-e.getTime())/864e5),i=t%7,a=Math.floor(t/7)*this.parent.nonWorkingDayIndex.length,n=e.getDay(),r=0;r<i;r++)-1!==this.parent.nonWorkingDayIndex.indexOf((n+r)%7)&&a++;return a},a.prototype.isWeekend=function(e){e=e.getDay();return-1!==this.parent.nonWorkingDayIndex.indexOf(e)},a.prototype.calculateWidthBetweenTwoDate=function(e,t,i,a,n){t=new Date(t.getTime()),i=new Date(i.getTime());this.parent.dateValidationModule.updateDateWithTimeZone(t,i);i=(i.getTime()-t.getTime())/864e5;if(this.parent.timelineSettings.showWeekend||"Day"!==this.parent.currentZoomingLevel.bottomTier.unit&&"Hour"!==this.parent.currentZoomingLevel.bottomTier.unit&&!this.isZoomToFit)return i*this.parent.perDayWidth;var r=Math.floor(i/7)*(7-this.parent.nonWorkingDayIndex.length),s=i%7;if(1<s||1<r){for(var o=0,l=new Date(t),d=0;d<s;d++){var h=l.getDay();-1===this.parent.nonWorkingDayIndex.indexOf(h)&&o++,l.setDate(l.getDate()+1)}return(r+o)*this.parent.perDayWidth}return this.isZoomToFit&&n?a.width:i*this.parent.perDayWidth},a.prototype.timelineWidthCalculation=function(){var e=this.customTimelineSettings.timelineUnitSize,t=this.customTimelineSettings.bottomTier.count,i=this.customTimelineSettings.topTier.count;this.bottomTierCellWidth=e,"None"===this.bottomTier?this.parent.perDayWidth=this.getPerDayWidth(e,i,this.topTier):this.parent.perDayWidth=this.getPerDayWidth(e,t,this.bottomTier),this.topTierCellWidth="None"!==this.bottomTier?"Week"===this.topTier?7*this.parent.perDayWidth:"Hour"===this.topTier?this.parent.perDayWidth/24:"Minutes"===this.topTier?this.parent.perDayWidth/1440:this.parent.perDayWidth:e,this.topTierCellWidth=this.isSingleTier?this.topTierCellWidth:this.topTierCellWidth*i},a.prototype.getPerDayWidth=function(e,t,i){var a;switch(i){case"Year":a=e/t/336;break;case"Month":a=e/t/28;break;case"Week":a=e/t/7;break;case"Day":a=e/t;break;case"Hour":a=24/t*e;break;case"Minutes":a=1440/t*e}return a},a.prototype.roundOffDays=function(){var e=this.parent.cloneProjectStartDate,t=this.parent.cloneProjectEndDate,i="None"===this.topTier?this.bottomTier:this.topTier;if(this.parent.isTimelineRoundOff){if("Year"===i)e=new Date(e.getFullYear(),0,1),t=new Date(t.getFullYear(),11,31);else if("Month"===i)e=new Date(e.getFullYear(),e.getMonth(),1),t=new Date(t.getFullYear(),t.getMonth()+1,0);else if("Week"===i){var a=ne.isNullOrUndefined(this.customTimelineSettings.weekStartDay)?0:this.parent.timelineModule.customTimelineSettings.weekStartDay,n=e.getDay()<a?e.getDate()-(7-a+e.getDay()):e.getDate()-e.getDay()+a;if(!this.parent.timelineSettings.showWeekend)for(;this.isWeekend(new Date(e.getFullYear(),e.getMonth(),n));)n++;e.setDate(n);var r=t.getDate()-t.getDay();t.setDate(6+r+a)}"Hour"===i?e.setMinutes(0):"Minutes"===i?e.setSeconds(0):e.setHours(0,0,0,0)}this.timelineStartDate=e,this.timelineEndDate=t,this.timelineRoundOffEndDate=this.getTimelineRoundOffEndDate(this.timelineEndDate)},a.prototype.updateScheduleDatesByToolBar=function(e,t,i,a){var n=this;if("Year"===e&&("prevTimeSpan"===t?i=0===i.getMonth()?new Date(i.getFullYear()-1,0,1):new Date(i.getFullYear(),0,1):a=11===a.getMonth()?new Date(a.getFullYear()+1,0,1):new Date(a.getFullYear(),12,1)),"Month"===e&&("prevTimeSpan"===t?i=1===i.getDate()?new Date(i.getFullYear(),i.getMonth()-1,1):new Date(i.getFullYear(),i.getMonth(),1):a=new Date(a.getFullYear(),a.getMonth()+1,1)),"Week"===e){var r=this.parent.timelineModule.customTimelineSettings.weekStartDay,s=void 0;if("prevTimeSpan"===t)if(this.parent.timelineSettings.showWeekend)s=i.getDay()<r?7-(r-i.getDay()):i.getDay()-r,i.setHours(0,0,0,0),0===s?i.setDate(i.getDate()-7):i.setDate(i.getDate()-s);else{var o=Array.from({length:7},function(e,t){return t}).filter(function(e){return-1===n.parent.nonWorkingDayIndex.indexOf(e)});if(i.setHours(0,0,0,0),1<this.parent.timelineModule.customTimelineSettings.weekStartDay)for(;;){i.setDate(i.getDate()-1);var l=i.getDay();if(-1!==o.indexOf(l)&&l===this.parent.timelineModule.customTimelineSettings.weekStartDay)break}else for(var d=0;d<o.length;){i.setDate(i.getDate()-1);var h=i.getDay();-1!==o.indexOf(h)&&d++}}else s=a.getDay()<r?r-a.getDay():7-a.getDay()+r,a.setHours(0,0,0,0),0===s?a.setDate(a.getDate()+6):a.setDate(a.getDate()+s)}if("Day"===e)if("prevTimeSpan"===t)if(0===i.getHours()){if(i.setTime(i.getTime()-864e5),!this.parent.timelineSettings.showWeekend)for(;-1!==this.parent.nonWorkingDayIndex.indexOf(i.getDay());)i.setTime(i.getTime()-864e5)}else i.setHours(0);else if(0===a.getHours()){if(a.setTime(a.getTime()+864e5),!this.parent.timelineSettings.showWeekend)for(;-1!==this.parent.nonWorkingDayIndex.indexOf(a.getDay());)a.setTime(a.getTime()+864e5)}else a.setHours(24);"Hour"===e&&("prevTimeSpan"===t?0===i.getMinutes()?i.setTime(i.getTime()-36e5):i.setMinutes(0):0===a.getMinutes()?a.setTime(a.getTime()+36e5):a.setMinutes(60)),"Minutes"===e&&("prevTimeSpan"===t?0===i.getSeconds()?i.setTime(i.getTime()-6e4):i.setSeconds(0):0===a.getSeconds()?a.setTime(a.getTime()+6e4):a.setSeconds(60)),this.parent.cloneProjectStartDate=i,this.parent.cloneProjectEndDate=a},a.prototype.updateTimeLineOnEditing=function(e,t){if(1<=e[0].length)for(var i=0;i<e.length;i++){var a=e[parseInt(i.toString(),10)],n=a.filter(function(e){return!ne.isNullOrUndefined(e.ganttProperties.startDate)}),r=a.filter(function(e){return!ne.isNullOrUndefined(e.ganttProperties.endDate)}),s=0<n.length?new Date(D.DataUtil.aggregates.min(n,"ganttProperties.startDate")):null,o=0<n.length?new Date(D.DataUtil.aggregates.min(r,"ganttProperties.endDate")):null,r=0<r.length?new Date(D.DataUtil.aggregates.max(r,"ganttProperties.endDate")):null,l=new Date(this.parent.dataOperation.checkStartDate(this.timelineStartDate).getTime()),d=new Date(this.parent.dataOperation.checkEndDate(this.timelineEndDate).getTime()),h=ne.isNullOrUndefined(s)?null:this.parent.dataOperation.getTaskLeft(s,!1),p=ne.isNullOrUndefined(r)?null:this.parent.dataOperation.getTaskLeft(r,!1),l=this.parent.dataOperation.getTaskLeft(l,!1),d=this.parent.dataOperation.getTaskLeft(d,!1),u=void 0,c=this.parent.editModule.taskbarEditModule,n=0<n.length?new Date(D.DataUtil.aggregates.min(n,"ganttProperties.startDate")).setHours(0,0,0,0):null,g=new Date(this.timelineStartDate.getTime()).setHours(0,0,0,0),s=!(!ne.isNullOrUndefined(h)&&!ne.isNullOrUndefined(c)&&(c.taskBarEditAction&&"RightResizing"!==c.taskBarEditAction||ne.isNullOrUndefined(c.taskBarEditAction))&&n<=g&&(h<this.bottomTierCellWidth||h<=l))||(u="prevTimeSpan",s>this.timelineStartDate)?this.timelineStartDate:s,r=!(!ne.isNullOrUndefined(p)&&p>=(this.parent.enableTimelineVirtualization?this.wholeTimelineWidth:this.totalTimelineWidth)-this.bottomTierCellWidth&&d<p)||(u="prevTimeSpan"===u?"both":"nextTimeSpan",r<this.timelineEndDate)?this.timelineEndDate:r;u?this.performTimeSpanAction(u,t,s,r):ne.isNullOrUndefined(a[0].ganttProperties.segments)||this.parent.dataOperation.updateWidthLeft(a[0]),!ne.isNullOrUndefined(s)&&!ne.isNullOrUndefined(o)&&o<=s&&("CellEditing"===t||"DialogEditing"===t)&&this.parent.allowUnscheduledTasks?(s=new Date(Math.min(s.getTime(),o.getTime())),s=new Date(Math.min(s.getTime(),this.timelineStartDate.getTime())),this.performTimeSpanAction("prevTimeSpan",t,s,r)):ne.isNullOrUndefined(o)&&o<=s&&("CellEditing"===t||"DialogEditing"===t)&&this.parent.allowUnscheduledTasks&&1===e[0].length&&!ne.isNullOrUndefined(e[0][0].ganttProperties.endDate)&&ne.isNullOrUndefined(a[0].ganttProperties.startDate)&&a[0].ganttProperties.endDate<=this.timelineStartDate&&(s=new Date(Math.min(e[0][0].ganttProperties.endDate.getTime(),s.getTime())),this.performTimeSpanAction("prevTimeSpan",t,s,r));break}},a.prototype.performTimeSpanAction=function(e,t,i,a,n){n=ne.isNullOrUndefined(n)?"None"===this.parent.timelineModule.topTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:n;var r=new Date(this.parent.cloneProjectStartDate.getTime()),s=new Date(this.parent.cloneProjectEndDate.getTime()),n=("publicMethod"!==t&&"both"===e?(this.updateScheduleDatesByToolBar(n,"prevTimeSpan",i,a),this.updateScheduleDatesByToolBar(n,"nextTimeSpan",new Date(this.parent.cloneProjectStartDate.getTime()),a)):this.updateScheduleDatesByToolBar(n,e,i,a),this.timeSpanActionEvent("actionBegin",e,t));n.cancel?(this.parent.cloneProjectStartDate=r,this.parent.cloneProjectEndDate=s):(this.restrictRender=!0,this.performedTimeSpanAction=!0,i=this.parent.ganttChartModule.scrollElement.scrollLeft,this.parent.updateProjectDates(n.projectStartDate,n.ProjectEndDate,n.isTimelineRoundOff,t),"prevTimeSpan"===e&&"publicMethod"===t?(this.parent.ganttChartModule.updateScrollLeft(0),this.parent.timelineModule.isZoomToFit=!1):"nextTimeSpan"===e&&"publicMethod"===t?(this.parent.ganttChartModule.updateScrollLeft(this.parent.enableTimelineVirtualization?this.wholeTimelineWidth:this.totalTimelineWidth),this.parent.timelineModule.isZoomToFit=!1):"nextTimeSpan"===e&&"TaskbarEditing"===t&&(a=document.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollLeft,this.parent.element.querySelector(".e-timeline-header-container").scrollLeft=a,this.parent.timelineModule.isZoomToFit=!1),"TaskbarEditing"===t&&this.parent.enableTimelineVirtualization&&this.wholeTimelineWidth>3*this.parent.element.offsetWidth&&(this.parent.ganttChartModule.scrollObject.setScrollLeft(i),this.parent.ganttChartModule.scrollObject.updateContent()),this.parent.timelineModule.timeSpanActionEvent("actionComplete",e,t))},a.prototype.timeSpanActionEvent=function(e,t,i){var a={};return a.projectStartDate=new Date(this.parent.cloneProjectStartDate.getTime()),a.ProjectEndDate=new Date(this.parent.cloneProjectEndDate.getTime()),a.requestType="publicMethod"===i?t:"beforeAdd"===i?"TimelineRefreshOnAdd":"TaskbarEditing"===i?"TimelineRefreshOnEdit":t,"actionBegin"===e&&(a.isTimelineRoundOff=this.parent.isTimelineRoundOff,a.cancel=!1),a.action="TimescaleUpdate",this.parent.trigger(e,a),a},a);function a(e){this.isZoomIn=!1,this.isZooming=!1,this.isZoomToFit=!1,this.topTierCollection=[],this.bottomTierCollection=[],this.pdfExportTopTierCollection=[],this.pdfExportBottomTierCollection=[],this.restrictRender=!0,this.applyDstHour=!1,this.performedTimeSpanAction=!1,this.dstIncreaseHour=!1,this.fromDummyDate=!1,this.isZoomedToFit=!1,this.isZoomingAction=!1,this.increaseIteration=!1,this.isFirstLoop=!1,this.inconsistenceDstApplied=!1,this.parent=e,this.initProperties()}var xt=function(e){this.allowEditing=!0,this.allowReordering=!0,this.allowResizing=!0,this.allowSorting=!0,this.allowFiltering=!0,this.edit={},ne.merge(this,e)},It=(n.prototype.addEventListener=function(){this.parent.on("renderPanels",this.createContainer,this),this.parent.on("chartScroll",this.updateScrollTop,this),this.parent.on("destroy",this.destroy,this),this.parent.treeGrid.on("renderReactTemplate",this.renderReactTemplate,this)},n.prototype.renderReactTemplate=function(e){for(var t="portals",i=0,a=e;i<a.length;i++){var n=a[i];-1===this.parent[t].indexOf(n)&&this.parent[t].push(n)}this.parent.renderTemplates()},n.prototype.createContainer=function(){this.treeGridElement=ne.createElement("div",{id:"treeGrid"+this.parent.element.id,className:"e-gantt-tree-grid"});var e=ne.createElement("div",{className:"e-gantt-temp-header"});this.parent.treeGridPane.appendChild(this.treeGridElement),this.treeGridElement.appendChild(e),this.parent.treeGridPane.classList.add("e-temp-content")},n.prototype.renderTreeGrid=function(){this.composeProperties(),this.bindEvents();var e="root";this.parent.treeGrid[e]=this.parent[e]||this.parent,ne.setValue("registeredTemplate",this.registeredTemplate,this.parent.treeGrid);ne.setValue("viewContainerRef",this.parent.viewContainerRef,this.parent.treeGrid),this.treeGridElement.contains(this.parent.treeGrid.element)||this.parent.treeGrid.appendTo(this.treeGridElement),this.parent.treeGrid.grid&&this.parent.toolbarModule&&this.parent.isReact&&(this.parent.treeGrid.grid.portals=this.parent.portals),this.wireEvents()},n.prototype.composeProperties=function(){var e;this.parent.treeGrid.enableAdaptiveUI=this.parent.enableAdaptiveUI,this.parent.treeGrid.hasChildMapping=this.parent.taskFields.hasChildMapping,this.parent.treeGrid.query=this.parent.query,this.parent.treeGrid.locale=this.parent.locale,this.parent.treeGrid.loadChildOnDemand=this.parent.loadChildOnDemand,this.parent.treeGrid.isFromGantt=!0,this.parent.treeGrid.parentIdMapping=this.parent.taskFields.parentID,this.parent.taskFields.parentID&&(this.parent.treeGrid.idMapping=this.parent.taskFields.id),this.parent.treeGrid.showColumnMenu=this.parent.showColumnMenu,this.parent.treeGrid.enableCollapseAll=this.parent.collapseAllParentTasks,this.parent.treeGrid.columnMenuItems=this.parent.columnMenuItems,this.parent.treeGrid.enableRtl=this.parent.enableRtl,this.parent.treeGrid.childMapping=ne.isNullOrUndefined(this.parent.taskFields.child)?"":this.parent.taskFields.child,this.parent.treeGrid.treeColumnIndex=this.parent.treeColumnIndex,this.parent.treeGrid.columns=this.treeGridColumns,this.parent.treeGrid.loadingIndicator=this.parent.loadingIndicator,this.parent.treeGrid.enableVirtualMaskRow=this.parent.enableVirtualMaskRow,this.parent.dataSource instanceof Object&&H(this.parent)?(this.parent.treeGrid.hasChildMapping="isParent",e=ne.getValue("count",this.parent.dataSource),this.parent.treeGrid.dataSource={result:this.parent.flatData,count:e}):this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.treeGrid.dataSource=this.parent.dataSource:(this.parent.treeGrid.hasChildMapping=null,this.parent.treeGrid.dataSource=this.parent.flatData),this.parent.treeGrid.expandStateMapping=this.parent.taskFields.expandState,this.parent.treeGrid.isGantt=!0,this.parent.treeGrid.rowHeight=this.parent.rowHeight,this.parent.treeGrid.gridLines=this.parent.gridLines,0===this.parent.searchSettings.fields.length&&""===this.parent.searchSettings.key||(this.parent.treeGrid.searchSettings=this.parent.searchSettings);this.parent.treeGrid.isJsComponent=!0,this.parent.treeGrid.height=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].offsetHeight-(0===this.parent.flatData.length?0:19)},n.prototype.getContentDiv=function(){return this.treeGridElement.querySelector(".e-content")},n.prototype.getHeaderDiv=function(){return this.treeGridElement.querySelector(".e-headercontent")},n.prototype.getScrollbarWidth=function(){var e=document.createElement("div"),t=(e.style.visibility="hidden",e.style.overflow="scroll",e.style.msOverflowStyle="scrollbar",document.createElement("div")),t=(e.appendChild(t),this.parent.element.appendChild(e),e.offsetWidth-t.offsetWidth);return e.parentNode.removeChild(e),t},n.prototype.ensureScrollBar=function(){var e=this.getContentDiv(),t=this.getHeaderDiv(),i=this.getScrollbarWidth(),a=/Android|Mac|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);0!==i||navigator.userAgent.includes("Firefox")?e.style.cssText+="width: calc(100% + "+(i+1)+"px);":e.classList.add("e-gantt-scroll-padding"),0===i&&a&&(t.style.cssText+="width: calc(100% + 17px);")},n.prototype.bindEvents=function(){this.parent.treeGrid.dataBound=this.dataBound.bind(this),this.parent.treeGrid.collapsing=this.collapsing.bind(this),this.parent.treeGrid.collapsed=this.collapsed.bind(this),this.parent.treeGrid.expanding=this.expanding.bind(this),this.parent.treeGrid.expanded=this.expanded.bind(this),this.parent.treeGrid.actionBegin=this.actionBegin.bind(this),this.parent.treeGrid.actionComplete=this.treeActionComplete.bind(this),this.parent.treeGrid.created=this.created.bind(this),this.parent.treeGrid.actionFailure=this.actionFailure.bind(this),this.parent.treeGrid.headerCellInfo=this.headerCellInfo.bind(this),this.parent.treeGrid.rowDataBound=this.rowDataBound.bind(this),this.parent.treeGrid.columnMenuOpen=this.columnMenuOpen.bind(this),this.parent.treeGrid.columnMenuClick=this.columnMenuClick.bind(this),this.parent.treeGrid.beforeDataBound=this.beforeDataBound.bind(this),this.parent.treeGrid.dataStateChange=this.dataStateChange.bind(this),null!=this.parent.queryCellInfo&&(this.parent.treeGrid.queryCellInfo=this.queryCellInfo.bind(this))},n.prototype.beforeDataBound=function(e){var t={result:e.result},t=(this.parent.trigger("beforeDataBound",t),!ne.isNullOrUndefined(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&0<this.parent.selectionModule.getSelectedRowIndexes().length&&"sorting"===e.actionArgs.requestType&&(this.isPersist=!0),this.parent.updatedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?ne.getValue("virtualScrollModule.visualData",this.parent.treeGrid):ne.getValue("result",e),e.actionArgs||null),i=!t||"sorting"!==t.requestType||"WBSCode"!==t.columnName,t=!t||"filtering"!==t.requestType;this.parent.enableWBS&&!this.parent.isVirtualScroll&&i&&t&&this.parent.generateWBSCodes(this.parent.updatedRecords),this.parent.virtualScrollModule&&this.parent.enableVirtualization&&this.parent.updateContentHeight(e),ne.setValue("contentModule.objectEqualityChecker",this.objectEqualityChecker,this.parent.treeGrid.grid),this.parent.isExpandPerformed=!1},n.prototype.dataBound=function(e){this.parent.isReact&&this.parent.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.ensureScrollBar(),this.parent.treeDataBound(e),this.parent.isVirtualScroll&&((this.parent.enableVirtualMaskRow&&this.parent.enableVirtualization||this.parent.enableVirtualization&&!this.parent.enableVirtualMaskRow&&"Shimmer"===this.parent.loadingIndicator.indicatorType||"Shimmer"===this.parent.loadingIndicator.indicatorType)&&this.parent.hideMaskRow(),this.parent.editModule&&this.parent.editModule.cellEditModule&&(this.parent.editModule.cellEditModule.isCellEdit=!1),this.parent.isVirtualScroll=!1,ne.isNullOrUndefined(this.parent.selectionModule)||ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()),this.prevCurrentView=ne.extend([],[],this.parent.currentViewData,!0)},n.prototype.dataStateChange=function(e){e.action&&"refresh"===e.action.requestType&&(this.parent.treeGrid.dataSource={result:ne.getValue("result",this.parent.treeGrid.dataSource),count:ne.getValue("count",this.parent.treeGrid.dataSource)}),this.parent.trigger("dataStateChange",e)},n.prototype.collapsing=function(e){var t,i=ne.getValue("data",e),a=i.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart){if(ne.isNullOrUndefined(a))t=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.collapseGanttRow(t);else for(var n=0;n<a;n++)t=this.createExpandCollapseArgs(e,i[n]),this.parent.ganttChartModule.collapseGanttRow(t);ne.setValue("cancel",ne.getValue("cancel",t),e)}},n.prototype.expanding=function(e){var t,i=ne.getValue("data",e),a=i.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart){if(ne.isNullOrUndefined(a))t=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.expandGanttRow(t);else for(var n=0;n<a;n++)t=this.createExpandCollapseArgs(e,i[n]),this.parent.ganttChartModule.expandGanttRow(t);ne.setValue("cancel",ne.getValue("cancel",t),e)}},n.prototype.collapsed=function(e){var t=e.data,t=t&&t.expanded;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&!this.parent.enableVirtualization&&!t&&(e.data[this.parent.taskFields.expandState]=!1),!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var i=void 0,a=ne.getValue("data",e),n=a.length;if(ne.isNullOrUndefined(n))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.collapsedGanttRow(i);else for(var r=0;r<n;r++)i=this.createExpandCollapseArgs(e,a[r]),this.parent.ganttChartModule.collapsedGanttRow(i);this.parent.ganttChartModule.isCollapseAll||!i.gridRow||this.parent.allowTaskbarOverlap||(i.gridRow.style.height=i.chartRow.style.height,this.parent.contentHeight=(this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2]:this.parent.element.getElementsByClassName("e-content")[0]).children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}this.parent.hideLoadingIndicator(),this.parent.trigger("collapsed",e)},n.prototype.expanded=function(e){if(!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var t=void 0,i=ne.getValue("data",e),a=i.length;if(ne.isNullOrUndefined(a))t=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.expandedGanttRow(t);else for(var n=0;n<a;n++)t=this.createExpandCollapseArgs(e,i[n]),this.parent.ganttChartModule.expandedGanttRow(t);this.parent.ganttChartModule.isExpandAll||!e.row||this.parent.allowTaskbarOverlap||(e.row.style.height=this.parent.rowHeight+"px",this.parent.contentHeight=(this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2]:this.parent.element.getElementsByClassName("e-content")[0]).children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}this.parent.hideLoadingIndicator(),this.parent.isCollapseAll=!1,this.parent.trigger("expanded",e),this.parent.isExpandPerformed=!0},n.prototype.actionBegin=function(e){var t;!this.parent.undoRedoModule||"filtering"!==e.requestType&&"searching"!==e.requestType&&"sorting"!==e.requestType&&"filterAfterOpen"!==e.requestType||(this.parent.undoRedoModule.canUpdateIndex=!1),"filterchoicerequest"===e.requestType&&(t=ne.getValue("filterModel.dlg",e))&&(t.style.display="none"),e&&"save"===e.type&&e.rowData&&e.rowData.ganttProperties&&(this.perviousStartDate=e.rowData.ganttProperties.startDate,this.perviousEndDate=e.rowData.ganttProperties.endDate),this.parent.notify("actionBegin",e),null!==ne.getValue("doubleClickTarget",this.parent.treeGrid.editModule)&&ne.setValue("doubleClickTarget",null,this.parent.treeGrid.editModule),this.parent.trigger("actionBegin",e),this.parent.trigger("cellSave",e),"virtualscroll"===e.requestType||"edit"===e.type||"beginEdit"===e.requestType||e.cancel||this.parent.showLoadingIndicator()},n.prototype.created=function(e){this.updateKeyConfigSettings()},n.prototype.actionFailure=function(e){this.parent.trigger("actionFailure",e)},n.prototype.createExpandCollapseArgs=function(e,t){var i=ne.getValue("data",e).length;return ne.isNullOrUndefined(i)?{data:i=ne.getValue("data",e),gridRow:ne.getValue("row",e),chartRow:this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(i)],cancel:!1}:{data:t,gridRow:ne.getValue("row",e),chartRow:this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(t)],cancel:!1}},n.prototype.treeActionComplete=function(e){var t,i,a,n,r=this,s=!1,o=ne.extend({},e);if("reorder"===ne.getValue("requestType",e)&&this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("ColumnReorder")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(n={action:"ColumnReorder"}).fromIndex=ne.extend([],[],[e.fromIndex],!0)[0],n.toIndex=ne.extend([],[],[e.toIndex],!0)[0],n.toColumn=ne.extend([],[],[this.parent.treeGrid.columns[e.toIndex].field],!0)[0],n.fromColumn=ne.extend([],[],[this.parent.treeGrid.columns[e.fromIndex].field],!0)[0],this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n),"columnstate"===ne.getValue("requestType",e)&&this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("ColumnState")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(n={action:"ColumnState"}).showhideColumns=ne.extend([],[],e.columns,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n),"sorting"===ne.getValue("requestType",e)?(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Sorting")&&(this.parent.undoRedoModule.currentAction&&this.parent.undoRedoModule.currentAction.sortColumns&&1<this.parent.undoRedoModule.currentAction.sortColumns.length&&this.parent.undoRedoModule.sortedColumnsLength++,this.parent.undoRedoModule.currentAction&&(!this.parent.undoRedoModule.currentAction.sortColumns||this.parent.undoRedoModule.sortedColumnsLength===this.parent.undoRedoModule.currentAction.sortColumns.length)||this.parent.undoRedoModule.isFromUndoRedo||(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(n={action:"Sorting",sortColumns:[]}).sortColumns=this.parent.undoRedoModule.previousSortedColumns,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n),this.parent.undoRedoModule.previousSortedColumns=this.parent.treeGrid.sortSettings.columns),this.parent.notify("updateModel",{}),ne.deleteObject(o,"isFrozen")):"filtering"===ne.getValue("requestType",e)?(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isFromUndoRedo&&this.parent.isUndoRedoItemPresent("Filtering")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(n={action:"Filtering"}).filteredColumns=ne.extend([],[],e.columns,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n),this.parent.notify("updateModel",{})):"save"===ne.getValue("type",e)&&((a=ne.isNullOrUndefined(e.column)?null:e.column.field)&&e.previousData===e.data[a]&&(s=!0),this.parent.editModule)&&this.parent.editModule.cellEditModule&&(a=ne.getValue("data",e),ne.isNullOrUndefined(a)||ne.isNullOrUndefined(this.parent.getTaskByUniqueID(a.uniqueID))||(this.parent.getTaskByUniqueID(a.uniqueID).taskData[this.parent.taskFields.duration]=a.taskData[this.parent.taskFields.duration],ne.isNullOrUndefined(a.taskData[this.parent.taskFields.resourceInfo]))||(this.parent.getTaskByUniqueID(a.uniqueID).taskData[this.parent.taskFields.resourceInfo]=a.taskData[this.parent.taskFields.resourceInfo]),G(this.currentEditRow)&&e.column&&e.column.edit&&e.column.field===this.parent.taskFields.resourceInfo&&(i=this.parent.taskFields.resourceInfo,this.currentEditRow=((t={})[i]=a.resources,t)),this.parent.editModule.cellEditModule.initiateCellEdit(e,this.currentEditRow),this.parent.editModule.cellEditModule.isCellEdit=!1,this.currentEditRow={}),"filterAfterOpen"===ne.getValue("requestType",e)&&this.parent.notify("actionComplete",e),"searching"===ne.getValue("requestType",e)&&(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Search")&&(this.parent.undoRedoModule.isFromUndoRedo||(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(n={action:"Search"}).searchString=this.parent.undoRedoModule.searchString,this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n),this.parent.undoRedoModule.searchString=this.parent.treeGrid.searchSettings.key),this.parent.notify("actionComplete",e)),ne.isNullOrUndefined(this.parent.toolbarModule)||ne.isNullOrUndefined(ne.getValue("batchChanges",e))||this.parent.toolbarModule.refreshToolbarItems(),this.parent.isCancelled&&(ne.setValue("requestType","cancel",o),ne.setValue("action","CellEditing",o),this.parent.isCancelled=!1),"refresh"===ne.getValue("requestType",e)&&ne.isNullOrUndefined(ne.getValue("type",e))&&this.parent.addDeleteRecord){if(-1!==this.parent.selectedRowIndex)if(this.parent.editModule.isAdded&&!ne.isNullOrUndefined(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection){var l=this.parent.selectionModule.selectedRowIndexes;if(1<l.length&&this.parent.selectionSettings.persistSelection)for(var d=0;d<l.length;d++){var h=this.parent.flatData[l[d].toString()];this.parent.selectRows(h)}}else this.parent.selectRow(this.parent.selectedRowIndex),this.parent.selectedRowIndex>this.parent.currentViewData.length-1&&(this.parent.selectedRowIndex=-1);else{if(!ne.isNullOrUndefined(this.parent.selectionModule)&&this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&this.parent.editModule&&!this.parent.editModule.isAdded)for(var p=this.parent.selectionModule.getSelectedRecords(),u=this,d=p.length-1;0<=d;d--)!function(e){var t=p[e][u.parent.taskFields.id];u.parent.editModule.deletedRecord.some(function(e){return e.ganttProperties.taskId===t})&&p.splice(e,1)}(d);var c=0;(this.parent.enableVirtualization?this.parent.flatData:this.parent.currentViewData).map(function(e,t){ne.isNullOrUndefined(r.parent.currentSelection)||e.ganttProperties.taskId!==r.parent.currentSelection[r.parent.taskFields.id]||("ResourceView"!==r.parent.viewType||e.ganttProperties.rowUniqueID!==r.parent.currentSelection.rowUniqueID)&&"ResourceView"===r.parent.viewType||(c=t)}),this.addedRecord=!0,this.parent.selectRow(ne.isNullOrUndefined(c)?0:c)}this.parent.isExpandPerformed||(this.parent.addDeleteRecord=!1),this.parent.isExpandPerformed=!1}if(this.parent.undoRedoModule&&(this.parent.undoRedoModule.isFromUndoRedo=!1),"refresh"===ne.getValue("requestType",e)&&this.parent.initiateEditAction(!1),s||this.setCancelArgs||this.parent.trigger("actionComplete",o),this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(d=0;d<this.parent.currentViewData.length;d++)this.parent.currentViewData[d].hasChildRecords&&!this.parent.currentViewData[d].expanded&&this.parent.chartRowsModule.updateDragDropRecords(this.parent.currentViewData[d]);this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)}"save"!==e.type&&this.parent.hideLoadingIndicator()},n.prototype.updateKeyConfigSettings=function(){delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.delete,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.insert,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.upArrow,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.downArrow,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.ctrlHome,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.ctrlEnd,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.enter,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.tab,delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.shiftTab,delete this.parent.treeGrid.keyboardModule.keyConfigs.enter,delete this.parent.treeGrid.keyboardModule.keyConfigs.upArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.downArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlShiftUpArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlShiftDownArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlUpArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlDownArrow,delete this.parent.treeGrid.keyboardModule.keyConfigs.tab,delete this.parent.treeGrid.keyboardModule.keyConfigs.shiftTab},n.prototype.wireEvents=function(){var e=this.parent.treeGrid.element.querySelector(".e-content");e&&ne.EventHandler.add(e,"scroll",this.scrollHandler,this),this.parent.isAdaptive&&ne.EventHandler.add(this.parent.treeGridPane,"click",this.treeGridClickHandler,this)},n.prototype.unWireEvents=function(){var e=this.parent.treeGrid.element&&this.parent.treeGrid.element.querySelector(".e-content");e&&ne.EventHandler.remove(e,"scroll",this.scrollHandler),this.parent.isAdaptive&&ne.EventHandler.remove(this.parent.treeGridPane,"click",this.treeGridClickHandler)},n.prototype.scrollHandler=function(e){var t=this.parent.treeGrid.element.querySelector(".e-content");t.scrollTop!==this.previousScroll.top&&this.parent.notify("grid-scroll",{top:t.scrollTop}),this.previousScroll.top=t.scrollTop,this.parent.contextMenuModule&&this.parent.contextMenuModule.isOpen&&this.parent.contextMenuModule.contextMenu.close()},n.prototype.validateGanttColumns=function(){for(var a=this.parent,e=a.columns.length,n=this.parent.taskFields,r=(this.parent.columnMapping={},this.parent.columnByField={},this.parent.customColumns=[],["id","name","startDate","endDate","duration","dependency","progress","baselineStartDate","baselineEndDate","baselineDuration","resourceInfo","notes","work","manual","type","milestone","segments","constraintType","constraintDate"]),s=this,t=0;t<e;t++)!function(e){var t={},e=("string"==typeof a.columns[e]?t.field=a.columns[e]:t=a.columns[e],[]);if(0===(e=0<r.length?r.filter(function(e){return t.field===n[e]}):e).length)return t.field!==s.parent.resourceFields.group&&("WBSCode"!==t.field&&"WBSPredecessor"!==t.field&&s.parent.customColumns.push(t.field),t.headerText=t.headerText||t.field,t.width=t.width||150,"WBSCode"===t.field?t.allowEditing=!1:t.allowEditing=!!ne.isNullOrUndefined(t.allowEditing)||t.allowEditing,"WBSCode"!==t.field&&"WBSPredecessor"!==t.field||(t.clipMode="EllipsisWithTooltip"),t.editType=t.editType||"stringedit",t.type=t.type||"string","checkbox"===t.type&&(s.parent.selectionSettings.type="Multiple"),s.bindTreeGridColumnProperties(t,!0));var i=r.indexOf(e[0]);r.splice(i,1),s.createTreeGridColumn(t,!0),s.parent.columnMapping[e[0]]=t.field}(t);for(var i=0;i<r.length;i++){var o={};ne.isNullOrUndefined(n[r[i]])||(o.field=n[r[i]],this.createTreeGridColumn(o,0===e),this.parent.columnMapping[r[i]]=o.field)}"ProjectView"!==this.parent.viewType&&(this.composeUniqueIDColumn(o={}),this.createTreeGridColumn(o,!0))},n.prototype.getLocalizedConstraintTypeText=function(e){return this.parent.localeObj.getConstant("constraintType"+e)},n.prototype.createTreeGridColumn=function(t,e){var i,a=this,n=this.parent.taskFields,r=this.parent.previousGanttColumns.filter(function(e){return t.field===e.field})[0];t.disableHtmlEncode=(ne.isNullOrUndefined(t.disableHtmlEncode)?this.parent:t).disableHtmlEncode,n.id!==t.field&&(t.clipMode=t.clipMode||"EllipsisWithTooltip"),n.id===t.field?this.composeIDColumn(t):n.name===t.field?(this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant("name"):t.headerText=t.headerText||this.parent.localeObj.getConstant("name"),t.width=t.width||150,t.editType=t.editType||"stringedit",t.type=t.type||"string"):n.startDate===t.field?(this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant("startDate"):t.headerText=t.headerText||this.parent.localeObj.getConstant("startDate"),t.editType=t.editType||(-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit"),t.format=t.format||{type:"date",format:this.parent.getDateFormat()},t.width=t.width||150,t.edit&&t.edit.params?t.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):t.edit?t.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:t.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}}):n.baselineStartDate===t.field||n.baselineEndDate===t.field?(i=n.baselineEndDate===t.field?"baselineEndDate":"baselineStartDate",t.width=t.width||150,this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant(i):t.headerText=t.headerText||this.parent.localeObj.getConstant(i),t.format=t.format||{type:"date",format:this.parent.getDateFormat()},t.editType=t.editType||(-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit")):n.endDate===t.field?(this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant("endDate"):t.headerText=t.headerText||this.parent.localeObj.getConstant("endDate"),t.format=t.format||{type:"date",format:this.parent.getDateFormat()},t.editType=t.editType||(-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit"),t.width=t.width||150,t.edit&&t.edit.params?t.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):t.edit?t.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:t.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}}):n.constraintDate===t.field?(this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant("constraintDate"):t.headerText=t.headerText||this.parent.localeObj.getConstant("constraintDate"),t.format=t.format||{type:"date",format:this.parent.getDateFormat()},t.editType=t.editType||(-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit"),t.width=t.width||150,t.edit&&t.edit.params?t.edit.params.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent):t.edit?t.edit.params={renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}:t.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}}):n.duration===t.field?(t.width=t.width||150,this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant("duration"):t.headerText=t.headerText||this.parent.localeObj.getConstant("duration"),t.valueAccessor=t.valueAccessor||(ne.isNullOrUndefined(t.edit)||ne.isNullOrUndefined(t.edit.read)?this.durationValueAccessor.bind(this):null),t.editType=t.editType||"stringedit",t.type=t.type||"string"):n.progress===t.field?this.composeProgressColumn(t):n.dependency===t.field?(this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant("dependency"):t.headerText=t.headerText||this.parent.localeObj.getConstant("dependency"),t.width=t.width||150,t.editType=t.editType||"stringedit",t.type="string",t.allowFiltering=!1!==t.allowFiltering,t.valueAccessor=t.valueAccessor||this.dependencyValueAccessor.bind(this),ne.isNullOrUndefined(t.filter)&&"en-US"!==this.parent.locale&&(t.filter={ui:{create:function(e){var t=ne.createElement("input",{className:"flm-input"});e.target.appendChild(t),a.dropInstance=new U.AutoComplete({dataSource:a.changeLocale(a.parent.treeGrid.grid.dataSource),fields:{text:a.parent.taskFields.dependency,value:a.parent.taskFields.dependency},placeholder:a.parent.localeObj.getConstant("enterValue"),popupHeight:"200px"}),a.dropInstance.appendTo(t)},write:function(e){a.dropInstance.value=e.filteredValue},read:function(e){e.fltrObj.filterByColumn(e.column.field,e.operator,a.changeDelocale(a.dropInstance.value))}}})):n.resourceInfo===t.field?this.composeResourceColumn(t):n.notes===t.field?(r&&this.parent.isLocaleChanged?t.headerText=r.headerText||this.parent.localeObj.getConstant("notes"):t.headerText=t.headerText||this.parent.localeObj.getConstant("notes"),t.width=t.width||150,t.editType=t.editType||"stringedit",this.parent.showInlineNotes||t.template||(t.template=ne.initializeCSPTemplate(function(){return'<div class="e-ganttnotes-info">\n                            <span class="e-icons e-notes-info"></span>\n                        </div>'}))):n.baselineDuration===t.field?(t.width=t.width||150,this.parent.isLocaleChanged&&r?t.headerText=r.headerText||this.parent.localeObj.getConstant("baselineDuration"):t.headerText=t.headerText||this.parent.localeObj.getConstant("baselineDuration"),t.valueAccessor=t.valueAccessor||(ne.isNullOrUndefined(t.edit)||ne.isNullOrUndefined(t.edit.read)?this.baselineDurationValueAccessor.bind(this):null),t.editType=t.editType||"stringedit",t.type=t.type||"string"):n.work===t.field?(r&&this.parent.isLocaleChanged?t.headerText=r.headerText||this.parent.localeObj.getConstant("work"):t.headerText=t.headerText||this.parent.localeObj.getConstant("work"),t.width=t.width||150,t.valueAccessor=t.valueAccessor||this.workValueAccessor.bind(this),t.editType=t.editType||"numericedit"):n.type===t.field?(r&&this.parent.isLocaleChanged?t.headerText=r.headerText||this.parent.localeObj.getConstant("taskType"):t.headerText=t.headerText||this.parent.localeObj.getConstant("taskType"),t.width=t.width||150,t.editType="dropdownedit",t.valueAccessor=t.valueAccessor||this.taskTypeValueAccessor.bind(this)):n.manual===t.field&&"Custom"===this.parent.taskMode?(r&&this.parent.isLocaleChanged?t.headerText=r.headerText||this.parent.localeObj.getConstant("taskMode"):t.headerText=t.headerText||this.parent.localeObj.getConstant("taskMode"),t.width=t.width||120,t.editType=t.editType||"dropdownedit",t.valueAccessor=t.valueAccessor||this.modeValueAccessor.bind(this),t.edit={params:{query:new D.Query,dataSource:[{id:1,text:this.parent.localeObj.getConstant("manual"),value:!0},{id:2,text:this.parent.localeObj.getConstant("auto"),value:!1}],fields:{text:"text",value:"value"}}}):n.constraintType===t.field&&(r&&this.parent.isLocaleChanged?t.headerText=r.headerText||this.parent.localeObj.getConstant("constraintType"):t.headerText=t.headerText||this.parent.localeObj.getConstant("constraintType"),t.width=t.width||160,t.editType=t.editType||"dropdownedit",i=Object.keys(k.ConstraintType).filter(function(e){return!isNaN(Number(k.ConstraintType[e]))}).map(function(e){return{text:a.getLocalizedConstraintTypeText(e),value:k.ConstraintType[e]}}),t.valueAccessor=t.valueAccessor||this.constraintTypeValueAccessor.bind(this),t.edit={params:{dataSource:i,fields:{text:"text",value:"value"},query:new D.Query}}),this.bindTreeGridColumnProperties(t,e)},n.prototype.changeLocale=function(e){var n=this,t=[];return e.map(function(e){return e.ganttProperties.predecessorsName}).map(function(e){var i,a;ne.isNullOrUndefined(e)||(i="",(a=e.split(",")).map(function(e,t){e.includes("FS")?i=(i+=e.replace("FS",n.parent.localeObj.getConstant("FS")))+(a.length!==t+1?",":""):e.includes("FF")?i=(i+=e.replace("FF",n.parent.localeObj.getConstant("FF")))+(a.length!==t+1?",":""):e.includes("SS")?i=(i+=e.replace("SS",n.parent.localeObj.getConstant("SS")))+(a.length!==t+1?",":""):e.includes("SF")&&(i=(i+=e.replace("SF",n.parent.localeObj.getConstant("SF")))+(a.length!==t+1?",":""))}),t.push(i))}),t},n.prototype.changeDelocale=function(e){var i,a,n=this.parent.localeObj.getConstant("FF"),r=this.parent.localeObj.getConstant("FS"),s=this.parent.localeObj.getConstant("SS"),o=this.parent.localeObj.getConstant("SF");return ne.isNullOrUndefined(e)?null:(i=e.split(","),a="",i.map(function(e,t){a=e.includes(n)?(a+=e.replace(n,"FF"))+(i.length!==t+1?",":""):e.includes(r)?(a+=e.replace(r,"FS"))+(i.length!==t+1?",":""):e.includes(s)?(a+=e.replace(s,"SS"))+(i.length!==t+1?",":""):e.includes(o)?(a+=e.replace(o,"SF"))+(i.length!==t+1?",":""):(a+=e)+(i.length!==t+1?",":"")}),a)},n.prototype.composeResourceColumn=function(t){var e=this.parent.previousGanttColumns.filter(function(e){return t.field===e.field})[0];e&&this.parent.isLocaleChanged?t.headerText=e.headerText||this.parent.localeObj.getConstant("resourceName"):t.headerText=t.headerText||this.parent.localeObj.getConstant("resourceName"),t.width=t.width||150,t.type="string",t.valueAccessor=t.valueAccessor||this.resourceValueAccessor.bind(this),t.allowFiltering=!1!==t.allowFiltering},n.prototype.getResourceIds=function(e){var t=ne.getValue(this.parent.taskFields.resourceInfo,e.taskData),i=[];if(ne.isNullOrUndefined(t))return t;for(var a=0;a<t.length;a++)i.push("object"==typeof t[a]?t[a][this.parent.resourceFields.id]:t[a]);return i},n.prototype.composeIDColumn=function(t){var e,i,a="ProjectView"===this.parent.viewType,n=this.parent.dataSource?this.parent.dataSource.length:0;t.isPrimaryKey=a,this.parent.isLocaleChanged?(i=this.parent.previousGanttColumns.filter(function(e){return t.field===e.field})[0])&&(t.headerText=i.headerText||this.parent.localeObj.getConstant("id")):t.headerText=t.headerText||this.parent.localeObj.getConstant("id"),t.width=t.width||100;for(var r=0;r<n;r++)if(!ne.isNullOrUndefined(this.parent.dataSource[r][this.parent.taskFields.id])){e=this.parent.dataSource[r][this.parent.taskFields.id];break}"string"==typeof e||ne.isNullOrUndefined(e)?("ResourceView"===this.parent.viewType?t.allowEditing=t.allowEditing||!1:t.allowEditing=t.allowEditing||!0,t.editType=t.editType||"stringedit"):(t.allowEditing=t.allowEditing||!1,t.editType=t.editType||"numericedit"),t.valueAccessor=a?null:this.idValueAccessor.bind(this)},n.prototype.composeUniqueIDColumn=function(e){e.field="rowUniqueID",e.isPrimaryKey=!0,e.headerText="UniqueID",e.allowEditing=!1,e.visible=!1},n.prototype.composeProgressColumn=function(t){var e=this.parent.previousGanttColumns.filter(function(e){return t.field===e.field})[0];this.parent.isLocaleChanged&&e?t.headerText=e.headerText||this.parent.localeObj.getConstant("progress"):t.headerText=t.headerText||this.parent.localeObj.getConstant("progress"),t.width=t.width||150,t.editType=t.editType||"numericedit"},n.prototype.bindTreeGridColumnProperties=function(e,t){for(var i={},a={},n=0,r=Object.keys(e);n<r.length;n++){var s=r[n];i[s]=a[s]=e[s]}a.field!==this.parent.taskFields.constraintDate||"type"in a||("datepickeredit"===a.editType?a.type="date":"datetimepickeredit"===a.editType&&(a.type="datetime"),i.type=a.type),this.parent.columnByField[a.field]=a,this.parent.ganttColumns.push(new xt(a)),t&&this.treeGridColumns.push(i)},n.prototype.durationValueAccessor=function(e,t,i){return ne.isNullOrUndefined(t)||ne.isNullOrUndefined(t.ganttProperties)?this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.dataOperation.getDurationString(parseInt(t[this.parent.taskFields.duration],10),this.parent.durationUnit):"":(t=t.ganttProperties,this.parent.dataOperation.getDurationString(t.duration,t.durationUnit))},n.prototype.dependencyValueAccessor=function(e,t,i){var a,n,r=this;return t&&t.ganttProperties&&!ne.isNullOrUndefined(t.ganttProperties.predecessorsName)?(a="",(n=t.ganttProperties.predecessorsName.split(",")).map(function(e,t){e.includes("FS")?a=(a+=e.replace("FS",r.parent.localeObj.getConstant("FS")))+(n.length!==t+1?",":""):e.includes("FF")?a=(a+=e.replace("FF",r.parent.localeObj.getConstant("FF")))+(n.length!==t+1?",":""):e.includes("SS")?a=(a+=e.replace("SS",r.parent.localeObj.getConstant("SS")))+(n.length!==t+1?",":""):e.includes("SF")&&(a=(a+=e.replace("SF",r.parent.localeObj.getConstant("SF")))+(n.length!==t+1?",":""))}),a):""},n.prototype.resourceValueAccessor=function(e,t,i){t=t.ganttProperties;return ne.isNullOrUndefined(t)?"":t.resourceNames},n.prototype.workValueAccessor=function(e,t,i){t=t.ganttProperties;return ne.isNullOrUndefined(t)?"":this.parent.dataOperation.getWorkString(t.work,t.workUnit)},n.prototype.taskTypeValueAccessor=function(e,t,i){t=t.ganttProperties;return ne.isNullOrUndefined(t)?"":t.taskType},n.prototype.modeValueAccessor=function(e,t,i){return t[e]?"Manual":"Auto"},n.prototype.constraintTypeValueAccessor=function(t,i,e){var a=Object.keys(k.ConstraintType).find(function(e){return k.ConstraintType[e]===i[t]});return this.getLocalizedConstraintTypeText(a)},n.prototype.baselineDurationValueAccessor=function(e,t,i){return ne.isNullOrUndefined(t)||ne.isNullOrUndefined(t.ganttProperties)?this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?this.parent.dataOperation.getDurationString(parseInt(t[this.parent.taskFields.baselineDuration],10),this.parent.durationUnit):"":(t=t.ganttProperties,this.parent.dataOperation.getDurationString(t.baselineDuration,t.durationUnit))},n.prototype.idValueAccessor=function(e,t,i){return 0===t.level?"R-"+t.ganttProperties.taskId:"T-"+t.ganttProperties.taskId},n.prototype.updateScrollTop=function(e){e=ne.getValue("top",e);this.treeGridElement.querySelector(".e-content").scrollTop=e,this.previousScroll.top=this.treeGridElement.querySelector(".e-content").scrollTop},n.prototype.treeGridClickHandler=function(e){this.parent.notify("treeGridClick",e)},n.prototype.removeEventListener=function(){this.parent.off("renderPanels",this.createContainer),this.parent.off("chartScroll",this.updateScrollTop),this.parent.off("destroy",this.destroy),this.parent.treeGrid.off("reactTemplateRender",this.renderReactTemplate)},n.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.parent.treeGrid.element&&this.parent.treeGrid.destroy()},n);function n(e){var s=this;this.isPersist=!1,this.setCancelArgs=!1,this.previousScroll={top:0,left:0},this.queryCellInfo=function(e){s.parent.trigger("queryCellInfo",e)},this.headerCellInfo=function(e){s.parent.trigger("headerCellInfo",e)},this.rowDataBound=function(e){s.parent.trigger("rowDataBound",e)},this.columnMenuOpen=function(e){s.parent.notify("columnMenuOpen",e),s.parent.trigger("columnMenuOpen",e),document.querySelector(".e-colmenu").addEventListener("mousemove",function(){var e=document.querySelector(".e-filter-popup"),t=document.querySelector(".e-filter-item");ne.isNullOrUndefined(e)||t.classList.contains("e-focused")||ne.remove(s.parent.filterModule.filterMenuElement)})},this.columnMenuClick=function(e){s.parent.trigger("columnMenuClick",e)},this.objectEqualityChecker=function(e,t){if(e){for(var i=Object.keys(e),a=!0,n=["Children","childRecords","taskData","uniqueID","parentItem","parentUniqueID","ganttProperties"],r=0;r<i.length;r++)if((e[i[parseInt(r.toString(),10)]]instanceof Date?new Date(e[i[parseInt(r.toString(),10)]]).getTime():e[i[parseInt(r.toString(),10)]])!==(t[i[parseInt(r.toString(),10)]]instanceof Date?new Date(t[i[parseInt(r.toString(),10)]]).getTime():t[i[parseInt(r.toString(),10)]])&&-1===n.indexOf(i[r])){s.parent.modifiedRecords.push(t),a=!1;break}return a}return!1},this.parent=e,this.parent.treeGrid=new T.TreeGrid,this.parent.treeGrid.allowSelection=!1,this.parent.treeGrid.allowKeyboard=this.parent.allowKeyboard,this.parent.treeGrid["${enableHtmlSanitizer}"]=this.parent.enableHtmlSanitizer,this.parent.treeGrid.enableImmutableMode=this.parent.enableImmutableMode,this.treeGridColumns=[],!this.parent.isLocaleChanged&&this.parent.isLoad&&(this.parent.previousGanttColumns=ne.extend([],[],this.parent.columns,!0)),this.validateGanttColumns(),this.parent.isLocaleChanged&&(this.parent.isLocaleChanged=!1),this.addEventListener()}Et=function(e,t){return(Et=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Et,Ft,r=function(e,t){function i(){this.constructor=e}Et(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Ut=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},r=(Ft=ne.ChildProperty,r(Nt,Ft),Ut([ne.Property(null)],Nt.prototype,"from",void 0),Ut([ne.Property(null)],Nt.prototype,"to",void 0),Nt);function Nt(){return null!==Ft&&Ft.apply(this,arguments)||this}Lt=function(e,t){return(Lt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Lt,Vt,Ut=function(e,t){function i(){this.constructor=e}Lt(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Bt=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Ut=(Vt=ne.ChildProperty,Ut(At,Vt),Bt([ne.Property(null)],At.prototype,"type",void 0),Bt([ne.Property(null)],At.prototype,"headerText",void 0),Bt([ne.Property([])],At.prototype,"fields",void 0),Bt([ne.Property({})],At.prototype,"additionalParams",void 0),At);function At(){return null!==Vt&&Vt.apply(this,arguments)||this}Wt=function(e,t){return(Wt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Wt,jt,Bt=function(e,t){function i(){this.constructor=e}Wt(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Ht=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Bt=(jt=ne.ChildProperty,Bt(zt,jt),Ht([ne.Property(null)],zt.prototype,"type",void 0),Ht([ne.Property(null)],zt.prototype,"headerText",void 0),Ht([ne.Property([])],zt.prototype,"fields",void 0),Ht([ne.Property({})],zt.prototype,"additionalParams",void 0),zt);function zt(){return null!==jt&&jt.apply(this,arguments)||this}Gt=function(e,t){return(Gt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Gt,qt,Ht=function(e,t){function i(){this.constructor=e}Gt(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},_t=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Ht=(qt=ne.ChildProperty,Ht(Zt,qt),_t([ne.Property(!1)],Zt.prototype,"allowEditing",void 0),_t([ne.Property(!1)],Zt.prototype,"allowAdding",void 0),_t([ne.Property(!1)],Zt.prototype,"allowDeleting",void 0),_t([ne.Property("Auto")],Zt.prototype,"mode",void 0),_t([ne.Property("Top")],Zt.prototype,"newRowPosition",void 0),_t([ne.Property(!1)],Zt.prototype,"showDeleteConfirmDialog",void 0),_t([ne.Property(!1)],Zt.prototype,"allowTaskbarEditing",void 0),_t([ne.Property(!1)],Zt.prototype,"allowNextRowEdit",void 0),Zt);function Zt(){return null!==qt&&qt.apply(this,arguments)||this}Xt=function(e,t){return(Xt=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Xt,Yt,_t=function(e,t){function i(){this.constructor=e}Xt(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Kt=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},_t=(Yt=ne.ChildProperty,_t(Qt,Yt),Kt([ne.Property(null)],Qt.prototype,"day",void 0),Kt([ne.Property(null)],Qt.prototype,"label",void 0),Kt([ne.Property(null)],Qt.prototype,"cssClass",void 0),Qt);function Qt(){return null!==Yt&&Yt.apply(this,arguments)||this}$t=function(e,t){return($t=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var $t,Jt,Kt=function(e,t){function i(){this.constructor=e}$t(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},ei=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Kt=(Jt=ne.ChildProperty,Kt(ti,Jt),ei([ne.Collection([],w.Predicate)],ti.prototype,"columns",void 0),ei([ne.Property("Menu")],ti.prototype,"type",void 0),ei([ne.Property()],ti.prototype,"operators",void 0),ei([ne.Property(!1)],ti.prototype,"ignoreAccent",void 0),ei([ne.Property("Parent")],ti.prototype,"hierarchyMode",void 0),ti);function ti(){return null!==Jt&&Jt.apply(this,arguments)||this}ii=function(e,t){return(ii=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var ii,ai,ei=function(e,t){function i(){this.constructor=e}ii(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},ni=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},ei=(ai=ne.ChildProperty,ei(ri,ai),ni([ne.Property([])],ri.prototype,"fields",void 0),ni([ne.Property(!1)],ri.prototype,"ignoreCase",void 0),ni([ne.Property("contains")],ri.prototype,"operator",void 0),ni([ne.Property("")],ri.prototype,"key",void 0),ni([ne.Property("Parent")],ri.prototype,"hierarchyMode",void 0),ri);function ri(){return null!==ai&&ai.apply(this,arguments)||this}si=function(e,t){return(si=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var si,oi,ni=function(e,t){function i(){this.constructor=e}si(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},li=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},ni=(oi=ne.ChildProperty,ni(di,oi),li([ne.Property(null)],di.prototype,"from",void 0),li([ne.Property(null)],di.prototype,"to",void 0),li([ne.Property(null)],di.prototype,"label",void 0),li([ne.Property(null)],di.prototype,"cssClass",void 0),di);function di(){return null!==oi&&oi.apply(this,arguments)||this}hi=function(e,t){return(hi=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var hi,pi,li=function(e,t){function i(){this.constructor=e}hi(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},ui=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},li=(pi=ne.ChildProperty,li(ci,pi),ui([ne.Property(null)],ci.prototype,"rightLabel",void 0),ui([ne.Property(null)],ci.prototype,"leftLabel",void 0),ui([ne.Property(null)],ci.prototype,"taskLabel",void 0),ci);function ci(){return null!==pi&&pi.apply(this,arguments)||this}gi=function(e,t){return(gi=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var gi,fi,ui=function(e,t){function i(){this.constructor=e}gi(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},mi=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},ui=(fi=ne.ChildProperty,ui(yi,fi),mi([ne.Property("Row")],yi.prototype,"mode",void 0),mi([ne.Property("Flow")],yi.prototype,"cellSelectionMode",void 0),mi([ne.Property("Single")],yi.prototype,"type",void 0),mi([ne.Property(!1)],yi.prototype,"persistSelection",void 0),mi([ne.Property(!1)],yi.prototype,"enableToggle",void 0),yi);function yi(){return null!==fi&&fi.apply(this,arguments)||this}Di=function(e,t){return(Di=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Di,ki,mi=function(e,t){function i(){this.constructor=e}Di(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},bi=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},mi=(ki=ne.ChildProperty,mi(wi,ki),bi([ne.Property(null)],wi.prototype,"position",void 0),bi([ne.Property(-1)],wi.prototype,"columnIndex",void 0),bi([ne.Property(4)],wi.prototype,"separatorSize",void 0),bi([ne.Property(null)],wi.prototype,"minimum",void 0),bi([ne.Property("Default")],wi.prototype,"view",void 0),wi);function wi(){return null!==ki&&ki.apply(this,arguments)||this}Ti=function(e,t){return(Ti=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Ti,vi,bi=function(e,t){function i(){this.constructor=e}Ti(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},s=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},bi=(vi=ne.ChildProperty,bi(o,vi),s([ne.Property(null)],o.prototype,"id",void 0),s([ne.Property(null)],o.prototype,"name",void 0),s([ne.Property(null)],o.prototype,"parentID",void 0),s([ne.Property(null)],o.prototype,"hasChildMapping",void 0),s([ne.Property(null)],o.prototype,"startDate",void 0),s([ne.Property(null)],o.prototype,"endDate",void 0),s([ne.Property(null)],o.prototype,"dependency",void 0),s([ne.Property(null)],o.prototype,"progress",void 0),s([ne.Property(null)],o.prototype,"child",void 0),s([ne.Property(null)],o.prototype,"milestone",void 0),s([ne.Property(null)],o.prototype,"duration",void 0),s([ne.Property(null)],o.prototype,"durationUnit",void 0),s([ne.Property(null)],o.prototype,"cssClass",void 0),s([ne.Property(null)],o.prototype,"baselineStartDate",void 0),s([ne.Property(null)],o.prototype,"baselineEndDate",void 0),s([ne.Property(null)],o.prototype,"baselineDuration",void 0),s([ne.Property(null)],o.prototype,"resourceInfo",void 0),s([ne.Property(null)],o.prototype,"expandState",void 0),s([ne.Property(null)],o.prototype,"indicators",void 0),s([ne.Property(null)],o.prototype,"notes",void 0),s([ne.Property(null)],o.prototype,"work",void 0),s([ne.Property(null)],o.prototype,"manual",void 0),s([ne.Property(null)],o.prototype,"type",void 0),s([ne.Property(null)],o.prototype,"segments",void 0),s([ne.Property(null)],o.prototype,"segmentId",void 0),s([ne.Property(null)],o.prototype,"constraintType",void 0),s([ne.Property(null)],o.prototype,"constraintDate",void 0),o);function o(){return null!==vi&&vi.apply(this,arguments)||this}Si=function(e,t){return(Si=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Si,Pi,s=function(e,t){function i(){this.constructor=e}Si(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Ci=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Ri=(Pi=ne.ChildProperty,s(Mi,Pi),Ci([ne.Property("")],Mi.prototype,"format",void 0),Ci([ne.Property("None")],Mi.prototype,"unit",void 0),Ci([ne.Property(1)],Mi.prototype,"count",void 0),Ci([ne.Property(null)],Mi.prototype,"formatter",void 0),Mi);function Mi(){return null!==Pi&&Pi.apply(this,arguments)||this}Oi=ne.ChildProperty,s(xi,Oi),Ci([ne.Property("Week")],xi.prototype,"timelineViewMode",void 0),Ci([ne.Complex({},Ri)],xi.prototype,"topTier",void 0),Ci([ne.Complex({},Ri)],xi.prototype,"bottomTier",void 0),Ci([ne.Property(33)],xi.prototype,"timelineUnitSize",void 0),Ci([ne.Property(0)],xi.prototype,"weekStartDay",void 0),Ci([ne.Property(null)],xi.prototype,"weekendBackground",void 0),Ci([ne.Property(!0)],xi.prototype,"showTooltip",void 0),Ci([ne.Property(!0)],xi.prototype,"updateTimescaleView",void 0),Ci([ne.Property(!0)],xi.prototype,"showWeekend",void 0);var Oi,s=xi;function xi(){return null!==Oi&&Oi.apply(this,arguments)||this}Ii=function(e,t){return(Ii=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Ii,Ei,Ci=function(e,t){function i(){this.constructor=e}Ii(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Fi=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Ci=(Ei=ne.ChildProperty,Ci(Ui,Ei),Fi([ne.Property(!0)],Ui.prototype,"showTooltip",void 0),Fi([ne.Property()],Ui.prototype,"taskbar",void 0),Fi([ne.Property()],Ui.prototype,"baseline",void 0),Fi([ne.Property()],Ui.prototype,"connectorLine",void 0),Fi([ne.Property()],Ui.prototype,"editing",void 0),Fi([ne.Property()],Ui.prototype,"timeline",void 0),Ui);function Ui(){return null!==Ei&&Ei.apply(this,arguments)||this}Ni=function(e,t){return(Ni=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Ni,Li,Fi=function(e,t){function i(){this.constructor=e}Ni(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Vi=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Bi=(Li=ne.ChildProperty,Fi(Ai,Li),Vi([ne.Property()],Ai.prototype,"field",void 0),Vi([ne.Property()],Ai.prototype,"direction",void 0),Ai);function Ai(){return null!==Li&&Li.apply(this,arguments)||this}Wi=ne.ChildProperty,Fi(ji,Wi),Vi([ne.Collection([],Bi)],ji.prototype,"columns",void 0),Vi([ne.Property(!0)],ji.prototype,"allowUnsort",void 0);var Wi,Fi=ji;function ji(){return null!==Wi&&Wi.apply(this,arguments)||this}Hi=function(e,t){return(Hi=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Hi,zi,Vi=function(e,t){function i(){this.constructor=e}Hi(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Gi=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Vi=(zi=ne.ChildProperty,Vi(qi,zi),Gi([ne.Property(null)],qi.prototype,"id",void 0),Gi([ne.Property(null)],qi.prototype,"name",void 0),Gi([ne.Property(null)],qi.prototype,"unit",void 0),Gi([ne.Property(null)],qi.prototype,"group",void 0),qi);function qi(){return null!==zi&&zi.apply(this,arguments)||this}_i=function(e,t){return(_i=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var _i,Zi,Gi=function(e,t){function i(){this.constructor=e}_i(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},Xi=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Gi=(Zi=ne.ChildProperty,Gi(Yi,Zi),Xi([ne.Property("Spinner")],Yi.prototype,"indicatorType",void 0),Yi);function Yi(){return null!==Zi&&Zi.apply(this,arguments)||this}Ki=function(e,t){return(Ki=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var Ki,Qi,Xi=function(e,t){function i(){this.constructor=e}Ki(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},$i=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},Xi=(Qi=ne.ChildProperty,Xi(Ji,Qi),$i([ne.Property()],Ji.prototype,"dayOfWeek",void 0),$i([ne.Collection([],r)],Ji.prototype,"timeRange",void 0),Ji);function Ji(){return null!==Qi&&Qi.apply(this,arguments)||this}ea=function(e,t){return(ea=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};(function(e,t){function i(){this.constructor=e}ea(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)})(d,ta=J),d.prototype.initPublicProp=function(){this.ganttChartTableBody=null},d.prototype.addEventListener=function(){this.parent.on("renderPanels",this.createChartTable,this),this.parent.on("dataReady",this.initiateTemplates,this),this.parent.on("destroy",this.destroy,this)},d.prototype.refreshChartByTimeline=function(){this.taskTable.style.width=ne.formatUnit(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth);var e=ne.getValue("prevProjectStartDate",this.parent.dataOperation),t=!1;e&&(t=e.getTime()===this.parent.cloneProjectStartDate.getTime()),this.isUpdated=!!(this.parent.isFromOnPropertyChange&&t&&ne.getValue("mutableData",this.parent.treeGrid.grid.contentModule)),this.refreshGanttRows(),this.isUpdated=!0},d.prototype.createChartTable=function(){this.taskTable=ne.createElement("table",{className:"e-task-table e-zero-spacing",id:"GanttTaskTable"+this.parent.element.id,styles:"position: absolute;width:"+(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth)+"px;",attrs:{cellspacing:"0.25px"}});var e=ne.createElement("colgroup"),t=ne.createElement("col",{styles:"width:"+this.parent.timelineModule.totalTimelineWidth+"px;"});e.appendChild(t),this.taskTable.appendChild(e),this.ganttChartTableBody=ne.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"}),this.taskTable.appendChild(this.ganttChartTableBody),this.parent.ganttChartModule.chartBodyContent.appendChild(this.taskTable)},d.prototype.initiateTemplates=function(){this.taskTable.style.width=ne.formatUnit(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth),this.initChartHelperPrivateVariable(),this.initializeChartTemplate()},d.prototype.renderChartRows=function(){this.createTaskbarTemplate(),this.parent.isGanttChartRendered=!0},d.prototype.getIndicatorNode=function(e){e='<label class="'+l+' e-indicator-span" style="display: inline-flex; align-items: center; margin-top: 0; line-height:'+this.parent.rowHeight+"px;"+(this.parent.enableRtl?"right:":"left:")+this.getIndicatorleft(e.date)+'px;"><i class="'+e.iconClass+'" style="margin-right: 3px;"></i> </label>';return this.createDivElement(e)},d.prototype.getIndicatorleft=function(e){return e=this.parent.dateValidationModule.getDateFromFormat(e),this.parent.dataOperation.getTaskLeft(e,!1)},d.prototype.getChildTaskbarNode=function(e,t){var i,a,n,r,s=null,o=this.templateData,l=this.parent.enableRtl?"right:":"left:",s=this.childTaskbarTemplateFunction?this.childTaskbarTemplateFunction(ne.extend({index:e},o),this.parent,"TaskbarTemplate",this.getTemplateID("TaskbarTemplate"),!1,void 0,t[0],this.parent.treeGrid.root):(r=t="",a=i=void 0,o.ganttProperties.startDate&&o.ganttProperties.endDate&&o.ganttProperties.duration&&(i=this.createDivElement('<div class="'+we+" "+Ae+" "+(o.ganttProperties.isAutoSchedule?"":Ge)+'"style="width:'+o.ganttProperties.width+"px;height:"+this.taskBarHeight+'px; margin-top :-1px"></div>'),a=this.createDivElement('<div class="'+Te+" "+We+" "+(o.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualprogressbar")+'" style="border-style:'+(o.ganttProperties.progressWidth?"solid;":"none;")+"width:"+o.ganttProperties.progressWidth+"px;height:100%;border-top-right-radius:"+this.getBorderRadius(o.ganttProperties)+"px;border-bottom-right-radius:"+this.getBorderRadius(o.ganttProperties)+'px;"></div>')),n=ne.createElement("div"),this.taskLabelTemplateFunction&&!ne.isNullOrUndefined(a)&&0<a.length?(e=this.taskLabelTemplateFunction(ne.extend({index:e},o),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,a[0]))&&0<e.length&&(ne.append(e,n),t=n.innerHTML,t="isCustomTemplate"===(t=this.getTaskLabel(this.parent.labelSettings.taskLabel))?n.innerHTML:t,this.parent.enableHtmlSanitizer)&&"string"==typeof t&&(t=ne.SanitizeHtmlHelper.sanitize(t)):(e=this.parent.labelSettings.taskLabel,t="isCustomTemplate"===(t=this.getTaskLabel(e))?this.parent.labelSettings.taskLabel:t,this.parent.enableHtmlSanitizer&&"string"==typeof t&&(t=ne.SanitizeHtmlHelper.sanitize(t))),-1===t.indexOf("null")&&("isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(t=""),r=isNaN(parseInt(t,10))?'<span class="'+be+'" style="line-height:'+(this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(o.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="'+be+'" style="line-height:'+(this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"text-align:"+(this.parent.enableRtl?"right;":"left;"):"")+ +("ResourceView"===this.parent.viewType?"display:inline-flex;":"")+ +("ResourceView"===this.parent.viewType?o.ganttProperties.width-10:"")+"px; height:"+this.taskBarHeight+'px;"></span>'),e=!ne.isNullOrUndefined(o.ganttProperties.segments)&&0<o.ganttProperties.segments.length?this.splitTaskbar(o,t):o.ganttProperties.startDate&&o.ganttProperties.endDate&&o.ganttProperties.duration?r:!o.ganttProperties.startDate||o.ganttProperties.endDate||o.ganttProperties.duration?!o.ganttProperties.endDate||o.ganttProperties.startDate||o.ganttProperties.duration?!o.ganttProperties.duration||o.ganttProperties.startDate||o.ganttProperties.endDate?"":'<div class="'+Te+" "+Ae+" e-gantt-unscheduled-taskbar "+(o.ganttProperties.isAutoSchedule?"":Ge)+'"style="'+l+o.ganttProperties.left+"px; width:"+o.ganttProperties.width+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+Te+" "+Ae+" "+et+" "+(o.ganttProperties.isAutoSchedule?"":Ge)+'"style="'+l+o.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+Te+" "+Ae+" "+Je+" "+(o.ganttProperties.isAutoSchedule?"":Ge)+'"style="'+l+o.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>',o.ganttProperties.segments&&0<o.ganttProperties.segments.length&&(e+=this.getSplitProgressResizerNode()),o.ganttProperties.startDate&&o.ganttProperties.endDate&&o.ganttProperties.duration&&(ne.isNullOrUndefined(o.ganttProperties.segments)||!ne.isNullOrUndefined(o.ganttProperties.segments)&&0===o.ganttProperties.segments.length)?(""!==e&&!ne.isNullOrUndefined(a)&&0<a.length&&(r=this.createDivElement(e)[0],this.parent.disableHtmlEncode?r.innerText=t:r.innerHTML=t,(l=this.parent.labelSettings.taskLabel)&&l.elementRef&&r.appendChild(n),a[0].appendChild(r),""!==a[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(l)&&a[0].querySelectorAll(".e-task-label")[0].children[0]&&this.parent.disableHtmlEncode&&a[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===a[0].querySelectorAll(".e-task-label")[0].textContent)&&l&&!l.elementRef&&""!==n.innerHTML&&(a[0].querySelectorAll(".e-task-label")[0].textContent=l),!ne.isNullOrUndefined(i)&&0<i.length&&i[0].appendChild([].slice.call(a)[0]),i):this.createDivElement(e));return this.parent.enableRtl&&!ne.isNullOrUndefined(s)&&s[0]&&s[0].querySelector(".e-task-label")&&(s[0].querySelector(".e-task-label").style.marginLeft="15px",s[0].querySelector(".e-task-label").style.marginRight="8px",s[0].querySelector(".e-gantt-child-progressbar"))&&(s[0].querySelector(".e-gantt-child-progressbar").style.textAlign="left"),s},d.prototype.splitTaskbar=function(e,t){for(var i="",a=0;a<e.ganttProperties.segments.length;a++){var n=e.ganttProperties.segments[a],r=void 0,r=n.showProgress?"initial":"hidden",s=0===a?"e-segment-first":a===e.ganttProperties.segments.length-1?"e-segment-last":"e-segment-inprogress";i+='<div class="'+we+" "+s+" "+Ae+'  e-segmented-taskbar"style="width:'+n.width+"px;position: absolute;"+(this.parent.enableRtl?"right:":"left:")+n.left+"px;height:"+this.taskBarHeight+"px; overflow:"+r+';" data-segment-index = "'+a+'" aria-label = "'+this.generateSpiltTaskAriaLabel(n,e.ganttProperties)+'"> '+this.getSplitTaskbarLeftResizerNode()+'<div class="'+Te+" "+We+' " style="border-style:'+(n.progressWidth?"solid;":"none;")+"display:"+(0<=n.progressWidth?"block;":"none;")+"width:"+n.progressWidth+"px;height:100%;text-align:"+(this.parent.enableRtl?"left;":"right;")+"border-top-right-radius:"+this.getSplitTaskBorderRadius(n)+"px;border-bottom-right-radius:"+this.getSplitTaskBorderRadius(n)+'px;"><span class="'+be+'" style="line-height:'+(this.taskBarHeight-1)+"px;display:"+(n.showProgress?"inline;":"none;")+"height:"+this.taskBarHeight+'px;">'+t+"</span></div>"+this.getSplitTaskbarRightResizerNode(n)+"</div></div>"}return i},d.prototype.getSplitTaskbarLeftResizerNode=function(){var e=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?5:-2;return'<div class="'+Ie+" "+Ve+'" style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>'},d.prototype.getSplitTaskbarRightResizerNode=function(e){var t=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?-17:-10;return'<div class="'+Ee+" "+Ve+'" style="'+(this.parent.enableRtl?"right:":"left:")+(e.width+t)+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>'},d.prototype.getSplitProgressResizerNode=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6;return'<div class="'+Fe+'" style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+Ue+'"><div class="'+Ne+'"></div><div class="'+Le+'"></div></div>'},d.prototype.getSegmentIndex=function(e,t){var i=-1,a=t.ganttProperties,n=a.segments;if(!ne.isNullOrUndefined(n)){n.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()});for(var r=n.length,s=0;s<r;s++){var o,l,d=n[s];e.getTime()===a.startDate.getTime()?(this.dropSplit=!0,i=0):e.getTime()===d.startDate.getTime()?(this.dropSplit=!0,(o=d.startDate).setDate(o.getDate()+1),o=d.startDate=this.parent.dataOperation.checkStartDate(o,a,!1),d.startDate=o,l=d.endDate,l=this.parent.dataOperation.getEndDate(o,d.duration,a.durationUnit,a,!1),d.endDate=l,s===n.length-1&&this.parent.setRecordValue("endDate",l,a,!0),this.incrementSegments(n,s,t),i=d.segmentIndex):(d.endDate=this.parent.dataOperation.getEndDate(d.startDate,d.duration,a.durationUnit,a,!1),e.getTime()>=d.startDate.getTime()&&e.getTime()<=d.endDate.getTime()&&(i=d.segmentIndex)),this.parent.setRecordValue("segments",a.segments,a,!0)}}return-1===i&&(this.dropSplit=!0),i},d.prototype.mergeTask=function(t,e){var i,a,n=e.length,r=this.parent.taskFields,s=this.parent.flatData.filter(function(e){return e[r.id]===t?e:null})[0],o=(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&(i={action:"MergeTaskbar"},this.parent.isUndoRedoItemPresent("Edit"))&&(this.parent.editModule&&this.parent.editModule.taskbarEditModule.isDragged&&0<this.parent.getUndoActions().length&&this.parent.undoRedoModule.getUndoCollection.splice(this.parent.undoRedoModule.getUndoCollection.length-1,1),this.parent.undoRedoModule.createUndoCollection(),a=this.parent.previousFlatData[s.index],i.modifiedRecords=ne.extend([],[a],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=i),s.ganttProperties.segments);e=e.sort(function(e,t){return t.firstSegmentIndex-e.firstSegmentIndex});for(var l,d=0;d<n;d++){var h=o[e[d].firstSegmentIndex],p=o[e[d].secondSegmentIndex],p=h.duration+p.duration,u=this.parent.dataOperation.getEndDate(h.startDate,p,s.ganttProperties.durationUnit,s.ganttProperties,!1),h={startDate:h.startDate,endDate:u,duration:p},p=e[d].firstSegmentIndex;o.splice(p,2,h),this.parent.setRecordValue("segments",o,s.ganttProperties,!0),this.parent.dataOperation.updateMappingData(s,"segments"),1===o.length?(this.parent.setRecordValue("endDate",u,s.ganttProperties,!0),this.parent.setRecordValue("EndDate",u,s,!0),this.parent.setRecordValue("segments",null,s.ganttProperties,!0),this.parent.dataOperation.updateMappingData(s,"segments")):s.ganttProperties.endDate!==o[o.length-1].endDate&&this.parent.setRecordValue("endDate",o[o.length-1].endDate,s.ganttProperties,!0)}ne.isNullOrUndefined(s[r.segments])||ne.isNullOrUndefined(s[r.segments][0])||(l=Object.keys(s[r.segments][0]));for(var c=[],g=0;g<o.length;g++)ne.isNullOrUndefined(l)||c[g]||(c[g]={}),ne.isNullOrUndefined(l)||-1===l.indexOf("StartDate")||(c[g][r.startDate]=o[g].startDate),ne.isNullOrUndefined(l)||-1===l.indexOf("EndDate")||(c[g][r.endDate]=o[g].endDate),ne.isNullOrUndefined(l)||-1===l.indexOf("Duration")||(c[g][r.duration]=o[g].duration);s[r.segments]=c,this.updateSegment(s.ganttProperties.segments,t),this.refreshChartAfterSegment(s,"mergeSegment")},d.prototype.updateSegment=function(e,t){var i=this;if(!ne.isNullOrUndefined(this.parent.taskFields.segmentId)&&0<this.parent.segmentData.length){if(ne.isNullOrUndefined(e))o=this.parent.segmentData.filter(function(e){return!(t===e[i.parent.taskFields.segmentId])});else{for(var a=[],n=0;n<e.length;n++){var r={},s=e[n];r[this.parent.taskFields.segmentId]=t,ne.isNullOrUndefined(this.parent.taskFields.startDate)||(r[this.parent.taskFields.startDate]=s.startDate),ne.isNullOrUndefined(this.parent.taskFields.duration)||(r[this.parent.taskFields.duration]=s.duration),ne.isNullOrUndefined(this.parent.taskFields.endDate)||(r[this.parent.taskFields.endDate]=s.endDate),a.push(r)}for(var o=this.parent.segmentData.filter(function(e){return!(t===e[i.parent.taskFields.segmentId])}),n=0;n<a.length;n++)o.push(a[n])}this.parent.segmentData=o}},d.prototype.refreshChartAfterSegment=function(e,t){this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e,!1),e.ganttProperties,!0),this.parent.dataOperation.updateMappingData(e,"segments"),this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateParentItems(e),e.ganttProperties.sharedTaskUniqueIds&&1<e.ganttProperties.sharedTaskUniqueIds.length&&this.parent.editModule.updateSharedTask(e),this.parent.predecessorModule&&this.parent.taskFields.dependency&&(this.parent.predecessorModule.updatedRecordsDateByPredecessor(),this.parent.connectorLineModule.removePreviousConnectorLines(this.parent.flatData),this.parent.connectorLineEditModule.refreshEditedRecordConnectorLine(this.parent.flatData),e.parentItem)&&this.parent.getParentTask(e.parentItem).ganttProperties.isAutoSchedule&&this.parent.isInPredecessorValidation&&this.parent.dataOperation.updateParentItems(e.parentItem),this.refreshRecords(this.parent.currentViewData);var i=this.ganttChartTableBody.querySelectorAll("tr")[this.parent.currentViewData.indexOf(e)],a={requestType:t,rowData:e,modifiedRecords:this.parent.editedRecords,modifiedTaskData:Z(this.parent.editedRecords,!0)},n=(this.triggerQueryTaskbarInfoByIndex(i,e),this.parent.selectionModule&&this.parent.selectionModule.clearSelection(),a.rowData.taskData[this.parent.taskFields.segments]);if(this.parent.timezone&&null!=n)for(var r=0;r<n.length;r++)n[r][this.parent.taskFields.startDate]=this.parent.dateValidationModule.remove(a.rowData.ganttProperties.segments[r].startDate,this.parent.timezone),this.parent.taskFields.endDate&&(n[r][this.parent.taskFields.endDate]=this.parent.dateValidationModule.remove(a.rowData.ganttProperties.segments[r].endDate,this.parent.timezone));this.parent.trigger("actionComplete",a),this.parent.hideLoadingIndicator(),ne.setValue("isEdit",!1,this.parent.contextMenuModule),ne.setValue("isEdit",!1,this.parent)},d.prototype.splitTask=function(t,e){var i=this.parent.taskFields,a=e,n=this.parent.flatData.filter(function(e){return e[i.id]===t?e:null})[0],r=(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&(r={action:"MergeTaskbar"},this.parent.isUndoRedoItemPresent("Edit"))&&(this.parent.undoRedoModule.createUndoCollection(),r.modifiedRecords=ne.extend([],[n],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=r),n.ganttProperties),s=(this.dropSplit=!1,-1),o=r.segments;if(ne.isNullOrUndefined(e.length)||e.length<0){var l=this.parent.dataOperation.checkStartDate(a,r,!1);if(l.getTime()!==r.startDate.getTime()&&r.isAutoSchedule){if(!ne.isNullOrUndefined(o)&&0<o.length&&(s=this.getSegmentIndex(l,n)),!1===this.dropSplit&&a.getTime()>r.startDate.getTime()&&a.getTime()<r.endDate.getTime()){for(var o=-1!==s?o:[],l=-1!==s?o[s].startDate:new Date(r.startDate.getTime()),d=-1!==s?o[s].endDate:new Date(r.endDate.getTime()),h=this.parent.dataOperation.getDuration(l,d,r.durationUnit,r.isAutoSchedule,r.isMilestone),p=(this.parent.setRecordValue("segments",this.splitSegmentedTaskbar(l,d,a,s,o,n,h),r,!0),[]),u=0;u<o.length;u++)p[u]||(p[u]={}),p[u][i.startDate]=o[u].startDate,p[u][i.endDate]=o[u].endDate,p[u][i.duration]=o[u].duration;n[i.segments]=p,-1!==s&&this.incrementSegments(o,s+1,n),this.parent.setRecordValue("endDate",o[o.length-1].endDate,r,!0),this.parent.taskFields.endDate&&this.parent.dataOperation.updateMappingData(n,"endDate")}this.updateSegment(n.ganttProperties.segments,t),this.refreshChartAfterSegment(n,"splitTaskbar")}}else e.sort(function(e,t){return e.getTime()-t.getTime()}),this.parent.setRecordValue("segments",this.constructSegments(e,n.ganttProperties),n.ganttProperties,!0),this.updateSegment(n.ganttProperties.segments,t),this.refreshChartAfterSegment(n,"splitTask")},d.prototype.constructSegments=function(e,t){for(var i,a,n=[],r=new Date,s=0;s<e.length+1&&(r=0===s?t.startDate:r,r=this.parent.dataOperation.checkStartDate(r,t,!1),i=s===e.length||new Date(e[s].getTime())>t.endDate?t.endDate:new Date(e[s].getTime()),i=this.parent.dataOperation.checkEndDate(i,t,!1),a=this.parent.dataOperation.getDuration(r,i,t.durationUnit,t.isAutoSchedule,t.isMilestone),i.getTime()>=r.getTime()&&n.push({startDate:r,endDate:i,duration:a}),s!==e.length);s++)(r=new Date(e[s].getTime())).setDate(e[s].getDate()+1);return n},d.prototype.splitSegmentedTaskbar=function(e,t,i,a,n,r,s){var o=r.ganttProperties,r=this.parent.includeWeekend?-1:this.parent.nonWorkingDayIndex.indexOf(i.getDay()),l=-1===r?0:0===r||1===r?1:2,d=(e=this.parent.dataOperation.checkStartDate(e,o,!1),new Date(i.getTime()));d=this.parent.dataOperation.checkEndDate(d,o,!1);for(var h=0;h<2;h++){0<this.parent.weekWorkingTime.length&&(p=this.parent.getCurrentDayEndTime(d),this.setTime(p,d));var p={startDate:e,endDate:d,duration:this.parent.dataOperation.getDuration(e,d,o.durationUnit,o.isAutoSchedule,o.isMilestone),offsetDuration:1},u=this.parent.includeWeekend?-1:this.parent.nonWorkingDayIndex.indexOf(d.getDay()),c=(-1!==a&&(n.splice(a,1),a=-1),n.push(p),this.parent.timelineModule.customTimelineSettings.bottomTier.unit);if("Hour"===c||"Minutes"===c){e=new Date(i.getTime()),e=this.parent.dataOperation.checkStartDate(e,o,!1);var c=this.parent.timelineModule.customTimelineSettings.bottomTier.count,g=this.parent.timelineModule.customTimelineSettings.bottomTier.unit,f=this.parent.timelineModule.getIncrement(e,c,g),m=e.getTime()+f;e.setTime(m+l),d=new Date(t.getTime()),f=this.parent.timelineModule.getIncrement(d,c,g),m=d.getTime()+f,d.setTime(m+l)}else{(e=new Date(i.getTime())).setDate(e.getDate()+1+l);c=this.parent.getCurrentDayStartTime(e);if(this.setTime(c,e),e=this.parent.dataOperation.checkStartDate(e,o,!1),!this.parent.taskFields.duration&&l<=0&&e.setDate(e.getDate()+1),(d=new Date(t.getTime()))<e&&d.setDate(d.getDate()+1),this.isOnHolidayOrWeekEnd(d,!0))for(;d.setDate(d.getDate()+1),this.isOnHolidayOrWeekEnd(d,!0););this.parent.includeWeekend||(d=this.getNextWorkingDay(d))}d=-1!==u?this.parent.dataOperation.getEndDate(e,s-p.duration,o.durationUnit,o,!1):this.parent.dataOperation.checkEndDate(d,o,!1)}return n.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),n},d.prototype.incrementSegments=function(e,t,i){for(var a=i.ganttProperties,n=t+1;n<e.length;n++){var r=e[n],s=0!==n?new Date(e[n-1].endDate.getTime()):new Date(r.startDate.getTime()),s=(this.parent.dataOperation.fromSegments=!0,s=this.parent.dataOperation.getEndDate(s,r.offsetDuration,a.durationUnit,a,!1),this.parent.dataOperation.fromSegments=!1,s=this.parent.dataOperation.checkStartDate(s,a,!1),r.startDate=s,r.endDate=this.parent.dataOperation.getEndDate(s,r.duration,a.durationUnit,a,!1));r.endDate=s,n===e.length-1&&(this.parent.setRecordValue("endDate",s,a,!0),this.parent.taskFields.endDate)&&this.parent.dataOperation.updateMappingData(i,"endDate")}e.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),this.parent.setRecordValue("segments",e,a,!0),this.parent.dataOperation.updateMappingData(i,"segments")},d.prototype.calculateLeftValue=function(e){var t=this.parent.renderBaseline?.45:!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,t=Math.floor(this.parent.rowHeight*t);return!ne.isNullOrUndefined(this.parent.taskbarHeight)&&this.parent.taskbarHeight<=t||ne.isNullOrUndefined(this.parent.taskbarHeight)&&e<=36||e<=36?1:-1/12*(e-36)+1},d.prototype.getMilestoneNode=function(e,t){var i=this.templateData,a=this.parent.rowHeight,a=this.calculateLeftValue(a);return this.milestoneTemplateFunction?this.milestoneTemplateFunction(ne.extend({index:e},i),this.parent,"MilestoneTemplate",this.getTemplateID("MilestoneTemplate"),!1,void 0,t[0],this.parent.treeGrid.root):(e='<div class="'+Be+'" style="width:'+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-6)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-6)+"px;position:absolute;transform: rotate(45deg);left:"+a+'px;"> </div>',this.createDivElement(e))},d.prototype.getTaskBaselineNode=function(){var e=this.templateData,e='<div class="'+Ce+' " role="term" style="margin-top:'+this.baselineTop+"px;"+(this.parent.enableRtl?"right:":"left:")+e.ganttProperties.baselineLeft+"px;width:"+e.ganttProperties.baselineWidth+"px;height:"+this.baselineHeight+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+'"></div>';return this.createDivElement(e)},d.prototype.updateTaskBaselineNode=function(e){e='<div class="'+Ce+' " role="term" style="margin-top:'+this.baselineTop+"px;"+(this.parent.enableRtl?"right:":"left:")+e.ganttProperties.baselineLeft+"px;width:"+e.ganttProperties.baselineWidth+"px;height:"+this.baselineHeight+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+'"></div>';return this.createDivElement(e)},d.prototype.getMilestoneBaselineNode=function(){var e=this.templateData,t=this.parent.renderBaseline?5:2,e='<div class="'+Re+'" style="width:'+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-10)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight:this.taskBarHeight-10)+"px;position:absolute;transform:rotate(45deg);"+(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e.ganttProperties.left-this.milestoneHeight/2+3:e.ganttProperties.baselineLeft-this.milestoneHeight/2+1)+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+"margin-top:"+(-Math.floor(this.parent.rowHeight-this.milestoneMarginTop)+t+2)+'px"> </div>';return this.createDivElement(e)},d.prototype.getLeftLabelNode=function(e){var t,i=this.leftLabelContainer(),a=(""!==this.generateTaskLabelAriaLabel("left")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("left")),null);return this.leftTaskLabelTemplateFunction?a=this.leftTaskLabelTemplateFunction(ne.extend({index:e},this.templateData),this.parent,"LeftLabelTemplate",this.getTemplateID("LeftLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root):(e=this.parent.labelSettings.leftLabel,(t=this.getTaskLabel(e))&&(a=this.getLableText(t="isCustomTemplate"===t?e:t,ye),this.parent.enableHtmlSanitizer)&&"string"==typeof t&&(t=ne.SanitizeHtmlHelper.sanitize(t),a=this.getLableText(t="isCustomTemplate"===t?e:t,ye))),a&&0<a.length&&("null"===a[0].data&&(a[0].data=""),ne.append(a,i[0])),this.parent.enableRtl&&(i[0].style.paddingLeft="25px",i[0].style.paddingRight="0px"),i},d.prototype.getLableText=function(e,t){var i=this.parent.renderBaseline?(this.parent.rowHeight-this.taskBarHeight)/2:this.taskBarMarginTop,t=ne.createElement("div",{className:t,styles:"height:"+this.taskBarHeight+"px;margin-top:"+i+"px;"}),i=ne.createElement("span",{className:l}),e=(i[this.parent.disableHtmlEncode?"textContent":"innerHTML"]=e,t.appendChild(i),ne.createElement("div"));return e.appendChild(t),e.childNodes},d.prototype.getRightLabelNode=function(e){var t,i=this.rightLabelContainer(),a=(""!==this.generateTaskLabelAriaLabel("right")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("right")),null);return this.rightTaskLabelTemplateFunction?a=this.rightTaskLabelTemplateFunction(ne.extend({index:e},this.templateData),this.parent,"RightLabelTemplate",this.getTemplateID("RightLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root):(e=this.parent.labelSettings.rightLabel,(t=this.getTaskLabel(e))&&(a=this.getLableText(t="isCustomTemplate"===t?e:t,ke),this.parent.enableHtmlSanitizer)&&"string"==typeof t&&(t=ne.SanitizeHtmlHelper.sanitize(t),a=this.getLableText(t="isCustomTemplate"===t?e:t,ke))),a&&0<a.length&&("null"===a[0].data&&(a[0].data=""),ne.append(a,i[0])),this.parent.enableRtl&&(i[0].style.marginLeft="0px",i[0].style.paddingRight="25px"),i},d.prototype.getManualTaskbar=function(){var e=this.templateData,t=this.taskBarHeight/2-1,i=(e.ganttProperties.startDate&&e.ganttProperties.endDate&&(e.ganttProperties.duration||e.hasChildRecords)?'<div class="'+He+'" style="width:'+e.ganttProperties.width+"px;height:"+t/5+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div>':e.ganttProperties.startDate||e.ganttProperties.endDate||!e.ganttProperties.duration?'<div class="'+He+" "+(e.ganttProperties.startDate?Je:et)+'" style="width:'+e.ganttProperties.width+"px;height:"+2*t+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div>':'<div class="'+He+' e-gantt-unscheduled-manualtask" style="width:'+e.ganttProperties.width+"px;height:"+(t/5+1)+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div>')+(e.ganttProperties.startDate&&e.ganttProperties.endDate&&(e.ganttProperties.duration||e.hasChildRecords)||e.ganttProperties.duration?'<div class="e-gantt-manualparenttaskbar-left" style='+(this.parent.enableRtl?"margin-right:0px;":"")+'"height:'+(t/5+8)+"px;border-left-width:"+t/5+"px; border-bottom:"+t/5+'px solid transparent;"></div><div class="e-gantt-manualparenttaskbar-right" style="'+(this.parent.enableRtl?"margin-right:-8px;":"")+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.width-Math.floor((t/5+8)/5))+"px;height:"+(t/5+8)+"px;border-right-width:"+t/5+"px;border-bottom:"+t/5+'px solid transparent;"></div></div>':""),t='<div class="'+je+'"style='+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.left-e.ganttProperties.autoLeft)+"px;width:"+e.ganttProperties.width+"px;height:"+t+"px;cursor:"+(this.parent.editSettings.allowTaskbarEditing?"move;":"default;")+"</div>",a='<div class="'+ze+'" style="width:'+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;position:absolute;transform: rotate(45deg);top:"+(40<this.parent.rowHeight?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';return this.createDivElement(0===e.ganttProperties.duration&&e.hasChildRecords&&!e.ganttProperties.isAutoSchedule?a+i:t+i)},d.prototype.getParentTaskbarNode=function(e,t){var i,a,n,r,s=null,o=this.templateData,s=this.parentTaskbarTemplateFunction&&0!==o.ganttProperties.autoDuration&&!o.ganttProperties.isMilestone?this.parentTaskbarTemplateFunction(ne.extend({index:e},o),this.parent,"ParentTaskbarTemplate",this.getTemplateID("ParentTaskbarTemplate"),!1,void 0,t[0],this.parent.treeGrid.root):(t="",r=void 0,i=this.taskBarHeight/5,i=this.createDivElement('<div class="e-gantt-parent-taskbar-inner-div '+this.getExpandClass(o)+" "+_e+'" style="width:'+(o.ganttProperties.isAutoSchedule?o.ganttProperties.width:o.ganttProperties.autoWidth)+"px;height:"+(o.ganttProperties.isAutoSchedule?this.taskBarHeight:3*i)+"px;margin-top:"+(o.ganttProperties.isAutoSchedule?-1:2*i)+'px; "></div>'),a=this.createDivElement('<div class="e-gantt-parent-progressbar-inner-div '+this.getExpandClass(o)+" "+Ze+'" style="border-style:'+(o.ganttProperties.progressWidth?"solid;":"none;")+"width:"+o.ganttProperties.progressWidth+"px;border-top-right-radius:"+this.getBorderRadius(o)+"px;border-bottom-right-radius:"+this.getBorderRadius(o)+'px;height:100%;"></div>'),n=ne.createElement("div"),this.taskLabelTemplateFunction?(e=this.taskLabelTemplateFunction(ne.extend({index:e},o),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,a[0]))&&0<e.length&&(ne.append(e,n),t=n.innerHTML,t="isCustomTemplate"===(t=this.getTaskLabel(this.parent.labelSettings.taskLabel))?n.innerHTML:t,this.parent.enableHtmlSanitizer)&&"string"==typeof t&&(t=ne.SanitizeHtmlHelper.sanitize(t)):(t="isCustomTemplate"===(t=this.getTaskLabel(this.parent.labelSettings.taskLabel))?this.parent.labelSettings.taskLabel:t,this.parent.enableHtmlSanitizer&&"string"==typeof t&&(t=ne.SanitizeHtmlHelper.sanitize(t))),-1===t.indexOf("null")&&("isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(t=""),r=isNaN(parseInt(t,10))?'<span class="'+be+'" style="line-height:'+(o[this.parent.taskFields.manual]&&o.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(o.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="'+be+'" style="line-height:'+(o[this.parent.taskFields.manual]&&o.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display:inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(o.ganttProperties.width-10):"")+"px; height:"+(this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display: inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(o.ganttProperties.width-10):"")+"px; height:"+this.taskBarHeight+'px;"></span>',e=this.createDivElement(r)[0],this.parent.disableHtmlEncode?e.innerText=t:e.innerHTML=t,(r=this.parent.labelSettings.taskLabel)&&r.elementRef&&e.appendChild(n),a[0].appendChild(e),""!==a[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(r)&&a[0].querySelectorAll(".e-task-label")[0].children[0]&&this.parent.disableHtmlEncode&&a[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===a[0].querySelectorAll(".e-task-label")[0].textContent)&&r&&!r.elementRef&&""!==n.innerHTML&&(a[0].querySelectorAll(".e-task-label")[0].textContent=r),t='<div class="e-gantt-parent-milestone" style="width:'+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;height:"+(this.parent.renderBaseline?this.taskBarHeight-3:this.taskBarHeight-7)+"px;position:absolute;transform: rotate(45deg);top:"+(40<this.parent.rowHeight?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>',i[0].appendChild([].slice.call(a)[0]),o.ganttProperties.isMilestone?this.createDivElement(o.ganttProperties.isAutoSchedule?t:""):i);return this.parent.enableRtl&&s[0]&&s[0].querySelector(".e-task-label")&&(s[0].querySelector(".e-task-label").style.marginLeft="15px",s[0].querySelector(".e-task-label").style.marginRight="8px",s[0].querySelector(".e-gantt-parent-progressbar"))&&(s[0].querySelector(".e-gantt-parent-progressbar").style.textAlign="left"),s},d.prototype.getTableTrNode=function(e){var t,i,a=this,n=ne.createElement("table"),r="Horizontal"===this.parent.gridLines||"Both"===this.parent.gridLines?"e-chart-row-border":"",s=(this.parent.treeGridModule.isPersist?setTimeout(function(){ne.isNullOrUndefined(a.parent.treeGrid.grid)||ne.isNullOrUndefined(a.parent.treeGrid.grid.contentModule)||ne.isNullOrUndefined(a.parent.treeGrid.grid.contentModule.getRows())||(i=a.parent.treeGrid.grid.contentModule.getRows()[e],t=i&&i.isSelected?"e-active":"")},0):(i=this.parent.treeGrid.grid.contentModule.getRows()[e],t=i&&i.isSelected?"e-active":""),n.querySelector("tbody")),o=(s||(s=document.createElement("tbody"),n.appendChild(s)),document.createElement("tr")),l=(o.classList.add(this.getRowClassName(this.templateData),Oe),t&&o.classList.add(t),o.style.display=this.getExpandDisplayProp(this.templateData),o.style.height=this.parent.rowHeight+"px",document.createElement("td"));return r?l.classList.add(Me,r):l.classList.add(Me),l.style.width=this.parent.timelineModule.totalTimelineWidth+"px",o.appendChild(l),s.appendChild(o),n.childNodes},d.prototype.initializeChartTemplate=function(){ne.isNullOrUndefined(this.parent.parentTaskbarTemplate)||(this.parentTaskbarTemplateFunction=this.templateCompiler(this.parent.parentTaskbarTemplate)),!ne.isNullOrUndefined(this.parent.labelSettings.leftLabel)&&this.isTemplate(this.parent.labelSettings.leftLabel)&&(this.leftTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.leftLabel)),!ne.isNullOrUndefined(this.parent.labelSettings.rightLabel)&&this.isTemplate(this.parent.labelSettings.rightLabel)&&(this.rightTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.rightLabel)),!ne.isNullOrUndefined(this.parent.labelSettings.taskLabel)&&this.isTemplate(this.parent.labelSettings.taskLabel)&&(this.taskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.taskLabel)),ne.isNullOrUndefined(this.parent.taskbarTemplate)||(this.childTaskbarTemplateFunction=this.templateCompiler(this.parent.taskbarTemplate)),ne.isNullOrUndefined(this.parent.milestoneTemplate)||(this.milestoneTemplateFunction=this.templateCompiler(this.parent.milestoneTemplate))},d.prototype.createDivElement=function(e){var t=document.createElement("div");return this.parseTemplate(e).forEach(function(e){return t.appendChild(e)}),t.childNodes},d.prototype.parseTemplate=function(e){var t=this;return this.parseHtmlStringToElementTree(e).map(function(e){return t.constructElementFromNode(e)})},d.prototype.parseHtmlStringToElementTree=function(e){for(var t=[],i=[],a=0;null!==(o=this.tagRegex.exec(e));){var n=o[0],r=o[1],s=o[2],s=void 0===s?"":s,o=e.substring(a,o.index).trim(),a=this.tagRegex.lastIndex,r={tagName:r,attributes:s,children:[]};n.startsWith("</")?(0<i.length&&o&&(i[i.length-1].value=o),i.pop()):n.endsWith("/>")||((0<i.length?i[i.length-1].children:t).push(r),i.push(r))}return t},d.prototype.constructElementFromNode=function(e){var t=this,i=document.createElement(e.tagName);return e.value&&(i.textContent=e.value),this.setAttributes(i,e.attributes),e.children.forEach(function(e){e=t.constructElementFromNode(e);i.appendChild(e)}),i},d.prototype.setAttributes=function(e,t){for(t=t.replace(/style=([^"'\s][^ >]*)/g,'style="$1"');null!==(a=this.attributeRegex.exec(t));){var i=a[1],a=a[2];"class"===i?e.className=a:"style"===i?e.style.cssText=this.cleanStyleString(a):e.setAttribute(i,a)}},d.prototype.cleanStyleString=function(e){return e.split(";").map(function(e){return e.trim()}).filter(Boolean).join("; ")},d.prototype.isTemplate=function(e){for(var t=!1,i=0;i<this.parent.ganttColumns.length;i++)if(e===this.parent.ganttColumns[i].field){t=!0;break}return t="string"!=typeof e||0===e.indexOf("#")||-1<e.indexOf("<")||-1<e.indexOf("$")||!t},d.prototype.getTemplateID=function(e){return this.parent.element.id+e},d.prototype.leftLabelContainer=function(){var e='<div class="'+(this.leftTaskLabelTemplateFunction?"e-left-label-container e-left-label-temp-container":me)+' " tabindex="-1" role="term" style="height:'+(this.parent.rowHeight-2)+"px;width:"+this.taskNameWidth(this.templateData)+'"></div>';return this.createDivElement(e)},d.prototype.taskbarContainer=function(){var e=this.templateData,t=!(!this.parent.editModule||!this.parent.editSettings.allowTaskbarEditing||"ParentResizing"!==this.parent.editModule.taskbarEditModule.taskBarEditAction),t='<div class="'+P+" "+this.parent.getUnscheduledTaskClass(e.ganttProperties)+" "+(e.ganttProperties.cssClass||"")+'"  tabindex="-1" role="term" style="'+(!e.ganttProperties.isMilestone||t||e.hasChildRecords&&!e.ganttProperties.isAutoSchedule?"width:"+e.ganttProperties.width+"px;margin-top:"+this.taskBarMarginTop+"px;"+(this.parent.enableRtl?"right:":"left:")+(!e.hasChildRecords||e.ganttProperties.isAutoSchedule?e.ganttProperties.left:e.ganttProperties.autoLeft)+"px;height:"+this.taskBarHeight+"px;cursor:"+(this.parent.editSettings.allowTaskbarEditing?"move;":"default;"):"width:"+this.milestoneHeight+"px;height:"+this.milestoneHeight+"px;margin-top:"+this.milestoneMarginTop+"px;"+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.left-this.milestoneHeight/2)+"px;cursor:"+(this.parent.editSettings.allowTaskbarEditing?"move;":"default;"))+'"></div>';return this.createDivElement(t)},d.prototype.rightLabelContainer=function(){var e='<div class="'+(this.rightTaskLabelTemplateFunction?"e-right-label-container e-right-label-temp-container":De)+'"  tabindex="-1" role="term" style="'+(this.parent.enableRtl?"right:":"left:")+this.getRightLabelLeft(this.templateData)+"px; height:"+(this.parent.rowHeight-2)+'px;"></div>';return this.createDivElement(e)},d.prototype.childTaskbarLeftResizer=function(){var e=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?5:-2,e='<div class="'+Ie+" "+Ve+'"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>';return this.createDivElement(e)},d.prototype.childTaskbarRightResizer=function(){var e=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?-17:-11,e='<div class="'+Ee+" "+Ve+'"style="'+(this.parent.enableRtl?"right:":"left:")+(this.templateData.ganttProperties.width+e)+"px;height:"+this.taskBarHeight+'px;z-index:1"></div>';return this.createDivElement(e)},d.prototype.childTaskbarProgressResizer=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6,e='<div class="'+Fe+'"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+Ue+'"><div class="'+Ne+'"></div><div class="'+Le+'"></div></div>';return this.createDivElement(e)},d.prototype.getLeftPointNode=function(){var e=this.templateData,t=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?12:0,i=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?6:3,t=-(2+this.connectorPointWidth+t),i=-(this.connectorPointWidth+i),a=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2),n=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px",r=!0,a=(e.hasChildRecords&&!this.parent.allowParentDependency&&(r=!1),'<div class="e-left-connectorpoint-outer-div" style="'+(e.ganttProperties.isMilestone?"margin-top:"+a+"px;left:"+i+"px;":n+";left:"+t+"px;")+'"><div class="'+(r?ot:"")+" "+this.parent.getUnscheduledTaskClass(e.ganttProperties)+'" style="width: '+this.connectorPointWidth+"px;"+(this.parent.enableRtl?"margin-right:2px;":"")+"height: "+this.connectorPointWidth+'px;">'+this.touchLeftConnectorpoint+"</div></div>");return this.createDivElement(a)},d.prototype.getRightPointNode=function(){var e=this.templateData,t=-(3+(!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?-12:0)),i=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2),a=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px",n=!0,i=(e.hasChildRecords&&!this.parent.allowParentDependency&&(n=!1),'<div class="'+pt+'" style="'+(e.ganttProperties.isMilestone?"left:"+(!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?this.milestoneHeight+5:this.milestoneHeight-2)+"px;margin-top:"+i+"px;":"left:"+(e.ganttProperties.width+t)+"px;"+a+";")+'"><div class="'+(n?lt:"")+" "+this.parent.getUnscheduledTaskClass(e.ganttProperties)+'" style="width:'+this.connectorPointWidth+"px;height:"+this.connectorPointWidth+'px;">'+this.touchRightConnectorpoint+"</div></div>");return this.createDivElement(i)},d.prototype.getTaskLabel=function(e){var t=this.parent.ganttColumns.length,i=null;if(ne.isNullOrUndefined(e)||""===e)i="";else if(e===this.parent.taskFields.resourceInfo)i=this.getResourceName(this.templateData);else{for(var a=0;a<t;a++)if(e===this.parent.ganttColumns[a].field){i=this.getFieldValue(this.templateData[e]).toString();break}if(ne.isNullOrUndefined(i))return"isCustomTemplate"}return i},d.prototype.getExpandDisplayProp=function(e){return e=this.templateData,this.parent.getExpandStatus(e)?"table-row":"none"},d.prototype.getRowClassName=function(e){var t="gridrowtaskId",i=(e=this.templateData).parentItem;return i&&(t+=i.taskId.toString()),t=(t+="level")+e.level.toString()},d.prototype.getBorderRadius=function(e){e=(e=this.templateData).ganttProperties.width-e.ganttProperties.progressWidth;return e<=4?4-e:0},d.prototype.getSplitTaskBorderRadius=function(e){e=e.width-e.progressWidth;return e<=4?4-e:0},d.prototype.taskNameWidth=function(e){var t=(e=this.templateData).ganttProperties,t=e.ganttProperties.isMilestone?e.ganttProperties.left-this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!t.isAutoSchedule?this.parent.allowUnscheduledTasks?t.left<t.autoLeft?t.left:t.autoLeft:t.autoStartDate.getTime()<t.startDate.getTime()?t.autoLeft:t.left:e.ganttProperties.left;return(t=t<0?0:t)+"px"},d.prototype.getRightLabelLeft=function(e){var t,i=(e=this.templateData).ganttProperties;return e.ganttProperties.isMilestone?e.ganttProperties.left+this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!i.isAutoSchedule?(i=this.parent.allowUnscheduledTasks?(t=i.left<i.autoLeft?i.autoLeft:i.left,i.autoWidth):(t=i.autoStartDate.getTime()<i.startDate.getTime()?i.autoLeft:i.left,(i.autoEndDate.getTime()<i.endDate.getTime()?this.parent.dataOperation.getTaskLeft(i.endDate,i.isMilestone):this.parent.dataOperation.getTaskLeft(i.autoEndDate,i.isMilestone))-t),t+i):e.ganttProperties.left+e.ganttProperties.width},d.prototype.getExpandClass=function(e){return(e=this.templateData).expanded?"e-row-expand":!e.expanded&&e.hasChildRecords?"e-row-collapse":""},d.prototype.getFieldValue=function(e){return ne.isNullOrUndefined(e)?"":e},d.prototype.getResourceName=function(e){e=this.templateData;var t=null;if(!ne.isNullOrUndefined(e.ganttProperties.resourceInfo)){var i=e.ganttProperties.resourceInfo.length;if(0<i){for(var a=0;a<i;a++){var n=e.ganttProperties.resourceInfo[a][this.parent.resourceFields.name],r=e.ganttProperties.resourceInfo[a][this.parent.resourceFields.unit];100!==r&&(n+="["+r+"%]"),ne.isNullOrUndefined(t)?t=n:t+=" , "+n}return t}}return""},d.prototype.initChartHelperPrivateVariable=function(){var e=this.parent.renderBaseline?.45:!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,t=this.parent.renderBaseline?4:2,i=this.parent.renderBaseline?1.13:.82;this.parent.rowHeight=ne.isNullOrUndefined(this.parent.rowHeight)?36:this.parent.rowHeight,this.baselineColor=ne.isNullOrUndefined(this.parent.baselineColor)||""===this.parent.baselineColor?null:this.parent.baselineColor,this.taskBarHeight=ne.isNullOrUndefined(this.parent.taskbarHeight)||this.parent.taskbarHeight>=this.parent.rowHeight?Math.floor(this.parent.rowHeight*e):this.parent.taskbarHeight,this.parent.renderBaseline&&(e=void 0,e=this.taskBarHeight+this.baselineHeight<=this.parent.rowHeight?this.taskBarHeight:this.taskBarHeight-(this.baselineHeight+1),this.taskBarHeight=e),this.milestoneHeight=Math.floor(this.taskBarHeight*i),this.taskBarMarginTop=Math.floor((this.parent.rowHeight-this.taskBarHeight)/t),this.milestoneMarginTop=Math.floor((this.parent.rowHeight-this.milestoneHeight)/2),this.milesStoneRadius=Math.floor(this.milestoneHeight/2),this.baselineTop=-(Math.floor(this.parent.rowHeight-(this.taskBarHeight+this.taskBarMarginTop))-4),this.connectorPointWidth=this.parent.isAdaptive?Math.round(this.taskBarHeight/2):9,this.connectorPointMargin=Math.floor(this.taskBarHeight/2-this.connectorPointWidth/1.5)},d.prototype.refreshGanttRows=function(){if(this.parent.currentViewData=this.parent.treeGrid.getCurrentViewRecords().slice(),this.createTaskbarTemplate(),this.parent.showOverAllocation){for(var e=0;e<this.parent.currentViewData.length;e++){var t=this.parent.currentViewData[e];0<t.childRecords.length&&(this.parent.setRecordValue("workTimelineRanges",this.parent.dataOperation.mergeRangeCollections(t.ganttProperties.workTimelineRanges,!0),t.ganttProperties,!0),this.parent.dataOperation.calculateRangeLeftWidth(t.ganttProperties.workTimelineRanges))}this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)}this.parent.ganttChartModule.updateLastRowBottomWidth()},d.prototype.createTaskbarTemplate=function(){var e,t=this,i=[].slice.call(this.ganttChartTableBody.querySelectorAll("tr")),a=(this.ganttChartTableBody.innerHTML="",[]),n=this.parent.treeGridModule.prevCurrentView;if(this.refreshedTr=[],this.refreshedData=[],this.parent.enableImmutableMode&&n&&0<n.length&&this.isUpdated){for(var r={},s=[],o=this.parent.treeGrid.getPrimaryKeyFieldNames()[0],l=0;l<n.length;l++)s[l]=i[l],r[n[l][o]]=l;for(var d=0;d<this.parent.currentViewData.length;d++){var h=r[this.parent.currentViewData[d][o]],p=this.parent.modifiedRecords.indexOf(this.parent.currentViewData[d]);ne.isNullOrUndefined(h)||-1!==p||this.parent.isFromRenderBaseline?(g=this.getGanttChartRow(d,this.parent.currentViewData[d]),this.ganttChartTableBody.appendChild(g),this.refreshedTr.push(this.ganttChartTableBody.querySelectorAll("tr")[d]),this.refreshedData.push(this.parent.currentViewData[d])):this.ganttChartTableBody.appendChild(s[h]),this.ganttChartTableBody.querySelectorAll("tr")[d].setAttribute("aria-rowindex",(d+1).toString())}}else{for(var u=ne.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"}),l=0;l<this.parent.currentViewData.length;l++){var c=this.parent.currentViewData[l],g=(!c.expanded&&this.parent.enableMultiTaskbar&&a.push(c),this.getGanttChartRow(l,c));c.hasChildRecords&&!c.expanded&&this.parent.enableMultiTaskbar&&!this.parent.allowTaskbarOverlap&&this.updateDragDropRecords(c,g),u.appendChild(g),this.parent.enableImmutableMode&&(this.refreshedTr.push(u.querySelectorAll("tr")[l]),this.refreshedData.push(this.parent.currentViewData[l])),this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.maintainSelectedRecords(parseInt(g.getAttribute("aria-rowindex"),10)-1)}(e=this.ganttChartTableBody).replaceChildren.apply(e,u.childNodes),this.ganttChartTableBody.childNodes.forEach(function(e){e instanceof Element&&(e.addEventListener("touchmove",t.handleTouchMove),e.addEventListener("touchend",t.handleTouchEnd))}),this.parent.initialChartRowElements=this.parent.ganttChartModule.getChartRows()}if(this.parent.enableCriticalPath&&this.parent.criticalPathModule&&(e=this.parent.criticalPathModule).criticalPathCollection&&this.parent.criticalPathModule.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds),this.parent.renderTemplates(),this.triggerQueryTaskbarInfo(),this.parent.modifiedRecords=[],this.parent.showOverAllocation&&this.updateOverlapped(),a.length)for(var f=0;f<a.length;f++)a[f].hasChildRecords&&(this.parent.isGanttChartRendered=!0,this.parent.chartRowsModule.refreshRecords([a[f]]));this.parent.isGanttChartRendered=!0,this.parent.renderTemplates()},d.prototype.getGanttChartRow=function(e,t){this.templateData=t;var i,a,n=this.getTableTrNode(e),r=this.getLeftLabelNode(e);if((o=this.taskbarContainer())[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),o[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID),i=this.getLeftPointNode(),(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)&&o[0].appendChild([].slice.call(i)[0]),this.templateData.hasChildRecords){var s=void 0;if(!this.parent.enableMultiTaskbar||this.parent.enableMultiTaskbar&&this.templateData.expanded)s=this.getParentTaskbarNode(e,o);else for(var o=[],l=0;l<this.templateData.childRecords.length;l++){this.templateData=this.templateData.childRecords[l];var d=this.taskbarContainer();d[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),d[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID),this.parent.allowParentDependency?(i=this.getLeftPointNode(),!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords||d[0].appendChild([].slice.call(i)[0])):(i=this.getLeftPointNode(),d[0].appendChild([].slice.call(i)[0])),this.appendChildTaskbars(t,e,d,a,o)}this.templateData.ganttProperties.isAutoSchedule||(h=this.getManualTaskbar(),ne.isNullOrUndefined(h[0]))||(this.parent.allowParentDependency&&(i=this.getLeftPointNode(),h[0].appendChild([].slice.call(i)[0]),p=this.getRightPointNode(),h[0].appendChild([].slice.call(p)[0])),o[0].appendChild([].slice.call(h)[0])),0!==this.templateData.ganttProperties.autoDuration&&!this.templateData.ganttProperties.isMilestone&&s&&0<s.length?ne.append(s,o[0]):0===this.templateData.ganttProperties.duration&&this.templateData.ganttProperties.isMilestone&&this.templateData.ganttProperties.isAutoSchedule&&(p=this.getMilestoneNode(e,o))&&0<p.length&&ne.append(p,o[0]),this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(ne.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||ne.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||ne.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||ne.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode()),!(!this.parent.enableMultiTaskbar||this.parent.enableMultiTaskbar&&this.templateData.expanded)||(this.parent.allowParentDependency&&(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)||!this.parent.allowParentDependency)&&(a=this.getRightPointNode(),o[0].appendChild([].slice.call(a)[0]))}else this.appendChildTaskbars(t,e,o,a);var h=this.getRightLabelNode(e);if(this.parent.enableMultiTaskbar&&this.templateData.hasChildRecords&&!this.templateData.expanded){s=ne.createElement("div",{className:"e-collapse-parent"});n[0].childNodes[0].childNodes[0].appendChild(s);for(l=0;l<o.length;l++)ne.addClass([o[l]],"collpse-parent-border"),n[0].childNodes[0].childNodes[0].childNodes[0].appendChild([].slice.call(o)[l]);n[0].childNodes[0].childNodes[0].appendChild([].slice.call(r)[0]),this.templateData.ganttProperties.indicators&&0<this.templateData.ganttProperties.indicators.length&&this.appendIndicators(e,n)}else n[0].childNodes[0].childNodes[0].appendChild([].slice.call(r)[0]),n[0].childNodes[0].childNodes[0].appendChild([].slice.call(o)[0]),this.templateData.ganttProperties.indicators&&0<this.templateData.ganttProperties.indicators.length&&this.appendIndicators(e,n),h&&0<h.length&&n[0].childNodes[0].childNodes[0].appendChild([].slice.call(h)[0]);ne.isNullOrUndefined(this.taskBaselineTemplateNode)||n[0].childNodes[0].childNodes[0].appendChild([].slice.call(this.taskBaselineTemplateNode)[0]),this.taskBaselineTemplateNode=null;var p=n[0].childNodes[0];return this.setAriaRowIndex(t,p),p},d.prototype.setAriaRowIndex=function(t,e){var i,a=this,n=this.parent.treeGrid.getCurrentViewRecords(),n=this.parent.virtualScrollModule&&this.parent.enableVirtualization?ne.getValue("virtualScrollModule.visualData",this.parent.treeGrid):n;this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping?(i=this.parent.treeGrid.grid.contentModule.rows.filter(function(e){if(e.data[a.parent.taskFields.id]===t.ganttProperties.taskId)return e})[0],e.setAttribute("data-rowindex",i.index.toString()),e.setAttribute("aria-rowindex",(i.index+1).toString())):(i=n.indexOf(t),e.setAttribute("aria-rowindex",(i+1).toString()))},d.prototype.triggerQueryTaskbarInfo=function(){if(this.parent.queryTaskbarInfo)for(var e=(this.parent.enableImmutableMode?this.refreshedTr:this.ganttChartTableBody.querySelectorAll("tr")).length,t=0;t<e;t++){var i=(this.parent.enableImmutableMode?this.refreshedTr:this.ganttChartTableBody.querySelectorAll("tr"))[t],a=(0<this.refreshedData.length?this.refreshedData:this.parent.currentViewData)[t],n=!ne.isNullOrUndefined(a.ganttProperties.segments)&&a.ganttProperties.segments.length;if(0<n)for(var r=0;r<n;r++){var s=i.getElementsByClassName("e-segmented-taskbar")[r];this.triggerQueryTaskbarInfoByIndex(s,a)}else i&&this.triggerQueryTaskbarInfoByIndex(i,a)}},d.prototype.appendIndicators=function(e,t){for(var i,a,n=this.templateData.ganttProperties.indicators,r=0;r<n.length;r++)(a=this.getIndicatorNode(n[r]))[0].setAttribute("aria-label",n[r].name),i=-1<n[r].name.indexOf("$")||-1<n[r].name.indexOf("#")?this.templateCompiler(n[r].name)(ne.extend({index:e},this.templateData),this.parent,"indicatorLabelText"):((i=ne.createElement("Text")).innerHTML=n[r].name,this.parent.enableHtmlSanitizer&&"string"==typeof n[r].name&&(n[r].name=ne.SanitizeHtmlHelper.sanitize(n[r].name)),i.childNodes),a[0].appendChild([].slice.call(i)[0]),a[0].title=ne.isNullOrUndefined(n[r].tooltip)?"":n[r].tooltip,t[0].childNodes[0].childNodes[0].appendChild([].slice.call(a)[0])},d.prototype.appendChildTaskbars=function(e,t,i,a,n){if(this.templateData.ganttProperties.isMilestone){var r=this.getMilestoneNode(t,i);r&&0<r.length&&ne.append(r,i[0]),this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(ne.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||ne.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||ne.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||ne.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode()),n&&(n.push(i[0]),this.templateData=e)}else{var r=j(this.templateData.ganttProperties),s=null,o=null,l=null;if(!ne.isNullOrUndefined(r)){(r||this.templateData.ganttProperties.duration)&&r&&(ne.isNullOrUndefined(this.templateData.ganttProperties.segments)||this.templateData.ganttProperties.segments.length<=0)&&(s=this.childTaskbarProgressResizer(),l=this.childTaskbarLeftResizer(),o=this.childTaskbarRightResizer());var d=this.getChildTaskbarNode(t,i);if(l&&i[0].appendChild([].slice.call(l)[0]),d&&0<d.length)if(this.templateData.ganttProperties.segments&&0<this.templateData.ganttProperties.segments.length){var h=this.templateData.ganttProperties.segments.length,r=this.createDivElement('<div class="e-gantt-split-container-line"></div>');i[0].appendChild([].slice.call(r)[0]);for(var p=0;p<h;p++)ne.append(d,i[0])}else ne.append(d,i[0]);s&&i[0].appendChild([].slice.call(s)[0]),o&&i[0].appendChild([].slice.call(o)[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(this.taskBaselineTemplateNode=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(ne.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||ne.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||ne.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||ne.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}(this.parent.allowParentDependency&&(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)||!this.parent.allowParentDependency)&&(a=this.getRightPointNode(),i[0].appendChild([].slice.call(a)[0])),n&&(n.push(i[0]),this.templateData=e)},d.prototype.customizeTaskbars=function(e,t,i){var a,n,r,s=this,e=(e.ganttProperties.segments&&0<e.ganttProperties.segments.length&&t&&t.parentElement&&t.parentElement.parentElement&&t.parentElement.parentElement.parentElement&&(a=t.parentElement.parentElement.parentElement),{data:e,rowElement:t,taskbarElement:i,taskbarType:e.hasChildRecords?"ParentTask":e.ganttProperties.isMilestone?"Milestone":"ChildTask"}),o=this.getClassName(e);"Milestone"===e.taskbarType?(e.milestoneColor=i.querySelector(o[0])?getComputedStyle(i.querySelector(o[0])).backgroundColor:null,e.baselineColor=t.querySelector(o[1])?getComputedStyle(t.querySelector(o[1])).backgroundColor:t.querySelector("."+Ce)?getComputedStyle(t.querySelector("."+Ce)).backgroundColor:null):i&&(n=i.querySelector(o[0]),r=i.querySelector(o[1]),e.taskbarBgColor=ne.isNullOrUndefined(n)?null:(i.classList.contains(Ae)?getComputedStyle(i):getComputedStyle(i.querySelector(o[0]))).backgroundColor,e.taskbarBorderColor=ne.isNullOrUndefined(n)?null:i.classList.contains(Ae)?getComputedStyle(i).backgroundColor:getComputedStyle(i.querySelector(o[0])).outlineColor,e.progressBarBgColor=ne.isNullOrUndefined(r)?null:(i.classList.contains(We)?getComputedStyle(i):getComputedStyle(i.querySelector(o[1]))).backgroundColor,e.baselineColor=a?a.querySelector("."+Ce)?getComputedStyle(a.querySelector("."+Ce)).backgroundColor:null:t.querySelector("."+Ce)?getComputedStyle(t.querySelector("."+Ce)).backgroundColor:null,e.taskLabelColor=i.querySelector("."+be)?getComputedStyle(i.querySelector("."+be)).color:null),a?(e.rightLabelColor=a.querySelector("."+De)&&a.querySelector("."+De).querySelector("."+l)?getComputedStyle(a.querySelector("."+De).querySelector("."+l)).color:null,e.leftLabelColor=a.querySelector("."+me)&&a.querySelector("."+me).querySelector("."+l)?getComputedStyle(a.querySelector("."+me).querySelector("."+l)).color:null):(e.rightLabelColor=t.querySelector("."+De)&&t.querySelector("."+De).querySelector("."+l)?getComputedStyle(t.querySelector("."+De).querySelector("."+l)).color:null,e.leftLabelColor=t.querySelector("."+me)&&t.querySelector("."+me).querySelector("."+l)?getComputedStyle(t.querySelector("."+me).querySelector("."+l)).color:null),this.parent.trigger("queryTaskbarInfo",e,function(e){s.updateQueryTaskbarInfoArgs(e,void 0,void 0)})},d.prototype.triggerQueryTaskbarInfoByIndex=function(e,t){if(!ne.isNullOrUndefined(e)){var i=t;if(!ne.isNullOrUndefined(t.ganttProperties.segments)&&0<t.ganttProperties.segments.length)(r=e)&&this.customizeTaskbars(t,e,r);else if(this.parent.enableMultiTaskbar)for(var a=e.querySelectorAll("."+P),n=0;n<a.length;n++){var r=a[n],i=!t.expanded&&t.hasChildRecords?t.childRecords[n]:i,s="ResourceView"===this.parent.viewType?r.getAttribute("rowUniqueId"):i.ganttProperties.taskId.toString();if(i.ganttProperties.segments&&0<i.ganttProperties.segments.length&&i.parentItem&&!t.expanded&&(s="ResourceView"===this.parent.viewType?t.ganttProperties.rowUniqueID:t.ganttProperties.taskId.toString()),e=(e=this.parent.getRowByID(s))||r.querySelector(".e-gantt-child-taskbar"),e=ne.isNullOrUndefined(e)&&i.ganttProperties.isMilestone?r:e){s=e.querySelectorAll(".e-segmented-taskbar");if(s&&0<s.length)for(var o=(e.querySelector('.e-taskbar-main-container[rowuniqueid="'+i.ganttProperties.rowUniqueID+'"]')||e).querySelectorAll(".e-segmented-taskbar"),l=0;l<o.length;l++)r=o[l],this.customizeTaskbars(i,o[l],r);else this.customizeTaskbars(i,e,r)}}else{var d=e.querySelector("."+P);e&&this.customizeTaskbars(i,e,d)}}},d.prototype.updateQueryTaskbarInfoArgs=function(e,t,i){var a,n=e.rowElement,r=this.parent.enableVirtualization?e.rowElement:e.taskbarElement,s=this.getClassName(e);e.data.ganttProperties.segments&&0<e.data.ganttProperties.segments.length&&(a=n.parentElement.parentElement.parentElement),"Milestone"===e.taskbarType?(r.querySelector(s[0])&&getComputedStyle(r.querySelector(s[0])).backgroundColor!==e.milestoneColor&&(r.querySelector(s[0]).style.backgroundColor=e.milestoneColor),n.querySelector(s[1])&&getComputedStyle(n.querySelector(s[1])).backgroundColor!==e.baselineColor&&(n.querySelector(s[1]).style.backgroundColor=e.baselineColor),n.querySelector("."+Ce)&&getComputedStyle(n.querySelector("."+Ce)).borderTopColor!==e.baselineColor&&(n.querySelector("."+Ce).style.backgroundColor=e.baselineColor)):r&&(r.querySelector(s[0])&&getComputedStyle(r.querySelector(s[0])).backgroundColor!==e.taskbarBgColor&&(r.querySelector(s[0]).style.backgroundColor=e.taskbarBgColor),r.querySelector(s[0])&&getComputedStyle(r.querySelector(s[0])).outlineColor!==e.taskbarBorderColor&&(r.querySelector(s[0]).style.outlineColor=e.taskbarBorderColor),r.querySelector(s[1])&&getComputedStyle(r.querySelector(s[1])).backgroundColor!==e.progressBarBgColor&&(r.querySelector(s[1]).style.backgroundColor=e.progressBarBgColor),r.classList.contains(Ae)&&getComputedStyle(r).backgroundColor!==e.taskbarBgColor&&(r.style.backgroundColor=e.taskbarBgColor),r.classList.contains(Ae)&&getComputedStyle(r).outlineColor!==e.taskbarBorderColor&&(r.style.outlineColor=e.taskbarBorderColor),r.classList.contains(We)&&getComputedStyle(r).backgroundColor!==e.progressBarBgColor&&(r.style.backgroundColor=e.progressBarBgColor),r.querySelector("."+be)&&getComputedStyle(r.querySelector("."+be)).color!==e.taskLabelColor&&(r.querySelector("."+be).style.color=e.taskLabelColor),a?a.querySelector("."+Ce)&&getComputedStyle(a.querySelector("."+Ce)).backgroundColor!==e.baselineColor&&(a.querySelector("."+Ce).style.backgroundColor=e.baselineColor):n.querySelector("."+Ce)&&getComputedStyle(n.querySelector("."+Ce)).backgroundColor!==e.baselineColor&&(n.querySelector("."+Ce).style.backgroundColor=e.baselineColor)),a?(a.querySelector("."+me)&&a.querySelector("."+me).querySelector("."+l)&&getComputedStyle(a.querySelector("."+me).querySelector("."+l)).color!==e.leftLabelColor&&(a.querySelector("."+me).querySelector("."+l).style.color=e.leftLabelColor),a.querySelector("."+De)&&a.querySelector("."+De).querySelector("."+l)&&getComputedStyle(a.querySelector("."+De).querySelector("."+l)).color!==e.rightLabelColor&&(a.querySelector("."+De).querySelector("."+l).style.color=e.rightLabelColor)):(n.querySelector("."+me)&&n.querySelector("."+me).querySelector("."+l)&&getComputedStyle(n.querySelector("."+me).querySelector("."+l)).color!==e.leftLabelColor&&(n.querySelector("."+me).querySelector("."+l).style.color=e.leftLabelColor),n.querySelector("."+De)&&n.querySelector("."+De).querySelector("."+l)&&getComputedStyle(n.querySelector("."+De).querySelector("."+l)).color!==e.rightLabelColor&&(n.querySelector("."+De).querySelector("."+l).style.color=e.rightLabelColor))},d.prototype.getClassName=function(e){var t=[];return t.push("."+("ParentTask"===e.taskbarType?_e:"ChildTask"===e.taskbarType?Ae:Be)),t.push("."+("ParentTask"===e.taskbarType?Ze:"ChildTask"===e.taskbarType?We:Re)),t},d.prototype.templateCompiler=function(t){if(!ne.isNullOrUndefined(t)&&""!==t)try{return"function"!=typeof t&&document.querySelectorAll(t).length?ne.compile(document.querySelector(t).innerHTML.trim(),this.parent):ne.compile(t,this.parent)}catch(e){return ne.compile(t,this.parent)}return null},d.prototype.updateOverlapped=function(){for(var e=0;e<this.parent.treeGrid.parentData.length;e++)for(var t=this.parent.treeGrid.parentData[e].childRecords,i=0;i<t.length;i++){t[i+1]&&(t[i].ganttProperties.eOverlapped=void 0);for(var a=i+1;a<t.length;a++)t[a].ganttProperties.eOverlapped=void 0,t[i].ganttProperties.startDate.getTime()<t[a].ganttProperties.endDate.getTime()&&t[i].ganttProperties.endDate.getTime()>t[a].ganttProperties.startDate.getTime()?(t[a].ganttProperties.eOverlapped=!0,t[i].ganttProperties.eOverlapped=!0):(ne.isNullOrUndefined(t[a].ganttProperties.eOverlapped)&&(t[a].ganttProperties.eOverlapped=!1),ne.isNullOrUndefined(t[i].ganttProperties.eOverlapped)&&(t[i].ganttProperties.eOverlapped=!1))}},d.prototype.updateDragDropRecords=function(e,t){var i=e.childRecords,a=this.parent.currentViewData.indexOf(e),n=(this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2]:this.parent.element.getElementsByClassName("e-content")[0]).children[0].offsetHeight,r=(t=t||this.ganttChartTableBody.childNodes[a],this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll?t.style.height=this.parent.treeGrid.getRowByIndex(a).style.height=this.parent.rowHeight+"px":t.style.height=this.parent.treeGrid.getRows()[a].style.height=this.parent.rowHeight+"px",this.parent.contentHeight=n,[]),s=0;if(e){for(var o=0;o<i.length;o++)for(var l=o+1;l<i.length;l++)for(var d=t.getElementsByClassName("e-taskbar-main-container"),h=0;h<d.length;h++){var p=("ResourceView"===this.parent.viewType?i[l]:i[l].ganttProperties).rowUniqueID;i[o].ganttProperties.startDate.getTime()<i[l].ganttProperties.endDate.getTime()&&i[o].ganttProperties.endDate.getTime()>i[l].ganttProperties.startDate.getTime()?d[h].getAttribute("rowuniqueid")===p&&-1===r.indexOf(p)&&(r.push(p),s++,t.children[0].style.verticalAlign="baseline",t.getElementsByClassName("e-taskbar-main-container")[h].style.marginTop=s*this.parent.rowHeight+this.taskBarMarginTop+"px",this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll?t.style.height=this.parent.treeGrid.getRowByIndex(a).style.height=parseInt(t.style.height,10)+this.parent.rowHeight+"px":t.style.height=this.parent.treeGrid.getRows()[a].style.height=parseInt(t.style.height,10)+this.parent.rowHeight+"px"):d[h].getAttribute("rowuniqueid")===p&&-1===r.indexOf(p)&&this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.draggedRecord&&d[h].getAttribute("rowuniqueid")===this.parent.rowDragAndDropModule.draggedRecord.rowUniqueID&&this.parent.rowDragAndDropModule.draggedRecord.rowUniqueID===i[l].rowUniqueID&&(t.getElementsByClassName("e-taskbar-main-container")[h].style.marginTop=this.parent.editModule.taskbarEditModule.draggedRecordMarginTop)}this.parent.contentHeight=(this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2]:this.parent.element.getElementsByClassName("e-content")[0]).children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px"}},d.prototype.refreshRow=function(e,t,i){var a=this,n=this.ganttChartTableBody.childNodes[e],r=(i?this.parent.previousFlatData:this.parent.currentViewData)[e];if(-1!==e&&r){var s,o,l=r,d=(!this.parent.allowTaskbarOverlap&&l.expanded&&(this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll?n.style.height=this.parent.treeGrid.getRowByIndex(e).style.height=this.parent.rowHeight+"px":n.style.height=this.parent.treeGrid.getRows()[e].style.height=this.parent.rowHeight+"px"),l.hasChildRecords&&!l.expanded&&this.parent.enableMultiTaskbar?(n.replaceChild(this.getGanttChartRow(e,l).childNodes[0],n.childNodes[0]),this.parent.renderBaseline&&l.childRecords.forEach(function(e){ne.isNullOrUndefined(e.ganttProperties.baselineStartDate&&e.ganttProperties.baselineEndDate)||n.childNodes[0].appendChild(a.updateTaskBaselineNode(e)[0])})):this.parent.allowTaskbarDragAndDrop&&!l.expanded?n.replaceWith(this.getGanttChartRow(e,l)):(n.replaceChild(this.getGanttChartRow(e,l).childNodes[0],n.childNodes[0]),this.parent.enableMultiTaskbar&&l.parentItem&&(u=l.parentItem.taskId,(s=this.parent.getRecordByID(u)).expanded||(o=this.parent.getRowByID(u)).replaceChild(this.getGanttChartRow(Number(u),s).childNodes[0],o.childNodes[0]))),this.parent.renderTemplates(),this.parent.showOverAllocation&&this.parent.allowTaskbarOverlap&&(l.hasChildRecords||l.parentItem&&this.parent.editedRecords.every(function(e){return e.ganttProperties.taskId.toString()!==l.parentItem.taskId.toString()}))&&(t?this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData):(u=l.hasChildRecords?l:this.parent.getRecordByID(l.parentItem.taskId),this.parent.dataOperation.updateOverlappingValues(u),this.parent.ganttChartModule.renderRangeContainer([u]))),!ne.isNullOrUndefined(l.ganttProperties.segments)&&l.ganttProperties.segments.length);if(0<d)for(var h=0;h<d;h++){var p=n.getElementsByClassName("e-segmented-taskbar")[h];this.triggerQueryTaskbarInfoByIndex(p,l)}else this.triggerQueryTaskbarInfoByIndex(n,l),this.parent.enableMultiTaskbar&&l.parentItem&&this.parent.queryTaskbarInfo&&!this.parent.getParentTask(l.parentItem).expanded&&(s=l.parentItem.index,o=void 0,o=(i?this.parent.previousFlatData:this.parent.currentViewData)[s],this.triggerQueryTaskbarInfoByIndex(this.ganttChartTableBody.querySelectorAll("tr")[s],o));var t="ProjectView"===this.parent.viewType?l.ganttProperties.taskId:l.ganttProperties.rowUniqueID,u=(this.parent.ganttChartModule.isExpandAll||this.parent.ganttChartModule.isCollapseAll||this.parent.treeGrid.grid.setRowData(t,l),l.hasChildRecords&&!l.expanded&&this.parent.enableMultiTaskbar&&!this.parent.allowTaskbarOverlap&&this.updateDragDropRecords(r,n),l.hasChildRecords&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap&&(this.parent.dataOperation.updateOverlappingValues(l),this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)),this.parent.ganttChartModule.tempNextElement),i=(this.parent.ganttChartModule.isEditableElement&&u&&(this.parent.treeGrid.grid.focusModule.focus(),ne.addClass([this.parent.treeGrid.getRows()[parseInt(n.getAttribute("aria-rowindex"),10)-1].children[this.parent.ganttChartModule.childrenIndex]],"e-focused"),this.parent.ganttChartModule.tempNextElement=null),this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[e].getAttribute("data-uid")));ne.isNullOrUndefined(i)||(i.data=l)}},d.prototype.updateResourceTaskbarElement=function(e,t){var i=e.querySelector(".e-taskbar-main-container"),e=("ProjectView"===this.parent.viewType&&e.querySelector(".e-collapse-parent")&&(i=e.querySelector(".e-collapse-parent")),null===e.querySelector(".e-collapse-parent")&&ne.addClass([i],"collpse-parent-border"),e.querySelector("."+P).getAttribute("rowUniqueId")),a=this.parent.getRecordByID(e);if(!ne.isNullOrUndefined(a)&&a.ganttProperties.segments&&0<a.ganttProperties.segments.length)for(var n=i.getElementsByClassName("e-segmented-taskbar"),r=0;r<n.length;r++)this.triggerQueryTaskbarInfoByIndex(n[r],a);else this.parent.queryTaskbarInfo&&(e=i.querySelector(".e-gantt-child-taskbar"),ne.isNullOrUndefined(e)||this.triggerQueryTaskbarInfoByIndex(e,a));e="",a&&!ne.isNullOrUndefined(a.ganttProperties.eOverlapIndex)&&(e=a.ganttProperties.eOverlapIndex.toString()),i=i.cloneNode(!0);i.style.zIndex=e,t[0].childNodes[0].childNodes[0].childNodes[0].appendChild(i)},d.prototype.refreshRecords=function(e,t,i){if(this.parent.isGanttChartRendered){this.parent.renderTemplates(),this.parent.enableMultiTaskbar&&(e=new D.DataManager(e).executeLocal((new D.Query).sortBy("expanded","Descending")));for(var a=0;a<e.length;a++){var n=void 0,n=i?this.parent.ids.indexOf(e[a].ganttProperties.taskId.toString()):this.parent.currentViewData.indexOf(e[a]);this.parent.enableMultiTaskbar&&(!this.parent.enableMultiTaskbar||!e[a].expanded&&this.parent.isLoad)||this.refreshRow(n,t,i)}this.parent.ganttChartModule.updateLastRowBottomWidth()}},d.prototype.removeEventListener=function(){var t=this;this.parent.isDestroyed||(this.ganttChartTableBody.childNodes.forEach(function(e){e instanceof Element&&(e.removeEventListener("touchmove",t.handleTouchMove),e.removeEventListener("touchend",t.handleTouchEnd))}),this.parent.off("renderPanels",this.createChartTable),this.parent.off("dataReady",this.initiateTemplates),this.parent.off("destroy",this.destroy))},d.prototype.destroy=function(){this.removeEventListener()},d.prototype.generateAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),a=this.parent.localeObj.getConstant("startDate"),n=this.parent.localeObj.getConstant("endDate"),r=this.parent.localeObj.getConstant("duration"),s=e.ganttProperties.taskName,o=e.ganttProperties.startDate,l=e.ganttProperties.endDate,d=e.ganttProperties.duration;return e.ganttProperties.isMilestone?t=i+" "+s+" "+a+" "+this.parent.getFormatedDate(o):(s&&(t+=i+" "+s+" "),o&&(t+=a+" "+this.parent.getFormatedDate(o)+" "),l&&(t+=n+" "+this.parent.getFormatedDate(l)+" "),d&&(t+=r+" "+this.parent.getDurationString(d,e.ganttProperties.durationUnit))),t},d.prototype.generateBaselineAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),a=this.parent.localeObj.getConstant("startDate"),n=this.parent.localeObj.getConstant("endDate"),r=e.ganttProperties.taskName,s=e.ganttProperties.baselineStartDate,e=e.ganttProperties.baselineEndDate;return t+"Baseline "+(i+" "+r+" ")+(a+" "+this.parent.getFormatedDate(s)+" ")+(n+" "+this.parent.getFormatedDate(e)+" ")},d.prototype.generateSpiltTaskAriaLabel=function(e,t){var i="",a=this.parent.localeObj.getConstant("startDate"),n=this.parent.localeObj.getConstant("endDate"),r=this.parent.localeObj.getConstant("duration"),s=e.startDate,o=e.endDate,e=e.duration;return s&&(i+=a+" "+this.parent.getFormatedDate(s)+" "),o&&(i+=n+" "+this.parent.getFormatedDate(o)+" "),e&&(i+=r+" "+this.parent.getDurationString(e,t.durationUnit)),i},d.prototype.generateTaskLabelAriaLabel=function(e){var t="";return"left"===e&&this.parent.labelSettings.leftLabel&&!this.leftTaskLabelTemplateFunction?t+=this.parent.localeObj.getConstant("leftTaskLabel")+" "+this.getTaskLabel(this.parent.labelSettings.leftLabel):"right"===e&&this.parent.labelSettings.rightLabel&&!this.rightTaskLabelTemplateFunction&&(t+=this.parent.localeObj.getConstant("rightTaskLabel")+" "+this.getTaskLabel(this.parent.labelSettings.rightLabel)),t};var ea,ta,ia=d;function d(e){var t=ta.call(this,e)||this;return t.taskBarHeight=0,t.milestoneHeight=0,t.milesStoneRadius=0,t.baselineTop=0,t.baselineHeight=8,t.touchLeftConnectorpoint="",t.touchRightConnectorpoint="",t.dropSplit=!1,t.refreshedTr=[],t.refreshedData=[],t.isUpdated=!0,t.tagRegex=/<\/?(\w+)([^>]*?)(\/?)>/g,t.attributeRegex=/([\w-]+)\s*=\s*"([^"]*)"/g,t.taskBaselineTemplateNode=null,t.handleTouchMove=function(e){t.parent.ganttChartModule.ganttChartMove(e)},t.handleTouchEnd=function(e){t.parent.ganttChartModule.documentMouseUp(e)},t.parent=e,t.initPublicProp(),t.addEventListener(),t}u.prototype.ensurePredecessorCollection=function(){var e=this.parent.predecessorsCollection,t=this.parent.flatData,i=new Map;if(null!=t)for(var a=0,n=t;a<n.length;a++){var r=n[a];i.set(r.ganttProperties.rowUniqueID.toString(),r)}for(var s=0,o=e;s<o.length;s++){var l=o[s];(l.hasChildRecords||this.parent.allowParentDependency)&&!this.parent.allowParentDependency||this.ensurePredecessorCollectionHelper(l,l.ganttProperties,i)}},u.prototype.ensurePredecessorCollectionHelper=function(e,t,i){void 0===i&&(i=null);var a=t.predecessorsName;if(!a||"string"!=typeof a&&"number"!=typeof a){if(a&&"object"==typeof a&&a.length){for(var n=[],r=0;r<a.length;r++){var s=a[r],o={},l=(o.from=ne.getValue("from",s)?ne.getValue("from",s):a[r],o.to=ne.getValue("to",s)?ne.getValue("to",s):t.rowUniqueID,o.type=ne.getValue("type",s)?ne.getValue("type",s):"FS",ne.getValue("offset",s));ne.isNullOrUndefined(l)?(o.offset=0,ne.isNullOrUndefined(this.parent.durationUnit)||(o.offsetUnit=this.parent.durationUnit.toLocaleLowerCase())):"string"==typeof l?(s=this.getOffsetDurationUnit(ne.getValue("offset",s)),o.offset=s.duration,o.offsetUnit=s.durationUnit):(o.offset=parseFloat(l.toString()),ne.isNullOrUndefined(this.parent.durationUnit)||(o.offsetUnit=this.parent.durationUnit.toLocaleLowerCase())),this.checkIsParent(o.from.toString())||n.push(o)}this.parent.setRecordValue("predecessor",n,t,!0)}}else this.parent.setRecordValue("predecessor",this.calculatePredecessor(a,e,i),t,!0);this.parent.setRecordValue("predecessorsName",this.getPredecessorStringValue(e),t,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,t.predecessorsName,e),this.parent.setRecordValue(this.parent.taskFields.dependency,t.predecessorsName,e)},u.prototype.updateUnscheduledDependency=function(e){for(var t=this.parent.taskFields,i=ne.isNullOrUndefined(e[t.dependency])?[]:e[t.dependency].toString().split(","),a=0;a<i.length;a++){var n=parseInt(i[a],10);if(!isNaN(n)){var n=this.parent.connectorLineModule.getRecordByID(n.toString()),r=ne.isNullOrUndefined(n)?null:ne.extend({},{},n.taskData,!0);if(!ne.isNullOrUndefined(r)&&ne.isNullOrUndefined(r[t.startDate])&&ne.isNullOrUndefined(r[t.duration])&&ne.isNullOrUndefined(r[t.endDate])){r[t.duration]=1;var s=void 0;if(n.parentItem){for(var o=this.parent.getParentTask(n.parentItem);o&&!o.ganttProperties.startDate;)o=this.parent.getParentTask(o.parentItem);s=o?o.ganttProperties.startDate:this.parent.cloneProjectStartDate}else s=this.parent.cloneProjectStartDate;r[t.startDate]=s,this.parent.updateRecordByID(r)}}}},u.prototype.checkIsParent=function(e){var t=!1;return t=this.parent.connectorLineModule.getRecordByID(e).hasChildRecords?!0:t},u.prototype.getRootParent=function(t){var e=t;return t.parentItem&&(e=this.parent.flatData.filter(function(e){return e.uniqueID===t.parentUniqueID})[0]).parentItem?this.getRootParent(e):e},u.prototype.validateParentPredecessor=function(e,t){if(e&&t)if(t.hasChildRecords&&!e.hasChildRecords){if(e.parentUniqueID===t.uniqueID)return!1;do{if(e.parentItem&&(e=this.parent.flatData[this.parent.ids.indexOf(e.parentItem.taskId)]).uniqueID===t.uniqueID)return!1}while(e.parentItem)}else if(!t.hasChildRecords&&e.hasChildRecords){if(t.parentUniqueID===e.uniqueID)return!1;do{if(t.parentItem&&(t=this.parent.flatData[this.parent.ids.indexOf(t.parentItem.taskId)]).uniqueID===e.uniqueID)return!1}while(t.parentItem)}else if(t.hasChildRecords&&e.hasChildRecords)if(t.parentItem&&e.parentItem){if(e.parentUniqueID===t.uniqueID||e.uniqueID===t.parentUniqueID)return!1}else if(!t.parentItem&&e.parentItem){if(this.getRootParent(e).uniqueID===t.uniqueID)return!1}else if(t.parentItem&&!e.parentItem)if(this.getRootParent(t).uniqueID===e.uniqueID)return!1;return!0},u.prototype.calculatePredecessor=function(e,l,d){var h,p,u,c=this,e=(void 0===d&&(d=null),e.toString()),g=[],f=[],m=[],a=(e.split(",").forEach(function(e){var t,i,a,n,r=!1,s=!1,o=e.split("-"),o=(6===o.length&&(o[4]=o[4]+"-"+o[5],o.pop()),5===o.length&&12<=o[4].length&&(i=e.substring(0,36),/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(i))&&(r=!0),e.includes("-")&&(i=e.lastIndexOf("-"),i=e.substring(i+1),a=((a=e.replace(i,"").trim().match(/(FS|SS|SF|FF)-$/))?a[0]:"")+i,a=a=/^(FS|SS|SF|FF)/.test(a)?a:(i=a.match(/(FS|SS|SF|FF)/))?i[0]+a.slice(a.indexOf(i[0])+i[0].length):e,e.includes("-"))&&/[A-Za-z]/.test(a)&&-1!==(i=e.indexOf(a))&&(n=e.substring(0,i)).includes("-")&&(s=!0),r?(r=i=void 0,1===(i=o[4].split("+")).length?f[0]=e:(r=i[1].length,f[0]=e.slice(0,-(r+1)),f[1]=i[1]),p="+",0<=o[4].indexOf("-")&&(1===(i=o[4].split("-")).length?f[0]=e:(r=i[1].length,f[0]=e.slice(0,-(r+1)),f[1]=i[1]),p="-")):s&&n.includes("-")?f[0]=n:(f=e.split("+"),p="+",0<=e.indexOf("-")&&(f=e.split("-"),p="-")),h=[],"ResourceView"===c.parent.viewType?c.parent.getTaskIds():c.parent.ids),r=(-1===("ResourceView"===c.parent.viewType?o.indexOf("T"+f[0]):o.indexOf(f[0]))&&-1===o.indexOf(f[0])?1===(h=f[0].split(" ")).length&&(-1!==h[0].indexOf(" ")?h=f[0].match(/(\d+|[A-z]+)/g):(h[0]=f[0].slice(0,-2),h[1]=f[0].slice(-2))):h[0]=f[0],"ResourceView"===c.parent.viewType?o.indexOf("T"+h[0]):o.indexOf(h[0]));h[0]&&-1!==r&&(u=1<h.length?"FS"===(t=h[1].toUpperCase())||"FF"===t||"SF"===t||"SS"===t?t:(c.parent.trigger("actionFailure",{error:"The provided dependency type, "+t+", is invalid. Please ensure that the Dependency Type is FS or FF or SS or SF"}),"FS"):e.includes("-")&&/[A-Za-z]/.test(a)&&n.includes("-")&&((t=e.slice(-2).toString()).toUpperCase(),"FS"===t||"FF"===t||"SF"===t||"SS"===t)?t:"FS",i=1<f.length?p+""+f[1]:"0",s=c.getOffsetDurationUnit(i),o={from:h[0],type:u,isDrawn:!1,to:("ResourceView"===c.parent.viewType?l.ganttProperties.taskId:l.ganttProperties.rowUniqueID).toString(),offsetUnit:s.durationUnit,offset:s.duration},r=c.checkIsParent(h[0]),c.parent.allowParentDependency?(n=a=null,(n="ProjectView"===c.parent.viewType&&!ne.isNullOrUndefined(d)&&0<d.size?(a=d.get(o.from),d.get(o.to)):(a=c.parent.connectorLineModule.getRecordByID(o.from),c.parent.connectorLineModule.getRecordByID(o.to)))&&a?c.validateParentPredecessor(a,n)&&(g.push(o),-1===m.indexOf(a))&&a.hasChildRecords&&c.parent.editModule&&c.parent.editModule.cellEditModule&&c.parent.editModule.cellEditModule.isCellEdit&&m.push(ne.extend([],[],[a],!0)[0]):g.push(o),h.splice(0)):r||g.push(o))}),0<m.length&&this.parent.undoRedoModule&&this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1].connectedRecords=m),[]);return g.map(function(e){var t=e.from,i=e.to,e=g.filter(function(e){return e.from===t&&e.to===i});-1===a.indexOf(e[e.length-1])&&a.push(e[e.length-1])}),a},u.prototype.getPredecessorStringValue=function(e){var t=e.ganttProperties.predecessor,i="",a=[];if(t)for(var n=t.length,r=0;r<n;r++){var s=t[r],o="",l="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;s.from!==l.toString()&&(o=s.from+s.type,o="string"==typeof e.ganttProperties.taskId?(a[0]=o.slice(0,-2),a[1]=o.slice(-2),a[0]+" "+a[1]):o,0!==s.offset&&(o+=0<s.offset?"+"+s.offset+" ":s.offset+" ",l=1!==s.offset,"day"===s.offsetUnit?o+=l?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===s.offsetUnit?o+=l?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):o+=l?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute")),i=0<i.length?i+","+o:o)}return i},u.prototype.getOffsetDurationUnit=function(e){var t,i=0,a=(ne.isNullOrUndefined(this.parent.durationUnit)||(t=this.parent.durationUnit.toLocaleLowerCase()),this.parent.durationUnitEditText);if("string"==typeof e){for(var n=e.match(/[^0-9]+|[0-9]+/g),r=0;r<n.length;r++)n[r]=n[r].trim();"-"===n[0]&&n[1]?(n[1]=n[0]+n[1],n.shift()):"+"===n[0]&&n.shift(),"."!==n[1]||isNaN(parseInt(n[2],10))||(n[0]+=n[1]+n[2],n.splice(1,2)),n&&n.length<=2&&(i=parseFloat(n[0]),t=n[1]?n[1].toLowerCase().trim():"",-1!==ne.getValue("minute",a).indexOf(t)?t="minute":-1!==ne.getValue("hour",a).indexOf(t)?t="hour":-1!==ne.getValue("day",a).indexOf(t)?t="day":ne.isNullOrUndefined(this.parent.durationUnit)||(t=this.parent.durationUnit.toLocaleLowerCase()))}else i=e,ne.isNullOrUndefined(this.parent.durationUnit)||(t=this.parent.durationUnit.toLocaleLowerCase());return isNaN(i)&&(this.parent.trigger("actionFailure",{error:"The provided value for the offset field is invalid.Please ensure the offset field contains only valid numeric values"}),i=0,ne.isNullOrUndefined(this.parent.durationUnit)||(t=this.parent.durationUnit.toLocaleLowerCase())),{duration:i,durationUnit:t}},u.prototype.updatePredecessors=function(e){void 0===e&&(e=null);for(var t,i=this.parent.predecessorsCollection,a=i.length,n=0;n<a;n++)((t=i[n]).hasChildRecords||this.parent.allowParentDependency)&&!this.parent.allowParentDependency||(this.updatePredecessorHelper(t,i,e),t.ganttProperties.isAutoSchedule)||!this.parent.editSettings.allowEditing||(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.parent.connectorLineEditModule.calculateOffset(t))},u.prototype.updatePredecessorHelper=function(e,t,i){void 0===i&&(i=null);var a=e.ganttProperties.predecessor,n=a.length;t=ne.isNullOrUndefined(t)?[]:t;for(var r=0;r<n;r++){var s=a[r],o="ProjectView"!==this.parent.viewType||ne.isNullOrUndefined(i)?this.parent.connectorLineModule.getRecordByID(s.from):i.get(s.from),l="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;s.from!==l.toString()&&o&&(l=void 0,o.ganttProperties.predecessor?((l=ne.extend([],o.ganttProperties.predecessor,[],!0)).push(s),this.parent.setRecordValue("predecessor",l,o.ganttProperties,!0)):((l=[]).push(s),this.parent.setRecordValue("predecessor",l,o.ganttProperties,!0),t.push(o)))}},u.prototype.traverseParents=function(e,t){this.parent.dataOperation.updateParentItems(e,t)},u.prototype.updatedRecordsDateByPredecessor=function(e){if(void 0===e&&(e=null),this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)){var t=this.parent.flatData,i=t.length;if(ne.isNullOrUndefined(e)){e=new Map;for(var a=0,n=t;a<n.length;a++){var r=n[a];e.set(r.ganttProperties.rowUniqueID.toString(),r)}}for(var s=0;s<i;s++){var o=t[s],l=o.ganttProperties;if(l.predecessorsName){this.validatePredecessorDates(o,e),o.hasChildRecords&&l.startDate&&this.parent.allowParentDependency&&this.updateChildItems(o);var l=l.predecessor;if(l&&1<l.length)for(var d=0,h=l;d<h.length;d++){var p=h[d],u=void 0;(u="ProjectView"===this.parent.viewType?e.get(p.to):this.parent.connectorLineModule.getRecordByID(p.to))&&this.validatePredecessorDates(u,e)}o.parentItem&&(l=o.parentItem.taskId,o=void 0,o="ProjectView"===this.parent.viewType?e.get(l):this.parent.getRecordByID(l))&&this.traverseParents(o,!0)}}}},u.prototype.updateParentPredecessor=function(e){if(void 0===e&&(e=null),this.parent.enablePredecessorValidation)for(var t=this.parentPredecessors.length-1;0<=t;t--){var i=this.parentPredecessors[t];this.validatePredecessorDates(i,e),i.ganttProperties.startDate&&this.updateChildItems(i)}},u.prototype.validatePredecessorDates=function(e,t){if(void 0===t&&(t=null),e.ganttProperties.predecessor)for(var i=e.ganttProperties.predecessor,a=void 0,n=void 0,r=null,s=("ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID).toString(),o=i.filter(function(e){return e.to===s?e:null}),a=0;a<o.length;a++){var l,d=o[a],r="ProjectView"!==this.parent.viewType||ne.isNullOrUndefined(t)?(n=this.parent.connectorLineModule.getRecordByID(d.from),this.parent.connectorLineModule.getRecordByID(d.to)):(n=t.get(d.from),t.get(d.to));this.parent.allowParentDependency&&n.hasChildRecords&&this.parent.dataOperation.updateParentItems(n),"ProjectView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&(l=void 0,ne.isNullOrUndefined(r)?(l=this.parent.editModule.taskbarEditModule.previousIds.indexOf(d.to),r=this.parent.editModule.taskbarEditModule.previousFlatData[l]):ne.isNullOrUndefined(n)&&(l=this.parent.editModule.taskbarEditModule.previousIds.indexOf(d.from),n=this.parent.editModule.taskbarEditModule.previousFlatData[l])),this.parent.allowParentDependency&&this.parent.isLoad&&-1===this.parentPredecessors.indexOf(e)&&(e.hasChildRecords||r.hasChildRecords)&&this.parentPredecessors.push(e),(r.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)&&this.validateChildGanttRecord(n,r,t)}},u.prototype.getConstraintDate=function(e,t,i){switch(e){case k.ConstraintType.AsSoonAsPossible:case k.ConstraintType.AsLateAsPossible:return null;case k.ConstraintType.MustStartOn:case k.ConstraintType.StartNoEarlierThan:return t;case k.ConstraintType.MustFinishOn:case k.ConstraintType.FinishNoEarlierThan:case k.ConstraintType.StartNoLaterThan:case k.ConstraintType.FinishNoLaterThan:return i;default:return null}},u.prototype.validateChildGanttRecord=function(e,t,i){var a,n,r;void 0===i&&(i=null),-1!==this.parent.editedPredecessorRecords.indexOf(t)||e&&ne.isNullOrUndefined(j(e.ganttProperties))||t&&ne.isNullOrUndefined(j(t.ganttProperties))||this.parent.isInPredecessorValidation&&(t.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)&&(e=t.ganttProperties,a=("ResourceView"===this.parent.viewType?e.taskId:e.rowUniqueID).toString(),r=e.predecessor.filter(function(e){return e.to===a?e:null}),r=this.getPredecessorDate(t,r,i,!0),this.parent.setRecordValue("startDate",r,e,!0),this.parent.dataOperation.updateMappingData(t,"startDate"),this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&this.parent.updateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule.calculateOffset(t),i=t.ganttProperties.segments,(ne.isNullOrUndefined(i)||!ne.isNullOrUndefined(i)&&0===i.length)&&this.dateValidateModule.calculateEndDate(t),this.parent.dataOperation.updateWidthLeft(t),!this.parent.isLoad&&!this.parent.isFromOnPropertyChange&&t.parentItem&&this.parent.isInPredecessorValidation&&this.parent.getParentTask(t.parentItem).ganttProperties.isAutoSchedule&&-1===this.parentIds.indexOf(t.parentItem.uniqueID)&&(this.parentIds.push(t.parentItem.uniqueID),this.parentRecord.push(t.parentItem)),this.parent.taskFields.constraintDate)&&this.parent.taskFields.constraintType&&(r=e.constraintType,i=e.startDate,n=e.endDate,r=this.getConstraintDate(r,i,n),this.parent.setRecordValue("constraintDate",r,e,!0),this.parent.dataOperation.updateMappingData(t,"constraintDate"))},u.prototype.filterPredecessorsByTarget=function(e,t,i){var a;return e&&Array.isArray(e)&&t&&t.ganttProperties&&i?(a="ResourceView"===i?t.ganttProperties.taskId:t.ganttProperties.rowUniqueID,e.filter(function(e){return e.to===a.toString()})):[]},u.prototype.getPredecessorDate=function(e,t,i,a){void 0===i&&(i=null);var n,r,s,o=this.filterPredecessorsByTarget(t,e,this.parent.viewType),l=!ne.isNullOrUndefined(this.parent.taskFields.constraintDate)&&!ne.isNullOrUndefined(this.parent.taskFields.constraintType);if(o)for(var d=o.length,h=0;h<d;h++){var p=o[h],u="ProjectView"!==this.parent.viewType||ne.isNullOrUndefined(i)?(s=this.parent.connectorLineModule.getRecordByID(p.from),this.parent.connectorLineModule.getRecordByID(p.to)):(s=i.get(p.from),i.get(p.to));if("ProjectView"!==this.parent.viewType||!this.parent.allowTaskbarDragAndDrop||ne.isNullOrUndefined(u)&&ne.isNullOrUndefined(s)||(u=ne.isNullOrUndefined(u)?this.getRecord(s,u,p):u,s=ne.isNullOrUndefined(s)?this.getRecord(s,u,p):s),!l&&this.parent.editModule&&this.parent.editModule.cellEditModule&&!this.parent.editModule.cellEditModule.isCellEdit&&!this.parent.editModule.dialogModule.isFromEditDialog&&!this.parent.updateOffsetOnTaskbarEdit&&!this.parent.isLoad){var c=this.parent.connectorLineEditModule.getOffsetForPredecessor(p,this.parent.connectorLineModule.getRecordByID(p.from),u);if(p.offset!==c&&0<=c)return u.ganttProperties.startDate}u&&s&&(r=this.getValidatedStartDate(u.ganttProperties,s.ganttProperties,p)),null!==n&&1!==this.dateValidateModule.compareDates(r,n)||(n=r)}return n=l?this.dateValidateModule.getDateByConstraint(e.ganttProperties,n,a,0<o.length):n},u.prototype.getValidatedStartDate=function(e,t,i){var a=i.type,n=i.offset;switch(a){case"FS":o=this.dateValidateModule.getValidEndDate(t),e.isMilestone&&0===n||(o=this.dateValidateModule.checkStartDate(o,e)),0!==n&&(o=this.updateDateByOffset(o,i,e)),s=e.isMilestone?o:this.dateValidateModule.checkStartDate(o,e);break;case"FF":case"SF":var r,s,o="FF"===a?this.dateValidateModule.getValidEndDate(t):this.dateValidateModule.getValidStartDate(t);0!==n&&(o=this.updateDateByOffset(o,i,e)),e.isMilestone||((r=new Date(o)).setDate(r.getDate()-1),o=this.parent.allowUnscheduledTasks&&ne.isNullOrUndefined(e.endDate)&&ne.isNullOrUndefined(e.duration)?this.dateValidateModule.checkStartDate(o,e):this.dateValidateModule.checkEndDate(o,e)),s=e.segments&&0!==e.segments.length?(r=this.dateValidateModule.getDuration(e.startDate,e.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone),this.dateValidateModule.getStartDate(o,r,e.durationUnit,e)):this.dateValidateModule.getStartDate(o,e.duration,e.durationUnit,e);break;case"SS":o=this.dateValidateModule.getValidStartDate(t),0!==n&&(o=this.updateDateByOffset(o,i,e)),s=e.isMilestone?o:this.dateValidateModule.checkStartDate(o,e)}return s},u.prototype.updateDateByOffset=function(e,t,i){var a,n=t.offset,t=t.offsetUnit;return n<0&&!ne.isNullOrUndefined(e)?a=this.dateValidateModule.getStartDate(this.dateValidateModule.checkEndDate(e,i),-1*n,t,i,!0):(ne.isNullOrUndefined(e)||(a=this.dateValidateModule.getEndDate(e,n,t,i,!1)),i.isMilestone||(a=this.dateValidateModule.checkStartDate(a,i))),a},u.prototype.createConnectorLinesCollection=function(e){var t,i=e||this.parent.currentViewData,e=this.parent.pdfExportModule,a=e&&e.isPdfExport,n=(a&&(h=(t=e.helper&&e.helper.exportProps)&&t.fitToWidthSettings,t)&&h&&h.isFitToWidth&&(h=t.exportType,t=e.helper.beforeSinglePageExport,i="CurrentViewData"===h?t.cloneCurrentViewData:t.cloneFlatData),i.length),e=(this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth&&this.parent.pdfExportModule.isPdfExport?this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.getExpandedRecords(this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData):this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.updatedRecords:this.parent.getExpandedRecords(this.parent.updatedRecords),this.parent.flatData),r=a?null:new Map;if(!a&&!ne.isNullOrUndefined(e))for(var s=0,o=e;s<o.length;s++){var l=o[s];r.set(l.ganttProperties.rowUniqueID.toString(),l)}for(var d,h=this.parent.ganttChartModule.getChartRows(),p=!ne.isNullOrUndefined(h)&&h[0]&&h[0].offsetHeight,u=0;u<n;u++)this.parent.editModule&&0<this.parent.editModule.deletedTaskDetails.length&&(d=i[u].parentItem)&&(d=ne.isNullOrUndefined(r)?this.parent.getRecordByID(d.taskId.toString()):r.get(d.taskId.toString()),this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(d),i[u])),this.parent.undoRedoModule&&this.parent.undoRedoModule.canUpdateIndex&&(i[u].index=u,i[u].parentItem)&&this.parent.getParentTask(i[u].parentItem)&&(i[u].parentItem.index=this.parent.getParentTask(i[u].parentItem).index),(d=i[u].ganttProperties.predecessor)&&this.addPredecessorsCollection(d,r,p)},u.prototype.addPredecessorsCollection=function(e,t,i){var a,n,r;if(void 0===t&&(t=null),void 0===i&&(i=0),e)for(a=e.length,n=0;n<a;n++){var s;if((s=e[n]).from===s.to)break;var o="ProjectView"!==this.parent.viewType||ne.isNullOrUndefined(t)?(r=this.parent.connectorLineModule.getRecordByID(s.from),this.parent.connectorLineModule.getRecordByID(s.to)):(r=t.get(s.from),t.get(s.to)),l=!0;(l=(r&&r.hasChildRecords&&!r.expanded||o&&o.hasChildRecords&&!o.expanded)&&!this.parent.allowTaskbarOverlap&&"ProjectView"===this.parent.viewType?!1:l)&&this.parent.connectorLineModule.expandedRecords&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(r)&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(o)&&this.updateConnectorLineObject(r,o,s,i)}},u.prototype.updateConnectorLineObject=function(e,t,i,a){a=this.parent.connectorLineModule.createConnectorLineObject(e,t,i,a=void 0===a?0:a);return a&&(t.isCritical&&e.isCritical&&(a.isCritical=!0),0<this.parent.connectorLineIds.length&&-1===this.parent.connectorLineIds.indexOf(a.connectorLineId)||0===this.parent.connectorLineIds.length?(this.parent.updatedConnectorLineCollection.push(a),this.parent.connectorLineIds.push(a.connectorLineId)):-1!==this.parent.connectorLineIds.indexOf(a.connectorLineId)&&(t=this.parent.connectorLineIds.indexOf(a.connectorLineId),this.parent.updatedConnectorLineCollection[t]=a),i.isDrawn=!0),a},u.prototype.shouldUpdatePredecessor=function(e,t,i,a,n){if(ne.isNullOrUndefined(t)||ne.isNullOrUndefined(t.ganttProperties)||ne.isNullOrUndefined(t.ganttProperties.taskId)||ne.isNullOrUndefined(e)||ne.isNullOrUndefined(e.ganttProperties))return!1;if(!n&&ne.isNullOrUndefined(i)&&ne.isNullOrUndefined(a))return!0;n=e.ganttProperties.predecessor;if(ne.isNullOrUndefined(n)||!Array.isArray(n))return!1;i=n.find(function(e){return e.to===t.ganttProperties.taskId.toString()});if(ne.isNullOrUndefined(i))return!1;a=i.type,n=e.ganttProperties,e=t.ganttProperties;if(ne.isNullOrUndefined(n)||ne.isNullOrUndefined(e))return!1;var r=n.startDate,s=n.endDate,o=e.startDate,l=e.endDate,e=i.offset,i=i.offsetUnit;switch(0!==e&&(0<e?(r=r&&this.parent.dataOperation.getEndDate(r,Math.abs(e),i,n,!1),s=s&&this.parent.dataOperation.getEndDate(s,Math.abs(e),i,n,!1)):(o=o&&this.parent.dataOperation.getEndDate(o,Math.abs(e),i,n,!1),l=l&&this.parent.dataOperation.getEndDate(l,Math.abs(e),i,n,!1))),a){case"FS":return(null!=o?o:l)<(null!=s?s:r);case"SS":return(null!=o?o:l)<(null!=r?r:s);case"SF":return(null!=l?l:o)<(null!=r?r:s);case"FF":return(null!=l?l:o)<(null!=s?s:r);default:return!1}},u.prototype.handleTaskUpdate=function(e,t){var i,a,n=this.parent.previousRecords[e.uniqueID],n=(n&&n.ganttProperties&&(r=n.ganttProperties,this.parent.editModule.isDialogEditing?(a=i=null,this.parent.editModule.isDialogEditing=!1):(i=r.startDate,a=r.endDate)),r&&"predecessor"in r),r=this.shouldUpdatePredecessor(e,t,i,a,n);(this.parent.updateOffsetOnTaskbarEdit||r)&&(this.validateChildGanttRecord(e,t),t.hasChildRecords)&&t.ganttProperties.isAutoSchedule&&this.updateChildItems(t)},u.prototype.validatePredecessor=function(e,t,i){if(this.parent.isInPredecessorValidation&&e.ganttProperties.predecessor){for(var a,n=this.parent.editModule.taskbarEditModule,r=void 0,s=(n&&(r=n.taskBarEditRecord),e.ganttProperties.predecessor),o=void 0,l=null,d=("ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID).toString(),h=s.filter(function(e){return e.to===d?e:null}),p=s.filter(function(e){return e.from===d?e:null}),u=void 0,c=0;c<h.length;c++){a=h[c],o=this.parent.connectorLineModule.getRecordByID(a.from),(l=this.parent.connectorLineModule.getRecordByID(a.to)).parentItem&&(u=this.parent.getTaskByUniqueID(l.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(u))&&this.parent.editModule.updateParentRecords.push(u),o.parentItem&&(u=this.parent.getTaskByUniqueID(o.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(u))&&this.parent.editModule.updateParentRecords.push(u),"ProjectView"!==this.parent.viewType||!this.parent.allowTaskbarDragAndDrop||ne.isNullOrUndefined(l)&&ne.isNullOrUndefined(o)||(l=ne.isNullOrUndefined(l)?this.getRecord(o,l,a):l,o=ne.isNullOrUndefined(o)?this.getRecord(o,l,a):o),this.parent.isInPredecessorValidation&&l.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1;var g="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;g.toString()!==a.to&&g.toString()!==a.from||i&&"predecessor"!==i||(this.handleTaskUpdate(o,l),this.parent.editModule.editedRecord&&this.parent.editModule.editedRecord.hasChildRecords&&!this.parent.editModule.editedRecord.parentItem&&(this.isValidatedParentTaskID=l.ganttProperties.taskId))}for(var f,c=0;c<p.length;c++){if(m=p[c],o=this.parent.connectorLineModule.getRecordByID(m.from),(l=this.parent.connectorLineModule.getRecordByID(m.to)).parentItem&&(u=this.parent.getTaskByUniqueID(l.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(u))&&this.parent.editModule.updateParentRecords.push(u),o.parentItem&&(u=this.parent.getTaskByUniqueID(o.parentItem.uniqueID),-1===this.parent.editModule.updateParentRecords.indexOf(u))&&this.parent.editModule.updateParentRecords.push(u),"ProjectView"!==this.parent.viewType||!this.parent.allowTaskbarDragAndDrop||ne.isNullOrUndefined(l)&&ne.isNullOrUndefined(o)||(l=ne.isNullOrUndefined(l)?this.getRecord(o,l,m):l,o=ne.isNullOrUndefined(o)?this.getRecord(o,l,m):o),this.parent.isInPredecessorValidation&&l.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1,"predecessor"!==i&&this.parent.isValidationEnabled){if(this.handleTaskUpdate(o,l),this.parent.editModule.editedRecord&&l){var m=o.parentItem?this.getRootParent(o):null;if(l.hasChildRecords&&(!this.parent.editModule.editedRecord.hasChildRecords||!l.parentItem&&(!m||m.ganttProperties.taskId===this.parent.editModule.editedRecord.ganttProperties.taskId))&&this.isValidatedParentTaskID!==l.ganttProperties.taskId){this.updateChildItems(l);for(var y=0;y<l.childRecords.length;y++){var D=l.childRecords[y].ganttProperties;if(-1!==this.isChildRecordValidated.indexOf(D.taskId))return;if(this.isChildRecordValidated.push(D.taskId),D.predecessor&&0<D.predecessor.length)for(var k=0;k<D.predecessor.length;k++){var b=void 0;(b=D.predecessor[k].to!==l.ganttProperties.taskId.toString()?this.parent.flatData[this.parent.ids.indexOf(D.predecessor[k].to)]:this.parent.flatData[this.parent.ids.indexOf(D.predecessor[k].from)])&&(this.validatePredecessor(b,[],""),b.hasChildRecords&&this.parent.editModule.editedRecord.hasChildRecords&&this.updateChildItems(b),this.isValidatedParentTaskID=b.ganttProperties.taskId)}}this.isValidatedParentTaskID=l.ganttProperties.taskId}this.parent.editModule.editedRecord.hasChildRecords&&!this.parent.editModule.editedRecord.parentItem&&(this.isValidatedParentTaskID=l.ganttProperties.taskId)}}else!l.ganttProperties.isAutoSchedule&&this.parent.updateOffsetOnTaskbarEdit&&(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.parent.connectorLineEditModule.calculateOffset(l));!1===o.expanded||!1===l.expanded?l&&this.validatePredecessor(l,void 0,"successor"):l&&(this.parent.editModule.isFirstCall&&(m="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,this.storeId=JSON.parse(JSON.stringify(m)),this.parent.editModule.isFirstCall=!1),this.storeId?(T=void 0,m=l[this.parent.taskFields.id].toString(),-1!==(T="ResourceView"===this.parent.viewType?this.storeId.includes(f="T"+m)?this.storeId.indexOf(f):-1:this.storeId.indexOf(m))&&(this.storeId=this.storeId.slice(0,T).concat(this.storeId.slice(T+1)),this.validatePredecessor(l,void 0,"successor"))):this.validatePredecessor(l,void 0,"successor"))}l&&!l.hasChildRecords&&l.parentItem&&-1===this.validatedParentIds.indexOf(l.parentItem.taskId)&&this.validatedParentIds.push(l.parentItem.taskId);s=!0;if(s=l&&l.hasChildRecords&&-1!==this.validatedParentIds.indexOf(l.ganttProperties.taskId.toString())?!1:s)if(l&&l.ganttProperties.taskId!==this.isValidatedParentTaskID&&r){if("ParentDrag"!==n.taskBarEditAction&&"ChildDrag"!==n.taskBarEditAction&&!r.hasChildRecords&&l.hasChildRecords&&(this.updateChildItems(l),this.isValidatedParentTaskID=l.ganttProperties.taskId),l.parentItem){this.parent.dataOperation.updateParentItems(l,!0);var w=this.parent.getParentTask(l.parentItem),T=this.storeId&&-1!==this.storeId.indexOf(w[this.parent.taskFields.id].toString())?this.storeId.indexOf(w[this.parent.taskFields.id].toString()):-1;if(w.ganttProperties.predecessor&&0<w.ganttProperties.predecessor.length&&-1!==T)for(y=0;y<w.ganttProperties.predecessor.length;y++)w.ganttProperties.predecessor[y].to!==w.ganttProperties.taskId.toString()&&(b=this.parent.flatData[this.parent.ids.indexOf(w.ganttProperties.predecessor[y].to)])&&b.parentItem&&this.validateChildGanttRecord(l,b)}}else l&&l.hasChildRecords&&this.isValidatedParentTaskID!==l.ganttProperties.taskId&&!r&&(this.updateChildItems(l),this.isValidatedParentTaskID=l.ganttProperties.taskId)}},u.prototype.updateChildItems=function(e){var t=this;if(0<e.childRecords.length&&this.validatedChildItems&&0<this.validatedChildItems.length)if(!!e.childRecords.some(function(e){return t.validatedChildItems.includes(e)}))return;var i,a,n,r=this.parent.previousRecords[e.uniqueID],s=(ne.isNullOrUndefined(r)||ne.isNullOrUndefined(r)&&!ne.isNullOrUndefined(r.ganttProperties)?i=new Date(e.ganttProperties.startDate.getTime()):ne.isNullOrUndefined(r.ganttProperties.startDate)||(i=new Date(r.ganttProperties.startDate.getTime())),e.ganttProperties.startDate),o=[];if(this.getUpdatableChildRecords(e,o),0!==o.length){for(var l,d=!ne.isNullOrUndefined(i)&&!ne.isNullOrUndefined(s)&&i.getTime()>s.getTime()?(a=this.parent.dateValidationModule.checkStartDate(s),n=this.parent.dateValidationModule.checkEndDate(i,e.ganttProperties),!1):(a=this.parent.dateValidationModule.checkStartDate(i),n=this.parent.dateValidationModule.checkEndDate(s,e.ganttProperties),!0),h=!ne.isNullOrUndefined(a)&&!ne.isNullOrUndefined(n)&&a.getTime()>=n.getTime()?0:this.parent.dateValidationModule.getDuration(a,n,"minute",!0,!1),p=0;p<o.length;p++)o[p].ganttProperties.isAutoSchedule&&(0<h?(l=j(o[p].ganttProperties)?o[p].ganttProperties.startDate:o[p].ganttProperties.startDate||o[p].ganttProperties.endDate||new Date(i.toString()),l=d?this.parent.dateValidationModule.getEndDate(this.parent.dateValidationModule.checkStartDate(l,o[p].ganttProperties,o[p].ganttProperties.isMilestone),h,"minute",o[p].ganttProperties,!1):this.parent.dateValidationModule.getStartDate(this.parent.dateValidationModule.checkEndDate(l,o[p].ganttProperties),h,"minute",o[p].ganttProperties),this.calculateDateByRoundOffDuration(o[p],l),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(o[p])&&this.validatedChildItems.push(o[p])):ne.isNullOrUndefined(r)&&(l=i,o[p].ganttProperties.startDate.getTime()<=l.getTime()&&this.calculateDateByRoundOffDuration(o[p],l),this.parent.isOnEdit)&&-1===this.validatedChildItems.indexOf(o[p])&&this.validatedChildItems.push(o[p]));o.length&&this.parent.dataOperation.updateParentItems(e,!0)}},u.prototype.getUpdatableChildRecords=function(e,t){for(var i=e.childRecords,a=0;a<i.length;a++)i[a].ganttProperties.isAutoSchedule&&(t.push(i[a]),i[a].hasChildRecords)&&this.getUpdatableChildRecords(i[a],t)},u.prototype.calculateDateByRoundOffDuration=function(e,t){var i,a=e,n=a.ganttProperties,t=new Date(t.getTime());!ne.isNullOrUndefined(n.endDate)&&ne.isNullOrUndefined(n.startDate)?(i=this.parent.dateValidationModule.checkStartDate(t,n,null),this.parent.setRecordValue("endDate",this.parent.dateValidationModule.checkEndDate(i,a.ganttProperties),n,!0)):(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(t,n,!1),n,!0),ne.isNullOrUndefined(n.duration)||this.parent.dateValidationModule.calculateEndDate(a)),this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateTaskData(a)},u.prototype.getRecord=function(e,t,i){var a,n;return ne.isNullOrUndefined(t)?(a=this.parent.editModule.taskbarEditModule.previousIds.indexOf(i.to),n=this.parent.editModule.taskbarEditModule.previousFlatData[a]):ne.isNullOrUndefined(e)&&(a=this.parent.editModule.taskbarEditModule.previousIds.indexOf(i.from),n=this.parent.editModule.taskbarEditModule.previousFlatData[a]),n},u.prototype.getValidPredecessor=function(i){var e,a=this,t=[];return ne.isNullOrUndefined(i)||(e=i.ganttProperties.predecessor)&&0<e.length&&(t=e.filter(function(e){var t="ResourceView"===a.parent.viewType?i.ganttProperties.taskId:i.ganttProperties.rowUniqueID;return e.from!==t.toString()})),t};var aa=u;function u(e){this.parentRecord=[],this.parentIds=[],this.parentPredecessors=[],this.validatedParentIds=[],this.storeId=null,this.isChildRecordValidated=[],this.parent=e,this.dateValidateModule=this.parent.dateValidationModule}c.prototype.getconnectorLineGap=function(e){return e.milestoneChild?this.parent.chartRowsModule.milestoneMarginTop/2+this.parent.chartRowsModule.milestoneHeight/2:this.parent.chartRowsModule.taskBarMarginTop/2+this.parent.chartRowsModule.taskBarHeight/2},c.prototype.initPublicProp=function(){this.lineColor=this.parent.connectorLineBackground,this.lineStroke=4<this.parent.connectorLineWidth?4:this.parent.connectorLineWidth,this.createConnectorLineTooltipTable()},c.prototype.getTaskbarMidpoint=function(e){return Math.floor(e?this.parent.chartRowsModule.milestoneMarginTop+this.parent.chartRowsModule.milestoneHeight/2:this.parent.chartRowsModule.taskBarMarginTop+this.parent.chartRowsModule.taskBarHeight/2)+1},c.prototype.createConnectorLineObject=function(t,i,e,a){void 0===a&&(a=0);var n,r,s={},o=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport?this.parent.flatData:this.expandedRecords,o=(r=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?(n=this.parent.flatData.filter(function(e){return e.ganttProperties.taskId.toString()===t.ganttProperties.taskId.toString()})[0],r=this.parent.flatData.filter(function(e){return e.ganttProperties.taskId.toString()===i.ganttProperties.taskId.toString()})[0],n=n.index,r.index):(n=o.indexOf(t),o.indexOf(i)),t.ganttProperties),l=i.ganttProperties,d=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData:this.parent.getExpandedRecords(this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData):this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.expandedRecords;return s.parentIndexInCurrentView=d.indexOf(t),s.childIndexInCurrentView=d.indexOf(i),!(this.parent.virtualScrollModule&&this.parent.enableVirtualization)&&(-1===s.parentIndexInCurrentView||-1===s.childIndexInCurrentView)||-1===s.parentIndexInCurrentView&&-1===s.childIndexInCurrentView||(s.parentLeft=o.isMilestone?o.left-this.parent.chartRowsModule.milestoneHeight/2:o.left,s.childLeft=l.isMilestone?l.left-this.parent.chartRowsModule.milestoneHeight/2:l.left,s.parentWidth=0===o.width||o.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):o.width,s.childWidth=0===l.width||l.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):l.width,s.parentIndex=n,s.childIndex=r,0===a?(d=this.parent.ganttChartModule.getChartRows(),s.rowHeight=!ne.isNullOrUndefined(d)&&d[0]&&d[0].offsetHeight):s.rowHeight=a,s.type=e.type,n="ResourceView"===this.parent.viewType?o.taskId:o.rowUniqueID,r="ResourceView"===this.parent.viewType?l.taskId:l.rowUniqueID,s.connectorLineId="parent"+n+"child"+r,s.milestoneParent=!!o.isMilestone,s.milestoneChild=!!l.isMilestone,s.parentEndPoint=s.parentLeft+s.parentWidth,s.childEndPoint=s.childLeft+s.childWidth,ne.isNullOrUndefined(j(o)))||ne.isNullOrUndefined(j(l))?null:s},c.prototype.renderConnectorLines=function(e){var t,i=[];this.svgObject.innerHTML="";for(var a=0;a<e.length;a++)t=this.getConnectorLineTemplate(e[a]),this.svgObject.appendChild(t),i.push(e[a]);for(var n=this.parent.connectorLineModule.svgObject.childNodes,r=0;r<n.length;r++)for(var s=n[r].childNodes,o=0;o<s.length;o++){var l="Connector Line "+this.parent.connectorLineModule.generateAriaLabel(i[r]);s[o].setAttribute("aria-label",l),s[o].setAttribute("role","img")}this.parent.ganttChartModule.chartBodyContent.insertBefore(this.dependencyViewContainer,this.parent.ganttChartModule.chartBodyContent.lastChild),this.dependencyViewContainer.appendChild(this.svgObject);for(r=0;r<this.svgObject.children.length;r++)this.svgObject.children[r].children[0].setAttribute("tabindex","-1")},c.prototype.getParentPosition=function(e){if(e.parentIndex<e.childIndex){if("FF"===e.type)return e.childLeft+e.childWidth>=e.parentLeft+e.parentWidth?"FFType2":"FFType1";if(e.parentLeft<e.childLeft&&e.childLeft>e.parentLeft+e.parentWidth+25){if("FS"===e.type)return"FSType1";if("SF"===e.type)return"SFType1";if("SS"===e.type)return"SSType2"}else if(e.parentLeft<e.childLeft&&e.childLeft<e.parentLeft+e.parentWidth||e.parentLeft===e.childLeft||e.parentLeft>e.childLeft){if(e.parentLeft>e.childLeft+e.childWidth+25&&"SF"===e.type)return"SFType2";if(e.parentLeft>e.childLeft){if("SS"===e.type)return"SSType1";if("SF"===e.type)return"SFType1"}if("FS"===e.type)return"FSType2";if("SS"===e.type)return"SSType2";if("SF"===e.type)return"SFType1"}else if(e.parentLeft<e.childLeft){if("FS"===e.type)return"FSType2";if("SS"===e.type)return"SSType2";if("SF"===e.type)return"SFType1"}}else if(e.parentIndex>e.childIndex)if(e.parentLeft<e.childLeft&&e.childLeft>e.parentLeft+e.parentWidth){if("FS"===e.type)return e.childLeft-(e.milestoneParent?e.parentLeft+e.parentWidth+4:e.parentLeft+e.parentWidth)<=30?"FSType3":"FSType4";if(e.childLeft+e.childWidth>e.parentLeft+e.parentWidth){if("SS"===e.type)return"SSType4";if("FF"===e.type)return"FFType4";if("SF"===e.type)return"SFType4"}}else if(e.parentLeft<e.childLeft&&e.childLeft<e.parentLeft+e.parentWidth||e.parentLeft===e.childLeft||e.parentLeft>e.childLeft){if(e.childLeft+e.childWidth<=e.parentLeft+e.parentWidth){if("FF"===e.type)return"FFType3";if("SF"===e.type)return e.childLeft+e.childWidth+25<e.parentLeft?"SFType3":"SFType4";if("SS"===e.type)return e.childLeft<=e.parentLeft?"SSType3":"SSType4"}else if(e.childLeft+e.childWidth>e.parentLeft+e.parentWidth){if("FF"===e.type)return"FFType4";if("SF"===e.type)return"SFType4";if("SS"===e.type)return e.childLeft<=e.parentLeft?"SSType3":"SSType4"}if("FS"===e.type)return"FSType3"}else if(e.parentLeft<e.childLeft){if("FS"===e.type)return"FSType3";if("SS"===e.type)return"SSType4";if("FF"===e.type)return"FFType4";if("SF"===e.type)return"SFType4"}return null},c.prototype.getHeightValue=function(){return this.parent.showOverAllocation&&this.parent.allowTaskbarOverlap,this.parentRowIndexHeight>this.childRowIndexHeight?this.parentRowIndexHeight-this.childRowIndexHeight:this.childRowIndexHeight-this.parentRowIndexHeight},c.prototype.getInnerElementWidthSSType2=function(e){return e.parentLeft===e.childLeft?10:e.childLeft-e.parentLeft},c.prototype.getInnerElementLeftSSType2=function(e){return e.parentLeft===e.childLeft?e.parentLeft-20:e.parentLeft-10},c.prototype.getInnerChildWidthSSType2=function(e){return e.parentLeft+e.parentWidth<e.childLeft?10:e.parentLeft===e.childLeft?20:e.parentLeft+e.parentWidth>=e.childLeft?10:e.childLeft-e.parentLeft},c.prototype.calculateAdjustments=function(e,t,i){var a=this.parent.renderBaseline?.45:!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?.7:.62,a=Math.floor(this.parent.rowHeight*a);return ne.isNullOrUndefined(this.parent.taskbarHeight)&&e<=36||!ne.isNullOrUndefined(this.parent.taskbarHeight)&&this.parent.taskbarHeight<=a||!t||e<=36?{adjustY1:0,adjustX:0,adjustY2:0,adjustZ:0}:{adjustY1:(e-36)/("FSType2"===i||"FSType3"===i||"FSType4"===i||"SSType1"===i||"SSType2"===i||"SSType4"===i||"SFType2"===i?12:24),adjustX:-(e-36)/4,adjustZ:-2*(e-36)/24}},c.prototype.shouldAdjustForBaseline=function(e,t){if(!this.parent.renderBaseline||!e.milestoneParent&&!e.milestoneChild||e.milestoneParent&&e.milestoneChild)return 0;switch(t){case"FSType1":case"FSType2":return e.milestoneParent?-this.parent.chartRowsModule.milestoneMarginTop/2:this.parent.chartRowsModule.taskBarMarginTop;case"FSType3":case"FFType2":case"SFType2":case"SSType2":return e.milestoneParent?this.parent.chartRowsModule.milestoneMarginTop/2:-this.parent.chartRowsModule.taskBarMarginTop;case"FSType4":case"FFType3":case"SFType4":case"FFType4":case"SFType3":case"SFType1":return e.milestoneParent?-this.parent.chartRowsModule.milestoneMarginTop/2:this.parent.chartRowsModule.taskBarMarginTop;case"SSType3":case"SSType4":return e.milestoneParent?-this.parent.chartRowsModule.taskBarMarginTop:this.parent.chartRowsModule.taskBarMarginTop;case"SSType1":case"FFType1":return e.milestoneParent?this.parent.chartRowsModule.taskBarMarginTop:-this.parent.chartRowsModule.milestoneMarginTop/2;default:return 0}},c.prototype.updateParentChildRowsHeight=function(e){var t=this.parent.currentViewData.length-1,i=this.parent.ganttChartModule.getChartRows(),a=(this.parentRowIndexHeight=e.parentIndexInCurrentView*e.rowHeight,this.childRowIndexHeight=e.childIndexInCurrentView*e.rowHeight,this.lastRowIndexHeight=t*e.rowHeight,0);if(!this.parent.allowTaskbarOverlap&&this.parent.enableMultiTaskbar)for(var n=this.parentRowIndexHeight=this.childRowIndexHeight=this.lastRowIndexHeight=0;n<t;n++){var r=i[n];r&&"none"!==r.style.display&&(a<e.parentIndexInCurrentView&&(this.parentRowIndexHeight+=i[n].offsetHeight),a<e.childIndexInCurrentView&&(this.childRowIndexHeight+=i[n].offsetHeight),this.lastRowIndexHeight+=i[n].offsetHeight,a++)}},c.prototype.getConnectorLineTemplate=function(e){var t=this.getInnerChildWidthSSType2(e),i=this.getInnerElementWidthSSType2(e),a=this.getInnerElementLeftSSType2(e),n=(this.updateParentChildRowsHeight(e),this.getHeightValue()),r=!!e.milestoneChild,s=this.getPosition(e,this.getParentPosition(e),n),n=this.getPosition(e,this.getParentPosition(e),n).top,s=(this.parent.renderBaseline&&(this.parent.rowHeight,e.milestoneParent&&e.milestoneChild||(e.milestoneParent||e.milestoneChild)),s.height),o=0,l=0,d=0,h=0;if(this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(var p=0;p<this.parent.currentViewData.length;p++)"none"!==this.parent.getRowByIndex(p).style.display&&h<e.parentIndex&&(h++,this.parent.getRowByIndex(p).offsetHeight);for(var h=0,u=0;u<this.parent.currentViewData.length;u++)"none"!==this.parent.getRowByIndex(u).style.display&&h<e.childIndex&&(h++,d+=this.parent.getRowByIndex(u).offsetHeight)}var c,g,f,m,y=this.parent.connectorLineModule.expandedRecords,D=(y[e.parentIndex]&&y[e.childIndex]&&this.parent.allowParentDependency&&(D=y[e.parentIndex].hasChildRecords,c=y[e.childIndex].hasChildRecords,g=y[e.parentIndex].ganttProperties.isAutoSchedule,y=y[e.childIndex].ganttProperties.isAutoSchedule,!(D&&g&&!c||c&&y&&!D||D&&g&&y&&c||!D&&!c))&&(D&&!g&&c&&!y?l=-11:e.childIndex>e.parentIndex?!D&&c?o=-11:l=-(o=11):D&&!c?o=-11:l=-(o=11),this.parent.currentViewData[e.parentIndex].ganttProperties.isMilestone?e.parentIndex>e.childIndex?(l=-11,o=12):"SS"!==e.type&&"FF"!==e.type||(l=-5):this.parent.currentViewData[e.childIndex].ganttProperties.isMilestone?e.parentIndex>e.childIndex?(l=5,o=-10):e.parentIndex<e.childIndex&&("SS"!==e.type&&"FF"!==e.type||(l=-10)):(e.parentIndex<e.childIndex&&g&&!y||e.childIndex<e.parentIndex&&!g&&y)&&(l=0,o=-11),n+=l),this.getParentPosition(e));return D&&(c=this.getParentPosition(e),g=this.parent.rowHeight,y=this.calculateAdjustments(g,r,c),this.transform=this.parent.enableRtl?"translate("+(this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth)+", 0) scale(-1, 1)":"",this.connectorId="ConnectorLine"+e.connectorLineId,this.groupObject=this.renderer.createGroup({id:this.connectorId,transform:this.transform,style:"pointer-events: stroke",class:tt}),this.connectorPath=this.renderer.drawPath({class:it,d:this.connectorLinePath,fill:"transparent","stroke-width":this.lineStroke}),this.arrowlinePath=this.renderer.drawPath({d:this.arrowPath,class:rt}),l=this.lineColor&&!this.parent.enableCriticalPath?this.lineColor:"",this.connectorPath.style.stroke=l,this.arrowlinePath.style.fill=l,this.groupObject.appendChild(this.connectorPath),this.groupObject.appendChild(this.arrowlinePath),g=this.shouldAdjustForBaseline(e,D),"FSType1"===D&&(this.taskLineValue=e.milestoneChild?1:0,this.x1=e.parentEndPoint+(e.milestoneParent||e.milestoneChild?-1:0),this.x2=e.milestoneParent?e.childLeft-(e.parentLeft+e.parentWidth+10)+this.lineStroke-10+1:e.childLeft-(e.parentLeft+e.parentWidth+10)+this.lineStroke-10,this.y1=n,this.y2=s+this.taskLineValue+o-this.lineStroke,this.connectorLinePath="M "+this.x1+" "+(this.y1-g)+" L "+(this.x1+this.x2+y.adjustZ)+" "+(this.y1-g)+" L "+(this.x1+this.x2+y.adjustZ)+" "+(this.y1+this.y2+y.adjustY1)+" L "+(this.x1+this.x2+12+y.adjustX)+" "+(this.y1+this.y2+y.adjustY1),this.arrowPath="M "+(this.x1+this.x2+20+y.adjustX)+" "+(this.y1+this.y2+y.adjustY1)+" L "+(this.x1+this.x2+12+y.adjustX)+" "+(this.y1+this.y2-(4+this.lineStroke)+y.adjustY1)+" L "+(this.x1+this.x2+12+y.adjustX)+" "+(this.y1+this.y2+4+y.adjustY1)+" Z"),"FSType2"===D&&(this.x1=e.parentLeft,this.x2=e.parentWidth+(e.milestoneParent?-1:0),this.x3=this.x2+(e.milestoneParent?11:10),this.x4=e.parentWidth-(e.parentEndPoint-e.childLeft+20),this.y1=n,this.y2=s+o-this.getconnectorLineGap(e)-this.lineStroke,this.y3=this.getconnectorLineGap(e),this.y4=this.parent.allowTaskbarOverlap?this.y1+this.y2-(this.y1+this.y2)%e.rowHeight:d,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1-g)+"  L "+(this.x1+this.x3)+" "+(this.y1-g)+" L "+(this.x1+this.x3)+" "+this.y4+" L "+(this.x1+this.x4+y.adjustZ)+" "+this.y4+" L "+(this.x1+this.x4+y.adjustZ)+" "+(this.y1+this.y2+this.y3+y.adjustY1)+" L "+(this.x1+this.x4+12+y.adjustX)+" "+(this.y1+this.y2+this.y3+y.adjustY1),this.arrowPath="M "+(this.x1+this.x4+20+y.adjustX)+" "+(this.y1+this.y2+this.y3+y.adjustY1)+" L "+(this.x1+this.x4+12+y.adjustX)+" "+(this.y1+this.y2+this.y3-(4+this.lineStroke)+y.adjustY1)+" L "+(this.x1+this.x4+12+y.adjustX)+" "+(this.y1+this.y2+this.y3+4+this.lineStroke+y.adjustY1)+" Z"),"FSType3"===D&&(this.taskLineValue=e.milestoneChild?1:0,this.point1=n,this.x1=e.childLeft+(e.milestoneChild?-1:0)+(e.milestoneParent?1:0)-20,this.x2=e.parentEndPoint-e.childLeft+30,this.y1=this.point1,this.y2=this.point1+s+o-this.getconnectorLineGap(e)-this.lineStroke+this.taskLineValue,this.y3=this.getconnectorLineGap(e),this.y4=this.y2-this.y2%e.rowHeight,this.connectorLinePath="M "+(this.x1+12)+" "+(this.y1-g+y.adjustY1)+" L "+this.x1+" "+(this.y1-g+y.adjustY1)+" L "+this.x1+" "+this.y4+" L "+(this.x1+this.x2)+" "+this.y4+" L "+(this.x1+this.x2)+" "+(this.y2+this.y3)+" L "+(this.x1+this.x2-12)+" "+(this.y2+this.y3),this.arrowPath="M "+(this.x1+20+y.adjustX)+" "+(this.y1-g+y.adjustY1)+" L "+(this.x1+12+y.adjustX)+" "+(this.y1-(4+this.lineStroke)-g+y.adjustY1)+" L "+(this.x1+12+y.adjustX)+" "+(this.y1+4+this.lineStroke-g+y.adjustY1)+" Z"),"FSType4"===D&&(this.point1=n,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.parentEndPoint+(e.milestoneChild?-1:0)+(e.milestoneParent?1:0),this.x2=e.childLeft-e.parentEndPoint-20,this.y1=this.point1+(e.milestoneChild?-1:0),this.y2=this.point1+s+o-this.lineStroke+1+this.taskLineValue,this.connectorLinePath="M "+(this.x1+this.x2+12)+" "+(this.y1+y.adjustY1)+" L "+(this.x1+this.x2)+" "+(this.y1+y.adjustY1)+" L "+(this.x1+this.x2)+" "+(this.y2-g)+" L "+this.x1+" "+(this.y2-g),this.arrowPath="M "+(this.x1+this.x2+20+y.adjustX)+" "+(this.y1+y.adjustY1)+" L "+(this.x1+this.x2+12+y.adjustX)+" "+(this.y1-(4+this.lineStroke)+y.adjustY1)+" L "+(this.x1+this.x2+12+y.adjustX)+" "+(this.y1+4+this.lineStroke+y.adjustY1)+" Z"),"SSType4"===D&&(m=0!==y.adjustX?y.adjustX+2:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=s+this.taskLineValue+o,this.x1=e.parentLeft-10,this.x2=e.childLeft-e.parentLeft,this.y1=n,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+this.x2+m)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2-g)+" L "+(this.x1+10)+" "+(this.y2-g),this.arrowPath="M "+(this.x1+this.x2+8+m)+" "+this.y1+" L "+(this.x1+this.x2+m)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+this.x2+m)+" "+(this.y1+4+this.lineStroke)+" Z"),"SSType3"===D&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=s+this.taskLineValue+o-(this.lineStroke-1),this.x1=e.childLeft-20,this.y1=n,this.x2=e.parentLeft-e.childLeft+21,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+12+y.adjustX)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2-g)+" L "+(this.x1+this.x2)+" "+(this.y2-g),this.arrowPath="M "+(this.x1+20+y.adjustX)+" "+this.y1+" L "+(this.x1+12+y.adjustX)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+12+y.adjustX)+" "+(this.y1+4+this.lineStroke)+" Z"),"SSType2"===D&&(m=0!==y.adjustX?y.adjustX+2:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=s+this.taskLineValue+o-this.lineStroke,this.x1=a,this.x2=t+1,this.y1=n,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+this.x2)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2+y.adjustY1-g)+" L "+(this.x1+i+m)+" "+(this.y2+y.adjustY1-g),this.arrowPath="M "+(this.x1+i+8+m)+" "+(this.y2+y.adjustY1-g)+" L "+(this.x1+i+m)+" "+(this.y2-(4+this.lineStroke)+y.adjustY1-g)+" L "+(this.x1+i+m)+" "+(this.y2+4+this.lineStroke+y.adjustY1-g)+" Z"),"SSType1"===D&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=s+this.taskLineValue+o-this.lineStroke,this.x1=e.childLeft-20,this.x2=e.parentLeft-e.childLeft+21,this.y1=n,this.y2=this.y1+this.point1,this.connectorLinePath="M "+(this.x1+this.x2)+" "+this.y1+" L "+this.x1+" "+this.y1+" L "+this.x1+" "+(this.y2+y.adjustY1-g)+" L "+(this.x1+12+y.adjustX)+" "+(this.y2+y.adjustY1-g),this.arrowPath="M "+(this.x1+20+y.adjustX)+" "+(this.y2+y.adjustY1-g)+" L "+(this.x1+12+y.adjustX)+" "+(this.y2-(4+this.lineStroke)+y.adjustY1-g)+" L "+(this.x1+12+y.adjustX)+" "+(this.y2+4+this.lineStroke+y.adjustY1-g)+" Z"),"FFType1"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.x1=e.childEndPoint,this.x2=e.parentEndPoint+(e.milestoneParent?-1:0),this.x3=e.milestoneParent?22:21,this.x4=e.milestoneChild?4:8,this.y1=n,this.y2=s+this.taskLineValue+o-this.lineStroke+1,this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+(this.x2+this.x3)+" "+this.y1+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2+y.adjustY1-g)+" L "+(this.x1+this.x4)+" "+(this.y1+this.y2+y.adjustY1-g),this.arrowPath="M "+(this.x1+m)+" "+(this.y1+this.y2+y.adjustY1-g)+" L "+(this.x1+8+m)+" "+(this.y1+this.y2-(4+this.lineStroke)+y.adjustY1-g)+" L "+(this.x1+8+m)+" "+(this.y1+this.y2+4+this.lineStroke+y.adjustY1-g)+" Z"),"FFType2"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.x1=e.parentEndPoint,this.x2=e.childEndPoint+(e.milestoneParent?22:21),this.x3=e.childEndPoint+(e.milestoneChild?9:8),this.y1=n,this.y2=s+this.taskLineValue+o-this.lineStroke+1,f=this.parent.renderBaseline?0:m,this.connectorLinePath="M "+this.x1+" "+this.y1+" L "+this.x2+" "+this.y1+" L "+this.x2+" "+(this.y1+this.y2+y.adjustY1-g)+" L "+this.x3+" "+(this.y1+this.y2+y.adjustY1-g),this.arrowPath="M "+(this.x3-8+f)+" "+(this.y1+this.y2+y.adjustY1-g)+" L "+(this.x3+f)+" "+(this.y1+this.y2-(4+this.lineStroke)+y.adjustY1-g)+" L "+(this.x3+f)+" "+(this.y1+this.y2+4+this.lineStroke+y.adjustY1-g)+" Z"),"FFType3"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.childEndPoint,this.x2=this.x1+(e.milestoneChild?4:8),this.x3=e.parentEndPoint-e.childEndPoint+(e.milestoneChild?16:10),this.x4=e.parentEndPoint+(e.milestoneParent?-1:0),this.y1=n,this.y2=s+this.taskLineValue+o-this.lineStroke+1,this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+(this.x2+this.x3)+" "+this.y1+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2-g)+" L "+this.x4+" "+(this.y1+this.y2-g),this.arrowPath="M "+(this.x1+m)+" "+this.y1+" L "+(this.x1+8+m)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x1+8+m)+" "+(this.y1+4+this.lineStroke)+" Z"),"FFType4"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.parentEndPoint,this.x2=e.childEndPoint+(e.milestoneChild?7:8),this.x3=this.x2+(e.milestoneChild?12:11),this.y1=n,this.y2=s+this.taskLineValue+o-this.lineStroke+1,f=this.parent.renderBaseline?0:m,this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+this.x3+" "+this.y1+" L "+this.x3+" "+(this.y1+this.y2-g)+" L "+this.x1+" "+(this.y1+this.y2-g),this.arrowPath="M "+(this.x2-8+f)+" "+this.y1+" L "+(this.x2+f)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x2+f)+" "+(this.y1+4+this.lineStroke)+" Z"),"SFType4"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?-1:0,this.point1=this.taskLineValue+s+o-this.getconnectorLineGap(e)-(this.lineStroke-1),this.point2=n,this.x1=e.parentLeft-10,this.x2=this.x1+(e.childEndPoint-e.parentLeft+18),this.x3=this.x2+(e.milestoneChild?16:11),this.y1=this.point2,this.y2=this.y1+this.point1,this.y3=this.getconnectorLineGap(e),this.y4=this.y2-this.y2%e.rowHeight,f=this.parent.renderBaseline?0:m,this.connectorLinePath="M "+this.x2+" "+(this.y1-y.adjustY1)+" L "+this.x3+" "+(this.y1-y.adjustY1)+" L "+this.x3+" "+this.y4+" L "+this.x1+" "+this.y4+" L "+this.x1+" "+(this.y2+this.y3-g)+" L "+(this.x1+11)+" "+(this.y2+this.y3-g),this.arrowPath="M "+(this.x2-8+f)+" "+(this.y1-y.adjustY1)+" L "+(this.x2+f)+" "+(this.y1-(4+this.lineStroke)-y.adjustY1)+" L "+(this.x2+f)+" "+(this.y1+4+this.lineStroke-y.adjustY1)+" Z"),"SFType3"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=e.parentLeft-(e.childEndPoint+(e.milestoneParent?23:20))+1,this.point2=n,this.x1=e.childEndPoint,this.x2=this.x1+(e.milestoneChild?9:8),this.x3=this.x2+(e.milestoneChild?17:11),this.y1=this.point2,this.y2=this.y1+s+o-(this.lineStroke-1)+this.taskLineValue,this.connectorLinePath="M "+this.x2+" "+this.y1+" L "+this.x3+" "+this.y1+" L "+this.x3+" "+(this.y2-g)+" L "+(this.x3+this.point1)+" "+(this.y2-g),this.arrowPath="M "+(this.x2-8+m)+" "+this.y1+" L "+(this.x2+m)+" "+(this.y1-(4+this.lineStroke))+" L "+(this.x2+m)+" "+(this.y1+4+this.lineStroke)+" Z"),"SFType1"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=s+o-this.getconnectorLineGap(e)+this.taskLineValue-this.lineStroke,this.point2=this.getconnectorLineGap(e),this.x1=e.parentLeft-10,this.y1=n,this.x2=e.childEndPoint-e.parentLeft+31,this.y2=this.y1+this.point1,this.x3=e.childEndPoint-e.parentLeft+18,this.y3=this.y2-this.y2%e.rowHeight,f=this.parent.renderBaseline?0:m,this.connectorLinePath="M "+(this.x1+11)+" "+(this.y1-g)+" L "+this.x1+" "+(this.y1-g)+" L "+this.x1+" "+this.y3+" L "+(this.x1+this.x2)+" "+this.y3+" L "+(this.x1+this.x2)+" "+(this.y2+this.point2+y.adjustY1)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2+y.adjustY1),this.arrowPath="M "+(this.x1+this.x3-8+f)+" "+(this.y2+this.point2+y.adjustY1)+" L "+(this.x1+this.x3+f)+" "+(this.y2+this.point2-(4+this.lineStroke)+y.adjustY1)+" L "+(this.x1+this.x3+f)+" "+(this.y2+this.point2+4+this.lineStroke+y.adjustY1)+" Z"),"SFType2"===D&&(m=0!==y.adjustX?y.adjustX+11:y.adjustX,this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.childEndPoint,this.y1=n,this.x2=e.parentLeft-e.childEndPoint,this.y2=this.y1+s+this.taskLineValue+o-this.lineStroke,this.connectorLinePath="M "+(this.x1+this.x2+1)+" "+this.y1+" L "+(this.x1+this.x2-10)+" "+this.y1+" L "+(this.x1+this.x2-10)+" "+(this.y2+y.adjustY1-g)+" L "+(this.x1+8)+" "+(this.y2+y.adjustY1-g),this.arrowPath="M "+(this.x1+m)+" "+(this.y2+y.adjustY1-g)+" L "+(this.x1+8+m)+" "+(this.y2-(4+this.lineStroke)+y.adjustY1-g)+" L "+(this.x1+8+m)+" "+(this.y2+4+this.lineStroke+y.adjustY1-g)+" Z"),this.connectorPath.setAttribute("d",this.connectorLinePath),this.arrowlinePath.setAttribute("d",this.arrowPath)),this.groupObject},c.prototype.getPosition=function(e,t,i){var a=0,n=0,r=!!e.milestoneParent,s=!!e.milestoneChild,r=this.getTaskbarMidpoint(r)-(this.lineStroke-1),s=this.getTaskbarMidpoint(s)-(this.lineStroke-1),o=-1!==e.parentIndexInCurrentView,e=-1!==e.childIndexInCurrentView;return"SSType1"===t||"SSType2"===t||"FFType1"===t||"FFType2"===t||"SFType2"===t?(a=o?this.parentRowIndexHeight+r:0,n=o&&e?i:e?this.childRowIndexHeight+r:this.lastRowIndexHeight+r):"SSType3"===t||"SSType4"===t||"FSType4"===t||"FFType3"===t||"FFType4"===t||"SFType4"===t||"SFType3"===t?(a=e?this.childRowIndexHeight+s:0,n=o&&e?i:o?this.parentRowIndexHeight+s:this.lastRowIndexHeight+s):"FSType3"===t?(a=e?this.childRowIndexHeight+r:0,n=o&&e?i:o?this.parentRowIndexHeight+s:this.lastRowIndexHeight+r):"SFType1"!==t&&"FSType1"!==t&&"FSType2"!==t||(a=o?this.parentRowIndexHeight+s:0,n=o&&e?i:e?this.childRowIndexHeight+s:this.lastRowIndexHeight+s),{top:a,height:n}},c.prototype.createConnectorLineTooltipTable=function(){this.tooltipTable=ne.createElement("table",{className:".e-tooltiptable",styles:"margin-top:0px",attrs:{cellspacing:"2px",cellpadding:"2px"}});var e=ne.createElement("tbody");e.innerHTML="",this.tooltipTable.appendChild(e)},c.prototype.getConnectorLineTooltipInnerTd=function(e,t,i,a){function n(e,t,i,a){var n=document.createElement("tr");return n.id=e,(e=document.createElement("td")).style.padding="2px",e.textContent=r.parent.localeObj.getConstant(t),(t=document.createElement("td")).textContent=i,(i=document.createElement("td")).style.padding="2px",i.textContent=r.parent.localeObj.getConstant(a),n.append(e,t,i),n}var r=this,s=document.createElement("tbody");return s.appendChild(n("fromPredecessor","from",e,t)),s.appendChild(n("toPredecessor","to",i||"",a||"")),s},c.prototype.generateAriaLabel=function(e){var t=e.type,i=this.expandedRecords,a=i[e.parentIndex].ganttProperties.taskName,i=i[e.childIndex].ganttProperties.taskName,e=this.parent.localeObj.getConstant("start"),n=this.parent.localeObj.getConstant("finish");return"FS"===t?a+" "+n+" to "+i+" "+e:"FF"===t?a+" "+n+" to "+i+" "+n:"SS"===t?a+" "+e+" to "+i+" "+e:a+" "+e+" to "+i+" "+n},c.prototype.getRecordByID=function(t){return ne.isNullOrUndefined(t)?null:this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth?this.parent.pdfExportModule.helper.beforeSinglePageExport.cloneFlatData.filter(function(e){return e.ganttProperties.taskId.toString()===t.toString()})[0]:"ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf("T"+t.toString())]:this.parent.getRecordByID(t)},c.prototype.removePreviousConnectorLines=function(e){for(var t=!0===ne.isObject(e),i=(t?Object.keys(e):e).length,a=Object.keys(e),n=0;n<i;n++){var r=void 0,s=(r=t?e[a[n]]:e[n]).ganttProperties&&r.ganttProperties.predecessor;if(s&&0<s.length)for(var o=0;o<s.length;o++){var l="parent"+s[o].from+"child"+s[o].to;this.removeConnectorLineById(l)}}},c.prototype.removeConnectorLineById=function(e){e=this.parent.connectorLineModule.dependencyViewContainer.querySelector("#ConnectorLine"+e.replace(/([.])/g,"\\$1"));ne.isNullOrUndefined(e)||ne.remove(e)};var na=c;function c(e){this.transform="",this.connectorLinePath="",this.arrowPath="",this.taskLineValue=0,this.expandedRecords=[],this.parent=e,this.dependencyViewContainer=ne.createElement("div",{className:"e-gantt-dependency-view-container"}),Object.assign(this.dependencyViewContainer.style,{width:"100%",height:"100%",zIndex:2,position:"absolute",pointerEvents:"none"}),this.renderer=new N.SvgRenderer(this.parent.element.id),this.initPublicProp(),this.svgObject=this.renderer.createSvg({id:this.parent.element.id+"_svg"}),this.svgObject.setAttribute("height","100%"),this.svgObject.setAttribute("width","100%")}sa.prototype.renderSplitter=function(){var n=this,e=this.calculateSplitterPosition(this.parent.splitterSettings),t=(this.parent.splitterElement=ne.createElement("div",{className:"e-gantt-splitter"}),this.parent.treeGridPane=ne.createElement("div",{className:"e-gantt-tree-grid-pane"}),this.parent.chartPane=ne.createElement("div",{className:"e-gantt-chart-pane"}),ne.addClass([this.parent.chartPane],"e-droppable"),this.parent.enableRtl?(this.parent.splitterElement.appendChild(this.parent.chartPane),this.parent.splitterElement.appendChild(this.parent.treeGridPane)):(this.parent.splitterElement.appendChild(this.parent.treeGridPane),this.parent.splitterElement.appendChild(this.parent.chartPane)),this.splitterObject=new L.Splitter({height:null,width:this.parent.ganttWidth.toString(),enableRtl:this.parent.enableRtl,separatorSize:this.parent.splitterSettings.separatorSize,paneSettings:[{resizable:!0,size:e,min:this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum)},{resizable:!0}],orientation:"Horizontal",resizeStart:function(e){n.parent.contextMenuModule&&n.parent.contextMenuModule.isOpen&&n.parent.contextMenuModule.contextMenu.close();var t=e.pane[0],i=e.pane[1],a=(n.splitterPreviousPositionGrid=t.scrollWidth+1+"px",n.splitterPreviousPositionChart=i.scrollWidth+1+"px",new D.Deferred);return n.parent.trigger("splitterResizeStart",e,function(e){a.resolve(e)}),a},resizing:function(e){n.parent.trigger("splitterResizing",e),n.parent.timelineModule.isZoomToFit&&n.parent.timelineModule.updateTimelineAfterZooming(n.parent.timelineModule.timelineEndDate,!0)},resizeStop:function(e){n.parent.calculateDimensions(),n.isSplitterResized=!0;var t=e.pane[0],i=(n.splitterPreviousPositionGrid=t.scrollWidth+1+"px",n.splitterObject.paneSettings[0].size=n.getSpliterPositionInPercentage(n.splitterPreviousPositionGrid),n.parent.splitterSettings.position=n.splitterObject.paneSettings[0].size,new D.Deferred);return n.parent.trigger("splitterResized",e,function(e){!0===e.cancel&&(n.splitterObject.paneSettings[0].size=null,n.splitterObject.paneSettings[0].size=n.getSpliterPositionInPercentage(n.splitterPreviousPositionGrid),n.parent.splitterSettings.position=n.splitterObject.paneSettings[0].size,n.splitterObject.paneSettings[1].size=null,n.splitterObject.paneSettings[1].size=n.getSpliterPositionInPercentage(n.splitterPreviousPositionChart)),ne.isNullOrUndefined(n.parent.projectEndDate)&&n.parent.timelineModule.updateTimelineAfterZooming(n.parent.timelineModule.timelineEndDate,!0),i.resolve(e)}),i}}),this.parent.element.appendChild(this.parent.splitterElement),this.splitterObject.appendTo(this.parent.splitterElement),this.splitterObject.element.querySelector(".e-split-bar"));t&&(e=parseFloat(e.replace("%","")),e=Math.min(100,Math.max(0,e)),t.setAttribute("aria-valuenow",e.toString()))},sa.prototype.calculateSplitterPosition=function(e){var t;return!ne.isNullOrUndefined(this.splitterObject)&&this.parent.enablePersistence?this.splitterObject.paneSettings[0].size:"Grid"===e.view?this.parent.enableRtl?"0%":"100%":"Chart"===e.view?this.parent.enableRtl?"100%":"0%":ne.isNullOrUndefined(e.position)||""===e.position?!ne.isNullOrUndefined(e.columnIndex)&&0<=e.columnIndex?150*e.columnIndex<this.parent.ganttWidth||!this.parent.element.classList.contains("e-device")?this.getSpliterPositionInPercentage(this.getTotalColumnWidthByIndex(e.columnIndex).toString()+"px"):this.getSpliterPositionInPercentage(130*e.columnIndex+"px"):(t=this.parent.ganttWidth,this.parent.enableRtl?this.getSpliterPositionInPercentage(t-250+"px"):this.getSpliterPositionInPercentage("250px")):this.getSpliterPositionInPercentage(e.position)},sa.prototype.getSpliterPositionInPercentage=function(e){var t,i=ne.isNullOrUndefined(e)||""===e?null:e;return i=ne.isNullOrUndefined(i)?i:-1!==e.indexOf("px")?(t=parseInt(e,10))/this.parent.ganttWidth*100<=100?t/this.parent.ganttWidth*100+"%":"25%":this.parent.enableRtl?100-parseFloat(e)+"%":-1===e.indexOf("%")?e+"%":e},sa.prototype.getTotalColumnWidthByIndex=function(e){var t=0,i=this.parent.ganttWidth,a=this.parent.ganttColumns.filter(function(e){return void 0===e.visible||!0===e.visible}).map(function(e){return Object.assign({},e)});if(e=a.length>e?e:a.length,this.parent.enableRtl){for(var n=0;n<e;n++)t+=parseInt(a[n].width,10);t=i-t}else for(n=0;n<e;n++)t+=parseInt(a[n].width,10);return t},sa.prototype.updateSplitterPosition=function(){this.splitterObject.separatorSize=this.parent.splitterSettings.separatorSize;var e=this.calculateSplitterPosition(this.parent.splitterSettings);this.splitterObject.paneSettings[0].min=this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum),this.splitterObject.dataBind(),this.isSplitterResized||(this.splitterObject.paneSettings[0].size=e),this.isSplitterResized=!1,ne.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.timelineModule.updateTimelineAfterZooming(this.parent.timelineModule.timelineEndDate,!0)},sa.prototype.triggerCustomResizedEvent=function(){var e=this.splitterObject.element.querySelectorAll(".e-pane")[0],t=this.splitterObject.element.querySelectorAll(".e-pane")[1],e={event:null,element:this.splitterObject.element,pane:[e,t],index:[0,1],separator:this.splitterObject.element.querySelector(".e-split-bar"),paneSize:[e.offsetWidth,t.offsetWidth]};this.parent.trigger("splitterResized",e),!0===e.cancel&&(this.splitterObject.paneSettings[0].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionGrid),this.splitterObject.paneSettings[1].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionChart))},sa.prototype.destroy=function(){this.splitterObject.destroy(),this.parent.off("destroy",this.destroy)};var ra=sa;function sa(e){this.isSplitterResized=!1,this.parent=e,this.parent.on("destroy",this.destroy,this)}la.prototype.createTooltip=function(){this.toolTipObj=new F.Tooltip,this.toolTipObj.target=".e-header-cell-label, .e-gantt-child-taskbar,.e-gantt-parent-taskbar, .e-gantt-milestone, .e-gantt-unscheduled-taskbar.e-event-markers, .e-baseline-bar, .e-event-markers,.e-connector-line-container, .e-indicator-span, .e-notes-info, .e-gantt-manualparent-milestone,.e-taskbar-left-resizer, .e-taskbar-right-resizer, .e-baseline-gantt-milestone-container, .e-gantt-manualparenttaskbar",this.toolTipObj.position="BottomCenter",this.toolTipObj.openDelay=700,this.toolTipObj.enableRtl=this.parent.enableRtl,this.toolTipObj.enableHtmlSanitizer=this.parent.enableHtmlSanitizer,this.toolTipObj.cssClass=ct,this.toolTipObj.animation={open:{effect:"None",delay:0},close:{effect:"None",delay:0}},this.toolTipObj.afterOpen=this.updateTooltipPosition.bind(this),this.toolTipObj.showTipPointer=!1,this.toolTipObj.beforeRender=this.tooltipBeforeRender.bind(this),this.toolTipObj.afterClose=this.tooltipCloseHandler.bind(this),this.toolTipObj.isStringTemplate=!0,this.toolTipObj.appendTo(this.parent.element)},la.prototype.tooltipBeforeRender=function(t){var e,i,a,n,r,s,o,l=this.parent;if(!l.isOnEdit)return n=ne.closest(t.target,"div."+P),n=ne.isNullOrUndefined(n)?S(t.target,Me):t.target,i={data:{},args:t,cancel:!1,content:""},t.target.classList.contains("e-header-cell-label")?l.timelineSettings.showTooltip?(r=t.target.getAttribute("data-tier"),a=t.target.title,s=ne.isNullOrUndefined(l.timelineTemplate)?t.target.textContent:t.target.getAttribute("value"),a=l.tooltipSettings.timeline?l.tooltipModule.templateCompiler(l.tooltipSettings.timeline,l,ne.extend({},{date:a,value:s,tier:r}),"TooltipTaskbarTemplate"):null,s=document.createElement("div"),a?(ne.append(a,s),i.content=this.toolTipObj.content=s):i.content=this.toolTipObj.content=l.tooltipModule.getTooltipContent("timeline",e,l,t)):t.cancel=!0:l.tooltipSettings.showTooltip?(n&&(i.data=l.ganttChartModule.getRecordByTaskBar(n),e=i.data),t.target.classList.contains("e-gantt-child-taskbar")||t.target.classList.contains("e-gantt-parent-taskbar")||t.target.classList.contains("e-gantt-milestone")||t.target.classList.contains("e-gantt-unscheduled-taskbar")||t.target.classList.contains("e-taskbar-left-resizer")||t.target.classList.contains("e-taskbar-right-resizer")||t.target.classList.contains("e-gantt-manualparenttaskbar")&&l.tooltipSettings.taskbar?(r=void 0,l.tooltipSettings.taskbar&&(r=l.tooltipModule.templateCompiler(l.tooltipSettings.taskbar,l,e,"TooltipTaskbarTemplate")),s=document.createElement("div"),r&&ne.append(r,s),i.content=this.toolTipObj.content=r?s:e?l.tooltipModule.getTooltipContent(e.ganttProperties.isMilestone?"milestone":"taskbar",e,l,t):""):t.target.classList.contains("e-baseline-bar")||t.target.classList.contains("e-baseline-gantt-milestone-container")?(a=void 0,l.tooltipSettings.baseline&&(a=l.tooltipModule.templateCompiler(l.tooltipSettings.baseline,l,e,"TooltipBaselineTemplate")),n=document.createElement("div"),a&&ne.append(a,n),i.content=this.toolTipObj.content=a?n:e?l.tooltipModule.getTooltipContent(e.ganttProperties.isMilestone?"milestone":"baseline",e,l,t):""):t.target.classList.contains("e-event-markers")?i.content=this.toolTipObj.content=l.tooltipModule.getTooltipContent("marker",e,l,t):t.target.classList.contains("e-connector-line-container")?(r=void 0,l.tooltipModule.predecessorTooltipData=l.tooltipModule.getPredecessorTooltipData(t),i.data=this.predecessorTooltipData,l.tooltipSettings.connectorLine&&(r=l.tooltipModule.templateCompiler(l.tooltipSettings.connectorLine,l,l.tooltipModule.predecessorTooltipData,"TooltipConnectorLineTemplate")),i.content=this.toolTipObj.content=r?r[0]:l.tooltipModule.getTooltipContent("connectorLine",e,l,t)):t.target.classList.contains("e-indicator-span")?(i.content=this.toolTipObj.content=l.tooltipModule.getTooltipContent("indicator",e,l,t),ne.isNullOrUndefined(i.content)&&(t.cancel=!0)):t.target.classList.contains("e-notes-info")?(s=this.parent.ganttChartModule.getRecordByTarget(t.event),i.content=this.toolTipObj.content=s.ganttProperties.notes,ne.isNullOrUndefined(i.content)&&(t.cancel=!0)):t.target.classList.contains("e-gantt-manualparenttaskbar")?(i.content=this.toolTipObj.content=l.tooltipModule.getTooltipContent("manualtaskbar",e,l,t),ne.isNullOrUndefined(i.content)&&(t.cancel=!0)):t.target.classList.contains("e-gantt-manualparent-milestone")&&(i.content=this.toolTipObj.content=l.tooltipModule.getTooltipContent("manualmilestone",e,l,t),ne.isNullOrUndefined(i.content))&&(t.cancel=!0)):t.cancel=!0,!1===t.cancel?(o=new D.Deferred,l.trigger("beforeTooltipRender",i,function(e){o.resolve(e),e.cancel&&(t.cancel=!0)}),this.toolTipObj.content=i.content,this.parent.isAdaptive||"mouseover"!==t.event.type||(this.currentTarget=t.target,ne.EventHandler.add(this.currentTarget,"mousemove",this.mouseMoveHandler.bind(this))),this.parent.renderTemplates(),o):void 0;t.cancel=!0},la.prototype.tooltipCloseHandler=function(e){this.tooltipMouseEvent=null,this.parent.isAdaptive||ne.isNullOrUndefined(this.currentTarget)||ne.EventHandler.remove(this.currentTarget,"mousemove",this.mouseMoveHandler),this.currentTarget=null},la.prototype.mouseMoveHandler=function(e){this.tooltipMouseEvent=e},la.prototype.updateTooltipPosition=function(e){e.element.style.visibility="visible";var t=this.parent.element.closest('[style*="zoom"]');if(ne.isNullOrUndefined(t)&&!ne.isNullOrUndefined(this.tooltipMouseEvent)&&!e.target.classList.contains("e-notes-info")){var t=this.getPointorPosition(this.tooltipMouseEvent),i=this.parent.getOffsetRect(this.parent.chartPane),a=i.top+this.parent.chartPane.offsetHeight,n=i.left+this.parent.chartPane.offsetWidth,r=t.x,i=t.y;if(n<r+e.element.offsetWidth+10)for(;n<r+e.element.offsetWidth+10;)r=n-e.element.offsetWidth-10,e.element.style.left=r+"px";else e.element.style.left=(r+=10)+"px";e.event.clientY>e.element.offsetHeight&&a<(i=window.innerHeight<e.element.offsetHeight+i?i-e.element.offsetHeight-10:i)+e.element.offsetHeight+20?i=i-e.element.offsetHeight-10:i+=10,e.element.style.top=i+"px"}},la.prototype.getPointorPosition=function(e){var t,i;return ne.isNullOrUndefined(ne.getValue("pageX",e))&&ne.isNullOrUndefined(ne.getValue("pageY",e))?ne.isNullOrUndefined(ne.getValue("clientX",e))&&ne.isNullOrUndefined(ne.getValue("clientY",e))||(t=ne.getValue("clientX",e)+document.body.scrollLeft+document.documentElement.scrollLeft,i=ne.getValue("clientY",e)+document.body.scrollTop+document.documentElement.scrollTop):(t=ne.getValue("pageX",e),i=ne.getValue("pageY",e)),{x:t,y:i}},la.prototype.getTooltipContent=function(e,t,i,a){var n,r,s,o;switch(t&&(s=(r=t.ganttProperties).taskName,this.parent.enableHtmlSanitizer&&"string"==typeof s&&(s=ne.SanitizeHtmlHelper.sanitize(s)),n=ne.isNullOrUndefined(s)?"":'<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">'+(this.parent.disableHtmlEncode?s.replace(/</g,"&lt;").replace(/>/g,"&gt;"):s)+"</td></tr>"),e){case"milestone":var l=void 0,d=(a.target.className.includes("e-baseline-gantt-milestone-container")&&!ne.isNullOrUndefined(r.baselineStartDate)?l=r.baselineStartDate:ne.isNullOrUndefined(r.startDate)||(l=r.startDate),this.parent.getFormatedDate(l,this.parent.getDateFormat())),h=(this.parent.enableHtmlSanitizer&&"string"==typeof d&&(d=ne.SanitizeHtmlHelper.sanitize(d)),ne.isNullOrUndefined(l)?"":'<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+d+"</td></tr>"),l=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+n+h+"</tbody></table>"},p=ne.initializeCSPTemplate(l);break;case"taskbar":var d=!(t.hasChildRecords&&!r.isAutoSchedule),u=this.parent.getFormatedDate(d?r.startDate:r.autoStartDate,this.parent.getDateFormat()),c=this.parent.getFormatedDate(d?r.endDate:r.autoEndDate,this.parent.getDateFormat()),g=this.parent.getDurationString(d?r.duration:r.autoDuration,r.durationUnit),f=r.progress,m=(this.parent.enableHtmlSanitizer&&(u="string"==typeof u?ne.SanitizeHtmlHelper.sanitize(u):u,c="string"==typeof c?ne.SanitizeHtmlHelper.sanitize(c):c,g=ne.SanitizeHtmlHelper.sanitize(g)),r.startDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(d?"startDate":"subTasksStartDate")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value"> '+u+"</td></tr>":""),y=r.endDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(d?"endDate":"subTasksEndDate")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value">'+c+"</td></tr>":"",D=ne.isNullOrUndefined(r.duration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value"> '+g+"</td></tr>",k='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+"</td><td class="+$e+">:</td><td>"+f+"</td></tr>",l=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+n+m+y+D+k+"</tbody></table>"};p=ne.initializeCSPTemplate(l);break;case"baseline":var b=this.parent.getFormatedDate(r.baselineStartDate,this.parent.getDateFormat()),w=this.parent.getFormatedDate(r.baselineEndDate,this.parent.getDateFormat()),T=this.parent.getDurationString(r.baselineDuration,r.durationUnit),l=(this.parent.enableHtmlSanitizer&&(b=ne.SanitizeHtmlHelper.sanitize(b),w=ne.SanitizeHtmlHelper.sanitize(w),T=ne.SanitizeHtmlHelper.sanitize(T)),function(){var e=this.parent.taskFields,t=r.baselineStartDate&&!ne.isNullOrUndefined(e.baselineStartDate)?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineStartDate")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value"> '+b+"</td></tr>":"",i=r.baselineEndDate&&!ne.isNullOrUndefined(e.baselineEndDate)?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineEndDate")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value">'+w+"</td></tr>":"",e=ne.isNullOrUndefined(r.baselineDuration)||ne.isNullOrUndefined(e.baselineDuration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineDuration")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value"> '+T+"</td></tr>";return'<table class = "e-gantt-tooltiptable"><tbody>'+n+t+i+e+"</tbody></table>"});p=ne.initializeCSPTemplate(l,this);break;case"marker":var u=i.tooltipModule.getMarkerTooltipData(a),v=this.parent.getFormatedDate(this.parent.dateValidationModule.getDateFromFormat(u.day),this.parent.getDateFormat()),S=u.label||"",l=(this.parent.enableHtmlSanitizer&&(S=ne.SanitizeHtmlHelper.sanitize(S),v=ne.SanitizeHtmlHelper.sanitize(v)),function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr><td>'+v+"</td></tr><tr><td>"+(this.parent.disableHtmlEncode?S.replace(/</g,"&lt;").replace(/>/g,"&gt;"):S)+"</td></tr></tbody></table>"});p=ne.initializeCSPTemplate(l,this);break;case"connectorLine":var P=i.tooltipModule.predecessorTooltipData.fromName,C=i.tooltipModule.predecessorTooltipData.fromId,R=i.tooltipModule.predecessorTooltipData.toName,M=i.tooltipModule.predecessorTooltipData.toId,O=i.tooltipModule.predecessorTooltipData.linkText,x=i.tooltipModule.predecessorTooltipData.offsetString,l=(this.parent.enableHtmlSanitizer&&(P=ne.SanitizeHtmlHelper.sanitize(P),C=ne.SanitizeHtmlHelper.sanitize(C),R=ne.SanitizeHtmlHelper.sanitize(R),M=ne.SanitizeHtmlHelper.sanitize(M),O=ne.SanitizeHtmlHelper.sanitize(O),x=ne.SanitizeHtmlHelper.sanitize(x)),function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("from")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+(this.parent.disableHtmlEncode?P.replace(/</g,"&lt;").replace(/>/g,"&gt;"):P)+" ("+(this.parent.disableHtmlEncode&&"string"==typeof C?C.replace(/</g,"&lt;").replace(/>/g,"&gt;"):C)+')</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("to")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+(this.parent.disableHtmlEncode?R.replace(/</g,"&lt;").replace(/>/g,"&gt;"):R)+" ("+M+')</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("taskLink")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+O+'</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("lag")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+x+"</td></tr></tbody></table>"});p=ne.initializeCSPTemplate(l,this);break;case"indicator":a.target.title.length&&(o=a.target.title,this.parent.enableHtmlSanitizer&&"string"==typeof o&&(o=ne.SanitizeHtmlHelper.sanitize(o)),p=ne.initializeCSPTemplate(l=function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+o+"</tr></tbody></table>"}));break;case"timeline":var I=a.target.title,l=(this.parent.enableHtmlSanitizer&&"string"==typeof I&&(I=ne.SanitizeHtmlHelper.sanitize(I)),function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+I+"</tr></tbody></table>"});p=ne.initializeCSPTemplate(l);break;case"manualtaskbar":var d=this.parent.getFormatedDate(r.autoStartDate,this.parent.getDateFormat()),c=this.parent.getFormatedDate(r.autoEndDate,this.parent.getDateFormat()),g=this.parent.getDurationString(r.duration,r.durationUnit),f=this.parent.getFormatedDate(r.startDate,this.parent.getDateFormat()),u=this.parent.getFormatedDate(r.endDate,this.parent.getDateFormat()),E=(this.parent.enableHtmlSanitizer&&(d=ne.SanitizeHtmlHelper.sanitize(d),c=ne.SanitizeHtmlHelper.sanitize(c),g=ne.SanitizeHtmlHelper.sanitize(g),f=ne.SanitizeHtmlHelper.sanitize(f),u=ne.SanitizeHtmlHelper.sanitize(u)),'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+d+"</td></tr>"),F='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+c+"</td></tr>",U='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+g+"</td></tr>",N='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+f+"</td></tr>",L='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+u+"</td></tr>",l=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+n+N+E+L+F+U+"</tbody></table>"};p=ne.initializeCSPTemplate(l);break;case"manualmilestone":var d=this.parent.getFormatedDate(r.autoStartDate,this.parent.getDateFormat()),c=this.parent.getFormatedDate(r.autoEndDate,this.parent.getDateFormat()),g=this.parent.getFormatedDate(r.startDate,this.parent.getDateFormat()),V=(this.parent.enableHtmlSanitizer&&(d=ne.SanitizeHtmlHelper.sanitize(d),c=ne.SanitizeHtmlHelper.sanitize(c),g=ne.SanitizeHtmlHelper.sanitize(g)),'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+d+"</td></tr>"),B='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+c+"</td></tr>",A='<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+g+"</tr>",l=function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+n+A+V+B+"</tbody></table>"};p=ne.initializeCSPTemplate(l)}return p},la.prototype.getMarkerTooltipData=function(e){e=e.target.id.match(/\d+/g);return this.parent.eventMarkers[Number(e)]},la.prototype.getPredecessorTooltipData=function(e){var t,e=e.target.id,i=(e=this.parent.enableHtmlSanitizer&&"string"==typeof e?ne.SanitizeHtmlHelper.sanitize(e):e).match(/ConnectorLineparent(.*)child(.*)/),a=(i.shift(),e="ResourceView"===this.parent.viewType?(t=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+i[0])],this.parent.flatData[this.parent.getTaskIds().indexOf("T"+i[1])]):(t=this.parent.flatData[this.parent.ids.indexOf(i[0])],this.parent.flatData[this.parent.ids.indexOf(i[1])]),t.ganttProperties.predecessor.filter(function(e){return e.to===i[1]}));return{fromId:"ResourceView"===this.parent.viewType?t.ganttProperties.taskId:t.ganttProperties.rowUniqueID,toId:"ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID,fromName:t.ganttProperties.taskName,toName:e.ganttProperties.taskName,linkType:a[0].type,linkText:this.parent.getPredecessorTextValue(a[0].type),offset:a[0].offset,offsetUnit:a[0].offsetUnit,offsetString:this.parent.getDurationString(a[0].offset,a[0].offsetUnit)}},la.prototype.templateCompiler=function(e,t,i,a){var e=t.chartRowsModule.templateCompiler(e),n=t.chartRowsModule.getTemplateID(a);return e(ne.extend({index:0},i),t,a,n,!0)},la.prototype.destroy=function(){this.toolTipObj.destroy()};var oa=la;function la(e){this.parent=e,this.createTooltip(),this.parent.on("destroy",this.destroy,this)}ha.prototype.getActiveElement=function(e){return e?this.previousActiveElement:this.activeElement},ha.prototype.setActiveElement=function(e){this.previousActiveElement=this.activeElement,this.activeElement=e},ha.prototype.onKeyPress=function(e){var t=this.parent,i=e.target,a=t.getExpandedRecords(t.currentViewData),n=(!ne.isNullOrUndefined(this.parent.focusModule.getActiveElement())||"expandAll"!==e.action&&"collapseAll"!==e.action||this.parent.element.querySelector(".e-treegrid").focus(),!this.parent.isEdit&&!ne.isNullOrUndefined(i)&&i.closest(".e-headercell")&&"Enter"===e.key&&this.parent.sortModule&&this.parent.allowSorting&&(e.action="enter",this.parent.treeGrid.grid.notify("key-pressed",e)),this.parent.focusModule.getActiveElement());if("home"!==e.action&&"end"!==e.action&&"downArrow"!==e.action&&"upArrow"!==e.action&&"delete"!==e.action&&"rightArrow"!==e.action&&"leftArrow"!==e.action&&"focusTask"!==e.action&&"focusSearch"!==e.action&&"expandAll"!==e.action&&"collapseAll"!==e.action&&"undo"!==e.action&&"redo"!==e.action&&"selectAll"!==e.action||ne.isNullOrUndefined(t.editModule)||ne.isNullOrUndefined(t.editModule.cellEditModule)||!0!==t.editModule.cellEditModule.isCellEdit)switch(!t.isAdaptive||"addRowDialog"!==e.action&&"editRowDialog"!==e.action&&"delete"!==e.action&&"addRow"!==e.action||t.selectionModule&&"Multiple"===t.selectionSettings.type&&(t.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none"),e.action){case"home":if(t.selectionModule&&"Cell"!==t.selectionSettings.mode){if(0===t.selectedRowIndex)return;t.selectionModule&&0===t.selectionModule.getCellSelectedRecords().length&&t.selectionModule.selectRow(0,!1,!0)}break;case"end":if(t.selectionModule&&"Cell"!==t.selectionSettings.mode){var r=a[a.length-1];if(t.selectedRowIndex===t.flatData.indexOf(r))return;t.selectionModule&&0===t.selectionModule.getCellSelectedRecords().length&&t.selectionModule.selectRow(t.flatData.indexOf(r),!1,!0)}break;case"downArrow":case"upArrow":(d=t.element.querySelector("#"+t.element.id+"_searchbar"))&&d.parentElement.classList.contains("e-input-focus")&&t.selectionModule.clearSelection(),t.element.classList.contains("e-scroll-disabled")||(this.upDownKeyNavigate(e),ne.isNullOrUndefined(n)||ne.isNullOrUndefined(n.closest(".e-chart-row"))||t.ganttChartModule.manageFocus(this.getActiveElement(),"remove",!0,e.action),t.selectionSettings&&"Both"===t.selectionSettings.mode&&e.target instanceof HTMLElement&&e.target.classList.contains("e-cellselectionbackground")&&e.target.classList.remove("e-cellselectionbackground"));break;case"expandAll":t.ganttChartModule.expandCollapseAll("expand");break;case"collapseAll":t.ganttChartModule.expandCollapseAll("collapse");break;case"expandRow":case"collapseRow":this.expandCollapseKey(e);break;case"saveRequest":if(!ne.isNullOrUndefined(t.editModule)&&!ne.isNullOrUndefined(t.editModule.cellEditModule)&&t.editModule.cellEditModule.isCellEdit){var r=t.editModule.cellEditModule.editedColumn;if(r.field!==t.columnMapping.duration||ne.isNullOrUndefined(r.edit)||ne.isNullOrUndefined(r.edit.read)||(l=e.target.ej2_instances[0],s=e.target.value,o=void 0,r.field===t.columnMapping.duration&&s!==(o=ne.isNullOrUndefined(r.edit)||ne.isNullOrUndefined(r.edit.read)?o:r.edit.read()).toString()&&(l.value=s,l.dataBind())),t.editModule.dialogModule.dialogObj&&ne.getValue("dialogOpen",t.editModule.dialogModule.dialogObj))return;t.treeGrid.grid.saveCell(),t.element.querySelector(".e-treegrid").focus()}!ne.isNullOrUndefined(n)&&!ne.isNullOrUndefined(n.closest(".e-chart-row"))&&(r=e.target,o=n.querySelector(".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone"))&&this.parent.ganttChartModule.onTaskbarClick(e,r,o);break;case"escape":ne.isNullOrUndefined(t.editModule)||ne.isNullOrUndefined(t.editModule.cellEditModule)||(t.editModule.cellEditModule.isCellEdit=!1,ne.isNullOrUndefined(t.toolbarModule))||t.toolbarModule.refreshToolbarItems();break;case"addRow":t.editModule&&t.editModule.cellEditModule&&t.editModule.cellEditModule.isCellEdit?e.stopPropagation():ne.isNullOrUndefined(document.getElementById(this.parent.element.id+"_dialog"))&&(e.preventDefault(),t.addRecord(void 0,this.parent.editSettings.newRowPosition,this.parent.selectedRowIndex),t.element.focus());break;case"addRowDialog":if(e.preventDefault(),t.editModule&&t.editModule.dialogModule&&t.editSettings.allowAdding){if(t.editModule.dialogModule.dialogObj&&ne.getValue("dialogOpen",t.editModule.dialogModule.dialogObj))return;t.editModule.dialogModule.openAddDialog()}break;case"editRowDialog":if(e.preventDefault(),t.element.querySelector(".e-treegrid").focus(),t.editModule&&t.editModule.dialogModule&&t.editSettings.allowEditing){if(t.editModule.dialogModule.dialogObj&&ne.getValue("dialogOpen",t.editModule.dialogModule.dialogObj))return;t.editModule.dialogModule.openToolbarEditDialog()}break;case"delete":t.selectionModule&&t.editModule&&t.editModule.dialogModule&&(!t.editModule.dialogModule.dialogObj||t.editModule.dialogModule.dialogObj&&!t.editModule.dialogModule.dialogObj.visible)&&(!t.editSettings.allowTaskbarEditing||t.editSettings.allowTaskbarEditing&&!t.editModule.taskbarEditModule.touchEdit)&&("Cell"!==t.selectionSettings.mode&&t.selectionModule.selectedRowIndexes.length||"Cell"===t.selectionSettings.mode&&t.selectionModule.getSelectedRowCellIndexes().length)&&(ne.isNullOrUndefined(e.target)||"INPUT"!==e.target.tagName)&&t.editModule.startDeleteAction();break;case"focusTask":e.preventDefault();var s=void 0;t.selectionModule&&(l=t.currentViewData,"Cell"===t.selectionSettings.mode||ne.isNullOrUndefined(l[t.selectedRowIndex])?"Cell"===t.selectionSettings.mode&&0<t.selectionModule.getSelectedRowCellIndexes().length&&(s=l[(r=t.selectionModule.getSelectedRowCellIndexes())[r.length-1].rowIndex].ganttProperties.rowUniqueID):s=t.currentViewData[t.selectedRowIndex].ganttProperties.rowUniqueID),s&&t.scrollToTask(s.toString());break;case"focusSearch":t.element.querySelector("#"+t.element.id+"_searchbar")&&((d=t.element.querySelector("#"+t.element.id+"_searchbar")).setAttribute("tabIndex","-1"),d.focus());break;case"tab":case"shiftTab":t.element.classList.contains("e-scroll-disabled")||t.ganttChartModule.onTabAction(e);break;case"contextMenu":var o=document.getElementById(this.parent.element.id+"_contextmenu").ej2_instances[0],l=this.parent.getOffsetRect(e.target),r=l.top+l.height/2,s=l.left+l.width/2;this.setActiveElement(e.target),o.open(r,s),e.preventDefault();break;case"undo":this.parent.undoRedoModule&&0<this.parent.undoRedoModule.getUndoCollection.length&&this.parent.undo();break;case"redo":this.parent.undoRedoModule&&0<this.parent.undoRedoModule.getRedoCollection.length&&this.parent.redo();break;case"selectAll":e.preventDefault();var d=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children);0<d.length&&(l=parseInt(d[0].getAttribute("aria-rowindex"),10)-1,o=parseInt(d[d.length-1].getAttribute("aria-rowindex"),10)-1,ne.isNullOrUndefined(l)||(l=Number(l)),ne.isNullOrUndefined(o)||(o=Number(o)),ne.isNullOrUndefined(l)||ne.isNullOrUndefined(o)||this.parent.selectionModule.selectRowsByRange(l,o));break;default:r={requestType:"keyPressed",action:e.action,keyEvent:e};t.trigger("actionComplete",r)}},ha.prototype.upDownKeyNavigate=function(e){e.preventDefault();var t,i,a,n,r,s=this.parent,o=("downArrow"===e.action||"upArrow"===e.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?s.getExpandedRecords(s.flatData):s.getExpandedRecords(s.currentViewData);s.selectionModule&&("Cell"!==s.selectionSettings.mode&&-1!==s.selectedRowIndex?(i=void 0,i=(("downArrow"===e.action||"upArrow"===e.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?s.flatData:s.currentViewData)[s.selectedRowIndex],(a=s.element.querySelector(".e-focused"))&&ne.removeClass([a],"e-focused"),a=o.indexOf(i),n="downArrow"===e.action?o[a+1]:o[a-1],r=this.parent.args,document.activeElement!==r&&(("downArrow"===e.action||"upArrow"===e.action)&&this.parent.selectionModule&&this.parent.allowSelection&&this.parent.virtualScrollModule&&this.parent.enableVirtualization?s.selectionModule.selectRow(s.flatData.indexOf(n),!1,!0):s.selectionModule.selectRow(s.currentViewData.indexOf(n),!1,!0))):"Cell"===s.selectionSettings.mode&&0<s.selectionModule.getSelectedRowCellIndexes().length&&(t=(r=(r=s.selectionModule.getSelectedRowCellIndexes())[r.length-1]).cellIndexes[r.cellIndexes.length-1],i=s.currentViewData[r.rowIndex],a=o.indexOf(i),n="downArrow"===e.action?o[a+1]:o[a-1],r={rowIndex:s.currentViewData.indexOf(n),cellIndex:t},s.selectionModule.selectCell(r)),this.parent.ganttChartModule.focusedRowIndex=this.parent.selectedRowIndex)},ha.prototype.expandCollapseKey=function(e){var t,i,a=this.parent;a.selectionModule&&-1!==a.selectedRowIndex&&("Cell"!==a.selectionSettings.mode?i=a.selectedRowIndex:"Cell"===a.selectionSettings.mode&&0<a.selectionModule.getSelectedRowCellIndexes().length&&(t=a.selectionModule.getSelectedRowCellIndexes(),i=t[t.length-1].rowIndex),this.parent.virtualScrollModule&&this.parent.enableVirtualization&&(i=this.parent.currentViewData.findIndex(function(e){return e.ganttProperties.rowUniqueID===i.toString()})+1),"expandRow"===e.action?(this.isFromKeyboardAction=!0,a.expandByIndex(i)):(this.isFromKeyboardAction=!0,a.collapseByIndex(i)),this.isFromKeyboardAction=!1)};var da=ha;function ha(e){this.isFromKeyboardAction=!1,this.parent=e,this.activeElement=null,this.previousActiveElement=null}pa=function(e,t){return(pa=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var pa,ua,$i=function(e,t){function i(){this.constructor=e}pa(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},g=function(e,t,i,a){var n,r=arguments.length,s=r<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,a);else for(var o=e.length-1;0<=o;o--)(n=e[o])&&(s=(r<3?n(s):3<r?n(t,i,s):n(t,i))||s);return 3<r&&s&&Object.defineProperty(t,i,s),s},$i=(ua=ne.Component,$i(f,ua),f.prototype.getModuleName=function(){return"gantt"},f.prototype.preRender=function(){this.initProperties()},f.prototype.getCurrentDayStartTime=function(e){e=0<this.weekWorkingTime.length?this.getStartTime(e):this.defaultStartTime;return e},f.prototype.getCurrentDayEndTime=function(e){e=0<this.weekWorkingTime.length?this.getEndTime(e):this.defaultEndTime;return e},f.prototype.getStartTime=function(e){var t;switch(e.getDay()){case 0:t=this.sundayDefaultStartTime;break;case 1:t=this.mondayDefaultStartTime;break;case 2:t=this.tuesdayDefaultStartTime;break;case 3:t=this.wednesdayDefaultStartTime;break;case 4:t=this.thursdayDefaultStartTime;break;case 5:t=this.fridayDefaultStartTime;break;default:t=this.saturdayDefaultStartTime}return t},f.prototype.getEndTime=function(e){var t;switch(e.getDay()){case 0:t=this.sundayDefaultEndTime;break;case 1:t=this.mondayDefaultEndTime;break;case 2:t=this.tuesdayDefaultEndTime;break;case 3:t=this.wednesdayDefaultEndTime;break;case 4:t=this.thursdayDefaultEndTime;break;case 5:t=this.fridayDefaultEndTime;break;default:t=this.saturdayDefaultEndTime}return t},f.prototype.getNonWorkingRange=function(e){var t;switch(e.getDay()){case 0:t=this.sundayNonWorkingTimeRanges;break;case 1:t=this.mondayNonWorkingTimeRanges;break;case 2:t=this.tuesdayNonWorkingTimeRanges;break;case 3:t=this.wednesdayNonWorkingTimeRanges;break;case 4:t=this.thursdayNonWorkingTimeRanges;break;case 5:t=this.fridayNonWorkingTimeRanges;break;default:t=this.saturdayNonWorkingTimeRanges}return t},f.prototype.getWorkingRange=function(e){var t;switch(e.getDay()){case 0:t=this.sundayWorkingTimeRanges;break;case 1:t=this.mondayWorkingTimeRanges;break;case 2:t=this.tuesdayWorkingTimeRanges;break;case 3:t=this.wednesdayWorkingTimeRanges;break;case 4:t=this.thursdayWorkingTimeRanges;break;case 5:t=this.fridayWorkingTimeRanges;break;default:t=this.saturdayWorkingTimeRanges}return t},f.prototype.getSecondsPerDay=function(e){var t;switch(e.getDay()){case 0:t=this.sundaySeconds;break;case 1:t=this.mondaySeconds;break;case 2:t=this.tuesdaySeconds;break;case 3:t=this.wednesdaySeconds;break;case 4:t=this.thursdaySeconds;break;case 5:t=this.fridaySeconds;break;case 6:t=this.saturdaySeconds;break;default:t=this.secondsPerDay}return t},f.prototype.showLoadingIndicator=function(){ne.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.showSpinner():this.showMaskRow()},f.prototype.hideLoadingIndicator=function(){ne.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.hideSpinner():this.hideMaskRow()},f.prototype.initProperties=function(){this.globalize=new ne.Internationalization(this.locale),this.isAdaptive=ne.Browser.isDevice,this.flatData=[],this.currentViewData=[],this.updatedRecords=[],this.ids=[],this.ganttColumns=[],this.updateOffsetOnTaskbarEdit=!1===this.UpdateOffsetOnTaskbarEdit?this.UpdateOffsetOnTaskbarEdit:this.updateOffsetOnTaskbarEdit,this.localeObj=new ne.L10n(this.getModuleName(),this.getDefaultLocale(),this.locale),this.dataOperation=new ie(this),this.nonWorkingHours=[],this.mondayNonWorkingHours=[],this.tuesdayNonWorkingHours=[],this.wednesdayNonWorkingHours=[],this.thursdayNonWorkingHours=[],this.fridayNonWorkingHours=[],this.saturdayNonWorkingHours=[],this.sundayNonWorkingHours=[],this.nonWorkingTimeRanges=[],this.mondayNonWorkingTimeRanges=[],this.tuesdayNonWorkingTimeRanges=[],this.wednesdayNonWorkingTimeRanges=[],this.thursdayNonWorkingTimeRanges=[],this.fridayNonWorkingTimeRanges=[],this.saturdayNonWorkingTimeRanges=[],this.sundayNonWorkingTimeRanges=[],this.workingTimeRanges=[],this.mondayWorkingTimeRanges=[],this.tuesdayWorkingTimeRanges=[],this.wednesdayWorkingTimeRanges=[],this.thursdayWorkingTimeRanges=[],this.fridayWorkingTimeRanges=[],this.saturdayWorkingTimeRanges=[],this.sundayWorkingTimeRanges=[],this.defaultEndTime=null,this.defaultStartTime=null,this.mondayDefaultStartTime=null,this.mondayDefaultEndTime=null,this.tuesdayDefaultStartTime=null,this.tuesdayDefaultEndTime=null,this.wednesdayDefaultStartTime=null,this.wednesdayDefaultEndTime=null,this.thursdayDefaultStartTime=null,this.thursdayDefaultEndTime=null,this.fridayDefaultStartTime=null,this.fridayDefaultEndTime=null,this.saturdayDefaultStartTime=null,this.saturdayDefaultEndTime=null,this.sundayDefaultStartTime=null,this.sundayDefaultEndTime=null,this.durationUnitTexts={days:"days",hours:"hours",minutes:"minutes",day:"day",hour:"hour",minute:"minute"},this.durationUnitEditText={minute:["m","min","minute","minutes"],hour:["h","hr","hour","hours"],day:["d","dy","day","days"]},this.perDayWidth=null,this.isMileStoneEdited=!1,this.chartVerticalLineContainer=null,this.updatedConnectorLineCollection=[],this.connectorLineIds=[],this.predecessorsCollection=[],this.isInPredecessorValidation=this.enablePredecessorValidation,this.isValidationEnabled=!0,this.isLoad=!0,this.editedPredecessorRecords=[],this.validationDialogElement=null,this.currentEditedArgs={},this.dialogValidateMode={respectLink:!1,removeLink:!1,preserveLinkWithEditing:!0},this.taskFields.constraintType&&this.taskFields.constraintDate&&(this.dialogValidateMode.respectMustStartOn=!1,this.dialogValidateMode.respectMustFinishOn=!1,this.dialogValidateMode.respectStartNoLaterThan=!1,this.dialogValidateMode.respectFinishNoLaterThan=!1),this.secondsPerDay=this.dataOperation.getSecondsPerDay(),this.nonWorkingDayIndex=[],this.dataOperation.getNonWorkingDayIndex(),this.columnMapping={},this.controlId=this.element.id,this.cloneProjectStartDate=this.enablePersistence&&this.cloneProjectStartDate?this.cloneProjectStartDate:null,this.cloneProjectEndDate=this.enablePersistence&&this.cloneProjectEndDate?this.cloneProjectEndDate:null,this.totalHolidayDates=this.dataOperation.getHolidayDates(),this.ganttChartModule=new Rt(this),this.timelineModule=new Ot(this),this.chartRowsModule=new ia(this),this.treeGridModule=new It(this),this.dateValidationModule=new J(this),this.predecessorModule=new aa(this),this.connectorLineModule=new na(this),this.splitterModule=new ra(this),this.tooltipModule=new oa(this),this.keyConfig={home:"home",end:"end",downArrow:"downarrow",upArrow:"uparrow",collapseAll:"ctrl+uparrow",expandAll:"ctrl+downarrow",collapseRow:"ctrl+shift+uparrow",expandRow:"ctrl+shift+downarrow",saveRequest:"13",escape:"27",addRow:"insert",addRowDialog:"ctrl+insert",editRowDialog:"ctrl+f2",delete:"delete",tab:"tab",shiftTab:"shift+tab",focusTask:"shift+f5",indentLevel:"shift+leftarrow",outdentLevel:"shift+rightarrow",focusSearch:"ctrl+shift+70",contextMenu:"shift+F10",undo:"ctrl+z",redo:"ctrl+y",selectAll:"ctrl+a"},this.focusModule=new da(this),0===this.zoomingLevels.length&&this.setProperties({zoomingLevels:this.getZoomingLevels()},!0),this.resourceFieldsMapping(),ne.isNullOrUndefined(this.resourceFields.unit)&&this.setProperties({resourceFields:{unit:"unit"}},!0),this.taskIds=[]},f.prototype.isUndoRedoItemPresent=function(e){return!(!this.undoRedoModule||!this.undoRedoActions||-1===this.undoRedoActions.indexOf(e))},f.prototype.getDateFormat=function(){return ne.isNullOrUndefined(this.dateFormat)?this.globalize.getDatePattern({skeleton:"yMd"}):this.dateFormat},f.prototype.getDefaultTZOffset=function(){var e=new Date((new Date).getFullYear(),0,1),t=new Date((new Date).getFullYear(),6,1);return Math.max(e.getTimezoneOffset(),t.getTimezoneOffset())},f.prototype.isInDst=function(e){return e.getTimezoneOffset()<this.getDefaultTZOffset()},f.prototype.resourceFieldsMapping=function(){var e=this.resourceFields;e.id=ne.isNullOrUndefined(e.id)?this.resourceIDMapping:e.id,e.name=ne.isNullOrUndefined(e.name)?this.resourceNameMapping:e.name},f.prototype.validateDimentionValue=function(e){return ne.isNullOrUndefined(e)?null:"string"==typeof e&&"auto"!==e&&-1===e.indexOf("%")?-1===e.indexOf("px")?e+"px":e:"number"==typeof e?e+"px":e.toString()},f.prototype.calculateDimensions=function(){var e=this.validateDimentionValue(this.height),t=this.validateDimentionValue(this.width),i=(ne.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(t=this.width),this.element.style.height),a=this.element.style.width;t&&(this.element.style.width=t),e&&(this.element.style.height=e),e||i||(this.element.style.height="auto"),t||a||(this.element.style.width="auto"),this.ganttHeight=this.element.offsetHeight,this.ganttWidth=this.element.offsetWidth},f.prototype.render=function(){this.isReact&&(this.treeGrid.isReact=!0,this.treeGrid.grid.isReact=!0),this.isVue&&(this.treeGrid.isVue=!0,this.treeGrid.grid.isVue=!0,this.treeGrid.vueInstance=this.vueInstance,this.treeGrid.grid.vueInstance=this.vueInstance),this.taskFields&&this.taskFields.constraintDate&&this.taskFields.constraintType&&!this.updateOffsetOnTaskbarEdit&&(this.updateOffsetOnTaskbarEdit=!1),this.element.setAttribute("role","application"),F.createSpinner({target:this.element},this.createElement),this.trigger("load",{}),this.element.classList.add(ae),this.isAdaptive?this.element.classList.add(pe):this.element.classList.remove(pe),this.calculateDimensions(),ne.isNullOrUndefined(this.toolbarModule)||this.renderToolbar(),this.splitterModule.renderSplitter(),this.notify("renderPanels",null),this.actionFailures(),this.showLoadingIndicator(),this.dataMap&&this.dataMap.clear(),this.dataOperation.checkDataBinding()},f.prototype.actionFailures=function(){for(var e,t,i,a,n,r,s=[],o=/^[a-zA-Z\s/]+$/,l=!0,d=this.taskFields.properties,h=(Object.keys(d).forEach(function(e){null!==d[e]&&(l=!1)}),!0),p=0;p<this.columns.length;p++)if(this.columns[p].isPrimaryKey){h=!1;break}function u(t,e,i,a){var n;ne.isNullOrUndefined(i)||(n=i.filter(function(e){return e.prototype.getModuleName()===t})),e&&!ne.isNullOrUndefined(n)&&0===n.length&&a.push("Module "+t+" is not available in Gantt component! You either misspelled the module name or forgot to load it!")}l&&s.push("Gantt Task Fields are not configured properly. The task fields are crucial for both the project and resource views to function properly. Please ensure that the gantt task fields are properly configured!"),"ResourceView"!==this.viewType||this.resourceFields.id||s.push("Gantt Resource Fields are not properly configured, which is crucial for the Resource View. Please ensure that the resource fields are configured correctly!"),this.dataSource instanceof D.DataManager&&ne.isNullOrUndefined(this.taskFields.hasChildMapping)&&s.push("hasChildMapping property is not configured for load-on-demand. Please ensure its properly configured in the Gantt Task Fields!"),ne.isNullOrUndefined(this.timelineSettings.topTier.format)||""===this.timelineSettings.topTier.format||o.test(this.timelineSettings.topTier.format)||s.push("The provided top tier format is invalid. Please ensure that you provide a valid format for these tier. Make sure to use only letters and avoid numbers or special characters!"),ne.isNullOrUndefined(this.timelineSettings.bottomTier.format)||""===this.timelineSettings.bottomTier.format||o.test(this.timelineSettings.bottomTier.format)||s.push("The provided bottom  tier format is invalid. Please ensure that you provide a valid format for these tier. Make sure to use only letters and avoid numbers or special characters!"),h&&"ResourceView"!==this.viewType&&s.push("Primarykey is not configured properly. The primarykey is crucial for doing CRUD operations or map taskId in column field of gantt!"),0<this.eventMarkers.length&&this.eventMarkers.forEach(function(e){e.day||s.push("Day is not configured properly in event markers.Please ensure that the day in event markers is properly configured!")}),u("sort",this.allowSorting,this.injectedModules,s),u("edit",e=this.editSettings.allowAdding||this.editSettings.allowDeleting||this.editSettings.allowEditing||this.editSettings.allowNextRowEdit||this.editSettings.allowTaskbarEditing||this.editSettings.mode||this.editSettings.newRowPosition||this.editSettings.showDeleteConfirmDialog?!0:e,this.injectedModules,s),u("reorder",this.allowReordering,this.injectedModules,s),u("excelExport",this.allowExcelExport,this.injectedModules,s),u("rowDragAndDrop",t=this.allowRowDragAndDrop||this.allowTaskbarDragAndDrop?!0:t,this.injectedModules,s),u("criticalPath",this.enableCriticalPath,this.injectedModules,s),u("undoRedo",this.enableUndoRedo,this.injectedModules,s),u("resize",this.allowResizing,this.injectedModules,s),u("toolbar",i=this.toolbar&&0<this.toolbar.length?!0:i,this.injectedModules,s),u("filter",a=this.allowFiltering||this.toolbar&&-1!==this.toolbar.indexOf("Search")?!0:a,this.injectedModules,s),u("selection",this.allowSelection,this.injectedModules,s),u("dayMarkers",n=this.highlightWeekends||this.holidays&&0<this.holidays.length||this.eventMarkers&&0<this.eventMarkers.length?!0:n,this.injectedModules,s),u("contextMenu",this.enableContextMenu,this.injectedModules,s),u("columnMenu",this.showColumnMenu,this.injectedModules,s),u("pdfExport",this.allowPdfExport,this.injectedModules,s),u("virtualScroll",this.enableVirtualization,this.injectedModules,s),0<s.length&&(r={error:{}},s.forEach(function(e,t){r.error[parseInt(t,10)]=e}),this.trigger("actionFailure",r))},f.prototype.hideMaskRow=function(){var e,t=this.element.querySelectorAll(".e-masked-table").length;for(ne.isNullOrUndefined(this.contentMaskTable)||0===t&&!this.contentMaskTable||(e=this.contentMaskTable,ne.remove(e),this.contentMaskTable=null),t=this.element.querySelectorAll(".e-masked-table").length,ne.isNullOrUndefined(this.headerMaskTable)||0===t&&!this.headerMaskTable||(e=this.headerMaskTable,ne.remove(e),this.headerMaskTable=null);0!==this.element.querySelectorAll(".e-table-background").length;)this.element.querySelectorAll(".e-table-background")[0].remove();for(;0!==this.element.querySelectorAll(".e-temp-timeline").length;)this.element.querySelectorAll(".e-temp-timeline")[0].remove();if(0!==this.element.querySelectorAll("."+ge).length)for(var i=0;i<this.singleTier;i++)ne.isNullOrUndefined(this.element.querySelectorAll("."+ge)[parseInt(i.toString(),10)])||(this.element.querySelectorAll("."+ge)[parseInt(i.toString(),10)].style.visibility="visible");ne.isNullOrUndefined(this.element.querySelector("."+ce))||(this.element.querySelector("."+ce).style.position="relative"),ne.isNullOrUndefined(this.element.getElementsByClassName(he)[0])||(this.element.getElementsByClassName(he)[0].style.visibility="visible")},f.prototype.showMaskRow=function(){var e=this.chartPane.childNodes[0].childNodes[0],t=(this.scrollLeftValue=this.chartPane.childNodes[0].childNodes[0].scrollLeft,this.chartPane.childNodes[0].childNodes[1]);if(this.treeGrid.element&&this.ganttChartModule.setVirtualHeight(),!this.contentMaskTable){if(t){var i=t;if(this.renderBackGround(i),this.ganttChartModule.scrollObject.isSetScrollLeft){if(0!==this.element.querySelectorAll("."+ge).length){this.singleTier=this.timelineModule.isSingleTier?1:2;for(var a=0;a<this.singleTier;a++)this.element.querySelectorAll("."+ge)[parseInt(a.toString(),10)].style.visibility="hidden"}0===this.singleTier&&(this.singleTier=2)}this.element.getElementsByClassName(he)[0].style.visibility="hidden",this.contentMaskTable=this.contentMaskTable=this.createMaskTable(i)}e&&this.ganttChartModule.scrollObject.isSetScrollLeft&&(this.element.querySelector("."+ce).style.position="static",this.renderHeaderBackground(i=e),this.headerMaskTable=this.headerMaskTable=this.createMaskTable(i))}},f.prototype.convertToWBSPredecessor=function(e,t){var i=this;return e.split(",").map(function(e){var t=e.trim().match(/^(.*?)(FS|SS|FF|SF|\+|\s|$)(.*)/i);return t?i.getRecordByID(t[1]).ganttProperties.wbsCode+(t[2]+t[3]).trim():e.trim()}).join(",")},f.prototype.updateWBSPredecessor=function(e){var t=e[this.taskFields.dependency]&&""!==e[this.taskFields.dependency]?this.convertToWBSPredecessor(e[this.taskFields.dependency],e):null;e.WBSPredecessor=t,e.ganttProperties.wbsPredecessor=t},f.prototype.updateWBSCodes=function(e,t,i,a){var n=this.getParentTask(e.parentItem),r=(i.get(n)||0)+1;return i.set(n,r),n=n?t.get(n)+"."+r:""+r,t.set(e,n),a||(e.WBSCode=n.toString(),e.ganttProperties.wbsCode=n.toString()),{wbsMap:t,siblingCountMap:i}},f.prototype.getMaxRootWBSCode=function(e,t){for(var i="",a=0,n=e;a<n.length;a++){var r=n[a].ganttProperties.wbsCode;if(r){for(var s=i.split(".").map(Number),o=r.split(".").map(Number),l=Math.max(s.length,o.length),d=!1,h=0;h<l;h++){var p=o[h]||0,u=s[h]||0;if(u<p){d=!0;break}if(p<u)break}!d&&i||(i=r)}}return i?((e=i.split(".").map(Number))[e.length-1]++,e.join(".")):t.ganttProperties.wbsCode+".1"},f.prototype.generateWBSCodes=function(e){for(var t=new Map,i=[],a=new Map,n=0,r=e;n<r.length;n++){var s,o,l=r[n];this.enableAutoWbsUpdate||this.isLoad?(t=(o=this.updateWBSCodes(l,t,a)).wbsMap,a=o.siblingCountMap):l.ganttProperties.wbsCode||(o=void 0,o=l.parentItem?(o=(s=this.getParentTask(l.parentItem)).ganttProperties.wbsCode,this.getMaxRootWBSCode(s.childRecords,s)):this.getMaxRootWBSCode(this.treeGrid.parentData),l.WBSCode=o,l.ganttProperties.wbsCode=o),l[this.taskFields.dependency]?i.push(l):(l.WBSPredecessor=null,l.ganttProperties.wbsPredecessor=null)}for(var d=0,h=i;d<h.length;d++){l=h[d];this.updateWBSPredecessor(l)}},f.prototype.renderHeaderBackground=function(e){var t=e;if(!!ne.closest(t,"."+ce)){for(var i=this.createElement("div",{className:"e-table-background"}),a=0,n=Math.round(e.getBoundingClientRect().width),r=0;r<3;r++)this.enableRtl?i.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n-=160)+"px; top:0px;"}})):i.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(a+=160)+"px; top:0px;"}}));t.insertBefore(i,t.firstChild)}},f.prototype.assignTimeToDate=function(e,t){var e=new Date(e),i=Math.floor(t/3600),a=Math.floor(t%3600/60);return e.setHours(i,a,t%60,0),e},f.prototype.renderBackGround=function(e){var t=e;if(!!ne.closest(t,"."+de)){for(var i=this.createElement("div",{className:"e-table-background"}),a=0,n=Math.round(e.getBoundingClientRect().width),r=0;r<3;r++)this.enableRtl?i.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n-=160)+"px;z-index:1;"}})):i.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(a+=160)+"px;z-index:1;"}}));t.insertBefore(i,t.firstChild)}},f.prototype.createMaskTable=function(e){var t,i=e,a=e.getBoundingClientRect().height,n=!!ne.closest(i,"."+ce);return n?((t=this.createEmptyTimeLineTable(a)).style.position="sticky",t.style.left="0px",this.enableRtl&&t.style.removeProperty("left")):((t=this.createEmptyMaskTable(a)).style.position="absolute",t.style.zIndex=1),n?(t.style.height=e.getBoundingClientRect().height+"px",(a=this.createElement("div",{className:"e-temp-timeline"})).style.width=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth+"px",a.style.position="sticky",this.enableRtl?a.style["margin-right"]=Math.abs(this.scrollLeftValue)+"px":a.style["margin-left"]=this.scrollLeftValue+"px",a.appendChild(t),i.insertBefore(a,i.firstChild)):(t.style.height=e.getBoundingClientRect().height+"px",i.insertBefore(t,i.firstChild)),t},f.prototype.createEmptyTimeLineTable=function(e){for(var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),a=[],n=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/2+"px;"}}),r=0;r<this.singleTier;r++)a.push(n.cloneNode(!0));for(r=this.topBottomHeader=0;r<a.length;r++)i.appendChild(this.applyTimelineMaskRow(a[parseInt(r.toString(),10)])),this.topBottomHeader=this.topBottomHeader+1;return t.appendChild(i),t.style.width="100%",t},f.prototype.applyTimelineMaskRow=function(e){var t=e,i=4;4<this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/166&&(i=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/166);for(var a=0;a<i;a++)t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(a=0;a<t.childNodes.length-1;a++)t.childNodes[parseInt(a.toString(),10)].style.width="166px";for(var n=[].slice.call(t.childNodes),a=0;a<n.length;a++){var r=n[parseInt(a.toString(),10)];switch(this.topBottomHeader){case 0:this.enableRtl?(r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>',r.children[0].style.left="-20px"):r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>';break;case 1:r.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),r.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),r.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(var s=[].slice.call(r.childNodes),o=0;o<s.length;o++){var l=s[parseInt(o.toString(),10)];0===o?this.enableRtl?(l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>',l.children[0].style.left="-14px"):l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>':1===o?this.enableRtl?(l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>',l.children[0].style.left="-30px"):l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>':this.enableRtl?(l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>',l.children[0].style.left="-60px"):l.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>'}}}return t},f.prototype.createEmptyMaskTable=function(e){for(var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),a=[],n=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/7+"px;"}}),r=this.columnLoop=0;r<6;r++)a.push(n.cloneNode(!0));for(var s=0;s<a.length;s++)this.columnLoop<4?this.columnLoop=this.columnLoop+1:4===this.columnLoop&&(this.columnLoop=1),i.appendChild(this.applyMaskRow(a[parseInt(s.toString(),10)]));t.appendChild(i),t.style.width="100%";e=this.createElement("div",{className:"e-temp-container"});return e.style.width="calc(100% - 17px)",e.style.overflow="hidden",e.appendChild(t),e},f.prototype.applyMaskRow=function(e){var t=e;if(this.columnLoop<4){var i=2;2<this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/300&&(i=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetWidth/300);for(var a=0;a<i;a++)t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}))}else t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}));for(var n=[].slice.call(t.childNodes),a=0;a<n.length;a++){var r=n[parseInt(a.toString(),10)];switch(this.columnLoop){case 1:0===a?this.enableRtl?(r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>',r.children[0].style.left="-14px"):r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>':r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell02"></span>';break;case 2:0===a?this.enableRtl?(r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>',r.children[0].style.left="-14px"):r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>':r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell04"></span>';break;case 3:0===a?this.enableRtl?(r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>',r.children[0].style.left="-64px"):r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>':this.enableRtl?(r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>',r.children[0].style.left="-192px"):r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>';break;case 4:this.enableRtl?(r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>',r.children[0].style.left="-388px"):r.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>'}}return t},f.prototype.showSpinner=function(){F.showSpinner(this.element)},f.prototype.hideSpinner=function(){F.hideSpinner(this.element)},f.prototype.processTimeline=function(){this.timelineModule.processTimelineUnit(),this.timelineModule.calculateZoomingLevelsPerDayWidth()},f.prototype.renderGantt=function(e){e&&(this.isFromOnPropertyChange=e),this.enableValidation&&(this.dataOperation.calculateProjectDates(),this.timelineModule.validateTimelineProp());var t=this.flatData,i=new Map;if(null!=t)for(var a=0,n=t;a<n.length;a++){var r=n[a];i.set(r.ganttProperties.rowUniqueID.toString(),r)}this.allowParentDependency&&this.predecessorModule.updateParentPredecessor(i),this.predecessorModule&&this.taskFields.dependency&&(this.predecessorModule.parentIds=[],this.predecessorModule.parentRecord=[],this.predecessorModule.updatePredecessors(i),this.isInPredecessorValidation)&&this.enableValidation&&this.autoCalculateDateScheduling&&(!this.isLoad||this.treeGrid.loadChildOnDemand||!this.taskFields.hasChildMapping)&&this.predecessorModule.updatedRecordsDateByPredecessor(i),this.enableValidation&&(this.dataOperation.calculateProjectDates(),this.timelineModule.validateTimelineProp(),this.dataOperation.updateGanttData()),e?(this.dataSource instanceof Object&&H(this)?(t=ne.getValue("count",this.dataSource),this.treeGrid.dataSource={result:this.flatData,count:t}):this.treeGrid.setProperties({dataSource:this.flatData},!1),ne.isNullOrUndefined(this.selectionModule)||this.treeGrid.setProperties({selectedRowIndex:this.selectedRowIndex},!1)):(this.treeGridPane.classList.remove("e-temp-content"),ne.isNullOrUndefined(this.treeGridPane.querySelector(".e-gantt-temp-header"))||ne.remove(this.treeGridPane.querySelector(".e-gantt-temp-header")),this.notify("dataReady",{}),this.enableContextMenu&&this.notify("initiate-contextMenu",{}),e=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")&&36===this.rowHeight?46:this.rowHeight,this.rowHeight=ne.isNullOrUndefined(this.rowHeight)?36:e,this.renderTreeGrid(),this.wireEvents(),this.notify("initPredessorDialog",{})),this.isFromOnPropertyChange||this.splitterModule.updateSplitterPosition(),"Vertical"!==this.gridLines&&"Both"!==this.gridLines||this.dayMarkersModule||this.renderChartVerticalLines()},f.prototype.removeCriticalPathStyles=function(){var e=this.ganttChartModule.chartElement;ne.removeClass(e.querySelectorAll(".e-gantt-child-taskbar-inner-div"),ve),ne.removeClass(e.querySelectorAll(".e-gantt-child-progressbar-inner-div"),Se),ne.removeClass(e.querySelectorAll(".e-critical-milestone"),Pe),ne.removeClass(this.element.querySelectorAll(".e-connector-line"),at),ne.removeClass(this.element.querySelectorAll(".e-connector-line-arrow"),nt)},f.prototype.wireEvents=function(){this.allowKeyboard&&(this.keyboardModule=new ne.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfig,eventName:"keydown"})),ne.EventHandler.add(window,"resize",this.windowResize,this),ne.EventHandler.add(document.body,"keydown",this.keyDownHandler,this)},f.prototype.unwireEvents=function(){this.keyboardModule&&(this.keyboardModule.destroy(),this.keyboardModule=null),ne.EventHandler.remove(window,"resize",this.windowResize),ne.EventHandler.remove(document.body,"keydown",this.keyDownHandler)},f.prototype.keyDownHandler=function(e){e.altKey&&74===e.keyCode&&(this.ganttChartModule.manageFocus(this.treeGrid.element.childNodes[1],"remove",!1),this.ganttChartModule.manageFocus(this.element,"add",!1))},f.prototype.windowResize=function(){var e,t,i=this;ne.isNullOrUndefined(this.element)||(this.updateContentHeight(),this.ganttChartModule.updateWidthAndHeight(),this.treeGridModule.ensureScrollBar(),this.predecessorModule&&this.taskFields.dependency&&(this.updateRowHeightInConnectorLine(this.updatedConnectorLineCollection),this.connectorLineModule.renderConnectorLines(this.updatedConnectorLineCollection)),e=this.criticalPathModule,this.enableCriticalPath&&e&&e.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds),this.calculateDimensions(),e=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[0],t=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[1],this.splitterModule.splitterPreviousPositionGrid=e.scrollWidth+1+"px",this.splitterModule.splitterPreviousPositionChart=t.scrollWidth+1+"px",this.timelineModule.isZoomedToFit&&setTimeout(function(){i.timelineModule.processZoomToFit()},0)),this.dayMarkersModule&&this.dayMarkersModule.eventMarkerRender&&this.dayMarkersModule.eventMarkerRender.updateContainerHeight(),this.enableTimelineVirtualization&&this.timelineModule.refreshTimeline()},f.prototype.keyActionHandler=function(e){var t;this.enableContextMenu&&this.contextMenuModule&&("downArrow"===e.action||"upArrow"===e.action)&&document.getElementById(this.element.id+"_contextmenu")&&this.args&&(t=this.args,ne.isNullOrUndefined(t)||t.focus()),e.target&&("downArrow"===e.action||"upArrow"===e.action)&&e.target===this.element.querySelector(".e-rowcell")||e.target&&"escape"===e.action&&this.treeGrid.grid.columnMenuModule&&"block"===this.treeGrid.grid.columnMenuModule.columnMenu.element.style.display?this.treeGrid.grid.notify("key-pressed",e):this.focusModule.onKeyPress(e)},f.prototype.updateRowHeightInConnectorLine=function(e){if(e&&e.length){var t=!ne.isNullOrUndefined(this.ganttChartModule)&&this.ganttChartModule.getChartRows()[0]&&this.ganttChartModule.getChartRows()[0].getBoundingClientRect().height;if(t&&!isNaN(t))for(var i=0;i<e.length;i++)e[i].rowHeight=t}},f.prototype.renderToolbar=function(){ne.isNullOrUndefined(this.toolbarModule)||(this.toolbarModule.renderToolbar(),this.toolbarModule.refreshToolbarItems())},f.prototype.renderTreeGrid=function(){this.treeGridModule.renderTreeGrid()},f.prototype.updateCurrentViewData=function(){var t=this;if(this.currentViewData=this.treeGrid.getCurrentViewRecords().slice(),0<this.currentViewData.length&&this.loadChildOnDemand&&this.taskFields.hasChildMapping){this.isLoad=!0,this.flatData=[],this.dataOperation.taskIds=[],this.ids=[],this.dataOperation.recordIndex=0,this.dataOperation.dataArray=this.currentViewData,this.dataOperation.cloneDataSource(),this.predecessorModule&&this.taskFields.dependency&&(this.predecessorModule.parentIds=[],this.predecessorModule.parentRecord=[],this.predecessorModule.updatePredecessors());for(var e=this.treeGrid.grid.contentModule.rows.filter(function(e){if(e.data[t.taskFields.id]===t.flatData[0].ganttProperties.taskId)return e})[0].index,i=0;i<this.flatData.length;i++)this.flatData[i].index=e,e++;this.currentViewData=this.flatData,this.treeGrid.grid.currentViewData=this.flatData,ne.isNullOrUndefined(this.treeGrid.virtualScrollModule)||(this.treeGrid.virtualScrollModule.visualData=this.flatData,this.updatedRecords=this.flatData)}},f.prototype.getRecordFromFlatdata=function(e){for(var t=[],i=0;i<e.length;i++)t.push(this.getTaskByUniqueID(e[i].uniqueID));return t},f.prototype.updateContentHeight=function(e){var t,i;(this.allowTaskbarOverlap||this.ganttChartModule.isCollapseAll||this.ganttChartModule.isExpandAll||this.isLoad)&&(this.virtualScrollModule&&this.enableVirtualization&&!ne.isNullOrUndefined(e)?(e=ne.getValue("result.length",e),this.contentHeight=e*this.rowHeight):(e=this.virtualScrollModule&&this.enableVirtualization?this.currentViewData:this.getExpandedRecords(this.currentViewData),i=void(this.expandedRecords=e),t=ne.isNullOrUndefined(this.ganttChartModule)||ne.isNullOrUndefined(this.ganttChartModule.getChartRows())?null:this.ganttChartModule.getChartRows()[0],i=!ne.isNullOrUndefined(t)&&0<t.offsetHeight?t.offsetHeight:this.rowHeight,this.contentHeight=e.length*i))},f.prototype.getExpandStatus=function(e){e=this.getParentTask(e.parentItem);return!!ne.isNullOrUndefined(e)||!1!==e.expanded&&(!e.parentItem||!1!==this.getParentTask(e.parentItem).expanded&&this.getExpandStatus(this.getParentTask(e.parentItem)))},f.prototype.getExpandedRecords=function(e){var t=this;return ne.isNullOrUndefined(e)?[]:(e=e.filter(function(e){return!0===t.getExpandStatus(e)}),this.expandedRecords=e)},f.prototype.getZoomingLevels=function(){var e=this.timelineSettings.weekStartDay;return[{topTier:{unit:"Year",format:"yyyy",count:50},bottomTier:{unit:"Year",format:"yyyy",count:10},timelineUnitSize:99,level:0,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:20},bottomTier:{unit:"Year",format:"yyyy",count:5},timelineUnitSize:99,level:1,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:5},bottomTier:{unit:"Year",format:"yyyy",count:1},timelineUnitSize:99,level:2,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"MMM, yy",count:1},bottomTier:{unit:"Month",formatter:this.displayHalfValue,count:6},timelineUnitSize:66,level:3,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"MMM, yy",count:1},bottomTier:{unit:"Month",formatter:this.displayHalfValue,count:6},timelineUnitSize:99,level:4,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"MMM, yy",count:1},bottomTier:{unit:"Month",formatter:this.displayQuarterValue,count:3},timelineUnitSize:66,level:5,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:1},bottomTier:{unit:"Month",formatter:this.displayQuarterValue,count:3},timelineUnitSize:99,level:6,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Year",format:"yyyy",count:1},bottomTier:{unit:"Month",format:"MMM yyyy",count:1},timelineUnitSize:99,level:7,timelineViewMode:"Year",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Month",format:"MMM, yy",count:1},bottomTier:{unit:"Week",format:"dd",count:1},timelineUnitSize:33,level:8,timelineViewMode:"Month",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Month",format:"MMM, yyyy",count:1},bottomTier:{unit:"Week",format:"dd MMM",count:1},timelineUnitSize:66,level:9,timelineViewMode:"Month",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Month",format:"MMM, yyyy",count:1},bottomTier:{unit:"Week",format:"dd MMM",count:1},timelineUnitSize:99,level:10,timelineViewMode:"Month",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Week",format:"MMM dd, yyyy",count:1},bottomTier:{unit:"Day",format:"d",count:1},timelineUnitSize:33,level:11,timelineViewMode:"Week",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Week",format:"MMM dd, yyyy",count:1},bottomTier:{unit:"Day",format:"d",count:1},timelineUnitSize:66,level:12,timelineViewMode:"Week",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Week",format:"MMM dd, yyyy",count:1},bottomTier:{unit:"Day",format:"d",count:1},timelineUnitSize:99,level:13,timelineViewMode:"Week",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:12},timelineUnitSize:66,level:14,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:12},timelineUnitSize:99,level:15,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:6},timelineUnitSize:66,level:16,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:6},timelineUnitSize:99,level:17,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:2},timelineUnitSize:66,level:18,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:2},timelineUnitSize:99,level:19,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:1},timelineUnitSize:66,level:20,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Day",format:"E dd yyyy",count:1},bottomTier:{unit:"Hour",format:"hh a",count:1},timelineUnitSize:99,level:21,timelineViewMode:"Day",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Hour",format:"ddd MMM, h a",count:1},bottomTier:{unit:"Minutes",format:"mm",count:30},timelineUnitSize:66,level:22,timelineViewMode:"Hour",weekStartDay:0,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Hour",format:"ddd MMM, h a",count:1},bottomTier:{unit:"Minutes",format:"mm",count:15},timelineUnitSize:66,level:23,timelineViewMode:"Hour",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0},{topTier:{unit:"Hour",format:"ddd MMM, h a",count:1},bottomTier:{unit:"Minutes",format:"mm",count:1},timelineUnitSize:66,level:24,timelineViewMode:"Hour",weekStartDay:e,updateTimescaleView:!0,weekendBackground:null,showTooltip:!0}]},f.prototype.displayQuarterValue=function(e){e=e.getMonth();return 0<=e&&e<=2?"Q1":3<=e&&e<=5?"Q2":6<=e&&e<=8?"Q3":"Q4"},f.prototype.displayHalfValue=function(e){e=e.getMonth();return 0<=e&&e<=5?"H1":"H2"},f.prototype.getFormatedDate=function(e,t){return ne.isNullOrUndefined(e)?null:(ne.isNullOrUndefined(t)&&(t=this.getDateFormat()),this.globalize.formatDate(e,{format:t}))},f.prototype.getDurationString=function(e,t){return this.dateValidationModule.getDurationString(e,t)},f.prototype.getWorkString=function(e,t){return this.dateValidationModule.getWorkString(e,t)},f.prototype.updateTreeColumns=function(){var e,t=this.treeGrid.grid.getColumns();-1!==this.treeColumnIndex&&this.columns[this.treeColumnIndex]&&!ne.isNullOrUndefined(this.columns[this.treeColumnIndex].template)&&(e=this.columns[this.treeColumnIndex].template);for(var i=0;i<t.length;i++)for(var a={},n=0;n<this.columns.length;n++)if(this.columns[n].field===t[i].field){for(var r=0,s=Object.keys(this.columns[n]);r<s.length;r++){var o=s[r];ne.isUndefined(this.columns[n][o])||(a[o]=t[i][o]),a.visible=t[i].visible,a.width=t[i].width}this.columns[n]=a,"checkbox"===this.columns[n].type||ne.isNullOrUndefined(e)||""===e||(this.columns[n].template=e)}0<this.columns.length&&this.treeGrid.setProperties({columns:this.columns},!0)},f.prototype.treeDataBound=function(e){var r=this;this.isLoad&&this.undoRedoModule&&(0<this.sortSettings.columns.length?this.undoRedoModule.previousSortedColumns=this.sortSettings.columns:""!==this.searchSettings.key&&(this.undoRedoModule.searchString=this.searchSettings.key)),this.element.getElementsByClassName("e-chart-root-container")[0].style.height="100%",this.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].setAttribute("tabindex","0");this.element.getElementsByClassName("e-gridcontent")[0].childNodes[0].childNodes[0].setAttribute("role","treegrid");var t=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight,i=this.element.getElementsByClassName("e-chart-scroll-container e-content")[0];i.style.height="calc(100% - "+t+"px)",i.setAttribute("tabindex","0"),ne.isNullOrUndefined(this.toolbarModule)||ne.isNullOrUndefined(this.toolbarModule.element)?this.splitterElement.style.height="100%":this.splitterElement.style.height="calc(100% - "+this.toolbarModule.element.offsetHeight+"px)",this.filterSettings&&this.filterSettings.properties&&this.filterSettings.properties.columns&&this.filterSettings.properties.columns.forEach(function(e){for(var t=e.properties.field,i=null,a=0;a<r.treeGrid.columns.length;a++){var n=r.treeGrid.columns[a];if(n.field===t){i=n;break}}i&&e.properties.uid!==i.uid&&(e.properties.uid=i.uid)}),this.isLoad?(this.enablePersistence&&this.updateTreeColumns(),this.updateCurrentViewData(),this.enableVirtualization?this.virtualScrollModule&&this.enableVirtualization&&(this.ganttChartModule.virtualRender.adjustTable(),this.ganttChartModule.scrollObject.updateTopPosition()):this.updateContentHeight(),this.isTreeGridRendered||(this.isTreeGridRendered=!0,this.timelineModule.isSingleTier?this.element.classList.add(le):this.element.classList.remove(le),t=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight,i.style.height="calc(100% - "+t+"px)",this.treeGrid.setProperties({height:"100%"},!1),this.notify("tree-grid-created",{}),this.createGanttPopUpElement(),this.hideLoadingIndicator(),ne.setValue("isGanttCreated",!0,e),this.renderComplete())):this.getCurrentRecords(e),this.loadChildOnDemand&&this.taskFields.hasChildMapping&&this.updateContentHeight(),this.enableCriticalPath&&this.criticalPathModule&&this.criticalPathModule.showCriticalPath(this.enableCriticalPath),this.notify("recordsUpdated",{});for(var a=0;a<document.getElementsByClassName("e-timeline-header-table-container").length;a++)for(var n=0;n<document.getElementsByClassName("e-timeline-header-table-container")[a].children[0].children[0].children.length;n++){var s=document.getElementsByClassName("e-timeline-header-table-container")[a].children[0].children[0].children[n].children[0];s&&s.setAttribute("tabindex","-1")}i=this.criticalPathModule;this.enableCriticalPath&&i&&i.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(i.criticalPathCollection,i.detailPredecessorCollection,!0,i.predecessorCollectionTaskIds),this.initialChartRowElements=this.ganttChartModule.getChartRows(),this.isLoad=!1,this.isExpandPerformed=!!this.enableVirtualization&&this.isExpandPerformed,this.isExpandPerformed||(this.previousFlatData=ne.extend([],this.flatData,[],!0)),this.undoRedoModule&&0!==Object.keys(this.undoRedoModule.undoActionDetails).length&&("RowDragAndDrop"===(t=this.undoRedoModule.undoActionDetails).action||"TaskbarDragAndDrop"===t.action?(t.beforeDrop.forEach(function(e){r.updateRecordByID(e.data)}),"child"===t.afterDrop.dropPosition&&this.updateRecordByID(t.afterDrop.dropRecord)):"Indent"!==t.action&&"Outdent"!==t.action||this.updateRecordByID(t.droppedRecord),this.undoRedoModule.undoActionDetails={}),this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed&&(this.undoRedoModule.isUndoRedoPerformed=!1),this.trigger("dataBound",e)},f.prototype.getCurrentRecords=function(e){this.predecessorModule&&this.taskFields.dependency&&this.connectorLineModule.removePreviousConnectorLines(this.currentViewData),this.updateCurrentViewData(),this.enableVirtualization||this.updateContentHeight(),this.virtualScrollModule&&this.enableVirtualization&&(this.ganttChartModule.virtualRender.adjustTable(),this.ganttChartModule.scrollObject.updateTopPosition())},f.prototype.onPropertyChanged=function(e,t){for(var i=!1,a=0,n=Object.keys(e);a<n.length;a++){var r,s=n[a];switch(s){case"allowSelection":case"allowRowDragAndDrop":case"allowFiltering":case"showColumnMenu":case"allowResizing":case"allowReordering":case"allowSorting":case"enableImmutableMode":this.treeGrid[s]=this[s],this.treeGrid.dataBind();break;case"workWeek":this.dataOperation.getNonWorkingDayIndex(),this.dataOperation.reUpdateGanttData(),this.chartRowsModule.initiateTemplates(),this.taskFields.dependency&&this.predecessorModule.updatedRecordsDateByPredecessor(),this.chartRowsModule.refreshGanttRows(),this.treeGrid.refreshColumns(),this.timelineModule.refreshTimeline();break;case"toolbar":this.notify("ui-toolbarupdate",{module:"toolbar",properties:e});break;case"columnMenuItems":this.treeGrid.grid.columnMenuItems=w.getActualProperties(this.columnMenuItems);break;case"eventMarkers":case"highlightWeekends":this.notify("ui-update",{module:"day-markers",properties:e});break;case"sortSettings":this.treeGrid.sortSettings=w.getActualProperties(this.sortSettings),this.treeGrid.dataBind();break;case"timelineSettings":this.timelineModule.refreshTimeline(),this.enableTimelineVirtualization&&(!this.undoRedoModule||this.undoRedoModule&&!this.undoRedoModule.isZoomingUndoRedoProgress)&&(i=!0),this.undoRedoModule&&this.undoRedoModule.isZoomingUndoRedoProgress&&(this.undoRedoModule.isZoomingUndoRedoProgress=!1);break;case"rowHeight":case"taskbarHeight":this.treeGrid.rowHeight=this.rowHeight,this.treeGrid.dataBind(),this.chartRowsModule.initiateTemplates(),this.timelineModule.updateChartByNewTimeline(),this.taskFields.dependency&&this.ganttChartModule.reRenderConnectorLines();break;case"timezone":case"durationUnit":this.dataOperation.checkDataBinding(!0);break;case"enableCriticalPath":this.hideLoadingIndicator(),this.enableCriticalPath&&this.criticalPathModule?(this.criticalPathModule.showCriticalPath(this.enableCriticalPath),(r=this.criticalPathModule).criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(r.criticalPathCollection,r.detailPredecessorCollection,!0,r.predecessorCollectionTaskIds)):this.removeCriticalPathStyles();break;case"filterSettings":ne.isNullOrUndefined(e.filterSettings)&&(this.filterSettings.columns=[]),this.treeGrid.filterSettings=w.getActualProperties(this.filterSettings),this.treeGrid.dataBind();break;case"gridLines":this.treeGrid.gridLines=this.gridLines,this.treeGrid.dataBind(),this.renderChartGridLines();break;case"tooltipSettings":this.tooltipModule.toolTipObj&&this.tooltipModule.toolTipObj.destroy(),this.tooltipModule.createTooltip();break;case"splitterSettings":this.splitterModule.updateSplitterPosition();break;case"selectionSettings":this.treeGrid.selectionSettings=w.getActualProperties(this.selectionSettings),this.treeGrid.grid.selectionSettings.enableToggle=this.selectionSettings.enableToggle,this.treeGrid.dataBind();break;case"searchSettings":void 0!==e.searchSettings.key&&(this.treeGrid.grid.searchSettings=w.getActualProperties(this.searchSettings),this.treeGrid.grid.dataBind()),this.treeGrid.searchSettings=w.getActualProperties(this.searchSettings),this.treeGrid.dataBind(),this.toolbarModule&&this.toolbarModule.updateSearchTextBox();break;case"labelSettings":case"renderBaseline":case"baselineColor":this.isFromRenderBaseline=!0,this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows(),this.isFromRenderBaseline=!1;break;case"resourceIDMapping":case"resourceNameMapping":case"resources":this.dataOperation.reUpdateResources(),this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows();break;case"includeWeekend":case"allowUnscheduledTasks":case"holidays":this.isLoad=!0,"holidays"===s&&(this.totalHolidayDates=this.dataOperation.getHolidayDates(),this.notify("ui-update",{module:"day-markers",properties:e})),this.dataOperation.reUpdateGanttData(),this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows(),this.isLoad=!1,this.taskFields.dependency&&(this.predecessorModule.updatedRecordsDateByPredecessor(),this.treeGrid.refreshColumns(),this.chartRowsModule.refreshGanttRows());break;case"dayWorkingTime":case"weekWorkingTime":i=!0;break;case"addDialogFields":case"editDialogFields":this.editModule&&this.editModule.dialogModule&&this.editModule.dialogModule.processDialogFields();break;case"columns":this.treeGridModule.treeGridColumns=[],this.treeGridModule.validateGanttColumns(),this.treeGrid.columns=this.treeGridModule.treeGridColumns,this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.timelineModule.updateChartByNewTimeline();break;case"width":case"height":this.reUpdateDimention(s);break;case"editSettings":this.treeGrid.editSettings.allowAdding=this.editSettings.allowAdding,this.treeGrid.editSettings.allowDeleting=this.editSettings.allowDeleting,this.treeGrid.editSettings.showDeleteConfirmDialog=this.editSettings.showDeleteConfirmDialog,this.treeGrid.editSettings.allowEditing=this.editSettings.allowEditing,this.treeGrid.editSettings.allowNextRowEdit=this.editSettings.allowNextRowEdit,ne.isNullOrUndefined(this.editModule)||this.editModule.reUpdateEditModules(),ne.isNullOrUndefined(this.toolbarModule)||this.toolbarModule.refreshToolbarItems();break;case"connectorLineBackground":case"connectorLineWidth":this.taskFields.dependency&&(this.connectorLineModule.initPublicProp(),this.ganttChartModule.reRenderConnectorLines());break;case"treeColumnIndex":this.treeGrid.treeColumnIndex=this.treeColumnIndex;break;case"projectStartDate":case"projectEndDate":this.timelineModule.isZoomToFit=!1,this.dataOperation.calculateProjectDates(),this.updateProjectDates(this.cloneProjectStartDate,this.cloneProjectEndDate,this.isTimelineRoundOff);break;case"selectedRowIndex":ne.isNullOrUndefined(this.selectionModule)||this.selectionModule.selectRowByIndex();break;case"dataSource":this.isLoad=!0,this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.closeGanttActions(),this.dataSource instanceof Object&&H(this)?(this.treeGrid.hasChildMapping="isParent",r=ne.getValue("count",this.dataSource),this.treeGrid.dataSource={result:this.flatData,count:r}):this.treeGrid.hasChildMapping=null,this.dataOperation.checkDataBinding(!0),this.isLoad=!1;break;case"enableContextMenu":case"contextMenuItems":this.enableContextMenu||"contextMenuItems"===s?this.notify("reRender-contextMenu",{module:"contextMenu",enable:!0}):this.treeGrid.contextMenuItems=[],this.treeGrid.dataBind();break;case"currencyCode":case"locale":case"enableRtl":case"readOnly":case"viewType":case"taskFields":case"allowTaskbarDragAndDrop":case"allowTaskbarOverlap":case"allowParentDependency":case"enableMultiTaskbar":if("locale"===s&&(this.isLocaleChanged=!0),"taskFields"===s&&!ne.isNullOrUndefined(e.taskFields.child))return;"allowTaskbarDragAndDrop"!==s&&(i=!0);break;case"validateManualTasksOnLinking":this.validateManualTasksOnLinking=e.validateManualTasksOnLinking;break;case"showOverAllocation":this.updateOverAllocationCotainer()}}i&&(this.isLoad&&this.contentMaskTable&&(this.contentMaskTable=null),this.refresh())},f.prototype.updateOverAllocationCotainer=function(){var e;this.showOverAllocation?this.ganttChartModule.renderOverAllocationContainer():(e=this.element.querySelector("."+bt))&&(e.innerHTML="")},f.prototype.getPersistData=function(){for(var e=["sortSettings","filterSettings","columns","searchSettings","selectedRowIndex","treeColumnIndex","currentZoomingLevel","cloneProjectStartDate","cloneProjectEndDate","splitterSettings"],t={filterSettings:["type","mode","showFilterBarStatus","immediateModeDelay","ignoreAccent","hierarchyMode"],searchSettings:["fields","operator","ignoreCase"],sortSettings:[],columns:[],selectedRowIndex:[]},i=0;i<e.length;i++)for(var a=this[e[i]],n=0,r=t[e[i]];!ne.isNullOrUndefined(r)&&n<r.length;n++)delete a[r[n]];return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(e)},f.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)this.ignoreInColumn(e,t[i])},f.prototype.ignoreInColumn=function(e,t){for(var i=0;i<e.length;i++)delete t[e[i]],t.filter={}},f.prototype.destroy=function(){this.notify("destroy",{}),this.unwireEvents(),ne.isNullOrUndefined(this.validationDialogElement)||this.validationDialogElement.isDestroyed||this.validationDialogElement.destroy();for(var e=["ganttChartModule","timelineModule","chartRowsModule","treeGridModule","ganttDataUpdatesModule","dateValidationModule","tooltipModule"],t=0;t<e.length;t++)this[e[t]]&&(this[e[t]]=null);this.keyboardModule&&this.keyboardModule.destroy(),this.editModule&&this.editModule.dialogModule&&this.editModule.dialogModule.destroy(),this.splitterModule&&this.splitterModule.destroy(),this.toolbarModule&&this.toolbarModule.toolbar&&this.toolbarModule.toolbar.destroy(),ne.isNullOrUndefined(this.dayMarkersModule)||(ne.isNullOrUndefined(this.dayMarkersModule.eventMarkerRender)||ne.isNullOrUndefined(this.dayMarkersModule.eventMarkerRender.eventMarkersContainer)||(this.dayMarkersModule.eventMarkerRender.eventMarkersContainer=null),ne.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender))||(ne.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender.nonworkingContainer)||(this.dayMarkersModule.nonworkingDayRender.nonworkingContainer=null),ne.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender.weekendContainer)||(this.dayMarkersModule.nonworkingDayRender.weekendContainer=null),ne.isNullOrUndefined(this.dayMarkersModule.nonworkingDayRender.holidayContainer))||(this.dayMarkersModule.nonworkingDayRender.holidayContainer=null),this.connectorLineModule&&(this.connectorLineModule.dependencyViewContainer=null,this.connectorLineModule.svgObject=null,this.connectorLineModule.renderer=null,this.connectorLineModule.tooltipTable=null),this.treeGridPane=null,this.chartPane=null,this.initialChartRowElements=null,ua.prototype.destroy.call(this),this.chartVerticalLineContainer=null,this.element.innerHTML="",ne.removeClass([this.element],ae),this.element.innerHTML="",this.isTreeGridRendered=!1,this.resetTemplates(),this.dataOperation.uid=null},f.prototype.getTaskbarHeight=function(){return this.chartRowsModule.taskBarHeight},f.prototype.requiredModules=function(){var e=[];return this.isDestroyed||(this.allowSorting&&e.push({member:"sort",args:[this]}),(this.allowFiltering||this.toolbar&&-1!==this.toolbar.indexOf("Search"))&&e.push({member:"filter",args:[this]}),this.allowReordering&&e.push({member:"reorder",args:[this]}),this.allowExcelExport&&e.push({member:"excelExport",args:[this]}),(this.allowRowDragAndDrop||this.allowTaskbarDragAndDrop)&&e.push({member:"rowDragAndDrop",args:[this]}),this.enableCriticalPath&&e.push({member:"criticalPath",args:[this]}),this.enableUndoRedo&&e.push({member:"undoRedo",args:[this]}),this.allowResizing&&e.push({member:"resize",args:[this]}),this.toolbar&&0<this.toolbar.length&&e.push({member:"toolbar",args:[this]}),(this.editSettings.allowAdding||this.editSettings.allowEditing||this.editSettings.allowDeleting||this.editSettings.allowTaskbarEditing||this.allowRowDragAndDrop)&&e.push({member:"edit",args:[this]}),this.allowSelection&&e.push({member:"selection",args:[this]}),this.tooltipSettings.showTooltip&&e.push({member:"tooltip",args:[this]}),(this.highlightWeekends||this.holidays&&0<this.holidays.length||this.eventMarkers&&0<this.eventMarkers.length)&&e.push({member:"dayMarkers",args:[this]}),this.enableContextMenu&&e.push({member:"contextMenu",args:[this]}),this.showColumnMenu&&e.push({member:"columnMenu",args:[this]}),this.allowPdfExport&&e.push({member:"pdfExport",args:[this]}),this.enableVirtualization&&e.push({member:"virtualScroll",args:[this]})),e},f.prototype.sortColumn=function(e,t,i){this.sortModule&&this.allowSorting&&this.sortModule.sortColumn(e,t,i)},f.prototype.mergePersistGanttData=function(){this.treeGrid||(this.treeGrid=new T.TreeGrid);this.treeGrid.grid.mergePersistGridData.apply(this)},f.prototype.mergeColumns=function(e,t){this.treeGrid.grid.mergeColumns.apply(this,[e,t])},f.prototype.setFrozenCount=function(){this.treeGrid.grid.setFrozenCount.apply(this)},f.prototype.splitFrozenCount=function(e){this.treeGrid.grid.splitFrozenCount.apply(this,[e])},f.prototype.isFrozenGrid=function(){return this.treeGrid.grid.isFrozenGrid()},f.prototype.clearSorting=function(){this.sortModule.clearSorting()},f.prototype.renderChartGridLines=function(){var e="e-chart-row-border",t=this.chartVerticalLineContainer,i=document.getElementById(this.element.id+"GanttTaskTableBody").querySelectorAll("td");if("Vertical"===this.gridLines){if(ne.isNullOrUndefined(t)?this.renderChartVerticalLines():"none"===window.getComputedStyle(t).display&&(t.style.display="block"),i&&0<i.length&&i[0].classList.contains(e))for(var a=0;a<i.length;a++)ne.removeClass([i[a]],e)}else if("Horizontal"===this.gridLines){if(ne.isNullOrUndefined(t)||(t.style.display="none"),i&&0<i.length&&!i[0].classList.contains(e))for(a=0;a<i.length;a++)ne.addClass([i[a]],e)}else if("Both"===this.gridLines){if(ne.isNullOrUndefined(t)?this.renderChartVerticalLines():"none"===window.getComputedStyle(t).display&&(t.style.display="block"),i&&0<i.length&&!i[0].classList.contains(e))for(a=0;a<i.length;a++)ne.addClass([i[a]],e)}else if("None"===this.gridLines&&(ne.isNullOrUndefined(t)||"none"===window.getComputedStyle(t).display||(t.style.display="none"),i)&&0<i.length&&i[0].classList.contains(e))for(a=0;a<i.length;a++)ne.removeClass([i[a]],e)},f.prototype.updateGridLineContainerHeight=function(){this.chartVerticalLineContainer&&(this.chartVerticalLineContainer.style.height=ne.formatUnit(this.getContentHeight()))},f.prototype.getContentHeight=function(){var e=this.ganttChartModule.scrollElement.offsetHeight-16,t=this.ganttChartModule.chartBodyContent.offsetHeight;return t<e?t:e},f.prototype.reUpdateDimention=function(e){var t,i,a,n=0;this.calculateDimensions(),ne.isNullOrUndefined(this.toolbarModule)||ne.isNullOrUndefined(this.toolbarModule.element)||(this.toolbarModule.toolbar.refresh(),this.toolbarModule.refreshToolbarItems(),n=this.toolbarModule.element.offsetHeight),this.treeGrid.height=this.ganttHeight-n-this.treeGrid.grid.getHeaderContent().offsetHeight,this.splitterModule.splitterObject.height=(this.ganttHeight-n).toString(),ne.isNullOrUndefined(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer.style.height=this.ganttHeight+"px"),ne.isNullOrUndefined(this.dayMarkersModule)||(t=ne.getValue("nonworkingDayRender.holidayContainer",this.dayMarkersModule),i=ne.getValue("nonworkingDayRender.weekendContainer",this.dayMarkersModule),a=ne.getValue("eventMarkerRender.eventMarkersContainer",this.dayMarkersModule),t&&(t.style.height=this.ganttHeight+"px"),i&&(i.style.height=this.ganttHeight+"px"),a&&(a.style.height=this.ganttHeight+"px")),"width"===e&&(this.splitterModule.splitterObject.width=this.ganttWidth.toString()),this.ganttChartModule.scrollObject.setHeight(this.ganttHeight-this.ganttChartModule.chartTimelineContainer.offsetHeight-n)},f.prototype.renderChartVerticalLines=function(){this.element.contains(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer=ne.createElement("div",{id:this.element.id+"line-container",styles:"position:absolute;height:100%;"}),this.ganttChartModule.chartBodyContent.insertBefore(this.chartVerticalLineContainer,this.ganttChartModule.chartBodyContent.lastChild)),this.chartVerticalLineContainer.innerHTML="";for(var e=this.element.getElementsByClassName("e-timeline-header-table-container")[1],t=(e=ne.isNullOrUndefined(e)?this.element.getElementsByClassName("e-timeline-header-table-container")[0]:e).getElementsByTagName("th"),i=t.length,a=0,n=ne.createElement("div"),r=0;r<i;r++){var a=0===r?-1:a+parseFloat(s),s=t[r].style.width,o=ne.createElement("div",{className:"e-line-container-cell",styles:(this.enableRtl?"right:"+(a+1):"left:"+(-1!==a?a+.3:a))+"px"});n.appendChild(o)}for(;n.firstChild;)this.chartVerticalLineContainer.appendChild(n.firstChild)},f.prototype.getDefaultLocale=function(){return{emptyRecord:"No records to display",id:"ID",name:"Name",startDate:"Start Date",endDate:"End Date",constraintDate:"Constraint Date",constraintType:"Constraint Type",advancedTab:"Advanced",duration:"Duration",progress:"Progress",dependency:"Dependency",notes:"Notes",criticalPath:"Critical Path",undo:"Undo",redo:"Redo",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",baselineDuration:"Baseline Duration",taskMode:"Task Mode",changeScheduleMode:"Change Schedule Mode",subTasksStartDate:"SubTasks Start Date",subTasksEndDate:"SubTasks End Date",scheduleStartDate:"Schedule Start Date",scheduleEndDate:"Schedule End Date",auto:"Auto",manual:"Manual",type:"Type",offset:"Offset",resourceName:"Resources",resourceID:"Resource ID",day:"day",hour:"hour",minute:"minute",days:"days",hours:"hours",minutes:"minutes",generalTab:"General",customTab:"Custom Columns",writeNotes:"Write Notes",addDialogTitle:"New Task",editDialogTitle:"Task Information",add:"Add",edit:"Edit",update:"Update",delete:"Delete",cancel:"Cancel",search:"Search",task:" task",tasks:" tasks",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomToFit:"Zoom to fit",excelExport:"Excel export",csvExport:"CSV export",pdfExport:"PDF export",expandAll:"Expand all",collapseAll:"Collapse all",nextTimeSpan:"Next timespan",prevTimeSpan:"Previous timespan",saveButton:"Save",cancelLink:"Cancel, keep the existing link",removeLink:'Remove the link and move "{0}" to start on "{1}".',removeConstraint:'Remove  {0}  constraint of task "{1}"',preserveLink:'Move the "{0}" to start on "{1}" and keep the link.',removeDependency:'Remove dependency from "{0}" to "{1}"',cancelChange:"Cancel the change and do nothing",validateEditing:"Validate Editing",schedulingConflicts:"Scheduling conflict",constraintTypeAsSoonAsPossible:"As Soon As Possible",constraintTypeAsLateAsPossible:"As Late As Possible",constraintTypeMustStartOn:"Must Start On",constraintTypeMustFinishOn:"Must Finish On",constraintTypeStartNoEarlierThan:"Start No Earlier Than",constraintTypeStartNoLaterThan:"Start No Later Than",constraintTypeFinishNoEarlierThan:"Finish No Earlier Than",constraintTypeFinishNoLaterThan:"Finish No Later Than",taskBeforePredecessorFS:'You moved "{0}" to start before "{1}" finishes and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorFS:'You moved "{0}" away from "{1}" and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskBeforePredecessorSS:'You moved "{0}" to start before "{1}" starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorSS:'You moved "{0}" to start after "{1}" starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskBeforePredecessorFF:'You moved "{0}" to finish before "{1}" finishes and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorFF:'You moved "{0}" to finish after "{1}" finishes and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskBeforePredecessorSF:'You moved "{0}" away from "{1}" to starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',taskAfterPredecessorSF:'You moved "{0}" to finish after "{1}" starts and the two tasks are linked.As the result, the links cannot be honored. Select one action below to perform',okText:"Ok",confirmDelete:"Are you sure you want to Delete Record?",from:"From",to:"To",taskLink:"Task Link",lag:"Lag",start:"Start",finish:"Finish",enterValue:"Enter the value",taskInformation:"Task Information",deleteTask:"Delete Task",deleteDependency:"Delete Dependency",convert:"Convert",save:"Save",above:"Above",below:"Below",child:"Child",milestone:"Milestone",toTask:"To Task",toMilestone:"To Milestone",eventMarkers:"Event markers",leftTaskLabel:"Left task label",rightTaskLabel:"Right task label",timelineCell:"Timeline cell",confirmPredecessorDelete:"Are you sure you want to remove dependency link?",unit:"Unit",work:"Work",taskType:"Task Type",unassignedTask:"Unassigned Task",group:"Group",indent:"Indent",outdent:"Outdent",segments:"Segments",splitTask:"Split Task",mergeTask:"Merge Task",left:"Left",right:"Right",FF:"FF",FS:"FS",SF:"SF",SS:"SS"}},f.prototype.removeSortColumn=function(e){this.sortModule.removeSortColumn(e)},f.prototype.actionBeginTask=function(e){this.trigger("actionBegin",e),ne.getValue("cancel",e)||this.showLoadingIndicator()},f.prototype.scrollToDate=function(e){e=this.dateValidationModule.getDateFromFormat(e),e=this.dataOperation.getTaskLeft(e,!1);this.ganttChartModule.updateScrollLeft(e)},f.prototype.scrollToTask=function(e){-1!==this.ids.indexOf(e)&&(e=this.flatData[this.ids.indexOf(e)].ganttProperties.left,this.ganttChartModule.updateScrollLeft(e))},f.prototype.updateChartScrollOffset=function(e,t){ne.isNullOrUndefined(e)||(e=this.ganttChartModule.scrollElement.scrollWidth<=e?this.ganttChartModule.scrollElement.scrollWidth:e,this.ganttChartModule.scrollObject.setScrollLeft(e,this.enableRtl?-1:0)),ne.isNullOrUndefined(t)||(t=this.ganttChartModule.scrollElement.scrollHeight<=t?this.ganttChartModule.scrollElement.scrollHeight:t,this.ganttChartModule.scrollObject.setScrollTop(t))},f.prototype.getParentTask=function(t){if(!ne.isNullOrUndefined(t))if(!this.autoCalculateDateScheduling&&this.dataMap&&0<this.dataMap.size&&!this.taskFields.hasChildMapping&&this.isLoad){var e=this.dataMap.get(t.uniqueID);if(e)return e}else{e=this.flatData.find(function(e){return t.uniqueID===e.uniqueID});if(e)return e}return null},f.prototype.getRootParent=function(e,t){return e.level===t?e:this.getRootParent(this.getParentTask(e.parentItem),t)},f.prototype.filterByColumn=function(e,t,i,a,n,r){this.treeGrid.filterByColumn(e,t,i,a,n,r)},f.prototype.excelExport=function(e,t,i,a){return this.excelExportModule?this.treeGrid.excelExport(e,t,i,a):null},f.prototype.csvExport=function(e,t,i,a){return this.excelExportModule?this.treeGrid.csvExport(e,t,i,a):null},f.prototype.pdfExport=function(e,t,i,a){return this.pdfExportModule?this.pdfExportModule.export(e,t,i,a):null},f.prototype.clearFiltering=function(e){this.treeGrid.grid.clearFiltering(e)},f.prototype.removeFilteredColsByField=function(e){this.treeGrid.removeFilteredColsByField(e,!1)},f.prototype.renderWorkingDayCell=function(e){var t=!1,i=!1,t="Auto"!==this.taskMode&&"Custom"!==this.taskMode||!(!this.includeWeekend&&this.autoCalculateDateScheduling),a=("Custom"===this.taskMode&&this.taskFields.manual&&((a=this.editModule)&&a.cellEditModule&&a.cellEditModule.isCellEdit?i=a.cellEditModule.currentEditedRowData[this.taskFields.manual]:a&&a.dialogModule&&a.dialogModule.isEdit&&(i=a.dialogModule.editedRecord[this.taskFields.manual]),t=i||this.includeWeekend||!this.autoCalculateDateScheduling),t?[]:this.nonWorkingDayIndex),i=this.totalHolidayDates;0<a.length&&-1!==a.indexOf(e.date.getDay())?e.isDisabled=!0:0<i.length&&((t=new Date(e.date.getTime())).setHours(0,0,0),-1!==i.indexOf(t.getTime()))&&(!this.autoCalculateDateScheduling||this.isLoad&&!this.treeGrid.loadChildOnDemand&&this.taskFields.hasChildMapping?e.isDisabled=!1:e.isDisabled=!0)},f.prototype.previousTimeSpan=function(e){var t;this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.undoRedoModule&&this.isUndoRedoItemPresent("PreviousTimeSpan")&&(this.undoRedoModule.redoEnabled&&this.undoRedoModule.disableRedo(),this.undoRedoModule.createUndoCollection(),(t={action:"PreviousTimeSpan"}).previousTimelineStartDate=ne.extend([],[],[this.timelineModule.timelineStartDate],!0)[0],t.previousTimelineEndDate=ne.extend([],[],[this.timelineModule.timelineEndDate],!0)[0],this.undoRedoModule.getUndoCollection[this.undoRedoModule.getUndoCollection.length-1]=t),this.timelineModule.performTimeSpanAction("prevTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},f.prototype.nextTimeSpan=function(e){var t;this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate"]),this.undoRedoModule&&this.isUndoRedoItemPresent("NextTimeSpan")&&(this.undoRedoModule.redoEnabled&&this.undoRedoModule.disableRedo(),this.undoRedoModule.createUndoCollection(),(t={action:"NextTimeSpan"}).previousTimelineStartDate=ne.extend([],[],[this.timelineModule.timelineStartDate],!0)[0],t.previousTimelineEndDate=ne.extend([],[],[this.timelineModule.timelineEndDate],!0)[0],this.undoRedoModule.getUndoCollection[this.undoRedoModule.getUndoCollection.length-1]=t),this.timelineModule.performTimeSpanAction("nextTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},f.prototype.updateProjectDates=function(e,t,i,a){this.timelineModule.totalTimelineWidth=0,this.cloneProjectStartDate=e,this.cloneProjectEndDate=t,this.isTimelineRoundOff=i,this.timelineModule.refreshTimelineByTimeSpan(),this.dataOperation.reUpdateGanttDataPosition(),(!this.pdfExportModule||this.pdfExportModule&&!this.pdfExportModule.isPdfExport||this.pdfExportModule&&this.pdfExportModule.isPdfExport&&this.pdfExportModule.helper.exportProps&&this.pdfExportModule.helper.exportProps.fitToWidthSettings&&!this.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth)&&(this.timelineModule.updateChartByNewTimeline(),e=window.outerWidth/window.innerWidth,this.timelineModule.isZoomToFit&&!this.enableTimelineVirtualization&&e<1?(t=void 0,t=this.enableVirtualization?Math.abs(this.timelineModule.totalTimelineWidth-this.element.getElementsByClassName("e-chart-scroll-container e-content")[0].clientWidth)+1:Math.abs(this.timelineModule.totalTimelineWidth-this.ganttChartModule.chartBodyContent.parentElement.clientWidth),this.ganttChartModule.chartBodyContent.style.width=ne.formatUnit(this.timelineModule.totalTimelineWidth-t)):this.ganttChartModule.chartBodyContent.style.width=ne.formatUnit(this.timelineModule.totalTimelineWidth),this.ganttChartModule.updateLastRowBottomWidth(),this.taskFields.dependency&&this.ganttChartModule.reRenderConnectorLines(),"beforeAdd"!==a)&&this.notify("selectRowByIndex",{})},f.prototype.splitTask=function(e,t){this.isEdit=!0,this.chartRowsModule.splitTask(e,t)},f.prototype.mergeTask=function(e,t){this.chartRowsModule.mergeTask(e,t)},f.prototype.reorderColumns=function(e,t){this.treeGrid.reorderColumns(e,t)},f.prototype.initiateEditAction=function(e){this.isOnEdit=e,this.previousRecords={},this.editedRecords=[]},f.prototype.setRecordValue=function(e,t,i,a){var n,r;t=ne.isUndefined(t)?null:t,!(!this.isOnEdit&&!this.isOnDelete)&&(this.makeCloneData(e,i,a),r=(a=a?i:i.ganttProperties).rowUniqueID,n=this.getRecordByID(r),r=!1,r=!(!ne.isNullOrUndefined(t)&&(ne.isNullOrUndefined(t)||ne.isNullOrUndefined(i[""+e])||(t instanceof Date?t.getTime()===i[""+e].getTime():i[""+e]===t))),n)&&(-1===this.editedRecords.indexOf(n)&&r||0===this.editedRecords.length)&&(this.editModule.draggedRecord&&this.editModule.draggedRecord.ganttProperties.taskId===a.taskId?this.editedRecords.splice(0,0,n):this.editedRecords.push(n),this.undoRedoModule&&(-1===this.undoRedoModule.changedRecords.indexOf(n)&&this.undoRedoModule.changedRecords.push(ne.extend({},{},n,!0)),a=0<(r=this.undoRedoModule.getUndoCollection).length?r[r.length-1].action:null,!this.editModule||!this.editSettings.allowEditing||this.undoRedoModule.isUndoRedoPerformed||this.isOnDelete||this.isOnAdded||"outdent"===a||"indent"===a||"RowDragAndDrop"===a||"TaskbarDragAndDrop"===a||(a=this.previousFlatData.filter(function(e){return e.ganttProperties.taskId===n.ganttProperties.taskId})[0])&&r[r.length-1]&&r[r.length-1].modifiedRecords&&-1===r[r.length-1].modifiedRecords.indexOf(a)&&r[r.length-1].modifiedRecords.push(a)),this.enableImmutableMode)&&this.modifiedRecords.push(n),ne.setValue(e,t,i)},f.prototype.makeCloneData=function(e,t,i){var a=ne.getValue(e,t);i&&(e="ganttProperties."+e),ne.isNullOrUndefined(this.previousRecords[t.uniqueID])&&(this.previousRecords[t.uniqueID]={}),i=this.previousRecords[t.uniqueID],t=ne.getValue(e,i),ne.isUndefined(t)&&(t=a instanceof Date?new Date(a.getTime()):ne.isObjectArray(a)?ne.extend([],a,[],!0):ne.isObject(a)?ne.extend({},{},a,!0):a,ne.isUndefined(t)?ne.setValue(e,null,i):ne.setValue(e,t,i))},f.prototype.closeGanttActions=function(){this.editModule&&(this.editModule.cellEditModule&&this.editModule.cellEditModule.isCellEdit?(this.treeGrid.closeEdit(),this.editModule.cellEditModule.isCellEdit=!1,ne.isNullOrUndefined(this.toolbarModule)||this.toolbarModule.refreshToolbarItems()):this.editModule.dialogModule&&this.editModule.dialogModule.dialogObj&&this.editModule.dialogModule.dialogObj.visible&&(this.editModule.dialogModule.dialogObj.hide(),this.editModule.dialogModule.dialogClose()))},f.prototype.getTaskByUniqueID=function(t){var e=this.flatData.filter(function(e){return e.uniqueID===t});return 0<e.length?e[0]:null},f.prototype.getRecordByID=function(e){return ne.isNullOrUndefined(e)?null:this.flatData[this.ids.indexOf(e.toString())]},f.prototype.setSplitterPosition=function(e,t){var i={},e=(i[t]=e,this.splitterModule.calculateSplitterPosition(i));switch(t){case"view":this.splitterSettings.view=i[t];break;case"columnIndex":this.splitterModule.isSplitterResized=!0,this.splitterSettings.columnIndex=i[t];break;case"position":this.splitterModule.isSplitterResized=!0,this.splitterSettings.position=i[t]}var a=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[0],n=this.splitterModule.splitterObject.element.querySelectorAll(".e-pane")[1];this.splitterModule.splitterPreviousPositionGrid=a.scrollWidth+1+"px",this.splitterModule.splitterPreviousPositionChart=n.scrollWidth+1+"px",this.splitterModule.splitterObject.paneSettings[0].size=e,this.splitterModule.splitterObject.paneSettings[1].size=parseFloat("99.75%")-parseFloat(e)+"%",this.splitterModule.triggerCustomResizedEvent()},f.prototype.expandByIndex=function(e){if("number"==typeof e){var t=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)}else for(var i,a=0;a<e.length;a++)"number"==typeof e[a]&&(i=e[a],t=this.contructExpandCollapseArgs(null,i),this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t))},f.prototype.expandByID=function(e){this.enableVirtualization&&(this.isExpandPerformed=!0);e=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(e)},f.prototype.collapseByIndex=function(e){e=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(e)},f.prototype.collapseByID=function(e){e=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(e)},f.prototype.addRecord=function(e,t,i){if(this.editModule&&this.editSettings.allowAdding){if("ResourceView"===this.viewType){this.editModule.addRowPosition=t,this.editModule.addRowIndex=i;var a=void 0,n=(ne.isNullOrUndefined(e)||(a=this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed?e.ganttProperties.resourceInfo:e[this.taskFields.resourceInfo]),void 0),r=void 0;if(!ne.isNullOrUndefined(a)&&a.length){for(var s,o,l=0;l<a.length&&(n="object"==typeof a[l]?a[l][this.resourceFields.id]:a[0],!(r=this.flatData[this.getTaskIds().indexOf("R"+n)]));l++);r&&(0===r.level||r.childRecords.length)?(s=r.childRecords[i],"ResourceView"===this.viewType&&this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed?this.editModule.addRecord(e,t,i):s?"Child"===(o="Above"===t||"Below"===t?t:"Child")?this.editModule.addRecord(e,o,this.getTaskIds().indexOf("R"+n)):this.editModule.addRecord(e,o,this.flatData.indexOf(s)):this.editModule.addRecord(e,"Child",this.getTaskIds().indexOf("R"+n))):this.editModule.addRecord(e,"Bottom")}else this.undoRedoModule&&this.undoRedoModule.isUndoRedoPerformed?this.editModule.addRecord(e,t,i):this.editModule.addRecord(e,"Bottom");this.editModule.addRowPosition=null,this.editModule.addRowIndex=null}else this.editModule.addRecord(e,t,i),"Bottom"===t&&(this.selectedRowIndex=i);"Above"!==t&&"Below"!==t&&"Child"!==t||(this.currentSelection=ne.isNullOrUndefined(e)?this.currentSelection:e)}},f.prototype.updateRecordByID=function(e){this.editModule&&this.editSettings.allowEditing&&(this.updateDuration=!0,this.editModule.updateRecordByID(e),this.updateDuration=!1)},f.prototype.getCurrentViewData=function(){return this.treeGrid.getCurrentViewRecords().map(function(e){return e.taskData})},f.prototype.autoFitColumns=function(e){this.treeGrid.autoFitColumns(e)},f.prototype.getTaskInfo=function(e){var t=this.getRecordByID(e),i={};if(t&&t.ganttProperties){var a,n=t.ganttProperties,e=this.taskFields,r={baseline:this.renderBaseline,isCritical:this.enableCriticalPath,progressWidth:e.progress,segments:e.segments,isAutoSchedule:n.isAutoSchedule,wbs:this.enableWBS};for(a in r)if(Object.prototype.hasOwnProperty.call(r,a))switch(a){case"baseline":n.baselineStartDate&&n.baselineEndDate&&(ne.isNullOrUndefined(n.baselineLeft)||(i.baselineLeft=n.baselineLeft),ne.isNullOrUndefined(n.baselineWidth)||(i.baselineWidth=n.baselineWidth));break;case"isCritical":n.isCritical&&(i.isCritical=n.isCritical,i.slack=n.slack);break;case"progressWidth":n.progressWidth&&(i.progressWidth=n.progressWidth);break;case"segments":n.segments&&(i.segments=n.segments);break;case"wbs":n.wbsCode&&(i.wbsCode=n.wbsCode),n.wbsPredecessor&&(i.wbsPredecessor=n.wbsPredecessor);break;case"isAutoSchedule":i.isAutoSchedule=n.isAutoSchedule,n.isAutoSchedule?(i.autoTaskLeft=n.left,i.autoTaskWidth=n.width):(!n.isAutoSchedule&&t.hasChildRecords&&(i.manualTaskAutoLeft=n.autoLeft,i.manualTaskAutoWidth=n.autoWidth),i.manualTaskLeft=n.left,i.manualTaskWidth=n.width)}}return i},f.prototype.updateTaskId=function(e,t){this.editModule&&this.editSettings.allowEditing&&this.editModule.updateTaskId(e,t)},f.prototype.expandAtLevel=function(e){this.enableVirtualization&&(this.isExpandCollapseLevelMethod=!0),this.ganttChartModule.expandAtLevel(e)},f.prototype.indent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.indent()},f.prototype.outdent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.outdent()},f.prototype.getUndoActions=function(){return this.undoRedoModule?this.undoRedoModule.getUndoCollection:[]},f.prototype.getRedoActions=function(){return this.undoRedoModule?this.undoRedoModule.getRedoCollection:[]},f.prototype.clearUndoCollection=function(){this.undoRedoModule&&(this.undoRedoModule.getUndoCollection=[],this.toolbarModule)&&this.toolbarModule.enableItems([this.controlId+"_undo"],!1)},f.prototype.clearRedoCollection=function(){this.undoRedoModule&&(this.undoRedoModule.getRedoCollection=[],this.toolbarModule)&&this.toolbarModule.enableItems([this.controlId+"_redo"],!1)},f.prototype.undo=function(){this.undoRedoModule&&this.undoRedoModule.undoAction()},f.prototype.redo=function(){this.undoRedoModule&&this.undoRedoModule.redoAction()},f.prototype.showCriticalPath=function(e){this.criticalPathModule&&(this.criticalPathModule.showCriticalPath(e),e=this.criticalPathModule,this.criticalPathModule.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds))},f.prototype.getCriticalTasks=function(){return!ne.isNullOrUndefined(this.criticalPathModule)&&this.enableCriticalPath?this.criticalPathModule.getCriticalTasks():null},f.prototype.zoomIn=function(){this.timelineModule.processZooming(!0)},f.prototype.zoomOut=function(){this.timelineModule.processZooming(!1)},f.prototype.fitToProject=function(){this.timelineModule.processZoomToFit(),this.ganttChartModule.updateScrollLeft(0)},f.prototype.reorderRows=function(e,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},f.prototype.updateRecordByIndex=function(e,t){var i;this.editModule&&this.editSettings.allowEditing&&(i=this.taskFields,e=!(0<this.updatedRecords.length)||ne.isNullOrUndefined(this.updatedRecords[e])?null:this.updatedRecords[e],ne.isNullOrUndefined(e)||(t[i.id]=e[i.id],this.editModule.updateRecordByID(t)))},f.prototype.addPredecessor=function(e,t){this.connectorLineModule&&(e=this.connectorLineModule.getRecordByID(e.toString()),this.editModule)&&!ne.isNullOrUndefined(e)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.addPredecessor(e,t)},f.prototype.removePredecessor=function(e){this.connectorLineModule&&(e=this.connectorLineModule.getRecordByID(e.toString()),this.editModule)&&!ne.isNullOrUndefined(e)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.removePredecessor(e)},f.prototype.updatePredecessor=function(e,t){this.connectorLineModule&&(e=this.connectorLineModule.getRecordByID(e.toString()),this.editModule)&&!ne.isNullOrUndefined(e)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.updatePredecessor(e,t)},f.prototype.openAddDialog=function(){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowAdding&&this.editModule.dialogModule.openAddDialog()},f.prototype.openEditDialog=function(e){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowEditing&&this.editModule.dialogModule.openEditDialog(e)},f.prototype.contructExpandCollapseArgs=function(e,t){ne.isNullOrUndefined(t)&&e?(n=this.getRecordByID(e.toString()),i=this.getRowByID(e),ne.isNullOrUndefined(i)||(a=ne.getValue("rowIndex",i))):ne.isNullOrUndefined(t)||(i=this.getRowByIndex(t),a=(e=this.focusModule.isFromKeyboardAction)?ne.getValue("rowIndex",i):t,n=(e?this.currentViewData:this.flatData)[a]);var i,a,n,t=this.treeGrid.getRows()[a];return{data:n,gridRow:t,chartRow:i,cancel:!1}},f.prototype.getRowByIndex=function(e){try{var t=this.element.querySelectorAll(".e-chart-row");return ne.isNullOrUndefined(e)?null:t[e]}catch(e){return null}},f.prototype.getRowByID=function(e){var t=this,e=this.getRecordByID(e.toString()),e=this.loadChildOnDemand&&this.taskFields.hasChildMapping?this.updatedRecords.map(function(e){return e[t.taskFields.id]}).indexOf(e.ganttProperties.taskId):(this.enableVirtualization?this.currentViewData:this.updatedRecords).indexOf(e);return-1!==e?this.getRowByIndex(e):null},f.prototype.getUnscheduledTaskClass=function(e){return ne.isNullOrUndefined(e.startDate)&&ne.isNullOrUndefined(e.endDate)&&ne.isNullOrUndefined(e.duration)||ne.isNullOrUndefined(e.startDate)||ne.isNullOrUndefined(e.endDate)||ne.isNullOrUndefined(e.duration)?" "+Xe:""},f.prototype.isUnscheduledTask=function(e){return!!(ne.isNullOrUndefined(e.startDate)||ne.isNullOrUndefined(e.endDate)||ne.isNullOrUndefined(e.duration))},f.prototype.createGanttPopUpElement=function(){var e=this.createElement("div",{className:"e-ganttpopup",styles:"display:none;"}),t=this.createElement("div",{className:"e-content",attrs:{tabIndex:"-1"}});ne.append([t,this.createElement("div",{className:"e-uptail e-tail"})],e),t.appendChild(this.createElement("span")),ne.append([t,this.createElement("div",{className:"e-downtail e-tail"})],e),document.getElementById(this.element.id+"GanttChart").appendChild(e)},f.prototype.getPredecessorTextValue=function(e){var t;switch(e){case"SS":t=this.localeObj.getConstant("start")+"-"+this.localeObj.getConstant("start");break;case"FF":t=this.localeObj.getConstant("finish")+"-"+this.localeObj.getConstant("finish");break;case"SF":t=this.localeObj.getConstant("start")+"-"+this.localeObj.getConstant("finish");break;case"FS":t=this.localeObj.getConstant("finish")+"-"+this.localeObj.getConstant("start")}return t},f.prototype.search=function(e){this.filterModule&&(this.searchSettings.key=e,this.dataBind())},f.prototype.getOffsetRect=function(e){var e=e.getBoundingClientRect(),t=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,i=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,a=document.documentElement.clientTop||document.body.clientTop||0,n=document.documentElement.clientLeft||document.body.clientLeft||0,t=e.top+t-a,a=this.enableRtl?e.right+i-n:e.left+i-n;return{top:Math.round(t),left:Math.round(a),width:e.width,height:e.height}},f.prototype.expandAll=function(){this.ganttChartModule.expandCollapseAll("expand")},f.prototype.updateDataSource=function(e,t){if(this.isDynamicData=!0,!ne.isNullOrUndefined(t))for(var i=0,a=Object.keys(t);i<a.length;i++){var n=a[i];switch(n){case"projectStartDate":this.setProperties({projectStartDate:t[n]},!0);break;case"projectEndDate":this.setProperties({projectEndDate:t[n]},!0)}}this.ganttChartModule.scrollObject.element.scrollLeft=0,this.dataSource=e},f.prototype.collapseAll=function(){this.ganttChartModule.expandCollapseAll("collapse")},f.prototype.getGridColumns=function(){return this.treeGrid.getColumns()},f.prototype.getColumnByField=function(t,e){e=e.filter(function(e){return e.field===t});return 0<e.length?e[0]:null},f.prototype.getGanttColumns=function(){return this.ganttColumns},f.prototype.showColumn=function(e,t){this.treeGrid.showColumns(e,t),this.updateTreeColumns()},f.prototype.hideColumn=function(e,t){this.treeGrid.hideColumns(e,t),this.updateTreeColumns()},f.prototype.setScrollTop=function(e){this.ganttChartModule.scrollObject.setScrollTop(e)},f.prototype.cancelEdit=function(){this.isCancelled=!0,this.closeGanttActions()},f.prototype.selectCell=function(e,t){this.selectionModule&&this.selectionModule.selectCell(e,t)},f.prototype.selectCells=function(e){this.selectionModule&&this.selectionModule.selectCells(e)},f.prototype.selectRow=function(e,t){this.selectionModule&&this.selectionModule.selectRow(e,t)},f.prototype.selectRows=function(e){this.selectionModule&&this.selectionModule.selectRows(e)},f.prototype.deleteRecord=function(e){this.editModule&&this.editModule.deleteRecord(e)},f.prototype.enableItems=function(e,t){this.toolbarModule&&this.toolbarModule.enableItems(e,t)},f.prototype.clearSelection=function(){this.selectionModule&&this.selectionModule.clearSelection()},f.prototype.updateDataArgs=function(e){var t;return Array.isArray(e.data)||((t=[]).push(e.data),ne.setValue("data",t,e)),e},f.prototype.convertToMilestone=function(e){var t,i,e=this.getRecordByID(e);ne.isNullOrUndefined(e)||((t=ne.extend({},{},e.taskData,!0))[(i=this.taskFields).startDate]&&this.setRecordValue(i.startDate,e.ganttProperties.startDate,t,!0),ne.isNullOrUndefined(i.duration)?(t[i.startDate]=new Date(e.ganttProperties.startDate),t[i.endDate]=new Date(e.ganttProperties.endDate)):t[i.duration]=0,ne.isNullOrUndefined(i.milestone)||!1===t[i.milestone]&&(t[i.milestone]=!0),ne.isNullOrUndefined(i.progress)||(t[i.progress]=0),!ne.isNullOrUndefined(i.child)&&t[i.child]&&(t[i.child]=[]),!ne.isNullOrUndefined(i.parentID)&&t[i.parentID]&&(t[i.parentID]=null),ne.isNullOrUndefined(i.segments)||(t[i.segments]=null),"FixedWork"===(ne.isNullOrUndefined(e.ganttProperties.taskType)?this:e.ganttProperties).taskType&&(ne.isNullOrUndefined(t[i.work])?e.ganttProperties.work=0:t[i.work]=0),!ne.isNullOrUndefined(this.contextMenuModule)&&this.contextMenuModule.isOpen&&"Milestone"===this.contextMenuModule.item?(ne.isNullOrUndefined(i.dependency)||(t[i.dependency]=null),i=this.editSettings.newRowPosition,this.addRecord(t,i,this.selectedRowIndex)):e.hasChildRecords||e.ganttProperties.isMilestone||(this.isConvertedMilestone=!0,this.updateRecordByID(t),this.isConvertedMilestone=!1))},f.prototype.changeTaskMode=function(e){this.undoRedoModule&&!this.undoRedoModule.isUndoRedoPerformed&&(this.undoRedoModule.redoEnabled&&this.undoRedoModule.disableRedo(),this.undoRedoModule.createUndoCollection(),(t={action:"TaskMode"}).modifiedRecords=ne.extend([],[e],[],!0),this.undoRedoModule.getUndoCollection[this.undoRedoModule.getUndoCollection.length-1]=t);var t=this.taskFields,e=this.getRecordByID(e[t.id]),i=e.ganttProperties,t=(this.isOnEdit=!0,this.setRecordValue("isAutoSchedule",!i.isAutoSchedule,i,!0),ne.isNullOrUndefined(this.taskFields.manual)||(this.setRecordValue("taskData."+t.manual,!i.isAutoSchedule,e),this.setRecordValue(t.manual,!i.isAutoSchedule,e)),this.editModule.updateTaskScheduleModes(e),{data:e});this.editModule.initiateUpdateAction(t)},f.prototype.getTaskIds=function(){return this.taskIds},f.prototype.setTaskIds=function(e){var t;"ProjectView"!==this.viewType&&(t=e.ganttProperties.taskId,t=0===e.level?"R"+t:"T"+t,this.taskIds.push(t))},f.prototype.renderTemplates=function(){this.isReact&&this.renderReactTemplates()},f.prototype.resetTemplates=function(){this.isReact&&this.clearTemplate(["TaskbarTemplate","ParentTaskbarTemplate","MilestoneTemplate","TaskLabelTemplate","RightLabelTemplate","LeftLabelTemplate","TooltipTaskbarTemplate","TooltipBaselineTemplate","TooltipConnectorLineTemplate","TimelineTemplate"])},g([ne.Property(!0)],f.prototype,"allowKeyboard",void 0),g([ne.Property(!1)],f.prototype,"enableImmutableMode",void 0),g([ne.Property(!0)],f.prototype,"allowParentDependency",void 0),g([ne.Property(!0)],f.prototype,"enableHtmlSanitizer",void 0),g([ne.Property(!0)],f.prototype,"disableHtmlEncode",void 0),g([ne.Complex({},Gi)],f.prototype,"loadingIndicator",void 0),g([ne.Property(!0)],f.prototype,"enableVirtualMaskRow",void 0),g([ne.Property(!0)],f.prototype,"loadChildOnDemand",void 0),g([ne.Property(!0)],f.prototype,"updateOffsetOnTaskbarEdit",void 0),g([ne.Property(!0)],f.prototype,"UpdateOffsetOnTaskbarEdit",void 0),g([ne.Property(!0)],f.prototype,"autoCalculateDateScheduling",void 0),g([ne.Property(!0)],f.prototype,"autoFocusTasks",void 0),g([ne.Property(!1)],f.prototype,"enableAdaptiveUI",void 0),g([ne.Property(!1)],f.prototype,"enableWBS",void 0),g([ne.Property(!1)],f.prototype,"enableAutoWbsUpdate",void 0),g([ne.Property(!0)],f.prototype,"allowSelection",void 0),g([ne.Property(!1)],f.prototype,"allowSorting",void 0),g([ne.Property(!0)],f.prototype,"enablePredecessorValidation",void 0),g([ne.Property(!1)],f.prototype,"showColumnMenu",void 0),g([ne.Property()],f.prototype,"columnMenuItems",void 0),g([ne.Property(["Sorting","Add","ColumnReorder","ColumnResize","ColumnState","Delete","Edit","Filtering","Indent","Outdent","NextTimeSpan","PreviousTimeSpan","RowDragAndDrop","TaskbarDragAndDrop","Search","ZoomIn","ZoomOut","ZoomToFit"])],f.prototype,"undoRedoActions",void 0),g([ne.Property()],f.prototype,"timezone",void 0),g([ne.Property(!1)],f.prototype,"collapseAllParentTasks",void 0),g([ne.Property(!1)],f.prototype,"highlightWeekends",void 0),g([ne.Property(0)],f.prototype,"treeColumnIndex",void 0),g([ne.Property([])],f.prototype,"dataSource",void 0),g([ne.Property("day")],f.prototype,"durationUnit",void 0),g([ne.Property(null)],f.prototype,"query",void 0),g([ne.Property(null)],f.prototype,"dateFormat",void 0),g([ne.Property("auto")],f.prototype,"height",void 0),g([ne.Property(!1)],f.prototype,"renderBaseline",void 0),g([ne.Property(!1)],f.prototype,"allowTaskbarDragAndDrop",void 0),g([ne.Property(!0)],f.prototype,"allowTaskbarOverlap",void 0),g([ne.Property("Horizontal")],f.prototype,"gridLines",void 0),g([ne.Complex({},li)],f.prototype,"labelSettings",void 0),g([ne.Property(null)],f.prototype,"taskbarTemplate",void 0),g([ne.Property(null)],f.prototype,"parentTaskbarTemplate",void 0),g([ne.Property(null)],f.prototype,"timelineTemplate",void 0),g([ne.Property(null)],f.prototype,"milestoneTemplate",void 0),g([ne.Property()],f.prototype,"baselineColor",void 0),g([ne.Property("auto")],f.prototype,"width",void 0),g([ne.Property(!1)],f.prototype,"enableVirtualization",void 0),g([ne.Property(!1)],f.prototype,"enableTimelineVirtualization",void 0),g([ne.Property()],f.prototype,"toolbar",void 0),g([ne.Property(["Monday","Tuesday","Wednesday","Thursday","Friday"])],f.prototype,"workWeek",void 0),g([ne.Property(!1)],f.prototype,"includeWeekend",void 0),g([ne.Property(!1)],f.prototype,"allowUnscheduledTasks",void 0),g([ne.Property(!1)],f.prototype,"showInlineNotes",void 0),g([ne.Property(36)],f.prototype,"rowHeight",void 0),g([ne.Property(null)],f.prototype,"taskbarHeight",void 0),g([ne.Property(null)],f.prototype,"projectStartDate",void 0),g([ne.Property(null)],f.prototype,"projectEndDate",void 0),g([ne.Property(null)],f.prototype,"resourceIDMapping",void 0),g([ne.Property(null)],f.prototype,"resourceNameMapping",void 0),g([ne.Property([])],f.prototype,"resources",void 0),g([ne.Property([])],f.prototype,"segmentData",void 0),g([ne.Property(null)],f.prototype,"connectorLineBackground",void 0),g([ne.Property(1)],f.prototype,"connectorLineWidth",void 0),g([ne.Property([])],f.prototype,"columns",void 0),g([ne.Property([])],f.prototype,"addDialogFields",void 0),g([ne.Property([])],f.prototype,"editDialogFields",void 0),g([ne.Property(-1)],f.prototype,"selectedRowIndex",void 0),g([ne.Property("hour")],f.prototype,"workUnit",void 0),g([ne.Property("FixedUnit")],f.prototype,"taskType",void 0),g([ne.Property("ProjectView")],f.prototype,"viewType",void 0),g([ne.Collection([{from:8,to:12},{from:13,to:17}],r)],f.prototype,"dayWorkingTime",void 0),g([ne.Collection([],Xi)],f.prototype,"weekWorkingTime",void 0),g([ne.Collection([],ni)],f.prototype,"holidays",void 0),g([ne.Collection([],_t)],f.prototype,"eventMarkers",void 0),g([ne.Complex({},bi)],f.prototype,"taskFields",void 0),g([ne.Complex({},Vi)],f.prototype,"resourceFields",void 0),g([ne.Complex({},s)],f.prototype,"timelineSettings",void 0),g([ne.Property([])],f.prototype,"zoomingLevels",void 0),g([ne.Complex({},Fi)],f.prototype,"sortSettings",void 0),g([ne.Complex({},Ht)],f.prototype,"editSettings",void 0),g([ne.Complex({},Ci)],f.prototype,"tooltipSettings",void 0),g([ne.Complex({},ui)],f.prototype,"selectionSettings",void 0),g([ne.Property(!1)],f.prototype,"allowFiltering",void 0),g([ne.Property(!1)],f.prototype,"allowExcelExport",void 0),g([ne.Property(!1)],f.prototype,"allowRowDragAndDrop",void 0),g([ne.Property(!1)],f.prototype,"allowReordering",void 0),g([ne.Property(!1)],f.prototype,"readOnly",void 0),g([ne.Property(!1)],f.prototype,"allowResizing",void 0),g([ne.Property(!1)],f.prototype,"enableContextMenu",void 0),g([ne.Property(!1)],f.prototype,"enableCriticalPath",void 0),g([ne.Property(!1)],f.prototype,"enableUndoRedo",void 0),g([ne.Property(10)],f.prototype,"undoRedoStepsCount",void 0),g([ne.Property()],f.prototype,"contextMenuItems",void 0),g([ne.Property(!1)],f.prototype,"allowPdfExport",void 0),g([ne.Property(!1)],f.prototype,"validateManualTasksOnLinking",void 0),g([ne.Property(!1)],f.prototype,"enableMultiTaskbar",void 0),g([ne.Property(!1)],f.prototype,"showOverAllocation",void 0),g([ne.Property("Auto")],f.prototype,"taskMode",void 0),g([ne.Complex({},Kt)],f.prototype,"filterSettings",void 0),g([ne.Complex({},ei)],f.prototype,"searchSettings",void 0),g([ne.Complex({},mi)],f.prototype,"splitterSettings",void 0),g([ne.Event()],f.prototype,"queryTaskbarInfo",void 0),g([ne.Event()],f.prototype,"beforeExcelExport",void 0),g([ne.Event()],f.prototype,"excelExportComplete",void 0),g([ne.Event()],f.prototype,"excelQueryCellInfo",void 0),g([ne.Event()],f.prototype,"excelHeaderQueryCellInfo",void 0),g([ne.Event()],f.prototype,"rowDrag",void 0),g([ne.Event()],f.prototype,"rowDragStart",void 0),g([ne.Event()],f.prototype,"rowDragStartHelper",void 0),g([ne.Event()],f.prototype,"rowDrop",void 0),g([ne.Event()],f.prototype,"collapsing",void 0),g([ne.Event()],f.prototype,"collapsed",void 0),g([ne.Event()],f.prototype,"expanding",void 0),g([ne.Event()],f.prototype,"expanded",void 0),g([ne.Event()],f.prototype,"actionBegin",void 0),g([ne.Event()],f.prototype,"cellSave",void 0),g([ne.Event()],f.prototype,"actionComplete",void 0),g([ne.Event()],f.prototype,"actionFailure",void 0),g([ne.Event()],f.prototype,"dataStateChange",void 0),g([ne.Event()],f.prototype,"taskbarEdited",void 0),g([ne.Event()],f.prototype,"endEdit",void 0),g([ne.Event()],f.prototype,"cellEdit",void 0),g([ne.Event()],f.prototype,"load",void 0),g([ne.Event()],f.prototype,"created",void 0),g([ne.Event()],f.prototype,"destroyed",void 0),g([ne.Event()],f.prototype,"taskbarEditing",void 0),g([ne.Event()],f.prototype,"dataBound",void 0),g([ne.Event()],f.prototype,"beforeDataBound",void 0),g([ne.Event()],f.prototype,"resizeStart",void 0),g([ne.Event()],f.prototype,"resizing",void 0),g([ne.Event()],f.prototype,"resizeStop",void 0),g([ne.Event()],f.prototype,"splitterResizeStart",void 0),g([ne.Event()],f.prototype,"splitterResizing",void 0),g([ne.Event()],f.prototype,"splitterResized",void 0),g([ne.Event()],f.prototype,"columnDragStart",void 0),g([ne.Event()],f.prototype,"columnDrag",void 0),g([ne.Event()],f.prototype,"columnDrop",void 0),g([ne.Event()],f.prototype,"beforeTooltipRender",void 0),g([ne.Event()],f.prototype,"rowSelecting",void 0),g([ne.Event()],f.prototype,"rowSelected",void 0),g([ne.Event()],f.prototype,"rowDeselecting",void 0),g([ne.Event()],f.prototype,"rowDeselected",void 0),g([ne.Event()],f.prototype,"cellSelecting",void 0),g([ne.Event()],f.prototype,"cellSelected",void 0),g([ne.Event()],f.prototype,"cellDeselecting",void 0),g([ne.Event()],f.prototype,"cellDeselected",void 0),g([ne.Event()],f.prototype,"queryCellInfo",void 0),g([ne.Event()],f.prototype,"headerCellInfo",void 0),g([ne.Event()],f.prototype,"rowDataBound",void 0),g([ne.Event()],f.prototype,"columnMenuOpen",void 0),g([ne.Event()],f.prototype,"toolbarClick",void 0),g([ne.Event()],f.prototype,"columnMenuClick",void 0),g([ne.Event()],f.prototype,"contextMenuOpen",void 0),g([ne.Event()],f.prototype,"contextMenuClick",void 0),g([ne.Event()],f.prototype,"onTaskbarClick",void 0),g([ne.Event()],f.prototype,"recordDoubleClick",void 0),g([ne.Event()],f.prototype,"onMouseMove",void 0),g([ne.Event()],f.prototype,"beforePdfExport",void 0),g([ne.Event()],f.prototype,"pdfExportComplete",void 0),g([ne.Event()],f.prototype,"pdfQueryCellInfo",void 0),g([ne.Event()],f.prototype,"pdfQueryTaskbarInfo",void 0),g([ne.Event()],f.prototype,"pdfQueryTimelineCellInfo",void 0),g([ne.Event()],f.prototype,"pdfColumnHeaderQueryCellInfo",void 0),g([ne.NotifyPropertyChanges],f));function f(e,t){e=ua.call(this,e,t)||this;return e.isRowSelected=!1,e.showIndicator=!0,e.singleTier=0,e.expandedRecords=[],e.isLocaleChanged=!1,e.triggeredColumnName="",e.totalUndoAction=0,e.previousFlatData=[],e.isExpandPerformed=!1,e.oldRecords=[],e.updateDuration=!1,e.isConvertedMilestone=!1,e.isCancelled=!1,e.isCollapseAll=!1,e.previousRecords={},e.editedRecords=[],e.modifiedRecords=[],e.isOnEdit=!1,e.isOnDelete=!1,e.isOnAdded=!1,e.isExpandCollapseLevelMethod=!1,e.isFromEventMarker=!1,e.isDynamicData=!1,e.isConnectorLineUpdate=!1,e.staticSelectedRowIndex=-1,e.needsID=!0,e.showActiveElement=!0,e.addDeleteRecord=!1,e.enableHeaderFocus=!0,e.enableValidation=!0,e.isTreeGridRendered=!1,e.isFromOnPropertyChange=!1,e.isFromRenderBaseline=!1,e.isGanttChartRendered=!1,e.isEdit=!1,e.eventMarkerColloction=[],ne.setValue("mergePersistData",e.mergePersistGanttData,e),e}(g=k.PdfHorizontalOverflowType||(k.PdfHorizontalOverflowType={}))[g.NextPage=0]="NextPage",g[g.LastPage=1]="LastPage";var ca="toolbarClick",ga=(m.prototype.bindTreeGridProperties=function(){this.parent.treeGrid.editSettings.allowEditing=this.parent.editSettings.allowEditing,this.parent.treeGrid.editSettings.allowNextRowEdit=this.parent.editSettings.allowNextRowEdit,this.parent.treeGrid.editSettings.mode="Cell",this.parent.treeGrid.cellEdit=this.ensureEditCell.bind(this),this.parent.editSettings.allowEditing&&T.TreeGrid.Inject(T.Edit)},m.prototype.ensureEditCell=function(i){var e,t,a,n,r,s,o=this,l=i.rowData,d=i.columnName,h=(this.editedColumn=this.parent.getColumnByField(d,this.parent.ganttColumns),this.parent.taskFields);if(this.parent.readOnly)i.cancel=!0;else if("Dialog"===this.parent.editSettings.mode)i.cancel=!0;else{if(i.columnObject&&i.columnObject.field===this.parent.taskFields.constraintType&&i.columnObject.edit&&i.columnObject.edit.params&&Array.isArray(i.columnObject.edit.params.dataSource)&&(e=Object.keys(k.ConstraintType).filter(function(e){return!isNaN(Number(k.ConstraintType[e]))}).map(function(e){return{text:o.parent.treeGridModule.getLocalizedConstraintTypeText(e),value:k.ConstraintType[e]}}),i.rowData&&i.rowData.hasChildRecords?(t=this.parent.treeGridModule.getLocalizedConstraintTypeText("AsSoonAsPossible"),a=this.parent.treeGridModule.getLocalizedConstraintTypeText("StartNoEarlierThan"),n=this.parent.treeGridModule.getLocalizedConstraintTypeText("FinishNoLaterThan"),i.columnObject.edit.params.dataSource=e.filter(function(e){return e.text===t||e.text===a||e.text===n})):i.columnObject.edit.params.dataSource=e),!l.hasChildRecords||this.parent.allowParentDependency||(d!==h.endDate||(ne.isNullOrUndefined(l[h.manual])||!1!==l[h.manual])&&"Auto"!==this.parent.taskMode)&&d!==h.duration&&d!==h.dependency&&d!==h.progress&&d!==h.work&&d!==h.type&&"taskType"!==d)return r=new D.Deferred,s=this.parent,this.currentEditedRowData=i.rowData,this.parent.trigger("cellEdit",i,function(e){var t;e.columnName===s.taskFields.progress&&e.rowData.hasChildRecords&&(e.cancel=!0),i.rowData.ganttProperties.isAutoSchedule||-1!==[(t=o.parent.taskFields).constraintDate,t.constraintType].indexOf(i.columnObject.field)&&(e.cancel=!0),0===l.level&&"ResourceView"===o.parent.viewType&&(e.cancel=!0),r.resolve(e),e.cancel||(e.columnName===o.parent.taskFields.notes||"WBSPredecessor"===e.columnName?o.openNotesEditor(e):(o.isCellEdit=!0,ne.isNullOrUndefined(o.parent.toolbarModule)||o.parent.toolbarModule.refreshToolbarItems()))}),r;(d!==h.dependency||this.parent.allowParentDependency)&&d===h.dependency||(i.cancel=!0)}},m.prototype.openNotesEditor=function(e){var t=this.parent.taskFields,i=e.rowData,a=e.columnName;(a!==t.notes||this.parent.showInlineNotes)&&"WBSPredecessor"!==a||(e.cancel=!0,e=this.parent.editModule.dialogModule.updatedEditFields.map(function(e){return e.type}),-1===(e="WBSPredecessor"===a?e.indexOf("Dependency"):e.indexOf("Notes")))||(this.parent.editModule.dialogModule.openEditDialog(i.ganttProperties.rowUniqueID),document.getElementById(this.parent.element.id+"_Tab").ej2_instances[0].selectedItem=e),a===t.notes&&!0===this.parent.showInlineNotes&&(this.isCellEdit=!0)},m.prototype.initiateCellEdit=function(e,t){var i,a=!0,a=("actionComplete"===e.name&&e.previousData===e.data[e.column.field]&&(a=!1),this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Edit")&&a&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(a={action:"CellEditing"}).editedColumn=e.column.field,a.modifiedRecords=[],this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=a),ne.getValue("column",e)),n=ne.getValue("data",e),r={action:"CellEditing"},s=(r.data=this.parent.getTaskByUniqueID(n.uniqueID),ne.getValue("previousData",e)),o=this.parent.taskFields.baselineEndDate===a.field||this.parent.taskFields.baselineStartDate===a.field,o=this.parent.allowUnscheduledTasks&&!o||!ne.isNullOrUndefined(n[a.field])&&""!==n[a.field]||this.parent.taskFields.duration!==a.field&&this.parent.taskFields.startDate!==a.field&&this.parent.taskFields.endDate!==a.field&&this.parent.taskFields.baselineDuration!==a.field&&this.parent.taskFields.baselineEndDate!==a.field&&this.parent.taskFields.baselineStartDate!==a.field?n[a.field]:s;ne.isNullOrUndefined(n)?this.parent.editModule.endEditAction(e):(n[a.field]=s,r.data[a.field]=s,this.parent.initiateEditAction(!0),0<this.parent.weekWorkingTime.length&&o&&(a.field===this.parent.taskFields.startDate||a.field===this.parent.taskFields.baselineStartDate)&&(i=a.field===this.parent.taskFields.startDate?n.ganttProperties.startDate:n.ganttProperties.baselineStartDate,this.parent.getStartTime(i)/3600===i.getHours())&&(i=this.parent.getStartTime(o),this.parent.dataOperation.setTime(i,o)),this.parent.setRecordValue(a.field,o,r.data),a.field===this.parent.taskFields.name?this.taskNameEdited(r):a.field===this.parent.taskFields.startDate?this.startDateEdited(r,!1):a.field===this.parent.taskFields.constraintDate||a.field===this.parent.taskFields.constraintType?this.constraintEdited(r):a.field===this.parent.taskFields.endDate?this.endDateEdited(r,e.previousData):a.field===this.parent.taskFields.duration?this.durationEdited(r):a.field===this.parent.taskFields.resourceInfo?this.resourceEdited(r,t,n):a.field===this.parent.taskFields.progress?this.progressEdited(r):a.field===this.parent.taskFields.baselineStartDate?this.startDateEdited(r,!0):a.field===this.parent.taskFields.baselineEndDate?this.endDateEditedforBaseline(r,e.previousData):a.field===this.parent.taskFields.baselineDuration?this.durationEdited(r,!0):a.field===this.parent.taskFields.dependency?this.dependencyEdited(r,s):a.field===this.parent.taskFields.notes?this.notedEdited(r):a.field===this.parent.taskFields.work?this.workEdited(r):a.field!==this.parent.taskFields.type&&"taskType"!==a.field||ne.isNullOrUndefined(this.parent.taskFields.work)?a.field===this.parent.taskFields.manual?this.taskmodeEdited(r):(this.parent.setRecordValue("taskData."+a.field,r.data[a.field],r.data),this.parent.editModule.initiateSaveAction(r)):this.typeEdited(r,t)),this.isCellEdit=!1,ne.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn)||(this.parent.editModule.cellEditModule.editedColumn=null),ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},m.prototype.taskNameEdited=function(e){this.parent.setRecordValue("taskData."+this.parent.taskFields.name,e.data[this.parent.taskFields.name],e.data),this.parent.setRecordValue("taskName",e.data[this.parent.taskFields.name],e.data.ganttProperties,!0),this.updateEditedRecord(e)},m.prototype.notedEdited=function(e){this.parent.setRecordValue("taskData."+this.parent.taskFields.notes,e.data[this.parent.taskFields.notes],e.data),this.parent.setRecordValue("notes",e.data[this.parent.taskFields.notes],e.data.ganttProperties,!0),this.updateEditedRecord(e)},m.prototype.taskmodeEdited=function(e){this.parent.setRecordValue("isAutoSchedule",!e.data[this.parent.taskFields.manual],e.data.ganttProperties,!0),this.parent.editModule.updateTaskScheduleModes(e.data),this.updateEditedRecord(e)},m.prototype.updateGanttDataProperties=function(e,t,i){var a=e.data,n=a.ganttProperties,r=this.parent.dateValidationModule.getFieldMappings(i),s=r.startdateField,o=r.enddateField,r=r.durationField;ne.isNullOrUndefined(t)?a.hasChildRecords||(i||(this.parent.setRecordValue(s,null,n,!0),this.parent.setRecordValue("isMilestone",!1,n,!0)),null===n.startDate&&null===n.endDate&&null!==n.duration)||this.parent.setRecordValue(r,null,n,!0):n[o]||!ne.isNullOrUndefined(n[r])?(this.parent.setRecordValue(s,new Date(t.getTime()),n,!0),i&&ne.isNullOrUndefined(this.parent.taskFields.baselineDuration)||this.parent.dateValidationModule.calculateEndDate(a,i)):ne.isNullOrUndefined(n[o])&&ne.isNullOrUndefined(n[r])&&this.parent.setRecordValue(s,new Date(t.getTime()),n,!0),i||this.parent.setRecordValue("isMilestone",0===n.duration,n,!0),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(a,s),this.parent.dataOperation.updateMappingData(a,o),this.parent.dataOperation.updateMappingData(a,r)},m.prototype.startDateEdited=function(e,t){var i=e.data,a=(e.data.ganttProperties,(a=t?e.data[this.parent.taskFields.baselineStartDate]:e.data[this.parent.taskFields.startDate])?new Date(a.getTime()):null);a=this.parent.dateValidationModule.checkStartDate(a,i.ganttProperties,i.ganttProperties.isMilestone,void 0,t),e.data.ganttProperties.constraintDate&&(e.data.ganttProperties.constraintDate=a),this.updateGanttDataProperties(e,a,t),this.updateEditedRecord(e)},m.prototype.constraintEdited=function(e){var t=e.data,i=e.data.ganttProperties,a=e.data[this.parent.taskFields.startDate],n=e.data[this.parent.taskFields.constraintDate],r=e.data[this.parent.taskFields.constraintType],a=a?new Date(a.getTime()):null;if(ne.isNullOrUndefined(n)){var s=t[this.parent.taskFields.startDate],o=t[this.parent.taskFields.endDate];switch(r){case k.ConstraintType.MustStartOn:case k.ConstraintType.StartNoEarlierThan:case k.ConstraintType.StartNoLaterThan:ne.isNullOrUndefined(s)||(this.parent.setRecordValue("constraintDate",new Date(s.getTime()),i,!0),n=i.constraintDate);break;case k.ConstraintType.MustFinishOn:case k.ConstraintType.FinishNoEarlierThan:case k.ConstraintType.FinishNoLaterThan:ne.isNullOrUndefined(o)||(this.parent.setRecordValue("constraintDate",new Date(o.getTime()),i,!0),n=i.constraintDate)}}else this.parent.setRecordValue("constraintDate",new Date(n.getTime()),i,!0);this.parent.setRecordValue("constraintType",r,i,!0),i.predecessor&&i.constraintType===k.ConstraintType.AsSoonAsPossible?(r=this.parent.predecessorModule.getPredecessorDate(e.data,i.predecessor))&&(a=r):a=i.constraintType===k.ConstraintType.StartNoEarlierThan||i.constraintType===k.ConstraintType.MustStartOn||i.constraintType===k.ConstraintType.MustFinishOn?this.parent.dateValidationModule.getDateByConstraint(t,n):this.parent.dateValidationModule.getDateByConstraint(t,a),this.updateGanttDataProperties(e,a),this.parent.dataOperation.updateMappingData(t,"constraintDate"),this.updateEditedRecord(e)},m.prototype.validateEndDateWithSegments=function(e){for(var t=[],i=e.segments,a=0;a<i.length;a++){var n=i[parseInt(a.toString(),10)],r=n.endDate,r=!ne.isNullOrUndefined(e.endDate)&&r.getTime()<e.endDate.getTime()&&a!==i.length-1?r:e.endDate;n.duration=this.parent.dataOperation.getDuration(n.startDate,r,e.durationUnit,e.isAutoSchedule,e.isMilestone),0<i.length&&r.getTime()<n.startDate.getTime()&&r.getTime()<=e.endDate.getTime()?i[a-1].duration=this.parent.dataOperation.getDuration(i[a-1].startDate,e.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone):t.push(n)}return t},m.prototype.endDateEdited=function(e,t){var i,a=e.data.ganttProperties,n=(n=e.data[this.parent.taskFields.endDate])?new Date(n.getTime()):null;ne.isNullOrUndefined(n)?(this.parent.setRecordValue("endDate",n,a,!0),null===a.startDate&&null===a.endDate&&null!==a.duration||this.parent.setRecordValue("duration",null,a,!0),this.parent.setRecordValue("isMilestone",!1,a,!0)):(i=this.parent.getCurrentDayEndTime(n),(0===n.getHours()||t&&n.toTimeString().slice(0,5)===t.toTimeString().slice(0,5))&&86400!==i&&this.parent.dateValidationModule.setTime(i,n),n=this.parent.dateValidationModule.checkEndDate(n,a,a.isMilestone),this.parent.setRecordValue("endDate",n,a,!0),!ne.isNullOrUndefined(a.startDate)&&ne.isNullOrUndefined(a.duration)?-1===this.parent.dateValidationModule.compareDates(a.endDate,a.startDate)&&(this.parent.setRecordValue("endDate",new Date(a.startDate.getTime()),a,!0),i=this.parent.getCurrentDayEndTime(a.endDate),this.parent.dateValidationModule.setTime(i,a.endDate)):!ne.isNullOrUndefined(a.duration)&&ne.isNullOrUndefined(a.startDate)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(a.endDate,a.duration,a.durationUnit,a),a,!0),ne.isNullOrUndefined(a.segments)||(a.segments=this.validateEndDateWithSegments(a)),this.compareDatesFromRecord(a)<=0?this.parent.dateValidationModule.calculateDuration(e.data):this.parent.editModule.revertCellEdit(e),this.updateDates(e),this.parent.setRecordValue("isMilestone",0===a.duration,a,!0),a.isMilestone&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(a.startDate,a),a,!0)),!ne.isNullOrUndefined(e.data.ganttProperties.segments)&&0<e.data.ganttProperties.segments.length&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e.data,!1),e.data.ganttProperties,!0),this.parent.dataOperation.updateMappingData(e.data,"segments")),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"startDate"),this.parent.dataOperation.updateMappingData(e.data,"endDate"),this.parent.dataOperation.updateMappingData(e.data,"duration"),this.parent.editModule.updateResourceRelatedFields(e.data,"endDate"),this.updateEditedRecord(e)},m.prototype.endDateEditedforBaseline=function(e,t){var i,a=e.data.ganttProperties,n=(n=e.data[this.parent.taskFields.baselineEndDate])?new Date(n.getTime()):null;ne.isNullOrUndefined(n)?(this.parent.setRecordValue("baselineEndDate",n,a,!0),null===a.baselineStartDate&&null===a.baselineEndDate&&null!==a.baselineDuration||this.parent.setRecordValue("baselineDuration",null,a,!0)):(i=this.parent.getCurrentDayEndTime(n),(0===n.getHours()||t&&n.toTimeString().slice(0,5)===t.toTimeString().slice(0,5))&&86400!==i&&this.parent.dateValidationModule.setTime(i,n),n=this.parent.dateValidationModule.checkEndDate(n,a,a.isMilestone,!0),this.parent.setRecordValue("baselineEndDate",n,a,!0),!ne.isNullOrUndefined(a.baselineStartDate)&&ne.isNullOrUndefined(a.baselineDuration)?-1===this.parent.dateValidationModule.compareDates(a.baselineEndDate,a.baselineStartDate)&&(this.parent.setRecordValue("baselineEndDate",new Date(a.baselineStartDate.getTime()),a,!0),i=this.parent.getCurrentDayEndTime(a.baselineEndDate),this.parent.dateValidationModule.setTime(i,a.baselineEndDate)):!ne.isNullOrUndefined(a.baselineDuration)&&ne.isNullOrUndefined(a.baselineStartDate)&&this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.getStartDate(a.baselineEndDate,a.baselineDuration,a.durationUnit,a,!0),a,!0),this.compareDatesFromRecord(a,!0)<=0?this.parent.dateValidationModule.calculateDuration(e.data,!0):this.parent.editModule.revertCellEdit(e),this.updateDatesforBaseline(e)),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"baselineStartDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineEndDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineDuration"),this.updateEditedRecord(e)},m.prototype.durationEdited=function(e,t){var i=t?"baselineDuration":"duration",a=(/^[^\d.-]+$/.test(e.data[this.parent.taskFields[i]])&&(a="The provided value for the "+this.parent.taskFields[i]+" field is invalid. Please ensure the "+this.parent.taskFields[i]+" field contains only valid numeric values.",this.parent.trigger("actionFailure",{error:a})),e.data.ganttProperties),i=(!t&&parseInt(e.data[this.parent.taskFields.duration],10)<0?e.data[this.parent.taskFields.duration]=a.duration:t&&parseInt(e.data[this.parent.taskFields.baselineDuration],10)<0&&(e.data[this.parent.taskFields.baselineDuration]=a.baselineDuration),e.data[this.parent.taskFields[i]]);this.parent.dataOperation.updateDurationValue(i,a,t),t?this.updateDatesforBaseline(e):(this.updateDates(e),this.parent.editModule.updateResourceRelatedFields(e.data,"duration")),this.updateEditedRecord(e)},m.prototype.updateDates=function(e){var t=e.data.ganttProperties,i=this.parent.dateValidationModule.getDateFromFormat(t.endDate),a=this.parent.dateValidationModule.getDateFromFormat(t.startDate),n=t.duration;ne.isNullOrUndefined(n)?(this.parent.setRecordValue("isMilestone",!1,t,!0),null!==e.data[this.parent.taskFields.duration]&&this.parent.setRecordValue("endDate",null,t,!0)):(ne.isNullOrUndefined(a)&&!ne.isNullOrUndefined(i)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(i,n,t.durationUnit,t),t,!0),0!==n&&t.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,t,!0),ne.isNullOrUndefined(this.parent.taskFields.milestone)||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,e.data,!0),this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(t.startDate,t),t,!0)),!ne.isNullOrUndefined(t.segments)&&0<t.segments.length&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e.data,!1),t,!0),this.parent.dataOperation.updateMappingData(e.data,"segments")),this.parent.setRecordValue("isMilestone",0===t.duration,t,!0),this.parent.dateValidationModule.calculateEndDate(e.data)),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"endDate"),this.parent.dataOperation.updateMappingData(e.data,"startDate"),this.parent.dataOperation.updateMappingData(e.data,"duration")},m.prototype.updateDatesforBaseline=function(e){var t=e.data.ganttProperties,i=this.parent.dateValidationModule.getDateFromFormat(t.baselineEndDate),a=this.parent.dateValidationModule.getDateFromFormat(t.baselineStartDate),n=t.baselineDuration;ne.isNullOrUndefined(a)&&!ne.isNullOrUndefined(i)&&this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.getStartDate(i,n,t.durationUnit,t,void 0,!0),t,!0),0!==n&&this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.checkStartDate(t.baselineStartDate,t,void 0,void 0,!0),t,!0),this.parent.dateValidationModule.calculateEndDate(e.data,!0),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(e.data,"baselineEndDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineStartDate"),this.parent.dataOperation.updateMappingData(e.data,"baselineDuration")},m.prototype.progressEdited=function(e){var t,i=e.data;this.parent.setRecordValue("progress",100<i[this.parent.taskFields.progress]?100:i[this.parent.taskFields.progress],i.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.progress,100<i[this.parent.taskFields.progress]?100:i[this.parent.taskFields.progress],e.data),i.ganttProperties.isAutoSchedule||this.parent.setRecordValue("autoWidth",this.parent.dataOperation.calculateWidth(i,!1),i.ganttProperties,!0),!ne.isNullOrUndefined(e.data.ganttProperties.segments)&&0<e.data.ganttProperties.segments.length&&!ne.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&this.parent.editModule.taskbarEditModule.updateSegmentProgress(e.data.ganttProperties),e.data.hasChildRecords||(t=i.ganttProperties.isAutoSchedule?i.ganttProperties.width:i.ganttProperties.autoWidth,this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t,i.ganttProperties.progress),i.ganttProperties,!0)),this.updateEditedRecord(e)},m.prototype.resourceEdited=function(e,t,i){var a=this.parent.resourceFields,n=t[this.parent.taskFields.resourceInfo];if(n){this.isResourceCellEdited=!0;for(var r=this.parent.dataOperation.setResourceInfo(t).length,s=i.ganttProperties.resourceInfo,o=void 0,l=[],d=this.parent.resources,h=void 0,p=0;p<r;p++)!function(t){if(s){var e=s.length;for(h=0;h<e;h++){if(s[h][a.id]===n[t]){o=h;break}o=-1}}var i;ne.isNullOrUndefined(o)||-1===o?(i=d.filter(function(e){return n[t]===e[a.id]}),(i=ne.extend({},i[0]))[a.unit]=100,l.push(i)):l.push(s[parseInt(o.toString(),10)])}(p);e.data.ganttProperties.resourceInfo=l,this.parent.dataOperation.updateMappingData(e.data,"resourceInfo"),this.parent.editModule.updateResourceRelatedFields(e.data,"resource"),"ResourceView"===this.parent.viewType&&(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=s),this.updateDates(e),this.updateEditedRecord(e)}},m.prototype.dependencyEdited=function(e,t){/[!@#$%^&*()_=[\]{};:<>|./?-]/.test(e.data[this.parent.taskFields.dependency])&&(i="The provided value for the "+this.parent.taskFields.dependency+" field is invalid. Please ensure that the "+this.parent.taskFields.dependency+" field does not contain any special characters.",this.parent.trigger("actionFailure",{error:i})),this.parent.predecessorModule.updateUnscheduledDependency(e.data);var i,a,n=this.parent.localeObj.getConstant("FF"),r=this.parent.localeObj.getConstant("FS"),s=this.parent.localeObj.getConstant("SS"),o=this.parent.localeObj.getConstant("SF"),l="";ne.isNullOrUndefined(e.data[this.parent.taskFields.dependency])||(a=e.data[this.parent.taskFields.dependency].split(",")).map(function(e,t){l=e.includes(n)?(l+=e.replace(n,"FF"))+(a.length!==t+1?",":""):e.includes(r)?(l+=e.replace(r,"FS"))+(a.length!==t+1?",":""):e.includes(s)?(l+=e.replace(s,"SS"))+(a.length!==t+1?",":""):e.includes(o)?(l+=e.replace(o,"SF"))+(a.length!==t+1?",":""):(l+=e)+(a.length!==t+1?",":"")}),this.parent.connectorLineEditModule.updatePredecessor(e.data,l,e)||this.parent.editModule.revertCellEdit(t)},m.prototype.workEdited=function(e){var t=e.data.ganttProperties,i=((e.data[this.parent.taskFields.work]<0||ne.isNullOrUndefined(e.data[this.parent.taskFields.work]))&&(e.data[this.parent.taskFields.work]=0),this.parent.updateDuration=!0,e.data[this.parent.taskFields.work]);this.parent.setRecordValue("work",i,t,!0),this.parent.editModule.updateResourceRelatedFields(e.data,"work"),this.updateDates(e),this.updateEditedRecord(e),this.parent.updateDuration=!1},m.prototype.typeEdited=function(e,t){var i=this.parent.taskFields.type||"taskType",a=e.data.ganttProperties,t=t[""+i];this.parent.setRecordValue("taskType",t,a,!0),"FixedDuration"===a.taskType&&0===a.duration&&this.parent.editModule.updateResourceRelatedFields(e.data,"work"),this.updateEditedRecord(e)},m.prototype.compareDatesFromRecord=function(e,t){var i=this.parent.dateValidationModule.getValidStartDate(e,null,t),e=this.parent.dateValidationModule.getValidEndDate(e,null,t);return this.parent.dateValidationModule.compareDates(i,e)},m.prototype.updateEditedRecord=function(e){this.parent.editModule.initiateUpdateAction(e)},m.prototype.destroy=function(){this.parent.editModule.cellEditModule=void 0},m);function m(e){this.isCellEdit=!1,this.isResourceCellEdited=!1,this.parent=e,this.bindTreeGridProperties()}ma.prototype.createTooltip=function(e,t,i){var a=this;this.toolTipObj=new F.Tooltip({opensOn:e,position:"TopRight",enableRtl:this.parent.enableRtl,mouseTrail:t,cssClass:ct,windowCollision:!0,target:i||null,animation:{open:{effect:"None"},close:{effect:"None"}}}),this.toolTipObj.target=".e-connectorpoint-left, .e-connectorpoint-right",this.toolTipObj.beforeRender=function(e){e={data:a.taskbarEdit.taskBarEditRecord,args:e,content:a.toolTipObj.content};a.parent.trigger("beforeTooltipRender",e)},this.toolTipObj.afterOpen=function(e){a.updateTooltipPosition(e)},this.toolTipObj.isStringTemplate=!0,this.toolTipObj.appendTo(this.parent.chartPane)},ma.prototype.updateTooltipPosition=function(e){e.element.style.visibility="visible";var t,i=this.parent.element.closest('[style*="zoom"]');ne.isNullOrUndefined(i)&&((i=this.parent.getOffsetRect(this.parent.chartPane).left+this.parent.chartPane.offsetWidth)<(t=e.element.offsetLeft)+e.element.offsetWidth&&(t+=i-(t+e.element.offsetWidth)),e.element.style.left=t+"px",e.element.style.visibility="visible",e.target)&&this.parent.tooltipSettings.editing&&(i=e.target.getBoundingClientRect().top+window.scrollY,t=void 0,t=e.target.classList.contains("e-connectorpoint-left")||e.target.classList.contains("e-connectorpoint-right")?i-e.element.offsetHeight-14:i-e.element.offsetHeight-8,this.toolTipHeight=e.element.style.top=t+"px")},ma.prototype.showHideTaskbarEditTooltip=function(e,t){e&&this.parent.tooltipSettings.showTooltip?(this.createTooltip("Custom",!1),this.parent.tooltipModule.toolTipObj.close(),this.updateTooltip(t),this.parent.tooltipSettings.editing&&(this.toolTipObj.openDelay=500),"ConnectorPointLeftDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+ot)):"ConnectorPointRightDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+lt)):this.toolTipObj.open(this.taskbarEdit.taskBarEditElement)):ne.isNullOrUndefined(this.toolTipObj)||(this.toolTipObj.destroy(),this.toolTipObj=null)},ma.prototype.updateTooltip=function(e){var t=this.taskbarEdit.taskBarEditRecord.ganttProperties,i=(ne.isNullOrUndefined(e)||-1===e?t:t.segments[e]).width,a=(ne.isNullOrUndefined(e)||-1===e?t:t.segments[e]).progressWidth,n=ne.isNullOrUndefined(e)||-1===e?t.left:t.left+t.segments[e].left;ne.isNullOrUndefined(this.toolTipObj)||("ConnectorPointLeftDrag"===this.taskbarEdit.taskBarEditAction||"ConnectorPointRightDrag"===this.taskbarEdit.taskBarEditAction?(this.toolTipObj.content=this.getTooltipText(e),this.parent.tooltipSettings.editing&&(this.toolTipObj.openDelay=500),this.toolTipObj.offsetY=-3):(this.parent.tooltipSettings.editing&&(this.toolTipObj.openDelay=500),this.toolTipObj.content=this.getTooltipText(e),t.segments&&0<t.segments.length&&this.taskbarEdit.mainElement&&"ProgressResizing"===this.taskbarEdit.taskBarEditAction?(t=this.taskbarEdit.mainElement.querySelectorAll(".e-segmented-taskbar"),this.toolTipObj.refresh(t[e])):this.toolTipObj.refresh(this.taskbarEdit.taskBarEditElement),"LeftResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=0:this.toolTipObj.offsetX=-i:"RightResizing"===this.taskbarEdit.taskBarEditAction||"ParentResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-i:this.toolTipObj.offsetX=0:"ProgressResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-a:this.toolTipObj.offsetX=-(i-a):"MilestoneDrag"===this.taskbarEdit.taskBarEditAction?this.toolTipObj.offsetX=-this.parent.chartRowsModule.milestoneHeight/2:5<i&&(this.toolTipObj.offsetX=-(i+n-this.taskbarEdit.tooltipPositionX)),this.parent.tooltipSettings.editing&&document.getElementsByClassName("e-gantt-tooltip")[0]&&this.toolTipHeight&&(document.getElementsByClassName("e-gantt-tooltip")[0].style.top=this.toolTipHeight)))},ma.prototype.getTooltipText=function(e){var t="",i=this.parent.globalize,a=this.taskbarEdit.taskBarEditRecord.ganttProperties;if(!ne.isNullOrUndefined(a.segments)&&0<a.segments.length&&-1!==e&&"ProgressResizing"!==this.taskbarEdit.taskBarEditAction&&(a=a.segments[e]),this.parent.tooltipSettings.editing){e=this.parent.tooltipModule.templateCompiler(this.parent.tooltipSettings.editing,this.parent,this.taskbarEdit.taskBarEditRecord,"TooltipEditingTemplate");ne.getValue("tooltipEle",this.toolTipObj)&&this.parent.renderTemplates(),t=e[0]}else{var n=void 0,r=void 0,s=void 0;switch(ne.isNullOrUndefined(a)||ne.isNullOrUndefined(a.startDate)||(n='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value">'+i.formatDate(a.startDate,{format:this.parent.getDateFormat()})+"</td></tr>"),ne.isNullOrUndefined(a)||ne.isNullOrUndefined(a.endDate)||(r='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value">'+i.formatDate(a.endDate,{format:this.parent.getDateFormat()})+"</td></tr>"),ne.isNullOrUndefined(a)||ne.isNullOrUndefined(a.duration)||(s='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value">'+this.parent.getDurationString(a.duration,a.durationUnit)+"</td></tr>"),this.taskbarEdit.taskBarEditAction){case"ProgressResizing":t='<table class = "e-gantt-tooltiptable"><tbody>'+('<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+"</td><td class="+$e+'>:</td><td class = "e-gantt-tooltip-value">'+a.progress+"</td></tr>")+"</tbody></table>";break;case"LeftResizing":t='<table class = "e-gantt-tooltiptable"><tbody>'+n+s+"</tbody></table>";break;case"RightResizing":case"ParentResizing":t='<table class = "e-gantt-tooltiptable"><tbody>'+r+s+"</tbody></table>";break;case"ChildDrag":case"ParentDrag":case"MilestoneDrag":case"ManualParentDrag":var o="",l="";ne.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.startDate)||(o=n),ne.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.endDate)||(l=r),t='<table class = "e-gantt-tooltiptable"><tbody>'+o+l+"</tbody></table>";break;case"ConnectorPointLeftDrag":case"ConnectorPointRightDrag":t=this.parent.connectorLineModule.tooltipTable,ne.isNullOrUndefined(this.toolTipObj)&&(this.parent.connectorLineModule.tooltipTable.innerHTML="",this.parent.connectorLineModule.tooltipTable.appendChild(this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"","")))}}return"string"==typeof t?ne.initializeCSPTemplate(function(){return t}):t};var fa=ma;function ma(e,t){this.parent=e,this.taskbarEdit=t}ya=function(e,t){return(ya=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var ya,Da,ka=function(){return(ka=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},ba=(function(e,t){function i(){this.constructor=e}ya(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(y,Da=J),y.prototype.wireEvents=function(){this.parent.on("chartMouseDown",this.mouseDownHandler,this),this.parent.on("chartMouseUp",this.mouseUpHandler,this),this.parent.on("chartMouseLeave",this.mouseLeaveHandler,this),this.parent.on("chartMouseMove",this.mouseMoveAction,this),this.parent.on("chartMouseClick",this.mouseClickHandler,this)},y.prototype.initPublicProp=function(){this.taskBarEditElement=null,this.taskBarEditRecord=null,this.taskBarEditAction=null,this.connectorSecondElement=null,this.connectorSecondRecord=null,this.connectorSecondAction=null,this.highlightedSecondElement=null,this.fromPredecessorText=null,this.toPredecessorText=null,this.finalPredecessor=null,this.drawPredecessor=!1,this.roundOffDuration=!0,this.dragMouseLeave=!1,this.isMouseDragged=!1,this.previousItemProperty=["left","progress","duration","isMilestone","startDate","endDate","width","progressWidth","autoLeft","autoDuration","autoStartDate","autoEndDate","autoWidth","segments"],this.tapPointOnFocus=!1,this.touchEdit=!1},y.prototype.mouseDownHandler=function(e){var t;this.parent.editSettings.allowTaskbarEditing&&!this.parent.readOnly&&(this.canDrag=!1,this.taskBarEditElement?((t=S(this.getElementByPosition(e),P))&&t.innerHTML===this.taskBarEditElement.innerHTML||this.taskBarEditElement.classList.contains("e-segmented-taskbar")||this.taskBarEditElement.classList.contains("collpse-parent-border"))&&(this.updateTaskBarEditElement(e),this.canDrag=!0,e.preventDefault()):this.parent.isAdaptive||this.updateTaskBarEditElement(e))},y.prototype.mouseClickHandler=function(e){var t,i;this.parent.editSettings.allowTaskbarEditing&&(i=S(t=this.getElementByPosition(e),P),this.parent.selectionModule&&this.parent.selectionModule.enableSelectMultiTouch?this.tapPointOnFocus&&this.updateTaskBarEditElement(e):this.tapPointOnFocus&&!ne.isNullOrUndefined(this.taskBarEditElement)&&i&&i.innerHTML!==this.taskBarEditElement.innerHTML?(this.connectorSecondRecord=this.parent.ganttChartModule.getRecordByTaskBar(i),this.connectorSecondAction="ConnectorPointLeftDrag",this.connectorSecondElement=i,this.fromPredecessorText="Finish",this.validateConnectorPoint()&&this.taskBarEditingAction(e,!0),this.showHideActivePredecessors(!1),this.initPublicProp()):t.classList.contains(dt)?(this.canDrag=!1,this.multipleSelectionEnabled(),this.showHideTaskBarEditingElements(t,this.taskBarEditElement),this.tapPointOnFocus=!0,this.taskBarEditAction="ConnectorPointLeftDrag",this.connectorSecondRecord=this.taskBarEditRecord,this.taskBarEditingAction(e,!1)):t.classList.contains(ht)?(this.canDrag=!1,this.multipleSelectionEnabled(),this.showHideTaskBarEditingElements(t,this.taskBarEditElement),this.tapPointOnFocus=!0,this.taskBarEditAction="ConnectorPointRightDrag",this.connectorSecondRecord=this.taskBarEditRecord,this.taskBarEditingAction(e,!1)):(this.tapPointOnFocus&&(this.showHideActivePredecessors(!1),this.showHideTaskBarEditingElements(i,this.taskBarEditElement)),this.updateTaskBarEditElement(e)))},y.prototype.showHideActivePredecessors=function(e){var t=this.taskBarEditRecord.ganttProperties,i=t.predecessor,a="ResourceView"===this.parent.viewType?t.taskId:t.rowUniqueID;if(i)for(var n=0;n<i.length;n++){var r=i[n];a.toString()!==r.from&&a.toString()!==r.to||this.applyActiveColor(r.from,r.to,e)}t=this.parent.ganttChartModule.chartBodyContainer;e?(ne.addClass([this.taskBarEditElement],[yt]),ne.addClass([t],[kt])):(ne.removeClass([this.taskBarEditElement],[yt]),ne.removeClass([t],[kt])),this.touchEdit=e,ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},y.prototype.applyActiveColor=function(e,t,i){var a=("ProjectView"===this.parent.viewType?this.taskBarEditRecord.ganttProperties.taskId:this.taskBarEditRecord.ganttProperties.rowUniqueID).toString()===e?this.parent.connectorLineModule.getRecordByID(t):this.parent.connectorLineModule.getRecordByID(e),a=this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(a)];ne.isNullOrUndefined(a)||(a=a.querySelector("."+P),e=this.parent.element.querySelector("#ConnectorLineparent"+e+"child"+t),i?(ne.addClass([a],[Dt]),e&&ne.addClass([e],[Dt])):(ne.removeClass([a],[Dt]),e&&ne.removeClass([e],[Dt])))},y.prototype.validateConnectorPoint=function(){var e=this.taskBarEditRecord.ganttProperties,t=this.connectorSecondRecord.ganttProperties,i=!0,a="ResourceView"===this.parent.viewType?e.taskId:e.rowUniqueID,n="ResourceView"===this.parent.viewType?t.taskId:t.rowUniqueID;if(this.connectorSecondRecord.hasChildRecords)i=!1;else if(t.predecessor)for(var r=0;r<t.predecessor.length;r++){var s=t.predecessor[r];if(s.from===a.toString()&&s.to===n.toString()){this.parent.connectorLineEditModule.childRecord=this.connectorSecondRecord,this.parent.connectorLineEditModule.predecessorIndex=r,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}if(s.from===n.toString()&&s.to===a.toString()){this.parent.connectorLineEditModule.childRecord=this.taskBarEditRecord,this.parent.connectorLineEditModule.predecessorIndex=r,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}}return i},y.prototype.mouseLeaveHandler=function(e){"ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"ProgressResizing"===this.taskBarEditAction||"LeftResizing"===this.taskBarEditAction||"RightResizing"===this.taskBarEditAction?this.dragMouseLeave=!1:this.dragMouseLeave=!0},y.prototype.updateTaskBarEditElement=function(e){var t,i,a,n,r,s=this.getElementByPosition(e);if(s.classList.contains(qe)||s.classList.contains(je)||s.classList.contains(He))l=S(s,je);else if(s.classList.contains(ze))l=S(s,ze);else{var o,l=S(s,P);if(!ne.isNullOrUndefined(l)&&!s.classList.contains("e-connectorpoint-left")&&!s.classList.contains("e-connectorpoint-right"))if((o=this.parent.ganttChartModule.getRecordByTaskBar(l))&&o.ganttProperties&&!ne.isNullOrUndefined(o.ganttProperties.segments)&&0<o.ganttProperties.segments.length)if(s.classList.contains("e-progressbar-handler-after")){for(var d=0;d<o.ganttProperties.segments.length;d++)if(o.ganttProperties.segments[d].showProgress){l=l.querySelectorAll(".e-segmented-taskbar")[d];break}}else l=S(s,we)}this.parent.editSettings.allowTaskbarEditing&&l?(this.showHideTaskBarEditingElements(l,this.editElement),this.editElement=l,this.realTaskbarElement=this.editElement,s=this.editElement.getAttribute("data-segment-index"),ne.isNullOrUndefined(s)?this.segmentIndex=-1:this.segmentIndex=Number(s),this.taskBarEditRecord=this.parent.ganttChartModule.getRecordByTaskBar(this.editElement),"mousedown"!==e.type&&"touchstart"!==e.type&&"click"!==e.type||(this.taskBarEditAction=this.getTaskBarAction(e),s=this.editElement.getAttribute("data-segment-index"),a=(o=this.parent.ganttChartModule.getRecordByTaskBar(l)).ganttProperties,t=this.editElement.parentElement.offsetLeft,this.currentData=o,i=ne.createElement("div",{styles:"height:100%;border-style:dashed;border-bottom:none;border-top:none;border-width:1px;position:absolute;z-index:10000"}),ne.addClass([i],"e-taskbar-resize-div"),i.style.setProperty("width",a.width+"px"),r=this.editElement.getAttribute("data-segment-index"),!ne.isNullOrUndefined(a.segments)&&this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?i.style.setProperty("left",ne.isNullOrUndefined(a.segments)?a.left+"px":t+"px"):i.style.setProperty("left",!ne.isNullOrUndefined(a.segments)&&1<a.segments.length?t+a.segments[Number(r)].left+"px":a.left+"px"),t=this.parent.createElement("table"),(r=this.parent.createElement("tbody")).appendChild(i),t.appendChild(r),a=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar"),i=null,r=(!("ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||ne.isNullOrUndefined(s)||ne.isNullOrUndefined(s)||0!==Number(s))||-1!==this.segmentIndex&&this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?this.editElement.parentElement:this.editElement).cloneNode(!0),a||(ne.addClass([r],"e-clone-taskbar"),r.style.setProperty("position","absolute"),o.hasChildRecords&&!o.ganttProperties.isAutoSchedule&&(a=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),n=this.parent.getOffsetRect(this.editElement),this.editElement.classList.contains("e-manualparent-main-container")?r.style.setProperty("left",o.ganttProperties.left-o.ganttProperties.autoLeft+"px"):r.style.setProperty(this.parent.enableRtl?"right":"left",Math.abs(n.left-a.left+Math.abs(this.parent.ganttChartModule.scrollElement.scrollLeft))+"px")),r.style.setProperty("top","0px"),i=this.parent.createElement("table"),(n=this.parent.createElement("tbody")).appendChild(r),i.appendChild(n)),"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||ne.isNullOrUndefined(s)||ne.isNullOrUndefined(s)||0!==Number(s)?this.cloneTaskbarElement=r:(a=r.getElementsByClassName("e-segmented-taskbar"),this.cloneTaskbarElement=a[Number(s)]),this.taskBarEditElement=this.cloneTaskbarElement,this.taskbarElement=i,this.taskbarResizer=t,this.currentIndex=s,this.roundOffDuration=!0,"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||!ne.isNullOrUndefined(this.parent.taskFields.dependency)||(this.taskBarEditAction=null),this.updateMouseDownProperties(e),"ResourceView"!==this.parent.viewType&&"ProjectView"!==this.parent.viewType)||0!==this.taskBarEditRecord.level&&this.parent.enableMultiTaskbar&&(n=this.parent.getTaskByUniqueID(this.taskBarEditRecord.parentItem.uniqueID),ne.isNullOrUndefined(n)||n.expanded||(this.prevZIndex=this.taskBarEditElement.style.zIndex,this.taskBarEditElement.style.zIndex="1000",this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")&&ne.addClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag")))):this.parent.isAdaptive?(this.taskBarEditElement&&this.showHideTaskBarEditingElements(l,this.editElement),this.initPublicProp()):this.showHideTaskBarEditingElements(l,this.editElement)},y.prototype.showHideTaskBarEditingElements=function(e,t,i){t=t||this.editElement;var a,n,r,s,o=!!this.parent.taskFields.progress,l=!0;this.parent.readOnly||(a=e?this.parent.ganttChartModule.getRecordByTaskBar(e):t?this.parent.ganttChartModule.getRecordByTaskBar(t):null,this.parent.enableMultiTaskbar&&e&&(r=this.parent.getParentTask(a.parentItem),ne.isNullOrUndefined(r)||r.expanded||(l=!1,a&&a.ganttProperties.segments&&0<a.ganttProperties.segments.length?ne.addClass([e.parentElement],[xe]):ne.addClass([e],[xe]))),e?(e.querySelector("."+Ie)?(ne.addClass([e.querySelector("."+Ie)],[Ye]),ne.addClass([e.querySelector("."+Ee)],[Ke]),o&&(n=(a&&a.ganttProperties.segments&&0<a.ganttProperties.segments.length?e.parentElement:e).querySelector("."+Fe),ne.isNullOrUndefined(n)||(ne.addClass([n],[Qe]),n.style.top="3px"))):this.parent.isAdaptive&&o&&this.parent.ganttChartModule.getRecordByTaskBar(e).hasChildRecords&&ne.addClass([e],[mt]),ne.addClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+tt),[st]),!ne.isNullOrUndefined(this.parent.taskFields.dependency)&&(e.querySelector("."+ot)||e.parentElement.querySelector("."+ot))&&l&&(s=ne.isNullOrUndefined(e.querySelector("."+ot))?e.parentElement:e,ne.isNullOrUndefined(s.querySelector("."+ot))||ne.addClass([s.querySelector("."+ot)],[dt]),ne.isNullOrUndefined(s.querySelector("."+lt))||ne.addClass([s.querySelector("."+lt)],[ht]))):i||ne.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+tt),[st]),t&&e!==t&&(t.querySelector("."+Ie)&&(ne.removeClass([t.querySelector("."+Ie)],[Ye]),ne.removeClass([t.querySelector("."+Ee)],[Ke]),n=a&&a.ganttProperties.segments&&0<a.ganttProperties.segments.length?t.parentElement:t)&&n.querySelector("."+Fe)&&ne.removeClass([n.querySelector("."+Fe)],[Qe]),ne.isNullOrUndefined(this.parent.taskFields.dependency)||!t.querySelector("."+ot)&&!t.parentElement.querySelector("."+ot)?this.parent.isAdaptive&&(r=this.parent.ganttChartModule.getRecordByTaskBar(t))&&r.hasChildRecords&&ne.removeClass([t],[mt]):(o=(s=ne.isNullOrUndefined(t.querySelector("."+ot))?t.parentElement:t).querySelector("."+ot),l=s.querySelector("."+lt),o&&ne.removeClass([o],[dt]),l&&ne.removeClass([l],[ht])),this.editElement=null))},y.prototype.getTaskBarAction=function(e){var e=this.getElementByPosition(e),t=this.taskBarEditRecord,i="";return e.classList.contains(Ie)?i="LeftResizing":e.classList.contains(Ee)?i="RightResizing":(e.classList.contains(Fe)||ne.closest(e,"."+Fe))&&this.parent.taskFields.progress?i="ProgressResizing":e.classList.contains(ot)?i="ConnectorPointLeftDrag":e.classList.contains(lt)?i="ConnectorPointRightDrag":e.classList.contains(qe)?i="ParentResizing":e.classList.contains(He)||e.classList.contains(je)||e.classList.contains(ze)?i="ManualParentDrag":t&&(i=t.hasChildRecords?t[this.parent.taskFields.manual]?"":"ParentDrag":t.ganttProperties.isMilestone?"MilestoneDrag":"ChildDrag"),i},y.prototype.updateMouseDownProperties=function(e){var e=this.getCoordinate(e),t=this.parent.element.closest('[style*="zoom"]');t&&(t=parseFloat(getComputedStyle(t).zoom),e.pageX=e.pageX/t,e.pageY=e.pageY/t),(e.pageX||e.pageY)&&(t=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),this.parent.enableRtl?this.mouseDownX=Math.abs(e.pageX-(t.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseDownX=e.pageX-t.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseDownX,this.mouseDownY=this.dragMoveY=e.pageY-t.top+this.parent.ganttChartModule.scrollObject.previousScroll.top),"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||(this.fromPredecessorText="ConnectorPointLeftDrag"===this.taskBarEditAction?"start":"finish",this.parent.connectorLineModule.tooltipTable.innerHTML="",this.parent.connectorLineModule.tooltipTable.appendChild(this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.taskBarEditRecord.ganttProperties.taskName,this.fromPredecessorText,"","")))},y.prototype.isMouseDragCheck=function(){var e;!this.isMouseDragged&&this.taskBarEditAction&&(this.mouseDownX!==this.mouseMoveX&&(this.mouseDownX+3<this.mouseMoveX||this.mouseDownX-3>this.mouseMoveX)||this.mouseDownY!==this.mouseMoveY&&(this.mouseDownY+3<this.mouseMoveY||this.mouseDownY-3>this.mouseMoveY))&&(this.isMouseDragged=!0,this.parent.initiateEditAction(!0),e=this.taskBarEditRecord.ganttProperties,this.previousItem=this.parent.timelineModule.extendFunction(e,this.previousItemProperty),"ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction||"ResourceView"===this.parent.viewType&&"ParentDrag"===this.taskBarEditAction||this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),this.taskBarEditElement.setAttribute("aria-grabbed","true"))},y.prototype.removeFirstBorder=function(e){var t="bottomSegment"===this.parent.rowDragAndDropModule.dropPosition;0<this.parent.element.getElementsByClassName("e-firstrow-border").length&&e&&(e.getAttribute("aria-rowindex")-1!=0||t)&&this.parent.element.getElementsByClassName("e-firstrow-border")[0].remove()},y.prototype.removeLastBorder=function(e){var t=e&&(e.classList.contains("e-emptyrow")||e.classList.contains("e-columnheader")||e.classList.contains("e-detailrow")),t=this.parent.enableVirtualization?e&&!t&&this.parent.treeGrid.getRows()[this.parent.treeGrid.getCurrentViewRecords().length-1].getAttribute("data-uid")!==e.getAttribute("data-uid"):e&&!t&&this.parent.treeGrid.getRowByIndex(this.parent.treeGrid.getCurrentViewRecords().length-1).getAttribute("data-uid")!==e.getAttribute("data-uid"),i=t||"topSegment"===this.parent.rowDragAndDropModule.dropPosition;0<this.parent.element.getElementsByClassName("e-lastrow-border").length&&e&&(t||i)&&this.parent.element.getElementsByClassName("e-lastrow-border")[0].remove()},y.prototype.removetopOrBottomBorder=function(){var e=[].slice.call(this.parent.element.querySelectorAll(".e-dropbottom, .e-droptop"));e.length&&(this.addRemoveClasses(e,!1,"e-dropbottom"),this.addRemoveClasses(e,!1,"e-droptop"))},y.prototype.topOrBottomBorder=function(t){var e;(e=(this.parent.enableVirtualization?(e=this.parent.treeGrid.getRows().filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1==parseInt(t.getAttribute("aria-rowindex"),10)-1})[0],e=this.parent.treeGrid.getRows().indexOf(e),this.parent.getRowByIndex(e)):this.parent.getRowByIndex(parseInt(t.getAttribute("aria-rowindex"),10)-1)).children)&&("above"===this.parent.rowDragAndDropModule.dropPosition&&(this.addRemoveClasses(e,!0,"e-droptop"),0<this.parent.element.getElementsByClassName("e-lastrow-dragborder").length)&&this.parent.element.getElementsByClassName("e-lastrow-dragborder")[0].remove(),"below"===this.parent.rowDragAndDropModule.dropPosition)&&this.addRemoveClasses(e,!0,"e-dropbottom")},y.prototype.removeChildBorder=function(){var e=[].slice.call(this.parent.element.querySelectorAll(".e-childborder"));0<e.length&&this.addRemoveClasses(e,!1,"e-childborder")},y.prototype.addRemoveClasses=function(e,t,i){for(var a=0,n=e.length;a<n;a++)t?e[parseInt(a.toString(),10)].classList.add(i):e[parseInt(a.toString(),10)].classList.remove(i)},y.prototype.addErrorElem=function(){var e,t=document.getElementsByClassName("e-clone-taskbar")[0];document.querySelectorAll(".e-errorelem").length||(e=document.createElement("div"),ne.classList(e,["e-errorcontainer"],[]),ne.classList(e,["e-icons","e-errorelem"],[]),this.taskBarEditRecord.ganttProperties.segments&&0<this.taskBarEditRecord.ganttProperties.segments.length&&(e.style.paddingTop=this.parent.taskbarHeight+"px"),t.appendChild(e))},y.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},y.prototype.ensurePosition=function(e,t){var i=this;e.filter(function(e){e.hasChildRecords&&!ne.isNullOrUndefined(e.childRecords)&&(-1===e.childRecords.indexOf(t)?i.ensurePosition(e.childRecords,t):(i.parent.rowDragAndDropModule.dropPosition="Invalid",i.addErrorElem()))})},y.prototype.mouseMoveAction=function(i){var a=this;if(this.parent.isAdaptive){if(!this.canDrag)return;this.multipleSelectionEnabled()}var e=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),t=this.getCoordinate(i),t=(this.parent.enableRtl?this.mouseMoveX=Math.abs(t.pageX-(e.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=t.pageX-e.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.mouseMoveY=t.pageY-e.top+this.parent.ganttChartModule.scrollObject.previousScroll.top,this.dragMouseLeave=!1);if("ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction&&"ManualParentDrag"!==this.taskBarEditAction&&"MilestoneDrag"!==this.taskBarEditAction||(e=void 0,e=this.parent.enableVirtualization?(s=this.parent.currentViewData.indexOf(this.taskBarEditRecord),this.parent.getRowByIndex(s)):this.parent.getRowByIndex(this.taskBarEditRecord.index),e={cancel:t,cloneElement:this.taskbarElement,data:this.taskBarEditRecord,target:i.target,rows:e},this.parent.trigger("rowDrag",e),t=e.cancel),t||this.isMouseDragCheck(),this.isMouseDragged&&this.taskBarEditAction){if(i.preventDefault(),ne.isNullOrUndefined(this.taskbarElement)||ne.isNullOrUndefined(this.editElement)||"ConnectorPointRightDrag"===this.taskBarEditAction||"ConnectorPointLeftDrag"===this.taskBarEditAction||"ResourceView"===this.parent.viewType&&this.currentData.hasChildRecords||(h=this.editElement.parentElement,this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?h.style.setProperty("position","relative"):h.style.setProperty("position","absolute"),("ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||ne.isNullOrUndefined(this.currentIndex)||ne.isNullOrUndefined(this.currentIndex)||0!==Number(this.currentIndex)?this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?this.parent.chartPane.getElementsByClassName("e-gantt-chart")[0]:h:(this.taskbarElement.childNodes[0].childNodes[0].style.setProperty("top",h.parentElement.offsetTop+"px"),this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction?this.parent.chartPane.getElementsByClassName("e-gantt-chart")[0]:h.parentElement)).appendChild(this.taskbarElement),"ProgressResizing"!==this.taskBarEditAction&&(this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-scroll-container"):this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-rows-container"))[0].appendChild(this.taskbarResizer)),this.parent.allowTaskbarDragAndDrop&&("ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction)){var n,r,s,e=this.parent.getOffsetRect(this.taskBarEditElement),t=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?12:0,t=3+this.parent.chartRowsModule.connectorPointWidth+t,o=void 0,o=this.parent.enableRtl?Math.abs(e.left+t+1):Math.abs(e.left-t-1),e=(this.isClonedElement||this.parent.enableRtl||(o-=this.parent.ganttChartModule.scrollElement.scrollLeft,this.isClonedElement=!0),0),t=this.parent.rowDragAndDropModule.dropPosition=void 0,l=void 0,l="touchmove"===i.type||"touchstart"===i.type||"touchend"===i.type?i.changedTouches[0].pageY:i.y,o=(this.parent.enableRtl?(t=document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth,l)).classList.contains("e-taskbar-resize-div")&&(t=document.elementFromPoint(this.parent.ganttChartModule.chartBodyContainer.offsetWidth-t.offsetWidth,l)):t=document.elementFromPoint(o,l),void 0);if(this.parent.enableVirtualization)this.draggedTreeGridRowElement||(o=(h=this.editElement.parentElement).parentElement,this.draggedTreeGridRowElement=o,this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight);else if(o=this.parent.treeGrid.getRows()[this.parent.flatData.indexOf(this.taskBarEditRecord)],this.draggedTreeGridRowElement=o,this.parent.enableMultiTaskbar)if(this.taskBarEditRecord.parentItem&&!ne.isNullOrUndefined(this.parent.getRowByID(this.taskBarEditRecord.parentItem.taskId))){if(this.draggedTreeGridRowHeight=this.parent.getRowByID(this.taskBarEditRecord.parentItem.taskId).offsetHeight,"ProjectView"===this.parent.viewType&&0===this.draggedTreeGridRowHeight)for(var d=this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);d.parentItem;)d=this.parent.getRecordByID(d.parentItem.taskId),this.draggedTreeGridRowHeight=this.parent.getRowByID(d.TaskID).offsetHeight}else{var h=this.editElement.parentElement;this.draggedTreeGridRowElement=h.parentElement,this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight}else this.draggedTreeGridRowHeight=this.draggedTreeGridRowElement.offsetHeight;(n=t?ne.closest(t,"tr."+Oe):n)&&(l=void 0,l=this.parent.enableVirtualization?this.parent.treeGrid.getRows().filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1==parseInt(n.getAttribute("aria-rowindex"),10)-1})[0]:this.parent.treeGrid.getRows()[parseInt(n.getAttribute("aria-rowindex"),10)-1],this.removeFirstBorder(l),this.removeLastBorder(l),(ne.isNullOrUndefined(l)||l.getAttribute("data-uid")!==this.draggedTreeGridRowElement.getAttribute("data-uid"))&&S(t,"e-chart-rows-container")||(this.parent.rowDragAndDropModule.dropPosition="Invalid",this.addErrorElem()),o=0,t=(h=this.parent).toolbarModule?this.parent.toolbarModule.element.offsetHeight:0,r=this.parent.getOffsetRect(h.element),r=h.treeGrid.getHeaderContent().offsetHeight+r.top+t,t=h.treeGrid.getContent().firstElementChild.scrollTop,ne.isNullOrUndefined(l)||(e=l.offsetTop-t),h=((o=this.parent.enableVirtualization?this.parent.getOffsetRect(l).top:e+r)+this.draggedTreeGridRowHeight-o)/3,r=(e=(t=o+h)+h)+h,h=t<(o="mousemove"===i.type?i.pageY:ne.isNullOrUndefined(i.changedTouches)?null:i.changedTouches[0].pageY)&&o<=e,e=e<o&&o<=r,(r=o<=t)||h||e)&&(o=void 0,o=this.parent.enableVirtualization?(s=this.parent.treeGrid.getRows().indexOf(l),this.parent.getRowByIndex(s)):this.parent.getRowByIndex(parseInt(l.getAttribute("aria-rowindex"),10)-1),t=ne.getValue("rowIndex",o),s=this.parent.currentViewData[t],t=!0,"ResourceView"!==this.parent.viewType||this.taskBarEditRecord.hasChildRecords||s.hasChildRecords||ne.isNullOrUndefined(s.parentItem)||this.taskBarEditRecord.parentItem.taskId!==s.parentItem.taskId||(t=!1),s&&this.ensurePosition([this.taskBarEditRecord],s),t)&&(r&&"Invalid"!==this.parent.rowDragAndDropModule.dropPosition&&(this.parent.rowDragAndDropModule.dropPosition="above",this.removeChildBorder(),this.removeErrorElem(),this.removetopOrBottomBorder(),this.topOrBottomBorder(o)),h&&"Invalid"!==this.parent.rowDragAndDropModule.dropPosition&&(this.parent.rowDragAndDropModule.dropPosition="child",this.removetopOrBottomBorder(),this.addRemoveClasses(o.children,!0,"e-childborder")),e)&&"Invalid"!==this.parent.rowDragAndDropModule.dropPosition&&(this.parent.rowDragAndDropModule.dropPosition="below",this.removetopOrBottomBorder(),this.removeErrorElem(),this.removeChildBorder(),this.removeFirstBorder(l),this.topOrBottomBorder(l))}var p={cancel:!1,requestType:"taskbarediting",taskBarEditAction:this.taskBarEditAction,data:this.taskBarEditRecord};-1!==this.segmentIndex&&(p.requestType="mergeSegment"),this.parent.trigger("actionBegin",p,function(e){var t;"ConnectorPointRightDrag"!==p.taskBarEditAction&&"ConnectorPointLeftDrag"!==p.taskBarEditAction&&"LeftResizing"!==p.taskBarEditAction&&"RightResizing"!==p.taskBarEditAction&&"ProgressResizing"!==p.taskBarEditAction&&"ChildDrag"!==p.taskBarEditAction&&"ParentDrag"!==p.taskBarEditAction&&"MilestoneDrag"!==p.taskBarEditAction&&"ManualParentDrag"!==p.taskBarEditAction&&"ParentResizing"!==p.taskBarEditAction||(a.parent.showIndicator=!1,a.parent.undoRedoModule&&a.parent.isUndoRedoItemPresent("Edit")&&(a.parent.undoRedoModule.redoEnabled&&a.parent.undoRedoModule.disableRedo(),t={},0===a.parent.undoRedoModule.getUndoCollection.length||a.parent.editModule.createArray)&&(a.isDragged=!0,t.modifiedRecords=[],t.action=p.taskBarEditAction,a.parent.undoRedoModule.createUndoCollection(),a.parent.undoRedoModule.getUndoCollection[a.parent.undoRedoModule.getUndoCollection.length-1]=t,a.parent.editModule.createArray=!1,a.parent.undoRedoModule.changedRecords=[])),!1===e.cancel?(a.parent.showIndicator&&a.parent.showLoadingIndicator(),a.taskBarEditingAction(i,!1)):a.editTooltip.updateTooltip(a.segmentIndex)})}else this.parent.isAdaptive||this.taskBarEditAction||this.updateTaskBarEditElement(i)},y.prototype.taskBarEditingAction=function(e,t){var a=this,n={},i=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement);if(null!==this.taskBarEditRecord&&(n.editingFields=this.taskBarEditRecord.ganttProperties,n.data=this.taskBarEditRecord,"ResourceView"!==this.parent.viewType||0!==n.data.level)){n.recordIndex=i,n.taskBarEditAction=this.taskBarEditAction,n.roundOffDuration=this.roundOffDuration,n.cancel=!1,n.previousData=this.previousItem,n.segmentIndex=this.segmentIndex,this.roundOffDuration=n.roundOffDuration,this.targetElement=n.target=this.cloneTaskbarElement,this.updateMouseMoveProperties(e),this.oldData||(this.oldData=ne.extend([],[],[this.taskBarEditRecord],!0)[0]);var r=-1!==this.segmentIndex?this.segmentIndex:null;if("ProgressResizing"===this.taskBarEditAction){if(this.mainElement=S(this.taskBarEditElement,P),this.taskBarEditRecord.ganttProperties.segments&&0<this.taskBarEditRecord.ganttProperties.segments.length)for(var r=-1,s=0;s<this.taskBarEditRecord.ganttProperties.segments.length;s++){var o=document.getElementsByClassName("e-child-progress-resizer e-progress-resize-gripper")[0].style,o=this.parent.enableRtl?parseInt(o.right,10)-8:parseInt(o.left,10)+8;o<this.taskBarEditRecord.ganttProperties.segments[s].width&&0===s&&(r=s),this.taskBarEditRecord.ganttProperties.segments[s+1]&&o<this.taskBarEditRecord.ganttProperties.segments[s+1].width+this.taskBarEditRecord.ganttProperties.segments[s+1].left&&o>this.taskBarEditRecord.ganttProperties.segments[s+1].left&&(r=s+1)}this.performProgressResize(e,r)}else"LeftResizing"===this.taskBarEditAction?this.enableLeftResizing(e):"RightResizing"===this.taskBarEditAction||"ParentResizing"===this.taskBarEditAction?this.enableRightResizing(e):"ParentDrag"===this.taskBarEditAction||"ChildDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction?this.enableDragging(e):"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||(this.updateConnectorLineSecondProperties(e),this.triggerDependencyEvent(e),this.drawFalseLine());if(this.parent.allowTaskbarDragAndDrop&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction){var i=this.parent.getOffsetRect(this.parent.chartPane),l=this.getCoordinate(e),d=l.pageY,l=l.pageX,l={left:Math.abs(l-i.left),top:d-i.top};if("ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar){var h=this.parent.getRecordByID(this.taskBarEditRecord.parentItem.taskId);if(!this.parent.allowTaskbarOverlap&&this.taskBarEditRecord.parentItem&&!h.expanded){var p=0;if(parseInt(this.editElement.style.marginTop,10)>this.parent.rowHeight){for(s=0;s<h.childRecords.length&&h.childRecords[s].ganttProperties.taskId!==this.taskBarEditRecord.ganttProperties.taskId;s++)p+=this.parent.rowHeight;l.top=l.top-p}}}this.topValue=l.top;d=void 0,d=("touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?e.changedTouches[0]:e).pageX;this.parent.enableRtl?this.leftValue=l.left-Math.abs(d-this.parent.getOffsetRect(this.taskBarEditElement).left)-(0!==this.previousLeftValue?d-this.previousLeftValue:0):this.leftValue=l.left-(d-this.parent.getOffsetRect(this.taskBarEditElement).left)+(0!==this.previousLeftValue?d-this.previousLeftValue:0),0===this.previousLeftValue&&(this.parent.enableRtl?(this.leftValue=this.leftValue-this.parent.ganttChartModule.scrollObject.previousScroll.left,0===this.parent.ganttChartModule.scrollObject.previousScroll.left&&(this.leftValue=this.leftValue-60)):this.leftValue=this.leftValue-this.parent.ganttChartModule.scrollObject.previousScroll.left),this.previousLeftValue=d}else this.leftValue=this.taskBarEditRecord.ganttProperties.left;this.currentSegmentIndex=r,this.setItemPosition(),this.updateEditedItem(),this.tooltipValue=("touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?e.changedTouches[0]:e).pageX,this.taskBarEditRecord.ganttProperties.segments&&-1===r||this.editTooltip.updateTooltip(r),t&&this.taskBarEditedAction(e),this.parent.trigger("taskbarEditing",n,function(e){var t,i;!0!==e.cancel&&2!==e.data.ganttProperties.constraintType&&3!==e.data.ganttProperties.constraintType&&-1!==["ChildDrag","ParentDrag","MilestoneDrag","LeftResizing","RightResizing"].indexOf(e.taskBarEditAction)&&(n.data.ganttProperties.constraintType=4,n.data.ganttProperties.constraintDate=n.data.ganttProperties.startDate),("ChildDrag"!==e.taskBarEditAction&&"ParentDrag"!==e.taskBarEditAction&&"MilestoneDrag"!==e.taskBarEditAction||2!==e.data.ganttProperties.constraintType&&3!==e.data.ganttProperties.constraintType)&&("LeftResizing"!==e.taskBarEditAction||2!==e.data.ganttProperties.constraintType)&&("RightResizing"!==e.taskBarEditAction||3!==e.data.ganttProperties.constraintType)||(t=a.parent.predecessorModule.filterPredecessorsByTarget(n.data.ganttProperties.predecessor,n.data,a.parent.viewType),i=(!(i=e.data.ganttProperties.predecessor&&0<e.data.ganttProperties.predecessor.length)||0!==t.length)&&i)||(e.cancel=!0),e.cancel&&null!==a.taskBarEditRecord&&(a.tapPointOnFocus=!1,ne.merge(a.taskBarEditRecord.ganttProperties,e.previousData))})}},y.prototype.updateMouseMoveProperties=function(e){var t=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),e=this.getCoordinate(e),i=this.parent.element.closest('[style*="zoom"]'),i=(i&&(i=parseFloat(getComputedStyle(i).zoom),e.pageX=e.pageX/i,e.pageY=e.pageY/i),(e.pageX||e.pageY)&&(this.parent.enableRtl?this.mouseMoveX=Math.abs(e.pageX-(t.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=e.pageX-t.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseMoveX,this.mouseMoveY=e.pageY-t.top+this.parent.ganttChartModule.scrollObject.previousScroll.top),"ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction);(3<this.taskBarEditRecord.ganttProperties.width||this.taskBarEditRecord.ganttProperties.isMilestone)&&("ProgressResizing"!==this.taskBarEditAction||0!==this.taskBarEditRecord.ganttProperties.progress&&100!==this.taskBarEditRecord.ganttProperties.progress)||i?(e=0,e=this.parent.enableRtl?Math.abs(Math.abs(this.mouseMoveX)-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left)+t.left):this.mouseMoveX-this.parent.ganttChartModule.scrollObject.previousScroll.left+t.left,i=this.mouseMoveY-this.parent.ganttChartModule.scrollObject.previousScroll.top+t.top,e+20>t.left+this.parent.ganttChartModule.chartBodyContainer.offsetWidth?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("right")):e+40>t.left+this.parent.ganttChartModule.chartBodyContainer.offsetWidth&&this.parent.enableRtl&&0===this.parent.ganttChartModule.scrollObject.previousScroll.left?(this.parent.ganttChartModule.scrollObject.previousScroll.left=-1,this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("right")):e-20<t.left?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("left")):i+80>t.top+this.parent.ganttChartModule.chartBodyContainer.offsetHeight?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("bottom")):i-20<t.top?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("top")):this.stopScrollTimer()):this.stopScrollTimer()},y.prototype.startScrollTimer=function(t){var i=this,a=(this.stopScrollTimer(),0);this.scrollTimer=window.setInterval(function(){var e;-1===Math.sign(i.timerCount)&&(a=-1,i.timerCount=Math.abs(i.timerCount)),"right"===t?(e=i.parent.enableTimelineVirtualization?i.parent.timelineModule.wholeTimelineWidth:i.parent.timelineModule.totalTimelineWidth,i.timerCount=i.timerCount+1>=e?e:i.timerCount+1):i.timerCount="bottom"===t?i.timerCount+1:i.timerCount-1<0?0:i.timerCount-1,"bottom"===t||"top"===t?i.parent.ganttChartModule.scrollObject.setScrollTop(i.timerCount):i.parent.ganttChartModule.scrollObject.setScrollLeft(i.timerCount,a),"ConnectorPointLeftDrag"!==i.taskBarEditAction&&"ConnectorPointRightDrag"!==i.taskBarEditAction||i.drawFalseLine()},0)},y.prototype.stopScrollTimer=function(){window.clearInterval(this.scrollTimer),this.scrollTimer=null},y.prototype.enableDragging=function(e){var t,i,a,n,r,s=this.taskBarEditRecord.ganttProperties,o=this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:this.parent.timelineModule.totalTimelineWidth,l=0;this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&!this.taskBarEditElement.classList.contains("e-segment-first")?(i=(t=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ka({},e)}))[this.segmentIndex],this.mouseDownX>this.mouseMoveX?(l=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,i.left=i.left-l):(l=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,i.left=i.left+l),a=t[this.segmentIndex-1],n=t[this.segmentIndex+1],r=void 0,r=this.taskBarEditElement.classList.contains("e-segment-inprogress")?i.left<a.left+a.width?a.left+a.width:i.width+i.left>n.left?n.left-i.width:i.left:i.left<a.left+a.width?a.left+a.width:s.left+i.width+i.left>=o?o-i.width:i.left,i.left=r,this.parent.setRecordValue("segments",t,s,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")):(this.mouseDownX>this.mouseMoveX?0<(l=this.mouseDownX-this.mouseMoveX)&&this.parent.setRecordValue("left",this.previousItem.left-l,s,!0):(l=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("left",this.previousItem.left+l,s,!0)),r=s.left<0?0:s.left+s.width>=o?o-s.width:s.left,this.parent.setRecordValue("left",r,s,!0))},y.prototype.validateProgressWidth=function(e,t,i){if(-1!==this.currentSegmentIndex&&e.segments){var a=this.currentSegmentIndex>=this.segmentIndex?0:0!==this.currentSegmentIndex?this.currentSegmentIndex:-1,n=this.currentSegmentIndex>=this.segmentIndex?this.currentSegmentIndex:this.segmentIndex;if(-1!==a)for(var r=a;r<n;r++)t-=e.segments[r+1].left-(e.segments[r].left+e.segments[r].width)}return e.segments&&0<e.segments.length&&(i=this.splitTasksDuration(e.segments)*this.parent.perDayWidth,i=e.segments.reduce(function(e,t){return e+t.width},0)),{progressWidth:t=i<t?i:t,totalTaskWidth:i}},y.prototype.performProgressResize=function(e,t){var i=this.taskBarEditRecord.ganttProperties,a=0,n=i.progressWidth,a=(this.mouseDownX>this.mouseMoveX?this.mouseMoveX>i.left&&this.mouseMoveX<i.left+i.width&&0<i.left?(a=this.mouseMoveX-i.left,this.parent.setRecordValue("progressWidth",a,i,!0)):this.mouseMoveX>=i.left+i.width?this.parent.setRecordValue("progressWidth",i.width,i,!0):this.parent.setRecordValue("progressWidth",0,i,!0):this.mouseMoveX>i.left&&this.mouseMoveX<i.left+i.width?(a=this.mouseMoveX-i.left,this.parent.setRecordValue("progressWidth",a,i,!0)):this.mouseMoveX<=i.left?this.parent.setRecordValue("progressWidth",0,i,!0):this.parent.setRecordValue("progressWidth",i.width,i,!0),i.progressWidth>i.width?i.width:i.progressWidth,i.progressWidth<0?0:i.progressWidth),t=(-1===t&&t?this.parent.setRecordValue("progressWidth",n,i,!0):this.parent.setRecordValue("progressWidth",a,i,!0),this.progressValue=a,i.width-i.progressWidth);this.progressBorderRadius=t<=4?4-t:0},y.prototype.enableLeftResizing=function(e){var t=this.taskBarEditRecord.ganttProperties,i=0;this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&1<t.segments.length?this.enableSplitTaskLeftResize(t):(this.mouseDownX>this.mouseMoveX?this.mouseMoveX<t.left+t.width?(i=this.mouseDownX-this.mouseMoveX,0<t.left&&(this.parent.setRecordValue("left",this.previousItem.left-i,t,!0),this.parent.setRecordValue("width",this.previousItem.width+i,t,!0))):this.mouseMoveX>t.left+t.width&&(i=this.mouseDownX-this.mouseMoveX,this.parent.setRecordValue("left",this.previousItem.left-i,t,!0),this.parent.setRecordValue("width",3,t,!0)):this.mouseMoveX<t.left+t.width?(i=this.mouseMoveX-this.mouseDownX,t.left<t.left+t.width&&this.previousItem.left+i<=this.previousItem.left+this.previousItem.width&&(this.parent.setRecordValue("left",this.previousItem.left+i,t,!0),this.parent.setRecordValue("width",this.previousItem.width-i,t,!0))):(i=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("left",this.previousItem.left+i,t,!0),this.parent.setRecordValue("width",3,t,!0)),t.segments&&1===t.segments.length&&(t.segments[0].width=t.width),this.updateEditPosition(e,t),this.parent.setRecordValue("left",this.previousItem.left+this.previousItem.width-t.width,t,!0))},y.prototype.enableSplitTaskLeftResize=function(e){var t=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ka({},e)}),i=t[this.segmentIndex],a=0;if(this.mouseDownX>this.mouseMoveX)if(this.mouseMoveX<e.left+i.width+i.left){var n,a=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX;if(this.previousMouseMove=this.mouseMoveX,0<i.left)i.left=i.left-a,i.width=i.width+a,0!==this.segmentIndex&&(n=t[this.segmentIndex-1],e.left+i.left<e.left+n.left+n.width)&&(n=e.left+n.left+n.width-(e.left+i.left),i.width-=n,i.left=i.left+n);else if(i.left<=0&&0===this.segmentIndex){this.parent.setRecordValue("left",e.left-a,e,!0),this.parent.setRecordValue("width",e.width+a,e,!0),i.width=i.width+a;for(var r=1;r<e.segments.length;r++){var s=t[r];s.left=s.left+a}}}else this.mouseMoveX>e.left+i.width+i.left&&(a=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,i.left=i.left-a,i.width=this.parent.perDayWidth);else if(this.mouseMoveX<e.left+i.width+i.left-this.parent.perDayWidth)if(a=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,0===this.segmentIndex&&i.left<=0){this.parent.setRecordValue("left",e.left+a,e,!0),this.parent.setRecordValue("width",e.width-a,e,!0),i.width=i.width-a;for(r=1;r<e.segments.length;r++){var o=t[r];o.left=o.left-a}}else i.left<i.left+i.width&&i.left+a<=i.left+i.width&&(i.left=i.left+a,i.width=i.width-a);else if(this.mouseMoveX<e.left+i.left+i.width&&i.width>this.parent.perDayWidth)if(a=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,a-=i.width-a<this.parent.perDayWidth?this.parent.perDayWidth>i.width?this.parent.perDayWidth-i.width:i.width-this.parent.perDayWidth:0,0===this.segmentIndex){this.parent.setRecordValue("width",e.width-a,e,!0),this.parent.setRecordValue("left",e.left+a,e,!0),i.width=i.width-a;for(r=1;r<e.segments.length;r++){var l=t[r];l.left=l.left-a}}else i.left=i.left+a,i.width=i.width-a;this.parent.setRecordValue("segments",t,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},y.prototype.updateEditPosition=function(e,t){this.updateIsMilestone(t),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.width,t.progress),t,!0)},y.prototype.updateIsMilestone=function(e){e.width<=3?(this.parent.setRecordValue("width",3,e,!0),this.parent.setRecordValue("isMilestone",!0,e,!0),ne.isNullOrUndefined(this.taskBarEditRecord[this.parent.taskFields.milestone])||this.parent.setRecordValue(this.parent.taskFields.milestone,!0,this.taskBarEditRecord,!0)):(this.parent.setRecordValue("width",e.width,e,!0),this.parent.setRecordValue("isMilestone",!1,e,!0),ne.isNullOrUndefined(this.taskBarEditRecord[this.parent.taskFields.milestone])||this.parent.setRecordValue(this.parent.taskFields.milestone,!1,this.taskBarEditRecord,!0))},y.prototype.enableRightResizing=function(e){var t,i,a,n,r=this.taskBarEditRecord.ganttProperties,s=0;this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&1<r.segments.length?(i=(t=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ka({},e)}))[this.segmentIndex],a=void(this.mouseDownX>this.mouseMoveX?this.mouseMoveX>r.left+i.left&&3<this.mouseDownX-this.mouseMoveX?(s=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,i.width=i.width-s):this.mouseMoveX<r.left+i.left&&(a=this.parent.timelineModule.isSingleTier&&("Hour"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit||"Hour"===this.parent.timelineModule.customTimelineSettings.topTier.unit||"Minutes"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit||"Minutes"===this.parent.timelineModule.customTimelineSettings.topTier.unit)||"Hour"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit||"Minutes"===this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.timelineUnitSize:this.parent.perDayWidth,i.width=a):this.mouseMoveX>i.left&&(s=ne.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,i.width=i.width+s)),n=this.segmentIndex!==t.length-1?t[this.segmentIndex+1]:null,ne.isNullOrUndefined(n)||(this.taskBarEditElement.classList.contains("e-segment-last")||(a=i.left+i.width>n.left?n.left-i.left:i.width),i.width=a),this.segmentIndex===r.segments.length-1&&0===this.segmentIndex&&this.parent.setRecordValue("width",i.width,r,!0),this.parent.setRecordValue("segments",t,r,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")):(this.mouseDownX>this.mouseMoveX?this.mouseMoveX>r.left&&3<this.mouseDownX-this.mouseMoveX?(s=this.mouseDownX-this.mouseMoveX,this.parent.setRecordValue("width",this.previousItem.width-s,r,!0)):this.mouseMoveX<r.left&&this.parent.setRecordValue("width",3,r,!0):this.mouseMoveX>r.left&&(s=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("width",this.previousItem.width+s,r,!0)),r.segments&&1===r.segments.length&&(r.segments[0].width=r.width),this.updateEditPosition(e,r))},y.prototype.updateEditedItem=function(){var e,t,i,a=this.taskBarEditRecord.ganttProperties;switch(this.taskBarEditAction){case"ProgressResizing":var n=a.progressWidth,r=a.width,n=this.validateProgressWidth(a,n,r);this.parent.setRecordValue("progress",this.getProgressPercent(n.totalTaskWidth,n.progressWidth),a,!0);break;case"LeftResizing":-1===this.segmentIndex?(t=this.getRoundOffStartLeft(a,this.roundOffDuration),r=this.getDateByLeft(t),ne.isNullOrUndefined(a.endDate)&&(i=this.parent.dateValidationModule.getValidEndDate(a),this.parent.setRecordValue("endDate",i,a,!0)),e=this.parent.dateValidationModule.checkStartDate(r,a,null),this.parent.setRecordValue("startDate",new Date(e.getTime()),a,!0),0===this.parent.dateValidationModule.compareDates(a.startDate,a.endDate)&&ne.isNullOrUndefined(a.isMilestone)&&!1===a.isMilestone&&0===a.duration&&this.parent.setRecordValue("duration",1,a,!0),a.isMilestone&&this.parent.setRecordValue("endDate",new Date(e.getTime()),a,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")):this.updateSplitLeftResize(a);break;case"RightResizing":case"ParentResizing":-1===this.segmentIndex?(t=this.getRoundOffEndLeft(a,this.roundOffDuration),n=this.getDateByLeft(t),ne.isNullOrUndefined(a.startDate)&&(e=this.parent.dateValidationModule.getValidStartDate(a),this.parent.setRecordValue("startDate",e,a,!0)),r=ne.isNullOrUndefined(a.startDate)?e:a.startDate,i=a.isMilestone?r:this.parent.dateValidationModule.checkEndDate(n,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",new Date(i.getTime()),a,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")):this.updateSplitRightResizing(a);break;case"ParentDrag":case"ChildDrag":case"MilestoneDrag":case"ManualParentDrag":-1===this.segmentIndex||0===this.segmentIndex||-1!==this.segmentIndex&&this.parent.allowTaskbarDragAndDrop?this.updateChildDrag(a):this.setSplitTaskDrag(a)}ne.isNullOrUndefined(this.taskBarEditRecord.ganttProperties.segments)||this.parent.chartRowsModule.updateSegment(this.taskBarEditRecord.ganttProperties.segments,this.taskBarEditRecord.ganttProperties.taskId)},y.prototype.extractEndDates=function(e){var a=this,n=new Date(0);return e.forEach(function(e){var t=a.parent.getRecordByID(e.from);if(t&&t.ganttProperties){var i=null;switch(e.type){case"FS":case"FF":i=t.ganttProperties.endDate||t.ganttProperties.startDate;break;case"SS":case"SF":i=t.ganttProperties.startDate||t.ganttProperties.endDate}i&&i.getTime()>n.getTime()&&(n=i)}}),{maxEndDate:n}},y.prototype.isValidDependency=function(e){var t,i;return!ne.isNullOrUndefined(e.ganttProperties)&&!ne.isNullOrUndefined(e.ganttProperties.predecessor)&&(t=e.ganttProperties.predecessor,i=this.extractEndDates(t).maxEndDate,i=this.parent.predecessorModule.getPredecessorDate(e,t,null))?{isValid:(ne.isNullOrUndefined(e.ganttProperties.startDate)?e.ganttProperties.endDate:e.ganttProperties.startDate).getTime()>=i.getTime(),maxDate:i}:{isValid:!0}},y.prototype.updateChildDrag=function(e){var t,i=this.getRoundOffStartLeft(e,this.roundOffDuration),i=this.getDateByLeft(i,e.isMilestone,e);0===this.segmentIndex?(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i,e,null),e,!0),e.segments[0].startDate=i,e.segments[0].endDate=this.parent.dataOperation.getEndDate(e.segments[0].startDate,e.segments[0].duration,e.durationUnit,e,!1),this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments"),this.parent.chartRowsModule.incrementSegments(e.segments,0,this.taskBarEditRecord),this.parent.setRecordValue("endDate",e.segments[e.segments.length-1].endDate,e,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,e.segments,this.taskBarEditRecord,!0)):!ne.isNullOrUndefined(e.endDate)&&ne.isNullOrUndefined(e.startDate)?(t=this.parent.dateValidationModule.checkStartDate(i,e,null),t=this.parent.dateValidationModule.checkEndDate(t,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",t,e,!0)):(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i,e,null),e,!0),ne.isNullOrUndefined(e.duration)||this.parent.dateValidationModule.calculateEndDate(this.taskBarEditRecord))},y.prototype.updateSplitLeftResize=function(e){var t=e.segments[this.segmentIndex],i=0===this.segmentIndex?this.getRoundOffStartLeft(e,this.roundOffDuration):this.getRoundOffStartLeft(t,this.roundOffDuration),i=this.getDateByLeft(i),i=this.parent.dataOperation.checkStartDate(i,e,!1),a=this.parent.dataOperation.getDuration(i,t.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);t.startDate=new Date(i.getTime()),t.duration=a,this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),0===this.segmentIndex&&this.parent.setRecordValue("startDate",t.startDate,e,!0),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration"),ne.isNullOrUndefined(e.segments[this.segmentIndex-1])||(i=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex-1].endDate,e.segments[this.segmentIndex].startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone),t.offsetDuration=i),this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},y.prototype.updateSplitRightResizing=function(e){var t=e.segments[this.segmentIndex],i=this.getRoundOffEndLeft(e,this.roundOffDuration),i=this.getDateByLeft(i),i=this.parent.dataOperation.checkEndDate(i,e,!1),a=this.parent.dataOperation.getDuration(t.startDate,i,e.durationUnit,e.isAutoSchedule,e.isMilestone);t.endDate=new Date(i.getTime()),t.duration=a,ne.isNullOrUndefined(e.segments[this.segmentIndex+1])||(i=e.segments[this.segmentIndex+1],a=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,i.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone),t.offsetDuration=a),this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments"),this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),this.parent.setRecordValue("endDate",e.segments[e.segments.length-1].endDate,e,!0),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")},y.prototype.sumOfDuration=function(e){for(var t=0,i=0;i<e.length;i++)t+=e[i].duration;return t},y.prototype.setSplitTaskDrag=function(e){var t,i=e.segments[this.segmentIndex],a=this.parent.taskFields,n=this.getRoundOffStartLeft(i,this.roundOffDuration),n=this.getDateByLeft(n),n=this.parent.dateValidationModule.checkStartDate(n,e,null),n=(i.startDate=n,this.parent.dataOperation.getEndDate(i.startDate,i.duration,e.durationUnit,e,!1));e.segments[this.segmentIndex+1]&&n.getTime()>e.segments[this.segmentIndex+1].startDate.getTime()?i.endDate=e.segments[this.segmentIndex+1].startDate:i.endDate=n,i.duration=this.parent.dataOperation.getDuration(i.startDate,i.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone),this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),this.parent.setRecordValue("endDate",e.segments[e.segments.length-1].endDate,e,!0),ne.isNullOrUndefined(a.endDate)||this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"endDate"),ne.isNullOrUndefined(e.segments[this.segmentIndex-1])||(t=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex-1].endDate,e.segments[this.segmentIndex].startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone),1!==i.startDate.getDay()||0!==t||this.parent.includeWeekend||(t=1),i.offsetDuration=t),ne.isNullOrUndefined(e.segments[this.segmentIndex+1])||(n=e.segments[this.segmentIndex+1],t=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,n.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone),1!==n.startDate.getDay()||0!==t||this.parent.includeWeekend||(t=1),n.offsetDuration=t),this.parent.setRecordValue("segments",e.segments,e,!0),this.taskBarEditRecord[a.segments][this.segmentIndex]=this.parent.dataOperation.setSegmentTaskData(i,this.taskBarEditRecord[a.segments][this.segmentIndex]),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},y.prototype.getRoundOffEndLeft=function(e,t){var i="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,a=e.width+e.left,e=(-1!==this.segmentIndex&&1<e.segments.length&&(n=e.segments[this.segmentIndex],a=a-e.width+n.width+n.left),1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Day")/864e5)),n=this.parent.perDayWidth-this.parent.perDayWidth/e,r=n/this.parent.perDayWidth;return(t=void 0===t?!1:t)?"Hour"===i?(t=this.parent.perDayWidth/24,e=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Hour")/36e5),0!==(n=this.parent.perDayWidth/24-this.parent.perDayWidth/24/e)&&(a=a-n+t)):"Minutes"===i?(t=this.parent.perDayWidth/1440,e=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(a),1,"Minutes")/6e4),0!==(n=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/e)&&(a=a-n+t)):0!==n&&(a=a-n+this.parent.perDayWidth):"Hour"!==i&&"Minutes"!==i&&(.5<r?a=a-n+this.parent.perDayWidth:r<.5&&(a=a-n+this.parent.perDayWidth/2)),a},y.prototype.getRoundOffStartLeft=function(e,t){ne.isNullOrUndefined(e);var i=e.left,a=(-1!==this.segmentIndex&&ne.isNullOrUndefined(e.segments)&&(i=e.left+this.taskBarEditRecord.ganttProperties.left),"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier),e=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(i,ne.isNullOrUndefined(e)?e.isMilestone:null,e),1,"Day")/864e5),n=this.parent.perDayWidth-this.parent.perDayWidth/e,r=n/this.parent.perDayWidth;return(t=void 0===t?!1:t)?"Hour"===a?(e=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(i),1,"Hour")/36e5),i-=n=this.parent.perDayWidth/24-this.parent.perDayWidth/24/e):"Minutes"===a?(e=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(i),1,"Minutes")/6e4),i-=n=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/e):i-=n:"Hour"!==a&&"Minutes"!==a&&(r<=.5?i-=n:.5<r&&(i=i-n+this.parent.perDayWidth/2)),i},y.prototype.getDateByLeft=function(e,t,i){var a=new Date(this.parent.timelineModule.timelineStartDate.toString()),n=864e5/this.parent.perDayWidth,r=new Date(a),n=(this.parent.timelineSettings.showWeekend?r.setTime(r.getTime()+e*n):a=r=this.parent.timelineModule.calculateDateExcludingNonWorkingDays(e,a),this.parent.timelineSettings.showWeekend?this.parent.isInDst(r)?a.setTime(a.getTime()+(e-this.parent.perDayWidth/24)*n):a.setTime(a.getTime()+e*n):a=r,t&&!ne.isNullOrUndefined(i.predecessorsName)&&""!==i.predecessorsName&&(e=this.parent.getCurrentDayEndTime(i.isAutoSchedule?i.autoEndDate:i.endDate),this.parent.dateValidationModule.setTime(e,a),a=this.parent.dateValidationModule.checkStartDate(a,i,!0)),"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier);return"Hour"!==n&&"Minutes"!==n&&this.parent.isInDst(new Date(this.parent.timelineModule.timelineStartDate.toString()))&&!this.parent.isInDst(a)&&a.setTime(a.getTime()+36e5),a},y.prototype.setItemPosition=function(){ne.isNullOrUndefined(this.editElement)||(a=this.editElement.parentElement,this.parent.allowTaskbarDragAndDrop&&"ChildDrag"===this.taskBarEditAction?a.style.position=null:this.parent.enableTimelineVirtualization&&this.parent.timelineModule.wholeTimelineWidth>3*this.parent.element.offsetWidth?a.style.setProperty("position","relative"):a.style.setProperty("position","absolute"));var e,t=this.taskBarEditRecord.ganttProperties,i=this.parent.enableRtl?"right":"left",a=ne.isNullOrUndefined(t.segments)?null:t.segments[this.segmentIndex],n="MilestoneDrag"===this.taskBarEditAction||t.isMilestone?this.parent.chartRowsModule.milestoneHeight:t.width,r=this.parent.isAdaptive?n-2:n-10,s=(ne.isNullOrUndefined(a)||(r=this.parent.isAdaptive?a.width-2:a.width-10),this.taskBarEditElement.style.setProperty("opacity",".75"),e=this.parent.allowTaskbarDragAndDrop&&!t.isAutoSchedule&&this.taskBarEditRecord.hasChildRecords||this.taskBarEditElement.classList.contains(P)?this.taskBarEditElement:"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||0!==this.segmentIndex?ne.closest(this.taskBarEditElement,"tr."+Oe).querySelector("."+P):this.taskBarEditElement.parentElement,!(!this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&!this.taskBarEditElement.querySelector(".e-segmented-taskbar"))),o=this.taskBarEditElement.querySelector("."+We),l=this.taskBarEditElement.querySelector("."+Ae),d=(s?S(this.taskBarEditElement,P):this.taskBarEditElement).querySelector("."+Fe),h=this.taskBarEditElement.querySelector("."+Ee),p=this.taskBarEditElement.querySelector("."+_e),u=this.taskBarEditElement.querySelector("."+Ze),c=this.taskBarEditElement.querySelector("."+pt),g=e.querySelector("."+pt),f=this.taskBarEditElement,m=this.taskBarEditElement.querySelector("."+He),y=(this.taskBarEditElement.querySelector("."+qe),this.taskBarEditElement.querySelector(".e-gantt-manualparenttaskbar-left"),this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div"));if(this.parent.allowTaskbarDragAndDrop&&!this.updatePosition&&(this.leftValue=this.leftValue+30,this.updatePosition=!0),"ConnectorPointRightDrag"!==this.taskBarEditAction&&"ConnectorPointLeftDrag"!==this.taskBarEditAction){if("ParentResizing"!==this.taskBarEditAction&&"ManualParentDrag"!==this.taskBarEditAction){if(!s||ne.isNullOrUndefined(t.segments)||"RightResizing"!==this.taskBarEditAction&&0===this.segmentIndex||(ne.isNullOrUndefined(y)||(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction)&&(y.style.width=a.width+"px"),this.taskBarEditElement.style.width=a.width+"px",this.parent.enableRtl?this.taskBarEditElement.style.right=a.left+"px":(this.taskBarEditElement.style.left=a.left+"px",ne.isNullOrUndefined(y)||(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction)&&(y.style.left=a.left+this.editElement.parentElement.offsetLeft+"px"))),e.style.setProperty(i,(this.parent.allowTaskbarDragAndDrop?this.leftValue:t.left)+"px"),e.style.width=n+"px",s&&g&&(g.style.left=(this.parent.isAdaptive?n+10:n+2)+"px"),this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"LeftResizing"!==this.taskBarEditAction&&"RightResizing"!==this.taskBarEditAction&&"ProgressResizing"!==this.taskBarEditAction&&(g=this.parent.taskbarHeight/2,e.style.setProperty("top",this.topValue+g+"px"),e.style.zIndex="4"),"LeftResizing"===this.taskBarEditAction&&0===this.segmentIndex){this.taskBarEditElement.style.setProperty("opacity",".75");for(var D=this.taskBarEditElement.parentElement.getElementsByClassName("e-segmented-taskbar"),k=0;k<t.segments.length;k++){var b=t.segments[k],w=D[k];w.style.width=b.width+"px",1===t.segments.length?(y.style.width=b.width+"px",y.style.setProperty(i,t.left+"px")):(0===k&&(y.style.width=b.width+"px",y.style.setProperty(i,b.left+t.left+"px")),this.parent.enableRtl?w.style.right=b.left+"px":w.style.left=b.left+"px")}}"ChildDrag"===this.taskBarEditAction&&(0===this.segmentIndex||-1!==this.segmentIndex&&this.parent.allowTaskbarDragAndDrop)&&(y.style.width=n+"px",y.style.setProperty(i,t.left+"px"),e.style.setProperty("opacity",".75"))}if(c&&(this.parent.enableRtl?c.style.left=(this.parent.isAdaptive?n+10:n-2)+"px":c.style.left=(this.parent.isAdaptive?n+10:n+2)+"px"),c&&"LeftResizing"===this.taskBarEditAction&&(c.style.left=n-2+"px"),d&&o&&("LeftResizing"===this.taskBarEditAction||"RightResizing"===this.taskBarEditAction||"ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction)&&(d.style.display="none",o.style.display="none"),c&&"ProgressResizing"===this.taskBarEditAction&&(c.style.display="none"),"MilestoneDrag"===this.taskBarEditAction||t.isMilestone)e.style.setProperty(i,(this.parent.allowTaskbarDragAndDrop?this.leftValue:t.left-n/2)+"px"),y.style.setProperty(i,t.left-n/2+"px"),y.style.width=n+"px";else if("ProgressResizing"===this.taskBarEditAction)if(-1===this.segmentIndex)l.style.setProperty(i,t.left+t.progressWidth-10+"px"),ne.isNullOrUndefined(o)||(o.style.width=t.progressWidth+"px",o.style.borderBottomRightRadius=this.progressBorderRadius+"px",o.style.borderTopRightRadius=this.progressBorderRadius+"px",g=this.parent.enableRtl?t.progressWidth+8:t.progressWidth-8,d.style.setProperty(i,g+"px"));else{this.updateSegmentProgress(this.taskBarEditRecord.ganttProperties);for(var T=e.querySelectorAll(".e-gantt-child-progressbar"),v=0;v<T.length;v++)t.segments[v]&&t.segments[v].progressWidth&&this.segmentIndex!==v&&(T[v].style.display="block",T[v].style.width=t.segments[v].progressWidth+"px");o.style.width=t.segments[this.segmentIndex].progressWidth+"px",o.style.borderBottomRightRadius=this.progressBorderRadius+"px",o.style.borderTopRightRadius=this.progressBorderRadius+"px";c=this.parent.enableRtl?this.progressValue+8:this.progressValue-8;d.style.setProperty(i,c+"px")}else"RightResizing"!==this.taskBarEditAction||ne.isNullOrUndefined(l)?"ParentDrag"===this.taskBarEditAction?(y.style.setProperty(i,t.left+"px"),y.style.width=n+"px",y.style.width=t.width+"px",ne.isNullOrUndefined(p)||(p.style.width=n+"px",y.style.width=t.width+"px"),ne.isNullOrUndefined(o)||ne.isNullOrUndefined(u)||(u.style.width=t.progressWidth+"px")):"ParentResizing"===this.taskBarEditAction?(y.style.width=t.width+"px",y.style.setProperty(i,t.left+"px"),f.style.setProperty("width",t.width+"px"),m.style.setProperty("width",t.width+"px"),this.editElement.parentElement.style.setProperty("width",t.width+"px")):"ManualParentDrag"===this.taskBarEditAction?(y.style.width=t.width+"px",y.style.setProperty(i,t.left+"px"),f.style.setProperty(i,t.left-t.autoLeft+"px"),this.parent.allowTaskbarDragAndDrop&&(f.style.setProperty(i,this.leftValue+"px"),f.style.setProperty("top",this.topValue+"px"),f.style.zIndex="4")):(ne.isNullOrUndefined(l)||s||(l.style.width=t.width+"px",l.style.left=t.left+"px",this.taskBarEditElement.style.width=t.width+"px",this.taskBarEditElement.style.left=(this.parent.allowTaskbarDragAndDrop?this.leftValue:t.left)+"px",y.style.setProperty(i,t.left+"px"),y.style.width=t.width+"px"),ne.isNullOrUndefined(o)||(h.style.setProperty(i,r+"px"),o.style.width=t.progressWidth+"px",ne.isNullOrUndefined(d))||d.style.setProperty(i,t.progressWidth-10+"px"),s&&(h.style.setProperty(i,r+"px"),o.style.width=a.width+"px",ne.isNullOrUndefined(d)||d.style.setProperty(i,a.width-10+"px"))):(y.style.width=n+"px",l.style.width=n+"px",ne.isNullOrUndefined(o)||(o.style.width=t.progressWidth+"px",h.style.setProperty(i,r+"px"),ne.isNullOrUndefined(d))||d.style.setProperty(i,t.progressWidth-10+"px"))}!this.parent.allowTaskbarDragAndDrop||"ChildDrag"!==this.taskBarEditAction&&"ParentDrag"!==this.taskBarEditAction&&"ManualParentDrag"!==this.taskBarEditAction&&"MilestoneDrag"!==this.taskBarEditAction||(g=this.parent.enableRtl?parseInt(y.style.right,10):parseInt(y.style.left,10),this.parent.enableRtl?y.style.right=g-30+"px":y.style.left=g+30+"px")},y.prototype.mouseUpHandler=function(e){var t,i,a,n=this.isMouseDragged;this.previousMouseMove=null,this.leftValue=0,this.previousLeftValue=0,this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),this.taskBarEditAction&&this.isMouseDragged&&(!this.dragMouseLeave&&this.taskBarEditedAction||this.parent.allowTaskbarDragAndDrop?("touchmove"===e.type||"touchstart"===e.type||"touchend"===e.type?(a=this.getCoordinate(e),this.droppedTarget=document.elementFromPoint(a.pageX,a.pageY)):(this.taskBarEditRecord.hasChildRecords&&!this.taskBarEditRecord.ganttProperties.isAutoSchedule?(a=this.parent.getOffsetRect(this.taskBarEditElement),t=!ne.isNullOrUndefined(document.body.className)&&document.body.className.includes("e-bigger")?12:0,t=3+this.parent.chartRowsModule.connectorPointWidth+t,i=void 0,i=this.parent.enableRtl?Math.abs(a.left+t+1):Math.abs(Math.abs(a.left-t-1)-this.parent.ganttChartModule.scrollElement.scrollLeft),this.droppedTarget=document.elementFromPoint(i,e.y)):this.droppedTarget=document.elementFromPoint(e.x,e.y),this.droppedTarget&&this.droppedTarget.classList.contains("e-span-label")&&(this.droppedTarget=document.elementFromPoint(e.x+this.droppedTarget.offsetWidth,e.y))),this.previousIds=this.parent.ids.slice(),this.previousFlatData=this.parent.flatData.slice(),this.taskBarEditedAction(e),this.isMouseDragged=!1):(this.parent.isOnEdit=!1,this.cancelTaskbarEditActionInMouseLeave(),a=this.parent.criticalPathModule,this.parent.enableCriticalPath&&a&&a.criticalPathCollection&&a.criticalConnectorLine(a.criticalPathCollection,a.detailPredecessorCollection,!0,a.predecessorCollectionTaskIds))),!this.parent.enableMultiTaskbar||ne.isNullOrUndefined(this.taskBarEditElement)||ne.isNullOrUndefined(this.taskBarEditElement.querySelector(".e-gantt-child-taskbar"))||this.taskBarEditElement.querySelector(".e-gantt-child-taskbar").classList.contains("e-collapsed-taskbar-drag")&&(ne.removeClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"),this.taskBarEditElement.style.zIndex=this.prevZIndex,this.prevZIndex=""),this.parent.isAdaptive&&!n||this.initPublicProp(),this.stopScrollTimer()},y.prototype.taskBarEditedAction=function(e){var t={},i=this.mouseDownX,a=this.mouseDownY,n=this.taskBarEditRecord,r=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement),s=this.mouseMoveX,e=this.getCoordinate(e).pageY-this.parent.ganttChartModule.chartBodyContainer.offsetTop,o=("ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||this.drawPredecessor||(this.dependencyCancel=!0),[]);("ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction)&&this.drawPredecessor&&(!this.connectorSecondRecord.hasChildRecords||this.connectorSecondRecord.hasChildRecords&&this.parent.allowParentDependency)?(o.push(ne.extend([],[],[this.taskBarEditRecord],!0)[0]),this.parent.undoRedoModule&&(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1].connectedRecords=o,this.parent.toolbarModule)&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),this.parent.connectorLineEditModule.updatePredecessor(this.connectorSecondRecord,this.finalPredecessor)):("ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction||this.oldData&&JSON.stringify(n.ganttProperties)===JSON.stringify(this.oldData.ganttProperties)?this.parent.undoRedoModule&&0<this.parent.undoRedoModule.getUndoCollection.length&&(this.parent.totalUndoAction--,this.parent.undoRedoModule.getUndoCollection.splice(this.parent.undoRedoModule.getUndoCollection.length-1,1),this.parent.toolbarModule)&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!1):this.parent.undoRedoModule&&this.parent.toolbarModule&&0<this.parent.undoRedoModule.getUndoCollection.length&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),(i!==s||Math.abs(a-e)>=(this.parent.rowHeight-this.parent.taskbarHeight)/2)&&null!==n&&(t.editingFields=n.ganttProperties,t.data=n,t.recordIndex=r,t.previousData=this.previousItem,t.taskBarEditAction=this.taskBarEditAction,t.action="TaskbarEditing",t.roundOffDuration=this.roundOffDuration,t.target=this.targetElement,this.taskbarEditedArgs=t,this.taskbarEdited(t))),this.parent.isProjectDateUpdated=!1},y.prototype.cancelTaskbarEditActionInMouseLeave=function(){this.parent.editModule.reUpdatePreviousRecords(!0)},y.prototype.updateSegmentProgress=function(e){for(var t=e.segments,i=!0,a=this.splitTasksDuration(t)*this.parent.perDayWidth,n=s=a*Math.ceil(e.progressWidth/a*100)/100,r=0;r<t.length;r++){var s,o=t[r];0!==r&&(s=o.left<=n?n-o.left:0),delete o.progressWidth,0<s&&s>o.width?(s-=o.width,o.progressWidth=o.width,o.showProgress=!1):i&&(o.progressWidth=s,o.showProgress=!0,s-=o.width,i=!1)}},y.prototype.taskbarEdited=function(e){var e=ne.extend({},e),t=e.data,i=t.ganttProperties,a=this.parent.flatData.indexOf(t);if((this.parent.allowTaskbarDragAndDrop&&"ChildDrag"===this.taskBarEditAction||"ParentDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction||"ManualParentDrag"===this.taskBarEditAction)&&0<this.dragMoveY&&("ResourceView"===this.parent.viewType&&!t.hasChildRecords||"ProjectView"===this.parent.viewType)&&(this.parent.rowDragAndDropModule&&(o=this.parent.currentViewData,this.taskBarEditRecord.parentItem&&o[this.taskBarEditRecord.parentItem.index]&&-1===this.parent.editedRecords.indexOf(o[this.taskBarEditRecord.parentItem.index])&&this.parent.editedRecords.push(o[this.taskBarEditRecord.parentItem.index]),this.removeChildBorder(),this.removeErrorElem(),h=void this.removetopOrBottomBorder(),this.updatePosition=!1,l=void(this.draggedRecordMarginTop=this.taskBarEditElement.style.marginTop),(l=ne.isNullOrUndefined(this.droppedTarget)?l:ne.closest(this.droppedTarget,"tr."+Oe))&&(h=o[o=Array.from(this.parent.ganttChartModule.getChartRows()).indexOf(l)],l=this.parent.getRootParent(h,0).index,d=this.parent.getRootParent(this.taskBarEditRecord,0).index,s={cancel:!1,data:this.taskBarEditRecord,fromIndex:this.taskBarEditRecord.index,dropIndex:h.index,dropPosition:this.parent.rowDragAndDropModule.dropPosition,dropRecord:h},this.parent.trigger("rowDrop",s),!s.cancel)&&h&&o!==a&&(l!==d||this.taskBarEditRecord.hasChildRecords&&h.hasChildRecords||!this.taskBarEditRecord.hasChildRecords)&&(s=this.parent.flatData.indexOf(h),o=void 0,o=("ProjectView"!==this.parent.viewType||ne.isNullOrUndefined(this.parent.rowDragAndDropModule.dropPosition))&&(h.hasChildRecords||!h.parentItem&&0===h.childRecords.length)?"child":this.parent.rowDragAndDropModule.dropPosition,this.parent.rowDragAndDropModule&&("ResourceView"!==this.parent.viewType||"child"!==o||h.hasChildRecords||ne.isNullOrUndefined(h.parentItem)||(this.parent.rowDragAndDropModule.dropPosition=o="Invalid"),o)&&this.parent.rowDragAndDropModule.reorderRows([a],s,o),this.dragMoveY=0),this.isClonedElement=!1),this.parent.showOverAllocation)&&this.parent.ganttChartModule.renderOverAllocationContainer(),"ProgressResizing"===e.taskBarEditAction)e.previousData.progress!==i.progress&&(l=e.data.ganttProperties.progressWidth,d=e.data.ganttProperties.width,h=this.validateProgressWidth(e.data.ganttProperties,l,d),this.parent.setRecordValue("progress",this.getProgressPercent(h.totalTaskWidth,h.progressWidth),i,!0),t.parentItem&&this.parent.editModule.updateParentProgress(t.parentItem),ne.isNullOrUndefined(i.segments)||this.updateSegmentProgress(i));else{var n=e.data.ganttProperties.segments;if(!ne.isNullOrUndefined(n)&&0<n.length&&("LeftResizing"===this.taskBarEditAction&&0!==this.segmentIndex||"ChildDrag"===this.taskBarEditAction&&0!==this.segmentIndex||"RightResizing"===this.taskBarEditAction)){var a=n[this.segmentIndex],r=this.taskBarEditRecord.ganttProperties,s=0===this.segmentIndex?null:n[this.segmentIndex-1],o=this.segmentIndex===n.length-1?null:n[this.segmentIndex+1],l=ne.isNullOrUndefined(o)?this.parent.cloneProjectEndDate:new Date(o.startDate.getTime()),d=ne.isNullOrUndefined(s)?this.parent.cloneProjectStartDate:new Date(s.endDate.getTime()),h=new Date(a.startDate.getTime()),p=new Date(a.endDate.getTime());if("Day"===this.parent.timelineModule.topTier&&"Hour"===this.parent.timelineModule.bottomTier?(h.setHours(h.getHours()-1),p.setHours(p.getHours()+1)):(h.setDate(h.getDate()),p.setDate(p.getDate())),this.parent.includeWeekend){if(l.setHours(0,0,0,0),d.setHours(0,0,0,0),h.setDate(h.getDate()-1),p.setDate(p.getDate()+1),h.setHours(0,0,0,0),p.setHours(0,0,0,0),h.getTime()<=d.getTime()&&!ne.isNullOrUndefined(s)&&!ne.isNullOrUndefined(a)){var u=[{firstSegmentIndex:s.segmentIndex,secondSegmentIndex:a.segmentIndex}];this.parent.chartRowsModule.mergeTask(r.taskId,u)}else if(p.getTime()>=l.getTime()&&this.segmentIndex!==n.length-1){var u=[{firstSegmentIndex:a.segmentIndex,secondSegmentIndex:o.segmentIndex}];this.parent.chartRowsModule.mergeTask(r.taskId,u)}else if(p.getTime()>=l.getTime()){a.endDate.setDate(this.parent.cloneProjectEndDate.getDate()-1),a.startDate=this.parent.dataOperation.getStartDate(a.endDate,a.duration,r.durationUnit,r);for(var c=n.length-2;0<=c;c--){var g,f=ka({},n[c]);ne.isNullOrUndefined(f)||((g=new Date(f.endDate)).setDate(g.getDate()-f.offsetDuration),f.endDate=g,f.startDate=this.parent.dataOperation.getStartDate(f.endDate,f.duration,r.durationUnit,r))}}}else p.getTime()<=l.getTime()&&this.segmentIndex!==n.length-1&&!this.parent.includeWeekend&&0===this.parent.dataOperation.getDuration(this.parent.dataOperation.checkStartDate(p,i,!1),l,i.durationUnit,!1,!1)?(u=[{firstSegmentIndex:a.segmentIndex,secondSegmentIndex:o.segmentIndex}],this.parent.chartRowsModule.mergeTask(r.taskId,u)):h.getTime()>=d.getTime()&&!ne.isNullOrUndefined(s)&&!ne.isNullOrUndefined(a)&&!this.parent.includeWeekend&&0===this.parent.dataOperation.getDuration(this.parent.dataOperation.checkEndDate(h,i,!1),d,i.durationUnit,!1,!1)&&(u=[{firstSegmentIndex:s.segmentIndex,secondSegmentIndex:a.segmentIndex}],this.parent.chartRowsModule.mergeTask(r.taskId,u))}this.parent.dataOperation.updateWidthLeft(e.data)}this.isDragged=!1,this.parent.dataOperation.updateTaskData(t),this.parent.editModule.initiateUpdateAction(e)},y.prototype.getProgressPercent=function(e,t){return Math.ceil(t/e*100)},y.prototype.drawFalseLine=function(){var e,t=this.mouseDownX,i=this.mouseDownY,a=this.mouseMoveX,n=this.mouseMoveY,r=Math.sqrt((t-a)*(t-a)+(i-n)*(i-n)),n=180*Math.atan2(n-i,a-t)/Math.PI,i="rotate("+(this.parent.enableRtl?-n:n)+"deg)",a=0,t=(ne.isNullOrUndefined(document.querySelectorAll(".e-chart-row")[0])||(a=document.querySelectorAll(".e-chart-row")[0].offsetWidth),"ConnectorPointLeftDrag"===this.taskBarEditAction&&(e=this.parent.enableRtl?a-(this.elementOffsetLeft+this.parent.chartRowsModule.connectorPointWidth/2)-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left):this.elementOffsetLeft-this.parent.chartRowsModule.connectorPointWidth/2-this.parent.ganttChartModule.scrollObject.previousScroll.left),"ConnectorPointRightDrag"===this.taskBarEditAction&&(e=this.parent.enableRtl?a-(this.elementOffsetLeft+this.elementOffsetWidth+this.parent.chartRowsModule.connectorPointWidth/2)-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left):this.elementOffsetLeft+this.elementOffsetWidth+this.parent.chartRowsModule.connectorPointWidth/2-Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left)),this.elementOffsetTop+this.elementOffsetHeight/2+this.parent.ganttChartModule.chartBodyContainer.offsetTop-this.parent.ganttChartModule.scrollObject.previousScroll.top);this.removeFalseLine(!1),this.falseLine=ne.createElement("div",{className:"e-gantt-false-line",id:"ganttfalseline"+this.parent.element.id,styles:"position: absolute;transform:"+i+";border-top-width: 1px;border-top-style: dashed;z-index: 5;width:"+(r-3)+"px;top:"+t+"px;"}),this.parent.enableRtl?(this.falseLine.style.left="auto",this.falseLine.style.right=e+"px",this.falseLine.style.transformOrigin="100% 0%"):(this.falseLine.style.right="auto",this.falseLine.style.left=e+"px",this.falseLine.style.transformOrigin="0% 100%"),this.parent.ganttChartModule.chartBodyContainer.appendChild(this.falseLine)},y.prototype.removeFalseLine=function(e){this.falseLine&&(ne.remove(this.falseLine),this.falseLine=null,e)&&(this.elementOffsetLeft=0,this.elementOffsetTop=0,this.elementOffsetWidth=0,this.elementOffsetHeight=0,ne.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+tt),[st]))},y.prototype.updateConnectorLineSecondProperties=function(e){var e=this.getElementByPosition(e),t=S(e,P),i=document.body.className.includes("e-bigger"),a=(this.connectorSecondAction=null,0);S(e,ot)?(this.connectorSecondAction="ConnectorPointLeftDrag",this.toPredecessorText="Start"):S(e,lt)?(this.connectorSecondAction="ConnectorPointRightDrag",this.toPredecessorText="Finish"):(this.connectorSecondAction=null,this.toPredecessorText=null),this.taskBarEditElement!==t&&this.taskBarEditElement!==this.highlightedSecondElement&&(this.parent.virtualScrollModule&&this.parent.enableVirtualization&&(a=this.parent.virtualScrollModule.getTopPosition()),(this.parent.virtualScrollModule&&this.parent.enableVirtualization&&!this.elementOffsetLeft||!this.parent.enableVirtualization)&&(this.parent.allowParentDependency&&this.taskBarEditElement.children[0].classList.contains("e-manualparent-main-container")?(this.elementOffsetLeft=this.realTaskbarElement.children[0].offsetLeft+this.realTaskbarElement.offsetLeft-(i?10:0),this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3-5+this.taskBarEditElement.children[0].offsetTop+a):(this.elementOffsetLeft=this.realTaskbarElement.offsetLeft-(i?10:0),this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3+a),this.elementOffsetWidth=this.realTaskbarElement.offsetWidth+(i?20:0),this.elementOffsetHeight=this.realTaskbarElement.offsetHeight),this.showHideTaskBarEditingElements(t,this.highlightedSecondElement,!0)),ne.isNullOrUndefined(this.connectorSecondAction)&&!ne.isNullOrUndefined(this.connectorSecondElement)&&(!this.connectorSecondRecord.hasChildRecords||this.connectorSecondRecord.hasChildRecords&&this.parent.allowParentDependency)&&(this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),ne.removeClass([this.connectorSecondElement.querySelector("."+ot)],[ut]),ne.removeClass([this.connectorSecondElement.querySelector("."+lt)],[ut])),this.connectorSecondElement=this.connectorSecondAction?t:null,this.highlightedSecondElement=t,this.connectorSecondRecord=ne.isNullOrUndefined(this.connectorSecondElement)?null:this.parent.ganttChartModule.getRecordByTaskBar(this.connectorSecondElement)},y.prototype.triggerDependencyEvent=function(e,t){var i,a,n,r,s=this.parent.element.closest('[style*="zoom"]'),s=(s&&(s=parseFloat(getComputedStyle(s).zoom),i=e.pageY/s),this.taskBarEditRecord.ganttProperties),o=this.connectorSecondRecord?this.connectorSecondRecord.ganttProperties:null,l=this.getElementByPosition(e),d=l,h="ResourceView"===this.parent.viewType?s.taskId:s.rowUniqueID;"ConnectorPointLeftDrag"===this.taskBarEditAction?r=h+(this.parent.enableRtl?"F":"S"):"ConnectorPointRightDrag"===this.taskBarEditAction&&(r=h+(this.parent.enableRtl?"S":"F")),this.connectorSecondAction&&("ConnectorPointLeftDrag"===this.connectorSecondAction?(r+=this.parent.enableRtl?"F":"S",a=this.parent.enableRtl?"finish":"start"):"ConnectorPointRightDrag"===this.connectorSecondAction&&(r+=this.parent.enableRtl?"S":"F",a=this.parent.enableRtl?"start":"finish")),ne.isNullOrUndefined(o)?this.drawPredecessor=!1:(o.predecessorsName?this.finalPredecessor=o.predecessorsName+","+r:this.finalPredecessor=r,h=this.parent.connectorLineEditModule.validatePredecessorRelation(this.connectorSecondRecord,this.finalPredecessor),r=this.parent.predecessorModule.calculatePredecessor(r,this.connectorSecondRecord),(n={}).fromItem=s,n.toItem=o,n.newPredecessorString=this.finalPredecessor,n.predecessor=r&&r[0],n.isValidLink=h,n.requestType="ValidateDependency",this.parent.trigger("actionBegin",n),ne.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType||"ValidateDependency"===n.requestType?"ValidateDependency"!==n.requestType&&this.parent.showSpinner():this.parent.showMaskRow(),n.isValidLink=!(!h&&n.isValidLink)&&n.isValidLink,n.isValidLink?(this.editTooltip.toolTipObj||this.parent.isAdaptive||this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),ne.isNullOrUndefined(this.editTooltip.toolTipObj)||(this.parent.connectorLineModule.tooltipTable.innerHTML="",this.parent.connectorLineModule.tooltipTable.appendChild(this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"","")),(s=this.parent.connectorLineModule.tooltipTable.querySelector("#toPredecessor").querySelectorAll("td"))[1].innerText=o.taskName,s[2].innerText=this.parent.localeObj.getConstant(a),ne.isNullOrUndefined(this.parent.connectorLineModule.tooltipTable.parentElement))||ne.isNullOrUndefined(this.parent.connectorLineModule.tooltipTable.parentElement.parentElement)||(r=this.parent.connectorLineModule.tooltipTable.parentElement.parentElement,h=ne.isNullOrUndefined(i)?e.pageY:i,r.offsetTop+r.offsetHeight>h&&(r.style.top=e.pageY-r.offsetHeight-20+"px")),this.drawPredecessor=!0):(this.parent.isAdaptive?(l.classList.contains(ot)||l.classList.contains(lt))&&this.showHideActivePredecessors(!0):ne.addClass([d],[ut]),this.drawPredecessor=!1))},y.prototype.getCoordinate=function(e){var t={},i=e;return t.pageX=i.pageX,t.pageY=i.pageY,!e||"click"===e.type||"touchmove"!==(i=e).type&&"touchstart"!==i.type&&"touchend"!==i.type||(t.pageX=i.changedTouches[0].pageX,t.pageY=i.changedTouches[0].pageY),t},y.prototype.getElementByPosition=function(e){var t;return this.parent.isAdaptive?(t=this.getCoordinate(e),document.elementFromPoint(t.pageX-window.pageXOffset,t.pageY-window.pageYOffset)):e.target},y.prototype.multipleSelectionEnabled=function(){this.parent.selectionModule&&"Cell"!==this.parent.selectionSettings.mode&&"Multiple"===this.parent.selectionSettings.type&&this.parent.selectionModule.hidePopUp()},y.prototype.unWireEvents=function(){this.parent.isDestroyed||(this.parent.off("chartMouseDown",this.mouseDownHandler),this.parent.off("chartMouseUp",this.mouseUpHandler),this.parent.off("chartMouseLeave",this.mouseLeaveHandler),this.parent.off("chartMouseMove",this.mouseMoveAction),this.parent.off("chartMouseClick",this.mouseClickHandler))},y.prototype.destroy=function(){this.unWireEvents(),this.stopScrollTimer(),this.parent.editModule.taskbarEditModule=void 0},y);function y(e){var t=Da.call(this,e)||this;return t.leftValue=0,t.previousLeftValue=0,t.isMouseDragged=!1,t.dependencyCancel=!1,t.isDragged=!1,t.editElement=null,t.elementOffsetLeft=0,t.elementOffsetTop=0,t.elementOffsetWidth=0,t.elementOffsetHeight=0,t.segmentIndex=-1,t.currentItemTop=0,t.currentItemPrevTop=0,t.topValue=0,t.draggedRecordMarginTop="0px",t.isClonedElement=!1,t.updatePosition=!1,t.tooltipValue=0,t.parent=e,t.initPublicProp(),t.wireEvents(),t.editTooltip=new fa(t.parent,t),t}var wa=function(){return(wa=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Ta=(b.prototype.wireEvents=function(){this.parent.on("chartDblClick",this.dblClickHandler,this)},b.prototype.dblClickHandler=function(e){e=this.parent.ganttChartModule.getRecordByTarget(e);!ne.isNullOrUndefined(e)&&this.parent.editModule&&this.parent.editSettings.allowEditing&&this.openEditDialog(e)},b.prototype.processDialogFields=function(){ne.isNullOrUndefined(this.parent.editDialogFields)||this.parent.editDialogFields&&0===this.parent.editDialogFields.length?(this.updatedEditFields=this.getDefaultDialogFields(),this.updatedEditFields=this.validateDialogFields(this.updatedEditFields)):this.updatedEditFields=this.validateDialogFields(this.parent.editDialogFields),ne.isNullOrUndefined(this.parent.addDialogFields)||this.parent.addDialogFields&&0===this.parent.addDialogFields.length?(this.updatedAddFields=this.getDefaultDialogFields(),this.updatedAddFields=this.validateDialogFields(this.updatedAddFields)):this.updatedAddFields=this.validateDialogFields(this.parent.addDialogFields)},b.prototype.validateDialogFields=function(e){for(var t=[],i=0,a=0;a<e.length;a++){var n=w.getActualProperties(e[a]);"General"!==n.type||!ne.isNullOrUndefined(n.fields)&&0!==n.fields.length||(n.fields=this.getGeneralColumnFields()),"Advanced"!==n.type||!ne.isNullOrUndefined(n.fields)&&0!==n.fields.length||(n.fields=this.getAdvancedColumnFields()),"Dependency"===n.type&&ne.isNullOrUndefined(this.parent.taskFields.dependency)||"Resources"===n.type&&ne.isNullOrUndefined(this.parent.taskFields.resourceInfo)||"Notes"===n.type&&ne.isNullOrUndefined(this.parent.taskFields.notes)||("Custom"!==n.type||!ne.isNullOrUndefined(n.fields)&&0!==n.fields.length||(i+=1,n.fields=this.getCustomColumnFields()),1<i)||t.push(n)}return t},b.prototype.getGeneralColumnFields=function(){for(var e=[],t=0,i=Object.keys(this.parent.columnMapping);t<i.length;t++){var a=i[t];"dependency"!==a&&"resourceInfo"!==a&&"notes"!==a&&e.push(this.parent.columnMapping[a])}return e},b.prototype.getAdvancedColumnFields=function(){var e=[];return this.parent.columnMapping.constraintType&&e.push(this.parent.columnMapping.constraintType),this.parent.columnMapping.constraintDate&&e.push(this.parent.columnMapping.constraintDate),e},b.prototype.getCustomColumnFields=function(){for(var e=[],t=0;t<this.parent.customColumns.length;t++)e.push(this.parent.customColumns[t]);return e},b.prototype.getDefaultDialogFields=function(){var e=[],t={},i=this.parent.taskFields,a=this.parent.columnMapping;return 0!==Object.keys(a).length&&(t.type="General",e.push(t)),ne.isNullOrUndefined(ne.getValue("dependency",a))||(!(t={})!==this.parent.columnByField[a.dependency.valueOf()].visible&&(t.type="Dependency"),e.push(t)),ne.isNullOrUndefined(ne.getValue("resourceInfo",a))||(!(t={})!==this.parent.columnByField[a.resourceInfo.valueOf()].visible&&(t.type="Resources"),e.push(t)),ne.isNullOrUndefined(ne.getValue("constraintType",a))||ne.isNullOrUndefined(ne.getValue("constraintDate",a))||e.push(t={type:"Advanced"}),ne.isNullOrUndefined(ne.getValue("notes",a))||(!(t={})!==this.parent.columnByField[a.notes.valueOf()].visible&&(t.type="Notes"),e.push(t)),ne.isNullOrUndefined(ne.getValue("segments",i))||e.push(t={type:"Segments"}),0<this.parent.customColumns.length&&e.push(t={type:"Custom"}),e},b.prototype.openAddDialog=function(){this.isEdit=!1,this.editedRecord=this.composeAddRecord(),this.isFromAddDialog=!0,this.createDialog()},b.prototype.getMinimumStartDate=function(){var e=D.DataUtil.aggregates.min(this.parent.flatData,"ganttProperties.startDate"),e=ne.isNullOrUndefined(e)?new Date(this.parent.timelineModule.timelineStartDate.getTime()):new Date(e.getTime());return e=this.parent.dateValidationModule.checkStartDate(e),new Date(e.getTime())},b.prototype.composeAddRecord=function(){for(var e={ganttProperties:{}},t=this.parent.ganttColumns,i=this.parent.taskFields,a=this.parent.editModule.getNewTaskId(),n=0;n<t.length;n++){var r=t[n].field;r===i.id?(e[r]=a,e.ganttProperties.rowUniqueID=e[r]):t[n].field===i.startDate?(ne.isNullOrUndefined(e[i.endDate])?e[r]=this.getMinimumStartDate():e[r]=new Date(e[i.endDate]),this.parent.timezone&&(e[r]=this.parent.dateValidationModule.remove(e[r],this.parent.timezone)),e.ganttProperties.startDate=new Date(e[r])):t[n].field===i.endDate?(ne.isNullOrUndefined(e[i.startDate])?e[r]=this.getMinimumStartDate():e[r]=new Date(e[i.startDate]),this.parent.timezone&&(e[r]=this.parent.dateValidationModule.remove(e[r],this.parent.timezone)),e.ganttProperties.endDate=new Date(e[r])):t[n].field===i.duration?(e[r]=1,e.ganttProperties.duration=e[r],e.ganttProperties.durationUnit=this.parent.durationUnit.toLocaleLowerCase()):t[n].field===i.name?(e[r]=this.localeObj.getConstant("addDialogTitle")+" "+a,e.ganttProperties.taskName=e[r]):t[n].field===i.progress?(e[r]=0,e.ganttProperties.progress=e[r]):t[n].field===i.work?(e[r]=0,e.ganttProperties.work=e[r]):t[n].field===i.type?(e[r]=this.parent.taskType,e.ganttProperties.taskType=e[r]):e[this.parent.ganttColumns[n].field]=""}return e.ganttProperties.isAutoSchedule="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[i.manual],e},b.prototype.openToolbarEditDialog=function(){var e=this.parent;e.editModule&&e.editSettings.allowEditing&&(e.selectionModule&&-1<this.parent.ganttChartModule.focusedRowIndex&&e.selectionModule.selectRow(this.parent.ganttChartModule.focusedRowIndex,!1,!1),e=e.selectionModule?"Row"!==e.selectionSettings.mode&&"Both"!==e.selectionSettings.mode||1!==e.selectionModule.selectedRowIndexes.length?"Cell"===e.selectionSettings.mode&&1===e.selectionModule.getSelectedRowCellIndexes().length?e.updatedRecords[e.selectionModule.getSelectedRowCellIndexes()[0].rowIndex].ganttProperties.rowUniqueID:null:e.updatedRecords[e.selectionModule.selectedRowIndexes[0]].ganttProperties.rowUniqueID:null,ne.isNullOrUndefined(e)||this.openEditDialog(e))},b.prototype.openEditDialog=function(e){var t=this.parent;ne.isNullOrUndefined(e)||(ne.isNullOrUndefined(e.ganttProperties)||("string"==typeof e.ganttProperties.taskId?this.numericOrString="stringedit":this.numericOrString="numericedit"),ne.isNullOrUndefined(e.ganttProperties)&&!ne.isNullOrUndefined(e)&&(isNaN(Number(e))||"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?this.numericOrString="stringedit":this.numericOrString="numericedit")),"object"!=typeof e||ne.isNullOrUndefined(e)?ne.isNullOrUndefined(e)?-1<t.selectedRowIndex&&(this.rowData=t.currentViewData[t.selectedRowIndex],this.rowIndex=t.selectedRowIndex):(this.rowIndex=t.ids.indexOf(e.toString()),-1<this.rowIndex&&(this.rowData=t.flatData[this.rowIndex])):(this.rowIndex=this.parent.currentViewData.indexOf(e),-1<this.rowIndex&&(this.rowData=e)),this.isEdit=!0,"ResourceView"===this.parent.viewType&&0===this.rowData.level||0!==Object.keys(this.rowData).length&&(this.editedRecord=ne.extend({},{},this.rowData,!0),this.isFromEditDialog=!0,this.createDialog())},b.prototype.createDialog=function(){var i=this,e=this.parent,t={},a=(this.beforeOpenArgs.dialogModel=t,this.beforeOpenArgs.rowData=this.editedRecord,this.beforeOpenArgs.rowIndex=this.rowIndex,this.parent.isAdaptive?"":"600px"),a=this.parent.createElement("div",{id:e.element.id+"_dialog",styles:"max-width:"+a}),e=(a.classList.add("e-gantt-dialog"),e.element.appendChild(a),t.animationSettings={effect:"None"},t.header=this.localeObj.getConstant(this.isEdit?"editDialogTitle":"addDialogTitle"),t.isModal=!0,t.enableRtl=this.parent.enableRtl,t.allowDragging=!this.parent.isAdaptive&&!this.parent.enableAdaptiveUI,t.showCloseIcon=!0,this.parent.isAdaptive?{X:"top",Y:"left"}:{X:"center",Y:"center"});t.position=e,t.height=this.parent.isAdaptive?"100%":"auto",t.target=document.body,t.close=this.dialogClose.bind(this),t.closeOnEscape=!0,t.beforeClose=function(e){"escape"===e.closedBy&&"key-pressed"===e.event.name&&"INPUT"===e.event.target.nodeName&&(e.cancel=!0)},t.open=function(e){var e=ne.getValue("element",e),t=e.querySelector("#"+i.parent.element.id+"GeneralTabContainer");t&&t.scrollHeight>t.offsetHeight&&t.classList.add("e-scroll"),0===i.tabObj.selectedItem&&i.tabObj.select(0),i.parent.isAdaptive&&(e.style.maxHeight="none"),i.parent.focusModule&&i.parent.focusModule.setActiveElement(e)},t.locale=this.parent.locale,t.buttons=[{buttonModel:{content:this.localeObj.getConstant("saveButton"),cssClass:"e-primary"},click:this.buttonClick.bind(this)},{buttonModel:{cssClass:"e-flat",content:this.localeObj.getConstant("cancel")},click:this.buttonClick.bind(this)}],this.createTab(t,a)},b.prototype.buttonClick=function(e){var t=e.target;if(t.style.pointerEvents="none",this.localeObj.getConstant("cancel").toLowerCase()===e.target.innerText.trim().toLowerCase())this.dialog&&!this.dialogObj.isDestroyed&&(this.CustomformObj=null,this.formObj=null,this.storeValidTab=null,this.customFieldColumn=[],this.taskFieldColumn=[],this.dialogObj.hide(),this.dialogClose());else if(this.CustomformObj&&!this.CustomformObj.validate())t.style.pointerEvents="";else{if(this.formObj)if(!this.formObj.validate())return void(t.style.pointerEvents="");if(this.storeDependencyTab||"Dependency"===this.firstOccuringTab){var i=void 0;if(i=("Dependency"===this.firstOccuringTab?e.target.closest("#"+this.parent.element.id+"_dialog"):this.storeDependencyTab).querySelector(".e-gridform"))if(!i.ej2_instances[0].validate())return void(t.style.pointerEvents="")}if(this.storeResourceTab||"Resources"===this.firstOccuringTab){i=void 0;if(i=("Resources"===this.firstOccuringTab?e.target.closest("#"+this.parent.element.id+"_dialog"):this.storeResourceTab).querySelector(".e-gridform"))if(!i.ej2_instances[0].validate())return void(t.style.pointerEvents="")}this.initiateDialogSave(),this.parent.updateDuration=!1,this.CustomformObj=null,this.formObj=null,this.storeValidTab=null,this.customFieldColumn=[],this.taskFieldColumn=[],t.style.pointerEvents="auto"}},b.prototype.dialogClose=function(){this.dialog&&this.resetValues(),ne.isNullOrUndefined(this.parent.focusModule)||ne.isNullOrUndefined(this.parent.focusModule.getActiveElement(!0))||this.parent.focusModule.getActiveElement(!0).focus()},b.prototype.resetValues=function(){this.isEdit=!1,this.isAddNewResource=!1,this.editedRecord={},this.parent.triggeredColumnName="",this.rowData={},this.rowIndex=-1,this.addedRecord=null,this.ganttResources=[],this.dialogEditValidationFlag=!1,this.isFromAddDialog=!1,this.isFromEditDialog=!1,this.dialog&&!this.dialogObj.isDestroyed&&(this.destroyDialogInnerElements(),this.dialogObj.destroy(),ne.remove(this.dialog))},b.prototype.destroyDialogInnerElements=function(){for(var e=this.parent,t=this.beforeOpenArgs.tabModel.items,i=0;i<t.length;i++){var a=t[i].content,n=a.getAttribute("id");ne.isNullOrUndefined(n)&&""===n||("General"===(n=(n=n.replace(e.element.id,"")).replace("TabContainer",""))?this.destroyCustomField(a):"Dependency"===n||"Notes"===n||"Resources"===n?a.ej2_instances[0].destroy():-1!==n.indexOf("Custom")&&this.destroyCustomField(a))}},b.prototype.destroyCustomField=function(e){for(var t=e.childNodes,i=this.parent,a=0;a<t.length;a++){var n=t[a],r=n.querySelector('input[id^="'+i.element.id+'"]');r&&(r=r.id.replace(i.element.id,""),n=n.querySelector("#"+i.element.id+r).ej2_instances[0],ne.isNullOrUndefined(n)||(r=i.columnByField[r],ne.isNullOrUndefined(r)||ne.isNullOrUndefined(r.edit)||ne.isNullOrUndefined(r.edit.destroy)||!ne.isNullOrUndefined(r.edit.params)?n.destroy():"string"==typeof(n=r.edit.destroy)?(n=w.getObject(n,window))():r.edit.destroy()))}},b.prototype.destroy=function(){this.resetValues(),this.parent.isDestroyed||(this.parent.off("chartDblClick",this.dblClickHandler),this.parent.editModule.dialogModule=void 0)},b.prototype.getEditFields=function(){return this.isEdit?this.updatedEditFields:this.updatedAddFields},b.prototype.createTab=function(t,i){var a,n=this,r=this.parent,s={},e=[],o=this.getEditFields(),l=r.taskFields,d=o.length,h=(s.items=e,s.locale=this.parent.locale,s.enableRtl=this.parent.enableRtl,this.beforeOpenArgs.tabModel=s,0);if(0<d)for(var p=0;p<d;p++){var u=o[p],c={};if("General"===u.type){if(0===Object.keys(r.columnMapping).length)continue;ne.isNullOrUndefined(u.headerText)&&(u.headerText=this.localeObj.getConstant("generalTab")),c.content="General",this.beforeOpenArgs[c.content]=this.getFieldsModel(u.fields)}else if("Segments"===u.type){if(ne.isNullOrUndefined(l.segments))continue;ne.isNullOrUndefined(u.headerText)&&(u.headerText=this.localeObj.getConstant("segments")),c.content="Segments",this.beforeOpenArgs[c.content]=this.getSegmentsModel(u.fields)}else if("Dependency"===u.type){if(ne.isNullOrUndefined(l.dependency))continue;ne.isNullOrUndefined(u.headerText)&&(u.headerText=this.localeObj.getConstant("dependency")),c.content="Dependency",this.beforeOpenArgs[c.content]=this.getPredecessorModel(u.fields)}else if("Resources"===u.type){if(ne.isNullOrUndefined(l.resourceInfo))continue;ne.isNullOrUndefined(u.headerText)&&(u.headerText=this.localeObj.getConstant("resourceName")),c.content="Resources",this.beforeOpenArgs[c.content]=this.getResourcesModel(u.fields)}else if("Notes"===u.type){if(ne.isNullOrUndefined(l.notes))continue;ne.isNullOrUndefined(u.headerText)&&(u.headerText=this.localeObj.getConstant("notes")),c.content="Notes",this.beforeOpenArgs[c.content]=this.getNotesModel(u.fields)}else if("Advanced"===u.type)ne.isNullOrUndefined(u.headerText)&&(u.headerText=this.localeObj.getConstant("advancedTab")),c.content="Advanced",this.beforeOpenArgs[c.content]=this.getAdvancedModel(u.fields);else{if(ne.isNullOrUndefined(u.fields)||0===u.fields.length)continue;ne.isNullOrUndefined(u.headerText)&&(u.headerText=this.localeObj.getConstant("customTab")),c.content="Custom"+h++,this.beforeOpenArgs[c.content]=this.getFieldsModel(u.fields)}c.header={text:u.headerText},e.push(c)}this.beforeOpenArgs.requestType=this.isEdit?"beforeOpenEditDialog":"beforeOpenAddDialog",this.parent.trigger("actionBegin",this.beforeOpenArgs,function(e){e.cancel?(e.cancel=!1,n.parent.hideLoadingIndicator()):(n.parent.showLoadingIndicator(),n.renderTabItems(),s.selected=n.tabSelectedEvent.bind(n),s.height=n.parent.isAdaptive?"100%":"auto",s.overflowMode="Scrollable",n.tabObj=new V.Tab(s),n.tabObj.isStringTemplate=!0,a=n.parent.createElement("div",{id:r.element.id+"_Tab"}),n.tabObj.appendTo(a),t.content=a,n.dialog=i,n.dialogObj=new F.Dialog(t),n.dialogObj.isStringTemplate=!0,n.dialogObj.appendTo(n.dialog),e={action:"OpenDialog",requestType:n.isEdit?"openEditDialog":"openAddDialog",data:n.beforeOpenArgs.rowData,element:n.dialog,cancel:!1},n.parent.treeGrid.grid.getColumns().some(function(e){return e.validationRules})&&(n.CustomformObj=null,n.formObj=null,n.storeValidTab=null,n.customFieldColumn=[],n.taskFieldColumn=[],n.changeFormObj(e.element)),n.parent.trigger("actionComplete",e,function(e){n.parent.hideLoadingIndicator(),e.cancel&&n.resetValues()}))})},b.prototype.changeFormObj=function(e){var t;if(this.storeColumn||(this.storeColumn=this.parent.treeGrid.grid.getColumns()),this.taskfields||(this.taskfields=this.parent.taskFields.properties),this.storeValidTab||(this.storeValidTab=this.getFilteredDialogFields()),0!==this.customFieldColumn.length&&0!==this.taskFieldColumn.length||this.validateColumn(this.storeColumn,this.taskfields,this.storeValidTab),this.isFromAddDialog&&this.parent.addDialogFields&&0<this.parent.addDialogFields.length?"Resources"!==(t=this.parent.addDialogFields[0].type)&&"Dependency"!==t||(this.firstOccuringTab=t):this.isFromEditDialog&&this.parent.editDialogFields&&0<this.parent.editDialogFields.length&&("Resources"!==(t=this.parent.editDialogFields[0].type)&&"Dependency"!==t||(this.firstOccuringTab=t)),!this.CustomformObj||!this.formObj){var i=this.customFieldColumn,a=this.taskFieldColumn;if(!this.CustomformObj&&i&&0<i.length){for(var n={},r=0;r<i.length;r++){var s=i[r];s.visible&&s.validationRules&&(n[s.field]=s.validationRules)}0<Object.keys(n).length&&(this.CustomformObj=e.querySelector("#"+this.parent.element.id+"Custom0TabContainer"),this.CustomformObj)&&(this.CustomformObj=this.createFormObj(this.CustomformObj,n))}if(!this.formObj&&a&&0<a.length){for(n={},r=0;r<a.length;r++){var o=a[r];o.visible&&o.validationRules&&(n[o.field]=o.validationRules)}0<Object.keys(n).length&&(this.formObj=e.querySelector("#"+this.parent.element.id+"GeneralTabContainer"),this.formObj)&&(this.formObj=this.createFormObj(this.formObj,n))}}this.isFromAddDialog=!1,this.isFromEditDialog=!1},b.prototype.getFilteredDialogFields=function(){var e=this.isFromAddDialog?this.parent.addDialogFields:this.parent.editDialogFields;return 0!==e.length?e.filter(function(e){return"General"===e.type||"Custom"===e.type}):null},b.prototype.validateColumn=function(a,e,t){var n=this;t?t.forEach(function(e){var i="General"===e.type?n.taskFieldColumn:n.customFieldColumn;e.fields.forEach(function(e){var t=n.parent.getColumnByField(e,a);null!==t?i.push(t):i.push(n.parent.columnByField[e])})}):a.forEach(function(e){(-1!==n.parent.customColumns.indexOf(e.field)?n.customFieldColumn:n.taskFieldColumn).push(e)})},b.prototype.createFormObj=function(e,t){var a=this;return new B.FormValidator(e,{rules:t,locale:this.parent.locale,validationComplete:function(e){a.validationComplete(e)},customPlacement:function(e,t){var i=e.getAttribute("name");i&&a.valErrorPlacement(e,t,i)}})},b.prototype.valErrorPlacement=function(e,t,i){var i=i+"-tooltip",a=this.getElemTable(e);a?(a=a.querySelector(".e-tip-content"))&&(a.innerHTML=t.outerHTML):this.createTooltip(e,t,i)},b.prototype.createTooltip=function(e,t,i,a){void 0===a&&(a="block");var n=document.getElementById(i),n=(n&&n.remove(),e.parentElement),e=(n&&(n.style.position="relative"),document.createElement("div")),a=(e.className="e-tooltip-wrap e-lib e-control e-popup e-griderror",e.style.display=a,e.style.zIndex="1000",i+"-label"),i=document.createElement("div"),r=(i.id=a,i.className="sr-only",document.createElement("div")),s=(r.className="e-tip-content",document.createElement("div")),t=(s.className="error-message",s.appendChild(t.cloneNode(!0)),document.createElement("div"));t.className="e-arrow-tip e-tip-top",t.appendChild(document.createElement("div")).className="e-arrow-tip-outer e-tip-top",t.appendChild(document.createElement("div")).className="e-arrow-tip-inner e-tip-top",e.setAttribute("aria-labelledby",a),r.appendChild(s),e.appendChild(r),e.appendChild(t),e.style.top="125%",e.style.left="50%",e.style.transform="translateX(-50%)",n&&(n.appendChild(i),n.appendChild(e))},b.prototype.getElemTable=function(e){e=e.parentElement;return e?e.querySelector(".e-tooltip-wrap"):null},b.prototype.validationComplete=function(e){var t=this.getElemTable(e.element);t&&("failure"===e.status?t.style.display="":t.style.display="none")},b.prototype.tabSelectedEvent=function(e){var t=this.parent,i=e.selectedContent.childNodes[0].id,a=this.parent.editModule.dialogModule,n=a.dialog,r=0<n.getElementsByClassName("e-editedbatchcell").length,n=0<n.getElementsByClassName("e-editedrow").length||0<n.getElementsByClassName("e-addedrow").length;a.storeResourceTab&&r?document.querySelector("#"+t.element.id+"ResourcesTabContainer_gridcontrol").ej2_instances[0].saveCell():n&&a.storeDependencyTab&&document.querySelector("#"+t.element.id+"DependencyTabContainer").ej2_instances[0].editModule.batchSave(),i===t.element.id+"DependencyTabContainer"&&(this.storeDependencyTab=e.selectedContent),i===t.element.id+"ResourcesTabContainer"&&(this.storeResourceTab=e.selectedContent),i===t.element.id+"Custom0TabContainer"&&this.parent.treeGrid.grid.getColumns().some(function(e){return e.validationRules})&&this.changeFormObj(e.selectedContent),i===t.element.id+"GeneralTabContainer"&&this.parent.treeGrid.grid.getColumns().some(function(e){return e.validationRules})&&this.changeFormObj(e.selectedContent),(this.parent.isAdaptive||this.parent.enableAdaptiveUI)&&this.responsiveTabContent(i,t),i===t.element.id+"ResourcesTabContainer"?this.resourceSelection(i):i===t.element.id+"NotesTabContainer"?document.getElementById(i).ej2_instances[0].refresh():i===t.element.id+"SegmentsTabContainer"&&(ne.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)?document.getElementById(i).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!1):document.getElementById(i).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!0))},b.prototype.responsiveTabContent=function(e,t){var t=document.getElementById(t.element.id+"_dialog_dialog-content"),i=t.clientHeight,t=(i-=t.querySelector(".e-tab-header").offsetHeight,document.querySelector("#"+e));t.classList.contains("e-grid")&&(i-=t.ej2_instances[0].getHeaderContent().offsetHeight,e=t.querySelector(".e-toolbar"))&&(i-=e.offsetHeight),t.parentElement.style.height=i+"px"},b.prototype.getFieldsModel=function(e){for(var t,i={},a=this.parent.columnByField,n=0;n<e.length;n++)e[n]===this.parent.taskFields.dependency||e[n]===this.parent.taskFields.resourceInfo||e[n]===this.parent.taskFields.notes||e[n]===this.parent.taskFields.constraintDate||e[n]===this.parent.taskFields.constraintType||ne.isNullOrUndefined(a[e[n]])||(t=e[n],this.createInputModel(a[t],i));return i},b.prototype.getAdvancedModel=function(e){for(var t={},i=this.parent.columnByField,a=0;a<e.length;a++){var n=e[a];ne.isNullOrUndefined(i[n])||n!==this.parent.taskFields.constraintDate&&n!==this.parent.taskFields.constraintType||this.createInputModel(i[n],t)}return t},b.prototype.processAndValidateScheduleDates=function(e,t){var i=e.editModule.dialogModule.dialog.querySelector("#"+e.element.id+t.constraintDate),a=e.editModule.dialogModule.dialog.querySelector("#"+e.element.id+t.constraintType),n=this.dialog.querySelector("#"+e.element.id+t.startDate),e=this.dialog.querySelector("#"+e.element.id+t.endDate);this.alignDateWithConstraint(i,a,n,e)},b.prototype.createInputModel=function(t,e){var i=this,a=this.parent,n=this.parent.locale,r=this.parent.taskFields,s={placeholder:t.headerText,floatLabelType:"Auto"};if(ne.isNullOrUndefined(this.parent.taskFields.id)||ne.isNullOrUndefined(this.parent.columnMapping.id)||ne.isNullOrUndefined(this.numericOrString)||r.id===t.field&&(t.editType=this.numericOrString),t.editTemplate){var o=this.parent.currentViewData.indexOf(this.rowData),o=this.parent.chartRowsModule.templateCompiler(t.editTemplate)(ne.extend({index:o},this.editedRecord),this.parent,"EditTemplate",this.parent.chartRowsModule.getTemplateID("EditTemplate"),!1,void 0,null,this.parent.treeGrid.root);e[t.field]=o}else switch(t.editType){case"booleanedit":var l={label:t.headerText,locale:n,enableRtl:this.parent.enableRtl};e[t.field]=l;break;case"defaultedit":case"stringedit":var l=s;l.enableRtl=this.parent.enableRtl,t.field!==a.columnMapping.duration&&t.field!==a.columnMapping.id&&t.field!==a.columnMapping.startDate&&t.field!==a.columnMapping.endDate&&t.field!==a.columnMapping.baselineDuration||(l.change=function(e){i.isTriggered?i.parent.triggeredColumnName="":(t.field!==i.parent.taskFields.duration&&t.field!==i.parent.taskFields.work&&t.field!==i.parent.taskFields.baselineDuration||i.isTriggered||(i.isTriggered=!0,i.parent.triggeredColumnName=t.field),i.validateScheduleFields(e,t,a))}),e[t.field]=s;break;case"numericedit":l=s;l.enableRtl=this.parent.enableRtl,r.progress===t.field&&(l.min=0,l.max=100),l.change=function(e){i.isTriggered?i.parent.triggeredColumnName="":(t.field!==i.parent.taskFields.duration&&t.field!==i.parent.taskFields.work||i.isTriggered||(i.isTriggered=!0,i.parent.triggeredColumnName=t.field),i.validateScheduleFields(e,t,a))},e[t.field]=l;break;case"datepickeredit":l=s;l.format=this.parent.getDateFormat(),l.enableRtl=this.parent.enableRtl,l.strictMode=!0,l.firstDayOfWeek=a.timelineModule.customTimelineSettings.weekStartDay,t.field!==a.columnMapping.startDate&&t.field!==a.columnMapping.endDate&&t.field!==a.columnMapping.constraintDate&&t.field!==a.columnMapping.baselineStartDate&&t.field!==a.columnMapping.baselineEndDate||(t.field===a.columnMapping.baselineStartDate||t.field===a.columnMapping.baselineEndDate||(l.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent)),l.change=function(e){t.field!==r.constraintDate?i.validateScheduleFields(e,t,a):i.processAndValidateScheduleDates(a,r)}),e[t.field]=l;break;case"datetimepickeredit":l=s;l.format=this.parent.getDateFormat(),l.enableRtl=this.parent.enableRtl,l.strictMode=!0,l.firstDayOfWeek=a.timelineModule.customTimelineSettings.weekStartDay,t.field!==a.columnMapping.startDate&&t.field!==a.columnMapping.endDate&&t.field!==a.columnMapping.baselineStartDate&&t.field!==a.columnMapping.baselineEndDate||(t.field===a.columnMapping.baselineStartDate||t.field===a.columnMapping.baselineEndDate||(l.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent)),l.change=function(e){t.field!==r.constraintDate?i.validateScheduleFields(e,t,a):i.processAndValidateScheduleDates(a,r)}),e[t.field]=l;break;case"dropdownedit":t.field!==a.columnMapping.type&&t.field!==a.columnMapping.manual&&t.field!==a.columnMapping.constraintType||(s.dataSource=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}],s.fields={value:"Value"},(l=s).enableRtl=this.parent.enableRtl,l.change=function(e){t.field===r.manual&&(i.editedRecord.ganttProperties.isAutoSchedule=!e.value),t.field!==r.constraintType?i.validateScheduleFields(e,t,a):(i.dialogConstraintValue=Number(e.value),i.processAndValidateScheduleDates(a,r))}),e[t.field]=s;break;case"maskededit":e[t.field]=s}return ne.isNullOrUndefined(t.edit)||ne.isNullOrUndefined(t.edit.params)||ne.extend(e[t.field],t.edit.params),e},b.prototype.setConstraintDateBasedOnType=function(e,t,i,a,n){if(!e&&i)switch(t){case k.ConstraintType.StartNoEarlierThan:case k.ConstraintType.StartNoLaterThan:case k.ConstraintType.MustStartOn:i.value=new Date(a);break;case k.ConstraintType.FinishNoEarlierThan:case k.ConstraintType.FinishNoLaterThan:case k.ConstraintType.MustFinishOn:i.value=new Date(n)}},b.prototype.alignDateWithConstraint=function(e,t,i,a){var n,r,s=e?e.ej2_instances[0].value:this.editedRecord.ganttProperties.constraintDate,t=t?t.ej2_instances[0].value:this.editedRecord.ganttProperties.constraintType,o=i?i.ej2_instances[0].value:this.editedRecord.ganttProperties.startDate,a=a?a.ej2_instances[0].value:this.editedRecord.ganttProperties.endDate,l=(!s&&t!==k.ConstraintType.AsSoonAsPossible&&t!==k.ConstraintType.AsLateAsPossible&&e&&this.setConstraintDateBasedOnType(s,t,e.ej2_instances[0],o,a),new Date(o)),d=new Date(a),h=this.parent.assignTimeToDate(s,this.parent.getCurrentDayStartTime(s)),p=this.parent.predecessorModule.filterPredecessorsByTarget(this.editedRecord.ganttProperties.predecessor,this.editedRecord,this.parent.viewType);switch(t){case k.ConstraintType.MustStartOn:h=s=this.parent.dateValidationModule.checkStartDate(new Date(h)),l.getTime()!==h.getTime()&&i&&(i.ej2_instances[0].value=s);break;case k.ConstraintType.MustFinishOn:h.setDate(h.getDate()+1),h=s=this.parent.dateValidationModule.checkEndDate(new Date(h)),d.getTime()!==h.getTime()&&(s=this.parent.dateValidationModule.getStartDate(s,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),i)&&(i.ej2_instances[0].value=s);break;case k.ConstraintType.StartNoEarlierThan:h=s=this.parent.dateValidationModule.checkStartDate(new Date(h)),i&&(i.ej2_instances[0].value=s);break;case k.ConstraintType.StartNoLaterThan:this.editedRecord.ganttProperties.predecessor&&0<this.editedRecord.ganttProperties.predecessor.length&&0!==p.length?(r=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord),i&&(i.ej2_instances[0].value=r.maxDate)):this.editedRecord.parentItem?i&&(i.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):i&&(i.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));break;case k.ConstraintType.FinishNoEarlierThan:h.setDate(h.getDate()+1),h=s=this.parent.dateValidationModule.checkEndDate(new Date(h)),d.getTime()!==h.getTime()&&(s=this.parent.dateValidationModule.getStartDate(s,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),i)&&(i.ej2_instances[0].value=s);break;case k.ConstraintType.FinishNoLaterThan:this.editedRecord.ganttProperties.predecessor&&0<this.editedRecord.ganttProperties.predecessor.length&&0!==p.length?(r=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord),i&&(i.ej2_instances[0].value=r.maxDate)):this.editedRecord.parentItem?i&&(i.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):i&&(i.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate)));break;case k.ConstraintType.AsSoonAsPossible:this.editedRecord.ganttProperties.predecessor&&0<this.editedRecord.ganttProperties.predecessor.length&&0!==p.length?(r=this.parent.editModule.taskbarEditModule.isValidDependency(this.editedRecord)).maxDate&&i&&(i.ej2_instances[0].value=r.maxDate):this.editedRecord.parentItem?i&&(i.ej2_instances[0].value=this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.startDate):i&&(i.ej2_instances[0].value=this.parent.dateValidationModule.checkStartDate(new Date(this.parent.projectStartDate))),e&&(e.ej2_instances[0].value=null);break;case k.ConstraintType.AsLateAsPossible:this.editedRecord.parentItem?(n=this.parent.dateValidationModule.checkEndDate(this.parent.getRecordByID(this.editedRecord.parentItem.taskId).ganttProperties.endDate),r=this.parent.dateValidationModule.getStartDate(n,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),i&&(i.ej2_instances[0].value=r)):(n=this.parent.dateValidationModule.checkEndDate(new Date(this.parent.projectEndDate)),r=this.parent.dateValidationModule.getStartDate(n,this.editedRecord.ganttProperties.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties),i&&(i.ej2_instances[0].value=r)),e&&(e.ej2_instances[0].value=null)}},b.prototype.validateScheduleFields=function(e,t,i){ne.isNullOrUndefined(i.editModule.dialogModule.dialog)||(a=i.editModule.dialogModule.dialog);var a,n,r=null,s=i.editModule.dialogModule.editedRecord,o=null,l=null,d="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,h=this.parent.viewType;return ne.isNullOrUndefined(e.element)?ne.isNullOrUndefined(e.container)?ne.isNullOrUndefined(e.event)||ne.isNullOrUndefined(e.event.path)||ne.isNullOrUndefined(e.event.path)[1]||(r=(n=e.event.path[1]).querySelector("input").getAttribute("id"),n=n.querySelector("#"+r)):(r=(n=e.container).querySelector("input").getAttribute("id"),n=n.querySelector("#"+r)):r=(n=e.element).getAttribute("id"),ne.isNullOrUndefined(n)?(o=e.value,l=t.field):(o=("datetimepickeredit"===t.editType?e:n).value,l=r.replace(i.element.id,""),"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType&&(n={rules:((t={})[this.parent.taskFields.id]={required:!0,minLength:[function(e){return"ResourceView"===h?-1===d.indexOf("T"+e.value)&&-1===d.indexOf("R"+e.value):-1===d.indexOf(e.value)},"ID is already present, please enter new value"]},t)},new B.FormValidator("#"+this.parent.element.id+"GeneralTabContainer",n))),0===l.search("Segments")?(l=l.replace("SegmentsTabContainer",""),this.validateSegmentFields(i,l,o,e),!(this.isTriggered=!1)):(r=!1,this.parent.taskFields.baselineDuration!==l&&this.parent.taskFields.baselineStartDate!==l&&this.parent.taskFields.baselineEndDate!==l||(r=!0),this.validateScheduleValuesByCurrentField(l,o,this.editedRecord,r),t=s.ganttProperties,o=(n=this.parent.dateValidationModule.getFieldMappings(r)).startdateField,s=n.enddateField,n=n.durationField,i=i.taskFields,ne.isNullOrUndefined(i.startDate||!ne.isNullOrUndefined(i.baselineStartDate))||i[o]===l||this.updateScheduleFields(a,t,o),i[s]===l&&!ne.isNullOrUndefined(t[o])&&!ne.isNullOrUndefined(e.value)&&t[o].getTime()>e.value&&this.updateScheduleFields(a,t,s),ne.isNullOrUndefined(i[s])||i[s]===l||(this.updateScheduleFields(a,t,s),this.parent.taskFields.constraintType&&this.updateScheduleFields(a,t,"constraintDate")),(!ne.isNullOrUndefined(i[n])&&i[n]!==l||0<=t[n])&&this.updateScheduleFields(a,t,n),ne.isNullOrUndefined(i.work)||i.work===l&&"FixedWork"===t.taskType||this.updateScheduleFields(a,t,"work"),this.dialogEditValidationFlag=!1,!(r=this.isTriggered=!1))},b.prototype.getConstraintDateElement=function(e,t,i){if(t===i.constraintDate)for(var a=0,n=this.beforeOpenArgs.tabModel.items;a<n.length;a++){var r=n[a];if("Advanced"===r.header.text)return r.content.querySelector("#"+e+t)}return null},b.prototype.updateScheduleFields=function(e,t,i){var a,n,r,s=this.parent,o=s.element.id,l=ne.getValue(i,s.columnMapping),d=s.columnByField[l],h=this.parent.taskFields;d&&("stringedit"===d.editType?(a=e.querySelector("#"+o+l))&&(n=a.ej2_instances[0])&&(r=ne.isNullOrUndefined(d.edit)||ne.isNullOrUndefined(d.edit.read)?ne.isNullOrUndefined(d.valueAccessor)?this.parent.dataOperation.getDurationString(t[i],t.durationUnit):d.valueAccessor(l,s.editModule.dialogModule.editedRecord,d):d.edit.read(),n.value!==r.toString()&&h[i]===l?(n.value=r,n.dataBind()):h.startDate!==l&&h.endDate!==l&&h.baselineStartDate!==l&&h.baselineEndDate!==l||(h.startDate===l?n.value=t.startDate.toString():h.endDate===l?n.value=t.endDate.toString():h.baselineStartDate===l?n.value=t.baselineStartDate.toString():h.baselineEndDate===l&&(n.value=t.baselineEndDate.toString()),n.dataBind())):"datepickeredit"===d.editType||"datetimepickeredit"===d.editType?(a=(a=e.querySelector("#"+o+l))||this.getConstraintDateElement(o,l,h))&&(d.editType,s=a.ej2_instances[0])&&(r=t[i],ne.isNullOrUndefined(s.value)&&!ne.isNullOrUndefined(r)||ne.isNullOrUndefined(r)&&!ne.isNullOrUndefined(s.value)||s.value!==r&&!ne.isNullOrUndefined(s.value)&&!ne.isNullOrUndefined(r)&&s.value.toString()!==r.toString())&&(s.value=r,s.dataBind()):"numericedit"===d.editType&&(n=e.querySelector("#"+o+l).ej2_instances[0],r=t[i],ne.isNullOrUndefined(r)||n.value===r||(n.value=r,n.dataBind())))},b.prototype.validateDuration=function(e,t){var i,a=e.ganttProperties;this.dialogEditValidationFlag||(t||ne.isNullOrUndefined(a.startDate)||j(a)||!ne.isNullOrUndefined(a.duration)?t||!j(a)&&ne.isNullOrUndefined(a.startDate)?t&&!ne.isNullOrUndefined(a.baselineStartDate)?(0!==e.ganttProperties.baselineDuration&&(i=this.parent.dateValidationModule.checkStartDate(a.baselineStartDate,void 0,void 0,void 0,!0),this.parent.setRecordValue("baselineStartDate",i,a,!0),this.parent.taskFields.baselineStartDate)&&this.parent.dataOperation.updateMappingData(e,"baselineStartDate"),this.parent.dateValidationModule.calculateEndDate(e,t)):(j(a)||ne.isNullOrUndefined(a.endDate))&&ne.isNullOrUndefined(a.endDate)&&!ne.isNullOrUndefined(a.baselineEndDate)||this.parent.dateValidationModule.calculateStartDate(e,t):(e.ganttProperties.isMilestone&&0!==e.ganttProperties.duration&&(i=this.parent.dateValidationModule.checkStartDate(a.startDate),this.parent.setRecordValue("startDate",i,a,!0),this.parent.taskFields.startDate)&&this.parent.dataOperation.updateMappingData(e,"startDate"),this.parent.dateValidationModule.calculateEndDate(e)):(this.parent.setRecordValue("endDate",null,a,!0),this.parent.setRecordValue("isMilestone",!1,a,!0)),t||(i=0===a.duration,this.parent.setRecordValue("isMilestone",i,a,!0)),this.dialogEditValidationFlag=!0)},b.prototype.validateStartDate=function(e,t){var i=e.ganttProperties,a=this.parent.taskFields,n=this.parent.dateValidationModule.getFieldMappings(t),r=n.startdateField,s=n.enddateField,n=n.durationField;this.dialogEditValidationFlag||(ne.isNullOrUndefined(i[r])?(this.parent.setRecordValue(n,null,i,!0),t||(this.parent.setRecordValue("isMilestone",!1,i,!0),this.parent.allowUnscheduledTasks&&ne.isNullOrUndefined(a.endDate)&&this.parent.setRecordValue("endDate",null,i,!0))):j(i)||t?ne.isNullOrUndefined(a[n])?this.parent.dateValidationModule.calculateDuration(e,t):(ne.isNullOrUndefined(a[s]),this.parent.dateValidationModule.calculateEndDate(e,t)):ne.isNullOrUndefined(i.endDate)?ne.isNullOrUndefined(i.duration)||this.parent.dateValidationModule.calculateEndDate(e):this.parent.dateValidationModule.calculateDuration(e),this.dialogEditValidationFlag=!0)},b.prototype.validateEndDate=function(e,t){var i,a,n,r=e.ganttProperties,s=this.parent.taskFields;this.dialogEditValidationFlag||(i=(n=this.parent.dateValidationModule.getFieldMappings(t)).startdateField,a=n.enddateField,n=n.durationField,ne.isNullOrUndefined(r[a])?(this.parent.setRecordValue(n,null,r,!0),t||this.parent.setRecordValue("isMilestone",!1,r,!0)):j(r)||t?ne.isNullOrUndefined(s[n])?this.parent.dateValidationModule.calculateDuration(e,t):ne.isNullOrUndefined(r[i])?this.parent.dateValidationModule.calculateStartDate(e,t):(t||!ne.isNullOrUndefined(r.segments)&&0<r.segments.length&&(r.segments=this.parent.editModule.cellEditModule.validateEndDateWithSegments(r)),this.parent.dateValidationModule.calculateDuration(e,t)):ne.isNullOrUndefined(r[n])?ne.isNullOrUndefined(r[i])||this.parent.dateValidationModule.calculateDuration(e,t):this.parent.dateValidationModule.calculateStartDate(e,t),this.dialogEditValidationFlag=!0)},b.prototype.updateConstraintDate=function(e,t){var i=e.constraintType;i===k.ConstraintType.StartNoEarlierThan||i===k.ConstraintType.StartNoLaterThan?this.parent.setRecordValue("constraintDate",e.startDate,e,!0):i!==k.ConstraintType.FinishNoEarlierThan&&i!==k.ConstraintType.FinishNoLaterThan||this.parent.setRecordValue("constraintDate",e.endDate,e,!0),this.parent.dataOperation.updateMappingData(t,"constraintDate")},b.prototype.validateScheduleValuesByCurrentField=function(e,t,i,a){var n,r,s,o,l,d,h,p,u=this.parent,c=i.ganttProperties,g=u.taskFields;return g.duration!==e&&g.baselineDuration!==e||(h=!ne.isNullOrUndefined(t)&&""!==t&&0<=parseFloat(t),r=/^[^\d.-]+$/.test(t),n=""===t,d=a?g.baselineDuration:g.duration,s=(l=this.parent.dateValidationModule.getFieldMappings(a)).startdateField,o=l.enddateField,l=l.durationField,h?(u.dataOperation.updateDurationValue(t,c,a),this.parent.setRecordValue(d,t,i),this.parent.setRecordValue("taskData."+d,c[l],i),a||!c.isMilestone||ne.isNullOrUndefined(this.parent.editModule.cellEditModule)||((p={}).data=i,this.parent.editModule.cellEditModule.updateDates(p)),this.validateDuration(i,a)):(a&&h||u.allowUnscheduledTasks)&&(c[s]&&c[o]&&c[s].getTime()>c[o].getTime()||-1!==t.indexOf("-")?(this.parent.setRecordValue(l,0,c,!0),c[o]&&this.parent.setRecordValue(s,c[o],c,!0)):n?(this.parent.setRecordValue(l,null,c,!0),c[s]&&c[s]&&this.parent.setRecordValue(o,null,c,!0)):(r&&(d=a?g.baselineDuration:g.duration,this.parent.trigger("actionFailure",{error:"The provided value for the "+d+" field is invalid. Please ensure it contains only valid numeric values."})),this.parent.setRecordValue(l,c[l],c,!0))),a)||this.parent.editModule.updateResourceRelatedFields(i,"duration"),g.startDate!==e&&g.baselineStartDate!==e||(""!==t?(h=a?"baselineStartDate":"startDate",n=this.parent.dateValidationModule.getDateFromFormat(t),n=this.parent.dateValidationModule.checkStartDate(n,c,void 0,void 0,a),this.parent.setRecordValue(h,n,c,!0),this.validateStartDate(i,a),this.parent.taskFields.constraintType&&this.updateConstraintDate(c,i)):a||!u.allowUnscheduledTasks||i.hasChildRecords||(this.parent.setRecordValue("startDate",null,c,!0),this.parent.setRecordValue("duration",null,c,!0),this.parent.setRecordValue("isMilestone",!1,c,!0))),g.endDate!==e&&g.baselineEndDate!==e||(s=(r=this.parent.dateValidationModule.getFieldMappings(a)).startdateField,o=r.enddateField,l=r.durationField,""!==t?(d=this.parent.dateValidationModule.getDateFromFormat(t),h=this.parent.getCurrentDayEndTime(d),0===d.getHours()&&86400!==h&&this.parent.dateValidationModule.setTime(h,d),!ne.isNullOrUndefined(c[s])&&!ne.isNullOrUndefined(c[o])&&!ne.isNullOrUndefined(d)&&c[s].getTime()>d.getTime()&&(d=c[o]),d=this.parent.dateValidationModule.checkEndDate(d,c,void 0,a),(ne.isNullOrUndefined(c[s])||d.getTime()>=c[s].getTime())&&this.parent.setRecordValue(o,d,c,!0),this.validateEndDate(i,a),a||!c.isMilestone||ne.isNullOrUndefined(this.parent.editModule.cellEditModule)||((p={}).data=i,this.parent.editModule.cellEditModule.updateDates(p))):u.allowUnscheduledTasks&&!a&&(this.parent.setRecordValue(o,null,c,!0),this.parent.setRecordValue(l,null,c,!0),a||this.parent.setRecordValue("isMilestone",!1,c,!0))),g.work!==e||ne.isNullOrUndefined(t)||""===t||(this.parent.setRecordValue("work",t,c,!0),this.parent.editModule.updateResourceRelatedFields(i,"work"),this.validateDuration(i)),e===g.type&&(this.parent.setRecordValue("taskType",t,c,!0),t)&&"FixedDuration"===t&&0===c.duration&&this.parent.editModule.updateResourceRelatedFields(i,"work"),g.manual===e&&this.parent.editModule.updateTaskScheduleModes(i),!0},b.prototype.getSegmentsModel=function(r){for(var s=this,e=this.parent.taskFields,e=(!ne.isNullOrUndefined(r)&&0!==r.length||(r=[],ne.isNullOrUndefined(e.startDate)||r.push(this.parent.taskFields.startDate),ne.isNullOrUndefined(e.endDate)||r.push(this.parent.taskFields.endDate),ne.isNullOrUndefined(e.duration)||r.push(this.parent.taskFields.duration),ne.isNullOrUndefined(e.id))||r.push(this.parent.taskFields.id),{}),t=(e.editSettings={allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal",newRowPosition:"Bottom"},e.locale=this.parent.locale,e.dataSource=[],e.rowHeight=this.parent.isAdaptive?48:null,e.toolbar=[{id:this.parent.element.id+"SegmentsTabContainer_add",prefixIcon:"e-add",tooltipText:this.localeObj.getConstant("add"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("add")},{id:this.parent.element.id+"SegmentsTabContainer_delete",prefixIcon:"e-delete",tooltipText:this.localeObj.getConstant("delete"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("delete")}],[]),i=this,a=0;a<r.length;a++)!function(a){var e={},n="General";switch(r[a]){case i.parent.taskFields.id:e={field:r[a],visible:!1,isPrimaryKey:!0},t.push(e);break;case i.parent.taskFields.startDate:case i.parent.taskFields.endDate:e={field:r[a],headerText:i.localeObj.getConstant(r[a]===i.parent.taskFields.startDate?"startDate":"endDate"),editType:"stringedit",width:"200px",edit:{write:function(e){t=(ne.isNullOrUndefined(s.beforeOpenArgs[n])||ne.isNullOrUndefined(s.beforeOpenArgs[n][r[a]])?(t=s.getGeneralColumnFields(),s.getFieldsModel(t)):s.beforeOpenArgs[n])[r[a]];var t,i=e.rowData[e.column.field];ne.setValue("value",i,t),new s.inputs[s.parent.columnByField[r[a]].editType](t).appendTo(e.element)},read:function(e){return e.ej2_instances[0].value}},format:i.parent.getDateFormat()},r[a]===i.parent.taskFields.startDate&&(e.validationRules={required:!0}),t.push(e);break;case i.parent.taskFields.duration:e={field:r[a],headerText:i.localeObj.getConstant(r[a].toLocaleLowerCase()),editType:"stringedit",width:"100px",edit:{write:function(e){(t=(ne.isNullOrUndefined(s.beforeOpenArgs[n])||ne.isNullOrUndefined(s.beforeOpenArgs[n][r[a]])?(t=s.getGeneralColumnFields(),s.getFieldsModel(t)):s.beforeOpenArgs[n])[r[a]]).floatLabelType="Never";var t,i=e.rowData[e.column.field];ne.isNullOrUndefined(i)?ne.setValue("value",null,t):ne.setValue("value",i,t),ne.setValue("value",i,t),new B.TextBox(t).appendTo(e.element)},read:function(e){return e.ej2_instances[0].value.toString()}}},t.push(e)}}(a);return e.columns=t,e.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"153px",e},b.prototype.getGridColumnByField=function(e,t){for(var i,a=0;a<t.length;a++)t[a].field===e&&(i=t[a]);return i},b.prototype.updateSegmentField=function(e,t,i){var a,n=this.parent.editModule.dialogModule.dialog,r=ne.getValue("Segments",this.beforeOpenArgs),r=this.getGridColumnByField(e,r.columns),s=this.parent.element.id,i=i[e];"stringedit"!==r.editType&&"datepickeredit"!==r.editType||(a=n.querySelector("#"+s+"SegmentsTabContainer"+e).ej2_instances[0]),ne.isNullOrUndefined(a.value)||ne.isNullOrUndefined(i)||a.value.toString()===i.toString()||(a.value=i,a.dataBind())},b.prototype.validateSegmentFields=function(e,t,i,a){var n,r=this.parent.taskFields;ne.isNullOrUndefined(r.duration)||r.duration.toLowerCase()!==t.toLowerCase()||ne.isNullOrUndefined(i)||""===i||(this.selectedSegment[r.duration]=Number(i),n=e.dataOperation.getEndDate(this.selectedSegment[r.startDate],Number(i),this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1),n=e.dataOperation.checkEndDate(n,this.editedRecord.ganttProperties,!1),this.selectedSegment[r.endDate]=n),ne.isNullOrUndefined(r.startDate)||r.startDate.toLowerCase()!==t.toLowerCase()||""!==i&&(e=this.parent.dateValidationModule.getDateFromFormat(i),e=this.parent.dateValidationModule.checkStartDate(e),this.selectedSegment[r.startDate]=e,ne.isNullOrUndefined(r.endDate)||(this.selectedSegment.endDate=this.parent.dataOperation.getEndDate(e,this.selectedSegment[r.duration],this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1))),ne.isNullOrUndefined(r.endDate)||r.endDate.toLowerCase()!==t.toLowerCase()||""!==i&&(n=this.parent.dateValidationModule.getDateFromFormat(i),e=this.parent.getCurrentDayEndTime(n),0===n.getHours()&&86400!==e&&this.parent.dateValidationModule.setTime(e,n),n=this.parent.dateValidationModule.checkEndDate(n,this.editedRecord.ganttProperties),this.selectedSegment[r.endDate]=n,this.selectedSegment[r.duration]=this.parent.dataOperation.getDuration(this.selectedSegment[r.startDate],this.selectedSegment[r.endDate],this.editedRecord.ganttProperties.durationUnit,!0,!1,!0)),ne.isNullOrUndefined(r.startDate)||this.updateSegmentField(r.startDate,a,this.selectedSegment),ne.isNullOrUndefined(r.endDate)||this.updateSegmentField(r.endDate,a,this.selectedSegment),ne.isNullOrUndefined(r.duration)||this.updateSegmentField(r.duration,a,this.selectedSegment)},b.prototype.getPredecessorModel=function(e){!ne.isNullOrUndefined(e)&&0!==e.length||(e=["ID","Name","Type","Offset","UniqueId"]);var t={editSettings:{allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal"}};t.locale=this.parent.locale,t.dataSource=[],t.rowHeight=this.parent.isAdaptive?48:null,t.toolbar=[{id:this.parent.element.id+"DependencyTabContainer_add",prefixIcon:"e-add",tooltipText:this.localeObj.getConstant("add"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("add")},{id:this.parent.element.id+"DependencyTabContainer_delete",prefixIcon:"e-delete",tooltipText:this.localeObj.getConstant("delete"),align:"Right",text:this.parent.isAdaptive?"":this.localeObj.getConstant("delete")}];for(var i=[],a=0;a<e.length;a++){var n={};"id"===e[a].toLowerCase()?(n={field:"id",headerText:this.localeObj.getConstant("id"),allowEditing:!1,width:"70px"},i.push(n)):"name"===e[a].toLowerCase()?(n={field:"name",headerText:this.localeObj.getConstant("name"),editType:"stringedit",width:"250px",validationRules:{required:!0}},i.push(n)):"type"===e[a].toLowerCase()?(n={field:"type",headerText:this.localeObj.getConstant("type"),editType:"dropdownedit",dataSource:this.types,foreignKeyField:"id",foreignKeyValue:"text",defaultValue:"FS",validationRules:{required:!0},width:"150px"},i.push(n)):"offset"===e[a].toLowerCase()?(n={field:"offset",headerText:this.localeObj.getConstant("offset"),editType:"stringedit",defaultValue:this.parent.dataOperation.getDurationString(0,this.beforeOpenArgs.rowData.ganttProperties.durationUnit),validationRules:{required:!0},width:"100px"},i.push(n)):"uniqueid"===e[a].toLowerCase()&&(n={field:"uniqueId",isPrimaryKey:!0,visible:!1,defaultValue:(Q++).toString()},i.push(n))}return t.columns=i,t.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"153px",t},b.prototype.getResourcesModel=function(e){for(var t=this.parent.resourceFields,i=(!ne.isNullOrUndefined(e)&&0!==e.length||(e=[t.id,t.name,t.unit,t.group]),{allowFiltering:!0,treeColumnIndex:-1,childMapping:"",editSettings:{allowEditing:!0,mode:"Cell"},locale:this.parent.locale,allowSelection:!0,rowHeight:this.parent.isAdaptive?48:null,filterSettings:{type:"Menu"},selectionSettings:{checkboxOnly:!0,checkboxMode:"Default",persistSelection:!0,type:"Multiple"}}),a=[{type:"checkbox",allowEditing:!1,allowSorting:!1,allowFiltering:!1,width:60}],n=0;n<e.length;n++){var r={};e[n]===t.id?(r={field:t.id,headerText:this.localeObj.getConstant("id"),isPrimaryKey:!0,width:"100px",allowEditing:!1},a.push(r)):e[n]===t.name?(r={field:t.name,headerText:this.localeObj.getConstant("name"),allowEditing:!1},a.push(r)):e[n]===t.unit?(r={field:t.unit,headerText:this.localeObj.getConstant("unit"),editType:"numericedit",edit:{params:{min:0}}},a.push(r)):e[n]!==t.group||ne.isNullOrUndefined(t.group)||(r={field:t.group,headerText:this.localeObj.getConstant("group"),allowEditing:!1},a.push(r))}return i.columns=a,i.height=this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"196px",i},b.prototype.getNotesModel=function(e){return!ne.isNullOrUndefined(e)&&0!==e.length||(e=["Bold","Italic","Underline","StrikeThrough","FontName","FontSize","FontColor","BackgroundColor","LowerCase","UpperCase","|","Alignments","OrderedList","UnorderedList","Outdent","Indent","|","CreateTable","CreateLink","|","ClearFormat","Print","|","Undo","Redo"]),{placeholder:this.localeObj.getConstant("writeNotes"),toolbarSettings:{items:e},height:this.parent.isAdaptive||this.parent.enableAdaptiveUI?"100%":"auto",locale:this.parent.locale}},b.prototype.createDivElement=function(e,t){return ne.createElement("div",{className:e,id:t})},b.prototype.createFormElement=function(e,t){return ne.createElement("form",{className:e,id:t})},b.prototype.createInputElement=function(e,t,i,a){return ne.createElement(a||"input",{className:e,attrs:{type:"text",id:t,name:i,title:i}})},b.prototype.renderTabItems=function(){for(var e=this.beforeOpenArgs.tabModel.items,t=0,i=0;i<e.length;i++){var a=e[i];a.content instanceof HTMLElement||("General"===a.content?a.content=this.renderGeneralTab(a.content):"Advanced"===a.content?a.content=this.renderAdvancedTab(a.content):"Dependency"===a.content?(this.editedRecord.hasChildRecords&&!this.parent.allowParentDependency&&(a.disabled=!0),a.content=this.renderPredecessorTab(a.content)):"Resources"===a.content?a.content=this.renderResourceTab(a.content):a.content==="Custom"+t?(a.content=this.renderCustomTab(a.content,!0),t++):"Notes"===a.content?a.content=this.renderNotesTab(a.content):"Segments"===a.content&&(this.editedRecord.hasChildRecords&&(a.disabled=!0),a.content=this.renderSegmentsTab(a.content)))}},b.prototype.segmentGridActionBegin=function(e){var t=this.parent.taskFields,i=this.beforeOpenArgs.Segments;if("add"===e.requestType||"beginEdit"===e.requestType||"save"===e.requestType){var a,n,r,s=i.dataSource,o=ne.getValue("rowData",e),l=this.beforeOpenArgs.rowData.ganttProperties.startDate;if(ne.isNullOrUndefined(l)||"add"===e.requestType&&(l={},a=ne.getValue(this.parent.taskFields.startDate,o),n=this.parent.taskFields.endDate?ne.getValue(this.parent.taskFields.endDate,o):null,r=void 0,ne.isNullOrUndefined(this.parent.taskFields.duration)||(r=ne.getValue(this.parent.taskFields.duration,o)),(o=!ne.isNullOrUndefined(s)&&0<s.length?ne.isNullOrUndefined(t.endDate)||ne.isNullOrUndefined(s[0][t.endDate])?new Date(ne.getValue(t.startDate,s[0]).getTime()):new Date(ne.getValue(t.endDate,s[0]).getTime()):!ne.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)&&new Date(this.beforeOpenArgs.rowData.ganttProperties.startDate.getTime())).setHours(0,0,0,0),!ne.isNullOrUndefined(s)&&0<s.length&&o.setDate(o.getDate()+2),a=this.parent.dataOperation.checkStartDate(o),n=this.parent.dateValidationModule.getDateFromFormat(a),o=this.parent.getCurrentDayEndTime(n),0===n.getHours()&&86400!==o&&this.parent.dateValidationModule.setTime(o,n),n=!ne.isNullOrUndefined(t.endDate)&&!ne.isNullOrUndefined(s)&&s.length<=0?this.beforeOpenArgs.rowData.ganttProperties.endDate:n,o=this.beforeOpenArgs.rowData.ganttProperties,r=a.getTime()===n.getTime()?1:this.parent.dataOperation.getDuration(a,n,o.durationUnit,!0,!1,!0),l=ne.isNullOrUndefined(t.duration)?((s={})[t.startDate]=a,s[t.endDate]=n,s):((o={})[t.startDate]=a,o[t.endDate]=n,o[t.duration]=r,o),e.rowData=l),"save"===e.requestType){for(var d=i.dataSource,h=this.parent.taskFields.id,p=d.length;d.some(function(e){return e[h]===p});)p++;ne.isNullOrUndefined(e.data[h])&&(e.data[h]=p,e.rowData[h]=p)}this.selectedSegment=e.rowData}},b.prototype.getDialogTabIndex=function(i){var a;return this.isEdit?this.parent.editDialogFields.map(function(e,t){e.type===i&&(a=t)}):this.parent.addDialogFields.map(function(e,t){e.type===i&&(a=t)}),a},b.prototype.setInjected=function(e,t,i,a,n,r,s){if(!ne.isNullOrUndefined(e)&&!ne.isNullOrUndefined(e.additionalParams))for(var o in t=e.additionalParams)if(Object.prototype.hasOwnProperty.call(t,o))switch(o){case"allowFiltering":i.Inject(w.Filter);break;case"allowSorting":i.Inject(w.Sort);break;case"allowPaging":i.Inject(w.Page);break;case"allowGrouping":i.Inject(w.Group);break;case"editSettings":i.Inject(w.Edit);break;case"aggregates":i.Inject(w.Aggregate);break;case"showColumnChooser":i.Inject(w.ColumnChooser);break;case"showColumnMenu":i.Inject(w.ColumnMenu);break;case"contextMenuItems":i.Inject(w.ContextMenu);break;case"allowResizing":i.Inject(w.Resize);break;case"allowReordering":i.Inject(w.Reorder);break;case"detailTemplate":i.Inject(w.DetailRow);break;case"allowRowDragAndDrop":i.Inject(w.RowDD);break;case"searchSettings":i.Inject(w.Search);break;case"selectionSettings":i.Inject(Selection);break;case"enableVirtualization":i.Inject(T.VirtualScroll);break;case"toolbar":t.toolbar.map(function(e){switch(e){case"Search":i.Inject(w.Search);break;case"Print":i.Inject(w.Print);break;case"PdfExport":i.Inject(w.PdfExport);break;case"ExcelExport":i.Inject(w.ExcelExport)}}),r.toolbar,i.Inject(w.Toolbar);break;case"columns":r.columns}},b.prototype.renderSegmentsTab=function(e){var i=this,t=this.parent,a=this.beforeOpenArgs[e],n=(a.enableAdaptiveUI=this.parent.enableAdaptiveUI,this.beforeOpenArgs.rowData),r=[],n=((r=this.isEdit?ne.isNullOrUndefined(n.taskData[this.parent.taskFields.segments])?[]:n.taskData[this.parent.taskFields.segments]:r).map(function(e,t){ne.isNullOrUndefined(e[i.parent.taskFields.id])&&(e[i.parent.taskFields.id]=t)}),a.dataSource=r,a.actionBegin=this.segmentGridActionBegin.bind(this),this.getDialogTabIndex("Segments")),r=(this.isEdit?this.isEdit&&(s=this.parent.editDialogFields[n]):s=this.parent.addDialogFields[n],[]),n=[],s=(ne.isNullOrUndefined(s)||ne.isNullOrUndefined(s.additionalParams)||(o=s.additionalParams),this.setInjected(s,o,w.Grid,void 0,r,a,n),w.Grid.Inject(w.Edit,w.Page,w.Toolbar,w.ForeignKey),(a=wa({},a,o)).toolbar=r.concat(a.toolbar),this.updateColumns(n,a.columns)),o=(a.columns=s,new w.Grid(a)),r=this.createDivElement("",t.element.id+""+e+"TabContainer");return o.appendTo(r),r},b.prototype.renderGeneralTab=function(e,t){var r,i=this.parent,s=[],o=this.beforeOpenArgs[e],l=t?this.createDivElement("e-edit-form-row",i.element.id+""+e+"TabContainer"):this.createFormElement("e-edit-form-row",i.element.id+""+e+"TabContainer");this.parent.enableAdaptiveUI&&(l.style.height="100%",(h=ne.createElement("table",{className:"e-table"})).style.width="100%",r=ne.createElement("tbody"));for(var t=l.id,d=this,a=0,n=Object.keys(o);a<n.length;a++)!function(e){if(!1===d.parent.columnByField[e].visible||"WBSCode"===e||"WBSPredecessor"===e)return;var t,i=d.parent.columnByField[e],a=o[e],n=void 0,n=i.editTemplate?(t=d.createDivElement("e-edit-form-column"),a.forEach(function(e){return t.appendChild(e)}),t):d.renderInputElements(a,i);(d.parent.enableAdaptiveUI?r:l).appendChild(n),s.push(e)}(n[a]);this.parent.enableAdaptiveUI&&(h.appendChild(r),l.appendChild(h)),t!==l.id&&(l.id=t);i=this.getDialogTabIndex("General"),e=[];if(this.isEdit||ne.isNullOrUndefined(this.parent.addDialogFields[i])||ne.isNullOrUndefined(this.parent.addDialogFields[i].fields)?!this.isEdit||ne.isNullOrUndefined(this.parent.editDialogFields[i])||ne.isNullOrUndefined(this.parent.editDialogFields[i].fields)||(e=this.parent.editDialogFields[i].fields):e=this.parent.addDialogFields[i].fields,!ne.isNullOrUndefined(e)){var h=e.filter(function(e){return!s.includes(e)});if(!ne.isNullOrUndefined(h))for(var p=h,u=0;u<=p.length-1;u++){var c,g=document.getElementById(p[u]);ne.isNullOrUndefined(g)||(g=g.innerHTML,(c=ne.createElement("div")).innerHTML=g,l.appendChild(c.children[0]))}}return l},b.prototype.renderAdvancedTab=function(e,t){var r,i=this.parent,s=[],o=this.beforeOpenArgs[e],l=t?this.createDivElement("e-edit-form-row",i.element.id+""+e+"TabContainer"):this.createFormElement("e-edit-form-row",i.element.id+""+e+"TabContainer");this.parent.enableAdaptiveUI&&(l.style.height="100%",(h=ne.createElement("table",{className:"e-table"})).style.width="100%",r=ne.createElement("tbody"));for(var t=l.id,d=this,a=0,n=Object.keys(o);a<n.length;a++)!function(e){if(!1===d.parent.columnByField[e].visible)return;var t,i=d.parent.columnByField[e],a=o[e],n=void 0,n=i.editTemplate?(t=d.createDivElement("e-edit-form-column"),a.forEach(function(e){return t.appendChild(e)}),t):d.renderInputElements(a,i);(d.parent.enableAdaptiveUI?r:l).appendChild(n),s.push(e)}(n[a]);this.parent.enableAdaptiveUI&&(h.appendChild(r),l.appendChild(h)),t!==l.id&&(l.id=t);i=this.getDialogTabIndex("Advanced"),e=[];if(this.isEdit||ne.isNullOrUndefined(this.parent.addDialogFields[i])||ne.isNullOrUndefined(this.parent.addDialogFields[i].fields)?!this.isEdit||ne.isNullOrUndefined(this.parent.editDialogFields[i])||ne.isNullOrUndefined(this.parent.editDialogFields[i].fields)||(e=this.parent.editDialogFields[i].fields):e=this.parent.addDialogFields[i].fields,!ne.isNullOrUndefined(e)){var h=e.filter(function(e){return!s.includes(e)});if(!ne.isNullOrUndefined(h))for(var p=h,u=0;u<=p.length-1;u++){var c,g=document.getElementById(p[u]);ne.isNullOrUndefined(g)||(g=g.innerHTML,(c=ne.createElement("div")).innerHTML=g,l.appendChild(c.children[0]))}}return l},b.prototype.isCheckIsDisabled=function(e){var t,i,a=!1;if(!1===e.allowEditing||e.isPrimaryKey||this.parent.readOnly)if(-1!==this.parent.customColumns.indexOf(e.field))a=!0;else if(e.field===this.parent.taskFields.baselineStartDate||e.field===this.parent.taskFields.baselineEndDate||e.field===this.parent.taskFields.work||e.field===this.parent.taskFields.type||e.field===this.parent.taskFields.id||e.field===this.parent.taskFields.name||e.field===this.parent.taskFields.duration||e.field===this.parent.taskFields.progress||e.field===this.parent.taskFields.startDate||e.field===this.parent.taskFields.endDate){for(var n=0;n<this.parent.currentViewData.length;n++)if(!ne.isNullOrUndefined(this.parent.currentViewData[n].ganttProperties.taskId)){t=this.parent.currentViewData[n].ganttProperties.taskId;break}a="string"!=typeof t}return this.isEdit&&(e.field===this.parent.taskFields.id&&(a=!0),this.editedRecord.hasChildRecords)&&(e.field===this.parent.taskFields.endDate&&(!ne.isNullOrUndefined(this.editedRecord[this.parent.taskFields.manual])&&!1===this.editedRecord[this.parent.taskFields.manual]||"Auto"===this.parent.taskMode)||e.field===this.parent.taskFields.duration||e.field===this.parent.taskFields.progress||e.field===this.parent.taskFields.work||e.field===this.parent.taskFields.type)&&(a=!0),this.editedRecord.ganttProperties.isAutoSchedule||-1!==[(i=this.parent.taskFields).constraintDate,i.constraintType].indexOf(e.field)&&(a=!0),a},b.prototype.isParentValid=function(e){if(0<e.length)for(var t=0;t<e.length;t++){if(e[t].uniqueID===this.beforeOpenArgs.rowData.uniqueID){this.isValidData=!1;break}if(e[t].hasChildRecords&&this.isParentValid(e[t].childRecords),!this.isValidData)break}return this.isValidData},b.prototype.renderPredecessorTab=function(e){var i=this,t=this.parent,a=this.beforeOpenArgs[e],n=this.parent.columnByField[this.parent.taskFields.dependency],n=((!1===n.allowEditing||n.isPrimaryKey||this.parent.readOnly)&&(a.editSettings.allowEditing=!1,a.editSettings.allowAdding=!1,a.editSettings.allowDeleting=!1),this.beforeOpenArgs.rowData),r=[];this.taskNameCollection(),this.isEdit&&(r=this.predecessorEditCollection(n),this.updatePredecessorDropDownData(n)),n[this.parent.taskFields.dependency]&&(s=n[this.parent.taskFields.dependency].split(",").length),0!==this.preTableCollection.length&&this.preTableCollection.length!==s||(a.editSettings.allowAdding=!1),a.actionComplete=this.gridActionComplete.bind(this),a.dataSource=r,a.enableAdaptiveUI=this.parent.enableAdaptiveUI,a.enableRtl=this.parent.enableRtl,a.locale=this.parent.locale,a.actionBegin=this.gridActionBegin.bind(this);a.columns[1].edit={write:function(e){"add"===ne.getValue("requestType",e)&&ne.setValue("rowData.uniqueId",Q++,e);new U.ComboBox({dataSource:new D.DataManager(i.idCollection),popupHeight:"180px",allowCustom:!1,enableRtl:i.parent.enableRtl,fields:{value:"text"},value:e.rowData.name,change:function(e){var t=ne.closest(e.element,"tr").querySelector("#"+i.parent.element.id+"DependencyTabContainerid");t&&(ne.isNullOrUndefined(e.itemData)||ne.isNullOrUndefined(e.item)?t.value="":t.value=e.itemData.id)},autofill:!0}).appendTo(e.element)},read:function(e){return e.ej2_instances[0].value}};var n=this.getDialogTabIndex("Dependency"),s=(this.isEdit?this.isEdit&&(o=this.parent.editDialogFields[n]):o=this.parent.addDialogFields[n],[]),r=[],n=(ne.isNullOrUndefined(o)||ne.isNullOrUndefined(o.additionalParams)||(l=o.additionalParams),this.setInjected(o,l,w.Grid,void 0,s,a,r),w.Grid.Inject(w.Edit,w.Page,w.Toolbar,w.ForeignKey),(a=wa({},a,l)).toolbar=a.toolbar.concat(s),this.updateColumns(r,a.columns)),o=(a.columns=n,new w.Grid(a)),l=this.createDivElement("e-dependent-div",t.element.id+""+e+"TabContainer");return o.appendTo(l),l},b.prototype.updateColumns=function(i,e){var a={};return i.forEach(function(e){"object"==typeof e&&(a[e.field]=e)}),e.forEach(function(e){var t;"object"==typeof e&&(t=e.field,a[t]?Object.assign(a[t],e):i.push(e))}),i},b.prototype.gridActionBegin=function(n){var r=this,e=this.beforeOpenArgs.Dependency;if("add"===n.requestType||"beginEdit"===n.requestType)for(var s="add"!==n.requestType,o=(this.idCollection=ne.extend([],[],this.preTableCollection,!0),e.dataSource),t=this,i=0;i<=o.length;i++)!function(a){t.idCollection.forEach(function(e,t){var i;e.id===ne.getValue("id",o[a])&&(i=ne.getValue("rowData",n),s&&ne.getValue("id",i)===e.id||r.idCollection.splice(r.idCollection.indexOf(e),1))})}(i)},b.prototype.gridActionComplete=function(e){var t;"save"===e.requestType&&(t=this.parent.editModule.dialogModule.dialog.querySelector("#"+this.parent.element.id+"DependencyTabContainer"),ne.isNullOrUndefined(t)||ne.isNullOrUndefined(e.rows)||e.rows.length!==this.preTableCollection.length||(e=t.ej2_instances[0])&&(e.editSettings.allowAdding=!1))},b.prototype.updateResourceCollection=function(e,t){if(!ne.isNullOrUndefined(e.data)&&Object.keys(e.data).length){t=document.querySelector("#"+t).ej2_instances[0];if(!ne.isNullOrUndefined(t)&&0<t.getSelectedRecords().length){for(var i=t.getSelectedRecords(),a=void 0,n=[],a=0;a<i.length;a++){var r=i[a];ne.isNullOrUndefined(r.taskData)||ne.isNullOrUndefined(r.taskData[this.parent.resourceFields.unit])||ne.isNullOrUndefined(e.data[this.parent.resourceFields.unit])||r.taskData[this.parent.resourceFields.id]!==e.data[this.parent.resourceFields.id]||(r.taskData[this.parent.resourceFields.unit]=e.data[this.parent.resourceFields.unit]),n.push(i[a].taskData)}this.ganttResources=ne.extend([],n)}else this.ganttResources=[]}else this.ganttResources=[]},b.prototype.renderResourceTab=function(e){var i=this,t=this.parent,a=t.resourceFields,n=this.beforeOpenArgs.rowData,r=(("beforeOpenEditDialog"===this.beforeOpenArgs.requestType&&!ne.isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo])||"beforeOpenAddDialog"===this.beforeOpenArgs.requestType&&!ne.isNullOrUndefined(this.editedRecord[this.parent.taskFields.resourceInfo]))&&"object"==typeof this.editedRecord[this.parent.taskFields.resourceInfo]&&this.parent.setRecordValue("resourceInfo",this.parent.dataOperation.setResourceInfo(this.editedRecord),n.ganttProperties,!0),n.ganttProperties.resourceInfo),s=((D=this.beforeOpenArgs[e]).enableAdaptiveUI=this.parent.enableAdaptiveUI,D.enableRtl=this.parent.enableRtl,D.locale=this.parent.locale,t.element.id+""+e+"TabContainer"),o=[],o=ne.extend([],[],t.resources,!0);if(this.parent.dataOperation.updateResourceUnit(o),!ne.isNullOrUndefined(r))for(var l=void 0,d=r.length,h=void 0,p=o.length,l=0;l<d;l++)for(h=0;h<p;h++)r[l][a.id]===o[h][a.id]&&(o[h][a.unit]=r[l][a.unit]);D.dataSource=o;var u=n.ganttProperties.resourceInfo;if(this.isEdit&&!ne.isNullOrUndefined(u))for(var c=0;c<u.length;c++)this.ganttResources.push(u[c]);else if(!this.isEdit&&!ne.isNullOrUndefined(u))for(c=0;c<u.length;c++)this.ganttResources.push(u[c]);D.actionBegin=function(e){if(e.rowData&&e.columnName===i.parent.resourceFields.unit&&i.editedRecord.ganttProperties.resourceInfo)for(var t=0;t<i.editedRecord.ganttProperties.resourceInfo.length;t++)i.editedRecord.ganttProperties.resourceInfo[t][i.parent.resourceFields.id]===e.rowData[i.parent.resourceFields.id]&&(i.editedRecord.ganttProperties.resourceInfo[t][i.parent.resourceFields.unit]=e.value)},D.rowSelected=function(e){i.updateResourceCollection(e,s),i.currentResources=i.ganttResources},D.rowDeselected=function(e){i.updateResourceCollection(e,s),i.currentResources=i.ganttResources};var g,f,m,e=this.createDivElement("e-resource-div",s),t=this.getDialogTabIndex("Resources"),y=(this.isEdit?this.isEdit&&(g=this.parent.editDialogFields[t]):g=this.parent.addDialogFields[t],[]);if(!ne.isNullOrUndefined(g)&&!ne.isNullOrUndefined(g.additionalParams))for(var c in f=g.additionalParams)if(Object.prototype.hasOwnProperty.call(f,c))switch(c){case"allowFiltering":T.TreeGrid.Inject(T.Filter);break;case"allowSorting":T.TreeGrid.Inject(T.Sort);break;case"allowPaging":T.TreeGrid.Inject(T.Page);break;case"editSettings":T.TreeGrid.Inject(T.Edit);break;case"aggregates":case"showColumnChooser":T.TreeGrid.Inject(T.Aggregate);break;case"showColumnMenu":T.TreeGrid.Inject(w.ColumnMenu);break;case"contextMenuItems":T.TreeGrid.Inject(w.ContextMenu);break;case"allowResizing":T.TreeGrid.Inject(T.Resize);break;case"allowReordering":T.TreeGrid.Inject(T.Reorder);break;case"detailTemplate":T.TreeGrid.Inject(w.DetailRow);break;case"allowRowDragAndDrop":T.TreeGrid.Inject(T.RowDD);break;case"searchSettings":T.TreeGrid.Inject(w.Search);break;case"selectionSettings":T.TreeGrid.Inject(T.Selection);break;case"toolbar":(m=f.toolbar).map(function(e){switch(e){case"Search":T.TreeGrid.Inject(w.Search);break;case"Print":T.TreeGrid.Inject(w.Print);break;case"PdfExport":T.TreeGrid.Inject(w.PdfExport);break;case"ExcelExport":T.TreeGrid.Inject(w.ExcelExport)}}),ne.isNullOrUndefined(m)||(D.toolbar=[],D.toolbar=D.toolbar.concat(m)),T.TreeGrid.Inject(T.Toolbar);break;case"enableVirtualization":T.TreeGrid.Inject(T.VirtualScroll);break;case"columns":y=D.columns}T.TreeGrid.Inject(T.Selection,T.Filter,T.Edit,T.VirtualScroll,T.Toolbar);var D=wa({},D,f),n=this.updateColumns(y,D.columns),k=(D.columns=n,!1),b=(D.showColumnMenu&&(k=D.showColumnMenu,D.showColumnMenu=!1),new T.TreeGrid(D)),t=this.parent.columnByField[this.parent.taskFields.resourceInfo];return(!1===t.allowEditing||t.isPrimaryKey||this.parent.readOnly)&&(b.allowSelection=!1,b.allowFiltering=!1,b.editSettings.allowEditing=!1),b.dataBound=function(){var e;k&&(b.showColumnMenu=!0),1<=i.parent.editDialogFields.length&&"Resources"===i.parent.editDialogFields[0].type&&(e=i.parent.element.id+"ResourcesTabContainer",i.resourceSelection(e))},b.appendTo(e),e},b.prototype.resourceSelection=function(e){var a=this,n=document.querySelector("#"+e).ej2_instances[0],e=(this.parent.triggeredColumnName="",n.getCurrentViewRecords()),r=this.ganttResources;r&&0<r.length&&e.forEach(function(e,t){for(var i=0;i<r.length;i++)e.taskData[a.parent.resourceFields.id]!==r[i][a.parent.resourceFields.id]||ne.isNullOrUndefined(n.selectionModule)||-1!==n.getSelectedRowIndexes().indexOf(t)||n.selectRow(t)})},b.prototype.renderCustomTab=function(e,t){return this.renderGeneralTab(e,t)},b.prototype.renderNotesTab=function(e){var t,i,a=this.parent,n=this.beforeOpenArgs[e],r=(n.enableHtmlSanitizer=this.parent.enableHtmlSanitizer,this.editedRecord.ganttProperties),a=this.createDivElement("",a.element.id+""+e+"TabContainer"),e=this.getDialogTabIndex("Notes"),s=[];if(this.isEdit?this.isEdit&&(t=this.parent.editDialogFields[e]):t=this.parent.addDialogFields[e],!ne.isNullOrUndefined(t)&&!ne.isNullOrUndefined(t.additionalParams))for(var o in i=t.additionalParams)if(Object.prototype.hasOwnProperty.call(i,o))switch(o){case"toolbarSettings":for(var l=0;l<i.toolbarSettings.items.length;l++){var d=i.toolbarSettings.items[l];if(d)switch(d){case"Image":h.RichTextEditor.Inject(h.Image);break;case"CreateTable":h.RichTextEditor.Inject(h.Table);break;case"EmojiPicker":h.RichTextEditor.Inject(h.EmojiPicker);break;case"FileManager":h.RichTextEditor.Inject(h.FileManager);break;case"FormatPainter":h.RichTextEditor.Inject(h.FormatPainter)}}ne.isNullOrUndefined(i.toolbarSettings.items)||(s=n.toolbarSettings.items),h.RichTextEditor.Inject(h.Toolbar);break;case"editorMode":h.RichTextEditor.Inject(h.MarkdownEditor)}h.RichTextEditor.Inject(h.Toolbar,h.Link,h.HtmlEditor,h.QuickToolbar,h.Count,h.Table),n.value=r.notes;e=this.parent.columnByField[this.parent.taskFields.notes];return(!1===e.allowEditing||e.isPrimaryKey||this.parent.readOnly)&&(n.enabled=!1),(n=wa({},n,i)).toolbarSettings.items=s.concat(n.toolbarSettings.items),new h.RichTextEditor(n).appendTo(a),a},b.prototype.renderInputElements=function(e,t){var i,a,n,r,s,o,l,d,h,p,u=this,c=this.parent.element.id,g=this.editedRecord,f=this.createDivElement("e-edit-form-column"),m=(this.parent.enableAdaptiveUI&&(i=ne.createElement("tr"),a=ne.createElement("td"),f.style.width="100%"),{column:t,data:g});return ne.isNullOrUndefined(t.edit)||ne.isNullOrUndefined(t.edit.create)||!ne.isNullOrUndefined(t.edit.params)?n=this.createInputElement("",c+""+t.field,t.field):((n="string"==typeof(h=t.edit.create)?(h=w.getObject(h,window))(m):t.edit.create(m)).className="",n.setAttribute("type","text"),n.setAttribute("id",c+""+t.field),n.setAttribute("name",t.field),n.setAttribute("title",t.field)),f.appendChild(n),e.enabled=ne.isNullOrUndefined(e.enabled)?!this.isCheckIsDisabled(t):e.enabled,t.field===this.parent.taskFields.constraintType&&g.hasChildRecords&&(r=this.parent.treeGridModule.getLocalizedConstraintTypeText("AsSoonAsPossible"),s=this.parent.treeGridModule.getLocalizedConstraintTypeText("StartNoEarlierThan"),o=this.parent.treeGridModule.getLocalizedConstraintTypeText("FinishNoLaterThan"),e.dataSource=e.dataSource.filter(function(e){e=e.text;return e===r||e===s||e===o})),t.field===this.parent.taskFields.duration?ne.isNullOrUndefined(t.valueAccessor)?ne.isNullOrUndefined(t.edit)&&(l=g.ganttProperties,e.value=this.parent.dataOperation.getDurationString(l.duration,l.durationUnit)):"string"==typeof t.valueAccessor?(d=w.getObject(t.valueAccessor,window),e.value=d(t.field,g,t)):e.value=t.valueAccessor(t.field,g,t):t.field===this.parent.taskFields.baselineDuration?ne.isNullOrUndefined(t.valueAccessor)?ne.isNullOrUndefined(t.edit)&&(l=g.ganttProperties,e.value=this.parent.dataOperation.getDurationString(l.baselineDuration,l.durationUnit)):"string"==typeof t.valueAccessor?(d=w.getObject(t.valueAccessor,window),e.value=d(t.field,g,t)):e.value=t.valueAccessor(t.field,g,t):"booleanedit"===t.editType?!0===g[t.field]?e.checked=!0:e.checked=!1:this.parent.taskFields[t.field]||"numericedit"!==t.editType||""!==g[t.field]&&0!==g[t.field]?e.value=g[t.field]:e.value=0,ne.isNullOrUndefined(t.edit)||ne.isNullOrUndefined(t.edit.write)||!ne.isNullOrUndefined(t.edit.params)?(p=new this.inputs[t.editType](e)).appendTo(n):(p=void 0,p="string"==typeof(h=t.edit.write)?(h=w.getObject(h,window))({column:t,rowData:g,element:n}):t.edit.write({column:t,rowData:g,element:n}),t.field===this.parent.taskFields.duration&&(p.change=function(e){u.validateScheduleFields(e,t,u.parent)})),this.parent.enableAdaptiveUI?(a.appendChild(f),i.appendChild(a),i):f},b.prototype.taskNameCollection=function(){var e=this.parent.flatData;this.preTaskIds=[],this.preTableCollection=[];for(var t=0;t<e.length;t++){var i=e[t];if(this.parent.allowParentDependency){var a=i;if(i.parentUniqueID===this.beforeOpenArgs.rowData.uniqueID)this.isValidData=!1;else do{if(a.parentItem&&(a=this.parent.flatData[this.parent.ids.indexOf(a.parentItem.taskId)]).uniqueID===this.beforeOpenArgs.rowData.uniqueID){this.isValidData=!1;break}}while(a.parentItem);if(i.hasChildRecords&&this.isValidData&&(this.isValidData=this.isParentValid(i.childRecords)),!this.isValidData){this.isValidData=!0;continue}}else if(i.hasChildRecords)continue;var n=("ResourceView"===this.parent.viewType?i.ganttProperties.taskId:i.ganttProperties.rowUniqueID).toString(),i={id:n,text:n+"-"+i.ganttProperties.taskName,value:n};this.preTaskIds.push(i.id),this.preTableCollection.push(i)}},b.prototype.predecessorEditCollection=function(e){var t=[],i=e.ganttProperties;if(this.isEdit&&!ne.isNullOrUndefined(this.parent.taskFields.dependency)&&!ne.isNullOrUndefined(e)&&!ne.isNullOrUndefined(i.predecessor))for(var a=i.predecessor,n=this.preTableCollection,r=0;r<a.length;r++){var s=a[r].from.toString(),o={};if(("ResourceView"===this.parent.viewType?i.taskId:i.rowUniqueID).toString()!==s){o.id=s;for(var l=0;l<n.length;l++)if(n[l].value===s){o.name=n[l].text;break}o.type=a[r].type;var d=a[r].offset,h=a[r].offsetUnit;o.offset=this.parent.dataOperation.getDurationString(d,h),o.uniqueId=Q++,t.push(o)}}return t},b.prototype.updatePredecessorDropDownData=function(e){var t=("ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID).toString(),t=this.preTaskIds.indexOf(t);this.preTableCollection.splice(t,1),this.preTaskIds.splice(t,1),this.validSuccessorTasks(e,this.preTaskIds,this.preTableCollection)},b.prototype.validSuccessorTasks=function(e,d,h){var t,p,u=this,e=e.ganttProperties;e.predecessor&&0<e.predecessor.length&&(t=e.predecessor,p=("ResourceView"===this.parent.viewType?e.taskId:e.rowUniqueID).toString(),t.forEach(function(e){if(e.from.toString()===p){var t,e=e.to;-1<(t=d.indexOf(e))&&(d.splice(t,1),h.splice(t,1));for(var i=u.parent.connectorLineModule.getRecordByID(e),a=!0,n=0,r=u.processedId;n<r.length;n++){var s=r[n];if(s.id===i.ganttProperties.taskId&&Array.isArray(s.value)&&Array.isArray(i.ganttProperties.predecessor)&&s.value.length===i.ganttProperties.predecessor.length){for(var o=!0,l=0;l<s.value.length;l++)if(s.value[l]!==i.ganttProperties.predecessor[l]){o=!1;break}if(o){a=!1;break}}}a&&(u.processedId.push({id:i.ganttProperties.taskId,value:i.ganttProperties.predecessor}),u.validSuccessorTasks(i,d,h))}}))},b.prototype.getPredecessorType=function(){var e=[this.parent.getPredecessorTextValue("SS"),this.parent.getPredecessorTextValue("SF"),this.parent.getPredecessorTextValue("FS"),this.parent.getPredecessorTextValue("FF")];return[{id:"FS",text:e[2],value:e[2]},{id:"FF",text:e[3],value:e[3]},{id:"SS",text:e[0],value:e[0]},{id:"SF",text:e[1],value:e[1]}]},b.prototype.initiateDialogSave=function(){if(this.isEdit?this.parent.initiateEditAction(!0):this.addedRecord={},this.currentResources&&(this.currentResources=null),this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("Edit")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.isEdit)){this.parent.undoRedoModule.createUndoCollection();var e={action:"DialogEdit",modifiedRecords:[]};if(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e,"ResourceView"===this.parent.viewType){var n,r,t=!1;if(this.rowData.ganttProperties.resourceInfo){if(this.ganttResources.length!==this.rowData.ganttProperties.resourceInfo.length)t=!0;else for(var i=0;i<this.rowData.ganttProperties.resourceInfo.length;i++)if(this.ganttResources[i][this.parent.resourceFields.id]!==this.rowData.ganttProperties.resourceInfo[i][this.parent.resourceFields.id]){t=!0;break}}else 0<this.ganttResources.length&&(t=!0);t&&(e={deletedIndexes:[]},n="T"+this.rowData.ganttProperties.taskId,r=[],this.parent.taskIds.reduce(function(e,t){if(t===n)if(0===this.ganttResources.length)r.push(this.parent.flatData[this.parent.taskIds.indexOf(t)]);else for(var i=this.parent.getTaskByUniqueID(this.parent.flatData[this.parent.taskIds.indexOf(t)].parentUniqueID),a=0;a<this.ganttResources.length;a++)i.ganttProperties.taskId!==this.ganttResources[a][this.parent.resourceFields.id]&&-1===r.indexOf(this.parent.flatData[this.parent.taskIds.indexOf(t)])&&r.push(this.parent.flatData[this.parent.taskIds.indexOf(t)])}.bind(this),[]),this.parent.undoRedoModule.findPosition(ne.extend([],[],r,!0),e,"deletedIndexes"),this.indexes?this.indexes.deletedIndexes[this.indexes.deletedIndexes.length]=e.deletedIndexes[0]:this.indexes=e)}}this.parent.updateDuration=!0;for(var a=this.parent,s=this.beforeOpenArgs.tabModel.items,i=0;i<s.length;i++){var o=s[i].content,l=o.getAttribute("id");ne.isNullOrUndefined(l)&&""===l||("General"===(l=(l=l.replace(a.element.id,"")).replace("TabContainer",""))?this.updateGeneralTab(o,!1):"Advanced"===l?this.updateAdvancedTab(o):"Dependency"===l?(this.isFromDialogPredecessor=!0,this.updatePredecessorTab(o),this.isFromDialogPredecessor=!1):"Notes"===l?this.updateNotesTab(o):"Resources"===l?(this.updateResourceTab(o),this.dialogEditValidationFlag=!1):-1!==l.indexOf("Custom")?this.updateCustomTab(o):"Segments"===l&&this.updateSegmentsData(o))}if(!this.disableUndo&&this.parent.undoRedoModule&&(this.parent.undoRedoModule.getUndoCollection.splice(this.parent.undoRedoModule.getUndoCollection.length-1,1),this.parent.toolbarModule&&0===this.parent.undoRedoModule.getUndoCollection.length&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!1),this.parent.totalUndoAction--),this.isEdit){this.parent.editModule.editedRecord=this.rowData,this.parent.dataOperation.updateWidthLeft(this.rowData);e={data:this.rowData,action:"DialogEditing"};this.parent.editModule.initiateUpdateAction(e)}else if(this.parent.editModule.editedRecord=this.addedRecord,"ResourceView"===this.parent.viewType){var d=ne.extend({},this.addedRecord,!0);if(d[this.parent.taskFields.resourceInfo].length)for(i=0;i<d[this.parent.taskFields.resourceInfo].length;i++){var l=d[this.parent.taskFields.resourceInfo][i].toString(),h=this.parent.getTaskIds().indexOf("R"+l.toString());if(-1!==h){this.parent.editModule.addRecord(this.addedRecord,"Child",h);break}}else this.parent.editModule.addRecord(this.addedRecord,"Bottom")}else this.parent.editModule.addRecord(this.addedRecord,this.parent.editSettings.newRowPosition,this.parent.selectedRowIndex);return!0},b.prototype.compareObjects=function(e,r){return!ne.isNullOrUndefined(e)&&e.every(function(e,t){for(var i=r[t],a=Object.keys(e),n=0;n<a.length;n++)if("startDate"===a[n]||"endDate"===a[n]){if(e[a[n]].getTime()!==i[a[n]].getTime())return!0}else if("duration"===a[n]&&e[a[n]]!==i[a[n]])return!0;return!1})},b.prototype.updateSegmentTaskData=function(e){var t,i,a=this.parent.taskFields;this.isEdit?(t=this.rowData.ganttProperties.segments,this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,e,this.rowData),i=this.parent.dataOperation.setSegmentsInfo(this.rowData,!0),(this.parent.enableUndoRedo&&t&&i&&t.length!==i.length||!t&&i||t&&!i||this.compareObjects(t,i))&&(this.disableUndo=!0),this.parent.setRecordValue("segments",i,this.rowData.ganttProperties,!0),this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(this.rowData,!1),this.rowData.ganttProperties,!0),e.length<=0&&this.validateDuration(this.rowData)):this.addedRecord[a.segments]=e},b.prototype.updateSegmentsData=function(e){var e=e.ej2_instances[0],t=e.isEdit;e.isEdit&&e.endEdit(),t=t&&e.currentViewData.length!==e.dataSource.length?e.dataSource:e.currentViewData,this.updateSegmentTaskData(t)},b.prototype.updateGeneralTab=function(e,t){var i=this.parent,a=e.childNodes,n={};this.isEdit||(n=this.addedRecord);for(var r=0;r<a.length;r++){var s,o,l,d=a[r],h=d.querySelector('input[id^="'+i.element.id+'"]')||d.querySelector('textarea[id^="'+i.element.id+'"]'),p=Array.from(d.children).find(function(e){return e.classList.contains("e-richtexteditor")});(h=p?p:h)&&(p=h.id.replace(i.element.id,""),d=d.querySelector("#"+i.element.id+p).ej2_instances[0],"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType&&p===this.parent.taskFields.id&&(s=d.value.toString(),d.value=s),s=i.columnByField[p],(p===this.parent.taskFields.duration||this.parent.taskFields.baselineDuration?parseInt(this.rowData[p],10)!==parseInt(d.value,10):this.rowData[p]!==d.value)&&(this.disableUndo=!0),ne.isNullOrUndefined(s)||ne.isNullOrUndefined(s.edit)||ne.isNullOrUndefined(s.edit.read)||!ne.isNullOrUndefined(s.edit.params)?ne.isNullOrUndefined(s)||"booleanedit"!==s.editType?(p===this.parent.taskFields.duration||p===this.parent.taskFields.baselineDuration?(o=parseFloat(String(d.value)),n[p]=o):(0<this.parent.weekWorkingTime.length&&d.value&&(p===this.parent.taskFields.startDate||p===this.parent.taskFields.baselineStartDate)&&(o=p===this.parent.taskFields.startDate?this.beforeOpenArgs.rowData.ganttProperties.startDate:this.beforeOpenArgs.rowData.ganttProperties.baselineStartDate,this.parent.getStartTime(o)/3600===o.getHours())&&(l=this.parent.getStartTime(d.value),this.parent.dataOperation.setTime(l,d.value)),n[p]=d.value),this.parent.enableHtmlSanitizer&&"string"==typeof d.value&&(d.value=ne.SanitizeHtmlHelper.sanitize(d.value),n[p]=d.value)):h instanceof HTMLInputElement&&!0===h.checked?n[p]=!0:n[p]=!1:"string"==typeof(l=s.edit.read)?(l=w.getObject(l,window),n[p]=l(h,d.value)):n[p]=s.edit.read(h,d.value))}this.isEdit&&(t||this.updateScheduleProperties(this.editedRecord,this.rowData),i.editModule.validateUpdateValues(n,this.rowData,!0))},b.prototype.updateAdvancedTab=function(e){for(var t=this.parent,i=e.childNodes,a=this.isEdit?this.rowData:this.addedRecord,n=0;n<i.length;n++){var r,s=i[n],o=s.querySelector('input[id^="'+t.element.id+'"]'),l=Array.from(s.children).find(function(e){return e.classList.contains("e-richtexteditor")});(o=l?l:o)&&(l=o.id.replace(t.element.id,""),s=s.querySelector("#"+t.element.id+l).ej2_instances[0],r=t.columnByField[l],this.rowData[l]!==s.value&&(this.disableUndo=!0),r&&r.edit&&!r.edit.params?("string"==typeof(r=r.edit.read)&&(r=w.getObject(r,window)),a[l]=r(o,s.value)):a[l]=o.ej2_instances[0].value)}this.isEdit&&t.editModule.validateUpdateValues(a,this.rowData,!0)},b.prototype.updateScheduleProperties=function(e,t){this.parent.setRecordValue("startDate",e.ganttProperties.startDate,t.ganttProperties,!0),this.parent.setRecordValue("endDate",e.ganttProperties.endDate,t.ganttProperties,!0),this.parent.setRecordValue("duration",e.ganttProperties.duration,t.ganttProperties,!0),this.parent.setRecordValue("baselineDuration",e.ganttProperties.baselineDuration,t.ganttProperties,!0),this.parent.setRecordValue("baselineStartDate",e.ganttProperties.baselineStartDate,t.ganttProperties,!0),this.parent.setRecordValue("baselineEndDate",e.ganttProperties.baselineEndDate,t.ganttProperties,!0),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,t.ganttProperties,!0),this.parent.setRecordValue("work",e.ganttProperties.work,t.ganttProperties,!0),this.parent.setRecordValue("type",e.ganttProperties.taskType,t.ganttProperties,!0),this.parent.setRecordValue("taskType",e.ganttProperties.taskType,t.ganttProperties,!0),this.parent.setRecordValue("resourceNames",e.ganttProperties.resourceNames,t.ganttProperties,!0),this.parent.setRecordValue("resourceInfo",e.ganttProperties.resourceInfo,t.ganttProperties,!0),ne.isNullOrUndefined(this.parent.taskFields.startDate)||this.parent.dataOperation.updateMappingData(t,"startDate"),ne.isNullOrUndefined(this.parent.taskFields.endDate)||this.parent.dataOperation.updateMappingData(t,"endDate"),ne.isNullOrUndefined(this.parent.taskFields.duration)||(this.parent.dataOperation.updateMappingData(t,"duration"),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,this.rowData,!0),0===this.rowData.ganttProperties.duration?this.parent.setRecordValue("isMilestone",!0,t.ganttProperties,!0):this.parent.setRecordValue("isMilestone",!1,this.rowData.ganttProperties,!0)),ne.isNullOrUndefined(this.parent.taskFields.baselineDuration)||this.parent.dataOperation.updateMappingData(t,"baselineDuration"),ne.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(this.rowData,"work"),ne.isNullOrUndefined(this.parent.taskFields.manual)||this.parent.dataOperation.updateMappingData(this.rowData,"manual"),ne.isNullOrUndefined(this.parent.taskFields.type)||this.parent.dataOperation.updateMappingData(this.rowData,"type"),ne.isNullOrUndefined(this.parent.taskFields.resourceInfo)||this.parent.dataOperation.updateMappingData(this.rowData,"resourceInfo")},b.prototype.getMatchingPrefix=function(e,t){for(var i=e.name.split("-"),a="",n=0;n<i.length;n++)if(a=""===a?i[n]:a+"-"+i[n],-1!==t.indexOf(a))return[a];return[]},b.prototype.updatePredecessorTab=function(e){for(var e=e.ej2_instances[0],t=(e.isEdit&&e.endEdit(),e.dataSource),i=[],e=[],a="",n=[],r=[],s=0;s<t.length;s++){var o=t[s],l=this.getMatchingPrefix(o,this.parent.ids);(ne.isNullOrUndefined(o.id)||o.id!==l[0]&&!ne.isNullOrUndefined(l[0]))&&(o.id=l[0]),-1===n.indexOf(o.id)&&("ProjectView"===this.parent.viewType&&(l=this.parent.flatData[this.parent.ids.indexOf(o.id)]).hasChildRecords&&-1===r.indexOf(l)&&r.push(l),l=o.id+o.type,o.offset&&-1!==o.offset.indexOf("-")?l+=o.offset:l+="+"+o.offset,i.push(l),n.push(o.id))}this.isEdit?(a=0<i.length?(e=this.parent.predecessorModule.calculatePredecessor(i.join(","),this.rowData),this.parent.setRecordValue("predecessor",e,this.rowData.ganttProperties,!0),this.parent.predecessorModule.getPredecessorStringValue(this.rowData)):(this.parent.setRecordValue("predecessor",e=[],this.rowData.ganttProperties,!0),""),this.parent.undoRedoModule&&0<this.parent.undoRedoModule.getUndoCollection.length&&(this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1].connectedRecords=r,""===a&&(ne.isNullOrUndefined(this.rowData.ganttProperties.predecessorsName)||this.rowData.ganttProperties.predecessorsName===a||this.disableUndo)||(this.disableUndo=!0)),this.parent.setRecordValue("predecessorsName",a,this.rowData.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,a,this.rowData),this.parent.setRecordValue(this.parent.taskFields.dependency,a,this.rowData),this.parent.predecessorModule.updateUnscheduledDependency(this.rowData)):this.addedRecord[this.parent.taskFields.dependency]=0<i.length?i.join(","):""},b.prototype.updateResourceTab=function(e){var t=this,e=e.ej2_instances[0],i=(e&&e.grid.endEdit(),this.ganttResources),a=(i.forEach(function(e){null===e[t.parent.resourceFields.unit]&&(e[t.parent.resourceFields.unit]=0)}),"ResourceView"!==this.parent.viewType||ne.isNullOrUndefined(this.rowData.ganttProperties)||(JSON.stringify(this.ganttResources)!==JSON.stringify(this.rowData.ganttProperties.resourceInfo)?(this.isResourceUpdate=!0,this.previousResource=ne.isNullOrUndefined(this.rowData.ganttProperties.resourceInfo)?[]:this.rowData.ganttProperties.resourceInfo.slice()):this.isResourceUpdate=!1),[]);if(this.isEdit){if((this.rowData.ganttProperties.resourceInfo&&i.length!==this.rowData.ganttProperties.resourceInfo.length||ne.isNullOrUndefined(this.rowData.ganttProperties.resourceInfo)&&0<i.length)&&(this.disableUndo=!0),!this.disableUndo)for(var n=0;n<i.length;n++)if(JSON.stringify(i[n])!==JSON.stringify(this.rowData.ganttProperties.resourceInfo[n])){this.disableUndo=!0;break}this.parent.setRecordValue("resourceInfo",i,this.editedRecord.ganttProperties,!0),this.parent.dataOperation.updateMappingData(this.editedRecord,"resourceInfo"),this.parent.editModule.updateResourceRelatedFields(this.editedRecord,"resource"),this.validateDuration(this.editedRecord),this.updateScheduleProperties(this.editedRecord,this.rowData)}else{for(n=0;n<i.length;n++)a.push(i[n][this.parent.resourceFields.id]),this.isAddNewResource=!0;this.addedRecord[this.parent.taskFields.resourceInfo]=a}},b.prototype.updateNotesTab=function(e){var t=this.parent,e=e.ej2_instances[0];this.isEdit?(t.columnByField[t.taskFields.notes].disableHtmlEncode?(this.rowData.ganttProperties.notes===e.getText()||null===this.rowData.ganttProperties.notes&&""===e.getText()||this.disableUndo||(this.disableUndo=!0),e.getHtml().includes("href")?this.parent.setRecordValue("notes",e.getHtml(),this.rowData.ganttProperties,!0):this.parent.setRecordValue("notes",e.getText(),this.rowData.ganttProperties,!0)):(this.rowData.ganttProperties.notes===e.getHtml()||null===this.rowData.ganttProperties.notes&&"<p><br></p>"===e.getHtml()||this.disableUndo||(this.disableUndo=!0),this.parent.setRecordValue("notes",e.getHtml(),this.rowData.ganttProperties,!0)),t.dataOperation.updateMappingData(this.rowData,"notes")):t.columnByField[t.taskFields.notes].disableHtmlEncode?this.addedRecord[this.parent.taskFields.notes]=e.getText():this.addedRecord[this.parent.taskFields.notes]=e.getHtml()},b.prototype.updateCustomTab=function(e){this.updateGeneralTab(e,!0)},b);function b(e){this.isFromDialogPredecessor=!1,this.isTriggered=!1,this.taskFieldColumn=[],this.customFieldColumn=[],this.processedId=[],this.updatedEditFields=null,this.updatedAddFields=null,this.addedRecord=null,this.dialogEditValidationFlag=!1,this.ganttResources=[],this.isValidData=!0,this.isResourceTabUpdated=!1,this.previousResource=[],this.isResourceUpdate=!1,this.parent=e,this.localeObj=this.parent.localeObj,this.beforeOpenArgs={cancel:!1},this.types=this.getPredecessorType(),this.rowData={},this.editedRecord={},this.inputs={booleanedit:A.CheckBox,dropdownedit:U.DropDownList,datepickeredit:W.DatePicker,datetimepickeredit:W.DateTimePicker,maskededit:B.MaskedTextBox,numericedit:B.NumericTextBox,stringedit:B.TextBox,defaultedit:B.TextBox},this.processDialogFields(),this.wireEvents()}var va=function(){return(va=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Sa=(v.prototype.updateConnectorLineEditElement=function(e){e=this.getConnectorLineHoverElement(e.target);ne.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)||this.highlightConnectorLineElements(e)},v.prototype.getConnectorLineHoverElement=function(e){var t=S(e,it),i=S(e,rt),a=S(e,at),n=S(e,nt);return t||i||a||n?S(e,tt):null},v.prototype.highlightConnectorLineElements=function(e){e?e!==this.connectorLineElement&&(this.removeHighlight(),this.addHighlight(e)):this.removeHighlight()},v.prototype.addHighlight=function(e){e=(this.connectorLineElement=e).querySelector("."+it);e&&e.setAttribute("stroke-width",(this.parent.connectorLineModule.lineStroke+1).toString())},v.prototype.removeHighlight=function(){var e;this.connectorLineElement&&((e=this.connectorLineElement.querySelector("."+it))&&e.setAttribute("stroke-width",this.parent.connectorLineModule.lineStroke.toString()),this.connectorLineElement=null)},v.prototype.getEditedConnectorLineString=function(e){for(var t,i=new Set,a=document.createDocumentFragment(),n=0;n<e.length;n++)if(t=e[n].ganttProperties.predecessor)for(var r=0;r<t.length;r++){var s,o=t[r],l="parent"+o.from+"child"+o.to;this.parent.connectorLineModule.removeConnectorLineById(l),l=this.parent.connectorLineModule.getRecordByID(o.from),s=this.parent.connectorLineModule.getRecordByID(o.to),(!this.parent.allowParentDependency&&(l&&l.expanded||s&&s.expanded)||this.parent.allowParentDependency&&(l||s))&&(l=this.parent.predecessorModule.updateConnectorLineObject(l,s,o),ne.isNullOrUndefined(l)||i.has(l.connectorLineId)||(s=this.parent.connectorLineModule.getConnectorLineTemplate(l),i.add(l.connectorLineId),a.appendChild(s)))}return a},v.prototype.refreshEditedRecordConnectorLine=function(e){this.parent.connectorLineModule.removePreviousConnectorLines(this.parent.previousRecords),this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.updatedRecords:this.parent.getExpandedRecords(this.parent.updatedRecords);e=this.getEditedConnectorLineString(e);e&&this.parent.connectorLineModule.svgObject.appendChild(e)},v.prototype.idFromPredecessor=function(e){for(var t=e.split(","),i=[],a=[],n=[],r=0;r<t.length;r++){var s,o=[],l=void 0,d=!1,h=void 0,p=!1,u=t[r].split("-");6===u.length&&(u[4]=u[4]+"-"+u[5],u.pop()),5===u.length&&12<=u[4].length&&(s=t[r].substring(0,36),/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(s))&&(p=!0),t[r].includes("-")&&(t[r].includes("-")&&(t[r].includes("days")||t[r].includes("day"))&&0<(s=t[r].split(/-(?=\d)/)).length&&(h=s[s.length-1]),t[r].includes("-"))&&/[A-Za-z]/.test(h)&&-1!==(h=t[r].indexOf(h))&&(l=t[r].substring(0,h-1)).includes("-")&&(d=!0),p?(p=h=void 0,1===(h=u[4].split("+")).length?a[0]=t[r]:(p=h[1].length,a[0]=t[r].slice(0,-(p+1)),a[1]=h[1]),0<=u[4].indexOf("-")&&(1===(h=u[4].split("-")).length?a[0]=t[r]:(p=h[1].length,a[0]=t[r].slice(0,-(p+1)),a[1]=h[1]))):d&&l.includes("-")?a[0]=l:(a=t[r].split("+"),0<=t[r].indexOf("-")&&(a=t[r].split("-"))),ne.isNullOrUndefined(a[0])||(-1===("ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids).indexOf(a[0])?-1!==a[0].indexOf(" ")?(1===(n=a[0].split(" ")).length&&(n=a[0].match(/(\d+|[A-z]+)/g)),o.push(n[0])):1===a[0].length||2===a[0].length?o.push(a[0]):o.push(a[0].slice(0,-2)):o.push(a[0])),i.push(o.join(""))}return i},v.prototype.predecessorValidation=function(e,t){for(var i,a=t.rowUniqueID,n=0;n<e.length;n++)for(var r=e[n],s=[],o=(e.slice(0).splice(n,1),this);null!==r;){var l=function(){var t=[];return-1===s.indexOf(r)?ne.isNullOrUndefined(o.parent.connectorLineModule.getRecordByID(r))||(i=o.parent.connectorLineModule.getRecordByID(r).ganttProperties,!ne.isNullOrUndefined(i.predecessor)&&0<i.predecessor.length&&i.predecessor.forEach(function(e){i.rowUniqueID.toString()!==e.from&&t.push(e.from.toString())}),a.toString()===i.rowUniqueID.toString())||-1!==t.indexOf(a.toString())?{value:!1}:(s.push(r),!ne.isNullOrUndefined(i.predecessor)&&0<i.predecessor.length?void(r=i.predecessor[0].from):"break"):"break"}();if("object"==typeof l)return l.value;if("break"===l)break}return!0},v.prototype.validatePredecessorRelation=function(s,e){var o,l=!0,d="ResourceView"===this.parent.viewType?s.ganttProperties.taskId:s.ganttProperties.rowUniqueID;if(!ne.isNullOrUndefined(e)&&0<e.length)for(var h=this.idFromPredecessor(e),t=function(e){if(p.parent.allowParentDependency)parseInt(h[h.length-1],10)!==s[p.parent.taskFields.id]&&(t=p.parent.ids.indexOf(h[h.length-1]),t=p.parent.currentViewData[t])&&s&&(l=p.parent.predecessorModule.validateParentPredecessor(t,s));else if(!p.checkParentRelation(s,h))return{value:!1};var t=h.slice(0),i=[],a=!0;if(t.forEach(function(e){-1===i.indexOf(e)?i.push(e):a=!1}),!a)return{value:!1};o=h[e];var r=[];for(h.slice(0).splice(e,1);null!==o;){var n=function(){var i,e,a,n=[];return-1===r.indexOf(o)?ne.isNullOrUndefined(p.parent.connectorLineModule.getRecordByID(o.toString()))||(a=p.parent.connectorLineModule.getRecordByID(o.toString()).ganttProperties,!ne.isNullOrUndefined(a.predecessor)&&0<a.predecessor.length&&a.predecessor.forEach(function(e,t){a.rowUniqueID.toString()!==e.from&&(n.push(e.from.toString()),i=t)}),d.toString()===a.rowUniqueID.toString())||-1!==n.indexOf(d.toString())?{value:!1}:(r.push(o),!ne.isNullOrUndefined(a.predecessor)&&0<a.predecessor.length?(e=void 0,1<n.length?e=p.predecessorValidation(n,s.ganttProperties):1===n.length&&(o=a.predecessor[i].from),!1===e?{value:!1}:void 0):"break"):"break"}();if("object"==typeof n)return n;if("break"===n)break}},p=this,i=0;i<h.length;i++){var a=t(i);if("object"==typeof a)return a.value}return l},v.prototype.addPredecessor=function(e,t){t=ne.isNullOrUndefined(e.ganttProperties.predecessorsName)||""===e.ganttProperties.predecessorsName?t:e.ganttProperties.predecessorsName+","+t;this.updatePredecessorHelper(e,t)},v.prototype.removePredecessor=function(e){this.isPublicDependencyDelete=!0,this.updatePredecessorHelper(e,null)},v.prototype.updatePredecessor=function(e,t,i){return this.updatePredecessorHelper(e,t,i)},v.prototype.updatePredecessorHelper=function(e,t,i){var a;return ne.isUndefined(t)||this.validatePredecessorRelation(e,t)?(this.parent.isOnEdit=!0,a=[],ne.isNullOrUndefined(t)||""===t||(a=this.parent.predecessorModule.calculatePredecessor(t,e)),this.parent.setRecordValue("predecessor",a,e.ganttProperties,!0),a=this.parent.predecessorModule.getPredecessorStringValue(e),this.parent.setRecordValue("predecessorsName",a,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,a,e),this.parent.setRecordValue(this.parent.taskFields.dependency,a,e),(a={}).action=i&&i.action&&"CellEditing"===i.action?i.action:this.parent.contextMenuModule&&this.parent.contextMenuModule.isCntxtMenuDependencyDelete||this.isPublicDependencyDelete?"DeleteConnectorLine":"DrawConnectorLine",a.data=e,this.parent.editModule.initiateUpdateAction(a),!0):(e.taskData[this.parent.taskFields.dependency]&&(e.taskData[this.parent.taskFields.dependency]=null),i=t+" is an invalid relation for task "+this.parent.taskFields.id+". Kindly ensure the "+this.parent.taskFields.dependency+" field contains only valid predecessor relations.",this.parent.trigger("actionFailure",{error:i}),!1)},v.prototype.checkParentRelation=function(e,i){if(e&&e.parentItem&&-1!==i.indexOf(e.parentItem.taskId.toString()))return!1;for(var a=this,t=0;t<i.length;t++){var n=function(t){var e=a.parent.currentViewData.filter(function(e){return e&&e.ganttProperties.rowUniqueID.toString()===i[t].toString()});if(e[0]&&e[0].hasChildRecords)return{value:!1}}(t);if("object"==typeof n)return n.value}return!0},v.prototype.initPredecessorValidationDialog=function(){var e;this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation&&(e=ne.createElement("div",{id:this.parent.element.id+"_dialogValidationRule"}),this.parent.element.appendChild(e),this.renderValidationDialog())},v.prototype.renderValidationDialog=function(){var e=this.parent.taskFields,e=e.constraintType&&e.constraintDate?this.parent.localeObj.getConstant("schedulingConflicts"):this.parent.localeObj.getConstant("validateEditing"),t=this.parent.element.id+"_dialogValidationRule",i=document.getElementById(t),i=(i?(i.innerHTML="",i.style.zIndex="2000"):((i=document.createElement("div")).id=t,i.style.zIndex="2000",document.body.appendChild(i)),new F.Dialog({header:e,isModal:!0,enableRtl:this.parent.enableRtl,visible:!1,width:"50%",showCloseIcon:!0,zIndex:2e3,close:this.validationDialogClose.bind(this),content:"",buttons:[{click:this.validationDialogOkButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("okText"),isPrimary:!0}},{click:this.validationDialogCancelButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("cancel")}}],target:document.body,animationSettings:{effect:"None"}}));i.isStringTemplate=!0,i.appendTo("#"+t),this.parent.validationDialogElement=i},v.prototype.validationDialogOkButton=function(){var e=this.parent.currentEditedArgs,t=document.getElementById(this.parent.element.id+"_ValidationAddlineOffset"),i=document.getElementById(this.parent.element.id+"_ValidationRemoveline"),a=document.getElementById(this.parent.element.id+"_ValidationCancel"),n=document.getElementById(this.parent.element.id+"_RemoveConstraint"),r=document.getElementById(this.parent.element.id+"_RemoveDependency"),s=document.getElementById(this.parent.element.id+"_CancelChange"),o=this.parent.editModule.violationArgs,l=o.matchedModifiedTask,d=o.args,o=o.matchedParedRecord||null;if(null!==n&&n.checked)l.ganttProperties.constraintType=4,this.parent.constraintViolationType="",this.parent.editModule.initiateSaveAction(d);else if(null!==r&&r.checked){var h=[],p=(o||d.data).ganttProperties.taskId;if(l&&Array.isArray(l.ganttProperties.predecessor))for(var u=0,c=l.ganttProperties.predecessor;u<c.length;u++){var g=c[u];if(g.from.toString()===p.toString()){h=[g];break}}this.parent.editModule.reUpdatePreviousRecords(void 0,void 0,l.uniqueID),l.parentItem&&l.parentItem.taskId&&(o=this.parent.getRecordByID(l.parentItem.taskId),this.parent.dataOperation.updateParentItems(o,!0)),this.removePredecessors(l,h),this.parent.editModule.initiateSaveAction(d)}else null!==s&&s.checked&&(e.validateMode.respectLink=!0,this.applyPredecessorOption());null!==n&&n.checked||null!==r&&r.checked||null!==s&&s.checked||(e.validateMode.preserveLinkWithEditing=null!==t&&t.checked,e.validateMode.removeLink=null!==i&&i.checked,e.validateMode.respectLink=null!==a&&a.checked,this.applyPredecessorOption()),this.parent.validationDialogElement.hide()},v.prototype.validationDialogCancelButton=function(){this.parent.constraintViolationType="",this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption(),this.parent.validationDialogElement.hide()},v.prototype.validationDialogClose=function(e){this.parent.constraintViolationType="",ne.getValue("isInteracted",e)&&(this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption())},v.prototype.applyPredecessorOption=function(){var t,i,e=this.parent.currentEditedArgs,a=e.data;e.validateMode.respectLink?(this.parent.editModule.reUpdatePreviousRecords(),this.parent.chartRowsModule.refreshRecords([e.data])):e.validateMode.removeLink?(this.checkChildRecords(a),this.parent.editModule.updateEditedTask(e.editEventArgs)):e.validateMode.preserveLinkWithEditing&&(this.parent.updateOffsetOnTaskbarEdit&&(i=a.ganttProperties.taskId.toString(),a.ganttProperties.predecessor)&&a.ganttProperties.predecessor.forEach(function(e){i===e.from&&(t=e.to)}),this.parent.editModule.updateEditedTask(e.editEventArgs),this.processPredecessor(t,[]))},v.prototype.compareArrays=function(e,t){return e.length===t.length&&JSON.stringify(e)===JSON.stringify(t)},v.prototype.processPredecessor=function(e,t){var i,a,n=this;e&&(i=this.parent.getRecordByID(e))&&i.ganttProperties&&i.ganttProperties.predecessor&&(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.calculateOffset(i),a=!0,(e=this.validatedId.find(function(e){return e.id===i.ganttProperties.taskId}))&&(e=e.value,this.compareArrays(e,i.ganttProperties.predecessor))&&(a=!1),i.ganttProperties.predecessor.forEach(function(e){i.ganttProperties.taskId===e.from&&a&&t&&-1===t.indexOf(e.to)&&(n.processPredecessor(e.to,t),t.push(e.to))}))},v.prototype.checkChildRecords=function(e){var t,i=[],a=e.ganttProperties.taskId,n=e.ganttProperties.predecessor;if(ne.isNullOrUndefined(n))this.validationPredecessor=n;else{for(var r=0;r<n.length;r++){var s=n[r];s.to.toString()===a.toString()&&i.push(s)}this.validationPredecessor=i}if(ne.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(e,this.validationPredecessor),0<e.childRecords.length)for(r=0;r<e.childRecords.length;r++){var o=e.childRecords[r];this.validationPredecessor=o.ganttProperties.predecessor,ne.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(o,this.validationPredecessor),0<o.childRecords.length&&this.checkChildRecords(o)}else ne.isNullOrUndefined(e.parentItem)||(t=this.parent.getRecordByID(e.parentItem.taskId),this.validationPredecessor=t.ganttProperties.predecessor,this.removePredecessors(t,this.validationPredecessor))},v.prototype.compareObjects=function(t,i){var e=Object.keys(t).filter(function(e){return"offset"!==e}),a=Object.keys(i).filter(function(e){return"offset"!==e});return e.length===a.length&&e.every(function(e){return t[e]===i[e]})},v.prototype.getOffsetForPredecessor=function(e,t,i){var a=0;if((t.ganttProperties.startDate||t.ganttProperties.endDate)&&(i.ganttProperties.startDate||i.ganttProperties.endDate)){var n,r=void 0,s=void 0,o=void 0,l=void 0;switch(e.type){case"FS":r=new Date((t.ganttProperties.endDate||t.ganttProperties.startDate).getTime()),s=new Date((i.ganttProperties.startDate||i.ganttProperties.endDate).getTime());break;case"SS":r=new Date((t.ganttProperties.startDate||t.ganttProperties.endDate).getTime()),s=new Date((i.ganttProperties.startDate||i.ganttProperties.endDate).getTime());break;case"SF":r=new Date((t.ganttProperties.startDate||t.ganttProperties.endDate).getTime()),s=new Date((i.ganttProperties.endDate||i.ganttProperties.startDate).getTime());break;case"FF":r=new Date((t.ganttProperties.endDate||t.ganttProperties.startDate).getTime()),s=new Date((i.ganttProperties.endDate||i.ganttProperties.startDate).getTime())}l=r.getTime()<s.getTime()?(r=this.dateValidateModule.checkStartDate(r),s=this.dateValidateModule.checkEndDate(s,null),!1):(n=new Date(r.getTime()),r=this.dateValidateModule.checkStartDate(s),s=this.dateValidateModule.checkEndDate(n,null),!0),r.getTime()<s.getTime()&&(o=this.dateValidateModule.getDuration(r,s,e.offsetUnit,!0,!1),this.parent.durationUnit===e.offsetUnit&&(t.ganttProperties.startDate&&ne.isNullOrUndefined(t.ganttProperties.endDate)||ne.isNullOrUndefined(t.ganttProperties.startDate)&&t.ganttProperties.endDate)&&--o,a=l?-o:o)}return a},v.prototype.calculateOffset=function(r,e){var i=this;if(this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)&&r&&null!==j(r.ganttProperties)){var s=ne.extend([],r.ganttProperties.predecessor,[],!0),o=this.parent.predecessorModule.getValidPredecessor(r);if(0<o.length){this.cumulativePredecessorChanges=s;for(var l=this,t=0;t<o.length;t++)!function(t){var e=o[parseInt(t.toString(),10)],i=l.parent.connectorLineModule.getRecordByID(e.from),a=(l.parent.undoRedoModule&&l.parent.undoRedoModule.isUndoRedoPerformed&&"ProjectView"===l.parent.viewType&&0===i.ganttProperties.predecessor.filter(function(e){return e.from===o[t].from&&e.to===o[t].to}).length&&i.ganttProperties.predecessor.push(o[t]),l.getOffsetForPredecessor(e,i,r)),n=K(e,"from",s,"to"),n=(-1!==n&&(s[n].offset=a),ne.extend([],i.ganttProperties.predecessor,[],!0)),e=K(e,"from",n,"to");-1!==e&&(n[e].offset=a),l.parent.setRecordValue("predecessor",n,i.ganttProperties,!0)}(t)}else{var a=r.ganttProperties.predecessor;a&&0<a.length&&a.forEach(function(e){-1===i.validatedOffsetIds.indexOf(e.to)&&("ResourceView"===i.parent.viewType?(i.validatedOffsetIds.push(e.to),i.calculateOffset(i.parent.getRecordByID(i.parent.taskIds.indexOf("T"+e.to).toString()),!0)):i.calculateOffset(i.parent.getRecordByID(e.to),!0))})}e?this.parent.setRecordValue("predecessor",s,r.ganttProperties,!0):(0===o.length&&(this.cumulativePredecessorChanges=[]),s&&0<s.length&&this.cumulativePredecessorChanges&&0<this.cumulativePredecessorChanges.length&&(a=s.map(function(t){var e=i.cumulativePredecessorChanges.find(function(e){return i.compareObjects(e,t)});return e?va({},e):null}).filter(function(e){return null!==e}),this.parent.setRecordValue("predecessor",a,r.ganttProperties,!0)));e=this.parent.predecessorModule.getPredecessorStringValue(r);if(this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,e,r),this.parent.setRecordValue(this.parent.taskFields.dependency,e,r),this.parent.setRecordValue("predecessorsName",e,r.ganttProperties,!0),-1===this.validatedOffsetIds.indexOf(r.ganttProperties.taskId.toString())&&this.validatedOffsetIds.push(r.ganttProperties.taskId.toString()),r.hasChildRecords)for(t=0;t<r.childRecords.length;t++)-1===this.validatedOffsetIds.indexOf(r.childRecords[t].ganttProperties.taskId.toString())&&r.childRecords[t].ganttProperties.predecessor&&0<r.childRecords[t].ganttProperties.predecessor.length&&this.calculateOffset(r.childRecords[t]);else if(r.parentItem)for(var n=r.parentItem;n;){var d=this.parent.getRecordByID(n.taskId),h=d.ganttProperties.taskId.toString();if(-1===this.validatedOffsetIds.indexOf(h)&&d.ganttProperties.predecessor&&0<d.ganttProperties.predecessor.length){this.calculateOffset(d);break}n=d.parentItem}}},v.prototype.removePredecessors=function(e,t){var i=ne.extend([],[],e.ganttProperties.predecessor,!0);if(!ne.isNullOrUndefined(t)){for(var a,n=t.length,r=0;r<n;r++){var s=this.parent.connectorLineModule.getRecordByID(t[r].from),o=ne.extend([],[],s.ganttProperties.predecessor,!0),l=K(t[r],"from",i,"to"),l=(i.splice(l,1),K(t[parseInt(r.toString(),10)],"from",o,"to"));o.splice(l,1),this.parent.setRecordValue("predecessor",o,s.ganttProperties,!0)}i.length!==e.ganttProperties.predecessor.length&&(this.parent.setRecordValue("predecessor",i,e.ganttProperties,!0),a=this.parent.predecessorModule.getPredecessorStringValue(e),this.parent.setRecordValue("predecessorsName",a,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,a,e),this.parent.setRecordValue(this.parent.taskFields.dependency,a,e))}},v.prototype.formatViolationType=function(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2")},v.prototype.openValidationDialog=function(e){e=this.validationDialogTemplate(e),this.parent.validationDialogElement.setProperties({content:e}),e=this.parent.element.id+"_dialogValidationRule_dialog-content",this.parent.validationDialogElement.element.querySelector("#"+e).style.paddingTop="10px",e=this.parent.element.id+"_dialogValidationRule_dialog-header";this.parent.validationDialogElement.element.querySelector("#"+e).style.padding="8px 16px",this.parent.validationDialogElement.show()},v.prototype.validationDialogTemplate=function(e){var t=this.parent.element.id,i=ne.createElement("div",{className:"e-ValidationContent"}),a=ne.getValue("task",e),n=ne.getValue("parentTask",e),e=ne.getValue("violationType",e),r=a.ganttProperties.taskName,s=ne.isNullOrUndefined(this.parent.dateFormat)?"M/d/yyyy h:mm a":this.parent.dateFormat,a=this.parent.getFormatedDate(a.ganttProperties.startDate,s),s=[r,n.ganttProperties.taskName],n="",s=("MustStartOn"!==e&&"MustFinishOn"!==e&&"StartNoLaterThan"!==e&&"FinishNoLaterThan"!==e&&("taskBeforePredecessor_FS"===e?n=this.parent.localeObj.getConstant("taskBeforePredecessor_FS"):"taskAfterPredecessor_FS"===e?n=this.parent.localeObj.getConstant("taskAfterPredecessor_FS"):"taskBeforePredecessor_SS"===e?n=this.parent.localeObj.getConstant("taskBeforePredecessor_SS"):"taskAfterPredecessor_SS"===e?n=this.parent.localeObj.getConstant("taskAfterPredecessor_SS"):"taskBeforePredecessor_FF"===e?n=this.parent.localeObj.getConstant("taskBeforePredecessor_FF"):"taskAfterPredecessor_FF"===e?n=this.parent.localeObj.getConstant("taskAfterPredecessor_FF"):"taskBeforePredecessor_SF"===e?n=this.parent.localeObj.getConstant("taskBeforePredecessor_SF"):"taskAfterPredecessor_SF"===e&&(n=this.parent.localeObj.getConstant("taskAfterPredecessor_SF")),n=Y(n,s)),'<div id="'+t+'_ValidationText">'+n+"</div>"),n=this.parent.localeObj.getConstant("cancelLink"),o=Y(this.parent.localeObj.getConstant("removeLink"),[r,a]),e=Y(this.parent.localeObj.getConstant("removeConstraint"),[this.formatViolationType(e),r]),r=Y(this.parent.localeObj.getConstant("preserveLink"),[r,a]),a=(i.innerHTML=s+('\n        <table>\n            <tr><td><input type="radio" id="'+t+'_ValidationCancel" name="ValidationRule" checked/></td></tr>\n            <tr><td><input type="radio" id="'+t+'_ValidationRemoveline" name="ValidationRule"/></td></tr>\n            <tr><td><input type="radio" id="'+t+'_RemoveConstraint" name="ValidationRule"/></td></tr>\n            <tr><td><input type="radio" id="'+t+'_ValidationAddlineOffset" name="ValidationRule"/></td></tr>\n        </table>'),i.querySelector("#"+t+"_ValidationCancel")),s=i.querySelector("#"+t+"_ValidationRemoveline"),l=i.querySelector("#"+t+"_RemoveConstraint"),t=i.querySelector("#"+t+"_ValidationAddlineOffset");return a&&new A.RadioButton({label:n,name:"ValidationRule",value:"cancel",checked:!0,cssClass:Tt}).appendTo(a),s&&new A.RadioButton({label:o,name:"ValidationRule",value:"removeLink",cssClass:Tt}).appendTo(s),l&&new A.RadioButton({label:e,name:"ValidationRule",value:"removeConstraint",cssClass:Tt}).appendTo(l),t&&new A.RadioButton({label:r,name:"ValidationRule",value:"preserveLink",cssClass:Tt}).appendTo(t),i.querySelectorAll(".e-radio-wrapper").forEach(function(e){e.style.padding="6px",e.querySelector("span").style.fontWeight="normal"}),i},v.prototype.openConstraintValidationDialog=function(e){var e=this.constraintValidationDialogTemplate(e),t=this.parent.localeObj.getConstant("schedulingConflicts"),e=(this.parent.validationDialogElement.setProperties({content:e,header:t}),this.parent.element.id+"_dialogValidationRule_dialog-content"),t=(this.parent.validationDialogElement.element.querySelector("#"+e).style.paddingTop="10px",this.parent.element.id+"_dialogValidationRule_dialog-header");this.parent.validationDialogElement.element.querySelector("#"+t).style.padding="8px 16px",this.parent.validationDialogElement.show()},v.prototype.constraintValidationDialogTemplate=function(e){var t=this.parent.element.id,i=e.parentRecord,a=e.record,n=e.predecessorLink,e=e.violationType,r=ne.createElement("div",{className:"e-ValidationContent"}),a=a.ganttProperties.taskName,s="",i=(i&&i.ganttProperties&&i.ganttProperties.taskName&&(s=i.ganttProperties.taskName),this.parent.localeObj.getConstant("removeConstraint")),o=this.parent.localeObj.getConstant("removeDependency"),l=this.parent.localeObj.getConstant("cancelChange"),i=Y(i,[this.formatViolationType(e),a]),e=Y(o,[s,a]),o="<table>",s=(o+='\n        <tr>\n            <td>\n                <input type="radio" id="'+t+'_RemoveConstraint" name="ValidationRule" />\n            </td>\n        </tr>',void 0!==n&&(o+='\n        <tr>\n            <td>\n                <input type="radio" id="'+t+'_RemoveDependency" name="ValidationRule"/>\n            </td>\n        </tr>'),r.innerHTML=o=o+('\n        <tr>\n            <td>\n                <input type="radio" id="'+t+'_CancelChange" name="ValidationRule"/>\n            </td>\n        </tr>')+"</table>",r.querySelector("#"+t+"_RemoveConstraint")),o=(s&&new A.RadioButton({label:i,name:"ValidationRule",value:"removeConstraint",checked:!0,cssClass:Tt}).appendTo(s),void 0!==n&&(a=r.querySelector("#"+t+"_RemoveDependency"))&&new A.RadioButton({label:e,name:"ValidationRule",value:"removeDependency",cssClass:Tt}).appendTo(a),r.querySelector("#"+t+"_CancelChange"));return o&&new A.RadioButton({label:l,name:"ValidationRule",value:"cancelChange",cssClass:Tt}).appendTo(o),r.querySelectorAll(".e-radio-wrapper").forEach(function(e){e.style.padding="6px",e.querySelector("span").style.fontWeight="normal"}),r},v.prototype.validateTypes=function(e,t){for(var i,a,n=this.parent.predecessorModule.getValidPredecessor(e),r=(this.validationPredecessor=[],this.parent.predecessorModule.getPredecessorDate(e,n,null,!0)),s=(t||e).ganttProperties,o=this.parent.allowUnscheduledTasks&&ne.isNullOrUndefined(r)?s.endDate:this.dateValidateModule.getEndDate(r,s.duration,s.durationUnit,s,!1),l=0;l<n.length;l++){var d,h,p,u=this.parent.connectorLineModule.getRecordByID(n[l].from),c=null;"FS"===n[l].type?(0!==(p=this.parent.dateValidationModule.getDuration(r,s.startDate,this.parent.durationUnit,s.isAutoSchedule,s.isMilestone,!0))||0===p&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(s.startDate<r?(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskBeforePredecessor_FS"):s.startDate>r&&(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskAfterPredecessor_FS")):"SS"===n[l].type?(d=new Date(s.endDate),h=new Date(r),s.startDate<r?(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskBeforePredecessor_SS"):s.startDate>r?(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskAfterPredecessor_SS"):this.parent.allowUnscheduledTasks&&ne.isNullOrUndefined(s.startDate)&&ne.isNullOrUndefined(s.duration)&&d.setHours(0,0,0,0)<h.setHours(0,0,0,0)?(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskBeforePredecessor_SS"):this.parent.allowUnscheduledTasks&&ne.isNullOrUndefined(s.startDate)&&ne.isNullOrUndefined(s.duration)&&d.setHours(0,0,0,0)>h.setHours(0,0,0,0)&&(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskAfterPredecessor_SS")):"FF"===n[l].type?(0!==(p=this.parent.dateValidationModule.getDuration(r,u.ganttProperties.endDate,this.parent.durationUnit,u.ganttProperties.isAutoSchedule,u.ganttProperties.isMilestone,!0))||0===p&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(o<=u.ganttProperties.endDate?(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskBeforePredecessor_FF"):o>u.ganttProperties.endDate&&(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskAfterPredecessor_FF")):"SF"===n[l].type&&(0!==(p=this.parent.dateValidationModule.getDuration(u.ganttProperties.startDate,o,this.parent.durationUnit,u.ganttProperties.isAutoSchedule,u.ganttProperties.isMilestone,!0))||0===p&&!1===this.parent.updateOffsetOnTaskbarEdit)&&(o<u.ganttProperties.startDate?(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskBeforePredecessor_SF"):o>=u.ganttProperties.startDate&&(this.validationPredecessor.push(n[parseInt(l.toString(),10)]),c="taskAfterPredecessor_SF")),!ne.isNullOrUndefined(c)&&ne.isNullOrUndefined(a)&&(i=u,a=c)}return{parentTask:i,task:e,violationType:a}},v.prototype.addRemovePredecessor=function(n){var e=this.parent.previousRecords[n.uniqueID],a=ne.isNullOrUndefined(n.ganttProperties.predecessor)?n.ganttProperties.predecessor:n.ganttProperties.predecessor.slice();if(e&&e.ganttProperties&&e.ganttProperties.hasOwnProperty("predecessor")){var r=e.ganttProperties.predecessor;if(!ne.isNullOrUndefined(r))for(var s=this,t=0;t<r.length;t++)!function(t){var e,i,a=s.parent.connectorLineModule.getRecordByID(r[parseInt(t.toString(),10)].from);a===n?0!==n.ganttProperties.predecessor.filter(function(e){return r[t].from===e.from&&r[t].to===e.to}).length||n.parentItem&&s.parent.taskFields.dependency&&n.ganttProperties.predecessor&&s.parent.allowParentDependency&&(r[t].from===n.parentItem.taskId||r[t].to===n.parentItem.taskId)||n.ganttProperties.predecessor.push(r[parseInt(t.toString(),10)]):(e=ne.extend([],[],a.ganttProperties.predecessor,!0),-1!==(i=K(r[parseInt(t.toString(),10)],"from",e,"to"))&&(e.splice(i,1),s.parent.setRecordValue("predecessor",e,a.ganttProperties,!0)))}(t);if(!ne.isNullOrUndefined(a))for(var o=this,i=0;i<a.length;i++)!function(t){var e=o.parent.connectorLineModule.getRecordByID(a[parseInt(t.toString(),10)].from),i=ne.extend([],[],e.ganttProperties.predecessor,!0);0===i.filter(function(e){return a[t].from===e.from&&a[t].to===e.to}).length&&(i.push(a[parseInt(t.toString(),10)]),o.parent.setRecordValue("predecessor",i,e.ganttProperties,!0))}(i)}},v.prototype.removePredecessorByIndex=function(e,t){this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection(),(i={action:"DeleteDependency"}).modifiedRecords=ne.extend([],[e],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=i);var i=e.ganttProperties.predecessor,t=i.splice(t,1),a=this.parent.connectorLineModule.getRecordByID(t[0].from).ganttProperties.predecessor,n=K(t[0],"from",a,"to"),a=(a.splice(n,1),this.parent.predecessorModule.getPredecessorStringValue(e));i.push(t[0]),this.parent.connectorLineEditModule.updatePredecessor(e,a)},v.prototype.renderPredecessorDeleteConfirmDialog=function(){this.confirmPredecessorDialog=new F.Dialog({width:"320px",isModal:!0,enableRtl:this.parent.enableRtl,content:this.parent.localeObj.getConstant("confirmPredecessorDelete"),buttons:[{click:this.confirmOkDeleteButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("okText"),isPrimary:!0}},{click:this.confirmCloseDialog.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("cancel")}}],target:this.parent.element,animationSettings:{effect:"None"}});var e=ne.createElement("div",{id:this.parent.element.id+"_deletePredecessorConfirmDialog"});this.parent.element.appendChild(e),this.confirmPredecessorDialog.isStringTemplate=!0,this.confirmPredecessorDialog.appendTo(e)},v.prototype.confirmCloseDialog=function(){this.confirmPredecessorDialog.destroy()},v.prototype.confirmOkDeleteButton=function(){this.removePredecessorByIndex(this.childRecord,this.predecessorIndex),this.confirmPredecessorDialog.destroy()},v);function v(e){this.validationPredecessor=null,this.confirmPredecessorDialog=null,this.predecessorIndex=null,this.childRecord=null,this.validatedId=[],this.validatedOffsetIds=[],this.isPublicDependencyDelete=!1,this.parent=e,this.dateValidateModule=this.parent.dateValidationModule,this.parent.on("initPredessorDialog",this.initPredecessorValidationDialog,this)}var Pa=function(){return(Pa=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},g=(C.prototype.getModuleName=function(){return"edit"},C.prototype.updateDefaultColumnEditors=function(){for(var e,t=[this.parent.taskFields.id,this.parent.taskFields.progress,this.parent.taskFields.resourceInfo,this.parent.taskFields.type,"taskType"],i=0;i<t.length;i++)!ne.isNullOrUndefined(t[i])&&0<t[i].length&&(e=this.parent.getColumnByField(t[parseInt(i.toString(),10)],this.parent.treeGridModule.treeGridColumns))&&(e.field===this.parent.taskFields.id?this.updateIDColumnEditParams(e):e.field===this.parent.taskFields.progress&&ne.isNullOrUndefined(e.edit)?this.updateProgessColumnEditParams(e):e.field===this.parent.taskFields.resourceInfo?this.updateResourceColumnEditor(e):e.field!==this.parent.taskFields.type&&"taskType"!==e.field||this.updateTaskTypeColumnEditor(e))},C.prototype.updateIDColumnEditParams=function(e){var t={min:0,decimals:0,enableRtl:this.parent.enableRtl,validateDecimalOnType:!0,format:"n0",showSpinButton:!1};this.updateEditParams(e,t)},C.prototype.updateProgessColumnEditParams=function(e){var t={min:0,enableRtl:this.parent.enableRtl,decimals:0,validateDecimalOnType:!0,max:100,format:"n0"};this.updateEditParams(e,t)},C.prototype.updateEditParams=function(e,t){ne.isNullOrUndefined(e.edit)?(e.edit={},e.edit.params={}):ne.isNullOrUndefined(e.edit.params)&&(e.edit.params={}),ne.extend(t,e.edit.params),e.edit.params=t,this.parent.getColumnByField(e.field,this.parent.ganttColumns).edit=e.edit},C.prototype.updateResourceColumnEditor=function(e){var t;this.parent.treeGridModule.currentEditRow={},this.parent.editSettings.allowEditing&&ne.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode&&(e.editType="dropdownedit",e.edit=this.getResourceEditor(),(t=this.parent.getColumnByField(e.field,this.parent.ganttColumns)).editType="dropdownedit",t.edit=e.edit)},C.prototype.getResourceEditor=function(){var t,r=this,s=this.parent.resourceFields,e={};return U.MultiSelect.Inject(U.CheckBoxSelection),e.write=function(e){r.parent.treeGridModule.currentEditRow={},(t=new U.MultiSelect({dataSource:new D.DataManager(r.parent.resources),fields:{text:s.name,value:s.id},enableRtl:r.parent.enableRtl,mode:"CheckBox",showDropDownIcon:!0,popupHeight:"350px",delimiterChar:",",value:r.parent.treeGridModule.getResourceIds(e.rowData)})).appendTo(e.element)},e.read=function(e){var t=e.ej2_instances[0].value,i=[];ne.isNullOrUndefined(t)&&(t=[]);for(var a=0;a<t.length;a++)for(var n=0;n<r.parent.resources.length;n++)if(r.parent.resources[n][s.id]===t[a]){i.push(r.parent.resources[n][s.name]);break}return r.parent.treeGridModule.currentEditRow[r.parent.taskFields.resourceInfo]=t,i.join(",")},e.destroy=function(){t&&t.destroy()},e},C.prototype.updateTaskTypeColumnEditor=function(e){var t;this.parent.editSettings.allowEditing&&ne.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode&&(e.editType="dropdownedit",e.edit=this.getTaskTypeEditor(),(t=this.parent.getColumnByField(e.field,this.parent.ganttColumns)).editType="dropdownedit",t.edit=e.edit)},C.prototype.getTaskTypeEditor=function(){var t,i=this,e={},a=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}];return e.write=function(e){i.parent.treeGridModule.currentEditRow={},(t=new U.DropDownList({dataSource:new D.DataManager(a),enableRtl:i.parent.enableRtl,fields:{value:"Value"},popupHeight:"350px",value:ne.getValue("taskType",e.rowData.ganttProperties)})).appendTo(e.element)},e.read=function(e){var e=e.ej2_instances[0].value,t=i.parent.taskFields.type||"taskType";return i.parent.treeGridModule.currentEditRow[t]=e},e.destroy=function(){t&&t.destroy()},e},C.prototype.reUpdateEditModules=function(){var e,t=this.parent.editSettings;t.allowEditing?(this.parent.editModule.cellEditModule&&"Dialog"===t.mode?(this.cellEditModule.destroy(),this.parent.treeGrid.recordDoubleClick=this.recordDoubleClick.bind(this)):ne.isNullOrUndefined(this.parent.editModule.cellEditModule)&&"Auto"===t.mode&&(this.cellEditModule=new ga(this.parent)),this.parent.editModule.dialogModule&&"Auto"===t.mode?this.parent.treeGrid.recordDoubleClick=void 0:ne.isNullOrUndefined(this.parent.editModule.dialogModule)&&(this.dialogModule=new Ta(this.parent))):(this.cellEditModule&&this.cellEditModule.destroy(),this.dialogModule&&this.dialogModule.destroy()),t.allowDeleting&&t.showDeleteConfirmDialog?ne.isNullOrUndefined(this.confirmDialog)&&(e=ne.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"}),this.parent.element.appendChild(e),this.renderDeleteConfirmDialog()):t.allowDeleting&&t.showDeleteConfirmDialog||this.confirmDialog&&!this.confirmDialog.isDestroyed&&this.confirmDialog.destroy(),t.allowTaskbarEditing?ne.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&(this.taskbarEditModule=new ba(this.parent)):this.taskbarEditModule&&this.taskbarEditModule.destroy()},C.prototype.recordDoubleClick=function(e){var t,i;this.parent.editSettings.allowEditing&&"Dialog"===this.parent.editSettings.mode&&(i=void 0,e.row&&(t=ne.getValue("rowIndex",e.row),i=this.parent.currentViewData[t]),ne.isNullOrUndefined(i)||this.dialogModule.openEditDialog(i)),this.parent.ganttChartModule.recordDoubleClick(e)},C.prototype.destroy=function(){this.cellEditModule&&this.cellEditModule.destroy(),this.taskbarEditModule&&this.taskbarEditModule.destroy(),this.dialogModule&&this.dialogModule.destroy(),this.confirmDialog&&!this.confirmDialog.isDestroyed&&this.confirmDialog.destroy()},C.prototype.updateRecordByID=function(r){var s=this;if(this.parent.enableImmutableMode&&this.parent.editSettings.allowEditing&&0<this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length&&this.parent.treeGrid.endEdit(),!this.parent.readOnly){var e=this.parent.taskFields;if(!ne.isNullOrUndefined(r)&&!ne.isNullOrUndefined(r[e.id])){var o="ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf((r.hasChildRecords?"R":"T")+r[e.id])]:this.parent.getRecordByID(r[e.id]);if(ne.isNullOrUndefined(o[e.milestone])||!0===o[e.milestone]&&(o[e.milestone]=!1),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("Edit")&&o&&(this.parent.undoRedoModule.createUndoCollection(),(d={}).requestType=this.parent.contextMenuModule&&this.parent.contextMenuModule.item?this.parent.contextMenuModule.item:"methodUpdate",d.modifiedRecords=ne.extend([],[o],[],!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=d),!ne.isNullOrUndefined(this.parent.editModule)&&o){if(this.parent.isOnEdit=!0,this.validateUpdateValues(r,o,!0),this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed){if("ProjectView"===this.parent.viewType&&r.ganttProperties.predecessor&&o.ganttProperties.predecessor){for(var l=this,t=0;t<r.ganttProperties.predecessor.length;t++)if("break"===function(t){var e=o.ganttProperties.predecessor.filter(function(e){return e.from===r.ganttProperties.predecessor[t].from&&e.to===r.ganttProperties.predecessor[t].to&&r.ganttProperties.predecessor[t].offset!==e.offset&&(s.parent.flatData[s.parent.ids.indexOf(e.to)].ganttProperties.predecessor.filter(function(e){return e.from===r.ganttProperties.predecessor[t].from&&e.to===r.ganttProperties.predecessor[t].to})[0].offset=r.ganttProperties.predecessor[t].offset),e.from!==r.ganttProperties.predecessor[t].from&&e.from!==r.ganttProperties.predecessor[t].to});if(0<e.length){for(var i=0;i<e.length;i++)for(var a=l.parent.flatData[l.parent.ids.indexOf(e[i].from)],n=0;n<a.ganttProperties.predecessor.length;n++)if(a.ganttProperties.predecessor[n].from===e[i].from&&a.ganttProperties.predecessor[n].to===e[i].to){a.ganttProperties.predecessor.splice(n,1);break}return"break"}}(t))break}else if(!r.ganttProperties.predecessor&&o.ganttProperties.predecessor)for(t=0;t<o.ganttProperties.predecessor.length;t++){var i=void 0,i=o.ganttProperties.taskId.toString()===o.ganttProperties.predecessor[t].from?o.ganttProperties.predecessor[t].to:o.ganttProperties.predecessor[t].from,a=this.parent.flatData[this.parent.ids.indexOf(i)];if(!ne.isNullOrUndefined(a)&&!ne.isNullOrUndefined(a.ganttProperties)&&!ne.isNullOrUndefined(a.ganttProperties.predecessor))for(var n=0;n<a.ganttProperties.predecessor.length;n++)a.ganttProperties.predecessor[n].from===o.ganttProperties.predecessor[t].from&&a.ganttProperties.predecessor[n].to===o.ganttProperties.predecessor[t].to&&a.ganttProperties.predecessor.splice(n,1)}o.ganttProperties.resourceInfo=r.ganttProperties.resourceInfo,o[this.parent.taskFields.resourceInfo]=r[this.parent.taskFields.resourceInfo],o.taskData[this.parent.taskFields.resourceInfo]=r.taskData[this.parent.taskFields.resourceInfo],this.parent.setRecordValue("predecessorsName",r.ganttProperties.predecessorsName,o.ganttProperties,!0),this.parent.taskFields.dependency&&this.parent.setRecordValue(this.parent.taskFields.dependency,r[this.parent.taskFields.dependency],o),this.parent.setRecordValue("predecessor",r.ganttProperties.predecessor,o.ganttProperties,!0)}r[this.parent.taskFields.resourceInfo]&&(0!==o.ganttProperties.duration||"FixedWork"===o.ganttProperties.taskType&&!this.parent.isConvertedMilestone||this.parent.dataOperation.updateWorkWithDuration(o),this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.updateResourceRelatedFields(o,"resource"),this.parent.dateValidationModule.calculateEndDate(o));var d=Object.keys(r);-1===d.indexOf(e.startDate)&&-1===d.indexOf(e.endDate)&&-1===d.indexOf(e.duration)||this.parent.dataOperation.calculateScheduledValues(o,o.taskData,!1),-1!==d.indexOf(e.baselineDuration)&&this.parent.dataOperation.calculateScheduledValuesforBaseline(o,o.taskData,!1),this.parent.dataOperation.updateWidthLeft(o),ne.isUndefined(r[this.parent.taskFields.dependency])||r[this.parent.taskFields.dependency]===o.ganttProperties.predecessorsName?((d={}).data=o,"ResourceView"===this.parent.viewType&&(d.action="methodUpdate"),this.parent.editModule.initiateUpdateAction(d)):this.parent.connectorLineEditModule.updatePredecessor(o,r[this.parent.taskFields.dependency])}}}},C.prototype.validateUpdateValues=function(e,t,i){for(var a=this.parent,n=a.taskFields,r=z(a.columnMapping),s=[],o=!1,l=0,d=Object.keys(e);l<d.length;l++){var h=d[l];if(n.startDate===h||n.endDate===h||n.duration===h||n.baselineDuration===h){var p=n.baselineDuration===h;ne.isNullOrUndefined(e[""+h])&&!a.allowUnscheduledTasks||(c=t.ganttProperties,g=n.duration===h||n.baselineDuration===h,i?(g?(a.dataOperation.updateDurationValue(e[h],c,p),!p&&0<c.duration&&c.isMilestone&&this.parent.setRecordValue("isMilestone",!1,c,!0)):(g="string"==typeof e[h]?new Date(e[h]):e[h],h===n.endDate&&ne.isNullOrUndefined(c.startDate)&&(ne.isNullOrUndefined(e[n.duration])||""===e[n.duration]||Number.isNaN(e[n.duration]))&&(g=this.parent.editModule.dialogModule.isFromEditDialog?t.ganttProperties.endDate:e[n.endDate]),a.setRecordValue(r[h],g,c,!0),!t[n.startDate]||t[n.startDate]instanceof Date||(t[n.startDate]=new Date(t[n.startDate])),!t[n.endDate]||t[n.endDate]instanceof Date||(t[n.endDate]=new Date(t[n.endDate]))),a.dataOperation.updateMappingData(t,r[h])):(s.push(h),o=!0))}else if(n.resourceInfo===h){p=a.dataOperation.setResourceInfo(e);"ResourceView"===this.parent.viewType&&(JSON.stringify(p)!==JSON.stringify(t.ganttProperties.resourceInfo)?(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=ne.isNullOrUndefined(t.ganttProperties.resourceInfo)?[]:t.ganttProperties.resourceInfo.slice()):this.parent.editModule.dialogModule.isResourceUpdate=!1),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed||(t.ganttProperties.resourceInfo=p),a.dataOperation.updateMappingData(t,"resourceInfo")}else if(n.dependency!==h)if(-1!==[n.progress,n.notes,n.durationUnit,n.milestone,n.name,n.baselineStartDate,n.baselineEndDate,n.id,n.segments,n.cssClass,n.constraintDate,n.constraintType].indexOf(h)){var u,c,g,f=a.columnByField[h],m=e[h],y=(ne.isNullOrUndefined(f)||"datepickeredit"!==f.editType&&"datetimepickeredit"!==f.editType||(m=a.dataOperation.getDateFromFormat(m)),r[h]);switch(h){case n.id:y="taskId";break;case n.name:y="taskName";break;case n.constraintDate:y="constraintDate";break;case n.constraintType:y="constraintType";break;case n.cssClass:y="cssClass";break;case n.milestone:var D,k,y="isMilestone";ne.isNullOrUndefined(n.duration)||(D=t.ganttProperties,k=e[n.duration],a.setRecordValue(n.duration,k=m?0:k<=0?1:k,t,!0),a.setRecordValue("duration",k,D,!0),a.setRecordValue("taskData."+n.duration,k,t));break;case n.segments:t.ganttProperties.segments&&(y="segments",e)&&!ne.isNullOrUndefined(e[n.segments])&&0<e[n.segments].length&&e.ganttProperties&&e.ganttProperties.segments&&(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&(t.ganttProperties.segments=e.ganttProperties.segments),D=t.ganttProperties.segments.reduce(function(e,t){return e+t.duration},0),k=t.ganttProperties.startDate,u=this.parent.dataOperation.getEndDate(k,D,t.ganttProperties.durationUnit,t.ganttProperties,!1),a.setRecordValue("endDate",a.dataOperation.getDateFromFormat(u),t.ganttProperties,!0))}if(!ne.isNullOrUndefined(y)){var b=[];if("segments"===y&&m&&0<m.length&&!ne.isNullOrUndefined(t.ganttProperties.segments)){for(var w=0;w<m.length;w++){var T={};m[w][n.startDate]&&(T.startDate=m[w][n.startDate]),m[w][n.endDate]&&(T.endDate=m[w][n.endDate]),m[w][n.duration]&&(T.duration=parseFloat(m[w][n.duration])),m[w][n.id]&&(T.id=m[w][n.id]),b.push(T)}a.setRecordValue(y,b,t.ganttProperties,!0)}else("segments"!==y||"segments"===y&&ne.isNullOrUndefined(m))&&a.setRecordValue(y,m,t.ganttProperties,!0)}(h===n.baselineStartDate||h===n.baselineEndDate)&&t.ganttProperties.baselineStartDate&&t.ganttProperties.baselineEndDate&&(c=t.ganttProperties,a.setRecordValue("baselineStartDate",a.dataOperation.checkBaselineStartDate(c.baselineStartDate,c),c,!0),g=this.parent.getCurrentDayEndTime(c.baselineEndDate),c.baselineEndDate&&0===c.baselineEndDate.getHours()&&86400!==g&&a.dataOperation.setTime(g,c.baselineEndDate),(c.baselineStartDate&&c.baselineEndDate&&c.baselineStartDate.getTime()>c.baselineEndDate.getTime()||!ne.isNullOrUndefined(c.baselineStartDate)&&!ne.isNullOrUndefined(c.startDate)&&c.baselineStartDate.getTime()===c.startDate.getTime()&&!ne.isNullOrUndefined(c.baselineEndDate)&&!ne.isNullOrUndefined(c.endDate)&&c.baselineEndDate.toLocaleDateString()===c.endDate.toLocaleDateString()&&c.isMilestone)&&(c.baselineEndDate=c.baselineStartDate),a.setRecordValue("baselineEndDate",a.dataOperation.checkBaselineEndDate(c.baselineEndDate),c,!0),a.setRecordValue("baselineLeft",a.dataOperation.calculateBaselineLeft(c),c,!0),a.setRecordValue("baselineWidth",a.dataOperation.calculateBaselineWidth(c),c,!0),!t[n.baselineStartDate]||t[n.baselineStartDate]instanceof Date||(t[n.baselineStartDate]=new Date(t[n.baselineStartDate])),!t[n.baselineEndDate]||t[n.baselineEndDate]instanceof Date||(t[n.baselineEndDate]=new Date(t[n.baselineEndDate]))),a.setRecordValue("taskData."+h,m,t),h===n.segments&&e&&!ne.isNullOrUndefined(e[n.segments])&&0<e[n.segments].length&&(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&e.ganttProperties&&e.ganttProperties.segments&&(t.ganttProperties.segments=e.ganttProperties.segments),a.dataOperation.setSegmentsInfo(t,!0)),a.setRecordValue(h,m,t)}else n.indicators===h?(m=e[h],a.setRecordValue("indicators",m,t.ganttProperties,!0),a.setRecordValue("taskData."+h,m,t),a.setRecordValue(h,m,t)):n.work===h?(a.setRecordValue("work",e[h],t.ganttProperties,!0),this.parent.dataOperation.updateMappingData(t,"work"),this.parent.dataOperation.updateMappingData(t,"duration"),this.parent.dataOperation.updateMappingData(t,"endDate")):h===n.type?(m=e[h],a.setRecordValue("taskType",m,t.ganttProperties,!0),a.setRecordValue(h,m,t),a.setRecordValue("taskData."+h,m,t)):h===n.expandState?(m=e[h],this.parent.setRecordValue("taskData."+h,m,t),this.parent.setRecordValue(this.parent.taskFields.expandState,m,t),this.parent.setRecordValue("expanded",m,t),this.parent.treeGrid.refresh()):-1!==a.customColumns.indexOf(h)?(f=a.columnByField[h],m=e[h],!ne.isNullOrUndefined(f.edit)||"datepickeredit"!==f.editType&&"datetimepickeredit"!==f.editType||(m=a.dataOperation.getDateFromFormat(m)),a.setRecordValue("taskData."+h,m,t),a.setRecordValue(h,m,t)):n.manual===h&&(a.setRecordValue("isAutoSchedule",!e[h],t.ganttProperties,!0),this.parent.setRecordValue(h,e[h],t),this.updateTaskScheduleModes(t))}o&&this.validateScheduleValues(s,t,e)},C.prototype.updateResourceRelatedFields=function(e,t){var i=e.ganttProperties,a=this.parent.previousRecords,n=i.taskType||this.parent.taskType,r=i.isAutoSchedule,s=this.parent.editModule.dialogModule&&this.parent.editModule.dialogModule.currentResources?this.parent.editModule.dialogModule.currentResources:e.ganttProperties.resourceInfo;if(ne.isNullOrUndefined(s))ne.isNullOrUndefined(s)&&"FixedDuration"===n&&0===i.duration&&this.parent.dataOperation.updateWorkWithDuration(e);else switch(n){case"FixedUnit":ne.isNullOrUndefined(a[i.uniqueID])||ne.isNullOrUndefined(a[i.uniqueID].ganttProperties)||null!==a[i.uniqueID].ganttProperties.resourceNames&&""!==a[i.uniqueID].ganttProperties.resourceNames||this.parent.dataOperation.updateWorkWithDuration(e),0!==s.length&&(r&&s.length?"resource"===t||"work"===t?this.parent.dataOperation.updateDurationWithWork(e):"duration"!==t&&"endDate"!==t||(this.parent.dataOperation.updateWorkWithDuration(e),0===i.duration&&this.parent.setRecordValue("isMilestone",!0,i,!0)):r||"work"!==t?this.parent.dataOperation.updateWorkWithDuration(e):this.parent.dataOperation.updateUnitWithWork(e));break;case"FixedWork":0!==s.length&&(r?"duration"===t||"endDate"===t?(this.parent.dataOperation.updateUnitWithWork(e),0===i.duration&&this.parent.setRecordValue("isMilestone",!0,i,!0)):this.parent.dataOperation.updateDurationWithWork(e):"work"===t?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e));break;case"FixedDuration":0===s.length?this.parent.dataOperation.updateWorkWithDuration(e):s.length&&"work"===t?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e)}},C.prototype.validateScheduleValues=function(e,t,i){var a=this.parent;2<e.length?a.dataOperation.calculateScheduledValues(t,i,!1):1<e.length?this.validateScheduleByTwoValues(i,e,t):this.dialogModule.validateScheduleValuesByCurrentField(e[0],i[e[0]],t)},C.prototype.validateScheduleByTwoValues=function(e,t,i){var a,n,r,s=this.parent,o=s.taskFields,l=i.ganttProperties,d=s.allowUnscheduledTasks;-1!==t.indexOf(o.startDate)&&(a=e[o.startDate]),-1!==t.indexOf(o.endDate)&&(n=e[o.endDate]),-1!==t.indexOf(o.duration)&&(r=e[o.duration]),a&&n||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.endDate)?(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(a),l,!0),s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(n),l,!0),s.dataOperation.calculateDuration(i)):n&&r||d&&-1!==t.indexOf(o.endDate)&&-1!==t.indexOf(o.duration)?(s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(n),l,!0),s.dataOperation.updateDurationValue(r,l)):(a&&r||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.duration))&&(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(a),l,!0),s.dataOperation.updateDurationValue(r,l))},C.prototype.isTaskbarMoved=function(e){var t,i,a,n,r=!1,s=e.ganttProperties,e=this.parent.previousRecords&&this.parent.previousRecords[e.uniqueID];return e&&e.ganttProperties&&(t=ne.getValue("ganttProperties.startDate",e),i=ne.getValue("ganttProperties.endDate",e),a=ne.getValue("ganttProperties.duration",e),n=ne.getValue("ganttProperties.durationUnit",e),-1===(e=Object.keys(e.ganttProperties)).indexOf("startDate")&&-1===e.indexOf("endDate")&&-1===e.indexOf("duration")&&-1===e.indexOf("durationUnit")||(ne.isNullOrUndefined(t)&&!ne.isNullOrUndefined(s.startDate)||ne.isNullOrUndefined(i)&&!ne.isNullOrUndefined(s.endDate)||ne.isNullOrUndefined(s.startDate)&&!ne.isNullOrUndefined(t)||ne.isNullOrUndefined(s.endDate)&&!ne.isNullOrUndefined(i)||t&&t.getTime()!==s.startDate.getTime()||i&&i.getTime()!==s.endDate.getTime()||!ne.isNullOrUndefined(a)&&a!==s.duration||!ne.isNullOrUndefined(a)&&a===s.duration&&n!==s.durationUnit)&&(r=!0)),r},C.prototype.removeImmediateParentDependency=function(e,t){if(!Array.isArray(e))return[];for(var i=[],a=0;a<e.length;a++){var n,r,s=e[a],o=t.getRecordByID(s.from),l=t.getRecordByID(s.to);o&&l&&o.ganttProperties&&l.ganttProperties?(n=o.ganttProperties.taskId,r=l.ganttProperties.taskId,o=o.parentItem,l=l.parentItem,o=o&&o.taskId,l=l&&l.taskId,o=!ne.isNullOrUndefined(o)&&!ne.isNullOrUndefined(r)&&o.toString()===r.toString(),r=!ne.isNullOrUndefined(l)&&!ne.isNullOrUndefined(n)&&l.toString()===n.toString(),o||r||i.push(s)):i.push(s)}return i},C.prototype.isPredecessorUpdated=function(e){var t=!1,i=this.parent.previousRecords[e.uniqueID];return i&&i.ganttProperties&&i.ganttProperties.hasOwnProperty("predecessor")&&(e.ganttProperties.predecessorsName===i.ganttProperties.predecessorsName||""===e.ganttProperties.predecessorsName&&ne.isNullOrUndefined(i.ganttProperties.predecessorsName)?(i=this.removeImmediateParentDependency(i.ganttProperties.predecessor,this.parent),this.parent.setRecordValue("predecessor",i,e.ganttProperties,!0)):t=!0),t},C.prototype.isCheckPredecessor=function(e){var t=!1;return t=this.parent.previousRecords[e.uniqueID]&&this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation&&0<this.parent.predecessorModule.getValidPredecessor(e).length&&this.isTaskbarMoved(e)?!0:t},C.prototype.updateGanttProperties=function(t,i){var a=["taskId","uniqueID","rowUniqueID","parentId","predecessor"];Object.keys(t.ganttProperties).forEach(function(e){-1===a.indexOf(e)&&(i.ganttProperties[e]=t.ganttProperties[e])})},C.prototype.shouldShowDialog=function(e,t){return!(!t||("MustStartOn"===e?t.respectMustStartOn:"MustFinishOn"===e?t.respectMustFinishOn:"StartNoLaterThan"===e?t.respectStartNoLaterThan:"FinishNoLaterThan"!==e||t.respectFinishNoLaterThan))},C.prototype.initiateUpdateAction=function(e){var t,i=this.isCheckPredecessor(e.data);if(ne.isNullOrUndefined(e.data.parentItem)||i){if(0<e.data.childRecords.length&&!i&&!(i=this.isCheckPredecessor(e.data))&&this.isTaskbarMoved(e.data))for(var a=0;a<e.data.childRecords.length;a++)0<this.parent.predecessorModule.getValidPredecessor(e.data.childRecords[a]).length&&(t=a,i=!0)}else r=this.parent.getRecordByID(e.data.parentItem.taskId),i=!!(this.isTaskbarMoved(e.data)&&0<this.parent.predecessorModule.getValidPredecessor(r).length&&this.parent.isInPredecessorValidation);(!this.parent.undoRedoModule||this.parent.undoRedoModule&&!this.parent.undoRedoModule.currentAction||this.parent.undoRedoModule.currentAction&&"indent"!==this.parent.undoRedoModule.currentAction.action&&"outdent"!==this.parent.undoRedoModule.currentAction.action)&&(this.taskbarMoved=this.isTaskbarMoved(e.data)),this.predecessorUpdated=this.isPredecessorUpdated(e.data),this.predecessorUpdated&&(this.parent.isConnectorLineUpdate=!0,this.parent.connectorLineEditModule.addRemovePredecessor(e.data));var n={};if(!i||!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)this.taskbarMoved&&(this.parent.isConnectorLineUpdate=!0),this.updateEditedTask(e);else{n=ne.isNullOrUndefined(r)?ne.isNullOrUndefined(t)?this.parent.connectorLineEditModule.validateTypes(e.data):this.parent.connectorLineEditModule.validateTypes(e.data.childRecords[t],e.data):this.parent.connectorLineEditModule.validateTypes(r,e.data),this.parent.isConnectorLineUpdate=!0;var r=this.parent.predecessorModule.filterPredecessorsByTarget(e.data.ganttProperties.predecessor,e.data,this.parent.viewType),s=e&&e.data&&e.data.ganttProperties?e.data.ganttProperties.constraintType:null,s=!ne.isNullOrUndefined(ne.getValue("violationType",n))||s===k.ConstraintType.MustStartOn||s===k.ConstraintType.MustFinishOn;if(s&&ne.isNullOrUndefined(ne.getValue("violationType",n))){for(var o,l=e.data.ganttProperties.predecessor,d=null,h=e.data.ganttProperties.taskId,a=0;a<l.length;a++){var p=l[a];if(p.to.toString()===h.toString()){d=p;break}}d&&(o=this.parent.connectorLineModule.getRecordByID(d.from),n.parentTask=o)}!s||0===r.length&&e.data.ganttProperties.predecessor?this.updateEditedTask(e):(o=void 0,o=this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType?(this.taskViolation=this.parent.constraintViolationType,this.parent.constraintViolationType="PredecessorLink",this.validateConstraintViolation(e)):this.validateTaskEvent(e),s=this.shouldShowDialog(this.taskViolation,o.validateMode),r=null,(r=this.parent&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&"function"==typeof this.parent.editModule.taskbarEditModule.isValidDependency?this.parent.editModule.taskbarEditModule.isValidDependency(e.data):r)&&(r=r.isValid,s||((!1===this.parent.updateOffsetOnTaskbarEdit&&!1===r&&!1===o.validateMode.respectLink||(o.data.ganttProperties.constraintType===k.ConstraintType.MustStartOn||o.data.ganttProperties.constraintType===k.ConstraintType.MustFinishOn)&&!1===o.validateMode.respectLink)&&(o.validateMode.respectLink=!0),!1===this.parent.updateOffsetOnTaskbarEdit&&!1===r&&!1===o.validateMode.respectLink&&(o.validateMode.respectLink=!0),o.data.ganttProperties.constraintType!==k.ConstraintType.MustStartOn&&o.data.ganttProperties.constraintType!==k.ConstraintType.MustFinishOn)||(o.validateMode.respectLink=!0)),!1===o.validateMode.preserveLinkWithEditing&&!1===o.validateMode.removeLink&&!1===o.validateMode.respectLink||s?(this.violationArgs={matchedModifiedTask:e.data,args:e},this.taskViolation&&this.parent.taskFields.constraintDate&&this.parent.taskFields.constraintType&&(n.violationType=this.taskViolation,n.predecessorLink=!0),this.parent.connectorLineEditModule.openValidationDialog(n)):(this.parent.editModule&&this.parent.editModule.dialogModule&&this.parent.editModule.dialogModule.isEdit&&this.predecessorUpdated&&(this.isValidatedEditedRecord=!0,this.parent.predecessorModule.validatePredecessor(e.data,[],"")),this.parent.connectorLineEditModule.applyPredecessorOption()))}},C.prototype.validateTaskEvent=function(e){var t={};return this.resetValidateArgs(),(this.parent.currentEditedArgs=t).cancel=!1,t.data=e.data,t.requestType="validateLinkedTask",t.validateMode=this.parent.dialogValidateMode,t.editEventArgs=e,this.parent.actionBeginTask(t),t},C.prototype.validateConstraintViolation=function(e){var t={};return this.resetValidateArgs(),(this.parent.currentEditedArgs=t).cancel=!1,t.data=e.data,t.requestType="validateTaskViolation",t.violationType=this.parent.constraintViolationType,t.validateMode=this.parent.dialogValidateMode,t.editEventArgs=e,this.parent.actionBeginTask(t),t},C.prototype.resetValidateArgs=function(){this.parent.dialogValidateMode.preserveLinkWithEditing=!0,this.parent.dialogValidateMode.removeLink=!1,this.parent.dialogValidateMode.respectLink=!1,this.parent.dialogValidateMode.respectMustFinishOn=!1,this.parent.dialogValidateMode.respectMustFinishOn=!1,this.parent.dialogValidateMode.respectStartNoLaterThan=!1,this.parent.dialogValidateMode.respectFinishNoLaterThan=!1},C.prototype.validateChildPredecessors=function(){for(var i=this,a=this,e=0;e<this.parent.predecessorModule.validatedChildItems.length;e++)!function(e){var t=a.parent.predecessorModule.validatedChildItems[e];t.ganttProperties.predecessor&&0<t.ganttProperties.predecessor.length&&(a.parent.editedPredecessorRecords.some(function(e){return e[i.parent.taskFields.id]===t[i.parent.taskFields.id]})||a.parent.editedPredecessorRecords.push(t),a.isValidatedEditedRecord||(a.isFirstCall=!0),a.parent.predecessorModule.validatePredecessor(t,[],""))}(e)},C.prototype.updateEditedTask=function(e){var t=e.data;if(this.editedRecord=t,!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||this.updateParentChildRecord(t),this.parent.predecessorModule&&(this.parent.predecessorModule.isValidatedParentTaskID=""),(this.parent.isConnectorLineUpdate||this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)&&this.parent.autoCalculateDateScheduling&&!(this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)){if(this.validateChildPredecessors(),t.ganttProperties.predecessor&&(this.parent.isMileStoneEdited=t.ganttProperties.isMilestone,this.taskbarMoved&&this.parent.editedPredecessorRecords.push(t),this.isValidatedEditedRecord||(this.isFirstCall=!0,"DialogEditing"===e.action&&(this.isDialogEditing=!0),this.parent.predecessorModule.validatePredecessor(t,[],""),this.parent.predecessorModule.isChildRecordValidated=[]),this.isValidatedEditedRecord=!1),this.parent.predecessorModule.isValidatedParentTaskID="",this.parent.allowParentDependency&&this.parent.predecessorModule.isValidatedParentTaskID!==t.ganttProperties.taskId&&t.hasChildRecords&&this.parent.previousRecords[t.uniqueID].ganttProperties.startDate&&"TaskbarEditing"!==e.action&&(!t.hasChildRecords||t.hasChildRecords&&t.ganttProperties.isAutoSchedule)&&(this.parent.predecessorModule.updateChildItems(t),this.validateChildPredecessors()),this.parent.predecessorModule.isValidatedParentTaskID="",this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)for(var i=0;i<t.childRecords.length;i++)t.childRecords[i].ganttProperties.predecessor&&this.parent.predecessorModule.validatePredecessor(t.childRecords[i],[],"");this.updateParentItemOnEditing(),this.parent.dataOperation.updateParentItems(t,!0)}if(t.parentItem&&(!this.parent.autoCalculateDateScheduling||this.parent.isLoad&&this.parent.treeGrid.loadChildOnDemand&&this.parent.taskFields.hasChildMapping||this.parent.dataOperation.updateParentItems(t,!0),l=this.parent.getRecordByID(t.parentItem.taskId),ne.isNullOrUndefined(l)||l.ganttProperties.predecessorsName||(this.isFirstCall=!0,this.parent.predecessorModule.validatePredecessor(l,[],""),this.updateParentItemOnEditing())),this.parent.updateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule&&e.data&&(this.parent.connectorLineEditModule.validatedOffsetIds=[],this.parent.connectorLineEditModule.calculateOffset(e.data)),this.parent.predecessorModule.validatedParentIds=[],ne.isNullOrUndefined(this.dialogModule)||this.dialogModule&&!this.dialogModule.isFromDialogPredecessor){var a=e.data.ganttProperties.predecessor,n=this.parent.editedRecords,r=void 0,s=-1,o=void 0,l=this.parent.taskFields.constraintDate,d=this.parent.taskFields.constraintType,h=[k.ConstraintType.MustStartOn,k.ConstraintType.MustFinishOn,k.ConstraintType.StartNoLaterThan,k.ConstraintType.FinishNoLaterThan];if(l&&d&&a&&n){for(i=0;i<a.length;i++)if("break"===function(e){var t=a[e].to,e=n.findIndex(function(e){return e.ganttProperties.taskId.toString()===t&&-1<h.indexOf(e.ganttProperties.constraintType)});if(-1!==e)return r=n[e],s=e,"break"}(i))break}else if(n){for(i=0;i<n.length;i++){var p=n[i];if(-1!==h.indexOf(p.ganttProperties.constraintType)){r=p;break}}if(r&&r.ganttProperties&&r.ganttProperties.predecessor)for(a=r.ganttProperties.predecessor,i=0;i<a.length;i++)if("break"===function(e){var t=a[e].from,e=n.findIndex(function(e){return e.ganttProperties.taskId.toString()===t});if(-1!==e)return o=n[e],s=e,"break"}(i))break}var u,l=e.data.ganttProperties.taskId,d=this.parent.validationDialogElement?this.parent.validationDialogElement.element:null,c=!1;(c=d?!d.ej2_instances[0].dialogOpen:c)&&r&&r.ganttProperties.taskId!==l&&(this.violationArgs={matchedModifiedTask:r,matchedModifiedTaskIndex:s,args:e,matchedParedRecord:o},d=r,c=o||e.data,ne.isNullOrUndefined(this.parent.constraintViolationType)&&((l=r.ganttProperties.constraintType)===k.ConstraintType.MustStartOn?this.parent.constraintViolationType="MustStartOn":l===k.ConstraintType.MustFinishOn?this.parent.constraintViolationType="MustFinishOn":l===k.ConstraintType.StartNoLaterThan?this.parent.constraintViolationType="StartNoLaterThan":l===k.ConstraintType.FinishNoLaterThan&&(this.parent.constraintViolationType="FinishNoLaterThan")),(l=this.parent.editModule.validateConstraintViolation(e)).violationType)?(u=l.validateMode,this.shouldShowDialog(l.violationType,u)?this.parent.connectorLineEditModule.openConstraintValidationDialog({violationType:l.violationType,parentRecord:c,record:d,predecessorLink:a}):(l.validateMode.respectLink=!0,this.parent.connectorLineEditModule.applyPredecessorOption())):this.initiateSaveAction(e)}},C.prototype.updateParentItemOnEditing=function(){for(var t=this,e=ne.getValue("parentRecord",this.parent.predecessorModule),i=0;i<e.length;i++)this.parent.dataOperation.updateParentItems(e[i]);this.parent.editModule.updateParentRecords&&0<this.parent.editModule.updateParentRecords.length&&this.parent.editModule.updateParentRecords.forEach(function(e){e.ganttProperties.predecessor&&0<e.ganttProperties.predecessor.length&&t.parent.predecessorModule.validatePredecessor(e,[],"")});for(i=0;i<e.length;i++)this.parent.dataOperation.updateParentItems(e[i]);ne.setValue("parentRecord",[],this.parent.predecessorModule),ne.setValue("parentIds",[],this.parent.predecessorModule)},C.prototype.updateParentChildRecord=function(e){!e.hasChildRecords||!this.taskbarMoved||!1!==e[this.parent.taskFields.manual]&&"Auto"!==this.parent.taskMode||ne.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isResourceCellEdited||this.parent.predecessorModule.updateChildItems(e),ne.isNullOrUndefined(this.parent.editModule.cellEditModule)||(this.parent.editModule.cellEditModule.isResourceCellEdited=!1)},C.prototype.updateTaskScheduleModes=function(e){var t=e[this.parent.taskFields.startDate],i=e.ganttProperties;this.parent.taskFields.manual&&this.parent.setRecordValue(this.parent.taskFields.manual,!e.ganttProperties.isAutoSchedule,e),e.hasChildRecords&&i.isAutoSchedule?(this.parent.setRecordValue("startDate",i.autoStartDate,i,!0),this.parent.setRecordValue("endDate",i.autoEndDate,i,!0),this.parent.setRecordValue("StartDate",i.autoStartDate,e,!0),this.parent.setRecordValue("EndDate",i.autoEndDate,e,!0),this.parent.setRecordValue("taskData.StartDate",i.autoStartDate,e,!0),this.parent.setRecordValue("taskData.EndDate",i.autoEndDate,e,!0),this.parent.setRecordValue("width",this.parent.dataOperation.calculateWidth(e,!0),i,!0),this.parent.setRecordValue("left",this.parent.dataOperation.calculateLeft(i,e,!0),i,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.width,i.progress),i,!0),this.parent.dataOperation.calculateDuration(e)):e.hasChildRecords&&!i.isAutoSchedule?(this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.calculateDuration(e),this.parent.setRecordValue("autoStartDate",i.autoStartDate,i,!0),this.parent.setRecordValue("autoEndDate",i.autoEndDate,i,!0),this.parent.setRecordValue("autoDuration",this.parent.dataOperation.calculateAutoDuration(e),i,!0),this.parent.dataOperation.updateAutoWidthLeft(e)):(i=this.parent.dateValidationModule.checkStartDate(t,e.ganttProperties),this.parent.setRecordValue("startDate",i,e.ganttProperties,!0),this.parent.dataOperation.updateMappingData(e,"startDate"),this.parent.dateValidationModule.calculateEndDate(e),this.parent.setRecordValue("taskData."+this.parent.taskFields.manual,e[this.parent.taskFields.manual],e),this.parent.dataOperation.updateWidthLeft(e))},C.prototype.updateParentProgress=function(e){var t,i=0,e=this.parent.getParentTask(e),a=e.childRecords,n=a?a.length:0,r=0,s=0,o=0;if(a){for(var l=0;l<n;l++)a[l].ganttProperties.isMilestone&&!a[l].hasChildRecords||!j(a[l].ganttProperties)?s+=1:(t=this.parent.dataOperation.getParentProgress(a[l]),r+=ne.getValue("totalProgress",t),o+=ne.getValue("totalDuration",t));i=0<n-s?Math.round(r/o):0,isNaN(i)&&(i=0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(e.ganttProperties.isAutoSchedule?e.ganttProperties.width:e.ganttProperties.autoWidth,i),e.ganttProperties,!0),this.parent.setRecordValue("progress",Math.floor(i),e.ganttProperties,!0),this.parent.setRecordValue("totalProgress",r,e.ganttProperties,!0),this.parent.setRecordValue("totalDuration",o,e.ganttProperties,!0)}this.parent.dataOperation.updateTaskData(e),e.parentItem&&this.updateParentProgress(e.parentItem)},C.prototype.revertCellEdit=function(e){this.parent.editModule.reUpdatePreviousRecords(!1,!0),this.resetEditProperties()},C.prototype.reUpdatePreviousRecords=function(e,t,i){for(var a=this.parent.previousRecords,n=i?[i]:Object.keys(a),r=0;r<n.length;r++){var s,o=n[r],l=a[o];l&&(o=this.parent.getTaskByUniqueID(o),this.copyTaskData(o.taskData,l.taskData),delete l.taskData,this.copyTaskData(o.ganttProperties,l.ganttProperties),delete l.ganttProperties,this.copyTaskData(o,l),l=this.parent.currentViewData.indexOf(o),e&&this.parent.chartRowsModule.refreshRow(l),t)&&(s="ProjectView"===this.parent.viewType?o.ganttProperties.taskId:o.ganttProperties.rowUniqueID,this.parent.treeGrid.grid.setRowData(s,o),this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[l].getAttribute("data-uid")).data=o)}},C.prototype.copyTaskData=function(e,t){ne.isNullOrUndefined(t)||ne.extend(e,t)},C.prototype.updateScheduleDatesOnEditing=function(e){},C.prototype.initiateSaveAction=function(h){var p=this,u={requestType:"beforeSave"},c=(u.data=h.data,this.createArray=!(u.cancel=!1),this.parent.toolbarModule&&this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&0<this.parent.undoRedoModule.getUndoCollection.length&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),u.modifiedRecords=this.parent.editedRecords,ne.isNullOrUndefined(h.target)||(u.target=h.target),u.modifiedTaskData=Z(this.parent.editedRecords,!0),"DrawConnectorLine"!==h.action&&"DeleteConnectorLine"!==h.action||(u.action=h.action,"DeleteConnectorLine"===h.action&&(this.parent.connectorLineEditModule.isPublicDependencyDelete=!1,this.parent.contextMenuModule)&&(this.parent.contextMenuModule.isCntxtMenuDependencyDelete=!1)),this.parent),g=Pa({},u.data.ganttProperties.baselineStartDate),f=Pa({},u.data.ganttProperties.baselineEndDate),m=u.data.ganttProperties.progress,y=JSON.parse(JSON.stringify(u.data.ganttProperties));this.parent.trigger("actionBegin",u,function(e){p.parent.treeGridModule.setCancelArgs=e.cancel,g===e.data.ganttProperties.baselineStartDate&&f===e.data.ganttProperties.baselineEndDate||(c.setRecordValue("baselineLeft",c.dataOperation.calculateBaselineLeft(e.data.ganttProperties),e.data.ganttProperties,!0),c.setRecordValue("baselineWidth",c.dataOperation.calculateBaselineWidth(e.data.ganttProperties),e.data.ganttProperties,!0)),p.parent.autoCalculateDateScheduling&&y!==e.data.ganttProperties&&!ne.isNullOrUndefined(e.data.parentItem)&&(p.updateParentItemOnEditing(),p.parent.dataOperation.updateParentItems(e.data,!0));var t=e.data.ganttProperties,i=t.startDate,a=t.endDate,n=(t.segments,t.durationUnit),r=t.isAutoSchedule,s=t.isMilestone,o=p.parent.treeGridModule.perviousStartDate,l=p.parent.treeGridModule.perviousEndDate;if(!ne.isNullOrUndefined(t.segments)&&0!==t.segments.length||(ne.isNullOrUndefined(o)||o.getTime()===(!ne.isNullOrUndefined(i)&&i.getTime()))&&(ne.isNullOrUndefined(l)||l.getTime()===(!ne.isNullOrUndefined(a)&&a.getTime()))||0!==(o=p.parent.dateValidationModule.getDuration(i,a,n,r,s,!0))&&(t.isMilestone=!1,t.duration=o),p.parent.dataOperation.updateWidthLeft(e.data),ne.isNullOrUndefined(p.parent.taskFields.progress)||m===e.data.ganttProperties.progress||(l=e.data.ganttProperties.isAutoSchedule?e.data.ganttProperties.width:e.data.ganttProperties.autoWidth,p.parent.setRecordValue("progressWidth",p.parent.dataOperation.getProgressWidth(l,e.data.ganttProperties.progress),e.data.ganttProperties,!0)),p.parent.chartRowsModule.updateSegment(e.data.ganttProperties.segments,e.data.ganttProperties.taskId),e.cancel)p.reUpdatePreviousRecords(),p.parent.chartRowsModule.refreshRecords([h.data]),p.resetEditProperties(u);else{if(p.parent.showLoadingIndicator(),e.modifiedRecords)for(var d=0;d<e.modifiedRecords.length;d++)p.parent.enableWBS&&p.parent.updateWBSPredecessor(e.modifiedRecords[d]),p.parent.dataOperation.updateTaskData(e.modifiedRecords[d]);e.modifiedTaskData=Z(e.modifiedRecords,null,null,p.parent),_(p.parent.dataSource)?(i=p.parent.dataSource,a={changedRecords:e.modifiedTaskData},n=p.parent.query instanceof D.Query?p.parent.query:new D.Query,((r=i.adaptor)instanceof D.WebApiAdaptor&&r instanceof D.ODataAdaptor&&!i.dataSource.batchUrl?i.update(p.parent.taskFields.id,a.changedRecords,null,n):i.saveChanges(a,p.parent.taskFields.id,null,n)).then(function(e){return p.dmSuccess(e,h)}).catch(function(e){return p.dmFailure(e,h)})):p.saveSuccess(h),p.parent.enableVirtualization&&p.parent.enableTimelineVirtualization&&p.parent.ganttChartModule.setVirtualHeight(),p.parent.undoRedoModule&&(p.parent.previousFlatData=ne.extend([],p.parent.flatData,[],!0))}}),this.parent.ganttChartModule.reRenderConnectorLines()},C.prototype.updateEditedFields=function(e){for(var t=(e.changedRecords||e).length,i=0;i<t;i++){for(var a=(e.changedRecords||e)[parseInt(i.toString(),10)],n=Object.keys(a).length,r=0,s=Object.keys(a);r<n;r++){var o=s[parseInt(r.toString(),10)];this.parent.editedRecords[parseInt(i.toString(),10)][""+o]=a[""+o],this.parent.editedRecords[parseInt(i.toString(),10)].taskData[""+o]=a[""+o]}this.updateEditedRecordFields(a,this.parent.editedRecords[parseInt(i.toString(),10)])}},C.prototype.dmSuccess=function(e,t){this.updateEditedFields(e),this.saveSuccess(t)},C.prototype.updateEditedRecordFields=function(e,t){for(var i=this.parent.taskFields,a=Object.keys(e).length,n=0,r=Object.keys(e);n<a;n++){var s=r[parseInt(n.toString(),10)];t[""+s]=e[""+s]}null!==i.id&&(t.ganttProperties.taskId=e[i.id]),null!==i.name&&(t.ganttProperties.taskName=e[i.name]),null!==i.startDate&&(t.ganttProperties.startDate=e[i.startDate]),null!==i.endDate&&(t.ganttProperties.endDate=e[i.endDate]),null!==i.duration&&(t.ganttProperties.duration=parseFloat(e[i.duration])),null!==i.durationUnit&&(t.ganttProperties.durationUnit=e[i.durationUnit]),null!==i.progress&&(t.ganttProperties.progress=e[i.progress]),null!==i.dependency&&(t.ganttProperties.dependency=e[i.dependency]),null!==i.parentID&&(t.ganttProperties.parentID=e[i.parentID]),null!==i.baselineEndDate&&(t.ganttProperties.baselineEndDate=e[i.baselineEndDate]),null!==i.baselineStartDate&&(t.ganttProperties.baselineStartDate=e[i.baselineStartDate]),null!==i.resourceInfo&&(t.ganttProperties.resources=e[i.resourceInfo])},C.prototype.dmFailure=function(e,t){if(this.deletedTaskDetails.length){for(var i=this.deletedTaskDetails,a=0;a<i.length;a++)i[a].isDelete=!1;this.deletedTaskDetails=[]}this.reUpdatePreviousRecords(!0,!0),this.resetEditProperties(),this.parent.trigger("actionFailure",{error:e})},C.prototype.updateSharedTask=function(e){for(var t=e.ganttProperties.sharedTaskUniqueIds,i=0;i<t.length;i++){var a=this.parent.flatData[this.parent.ids.indexOf(t[i].toString())];a&&a.uniqueID!==e.uniqueID&&(this.updateGanttProperties(e,a),this.parent.setRecordValue("taskData",e.taskData,a,!0),this.parent.dataOperation.updateTaskData(a),this.parent.dataOperation.updateResourceName(a),ne.isNullOrUndefined(a.parentItem)||this.parent.dataOperation.updateParentItems(a.parentItem))}},C.prototype.saveSuccess=function(e){var t={};if(this.parent.timelineSettings.updateTimescaleView&&(a=this.parent.editedRecords,this.parent.timelineModule.updateTimeLineOnEditing([a],e.action)),"ResourceView"===this.parent.viewType){"TaskbarEditing"===e.action||"DrawConnectorLine"===e.action||"DeleteConnectorLine"===e.action?this.updateSharedTask(e.data):"DialogEditing"!==e.action&&"CellEditing"!==e.action&&"methodUpdate"!==e.action||(this.parent.editModule.dialogModule.isResourceUpdate?(this.updateResoures(this.parent.editModule.dialogModule.previousResource,e.data.ganttProperties.resourceInfo,e.data),this.updateSharedTask(e.data),this.isTreeGridRefresh=!0):this.updateSharedTask(e.data));for(var i=0;i<this.updateParentRecords.length;i++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[i]);this.updateParentRecords=[],this.parent.editModule.dialogModule.isResourceUpdate=!1,this.parent.editModule.dialogModule.previousResource=[]}var a=this.parent.criticalPathModule;this.parent.enableCriticalPath&&a&&a.criticalPathCollection&&(a.showCriticalPath(!0),a.criticalConnectorLine(a.criticalPathCollection,a.detailPredecessorCollection,!0,a.predecessorCollectionTaskIds)),this.isTreeGridRefresh||(this.parent.editSettings.allowEditing&&0<this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length&&(this.parent.treeGrid.grid.element.querySelector("form").ej2_instances[0].validate()||(ne.setValue("isEdit",!1,this.parent.treeGrid.grid),this.parent.editModule.cellEditModule.isCellEdit=!1),this.parent.treeGrid.endEdit()),this.parent.chartRowsModule.refreshRecords(this.parent.editedRecords),!this.parent.allowTaskbarOverlap&&this.parent.showOverAllocation&&(this.parent.contentHeight=this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,this.parent.ganttChartModule.chartBodyContent.style.height=this.parent.contentHeight+"px",this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData),this.parent.taskFields.dependency)&&this.parent.ganttChartModule.reRenderConnectorLines(),(this.parent.isConnectorLineUpdate||this.parent.undoRedoModule&&this.parent.undoRedoModule.currentAction&&this.parent.undoRedoModule.currentAction.connectedRecords)&&!ne.isNullOrUndefined(this.parent.connectorLineEditModule)&&(this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.connectorLineEditModule.refreshEditedRecordConnectorLine(this.parent.editedRecords),this.updateScheduleDatesOnEditing(e))),!this.parent.editSettings.allowTaskbarEditing||this.parent.editSettings.allowTaskbarEditing&&!this.taskbarEditModule.dependencyCancel?(t.requestType="save",t.data=e.data,t.modifiedRecords=this.parent.editedRecords,t.modifiedTaskData=Z(this.parent.editedRecords,null,null,this.parent),!this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&"middleSegment"!==this.parent.rowDragAndDropModule.dropPosition&&this.updateRowIndex(),ne.isNullOrUndefined(e.action)||ne.setValue("action",e.action,t),"TaskbarEditing"===e.action&&(t.taskBarEditAction=e.taskBarEditAction),this.endEditAction(e),this.parent.trigger("actionComplete",t),this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.draggedRecord&&(this.parent.rowDragAndDropModule.draggedRecord=null),this.parent.hideLoadingIndicator()):(this.taskbarEditModule.dependencyCancel=!1,this.resetEditProperties()),"ResourceView"===this.parent.viewType&&this.isTreeGridRefresh&&(this.parent.treeGrid.parentData=[],this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.refresh(),this.isTreeGridRefresh=!1),this.parent.editedRecords=[]},C.prototype.updateResoures=function(e,t,i){var a=this.parent.flatData,n=t?t.length:0,r=e?e.length:0;if(0!==n||0!==r){for(var s=0;s<n;s++){var o,l=[];if("NaN"===(c=parseInt(t[s][this.parent.resourceFields.id],10).toString())&&(c=t[s][this.parent.resourceFields.id]),!ne.isNullOrUndefined(e))for(var d=0;d<e.length;d++){var h=parseInt(e[d][this.parent.resourceFields.id],10).toString();if((h="NaN"===h?e[d][this.parent.resourceFields.id]:h)===c){l.push(d);break}}0===l.length?(o=a[this.parent.getTaskIds().indexOf("R"+c)])&&this.addNewRecord(i,o):("NaN"===(o=parseInt(l[0].toString(),10)).toString()&&(o=l[0].toString()),e.splice(o,1))}for(var p=e?e.length:0,s=0;s<p;s++){var u=i.ganttProperties.taskId,c=e[s][this.parent.resourceFields.id],g=a[this.parent.getTaskIds().indexOf("R"+c)];if(!ne.isNullOrUndefined(g))for(var f=0;f<g.childRecords.length;f++)g.childRecords[f].ganttProperties.taskId===u&&this.removeChildRecord(g.childRecords[f])}0<n&&(r=this.parent.getParentTask(i.parentItem))&&r.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&this.removeChildRecord(i),0===n&&this.checkWithUnassignedTask(i),this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.flatData[this.parent.flatData.length-1].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&!this.isFlatDataHaveUnAsignedTask&&(this.parent.flatData.splice(this.parent.flatData.length-1,1),this.parent.currentViewData.splice(this.parent.currentViewData.length-1,1),this.parent.taskIds.splice(this.parent.flatData.length-1,1),this.parent.ids.splice(this.parent.flatData.length-1,1)),this.isFlatDataHaveUnAsignedTask=!1}},C.prototype.checkWithUnassignedTask=function(t){for(var e,i=null,a=0;a<this.parent.flatData.length;a++)this.parent.flatData[a].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&(i=this.parent.flatData[a]);ne.isNullOrUndefined(i)?((n={})[this.parent.taskFields.id]=0,n[this.parent.taskFields.name]=this.parent.localeObj.getConstant("unassignedTask"),e=this.parent.isOnEdit,this.parent.isOnEdit=!1,n=this.parent.dataOperation.createRecord(n,0),this.parent.isOnEdit=e,this.addRecordAsBottom(n),e=this.parent.flatData[this.parent.flatData.length-1],n=this.parent.flatData.indexOf(e)+1+e.childRecords.length,t.index=n,t.level=e.level+1,this.addNewRecord(t,e),this.parent.dataSource.push(t.taskData)):(this.addNewRecord(t,i),this.isFlatDataHaveUnAsignedTask=!0);var n=this.parent.currentViewData.filter(function(e){return e.ganttProperties.taskId===t.ganttProperties.taskId&&e.hasChildRecords===t.hasChildRecords})[0];t.parentItem=n.parentItem,t.parentUniqueID=n.parentUniqueID},C.prototype.addRecordAsBottom=function(e){var t=this.parent.flatData.length,i=(this.parent.currentViewData.splice(t+1,0,e),this.parent.flatData.splice(t+1,0,e),this.parent.ids.splice(t+1,0,e.ganttProperties.rowUniqueID.toString()),0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId);this.parent.getTaskIds().splice(t+1,0,i),this.updateTreeGridUniqueID(e,"add")},C.prototype.addNewRecord=function(e,t){var i=null,i=ne.extend({},{},e,!0),a=(this.parent.setRecordValue("uniqueID",this.parent.dataOperation.getGanttUid(this.parent.element.id+"_data_"),i),this.parent.setRecordValue("uniqueID",i.uniqueID,i.ganttProperties,!0),i.uniqueID.replace(this.parent.element.id+"_data_","")),n=(this.parent.setRecordValue("rowUniqueID",a,i),this.parent.setRecordValue("rowUniqueID",a,i.ganttProperties,!0),this.parent.setRecordValue("level",1,i),this.parent.taskFields.parentID&&this.parent.setRecordValue("parentId",t.ganttProperties.taskId,i.ganttProperties,!0),this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(t),i),i.parentItem?i.parentItem.uniqueID:null);this.parent.setRecordValue("parentUniqueID",n,i),e.ganttProperties.sharedTaskUniqueIds.push(a),i.ganttProperties.sharedTaskUniqueIds=e.ganttProperties.sharedTaskUniqueIds,this.addRecordAsChild(t,i)},C.prototype.removeChildRecord=function(e){var t=this.parent,i=[],i=this.parent.dataSource instanceof D.DataManager&&0<this.parent.dataSource.dataSource.json.length?this.parent.dataSource.dataSource.json:this.parent.currentViewData,a=this.parent.dataSource,n=e,e=this.parent.getParentTask(n.parentItem);if(n){n.parentItem&&(d=0,r=e?e.childRecords:[])&&0<r.length&&(1===r.length&&(this.parent.isOnDelete=!0,r[0].isDelete=!0,this.parent.dataOperation.updateParentItems(e),this.parent.isOnDelete=!1,r[0].isDelete=!1),d=r.indexOf(n),e.childRecords.splice(d,1),this.updateParentRecords.push(e)),n.ganttProperties.sharedTaskUniqueIds.length&&(r=n.ganttProperties.sharedTaskUniqueIds.indexOf(n.ganttProperties.rowUniqueID),n.ganttProperties.sharedTaskUniqueIds.splice(r,1)),this.updateTreeGridUniqueID(n,"delete"),this.parent.taskFields.parentID||((d=[]).push(n.ganttProperties.rowUniqueID.toString()),"ProjectView"===this.parent.viewType&&this.parent.editModule.removeFromDataSource(d));var r=this.parent.flatData.indexOf(n);if(t.taskFields.parentID){for(var s=void 0,o=this.parent.currentViewData,l=0;l<o.length;l++)o[l].ganttProperties.rowUniqueID===n.ganttProperties.rowUniqueID&&(s=l);-1!==s&&(0<a.length&&a.splice(s,1),i.splice(s,1),this.parent.flatData.splice(r,1),this.parent.ids.splice(r,1),this.parent.getTaskIds().splice(r,1))}var d=i.indexOf(n);t.taskFields.parentID||(a=this.parent.editModule.getChildCount(n,0),i.splice(d,a+1),this.parent.flatData.splice(r,a+1),this.parent.ids.splice(r,a+1),this.parent.getTaskIds().splice(r,a+1)),n.parentItem&&e&&e.childRecords&&!e.childRecords.length&&(this.parent.setRecordValue("expanded",!1,e),this.parent.setRecordValue("hasChildRecords",!1,e))}},C.prototype.addRecordAsChild=function(e,t){var i,a,n=this.parent,r=this.parent.flatData.indexOf(e),s=this.parent.editModule.getChildCount(e,0),o=this.parent.getTaskByUniqueID(t.parentItem.uniqueID);if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.dialogModule.indexes&&this.dialogModule.indexes.deletedIndexes&&0<this.dialogModule.indexes.deletedIndexes.length)if(o.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask"))h=this.parent.taskIds.length+1;else for(var l=0;l<this.dialogModule.indexes.deletedIndexes.length;l++){if(this.dialogModule.indexes.deletedIndexes[l].data.parentUniqueID===t.parentUniqueID&&t.ganttProperties.taskId===this.dialogModule.indexes.deletedIndexes[l].data.ganttProperties.taskId){for(var d=this.dialogModule.indexes.deletedIndexes[l].index,h="above"===this.dialogModule.indexes.deletedIndexes[l].position?d:d+1,p=0;p<e.childRecords.length;p++)if("T"+e.childRecords[p].ganttProperties.taskId===this.dialogModule.indexes.deletedIndexes[l].id){i="above"===this.dialogModule.indexes.deletedIndexes[l].position?p:p+1;break}break}if(this.dialogModule.indexes.deletedIndexes[l].data.parentUniqueID!==t.parentUniqueID&&t.ganttProperties.taskId===this.dialogModule.indexes.deletedIndexes[l].data.ganttProperties.taskId){d=this.parent.getTaskByUniqueID(t.parentItem.uniqueID);h=d.index+d.childRecords.length+1;break}}else if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&o.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&this.parent.undoRedoModule.currentAction.deletedRecordsDetails){for(p=0;p<this.parent.undoRedoModule.currentAction.deletedRecordsDetails.length;p++)if(this.parent.undoRedoModule.currentAction.deletedRecordsDetails[p].data.ganttProperties.taskId===t.ganttProperties.taskId){i=o.index?(h=this.parent.undoRedoModule.currentAction.deletedRecordsDetails[p].data.index)-o.index-1:(h=ne.isNullOrUndefined(s)||0===s?r+1:s+r+1,0);break}}else h=!ne.isNullOrUndefined(this.addRowIndex)&&this.addRowPosition&&e.childRecords&&"Child"!==this.addRowPosition?(u=e.childRecords[this.addRowIndex],a="Above"===this.addRowPosition||"Below"===this.addRowPosition?this.addRowPosition:"Child",h=u?this.addRowIndex+r+1:s+r+1,"Above"===a?h:h+1):ne.isNullOrUndefined(s)||0===s?r+1:s+r+1;this.parent.currentViewData.splice(h,0,t),this.parent.flatData.splice(h,0,t),this.parent.ids.splice(h,0,t.ganttProperties.rowUniqueID.toString()),this.updateTreeGridUniqueID(t,"add");var u=0===t.level?"R"+t.ganttProperties.taskId:"T"+t.ganttProperties.taskId;this.parent.getTaskIds().splice(h,0,u),e.hasChildRecords||(this.parent.setRecordValue("hasChildRecords",!0,e),this.parent.setRecordValue("expanded",!0,e),e.childRecords.length)||(e.childRecords=[],!n.taskFields.parentID&&ne.isNullOrUndefined(e.taskData[this.parent.taskFields.child])&&(e.taskData[this.parent.taskFields.child]=[])),0<=i?e.childRecords.splice(i,0,t):e.childRecords.splice(e.childRecords.length,0,t),ne.isNullOrUndefined(t)||this.parent.taskFields.parentID||ne.isNullOrUndefined(e.taskData[this.parent.taskFields.child])||e.taskData[this.parent.taskFields.child].splice(e.childRecords.length,0,t.taskData),ne.isNullOrUndefined(t.parentItem)||this.updateParentRecords.push(e)},C.prototype.resetEditProperties=function(e){this.parent.currentEditedArgs={},this.resetValidateArgs(),this.parent.isOnEdit=!1,this.parent.predecessorModule.validatedChildItems=[],this.parent.isConnectorLineUpdate=!1,this.parent.editedPredecessorRecords=[],this.taskbarMoved=!1,this.predecessorUpdated=!1,ne.isNullOrUndefined(this.dialogModule)||!ne.isNullOrUndefined(e)&&(ne.isNullOrUndefined(e)||"beforeSave"!==e.requestType||e.cancel)||(this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose()),this.parent.hideSpinner(),this.parent.initiateEditAction(!1)},C.prototype.endEditAction=function(e){this.resetEditProperties(),"TaskbarEditing"===e.action?(e.target=this.taskbarEditModule.editElement,this.parent.trigger("taskbarEdited",e)):"CellEditing"===e.action?this.parent.trigger("endEdit",e):"DialogEditing"===e.action&&(this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose())},C.prototype.saveFailed=function(e){this.reUpdatePreviousRecords(),this.parent.hideSpinner()},C.prototype.renderDeleteConfirmDialog=function(){var e=new F.Dialog({width:"320px",isModal:!0,visible:!1,enableRtl:this.parent.enableRtl,content:this.parent.localeObj.getConstant("confirmDelete"),buttons:[{click:this.confirmDeleteOkButton.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("okText"),isPrimary:!0}},{click:this.closeConfirmDialog.bind(this),buttonModel:{content:this.parent.localeObj.getConstant("cancel")}}],target:this.parent.element,animationSettings:{effect:"None"}});e.appendTo("#"+this.parent.element.id+"_deleteConfirmDialog"),this.confirmDialog=e},C.prototype.closeConfirmDialog=function(){this.confirmDialog.hide()},C.prototype.confirmDeleteOkButton=function(){this.deleteSelectedItems(),this.confirmDialog.hide(),this.parent.element.querySelector(".e-treegrid").focus()},C.prototype.startDeleteAction=function(){this.parent.editSettings.allowDeleting&&!this.parent.readOnly&&(this.parent.editSettings.showDeleteConfirmDialog?this.confirmDialog.show():(this.deleteSelectedItems(),this.parent.element.querySelector(".e-treegrid").focus()))},C.prototype.deleteResourceRecords=function(n){for(var r=this,s=[],o=this,e=0;e<n.length;e++)!function(t){if(n[t].parentItem)if(1===n[t].ganttProperties.sharedTaskUniqueIds.length){for(var e=n[t],i=e.ganttProperties.sharedTaskUniqueIds,a=0;a<i.length;a++)-1!==o.parent.ids.indexOf(i[a].toString())?s.push(o.parent.flatData[o.parent.ids.indexOf(i[a].toString())]):o.parent.undoRedoModule&&o.parent.undoRedoModule.isUndoRedoPerformed&&o.parent.undoRedoModule.currentAction&&"Delete"===o.parent.undoRedoModule.currentAction.action&&s.push(o.parent.flatData[o.parent.taskIds.indexOf("T"+n[t].ganttProperties.taskId)]);-1!==o.parent.ids.indexOf(e.ganttProperties.rowUniqueID)&&-1===s.indexOf(o.parent.flatData[o.parent.ids.indexOf(e.ganttProperties.rowUniqueID)])&&s.push(o.parent.flatData[o.parent.ids.indexOf(e.ganttProperties.rowUniqueID)])}else 1<n[t].ganttProperties.sharedTaskUniqueIds.length&&n.forEach(function(e){e.ganttProperties.sharedTaskUniqueIds.forEach(function(e){s.push(r.parent.getTaskByUniqueID(r.parent.element.id+"_data_"+e))})});else{e=o.parent.flatData.filter(function(e){return e.ganttProperties.taskId===n[t].ganttProperties.taskId&&e.hasChildRecords})[0];ne.isNullOrUndefined(e)||s.push(e)}}(e);this.deleteRow(s)},C.prototype.add=function(e,t){if(t.push(e),e.hasChildRecords)for(var i=e.childRecords,a=0;a<i.length;a++)this.add(i[a],t);else-1===t.indexOf(e)&&t.push(e)},C.prototype.deleteSelectedItems=function(){var e;this.isFromDeleteMethod?(this.targetedRecords.length&&("ResourceView"===this.parent.viewType?this.deleteResourceRecords(this.targetedRecords):this.deleteRow(this.targetedRecords)),this.isFromDeleteMethod=!1):(e=[],"Cell"!==this.parent.selectionSettings.mode?e=this.parent.selectionModule.getSelectedRecords():"Cell"===this.parent.selectionSettings.mode&&(e=this.parent.selectionModule.getCellSelectedRecords()),"ResourceView"===this.parent.viewType?this.deleteResourceRecords(e):this.deleteRow(e))},C.prototype.deleteRecord=function(e){this.isFromDeleteMethod=!0;var t=typeof e;switch(this.targetedRecords=[],t){case"number":case"string":var i=e.toString();"ResourceView"===this.parent.viewType?ne.isNullOrUndefined(i)||-1===this.parent.getTaskIds().indexOf("T"+i)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+i)]):ne.isNullOrUndefined(i)||-1===this.parent.ids.indexOf(i)||this.targetedRecords.push(this.parent.getRecordByID(i));break;case"object":Array.isArray(e)?this.updateTargetedRecords(e):this.targetedRecords.push(e.valueOf())}this.startDeleteAction()},C.prototype.updateTargetedRecords=function(e){if(e.length)if("object"==typeof e[0])this.targetedRecords=e;else for(var t=0;t<e.length;t++){var i=e[t].toString();"ResourceView"===this.parent.viewType?ne.isNullOrUndefined(i)||-1===this.parent.getTaskIds().indexOf("T"+i)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+i)]):ne.isNullOrUndefined(i)||-1===this.parent.ids.indexOf(i)||this.targetedRecords.push(this.parent.getRecordByID(i))}},C.prototype.deleteRow=function(e){var t=this,l=e&&e.length?e:this.parent.selectionModule.getSelectedRecords();if(this.parent.addDeleteRecord=!0,l.length){this.parent.isOnDelete=!0,l.forEach(function(e){t.parent.undoRedoModule&&t.parent.undoRedoModule.isUndoRedoPerformed&&(("ProjectView"===t.parent.viewType?t.parent.getRecordByID(e.ganttProperties.taskId):t.parent.flatData[t.parent.taskIds.indexOf((e.hasChildRecords?"R":"T")+e.ganttProperties.taskId)]).isDelete=!0),e.isDelete=!0}),"ResourceView"!==this.parent.viewType||e.length||(l=[]),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("Delete")&&(this.parent.undoRedoModule.redoEnabled&&!this.parent.undoRedoModule.isUndoRedoPerformed&&(this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.getUndoCollection[0]=[]),this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.undoRedoModule.createUndoCollection(),e={action:"Delete",deletedRecordsDetails:[]},this.parent.undoRedoModule.findPosition(ne.extend([],[],l,!0),e,"deletedRecordsDetails"),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e);for(var d=this,i=0;i<l.length;i++)!function(e){var t=l[e];if(-1!==d.deletedTaskDetails.indexOf(t))return;var i,a=[t];"ResourceView"===d.parent.viewType&&d.parent.undoRedoModule&&d.parent.undoRedoModule.isUndoRedoPerformed&&l[e].ganttProperties.resourceInfo&&1<l[e].ganttProperties.resourceInfo.length&&(a=[],l[e].hasChildRecords||(i="T"+l[e].ganttProperties.taskId,d.parent.taskIds.reduce(function(e,t){e===i&&a.push(this.parent.flatData[t])}.bind(d),[])));for(var n=0;n<a.length;n++){var r=d.parent.getParentTask(a[n].parentItem),s=(a[n].parentItem&&(s=void 0,ne.isNullOrUndefined(r)||0<(1===(s=r.childRecords).length?s:s.filter(function(e){return!e.isDelete})).length&&d.parent.dataOperation.updateParentItems(a[n].parentItem)),a[n].ganttProperties.predecessor),o=!0;"ResourceView"===d.parent.viewType&&r&&r.ganttProperties.taskName!==d.parent.localeObj.getConstant("unassignedTask")&&(o=!1),s&&s.length&&o&&d.removePredecessorOnDelete(a[n]),d.deletedTaskDetails.push(a[n]),a[n].hasChildRecords&&d.deleteChildRecords(a[n])}}(i);this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.clearSelection();e={};e.deletedRecordCollection=this.deletedTaskDetails,e.updatedRecordCollection=this.parent.editedRecords,e.cancel=!1,e.action="delete",this.initiateDeleteAction(e),this.parent.isOnDelete=!1}ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},C.prototype.removePredecessorOnDelete=function(c){for(var g=this,f=c.ganttProperties.predecessor,m=this,e=0;e<f.length;e++)!function(e){var t=f[e],i="ResourceView"===m.parent.viewType?c.ganttProperties.taskId:c.ganttProperties.rowUniqueID,e=m.parent.rowDragAndDropModule&&"middleSegment"===m.parent.rowDragAndDropModule.dropPosition||m.dropPosition&&"middleSegment"===m.dropPosition,a=c.hasChildRecords&&c.childRecords.some(function(e){return t.to.toString()===e[g.parent.taskFields.id].toString()}),n=c.hasChildRecords&&c.childRecords.some(function(e){return t.from.toString()===e[g.parent.taskFields.id].toString()});if(t.from.toString()===i.toString()&&(a&&e||m.parent.isOnDelete)){var r=m.parent.connectorLineModule.getRecordByID(t.to.toString());if(!ne.isNullOrUndefined(r)){for(var s=ne.extend([],[],r.ganttProperties.predecessor,!0),o=void 0,l=0;l<s.length;l++){var d="ResourceView"===m.parent.viewType?r.ganttProperties.taskId:r.ganttProperties.rowUniqueID;if(s[l].to.toString()===d.toString()&&s[l].from.toString()===i.toString()){o=l;break}}s.splice(o,1),m.updatePredecessorValues(r,s)}}else if(t.to.toString()===i.toString()&&(n&&e||m.parent.isOnDelete)){var h=m.parent.connectorLineModule.getRecordByID(t.from.toString());if(!ne.isNullOrUndefined(h)){for(var p=ne.extend([],[],h.ganttProperties.predecessor,!0),o=void 0,l=0;l<p.length;l++){var u="ResourceView"===m.parent.viewType?h.ganttProperties.taskId:h.ganttProperties.rowUniqueID;if(p[l].from.toString()===u.toString()&&p[l].to.toString()===i.toString()){o=l;break}}c.uniqueID!==h.parentUniqueID&&c.parentUniqueID!==h.uniqueID&&!m.parent.isOnDelete||(p.splice(o,1),m.updatePredecessorValues(h,p))}}}(e)},C.prototype.updatePredecessorValues=function(e,t){this.parent.setRecordValue("predecessor",t,e.ganttProperties,!0);t=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",t,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,t,e),this.parent.setRecordValue(this.parent.taskFields.dependency,t,e)},C.prototype.updateTaskId=function(e,t){if(!this.parent.readOnly){var i="number"==typeof e?e.toString():e,a="number"==typeof t?t.toString():t,n=this.parent.ids;if(!ne.isNullOrUndefined(i)&&!ne.isNullOrUndefined(a)){var e=n.indexOf(i),r=n.indexOf(a);if(!(-1===e||-1<r)){r=this.parent.flatData[e];if(ne.isNullOrUndefined(r)||(this.parent.setRecordValue("taskId",t,r.ganttProperties,!0),this.parent.setRecordValue("rowUniqueID",a,r.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.id,t,r,!0),this.parent.setRecordValue(this.parent.taskFields.id,t,r.taskData,!0)),n[e]=a,r.hasChildRecords&&this.parent.taskFields.parentID)for(var s=r.childRecords,o=0;o<s.length;o++){var l=s[o];l[this.parent.taskFields.parentID]=t,this.parent.chartRowsModule.refreshRecords([l])}if(this.parent.taskFields.dependency&&!ne.isNullOrUndefined(r.ganttProperties.predecessor))for(var d=r.ganttProperties.predecessor,h=void 0,p=0;p<d.length;p++){var u=d[p];u.to===i?h=this.parent.flatData[n.indexOf(u.from)]:u.from===i&&(h=this.parent.flatData[n.indexOf(u.to)]),this.updatePredecessorOnUpdateId(h,i,a)}this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh()}}}},C.prototype.updatePredecessorOnUpdateId=function(e,t,i){if(-1<this.parent.flatData.indexOf(e))for(var a=e.ganttProperties.predecessor,n=0;n<a.length;n++){var r=a[n];r.to===t?r.to=i:r.from===t&&(r.from=i)}this.updatePredecessorValues(e,e.ganttProperties.predecessor)},C.prototype.deleteChildRecords=function(e){for(var t=this,i=e.childRecords,a=0;a<i.length;a++){var n,r,s,o=i[a];-1===this.deletedTaskDetails.indexOf(o)&&(n=o.ganttProperties.predecessor,r=!0,s=this.parent.getParentTask(o.parentItem),"ResourceView"===this.parent.viewType&&s&&s.ganttProperties.taskName!==this.parent.localeObj.getConstant("unassignedTask")&&(r=!1),n&&n.length&&r&&this.removePredecessorOnDelete(o),!ne.isNullOrUndefined(o.ganttProperties.sharedTaskUniqueIds)&&1<o.ganttProperties.sharedTaskUniqueIds.length?o.ganttProperties.sharedTaskUniqueIds.forEach(function(e){t.deletedTaskDetails.push(t.parent.getTaskByUniqueID(t.parent.element.id+"_data_"+e))}):this.deletedTaskDetails.push(o),o.hasChildRecords)&&this.deleteChildRecords(o)}},C.prototype.removeFromDataSource=function(e){var t=this.parent.dataSource instanceof D.DataManager?this.parent.dataSource.dataSource.json:this.parent.dataSource;this.removeData(t,e),this.isBreakLoop=!1},C.prototype.removeData=function(e,t){for(var i,a=0;a<e.length&&!this.isBreakLoop;a++)if(-1!==t.indexOf(ne.getValue(this.parent.taskFields.id,e[a]).toString())){if(e[a][this.parent.taskFields.child]&&(i=e[a][this.parent.taskFields.child],this.removeData(i,t)),t.splice(t.indexOf(ne.getValue(this.parent.taskFields.id,e[a]).toString()),1),e.splice(a,1),0===t.length){this.isBreakLoop=!0;break}}else e[a][this.parent.taskFields.child]&&(i=e[a][this.parent.taskFields.child],this.removeData(i,t))},C.prototype.initiateDeleteAction=function(d){var h=this,e=(this.parent.showSpinner(),{});e.requestType="beforeDelete",e.data=d.deletedRecordCollection,e.modifiedRecords=d.updatedRecordCollection,e.modifiedTaskData=Z(d.updatedRecordCollection,null,null,this.parent),this.parent.trigger("actionBegin",e,function(e){if(e.cancel){for(var t=h.deletedTaskDetails,i=0;i<t.length;i++)t[i].isDelete=!1;h.deletedTaskDetails=[],h.reUpdatePreviousRecords(),h.parent.initiateEditAction(!1),h.parent.hideSpinner()}else if(h.parent.showLoadingIndicator(),_(h.parent.dataSource)){var a=h.parent.dataSource,n=(h.parent.timezone&&e.modifiedRecords.forEach(function(e){X(e,h.parent)}),{deletedRecords:Z(e.data,null,null,h.parent),changedRecords:e.modifiedTaskData}),e=a.adaptor,r=h.parent.query instanceof D.Query?h.parent.query:new D.Query;if(e instanceof D.WebApiAdaptor&&e instanceof D.ODataAdaptor&&!a.dataSource.batchUrl){for(var s="deletedRecords",o=null,l=0;l<n[s].length;l++)o=a.remove(h.parent.taskFields.id,n[s][l],null,r);o.then(function(){for(var i="changedRecords",e=n[i].length-1;0<=e;e--)!function(t){n.deletedRecords.some(function(e){return e[h.parent.taskFields.id]===n[i][t].taskId})&&n[i].splice(t,1)}(e);a.update(h.parent.taskFields.id,n[i],null,r).then(function(){return h.deleteSuccess(d)}).catch(function(e){return h.dmFailure(e,d)})}).catch(function(e){return h.dmFailure(e,d)})}else a.saveChanges(n,h.parent.taskFields.id,null,r).then(function(){return h.deleteSuccess(d)}).catch(function(e){return h.dmFailure(e,d)})}else h.deleteSuccess(d)})},C.prototype.deleteSuccess=function(e){for(var n=this,t=this.parent.flatData,i=this.parent.currentViewData,a=[],r=0;r<e.deletedRecordCollection.length;r++)if("ProjectView"===this.parent.viewType){var s=this.parent.getRecordByID(e.deletedRecordCollection[r].ganttProperties.taskId);ne.isNullOrUndefined(s)||a.push(s)}else{var o=e.deletedRecordCollection[r].hasChildRecords,l=e.deletedRecordCollection[r].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask"),d=!e.deletedRecordCollection[r].expanded;if(o&&l&&d)return this.parent.hideLoadingIndicator(),this.deletedTaskDetails=[],void this.parent.initiateEditAction(!1);e.deletedRecordCollection[r].hasChildRecords?"R"+e.deletedRecordCollection[r].ganttProperties.taskId:"T"+e.deletedRecordCollection[r].ganttProperties.taskId,a.push(this.parent.getTaskByUniqueID(e.deletedRecordCollection[r].uniqueID))}var h=[];0<a.length&&(s=D=void 0,this.parent.enableVirtualization?(D=this.parent.flatData.indexOf(a[a.length-1]),this.parent.staticSelectedRowIndex=this.parent.selectedRowIndex=D,s=this.parent.flatData[this.parent.selectedRowIndex+1],this.parent.isCollapseAll||(this.parent.staticSelectedRowIndex=D-(a.length-1))):(D=this.parent.currentViewData.indexOf(a[a.length-1]),this.parent.staticSelectedRowIndex=this.parent.selectedRowIndex=D,s=this.parent.currentViewData[this.parent.selectedRowIndex+1]),ne.isNullOrUndefined(s)?0<=(D=this.parent.selectedRowIndex-1)&&(this.parent.currentSelection=(this.parent.enableVirtualization?this.parent.flatData:this.parent.currentViewData)[D]):this.parent.currentSelection=s),this.deletedRecord=a;for(r=0;r<a.length;r++){var p=a[r],u=void 0,c=void 0,g=void 0,f=("ResourceView"===this.parent.viewType?c=p.hasChildRecords?(u=this.parent.taskIds.indexOf("R"+p.ganttProperties.taskId.toString()),this.parent.taskIds.indexOf("R"+p.ganttProperties.taskId.toString())):(u=this.parent.taskIds.indexOf("T"+p.ganttProperties.taskId.toString()),this.parent.taskIds.indexOf("T"+p.ganttProperties.taskId.toString())):(u=i.indexOf(p),c=t.indexOf(p),this.parent.editModule&&this.parent.editModule.updateParentRecords&&0<this.parent.editModule.updateParentRecords.length&&(g=this.parent.editModule.updateParentRecords.indexOf(p))),this.parent.treeGrid.parentData.indexOf(p)),m=ne.getValue("dataOperation.dataArray",this.parent),y=m.indexOf(p.taskData);-1!==u&&i.splice(u,1),-1!==c&&t.splice(c,1),-1!==y&&m.splice(y,1),"number"==typeof g&&-1!==g&&this.parent.editModule.updateParentRecords.splice(g,1),ne.isNullOrUndefined(p)||(h.push(p.ganttProperties.taskId.toString()),-1!==c&&(this.parent.ids.splice(c,1),"ResourceView"===this.parent.viewType)&&(this.parent.getTaskIds().splice(c,1),p.hasChildRecords||(p.ganttProperties.resourceInfo=null,delete p.ganttProperties.resourceNames,p[this.parent.taskFields.resourceInfo]=null,p.ganttProperties.sharedTaskUniqueIds=[],delete p.taskData[this.parent.taskFields.resourceInfo])),0===p.level&&-1!==f&&this.parent.treeGrid.parentData.splice(f,1),p.parentItem&&(u=this.parent.getParentTask(p.parentItem))&&(-1!==(y=(m=u.childRecords).indexOf(p))&&m.splice(y,1),m.length||this.parent.setRecordValue("hasChildRecords",!1,u)),this.updateTreeGridUniqueID(p,"delete"))}0<h.length&&this.removeFromDataSource(h),this.updateRowIndex();var D={};if(this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.parentData=[],this.isAdded=!1,this.parent.treeGrid.editModule&&(this.parent.treeGrid.editModule.isOnBatch=!1),this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&this.refreshRecordInImmutableMode(),D.requestType="delete",D.data=e.deletedRecordCollection,D.modifiedRecords=e.updatedRecordCollection,D.modifiedTaskData=Z(e.updatedRecordCollection,null,null,this.parent),ne.setValue("action",e.action,D),this.parent.isOnDelete=!1,"ResourceView"===this.parent.viewType&&(!this.parent.undoRedoModule||this.parent.undoRedoModule&&(!this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.undoRedoModule.isUndoRedoPerformed&&"Delete"===this.parent.undoRedoModule.currentAction.action)))for(var k=D.data.filter(function(e){return!e.hasChildRecords}),b=this,r=0;r<k.length;r++)!function(t){var i=b.parent.flatData.filter(function(e){return e.ganttProperties.taskName===n.parent.localeObj.getConstant("unassignedTask")})[0],e=[],a=(i&&(e=i.childRecords.filter(function(e){return e.ganttProperties.taskId===k[t].ganttProperties.taskId})),b.parent.getParentTask(k[t].parentItem)),a=((!a||a.ganttProperties.taskName===b.parent.localeObj.getConstant("unassignedTask")||0!==e.length)&&(a||e&&0!==e.length)||b.checkWithUnassignedTask(k[t]),i=b.parent.flatData.filter(function(e){return e.ganttProperties.taskName===n.parent.localeObj.getConstant("unassignedTask")})[0],b.parent.currentViewData.filter(function(e){return e.ganttProperties.taskId===k[t].ganttProperties.taskId&&!e.hasChildRecords&&e.parentItem&&i.uniqueID===e.parentItem.uniqueID?e:null}));a[0]&&b.parent.dataOperation.updateParentItems(a[0])}(r);this.parent.trigger("actionComplete",D),this.deletedTaskDetails=[],this.parent.initiateEditAction(!1),this.parent.hideLoadingIndicator(),this.parent.treeGrid.closeEdit()},C.prototype.getNewTaskId=function(){var e="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,t=e.length,i=this.parent.dataOperation.isTaskIDInteger&&0<this.parent.ids.length?Math.max.apply(Math,this.parent.ids.map(function(e){return Number(e)})):t+1;if("ResourceView"===this.parent.viewType){if(!(-1===e.indexOf("T"+i)&&-1===e.indexOf("R"+i)||-1===e.indexOf("T"+(i+=1))&&-1===e.indexOf("R"+i)))for(;-1!==e.indexOf("T"+(i+=1))||-1!==e.indexOf("R"+i););}else if(-1!==e.indexOf(i.toString())&&-1!==e.indexOf((i+=1).toString()))for(;-1!==e.indexOf((i+=1).toString()););return"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?i.toString():i},C.prototype.prepareNewlyAddedData=function(e,t){var i=this.parent.taskFields,a=this.parent.ids;e[i.id]&&(-1!==a.indexOf(e[i.id].toString())?e[i.id]=null:(a="string"==typeof e[i.id]?e[i.id]:parseInt(e[i.id],10),e[i.id]=ne.isNullOrUndefined(a)?null:a)),e[i.id]||(a=this.getNewTaskId(),e[i.id]=a),this.parent.allowUnscheduledTasks||e[i.startDate]||(e[i.startDate]=this.parent.projectStartDate),!this.parent.allowUnscheduledTasks&&i.duration&&ne.isNullOrUndefined(e[i.duration])&&!e[i.endDate]&&(e[i.duration]="5"),i.progress&&(e[i.progress]=e[i.progress]?100<e[i.progress]?100:e[i.progress]:0),this.parent.allowUnscheduledTasks||e[i.endDate]||!i.endDate||e[i.duration]||(a=this.parent.dataOperation.getDateFromFormat(this.parent.projectStartDate),ne.isNullOrUndefined(a))||(a.setDate(a.getDate()+4),e[i.endDate]=this.parent.getFormatedDate(a,this.parent.getDateFormat()))},C.prototype.processPredecessors=function(e,t){if(e.ganttProperties.predecessorsName&&(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.predecessorModule.ensurePredecessorCollectionHelper(e,e.ganttProperties),this.parent.predecessorModule.updatePredecessorHelper(e),this.parent.predecessorModule.validatePredecessorDates(e)),e.childRecords&&0<e.childRecords.length&&t)for(var i=0;i<e.childRecords.length;i++)this.processPredecessors(e.childRecords[i],t)},C.prototype.updateNewlyAddedDataBeforeAjax=function(e,t,i,a,n){var r=this.parent.dataOperation.createRecord(e,t);switch(i){case"Above":r.index=n;break;case"Below":case"Child":r.index=n+1;break;case"Bottom":r.index=(this.parent.enableVirtualization?this.parent.flatData:this.parent.currentViewData).length;break;case"Top":r.index=0}if(ne.isNullOrUndefined(a)||(this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(a),r),p=r.parentItem?r.parentItem.index:null,this.parent.setRecordValue("parentIndex",p,r),u=r.parentItem?r.parentItem.uniqueID:null,this.parent.setRecordValue("parentUniqueID",u,r),ne.isNullOrUndefined(this.parent.taskFields.id))||ne.isNullOrUndefined(this.parent.taskFields.parentID)||!r.parentItem||("ProjectView"===this.parent.viewType&&this.parent.setRecordValue(this.parent.taskFields.parentID,r.parentItem.taskId,r.taskData,!0),this.parent.setRecordValue("parentId",r.parentItem.taskId,r.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.parentID,r.parentItem.taskId,r,!0)),this.parent.isOnEdit=!0,this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)if(e.hasChildRecords){for(var s=[],o=this.parent.undoRedoModule.currentAction.deletedRecordsDetails,l=0;l<e.childRecords.length;l++)this.add(e.childRecords[l],s);for(var d=0;d<o.length;d++)if(e.ganttProperties.taskId===o[d].data.ganttProperties.taskId){"child"===o[d].position?i="Child":"below"===o[d].position?i="Below":"above"===o[d].position&&(i="Above"),this.backUpAndPushNewlyAddedRecord(r,i,a);for(l=0;l<s.length;l++)"ProjectView"===this.parent.viewType?s[l].parentItem.taskId===r.ganttProperties.taskId&&(s[l].parentItem.index=r.index,s[l].parentItem.taskId=r.ganttProperties.taskId,s[l].parentItem.uniqueID=r.ganttProperties.uniqueID,s[l].parentUniqueID=r.ganttProperties.uniqueID):(s[l].parentItem.index=r.index,s[l].parentItem.taskId=r.ganttProperties.rowUniqueID,s[l].parentItem.uniqueID=r.ganttProperties.uniqueID,s[l].parentUniqueID=r.ganttProperties.uniqueID);break}(this.addRowSelectedItem=r).taskData[this.parent.taskFields.child]=[];for(var h=0;h<s.length;h++){this.parent.isOnEdit=!1;var p,u,c=this.parent.dataOperation.createRecord(s[h],s[h].level);0===c.childRecords.length&&c.taskData[this.parent.taskFields.child]&&(c.taskData[this.parent.taskFields.child]=[]),a=this.parent.getRecordByID(s[h].parentItem.taskId),ne.isNullOrUndefined(a)||(this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(a),c),p=c.parentItem?c.parentItem.index:null,this.parent.setRecordValue("parentIndex",p,c),u=c.parentItem?c.parentItem.uniqueID:null,this.parent.setRecordValue("parentUniqueID",u,c),ne.isNullOrUndefined(this.parent.taskFields.id))||ne.isNullOrUndefined(this.parent.taskFields.parentID)||!c.parentItem||("ProjectView"===this.parent.viewType&&this.parent.setRecordValue(this.parent.taskFields.parentID,c.parentItem.taskId,c.taskData,!0),this.parent.setRecordValue("parentId",c.parentItem.taskId,c.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.parentID,c.parentItem.taskId,c,!0)),this.parent.isOnEdit=!0,c.parentItem&&(i=0===a.childRecords.length?"Child":"Below"),0<this.parent.getParentTask(c.parentItem).childRecords.length&&(this.addRowSelectedItem=this.parent.getParentTask(c.parentItem).childRecords[this.parent.getParentTask(c.parentItem).childRecords.length-1]),this.backUpAndPushNewlyAddedRecord(c,i,a);for(l=0;l<s.length;l++)"ProjectView"===this.parent.viewType?s[l].parentItem.taskId===c.ganttProperties.taskId&&(s[l].parentItem.index=c.index,s[l].parentItem.taskId=c.ganttProperties.taskId,s[l].parentItem.uniqueID=c.ganttProperties.uniqueID,s[l].parentUniqueID=c.ganttProperties.uniqueID):(s[l].parentItem.index=r.index,s[l].parentItem.taskId=r.ganttProperties.rowUniqueID,s[l].parentItem.uniqueID=r.ganttProperties.uniqueID,s[l].parentUniqueID=r.ganttProperties.uniqueID)}}else this.backUpAndPushNewlyAddedRecord(r,i,a);else this.backUpAndPushNewlyAddedRecord(r,i,a);if(this.parent.taskFields.dependency){var g=!(!this.parent.undoRedoModule||!this.parent.undoRedoModule.isUndoRedoPerformed);if(r.ganttProperties.predecessorsName)this.processPredecessors(r,g);else if(!r.ganttProperties.predecessorsName&&0<r.childRecords.length&&g)for(l=0;l<r.childRecords.length;l++)this.processPredecessors(r.childRecords[l],g)}return r.parentItem&&this.parent.getParentTask(r.parentItem).ganttProperties.isAutoSchedule&&this.parent.dataOperation.updateParentItems(r.parentItem),this.parent.isOnEdit=!1,r},C.prototype.getChildCount=function(e,t){var i;if(!e.hasChildRecords)return 0;for(var a=0;a<e.childRecords.length;a++)t++,(i=e.childRecords[a]).hasChildRecords&&(t=this.getChildCount(i,t));return t},C.prototype.getVisibleChildRecordCount=function(e,t,i){if(e.hasChildRecords)for(var a,n=(a=e.childRecords).length,r=0;r<n;r++)-1!==i.indexOf(a[r])&&t++,a[r].hasChildRecords&&(t=this.getVisibleChildRecordCount(a[r],t,i));else-1!==i.indexOf(e)&&t++;return t},C.prototype.updatePredecessorOnIndentOutdent=function(e){for(var t=e.ganttProperties.predecessor.length,i=e.ganttProperties,a=i.predecessor,n=0;n<t;n++){var r,s,o,l=this.parent.getRecordByID(a[n].from),d=this.parent.getRecordByID(a[n].to);(o=this.parent.predecessorModule.validateParentPredecessor(l,d))&&this.parent.allowParentDependency||(a[n].to===i.rowUniqueID.toString()?(r=this.parent.getRecordByID(a[n].from),s=K(a[n],"from",r.ganttProperties.predecessor,"to"),(l=ne.extend([],r.ganttProperties.predecessor,[],!0)).splice(s,1),this.parent.setRecordValue("predecessor",l,r.ganttProperties,!0)):a[n].from===i.rowUniqueID.toString()&&(d=(r=this.parent.getRecordByID(a[n].to)).ganttProperties.predecessorsName.toString().split(","),l=a[n].from+a[n].type,l=d.indexOf(l),d.splice(l,1),this.parent.setRecordValue("predecessorsName",d.join(","),r.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.dependency,d.join(","),r),s=K(a[n],"from",r.ganttProperties.predecessor,"to"),(l=ne.extend([],r.ganttProperties.predecessor,[],!0)).splice(s,1),this.parent.setRecordValue("predecessor",l,r.ganttProperties,!0),this.parent.predecessorModule.validatePredecessorDates(r)))}o&&this.parent.allowParentDependency||(this.parent.setRecordValue("predecessor",[],e.ganttProperties,!0),this.parent.setRecordValue("predecessorsName","",e.ganttProperties,!0))},C.prototype.backUpAndPushNewlyAddedRecord=function(e,t,i){var a,n=this.parent.flatData,r=this.parent.currentViewData,s=this.parent.ids;switch(t){case"Top":n.splice(0,0,e),r.splice(0,0,e),s.splice(0,0,e.ganttProperties.rowUniqueID.toString());break;case"Bottom":n.push(e),r.push(e),s.push(e.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType&&(a=0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId,this.parent.getTaskIds().push(a));break;case"Above":o=n.indexOf(this.addRowSelectedItem),l=r.indexOf(this.addRowSelectedItem),this.recordCollectionUpdate(void 0,o,l,e,i,t);break;case"Below":var o,l,d=n.indexOf(this.addRowSelectedItem);l=this.addRowSelectedItem.hasChildRecords?(o=d+this.getChildCount(this.addRowSelectedItem,0)+1,r.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,r)+1):(o=d+1,r.indexOf(this.addRowSelectedItem)+1),this.recordCollectionUpdate(NaN,o,l,e,i,t);break;case"Child":d=n.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords?(o=d+this.getChildCount(this.addRowSelectedItem,0)+1,this.addRowSelectedItem.expanded||this.parent.enableMultiTaskbar||this.parent.expandByID(this.addRowSelectedItem.ganttProperties.rowUniqueID),l=r.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,r)+1):(this.parent.setRecordValue("hasChildRecords",!0,this.addRowSelectedItem),this.parent.setRecordValue("isMilestone",!1,this.addRowSelectedItem.ganttProperties,!0),this.parent.setRecordValue("expanded",!0,this.addRowSelectedItem),this.parent.setRecordValue("childRecords",[],this.addRowSelectedItem),o=d+1,l=r.indexOf(this.addRowSelectedItem)+1,this.addRowSelectedItem.ganttProperties.predecessor&&this.updatePredecessorOnIndentOutdent(this.addRowSelectedItem),ne.isNullOrUndefined(this.addRowSelectedItem.ganttProperties.segments)||(this.addRowSelectedItem.ganttProperties.segments=null)),this.recordCollectionUpdate(NaN,o,l,e,i,t)}this.newlyAddedRecordBackup=e},C.prototype.recordCollectionUpdate=function(e,t,i,a,n,r){var s=this.parent.flatData,o=this.parent.currentViewData,l=this.parent.ids;s.splice(t,0,a),o.splice(i,0,a),l.splice(t,0,a.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType&&(s=0===a.level?"R"+a.ganttProperties.taskId:"T"+a.ganttProperties.taskId,this.parent.getTaskIds().splice(t,0,s)),!ne.isNullOrUndefined(n)&&(e="Above"===r?n.childRecords.indexOf(this.addRowSelectedItem):"Below"===r?n.childRecords.indexOf(this.addRowSelectedItem)+1:n.childRecords.length,n.childRecords.splice(e,0,a),this.parent.taskFields.child||(this.parent.taskFields.child="Children"),this.parent.dataSource instanceof D.DataManager&&ne.isNullOrUndefined(n.taskData[this.parent.taskFields.parentID])||!ne.isNullOrUndefined(this.parent.dataSource))&&(o=this.parent.taskFields.child,n.taskData[o]&&0<n.taskData[o].length?"Above"===r||"Below"===r?n.taskData[o].splice(e,0,a.taskData):n.taskData[o].push(a.taskData):(n.taskData[o]=[],n.taskData[o].push(a.taskData)),this.isNewRecordAdded=!0)},C.prototype.constructTaskAddedEventArgs=function(e,t,i){var a={};if(a.action=a.requestType=i,1<e.length){a.data=[],a.newTaskData=[],a.recordIndex=[];for(var n=0;n<e.length;n++)a.data[n]=e[n],a.newTaskData[n]=Z([e[n]],a.data[n],a,this.parent),a.recordIndex[n]=e[n].index}else if(1===e.length)for(n=0;n<e.length;n++)a.data=e[n],a.newTaskData=Z([e[n]],a.data,a,this.parent),a.recordIndex=e[n].index;return a.modifiedRecords=t,a.modifiedTaskData=Z(t,null,null,this.parent),a},C.prototype.addSuccess=function(e){this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.parentData=[],this.parent.addDeleteRecord=!0,this.parent.treeGrid.isAddedFromGantt=!0,this.isAdded=!0,this.parent.treeGrid.editModule&&(this.parent.treeGrid.editModule.isOnBatch=!1),this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&(this.parent.modifiedRecords=e.modifiedRecords,this.parent.modifiedRecords.push(e.data),this.refreshRecordInImmutableMode()),this.parent.treeGrid.closeEdit()},C.prototype.refreshRecordInImmutableMode=function(e,t){if(!t&&!ne.isNullOrUndefined(e))for(var i=e[0].index+1;i<this.parent.currentViewData.length&&e[0].level<this.parent.currentViewData[i].level;i++)this.parent.modifiedRecords.push(this.parent.currentViewData[i]);for(var r=this,i=0;i<this.parent.modifiedRecords.length;i++)!function(e){var t,i=r.parent.modifiedRecords[e],e=r.parent.rowDragAndDropModule&&r.parent.allowRowDragAndDrop?1:0,a=r.parent.taskFields.id,n=r.parent.currentViewData.findIndex(function(e){return e[a]===i[a]});r.parent.treeGrid.getRows()[n]&&(t=r.parent.treeGrid.grid.getRowObjectFromUID(r.parent.treeGrid.grid.getDataRows()[n].getAttribute("data-uid")),r.parent.treeGrid.renderModule.cellRender({data:t.data,cell:r.parent.treeGrid.getRows()[n].cells[r.parent.treeColumnIndex+e],column:r.parent.treeGrid.grid.getColumns()[r.parent.treeColumnIndex],requestType:"rowDragAndDrop"}),r.parent.treeGrid.renderModule.RowModifier({data:i,row:r.parent.treeGrid.getRows()[n],rowHeight:r.parent.rowHeight}))}(i)},C.prototype.updateRealDataSource=function(e,t){var i=this.parent.taskFields,a=H(this.parent)?ne.getValue("result",this.parent.dataSource):this.parent.dataSource;this.parent.dataSource instanceof D.DataManager&&(a=this.parent.dataSource.dataSource.json);for(var n=0;n<e.length;n++)"Top"===(t=ne.isNullOrUndefined(t)||ne.isNullOrUndefined(this.addRowSelectedItem)?"Bottom"===t?"Bottom":"Top":t)?a.splice(0,0,e[n].taskData):"Bottom"!==t&&(ne.isNullOrUndefined(i.id)||ne.isNullOrUndefined(i.parentID)||"Child"!==t)?(this.isNewRecordAdded||this.addDataInRealDataSource(a,e[n].taskData,t),this.isNewRecordAdded=!1):a.push(e[n].taskData),this.isBreakLoop=!1},C.prototype.addDataInRealDataSource=function(e,t,i){for(var a=0;a<e.length;a++){var n=this.parent.taskFields.child;if(this.isBreakLoop)break;if(ne.getValue(this.parent.taskFields.id,e[a]).toString()===this.addRowSelectedItem.ganttProperties.rowUniqueID.toString()){var r=void 0;if(this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.droppedRecord&&"ResourceView"===this.parent.viewType)for(var s=0;s<e.length;s++)if(e[s][this.parent.taskFields.id]===this.parent.rowDragAndDropModule.droppedRecord.ganttProperties.taskId){r=s;break}"Above"===i?r?e.splice(r,0,t):e.splice(a,0,t):"Below"===i?r?e.splice(r+1,0,t):e.splice(a+1,0,t):"Child"===i&&(e[a][n]&&0<e[a][n].length||(e[a][n]=[]),e[a][n].push(t)),this.isBreakLoop=!0;break}e[a][n]&&(n=e[a][n],this.addDataInRealDataSource(n,t,i))}},C.prototype.updateClientDataFromServer=function(e,t){for(var i=e.addedRecords[0],a=Object.keys(i).length,n=0,r=Object.keys(i);n<a;n++){var s=r[parseInt(n.toString(),10)];t.data[""+s]=i[""+s]}null!==this.parent.taskFields.id&&(t.data.ganttProperties.taskId=i[this.parent.taskFields.id]),null!==this.parent.taskFields.name&&(t.data.ganttProperties.taskName=i[this.parent.taskFields.name]),null!==this.parent.taskFields.startDate&&(t.data.ganttProperties.startDate=i[this.parent.taskFields.startDate]),null!==this.parent.taskFields.endDate&&(t.data.ganttProperties.endDate=i[this.parent.taskFields.endDate]),null!==this.parent.taskFields.duration&&(t.data.ganttProperties.duration=parseFloat(i[this.parent.taskFields.duration])),null!==this.parent.taskFields.durationUnit&&(t.data.ganttProperties.durationUnit=i[this.parent.taskFields.durationUnit]),null!==this.parent.taskFields.progress&&(t.data.ganttProperties.progress=i[this.parent.taskFields.progress]),null!==this.parent.taskFields.dependency&&(t.data.ganttProperties.dependency=i[this.parent.taskFields.dependency]),null!==this.parent.taskFields.parentID&&(t.data.ganttProperties.parentID=i[this.parent.taskFields.parentID]),null!==this.parent.taskFields.baselineEndDate&&(t.data.ganttProperties.baselineEndDate=i[this.parent.taskFields.baselineEndDate]),null!==this.parent.taskFields.baselineStartDate&&(t.data.ganttProperties.baselineStartDate=i[this.parent.taskFields.baselineStartDate]),null!==this.parent.taskFields.resourceInfo&&(t.data.ganttProperties.resources=i[this.parent.taskFields.resourceInfo])},C.prototype.addNewUndoCollection=function(e,t){if(this.parent.undoRedoModule&&(!this.parent.undoRedoModule.isUndoRedoPerformed||this.parent.undoRedoModule.isUndoRedoPerformed&&"Add"===this.parent.undoRedoModule.currentAction.action&&"ResourceView"===this.parent.viewType)&&this.parent.isUndoRedoItemPresent("Add")){e.action="Add";for(var i=0<t.data.length?ne.extend([],[],t.data,!0):[t.data],a=[],n=this,r=0;r<i.length;r++)!function(t){a=n.parent.flatData.filter(function(e){return i[t].index===e.index&&i[t].ganttProperties.taskId===e.ganttProperties.taskId})}(r);e.addedRecords=ne.extend([],[],a,!0),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=e}},C.prototype.addRecord=function(e,c,t){var g=this,f=this.parent.taskFields.id;if(this.parent.editModule&&this.parent.editSettings.allowAdding){this.parent.isDynamicData=!0,this.parent.treeGrid.isAddedFromGantt=!0,this.parent.isOnAdded=!0;var m=[];if(ne.isNullOrUndefined(e))this.validateTaskPosition(e,c,t,m);else if(e instanceof Array)if(this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed){var i=e,a=t;"ResourceView"===this.parent.viewType&&("below"===e[0].position?c="Below":"above"===e[0].position?c="Above":"child"===e[0].position&&(c="Child"),a=this.parent.taskIds.indexOf(e[0].id.toString()),i=e[0].data),this.validateTaskPosition(i,c,a,m)}else for(var n=0;n<e.length;n++)this.validateTaskPosition(e[n],c,t,m);else{if("object"!=typeof e)return;this.validateTaskPosition(e,c,t,m)}i={},i=this.constructTaskAddedEventArgs(m,this.parent.editedRecords,"beforeAdd");ne.isNullOrUndefined(c)||(i.rowPosition=c),this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent("Add")&&(this.parent.undoRedoModule.redoEnabled&&this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection()),this.parent.trigger("actionBegin",i,function(a){g.parent.previousRecords={};var e=g.parent.taskFields,e="ResourceView"===g.parent.viewType?0<a.data.childRecords.length?g.parent.flatData[g.parent.getTaskIds().indexOf("R"+a.data[e.id])]:g.parent.flatData[g.parent.getTaskIds().indexOf("T"+a.data[e.id])]:g.parent.getRecordByID(a.data[e.id]);if(ne.isNullOrUndefined(e)||(g.validateUpdateValues(a.newTaskData,e,!0),g.parent.dateValidationModule.calculateEndDate(e),g.parent.dataOperation.updateWidthLeft(e),g.parent.dataOperation.updateParentItems(e)),!ne.isNullOrUndefined(a.data[""+f])&&a.data[f]!==a.data.ganttProperties.taskId){for(var t=0,i=Object.keys(g.parent.ids);t<i.length;t++){var n=i[t];if(g.parent.ids[n]===a.data.ganttProperties.taskId.toString()){g.parent.ids[n]=a.data[f].toString();break}}a.data.ganttProperties.taskId=a.data[f],a.newTaskData[f]=a.data[f],a.data.ganttProperties.rowUniqueID=a.data[f].toString()}if(a.cancel)g.removeAddedRecord(),g.reUpdatePreviousRecords(),g._resetProperties();else{g.parent.showLoadingIndicator();if(_(g.parent.dataSource)){var r,s=g.parent.dataSource,o={addedRecords:[a.newTaskData],changedRecords:a.modifiedTaskData},l=g.parent.query instanceof D.Query?g.parent.query:new D.Query,d=s.adaptor;!(d instanceof D.WebApiAdaptor||d instanceof D.ODataAdaptor||d instanceof D.ODataV4Adaptor)||s.dataSource.batchUrl?(r=a.data.ganttProperties.taskId,s.saveChanges(o,g.parent.taskFields.id,null,l).then(function(t){t.addedRecords[0][g.parent.taskFields.id].toString()!==a.data.ganttProperties.taskId&&(e=g.parent.ids.indexOf(r),a.data.ganttProperties.taskId=t.addedRecords[0][g.parent.taskFields.id].toString(),a.newTaskData[f]=t.addedRecords[0][g.parent.taskFields.id].toString(),a.data.ganttProperties.rowUniqueID=t.addedRecords[0][g.parent.taskFields.id].toString(),g.parent.ids.some(function(e){return e===t.addedRecords[0][g.parent.taskFields.id].toString()})?(i="The provided ID value "+t.addedRecords[0][g.parent.taskFields.id]+" already exists. Please provide a unique ID value.",g.parent.trigger("actionFailure",{error:i})):-1!==e?g.parent.ids.splice(e,1,t.addedRecords[0][g.parent.taskFields.id].toString()):g.parent.ids.push(t.addedRecords[0][g.parent.taskFields.id].toString()));var e,i=a.data.ganttProperties.taskId.toString();g.parent.taskFields.id&&!ne.isNullOrUndefined(t.addedRecords[0][g.parent.taskFields.id])&&t.addedRecords[0][g.parent.taskFields.id].toString()===i&&(g.parent.setRecordValue("taskId",t.addedRecords[0][g.parent.taskFields.id],a.data.ganttProperties,!0),g.parent.setRecordValue("taskData",t.addedRecords[0],a.data),g.parent.setRecordValue(g.parent.taskFields.id,t.addedRecords[0][g.parent.taskFields.id],a.data),g.parent.setRecordValue("rowUniqueID",t.addedRecords[0][g.parent.taskFields.id].toString(),a.data.ganttProperties,!0),g.updateClientDataFromServer(t,a),-1!==(e=g.parent.ids.indexOf(i)))&&(g.parent.ids[e]=t.addedRecords[0][g.parent.taskFields.id].toString()),g.updateNewRecord(m,a)}).catch(function(e){g.removeAddedRecord(),g.dmFailure(e,a),g._resetProperties()})):s.insert(o.addedRecords,null,l).then(function(e){var t=(ne.isNullOrUndefined(e[0])?o.addedRecords:e)[0];m.forEach(function(e){ne.isNullOrUndefined(e)||(g.updateEditedRecordFields(t,e),g.parent.dataOperation.updateTaskData(e))}),g.updateNewRecord(m,a)}).catch(function(e){g.removeAddedRecord(),g.dmFailure(e,a),g._resetProperties()})}else{if("ProjectView"===g.parent.viewType?("Top"===c||"Bottom"===c||"Above"===c||"Below"===c||"Child"===c||ne.isNullOrUndefined(c)&&!a.data.parentItem)&&(a.data instanceof Array?g.updateRealDataSource(a.data,c):((d=[]).push(a.data),g.updateRealDataSource(d,c),g.parent.currentSelection=m[0])):(H(g.parent)?ne.getValue("result",g.parent.dataSource):g.parent.dataSource).push(a.data.taskData),0===m.level&&g.parent.treeGrid.parentData.splice(0,0,m),g.updateTreeGridUniqueID(m,"add"),"ResourceView"===g.parent.viewType&&g.parent.undoRedoModule&&g.parent.undoRedoModule.currentAction){s=!1;if((a.data.hasChildRecords||a.data.parentItem&&g.parent.getTaskByUniqueID(a.data.parentItem.uniqueID).ganttProperties.taskName!==g.parent.localeObj.getConstant("unassignedTask"))&&(s=!0),-1!==g.parent.taskIds.indexOf("R0")&&g.parent.undoRedoModule&&g.parent.undoRedoModule.isUndoRedoPerformed&&"Delete"===g.parent.undoRedoModule.currentAction.action&&s){for(var h=g.parent.flatData[g.parent.taskIds.indexOf("R0")],p=h.childRecords.filter(function(e){return e.ganttProperties.taskId===a.data.ganttProperties.taskId}),u=(a.data.hasChildRecords&&(p=a.data.childRecords),0);u<p.length;u++)!function(e){var a,t;1===h.childRecords.length?(g.parent.flatData.splice(g.parent.taskIds.indexOf("R0"),2),g.parent.ids.splice(g.parent.taskIds.indexOf("R0"),2),g.parent.taskIds.splice(g.parent.taskIds.indexOf("R0"),2)):(t=g.parent.taskIds.indexOf("T"+p[e].ganttProperties.taskId),a="T"+p[e].ganttProperties.taskId,t=(e=g.parent.taskIds.reduce(function(e,t,i){return t===a&&e.push(i),e},[]))[e.length-1],g.parent.taskIds.splice(t,1),g.parent.flatData.splice(t,1),g.parent.ids.splice(t,1))}(u);h&&"ResourceView"===g.parent.viewType&&!g.parent.flatData[g.parent.taskIds.indexOf("R0")+1]&&(g.parent.flatData.splice(g.parent.taskIds.indexOf("R0"),1),g.parent.ids.splice(g.parent.taskIds.indexOf("R0"),1),g.parent.taskIds.splice(g.parent.taskIds.indexOf("R0"),1))}}g.refreshNewlyAddedRecord(a,m),"ResourceView"===g.parent.viewType&&g.parent.taskFields.work&&e&&g.parent.dataOperation.updateParentItems(e,!0),g.addNewUndoCollection({},a),g._resetProperties()}g.parent.isOnAdded=!1}})}},C.prototype.createNewRecord=function(){for(var e={},t=this.parent.ganttColumns,i=this.parent.taskFields,a=this.parent.editModule.getNewTaskId(),n=0;n<t.length;n++){var r=t[n].field;r===i.id?e[r]=a:t[n].field===i.startDate?(ne.isNullOrUndefined(e[i.endDate])?e[r]=this.parent.editModule.dialogModule.getMinimumStartDate():e[r]=new Date(e[i.endDate]),this.parent.timezone&&(e[r]=this.parent.dateValidationModule.remove(e[r],this.parent.timezone))):t[n].field===i.endDate?(ne.isNullOrUndefined(e[i.startDate])?e[r]=this.parent.editModule.dialogModule.getMinimumStartDate():e[r]=new Date(e[i.startDate]),this.parent.timezone&&(e[r]=this.parent.dateValidationModule.remove(e[r],this.parent.timezone))):t[n].field===i.duration?e[r]=1:t[n].field===i.name?e[r]=this.parent.editModule.dialogModule.localeObj.getConstant("addDialogTitle")+" "+a:t[n].field===i.progress||t[n].field===i.work?e[r]=0:t[n].field===i.type||"taskType"===t[n].field?e[r]=this.parent.taskType:t[n].field===i.milestone?e[r]=null:e[this.parent.ganttColumns[n].field]=""}return e},C.prototype.validateTaskPosition=function(e,t,i,a){var n,r=ne.isNullOrUndefined(i)||isNaN(parseInt(i.toString(),10))?this.parent.selectionModule?"Row"!==this.parent.selectionSettings.mode&&"Both"!==this.parent.selectionSettings.mode||1!==this.parent.selectionModule.selectedRowIndexes.length?"Cell"===this.parent.selectionSettings.mode&&1===this.parent.selectionModule.getSelectedRowCellIndexes().length?this.parent.selectionModule.getSelectedRowCellIndexes()[0].rowIndex:null:this.parent.selectionModule.selectedRowIndexes[0]:null:i,s=(this.addRowSelectedItem=ne.isNullOrUndefined(r)?null:this.parent.updatedRecords[r],t=ne.isNullOrUndefined(t)?this.parent.editSettings.newRowPosition:t,e=ne.isNullOrUndefined(e)?this.createNewRecord():e,0);switch(t=(ne.isNullOrUndefined(r)||r<0||ne.isNullOrUndefined(this.addRowSelectedItem))&&("Above"===t||"Below"===t||"Child"===t)||!t||"Above"!==t&&"Below"!==t&&"Child"!==t&&"Top"!==t&&"Bottom"!==t?"Top":t){case"Top":case"Bottom":s="ResourceView"===this.parent.viewType?1:0;break;case"Above":case"Below":s=this.addRowSelectedItem.level,n=this.parent.getParentTask(this.addRowSelectedItem.parentItem);break;case"Child":s=this.addRowSelectedItem.level+1,n=this.addRowSelectedItem}this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed||this.prepareNewlyAddedData(e,t);r=this.updateNewlyAddedDataBeforeAjax(e,s,t,n,i);a.push(r)},C.prototype.updateRowIndex=function(){for(var e=this.parent.currentViewData,t=e.length,i=0;i<t;i++){var a=i;e[i].index=a,e[i].parentItem&&e[i].parentItem.taskId&&(a=this.parent.getRecordByID(e[i].parentItem.taskId),ne.isNullOrUndefined(a)||ne.isNullOrUndefined(a.index)||ne.isNullOrUndefined(a.level)||(e[i].parentItem.index=a.index,e[i].parentItem.level=a.level))}},C.prototype.updateNewRecord=function(e,t){var i=this;e.forEach(function(e){0===e.level&&(i.parent.treeGrid.parentData.splice(0,0,e),ne.getValue("dataOperation.dataArray",i.parent).splice(0,0,e.taskData)),i.updateTreeGridUniqueID(e,"add")}),this.updateTreeGridUniqueID(e,"add"),this.refreshNewlyAddedRecord(t,e);this.addNewUndoCollection({},t),this._resetProperties()},C.prototype._resetProperties=function(){this.parent.isOnEdit=!1,this.parent.hideSpinner(),this.addRowSelectedItem=null,this.newlyAddedRecordBackup=null,this.isBreakLoop=!1,this.parent.element.tabIndex=0,this.parent.initiateEditAction(!1)},C.prototype.updateTreeGridUniqueID=function(e,t){"add"===t?ne.setValue("uniqueIDCollection."+e.uniqueID,e,this.parent.treeGrid):"delete"===t&&ne.deleteObject(ne.getValue("uniqueIDCollection",this.parent.treeGrid),e.uniqueID)},C.prototype.refreshNewlyAddedRecord=function(e,t){var i=this;if(this.parent.selectionModule&&this.parent.allowSelection&&("Row"===this.parent.selectionSettings.mode||"Both"===this.parent.selectionSettings.mode)&&(this.parent.staticSelectedRowIndex=this.parent.currentViewData.indexOf(e.data)),this.parent.timelineSettings.updateTimescaleView&&(s=[],0<e.modifiedRecords.length?(s=0<e.data.length?ne.extend([],[],e.data,!0):[e.data]).push.apply(s,e.modifiedRecords):s=0<e.data.length?ne.extend([],[],e.data,!0):[e.data],this.parent.timelineModule.updateTimeLineOnEditing([s],e.action)),this.addSuccess(e),e=this.constructTaskAddedEventArgs(t,e.modifiedRecords,"add"),this.updateRowIndex(),this.parent.trigger("actionComplete",e),this.parent.hideLoadingIndicator(),this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose(),"ResourceView"===this.parent.viewType)if(1<t.length)for(var a,n=0;n<t.length;n++){e.data[n].ganttProperties.sharedTaskUniqueIds.push(e.data[n].ganttProperties.rowUniqueID),e.data[n].ganttProperties.resourceInfo?((a=ne.extend([],[],e.data[n].ganttProperties.resourceInfo,!0)).splice(0,1),this.updateResoures([],a,e.data[n])):this.parent.undoRedoModule&&(!this.parent.undoRedoModule||e.data[n].hasChildRecords||!this.parent.undoRedoModule.isUndoRedoPerformed)&&this.parent.undoRedoModule.isUndoRedoPerformed||(this.removeChildRecord(e.data[n]),this.parent.editModule.checkWithUnassignedTask(e.data[n]));for(var r=0;r<this.updateParentRecords.length;r++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[r]);this.updateParentRecords=[]}else{e.data.ganttProperties.sharedTaskUniqueIds.push(e.data.ganttProperties.rowUniqueID);var s=e.data,o=s.ganttProperties,l=s.childRecords,d=this.parent.undoRedoModule,h=function(e,t){e&&1<e.length&&((e=ne.extend([],[],e,!0)).splice(0,1),d&&d.isUndoRedoPerformed&&(i.parent.editModule.addRowIndex=void 0),i.updateResoures([],e,t))};o.resourceInfo&&o.resourceInfo.length?h(o.resourceInfo,s):0<l.length&&l[0].ganttProperties.resourceInfo&&l[0].ganttProperties.resourceInfo.length?h(l[0].ganttProperties.resourceInfo,e.data.childRecords[0]):this.parent.undoRedoModule&&(!this.parent.undoRedoModule||e.data.hasChildRecords||!this.parent.undoRedoModule.isUndoRedoPerformed)&&this.parent.undoRedoModule.isUndoRedoPerformed||(this.removeChildRecord(e.data),this.parent.editModule.checkWithUnassignedTask(e.data));for(r=0;r<this.updateParentRecords.length;r++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[r]);this.updateParentRecords=[]}},C.prototype.removeAddedRecord=function(){var e,t,i=this.parent.flatData,a=this.parent.currentViewData,n=this.parent.ids,r=i.indexOf(this.newlyAddedRecordBackup),s=a.indexOf(this.newlyAddedRecordBackup),o=n.indexOf(this.newlyAddedRecordBackup.ganttProperties.rowUniqueID.toString());ne.deleteObject(this.parent.previousRecords,i[r].uniqueID),this.newlyAddedRecordBackup.parentItem&&(t=(e=this.parent.getParentTask(this.newlyAddedRecordBackup.parentItem)).childRecords.indexOf(this.newlyAddedRecordBackup),e.childRecords.splice(t,1),0===e.childRecords.length)&&e.hasChildRecords&&(e.hasChildRecords=!1),i.splice(r,1),a.splice(s,1),n.splice(o,1)},C.prototype.getPrevRecordIndex=function(){var e=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],t=this.parent.selectionModule.getSelectedRecords()[0],e=this.parent.getRootParent(e,t.level);return this.parent.updatedRecords.indexOf(e)},C.prototype.indent=function(){var e=this.parent.selectedRowIndex,t=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),i=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],a=this.parent.selectionModule.getSelectedRecords()[0];this.parent.editSettings.allowEditing&&0!==e&&-1!==e&&t&&"ResourceView"!==this.parent.viewType&&(ne.isNullOrUndefined(this.parent.updatedRecords[e])||this.parent.updatedRecords[e].level-i.level!=1)&&(t=i.level-a.level==0?this.parent.selectionModule.getSelectedRowIndexes()[0]-1:this.getPrevRecordIndex(),this.indentOutdentRow([this.parent.selectionModule.getSelectedRowIndexes()[0]],t,"child"))},C.prototype.outdent=function(){var e=this.parent.selectionModule.getSelectedRowIndexes()[0],t=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length);this.parent.editSettings.allowEditing&&-1!==e&&0!==e&&t&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[e].level&&(t=this.parent.getTaskByUniqueID(this.parent.selectionModule.getSelectedRecords()[0].parentItem.uniqueID),t=this.parent.updatedRecords.indexOf(t),this.indentOutdentRow([e],t,"below"))},C.prototype.indentOutdentRow=function(e,t,i){var a=this;e[0],"above"===i&&(this.dropPosition="topSegment"),"below"===i&&(this.dropPosition="bottomSegment"),"child"===i&&(this.dropPosition="middleSegment");for(var i=void 0,n=[],r=0;r<e.length;r++)this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.undoRedoModule.currentAction?this.parent.undoRedoModule.currentAction.modifiedRecord?n[r]=this.parent.undoRedoModule.currentAction.modifiedRecord[r].data:n[r]=this.parent.undoRedoModule.currentAction.data[r]:n[r]=this.parent.updatedRecords[e[r]];var s={data:n,dropIndex:t,dropPosition:this.dropPosition};"middleSegment"===this.dropPosition?i="indenting":"bottomSegment"===this.dropPosition&&(i="outdenting"),this.parent.trigger("actionBegin",{action:i,data:n[0],cancel:!1},function(e){e.cancel?a.parent.hideLoadingIndicator():(a.parent.showLoadingIndicator(),a.reArrangeRows(s,!0))})},C.prototype.reArrangeRows=function(e,t){var i=this;if(this.dropPosition=e.dropPosition,this.parent.oldRecords=[],this.parent.oldRecords=ne.extend([],[],e.data,!0),"Invalid"!==e.dropPosition&&this.parent.editModule){for(var a,n,r,s,o,l=this.parent,l=(this.droppedRecord=l.updatedRecords[e.dropIndex],"middleSegment"===e.dropPosition?"Indent":"Outdent"),d=(this.parent.undoRedoModule&&!this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.isUndoRedoItemPresent(l)&&((n={}).action=l,n.modifiedRecord=[],n.selectedRowIndexes=ne.extend([],[],this.parent.selectionModule.selectedRowIndexes,!0),this.parent.undoRedoModule.findPosition(ne.extend([],[],[e.data],!0)[0],n,"modifiedRecord"),n.droppedRecord=ne.extend([],[],this.droppedRecord,!0),this.parent.undoRedoModule.redoEnabled&&(this.parent.undoRedoModule.redoEnabled=!1,this.parent.undoRedoModule.getUndoCollection=[],this.parent.undoRedoModule.getRedoCollection=[],this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!1),this.parent.undoRedoModule.getUndoCollection[0]=[]),this.parent.undoRedoModule.createUndoCollection(),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=n),[]),h=this.droppedRecord,p=(e.data[0]?d=e.data:d.push(e.data),0),u=d.length,c=0;c<u;c++)this.parent.isOnEdit=!0,a=d[c],this.draggedRecord=a,"Invalid"!==this.dropPosition&&(t&&this.deleteDragRow(),o=this.treeGridData.indexOf(h),this.parent.editModule.updateResourceRelatedFields(h,""),"bottomSegment"===this.dropPosition&&-1!==o&&(h.hasChildRecords?(p=this.parent.editModule.getChildCount(h,0),this.parent.taskFields.parentID&&0<this.ganttData.length&&this.ganttData.splice(o+p+1,0,this.draggedRecord.taskData),this.treeGridData.splice(o+p+1,0,this.draggedRecord),this.parent.ids.splice(o+p+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString()),(r=this.parent.ids.indexOf(this.draggedRecord[this.parent.taskFields.id].toString()))!==o+p+1&&(this.parent.ids.splice(r,1),this.parent.ids.splice(o+p+1,0,this.draggedRecord[this.parent.taskFields.id].toString()))):(this.parent.taskFields.parentID&&0<this.ganttData.length&&this.ganttData.splice(o+1,0,this.draggedRecord.taskData),this.treeGridData.splice(o+1,0,this.draggedRecord),this.parent.ids.splice(o+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString())),this.parent.setRecordValue("parentItem",this.treeGridData[o].parentItem,a),this.parent.setRecordValue("parentUniqueID",this.treeGridData[o].parentUniqueID,a),this.parent.setRecordValue("level",this.treeGridData[o].level,a),a.hasChildRecords&&(this.updateChildRecordLevel(a,1),this.updateChildRecord(a,o+p+1)),h.parentItem)&&(s=(r=n=this.parent.getParentTask(h.parentItem).childRecords).indexOf(h)+1,r.splice(s,0,a)),"middleSegment"===this.dropPosition&&this.dropMiddle(o),ne.isNullOrUndefined(a.parentItem&&-1!==this.updateParentRecords.indexOf(a.parentItem))||this.updateParentRecords.push(this.parent.getTaskByUniqueID(a.parentItem.uniqueID))),ne.isNullOrUndefined(a.parentItem)&&(o=(s=this.parent.treeGrid.parentData).indexOf(this.droppedRecord),"bottomSegment"===this.dropPosition)&&s.splice(o+1,0,a),this.refreshDataSource();if("middleSegment"===this.dropPosition){if(!ne.isNullOrUndefined(h.ganttProperties.predecessor))for(var g,f,m=h.ganttProperties.predecessor.length-1;0<=m;m--)ne.isNullOrUndefined(h.ganttProperties.predecessor)||(f=this.parent.getRecordByID(h.ganttProperties.predecessor[m].from),g=this.parent.getRecordByID(h.ganttProperties.predecessor[m].to),f=this.parent.predecessorModule.validateParentPredecessor(f,g),!h.ganttProperties.predecessor)||f&&this.parent.allowParentDependency||(this.parent.editModule.removePredecessorOnDelete(h),h.ganttProperties.predecessor.splice(m,1),h.ganttProperties.predecessorsName=null,h[this.parent.taskFields.dependency]=null,h.taskData[this.parent.taskFields.dependency]=null);h.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,h.ganttProperties,!0),ne.isNullOrUndefined(h.taskData[this.parent.taskFields.milestone])||!0===h.taskData[this.parent.taskFields.milestone]&&(h.taskData[this.parent.taskFields.milestone]=!1))}for(var y=0;y<this.updateParentRecords.length;y++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[y]);this.parent.editedRecords.forEach(function(e){i.isFirstCall=!0,i.parent.predecessorModule.validatePredecessor(e,[],"")});for(y=0;y<this.updateParentRecords.length;y++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[y]);this.updateParentRecords=[],this.parent.isOnEdit=!1}this.canReset=!0,this.refreshRecord(e)},C.prototype.refreshRecord=function(t,i){var e,a,n,r,s=this;_(this.parent.dataSource)?(e=this.parent.dataSource,a={changedRecords:Z(this.parent.editedRecords,null,null,this.parent)},n=this.parent.query instanceof D.Query?this.parent.query:new D.Query,((r=e.adaptor)instanceof D.WebApiAdaptor&&r instanceof D.ODataAdaptor&&!e.dataSource.batchUrl?e.update(this.parent.taskFields.id,a.changedRecords,null,n):e.saveChanges(a,this.parent.taskFields.id,null,n)).then(function(e){return s.indentSuccess(e,t,i)}).catch(function(e){return s.indentFailure(e)})):this.indentOutdentSuccess(t,i)},C.prototype.indentSuccess=function(e,t,i){this.updateEditedFields(e),this.indentOutdentSuccess(t,i)},C.prototype.indentFailure=function(e){this.parent.trigger("actionFailure",{error:e})},C.prototype.indentOutdentSuccess=function(e,t){if(this.parent.treeGrid.parentData=[],this.parent.treeGrid.editModule&&(this.parent.treeGrid.editModule.isOnBatch=!1),this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&(this.refreshRecordInImmutableMode(e.data,t),this.parent.chartRowsModule.refreshRecords(this.parent.editedRecords)),t?e.requestType="rowDropped":"middleSegment"===this.dropPosition?e.requestType="indented":"bottomSegment"===this.dropPosition&&(e.requestType="outdented"),e.modifiedRecords=this.parent.editedRecords,this.parent.timezone)for(var i=0;i<e.modifiedRecords.length;i++)X(e.modifiedRecords[i],this.parent);this.canReset&&(this.parent.previousRecords={}),this.canReset=!1,this.parent.trigger("actionComplete",e),this.parent.hideLoadingIndicator(),this.parent.rowDragAndDropModule&&(this.parent.rowDragAndDropModule.draggedRecord=null)},C.prototype.refreshDataSource=function(){var e,t,i=this.draggedRecord,a=this.droppedRecord,n=this.parent,r=this.parent.dataSource instanceof D.DataManager?ne.getValue("dataOperation.dataArray",this.parent):n.dataSource;if(0<r.length&&!ne.isNullOrUndefined(a)&&!a.parentItem){for(var s=0;s<Object.keys(r).length;s++)r[s][this.parent.taskFields.child]===a.taskData[this.parent.taskFields.child]&&(e=s);"topSegment"===this.dropPosition?this.parent.taskFields.parentID||r.splice(e,0,i.taskData):"bottomSegment"!==this.dropPosition||this.parent.taskFields.parentID||r.splice(e+1,0,i.taskData)}else this.parent.taskFields.parentID||ne.isNullOrUndefined(a)||!a.parentItem||"topSegment"!==this.dropPosition&&"bottomSegment"!==this.dropPosition||(n="topSegment"===this.dropPosition?"Above":"Below",this.parent.editModule.addRowSelectedItem=a,t=[],Array.isArray(i)?t=i:t[0]=i,this.parent.editModule.updateRealDataSource(t,n),delete this.parent.editModule.addRowSelectedItem);this.parent.taskFields.parentID&&(i.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(i[this.parent.taskFields.parentID]=a[this.parent.taskFields.parentID],i.taskData[this.parent.taskFields.parentID]=a[this.parent.taskFields.parentID],i.ganttProperties.parentId=a[this.parent.taskFields.parentID]):(i[this.parent.taskFields.parentID]=a[this.parent.taskFields.id],i.taskData[this.parent.taskFields.parentID]=a[this.parent.taskFields.id],i.ganttProperties.parentId=a[this.parent.taskFields.id]):(i[this.parent.taskFields.parentID]=null,i.taskData[this.parent.taskFields.parentID]=null,i.ganttProperties.parentId=null))},C.prototype.deleteDragRow=function(){this.parent.dataSource instanceof D.DataManager?this.ganttData=ne.getValue("dataOperation.dataArray",this.parent):this.ganttData=H(this.parent)?ne.getValue("result",this.parent.dataSource):this.parent.dataSource,this.treeGridData=H(this.parent)?ne.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource;var e=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(e)},C.prototype.updateIndentedChildRecords=function(e){for(var t={uniqueID:e.uniqueID,expanded:e.expanded,level:e.level,index:e.index,taskId:e.ganttProperties.rowUniqueID},i=0;i<e.childRecords.length;i++)this.parent.setRecordValue("parentItem",t,e.childRecords[i]),this.parent.setRecordValue("parentUniqueID",e.uniqueID,e.childRecords[i]);if(e.hasChildRecords){e=e.childRecords;for(var a=0;a<e.length;a++)this.updateIndentedChildRecords(e[a])}},C.prototype.dropMiddle=function(e){var t,i,a=this.parent;this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.undoRedoModule.currentAction.modifiedRecord&&"child"!==this.parent.undoRedoModule.currentAction.modifiedRecord[0].position?"above"===this.parent.undoRedoModule.currentAction.modifiedRecord[0].position?t=this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.modifiedRecord[0].id.toString()):"below"===this.parent.undoRedoModule.currentAction.modifiedRecord[0].position&&(t=this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.modifiedRecord[0].id.toString())+1):(i=this.parent.editModule.getChildCount(this.droppedRecord,0),t=ne.isNullOrUndefined(i)||0===i?e+1:i+e+1),"middleSegment"===this.dropPosition&&(this.droppedRecord.ganttProperties.isAutoSchedule&&!ne.isNullOrUndefined(this.droppedRecord.ganttProperties.predecessorsName)&&""!==this.droppedRecord.ganttProperties.predecessorsName&&(i=this.droppedRecord.ganttProperties.startDate,this.parent.setRecordValue("startDate",i,this.draggedRecord.ganttProperties,!0),this.parent.dateValidationModule.calculateEndDate(this.draggedRecord),this.parent.dataOperation.updateTaskData(this.draggedRecord),this.parent.dataOperation.updateTaskLeftWidth(this.draggedRecord)),a.taskFields.parentID&&0<this.ganttData.length&&this.ganttData.splice(t,0,this.draggedRecord.taskData),this.treeGridData.splice(t,0,this.draggedRecord),this.parent.ids.splice(t,0,this.draggedRecord[this.parent.taskFields.id].toString()),this.recordLevel(),this.draggedRecord.hasChildRecords&&(this.updateChildRecord(this.draggedRecord,t,this.droppedRecord.expanded),this.parent.enableImmutableMode)&&(e=this.draggedRecord,this.updateIndentedChildRecords(e)),ne.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem)))&&this.updateParentRecords.push(this.draggedRecord.parentItem)},C.prototype.updateChildRecordLevel=function(e,t){if(t++,!e.hasChildRecords)return 0;for(var i=e.childRecords.length,a=0;a<i;a++){var n=e.childRecords[a],r=void 0;e.parentItem&&(r=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]),n.level=e.parentItem?r.level+t:e.level+1,n.hasChildRecords&&(t--,t=this.updateChildRecordLevel(n,t))}return t},C.prototype.updateChildRecord=function(e,t,i){var a,n=this.parent;if(!e.hasChildRecords)return 0;for(var r=e.childRecords.length,s=0;s<r;s++)a=e.childRecords[s],n.flatData.splice(++t,0,a),this.parent.ids.splice(t,0,a.ganttProperties.rowUniqueID.toString()),n.taskFields.parentID&&0<this.ganttData.length&&this.ganttData.splice(t,0,a.taskData),a.hasChildRecords&&(t=this.updateChildRecord(a,t));return t},C.prototype.removeRecords=function(e){var t=this.parent,i=this.parent.dataSource instanceof D.DataManager?ne.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource,a=e;if(a){e=this.parent.getParentTask(a.parentItem);if(a.parentItem&&(l=0,d=e?e.childRecords:[])&&0<d.length&&(l=d.indexOf(a),e.childRecords.splice(l,1),this.parent.taskFields.parentID||e.taskData[this.parent.taskFields.child].splice(l,1),this.updateParentRecords.push(e)),t.taskFields.parentID){a.hasChildRecords&&0<a.childRecords.length&&this.removeChildItem(a);for(var n=void 0,r=0<i.length?i:this.parent.currentViewData,s=0;s<r.length;s++)r[s][this.parent.taskFields.id]===a.taskData[this.parent.taskFields.id]&&(n=s);if(-1!==n){0<i.length&&i.splice(n,1);for(var o=void 0,s=0;s<this.treeGridData.length;s++)this.treeGridData[s][this.parent.taskFields.id]===a.taskData[this.parent.taskFields.id]&&(o=s);this.treeGridData.splice(o,1),this.parent.ids.splice(o,1),-1!==this.parent.treeGrid.parentData.indexOf(a)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(a),1)}}var l,d=this.treeGridData.indexOf(a);t.taskFields.parentID||(l=this.getChildCount(a,0),this.treeGridData.splice(d,l+1),this.parent.ids.splice(d,l+1),-1!==(i=this.ganttData.indexOf(a.taskData))&&(this.ganttData.splice(i,1),this.parent.treeGrid.parentData.splice(i,1))),a.parentItem&&e&&e.childRecords&&!e.childRecords.length&&(this.parent.setRecordValue("expanded",!1,e),this.parent.setRecordValue("hasChildRecords",!1,e))}},C.prototype.removeChildItem=function(e){for(var t,i=0;i<e.childRecords.length;i++){for(var a=e.childRecords[i],n=void 0,n=this.parent.dataSource instanceof D.DataManager?ne.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource,r=0;r<n.length;r++)n[r][this.parent.taskFields.id]===a.taskData[this.parent.taskFields.id]&&(t=r);if(-1!==t){0<n.length&&n.splice(t,1);for(var s=void 0,o=0;o<this.treeGridData.length;o++)this.treeGridData[o][this.parent.taskFields.id]===a.taskData[this.parent.taskFields.id]&&(s=o);this.treeGridData.splice(s,1),this.parent.ids.splice(s,1)}a.hasChildRecords&&this.removeChildItem(a)}},C.prototype.insertDraggedRecordAtIndex=function(e,t){var i=t.index,a=e.childRecords.findIndex(function(e){return e.index>=i});-1===a?e.childRecords.splice(e.childRecords.length,0,t):e.childRecords.splice(a,0,t)},C.prototype.recordLevel=function(){var e,t=this.parent,i=this.draggedRecord,a=this.droppedRecord,n=t.taskFields.child;a.hasChildRecords||(a.hasChildRecords=!0,a.childRecords.length)||(a.childRecords=[],!t.taskFields.parentID&&ne.isNullOrUndefined(a.taskData[n])&&(a.taskData[n]=[])),"middleSegment"===this.dropPosition&&(delete(e=ne.extend({},a)).childRecords,e={uniqueID:e.uniqueID,expanded:e.expanded,level:e.level,index:e.index,taskId:e.ganttProperties.rowUniqueID},this.parent.setRecordValue("parentItem",e,i),this.parent.setRecordValue("parentUniqueID",a.uniqueID,i),this.insertDraggedRecordAtIndex(a,i),ne.isNullOrUndefined(i)||t.taskFields.parentID||ne.isNullOrUndefined(a.taskData[n])||a.taskData[t.taskFields.child].splice(a.childRecords.length,0,i.taskData),!ne.isNullOrUndefined(a.ganttProperties.segments)&&0<a.ganttProperties.segments.length&&(a.ganttProperties.segments=null,a.taskData[t.taskFields.segments]=null),i.hasChildRecords?(i.level=a.level+1,this.updateChildRecordLevel(i,1)):i.level=a.level+1,a.expanded=!0)},C);function C(e){this.isFromDeleteMethod=!1,this.targetedRecords=[],this.isNewRecordAdded=!1,this.isValidatedEditedRecord=!1,this.createArray=!0,this.violationArgs={},this.deletedRecord=[],this.canReset=!1,this.isFlatDataHaveUnAsignedTask=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.confirmDialog=null,this.taskbarMoved=!1,this.predecessorUpdated=!1,this.isBreakLoop=!1,this.isDialogEditing=!1,this.deletedTaskDetails=[],this.parent=e,this.parent.predecessorModule.validatedChildItems=[],this.parent.editSettings.allowEditing&&"Auto"===this.parent.editSettings.mode&&(this.cellEditModule=new ga(this.parent)),this.parent.taskFields.dependency&&(this.parent.connectorLineEditModule=new Sa(this.parent)),(this.parent.editSettings.allowAdding||this.parent.editSettings.allowEditing&&("Dialog"===this.parent.editSettings.mode||"Auto"===this.parent.editSettings.mode))&&(this.dialogModule=new Ta(this.parent)),this.parent.editSettings.allowTaskbarEditing&&(this.taskbarEditModule=new ba(this.parent)),this.parent.editSettings.allowDeleting&&(e=ne.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"}),this.parent.element.appendChild(e),this.renderDeleteConfirmDialog()),this.parent.treeGrid.recordDoubleClick=this.recordDoubleClick.bind(this),this.parent.treeGrid.editSettings.allowAdding=this.parent.editSettings.allowAdding,this.parent.treeGrid.editSettings.allowDeleting=this.parent.editSettings.allowDeleting,this.parent.treeGrid.editSettings.showDeleteConfirmDialog=this.parent.editSettings.showDeleteConfirmDialog,this.parent.treeGrid.editSettings.allowNextRowEdit=this.parent.editSettings.allowNextRowEdit,"Dialog"===this.parent.editSettings.mode&&T.TreeGrid.Inject(T.Edit),this.updateDefaultColumnEditors()}Ra.prototype.getModuleName=function(){return"reorder"},Ra.prototype.bindEvents=function(){var t=this;this.parent.treeGrid.columnDragStart=function(e){t.parent.trigger("columnDragStart",e)},this.parent.treeGrid.columnDrag=function(e){t.parent.trigger("columnDrag",e)},this.parent.treeGrid.columnDrop=function(e){t.parent.trigger("columnDrop",e)}},Ra.prototype.destroy=function(){};var Ca=Ra;function Ra(e){this.parent=e,T.TreeGrid.Inject(T.Reorder),this.parent.treeGrid.allowReordering=this.parent.allowReordering,this.bindEvents()}var Ma=function(){return(Ma=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Oa=(xa.prototype.getModuleName=function(){return"resize"},xa.prototype.bindEvents=function(){var i=this;this.parent.treeGrid.resizeStart=function(e){var t;i.parent.undoRedoModule&&i.parent.isUndoRedoItemPresent("ColumnResize")&&(i.parent.undoRedoModule.createUndoCollection(),(t={action:"ColumnResize"}).resizedColumn=Ma({},e.column),i.parent.undoRedoModule.getUndoCollection[i.parent.undoRedoModule.getUndoCollection.length-1]=t),i.parent.trigger("resizeStart",e)},this.parent.treeGrid.resizing=function(e){i.parent.trigger("resizing",e)},this.parent.treeGrid.resizeStop=function(e){i.parent.trigger("resizeStop",e)}},xa.prototype.destroy=function(){},xa);function xa(e){this.parent=e,T.TreeGrid.Inject(T.Resize),this.parent.treeGrid.allowResizing=this.parent.allowResizing,this.bindEvents()}R.prototype.getModuleName=function(){return"filter"},R.prototype.updateCustomFilters=function(){for(var e=this.parent.taskFields,t=0;t<this.parent.ganttColumns.length;t++){var i=this.parent.ganttColumns[t];("datepickeredit"!==i.editType&&"datetimepickeredit"!==i.editType||i.field!==e.startDate&&i.field!==e.endDate&&i.field!==e.baselineStartDate&&i.field!==e.baselineEndDate)&&(i.field!==e.duration||"stringedit"!==i.editType)||this.initiateFiltering(this.parent.ganttColumns[t])}},R.prototype.updateModel=function(){this.parent.filterSettings=this.parent.treeGrid.filterSettings},R.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this),this.parent.on("actionBegin",this.actionBegin,this),this.parent.on("actionComplete",this.actionComplete,this),this.parent.on("columnMenuOpen",this.columnMenuOpen,this)},R.prototype.wireEvents=function(e){ne.EventHandler.add(document.getElementById(e),"click",this.mouseClickHandler,this)},R.prototype.initiateFiltering=function(e){var t=this.parent.getColumnByField(e.field,this.parent.treeGridModule.treeGridColumns);e.allowFiltering=!1!==e.allowFiltering,!e.allowFiltering||"Menu"!==this.parent.filterSettings.type&&"Excel"!==this.parent.filterSettings.type||e.filter||(e.filter={ui:this.getCustomFilterUi(e)}),t&&(t.allowFiltering=e.allowFiltering,t.filter=e.allowFiltering?e.filter:{})},R.prototype.getCustomFilterUi=function(e){var t=this.parent.taskFields,i={};return"datepickeredit"!==e.editType||e.field!==t.startDate&&e.field!==t.endDate&&e.field!==t.baselineStartDate&&e.field!==t.baselineEndDate?"datetimepickeredit"!==e.editType||e.field!==t.startDate&&e.field!==t.endDate&&e.field!==t.baselineStartDate&&e.field!==t.baselineEndDate?e.field===t.duration&&"stringedit"===e.editType&&(i=this.getDurationFilter()):i=this.getDateTimePickerFilter():i=this.getDatePickerFilter(e.field),i},R.prototype.mouseClickHandler=function(e){ne.closest(e.target,".e-excelfilter")&&this.parent.treeGrid.grid.notify("click",e)},R.prototype.unWireEvents=function(){ne.EventHandler.remove(this.parent.element,"click",this.mouseClickHandler)},R.prototype.getDatePickerFilter=function(e){var a,n=this,t=this.parent,i=e===t.taskFields.startDate||e===t.taskFields.baselineStartDate?t.defaultStartTime:t.defaultEndTime;return{create:function(e){var t=w.getCustomDateFormat(e.column.format,e.column.type),i=ne.createElement("input",{className:"flm-input"});e.target.appendChild(i),(a=new W.DatePicker({placeholder:n.parent.localeObj.getConstant("enterValue"),format:t})).enableRtl=n.parent.enableRtl,a.appendTo(i)},write:function(e){a.value=e.filteredValue},read:function(e){a.value&&a.value.setSeconds(i),e.fltrObj.filterByColumn(e.column.field,e.operator,a.value)}}},R.prototype.getDateTimePickerFilter=function(){var a,n=this;return{create:function(e){var t=w.getCustomDateFormat(e.column.format,e.column.type),i=ne.createElement("input",{className:"flm-input"});e.target.appendChild(i),(a=new W.DateTimePicker({placeholder:n.parent.localeObj.getConstant("enterValue"),format:t})).enableRtl=n.parent.enableRtl,a.appendTo(i)},write:function(e){a.value=e.filteredValue},read:function(e){e.fltrObj.filterByColumn(e.column.field,e.operator,a.value)}}},R.prototype.getDurationFilter=function(){var n,r=this,s=this.parent,o="";return{create:function(e){var t=ne.createElement("input",{className:"e-input"});t.setAttribute("placeholder",r.parent.localeObj.getConstant("enterValue")),e.target.appendChild(t),(n=new B.TextBox).enableRtl=r.parent.enableRtl,n.appendTo(t)},write:function(e){n.value=e.filteredValue?o:""},read:function(e){var t,i=r.parent.dataOperation.getDurationValue(n.value),a=ne.getValue("duration",i),i=ne.getValue("durationUnit",i);o=0<=a?(t=void 0,"minute"===i?t=60*a/s.secondsPerDay:"hour"===i?t=60*a*60/s.secondsPerDay:(t=a,i="day"),e.fltrObj.filterByColumn(e.column.field,e.operator,t),r.parent.dataOperation.getDurationString(a,i)):(e.fltrObj.filterByColumn(e.column.field,e.operator,null),null)}}},R.prototype.columnMenuOpen=function(e){this.filterMenuElement&&document.body.contains(this.filterMenuElement)&&ne.remove(this.filterMenuElement),this.filterMenuElement=null},R.prototype.actionBegin=function(e){},R.prototype.closeFilterOnContextClick=function(e){var t,i=document.querySelector("body > div.e-datepicker"),a=document.querySelector("body > div.e-datetimepicker");this.filterMenuElement&&document.body.contains(this.filterMenuElement)&&(t=ne.closest(e,"#"+this.parent.element.id)||e.querySelector("#"+this.parent.element.id),(this.filterMenuElement.contains(e)||ne.isNullOrUndefined(t))&&(this.filterMenuElement.contains(e)||this.parent.enableAdaptiveUI||!ne.isNullOrUndefined(i)||!ne.isNullOrUndefined(a)||"DIV"!==e.nodeName&&"HTML"!==e.nodeName&&"SPAN"!==e.nodeName&&"BUTTON"!==e.nodeName||e.classList.contains("e-dropdownbase"))||(ne.remove(this.filterMenuElement),this.parent.treeGrid.grid.notify("filter-menu-close",{isOpen:!1}),this.filterMenuElement=null))},R.prototype.actionComplete=function(e){var t,i,a,n,r,s;ne.isNullOrUndefined(e.filterModel)||ne.isNullOrUndefined(e.filterModel.dialogObj)||ne.isNullOrUndefined(e.filterModel.dialogObj.element)||"Excel"===this.parent.filterSettings.type&&this.wireEvents(e.filterModel.dialogObj.element.id),e.requestType===w.filterAfterOpen&&("Menu"===this.parent.treeGrid.filterSettings.type?this.filterMenuElement=ne.getValue("filterModel.dlgObj.element",e):this.filterMenuElement=ne.getValue("filterModel.dialogObj.element",e),this.updateFilterMenuPosition(this.filterMenuElement,e),t=this.parent.taskFields.id,i=this.parent.taskFields.dependency,a=this.parent.taskFields.resourceInfo,n=this.parent.treeGrid.grid.filterModule,n=ne.getValue("values",n),e.columnName===i&&ne.isNullOrUndefined(ne.getValue(i,n))||e.columnName===a&&ne.isNullOrUndefined(ne.getValue(a,n))?(r=this.filterMenuElement.querySelector(".e-dropdownlist"),s=void 0,ne.isNullOrUndefined(r)||((s=ne.getValue("ej2_instances[0]",r)).index=2,s.dataBind())):e.columnName===t&&ne.isNullOrUndefined(ne.getValue(t,n))&&"Menu"===this.parent.treeGrid.filterSettings.type&&(r=this.filterMenuElement.querySelector(".e-flmenu-input"),s=ne.getValue("ej2_instances[0]",r),!ne.isNullOrUndefined(s))&&ne.isNullOrUndefined(this.parent.columnByField[e.columnName].format)&&(s.format="n"))},R.prototype.setPosition=function(e,t){var i=this.parent.element.getBoundingClientRect(),a=this.parent.element.offsetParent.getBoundingClientRect(),e=e.getBoundingClientRect(),n=t.getBoundingClientRect(),i=i.left-e.left,n=this.parent.enableRtl?Math.abs(i)-n.width:e.width-i,i=a.top,a=("BODY"===t.offsetParent.tagName&&(i=0),e.top-i+window.scrollY);t.style.left="",t.style.top=a+"px",t.style.marginLeft=n+"px"},R.prototype.updateFilterMenuPosition=function(e,t){var i,a;ne.addClass([e],"e-gantt"),this.parent.enableAdaptiveUI||document.querySelector("#"+this.parent.controlId).appendChild(e),e.style.display="block",this.parent.showColumnMenu?(a=document.querySelector("#treeGrid"+this.parent.controlId+"_gridcontrol_colmenu_Filter"))&&(e.style.zIndex=a.parentElement.style.zIndex,"Menu"===this.parent.treeGrid.filterSettings.type?this.setPosition(a,ne.getValue("filterModel.dlgObj.element",t)):((i=ne.getValue("filterModel.dialogObj.element",t))&&(i.style.visibility="hidden"),this.setPosition(a,i))):(a=this.parent.treeGrid.grid.getColumnHeaderByField(t.columnName).querySelector(".e-filtermenudiv"),"Menu"===this.parent.treeGrid.filterSettings.type?w.getFilterMenuPostion(a,ne.getValue("filterModel.dlgObj",t)):w.getFilterMenuPostion(a,ne.getValue("filterModel.dialogObj",t))),e.style.visibility="visible","Menu"===this.parent.treeGrid.filterSettings.type&&e.querySelector(".e-valid-input").focus(),"Excel"===this.parent.treeGrid.filterSettings.type&&document.querySelector(".e-searchinput").focus()},R.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("updateModel",this.updateModel),this.parent.off("actionBegin",this.actionBegin),this.parent.off("actionComplete",this.actionComplete),this.parent.off("columnMenuOpen",this.columnMenuOpen))},R.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents()};var Ia=R;function R(e){this.parent=e,T.TreeGrid.Inject(T.Filter),this.parent.treeGrid.allowFiltering=this.parent.allowFiltering,this.updateCustomFilters(),this.parent.treeGrid.filterSettings=w.getActualProperties(this.parent.filterSettings),this.addEventListener()}Fa.prototype.getModuleName=function(){return"sort"},Fa.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this)},Fa.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("updateModel",this.updateModel)},Fa.prototype.destroy=function(){this.removeEventListener()},Fa.prototype.sortColumn=function(e,t,i){this.parent.treeGrid.sortByColumn(e,t,i)},Fa.prototype.clearSorting=function(){this.parent.treeGrid.clearSorting()},Fa.prototype.updateModel=function(){this.parent.sortSettings=this.parent.treeGrid.sortSettings},Fa.prototype.removeSortColumn=function(e){this.parent.treeGrid.grid.removeSortColumn(e)};var Ea=Fa;function Fa(e){this.parent=e,T.TreeGrid.Inject(T.Sort),this.parent.treeGrid.allowSorting=this.parent.allowSorting,this.parent.treeGrid.sortSettings=w.getActualProperties(this.parent.sortSettings),this.addEventListener()}M.prototype.getModuleName=function(){return"selection"},M.prototype.wireEvents=function(){this.parent.on("selectRowByIndex",this.selectRowByIndex,this),this.parent.isAdaptive?(this.parent.on("chartMouseClick",this.mouseUpHandler,this),this.parent.on("treeGridClick",this.popUpClickHandler,this)):this.parent.on("chartMouseUp",this.mouseUpHandler,this)},M.prototype.selectRowByIndex=function(){-1===this.parent.selectedRowIndex&&-1===this.parent.staticSelectedRowIndex||(this.selectRow(-1!==this.parent.staticSelectedRowIndex?this.parent.staticSelectedRowIndex:this.parent.selectedRowIndex),this.parent.staticSelectedRowIndex=-1)},M.prototype.bindEvents=function(){this.parent.treeGrid.rowSelecting=this.rowSelecting.bind(this),this.parent.treeGrid.rowSelected=this.rowSelected.bind(this),this.parent.treeGrid.rowDeselecting=this.rowDeselecting.bind(this),this.parent.treeGrid.rowDeselected=this.rowDeselected.bind(this),this.parent.treeGrid.cellSelecting=this.cellSelecting.bind(this),this.parent.treeGrid.cellSelected=this.cellSelected.bind(this),this.parent.treeGrid.cellDeselecting=this.cellDeselecting.bind(this),this.parent.treeGrid.cellDeselected=this.cellDeselected.bind(this)},M.prototype.rowSelecting=function(e){this.parent.isGanttChartRendered?(e.isCtrlPressed=this.isMultiCtrlRequest||e.isCtrlPressed,e.isShiftPressed=this.isMultiShiftRequest||e.isShiftPressed,e.target=this.actualTarget,ne.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.parent.selectionSettings&&this.parent.selectionSettings.persistSelection&&(this.parent.treeGrid.grid.selectionModule.checkSelectAllClicked=!0),this.parent.trigger("rowSelecting",e),(this.isMultiShiftRequest||this.isMultiCtrlRequest)&&(this.isMultiShiftRequest=this.isMultiCtrlRequest=!1)):e.cancel=!0},M.prototype.rowSelected=function(e){var t="rowIndexes",t="Multiple"!==this.parent.selectionSettings.type||ne.isNullOrUndefined(e[t])?[e.rowIndex]:e[t];if(this.addRemoveClass(t,e.name),this.selectedRowIndexes=ne.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:this.parent.treeGrid.grid.selectedRowIndex},!0),this.isMultiShiftRequest&&(this.selectedRowIndexes=t),this.parent.autoFocusTasks)if(this.parent.enableTimelineVirtualization&&(this.parent.isRowSelected=!0),e.data&&!ne.isNullOrUndefined(e.data.length))for(var i=0;i<e.data.length;i++)this.parent.ganttChartModule.updateScrollLeft(e.data[i].ganttProperties.left);else this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping&&ne.isNullOrUndefined(ne.getValue("data.ganttProperties.left",e))&&(e.data=this.parent.getRecordByID(e.data.taskId)),this.parent.ganttChartModule.updateScrollLeft(ne.getValue("data.ganttProperties.left",e));e.target=this.actualTarget,ne.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.prevRowIndex=e.rowIndex,ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(e),ne.isNullOrUndefined(this.parent.focusModule.previousActiveElement)||(t=this.parent.focusModule.previousActiveElement,ne.removeClass([t],"e-focused"),ne.removeClass([t],"e-focus")),this.parent.trigger("rowSelected",e)},M.prototype.rowDeselecting=function(e){e.target=this.actualTarget,e.isInteracted=this.isInteracted,this.parent.trigger("rowDeselecting",e)},M.prototype.rowDeselected=function(e){var t,i;if(0!==this.multipleIndexes.length)t=this.multipleIndexes;else if(ne.isNullOrUndefined(e.rowIndexes))t=[e.rowIndex];else{for(var a=0;a<e.rowIndexes.length;a++)e.rowIndexes[a]===e.rowIndex&&(i=!0);t=i?e.rowIndexes:[e.rowIndex]}this.addRemoveClass(t),this.selectedRowIndexes=ne.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:-1},!0),1===this.selectedRowIndexes.length&&this.parent.setProperties({selectedRowIndex:this.selectedRowIndexes[0]},!0),ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&0===this.selectedRowIndexes.length&&this.hidePopUp(),e.target=this.actualTarget,e.isInteracted=this.isInteracted,this.parent.trigger("rowDeselected",e),this.isInteracted=!1,this.multipleIndexes=[]},M.prototype.cellSelecting=function(e){var t=new D.Deferred;return this.parent.trigger("cellSelecting",e,function(e){t.resolve(e)}),t},M.prototype.cellSelected=function(e){this.parent.trigger("cellSelected",e),ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},M.prototype.cellDeselecting=function(e){this.parent.trigger("cellDeselecting",e)},M.prototype.cellDeselected=function(e){this.parent.trigger("cellDeselected",e),ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},M.prototype.selectCell=function(e,t){this.parent.treeGrid.selectCell(e,t)},M.prototype.selectCells=function(e){this.parent.treeGrid.grid.selectCells(e)},M.prototype.selectRow=function(t,e,i){var a,n=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children),n=(this.parent.enableVirtualization&&(this.parent.treeGridModule.addedRecord||this.parent.editModule&&this.parent.editModule.isAdded)&&(t=this.parent.getExpandedRecords(this.parent.flatData).indexOf(this.parent.flatData[t]),this.parent.treeGridModule.addedRecord=!1,this.parent.editModule)&&(this.parent.editModule.isAdded=!1),n.filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1===t})[0]);-1===t||ne.isNullOrUndefined(n)&&!this.parent.enableVirtualization||"Cell"===this.parent.selectionSettings.mode||(this.parent.showActiveElement&&!ne.isNullOrUndefined(i)&&!i||this.isFromChart?(this.isFromChart&&(this.isFromChart=!1),this.parent.treeGrid.grid.selectionModule.preventFocus=!0):this.parent.treeGrid.grid.selectionModule.preventFocus=!1,!0!==(a=ne.isNullOrUndefined(this.selectedClass)||this.selectedClass!==n||e?a:!0)&&this.parent.treeGrid.selectRow(t,e),this.parent.treeGrid.grid.selectionModule.preventFocus=!0!==this.parent.treeGrid.grid.selectionModule.preventFocus&&this.parent.treeGrid.grid.selectionModule.preventFocus,this.prevRowIndex=t,this.selectedClass=n)},M.prototype.selectRows=function(e){!ne.isNullOrUndefined(e)&&0<e.length&&this.parent.treeGrid.selectRows(e)},M.prototype.getSelectedRowIndexes=function(){return this.parent.treeGrid.getSelectedRowIndexes()},M.prototype.getSelectedRowCellIndexes=function(){return this.parent.treeGrid.getSelectedRowCellIndexes()},M.prototype.getSelectedRecords=function(){if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping){for(var i=[],a=this.parent.selectionModule.getSelectedRowIndexes(),n=this,e=0;e<a.length;e++)!function(t){var e=n.parent.currentViewData.filter(function(e){return e.index===a[t]})[0];i.push(e)}(e);return i}return this.parent.treeGrid.getSelectedRecords()},M.prototype.getCellSelectedRecords=function(){for(var e=this.parent.selectionModule.getSelectedRowCellIndexes(),t=[],i=0;i<e.length;i++)t.push(this.parent.currentViewData[e[i].rowIndex]);return t},M.prototype.getSelectedRows=function(){return this.parent.treeGrid.getSelectedRows()},M.prototype.clearSelection=function(){this.addRemoveClass(this.selectedRowIndexes),this.parent.treeGrid.clearSelection(),this.parent.selectedRowIndex=-1,this.selectedRowIndexes=[],this.selectedClass=null,ne.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),this.isInteracted=!1},M.prototype.highlightSelectedRows=function(e,t){var i;this.isMultiCtrlRequest=e.ctrlKey||this.enableSelectMultiTouch,this.isMultiShiftRequest=e.shiftKey,this.actualTarget=e.target,this.isInteracted=!0,(this.isSelectionFromChart=t)&&(t=ne.closest(e.target,"tr.e-chart-row"),t=parseInt(t.getAttribute("aria-rowindex"),10)-1,i=this.parent.selectionSettings.enableToggle,"Single"===this.parent.selectionSettings.type||!this.isMultiCtrlRequest&&!this.isMultiShiftRequest?(this.parent.selectionSettings.persistSelection&&this.addRemoveClass(this.selectedRowIndexes,e.name),(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&!this.parent.rowDragAndDropModule.draggedRecord)&&(this.isFromChart=!0,this.selectRow(t,i))):this.isMultiShiftRequest?this.selectRowsByRange(ne.isNullOrUndefined(this.prevRowIndex)?t:this.prevRowIndex,t):(ne.setValue("isMultiCtrlRequest",!0,this.parent.treeGrid.grid.selectionModule),this.parent.treeGrid.grid.selectionModule.addRowsToSelection([t]),-1<this.selectedRowIndexes.indexOf(t)&&this.addRemoveClass([t],e.name)))},M.prototype.getselectedrowsIndex=function(e,t){for(var i=[],a=e<t?{i:e,max:t}:{i:t,max:e},n=a.i,r=a.max;n<=r;n++)i.push(n);t<e&&i.reverse(),this.selectedRowIndexes=i},M.prototype.selectRowsByRange=function(e,t){this.isSelectionFromChart=!0,this.getselectedrowsIndex(e,t),this.selectRows(this.selectedRowIndexes)},M.prototype.addRemoveClass=function(r,s){"number"==typeof r&&(r=[r]);for(var o=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children),l=this,e=0;e<r.length;e++)!function(t){var e,i,a,n=o.filter(function(e){return parseInt(e.getAttribute("aria-rowindex"),10)-1===r[parseInt(t.toString(),10)]})[0];ne.isNullOrUndefined(n)||(e=!1,i=l.getSelectedRowIndexes().indexOf(r[parseInt(t.toString(),10)]),a=l.getSelectedRecords().length,l.parent.selectionSettings.persistSelection&&l.parent.selectionSettings.enableToggle&&!ne.isNullOrUndefined(s)&&"Multiple"!==l.parent.selectionSettings.type&&0<a&&(e=!0),l.parent.selectionSettings.enableToggle&&l.parent.selectionSettings.persistSelection&&-1<i&&"Single"===l.parent.selectionSettings.type&&e||-1<i&&!ne.isNullOrUndefined(s)&&"Multiple"===l.parent.selectionSettings.type?l.addClass(n):ne.isNullOrUndefined(s)?l.removeClass(n):-1<i&&l.addClass(n),l.parent.selectionSettings.enableToggle&&-1<i&&("Single"===l.parent.selectionSettings.type||!l.isMultiCtrlRequest&&!l.isMultiShiftRequest)&&l.parent.selectionSettings.persistSelection&&"chartMouseUp"===s&&l.isSelectionFromChart&&l.removeClass(n))}(e)},M.prototype.addClass=function(e){ne.addClass([e],"e-active"),e.setAttribute("aria-selected","true")},M.prototype.removeClass=function(e){ne.removeClass([e],"e-active"),e.removeAttribute("aria-selected")},M.prototype.showPopup=function(e){this.isSelectionFromChart?(w.setCssInGridPopUp(this.parent.element.querySelector(".e-ganttpopup"),e,"e-rowselect e-icons e-icon-rowselect"+(this.enableSelectMultiTouch&&(1<this.getSelectedRecords().length||1<this.getSelectedRowCellIndexes().length)?" e-spanclicked":"")),document.getElementsByClassName("e-gridpopup")[0].style.display="none",this.openPopup=!0):0===this.selectedRowIndexes.length&&this.hidePopUp()},M.prototype.hidePopUp=function(){this.openPopup?(document.getElementsByClassName("e-ganttpopup")[0].style.display="none",this.openPopup=!1):document.getElementsByClassName("e-gridpopup")[0].style.display="none"},M.prototype.popUpClickHandler=function(e){var e=e.target,t=this.parent.treeGrid.grid,i=ne.closest(e,".e-ganttpopup")?ne.closest(e,".e-ganttpopup"):ne.closest(e,".e-gridpopup");i?(i=i.querySelector(".e-rowselect"),ne.closest(e,".e-ganttpopup")&&!i.classList.contains("e-spanclicked")?(this.enableSelectMultiTouch=!0,i.classList.add("e-spanclicked")):ne.closest(e,".e-gridpopup")&&i.classList.contains("e-spanclicked")?(this.openPopup=!0,this.enableSelectMultiTouch=!0):(this.hidePopUp(),this.enableSelectMultiTouch=!1,ne.closest(e,".e-ganttpopup")&&i.classList.remove("e-spanclicked"))):"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&ne.closest(e,".e-rowcell")&&(0===this.selectedRowIndexes.length&&"Row"===this.parent.selectionSettings.mode||0===this.getCellSelectedRecords().length&&"Cell"===this.parent.selectionSettings.mode)&&this.hidePopUp(),t&&ne.setValue("enableSelectMultiTouch",this.enableSelectMultiTouch,t.selectionModule)},M.prototype.mouseUpHandler=function(e){var t=!1,i=document.querySelectorAll(".e-drag-item"),a=null;e.target.closest(".e-rowcell")?a=e.target:e.target.closest(".e-chart-row")&&(a=e.target.closest(".e-left-label-container")||e.target.closest(".e-taskbar-main-container")||e.target.closest(".e-right-label-container")),this.parent.focusModule&&this.parent.focusModule.setActiveElement(a),!(t=this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&this.parent.editModule.taskbarEditModule&&((a=this.parent.editModule.taskbarEditModule).isMouseDragged||a.tapPointOnFocus)?!0:t)&&this.parent.element.contains(e.target)&&1!==i.length&&(a=w.parentsUntil(e.target,"e-chart-row"),i=(t=e.target).classList.contains("e-rowcell")||t.closest("td.e-rowcell")&&t.closest("td.e-rowcell").classList.contains("e-rowcell")||t.classList.contains("e-row")||t.parentElement&&t.parentElement.classList.contains("e-checkbox-wrapper")||t.classList.contains("e-treegridexpand")||t.classList.contains("e-treegridcollapse")||!ne.isNullOrUndefined(a),this.popUpClickHandler(e),"Cell"!==this.parent.selectionSettings.mode&&i?(ne.closest(e.target,"tr.e-chart-row")?(this.parent.enableVirtualization&&(this.parent.treeGrid.grid.selectionModule.isInteracted=!0),this.parent.treeGrid.isFromChartSide=!0,this.highlightSelectedRows(e,!0)):(this.parent.treeGrid.isFromChartSide=!1,this.highlightSelectedRows(e,!1)),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&(0<this.selectedRowIndexes.length?this.showPopup(e):this.hidePopUp())):this.isSelectionFromChart=!1)},M.prototype.maintainSelectedRecords=function(e){-1<this.parent.selectionModule.getSelectedRowIndexes().indexOf(e)&&this.addRemoveClass([e])},M.prototype.destroy=function(){this.parent.isDestroyed||(this.parent.off("selectRowByIndex",this.selectRowByIndex),this.parent.isAdaptive?(this.parent.off("chartMouseClick",this.mouseUpHandler),this.parent.off("treeGridClick",this.popUpClickHandler)):this.parent.off("chartMouseUp",this.mouseUpHandler))};var Ua=M;function M(e){this.isSelectionFromChart=!1,this.isFromChart=!1,this.multipleIndexes=[],this.selectedRowIndexes=[],this.enableSelectMultiTouch=!1,this.openPopup=!1,this.parent=e,this.bindEvents(),this.parent.treeGrid.selectedRowIndex=this.parent.selectedRowIndex,this.parent.treeGrid.allowSelection=this.parent.allowSelection,this.parent.treeGrid.grid.selectionSettings.enableToggle=this.parent.selectionSettings.enableToggle,this.parent.treeGrid.selectionSettings=w.getActualProperties(this.parent.selectionSettings),this.wireEvents()}O.prototype.getModuleName=function(){return"toolbar"},O.prototype.renderToolbar=function(){if(0<(this.parent.toolbar||[]).length){this.element=ne.createElement("div",{id:this.parent.controlId+"_Gantt_Toolbar",className:"e-gantt-toolbar"}),this.parent.treeGrid.grid.headerModule?this.parent.element.insertBefore(this.element,this.parent.treeGridPane.offsetParent):this.parent.element.appendChild(this.element);for(var e=0,t=["Add","Edit","Update","Delete","Cancel","ExpandAll","CollapseAll","PrevTimeSpan","NextTimeSpan","ZoomIn","ZoomOut","ZoomToFit","ExcelExport","CsvExport","PdfExport","Indent","Outdent","CriticalPath","Undo","Redo"];e<t.length;e++){var i=t[e],a=void 0,n=void 0,n="CriticalPath"===i?(a="critical-path","criticalPath"):(a=i.toLowerCase(),i[0].toLowerCase()+i.slice(1));this.predefinedItems[i]={id:this.parent.element.id+"_"+a,prefixIcon:"e-"+a,text:this.parent.isAdaptive?"":this.parent.localeObj.getConstant(n),tooltipText:this.parent.localeObj.getConstant(n)+("add"===n||"edit"===n||"delete"===n?this.parent.localeObj.getConstant("task"):"expandAll"===n||"collapseAll"===n?this.parent.localeObj.getConstant("tasks"):""),align:this.parent.isAdaptive?"Right":"Left"},this.parent.enableRtl&&("PrevTimeSpan"===i&&(this.predefinedItems[i].prefixIcon="e-nexttimespan"),"NextTimeSpan"===i)&&(this.predefinedItems[i].prefixIcon="e-prevtimespan")}var r=this.parent.localeObj.getConstant("search");this.parent.isAdaptive?this.predefinedItems.Search={id:this.id+"_searchbutton",prefixIcon:"e-search-icon",tooltipText:r,align:"Right"}:this.predefinedItems.Search={id:this.id+"_search",template:'<div class="e-input-group e-search" role="search"><input id="'+this.id+'_searchbar" class="e-input" name="input" type="search"placeholder= "'+r+'"/><span id="'+this.id+'_searchbutton" class="e-input-group-icon e-search-icon e-icons"tabindex="-1" title="'+r+'" aria-label= "search" role="button"></span></div>',tooltipText:r,align:"Right",cssClass:"e-search-wrapper"},this.createToolbar()}},O.prototype.addReactToolbarPortals=function(e){this.parent.isReact&&e&&(this.parent.portals=this.parent.portals.concat(e),this.parent.renderTemplates())},O.prototype.createToolbar=function(){var e=this.getItems(),e=(this.toolbar=new V.Toolbar({items:e,enableRtl:this.parent.enableRtl,clicked:this.toolbarClickHandler.bind(this),height:this.parent.isAdaptive?48:"auto"}),this.toolbar.isStringTemplate=!0,this.toolbar.isReact=this.parent.isReact,this.toolbar.on("render-react-toolbar-template",this.addReactToolbarPortals,this),this.toolbar.appendTo(this.element),this.parent.treeGrid.grid&&this.parent.isReact&&(this.parent.treeGrid.grid.portals=this.parent.portals),this.element.querySelector("#"+this.parent.element.id+"_cancel")),t=this.element.querySelector("#"+this.parent.element.id+"_update"),i=(e&&ne.addClass([e],ue),t&&ne.addClass([t],ue),!1);this.parent.toolbar.map(function(e){"Search"===e&&(i=!0)}),this.parent.isAdaptive&&i?(this.element.insertBefore(this.getSearchBarElement(),this.element.childNodes[0]),this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar"),new B.TextBox({placeholder:this.parent.localeObj.getConstant("search"),enableRtl:this.parent.enableRtl,floatLabelType:"Never",showClearButton:!0}).appendTo(this.searchElement)):this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar"),this.parent.filterModule&&(this.wireEvent(),this.parent.searchSettings)&&this.updateSearchTextBox(),this.enableItems([this.parent.controlId+"_redo",this.parent.controlId+"_undo"],!1),this.parent.readOnly&&this.enableItems([this.parent.element.id+"_add",this.parent.element.id+"_update",this.parent.element.id+"_delete",this.parent.element.id+"_cancel",this.parent.element.id+"_indent",this.parent.element.id+"_outdent"],!1)},O.prototype.getSearchBarElement=function(){var e=this,t=ne.createElement("div",{className:"e-adaptive-searchbar",styles:"display: none"}),i=ne.createElement("input",{attrs:{type:"text"},id:this.parent.element.id+"_searchbar"}),a=ne.createElement("span",{className:"e-backarrowspan e-icons"});return a.onclick=function(){t.style.display="none",e.element.childNodes[1].style.display="block"},t.appendChild(a),t.appendChild(i),t},O.prototype.wireEvent=function(){this.searchElement&&(ne.EventHandler.add(this.searchElement,"keyup",this.keyUpHandler,this),ne.EventHandler.add(this.searchElement,"focus",this.focusHandler,this),ne.EventHandler.add(this.searchElement,"blur",this.blurHandler,this))},O.prototype.propertyChanged=function(e){ne.getValue("module",e)===this.getModuleName()&&this.parent.toolbar&&(this.element&&this.element.parentNode&&ne.remove(this.element),this.renderToolbar(),this.refreshToolbarItems())},O.prototype.unWireEvent=function(){this.searchElement&&(ne.EventHandler.remove(this.searchElement,"keyup",this.keyUpHandler),ne.EventHandler.remove(this.searchElement,"focus",this.focusHandler),ne.EventHandler.remove(this.searchElement,"blur",this.blurHandler),this.searchElement=null),this.parent.isDestroyed||this.parent.off("ui-toolbarupdate",this.propertyChanged)},O.prototype.keyUpHandler=function(e){13===e.keyCode&&this.parent.searchSettings.key!==this.searchElement.value&&(this.parent.searchSettings.key=this.searchElement.value,this.parent.dataBind())},O.prototype.focusHandler=function(e){e.target.parentElement.classList.add("e-input-focus")},O.prototype.blurHandler=function(e){e.target.parentElement.classList.remove("e-input-focus")},O.prototype.updateSearchTextBox=function(){this.searchElement&&this.searchElement.value!==this.parent.searchSettings.key&&(this.searchElement.value=this.parent.searchSettings.key)},O.prototype.getItems=function(){var e,t=[],i=this.parent.toolbar,a=-1;i.forEach(function(e,t){("string"==typeof e&&"Search"===e||"object"==typeof e&&"Search"===e.text)&&(a=t)}),-1<a&&(e=i.splice(a,1),i.push(e[0]));for(var n=0,r=i;n<r.length;n++){var s=r[n];t.push("string"==typeof s?this.getItemObject(s):this.getItem(s))}return t},O.prototype.getItem=function(e){var t=this.predefinedItems[e.text],t=t?ne.extend(t,t,e):e;return t.align||(t.align=this.parent.isAdaptive?"Right":"Left"),t},O.prototype.getItemObject=function(e){return this.predefinedItems[e]||{text:e,id:this.id+"_"+e}},O.prototype.toolbarClickHandler=function(i){var a=this,n=this.parent,r=this.id;this.parent.isToolBarClick=!1,ne.extend(i,{cancel:!1}),n.trigger(ca,i,function(e){if(!e.cancel)switch(i.item.properties.id!==a.parent.element.id+"_pdfexport"&&i.item.properties.id!==a.parent.element.id+"_critical-path"||a.parent.showLoadingIndicator(),!0!==a.parent.isAdaptive||e.item.id!==r+"_edit"&&e.item.id!==r+"_add"&&e.item.id!==r+"_delete"&&e.item.id!==r+"_searchbutton"&&e.item.id!==r+"_expandall"&&e.item.id!==r+"_collapseall"||a.parent.selectionModule&&"Multiple"===a.parent.selectionSettings.type&&(a.parent.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none"),!ne.isNullOrUndefined(e.item)&&e.item.id){case r+"_edit":n.editModule&&n.editSettings.allowEditing&&n.editModule.dialogModule.openToolbarEditDialog();break;case r+"_indent":n.editModule&&n.selectionModule.getSelectedRecords().length&&n.indent();break;case r+"_critical-path":n.enableCriticalPath?n.enableCriticalPath=!1:n.enableCriticalPath=!0;break;case r+"_outdent":n.editModule&&n.selectionModule.getSelectedRecords().length&&n.outdent();break;case r+"_update":n.editModule.cellEditModule.isCellEdit=!1,n.treeGrid.grid.saveCell();break;case r+"_cancel":n.cancelEdit();break;case r+"_add":n.editModule&&n.editSettings.allowAdding&&n.editModule.dialogModule.openAddDialog();break;case r+"_delete":a.parent.selectionModule&&a.parent.editModule&&("Cell"!==a.parent.selectionSettings.mode&&a.parent.selectionModule.selectedRowIndexes.length||"Cell"===a.parent.selectionSettings.mode&&a.parent.selectionModule.getSelectedRowCellIndexes().length)&&a.parent.editModule.startDeleteAction();break;case r+"_search":ne.getValue("originalEvent.target.id",e)===a.parent.element.id+"_searchbutton"&&a.parent.filterModule&&(t=a.element.querySelector("#"+a.parent.element.id+"_searchbar").value,a.parent.searchSettings.key!==t)&&(a.parent.searchSettings.key=t,a.parent.dataBind());break;case r+"_searchbutton":var t=a.element.querySelector(".e-adaptive-searchbar");t.parentElement.childNodes[1].style.display="none",t.style.display="block";break;case r+"_expandall":a.parent.ganttChartModule.expandCollapseAll("expand"),a.parent.isCollapseAll=!1;break;case r+"_collapseall":a.parent.ganttChartModule.expandCollapseAll("collapse"),a.parent.isCollapseAll=!0;break;case r+"_prevtimespan":a.parent.previousTimeSpan();break;case r+"_nexttimespan":a.parent.nextTimeSpan();break;case r+"_zoomin":a.zoomIn();break;case r+"_zoomout":a.zoomOut();break;case r+"_zoomtofit":a.zoomToFit();break;case r+"_undo":a.parent.undo();break;case r+"_redo":a.parent.redo()}})},O.prototype.zoomIn=function(){this.parent.timelineModule.processZooming(!0),this.parent.timelineModule.isZooming=!1},O.prototype.zoomToFit=function(){this.parent.timelineModule.isZoomIn&&(this.parent.timelineModule.isZoomIn=!1),this.parent.timelineModule.processZoomToFit(),this.parent.ganttChartModule.updateScrollLeft(0),this.parent.timelineModule.isZoomToFit=!1},O.prototype.zoomOut=function(){this.parent.timelineModule.processZooming(!1),this.parent.timelineModule.isZooming=!1},O.prototype.refreshToolbarItems=function(e){var t=this.parent,i=[],a=[],n=t.editSettings,r=this.id,s=t.selectedRowIndex;if(this.parent.loadChildOnDemand&&this.parent.taskFields.hasChildMapping)for(var o=0;o<t.updatedRecords.length;o++)if(t.updatedRecords[o].index===s){s=o;break}var l=!1,d=(!t.selectionModule||1!==t.selectionModule.getSelectedRecords().length&&1!==t.selectionModule.getSelectedRowCellIndexes().length||(l=!0),t.selectionModule&&"Multiple"===t.selectionSettings.type&&1<t.selectionModule.selectedRowIndexes.length&&(l=!1),!1);if(t.selectionModule&&t.selectionSettings.persistSelection){var h=t.selectionModule.getSelectedRecords().length;if(t.selectionSettings.persistSelection&&1===h)for(o=0;o<h;o++)-1===(k=t.currentViewData.indexOf(t.selectionModule.getSelectedRecords()[o]))&&(d=!0);d&&(l=!1)}var p=this.toolbar?this.toolbar.items:[],u=[r+"_add",r+"_edit",r+"_delete",r+"_update",r+"_cancel",r+"_indent",r+"_outdent"],e="ResourceView"===this.parent.viewType&&0!==ne.getValue("data.level",e)||"ProjectView"===this.parent.viewType;if(ne.isNullOrUndefined(this.parent.editModule))a.push(r+"_delete"),a.push(r+"_add"),a.push(r+"_edit"),a.push(r+"_update"),a.push(r+"_cancel"),a.push(r+"_indent"),a.push(r+"_outdent");else{var c=!!t.editModule.taskbarEditModule&&t.editModule.taskbarEditModule.touchEdit,g=t.flatData&&t.flatData.length,f=((n.allowAdding&&!c?i:a).push(r+"_add"),(n.allowEditing&&e&&g&&l&&!c?i:a).push(r+"_edit"),n.allowEditing&&0!==s&&-1!==s&&g&&l&&"ResourceView"!==this.parent.viewType?ne.isNullOrUndefined(t.updatedRecords[s])||0!==t.updatedRecords[s].level||!g||c?(e=t.updatedRecords[s-1],ne.isNullOrUndefined(t.updatedRecords[s])||t.updatedRecords[s].level-e.level!=1||-1===s?-1!==s&&(i.push(r+"_indent"),i.push(r+"_outdent")):(a.push(r+"_indent"),i.push(r+"_outdent"))):(i.push(r+"_indent"),a.push(r+"_outdent")):(a.push(r+"_indent"),a.push(r+"_outdent")),!!t.selectionModule&&(0<t.selectionModule.getSelectedRecords().length||0<t.selectionModule.getSelectedRowCellIndexes().length));if(t.selectionModule&&t.selectionSettings.persistSelection){d&&(f=!1);var m=(h=t.selectionModule.getSelectedRecords()).length;if(t.selectionSettings.persistSelection&&1<m)for(o=0;o<m;o++){if(-1<(k=t.currentViewData.indexOf(h[o]))){f=!0;break}f=!1}}if((n.allowDeleting&&g&&f&&!c?i:a).push(r+"_delete"),"Auto"===t.editSettings.mode&&!ne.isNullOrUndefined(t.editModule.cellEditModule)&&t.editModule.cellEditModule.isCellEdit){(i=[]).push(r+"_update",r+"_cancel");for(var a=[],y=0;y<p.length;y++)p[y].id!==r+"_update"&&p[y].id!==r+"_cancel"&&-1!==u.indexOf(p[y].id)&&a.push(p[y].id)}else{a.push(r+"_update",r+"_cancel");for(y=0;y<p.length;y++)-1===i.indexOf(p[y].id)&&-1===a.indexOf(p[y].id)&&i.push(p[y].id)}}for(var D=0;D<i.length;D++){for(var k=void 0,y=0;y<p.length;y++)if(p[y].id===i[D]){k=y;break}0<p.length&&!ne.isNullOrUndefined(p[k])&&p[k].properties.visible&&this.toolbar.hideItem(k,!1)}for(var b=0;b<a.length;b++){for(k=void 0,y=0;y<p.length;y++)if(p[y].id===a[b]){k=y;break}0<p.length&&this.toolbar.hideItem(k,!0)}},O.prototype.enableItems=function(e,t){for(var i=0,a=e;i<a.length;i++){var n=a[i],n=this.element.querySelector("#"+n);n&&this.toolbar.enableItems(n.parentElement,t)}},O.prototype.destroy=function(){this.parent.filterModule&&this.unWireEvent(),this.parent.isDestroyed||(this.toolbar&&this.toolbar.off("render-react-toolbar-template",this.addReactToolbarPortals),this.toolbar.destroy(),ne.remove(this.element))};var Na=O;function O(e){this.predefinedItems={},this.items=["Add","Edit","Update","Delete","Cancel","ExpandAll","CollapseAll","Search","PrevTimeSpan","NextTimeSpan","ZoomIn","ZoomOut","ZoomToFit","ExcelExport","CsvExport","PdfExport","Indent","Outdent","CriticalPath"],this.parent=e,this.id=this.parent.element.id,this.parent.on("ui-toolbarupdate",this.propertyChanged,this)}Va.prototype.createNonworkingContainer=function(){this.parent.ganttChartModule.chartBodyContent.contains(this.nonworkingContainer)||(this.nonworkingContainer=ne.createElement("div",{className:"e-nonworking-day-container"}),this.parent.enableTimelineVirtualization&&(this.nonworkingContainer.style.height="100%"),this.parent.ganttChartModule.chartBodyContent.insertBefore(this.nonworkingContainer,this.parent.ganttChartModule.chartBodyContent.firstChild))},Va.prototype.renderHolidays=function(){var e,t=this;this.parent.holidays&&0<this.parent.holidays.length?(this.createNonworkingContainer(),this.nonworkingContainer.contains(this.holidayContainer)||(this.holidayContainer=ne.createElement("div",{className:"e-holiday-container"}),this.parent.enableTimelineVirtualization&&(this.holidayContainer.style.height="100%",this.holidayContainer.style.zIndex="-1"),this.nonworkingContainer.appendChild(this.holidayContainer)),e=this.getHolidaysElement().childNodes,this.holidayContainer.innerHTML="",e.forEach(function(e){t.holidayContainer.appendChild(e.cloneNode(!0))})):this.holidayContainer&&this.holidayContainer.parentNode&&(ne.remove(this.holidayContainer),this.nonworkingContainer)&&0===this.nonworkingContainer.childNodes.length&&ne.remove(this.nonworkingContainer)},Va.prototype.getHolidaysElement=function(){for(var e,t,i=ne.createElement("div"),a=this.parent.contentHeight,n=0,r=(ne.isNullOrUndefined(this.parent.toolbarModule)||ne.isNullOrUndefined(this.parent.toolbarModule.element)||(n=this.parent.toolbarModule.element.offsetHeight),this.parent.ganttHeight-n-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight),s=0;s<this.parent.holidays.length;s++){this.parent.holidays[s].from&&this.parent.holidays[s].to?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[s].from),(t=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[s].to)).setDate(t.getDate()+1),e.setHours(0,0,0,0),t.setHours(0,0,0,0)):this.parent.holidays[s].from?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[s].from)).setHours(0,0,0,0):this.parent.holidays[s].to&&(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[s].to)).setHours(0,0,0,0);var o=this.parent.holidays[s].from&&this.parent.holidays[s].to?this.parent.dataOperation.getTaskWidth(e,t):this.parent.perDayWidth,l=this.parent.dataOperation.getTaskLeft(e,!1,!0),l=this.parent.enableRtl?"right:"+l+"px;":"left:"+l+"px;",l=ne.createElement("div",{className:"e-holiday",styles:l+" width:"+o+"px; height:100%;"}),o=ne.createElement("span",{className:"e-span",styles:"top:"+(r<a?r/2:a/2)+"px;left:"+o/2+"px;"}),d=this.parent.disableHtmlEncode?"textContent":"innerHTML";o[d]=this.parent.holidays[s].label||"",this.parent.enableHtmlSanitizer&&"string"==typeof o[d]&&(o[d]=ne.SanitizeHtmlHelper.sanitize(o[d])),l.appendChild(o),this.parent.holidays[s].cssClass&&l.classList.add(this.parent.holidays[s].cssClass),i.appendChild(l)}return i},Va.prototype.renderWeekends=function(){var e,t=this;this.parent.highlightWeekends&&this.parent.timelineSettings.showWeekend?(this.createNonworkingContainer(),this.nonworkingContainer.contains(this.weekendContainer)||(this.weekendContainer=ne.createElement("div",{className:"e-weekend-container"}),this.parent.enableTimelineVirtualization&&(this.weekendContainer.style.height="100%",this.weekendContainer.style.zIndex="-1"),this.nonworkingContainer.appendChild(this.weekendContainer)),e=this.getWeekendElements().childNodes,this.weekendContainer.innerHTML="",e.forEach(function(e){t.weekendContainer.appendChild(e.cloneNode(!0))})):this.weekendContainer&&(ne.remove(this.weekendContainer),this.weekendContainer=null,this.nonworkingContainer)&&0===this.nonworkingContainer.childNodes.length&&(ne.remove(this.nonworkingContainer),this.nonworkingContainer=null)},Va.prototype.getWeekendElements=function(){var e,t,i,a,n,r,s,o=ne.createElement("div"),l=this.parent.enableTimelineVirtualization&&0!==this.parent.ganttChartModule.scrollObject.element.scrollLeft?this.parent.ganttChartModule.scrollObject.getTimelineLeft():null,d=this.parent.enableTimelineVirtualization&&!ne.isNullOrUndefined(l)?new Date(this.parent.timelineModule.dateByLeftValue(l).getTime()):new Date(this.parent.timelineModule.timelineStartDate.getTime()),h=this.parent.enableTimelineVirtualization?new Date(this.parent.timelineModule.weekendEndDate.getTime()):new Date(this.parent.timelineModule.timelineEndDate.getTime()),p=this.parent.nonWorkingDayIndex,u=!0,c=!0,g=(this.weekendWidthUpdated=!1,this.parent.dataOperation.hasDSTTransition(d.getFullYear()));do{}while(-1!==p.indexOf(d.getDay())&&(e=this.parent.dataOperation.getTaskLeft(d,!1,!0),t=this.parent.perDayWidth,u&&(i=new Date(d.getTime()),(a=new Date(i.getTime())).setDate(a.getDate()+1),a.setHours(0,0,0,0),t=this.parent.dataOperation.getTaskWidth(i,a),u=!1),g||(i=new Date(d),a=new Date(d),i.setDate(i.getDate()+1),s=i.getTimezoneOffset(),n=a.getTimezoneOffset(),c?c=!1:(r="Hour"===this.parent.timelineModule.bottomTier&&1===this.parent.timelineModule.customTimelineSettings.bottomTier.count||"Minutes"===this.parent.timelineModule.bottomTier&&60===this.parent.timelineModule.customTimelineSettings.bottomTier.count||"Hour"===this.parent.timelineModule.topTier&&1===this.parent.timelineModule.customTimelineSettings.topTier.count&&"Minutes"===this.parent.timelineModule.bottomTier&&(30===this.parent.timelineModule.customTimelineSettings.bottomTier.count||15===this.parent.timelineModule.customTimelineSettings.bottomTier.count),this.weekendWidthUpdated||r&&s<n&&(t-=this.parent.perDayWidth/24,this.weekendWidthUpdated=!0))),r=this.parent.enableRtl?"right:"+e+"px;":"left:"+e+"px;",s=ne.createElement("div",{className:"e-weekend",styles:r+" width:"+t+"px;height:100%;"}),o.appendChild(s)),d.setDate(d.getDate()+1),d.setHours(0,0,0,0),d<h);return o},Va.prototype.updateHolidayLabelHeight=function(){for(var e=this.parent.getContentHeight(),t=document.getElementById(this.parent.element.id),i=0,t=(ne.isNullOrUndefined(this.parent.toolbarModule)||ne.isNullOrUndefined(this.parent.toolbarModule.element)||(i=this.parent.toolbarModule.element.offsetHeight),"auto"===this.parent.height?t.offsetHeight-i-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight:this.parent.ganttHeight-i-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight),a=t<e?t/2:e/2,n=this.holidayContainer.querySelectorAll(".e-span"),r=0;r<n.length;r++)n[r].style.top=ne.formatUnit(a)},Va.prototype.updateContainerHeight=function(){var e=this.parent.getContentHeight();this.holidayContainer&&(this.holidayContainer.style.height=ne.formatUnit(e),this.updateHolidayLabelHeight()),this.weekendContainer&&(this.weekendContainer.style.height=ne.formatUnit(e))},Va.prototype.removeContainers=function(){this.holidayContainer&&ne.remove(this.holidayContainer),this.weekendContainer&&(ne.remove(this.weekendContainer),this.weekendContainer=null),this.nonworkingContainer&&(ne.remove(this.nonworkingContainer),this.nonworkingContainer=null)};var La=Va;function Va(e){this.weekendWidthUpdated=!1,this.parent=e,this.nonworkingContainer=null,this.holidayContainer=null,this.weekendContainer=null}Aa.prototype.renderEventMarkers=function(){this.parent.eventMarkers&&0<this.parent.eventMarkers.length?(this.parent.ganttChartModule.chartBodyContent.contains(this.eventMarkersContainer)||(this.eventMarkersContainer=ne.createElement("div",{className:"e-event-markers-container"}),this.eventMarkersContainer.setAttribute("role","term"),this.parent.ganttChartModule.chartBodyContent.appendChild(this.eventMarkersContainer)),this.eventMarkersContainer.innerHTML="",this.getEventMarkersElements(this.eventMarkersContainer)):this.removeContainer()},Aa.prototype.removeContainer=function(){this.eventMarkersContainer&&(ne.remove(this.eventMarkersContainer),this.eventMarkersContainer=null)},Aa.prototype.getEventMarkersElements=function(e){for(var t,i,a,n=[],r=0;r<this.parent.eventMarkers.length;r++)ne.isNullOrUndefined(this.parent.eventMarkers[r].day)||(this.parent.isFromEventMarker=!0,a=this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[r].day,!0),!1,!0),this.parent.isFromEventMarker=!1,n.push({id:r,left:a,label:this.parent.eventMarkers[r].label,date:this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[r].day,!0)}),i=void 0,i=this.parent.enableRtl?"right:"+a+"px;":"left:"+a+"px;",a=ne.createElement("div",{className:"e-event-markers",styles:i+"  height:100%;",id:"stripline"+r}),this.parent.eventMarkers[r].label&&((i=ne.createElement("div",{className:"e-span-label"}))[t=this.parent.disableHtmlEncode?"textContent":"innerHTML"]=this.parent.eventMarkers[r].label,this.parent.enableHtmlSanitizer&&"string"==typeof i[t]&&(i[t]=ne.SanitizeHtmlHelper.sanitize(i[t])),this.parent.enableRtl?i.style.right="5px":i.style.left="5px",a.appendChild(i),t=ne.createElement("div",{className:"e-gantt-right-arrow"}),a.appendChild(t)),this.parent.eventMarkers[r].cssClass&&a.classList.add(this.parent.eventMarkers[r].cssClass),a.setAttribute("tabindex","-1"),a.setAttribute("aria-label",this.parent.localeObj.getConstant("eventMarkers")+" "+("string"==typeof this.parent.eventMarkers[r].day?this.parent.eventMarkers[r].day:this.parent.getFormatedDate(this.parent.eventMarkers[r].day))+" "+this.parent.eventMarkers[r].label),e.appendChild(a));this.parent.eventMarkerColloction=n},Aa.prototype.updateContainerHeight=function(){this.eventMarkersContainer&&(this.eventMarkersContainer.style.height=ne.formatUnit(this.parent.getContentHeight()))};var Ba=Aa;function Aa(e){this.parent=e,this.eventMarkersContainer=null}ja.prototype.wireEvents=function(){this.parent.on("refreshDayMarkers",this.refreshMarkers,this),this.parent.on("updateHeight",this.updateHeight,this),this.parent.on("ui-update",this.propertyChanged,this)},ja.prototype.propertyChanged=function(e){for(var t=Object.keys(ne.getValue("properties",e)),i=0;i<t.length;i++)switch(t[i]){case"eventMarkers":this.eventMarkerRender.renderEventMarkers(),this.updateHeight();break;case"highlightWeekends":this.nonworkingDayRender.renderWeekends(),this.updateHeight();break;case"holidays":this.nonworkingDayRender.renderHolidays(),this.updateHeight()}},ja.prototype.refreshMarkers=function(){this.nonworkingDayRender.renderWeekends(),this.nonworkingDayRender.renderHolidays(),"Vertical"!==this.parent.gridLines&&"Both"!==this.parent.gridLines||this.parent.renderChartVerticalLines(),this.eventMarkerRender.renderEventMarkers()},ja.prototype.updateHeight=function(){this.nonworkingDayRender.updateContainerHeight(),this.eventMarkerRender.updateContainerHeight(),this.parent.ganttChartModule.scrollObject.updateTopPosition()},ja.prototype.getModuleName=function(){return"dayMarkers"},ja.prototype.destroy=function(){this.parent.isDestroyed||(this.nonworkingDayRender.removeContainers(),this.eventMarkerRender.removeContainer(),this.parent.off("refreshDayMarkers",this.refreshMarkers),this.parent.off("updateHeight",this.updateHeight),this.parent.off("ui-update",this.propertyChanged))};var Wa=ja;function ja(e){this.parent=e,this.nonworkingDayRender=new La(this.parent),this.eventMarkerRender=new Ba(this.parent),this.wireEvents()}za.prototype.getCriticalTasks=function(){return this.criticalTasks},za.prototype.showCriticalPath=function(e){var a=this.parent.ids,n=this.parent.flatData;if(e&&0<this.parent.flatData.length){this.parent.enableCriticalPath=!0;var t,i=this.parent.treeGrid.parentData,r=i[0].ganttProperties.endDate,s=0,o=[],l=[],d=[],h=0,p=[],u=[],c=[],g=[],f=[];this.criticalTasks=[],i[0].ganttProperties.autoEndDate>i[0].ganttProperties.endDate&&!i[0].ganttProperties.isAutoSchedule&&(r=i[0].ganttProperties.autoEndDate);for(var m=1;m<i.length;m++)i[m].ganttProperties.endDate>=r&&(r=i[m].ganttProperties.endDate),i[m].ganttProperties.isAutoSchedule||i[m].ganttProperties.autoEndDate>=r&&(r=i[m].ganttProperties.autoEndDate);this.maxEndDate=r;for(var y=0;y<n.length;y++)n[y].isCritical=!1,n[y].ganttProperties.isCritical=!1,s=this.parent.dataOperation.getDuration(n[y].ganttProperties.endDate,r,n[y].ganttProperties.durationUnit,n[y].ganttProperties.isAutoSchedule,n[y].ganttProperties.isMilestone),n[y].slack=s+" "+n[y].ganttProperties.durationUnit,n[y].ganttProperties.slack=s+" "+n[y].ganttProperties.durationUnit,n[y].ganttProperties.endDate>=r&&o.push(n[y].ganttProperties.taskId),n[y].ganttProperties.predecessor&&0!==n[y].ganttProperties.predecessor.length&&(l.push(n[y]),d.push(n[y].ganttProperties.taskId));if("ResourceView"===this.parent.viewType)for(m=0;m<this.parent.taskIds.length;m++)this.resourceCollectionIds[m]=this.parent.taskIds[m].slice(1);for(var D=this,k=0;k<o.length;k++)!function(t){if(-1===d.indexOf(o[t])){if("ProjectView"===D.parent.viewType)h=a.indexOf(o[t].toString());else for(var e=D.parent.currentViewData.filter(function(e){return parseInt(e.ganttProperties.taskId,10)===o[t]}),i=0;i<e.length;i++)!e[i].hasChildRecords&&e[i].ganttProperties.endDate>=D.maxEndDate&&(h=e[i].index);n[h].ganttProperties.progress<100&&(n[h].isCritical=!0,n[h].ganttProperties.isCritical=!0),n[h].slack="0 "+n[h].ganttProperties.durationUnit,p.push(o[t])}else u.push(o[t])}(k);for(var b=l.length,w=[],T=0;T<b;T++){for(var v=-1,S=-1,P=-1,C=-1,R=T,M=l[T].ganttProperties.predecessor,L=l[T].ganttProperties.predecessor.length,O=l[T].ganttProperties.taskId,x=0;x<L;x++)(isNaN(Number(M[x].from))||"string"==typeof O?(isNaN(Number(M[x].from)),M[x].from):parseInt(M[x].from,10))===O&&(P=-1===v?(v=M[x].offset?M[x].to+":"+M[x].offset+M[x].offsetUnit:M[x].to,M[x].type):(v=M[x].offset?v+","+M[x].to+":"+M[x].offset+M[x].offsetUnit:v+","+M[x].to,P+","+M[x].type)),(isNaN(Number(M[x].to))||"string"==typeof O?(isNaN(Number(M[x].to)),M[x].to):parseInt(M[x].to,10))===O&&(C=-1===S?(S=M[x].offset?M[x].from+":"+M[x].offset+M[x].offsetUnit:M[x].from,M[x].type):(S=M[x].offset?S+","+M[x].from+":"+M[x].offset+M[x].offsetUnit:S+","+M[x].from,C+","+M[x].type));-1===S&&(C=S=null),-1===v&&(P=v=null),c.push({from:S,fromPredecessor:C,taskid:O,to:v,toPredecessor:P,currentIndex:R,slack:null,enddate:null}),g.push(O)}for(var I,V=c.length,E=0,F=void 0,U=0;U<V;U++)c[U].to||(F=c[U].taskid,E=("ProjectView"===this.parent.viewType?a:this.resourceCollectionIds).indexOf(F.toString()),I=n[E].ganttProperties,s=this.parent.dataOperation.getDuration(I.endDate,r,"minute",I.isAutoSchedule,I.isMilestone),c[U].slack=s,c[U].fs=-1,c[U].enddate=I.endDate,w.push({fromdata:c[U].from,todateID:c[U].taskid,fromDataPredecessor:c[U].fromPredecessor}));for(var B={},k=0;k<w.length;k++)f.push(w[k]),this.slackCalculation(f,c,g,r,n,a,B);t=this.finalCriticalPath(c,p,n,a,r),this.validatedids=[],this.criticalPathCollection=t,this.detailPredecessorCollection=c,this.predecessorCollectionTaskIds=g}if(!1===e&&0<this.parent.flatData.length){var N;this.parent.enableCriticalPath=!1;for(U=0;U<this.criticalPathCollection.length;U++)N=a.indexOf(this.criticalPathCollection[U].toString()),n[N].isCritical=!1;this.criticalPathCollection=[],this.detailPredecessorCollection=[],this.predecessorCollectionTaskIds=[]}},za.prototype.slackCalculation=function(e,t,i,a,n,r,s){for(var o,l,d,h,p,u,c,g=e[0].fromdata.split(","),f=e[0].fromDataPredecessor.split(","),m=(i=(i=i.toString()).split(","),[]),y=0;y<g.length;y++){if(m=g[y].split(":"),o=i.indexOf(m[0].toString()),d=i.indexOf(e[0].todateID.toString()),-1!==o){var D=o.toString(),k=JSON.stringify(t[o]);if(Object.prototype.hasOwnProperty.call(s,D)&&s[D]===k)return;s[D]=k}var D=("ProjectView"===this.parent.viewType?(l=r.indexOf(m[0].toString()),r):(l=this.resourceCollectionIds.indexOf(m[0].toString()),this.resourceCollectionIds)).indexOf(e[0].todateID.toString()),k=void 0,b=(-1!==l&&(k=n[l].ganttProperties),n[D].ganttProperties);1<m.length&&(u=-1!==m[1].indexOf("hour")?60*parseFloat(m[1]):-1!==m[1].indexOf("day")?parseFloat(m[1])*(this.parent.secondsPerDay/3600)*60:parseFloat(m[1])),k&&-1!==o&&("FS"===f[y]&&(h=k.endDate>b.startDate?-this.parent.dataOperation.getDuration(b.startDate,k.endDate,"minute",k.isAutoSchedule,k.isMilestone):this.parent.dataOperation.getDuration(k.endDate,b.startDate,"minute",k.isAutoSchedule,k.isMilestone),ne.isNullOrUndefined(t[o].slack)?m.length<=1&&(t[d].slack+h<=0?t[o].slack=0:t[o].slack=t[d].slack+h):t[o].slack>h&&0!==t[o].slack&&m.length<=1&&(t[d].slack+h<=0?t[o].slack=0:t[o].slack=t[d].slack+h),1<m.length&&(t[o].slack=t[d].slack+h,t[o].slack=t[o].slack-u,t[o].slack<=0)&&(t[o].slack=0),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=k.startDate,k.endDate>=a)&&(t[o].slack=0),"SS"===f[y]&&(k.isAutoSchedule?(h=k.startDate>b.startDate?-this.parent.dataOperation.getDuration(b.endDate,k.startDate,"minute",k.isAutoSchedule,k.isMilestone):this.parent.dataOperation.getDuration(k.startDate,b.startDate,"minute",k.isAutoSchedule,k.isMilestone),ne.isNullOrUndefined(t[o].slack)?m.length<=1&&(t[d].slack+h<=0?t[o].slack=0:t[o].slack=t[d].slack+h):t[o].slack>h&&0!==t[o].slack&&m.length<=1&&(t[d].slack+h<=0?t[o].slack=0:t[o].slack=t[d].slack+h),1<m.length&&(t[o].slack=t[d].slack+h,t[o].slack=t[o].slack-u,t[o].slack<=0)&&(t[o].slack=0),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=k.startDate):!k.isAutoSchedule&&(h=this.getSlackDuration(k.endDate,a,"minute",n[l]),ne.isNullOrUndefined(t[o].slack)||t[o].slack>h&&0!==t[o].slack)&&(t[o].slack=h),k.endDate>=a)&&k.endDate<=a&&(t[o].slack=0),"FF"===f[y]&&(1!==t[d].fs&&1!==t[d].ff&&-1!==t[d].fs||(1!==t[d].fs&&1!==t[d].ff||(p=b.endDate,c=t[d].slack),-1===t[d].fs&&(p=t[d].enddate,c=t[d].slack),h=p>k.endDate?-this.getSlackDuration(k.endDate,p,"minute",n[l]):this.getSlackDuration(p,k.endDate,"minute",n[l]),ne.isNullOrUndefined(t[o].slack)?m.length<=1&&(t[o].slack=c-h<0?0:c-h):t[o].slack>h&&0!==t[o].slack&&m.length<=1&&(t[o].slack=c-h<0?0:c-h),1<m.length&&(t[o].slack=t[d].slack-h,t[o].slack=t[o].slack-u,t[o].slack<=0)&&(t[o].slack=0),t[o].ff=1,t[o].enddate=p,t[o].fsslack=c),k.endDate>=a)&&k.endDate<=a&&(t[o].slack=0),"SF"===f[y]&&(k.isAutoSchedule?(ne.isNullOrUndefined(t[o].slack)?m.length<=1?ne.isNullOrUndefined(t[d].to)?(h=this.getSlackDuration(k.endDate,a,"minute",n[l]),t[o].slack=h):ne.isNullOrUndefined(t[d].to)||(h=b.endDate>k.startDate?-this.parent.dataOperation.getDuration(k.startDate,b.endDate,"minute",k.isAutoSchedule,k.isMilestone):this.getSlackDuration(b.endDate,k.startDate,"minute",n[l]),t[d].slack+h<=0?t[o].slack=0:t[o].slack=t[d].slack+h):1<m.length&&(h=b.endDate>=k.endDate?k.startDate>b.endDate?-this.getSlackDuration(b.endDate,k.startDate,"minute",n[l]):this.parent.dataOperation.getDuration(k.startDate,b.endDate,"minute",k.isAutoSchedule,k.isMilestone):this.getSlackDuration(k.endDate,a,"minute",n[l]),t[o].slack=t[d].slack+h,t[o].slack=t[o].slack-u,t[o].slack<=0)&&(t[o].slack=0):m.length<=1?(ne.isNullOrUndefined(t[d].to)?h=this.getSlackDuration(k.endDate,a,"minute",n[l]):ne.isNullOrUndefined(t[d].to)||(h=b.endDate>k.startDate?-this.parent.dataOperation.getDuration(k.startDate,b.endDate,"minute",k.isAutoSchedule,k.isMilestone):this.getSlackDuration(b.endDate,k.startDate,"minute",n[l])),t[o].slack>h&&0!==t[o].slack&&(ne.isNullOrUndefined(t[d].to)?t[o].slack=h:ne.isNullOrUndefined(t[d].to)||(t[d].slack+h<=0?t[o].slack=0:t[o].slack=t[d].slack+h))):1<m.length&&(h=b.endDate>k.endDate?k.startDate>b.endDate?-this.getSlackDuration(b.endDate,k.startDate,"minute",n[l]):this.parent.dataOperation.getDuration(k.startDate,b.endDate,"minute",k.isAutoSchedule,k.isMilestone):this.getSlackDuration(k.endDate,a,"minute",n[l]),t[o].slack>h)&&0!==t[o].slack&&(t[o].slack=t[d].slack+h,t[o].slack=t[o].slack-u,t[o].slack<=0)&&(t[o].slack=0),t[o].fs=1,t[o].fsslack=t[o].slack,t[o].enddate=k.startDate):!k.isAutoSchedule&&(h=this.getSlackDuration(k.endDate,a,"minute",n[l]),ne.isNullOrUndefined(t[o].slack)||t[o].slack>h&&0!==t[o].slack)&&(t[o].slack=h),k.endDate>=a)&&k.endDate<=a&&(t[o].slack=0),t[o].from)&&((b=[]).push({fromdata:t[o].from,todateID:t[o].taskid,fromDataPredecessor:t[o].fromPredecessor}),this.slackCalculation(b,t,i,a,n,r,s))}},za.prototype.getSlackDuration=function(e,t,i,a){e=this.parent.dateValidationModule.checkStartDate(new Date(e)),t=this.parent.dateValidationModule.checkEndDate(new Date(t));return this.parent.dataOperation.getTimeDifference(e,t,!0)<=0?0:this.parent.dataOperation.getDuration(e,t,i,a.ganttProperties.isAutoSchedule,!0)},za.prototype.updateCriticalTasks=function(e,t){for(var i=0;i<e.ganttProperties.predecessor.length;i++){var a=void 0,n=(a="ProjectView"===this.parent.viewType?this.parent.getRecordByID(e.ganttProperties.predecessor[i].from):(n=this.resourceCollectionIds.indexOf(e.ganttProperties.predecessor[i].from.toString()),this.parent.flatData[n]),void 0);e.ganttProperties.endDate&&e.ganttProperties.endDate.getTime()>=this.maxEndDate.getTime()&&(e.ganttProperties.slack=e.slack="0 "+e.ganttProperties.durationUnit,e.ganttProperties.progress<100)&&(e.isCritical=!0,e.ganttProperties.isCritical=!0,-1===t.indexOf(e.ganttProperties.taskId))&&t.push(e.ganttProperties.taskId),a&&("FS"===e.ganttProperties.predecessor[i].type?n=this.parent.dataOperation.getDuration(a.ganttProperties.endDate,e.ganttProperties.startDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0):"SS"===e.ganttProperties.predecessor[i].type?n=this.parent.dataOperation.getDuration(a.ganttProperties.startDate,e.ganttProperties.startDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0):"FF"===e.ganttProperties.predecessor[i].type?n=this.parent.dataOperation.getDuration(a.ganttProperties.endDate,e.ganttProperties.endDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0):"SF"===e.ganttProperties.predecessor[i].type&&(n=this.parent.dataOperation.getDuration(e.ganttProperties.endDate,a.ganttProperties.startDate,a.ganttProperties.durationUnit,a.ganttProperties.isAutoSchedule,!0)),0<=n)&&-1===this.validatedids.indexOf(parseInt(a.ganttProperties.taskId,10))&&a.ganttProperties.taskId!==e.ganttProperties.taskId&&(a.ganttProperties.slack=e.ganttProperties.slack,a.slack=e.slack,a.isCritical=e.ganttProperties.isCritical,a.ganttProperties.isCritical=e.ganttProperties.isCritical,-1===t.indexOf(a.ganttProperties.taskId)&&a.ganttProperties.isCritical&&a.ganttProperties.progress<100&&(t.push(a.ganttProperties.taskId),this.validatedids.push(parseInt(a.ganttProperties.taskId,10)),-1===this.criticalTasks.indexOf(a))&&this.criticalTasks.push(a),a.ganttProperties.predecessorsName)&&this.updateCriticalTasks(a,t)}},za.prototype.finalCriticalPath=function(e,t,i,a,n){for(var r=[],s=e.length-1;0<=s;s--){var o,l=i[o=("ProjectView"===this.parent.viewType?a:this.resourceCollectionIds).indexOf(e[s].taskid.toString())].ganttProperties.predecessor,d="0 "+i[o].ganttProperties.durationUnit;if(l&&0<l.length)for(var h=l.length-1;0<=h;h--){var p=void 0,p=("ProjectView"===this.parent.viewType?this.parent.ids:this.resourceCollectionIds).indexOf(l[h].to),u=void 0,c=i[o].ganttProperties;-1!==p&&("FS"===l[h].type?l[h].to!==c.taskId.toString()&&(l[h].to!==c.taskId.toString()||"ResourceView"===this.parent.viewType?u=this.parent.dataOperation.getDuration(c.endDate,i[p].ganttProperties.startDate,c.durationUnit,c.isAutoSchedule,c.isMilestone):-1!==(p=this.parent.ids.indexOf(l[h].from))&&0===(u=this.parent.dataOperation.getDuration(i[p].ganttProperties.endDate,c.startDate,c.durationUnit,c.isAutoSchedule,c.isMilestone))&&o!==p&&i[o].slack===d&&(i[p].slack=i[o].slack,i[p].ganttProperties.slack=i[o].slack),-1!==p)&&(0===u&&o!==p&&i[o].slack!==d?(i[o].slack=i[p].slack,i[o].ganttProperties.slack=i[p].slack):0!==u&&o!==p&&i[p].isCritical&&(i[o].slack=u+" "+i[o].ganttProperties.durationUnit,i[o].ganttProperties.slack=u+" "+i[o].ganttProperties.durationUnit)):u="SF"===l[h].type?this.parent.dataOperation.getDuration(c.startDate,i[p].ganttProperties.endDate,c.durationUnit,c.isAutoSchedule,c.isMilestone):"SS"===l[h].type?this.parent.dataOperation.getDuration(c.startDate,i[p].ganttProperties.startDate,c.durationUnit,c.isAutoSchedule,c.isMilestone):this.parent.dataOperation.getDuration(c.endDate,i[p].ganttProperties.endDate,c.durationUnit,c.isAutoSchedule,c.isMilestone),("number"==typeof i[o][this.parent.taskFields.id]?parseInt(l[h].from,10):l[h].from)===i[o][this.parent.taskFields.id])&&i[p].slack===d&&u<=0&&(i[o].slack=d,i[o].ganttProperties.slack=d)}i[o].slack===d&&i[o].ganttProperties.progress<100&&(i[o].isCritical=!0,i[o].ganttProperties.isCritical=!0,-1===this.criticalTasks.indexOf(i[o])&&this.criticalTasks.push(i[o]),-1===r.indexOf(e[s].taskid))&&r.push(e[s].taskid),i[o].ganttProperties.predecessor&&0<i[o].ganttProperties.predecessor.length&&this.updateCriticalTasks(i[o],r)}if(0<t.length)for(h=0;h<t.length;h++)-1!==(o=("ProjectView"===this.parent.viewType?a:this.resourceCollectionIds).indexOf(t[h].toString()))&&i[o].ganttProperties.progress<100&&(this.criticalTasks.push(i[o]),-1===r.indexOf(t[h]))&&(r=r.concat(t[h]));return r},za.prototype.criticalConnectorLine=function(h,e,t,i){this.parent.removeCriticalPathStyles();for(var p=this,a=0;a<h.length;a++)!function(t){var i;if("ProjectView"===p.parent.viewType)i=p.parent.flatData[p.parent.ids.indexOf(h[t].toString())];else for(var e=p.parent.flatData.filter(function(e){return e.ganttProperties.taskId.toString()===h[t].toString()}),a=0;a<e.length;a++)(e[a].ganttProperties.isCritical||e[a].ganttProperties.endDate>=p.maxEndDate)&&(i=e[a]);var n=p.parent.currentViewData.indexOf(i),n=p.parent.getRowByIndex(n),r=void 0,s=p.parent.taskFields;if(i&&i.parentItem){var o=p.parent.currentViewData.filter(function(e){return i.parentItem.uniqueID===e.uniqueID}),o=p.parent.flatData.indexOf(o[0]),o=p.parent.getRowByIndex(o);if(o)for(var l=o.querySelectorAll(".e-taskbar-main-container"),d=0;d<l.length;d++)l[d].getAttribute("rowuniqueid")===i.rowUniqueID&&ne.addClass(l[d].querySelectorAll(".e-gantt-child-taskbar-inner-div"),ve)}r=p.parent.allowUnscheduledTasks&&i&&!i[s.startDate]&&!i[s.endDate]&&i[s.duration]?"e-gantt-critical-unscheduled-taskbar":Se,n&&("ProjectView"===p.parent.viewType||"ResourceView"===p.parent.viewType&&!i.hasChildRecords)&&(n.getElementsByClassName("e-gantt-milestone")[0]&&ne.addClass(n.querySelectorAll(".e-gantt-milestone"),Pe),0<n.getElementsByClassName("e-gantt-child-taskbar-inner-div").length&&ne.addClass(n.querySelectorAll(".e-gantt-child-taskbar-inner-div"),ve),0<n.getElementsByClassName("e-gantt-child-progressbar-inner-div").length)&&ne.addClass(n.querySelectorAll(".e-gantt-child-progressbar-inner-div"),r)}(a);if(0!==e.length)for(var n,r=void 0,s=[],o=void 0,l=void 0,a=0;a<this.criticalPathCollection.length;a++)if(r=e[n=i.indexOf(this.criticalPathCollection[a])],-1!==n&&r.to)for(var s=r.to.split(","),d=0;d<s.length;d++){var u,c,l=s[d].split("+"),o=(l=0<=s[d].indexOf("-")?s[d].split("-"):l)[0].replace(":","");"number"==typeof h[d]&&(o=parseInt(l[0],10)),-1!==h.indexOf(o)&&(u=String(r.taskid),c=String(o),0<this.parent.element.querySelectorAll("#ConnectorLineparent"+u.replace(/([.])/g,"\\$1")+"child"+c.replace(/([.])/g,"\\$1")).length)&&(ne.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+u.replace(/([.])/g,"\\$1")+"child"+c.replace(/([.])/g,"\\$1"))[0].querySelectorAll(".e-connector-line"),at),ne.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+u.replace(/([.])/g,"\\$1")+"child"+c.replace(/([.])/g,"\\$1"))[0].querySelectorAll(".e-connector-line-arrow"),nt))}},za.prototype.getModuleName=function(){return"criticalPath"},za.prototype.destroy=function(){!this.parent.enableCriticalPath&&this.parent.criticalPathModule&&(this.parent.criticalPathModule=void 0)};var Ha=za;function za(e){this.validatedids=[],this.resourceCollectionIds=[],this.criticalTasks=[],this.parent=e}var Ga=function(){return(Ga=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},qa=(_a.prototype.isInHierarchyOf=function(e,t){for(var i=e.parentItem;i;){if(i.taskId===t.ganttProperties.taskId.toString())return!0;i=i.parentItem}return!1},_a.prototype.isPartOfExistingHierarchy=function(t){return this.uniqueDeletedRecords.some(function(e){return!!this.isInHierarchyOf(t.data,e.data)||!!(e.data&&e.data.childRecords&&e.data.childRecords.some(function(e){return e.ganttProperties.taskId===t.data.ganttProperties.taskId}))}.bind(this))},_a.prototype.undoAction=function(){var i=this;if(0<this.getUndoCollection.length){var e=this.getUndoCollection[this.getUndoCollection.length-1],t={};if("ZoomIn"===e.action||"ZoomOut"===e.action||"ZoomToFit"===e.action)t.action=e.action,t.previousZoomingLevel=ne.extend({},{},this.parent.currentZoomingLevel,!0);else if("NextTimeSpan"===e.action||"PreviousTimeSpan"===e.action)t.action=e.action,t.previousTimelineStartDate=ne.extend([],[this.parent.timelineModule.timelineStartDate],[],!0)[0],t.previousTimelineEndDate=ne.extend([],[this.parent.timelineModule.timelineEndDate],[],!0)[0];else if("Sorting"===e.action)t.action="Sorting",t.sortColumns=this.previousSortedColumns;else if("Filtering"===e.action)t.action="Filtering",t.filteredColumns=e.filteredColumns;else if("ColumnReorder"===e.action)t.action=e.action,t.toColumn=e.fromColumn,t.fromColumn=e.toColumn,t.fromIndex=e.toIndex,t.toIndex=e.fromIndex;else if("Search"===e.action)t.action=e.action,t.searchString=this.searchString;else if("ColumnState"===e.action)t.action=e.action,t.showhideColumns=e.showhideColumns;else if("ColumnResize"===e.action)t.action=e.action,t.resizedColumn=Ga({},this.parent.treeGrid.columns[e.resizedColumn.index]);else if("RowDragAndDrop"===e.action||"TaskbarDragAndDrop"===e.action){for(var a=[],n=0;n<e.beforeDrop.length;n++)"ProjectView"===this.parent.viewType?a.push(this.parent.getRecordByID(e.beforeDrop[n].data.ganttProperties.taskId)):a.push(this.parent.flatData[this.getResourceViewRowIndex(e.beforeDrop[n].data)]);t.action=e.action,t.beforeDrop=[];var r={},s=ne.extend([],[],[this.parent.getRecordByID(e.afterDrop.dropRecord.ganttProperties.taskId)],!0)[0];r.data=[];for(n=0;n<e.afterDrop.data.length;n++)"ProjectView"===this.parent.viewType?r.data.push(ne.extend([],[],[this.parent.getRecordByID(e.afterDrop.data[n].ganttProperties.taskId)],!0)[0]):r.data.push(ne.extend([],[],[this.parent.flatData[this.getResourceViewRowIndex(e.afterDrop.data[n])]],!0)[0]);r.dropRecord=ne.extend([],[],[s],!0)[0],r.dropPosition=e.afterDrop.dropPosition,t.afterDrop=r,this.findPosition(a,t,"beforeDrop")}else if("Indent"===e.action||"Outdent"===e.action)t.selectedRowIndexes=e.selectedRowIndexes,t.droppedRecord=ne.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(e.droppedRecord.ganttProperties.taskId.toString())]],!0)[0],t.modifiedRecord=[],this.findPosition(ne.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(e.modifiedRecord[0].data.ganttProperties.taskId.toString())]],!0),t,"modifiedRecord"),t.action=e.action;else if("Delete"===e.action){t.action="Delete",t.deleteRecords=[];for(n=0;n<e.deletedRecordsDetails.length;n++){var o=e.deletedRecordsDetails[n];this.isPartOfExistingHierarchy(o)||this.uniqueDeletedRecords.push(o)}e.deletedRecordsDetails=this.uniqueDeletedRecords,t.deleteRecords=this.uniqueDeletedRecords.map(function(e){return e.data}),this.uniqueDeletedRecords=[]}else if("Add"===e.action){t.action="Add",t.deletedRecordsDetails=[];a=e.addedRecords;this.findPosition(a,t,"deletedRecordsDetails")}else{t.action=e.action,t.modifiedRecords=[];for(n=0;n<e.modifiedRecords.length;n++){var l=void 0,l="ProjectView"===this.parent.viewType?this.findTaskRowIndex(e.modifiedRecords[n].ganttProperties.taskId.toString()):this.parent.undoRedoModule.getResourceViewRowIndex(e.modifiedRecords[n]);t.modifiedRecords.push(ne.extend([],[this.parent.flatData[l]],[],!0)[0])}}if(this.getRedoCollection.push(t),this.isUndoRedoPerformed=!0,this.changedRecords=[],"ZoomIn"===(this.currentAction=e).action||"ZoomOut"===e.action||"ZoomToFit"===e.action)this.parent.timelineSettings.timelineViewMode=e.previousZoomingLevel.timelineViewMode,this.parent.timelineSettings.timelineUnitSize=e.previousZoomingLevel.timelineUnitSize,this.parent.timelineSettings.updateTimescaleView=e.previousZoomingLevel.updateTimescaleView,this.parent.timelineSettings.topTier.unit=e.previousZoomingLevel.topTier.unit,this.parent.timelineSettings.topTier.count=e.previousZoomingLevel.topTier.count,this.parent.timelineSettings.topTier.format=e.previousZoomingLevel.topTier.format,this.parent.timelineSettings.bottomTier.unit=e.previousZoomingLevel.bottomTier.unit,this.parent.timelineSettings.bottomTier.count=e.previousZoomingLevel.bottomTier.count,this.parent.timelineSettings.bottomTier.format=e.previousZoomingLevel.bottomTier.format,this.parent.timelineSettings.weekStartDay=e.previousZoomingLevel.weekStartDay,this.parent.timelineSettings.weekendBackground=e.previousZoomingLevel.weekendBackground,this.isZoomingUndoRedoProgress=!0,"ZoomToFit"===e.action&&this.parent.timelineModule.refreshTimeline(),this.isUndoRedoPerformed=!1;else if("NextTimeSpan"===e.action||"PreviousTimeSpan"===e.action)this.parent.updateProjectDates(e.previousTimelineStartDate,e.previousTimelineEndDate,!1),this.isUndoRedoPerformed=!1;else if("Sorting"===e.action)if(this.isFromUndoRedo=!0,(this.sortedColumnsLength=0)<e.sortColumns.length)for(n=0;n<e.sortColumns.length;n++)this.parent.treeGrid.sortByColumn(e.sortColumns[n].field,e.sortColumns[n].direction,0<n);else this.parent.clearSorting();else if("Filtering"===e.action){this.isFromUndoRedo=!0;for(n=this.getUndoCollection.length-1;0<=n;n--)if(this.getUndoCollection[n].filteredColumns){for(var d=[],h=0;h<this.getUndoCollection[n].filteredColumns.length;h++)d.push(this.getUndoCollection[n].filteredColumns[h].field);this.parent.clearFiltering(d)}}else if("ColumnReorder"===e.action){this.isFromUndoRedo=!0;var s=this.parent.treeGrid.columns[e.fromIndex].field,p=this.parent.treeGrid.columns[e.toIndex].field;this.parent.reorderColumns(s,p)}else if("Search"===e.action)this.isFromUndoRedo=!0,this.parent.search(e.searchString);else if("ColumnState"===e.action){this.isFromUndoRedo=!0;for(n=0;n<e.showhideColumns.length;n++)e.showhideColumns[n].visible?this.parent.hideColumn(e.showhideColumns[n].field,"field"):this.parent.showColumn(e.showhideColumns[n].field,"field");this.isUndoRedoPerformed=!1}else if("ColumnResize"===e.action)this.parent.treeGrid.columns[e.resizedColumn.index].width=e.resizedColumn.width,this.parent.treeGrid.refreshColumns();else if("RowDragAndDrop"===e.action||"TaskbarDragAndDrop"===e.action)for(n=0;n<e.beforeDrop.length;n++){var u=this.findTaskRowIndex(e.beforeDrop[n].data.ganttProperties.taskId.toString()),c=this.findTaskRowIndex(e.beforeDrop[n].id.toString());this.parent.reorderRows([u],c,e.beforeDrop[n].position)}else if("Indent"===e.action||"Outdent"===e.action)this.parent.selectRow(this.findTaskRowIndex(e.modifiedRecord[0].data.ganttProperties.taskId.toString())),"Indent"===e.action?this.parent.outdent():this.parent.indent();else if("Delete"===e.action)for(n=0;n<e.deletedRecordsDetails.length;n++){var g,f=this.findTaskRowIndex(e.deletedRecordsDetails[n].id.toString()),m=void 0;"above"===e.deletedRecordsDetails[n].position&&(m="Above"),"below"===e.deletedRecordsDetails[n].position&&(m="Below"),"child"===e.deletedRecordsDetails[n].position&&(m="Child"),ne.isNullOrUndefined(m)&&(m=(g=e.deletedRecordsDetails[n].position).charAt(0).toUpperCase()+g.slice(1)),e.deletedRecordsDetails[n].data.ganttProperties.predecessor&&0<e.deletedRecordsDetails[n].data.ganttProperties.predecessor.length&&e.deletedRecordsDetails[n].data.ganttProperties.predecessor.forEach(function(e){var t=i.parent.connectorLineModule.getRecordByID(e.to);t&&(t.ganttProperties.predecessor.push(e),e=i.parent.predecessorModule.getPredecessorStringValue(t),t.ganttProperties.predecessorsName=e)}),this.parent.addRecord(e.deletedRecordsDetails[n].data,m,f)}else if("Add"===e.action){s=ne.extend([],[this.parent.editSettings.showDeleteConfirmDialog],[],!0)[0],p=(this.parent.editSettings.showDeleteConfirmDialog=!1,e.addedRecords);"ResourceView"===this.parent.viewType&&1===e.addedRecords.length&&e.addedRecords[0].parentItem&&1===(y=this.parent.getTaskByUniqueID(e.addedRecords[0].parentItem.uniqueID)).childRecords.length&&"Unassigned Task"===y.ganttProperties.taskName&&(p=y),this.parent.deleteRecord(p),this.parent.enableVirtualization&&this.parent.treeGrid.virtualScrollModule&&!ne.isNullOrUndefined(this.parent.treeGrid.virtualScrollModule.ganttEndIndex)&&(this.parent.treeGrid.virtualScrollModule.ganttEndIndex=this.parent.flatData.length),this.parent.editSettings.showDeleteConfirmDialog=s}else{if(this.parent.updateRecordByID(this.getUndoCollection[this.getUndoCollection.length-1].modifiedRecords[0]),e.connectedRecords&&"ProjectView"===this.parent.viewType)for(n=0;n<e.connectedRecords.length;n++)this.parent.updateRecordByID(e.connectedRecords[n]);this.isUndoRedoPerformed=!1}var y={};(y=ne.extend([],[],[this.getUndoCollection[this.getUndoCollection.length-1]],!0)[0]).requestType="afterUndoAction",this.parent.trigger("onAfterUndo",y),"RowDragAndDrop"!==e.action&&"TaskbarDragAndDrop"!==e.action&&"Indent"!==e.action&&"Outdent"!==e.action||(this.undoActionDetails=this.getUndoCollection[this.getUndoCollection.length-1]),0<this.getRedoCollection.length&&(this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!0),this.redoEnabled=!0)}this.getUndoCollection.splice(this.getUndoCollection.length-1,1),0===this.getUndoCollection.length&&this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!1)},_a.prototype.redoAction=function(){if(0<this.getRedoCollection.length){var e=this.getRedoCollection[this.getRedoCollection.length-1],t={};if("ZoomIn"===e.action||"ZoomOut"===e.action||"ZoomToFit"===e.action)t.action=e.action,t.previousZoomingLevel=ne.extend({},{},this.parent.currentZoomingLevel,!0),t.previousZoomingLevel.bottomTier.format=this.parent.timelineModule.customTimelineSettings.bottomTier.format,t.previousZoomingLevel.topTier.format=this.parent.timelineModule.customTimelineSettings.topTier.format;else if("NextTimeSpan"===e.action||"PreviousTimeSpan"===e.action)t.action=e.action,t.previousTimelineStartDate=ne.extend([],[this.parent.timelineModule.timelineStartDate],[],!0)[0],t.previousTimelineEndDate=ne.extend([],[this.parent.timelineModule.timelineEndDate],[],!0)[0];else if("Sorting"===e.action)t.action="Sorting",t.sortColumns=ne.extend([],this.parent.sortSettings.columns,[],!0);else if("Filtering"===e.action)t.action="Filtering",t.filteredColumns=e.filteredColumns;else if("ColumnReorder"===e.action)t.action=e.action,t.toColumn=e.fromColumn,t.fromColumn=e.toColumn,t.fromIndex=e.toIndex,t.toIndex=e.fromIndex;else if("Search"===e.action)t.action=e.action,t.searchString=ne.extend([],[this.parent.searchSettings.key],[],!0)[0];else if("ColumnState"===e.action)t.action=e.action,t.showhideColumns=e.showhideColumns;else if("ColumnResize"===e.action)t.action=e.action,t.resizedColumn=Ga({},this.parent.treeGrid.columns[e.resizedColumn.index]);else if("RowDragAndDrop"===e.action||"TaskbarDragAndDrop"===e.action){for(var i=[],a=0;a<e.beforeDrop.length;a++)"ProjectView"===this.parent.viewType?i.push(this.parent.getRecordByID(e.beforeDrop[a].data.ganttProperties.taskId)):i.push(this.parent.flatData[this.getResourceViewRowIndex(e.beforeDrop[a].data)]);t.action=e.action,t.beforeDrop=[];var n={},r=void 0;e.afterDrop.dropRecord&&(r=ne.extend([],[],[this.parent.getRecordByID(e.afterDrop.dropRecord.ganttProperties.taskId)],!0)[0]),n.data=[];for(a=0;a<e.afterDrop.data.length;a++)"ProjectView"===this.parent.viewType?n.data.push(ne.extend([],[],[this.parent.getRecordByID(e.afterDrop.data[a].ganttProperties.taskId)],!0)[0]):void 0!==e.afterDrop.data[a]&&n.data.push(ne.extend([],[],[this.parent.flatData[this.getResourceViewRowIndex(e.afterDrop.data[a])]],!0)[0]);n.dropRecord=ne.extend([],[],[r],!0)[0],n.dropPosition=e.afterDrop.dropPosition,t.afterDrop=n,this.findPosition(i,t,"beforeDrop")}else if("Indent"===e.action||"Outdent"===e.action)t.selectedRowIndexes=e.selectedRowIndexes,t.droppedRecord=ne.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(e.droppedRecord.ganttProperties.taskId.toString())]],!0)[0],t.modifiedRecord=[],this.findPosition(ne.extend([],[],[this.parent.flatData[this.parent.ids.indexOf(e.modifiedRecord[0].data.ganttProperties.taskId.toString())]],!0),t,"modifiedRecord"),t.action=e.action;else if("Delete"===e.action)t.action="Delete",t.deletedRecordsDetails=[],this.findPosition(ne.extend([],[],e.deleteRecords,!0),t,"deletedRecordsDetails");else if("Add"===e.action)t.action="Add",t.addedRecords=[e.deletedRecordsDetails[0].data];else{t.action=e.action,t.modifiedRecords=[];for(a=0;a<e.modifiedRecords.length;a++){var s=this.findTaskRowIndex(e.modifiedRecords[a].ganttProperties.taskId.toString());t.modifiedRecords.push(ne.extend([],[this.parent.flatData[s]],[],!0)[0])}}if(this.getUndoCollection.push(t),this.isUndoRedoPerformed=!0,"ZoomIn"===(this.currentAction=e).action||"ZoomOut"===e.action||"ZoomToFit"===e.action)"ZoomToFit"===e.action?this.parent.fitToProject():(this.parent.timelineSettings.timelineViewMode=e.previousZoomingLevel.timelineViewMode,this.parent.timelineSettings.timelineUnitSize=e.previousZoomingLevel.timelineUnitSize,this.parent.timelineSettings.updateTimescaleView=e.previousZoomingLevel.updateTimescaleView,this.parent.timelineSettings.topTier.unit=e.previousZoomingLevel.topTier.unit,this.parent.timelineSettings.topTier.count=e.previousZoomingLevel.topTier.count,this.parent.timelineSettings.topTier.format=e.previousZoomingLevel.topTier.format,this.parent.timelineSettings.bottomTier.unit=e.previousZoomingLevel.bottomTier.unit,this.parent.timelineSettings.bottomTier.count=e.previousZoomingLevel.bottomTier.count,this.parent.timelineSettings.bottomTier.format=e.previousZoomingLevel.bottomTier.format,this.parent.timelineSettings.weekStartDay=e.previousZoomingLevel.weekStartDay,this.parent.timelineSettings.weekendBackground=e.previousZoomingLevel.weekendBackground,this.isZoomingUndoRedoProgress=!0),this.isUndoRedoPerformed=!1;else if("NextTimeSpan"===e.action||"PreviousTimeSpan"===e.action)this.parent.updateProjectDates(e.previousTimelineStartDate,e.previousTimelineEndDate,!1),this.isUndoRedoPerformed=!1;else if("Sorting"===e.action)if(this.isFromUndoRedo=!0,(this.sortedColumnsLength=0)===e.sortColumns.length)this.parent.clearSorting();else for(a=0;a<e.sortColumns.length;a++)this.parent.treeGrid.sortByColumn(e.sortColumns[a].field,e.sortColumns[a].direction,1<e.sortColumns.length);else if("ColumnState"===e.action){this.isFromUndoRedo=!0;for(a=0;a<e.showhideColumns.length;a++)e.showhideColumns[a].visible?this.parent.hideColumn(e.showhideColumns[a].field,"field"):this.parent.showColumn(e.showhideColumns[a].field,"field");this.isUndoRedoPerformed=!1}else if("Filtering"===e.action)for(var o=0;o<e.filteredColumns.length;o++)this.isFromUndoRedo=!0,this.parent.filterByColumn(e.filteredColumns[o].field,e.filteredColumns[o].operator,e.filteredColumns[o].value,e.filteredColumns[o].predicate,e.filteredColumns[o].matchCase,e.filteredColumns[o].ignoreAccent);else if("ColumnReorder"===e.action){this.isFromUndoRedo=!0;var r=this.parent.treeGrid.columns[e.fromIndex].field,l=this.parent.treeGrid.columns[e.toIndex].field;this.parent.reorderColumns(r,l)}else if("Search"===e.action)this.isFromUndoRedo=!0,this.parent.search(e.searchString);else if("ColumnResize"===e.action)this.parent.treeGrid.columns[e.resizedColumn.index].width=e.resizedColumn.width,this.parent.treeGrid.refreshColumns();else if("RowDragAndDrop"===e.action||"TaskbarDragAndDrop"===e.action)for(a=0;a<e.beforeDrop.length;a++){var d=this.findTaskRowIndex(e.beforeDrop[a].data.ganttProperties.taskId.toString()),h=this.findTaskRowIndex(e.beforeDrop[a].id.toString());this.parent.reorderRows([d],h,e.beforeDrop[a].position)}else if("Indent"===e.action||"Outdent"===e.action)this.parent.selectRow(e.selectedRowIndexes[0]),"Indent"===e.action&&this.parent.indent(),"Outdent"===e.action&&this.parent.outdent();else if("Delete"===e.action){r=ne.extend([],[this.parent.editSettings.showDeleteConfirmDialog],[],!0)[0];this.parent.editSettings.showDeleteConfirmDialog=!1,this.parent.deleteRecord(e.deleteRecords),this.parent.editSettings.showDeleteConfirmDialog=r}else if("Add"===e.action)if("ResourceView"===this.parent.viewType&&1<e.deletedRecordsDetails.length)this.parent.editModule.addRecord(ne.extend([],[],e.deletedRecordsDetails,!0));else for(a=0;a<e.deletedRecordsDetails.length;a++){var p=this.findTaskRowIndex(e.deletedRecordsDetails[a].id.toString()),u=void 0;"above"===e.deletedRecordsDetails[a].position&&(u="Above"),"below"===e.deletedRecordsDetails[a].position&&(u="Below"),"child"===e.deletedRecordsDetails[a].position&&(u="Child"),"bottom"===e.deletedRecordsDetails[a].position&&(u="Bottom"),this.parent.editModule.addRecord(e.deletedRecordsDetails[a].data,u,p)}else this.parent.updateRecordByID(e.modifiedRecords[0]),this.isUndoRedoPerformed=!1;0<this.getUndoCollection.length&&this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),this.getRedoCollection.splice(this.getRedoCollection.length-1,1),0===this.getRedoCollection.length&&this.parent.toolbarModule&&(this.redoEnabled=!1,this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!1))}},_a.prototype.findTaskRowIndex=function(i){var a=this;return this.parent.updatedRecords.findIndex(function(e){var t=e.ganttProperties.taskId.toString();return"ProjectView"===a.parent.viewType?t===i:(e=(0===e.level||"Unassigned Task"===e.ganttProperties.taskName?"R":"T")+t,t===i||e===i)})},_a.prototype.getResourceViewRowIndex=function(e){var t;return e?(t=0===e.level?"R":"T",this.parent.taskIds.indexOf(t+e.ganttProperties.taskId.toString())):-1},_a.prototype.createUndoCollection=function(){this.parent.totalUndoAction+1>this.parent.undoRedoStepsCount&&this.getUndoCollection.length===this.parent.totalUndoAction&&(this.getUndoCollection.splice(0,1),this.disableRedo()),this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0),0===this.getUndoCollection.length?(this.getUndoCollection[0]=[],this.parent.totalUndoAction+1<=this.parent.undoRedoStepsCount&&this.parent.totalUndoAction++):0<Object.keys(this.getUndoCollection[this.getUndoCollection.length-1]).length&&(this.getUndoCollection[this.getUndoCollection.length]=[],this.parent.totalUndoAction+1<=this.parent.undoRedoStepsCount)&&this.parent.totalUndoAction++},_a.prototype.disableRedo=function(){this.redoEnabled=!1,this.getRedoCollection=[],this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_redo"],!1)},_a.prototype.findPosition=function(k,b,w){for(var T=this,e=0;e<k.length;e++)!function(t){var i,e,a={};if(a.data=k[t],"ProjectView"===T.parent.viewType)if(!k[t].hasChildRecords&&k[t].parentItem)if(1<(f=T.parent.getRecordByID(k[t].parentItem.taskId)).childRecords.length){var n=T.parent.ids.indexOf(k[t].ganttProperties.taskId.toString());if((u=T.parent.flatData[n-1]).parentItem&&u.parentItem.taskId.toString()===f.ganttProperties.taskId.toString())a.position="below",a.id=ne.extend([],[T.parent.flatData[T.parent.ids.indexOf(k[t].ganttProperties.taskId.toString())-1].ganttProperties.taskId],[],!0)[0];else{a.position="above";var r=T.parent.flatData[T.parent.ids.indexOf(k[t].ganttProperties.taskId.toString())+1],s=T.parent.ids.indexOf(k[t].ganttProperties.taskId.toString())+1,o=t;do{}while((y=k[o+1])&&r.ganttProperties.taskId.toString()===y.ganttProperties.taskId.toString()?(o++,r=T.parent.flatData[++s]):r&&r.parentItem?a.id=ne.extend([],[r.ganttProperties.taskId],[],!0)[0]:(a.id=ne.extend([],[k[t].parentItem.taskId],[],!0)[0],a.position="child"),!a.id)}}else a.position="child",a.id=ne.extend([],[f.ganttProperties.taskId],[],!0)[0];else if(k[t].hasChildRecords||k[t].parentItem)if(k[t].hasChildRecords&&!k[t].parentItem){for(l=void 0,r=void 0,d=void 0,h=0;h<T.parent.treeGrid.parentData.length;h++)if(T.parent.treeGrid.parentData[h].ganttProperties.taskId.toString()===k[t].ganttProperties.taskId.toString()){l=h,r=T.parent.treeGrid.parentData[h+1],d=h+1;break}if(-1!==l)if(0===l){a.position="above";o=t;do{}while((y=k[o+1])&&r.ganttProperties.taskId.toString()===y.ganttProperties.taskId.toString()?(o++,r=T.parent.treeGrid.parentData[++d]):(r=r||T.parent.treeGrid.parentData[l],a.id=ne.extend([],[r.ganttProperties.taskId],[],!0)[0]),!a.id)}else a.position="below",a.id=ne.extend([],[T.parent.treeGrid.parentData[l-1].ganttProperties.taskId],[],!0)[0]}else k[t].hasChildRecords&&k[t].parentItem&&(e=(m=(f=T.parent.getRecordByID(k[t].parentItem.taskId)).childRecords).length,i=k[t].ganttProperties.taskId.toString(),1===e?(a.position="child",a.id=ne.extend([],[f.ganttProperties.taskId],[],!0)[0]):-1!==(e=m.findIndex(function(e){return e.ganttProperties.taskId.toString()===i}))&&(0===e?(a.position="above",a.id=m[1].ganttProperties.taskId):(a.position="below",a.id=m[e-1].ganttProperties.taskId)));else{T.parent.ids.indexOf(k[t].ganttProperties.taskId.toString())===T.parent.ids.length-1?a.position="below":a.position="above";for(var l=void 0,r=void 0,d=void 0,h=0;h<T.parent.treeGrid.parentData.length;h++)if(T.parent.treeGrid.parentData[h].ganttProperties.taskId.toString()===k[t].ganttProperties.taskId.toString()){l=h,r=T.parent.treeGrid.parentData[h+1],d=h+1;break}var o=t;do{}while((y=k[o+1])&&r.ganttProperties.taskId.toString()===y.ganttProperties.taskId.toString()?(o++,r=T.parent.treeGrid.parentData[++d]):(r=(r=r||T.parent.treeGrid.parentData[l-1])||T.parent.treeGrid.parentData[l],a.id=ne.extend([],[r.ganttProperties.taskId],[],!0)[0]),!a.id)}else if(k[t].parentItem){var p=void 0;if(1===(p=k[t].parentItem.index?T.parent.flatData[k[t].parentItem.index]:T.parent.flatData[T.parent.ids.indexOf(k[t].parentItem.taskId)]).childRecords.length)a.position="child",a.id="R"+p.ganttProperties.taskId,"deletedIndexes"===w&&(a.position="child",a.index=p.index);else{for(var u,c=void 0,g=0;g<p.childRecords.length;g++)if(p.childRecords[g].ganttProperties.taskId.toString()===k[t].ganttProperties.taskId.toString()){c=g;break}if((u=p.childRecords[c-1])&&u.parentItem&&u.parentUniqueID===p.uniqueID)a.position="below",a.id=ne.extend([],["T"+T.parent.flatData[T.parent.taskIds.indexOf("T"+k[t].ganttProperties.taskId.toString())-1].ganttProperties.taskId],[],!0)[0],"deletedIndexes"===w&&(a.index=T.parent.taskIds.indexOf("T"+k[t].ganttProperties.taskId.toString())-1);else{s=void 0;if(c!==p.childRecords.length-1){a.position="above",0===c&&p.childRecords[1]?s=p.childRecords[1].index:p.childRecords[c-1]&&(s=p.childRecords[c-1].index);r=T.parent.flatData[s],n=s,o=t;do{}while((y=k[o+1])&&r.ganttProperties.taskId.toString()===y.ganttProperties.taskId.toString()?(o++,r=T.parent.flatData[++n]):r&&r.parentItem?(a.id=ne.extend([],["T"+r.ganttProperties.taskId],[],!0)[0],"deletedIndexes"===w&&(a.index=ne.extend([],[r.index],[],!0)[0],0===c)&&p.childRecords[1].ganttProperties.taskId===r.ganttProperties.taskId&&(a.index=a.index-1)):(a.id=ne.extend([],["R"+k[t].parentItem.taskId],[],!0)[0],a.position="child","deletedIndexes"===w&&(a.index=k[t].parentItem.index)),!a.id)}else c===p.childRecords.length-1?a.position="below":a.position="above",a.id="T"+p.childRecords[c-1].ganttProperties.taskId,"deletedIndexes"===w&&(a.index=p.childRecords[c-1].index)}}}else{var f=T.parent.treeGrid.parentData.filter(function(e){return e.ganttProperties.taskId===k[t].ganttProperties.taskId})[0],m=T.parent.treeGrid.parentData.indexOf(f);if(0===m){a.position="above";for(r=void 0,d=void 0,h=0;h<T.parent.treeGrid.parentData.length;h++)if(T.parent.treeGrid.parentData[h].ganttProperties.taskId===k[t].ganttProperties.taskId){r=T.parent.treeGrid.parentData[h+1],d=h+1;break}var y,o=t;do{}while((y=k[o+1])&&r.ganttProperties.taskId===y.ganttProperties.taskId?(o++,r=T.parent.treeGrid.parentData[++d]):(a.id="R"+r.ganttProperties.taskId,"deletedIndexes"===w&&(a.index=r.index)),!a.id)}else a.position="below",a.id="R"+T.parent.treeGrid.parentData[m-1].ganttProperties.taskId,"deletedIndexes"===w&&(a.index=T.parent.treeGrid.parentData[m-1].index)}if("deletedIndexes"===w){var D=T.parent.getTaskByUniqueID(a.data.parentUniqueID);if(0===T.parent.editModule.dialogModule.ganttResources.length&&-1===b[w].indexOf(a))b[w].push(a);else for(g=0;g<T.parent.editModule.dialogModule.ganttResources.length;g++)T.parent.editModule.dialogModule.ganttResources[g][T.parent.resourceFields.id]!==D.ganttProperties.taskId&&-1===b[w].indexOf(a)&&b[w].push(a)}else b[w].some(function(e){return e.data.ganttProperties.taskId===a.data.ganttProperties.taskId})||b[w].push(a)}(e)},_a.prototype.getModuleName=function(){return"undoRedo"},_a.prototype.destroy=function(){!this.parent.enableUndoRedo&&this.parent.undoRedoModule&&(this.parent.undoRedoModule=void 0)},_a);function _a(e){this.isUndoRedoPerformed=!1,this.changedRecords=[],this.getRedoCollection=[],this.getUndoCollection=[],this.redoEnabled=!1,this.previousSortedColumns=[],this.searchString="",this.isFromUndoRedo=!1,this.undoActionDetails={},this.canUpdateIndex=!0,this.sortedColumnsLength=0,this.isZoomingUndoRedoProgress=!1,this.uniqueDeletedRecords=[],this.parent=e}x.prototype.addEventListener=function(){this.parent.isDestroyed||(this.parent.on("initiate-contextMenu",this.render,this),this.parent.on("reRender-contextMenu",this.reRenderContextMenu,this),this.parent.on("contextMenuClick",this.contextMenuItemClick,this),this.parent.on("contextMenuOpen",this.contextMenuBeforeOpen,this))},x.prototype.reRenderContextMenu=function(e){e.module===this.getModuleName()&&e.enable&&(this.contextMenu&&(this.contextMenu.destroy(),ne.remove(this.element)),this.resetItems(),this.render())},x.prototype.render=function(){this.element=this.parent.createElement("ul",{id:this.ganttID+"_contextmenu",className:ue}),this.parent.element.appendChild(this.element);var e="#"+this.ganttID;this.contextMenu=new V.ContextMenu({items:this.getMenuItems(),locale:this.parent.locale,enableRtl:this.parent.enableRtl,target:e,animationSettings:{effect:"None"},select:this.contextMenuItemClick.bind(this),beforeOpen:this.contextMenuBeforeOpen.bind(this),onOpen:this.contextMenuOpen.bind(this),onClose:this.contextMenuOnClose.bind(this),cssClass:"e-gantt"}),this.contextMenu.appendTo(this.element),this.parent.treeGrid.contextMenuItems=this.headerMenuItems},x.prototype.contextMenuItemClick=function(e){this.item=this.getKeyFromId(e.item.id);var t,i,a,n,r,s,o=ne.getValue("parentObj",e.item),l=-1;switch(e.type="Content",e.rowData=this.rowData,this.parent.trigger("contextMenuClick",e),o&&!ne.isNullOrUndefined(o.id)&&"DeleteDependency"===this.getKeyFromId(o.id)&&(l=o.items.indexOf(e.item)),!this.parent.isAdaptive||"TaskInformation"!==this.item&&"Above"!==this.item&&"Below"!==this.item&&"Child"!==this.item&&"DeleteTask"!==this.item||this.parent.selectionModule&&"Multiple"===this.parent.selectionSettings.type&&(this.parent.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none"),this.item){case"TaskInformation":ne.isNullOrUndefined(this.rowData)||("string"==typeof this.rowData.ganttProperties.taskId?this.parent.openEditDialog(this.rowData.ganttProperties.rowUniqueID):this.parent.openEditDialog(Number(this.rowData.ganttProperties.rowUniqueID)));break;case"Above":case"Below":case"Child":ne.isNullOrUndefined(this.rowData)?0===this.parent.flatData.length&&this.parent.addRecord():(r=this.item,(a=ne.extend({},{},this.rowData.taskData,!0))[(n=this.parent.taskFields).startDate]&&this.parent.setRecordValue(n.startDate,this.rowData.ganttProperties.startDate,a,!0),a[n.endDate]&&this.parent.setRecordValue(n.endDate,this.rowData.ganttProperties.endDate,a,!0),ne.isNullOrUndefined(n.dependency)||(a[n.dependency]=null),!ne.isNullOrUndefined(n.child)&&a[n.child]&&delete a[n.child],!ne.isNullOrUndefined(n.parentID)&&a[n.parentID]&&(a[n.parentID]=null),this.rowData&&("ResourceView"===this.parent.viewType&&this.rowData.parentItem&&a[this.parent.taskFields.resourceInfo]&&(t=this.parent.getParentTask(this.rowData.parentItem),i=this.parent.resourceFields.id,s=this.rowData.taskData[this.parent.taskFields.resourceInfo].find(function(e){return e[i]===t.ganttProperties.taskId}),a[this.parent.taskFields.resourceInfo]=s?[s]:[]),s=this.parent.updatedRecords.indexOf(this.rowData),this.parent.addRecord(a,r,s)));break;case"Milestone":case"ToMilestone":ne.isNullOrUndefined(this.rowData)?0===this.parent.flatData.length&&"Milestone"===this.item&&(r=this.parent.editModule.createNewRecord(),s=this.parent.taskFields,this.parent.taskFields.duration&&(r[s.duration]=0),this.parent.taskFields.milestone&&(r[s.milestone]=!0),this.parent.addRecord(r)):this.parent.convertToMilestone(this.rowData.ganttProperties.rowUniqueID);break;case"DeleteTask":"Cell"!==this.parent.selectionSettings.mode&&1<this.parent.selectionModule.selectedRowIndexes.length||"Cell"===this.parent.selectionSettings.mode&&this.parent.selectionModule.getSelectedRowCellIndexes().length?this.parent.editModule.startDeleteAction():this.parent.editModule.deleteRecord(this.rowData);break;case"ToTask":ne.isNullOrUndefined(this.rowData)||(a=ne.extend({},{},this.rowData.taskData,!0),n=this.parent.taskFields,ne.isNullOrUndefined(n.duration)?(a[n.startDate]=new Date(this.rowData.taskData[n.startDate]),(s=new Date(this.rowData.taskData[n.startDate])).setDate(s.getDate()+1),a[n.endDate]=s):(r=parseInt(a[n.duration],10)<=0?1:a[n.duration],a[n.duration]=r,this.parent.setRecordValue("duration",r,this.rowData.ganttProperties,!0)),ne.isNullOrUndefined(a[n.milestone])||!0===a[n.milestone]&&(a[n.milestone]=!1),"FixedWork"!==(s=(ne.isNullOrUndefined(this.rowData.ganttProperties.taskType)?this.parent:this.rowData.ganttProperties).taskType)&&"FixedUnit"!==s||(this.parent.dataOperation.updateWorkWithDuration(this.rowData),ne.isNullOrUndefined(a[n.work]))||(a[n.work]=this.rowData.ganttProperties.work),a[n.startDate]&&this.parent.setRecordValue(n.startDate,this.rowData.ganttProperties.startDate,a,!0),this.parent.updateRecordByID(a));break;case"Cancel":this.parent.cancelEdit();break;case"Save":this.parent.editModule.cellEditModule.isCellEdit=!1,this.parent.treeGrid.grid.saveCell();break;case"Dependency"+l:this.isCntxtMenuDependencyDelete=!0,this.parent.connectorLineEditModule.removePredecessorByIndex(this.rowData,l);break;case"Auto":case"Manual":this.parent.changeTaskMode(this.rowData);break;case"Indent":this.parent.indent();break;case"Outdent":this.parent.outdent();break;case"Left":case"Right":this.mergeCall(this.item);break;case"SplitTask":this.splitTaskCall(e)}},x.prototype.splitTaskCall=function(e){var t=this,i=(this.isEdit=!0,this.parent.taskFields),a=this.getClickedDate(e.element),e=(ne.isNullOrUndefined(this.parent.timelineSettings.bottomTier)&&"Hour"!==this.parent.timelineSettings.bottomTier.unit&&a.setHours(0,0,0,0),{rowData:this.rowData,requestType:"splitTaskbar",splitDate:a,cancel:!1,target:this.targetElement});this.parent.trigger("actionBegin",e,function(e){e.cancel||(t.parent.showLoadingIndicator(),t.parent.chartRowsModule.splitTask(t.rowData[i.id],a),t.parent.chartRowsModule.updateSegment(t.rowData.ganttProperties.segments,t.rowData.ganttProperties.taskId))})},x.prototype.mergeCall=function(e){var t=this,i=(this.isEdit=!0,this.parent.taskFields),a=this.rowData.ganttProperties.segments,n=[{firstSegmentIndex:("Right"===e?this:a[this.segmentIndex-1]).segmentIndex,secondSegmentIndex:("Left"===e?this:a[this.segmentIndex+1]).segmentIndex}],e={rowData:this.rowData,mergeSegmentIndexes:n,requestType:"mergeSegment",cancel:!1,target:this.targetElement};this.parent.trigger("actionBegin",e,function(e){!1===e.cancel&&(ne.isNullOrUndefined(t.parent.loadingIndicator)||"Shimmer"!==t.parent.loadingIndicator.indicatorType?t.parent.showSpinner():t.parent.showMaskRow(),t.parent.chartRowsModule.mergeTask(t.rowData[i.id],n))})},x.prototype.getClickedDate=function(e){n=this.parent.enableRtl?(n=this.parent.element.getBoundingClientRect(),t=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,i=document.documentElement.clientLeft||document.body.clientLeft||0,n.left+t-i):this.parent.getOffsetRect(this.parent.element).left,t=this.parent.enableRtl?(r=Math.abs(n+this.parent.ganttChartModule.chartElement.offsetWidth-this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft),Math.abs(this.clickedPosition-r)):(r=n+this.parent.ganttChartModule.chartElement.offsetLeft+this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft,this.clickedPosition-r);var t,i=Math.ceil(t/this.parent.perDayWidth);if(!this.parent.timelineSettings.showWeekend){var a=new Date(this.rowData.ganttProperties.startDate),n=864e5/this.parent.perDayWidth;if(!this.parent.timelineSettings.showWeekend){for(var r=Math.floor(t*n/864e5),n=7-this.parent.nonWorkingDayIndex.length,s=Math.floor(r/n),o=r%n,l=(a.setDate(a.getDate()+7*s),0);l<o;)a.setDate(a.getDate()+1),-1===this.parent.nonWorkingDayIndex.indexOf(a.getDay())&&l++;r=a;i+=this.parent.timelineModule.calculateNonWorkingDaysBetweenDates(new Date(this.rowData.ganttProperties.startDate),r)}}n=this.rowData.ganttProperties.startDate;return ne.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||"Hour"!==this.parent.timelineSettings.bottomTier.unit||(i=Math.ceil(t/this.parent.timelineSettings.timelineUnitSize),--i),ne.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||"Minutes"!==this.parent.timelineSettings.bottomTier.unit&&"Hour"!==this.parent.timelineSettings.bottomTier.unit?this.parent.dataOperation.getEndDate(n,i,1<this.rowData.ganttProperties.duration?this.rowData.ganttProperties.durationUnit:("None"!==this.parent.timelineSettings.bottomTier.unit?this.parent.timelineSettings.bottomTier:this.parent.timelineSettings.topTier).unit.toLocaleLowerCase(),this.rowData,!1):(i=Math.ceil(t/this.parent.timelineSettings.timelineUnitSize),this.parent.dataOperation.getEndDate(n,--i,this.parent.timelineSettings.bottomTier.unit.toLocaleLowerCase(),this.rowData,!1))},x.prototype.contextMenuBeforeOpen=function(t){var i=this,e=t.event?t.event.target:this.parent.focusModule?this.parent.ganttChartModule.targetElement:this.parent.focusModule.getActiveElement(),a=(!ne.isNullOrUndefined(this.parent.editModule)&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&(e.parentElement.classList.contains("e-row")||e.parentElement.classList.contains("e-treecolumn-container"))&&this.parent.treeGrid.endEdit(),ne.isNullOrUndefined(t.element)||t.element.id!==this.parent.element.id+"_contextmenu"||(this.clickedPosition=ne.getValue("event",t).clientX),ne.closest(e,".e-gantt-child-taskbar")),a=(a&&(this.targetElement=t.target=a),t.gridRow=ne.closest(e,".e-row"),t.chartRow=ne.closest(e,".e-chart-row"),ne.closest(e,".e-gantt"));if(!ne.closest(e,gt)&&this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&this.parent.editModule.dialogModule.dialogObj&&!this.parent.editModule.dialogModule.dialogObj.open&&(this.parent.treeGrid.grid.saveCell(),this.parent.editModule.cellEditModule.isCellEdit=!1),this.parent.readOnly&&this.contextMenu.enableItems(["Add","Save","Convert","Delete Dependency","Delete Task","TaskMode","Indent","Outdent","SplitTask","MergeTask"],!1),(ne.isNullOrUndefined(t.gridRow)&&ne.isNullOrUndefined(t.chartRow)||0===this.contentMenuItems.length)&&((ne.isNullOrUndefined(t.parentItem)||ne.isNullOrUndefined(a))&&ne.isNullOrUndefined(ne.closest(e,".e-content"))?t.cancel=!0:t.cancel=!1),!t.cancel){var n=-1;t.gridRow?n=parseInt(t.gridRow.getAttribute("aria-rowindex"),0)-1:t.chartRow&&(n=parseInt(t.chartRow.getAttribute("aria-rowindex"),0)-1),this.parent.selectionModule&&this.parent.allowSelection&&!t.parentItem&&!ne.isNullOrUndefined(t.chartRow)&&this.parent.selectionModule.selectRow(n),t.parentItem||(this.rowData=this.parent.ganttChartModule.getRecordByTarget(t.event));for(var r,s=0,o=t.items;s<o.length;s++){var l=o[s];l.separator||(!e.classList.contains("e-gantt-unscheduled-taskbar")||l.text!==this.getLocale("splitTask")&&l.text!==this.getLocale("mergeTask")?this.updateItemStatus(l,e,n):this.hideItems.push(l.text))}if(t.rowData=this.rowData,t.type="Content",t.disableItems=this.disableItems,t.hideItems=this.hideItems,t.hideChildItems=[],ne.isNullOrUndefined(t.rowData)||0!==t.rowData.level||"ResourceView"!==this.parent.viewType)return r=new D.Deferred,this.parent.trigger("contextMenuOpen",t,function(e){r.resolve(e),i.hideItems=e.hideItems,i.disableItems=e.disableItems,e.parentItem||e.hideItems.length!==e.items.length||(i.revertItemStatus(),e.cancel=!0),0<i.hideItems.length&&i.contextMenu.hideItems(i.hideItems),0<i.disableItems.length&&i.contextMenu.enableItems(i.disableItems,!1),0<t.hideChildItems.length&&i.contextMenu.hideItems(t.hideChildItems)}),r;t.cancel=!0}},x.prototype.updateItemStatus=function(e,t,i){var a=this.getKeyFromId(e.id),n=ne.closest(t,gt),r=[],s=ne.closest(t,".e-gantt-child-taskbar")||ne.closest(t,"e-taskbar-right-resizer")||ne.closest(t,"e-taskbar-left-resizer");if(n)"Save"!==a&&"Cancel"!==a&&this.hideItems.push(e.text);else switch(a){case"TaskInformation":this.parent.editSettings.allowEditing&&this.parent.editModule||this.updateItemVisibility(e.text),0===this.parent.flatData.length&&this.hideItems.push(e.text);break;case"Add":this.parent.editSettings.allowAdding&&this.parent.editModule||this.updateItemVisibility(e.text);break;case"Save":case"Cancel":this.hideItems.push(e.text);break;case"Convert":!ne.isNullOrUndefined(this.rowData)&&this.rowData.hasChildRecords?this.hideItems.push(e.text):this.parent.editSettings.allowEditing&&this.parent.editModule?(ne.isNullOrUndefined(this.rowData)||this.rowData.ganttProperties.isMilestone?r.push(this.createItemModel(p,"ToTask",this.getLocale("toTask"))):r.push(this.createItemModel(p,"ToMilestone",this.getLocale("toMilestone"))),e.items=r):this.updateItemVisibility(e.text),0===this.parent.flatData.length&&this.hideItems.push(e.text);break;case"DeleteDependency":var o=this.getPredecessorsItems();ne.isNullOrUndefined(this.rowData)||!this.rowData.hasChildRecords||this.parent.allowParentDependency?this.parent.editSettings.allowDeleting&&0!==o.length&&this.parent.editModule?0<o.length&&(e.items=o):this.updateItemVisibility(e.text):this.hideItems.push(e.text);break;case"DeleteTask":this.parent.editSettings.allowDeleting&&this.parent.editModule||this.updateItemVisibility(e.text),0===this.parent.flatData.length&&this.hideItems.push(e.text);break;case"TaskMode":"Custom"!==this.parent.taskMode?this.updateItemVisibility(e.text):(this.rowData.ganttProperties.isAutoSchedule?r.push(this.createItemModel(p,"Manual",this.getLocale("manual"))):r.push(this.createItemModel(p,"Auto",this.getLocale("auto"))),e.items=r);break;case"Indent":this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings?(o=this.parent.selectedRowIndex,d=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),l=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],this.parent.editSettings.allowEditing&&0!==o&&-1!==o&&d&&"ResourceView"!==this.parent.viewType&&this.parent.updatedRecords[parseInt(o.toString(),10)].level-l.level!=1||this.updateItemVisibility(e.text)):this.hideItems.push(e.text);break;case"Outdent":this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings?(d=this.parent.selectionModule.getSelectedRowIndexes()[0],o=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),this.parent.editSettings.allowEditing&&-1!==d&&0!==d&&o&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[parseInt(d.toString(),10)].level||this.updateItemVisibility(e.text)):this.hideItems.push(e.text);break;case"SplitTask":var l=!1,o=!1,d=this.parent.taskFields;ne.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||(l="Minutes"===this.parent.timelineSettings.bottomTier.unit,o="Hour"===this.parent.timelineSettings.bottomTier.unit),(this.parent.readOnly||!s||ne.isNullOrUndefined(d.segments)||this.parent.updatedRecords[Number(i)].hasChildRecords||this.parent.updatedRecords[Number(i)].ganttProperties.duration<2&&!l&&!o)&&this.updateItemVisibility(e.text);break;case"MergeTask":this.parent.readOnly||!s?this.updateItemVisibility(e.text):this.mergeItemVisiblity(t,e)}},x.prototype.mergeItemVisiblity=function(e,t){var i=[],a=this.parent.taskFields,e=this.getClickedDate(e),e=(this.segmentIndex=this.parent.chartRowsModule.getSegmentIndex(e,this.rowData),this.rowData.ganttProperties.segments);!ne.isNullOrUndefined(e)&&0<e.length?ne.isNullOrUndefined(a.segments)&&-1===this.segmentIndex?this.updateItemVisibility(t.text):(0===this.segmentIndex?i.push(this.createItemModel(p,"Right",this.getLocale("right"))):(this.segmentIndex!==e.length-1&&i.push(this.createItemModel(p,"Right",this.getLocale("right"))),i.push(this.createItemModel(p,"Left",this.getLocale("left")))),t.items=i):this.hideItems.push(t.text)},x.prototype.updateItemVisibility=function(e){(!!ne.isNullOrUndefined(this.parent.contextMenuItems)?this.hideItems:this.disableItems).push(e)},x.prototype.contextMenuOpen=function(e){this.isOpen=!0;e=this.parent.args=e.element.querySelectorAll("li:not(.e-menu-hide):not(.e-disabled)")[0];ne.isNullOrUndefined(e)||ne.addClass([e],"e-focused")},x.prototype.getMenuItems=function(){for(var e=0,t=ne.isNullOrUndefined(this.parent.contextMenuItems)?this.getDefaultItems():this.parent.contextMenuItems;e<t.length;e++){var i=t[e];"string"==typeof i&&-1!==this.getDefaultItems().indexOf(i)?this.buildDefaultItems(i):"string"!=typeof i&&(-1!==this.getDefaultItems().indexOf(i.text)?this.buildDefaultItems(i.text,i.iconCss):(".e-gridheader"===i.target?this.headerMenuItems:this.contentMenuItems).push(i))}return this.contentMenuItems},x.prototype.createItemModel=function(e,t,i,a){return{text:i,id:this.generateID(t),target:e,iconCss:a?"e-icons "+a:null}},x.prototype.getLocale=function(e){return this.parent.localeObj.getConstant(e)},x.prototype.buildDefaultItems=function(e,t){var i;switch(e){case"AutoFitAll":case"AutoFit":case"SortAscending":case"SortDescending":this.headerMenuItems.push(e);break;case"TaskInformation":i=this.createItemModel(p,e,this.getLocale("taskInformation"),this.getIconCSS(ft,t));break;case"Indent":i=this.createItemModel(p,e,this.getLocale("indent"),this.getIconCSS("e-indent",t));break;case"Outdent":i=this.createItemModel(p,e,this.getLocale("outdent"),this.getIconCSS("e-outdent",t));break;case"Save":i=this.createItemModel(ft,e,this.getLocale("save"),this.getIconCSS("e-save",t));break;case"Cancel":i=this.createItemModel(ft,e,this.getLocale("cancel"),this.getIconCSS("e-cancel",t));break;case"Add":(i=this.createItemModel(p,e,this.getLocale("add"),this.getIconCSS("e-add",t))).items=[],i.items.push(this.createItemModel(p,"Above",this.getLocale("above"),this.getIconCSS("e-add-above",t))),i.items.push(this.createItemModel(p,"Below",this.getLocale("below"),this.getIconCSS("e-add-below",t))),"ResourceView"!==this.parent.viewType&&i.items.push(this.createItemModel(p,"Child",this.getLocale("child"))),i.items.push(this.createItemModel(p,"Milestone",this.getLocale("milestone")));break;case"DeleteTask":i=this.createItemModel(p,e,this.getLocale("deleteTask"),this.getIconCSS("e-delete",t));break;case"DeleteDependency":(i=this.createItemModel(p,e,this.getLocale("deleteDependency"))).items=[],i.items.push({});break;case"Convert":(i=this.createItemModel(p,e,this.getLocale("convert"))).items=[],i.items.push({});break;case"TaskMode":(i=this.createItemModel(p,e,this.getLocale("changeScheduleMode"))).items=[],i.items.push({});break;case"SplitTask":i=this.createItemModel(p,e,this.getLocale("splitTask"));break;case"MergeTask":(i=this.createItemModel(p,e,this.getLocale("mergeTask"))).items=[],i.items.push({})}i&&this.contentMenuItems.push(i)},x.prototype.getIconCSS=function(e,t){return ne.isNullOrUndefined(t)?e:t},x.prototype.getPredecessorsItems=function(){this.predecessors=this.parent.predecessorModule.getValidPredecessor(this.rowData);for(var e=[],t=0,i=0,a=this.predecessors;i<a.length;i++){var n=a[i],n=this.parent.connectorLineModule.getRecordByID(n.from).ganttProperties,n=n.rowUniqueID+" - "+n.taskName,r="Dependency"+t++,r=this.createItemModel(p,r,n);e.push(r)}return e},x.prototype.getDefaultItems=function(){return["AutoFitAll","AutoFit","TaskInformation","DeleteTask","Save","Cancel","SortAscending","SortDescending","Add","DeleteDependency","Convert","TaskMode","Indent","Outdent","SplitTask","MergeTask"]},x.prototype.getModuleName=function(){return"contextMenu"},x.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("initiate-contextMenu",this.render),this.parent.off("reRender-contextMenu",this.reRenderContextMenu),this.parent.off("contextMenuClick",this.contextMenuItemClick),this.parent.off("contextMenuOpen",this.contextMenuOpen))},x.prototype.contextMenuOnClose=function(e){0<e.items.length&&e.items[0].parentObj instanceof V.ContextMenu&&this.revertItemStatus()},x.prototype.revertItemStatus=function(){this.contextMenu.showItems(this.hideItems),this.contextMenu.enableItems(this.disableItems),this.hideItems=[],this.disableItems=[],this.isOpen=!1},x.prototype.resetItems=function(){this.hideItems=[],this.disableItems=[],this.headerMenuItems=[],this.contentMenuItems=[],this.item=null},x.prototype.generateID=function(e){return this.ganttID+"_contextMenu_"+e},x.prototype.getKeyFromId=function(e){var t=this.ganttID+"_contextMenu_";return-1<e.indexOf(t)?e.replace(t,""):"Custom"},x.prototype.destroy=function(){this.contextMenu.destroy(),ne.remove(this.element),this.removeEventListener(),this.contextMenu=null,this.element=null};var Za=x;function x(e){var a=this;this.segmentIndex=-1,this.isCntxtMenuDependencyDelete=!1,this.headerContextMenuClick=function(e){var t=ne.closest(e.event.target,".e-row"),i=ne.closest(e.event.target,".e-chart-row");ne.isNullOrUndefined(t)&&ne.isNullOrUndefined(i)&&(e.type="Header",a.parent.trigger("contextMenuClick",e))},this.headerContextMenuOpen=function(e){var t=ne.closest(e.event.target,".e-row"),i=ne.closest(e.event.target,".e-chart-row");ne.isNullOrUndefined(t)&&ne.isNullOrUndefined(i)?(e.type="Header",a.parent.trigger("contextMenuOpen",e)):e.cancel=!0},this.parent=e,this.ganttID=e.element.id,T.TreeGrid.Inject(T.ContextMenu),this.parent.treeGrid.contextMenuClick=this.headerContextMenuClick.bind(this),this.parent.treeGrid.contextMenuOpen=this.headerContextMenuOpen.bind(this),this.addEventListener(),this.resetItems()}Ya.prototype.getModuleName=function(){return"excelExport"},Ya.prototype.destroy=function(){},Ya.prototype.bindEvents=function(){var t=this;this.parent.treeGrid.beforeExcelExport=function(e){t.parent.trigger("beforeExcelExport",e),ne.isNullOrUndefined(t.parent.loadingIndicator)||"Shimmer"!==t.parent.loadingIndicator.indicatorType?t.parent.showSpinner():t.parent.showMaskRow()},this.parent.treeGrid.excelQueryCellInfo=function(e){t.parent.trigger("excelQueryCellInfo",e)},this.parent.treeGrid.excelHeaderQueryCellInfo=function(e){t.parent.trigger("excelHeaderQueryCellInfo",e)},this.parent.treeGrid.excelExportComplete=function(e){t.parent.trigger("excelExportComplete",e),ne.isNullOrUndefined(t.parent.loadingIndicator)||"Shimmer"!==t.parent.loadingIndicator.indicatorType?t.parent.hideSpinner():t.parent.hideMaskRow()}};var Xa=Ya;function Ya(e){this.parent=e,T.TreeGrid.Inject(T.ExcelExport),this.parent.treeGrid.allowExcelExport=this.parent.allowExcelExport,this.bindEvents()}Qa.prototype.getColumnMenu=function(){return this.parent.treeGrid.columnMenuModule.getColumnMenu()},Qa.prototype.destroy=function(){},Qa.prototype.getModuleName=function(){return"columnMenu"};var Ka=Qa;function Qa(e){T.TreeGrid.Inject(T.ColumnMenu),this.parent=e}I.prototype.getModuleName=function(){return"rowDragAndDrop"},I.prototype.destroy=function(){},I.prototype.bindEvents=function(){this.parent.treeGrid.rowDragStart=this.rowDragStart.bind(this),this.parent.treeGrid.rowDragStartHelper=this.rowDragStartHelper.bind(this),this.parent.treeGrid.rowDrag=this.rowDrag.bind(this),this.parent.treeGrid.rowDrop=this.rowDrop.bind(this)},I.prototype.rowDragStart=function(e){this.parent.trigger("rowDragStart",e),this.parent.element.style.position="relative"},I.prototype.addErrorElem=function(){var e,t,i,a,n=document.querySelector(".e-ganttdrag");n&&!!!n.querySelector(".e-errorelem")&&((e=document.createElement("div")).classList.add("e-errorcontainer","e-icons","e-errorelem"),n=n.querySelector(".e-rowcell"))&&(t=n.childNodes,(i=n.querySelector(".errorValue"))&&(t=i.childNodes,i.remove()),n.innerHTML="",(a=document.createElement("span")).className="errorValue",a.style.paddingLeft="16px",t.forEach(function(e){a.appendChild(e.cloneNode(!0))}),n.appendChild(e),n.appendChild(a))},I.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},I.prototype.rowDrag=function(e){var t,i=this.parent.element.querySelector(".e-cloneproperties"),i=(i.style.display="none",i.cloneNode(!0)),i=(i.classList.add("e-ganttdrag"),i.style.display="",this.parent.element.querySelectorAll(".e-cloneproperties").length<=1?this.parent.element.appendChild(i):document.getElementsByClassName("e-cloneproperties")[0].querySelectorAll(".e-errorelem").length?this.addErrorElem():this.removeErrorElem(),"Both"===this.parent.gridLines&&ne.addClass(this.parent.element.querySelectorAll(".e-ganttdrag .e-rowcell"),["e-bothganttlines"]),this.parent.element.querySelector(".e-ganttdrag")),a=this.parent.element.getClientRects()[0].top,n=this.parent.element.getClientRects()[0].left,n=this.parent.isAdaptive?(t=e.originalEvent.event.touches[0].clientX-n,e.originalEvent.event.touches[0].clientY-a):(t=ne.getValue("event",e.originalEvent).clientX-n,ne.getValue("event",e.originalEvent).clientY-a);i.style.left=t+20+"px",i.style.top=n+20+"px",this.parent.trigger("rowDrag",e)},I.prototype.rowDragStartHelper=function(e){this.parent.trigger("rowDragStartHelper",e),this.parent.readOnly&&(e.cancel=!0)},I.prototype.rowDrop=function(e){this.parent.isAdaptive&&(t=document.querySelector(".e-ganttdrag"))&&t.remove();var t=ne.closest(e.target,".e-row"),t=(this.parent.oldRecords=ne.extend([],[],e.data,!0),t?parseInt(t.getAttribute("aria-rowindex"),10)-1:e.dropIndex);e.dropIndex=t,e.dropRecord=this.parent.updatedRecords[e.dropIndex],this.parent.trigger("rowDrop",e),"ResourceView"!==this.parent.viewType||this.validPosition(e,e.dropRecord)||(e.cancel=!0),e.cancel||(e.requestType="beforeDrop",this.parent.trigger("actionBegin",e),e.cancel?this.parent.hideLoadingIndicator():(this.parent.showLoadingIndicator(),this.dropRows(e,!0),e.cancel=!0))},I.prototype.validPosition=function(e,t){var i=t.level,a=ne.getValue("level",e.data[0]),n=e.data[0];return this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&(n=this.parent.currentViewData[this.parent.undoRedoModule.getResourceViewRowIndex(n)]),!("middleSegment"===e.dropPosition&&(1===i||0===a)||"middleSegment"!==e.dropPosition&&(0===a&&1===i||1===a&&0===i)||ne.getValue("parentItem",n)&&t.uniqueID===ne.getValue("parentItem",n).uniqueID)},I.prototype.dropRows=function(i,u){if(!this.parent.readOnly){if(this.dropPosition=i.dropPosition,"Invalid"!==i.dropPosition&&this.parent.editModule){var c=this.parent;if(this.droppedRecord=c.updatedRecords[i.dropIndex],"ResourceView"===this.parent.viewType&&!this.validPosition(i,this.droppedRecord))return void(this.droppedRecord=null);if(this.parent.undoRedoModule&&this.parent.isUndoRedoItemPresent("RowDragAndDrop")){if(!this.parent.undoRedoModule.isUndoRedoPerformed){this.parent.undoRedoModule.redoEnabled&&(this.parent.undoRedoModule.disableRedo(),this.parent.undoRedoModule.createUndoCollection()),!i.target&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.taskBarEditAction?this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=[]:this.parent.undoRedoModule.createUndoCollection();for(var e=[],a=this,n=0;n<i.data.length;n++)!function(t){e.push(a.parent.flatData.filter(function(e){return i.data[t].ganttProperties.taskId===e.ganttProperties.taskId})[0])}(n);var t=ne.extend([],[],e,!0),r={},s=(i.name?r.action="RowDragAndDrop":r.action="TaskbarDragAndDrop",r.beforeDrop=[],{});s.dropRecord=ne.extend([],[],[i.dropRecord||this.droppedRecord],!0)[0],s.data=ne.extend([],[],i.data,!0),"middleSegment"===i.dropPosition?s.dropPosition="child":"topSegment"===i.dropPosition?s.dropPosition="above":"bottomSegment"===i.dropPosition&&(s.dropPosition="below"),r.afterDrop=s,this.parent.undoRedoModule.findPosition(t,r,"beforeDrop"),this.parent.undoRedoModule.getUndoCollection[this.parent.undoRedoModule.getUndoCollection.length-1]=r}this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_undo"],!0)}for(var g=void 0,f=[],m=this.droppedRecord,y=(i.data[0]?f=i.data:f.push(i.data),0),o=f.length,l=function(e){if(D.parent.isOnEdit=!0,g=f[e],D.draggedRecord=g,"Invalid"!==D.dropPosition){if("ResourceView"===D.parent.viewType&&(D.checkisSharedTask(),0!==D.draggedRecord.level)&&(D.previousParent=D.draggedRecord.parentItem.uniqueID),D.isSharedTask)return{value:void 0};u&&D.deleteDragRow();var t,e=D.treeGridData.indexOf(m);if("topSegment"===D.dropPosition&&D.dropAtTop(e),"bottomSegment"!==D.dropPosition||D.isSharedTask||(m.hasChildRecords?(y=D.parent.editModule.getChildCount(m,0),D.parent.taskFields.parentID&&0<D.ganttData.length&&D.ganttData.splice(e+y+1,0,D.draggedRecord.taskData),D.treeGridData.splice(e+y+1,0,D.draggedRecord),D.parent.ids.splice(e+y+1,0,D.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===D.parent.viewType&&(r=0===D.draggedRecord.level?"R"+D.draggedRecord.ganttProperties.taskId:"T"+D.draggedRecord.ganttProperties.taskId,D.parent.getTaskIds().splice(e+y+1,0,r))):(D.parent.taskFields.parentID&&0<D.ganttData.length&&D.ganttData.splice(e+1,0,D.draggedRecord.taskData),D.treeGridData.splice(e+1,0,D.draggedRecord),D.parent.ids.splice(e+1,0,D.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===D.parent.viewType&&(r=0===D.draggedRecord.level?"R"+D.draggedRecord.ganttProperties.taskId:"T"+D.draggedRecord.ganttProperties.taskId,D.parent.getTaskIds().splice(e+1,0,r))),D.parent.setRecordValue("parentItem",D.treeGridData[e].parentItem,g),D.parent.setRecordValue("parentUniqueID",D.treeGridData[e].parentUniqueID,g),D.parent.setRecordValue("level",D.treeGridData[e].level,g),g.hasChildRecords&&(D.updateChildRecordLevel(g,1),D.updateChildRecord(g,e+y+1)),m.parentItem&&(t=(r=D.parent.getParentTask(m.parentItem).childRecords).indexOf(m)+1,r.splice(t,0,g))),"middleSegment"===D.dropPosition&&(D.dropMiddle(e),0<m.childRecords.length)&&(delete m.ganttProperties.segments,delete m.taskData[D.parent.taskFields.segments]),0!==D.treeGridData.length){for(var i,a=0;a<D.treeGridData.length;a++)D.treeGridData[parseInt(a.toString(),10)].index=a,ne.isNullOrUndefined(D.treeGridData[parseInt(a.toString(),10)].parentItem)||(i=ne.getValue("uniqueIDCollection."+D.treeGridData[parseInt(a.toString(),10)].parentUniqueID,D.parent.treeGrid),D.treeGridData[parseInt(a.toString(),10)].parentItem.index=i.index);D.parent.undoRedoModule&&(D.parent.undoRedoModule.canUpdateIndex=!1)}ne.isNullOrUndefined(g.parentItem&&-1!==D.updateParentRecords.indexOf(g.parentItem))||D.updateParentRecords.push(g.parentItem)}if(!D.parent.enableVirtualization){var n=c.flatData,r=void 0,s=void 0,o=D.parent.dataSource,l=D.parent.taskFields.id;if(g.index<m.index){for(var r=g.index,d=0;d<o.length;d++)if("break"===function(t){var e=D.parent.currentViewData.filter(function(e){return e[l]===o[t][l]})[0];if(e&&e.index>m.index)return s=e.index,"break"}(d))break}else{r=m.index;for(var h=0;h<o.length;h++)if("break"===function(t){var e=D.parent.currentViewData.filter(function(e){return e[l]===o[t][l]})[0];if(e&&e.index>g.index)return s=e.index,"break"}(h))break}for(var p=r;p<=s;p++)!function(t){var e;ne.isNullOrUndefined(n[t])||(n[t].index=t,ne.isNullOrUndefined(n[t].parentItem))||(e=n.filter(function(e){return e.uniqueID===n[t].parentUniqueID})[0],n[t].parentItem.index=e.index)}(p)}c.rowDragAndDropModule.refreshDataSource()},D=this,n=0;n<o;n++){var d=l(n);if("object"==typeof d)return d.value}if("middleSegment"===this.dropPosition){if(m.ganttProperties.predecessor)for(var h=m.ganttProperties.predecessor.length,p=0;p<h;p++)if(m.ganttProperties.predecessor&&m.ganttProperties.predecessor[p]){var k=this.parent.getRecordByID(m.ganttProperties.predecessor[p].from),b=this.parent.getRecordByID(m.ganttProperties.predecessor[p].to),k=this.parent.predecessorModule.validateParentPredecessor(k,b);if(m.ganttProperties.predecessor&&(!k||!this.parent.allowParentDependency)&&(this.parent.editModule.removePredecessorOnDelete(m),m.ganttProperties.predecessor.splice(0,1),m.ganttProperties.predecessorsName)){for(var w=m.ganttProperties.predecessorsName.split(","),n=0;n<w.length;n++)-1!==w[n].indexOf(g.ganttProperties.taskId+"")&&w.splice(n,1);b=w.join();m.ganttProperties.predecessorsName=b,m[this.parent.taskFields.dependency]=b,m.taskData[this.parent.taskFields.dependency]=b}}m.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,m.ganttProperties,!0),ne.isNullOrUndefined(m.taskData[this.parent.taskFields.milestone])||!0===m.taskData[this.parent.taskFields.milestone]&&(m.taskData[this.parent.taskFields.milestone]=!1))}if("ResourceView"!==this.parent.viewType||this.isSharedTask||(s=void 0,s=("middleSegment"!==this.dropPosition&&this.droppedRecord.parentItem||this.droppedRecord).uniqueID,t=this.parent.getTaskByUniqueID(s),(r={})[this.parent.taskFields.resourceInfo]=[],r[this.parent.taskFields.resourceInfo].push(t.ganttProperties.taskId),this.removeExistingResources(),s=this.parent.dataOperation.setResourceInfo(r),r=this.draggedRecord,ne.isNullOrUndefined(r.ganttProperties.resourceInfo)&&(r.ganttProperties.resourceInfo=[]),"Unassigned Task"===t.ganttProperties.taskName?(r.ganttProperties.resourceInfo=[],r.ganttProperties.sharedTaskUniqueIds=[r.ganttProperties.rowUniqueID]):r.ganttProperties.resourceInfo.push(s[0]),this.updateCurrentTask(r),"Unassigned Task"===t.ganttProperties.taskName?this.deleteSharedResourceTask():this.updateSharedResourceTask()),this.parent.taskFields.dependency&&this.parent.allowParentDependency){var s=void 0,s=g.parentItem?this.parent.flatData[this.parent.ids.indexOf(g.parentItem.taskId)]:g,T=m.parentItem?this.parent.flatData[this.parent.ids.indexOf(m.parentItem.taskId)]:m,v=void 0;if(T.uniqueID===s.uniqueID||s.parentItem&&T.uniqueID===this.parent.flatData[this.parent.ids.indexOf(s.parentItem.taskId)].uniqueID)for(var v=this.parent.currentViewData.filter(function(e){if(e.ganttProperties.predecessor&&0<e.ganttProperties.predecessor.length){var t=0;if(t<e.ganttProperties.predecessor.length)return parseInt(e.ganttProperties.predecessor[t].to,10)===parseInt(T.ganttProperties.taskId,10)||parseInt(e.ganttProperties.predecessor[t].from,10)===parseInt(T.ganttProperties.taskId,10)}return null}),S=[],n=0;n<v.length;n++){if(S=[],v[n].ganttProperties.predecessor)for(var P=0;P<v[n].ganttProperties.predecessor.length;P++)parseInt(v[n].ganttProperties.taskId,10)!==parseInt(v[n].ganttProperties.predecessor[P].from,10)?S.push(v[n].ganttProperties.predecessor[P].from):S.push(v[n].ganttProperties.predecessor[P].to);for(var C=this,R=0;R<S.length;R++)!function(e){var t=S[e].replace(/\D/g,""),e=C.parent.currentViewData.filter(function(e){return parseInt(e.ganttProperties.taskId,10)===parseInt(t,10)});C.parent.predecessorModule.validateParentPredecessor(v[n],e[0])||(C.parent.dataOperation.resetDependency(v[n]),C.parent.dataOperation.resetDependency(e[0]))}(R)}}for(R=0;R<this.updateParentRecords.length;R++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[R]);"ProjectView"===this.parent.viewType&&this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.predecessorModule&&"TaskbarDragAndDrop"===this.parent.undoRedoModule.currentAction.action&&"child"!==this.parent.undoRedoModule.currentAction.beforeDrop[0].position&&(r=this.parent.flatData[this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.afterDrop.dropRecord.ganttProperties.taskId.toString())],this.parent.editModule.taskbarEditModule.taskBarEditRecord=r,this.parent.editModule.taskbarEditModule.taskBarEditAction="ChildDrag",this.parent.predecessorModule.validatePredecessor(r,[],""),this.parent.editModule.taskbarEditModule.taskBarEditAction=null),this.updateParentRecords=[],this.parent.isOnEdit=!1}ne.isNullOrUndefined(this.parent.editModule)||this.parent.editModule.refreshRecord(i,!0),(!this.parent.undoRedoModule||this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed)&&(this.parent.previousFlatData=ne.extend([],[],this.parent.flatData,!0))}this.parent.oldRecords=[]},I.prototype.updateCurrentTask=function(e){this.parent.dataOperation.updateMappingData(e,"resourceInfo"),this.parent.editModule.updateResourceRelatedFields(e,"resource"),this.parent.editModule.dialogModule.dialogEditValidationFlag=!1,this.parent.editModule.dialogModule.validateDuration(e),this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateTaskData(e)},I.prototype.deleteSharedResourceTask=function(){for(var e=0;e<this.parent.getTaskIds().length;e++)this.parent.getTaskIds()[e]==="T"+this.draggedRecord.ganttProperties.taskId&&("Unassigned Task"!==this.parent.getTaskByUniqueID(this.parent.flatData[e].parentItem.uniqueID).ganttProperties.taskName&&this.removeRecords(this.parent.flatData[e]),ne.isNullOrUndefined(this.parent.flatData[parseInt(e.toString(),10)].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.flatData[parseInt(e.toString(),10)].parentItem))||this.updateParentRecords.push(this.parent.flatData[e].parentItem))},I.prototype.removeExistingResources=function(){var e=this.parent.getTaskByUniqueID(this.previousParent);if(this.draggedRecord.ganttProperties.resourceInfo&&e)for(var t=0;t<this.draggedRecord.ganttProperties.resourceInfo.length;t++)if(this.draggedRecord.ganttProperties.resourceInfo[parseInt(t.toString(),10)][this.parent.resourceFields.id]===e.ganttProperties.taskId){this.draggedRecord.ganttProperties.resourceInfo.splice(t,1);break}},I.prototype.updateSharedResourceTask=function(){for(var e=0;e<this.parent.getTaskIds().length;e++)this.parent.getTaskIds()[e]==="T"+this.draggedRecord.ganttProperties.taskId&&(this.parent.editModule.updateGanttProperties(this.draggedRecord,this.parent.flatData[e]),this.parent.dataOperation.updateTaskData(this.parent.flatData[e]),ne.isNullOrUndefined(this.parent.flatData[parseInt(e.toString(),10)].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.flatData[parseInt(e.toString(),10)].parentItem))||this.updateParentRecords.push(this.parent.flatData[e].parentItem))},I.prototype._getExistingTaskWithID=function(e){for(var t=[],i=0;i<this.parent.getTaskIds().length;i++)this.parent.getTaskIds()[i]==="T"+e.ganttProperties.taskId&&t.push(this.parent.flatData[i]);return t},I.prototype.removeResourceInfo=function(e){var t=this.parent.getTaskByUniqueID(this.draggedRecord.parentItem.uniqueID);if(e.ganttProperties.resourceInfo&&1<e.ganttProperties.resourceInfo.length){var i=this._getExistingTaskWithID(e);if(null!==i)for(var a=0;a<i.length;a++)for(var n,r=(n=i[a]).ganttProperties.resourceInfo,s=0;s<r.length;s++)if(r[s][this.parent.resourceFields.id]===t.ganttProperties.taskId){r.splice(s,1),this.parent.setRecordValue("resourceInfo",r,n.ganttProperties,!0),this.updateCurrentTask(n),ne.isNullOrUndefined(n.parentItem&&-1!==this.updateParentRecords.indexOf(n.parentItem))||this.updateParentRecords.push(n.parentItem);break}}},I.prototype.refreshDataSource=function(){var e,t=this.draggedRecord,i=this.droppedRecord,a=this.parent,n=this.parent.taskFields,r=this.parent.dataSource instanceof D.DataManager?ne.getValue("dataOperation.dataArray",this.parent):a.dataSource;if(0<r.length&&!ne.isNullOrUndefined(i)&&!i.parentItem){for(var s=0;s<Object.keys(r).length;s++)(!ne.isNullOrUndefined(i.taskData[n.child])&&r[s][n.child]===i.taskData[n.child]||ne.isNullOrUndefined(i.taskData[n.child])&&i.taskData[n.id]===r[s][n.id])&&(e=s);"topSegment"===this.dropPosition?this.parent.taskFields.parentID||r.splice(e,0,t.taskData):"bottomSegment"!==this.dropPosition||this.parent.taskFields.parentID||r.splice(e+1,0,t.taskData)}else this.parent.taskFields.parentID||ne.isNullOrUndefined(i)||!i.parentItem||"topSegment"!==this.dropPosition&&"bottomSegment"!==this.dropPosition||(a="topSegment"===this.dropPosition?"Above":"Below",this.parent.editModule.addRowSelectedItem=i,this.parent.editModule.updateRealDataSource([t],a),delete this.parent.editModule.addRowSelectedItem);this.parent.taskFields.parentID&&(t.parentItem?(a="middleSegment"===this.dropPosition?this.parent.taskFields.id:this.parent.taskFields.parentID,t[this.parent.taskFields.parentID]=i[a],t.ganttProperties.parentId=i[a],("ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition||"ProjectView"===this.parent.viewType)&&(t.taskData[this.parent.taskFields.parentID]=i.taskData[a])):(t[this.parent.taskFields.parentID]=null,t.taskData[this.parent.taskFields.parentID]=null,t.ganttProperties.parentId=null)),this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&this.parent.predecessorModule&&"TaskbarDragAndDrop"===this.parent.undoRedoModule.currentAction.action&&(a=void 0,a="ProjectView"===this.parent.viewType?this.parent.flatData[this.parent.ids.indexOf(this.parent.undoRedoModule.currentAction.afterDrop.data[0].ganttProperties.taskId.toString())]:this.parent.flatData[this.parent.undoRedoModule.getResourceViewRowIndex(this.parent.undoRedoModule.currentAction.afterDrop.data[0])],this.parent.editModule.taskbarEditModule.taskBarEditRecord=a,this.parent.editModule.taskbarEditModule.taskBarEditAction="ChildDrag",this.parent.predecessorModule.validatePredecessor(a,[],""),this.parent.editModule.taskbarEditModule.taskBarEditAction=null)},I.prototype.dropMiddle=function(e){var t=this.parent,i=this.parent.editModule.getChildCount(this.droppedRecord,0),i=ne.isNullOrUndefined(i)||0===i?e+1:i+e+1;"middleSegment"!==this.dropPosition||this.isSharedTask||(t.taskFields.parentID&&0<this.ganttData.length&&this.ganttData.splice(i,0,this.draggedRecord.taskData),this.treeGridData.splice(i,0,this.draggedRecord),this.parent.ids.splice(i,0,this.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType&&(e=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId,this.parent.getTaskIds().splice(i,0,e)),this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,i,this.droppedRecord.expanded),this.recordLevel(),ne.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem))},I.prototype.recordLevel=function(){var e,t=this.parent,i=this.draggedRecord,a=this.droppedRecord,n=t.taskFields.child;a.hasChildRecords||(a.hasChildRecords=!0,a.childRecords.length)||(a.childRecords=[],!t.taskFields.parentID&&ne.isNullOrUndefined(a.taskData[n])&&(a.taskData[n]=[])),"middleSegment"===this.dropPosition&&(delete(e=ne.extend({},a)).childRecords,e={uniqueID:e.uniqueID,expanded:e.expanded,level:e.level,index:e.index,taskId:e.ganttProperties.rowUniqueID},this.parent.setRecordValue("parentItem",e,i),this.parent.setRecordValue("parentUniqueID",a.uniqueID,i),a.childRecords.splice(a.childRecords.length,0,i),ne.isNullOrUndefined(i)||t.taskFields.parentID||ne.isNullOrUndefined(a.taskData[n])||a.taskData[t.taskFields.child].splice(a.childRecords.length,0,i.taskData),i.hasChildRecords?(i.level=a.level+1,this.parent.setRecordValue("level",this.draggedRecord.level,this.draggedRecord),this.updateChildRecordLevel(i,1)):i.level=a.level+1,this.parent.enableMultiTaskbar||(a.expanded=!0))},I.prototype.deleteDragRow=function(){var e;this.treeGridData=H(this.parent)?ne.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource,this.parent.dataSource instanceof D.DataManager?this.ganttData=ne.getValue("dataOperation.dataArray",this.parent):this.ganttData=H(this.parent)?ne.getValue("result",this.parent.dataSource):this.parent.dataSource,e=this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed?"ProjectView"===this.parent.viewType?this.parent.flatData[this.parent.ids.indexOf(this.draggedRecord.ganttProperties.taskId.toString())]:(e=this.draggedRecord.hasChildRecords?"R":"T",this.parent.flatData[this.parent.taskIds.indexOf(e+this.draggedRecord.ganttProperties.taskId)]):this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID),this.removeRecords(e)},I.prototype.checkisSharedTask=function(){this.isSharedTask=!1;for(var e=null,t=(0===this.droppedRecord.level?this.droppedRecord:this.droppedRecord.parentItem).uniqueID,i=this.parent.getTaskByUniqueID(t).childRecords,a=0;a<i.length;a++)this.draggedRecord.hasChildRecords||"T"+this.draggedRecord.ganttProperties.taskId!="T"+i[a].ganttProperties.taskId||(this.isSharedTask=!0,e=i[a]);this.isSharedTask&&this.removeResourceInfo(e)},I.prototype.dropAtTop=function(e){var t=this.parent;this.isSharedTask||(t.taskFields.parentID&&0<this.ganttData.length&&this.ganttData.splice(e,0,this.draggedRecord.taskData),this.treeGridData.splice(e,0,this.draggedRecord),this.parent.ids.splice(e,0,this.draggedRecord.ganttProperties.rowUniqueID.toString()),this.parent.setRecordValue("parentItem",this.droppedRecord.parentItem,this.draggedRecord),this.parent.setRecordValue("parentUniqueID",this.droppedRecord.parentUniqueID,this.draggedRecord),this.parent.setRecordValue("level",this.droppedRecord.level,this.draggedRecord),"ResourceView"===this.parent.viewType&&(t=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId,this.parent.getTaskIds().splice(e,0,t)),this.draggedRecord.hasChildRecords&&(this.updateChildRecord(this.draggedRecord,e),this.updateChildRecordLevel(this.draggedRecord,1)),this.droppedRecord.parentItem&&(e=(t=this.parent.getParentTask(this.droppedRecord.parentItem).childRecords).indexOf(this.droppedRecord),t.splice(e,0,this.draggedRecord)),ne.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem)))||this.updateParentRecords.push(this.draggedRecord.parentItem)},I.prototype.updateChildRecordLevel=function(e,t){if(t++,!e.hasChildRecords)return 0;for(var i=e.childRecords.length,a=0;a<i;a++){var n=e.childRecords[a],r=void 0;e.parentItem&&(r=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]),n.level=e.parentItem?r.level+t:e.level+1,this.parent.setRecordValue("level",n.level,n),n.hasChildRecords&&(t--,t=this.updateChildRecordLevel(n,t))}return t},I.prototype.updateChildRecord=function(e,t,i){var a=this.parent;if(!e.hasChildRecords)return 0;for(var n=e.childRecords.length,r=0;r<n;r++){var s,o=e.childRecords[r];t++,a.flatData.splice(t,0,o),this.parent.ids.splice(t,0,o.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType&&(s=(0===o.level?"R":"T")+o.ganttProperties.taskId,this.parent.getTaskIds().splice(t,0,s)),a.taskFields.parentID&&0<a.dataSource.length&&this.ganttData.splice(t,0,o.taskData),o.hasChildRecords&&(t=this.updateChildRecord(o,t))}return t},I.prototype.removeRecords=function(e){var t=this.parent,i=this.parent.dataSource instanceof D.DataManager?ne.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource,a=e,e=a&&a.parentItem?this.parent.getParentTask(a.parentItem):null;if(a){if(a.parentItem&&(l=[],o=0,l=e?e.childRecords:l)&&0<l.length&&("ResourceView"===this.parent.viewType&&1===l.length&&(this.parent.isOnDelete=!0,l[0].isDelete=!0,this.parent.dataOperation.updateParentItems(e),this.parent.isOnDelete=!1,l[0].isDelete=!1),o=l.indexOf(a),e.childRecords.splice(o,1),!this.parent.taskFields.parentID&&e.taskData[this.parent.taskFields.child]&&e.taskData[this.parent.taskFields.child].splice(o,1),this.updateParentRecords.push(e)),!this.parent.taskFields.parentID&&((l=[]).push(a.ganttProperties.taskId.toString()),"ProjectView"===this.parent.viewType||"ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition)&&this.parent.editModule.removeFromDataSource(l),t.taskFields.parentID){a.hasChildRecords&&0<a.childRecords.length&&this.removeChildItem(a);for(var n=void 0,r=0<i.length&&"ResourceView"!==this.parent.viewType?i:this.parent.updatedRecords,s=0;s<r.length;s++)"ResourceView"===this.parent.viewType?r[s].ganttProperties.rowUniqueID===a.ganttProperties.rowUniqueID&&(n=s):r[s][this.parent.taskFields.id]===a.taskData[this.parent.taskFields.id]&&(n=s);-1!==n&&(0<i.length&&i.splice(n,1),o=this.treeGridData.indexOf(a),this.treeGridData.splice(o,1),this.parent.ids.splice(o,1),-1!==this.parent.treeGrid.parentData.indexOf(a)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(a),1),"ResourceView"===this.parent.viewType)&&this.parent.getTaskIds().splice(n,1)}var o,l=this.treeGridData.indexOf(a);t.taskFields.parentID||(i=this.parent.editModule.getChildCount(a,0),this.treeGridData.splice(l,i+1),this.parent.ids.splice(l,i+1),-1!==(o=this.ganttData.indexOf(a.taskData))&&(this.ganttData.splice(o,1),this.parent.treeGrid.parentData.splice(o,1)),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(l,i+1)),a.parentItem&&e&&e.childRecords&&!e.childRecords.length&&(e.expanded=!1,e.hasChildRecords=!1)}},I.prototype.removeChildItem=function(e){for(var t,i=0;i<e.childRecords.length;i++){for(var a,n=e.childRecords[i],r=void 0,r=this.parent.dataSource instanceof D.DataManager?ne.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource,s=0;s<r.length;s++)r[s][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(t=s);-1!==t&&(0<r.length&&r.splice(t,1),a=this.treeGridData.indexOf(n),this.treeGridData.splice(a,1),this.parent.ids.splice(a,1),"ResourceView"===this.parent.viewType)&&this.parent.getTaskIds().splice(t,1),n.hasChildRecords&&this.removeChildItem(n)}},I.prototype.reorderRows=function(e,t,i){if(!this.parent.readOnly&&e[0]!==t&&("above"===i||"below"===i||"child"===i)){"above"===i&&(this.dropPosition="topSegment"),"below"===i&&(this.dropPosition="bottomSegment"),"child"===i&&(this.dropPosition="middleSegment");for(var a=void 0,n=(this.parent.undoRedoModule&&(a=ne.extend([],[],[this.parent.undoRedoModule.currentAction],!0)[0]),[]),r=0;r<e.length;r++)this.parent.undoRedoModule&&this.parent.undoRedoModule.isUndoRedoPerformed&&("RowDragAndDrop"===a.action||"TaskbarDragAndDrop"===a.action)?n[r]=a.beforeDrop[r].data:n[r]=this.parent.flatData[e[r]];i={data:n,dropIndex:t,dropPosition:this.dropPosition};this.dropRows(i,!0)}};var $a=I;function I(e){this.isTest=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.updateCollection={},this.isSharedTask=!1,this.canDrop=!0,this.parent=e,T.TreeGrid.Inject(T.RowDD),this.parent.treeGrid.allowRowDragAndDrop=this.parent.allowRowDragAndDrop,this.bindEvents()}Object.defineProperty(en.prototype,"style",{get:function(){return this.ganttStyle},enumerable:!0,configurable:!0}),en.prototype.setTheme=function(e,t){switch(this.initStyles(e),e.columnHeader.fontSize=9.5,e.columnHeader.fontColor=new re.PdfColor(0,0,0),e.columnHeader.fontColor.gray=.2,e.columnHeader.backgroundColor=new re.PdfColor(255,255,255),e.columnHeader.borderColor=new re.PdfColor(234,234,234),e.columnHeader.format.lineAlignment=1,e.columnHeader.format.alignment=0,e.fontFamily=re.PdfFontFamily.Helvetica,e.cell.fontSize=9.5,e.cell.backgroundColor=new re.PdfColor(255,255,255),e.cell.borderColor=new re.PdfColor(234,234,234),e.cell.fontColor=new re.PdfColor(0,0,0),e.cell.fontColor.gray=.2,e.cell.format.lineAlignment=1,e.cell.format.alignment=0,e.footer.fontSize=9.5,e.footer.fontStyle=0,e.footer.format.alignment=1,e.footer.format.lineAlignment=1,e.footer.borderColor=new re.PdfColor(235,235,235),e.timeline.fontSize=9.5,e.timeline.fontStyle=0,e.timeline.backgroundColor=new re.PdfColor(252,252,252),e.timeline.fontColor=new re.PdfColor(40,40,39),e.chartGridLineColor=new re.PdfColor(235,235,235),e.timeline.borderColor=new re.PdfColor(235,235,235),e.eventMarker.label.backgroundColor=new re.PdfColor(100,253,191),e.eventMarker.label.fontColor=new re.PdfColor(33,33,33),e.eventMarker.lineStyle=new re.PdfPen(new re.PdfColor(227,22,91)),e.eventMarker.lineStyle.dashStyle=re.PdfDashStyle.Dash,e.holiday.backgroundColor=new re.PdfColor(238,238,238),t){case"Bootstrap":e.taskbar.taskColor=new re.PdfColor(49,122,185),e.taskbar.progressColor=new re.PdfColor(33,82,125),e.taskbar.criticalTaskColor=new re.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new re.PdfColor(255,85,85),e.taskbar.baselineColor=new re.PdfColor(240,173,78),e.taskbar.baselineBorderColor=new re.PdfColor(240,173,78),e.criticalConnectorLineColor=new re.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new re.PdfColor(255,85,85),e.taskbar.parentTaskColor=new re.PdfColor(119,119,119),e.taskbar.parentProgressColor=new re.PdfColor(85,85,85),e.taskbar.taskBorderColor=new re.PdfColor(33,82,125),e.taskbar.parentTaskBorderColor=new re.PdfColor(85,85,85),e.taskbar.milestoneColor=new re.PdfColor(85,85,85),e.footer.fontColor=new re.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new re.PdfColor(33,82,125),e.footer.backgroundColor=new re.PdfColor(255,255,255),e.taskbar.progressFontColor=new re.PdfColor(255,255,255),e.label.fontColor=new re.PdfColor(0,0,0),e.taskbar.splitLineBackground=new re.PdfColor(51,51,51),e.taskbar.unscheduledTaskBarColor=new re.PdfColor(49,122,185),e.taskbar.manualParentBackground=new re.PdfColor(119,119,119),e.taskbar.manualParentProgress=new re.PdfColor(85,85,85),e.taskbar.manualChildBackground=new re.PdfColor(117,56,201),e.taskbar.manualChildProgress=new re.PdfColor(87,42,150),e.taskbar.manualLineColor=new re.PdfColor(152,154,156),e.taskbar.manualParentBorder=new re.PdfColor(85,85,85),e.taskbar.manualChildBorder=new re.PdfColor(87,42,150),e.eventMarker.label.backgroundColor=new re.PdfColor(138,109,59),e.eventMarker.label.fontColor=new re.PdfColor(252,248,227),e.eventMarker.lineStyle=new re.PdfPen(new re.PdfColor(49,122,185)),e.holiday.backgroundColor=new re.PdfColor(238,238,238);break;case"Bootstrap 4":e.taskbar.taskColor=new re.PdfColor(0,123,255),e.taskbar.progressColor=new re.PdfColor(0,86,179),e.taskbar.criticalTaskColor=new re.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new re.PdfColor(255,85,85),e.taskbar.baselineColor=new re.PdfColor(255,193,7),e.taskbar.baselineBorderColor=new re.PdfColor(255,193,7),e.criticalConnectorLineColor=new re.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new re.PdfColor(255,85,85),e.taskbar.parentTaskColor=new re.PdfColor(108,117,125),e.taskbar.parentProgressColor=new re.PdfColor(73,80,87),e.taskbar.taskBorderColor=new re.PdfColor(0,86,179),e.taskbar.parentTaskBorderColor=new re.PdfColor(73,80,87),e.taskbar.milestoneColor=new re.PdfColor(73,80,87),e.footer.fontColor=new re.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new re.PdfColor(0,86,179),e.footer.backgroundColor=new re.PdfColor(255,255,255),e.taskbar.progressFontColor=new re.PdfColor(255,255,255),e.label.fontColor=new re.PdfColor(33,37,41),e.taskbar.splitLineBackground=new re.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new re.PdfColor(0,123,255),e.taskbar.manualParentBackground=new re.PdfColor(108,117,125),e.taskbar.manualParentProgress=new re.PdfColor(73,80,87),e.taskbar.manualChildBackground=new re.PdfColor(133,83,241),e.taskbar.manualChildProgress=new re.PdfColor(102,40,238),e.taskbar.manualLineColor=new re.PdfColor(152,154,156),e.taskbar.manualParentBorder=new re.PdfColor(73,80,87),e.taskbar.manualChildBorder=new re.PdfColor(102,40,238),e.eventMarker.label.backgroundColor=new re.PdfColor(255,193,7),e.eventMarker.label.fontColor=new re.PdfColor(0,0,0),e.eventMarker.lineStyle=new re.PdfPen(new re.PdfColor(0,123,255)),e.holiday.backgroundColor=new re.PdfColor(233,236,239);break;case"Fabric":e.columnHeader.fontColor=new re.PdfColor(102,102,102),e.cell.fontColor=new re.PdfColor(51,51,51),e.taskbar.taskColor=new re.PdfColor(0,120,214),e.taskbar.progressColor=new re.PdfColor(0,91,163),e.taskbar.criticalTaskColor=new re.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new re.PdfColor(255,85,85),e.taskbar.baselineColor=new re.PdfColor(216,59,1),e.taskbar.baselineBorderColor=new re.PdfColor(216,59,1),e.criticalConnectorLineColor=new re.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new re.PdfColor(255,85,85),e.taskbar.parentTaskColor=new re.PdfColor(118,118,118),e.taskbar.parentProgressColor=new re.PdfColor(80,80,80),e.taskbar.taskBorderColor=new re.PdfColor(0,91,163),e.taskbar.parentTaskBorderColor=new re.PdfColor(80,80,80),e.taskbar.milestoneColor=new re.PdfColor(80,80,80),e.footer.fontColor=new re.PdfColor(51,51,51),e.footer.fontColor.gray=.2,e.connectorLineColor=new re.PdfColor(0,69,122),e.footer.backgroundColor=new re.PdfColor(255,255,255),e.taskbar.progressFontColor=new re.PdfColor(255,255,255),e.label.fontColor=new re.PdfColor(51,51,51),e.taskbar.splitLineBackground=new re.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new re.PdfColor(0,120,214),e.taskbar.manualParentBackground=new re.PdfColor(118,118,118),e.taskbar.manualParentProgress=new re.PdfColor(80,80,80),e.taskbar.manualChildBackground=new re.PdfColor(154,56,186),e.taskbar.manualChildProgress=new re.PdfColor(109,24,136),e.taskbar.manualLineColor=new re.PdfColor(152,154,156),e.taskbar.manualParentBorder=new re.PdfColor(80,80,80),e.taskbar.manualChildBorder=new re.PdfColor(109,24,136),e.eventMarker.label.backgroundColor=new re.PdfColor(202,232,255),e.eventMarker.label.fontColor=new re.PdfColor(0,90,158),e.eventMarker.lineStyle=new re.PdfPen(new re.PdfColor(0,120,214)),e.holiday.backgroundColor=new re.PdfColor(244,244,244);break;default:e.taskbar.taskColor=new re.PdfColor(88,105,197),e.taskbar.progressColor=new re.PdfColor(63,81,181),e.taskbar.criticalTaskColor=new re.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new re.PdfColor(255,85,85),e.taskbar.baselineColor=new re.PdfColor(193,87,0),e.taskbar.baselineBorderColor=new re.PdfColor(193,87,0),e.criticalConnectorLineColor=new re.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new re.PdfColor(255,85,85),e.taskbar.parentTaskColor=new re.PdfColor(132,132,132),e.taskbar.parentProgressColor=new re.PdfColor(97,97,97),e.taskbar.taskBorderColor=new re.PdfColor(63,81,181),e.taskbar.parentTaskBorderColor=new re.PdfColor(51,51,51),e.taskbar.milestoneColor=new re.PdfColor(97,97,97),e.footer.fontColor=new re.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new re.PdfColor(63,81,181),e.footer.backgroundColor=new re.PdfColor(255,255,255),e.taskbar.progressFontColor=new re.PdfColor(255,255,255),e.label.fontColor=new re.PdfColor(51,51,51),e.taskbar.splitLineBackground=new re.PdfColor(0,0,0),e.taskbar.unscheduledTaskBarColor=new re.PdfColor(63,81,181),e.taskbar.manualParentBackground=new re.PdfColor(97,97,97),e.taskbar.manualParentProgress=new re.PdfColor(97,97,97),e.taskbar.manualChildBackground=new re.PdfColor(0,135,134),e.taskbar.manualChildProgress=new re.PdfColor(0,135,134),e.taskbar.manualLineColor=new re.PdfColor(152,154,156),e.taskbar.manualParentBorder=new re.PdfColor(97,97,97),e.taskbar.manualChildBorder=new re.PdfColor(0,135,134),e.eventMarker.label.backgroundColor=new re.PdfColor(253,191,100),e.eventMarker.label.fontColor=new re.PdfColor(33,33,33),e.eventMarker.lineStyle=new re.PdfPen(new re.PdfColor(227,22,91)),e.holiday.backgroundColor=new re.PdfColor(238,238,238)}},en.prototype.initStyles=function(e){e.columnHeader={},e.columnHeader.format=new re.PdfStringFormat,e.cell={},e.cell.format=new re.PdfStringFormat,e.timeline={},e.footer={},e.footer.format=new re.PdfStringFormat,e.label={},e.taskbar={},e.eventMarker={},e.eventMarker.label={},e.eventMarker.lineStyle=new re.PdfPen(null),e.holiday={}};var Ja=en;function en(e){this.theme=e,this.ganttStyle={},this.setTheme(this.ganttStyle,this.theme),this.ganttStyle.eventMarker.lineStyle.dashStyle=re.PdfDashStyle.Dash}an.prototype.size=function(){return this.mKeys.length},an.prototype.add=function(e,t){if(null==e||null==t)throw new ReferenceError("Provided key or value is not valid.");if(this.mKeys.indexOf(e)<0)return this.mKeys.push(e),this.mValues.push(t),1;throw new RangeError("An item with the same key has already been added.")},an.prototype.keys=function(){return this.mKeys},an.prototype.values=function(){return this.mValues},an.prototype.getValue=function(e){if(null==e)throw new ReferenceError("Provided key is not valid.");e=this.mKeys.indexOf(e);if(e<0)throw new RangeError("No item with the specified key has been added.");return this.mValues[e]},an.prototype.setValue=function(e,t){if(null==e)throw new ReferenceError("Provided key is not valid.");var i=this.mKeys.indexOf(e);i<0?(this.mKeys.push(e),this.mValues.push(t)):this.mValues[i]=t},an.prototype.remove=function(e){if(null==e)throw new ReferenceError("Provided key is not valid.");e=this.mKeys.indexOf(e);if(e<0)throw new RangeError("No item with the specified key has been added.");return this.mKeys.splice(e,1),this.mValues.splice(e,1),!0},an.prototype.containsKey=function(e){if(null==e)throw new ReferenceError("Provided key is not valid.");return!(this.mKeys.indexOf(e)<0)},an.prototype.clear=function(){this.mKeys=[],this.mValues=[]};var tn=an;function an(){this.mKeys=[],this.mValues=[]}Object.defineProperty(rn.prototype,"left",{get:function(){return this.leftPen},set:function(e){this.leftPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(rn.prototype,"right",{get:function(){return this.rightPen},set:function(e){this.rightPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(rn.prototype,"top",{get:function(){return this.topPen},set:function(e){this.topPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(rn.prototype,"bottom",{get:function(){return this.bottomPen},set:function(e){this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(rn.prototype,"all",{set:function(e){this.leftPen=this.rightPen=this.topPen=this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(rn.prototype,"isAll",{get:function(){return this.leftPen===this.rightPen&&this.leftPen===this.topPen&&this.leftPen===this.bottomPen},enumerable:!0,configurable:!0}),Object.defineProperty(rn,"default",{get:function(){return new rn},enumerable:!0,configurable:!0});var nn=rn;function rn(){var e=new re.PdfPen(new re.PdfColor(0,0,0)),t=(e.dashStyle=re.PdfDashStyle.Solid,new re.PdfPen(new re.PdfColor(0,0,0))),i=(t.dashStyle=re.PdfDashStyle.Solid,new re.PdfPen(new re.PdfColor(0,0,0))),a=(i.dashStyle=re.PdfDashStyle.Solid,new re.PdfPen(new re.PdfColor(0,0,0)));a.dashStyle=re.PdfDashStyle.Solid,this.leftPen=e,this.rightPen=t,this.topPen=i,this.bottomPen=a}Object.defineProperty(on.prototype,"left",{get:function(){return this.leftPad},set:function(e){this.leftPad=e,this.hasLeftPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(on.prototype,"right",{get:function(){return this.rightPad},set:function(e){this.rightPad=e,this.hasRightPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(on.prototype,"top",{get:function(){return this.topPad},set:function(e){this.topPad=e,this.hasTopPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(on.prototype,"bottom",{get:function(){return this.bottomPad},set:function(e){this.bottomPad=e,this.hasBottomPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(on.prototype,"all",{set:function(e){this.leftPad=this.rightPad=this.topPad=this.bottomPad=e,this.hasLeftPad=!0,this.hasRightPad=!0,this.hasTopPad=!0,this.hasBottomPad=!0},enumerable:!0,configurable:!0});var sn=on;function on(e,t,i,a){this.hasLeftPad=!1,this.hasRightPad=!1,this.hasTopPad=!1,this.hasBottomPad=!1,void 0===e?(this.leftPad=this.rightPad=5.76,this.bottomPad=this.topPad=.5):(this.leftPad=e,this.rightPad=t,this.topPad=i,this.bottomPad=a,this.hasLeftPad=!0,this.hasRightPad=!0,this.hasTopPad=!0,this.hasBottomPad=!0)}function ln(){}var dn,hn,pn=function(){this.cellSpacing=0,this.borderOverlapStyle=re.PdfBorderOverlapStyle.Overlap,this.allowHorizontalOverflow=!1,this.horizontalOverflowType=k.PdfHorizontalOverflowType.LastPage,this.cellPadding=new sn},un=(dn=function(e,t){return(dn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)},function(e,t){function i(){this.constructor=e}dn(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),cn=(hn=re.ElementLayouter,un(gn,hn),Object.defineProperty(gn.prototype,"treegrid",{get:function(){return this.elements},enumerable:!0,configurable:!0}),gn.prototype.layoutInternal=function(e){this.currentPage=e.page;var t=e.format;return null!==this.currentPage&&(this.currentPageBounds=this.currentPage.getClientSize()),this.currentGraphics=this.currentPage.graphics,null!==t&&t.break===re.PdfLayoutBreakType.FitColumnsToPage?this.currentBounds=new re.RectangleF(new re.PointF(e.bounds.x,e.bounds.y),new re.SizeF(this.treegrid.columns.width,this.currentGraphics.clientSize.height)):this.currentBounds=new re.RectangleF(new re.PointF(e.bounds.x,e.bounds.y),this.currentGraphics.clientSize),0!==this.treegrid.rows.count&&(this.currentBounds.width=0<e.bounds.width?e.bounds.width:this.currentBounds.width-this.treegrid.rows.getRow(0).cells.getCell(0).style.borders.left.width/2),this.startLocation=new re.PointF(e.bounds.x,e.bounds.y),0<e.bounds.height&&(this.currentBounds.height=e.bounds.height),this.treegrid.style.allowHorizontalOverflow||this.treegrid.isFitToWidth?(this.treegrid.measureColumnsWidth(this.currentBounds),this.columnRanges.push([0,this.treegrid.columns.count-1])):(this.treegrid.measureColumnsWidth(),this.determineColumnDrawRanges()),this.layoutOnPage(e)},gn.prototype.determineColumnDrawRanges=function(){for(var e=0,t=0,i=0,a=this.treegrid.taskbar.isAutoFit()?oe(this.currentGraphics.clientSize.width)-this.currentBounds.x:this.currentGraphics.clientSize.width-this.currentBounds.x,n=0;n<this.treegrid.columns.count;n++)if(a<=(i+=this.treegrid.columns.getColumn(n).width)){for(var r=0,s=e;s<=n&&!(a<(r+=this.treegrid.columns.getColumn(s).width));s++)t=s;this.columnRanges.push([e,t]),e=t+1,t<=n&&(i=this.treegrid.columns.getColumn(n).width)}this.columnRanges.push([e,this.treegrid.columns.count-1])},gn.prototype.getFormat=function(e){return e},gn.prototype.updateCollection=function(e,t,i,a,n,r,s){null!=e&&(e=r,0<t.length&&(e=t[t.length-1].pageNumber),i.push({rowIndex:a,height:n,pageNumber:e+s}))},gn.prototype.layoutOnPage=function(e){for(var t=0,i=0,a=[],n=[],r=this.getFormat(e.format),s=new tn,o=e.page,l=0;l<this.columnRanges.length;l++){for(var d=this.columnRanges[l],h=(this.cellStartIndex=d[0],this.cellEndIndex=d[1],this.treegrid.rows.count),p=0,u=!1,c=0;c<h;c++){var g=this.treegrid.rows.getRow(c),f=(p++,this.currentBounds.y),m=(null===this.currentPage||s.containsKey(this.currentPage)||(a.push({height:t,pageNumber:i}),i++,t=0,s.add(this.currentPage,d)),this.drawRow(g));for(f===this.currentBounds.y?(u=!0,this.repeatRowIndex=this.treegrid.rows.rowCollection.indexOf(g)):(u=!1,this.repeatRowIndex=-1,this.updateCollection(this.currentPage,a,n,c,g.height,i,0));!m.isFinish&&null!==o;)if(this.treegrid.allowRowBreakAcrossPages)this.currentPage=this.getNextPageFormat(r),this.treegrid.enableHeader&&this.drawHeader(),this.checkBounds(r),m=this.drawRow(g),t+=g.height,this.updateCollection(this.currentPage,a,n,c,g.height,i,1);else{if(!this.treegrid.allowRowBreakAcrossPages&&p<length){this.currentPage=this.getNextPageFormat(r),this.treegrid.enableHeader&&this.drawHeader();break}if(p>=length)break}!m.isFinish&&null!==o&&r.layout!==re.PdfLayoutType.OnePage&&u&&(this.startLocation.x=this.currentBounds.x,this.currentPage=this.getNextPageFormat(r),this.treegrid.enableHeader&&this.drawHeader(),this.startLocation.y=this.currentBounds.y,r.paginateBounds===new re.RectangleF(0,0,0,0)?this.currentBounds.x+=this.startLocation.x:(f=this.currentBounds.x,this.currentBounds.x=f),this.currentBounds.x===nn.default.left.width/2&&(this.currentBounds.y+=this.startLocation.x),this.drawRow(g),null===this.currentPage||s.containsKey(this.currentPage)||s.add(this.currentPage,d),this.updateCollection(this.currentPage,a,n,c,g.height,i,0))}this.columnRanges.indexOf(d)<this.columnRanges.length-1&&null!==o&&r.layout!==re.PdfLayoutType.OnePage&&(this.currentPage=this.getNextPageFormat(r),this.checkBounds(r))}e=this.getLayoutResult(),this.treegrid.style.allowHorizontalOverflow&&this.treegrid.style.horizontalOverflowType===k.PdfHorizontalOverflowType.NextPage&&this.reArrangePages(s),a.push({height:t,pageNumber:i});var y={},D=(this.headerHeight=n[0].height,n.forEach(function(e){y[e.pageNumber]||(y[e.pageNumber]=[]),y[e.pageNumber].push(e.height)}),Object.keys(y).map(function(e){e=parseInt(e,10);return{pageNumber:e,totalHeight:y[e].reduce(function(e,t){return e+t},0)}}));return this.pageHeightCollection=D,e},gn.prototype.checkBounds=function(e){var t=new re.PointF(nn.default.right.width/2,nn.default.top.width/2);e.paginateBounds===new re.RectangleF(0,0,0,0)&&this.startLocation===t&&(this.currentBounds.x+=this.startLocation.x,this.currentBounds.y+=this.startLocation.y)},gn.prototype.drawHeader=function(){this.drawRow(this.treegrid.rows.getRow(0))},gn.prototype.reArrangePages=function(e){for(var t=this.currentPage.document,i=[],a=e.keys(),n=0;n<a.length;n++)(o=a[n]).section=null,i.push(o),t.pages.remove(o);for(n=0;n<e.size();n++)for(var r=e.size()/this.columnRanges.length,s=n;s<e.size();s+=r){var o=i[s];-1===t.pages.indexOf(o)&&t.pages.add(o)}},gn.prototype.getNextPageFormat=function(e){var t=this.currentPage.section,i=null,a=t.indexOf(this.currentPage),i=a===t.count-1?t.add():t.getPages()[a+1];return this.currentGraphics=i.graphics,this.currentBounds=new re.RectangleF(new re.PointF(0,0),i.getClientSize()),i},gn.prototype.getLayoutResult=function(){var e=new re.RectangleF(this.startLocation,new re.SizeF(this.currentBounds.width,this.currentBounds.y-this.startLocation.y));return new mn(this.currentPage,e)},gn.prototype.checkIfDefaultFormat=function(e){var t=new re.PdfStringFormat;return e.alignment===t.alignment&&e.characterSpacing===t.characterSpacing&&e.clipPath===t.clipPath&&e.firstLineIndent===t.firstLineIndent&&e.horizontalScalingFactor===t.horizontalScalingFactor&&e.lineAlignment===t.lineAlignment&&e.lineLimit===t.lineLimit&&e.lineSpacing===t.lineSpacing&&e.measureTrailingSpaces===t.measureTrailingSpaces&&e.noClip===t.noClip&&e.paragraphIndent===t.paragraphIndent&&e.rightToLeft===t.rightToLeft&&e.subSuperScript===t.subSuperScript&&e.wordSpacing===t.wordSpacing&&e.wordWrap===t.wordWrap},gn.prototype.drawRow=function(e,t,i){var a;if(ne.isNullOrUndefined(t))return a=new re.RowLayoutResult,(i=0<e.rowBreakHeight?e.rowBreakHeight:e.height)>this.currentPageBounds.height?this.treegrid.allowRowBreakAcrossPages?(a.isFinish=!0,this.drawRowWithBreak(a,e,i)):(a.isFinish=!1,this.drawRow(e,a,i)):this.currentBounds.y+i>this.currentPageBounds.height||this.currentBounds.y+i>this.currentBounds.height?-1<this.repeatRowIndex&&this.repeatRowIndex===e.rowIndex?this.treegrid.allowRowBreakAcrossPages?(a.isFinish=!0,this.drawRowWithBreak(a,e,i)):(a.isFinish=!1,this.drawRow(e,a,i)):a.isFinish=!1:(a.isFinish=!0,this.drawRow(e,a,i)),a;var n=new re.PointF(this.currentBounds.x,this.currentBounds.y),r=(t.bounds=new re.RectangleF(n,new re.SizeF(0,0)),0);i=this.reCalculateHeight(e,i);for(var s=this.cellStartIndex;s<=this.cellEndIndex;s++){var o=e.cells.getCell(s),l=this.treegrid.columns.getColumn(s);if(!ne.isNullOrUndefined(o.value)){l.isTreeColumn&&(r=e.level);var d=1<o.columnSpan&&s>this.cellEndIndex+1;if(!d)for(var h=1;h<o.columnSpan;h++)e.cells.getCell(s+h).isCellMergeContinue=!0;var p=new re.SizeF(l.width,i);1<o.columnSpan&&(p=new re.SizeF(o.width,i),s+=o.columnSpan),!this.checkIfDefaultFormat(l.format)&&this.checkIfDefaultFormat(o.style.format)&&(o.style.format=l.format),o.draw(this.currentGraphics,new re.RectangleF(n,p),d,r),e.treegrid.style.allowHorizontalOverflow&&(o.columnSpan>this.cellEndIndex||s+o.columnSpan>this.cellEndIndex+1)&&this.cellEndIndex<e.cells.count-1&&(e.rowOverflowIndex=this.cellEndIndex),n.x+=l.width,r=0}}return this.currentBounds.y+=i,t.bounds=new re.RectangleF(new re.PointF(t.bounds.x,t.bounds.y),new re.SizeF(n.x,n.y)),null},gn.prototype.drawRowWithBreak=function(e,t,i){var a=new re.PointF(this.currentBounds.x,this.currentBounds.y),n=(e.bounds=new re.RectangleF(a,new re.SizeF(0,0)),0);this.treegridHeight=this.currentBounds.height,t.rowBreakHeight=this.currentBounds.y+i-this.currentBounds.height;for(var r=0;r<t.cells.count;r++)(l=t.cells.getCell(r)).measureHeight()===i&&null===l.value&&(t.rowBreakHeight=this.currentBounds.y+i-this.currentBounds.height);for(var s=this.cellStartIndex;s<=this.cellEndIndex;s++){var o=this.treegrid.columns.getColumn(s);o.isTreeColumn&&(n=10*t.level);var l,d=(l=t.cells.getCell(s)).columnSpan+s>this.cellEndIndex+1&&1<l.columnSpan;if(!d)for(var h=1;h<l.columnSpan;h++)t.cells.getCell(s+h).isCellMergeContinue=!0;var p=0<this.treegridHeight?this.treegridHeight:this.currentBounds.height,p=new re.SizeF(o.width,p);!this.checkIfDefaultFormat(o.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=o.format),l.draw(this.currentGraphics,new re.RectangleF(a,p),d,n),e.isFinish=e.isFinish&&l.finishedDrawingCell,a.x+=o.width,this.currentBounds.y+=(n=0)<this.treegridHeight?this.treegridHeight:i,e.bounds=new re.RectangleF(new re.PointF(e.bounds.x,e.bounds.y),new re.SizeF(a.x,a.y))}},gn.prototype.reCalculateHeight=function(e,t){for(var i=0,a=this.cellStartIndex;a<=this.cellEndIndex;a++)ne.isNullOrUndefined(e.cells.getCell(a).remainingString)&&""!==e.cells.getCell(a).remainingString||(i=Math.max(i,e.cells.getCell(a).measureHeight()));return Math.max(t,i)},gn);function gn(e){e=hn.call(this,e)||this;return e.columnRanges=[],e.repeatRowIndex=-1,e.pageHeightCollection=[],e.headerHeight=0,e.currentBounds=new re.RectangleF(0,0,0,0),e}fn=re.PdfLayoutResult,un(yn,fn);var fn,mn=yn;function yn(e,t){return fn.call(this,e,t)||this}Dn=re.PdfLayoutFormat,un(bn,Dn);var Dn,kn=bn;function bn(e){return void 0===e?Dn.call(this)||this:Dn.call(this,e)||this}wn=function(e,t){return(wn=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var wn,Tn,un=function(e,t){function i(){this.constructor=e}wn(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},vn=(Tn=re.PdfLayoutElement,un(Sn,Tn),Object.defineProperty(Sn.prototype,"size",{get:function(){return 0===this.treeGridSize.width&&0===this.treeGridSize.height&&(this.treeGridSize=this.calculateTreeGridSize()),this.treeGridSize},set:function(e){this.treeGridSize=e},enumerable:!0,configurable:!0}),Sn.prototype.draw=function(e,t,i,a){var n;return t instanceof re.PointF&&void 0===t.width&&void 0===i?this.drawHelper(e,t.x,t.y):"number"==typeof t&&"number"==typeof i&&void 0===a?this.drawHelper(e,t,i,null):t instanceof re.RectangleF&&void 0!==t.width&&void 0===i?this.drawHelper(e,t,null):t instanceof re.PointF&&void 0===t.width&&i instanceof re.PdfLayoutFormat?this.drawHelper(e,t.x,t.y,i):"number"==typeof t&&"number"==typeof i&&(a instanceof re.PdfLayoutFormat||null===a)?(n=e.graphics.clientSize.width-t,n=new re.RectangleF(t,i,n,0),this.drawHelper(e,n,a)):t instanceof re.RectangleF&&void 0!==t.width&&"boolean"==typeof i?this.drawHelper(e,t,null):this.drawHelper(e,t,i)},Sn.prototype.measureColumnsWidth=function(e){if(void 0!==e)for(var t=this.columns.getDefaultWidths(e.width-e.x),i=0;i<this.columns.count;i++)this.columns.getColumn(i).width<0&&(this.columns.getColumn(i).width=t[i]);else{for(var t=[],a=0,n=0,r=this.columns.count,i=0;i<r;i++){for(var s=this.rows.count,o=0;o<s;o++){var l=this.rows.getRow(o).cells.getCell(i).width,l=0<this.initialWidth?Math.min(this.initialWidth,l):l,a=Math.max(a,l);a=Math.max(this.columns.getColumn(i).width,a),this.columns.getColumn(i).isTreeColumn&&(n=Math.max(n,this.rows.getRow(o).level))}this.columns.getColumn(i).isTreeColumn?t.push(a+10*n):t.push(a),a=0}for(i=0;i<this.columns.count;i++)this.columns.getColumn(i).width<0&&(this.columns.getColumn(i).width=t[i])}},Sn.prototype.calculateTreeGridSize=function(){for(var e=0,t=this.columns.width,i=0;i<this.headers.count;i++)e+=this.headers.getHeader(i).height;for(i=0;i<this.rows.count;i++)e+=this.rows.getRow(i).height;return new re.SizeF(t,e)},Sn.prototype.drawGrid=function(e,t,i,a){this.initialWidth=e.graphics.clientSize.width;var n=new re.RectangleF(0,0,e.getClientSize().height,0);return this.draw(e,n,a)},Sn.prototype.layout=function(e){var t,i;return 0!==this.rows.count&&(t=0!==this.rows.getRow(0).cells.count?this.rows.getRow(0).cells.getCell(0).style:null,ne.isNullOrUndefined(t)||1===t.borders.left.width||(i=t.borders.left.width/2,t=t.borders.top.width/2,e.bounds.x===nn.default.right.width/2&&e.bounds.y===nn.default.right.width/2&&(i=new re.RectangleF(new re.PointF(i,t),new re.SizeF(this.size.width,this.size.height)),e.bounds=i))),this.layouter=new cn(this),this.layouter.layoutInternal(e)},Sn);function Sn(){var e=Tn.call(this)||this;return e.treeGridSize=new re.SizeF(0,0),e.treeColumnIndex=0,e.allowRowBreakAcrossPages=!0,e.enableHeader=!0,e.isFitToWidth=!1,e.columns=new Vn(e),e.rows=new In(e),e.headers=new Fn(e),e.style=new pn,e.rowHeight=0,e}Object.defineProperty(Cn.prototype,"height",{get:function(){return 0===this.cellHeight&&(this.cellHeight=this.measureHeight()),this.cellHeight},set:function(e){this.cellHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(Cn.prototype,"width",{get:function(){return 0===this.cellWidth&&(this.cellWidth=this.measureWidth()),Math.round(this.cellWidth)},set:function(e){this.cellWidth=e},enumerable:!0,configurable:!0}),Cn.prototype.measureWidth=function(){var e,t=0,i=new re.PdfStringLayouter;return"string"==typeof this.value&&(e=new re.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),e=this.row.isParentRow?new re.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,re.PdfFontStyle.Bold):new re.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),this.row.treegrid.ganttStyle.font&&(e=this.row.treegrid.ganttStyle.font),t=(t+=i.layout(this.value,e,this.style.format,new re.SizeF(Number.MAX_VALUE,Number.MAX_VALUE),!1,new re.SizeF(0,0)).actualSize.width)+2*(this.style.borders.left.width+this.style.borders.right.width)),void 0!==this.row.treegrid.style.cellPadding.left&&this.row.treegrid.style.cellPadding.hasLeftPad&&(t+=this.row.treegrid.style.cellPadding.left),void 0!==this.row.treegrid.style.cellPadding.right&&this.row.treegrid.style.cellPadding.hasRightPad&&(t+=this.row.treegrid.style.cellPadding.right),t+=this.row.treegrid.style.cellSpacing},Cn.prototype.measureHeight=function(){var e,t,i=this.row.treegrid.rowHeight,a=0,n=this.calculateWidth(),r=(n=(n-=this.row.treegrid.style.cellPadding.right+this.row.treegrid.style.cellPadding.left)-(this.style.borders?this.style.borders.left.width+this.style.borders.right.width:0),new re.PdfStringLayouter);return"string"!=typeof this.value&&"string"!=typeof this.remainingString||(e=this.value,this.finishedDrawingCell||(e=ne.isNullOrUndefined(this.remainingString)||""===this.remainingString?this.value:this.remainingString),t=null,t=this.row.isParentRow?new re.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,re.PdfFontStyle.Bold):new re.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),this.row.treegrid.ganttStyle.font&&(t=this.row.treegrid.ganttStyle.font),r=r.layout(e,t,this.style.format,new re.SizeF(n-10,0),!1,new re.SizeF(0,0)),t=Math.max(r.lineHeight,r.actualSize.height),80<e.length?a+=t+20:a+=t+r.size.height/2,a+=2*(this.style.borders.top.width+this.style.borders.bottom.width)),i<(a=(a+=this.row.treegrid.style.cellPadding.top+this.row.treegrid.style.cellPadding.bottom)+this.row.treegrid.style.cellSpacing)?a:i},Cn.prototype.calculateWidth=function(){for(var e=this.row.cells.indexOf(this),t=this.columnSpan,i=0,a=0;a<t;a++)i+=this.row.treegrid.columns.getColumn(e+a)?this.row.treegrid.columns.getColumn(e+a).width:0;return this.row.treegrid.columns.getColumn(e)&&this.row.treegrid.columns.getColumn(e).isTreeColumn&&(i-=10*this.row.level),i},Cn.prototype.draw=function(e,t,i,a){var n,r,s,o,l,d=null,h=(this.drawCellBackground(e,t),new re.PdfSolidBrush(this.style.fontColor)),p=null,p=this.row.isParentRow?(u=re.PdfFontStyle.Bold,this.style.fontStyle&&(u=this.style.fontStyle),new re.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,u)):new re.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),u=(this.row.treegrid.ganttStyle.font&&(p=this.row.treegrid.ganttStyle.font),t);return this.isHeaderCell||(u.x=u.x,u.width=u.width),u.height>=e.clientSize.height&&(this.row.treegrid.allowRowBreakAcrossPages?(u.height-=u.y,t.height-=t.y):(u.height=e.clientSize.height,t.height=e.clientSize.height)),u=this.adjustContentLayoutArea(u),this.image&&this.value?(l=void 0,l=this.image.width<=u.width?new re.RectangleF(u.x+a,u.y-this.style.padding.bottom,this.image.width,this.image.height):u,e.drawImage(this.image,l.x+a,l.y-5,l.width,l.height),n=null,r=void 0,o=(o=this.fontStyle)||this.style,s=new re.PdfStandardFont(o.fontFamily,o.fontSize,o.fontStyle),r=o.fontFamily?s:p,o=h,this.row.treegrid.ganttStyle.cell.fontBrush&&(o=new re.PdfSolidBrush(this.row.treegrid.ganttStyle.cell.fontBrush)),this.row.treegrid.ganttStyle.cell.format.alignment&&!this.isHeaderCell&&(this.style.format.alignment=this.row.treegrid.ganttStyle.cell.format.alignment),this.finishedDrawingCell?(n=""===this.remainingString?this.remainingString:this.value,e.drawString(n,r,null,o,u.x+a+(l.width?l.width+8:0),this.isHeaderCell?u.y-16:u.y-this.style.padding.bottom,u.width-a-10,u.height-10,this.style.format)):e.drawString(this.remainingString,r,null,o,u.x+a,this.isHeaderCell?u.y-16:u.y,this.style.format),d=e.stringLayoutResult):"string"==typeof this.value||"string"==typeof this.remainingString?(n=null,r=void 0,s=new re.PdfStandardFont(this.style.fontFamily,this.style.fontSize,this.style.fontStyle),r=this.style.fontFamily?s:p,o=h,this.row.treegrid.ganttStyle.cell.fontBrush&&(o=new re.PdfSolidBrush(this.row.treegrid.ganttStyle.cell.fontBrush)),this.row.treegrid.ganttStyle.cell.format.alignment&&!this.isHeaderCell&&(this.style.format.alignment=this.row.treegrid.ganttStyle.cell.format.alignment),this.finishedDrawingCell?(n=""===this.remainingString?this.remainingString:this.value,e.drawString(n,r,null,o,u.x+a,this.isHeaderCell?u.y-16:u.y-this.style.padding.bottom-3,u.width-a-10,u.height-10,this.style.format)):e.drawString(this.remainingString,r,null,o,u.x+a,this.isHeaderCell?u.y-16:u.y,this.style.format),d=e.stringLayoutResult):this.value instanceof re.PdfImage||this.value instanceof re.PdfBitmap?(l=void 0,l=this.value.width<=u.width?new re.RectangleF(u.x,u.y,this.value.width,u.height):u,e.drawImage(this.value,l.x,l.y-10,l.width,l.height)):this.value instanceof re.PdfTextWebLink&&this.value.draw(e.currentPage,u),null!==this.style.borders&&this.drawCellBorder(e,t),d},Cn.prototype.drawCellBackground=function(e,t){var i=new re.PdfSolidBrush(this.style.backgroundColor);null!==i&&(e.save(),e.drawRectangle(i,t.x,t.y,t.width,t.height),e.restore())},Cn.prototype.adjustContentLayoutArea=function(e){var t,e=new re.RectangleF(new re.PointF(e.x,e.y),new re.SizeF(e.width,e.height)),i=this.style.padding;return this.value instanceof vn?(t=this.value.size,this.style.format.alignment===re.PdfTextAlignment.Center?(e.x+=i.left+(e.width-t.width)/2,e.y+=i.top+(e.height-t.height)/2):this.style.format.alignment===re.PdfTextAlignment.Left?(e.x+=i.left,e.y+=i.top):this.style.format.alignment===re.PdfTextAlignment.Right&&(e.x+=i.left+(e.width-t.width),e.y+=i.top)):(e.x+=i.left,e.y+=i.top),e},Cn.prototype.drawCellBorder=function(e,t){var i,a,n;this.row.treegrid.style.borderOverlapStyle===re.PdfBorderOverlapStyle.Inside&&(t.x+=this.style.borders.left.width,t.y+=this.style.borders.top.width,t.width-=this.style.borders.right.width,t.height-=this.style.borders.bottom.width),this.style.borders.isAll&&this.isHeaderCell?e.drawRectangle(this.style.borders.left,t.x,t.y,t.width,t.height):(i=new re.PointF(t.x,t.y+t.height),a=new re.PointF(t.x,t.y),(n=this.style.borders.left).lineCap=this.style.borders.left.dashStyle===re.PdfDashStyle.Solid?re.PdfLineCap.Square:n.lineCap,e.drawLine(n,i,a),e.restore(),i=new re.PointF(t.x+t.width,t.y),a=new re.PointF(t.x+t.width,t.y+t.height),n=this.style.borders.right,t.x+t.width>e.clientSize.width-n.width/2&&(i=new re.PointF(e.clientSize.width-n.width/2,t.y),a=new re.PointF(e.clientSize.width-n.width/2,t.y+t.height)),n.lineCap=this.style.borders.right.dashStyle===re.PdfDashStyle.Solid?re.PdfLineCap.Square:n.lineCap,e.drawLine(n,i,a),e.restore(),i=new re.PointF(t.x,t.y),a=new re.PointF(t.x+t.width,t.y),(n=this.style.borders.top).lineCap=this.style.borders.top.dashStyle===re.PdfDashStyle.Solid?re.PdfLineCap.Square:n.lineCap,e.drawLine(n,i,a),e.restore(),i=new re.PointF(t.x+t.width,t.y+t.height),a=new re.PointF(t.x,t.y+t.height),n=this.style.borders.bottom,t.y+t.height>e.clientSize.height-n.width/2&&(i=new re.PointF(t.x+t.width,e.clientSize.height-n.width/2),a=new re.PointF(t.x,e.clientSize.height-n.width/2)),n.lineCap=this.style.borders.bottom.dashStyle===re.PdfDashStyle.Solid?re.PdfLineCap.Square:n.lineCap,e.drawLine(n,i,a)),e.restore()};var Pn=Cn;function Cn(e){this.cellWidth=0,this.cellHeight=0,this.finishedDrawingCell=!0,ne.isNullOrUndefined(e)?(this.rowSpan=1,this.columnSpan=1):this.row=e,this.style={}}Mn.prototype.getCell=function(e){if(e<0||e>=this.count)throw new Error("IndexOutOfRangeException");return this.cells[e]},Object.defineProperty(Mn.prototype,"count",{get:function(){return this.cells.length},enumerable:!0,configurable:!0}),Mn.prototype.add=function(e){var t;if(void 0===e)return t=new Pn,this.add(t),e;e.row=this.treegridRow,this.cells.push(e)},Mn.prototype.indexOf=function(e){return this.cells.indexOf(e)};var Rn=Mn;function Mn(e){this.treegridRow=e,this.cells=[]}Object.defineProperty(xn.prototype,"cells",{get:function(){return ne.isNullOrUndefined(this.treegridCells)&&(this.treegridCells=new Rn(this)),this.treegridCells},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"isParentRow",{get:function(){return this._isParentRow},set:function(e){this._isParentRow=e},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"treegrid",{get:function(){return this.pdfTreeGrid},set:function(e){this.pdfTreeGrid=e},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"rowBreakHeight",{get:function(){return void 0===this.treegridRowBreakHeight&&(this.treegridRowBreakHeight=0),this.treegridRowBreakHeight},set:function(e){this.treegridRowBreakHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"rowOverflowIndex",{get:function(){return this.treegridRowOverflowIndex},set:function(e){this.treegridRowOverflowIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"level",{get:function(){return this.intendLevel},set:function(e){this.intendLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"height",{get:function(){return 0===this.rowHeight&&(this.rowHeight=this.measureHeight()),this.rowHeight},set:function(e){this.rowHeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"width",{get:function(){return 0===this.rowWidth&&(this.rowWidth=this.measureWidth()),this.rowWidth},enumerable:!0,configurable:!0}),Object.defineProperty(xn.prototype,"rowIndex",{get:function(){return this.treegrid.rows.rowCollection.indexOf(this)},enumerable:!0,configurable:!0}),xn.prototype.measureWidth=function(){for(var e=this.treegrid.columns.columns,t=0,i=0;i<e.length;i++)t+=e[i].width;return t},xn.prototype.measureHeight=function(){for(var e=0===this.cells.count||ne.isNullOrUndefined(this.cells.getCell(0).height)?33:this.cells.getCell(0).height,t=0;t<this.cells.count;t++){var i=this.cells.getCell(t),e=1===i.columnSpan||1===i.rowSpan?Math.max(e,i.height):Math.min(e,i.height);i.height=e}return e};var On=xn;function xn(e){this.treegridRowOverflowIndex=0,this.rowHeight=0,this.rowWidth=0,this._isParentRow=!1,this.intendLevel=0,this.pdfTreeGrid=e}Object.defineProperty(En.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),Object.defineProperty(En.prototype,"rowCollection",{get:function(){return this.rows},enumerable:!0,configurable:!0}),En.prototype.addRow=function(e){var t;if(void 0===e)return t=new On(this.treegrid),this.addRow(t),t;if(0===e.cells.count)for(var i=0;i<this.treegrid.columns.count;i++)e.cells.add(new Pn);this.rows.push(e)},En.prototype.getRow=function(e){return this.rows[e]};var In=En;function En(e){this.rows=[],this.treegrid=e}Un.prototype.getHeader=function(e){return this.rows[e]},Object.defineProperty(Un.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),Un.prototype.add=function(e){this.rows.push(e)},Un.prototype.indexOf=function(e){return this.rows.indexOf(e)};var Fn=Un;function Un(e){this.rows=[],this.treegrid=e,this.rows=[]}Object.defineProperty(Ln.prototype,"headerText",{get:function(){return this._headerText},set:function(e){this._headerText=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"field",{get:function(){return this._field},set:function(e){this._field=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"width",{get:function(){return this.columnWidth},set:function(e){this.columnWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"isTreeColumn",{get:function(){return this.treeColumnIndex},set:function(e){this.treeColumnIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ln.prototype,"format",{get:function(){return ne.isNullOrUndefined(this.stringFormat)&&(this.stringFormat=new re.PdfStringFormat),this.stringFormat},set:function(e){this.stringFormat=e},enumerable:!0,configurable:!0});var Nn=Ln;function Ln(e){this.columnWidth=0,this.treeColumnIndex=!1,this._headerText="",this._field="",this.treegrid=e}Bn.prototype.add=function(e){for(var t=0;t<e;t++){this.internalColumns.push(new Nn(this.treegrid));for(var i=0;i<this.treegrid.rows.count;i++){var a=this.treegrid.rows.getRow(i),n=new Pn;n.value="",a.cells.add(n)}}},Object.defineProperty(Bn.prototype,"count",{get:function(){return this.internalColumns.length},enumerable:!0,configurable:!0}),Object.defineProperty(Bn.prototype,"width",{get:function(){return 0===this.columnWidth&&(this.columnWidth=this.measureColumnsWidth()),this.columnWidth},enumerable:!0,configurable:!0}),Object.defineProperty(Bn.prototype,"columns",{get:function(){return this.internalColumns},enumerable:!0,configurable:!0}),Bn.prototype.getColumn=function(e){if(0<=e&&e<=this.columns.length)return this.columns[e];throw Error("can not get the column from the index: "+e)},Bn.prototype.measureColumnsWidth=function(){var e=0;this.treegrid.measureColumnsWidth();for(var t=0,i=this.internalColumns.length;t<i;t++)e+=this.internalColumns[t].width;return e},Bn.prototype.getDefaultWidths=function(e){for(var t=[],i=this.count,a=0;a<this.count;a++)t[a]=this.internalColumns[a].width,0<this.internalColumns[a].width?(e-=this.internalColumns[a].width,i--):t[a]=0;for(a=0;a<this.count;a++)t[a]<=0&&(t[a]=e/i);return t};var Vn=Bn;function Bn(e){this.internalColumns=[],this.columnWidth=0,this.treegrid=e,this.internalColumns=[]}var An=function(){return(An=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Wn=(E.prototype.processToFit=function(){this.beforeSinglePageExport.zoomingProjectStartDate=this.parent.zoomingProjectStartDate,this.beforeSinglePageExport.zoomingProjectEndDate=this.parent.zoomingProjectEndDate,this.beforeSinglePageExport.cloneProjectStartDate=this.parent.cloneProjectStartDate,this.beforeSinglePageExport.cloneProjectEndDate=this.parent.cloneProjectEndDate,this.beforeSinglePageExport.customTimelineSettings=ne.extend({},this.parent.timelineModule.customTimelineSettings,null,!0),this.beforeSinglePageExport.isTimelineRoundOff=this.parent.isTimelineRoundOff,this.beforeSinglePageExport.topTier=this.parent.timelineModule.topTier,this.beforeSinglePageExport.topTierCellWidth=this.parent.timelineModule.topTierCellWidth,this.beforeSinglePageExport.topTierCollection=this.parent.timelineModule.topTierCollection,this.beforeSinglePageExport.bottomTier=this.parent.timelineModule.bottomTier,this.beforeSinglePageExport.bottomTierCellWidth=this.parent.timelineModule.bottomTierCellWidth,this.beforeSinglePageExport.bottomTierCollection=this.parent.timelineModule.bottomTierCollection,this.beforeSinglePageExport.totalTimelineWidth=this.parent.timelineModule.totalTimelineWidth,this.beforeSinglePageExport.timelineStartDate=this.parent.timelineModule.timelineStartDate,this.beforeSinglePageExport.timelineEndDate=this.parent.timelineModule.timelineEndDate,this.beforeSinglePageExport.timelineRoundOffEndDate=this.parent.timelineModule.timelineRoundOffEndDate,this.beforeSinglePageExport.perDayWidth=this.parent.perDayWidth,this.beforeSinglePageExport.updatedConnectorLineCollection=ne.extend([],this.parent.updatedConnectorLineCollection,null,!0),this.parent.timelineModule.isZoomToFit=!0,this.parent.timelineModule.isZooming=!1,this.parent.zoomingProjectStartDate||(this.parent.zoomingProjectStartDate=this.parent.cloneProjectStartDate,this.parent.zoomingProjectEndDate=this.parent.cloneProjectEndDate),this.parent.zoomingProjectStartDate>this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=new Date(this.parent.allowUnscheduledTasks?this.parent.zoomingProjectStartDate:this.parent.cloneProjectStartDate)),ne.isNullOrUndefined(this.parent.projectStartDate)&&ne.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.dataOperation.calculateProjectDates();var e,t,i,a=(this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5,n=(this.exportProps.fitToWidthSettings.gridWidth&&(r=100<(r=parseInt(this.exportProps.fitToWidthSettings.gridWidth.split("%")[0],10))?100:r),this.exportProps.fitToWidthSettings.chartWidth?100<(n=parseInt(this.exportProps.fitToWidthSettings.chartWidth.split("%")[0],10))?100:n:this.exportProps.fitToWidthSettings.gridWidth?100-r:70),r=this.parent.pdfExportModule.pdfPageDimensions.width*n/100,s=r/a,o=this.parent.zoomingLevels.slice().sort(function(e,t){return e.perDayWidth||t.perDayWidth?e.perDayWidth<t.perDayWidth?1:-1:0});if(0!=s){for(var l=0;l<o.length;l++){if(t=o[l],l===o.length-1){e=o[l];break}if(i=o[l+1],s>=t.perDayWidth){e=o[l];break}if(s<t.perDayWidth&&s>i.perDayWidth){e=o[l+1];break}}var n=ne.extend({},{},e,!0),a=(ne.isNullOrUndefined(this.parent.projectStartDate)&&this.parent.timelineModule.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,s,n.bottomTier.unit,e),ne.isNullOrUndefined(this.parent.projectEndDate)&&this.parent.timelineModule.roundOffDateToZoom(this.parent.cloneProjectEndDate,!1,s,n.bottomTier.unit,e),this.parent.timelineModule.calculateNumberOfTimelineCells(n)),d=this.parent.pdfExportModule.pdfPageDimensions.height;n.timelineUnitSize=Math.abs(r-(d<=0?0:17))/a,this.parent.timelineModule.changeTimelineSettings(n),this.parent.timelineModule.isZoomToFit=!1,this.parent.timelineModule.isZooming=!1}},E.prototype.processGridExport=function(e,t,i){this.flatData=e,this.gantt=t,this.exportValueFormatter=new jn(this.parent.locale),this.exportProps=i,this.rowIndex=0,this.colIndex=0,this.columns=this.parent.treeGrid.columns,this.gantt.treeColumnIndex=this.parent.treeColumnIndex,this.gantt.rowHeight=se(this.parent.rowHeight),this.gantt.style.cellPadding.left=0,this.gantt.style.cellPadding.right=0,this.ganttStyle=this.gantt.ganttStyle,this.gantt.borderColor=this.ganttStyle.chartGridLineColor,this.parent.pdfExportModule.isPdfExport=!0,this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth&&this.processToFit(),this.processHeaderContent(),this.processGanttContent(),this.processTimeline(),this.processTaskbar(),this.processPredecessor(),this.parent.pdfExportModule.isPdfExport=!1},E.prototype.processHeaderContent=function(){var t=this,i=(this.rowIndex++,this.row=this.gantt.rows.addRow(),0);this.columns.forEach(function(e){t.isColumnVisible(e)&&(t.processColumnHeader(e,i),i++)})},E.prototype.processColumnHeader=function(e,t){this.gantt.columns.add(1);var i=this.gantt.columns.getColumn(t),a=(this.columns[this.parent.treeColumnIndex].field===e.field&&(i.isTreeColumn=!0),parseInt(e.width,10)),a=(i.width=se(a),this.totalColumnWidth+=i.width,i.headerText=e.headerText,i.field=e.field,this.row.cells.getCell(t)),i=(a.value=e.headerText,a.isHeaderCell=!0,this.ganttStyle&&this.ganttStyle.columnHeader&&!ne.isNullOrUndefined(this.ganttStyle.columnHeader.fontBrush)&&(a.style.fontBrush=new re.PdfColor(this.ganttStyle.columnHeader.fontBrush)),this.parent.timelineModule.isSingleTier?45:60),t=(this.copyStyles(this.ganttStyle.columnHeader,a,!1),this.row.height=se(i),e.headerTextAlign&&(a.style.format.alignment=re.PdfTextAlignment[e.headerTextAlign]),a.fontStyle={fontSize:9},{cell:a,style:a.style,value:a.value,column:e,image:null,headerTemplate:{image:null,value:null,fontStyle:{fontBrush:null}}});this.parent.pdfColumnHeaderQueryCellInfo&&this.parent.trigger("pdfColumnHeaderQueryCellInfo",t),t.headerTemplate.image&&t.headerTemplate.value?(t.image=new re.PdfBitmap(t.headerTemplate.image[0].base64),t.image.height=t.headerTemplate.image[0].height||t.image.height,t.image.width=t.headerTemplate.image[0].width||t.image.width,a.image=t.image,a.value=t.headerTemplate.value,a.fontStyle.fontSize=t.headerTemplate.fontStyle.fontSize,a.fontStyle.fontFamily=t.headerTemplate.fontStyle.fontFamily,a.fontStyle.fontBrush=t.headerTemplate.fontStyle.fontColor):a.value=t.value},E.prototype.isColumnVisible=function(e){return e.visible||this.exportProps.includeHiddenColumn},E.prototype.processGanttContent=function(){var t=this;0===this.flatData.length?this.renderEmptyGantt():this.flatData.forEach(function(e){t.row=t.gantt.rows.addRow(),e.hasChildRecords&&(t.gantt.rows.getRow(t.rowIndex).isParentRow=!0),t.processRecordRow(e),t.rowIndex++})},E.prototype.processTimeline=function(){this.parent.enableTimelineVirtualization&&(this.parent.timelineModule.pdfExportTopTierCollection=[],this.parent.timelineModule.pdfExportBottomTierCollection=[],this.parent.timelineModule.createTimelineSeries());var e,t=this.parent.timelineModule;this.gantt.chartHeader.topTierHeight=this.gantt.chartHeader.bottomTierHeight=this.parent.timelineModule.isSingleTier?45:30,this.gantt.chartHeader.topTierCellWidth=t.topTierCellWidth,this.gantt.chartHeader.bottomTierCellWidth=t.bottomTierCellWidth,this.gantt.chartHeader.topTier=ne.extend([],[],this.parent.enableTimelineVirtualization?t.pdfExportTopTierCollection:t.topTierCollection,!0),this.gantt.chartHeader.bottomTier=ne.extend([],[],this.parent.enableTimelineVirtualization?t.pdfExportBottomTierCollection:t.bottomTierCollection,!0),this.exportProps&&this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth&&this.parent.enableTimelineVirtualization?(e="None"===t.topTier?"bottomTier":"topTier",this.gantt.chartHeader.width=t.calculateWidthBetweenTwoDate(e,t.timelineStartDate,t.timelineEndDate)):this.gantt.chartHeader.width=this.parent.enableTimelineVirtualization?this.parent.timelineModule.wholeTimelineWidth:t.totalTimelineWidth,this.gantt.chartHeader.height=ne.isNullOrUndefined(this.gantt.rows.getRow(0).height)?65:this.gantt.rows.getRow(0).height,this.gantt.timelineStartDate=new Date(t.timelineStartDate.getTime())},E.prototype.processPredecessor=function(){var i=this;(ne.isNullOrUndefined(this.exportProps.showPredecessorLines)||this.exportProps.showPredecessorLines)&&(this.parent.pdfExportModule.isPdfExport=!0,this.parent.predecessorModule.createConnectorLinesCollection(this.flatData),this.parent.updatedConnectorLineCollection.forEach(function(e){var t=i.gantt.predecessor.add();t.parentLeft=e.parentLeft,t.childLeft=e.childLeft,t.parentWidth=e.parentWidth,t.childWidth=e.childWidth,t.parentIndex=i.findIndexUsingParent(i.flatData,e.parentIndex),t.childIndex=i.findIndexUsingParent(i.flatData,e.childIndex),t.rowHeight=e.rowHeight,t.type=e.type,t.milestoneParent=e.milestoneParent,t.milestoneChild=e.milestoneChild,t.parentEndPoint=e.parentEndPoint,t.lineWidth=5<i.parent.connectorLineWidth?se(5):se(i.parent.connectorLineWidth),e.isCritical?t.connectorLineColor=i.ganttStyle.criticalConnectorLineColor:t.connectorLineColor=i.ganttStyle.connectorLineColor,i.gantt.predecessorCollection.push(t)}),this.parent.pdfExportModule.isPdfExport=!1)},E.prototype.findIndexUsingParent=function(e,t){return e.findIndex(function(e){return e.index===t})},E.prototype.processRecordRow=function(t){var i=this;this.colIndex=0,this.row.level=t.level,this.columns.forEach(function(e){i.isColumnVisible(e)&&(i.processRecordCell(t,e,i.row),i.colIndex++)})},E.prototype.processRecordCell=function(e,t,i){var a=i.cells.getCell(this.colIndex),n=this.parent.taskFields,r=e.ganttProperties;"datepickeredit"===t.editType||"datetimepickeredit"===t.editType?a.value=e[t.field]:t.field===n.duration?a.value=this.parent.getDurationString(r.duration,r.durationUnit):t.field===n.baselineDuration?a.value=this.parent.getDurationString(r.baselineDuration,r.durationUnit):t.field===n.resourceInfo?a.value=r.resourceNames:t.field===n.work?a.value=this.parent.getWorkString(r.work,r.workUnit):a.value=ne.isNullOrUndefined(e[t.field])?"":"number"===t.type?e[t.field]:e[t.field].toString();var n=ne.isNullOrUndefined(a.value)?"":"number"===t.type?a.value:a.value.toString(),r=ne.isNullOrUndefined(n)?"":n,n=(a.isHeaderCell=!1,a.style.padding=new sn,this.copyStyles(this.ganttStyle.cell,a,i.isParentRow),t.index!==this.parent.treeColumnIndex?a.style.format.alignment=re.PdfTextAlignment[t.textAlign]:a.style.format.paragraphIndent=10*a.row.level,{data:e,value:r,column:t,style:a.style,cell:a});n.value=this.exportValueFormatter.formatCellValue(n,this.parent),this.parent.pdfQueryCellInfo&&(this.parent.trigger("pdfQueryCellInfo",n),n.style.backgroundColor&&(a.style.backgroundColor=n.style.backgroundColor),n.style.borderColor&&(a.style.borderColor=n.style.borderColor),n.style.fontBrush&&(a.style.fontBrush=n.style.fontBrush),n.style.fontColor&&(a.style.fontColor=n.style.fontColor),n.style.fontFamily?(i=n.style.fontFamily,e=this.getFontFamily(i),a.style.fontFamily=e):a.style.fontFamily=this.ganttStyle.fontFamily,n.style.fontSize&&(a.style.fontSize=n.style.fontSize),n.style.fontStyle?(r=n.style.fontStyle,t=this.getFontStyle(r),a.style.fontStyle=t):a.style.fontStyle=this.ganttStyle.footer.fontStyle,n.style.format&&(a.style.format=n.style.format),n.style.padding)&&(a.style.padding=n.style.padding),ne.isNullOrUndefined(n.image)||ne.isNullOrUndefined(n.image.base64)||(i=ne.extend({},n.image,null,!0),n.image=new re.PdfBitmap(n.image.base64),n.image.height=i.height||n.image.height,n.image.width=i.width||n.image.width,a.image=n.image),a.value=n.value,ne.isNullOrUndefined(n.hyperLink)||ne.isNullOrUndefined(n.hyperLink.displayText)&&ne.isNullOrUndefined(n.hyperLink.target)||(a.value=this.setHyperLink(n))},E.prototype.setHyperLink=function(e){var t=new re.PdfTextWebLink;return t.url=e.hyperLink.target,t.text=e.hyperLink.displayText||e.hyperLink.target,t.font=new re.PdfStandardFont(re.PdfFontFamily.Helvetica,9.75),t.brush=new re.PdfSolidBrush(new re.PdfColor(51,102,187)),t},E.prototype.processTaskbar=function(){var c=this;this.flatData.forEach(function(e){var r=c.gantt.taskbar.add(),t=e.ganttProperties,i=(r.left=t.left,r.width=t.width,r.left<0&&(r.width=r.width+r.left,r.left=0),r.progress=t.progress,r.isScheduledTask=j(t),ne.isNullOrUndefined(t.endDate)&&ne.isNullOrUndefined(t.duration)?r.unscheduledTaskBy="startDate":ne.isNullOrUndefined(t.startDate)&&ne.isNullOrUndefined(t.duration)?r.unscheduledTaskBy="endDate":(r.unscheduledTaskBy="duration",r.unscheduleStarteDate=c.parent.dateValidationModule.getValidStartDate(e.ganttProperties),r.unscheduleEndDate=c.parent.dateValidationModule.getValidEndDate(e.ganttProperties)),r.startDate=t.startDate,r.endDate=t.endDate,r.height=c.parent.chartRowsModule.taskBarHeight,r.indicators=t.indicators,r.autoStartDate=t.autoStartDate,r.autoEndDate=t.autoEndDate,r.isAutoSchedule=t.isAutoSchedule,r.autoWidth=t.autoWidth,r.autoLeft=t.autoLeft,r.segment=t.segments,r.isSpliterTask=!ne.isNullOrUndefined(t.segments)&&0!==t.segments.length,r.isSpliterTask&&(r.segmentCollection=r.segment.map(function(e){return An({},e)})),r.baselineTop=c.parent.chartRowsModule.baselineTop,r.isMilestone=t.isMilestone,r.baselineStartDate=t.baselineStartDate,r.baselineEndDate=t.baselineEndDate,r.baselineLeft=t.baselineLeft,r.baselineWidth=t.baselineWidth,r.baselineLeft<0&&(r.baselineWidth=r.baselineWidth+r.baselineLeft,r.baselineLeft=0),r.milestoneColor=new re.PdfColor(c.ganttStyle.taskbar.milestoneColor),r.isParentTask=e.hasChildRecords,t.isMilestone&&(r.height=t.width),e[c.parent.labelSettings.leftLabel]&&(r.leftTaskLabel.value=e[c.parent.labelSettings.leftLabel].toString()),e[c.parent.labelSettings.rightLabel]&&(r.rightTaskLabel.value=e[c.parent.labelSettings.rightLabel].toString()),ne.isNullOrUndefined(e[c.parent.labelSettings.taskLabel])||(r.taskLabel=e[c.parent.labelSettings.taskLabel].toString()),t.isMilestone?Math.floor(c.parent.chartRowsModule.taskBarHeight/2)+33:33),a=!(e.hasChildRecords&&!e.ganttProperties.isAutoSchedule),n=a?t.left:t.autoLeft,a=a?t.width:t.autoWidth,n=(r.rightTaskLabel.left=n+a+i,r.fontFamily=c.ganttStyle.fontFamily,r.progressWidth=t.progressWidth,r.labelColor=new re.PdfColor(c.ganttStyle.label.fontColor),r.progressFontColor=new re.PdfColor(c.ganttStyle.taskbar.progressFontColor),r.isParentTask?(r.taskColor=new re.PdfColor(c.ganttStyle.taskbar.parentTaskColor),r.taskBorderColor=new re.PdfColor(c.ganttStyle.taskbar.parentTaskBorderColor),r.progressColor=new re.PdfColor(c.ganttStyle.taskbar.parentProgressColor)):e.isCritical?(r.taskColor=new re.PdfColor(c.ganttStyle.taskbar.criticalTaskColor),r.progressColor=new re.PdfColor(c.ganttStyle.taskbar.criticalProgressColor),r.taskBorderColor=new re.PdfColor(c.ganttStyle.taskbar.criticalTaskBorderColor),r.milestoneColor=new re.PdfColor(c.ganttStyle.taskbar.criticalTaskColor)):(r.taskColor=new re.PdfColor(c.ganttStyle.taskbar.taskColor),r.progressColor=new re.PdfColor(c.ganttStyle.taskbar.progressColor),r.taskBorderColor=new re.PdfColor(c.ganttStyle.taskbar.taskBorderColor)),r.manualParentBorder=new re.PdfColor(c.ganttStyle.taskbar.manualParentBorder),r.manualChildBorder=new re.PdfColor(c.ganttStyle.taskbar.manualChildBorder),r.manuallineColor=new re.PdfColor(c.ganttStyle.taskbar.manualLineColor),r.unscheduledTaskBarColor=new re.PdfColor(c.ganttStyle.taskbar.unscheduledTaskBarColor),r.manualParentBackground=new re.PdfColor(c.ganttStyle.taskbar.manualParentBackground),r.manualParentProgress=new re.PdfColor(c.ganttStyle.taskbar.manualParentProgress),r.manualChildBackground=new re.PdfColor(c.ganttStyle.taskbar.manualChildBackground),r.manualChildProgress=new re.PdfColor(c.ganttStyle.taskbar.manualChildProgress),r.splitLineBackground=new re.PdfColor(c.ganttStyle.taskbar.splitLineBackground),r.baselineColor=new re.PdfColor(c.ganttStyle.taskbar.baselineColor),r.baselineBorderColor=new re.PdfColor(c.ganttStyle.taskbar.baselineBorderColor),r.gridLineColor=new re.PdfColor(c.ganttStyle.chartGridLineColor),{}),a=(n.leftLabel={value:null,image:null,fontStyle:{fontBrush:null}},n.rightLabel={value:null,image:null,fontStyle:{fontBrush:null}},n.taskLabel={value:null,image:null,fontStyle:{fontBrush:null}},r.labelSettings=n,{value:null,image:null,fontStyle:{fontBrush:null}}),i=(r.taskbarTemplate=a,c.gantt.taskbarCollection.push(r),{}),s=(i.progressFontColor=r.progressFontColor,i.taskColor=r.taskColor,i.taskBorderColor=r.taskBorderColor,i.progressColor=r.progressColor,i.milestoneColor=r.milestoneColor,i.baselineColor=r.baselineColor,i.baselineBorderColor=r.baselineBorderColor,i.unscheduledTaskBarColor=r.unscheduledTaskBarColor,i.manualParentBackground=r.manualParentBackground,i.manualParentBorder=r.manualParentBorder,i.manualParentProgress=r.manualParentProgress,i.manualChildBackground=r.manualChildBackground,i.manualChildProgress=r.manualChildProgress,i.manualLineColor=r.manuallineColor,i.manualChildBorder=r.manualChildBorder,i.manualChildProgress=r.manualChildProgress,i.splitLineBackground=r.splitLineBackground,{taskbar:i,data:e,indicators:e.ganttProperties.indicators,labelSettings:n,taskbarTemplate:a});if(c.parent.pdfQueryTaskbarInfo){var o=[];if(s.taskbar.taskSegmentStyles=null,s.data.ganttProperties.segments){for(var l=0;l<s.data.ganttProperties.segments.length;l++){var d={taskColor:s.taskbar.taskColor,taskBorderColor:s.taskbar.taskBorderColor,progressColor:s.taskbar.progressColor};o.push(d)}s.taskbar.taskSegmentStyles=o}c.parent.trigger("pdfQueryTaskbarInfo",s),r.taskSegmentStyles=s.taskbar.taskSegmentStyles,r.progressFontColor=s.taskbar.progressFontColor,r.taskColor=s.taskbar.taskColor,r.taskBorderColor=s.taskbar.taskBorderColor,r.progressColor=s.taskbar.progressColor,r.milestoneColor=s.taskbar.milestoneColor,r.baselineColor=s.taskbar.baselineColor,r.baselineBorderColor=s.taskbar.baselineBorderColor,r.unscheduledTaskBarColor=s.taskbar.unscheduledTaskBarColor,r.manualParentBackground=s.taskbar.manualParentBackground,r.manualParentProgress=s.taskbar.manualParentProgress,r.manualParentBorder=s.taskbar.manualParentBorder,r.manualChildBackground=s.taskbar.manualChildBackground,r.manualChildProgress=s.taskbar.manualChildProgress,r.manuallineColor=s.taskbar.manualLineColor,r.manualChildBorder=s.taskbar.manualChildBorder,r.manualChildProgress=s.taskbar.manualChildProgress,r.splitLineBackground=s.taskbar.splitLineBackground,r.indicators=s.indicators,r.labelSettings.leftLabel.value=s.labelSettings.leftLabel.value;var h=s.labelSettings.leftLabel.image,p=(r.labelSettings.rightLabel.value=s.labelSettings.rightLabel.value,s.labelSettings.rightLabel.image);if(ne.isNullOrUndefined(s.labelSettings.taskLabel.value)||(r.taskLabel=s.labelSettings.taskLabel.value),!ne.isNullOrUndefined(s.labelSettings.leftLabel.image)&&Array.isArray(s.labelSettings.leftLabel.image[0].base64)&&0<s.labelSettings.leftLabel.image[0].base64.length){var u=s.labelSettings.leftLabel.image[0].base64.length;r.labelSettings.leftLabel.image=[];for(l=0;l<u;l++)r.labelSettings.leftLabel.image.push({base64:h[0].base64[l],width:h[0].width,height:h[0].height})}else ne.isNullOrUndefined(s.labelSettings.leftLabel.image)||(r.labelSettings.leftLabel.image=s.labelSettings.leftLabel.image);if(!ne.isNullOrUndefined(s.labelSettings.rightLabel.image)&&Array.isArray(s.labelSettings.rightLabel.image[0].base64)&&0<s.labelSettings.rightLabel.image[0].base64.length){u=s.labelSettings.rightLabel.image[0].base64.length;r.labelSettings.rightLabel.image=[];for(l=0;l<u;l++)r.labelSettings.rightLabel.image.push({base64:p[0].base64[l],width:p[0].width,height:p[0].height})}else ne.isNullOrUndefined(s.labelSettings.rightLabel.image)||(r.labelSettings.rightLabel.image=s.labelSettings.rightLabel.image);t=function(e,t){var i,a,n;e.progressFontColor=t.taskbar.progressFontColor,e.taskColor=new re.PdfColor(t.taskbar.taskColor),e.taskBorderColor=t.taskbar.taskBorderColor,e.progressColor=t.taskbar.progressColor,e.milestoneColor=t.taskbar.milestoneColor,ne.isNullOrUndefined(t.taskbarTemplate.image)||ne.isNullOrUndefined(t.taskbarTemplate.image[0].base64)||(i=t.taskbarTemplate.image[0].width,n=r.isMilestone&&t.taskbarTemplate.image[0].height<.7*c.parent.chartRowsModule.taskBarHeight?t.taskbarTemplate.image[0].height:.7*c.parent.chartRowsModule.taskBarHeight-2,a=!ne.isNullOrUndefined(t.taskbarTemplate.image[0].height)&&t.taskbarTemplate.image[0].height<r.height?t.taskbarTemplate.image[0].height:r.height-2,n=r.isMilestone?n:a,e.taskbarTemplate.image=t.taskbarTemplate.image,e.taskbarTemplate.image[0].width=i,e.taskbarTemplate.image[0].height=n),ne.isNullOrUndefined(t.taskbarTemplate.value)||(e.taskbarTemplate.value=t.taskbarTemplate.value,e.taskbarTemplate.value=t.taskbarTemplate.value,e.taskbarTemplate.fontStyle.fontColor=t.taskbarTemplate.fontStyle.fontColor,e.taskbarTemplate.fontStyle.fontSize=t.taskbarTemplate.fontStyle.fontSize,e.taskbarTemplate.fontStyle.fontFamily=t.taskbarTemplate.fontStyle.fontFamily,e.taskbarTemplate.fontStyle.fontStyle=t.taskbarTemplate.fontStyle.fontStyle,e.taskbarTemplate.fontStyle.fontBrush=t.taskbarTemplate.fontStyle.fontBrush)};(!s.data.hasChildRecords&&0!==s.data.ganttProperties.duration||s.data.hasChildRecords&&0!==s.data.ganttProperties.duration||0===s.data.ganttProperties.duration)&&t(r,s)}})},E.prototype.getHorizontalAlignment=function(e,t){switch(void 0===t&&(t=new re.PdfStringFormat),e){case"Right":t.alignment=re.PdfTextAlignment.Right;break;case"Center":t.alignment=re.PdfTextAlignment.Center;break;case"Justify":t.alignment=re.PdfTextAlignment.Justify;break;case"Left":t.alignment=re.PdfTextAlignment.Left}return t},E.prototype.getVerticalAlignment=function(e,t,i){switch(void 0===t&&(t=new re.PdfStringFormat,t=this.getHorizontalAlignment(i,t)),e){case"Bottom":t.lineAlignment=re.PdfVerticalAlignment.Bottom;break;case"Middle":t.lineAlignment=re.PdfVerticalAlignment.Middle;break;case"Top":t.lineAlignment=re.PdfVerticalAlignment.Top}return t},E.prototype.getFontFamily=function(e){switch(e){case"TimesRoman":return 2;case"Courier":return 1;case"Symbol":return 3;case"ZapfDingbats":return 4;default:return 0}},E.prototype.getFontStyle=function(e){switch(e){case"Strikeout":return 8;case"Underline":return 4;case"Italic":return 2;case"Bold":return 1;default:return 0}},E.prototype.getFont=function(e){var t,i;return e.font||(i=this.exportProps.ganttStyle&&this.exportProps.ganttStyle.fontFamily?this.exportProps.ganttStyle.fontFamily:re.PdfFontFamily.TimesRoman,t=ne.isNullOrUndefined(e.style.fontSize)?9.75:.75*e.style.fontSize,i=ne.isNullOrUndefined(e.style.fontFamily)?i:this.getFontFamily(e.style.fontFamily),e=re.PdfFontStyle.Regular,new re.PdfStandardFont(i,t,e))},E.prototype.renderEmptyGantt=function(){var e=this.gantt.rows.addRow(),t=(0===e.cells.count&&e.cells.add(),e.cells.getCell(0).isHeaderCell=!1,e.height=se(this.parent.rowHeight),this.copyStyles(this.ganttStyle.columnHeader,e.cells.getCell(0),e.isParentRow),this.columns.length);e.cells.getCell(0).value=this.parent.localeObj.getConstant("emptyRecord"),this.mergeCells(1,0,t)},E.prototype.mergeCells=function(e,t,i){this.gantt.rows.getRow(e).cells.getCell(t).columnSpan=i},E.prototype.copyStyles=function(e,t,i){t.style.fontColor=new re.PdfColor(e.fontColor),t.style.backgroundColor=new re.PdfColor(e.backgroundColor),t.style.borderColor=new re.PdfColor(e.borderColor),t.style.fontSize=e.fontSize,t.style.fontStyle=e.fontStyle,t.style.format=Object.assign(new re.PdfStringFormat,e.format),t.style.borders=new nn,t.style.borders.all=new re.PdfPen(t.style.borderColor),t.style.padding=new sn;var a=0;t.isHeaderCell?(a=this.parent.timelineModule.isSingleTier?22.5:30,t.style.padding.top=0<a-e.fontSize?a-e.fontSize:a):(a=this.parent.rowHeight/2,t.style.padding.top=a),t.style.padding.bottom=0<a-e.fontSize?a-e.fontSize:0,t.style.padding.left=10,t.style.padding.right=10,e.padding&&(t.style.padding=e.padding),e.borders&&(t.style.borders=e.borders)},E.prototype.initializePdf=function(e){this.pdfDoc=e;var t=[],i=this.pdfDoc.pageSettings.width-82;if(this.exportProps&&this.exportProps.fitToWidthSettings&&this.exportProps.fitToWidthSettings.isFitToWidth){var a=void 0;a=this.exportProps.fitToWidthSettings.gridWidth?parseInt(this.exportProps.fitToWidthSettings.gridWidth.split("%")[0],10):this.exportProps.fitToWidthSettings.chartWidth?100-parseInt(this.exportProps.fitToWidthSettings.chartWidth.split("%")[0],10):30;for(var n=this.parent.pdfExportModule.pdfPageDimensions.width*a/100/this.gantt.columns.columns.length,r=0;r<this.gantt.columns.columns.length;r++)this.gantt.columns.getColumn(r).width=n}var s,o,l,d,h,a=this.parent.pdfExportModule.pdfPage,p=(this.totalColumnWidth>this.pdfDoc.pageSettings.width-82&&this.totalColumnWidth<a.getClientSize().width?this.gantt.style.allowHorizontalOverflow=!0:i/this.columns.length<t[0]&&(this.gantt.columns.getColumn(0).width=t[0]),(this.exportProps.enableFooter||ne.isNullOrUndefined(this.exportProps.enableFooter))&&(i=this.parent.pdfExportModule.getPageSize(this.exportProps.pageSize),h=new re.RectangleF(0,0,i.width,35),t=new re.PdfPen(this.ganttStyle.footer.borderColor),o=new re.PdfPageTemplateElement(h),p=new re.PdfSolidBrush(this.ganttStyle.footer.backgroundColor),o.graphics.drawRectangle(t,p,0,0,i.width,35),t=new re.PdfStandardFont(this.ganttStyle.fontFamily,this.ganttStyle.footer.fontSize,this.ganttStyle.footer.fontStyle),this.ganttStyle.font&&(t=this.ganttStyle.font),p=new re.PdfSolidBrush(this.ganttStyle.footer.fontColor),i=new re.PdfPageNumberField(t),s=new re.PdfPageCountField(t,p),(t=new re.PdfCompositeField(t,p,"Page {0}",i,s)).stringFormat=this.ganttStyle.footer.format,t.bounds=h,t.draw(o.graphics,new re.PointF(0,0)),e.template.bottom=o),a.size),i=ne.isNullOrUndefined(p)?this.pdfDoc.pageSettings.size:p;ne.isNullOrUndefined(this.exportProps.header)||(s=this.exportProps.header,l=new re.PointF(0,s.fromTop),d=new re.SizeF(1.1*i.width,s&&s.height?.75*s.height:50),h=new re.RectangleF(l,d),e.template.top=this.drawPageTemplate(new re.PdfPageTemplateElement(h),s)),this.exportProps.enableFooter||ne.isNullOrUndefined(this.exportProps.footer)||(o=this.exportProps.footer,l=new re.PointF(0,i.width-80-(o&&o.fromBottom?.75*o.fromBottom:0)),d=new re.SizeF(1.1*i.width,o&&o.height?.75*o.height:50),h=new re.RectangleF(l,d),this.pdfDoc.template.bottom=this.drawPageTemplate(new re.PdfPageTemplateElement(h),o))},E.prototype.drawPageTemplate=function(e,t){for(var i=0,a=t.contents;i<a.length;i++){var n=a[i];switch(n.type){case"Text":if(""===n.value||void 0===n.value||null===n.value||"string"!=typeof n.value)throw new Error("please enter the valid input value in text content...");this.drawText(e,n);break;case"PageNumber":this.drawPageNumber(e,n);break;case"Image":if(void 0===n.src||null===n.src||""===n.src)throw new Error("please enter the valid base64 string in image content...");this.drawImage(e,n);break;case"Line":this.drawLine(e,n);break;default:throw new Error("Please set valid content type...")}}return e},E.prototype.drawText=function(e,t){var i=this.getFont(t),a=(this.ganttStyle.font&&(i=this.ganttStyle.font),this.getBrushFromContent(t)),n=null,r=(ne.isNullOrUndefined(t.style.textPenColor)||(r=this.hexToRgb(t.style.textPenColor),n=new re.PdfPen(new re.PdfColor(r.r,r.g,r.b))),null===a&&null===n&&(a=new re.PdfSolidBrush(new re.PdfColor(0,0,0))),t.value.toString()),s=.75*t.position.x,o=.75*t.position.y,l=new re.PdfStringFormat,t=(ne.isNullOrUndefined(t.style.stringFormat)||(l.alignment=t.style.stringFormat.alignment),this.setContentFormat(t,l));null===t||ne.isNullOrUndefined(t.format)||ne.isNullOrUndefined(t.size)?e.graphics.drawString(r,i,n,a,s,o,l):e.graphics.drawString(r,i,n,a,s,o,t.size.width,t.size.height,t.format)},E.prototype.drawPageNumber=function(e,t){var i,a,n,r=this.getFont(t),s=null,o=(s=ne.isNullOrUndefined(t.style.textBrushColor)?new re.PdfSolidBrush(new re.PdfColor(0,0,0)):(o=this.hexToRgb(t.style.textBrushColor),new re.PdfSolidBrush(new re.PdfColor(o.r,o.g,o.b))),new re.PdfPageNumberField(r,s)),o=(o.numberStyle=this.getPageNumberStyle(t.pageNumberType),n=ne.isNullOrUndefined(t.format)?new re.PdfCompositeField(r,s,a="{0}",o):(n="$current",-1!==t.format.indexOf(l="$total")&&-1!==t.format.indexOf(n)?((i=new re.PdfPageCountField(r)).numberStyle=this.getPageNumberStyle(t.pageNumberType),a=t.format.indexOf(l)>t.format.indexOf(n)?(a=t.format.replace(n,"0")).replace(l,"1"):(a=t.format.replace(n,"1")).replace(l,"0"),new re.PdfCompositeField(r,s,a,o,i)):-1!==t.format.indexOf(n)&&-1===t.format.indexOf(l)?(a=t.format.replace(n,"0"),new re.PdfCompositeField(r,s,a,o)):(i=new re.PdfPageCountField(r),a=t.format.replace(l,"0"),new re.PdfCompositeField(r,s,a,i))),.75*t.position.x),l=.75*t.position.y,r=this.setContentFormat(t,n.stringFormat);null===r||ne.isNullOrUndefined(r.format)||ne.isNullOrUndefined(r.size)||(n.stringFormat=r.format,n.bounds=new re.RectangleF(o,l,r.size.width,r.size.height)),n.draw(e.graphics,o,l)},E.prototype.drawImage=function(e,t){var i=.75*t.position.x,a=.75*t.position.y,n=ne.isNullOrUndefined(t.size)||ne.isNullOrUndefined(t.size.width)?void 0:.5*t.size.width,r=ne.isNullOrUndefined(t.size)||ne.isNullOrUndefined(t.size.height)?void 0:.75*t.size.height,t=new re.PdfBitmap(t.src);ne.isNullOrUndefined(n)?e.graphics.drawImage(t,i,a):e.graphics.drawImage(t,i,a,n,r)},E.prototype.drawLine=function(e,t){var i=.75*t.points.x1,a=.75*t.points.y1,n=.75*t.points.x2,r=.75*t.points.y2,s=this.getPenFromContent(t);ne.isNullOrUndefined(t.style)||(ne.isNullOrUndefined(t.style.penSize)||"number"!=typeof t.style.penSize||(s.width=.75*t.style.penSize),s.dashStyle=this.getDashStyle(t.style.dashStyle)),e.graphics.drawLine(s,i,a,n,r)},E.prototype.getPenFromContent=function(e){var t=new re.PdfPen(new re.PdfColor(0,0,0));return ne.isNullOrUndefined(e.style)||null===e.style||ne.isNullOrUndefined(e.style.penColor)||(e=this.hexToRgb(e.style.penColor),t=new re.PdfPen(new re.PdfColor(e.r,e.g,e.b))),t},E.prototype.getDashStyle=function(e){switch(e){case"Dash":return 1;case"Dot":return 2;case"DashDot":return 3;case"DashDotDot":return 4;default:return 0}},E.prototype.getBrushFromContent=function(e){var t=null;return ne.isNullOrUndefined(e.style.textBrushColor)||(e=this.hexToRgb(e.style.textBrushColor),t=new re.PdfSolidBrush(new re.PdfColor(e.r,e.g,e.b))),t},E.prototype.hexToRgb=function(e){if(null===e||""===e||7!==e.length)throw new Error("please set valid hex value for color...");e=e.substring(1);e=parseInt(e,16);return{r:e>>16&255,g:e>>8&255,b:255&e}},E.prototype.setContentFormat=function(e,t){var i=e.size?.75*e.size.width:this.pdfDoc.pageSettings.size.width,a=e.size?.75*e.size.height:ne.isNullOrUndefined(this.exportProps.footer)?0:.5*this.exportProps.footer.height;if(t=new re.PdfStringFormat(re.PdfTextAlignment.Left,re.PdfVerticalAlignment.Middle),!ne.isNullOrUndefined(e.style.hAlign))switch(e.style.hAlign){case"Right":t.alignment=re.PdfTextAlignment.Right;break;case"Center":t.alignment=re.PdfTextAlignment.Center;break;case"Justify":t.alignment=re.PdfTextAlignment.Justify;break;default:t.alignment=re.PdfTextAlignment.Left}return{format:t=ne.isNullOrUndefined(e.style.vAlign)?t:this.getVerticalAlignment(e.style.vAlign,t),size:new re.SizeF(i,a)}},E.prototype.getPageNumberStyle=function(e){switch(e){case"LowerLatin":return 2;case"LowerRoman":return 3;case"UpperLatin":return 4;case"UpperRoman":return 5;default:return 1}},E);function E(e){this.totalColumnWidth=0,this.beforeSinglePageExport={},this.baselineHeight=8,this.parent=e}Hn.prototype.returnFormattedValue=function(e,t){return!ne.isNullOrUndefined(e.value)&&e.value?this.valueFormatter.getFormatFunction(t)(e.value):""},Hn.prototype.formatCellValue=function(e,t){var i;return e.isForeignKey&&(e.value=ne.getValue(e.column.foreignKeyValue,w.getForeignData(e.column,{},e.value)[0])),"number"===e.column.type&&void 0!==e.column.format&&""!==e.column.format?e.value?this.internationalization.getNumberFormat({format:e.column.format})(e.value):"":"boolean"===e.column.type?e.value?"true":"false":"date"!==e.column.type&&"datetime"!==e.column.type&&"time"!==e.column.type||void 0===e.column.format||""===e.value?(ne.isNullOrUndefined(e.column.type)||ne.isNullOrUndefined(e.value))&&ne.isNullOrUndefined(e.value)?"":(e.column.field===t.taskFields.constraintType&&(i=k.ConstraintType[e.value],t=t.treeGridModule.getLocalizedConstraintTypeText(i),e.value=t),e.value.toString()):("string"==typeof e.value&&(e.value=new Date(e.value)),"string"==typeof e.column.format?(i=void 0,i="date"===e.column.type?{type:"date",format:e.column.format}:"time"===e.column.type?{type:"time",format:e.column.format}:{type:"dateTime",format:e.column.format},this.returnFormattedValue(e,i)):e.column.format instanceof Object&&void 0===e.column.format.type?e.value.toString():(t=void 0,t="date"===e.column.type?{type:e.column.format.type,format:e.column.format.format,skeleton:e.column.format.skeleton}:"time"===e.column.type?{type:"time",format:e.column.format.format,skeleton:e.column.format.skeleton}:{type:"dateTime",format:e.column.format.format,skeleton:e.column.format.skeleton},this.returnFormattedValue(e,t)))};var jn=Hn;function Hn(e){this.valueFormatter=new w.ValueFormatter(e),this.internationalization=new ne.Internationalization(e)}var zn=function(){return(zn=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},Gn=(qn.prototype.add=function(){return new qn(this.parent)},qn.prototype.GetNextPage=function(e){var t=e.section,e=t.indexOf(e);return e===t.count-1?t.add():t.getPages()[e+1]},qn.prototype.isAutoFit=function(){return!!(this.parent.pdfExportModule&&this.parent.pdfExportModule.helper.exportProps&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings&&this.parent.pdfExportModule.helper.exportProps.fitToWidthSettings.isFitToWidth||this.parent.timelineModule.isZoomedToFit)},qn.prototype.drawTaskbar=function(r,h,p,u,L,c,V,B){var g,f,e,t,m,y,A,W,j,i,H,a,z,G,q,_,D,k,b,Z,X,w,Y,n,K,Q,$,J,s,o,l,d,ee,T,v,S,P,C=this,R=r.graphics,te=!1,M=r.getClientSize(),ie=(h.y+L>M.height&&((r=this.GetNextPage(r)).contentWidth=this.isAutoFit()?oe(p.endPoint-p.startPoint):p.endPoint-p.startPoint,R=r.graphics,h.y=0,this.parent.pdfExportModule.gantt.currentPage=this.parent.pdfExportModule.gantt.currentPage+1,this.parent.pdfExportModule.gantt.eventMarker.renderHeight=this.parent.pdfExportModule.gantt.layouter.pageHeightCollection[this.parent.pdfExportModule.gantt.currentPage].totalHeight,this.parent.pdfExportModule.gantt.enableHeader&&(this.parent.pdfExportModule.gantt.chartHeader.drawPageTimeline(r,h,p,this.parent.pdfExportModule.gantt.currentPage),h.y=se(this.parent.timelineModule.isSingleTier?45:60)),te=!0),this.drawLeftLabel(r,h,p,u,c),new re.PdfStandardFont(this.fontFamily,this.defaultFontSize,re.PdfFontStyle.Regular)),M=null,O=new re.PdfSolidBrush(this.progressFontColor),x=ie,I=(!ne.isNullOrUndefined(c.taskbarTemplate.value)&&c.taskbarTemplate.fontStyle&&c.taskbarTemplate.fontStyle.fontFamily&&c.taskbarTemplate.fontStyle.fontSize&&(x=new re.PdfStandardFont(c.taskbarTemplate.fontStyle.fontFamily,c.taskbarTemplate.fontStyle.fontSize,c.taskbarTemplate.fontStyle.fontStyle)),g=!ne.isNullOrUndefined(c.taskbarTemplate.value)&&c.taskbarTemplate.fontStyle&&c.taskbarTemplate.fontStyle.fontColor?new re.PdfSolidBrush(c.taskbarTemplate.fontStyle.fontColor):O,f=!ne.isNullOrUndefined(c.taskbarTemplate.value)&&c.taskbarTemplate.fontStyle&&c.taskbarTemplate.fontStyle.fontBrush?new re.PdfPen(c.taskbarTemplate.fontStyle.fontBrush):M,!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(ie=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),this.parent.pdfExportModule.helper.exportProps.ganttStyle),E=this.labelSettings.taskLabel,F=(E.fontStyle.fontSize||E.fontStyle.fontFamily||E.fontStyle.fontStyle?(t=E.fontStyle&&E.fontStyle.fontFamily?E.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,U=E.fontStyle&&E.fontStyle.fontSize?E.fontStyle.fontSize:this.defaultFontSize,E=E.fontStyle&&"string"==typeof E.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(E.fontStyle.fontStyle):E.fontStyle&&E.fontStyle.fontStyle?E.fontStyle.fontStyle:re.PdfFontStyle.Regular,t=new re.PdfStandardFont(t,U,E)):I&&I.label&&I.label.fontBrush?e=new re.PdfSolidBrush(I.label.fontBrush):t=ie,e=c.labelSettings.taskLabel.fontStyle.fontColor?new re.PdfSolidBrush(c.labelSettings.taskLabel.fontStyle.fontColor):I&&I.label&&I.label.fontColor?new re.PdfSolidBrush(I.label.fontColor):O,ne.isNullOrUndefined(I)||ne.isNullOrUndefined(I.label)||ne.isNullOrUndefined(I.label.fontBrush)||(M=new re.PdfPen(I.label.fontBrush)),ne.isNullOrUndefined(I)||ne.isNullOrUndefined(I.label)||ne.isNullOrUndefined(I.label.fontSize)&&ne.isNullOrUndefined(I.label.fontStyle)&&ne.isNullOrUndefined(I.label.fontFamily)||(t=this.getPdfFont(I)),new re.PdfStringFormat),U=(F.lineAlignment=re.PdfVerticalAlignment.Middle,F.alignment=re.PdfTextAlignment.Right,!1),E=(ne.isNullOrUndefined(this.taskLabel)||!/^[a-zA-Z0-9]/.test(this.taskLabel)||"0"!==this.taskLabel&&"0%"!==this.taskLabel||(n=this.width,F.alignment=re.PdfTextAlignment.Left),(ne.isNullOrUndefined(this.taskLabel)||!/^[a-zA-Z]/.test(this.taskLabel))&&ne.isNullOrUndefined(c.taskbarTemplate.value)||(U=!0,F.alignment=re.PdfTextAlignment.Left),ne.isNullOrUndefined(I)||ne.isNullOrUndefined(I.label)||ne.isNullOrUndefined(I.label.format)||(F=I.label.format),{left:0,right:0,top:0,bottom:0}),O=(ne.isNullOrUndefined(I)||ne.isNullOrUndefined(I.label)||ne.isNullOrUndefined(I.label.padding)||(E=I.label.padding),-1),I=new re.PdfPen(c.baselineBorderColor),ae=new re.PdfSolidBrush(c.baselineColor),N=c.taskbarTemplate;return c.isMilestone?(this.drawMilestone(r,h,p,u,c,!1),this.parent.renderBaseline&&c.baselineStartDate&&c.baselineEndDate&&this.drawMilestone(r,h,p,u,c,!0)):(m=new re.PdfPen(c.taskBorderColor),y=new re.PdfSolidBrush(c.taskColor),A=new re.PdfPen(c.manualParentBorder),W=new re.PdfPen(c.manualChildBorder),j=new re.PdfPen(c.manuallineColor),new re.PdfPen(c.manualParentProgress),i=new re.PdfPen(c.manuallineColor),H=new re.PdfSolidBrush(c.manuallineColor),a=new re.PdfPen(c.splitLineBackground),z=new re.PdfSolidBrush(c.manualParentBackground),G=new re.PdfSolidBrush(c.manualChildBackground),q=new re.PdfSolidBrush(c.manualChildProgress),_=new re.PdfSolidBrush(c.manualParentProgress),D=new re.PdfPen(c.progressColor),k=new re.PdfSolidBrush(c.progressColor),X=se((this.parent.rowHeight-this.height)/2),Z=se((this.parent.rowHeight-this.height)/4.5),b=this.parent.renderBaseline?Z:X,O=r.section.indexOf(r),Z=ne.isNullOrUndefined(this.unscheduleStarteDate)?this.startDate:this.unscheduleStarteDate,X=ne.isNullOrUndefined(this.unscheduleEndDate)?this.endDate:this.unscheduleEndDate,p.startDate<=Z&&X<=p.endDate?(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy?(this.isScheduledTask||"endDate"!==this.unscheduledTaskBy)&&(this.isScheduledTask||"duration"===this.unscheduledTaskBy)?(c.isSpliterTask?(a.dashStyle=re.PdfDashStyle.Dot,this.isAutoFit()?R.drawLine(a,new re.PointF(h.x+(this.left-u)+.5,h.y+b+se(c.height/2)),new re.PointF(c.width+h.x+(this.left-u)+.5,h.y+b+se(c.height/2))):R.drawLine(a,new re.PointF(h.x+se(this.left-u)+.5,h.y+b+se(c.height/2)),new re.PointF(se(c.width)+h.x+se(this.left-u)+.5,h.y+b+se(c.height/2))),c.segmentCollection.map(function(e,t){var i,a,n=ne.isNullOrUndefined(C.taskSegmentStyles)?m:new re.PdfPen(C.taskSegmentStyles[t].taskBorderColor),t=ne.isNullOrUndefined(C.taskSegmentStyles)?y:new re.PdfSolidBrush(C.taskSegmentStyles[t].taskColor);C.isAutoFit()?(R.drawRectangle(n,t,h.x+(C.left+e.left-u)+.5,h.y+b,e.width,se(c.height)),(N.image||N.value)&&(i=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?i=0:(i=c.taskbarTemplate.image[0].width,a=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(a,h.x+(C.left+e.left-u)+.5,h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+(C.left+e.left-u)+.5+i,h.y+b,se(e.width),se(c.height),F))):(R.drawRectangle(n,t,h.x+se(C.left+e.left-u)+.5,h.y+b,se(e.width),se(c.height)),(N.image||N.value)&&(i=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?i=0:(i=c.taskbarTemplate.image[0].width,a=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(a,h.x+se(C.left+e.left-u)+.5,h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(C.left+e.left-u)+.5+i,h.y+b,se(e.width),se(c.height),F)))})):!c.isAutoSchedule&&c.isParentTask?(R.save(),(Q=new re.PdfPath).addEllipse(0,0,5,5),this.isAutoFit()?R.translateTransform(h.x+(this.left-u)+.5,h.y+b-2):R.translateTransform(h.x+se(this.left-u)+.5,h.y+b-2),R.drawPath(j,H,Q),R.restore(),(K=new re.PdfPath).addEllipse(0,0,5,5),R.save(),this.isAutoFit()?R.translateTransform(h.x+(this.left-u)+.5+this.width,h.y+b-2):R.translateTransform(h.x+se(this.left-u)+.5+se(this.width),h.y+b-2),R.drawPath(j,H,K),R.restore(),i.dashStyle=re.PdfDashStyle.Solid,this.isAutoFit()?R.drawLine(i,new re.PointF(h.x+(this.left-u)+.5,h.y+b),new re.PointF(c.width+h.x+(this.left-u)+.5,h.y+b)):R.drawLine(i,new re.PointF(h.x+se(this.left-u)+.5,h.y+b),new re.PointF(se(c.width)+h.x+se(this.left-u)+.5,h.y+b))):c.isAutoSchedule||c.isParentTask?this.isAutoFit()?ne.isNullOrUndefined(N.value)&&ne.isNullOrUndefined(N.image)?R.drawRectangle(m,y,h.x+(this.left-u)+.5,h.y+b,c.width,se(c.height)):(R.drawRectangle(m,y,h.x+(this.left-u)+.5,h.y+b,c.width,se(c.height)),l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width/2,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+(this.left-u)+.5,h.y+b+(c.height-c.taskbarTemplate.image[0].height)/2,c.taskbarTemplate.image[0].width/2,c.taskbarTemplate.image[0].height/2)),c.taskbarTemplate.value&&(U&&(n=this.width),R.drawString(c.taskbarTemplate.value,x,f,g,h.x+(this.left-u)+l,h.y+b,n,se(this.height),F))):ne.isNullOrUndefined(N.value)&&ne.isNullOrUndefined(N.image)?R.drawRectangle(m,y,h.x+se(this.left-u)+.5,h.y+b,se(c.width),se(c.height)):(R.drawRectangle(m,y,h.x+se(this.left-u)+.5,h.y+b,se(c.width),se(c.height)),l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+se(this.left-u)+1,h.y+b+1+se((c.height-c.taskbarTemplate.image[0].height)/2),se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(this.left-u)+l,h.y+b,se(n),se(this.height),F)):(R.save(),R.setTransparency(.87),this.isAutoFit()?R.drawRectangle(W,G,h.x+(this.left-u)+.5,h.y+b,c.width,se(c.height)):R.drawRectangle(W,G,h.x+se(this.left-u)+.5,h.y+b,se(c.width),se(c.height)),R.restore(),this.isAutoFit()?R.drawRectangle(null,q,h.x+(this.left-u)+.5,h.y+b,c.progressWidth,se(this.height)):R.drawRectangle(null,q,h.x+se(this.left-u)+.5,h.y+b,se(c.progressWidth),se(this.height))),this.isScheduledTask&&!c.isSpliterTask?ne.isNullOrUndefined(N.image)&&ne.isNullOrUndefined(N.value)&&(this.isAutoFit()&&c.isAutoSchedule?R.drawRectangle(D,k,h.x+(this.left-u)+.5,h.y+b,c.progressWidth,se(c.height)):c.isAutoSchedule&&R.drawRectangle(D,k,h.x+se(this.left-u)+.5,h.y+b,se(c.progressWidth),se(c.height)),ne.isNullOrUndefined(this.parent.labelSettings.taskLabel)||ne.isNullOrUndefined(this.taskLabel)||("0"!==this.taskLabel&&"0%"!==this.taskLabel&&(n=this.progressWidth),U&&(n=this.width),this.isAutoFit()?R.drawString(this.taskLabel.toString(),t,M,e,h.x+(this.left-u)-(E.left+E.right),h.y+b-(E.top+E.bottom),n,se(this.height),F):R.drawString(this.taskLabel.toString(),t,M,e,h.x+se(this.left-u)-(E.left+E.right),h.y+b-(E.top+E.bottom),se(n),se(this.height),F))):c.isSpliterTask&&c.segment.map(function(e,t){var i=ne.isNullOrUndefined(C.taskSegmentStyles)?D:new re.PdfPen(C.taskSegmentStyles[t].progressColor),t=ne.isNullOrUndefined(C.taskSegmentStyles)?k:new re.PdfSolidBrush(C.taskSegmentStyles[t].progressColor);C.isAutoFit()?R.drawRectangle(i,t,h.x+(C.left+e.left-u)+.5,h.y+b,e.progressWidth,se(c.height)):R.drawRectangle(i,t,h.x+se(C.left+e.left-u)+.5,h.y+b,se(e.progressWidth),se(c.height))})):this.drawUnscheduledTask(R,h,u,b):(o=s=void 0,this.isAutoFit()?(s=new re.PdfLinearGradientBrush(new re.PointF(h.x+(this.left-u)+.5+c.width/2,0),new re.PointF(h.x+(this.left-u),0),new re.PdfColor(c.unscheduledTaskBarColor),new re.PdfColor(255,255,255)),R.drawRectangle(s,h.x+(this.left-u)+.5,h.y+b,c.width,se(c.height)),o=new re.PdfLinearGradientBrush(new re.PointF(h.x+(this.left-u)+.5+c.width,0),new re.PointF(h.x+(this.left-u)+c.width/2,0),new re.PdfColor(255,255,255),new re.PdfColor(c.unscheduledTaskBarColor)),R.drawRectangle(o,h.x+(this.left-u)+.5+c.width/2,h.y+b,c.width/2,se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+(this.left-u)+.5,h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+(this.left-u)+.5+l,h.y+b,se(c.width),se(this.height),F))):(s=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(this.left-u)+.5+se(c.width)/2,0),new re.PointF(h.x+se(this.left-u),0),new re.PdfColor(c.unscheduledTaskBarColor),new re.PdfColor(255,255,255)),R.drawRectangle(s,h.x+se(this.left-u)+.5,h.y+b,se(c.width),se(c.height)),o=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(this.left-u)+.5+se(c.width),0),new re.PointF(h.x+se(this.left-u)+se(c.width)/2,0),new re.PdfColor(255,255,255),new re.PdfColor(c.unscheduledTaskBarColor)),R.drawRectangle(o,h.x+se(this.left-u)+.5+se(c.width)/2,h.y+b,se(c.width)/2,se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+se(this.left-u)+.5,h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(this.left-u)+.5+l,h.y+b,se(c.width),se(this.height),F)))),this.isCompleted=!0,this.startPage=O,this.endPage=O):p.startDate<=Z&&p.endDate>=Z&&X>=p.endDate?(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),ee=this.width,v=w=0,this.width=this.width-(p.totalWidth-(this.left-u)),w=p.totalWidth-(this.left-u),v=p.totalWidth-(this.left-u),ee<w&&(w=ee),this.isScheduledTask||"duration"!==this.unscheduledTaskBy?this.isScheduledTask||"duration"===this.unscheduledTaskBy?!c.isAutoSchedule&&c.isParentTask?(R.save(),(Q=new re.PdfPath).addEllipse(0,0,5,5),this.isAutoFit()?R.translateTransform(h.x+(this.left-u)+.5,h.y+b-2):R.translateTransform(h.x+se(this.left-u)+.5,h.y+b-2),R.drawPath(j,H,Q),R.restore(),i.dashStyle=re.PdfDashStyle.Solid,this.isAutoFit()?R.drawLine(i,new re.PointF(h.x+(this.left-u)+.5,h.y+b),new re.PointF(w+h.x+(this.left-u)+.5,h.y+b)):R.drawLine(i,new re.PointF(h.x+se(this.left-u)+.5,h.y+b),new re.PointF(se(w)+h.x+se(this.left-u)+.5,h.y+b))):c.isAutoSchedule||c.isParentTask?(this.isScheduledTask||"duration"===this.unscheduledTaskBy)&&(this.isScheduledTask||"endDate"!==this.unscheduledTaskBy)?c.isSpliterTask?(Y=0,a.dashStyle=re.PdfDashStyle.Dot,this.isAutoFit()?R.drawLine(a,new re.PointF(h.x+(this.left-u)+.5,h.y+b+se(c.height/2)),new re.PointF(w+(this.left-u)+h.x,h.y+b+se(c.height/2))):R.drawLine(a,new re.PointF(h.x+se(this.left-u)+.5,h.y+b+se(c.height/2)),new re.PointF(se(w)+se(this.left-u)+h.x,h.y+b+se(c.height/2))),c.segmentCollection.map(function(e,t){var i,a,n,r,s,o,l,d;e.startDate<p.endDate&&e.endDate>p.startDate&&(i=ne.isNullOrUndefined(C.taskSegmentStyles)?m:new re.PdfPen(C.taskSegmentStyles[t].taskBorderColor),a=ne.isNullOrUndefined(C.taskSegmentStyles)?y:new re.PdfSolidBrush(C.taskSegmentStyles[t].taskColor),n=ne.isNullOrUndefined(C.taskSegmentStyles)?D:new re.PdfPen(C.taskSegmentStyles[t].progressColor),r=ne.isNullOrUndefined(C.taskSegmentStyles)?k:new re.PdfSolidBrush(C.taskSegmentStyles[t].progressColor),s=w-e.left,o=s=e.width<s?e.width:s,e.progressWidth<o&&(o=e.progressWidth),C.isAutoFit()?(R.drawRectangle(i,a,h.x+(C.left-u)+.5+e.left,h.y+b,e.width,se(c.height)),R.drawRectangle(n,r,h.x+(C.left+e.left-u)+.5,h.y+b,e.progressWidth,se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+(C.left-u)+.5+e.left,h.y+b,c.taskbarTemplate.image[0].width,c.taskbarTemplate.image[0].height)),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+(C.left-u)+.5+e.left+l,h.y+b,e.width,c.height,F))):(R.drawRectangle(i,a,h.x+se(C.left-u)+.5+se(e.left),h.y+b,se(s),se(c.height)),R.drawRectangle(n,r,h.x+se(C.left+e.left-u)+.5,h.y+b,se(o),se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+se(C.left-u)+.5+se(e.left),h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(C.left-u)+.5+se(e.left)+l,h.y+b,se(e.width),se(c.height),F))),0===C.segmentCollection[parseInt(t.toString(),10)].width?C.segmentCollection[parseInt(t.toString(),10)].progressWidth=0:e.width-C.segmentCollection[parseInt(t.toString(),10)].width<e.progressWidth&&e.width!==C.segmentCollection[t].width&&(C.segmentCollection[parseInt(t.toString(),10)].progressWidth=e.progressWidth-(e.width-C.segmentCollection[t].width)),(Y=e.left+e.width)<=s?(C.segmentCollection[parseInt(t.toString(),10)].width=0,C.segmentCollection[parseInt(t.toString(),10)].left=0):(s>=Y-e.width?(C.segmentCollection[parseInt(t.toString(),10)].left=0,C.segmentCollection[parseInt(t.toString(),10)].width=e.width-s):C.segmentCollection[parseInt(t.toString(),10)].left=e.left-p.totalWidth,Y<=w&&(C.segmentCollection[parseInt(t.toString(),10)].width=0)))}),this.pageDetailedWidth+=w):(this.isAutoFit()?ne.isNullOrUndefined(N.value)&&ne.isNullOrUndefined(N.image)?R.drawRectangle(m,y,h.x+(this.left-u)+.5,h.y+b,w,se(c.height)):(R.drawRectangle(m,y,h.x+(this.left-u)+.5,h.y+b,w,se(c.height)),ne.isNullOrUndefined(c.taskbarTemplate.image)||(d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+(this.left-u)+.5,h.y+b+se((c.height-c.taskbarTemplate.image[0].height)/.5),c.taskbarTemplate.image[0].width/2,c.taskbarTemplate.image[0].height/2)),ne.isNullOrUndefined(c.taskbarTemplate.value)||(l=ne.isNullOrUndefined(c.taskbarTemplate.image)?0:c.taskbarTemplate.image[0].width,R.drawString(c.taskbarTemplate.value,x,f,g,h.x+(this.left-u)+l,h.y+b,se(n),se(this.height),F))):ne.isNullOrUndefined(N.value)&&ne.isNullOrUndefined(N.image)?R.drawRectangle(m,y,h.x+se(this.left-u)+.5,h.y+b,se(w),se(c.height)):(R.drawRectangle(m,y,h.x+se(this.left-u)+.5,h.y+b,se(w),se(c.height)),l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+se(this.left-u)+1,h.y+b+1+se((c.height-c.taskbarTemplate.image[0].height)/2),se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||(this.stringLeft=se(this.left),S=this.getWidth(c.taskbarTemplate.value,p.endPoint-this.stringLeft,15),R.drawString(S.lines[0].text,x,f,g,h.x+se(this.left-u)+l,h.y+b,se(n),se(this.height),F),ne.isNullOrUndefined(S.remainder))||(this.remainString=S.remainder,this.stringLeft=p.endPoint)),c.isAutoSchedule&&!c.isSpliterTask&&(P=0,P=this.progressWidth<=w?this.progressWidth:w,ne.isNullOrUndefined(N.image)&&ne.isNullOrUndefined(N.value)&&(this.isAutoFit()?R.drawRectangle(D,k,h.x+(this.left-u)+.5,h.y+b,P,se(c.height)):R.drawRectangle(D,k,h.x+se(this.left-u)+.5,h.y+b,se(P),se(c.height))),this.progressWidth-=P,this.parent.labelSettings.taskLabel)&&!ne.isNullOrUndefined(this.taskLabel)&&(n=U?w:P,this.stringLeft=this.left,ne.isNullOrUndefined(c.taskbarTemplate.value)?(S=this.getWidth(this.taskLabel.toString(),p.endPoint-this.stringLeft,15),R.drawString(S.lines[0].text,t,M,e,h.x+se(this.left-u),h.y+b,se(n),se(this.height),F),ne.isNullOrUndefined(S.remainder)||(this.remainString=S.remainder,this.stringLeft=p.endPoint)):this.isAutoFit()?R.drawString(this.taskLabel.toString(),t,M,e,h.x+(this.left-u)-(E.left+E.right),h.y+b-(E.top+E.bottom),n,se(this.height),F):R.drawString(this.taskLabel.toString(),t,M,e,h.x+se(this.left-u)-(E.left+E.right),h.y+b-(E.top+E.bottom),se(n),se(this.height),F))):this.drawUnscheduledTask(R,h,u,b):(this.isAutoFit()?R.drawRectangle(W,null,h.x+(this.left-u)+.5,h.y+b,w,se(c.height)):R.drawRectangle(W,null,h.x+se(this.left-u)+.5,h.y+b,se(w),se(c.height)),R.save(),R.setTransparency(.87),this.isAutoFit()?R.drawRectangle(null,G,h.x+(this.left-u)+.5,h.y+b,w,se(c.height)):R.drawRectangle(null,G,h.x+se(this.left-u)+.5,h.y+b,se(w),se(c.height)),R.restore(),this.isAutoFit()?R.drawRectangle(null,q,h.x+(this.left-u)+.5,h.y+b,v,se(c.height)):R.drawRectangle(null,q,h.x+se(this.left-u)+.5,h.y+b,se(v),se(c.height)),c.progressWidth=c.progressWidth-v):this.drawUnscheduledTask(R,h,u,b):(o=s=void 0,this.isAutoFit()?(s=new re.PdfLinearGradientBrush(new re.PointF(h.x+(this.left-u)+.5+w/2,0),new re.PointF(h.x+(this.left-u),0),new re.PdfColor(c.unscheduledTaskBarColor),new re.PdfColor(255,255,255)),R.drawRectangle(s,h.x+(this.left-u)+.5,h.y+b,w,se(c.height)),o=new re.PdfLinearGradientBrush(new re.PointF(h.x+(this.left-u)+.5+w,0),new re.PointF(h.x+(this.left-u)+w/2,0),new re.PdfColor(255,255,255),new re.PdfColor(c.unscheduledTaskBarColor)),R.drawRectangle(o,h.x+(this.left-u)+.5+w/2,h.y+b,w/2,se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+(this.left-u)+.5,h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+(this.left-u)+.5+l,h.y+b,se(c.width),se(this.height),F))):(s=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(this.left-u)+.5+se(w)/2,0),new re.PointF(h.x+se(this.left-u),0),new re.PdfColor(c.unscheduledTaskBarColor),new re.PdfColor(255,255,255)),R.drawRectangle(s,h.x+se(this.left-u)+.5,h.y+b,se(w),se(c.height)),o=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(this.left-u)+.5+se(w),0),new re.PointF(h.x+se(this.left-u)+se(w)/2,0),new re.PdfColor(255,255,255),new re.PdfColor(c.unscheduledTaskBarColor)),R.drawRectangle(o,h.x+se(this.left-u)+.5+se(w)/2,h.y+b,se(w)/2,se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+se(this.left-u)+.5,h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(this.left-u)+.5+l,h.y+b,se(c.width),se(this.height),F)))),this.left=0,this.isCompleted=!1,this.startPage=O):X<=p.endDate&&p.startDate<=X&&!this.isCompleted?(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy?!c.isAutoSchedule&&c.isParentTask?((K=new re.PdfPath).addEllipse(0,0,5,5),R.save(),Q=h.x+se(this.left+.5),$=se(c.width)+Q-5,J=h.y+b,R.drawLine(i,Q,J,$,J),R.translateTransform($,J-2),R.drawPath(j,H,K),R.restore(),i.dashStyle=re.PdfDashStyle.Solid):c.isAutoSchedule||c.isParentTask?this.isScheduledTask||"endDate"!==this.unscheduledTaskBy?c.isSpliterTask?(a.dashStyle=re.PdfDashStyle.Dot,R.drawLine(a,new re.PointF(h.x+se(this.left)+.5,h.y+b+se(c.height/2)),new re.PointF(se(c.width)+h.x+se(this.left),h.y+b+se(c.height/2))),c.segmentCollection.map(function(e,t){var i,a,n=ne.isNullOrUndefined(C.taskSegmentStyles)?m:new re.PdfPen(C.taskSegmentStyles[t].taskBorderColor),r=ne.isNullOrUndefined(C.taskSegmentStyles)?y:new re.PdfSolidBrush(C.taskSegmentStyles[t].taskColor);0!==e.width&&e.startDate<p.endDate&&e.endDate>p.startDate&&(0!==C.segmentCollection[t].left&&(C.segmentCollection[t].left=C.segmentCollection[t].left-C.pageDetailedWidth),a=p.totalWidth-e.left,i=a=e.width<a?e.width:a,e.progressWidth<i&&(i=e.progressWidth),R.drawRectangle(n,r,h.x+se(c.left+.5+e.left),h.y+b,se(a),se(c.height)),n=ne.isNullOrUndefined(C.taskSegmentStyles)?D:new re.PdfPen(C.taskSegmentStyles[t].progressColor),r=ne.isNullOrUndefined(C.taskSegmentStyles)?k:new re.PdfSolidBrush(C.taskSegmentStyles[t].progressColor),R.drawRectangle(n,r,h.x+se(c.left+.5+e.left),h.y+b,se(i),se(c.height)),N.image||N.value)&&(a=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?a=0:(a=c.taskbarTemplate.image[0].width,t=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(t,h.x+se(c.left+.5+e.left),h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(c.left+.5+e.left)+a,h.y+b,se(e.width),se(c.height),F))}),this.pageDetailedWidth+=p.totalWidth):R.drawRectangle(m,y,h.x+se(c.left+.5),h.y+b,se(c.width),se(c.height)):this.drawUnscheduledTask(R,h,u,b):(R.drawRectangle(W,null,h.x+se(this.left+.5),h.y+b,se(c.width),se(c.height)),R.save(),R.setTransparency(.87),R.drawRectangle(null,G,h.x+se(this.left+.5),h.y+b,se(c.width),se(c.height)),R.restore(),R.drawRectangle(null,q,h.x+se(this.left+.5),h.y+b,se(c.progressWidth),se(c.height))):(o=s=void 0,s=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(c.left+.5)+se(c.width)/2,0),new re.PointF(h.x+se(c.left+.5),0),new re.PdfColor(c.unscheduledTaskBarColor),new re.PdfColor(255,255,255)),R.drawRectangle(s,h.x+se(c.left+.5),h.y+b,se(c.width),se(c.height)),o=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(c.left+.5)+se(c.width),0),new re.PointF(h.x+se(c.left+.5)+se(c.width)/2,0),new re.PdfColor(255,255,255),new re.PdfColor(c.unscheduledTaskBarColor)),R.drawRectangle(o,h.x+se(c.left+.5)+se(c.width)/2,h.y+b,se(c.width)/2,se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+se(c.left+.5),h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(c.left+.5)+l,h.y+b,se(c.width),se(this.height),F))),this.isScheduledTask&&!c.isSpliterTask&&(ne.isNullOrUndefined(N.image)&&ne.isNullOrUndefined(N.value)&&c.isAutoSchedule&&R.drawRectangle(D,k,h.x+se(c.left+.5),h.y+b,se(c.progressWidth),se(c.height)),ne.isNullOrUndefined(this.taskLabel)||(n=this.progressWidth,U&&(n=this.width),U&&ne.isNullOrUndefined(c.taskbarTemplate.value)?ne.isNullOrUndefined(this.remainString)||(S=this.getWidth(this.remainString,p.endPoint-this.stringLeft,15),R.drawString(S.lines[0].text,t,M,e,h.x+se(this.left)-(E.left+E.right),h.y+b-(E.top+E.bottom),se(n),se(this.height),F)):ne.isNullOrUndefined(this.taskLabel)||U||(n=this.progressWidth,U&&(n=this.width),R.drawString(this.taskLabel.toString(),t,M,e,h.x+se(this.left)-(E.left+E.right),h.y+b-(E.top+E.bottom),se(n),se(this.height),F)))),this.isCompleted=!0,this.endPage=O):Z<p.startDate&&X>p.endDate&&(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),this.isScheduledTask||"duration"!==this.unscheduledTaskBy?this.isScheduledTask||"endDate"!==this.unscheduledTaskBy?c.isAutoSchedule||c.isParentTask?!c.isAutoSchedule&&c.isParentTask?(i.dashStyle=re.PdfDashStyle.Solid,R.drawLine(i,h.x+se(c.left)+.5,h.y+b,se(p.totalWidth),h.y+b)):c.isSpliterTask?(a.dashStyle=re.PdfDashStyle.Dot,this.isAutoFit()?R.drawLine(a,new re.PointF(h.x+this.left+.5,h.y+b+se(c.height/2)),new re.PointF(p.totalWidth+h.x+this.left,h.y+b+se(c.height/2))):R.drawLine(a,new re.PointF(h.x+se(this.left)+.5,h.y+b+se(c.height/2)),new re.PointF(se(p.totalWidth)+h.x+se(this.left),h.y+b+se(c.height/2))),c.segmentCollection.map(function(e,t){var i,a,n=ne.isNullOrUndefined(C.taskSegmentStyles)?m:new re.PdfPen(C.taskSegmentStyles[t].taskBorderColor),r=ne.isNullOrUndefined(C.taskSegmentStyles)?y:new re.PdfSolidBrush(C.taskSegmentStyles[t].taskColor);0!==e.width&&e.startDate<p.endDate&&e.endDate>p.startDate&&(0!==C.segmentCollection[t].left&&(C.segmentCollection[t].left=C.segmentCollection[t].left-C.pageDetailedWidth),i=p.totalWidth-e.left,a=i=e.width<i?e.width:i,e.progressWidth<a&&(a=e.progressWidth),R.drawRectangle(n,r,h.x+se(c.left+.5+e.left),h.y+b,se(i),se(c.height)),n=ne.isNullOrUndefined(C.taskSegmentStyles)?D:new re.PdfPen(C.taskSegmentStyles[t].progressColor),r=ne.isNullOrUndefined(C.taskSegmentStyles)?k:new re.PdfSolidBrush(C.taskSegmentStyles[t].progressColor),R.drawRectangle(n,r,h.x+se(c.left+.5+e.left),h.y+b,se(a),se(c.height)),e.width>i)&&(C.segmentCollection[parseInt(t.toString(),10)].width=e.width-i,C.segmentCollection[parseInt(t.toString(),10)].left=0)}),this.pageDetailedWidth+=p.totalWidth):(R.drawRectangle(m,y,h.x+se(c.left)+.5,h.y+b,se(p.totalWidth),se(c.height)),ne.isNullOrUndefined(c.taskbarTemplate.value)||ne.isNullOrUndefined(this.remainString)||(S=this.getWidth(this.remainString,p.endPoint-this.stringLeft,15),R.drawString(S.lines[0].text,x,f,g,h.x+se(c.left)+.5,h.y+b,se(p.totalWidth),se(this.height),F)),this.isScheduledTask&&!c.isParentTask&&(P=0,P=this.progressWidth<=p.totalWidth?this.progressWidth:p.totalWidth,ne.isNullOrUndefined(N.image)&&ne.isNullOrUndefined(N.value)&&R.drawRectangle(D,k,h.x+se(c.left)+.5,h.y+b,se(P),se(c.height)),this.progressWidth-=P,ne.isNullOrUndefined(this.taskLabel)||(n=P,U&&(n=this.width),R.drawString(this.taskLabel.toString(),t,M,e,h.x+se(this.left)-(E.left+E.right),h.y+b-(E.top+E.bottom),se(n),se(this.height),F)))):(R.drawRectangle(W,null,h.x+se(c.left)+.5,h.y+b,se(p.totalWidth),se(c.height)),R.save(),R.setTransparency(.87),R.drawRectangle(null,G,h.x+se(c.left)+.5,h.y+b,se(p.totalWidth),se(c.height)),R.restore(),P=0,P=this.progressWidth<=p.totalWidth?this.progressWidth:p.totalWidth,ne.isNullOrUndefined(N.image)&&ne.isNullOrUndefined(N.value)&&R.drawRectangle(D,k,h.x+se(c.left)+.5,h.y+b,se(P),se(c.height)),this.progressWidth-=P,R.drawRectangle(null,q,h.x+se(c.left)+.5,h.y+b,se(P),se(c.height))):this.drawUnscheduledTask(R,h,u,b):(o=s=void 0,s=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(c.left)+.5+se(p.totalWidth)/2,0),new re.PointF(h.x+se(c.left),0),new re.PdfColor(c.unscheduledTaskBarColor),new re.PdfColor(255,255,255)),R.drawRectangle(s,h.x+se(c.left)+.5,h.y+b,se(p.totalWidth),se(c.height)),o=new re.PdfLinearGradientBrush(new re.PointF(h.x+se(c.left)+.5+se(p.totalWidth),0),new re.PointF(h.x+se(c.left)+se(p.totalWidth)/2,0),new re.PdfColor(255,255,255),new re.PdfColor(c.unscheduledTaskBarColor)),R.drawRectangle(o,h.x+se(c.left)+.5+se(p.totalWidth)/2,h.y+b,se(p.totalWidth)/2,se(c.height)),(N.image||N.value)&&(l=void 0,ne.isNullOrUndefined(c.taskbarTemplate.image)?l=0:(l=c.taskbarTemplate.image[0].width,d=new re.PdfBitmap(c.taskbarTemplate.image[0].base64),R.drawImage(d,h.x+se(c.left)+.5,h.y+b,se(c.taskbarTemplate.image[0].width),se(c.taskbarTemplate.image[0].height))),ne.isNullOrUndefined(c.taskbarTemplate.value)||R.drawString(c.taskbarTemplate.value,x,f,g,h.x+se(c.left+.5)+l,h.y+b,se(c.width),se(this.height),F))),this.isCompleted=!1,this.width-=p.totalWidth),this.parent.renderBaseline&&c.baselineStartDate&&c.baselineEndDate&&(p.startDate<=c.baselineStartDate&&c.baselineEndDate<=p.endDate?(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),this.parent.renderBaseline&&c.baselineStartDate&&c.baselineEndDate&&(this.isAutoFit()?R.drawRectangle(I,ae,h.x+(c.baselineLeft-u)+.5,h.y+b+se(c.height+3),c.baselineWidth,se(this.baselineHeight)):R.drawRectangle(I,ae,h.x+se(c.baselineLeft-u)+.5,h.y+b+se(c.height+3),se(c.baselineWidth),se(this.baselineHeight))),this.isCompletedBaseline=!0,this.startPage=O,this.endPage=O):p.startDate<=c.baselineStartDate&&p.endDate>=c.baselineStartDate&&c.baselineEndDate>=p.endDate?(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),T=0,(ee=this.baselineWidth)<(T=p.totalWidth-(c.baselineLeft-u))&&(T=ee),this.parent.renderBaseline&&c.baselineStartDate&&c.baselineEndDate&&(this.isAutoFit()?R.drawRectangle(I,ae,h.x+(c.baselineLeft-u)+.5,h.y+b+se(c.height+3),T,se(this.baselineHeight)):R.drawRectangle(I,ae,h.x+se(c.baselineLeft-u)+.5,h.y+b+se(c.height+3),se(T),se(this.baselineHeight))),c.baselineWidth=c.baselineWidth-T,this.baselineLeft=0,this.isCompletedBaseline=!1,this.startPage=O):c.baselineEndDate<=p.endDate&&p.startDate<=c.baselineEndDate&&!this.isCompletedBaseline?(this.parent.renderBaseline&&c.baselineStartDate&&c.baselineEndDate&&(this.isAutoFit()?R.drawRectangle(I,ae,h.x+(c.baselineLeft+.5),h.y+b+se(c.height+3),c.baselineWidth,se(this.baselineHeight)):R.drawRectangle(I,ae,h.x+se(c.baselineLeft+.5),h.y+b+se(c.height+3),se(c.baselineWidth),se(this.baselineHeight))),this.isCompletedBaseline=!0,this.endPage=O):c.baselineStartDate<p.startDate&&c.baselineEndDate>p.endDate&&(this.parent.renderBaseline&&c.baselineStartDate&&c.baselineEndDate&&(this.isAutoFit()?R.drawRectangle(I,ae,h.x+c.baselineLeft+.5,h.y+b+se(c.height+3),p.totalWidth,se(c.baselineHeight)):R.drawRectangle(I,ae,h.x+se(c.baselineLeft)+.5,h.y+b+se(c.height+3),se(p.totalWidth),se(c.baselineHeight))),this.isCompletedBaseline=!1,this.baselineWidth-=p.totalWidth)),!this.isAutoSchedule&&c.isParentTask&&(p.startDate<=c.autoStartDate&&c.autoEndDate<=p.endDate?(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),!c.isAutoSchedule&&c.isParentTask&&(this.isAutoFit()?R.drawRectangle(A,null,h.x+(this.autoLeft-u)+.5,h.y+b+10,this.autoWidth,se(12)):R.drawRectangle(A,null,h.x+se(this.autoLeft-u)+.5,h.y+b+10,se(this.autoWidth),se(12)),R.save(),R.setTransparency(.87),this.isAutoFit()?R.drawRectangle(null,z,h.x+(this.autoLeft-u)+.5,h.y+b+10,this.autoWidth,se(12)):R.drawRectangle(null,z,h.x+se(this.autoLeft-u)+.5,h.y+b+10,se(this.autoWidth),se(12)),R.restore(),this.isAutoFit()?R.drawRectangle(null,_,h.x+(this.autoLeft-u)+.5,h.y+b+10,c.progressWidth,se(12)):R.drawRectangle(null,_,h.x+se(this.autoLeft-u)+.5,h.y+b+10,se(c.progressWidth),se(12))),ne.isNullOrUndefined(this.taskLabel)||(this.isAutoFit()?R.drawString(this.taskLabel.toString(),t,M,e,h.x+(this.autoLeft-u)+.5-(E.left+E.right),h.y+b+8-(E.top+E.bottom),this.autoWidth,se(this.height),F):R.drawString(this.taskLabel.toString(),t,M,e,h.x+se(this.autoLeft-u)+.5-(E.left+E.right),h.y+b+8-(E.top+E.bottom),se(this.autoWidth),se(this.height),F)),this.isCompletedAutotask=!0,this.startPage=O,this.endPage=O):p.startDate<=c.autoStartDate&&p.endDate>=c.autoStartDate&&c.autoEndDate>=p.endDate?(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),v=T=0,T=p.totalWidth-(this.autoLeft-u),v=p.totalWidth-(this.autoLeft-u),!c.isAutoSchedule&&c.isParentTask&&(this.isAutoFit()?R.drawRectangle(A,null,h.x+(this.autoLeft-u)+.5,h.y+b+10,T,se(12)):R.drawRectangle(A,null,h.x+se(this.autoLeft-u)+.5,h.y+b+10,se(T),se(12)),R.save(),R.setTransparency(.87),this.isAutoFit()?R.drawRectangle(null,z,h.x+(this.autoLeft-u)+.5,h.y+b+10,T,se(12)):R.drawRectangle(null,z,h.x+se(this.autoLeft-u)+.5,h.y+b+10,se(T),se(12)),R.restore(),this.isAutoFit()?R.drawRectangle(null,_,h.x+(this.autoLeft-u)+.5,h.y+b+10,c.progressWidth,se(12)):R.drawRectangle(null,_,h.x+se(this.autoLeft-u)+.5,h.y+b+10,se(v),se(12)),c.autoWidth=c.autoWidth-T,c.progressWidth=c.progressWidth-v),this.parent.labelSettings.taskLabel&&!ne.isNullOrUndefined(this.taskLabel)&&(this.stringLeft=this.autoLeft,ne.isNullOrUndefined(c.taskbarTemplate.value)?(S=this.getWidth(this.taskLabel.toString(),p.endPoint-this.stringLeft,15),R.drawString(S.lines[0].text,t,M,e,h.x+se(this.autoLeft-u)+.5,h.y+b+10,se(c.progressWidth),se(this.height),F),ne.isNullOrUndefined(S.remainder)||(this.remainString=S.remainder,this.stringLeft=p.endPoint)):this.isAutoFit()?R.drawString(this.taskLabel.toString(),t,M,e,h.x+(this.autoLeft-u)+.5-(E.left+E.right),h.y+b+10-(E.top+E.bottom),c.progressWidth,se(this.height),F):R.drawString(this.taskLabel.toString(),t,M,e,h.x+se(this.autoLeft-u)+.5-(E.left+E.right),h.y+b+10-(E.top+E.bottom),se(c.progressWidth),se(this.height),F)),this.autoLeft=0,this.isCompletedAutotask=!1,this.startPage=O):c.autoEndDate<=p.endDate&&p.startDate<=c.autoEndDate&&!this.isCompletedAutotask?(this.isStartPoint?!c.isAutoSchedule&&c.isParentTask&&(R.drawRectangle(A,null,h.x+se(this.autoLeft+.5),h.y+b+10,se(c.autoWidth),se(12)),R.save(),R.setTransparency(.87),R.drawRectangle(z,h.x+se(this.autoLeft+.5),h.y+b+10,se(c.autoWidth),se(12)),R.restore(),R.drawRectangle(null,_,h.x+se(this.autoLeft+.5),h.y+b+10,se(c.progressWidth),se(12))):(this.taskStartPoint=zn({},h),this.isStartPoint=!0),ne.isNullOrUndefined(this.taskLabel)||(U&&ne.isNullOrUndefined(c.taskbarTemplate.value)?ne.isNullOrUndefined(this.remainString)||(S=this.getWidth(this.remainString,p.endPoint-this.stringLeft,15),R.drawString(S.lines[0].text,t,M,e,h.x+se(this.autoLeft+.5)-(E.left+E.right),h.y+b+10-(E.top+E.bottom),se(c.progressWidth),se(this.height),F)):ne.isNullOrUndefined(this.taskLabel)||U||R.drawString(this.taskLabel.toString(),t,M,e,h.x+se(this.autoLeft+.5)-(E.left+E.right),h.y+b+10-(E.top+E.bottom),se(c.progressWidth),se(this.height),F)),this.isCompletedAutotask=!0,this.endPage=O):c.autoStartDate<p.startDate&&c.autoEndDate>p.endDate&&(this.isStartPoint||(this.taskStartPoint=zn({},h),this.isStartPoint=!0),!c.isAutoSchedule&&c.isParentTask&&(P=0,P=this.progressWidth<=p.totalWidth?this.progressWidth:p.totalWidth,this.isAutoFit()?R.drawRectangle(null,_,h.x+(this.autoLeft+.5),h.y+b+10,P,se(12)):0!==c.progressWidth&&R.drawRectangle(null,_,h.x+se(this.autoLeft+.5),h.y+b+10,se(P),se(12)),this.progressWidth-=P,this.isAutoFit()?R.drawRectangle(A,null,h.x+this.autoLeft+.5,h.y+b+10,p.totalWidth,se(12)):R.drawRectangle(A,null,h.x+se(this.autoLeft)+.5,h.y+b+10,se(p.totalWidth),se(12)),R.save(),R.setTransparency(.87),this.isAutoFit()?R.drawRectangle(null,z,h.x+(this.autoLeft-u)+.5,h.y+b+10,p.totalWidth,se(12)):R.drawRectangle(null,z,h.x+se(this.autoLeft)+.5,h.y+b+10,se(p.totalWidth),se(12)),R.restore()),this.isCompletedAutotask=!1,this.autoWidth-=p.totalWidth)),!ne.isNullOrUndefined(c.indicators)&&0<c.indicators.length&&c.indicators.map(function(e,t){var i,a,n=C.parent.dateValidationModule.getDateFromFormat(e.date,!0);p.startDate<=n&&n<=p.endDate&&(n=C.parent.chartRowsModule.getIndicatorleft(e.date),ne.isNullOrUndefined(e.base64)||(i=new re.PdfBitmap(e.base64),C.isAutoFit()?(R.drawImage(i,h.x+(n-u)+.5+10-C.parent.perDayWidth/2,h.y+b,10,10),a=R.save(),R.setClip(new re.RectangleF(h.x,h.y,r.contentWidth,L)),R.drawString(e.name,ie,null,re.PdfBrushes.Black,h.x+(n-u)+.5+15+10-C.parent.perDayWidth/2,h.y+b,null)):(R.drawImage(i,h.x+se(n-u)+.5+10,h.y+b,10,10),a=R.save(),R.setClip(new re.RectangleF(h.x,h.y,r.contentWidth,L)),R.drawString(e.name,ie,null,re.PdfBrushes.Black,h.x+se(n-u)+.5+15+10,h.y+b,null)),R.restore(a)))})),this.drawRightLabel(r,h,p,u),te},qn.prototype.getPdfFont=function(e){var t,i,a;return e&&e.label&&(e.label.fontSize||e.label.fontStyle||e.label.fontFamily)&&(t=e.label.fontSize||this.defaultFontSize,i=e.label.fontFamily,i=e.label.fontFamily?i:this.fontFamily,a=e.label.fontStyle,e=e.label.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(a):re.PdfFontStyle.Regular,a=new re.PdfStandardFont(i,t,e)),a},qn.prototype.drawRightLabel=function(e,t,i,a){var n=e.graphics;if(ne.isNullOrUndefined(this.rightTaskLabel.value))if(ne.isNullOrUndefined(this.labelSettings.rightLabel.image))this.labelSettings.rightLabel.value&&this.drawRightLabelValue(e,t,i,a,this.labelSettings.rightLabel.value);else{this.previousWidthofRightImage=0;for(var r,s=this.previousWidthofRightValue=0;s<this.labelSettings.rightLabel.image.length;s++)this.drawRigthlabelImage(e,t,i,a,this.labelSettings.rightLabel.image[s]),this.labelSettings.rightLabel.value&&(r=this.labelSettings.rightLabel.value.split(","))&&(this.rightTaskLabel.isCompleted=!1,this.drawRightLabelValue(e,t,i,a-this.spaceBetweenImageAndValue,r[s]))}else{var o,l,d,h,p,u,c,g,f,m,y=this.rightTaskLabel.isLeftCalculated||this.isAutoFit()?this.rightTaskLabel.left:se(this.rightTaskLabel.left),D=void 0,D=this.isAutoFit()?y-a+t.x:y-se(a)+t.x,y=this.isAutoFit()?se(y):y;i.startPoint<=y&&y<i.endPoint&&!ne.isNullOrUndefined(this.rightTaskLabel.value)&&!this.rightTaskLabel.isCompleted&&(y=this.getWidth(this.rightTaskLabel.value,i.endPoint-y,15),g=new re.PdfStandardFont(this.fontFamily,this.defaultFontSize),o=void 0,p=this.parent.pdfExportModule.helper.exportProps.ganttStyle,ne.isNullOrUndefined(p)||ne.isNullOrUndefined(p.label)||ne.isNullOrUndefined(p.label.fontSize)&&ne.isNullOrUndefined(p.label.fontStyle)&&ne.isNullOrUndefined(p.label.fontFamily)||(o=this.getPdfFont(p)),ne.isNullOrUndefined(o)||(g=o),o={left:0,right:0,top:0,bottom:0},ne.isNullOrUndefined(p)||ne.isNullOrUndefined(p.label)||ne.isNullOrUndefined(p.label.padding)||(o=p.label.padding),!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(g=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),l=(se(this.parent.rowHeight)-y.actualSize.height)/2,l=new re.PointF(D+o.left,t.y+l+o.top),D=new re.SizeF(e.contentWidth-D-(o.left+o.right),y.actualSize.height-(o.top+o.bottom)),o=new re.RectangleF(l,D),(l=new re.PdfStringFormat).alignment=re.PdfTextAlignment.Left,l.lineAlignment=re.PdfVerticalAlignment.Middle,ne.isNullOrUndefined(p)||ne.isNullOrUndefined(p.label)||ne.isNullOrUndefined(p.label.format)||ne.isNullOrUndefined(p.label.format.alignment)||(l.alignment=p.label.format.alignment),0<y.actualSize.width?(p=this.parent.pdfExportModule.helper.exportProps.ganttStyle,f=new re.PdfSolidBrush(p&&p.label&&p.label.fontBrush?p.label.fontBrush:this.labelColor),d=null,ne.isNullOrUndefined(p)||ne.isNullOrUndefined(p.label)||ne.isNullOrUndefined(p.label.backgroundColor)||(d=new re.PdfSolidBrush(p.label.backgroundColor)),h=null,ne.isNullOrUndefined(p)||ne.isNullOrUndefined(p.label)||ne.isNullOrUndefined(p.label.borderColor)||(h=new re.PdfPen(p.label.borderColor)),this.labelSettings.rightLabel&&(this.labelSettings.rightLabel.fontStyle.fontSize||this.labelSettings.rightLabel.fontStyle.fontStyle||this.labelSettings.rightLabel.fontStyle.fontFamily)&&(m=(p=this.labelSettings.rightLabel).fontStyle&&p.fontStyle.fontFamily?p.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,u=p.fontStyle&&p.fontStyle.fontSize?p.fontStyle.fontSize:g.fontSize||this.defaultFontSize,c=p.fontStyle&&"string"==typeof p.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(p.fontStyle.fontStyle):p.fontStyle&&p.fontStyle.fontStyle?p.fontStyle.fontStyle:re.PdfFontStyle.Regular,g=new re.PdfStandardFont(m,u,c),f=p.fontStyle.fontColor?new re.PdfSolidBrush(p.fontStyle.fontColor):f),m=g.measureString(y.lines[0].text),n.drawRectangle(h,d,o.x-3,o.y,m.width+6,m.height),n.drawString(y.lines[0].text,g,null,f,o.x,o.y,D.width,D.height,l),null!==y.remainder?(this.rightTaskLabel.value=y.remainder,this.rightTaskLabel.left=i.endPoint,this.rightTaskLabel.isLeftCalculated=!0):this.rightTaskLabel.isCompleted=!0):this.rightTaskLabel.left=i.endPoint)}},qn.prototype.drawRigthlabelImage=function(e,t,i,a,n){var r,s,e=e.graphics;ne.isNullOrUndefined(this.labelSettings.rightLabel)||ne.isNullOrUndefined(this.labelSettings.rightLabel.image)||(s=void(this.labelSettings.isLeftCalculated?r=this.rightTaskLabel.left:this.isAutoFit()?1<this.labelSettings.rightLabel.image.length?(r=this.rightTaskLabel.left+ +this.previousWidthofRightValue,this.previousWidthofRightImage=n.width):r=this.rightTaskLabel.left:(s=void 0,ne.isNullOrUndefined(this.labelSettings.rightLabel.value)||(s=this.labelSettings.rightLabel.value.split(",")),1<this.labelSettings.rightLabel.image.length&&1<s.length?(r=se(this.rightTaskLabel.left)+this.previousWidthofRightValue,this.previousWidthofRightImage=n.width):1<this.labelSettings.rightLabel.image.length?(r=se(this.rightTaskLabel.left)+this.previousWidthofRightImage,this.previousWidthofRightImage=n.width):r=se(this.rightTaskLabel.left))),s=this.isAutoFit()?r-a+t.x:r-se(a)+t.x,a=this.isAutoFit()?se(r):r,i.startPoint<=a&&a<i.endPoint&&!ne.isNullOrUndefined(this.labelSettings.rightLabel)&&!this.rightTaskLabel.isCompleted&&(r=new re.SizeF(n.width,n.height),a=(se(this.parent.rowHeight)-r.height)/2,s=new re.PointF(s,t.y+a),t=new re.SizeF(r.width,r.height),a=new re.RectangleF(s,t),s=new re.PdfBitmap(n.base64),0<r.width?(e.drawImage(s,a.x,a.y,r.width,r.height),null!==this.labelSettings.rightLabel.value?this.rightTaskLabel.isLeftCalculated=!0:ne.isNullOrUndefined(this.labelSettings.rightLabel.value)&&(this.rightTaskLabel.isCompleted=!0)):this.rightTaskLabel.left=i.endPoint))},qn.prototype.drawRightLabelValue=function(e,t,i,a,n){var r,s,o,l,d,h,e=e.graphics;ne.isNullOrUndefined(this.labelSettings.rightLabel.value)||(s=void(this.labelSettings.isLeftCalculated?h=this.rightTaskLabel.left:this.isAutoFit()?this.labelSettings.rightLabel.image?1<this.labelSettings.rightLabel.image.length?(h=this.rightTaskLabel.left+this.previousWidthofRightImage+this.previousWidthofRightValue,ne.isNullOrUndefined(n)||(r=this.getWidthofrightLabel(n,i.endPoint-h,15),this.previousWidthofRightValue+=r.actualSize.width+this.previousWidthofRightImage)):h=this.rightTaskLabel.left+this.labelSettings.rightLabel.image[0].width:h=this.rightTaskLabel.left:this.labelSettings.rightLabel.image?1<this.labelSettings.rightLabel.image.length?(h=se(this.rightTaskLabel.left)+this.previousWidthofRightImage+this.previousWidthofRightValue,ne.isNullOrUndefined(n)||(r=this.getWidthofrightLabel(n,i.endPoint-h,15),this.previousWidthofRightValue+=r.actualSize.width+this.previousWidthofRightImage)):h=se(this.rightTaskLabel.left)+this.labelSettings.rightLabel.image[0].width:h=se(this.rightTaskLabel.left)),s=this.isAutoFit()?h-a+t.x:h-se(a)+t.x,a=this.isAutoFit()?se(h):h,i.startPoint<=a&&a<i.endPoint&&!ne.isNullOrUndefined(n)&&!this.rightTaskLabel.isCompleted&&(r=this.getWidthofrightLabel(n,i.endPoint-a,15),h=new re.PdfStandardFont(this.fontFamily,this.defaultFontSize),!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(h=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),a=(se(this.parent.rowHeight)-r.actualSize.height)/2,s=new re.PointF(s,t.y+a),t=new re.SizeF(r.actualSize.width,r.actualSize.height),a=new re.RectangleF(s,t),(s=new re.PdfStringFormat).alignment=re.PdfTextAlignment.Right,s.lineAlignment=re.PdfVerticalAlignment.Middle,0<r.actualSize.width?(t=new re.PdfSolidBrush(this.labelColor),d=(o=this.labelSettings.rightLabel).fontStyle&&o.fontStyle.fontFamily?o.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,h=o.fontStyle&&o.fontStyle.fontSize?o.fontStyle.fontSize:h.fontSize||this.defaultFontSize,l=o.fontStyle&&"string"==typeof o.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(o.fontStyle.fontStyle):o.fontStyle&&o.fontStyle.fontStyle?o.fontStyle.fontStyle:re.PdfFontStyle.Regular,d=new re.PdfStandardFont(d,h,l),h=o.fontStyle.fontColor?new re.PdfSolidBrush(o.fontStyle.fontColor):t,e.drawString(n,d,null,h,a.x,a.y,r.actualSize.width,r.actualSize.height,s),ne.isNullOrUndefined(r.remainder)||null===r.remainder?ne.isNullOrUndefined(o.value)&&(this.rightTaskLabel.isCompleted=!0):(this.rightTaskLabel.value=r.remainder,this.rightTaskLabel.left=i.endPoint,this.rightTaskLabel.isLeftCalculated=!0)):this.rightTaskLabel.left=i.endPoint))},qn.prototype.drawLeftLabel=function(e,t,i,a,n){var r=e.graphics;if(ne.isNullOrUndefined(this.leftTaskLabel.value))if(ne.isNullOrUndefined(this.labelSettings.leftLabel)||ne.isNullOrUndefined(this.labelSettings.leftLabel.image))ne.isNullOrUndefined(this.labelSettings.leftLabel)||ne.isNullOrUndefined(this.labelSettings.leftLabel.value)||this.drawLeftLabelValue(e,t,i,a,this.labelSettings.leftLabel.value);else{this.previousWidthofLeftImage=0,this.previousWidthofLeftValue=0;for(var s=this.totalLeftWidth=0;s<this.labelSettings.leftLabel.image.length;s++){var o=void 0,l=void 0,d=(ne.isNullOrUndefined(this.labelSettings.leftLabel.value)||(o=this.labelSettings.leftLabel.value.split(","),l=this.getWidth(o[s],Number.MAX_VALUE,15)),ne.isNullOrUndefined(l)?0:l.actualSize.width);this.totalLeftWidth+=this.labelSettings.leftLabel.image[s].width+d}for(s=0;s<this.labelSettings.leftLabel.image.length;s++)this.drawLeftLabelImage(e,t,i,a,this.labelSettings.leftLabel.image[s]),this.labelSettings.leftLabel.value&&(o=this.labelSettings.leftLabel.value.split(","))&&this.drawLeftLabelValue(e,t,i,a-this.spaceBetweenImageAndValue,o[s])}else{var l,h,p,u,c,g,f,m,y=this.left,y=(this.leftTaskLabel.isLeftCalculated?u=this.leftTaskLabel.left:(l=this.getWidth(this.leftTaskLabel.value,Number.MAX_VALUE,15),D=this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33,u=this.isAutoFit()?y-D-l.actualSize.width:se(y-D)-l.actualSize.width,this.leftTaskLabel.left=u,this.leftTaskLabel.isLeftCalculated=!0),void 0),D=(this.isAutoFit()?(y=u-se(a)+t.x,!n.isAutoSchedule&&n.isParentTask&&(f=n.left-n.autoLeft,y=n.left<n.autoLeft?u-a+t.x:u-a+t.x-f)):(y=u-se(a)+t.x,!n.isAutoSchedule&&n.isParentTask&&(f=se(n.left)-se(n.autoLeft),y=n.left<n.autoLeft?u-se(a)+t.x:u-se(a)+t.x-f)),this.isAutoFit()?se(u):u);i.startPoint<=D&&D<i.endPoint&&!ne.isNullOrUndefined(this.leftTaskLabel.value)&&!this.leftTaskLabel.isCompleted&&(l=this.getWidth(this.leftTaskLabel.value,i.endPoint-D,15),n=new re.PdfStandardFont(this.fontFamily,this.defaultFontSize),f=void 0,u=this.parent.pdfExportModule.helper.exportProps.ganttStyle,ne.isNullOrUndefined(u)||ne.isNullOrUndefined(u.label)||ne.isNullOrUndefined(u.label.fontSize)&&ne.isNullOrUndefined(u.label.fontStyle)&&ne.isNullOrUndefined(u.label.fontFamily)||(f=this.getPdfFont(u)),ne.isNullOrUndefined(f)||(n=f),!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(n=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),D={left:0,right:0,top:0,bottom:0},ne.isNullOrUndefined(u)||ne.isNullOrUndefined(u.label)||ne.isNullOrUndefined(u.label.padding)||(D=u.label.padding),f=(se(this.parent.rowHeight)-l.actualSize.height)/2,y=new re.PointF(y+D.left,t.y+f+D.top),f=new re.SizeF(l.actualSize.width-(D.left+D.right),l.actualSize.height-(D.top+D.bottom)),D=new re.RectangleF(y,f),(y=new re.PdfStringFormat).alignment=re.PdfTextAlignment.Right,y.lineAlignment=re.PdfVerticalAlignment.Middle,0<l.actualSize.width?(f=new re.PdfSolidBrush(u&&u.label&&u.label.fontBrush?u.label.fontBrush:this.labelColor),h=null,ne.isNullOrUndefined(u)||ne.isNullOrUndefined(u.label)||ne.isNullOrUndefined(u.label.backgroundColor)||(h=new re.PdfSolidBrush(u.label.backgroundColor)),p=null,ne.isNullOrUndefined(u)||ne.isNullOrUndefined(u.label)||ne.isNullOrUndefined(u.label.borderColor)||(p=new re.PdfPen(u.label.borderColor)),this.labelSettings.leftLabel&&(this.labelSettings.leftLabel.fontStyle.fontSize||this.labelSettings.leftLabel.fontStyle.fontStyle||this.labelSettings.leftLabel.fontStyle.fontFamily)&&(m=(u=this.labelSettings.leftLabel).fontStyle&&u.fontStyle.fontFamily?u.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,c=u.fontStyle&&u.fontStyle.fontSize?u.fontStyle.fontSize:n.fontSize||this.defaultFontSize,g=u.fontStyle&&"string"==typeof u.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(u.fontStyle.fontStyle):u.fontStyle&&u.fontStyle.fontStyle?u.fontStyle.fontStyle:re.PdfFontStyle.Regular,n=new re.PdfStandardFont(m,c,g),f=u.fontStyle.fontColor?new re.PdfSolidBrush(u.fontStyle.fontColor):f),m=n.measureString(l.lines[0].text),r.drawRectangle(p,h,D.x-3,D.y,m.width+6,m.height),r.drawString(l.lines[0].text,n,null,f,D.x,D.y,l.actualSize.width,l.actualSize.height,y),null!==l.remainder?(this.leftTaskLabel.value=l.remainder,this.leftTaskLabel.left=i.endPoint):this.leftTaskLabel.isCompleted=!0):this.leftTaskLabel.left=i.endPoint)}},qn.prototype.drawLeftLabelImage=function(e,t,i,a,n){var r,s,o,l,e=e.graphics,d=this.left;ne.isNullOrUndefined(this.labelSettings.leftLabel)||ne.isNullOrUndefined(this.labelSettings.leftLabel.image)||(l=void(this.leftTaskLabel.isLeftCalculated?o=1<this.labelSettings.leftLabel.image.length?this.leftTaskLabel.left+this.previousWidthofLeftValue:this.leftTaskLabel.left:(r=new re.SizeF(n.width,n.height),s=this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33,l=this.labelSettings.leftLabel.value.split(","),this.isAutoFit()?0<this.labelSettings.leftLabel.image.length&&0<l.length?(o=d-this.totalLeftWidth-r.width,this.previousWidthofLeftImage+=r.width):o=d-s-r.width:0<this.labelSettings.leftLabel.image.length&&0<l.length?(o=se(d)-this.totalLeftWidth-r.width,this.previousWidthofLeftImage+=r.width):o=se(d-s)-r.width,this.leftTaskLabel.left=o,this.leftTaskLabel.isLeftCalculated=!0)),this.isAutoFit(),l=o-se(a)+t.x,i.startPoint<=o&&o<i.endPoint&&!ne.isNullOrUndefined(n)&&!this.leftTaskLabel.isCompleted&&(r=new re.SizeF(n.width,n.height),d=(se(this.parent.rowHeight)-r.height)/2,s=new re.PointF(l,t.y+d),a=new re.SizeF(r.width,r.height),o=new re.RectangleF(s,a),l=new re.PdfBitmap(n.base64),0<r.width?(e.drawImage(l,o.x,o.y,r.width,r.height),this.totalLeftWidth=this.totalLeftWidth-r.width):this.leftTaskLabel.left=i.endPoint))},qn.prototype.drawLeftLabelValue=function(e,t,i,a,n){var r,s,o,l,d,h,p,u,c,e=e.graphics;ne.isNullOrUndefined(n)||(h=0,h=this.left,l=void(this.leftTaskLabel.isLeftCalculated?1===(c=this.labelSettings.leftLabel.value.split(",")).length?(s=this.leftTaskLabel.left+(this.previousWidthofLeftImage||0),this.labelSettings.left=s,r=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15),this.previousWidthofLeftValue+=this.previousWidthofLeftImage+r.actualSize.width):1<c.length?(u=0!==this.previousWidthofLeftValue?this.previousWidthofLeftValue+this.previousWidthofLeftImage:this.previousWidthofLeftImage,s=this.leftTaskLabel.left+u,this.labelSettings.left=s,r=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15),this.previousWidthofLeftValue+=this.previousWidthofLeftImage+r.actualSize.width):s=this.leftTaskLabel.left:(r=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15),p=this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33,c=this.labelSettings.leftLabel.value.split(","),this.isAutoFit()?(o=(l=!ne.isNullOrUndefined(this.labelSettings.leftLabel.image))?this.labelSettings.leftLabel.image.length:0,1===c.length&&l&&1===o?(s=this.leftTaskLabel.left+this.previousWidthofLeftImage,this.labelSettings.left=s,d=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15),this.previousWidthofLeftValue+=this.previousWidthofLeftImage+d.actualSize.width):1<c.length&&l&&1<o?(u=0!==this.previousWidthofLeftValue?this.previousWidthofLeftValue+this.previousWidthofLeftImage:this.previousWidthofLeftImage,s=this.leftTaskLabel.left+u,this.labelSettings.left=s,d=this.getWidthofLeftLabel(n,Number.MAX_VALUE,15),this.previousWidthofLeftValue+=this.previousWidthofLeftImage+d.actualSize.width):s=h-p-r.actualSize.width):s=se(h-p)-r.actualSize.width,this.leftTaskLabel.left=s,this.leftTaskLabel.isLeftCalculated=!0)),this.isAutoFit(),l=s-se(a)+t.x,o=this.isAutoFit()?se(s):s,i.startPoint<=o&&o<i.endPoint&&!ne.isNullOrUndefined(n)&&!this.leftTaskLabel.isCompleted&&(r=this.getWidthofLeftLabel(n,i.endPoint-o,15),u=new re.PdfStandardFont(this.fontFamily,this.defaultFontSize),!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(u=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),d=(se(this.parent.rowHeight)-r.actualSize.height)/2,h=new re.PointF(l,t.y+d),p=new re.SizeF(r.actualSize.width,r.actualSize.height),a=new re.RectangleF(h,p),(s=new re.PdfStringFormat).alignment=re.PdfTextAlignment.Right,s.lineAlignment=re.PdfVerticalAlignment.Middle,0<r.actualSize.width?(o=new re.PdfSolidBrush(this.labelColor),t=(l=this.labelSettings.leftLabel).fontStyle&&l.fontStyle.fontFamily?l.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,d=l.fontStyle&&l.fontStyle.fontSize?l.fontStyle.fontSize:u.fontSize||this.defaultFontSize,h=l.fontStyle&&"string"==typeof l.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(l.fontStyle.fontStyle):l.fontStyle&&l.fontStyle.fontStyle?l.fontStyle.fontStyle:re.PdfFontStyle.Regular,p=new re.PdfStandardFont(t,d,h),u=l.fontStyle.fontColor?new re.PdfSolidBrush(l.fontStyle.fontColor):o,e.drawString(n,p,null,u,a.x,a.y,r.actualSize.width,r.actualSize.height,s),c=l.value.split(","),ne.isNullOrUndefined(r.remainder)||null===r.remainder?ne.isNullOrUndefined(l.image)||1!==l.image.length||1!==c.length||(this.leftTaskLabel.isCompleted=!0):(this.leftTaskLabel.value=r.remainder,this.leftTaskLabel.left=i.endPoint)):this.leftTaskLabel.left=i.endPoint))},qn.prototype.getWidth=function(e,t,i){a=new re.PdfStandardFont(this.fontFamily,this.defaultFontSize);var a,n,r,s=this.parent.pdfExportModule.helper.exportProps.ganttStyle,s=(ne.isNullOrUndefined(s)||ne.isNullOrUndefined(s.label)||ne.isNullOrUndefined(s.label.fontSize)&&ne.isNullOrUndefined(s.label.fontStyle)&&ne.isNullOrUndefined(s.label.fontFamily)||(i=(a=this.getPdfFont(s)).height),!ne.isNullOrUndefined(s)&&s.font&&(i=(a=s.font).height),this.labelSettings.leftLabel),s=(s&&(s.fontStyle.fontSize||s.fontStyle.fontFamily||s.fontStyle.fontStyle)&&(o=s.fontStyle&&s.fontStyle.fontFamily?s.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,n=s.fontStyle&&s.fontStyle.fontSize?s.fontStyle.fontSize:this.defaultFontSize,r=s.fontStyle&&"string"==typeof s.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(s.fontStyle.fontStyle):s.fontStyle&&s.fontStyle.fontStyle?s.fontStyle.fontStyle:re.PdfFontStyle.Regular,a=new re.PdfStandardFont(o,n,r)),this.labelSettings.rightLabel),s=(s&&(s.fontStyle.fontSize||s.fontStyle.fontFamily||s.fontStyle.fontStyle)&&(o=s.fontStyle&&s.fontStyle.fontFamily?s.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,n=s.fontStyle&&s.fontStyle.fontSize?s.fontStyle.fontSize:this.defaultFontSize,r=s.fontStyle&&"string"==typeof s.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(s.fontStyle.fontStyle):s.fontStyle&&s.fontStyle.fontStyle?s.fontStyle.fontStyle:re.PdfFontStyle.Regular,a=new re.PdfStandardFont(o,n,r)),new re.PdfStringLayouter),o=new re.PdfStringFormat;return o.alignment=re.PdfTextAlignment.Left,o.wordWrap=re.PdfWordWrapType.Character,o.lineAlignment=re.PdfVerticalAlignment.Middle,s.layout(e,a,o,new re.SizeF(t,i),!1,new re.SizeF(t,i))},qn.prototype.getWidthofLeftLabel=function(e,t,i){var a,n=this.labelSettings.leftLabel,r=(a=n.fontStyle.fontSize||n.fontStyle.fontFamily||n.fontStyle.fontStyle?(a=n.fontStyle&&n.fontStyle.fontFamily?n.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,r=n.fontStyle&&n.fontStyle.fontSize?n.fontStyle.fontSize:this.defaultFontSize,n=n.fontStyle&&"string"==typeof n.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(n.fontStyle.fontStyle):n.fontStyle&&n.fontStyle.fontStyle?n.fontStyle.fontStyle:re.PdfFontStyle.Regular,new re.PdfStandardFont(a,r,n)):new re.PdfStandardFont(this.fontFamily,this.defaultFontSize),!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(a=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),new re.PdfStringLayouter),n=new re.PdfStringFormat;return n.alignment=re.PdfTextAlignment.Left,n.wordWrap=re.PdfWordWrapType.Character,n.lineAlignment=re.PdfVerticalAlignment.Middle,r.layout(e,a,n,new re.SizeF(t,i),!1,new re.SizeF(t,i))},qn.prototype.getWidthofrightLabel=function(e,t,i){var a,n=this.labelSettings.rightLabel,r=(a=n.fontStyle.fontSize||n.fontStyle.fontFamily||n.fontStyle.fontStyle?(a=n.fontStyle&&n.fontStyle.fontFamily?n.fontStyle.fontFamily:this.fontFamily||re.PdfFontFamily.Helvetica,r=n.fontStyle&&n.fontStyle.fontSize?n.fontStyle.fontSize:this.defaultFontSize,n=n.fontStyle&&"string"==typeof n.fontStyle.fontStyle?this.parent.pdfExportModule.helper.getFontStyle(n.fontStyle.fontStyle):n.fontStyle&&n.fontStyle.fontStyle?n.fontStyle.fontStyle:re.PdfFontStyle.Regular,new re.PdfStandardFont(a,r,n)):new re.PdfStandardFont(this.fontFamily,this.defaultFontSize),!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(a=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),new re.PdfStringLayouter),n=new re.PdfStringFormat;return n.alignment=re.PdfTextAlignment.Left,n.wordWrap=re.PdfWordWrapType.Character,n.lineAlignment=re.PdfVerticalAlignment.Middle,r.layout(e,a,n,new re.SizeF(t,i),!1,new re.SizeF(t,i))},qn.prototype.drawUnscheduledTask=function(e,t,i,a){var n=new re.PdfSolidBrush(this.taskColor);this.isAutoFit()?e.drawRectangle(n,t.x+(this.left-i),t.y+a,se(3),se(this.height)):e.drawRectangle(n,t.x+se(this.left-i),t.y+a,se(3),se(this.height))},qn.prototype.drawMilestone=function(e,t,i,a,n,r){var s,o,l,d,h,p,u,c;i.startDate<=this.startDate&&this.startDate<=i.endDate&&(i=e.graphics,e=e.section.indexOf(e),this.taskStartPoint=zn({},t),s=new re.PdfPen(this.milestoneColor),o=se((this.parent.rowHeight-this.height)/3),l=se((this.parent.rowHeight-this.height)/2),o=this.parent.renderBaseline?o:l,l=new re.PdfSolidBrush(this.milestoneColor),h=new re.PdfPen(this.baselineBorderColor),p=new re.PdfSolidBrush(this.baselineColor),i.save(),d=Math.floor(.8*this.parent.chartRowsModule.taskBarHeight),r||(this.isAutoFit()?i.translateTransform(t.x+(this.left-a),t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2):i.translateTransform(t.x+se(this.left-a),t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2)),r&&(this.isAutoFit()?i.translateTransform(t.x+(n.baselineLeft-a),t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2):i.translateTransform(t.x+se(n.baselineLeft-a),t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2)),i.rotateTransform(45),this.parent.renderBaseline&&this.baselineStartDate&&this.baselineEndDate&&r&&i.drawRectangle(h,p,2,2,se(d),se(d)),r||i.drawRectangle(s,l,0,0,se(d),se(d)),i.restore(),this.isAutoFit()?ne.isNullOrUndefined(n.taskbarTemplate.image)||(u=new re.PdfBitmap(n.taskbarTemplate.image[0].base64),c=t.x+(this.left-a)-.7*this.parent.chartRowsModule.taskBarHeight/2+(.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height),h=n.taskbarTemplate.image[0].width/2,p=n.taskbarTemplate.image[0].height/2,i.drawImage(u,c,t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2+(.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/.5,h,p)):ne.isNullOrUndefined(n.taskbarTemplate.image)||(u=new re.PdfBitmap(n.taskbarTemplate.image[0].base64),c=t.x+se(this.left-a)-.7*this.parent.chartRowsModule.taskBarHeight/2+ +se(.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height),i.drawImage(u,c,t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2+se((.7*this.parent.chartRowsModule.taskBarHeight-n.taskbarTemplate.image[0].height)/.5),se(n.taskbarTemplate.image[0].width),se(n.taskbarTemplate.image[0].height-2))),this.endPage=this.startPage=e)},qn);function qn(e){this.baselineHeight=8,this.segment=[],this.segmentCollection=[],this.leftTaskLabel={},this.rightTaskLabel={},this.startPage=-1,this.endPage=-1,this.pageDetailedWidth=0,this.defaultFontSize=9,this.spaceBetweenImageAndValue=8,this.parent=e}Zn.prototype.drawTimeline=function(e,t,i,a){this.detailsTimeline=i,this.pageIndex=a,this.timelineHeight=this.gantt.layouter.headerHeight;var n=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?oe(Math.floor(i.totalWidth)):Math.round(i.totalWidth),r=0;for(this.topTierPoint.x=t.x,this.topTierPoint.y=t.y,this.prevTopTierIndex=this.topTierIndex,this.prevBottomTierIndex=this.bottomTierIndex;0<n;){var s,o=this.topTier[this.topTierIndex];this.topTier.length>this.topTierIndex?(l=!1,this.topTier[this.topTierIndex].isFinished||(n>=o.width?(r=o.width,o.isFinished=!0,o.completedWidth=r,l=!0):(r=n,o.isFinished=l=!1,o.width=o.width-n,o.completedWidth=r)),s=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?r:se(r),this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,s,o.value,!0,this.parent.timelineModule.isSingleTier&&"Day"===this.parent.timelineSettings.topTier.unit?o.startDate:null),this.topTierPoint.x+=s,n-=r,l&&this.topTierIndex++):n=0}n=Math.round(i.totalWidth),a=this.parent.timelineModule.isSingleTier?0:this.topTierHeight;for(this.bottomTierPoint=new re.PointF(t.x,se(t.y+a));0<n;){var l,d,h=this.bottomTier[this.bottomTierIndex];this.bottomTier.length>this.bottomTierIndex?(l=!0,n<(d=h.width)&&(d=n,l=!1,h.completedWidth=d),this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?d:se(d),h.value,!1,h.startDate),this.bottomTierPoint.x=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?this.bottomTierPoint.x+d:this.bottomTierPoint.x+se(d),n-=d,h.completedWidth=d,this.bottomTierIndex++,0<n&&n<d&&(n=h.width-1)):n=0}this.timelineWidth=this.lastWidth},Zn.prototype.drawPageTimeline=function(e,t,i,a){this.pageIndex=a,this.timelineHeight=0,this.topTierPoint=ne.extend({},{},t,!0);for(var n,r=this.prevTopTierIndex;r<=this.topTierIndex;r++)this.topTier.length>r&&0<(n=this.topTier[r]).completedWidth&&(this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?n.completedWidth:se(n.completedWidth),n.value,!0,this.parent.timelineModule.isSingleTier&&"Day"===this.parent.timelineSettings.topTier.unit?n.startDate:null),this.topTierPoint.x+=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?n.completedWidth:se(n.completedWidth));this.bottomTierPoint.x=t.x,this.bottomTierPoint.y=se(t.y+this.topTierHeight);for(var s,r=this.prevBottomTierIndex;r<=this.bottomTierIndex;r++)this.bottomTier.length>r&&0<(s=this.bottomTier[r]).completedWidth&&(this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?s.width:se(s.width),s.value,!1,s.startDate),this.bottomTierPoint.x=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?this.bottomTierPoint.x+s.width:this.bottomTierPoint.x+se(s.width))},Zn.prototype.triggerQueryTimelinecell=function(e,n,t,i,r,a,s,o){var l,d,h=this,p=new Date(o).getDay(),e=e.graphics,u={},c=this.gantt.ganttStyle,g=(u.borderColor=new re.PdfColor(c.timeline.borderColor),u.fontColor=new re.PdfColor(c.timeline.fontColor),u.fontSize=c.timeline.fontSize,u.fontStyle=c.timeline.fontStyle,u.backgroundColor=new re.PdfColor(c.timeline.backgroundColor),c.timeline.padding&&(u.padding=c.timeline.padding),this.initializePdfStringFormat(c,s)),g=(u.format=g,{timelineCell:u,value:a}),u=(this.parent.pdfQueryTimelineCellInfo&&this.parent.trigger("pdfQueryTimelineCellInfo",g),g.timelineCell),f=new re.PdfSolidBrush(g.timelineCell.backgroundColor),a=this.parent.nonWorkingDayIndex,m=!1,y=new re.PdfSolidBrush(c.holiday.backgroundColor),a=(this.parent.highlightWeekends&&-1!==a.indexOf(p)&&("Day"===this.parent.timelineModule.bottomTier||"None"===this.parent.timelineModule.bottomTier&&"Day"===this.parent.timelineModule.topTier)&&(f=y,m=!0),this.parent.holidays.map(function(t){var i=new Date(t.from),e=new Date(t.to),a=new Date(o);i<=a&&a<=e&&("Day"===h.parent.timelineModule.bottomTier||"None"===h.parent.timelineModule.bottomTier&&"Day"===h.parent.timelineModule.topTier)?(f=y,i.getTime()===a.getTime()&&(h.holidayWidth=n),e.getTime()===a.getTime()&&(h.holidayLabel=t.label,(e=new Date(t.to)).setDate(e.getDate()+1),a=h.parent.dataOperation.getTaskWidth(i,e),h.holidayNumberOfDays=se(a)/r,h.holidayCompleted=!0),m=!0):"Day"!==h.parent.timelineModule.bottomTier&&h.detailsTimeline.startDate<=i&&h.detailsTimeline.endDate>=i&&h.parent.timelineModule.bottomTierCollection.map(function(e){e.startDate<=i&&e.endDate>=i&&e.startDate===o&&(h.fitHolidayCompleted=!0,h.fromDataHoliday=t.from,h.holidayLabel=t.label)})}),m&&c.holiday&&c.holiday.borders?c.holiday.borders.left:m&&c.holiday&&c.holiday.borderColor?new re.PdfPen(c.holiday.borderColor):new re.PdfPen(g.timelineCell.borderColor)),p=(this.parent.pdfExportModule.gantt.taskbar.isAutoFit()||(this.lastWidth=n+r),m&&(c.holiday.borderColor||c.holiday.borders)?r-2:r),D=(e.drawRectangle(a,f,n,t,p,se(i)),s||"Both"!==this.parent.gridLines&&"Vertical"!==this.parent.gridLines?null:new re.PdfPen(c.chartGridLineColor)),a=m&&(c.holiday.borderColor||c.holiday.borders)?a:D,D=(e.drawRectangle(a,f,n,t+se(i),p,this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight),new re.PdfStandardFont(c.fontFamily,u.fontSize,u.fontStyle)),p=(c.font&&(D=c.font),this.getPdfFont(c)),p=(ne.isNullOrUndefined(p)||(D=p),c.holiday&&c.holiday.fontColor?new re.PdfSolidBrush(c.holiday.fontColor):new re.PdfSolidBrush(new re.PdfColor(0,0,0))),k=c.holiday&&c.holiday.fontBrush?new re.PdfPen(new re.PdfColor(c.holiday.fontBrush)):null,b=(new re.PdfStringFormat,c.holiday&&c.holiday.format?c.holiday.format:null),w={left:0,right:0,top:0,bottom:0},T=(ne.isNullOrUndefined(c)||ne.isNullOrUndefined(c.holiday)||ne.isNullOrUndefined(c.holiday.padding)||(w=c.holiday.padding),ne.isNullOrUndefined(this.holidayLabel)||(l=D.measureString(this.holidayLabel)),this.holidayCompleted&&(S=(this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight)/2,T=e.save(),d=D.height,v=D.size,e.translateTransform(this.holidayWidth+r-v/2*this.holidayNumberOfDays-d+d/2+r*this.holidayNumberOfDays/2,40),e.rotateTransform(-90),e.translateTransform(-S,-((this.holidayWidth+r+v)/((this.holidayWidth+r)/r))),l.width+10<S&&e.drawString(this.holidayLabel,D,k,p,5-(w.left+w.right),5-(w.top+w.bottom),l.width+10,l.height+10,b),e.restore(T),this.holidayCompleted=!1),this.fitHolidayCompleted&&(S=(this.gantt.layouter.pageHeightCollection[this.pageIndex].totalHeight-this.timelineHeight)/2,v=D.size,e.drawRectangle(a,y,n+r/2-v,t+se(i),v,2*S),d=e.save(),e.translateTransform(n+r+r/2-v,40),e.rotateTransform(-90),e.translateTransform(-S,-((this.holidayWidth+r+v)/((this.holidayWidth+r)/r))),l.width+10<S&&e.drawString(this.holidayLabel,D,k,p,5-(w.left+w.right),5-(w.top+w.bottom),l.width+10,l.height+10,b),e.restore(d),this.fitHolidayCompleted=!1),new re.PdfStandardFont(c.fontFamily,u.fontSize,u.fontStyle)),a=(c.font&&(T=c.font),new re.PdfSolidBrush(ne.isNullOrUndefined(c.timeline.fontBrush)?g.timelineCell.fontColor:c.timeline.fontBrush)),v=c.timeline.padding?g.timelineCell.padding.left:0,S=c.timeline.padding?g.timelineCell.padding.top:0,D=e.save();e.setClip(new re.RectangleF(n,t,r,se(i))),s?n=n+v+this.topTierValueLeftPadding:n+=v,e.drawString(g.value,T,null,a,n,t+S,se(r),se(i),u.format),e.restore(D)},Zn.prototype.initializePdfStringFormat=function(e,t){var i=new re.PdfStringFormat;return ne.isNullOrUndefined(e.timeline.format)?t?(i.lineAlignment=re.PdfVerticalAlignment.Middle,i.alignment=re.PdfTextAlignment.Left):(i.lineAlignment=re.PdfVerticalAlignment.Middle,i.alignment=re.PdfTextAlignment.Center,i.wordWrap=re.PdfWordWrapType.Character):i=e.timeline.format,i},Zn.prototype.getPdfFont=function(e){var t,i;return e&&e.holiday&&(e.holiday.fontSize||e.holiday.fontStyle||e.holiday.fontFamily)&&(t=e.holiday.fontSize||9,i=e.holiday.fontFamily||this.fontFamily,e=e.holiday.fontStyle||re.PdfFontStyle.Regular,i=new re.PdfStandardFont(i,t,e)),i};var _n=Zn;function Zn(e){this.holidayCompleted=!1,this.holidayWidth=0,this.fitHolidayCompleted=!1,this.timelineWidth=0,this.lastWidth=0,this.topTierValueLeftPadding=8,this.timelineHeight=0,this.width=0,this.gantt=e,this.parent=e.parent,this.topTierPoint=new re.PointF,this.bottomTierPoint=new re.PointF,this.topTierIndex=0,this.bottomTierIndex=0,this.prevTopTierIndex=0,this.prevBottomTierIndex=0}Yn.prototype.add=function(){return new Yn(this.parent)},Yn.prototype.drawPredecessor=function(e){var t,i,a=(this.pdfGantt=e).result.page.section.getPages(),n=e.taskbarCollection[this.parentIndex],r=e.taskbarCollection[this.childIndex],s=new re.PdfPage,o=new re.PdfPage,l="";if(r&&n){switch(this.type){case"FS":if(!(-1<r.startPage&&-1<n.endPage))return;s=a[n.endPage],o=a[r.startPage],t=e.pdfPageDetail[n.endPage-e.chartPageIndex],i=e.pdfPageDetail[r.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft<this.childLeft&&this.childLeft>this.parentLeft+this.parentWidth+25?"FSType1":"FSType2":this.parentLeft<this.childLeft&&this.childLeft>this.parentLeft+this.parentWidth+25?"FSType3":"FSType4";break;case"SF":if(!(-1<r.endPage&&-1<n.startPage))return;s=a[n.startPage],o=a[r.endPage],t=e.pdfPageDetail[n.endPage-e.chartPageIndex],i=e.pdfPageDetail[r.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft>this.childLeft+this.childWidth?"SFType1":"SFType2":this.parentLeft>this.childLeft+this.childWidth?"SFType3":"SFType4";break;case"FF":if(!(-1<r.endPage&&-1<n.endPage))return;s=a[n.endPage],o=a[r.endPage],t=e.pdfPageDetail[n.endPage-e.chartPageIndex],i=e.pdfPageDetail[r.endPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.childLeft+this.childWidth>=this.parentLeft+this.parentWidth?"FFType1":"FFType2":this.childLeft+this.childWidth>=this.parentLeft+this.parentWidth?"FFType3":"FFType4";break;case"SS":if(!(-1<r.startPage&&-1<n.startPage))return;s=a[n.startPage],o=a[r.startPage],t=e.pdfPageDetail[n.startPage-e.chartPageIndex],i=e.pdfPageDetail[r.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft>=this.childLeft?"SSType1":"SSType2":this.parentLeft>=this.childLeft?"SSType3":"SSType4"}var d=Math.round((this.parent.rowHeight-15)/2),h=Math.round((this.parent.rowHeight-1)/2),p=Math.round((this.parent.rowHeight-10)/2),u=se(this.parent.renderBaseline?p:!n.isAutoSchedule&&n.isParentTask||!r.isAutoSchedule&&r.isParentTask?d:h),c=void 0,g=void 0,f=void 0,m=void 0,y=void 0,D=void 0,c=g=f=m=y=D=new re.PointF,p=(n.taskStartPoint.x,n.taskStartPoint.y),d=(r.taskStartPoint.x,r.taskStartPoint.y),k=p+t.startPoint.y,b=d+i.startPoint.y,w=void 0,T=void 0,v=void 0,S=void 0,P=void 0,P=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(w=new re.PointF(this.parentLeft+this.parentWidth,k+u),T=new re.PointF(this.parentLeft-1,k+u),v=new re.PointF(this.childLeft-20,b+u),S=new re.PointF(this.childLeft-6-this.lineWidth-1,b+u),new re.PointF(this.childLeft+this.childWidth+6+this.lineWidth+1,b+u)):(w=new re.PointF(se(this.parentLeft+this.parentWidth),k+u),T=new re.PointF(se(this.parentLeft)-1,k+u),v=new re.PointF(se(this.childLeft-20),b+u),S=new re.PointF(se(this.childLeft-6-this.lineWidth)-1,b+u),new re.PointF(se(this.childLeft+this.childWidth+6+this.lineWidth)+1,b+u));switch(l){case"FSType1":case"FSType3":c=w,g=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new re.PointF(this.childLeft-20,k+u):new re.PointF(se(this.childLeft-20),k+u),f=v,m=S,this.connectLines(s,o,c,g,f,m,r,u);break;case"FSType2":c=w,g=new re.PointF(c.x+10,k+u),f=new re.PointF(c.x+10,b+2),m=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new re.PointF(this.childLeft-20,b+2):new re.PointF(se(this.childLeft-20),b+2),y=v,D=S,this.connectLines(s,o,c,g,f,m,r,u,y,D);break;case"FSType4":c=w,g=new re.PointF(c.x+10,k+u),f=new re.PointF(c.x+10,k+2),m=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new re.PointF(this.childLeft-20,k+2):new re.PointF(se(this.childLeft-20),k+2),y=v,D=S,this.connectLines(s,o,c,g,f,m,r,u,y,D);break;case"FFType1":case"FFType3":g=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(c=new re.PointF(this.parentLeft+this.parentWidth+1,k+u),new re.PointF(this.childLeft+this.childWidth+20,k+u)):(c=new re.PointF(se(this.parentLeft+this.parentWidth)+1,k+u),new re.PointF(se(this.childLeft+this.childWidth+20),k+u)),f=new re.PointF(g.x,b+u),m=P,this.connectLines(s,o,c,g,f,m,r,u);break;case"FFType2":case"FFType4":g=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(c=new re.PointF(this.parentLeft+this.parentWidth+1,k+u),new re.PointF(this.parentLeft+this.parentWidth+20,k+u)):(c=new re.PointF(se(this.parentLeft+this.parentWidth)+1,k+u),new re.PointF(se(this.parentLeft+this.parentWidth+20),k+u)),f=new re.PointF(g.x,b+u),m=P,this.connectLines(s,o,c,g,f,m,r,u);break;case"SSType1":case"SSType3":c=T,g=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new re.PointF(this.childLeft-20,k+u):new re.PointF(se(this.childLeft-20),k+u),f=new re.PointF(g.x,b+u),m=S,this.connectLines(s,o,c,g,f,m,r,u);break;case"SSType2":case"SSType4":c=T,g=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new re.PointF(this.parentLeft-20,k+u):new re.PointF(se(this.parentLeft-20),k+u),f=new re.PointF(g.x,b+u),m=S,this.connectLines(s,o,c,g,f,m,r,u);break;case"SFType1":case"SFType3":c=T,g=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?new re.PointF(this.childLeft+this.childWidth+20,k+u):new re.PointF(se(this.childLeft+this.childWidth+20),k+u),f=new re.PointF(g.x,b+u),m=P,this.connectLines(s,o,c,g,f,m,r,u);break;case"SFType2":c=T,m=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(g=new re.PointF(this.parentLeft-20,k+u),new re.PointF(this.childLeft+this.childWidth+20,b+2)):(g=new re.PointF(se(this.parentLeft-20),k+u),new re.PointF(se(this.childLeft+this.childWidth+20),b+2)),f=new re.PointF(g.x,b+2),y=new re.PointF(m.x,b+u),D=P,this.connectLines(s,o,c,g,f,m,r,u,y,D);break;case"SFType4":c=T,m=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(g=new re.PointF(this.parentLeft-20,k+u),new re.PointF(this.childLeft+this.childWidth+20,k+2)):(g=new re.PointF(se(this.parentLeft-20),k+u),new re.PointF(se(this.childLeft+this.childWidth+20),k+2)),f=new re.PointF(g.x,k+2),y=new re.PointF(m.x,b+u),D=P,this.connectLines(s,o,c,g,f,m,r,u,y,D)}}},Yn.prototype.connectLines=function(e,t,i,a,n,r,s,o,l,d){this.drawLine(e,i,a),this.drawLine(e,a,n),this.drawLine(e,n,r),ne.isNullOrUndefined(l)||ne.isNullOrUndefined(d)||(this.drawLine(e,r,l),this.drawLine(e,l,d)),this.drawArrow(t,s,o)},Yn.prototype.contains=function(e,t,i){return e.x<=t&&t<e.x+e.width&&e.y<=i&&i<e.y+e.height},Yn.prototype.findPageIndex=function(e){for(var t=-1,i=0;i<this.pdfGantt.pdfPageDetail.length;i++){var a=this.pdfGantt.pdfPageDetail[i],a=new re.RectangleF(a.startPoint.x,a.startPoint.y,a.width,a.height);if(this.contains(a,e.x,e.y)){t=i;break}}return t},Yn.prototype.drawLine=function(e,t,i){var a,n,r=this.pdfGantt.result.page.section.getPages(),s=e.graphics,o={x:i.x,y:i.y},l={x:i.x,y:i.y},d={x:i.x,y:i.y},e=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],h=new re.RectangleF(e.startPoint.x,e.startPoint.y,e.width,e.height),p=this.contains(h,t.x,t.y),u=this.contains(h,i.x,i.y),c=-1;t=new re.PointF(t.x,t.y),i=new re.PointF(i.x,i.y),!p&&!u||u&&!p?-1<(c=this.findPageIndex(t))&&(e=this.pdfGantt.pdfPageDetail[c],l=t,o=i,this.drawLine(r[c+this.pdfGantt.chartPageIndex],l,o)):!u&&p&&(u=h.x,n=h.x+h.width,a=h.y+h.height,h=h.y,u>i.x?(d.x=i.x=u-1,l.x=u-1):n<i.x?(d.x=i.x=n,l.x=n,d.x+=1):a<i.y?(d.y=i.y=a,l.y=a,d.y+=1,this.pdfGantt.enableHeader&&(l.y+=this.parent.timelineModule.isSingleTier?se(45):se(62))):h>i.y&&(l.y=d.y=h-1,i.y=h,this.pdfGantt.enableHeader)&&(d.y+=this.parent.timelineModule.isSingleTier?se(45):se(62),i.y+=this.parent.timelineModule.isSingleTier?se(45):se(62)),-1!==(c=this.findPageIndex(d)))&&this.drawLine(r[c+this.pdfGantt.chartPageIndex],l,o),p&&(t=new re.PointF(t.x,t.y),i=new re.PointF(i.x,i.y),t.x=t.x+e.pageStartX-e.startPoint.x,t.y=t.y-e.startPoint.y,i.x=i.x+e.pageStartX-e.startPoint.x,i.y=i.y-e.startPoint.y,u=new re.PdfSolidBrush(this.connectorLineColor),n=new re.PdfPen(u,se(this.lineWidth)),s.drawLine(n,t,i))},Yn.prototype.drawArrow=function(e,t,i){var a,n=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],r=new re.RectangleF(new re.PointF(n.startPoint.x,n.startPoint.y),new re.SizeF(n.width,n.height)),s=new re.PointF,o=e.section.getPages(),l=6+this.lineWidth,s=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?"FS"===this.type||"SS"===this.type?new re.PointF(this.childLeft-1,t.taskStartPoint.y+n.startPoint.y):new re.PointF(this.childLeft+this.childWidth+1,t.taskStartPoint.y+n.startPoint.y):"FS"===this.type||"SS"===this.type?new re.PointF(se(this.childLeft)-1,t.taskStartPoint.y+n.startPoint.y):new re.PointF(se(this.childLeft+this.childWidth)+1,t.taskStartPoint.y+n.startPoint.y),r=(this.contains(r,s.x,s.y)||-1<(t=this.findPageIndex(s))&&(n=this.pdfGantt.pdfPageDetail[t],e=o[t+this.pdfGantt.chartPageIndex]),e.graphics),o=(s.x=s.x-n.startPoint.x+n.pageStartX,s.y=s.y-n.startPoint.y,new re.PointF(s.x,s.y+i)),t=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?"FS"===this.type||"SS"===this.type?new re.PointF(o.x-l,o.y-l):new re.PointF(o.x+l,o.y-l):"FS"===this.type||"SS"===this.type?new re.PointF(o.x-se(l),o.y-se(l)):new re.PointF(o.x+se(l),o.y-se(l)),e=new re.PdfSolidBrush(this.connectorLineColor),n=this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(a=new re.PointF(t.x,t.y+2*l),new re.PdfPen(e,this.lineWidth)):(a=new re.PointF(t.x,t.y+se(2*l)),new re.PdfPen(e,se(this.lineWidth)));0<this.childLeft&&(r.drawLine(n,o,t),r.drawLine(n,t,a),r.drawLine(n,a,o))};var Xn=Yn;function Yn(e,t){this.parent=e,this.pdfGantt=t}Qn.prototype.drawEventMarker=function(e,t,i,a,n,r,s){var o,l,d,h,p,u,c=e.graphics,e=(e.getClientSize(),new re.PdfStandardFont(re.PdfFontFamily.Helvetica,10)),g=(!ne.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(e=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font),ne.isNullOrUndefined(n.label)||(o=e.measureString(n.label)),s.eventMarker.lineStyle);g.dashStyle=s.eventMarker.lineStyle.dashStyle,a.startDate<=n.date&&n.date<=a.endDate&&((a=new re.PdfStringFormat).alignment=re.PdfTextAlignment.Center,a=ne.isNullOrUndefined(s.eventMarker.label.format)?a:s.eventMarker.label.format,l=new re.PdfSolidBrush(s.eventMarker.label.backgroundColor),d=s.eventMarker.label&&s.eventMarker.label.fontColor?new re.PdfSolidBrush(s.eventMarker.label.fontColor):null,h=this.getPdfFont(s),ne.isNullOrUndefined(h)&&(h=e),e=s.eventMarker.label.borders||null,s.eventMarker.label.borderColor&&((p=new nn).all=new re.PdfPen(new re.PdfColor(s.eventMarker.label.borderColor)),e=p),p=ne.isNullOrUndefined(e)||ne.isNullOrUndefined(e.left)?null:e.left,e={left:0,right:0,top:0,bottom:0},ne.isNullOrUndefined(s)||ne.isNullOrUndefined(s.eventMarker)||ne.isNullOrUndefined(s.eventMarker.label)||ne.isNullOrUndefined(s.eventMarker.label.padding)||(e=s.eventMarker.label.padding),s=ne.isNullOrUndefined(s.eventMarker.label.fontBrush)?null:new re.PdfPen(s.eventMarker.label.fontBrush),u=this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(n.date,!0),!1,!0),this.parent.pdfExportModule.gantt.taskbar.isAutoFit()?(c.drawLine(g,new re.PointF(t.x+(u-i)+10,r),new re.PointF(t.x+(u-i)+10,this.renderHeight)),!ne.isNullOrUndefined(n.label)&&0<n.label.length&&r+se(50)+2*o.height<this.renderHeight&&(c.save(),c.translateTransform(t.x+(u-i)+7+10,r+se(50)+o.height/2),c.rotateTransform(45),c.drawRectangle(p,l,0,0,8,8),c.restore(),c.drawRectangle(p,l,t.x+(u-i)+7+10,r+se(50),o.width+10,2*o.height),c.drawString(n.label,h,s,d,t.x+(u-i)+12+10-(e.left+e.right),r+se(50)+se(o.height/2)-(e.top+e.bottom),o.width,o.height,a))):(c.drawLine(g,new re.PointF(t.x+se(u-i)+10,r),new re.PointF(t.x+se(u-i)+10,this.renderHeight)),!ne.isNullOrUndefined(n.label)&&0<n.label.length&&r+se(50)+2*o.height<this.renderHeight&&(c.save(),c.translateTransform(t.x+se(u-i)+7+10,r+se(50)+o.height/2),c.rotateTransform(45),c.drawRectangle(p,l,0,0,8,8),c.restore(),c.drawRectangle(p,l,t.x+se(u-i)+7+10,r+se(50),o.width+10,2*o.height),c.drawString(n.label,h,s,d,t.x+se(u-i)+12+10-(e.left+e.right),r+se(51)+se(o.height/2)-(e.top+e.bottom),o.width,o.height,a))))},Qn.prototype.getPdfFont=function(e){var t,i;return e&&e.eventMarker&&e.eventMarker.label&&(e.eventMarker.label.fontSize||e.eventMarker.label.fontStyle||e.eventMarker.label.fontFamily)&&(t=e.eventMarker.label.fontSize||9,i=e.eventMarker.label.fontFamily||this.fontFamily,e=e.eventMarker.label.fontStyle||re.PdfFontStyle.Regular,i=new re.PdfStandardFont(i,t,e)),i};var Kn=Qn;function Qn(e){this.renderHeight=0,this.parent=e}$n=function(e,t){return($n=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var $n,Jn,er=function(){return(er=Object.assign||function(e){for(var t,i=1,a=arguments.length;i<a;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)},tr=(function(e,t){function i(){this.constructor=e}$n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(ir,Jn=vn),Object.defineProperty(ir.prototype,"taskbar",{get:function(){return ne.isNullOrUndefined(this.taskbars)&&(this.taskbars=new Gn(this.parent)),this.taskbars},enumerable:!0,configurable:!0}),ir.prototype.drawChart=function(e){this.result=e,this.totalPages=this.result.page.section.count,this.perColumnPages=this.totalPages/this.layouter.columnRanges.length,this.calculateRange(),this.drawGantttChart(),this.drawPageBorder()},ir.prototype.calculateRange=function(){for(var e=this.layouter.columnRanges[this.layouter.columnRanges.length-1],t=0,i=!0,a=0,n=0,r=0,s=se(this.chartHeader.width),o=this.parent.timelineModule,l=e[0];l<=e[1];l++)t+=this.layouter.treegrid.columns.getColumn(l).width;for((t+=.5)+100<this.result.page.getClientSize().width?(n=this.result.page.getClientSize().width-t,this.chartPageIndex=this.startPageIndex=this.totalPages-this.perColumnPages,i=!1,this.startPoint=new re.PointF(t,0)):(this.result.page.section.add(),this.chartPageIndex=this.startPageIndex=this.totalPages,i=!0,this.startPoint=new re.PointF(r,0));Math.round(r)<Math.round(s);){i?a=this.result.page.getClientSize().width:(a=n,i=!0);var d={},h=[],p=se(this.chartHeader.bottomTierCellWidth),u=0,c=(0!==this.chartHeader.bottomTierCellWidth&&(u=Math.floor(a/p)*p),s-(h[0]=r)<=u?d.totalWidth=oe((h[1]=s)-r):(h[1]=r+u,d.totalWidth=oe(u)),d.startPoint=h[0],d.endPoint=h[1],0===this.parent.cloneProjectStartDate.getHours()&&0===this.parent.cloneProjectStartDate.getMinutes()&&0===this.parent.cloneProjectStartDate.getSeconds()&&(this.changeCloneProjectDates=!0,this.parent.cloneProjectStartDate.setHours(8)),this.parent.dataOperation.getDateFromFormat(this.parent.timelineModule.timelineStartDate)),g=(ne.isNullOrUndefined(o.customTimelineSettings.bottomTier.count)?o.customTimelineSettings.topTier:o.customTimelineSettings.bottomTier).count;switch(("None"===o.customTimelineSettings.bottomTier.unit?o.customTimelineSettings.topTier:o.customTimelineSettings.bottomTier).unit){case"Minutes":d.startDate=new Date(c.getTime());var f=Math.floor(oe(d.startPoint)/this.chartHeader.bottomTierCellWidth),f=(d.startDate.setMinutes(d.startDate.getMinutes()+f*g),d.startDate.setSeconds(d.startDate.getSeconds()+1),d.endDate=new Date(d.startDate.getTime()),Math.floor(oe(d.endPoint-d.startPoint)/this.chartHeader.bottomTierCellWidth));d.endDate.setMinutes(d.endDate.getMinutes()+f*g);break;case"Hour":d.startDate=new Date(c.getTime());var f=Math.floor(oe(d.startPoint)/this.chartHeader.bottomTierCellWidth),m=new Date(d.startDate.getTime()),y=(this.parent.timelineSettings.showWeekend?(d.startDate.setHours(d.startDate.getHours()+f*g),d.startDate.setMinutes(d.startDate.getMinutes()+1)):(m=this.calculateHoursWithoutNonworkingDays(m,f,g),d.startDate=new Date(m.getTime())),Math.floor((d.endPoint-d.startPoint)/oe(this.chartHeader.bottomTierCellWidth)));m=new Date(d.startDate.getTime()),this.parent.timelineSettings.showWeekend?m.setHours(m.getHours()+y*g):m=this.calculateHoursWithoutNonworkingDays(m,y,g),d.endDate=new Date(m.getTime());break;case"Day":d.startDate=new Date(c.getTime());var y=Math.round(d.startPoint/se(this.chartHeader.bottomTierCellWidth)),m=new Date(d.startDate.getTime()),D=(this.parent.timelineSettings.showWeekend?d.startDate.setDate(d.startDate.getDate()+y*g):d.startDate=this.calculateDaysWithoutNonworkingDays(d.startDate,y*g),Math.round((d.endPoint-d.startPoint)/se(this.chartHeader.bottomTierCellWidth))-1),D=(d.startDate.setHours(0,0,0,0),m=new Date(d.startDate.getTime()),this.parent.timelineSettings.showWeekend?m.setDate(m.getDate()+D*g):m=this.calculateDaysWithoutNonworkingDays(m,D*g),1e3*this.parent.workingTimeRanges[0].to);d.endDate=new Date(m.getTime()),d.endDate.setTime(d.endDate.getTime()+D);break;case"Week":d.startDate=new Date(c.getTime());var D=d.startPoint/se(this.chartHeader.bottomTierCellWidth)*7,k=(this.parent.timelineSettings.showWeekend?d.startDate.setDate(d.startDate.getDate()+D*g):d.startDate=this.calculateDaysWithoutNonworkingDays(d.startDate,D*g),7*Math.round((d.endPoint-d.startPoint)/se(this.chartHeader.bottomTierCellWidth))-1);d.endDate=new Date(d.startDate.getTime()),this.parent.timelineSettings.showWeekend?d.endDate.setDate(d.startDate.getDate()+k*g):d.endDate=this.calculateDaysWithoutNonworkingDays(d.endDate,k*g);break;case"Month":d.startDate=new Date(c.getTime());var k=d.startPoint/se(this.chartHeader.bottomTierCellWidth)*31,b=(d.startDate.setDate(d.startDate.getDate()+k*g),31*Math.round((d.endPoint-d.startPoint)/se(this.chartHeader.bottomTierCellWidth))-1);d.endDate=new Date(d.startDate.getTime()),d.endDate.setDate(d.startDate.getDate()+b*g);break;case"Year":d.startDate=new Date(c.getTime());var b=d.startPoint/se(this.chartHeader.bottomTierCellWidth)*365,w=(d.startDate.setDate(d.startDate.getDate()+b*g),365*Math.round((d.endPoint-d.startPoint)/se(this.chartHeader.bottomTierCellWidth))-1);d.endDate=new Date(d.startDate.getTime()),d.endDate.setDate(d.startDate.getDate()+w*g)}this.headerDetails.push(d),r+=u}},ir.prototype.calculateHoursWithoutNonworkingDays=function(e,t,i){for(var a=0;a<t*i;)e.setHours(e.getHours()+1),-1===this.parent.nonWorkingDayIndex.indexOf(e.getDay())&&a++,-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay())&&e.setHours(24,0,0,0);return e},ir.prototype.calculateDaysWithoutNonworkingDays=function(e,t){var i=new Date(e.getTime()),e=7-this.parent.nonWorkingDayIndex.length,a=Math.floor(t/e),n=t%e;for(i.setDate(i.getDate()+7*a);0<n;)i.setDate(i.getDate()+1),-1===this.parent.nonWorkingDayIndex.indexOf(i.getDay())&&n--;return i},ir.prototype.drawPageBorder=function(){for(var e=this.result.page.section.getPages(),t=0;t<e.length;t++){var i=e[t],a=i.graphics,i=i.getClientSize(),n=new re.PdfPen(new re.PdfColor(this.ganttStyle.chartGridLineColor));a.drawRectangle(n,0,0,i.width,i.height)}},ir.prototype.drawGantttChart=function(){var h,p,u=this,c=this.startPoint,g=new re.PointF,f=0,m=0;this.headerDetails.forEach(function(a,e){u.currentPage=0;var t=u.result.page.section.getPages()[u.startPageIndex];t.contentWidth=u.parent.pdfExportModule.gantt.taskbar.isAutoFit()?oe(u.headerDetails[e].endPoint-u.headerDetails[e].startPoint):u.headerDetails[e].endPoint-u.headerDetails[e].startPoint,u.chartHeader.drawTimeline(t,u.startPoint,a,0),c.y=c.y+se(u.parent.timelineModule.isSingleTier?45:60),h=c.x,m=se(u.parent.timelineModule.isSingleTier?45:60),u.headerDetails[u.headerDetails.indexOf(a)].startIndex=u.startPageIndex,u.headerDetails[u.headerDetails.indexOf(a)].pageStartPoint=c;for(var i=0;i<u.taskbarCollection.length;i++){var n=u.taskbarCollection[i],r=u.rows.getRow(i+1).height,s=u.result.page.section.getPages()[u.startPageIndex],o=s.graphics,l=new re.PdfPen(new re.PdfColor(u.ganttStyle.chartGridLineColor)),d=void 0;!t.contentWidth||"Both"!==u.parent.gridLines&&"Horizontal"!==u.parent.gridLines||(d=u.chartHeader.timelineWidth,o.drawRectangle(l,h,c.y,t.contentWidth+.5,r)),n.drawTaskbar(s,c,a,f,r,u.taskbarCollection[parseInt(i.toString(),10)],d,e)&&(u.enableHeader?c.y=se(u.parent.timelineModule.isSingleTier?45:60):c.y=0,u.startPageIndex++,(p={}).height=m,p.pageStartX=h,p.startPoint=er({},g),u.parent.pdfExportModule.gantt.taskbar.isAutoFit(),p.width=a.totalWidth,u.pdfPageDetail.push(p),g.y+=p.height,m=u.enableHeader?u.chartHeader.height:c.y=0),c.y+=r,m+=r,u.eventMarker.renderHeight=u.layouter.pageHeightCollection[u.currentPage].totalHeight,u.parent.eventMarkerColloction.map(function(e){var t=se(u.parent.timelineModule.isSingleTier?45:60),i=(0!==u.currentPage&&(u.eventMarker.renderHeight=u.layouter.pageHeightCollection[u.currentPage].totalHeight+t),u.result.page.section.getPages()[u.startPageIndex]);u.eventMarker.drawEventMarker(i,c,f,a,e,t,u.ganttStyle)})}u.headerDetails[e].endIndex=u.startPageIndex,f+=a.totalWidth,(p={}).height=m,p.pageStartX=h,p.startPoint=er({},g),u.parent.pdfExportModule.gantt.taskbar.isAutoFit()?p.width=a.totalWidth:p.width=se(a.totalWidth),u.pdfPageDetail.push(p),g.x+=p.width,g.y=0,u.enableHeader?m=u.chartHeader.height:c.y=0,u.headerDetails.indexOf(a)!==u.headerDetails.length-1&&(u.result.page.section.add(),u.startPageIndex=u.result.page.section.count-1,c=u.startPoint=new re.PointF(0,0))});for(var e=0;e<this.predecessorCollection.length;e++)this.predecessorCollection[e].drawPredecessor(this)},ir);function ir(e){var t=Jn.call(this)||this;return t.exportProps={},t.changeCloneProjectDates=!1,t.currentPage=0,t.parent=e,t.chartHeader=new _n(t),t.eventMarker=new Kn(e),t.predecessor=new Xn(e,t),t.headerDetails=[],t.pdfPageDetail=[],t.taskbarCollection=[],t.predecessorCollection=[],t}ar.prototype.getModuleName=function(){return"pdfExport"},ar.prototype.destroy=function(){},ar.prototype.initGantt=function(){this.pdfDocument=void 0,this.gantt=new tr(this.parent)},ar.prototype.export=function(i,a,n,e){var r=this,e=(this.isBlob=e,{requestType:"beforePdfExport",ganttObject:this.parent,cancel:!1});return this.parent.trigger("beforePdfExport",e),ne.getValue("cancel",e)||this.parent.showLoadingIndicator(),ne.getValue("cancel",e)?new Promise(function(e,t){return e()}):new Promise(function(e,t){r.exportWithData(n,e,i,a)})},ar.prototype.exportWithData=function(e,t,i,a){var n=this,r=[],s=this.parent.getExpandedRecords(this.parent.updatedRecords),r=(i=ne.isNullOrUndefined(i)?{}:i).fitToWidthSettings&&i.fitToWidthSettings.isFitToWidth?("CurrentViewData"===i.exportType?this.helper.beforeSinglePageExport.cloneFlatData=ne.extend([],this.parent.currentViewData,null,!0):"AllData"===i.exportType?this.helper.beforeSinglePageExport.cloneFlatData=ne.extend([],this.parent.flatData,null,!0):this.helper.beforeSinglePageExport.cloneFlatData=ne.extend([],s,null,!0),this.helper.beforeSinglePageExport.cloneCurrentViewData=ne.extend([],this.parent.currentViewData,null,!0),this.helper.beforeSinglePageExport.cloneFlatData):ne.isNullOrUndefined(i.exportType)?s:"CurrentViewData"===i.exportType?this.parent.currentViewData:this.parent.flatData;this.initGantt(),ne.isNullOrUndefined(e)?this.pdfDocument=new re.PdfDocument:this.pdfDocument=e,this.processExport(r,i,a).then(function(){n.parent.trigger("pdfExportComplete",n.isBlob?{promise:n.blobPromise}:{}),n.parent.hideLoadingIndicator(),t(n.pdfDocument)})},ar.prototype.processExport=function(i,a,t){var n=this,e=this.pdfDocument.sections.add();return this.processSectionExportProperties(e,a),this.pdfPage=e.pages.add(),this.pdfPageDimensions=this.pdfPage.getClientSize(),new Promise(function(e,t){n.helper.processGridExport(i,n.gantt,a),n.helper.initializePdf(n.pdfDocument),e()}).then(function(){var e=new kn,e=(e.break=re.PdfLayoutBreakType.FitElement,n.gantt.drawGrid(n.pdfPage,0,0,e));return n.gantt.drawChart(e),n.helper.exportProps&&n.helper.exportProps.fitToWidthSettings&&n.helper.exportProps.fitToWidthSettings.isFitToWidth&&(n.parent.zoomingProjectStartDate=n.helper.beforeSinglePageExport.zoomingProjectStartDate,n.parent.zoomingProjectEndDate=n.helper.beforeSinglePageExport.zoomingProjectEndDate,n.parent.cloneProjectStartDate=n.helper.beforeSinglePageExport.cloneProjectStartDate,n.parent.cloneProjectEndDate=n.helper.beforeSinglePageExport.cloneProjectEndDate,n.parent.timelineModule.customTimelineSettings=n.helper.beforeSinglePageExport.customTimelineSettings,n.parent.isTimelineRoundOff=n.helper.beforeSinglePageExport.isTimelineRoundOff,n.parent.timelineModule.topTier=n.helper.beforeSinglePageExport.topTier,n.parent.timelineModule.topTierCellWidth=n.helper.beforeSinglePageExport.topTierCellWidth,n.parent.timelineModule.topTierCollection=n.helper.beforeSinglePageExport.topTierCollection,n.parent.timelineModule.bottomTier=n.helper.beforeSinglePageExport.bottomTier,n.parent.timelineModule.bottomTierCellWidth=n.helper.beforeSinglePageExport.bottomTierCellWidth,n.parent.timelineModule.bottomTierCollection=n.helper.beforeSinglePageExport.bottomTierCollection,n.parent.timelineModule.totalTimelineWidth=n.helper.beforeSinglePageExport.totalTimelineWidth,n.parent.timelineModule.timelineStartDate=n.helper.beforeSinglePageExport.timelineStartDate,n.parent.timelineModule.timelineEndDate=n.helper.beforeSinglePageExport.timelineEndDate,n.parent.timelineModule.timelineRoundOffEndDate=n.helper.beforeSinglePageExport.timelineRoundOffEndDate,n.parent.perDayWidth=n.helper.beforeSinglePageExport.perDayWidth,n.parent.updatedConnectorLineCollection=n.helper.beforeSinglePageExport.updatedConnectorLineCollection),n.gantt.changeCloneProjectDates&&(n.parent.cloneProjectStartDate.setHours(0),n.gantt.changeCloneProjectDates=!1),t||(n.isBlob?n.blobPromise=n.pdfDocument.save():!ne.isNullOrUndefined(a)&&a.fileName?n.pdfDocument.save(a.fileName):n.pdfDocument.save("Export.pdf"),n.pdfDocument.destroy()),n.pdfDocument})},ar.prototype.processSectionExportProperties=function(e,t){var i;ne.isNullOrUndefined(t)||(i=new re.PdfPageSettings,ne.isNullOrUndefined(t.pageOrientation)||"Portrait"!==t.pageOrientation?i.orientation=re.PdfPageOrientation.Landscape:i.orientation=re.PdfPageOrientation.Portrait,ne.isNullOrUndefined(t.pageSize)||(i.size=this.getPageSize(t.pageSize)),e.setPageSettings(i),ne.isNullOrUndefined(t.ganttStyle))?this.gantt.ganttStyle=new Ja(t.theme).style:(e=new Ja(t.theme).style,this.gantt.ganttStyle=ne.extend({},e,t.ganttStyle,!0))},ar.prototype.getPageSize=function(e){switch(e){case"Letter":return new re.SizeF(612,792);case"Note":return new re.SizeF(540,720);case"Legal":return new re.SizeF(612,1008);case"A0":return new re.SizeF(2380,3368);case"A1":return new re.SizeF(1684,2380);case"A2":return new re.SizeF(1190,1684);case"A3":return new re.SizeF(842,1190);case"A5":return new re.SizeF(421,595);case"A6":return new re.SizeF(297,421);case"A7":return new re.SizeF(210,297);case"A8":return new re.SizeF(148,210);case"A9":return new re.SizeF(105,148);case"B0":return new re.SizeF(2836,4008);case"B1":return new re.SizeF(2004,2836);case"B2":return new re.SizeF(1418,2004);case"B3":return new re.SizeF(1002,1418);case"B4":return new re.SizeF(709,1002);case"B5":return new re.SizeF(501,709);case"Archa":return new re.SizeF(648,864);case"Archb":return new re.SizeF(864,1296);case"Archc":return new re.SizeF(1296,1728);case"Archd":return new re.SizeF(1728,2592);case"Arche":return new re.SizeF(2592,3456);case"Flsa":return new re.SizeF(612,936);case"HalfLetter":return new re.SizeF(396,612);case"Letter11x17":return new re.SizeF(792,1224);case"Ledger":return new re.SizeF(1224,792);default:return new re.SizeF(595,842)}};un=ar;function ar(e){this.isPdfExport=!1,this.parent=e,this.helper=new Wn(this.parent),this.pdfDocument=void 0}rr.prototype.getModuleName=function(){return"virtualScroll"},rr.prototype.bindTreeGridProperties=function(){this.parent.treeGrid.enableVirtualization=this.parent.enableVirtualization,T.TreeGrid.Inject(T.VirtualScroll)},rr.prototype.getTopPosition=function(){var e=this.parent.ganttChartModule.scrollElement.querySelector(".e-virtualtable"),t=e.style.transform.split(",");return e=1<t.length?t[1].trim().split(")")[0]:(t=e.style.transform).substring(t.lastIndexOf("(")+1,t.lastIndexOf(")")),parseFloat(e)},rr.prototype.destroy=function(){};var nr=rr;function rr(e){this.parent=e,this.bindTreeGridProperties()}k.AddDialogFieldSettings=Ut,k.Column=xt,k.ColumnMenu=Ka,k.ContextMenu=Za,k.CriticalPath=Ha,k.DayMarkers=Wa,k.DayWorkingTime=r,k.Dependency=aa,k.Edit=g,k.EditDialogFieldSettings=Bt,k.EditSettings=Ht,k.EventMarker=_t,k.ExcelExport=Xa,k.Filter=Ia,k.FilterSettings=Kt,k.Gantt=$i,k.Holiday=ni,k.LabelSettings=li,k.LoadingIndicator=Gi,k.PdfBorders=nn,k.PdfExport=un,k.PdfGanttTheme=Ja,k.PdfPaddings=sn,k.PdfTreeGridCell=Pn,k.PdfTreeGridCellCollection=Rn,k.PdfTreeGridColumn=Nn,k.PdfTreeGridColumnCollection=Vn,k.PdfTreeGridHeaderCollection=Fn,k.PdfTreeGridLayoutFormat=kn,k.PdfTreeGridLayoutResult=mn,k.PdfTreeGridLayouter=cn,k.PdfTreeGridRow=On,k.PdfTreeGridRowCollection=In,k.PdfTreeGridStyle=pn,k.PdfTreeGridStyleBase=ln,k.Reorder=Ca,k.Resize=Oa,k.ResourceFields=Vi,k.RowDD=$a,k.SearchSettings=ei,k.Selection=Ua,k.SelectionSettings=ui,k.Sort=Ea,k.SortDescriptor=Bi,k.SortSettings=Fi,k.SplitterSettings=mi,k.TaskFields=bi,k.TemporaryDictionary=tn,k.TimelineSettings=s,k.TimelineTierSettings=Ri,k.Toolbar=Na,k.TooltipSettings=Ci,k.UndoRedo=qa,k.VirtualScroll=nr,k.WeekWorkingTime=Xi,k.formatString=Y,k.getIndex=K,k.getSwapKey=z,k.getTaskData=Z,k.getUid=$,k.getUniversalTime=q,k.isCountRequired=H,k.isEmptyObject=G,k.isRemoteData=_,k.isScheduledTask=j,k.keyPressed="key-pressed",k.load="load",k.parentsUntil=S,k.pixelToPoint=se,k.pointToPixel=oe,k.queryCellInfo="queryCellInfo",k.rowDataBound="rowDataBound",k.toolbarClick=ca,k.updateDates=X,Object.defineProperty(k,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-gantt.umd.min.js.map