@syncfusion/ej2-gantt 22.1.36 → 22.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/ej2-gantt.min.js +2 -2
- package/dist/ej2-gantt.umd.min.js +2 -2
- package/dist/ej2-gantt.umd.min.js.map +1 -1
- package/dist/es6/ej2-gantt.es2015.js +232 -106
- package/dist/es6/ej2-gantt.es2015.js.map +1 -1
- package/dist/es6/ej2-gantt.es5.js +232 -106
- package/dist/es6/ej2-gantt.es5.js.map +1 -1
- package/dist/global/ej2-gantt.min.js +2 -2
- package/dist/global/ej2-gantt.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +17 -17
- package/src/gantt/actions/context-menu.js +70 -47
- package/src/gantt/actions/dependency.js +6 -0
- package/src/gantt/actions/taskbar-edit.js +1 -0
- package/src/gantt/base/date-processor.js +11 -2
- package/src/gantt/base/gantt-chart.js +20 -15
- package/src/gantt/base/gantt.d.ts +1 -0
- package/src/gantt/base/task-processor.js +41 -20
- package/src/gantt/base/tree-grid.js +78 -22
- package/src/gantt/renderer/timeline.js +5 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: ej2-gantt.umd.min.js
|
|
3
|
-
* version : 22.1.
|
|
3
|
+
* version : 22.1.38
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
7
|
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
8
|
* applicable laws.
|
|
9
9
|
*/
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-treegrid"),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-dropdowns"),require("@syncfusion/ej2-pdf-export")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-popups","@syncfusion/ej2-grids","@syncfusion/ej2-data","@syncfusion/ej2-treegrid","@syncfusion/ej2-svg-base","@syncfusion/ej2-layouts","@syncfusion/ej2-navigations","@syncfusion/ej2-richtexteditor","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-calendars","@syncfusion/ej2-dropdowns","@syncfusion/ej2-pdf-export"],t):t(e.ej={},e.ej2Base,e.ej2Popups,e.ej2Grids,e.ej2Data,e.ej2Treegrid,e.ej2SvgBase,e.ej2Layouts,e.ej2Navigations,e.ej2Richtexteditor,e.ej2Inputs,e.ej2Buttons,e.ej2Calendars,e.ej2Dropdowns,e.ej2PdfExport)}(this,function(e,t,i,r,a,n,s,o,l,d,h,p,c,u,g){"use strict";function f(e,t,i){for(var r=e;r&&(i?r.id!==t:!r.classList.contains(t));)r=r.parentElement;return r}function m(e){return t.isNullOrUndefined(e.startDate)&&t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.duration)?null:!(t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration))}function y(e){return!(!e.dataSource||e.dataSource instanceof a.DataManager||!("result"in e.dataSource))}function D(e){for(var t={},i=0,r=Object.keys(e);i<r.length;i++){var a=r[i];t[e[a]]=a}return t}function v(e){if(e instanceof a.DataManager){var t=e.adaptor;return t instanceof a.ODataAdaptor||t instanceof a.ODataV4Adaptor||t instanceof a.WebApiAdaptor||t instanceof a.WebMethodAdaptor||t instanceof a.CacheAdaptor||t instanceof a.RemoteSaveAdaptor||t instanceof a.UrlAdaptor}return!1}function w(e,i,r,a){if(r){for(var n=void 0,s=0;s<e.length;s++){var o=void 0;n=o=i?e[s].taskData:t.extend({},e[s].taskData,{},!0)}return n}for(n=[],s=0;s<e.length;s++){o=void 0;!t.isNullOrUndefined(a)&&a.timezone&&k(e[s],a),o=i?e[s].taskData:t.extend({},e[s].taskData,{},!0),n.push(o)}return n}function k(e,t){return 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 T(e,t){for(var i,r=0;r<t.length;r++)i=new RegExp("\\{"+r+"\\}","gm"),e=e.replace(i,t[r].toString());return e}function b(e,i,r,a){for(var n=-1,s=0;s<r.length;s++)if(t.getValue(i,r[s])===t.getValue(i,e)&&t.isNullOrUndefined(a)||!t.isNullOrUndefined(a)&&t.getValue(i,r[s])===t.getValue(i,e)&&t.getValue(a,r[s])===t.getValue(a,e)){n=s;break}return n}function P(e){return 76*e/92}function S(e){return 92*e/76}function C(){return M++}var M=0,R=function(){function e(e){this.parent=e}return e.prototype.isValidateNonWorkDays=function(e){return!t.isNullOrUndefined(e)&&e.isAutoSchedule&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)||t.isNullOrUndefined(e)&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)},e.prototype.checkStartDate=function(e,i,r,a){if(t.isNullOrUndefined(e))return null;var n=new Date(e.getTime()),s=this.getSecondsInDecimal(n);if(r=t.isNullOrUndefined(r)?!t.isNullOrUndefined(i)&&i.isMilestone:r,s<this.parent.defaultStartTime&&(!r||a))this.setTime(this.parent.defaultStartTime,n);else if(s<this.parent.defaultStartTime&&r)this.setTime(this.parent.defaultStartTime,n);else if(s===this.parent.defaultEndTime&&(!i||!r)||s>this.parent.defaultEndTime)n.setDate(n.getDate()+1),this.setTime(this.parent.defaultStartTime,n);else if(s>this.parent.defaultStartTime&&s<this.parent.defaultEndTime)for(var o=0;o<this.parent.workingTimeRanges.length;o++){var l=this.parent.workingTimeRanges[o];if(s>=l.to&&this.parent.workingTimeRanges[o+1]&&s<this.parent.workingTimeRanges[o+1].from){(s!==l.to||i&&r)&&s===l.to||this.setTime(this.parent.workingTimeRanges[o+1].from,n);break}}var d;if(this.parent.autoCalculateDateScheduling){do{d=new Date(n.getTime());var h=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)){var p=!r||a?this.parent.defaultStartTime:this.parent.defaultEndTime;if(!this.parent.includeWeekend){var c=new Date(n.getTime());n=this.getNextWorkingDay(n),c.getTime()!==n.getTime()&&this.setTime(p,n)}for(var u=0;u<h;u++){var g=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[u])),f=new Date(g.getTime());g.setHours(0,0,0,0),f.setHours(23,59,59,59),n.getTime()>=g.getTime()&&n.getTime()<f.getTime()&&(n.setDate(n.getDate()+1),this.setTime(p,n))}}}while(d.getTime()!==n.getTime());return new Date(n.getTime())}return new Date(n.getTime())},e.prototype.checkEndDate=function(e,i,r){if(t.isNullOrUndefined(e))return null;var a=new Date(e.getTime()),n=this.getSecondsInDecimal(a);if(n>this.parent.defaultEndTime)this.setTime(this.parent.defaultEndTime,a);else if(n<=this.parent.defaultStartTime&&!r)a.setDate(a.getDate()-1),this.setTime(this.parent.defaultEndTime,a);else if(n>this.parent.defaultStartTime&&n<this.parent.defaultEndTime)for(var s=0;s<this.parent.workingTimeRanges.length;s++){if(n>this.parent.workingTimeRanges[s].to&&this.parent.workingTimeRanges[s+1]&&n<=this.parent.workingTimeRanges[s+1].from){this.setTime(this.parent.workingTimeRanges[s].to,a);break}}var o;if(this.parent.autoCalculateDateScheduling){do{o=new Date(a.getTime());var l=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)){if(!this.parent.includeWeekend){var d=new Date(a.getTime());a=this.getPreviousWorkingDay(a),d.getTime()!==a.getTime()&&this.setTime(this.parent.defaultEndTime,a)}for(var h=0;h<l;h++){var p=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[h])),c=new Date(p.getTime()),u=new Date(a.getTime());u.setMinutes(a.getMilliseconds()-2),p.setHours(0,0,0,0),c.setHours(23,59,59,59),(a.getTime()>=p.getTime()&&a.getTime()<c.getTime()||u.getTime()>=p.getTime()&&u.getTime()<c.getTime())&&(a.setDate(a.getDate()-1),a.getTime()===p.getTime()&&86400===this.parent.defaultEndTime&&0===this.getSecondsInDecimal(a)||this.setTime(this.parent.defaultEndTime,a))}}}while(o.getTime()!==a.getTime());return new Date(a.getTime())}return t.isNullOrUndefined(a)||this.setTime(this.parent.defaultEndTime,a),new Date(a.getTime())},e.prototype.checkBaselineStartDate=function(e){if(t.isNullOrUndefined(e))return null;var i=new Date(e.getTime()),r=this.getSecondsInDecimal(i);if(r<this.parent.defaultStartTime)this.setTime(this.parent.defaultStartTime,i);else if(r>this.parent.defaultEndTime)i.setDate(i.getDate()+1),this.setTime(this.parent.defaultStartTime,i);else if(r>this.parent.defaultStartTime&&r<this.parent.defaultEndTime)for(var a=0;a<this.parent.workingTimeRanges.length;a++){if(r>this.parent.workingTimeRanges[a].to&&this.parent.workingTimeRanges[a+1]&&r<this.parent.workingTimeRanges[a+1].from){this.setTime(this.parent.workingTimeRanges[a+1].from,i);break}}return i},e.prototype.checkBaselineEndDate=function(e,i){if(t.isNullOrUndefined(e))return null;var r=new Date(e.getTime()),a=this.getSecondsInDecimal(r);if(a>this.parent.defaultEndTime)this.setTime(this.parent.defaultEndTime,r);else if(a<this.parent.defaultStartTime&&!t.isNullOrUndefined(i)&&!i.isMilestone)r.setDate(r.getDate()-1),this.setTime(this.parent.defaultEndTime,r);else if(a>this.parent.defaultStartTime&&a<this.parent.defaultEndTime)for(var n=0;n<this.parent.workingTimeRanges.length;n++){if(a>this.parent.workingTimeRanges[n].to&&this.parent.workingTimeRanges[n+1]&&a<=this.parent.workingTimeRanges[n+1].from){this.setTime(this.parent.workingTimeRanges[n].to,r);break}}return i&&i.baselineStartDate&&r&&i.baselineStartDate.getTime()>r.getTime()&&r.setDate(r.getDate()+1),r},e.prototype.calculateStartDate=function(e){var i=e.ganttProperties,r=null;t.isNullOrUndefined(i.endDate)||t.isNullOrUndefined(i.duration)||(r=this.getStartDate(i.endDate,i.duration,i.durationUnit,i)),this.parent.setRecordValue("startDate",r,i,!0),this.parent.taskFields.startDate&&this.parent.dataOperation.updateMappingData(e,"startDate")},e.prototype.calculateEndDate=function(e){var i=e.ganttProperties,r=null;if(t.isNullOrUndefined(i.startDate))r=e[this.parent.taskFields.endDate],t.isNullOrUndefined(r)||this.setTime(this.parent.defaultEndTime,r),this.parent.setRecordValue("endDate",r,i,!0);else{if(!t.isNullOrUndefined(i.endDate)&&t.isNullOrUndefined(i.duration)&&(1===this.compareDates(i.startDate,i.endDate)&&(this.parent.setRecordValue("startDate",new Date(i.endDate.getTime()),i,!0),this.setTime(this.parent.defaultStartTime,i.startDate)),this.calculateDuration(e)),!t.isNullOrUndefined(i.duration)){var a=!t.isNullOrUndefined(i.segments)&&i.segments.length>0?this.totalDuration(i.segments):i.duration;r=this.getEndDate(i.startDate,a,i.durationUnit,i,!1)}this.parent.setRecordValue("endDate",r,i,!0)}this.parent.taskFields.endDate&&this.parent.dataOperation.updateMappingData(e,"endDate")},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){var i,r=e.ganttProperties;i=!t.isNullOrUndefined(r.segments)&&r.segments.length>0&&!t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)?this.parent.editModule.taskbarEditModule.sumOfDuration(r.segments):t.isNullOrUndefined(this.parent.taskFields.milestone)||t.isNullOrUndefined(r.startDate)||t.isNullOrUndefined(r.endDate)||r.startDate.getTime()!==r.endDate.getTime()||t.isNullOrUndefined(e.taskData[this.parent.taskFields.milestone])?this.getDuration(r.startDate,r.endDate,r.durationUnit,r.isAutoSchedule,r.isMilestone):1,this.parent.setRecordValue("duration",i,r,!0);var a=this.parent.columnByField[this.parent.columnMapping.duration];if(!(t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||t.isNullOrUndefined(a))){if(!t.isNullOrUndefined(a.edit)&&!t.isNullOrUndefined(a.edit.read)){var n=this.parent.editModule.dialogModule.dialog;if(!t.isNullOrUndefined(n)){var s=n.querySelector("#"+this.parent.element.id+"Duration").ej2_instances[0];t.isNullOrUndefined(s)||s.value===i.toString()||(s.value=i.toString(),s.dataBind())}}this.parent.taskFields.duration&&(this.parent.dataOperation.updateMappingData(e,"duration"),this.parent.taskFields.durationUnit&&this.parent.dataOperation.updateMappingData(e,"durationUnit"))}},e.prototype.getNonworkingTime=function(e,i,r,a){a=!!t.isNullOrUndefined(a)||a;var n=!this.parent.includeWeekend&&this.parent.autoCalculateDateScheduling&&r?this.getWeekendCount(e,i):0,s=this.getNumberOfSeconds(e,i,a),o=r&&this.parent.autoCalculateDateScheduling?this.getHolidaysCount(e,i):0,l=(s-86400*n-86400*o)/86400,d=this.getNonWorkingSecondsOnDate(e,i,r);return l*(86400-this.parent.secondsPerDay)+86400*n+86400*o+d},e.prototype.getDuration=function(e,i,r,a,n,s){if(t.isNullOrUndefined(e)||t.isNullOrUndefined(i))return null;s=!!t.isNullOrUndefined(s)||s;var o=0,l=this.getTimeDifference(e,i,s)/1e3-this.getNonworkingTime(e,i,a,s);return o=n&&this.parent.getFormatedDate(e)===this.parent.getFormatedDate(i)?0:r&&"day"!==r?"minute"===r?l/60:l/3600:l/this.parent.secondsPerDay,parseFloat(o.toString())},e.prototype.getDurationAsSeconds=function(e,t){return t&&"day"!==t.toLocaleLowerCase()?"hour"===t.toLocaleLowerCase()?3600*e:60*e:this.parent.secondsPerDay*e},e.prototype.getEndDate=function(e,t,i,r,a){for(var n=new Date(e.getTime()),s=new Date(e.getTime()),o=this.getDurationAsSeconds(t,i);o>0;)s.setSeconds(s.getSeconds()+o),(o-=o-this.getNonworkingTime(n,s,r.isAutoSchedule,!0))>0&&(s=this.checkStartDate(s,r,a)),n=new Date(s.getTime());return s},e.prototype.getStartDate=function(e,t,i,r,a){for(var n=new Date(e.getTime()),s=new Date(e.getTime()),o=this.getDurationAsSeconds(t,i);o>0;)s.setSeconds(s.getSeconds()-o),(o-=o-this.getNonworkingTime(s,n,r.isAutoSchedule,!0))>0&&(n=this.checkEndDate(s,r)),n=new Date(s.getTime());return a&&r.isMilestone&&(s.setDate(s.getDate()-1),this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,s),s=this.parent.dateValidationModule.checkStartDate(s,r,!0)),s},e.prototype.getProjectStartDate=function(e,i){if(!t.isNullOrUndefined(this.parent.cloneProjectStartDate)){"string"==typeof this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate));var r=this.checkStartDate(this.parent.cloneProjectStartDate);return this.parent.cloneProjectStartDate=r,new Date(r.getTime())}if(t.isNullOrUndefined(this.parent.projectStartDate)){if(t.isNullOrUndefined(i))return null;var a=this.parent.flatData,n=void 0;a.length>0?n=a[0].ganttProperties.startDate:(n=new Date).setHours(0,0,0,0);for(var s=1;s<a.length;s++){var o=a[s].ganttProperties.startDate;t.isNullOrUndefined(o)||-1!==this.compareDates(o,n)||(n=o)}this.parent.cloneProjectStartDate=this.checkStartDate(n,e)}else{r=this.getDateFromFormat(this.parent.projectStartDate);this.parent.cloneProjectStartDate=this.checkStartDate(r)}return new Date(this.parent.cloneProjectStartDate.getTime())},e.prototype.getValidStartDate=function(e,i){var r=null,a=i?e.autoStartDate:e.startDate,n=i?e.autoEndDate:e.endDate,s=!e.isAutoSchedule&&e.autoDuration?e.autoDuration:e.duration;return t.isNullOrUndefined(a)?t.isNullOrUndefined(n)?t.isNullOrUndefined(s)||(r=this.getProjectStartDate(e)):(r=new Date(n.getTime()),this.setTime(this.parent.defaultStartTime,r)):r=new Date(a.getTime()),r},e.prototype.getValidEndDate=function(e,i){var r=null,a=i?e.autoStartDate:e.startDate,n=i?e.autoEndDate:e.endDate,s=i?e.autoDuration:e.duration;if(t.isNullOrUndefined(n))if(t.isNullOrUndefined(a)){if(!t.isNullOrUndefined(s)){var o=this.getValidStartDate(e);o&&(r=this.getEndDate(o,s,e.durationUnit,e,!1))}}else e.isMilestone?r=this.checkStartDate(a):(r=new Date(a.getTime()),this.setTime(this.parent.defaultEndTime,r));else r=new Date(n.getTime());return r},e.prototype.getSecondsPerDay=function(){var e=this.parent.dayWorkingTime,i=e.length,r=0,a=new Date("10/11/2018");this.parent.nonWorkingHours=[];var n=this.parent.nonWorkingHours;this.parent.workingTimeRanges=[];var s=this.parent.workingTimeRanges;this.parent.nonWorkingTimeRanges=[];for(var o=this.parent.nonWorkingTimeRanges,l=0;l<i;l++){var d=e[l];if(!t.isNullOrUndefined(d.from)&&!t.isNullOrUndefined(d.to)){a.setHours(0,0,0,0);var h=new Date(a.getTime());a.setTime(a.getTime()+36e5*d.from);var p=new Date(a.getTime());h.setTime(h.getTime()+36e5*d.to);var c=new Date(h.getTime()),u=c.getTime()-p.getTime(),g=this.getSecondsInDecimal(p),f=this.getSecondsInDecimal(c);0===f&&(f=86400),r+=u/1e3,0===l&&(this.parent.defaultStartTime=g),l===i-1&&(this.parent.defaultEndTime=f),l>0?(n.push(n[n.length-1]+g-s[l-1].to),s[l-1].to<g&&o.push({from:s[l-1].to,to:g,isWorking:!1,interval:g-s[l-1].to})):(n.push(0),o.push({from:0,to:g,isWorking:!1,interval:g})),s.push({from:g,to:f}),o.push({from:g,to:f,isWorking:!0,interval:f-g})}}return this.parent.defaultEndTime/3600!=24&&o.push({from:this.parent.defaultEndTime,to:86400,isWorking:!1,interval:86400-this.parent.defaultEndTime}),r},e.prototype.getDurationValue=function(e,i){var r=null,a=null;if("string"==typeof e){var n=e.match(/(\d*\.*\d+|.+$)/g);if(n&&n.length<=2){a=parseFloat(n[0].toString().trim());var s=n[1]?n[1].toString().trim().toLowerCase():null;-1!==t.getValue("minute",this.parent.durationUnitEditText).indexOf(s)?r="minute":-1!==t.getValue("hour",this.parent.durationUnitEditText).indexOf(s)?r="hour":-1!==t.getValue("day",this.parent.durationUnitEditText).indexOf(s)&&(r="day")}}else a=e,r=null;return{duration:a,durationUnit:r}},e.prototype.getNextWorkingDay=function(e){var t=e.getDay();return-1!==this.parent.nonWorkingDayIndex.indexOf(t)?(e.setDate(e.getDate()+1),e=this.getNextWorkingDay(e)):e},e.prototype.getWeekendCount=function(e,t){var i=0,r=new Date(e.getTime()),a=new Date(t.getTime());for(r.setHours(0,0,0,0),r.setDate(r.getDate()+1),a.setHours(0,0,0,0);r.getTime()<a.getTime();)-1!==this.parent.nonWorkingDayIndex.indexOf(r.getDay())&&(i+=1),r.setDate(r.getDate()+1);return i},e.prototype.getNumberOfSeconds=function(e,t,i){var r=new Date(e.getTime()),a=new Date(t.getTime()),n=0;return r.setDate(r.getDate()+1),r.setHours(0,0,0,0),a.setHours(0,0,0,0),r.getTime()<a.getTime()&&(n=this.getTimeDifference(r,a,i)/1e3),n%86400!=0&&(n=n-n%86400+86400),n},e.prototype.getHolidaysCount=function(e,t){var i=0,r=this.parent.totalHolidayDates,a=new Date(e.getTime()),n=new Date(t.getTime());if(a.setDate(a.getDate()+1),a.setHours(0,0,0,0),n.setHours(0,0,0,0),a.getTime()<n.getTime())for(var s=0;s<r.length;s++){var o=this.getDateFromFormat(new Date(r[s]));a.getTime()<=o.getTime()&&n.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,i=[],r=0;r<e.length;r++){var a=this.getDateFromFormat(e[r].from),n=this.getDateFromFormat(e[r].to);if(!t.isNullOrUndefined(a)||!t.isNullOrUndefined(n))if(t.isNullOrUndefined(a)||t.isNullOrUndefined(n)){var s=a||n;s.setHours(0,0,0,0),-1===i.indexOf(s.getTime())&&i.push(s.getTime())}else for(;a<=n;)a.setHours(0,0,0,0),-1===i.indexOf(a.getTime())&&i.push(a.getTime()),a.setDate(a.getDate()+1)}return i},e.prototype.isOnHolidayOrWeekEnd=function(e,i){if(i=t.isNullOrUndefined(i)?this.parent.includeWeekend:i,this.parent.autoCalculateDateScheduling||(i=!0),!i&&-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay()))return!0;for(var r=this.parent.totalHolidayDates,a=0;a<r.length;a++){var n=this.getDateFromFormat(new Date(r[a])),s=new Date(n.getTime());if(n.setHours(0,0,0,0),s.setHours(23,59,59,59),e.getTime()>=n.getTime()&&e.getTime()<s.getTime())return!0}return!1},e.prototype.getNonWorkingSecondsOnDate=function(e,t,i){for(var r=this.getSecondsInDecimal(e),a=this.getSecondsInDecimal(t),n=-1,s=-1,o=0,l=!(!i||!this.parent.autoCalculateDateScheduling)&&this.isOnHolidayOrWeekEnd(e,null),d=!(!i||!this.parent.autoCalculateDateScheduling)&&this.isOnHolidayOrWeekEnd(t,null),h=0;h<this.parent.nonWorkingTimeRanges.length;h++){var p=this.parent.nonWorkingTimeRanges[h];r>=p.from&&r<=p.to&&(n=h),a>=p.from&&a<=p.to&&(s=h)}if(e.getDate()!==t.getDate()||e.getMonth()!==t.getMonth()||e.getFullYear()!==t.getFullYear()){if(l)o+=86400-r;else for(h=n;h<this.parent.nonWorkingTimeRanges.length;h++)this.parent.nonWorkingTimeRanges[h].isWorking||(o+=h===n?this.parent.nonWorkingTimeRanges[h].to-r:this.parent.nonWorkingTimeRanges[h].interval);if(d)o+=a;else for(h=0;h<=s;h++)this.parent.nonWorkingTimeRanges[h].isWorking||(o+=h===s?a-this.parent.nonWorkingTimeRanges[h].from:this.parent.nonWorkingTimeRanges[h].interval)}else if(n!==s)if(d)o+=a-r;else for(h=n;h<=s;h++)this.parent.nonWorkingTimeRanges[h].isWorking||(o+=h===n?this.parent.nonWorkingTimeRanges[h].to-r:h===s?a-this.parent.nonWorkingTimeRanges[h].from:this.parent.nonWorkingTimeRanges[h].interval);else if(d)o+=a-r;else{this.parent.nonWorkingTimeRanges[n].isWorking||(o=a-r)}return o},e.prototype.getPreviousWorkingDay=function(e){var t=e.getDay(),i=0===t?6:t-1;return-1!==this.parent.nonWorkingDayIndex.indexOf(t)||-1!==this.parent.nonWorkingDayIndex.indexOf(i)&&86400===this.parent.defaultEndTime&&0===this.getSecondsInDecimal(e)?(e.setDate(e.getDate()-1),-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay())&&(e=this.getPreviousWorkingDay(e)),e):e},e.prototype.getNonWorkingDayIndex=function(){var e=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],t=e.length;0===this.parent.workWeek.length&&(this.parent.workWeek=["Monday","Tuesday","Wednesday","Thursday","Friday"]);for(var i=this.parent.workWeek.slice(),r=i.length,a=0;a<r;a++)i[a]=i[a].toLowerCase();this.parent.nonWorkingDayIndex=[];for(a=0;a<t;a++)-1===i.indexOf(e[a])&&this.parent.nonWorkingDayIndex.push(a)},e.prototype.setTime=function(e,t){var i=e/3600,r=(e-3600*(i=parseInt(i,10)))/60,a=e-3600*i-60*(r=parseInt(r,10));t.setHours(i,r,a)},e.prototype.getTimeDifference=function(e,t,i){var r=new Date(e.getTime()),a=new Date(t.getTime());return i&&this.updateDateWithTimeZone(r,a),a.getTime()-r.getTime()},e.prototype.updateDateWithTimeZone=function(e,t){var i,r,a=e.getTimezoneOffset(),n=t.getTimezoneOffset();if(a!==n){var s=new Date((new Date).getFullYear(),0,1).getTimezoneOffset();if(s!==a?(r=e,i=a):s!==n&&(r=t,i=n),s<0){var o=s-i;r.setTime(r.getTime()+60*o*1e3)}else if(s>=0){o=i-s;r.setTime(r.getTime()-60*o*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 r=new Date(e.toLocaleString("en-US",{timeZone:t}));return isNaN(r.getTime())?0:(e.getTime()-r.getTime())/6e4+i}catch(e){return 0}},e.prototype.remove=function(e,i){return t.isNullOrUndefined(e)||(e=this.reverse(e,i,e.getTimezoneOffset())),e},e.prototype.reverse=function(e,t,i){"string"==typeof t&&(t=this.offset(e,t)),"string"==typeof i&&(i=this.offset(e,i));var r=e.getTimezoneOffset(),a=(e=new Date(e.getTime()+6e4*(t-i))).getTimezoneOffset();return new Date(e.getTime()+6e4*(a-r))},e.prototype.convert=function(e,t){var i=e.getTimezoneOffset(),r=this.offset(e,t),a=(e=new Date(e.getTime()+6e4*(i-r))).getTimezoneOffset();return new Date(e.getTime()+6e4*(a-i))},e.prototype.getDateFromFormat=function(e,i){var r;if(t.isNullOrUndefined(e))return null;if(e instanceof Date)r=new Date(e.getTime());else{var a=this.parent.globalize.parseDate(e,{format:this.parent.getDateFormat(),type:"dateTime"});r=t.isNullOrUndefined(a)&&!isNaN(new Date(e).getTime())?new Date(e):a}if(!t.isNullOrUndefined(this.parent.timezone)&&i){return this.convert(r,this.parent.timezone)}return r},e.prototype.compareDates=function(e,i){return t.isNullOrUndefined(e)||t.isNullOrUndefined(i)?!t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)?1:t.isNullOrUndefined(e)&&!t.isNullOrUndefined(i)?-1:null:e.getTime()>i.getTime()?1:e.getTime()<i.getTime()?-1:0},e.prototype.getDurationString=function(e,i){var r="";if(!t.isNullOrUndefined(e)&&(r+=parseFloat(e.toFixed(2))+" ",!t.isNullOrUndefined(i))){var a=1!==e;"day"===i?r+=a?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===i?r+=a?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===i&&(r+=a?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))}return r},e.prototype.getWorkString=function(e,i){var r="";if(!t.isNullOrUndefined(e)&&(r+=parseFloat(e).toFixed(2)+" ",!t.isNullOrUndefined(i))){var a=1!==e;"day"===i?r+=a?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===i?r+=a?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===i&&(r+=a?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))}return r},e.prototype.calculateProjectDatesForValidatedTasks=function(e){var i=this,r="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,a="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,n=null,s=null,o=t.getValue("dataOperation.dataArray",this.parent);if(r&&a||!o||0!==o.length){if(o.length>0){var l=o.slice().sort(function(e,t){return new Date(e[i.parent.taskFields.startDate]).getTime()-new Date(t[i.parent.taskFields.startDate]).getTime()}),d=o.slice().sort(function(e,t){return new Date(t[i.parent.taskFields.endDate]).getTime()-new Date(e[i.parent.taskFields.endDate]).getTime()});n=l[0][this.parent.taskFields.startDate],s=d[d.length-1][this.parent.taskFields.endDate]}}else n=this.getDateFromFormat(new Date),s=this.getDateFromFormat(new Date(n.getTime()));this.parent.cloneProjectStartDate=r?new Date(r.getTime()):"string"==typeof n?new Date(n):n,this.parent.cloneProjectEndDate=a?new Date(a.getTime()):"string"==typeof s?new Date(s):s},e.prototype.calculateProjectDates=function(e){var i=this;if(this.parent.isLoad&&this.parent.enablePersistence&&this.parent.cloneProjectStartDate&&this.parent.cloneProjectEndDate)return this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate),void(this.parent.cloneProjectEndDate=this.getDateFromFormat(this.parent.cloneProjectEndDate));var r="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,a="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,n=this.parent.timelineModule.isZooming&&this.parent.cloneProjectStartDate?this.getDateFromFormat(this.parent.cloneProjectStartDate):this.getDateFromFormat(r),s=this.parent.timelineModule.isZooming&&this.parent.cloneProjectEndDate?this.getDateFromFormat(this.parent.cloneProjectEndDate):this.getDateFromFormat(a),o=null,l=null,d=this.parent.flatData,h=this.parent.currentViewData,p=[],c=function(e){t.isNullOrUndefined(e)||p.push(e)},u=function(e){e.length>0&&(e.sort(function(e,t){return e.getTime()-t.getTime()}),o=new Date(e[0].getTime()),l=e.length>1?new Date(e[e.length-1].getTime()):null)};if((!n||!s)&&d.length>0||e||this.parent.timelineModule.isZoomToFit){if((h.length>0&&this.parent.timelineModule.isZoomToFit&&this.parent.treeGrid.filterModule&&this.parent.treeGrid.filterModule.filteredResult.length>0?h:d).forEach(function(e){p=[];var t=e.ganttProperties,r=i.getValidStartDate(t),a=i.getValidEndDate(t);c(o),c(l),c(r),c(a),i.parent.renderBaseline&&!i.parent.timelineModule.isZoomToFit&&(c(t.baselineStartDate),c(t.baselineEndDate)),t.indicators&&t.indicators.length>0&&!i.parent.timelineModule.isZoomToFit&&t.indicators.forEach(function(e){c(i.getDateFromFormat(e.date))}),u(p)}),p=[],c(o),c(l),this.parent.eventMarkers.length>0&&!this.parent.timelineModule.isZoomToFit){this.parent.eventMarkers.forEach(function(e,t){c(i.getDateFromFormat(e.day))})}if(this.parent.totalHolidayDates.length>0&&!this.parent.timelineModule.isZoomToFit){this.parent.totalHolidayDates.forEach(function(e,t){c(new Date(e))})}u(p),o&&l||(o?o=t.isNullOrUndefined(o)?this.getDateFromFormat(new Date):o:(o=t.isNullOrUndefined(o)?this.getDateFromFormat(new Date):o).setHours(0,0,0,0),(l=this.getDateFromFormat(new Date(o.getTime()))).setDate(l.getDate()+20))}else n&&s||0!==d.length||(o=this.getDateFromFormat(new Date),l=this.getDateFromFormat(new Date(o.getTime())));e?(t.setValue("minStartDate",o,e),t.setValue("maxEndDate",l,e)):(this.prevProjectStartDate=this.parent.cloneProjectStartDate,this.parent.cloneProjectStartDate=o||new Date(n.getTime()),this.parent.cloneProjectEndDate=l||new Date(s.getTime()))},e.prototype.splitTasksDuration=function(e){for(var t=0,i=0;i<e.length;i++){var r=e[i],a=r.startDate,n=r.endDate;"Hour"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(a,n)/36e5):"Minutes"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(a,n)/6e4):t+=Math.ceil(this.getTimeDifference(a,n)/864e5)}return t},e}(),O=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),x=function(e){function i(t){var i=e.call(this,t)||this;return i.recordIndex=0,i.taskIds=[],i.hierarchyData=[],i.addEventListener(),i}return O(i,e),i.prototype.addEventListener=function(){this.parent.on("beforeDataManipulate",this.checkDataBinding.bind(this))},i.prototype.checkDataBinding=function(e){if(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=[]),t.isNullOrUndefined(this.parent.dataSource))this.parent.dataSource=[],this.parent.processTimeline(),this.parent.renderGantt(e);else if(this.parent.dataSource instanceof a.DataManager)this.initDataSource(e);else{if(this.parent.dataSource instanceof Object&&y(this.parent)){var i=t.getValue("result",this.parent.dataSource);this.dataArray=i}else this.dataArray=this.parent.dataSource;this.processTimeline(),this.cloneDataSource(),this.parent.renderGantt(e)}},i.prototype.processTimeline=function(){this.parent.processTimeline(),this.parent.enableValidation||(this.parent.dataOperation.calculateProjectDatesForValidatedTasks(),this.parent.timelineModule.validateTimelineProp())},i.prototype.initDataSource=function(e){var t=this,i=this.parent.query instanceof a.Query?this.parent.query:new a.Query;i.requiresCount();this.parent.dataSource.executeQuery(i).then(function(i){t.dataArray=i.result,t.processTimeline(),t.cloneDataSource(),t.parent.renderGantt(e)}).catch(function(i){t.parent.processTimeline(),t.parent.renderGantt(e),t.parent.trigger("actionFailure",{error:i})})},i.prototype.constructDataSource=function(e){for(var i,r=new a.DataManager(e).executeLocal((new a.Query).group(this.parent.taskFields.parentID)),n=[],s=0;s<r.length;s++){var o=r[s];!t.isNullOrUndefined(o.key)&&(i=this.taskIds.indexOf(o.key.toString()))>-1&&!t.isNullOrUndefined(o.key)?e[i][this.parent.taskFields.child]=o.items:-1!==i&&n.push.apply(n,o.items)}this.hierarchyData=this.dataReorder(e,n)},i.prototype.cloneDataSource=function(){var e=this.parent.taskFields.id,i=this.parent.taskFields.parentID,r=[];if(t.isNullOrUndefined(e)||t.isNullOrUndefined(i))r=this.dataArray;else{for(var n=[],s=0;s<this.dataArray.length;s++){var o=this.dataArray[s];n.push(t.extend({},{},o,!0)),t.isNullOrUndefined(o[e])||this.taskIds.push(o[e].toString())}this.parent.taskFields.child||(this.parent.taskFields.child="Children"),this.constructDataSource(n),r=this.hierarchyData}if(this.parent.taskFields.segmentId&&(this.segmentCollection=new a.DataManager(this.parent.segmentData).executeLocal((new a.Query).group(this.parent.taskFields.segmentId)),this.parent.taskFields.segments||(this.parent.taskFields.segments="Segments")),"ProjectView"!==this.parent.viewType){var l=t.extend([],[],this.parent.resources,!0),d=[];if(this.constructResourceViewDataSource(l,r,d),d.length>0){var h={};h[this.parent.resourceFields.id]=0,h[this.parent.resourceFields.name]=this.parent.localeObj.getConstant("unassignedTask"),h[this.parent.taskFields.child]=d,l.push(h)}r=l}this.prepareDataSource(r)},i.prototype.constructResourceViewDataSource=function(e,t,i){for(var r=function(r){var n=t[r],s=null!=a.parent.taskFields.child?a.parent.taskFields.child:a.parent.taskFields.child="Children",o=n&&n[a.parent.taskFields.resourceInfo],l=a.parent.resourceFields.id;n[s]&&0!==n[s].length||!o||!o.length?(!n[s]||n[s]&&0===n[s].length)&&i.push(n):o.forEach(function(t){for(var i="object"==typeof t?t[l]:t,r=0;r<e.length;r++)if(e[r][l].toString()===i.toString()){e[r][s]?e[r][s].push(n):e[r][s]=[n];break}}),n[a.parent.taskFields.child]&&n[a.parent.taskFields.child].length&&a.constructResourceViewDataSource(e,n[a.parent.taskFields.child],i)},a=this,n=0;n<t.length;n++)r(n)},i.prototype.prepareDataSource=function(e){this.prepareRecordCollection(e,0),this.parent.initialLoadData=t.extend({},{},this.parent.flatData,!0),"ResourceView"===this.parent.viewType&&this.calculateSharedTaskUniqueIds(),this.parent.taskFields.dependency&&this.parent.predecessorModule&&this.parent.predecessorModule.ensurePredecessorCollection()},i.prototype.calculateSharedTaskUniqueIds=function(){for(var e=function(e){var i=[];if(i[0]=t.parent.getTaskIds()[e][0],i[1]=t.parent.getTaskIds()[e].slice(1),"R"!==i[0]){var r=[],a=[];t.parent.flatData.filter(function(e){e.ganttProperties.taskId.toString()===i[1]&&0!==e.level&&(a.push(e.ganttProperties.rowUniqueID),r.push(e))});for(var n=0;n<r.length;n++)r[n].ganttProperties.sharedTaskUniqueIds=a}},t=this,i=0;i<this.parent.getTaskIds().length;i++)e(i)},i.prototype.prepareRecordCollection=function(e,i,r){for(var a=this,n=e.length,s=function(n){var s=e[n];if(!t.isNullOrUndefined(o.parent.taskFields.segmentId)){var l=o.segmentCollection.filter(function(e){return e.key===s[a.parent.taskFields.id]});l.length>0&&(s[o.parent.taskFields.segments]=l[0].items)}var d=o.createRecord(s,i,r,!0);o.parent.enableValidation&&o.parent.autoCalculateDateScheduling||o.updateTaskLeftWidth(d),d.index=o.recordIndex++,o.parent.ids[d.index]=d.ganttProperties.rowUniqueID,o.parent.flatData.push(d),o.parent.setTaskIds(d);var h=s[o.parent.taskFields.child];if("ResourceView"===o.parent.viewType&&t.isNullOrUndefined(h)&&t.isNullOrUndefined(d.parentItem)&&0===d.level){var p=d.ganttProperties,c=d;o.parent.setRecordValue(p.isAutoSchedule?"startDate":"autoStartDate",null,c.ganttProperties,!0),o.parent.setRecordValue(p.isAutoSchedule?"endDate":"autoEndDate",null,c.ganttProperties,!0);var u=c.ganttProperties;o.parent.setRecordValue("isMilestone",!1,u,!0),u.isAutoSchedule&&o.calculateDuration(c),o.updateWorkWithDuration(c);var g=u.work;o.parent.setRecordValue("work",g,u,!0),o.parent.setRecordValue("taskType","FixedDuration",u,!0),t.isNullOrUndefined(o.parent.taskFields.type)||o.updateMappingData(c,"type"),o.parent.setRecordValue("progress",Math.floor(0),u,!0),o.parent.setRecordValue("totalProgress",0,u,!0),o.parent.setRecordValue("totalDuration",0,u,!0),u.isAutoSchedule||(o.parent.setRecordValue("autoDuration",o.calculateAutoDuration(u),u,!0),o.updateAutoWidthLeft(c)),o.parent.allowParentDependency||o.resetDependency(c),o.updateWidthLeft(c),o.updateTaskData(c)}!t.isNullOrUndefined(h)&&h.length>0&&o.prepareRecordCollection(h,d.level+1,d)},o=this,l=0;l<n;l++)s(l)},i.prototype.addCustomFieldValue=function(e,t){var i=this.parent.ganttColumns,r=i.length;if(r)for(var a=0;a<r;a++){void 0===t[i[a].field]&&this.parent.setRecordValue(i[a].field,e[i[a].field],t)}},i.prototype.createRecord=function(e,i,a,n){var s=this.parent.taskFields,o=this.parent.resourceFields,l=e[s.progress],d=null,h=null,p=e[s.notes];l=l&&parseFloat(l.toString())?parseFloat(l.toString()):0;var c=e[s.dependency],u=this.getDateFromFormat(e[s.baselineStartDate],!0),g=this.getDateFromFormat(e[s.baselineEndDate],!0),f={},m={},D="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[s.manual];this.parent.setRecordValue("ganttProperties",m,f),t.isNullOrUndefined(e[s.id])?t.isNullOrUndefined(e[o.id])||(d=e[o.id],h=e[o.name],this.addTaskData(f,e,!1)):(d=e[s.id],h=e[s.name],this.addTaskData(f,e,n)),this.parent.setRecordValue("taskId",d,m,!0),this.parent.setRecordValue("taskName",h,m,!0),s.parentID&&this.parent.setRecordValue("parentId",e[s.parentID],m,!0),this.addCustomFieldValue(e,f),this.parent.setRecordValue("isAutoSchedule",D,m,!0),this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),m,!0),this.parent.setRecordValue("isMilestone",!1,m,!0),this.parent.setRecordValue("indicators",e[s.indicators],m,!0),this.updateResourceName(f),this.calculateScheduledValues(f,e,n),this.parent.setRecordValue("baselineStartDate",this.checkBaselineStartDate(u),m,!0),g&&0===g.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,g),(m.baselineStartDate&&g&&m.baselineStartDate.getTime()>g.getTime()||!t.isNullOrUndefined(m.baselineStartDate)&&!t.isNullOrUndefined(m.startDate)&&m.baselineStartDate.getTime()===m.startDate.getTime()&&!t.isNullOrUndefined(g)&&!t.isNullOrUndefined(m.endDate)&&g.toLocaleDateString()===m.endDate.toLocaleDateString()&&m.isMilestone)&&(g=m.baselineStartDate),this.parent.setRecordValue("baselineEndDate",this.checkBaselineEndDate(g,m),m,!0),this.parent.setRecordValue("progress",l,m,!0),this.parent.setRecordValue("totalProgress",l,m,!0),this.parent.setRecordValue("predecessorsName",c,m,!0),this.parent.setRecordValue("notes",p,m,!0),this.parent.setRecordValue("cssClass",e[s.cssClass],m,!0),this.parent.setRecordValue("parentItem",this.getCloneParent(a),f);var v=f.parentItem?f.parentItem.uniqueID:null;if(this.parent.setRecordValue("parentUniqueID",v,f),"ResourceView"!==this.parent.viewType||t.isNullOrUndefined(s.parentID)||t.isNullOrUndefined(f.parentItem)||this.parent.setRecordValue("parentId",f.parentItem.taskId,m,!0),this.parent.setRecordValue("level",i,f),this.parent.setRecordValue("uniqueID",r.getUid(this.parent.element.id+"_data_"),f),this.parent.setRecordValue("uniqueID",f.uniqueID,m,!0),this.parent.setRecordValue("childRecords",[],f),this.parent.dataSource instanceof Object&&y(this.parent)&&!t.isNullOrUndefined(s.child)&&this.parent.setRecordValue(s.child,[],f),!t.isNullOrUndefined(e[s.child])&&e[s.child].length>0?(this.parent.setRecordValue("hasChildRecords",!0,f),this.parent.setRecordValue("isMilestone",!1,m,!0),this.parent.allowParentDependency||this.resetDependency(f)):this.parent.setRecordValue("hasChildRecords",!1,f),f.hasChildRecords&&(this.parent.setRecordValue("autoStartDate",f.ganttProperties.startDate,m),this.parent.setRecordValue("autoEndDate",f.ganttProperties.endDate,m),this.parent.setRecordValue("autoDuration",f.ganttProperties.duration,m)),this.parent.setRecordValue("expanded",!f.hasChildRecords||!this.parent.collapseAllParentTasks,f),this.updateExpandStateMappingValue(f,e),n||(this.parent.setRecordValue("width",this.calculateWidth(f),m,!0),this.parent.setRecordValue("left",this.calculateLeft(m),m,!0),this.parent.setRecordValue("progressWidth",this.getProgressWidth(m.width,l),m,!0),m.baselineEndDate&&m.baselineStartDate&&(this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(m),m,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(m),m,!0))),t.isNullOrUndefined(s.work)&&this.updateWorkWithDuration(f),t.isNullOrUndefined(s.manual)||this.parent.dataOperation.updateMappingData(f,"manual"),this.updateTaskData(f),c&&this.parent.predecessorsCollection.push(f),t.isNullOrUndefined(a)||(a.childRecords.push(f),this.parent.dataSource instanceof Object&&y(this.parent)&&!t.isNullOrUndefined(this.parent.taskFields.child)&&a[this.parent.taskFields.child].push(f.taskData)),"ProjectView"===this.parent.viewType)this.parent.setRecordValue("rowUniqueID",m.taskId.toString(),m,!0);else{var w=f.uniqueID.replace(this.parent.element.id+"_data_","");"ResourceView"===this.parent.viewType&&"string"==typeof f.ganttProperties.taskId&&(w=m.taskId.toString()),this.parent.setRecordValue("rowUniqueID",w,f),this.parent.setRecordValue("rowUniqueID",w,m,!0),this.parent.setRecordValue("sharedTaskUniqueIds",[],m,!0)}return this.parent.allowUnscheduledTasks&&f.ganttProperties.startDate&&(f.ganttProperties.endDate||f.ganttProperties.duration)&&(this.parent.setRecordValue("segments",this.setSegmentsInfo(f,!0),m,!0),this.parent.dataOperation.updateMappingData(f,"segments"),n||this.updateWidthLeft(f)),f},i.prototype.sortSegmentsData=function(e,t,i){var r=this;return t?e.sort(function(e,t){var i=r.parent.taskFields.startDate;return r.getDateFromFormat(e[i]).getTime()-r.getDateFromFormat(t[i]).getTime()}):e.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),e},i.prototype.setSegmentsInfo=function(e,i){var r,a=this.parent.taskFields,n=[],s=0,o=0,l=[];if(!t.isNullOrUndefined(this.parent.taskFields.segments)&&(r=i?e.taskData[this.parent.taskFields.segments]:e.ganttProperties.segments,!t.isNullOrUndefined(r)&&r.length>1)){this.sortSegmentsData(r,i,e.ganttProperties);for(var d=0;d<r.length;d++){var h=r[d],p=i?h[a.startDate]:h.startDate,c=i?h[a.endDate]:h.endDate,u=i?h[a.duration]:h.duration;if(p=this.getDateFromFormat(p),p=this.checkStartDate(p,e.ganttProperties,!1),t.isNullOrUndefined(u)){if((c=this.getDateFromFormat(c))&&(t.isNullOrUndefined(u)||""===String(u))&&0===c.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,c),c=this.checkEndDate(c,e.ganttProperties,!1),u=this.getDuration(p,c,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),a.duration){if((o=e.ganttProperties.duration-s-1)<=0)continue;u=d===r.length-1?o:o>0&&u>o?o:u,c=this.getEndDate(p,u,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!a.duration&&a.endDate&&(c=!t.isNullOrUndefined(e.ganttProperties.endDate)&&c.getTime()>e.ganttProperties.endDate.getTime()&&d!==r.length-1?c:e.ganttProperties.endDate,u=this.getDuration(p,c,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),n.length>0&&c.getTime()<p.getTime()&&c.getTime()<=e.ganttProperties.endDate.getTime())){n[d-1].duration=this.getDuration(n[d-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}}else if(c=this.getEndDate(p,u,e.ganttProperties.durationUnit,e.ganttProperties,!1),a.duration){if((o=e.ganttProperties.duration-s)<=0)continue;u=d===r.length-1?o:o>0&&u>o?o:u,c=this.getEndDate(p,u,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!a.duration&&a.endDate&&(c=!t.isNullOrUndefined(e.ganttProperties.endDate)&&c.getTime()>e.ganttProperties.endDate.getTime()&&d!==r.length-1?c:e.ganttProperties.endDate,u=this.getDuration(p,c,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),n.length>0&&c.getTime()<p.getTime()&&c.getTime()<=e.ganttProperties.endDate.getTime())){n[d-1].duration=this.getDuration(n[d-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}if(h={},!(p&&c&&p&&u))break;if(s+=u,h.startDate=p,h.endDate=c,h.duration=u,h.width=0,h.left=0,h.segmentIndex=d,n.push(h),t.isNullOrUndefined(n[d-1]))h.offsetDuration=0;else{var g=this.getDuration(n[d-1].endDate,n[d].startDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);h.offsetDuration=g,g<1&&(h.startDate=this.getEndDate(n[d-1].endDate,1,e.ganttProperties.durationUnit,e.ganttProperties,!1),h.startDate=this.checkStartDate(h.startDate,e.ganttProperties,!1),h.endDate=this.getEndDate(h.startDate,h.duration,e.ganttProperties.durationUnit,e.ganttProperties,!1),h.endDate=!a.duration&&a.endDate&&h.endDate>e.ganttProperties.endDate?e.ganttProperties.endDate:h.endDate,h.offsetDuration=1)}l.push(this.setSegmentTaskData(h,r[d]))}this.parent.setRecordValue("duration",s,e.ganttProperties,!0),t.isNullOrUndefined(n[n.length-1])||this.parent.setRecordValue("endDate",n[n.length-1].endDate,e.ganttProperties,!0),t.isNullOrUndefined(a.endDate)||t.isNullOrUndefined(n[n.length-1])||this.parent.setRecordValue(this.parent.taskFields.endDate,n[n.length-1].endDate,e,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,l,e)}return n.length>1?this.parent.setRecordValue("segments",n,e.ganttProperties,!0):n=null,n},i.prototype.setSegmentTaskData=function(e,i){var r=this.parent.taskFields,a=t.extend({},{},i,!0);return t.isNullOrUndefined(r.startDate)||(a[this.parent.taskFields.startDate]=e.startDate),t.isNullOrUndefined(r.endDate)||(a[this.parent.taskFields.endDate]=e.endDate),t.isNullOrUndefined(r.duration)||(a[this.parent.taskFields.duration]=Number(e.duration)),a},i.prototype.updateWorkWithDuration=function(e){var i=e.ganttProperties.resourceInfo,r=0;if(!t.isNullOrUndefined(i)){var a=i.length,n=void 0,s=void 0,o=this.parent.secondsPerDay/3600,l=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit);for(n=0;n<a;n++)r+=((s=i[n][this.parent.resourceFields.unit])>0?o*s/100:o)*l;"minute"===e.ganttProperties.workUnit&&(r*=60),"day"===e.ganttProperties.workUnit&&(r/=o),r%1!=0&&(r=parseFloat(r.toFixed(2)))}if(e.childRecords.length>0&&this.parent.isOnEdit){for(var d=0,h=0;h<e.childRecords.length;h++)d+=e.childRecords[h].ganttProperties.work;r+=d}this.parent.setRecordValue("work",r,e.ganttProperties,!0),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(e,"work")},i.prototype.getCloneParent=function(e){if(t.isNullOrUndefined(e))return null;var i={};return i.uniqueID=e.uniqueID,i.expanded=e.expanded,i.level=e.level,i.index=e.index,i.taskId=e.ganttProperties.rowUniqueID,i},i.prototype.reUpdateResources=function(){if(this.parent.flatData.length>0)for(var e=void 0,t=void 0,i=void 0,r=0;r<this.parent.flatData.length;r++)e=this.parent.flatData[r].taskData,t=this.parent.flatData[r].ganttProperties,i=this.parent.flatData[r],this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),t,!0),this.updateResourceName(i)},i.prototype.addTaskData=function(e,i,r){var n=this,s=this.parent.taskFields,o=this.parent.dataSource;if(r)if(s.parentID||o instanceof a.DataManager&&o.dataSource.json&&o.dataSource.offline)if(s.parentID){var l=i[s.id],d=this.taskIds.indexOf(l.toString()),h=d>-1?this.dataArray[d]:{};if(!t.isNullOrUndefined(this.parent.taskFields.segmentId)){var p=this.segmentCollection.filter(function(e){return e.key===h[n.parent.taskFields.id]});p.length>0&&(h[this.parent.taskFields.segments]=p[0].items)}this.parent.setRecordValue("taskData",h,e)}else this.parent.setRecordValue("taskData",i,e);else this.parent.setRecordValue("taskData",i,e);else this.parent.setRecordValue("taskData",i,e)},i.prototype.updateExpandStateMappingValue=function(e,i){var r,a=this.parent.taskFields.expandState,n=i[a];a&&e.hasChildRecords&&(t.isNullOrUndefined(n)?t.isNullOrUndefined(n)&&!this.parent.collapseAllParentTasks?r=!0:t.isNullOrUndefined(n)&&this.parent.collapseAllParentTasks&&(r=!1):r="true"===n.toString(),this.parent.setRecordValue("taskData."+a,r,e),this.parent.setRecordValue(a,r,e),this.parent.setRecordValue("expanded",r,e))},i.prototype.setValidatedDates=function(e,i){var r=e.ganttProperties,a=this.parent.taskFields,n=i[a.duration],s=this.getDateFromFormat(i[a.startDate],!0),o=this.getDateFromFormat(i[a.endDate],!0);n=t.isNullOrUndefined(n)||""===n?null:n,this.parent.setRecordValue("startDate",new Date(s.getTime()),r,!0),t.isNullOrUndefined(n)||""===n?this.calculateDuration(e):this.updateDurationValue(n,r),this.parent.setRecordValue("endDate",new Date(o.getTime()),r,!0)},i.prototype.calculateScheduledValues=function(e,i,r){var a=this.parent.taskFields,n=e.ganttProperties,s=i[a.duration];s=t.isNullOrUndefined(s)||""===s?null:s;var o,l;n.startDate&&n.endDate?(o=this.getDateFromFormat(n.startDate,!0),l=this.getDateFromFormat(n.endDate,!0)):(o=this.getDateFromFormat(i[a.startDate],!0),l=this.getDateFromFormat(i[a.endDate],!0));var d=a.segments?i[a.segments]||e.taskData[a.segments]:null,h=!!a.milestone&&!!i[a.milestone],p=i[a.durationUnit]?i[a.durationUnit]:"";this.parent.setRecordValue("durationUnit",this.validateDurationUnitMapping(p),n,!0);var c=t.isNullOrUndefined(i[a.work])?0:parseFloat(i[a.work]);this.parent.setRecordValue("workUnit",this.validateWorkUnitMapping(this.parent.workUnit),n,!0);var u=i[a.type]?i[a.type]:"",g=this.validateTaskTypeMapping(u);if(this.parent.setRecordValue("taskType",g,n,!0),r&&!this.parent.enableValidation&&o&&l)this.setValidatedDates(e,i);else if(l||o||!t.isNullOrUndefined(s)&&""!==s)o?this.calculateDateFromStartDate(o,l,s,e,r):l?this.calculateDateFromEndDate(l,s,e):t.isNullOrUndefined(s)||""===s||(this.updateDurationValue(s,n),this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("startDate",null,n,!0),this.parent.setRecordValue("endDate",null,n,!0)):(this.parent.setRecordValue("startDate",this.getProjectStartDate(n,r),n,!0),this.calculateEndDate(e)));else{if(this.parent.allowUnscheduledTasks)return;this.parent.setRecordValue("duration",1,n,!0),this.parent.setRecordValue("startDate",this.getProjectStartDate(n,r),n,!0),this.calculateEndDate(e)}if(this.parent.autoCalculateDateScheduling||(t.isNullOrUndefined(e.ganttProperties.startDate)||(e[this.parent.taskFields.startDate]=e.ganttProperties.startDate,e.taskData[this.parent.taskFields.startDate]=e.ganttProperties.startDate),t.isNullOrUndefined(e.ganttProperties.endDate)||(e[this.parent.taskFields.endDate]=e.ganttProperties.endDate,e.taskData[this.parent.taskFields.endDate]=e.ganttProperties.endDate)),t.isNullOrUndefined(d)||this.parent.setRecordValue("segments",this.setSegmentsInfo(e,!0),n,!0),0===n.duration&&(this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)),!t.isNullOrUndefined(h)&&h&&(this.parent.setRecordValue("duration",0,n,!0),this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)),t.isNullOrUndefined(a.work))a.type&&n.taskType&&this.parent.dataOperation.updateMappingData(e,"type");else{if(this.parent.setRecordValue("durationUnit",this.parent.durationUnit,n,!0),isNaN(c)||t.isNullOrUndefined(c))this.parent.setRecordValue("work",0,n,!0),this.parent.setRecordValue("duration",0,n,!0),this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0);else{switch(this.parent.setRecordValue("work",c,n,!0),g){case"FixedDuration":case"FixedWork":this.updateUnitWithWork(e);break;case"FixedUnit":this.updateDurationWithWork(e)}t.isNullOrUndefined(a.type)||this.parent.dataOperation.updateMappingData(e,"type"),0===n.duration?(this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)):t.isNullOrUndefined(n.startDate)||t.isNullOrUndefined(n.duration)||(this.parent.setRecordValue("isMilestone",!1,n,!0),this.calculateEndDate(e))}this.parent.dataOperation.updateMappingData(e,"work")}},i.prototype.updateDurationWithWork=function(e){var i=e.ganttProperties,r=i.resourceInfo;if(!t.isNullOrUndefined(r)){var a=t.isNullOrUndefined(r)?0:r.length,n=0,s=this.parent.secondsPerDay/3600,o=0,l=void 0,d=void 0;for(d=0;d<a;d++)n+=(l=r[d][this.parent.resourceFields.unit])>0?s*l/100:s;var h=this.getWorkInHour(i.work,i.workUnit);a>0&&(o+=h/n),"minute"===i.durationUnit&&(o=o*s*60),"hour"===i.durationUnit&&(o*=s),o%1!=0&&(o=parseFloat(o.toFixed(2))),t.isNullOrUndefined(i.duration)||this.parent.setRecordValue("duration",o,i,!0),this.parent.dataOperation.updateMappingData(e,"duration")}},i.prototype.updateUnitWithWork=function(e){var i=e.ganttProperties,r=i.resourceInfo,a=t.isNullOrUndefined(r)?0:r.length,n=this.parent.secondsPerDay/3600;if(0!==a){var s=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit),o=this.getWorkInHour(i.work,i.workUnit),l=s>0?o/(s*n)*100:0,d=l>0?l/a:100;d%1!=0&&(d=parseFloat(d.toFixed(2)));for(var h=0;h<a;h++)r[h][this.parent.resourceFields.unit]=d;this.updateResourceName(e)}},i.prototype.calculateDateFromEndDate=function(e,i,r){var a=r.ganttProperties;0===e.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,e);var n=0===parseInt(i,10)||null;this.parent.setRecordValue("endDate",this.checkEndDate(e,r.ganttProperties,n),a,!0),t.isNullOrUndefined(i)||""===i?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)):t.isNullOrUndefined(i)||""===i||(this.updateDurationValue(i,a),this.parent.setRecordValue("startDate",this.getStartDate(a.endDate,a.duration,a.durationUnit,a),a,!0))},i.prototype.calculateDateFromStartDate=function(e,i,r,a,n){var s=a.ganttProperties,o=!!(0===parseInt(r,10)||e&&i&&new Date(e.getTime())===new Date(i.getTime()))||null;this.parent.setRecordValue("startDate",this.checkStartDate(e,s,o,n),s,!0),this.parent.isTreeGridRendered&&a&&this.updateTaskData(a),i||!t.isNullOrUndefined(r)&&""!==r?(t.isNullOrUndefined(r)||i)&&i&&(t.isNullOrUndefined(r)||""===r)?(0===i.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,i),this.parent.setRecordValue("endDate",this.checkEndDate(i,a.ganttProperties),s,!0),1===this.compareDates(s.startDate,s.endDate)?(this.parent.setRecordValue("endDate",s.startDate,s,!0),this.parent.setRecordValue("isMilestone",!0,s,!0),this.parent.setRecordValue("duration",0,s,!0)):this.calculateDuration(a)):(this.updateDurationValue(r,s),this.calculateEndDate(a)):this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("endDate",null,s,!0),this.parent.setRecordValue("duration",null,s,!0)):(this.parent.setRecordValue("duration",1,s,!0),this.calculateEndDate(a))},i.prototype.getProgressWidth=function(e,t){return e*t/100},i.prototype.calculateWidth=function(e,i){var r=e.ganttProperties,a=i?r.autoStartDate:r.startDate,n=i?r.autoEndDate:r.endDate;return t.isNullOrUndefined(a)&&t.isNullOrUndefined(n)&&(a=this.getValidStartDate(r,i),n=this.getValidEndDate(r,i)),t.isNullOrUndefined(a)||t.isNullOrUndefined(n)?3:!r.isMilestone||e.hasChildRecords&&!r.isAutoSchedule?this.getTaskWidth(a,n,r):0},i.prototype.getTaskbarHeight=function(){var e=this.parent.rowHeight,t=this.parent.taskbarHeight;return t<e?t:e},i.prototype.calculateLeft=function(e,i){var r=null,a=-300,n=i?e.autoStartDate:e.startDate,s=i?e.autoEndDate:e.endDate,o=(i?e.autoDuration:e.duration,e.isMilestone);return n?r=new Date(n.getTime()):s?(r=new Date(s.getTime()),o=!t.isNullOrUndefined(n)||!this.parent.allowUnscheduledTasks):r=this.getValidStartDate(e),t.isNullOrUndefined(r)||(a=this.getTaskLeft(r,o)),a},i.prototype.calculateAutoLeft=function(e){return this.getTaskLeft(e.autoStartDate,e.isMilestone)},i.prototype.calculateAutoDuration=function(e){return this.getDuration(e.autoStartDate,e.autoEndDate,e.durationUnit,!1,e.isMilestone)},i.prototype.calculateAutoWidth=function(e){return this.getTaskWidth(e.autoStartDate,e.autoEndDate)},i.prototype.calculateBaselineLeft=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i?this.getTaskLeft(t,e.isMilestone):0},i.prototype.calculateBaselineWidth=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i&&t.getTime()!==i.getTime()?this.getTaskWidth(t,i):0},i.prototype.getTaskWidth=function(e,t,i){var r=new Date(e.getTime()),a=new Date(t.getTime()),n="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,s=!1,o=new Date(e.getTime()),l=0;i&&"hour"==i.durationUnit&&(o=new Date(o.getTime()+60*i.duration*60*1e3)),i&&"minute"==i.durationUnit&&(o=new Date(o.getTime()+60*i.duration*60*60*1e3));for(var d=0;d<this.parent.dayWorkingTime.length;d++)l=l+this.parent.dayWorkingTime[d].to-this.parent.dayWorkingTime[d].from;var h=o.getTime()-r.getTime();return"Day"===n?((Math.floor(h/36e5%24)>=l||0===h)&&(s=!0),this.getSecondsInDecimal(r)===this.parent.defaultStartTime&&s&&r.setHours(0,0,0,0),this.getSecondsInDecimal(a)===this.parent.defaultEndTime&&a.setHours(24),this.getSecondsInDecimal(a)===this.parent.defaultStartTime&&a.setHours(0,0,0,0)):s=!0,r.getTime()===a.getTime()?this.parent.perDayWidth:s?this.getTimeDifference(r,a)/864e5*this.parent.perDayWidth:this.getTimeDifference(r,a)/(36e5*l)*this.parent.perDayWidth},i.prototype.getTaskLeft=function(e,t){var i=new Date(e.getTime());"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(this.getSecondsInDecimal(i)===this.parent.defaultStartTime?i.setHours(0,0,0,0):t&&this.getSecondsInDecimal(i)===this.parent.defaultEndTime?i.setHours(24):this.getSecondsInDecimal(i)===this.parent.defaultEndTime&&this.parent.allowUnscheduledTasks&&i.setHours(22));var r=this.parent.timelineModule.timelineStartDate;return r?(i.getTime()-r.getTime())/864e5*this.parent.perDayWidth:0},i.prototype.getSplitTaskWidth=function(e,t,i){var r=new Date(e.getTime()),a=new Date(this.getEndDate(r,t,i.ganttProperties.durationUnit,i.ganttProperties,!1).getTime());return"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(this.getSecondsInDecimal(r)===this.parent.defaultStartTime&&r.setHours(0,0,0,0),this.getSecondsInDecimal(a)===this.parent.defaultEndTime&&a.setHours(24),this.getSecondsInDecimal(a)===this.parent.defaultStartTime&&a.setHours(0,0,0,0)),this.getTimeDifference(r,a)/864e5*this.parent.perDayWidth},i.prototype.getSplitTaskLeft=function(e,t){var i=new Date(e.getTime());return"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(this.getSecondsInDecimal(i)===this.parent.defaultStartTime&&i.setHours(0,0,0,0),this.getSecondsInDecimal(t)===this.parent.defaultStartTime&&t.setHours(0,0,0,0)),t?(i.getTime()-t.getTime())/864e5*this.parent.perDayWidth:0},i.prototype.updateMappingData=function(e,i){var r=this.parent.columnMapping,a=e.ganttProperties;if(!t.isNullOrUndefined(r[i])||"taskType"===i||"segments"===i)if("predecessorName"===i);else if("resourceInfo"===i){var n=a.resourceInfo,s=this.parent.resourceFields,o=[],l=[];if(!t.isNullOrUndefined(n))for(var d=0;d<n.length;d++){o.push(n[d][s.id]);var h=n[d][s.name],p=n[d][s.unit];100!==p&&(h+="["+p+"%]"),l.push(h)}this.parent.setRecordValue("resourceNames",l.join(","),a,!0),this.updateTaskDataResource(e),this.parent.setRecordValue(r[i],l.join(","),e)}else"startDate"===i||"endDate"===i?this.setRecordDate(e,a[i],r[i]):"duration"===i?this.setRecordDuration(e,r[i]):"work"===i?(this.parent.setRecordValue("taskData."+r[i],this.getWorkString(a.work,a.workUnit),e),this.parent.setRecordValue(r[i],a[i],e)):"type"===i?(this.parent.setRecordValue("taskData."+r[i],a[i],e),this.parent.setRecordValue(r[i],a[i],e)):"manual"===i?(this.parent.setRecordValue("taskData."+r[i],!a.isAutoSchedule,e),this.parent.setRecordValue(r[i],!a.isAutoSchedule,e)):"segments"===i?this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,this.segmentTaskData(e),e):(this.parent.setRecordValue("taskData."+r[i],a[i],e),this.parent.setRecordValue(r[i],a[i],e))},i.prototype.segmentTaskData=function(e){var i=e.ganttProperties.segments,r=this.parent.taskFields;if(t.isNullOrUndefined(i))return null;for(var a=t.extend([],[],e.taskData[r.segments],!0),n=0;n<i.length;n++)(this.parent.isEdit||this.parent.editModule&&this.parent.editModule.dialogModule&&t.getValue("isEdit",this.parent.editModule.dialogModule)||this.parent.contextMenuModule&&t.getValue("isEdit",this.parent.contextMenuModule))&&(a[n]={}),t.isNullOrUndefined(r.startDate)||(a[n][this.parent.taskFields.startDate]=i[n].startDate),t.isNullOrUndefined(r.endDate)||(a[n][this.parent.taskFields.endDate]=i[n].endDate),t.isNullOrUndefined(r.duration)||(a[n][this.parent.taskFields.duration]=Number(i[n].duration));return a},i.prototype.updateTaskDataResource=function(e){var i=e.ganttProperties.resourceInfo,r=e.taskData[this.parent.taskFields.resourceInfo],a=this.parent.resourceFields;if(t.isNullOrUndefined(r))e.taskData[this.parent.taskFields.resourceInfo]=i;else if(i.length){for(var n=0;n<i.length;n++){for(var s=!1,o=0;o<r.length;o++)if("number"==typeof r[o]||"string"==typeof r[o]){if(parseInt(r[o],10)===parseInt(i[n][a.id],10)){r[o]=i[n],s=!0;break}}else if(r[o][a.id]===i[n][a.id]&&"number"!=typeof r[o]){r[o]=t.extend({},r[o],i[n],!0),s=!0;break}s||r.push(i[n])}for(var l=[],d=function(e){i.filter(function(t){t[a.id]===r[e][a.id]&&-1===l.indexOf(r[e])&&l.push(r[e])})},h=0;h<r.length;h++)d(h);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,l,e)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],e)},i.prototype.setRecordDate=function(e,i,r){var a="string"==typeof i?new Date(i):i;t.isNullOrUndefined(i)||(i=new Date(a.getTime())),this.parent.setRecordValue(r,i,e),t.isNullOrUndefined(i)||(i=new Date(a.getTime())),this.parent.isLoad||this.parent.isDynamicData||this.parent.setRecordValue("taskData."+r,i,e),this.parent.isDynamicData=!1},i.prototype.getDurationInDay=function(e,t){return"day"===t?e:"hour"===t?e/(this.parent.secondsPerDay/3600):e/(this.parent.secondsPerDay/60)},i.prototype.setRecordDuration=function(e,i){var r=e.ganttProperties.duration,a=e.ganttProperties.durationUnit;if(t.isNullOrUndefined(r))this.parent.setRecordValue(i,r,e),this.parent.setRecordValue("taskData."+i,r,e);else{this.parent.setRecordValue(i,e.ganttProperties.duration,e);var n=t.getValue(i,e.taskData);isNaN(n)&&t.isNullOrUndefined(this.parent.taskFields.durationUnit)&&!t.isNullOrUndefined(n)?this.parent.setRecordValue("taskData."+i,this.getDurationString(r,a),e):"string"==typeof n?this.parent.setRecordValue("taskData."+i,r.toString(),e):this.parent.setRecordValue("taskData."+i,r,e)}this.parent.taskFields.durationUnit&&(e.taskData[this.parent.taskFields.durationUnit]=e.ganttProperties.durationUnit)},i.prototype.setDataSource=function(e){for(var i=[],r=e.length,a=0;a<r;a++){var n=e[a];i.push(n),t.isNullOrUndefined(e[a][this.parent.taskFields.child])||this.setDataSource(e[a][this.parent.taskFields.child])}return i},i.prototype.setStartDate=function(e){var i=this,r=[];r=t.isNullOrUndefined(this.parent.taskFields.parentID)||t.isNullOrUndefined(this.parent.taskFields.id)?this.parent.dataSource:this.setDataSource(this.parent.dataSource),this.parent.flatData.map(function(a){r.map(function(r){a.ganttProperties.taskId===r[i.parent.taskFields.id]&&(t.isNullOrUndefined(i.parent.taskFields.startDate)||(e[i.parent.taskFields.endDate]=r[i.parent.taskFields.endDate]),t.isNullOrUndefined(i.parent.taskFields.endDate)||(e[i.parent.taskFields.endDate]=r[i.parent.taskFields.endDate]))})})},i.prototype.getWorkInHour=function(e,t){return"day"===t?e*(this.parent.secondsPerDay/3600):"minute"===t?e/60:e},i.prototype.updateTaskData=function(e){var i=this.parent.taskFields,r=e.ganttProperties;if(!t.isNullOrUndefined(e.taskData)){var a=e.taskData;if(i.id&&(this.parent.setRecordValue("taskData."+i.id,r.taskId,e),this.parent.setRecordValue(i.id,r.taskId,e)),i.name&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.name,r.taskName,e),this.parent.setRecordValue(i.name,r.taskName,e)),i.startDate&&this.setRecordDate(e,r.startDate,i.startDate),i.endDate&&this.setRecordDate(e,r.endDate,i.endDate),i.duration&&this.setRecordDuration(e,i.duration),i.durationUnit&&(a[i.durationUnit]=r.durationUnit),i.progress&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.progress,r.progress,e),this.parent.setRecordValue(i.progress,r.progress,e)),i.baselineStartDate&&this.setRecordDate(e,r.baselineStartDate,i.baselineStartDate),i.baselineEndDate&&this.setRecordDate(e,r.baselineEndDate,i.baselineEndDate),i.notes&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.notes,r.notes,e),this.parent.setRecordValue(i.notes,r.notes,e)),i.cssClass&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.cssClass,r.cssClass,e),this.parent.setRecordValue(i.cssClass,r.cssClass,e)),i.indicators&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.indicators,r.indicators,e),this.parent.setRecordValue(i.indicators,r.indicators,e)),i.parentID){var n="ProjectView"===this.parent.viewType?r.parentId:a[i.parentID];this.parent.setRecordValue("taskData."+i.parentID,n,e),this.parent.setRecordValue(i.parentID,r.parentId,e)}i.work&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.work,this.getWorkString(r.work,r.workUnit),e),this.parent.setRecordValue(i.work,r.work,e)),i.type&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.type,r.taskType,e),this.parent.setRecordValue(i.type,r.taskType,e))}},i.prototype.setResourceInfo=function(e){var i;if(t.isNullOrUndefined(e[this.parent.taskFields.resourceInfo]))return i;i=e[this.parent.taskFields.resourceInfo];var r;r=t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.dialogModule)||!this.parent.editModule.dialogModule.isAddNewResource?this.parent.resources:this.parent.editModule.dialogModule.ganttResources;for(var a=this.parent.resourceFields.id,n=this.parent.resourceFields.unit,s=this.parent.resourceFields.group,o=[],l=function(e){var l=r.filter(function(t){return"object"==typeof i[e]&&i[e][a]===t[a]||i[e]===t[a]}),d=t.extend({},l[0]);o.push(d),t.isNullOrUndefined(n)||t.isNullOrUndefined(i[e][n])||(d[n]=i[e][n]),t.isNullOrUndefined(s)||t.isNullOrUndefined(i[e][s])||(d[s]=i[e][s])},d=0;d<i.length;d++)l(d);return this.updateResourceUnit(o),o},i.prototype.updateResourceUnit=function(e){var i=this.parent.resourceFields.unit;if(!t.isNullOrUndefined(i)){var r=e.length,a=void 0;for(a=0;a<r;a++)t.isNullOrUndefined(e[a][i])&&(e[a][i]=100)}},i.prototype.updateResourceName=function(e){var i=e.ganttProperties.resourceInfo,r=[],a=this.parent.taskFields;if(i){var n=i.length,s=t.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=i[o],d=l[this.parent.resourceFields.name],h=l[this.parent.resourceFields.unit];if(100!==h&&(d+="["+h+"%]"),t.isNullOrUndefined(d)||r.push(d),e.taskData){var p=a.resourceInfo;s[o],e.taskData[p].push(s[o])}}this.parent.setRecordValue("resourceNames",r.join(","),e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,r.join(","),e,!0),this.updateTaskDataResource(e)}},i.prototype.dataReorder=function(e,t){for(var i=[];e.length>0&&t.length>0;){var r=t.indexOf(e[0]);-1===r?e.shift():(i.push(e.shift()),t.splice(r,1))}return i},i.prototype.validateDurationUnitMapping=function(e){var t=e;return t="minute"===t||"minutes"===t||"m"===t||"min"===t?"minute":"hour"===t||"hours"===t||"h"===t||"hr"===t?"hour":"day"===t||"days"===t||"d"===t?"day":this.parent.durationUnit.toLocaleLowerCase()},i.prototype.validateTaskTypeMapping=function(e){var t=e;return t="FixedDuration"===t?"FixedDuration":"FixedUnit"===t?"FixedUnit":"FixedWork"===t?"FixedWork":this.parent.taskType},i.prototype.validateWorkUnitMapping=function(e){var t=e;return t="minute"===t?"minute":"hour"===t?"hour":"day"===t?"day":this.parent.workUnit.toLocaleLowerCase()},i.prototype.updateDurationValue=function(e,i){var r=this.getDurationValue(e);isNaN(t.getValue("duration",r))||this.parent.setRecordValue("duration",t.getValue("duration",r),i,!0),t.isNullOrUndefined(t.getValue("durationUnit",r))||this.parent.setRecordValue("durationUnit",t.getValue("durationUnit",r),i,!0)},i.prototype.reUpdateGanttData=function(){if(this.parent.flatData.length>0){var e=void 0,i=void 0;this.parent.secondsPerDay=this.getSecondsPerDay();for(var r=0;r<this.parent.flatData.length;r++)e=this.parent.flatData[r].taskData,i=this.parent.flatData[r],t.isNullOrUndefined(this.parent.taskFields.duration)||this.setRecordDuration(i,this.parent.taskFields.duration),this.parent.isLoad&&this.setStartDate(i),this.calculateScheduledValues(i,e,!1);this.updateGanttData()}},i.prototype._isInStartDateRange=function(e,t,i){var r=!1;return e.getTime()>=t.getTime()&&e.getTime()<i.getTime()&&(r=!0),r},i.prototype._isInEndDateRange=function(e,t,i){var r=!1;return e.getTime()>t.getTime()&&e.getTime()<=i.getTime()&&(r=!0),r},i.prototype.updateOverlappingValues=function(e){var t,i=e.childRecords,r=[];if(i.length<=1)e.ganttProperties.workTimelineRanges=[];else{i=this.setSortedChildTasks(e),this.updateOverlappingIndex(i);for(var a=1;a<i.length;a++){t=i[a];for(var n=new Date(t.ganttProperties.startDate.getTime()),s=new Date(t.ganttProperties.endDate.getTime()),o=[],l=0;l<a;l++){var d=i[l].ganttProperties.startDate,h=i[l].ganttProperties.endDate,p={};(this._isInStartDateRange(n,d,h)||this._isInEndDateRange(s,d,h))&&(d.getTime()>n.getTime()&&d.getTime()<s.getTime()&&h.getTime()>n.getTime()&&h.getTime()>=s.getTime()||n.getTime()===d.getTime()&&s.getTime()<=h.getTime()?(p.from=d,p.to=s):n.getTime()===d.getTime()&&s.getTime()>h.getTime()?(p.from=d,p.to=h):n.getTime()>d.getTime()&&s.getTime()>=h.getTime()?(p.from=n,p.to=h):n.getTime()>d.getTime()&&s.getTime()<h.getTime()&&(p.from=n,p.to=s),o.push(p))}r.push.apply(r,this.mergeRangeCollections(o))}this.parent.setRecordValue("workTimelineRanges",this.mergeRangeCollections(r,!0),e.ganttProperties,!0),this.calculateRangeLeftWidth(e.ganttProperties.workTimelineRanges)}},i.prototype.updateOverlappingIndex=function(e){for(var t=0;t<e.length;t++)e[t].ganttProperties.eOverlapIndex=t},i.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)},i.prototype.mergeRangeCollections=function(e,t){for(var i,r,n,s,o=[],l={},d={},h=new a.DataManager(e).executeLocal((new a.Query).sortBy(this.parent.taskFields.startDate,"Ascending")),p=0;p<h.length;p++)0!==o.length||0!==p?(i=(l=o[o.length-1]).from,r=l.to,n=(d=h[p]).from,s=d.to,i.getTime()===n.getTime()&&r.getTime()>=s.getTime()||i.getTime()<n.getTime()&&r.getTime()>=s.getTime()||(i.getTime()<=n.getTime()&&r.getTime()>=n.getTime()&&r.getTime()<s.getTime()||r.getTime()<n.getTime()&&this.checkStartDate(r).getTime()===n.getTime()?l.to=s:r.getTime()<n.getTime()&&this.checkStartDate(r).getTime()!==n.getTime()&&o.push(h[p]))):o.push(h[p]);return t&&(o=this.splitRangeCollection(o)),o},i.prototype.setSortedChildTasks=function(e){return new a.DataManager(e.childRecords).executeLocal((new a.Query).sortBy(this.parent.taskFields.startDate,"Ascending"))},i.prototype.splitRangeCollection=function(e,t,i){var r;return r=this.parent.timelineModule.isSingleTier?"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier,"Week"===r||"Month"===r||"Year"===r?e:"Day"===r?this.getRangeWithWeek(e,t,i):0===this.parent.workingTimeRanges[0].from&&86400===this.parent.workingTimeRanges[0].to?this.getRangeWithWeek(e,t,i):this.getRangeWithDay(e,t,i)},i.prototype.getRangeWithDay=function(e,t,i){for(var r=[],a=0;a<e.length;a++)r.push.apply(r,this.splitRangeForDayMode(e[a],t,i));return r},i.prototype.splitRangeForDayMode=function(e,i,r){var a=i||"from",n=r||"to",s=new Date(e[a]),o=new Date(e[n]),l=[],d={};if(s.getTime()<o.getTime())do{for(var h=new Date(s.getTime()),p=new Date(s.getTime()),c=0,u=this.parent.dataOperation.getSecondsInDecimal(s),g=-1,f=0;f<this.parent.workingTimeRanges.length;f++){var m=this.parent.workingTimeRanges[f];if(u>=m.from&&u<=m.to){g=f;break}}-1!==g&&(c=Math.round(this.parent.workingTimeRanges[g].to-u),p.setSeconds(p.getSeconds()+c));p.getTime()<o.getTime()?(d={},e.task&&(d.task=t.extend([],e.task)),d[a]=h,d[n]=p,d.isSplit=!0,l.push(d)):(d={},e.task&&(d.task=t.extend([],e.task)),d[a]=h,d[n]=o,d.isSplit=!0,l.push(d)),s=this.checkStartDate(p)}while(s.getTime()<o.getTime());else l.push(e);return l},i.prototype.getRangeWithWeek=function(e,t,i){for(var r=[],a=0;a<e.length;a++)r.push.apply(r,this.splitRangeForWeekMode(e[a],t,i));return r},i.prototype.splitRangeForWeekMode=function(e,i,r){var a=i||"from",n=r||"to",s=new Date(e[a]),o=new Date(e[a]),l=new Date(e[n]),d=!1,h=[],p={};if(o.setDate(o.getDate()+1),o.getTime()<l.getTime()){do{if(this.parent.dataOperation.isOnHolidayOrWeekEnd(o,null)){var c=new Date(o.getTime());c.setDate(o.getDate()-1),this.setTime(this.parent.defaultEndTime,c),(p={})[a]=s,p.isSplit=!0,p[n]=c,e.task&&(p.task=t.extend([],e.task,!0)),s.getTime()!==c.getTime()&&h.push(p),s=this.checkStartDate(c),o=new Date(s.getTime()),d=!0}else o.setDate(o.getDate()+1)}while(o.getTime()<l.getTime());d?s.getTime()!==l.getTime()&&(p={},e.task&&(p.task=t.extend([],e.task,!0)),p[a]=s,p[n]=l,p.isSplit=!0,h.push(p)):h.push(e)}else h.push(e);return h},i.prototype.updateGanttData=function(){for(var e=this.parent.flatData,t=e.length,i=0;i<t;i++){var r=e[i];this.updateTaskLeftWidth(r)}},i.prototype.updateTaskLeftWidth=function(e){var t=e.ganttProperties;e.hasChildRecords&&this.parent.autoCalculateDateScheduling||this.updateWidthLeft(e),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(t),t,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(t),t,!0);var i,r=[];e.parentItem&&(r=(i=this.parent.getParentTask(e.parentItem)).childRecords),i&&r.indexOf(e)===r.length-1&&!e.hasChildRecords&&this.parent.enableValidation?((this.parent.autoCalculateDateScheduling||"ResourceView"===this.parent.viewType)&&this.updateParentItems(i),this.parent.autoCalculateDateScheduling||this.updateWidthLeft(i)):i&&!this.parent.enableValidation&&this.updateWidthLeft(i)},i.prototype.reUpdateGanttDataPosition=function(){for(var e=this.parent.flatData,t=e.length,i=0;i<t;i++){var r=e[i],a=r.ganttProperties;this.updateWidthLeft(r),"Auto"!==this.parent.taskMode&&r.hasChildRecords&&this.updateAutoWidthLeft(r),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(a),a,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(a),a,!0),this.parent.dataOperation.updateTaskData(r)}},i.prototype.updateWidthLeft=function(e){var i=e.ganttProperties;if(!t.isNullOrUndefined(i.segments)&&i.segments.length>0){for(var r=i.segments,a=!0,n=this.splitTasksDuration(r)*("Hour"===this.parent.timelineModule.bottomTier||"Minutes"===this.parent.timelineModule.bottomTier?this.parent.timelineSettings.timelineUnitSize:this.parent.perDayWidth),s=this.parent.dataOperation.getProgressWidth(n,i.progress),o=0;o<r.length;o++){var l=r[o];if(0===o&&!t.isNullOrUndefined(i.startDate)&&l.startDate.getTime()!==i.startDate.getTime()){l.startDate=i.startDate;var d=this.parent.dataOperation.getEndDate(l.startDate,l.duration,i.durationUnit,i,!1);l.endDate=this.parent.dataOperation.checkEndDate(d,i,!1),this.parent.chartRowsModule.incrementSegments(r,0,e)}if(l.width=this.getSplitTaskWidth(l.startDate,l.duration,e),l.showProgress=!1,l.progressWidth=-1,0!==o){var h=new Date(i.startDate.getTime());l.left=this.getSplitTaskLeft(l.startDate,h)}s>0&&s>l.width?(s-=l.width,l.progressWidth=l.width,l.showProgress=!1):a&&(l.progressWidth=s,l.showProgress=!0,s-=l.width,a=!1)}this.parent.setRecordValue("segments",i.segments,i,!0),this.parent.dataOperation.updateMappingData(e,"segments")}this.parent.setRecordValue("width",this.parent.dataOperation.calculateWidth(e),i,!0),this.parent.setRecordValue("left",this.parent.dataOperation.calculateLeft(i),i,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.isAutoSchedule||!e.hasChildRecords?i.width:i.autoWidth,i.progress),i,!0)},i.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,!0),t,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.isAutoSchedule||!e.hasChildRecords?t.width:t.autoWidth,t.progress),t,!0)},i.prototype.getParentProgress=function(e){var i=0,r={};switch(e.ganttProperties.durationUnit){case"hour":i=e.ganttProperties.duration/(this.parent.secondsPerDay/3600);break;case"minute":i=e.ganttProperties.duration/(this.parent.secondsPerDay/60);break;default:i=e.ganttProperties.duration}return e.hasChildRecords?(t.setValue("totalProgress",e.ganttProperties.totalProgress,r),t.setValue("totalDuration",e.ganttProperties.totalDuration?e.ganttProperties.totalDuration:0,r)):(t.setValue("totalProgress",e.ganttProperties.progress*i,r),t.setValue("totalDuration",i,r)),r},i.prototype.resetDependency=function(e){var i=this.parent.taskFields.dependency;if(!t.isNullOrUndefined(i)){var r=e.ganttProperties;this.parent.setRecordValue("predecessor",[],r,!0),this.parent.setRecordValue("predecessorsName",null,r,!0),this.parent.setRecordValue("taskData."+i,null,e),this.parent.setRecordValue(i,null,e)}},i.prototype.updateParentItems=function(e,i){var r=i?e:this.parent.getParentTask(e),a=!1,n=r.ganttProperties;if(this.parent.autoCalculateDateScheduling||"ResourceView"===this.parent.viewType){if(r.childRecords.length>0){for(var s=n.isAutoSchedule?n.startDate:n.autoStartDate,o=n.isAutoSchedule?n.endDate:n.autoEndDate,l=r.childRecords,d=l.length,h=0,p={},c=null,u=null,g=0,f=0,y=0,D=void 0,v=0;v<d;v++)if(D=l[v],this.parent.isOnDelete&&D.isDelete)1===d&&"ProjectView"===this.parent.viewType&&(a=!0);else{var w=this.getValidStartDate(D.ganttProperties);!r.hasChildRecords||n.isAutoSchedule||t.isNullOrUndefined(D.ganttProperties.autoStartDate)||(w=D.ganttProperties.autoStartDate);var k=this.getValidEndDate(D.ganttProperties);!r.hasChildRecords||n.isAutoSchedule||t.isNullOrUndefined(D.ganttProperties.autoEndDate)||(k=D.ganttProperties.autoEndDate),t.isNullOrUndefined(c)&&(c=this.getDateFromFormat(w)),t.isNullOrUndefined(u)&&(u=this.getDateFromFormat(k)),t.isNullOrUndefined(k)||1!==this.compareDates(k,u)||(u=this.getDateFromFormat(k)),t.isNullOrUndefined(w)||-1!==this.compareDates(w,c)||(c=this.getDateFromFormat(w)),!D.ganttProperties.isMilestone&&m(D.ganttProperties)?(p=this.getParentProgress(D),f+=t.getValue("totalProgress",p),D[this.parent.taskFields.duration]<1?(h+=t.getValue("totalDuration",p),h=Number(h.toFixed(4))):h+=t.getValue("totalDuration",p)):g++,y+=D.ganttProperties.work}if(!a){var T=void 0,b=(T=this.parent.isOnDelete&&D.isDelete?d-g-1:d-g)>0&&h>0?Number((f/h).toFixed(2)):0,P=r.ganttProperties,S=!(0!==T||!c||!u||c.getTime()!==u.getTime());0!==this.compareDates(s,c)&&(this.parent.setRecordValue(n.isAutoSchedule?"startDate":"autoStartDate",c,r.ganttProperties,!0),(t.isNullOrUndefined(n.autoDuration)?0===n.duration:0===n.autoDuration)&&r.isManual&&S&&r.hasChildRecords&&r.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("startDate",c,r.ganttProperties,!0)),0!==this.compareDates(o,u)&&(this.parent.setRecordValue(n.isAutoSchedule?"endDate":"autoEndDate",u,r.ganttProperties,!0),(t.isNullOrUndefined(n.autoDuration)?0===n.duration:0===n.autoDuration)&&r.isManual&&S&&r.hasChildRecords&&r.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("endDate",u,r.ganttProperties,!0)),this.parent.setRecordValue("isMilestone",S,P,!0),t.isNullOrUndefined(this.parent.taskFields.milestone)||this.updateMappingData(r,"milestone"),P.isAutoSchedule&&this.calculateDuration(r),this.updateWorkWithDuration(r);var C=P.work;C=this.parent.isOnEdit?C:C+y,this.parent.setRecordValue("work",C,P,!0),this.parent.setRecordValue("taskType","FixedDuration",P,!0),t.isNullOrUndefined(this.parent.taskFields.type)||this.updateMappingData(r,"type"),this.parent.setRecordValue("progress",Math.floor(b),P,!0),this.parent.setRecordValue("totalProgress",f,P,!0),this.parent.setRecordValue("totalDuration",h,P,!0),P.isAutoSchedule||(this.parent.setRecordValue("autoDuration",this.calculateAutoDuration(P),P,!0),this.updateAutoWidthLeft(r)),this.parent.allowParentDependency||this.resetDependency(r),this.updateWidthLeft(r),this.updateTaskData(r)}}}else r.ganttProperties.endDate=r.taskData[this.parent.taskFields.endDate];a&&1===r.childRecords.length&&0===r.ganttProperties.duration&&(this.parent.setRecordValue("isMilestone",!0,r.ganttProperties,!0),this.updateWidthLeft(r),this.updateTaskData(r));var M=this.parent.getParentTask(r.parentItem);M&&(this.parent.autoCalculateDateScheduling||"ResourceView"===this.parent.viewType)&&this.updateParentItems(M),a=!1},i}(R),I="e-chart-root-container",E="e-chart-rows-container",N="e-timeline-header-container",F="e-timeline-header-table-container",U="e-timeline-single-header-outer-div",V="e-left-label-container",L="e-left-label-inner-div",B="e-right-label-container",A="e-right-label-inner-div",H="e-taskbar-main-container",j="e-task-label",W="e-gantt-child-taskbar-inner-div",q="e-gantt-child-progressbar-inner-div",G="e-gantt-child-critical-taskbar-inner-div",z="e-gantt-child-critical-progressbar-inner-div",_="e-critical-milestone",X="e-baseline-bar",Y="e-baseline-gantt-milestone-container",Z="e-chart-row-cell",Q="e-chart-row",K="e-taskbar-left-resizer",J="e-taskbar-right-resizer",$="e-child-progress-resizer",ee="e-progressbar-handler",te="e-progressbar-handler-element",ie="e-progressbar-handler-after",re="e-gantt-milestone",ae="e-gantt-child-taskbar",ne="e-gantt-child-progressbar",se="e-manualparent-main-container",oe="e-gantt-manualparenttaskbar",le="e-gantt-manualparent-milestone",de="e-gantt-child-manualtaskbar",he="e-gantt-manualparenttaskbar-right",pe="e-gantt-parent-taskbar",ce="e-gantt-parent-progressbar",ue="e-gantt-unscheduled-task",ge="e-left-resize-gripper",fe="e-right-resize-gripper",me="e-progress-resize-gripper",ye="e-label",De="e-gantt-unscheduled-taskbar-left",ve="e-gantt-unscheduled-taskbar-right",we="e-gantt-dependency-view-container",ke="e-connector-line-container",Te="e-connector-line",be="e-critical-line",Pe="e-critical-line-arrow",Se="e-connector-line-arrow",Ce="e-connector-line-z-index",Me="e-connectorpoint-left",Re="e-connectorpoint-right",Oe="e-connectorpoint-left-hover",xe="e-connectorpoint-right-hover",Ie="e-right-connectorpoint-outer-div",Ee="e-connectorpoint-allow-block",Ne=".e-content",Fe="e-active-parent-task",Ue="e-active-child-task",Ve="e-active-connected-task",Le="e-predecessor-touch-mode",Be="e-rangecontainer",Ae=function(){function e(e){this.previousScroll={top:0,left:0},this.parent=e,this.element=this.parent.ganttChartModule.scrollElement,this.addEventListeners()}return e.prototype.addEventListeners=function(){this.parent.on("grid-scroll",this.gridScrollHandler,this),t.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)},e.prototype.removeEventListeners=function(){t.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)},e.prototype.gridScrollHandler=function(e){this.element.scrollTop=t.getValue("top",e),this.isFromTreeGrid=!0},e.prototype.updateTopPosition=function(){var e,i=this.parent.treeGrid.element.querySelector(".e-content").scrollTop;if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){e=i-this.parent.virtualScrollModule.getTopPosition()}else e=i;if(!t.isNullOrUndefined(this.parent.dayMarkersModule)){var r=t.getValue("nonworkingDayRender.holidayContainer",this.parent.dayMarkersModule),a=t.getValue("nonworkingDayRender.weekendContainer",this.parent.dayMarkersModule),n=t.getValue("eventMarkerRender.eventMarkersContainer",this.parent.dayMarkersModule);r&&(r.style.top=t.formatUnit(e)),a&&(a.style.top=t.formatUnit(e)),n&&(n.style.top=t.formatUnit(e))}this.parent.chartVerticalLineContainer&&(this.parent.chartVerticalLineContainer.style.top=t.formatUnit(e))},e.prototype.removeShimmer=function(){var e=this.parent;setTimeout(function(){if(e.hideMaskRow(),"ResourceView"===e.viewType&&!e.allowTaskbarOverlap&&e.showOverAllocation){for(var t=0;t<e.currentViewData.length;t++){var i=e.chartRowsModule.ganttChartTableBody.childNodes[t];"none"!==i.style.display&&e.currentViewData[t].hasChildRecords&&!e.currentViewData[t].expanded&&(e.treeGrid.getRowByIndex(t).style.height=i.style.height)}e.contentHeight=e.enableRtl?e.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:e.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=e.contentHeight+"px"}},0)},e.prototype.updateShimmer=function(){var e=this.parent;setTimeout(function(){e.showMaskRow()},0)},e.prototype.updateSpinner=function(){var e=this.parent;this.parent.showSpinner(),window.clearTimeout(this.isScrolling),this.isScrolling=setTimeout(function(){e.hideSpinner()},200)},e.prototype.onScroll=function(){var e={};this.element.scrollTop!==this.previousScroll.top&&(this.isFromTreeGrid?this.isFromTreeGrid=!1:this.parent.notify("chartScroll",{top:this.element.scrollTop}),e.previousScrollTop=this.previousScroll.top,this.previousScroll.top=this.element.scrollTop,e.scrollTop=this.element.scrollTop,e.scrollDirection="Vertical",e.action="VerticalScroll",this.updateTopPosition()),this.element.scrollLeft!==this.previousScroll.left&&(this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,e.previousScrollLeft=this.previousScroll.left,this.previousScroll.left=this.element.scrollLeft,e.scrollLeft=this.element.scrollLeft,e.scrollDirection="Horizontal",e.action="HorizontalScroll"),"Horizontal"===e.scrollDirection||t.isNullOrUndefined(e.scrollDirection)||!0!==this.parent.enableVirtualization||!this.parent.isToolBarClick&&!t.isNullOrUndefined(this.parent.isToolBarClick)||(this.parent.isVirtualScroll=!0,(this.parent.showIndicator||t.isNullOrUndefined(this.parent.showIndicator))&&!this.parent.enableVirtualMaskRow&&this.parent.enableVirtualization&&"Spinner"===this.parent.loadingIndicator.indicatorType&&this.updateSpinner()),this.parent.isToolBarClick=!0,e.requestType="scroll",this.parent.trigger("actionComplete",e)},e.prototype.setHeight=function(e){this.element.style.height=t.formatUnit(e)},e.prototype.setWidth=function(e){this.element.style.width=t.formatUnit(e)},e.prototype.setScrollTop=function(e){this.element.scrollTop=e,this.parent.treeGrid.element.querySelector(".e-content").scrollTop=e},e.prototype.setScrollLeft=function(e,t){t&&(e=-1===t&&this.parent.enableRtl?-e:e),this.element.scrollLeft=e,this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,this.previousScroll.left=this.element.scrollLeft},e.prototype.destroy=function(){this.removeEventListeners()},e}(),He=function(){function e(e){this.parent=e}return e.prototype.renderWrapper=function(){this.wrapper=t.createElement("div",{className:"e-virtualtable",styles:"position: absolute; transform: translate(0px, 0px);"}),this.parent.ganttChartModule.scrollElement.appendChild(this.wrapper),this.virtualTrack=t.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)},e.prototype.appendChildElements=function(e){this.wrapper.appendChild(e)},e.prototype.adjustTable=function(){var e=this.parent.treeGrid.getContent().querySelector(".e-content").querySelector(".e-virtualtable");this.parent.ganttChartModule.virtualRender.wrapper.style.transform=e.style.transform},e}(),je=function(){function e(e){this.isExpandCollapseFromChart=!1,this.isExpandAll=!1,this.isGanttElement=!1,this.parent=e,this.chartTimelineContainer=null,this.rangeViewContainer=t.createElement("div",{className:Be}),this.rangeViewContainer.setAttribute("role","RangeContainer"),this.virtualRender=new He(this.parent),this.addEventListener()}return e.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)},e.prototype.renderChartContents=function(){this.parent.notify("refreshDayMarkers",{}),this.wireEvents()},e.prototype.renderChartContainer=function(){this.chartElement=t.createElement("div",{id:this.parent.element.id+"GanttChart",className:"e-gantt-chart"}),this.parent.chartPane.appendChild(this.chartElement),this.renderTimelineContainer(),this.renderBodyContainers()},e.prototype.renderInitialContents=function(){this.parent.timelineModule.createTimelineSeries()},e.prototype.renderOverAllocationContainer=function(){for(var e=0;e<this.parent.flatData.length;e++){var t=this.parent.flatData[e];t.childRecords.length>0&&this.parent.dataOperation.updateOverlappingValues(t)}var i=this.parent.element.querySelector("."+Be);i&&(i.innerHTML=""),0===this.parent.treeGrid.grid.filterSettings.columns.length&&this.renderRangeContainer(this.parent.currentViewData)},e.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=0;e<this.parent.chartRowsModule.ganttChartTableBody.children.length;e++)this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[4]?(this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[1].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[2].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[4].setAttribute("tabindex","-1")):"ProjectView"===this.parent.viewType?t.isNullOrUndefined(this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(e.toString(),10)].children[0].children[1].children[1])||this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[1].setAttribute("tabindex","-1"):this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(e.toString(),10)].children[0].children[1].children[0]&&this.parent.chartRowsModule.ganttChartTableBody.children[e].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),"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&this.renderOverAllocationContainer()}this.updateWidthAndHeight(),this.parent.notify("selectRowByIndex",{})},e.prototype.renderRangeContainer=function(e){var t,i,r,a=e.length;if(0===this.parent.treeGrid.grid.filterSettings.columns.length)for(t=0;t<a;t++)(r=(i=e[t]).ganttProperties.workTimelineRanges)&&this.renderRange(r,i)},e.prototype.getTopValue=function(e){var t=this.parent.getExpandedRecords(this.parent.currentViewData).indexOf(e);return e.expanded?(t+1)*this.parent.rowHeight:t*this.parent.rowHeight},e.prototype.getRangeHeight=function(e){return!e.expanded&&e.hasChildRecords?this.parent.rowHeight-Math.floor(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight):e.childRecords.length*this.parent.rowHeight-Math.floor(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)},e.prototype.renderRange=function(e,i){var r=0,a=this.parent.currentViewData.indexOf(i);r=!this.parent.allowTaskbarOverlap&&this.parent.enableMultiTaskbar?i.expanded?this.parent.getRowByIndex(a).offsetTop+this.parent.rowHeight:this.parent.getRowByIndex(a).offsetTop:this.getTopValue(i);var n=this.rangeViewContainer.querySelector(".rangeContainer"+i.ganttProperties.rowUniqueID);n&&n.remove();var s=t.createElement("div",{className:"rangeContainer"+i.ganttProperties.rowUniqueID,styles:"top:"+r+"px; position: absolute;"});if(0!==i.level||i.expanded||!t.isNullOrUndefined(i.parentItem)||this.parent.enableMultiTaskbar){for(var o=0;o<e.length;o++){var l=void 0;l=this.parent.allowTaskbarOverlap||i.expanded||!this.parent.enableMultiTaskbar?this.getRangeHeight(i):parseInt(this.parent.chartRowsModule.ganttChartTableBody.childNodes[a].style.height)-(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight);var d=t.createElement("div",{className:"e-rg-rangdiv e-leftarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[o].left+e[o].width-5:e[o].left)+"px;\n top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px;\n height: "+(l+1)+"px; border-right: 0px"}),h=t.createElement("div",{className:"e-rg-rangdiv e-rightarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[o].left:e[o].left+e[o].width-5)+"px;\n top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px; height: "+(l+1)+"px;\n border-left: 0px"});s.appendChild(d),s.appendChild(h),this.rangeViewContainer.appendChild(s)}this.parent.ganttChartModule.chartBodyContent.appendChild(this.rangeViewContainer)}},e.prototype.renderTimelineContainer=function(){this.chartTimelineContainer=t.createElement("div",{className:N}),this.parent.enableRtl&&(this.chartTimelineContainer.style.borderLeftWidth="1px",this.chartTimelineContainer.style.borderRightWidth="0px"),this.chartTimelineContainer.setAttribute("role","presentation"),this.chartElement.appendChild(this.chartTimelineContainer)},e.prototype.renderBodyContainers=function(){this.chartBodyContainer=t.createElement("div",{className:I}),this.chartElement.appendChild(this.chartBodyContainer),this.scrollElement=t.createElement("div",{className:"e-chart-scroll-container e-content",styles:"position:relative;"}),this.chartBodyContainer.appendChild(this.scrollElement),this.chartBodyContent=t.createElement("div",{className:E,styles:"position:relative; overflow:hidden "}),this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.ganttChartModule.virtualRender.renderWrapper():this.scrollElement.appendChild(this.chartBodyContent),this.scrollObject=new Ae(this.parent);var e=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(e=this.parent.toolbarModule.element.offsetHeight),this.scrollObject.setHeight(this.parent.ganttHeight-this.chartTimelineContainer.offsetHeight-e)},e.prototype.updateWidthAndHeight=function(){var e=0===this.parent.contentHeight?this.parent.flatData.length>1?36:0:this.parent.contentHeight,i=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0];if(e>=i.offsetHeight||"auto"===this.parent.height)this.chartBodyContent.style.height=t.formatUnit(e);else{var r=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;i.offsetHeight>=r?this.chartBodyContent.style.height=i.offsetHeight-17+"px":this.chartBodyContent.style.height=i.offsetHeight+"px"}this.chartBodyContent.style.width=t.formatUnit(this.parent.timelineModule.totalTimelineWidth),this.setVirtualHeight(),this.parent.notify("updateHeight",{}),this.parent.updateGridLineContainerHeight(),this.updateLastRowBottomWidth()},e.prototype.setVirtualHeight=function(){if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){t.getValue("virtualTrack",this.parent.ganttChartModule.virtualRender).style.height=this.parent.treeGrid.element.getElementsByClassName("e-virtualtrack")[0].style.height;var e=t.getValue("wrapper",this.parent.ganttChartModule.virtualRender),i=this.parent.treeGrid.element.getElementsByClassName("e-virtualtable")[0].style.transform;e.style.transform=i}},e.prototype.updateLastRowBottomWidth=function(){if(this.parent.currentViewData.length>0&&"auto"!==this.parent.height){var e=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.getExpandedRecords(this.parent.currentViewData),i=e[e.length-1],r=this.parent.currentViewData.indexOf(i),a=this.parent.getRowByIndex(r),n=this.parent.chartRowsModule.ganttChartTableBody;if(n.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow")&&t.removeClass(n.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow"),"e-lastrow"),this.chartBodyContent.clientHeight<this.chartBodyContainer.clientHeight&&a){t.addClass(a.querySelectorAll("td"),"e-lastrow");var s=0===this.parent.contentHeight?this.parent.flatData.length>1?36:0:this.parent.contentHeight,o=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0];if(s>=o.offsetHeight)this.chartBodyContent.style.height=t.formatUnit(s);else{var l=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;o.offsetHeight>=l?this.chartBodyContent.style.height=o.offsetHeight-17+"px":this.chartBodyContent.style.height=o.offsetHeight+"px"}}}},e.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))},e.prototype.ganttChartMouseDown=function(e){3!==e.which&&this.parent.editSettings.allowTaskbarEditing&&(this.parent.notify("chartMouseDown",e),this.parent.element.tabIndex=0),this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.endEdit()},e.prototype.ganttChartMouseClick=function(e){this.parent.autoFocusTasks&&this.scrollToTarget(e),this.parent.notify("chartMouseClick",e)},e.prototype.ganttChartMouseUp=function(e){this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseUp",e)},e.prototype.scrollToTarget=function(e){var i=t.closest(e.target,"tr");if(i&&this.parent.element.contains(i)&&(this.parent.element.querySelectorAll(".e-chart-rows-container")[0].contains(e.target)||this.parent.element.querySelectorAll(".e-gridcontent")[0].contains(e.target))&&this.parent.currentViewData.length>0){var r=t.getValue("rowIndex",t.closest(e.target,"tr")),a=this.parent.currentViewData[r].ganttProperties.startDate;if(!t.isNullOrUndefined(a)){var n=this.parent.dataOperation.getTaskLeft(a,!1);this.parent.autoFocusTasks&&this.updateScrollLeft(n)}}},e.prototype.updateScrollLeft=function(e){e=e>0?e:0,e=this.scrollElement.scrollWidth<=e?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)},e.prototype.mouseUp=function(e){if(t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)||this.parent.editModule.taskbarEditModule.removeFalseLine(!1),this.parent.allowRowDragAndDrop){var i=this.parent.element.querySelector(".e-ganttdrag");i&&i.remove()}this.isGanttElement||this.parent.notify("chartMouseUp",e),this.isGanttElement=!1},e.prototype.documentMouseUp=function(e){if(this.isGanttElement=!0,(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse"))&&!0===t.getValue("isEditCollapse",this.parent.treeGrid)&&t.setValue("isEditCollapse",!1,this.parent.treeGrid),this.parent.allowRowDragAndDrop){var i=this.parent.element.querySelector(".e-ganttdrag");i&&i.remove()}if(!this.parent.isDestroyed&&3!==e.which){var r=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");t.isNullOrUndefined(r)||r.remove();var a=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar");if(!t.isNullOrUndefined(a)){a.parentElement.parentElement.remove()}var n=!1;if(this.parent.editSettings.allowTaskbarEditing&&t.getValue("editModule.taskbarEditModule.isMouseDragged",this.parent)&&t.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)&&(n=!0),this.parent.notify("chartMouseUp",e),this.parent.showActiveElement&&(this.parent.showIndicator=!0,t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.focusedElement&&!e.target.classList.contains("e-split-bar")&&(this.focusedElement.tabIndex=0===this.focusedElement.tabIndex?-1:this.focusedElement.tabIndex,t.removeClass([this.focusedElement],"e-active-container"))),!n){var s=e.target,o=e.target.classList.contains(H)||t.closest(e.target,"."+H);t.closest(s,".e-gantt-parent-taskbar")&&!this.parent.editSettings.allowEditing?this.chartExpandCollapseRequest(e):!o&&this.parent.autoFocusTasks&&this.scrollToTarget(e)}if(this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.removeFalseLine(!0),!t.isNullOrUndefined(this.parent.onTaskbarClick)&&!n){s=e.target;var l=t.closest(s,".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");l&&this.onTaskbarClick(e,s,l)}}},e.prototype.onTaskbarClick=function(e,i,r){var a=t.closest(i,"tr"),n=t.getValue("rowIndex",a),s={data:this.getRecordByTarget(e),taskbarElement:r,rowIndex:n,target:i};this.parent.trigger("onTaskbarClick",s)},e.prototype.ganttChartLeave=function(e){this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseLeave",e)},e.prototype.ganttChartMove=function(e){this.parent.editSettings.allowTaskbarEditing&&(this.parent.notify("chartMouseMove",e),!t.isNullOrUndefined(this.parent.taskFields.dependency)&&this.parent.connectorLineEditModule&&this.parent.connectorLineEditModule.updateConnectorLineEditElement(e))},e.prototype.contextClick=function(e){this.parent.allowFiltering&&this.parent.filterModule&&this.parent.filterModule.closeFilterOnContextClick(e.srcElement)},e.prototype.mouseMoveHandler=function(e){if(!t.isNullOrUndefined(this.parent.onMouseMove)&&(this.parent.flatData.length||e.target.classList.contains("e-header-cell-label")||e.target.classList.contains("e-headercell"))){var i=e.target,r={originalEvent:e},a=t.closest(i,".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=void 0,s=t.closest(i,".e-rowcell,.e-chart-row-cell"),o=t.closest(i,".e-rowcell,.e-headercell");if(s&&(n=this.parent.ganttChartModule.getRecordByTarget(e),r.data=n),o){var l=t.getValue("cellIndex",o);r.column=this.parent.treeGrid.columns[l]}if(t.closest(i,".e-indicator-span")){var d=0,h=n.ganttProperties.indicators;if(h.length>1)for(d=0;d<h.length&&h[d].name!==a.innerText.trim();d++);r.indicator=h[d]}if(t.closest(i,".e-connector-line-container")){(p={}).target=a,r.predecessor=this.parent.tooltipModule.getPredecessorTooltipData(p)}if(t.closest(i,".e-event-markers")){var p;(p={}).target=a,r.eventMarkers=this.parent.tooltipModule.getMarkerTooltipData(p)}i.classList.contains("e-header-cell-label")&&(r.date=new Date(i.dataset.content))}this.parent.trigger("onMouseMove",r)}},e.prototype.doubleClickHandler=function(e){this.parent.notify("chartDblClick",e);var i=e.target,r=t.closest(i,"tr"),a=t.getValue("rowIndex",r),n={row:r,rowData:this.parent.ganttChartModule.getRecordByTarget(e),rowIndex:a,target:i};this.recordDoubleClick(n)},e.prototype.recordDoubleClick=function(e){this.parent.trigger("recordDoubleClick",e)},e.prototype.getRecordByTarget=function(e){var i,r=t.closest(e.target,"div."+H);if(t.isNullOrUndefined(r)){if(r=t.closest(e.target,"tr")){var a=t.getValue("rowIndex",t.closest(e.target,"tr"));i=this.parent.currentViewData[a]}}else{var n=r.getAttribute("rowUniqueId");i=this.parent.getRecordByID(n)}return i},e.prototype.getChartRows=function(){return null!=document.getElementById(this.parent.element.id+"GanttTaskTableBody")?document.getElementById(this.parent.element.id+"GanttTaskTableBody").querySelectorAll(".e-chart-row"):null},e.prototype.chartExpandCollapseRequest=function(e){if(!this.parent.enableMultiTaskbar){var i=e.target,r=t.closest(i,".e-gantt-parent-taskbar"),a=this.getRecordByTarget(e),n=t.closest(i,"tr"),s=t.getValue("rowIndex",n),o={data:a,gridRow:this.parent.treeGrid.getRows()[s],chartRow:n,cancel:!1};this.isExpandCollapseFromChart=!0,r.classList.contains("e-row-expand")?this.collapseGanttRow(o):r.classList.contains("e-row-collapse")&&this.expandGanttRow(o)}},e.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)},e.prototype.collapseGanttRow=function(e,i){var r=this;i?this.collapsedGanttRow(e):this.parent.trigger("collapsing",e,function(e){r.isExpandCollapseFromChart&&!t.getValue("cancel",e)&&r.collapsedGanttRow(e),r.isExpandCollapseFromChart=!1})},e.prototype.collapsedGanttRow=function(e){if(!(t.isNullOrUndefined(e.gridRow)&&this.parent.enableVirtualization||t.isNullOrUndefined(e.chartRow))){var i=t.getValue("data",e);this.isExpandCollapseFromChart?(this.expandCollapseChartRows("collapse",t.getValue("chartRow",e),i,null),this.parent.treeGrid.collapseRow(t.getValue("gridRow",e),i),this.isExpandCollapseFromChart=!1):this.expandCollapseChartRows("collapse",t.getValue("chartRow",e),i,null),"ResourceView"===this.parent.viewType&&this.renderMultiTaskbar(i),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),t.getValue("chartRow",e).setAttribute("aria-expanded","false"),this.parent.trigger("collapsed",e)}},e.prototype.expandGanttRow=function(e,i){var r=this;i?this.expandedGanttRow(e):this.parent.trigger("expanding",e,function(e){r.isExpandCollapseFromChart&&!t.getValue("cancel",e)&&r.expandedGanttRow(e),r.isExpandCollapseFromChart=!1})},e.prototype.expandedGanttRow=function(e){if(!(t.isNullOrUndefined(e.gridRow)&&this.parent.enableVirtualization||t.isNullOrUndefined(e.chartRow))){var i=t.getValue("data",e);this.isExpandCollapseFromChart?(this.expandCollapseChartRows("expand",t.getValue("chartRow",e),i,null),this.parent.treeGrid.expandRow(t.getValue("gridRow",e),i),this.isExpandCollapseFromChart=!1):(this.parent.isExpandCollapseLevelMethod||this.expandCollapseChartRows("expand",t.getValue("chartRow",e),i,null),this.parent.isExpandCollapseLevelMethod=!1),"ResourceView"===this.parent.viewType&&this.renderMultiTaskbar(i),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),t.getValue("chartRow",e).setAttribute("aria-expanded","true"),this.parent.trigger("expanded",e)}},e.prototype.renderMultiTaskbar=function(e){this.parent.enableMultiTaskbar?this.parent.chartRowsModule.refreshRecords([e],!0):this.parent.showOverAllocation&&this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)},e.prototype.expandCollapseChartRows=function(e,i,r,a){var n;if("expand"===e){n="table-row",a||(r.expanded=!0);for(var s=i.querySelectorAll(".e-row-collapse"),o=0;o<s.length;o++)t.addClass([s[o]],"e-row-expand"),t.removeClass([s[o]],"e-row-collapse")}else if("collapse"===e){n="none",a||(r.expanded=!1);for(s=i.querySelectorAll(".e-row-expand"),o=0;o<s.length;o++)t.addClass([s[o]],"e-row-collapse"),t.removeClass([s[o]],"e-row-expand")}for(var l=r.childRecords,d=this.getChartRows(),h=[],p=0;p<d.length;p++)d[p].classList.contains("gridrowtaskId"+r.ganttProperties.rowUniqueID+"level"+(r.level+1))&&h.push(d[p]);for(p=0;p<h.length;p++)h[p].style.display=n,l[p].childRecords&&l[p].childRecords.length&&("collapse"===e||l[p].expanded||this.isExpandAll)&&this.expandCollapseChartRows(e,h[p],l[p],!0)},e.prototype.expandCollapseAll=function(e){"expand"===e?(this.isExpandAll=!0,this.parent.treeGrid.expandAll()):this.parent.treeGrid.collapseAll(),this.isExpandAll=!1},e.prototype.expandAtLevel=function(e){this.parent.treeGrid.expandAtLevel(e)},e.prototype.collapseAtLevel=function(e){this.parent.enableVirtualization&&(this.parent.isExpandCollapseLevelMethod=!0),this.parent.treeGrid.collapseAtLevel(e)},e.prototype.wireEvents=function(){var e=t.Browser.isPointer,i=t.Browser.touchStartEvent,a=t.Browser.touchEndEvent,n=t.Browser.touchMoveEvent,s=e?"pointerleave":"mouseleave";t.EventHandler.add(this.parent.chartPane,i,this.ganttChartMouseDown,this),t.EventHandler.add(this.parent.chartPane,s,this.ganttChartLeave,this),t.EventHandler.add(this.parent.chartPane,n,this.ganttChartMove,this),this.parent.isAdaptive&&(t.EventHandler.add(this.parent.chartPane,r.click,this.ganttChartMouseClick,this),t.EventHandler.add(this.parent.chartPane,a,this.ganttChartMouseUp,this)),this.parent.isAdaptive||(t.EventHandler.add(this.parent.element,a,this.documentMouseUp,this),t.EventHandler.add(document,a,this.mouseUp,this)),t.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),t.EventHandler.add(document.body,"contextmenu",this.contextClick,this),t.EventHandler.add(document,"mouseup",this.contextClick,this),t.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler,this)},e.prototype.unWireEvents=function(){var e=t.Browser.isPointer,i=t.Browser.touchStartEvent,a=t.Browser.touchEndEvent,n=t.Browser.touchMoveEvent,s=e?"pointerleave":"mouseleave";t.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,i,this.ganttChartMouseDown),t.EventHandler.remove(this.parent.chartPane,s,this.ganttChartLeave),t.EventHandler.remove(this.parent.chartPane,n,this.ganttChartMove),this.parent.isAdaptive&&(t.EventHandler.remove(this.parent.chartPane,r.click,this.ganttChartMouseClick),t.EventHandler.remove(this.parent.chartPane,a,this.ganttChartMouseUp)),this.parent.isAdaptive||(t.EventHandler.remove(this.parent.element,a,this.documentMouseUp),t.EventHandler.remove(document,a,this.mouseUp)),t.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),t.EventHandler.remove(document.body,"contextmenu",this.contextClick),t.EventHandler.remove(document,"mouseup",this.contextClick),t.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler)},e.prototype.getRecordByTaskBar=function(e){return this.parent.enableVirtualization&&this.parent.enableMultiTaskbar?this.parent.flatData[this.getIndexByTaskBar(e)]:this.parent.currentViewData[this.getIndexByTaskBar(e)]},e.prototype.onTabAction=function(e){this.parent.treeGrid.grid.enableHeaderFocus=this.parent.enableHeaderFocus;var i=this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit;if(this.parent.showActiveElement||i){var r=i?e.target.closest(".e-rowcell"):e.target;(r.closest(".e-rowcell")||r.closest(".e-chart-row"))&&this.parent.focusModule.setActiveElement(r),this.focusedRowIndex=r.closest(".e-rowcell")?r.parentElement.rowIndex:r.closest(".e-chart-row")?r.closest(".e-chart-row").rowIndex:-1;var a="tab"===e.action,n=this.getNextElement(r,a,i);if(n&&r.classList.contains("e-headercell")){var s=parseInt(n.getAttribute("data-colindex"));if("shiftTab"===e.action){for(;-1!=s&&!this.parent.treeGrid.columns[s].visible;)s-=1;if(-1!=s)n=document.getElementsByClassName("e-columnheader")[0].childNodes[s];else for(var o=document.getElementsByClassName("e-toolbar-item").length-1;o>0;o--)if(!document.getElementsByClassName("e-toolbar-item")[o].classList.contains("e-hidden")){n=document.getElementsByClassName("e-toolbar-item")[o];break}}else{for(;!this.parent.treeGrid.columns[s].visible;)s+=1;n=document.getElementsByClassName("e-columnheader")[0].childNodes[s]}}if(!n&&"shiftTab"===e.action&&r.classList.contains("e-headercell"))for(o=document.getElementsByClassName("e-toolbar-item").length-1;o>0;o--)if(!document.getElementsByClassName("e-toolbar-item")[o].classList.contains("e-hidden")){n=document.getElementsByClassName("e-toolbar-item")[o];break}if(r.classList.contains("e-treegrid")&&!n)for(o=0;o<this.parent.treeGrid.columns.length;o++)if(this.parent.treeGrid.columns[o].visible){n=document.getElementsByClassName("e-columnheader")[0].childNodes[o];break}if(!n&&r.classList.contains("e-headercell")&&(n=document.getElementsByClassName("e-timeline-header-container")[0]),"shiftTab"!==e.action&&r.classList.contains("e-timeline-header-container"))for(o=0;o<this.parent.treeGrid.columns.length;o++)if(this.parent.treeGrid.columns[o].visible){n=document.getElementsByClassName("e-row")[0].childNodes[o];break}if("shiftTab"!==e.action||n||(n=document.getElementsByClassName("e-timeline-header-container")[0]),"shiftTab"===e.action&&r.classList.contains("e-timeline-header-container"))for(o=this.parent.treeGrid.columns.length-1;o>0;o--)if(this.parent.treeGrid.columns[o].visible){n=document.getElementsByClassName("e-columnheader")[0].childNodes[o];break}if(this.tempNextElement=n,t.isNullOrUndefined(n)||t.isNullOrUndefined(n.cellIndex)||(this.parent.allowRowDragAndDrop?(this.childrenIndex=n.cellIndex,this.nextElementIndex=n.cellIndex-1):(this.childrenIndex=n.cellIndex,this.nextElementIndex=n.cellIndex),this.parent.ganttColumns[this.nextElementIndex].allowEditing||this.parent.ganttColumns[this.nextElementIndex].field===this.parent.taskFields.id?this.isEditableElement=!1:this.isEditableElement=!0),"noNextRow"!==n){if("string"!=typeof n){if((r.classList.contains("e-rowcell")||r.closest(".e-chart-row-cell")||r.classList.contains("e-headercell")||r.closest(".e-segmented-taskbar")||r.classList.contains("e-timeline-header-container"))&&e.preventDefault(),a&&r.classList.contains("e-rowdragdrop"))return void this.parent.treeGrid.grid.notify("key-pressed",e);if(r.classList.contains("e-rowcell")&&n&&n.classList.contains("e-rowcell")||r.classList.contains("e-headercell"))if(a)if(this.parent.editSettings.allowNextRowEdit){var l=this.parent.currentViewData[this.focusedRowIndex],d=this.parent.ganttColumns[n.getAttribute("data-colindex")].field;l.hasChildRecords?d===this.parent.taskFields.endDate||d===this.parent.taskFields.duration||d===this.parent.taskFields.dependency||d===this.parent.taskFields.progress||d===this.parent.taskFields.work||"taskType"===d?(this.parent.treeGrid.grid.endEdit(),this.parent.treeGrid.grid.notify("key-pressed",e)):d===this.parent.taskFields.name||d===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,d)):this.parent.treeGrid.grid.notify("key-pressed",e)}else(!n||n&&!n.classList.contains("e-headercell"))&&(r.classList.contains("e-headercell")&&this.manageFocus(r,"remove",!1),n&&!r.classList.contains("e-editedbatchcell")||this.parent.treeGrid.grid.notify("key-pressed",e));else n.classList.contains("e-headercell")||n.classList.contains("e-rowcell")||n.classList.contains("e-toolbar-item")||this.parent.treeGrid.grid.notify("key-pressed",e);if((!this.parent.editModule||!this.parent.editModule.cellEditModule||t.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn))&&n){if(r.classList.contains("e-rowcell")?this.manageFocus(r,"remove",!1):this.manageFocus(r,"remove",!0),n.classList.contains("e-rowcell")&&r.nextElementSibling&&!r.classList.contains("e-timeline-header-container")||r.classList.contains("e-right-label-container")){if(!r.classList.contains("e-rowcell")){this.parent.treeGrid.grid.notify("key-pressed",e);var h=t.getValue("focusModule",this.parent.treeGrid.grid);h.currentInfo.element=n,h.currentInfo.elementToFocus=n,h.content.matrix.current=[n.parentElement.rowIndex,n.cellIndex]}this.manageFocus(n,"add",!1)}else n&&(n.classList.contains("e-toolbar-item")||n.classList.contains("e-headercell")||n.classList.contains("e-rowcell"))?(this.manageFocus(r,"remove",!1),this.manageFocus(n,"add",!1),r.classList.contains("e-treegrid")&&e.preventDefault()):this.manageFocus(n,"add",!0);this.parent.focusModule.setActiveElement(n)}}}else this.manageFocus(r,"remove",!0)}},e.prototype.getNextElement=function(e,i,r){for(var a=i?e.nextElementSibling:e.previousElementSibling;a&&a.parentElement.classList.contains("e-row");){if(!a.matches(".e-hide")&&!a.matches(".e-rowdragdrop"))return a;a=i?a.nextElementSibling:a.previousElementSibling}if(!t.isNullOrUndefined(a)&&(a.classList.contains("e-taskbar-main-container")||a.classList.contains("e-right-connectorpoint-outer-div"))){var n=this.parent.currentViewData[this.focusedRowIndex];!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length>0&&(a=a.classList.contains("e-right-connectorpoint-outer-div")?a.parentElement.nextElementSibling:a.getElementsByClassName("e-gantt-child-taskbar-inner-div")[0])}if(this.validateNextElement(a))return a;var s=-1,o=null;if(e.classList.contains("e-rowcell")&&r&&this.parent.editSettings.allowNextRowEdit)return s=e.parentElement.rowIndex,o=this.getNextRowElement(s,i,!0),this.getChildElement(o,i);if(e.classList.contains("e-rowcell"))if(s=e.parentElement.rowIndex,i){if(o=this.parent.getRowByIndex(s),this.validateNextElement(o,"e-left-label-container"))return o.getElementsByClassName("e-left-label-container")[0];if(this.validateNextElement(o,"e-taskbar-main-container"))return o.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(o,"e-right-label-container"))return o.getElementsByClassName("e-right-label-container")[0]}else{if(o=this.getNextRowElement(s,i,!1),this.validateNextElement(o,"e-right-label-container"))return o.getElementsByClassName("e-right-label-container")[0];if(this.validateNextElement(o,"e-taskbar-main-container"))return o.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(o,"e-left-label-container"))return o.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")){s=t.closest(e,".e-chart-row").rowIndex,o=i?this.getNextRowElement(s,i,!0):this.parent.treeGrid.grid.getRowByIndex(s);return this.getChildElement(o,i)}if((a=e)&&a.parentElement.classList.contains("e-toolbar-item")&&this.parent.toolbarModule)for(;a&&a.parentElement.classList.contains("e-toolbar-item")&&a.parentElement.nextElementSibling.classList.contains("e-toolbar-item");){if(!a.parentElement.nextElementSibling.classList.contains("e-hidden"))return a.parentElement.nextElementSibling;a=a.parentElement.nextElementSibling.childNodes[0]}return null},e.prototype.getNextRowElement=function(e,t,i){var r=this.parent.getExpandedRecords(this.parent.currentViewData),a=this.parent.currentViewData[e],n=r.indexOf(a),s=t?r[n+1]:r[n-1],o=this.parent.currentViewData.indexOf(s);return s?i?this.parent.treeGrid.grid.getRowByIndex(o):this.parent.getRowByIndex(o):null},e.prototype.validateNextElement=function(e,i){if(e&&e.classList.contains("e-rowcell"))return!0;if(e&&i){var r=e.getElementsByClassName(i)[0];return!(!r||!r.hasChildNodes())}return!!e&&!(t.isNullOrUndefined(e)||!e.hasChildNodes())},e.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},e.prototype.manageFocus=function(e,i,r){if(r){var a=null;if(e.classList.contains("e-left-label-container")||e.classList.contains("e-right-label-container"))a=e.getElementsByTagName("span")[0];else if(e.classList.contains("e-taskbar-main-container")||e.classList.contains("e-gantt-child-taskbar-inner-div")){var n=t.closest(e,".e-chart-row").rowIndex,s=this.parent.currentViewData[n],o=s.hasChildRecords?s.ganttProperties.isAutoSchedule?"e-gantt-parent-taskbar":"e-manualparent-main-container":s.ganttProperties.isMilestone?"e-gantt-milestone":!t.isNullOrUndefined(s.ganttProperties.segments)&&s.ganttProperties.segments.length>0?"e-segmented-taskbar":"e-gantt-child-taskbar";a=e.getElementsByClassName(o)[0],t.isNullOrUndefined(a)&&(a=e)}(e.classList.contains("e-right-label-temp-container")||e.classList.contains("e-left-label-temp-container")||e.classList.contains("e-indicator-span"))&&("add"===i?(e.setAttribute("tabIndex","0"),t.addClass([e],"e-active-container"),e.focus()):(t.removeClass([e],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur())),"add"!==i||t.isNullOrUndefined(a)?t.isNullOrUndefined(a)||(t.removeClass([a],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur()):(e.setAttribute("tabIndex","0"),t.addClass([a],"e-active-container"),e.focus(),this.focusedElement=a)}else"add"===i?(e.setAttribute("tabIndex","0"),t.addClass([e],["e-focused","e-focus"]),e.focus()):(e.setAttribute("tabIndex","-1"),t.removeClass([e],["e-focused","e-focus"]),e.blur())},e.prototype.getIndexByTaskBar=function(e){var i,r;if(i=e.classList.contains(H)?e:t.closest(e,"div."+H),t.isNullOrUndefined(i))i=t.closest(e,"tr."+Q),r=[].slice.call(this.parent.chartRowsModule.ganttChartTableBody.childNodes).indexOf(i);else{var a=i.getAttribute("rowUniqueId"),n=this.parent.getRecordByID(a);r=this.parent.enableVirtualization&&this.parent.enableMultiTaskbar?this.parent.flatData.indexOf(n):this.parent.currentViewData.indexOf(n)}return r},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.scrollObject.destroy(),this.scrollObject=null},e}(),We=function(){return(We=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},qe=function(){function e(e){this.isZoomIn=!1,this.isZooming=!1,this.isZoomToFit=!1,this.topTierCollection=[],this.bottomTierCollection=[],this.parent=e,this.initProperties()}return e.prototype.initProperties=function(){this.timelineStartDate=null,this.timelineEndDate=null,this.totalTimelineWidth=0,this.customTimelineSettings=null,this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!t.isNullOrUndefined(this.parent.projectStartDate),this.parent.enablePersistence&&this.parent.isLoad&&(this.parent.timelineSettings=this.parent.currentZoomingLevel)},e.prototype.validateTimelineProp=function(){this.roundOffDays(),this.processTimelineProperty(),this.timelineWidthCalculation()},e.prototype.refreshTimeline=function(){this.initProperties(),this.processTimelineUnit(),this.parent.dataOperation.calculateProjectDates(),this.parent.isFromOnPropertyChange||this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff)},e.prototype.refreshTimelineByTimeSpan=function(){this.validateTimelineProp(),this.parent.ganttChartModule.chartTimelineContainer.innerHTML="",this.createTimelineSeries()},e.prototype.updateChartByNewTimeline=function(){this.parent.chartRowsModule.refreshChartByTimeline(),this.parent.notify("refreshDayMarkers",{})},e.prototype.processZooming=function(e){this.isZoomToFit=!1,t.isNullOrUndefined(this.parent.zoomingProjectStartDate)||(this.parent.cloneProjectStartDate=this.parent.cloneProjectStartDate.getTime()<this.parent.zoomingProjectStartDate.getTime()?this.parent.cloneProjectStartDate:this.parent.zoomingProjectStartDate,this.parent.cloneProjectEndDate=this.parent.cloneProjectEndDate.getTime()>this.parent.zoomingProjectEndDate.getTime()?this.parent.cloneProjectEndDate:this.parent.zoomingProjectEndDate),this.parent.zoomingProjectStartDate=null,this.parent.zoomingProjectEndDate=null;var i=this.checkCurrentZoomingLevel();this.isZoomIn=e,this.isZooming=!0;var r=e?i+1:i-1;this.parent.toolbarModule&&(e?r===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)):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!0):r===this.parent.zoomingLevels[0].level?(this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1),this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!0)):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!0)),r=this.parent.zoomingLevels.findIndex(function(e){return e.level===r});var a=this.parent.zoomingLevels[r],n={requestType:e?"beforeZoomIn":"beforeZoomOut",timeline:a,cancel:!1};this.parent.trigger("actionBegin",n),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),n.cancel||(a=n.timeline,this.changeTimelineSettings(a))},e.prototype.changeTimelineSettings=function(e){var i=this;this.isZoomToFit?this.isSingleTier="None"===this.customTimelineSettings.topTier.unit||"None"===this.customTimelineSettings.bottomTier.unit:this.isZoomIn||(this.isSingleTier="None"===e.topTier.unit||"None"===e.bottomTier.unit);var r=this.isSingleTier?"None"===this.customTimelineSettings.topTier.unit?"topTier":"bottomTier":null;Object.keys(this.customTimelineSettings).forEach(function(a){if(a!==r)i.customTimelineSettings[a]="object"!=typeof e[a]||t.isNullOrUndefined(e[a])?e[a]:We({},e[a]);else{var n="topTier"===a?"bottomTier":"topTier";"None"!=e.bottomTier.unit&&(i.customTimelineSettings[n]=We({},e.bottomTier))}}),this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!t.isNullOrUndefined(this.parent.projectStartDate),this.processTimelineUnit(),this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff);var a=this.parent.criticalPathModule;if(this.parent.enableCriticalPath&&a&&a.criticalConnectorLine(a.criticalPathCollection,a.detailPredecessorCollection,!0,a.predecessorCollectionTaskIds),this.isZooming||this.isZoomToFit){var n={requestType:this.isZoomIn?"AfterZoomIn":this.isZoomToFit?"AfterZoomToProject":"AfterZoomOut",timeline:this.parent.currentZoomingLevel};this.parent.trigger("actionComplete",n),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()}},e.prototype.processZoomToFit=function(){this.isZoomToFit=!0,this.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)),this.parent.dataOperation.calculateProjectDates();var e,i,r,a=(this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5,n=this.parent.ganttChartModule.chartElement.offsetWidth,s=n/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(i=o[l],l===o.length-1){e=o[l];break}if(r=o[l+1],s>=i.perDayWidth){e=o[l];break}if(s<i.perDayWidth&&s>r.perDayWidth){e=o[l+1];break}}var d=t.extend({},{},e,!0);this.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,s,d.bottomTier.unit,e),this.roundOffDateToZoom(this.parent.cloneProjectEndDate,!1,s,d.bottomTier.unit,e);var h=this.calculateNumberOfTimelineCells(d),p=this.parent.ganttChartModule.scrollElement.offsetHeight-17,c=this.parent.ganttChartModule.chartBodyContent.offsetHeight<=p?0:17;d.timelineUnitSize=Math.abs(n-c)/h;var u={requestType:"beforeZoomToProject",timeline:d};this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin",this.parent.controlId+"_zoomout"],!0),this.parent.trigger("actionBegin",u),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),this.changeTimelineSettings(d)}},e.prototype.bottomTierCellWidthCalc=function(e,t,i){var r;switch(e){case"Minutes":r=6e4*t.bottomTier.count;break;case"Hour":r=36e5*t.bottomTier.count;break;case"Week":r=6048e5*t.bottomTier.count;break;case"Day":r=864e5*t.bottomTier.count;break;case"Month":var a=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();r=t.bottomTier.count*(86400*a*1e3);break;case"Year":var n=i.getFullYear()%400==0||i.getFullYear()%100!=0&&i.getFullYear()%4==0?366:365;r=t.bottomTier.count*(86400*n*1e3)}return r},e.prototype.roundOffDateToZoom=function(e,t,i,r,a){var n=this.bottomTierCellWidthCalc(r,a,e);t?e.setTime(e.getTime()-n):e.setTime(e.getTime()+n)},e.prototype.calculateNumberOfTimelineCells=function(e){var t=Math.abs((this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5),i=e.bottomTier.count,r=e.bottomTier.unit;return"Day"===r?t/i:"Week"===r?t/i/7:"Month"===r?t/i/28:"Year"===r?t/i/336:"Hour"===r?t*(24/i):t*(1440/i)},e.prototype.processTimelineUnit=function(){var e=["Year","Month","Week","Day","Hour","Minutes"];this.customTimelineSettings=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},e.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=this.customTimelineSettings.weekStartDay>=0&&this.customTimelineSettings.weekStartDay<=6?this.customTimelineSettings.weekStartDay:0,this.checkCurrentZoomingLevel()},e.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}},e.prototype.checkCurrentZoomingLevel=function(){var e="None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier.count:this.customTimelineSettings.topTier.count,t="None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier.unit:this.customTimelineSettings.topTier.unit,i="None"!==this.customTimelineSettings.bottomTier.unit?"bottomTier":"topTier",r=this.getCurrentZoomingLevel(t,e,i);return this.parent.toolbarModule&&(r===this.parent.zoomingLevels[this.parent.zoomingLevels.length-1].level?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):r===this.parent.zoomingLevels[0].level&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),this.parent.currentZoomingLevel=this.parent.zoomingLevels[r],r},e.prototype.getCurrentZoomingLevel=function(e,t,i){var r,a,n,s,o;this.parent.zoomingLevels.length||(this.parent.zoomingLevels=this.parent.getZoomingLevels());var l=this.parent.zoomingLevels.filter(function(t){return"bottomTier"===i?t.bottomTier.unit===e:t.topTier.unit===e});if(0===l.length){var d=this.getClosestUnit(e,"",!1);l=this.parent.zoomingLevels.filter(function(e){return"bottomTier"===i?e.bottomTier.unit===d:e.topTier.unit===d})}for(var h=l.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){r=h[p].level;break}if(s=h[p+1],t>=o[""+i].count){a=h[p],r=(n=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===a.bottomTier.count:e.topTier.count===a.topTier.count})).length>1?this.checkCollectionsWidth(n):n[0].level;break}if(t<o[""+i].count&&t>s[""+i].count){a=h[p+1],r=(n=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===a.bottomTier.count:e.topTier.count===a.topTier.count})).length>1?this.checkCollectionsWidth(n):n[0].level;break}}return r},e.prototype.getClosestUnit=function(e,t,i){var r=["Year","Month","Week","Day","Hour","Minutes"],a=r.indexOf(e);0===a&&(i=!0),e=this.isZoomIn||i?r[a+1]:r[a-1];return 0===this.parent.zoomingLevels.filter(function(t){return t.bottomTier.unit===e}).length?("Year"===e&&(i=!0),t=e,this.getClosestUnit(e,t,i)):e},e.prototype.checkCollectionsWidth=function(e){for(var t,i,r,a=e,n=this.customTimelineSettings.timelineUnitSize,s=a.sort(function(e,t){return e.timelineUnitSize<t.timelineUnitSize?1:-1}),o=0;o<s.length;o++){if(r=s[o],o===s.length-1){t=s[o].level;break}if(i=s[o+1],n>=r.timelineUnitSize){t=s[o].level;break}if(n<r.timelineUnitSize&&n>i.timelineUnitSize){t=s[o+1].level;break}}return t},e.prototype.updateTimelineHeaderHeight=function(){if(this.parent.timelineModule.isSingleTier?(t.addClass([this.parent.ganttChartModule.chartTimelineContainer],U),this.parent.treeGrid.element&&(t.addClass(this.parent.treeGrid.element.querySelectorAll(".e-headercell"),U),t.addClass(this.parent.treeGrid.element.querySelectorAll(".e-columnheader"),U))):(t.removeClass([this.parent.ganttChartModule.chartTimelineContainer],U),this.parent.treeGrid.element&&(t.removeClass(this.parent.treeGrid.element.querySelectorAll(".e-headercell"),U),t.removeClass(this.parent.treeGrid.element.querySelectorAll(".e-columnheader"),U))),this.previousIsSingleTier!==this.isSingleTier){var e=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.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}},e.prototype.createTimelineSeries=function(){var e,i,r,a,n,s=this.isSingleTier?1:2,o="None"===this.topTier?"bottomTier":"topTier";this.updateTimelineHeaderHeight(),this.topTierCollection=[],this.bottomTierCollection=[];for(var l=0;l<s;l++)a=t.createElement("table",{className:F,styles:"display: block;"}),n=t.createElement("thead",{className:"e-timeline-header-table-body",styles:"display:block; border-collapse:collapse"}),e=t.createElement("tr",{innerHTML:this.createTimelineTemplate(o)}),i=t.createElement("th"),r=t.createElement("div",{styles:"width: 20px"}),i.appendChild(r),e.appendChild(i),n.appendChild(e),a.appendChild(n),this.parent.ganttChartModule.chartTimelineContainer.appendChild(a),o="bottomTier",e=null},e.prototype.validateCount=function(e,i,r){var a,n=!t.isNullOrUndefined(i)&&parseInt(i.toString(),10)>0?parseInt(i.toString(),10):1,s=Math.abs(this.timelineRoundOffEndDate.getTime()-this.timelineStartDate.getTime());switch(e){case"Year":n=n<=(a=Math.round(s/864e5/336))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Month":n=n<=(a=Math.round(s/864e5/28))?n:a>0?a+1:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Week":n=n<=(a=Math.round(s/864e5/7))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Day":n=n<=(a=Math.round(s/864e5))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Hour":n=n<=(a=Math.round(s/36e5))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Minutes":n=n<=(a=Math.round(s/6e4))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n))}return i!==n&&this.isZooming&&this.parent.toolbarModule&&("bottomTier"===r||this.isSingleTier)&&(this.isZoomIn?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),n},e.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},e.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},e.prototype.extendFunction=function(e,t,i){for(var r=this,a={},n=0;n<t.length;n++)a[t[n]]=e[t[n]];return i&&Object.keys(i).forEach(function(t){a[t]=r.extendFunction(e[t],i[t],null)}),a},e.prototype.formatDateHeader=function(e,t){var i,r=new Date(t.getTime());return""===e?(i=this.parent.globalize.formatDate(r,{format:"E"}),i="zh"===this.parent.locale?i.slice(1):i.slice(0,1)):i=this.parent.globalize.formatDate(r,{format:e}),i},e.prototype.customFormat=function(e,i,r,a,n){return(n="string"==typeof n?t.getValue(n,window):n)(e,i,r,a)},e.prototype.createTimelineTemplate=function(e){var t,i,r=!1,a=this.parent,n="",s="",o="topTier"===e?a.timelineModule.customTimelineSettings.topTier.unit:a.timelineModule.customTimelineSettings.bottomTier.unit,l="topTier"===e?a.timelineModule.customTimelineSettings.topTier.count:a.timelineModule.customTimelineSettings.bottomTier.count,d=new Date(this.parent.timelineModule.timelineStartDate.toString()),h=new Date(this.timelineRoundOffEndDate.toString()),p=[];do{var c={};c.startDate=new Date(d.getTime()),"Month"===o&&"bottomTier"===e&&1!=l&&0===p.length&&(r=!0),s=this.getHeaterTemplateString(new Date(d.toString()),o,e,!1,l,c,r),p.push(new Date(d.toString())),r?i=this.calculateQuarterEndDate(d,l).getTime():(t=this.getIncrement(d,l,o),i=d.getTime()+t),r=!1,d.setTime(i),5===d.getHours()&&2===l&&"bottomTier"===e&&"Hour"===this.parent.timelineSettings.bottomTier.unit&&d.setTime(d.getTime()-36e5),d>=h&&(s=this.getHeaterTemplateString(p[p.length-1],o,e,!0,l,c)),n+=s;var u="topTier"===e?this.topTierCollection:this.bottomTierCollection;c.endDate=new Date(d.getTime()),u.push(c)}while(d<h);return n},e.prototype.updateTimelineAfterZooming=function(e,i){var r,a,n,s=document.getElementsByClassName("e-chart-scroll-container e-content")[0];if(!t.isNullOrUndefined(s)){var o=s.offsetWidth,l=s.offsetHeight,d=document.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;if(r=Math.abs(this.timelineStartDate.getTime()-e.getTime()),r/=864e5,a="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),n=l<d?a*r+17:a*r,o>=n){var h=o-n;h=Math.round(h/a),e.setDate(e.getDate()+h),this.parent.timelineModule.timelineEndDate=e,i&&this.parent.updateProjectDates(this.timelineStartDate,this.timelineEndDate,this.parent.isTimelineRoundOff)}}},e.prototype.getTimelineRoundOffEndDate=function(e){var i="None"===this.topTier?this.bottomTier:this.topTier,r=new Date(e.toString());return this.parent.isTimelineRoundOff&&("Hour"===i?r.setMinutes(60):"Minutes"===i?r.setSeconds(60):r.setHours(24,0,0,0)),t.isNullOrUndefined(this.parent.projectEndDate)&&this.updateTimelineAfterZooming(r,!1),r},e.prototype.getIncrement=function(e,t,i){var r,a=new Date(e.getTime()),n=new Date(e.getTime());switch(i){case"Year":a=e,r=(n=new Date(e.getFullYear()+(t-1),11,31)).getTime()-a.getTime()+864e5;break;case"Month":a=e,r=(n=new Date(e.getFullYear(),e.getMonth()+t,1)).getTime()-a.getTime();break;case"Week":var s=this.parent.timelineModule.customTimelineSettings.weekStartDay,o=e.getDay()<s?s-e.getDay():6-e.getDay()+s;t=o>0?t-1:0,n.setHours(24,0,0,0),o=e.getDay()<s&&o>0?o-1:o,n.setDate(n.getDate()+(o+7*t)),r=n.getTime()-a.getTime();break;case"Day":n.setHours(24,0,0,0),r=n.getTime()-a.getTime()+864e5*(t-1);break;case"Hour":n.setMinutes(60),n.setSeconds(0),r=n.getTime()-a.getTime()+36e5*(t-1),r=this.checkDate(a,n,r,t);break;case"Minutes":n.setSeconds(60),r=n.getTime()-a.getTime()+6e4*(t-1)}return r},e.prototype.checkDate=function(e,t,i,r){var a=new Date(e.getTime());if(a.setTime(a.getTime()+i),1!==r&&(a.getTime()-t.getTime())/36e5!=r&&e.getTimezoneOffset()!==a.getTimezoneOffset()){var n=r-(a.getTime()-t.getTime())/36e5;this.parent.isInDst(a)?this.parent.isInDst(a)&&2!==r&&(i-=36e5*n):i+=36e5*n}return i},e.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()))},e.prototype.calculateQuarterEndDate=function(e,t){var i=e.getMonth();return 3===t?i>=0&&i<=2?new Date(e.getFullYear(),3,1):i>=3&&i<=5?new Date(e.getFullYear(),6,1):i>=6&&i<=8?new Date(e.getFullYear(),9,1):new Date(e.getFullYear()+1,0,1):i>=0&&i<=5?new Date(e.getFullYear(),6,1):new Date(e.getFullYear()+1,0,1)},e.prototype.getHeaterTemplateString=function(e,i,r,a,n,s,o){var l,d="",h="",p="topTier"===r?this.parent.timelineModule.customTimelineSettings.topTier.format:this.parent.timelineModule.customTimelineSettings.bottomTier.format,c="topTier"===r?this.parent.timelineModule.customTimelineSettings.topTier.formatter:this.parent.timelineModule.customTimelineSettings.bottomTier.formatter,u=t.isNullOrUndefined(c)?this.parent.globalize.formatDate(e,{format:this.parent.getDateFormat()}):this.customFormat(e,p,r,i,c),g=l=this.getIncrement(e,n,i)/864e5*this.parent.perDayWidth;l=a||o?a?this.calculateWidthBetweenTwoDate(i,e,this.timelineRoundOffEndDate):this.calculateWidthBetweenTwoDate(i,e,this.calculateQuarterEndDate(e,n)):l;var f=this.isWeekendHeaderCell(i,r,e),m="topTier"===r?" e-gantt-top-cell-text":"",y=t.isNullOrUndefined(c)?this.formatDateHeader(p,e):this.customFormat(e,p,r,i,c);return h+=this.parent.timelineModule.isSingleTier?'<th class="e-timeline-single-header-cell ':'<th class="e-timeline-top-header-cell',h+=f?" e-weekend-header-cell":"",h+='" tabindex="-1" aria-label= "'+this.parent.localeObj.getConstant("timelineCell")+" "+u,h+='" style="width:'+l+"px;",h+=f&&this.customTimelineSettings.weekendBackground?"background-color:"+this.customTimelineSettings.weekendBackground+";":"",h+='"><div class="e-header-cell-label'+m+'" style="width:'+(l-1)+"px;"+(this.parent.timelineSettings.showTooltip?'"title="'+u:""),h+='">'+y+"</div>",d+=h,d+="</th>",!this.isSingleTier&&"topTier"!==r||a?(this.isSingleTier||"topTier"===r)&&a&&(this.totalTimelineWidth=this.totalTimelineWidth-g+l):this.totalTimelineWidth=this.totalTimelineWidth+l,s.value=y,s.isWeekend=f,s.width=g,d},e.prototype.calculateWidthBetweenTwoDate=function(e,t,i){return(i.getTime()-t.getTime())/864e5*this.parent.perDayWidth},e.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},e.prototype.getPerDayWidth=function(e,t,i){var r;switch(i){case"Year":r=e/t/336;break;case"Month":r=e/t/28;break;case"Week":r=e/t/7;break;case"Day":r=e/t;break;case"Hour":r=24/t*e;break;case"Minutes":r=1440/t*e}return r},e.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 r=this.parent.timelineModule.customTimelineSettings.weekStartDay,a=e.getDay()<r?e.getDate()-(7-r+e.getDay()):e.getDate()-e.getDay()+r;e.setDate(a);var n=t.getDate()-t.getDay()+6+r;t.setDate(n)}"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)},e.prototype.updateScheduleDatesByToolBar=function(e,t,i,r){if("Year"===e&&("prevTimeSpan"===t?i=0===i.getMonth()?new Date(i.getFullYear()-1,0,1):new Date(i.getFullYear(),0,1):r=11===r.getMonth()?new Date(r.getFullYear()+1,0,1):new Date(r.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):r=new Date(r.getFullYear(),r.getMonth()+1,1)),"Week"===e){var a=this.parent.timelineModule.customTimelineSettings.weekStartDay,n=void 0;"prevTimeSpan"===t?(n=i.getDay()<a?7-(a-i.getDay()):i.getDay()-a,i.setHours(0,0,0,0),0===n?i.setDate(i.getDate()-7):i.setDate(i.getDate()-n)):(n=r.getDay()<a?a-r.getDay():7-r.getDay()+a,r.setHours(0,0,0,0),0===n?r.setDate(r.getDate()+6):r.setDate(r.getDate()+n))}"Day"===e&&("prevTimeSpan"===t?0===i.getHours()?i.setTime(i.getTime()-864e5):i.setHours(0):0===r.getHours()?r.setTime(r.getTime()+864e5):r.setHours(24)),"Hour"===e&&("prevTimeSpan"===t?0===i.getMinutes()?i.setTime(i.getTime()-36e5):i.setMinutes(0):0===r.getMinutes()?r.setTime(r.getTime()+36e5):r.setMinutes(60)),"Minutes"===e&&("prevTimeSpan"===t?0===i.getSeconds()?i.setTime(i.getTime()-6e4):i.setSeconds(0):0===r.getSeconds()?r.setTime(r.getTime()+6e4):r.setSeconds(60)),this.parent.cloneProjectStartDate=i,this.parent.cloneProjectEndDate=r},e.prototype.updateTimeLineOnEditing=function(e,i){if(e[0].length>=1)for(var r=0;r<e.length;r++){var n=e[r],s=n.filter(function(e){return!t.isNullOrUndefined(e.ganttProperties.startDate)}),o=n.filter(function(e){return!t.isNullOrUndefined(e.ganttProperties.endDate)}),l=s.length>0?new Date(a.DataUtil.aggregates.min(s,"ganttProperties.startDate")):null,d=o.length>0?new Date(a.DataUtil.aggregates.max(o,"ganttProperties.endDate")):null,h=new Date(this.parent.dataOperation.checkStartDate(this.timelineStartDate).getTime()),p=new Date(this.parent.dataOperation.checkEndDate(this.timelineEndDate).getTime()),c=t.isNullOrUndefined(l)?null:this.parent.dataOperation.getTaskLeft(l,!1),u=t.isNullOrUndefined(d)?null:this.parent.dataOperation.getTaskLeft(d,!1),g=this.parent.dataOperation.getTaskLeft(h,!1),f=this.parent.dataOperation.getTaskLeft(p,!1),m=void 0,y=this.parent.editModule.taskbarEditModule;!t.isNullOrUndefined(c)&&(l<this.timelineStartDate||!t.isNullOrUndefined(y)&&!t.isNullOrUndefined(y.taskBarEditAction)&&"ProgressResizing"!==y.taskBarEditAction&&"RightResizing"!==y.taskBarEditAction)&&(c<this.bottomTierCellWidth||c<=g)?(m="prevTimeSpan",l=l>this.timelineStartDate?this.timelineStartDate:l):l=this.timelineStartDate,!t.isNullOrUndefined(u)&&(u>=this.totalTimelineWidth-this.bottomTierCellWidth||u>=f)?(m="prevTimeSpan"===m?"both":"nextTimeSpan",d=d<this.timelineEndDate?this.timelineEndDate:d):d=this.timelineEndDate,m?this.performTimeSpanAction(m,i,l,d):t.isNullOrUndefined(n[0].ganttProperties.segments)||this.parent.dataOperation.updateWidthLeft(n[0]);break}},e.prototype.performTimeSpanAction=function(e,i,r,a,n){n=t.isNullOrUndefined(n)?"None"===this.parent.timelineModule.topTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:n;var s=new Date(this.parent.cloneProjectStartDate.getTime()),o=new Date(this.parent.cloneProjectEndDate.getTime());"publicMethod"!==i&&"both"===e?(this.updateScheduleDatesByToolBar(n,"prevTimeSpan",r,a),this.updateScheduleDatesByToolBar(n,"nextTimeSpan",new Date(this.parent.cloneProjectStartDate.getTime()),a)):this.updateScheduleDatesByToolBar(n,e,r,a);var l=this.timeSpanActionEvent("actionBegin",e,i);if(l.cancel)this.parent.cloneProjectStartDate=s,this.parent.cloneProjectEndDate=o;else{if(this.parent.updateProjectDates(l.projectStartDate,l.ProjectEndDate,l.isTimelineRoundOff,i),"prevTimeSpan"===e&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(0);else if("nextTimeSpan"===e&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(this.parent.timelineModule.totalTimelineWidth);else if("nextTimeSpan"===e&&"TaskbarEditing"===i){var d=document.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollLeft;this.parent.element.querySelector(".e-timeline-header-container").scrollLeft=d}this.parent.timelineModule.timeSpanActionEvent("actionComplete",e,i)}},e.prototype.timeSpanActionEvent=function(e,t,i){var r={};return r.projectStartDate=new Date(this.parent.cloneProjectStartDate.getTime()),r.ProjectEndDate=new Date(this.parent.cloneProjectEndDate.getTime()),r.requestType="publicMethod"===i?t:"beforeAdd"===i?"TimelineRefreshOnAdd":"TaskbarEditing"===i?"TimelineRefreshOnEdit":t,"actionBegin"===e&&(r.isTimelineRoundOff=this.parent.isTimelineRoundOff,r.cancel=!1),r.action="TimescaleUpdate",this.parent.trigger(e,r),r},e}(),Ge=function(){return function(e){this.allowEditing=!0,this.allowReordering=!0,this.allowResizing=!0,this.allowSorting=!0,this.allowFiltering=!0,this.edit={},t.merge(this,e)}}(),ze=function(){function e(e){var i=this;this.previousScroll={top:0,left:0},this.queryCellInfo=function(e){i.parent.trigger("queryCellInfo",e)},this.headerCellInfo=function(e){i.parent.trigger("headerCellInfo",e)},this.rowDataBound=function(e){i.parent.trigger("rowDataBound",e)},this.columnMenuOpen=function(e){i.parent.notify("columnMenuOpen",e),i.parent.trigger("columnMenuOpen",e),document.querySelector(".e-colmenu").addEventListener("mousemove",function(e){var r=document.querySelector(".e-filter-popup"),a=document.querySelector(".e-filter-item");t.isNullOrUndefined(r)||a.classList.contains("e-focused")||t.remove(i.parent.filterModule.filterMenuElement)})},this.columnMenuClick=function(e){i.parent.trigger("columnMenuClick",e)},this.objectEqualityChecker=function(e,t){if(e){for(var r=Object.keys(e),a=!0,n=["Children","childRecords","taskData","uniqueID","parentItem","parentUniqueID","ganttProperties"],s=0;s<r.length;s++){if((e[r[s]]instanceof Date?new Date(e[r[s]]).getTime():e[r[s]])!==(t[r[s]]instanceof Date?new Date(t[r[s]]).getTime():t[r[s]])&&-1===n.indexOf(r[s])){i.parent.modifiedRecords.push(t),a=!1;break}}return a}return!1},this.parent=e,this.parent.treeGrid=new n.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=t.extend([],[],this.parent.columns,!0)),this.validateGanttColumns(),this.parent.isLocaleChanged&&(this.parent.isLocaleChanged=!1),this.addEventListener()}return e.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)},e.prototype.renderReactTemplate=function(e){this.parent.portals=e,this.parent.renderTemplates()},e.prototype.createContainer=function(){this.treeGridElement=t.createElement("div",{id:"treeGrid"+this.parent.element.id,className:"e-gantt-tree-grid"});var e=t.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")},e.prototype.renderTreeGrid=function(){this.composeProperties(),this.bindEvents();this.parent.treeGrid.root=this.parent.root?this.parent.root:this.parent,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()},e.prototype.composeProperties=function(){if(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=t.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&&y(this.parent)){this.parent.treeGrid.hasChildMapping="isParent";var e=t.getValue("count",this.parent.dataSource);this.parent.treeGrid.dataSource={result:this.parent.flatData,count:e}}else 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;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||this.parent.toolbarModule.element.offsetHeight,this.parent.treeGrid.height=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].offsetHeight-19},e.prototype.getContentDiv=function(){return this.treeGridElement.querySelector(".e-content")},e.prototype.getHeaderDiv=function(){return this.treeGridElement.querySelector(".e-headercontent")},e.prototype.getScrollbarWidth=function(){var e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",e.style.msOverflowStyle="scrollbar";var t=document.createElement("div");e.appendChild(t),this.parent.element.appendChild(e);var i=e.offsetWidth-t.offsetWidth;return e.parentNode.removeChild(e),i},e.prototype.ensureScrollBar=function(){var e=this.getContentDiv(),t=this.getHeaderDiv(),i=this.getScrollbarWidth(),r=/Android|Mac|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);0!==i?e.style.cssText+="width: calc(100% + "+(i+1)+"px);":e.classList.add("e-gantt-scroll-padding"),0===i&&r&&(t.style.cssText+="width: calc(100% + 17px);")},e.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.queryCellInfo=this.queryCellInfo.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)},e.prototype.beforeDataBound=function(e){this.parent.updatedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?t.getValue("virtualScrollModule.visualData",this.parent.treeGrid):t.getValue("result",e),this.parent.virtualScrollModule&&this.parent.enableVirtualization&&this.parent.updateContentHeight(e),t.setValue("contentModule.objectEqualityChecker",this.objectEqualityChecker,this.parent.treeGrid.grid)},e.prototype.dataBound=function(e){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.isVirtualScroll=!1),this.prevCurrentView=t.extend([],[],this.parent.currentViewData,!0)},e.prototype.dataStateChange=function(e){e.action&&"refresh"===e.action.requestType&&(this.parent.treeGrid.dataSource={result:t.getValue("result",this.parent.treeGrid.dataSource),count:t.getValue("count",this.parent.treeGrid.dataSource)}),this.parent.trigger("dataStateChange",e)},e.prototype.collapsing=function(e){new a.Deferred;if(!this.parent.ganttChartModule.isExpandCollapseFromChart){var i=this.createExpandCollapseArgs(e);this.parent.ganttChartModule.collapseGanttRow(i),t.setValue("cancel",t.getValue("cancel",i),e)}},e.prototype.expanding=function(e){new a.Deferred;if(!this.parent.ganttChartModule.isExpandCollapseFromChart){var i=this.createExpandCollapseArgs(e);this.parent.ganttChartModule.expandGanttRow(i),t.setValue("cancel",t.getValue("cancel",i),e)}},e.prototype.collapsed=function(e){if(!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var i=this.createExpandCollapseArgs(e);this.parent.ganttChartModule.collapsedGanttRow(i),"ResourceView"===this.parent.viewType&&!this.parent.allowTaskbarOverlap&&i.gridRow&&(i.gridRow.style.height=i.chartRow.style.height,this.parent.contentHeight=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()},e.prototype.expanded=function(e){if(!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod&&!e.data.length){var i=this.createExpandCollapseArgs(e);this.parent.ganttChartModule.expandedGanttRow(i),"ResourceView"===this.parent.viewType&&!this.parent.allowTaskbarOverlap&&e.row&&(e.row.style.height=this.parent.rowHeight+"px",this.parent.contentHeight=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()},e.prototype.actionBegin=function(e){this.parent.notify("actionBegin",e);null!==t.getValue("doubleClickTarget",this.parent.treeGrid.editModule)&&t.setValue("doubleClickTarget",null,this.parent.treeGrid.editModule),this.parent.trigger("actionBegin",e),"virtualscroll"!=e.requestType&&"edit"!=e.type&&"beginEdit"!=e.requestType&&(t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow())},e.prototype.created=function(e){this.updateKeyConfigSettings()},e.prototype.actionFailure=function(e){this.parent.trigger("actionFailure",e)},e.prototype.createExpandCollapseArgs=function(e){var i=t.getValue("data",e);return{data:i,gridRow:t.getValue("row",e),chartRow:this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(i)],cancel:!1}},e.prototype.treeActionComplete=function(e){var i=t.extend({},e);if("sorting"===t.getValue("requestType",e))this.parent.notify("updateModel",{}),t.deleteObject(i,"isFrozen");else if("filtering"===t.getValue("requestType",e)){this.parent.notify("updateModel",{});this.parent.element.querySelector(".e-treegrid").focus()}else if("save"===t.getValue("type",e)&&this.parent.editModule&&this.parent.editModule.cellEditModule){var r=t.getValue("data",e);t.isNullOrUndefined(r)||t.isNullOrUndefined(this.parent.getTaskByUniqueID(r.uniqueID))||(this.parent.getTaskByUniqueID(r.uniqueID).taskData[this.parent.taskFields.duration]=r.taskData[this.parent.taskFields.duration],t.isNullOrUndefined(r.taskData[this.parent.taskFields.resourceInfo])||(this.parent.getTaskByUniqueID(r.uniqueID).taskData[this.parent.taskFields.resourceInfo]=r.taskData[this.parent.taskFields.resourceInfo])),this.parent.editModule.cellEditModule.initiateCellEdit(e,this.currentEditRow),this.currentEditRow={}}if("filterafteropen"===t.getValue("requestType",e)&&this.parent.notify("actionComplete",e),"searching"===t.getValue("requestType",e)&&this.parent.notify("actionComplete",e),t.isNullOrUndefined(t.getValue("batchChanges",e))||t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),this.parent.isCancelled&&(t.setValue("requestType","cancel",i),t.setValue("action","CellEditing",i),this.parent.isCancelled=!1),"refresh"===t.getValue("requestType",e)&&t.isNullOrUndefined(t.getValue("type",e))&&this.parent.addDeleteRecord&&(-1!=this.parent.selectedRowIndex?(this.parent.selectRow(this.parent.selectedRowIndex),this.parent.selectedRowIndex>this.parent.currentViewData.length-1&&(this.parent.selectedRowIndex=-1)):this.parent.selectRow(0),this.parent.addDeleteRecord=!1),this.parent.trigger("actionComplete",i),"ResourceView"===this.parent.viewType&&!this.parent.allowTaskbarOverlap&&this.parent.showOverAllocation){for(var a=0;a<this.parent.currentViewData.length;a++)this.parent.currentViewData[a].hasChildRecords&&!this.parent.currentViewData[a].expanded&&this.parent.chartRowsModule.updateDragDropRecords(this.parent.currentViewData[a]);this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)}t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()},e.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},e.prototype.wireEvents=function(){var e=this.parent.treeGrid.element.querySelector(".e-content");e&&t.EventHandler.add(e,"scroll",this.scrollHandler,this),this.parent.isAdaptive&&t.EventHandler.add(this.parent.treeGridPane,"click",this.treeGridClickHandler,this)},e.prototype.unWireEvents=function(){var e=this.parent.treeGrid.element&&this.parent.treeGrid.element.querySelector(".e-content");e&&t.EventHandler.remove(e,"scroll",this.scrollHandler),this.parent.isAdaptive&&t.EventHandler.remove(this.parent.treeGridPane,"click",this.treeGridClickHandler)},e.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()},e.prototype.validateGanttColumns=function(){var e=this.parent,i=e.columns.length,r=this.parent.taskFields;this.parent.columnMapping={},this.parent.columnByField={},this.parent.customColumns=[];for(var a=["id","name","startDate","endDate","duration","dependency","progress","baselineStartDate","baselineEndDate","resourceInfo","notes","work","manual","type","milestone"],n=function(t){var i={};"string"==typeof e.columns[t]?i.field=e.columns[t]:i=e.columns[t];var n=[];if(a.length>0&&(n=a.filter(function(e){return i.field===r[e]})),0===n.length)return i.field===s.parent.resourceFields.group?"continue":(s.parent.customColumns.push(i.field),i.headerText=i.headerText?i.headerText:i.field,i.width=i.width?i.width:150,i.editType=i.editType?i.editType:"stringedit",i.type=i.type?i.type:"string",s.bindTreeGridColumnProperties(i,!0),"continue");var o=a.indexOf(n[0]);a.splice(o,1),s.createTreeGridColumn(i,!0),s.parent.columnMapping[n[0]]=i.field},s=this,o=0;o<i;o++)n(o);for(var l=0;l<a.length;l++){var d={};t.isNullOrUndefined(r[a[l]])||(d.field=r[a[l]],this.createTreeGridColumn(d,0===i),this.parent.columnMapping[a[l]]=d.field)}if("ProjectView"!==this.parent.viewType){d={};this.composeUniqueIDColumn(d),this.createTreeGridColumn(d,!0)}},e.prototype.createTreeGridColumn=function(e,i){var r=this.parent.taskFields,n=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];if(e.disableHtmlEncode=t.isNullOrUndefined(e.disableHtmlEncode)?this.parent.disableHtmlEncode:e.disableHtmlEncode,r.id!==e.field&&(e.clipMode=e.clipMode?e.clipMode:"EllipsisWithTooltip"),r.id===e.field)this.composeIDColumn(e);else if(r.name===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("name"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("name"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"stringedit",e.type=e.type?e.type:"string";else if(r.startDate===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("startDate"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("startDate"),e.editType=e.editType?e.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",e.format=e.format?e.format:{type:"date",format:this.parent.getDateFormat()},e.width=e.width?e.width:150,(!e.edit||e.edit&&!e.edit.create)&&(e.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}});else if(r.endDate===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("endDate"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("endDate"),e.format=e.format?e.format:{type:"date",format:this.parent.getDateFormat()},e.editType=e.editType?e.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",e.width=e.width?e.width:150,(!e.edit||e.edit&&!e.edit.create)&&(e.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}});else if(r.duration===e.field)e.width=e.width?e.width:150,this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("duration"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("duration"),e.valueAccessor=e.valueAccessor?e.valueAccessor:t.isNullOrUndefined(e.edit)?this.durationValueAccessor.bind(this):null,e.editType=e.editType?e.editType:"stringedit",e.type=e.type?e.type:"string";else if(r.progress===e.field)this.composeProgressColumn(e);else if(r.dependency===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("dependency"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("dependency"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"stringedit",e.type="string",e.allowFiltering=!1!==e.allowFiltering;else if(r.resourceInfo===e.field)this.composeResourceColumn(e);else if(r.notes===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("notes"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("notes"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"stringedit",this.parent.showInlineNotes||e.template||(e.template='<div class="e-ganttnotes-info"><span class="e-icons e-notes-info"></span></div>');else if(r.baselineStartDate===e.field||r.baselineEndDate===e.field){var s=r.baselineEndDate===e.field?"baselineEndDate":"baselineStartDate";e.width=e.width?e.width:150,this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant(s):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant(s),e.format=e.format?e.format:{type:"date",format:this.parent.getDateFormat()},e.editType=e.editType?e.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit"}else r.work===e.field?(this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("work"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("work"),e.width=e.width?e.width:150,e.valueAccessor=e.valueAccessor?e.valueAccessor:this.workValueAccessor.bind(this),e.editType=e.editType?e.editType:"numericedit"):r.type===e.field?(this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("taskType"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("taskType"),e.width=e.width?e.width:150,e.editType="dropdownedit",e.valueAccessor=e.valueAccessor?e.valueAccessor:this.taskTypeValueAccessor.bind(this)):r.manual===e.field&&"Custom"===this.parent.taskMode&&(this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("taskMode"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("taskMode"),e.width=e.width?e.width:120,e.editType=e.editType?e.editType:"dropdownedit",e.valueAccessor=e.valueAccessor?e.valueAccessor:this.modeValueAccessor.bind(this),e.edit={params:{query:new a.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"}}});this.bindTreeGridColumnProperties(e,i)},e.prototype.composeResourceColumn=function(e){var t=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];this.parent.isLocaleChanged&&t?e.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("resourceName"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("resourceName"),e.width=e.width?e.width:150,e.type="string",e.valueAccessor=e.valueAccessor?e.valueAccessor:this.resourceValueAccessor.bind(this),e.allowFiltering=!1!==e.allowFiltering},e.prototype.getResourceIds=function(e){var i=t.getValue(this.parent.taskFields.resourceInfo,e.taskData),r=[];if(t.isNullOrUndefined(i))return i;for(var a=0;a<i.length;a++)r.push("object"==typeof i[a]?i[a][this.parent.resourceFields.id]:i[a]);return r},e.prototype.composeIDColumn=function(e){var i,r="ProjectView"===this.parent.viewType,a=this.parent.dataSource.length;if(e.isPrimaryKey=!!r,this.parent.isLocaleChanged){var n=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];n&&(e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("id"))}else e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("id");e.width=e.width?e.width:100;for(var s=0;s<a;s++)if(!t.isNullOrUndefined(this.parent.dataSource[s][this.parent.taskFields.id])){i=this.parent.dataSource[s][this.parent.taskFields.id];break}"string"==typeof i||t.isNullOrUndefined(i)?("ResourceView"===this.parent.viewType?e.allowEditing=!!e.allowEditing&&e.allowEditing:e.allowEditing=!e.allowEditing||e.allowEditing,e.editType=e.editType?e.editType:"stringedit"):(e.allowEditing=!!e.allowEditing&&e.allowEditing,e.editType=e.editType?e.editType:"numericedit"),e.valueAccessor=r?null:this.idValueAccessor.bind(this)},e.prototype.composeUniqueIDColumn=function(e){e.field="rowUniqueID",e.isPrimaryKey=!0,e.headerText="UniqueID",e.allowEditing=!1,e.visible=!1},e.prototype.composeProgressColumn=function(e){var t=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];this.parent.isLocaleChanged&&t?e.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("progress"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("progress"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"numericedit"},e.prototype.bindTreeGridColumnProperties=function(e,t){for(var i={},r={},a=0,n=Object.keys(e);a<n.length;a++){var s=n[a];i[s]=r[s]=e[s]}this.parent.columnByField[r.field]=r,this.parent.ganttColumns.push(new Ge(r)),t&&this.treeGridColumns.push(i)},e.prototype.durationValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":this.parent.dataOperation.getDurationString(a.duration,a.durationUnit)},e.prototype.resourceValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":a.resourceNames},e.prototype.workValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":this.parent.dataOperation.getWorkString(a.work,a.workUnit)},e.prototype.taskTypeValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":a.taskType},e.prototype.modeValueAccessor=function(e,t,i){return t[e]?"Manual":"Auto"},e.prototype.idValueAccessor=function(e,t,i){return 0===t.level?"R-"+t.ganttProperties.taskId:"T-"+t.ganttProperties.taskId},e.prototype.updateScrollTop=function(e){var i;i=t.getValue("top",e)>this.parent.flatData.length*this.parent.rowHeight?t.getValue("top",e)-document.getElementsByClassName("e-chart-scroll-container e-content")[0].offsetHeight:t.getValue("top",e),this.treeGridElement.querySelector(".e-content").scrollTop=i,this.previousScroll.top=this.treeGridElement.querySelector(".e-content").scrollTop},e.prototype.treeGridClickHandler=function(e){this.parent.notify("treeGridClick",e)},e.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)},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.parent.treeGrid.element&&this.parent.treeGrid.destroy()},e}(),_e=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Xe=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ye=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return _e(i,e),Xe([t.Property(null)],i.prototype,"from",void 0),Xe([t.Property(null)],i.prototype,"to",void 0),i}(t.ChildProperty),Ze=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qe=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ze(i,e),Qe([t.Property(null)],i.prototype,"type",void 0),Qe([t.Property(null)],i.prototype,"headerText",void 0),Qe([t.Property([])],i.prototype,"fields",void 0),i}(t.ChildProperty),Je=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),$e=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},et=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Je(i,e),$e([t.Property(null)],i.prototype,"type",void 0),$e([t.Property(null)],i.prototype,"headerText",void 0),$e([t.Property([])],i.prototype,"fields",void 0),i}(t.ChildProperty),tt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),it=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},rt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return tt(i,e),it([t.Property(!1)],i.prototype,"allowEditing",void 0),it([t.Property(!1)],i.prototype,"allowAdding",void 0),it([t.Property(!1)],i.prototype,"allowDeleting",void 0),it([t.Property("Auto")],i.prototype,"mode",void 0),it([t.Property("Top")],i.prototype,"newRowPosition",void 0),it([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),it([t.Property(!1)],i.prototype,"allowTaskbarEditing",void 0),it([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),at=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),nt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},st=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return at(i,e),nt([t.Property(null)],i.prototype,"day",void 0),nt([t.Property(null)],i.prototype,"label",void 0),nt([t.Property(null)],i.prototype,"cssClass",void 0),i}(t.ChildProperty),ot=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),lt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},dt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ot(i,e),lt([t.Collection([],r.Predicate)],i.prototype,"columns",void 0),lt([t.Property("Menu")],i.prototype,"type",void 0),lt([t.Property()],i.prototype,"operators",void 0),lt([t.Property(!1)],i.prototype,"ignoreAccent",void 0),lt([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),ht=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),pt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ct=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ht(i,e),pt([t.Property([])],i.prototype,"fields",void 0),pt([t.Property(!1)],i.prototype,"ignoreCase",void 0),pt([t.Property("contains")],i.prototype,"operator",void 0),pt([t.Property("")],i.prototype,"key",void 0),pt([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),ut=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),gt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ft=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ut(i,e),gt([t.Property(null)],i.prototype,"from",void 0),gt([t.Property(null)],i.prototype,"to",void 0),gt([t.Property(null)],i.prototype,"label",void 0),gt([t.Property(null)],i.prototype,"cssClass",void 0),i}(t.ChildProperty),mt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),yt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Dt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return mt(i,e),yt([t.Property(null)],i.prototype,"rightLabel",void 0),yt([t.Property(null)],i.prototype,"leftLabel",void 0),yt([t.Property(null)],i.prototype,"taskLabel",void 0),i}(t.ChildProperty),vt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),wt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},kt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return vt(i,e),wt([t.Property("Row")],i.prototype,"mode",void 0),wt([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),wt([t.Property("Single")],i.prototype,"type",void 0),wt([t.Property(!1)],i.prototype,"persistSelection",void 0),wt([t.Property(!1)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),Tt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),bt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Pt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Tt(i,e),bt([t.Property(null)],i.prototype,"position",void 0),bt([t.Property(-1)],i.prototype,"columnIndex",void 0),bt([t.Property(4)],i.prototype,"separatorSize",void 0),bt([t.Property(null)],i.prototype,"minimum",void 0),bt([t.Property("Default")],i.prototype,"view",void 0),i}(t.ChildProperty),St=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ct=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Mt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return St(i,e),Ct([t.Property(null)],i.prototype,"id",void 0),Ct([t.Property(null)],i.prototype,"name",void 0),Ct([t.Property(null)],i.prototype,"parentID",void 0),Ct([t.Property(null)],i.prototype,"startDate",void 0),Ct([t.Property(null)],i.prototype,"endDate",void 0),Ct([t.Property(null)],i.prototype,"dependency",void 0),Ct([t.Property(null)],i.prototype,"progress",void 0),Ct([t.Property(null)],i.prototype,"child",void 0),Ct([t.Property(null)],i.prototype,"milestone",void 0),Ct([t.Property(null)],i.prototype,"duration",void 0),Ct([t.Property(null)],i.prototype,"durationUnit",void 0),Ct([t.Property(null)],i.prototype,"cssClass",void 0),Ct([t.Property(null)],i.prototype,"baselineStartDate",void 0),Ct([t.Property(null)],i.prototype,"baselineEndDate",void 0),Ct([t.Property(null)],i.prototype,"resourceInfo",void 0),Ct([t.Property(null)],i.prototype,"expandState",void 0),Ct([t.Property(null)],i.prototype,"indicators",void 0),Ct([t.Property(null)],i.prototype,"notes",void 0),Ct([t.Property(null)],i.prototype,"work",void 0),Ct([t.Property(null)],i.prototype,"manual",void 0),Ct([t.Property(null)],i.prototype,"type",void 0),Ct([t.Property(null)],i.prototype,"segments",void 0),Ct([t.Property(null)],i.prototype,"segmentId",void 0),i}(t.ChildProperty),Rt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ot=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},xt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Rt(i,e),Ot([t.Property("")],i.prototype,"format",void 0),Ot([t.Property("None")],i.prototype,"unit",void 0),Ot([t.Property(1)],i.prototype,"count",void 0),Ot([t.Property(null)],i.prototype,"formatter",void 0),i}(t.ChildProperty),It=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Rt(i,e),Ot([t.Property("Week")],i.prototype,"timelineViewMode",void 0),Ot([t.Complex({},xt)],i.prototype,"topTier",void 0),Ot([t.Complex({},xt)],i.prototype,"bottomTier",void 0),Ot([t.Property(33)],i.prototype,"timelineUnitSize",void 0),Ot([t.Property(0)],i.prototype,"weekStartDay",void 0),Ot([t.Property(null)],i.prototype,"weekendBackground",void 0),Ot([t.Property(!0)],i.prototype,"showTooltip",void 0),Ot([t.Property(!0)],i.prototype,"updateTimescaleView",void 0),i}(t.ChildProperty),Et=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Nt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ft=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Et(i,e),Nt([t.Property(!0)],i.prototype,"showTooltip",void 0),Nt([t.Property()],i.prototype,"taskbar",void 0),Nt([t.Property()],i.prototype,"baseline",void 0),Nt([t.Property()],i.prototype,"connectorLine",void 0),Nt([t.Property()],i.prototype,"editing",void 0),i}(t.ChildProperty),Ut=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Vt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Lt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ut(i,e),Vt([t.Property()],i.prototype,"field",void 0),Vt([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),Bt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ut(i,e),Vt([t.Collection([],Lt)],i.prototype,"columns",void 0),Vt([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),At=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ht=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},jt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return At(i,e),Ht([t.Property(null)],i.prototype,"id",void 0),Ht([t.Property(null)],i.prototype,"name",void 0),Ht([t.Property(null)],i.prototype,"unit",void 0),Ht([t.Property(null)],i.prototype,"group",void 0),i}(t.ChildProperty),Wt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),qt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Gt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Wt(i,e),qt([t.Property("Spinner")],i.prototype,"indicatorType",void 0),i}(t.ChildProperty),zt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),_t=function(e){function i(t){var i=e.call(this,t)||this;return i.taskBarHeight=0,i.milestoneHeight=0,i.milesStoneRadius=0,i.baselineTop=0,i.baselineHeight=8,i.touchLeftConnectorpoint="",i.touchRightConnectorpoint="",i.dropSplit=!1,i.refreshedTr=[],i.refreshedData=[],i.isUpdated=!0,i.parent=t,i.initPublicProp(),i.addEventListener(),i}return zt(i,e),i.prototype.initPublicProp=function(){this.ganttChartTableBody=null},i.prototype.addEventListener=function(){this.parent.on("renderPanels",this.createChartTable,this),this.parent.on("dataReady",this.initiateTemplates,this),this.parent.on("destroy",this.destroy,this)},i.prototype.refreshChartByTimeline=function(){this.taskTable.style.width=t.formatUnit(this.parent.timelineModule.totalTimelineWidth);var e=t.getValue("prevProjectStartDate",this.parent.dataOperation),i=!1;e&&(i=e.getTime()===this.parent.cloneProjectStartDate.getTime()),this.isUpdated=!!(this.parent.isFromOnPropertyChange&&i&&t.getValue("mutableData",this.parent.treeGrid.grid.contentModule)),this.refreshGanttRows(),this.isUpdated=!0},i.prototype.createChartTable=function(){this.taskTable=t.createElement("table",{className:"e-task-table e-zero-spacing",id:"GanttTaskTable"+this.parent.element.id,styles:"position: absolute;width:"+this.parent.timelineModule.totalTimelineWidth+"px;",attrs:{cellspacing:"0.25px"}});var e=t.createElement("colgroup"),i=t.createElement("col",{styles:"width:"+this.parent.timelineModule.totalTimelineWidth+"px;"});e.appendChild(i),this.taskTable.appendChild(e),this.ganttChartTableBody=t.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"}),this.taskTable.appendChild(this.ganttChartTableBody),this.parent.ganttChartModule.chartBodyContent.appendChild(this.taskTable)},i.prototype.initiateTemplates=function(){this.taskTable.style.width=t.formatUnit(this.parent.timelineModule.totalTimelineWidth),this.initChartHelperPrivateVariable(),this.initializeChartTemplate()},i.prototype.renderChartRows=function(){this.createTaskbarTemplate(),this.parent.isGanttChartRendered=!0},i.prototype.getIndicatorNode=function(e){var t='<label class="e-label e-indicator-span"style="line-height:'+this.parent.rowHeight+"px;"+(this.parent.enableRtl?"right:":"left:")+this.getIndicatorleft(e.date)+'px;"><i class="'+e.iconClass+'"></i> </label>';return this.createDivElement(t)},i.prototype.getIndicatorleft=function(e){e=this.parent.dateValidationModule.getDateFromFormat(e);return this.parent.dataOperation.getTaskLeft(e,!1)},i.prototype.getChildTaskbarNode=function(e,i){var r,a=null,n=this.templateData;if(r=this.parent.enableRtl?"right:":"left:",this.childTaskbarTemplateFunction)a=this.childTaskbarTemplateFunction(t.extend({index:e},n),this.parent,"TaskbarTemplate",this.getTemplateID("TaskbarTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var s="",o="",l=void 0,d=void 0;n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration&&(l=this.createDivElement('<div class="'+W+" "+ae+" "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="width:'+n.ganttProperties.width+"px;height:"+this.taskBarHeight+'px; margin-top :-1px"></div>'),d=this.createDivElement('<div class="'+q+" "+ne+" "+(n.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualprogressbar")+'" style="border-style:'+(n.ganttProperties.progressWidth?"solid;":"none;")+"width:"+n.ganttProperties.progressWidth+"px;height:100%;border-top-right-radius:"+this.getBorderRadius(n.ganttProperties)+"px;border-bottom-right-radius:"+this.getBorderRadius(n.ganttProperties)+'px;"></div>'));var h=t.createElement("div");if(this.taskLabelTemplateFunction&&!t.isNullOrUndefined(d)&&d.length>0){var p=this.taskLabelTemplateFunction(t.extend({index:e},n),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&(t.append(p,h),s=h.innerHTML)}else{var c=this.parent.labelSettings.taskLabel;s="isCustomTemplate"===(s=this.getTaskLabel(c))?this.parent.labelSettings.taskLabel:s,this.parent.enableHtmlSanitizer&&"string"==typeof s&&(s=t.SanitizeHtmlHelper.sanitize(s))}-1===s.indexOf("null")&&("isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(s=""),o=isNaN(parseInt(s))?'<span class="'+j+'" style="line-height:'+(this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(n.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="'+j+'" 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?n.ganttProperties.width-10:"")+"px; height:"+this.taskBarHeight+'px;"></span>');var u=!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length>0?this.splitTaskbar(n,s):n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration?o:!n.ganttProperties.startDate||n.ganttProperties.endDate||n.ganttProperties.duration?!n.ganttProperties.endDate||n.ganttProperties.startDate||n.ganttProperties.duration?!n.ganttProperties.duration||n.ganttProperties.startDate||n.ganttProperties.endDate?"":'<div class="'+q+" "+ae+" e-gantt-unscheduled-taskbar "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="'+r+n.ganttProperties.left+"px; width:"+n.ganttProperties.width+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+q+" "+ae+" "+ve+" "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="'+r+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+q+" "+ae+" "+De+" "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="'+r+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>';if(n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration&&(t.isNullOrUndefined(n.ganttProperties.segments)||!t.isNullOrUndefined(n.ganttProperties.segments)&&0===n.ganttProperties.segments.length)){if(""!==u&&!t.isNullOrUndefined(d)&&d.length>0){var g=this.createDivElement(u)[0];this.parent.disableHtmlEncode?g.innerText=s:g.innerHTML=s;var f=this.parent.labelSettings.taskLabel;f&&f.elementRef&&g.appendChild(h),d[0].appendChild(g),""!==d[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(f)&&d[0].querySelectorAll(".e-task-label")[0].children[0]&&d[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===d[0].querySelectorAll(".e-task-label")[0].textContent&&f&&!f.elementRef&&""!==h.innerHTML&&(d[0].querySelectorAll(".e-task-label")[0].textContent=f)}!t.isNullOrUndefined(l)&&l.length>0&&l[0].appendChild([].slice.call(d)[0]),a=l}else a=this.createDivElement(u)}return this.parent.enableRtl&&a[0]&&a[0].querySelector(".e-task-label")&&(a[0].querySelector(".e-task-label").style.marginLeft="15px",a[0].querySelector(".e-task-label").style.marginRight="8px",a[0].querySelector(".e-gantt-child-progressbar")&&(a[0].querySelector(".e-gantt-child-progressbar").style.textAlign="left")),a},i.prototype.splitTaskbar=function(e,t){for(var i="",r=0;r<e.ganttProperties.segments.length;r++){var a=e.ganttProperties.segments[r],n=void 0;n=a.showProgress?"initial":"hidden";var s=0===r?"e-segment-first":r===e.ganttProperties.segments.length-1?"e-segment-last":"e-segment-inprogress";i+='<div class="'+W+" "+s+" "+ae+' e-segmented-taskbar"style="width:'+a.width+"px;position: absolute;"+(this.parent.enableRtl?"right:":"left:")+a.left+"px;height:"+this.taskBarHeight+"px; overflow:"+n+';" data-segment-index = "'+r+'" aria-label = "'+this.generateSpiltTaskAriaLabel(a,e.ganttProperties)+'"> '+this.getSplitTaskbarLeftResizerNode()+'<div class="'+q+" "+ne+' " style="border-style:'+(a.progressWidth?"solid;":"none;")+"display:"+(a.progressWidth>=0?"block;":"none;")+"width:"+a.progressWidth+"px;height:100%;text-align:"+(this.parent.enableRtl?"left;":"right;")+"border-top-right-radius:"+this.getSplitTaskBorderRadius(a)+"px;border-bottom-right-radius:"+this.getSplitTaskBorderRadius(a)+'px;"><span class="'+j+'" style="line-height:'+(this.taskBarHeight-1)+"px;display:"+(a.showProgress?"inline;":"none;")+"height:"+this.taskBarHeight+'px;">'+t+"</span></div>"+this.getSplitTaskbarRightResizerNode(a)+(a.showProgress?this.getSplitProgressResizerNode(a):"")+"</div></div>"}return i},i.prototype.getSplitTaskbarLeftResizerNode=function(){var e=-(this.parent.isAdaptive?12:2);return'<div class="'+K+' e-icon" style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;"></div>'},i.prototype.getSplitTaskbarRightResizerNode=function(e){var t=this.parent.isAdaptive?-2:-10;return'<div class="'+J+' e-icon" style="'+(this.parent.enableRtl?"right:":"left:")+(e.width+t)+"px;height:"+this.taskBarHeight+'px;"></div>'},i.prototype.getSplitProgressResizerNode=function(e){var t=this.parent.enableRtl?e.progressWidth+8:e.progressWidth-6;return'<div class="'+$+'" style="'+(this.parent.enableRtl?"right:":"left:")+t+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+ee+'"><div class="'+te+'"></div><div class="'+ie+'"></div></div>'},i.prototype.getSegmentIndex=function(e,i){var r=-1,a=i.ganttProperties,n=a.segments;if(!t.isNullOrUndefined(n)){n.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()});for(var s=n.length,o=0;o<s;o++){var l=n[o];if(e.getTime()===a.startDate.getTime())this.dropSplit=!0,r=0;else if(e.getTime()===l.startDate.getTime()){this.dropSplit=!0;var d=l.startDate;d.setDate(d.getDate()+1),d=l.startDate=this.parent.dataOperation.checkStartDate(d,a,!1),l.startDate=d;var h=l.endDate;h=this.parent.dataOperation.getEndDate(d,l.duration,a.durationUnit,a,!1),l.endDate=h,o===n.length-1&&this.parent.setRecordValue("endDate",h,a,!0),this.incrementSegments(n,o,i),r=l.segmentIndex}else l.endDate=this.parent.dataOperation.getEndDate(l.startDate,l.duration,a.durationUnit,a,!1),e.getTime()>=l.startDate.getTime()&&e.getTime()<=l.endDate.getTime()&&(r=l.segmentIndex);this.parent.setRecordValue("segments",a.segments,a,!0)}}return-1===r&&(this.dropSplit=!0),r},i.prototype.mergeTask=function(e,t){var i=t.length,r=this.parent.taskFields,a=this.parent.flatData.filter(function(t){return t[r.id]===e?t:null})[0],n=a.ganttProperties.segments;t=t.sort(function(e,t){return t.firstSegmentIndex-e.firstSegmentIndex});for(var s=0;s<i;s++){var o=n[t[s].firstSegmentIndex],l=n[t[s].secondSegmentIndex],d=o.duration+l.duration,h=this.parent.dataOperation.getEndDate(o.startDate,d,a.ganttProperties.durationUnit,a.ganttProperties,!1),p={startDate:o.startDate,endDate:h,duration:d},c=t[s].firstSegmentIndex;n.splice(c,2,p),this.parent.setRecordValue("segments",n,a.ganttProperties,!0),this.parent.dataOperation.updateMappingData(a,"segments"),1===n.length?(this.parent.setRecordValue("endDate",h,a.ganttProperties,!0),this.parent.setRecordValue("EndDate",h,a,!0),this.parent.setRecordValue("segments",null,a.ganttProperties,!0),this.parent.dataOperation.updateMappingData(a,"segments")):a.ganttProperties.endDate!==n[n.length-1].endDate&&this.parent.setRecordValue("endDate",n[n.length-1].endDate,a.ganttProperties,!0)}this.refreshChartAfterSegment(a,"mergeSegment")},i.prototype.refreshChartAfterSegment=function(e,i){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.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)):this.refreshRow(this.parent.currentViewData.indexOf(e));var r=this.ganttChartTableBody.querySelectorAll("tr")[this.parent.currentViewData.indexOf(e)],a={requestType:i,rowData:e};this.triggerQueryTaskbarInfoByIndex(r,e),this.parent.selectionModule.clearSelection();var n=a.rowData.taskData[this.parent.taskFields.segments];if(this.parent.timezone&&null!=n)for(var s=0;s<n.length;s++)n[s][this.parent.taskFields.startDate]=this.parent.dateValidationModule.remove(a.rowData.ganttProperties.segments[s].startDate,this.parent.timezone),this.parent.taskFields.endDate&&(n[s][this.parent.taskFields.endDate]=this.parent.dateValidationModule.remove(a.rowData.ganttProperties.segments[s].endDate,this.parent.timezone));this.parent.trigger("actionComplete",a),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),t.setValue("isEdit",!1,this.parent.contextMenuModule),t.setValue("isEdit",!1,this.parent)},i.prototype.splitTask=function(e,i){var r=this.parent.taskFields,a=i,n=this.parent.flatData.filter(function(t){return t[r.id]===e?t:null})[0],s=n.ganttProperties;this.dropSplit=!1;var o=-1,l=s.segments;if(t.isNullOrUndefined(i.length)||i.length<0){var d=this.parent.dataOperation.checkStartDate(a,s,!1);if(d.getTime()!==s.startDate.getTime()&&s.isAutoSchedule){if(!t.isNullOrUndefined(l)&&l.length>0&&(o=this.getSegmentIndex(d,n)),!1===this.dropSplit&&a.getTime()>s.startDate.getTime()&&a.getTime()<s.endDate.getTime()){l=-1!==o?l:[];var h=-1!==o?l[o].startDate:new Date(s.startDate.getTime()),p=-1!==o?l[o].endDate:new Date(s.endDate.getTime()),c=this.parent.dataOperation.getDuration(h,p,s.durationUnit,s.isAutoSchedule,s.isMilestone);this.parent.setRecordValue("segments",this.splitSegmentedTaskbar(h,p,a,o,l,n,c),s,!0),-1!==o&&this.incrementSegments(l,o+1,n),this.parent.setRecordValue("endDate",l[l.length-1].endDate,s,!0),this.parent.taskFields.endDate&&this.parent.dataOperation.updateMappingData(n,"endDate")}this.refreshChartAfterSegment(n,"splitTaskbar")}}else i.sort(function(e,t){return e.getTime()-t.getTime()}),this.parent.setRecordValue("segments",this.constructSegments(i,n.ganttProperties),n.ganttProperties,!0),this.refreshChartAfterSegment(n,"splitTask")},i.prototype.constructSegments=function(e,t){for(var i,r,a,n=[],s=new Date,o=0;o<e.length+1&&(s=0===o?t.startDate:s,s=this.parent.dataOperation.checkStartDate(s,t,!1),r=o!==e.length?new Date(e[o].getTime())>t.endDate?t.endDate:new Date(e[o].getTime()):t.endDate,r=this.parent.dataOperation.checkEndDate(r,t,!1),a=this.parent.dataOperation.getDuration(s,r,t.durationUnit,t.isAutoSchedule,t.isMilestone),r.getTime()>=s.getTime()&&(i={startDate:s,endDate:r,duration:a},n.push(i)),o!==e.length);o++)(s=new Date(e[o].getTime())).setDate(e[o].getDate()+1);return n},i.prototype.splitSegmentedTaskbar=function(e,t,i,r,a,n,s){var o=n.ganttProperties,l=this.parent.nonWorkingDayIndex.indexOf(i.getDay()),d=-1===l?0:0===l?1:2;e=this.parent.dataOperation.checkStartDate(e,o,!1);var h=new Date(i.getTime());h=this.parent.dataOperation.checkEndDate(h,o,!1);for(var p=0;p<2;p++){var c={startDate:e,endDate:h,duration:this.parent.dataOperation.getDuration(e,h,o.durationUnit,o.isAutoSchedule,o.isMilestone),offsetDuration:1},u=this.parent.nonWorkingDayIndex.indexOf(h.getDay());-1!==r&&(a.splice(r,1),r=-1),a.push(c);var g=this.parent.timelineModule.customTimelineSettings.bottomTier.unit;if("Hour"===g||"Minutes"===g){e=new Date(i.getTime()),e=this.parent.dataOperation.checkStartDate(e,o,!1);var f=this.parent.timelineModule.customTimelineSettings.bottomTier.count,m=this.parent.timelineModule.customTimelineSettings.bottomTier.unit,y=this.parent.timelineModule.getIncrement(e,f,m),D=e.getTime()+y;e.setTime(D+d),h=new Date(t.getTime()),y=this.parent.timelineModule.getIncrement(h,f,m),D=h.getTime()+y,h.setTime(D+d)}else(e=new Date(i.getTime())).setDate(e.getDate()+1+d),this.setTime(this.parent.defaultStartTime,e),e=this.parent.dataOperation.checkStartDate(e,o,!1),(h=new Date(t.getTime())).setDate(h.getDate()+1);if(-1!==u){var v=s-c.duration;h=this.parent.dataOperation.getEndDate(e,v,o.durationUnit,o,!1)}else h=this.parent.dataOperation.checkEndDate(h,o,!1)}return a.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),a},i.prototype.incrementSegments=function(e,t,i){for(var r=i.ganttProperties,a=t+1;a<e.length;a++){var n=e[a],s=0!==a?new Date(e[a-1].endDate.getTime()):new Date(n.startDate.getTime());s=this.parent.dataOperation.getEndDate(s,n.offsetDuration,r.durationUnit,r,!1),s=this.parent.dataOperation.checkStartDate(s,r,!1),n.startDate=s;var o=n.endDate=this.parent.dataOperation.getEndDate(s,n.duration,r.durationUnit,r,!1);n.endDate=o,a===e.length-1&&(this.parent.setRecordValue("endDate",o,r,!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,r,!0),this.parent.dataOperation.updateMappingData(i,"segments")},i.prototype.getMilestoneNode=function(e,i){var r=null,a=this.templateData;if(this.milestoneTemplateFunction)r=this.milestoneTemplateFunction(t.extend({index:e},a),this.parent,"MilestoneTemplate",this.getTemplateID("MilestoneTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var n='<div class="'+re+'" 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:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';r=this.createDivElement(n)}return r},i.prototype.getTaskBaselineNode=function(){var e=this.templateData,t='<div class="'+X+' " 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(t)},i.prototype.getMilestoneBaselineNode=function(){var e=this.templateData,t=this.parent.renderBaseline?5:2,i='<div class="'+Y+'" style="width:'+(2+(this.parent.renderBaseline?this.taskBarHeight-5:this.taskBarHeight-10))+"px;height:"+(2+(this.parent.renderBaseline?this.taskBarHeight-5: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.left-this.milestoneHeight/2+2)+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+"margin-top:"+(-Math.floor(this.parent.rowHeight-this.milestoneMarginTop)+t+3)+'px"> </div>';return this.createDivElement(i)},i.prototype.getLeftLabelNode=function(e){var i=this.leftLabelContainer();""!==this.generateTaskLabelAriaLabel("left")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("left"));var r=null;if(this.leftTaskLabelTemplateFunction)r=this.leftTaskLabelTemplateFunction(t.extend({index:e},this.templateData),this.parent,"LeftLabelTemplate",this.getTemplateID("LeftLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var a=this.parent.labelSettings.leftLabel,n=this.getTaskLabel(a);n&&(n="isCustomTemplate"===n?a:n,r=this.getLableText(n,L),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=t.SanitizeHtmlHelper.sanitize(n))?a:n,r=this.getLableText(n,L)))}return r&&r.length>0&&("null"===r[0].data&&(r[0].data=""),t.append(r,i[0])),this.parent.enableRtl&&(i[0].style.paddingLeft="25px",i[0].style.paddingRight="0px"),i},i.prototype.getLableText=function(e,i){var r=this.parent.renderBaseline?(this.parent.rowHeight-this.taskBarHeight)/2:this.taskBarMarginTop,a=t.createElement("div",{className:i,styles:"height:"+this.taskBarHeight+"px;margin-top:"+r+"px;"}),n=t.createElement("span",{className:ye});n[this.parent.disableHtmlEncode?"textContent":"innerHTML"]=e,a.appendChild(n);var s=t.createElement("div");return s.appendChild(a),s.childNodes},i.prototype.getRightLabelNode=function(e){var i=this.rightLabelContainer();""!==this.generateTaskLabelAriaLabel("right")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("right"));var r=null;if(this.rightTaskLabelTemplateFunction)r=this.rightTaskLabelTemplateFunction(t.extend({index:e},this.templateData),this.parent,"RightLabelTemplate",this.getTemplateID("RightLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var a=this.parent.labelSettings.rightLabel,n=this.getTaskLabel(a);n&&(n="isCustomTemplate"===n?a:n,r=this.getLableText(n,A),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=t.SanitizeHtmlHelper.sanitize(n))?a:n,r=this.getLableText(n,A)))}return r&&r.length>0&&("null"===r[0].data&&(r[0].data=""),t.append(r,i[0])),this.parent.enableRtl&&(i[0].style.marginLeft="0px",i[0].style.paddingRight="25px"),i},i.prototype.getManualTaskbar=function(){var e=this.templateData,t=this.taskBarHeight/2-1,i=e.ganttProperties.startDate&&e.ganttProperties.endDate&&e.ganttProperties.duration?'<div class="'+oe+'" 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="'+oe+" "+(e.ganttProperties.startDate?De:ve)+'" 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="'+oe+' 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>',r='<div class="'+se+'"style='+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.left-e.ganttProperties.autoLeft)+"px;width:"+e.ganttProperties.width+"px;height:"+t+"px;>"+i+(e.ganttProperties.startDate&&e.ganttProperties.endDate&&e.ganttProperties.duration||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>":""),a='<div class="'+le+'" 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:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';return this.createDivElement(0!==e.ganttProperties.duration?r:a)},i.prototype.getParentTaskbarNode=function(e,i){var r=null,a=this.templateData;if(this.parentTaskbarTemplateFunction)r=this.parentTaskbarTemplateFunction(t.extend({index:e},a),this.parent,"ParentTaskbarTemplate",this.getTemplateID("ParentTaskbarTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var n="",s=void 0,o=this.taskBarHeight/5,l=this.createDivElement('<div class="e-gantt-parent-taskbar-inner-div '+this.getExpandClass(a)+" "+pe+'" style="width:'+(a.ganttProperties.isAutoSchedule?a.ganttProperties.width:a.ganttProperties.autoWidth)+"px;height:"+(a.ganttProperties.isAutoSchedule?this.taskBarHeight:3*o)+"px;margin-top:"+(a.ganttProperties.isAutoSchedule?-1:2*o)+'px; "></div>'),d=this.createDivElement('<div class="e-gantt-parent-progressbar-inner-div '+this.getExpandClass(a)+" "+ce+'" style="border-style:'+(a.ganttProperties.progressWidth?"solid;":"none;")+"width:"+a.ganttProperties.progressWidth+"px;border-top-right-radius:"+this.getBorderRadius(a)+"px;border-bottom-right-radius:"+this.getBorderRadius(a)+'px;height:100%;"></div>'),h=t.createElement("div");if(this.taskLabelTemplateFunction){var p=this.taskLabelTemplateFunction(t.extend({index:e},a),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&(t.append(p,h),n=h.innerHTML)}else n="isCustomTemplate"===(n=this.getTaskLabel(this.parent.labelSettings.taskLabel))?this.parent.labelSettings.taskLabel:n,this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n=t.SanitizeHtmlHelper.sanitize(n));if(-1===n.indexOf("null")){"isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(n=""),s=isNaN(parseInt(n))?'<span class="'+j+'" style="line-height:'+(a.isManual&&a.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(a.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="'+j+'" style="line-height:'+(a.isManual&&a.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display:inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(a.ganttProperties.width-10):"")+"px; height:"+(this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display: inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(a.ganttProperties.width-10):"")+"px; height:"+this.taskBarHeight+'px;"></span>';var c=this.createDivElement(s)[0];this.parent.disableHtmlEncode?c.innerText=n:c.innerHTML=n;var u=this.parent.labelSettings.taskLabel;u&&u.elementRef&&c.appendChild(h),d[0].appendChild(c),""!==d[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(u)&&d[0].querySelectorAll(".e-task-label")[0].children[0]&&d[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===d[0].querySelectorAll(".e-task-label")[0].textContent&&u&&!u.elementRef&&""!==h.innerHTML&&(d[0].querySelectorAll(".e-task-label")[0].textContent=u)}var g='<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:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';l[0].appendChild([].slice.call(d)[0]),r=a.ganttProperties.isMilestone?this.createDivElement(a.ganttProperties.isAutoSchedule?g:""):l}return this.parent.enableRtl&&r[0]&&r[0].querySelector(".e-task-label")&&(r[0].querySelector(".e-task-label").style.marginLeft="15px",r[0].querySelector(".e-task-label").style.marginRight="8px",r[0].querySelector(".e-gantt-parent-progressbar")&&(r[0].querySelector(".e-gantt-parent-progressbar").style.textAlign="left")),r},i.prototype.getTableTrNode=function(e){var i,r=t.createElement("table"),a="Horizontal"===this.parent.gridLines||"Both"===this.parent.gridLines?"e-chart-row-border":"",n=this.parent.treeGrid.grid.contentModule.getRows()[e];return i=n&&n.isSelected?"e-active":"",r.innerHTML='<tr class="'+this.getRowClassName(this.templateData)+" "+Q+" "+i+'"style="display:'+this.getExpandDisplayProp(this.templateData)+";height:"+this.parent.rowHeight+'px;"><td class="'+Z+" "+a+'"style="width:'+this.parent.timelineModule.totalTimelineWidth+'px;"></td></tr>',r.childNodes},i.prototype.initializeChartTemplate=function(){t.isNullOrUndefined(this.parent.parentTaskbarTemplate)||(this.parentTaskbarTemplateFunction=this.templateCompiler(this.parent.parentTaskbarTemplate)),!t.isNullOrUndefined(this.parent.labelSettings.leftLabel)&&this.isTemplate(this.parent.labelSettings.leftLabel)&&(this.leftTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.leftLabel)),!t.isNullOrUndefined(this.parent.labelSettings.rightLabel)&&this.isTemplate(this.parent.labelSettings.rightLabel)&&(this.rightTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.rightLabel)),!t.isNullOrUndefined(this.parent.labelSettings.taskLabel)&&this.isTemplate(this.parent.labelSettings.taskLabel)&&(this.taskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.taskLabel)),t.isNullOrUndefined(this.parent.taskbarTemplate)||(this.childTaskbarTemplateFunction=this.templateCompiler(this.parent.taskbarTemplate)),t.isNullOrUndefined(this.parent.milestoneTemplate)||(this.milestoneTemplateFunction=this.templateCompiler(this.parent.milestoneTemplate))},i.prototype.createDivElement=function(e){var i=t.createElement("div");return i.innerHTML=e,i.childNodes},i.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("#")||e.indexOf("<")>-1||e.indexOf("$")>-1||!t},i.prototype.getTemplateID=function(e){return this.parent.element.id+e},i.prototype.leftLabelContainer=function(){var e='<div class="'+(this.leftTaskLabelTemplateFunction?"e-left-label-container e-left-label-temp-container":V)+' " tabindex="-1" role="term" style="height:'+(this.parent.rowHeight-2)+"px;width:"+this.taskNameWidth(this.templateData)+'"></div>';return this.createDivElement(e)},i.prototype.taskbarContainer=function(){var e=this.templateData,t=!(!this.parent.editModule||!this.parent.editSettings.allowTaskbarEditing||"ParentResizing"!==this.parent.editModule.taskbarEditModule.taskBarEditAction),i='<div class="'+H+" "+this.parent.getUnscheduledTaskClass(e.ganttProperties)+" "+(e.ganttProperties.cssClass?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:"+(e.ganttProperties.isAutoSchedule?"move;":"auto;"):"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;")+'"></div>';return this.createDivElement(i)},i.prototype.rightLabelContainer=function(){var e='<div class="'+(this.rightTaskLabelTemplateFunction?"e-right-label-container e-right-label-temp-container":B)+'" 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)},i.prototype.childTaskbarLeftResizer=function(){var e=-(this.parent.isAdaptive?12:2),t='<div class="'+K+' e-icon"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;"></div>';return this.createDivElement(t)},i.prototype.childTaskbarRightResizer=function(){var e=this.parent.isAdaptive?-2:-10,t='<div class="'+J+' e-icon"style="'+(this.parent.enableRtl?"right:":"left:")+(this.templateData.ganttProperties.width+e)+"px;height:"+this.taskBarHeight+'px;"></div>';return this.createDivElement(t)},i.prototype.childTaskbarProgressResizer=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6,t='<div class="'+$+'"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+ee+'"><div class="'+te+'"></div><div class="'+ie+'"></div></div>';return this.createDivElement(t)},i.prototype.getLeftPointNode=function(){var e,t=this.templateData,i=-((this.parent.isAdaptive?14:2)+this.connectorPointWidth),r=-(this.connectorPointWidth+2),a=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2);e=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px";var n='<div class="e-left-connectorpoint-outer-div" style="'+(t.ganttProperties.isMilestone?"margin-top:"+a+"px;left:"+r+"px;":e+";left:"+i+"px;")+'"><div class="'+Me+" "+this.parent.getUnscheduledTaskClass(t.ganttProperties)+'" style="width: '+this.connectorPointWidth+"px;"+(this.parent.enableRtl?"margin-right:2px;":"")+"height: "+this.connectorPointWidth+'px;">'+this.touchLeftConnectorpoint+"</div></div>";return this.createDivElement(n)},i.prototype.getRightPointNode=function(){var e,t=this.templateData,i=this.parent.isAdaptive?10:-2,r=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2);e=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px";var a='<div class="'+Ie+'" style="'+(t.ganttProperties.isMilestone?"left:"+(this.milestoneHeight-2)+"px;margin-top:"+r+"px;":"left:"+(t.ganttProperties.width+i)+"px;"+e+";")+'"><div class="'+Re+" "+this.parent.getUnscheduledTaskClass(t.ganttProperties)+'" style="width:'+this.connectorPointWidth+"px;height:"+this.connectorPointWidth+'px;">'+this.touchRightConnectorpoint+"</div></div>";return this.createDivElement(a)},i.prototype.getTaskLabel=function(e){var i=this.parent.ganttColumns.length,r=null;if(t.isNullOrUndefined(e)||""===e)r="";else if(e===this.parent.taskFields.resourceInfo)r=this.getResourceName(this.templateData);else{for(var a=0;a<i;a++)if(e===this.parent.ganttColumns[a].field){r=this.getFieldValue(this.templateData[e]).toString();break}if(t.isNullOrUndefined(r))return"isCustomTemplate"}return r},i.prototype.getExpandDisplayProp=function(e){return e=this.templateData,this.parent.getExpandStatus(e)?"table-row":"none"},i.prototype.getRowClassName=function(e){var t="gridrowtaskId",i=(e=this.templateData).parentItem;return i&&(t+=i.taskId.toString()),t+="level",t+=e.level.toString()},i.prototype.getBorderRadius=function(e){var t=(e=this.templateData).ganttProperties.width-e.ganttProperties.progressWidth;return t<=4?4-t:0},i.prototype.getSplitTaskBorderRadius=function(e){var t=e.width-e.progressWidth;return t<=4?4-t:0},i.prototype.taskNameWidth=function(e){var t,i=(e=this.templateData).ganttProperties;return(t=e.ganttProperties.isMilestone?e.ganttProperties.left-this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!i.isAutoSchedule?this.parent.allowUnscheduledTasks?i.left<i.autoLeft?i.left:i.autoLeft:i.autoStartDate.getTime()<i.startDate.getTime()?i.autoLeft:i.left:e.ganttProperties.left)<0&&(t=0),t+"px"},i.prototype.getRightLabelLeft=function(e){var t,i,r=(e=this.templateData).ganttProperties;return e.ganttProperties.isMilestone?e.ganttProperties.left+this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!r.isAutoSchedule?(this.parent.allowUnscheduledTasks?(t=r.left<r.autoLeft?r.left:r.autoLeft,i=r.autoWidth):(t=r.autoStartDate.getTime()<r.startDate.getTime()?r.autoLeft:r.left,i=(r.autoEndDate.getTime()<r.endDate.getTime()?this.parent.dataOperation.getTaskLeft(r.endDate,r.isMilestone):this.parent.dataOperation.getTaskLeft(r.autoEndDate,r.isMilestone))-t),t+i):e.ganttProperties.left+e.ganttProperties.width},i.prototype.getExpandClass=function(e){return(e=this.templateData).expanded?"e-row-expand":!e.expanded&&e.hasChildRecords?"e-row-collapse":""},i.prototype.getFieldValue=function(e){return t.isNullOrUndefined(e)?"":e},i.prototype.getResourceName=function(e){e=this.templateData;var i=null;if(!t.isNullOrUndefined(e.ganttProperties.resourceInfo)){var r=e.ganttProperties.resourceInfo.length;if(r>0){for(var a=0;a<r;a++){var n=e.ganttProperties.resourceInfo[a][this.parent.resourceFields.name],s=e.ganttProperties.resourceInfo[a][this.parent.resourceFields.unit];100!==s&&(n+="["+s+"%]"),t.isNullOrUndefined(i)?i=n:i+=" , "+n}return i}return""}return""},i.prototype.initChartHelperPrivateVariable=function(){var e=this.parent.renderBaseline?.45:.62,i=this.parent.renderBaseline?4:2,r=this.parent.renderBaseline?1.13:.82;if(this.baselineColor=t.isNullOrUndefined(this.parent.baselineColor)||""===this.parent.baselineColor?null:this.parent.baselineColor,this.taskBarHeight=t.isNullOrUndefined(this.parent.taskbarHeight)||this.parent.taskbarHeight>=this.parent.rowHeight?Math.floor(this.parent.rowHeight*e):this.parent.taskbarHeight,this.parent.renderBaseline){var a=void 0;a=this.taskBarHeight+this.baselineHeight<=this.parent.rowHeight?this.taskBarHeight:this.taskBarHeight-(this.baselineHeight+1),this.taskBarHeight=a}this.milestoneHeight=Math.floor(this.taskBarHeight*r),this.taskBarMarginTop=Math.floor((this.parent.rowHeight-this.taskBarHeight)/i),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):10,this.connectorPointMargin=Math.floor(this.taskBarHeight/2-this.connectorPointWidth/2)-1},i.prototype.refreshGanttRows=function(){if(this.parent.currentViewData=this.parent.treeGrid.getCurrentViewRecords().slice(),this.createTaskbarTemplate(),"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation){for(var e=0;e<this.parent.currentViewData.length;e++){var t=this.parent.currentViewData[e];t.childRecords.length>0&&(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()},i.prototype.createTaskbarTemplate=function(){var e,i=[].slice.call(this.ganttChartTableBody.querySelectorAll("tr"));this.ganttChartTableBody.innerHTML="";var r=[],a=this.parent.treeGridModule.prevCurrentView;if(this.refreshedTr=[],this.refreshedData=[],this.parent.enableImmutableMode&&a&&a.length>0&&this.isUpdated){for(var n={},s=[],o=this.parent.treeGrid.getPrimaryKeyFieldNames()[0],l=0;l<a.length;l++)s[l]=i[l],n[a[l][o]]=l;for(var d=0;d<this.parent.currentViewData.length;d++){var h=n[this.parent.currentViewData[d][o]],p=this.parent.modifiedRecords.indexOf(this.parent.currentViewData[d]);if(t.isNullOrUndefined(h)||-1!==p||this.parent.isFromRenderBaseline){var c=this.getGanttChartRow(d,this.parent.currentViewData[d]);this.ganttChartTableBody.appendChild(c),this.refreshedTr.push(this.ganttChartTableBody.querySelectorAll("tr")[d]),this.refreshedData.push(this.parent.currentViewData[d])}else this.ganttChartTableBody.appendChild(s[h]);this.ganttChartTableBody.querySelectorAll("tr")[d].setAttribute("aria-rowindex",d.toString())}}else{var u=void 0;u=t.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"});for(l=0;l<this.parent.currentViewData.length;l++){var g=this.parent.currentViewData[l];"ResourceView"===this.parent.viewType&&((this.parent.editModule&&this.parent.editModule.isResourceTaskDeleted||this.parent.isFromOnPropertyChange)&&(this.parent.editModule.isResourceTaskDeleted=!1),!g.expanded&&this.parent.enableMultiTaskbar&&r.push(g));c=this.getGanttChartRow(l,g);u.appendChild(c),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(c.getAttribute("aria-rowindex"),10))}(e=this.ganttChartTableBody).replaceChildren.apply(e,u.childNodes),this.parent.initialChartRowElements=this.parent.ganttChartModule.getChartRows()}if(this.parent.renderTemplates(),this.triggerQueryTaskbarInfo(),this.parent.modifiedRecords=[],"ResourceView"==this.parent.viewType&&this.parent.showOverAllocation&&this.updateOverlapped(),r.length)for(var f=0;f<r.length;f++)r[f].hasChildRecords&&(this.parent.isGanttChartRendered=!0,this.parent.chartRowsModule.refreshRecords([r[f]]));this.parent.renderTemplates()},i.prototype.getGanttChartRow=function(e,i){this.templateData=i;var r=null,a=this.getTableTrNode(e),n=this.getLeftLabelNode(e),s=this.taskbarContainer();s[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),s[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID);var o;if(this.templateData.hasChildRecords||this.parent.allowParentDependency)this.parent.allowParentDependency&&(o=this.getLeftPointNode(),(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)&&s[0].appendChild([].slice.call(o)[0]));else{var l=this.getLeftPointNode();s[0].appendChild([].slice.call(l)[0])}if(this.templateData.hasChildRecords){var d=this.getParentTaskbarNode(e,s);if(!this.templateData.ganttProperties.isAutoSchedule){var h=this.getManualTaskbar();if(!t.isNullOrUndefined(h[0])){if(this.parent.allowParentDependency){h[0].appendChild([].slice.call(o)[0]);var p=this.getRightPointNode();h[0].appendChild([].slice.call(p)[0])}s[0].appendChild([].slice.call(h)[0])}}if(0!==this.templateData.ganttProperties.autoDuration&&!this.templateData.ganttProperties.isMilestone&&d&&d.length>0)t.append(d,s[0]);else if(0===this.templateData.ganttProperties.duration&&this.templateData.ganttProperties.isMilestone&&this.templateData.ganttProperties.isAutoSchedule){(c=this.getMilestoneNode(e,s))&&c.length>0&&t.append(c,s[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(r=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}else if(this.templateData.ganttProperties.isMilestone){var c;(c=this.getMilestoneNode(e,s))&&c.length>0&&t.append(c,s[0]),this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(r=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}else{var u=m(this.templateData.ganttProperties),g=null,f=null,y=null;if(!t.isNullOrUndefined(u)){(u||this.templateData.ganttProperties.duration)&&u&&(t.isNullOrUndefined(this.templateData.ganttProperties.segments)||this.templateData.ganttProperties.segments.length<=0)&&(g=this.childTaskbarProgressResizer(),y=this.childTaskbarLeftResizer(),f=this.childTaskbarRightResizer());var D=this.getChildTaskbarNode(e,s);if(y&&s[0].appendChild([].slice.call(y)[0]),D&&D.length>0)if(this.templateData.ganttProperties.segments&&this.templateData.ganttProperties.segments.length>0){var v=this.templateData.ganttProperties.segments.length,w=null;w=this.createDivElement('<div class="e-gantt-split-container-line"></div>'),s[0].appendChild([].slice.call(w)[0]);for(var k=0;k<v;k++)s[0].appendChild([].slice.call(D)[0])}else t.append(D,s[0]);g&&s[0].appendChild([].slice.call(g)[0]),f&&s[0].appendChild([].slice.call(f)[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(r=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}var T;this.parent.allowParentDependency&&(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)?(T=this.getRightPointNode(),s[0].appendChild([].slice.call(T)[0])):this.parent.allowParentDependency||(T=this.getRightPointNode(),s[0].appendChild([].slice.call(T)[0]));var b=this.getRightLabelNode(e);if(a[0].childNodes[0].childNodes[0].appendChild([].slice.call(n)[0]),a[0].childNodes[0].childNodes[0].appendChild([].slice.call(s)[0]),this.templateData.ganttProperties.indicators&&this.templateData.ganttProperties.indicators.length>0)for(var P=void 0,S=void 0,C=this.templateData.ganttProperties.indicators,M=0;M<C.length;M++){if((P=this.getIndicatorNode(C[M]))[0].setAttribute("aria-label",C[M].name),C[M].name.indexOf("$")>-1||C[M].name.indexOf("#")>-1)S=this.templateCompiler(C[M].name)(t.extend({index:e},this.templateData),this.parent,"indicatorLabelText");else{var R=t.createElement("Text");R.innerHTML=C[M].name,this.parent.enableHtmlSanitizer&&"string"==typeof C[M].name&&(C[M].name=t.SanitizeHtmlHelper.sanitize(C[M].name),R.innerText=C[M].name),S=R.childNodes}P[0].appendChild([].slice.call(S)[0]),P[0].title=t.isNullOrUndefined(C[M].tooltip)?"":C[M].tooltip,a[0].childNodes[0].childNodes[0].appendChild([].slice.call(P)[0])}b&&b.length>0&&a[0].childNodes[0].childNodes[0].appendChild([].slice.call(b)[0]),t.isNullOrUndefined(r)||a[0].childNodes[0].childNodes[0].appendChild([].slice.call(r)[0]);var O=a[0].childNodes[0];return this.setAriaRowIndex(i,O),O},i.prototype.setAriaRowIndex=function(e,i){var r=this.parent.treeGrid.getCurrentViewRecords(),a=(this.parent.virtualScrollModule&&this.parent.enableVirtualization?t.getValue("virtualScrollModule.visualData",this.parent.treeGrid):r).indexOf(e);i.setAttribute("aria-rowindex",a.toString())},i.prototype.triggerQueryTaskbarInfo=function(){if(this.parent.queryTaskbarInfo)for(var e,i,r=this.parent.enableImmutableMode?this.refreshedTr.length:this.ganttChartTableBody.querySelectorAll("tr").length,a=0;a<r;a++){e=this.parent.enableImmutableMode?this.refreshedTr[a]:this.ganttChartTableBody.querySelectorAll("tr")[a],i=this.refreshedData.length>0?this.refreshedData[a]:this.parent.currentViewData[a];var n=!t.isNullOrUndefined(i.ganttProperties.segments)&&i.ganttProperties.segments.length;if(n>0)for(var s=0;s<n;s++){var o=e.getElementsByClassName("e-segmented-taskbar")[s];this.triggerQueryTaskbarInfoByIndex(o,i)}else e&&this.triggerQueryTaskbarInfoByIndex(e,i)}},i.prototype.triggerQueryTaskbarInfoByIndex=function(e,i){var r,a=this,n=!t.isNullOrUndefined(i.ganttProperties.segments)&&i.ganttProperties.segments.length>0?e:e.querySelector("."+H);i.ganttProperties.segments&&i.ganttProperties.segments.length>0&&(r=e.parentElement.parentElement.parentElement);var s={data:i,rowElement:e,taskbarElement:n,taskbarType:i.hasChildRecords?"ParentTask":i.ganttProperties.isMilestone?"Milestone":"ChildTask"},o=this.getClassName(s);if("Milestone"===s.taskbarType)s.milestoneColor=n.querySelector(o[0])?getComputedStyle(n.querySelector(o[0])).backgroundColor:null,s.baselineColor=e.querySelector(o[1])?getComputedStyle(e.querySelector(o[1])).backgroundColor:e.querySelector("."+X)?getComputedStyle(e.querySelector("."+X)).backgroundColor:null;else if(n){var l=n.querySelector(o[0]),d=n.querySelector(o[1]);s.taskbarBgColor=t.isNullOrUndefined(l)?null:n.classList.contains(ae)?getComputedStyle(n).backgroundColor:getComputedStyle(n.querySelector(o[0])).backgroundColor,s.taskbarBorderColor=t.isNullOrUndefined(l)?null:n.classList.contains(ae)?getComputedStyle(n).backgroundColor:getComputedStyle(n.querySelector(o[0])).borderColor,s.progressBarBgColor=t.isNullOrUndefined(d)?null:n.classList.contains(ne)?getComputedStyle(n).backgroundColor:getComputedStyle(n.querySelector(o[1])).backgroundColor,s.baselineColor=r?r.querySelector("."+X)?getComputedStyle(r.querySelector("."+X)).backgroundColor:null:e.querySelector("."+X)?getComputedStyle(e.querySelector("."+X)).backgroundColor:null,s.taskLabelColor=n.querySelector("."+j)?getComputedStyle(n.querySelector("."+j)).color:null}r?(s.rightLabelColor=r.querySelector("."+B)&&r.querySelector("."+B).querySelector("."+ye)?getComputedStyle(r.querySelector("."+B).querySelector("."+ye)).color:null,s.leftLabelColor=r.querySelector("."+V)&&r.querySelector("."+V).querySelector("."+ye)?getComputedStyle(r.querySelector("."+V).querySelector("."+ye)).color:null):(s.rightLabelColor=e.querySelector("."+B)&&e.querySelector("."+B).querySelector("."+ye)?getComputedStyle(e.querySelector("."+B).querySelector("."+ye)).color:null,s.leftLabelColor=e.querySelector("."+V)&&e.querySelector("."+V).querySelector("."+ye)?getComputedStyle(e.querySelector("."+V).querySelector("."+ye)).color:null),this.parent.trigger("queryTaskbarInfo",s,function(e){a.updateQueryTaskbarInfoArgs(e,void 0,void 0)})},i.prototype.updateQueryTaskbarInfoArgs=function(e,t,i){var r,a=e.rowElement,n=e.taskbarElement,s=this.getClassName(e);e.data.ganttProperties.segments&&e.data.ganttProperties.segments.length>0&&(r=a.parentElement.parentElement.parentElement),"Milestone"===e.taskbarType?(n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).backgroundColor!==e.milestoneColor&&(n.querySelector(s[0]).style.backgroundColor=e.milestoneColor),a.querySelector(s[1])&&getComputedStyle(a.querySelector(s[1])).backgroundColor!==e.baselineColor&&(a.querySelector(s[1]).style.backgroundColor=e.baselineColor),a.querySelector("."+X)&&getComputedStyle(a.querySelector("."+X)).borderTopColor!==e.baselineColor&&(a.querySelector("."+X).style.backgroundColor=e.baselineColor)):n&&(n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).backgroundColor!==e.taskbarBgColor&&(n.querySelector(s[0]).style.backgroundColor=e.taskbarBgColor),n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).borderColor!==e.taskbarBorderColor&&(n.querySelector(s[0]).style.borderColor=e.taskbarBorderColor),n.querySelector(s[1])&&getComputedStyle(n.querySelector(s[1])).backgroundColor!==e.progressBarBgColor&&(n.querySelector(s[1]).style.backgroundColor=e.progressBarBgColor),n.classList.contains(ae)&&getComputedStyle(n).backgroundColor!==e.taskbarBgColor&&(n.style.backgroundColor=e.taskbarBgColor),n.classList.contains(ae)&&getComputedStyle(n).borderColor!==e.taskbarBorderColor&&(n.style.borderColor=e.taskbarBorderColor),n.classList.contains(ne)&&getComputedStyle(n).backgroundColor!==e.progressBarBgColor&&(n.style.backgroundColor=e.progressBarBgColor),n.querySelector("."+j)&&getComputedStyle(n.querySelector("."+j)).color!==e.taskLabelColor&&(n.querySelector("."+j).style.color=e.taskLabelColor),r?r.querySelector("."+X)&&getComputedStyle(r.querySelector("."+X)).backgroundColor!==e.baselineColor&&(r.querySelector("."+X).style.backgroundColor=e.baselineColor):a.querySelector("."+X)&&getComputedStyle(a.querySelector("."+X)).backgroundColor!==e.baselineColor&&(a.querySelector("."+X).style.backgroundColor=e.baselineColor)),r?(r.querySelector("."+V)&&r.querySelector("."+V).querySelector("."+ye)&&getComputedStyle(r.querySelector("."+V).querySelector("."+ye)).color!==e.leftLabelColor&&(r.querySelector("."+V).querySelector("."+ye).style.color=e.leftLabelColor),r.querySelector("."+B)&&r.querySelector("."+B).querySelector("."+ye)&&getComputedStyle(r.querySelector("."+B).querySelector("."+ye)).color!==e.rightLabelColor&&(r.querySelector("."+B).querySelector("."+ye).style.color=e.rightLabelColor)):(a.querySelector("."+V)&&a.querySelector("."+V).querySelector("."+ye)&&getComputedStyle(a.querySelector("."+V).querySelector("."+ye)).color!==e.leftLabelColor&&(a.querySelector("."+V).querySelector("."+ye).style.color=e.leftLabelColor),a.querySelector("."+B)&&a.querySelector("."+B).querySelector("."+ye)&&getComputedStyle(a.querySelector("."+B).querySelector("."+ye)).color!==e.rightLabelColor&&(a.querySelector("."+B).querySelector("."+ye).style.color=e.rightLabelColor))},i.prototype.getClassName=function(e){var t=[];return t.push("."+("ParentTask"===e.taskbarType?pe:"ChildTask"===e.taskbarType?ae:re)),t.push("."+("ParentTask"===e.taskbarType?ce:"ChildTask"===e.taskbarType?ne:Y)),t},i.prototype.templateCompiler=function(e){if(!t.isNullOrUndefined(e)&&""!==e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?t.compile(document.querySelector(e).innerHTML.trim(),this.parent):t.compile(e,this.parent)}catch(i){return t.compile(e,this.parent)}return null},i.prototype.updateOverlapped=function(){for(var e=0;e<this.parent.treeGrid.parentData.length;e++)for(var i=this.parent.treeGrid.parentData[e].childRecords,r=0;r<i.length;r++){i[r+1]&&(i[r].ganttProperties.eOverlapped=void 0);for(var a=r+1;a<i.length;a++)i[a].ganttProperties.eOverlapped=void 0,i[r].ganttProperties.startDate.getTime()<i[a].ganttProperties.endDate.getTime()&&i[r].ganttProperties.endDate.getTime()>i[a].ganttProperties.startDate.getTime()?(i[a].ganttProperties.eOverlapped=!0,i[r].ganttProperties.eOverlapped=!0):(t.isNullOrUndefined(i[a].ganttProperties.eOverlapped)&&(i[a].ganttProperties.eOverlapped=!1),t.isNullOrUndefined(i[r].ganttProperties.eOverlapped)&&(i[r].ganttProperties.eOverlapped=!1))}},i.prototype.updateDragDropRecords=function(e,t){var i=e.childRecords,r=this.parent.currentViewData.indexOf(e),a=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight;t||(t=this.ganttChartTableBody.childNodes[r]),t.style.height=this.parent.treeGrid.getRowByIndex(r).style.height=this.parent.rowHeight+"px",this.parent.contentHeight=a;var 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++)i[o].ganttProperties.startDate.getTime()<i[l].ganttProperties.endDate.getTime()&&i[o].ganttProperties.endDate.getTime()>i[l].ganttProperties.startDate.getTime()?d[h].getAttribute("rowuniqueid")===i[l].rowUniqueID&&-1==n.indexOf(i[l].rowUniqueID)&&(n.push(i[l].rowUniqueID),s++,t.children[0].style.verticalAlign="baseline",t.getElementsByClassName("e-taskbar-main-container")[h].style.marginTop=s*this.parent.rowHeight+this.taskBarMarginTop+"px",t.style.height=this.parent.treeGrid.getRowByIndex(r).style.height=parseInt(t.style.height)+this.parent.rowHeight+"px"):d[h].getAttribute("rowuniqueid")===i[l].rowUniqueID&&-1==n.indexOf(i[l].rowUniqueID)&&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=a,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px"}},i.prototype.refreshRow=function(e,i){var r=this.ganttChartTableBody.childNodes[e],a=this.parent.currentViewData[e];if(-1!==e&&a){var n=a;!this.parent.allowTaskbarOverlap&&"ResourceView"===this.parent.viewType&&n.expanded&&(r.style.height=this.parent.treeGrid.getRowByIndex(e).style.height=this.parent.rowHeight+"px"),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&!n.expanded&&this.parent.enableMultiTaskbar?r.replaceChild(this.getResourceParent(n).childNodes[0],r.childNodes[0]):"ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&!n.expanded?r.replaceWith(this.getGanttChartRow(e,n)):r.replaceChild(this.getGanttChartRow(e,n).childNodes[0],r.childNodes[0]),this.parent.renderTemplates(),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&this.parent.showOverAllocation&&this.parent.allowTaskbarOverlap&&(i?this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData):(this.parent.dataOperation.updateOverlappingValues(n),this.parent.ganttChartModule.renderRangeContainer([n])));var s=!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length;if(s>0)for(var o=0;o<s;o++){var l=r.getElementsByClassName("e-segmented-taskbar")[o];this.triggerQueryTaskbarInfoByIndex(l,n)}else this.triggerQueryTaskbarInfoByIndex(r,n);var d="ProjectView"===this.parent.viewType?n.ganttProperties.taskId:n.ganttProperties.rowUniqueID;this.parent.treeGrid.grid.setRowData(d,n),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&!n.expanded&&this.parent.enableMultiTaskbar&&!this.parent.allowTaskbarOverlap&&this.updateDragDropRecords(a,r),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap&&this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);var h=this.parent.ganttChartModule.tempNextElement;this.parent.ganttChartModule.isEditableElement&&h&&(this.parent.treeGrid.grid.focusModule.focus(),t.addClass([this.parent.treeGrid.getRows()[r.ariaRowIndex].children[this.parent.ganttChartModule.childrenIndex]],"e-focused"),this.parent.ganttChartModule.tempNextElement=null);var p=this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[e].getAttribute("data-uid"));t.isNullOrUndefined(p)||(p.data=n)}},i.prototype.updateResourceTaskbarElement=function(e,i){var r=e.querySelector(".e-taskbar-main-container");t.addClass([r],"collpse-parent-border");var a=e.querySelector("."+H).getAttribute("rowUniqueId"),n=this.parent.getRecordByID(a),s="";n&&!t.isNullOrUndefined(n.ganttProperties.eOverlapIndex)&&(s=n.ganttProperties.eOverlapIndex.toString());var o=r.cloneNode(!0);o.style.zIndex=s,i[0].childNodes[0].childNodes[0].childNodes[0].appendChild(o)},i.prototype.getResourceParent=function(e){var i=this.parent.ganttChartModule.getChartRows();if(this.parent.initialChartRowElements&&!this.parent.allowTaskbarDragAndDrop&&this.parent.allowTaskbarOverlap)for(var r=0;r<this.parent.initialChartRowElements.length;r++)t.isNullOrUndefined(i[r])||t.isNullOrUndefined(i[r].childNodes[0].childNodes[1].childNodes[2])||t.isNullOrUndefined(this.parent.initialChartRowElements[r].childNodes[0].childNodes[1].childNodes[2])||(i[r].childNodes[0].childNodes[1].childNodes[2].innerHTML=this.parent.initialChartRowElements[r].childNodes[0].childNodes[1].childNodes[2].innerHTML);this.templateData=e;var a=this.getTableTrNode(),n=this.leftLabelContainer(),s=t.createElement("div",{className:"e-collapse-parent"});a[0].childNodes[0].childNodes[0].appendChild(s);var o=this.parent.dataOperation.setSortedChildTasks(e);this.parent.dataOperation.updateOverlappingIndex(o);var l;if(this.parent.enableVirtualization)for(var d=0;d<e.childRecords.length;d++)l=this.getGanttChartRow(e.childRecords[d].index,this.parent.flatData[e.childRecords[d].index]),this.updateResourceTaskbarElement(l,a);else for(d=0;d<i.length;d++)i[d].classList.contains("gridrowtaskId"+e.ganttProperties.rowUniqueID+"level"+(e.level+1))&&this.updateResourceTaskbarElement(i[d],a);return a[0].childNodes[0].childNodes[0].appendChild([].slice.call(n)[0]),a[0].childNodes[0]},i.prototype.refreshRecords=function(e,t){if(this.parent.isGanttChartRendered){if(this.parent.renderTemplates(),"ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar){e=new a.DataManager(e).executeLocal((new a.Query).sortBy("expanded","Descending"))}for(var i=0;i<e.length;i++){var r=this.parent.currentViewData.indexOf(e[i]);this.refreshRow(r,t)}this.parent.ganttChartModule.updateLastRowBottomWidth()}},i.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("renderPanels",this.createChartTable),this.parent.off("dataReady",this.initiateTemplates),this.parent.off("destroy",this.destroy))},i.prototype.destroy=function(){this.removeEventListener()},i.prototype.generateAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),r=this.parent.localeObj.getConstant("startDate"),a=this.parent.localeObj.getConstant("endDate"),n=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+" "+r+" "+this.parent.getFormatedDate(o):(s&&(t+=i+" "+s+" "),o&&(t+=r+" "+this.parent.getFormatedDate(o)+" "),l&&(t+=a+" "+this.parent.getFormatedDate(l)+" "),d&&(t+=n+" "+this.parent.getDurationString(d,e.ganttProperties.durationUnit))),t},i.prototype.generateBaselineAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),r=this.parent.localeObj.getConstant("startDate"),a=this.parent.localeObj.getConstant("endDate"),n=e.ganttProperties.taskName,s=e.ganttProperties.baselineStartDate,o=e.ganttProperties.baselineEndDate;return t+="Baseline ",t+=i+" "+n+" ",t+=r+" "+this.parent.getFormatedDate(s)+" ",t+=a+" "+this.parent.getFormatedDate(o)+" "},i.prototype.generateSpiltTaskAriaLabel=function(e,t){var i="",r=this.parent.localeObj.getConstant("startDate"),a=this.parent.localeObj.getConstant("endDate"),n=this.parent.localeObj.getConstant("duration"),s=e.startDate,o=e.endDate,l=e.duration;return s&&(i+=r+" "+this.parent.getFormatedDate(s)+" "),o&&(i+=a+" "+this.parent.getFormatedDate(o)+" "),l&&(i+=n+" "+this.parent.getDurationString(l,t.durationUnit)),i},i.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},i}(R),Xt=function(){function e(e){this.parentRecord=[],this.parentIds=[],this.parentPredecessors=[],this.parent=e,this.dateValidateModule=this.parent.dateValidationModule}return e.prototype.ensurePredecessorCollection=function(){for(var e=this.parent.predecessorsCollection,t=e.length-1;t>=0;t--){var i=e[t],r=i.ganttProperties;(!i.hasChildRecords&&!this.parent.allowParentDependency||this.parent.allowParentDependency)&&this.ensurePredecessorCollectionHelper(i,r)}},e.prototype.ensurePredecessorCollectionHelper=function(e,i){var r=i.predecessorsName;if(!r||"string"!=typeof r&&"number"!=typeof r){if(r&&"object"==typeof r&&r.length){for(var a=[],n=0;n<r.length;n++){var s=r[n],o={};o.from=t.getValue("from",s),o.to=t.getValue("to",s)?t.getValue("to",s):i.rowUniqueID,o.type=t.getValue("type",s)?t.getValue("type",s):"FS";var l=t.getValue("offset",s);if(t.isNullOrUndefined(l))o.offset=0,o.offsetUnit=this.parent.durationUnit.toLocaleLowerCase();else if("string"==typeof l){var d=this.getOffsetDurationUnit(t.getValue("offset",s));o.offset=d.duration,o.offsetUnit=d.durationUnit}else o.offset=parseFloat(l.toString()),o.offsetUnit=this.parent.durationUnit.toLocaleLowerCase();this.checkIsParent(o.from.toString())||a.push(o)}this.parent.setRecordValue("predecessor",a,i,!0)}}else this.parent.setRecordValue("predecessor",this.calculatePredecessor(r,e),i,!0);this.parent.setRecordValue("predecessorsName",this.getPredecessorStringValue(e),i,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,i.predecessorsName,e),this.parent.setRecordValue(this.parent.taskFields.dependency,i.predecessorsName,e)},e.prototype.updateUnscheduledDependency=function(e){for(var i=this.parent.taskFields,r=t.isNullOrUndefined(e[i.dependency])?[]:e[i.dependency].toString().split(","),a=0;a<r.length;a++){var n=parseInt(r[a],10);if(!isNaN(n)){var s=this.parent.getRecordByID(n.toString()),o=t.isNullOrUndefined(s)?null:t.extend({},{},s.taskData,!0);!t.isNullOrUndefined(o)&&t.isNullOrUndefined(o[i.startDate])&&t.isNullOrUndefined(o[i.duration])&&t.isNullOrUndefined(o[i.endDate])&&(o[i.duration]=1,o[i.startDate]=this.parent.projectStartDate,this.parent.updateRecordByID(o))}}},e.prototype.checkIsParent=function(e){var t=!1;return this.parent.connectorLineModule.getRecordByID(e).hasChildRecords&&(t=!0),t},e.prototype.calculatePredecessor=function(e,t){var i,r,a,n,s=this,o=[];return e.toString().split(",").forEach(function(e){r=e.split("+"),a="+",e.indexOf("-")>=0&&(r=e.split("-"),a="-"),i=[];var l="ResourceView"===s.parent.viewType?s.parent.getTaskIds():s.parent.ids;-1!==("ResourceView"===s.parent.viewType?l.indexOf("T"+r[0]):l.indexOf(r[0]))?i[0]=r[0]:-1===l.indexOf(r[0])?1===(i=r[0].split(" ")).length&&(-1!=i[0].indexOf(" ")?i=r[0].match(/(\d+|[A-z]+)/g):(i[0]=r[0].slice(0,-2),i[1]=r[0].slice(-2))):i[0]=r[0];var d="ResourceView"===s.parent.viewType?l.indexOf("T"+i[0]):l.indexOf(i[0]);if(i[0]&&-1!==d){if(i.length>1){var h=i[1].toUpperCase();n="FS"===h||"FF"===h||"SF"===h||"SS"===h?h:"FS"}else n="FS";var p=r.length>1?a+""+r[1]:"0",c=s.getOffsetDurationUnit(p),u={from:i[0],type:n,isDrawn:!1,to:"ResourceView"===s.parent.viewType?t.ganttProperties.taskId.toString():t.ganttProperties.rowUniqueID.toString(),offsetUnit:c.durationUnit,offset:c.duration},g=s.checkIsParent(i[0]);if(s.parent.allowParentDependency){var f=s.parent.connectorLineModule.getRecordByID(u.to),m=s.parent.connectorLineModule.getRecordByID(u.from);s.parent.connectorLineEditModule&&m&&f?s.parent.connectorLineEditModule.validateParentPredecessor(m,f)&&o.push(u):o.push(u),i.splice(0)}else g||o.push(u)}}),o},e.prototype.getPredecessorStringValue=function(e){var i,r,a=e.ganttProperties.predecessor,n=this.parent.durationUnitTexts,s="";if(r=[],a)for(var o=a.length,l=0;l<o;l++){var d=a[l],h="",p="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(d.from!==p.toString()){if(h=d.from+d.type,"string"==typeof e.ganttProperties.taskId?(r[0]=h.slice(0,-2),r[1]=h.slice(-2),i=r[0]+" "+r[1]):i=h,h=i,0!==d.offset){h+=d.offset>0?"+"+d.offset+" ":d.offset+" ";var c=1!==d.offset;"day"===d.offsetUnit?h+=c?t.getValue("days",n):t.getValue("day",n):"hour"===d.offsetUnit?h+=c?t.getValue("hours",n):t.getValue("hour",n):h+=c?t.getValue("minutes",n):t.getValue("minute",n)}s=s.length>0?s+","+h:h}}return s},e.prototype.getOffsetDurationUnit=function(e){var i=0,r=this.parent.durationUnit.toLocaleLowerCase(),a=this.parent.durationUnitEditText;if("string"==typeof e){for(var n=e.match(/[^0-9]+|[0-9]+/g),s=0;s<n.length;s++)n[s]=n[s].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]),r=n[1]?n[1].toLowerCase().trim():"",r=-1!==t.getValue("minute",a).indexOf(r)?"minute":-1!==t.getValue("hour",a).indexOf(r)?"hour":-1!==t.getValue("day",a).indexOf(r)?"day":this.parent.durationUnit.toLocaleLowerCase())}else i=e,r=this.parent.durationUnit.toLocaleLowerCase();return isNaN(i)&&(i=0,r=this.parent.durationUnit.toLocaleLowerCase()),{duration:i,durationUnit:r}},e.prototype.updatePredecessors=function(){for(var e,t=this.parent.predecessorsCollection,i=t.length,r=0;r<i;r++)(!(e=t[r]).hasChildRecords&&!this.parent.allowParentDependency||this.parent.allowParentDependency)&&this.updatePredecessorHelper(e,t)},e.prototype.updatePredecessorHelper=function(e,i){var r,a=e.ganttProperties.predecessor,n=a.length;i=t.isNullOrUndefined(i)?[]:i;for(var s=0;s<n;s++){var o=a[s];r=this.parent.connectorLineModule.getRecordByID(o.from);var l="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(o.from!==l.toString()&&r){var d=void 0;r.ganttProperties.predecessor?((d=t.extend([],r.ganttProperties.predecessor,[],!0)).push(o),this.parent.setRecordValue("predecessor",d,r.ganttProperties,!0)):((d=[]).push(o),this.parent.setRecordValue("predecessor",d,r.ganttProperties,!0),i.push(r))}}},e.prototype.updatedRecordsDateByPredecessor=function(){if(this.parent.autoCalculateDateScheduling)for(var e=this.parent.flatData,t=this.parent.flatData.length,i=0;i<t;i++)if(e[i].ganttProperties.predecessorsName){this.validatePredecessorDates(e[i]);var r=e[i].ganttProperties.predecessor;if(r&&r.length>1)for(var a=0;a<r.length;a++){var n=this.parent.getRecordByID(r[a].to);n&&this.validatePredecessorDates(n)}e[i].hasChildRecords&&this.parent.editModule&&!this.parent.allowUnscheduledTasks&&this.parent.allowParentDependency&&this.parent.editModule.updateChildItems(e[i])}},e.prototype.updateParentPredecessor=function(){if(this.parent.enablePredecessorValidation)for(var e=this.parentPredecessors.length-1;e>=0;e--){var t=this.parentPredecessors[e];this.validatePredecessorDates(t),t.ganttProperties.startDate&&this.parent.editModule.updateChildItems(t)}},e.prototype.validatePredecessorDates=function(e){if(e.ganttProperties.predecessor){var t=e.ganttProperties.predecessor,i=void 0,r=void 0,a=null,n="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString(),s=t.filter(function(e){return e.to===n?e:null});for(i=0;i<s.length;i++){var o=s[i];r=this.parent.connectorLineModule.getRecordByID(o.from),a=this.parent.connectorLineModule.getRecordByID(o.to),this.parent.allowParentDependency&&this.parent.isLoad&&-1==this.parentPredecessors.indexOf(e)&&(e.hasChildRecords||a.hasChildRecords)&&this.parentPredecessors.push(e),(a.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)&&this.validateChildGanttRecord(r,a)}}},e.prototype.validateChildGanttRecord=function(e,i){if(this.parent.editedTaskBarItem!==i&&!t.isNullOrUndefined(m(e.ganttProperties))&&!t.isNullOrUndefined(m(i.ganttProperties))&&this.parent.isInPredecessorValidation&&(i.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)){var r=i.ganttProperties,a="ResourceView"===this.parent.viewType?r.taskId.toString():r.rowUniqueID.toString(),n=r.predecessor.filter(function(e){return e.to===a?e:null}),s=this.getPredecessorDate(i,n);this.parent.setRecordValue("startDate",s,r,!0),this.parent.dataOperation.updateMappingData(i,"startDate");var o=i.ganttProperties.segments;t.isNullOrUndefined(o)&&this.dateValidateModule.calculateEndDate(i),this.parent.dataOperation.updateWidthLeft(i),!this.parent.isLoad&&!this.parent.isFromOnPropertyChange&&i.parentItem&&this.parent.isInPredecessorValidation&&this.parent.getParentTask(i.parentItem).ganttProperties.isAutoSchedule&&-1===this.parentIds.indexOf(i.parentItem.uniqueID)&&(this.parentIds.push(i.parentItem.uniqueID),this.parentRecord.push(i.parentItem))}},e.prototype.getPredecessorDate=function(e,t){var i,r,a,n,s=this,o=t.filter(function(t){var i="ResourceView"===s.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;return t.to===i.toString()?t:null});if(o)for(var l=o.length,d=0;d<l;d++){var h=o[d];a=this.parent.connectorLineModule.getRecordByID(h.from),n=this.parent.connectorLineModule.getRecordByID(h.to),r=this.getValidatedStartDate(n.ganttProperties,a.ganttProperties,h),null!=i&&1!==this.dateValidateModule.compareDates(r,i)||(i=r)}return i},e.prototype.getValidatedStartDate=function(e,t,i){var r,a,n=i.type,s=i.offset;switch(n){case"FS":r=this.dateValidateModule.getValidEndDate(t),e.isMilestone&&0===s||(r=this.dateValidateModule.checkStartDate(r,e)),0!==s&&(r=this.updateDateByOffset(r,i,e)),a=e.isMilestone?r:this.dateValidateModule.checkStartDate(r,e);break;case"FF":case"SF":r="FF"===n?this.dateValidateModule.getValidEndDate(t):this.dateValidateModule.getValidStartDate(t),0!==s&&(r=this.updateDateByOffset(r,i,e)),e.isMilestone||(r=this.dateValidateModule.checkEndDate(r,e)),a=this.dateValidateModule.getStartDate(r,e.duration,e.durationUnit,e);break;case"SS":r=this.dateValidateModule.getValidStartDate(t),0!==s&&(r=this.updateDateByOffset(r,i,e)),a=e.isMilestone?r:this.dateValidateModule.checkStartDate(r,e)}return a},e.prototype.updateDateByOffset=function(e,t,i){var r,a=t.offset,n=t.offsetUnit;return a<0?r=this.dateValidateModule.getStartDate(this.dateValidateModule.checkEndDate(e,i),-1*a,n,i,!0):(r=this.dateValidateModule.getEndDate(e,a,n,i,!1),i.isMilestone||(r=this.dateValidateModule.checkStartDate(r,i))),r},e.prototype.createConnectorLinesCollection=function(e){var t,i,r=e||this.parent.currentViewData,a=r.length;for(this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.updatedRecords:this.parent.getExpandedRecords(this.parent.updatedRecords),t=0;t<a;t++)(i=r[t].ganttProperties.predecessor)&&this.addPredecessorsCollection(i)},e.prototype.addPredecessorsCollection=function(e){var t,i,r,a,n;if(e)for(t=e.length,i=0;i<t;i++){r=e[i];a=this.parent.connectorLineModule.getRecordByID(r.from),n=this.parent.connectorLineModule.getRecordByID(r.to),this.parent.connectorLineModule.expandedRecords&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(a)&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(n)&&this.updateConnectorLineObject(a,n,r)}},e.prototype.updateConnectorLineObject=function(e,t,i){var r=this.parent.connectorLineModule.createConnectorLineObject(e,t,i);if(r){if(t.isCritical&&e.isCritical&&(r.isCritical=!0),this.parent.connectorLineIds.length>0&&-1===this.parent.connectorLineIds.indexOf(r.connectorLineId)||0===this.parent.connectorLineIds.length)this.parent.updatedConnectorLineCollection.push(r),this.parent.connectorLineIds.push(r.connectorLineId);else if(-1!==this.parent.connectorLineIds.indexOf(r.connectorLineId)){var a=this.parent.connectorLineIds.indexOf(r.connectorLineId);this.parent.updatedConnectorLineCollection[a]=r}i.isDrawn=!0}return r},e.prototype.validatePredecessor=function(e,t,i){if(this.parent.isInPredecessorValidation&&e.ganttProperties.predecessor){var r=this.parent.editModule.taskbarEditModule,a=void 0;r&&(a=r.taskBarEditRecord);for(var n=e.ganttProperties.predecessor,s=void 0,o=null,l=void 0,d=void 0,h="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString(),p=n.filter(function(e){return e.to===h?e:null}),c=n.filter(function(e){return e.from===h?e:null}),u=0;u<p.length;u++){l=p[u],s=this.parent.connectorLineModule.getRecordByID(l.from),o=this.parent.connectorLineModule.getRecordByID(l.to),this.parent.isInPredecessorValidation&&o.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1;var g="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;g.toString()!==l.to&&g.toString()!==l.from||i&&"predecessor"!==i||this.validateChildGanttRecord(s,o)}for(u=0;u<c.length;u++)d=c[u],s=this.parent.connectorLineModule.getRecordByID(d.from),o=this.parent.connectorLineModule.getRecordByID(d.to),this.parent.isInPredecessorValidation&&o.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1,"predecessor"!==i&&this.parent.isValidationEnabled&&this.validateChildGanttRecord(s,o),!1!==s.expanded&&o.expanded,o&&this.validatePredecessor(o,void 0,"successor");if(o&&o.ganttProperties.taskId!==this.isValidatedParentTaskID&&a){var f=!1,m=a.ganttProperties.predecessorsName?a.ganttProperties.predecessorsName.split(",").length:a.ganttProperties.predecessorsName,y=a.ganttProperties.predecessor?a.ganttProperties.predecessor.length:a.ganttProperties.predecessor;y&&m!==y?f=!0:o.hasChildRecords&&o.ganttProperties.predecessor.length>0&&a.hasChildRecords&&!a.ganttProperties.predecessor&&(f=!0),"ParentDrag"!==r.taskBarEditAction&&"ChildDrag"!==r.taskBarEditAction?!a.hasChildRecords&&o.hasChildRecords&&(this.parent.editModule.updateChildItems(o),this.isValidatedParentTaskID=o.ganttProperties.taskId):(o.hasChildRecords&&"ChildDrag"==r.taskBarEditAction||f&&"ParentDrag"==r.taskBarEditAction)&&(this.parent.editModule.updateChildItems(o),this.isValidatedParentTaskID=o.ganttProperties.taskId),a.hasChildRecords||this.parent.dataOperation.updateParentItems(o,!0)}else o&&o.hasChildRecords&&!a&&this.parent.editModule.updateChildItems(o)}},e.prototype.getValidPredecessor=function(e){var i=this,r=[];if(!t.isNullOrUndefined(e)){var a=e.ganttProperties.predecessor;a&&a.length>0&&(r=a.filter(function(t){var r="ResourceView"===i.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;return t.from!==r.toString()}))}return r},e}(),Yt=function(){function e(e){this.transform="",this.connectorLinePath="",this.arrowPath="",this.expandedRecords=[],this.parent=e,this.dependencyViewContainer=t.createElement("div",{className:we}),Object.assign(this.dependencyViewContainer.style,{width:"100%",height:"100%",zIndex:2,position:"absolute",pointerEvents:"none"}),this.renderer=new s.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%")}return e.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},e.prototype.initPublicProp=function(){this.lineColor=this.parent.connectorLineBackground,this.lineStroke=this.parent.connectorLineWidth>4?4:this.parent.connectorLineWidth,this.createConnectorLineTooltipTable()},e.prototype.getTaskbarMidpoint=function(e){return Math.floor(e?this.parent.chartRowsModule.milestoneMarginTop+this.parent.chartRowsModule.milestoneHeight/2+1:this.parent.chartRowsModule.taskBarMarginTop+this.parent.chartRowsModule.taskBarHeight/2)+1},e.prototype.createConnectorLineObject=function(e,i,r){var a={},n=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport?this.parent.flatData:this.expandedRecords,s=n.indexOf(e),o=n.indexOf(i),l=e.ganttProperties,d=i.ganttProperties,h=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.getExpandedRecords(this.parent.currentViewData);a.parentIndexInCurrentView=h.indexOf(e),a.childIndexInCurrentView=h.indexOf(i);if(!(this.parent.virtualScrollModule&&this.parent.enableVirtualization)&&(-1===a.parentIndexInCurrentView||-1===a.childIndexInCurrentView)||-1===a.parentIndexInCurrentView&&-1===a.childIndexInCurrentView)return null;a.parentLeft=l.isMilestone?l.left-this.parent.chartRowsModule.milestoneHeight/2:l.left,a.childLeft=d.isMilestone?d.left-this.parent.chartRowsModule.milestoneHeight/2:d.left,a.parentWidth=0===l.width||l.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):l.width,a.childWidth=0===d.width||d.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):d.width,a.parentIndex=s,a.childIndex=o;var p=!t.isNullOrUndefined(this.parent.ganttChartModule.getChartRows())&&this.parent.ganttChartModule.getChartRows()[0]&&this.parent.ganttChartModule.getChartRows()[0].getBoundingClientRect().height;a.rowHeight=p&&!isNaN(p)?p:this.parent.rowHeight,a.type=r.type;var c="ResourceView"===this.parent.viewType?l.taskId:l.rowUniqueID,u="ResourceView"===this.parent.viewType?d.taskId:d.rowUniqueID;return a.connectorLineId="parent"+c+"child"+u,a.milestoneParent=!!l.isMilestone,a.milestoneChild=!!d.isMilestone,a.isManualParent=!this.parent.flatData[s].ganttProperties.isAutoSchedule&&this.parent.flatData[s].hasChildRecords,a.isManualChild=!this.parent.flatData[o].ganttProperties.isAutoSchedule&&this.parent.flatData[o].hasChildRecords,a.parentEndPoint=a.parentLeft+a.parentWidth,a.childEndPoint=a.childLeft+a.childWidth,t.isNullOrUndefined(m(l))||t.isNullOrUndefined(m(d))?null:a},e.prototype.renderConnectorLines=function(e){for(var t="",i=[],r=0;r<e.length;r++)t+=this.getConnectorLineTemplate(e[r]),i.push(e[r]);this.svgObject.innerHTML=t;for(var a=this.parent.connectorLineModule.svgObject.childNodes,n=0;n<a.length;n++)for(var s=a[n].childNodes,o=0;o<s.length;o++){var l="Connector Line "+this.parent.connectorLineModule.generateAriaLabel(i[n]);s[o].setAttribute("aria-label",l)}this.parent.ganttChartModule.chartBodyContent.insertBefore(this.dependencyViewContainer,this.parent.ganttChartModule.chartBodyContent.lastChild),this.dependencyViewContainer.appendChild(this.svgObject);for(n=0;n<this.svgObject.children.length;n++)this.svgObject.children[n].children[0].setAttribute("tabindex","-1")},e.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";if("FF"===e.type)return"FFType2"}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("FF"===e.type)return"FFType1"}else if(e.childLeft+e.childWidth>e.parentLeft+e.parentWidth&&"FF"===e.type)return"FFType2";if("FS"===e.type)return"FSType2";if("SS"===e.type)return"SSType2";if("FF"===e.type)return"FFType1";if("SF"===e.type)return"SFType1"}else if(e.parentLeft<e.childLeft){if("FS"===e.type)return"FSType2";if("FF"===e.type)return"FFType2";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 30>=e.childLeft-(e.milestoneParent?e.parentLeft+e.parentWidth+4:e.parentLeft+e.parentWidth)?"FSType3":"FSType4";if(e.parentLeft<e.childLeft||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.childLeft+e.childWidth>e.parentLeft+e.parentWidth&&"FF"===e.type)return"FFType4"}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},e.prototype.getHeightValue=function(e){return"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap?e.parentIndex*this.parent.rowHeight>e.childIndex*this.parent.rowHeight?e.parentIndex*this.parent.rowHeight-e.childIndex*this.parent.rowHeight:e.childIndex*this.parent.rowHeight-e.parentIndex*this.parent.rowHeight:e.parentIndex*e.rowHeight>e.childIndex*e.rowHeight?e.parentIndex*e.rowHeight-e.childIndex*e.rowHeight:e.childIndex*e.rowHeight-e.parentIndex*e.rowHeight},e.prototype.getInnerElementWidthSSType2=function(e){return e.parentLeft===e.childLeft?10:e.childLeft-e.parentLeft},e.prototype.getInnerElementLeftSSType2=function(e){return e.parentLeft===e.childLeft?e.parentLeft-20:e.parentLeft-10},e.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},e.prototype.getBorderStyles=function(e,i){return"border-"+e+"-width:"+i+"px;"+("border-"+e+"-style:solid;")+(t.isNullOrUndefined(this.lineColor)?"":"border-"+e+"-color:"+this.lineColor+";")},e.prototype.getConnectorLineTemplate=function(e){var t=this.getInnerChildWidthSSType2(e),i=this.getInnerElementWidthSSType2(e),r=this.getInnerElementLeftSSType2(e),a=this.getHeightValue(e),n=(e.milestoneParent,e.milestoneChild,this.parent.virtualScrollModule&&this.parent.enableVirtualization),s=this.getPosition(e,this.getParentPosition(e),a),o=this.getPosition(e,this.getParentPosition(e),a).top,l=0;this.parent.renderBaseline&&(l=e.milestoneParent&&e.milestoneChild?0:e.milestoneParent?-5:e.milestoneChild?5:0);var d=n?s.height:a+l,h=0,p=0,c=0;if("ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(var u=0;u<this.parent.currentViewData.length;u++)"none"!=this.parent.getRowByIndex(u).style.display&&c<e.parentIndex&&(c++,h+=this.parent.getRowByIndex(u).offsetHeight);c=0;for(var g=0;g<this.parent.currentViewData.length;g++)"none"!=this.parent.getRowByIndex(g).style.display&&c<e.childIndex&&(c++,p+=this.parent.getRowByIndex(g).offsetHeight);d=Math.abs(h-p)}if(this.parent.currentViewData[e.parentIndex]&&this.parent.currentViewData[e.childIndex]&&this.parent.allowParentDependency){var f=this.parent.currentViewData[e.parentIndex].hasChildRecords,m=this.parent.currentViewData[e.childIndex].hasChildRecords,y=this.parent.currentViewData[e.parentIndex].ganttProperties.isAutoSchedule,D=this.parent.currentViewData[e.childIndex].ganttProperties.isAutoSchedule,v=!0;(f&&y&&!m||m&&D&&!f||f&&y&&D&&m||!f&&!m)&&(v=!1),v&&(f&&!y&&m&&!D||f&&!y&&m&&!D||(e.childIndex,e.parentIndex),this.parent.currentViewData[e.parentIndex].ganttProperties.isMilestone?e.parentIndex>e.childIndex||"SS"===e.type||e.type:this.parent.currentViewData[e.childIndex].ganttProperties.isMilestone&&(e.parentIndex>e.childIndex||"SS"===e.type||e.type))}return this.getParentPosition(e)&&(this.transform=this.parent.enableRtl?"translate("+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:ke}),this.connectorPath=this.renderer.drawPath({class:Te,d:this.connectorLinePath,fill:"transparent","stroke-width":1}),this.arrowlinePath=this.renderer.drawPath({d:this.arrowPath,class:Se}),this.groupObject.appendChild(this.connectorPath),this.groupObject.appendChild(this.arrowlinePath),"FSType1"===this.getParentPosition(e)&&(this.taskLineValue=e.milestoneChild?1:0,this.x1=e.parentEndPoint+(e.milestoneParent?-1:e.milestoneChild?-1:0),this.x2=e.milestoneParent?e.childLeft-(e.parentEndPoint+10)+1-10+1:e.childLeft-(e.parentEndPoint+10)-10,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+this.y2)+" L "+(this.x1+this.x2+11)+" "+(this.y1+this.y2),this.arrowPath="M "+(this.x1+this.x2+18)+" "+(this.y1+this.y2+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1+this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1+this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FSType2"===this.getParentPosition(e)&&(this.taskLineValue=e.milestoneChild?1:0,this.x1=e.parentLeft+(e.milestoneChild?-1:0),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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d-this.getconnectorLineGap(e)+this.taskLineValue,this.y3=this.getconnectorLineGap(e),this.y4=this.y1+this.y2-(this.y1+this.y2)%e.rowHeight,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x3)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x3)+" "+this.y4+" L "+(this.x1+this.x4)+" "+this.y4+" L "+(this.x1+this.x4)+" "+(this.y1+this.y2+this.y3)+" L "+(this.x1+this.x4+11)+" "+(this.y1+this.y2+this.y3),this.arrowPath="M "+(this.x1+this.x4+18)+" "+(this.y1+this.y2+this.y3+this.manualChild)+" L "+(this.x1+this.x4+11)+" "+(this.y1+this.y2+this.y3-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x4+11)+" "+(this.y1+this.y2+this.y3+4+this.lineStroke+this.manualChild)+" Z"),"FSType3"===this.getParentPosition(e)&&(this.taskLineValue=e.milestoneChild?1:0,this.point1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),this.x1=e.childLeft+(e.milestoneChild?-1:0)+(e.milestoneParent?1:0)-20,this.x2=e.parentEndPoint-e.childLeft+30,this.y1=this.point1+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.point1+d-this.getconnectorLineGap(e)+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneChild?-10:0),this.y3=this.getconnectorLineGap(e)+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.y4=this.y2-this.y2%e.rowHeight,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+12)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" 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+18)+" "+(this.y1+this.manualChild)+" L "+(this.x1+11)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+11)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"FSType4"===this.getParentPosition(e)&&(this.point1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),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)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.point1+d+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2+11)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+this.y2+" L "+this.x1+" "+this.y2,this.arrowPath="M "+(this.x1+this.x2+18)+" "+(this.y1+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SSType4"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=d+this.taskLineValue,this.point2=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),this.x1=e.parentLeft-8,this.x2=e.childLeft-e.parentLeft,this.y1=this.point2+(e.milestoneChild?1:0)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+10)+" "+this.y2,this.arrowPath="M "+(this.x1+this.x2+8)+" "+(this.y1+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SSType3"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue,this.x1=e.childLeft-20,this.y1=(e.milestoneChild?1:0)+(this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild))+(e.isManualParent&&e.isManualChild?-10:0),this.x2=e.parentLeft-e.childLeft+21,this.y2=this.y1+this.point1+(this.parent.renderBaseline?e.milestoneChild?-11:e.milestoneParent?10:0:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+12)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+this.x2)+" "+this.y2,this.arrowPath="M "+(this.x1+20)+" "+(this.y1+this.manualChild)+" L "+(this.x1+12)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+12)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SSType2"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue,this.x1=r,this.x2=t+1,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+i)+" "+this.y2,this.arrowPath="M "+(this.x1+i+8)+" "+(this.y2+this.manualChild)+" L "+(this.x1+i)+" "+(this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+i)+" "+(this.y2+4+this.lineStroke+this.manualChild)+" Z"),"SSType1"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue,this.x1=e.childLeft-20,this.x2=e.parentLeft-e.childLeft+21,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+ +(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+12)+" "+this.y2,this.arrowPath="M "+(this.x1+20)+" "+(this.y2+this.manualChild)+" L "+(this.x1+12)+" "+(this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+12)+" "+(this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FFType1"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2)+" L "+(this.x1+this.x4)+" "+(this.y1+this.y2),this.arrowPath="M "+this.x1+" "+(this.y1+this.y2+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1+this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1+this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FFType2"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x2+" "+(this.y1+this.y2)+" L "+this.x3+" "+(this.y1+this.y2),this.arrowPath="M "+(this.x3-8)+" "+(this.y1+this.y2+this.manualChild)+" L "+this.x3+" "+(this.y1+this.y2-(4+this.lineStroke)+this.manualChild)+" L "+this.x3+" "+(this.y1+this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FFType3"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2)+" L "+this.x4+" "+(this.y1+this.y2),this.arrowPath="M "+this.x1+" "+(this.y1+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"FFType4"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue+ +(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.y2)+" L "+this.x1+" "+(this.y1+this.y2),this.arrowPath="M "+(this.x2-8)+" "+(this.y1+this.manualChild)+" L "+this.x2+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+this.x2+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SFType4"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?-1:0,this.point1=d-this.getconnectorLineGap(e)+this.taskLineValue,this.point2=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),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+(e.milestoneChild?1:0)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1+(this.parent.renderBaseline&&e.milestoneChild?-11:0),this.y3=this.getconnectorLineGap(e)+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.y4=this.y2-this.y2%e.rowHeight,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+this.y4+" L "+this.x1+" "+this.y4+" L "+this.x1+" "+(this.y2+this.y3)+" L "+(this.x1+11)+" "+(this.y2+this.y3),this.arrowPath="M "+(this.x2-8)+" "+(this.y1+this.manualChild)+" L "+this.x2+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+this.x2+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SFType3"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=e.parentLeft-(e.childEndPoint+(e.milestoneParent?25:20))+1+(this.parent.renderBaseline&&e.milestoneParent?5:0),this.point2=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),this.x1=e.childEndPoint,this.x2=this.x1+(e.milestoneChild?9:8),this.x3=this.x2+(e.milestoneChild?17:11),this.y1=this.point2+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+d+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+this.y2+" L "+(this.x3+this.point1)+" "+this.y2,this.arrowPath="M "+(this.x2-8)+" "+(this.y1+this.manualChild)+" L "+this.x2+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+this.x2+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SFType1"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d-this.getconnectorLineGap(e)+this.taskLineValue,this.point2=this.getconnectorLineGap(e),this.x1=e.parentLeft-10,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+ +(e.isManualParent&&e.isManualChild?-10:0),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,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+11)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y3+" L "+(this.x1+this.x2)+" "+this.y3+" L "+(this.x1+this.x2)+" "+(this.y2+this.point2)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2),this.arrowPath="M "+(this.x1+this.x3-8)+" "+(this.y2+this.point2+this.manualChild)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2+4+this.lineStroke+this.manualChild)+" Z"),"SFType2"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.childEndPoint,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+ +(e.isManualParent&&e.isManualChild?-10:0),this.x2=e.parentLeft-e.childEndPoint,this.y2=this.y1+d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2+1)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2-10)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2-10)+" "+this.y2+" L "+(this.x1+8)+" "+this.y2,this.arrowPath="M "+this.x1+" "+(this.y2+this.manualChild)+" L "+(this.x1+8)+" "+(this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+8)+" "+(this.y2+4+this.lineStroke+this.manualChild)+" Z"),this.connectorPath.setAttribute("d",this.connectorLinePath),this.arrowlinePath.setAttribute("d",this.arrowPath)),this.groupObject.outerHTML},e.prototype.getPosition=function(e,t,i){var r=0,a=0;if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){var n=!!e.milestoneParent,s=!!e.milestoneChild,o=this.getTaskbarMidpoint(n)-(this.lineStroke-1),l=this.getTaskbarMidpoint(s)-(this.lineStroke-1),d=-1!==e.parentIndexInCurrentView,h=-1!==e.childIndexInCurrentView,p=this.parent.currentViewData.length-1;"SSType1"===t||"SSType2"===t||"FFType1"===t||"FFType2"===t||"SFType2"===t?(r=d?e.parentIndexInCurrentView*e.rowHeight+o:0,a=d&&h?i:h?e.childIndexInCurrentView*e.rowHeight+o:p*e.rowHeight+o):"SSType3"===t||"SSType4"===t||"FSType4"===t||"FFType3"===t||"FFType4"===t||"SFType4"===t||"SFType3"===t?(r=h?e.childIndexInCurrentView*e.rowHeight+l:0,a=d&&h?i:d?e.parentIndexInCurrentView*e.rowHeight+l:p*e.rowHeight+l):"FSType3"===t?(r=h?e.childIndexInCurrentView*e.rowHeight+o:0,a=d&&h?i:d?e.parentIndexInCurrentView*e.rowHeight+l:p*e.rowHeight+o):"SFType1"!==t&&"FSType1"!==t&&"FSType2"!==t||(r=d?e.parentIndexInCurrentView*e.rowHeight+l:0,a=d&&h?i:h?e.childIndexInCurrentView*e.rowHeight+l:p*e.rowHeight+l)}return{top:r,height:a}},e.prototype.createConnectorLineTooltipTable=function(){this.tooltipTable=t.createElement("table",{className:".e-tooltiptable",styles:"margin-top:0px",attrs:{cellspacing:"2px",cellpadding:"2px"}});var e=t.createElement("tbody");e.innerHTML="",this.tooltipTable.appendChild(e)},e.prototype.getConnectorLineTooltipInnerTd=function(e,t,i,r){var a='<tr id="fromPredecessor"><td style="padding: 4px;">'+this.parent.localeObj.getConstant("from")+"</td><td> ";return a=a+e+' </td><td style="padding: 2px;"> '+this.parent.localeObj.getConstant(t)+" </td> </tr>",a=a+'<tr id="toPredecessor"><td style="padding: 4px;">'+this.parent.localeObj.getConstant("to")+"</td><td> "+i,a=a+' </td><td style="padding: 2px;"> '+this.parent.localeObj.getConstant(r)+" </td></tr></tbody><table>"},e.prototype.generateAriaLabel=function(e){var t=e.type,i=this.expandedRecords,r=i[e.parentIndex].ganttProperties.taskName,a=i[e.childIndex].ganttProperties.taskName,n=this.parent.localeObj.getConstant("start"),s=this.parent.localeObj.getConstant("finish");return"FS"===t?r+" "+s+" to "+a+" "+n:"FF"===t?r+" "+s+" to "+a+" "+s:"SS"===t?r+" "+n+" to "+a+" "+n:r+" "+n+" to "+a+" "+s},e.prototype.getRecordByID=function(e){return t.isNullOrUndefined(e)?null:"ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf("T"+e.toString())]:this.parent.flatData[this.parent.ids.indexOf(e.toString())]},e.prototype.removePreviousConnectorLines=function(e){for(var i,r=(i=!0===t.isObject(e))?Object.keys(e).length:e.length,a=Object.keys(e),n=0;n<r;n++){var s=void 0;if(i){s=e[a[n]]}else s=e[n];var o=s.ganttProperties&&s.ganttProperties.predecessor;if(o&&o.length>0)for(var l=0;l<o.length;l++){var d="parent"+o[l].from+"child"+o[l].to;this.removeConnectorLineById(d)}}},e.prototype.removeConnectorLineById=function(e){var i=this.parent.connectorLineModule.dependencyViewContainer.querySelector("#ConnectorLine"+e);t.isNullOrUndefined(i)||t.remove(i)},e}(),Zt=function(){function e(e){this.parent=e,this.parent.on("destroy",this.destroy,this)}return e.prototype.renderSplitter=function(){var e=this,i=this.calculateSplitterPosition(this.parent.splitterSettings);this.parent.splitterElement=t.createElement("div",{className:"e-gantt-splitter"}),this.parent.treeGridPane=t.createElement("div",{className:"e-gantt-tree-grid-pane"}),this.parent.chartPane=t.createElement("div",{className:"e-gantt-chart-pane"}),t.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 o.Splitter({height:null,width:this.parent.ganttWidth.toString(),enablePersistence:this.parent.enablePersistence,enableRtl:this.parent.enableRtl,separatorSize:this.parent.splitterSettings.separatorSize,paneSettings:[{resizable:!0,size:i,min:this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum)},{resizable:!0}],orientation:"Horizontal",resizeStart:function(t){e.parent.contextMenuModule&&e.parent.contextMenuModule.isOpen&&e.parent.contextMenuModule.contextMenu.close();var i=t.pane[0],r=t.pane[1];e.splitterPreviousPositionGrid=i.scrollWidth+1+"px",e.splitterPreviousPositionChart=r.scrollWidth+1+"px";var n=new a.Deferred;return e.parent.trigger("splitterResizeStart",t,function(e){n.resolve(e)}),n},resizing:function(t){e.parent.trigger("splitterResizing",t)},resizeStop:function(i){var r=i.pane[0];e.splitterPreviousPositionGrid=r.scrollWidth+1+"px",e.splitterObject.paneSettings[0].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionGrid);var n=new a.Deferred;return e.parent.trigger("splitterResized",i,function(i){!0===i.cancel&&(e.splitterObject.paneSettings[0].size=null,e.splitterObject.paneSettings[0].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionGrid),e.splitterObject.paneSettings[1].size=null,e.splitterObject.paneSettings[1].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionChart)),t.isNullOrUndefined(e.parent.projectEndDate)&&e.parent.timelineModule.updateTimelineAfterZooming(e.parent.timelineModule.timelineEndDate,!0),n.resolve(i)}),n}}),this.parent.element.appendChild(this.parent.splitterElement),this.splitterObject.appendTo(this.parent.splitterElement)},e.prototype.calculateSplitterPosition=function(e){return!t.isNullOrUndefined(this.splitterObject)&&this.parent.enablePersistence?this.splitterObject.paneSettings[0].size:"Grid"===e.view?"100%":"Chart"===e.view?"0%":t.isNullOrUndefined(e.position)||""===e.position?!t.isNullOrUndefined(e.columnIndex)&&e.columnIndex>=0?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"):this.getSpliterPositionInPercentage("250px"):this.getSpliterPositionInPercentage(e.position)},e.prototype.getSpliterPositionInPercentage=function(e){var i=t.isNullOrUndefined(e)||""===e?null:e;if(!t.isNullOrUndefined(i))if(-1!==e.indexOf("px")){var r=parseInt(e,10);i=r/this.parent.ganttWidth*100<=100?r/this.parent.ganttWidth*100+"%":"25%"}else i=-1===e.indexOf("%")?e+"%":e;return i},e.prototype.getTotalColumnWidthByIndex=function(e){var t=0,i=this.parent.ganttColumns;e=i.length>e?e:i.length;for(var r=0;r<e;r++)t+=parseInt(i[r].width);return t},e.prototype.updateSplitterPosition=function(){this.splitterObject.separatorSize=this.parent.splitterSettings.separatorSize>=4?this.parent.splitterSettings.separatorSize:4;var e=this.calculateSplitterPosition(this.parent.splitterSettings);this.splitterObject.paneSettings[0].min=this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum),this.splitterObject.dataBind(),this.splitterObject.paneSettings[0].size=e},e.prototype.triggerCustomResizedEvent=function(){var e=this.splitterObject.element.querySelectorAll(".e-pane")[0],t=this.splitterObject.element.querySelectorAll(".e-pane")[1],i={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",i),!0===i.cancel&&(this.splitterObject.paneSettings[0].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionGrid),this.splitterObject.paneSettings[1].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionChart))},e.prototype.destroy=function(){this.splitterObject.destroy(),this.parent.off("destroy",this.destroy)},e}(),Qt=function(){function e(e){this.parent=e,this.createTooltip(),this.parent.on("destroy",this.destroy,this)}return e.prototype.createTooltip=function(){this.toolTipObj=new i.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, .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="e-gantt-tooltip",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)},e.prototype.tooltipBeforeRender=function(e){var i=this.parent;if(i.isOnEdit)e.cancel=!0;else{var r,n=t.closest(e.target,"div."+H);r=t.isNullOrUndefined(n)?f(e.target,Z):e.target;var s,o={data:{},args:e,cancel:!1,content:""};if(e.target.classList.contains("e-header-cell-label"))i.timelineSettings.showTooltip?o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("timeline",s,i,e):e.cancel=!0;else if(i.tooltipSettings.showTooltip)if(r&&(o.data=i.ganttChartModule.getRecordByTaskBar(r),s=o.data),e.target.classList.contains("e-gantt-child-taskbar")||e.target.classList.contains("e-gantt-parent-taskbar")||e.target.classList.contains("e-gantt-milestone")||e.target.classList.contains("e-gantt-unscheduled-taskbar")||e.target.classList.contains("e-taskbar-left-resizer")||e.target.classList.contains("e-taskbar-right-resizer")||e.target.classList.contains("e-gantt-manualparenttaskbar")&&i.tooltipSettings.taskbar){var l=void 0;i.tooltipSettings.taskbar&&(l=i.tooltipModule.templateCompiler(i.tooltipSettings.taskbar,i,s,"TooltipTaskbarTemplate"));var d=document.createElement("div");l&&t.append(l,d),o.content=this.toolTipObj.content=l?d:i.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"taskbar",s,i,e)}else if(e.target.classList.contains("e-baseline-bar")||e.target.classList.contains("e-baseline-gantt-milestone")){var h=void 0;i.tooltipSettings.baseline&&(h=i.tooltipModule.templateCompiler(i.tooltipSettings.baseline,i,s,"TooltipBaselineTemplate"));var p=document.createElement("div");h&&t.append(h,p),o.content=this.toolTipObj.content=h?p:i.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"baseline",s,i,e)}else if(e.target.classList.contains("e-event-markers"))o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("marker",s,i,e);else if(e.target.classList.contains("e-connector-line-container")){var c=void 0;i.tooltipModule.predecessorTooltipData=i.tooltipModule.getPredecessorTooltipData(e),o.data=this.predecessorTooltipData,i.tooltipSettings.connectorLine&&(c=i.tooltipModule.templateCompiler(i.tooltipSettings.connectorLine,i,i.tooltipModule.predecessorTooltipData,"TooltipConnectorLineTemplate")),o.content=this.toolTipObj.content=c?c[0]:i.tooltipModule.getTooltipContent("connectorLine",s,i,e)}else if(e.target.classList.contains("e-indicator-span"))o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("indicator",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0);else if(e.target.classList.contains("e-notes-info")){var u=this.parent.ganttChartModule.getRecordByTarget(e.event);o.content=this.toolTipObj.content=u.ganttProperties.notes,t.isNullOrUndefined(o.content)&&(e.cancel=!0)}else e.target.classList.contains("e-gantt-manualparenttaskbar")?(o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("manualtaskbar",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0)):e.target.classList.contains("e-gantt-manualparent-milestone")&&(o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("manualmilestone",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0));else e.cancel=!0;if(!1===e.cancel){var g=new a.Deferred;return i.trigger("beforeTooltipRender",o,function(t){g.resolve(t),t.cancel&&(e.cancel=!0)}),this.toolTipObj.content=o.content,this.parent.isAdaptive||"mouseover"!==e.event.type||(this.currentTarget=e.target,t.EventHandler.add(this.currentTarget,"mousemove",this.mouseMoveHandler.bind(this))),this.parent.renderTemplates(),g}}},e.prototype.tooltipCloseHandler=function(e){this.tooltipMouseEvent=null,this.parent.isAdaptive||t.EventHandler.remove(this.currentTarget,"mousemove",this.mouseMoveHandler),this.currentTarget=null},e.prototype.mouseMoveHandler=function(e){this.tooltipMouseEvent=e},e.prototype.updateTooltipPosition=function(e){if(e.element.style.visibility="visible",!t.isNullOrUndefined(this.tooltipMouseEvent)&&!e.target.classList.contains("e-notes-info")){var i=this.getPointorPosition(this.tooltipMouseEvent),r=this.parent.getOffsetRect(this.parent.chartPane),a=r.top+this.parent.chartPane.offsetHeight,n=r.left+this.parent.chartPane.offsetWidth,s=i.x,o=i.y;if(n<s+e.element.offsetWidth+10)for(;n<s+e.element.offsetWidth+10;)s=n-e.element.offsetWidth-10,e.element.style.left=s+"px";else s+=10,e.element.style.left=s+"px";window.innerHeight<e.element.offsetHeight+o&&(o=o-e.element.offsetHeight-10),a<o+e.element.offsetHeight+20?o=o-e.element.offsetHeight-10:o+=10,e.element.style.top=o+"px"}},e.prototype.getPointorPosition=function(e){var i,r;return t.isNullOrUndefined(t.getValue("pageX",e))&&t.isNullOrUndefined(t.getValue("pageY",e))?t.isNullOrUndefined(t.getValue("clientX",e))&&t.isNullOrUndefined(t.getValue("clientY",e))||(i=t.getValue("clientX",e)+document.body.scrollLeft+document.documentElement.scrollLeft,r=t.getValue("clientY",e)+document.body.scrollTop+document.documentElement.scrollTop):(i=t.getValue("pageX",e),r=t.getValue("pageY",e)),{x:i,y:r}},e.prototype.getTooltipContent=function(e,i,r,a){var n,s,o;if(i){var l=(s=i.ganttProperties).taskName;this.parent.enableHtmlSanitizer&&"string"==typeof l&&(l=t.SanitizeHtmlHelper.sanitize(l)),o=t.isNullOrUndefined(l)?"":'<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">'+(this.parent.disableHtmlEncode?l.replace(/</g,"<").replace(/>/g,">"):l)+"</td></tr>"}switch(e){case"milestone":var d=void 0;a.target.className.includes("e-baseline-gantt-milestone")&&!t.isNullOrUndefined(s.baselineStartDate)?d=s.baselineStartDate:t.isNullOrUndefined(s.startDate)||(d=s.startDate);var h=this.parent.getFormatedDate(d,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&"string"==typeof h&&(h=t.SanitizeHtmlHelper.sanitize(h));var p=t.isNullOrUndefined(d)?"":'<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+h+"</td></tr>";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+p+"</tbody></table>"});break;case"taskbar":var c=!(i.hasChildRecords&&!s.isAutoSchedule),u=this.parent.getFormatedDate(c?s.startDate:s.autoStartDate,this.parent.getDateFormat()),g=this.parent.getFormatedDate(c?s.endDate:s.autoEndDate,this.parent.getDateFormat()),f=this.parent.getDurationString(c?s.duration:s.autoDuration,s.durationUnit),m=s.progress;this.parent.enableHtmlSanitizer&&(u="string"==typeof u?t.SanitizeHtmlHelper.sanitize(u):u,g="string"==typeof g?t.SanitizeHtmlHelper.sanitize(g):g,f="string"==typeof f?t.SanitizeHtmlHelper.sanitize(f):f,m="string"==typeof m?t.SanitizeHtmlHelper.sanitize(m):m);var y=s.startDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(c?"startDate":"subTasksStartDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value"> '+u+"</td></tr>":"",D=s.endDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(c?"endDate":"subTasksEndDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+g+"</td></tr>":"",v=t.isNullOrUndefined(s.duration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value"> '+f+"</td></tr>",w=t.isNullOrUndefined(s.progress)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+'</td><td style="padding: 2px;">:</td><td>'+m+"</td></tr>";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+y+D+v+w+"</tbody></table>"});break;case"baseline":var k=this.parent.getFormatedDate(s.baselineStartDate,this.parent.getDateFormat()),T=this.parent.getFormatedDate(s.baselineEndDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(k="string"==typeof k?t.SanitizeHtmlHelper.sanitize(k):k,T="string"==typeof T?t.SanitizeHtmlHelper.sanitize(T):T);n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+k+'</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+T+"</td></tr></tbody></table>"},this);break;case"marker":var b=r.tooltipModule.getMarkerTooltipData(a),P=this.parent.getFormatedDate(this.parent.dateValidationModule.getDateFromFormat(b.day),this.parent.getDateFormat()),S=b.label?b.label:"";this.parent.enableHtmlSanitizer&&(S="string"==typeof S?t.SanitizeHtmlHelper.sanitize(S):S,P="string"==typeof P?t.SanitizeHtmlHelper.sanitize(P):P);n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr><td>'+P+"</td></tr><tr><td>"+(this.parent.disableHtmlEncode?S.replace(/</g,"<").replace(/>/g,">"):S)+"</td></tr></tbody></table>"},this);break;case"connectorLine":var C=r.tooltipModule.predecessorTooltipData.fromName,M=r.tooltipModule.predecessorTooltipData.fromId,R=r.tooltipModule.predecessorTooltipData.toName,O=r.tooltipModule.predecessorTooltipData.toId,x=r.tooltipModule.predecessorTooltipData.linkText,I=r.tooltipModule.predecessorTooltipData.offsetString;this.parent.enableHtmlSanitizer&&(C="string"==typeof C?t.SanitizeHtmlHelper.sanitize(C):C,M="string"==typeof M?t.SanitizeHtmlHelper.sanitize(M):M,R="string"==typeof R?t.SanitizeHtmlHelper.sanitize(R):R,O="string"==typeof O?t.SanitizeHtmlHelper.sanitize(O):O,x="string"==typeof x?t.SanitizeHtmlHelper.sanitize(x):x,I="string"==typeof I?t.SanitizeHtmlHelper.sanitize(I):I);n=t.initializeCSPTemplate(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?C.replace(/</g,"<").replace(/>/g,">"):C)+" ("+(this.parent.disableHtmlEncode&&"string"==typeof M?M.replace(/</g,"<").replace(/>/g,">"):M)+')</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,"<").replace(/>/g,">"):R)+" ("+O+')</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("taskLink")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+x+'</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("lag")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+I+"</td></tr></tbody></table>"},this);break;case"indicator":if(a.target.title.length){var E=a.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof E&&(E=t.SanitizeHtmlHelper.sanitize(E));n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+E+"</tr></tbody></table>"})}break;case"timeline":var N=a.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof N&&(N=t.SanitizeHtmlHelper.sanitize(N));n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+N+"</tr></tbody></table>"});break;case"manualtaskbar":var F=this.parent.getFormatedDate(s.autoStartDate,this.parent.getDateFormat()),U=this.parent.getFormatedDate(s.autoEndDate,this.parent.getDateFormat()),V=this.parent.getDurationString(s.duration,s.durationUnit),L=this.parent.getFormatedDate(s.startDate,this.parent.getDateFormat()),B=this.parent.getFormatedDate(s.endDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(F="string"==typeof F?t.SanitizeHtmlHelper.sanitize(F):F,U="string"==typeof U?t.SanitizeHtmlHelper.sanitize(U):U,V="string"==typeof V?t.SanitizeHtmlHelper.sanitize(V):V,L="string"==typeof L?t.SanitizeHtmlHelper.sanitize(L):L,B="string"==typeof B?t.SanitizeHtmlHelper.sanitize(B):B);var A=s.autoStartDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+F+"</td></tr>":"",H=s.autoEndDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+U+"</td></tr>":"",j=t.isNullOrUndefined(s.duration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+V+"</td></tr>",W=s.startDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+L+"</td></tr>":"",q=s.endDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+B+"</td></tr>":"";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+W+A+q+H+j+"</tbody></table>"});break;case"manualmilestone":var G=this.parent.getFormatedDate(s.autoStartDate,this.parent.getDateFormat()),z=this.parent.getFormatedDate(s.autoEndDate,this.parent.getDateFormat()),_=this.parent.getFormatedDate(s.startDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(G="string"==typeof G?t.SanitizeHtmlHelper.sanitize(G):G,z="string"==typeof z?t.SanitizeHtmlHelper.sanitize(z):z,_="string"==typeof _?t.SanitizeHtmlHelper.sanitize(_):_);var X=s.autoStartDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+G+"</td></tr>":"",Y=s.autoEndDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+z+"</td></tr>":"",Z='<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+_+"</tr>";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+Z+X+Y+"</tbody></table>"})}return n},e.prototype.getMarkerTooltipData=function(e){var t=e.target.id.match(/\d+/g);return this.parent.eventMarkers[Number(t)]},e.prototype.getPredecessorTooltipData=function(e){var i=e.target.id;this.parent.enableHtmlSanitizer&&"string"==typeof i&&(i=t.SanitizeHtmlHelper.sanitize(i));var r=i.match(/ConnectorLineparent(.*)child(.*)/);r.shift();var a,n;"ResourceView"===this.parent.viewType?(a=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r[0])],n=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r[1])]):(a=this.parent.flatData[this.parent.ids.indexOf(r[0])],n=this.parent.flatData[this.parent.ids.indexOf(r[1])]);var s=a.ganttProperties.predecessor.filter(function(e){return e.to===r[1]});return{fromId:"ResourceView"===this.parent.viewType?a.ganttProperties.taskId:a.ganttProperties.rowUniqueID,toId:"ResourceView"===this.parent.viewType?n.ganttProperties.taskId:n.ganttProperties.rowUniqueID,fromName:a.ganttProperties.taskName,toName:n.ganttProperties.taskName,linkType:s[0].type,linkText:this.parent.getPredecessorTextValue(s[0].type),offset:s[0].offset,offsetUnit:s[0].offsetUnit,offsetString:this.parent.getDurationString(s[0].offset,s[0].offsetUnit)}},e.prototype.templateCompiler=function(e,i,r,a){var n=i.chartRowsModule.templateCompiler(e),s=i.chartRowsModule.getTemplateID(a);return n(t.extend({index:0},r),i,a,s,!0)},e.prototype.destroy=function(){this.toolTipObj.destroy()},e}(),Kt=function(){function e(e){this.parent=e,this.activeElement=null,this.previousActiveElement=null}return e.prototype.getActiveElement=function(e){return e?this.previousActiveElement:this.activeElement},e.prototype.setActiveElement=function(e){this.previousActiveElement=this.activeElement,this.activeElement=e},e.prototype.onKeyPress=function(e){var i=this.parent,r=i.getExpandedRecords(i.currentViewData);if(t.isNullOrUndefined(this.parent.focusModule.getActiveElement())&&("expandAll"===e.action||"collapseAll"===e.action)){this.parent.element.querySelector(".e-treegrid").focus()}var a=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||t.isNullOrUndefined(i.editModule)||t.isNullOrUndefined(i.editModule.cellEditModule)||!0!==i.editModule.cellEditModule.isCellEdit)switch(i.isAdaptive&&("addRowDialog"!==e.action&&"editRowDialog"!==e.action&&"delete"!==e.action&&"addRow"!==e.action||i.selectionModule&&"Multiple"===i.selectionSettings.type&&(i.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),e.action){case"home":if(i.selectionModule&&"Cell"!==i.selectionSettings.mode){if(0===i.selectedRowIndex)return;i.selectionModule.selectRow(0,!1,!0)}break;case"end":if(i.selectionModule&&"Cell"!==i.selectionSettings.mode){var n=r[r.length-1];if(i.selectedRowIndex===i.flatData.indexOf(n))return;i.selectionModule.selectRow(i.flatData.indexOf(n),!1,!0)}break;case"downArrow":case"upArrow":(f=i.element.querySelector("#"+i.element.id+"_searchbar"))&&f.parentElement.classList.contains("e-input-focus")&&i.selectionModule.clearSelection(),i.element.classList.contains("e-scroll-disabled")||(this.upDownKeyNavigate(e),t.isNullOrUndefined(a)||t.isNullOrUndefined(a.closest(".e-chart-row"))||i.ganttChartModule.manageFocus(this.getActiveElement(),"remove",!0));break;case"expandAll":i.ganttChartModule.expandCollapseAll("expand");break;case"collapseAll":i.ganttChartModule.expandCollapseAll("collapse");break;case"expandRow":case"collapseRow":this.expandCollapseKey(e);break;case"saveRequest":if(!t.isNullOrUndefined(i.editModule)&&!t.isNullOrUndefined(i.editModule.cellEditModule)&&i.editModule.cellEditModule.isCellEdit){var s=i.editModule.cellEditModule.editedColumn;if(s.field===i.columnMapping.duration&&!t.isNullOrUndefined(s.edit)&&!t.isNullOrUndefined(s.edit.read)){var o=e.target.ej2_instances[0],l=e.target.value,d=i.currentViewData[i.selectedRowIndex].ganttProperties;s.field===i.columnMapping.duration&&l!==(t.isNullOrUndefined(s.edit)||t.isNullOrUndefined(s.edit.read)?t.isNullOrUndefined(s.valueAccessor)?i.dataOperation.getDurationString(d.duration,d.durationUnit):s.valueAccessor(i.columnMapping.duration,i.editedRecords,s):s.edit.read()).toString()&&(o.value=l,o.dataBind())}if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.cellEditModule.isCellEdit=!1,i.treeGrid.grid.saveCell();i.element.querySelector(".e-treegrid").focus()}if(!t.isNullOrUndefined(this.parent.onTaskbarClick)&&!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(a.closest(".e-chart-row"))){var h=e.target,p=a.querySelector(".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");p&&this.parent.ganttChartModule.onTaskbarClick(e,h,p)}break;case"cancelRequest":t.isNullOrUndefined(i.editModule)||t.isNullOrUndefined(i.editModule.cellEditModule)||(i.editModule.cellEditModule.isCellEdit=!1,t.isNullOrUndefined(i.toolbarModule)||i.toolbarModule.refreshToolbarItems());break;case"addRow":if(i.editModule&&i.editModule.cellEditModule&&i.editModule.cellEditModule.isCellEdit)e.stopPropagation();else if(t.isNullOrUndefined(document.getElementById(this.parent.element.id+"_dialog"))){e.preventDefault(),i.addRecord(void 0,this.parent.editSettings.newRowPosition);i.element.focus()}break;case"addRowDialog":if(e.preventDefault(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowAdding){if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.dialogModule.openAddDialog()}break;case"editRowDialog":e.preventDefault();if(i.element.querySelector(".e-treegrid").focus(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowEditing){if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.dialogModule.openToolbarEditDialog()}break;case"delete":i.selectionModule&&i.editModule&&i.editModule.dialogModule&&(!i.editModule.dialogModule.dialogObj||i.editModule.dialogModule.dialogObj&&!i.editModule.dialogModule.dialogObj.visible)&&(!i.editSettings.allowTaskbarEditing||i.editSettings.allowTaskbarEditing&&!i.editModule.taskbarEditModule.touchEdit)&&("Cell"!==i.selectionSettings.mode&&i.selectionModule.selectedRowIndexes.length||"Cell"===i.selectionSettings.mode&&i.selectionModule.getSelectedRowCellIndexes().length)&&(t.isNullOrUndefined(e.target)?i.editModule.startDeleteAction():"INPUT"!==e.target.tagName&&i.editModule.startDeleteAction());break;case"focusTask":e.preventDefault();var c=void 0;if(i.selectionModule){var u=i.currentViewData;if("Cell"===i.selectionSettings.mode||t.isNullOrUndefined(u[i.selectedRowIndex])){if("Cell"===i.selectionSettings.mode&&i.selectionModule.getSelectedRowCellIndexes().length>0){var g=i.selectionModule.getSelectedRowCellIndexes();c=u[g[g.length-1].rowIndex].ganttProperties.rowUniqueID}}else c=i.currentViewData[i.selectedRowIndex].ganttProperties.rowUniqueID}c&&i.scrollToTask(c.toString());break;case"focusSearch":if(i.element.querySelector("#"+i.element.id+"_searchbar")){var f;(f=i.element.querySelector("#"+i.element.id+"_searchbar")).setAttribute("tabIndex","-1"),f.focus()}break;case"tab":case"shiftTab":i.element.classList.contains("e-scroll-disabled")||i.ganttChartModule.onTabAction(e);break;case"contextMenu":var m=document.getElementById(this.parent.element.id+"_contextmenu").ej2_instances[0],y=this.parent.getOffsetRect(e.target),D=y.top+y.height/2,v=y.left+y.width/2;this.setActiveElement(e.target),m.open(D,v),e.preventDefault();break;default:var w={requestType:"keyPressed",action:e.action,keyEvent:e};i.trigger("actionComplete",w)}},e.prototype.upDownKeyNavigate=function(e){e.preventDefault();var t=this.parent,i=t.getExpandedRecords(t.currentViewData);if(t.selectionModule){if("Cell"!==t.selectionSettings.mode&&-1!==t.selectedRowIndex){var r=t.currentViewData[t.selectedRowIndex],a=(this.parent.ganttChartModule.focusedRowIndex,i.indexOf(r)),n="downArrow"===e.action?i[a+1]:i[a-1];t.selectionModule.selectRow(t.currentViewData.indexOf(n),!1,!0)}else if("Cell"===t.selectionSettings.mode&&t.selectionModule.getSelectedRowCellIndexes().length>0){var s=t.selectionModule.getSelectedRowCellIndexes(),o=s[s.length-1],l=o.cellIndexes[o.cellIndexes.length-1],d=(r=t.currentViewData[o.rowIndex],a=i.indexOf(r),n="downArrow"===e.action?i[a+1]:i[a-1],{rowIndex:t.currentViewData.indexOf(n),cellIndex:l});t.selectionModule.selectCell(d)}this.parent.ganttChartModule.focusedRowIndex=this.parent.selectedRowIndex}},e.prototype.expandCollapseKey=function(e){var t=this.parent;if(t.selectionModule&&-1!==t.selectedRowIndex){var i=void 0;if("Cell"!==t.selectionSettings.mode)i=t.selectedRowIndex;else if("Cell"===t.selectionSettings.mode&&t.selectionModule.getSelectedRowCellIndexes().length>0){var r=t.selectionModule.getSelectedRowCellIndexes();i=r[r.length-1].rowIndex}"expandRow"===e.action?t.expandByIndex(i):t.collapseByIndex(i)}},e}(),Jt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),$t=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ei=function(e){function a(i,r){var a=e.call(this,i,r)||this;return a.showIndicator=!0,a.singleTier=0,a.isLocaleChanged=!1,a.isCancelled=!1,a.previousRecords={},a.editedRecords=[],a.modifiedRecords=[],a.isOnEdit=!1,a.isOnDelete=!1,a.isExpandCollapseLevelMethod=!1,a.isDynamicData=!1,a.isConnectorLineUpdate=!1,a.staticSelectedRowIndex=-1,a.needsID=!0,a.showActiveElement=!0,a.addDeleteRecord=!1,a.enableHeaderFocus=!0,a.enableValidation=!0,a.isTreeGridRendered=!1,a.isFromOnPropertyChange=!1,a.isFromRenderBaseline=!1,a.isGanttChartRendered=!1,a.isEdit=!1,t.setValue("mergePersistData",a.mergePersistGanttData,a),a}return Jt(a,e),a.prototype.getModuleName=function(){return"gantt"},a.prototype.preRender=function(){this.initProperties()},a.prototype.initProperties=function(){this.globalize=new t.Internationalization(this.locale),this.isAdaptive=t.Browser.isDevice,this.flatData=[],this.currentViewData=[],this.updatedRecords=[],this.ids=[],this.ganttColumns=[],this.localeObj=new t.L10n(this.getModuleName(),this.getDefaultLocale(),this.locale),this.dataOperation=new x(this),this.nonWorkingHours=[],this.nonWorkingTimeRanges=[],this.workingTimeRanges=[],this.defaultEndTime=null,this.defaultStartTime=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.editedTaskBarItem=null,this.validationDialogElement=null,this.currentEditedArgs={},this.dialogValidateMode={respectLink:!1,removeLink:!1,preserveLinkWithEditing:!0},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 je(this),this.timelineModule=new qe(this),this.chartRowsModule=new _t(this),this.treeGridModule=new ze(this),this.dateValidationModule=new R(this),this.predecessorModule=new Xt(this),this.connectorLineModule=new Yt(this),this.splitterModule=new Zt(this),this.tooltipModule=new Qt(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",cancelRequest:"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"},this.focusModule=new Kt(this),0===this.zoomingLevels.length&&(this.zoomingLevels=this.getZoomingLevels()),this.resourceFieldsMapping(),t.isNullOrUndefined(this.resourceFields.unit)&&(this.resourceFields.unit="unit"),t.isNullOrUndefined(this.taskFields.work)||(this.taskType="FixedWork"),this.taskIds=[]},a.prototype.getDateFormat=function(){if(t.isNullOrUndefined(this.dateFormat)){return this.globalize.getDatePattern({skeleton:"yMd"})}return this.dateFormat},a.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())},a.prototype.isInDst=function(e){return e.getTimezoneOffset()<this.getDefaultTZOffset()},a.prototype.resourceFieldsMapping=function(){var e=this.resourceFields;e.id=t.isNullOrUndefined(e.id)?this.resourceIDMapping:e.id,e.name=t.isNullOrUndefined(e.name)?this.resourceNameMapping:e.name},a.prototype.validateDimentionValue=function(e){return t.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()},a.prototype.calculateDimensions=function(){var e=this.validateDimentionValue(this.height),i=this.validateDimentionValue(this.width);t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(i=this.width);var r=this.element.style.height,a=this.element.style.width;i&&(this.element.style.width=i),e&&(this.element.style.height=e),e||r||(this.element.style.height="auto"),i||a||(this.element.style.width="auto"),this.ganttHeight=this.element.offsetHeight,this.ganttWidth=this.element.offsetWidth},a.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),i.createSpinner({target:this.element},this.createElement),this.trigger("load",{}),this.element.classList.add("e-gantt"),this.isAdaptive?this.element.classList.add("e-device"):this.element.classList.remove("e-device"),this.calculateDimensions(),t.isNullOrUndefined(this.toolbarModule)||this.renderToolbar(),this.splitterModule.renderSplitter(),this.notify("renderPanels",null),t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.showSpinner():this.showMaskRow(),this.dataOperation.checkDataBinding()},a.prototype.hideMaskRow=function(){var e=this.element.querySelectorAll(".e-masked-table").length;if(!t.isNullOrUndefined(this.contentMaskTable)&&(0!=e||this.contentMaskTable)){var i=this.contentMaskTable;t.remove(i),this.contentMaskTable=null}if(e=this.element.querySelectorAll(".e-masked-table").length,!t.isNullOrUndefined(this.headerMaskTable)&&(0!=e||this.headerMaskTable)){i=this.headerMaskTable;t.remove(i),this.headerMaskTable=null}for(;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("."+F).length)for(var r=0;r<this.singleTier;r++)t.isNullOrUndefined(this.element.querySelectorAll("."+F)[parseInt(r.toString(),10)])||(this.element.querySelectorAll("."+F)[parseInt(r.toString(),10)].style.visibility="visible");t.isNullOrUndefined(this.element.querySelector("."+N))||(this.element.querySelector("."+N).style.position="relative"),t.isNullOrUndefined(this.element.getElementsByClassName(E)[0])||(this.element.getElementsByClassName(E)[0].style.visibility="visible")},a.prototype.showMaskRow=function(){var e=this.chartPane.childNodes[0].childNodes[0];this.scrollLeftValue=this.chartPane.childNodes[0].childNodes[0].scrollLeft;var t=this.chartPane.childNodes[0].childNodes[1];if(this.treeGrid.element&&this.ganttChartModule.setVirtualHeight(),!this.contentMaskTable){if(t){var i=t;if(this.renderBackGround(i),0!=this.element.querySelectorAll("."+F).length){this.singleTier=this.timelineModule.isSingleTier?1:2;for(var r=0;r<this.singleTier;r++)this.element.querySelectorAll("."+F)[parseInt(r.toString(),10)].style.visibility="hidden"}0===this.singleTier&&(this.singleTier=2),this.element.getElementsByClassName(E)[0].style.visibility="hidden",this.contentMaskTable=this.contentMaskTable=this.createMaskTable(i)}if(e){this.element.querySelector("."+N).style.position="static";i=e;this.renderHeaderBackground(i),this.headerMaskTable=this.headerMaskTable=this.createMaskTable(i)}}},a.prototype.renderHeaderBackground=function(e){var i=e,r=e.getBoundingClientRect().height;if(!!t.closest(i,"."+N)){for(var a=this.createElement("div",{className:"e-table-background"}),n=(this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+r+"px;"}}),0),s=Math.round(e.getBoundingClientRect().width),o=0;o<3;o++)this.enableRtl?a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(s-=160)+"px; top:0px;"}})):a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n+=160)+"px; top:0px;"}}));i.insertBefore(a,i.firstChild)}},a.prototype.renderBackGround=function(e){var i=e,r=e.getBoundingClientRect().height;if(!!t.closest(i,"."+I)){for(var a=this.createElement("div",{className:"e-table-background"}),n=(this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+r+"px;"}}),0),s=Math.round(e.getBoundingClientRect().width),o=0;o<3;o++)this.enableRtl?a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(s-=160)+"px;z-index:1;"}})):a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n+=160)+"px;z-index:1;"}}));i.insertBefore(a,i.firstChild)}},a.prototype.createMaskTable=function(e){var i,r=e,a=e.getBoundingClientRect().height,n=!!t.closest(r,"."+N);if(n?((i=this.createEmptyTimeLineTable(a)).style.position="sticky",i.style.left="0px",this.enableRtl&&i.style.removeProperty("left")):((i=this.createEmptyMaskTable(a)).style.position="absolute",i.style.zIndex=1),n){i.style.height=e.getBoundingClientRect().height+"px";var s=this.createElement("div",{className:"e-temp-timeline"});s.style.width="614px",s.style.position="sticky",this.enableRtl?s.style["margin-right"]=Math.abs(this.scrollLeftValue)+"px":s.style["margin-left"]=this.scrollLeftValue+"px",s.appendChild(i),r.insertBefore(s,r.firstChild)}else i.style.height=e.getBoundingClientRect().height+"px",r.insertBefore(i,r.firstChild);return i},a.prototype.createEmptyTimeLineTable=function(e){for(var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),r=[],a=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/2+"px;"}}),n=0;n<this.singleTier;n++)r.push(a.cloneNode(!0));this.topBottomHeader=0;for(n=0;n<r.length;n++)i.appendChild(this.applyTimelineMaskRow(r[parseInt(n.toString(),10)])),this.topBottomHeader=this.topBottomHeader+1;return t.appendChild(i),t.style.width="100%",t},a.prototype.applyTimelineMaskRow=function(e){var t=e;t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(var i=0;i<t.childNodes.length-1;i++)t.childNodes[parseInt(i.toString(),10)].style.width="166px";var r=[].slice.call(t.childNodes);for(i=0;i<r.length;i++){var a=r[parseInt(i.toString(),10)];switch(this.topBottomHeader){case 0:this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>',a.children[0].style.left="-20px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>';break;case 1:a.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),a.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),a.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(var n=[].slice.call(a.childNodes),s=0;s<n.length;s++){var o=n[parseInt(s.toString(),10)];0===s?this.enableRtl?(o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>',o.children[0].style.left="-14px"):o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>':1===s?this.enableRtl?(o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>',o.children[0].style.left="-30px"):o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>':this.enableRtl?(o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>',o.children[0].style.left="-60px"):o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>'}}}return t},a.prototype.createEmptyMaskTable=function(e){var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),r=[],a=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/7+"px;"}});this.columnLoop=0;for(var n=0;n<6;n++)r.push(a.cloneNode(!0));for(var s=0;s<r.length;s++)this.columnLoop<4?this.columnLoop=this.columnLoop+1:4===this.columnLoop&&(this.columnLoop=1),i.appendChild(this.applyMaskRow(r[parseInt(s.toString(),10)]));t.appendChild(i),t.style.width="100%";var o=this.createElement("div",{className:"e-temp-container"});return o.style.width="calc(100% - 17px)",o.style.overflow="hidden",o.appendChild(t),o},a.prototype.applyMaskRow=function(e){var t=e;this.columnLoop<4?(t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"})),t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}))):t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}));for(var i=[].slice.call(t.childNodes),r=0;r<i.length;r++){var a=i[parseInt(r.toString(),10)];switch(this.columnLoop){case 1:0===r?this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>',a.children[0].style.left="-14px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>':a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell02"></span>';break;case 2:0===r?this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>',a.children[0].style.left="-14px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>':a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell04"></span>';break;case 3:0===r?this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>',a.children[0].style.left="-64px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>':this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>',a.children[0].style.left="-192px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>';break;case 4:this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>',a.children[0].style.left="-388px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>'}}return t},a.prototype.showSpinner=function(){i.showSpinner(this.element)},a.prototype.hideSpinner=function(){i.hideSpinner(this.element)},a.prototype.processTimeline=function(){this.timelineModule.processTimelineUnit(),this.timelineModule.calculateZoomingLevelsPerDayWidth()},a.prototype.renderGantt=function(e){if(e&&(this.isFromOnPropertyChange=e),this.predecessorModule&&this.taskFields.dependency&&(this.predecessorModule.parentIds=[],this.predecessorModule.parentRecord=[],this.predecessorModule.updatePredecessors(),this.isInPredecessorValidation&&this.enableValidation&&this.autoCalculateDateScheduling&&this.predecessorModule.updatedRecordsDateByPredecessor()),this.enableValidation&&(this.dataOperation.calculateProjectDates(),this.timelineModule.validateTimelineProp()),e)if(this.enableValidation&&this.dataOperation.updateGanttData(),this.allowParentDependency&&this.predecessorModule.updateParentPredecessor(),this.dataSource instanceof Object&&y(this)){var i=t.getValue("count",this.dataSource);this.treeGrid.dataSource={result:this.flatData,count:i}}else this.treeGrid.setProperties({dataSource:this.flatData},!1);else this.enableValidation&&this.dataOperation.updateGanttData(),this.allowParentDependency&&this.predecessorModule.updateParentPredecessor(),this.treeGridPane.classList.remove("e-temp-content"),t.remove(this.treeGridPane.querySelector(".e-gantt-temp-header")),this.notify("dataReady",{}),this.enableContextMenu&&this.notify("initiate-contextMenu",{}),this.renderTreeGrid(),this.wireEvents(),this.notify("initPredessorDialog",{});this.splitterModule.updateSplitterPosition()},a.prototype.removeCriticalPathStyles=function(){var e=this.ganttChartModule.chartElement;t.removeClass(e.querySelectorAll(".e-gantt-child-taskbar-inner-div"),G),t.removeClass(e.querySelectorAll(".e-gantt-child-progressbar-inner-div"),z),t.removeClass(e.querySelectorAll(".e-critical-milestone"),_),t.removeClass(this.element.querySelectorAll(".e-connector-line"),be),t.removeClass(this.element.querySelectorAll(".e-connector-line-arrow"),Pe)},a.prototype.wireEvents=function(){this.allowKeyboard&&(this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfig,eventName:"keydown"})),t.EventHandler.add(window,"resize",this.windowResize,this),t.EventHandler.add(document.body,"keydown",this.keyDownHandler,this)},a.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))},a.prototype.windowResize=function(){if(!t.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));var e=this.criticalPathModule;this.enableCriticalPath&&e&&e.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds)}},a.prototype.keyActionHandler=function(e){this.focusModule.onKeyPress(e)},a.prototype.updateRowHeightInConnectorLine=function(e){if(e&&e.length){var t=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}},a.prototype.renderToolbar=function(){t.isNullOrUndefined(this.toolbarModule)||(this.toolbarModule.renderToolbar(),this.toolbarModule.refreshToolbarItems())},a.prototype.renderTreeGrid=function(){this.treeGridModule.renderTreeGrid()},a.prototype.updateCurrentViewData=function(){this.currentViewData=this.treeGrid.getCurrentViewRecords().slice()},a.prototype.getRecordFromFlatdata=function(e){for(var t=[],i=0;i<e.length;i++)t.push(this.getTaskByUniqueID(e[i].uniqueID));return t},a.prototype.updateContentHeight=function(e){if(this.allowTaskbarOverlap||"ResourceView"!==this.viewType||this.isLoad)if(this.virtualScrollModule&&this.enableVirtualization&&!t.isNullOrUndefined(e)){var i=t.getValue("result.length",e);this.contentHeight=i*this.rowHeight}else{var r=this.virtualScrollModule&&this.enableVirtualization?this.currentViewData:this.getExpandedRecords(this.currentViewData),a=void 0,n=t.isNullOrUndefined(this.ganttChartModule.getChartRows())?null:this.ganttChartModule.getChartRows()[0];a=!t.isNullOrUndefined(n)&&n.getBoundingClientRect().height>0?n.getBoundingClientRect().height:this.rowHeight,this.contentHeight=r.length*a}},a.prototype.getExpandStatus=function(e){var i=this.getParentTask(e.parentItem);if(t.isNullOrUndefined(i))return!0;if(!1===i.expanded)return!1;if(i.parentItem){return!1!==this.getParentTask(i.parentItem).expanded&&this.getExpandStatus(this.getParentTask(i.parentItem))}return!0},a.prototype.getExpandedRecords=function(e){var i=this;if(t.isNullOrUndefined(e))return[];return e.filter(function(e){return!0===i.getExpandStatus(e)})},a.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}]},a.prototype.displayQuarterValue=function(e){var t=e.getMonth();return t>=0&&t<=2?"Q1":t>=3&&t<=5?"Q2":t>=6&&t<=8?"Q3":"Q4"},a.prototype.displayHalfValue=function(e){var t=e.getMonth();return t>=0&&t<=5?"H1":"H2"},a.prototype.getFormatedDate=function(e,i){return t.isNullOrUndefined(e)?null:(t.isNullOrUndefined(i)&&(i=this.getDateFormat()),this.globalize.formatDate(e,{format:i}))},a.prototype.getDurationString=function(e,t){return this.dateValidationModule.getDurationString(e,t)},a.prototype.getWorkString=function(e,t){return this.dateValidationModule.getWorkString(e,t)},a.prototype.updateTreeColumns=function(){var e,i=this.treeGrid.grid.getColumns();-1!==this.treeColumnIndex&&this.columns[this.treeColumnIndex]&&!t.isNullOrUndefined(this.columns[this.treeColumnIndex].template)&&(e=this.columns[this.treeColumnIndex].template,this.columns[this.treeColumnIndex].field);for(var r,a=0;a<i.length;a++){r={};for(var n=0;n<this.columns.length;n++)if(this.columns[n].field==i[a].field){for(var s=0,o=Object.keys(this.columns[n]);s<o.length;s++){var l=o[s];t.isUndefined(this.columns[n][l])||(r[l]=i[a][l]),r.visible=i[a].visible,r.width=i[a].width}this.columns[n]=r,"checkbox"===this.columns[n].type||t.isNullOrUndefined(e)||""===e||(this.columns[n].template=e)}}this.columns.length>0&&this.treeGrid.setProperties({columns:this.columns},!0)},a.prototype.treeDataBound=function(e){this.element.getElementsByClassName("e-chart-root-container")[0].style.height="100%";this.element.getElementsByClassName("e-gridcontent")[0].style.height;var i=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight;if("calc(100% - "+i+"px)",this.element.getElementsByClassName("e-chart-scroll-container e-content")[0].style.height="calc(100% - "+i+"px)",t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)?this.splitterElement.style.height="100%":this.splitterElement.style.height="calc(100% - "+this.toolbarModule.element.offsetHeight+"px)",this.isLoad){if(this.enablePersistence&&this.updateTreeColumns(),this.updateCurrentViewData(),this.enableVirtualization||this.updateContentHeight(),!this.isTreeGridRendered){this.isTreeGridRendered=!0;t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)||this.toolbarModule.element.offsetHeight,this.timelineModule.isSingleTier?(t.addClass(this.treeGrid.element.querySelectorAll(".e-headercell"),U),t.addClass(this.treeGrid.element.querySelectorAll(".e-columnheader"),U)):(t.removeClass(this.treeGrid.element.querySelectorAll(".e-headercell"),U),t.removeClass(this.treeGrid.element.querySelectorAll(".e-columnheader"),U)),this.treeGrid.height="100%",this.notify("tree-grid-created",{}),this.createGanttPopUpElement(),t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.hideSpinner():this.hideMaskRow(),t.setValue("isGanttCreated",!0,e),this.renderComplete()}}else this.getCurrentRecords(e);this.enableCriticalPath&&this.criticalPathModule&&this.criticalPathModule.showCriticalPath(this.enableCriticalPath),this.notify("recordsUpdated",{});for(var r=0;r<document.getElementsByClassName("e-timeline-header-table-container").length;r++)for(var a=0;a<document.getElementsByClassName("e-timeline-header-table-container")[r].children[0].children[0].children.length;a++)document.getElementsByClassName("e-timeline-header-table-container")[r].children[0].children[0].children[a].children[0].setAttribute("tabindex","-1");var n=this.criticalPathModule;this.enableCriticalPath&&n&&n.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(n.criticalPathCollection,n.detailPredecessorCollection,!0,n.predecessorCollectionTaskIds),this.initialChartRowElements=this.ganttChartModule.getChartRows(),this.isLoad=!1,this.trigger("dataBound",e)},a.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())},a.prototype.onPropertyChanged=function(e,i){for(var a=!1,n=0,s=Object.keys(e);n<s.length;n++){var o=s[n];switch(o){case"allowSelection":case"allowRowDragAndDrop":case"allowFiltering":case"showColumnMenu":case"allowResizing":case"allowReordering":case"enableImmutableMode":this.treeGrid[o]=this[o],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=r.getActualProperties(this.columnMenuItems);break;case"eventMarkers":case"highlightWeekends":this.notify("ui-update",{module:"day-markers",properties:e});break;case"sortSettings":this.treeGrid.sortSettings=r.getActualProperties(this.sortSettings),this.treeGrid.dataBind();break;case"timelineSettings":this.timelineModule.refreshTimeline();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":this.dataOperation.checkDataBinding(!0);break;case"enableCriticalPath":if(t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.hideSpinner():this.hideMaskRow(),this.enableCriticalPath&&this.criticalPathModule){this.criticalPathModule.showCriticalPath(this.enableCriticalPath);var l=this.criticalPathModule;l.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(l.criticalPathCollection,l.detailPredecessorCollection,!0,l.predecessorCollectionTaskIds)}else this.removeCriticalPathStyles();break;case"filterSettings":this.treeGrid.filterSettings=r.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=r.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=r.getActualProperties(this.searchSettings),this.treeGrid.grid.dataBind()),this.treeGrid.searchSettings=r.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"===o&&(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;break;case"dayWorkingTime":this.isLoad=!0,this.dataOperation.reUpdateGanttData(),this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows(),this.isLoad=!1;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.chartRowsModule.initiateTemplates(),this.timelineModule.updateChartByNewTimeline();break;case"width":case"height":this.reUpdateDimention();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,t.isNullOrUndefined(this.editModule)||this.editModule.reUpdateEditModules(),t.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.dataOperation.calculateProjectDates(),this.updateProjectDates(this.cloneProjectStartDate,this.cloneProjectEndDate,this.isTimelineRoundOff);break;case"selectedRowIndex":t.isNullOrUndefined(this.selectionModule)||this.selectionModule.selectRowByIndex();break;case"dataSource":if(this.closeGanttActions(),this.dataSource instanceof Object&&y(this)){this.treeGrid.hasChildMapping="isParent";var d=t.getValue("count",this.dataSource);this.treeGrid.dataSource={result:this.flatData,count:d}}else this.treeGrid.hasChildMapping=null;this.dataOperation.checkDataBinding(!0);break;case"enableContextMenu":case"contextMenuItems":this.enableContextMenu||"contextMenuItems"===o?this.notify("reRender-contextMenu",{module:"contextMenu",enable:this.contextMenuItems}):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":"locale"===o&&(this.isLocaleChanged=!0),a=!0;break;case"validateManualTasksOnLinking":this.validateManualTasksOnLinking=e.validateManualTasksOnLinking;break;case"showOverAllocation":this.updateOverAllocationCotainer()}}a&&(this.isLoad&&this.contentMaskTable&&(this.contentMaskTable=null),this.refresh())},a.prototype.updateOverAllocationCotainer=function(){if(this.showOverAllocation&&"ResourceView"===this.viewType)this.ganttChartModule.renderOverAllocationContainer();else{var e=this.element.querySelector("."+Be);e&&(e.innerHTML="")}},a.prototype.getPersistData=function(){for(var e=["sortSettings","filterSettings","columns","searchSettings","selectedRowIndex","treeColumnIndex","currentZoomingLevel","cloneProjectStartDate","cloneProjectEndDate"],i={filterSettings:["type","mode","showFilterBarStatus","immediateModeDelay","ignoreAccent","hierarchyMode"],searchSettings:["fields","operator","ignoreCase"],sortSettings:[],columns:[],selectedRowIndex:[]},r=0;r<e.length;r++)for(var a=this[e[r]],n=0,s=i[e[r]];!t.isNullOrUndefined(s)&&n<s.length;n++){delete a[s[n]]}return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(e)},a.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)this.ignoreInColumn(e,t[i])},a.prototype.ignoreInColumn=function(e,t){for(var i=0;i<e.length;i++)delete t[e[i]],t.filter={}},a.prototype.destroy=function(){this.notify("destroy",{}),t.isNullOrUndefined(this.validationDialogElement)||this.validationDialogElement.isDestroyed||this.validationDialogElement.destroy();for(var i=["ganttChartModule","timelineModule","chartRowsModule","treeGridModule","ganttDataUpdatesModule","dateValidationModule","tooltipModule"],r=0;r<i.length;r++)this[i[r]]&&(this[i[r]]=null);this.keyboardModule&&this.keyboardModule.destroy(),this.editModule&&this.editModule.dialogModule&&this.editModule.dialogModule.destroy(),e.prototype.destroy.call(this),this.chartVerticalLineContainer=null,this.element.innerHTML="",t.removeClass([this.element],"e-gantt"),this.element.innerHTML="",this.isTreeGridRendered=!1,this.resetTemplates(),t.EventHandler.remove(window,"resize",this.windowResize)},a.prototype.getTaskbarHeight=function(){return this.chartRowsModule.taskBarHeight},a.prototype.requiredModules=function(){var e=[];return this.isDestroyed?e:(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.allowResizing&&e.push({member:"resize",args:[this]}),this.toolbar&&this.toolbar.length>0&&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&&this.holidays.length>0||this.eventMarkers&&this.eventMarkers.length>0)&&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)},a.prototype.sortColumn=function(e,t,i){this.sortModule&&this.allowSorting&&this.sortModule.sortColumn(e,t,i)},a.prototype.mergePersistGanttData=function(){this.treeGrid||(this.treeGrid=new n.TreeGrid);this.treeGrid.grid.mergePersistGridData.apply(this)},a.prototype.mergeColumns=function(e,t){this.treeGrid.grid.mergeColumns.apply(this,[e,t])},a.prototype.clearSorting=function(){this.sortModule.clearSorting()},a.prototype.renderChartGridLines=function(){var e="e-chart-row-border",i=this.chartVerticalLineContainer,r=document.getElementById(this.element.id+"GanttTaskTableBody").querySelectorAll("td");if("Vertical"===this.gridLines){if(t.isNullOrUndefined(i)?this.renderChartVerticalLines():"none"===i.style.display&&(i.style.display="block"),r[0].classList.contains(e))for(var a=0;a<r.length;a++)t.removeClass([r[a]],e)}else if("Horizontal"===this.gridLines){if(t.isNullOrUndefined(i)||(i.style.display="none"),!r[0].classList.contains(e))for(a=0;a<r.length;a++)t.addClass([r[a]],e)}else if("Both"===this.gridLines){if(t.isNullOrUndefined(i)?this.renderChartVerticalLines():"none"===i.style.display&&(i.style.display="block"),!r[0].classList.contains(e))for(a=0;a<r.length;a++)t.addClass([r[a]],e)}else if("None"===this.gridLines&&(t.isNullOrUndefined(i)||"none"===i.style.display||(i.style.display="none"),r[0].classList.contains(e)))for(a=0;a<r.length;a++)t.removeClass([r[a]],e)},a.prototype.updateGridLineContainerHeight=function(){this.chartVerticalLineContainer&&(this.chartVerticalLineContainer.style.height=t.formatUnit(this.getContentHeight()))},a.prototype.getContentHeight=function(){var e=this.ganttChartModule.scrollElement.offsetHeight-16,t=this.ganttChartModule.chartBodyContent.offsetHeight;return t<e?t:e},a.prototype.reUpdateDimention=function(){var e=0;if(this.calculateDimensions(),t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)||(this.toolbarModule.toolbar.refresh(),this.toolbarModule.refreshToolbarItems(),e=this.toolbarModule.element.offsetHeight),this.treeGrid.height=this.ganttHeight-e-this.treeGrid.grid.getHeaderContent().offsetHeight,this.splitterModule.splitterObject.height=(this.ganttHeight-e).toString(),t.isNullOrUndefined(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer.style.height=this.ganttHeight+"px"),!t.isNullOrUndefined(this.dayMarkersModule)){var i=t.getValue("nonworkingDayRender.holidayContainer",this.dayMarkersModule),r=t.getValue("nonworkingDayRender.weekendContainer",this.dayMarkersModule),a=t.getValue("eventMarkerRender.eventMarkersContainer",this.dayMarkersModule);i&&(i.style.height=this.ganttHeight+"px"),r&&(r.style.height=this.ganttHeight+"px"),a&&(a.style.height=this.ganttHeight+"px")}this.splitterModule.splitterObject.width=this.ganttWidth.toString(),this.ganttChartModule.scrollObject.setHeight(this.ganttHeight-this.ganttChartModule.chartTimelineContainer.offsetHeight-e)},a.prototype.renderChartVerticalLines=function(){this.element.contains(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer=t.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="";var e=this.element.getElementsByClassName("e-timeline-header-table-container")[1];t.isNullOrUndefined(e)&&(e=this.element.getElementsByClassName("e-timeline-header-table-container")[0]);for(var i,r=e.getElementsByTagName("th"),a=r.length,n=0,s=t.createElement("div"),o=0;o<a;o++){n=0===o?-1:n+parseFloat(i),i=r[o].style.width;var l=t.createElement("div",{className:"e-line-container-cell",styles:(this.enableRtl?"right:"+(n+1):"left:"+n)+"px"});s.appendChild(l)}this.chartVerticalLineContainer.innerHTML=s.innerHTML},a.prototype.getDefaultLocale=function(){return{emptyRecord:"No records to display",id:"ID",name:"Name",startDate:"Start Date",endDate:"End Date",duration:"Duration",progress:"Progress",dependency:"Dependency",notes:"Notes",criticalPath:"Critical Path",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",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",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"}},a.prototype.removeSortColumn=function(e){this.sortModule.removeSortColumn(e)},a.prototype.actionBeginTask=function(e){this.trigger("actionBegin",e),t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.showSpinner():this.showMaskRow()},a.prototype.scrollToDate=function(e){var t=this.dateValidationModule.getDateFromFormat(e),i=this.dataOperation.getTaskLeft(t,!1);this.ganttChartModule.updateScrollLeft(i)},a.prototype.scrollToTask=function(e){if(-1!==this.ids.indexOf(e)){var t=this.flatData[this.ids.indexOf(e)].ganttProperties.left;this.ganttChartModule.updateScrollLeft(t)}},a.prototype.updateChartScrollOffset=function(e,i){t.isNullOrUndefined(e)||(e=this.ganttChartModule.scrollElement.scrollWidth<=e?this.ganttChartModule.scrollElement.scrollWidth:e,this.ganttChartModule.scrollObject.setScrollLeft(e,this.enableRtl?-1:0)),t.isNullOrUndefined(i)||(i=this.ganttChartModule.scrollElement.scrollHeight<=i?this.ganttChartModule.scrollElement.scrollHeight:i,this.ganttChartModule.scrollObject.setScrollTop(i))},a.prototype.getParentTask=function(e){if(t.isNullOrUndefined(e))return null;var i=this.flatData.filter(function(t){return e.uniqueID===t.uniqueID});return i.length>0?i[0]:null},a.prototype.getRootParent=function(e,t){return e.level===t?e:this.getRootParent(this.getParentTask(e.parentItem),t)},a.prototype.filterByColumn=function(e,t,i,r,a,n){this.treeGrid.filterByColumn(e,t,i,r,a,n)},a.prototype.excelExport=function(e,t,i,r){return this.excelExportModule?this.treeGrid.excelExport(e,t,i,r):null},a.prototype.csvExport=function(e,t,i,r){return this.excelExportModule?this.treeGrid.csvExport(e,t,i,r):null},a.prototype.pdfExport=function(e,t,i,r){return this.pdfExportModule?this.pdfExportModule.export(e,t,i,r):null},a.prototype.clearFiltering=function(e){this.treeGrid.grid.clearFiltering(e)},a.prototype.removeFilteredColsByField=function(e){this.treeGrid.removeFilteredColsByField(e,!1)},a.prototype.renderWorkingDayCell=function(e){var t="Auto"!==this.taskMode||!(!this.includeWeekend&&this.autoCalculateDateScheduling)?[]:this.nonWorkingDayIndex,i=this.totalHolidayDates;if(t.length>0&&-1!==t.indexOf(e.date.getDay()))e.isDisabled=!0;else if(i.length>0){var r=new Date(e.date.getTime());r.setHours(0,0,0),-1!==i.indexOf(r.getTime())&&(this.autoCalculateDateScheduling?e.isDisabled=!0:e.isDisabled=!1)}},a.prototype.previousTimeSpan=function(e){this.timelineModule.performTimeSpanAction("prevTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},a.prototype.nextTimeSpan=function(e){this.timelineModule.performTimeSpanAction("nextTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},a.prototype.updateProjectDates=function(e,i,r,a){this.timelineModule.totalTimelineWidth=0,this.cloneProjectStartDate=e,this.cloneProjectEndDate=i,this.isTimelineRoundOff=r,this.timelineModule.refreshTimelineByTimeSpan(),this.dataOperation.reUpdateGanttDataPosition(),this.timelineModule.updateChartByNewTimeline(),this.ganttChartModule.chartBodyContent.style.width=t.formatUnit(this.timelineModule.totalTimelineWidth),this.ganttChartModule.updateLastRowBottomWidth(),this.taskFields.dependency&&this.ganttChartModule.reRenderConnectorLines(),"beforeAdd"!==a&&this.notify("selectRowByIndex",{})},a.prototype.splitTask=function(e,t){this.isEdit=!0,this.chartRowsModule.splitTask(e,t)},a.prototype.mergeTask=function(e,t){this.chartRowsModule.mergeTask(e,t)},a.prototype.reorderColumns=function(e,t){this.treeGrid.reorderColumns(e,t)},a.prototype.initiateEditAction=function(e){this.isOnEdit=e,this.previousRecords={},this.editedRecords=[]},a.prototype.setRecordValue=function(e,i,r,a){if(i=t.isUndefined(i)?null:i,this.isOnEdit||this.isOnDelete){this.makeCloneData(e,r,a);var n=a?r:r.ganttProperties,s=n.rowUniqueID,o=this.getRecordByID(s),l=!1;(t.isNullOrUndefined(i)||!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(r[""+e])&&(i instanceof Date?i.getTime()!==r[""+e].getTime():r[""+e]!==i))&&(l=!0),o&&(-1===this.editedRecords.indexOf(o)&&l||0===this.editedRecords.length)&&(this.editModule.draggedRecord&&this.editModule.draggedRecord.ganttProperties.taskId===n.taskId?this.editedRecords.splice(0,0,o):this.editedRecords.push(o),this.enableImmutableMode&&this.modifiedRecords.push(o))}t.setValue(e,i,r)},a.prototype.makeCloneData=function(e,i,r){var a,n,s,o=t.getValue(e,i);if(r&&(e="ganttProperties."+e),t.isNullOrUndefined(this.previousRecords[i.uniqueID])){this.previousRecords[i.uniqueID]={}}a=this.previousRecords[i.uniqueID],n=t.getValue(e,a),t.isUndefined(n)&&(s=o instanceof Date?new Date(o.getTime()):t.isObjectArray(o)?t.extend([],o,[],!0):t.isObject(o)?t.extend({},{},o,!0):o,t.isUndefined(s)?t.setValue(e,null,a):t.setValue(e,s,a))},a.prototype.closeGanttActions=function(){this.editModule&&(this.editModule.cellEditModule&&this.editModule.cellEditModule.isCellEdit?(this.treeGrid.closeEdit(),this.editModule.cellEditModule.isCellEdit=!1,t.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()))},a.prototype.getTaskByUniqueID=function(e){var t=this.flatData.filter(function(t){return t.uniqueID===e});return t.length>0?t[0]:null},a.prototype.getRecordByID=function(e){return t.isNullOrUndefined(e)?null:this.flatData[this.ids.indexOf(e.toString())]},a.prototype.setSplitterPosition=function(e,t){var i={};i[t]=e;var r=this.splitterModule.calculateSplitterPosition(i),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=r,this.splitterModule.triggerCustomResizedEvent()},a.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=0;i<e.length;i++)if("number"==typeof e[i]){var r=e[i];t=this.contructExpandCollapseArgs(null,r);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)}},a.prototype.expandByID=function(e){var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)},a.prototype.collapseByIndex=function(e){var t=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},a.prototype.collapseByID=function(e){var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},a.prototype.addRecord=function(e,i,r){if(this.editModule&&this.editSettings.allowAdding)if("ResourceView"===this.viewType){this.editModule.addRowPosition=i,this.editModule.addRowIndex=r;var a=void 0;t.isNullOrUndefined(e)||(a=e[this.taskFields.resourceInfo]);var n=void 0,s=void 0;if(!t.isNullOrUndefined(a)&&a.length){for(var o=0;o<a.length&&(n="object"==typeof a[o]?a[o][this.resourceFields.id]:a[0],!(s=this.flatData[this.getTaskIds().indexOf("R"+n)]));o++);if(s&&s.childRecords.length||0===s.level){var l=s.childRecords[r];if(l){var d="Above"===i||"Below"===i?i:"Child";"Child"===d?this.editModule.addRecord(e,d,this.getTaskIds().indexOf("R"+n)):this.editModule.addRecord(e,d,this.flatData.indexOf(l))}else this.editModule.addRecord(e,"Child",this.getTaskIds().indexOf("R"+n))}else this.editModule.addRecord(e,"Bottom")}else this.editModule.addRecord(e,"Bottom");this.editModule.addRowPosition=null,this.editModule.addRowIndex=null}else this.editModule.addRecord(e,i,r)},a.prototype.updateRecordByID=function(e){this.editModule&&this.editSettings.allowEditing&&this.editModule.updateRecordByID(e)},a.prototype.updateTaskId=function(e,t){this.editModule&&this.editSettings.allowEditing&&this.editModule.updateTaskId(e,t)},a.prototype.expandAtLevel=function(e){this.enableVirtualization&&(this.isExpandCollapseLevelMethod=!0),this.ganttChartModule.expandAtLevel(e)},a.prototype.indent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.indent()},a.prototype.outdent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.outdent()},a.prototype.showCriticalPath=function(e){if(this.criticalPathModule){this.criticalPathModule.showCriticalPath(e);var t=this.criticalPathModule;this.criticalPathModule.criticalConnectorLine(t.criticalPathCollection,t.detailPredecessorCollection,!0,t.predecessorCollectionTaskIds)}},a.prototype.getCriticalTasks=function(){return!t.isNullOrUndefined(this.criticalPathModule)&&this.enableCriticalPath?this.criticalPathModule.getCriticalTasks():null},a.prototype.zoomIn=function(){this.timelineModule.processZooming(!0)},a.prototype.zoomOut=function(){this.timelineModule.processZooming(!1)},a.prototype.fitToProject=function(){this.timelineModule.processZoomToFit(),this.ganttChartModule.updateScrollLeft(0)},a.prototype.reorderRows=function(e,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},a.prototype.updateRecordByIndex=function(e,i){if(this.editModule&&this.editSettings.allowEditing){var r=this.taskFields,a=this.updatedRecords.length>0?t.isNullOrUndefined(this.updatedRecords[e])?null:this.updatedRecords[e]:null;t.isNullOrUndefined(a)||(i[r.id]=a[r.id],this.editModule.updateRecordByID(i))}},a.prototype.addPredecessor=function(e,i){var r=this.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(r)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.addPredecessor(r,i)},a.prototype.removePredecessor=function(e){var i=this.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(i)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.removePredecessor(i)},a.prototype.updatePredecessor=function(e,i){var r=this.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(r)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.updatePredecessor(r,i)},a.prototype.openAddDialog=function(){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowAdding&&this.editModule.dialogModule.openAddDialog()},a.prototype.openEditDialog=function(e){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowEditing&&this.editModule.dialogModule.openEditDialog(e)},a.prototype.contructExpandCollapseArgs=function(e,i){var r,a,n;t.isNullOrUndefined(i)?(a=this.getRecordByID(e.toString()),r=this.getRowByID(e),t.isNullOrUndefined(r)||(n=t.getValue("rowIndex",r))):t.isNullOrUndefined(i)||(r=this.getRowByIndex(i),n=t.getValue("rowIndex",r),a=this.currentViewData[n]);return{data:a,gridRow:this.treeGrid.getRows()[n],chartRow:r,cancel:!1}},a.prototype.getRowByIndex=function(e){try{var i=this.element.querySelectorAll(".e-chart-row");return t.isNullOrUndefined(e)?null:i[e]}catch(e){return null}},a.prototype.getRowByID=function(e){var t=this.getRecordByID(e.toString()),i=this.updatedRecords.indexOf(t);return-1!==i?this.getRowByIndex(i):null},a.prototype.getUnscheduledTaskClass=function(e){return t.isNullOrUndefined(e.startDate)&&t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.duration)?" "+ue:t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration)?" "+ue:""},a.prototype.isUnscheduledTask=function(e){return!!(t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration))},a.prototype.createGanttPopUpElement=function(){var e=this.createElement("div",{className:"e-ganttpopup",styles:"display:none;"}),i=this.createElement("div",{className:"e-content",attrs:{tabIndex:"-1"}});t.append([i,this.createElement("div",{className:"e-uptail e-tail"})],e),i.appendChild(this.createElement("span")),t.append([i,this.createElement("div",{className:"e-downtail e-tail"})],e),document.getElementById(this.element.id+"GanttChart").appendChild(e)},a.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},a.prototype.search=function(e){this.filterModule&&(this.searchSettings.key=e,this.dataBind())},a.prototype.getOffsetRect=function(e){var t=e.getBoundingClientRect(),i=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,r=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,a=document.documentElement.clientTop||document.body.clientTop||0,n=document.documentElement.clientLeft||document.body.clientLeft||0,s=t.top+i-a,o=this.enableRtl?t.right+r-n:t.left+r-n;return{top:Math.round(s),left:Math.round(o),width:t.width,height:t.height}},a.prototype.expandAll=function(){this.ganttChartModule.expandCollapseAll("expand")},a.prototype.updateDataSource=function(e,i){if(this.isDynamicData=!0,!t.isNullOrUndefined(i))for(var r=0,a=Object.keys(i);r<a.length;r++){var n=a[r];switch(n){case"projectStartDate":this.setProperties({projectStartDate:i[n]},!0);break;case"projectEndDate":this.setProperties({projectEndDate:i[n]},!0)}}this.dataSource=e},a.prototype.collapseAll=function(){this.ganttChartModule.expandCollapseAll("collapse")},a.prototype.getGridColumns=function(){return this.treeGrid.getColumns()},a.prototype.getColumnByField=function(e,t){var i=t.filter(function(t){return t.field===e});return i.length>0?i[0]:null},a.prototype.getGanttColumns=function(){return this.ganttColumns},a.prototype.showColumn=function(e,t){this.treeGrid.showColumns(e,t),this.updateTreeColumns()},a.prototype.hideColumn=function(e,t){this.treeGrid.hideColumns(e,t),this.updateTreeColumns()},a.prototype.setScrollTop=function(e){this.ganttChartModule.scrollObject.setScrollTop(e)},a.prototype.cancelEdit=function(){this.isCancelled=!0,this.closeGanttActions()},a.prototype.selectCell=function(e,t){this.selectionModule&&this.selectionModule.selectCell(e,t)},a.prototype.selectCells=function(e){this.selectionModule&&this.selectionModule.selectCells(e)},a.prototype.selectRow=function(e,t){this.selectionModule&&this.selectionModule.selectRow(e,t)},a.prototype.selectRows=function(e){this.selectionModule&&this.selectionModule.selectRows(e)},a.prototype.deleteRecord=function(e){this.editModule&&this.editModule.deleteRecord(e)},a.prototype.enableItems=function(e,t){this.toolbarModule&&this.toolbarModule.enableItems(e,t)},a.prototype.clearSelection=function(){this.selectionModule&&this.selectionModule.clearSelection()},a.prototype.updateDataArgs=function(e){if(!Array.isArray(e.data)){var i=[];i.push(e.data),t.setValue("data",i,e)}return e},a.prototype.convertToMilestone=function(e){var i=this.getRecordByID(e);if(!t.isNullOrUndefined(i)){var r=t.extend({},{},i.taskData,!0),a=this.taskFields;if(r[a.startDate]&&this.setRecordValue(a.startDate,i.ganttProperties.startDate,r,!0),t.isNullOrUndefined(a.duration)?(r[a.startDate]=new Date(i.ganttProperties.startDate),r[a.endDate]=new Date(i.ganttProperties.endDate)):r[a.duration]=0,t.isNullOrUndefined(a.milestone)||!1===r[a.milestone]&&(r[a.milestone]=!0),t.isNullOrUndefined(a.progress)||(r[a.progress]=0),!t.isNullOrUndefined(a.child)&&r[a.child]&&(r[a.child]=[]),!t.isNullOrUndefined(a.parentID)&&r[a.parentID]&&(r[a.parentID]=null),t.isNullOrUndefined(a.segments)||(r[a.segments]=null),!t.isNullOrUndefined(this.contextMenuModule)&&this.contextMenuModule.isOpen&&"Milestone"===this.contextMenuModule.item){t.isNullOrUndefined(a.dependency)||(r[a.dependency]=null);this.addRecord(r,"Below")}else i.hasChildRecords||i.ganttProperties.isMilestone||this.updateRecordByID(r)}},a.prototype.changeTaskMode=function(e){var i=this.taskFields,r=this.getRecordByID(e[i.id]),a=r.ganttProperties;this.isOnEdit=!0,this.setRecordValue("isAutoSchedule",!a.isAutoSchedule,a,!0),t.isNullOrUndefined(this.taskFields.manual)||(this.setRecordValue("taskData."+i.manual,!a.isAutoSchedule,r),this.setRecordValue(i.manual,!a.isAutoSchedule,r)),this.editModule.updateTaskScheduleModes(r);var n={data:r};this.editModule.initiateUpdateAction(n)},a.prototype.getTaskIds=function(){return this.taskIds},a.prototype.setTaskIds=function(e){if("ProjectView"!==this.viewType){var t=e.ganttProperties.taskId;t=0===e.level?"R"+t:"T"+t,this.taskIds.push(t)}},a.prototype.renderTemplates=function(){this.isReact&&this.renderReactTemplates()},a.prototype.resetTemplates=function(){this.isReact&&this.clearTemplate()},$t([t.Property(!0)],a.prototype,"allowKeyboard",void 0),$t([t.Property(!1)],a.prototype,"enableImmutableMode",void 0),$t([t.Property(!0)],a.prototype,"allowParentDependency",void 0),$t([t.Property(!1)],a.prototype,"enableHtmlSanitizer",void 0),$t([t.Property(!0)],a.prototype,"disableHtmlEncode",void 0),$t([t.Complex({},Gt)],a.prototype,"loadingIndicator",void 0),$t([t.Property(!0)],a.prototype,"enableVirtualMaskRow",void 0),$t([t.Property(!0)],a.prototype,"UpdateOffsetOnTaskbarEdit",void 0),$t([t.Property(!0)],a.prototype,"autoCalculateDateScheduling",void 0),$t([t.Property(!0)],a.prototype,"autoFocusTasks",void 0),$t([t.Property(!0)],a.prototype,"allowSelection",void 0),$t([t.Property(!1)],a.prototype,"allowSorting",void 0),$t([t.Property(!0)],a.prototype,"enablePredecessorValidation",void 0),$t([t.Property(!1)],a.prototype,"showColumnMenu",void 0),$t([t.Property()],a.prototype,"columnMenuItems",void 0),$t([t.Property()],a.prototype,"timezone",void 0),$t([t.Property(!1)],a.prototype,"collapseAllParentTasks",void 0),$t([t.Property(!1)],a.prototype,"highlightWeekends",void 0),$t([t.Property(0)],a.prototype,"treeColumnIndex",void 0),$t([t.Property([])],a.prototype,"dataSource",void 0),$t([t.Property("day")],a.prototype,"durationUnit",void 0),$t([t.Property(null)],a.prototype,"query",void 0),$t([t.Property(null)],a.prototype,"dateFormat",void 0),$t([t.Property("auto")],a.prototype,"height",void 0),$t([t.Property(!1)],a.prototype,"renderBaseline",void 0),$t([t.Property(!1)],a.prototype,"allowTaskbarDragAndDrop",void 0),$t([t.Property(!0)],a.prototype,"allowTaskbarOverlap",void 0),$t([t.Property("Horizontal")],a.prototype,"gridLines",void 0),$t([t.Complex({},Dt)],a.prototype,"labelSettings",void 0),$t([t.Property(null)],a.prototype,"taskbarTemplate",void 0),$t([t.Property(null)],a.prototype,"parentTaskbarTemplate",void 0),$t([t.Property(null)],a.prototype,"milestoneTemplate",void 0),$t([t.Property()],a.prototype,"baselineColor",void 0),$t([t.Property("auto")],a.prototype,"width",void 0),$t([t.Property(!1)],a.prototype,"enableVirtualization",void 0),$t([t.Property()],a.prototype,"toolbar",void 0),$t([t.Property(["Monday","Tuesday","Wednesday","Thursday","Friday"])],a.prototype,"workWeek",void 0),$t([t.Property(!1)],a.prototype,"includeWeekend",void 0),$t([t.Property(!1)],a.prototype,"allowUnscheduledTasks",void 0),$t([t.Property(!1)],a.prototype,"showInlineNotes",void 0),$t([t.Property(36)],a.prototype,"rowHeight",void 0),$t([t.Property(null)],a.prototype,"taskbarHeight",void 0),$t([t.Property(null)],a.prototype,"projectStartDate",void 0),$t([t.Property(null)],a.prototype,"projectEndDate",void 0),$t([t.Property(null)],a.prototype,"resourceIDMapping",void 0),$t([t.Property(null)],a.prototype,"resourceNameMapping",void 0),$t([t.Property([])],a.prototype,"resources",void 0),$t([t.Property([])],a.prototype,"segmentData",void 0),$t([t.Property(null)],a.prototype,"connectorLineBackground",void 0),$t([t.Property(1)],a.prototype,"connectorLineWidth",void 0),$t([t.Property([])],a.prototype,"columns",void 0),$t([t.Property([])],a.prototype,"addDialogFields",void 0),$t([t.Property([])],a.prototype,"editDialogFields",void 0),$t([t.Property(-1)],a.prototype,"selectedRowIndex",void 0),$t([t.Property("hour")],a.prototype,"workUnit",void 0),$t([t.Property("FixedUnit")],a.prototype,"taskType",void 0),$t([t.Property("ProjectView")],a.prototype,"viewType",void 0),$t([t.Collection([{from:8,to:12},{from:13,to:17}],Ye)],a.prototype,"dayWorkingTime",void 0),$t([t.Collection([],ft)],a.prototype,"holidays",void 0),$t([t.Collection([],st)],a.prototype,"eventMarkers",void 0),$t([t.Complex({},Mt)],a.prototype,"taskFields",void 0),$t([t.Complex({},jt)],a.prototype,"resourceFields",void 0),$t([t.Complex({},It)],a.prototype,"timelineSettings",void 0),$t([t.Property([])],a.prototype,"zoomingLevels",void 0),$t([t.Complex({},Bt)],a.prototype,"sortSettings",void 0),$t([t.Complex({},rt)],a.prototype,"editSettings",void 0),$t([t.Complex({},Ft)],a.prototype,"tooltipSettings",void 0),$t([t.Complex({},kt)],a.prototype,"selectionSettings",void 0),$t([t.Property(!1)],a.prototype,"allowFiltering",void 0),$t([t.Property(!1)],a.prototype,"allowExcelExport",void 0),$t([t.Property(!1)],a.prototype,"allowRowDragAndDrop",void 0),$t([t.Property(!1)],a.prototype,"allowReordering",void 0),$t([t.Property(!1)],a.prototype,"readOnly",void 0),$t([t.Property(!1)],a.prototype,"allowResizing",void 0),$t([t.Property(!1)],a.prototype,"enableContextMenu",void 0),$t([t.Property(!1)],a.prototype,"enableCriticalPath",void 0),$t([t.Property()],a.prototype,"contextMenuItems",void 0),$t([t.Property(!1)],a.prototype,"allowPdfExport",void 0),$t([t.Property(!1)],a.prototype,"validateManualTasksOnLinking",void 0),$t([t.Property(!1)],a.prototype,"enableMultiTaskbar",void 0),$t([t.Property(!1)],a.prototype,"showOverAllocation",void 0),$t([t.Property("Auto")],a.prototype,"taskMode",void 0),$t([t.Complex({},dt)],a.prototype,"filterSettings",void 0),$t([t.Complex({},ct)],a.prototype,"searchSettings",void 0),$t([t.Complex({},Pt)],a.prototype,"splitterSettings",void 0),$t([t.Event()],a.prototype,"queryTaskbarInfo",void 0),$t([t.Event()],a.prototype,"beforeExcelExport",void 0),$t([t.Event()],a.prototype,"excelExportComplete",void 0),$t([t.Event()],a.prototype,"excelQueryCellInfo",void 0),$t([t.Event()],a.prototype,"excelHeaderQueryCellInfo",void 0),$t([t.Event()],a.prototype,"rowDrag",void 0),$t([t.Event()],a.prototype,"rowDragStart",void 0),$t([t.Event()],a.prototype,"rowDragStartHelper",void 0),$t([t.Event()],a.prototype,"rowDrop",void 0),$t([t.Event()],a.prototype,"collapsing",void 0),$t([t.Event()],a.prototype,"collapsed",void 0),$t([t.Event()],a.prototype,"expanding",void 0),$t([t.Event()],a.prototype,"expanded",void 0),$t([t.Event()],a.prototype,"actionBegin",void 0),$t([t.Event()],a.prototype,"actionComplete",void 0),$t([t.Event()],a.prototype,"actionFailure",void 0),$t([t.Event()],a.prototype,"dataStateChange",void 0),$t([t.Event()],a.prototype,"taskbarEdited",void 0),$t([t.Event()],a.prototype,"endEdit",void 0),$t([t.Event()],a.prototype,"cellEdit",void 0),$t([t.Event()],a.prototype,"load",void 0),$t([t.Event()],a.prototype,"created",void 0),$t([t.Event()],a.prototype,"destroyed",void 0),$t([t.Event()],a.prototype,"taskbarEditing",void 0),$t([t.Event()],a.prototype,"dataBound",void 0),$t([t.Event()],a.prototype,"resizeStart",void 0),$t([t.Event()],a.prototype,"resizing",void 0),$t([t.Event()],a.prototype,"resizeStop",void 0),$t([t.Event()],a.prototype,"splitterResizeStart",void 0),$t([t.Event()],a.prototype,"splitterResizing",void 0),$t([t.Event()],a.prototype,"splitterResized",void 0),$t([t.Event()],a.prototype,"columnDragStart",void 0),$t([t.Event()],a.prototype,"columnDrag",void 0),$t([t.Event()],a.prototype,"columnDrop",void 0),$t([t.Event()],a.prototype,"beforeTooltipRender",void 0),$t([t.Event()],a.prototype,"rowSelecting",void 0),$t([t.Event()],a.prototype,"rowSelected",void 0),$t([t.Event()],a.prototype,"rowDeselecting",void 0),$t([t.Event()],a.prototype,"rowDeselected",void 0),$t([t.Event()],a.prototype,"cellSelecting",void 0),$t([t.Event()],a.prototype,"cellSelected",void 0),$t([t.Event()],a.prototype,"cellDeselecting",void 0),$t([t.Event()],a.prototype,"cellDeselected",void 0),$t([t.Event()],a.prototype,"queryCellInfo",void 0),$t([t.Event()],a.prototype,"headerCellInfo",void 0),$t([t.Event()],a.prototype,"rowDataBound",void 0),$t([t.Event()],a.prototype,"columnMenuOpen",void 0),$t([t.Event()],a.prototype,"toolbarClick",void 0),$t([t.Event()],a.prototype,"columnMenuClick",void 0),$t([t.Event()],a.prototype,"contextMenuOpen",void 0),$t([t.Event()],a.prototype,"contextMenuClick",void 0),$t([t.Event()],a.prototype,"onTaskbarClick",void 0),$t([t.Event()],a.prototype,"recordDoubleClick",void 0),$t([t.Event()],a.prototype,"onMouseMove",void 0),$t([t.Event()],a.prototype,"beforePdfExport",void 0),$t([t.Event()],a.prototype,"pdfExportComplete",void 0),$t([t.Event()],a.prototype,"pdfQueryCellInfo",void 0),$t([t.Event()],a.prototype,"pdfQueryTaskbarInfo",void 0),$t([t.Event()],a.prototype,"pdfQueryTimelineCellInfo",void 0),$t([t.Event()],a.prototype,"pdfColumnHeaderQueryCellInfo",void 0),a=$t([t.NotifyPropertyChanges],a)}(t.Component);!function(e){e[e.NextPage=0]="NextPage",e[e.LastPage=1]="LastPage"}(e.PdfHorizontalOverflowType||(e.PdfHorizontalOverflowType={}));var ti=function(){function e(e){this.isCellEdit=!1,this.isResourceCellEdited=!1,this.parent=e,this.bindTreeGridProperties()}return e.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&&n.TreeGrid.Inject(n.Edit)},e.prototype.ensureEditCell=function(e){var i=this,r=e.rowData,n=e.columnName;this.editedColumn=this.parent.getColumnByField(n,this.parent.ganttColumns);var s=this.parent.taskFields;if(this.parent.readOnly)e.cancel=!0;else if("Dialog"!==this.parent.editSettings.mode){if(!r.hasChildRecords||(n!==s.endDate||(t.isNullOrUndefined(r.isManual)||!1!==r.isManual)&&"Auto"!==this.parent.taskMode)&&n!==s.duration&&n!==s.dependency&&n!==s.progress&&n!==s.work&&"taskType"!==n){var o=new a.Deferred;return this.parent.trigger("cellEdit",e,function(e){0===r.level&&"ResourceView"===i.parent.viewType&&(e.cancel=!0),o.resolve(e),e.cancel||(e.columnName===i.parent.taskFields.notes?i.openNotesEditor(e):(i.isCellEdit=!0,t.isNullOrUndefined(i.parent.toolbarModule)||i.parent.toolbarModule.refreshToolbarItems()))}),o}(n===s.dependency&&!this.parent.allowParentDependency||n!==s.dependency)&&(e.cancel=!0)}else e.cancel=!0},e.prototype.openNotesEditor=function(e){var t=this.parent.taskFields,i=e.rowData,r=e.columnName;if(r===t.notes&&!this.parent.showInlineNotes){e.cancel=!0;var a=this.parent.editModule.dialogModule.updatedEditFields.map(function(e){return e.type}).indexOf("Notes");if(-1!==a){this.parent.editModule.dialogModule.openEditDialog(i.ganttProperties.rowUniqueID);document.getElementById(this.parent.element.id+"_Tab").ej2_instances[0].selectedItem=a}}r===t.notes&&!0===this.parent.showInlineNotes&&(this.isCellEdit=!0)},e.prototype.isValueChange=function(e,i){var r=t.getValue("data",e),a=r[""+i],n=t.getValue("previousData",e);if(t.isNullOrUndefined(a)&&!t.isNullOrUndefined(n)||!t.isNullOrUndefined(a)&&t.isNullOrUndefined(n))return!0;if(!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(n)){if(a instanceof Date)return a.getTime()!==r.taskData[i].getTime();if(i===this.parent.taskFields.resourceInfo)return a!==n;if(a!==r.taskData[i])return!0}return!1},e.prototype.initiateCellEdit=function(e,i){var r=t.getValue("column",e),a=t.getValue("data",e),n={};n.action="CellEditing",n.data=this.parent.getTaskByUniqueID(a.uniqueID);var s=t.getValue("previousData",e),o=this.parent.allowUnscheduledTasks?a[r.field]:!t.isNullOrUndefined(a[r.field])&&""!==a[r.field]||this.parent.taskFields.duration!==r.field&&this.parent.taskFields.startDate!==r.field&&this.parent.taskFields.endDate!==r.field?a[r.field]:s;t.isNullOrUndefined(a)?this.parent.editModule.endEditAction(e):(a[r.field]=s,n.data[r.field]=s,this.parent.initiateEditAction(!0),this.parent.setRecordValue(r.field,o,n.data),r.field===this.parent.taskFields.name?this.taskNameEdited(n):r.field===this.parent.taskFields.startDate?this.startDateEdited(n):r.field===this.parent.taskFields.endDate?this.endDateEdited(n):r.field===this.parent.taskFields.duration?this.durationEdited(n):r.field===this.parent.taskFields.resourceInfo?this.resourceEdited(n,i,a):r.field===this.parent.taskFields.progress?this.progressEdited(n):r.field===this.parent.taskFields.baselineStartDate||r.field===this.parent.taskFields.baselineEndDate?this.baselineEdited(n):r.field===this.parent.taskFields.dependency?this.dependencyEdited(n,s):r.field===this.parent.taskFields.notes?this.notedEdited(n):r.field===this.parent.taskFields.work?this.workEdited(n):"taskType"!==r.field||t.isNullOrUndefined(this.parent.taskFields.work)?r.field===this.parent.taskFields.manual?this.taskmodeEdited(n):(this.parent.setRecordValue("taskData."+r.field,n.data[r.field],n.data),this.parent.editModule.initiateSaveAction(n)):this.typeEdited(n,i)),this.isCellEdit=!1,t.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn)||(this.parent.editModule.cellEditModule.editedColumn=null),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.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)},e.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)},e.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)},e.prototype.startDateEdited=function(e){var i=e.data,r=e.data.ganttProperties,a=e.data[this.parent.taskFields.startDate];a=a?new Date(a.getTime()):null,a=this.parent.dateValidationModule.checkStartDate(a,i.ganttProperties,i.ganttProperties.isMilestone),t.isNullOrUndefined(a)?i.hasChildRecords||(this.parent.setRecordValue("startDate",null,r,!0),this.parent.setRecordValue("duration",null,r,!0),this.parent.setRecordValue("isMilestone",!1,r,!0),this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(this.parent.taskFields.endDate)&&this.parent.setRecordValue("endDate",null,r,!0)):r.endDate||!t.isNullOrUndefined(r.duration)?(this.parent.setRecordValue("startDate",new Date(a.getTime()),r,!0),this.parent.dateValidationModule.calculateEndDate(i)):t.isNullOrUndefined(r.endDate)&&t.isNullOrUndefined(r.duration)&&this.parent.setRecordValue("startDate",new Date(a.getTime()),r,!0),this.parent.setRecordValue("isMilestone",0===r.duration,r,!0),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(i,"startDate"),this.parent.dataOperation.updateMappingData(i,"endDate"),this.parent.dataOperation.updateMappingData(i,"duration"),this.updateEditedRecord(e)},e.prototype.validateEndDateWithSegments=function(e){for(var i=[],r=e.segments,a=0;a<r.length;a++){var n=r[parseInt(a.toString(),10)],s=n.endDate;s=!t.isNullOrUndefined(e.endDate)&&s.getTime()<e.endDate.getTime()&&a!==r.length-1?s:e.endDate,n.duration=this.parent.dataOperation.getDuration(n.startDate,s,e.durationUnit,e.isAutoSchedule,e.isMilestone),r.length>0&&s.getTime()<n.startDate.getTime()&&s.getTime()<=e.endDate.getTime()?r[a-1].duration=this.parent.dataOperation.getDuration(r[a-1].startDate,e.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone):i.push(n)}return i},e.prototype.endDateEdited=function(e){var i=e.data.ganttProperties,r=e.data[this.parent.taskFields.endDate];r=r?new Date(r.getTime()):null,t.isNullOrUndefined(r)?(this.parent.setRecordValue("endDate",r,i,!0),this.parent.setRecordValue("duration",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0)):(0===r.getHours()&&86400!==this.parent.defaultEndTime&&this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,r),r=this.parent.dateValidationModule.checkEndDate(r,i),this.parent.setRecordValue("endDate",r,i,!0),!t.isNullOrUndefined(i.startDate)&&t.isNullOrUndefined(i.duration)?-1===this.parent.dateValidationModule.compareDates(i.endDate,i.startDate)&&(this.parent.setRecordValue("endDate",new Date(i.startDate.getTime()),i,!0),this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,i.endDate)):!t.isNullOrUndefined(i.duration)&&t.isNullOrUndefined(i.startDate)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(i.endDate,i.duration,i.durationUnit,i),i,!0),t.isNullOrUndefined(i.segments)||(i.segments=this.validateEndDateWithSegments(i)),-1===this.compareDatesFromRecord(i)?this.parent.dateValidationModule.calculateDuration(e.data):this.parent.editModule.revertCellEdit(e),this.parent.setRecordValue("isMilestone",0===i.duration,i,!0),i.isMilestone&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i.startDate,i),i,!0)),!t.isNullOrUndefined(e.data.ganttProperties.segments)&&e.data.ganttProperties.segments.length>0&&(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)},e.prototype.durationEdited=function(e){var t=e.data.ganttProperties,i=e.data[this.parent.taskFields.duration];this.parent.dataOperation.updateDurationValue(i,t),this.updateDates(e),this.parent.editModule.updateResourceRelatedFields(e.data,"duration"),this.updateEditedRecord(e)},e.prototype.updateDates=function(e){var i=e.data.ganttProperties,r=this.parent.dateValidationModule.getDateFromFormat(i.endDate),a=this.parent.dateValidationModule.getDateFromFormat(i.startDate),n=i.duration;t.isNullOrUndefined(n)?(this.parent.setRecordValue("isMilestone",!1,i,!0),null!=e.data[this.parent.taskFields.duration]&&this.parent.setRecordValue("endDate",null,i,!0)):(t.isNullOrUndefined(a)&&!t.isNullOrUndefined(r)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(r,n,i.durationUnit,i),i,!0),0!==n&&i.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,i,!0),this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i.startDate,i),i,!0)),!t.isNullOrUndefined(i.segments)&&i.segments.length>0&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e.data,!1),i,!0),this.parent.dataOperation.updateMappingData(e.data,"segments")),this.parent.setRecordValue("isMilestone",0===i.duration,i,!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")},e.prototype.progressEdited=function(e){var i=e.data;if(this.parent.setRecordValue("progress",i[this.parent.taskFields.progress]>100?100:i[this.parent.taskFields.progress],i.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.progress,i[this.parent.taskFields.progress]>100?100:i[this.parent.taskFields.progress],e.data),i.ganttProperties.isAutoSchedule||this.parent.setRecordValue("autoWidth",this.parent.dataOperation.calculateWidth(i,!1),i.ganttProperties,!0),!t.isNullOrUndefined(e.data.ganttProperties.segments)&&e.data.ganttProperties.segments.length>0&&!t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&this.parent.editModule.taskbarEditModule.updateSegmentProgress(e.data.ganttProperties),!e.data.hasChildRecords){var r=i.ganttProperties.isAutoSchedule?i.ganttProperties.width:i.ganttProperties.autoWidth;this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(r,i.ganttProperties.progress),i.ganttProperties,!0)}this.updateEditedRecord(e)},e.prototype.baselineEdited=function(e){var t=e.data.ganttProperties,i=e.data[this.parent.taskFields.baselineStartDate],r=e.data[this.parent.taskFields.baselineEndDate];r&&0===r.getHours()&&86400!==this.parent.defaultEndTime&&this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,r),this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.checkBaselineStartDate(i),t,!0),this.parent.setRecordValue("baselineEndDate",this.parent.dateValidationModule.checkBaselineEndDate(r),t,!0),t.baselineStartDate&&t.baselineEndDate&&(this.parent.setRecordValue("baselineLeft",this.parent.dataOperation.calculateBaselineLeft(t),t,!0),this.parent.setRecordValue("baselineWidth",this.parent.dataOperation.calculateBaselineWidth(t),t,!0)),this.updateEditedRecord(e)},e.prototype.resourceEdited=function(e,i,r){var a=this.parent.resourceFields,n=i[this.parent.taskFields.resourceInfo];if(n){this.isResourceCellEdited=!0;for(var s=this.parent.dataOperation.setResourceInfo(i).length,o=r.ganttProperties.resourceInfo,l=void 0,d=[],h=this.parent.resources,p=void 0,c=function(e){if(o){var i=o.length;for(p=0;p<i;p++){if(o[p][a.id]===n[e]){l=p;break}l=-1}}if(t.isNullOrUndefined(l)||-1===l){var r=h.filter(function(t){return n[e]===t[a.id]}),s=t.extend({},r[0]);s[a.unit]=100,d.push(s)}else d.push(o[parseInt(l.toString(),10)])},u=0;u<s;u++)c(u);e.data.ganttProperties.resourceInfo=d,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=o),this.updateDates(e),this.updateEditedRecord(e)}},e.prototype.dependencyEdited=function(e,t){this.parent.predecessorModule.updateUnscheduledDependency(e.data),this.parent.connectorLineEditModule.updatePredecessor(e.data,e.data[this.parent.taskFields.dependency],e)||this.parent.editModule.revertCellEdit(t)},e.prototype.workEdited=function(e){var t=e.data.ganttProperties,i=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)},e.prototype.typeEdited=function(e,t){var i=e.data.ganttProperties,r=t.taskType;this.parent.setRecordValue("taskType",r,i,!0),this.updateEditedRecord(e)},e.prototype.compareDatesFromRecord=function(e){var t=this.parent.dateValidationModule.getValidStartDate(e),i=this.parent.dateValidationModule.getValidEndDate(e);return this.parent.dateValidationModule.compareDates(t,i)},e.prototype.updateEditedRecord=function(e){this.parent.editModule.initiateUpdateAction(e)},e.prototype.destroy=function(){this.parent.editModule.cellEditModule=void 0},e}(),ii=function(){function e(e,t){this.parent=e,this.taskbarEdit=t}return e.prototype.createTooltip=function(e,t,r){var a=this;this.toolTipObj=new i.Tooltip({opensOn:e,position:"TopRight",enableRtl:this.parent.enableRtl,mouseTrail:t,cssClass:"e-gantt-tooltip",target:r||null,animation:{open:{effect:"None"},close:{effect:"None"}}}),this.toolTipObj.beforeRender=function(e){var t={data:a.taskbarEdit.taskBarEditRecord,args:e,content:a.toolTipObj.content};a.parent.trigger("beforeTooltipRender",t)},this.toolTipObj.afterOpen=function(e){a.updateTooltipPosition(e)},this.toolTipObj.isStringTemplate=!0,this.toolTipObj.appendTo(this.parent.chartPane)},e.prototype.updateTooltipPosition=function(e){var t=this.parent.getOffsetRect(this.parent.chartPane).left+this.parent.chartPane.offsetWidth,i=e.element.offsetLeft;t<i+e.element.offsetWidth&&(i+=t-(i+e.element.offsetWidth)),e.element.style.left=i+"px",e.element.style.visibility="visible"},e.prototype.showHideTaskbarEditTooltip=function(e,i){e&&this.parent.tooltipSettings.showTooltip?(this.createTooltip("Custom",!1),this.parent.tooltipModule.toolTipObj.close(),this.updateTooltip(i),"ConnectorPointLeftDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+Me)):"ConnectorPointRightDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+Re)):this.toolTipObj.open(this.taskbarEdit.taskBarEditElement)):t.isNullOrUndefined(this.toolTipObj)||(this.toolTipObj.destroy(),this.toolTipObj=null)},e.prototype.updateTooltip=function(e){var i=this.taskbarEdit.taskBarEditRecord.ganttProperties,r=-1===e?i.width:i.segments[e].width,a=-1===e?i.progressWidth:i.segments[e].progressWidth,n=-1===e?i.left:i.left+i.segments[e].left;t.isNullOrUndefined(this.toolTipObj)||("ConnectorPointLeftDrag"===this.taskbarEdit.taskBarEditAction||"ConnectorPointRightDrag"===this.taskbarEdit.taskBarEditAction?(this.toolTipObj.content=this.getTooltipText(e),this.toolTipObj.offsetY=-3):(this.toolTipObj.content=this.getTooltipText(e),this.toolTipObj.refresh(this.taskbarEdit.taskBarEditElement),"LeftResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=0:this.toolTipObj.offsetX=-r:"RightResizing"===this.taskbarEdit.taskBarEditAction||"ParentResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-r:this.toolTipObj.offsetX=0:"ProgressResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-a:this.toolTipObj.offsetX=-(r-a):"MilestoneDrag"===this.taskbarEdit.taskBarEditAction?this.toolTipObj.offsetX=-this.parent.chartRowsModule.milestoneHeight/2:r>5&&(this.toolTipObj.offsetX=-(r+n-this.taskbarEdit.tooltipPositionX))))},e.prototype.getTooltipText=function(e){var i="",r=this.parent.globalize,a=this.taskbarEdit.taskBarEditRecord.ganttProperties;if(!t.isNullOrUndefined(a.segments)&&a.segments.length>0&&-1!==e&&"ProgressResizing"!==this.taskbarEdit.taskBarEditAction&&(a=a.segments[e]),this.parent.tooltipSettings.editing){var n=this.parent.tooltipModule.templateCompiler(this.parent.tooltipSettings.editing,this.parent,this.taskbarEdit.taskBarEditRecord,"TooltipEditingTemplate");t.getValue("tooltipEle",this.toolTipObj)&&this.parent.renderTemplates(),i=n[0]}else{var s=void 0,o=void 0,l=void 0;switch(t.isNullOrUndefined(a.startDate)||(s='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+r.formatDate(a.startDate,{format:this.parent.getDateFormat()})+"</td></tr>"),t.isNullOrUndefined(a.endDate)||(o='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+r.formatDate(a.endDate,{format:this.parent.getDateFormat()})+"</td></tr>"),t.isNullOrUndefined(a.duration)||(l='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+this.parent.getDurationString(a.duration,a.durationUnit)+"</td></tr>"),this.taskbarEdit.taskBarEditAction){case"ProgressResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+('<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+a.progress+"</td></tr>")+"</tbody></table>";break;case"LeftResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+s+l+"</tbody></table>";break;case"RightResizing":case"ParentResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+o+l+"</tbody></table>";break;case"ChildDrag":case"ParentDrag":case"MilestoneDrag":case"ManualParentDrag":var d="",h="";t.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.startDate)||(d=s),t.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.endDate)||(h=o),i='<table class = "e-gantt-tooltiptable"><tbody>'+d+h+"</tbody></table>";break;case"ConnectorPointLeftDrag":case"ConnectorPointRightDrag":i=this.parent.connectorLineModule.tooltipTable,t.isNullOrUndefined(this.toolTipObj)&&(this.parent.connectorLineModule.tooltipTable.innerHTML=this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"",""))}}return i},e}(),ri=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ai=function(){return(ai=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},ni=function(e){function i(t){var i=e.call(this,t)||this;return i.isMouseDragged=!1,i.dependencyCancel=!1,i.editElement=null,i.elementOffsetLeft=0,i.elementOffsetTop=0,i.elementOffsetWidth=0,i.elementOffsetHeight=0,i.segmentIndex=-1,i.currentItemTop=0,i.currentItemPrevTop=0,i.topValue=0,i.draggedRecordMarginTop=0,i.parent=t,i.initPublicProp(),i.wireEvents(),i.editTooltip=new ii(i.parent,i),i}return ri(i,e),i.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)},i.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},i.prototype.mouseDownHandler=function(e){if(this.parent.editSettings.allowTaskbarEditing&&!this.parent.readOnly)if(this.canDrag=!1,this.parent.isAdaptive&&this.taskBarEditElement){var t=this.getElementByPosition(e),i=f(t,H);!i||i.innerHTML!==this.taskBarEditElement.innerHTML||t.classList.contains(Me)||t.classList.contains(Re)||this.tapPointOnFocus||(this.updateTaskBarEditElement(e),this.canDrag=!0,e.preventDefault())}else this.parent.isAdaptive||this.updateTaskBarEditElement(e)},i.prototype.mouseClickHandler=function(e){if(this.parent.editSettings.allowTaskbarEditing){var t=this.getElementByPosition(e),i=f(t,H);this.parent.selectionModule&&this.parent.selectionModule.enableSelectMultiTouch?this.tapPointOnFocus&&this.updateTaskBarEditElement(e):this.tapPointOnFocus&&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(Oe)||t.classList.contains(xe)?(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))}},i.prototype.showHideActivePredecessors=function(e){var i=this.taskBarEditRecord.ganttProperties,r=i.predecessor,a="ResourceView"===this.parent.viewType?i.taskId:i.rowUniqueID;if(r)for(var n=0;n<r.length;n++){var s=r[n];a.toString()!==s.from&&a.toString()!==s.to||this.applyActiveColor(s.from,s.to,e)}var o=this.parent.ganttChartModule.chartBodyContainer;e?(t.addClass([this.taskBarEditElement],[Ue]),t.addClass([o],[Le])):(t.removeClass([this.taskBarEditElement],[Ue]),t.removeClass([o],[Le])),this.touchEdit=e,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},i.prototype.applyActiveColor=function(e,i,r){var a=("ProjectView"===this.parent.viewType?this.taskBarEditRecord.ganttProperties.taskId.toString():this.taskBarEditRecord.ganttProperties.rowUniqueID.toString())===e?this.parent.connectorLineModule.getRecordByID(i):this.parent.connectorLineModule.getRecordByID(e),n=this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(a)];if(!t.isNullOrUndefined(n)){var s=n.querySelector("."+H),o=this.parent.element.querySelector("#ConnectorLineparent"+e+"child"+i);r?(t.addClass([s],[Ve]),o&&t.addClass([o],[Ve])):(t.removeClass([s],[Ve]),o&&t.removeClass([o],[Ve]))}},i.prototype.validateConnectorPoint=function(){var e=this.taskBarEditRecord.ganttProperties,t=this.connectorSecondRecord.ganttProperties,i=!0,r="ResourceView"===this.parent.viewType?e.taskId:e.rowUniqueID,a="ResourceView"===this.parent.viewType?t.taskId:t.rowUniqueID;if(this.connectorSecondRecord.hasChildRecords)i=!1;else if(t.predecessor)for(var n=0;n<t.predecessor.length;n++){var s=t.predecessor[n];if(s.from===r.toString()&&s.to===a.toString()){this.parent.connectorLineEditModule.childRecord=this.connectorSecondRecord,this.parent.connectorLineEditModule.predecessorIndex=n,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}if(s.from===a.toString()&&s.to===r.toString()){this.parent.connectorLineEditModule.childRecord=this.taskBarEditRecord,this.parent.connectorLineEditModule.predecessorIndex=n,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}}return i},i.prototype.mouseLeaveHandler=function(e){this.dragMouseLeave=!0},i.prototype.updateTaskBarEditElement=function(e){var i,r=this.getElementByPosition(e);if(r.classList.contains(he)||r.classList.contains(se)||r.classList.contains(oe))i=f(r,se);else if(r.classList.contains(le))i=f(r,le);else if(i=f(r,H),!t.isNullOrUndefined(i)&&!r.classList.contains("e-connectorpoint-left")&&!r.classList.contains("e-connectorpoint-right")){var a=this.parent.ganttChartModule.getRecordByTaskBar(i);!t.isNullOrUndefined(a.ganttProperties.segments)&&a.ganttProperties.segments.length>0&&(i=f(r,W))}if(this.parent.editSettings.allowTaskbarEditing&&i){this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.editElement=i,this.realTaskbarElement=this.editElement;var n=this.editElement.getAttribute("data-segment-index");if(t.isNullOrUndefined(n)?this.segmentIndex=-1:this.segmentIndex=Number(n),this.taskBarEditRecord=this.parent.ganttChartModule.getRecordByTaskBar(this.editElement),"mousedown"===e.type||"touchstart"===e.type||"click"===e.type){this.taskBarEditAction=this.getTaskBarAction(e);var s=this.editElement.getAttribute("data-segment-index"),o=(a=this.parent.ganttChartModule.getRecordByTaskBar(i)).ganttProperties,l=this.editElement.parentElement.offsetLeft;this.currentData=a;var d=t.createElement("div",{styles:"height:100%;border-style:dashed;border-bottom:none;border-top:none;border-width:1px;position:absolute;z-index:10000"});t.addClass([d],"e-taskbar-resize-div"),d.style.setProperty("width",o.width+"px");var h=this.editElement.getAttribute("data-segment-index");d.style.setProperty("left",t.isNullOrUndefined(o.segments)?o.left+"px":l+o.segments[Number(h)].left+"px");var p=this.parent.createElement("table"),c=this.parent.createElement("tbody");c.appendChild(d),p.appendChild(c);var u=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar"),g=null;if("ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(s)||t.isNullOrUndefined(s)||0!==Number(s))m=this.editElement.cloneNode(!0);else var m=this.editElement.parentElement.cloneNode(!0);if(!u){t.addClass([m],"e-clone-taskbar"),m.style.setProperty("position","absolute"),m.style.setProperty("top","0px"),g=this.parent.createElement("table");var y=this.parent.createElement("tbody");y.appendChild(m),g.appendChild(y)}if("ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(s)||t.isNullOrUndefined(s)||0!==Number(s))this.cloneTaskbarElement=m;else{var D=m.getElementsByClassName("e-segmented-taskbar");this.cloneTaskbarElement=D[Number(s)]}if(this.taskBarEditElement=this.cloneTaskbarElement,this.taskbarElement=g,this.taskbarResizer=p,this.currentIndex=s,this.roundOffDuration=!0,"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||!t.isNullOrUndefined(this.parent.taskFields.dependency)||(this.taskBarEditAction=null),this.updateMouseDownProperties(e),"ResourceView"===this.parent.viewType){if(0===this.taskBarEditRecord.level)return;if(this.parent.enableMultiTaskbar){var v=this.parent.getTaskByUniqueID(this.taskBarEditRecord.parentItem.uniqueID);t.isNullOrUndefined(v)||v.expanded||(this.prevZIndex=this.taskBarEditElement.style.zIndex,this.taskBarEditElement.style.zIndex="1000",this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")&&t.addClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"))}}}}else this.parent.isAdaptive?(this.taskBarEditElement&&this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.initPublicProp()):this.showHideTaskBarEditingElements(i,this.editElement)},i.prototype.showHideTaskBarEditingElements=function(e,i,r){i=i||this.editElement;var a=!!this.parent.taskFields.progress,n=!0;if(!this.parent.readOnly){if("ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar&&e){var s=this.parent.ganttChartModule.getRecordByTaskBar(e),o=this.parent.getParentTask(s.parentItem);t.isNullOrUndefined(o)||o.expanded||(a=!1,n=!1)}if(e){if(e.querySelector("."+K)){if(t.addClass([e.querySelector("."+K)],[ge]),t.addClass([e.querySelector("."+J)],[fe]),a){var l=e.querySelector("."+$);t.isNullOrUndefined(l)||(t.addClass([l],[me]),l.style.top="3px")}}else if(this.parent.isAdaptive&&a){(s=this.parent.ganttChartModule.getRecordByTaskBar(e)).hasChildRecords&&t.addClass([e],[Fe])}if(t.addClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+ke),[Ce]),!t.isNullOrUndefined(this.parent.taskFields.dependency)&&(e.querySelector("."+Me)||e.parentElement.querySelector("."+Me))&&n){var d=t.isNullOrUndefined(e.querySelector("."+Me))?e.parentElement:e;t.addClass([d.querySelector("."+Me)],[Oe]),t.addClass([d.querySelector("."+Re)],[xe])}}else r||t.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+ke),[Ce]);if(i&&e!==i){if(i.querySelector("."+K)&&(t.removeClass([i.querySelector("."+K)],[ge]),t.removeClass([i.querySelector("."+J)],[fe]),i.querySelector("."+$)&&t.removeClass([i.querySelector("."+$)],[me])),t.isNullOrUndefined(this.parent.taskFields.dependency)||!i.querySelector("."+Me)&&!i.parentElement.querySelector("."+Me)){if(this.parent.isAdaptive){(s=this.parent.ganttChartModule.getRecordByTaskBar(i))&&s.hasChildRecords&&t.removeClass([i],[Fe])}}else{d=t.isNullOrUndefined(i.querySelector("."+Me))?i.parentElement:i;t.removeClass([d.querySelector("."+Me)],[Oe]),t.removeClass([d.querySelector("."+Re)],[xe])}this.editElement=null}}},i.prototype.getTaskBarAction=function(e){var i=this.getElementByPosition(e),r=this.taskBarEditRecord,a="";return i.classList.contains(K)?a="LeftResizing":i.classList.contains(J)?a="RightResizing":(i.classList.contains($)||t.closest(i,"."+$))&&this.parent.taskFields.progress?a="ProgressResizing":i.classList.contains(Me)?a="ConnectorPointLeftDrag":i.classList.contains(Re)?a="ConnectorPointRightDrag":i.classList.contains(he)?a="ParentResizing":i.classList.contains(oe)||i.classList.contains(se)||i.classList.contains(le)?a="ManualParentDrag":r&&(a=r.hasChildRecords?"Auto"===this.parent.taskMode?"ParentDrag":"":r.ganttProperties.isMilestone?"MilestoneDrag":"ChildDrag"),a},i.prototype.updateMouseDownProperties=function(e){var i=this.getCoordinate(e);if(i.pageX||i.pageY){var r=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);this.parent.enableRtl?this.mouseDownX=Math.abs(i.pageX-(r.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseDownX=i.pageX-r.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseDownX,this.mouseDownY=this.dragMoveY=i.pageY-r.top+this.parent.ganttChartModule.scrollObject.previousScroll.top}if("ResourceView"==this.parent.viewType&&this.parent.allowTaskbarDragAndDrop){var a=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(a=this.parent.toolbarModule.element.offsetHeight),this.topValue=this.parent.getOffsetRect(e.target).top-this.parent.getOffsetRect(this.parent.element).top-parseInt(t.closest(e.target,".e-taskbar-main-container").style.marginTop)-this.parent.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight-a+document.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollTop,this.currentItemPrevTop=this.currentItemTop=this.topValue}"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||(this.fromPredecessorText="ConnectorPointLeftDrag"===this.taskBarEditAction?"start":"finish",this.parent.connectorLineModule.tooltipTable.innerHTML=this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.taskBarEditRecord.ganttProperties.taskName,this.fromPredecessorText,"",""))},i.prototype.isMouseDragCheck=function(){if(!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);var e=this.taskBarEditRecord.ganttProperties;this.previousItem=this.parent.timelineModule.extendFunction(e,this.previousItemProperty),"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction&&this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),this.taskBarEditElement.setAttribute("aria-grabbed","true")}},i.prototype.mouseMoveAction=function(e){var i=this;if(this.parent.isAdaptive){if(!this.canDrag)return;this.multipleSelectionEnabled()}var r=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),a=this.getCoordinate(e);if(this.parent.enableRtl?this.mouseMoveX=Math.abs(a.pageX-(r.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=a.pageX-r.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.mouseMoveY=a.pageY-r.top+this.parent.ganttChartModule.scrollObject.previousScroll.top,this.dragMouseLeave=!1,this.isMouseDragCheck(),this.isMouseDragged&&this.taskBarEditAction){if(!(t.isNullOrUndefined(this.taskbarElement)||t.isNullOrUndefined(this.editElement)||"ConnectorPointRightDrag"===this.taskBarEditAction||"ConnectorPointLeftDrag"===this.taskBarEditAction||"ResourceView"===this.parent.viewType&&this.currentData.hasChildRecords)){var n=this.editElement.parentElement;if(n.style.setProperty("position","absolute"),"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(this.currentIndex)||t.isNullOrUndefined(this.currentIndex)||0!==Number(this.currentIndex)?n.appendChild(this.taskbarElement):(this.taskbarElement.childNodes[0].childNodes[0].style.setProperty("top",n.parentElement.offsetTop+"px"),n.parentElement.appendChild(this.taskbarElement)),"ProgressResizing"!==this.taskBarEditAction){this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-rows-container")[0].appendChild(this.taskbarResizer)}}var s={cancel:!1,requestType:"taskbarediting",taskBarEditAction:this.taskBarEditAction,data:this.taskBarEditRecord};-1!==this.segmentIndex&&(s.requestType="mergeSegment"),this.parent.trigger("actionBegin",s,function(r){"ConnectorPointRightDrag"!==s.taskBarEditAction&&"ConnectorPointLeftDrag"!==s.taskBarEditAction&&"LeftResizing"!==s.taskBarEditAction&&"RightResizing"!==s.taskBarEditAction&&"ProgressResizing"!==s.taskBarEditAction&&"ChildDrag"!==s.taskBarEditAction&&"ParentDrag"!==s.taskBarEditAction&&"MilestoneDrag"!==s.taskBarEditAction&&"ManualParentDrag"!==s.taskBarEditAction||(i.parent.showIndicator=!1),!t.isNullOrUndefined(i.parent.loadingIndicator)&&"Shimmer"===i.parent.loadingIndicator.indicatorType&&i.parent.showIndicator?i.parent.showMaskRow():i.parent.showIndicator&&i.parent.showSpinner(),!1===r.cancel&&i.taskBarEditingAction(e,!1)})}else this.parent.isAdaptive||this.taskBarEditAction||this.updateTaskBarEditElement(e)},i.prototype.taskBarEditingAction=function(e,i){var r=this,a={},n=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement);if(null!==this.taskBarEditRecord){if(a.editingFields=this.taskBarEditRecord.ganttProperties,a.data=this.taskBarEditRecord,"ResourceView"===this.parent.viewType&&0===a.data.level)return;if(a.recordIndex=n,a.taskBarEditAction=this.taskBarEditAction,a.roundOffDuration=this.roundOffDuration,a.cancel=!1,a.previousData=this.previousItem,a.segmentIndex=this.segmentIndex,this.roundOffDuration=a.roundOffDuration,this.targetElement=a.target=t.closest(e.target,".e-gantt-child-taskbar"),this.updateMouseMoveProperties(e),"ProgressResizing"===this.taskBarEditAction?this.performProgressResize(e):"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.parent.isAdaptive||this.drawFalseLine()),"ResourceView"==this.parent.viewType&&this.parent.allowTaskbarDragAndDrop){this.dragMoveY>this.mouseMoveY?(this.mouseMoveY=this.dragMoveY-this.mouseMoveY,this.currentItemTop=this.currentItemTop-this.mouseMoveY):(this.mouseMoveY-=this.dragMoveY,this.currentItemTop=this.currentItemTop+this.mouseMoveY);var s=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);this.dragMoveY=e.pageY-s.top+this.parent.ganttChartModule.scrollObject.previousScroll.top,this.topValue=this.currentItemTop,this.currentItemPrevTop=0===this.currentItemPrevTop||this.topValue==this.currentItemTop?this.topValue:this.currentItemPrevTop}this.setItemPosition(),this.updateEditedItem(),this.editTooltip.updateTooltip(this.segmentIndex),i&&this.taskBarEditedAction(e),this.parent.trigger("taskbarEditing",a,function(e){e.cancel&&null!==r.taskBarEditRecord&&(r.tapPointOnFocus=!1,t.merge(r.taskBarEditRecord.ganttProperties,e.previousData))})}},i.prototype.updateMouseMoveProperties=function(e){var t=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),i=this.getCoordinate(e);(i.pageX||i.pageY)&&(this.parent.enableRtl?this.mouseMoveX=Math.abs(i.pageX-(t.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=i.pageX-t.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseMoveX,this.mouseMoveY=i.pageY-t.top+this.parent.ganttChartModule.scrollObject.previousScroll.top);var r="ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction;if(this.taskBarEditRecord.ganttProperties.width>3&&("ProgressResizing"!==this.taskBarEditAction||0!==this.taskBarEditRecord.ganttProperties.progress&&100!==this.taskBarEditRecord.ganttProperties.progress)||r){var a=0;a=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;var n=this.mouseMoveY-this.parent.ganttChartModule.scrollObject.previousScroll.top+t.top;a+20>t.left+this.parent.ganttChartModule.chartBodyContainer.offsetWidth?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("right")):a+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")):a-20<t.left?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("left")):n+80>t.top+this.parent.ganttChartModule.chartBodyContainer.offsetHeight?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("bottom")):n-20<t.top?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("top")):this.stopScrollTimer()}else this.stopScrollTimer()},i.prototype.startScrollTimer=function(e){var t=this;this.stopScrollTimer();var i=0;this.scrollTimer=window.setInterval(function(){-1==Math.sign(t.timerCount)&&(i=-1,t.timerCount=Math.abs(t.timerCount)),t.timerCount="right"===e?t.timerCount+1>=t.parent.timelineModule.totalTimelineWidth?t.parent.timelineModule.totalTimelineWidth:t.timerCount+1:"bottom"===e?t.timerCount+1:t.timerCount-1<0?0:t.timerCount-1,"bottom"===e||"top"===e?t.parent.ganttChartModule.scrollObject.setScrollTop(t.timerCount):t.parent.ganttChartModule.scrollObject.setScrollLeft(t.timerCount,i),"ConnectorPointLeftDrag"!==t.taskBarEditAction&&"ConnectorPointRightDrag"!==t.taskBarEditAction||t.drawFalseLine()},0)},i.prototype.stopScrollTimer=function(){window.clearInterval(this.scrollTimer),this.scrollTimer=null},i.prototype.enableDragging=function(e){var i=this.taskBarEditRecord.ganttProperties,r=0;if(this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&!this.taskBarEditElement.classList.contains("e-segment-first")){var a=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ai({},e)}),n=a[this.segmentIndex];this.mouseDownX>this.mouseMoveX?(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,n.left=n.left-r):(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,n.left=n.left+r);var s=a[this.segmentIndex-1],o=a[this.segmentIndex+1],l=void 0;l=this.taskBarEditElement.classList.contains("e-segment-inprogress")?n.left<s.left+s.width?s.left+s.width:n.width+n.left>o.left?o.left-n.width:n.left:n.left<s.left+s.width?s.left+s.width:i.left+n.width+n.left>=this.parent.timelineModule.totalTimelineWidth?this.parent.timelineModule.totalTimelineWidth-n.width:n.left,n.left=l,this.parent.setRecordValue("segments",a,i,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")}else{this.mouseDownX>this.mouseMoveX?(r=this.mouseDownX-this.mouseMoveX)>0&&this.parent.setRecordValue("left",this.previousItem.left-r,i,!0):(r=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("left",this.previousItem.left+r,i,!0));l=i.left<0?0:i.left+i.width>=this.parent.timelineModule.totalTimelineWidth?this.parent.timelineModule.totalTimelineWidth-i.width:i.left;this.parent.setRecordValue("left",l,i,!0)}},i.prototype.performProgressResize=function(e){var t=this.taskBarEditRecord.ganttProperties,i=0;this.mouseDownX>this.mouseMoveX?this.mouseMoveX>t.left&&this.mouseMoveX<t.left+t.width&&t.left>0?(i=this.mouseMoveX-t.left,this.parent.setRecordValue("progressWidth",i,t,!0)):this.mouseMoveX>=t.left+t.width?this.parent.setRecordValue("progressWidth",t.width,t,!0):this.parent.setRecordValue("progressWidth",0,t,!0):this.mouseMoveX>t.left&&this.mouseMoveX<t.left+t.width?(i=this.mouseMoveX-t.left,this.parent.setRecordValue("progressWidth",i,t,!0)):this.mouseMoveX<=t.left?this.parent.setRecordValue("progressWidth",0,t,!0):this.parent.setRecordValue("progressWidth",t.width,t,!0);var r=t.progressWidth>t.width?t.width:t.progressWidth;r=t.progressWidth<0?0:t.progressWidth,this.parent.setRecordValue("progressWidth",r,t,!0);var a=t.width-t.progressWidth;this.progressBorderRadius=a<=4?4-a:0},i.prototype.enableLeftResizing=function(e){var t=this.taskBarEditRecord.ganttProperties,i=0;this.taskBarEditElement.classList.contains("e-segmented-taskbar")?this.enableSplitTaskLeftResize(t):(this.mouseDownX>this.mouseMoveX?this.mouseMoveX<t.left+t.width?(i=this.mouseDownX-this.mouseMoveX,t.left>0&&(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)),this.updateEditPosition(e,t),this.parent.setRecordValue("left",this.previousItem.left+this.previousItem.width-t.width,t,!0))},i.prototype.enableSplitTaskLeftResize=function(e){var i=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ai({},e)}),r=i[this.segmentIndex],a=0;if(this.mouseDownX>this.mouseMoveX)if(this.mouseMoveX<e.left+r.width+r.left){if(a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,r.left>0){if(r.left=r.left-a,r.width=r.width+a,0!==this.segmentIndex){var n=i[this.segmentIndex-1];if(e.left+r.left<e.left+n.left+n.width){var s=e.left+n.left+n.width-(e.left+r.left);r.width-=s,r.left=r.left+s}}}else if(r.left<=0&&0===this.segmentIndex){this.parent.setRecordValue("left",e.left-a,e,!0),this.parent.setRecordValue("width",e.width+a,e,!0),r.width=r.width+a;for(var o=1;o<e.segments.length;o++){var l=i[o];l.left=l.left+a}}}else this.mouseMoveX>e.left+r.width+r.left&&(a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,r.left=r.left-a,r.width=this.parent.perDayWidth);else if(this.mouseMoveX<e.left+r.width+r.left-this.parent.perDayWidth)if(a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,0===this.segmentIndex&&r.left<=0){this.parent.setRecordValue("left",e.left+a,e,!0),this.parent.setRecordValue("width",e.width-a,e,!0),r.width=r.width-a;for(o=1;o<e.segments.length;o++){var d=i[o];d.left=d.left-a}}else r.left<r.left+r.width&&r.left+a<=r.left+r.width&&(r.left=r.left+a,r.width=r.width-a);else if(this.mouseMoveX<e.left+r.left+r.width&&r.width>this.parent.perDayWidth){a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX;if(a-=r.width-a<this.parent.perDayWidth?this.parent.perDayWidth>r.width?this.parent.perDayWidth-r.width:r.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);for(o=1;o<e.segments.length;o++){var h=i[o];h.left=h.left-a}}else r.left=r.left+a,r.width=r.width-a}this.parent.setRecordValue("segments",i,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.updateEditPosition=function(e,t){this.updateIsMilestone(t),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.width,t.progress),t,!0)},i.prototype.updateIsMilestone=function(e){e.width<=3?(this.parent.setRecordValue("width",3,e,!0),this.parent.setRecordValue("isMilestone",!0,e,!0)):(this.parent.setRecordValue("width",e.width,e,!0),this.parent.setRecordValue("isMilestone",!1,e,!0))},i.prototype.enableRightResizing=function(e){var i=this.taskBarEditRecord.ganttProperties,r=0;if(this.taskBarEditElement.classList.contains("e-segmented-taskbar")){var a=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ai({},e)}),n=a[this.segmentIndex];this.mouseDownX>this.mouseMoveX?this.mouseMoveX>i.left+n.left&&this.mouseDownX-this.mouseMoveX>3?(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,n.width=n.width-r):this.mouseMoveX<i.left+n.left&&(n.width=this.parent.perDayWidth):this.mouseMoveX>n.left&&(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,n.width=n.width+r);var s=void 0,o=this.segmentIndex!==a.length-1?a[this.segmentIndex+1]:null;t.isNullOrUndefined(o)||(this.taskBarEditElement.classList.contains("e-segment-last")||(s=n.left+n.width>o.left?o.left-n.left:n.width),n.width=s),this.segmentIndex===i.segments.length-1&&0===this.segmentIndex&&this.parent.setRecordValue("width",n.width,i,!0),this.parent.setRecordValue("segments",a,i,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")}else this.mouseDownX>this.mouseMoveX?this.mouseMoveX>i.left&&this.mouseDownX-this.mouseMoveX>3?(r=this.mouseDownX-this.mouseMoveX,this.parent.setRecordValue("width",this.previousItem.width-r,i,!0)):this.mouseMoveX<i.left&&this.parent.setRecordValue("width",3,i,!0):this.mouseMoveX>i.left&&(r=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("width",this.previousItem.width+r,i,!0)),this.updateEditPosition(e,i)},i.prototype.updateEditedItem=function(){var e,i,r,a,n=this.taskBarEditRecord.ganttProperties;switch(this.taskBarEditAction){case"ProgressResizing":this.parent.setRecordValue("progress",this.getProgressPercent(n.width,n.progressWidth),n,!0);break;case"LeftResizing":-1===this.segmentIndex?(e=this.getRoundOffStartLeft(n,this.roundOffDuration),i=this.getDateByLeft(e),t.isNullOrUndefined(n.endDate)&&(r=this.parent.dateValidationModule.getValidEndDate(n),this.parent.setRecordValue("endDate",r,n,!0)),a=this.parent.dateValidationModule.checkStartDate(i,n,null),this.parent.setRecordValue("startDate",new Date(a.getTime()),n,!0),0===this.parent.dateValidationModule.compareDates(n.startDate,n.endDate)&&t.isNullOrUndefined(n.isMilestone)&&!1===n.isMilestone&&0===n.duration&&this.parent.setRecordValue("duration",1,n,!0),n.isMilestone&&this.parent.setRecordValue("endDate",new Date(a.getTime()),n,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")):this.updateSplitLeftResize(n);break;case"RightResizing":case"ParentResizing":if(-1===this.segmentIndex){e=this.getRoundOffEndLeft(n,this.roundOffDuration);var s=this.getDateByLeft(e);t.isNullOrUndefined(n.startDate)&&(a=this.parent.dateValidationModule.getValidStartDate(n),this.parent.setRecordValue("startDate",a,n,!0));var o=t.isNullOrUndefined(n.startDate)?a:n.startDate;r=n.isMilestone?o:this.parent.dateValidationModule.checkEndDate(s,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",new Date(r.getTime()),n,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")}else this.updateSplitRightResizing(n);break;case"ParentDrag":case"ChildDrag":case"MilestoneDrag":case"ManualParentDrag":-1===this.segmentIndex||0===this.segmentIndex?this.updateChildDrag(n):this.setSplitTaskDrag(n)}},i.prototype.updateChildDrag=function(e){var i,r=this.getRoundOffStartLeft(e,this.roundOffDuration),a=this.getDateByLeft(r,e.isMilestone,e);0===this.segmentIndex?(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(a,e,null),e,!0),e.segments[0].startDate=a,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)):!t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.startDate)?(i=this.parent.dateValidationModule.checkStartDate(a,e,null),i=this.parent.dateValidationModule.checkEndDate(i,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",i,e,!0)):(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(a,e,null),e,!0),t.isNullOrUndefined(e.duration)||this.parent.dateValidationModule.calculateEndDate(this.taskBarEditRecord))},i.prototype.updateSplitLeftResize=function(e){var i=e.segments[this.segmentIndex],r=0===this.segmentIndex?this.getRoundOffStartLeft(e,this.roundOffDuration):this.getRoundOffStartLeft(i,this.roundOffDuration),a=0===this.segmentIndex?this.getDateByLeft(r):this.getDateByLeft(e.left+r),n=this.parent.dataOperation.checkStartDate(a,e,!1),s=this.parent.dataOperation.getDuration(n,i.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);if(i.startDate=new Date(n.getTime()),i.duration=s,this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),0===this.segmentIndex&&this.parent.setRecordValue("startDate",i.startDate,e,!0),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration"),!t.isNullOrUndefined(e.segments[this.segmentIndex-1])){var o=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex-1].endDate,e.segments[this.segmentIndex].startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);i.offsetDuration=o}this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.updateSplitRightResizing=function(e){var i=e.segments[this.segmentIndex],r=this.getRoundOffEndLeft(e,this.roundOffDuration),a=this.getDateByLeft(r),n=this.parent.dataOperation.checkEndDate(a,e,!1),s=this.parent.dataOperation.getDuration(i.startDate,n,e.durationUnit,e.isAutoSchedule,e.isMilestone);if(i.endDate=new Date(n.getTime()),i.duration=s,!t.isNullOrUndefined(e.segments[this.segmentIndex+1])){var o=e.segments[this.segmentIndex+1],l=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,o.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);i.offsetDuration=l}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")},i.prototype.sumOfDuration=function(e){for(var t=0,i=0;i<e.length;i++){t+=e[i].duration}return t},i.prototype.setSplitTaskDrag=function(e){var i=e.segments[this.segmentIndex],r=this.getRoundOffStartLeft(i,this.roundOffDuration),a=this.getDateByLeft(e.left+r);if(a=this.parent.dateValidationModule.checkStartDate(a,e,null),i.startDate=a,i.endDate=this.parent.dataOperation.getEndDate(i.startDate,i.duration,e.durationUnit,e,!1),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),t.isNullOrUndefined(this.parent.taskFields.endDate)||this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"endDate"),!t.isNullOrUndefined(e.segments[this.segmentIndex-1])){var n=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!==n||this.parent.includeWeekend||(n=1),i.offsetDuration=n}if(!t.isNullOrUndefined(e.segments[this.segmentIndex+1])){var s=e.segments[this.segmentIndex+1];n=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,s.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);1!==s.startDate.getDay()||0!==n||this.parent.includeWeekend||(n=1),s.offsetDuration=n}this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.getRoundOffEndLeft=function(e,t){var i="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,r=e.width+e.left;if(-1!==this.segmentIndex){var a=e.segments[this.segmentIndex];r=r-e.width+a.width+a.left}var n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Day")/864e5),s=this.parent.perDayWidth-this.parent.perDayWidth/n,o=s/this.parent.perDayWidth;if(void 0===t&&(t=!1),t){if(t)if("Hour"===i){var l=this.parent.perDayWidth/24;n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Hour")/36e5),0!==(s=this.parent.perDayWidth/24-this.parent.perDayWidth/24/n)&&(r=r-s+l)}else if("Minutes"===i){var d=this.parent.perDayWidth/1440;n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Minutes")/6e4),0!==(s=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/n)&&(r=r-s+d)}else 0!==s&&(r=r-s+this.parent.perDayWidth)}else"Hour"!==i&&"Minutes"!==i&&(o>.5?r=r-s+this.parent.perDayWidth:o<.5&&(r=r-s+this.parent.perDayWidth/2));return r},i.prototype.getRoundOffStartLeft=function(e,i){var r=(t.isNullOrUndefined(e),e.left),a="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r,t.isNullOrUndefined(e)?e.isMilestone:null,e),1,"Day")/864e5),s=this.parent.perDayWidth-this.parent.perDayWidth/n,o=s/this.parent.perDayWidth;return void 0===i&&(i=!1),i?i&&("Hour"===a?(n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Hour")/36e5),r-=s=this.parent.perDayWidth/24-this.parent.perDayWidth/24/n):"Minutes"===a?(n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Minutes")/6e4),r-=s=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/n):r-=s):"Hour"!==a&&"Minutes"!==a&&(o<=.5?r-=s:o>.5&&(r=r-s+this.parent.perDayWidth/2)),r},i.prototype.getDateByLeft=function(e,i,r){var a=new Date(this.parent.timelineModule.timelineStartDate.toString()),n=864e5/this.parent.perDayWidth;a.setTime(a.getTime()+e*n),i&&!t.isNullOrUndefined(r.predecessor)&&r.predecessor.length>0&&(a.setDate(a.getDate()-1),this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,a),a=this.parent.dateValidationModule.checkStartDate(a,r,!0));var s="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier;return"Hour"!==s&&"Minutes"!==s&&(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},i.prototype.setItemPosition=function(){if(!t.isNullOrUndefined(this.editElement)){var e=this.editElement.parentElement;"ResourceView"==this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&"ChildDrag"===this.taskBarEditAction?e.style.position=null:e.style.setProperty("position","absolute")}var i=this.taskBarEditRecord.ganttProperties,r=this.parent.enableRtl?"right":"left",a=t.isNullOrUndefined(i.segments)?null:i.segments[this.segmentIndex],n="MilestoneDrag"===this.taskBarEditAction||i.isMilestone?this.parent.chartRowsModule.milestoneHeight:i.width,s=this.parent.isAdaptive?n-2:n-10;t.isNullOrUndefined(a)||(s=this.parent.isAdaptive?a.width-2:a.width-10),this.taskBarEditElement.style.setProperty("opacity",".75");var o=this.taskBarEditElement.classList.contains(H)?this.taskBarEditElement:"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||0!==this.segmentIndex?t.closest(this.taskBarEditElement,"tr."+Q).querySelector("."+H):this.taskBarEditElement.parentElement,l=this.taskBarEditElement.classList.contains("e-segmented-taskbar"),d=this.taskBarEditElement.querySelector("."+ne),h=this.taskBarEditElement.querySelector("."+ae),p=this.taskBarEditElement.querySelector("."+$),c=this.taskBarEditElement.querySelector("."+J),u=this.taskBarEditElement.querySelector("."+pe),g=this.taskBarEditElement.querySelector("."+ce),f=this.taskBarEditElement.querySelector("."+Ie),m=this.taskBarEditElement,y=this.taskBarEditElement.querySelector("."+oe),D=this.taskBarEditElement.querySelector("."+he),v=this.taskBarEditElement.querySelector(".e-gantt-manualparenttaskbar-left"),w=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");if("ConnectorPointRightDrag"!==this.taskBarEditAction&&"ConnectorPointLeftDrag"!==this.taskBarEditAction){if("ParentResizing"!==this.taskBarEditAction&&"ManualParentDrag"!==this.taskBarEditAction){if(!l||t.isNullOrUndefined(i.segments)||"RightResizing"!==this.taskBarEditAction&&0===this.segmentIndex||(t.isNullOrUndefined(w)||(w.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",t.isNullOrUndefined(w)||(w.style.left=a.left+this.editElement.parentElement.offsetLeft+"px"))),o.style.setProperty(r,i.left+"px"),o.style.width=n+"px","ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&("ChildDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction)&&(o.style.setProperty("top",this.topValue+"px"),o.style.zIndex="4"),"LeftResizing"===this.taskBarEditAction&&0===this.segmentIndex){this.taskBarEditElement.style.setProperty("opacity",".75");for(var k=this.taskBarEditElement.parentElement.getElementsByClassName("e-segmented-taskbar"),T=0;T<i.segments.length;T++){var b=i.segments[T],P=k[T];P.style.width=b.width+"px",0===T&&(w.style.width=b.width+"px",w.style.left=b.left+i.left+"px"),this.parent.enableRtl?P.style.right=b.left+"px":P.style.left=b.left+"px"}}"ChildDrag"===this.taskBarEditAction&&0===this.segmentIndex&&(w.style.width=n+"px",w.style.left=i.left+"px",o.style.setProperty("opacity",".75"))}if(f&&(this.parent.enableRtl?f.style.left=(this.parent.isAdaptive?n+10:n-2)+"px":f.style.left=(this.parent.isAdaptive?n+10:n+2)+"px"),"MilestoneDrag"===this.taskBarEditAction||i.isMilestone)o.style.setProperty(r,i.left-n/2+"px"),w.style.left=i.left-n/2+"px",w.style.width=n+"px";else if("ProgressResizing"===this.taskBarEditAction)if(-1===this.segmentIndex){if(h.style.setProperty(r,i.left+i.progressWidth-10+"px"),!t.isNullOrUndefined(d)){d.style.width=i.progressWidth+"px",d.style.borderBottomRightRadius=this.progressBorderRadius+"px",d.style.borderTopRightRadius=this.progressBorderRadius+"px";var S=this.parent.enableRtl?i.progressWidth+8:i.progressWidth-8;p.style.setProperty(r,S+"px")}}else{this.updateSegmentProgress(this.taskBarEditRecord.ganttProperties),d.style.width=i.segments[this.segmentIndex].progressWidth+"px",d.style.borderBottomRightRadius=this.progressBorderRadius+"px",d.style.borderTopRightRadius=this.progressBorderRadius+"px";var C=this.parent.enableRtl?i.segments[this.segmentIndex].progressWidth+8:i.segments[this.segmentIndex].progressWidth-8;p.style.setProperty(r,C+"px")}else"RightResizing"!==this.taskBarEditAction||t.isNullOrUndefined(h)?"ParentDrag"===this.taskBarEditAction?(w.style.left=i.left+"px",w.style.width=n+"px",w.style.width=i.width+"px",t.isNullOrUndefined(u)||(u.style.width=n+"px",w.style.width=i.width+"px"),t.isNullOrUndefined(d)||(g.style.width=i.progressWidth+"px")):"ParentResizing"===this.taskBarEditAction?(w.style.width=i.width+"px",w.style.left=i.left+"px",m.style.width=y.style.width=i.width+"px",D.style.setProperty(r,i.width-v.offsetLeft+"px")):"ManualParentDrag"===this.taskBarEditAction?(w.style.width=i.width+"px",w.style.left=i.left+"px",m.style.setProperty(r,i.left-i.autoLeft+"px")):(t.isNullOrUndefined(h)||l||(h.style.width=i.width+"px",h.style.left=i.left+"px",this.taskBarEditElement.style.width=i.width+"px",this.taskBarEditElement.style.left=i.left+"px",w.style.left=i.left+"px",w.style.width=i.width+"px"),t.isNullOrUndefined(d)||(c.style.setProperty(r,s+"px"),d.style.width=i.progressWidth+"px",t.isNullOrUndefined(p)||p.style.setProperty(r,i.progressWidth-10+"px")),l&&(c.style.setProperty(r,s+"px"),d.style.width=a.progressWidth+"px",t.isNullOrUndefined(p)||p.style.setProperty(r,a.progressWidth-10+"px"))):(w.style.width=n+"px",h.style.width=n+"px",t.isNullOrUndefined(d)||(d.style.width=i.progressWidth+"px",c.style.setProperty(r,s+"px"),t.isNullOrUndefined(p)||p.style.setProperty(r,i.progressWidth-10+"px")))}},i.prototype.mouseUpHandler=function(e){var i=this.isMouseDragged;if(this.previousMouseMove=null,this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),this.taskBarEditAction&&this.isMouseDragged)if(!this.dragMouseLeave&&this.taskBarEditedAction||"ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop)this.taskBarEditedAction(e),this.isMouseDragged=!1;else if(this.parent.isOnEdit=!1,this.cancelTaskbarEditActionInMouseLeave(),this.parent.enableCriticalPath&&this.parent.criticalPathModule){var r=this.parent.criticalPathModule;r.criticalConnectorLine(r.criticalPathCollection,r.detailPredecessorCollection,!0,r.predecessorCollectionTaskIds)}"ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar&&!t.isNullOrUndefined(this.taskBarEditElement)&&(t.isNullOrUndefined(this.taskBarEditElement.querySelector(".e-gantt-child-taskbar"))||this.taskBarEditElement.querySelector(".e-gantt-child-taskbar").classList.contains("e-collapsed-taskbar-drag")&&(t.removeClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"),this.taskBarEditElement.style.zIndex=this.prevZIndex,this.prevZIndex="")),this.parent.isAdaptive&&!i||this.initPublicProp(),this.stopScrollTimer()},i.prototype.taskBarEditedAction=function(e){var t={},i=this.mouseDownX,r=this.mouseDownY,a=this.taskBarEditRecord,n=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement),s=this.mouseMoveX,o=this.getCoordinate(e).pageY-this.parent.ganttChartModule.chartBodyContainer.offsetTop;"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)?(this.parent.connectorLineEditModule.updatePredecessor(this.connectorSecondRecord,this.finalPredecessor),this.parent.UpdateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule.calculateOffset(this.connectorSecondRecord)):(i!==s||Math.abs(r-o)>=(this.parent.rowHeight-this.parent.taskbarHeight)/2)&&null!==a&&(t.editingFields=a.ganttProperties,t.data=a,t.recordIndex=n,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))},i.prototype.cancelTaskbarEditActionInMouseLeave=function(){this.parent.editModule.reUpdatePreviousRecords(!0)},i.prototype.updateSegmentProgress=function(e){for(var t=e.segments,i=!0,r=this.splitTasksDuration(t)*this.parent.perDayWidth,a=this.parent.dataOperation.getProgressWidth(r,e.progress),n=0;n<t.length;n++){var s=t[n];delete s.progressWidth,a>0&&a>s.width?(a-=s.width,s.progressWidth=s.width,s.showProgress=!1):i&&(s.progressWidth=a,s.showProgress=!0,a-=s.width,i=!1)}},i.prototype.taskbarEdited=function(e){var i=t.extend({},e),r=i.data,a=r.ganttProperties,n=this.parent.currentViewData.indexOf(r);if(("MilestoneDrag"===i.taskBarEditAction||"ChildDrag"===i.taskBarEditAction)&&"ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&this.dragMoveY>0){if(this.parent.rowDragAndDropModule){var s=this.parent.currentViewData;s[this.taskBarEditRecord.parentItem.index]&&-1===this.parent.editedRecords.indexOf(s[this.taskBarEditRecord.parentItem.index])&&this.parent.editedRecords.push(s[this.taskBarEditRecord.parentItem.index]);for(var o,l=0,d=0,h=void 0,p=this.parent.treeGrid.getRows().length,c=0;c<p;c++)l<this.dragMoveY&&"none"!==this.parent.getRowByIndex(c).style.display&&(d=c,l+=parseInt(this.parent.getRowByIndex(c).style.height),s[c].parentItem?this.parent.getRecordByID(s[c].parentItem.taskId):s[c]);for(var u=this.parent.getRowByIndex(n).getElementsByClassName("e-taskbar-main-container"),g=this.parent.getRowByIndex(d).getElementsByClassName("e-taskbar-main-container"),f=0;f<g.length;f++)g[f].offsetTop<this.dragMoveY&&u[0].getAttribute("rowuniqueid")!==g[f].getAttribute("rowuniqueid")&&(this.draggedRecordMarginTop=g[f].style.marginTop,o=g[f].getAttribute("rowuniqueid"));if(o&&(h=this.parent.currentViewData.filter(function(e){return e.rowUniqueID===o?e:null})),h){var m=this.parent.currentViewData.indexOf(h[0]),y=h[0].hasChildRecords||!h[0].parentItem&&0==h[0].childRecords.length?"child":"below";this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.reorderRows([n],m,y),this.dragMoveY=0}}"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&this.parent.ganttChartModule.renderOverAllocationContainer()}if("ProgressResizing"===i.taskBarEditAction)i.previousData.progress!==a.progress&&(this.parent.setRecordValue("progress",this.getProgressPercent(a.width,a.progressWidth),a,!0),r.parentItem&&this.parent.editModule.updateParentProgress(r.parentItem),t.isNullOrUndefined(a.segments)||this.updateSegmentProgress(a));else{var D=i.data.ganttProperties.segments;if(!t.isNullOrUndefined(D)&&D.length>0&&("LeftResizing"===this.taskBarEditAction&&0!==this.segmentIndex||"ChildDrag"===this.taskBarEditAction&&0!==this.segmentIndex||"RightResizing"===this.taskBarEditAction)){var v=D[this.segmentIndex],w=this.taskBarEditRecord.ganttProperties,k=0===this.segmentIndex?null:D[this.segmentIndex-1],T=this.segmentIndex===D.length-1?null:D[this.segmentIndex+1],b=t.isNullOrUndefined(T)?this.parent.cloneProjectEndDate:new Date(T.startDate.getTime()),P=t.isNullOrUndefined(k)?this.parent.cloneProjectStartDate:new Date(k.endDate.getTime()),S=new Date(v.startDate.getTime()),C=new Date(v.endDate.getTime());if("Day"===this.parent.timelineModule.topTier&&"Hour"===this.parent.timelineModule.bottomTier?(S.setHours(S.getHours()-1),C.setHours(C.getHours()+1)):(b.setHours(0,0,0,0),P.setHours(0,0,0,0),S.setDate(S.getDate()-1),C.setDate(C.getDate()+1),S.setHours(0,0,0,0),C.setHours(0,0,0,0)),S.getTime()<=P.getTime()&&!t.isNullOrUndefined(k)&&!t.isNullOrUndefined(v)){var M=[{firstSegmentIndex:k.segmentIndex,secondSegmentIndex:v.segmentIndex}];this.parent.chartRowsModule.mergeTask(w.taskId,M)}else if(C.getTime()>=b.getTime()&&this.segmentIndex!==D.length-1){M=[{firstSegmentIndex:v.segmentIndex,secondSegmentIndex:T.segmentIndex}];this.parent.chartRowsModule.mergeTask(w.taskId,M)}else if(C.getTime()>=b.getTime()){v.endDate.setDate(this.parent.cloneProjectEndDate.getDate()-1),v.startDate=this.parent.dataOperation.getStartDate(v.endDate,v.duration,w.durationUnit,w);for(c=D.length-2;c>=0;c++){var R=D[c],O=R.endDate;O.setDate(O.getDate()-R.offsetDuration),R.endDate=O,R.startDate=this.parent.dataOperation.getStartDate(R.endDate,R.duration,w.durationUnit,w)}}}this.parent.dataOperation.updateWidthLeft(i.data)}this.parent.dataOperation.updateTaskData(r),this.parent.editModule.initiateUpdateAction(i)},i.prototype.getProgressPercent=function(e,t){return Math.ceil(t/e*100)},i.prototype.drawFalseLine=function(){var e,i=this.mouseDownX,r=this.mouseDownY,a=this.mouseMoveX,n=this.mouseMoveY,s=Math.sqrt((i-a)*(i-a)+(r-n)*(r-n)),o=180*Math.atan2(n-r,a-i)/Math.PI,l="rotate("+(this.parent.enableRtl?-o:o)+"deg)",d=0;t.isNullOrUndefined(document.querySelectorAll(".e-chart-row")[0])||(d=document.querySelectorAll(".e-chart-row")[0].offsetWidth),"ConnectorPointLeftDrag"===this.taskBarEditAction&&(e=this.parent.enableRtl?d-(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?d-(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));var h=this.elementOffsetTop+this.elementOffsetHeight/2+this.parent.ganttChartModule.chartBodyContainer.offsetTop-this.parent.ganttChartModule.scrollObject.previousScroll.top;this.removeFalseLine(!1),this.falseLine=t.createElement("div",{className:"e-gantt-false-line",id:"ganttfalseline"+this.parent.element.id,styles:"position: absolute;transform:"+l+";border-top-width: 1px;border-top-style: dashed;z-index: 5;width:"+(s-3)+"px;top:"+h+"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)},i.prototype.removeFalseLine=function(e){this.falseLine&&(t.remove(this.falseLine),this.falseLine=null,e&&(this.elementOffsetLeft=0,this.elementOffsetTop=0,this.elementOffsetWidth=0,this.elementOffsetHeight=0,t.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+ke),[Ce])))},i.prototype.updateConnectorLineSecondProperties=function(e){var i=this.getElementByPosition(e),r=f(i,H);this.connectorSecondAction=null;var a=0;if(f(i,Me)?(this.connectorSecondAction="ConnectorPointLeftDrag",this.toPredecessorText="Start"):f(i,Re)?(this.connectorSecondAction="ConnectorPointRightDrag",this.toPredecessorText="Finish"):(this.connectorSecondAction=null,this.toPredecessorText=null),this.taskBarEditElement!==r&&this.taskBarEditElement!==this.highlightedSecondElement){if(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,this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3-5+this.taskBarEditElement.children[0].offsetTop+a):(this.elementOffsetLeft=this.realTaskbarElement.offsetLeft,this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3+a),this.elementOffsetWidth=this.realTaskbarElement.offsetWidth,this.elementOffsetHeight=this.realTaskbarElement.offsetHeight),this.showHideTaskBarEditingElements(r,this.highlightedSecondElement,!0)}t.isNullOrUndefined(this.connectorSecondAction)&&!t.isNullOrUndefined(this.connectorSecondElement)&&(!this.connectorSecondRecord.hasChildRecords||this.connectorSecondRecord.hasChildRecords&&this.parent.allowParentDependency)&&(this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),t.removeClass([this.connectorSecondElement.querySelector("."+Me)],[Ee]),t.removeClass([this.connectorSecondElement.querySelector("."+Re)],[Ee])),this.connectorSecondElement=this.connectorSecondAction?r:null,this.highlightedSecondElement=r,this.connectorSecondRecord=t.isNullOrUndefined(this.connectorSecondElement)?null:this.parent.ganttChartModule.getRecordByTaskBar(this.connectorSecondElement)},i.prototype.triggerDependencyEvent=function(e,i){var r,a,n=this.taskBarEditRecord.ganttProperties,s=this.connectorSecondRecord?this.connectorSecondRecord.ganttProperties:null,o=this.getElementByPosition(e),l=o,d="ResourceView"===this.parent.viewType?n.taskId:n.rowUniqueID;if("ConnectorPointLeftDrag"===this.taskBarEditAction?r=d+(this.parent.enableRtl?"F":"S"):"ConnectorPointRightDrag"===this.taskBarEditAction&&(r=d+(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")),t.isNullOrUndefined(s))this.drawPredecessor=!1;else{s.predecessorsName?this.finalPredecessor=s.predecessorsName+","+r:this.finalPredecessor=r;var h=this.parent.connectorLineEditModule.validatePredecessorRelation(this.connectorSecondRecord,this.finalPredecessor),p=this.parent.predecessorModule.calculatePredecessor(r,this.connectorSecondRecord),c={};if(c.fromItem=n,c.toItem=s,c.newPredecessorString=this.finalPredecessor,c.predecessor=p&&p[0],c.isValidLink=h,c.requestType="ValidateDependency",this.parent.trigger("actionBegin",c),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType||"ValidateDependency"==c.requestType?"ValidateDependency"!=c.requestType&&this.parent.showSpinner():this.parent.showMaskRow(),c.isValidLink=!(!h&&c.isValidLink)&&c.isValidLink,c.isValidLink){if(this.editTooltip.toolTipObj||this.parent.isAdaptive||this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),this.editTooltip.toolTipObj){this.parent.connectorLineModule.tooltipTable.innerHTML=this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"","");var u=this.parent.connectorLineModule.tooltipTable.querySelector("#toPredecessor").querySelectorAll("td");u[1].innerText=s.taskName,u[2].innerText=this.parent.localeObj.getConstant(a);var g=this.parent.connectorLineModule.tooltipTable.parentElement.parentElement;g.offsetTop+g.offsetHeight>e.pageY&&(g.style.top=e.pageY-g.offsetHeight-20+"px")}this.drawPredecessor=!0}else this.parent.isAdaptive?(o.classList.contains(Me)||o.classList.contains(Re))&&this.showHideActivePredecessors(!0):t.addClass([l],[Ee]),this.drawPredecessor=!1}},i.prototype.getCoordinate=function(e){var t={};if(this.parent.isAdaptive&&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)}else if(e){var i=e;t.pageX=i.pageX,t.pageY=i.pageY}return t},i.prototype.getElementByPosition=function(e){if(this.parent.isAdaptive){var t=this.getCoordinate(e);return document.elementFromPoint(t.pageX-window.pageXOffset,t.pageY-window.pageYOffset)}return e.target},i.prototype.multipleSelectionEnabled=function(){this.parent.selectionModule&&"Cell"!==this.parent.selectionSettings.mode&&"Multiple"===this.parent.selectionSettings.type&&this.parent.selectionModule.hidePopUp()},i.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))},i.prototype.destroy=function(){this.unWireEvents(),this.stopScrollTimer(),this.parent.editModule.taskbarEditModule=void 0},i}(R),si=function(){function e(e){this.updatedEditFields=null,this.updatedAddFields=null,this.addedRecord=null,this.dialogEditValidationFlag=!1,this.ganttResources=[],this.isValidData=!0,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:p.CheckBox,dropdownedit:u.DropDownList,datepickeredit:c.DatePicker,datetimepickeredit:c.DateTimePicker,maskededit:h.MaskedTextBox,numericedit:h.NumericTextBox,stringedit:h.TextBox,defaultedit:h.TextBox},this.processDialogFields(),this.wireEvents()}return e.prototype.wireEvents=function(){this.parent.on("chartDblClick",this.dblClickHandler,this)},e.prototype.dblClickHandler=function(e){var i=this.parent.ganttChartModule.getRecordByTarget(e);!t.isNullOrUndefined(i)&&this.parent.editModule&&this.parent.editSettings.allowEditing&&this.openEditDialog(i)},e.prototype.processDialogFields=function(){t.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),t.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)},e.prototype.validateDialogFields=function(e){for(var i=[],a=0,n=0;n<e.length;n++){var s=r.getActualProperties(e[n]);"General"!==s.type||!t.isNullOrUndefined(s.fields)&&0!==s.fields.length||(s.fields=this.getGeneralColumnFields()),"Dependency"===s.type&&t.isNullOrUndefined(this.parent.taskFields.dependency)||"Resources"===s.type&&t.isNullOrUndefined(this.parent.taskFields.resourceInfo)||"Notes"===s.type&&t.isNullOrUndefined(this.parent.taskFields.notes)||("Custom"!==s.type||!t.isNullOrUndefined(s.fields)&&0!==s.fields.length||(a+=1,s.fields=this.getCustomColumnFields()),a>1||i.push(s))}return i},e.prototype.getGeneralColumnFields=function(){for(var e=[],t=0,i=Object.keys(this.parent.columnMapping);t<i.length;t++){var r=i[t];"dependency"!==r&&"resourceInfo"!==r&&"notes"!==r&&e.push(this.parent.columnMapping[r])}return e},e.prototype.getCustomColumnFields=function(){for(var e=[],t=0;t<this.parent.customColumns.length;t++)e.push(this.parent.customColumns[t]);return e},e.prototype.getDefaultDialogFields=function(){var e=[],i={},r=this.parent.taskFields,a=this.parent.columnMapping;return 0!==Object.keys(a).length&&(i.type="General",e.push(i)),t.isNullOrUndefined(t.getValue("dependency",a))||(i={},!1!==this.parent.columnByField[a.dependency.valueOf()].visible&&(i.type="Dependency"),e.push(i)),t.isNullOrUndefined(t.getValue("resourceInfo",a))||(i={},!1!==this.parent.columnByField[a.resourceInfo.valueOf()].visible&&(i.type="Resources"),e.push(i)),t.isNullOrUndefined(t.getValue("notes",a))||(i={},!1!==this.parent.columnByField[a.notes.valueOf()].visible&&(i.type="Notes"),e.push(i)),t.isNullOrUndefined(t.getValue("segments",r))||((i={}).type="Segments",e.push(i)),this.parent.customColumns.length>0&&((i={}).type="Custom",e.push(i)),e},e.prototype.openAddDialog=function(){this.isEdit=!1,this.editedRecord=this.composeAddRecord(),this.createDialog()},e.prototype.getMinimumStartDate=function(){var e=a.DataUtil.aggregates.min(this.parent.flatData,"ganttProperties.startDate");return e=t.isNullOrUndefined(e)?new Date(this.parent.timelineModule.timelineStartDate.getTime()):new Date(e.getTime()),e=this.parent.dateValidationModule.checkStartDate(e),new Date(e.getTime())},e.prototype.composeAddRecord=function(){var e={};e.ganttProperties={};for(var i=this.parent.ganttColumns,r=this.parent.taskFields,a=this.parent.editModule.getNewTaskId(),n=0;n<i.length;n++){var s=i[n].field;s===r.id?(e[s]=a,e.ganttProperties.rowUniqueID=e[s]):i[n].field===r.startDate?(t.isNullOrUndefined(e[r.endDate])?e[s]=this.getMinimumStartDate():e[s]=new Date(e[r.endDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone)),e.ganttProperties.startDate=new Date(e[s])):i[n].field===r.endDate?(t.isNullOrUndefined(e[r.startDate])?e[s]=this.getMinimumStartDate():e[s]=new Date(e[r.startDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone)),e.ganttProperties.endDate=new Date(e[s])):i[n].field===r.duration?(e[s]=1,e.ganttProperties.duration=e[s],e.ganttProperties.durationUnit=this.parent.durationUnit.toLocaleLowerCase()):i[n].field===r.name?(e[s]=this.localeObj.getConstant("addDialogTitle")+" "+a,e.ganttProperties.taskName=e[s]):i[n].field===r.progress?(e[s]=0,e.ganttProperties.progress=e[s]):i[n].field===r.work?(e[s]=0,e.ganttProperties.work=e[s]):i[n].field===r.type?(e[s]=this.parent.taskType,e.ganttProperties.taskType=e[s]):e[this.parent.ganttColumns[n].field]=""}return e.ganttProperties.isAutoSchedule="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[r.manual],e},e.prototype.openToolbarEditDialog=function(){var e=this.parent;if(e.editModule&&e.editSettings.allowEditing){this.parent.ganttChartModule.focusedRowIndex>-1&&e.selectionModule&&e.selectionModule.selectRow(this.parent.ganttChartModule.focusedRowIndex,!1,!1);var i=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;t.isNullOrUndefined(i)||this.openEditDialog(i)}},e.prototype.openEditDialog=function(e){var i=this.parent;t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.ganttProperties)||("string"==typeof e.ganttProperties.taskId?this.numericOrString="stringedit":this.numericOrString="numericedit"),t.isNullOrUndefined(e.ganttProperties)&&!t.isNullOrUndefined(e)&&(isNaN(Number(e))||"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?this.numericOrString="stringedit":this.numericOrString="numericedit")),"object"!=typeof e||t.isNullOrUndefined(e)?t.isNullOrUndefined(e)?i.selectedRowIndex>-1&&(this.rowData=i.currentViewData[i.selectedRowIndex],this.rowIndex=i.selectedRowIndex):(this.rowIndex=i.ids.indexOf(e.toString()),this.rowIndex>-1&&(this.rowData=i.flatData[this.rowIndex])):(this.rowIndex=this.parent.currentViewData.indexOf(e),this.rowIndex>-1&&(this.rowData=e)),this.isEdit=!0,"ResourceView"===this.parent.viewType&&0===this.rowData.level||0!==Object.keys(this.rowData).length&&(this.editedRecord=t.extend({},{},this.rowData,!0),this.createDialog())},e.prototype.createDialog=function(){var e=this,i=this.parent,r={};this.beforeOpenArgs.dialogModel=r,this.beforeOpenArgs.rowData=this.editedRecord,this.beforeOpenArgs.rowIndex=this.rowIndex;var a=this.parent.isAdaptive?"":"600px",n=this.parent.createElement("div",{id:i.element.id+"_dialog",styles:"max-width:"+a});n.classList.add("e-gantt-dialog"),i.element.appendChild(n),r.animationSettings={effect:"None"},r.header=this.localeObj.getConstant(this.isEdit?"editDialogTitle":"addDialogTitle"),r.isModal=!0,r.enableRtl=this.parent.enableRtl,r.allowDragging=!this.parent.isAdaptive,r.showCloseIcon=!0;var s=this.parent.isAdaptive?{X:"top",Y:"left"}:{X:"center",Y:"center"};r.position=s,r.height=this.parent.isAdaptive?"100%":"auto",r.target=document.body,r.close=this.dialogClose.bind(this),r.closeOnEscape=!0,r.beforeClose=function(e){"escape"===e.closedBy&&"key-pressed"===e.event.name&&"INPUT"===e.event.target.nodeName&&(e.cancel=!0)},r.open=function(i){var r=t.getValue("element",i),a=r.querySelector("#"+e.parent.element.id+"GeneralTabContainer");a&&a.scrollHeight>a.offsetHeight&&a.classList.add("e-scroll"),0===e.tabObj.selectedItem&&e.tabObj.select(0),e.parent.isAdaptive&&(r.style.maxHeight="none"),e.parent.focusModule&&e.parent.focusModule.setActiveElement(r)},r.locale=this.parent.locale,r.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(r,n)},e.prototype.buttonClick=function(e){var t=e.target;t.style.pointerEvents="none",this.localeObj.getConstant("cancel").toLowerCase()===e.target.innerText.trim().toLowerCase()?this.dialog&&!this.dialogObj.isDestroyed&&(this.dialogObj.hide(),this.dialogClose()):(this.initiateDialogSave(),t.style.pointerEvents="auto")},e.prototype.dialogClose=function(){this.dialog&&this.resetValues(),t.isNullOrUndefined(this.parent.focusModule)||t.isNullOrUndefined(this.parent.focusModule.getActiveElement(!0))||this.parent.focusModule.getActiveElement(!0).focus()},e.prototype.resetValues=function(){this.isEdit=!1,this.isAddNewResource=!1,this.editedRecord={},this.rowData={},this.rowIndex=-1,this.addedRecord=null,this.ganttResources=[],this.dialogEditValidationFlag=!1,this.dialog&&!this.dialogObj.isDestroyed&&(this.destroyDialogInnerElements(),this.dialogObj.destroy(),t.remove(this.dialog))},e.prototype.destroyDialogInnerElements=function(){for(var e=this.parent,i=this.beforeOpenArgs.tabModel.items,r=0;r<i.length;r++){var a=i[r].content,n=a.id;if(!t.isNullOrUndefined(n)||""!==n)if(n=n.replace(e.element.id,""),"General"===(n=n.replace("TabContainer","")))this.destroyCustomField(a);else if("Dependency"===n){a.ej2_instances[0].destroy()}else if("Notes"===n){a.ej2_instances[0].destroy()}else if("Resources"===n){a.ej2_instances[0].destroy()}else-1!==n.indexOf("Custom")&&this.destroyCustomField(a)}},e.prototype.destroyCustomField=function(e){for(var i=e.childNodes,a=this.parent,n=0;n<i.length;n++){var s=i[n],o=s.querySelector('input[id^="'+a.element.id+'"]');if(o){var l=o.id.replace(a.element.id,""),d=s.querySelector("#"+a.element.id+l).ej2_instances[0];if(!t.isNullOrUndefined(d)){var h=a.columnByField[l];if(!t.isNullOrUndefined(h.edit)&&t.isNullOrUndefined(h.edit.params)){var p=h.edit.destroy;"string"==typeof p?(p=r.getObject(p,window))():h.edit.destroy()}else d.destroy()}}}},e.prototype.destroy=function(){this.resetValues(),this.parent.isDestroyed||(this.parent.off("chartDblClick",this.dblClickHandler),this.parent.editModule.dialogModule=void 0)},e.prototype.getEditFields=function(){return this.isEdit?this.updatedEditFields:this.updatedAddFields},e.prototype.createTab=function(e,r){var a,n=this,s=this.parent,o={},d=[],h=this.getEditFields(),p=s.taskFields,c=h.length;o.items=d,o.locale=this.parent.locale,o.enableRtl=this.parent.enableRtl,this.beforeOpenArgs.tabModel=o;var u=0;if(c>0)for(var g=0;g<c;g++){var f=h[g],m={};if("General"===f.type){if(0===Object.keys(s.columnMapping).length)continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("generalTab")),m.content="General",this.beforeOpenArgs[m.content]=this.getFieldsModel(f.fields)}else if("Segments"===f.type){if(t.isNullOrUndefined(p.segments))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("segments")),m.content="Segments",this.beforeOpenArgs[m.content]=this.getSegmentsModel(f.fields)}else if("Dependency"===f.type){if(t.isNullOrUndefined(p.dependency))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("dependency")),m.content="Dependency",this.beforeOpenArgs[m.content]=this.getPredecessorModel(f.fields)}else if("Resources"===f.type){if(t.isNullOrUndefined(p.resourceInfo))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("resourceName")),m.content="Resources",this.beforeOpenArgs[m.content]=this.getResourcesModel(f.fields)}else if("Notes"===f.type){if(t.isNullOrUndefined(p.notes))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("notes")),m.content="Notes",this.beforeOpenArgs[m.content]=this.getNotesModel(f.fields)}else{if(t.isNullOrUndefined(f.fields)||0===f.fields.length)continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("customTab")),m.content="Custom"+u++,this.beforeOpenArgs[m.content]=this.getFieldsModel(f.fields)}m.header={text:f.headerText},d.push(m)}this.beforeOpenArgs.requestType=this.isEdit?"beforeOpenEditDialog":"beforeOpenAddDialog";this.beforeOpenArgs.rowData,this.beforeOpenArgs.name,this.beforeOpenArgs.requestType,this.beforeOpenArgs.cancel;this.parent.trigger("actionBegin",this.beforeOpenArgs,function(d){if(t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.showSpinner():n.parent.showMaskRow(),n.renderTabItems(),!d.cancel){o.selected=n.tabSelectedEvent.bind(n),o.height=n.parent.isAdaptive?"100%":"auto",o.overflowMode="Scrollable",n.tabObj=new l.Tab(o),n.tabObj.isStringTemplate=!0,a=n.parent.createElement("div",{id:s.element.id+"_Tab"}),n.tabObj.appendTo(a),e.content=a,n.dialog=r,n.dialogObj=new i.Dialog(e),n.dialogObj.isStringTemplate=!0,n.dialogObj.appendTo(n.dialog);var h={action:"OpenDialog",requestType:n.isEdit?"openEditDialog":"openAddDialog",data:n.beforeOpenArgs.rowData,element:n.dialog,cancel:!1};n.parent.trigger("actionComplete",h,function(e){t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.hideSpinner():n.parent.hideMaskRow(),e.cancel&&n.resetValues()})}})},e.prototype.tabSelectedEvent=function(e){var i=this.parent,r=e.selectedContent.childNodes[0].id;if(this.parent.isAdaptive&&this.responsiveTabContent(r,i),r===i.element.id+"ResourcesTabContainer")this.resourceSelection(r);else if(r===i.element.id+"NotesTabContainer"){document.getElementById(r).ej2_instances[0].refresh();document.querySelector("#"+this.parent.element.id+"NotesTabContainer").style.overflow="scroll"}else r===i.element.id+"SegmentsTabContainer"&&(t.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)?document.getElementById(r).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!1):document.getElementById(r).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!0))},e.prototype.responsiveTabContent=function(e,t){var i=document.getElementById(t.element.id+"_dialog_dialog-content"),r=i.clientHeight;r-=i.querySelector(".e-tab-header").offsetHeight;var a=document.querySelector("#"+e);if(a.classList.contains("e-grid")){r-=a.ej2_instances[0].getHeaderContent().offsetHeight;var n=a.querySelector(".e-toolbar");n&&(r-=n.offsetHeight)}a.parentElement.style.height=r+"px"},e.prototype.getFieldsModel=function(e){for(var i={},r=this.parent.columnByField,a=0;a<e.length;a++)if(e[a]!==this.parent.taskFields.dependency&&e[a]!==this.parent.taskFields.resourceInfo&&e[a]!==this.parent.taskFields.notes&&!t.isNullOrUndefined(r[e[a]])){var n=e[a];this.createInputModel(r[n],i)}return i},e.prototype.createInputModel=function(e,i){var r=this,a=this.parent,n=this.parent.locale,s=this.parent.taskFields,o={placeholder:e.headerText,floatLabelType:"Auto"};switch(t.isNullOrUndefined(this.parent.taskFields.id)||t.isNullOrUndefined(this.parent.columnMapping.id)||t.isNullOrUndefined(this.numericOrString)||s.id===e.field&&(e.editType=this.numericOrString),e.editType){case"booleanedit":var l={label:e.headerText,locale:n,enableRtl:this.parent.enableRtl};i[e.field]=l;break;case"defaultedit":case"stringedit":var d=o;d.enableRtl=this.parent.enableRtl,e.field!==a.columnMapping.duration&&e.field!==a.columnMapping.id&&e.field!==a.columnMapping.startDate&&e.field!==a.columnMapping.endDate||(d.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=o;break;case"numericedit":var h=o;h.enableRtl=this.parent.enableRtl,s.progress===e.field&&(h.min=0,h.max=100),s.work===e.field&&(h.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=h;break;case"datepickeredit":var p=o;p.format=this.parent.getDateFormat(),p.enableRtl=this.parent.enableRtl,p.strictMode=!0,p.firstDayOfWeek=a.timelineModule.customTimelineSettings.weekStartDay,e.field!==a.columnMapping.startDate&&e.field!==a.columnMapping.endDate||(p.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent),p.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=p;break;case"datetimepickeredit":var c=o;c.format=this.parent.getDateFormat(),c.enableRtl=this.parent.enableRtl,c.strictMode=!0,c.firstDayOfWeek=a.timelineModule.customTimelineSettings.weekStartDay,e.field!==a.columnMapping.startDate&&e.field!==a.columnMapping.endDate||(c.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent),c.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=c;break;case"dropdownedit":if(e.field===a.columnMapping.type||e.field===a.columnMapping.manual){o.dataSource=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}],o.fields={value:"Value"};var u=o;u.enableRtl=this.parent.enableRtl,u.change=function(t){e.field===s.manual&&(r.editedRecord.ganttProperties.isAutoSchedule=!t.value),r.validateScheduleFields(t,e,a)}}i[e.field]=o;break;case"maskededit":i[e.field]=o}return t.isNullOrUndefined(e.edit)||t.isNullOrUndefined(e.edit.params)||t.extend(i[e.field],e.edit.params),i},e.prototype.validateScheduleFields=function(e,i,r){var a,n;t.isNullOrUndefined(r.editModule.dialogModule.dialog)||(n=r.editModule.dialogModule.dialog);var s,o=null,l=r.editModule.dialogModule.editedRecord,d=null,p=null,c="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,u=this.parent.viewType;if(t.isNullOrUndefined(e.element)?t.isNullOrUndefined(e.container)?t.isNullOrUndefined(e.event)||t.isNullOrUndefined(e.event.path)||t.isNullOrUndefined(e.event.path)[1]||(o=(s=e.event.path[1]).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):(o=(s=e.container).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):o=(s=e.element).getAttribute("id"),t.isNullOrUndefined(s))d=e.value,p=i.field;else if(d=s.value,p=o.replace(r.element.id,""),"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType){var g={rules:(a={},a[this.parent.taskFields.id]={required:!0,minLength:[function(e){return"ResourceView"===u?-1===c.indexOf("T"+e.value)&&-1===c.indexOf("R"+e.value):-1===c.indexOf(e.value)},"ID is already present, please enter new value"]},a)};new h.FormValidator("#"+this.parent.element.id+"GeneralTabContainer",g)}if(0===p.search("Segments"))return p=p.replace("SegmentsTabContainer",""),this.validateSegmentFields(r,p,d,e),!0;this.validateScheduleValuesByCurrentField(p,d,this.editedRecord);var f=l.ganttProperties,m=r.taskFields;return t.isNullOrUndefined(m.startDate)||m.startDate===p||this.updateScheduleFields(n,f,"startDate"),m.endDate===p&&!t.isNullOrUndefined(f.startDate)&&!t.isNullOrUndefined(e.value)&&f.startDate.getTime()>e.value&&this.updateScheduleFields(n,f,"endDate"),t.isNullOrUndefined(m.endDate)||m.endDate===p||this.updateScheduleFields(n,f,"endDate"),t.isNullOrUndefined(m.duration)||m.duration===p||this.updateScheduleFields(n,f,"duration"),t.isNullOrUndefined(m.work)||m.work===p||this.updateScheduleFields(n,f,"work"),this.dialogEditValidationFlag=!1,!0},e.prototype.updateScheduleFields=function(e,i,r){var a,n=this.parent,s=n.element.id,o=t.getValue(r,n.columnMapping),l=n.columnByField[o],d=this.parent.taskFields;if("stringedit"===l.editType){var h=e.querySelector("#"+s+o).ej2_instances[0];a=t.isNullOrUndefined(l.edit)||t.isNullOrUndefined(l.edit.read)?t.isNullOrUndefined(l.valueAccessor)?this.parent.dataOperation.getDurationString(i.duration,i.durationUnit):l.valueAccessor(o,n.editModule.dialogModule.editedRecord,l):l.edit.read(),h.value!==a.toString()&&d.duration===o?(h.value=a,h.dataBind()):d.startDate!==o&&d.endDate!==o||(h.value=d.startDate===o?i.startDate.toString():i.endDate.toString(),h.dataBind())}else if("datepickeredit"===l.editType||"datetimepickeredit"===l.editType){var p=(l.editType,e.querySelector("#"+s+o).ej2_instances[0]);a=i[r],(t.isNullOrUndefined(p.value)&&!t.isNullOrUndefined(a)||t.isNullOrUndefined(a)&&!t.isNullOrUndefined(p.value)||p.value!==a&&!t.isNullOrUndefined(p.value)&&!t.isNullOrUndefined(a)&&p.value.toString()!==a.toString())&&(p.value=a,p.dataBind())}else if("numericedit"===l.editType){var c=e.querySelector("#"+s+o).ej2_instances[0];a=i[r],t.isNullOrUndefined(a)||c.value===a||(c.value=a,c.dataBind())}},e.prototype.validateDuration=function(e){var i=e.ganttProperties;if(!this.dialogEditValidationFlag){t.isNullOrUndefined(i.duration)?(this.parent.setRecordValue("endDate",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0)):m(i)||!t.isNullOrUndefined(i.startDate)?(e.ganttProperties.isMilestone&&0!==e.ganttProperties.duration&&this.parent.dateValidationModule.checkStartDate(i.startDate),this.parent.dateValidationModule.calculateEndDate(e)):m(i)||t.isNullOrUndefined(i.endDate)||this.parent.dateValidationModule.calculateStartDate(e);var r=0===i.duration;this.parent.setRecordValue("isMilestone",r,i,!0),this.dialogEditValidationFlag=!0}},e.prototype.validateStartDate=function(e){var i=e.ganttProperties,r=this.parent.taskFields;this.dialogEditValidationFlag||(t.isNullOrUndefined(i.startDate)?(this.parent.setRecordValue("duration",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0),this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(r.endDate)&&this.parent.setRecordValue("endDate",null,i,!0)):m(i)?t.isNullOrUndefined(r.duration)?this.parent.dateValidationModule.calculateDuration(e):(t.isNullOrUndefined(r.endDate),this.parent.dateValidationModule.calculateEndDate(e)):t.isNullOrUndefined(i.endDate)?t.isNullOrUndefined(i.duration)||this.parent.dateValidationModule.calculateEndDate(e):this.parent.dateValidationModule.calculateDuration(e),this.dialogEditValidationFlag=!0)},e.prototype.validateEndDate=function(e){var i=e.ganttProperties,r=this.parent.taskFields;this.dialogEditValidationFlag||(t.isNullOrUndefined(i.endDate)?(this.parent.setRecordValue("duration",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0)):m(i)?t.isNullOrUndefined(r.duration)?this.parent.dateValidationModule.calculateDuration(e):t.isNullOrUndefined(i.startDate)?this.parent.dateValidationModule.calculateStartDate(e):(!t.isNullOrUndefined(i.segments)&&i.segments.length>0&&(i.segments=this.parent.editModule.cellEditModule.validateEndDateWithSegments(i)),this.parent.dateValidationModule.calculateDuration(e)):t.isNullOrUndefined(i.duration)?t.isNullOrUndefined(i.startDate)||this.parent.dateValidationModule.calculateDuration(e):this.parent.dateValidationModule.calculateStartDate(e),this.dialogEditValidationFlag=!0)},e.prototype.validateScheduleValuesByCurrentField=function(e,i,r){var a=this.parent,n=r.ganttProperties,s=a.taskFields;if(s.duration===e&&(t.isNullOrUndefined(i)||""===i?a.allowUnscheduledTasks&&this.parent.setRecordValue("duration",null,n,!0):(a.dataOperation.updateDurationValue(i,n),this.parent.setRecordValue(s.duration,i,r),this.parent.setRecordValue("taskData."+s.duration,n.duration,r)),this.validateDuration(r),this.parent.editModule.updateResourceRelatedFields(r,"duration")),s.startDate===e){if(""!==i){var o=this.parent.dateValidationModule.getDateFromFormat(i);o=this.parent.dateValidationModule.checkStartDate(o,n),this.parent.setRecordValue("startDate",o,n,!0)}else a.allowUnscheduledTasks&&!r.hasChildRecords&&this.parent.setRecordValue("startDate",null,n,!0);this.validateStartDate(r)}if(s.endDate===e){if(""!==i){var l=this.parent.dateValidationModule.getDateFromFormat(i);t.isNullOrUndefined(n.startDate)&&t.isNullOrUndefined(l)&&n.startDate.getTime()>l.getTime()&&(l=n.endDate),0===l.getHours()&&86400!==a.defaultEndTime&&this.parent.dateValidationModule.setTime(a.defaultEndTime,l),l=this.parent.dateValidationModule.checkEndDate(l,n),(t.isNullOrUndefined(n.startDate)||l.getTime()>n.startDate.getTime())&&this.parent.setRecordValue("endDate",l,n,!0)}else a.allowUnscheduledTasks&&this.parent.setRecordValue("endDate",null,n,!0);this.validateEndDate(r)}return s.work===e&&(t.isNullOrUndefined(i)||""===i||(this.parent.setRecordValue("work",i,n,!0),this.parent.editModule.updateResourceRelatedFields(r,"work"),this.validateDuration(r))),e===s.type&&this.parent.setRecordValue("taskType",i,n,!0),s.manual===e&&this.parent.editModule.updateTaskScheduleModes(r),!0},e.prototype.getSegmentsModel=function(e){var i=this,r=this.parent.taskFields;(t.isNullOrUndefined(e)||0===e.length)&&(e=[],t.isNullOrUndefined(r.startDate)||e.push("startDate"),t.isNullOrUndefined(r.endDate)||e.push("endDate"),t.isNullOrUndefined(r.duration)||e.push("duration"));var a={};a.editSettings={allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal",newRowPosition:"Bottom"},a.locale=this.parent.locale,a.dataSource=[],a.rowHeight=this.parent.isAdaptive?48:null,a.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")}];for(var n=[],s=function(r){var a={};switch(e[r]){case"startDate":case"endDate":a={field:e[r],headerText:o.localeObj.getConstant(e[r]),editType:"stringedit",width:"200px",edit:{write:function(a){var n;if(t.isNullOrUndefined(i.beforeOpenArgs.General)){var s=i.getGeneralColumnFields();n=i.getFieldsModel(s)[i.parent.taskFields[e[r]]]}else n=i.beforeOpenArgs.General[i.parent.taskFields[e[r]]];var o=a.rowData[a.column.field];t.setValue("value",o,n);new i.inputs[i.parent.columnByField[i.parent.taskFields[e[r]]].editType](n).appendTo(a.element)},read:function(e){return e.ej2_instances[0].value}},format:o.parent.getDateFormat()},"startDate"===e[r]&&(a.validationRules={required:!0}),n.push(a);break;case"duration":a={field:e[r],headerText:o.localeObj.getConstant(e[r]),editType:"stringedit",width:"100px",edit:{write:function(a){var n;if(t.isNullOrUndefined(i.beforeOpenArgs.General)){var s=i.getGeneralColumnFields();n=i.getFieldsModel(s)[i.parent.taskFields[e[r]]]}else n=i.beforeOpenArgs.General[i.parent.taskFields[e[r]]];n.floatLabelType="Never";var o=a.rowData[a.column.field];t.isNullOrUndefined(o)?t.setValue("value",null,n):t.setValue("value",o,n),t.setValue("value",o,n);new h.TextBox(n).appendTo(a.element)},read:function(e){return e.ej2_instances[0].value.toString()}}},n.push(a)}},o=this,l=0;l<e.length;l++)s(l);return a.columns=n,a.height=this.parent.isAdaptive?"100%":"153px",a},e.prototype.getGridColumnByField=function(e,t){for(var i,r=0;r<t.length;r++)t[r].field===e&&(i=t[r]);return i},e.prototype.updateSegmentField=function(e,i,r){var a,n=this.parent.editModule.dialogModule.dialog,s=t.getValue("Segments",this.beforeOpenArgs),o=this.getGridColumnByField(e,s.columns),l=this.parent.element.id,d=r[e];"stringedit"===o.editType?a=n.querySelector("#"+l+"SegmentsTabContainer"+e).ej2_instances[0]:"datepickeredit"===o.editType&&(a=n.querySelector("#"+l+"SegmentsTabContainer"+e).ej2_instances[0]),t.isNullOrUndefined(a.value)||a.value.toString()===d.toString()||(a.value=d,a.dataBind())},e.prototype.validateSegmentFields=function(e,i,r,a){var n=this.parent.taskFields;if(!t.isNullOrUndefined(n.duration)&&n.duration.toLowerCase()===i.toLowerCase()&&!t.isNullOrUndefined(r)&&""!==r){this.selectedSegment.duration=Number(r);var s=e.dataOperation.getEndDate(this.selectedSegment.startDate,Number(r),this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1);s=e.dataOperation.checkEndDate(s,this.editedRecord.ganttProperties,!1),this.selectedSegment.endDate=s}if(!t.isNullOrUndefined(n.startDate)&&n.startDate.toLowerCase()===i.toLowerCase()&&""!==r){var o=this.parent.dateValidationModule.getDateFromFormat(r);o=this.parent.dateValidationModule.checkStartDate(o),this.selectedSegment.startDate=o,t.isNullOrUndefined(n.endDate)||(this.selectedSegment.endDate=this.parent.dataOperation.getEndDate(o,this.selectedSegment.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1))}if(!t.isNullOrUndefined(n.endDate)&&n.endDate.toLowerCase()===i.toLowerCase()&&""!==r){0===(s=this.parent.dateValidationModule.getDateFromFormat(r)).getHours()&&86400!==e.defaultEndTime&&this.parent.dateValidationModule.setTime(e.defaultEndTime,s),s=this.parent.dateValidationModule.checkEndDate(s,this.editedRecord.ganttProperties),this.selectedSegment.endDate=s,this.selectedSegment.duration=this.parent.dataOperation.getDuration(this.selectedSegment.startDate,this.selectedSegment.endDate,this.editedRecord.ganttProperties.durationUnit,!0,!1,!0)}t.isNullOrUndefined(n.startDate)||this.updateSegmentField("startDate",a,this.selectedSegment),t.isNullOrUndefined(n.endDate)||this.updateSegmentField("endDate",a,this.selectedSegment),t.isNullOrUndefined(n.duration)||this.updateSegmentField("duration",a,this.selectedSegment)},e.prototype.getPredecessorModel=function(e){(t.isNullOrUndefined(e)||0===e.length)&&(e=["ID","Name","Type","Offset","UniqueId"]);var i={};i.editSettings={allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal"},i.locale=this.parent.locale,i.dataSource=[],i.rowHeight=this.parent.isAdaptive?48:null,i.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 r=[],a=0;a<e.length;a++){var n={};"id"===e[a].toLowerCase()?(n={field:"id",headerText:this.localeObj.getConstant("id"),allowEditing:!1,width:"70px"},r.push(n)):"name"===e[a].toLowerCase()?(n={field:"name",headerText:this.localeObj.getConstant("name"),editType:"stringedit",width:"250px",validationRules:{required:!0}},r.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"},r.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"},r.push(n)):"uniqueid"===e[a].toLowerCase()&&(n={field:"uniqueId",isPrimaryKey:!0,visible:!1,defaultValue:C().toString()},r.push(n))}return i.columns=r,i.height=this.parent.isAdaptive?"100%":"153px",i},e.prototype.getResourcesModel=function(e){var i=this.parent.resourceFields;(t.isNullOrUndefined(e)||0===e.length)&&(e=[i.id,i.name,i.unit,i.group]);for(var r={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 s={};e[n]===i.id?(s={field:i.id,headerText:this.localeObj.getConstant("id"),isPrimaryKey:!0,width:"100px",allowEditing:!1},a.push(s)):e[n]===i.name?(s={field:i.name,headerText:this.localeObj.getConstant("name"),allowEditing:!1},a.push(s)):e[n]===i.unit?(s={field:i.unit,headerText:this.localeObj.getConstant("unit"),editType:"numericedit",edit:{params:{min:0}}},a.push(s)):e[n]!==i.group||t.isNullOrUndefined(i.group)||(s={field:i.group,headerText:this.localeObj.getConstant("group"),allowEditing:!1},a.push(s))}return r.columns=a,r.height=this.parent.isAdaptive?"100%":"196px",r},e.prototype.getNotesModel=function(e){(t.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"]);return{placeholder:this.localeObj.getConstant("writeNotes"),toolbarSettings:{items:e},height:this.parent.isAdaptive?"100%":"auto",locale:this.parent.locale}},e.prototype.createDivElement=function(e,i){return t.createElement("div",{className:e,id:i})},e.prototype.createInputElement=function(e,i,r,a){return t.createElement(a||"input",{className:e,attrs:{type:"text",id:i,name:r,title:r}})},e.prototype.renderTabItems=function(){for(var e=this.beforeOpenArgs.tabModel.items,t=0,i=0;i<e.length;i++){var r=e[i];r.content instanceof HTMLElement||("General"===r.content?r.content=this.renderGeneralTab(r.content):"Dependency"===r.content?(this.editedRecord.hasChildRecords&&!this.parent.allowParentDependency&&(r.disabled=!0),r.content=this.renderPredecessorTab(r.content)):"Resources"===r.content?r.content=this.renderResourceTab(r.content):r.content==="Custom"+t?(r.content=this.renderCustomTab(r.content),t++):"Notes"===r.content?r.content=this.renderNotesTab(r.content):"Segments"===r.content&&(this.editedRecord.hasChildRecords&&(r.disabled=!0),r.content=this.renderSegmentsTab(r.content)))}},e.prototype.segmentGridActionBegin=function(e){var i=this.parent.taskFields,r=this.beforeOpenArgs.Segments;if("add"===e.requestType||"beginEdit"===e.requestType||"save"===e.requestType){var a=r.dataSource,n=t.getValue("rowData",e),s=this.beforeOpenArgs.rowData.ganttProperties.startDate;if(!t.isNullOrUndefined(s)&&"add"===e.requestType){var o={},l=t.getValue("startDate",n),d=t.getValue("endDate",n),h=(t.getValue("duration",n),!t.isNullOrUndefined(a)&&a.length>0?t.isNullOrUndefined(i.endDate)?new Date(t.getValue("startDate",a[0]).getTime()):new Date(t.getValue("endDate",a[0]).getTime()):!t.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)&&new Date(this.beforeOpenArgs.rowData.ganttProperties.startDate.getTime()));h.setHours(0,0,0,0),!t.isNullOrUndefined(a)&&a.length>0&&h.setDate(h.getDate()+2),l=this.parent.dataOperation.checkStartDate(h),0===(d=this.parent.dateValidationModule.getDateFromFormat(l)).getHours()&&86400!==this.parent.defaultEndTime&&this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,d),o={startDate:l,endDate:d=!t.isNullOrUndefined(i.endDate)&&!t.isNullOrUndefined(a)&&a.length<=0?this.beforeOpenArgs.rowData.ganttProperties.endDate:d,duration:!t.isNullOrUndefined(i.duration)&&!t.isNullOrUndefined(a)&&a.length<=0?this.beforeOpenArgs.rowData.ganttProperties.duration:1},e.rowData=o}this.selectedSegment=e.rowData}},e.prototype.renderSegmentsTab=function(e){var i=this.parent,a=this.beforeOpenArgs[e],n=this.beforeOpenArgs.rowData,s=[];this.isEdit&&(s=t.isNullOrUndefined(n.ganttProperties.segments)?[]:n.ganttProperties.segments),a.dataSource=s,a.actionBegin=this.segmentGridActionBegin.bind(this),r.Grid.Inject(r.Edit,r.Page,r.Toolbar,r.ForeignKey);var o=new r.Grid(a),l=this.createDivElement("",i.element.id+""+e+"TabContainer");return o.appendTo(l),l},e.prototype.renderGeneralTab=function(e){for(var t=this.parent,i=this.beforeOpenArgs[e],r=this.createDivElement("e-edit-form-row",t.element.id+""+e+"TabContainer"),a=0,n=Object.keys(i);a<n.length;a++){var s=n[a];if(!1!==this.parent.columnByField[s].visible){var o=this.parent.columnByField[s],l=i[s];r.appendChild(this.renderInputElements(l,o))}}return r},e.prototype.isCheckIsDisabled=function(e){var i,r=!1;if(!1===e.allowEditing||e.isPrimaryKey||this.parent.readOnly)if(-1!==this.parent.customColumns.indexOf(e.field))r=!0;else if(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||e.field===this.parent.taskFields.baselineStartDate||e.field===this.parent.taskFields.baselineEndDate||e.field===this.parent.taskFields.work||e.field===this.parent.taskFields.type){for(var a=0;a<this.parent.currentViewData.length;a++)if(!t.isNullOrUndefined(this.parent.currentViewData[a].ganttProperties.taskId)){i=this.parent.currentViewData[a].ganttProperties.taskId;break}r="string"!=typeof i}return this.isEdit&&(e.field===this.parent.taskFields.id&&(r=!0),this.editedRecord.hasChildRecords&&(e.field===this.parent.taskFields.endDate&&(!t.isNullOrUndefined(this.editedRecord.isManual)&&!1===this.editedRecord.isManual||"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)&&(r=!0)),r},e.prototype.isParentValid=function(e){if(e.length>0)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},e.prototype.renderPredecessorTab=function(e){var i=this,n=this.parent,s=this.beforeOpenArgs[e],o=this.parent.columnByField[this.parent.taskFields.dependency];(!1===o.allowEditing||o.isPrimaryKey||this.parent.readOnly)&&(s.editSettings.allowEditing=!1,s.editSettings.allowAdding=!1,s.editSettings.allowDeleting=!1);var l=this.beforeOpenArgs.rowData,d=[];this.taskNameCollection(),this.isEdit&&(d=this.predecessorEditCollection(l),this.updatePredecessorDropDownData(l)),s.dataSource=d,s.actionBegin=this.gridActionBegin.bind(this);s.columns[1].edit={write:function(e){"add"===t.getValue("requestType",e)&&t.setValue("rowData.uniqueId",C(),e);new u.ComboBox({dataSource:new a.DataManager(i.idCollection),popupHeight:"180px",allowCustom:!1,enableRtl:i.parent.enableRtl,fields:{value:"text"},value:e.rowData.name,change:function(e){var r=t.closest(e.element,"tr").querySelector("#"+i.parent.element.id+"DependencyTabContainerid");r&&(t.isNullOrUndefined(e.itemData)||t.isNullOrUndefined(e.item)?r.value="":r.value=e.itemData.id)},autofill:!0}).appendTo(e.element)},read:function(e){return e.ej2_instances[0].value}},r.Grid.Inject(r.Edit,r.Page,r.Toolbar,r.ForeignKey);var h=new r.Grid(s),p=this.createDivElement("e-dependent-div",n.element.id+""+e+"TabContainer");return h.appendTo(p),p},e.prototype.gridActionBegin=function(e){var i=this,r=this.beforeOpenArgs.Dependency;if("add"===e.requestType||"beginEdit"===e.requestType){var a="add"!==e.requestType;this.idCollection=t.extend([],[],this.preTableCollection,!0);for(var n=r.dataSource,s=function(r){o.idCollection.forEach(function(s,o){if(s.id===t.getValue("id",n[r])){var l=t.getValue("rowData",e);if(a&&t.getValue("id",l)===s.id)return;i.idCollection.splice(i.idCollection.indexOf(s),1)}})},o=this,l=0;l<=n.length;l++)s(l)}},e.prototype.updateResourceCollection=function(e,i){if(!t.isNullOrUndefined(e.data)&&Object.keys(e.data).length){this.parent;var r=document.querySelector("#"+i).ej2_instances[0];if(!t.isNullOrUndefined(r)&&r.getSelectedRecords().length>0){var a=r.getSelectedRecords(),n=void 0,s=[];for(n=0;n<a.length;n++)s.push(a[n].taskData);this.ganttResources=t.extend([],s)}else this.ganttResources=[]}else this.ganttResources=[]},e.prototype.renderResourceTab=function(e){var i=this,r=this.parent,a=r.resourceFields,s=this.beforeOpenArgs.rowData,o=s.ganttProperties.resourceInfo,l=this.beforeOpenArgs[e],d=r.element.id+""+e+"TabContainer",h=[];if("ResourceView"===this.parent.viewType)for(var p=0;p<r.currentViewData.length;p++)for(var c=0;c<r.resources.length;c++)r.currentViewData[p][r.taskFields.id]===r.resources[c][a.id]&&(r.currentViewData[p].hasChildRecords||t.isNullOrUndefined(r.currentViewData[p].parentItem))&&h.push(r.resources[c]);else h=t.extend([],[],r.resources,!0);if(this.parent.dataOperation.updateResourceUnit(h),!t.isNullOrUndefined(o)){var u=void 0,g=o.length,f=void 0,m=h.length;for(u=0;u<g;u++)for(f=0;f<m;f++)o[u][a.id]===h[f][a.id]&&(h[f][a.unit]=o[u][a.unit])}l.dataSource=h;var y=s.ganttProperties.resourceInfo;if(this.isEdit&&!t.isNullOrUndefined(y))for(p=0;p<y.length;p++)this.ganttResources.push(y[p]);l.rowSelected=function(e){i.updateResourceCollection(e,d)},l.rowDeselected=function(e){i.updateResourceCollection(e,d)};var D=this.createDivElement("e-resource-div",d);n.TreeGrid.Inject(n.Selection,n.Filter,n.Edit,n.VirtualScroll);var v=new n.TreeGrid(l),w=this.parent.columnByField[this.parent.taskFields.resourceInfo];return(!1===w.allowEditing||w.isPrimaryKey||this.parent.readOnly)&&(v.allowSelection=!1,v.allowFiltering=!1,v.editSettings.allowEditing=!1),v.dataBound=function(){if(i.parent.editDialogFields.length>=1&&"Resources"===i.parent.editDialogFields[0].type){var e=i.parent.element.id+"ResourcesTabContainer";i.resourceSelection(e)}},v.appendTo(D),D},e.prototype.resourceSelection=function(e){var i=this,r=document.querySelector("#"+e).ej2_instances[0],a=r.getCurrentViewRecords(),n=this.ganttResources;n&&n.length>0&&a.forEach(function(e,a){for(var s=0;s<n.length;s++)e.taskData[i.parent.resourceFields.id]!==n[s][i.parent.resourceFields.id]||t.isNullOrUndefined(r.selectionModule)||-1!==r.getSelectedRowIndexes().indexOf(a)||r.selectRow(a)})},e.prototype.renderCustomTab=function(e){return this.renderGeneralTab(e)},e.prototype.renderNotesTab=function(e){var t=this.parent,i=this.beforeOpenArgs[e];i.enableHtmlSanitizer=this.parent.enableHtmlSanitizer;var r=this.editedRecord.ganttProperties,a=this.createDivElement("",t.element.id+""+e+"TabContainer");d.RichTextEditor.Inject(d.Toolbar,d.Link,d.HtmlEditor,d.QuickToolbar,d.Count),i.value=r.notes;var n=this.parent.columnByField[this.parent.taskFields.notes];(!1===n.allowEditing||n.isPrimaryKey||this.parent.readOnly)&&(i.enabled=!1);return new d.RichTextEditor(i).appendTo(a),a},e.prototype.renderInputElements=function(e,i){var a,n=this,s=this.parent.element.id,o=this.editedRecord,l=this.createDivElement("e-edit-form-column"),d={column:i,data:o};if(!t.isNullOrUndefined(i.edit)&&t.isNullOrUndefined(i.edit.params)){var h=i.edit.create;(a="string"==typeof h?(h=r.getObject(h,window))(d):i.edit.create(d)).className="",a.setAttribute("type","text"),a.setAttribute("id",s+""+i.field),a.setAttribute("name",i.field),a.setAttribute("title",i.field),l.appendChild(a)}else a=this.createInputElement("",s+""+i.field,i.field),l.appendChild(a);if(e.enabled=t.isNullOrUndefined(e.enabled)?!this.isCheckIsDisabled(i):e.enabled,i.field===this.parent.taskFields.duration)if(t.isNullOrUndefined(i.valueAccessor)){if(t.isNullOrUndefined(i.edit)){var p=o.ganttProperties;e.value=this.parent.dataOperation.getDurationString(p.duration,p.durationUnit)}}else if("string"==typeof i.valueAccessor){var c=r.getObject(i.valueAccessor,window);e.value=c(i.field,o,i)}else e.value=i.valueAccessor(i.field,o,i);else"booleanedit"===i.editType?!0===o[i.field]?e.checked=!0:e.checked=!1:e.value=o[i.field];if(!t.isNullOrUndefined(i.edit)&&t.isNullOrUndefined(i.edit.params)){var u=i.edit.write,g=void 0;g="string"==typeof u?(u=r.getObject(u,window))({column:i,rowData:o,element:a}):i.edit.write({column:i,rowData:o,element:a}),i.field===this.parent.taskFields.duration&&(g.change=function(e){n.validateScheduleFields(e,i,n.parent)})}else{(g=new this.inputs[i.editType](e)).appendTo(a)}return l},e.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 r=i;if(i.parentUniqueID===this.beforeOpenArgs.rowData.uniqueID)this.isValidData=!1;else do{if(r.parentItem&&(r=this.parent.flatData[this.parent.ids.indexOf(r.parentItem.taskId)]).uniqueID===this.beforeOpenArgs.rowData.uniqueID){this.isValidData=!1;break}}while(r.parentItem);if(i.hasChildRecords&&this.isValidData&&(this.isValidData=this.isParentValid(i.childRecords)),!this.isValidData){this.isValidData=!0;continue}}else if(i.hasChildRecords)continue;var a="ResourceView"===this.parent.viewType?i.ganttProperties.taskId.toString():i.ganttProperties.rowUniqueID.toString(),n={id:a,text:a+"-"+i.ganttProperties.taskName,value:a};this.preTaskIds.push(n.id),this.preTableCollection.push(n)}},e.prototype.predecessorEditCollection=function(e){var i=[],r=e.ganttProperties;if(this.isEdit&&!t.isNullOrUndefined(this.parent.taskFields.dependency)&&!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(r.predecessor))for(var a=r.predecessor,n=this.preTableCollection,s=0;s<a.length;s++){var o=a[s].from.toString(),l={};if(("ResourceView"===this.parent.viewType?r.taskId:r.rowUniqueID).toString()!==o){l.id=o;for(var d=0;d<n.length;d++)if(n[d].value===o){l.name=n[d].text;break}l.type=a[s].type;var h=a[s].offset,p=a[s].offsetUnit;l.offset=this.parent.dataOperation.getDurationString(h,p),l.uniqueId=C(),i.push(l)}}return i},e.prototype.updatePredecessorDropDownData=function(e){var t=-1,i="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString();t=this.preTaskIds.indexOf(i),this.preTableCollection.splice(t,1),this.preTaskIds.splice(t,1),this.validSuccessorTasks(e,this.preTaskIds,this.preTableCollection)},e.prototype.validSuccessorTasks=function(e,t,i){var r=this,a=e.ganttProperties;if(a.predecessor&&a.predecessor.length>0){var n=a.predecessor,s="ResourceView"===this.parent.viewType?a.taskId.toString():a.rowUniqueID.toString();n.forEach(function(e){if(e.from.toString()===s){var a=e.to,n=-1;(n=t.indexOf(a))>-1&&(t.splice(n,1),i.splice(n,1));var o=r.parent.connectorLineModule.getRecordByID(a);r.validSuccessorTasks(o,t,i)}})}},e.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]}]},e.prototype.initiateDialogSave=function(){this.isEdit?this.parent.initiateEditAction(!0):this.addedRecord={};for(var e=this.parent,i=this.beforeOpenArgs.tabModel.items,r=0;r<i.length;r++){var a=i[r].content,n=a.id;t.isNullOrUndefined(n)&&""===n||("General"===(n=(n=n.replace(e.element.id,"")).replace("TabContainer",""))?this.updateGeneralTab(a,!1):"Dependency"===n?this.updatePredecessorTab(a):"Notes"===n?this.updateNotesTab(a):"Resources"===n?this.updateResourceTab(a):-1!==n.indexOf("Custom")?this.updateCustomTab(a):"Segments"===n&&this.updateSegmentsData(a,this.beforeOpenArgs.rowData))}if(this.isEdit){this.parent.dataOperation.updateWidthLeft(this.rowData);var s={data:this.rowData,action:"DialogEditing"};this.parent.editModule.initiateUpdateAction(s)}else if("ResourceView"===this.parent.viewType){var o=t.extend({},this.addedRecord,!0);if(o[this.parent.taskFields.resourceInfo].length)for(r=0;r<o[this.parent.taskFields.resourceInfo].length;r++){n=o[this.parent.taskFields.resourceInfo][r].toString();var l=this.parent.getTaskIds().indexOf("R"+n.toString());if(-1!==l){this.parent.editModule.addRecord(this.addedRecord,"Child",l);break}}else this.parent.editModule.addRecord(this.addedRecord,"Bottom")}else this.parent.editModule.addRecord(this.addedRecord,this.parent.editSettings.newRowPosition);return!0},e.prototype.updateSegmentTaskData=function(e){for(var i=[],r=this.parent.taskFields,a=0;a<e.length;a++){var n={};t.isNullOrUndefined(r.startDate)||(n[this.parent.taskFields.startDate]=e[a].startDate),t.isNullOrUndefined(r.endDate)||(n[this.parent.taskFields.endDate]=e[a].endDate),t.isNullOrUndefined(r.duration)||(n[this.parent.taskFields.duration]=Number(e[a].duration),e[a].duration=n[this.parent.taskFields.duration]),i.push(n)}this.isEdit?(this.rowData.ganttProperties.segments=e,this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(this.rowData,!1),this.rowData.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,i,this.rowData),e.length<=0&&this.validateDuration(this.rowData)):this.addedRecord[r.segments]=i},e.prototype.updateSegmentsData=function(e,t){var i,r=e.ej2_instances[0],a=r.isEdit;r.isEdit&&r.endEdit(),i=a&&r.currentViewData.length!=r.dataSource.length?r.dataSource:r.currentViewData,this.updateSegmentTaskData(i)},e.prototype.updateGeneralTab=function(e,i){var a=this.parent,n=e.childNodes,s={};this.isEdit||(s=this.addedRecord);for(var o=0;o<n.length;o++){var l=n[o],d=l.querySelector('input[id^="'+a.element.id+'"]');if(d){var h=d.id.replace(a.element.id,""),p=l.querySelector("#"+a.element.id+h).ej2_instances[0];if("stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType&&h===this.parent.taskFields.id){var c=p.value.toString();p.value=c}var u=a.columnByField[h];if(!t.isNullOrUndefined(u.edit)&&t.isNullOrUndefined(u.edit.params)){var g=u.edit.read;"string"==typeof g?(g=r.getObject(g,window),s[h]=g(d,p.value)):s[h]=u.edit.read(d,p.value)}else i&&"booleanedit"===u.editType?!0===d.checked?s[h]=!0:s[h]=!1:(s[h]=p.value,this.parent.enableHtmlSanitizer&&"string"==typeof p.value&&(p.value=t.SanitizeHtmlHelper.sanitize(p.value),s[h]=p.value))}}this.isEdit&&(i||this.updateScheduleProperties(this.editedRecord,this.rowData),a.editModule.validateUpdateValues(s,this.rowData,!0))},e.prototype.updateScheduleProperties=function(e,i){this.parent.setRecordValue("startDate",e.ganttProperties.startDate,i.ganttProperties,!0),this.parent.setRecordValue("endDate",e.ganttProperties.endDate,i.ganttProperties,!0),this.parent.setRecordValue("duration",e.ganttProperties.duration,i.ganttProperties,!0),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,i.ganttProperties,!0),this.parent.setRecordValue("work",e.ganttProperties.work,i.ganttProperties,!0),this.parent.setRecordValue("type",e.ganttProperties.taskType,i.ganttProperties,!0),this.parent.setRecordValue("resourceNames",e.ganttProperties.resourceNames,i.ganttProperties,!0),this.parent.setRecordValue("resourceInfo",e.ganttProperties.resourceInfo,i.ganttProperties,!0),t.isNullOrUndefined(this.parent.taskFields.startDate)||this.parent.dataOperation.updateMappingData(i,this.parent.taskFields.startDate),t.isNullOrUndefined(this.parent.taskFields.endDate)||this.parent.dataOperation.updateMappingData(i,this.parent.taskFields.endDate),t.isNullOrUndefined(this.parent.taskFields.duration)||(this.parent.dataOperation.updateMappingData(i,this.parent.taskFields.duration),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,this.rowData,!0),0===this.rowData.ganttProperties.duration?this.parent.setRecordValue("isMilestone",!0,i.ganttProperties,!0):this.parent.setRecordValue("isMilestone",!1,this.rowData.ganttProperties,!0)),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(this.rowData,this.parent.taskFields.work),t.isNullOrUndefined(this.parent.taskFields.manual)||this.parent.dataOperation.updateMappingData(this.rowData,this.parent.taskFields.manual),t.isNullOrUndefined(this.parent.taskFields.type)||this.parent.dataOperation.updateMappingData(this.rowData,"type"),t.isNullOrUndefined(this.parent.taskFields.resourceInfo)||this.parent.dataOperation.updateMappingData(this.rowData,"resourceInfo")},e.prototype.updatePredecessorTab=function(e){var t=e.ej2_instances[0];t.isEdit&&t.endEdit();for(var i=t.dataSource,r=[],a=[],n="",s=[],o=0;o<i.length;o++){var l=i[o];if(-1===s.indexOf(l.id)){var d=l.id+l.type;l.offset&&-1!==l.offset.indexOf("-")?d+=l.offset:d+="+"+l.offset,r.push(d),s.push(l.id)}}this.isEdit?(r.length>0?(a=this.parent.predecessorModule.calculatePredecessor(r.join(","),this.rowData),this.parent.setRecordValue("predecessor",a,this.rowData.ganttProperties,!0),n=this.parent.predecessorModule.getPredecessorStringValue(this.rowData)):(a=[],this.parent.setRecordValue("predecessor",a,this.rowData.ganttProperties,!0),n=""),this.parent.setRecordValue("predecessorsName",n,this.rowData.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,n,this.rowData),this.parent.setRecordValue(this.parent.taskFields.dependency,n,this.rowData),this.parent.predecessorModule.updateUnscheduledDependency(this.rowData)):this.addedRecord[this.parent.taskFields.dependency]=r.length>0?r.join(","):""},e.prototype.updateResourceTab=function(e){var i=e.ej2_instances[0];i&&i.grid.endEdit();var r=this.ganttResources;"ResourceView"!==this.parent.viewType||t.isNullOrUndefined(this.rowData.ganttProperties)||(JSON.stringify(this.ganttResources)!==JSON.stringify(this.rowData.ganttProperties.resourceInfo)?(this.isResourceUpdate=!0,this.previousResource=t.isNullOrUndefined(this.rowData.ganttProperties.resourceInfo)?[]:this.rowData.ganttProperties.resourceInfo.slice()):this.isResourceUpdate=!1);var a=[];if(this.isEdit)this.parent.setRecordValue("resourceInfo",r,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(var n=0;n<r.length;n++)a.push(r[n][this.parent.resourceFields.id]),this.isAddNewResource=!0;this.addedRecord[this.parent.taskFields.resourceInfo]=a}},e.prototype.updateNotesTab=function(e){var t=this.parent,i=e.ej2_instances[0];this.isEdit?(!1===t.columnByField[t.taskFields.notes].disableHtmlEncode?this.parent.setRecordValue("notes",i.getHtml(),this.rowData.ganttProperties,!0):this.parent.setRecordValue("notes",i.getText(),this.rowData.ganttProperties,!0),t.dataOperation.updateMappingData(this.rowData,"notes")):this.addedRecord[this.parent.taskFields.notes]=i.getHtml()},e.prototype.updateCustomTab=function(e){this.updateGeneralTab(e,!0)},e}(),oi=function(){function e(e){this.validationPredecessor=null,this.confirmPredecessorDialog=null,this.predecessorIndex=null,this.childRecord=null,this.parent=e,this.dateValidateModule=this.parent.dateValidationModule,this.parent.on("initPredessorDialog",this.initPredecessorValidationDialog,this)}return e.prototype.updateConnectorLineEditElement=function(e){var i=this.getConnectorLineHoverElement(e.target);t.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)||this.highlightConnectorLineElements(i)},e.prototype.getConnectorLineHoverElement=function(e){var t=f(e,Te),i=f(e,Se),r=f(e,be),a=f(e,Pe);return t||i||r||a?f(e,ke):null},e.prototype.highlightConnectorLineElements=function(e){e?e!==this.connectorLineElement&&(this.removeHighlight(),this.addHighlight(e)):this.removeHighlight()},e.prototype.addHighlight=function(e){this.connectorLineElement=e;var t=e.querySelector("."+Te),i=e.querySelector("."+be);t?t.setAttribute("stroke-width","2"):i.setAttribute("stroke-width","2")},e.prototype.removeHighlight=function(){if(this.connectorLineElement){var e=this.connectorLineElement.querySelector("."+Te),t=this.connectorLineElement.querySelector("."+be);e?e.setAttribute("stroke-width","1"):t.setAttribute("stroke-width","1"),this.connectorLineElement=null}},e.prototype.getEditedConnectorLineString=function(e){for(var i,r,a,n,s,o,l=[],d=[],h="",p=0;p<e.length;p++)if(i=e[p],r=i.ganttProperties.predecessor){for(var c=0;c<r.length;c++){a=r[c];if(this.parent.connectorLineModule.removeConnectorLineById("parent"+a.from+"child"+a.to),n=this.parent.connectorLineModule.getRecordByID(a.from),s=this.parent.connectorLineModule.getRecordByID(a.to),(!this.parent.allowParentDependency&&n&&!0===n.expanded||s&&!0===s.expanded||this.parent.allowParentDependency&&(n||s))&&(o=this.parent.predecessorModule.updateConnectorLineObject(n,s,a),!t.isNullOrUndefined(o))){var u=l.indexOf(o.connectorLineId),g=this.parent.connectorLineModule.getConnectorLineTemplate(o);-1!==u?d[u]=g:(l.push(o.connectorLineId),d.push(g))}}h=d.join("")}return h},e.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);var t=this.getEditedConnectorLineString(e);this.parent.connectorLineModule.svgObject.innerHTML=this.parent.connectorLineModule.svgObject.innerHTML+t},e.prototype.idFromPredecessor=function(e){for(var i,r=e.split(","),a=[],n=[],s=0;s<r.length;s++){var o=[];if(i=r[s].split("+"),r[s].indexOf("-")>=0&&(i=r[s].split("-")),!t.isNullOrUndefined(i[0])){-1===("ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids).indexOf(i[0])?-1!==i[0].indexOf(" ")?(1===(n=i[0].split(" ")).length&&(n=i[0].match(/(\d+|[A-z]+)/g)),o.push(n[0])):1===i[0].length||2===i[0].length?o.push(i[0]):o.push(i[0].slice(0,-2)):o.push(i[0])}a.push(o.join(""))}return a},e.prototype.predecessorValidation=function(e,i){for(var r,a,n=i.rowUniqueID,s=0;s<e.length;s++){r=e[s];var o=[];e.slice(0).splice(s,1);for(var l=function(){var e=[];return-1!==o.indexOf(r)?"break":t.isNullOrUndefined(d.parent.connectorLineModule.getRecordByID(r))?{value:!1}:(a=d.parent.connectorLineModule.getRecordByID(r).ganttProperties,!t.isNullOrUndefined(a.predecessor)&&a.predecessor.length>0&&a.predecessor.forEach(function(t){a.rowUniqueID.toString()!==t.from&&e.push(t.from.toString())}),n.toString()===a.rowUniqueID.toString()||-1!==e.indexOf(n.toString())?{value:!1}:(o.push(r),!t.isNullOrUndefined(a.predecessor)&&a.predecessor.length>0?void(r=a.predecessor[0].from):"break"))},d=this;null!==r;){var h=l();if("object"==typeof h)return h.value;if("break"===h)break}}return!0},e.prototype.getRootParent=function(e){var t=e;return e.parentItem?((t=this.parent.flatData.filter(function(t){return t.uniqueID===e.parentUniqueID})[0]).parentItem&&(t=this.getRootParent(t)),t):t},e.prototype.validateParentPredecessor=function(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.parent.connectorLineEditModule.getRootParent(e).uniqueID===t.uniqueID)return!1}else if(t.parentItem&&!e.parentItem){if(this.parent.connectorLineEditModule.getRootParent(t).uniqueID===e.uniqueID)return!1}return!0},e.prototype.validatePredecessorRelation=function(e,i){var r,a,n=!0,s="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(!t.isNullOrUndefined(i)&&i.length>0){r=this.idFromPredecessor(i);for(var o=function(i){if(l.parent.allowParentDependency){if(parseInt(r[r.length-1])!==e[l.parent.taskFields.id]){var o=l.parent.ids.indexOf(r[r.length-1]),d=l.parent.currentViewData[o];d&&e&&(n=l.validateParentPredecessor(d,e))}}else{if(!l.checkParentRelation(e,r))return{value:!1}}var h=[],p=!0;if(r.slice(0).forEach(function(e){-1===h.indexOf(e)?h.push(e):p=!1}),!p)return{value:!1};a=r[i];var c=[];r.slice(0).splice(i,1);for(var u=function(){var i,r,n=[];if(-1!==c.indexOf(a))return"break";if(t.isNullOrUndefined(l.parent.connectorLineModule.getRecordByID(a.toString())))return{value:!1};if(r=l.parent.connectorLineModule.getRecordByID(a.toString()).ganttProperties,!t.isNullOrUndefined(r.predecessor)&&r.predecessor.length>0&&r.predecessor.forEach(function(e,t){r.rowUniqueID.toString()!==e.from&&(n.push(e.from.toString()),i=t)}),s.toString()===r.rowUniqueID.toString()||-1!==n.indexOf(s.toString()))return{value:!1};if(c.push(a),t.isNullOrUndefined(r.predecessor)||!(r.predecessor.length>0))return"break";var o=void 0;return n.length>1?o=l.predecessorValidation(n,e.ganttProperties):1===n.length&&(a=r.predecessor[i].from),!1===o?{value:!1}:void 0};null!==a;){var g=u();if("object"==typeof g)return g;if("break"===g)break}},l=this,d=0;d<r.length;d++){var h=o(d);if("object"==typeof h)return h.value}}return n},e.prototype.addPredecessor=function(e,i){var r=t.isNullOrUndefined(e.ganttProperties.predecessorsName)||""===e.ganttProperties.predecessorsName?i:e.ganttProperties.predecessorsName+","+i;this.updatePredecessorHelper(e,r)},e.prototype.removePredecessor=function(e){this.updatePredecessorHelper(e,null)},e.prototype.updatePredecessor=function(e,t,i){return this.updatePredecessorHelper(e,t,i)},e.prototype.updatePredecessorHelper=function(e,i,r){if(t.isUndefined(i)||this.validatePredecessorRelation(e,i)){this.parent.isOnEdit=!0;var a=[];t.isNullOrUndefined(i)||""===i||(a=this.parent.predecessorModule.calculatePredecessor(i,e)),this.parent.setRecordValue("predecessor",a,e.ganttProperties,!0);var n=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",n,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,n,e),this.parent.setRecordValue(this.parent.taskFields.dependency,n,e);var s={};return s.action=r&&r.action&&"CellEditing"===r.action?r.action:"DrawConnectorLine",s.data=e,this.parent.editModule.initiateUpdateAction(s),!0}return!1},e.prototype.checkParentRelation=function(e,t){var i=e;if(i&&i.parentItem&&-1!==t.indexOf(i.parentItem.taskId.toString()))return!1;for(var r=function(e){var i=a.parent.currentViewData.filter(function(i){return i&&i.ganttProperties.rowUniqueID.toString()===t[e].toString()});if(i[0]&&i[0].hasChildRecords)return{value:!1}},a=this,n=0;n<t.length;n++){var s=r(n);if("object"==typeof s)return s.value}return!0},e.prototype.initPredecessorValidationDialog=function(){if(this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation){var e=t.createElement("div",{id:this.parent.element.id+"_dialogValidationRule"});this.parent.element.appendChild(e),this.renderValidationDialog()}},e.prototype.renderValidationDialog=function(){var e=new i.Dialog({header:"Validate Editing",isModal:!0,enableRtl:this.parent.enableRtl,visible:!1,width:"50%",showCloseIcon:!0,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:this.parent.element,animationSettings:{effect:"None"}});document.getElementById(this.parent.element.id+"_dialogValidationRule").innerHTML="",e.isStringTemplate=!0,e.appendTo("#"+this.parent.element.id+"_dialogValidationRule"),this.parent.validationDialogElement=e},e.prototype.validationDialogOkButton=function(){var e=this.parent.currentEditedArgs;e.validateMode.preserveLinkWithEditing=document.getElementById(this.parent.element.id+"_ValidationAddlineOffset").checked,e.validateMode.removeLink=document.getElementById(this.parent.element.id+"_ValidationRemoveline").checked,e.validateMode.respectLink=document.getElementById(this.parent.element.id+"_ValidationCancel").checked,this.applyPredecessorOption(),this.parent.validationDialogElement.hide()},e.prototype.validationDialogCancelButton=function(){this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption(),this.parent.validationDialogElement.hide()},e.prototype.validationDialogClose=function(e){t.getValue("isInteraction",e)&&(this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption())},e.prototype.applyPredecessorOption=function(){var e=this.parent.currentEditedArgs,t=e.data;e.validateMode.respectLink?(this.parent.editModule.reUpdatePreviousRecords(),this.parent.chartRowsModule.refreshRecords([e.data])):e.validateMode.removeLink?(this.checkChildRecords(t),this.parent.editModule.updateEditedTask(e.editEventArgs)):e.validateMode.preserveLinkWithEditing&&(this.parent.UpdateOffsetOnTaskbarEdit&&this.calculateOffset(t),this.parent.editModule.updateEditedTask(e.editEventArgs))},e.prototype.checkChildRecords=function(e){if(this.validationPredecessor=e.ganttProperties.predecessor,t.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(e,this.validationPredecessor),e.childRecords.length>0)for(var i=0;i<e.childRecords.length;i++){var r=e.childRecords[i];this.validationPredecessor=r.ganttProperties.predecessor,t.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(r,this.validationPredecessor),r.childRecords.length>0&&this.checkChildRecords(r)}else if(!t.isNullOrUndefined(e.parentItem)){var a=this.parent.getRecordByID(e.parentItem.taskId);this.validationPredecessor=a.ganttProperties.predecessor,this.removePredecessors(a,this.validationPredecessor)}},e.prototype.calculateOffset=function(e){for(var i=t.extend([],e.ganttProperties.predecessor,[],!0),r=this.parent.predecessorModule.getValidPredecessor(e),a=0;a<r.length;a++){var n=r[parseInt(a.toString(),10)],s=this.parent.connectorLineModule.getRecordByID(n.from),o=void 0;if(m(s.ganttProperties)&&m(e.ganttProperties)){var l=void 0,d=void 0,h=void 0,p=void 0;switch(n.type){case"FS":l=new Date(s.ganttProperties.endDate.getTime()),d=new Date(e.ganttProperties.startDate.getTime());break;case"SS":l=new Date(s.ganttProperties.startDate.getTime()),d=new Date(e.ganttProperties.startDate.getTime());break;case"SF":l=new Date(s.ganttProperties.startDate.getTime()),d=new Date(e.ganttProperties.endDate.getTime());break;case"FF":l=new Date(s.ganttProperties.endDate.getTime()),d=new Date(e.ganttProperties.endDate.getTime())}if(l.getTime()<d.getTime())l=this.dateValidateModule.checkStartDate(l),d=this.dateValidateModule.checkEndDate(d,null),p=!1;else{var c=new Date(l.getTime());l=this.dateValidateModule.checkStartDate(d),d=this.dateValidateModule.checkEndDate(c,null),p=!0}l.getTime()<d.getTime()?(h=this.dateValidateModule.getDuration(l,d,n.offsetUnit,!0,!1),o=p?-1*h:h):o=0}else o=0;i[b(n,"from",i,"to")].offset=o;var u=t.extend([],s.ganttProperties.predecessor,[],!0);u[b(n,"from",u,"to")].offset=o,this.parent.setRecordValue("predecessor",u,s.ganttProperties,!0)}this.parent.setRecordValue("predecessor",i,e.ganttProperties,!0);var g=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,g,e),this.parent.setRecordValue(this.parent.taskFields.dependency,g,e),this.parent.setRecordValue("predecessorsName",g,e.ganttProperties,!0)},e.prototype.removePredecessors=function(e,i){var r=t.extend([],[],e.ganttProperties.predecessor,!0);if(!t.isNullOrUndefined(i)){for(var a=i.length,n=0;n<a;n++){var s=this.parent.connectorLineModule.getRecordByID(i[n].from),o=t.extend([],[],s.ganttProperties.predecessor,!0),l=b(i[n],"from",r,"to");r.splice(l,1);var d=b(i[parseInt(n.toString(),10)],"from",o,"to");o.splice(d,1),this.parent.setRecordValue("predecessor",o,s.ganttProperties,!0)}if(r.length!==e.ganttProperties.predecessor.length){this.parent.setRecordValue("predecessor",r,e.ganttProperties,!0);var h=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",h,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,h,e),this.parent.setRecordValue(this.parent.taskFields.dependency,h,e)}}},e.prototype.openValidationDialog=function(e){var t=this.validationDialogTemplate(e);this.parent.validationDialogElement.setProperties({content:t}),this.parent.validationDialogElement.show()},e.prototype.validationDialogTemplate=function(e){var i,r=this.parent.element.id,a=t.createElement("div",{className:"e-ValidationContent"}),n=t.getValue("task",e),s=t.getValue("parentTask",e),o=t.getValue("violationType",e),l=n.ganttProperties.taskName,d=this.parent.getFormatedDate(n.ganttProperties.startDate,"MM/dd/yyyy"),h=[l,s.ganttProperties.taskName];"taskBeforePredecessor_FS"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_FS"):"taskAfterPredecessor_FS"===o?i=this.parent.localeObj.getConstant("taskAfterPredecessor_FS"):"taskBeforePredecessor_SS"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_SS"):"taskAfterPredecessor_SS"===o?i=this.parent.localeObj.getConstant("taskAfterPredecessor_SS"):"taskBeforePredecessor_FF"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_FF"):"taskAfterPredecessor_FF"===o?i=this.parent.localeObj.getConstant("taskAfterPredecessor_FF"):"taskBeforePredecessor_SF"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_SF"):"taskAfterPredecessor_SF"===o&&(i=this.parent.localeObj.getConstant("taskAfterPredecessor_SF"));var p='<div id="'+r+'_ValidationText">'+(i=T(i,h))+"<div>",c='<table><tr><td><input type="radio" id="'+r+'_ValidationCancel" name="ValidationRule" checked/><label for="'+r+'_ValidationCancel" id= "'+r+'_cancelLink">Cancel, keep the existing link</label></td></tr><tr><td><input type="radio" id="'+r+'_ValidationRemoveline" name="ValidationRule"/><label for="'+r+'_ValidationRemoveline" id="'+r+'_removeLink">Remove the link and move <b>'+l+"</b> to start on <b>"+d+'</b>.</label></td></tr><tr><td><input type="radio" id="'+r+'_ValidationAddlineOffset" name="ValidationRule"/><label for="'+r+'_ValidationAddlineOffset" id="'+r+'_preserveLink">Move the <b>'+l+"</b> to start on <b>"+d+"</b> and keep the link.</label></td></tr></table>";return a.innerHTML=p+c,a},e.prototype.validateTypes=function(e,i){var r,a=this.parent.predecessorModule.getValidPredecessor(e);this.validationPredecessor=[];var n,s,o,l=this.parent.predecessorModule.getPredecessorDate(e,a);s=i?i.ganttProperties:e.ganttProperties;for(var d=this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(l)?s.endDate:this.dateValidateModule.getEndDate(l,s.duration,s.durationUnit,s,!1),h=0;h<a.length;h++){r=this.parent.connectorLineModule.getRecordByID(a[h].from);var p=null;"FS"===a[h].type?s.startDate<l?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FS"):s.startDate>l&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FS"):"SS"===a[h].type?s.startDate<l?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SS"):s.startDate>l&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SS"):"FF"===a[h].type?d<=r.ganttProperties.endDate?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FF"):d>r.ganttProperties.endDate&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FF"):"SF"===a[h].type&&(d<r.ganttProperties.startDate?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SF"):d>=r.ganttProperties.startDate&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SF")),!t.isNullOrUndefined(p)&&t.isNullOrUndefined(o)&&(n=r,o=p)}return{parentTask:n,task:e,violationType:o}},e.prototype.addRemovePredecessor=function(e){var i=this.parent.previousRecords[e.uniqueID],r=e.ganttProperties.predecessor.slice();if(i&&i.ganttProperties&&i.ganttProperties.hasOwnProperty("predecessor")){var a=i.ganttProperties.predecessor;if(!t.isNullOrUndefined(a))for(var n=0;n<a.length;n++){if((d=this.parent.connectorLineModule.getRecordByID(a[parseInt(n.toString(),10)].from))===e)e.ganttProperties.predecessor.push(a[parseInt(n.toString(),10)]);else{var s=t.extend([],[],d.ganttProperties.predecessor,!0),o=b(a[parseInt(n.toString(),10)],"from",s,"to");-1!==o&&(s.splice(o,1),this.parent.setRecordValue("predecessor",s,d.ganttProperties,!0))}}if(!t.isNullOrUndefined(r))for(var l=0;l<r.length;l++){var d=this.parent.connectorLineModule.getRecordByID(r[parseInt(l.toString(),10)].from);(s=t.extend([],[],d.ganttProperties.predecessor,!0)).push(r[parseInt(l.toString(),10)]),this.parent.setRecordValue("predecessor",s,d.ganttProperties,!0)}}},e.prototype.removePredecessorByIndex=function(e,t){var i=e.ganttProperties.predecessor,r=i.splice(t,1),a=this.parent.connectorLineModule.getRecordByID(r[0].from).ganttProperties.predecessor,n=b(r[0],"from",a,"to");a.splice(n,1);var s=this.parent.predecessorModule.getPredecessorStringValue(e);i.push(r[0]),this.parent.connectorLineEditModule.updatePredecessor(e,s)},e.prototype.renderPredecessorDeleteConfirmDialog=function(){this.confirmPredecessorDialog=new i.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=t.createElement("div",{id:this.parent.element.id+"_deletePredecessorConfirmDialog"});this.parent.element.appendChild(e),this.confirmPredecessorDialog.isStringTemplate=!0,this.confirmPredecessorDialog.appendTo(e)},e.prototype.confirmCloseDialog=function(){this.confirmPredecessorDialog.destroy()},e.prototype.confirmOkDeleteButton=function(){this.removePredecessorByIndex(this.childRecord,this.predecessorIndex),this.confirmPredecessorDialog.destroy()},e}(),li=function(){function e(e){if(this.isFromDeleteMethod=!1,this.targetedRecords=[],this.isNewRecordAdded=!1,this.isValidatedEditedRecord=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.confirmDialog=null,this.taskbarMoved=!1,this.predecessorUpdated=!1,this.isBreakLoop=!1,this.isResourceTaskDeleted=!1,this.deletedTaskDetails=[],this.parent=e,this.validatedChildItems=[],this.parent.editSettings.allowEditing&&"Auto"===this.parent.editSettings.mode&&(this.cellEditModule=new ti(this.parent)),this.parent.taskFields.dependency&&(this.parent.connectorLineEditModule=new oi(this.parent)),(this.parent.editSettings.allowAdding||this.parent.editSettings.allowEditing&&("Dialog"===this.parent.editSettings.mode||"Auto"===this.parent.editSettings.mode))&&(this.dialogModule=new si(this.parent)),this.parent.editSettings.allowTaskbarEditing&&(this.taskbarEditModule=new ni(this.parent)),this.parent.editSettings.allowDeleting){var i=t.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"});this.parent.element.appendChild(i),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,this.updateDefaultColumnEditors()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.updateDefaultColumnEditors=function(){for(var e=[this.parent.taskFields.id,this.parent.taskFields.progress,this.parent.taskFields.resourceInfo,"taskType"],i=0;i<e.length;i++)if(!t.isNullOrUndefined(e[i])&&e[i].length>0){var r=this.parent.getColumnByField(e[i],this.parent.treeGridModule.treeGridColumns);r&&(r.field===this.parent.taskFields.id?this.updateIDColumnEditParams(r):r.field===this.parent.taskFields.progress&&t.isNullOrUndefined(r.edit)?this.updateProgessColumnEditParams(r):r.field===this.parent.taskFields.resourceInfo?this.updateResourceColumnEditor(r):"taskType"===r.field&&this.updateTaskTypeColumnEditor(r))}},e.prototype.updateIDColumnEditParams=function(e){var t={min:0,decimals:0,enableRtl:this.parent.enableRtl,validateDecimalOnType:!0,format:"n0",showSpinButton:!1};this.updateEditParams(e,t)},e.prototype.updateProgessColumnEditParams=function(e){var t={min:0,enableRtl:this.parent.enableRtl,decimals:0,validateDecimalOnType:!0,max:100,format:"n0"};this.updateEditParams(e,t)},e.prototype.updateEditParams=function(e,i){t.isNullOrUndefined(e.edit)?(e.edit={},e.edit.params={}):t.isNullOrUndefined(e.edit.params)&&(e.edit.params={}),t.extend(i,e.edit.params),e.edit.params=i;this.parent.getColumnByField(e.field,this.parent.ganttColumns).edit=e.edit},e.prototype.updateResourceColumnEditor=function(e){if(this.parent.editSettings.allowEditing&&t.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode){e.editType="dropdownedit",e.edit=this.getResourceEditor();var i=this.parent.getColumnByField(e.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=e.edit}},e.prototype.getResourceEditor=function(){var e,i=this,r=this.parent.resourceFields,n={};return u.MultiSelect.Inject(u.CheckBoxSelection),n.write=function(t){i.parent.treeGridModule.currentEditRow={},(e=new u.MultiSelect({dataSource:new a.DataManager(i.parent.resources),fields:{text:r.name,value:r.id},enableRtl:i.parent.enableRtl,mode:"CheckBox",showDropDownIcon:!0,popupHeight:"350px",delimiterChar:",",value:i.parent.treeGridModule.getResourceIds(t.rowData)})).appendTo(t.element)},n.read=function(e){var a=e.ej2_instances[0].value,n=[];t.isNullOrUndefined(a)&&(a=[]);for(var s=0;s<a.length;s++)for(var o=0;o<i.parent.resources.length;o++)if(i.parent.resources[o][r.id]===a[s]){n.push(i.parent.resources[o][r.name]);break}return i.parent.treeGridModule.currentEditRow[i.parent.taskFields.resourceInfo]=a,n.join(",")},n.destroy=function(){e&&e.destroy()},n},e.prototype.updateTaskTypeColumnEditor=function(e){if(this.parent.editSettings.allowEditing&&t.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode){e.editType="dropdownedit",e.edit=this.getTaskTypeEditor();var i=this.parent.getColumnByField(e.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=e.edit}},e.prototype.getTaskTypeEditor=function(){var e,i=this,r={},n=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}];return r.write=function(r){i.parent.treeGridModule.currentEditRow={},(e=new u.DropDownList({dataSource:new a.DataManager(n),enableRtl:i.parent.enableRtl,fields:{value:"Value"},popupHeight:"350px",value:t.getValue("taskType",r.rowData.ganttProperties)})).appendTo(r.element)},r.read=function(e){var t=e.ej2_instances[0].value;return i.parent.treeGridModule.currentEditRow.taskType=t,t},r.destroy=function(){e&&e.destroy()},r},e.prototype.reUpdateEditModules=function(){var e=this.parent.editSettings;if(e.allowEditing?(this.parent.editModule.cellEditModule&&"Dialog"===e.mode?(this.cellEditModule.destroy(),this.parent.treeGrid.recordDoubleClick=this.recordDoubleClick.bind(this)):t.isNullOrUndefined(this.parent.editModule.cellEditModule)&&"Auto"===e.mode&&(this.cellEditModule=new ti(this.parent)),this.parent.editModule.dialogModule&&"Auto"===e.mode?this.parent.treeGrid.recordDoubleClick=void 0:t.isNullOrUndefined(this.parent.editModule.dialogModule)&&(this.dialogModule=new si(this.parent))):(this.cellEditModule&&this.cellEditModule.destroy(),this.dialogModule&&this.dialogModule.destroy()),e.allowDeleting&&e.showDeleteConfirmDialog){if(t.isNullOrUndefined(this.confirmDialog)){var i=t.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"});this.parent.element.appendChild(i),this.renderDeleteConfirmDialog()}}else e.allowDeleting&&e.showDeleteConfirmDialog||this.confirmDialog&&!this.confirmDialog.isDestroyed&&this.confirmDialog.destroy();e.allowTaskbarEditing?t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&(this.taskbarEditModule=new ni(this.parent)):this.taskbarEditModule&&this.taskbarEditModule.destroy()},e.prototype.recordDoubleClick=function(e){if(this.parent.editSettings.allowEditing&&"Dialog"===this.parent.editSettings.mode){var i=void 0;if(e.row){var r=t.getValue("rowIndex",e.row);i=this.parent.currentViewData[r]}t.isNullOrUndefined(i)||this.dialogModule.openEditDialog(i)}this.parent.ganttChartModule.recordDoubleClick(e)},e.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()},e.prototype.updateRecordByID=function(e){if(!this.parent.readOnly){var i=this.parent.taskFields;if(t.isNullOrUndefined(e)||t.isNullOrUndefined(e[i.id]))return;var r="ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf("T"+e[i.id])]:this.parent.getRecordByID(e[i.id]);if(!t.isNullOrUndefined(this.parent.editModule)&&r){this.parent.isOnEdit=!0,this.validateUpdateValues(e,r,!0),e[this.parent.taskFields.resourceInfo]&&(0===r.ganttProperties.duration&&this.parent.dataOperation.updateWorkWithDuration(r),this.updateResourceRelatedFields(r,"resource"),this.parent.dateValidationModule.calculateEndDate(r));var a=Object.keys(e);if(-1===a.indexOf(i.startDate)&&-1===a.indexOf(i.endDate)&&-1===a.indexOf(i.duration)||this.parent.dataOperation.calculateScheduledValues(r,r.taskData,!1),this.parent.dataOperation.updateWidthLeft(r),t.isUndefined(e[this.parent.taskFields.dependency])||e[this.parent.taskFields.dependency]===r.ganttProperties.predecessorsName){var n={};n.data=r,"ResourceView"===this.parent.viewType&&(n.action="methodUpdate"),this.parent.editModule.initiateUpdateAction(n)}else this.parent.connectorLineEditModule.updatePredecessor(r,e[this.parent.taskFields.dependency])}}},e.prototype.validateUpdateValues=function(e,i,r){for(var a=this.parent,n=a.taskFields,s=D(a.columnMapping),o=[],l=!1,d=0,h=Object.keys(e);d<h.length;d++){var p=h[d];if(-1!==[n.startDate,n.endDate,n.duration].indexOf(p)){if(t.isNullOrUndefined(e[""+p])&&!a.allowUnscheduledTasks)continue;if(r)if(n.duration===p)a.dataOperation.updateDurationValue(e[p],i.ganttProperties),i.ganttProperties.duration>0&&i.ganttProperties.isMilestone&&this.parent.setRecordValue("isMilestone",!1,i.ganttProperties,!0),a.dataOperation.updateMappingData(i,s[p]);else{var c="string"==typeof e[p]?new Date(e[p]):e[p];a.setRecordValue(s[p],c,i.ganttProperties,!0),a.dataOperation.updateMappingData(i,s[p])}else o.push(p),l=!0}else if(n.resourceInfo===p){var u=a.dataOperation.setResourceInfo(e);"ResourceView"===this.parent.viewType&&(JSON.stringify(u)!==JSON.stringify(i.ganttProperties.resourceInfo)?(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=t.isNullOrUndefined(i.ganttProperties.resourceInfo)?[]:i.ganttProperties.resourceInfo.slice()):this.parent.editModule.dialogModule.isResourceUpdate=!1),i.ganttProperties.resourceInfo=u,a.dataOperation.updateMappingData(i,"resourceInfo")}else if(n.dependency===p);else if(-1!==[n.progress,n.notes,n.durationUnit,n.expandState,n.milestone,n.name,n.baselineStartDate,n.baselineEndDate,n.id,n.segments,n.cssClass].indexOf(p)){var g=a.columnByField[p],f=e[p];t.isNullOrUndefined(g)||"datepickeredit"!==g.editType&&"datetimepickeredit"!==g.editType||(f=a.dataOperation.getDateFromFormat(f));var m=s[p];if(p===n.id)m="taskId";else if(p===n.name)m="taskName";else if(p===n.cssClass)m="cssClass";else if(p===n.segments&&!t.isNullOrUndefined(i.ganttProperties.segments)&&(m="segments",e&&!t.isNullOrUndefined(e[this.parent.taskFields.segments])&&e[this.parent.taskFields.segments].length>0)){for(var y=0,v=0;v<i.ganttProperties.segments.length;v++)y+=i.ganttProperties.segments[v].duration;var w=i.ganttProperties.startDate,k=this.parent.dataOperation.getEndDate(w,y,i.ganttProperties.durationUnit,i.ganttProperties,!1);a.setRecordValue("endDate",a.dataOperation.getDateFromFormat(k),i.ganttProperties,!0)}t.isNullOrUndefined(m)||a.setRecordValue(m,f,i.ganttProperties,!0),(p===n.baselineStartDate||p===n.baselineEndDate)&&i.ganttProperties.baselineStartDate&&i.ganttProperties.baselineEndDate&&(a.setRecordValue("baselineStartDate",a.dataOperation.checkBaselineStartDate(i.ganttProperties.baselineStartDate),i.ganttProperties,!0),i.ganttProperties.baselineEndDate&&0===i.ganttProperties.baselineEndDate.getHours()&&86400!==this.parent.defaultEndTime&&a.dataOperation.setTime(this.parent.defaultEndTime,i.ganttProperties.baselineEndDate),a.setRecordValue("baselineEndDate",a.dataOperation.checkBaselineEndDate(i.ganttProperties.baselineEndDate),i.ganttProperties,!0),a.setRecordValue("baselineLeft",a.dataOperation.calculateBaselineLeft(i.ganttProperties),i.ganttProperties,!0),a.setRecordValue("baselineWidth",a.dataOperation.calculateBaselineWidth(i.ganttProperties),i.ganttProperties,!0)),a.setRecordValue("taskData."+p,f,i),p===n.segments&&e&&!t.isNullOrUndefined(e[this.parent.taskFields.segments])&&e[this.parent.taskFields.segments].length>0&&a.dataOperation.setSegmentsInfo(i,!0),a.setRecordValue(p,f,i)}else if(n.indicators===p){f=e[p];a.setRecordValue("indicators",f,i.ganttProperties,!0),a.setRecordValue("taskData."+p,f,i),a.setRecordValue(p,f,i)}else if(n.work===p)a.setRecordValue("work",e[p],i.ganttProperties,!0),this.parent.dataOperation.updateMappingData(i,"work"),this.parent.dataOperation.updateMappingData(i,"duration"),this.parent.dataOperation.updateMappingData(i,"endDate");else if(p===n.type)a.setRecordValue("taskType",e[p],i.ganttProperties,!0);else if(-1!==a.customColumns.indexOf(p)){g=a.columnByField[p],f=e[p];t.isNullOrUndefined(g.edit)&&("datepickeredit"!==g.editType&&"datetimepickeredit"!==g.editType||(f=a.dataOperation.getDateFromFormat(f))),a.setRecordValue("taskData."+p,f,i),a.setRecordValue(p,f,i)}else n.manual===p&&(a.setRecordValue("isAutoSchedule",!e[p],i.ganttProperties,!0),this.parent.setRecordValue(p,e[p],i),this.updateTaskScheduleModes(i))}l&&this.validateScheduleValues(o,i,e)},e.prototype.updateResourceRelatedFields=function(e,i){var r=e.ganttProperties,a=r.taskType,n=r.isAutoSchedule;if(!t.isNullOrUndefined(r.resourceInfo))if(r.work>0||"work"===i)switch(a){case"FixedUnit":if(0===r.resourceInfo.length)return;n&&r.resourceInfo.length&&("work"===i||"resource"===i)?this.parent.dataOperation.updateDurationWithWork(e):n||"work"!==i?this.parent.dataOperation.updateWorkWithDuration(e):this.parent.dataOperation.updateUnitWithWork(e);break;case"FixedWork":if(0===r.resourceInfo.length)return;n?"duration"===i||"endDate"===i?(this.parent.dataOperation.updateUnitWithWork(e),0===r.duration&&(this.parent.setRecordValue("work",0,r,!0),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(e,"work"))):this.parent.dataOperation.updateDurationWithWork(e):"work"===i?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e);break;case"FixedDuration":r.resourceInfo.length&&"work"===i?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e)}else this.parent.dataOperation.updateWorkWithDuration(e)},e.prototype.validateScheduleValues=function(e,t,i){var r=this.parent;e.length>2?r.dataOperation.calculateScheduledValues(t,i,!1):e.length>1?this.validateScheduleByTwoValues(i,e,t):this.dialogModule.validateScheduleValuesByCurrentField(e[0],i[e[0]],t)},e.prototype.validateScheduleByTwoValues=function(e,t,i){var r,a,n,s=this.parent,o=s.taskFields,l=i.ganttProperties,d=s.allowUnscheduledTasks;-1!==t.indexOf(o.startDate)&&(r=e[o.startDate]),-1!==t.indexOf(o.endDate)&&(a=e[o.endDate]),-1!==t.indexOf(o.duration)&&(n=e[o.duration]),r&&a||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.endDate)?(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(r),l,!0),s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(a),l,!0),s.dataOperation.calculateDuration(i)):a&&n||d&&-1!==t.indexOf(o.endDate)&&-1!==t.indexOf(o.duration)?(s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(a),l,!0),s.dataOperation.updateDurationValue(n,l)):(r&&n||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.duration))&&(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(r),l,!0),s.dataOperation.updateDurationValue(n,l))},e.prototype.isTaskbarMoved=function(e){var i=!1,r=e.ganttProperties,a=this.parent.previousRecords&&this.parent.previousRecords[e.uniqueID];if(a&&a.ganttProperties){var n=t.getValue("ganttProperties.startDate",a),s=t.getValue("ganttProperties.endDate",a),o=t.getValue("ganttProperties.duration",a),l=t.getValue("ganttProperties.durationUnit",a),d=Object.keys(a.ganttProperties);-1===d.indexOf("startDate")&&-1===d.indexOf("endDate")&&-1===d.indexOf("duration")&&-1===d.indexOf("durationUnit")||(t.isNullOrUndefined(n)&&!t.isNullOrUndefined(r.startDate)||t.isNullOrUndefined(s)&&!t.isNullOrUndefined(r.endDate)||t.isNullOrUndefined(r.startDate)&&!t.isNullOrUndefined(n)||t.isNullOrUndefined(r.endDate)&&!t.isNullOrUndefined(s)||n&&n.getTime()!==r.startDate.getTime()||s&&s.getTime()!==r.endDate.getTime()||!t.isNullOrUndefined(o)&&o!==r.duration||!t.isNullOrUndefined(o)&&o===r.duration&&l!==r.durationUnit)&&(i=!0)}return i},e.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?t=!0:this.parent.setRecordValue("predecessor",i.ganttProperties.predecessor,e.ganttProperties,!0)),t},e.prototype.isCheckPredecessor=function(e){var t=!1;return this.parent.previousRecords[e.uniqueID]&&this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation&&this.parent.predecessorModule.getValidPredecessor(e).length>0&&this.isTaskbarMoved(e)&&(t=!0),t},e.prototype.updateGanttProperties=function(e,t){var i=["taskId","uniqueID","rowUniqueID","parentId"];Object.keys(e.ganttProperties).forEach(function(r){-1===i.indexOf(r)&&(t.ganttProperties[r]=e.ganttProperties[r])})},e.prototype.initiateUpdateAction=function(e){var i,r,a=this.isCheckPredecessor(e.data);if(t.isNullOrUndefined(e.data.parentItem)||a){if(e.data.childRecords.length>0&&!a&&!(a=this.isCheckPredecessor(e.data))&&this.isTaskbarMoved(e.data))for(var n=0;n<e.data.childRecords.length;n++)this.parent.predecessorModule.getValidPredecessor(e.data.childRecords[n]).length>0&&(r=n,a=!0)}else i=this.parent.getRecordByID(e.data.parentItem.taskId),a=!!(this.isTaskbarMoved(e.data)&&this.parent.predecessorModule.getValidPredecessor(i).length>0&&this.parent.isInPredecessorValidation);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 s={};if(a)if(s=t.isNullOrUndefined(i)?t.isNullOrUndefined(r)?this.parent.connectorLineEditModule.validateTypes(e.data):this.parent.connectorLineEditModule.validateTypes(e.data.childRecords[r],e.data):this.parent.connectorLineEditModule.validateTypes(i,e.data),this.parent.isConnectorLineUpdate=!0,t.isNullOrUndefined(t.getValue("violationType",s)))this.updateEditedTask(e);else{var o=this.validateTaskEvent(e);!1===o.validateMode.preserveLinkWithEditing&&!1===o.validateMode.removeLink&&!1===o.validateMode.respectLink?this.parent.connectorLineEditModule.openValidationDialog(s):(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())}else this.taskbarMoved&&(this.parent.isConnectorLineUpdate=!0),this.updateEditedTask(e)},e.prototype.validateTaskEvent=function(e){var t={};return this.resetValidateArgs(),this.parent.currentEditedArgs=t,t.cancel=!1,t.data=e.data,t.requestType="validateLinkedTask",t.validateMode=this.parent.dialogValidateMode,t.editEventArgs=e,this.parent.actionBeginTask(t),t},e.prototype.resetValidateArgs=function(){this.parent.dialogValidateMode.preserveLinkWithEditing=!0,this.parent.dialogValidateMode.removeLink=!1,this.parent.dialogValidateMode.respectLink=!1},e.prototype.updateEditedTask=function(e){var t=e.data;if(this.parent.autoCalculateDateScheduling&&this.updateParentChildRecord(t),this.parent.isConnectorLineUpdate&&this.parent.autoCalculateDateScheduling){for(var i=0;i<this.validatedChildItems.length;i++){var r=this.validatedChildItems[i];r.ganttProperties.predecessor&&r.ganttProperties.predecessor.length>0&&(this.parent.editedTaskBarItem=r,this.parent.predecessorModule.validatePredecessor(r,[],""))}this.parent.predecessorModule.isValidatedParentTaskID="",t.ganttProperties.predecessor&&(this.parent.isMileStoneEdited=t.ganttProperties.isMilestone,this.taskbarMoved&&(this.parent.editedTaskBarItem=t),this.isValidatedEditedRecord||this.parent.predecessorModule.validatePredecessor(t,[],""),this.isValidatedEditedRecord=!1,this.parent.predecessorModule.isValidatedParentTaskID=""),(this.parent.allowParentDependency&&t.hasChildRecords&&this.parent.previousRecords[t.uniqueID].ganttProperties.startDate&&"DrawConnectorLine"===e.action||"DialogEditing"===e.action)&&this.updateChildItems(t),this.updateParentItemOnEditing()}if(t.parentItem){this.parent.autoCalculateDateScheduling&&this.parent.dataOperation.updateParentItems(t,!0);var a=this.parent.getRecordByID(t.parentItem.taskId);a.ganttProperties.predecessorsName||(this.parent.predecessorModule.validatePredecessor(a,[],""),this.updateParentItemOnEditing())}this.initiateSaveAction(e)},e.prototype.updateParentItemOnEditing=function(){for(var e=t.getValue("parentRecord",this.parent.predecessorModule),i=0;i<e.length;i++)this.parent.dataOperation.updateParentItems(e[i]);t.setValue("parentRecord",[],this.parent.predecessorModule),t.setValue("parentIds",[],this.parent.predecessorModule)},e.prototype.updateParentChildRecord=function(e){var i=e;i.hasChildRecords&&this.taskbarMoved&&"Auto"===this.parent.taskMode&&!t.isNullOrUndefined(this.parent.editModule.cellEditModule)&&!this.parent.editModule.cellEditModule.isResourceCellEdited&&this.updateChildItems(i),t.isNullOrUndefined(this.parent.editModule.cellEditModule)||(this.parent.editModule.cellEditModule.isResourceCellEdited=!1)},e.prototype.updateTaskScheduleModes=function(e){var t=e[this.parent.taskFields.startDate],i=e.ganttProperties;if(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,!0),i,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.width,i.progress),i,!0),this.parent.dataOperation.calculateDuration(e);else if(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);else{var r=this.parent.dateValidationModule.checkStartDate(t,e.ganttProperties);this.parent.setRecordValue("startDate",r,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)}},e.prototype.calculateDateByRoundOffDuration=function(e,i){var r=e,a=r.ganttProperties,n=new Date(i.getTime());if(!t.isNullOrUndefined(a.endDate)&&t.isNullOrUndefined(a.startDate)){var s=this.parent.dateValidationModule.checkStartDate(n,a,null);this.parent.setRecordValue("endDate",this.parent.dateValidationModule.checkEndDate(s,r.ganttProperties),a,!0)}else this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(n,a,!1),a,!0),t.isNullOrUndefined(a.duration)||this.parent.dateValidationModule.calculateEndDate(r);this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateTaskData(r)},e.prototype.updateParentProgress=function(e){var i=0,r=this.parent.getParentTask(e),a=r.childRecords,n=a?a.length:0,s=0,o=0,l=0,d={};if(a){for(var h=0;h<n;h++)a[h].ganttProperties.isMilestone&&!a[h].hasChildRecords||!m(a[h].ganttProperties)?o+=1:(d=this.parent.dataOperation.getParentProgress(a[h]),s+=t.getValue("totalProgress",d),l+=t.getValue("totalDuration",d));i=n-o>0?Math.round(s/l):0,isNaN(i)&&(i=0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(r.ganttProperties.isAutoSchedule?r.ganttProperties.width:r.ganttProperties.autoWidth,i),r.ganttProperties,!0),this.parent.setRecordValue("progress",Math.floor(i),r.ganttProperties,!0),this.parent.setRecordValue("totalProgress",s,r.ganttProperties,!0),this.parent.setRecordValue("totalDuration",l,r.ganttProperties,!0)}this.parent.dataOperation.updateTaskData(r),r.parentItem&&this.updateParentProgress(r.parentItem)},e.prototype.revertCellEdit=function(e){this.parent.editModule.reUpdatePreviousRecords(!1,!0),this.resetEditProperties()},e.prototype.reUpdatePreviousRecords=function(e,t){for(var i=this.parent.previousRecords,r=Object.keys(i),a=0;a<r.length;a++){var n=r[a],s=i[n],o=this.parent.getTaskByUniqueID(n);this.copyTaskData(o.taskData,s.taskData),delete s.taskData,this.copyTaskData(o.ganttProperties,s.ganttProperties),delete s.ganttProperties,this.copyTaskData(o,s);var l=this.parent.currentViewData.indexOf(o);if(e&&this.parent.chartRowsModule.refreshRow(l),t){var d="ProjectView"===this.parent.viewType?o.ganttProperties.taskId:o.ganttProperties.rowUniqueID;this.parent.treeGrid.grid.setRowData(d,o);this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[l].getAttribute("data-uid")).data=o}}},e.prototype.copyTaskData=function(e,i){t.isNullOrUndefined(i)||t.extend(e,i)},e.prototype.updateScheduleDatesOnEditing=function(e){},e.prototype.updateChildItems=function(e){var i,r=this.parent.previousRecords[e.uniqueID];t.isNullOrUndefined(r)||t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r.ganttProperties)?i=new Date(e.ganttProperties.startDate.getTime()):t.isNullOrUndefined(r.ganttProperties.startDate)||(i=new Date(r.ganttProperties.startDate.getTime()));var a,n,s,o,l,d=e.ganttProperties.startDate,h=[];if(this.getUpdatableChildRecords(e,h),0!==h.length){!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(d)&&i.getTime()>d.getTime()?(a=this.parent.dateValidationModule.checkStartDate(d),n=this.parent.dateValidationModule.checkEndDate(i,e.ganttProperties),o=!1):(a=this.parent.dateValidationModule.checkStartDate(i),n=this.parent.dateValidationModule.checkEndDate(d,e.ganttProperties),o=!0),l=!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(n)&&a.getTime()>=n.getTime()?0:this.parent.dateValidationModule.getDuration(a,n,"minute",!0,!1);for(var p=0;p<h.length;p++)if(h[p].ganttProperties.isAutoSchedule)if(l>0){var c=m(h[p].ganttProperties)?h[p].ganttProperties.startDate:h[p].ganttProperties.startDate?h[p].ganttProperties.startDate:h[p].ganttProperties.endDate?h[p].ganttProperties.endDate:new Date(i.toString());s=o?this.parent.dateValidationModule.getEndDate(this.parent.dateValidationModule.checkStartDate(c,h[p].ganttProperties,h[p].ganttProperties.isMilestone),l,"minute",h[p].ganttProperties,!1):this.parent.dateValidationModule.getStartDate(this.parent.dateValidationModule.checkEndDate(c,h[p].ganttProperties),l,"minute",h[p].ganttProperties),this.calculateDateByRoundOffDuration(h[p],s),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(h[p])&&this.validatedChildItems.push(h[p])}else if(t.isNullOrUndefined(r)){s=i;var u=this.parent.initialLoadData[h[p].index];this.parent.isLoad?this.calculateDateByRoundOffDuration(u,s):this.calculateDateByRoundOffDuration(h[p],s),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(h[p])&&this.validatedChildItems.push(h[p])}h.length&&this.parent.dataOperation.updateParentItems(e,!0)}},e.prototype.getUpdatableChildRecords=function(e,t){for(var i=e.childRecords,r=0;r<i.length;r++)i[r].ganttProperties.isAutoSchedule&&(t.push(i[r]),i[r].hasChildRecords&&this.getUpdatableChildRecords(i[r],t))},e.prototype.initiateSaveAction=function(e){var i=this,r={};r.requestType="beforeSave",r.data=e.data,r.cancel=!1,r.modifiedRecords=this.parent.editedRecords,t.isNullOrUndefined(e.target)||(r.target=e.target),r.modifiedTaskData=w(this.parent.editedRecords,!0),e.action&&"DrawConnectorLine"===e.action&&(r.action="DrawConnectorLine"),this.parent.trigger("actionBegin",r,function(n){if(t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),n.cancel)i.reUpdatePreviousRecords(),i.parent.chartRowsModule.refreshRecords([e.data]),i.resetEditProperties(r);else if(n.modifiedTaskData=w(n.modifiedRecords,null,null,i.parent),v(i.parent.dataSource)){var s=i.parent.dataSource,o={changedRecords:n.modifiedTaskData},l=i.parent.query instanceof a.Query?i.parent.query:new a.Query,d=null,h=s.adaptor;if(h instanceof a.WebApiAdaptor&&h instanceof a.ODataAdaptor&&!s.dataSource.batchUrl){d=s.update(i.parent.taskFields.id,o.changedRecords,null,l)}else d=s.saveChanges(o,i.parent.taskFields.id,null,l);d.then(function(t){return i.dmSuccess(t,e)}).catch(function(t){return i.dmFailure(t,e)})}else i.saveSuccess(e)})},e.prototype.dmSuccess=function(e,t){var i,r;i=e.changedRecords?e.changedRecords.length:e.length;for(var a=0;a<i;a++){r=e.changedRecords?e.changedRecords[parseInt(a.toString(),10)]:e[parseInt(a.toString(),10)];for(var n=Object.keys(r).length,s=0,o=Object.keys(r);s<n;s++){var l=o[parseInt(s.toString(),10)];this.parent.editedRecords[parseInt(a.toString(),10)][""+l]=r[""+l],this.parent.editedRecords[parseInt(a.toString(),10)].taskData[""+l]=r[""+l]}null!==this.parent.taskFields.id&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.taskId=r[this.parent.taskFields.id]),null!==this.parent.taskFields.name&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.taskName=r[this.parent.taskFields.name]),null!==this.parent.taskFields.startDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.startDate=r[this.parent.taskFields.startDate]),null!==this.parent.taskFields.endDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.endDate=r[this.parent.taskFields.endDate]),null!==this.parent.taskFields.duration&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.duration=parseInt(r[this.parent.taskFields.duration])),null!==this.parent.taskFields.durationUnit&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.durationUnit=r[this.parent.taskFields.durationUnit]),null!==this.parent.taskFields.progress&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.progress=r[this.parent.taskFields.progress]),null!==this.parent.taskFields.dependency&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.dependency=r[this.parent.taskFields.dependency]),null!==this.parent.taskFields.parentID&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.parentID=r[this.parent.taskFields.parentID]),null!==this.parent.taskFields.baselineEndDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.baselineEndDate=r[this.parent.taskFields.baselineEndDate]),null!==this.parent.taskFields.baselineStartDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.baselineStartDate=r[this.parent.taskFields.baselineStartDate]),null!==this.parent.taskFields.resourceInfo&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.resources=r[this.parent.taskFields.resourceInfo])}this.saveSuccess(t)},e.prototype.dmFailure=function(e,t){if(this.deletedTaskDetails.length){for(var i=this.deletedTaskDetails,r=0;r<i.length;r++)i[r].isDelete=!1;this.deletedTaskDetails=[]}this.reUpdatePreviousRecords(!0,!0),this.resetEditProperties(),this.parent.trigger("actionFailure",{error:e})},e.prototype.updateSharedTask=function(e){for(var i=e.ganttProperties.sharedTaskUniqueIds,r=0;r<i.length;r++){var a=this.parent.flatData[this.parent.ids.indexOf(i[r].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),t.isNullOrUndefined(a.parentItem)||this.parent.dataOperation.updateParentItems(a.parentItem))}},e.prototype.saveSuccess=function(e){var i={};if(this.parent.timelineSettings.updateTimescaleView){var r=this.parent.editedRecords;this.parent.timelineModule.updateTimeLineOnEditing([r],e.action)}if("ResourceView"===this.parent.viewType){"TaskbarEditing"===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 a=0;a<this.updateParentRecords.length;a++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[a]);this.updateParentRecords=[],this.parent.editModule.dialogModule.isResourceUpdate=!1,this.parent.editModule.dialogModule.previousResource=[]}if(this.isTreeGridRefresh||(this.parent.chartRowsModule.refreshRecords(this.parent.editedRecords),"ResourceView"===this.parent.viewType&&!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&&!t.isNullOrUndefined(this.parent.connectorLineEditModule)&&(this.parent.connectorLineEditModule.refreshEditedRecordConnectorLine(this.parent.editedRecords),this.updateScheduleDatesOnEditing(e))),!this.parent.editSettings.allowTaskbarEditing||this.parent.editSettings.allowTaskbarEditing&&!this.taskbarEditModule.dependencyCancel){if(i.requestType="save",i.data=e.data,i.modifiedRecords=this.parent.editedRecords,i.modifiedTaskData=w(this.parent.editedRecords,null,null,this.parent),t.isNullOrUndefined(e.action)||t.setValue("action",e.action,i),"TaskbarEditing"===e.action&&(i.taskBarEditAction=e.taskBarEditAction),this.endEditAction(e),this.parent.enableCriticalPath){var n=this.parent.criticalPathModule;n.showCriticalPath(!0),n.criticalConnectorLine(n.criticalPathCollection,n.detailPredecessorCollection,!0,n.predecessorCollectionTaskIds)}this.parent.trigger("actionComplete",i),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()}else this.taskbarEditModule.dependencyCancel=!1,this.resetEditProperties();"ResourceView"===this.parent.viewType&&this.isTreeGridRefresh&&(this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh(),this.isTreeGridRefresh=!1)},e.prototype.updateResoures=function(e,t,i){var r=this.parent.flatData,a=t?t.length:0,n=e?e.length:0;if(0!==a||0!==n){for(var s=0;s<a;s++){var o=[];"NaN"===(g=parseInt(t[s][this.parent.resourceFields.id],10).toString())&&(g=t[s][this.parent.resourceFields.id]);for(var l=0;l<e.length;l++){var d=parseInt(e[l][this.parent.resourceFields.id],10).toString();if("NaN"===d&&(d=e[l][this.parent.resourceFields.id]),d===g){o.push(l);break}}if(0===o.length){var h=r[this.parent.getTaskIds().indexOf("R"+g)];h&&this.addNewRecord(i,h)}else{var p=parseInt(o[0].toString(),10);"NaN"===p.toString()&&(p=o[0].toString()),e.splice(p,1)}}var c=e?e.length:0;for(s=0;s<c;s++)for(var u=i.ganttProperties.taskId,g=e[s][this.parent.resourceFields.id],f=r[this.parent.getTaskIds().indexOf("R"+g)],m=0;m<f.childRecords.length;m++)f.childRecords[m].ganttProperties.taskId===u&&this.removeChildRecord(f.childRecords[m]);if(a>0){var y=this.parent.getParentTask(i.parentItem);y&&y.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&this.removeChildRecord(i)}0===a&&this.checkWithUnassignedTask(i)}},e.prototype.checkWithUnassignedTask=function(e){for(var i=null,r=0;r<this.parent.flatData.length;r++)this.parent.flatData[r].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&(i=this.parent.flatData[r]);if(t.isNullOrUndefined(i)){var a={};a[this.parent.taskFields.id]=0,a[this.parent.taskFields.name]=this.parent.localeObj.getConstant("unassignedTask");var n=this.parent.isOnEdit;this.parent.isOnEdit=!1;var s=this.parent.dataOperation.createRecord(a,0);this.parent.isOnEdit=n,this.addRecordAsBottom(s);var o=this.parent.flatData[this.parent.flatData.length-1];this.addNewRecord(e,o);this.parent.dataSource.push(e.taskData)}else this.addNewRecord(e,i);var l=this.parent.currentViewData.filter(function(t){return t.ganttProperties.taskId===e.ganttProperties.taskId&&t.hasChildRecords===e.hasChildRecords})[0];e.parentItem=l.parentItem,e.parentUniqueID=l.parentUniqueID},e.prototype.addRecordAsBottom=function(e){var t=this.parent.flatData.length;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());var i=0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId;this.parent.getTaskIds().splice(t+1,0,i),this.updateTreeGridUniqueID(e,"add")},e.prototype.addNewRecord=function(e,i){var a=null;a=t.extend({},{},e,!0),this.parent.setRecordValue("uniqueID",r.getUid(this.parent.element.id+"_data_"),a),this.parent.setRecordValue("uniqueID",a.uniqueID,a.ganttProperties,!0);var n=a.uniqueID.replace(this.parent.element.id+"_data_","");this.parent.setRecordValue("rowUniqueID",n,a),this.parent.setRecordValue("rowUniqueID",n,a.ganttProperties,!0),this.parent.setRecordValue("level",1,a),this.parent.taskFields.parentID&&this.parent.setRecordValue("parentId",i.ganttProperties.taskId,a.ganttProperties,!0),this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(i),a);var s=a.parentItem?a.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",s,a),e.ganttProperties.sharedTaskUniqueIds.push(n),a.ganttProperties.sharedTaskUniqueIds=e.ganttProperties.sharedTaskUniqueIds,this.addRecordAsChild(i,a)},e.prototype.removeChildRecord=function(e){var t=this.parent,i=[];i=this.parent.dataSource instanceof a.DataManager&&this.parent.dataSource.dataSource.json.length>0?this.parent.dataSource.dataSource.json:this.parent.currentViewData;var r=this.parent.dataSource,n=e,s=this.parent.getParentTask(n.parentItem);if(n){if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&(1===o.length&&(this.parent.isOnDelete=!0,o[0].isDelete=!0,this.parent.dataOperation.updateParentItems(s),this.parent.isOnDelete=!1,o[0].isDelete=!1),l=o.indexOf(n),s.childRecords.splice(l,1),this.updateParentRecords.push(s))}if(n.ganttProperties.sharedTaskUniqueIds.length){var d=n.ganttProperties.sharedTaskUniqueIds.indexOf(n.ganttProperties.rowUniqueID);n.ganttProperties.sharedTaskUniqueIds.splice(d,1)}if(this.updateTreeGridUniqueID(n,"delete"),!this.parent.taskFields.parentID){var h=[];h.push(n.ganttProperties.rowUniqueID.toString()),this.parent.editModule.removeFromDataSource(h)}var p=this.parent.flatData.indexOf(n);if(t.taskFields.parentID){for(var c=void 0,u=this.parent.currentViewData,g=0;g<u.length;g++)u[g].ganttProperties.rowUniqueID===n.ganttProperties.rowUniqueID&&(c=g);-1!==c&&(r.length>0&&r.splice(c,1),i.splice(c,1),this.parent.flatData.splice(p,1),this.parent.ids.splice(p,1),this.parent.getTaskIds().splice(p,1))}var f=i.indexOf(n);if(!t.taskFields.parentID){var m=this.parent.editModule.getChildCount(n,0);i.splice(f,m+1),this.parent.flatData.splice(p,m+1),this.parent.ids.splice(p,m+1),this.parent.getTaskIds().splice(p,m+1)}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(this.parent.setRecordValue("expanded",!1,s),this.parent.setRecordValue("hasChildRecords",!1,s))}},e.prototype.addRecordAsChild=function(e,i){var r,a=this.parent,n=this.parent.flatData.indexOf(e),s=this.parent.editModule.getChildCount(e,0);if(!t.isNullOrUndefined(this.addRowIndex)&&this.addRowPosition&&e.childRecords&&"Child"!==this.addRowPosition){var o=e.childRecords[this.addRowIndex],l="Above"===this.addRowPosition||"Below"===this.addRowPosition?this.addRowPosition:"Child";r=o?this.addRowIndex+n+1:s+n+1,r="Above"===l?r:r+1}else r=t.isNullOrUndefined(s)||0===s?n+1:s+n+1;this.parent.currentViewData.splice(r,0,i),this.parent.flatData.splice(r,0,i),this.parent.ids.splice(r,0,i.ganttProperties.rowUniqueID.toString()),this.updateTreeGridUniqueID(i,"add");var d=0===i.level?"R"+i.ganttProperties.taskId:"T"+i.ganttProperties.taskId;this.parent.getTaskIds().splice(r,0,d),e.hasChildRecords||(this.parent.setRecordValue("hasChildRecords",!0,e),this.parent.setRecordValue("expanded",!0,e),e.childRecords.length||(e.childRecords=[],!a.taskFields.parentID&&t.isNullOrUndefined(e.taskData[this.parent.taskFields.child])&&(e.taskData[this.parent.taskFields.child]=[]))),e.childRecords.splice(e.childRecords.length,0,i),t.isNullOrUndefined(i)||this.parent.taskFields.parentID||t.isNullOrUndefined(e.taskData[this.parent.taskFields.child])||e.taskData[this.parent.taskFields.child].splice(e.childRecords.length,0,i.taskData),t.isNullOrUndefined(i.parentItem)||this.updateParentRecords.push(e)},e.prototype.resetEditProperties=function(e){this.parent.currentEditedArgs={},this.resetValidateArgs(),this.parent.editedTaskBarItem=null,this.parent.isOnEdit=!1,this.validatedChildItems=[],this.parent.isConnectorLineUpdate=!1,this.parent.editedTaskBarItem=null,this.taskbarMoved=!1,this.predecessorUpdated=!1,t.isNullOrUndefined(this.dialogModule)||!t.isNullOrUndefined(e)&&(t.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)},e.prototype.endEditAction=function(e){this.resetEditProperties(),"TaskbarEditing"===e.action?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())},e.prototype.saveFailed=function(e){this.reUpdatePreviousRecords(),this.parent.hideSpinner()},e.prototype.renderDeleteConfirmDialog=function(){var e=new i.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},e.prototype.closeConfirmDialog=function(){this.confirmDialog.hide()},e.prototype.confirmDeleteOkButton=function(){this.deleteSelectedItems(),this.confirmDialog.hide();this.parent.element.querySelector(".e-treegrid").focus()},e.prototype.startDeleteAction=function(){if(this.parent.editSettings.allowDeleting&&!this.parent.readOnly)if(this.parent.editSettings.showDeleteConfirmDialog)this.confirmDialog.show();else{this.deleteSelectedItems();this.parent.element.querySelector(".e-treegrid").focus()}},e.prototype.deleteResourceRecords=function(e){for(var t=[],i=function(i){if(e[i].parentItem){if(1===e[i].ganttProperties.sharedTaskUniqueIds.length){for(var a=e[i],n=a.ganttProperties.sharedTaskUniqueIds,s=0;s<n.length;s++)-1!==r.parent.ids.indexOf(n[s].toString())&&t.push(r.parent.flatData[r.parent.ids.indexOf(n[s].toString())]);-1!==r.parent.ids.indexOf(a.ganttProperties.rowUniqueID)&&t.push(r.parent.flatData[r.parent.ids.indexOf(a.ganttProperties.rowUniqueID)])}}else{var o=r.parent.flatData.filter(function(t){return t.ganttProperties.taskId===e[i].ganttProperties.taskId&&t.hasChildRecords})[0];t.push(o)}},r=this,a=0;a<e.length;a++)i(a);this.deleteRow(t)},e.prototype.deleteSelectedItems=function(){if(this.isFromDeleteMethod)this.targetedRecords.length&&("ResourceView"===this.parent.viewType?this.deleteResourceRecords(this.targetedRecords):this.deleteRow(this.targetedRecords)),this.isFromDeleteMethod=!1;else{var 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)}},e.prototype.deleteRecord=function(e){this.isFromDeleteMethod=!0;var i=typeof e;switch(this.targetedRecords=[],i){case"number":case"string":var r=e.toString();"ResourceView"===this.parent.viewType?t.isNullOrUndefined(r)||-1===this.parent.getTaskIds().indexOf("T"+r)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r)]):t.isNullOrUndefined(r)||-1===this.parent.ids.indexOf(r)||this.targetedRecords.push(this.parent.getRecordByID(r));break;case"object":Array.isArray(e)?this.updateTargetedRecords(e):this.targetedRecords.push(e.valueOf())}this.startDeleteAction()},e.prototype.updateTargetedRecords=function(e){if(e.length){if("object"===typeof e[0])this.targetedRecords=e;else for(var i=0;i<e.length;i++){var r=e[i].toString();"ResourceView"===this.parent.viewType?t.isNullOrUndefined(r)||-1===this.parent.getTaskIds().indexOf("T"+r)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r)]):t.isNullOrUndefined(r)||-1===this.parent.ids.indexOf(r)||this.targetedRecords.push(this.parent.getRecordByID(r))}}},e.prototype.deleteRow=function(e){var i=e&&e.length?e:this.parent.selectionModule.getSelectedRecords();if(this.parent.addDeleteRecord=!0,i.length){this.parent.isOnDelete=!0,i.forEach(function(e){e.isDelete=!0}),"ResourceView"!==this.parent.viewType||e.length||(i=[]);for(var r=0;r<i.length;r++){var a=i[r];if(-1===this.deletedTaskDetails.indexOf(a)){var n=this.parent.getParentTask(a.parentItem);if(a.parentItem){var s=n.childRecords;(1===s.length?s:s.filter(function(e){return!e.isDelete})).length>0&&this.parent.dataOperation.updateParentItems(a.parentItem)}var o=a.ganttProperties.predecessor,l=!0;"ResourceView"===this.parent.viewType&&n&&n.ganttProperties.taskName!==this.parent.localeObj.getConstant("unassignedTask")&&(l=!1),o&&o.length&&l&&this.removePredecessorOnDelete(a),this.deletedTaskDetails.push(a),a.hasChildRecords&&this.deleteChildRecords(a)}}this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.clearSelection();var d={};d.deletedRecordCollection=this.deletedTaskDetails,d.updatedRecordCollection=this.parent.editedRecords,d.cancel=!1,d.action="delete",this.initiateDeleteAction(d),this.parent.isOnDelete=!1}t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.removePredecessorOnDelete=function(e){for(var i=e.ganttProperties.predecessor,r=0;r<i.length;r++){var a=i[r],n="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(a.from.toString()===n.toString()){var s=this.parent.connectorLineModule.getRecordByID(a.to.toString());if(!t.isNullOrUndefined(s)){for(var o=t.extend([],[],s.ganttProperties.predecessor,!0),l=void 0,d=0;d<o.length;d++){var h="ResourceView"===this.parent.viewType?s.ganttProperties.taskId:s.ganttProperties.rowUniqueID;if(o[d].to.toString()===h.toString()&&o[d].from.toString()===n.toString()){l=d;break}}o.splice(l,1),this.updatePredecessorValues(s,o)}}else if(a.to.toString()===n.toString()){var p=this.parent.connectorLineModule.getRecordByID(a.from.toString());if(!t.isNullOrUndefined(p)){var c=t.extend([],[],p.ganttProperties.predecessor,!0);for(l=void 0,d=0;d<c.length;d++){var u="ResourceView"===this.parent.viewType?p.ganttProperties.taskId:p.ganttProperties.rowUniqueID;if(c[d].from.toString()===u.toString()&&c[d].to.toString()===n.toString()){l=d;break}}c.splice(l,1),this.updatePredecessorValues(p,c)}}}},e.prototype.updatePredecessorValues=function(e,t){this.parent.setRecordValue("predecessor",t,e.ganttProperties,!0);var i=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",i,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,i,e),this.parent.setRecordValue(this.parent.taskFields.dependency,i,e)},e.prototype.updateTaskId=function(e,i){if(!this.parent.readOnly){var r="number"==typeof e?e.toString():e,a="number"==typeof i?i.toString():i,n=this.parent.ids;if(!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(a)){var s=n.indexOf(r),o=n.indexOf(a);if(-1===s||o>-1)return;var l=this.parent.flatData[s];if(l.ganttProperties.taskId=l.ganttProperties.rowUniqueID=a,l.taskData[this.parent.taskFields.id]=a,l[this.parent.taskFields.id]=a,n[s]=a,l.hasChildRecords&&this.parent.taskFields.parentID)for(var d=l.childRecords,h=0;h<d.length;h++){var p=d[h];p[this.parent.taskFields.parentID]=i,this.parent.chartRowsModule.refreshRecords([p])}if(this.parent.taskFields.dependency&&!t.isNullOrUndefined(l.ganttProperties.predecessor))for(var c=l.ganttProperties.predecessor,u=void 0,g=0;g<c.length;g++){var f=c[g];f.to===r?u=this.parent.flatData[n.indexOf(f.from)]:f.from===r&&(u=this.parent.flatData[n.indexOf(f.to)]),this.updatePredecessorOnUpdateId(u,r,a)}this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh()}}},e.prototype.updatePredecessorOnUpdateId=function(e,t,i){if(this.parent.flatData.indexOf(e)>-1)for(var r=e.ganttProperties.predecessor,a=0;a<r.length;a++){var n=r[a];n.to===t?n.to=i:n.from===t&&(n.from=i)}this.updatePredecessorValues(e,e.ganttProperties.predecessor)},e.prototype.deleteChildRecords=function(e){for(var t=e.childRecords,i=0;i<t.length;i++){var r=t[i];if(-1===this.deletedTaskDetails.indexOf(r)){var a=r.ganttProperties.predecessor,n=!0,s=this.parent.getParentTask(r.parentItem);"ResourceView"===this.parent.viewType&&s&&s.ganttProperties.taskName!==this.parent.localeObj.getConstant("unassignedTask")&&(n=!1),a&&a.length&&n&&this.removePredecessorOnDelete(r),this.deletedTaskDetails.push(r),r.hasChildRecords&&this.deleteChildRecords(r)}}},e.prototype.removeFromDataSource=function(e){var t;t=this.parent.dataSource instanceof a.DataManager?this.parent.dataSource.dataSource.json:this.parent.dataSource,this.removeData(t,e),this.isBreakLoop=!1},e.prototype.removeData=function(e,i){for(var r=0;r<e.length&&!this.isBreakLoop;r++)if(-1!==i.indexOf(t.getValue(this.parent.taskFields.id,e[r]).toString())){if(e[r][this.parent.taskFields.child]){var a=e[r][this.parent.taskFields.child];this.removeData(a,i)}if(i.splice(i.indexOf(t.getValue(this.parent.taskFields.id,e[r]).toString()),1),e.splice(r,1),0===i.length){this.isBreakLoop=!0;break}}else if(e[r][this.parent.taskFields.child]){a=e[r][this.parent.taskFields.child];this.removeData(a,i)}},e.prototype.initiateDeleteAction=function(e){var i=this;this.parent.showSpinner();var r={};r.requestType="beforeDelete",r.data=e.deletedRecordCollection,r.modifiedRecords=e.updatedRecordCollection,r.modifiedTaskData=w(e.updatedRecordCollection,null,null,this.parent),this.parent.trigger("actionBegin",r,function(r){if(t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),r.cancel){for(var n=i.deletedTaskDetails,s=0;s<n.length;s++)n[s].isDelete=!1;i.deletedTaskDetails=[],i.reUpdatePreviousRecords(),i.parent.initiateEditAction(!1),i.parent.hideSpinner()}else if(v(i.parent.dataSource)){var o=i.parent.dataSource;i.parent.timezone&&k(r.modifiedTaskData,i.parent);var l={deletedRecords:w(r.data,null,null,i.parent),changedRecords:r.modifiedTaskData},d=o.adaptor,h=i.parent.query instanceof a.Query?i.parent.query:new a.Query;if(d instanceof a.WebApiAdaptor&&d instanceof a.ODataAdaptor&&!o.dataSource.batchUrl){for(var p=null,c=0;c<l.deletedRecords.length;c++)p=o.remove(i.parent.taskFields.id,l.deletedRecords[c],null,h);p.then(function(){o.update(i.parent.taskFields.id,l.changedRecords,null,h).then(function(){return i.deleteSuccess(e)}).catch(function(t){return i.dmFailure(t,e)})}).catch(function(t){return i.dmFailure(t,e)})}else{o.saveChanges(l,i.parent.taskFields.id,null,h).then(function(){return i.deleteSuccess(e)}).catch(function(t){return i.dmFailure(t,e)})}}else i.deleteSuccess(e)})},e.prototype.deleteSuccess=function(e){var i=this,r=this.parent.flatData,a=this.parent.currentViewData,n=this.parent.getRecordFromFlatdata(e.deletedRecordCollection),s=[];n.length>0&&(this.parent.selectedRowIndex=n[n.length-1].index);for(var o=0;o<n.length;o++){var l=n[o],d=a.indexOf(l),h=r.indexOf(l),p=this.parent.treeGrid.parentData.indexOf(l),c=t.getValue("dataOperation.dataArray",this.parent),u=c.indexOf(l.taskData),g=void 0;if(-1!==d&&a.splice(d,1),-1!==h&&r.splice(h,1),-1!==u&&c.splice(u,1),!t.isNullOrUndefined(l)){if(s.push(l.ganttProperties.taskId.toString()),-1!==h&&(this.parent.ids.splice(h,1),"ResourceView"===this.parent.viewType&&(this.parent.getTaskIds().splice(h,1),this.isResourceTaskDeleted=!0,l.hasChildRecords||(l.ganttProperties.resourceInfo=null,delete l.ganttProperties.resourceNames,l[this.parent.taskFields.resourceInfo]=null,l.ganttProperties.sharedTaskUniqueIds=[],delete l.taskData[this.parent.taskFields.resourceInfo]))),0===l.level&&-1!==p&&this.parent.treeGrid.parentData.splice(p,1),l.parentItem){var f=this.parent.getParentTask(l.parentItem);if(f){var m=f.childRecords;-1!==(g=m.indexOf(l))&&m.splice(g,1),m.length||this.parent.setRecordValue("hasChildRecords",!1,f)}}this.updateTreeGridUniqueID(l,"delete")}}s.length>0&&this.removeFromDataSource(s);var y={};if(this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&this.refreshRecordInImmutableMode(),y.requestType="delete",y.data=e.deletedRecordCollection,y.modifiedRecords=e.updatedRecordCollection,y.modifiedTaskData=w(e.updatedRecordCollection,null,null,this.parent),t.setValue("action",e.action,y),this.parent.isOnDelete=!1,"ResourceView"===this.parent.viewType){var D=y.data.filter(function(e){return!e.hasChildRecords}),v=function(e){var t=k.parent.flatData.filter(function(e){return e.ganttProperties.taskName===i.parent.localeObj.getConstant("unassignedTask")})[0],r=[];t&&(r=t.childRecords.filter(function(t){return t.ganttProperties.taskId===D[e].ganttProperties.taskId}));var a=k.parent.getParentTask(D[e].parentItem);a&&a.ganttProperties.taskName!==k.parent.localeObj.getConstant("unassignedTask")&&0===r.length?k.checkWithUnassignedTask(D[e]):a||r&&0!==r.length||k.checkWithUnassignedTask(D[e]),t=k.parent.flatData.filter(function(e){return e.ganttProperties.taskName===i.parent.localeObj.getConstant("unassignedTask")})[0];var n=k.parent.currentViewData.filter(function(i){return i.ganttProperties.taskId==D[e].ganttProperties.taskId&&!i.hasChildRecords&&i.parentItem&&t.uniqueID===i.parentItem.uniqueID?i:null});n[0]&&k.parent.dataOperation.updateParentItems(n[0])},k=this;for(o=0;o<D.length;o++)v(o)}this.parent.trigger("actionComplete",y),this.deletedTaskDetails=[],this.parent.initiateEditAction(!1),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()},e.prototype.getNewTaskId=function(){var e="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,t=e.length+1;if("ResourceView"===this.parent.viewType){if((-1!==e.indexOf("T"+t)||-1!==e.indexOf("R"+t))&&(t+=1,-1!==e.indexOf("T"+t)||-1!==e.indexOf("R"+t)))do{t+=1}while(-1!==e.indexOf("T"+t)||-1!==e.indexOf("R"+t))}else if(-1!=e.indexOf(t.toString())&&(t+=1,-1!=e.indexOf(t.toString())))do{t+=1}while(-1!=e.indexOf(t.toString()));return"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?t=t.toString():t},e.prototype.prepareNewlyAddedData=function(e,i){var r,a,n=this.parent.taskFields,s=this.parent.ids;if(e[n.id]&&(-1!==s.indexOf(e[n.id].toString())?e[n.id]=null:(a="string"==typeof e[n.id]?e[n.id]:parseInt(e[n.id],10),e[n.id]=t.isNullOrUndefined(a)?null:a)),e[n.id]||(r=this.getNewTaskId(),e[n.id]=r),this.parent.allowUnscheduledTasks||e[n.startDate]||(e[n.startDate]=this.parent.projectStartDate),!this.parent.allowUnscheduledTasks&&n.duration&&t.isNullOrUndefined(e[n.duration])&&(e[n.endDate]||(e[n.duration]="5")),n.progress&&(e[n.progress]=e[n.progress]?e[n.progress]>100?100:e[n.progress]:0),!this.parent.allowUnscheduledTasks&&!e[n.endDate]&&n.endDate&&!e[n.duration]){var o=this.parent.dataOperation.getDateFromFormat(this.parent.projectStartDate);o.setDate(o.getDate()+4),e[n.endDate]=this.parent.getFormatedDate(o,this.parent.getDateFormat())}},e.prototype.updateNewlyAddedDataBeforeAjax=function(e,i,r,a){var n=this.parent.dataOperation.createRecord(e,i);if(n.index=parseInt(n.ganttProperties.rowUniqueID.toString(),10)-1,!t.isNullOrUndefined(a)){this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(a),n);var s=n.parentItem?n.parentItem.index:null;this.parent.setRecordValue("parentIndex",s,n);var o=n.parentItem?n.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",o,n),t.isNullOrUndefined(this.parent.taskFields.id)||t.isNullOrUndefined(this.parent.taskFields.parentID)||!n.parentItem||("ProjectView"===this.parent.viewType&&this.parent.setRecordValue(this.parent.taskFields.parentID,n.parentItem.taskId,n.taskData,!0),this.parent.setRecordValue("parentId",n.parentItem.taskId,n.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.parentID,n.parentItem.taskId,n,!0))}return this.parent.isOnEdit=!0,this.backUpAndPushNewlyAddedRecord(n,r,a),this.parent.taskFields.dependency&&n.ganttProperties.predecessorsName&&(this.parent.predecessorModule.ensurePredecessorCollectionHelper(n,n.ganttProperties),this.parent.predecessorModule.updatePredecessorHelper(n),this.parent.predecessorModule.validatePredecessorDates(n)),n.parentItem&&this.parent.getParentTask(n.parentItem).ganttProperties.isAutoSchedule&&this.parent.dataOperation.updateParentItems(n.parentItem),this.parent.isOnEdit=!1,n},e.prototype.getChildCount=function(e,t){var i;if(!e.hasChildRecords)return 0;for(var r=0;r<e.childRecords.length;r++)t++,(i=e.childRecords[r]).hasChildRecords&&(t=this.getChildCount(i,t));return t},e.prototype.getVisibleChildRecordCount=function(e,t,i){var r,a;if(e.hasChildRecords){a=(r=e.childRecords).length;for(var n=0;n<a;n++)-1!==i.indexOf(r[n])&&t++,r[n].hasChildRecords&&(t=this.getVisibleChildRecordCount(r[n],t,i))}else-1!==i.indexOf(e)&&t++;return t},e.prototype.updatePredecessorOnIndentOutdent=function(e){for(var i,r,a=e.ganttProperties.predecessor.length,n=e.ganttProperties,s=n.predecessor,o=0;o<a;o++)if(s[o].to===n.rowUniqueID.toString()){i=this.parent.getRecordByID(s[o].from),r=b(s[o],"from",i.ganttProperties.predecessor,"to");var l=t.extend([],i.ganttProperties.predecessor,[],!0);l.splice(r,1),this.parent.setRecordValue("predecessor",l,i.ganttProperties,!0)}else if(s[o].from===n.rowUniqueID.toString()){var d=(i=this.parent.getRecordByID(s[o].to)).ganttProperties.predecessorsName.toString().split(","),h=s[o].from+s[o].type,p=d.indexOf(h);d.splice(p,1),this.parent.setRecordValue("predecessorsName",d.join(","),i.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.dependency,d.join(","),i),r=b(s[o],"from",i.ganttProperties.predecessor,"to");var c=t.extend([],i.ganttProperties.predecessor,[],!0);c.splice(r,1),this.parent.setRecordValue("predecessor",c,i.ganttProperties,!0),this.parent.predecessorModule.validatePredecessorDates(i)}this.parent.setRecordValue("predecessor",[],e.ganttProperties,!0),this.parent.setRecordValue("predecessorsName","",e.ganttProperties,!0)},e.prototype.predecessorToString=function(e,t){for(var i=[],r=0,a=e.length;r<a;r++)if(t.ganttProperties.rowUniqueID.toString()!==e[r].from){var n=e[r].from+e[r].type;e[r].offset=isNaN(e[r].offset)?0:e[r].offset,0!==e[r].offset&&(e[r].offset<0?n+=e[r].offset.toString()+"d":e[r].offset>0&&(n+="+"+e[r].offset.toString()+"d")),i.push(n)}return i.join(",")},e.prototype.backUpAndPushNewlyAddedRecord=function(e,i,r){var a,n,s,o=this.parent.flatData,l=this.parent.currentViewData,d=this.parent.ids;switch(i){case"Top":o.splice(0,0,e),l.splice(0,0,e),d.splice(0,0,e.ganttProperties.rowUniqueID.toString());break;case"Bottom":if(o.push(e),l.push(e),d.push(e.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var h=0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId;this.parent.getTaskIds().push(h)}break;case"Above":n=o.indexOf(this.addRowSelectedItem),s=l.indexOf(this.addRowSelectedItem),this.recordCollectionUpdate(void 0,n,s,e,r,i);break;case"Below":if(a=o.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords){n=a+this.getChildCount(this.addRowSelectedItem,0)+1,s=l.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,l)+1}else n=a+1,s=l.indexOf(this.addRowSelectedItem)+1;this.recordCollectionUpdate(NaN,n,s,e,r,i);break;case"Child":if(a=o.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords){n=a+this.getChildCount(this.addRowSelectedItem,0)+1,this.addRowSelectedItem.expanded||this.parent.enableMultiTaskbar||this.parent.expandByID(this.addRowSelectedItem.ganttProperties.rowUniqueID),s=l.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,l)+1}else 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),n=a+1,s=l.indexOf(this.addRowSelectedItem)+1,this.addRowSelectedItem.ganttProperties.predecessor&&this.updatePredecessorOnIndentOutdent(this.addRowSelectedItem),t.isNullOrUndefined(this.addRowSelectedItem.ganttProperties.segments)||(this.addRowSelectedItem.ganttProperties.segments=null);this.recordCollectionUpdate(NaN,n,s,e,r,i)}this.newlyAddedRecordBackup=e},e.prototype.recordCollectionUpdate=function(e,i,r,n,s,o){var l=this.parent.flatData,d=this.parent.currentViewData,h=this.parent.ids;if(l.splice(i,0,n),d.splice(r,0,n),"ResourceView"===this.parent.viewType&&"number"==typeof n.ganttProperties.taskId){var p=n.ganttProperties.taskId;h.push(p.toString())}if(h.splice(i,0,n.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var c=0===n.level?"R"+n.ganttProperties.taskId:"T"+n.ganttProperties.taskId;this.parent.getTaskIds().splice(i,0,c)}if(!t.isNullOrUndefined(s)&&(e="Above"==o?s.childRecords.indexOf(this.addRowSelectedItem):"Below"==o?s.childRecords.indexOf(this.addRowSelectedItem)+1:s.childRecords.length,s.childRecords.splice(e,0,n),this.parent.taskFields.child||(this.parent.taskFields.child="Children"),this.parent.dataSource instanceof a.DataManager&&t.isNullOrUndefined(s.taskData[this.parent.taskFields.parentID])||!t.isNullOrUndefined(this.parent.dataSource))){var u=this.parent.taskFields.child;s.taskData[u]&&s.taskData[u].length>0?"Above"===o||"Below"===o?s.taskData[u].splice(e,0,n.taskData):s.taskData[u].push(n.taskData):(s.taskData[u]=[],s.taskData[u].push(n.taskData)),this.isNewRecordAdded=!0}},e.prototype.constructTaskAddedEventArgs=function(e,t,i){var r={};if(r.action=r.requestType=i,e.length>1){r.data=[],r.newTaskData=[],r.recordIndex=[];for(var a=0;a<e.length;a++)r.data[a]=e[a],r.newTaskData[a]=w([e[a]],r.data[a],r,this.parent),r.recordIndex[a]=e[a].index}else if(1===e.length)for(a=0;a<e.length;a++)r.data=e[a],r.newTaskData=w([e[a]],r.data,r,this.parent),r.recordIndex=e[a].index;return r.modifiedRecords=t,r.modifiedTaskData=w(t,null,null,this.parent),r},e.prototype.addSuccess=function(e){this.parent.treeGrid.parentData=[],this.parent.addDeleteRecord=!0,this.parent.selectedRowIndex=0,this.parent.treeGrid.isAddedFromGantt=!0,this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&(this.parent.modifiedRecords=e.modifiedRecords,this.parent.modifiedRecords.push(e.data),this.refreshRecordInImmutableMode())},e.prototype.refreshRecordInImmutableMode=function(e,i){if(!i&&!t.isNullOrUndefined(e))for(var r=e[0].index+1;r<this.parent.currentViewData.length&&e[0].level<this.parent.currentViewData[r].level;r++)this.parent.modifiedRecords.push(this.parent.currentViewData[r]);var a=function(e){var t=n.parent.modifiedRecords[e],i=n.parent.allowRowDragAndDrop?1:0,r=n.parent.taskFields.id,a=n.parent.currentViewData.findIndex(function(e){return e[r]===t[r]});n.parent.treeGrid.getRows()[a]&&(n.parent.treeGrid.renderModule.cellRender({data:t,cell:n.parent.treeGrid.getRows()[a].cells[n.parent.treeColumnIndex+i],column:n.parent.treeGrid.grid.getColumns()[n.parent.treeColumnIndex],requestType:"rowDragAndDrop"}),n.parent.treeGrid.renderModule.RowModifier({data:t,row:n.parent.treeGrid.getRows()[a],rowHeight:n.parent.rowHeight}))},n=this;for(r=0;r<this.parent.modifiedRecords.length;r++)a(r)},e.prototype.updateRealDataSource=function(e,i){var r=this.parent.taskFields,n=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource;this.parent.dataSource instanceof a.DataManager&&(n=this.parent.dataSource.dataSource.json);for(var s=0;s<e.length;s++)(t.isNullOrUndefined(i)||t.isNullOrUndefined(this.addRowSelectedItem))&&(i="Bottom"===i?"Bottom":"Top"),"Top"===i?n.splice(0,0,e[s].taskData):"Bottom"===i?n.push(e[s].taskData):t.isNullOrUndefined(r.id)||t.isNullOrUndefined(r.parentID)?(this.isNewRecordAdded||this.addDataInRealDataSource(n,e[s].taskData,i),this.isNewRecordAdded=!1):n.push(e[s].taskData),this.isBreakLoop=!1},e.prototype.addDataInRealDataSource=function(e,i,r){for(var a=0;a<e.length;a++){var n=this.parent.taskFields.child;if(this.isBreakLoop)break;if(t.getValue(this.parent.taskFields.id,e[a]).toString()===this.addRowSelectedItem.ganttProperties.rowUniqueID.toString()){"Above"===r?e.splice(a,0,i):"Below"===r?e.splice(a+1,0,i):"Child"===r&&(e[a][n]&&e[a][n].length>0?e[a][n].push(i):(e[a][n]=[],e[a][n].push(i))),this.isBreakLoop=!0;break}if(e[a][n]){var s=e[a][n];this.addDataInRealDataSource(s,i,r)}}},e.prototype.addRecord=function(e,i,r){var n=this,s=this.parent.taskFields.id;if(this.parent.editModule&&this.parent.editSettings.allowAdding){this.parent.isDynamicData=!0;var o=[];if(t.isNullOrUndefined(e))this.validateTaskPosition(e,i,r,o);else if(e instanceof Array)for(var l=0;l<e.length;l++)this.validateTaskPosition(e[l],i,r,o);else{if("object"!=typeof e)return;this.validateTaskPosition(e,i,r,o)}var d={};d=this.constructTaskAddedEventArgs(o,this.parent.editedRecords,"beforeAdd"),this.parent.trigger("actionBegin",d,function(e){t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.showSpinner():n.parent.showMaskRow();var r=n.parent.taskFields,l="ResourceView"===n.parent.viewType?n.parent.flatData[n.parent.getTaskIds().indexOf("T"+e.data[r.id])]:n.parent.getRecordByID(e.data[r.id]);if(t.isNullOrUndefined(l)||n.validateUpdateValues(e.newTaskData,l,!0),t.isNullOrUndefined(e.data[""+s])||e.data[s]!=e.data.ganttProperties.taskId&&(e.data.ganttProperties.taskId=e.data[s],e.newTaskData[s]=e.data[s]),e.cancel)e=e,n.removeAddedRecord(),n.reUpdatePreviousRecords(),n._resetProperties();else if(v(n.parent.dataSource)){var d=n.parent.dataSource,h={addedRecords:[e.newTaskData],changedRecords:e.modifiedTaskData},p=e.data.ganttProperties.taskId.toString(),c=n.parent.query instanceof a.Query?n.parent.query:new a.Query,u=d.adaptor;if(u instanceof a.WebApiAdaptor&&u instanceof a.ODataAdaptor&&!d.dataSource.batchUrl){d.insert(h.addedRecords,null,c).then(function(i){t.isNullOrUndefined(i[0])?h.addedRecords[0]:i[0],n.updateNewRecord(o,e)}).catch(function(t){n.removeAddedRecord(),n.dmFailure(t,e),n._resetProperties()})}else{d.saveChanges(h,n.parent.taskFields.id,null,c).then(function(i){if(n.parent.taskFields.id&&!t.isNullOrUndefined(i.addedRecords[0][n.parent.taskFields.id])&&i.addedRecords[0][n.parent.taskFields.id].toString()==p){n.parent.setRecordValue("taskId",i.addedRecords[0][n.parent.taskFields.id],e.data.ganttProperties,!0),n.parent.setRecordValue("taskData",i.addedRecords[0],e.data),n.parent.setRecordValue(n.parent.taskFields.id,i.addedRecords[0][n.parent.taskFields.id],e.data),n.parent.setRecordValue("rowUniqueID",i.addedRecords[0][n.parent.taskFields.id].toString(),e.data.ganttProperties,!0);var r=n.parent.ids.indexOf(p);-1!==r&&(n.parent.ids[r]=i.addedRecords[0][n.parent.taskFields.id].toString())}n.updateNewRecord(o,e)}).catch(function(t){n.removeAddedRecord(),n.dmFailure(t,e),n._resetProperties()})}}else{if("ProjectView"===n.parent.viewType){if("Top"===i||"Bottom"===i||"Above"===i||"Below"===i||"Child"===i||t.isNullOrUndefined(i)&&!e.data.parentItem)if(e.data instanceof Array)n.updateRealDataSource(e.data,i);else{var g=[];g.push(e.data),n.updateRealDataSource(g,i)}}else{(y(n.parent)?t.getValue("result",n.parent.dataSource):n.parent.dataSource).push(e.data.taskData)}0===o.level&&n.parent.treeGrid.parentData.splice(0,0,o),n.updateTreeGridUniqueID(o,"add"),n.refreshNewlyAddedRecord(e,o),n._resetProperties()}})}},e.prototype.createNewRecord=function(){for(var e={},i=this.parent.ganttColumns,r=this.parent.taskFields,a=this.parent.editModule.getNewTaskId(),n=0;n<i.length;n++){var s=i[n].field;s===r.id?e[s]=a:i[n].field===r.startDate?(t.isNullOrUndefined(e[r.endDate])?e[s]=this.parent.editModule.dialogModule.getMinimumStartDate():e[s]=new Date(e[r.endDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone))):i[n].field===r.endDate?(t.isNullOrUndefined(e[r.startDate])?e[s]=this.parent.editModule.dialogModule.getMinimumStartDate():e[s]=new Date(e[r.startDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone))):i[n].field===r.duration?e[s]=1:i[n].field===r.name?e[s]=this.parent.editModule.dialogModule.localeObj.getConstant("addDialogTitle")+" "+a:i[n].field===r.progress?e[s]=0:i[n].field===r.work?e[s]=0:"taskType"===i[n].field?e[s]=this.parent.taskType:e[this.parent.ganttColumns[n].field]=""}return e},e.prototype.validateTaskPosition=function(e,i,r,a){var n=t.isNullOrUndefined(r)||isNaN(parseInt(r.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:r;this.addRowSelectedItem=t.isNullOrUndefined(n)?null:this.parent.updatedRecords[n],i=t.isNullOrUndefined(i)?this.parent.editSettings.newRowPosition:i,e=t.isNullOrUndefined(e)?this.createNewRecord():e,((t.isNullOrUndefined(n)||n<0||t.isNullOrUndefined(this.addRowSelectedItem))&&("Above"===i||"Below"===i||"Child"===i)||!i||"Above"!==i&&"Below"!==i&&"Child"!==i&&"Top"!==i&&"Bottom"!==i)&&(i="Top");var s,o=0;switch(i){case"Top":case"Bottom":o="ResourceView"===this.parent.viewType?1:0;break;case"Above":case"Below":o=this.addRowSelectedItem.level,s=this.parent.getParentTask(this.addRowSelectedItem.parentItem);break;case"Child":o=this.addRowSelectedItem.level+1,s=this.addRowSelectedItem}this.prepareNewlyAddedData(e,i);var l=this.updateNewlyAddedDataBeforeAjax(e,o,i,s);a.push(l)},e.prototype.updateNewRecord=function(e,i){if(0===e.level){this.parent.treeGrid.parentData.splice(0,0,e);t.getValue("dataOperation.dataArray",this.parent).splice(0,0,e.taskData)}this.updateTreeGridUniqueID(e,"add"),this.refreshNewlyAddedRecord(i,e),this._resetProperties()},e.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)},e.prototype.updateTreeGridUniqueID=function(e,i){"add"===i?t.setValue("uniqueIDCollection."+e.uniqueID,e,this.parent.treeGrid):"delete"===i&&t.deleteObject(t.getValue("uniqueIDCollection",this.parent.treeGrid),e.uniqueID)},e.prototype.refreshNewlyAddedRecord=function(e,i){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){var r=[];e.modifiedRecords.length>0?(r=e.data.length>0?e.data:[e.data]).push.apply(r,e.modifiedRecords):r=e.data.length>0?e.data:[e.data],this.parent.timelineModule.updateTimeLineOnEditing([r],e.action)}if(this.addSuccess(e),e=this.constructTaskAddedEventArgs(i,e.modifiedRecords,"add"),this.dialogModule.isAddNewResource&&!this.parent.isEdit&&this.parent.taskFields.work&&this.parent.dataOperation.updateWorkWithDuration(i[0]),this.parent.trigger("actionComplete",e),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose(),"ResourceView"===this.parent.viewType)if(i.length>1)for(var a=0;a<i.length;a++){if(e.data[a].ganttProperties.sharedTaskUniqueIds.push(e.data[a].ganttProperties.rowUniqueID),e.data[a].ganttProperties.resourceInfo){(s=t.extend([],[],e.data[a].ganttProperties.resourceInfo,!0)).splice(0,1),this.updateResoures([],s,e.data[a])}else this.removeChildRecord(e.data[a]),this.parent.editModule.checkWithUnassignedTask(e.data[a]);for(var n=0;n<this.updateParentRecords.length;n++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[n]);this.updateParentRecords=[]}else{if(e.data.ganttProperties.sharedTaskUniqueIds.push(e.data.ganttProperties.rowUniqueID),e.data.ganttProperties.resourceInfo&&e.data.ganttProperties.resourceInfo.length){if(e.data.ganttProperties.resourceInfo.length>1){var s;(s=t.extend([],[],e.data.ganttProperties.resourceInfo,!0)).splice(0,1),this.updateResoures([],s,e.data)}}else this.removeChildRecord(e.data),this.parent.editModule.checkWithUnassignedTask(e.data);for(n=0;n<this.updateParentRecords.length;n++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[n]);this.updateParentRecords=[]}},e.prototype.removeAddedRecord=function(){var e=this.parent.flatData,i=this.parent.currentViewData,r=this.parent.ids,a=e.indexOf(this.newlyAddedRecordBackup),n=i.indexOf(this.newlyAddedRecordBackup),s=r.indexOf(this.newlyAddedRecordBackup.ganttProperties.rowUniqueID.toString());if(t.deleteObject(this.parent.previousRecords,e[a].uniqueID),this.newlyAddedRecordBackup.parentItem){var o=this.parent.getParentTask(this.newlyAddedRecordBackup.parentItem),l=o.childRecords.indexOf(this.newlyAddedRecordBackup);o.childRecords.splice(l,1)}e.splice(a,1),i.splice(n,1),r.splice(s,1)},e.prototype.getPrevRecordIndex=function(){var e=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],t=this.parent.selectionModule.getSelectedRecords()[0],i=this.parent.getRootParent(e,t.level);return this.parent.updatedRecords.indexOf(i)},e.prototype.indent=function(){var e,t=this.parent.selectedRowIndex,i=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),r=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],a=this.parent.selectionModule.getSelectedRecords()[0];this.parent.editSettings.allowEditing&&0!==t&&-1!==t&&i&&"ResourceView"!==this.parent.viewType&&this.parent.updatedRecords[t].level-r.level!=1&&(e=r.level-a.level==0?this.parent.selectionModule.getSelectedRowIndexes()[0]-1:this.getPrevRecordIndex(),this.indentOutdentRow([this.parent.selectionModule.getSelectedRowIndexes()[0]],e,"child"))},e.prototype.outdent=function(){var e,t=this.parent.selectionModule.getSelectedRowIndexes()[0],i=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length);if(this.parent.editSettings.allowEditing&&-1!==t&&0!==t&&i&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[t].level){var r=this.parent.getTaskByUniqueID(this.parent.selectionModule.getSelectedRecords()[0].parentItem.uniqueID);e=this.parent.updatedRecords.indexOf(r),this.indentOutdentRow([t],e,"below")}},e.prototype.indentOutdentRow=function(e,i,r){var a=this;e[0],"above"===r&&(this.dropPosition="topSegment"),"below"===r&&(this.dropPosition="bottomSegment"),"child"===r&&(this.dropPosition="middleSegment");for(var n=void 0,s=[],o=0;o<e.length;o++)s[o]=this.parent.updatedRecords[e[o]];var l={data:s,dropIndex:i,dropPosition:this.dropPosition};"middleSegment"===this.dropPosition?n="indenting":"bottomSegment"===this.dropPosition&&(n="outdenting");var d={action:n,data:s[0],cancel:!1};this.parent.trigger("actionBegin",d,function(e){t.isNullOrUndefined(a.parent.loadingIndicator)||"Shimmer"!==a.parent.loadingIndicator.indicatorType?a.parent.showSpinner():a.parent.showMaskRow(),e.cancel||a.reArrangeRows(l,!0)})},e.prototype.reArrangeRows=function(e,i){if(this.dropPosition=e.dropPosition,"Invalid"!==e.dropPosition&&this.parent.editModule){var r=this.parent,a=void 0;this.droppedRecord=r.updatedRecords[e.dropIndex];var n=[],s=this.droppedRecord;e.data[0]?n=e.data:n.push(e.data);for(var o=0,l=n.length,d=0;d<l;d++){if(this.parent.isOnEdit=!0,a=n[d],this.draggedRecord=a,"Invalid"!==this.dropPosition){i&&this.deleteDragRow();var h=this.treeGridData.indexOf(s);if("bottomSegment"===this.dropPosition){if(s.hasChildRecords){o=this.parent.editModule.getChildCount(s,0),this.parent.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(h+o+1,0,this.draggedRecord.taskData),this.treeGridData.splice(h+o+1,0,this.draggedRecord),this.parent.ids.splice(h+o+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString());var p=this.parent.ids.indexOf(this.draggedRecord[this.parent.taskFields.id].toString());p!==h+o+1&&(this.parent.ids.splice(p,1),this.parent.ids.splice(h+o+1,0,this.draggedRecord[this.parent.taskFields.id].toString()))}else this.parent.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(h+1,0,this.draggedRecord.taskData),this.treeGridData.splice(h+1,0,this.draggedRecord),this.parent.ids.splice(h+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString());if(this.parent.setRecordValue("parentItem",this.treeGridData[h].parentItem,a),this.parent.setRecordValue("parentUniqueID",this.treeGridData[h].parentUniqueID,a),this.parent.setRecordValue("level",this.treeGridData[h].level,a),a.hasChildRecords){this.updateChildRecordLevel(a,1),this.updateChildRecord(a,h+o+1)}if(s.parentItem){var c=this.parent.getParentTask(s.parentItem).childRecords,u=c.indexOf(s)+1;c.splice(u,0,a)}}"middleSegment"===this.dropPosition&&this.dropMiddle(h),t.isNullOrUndefined(a.parentItem&&-1!==this.updateParentRecords.indexOf(a.parentItem))||this.updateParentRecords.push(a.parentItem)}if(t.isNullOrUndefined(a.parentItem)){var g=this.parent.treeGrid.parentData,f=g.indexOf(this.droppedRecord);"bottomSegment"===this.dropPosition&&g.splice(f+1,0,a)}this.refreshDataSource()}"middleSegment"===this.dropPosition&&(s.ganttProperties.predecessor&&(this.parent.editModule.removePredecessorOnDelete(s),s.ganttProperties.predecessor=null,s.ganttProperties.predecessorsName=null,s[this.parent.taskFields.dependency]=null,s.taskData[this.parent.taskFields.dependency]=null),s.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,s.ganttProperties,!0),t.isNullOrUndefined(s.taskData[this.parent.taskFields.milestone])||!0===s.taskData[this.parent.taskFields.milestone]&&(s.taskData[this.parent.taskFields.milestone]=!1)));for(var m=0;m<this.updateParentRecords.length;m++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[m]);this.updateParentRecords=[],this.parent.isOnEdit=!1}this.refreshRecord(e)},e.prototype.refreshRecord=function(e,t){var i=this;if(v(this.parent.dataSource)){var r=this.parent.dataSource,n={changedRecords:w(this.parent.editedRecords,null,null,this.parent)},s=this.parent.query instanceof a.Query?this.parent.query:new a.Query,o=null,l=r.adaptor;if(l instanceof a.WebApiAdaptor&&l instanceof a.ODataAdaptor&&!r.dataSource.batchUrl){o=r.update(this.parent.taskFields.id,n.changedRecords,null,s)}else o=r.saveChanges(n,this.parent.taskFields.id,null,s);o.then(function(r){return i.indentSuccess(r,e,t)}).catch(function(e){return i.indentFailure(e)})}else this.indentOutdentSuccess(e,t)},e.prototype.indentSuccess=function(e,t,i){this.indentOutdentSuccess(t,i)},e.prototype.indentFailure=function(e){this.parent.trigger("actionFailure",{error:e})},e.prototype.indentOutdentSuccess=function(e,i){if(this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&this.refreshRecordInImmutableMode(e.data,i),i?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 r=0;r<e.modifiedRecords.length;r++)k(e.modifiedRecords[r],this.parent);this.parent.trigger("actionComplete",e),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.parent.editedRecords=[]},e.prototype.refreshDataSource=function(){var e,i,r=this.draggedRecord,n=this.droppedRecord,s=this.parent;if((e=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!t.isNullOrUndefined(n)&&!n.parentItem){for(var o=0;o<Object.keys(e).length;o++)e[o][this.parent.taskFields.child]===n.taskData[this.parent.taskFields.child]&&(i=o);"topSegment"===this.dropPosition?this.parent.taskFields.parentID||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||e.splice(i+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!t.isNullOrUndefined(n)&&n.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var l="topSegment"===this.dropPosition?"Above":"Below";this.parent.editModule.addRowSelectedItem=n;var d=[];Array.isArray(r)?d=r:d[0]=r,this.parent.editModule.updateRealDataSource(d,l),delete this.parent.editModule.addRowSelectedItem}this.parent.taskFields.parentID&&(r.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(r[this.parent.taskFields.parentID]=n[this.parent.taskFields.parentID],r.taskData[this.parent.taskFields.parentID]=n[this.parent.taskFields.parentID],r.ganttProperties.parentId=n[this.parent.taskFields.parentID]):(r[this.parent.taskFields.parentID]=n[this.parent.taskFields.id],r.taskData[this.parent.taskFields.parentID]=n[this.parent.taskFields.id],r.ganttProperties.parentId=n[this.parent.taskFields.id]):(r[this.parent.taskFields.parentID]=null,r.taskData[this.parent.taskFields.parentID]=null,r.ganttProperties.parentId=null))},e.prototype.deleteDragRow=function(){this.parent.dataSource instanceof a.DataManager?this.ganttData=t.getValue("dataOperation.dataArray",this.parent):this.ganttData=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource,this.treeGridData=y(this.parent)?t.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource;var e=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(e)},e.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 r=0;r<e.length;r++)this.updateIndentedChildRecords(e[r])}},e.prototype.dropMiddle=function(e){var i=this.parent,r=this.parent.editModule.getChildCount(this.droppedRecord,0),a=t.isNullOrUndefined(r)||0===r?e+1:r+e+1;if("middleSegment"===this.dropPosition){if(i.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(a,0,this.draggedRecord.taskData),this.treeGridData.splice(a,0,this.draggedRecord),this.parent.ids.splice(a,0,this.draggedRecord[this.parent.taskFields.id].toString()),this.recordLevel(),this.draggedRecord.hasChildRecords&&(this.updateChildRecord(this.draggedRecord,a,this.droppedRecord.expanded),this.parent.enableImmutableMode)){var n=this.draggedRecord;this.updateIndentedChildRecords(n)}t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.updateChildRecordLevel=function(e,t){var i,r=0;if(t++,!e.hasChildRecords)return 0;r=e.childRecords.length;for(var a=0;a<r;a++){i=e.childRecords[a];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}i.level=e.parentItem?n.level+t:e.level+1,i.hasChildRecords&&(t--,t=this.updateChildRecordLevel(i,t))}return t},e.prototype.updateChildRecord=function(e,t,i){var r,a=this.parent,n=0;if(!e.hasChildRecords)return 0;n=e.childRecords.length;for(var s=0;s<n;s++)r=e.childRecords[s],t++,a.flatData.splice(t,0,r),this.parent.ids.splice(t,0,r.ganttProperties.rowUniqueID.toString()),a.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(t,0,r.taskData),r.hasChildRecords&&(t=this.updateChildRecord(r,t));return t},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=e,s=this.parent.getParentTask(n.parentItem);if(n){if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&(l=o.indexOf(n),s.childRecords.splice(l,1),this.parent.taskFields.parentID||s.taskData[this.parent.taskFields.child].splice(l,1),this.updateParentRecords.push(s))}if(r.taskFields.parentID){n.hasChildRecords&&n.childRecords.length>0&&this.removeChildItem(n);for(var d=void 0,h=i.length>0?i:this.parent.currentViewData,p=0;p<h.length;p++)h[p][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(d=p);if(-1!==d){i.length>0&&i.splice(d,1);var c=void 0;for(p=0;p<this.treeGridData.length;p++)this.treeGridData[p][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(c=p);this.treeGridData.splice(c,1),this.parent.ids.splice(c,1),-1!==this.parent.treeGrid.parentData.indexOf(n)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(n),1)}}var u=this.treeGridData.indexOf(n);if(!r.taskFields.parentID){var g=this.getChildCount(n,0);this.treeGridData.splice(u,g+1),this.parent.ids.splice(u,g+1);var f=this.ganttData.indexOf(n.taskData);-1!==f&&(this.ganttData.splice(f,1),this.parent.treeGrid.parentData.splice(f,1))}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(this.parent.setRecordValue("expanded",!1,s),this.parent.setRecordValue("hasChildRecords",!1,s))}},e.prototype.removeChildItem=function(e){for(var i,r,n=0;n<e.childRecords.length;n++){i=e.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(r=o);if(-1!==r){s.length>0&&s.splice(r,1);for(var l=void 0,d=0;d<this.treeGridData.length;d++)this.treeGridData[d][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(l=d);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1)}i.hasChildRecords&&this.removeChildItem(i)}},e.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,r=this.droppedRecord,a=e.taskFields.child;if(r.hasChildRecords||(r.hasChildRecords=!0,r.childRecords.length||(r.childRecords=[],!e.taskFields.parentID&&t.isNullOrUndefined(r.taskData[a])&&(r.taskData[a]=[]))),"middleSegment"===this.dropPosition){var n=t.extend({},r);delete n.childRecords;var s={uniqueID:n.uniqueID,expanded:n.expanded,level:n.level,index:n.index,taskId:n.ganttProperties.rowUniqueID};if(this.parent.setRecordValue("parentItem",s,i),this.parent.setRecordValue("parentUniqueID",r.uniqueID,i),r.childRecords.splice(r.childRecords.length,0,i),t.isNullOrUndefined(i)||e.taskFields.parentID||t.isNullOrUndefined(r.taskData[a])||r.taskData[e.taskFields.child].splice(r.childRecords.length,0,i.taskData),!t.isNullOrUndefined(r.ganttProperties.segments)&&r.ganttProperties.segments.length>0&&(r.ganttProperties.segments=null,r.taskData[e.taskFields.segments]=null),i.hasChildRecords){i.level=r.level+1,this.updateChildRecordLevel(i,1)}else i.level=r.level+1;r.expanded=!0}},e}(),di=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Reorder),this.parent.treeGrid.allowReordering=this.parent.allowReordering,this.bindEvents()}return e.prototype.getModuleName=function(){return"reorder"},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.columnDragStart=function(t){e.parent.trigger("columnDragStart",t)},this.parent.treeGrid.columnDrag=function(t){e.parent.trigger("columnDrag",t)},this.parent.treeGrid.columnDrop=function(t){e.parent.trigger("columnDrop",t)}},e.prototype.destroy=function(){},e}(),hi=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Resize),this.parent.treeGrid.allowResizing=this.parent.allowResizing,this.bindEvents()}return e.prototype.getModuleName=function(){return"resize"},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.resizeStart=function(t){e.parent.trigger("resizeStart",t)},this.parent.treeGrid.resizing=function(t){e.parent.trigger("resizing",t)},this.parent.treeGrid.resizeStop=function(t){e.parent.trigger("resizeStop",t)}},e.prototype.destroy=function(){},e}(),pi=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Filter),this.parent.treeGrid.allowFiltering=this.parent.allowFiltering,this.updateCustomFilters(),this.parent.treeGrid.filterSettings=r.getActualProperties(this.parent.filterSettings),this.addEventListener()}return e.prototype.getModuleName=function(){return"filter"},e.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])}},e.prototype.updateModel=function(){this.parent.filterSettings=this.parent.treeGrid.filterSettings},e.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)},e.prototype.wireEvents=function(e){t.EventHandler.add(document.getElementById(e),"click",this.mouseClickHandler,this)},e.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:{})},e.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},e.prototype.mouseClickHandler=function(e){t.closest(e.target,".e-excelfilter")&&this.parent.treeGrid.grid.notify("click",e)},e.prototype.unWireEvents=function(){t.EventHandler.remove(this.parent.element,"click",this.mouseClickHandler)},e.prototype.getDatePickerFilter=function(e){var i,a=this,n=this.parent,s=e===n.taskFields.startDate||e===n.taskFields.baselineStartDate?n.defaultStartTime:n.defaultEndTime;return{create:function(e){var n=r.getCustomDateFormat(e.column.format,e.column.type),s=t.createElement("input",{className:"flm-input"});e.target.appendChild(s),(i=new c.DatePicker({placeholder:a.parent.localeObj.getConstant("enterValue"),format:n})).enableRtl=a.parent.enableRtl,i.appendTo(s)},write:function(e){i.value=e.filteredValue},read:function(e){i.value&&i.value.setSeconds(s),e.fltrObj.filterByColumn(e.column.field,e.operator,i.value)}}},e.prototype.getDateTimePickerFilter=function(){var e,i=this;return{create:function(a){var n=r.getCustomDateFormat(a.column.format,a.column.type),s=t.createElement("input",{className:"flm-input"});a.target.appendChild(s),(e=new c.DateTimePicker({placeholder:i.parent.localeObj.getConstant("enterValue"),format:n})).enableRtl=i.parent.enableRtl,e.appendTo(s)},write:function(t){e.value=t.filteredValue},read:function(t){t.fltrObj.filterByColumn(t.column.field,t.operator,e.value)}}},e.prototype.getDurationFilter=function(){var e,i=this,r=this.parent,a="";return{create:function(r){var a=t.createElement("input",{className:"e-input"});a.setAttribute("placeholder",i.parent.localeObj.getConstant("enterValue")),r.target.appendChild(a),(e=new h.TextBox).enableRtl=i.parent.enableRtl,e.appendTo(a)},write:function(t){e.value=t.filteredValue?a:""},read:function(n){var s=i.parent.dataOperation.getDurationValue(e.value),o=t.getValue("duration",s),l=t.getValue("durationUnit",s);if(o>=0){var d=void 0;"minute"===l?d=60*o/r.secondsPerDay:"hour"===l?d=60*o*60/r.secondsPerDay:(d=o,l="day"),n.fltrObj.filterByColumn(n.column.field,n.operator,d),a=i.parent.dataOperation.getDurationString(o,l)}else n.fltrObj.filterByColumn(n.column.field,n.operator,null),a=null}}},e.prototype.columnMenuOpen=function(e){this.filterMenuElement&&document.body.contains(this.filterMenuElement)&&t.remove(this.filterMenuElement),this.filterMenuElement=null},e.prototype.actionBegin=function(e){},e.prototype.closeFilterOnContextClick=function(e){var i=document.querySelector("body > div.e-datepicker"),r=document.querySelector("body > div.e-datetimepicker");if(this.filterMenuElement&&document.body.contains(this.filterMenuElement)){var a=t.closest(e,"#"+this.parent.element.id)||e.querySelector("#"+this.parent.element.id);(!this.filterMenuElement.contains(e)&&!t.isNullOrUndefined(a)||!this.filterMenuElement.contains(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)&&("DIV"===e.nodeName||"HTML"===e.nodeName||"SPAN"===e.nodeName||"BUTTON"===e.nodeName))&&(t.remove(this.filterMenuElement),this.parent.treeGrid.grid.notify("filter-menu-close",{isOpen:!1}),this.filterMenuElement=null)}},e.prototype.actionComplete=function(e){if(t.isNullOrUndefined(e.filterModel)||t.isNullOrUndefined(e.filterModel.dialogObj)||t.isNullOrUndefined(e.filterModel.dialogObj.element)||"Excel"===this.parent.filterSettings.type&&this.wireEvents(e.filterModel.dialogObj.element.id),e.requestType===r.filterAfterOpen){"Menu"===this.parent.treeGrid.filterSettings.type?this.filterMenuElement=t.getValue("filterModel.dlgObj.element",e):this.filterMenuElement=t.getValue("filterModel.dialogObj.element",e),this.updateFilterMenuPosition(this.filterMenuElement,e);var i=this.parent.taskFields.id,a=this.parent.taskFields.dependency,n=this.parent.taskFields.resourceInfo,s=this.parent.treeGrid.grid.filterModule,o=t.getValue("values",s);if(e.columnName===a&&t.isNullOrUndefined(t.getValue(a,o))||e.columnName===n&&t.isNullOrUndefined(t.getValue(n,o))){var l=this.filterMenuElement.querySelector(".e-dropdownlist"),d=void 0;t.isNullOrUndefined(l)||((d=t.getValue("ej2_instances[0]",l)).index=2,d.dataBind())}else if(e.columnName===i&&t.isNullOrUndefined(t.getValue(i,o))&&"Menu"===this.parent.treeGrid.filterSettings.type){l=this.filterMenuElement.querySelector(".e-flmenu-input"),d=t.getValue("ej2_instances[0]",l);!t.isNullOrUndefined(d)&&t.isNullOrUndefined(this.parent.columnByField[e.columnName].format)&&(d.format="n")}}},e.prototype.setPosition=function(e,i){var r,a,n,s,o,l,d,h=this.parent.element.getBoundingClientRect(),p=h.top,c=h.left;if(!t.isNullOrUndefined(this.parent.element.parentNode)&&"BODY"!=this.parent.element.parentNode.tagName){for(a=(r=this.parent.element.parentNode).getBoundingClientRect().top,l=r.style.marginTop;;){if(Math.abs(p)>Math.abs(a)){s=p-a;break}t.isNullOrUndefined(this.parent.element.parentNode)||(l=(r=r.parentNode).parentNode.style.marginTop),a=r.getBoundingClientRect().top}for(n=r.getBoundingClientRect().left,d=r.style.marginLeft;;){if(Math.abs(c)>Math.abs(n)){o=c-n;break}t.isNullOrUndefined(this.parent.element.parentNode)||(d=(r=r.parentNode).style.marginLeft),n=r.getBoundingClientRect().left}}var u=e.getBoundingClientRect(),g=u.right+window.scrollX,f=u.top+window.scrollY;h.right<g+i.offsetWidth?u.left-i.offsetWidth>h.left?g=u.left-i.offsetWidth:g-=g+i.offsetWidth-h.right:t.isNullOrUndefined(s)||t.isNullOrUndefined(o)||(g=Math.abs(u.right-h.left),f=Math.abs(u.top-h.top)),t.isNullOrUndefined(s)||t.isNullOrUndefined(o)?(i.style.top=f+"px",i.style.left=g+"px"):(i.style.top="string"==typeof parseInt(l)?f+s+parseInt(l)+"px":f+s+"px",i.style.left="string"==typeof parseInt(d)?g+o+parseInt(d)+8+"px":g+o+"px")},e.prototype.updateFilterMenuPosition=function(e,i){t.addClass([e],"e-gantt"),document.querySelector("#"+this.parent.controlId).appendChild(e);var a;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,t.getValue("filterModel.dlgObj.element",i)):this.setPosition(a,t.getValue("filterModel.dialogObj.element",i))):(a=this.parent.treeGrid.grid.getColumnHeaderByField(i.columnName).querySelector(".e-filtermenudiv"),"Menu"===this.parent.treeGrid.filterSettings.type?r.getFilterMenuPostion(a,t.getValue("filterModel.dlgObj",i)):r.getFilterMenuPostion(a,t.getValue("filterModel.dialogObj",i))),"Menu"===this.parent.treeGrid.filterSettings.type&&e.querySelector(".e-valid-input").focus()},e.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))},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents()},e}(),ci=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Sort),this.parent.treeGrid.allowSorting=this.parent.allowSorting,this.parent.treeGrid.sortSettings=r.getActualProperties(this.parent.sortSettings),this.addEventListener()}return e.prototype.getModuleName=function(){return"sort"},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("updateModel",this.updateModel)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.sortColumn=function(e,t,i){this.parent.treeGrid.sortByColumn(e,t,i)},e.prototype.clearSorting=function(){this.parent.treeGrid.clearSorting()},e.prototype.updateModel=function(){this.parent.sortSettings=this.parent.treeGrid.sortSettings},e.prototype.removeSortColumn=function(e){this.parent.treeGrid.grid.removeSortColumn(e)},e}(),ui=function(){function e(e){this.isSelectionFromChart=!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=r.getActualProperties(this.parent.selectionSettings),this.wireEvents()}return e.prototype.getModuleName=function(){return"selection"},e.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)},e.prototype.selectRowByIndex=function(){-1===this.parent.selectedRowIndex&&-1===this.parent.staticSelectedRowIndex||!this.parent.isLoad||(this.selectRow(-1!==this.parent.staticSelectedRowIndex?this.parent.staticSelectedRowIndex:this.parent.selectedRowIndex),this.parent.staticSelectedRowIndex=-1)},e.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)},e.prototype.rowSelecting=function(e){this.parent.isGanttChartRendered?(e.isCtrlPressed=this.isMultiCtrlRequest,e.isShiftPressed=this.isMultiShiftRequest,e.target=this.actualTarget,t.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.parent.trigger("rowSelecting",e)):e.cancel=!0},e.prototype.rowSelected=function(e){var i="Multiple"!==this.parent.selectionSettings.type||t.isNullOrUndefined(e.rowIndexes)?[e.rowIndex]:e.rowIndexes;this.addRemoveClass(i),this.selectedRowIndexes=t.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:this.parent.treeGrid.grid.selectedRowIndex},!0),this.isMultiShiftRequest&&(this.selectedRowIndexes=i),this.parent.autoFocusTasks&&this.parent.ganttChartModule.updateScrollLeft(t.getValue("data.ganttProperties.left",e)),e.target=this.actualTarget,t.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.prevRowIndex=e.rowIndex,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(e),this.parent.trigger("rowSelected",e)},e.prototype.rowDeselecting=function(e){e.target=this.actualTarget,e.isInteracted=this.isInteracted,this.parent.trigger("rowDeselecting",e)},e.prototype.rowDeselected=function(e){var i,r;if(0!==this.multipleIndexes.length)i=this.multipleIndexes;else if(t.isNullOrUndefined(e.rowIndexes))i=[e.rowIndex];else{for(var a=0;a<e.rowIndexes.length;a++)e.rowIndexes[a]===e.rowIndex&&(r=!0);i=r?e.rowIndexes:[e.rowIndex]}this.addRemoveClass(i),this.selectedRowIndexes=t.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:-1},!0),1===this.selectedRowIndexes.length&&this.parent.setProperties({selectedRowIndex:this.selectedRowIndexes[0]},!0),t.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=[]},e.prototype.cellSelecting=function(e){var t=new a.Deferred;return this.parent.trigger("cellSelecting",e,function(e){t.resolve(e)}),t},e.prototype.cellSelected=function(e){this.parent.trigger("cellSelected",e),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.cellDeselecting=function(e){this.parent.trigger("cellDeselecting",e)},e.prototype.cellDeselected=function(e){this.parent.trigger("cellDeselected",e),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.selectCell=function(e,t){this.parent.treeGrid.selectCell(e,t)},e.prototype.selectCells=function(e){this.parent.treeGrid.grid.selectCells(e)},e.prototype.selectRow=function(e,i,r){var a,n=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children).filter(function(t){return parseInt(t.getAttribute("aria-rowindex"),0)===e})[0];-1===e||t.isNullOrUndefined(n)||"Cell"===this.parent.selectionSettings.mode||(this.parent.showActiveElement&&!r?this.parent.treeGrid.grid.selectionModule.preventFocus=!0:this.parent.treeGrid.grid.selectionModule.preventFocus=!1,t.isNullOrUndefined(this.selectedClass)||this.selectedClass!==n||i||(a=!0),!0!==a&&this.parent.treeGrid.selectRow(e,i),this.parent.treeGrid.grid.selectionModule.preventFocus=!0!==this.parent.treeGrid.grid.selectionModule.preventFocus&&this.parent.treeGrid.grid.selectionModule.preventFocus,this.prevRowIndex=e,this.selectedClass=n)},e.prototype.selectRows=function(e){!t.isNullOrUndefined(e)&&e.length>0&&this.parent.treeGrid.selectRows(e)},e.prototype.getSelectedRowIndexes=function(){return this.parent.treeGrid.getSelectedRowIndexes()},e.prototype.getSelectedRowCellIndexes=function(){return this.parent.treeGrid.getSelectedRowCellIndexes()},e.prototype.getSelectedRecords=function(){return this.parent.treeGrid.getSelectedRecords()},e.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},e.prototype.getSelectedRows=function(){return this.parent.treeGrid.getSelectedRows()},e.prototype.clearSelection=function(){this.addRemoveClass(this.selectedRowIndexes),this.parent.treeGrid.clearSelection(),this.parent.selectedRowIndex=-1,this.selectedRowIndexes=[],this.selectedClass=null,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),this.isInteracted=!1},e.prototype.highlightSelectedRows=function(e,i){if(this.isMultiCtrlRequest=e.ctrlKey||this.enableSelectMultiTouch,this.isMultiShiftRequest=e.shiftKey,this.actualTarget=e.target,this.isInteracted=!0,this.isSelectionFromChart=i,i){var r=t.closest(e.target,"tr.e-chart-row"),a=parseInt(r.getAttribute("aria-rowindex"),10),n=this.parent.selectionSettings.enableToggle;if("Single"===this.parent.selectionSettings.type||!this.isMultiCtrlRequest&&!this.isMultiShiftRequest)(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&!this.parent.rowDragAndDropModule.draggedRecord)&&this.selectRow(a,n);else if(this.isMultiShiftRequest)this.selectRowsByRange(t.isNullOrUndefined(this.prevRowIndex)?a:this.prevRowIndex,a);else{t.setValue("isMultiCtrlRequest",!0,this.parent.treeGrid.grid.selectionModule),this.parent.treeGrid.grid.selectionModule.addRowsToSelection([a]);this.selectedRowIndexes.indexOf(a)>-1&&this.addRemoveClass([a])}}},e.prototype.getselectedrowsIndex=function(e,t){for(var i=[],r=e<t?{i:e,max:t}:{i:t,max:e},a=r.i,n=r.max;a<=n;a++)i.push(a);e>t&&i.reverse(),this.selectedRowIndexes=i},e.prototype.selectRowsByRange=function(e,t){this.isSelectionFromChart=!0,this.getselectedrowsIndex(e,t),this.selectRows(this.selectedRowIndexes)},e.prototype.addRemoveClass=function(e){"number"==typeof e&&(e=[e]);for(var i=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children),r=function(r){var n=i.filter(function(t){return parseInt(t.getAttribute("aria-rowindex"),0)===e[r]})[0];t.isNullOrUndefined(n)||(a.getSelectedRowIndexes().indexOf(e[r])>-1?a.addClass(n):a.removeClass(n))},a=this,n=0;n<e.length;n++)r(n)},e.prototype.addClass=function(e){t.addClass([e],"e-active"),e.setAttribute("aria-selected","true")},e.prototype.removeClass=function(e){t.removeClass([e],"e-active"),e.removeAttribute("aria-selected")},e.prototype.showPopup=function(e){this.isSelectionFromChart?(r.setCssInGridPopUp(this.parent.element.querySelector(".e-ganttpopup"),e,"e-rowselect e-icons e-icon-rowselect"+(this.enableSelectMultiTouch&&(this.getSelectedRecords().length>1||this.getSelectedRowCellIndexes().length>1)?" e-spanclicked":"")),document.getElementsByClassName("e-gridpopup")[0].style.display="none",this.openPopup=!0):0===this.selectedRowIndexes.length&&this.hidePopUp()},e.prototype.hidePopUp=function(){this.openPopup?(document.getElementsByClassName("e-ganttpopup")[0].style.display="none",this.openPopup=!1):document.getElementsByClassName("e-gridpopup")[0].style.display="none"},e.prototype.popUpClickHandler=function(e){var i=e.target,r=this.parent.treeGrid.grid,a=t.closest(i,".e-ganttpopup")?t.closest(i,".e-ganttpopup"):t.closest(i,".e-gridpopup");if(a){var n=a.querySelector(".e-rowselect");t.closest(i,".e-ganttpopup")&&!n.classList.contains("e-spanclicked")?(this.enableSelectMultiTouch=!0,n.classList.add("e-spanclicked")):t.closest(i,".e-gridpopup")&&n.classList.contains("e-spanclicked")?(this.openPopup=!0,this.enableSelectMultiTouch=!0):(this.hidePopUp(),this.enableSelectMultiTouch=!1,t.closest(i,".e-ganttpopup")&&n.classList.remove("e-spanclicked"))}else if("Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive){t.closest(i,".e-rowcell")&&0===this.selectedRowIndexes.length&&this.hidePopUp()}r&&t.setValue("enableSelectMultiTouch",this.enableSelectMultiTouch,r.selectionModule)},e.prototype.mouseUpHandler=function(e){var i=!1,a=document.querySelectorAll(".e-drag-item"),n=null;if(e.target.closest(".e-rowcell")?n=e.target:e.target.closest(".e-chart-row")&&(n=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(n),this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&this.parent.editModule.taskbarEditModule){var s=this.parent.editModule.taskbarEditModule;(s.isMouseDragged||s.tapPointOnFocus)&&(i=!0)}if(!i&&this.parent.element.contains(e.target)&&1!==a.length){var o=r.parentsUntil(e.target,"e-chart-row"),l=e.target.classList.contains("e-rowcell")||e.target.classList.contains("e-row")||e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse")||!t.isNullOrUndefined(o);this.popUpClickHandler(e),"Cell"!==this.parent.selectionSettings.mode&&l?(t.closest(e.target,"tr.e-chart-row")?(this.parent.enableVirtualization&&(this.parent.treeGrid.grid.selectionModule.isInteracted=!0),this.highlightSelectedRows(e,!0)):this.highlightSelectedRows(e,!1),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&(this.selectedRowIndexes.length>0?this.showPopup(e):this.hidePopUp())):this.isSelectionFromChart=!1}},e.prototype.maintainSelectedRecords=function(e){this.parent.selectionModule.getSelectedRowIndexes().indexOf(e)>-1&&this.addRemoveClass([e])},e.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))},e}(),gi=function(){function e(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)}return e.prototype.getModuleName=function(){return"toolbar"},e.prototype.renderToolbar=function(){if((this.parent.toolbar||[]).length>0){this.element=t.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,i=["Add","Edit","Update","Delete","Cancel","ExpandAll","CollapseAll","PrevTimeSpan","NextTimeSpan","ZoomIn","ZoomOut","ZoomToFit","ExcelExport","CsvExport","PdfExport","Indent","Outdent","CriticalPath"];e<i.length;e++){var r=i[e],a=void 0,n=void 0;"CriticalPath"===r?(a="critical-path",n="criticalPath"):(a=r.toLowerCase(),n=r[0].toLowerCase()+r.slice(1)),this.predefinedItems[r]={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"===r&&(this.predefinedItems[r].prefixIcon="e-nexttimespan"),"NextTimeSpan"===r&&(this.predefinedItems[r].prefixIcon="e-prevtimespan"))}var s=this.parent.localeObj.getConstant("search");this.parent.isAdaptive?this.predefinedItems.Search={id:this.id+"_searchbutton",prefixIcon:"e-search-icon",tooltipText:s,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= "'+s+'"/><span id="'+this.id+'_searchbutton" class="e-input-group-icon e-search-icon e-icons"tabindex="-1" title="'+s+'" aria-label= "search"></span></div>',tooltipText:s,align:"Right",cssClass:"e-search-wrapper"},this.createToolbar()}},e.prototype.addReactToolbarPortals=function(e){this.parent.isReact&&e&&(this.parent.portals=this.parent.portals.concat(e),this.parent.renderTemplates())},e.prototype.createToolbar=function(){var e=this.getItems();this.toolbar=new l.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);var i=this.element.querySelector("#"+this.parent.element.id+"_cancel"),r=this.element.querySelector("#"+this.parent.element.id+"_update");if(i&&t.addClass([i],"e-grid"),r&&t.addClass([r],"e-grid"),this.parent.isAdaptive){this.element.insertBefore(this.getSearchBarElement(),this.element.childNodes[0]),this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar");new h.TextBox({placeholder:this.parent.localeObj.getConstant("search"),enableRtl:this.parent.enableRtl,floatLabelType:"Never",showClearButton:!0}).appendTo(this.searchElement)}else this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar");this.parent.filterModule&&(this.wireEvent(),this.parent.searchSettings&&this.updateSearchTextBox()),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)},e.prototype.getSearchBarElement=function(){var e=this,i=t.createElement("div",{className:"e-adaptive-searchbar",styles:"display: none"}),r=t.createElement("input",{attrs:{type:"text"},id:this.parent.element.id+"_searchbar"}),a=t.createElement("span",{className:"e-backarrowspan e-icons"});return a.onclick=function(){i.style.display="none",e.element.childNodes[1].style.display="block"},i.appendChild(a),i.appendChild(r),i},e.prototype.wireEvent=function(){this.searchElement&&(t.EventHandler.add(this.searchElement,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.searchElement,"focus",this.focusHandler,this),t.EventHandler.add(this.searchElement,"blur",this.blurHandler,this))},e.prototype.propertyChanged=function(e){t.getValue("module",e)===this.getModuleName()&&this.parent.toolbar&&(this.element&&this.element.parentNode&&t.remove(this.element),this.renderToolbar(),this.refreshToolbarItems())},e.prototype.unWireEvent=function(){this.searchElement&&(t.EventHandler.remove(this.searchElement,"keyup",this.keyUpHandler),t.EventHandler.remove(this.searchElement,"focus",this.focusHandler),t.EventHandler.remove(this.searchElement,"blur",this.blurHandler),this.searchElement=null),this.parent.off("ui-toolbarupdate",this.propertyChanged)},e.prototype.keyUpHandler=function(e){13===e.keyCode&&this.parent.searchSettings.key!==this.searchElement.value&&(this.parent.searchSettings.key=this.searchElement.value,this.parent.dataBind())},e.prototype.focusHandler=function(e){e.target.parentElement.classList.add("e-input-focus")},e.prototype.blurHandler=function(e){e.target.parentElement.classList.remove("e-input-focus")},e.prototype.updateSearchTextBox=function(){this.searchElement&&this.searchElement.value!==this.parent.searchSettings.key&&(this.searchElement.value=this.parent.searchSettings.key)},e.prototype.getItems=function(){var e=[],t=this.parent.toolbar,i=-1;if(t.forEach(function(e,t){("string"==typeof e&&"Search"===e||"object"==typeof e&&"Search"===e.text)&&(i=t)}),i>-1){var r=t.splice(i,1);t.push(r[0])}for(var a=0,n=t;a<n.length;a++){var s=n[a];"string"==typeof s?e.push(this.getItemObject(s)):e.push(this.getItem(s))}return e},e.prototype.getItem=function(e){var i=this.predefinedItems[e.text];return i?t.extend(i,i,e):e},e.prototype.getItemObject=function(e){return this.predefinedItems[e]||{text:e,id:this.id+"_"+e}},e.prototype.toolbarClickHandler=function(e){var i=this,r=this.parent,a=this.id;this.parent.isToolBarClick=!1,t.extend(e,{cancel:!1}),e.item.properties.id!==this.parent.element.id+"_pdfexport"&&e.item.properties.id!==this.parent.element.id+"_critical-path"||(t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow()),r.trigger("toolbarClick",e,function(e){if(!e.cancel)switch(!0===i.parent.isAdaptive&&(e.item.id!==a+"_edit"&&e.item.id!==a+"_add"&&e.item.id!==a+"_delete"&&e.item.id!==a+"_searchbutton"&&e.item.id!==a+"_expandall"&&e.item.id!==a+"_collapseall"||i.parent.selectionModule&&"Multiple"===i.parent.selectionSettings.type&&(i.parent.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),!t.isNullOrUndefined(e.item)&&e.item.id){case a+"_edit":r.editModule&&r.editSettings.allowEditing&&r.editModule.dialogModule.openToolbarEditDialog();break;case a+"_indent":r.editModule&&r.selectionModule.getSelectedRecords().length&&r.indent();break;case a+"_critical-path":r.enableCriticalPath?r.enableCriticalPath=!1:r.enableCriticalPath=!0;break;case a+"_outdent":r.editModule&&r.selectionModule.getSelectedRecords().length&&r.outdent();break;case a+"_update":r.editModule.cellEditModule.isCellEdit=!1,r.treeGrid.grid.saveCell();break;case a+"_cancel":r.cancelEdit();break;case a+"_add":r.editModule&&r.editSettings.allowAdding&&r.editModule.dialogModule.openAddDialog();break;case a+"_delete":i.parent.selectionModule&&i.parent.editModule&&("Cell"!==i.parent.selectionSettings.mode&&i.parent.selectionModule.selectedRowIndexes.length||"Cell"===i.parent.selectionSettings.mode&&i.parent.selectionModule.getSelectedRowCellIndexes().length)&&i.parent.editModule.startDeleteAction();break;case a+"_search":if(t.getValue("originalEvent.target.id",e)===i.parent.element.id+"_searchbutton"&&i.parent.filterModule){var n=i.element.querySelector("#"+i.parent.element.id+"_searchbar").value;i.parent.searchSettings.key!==n&&(i.parent.searchSettings.key=n,i.parent.dataBind())}break;case a+"_searchbutton":var s=i.element.querySelector(".e-adaptive-searchbar");s.parentElement.childNodes[1].style.display="none",s.style.display="block";break;case a+"_expandall":i.parent.ganttChartModule.expandCollapseAll("expand");break;case a+"_collapseall":i.parent.ganttChartModule.expandCollapseAll("collapse");break;case a+"_prevtimespan":i.parent.previousTimeSpan();break;case a+"_nexttimespan":i.parent.nextTimeSpan();break;case a+"_zoomin":i.zoomIn();break;case a+"_zoomout":i.zoomOut();break;case a+"_zoomtofit":i.zoomToFit()}})},e.prototype.zoomIn=function(){this.parent.timelineModule.processZooming(!0)},e.prototype.zoomToFit=function(){this.parent.timelineModule.isZoomIn&&(this.parent.timelineModule.isZoomIn=!1),this.parent.timelineModule.processZoomToFit(),this.parent.ganttChartModule.updateScrollLeft(0)},e.prototype.zoomOut=function(){this.parent.timelineModule.processZooming(!1)},e.prototype.refreshToolbarItems=function(e){var i,r=this.parent,a=[],n=[],s=r.editSettings,o=this.id,l=r.selectedRowIndex,d=!!r.selectionModule&&(1===r.selectionModule.selectedRowIndexes.length||1===r.selectionModule.getSelectedRowCellIndexes().length),h=this.toolbar?this.toolbar.items:[],p=[o+"_add",o+"_edit",o+"_delete",o+"_update",o+"_cancel",o+"_indent",o+"_outdent"],c="ResourceView"===this.parent.viewType&&0!==t.getValue("data.level",e)||"ProjectView"===this.parent.viewType;if(t.isNullOrUndefined(this.parent.editModule))n.push(o+"_delete"),n.push(o+"_add"),n.push(o+"_edit"),n.push(o+"_update"),n.push(o+"_cancel"),n.push(o+"_indent"),n.push(o+"_outdent");else{var u=!!r.editModule.taskbarEditModule&&r.editModule.taskbarEditModule.touchEdit,g=r.flatData&&r.flatData.length;s.allowAdding&&!u?a.push(o+"_add"):n.push(o+"_add"),s.allowEditing&&c&&g&&d&&!u?a.push(o+"_edit"):n.push(o+"_edit"),s.allowEditing&&0!==l&&-1!==l&&g&&d&&"ResourceView"!==this.parent.viewType?0===r.updatedRecords[l].level&&g&&!u?(a.push(o+"_indent"),n.push(o+"_outdent")):(i=r.updatedRecords[l-1],r.updatedRecords[l].level-i.level==1&&-1!==l?(n.push(o+"_indent"),a.push(o+"_outdent")):-1!==l&&(a.push(o+"_indent"),a.push(o+"_outdent"))):(n.push(o+"_indent"),n.push(o+"_outdent"));var f=!!r.selectionModule&&(r.selectionModule.selectedRowIndexes.length>0||r.selectionModule.getSelectedRowCellIndexes().length>0);if(s.allowDeleting&&g&&f&&!u?a.push(o+"_delete"):n.push(o+"_delete"),"Auto"===r.editSettings.mode&&!t.isNullOrUndefined(r.editModule.cellEditModule)&&r.editModule.cellEditModule.isCellEdit){(a=[]).push(o+"_update",o+"_cancel"),n=[];for(var m=0;m<h.length;m++)h[m].id!==o+"_update"&&h[m].id!==o+"_cancel"&&-1!==p.indexOf(h[m].id)&&n.push(h[m].id)}else{n.push(o+"_update",o+"_cancel");for(m=0;m<h.length;m++)-1===a.indexOf(h[m].id)&&-1===n.indexOf(h[m].id)&&a.push(h[m].id)}}for(var y=0;y<a.length;y++){var D=void 0;for(m=0;m<h.length;m++)if(h[m].id===a[y]){D=m;break}h.length>0&&this.toolbar.hideItem(D,!1)}for(var v=0;v<n.length;v++){for(D=void 0,m=0;m<h.length;m++)if(h[m].id===n[v]){D=m;break}h.length>0&&this.toolbar.hideItem(D,!0)}},e.prototype.enableItems=function(e,t){for(var i=0,r=e;i<r.length;i++){var a=r[i],n=this.element.querySelector("#"+a);n&&this.toolbar.enableItems(n.parentElement,t)}},e.prototype.destroy=function(){this.parent.isDestroyed||(this.toolbar.off("render-react-toolbar-template",this.addReactToolbarPortals),this.toolbar.destroy(),this.parent.filterModule&&this.unWireEvent(),t.remove(this.element))},e}(),fi=function(){function e(e){this.weekendWidthUpdated=!1,this.parent=e,this.nonworkingContainer=null,this.holidayContainer=null,this.weekendContainer=null}return e.prototype.createNonworkingContainer=function(){this.parent.ganttChartModule.chartBodyContent.contains(this.nonworkingContainer)||(this.nonworkingContainer=t.createElement("div",{className:"e-nonworking-day-container"}),this.parent.ganttChartModule.chartBodyContent.insertBefore(this.nonworkingContainer,this.parent.ganttChartModule.chartBodyContent.lastChild))},e.prototype.renderHolidays=function(){this.parent.holidays&&this.parent.holidays.length>0?(this.createNonworkingContainer(),this.nonworkingContainer.contains(this.holidayContainer)||(this.holidayContainer=t.createElement("div",{className:"e-holiday-container"}),this.nonworkingContainer.appendChild(this.holidayContainer)),this.holidayContainer.innerHTML=this.getHolidaysElement().innerHTML):this.holidayContainer&&this.holidayContainer.parentNode&&(t.remove(this.holidayContainer),this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&t.remove(this.nonworkingContainer))},e.prototype.getHolidaysElement=function(){var e,i,r=t.createElement("div"),a=this.parent.contentHeight,n=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(n=this.parent.toolbarModule.element.offsetHeight);for(var s=this.parent.ganttHeight-n-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight,o=0;o<this.parent.holidays.length;o++){this.parent.holidays[o].from&&this.parent.holidays[o].to?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from),(i=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].to)).setDate(i.getDate()+1),e.setHours(0,0,0,0),i.setHours(0,0,0,0)):this.parent.holidays[o].from?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from)).setHours(0,0,0,0):this.parent.holidays[o].to&&(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].to)).setHours(0,0,0,0);var l=this.parent.holidays[o].from&&this.parent.holidays[o].to?this.parent.dataOperation.getTaskWidth(e,i):this.parent.perDayWidth,d=this.parent.dataOperation.getTaskLeft(e,!1),h=this.parent.enableRtl?"right:"+d+"px;":"left:"+d+"px;",p=t.createElement("div",{className:"e-holiday",styles:h+" width:"+l+"px; height:100%;"}),c=s<a?s/2:a/2,u=t.createElement("span",{className:"e-span",styles:"top:"+c+"px;left:"+l/2+"px;"}),g=this.parent.disableHtmlEncode?"textContent":"innerHTML";u[g]=this.parent.holidays[o].label?this.parent.holidays[o].label:"",this.parent.enableHtmlSanitizer&&"string"==typeof u[g]&&(u[g]=t.SanitizeHtmlHelper.sanitize(u[g])),p.appendChild(u),this.parent.holidays[o].cssClass&&p.classList.add(this.parent.holidays[o].cssClass),r.appendChild(p)}return r},e.prototype.renderWeekends=function(){this.parent.highlightWeekends?(this.createNonworkingContainer(),this.nonworkingContainer.contains(this.weekendContainer)||(this.weekendContainer=t.createElement("div",{className:"e-weekend-container"}),this.nonworkingContainer.appendChild(this.weekendContainer)),this.weekendContainer.innerHTML=this.getWeekendElements().innerHTML):this.weekendContainer&&(t.remove(this.weekendContainer),this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&t.remove(this.nonworkingContainer))},e.prototype.getWeekendElements=function(){var e=t.createElement("div"),i=new Date(this.parent.timelineModule.timelineStartDate.getTime()),r=new Date(this.parent.timelineModule.timelineEndDate.getTime()),a=this.parent.nonWorkingDayIndex,n=!0;do{if(-1!==a.indexOf(i.getDay())){var s=this.parent.dataOperation.getTaskLeft(i,!1),o=this.parent.perDayWidth;if(n){var l=new Date(i.getTime()),d=new Date(l.getTime());d.setDate(d.getDate()+1),d.setHours(0,0,0,0),o=this.parent.dataOperation.getTaskWidth(l,d),n=!1}var h=new Date(i);h.setDate(h.getDate()+1),h.getTimezoneOffset()==this.parent.timelineModule.timelineStartDate.getTimezoneOffset()||this.weekendWidthUpdated||"Hour"==this.parent.timelineModule.bottomTier&&1===this.parent.timelineSettings.bottomTier.count&&(o-=this.parent.timelineSettings.timelineUnitSize,this.weekendWidthUpdated=!0);var p=this.parent.enableRtl?"right:"+s+"px;":"left:"+s+"px;",c=t.createElement("div",{className:"e-weekend",styles:p+" width:"+o+"px;height:100%;"});e.appendChild(c)}i.setDate(i.getDate()+1),i.setHours(0,0,0,0)}while(i<r);return e},e.prototype.updateHolidayLabelHeight=function(){var e=this.parent.getContentHeight(),i=document.getElementById("ganttContainer"),r=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(r=this.parent.toolbarModule.element.offsetHeight);for(var a="auto"===this.parent.height?i.offsetHeight-r-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight:this.parent.ganttHeight-r-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight,n=a<e?a/2:e/2,s=this.holidayContainer.querySelectorAll(".e-span"),o=0;o<s.length;o++)s[o].style.top=t.formatUnit(n)},e.prototype.updateContainerHeight=function(){var e=this.parent.getContentHeight();this.holidayContainer&&(this.holidayContainer.style.height=t.formatUnit(e),this.updateHolidayLabelHeight()),this.weekendContainer&&(this.weekendContainer.style.height=t.formatUnit(e))},e.prototype.removeContainers=function(){this.holidayContainer&&t.remove(this.holidayContainer),this.weekendContainer&&t.remove(this.weekendContainer),this.nonworkingContainer&&t.remove(this.nonworkingContainer)},e}(),mi=function(){function e(e){this.parent=e,this.eventMarkersContainer=null}return e.prototype.renderEventMarkers=function(){this.parent.eventMarkers&&this.parent.eventMarkers.length>0?(this.parent.ganttChartModule.chartBodyContent.contains(this.eventMarkersContainer)||(this.eventMarkersContainer=t.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()},e.prototype.removeContainer=function(){this.eventMarkersContainer&&(t.remove(this.eventMarkersContainer),this.eventMarkersContainer=null)},e.prototype.getEventMarkersElements=function(e){for(var i,r,a,n,s=0;s<this.parent.eventMarkers.length;s++){i=this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[s].day,!0),!1);var o=void 0;if(o=this.parent.enableRtl?"right:"+i+"px;":"left:"+i+"px;",r=t.createElement("div",{className:"e-event-markers",styles:o+" height:100%;",id:"stripline"+s}),this.parent.eventMarkers[s].label){a=t.createElement("div",{className:"e-span-label"});var l=this.parent.disableHtmlEncode?"textContent":"innerHTML";a[l]=this.parent.eventMarkers[s].label,this.parent.enableHtmlSanitizer&&"string"==typeof a[l]&&(a[l]=t.SanitizeHtmlHelper.sanitize(a[l])),this.parent.enableRtl?a.style.right="5px":a.style.left="5px",r.appendChild(a),n=t.createElement("div",{className:"e-gantt-right-arrow"}),r.appendChild(n)}this.parent.eventMarkers[s].cssClass&&r.classList.add(this.parent.eventMarkers[s].cssClass),r.setAttribute("tabindex","-1"),t.isNullOrUndefined(this.parent.eventMarkers[s].day)||r.setAttribute("aria-label",this.parent.localeObj.getConstant("eventMarkers")+" "+("string"==typeof this.parent.eventMarkers[s].day?this.parent.eventMarkers[s].day:this.parent.getFormatedDate(this.parent.eventMarkers[s].day))+" "+this.parent.eventMarkers[s].label),e.appendChild(r)}},e.prototype.updateContainerHeight=function(){this.eventMarkersContainer&&(this.eventMarkersContainer.style.height=t.formatUnit(this.parent.getContentHeight()))},e}(),yi=function(){function e(e){this.parent=e,this.nonworkingDayRender=new fi(this.parent),this.eventMarkerRender=new mi(this.parent),this.wireEvents()}return e.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)},e.prototype.propertyChanged=function(e){for(var i=Object.keys(t.getValue("properties",e)),r=0;r<i.length;r++){switch(i[r]){case"eventMarkers":this.eventMarkerRender.renderEventMarkers(),this.updateHeight();break;case"highlightWeekends":this.nonworkingDayRender.renderWeekends(),this.updateHeight();break;case"holidays":this.nonworkingDayRender.renderHolidays(),this.updateHeight()}}},e.prototype.refreshMarkers=function(){this.nonworkingDayRender.renderWeekends(),this.nonworkingDayRender.renderHolidays(),"Vertical"!==this.parent.gridLines&&"Both"!==this.parent.gridLines||this.parent.renderChartVerticalLines(),this.eventMarkerRender.renderEventMarkers()},e.prototype.updateHeight=function(){this.nonworkingDayRender.updateContainerHeight(),this.eventMarkerRender.updateContainerHeight()},e.prototype.getModuleName=function(){return"dayMarkers"},e.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))},e}(),Di=function(){function e(e){this.resourceCollectionIds=[],this.criticalTasks=[],this.parent=e}return e.prototype.getCriticalTasks=function(){return this.criticalTasks},e.prototype.showCriticalPath=function(e){var t=this.parent.ids,i=this.parent.flatData;if(e&&this.parent.flatData.length>0){this.parent.enableCriticalPath=!0;var r=this.parent.treeGrid.parentData,a=r[0].ganttProperties.endDate,n=0,s=[],o=[],l=[],d=0,h=[],p=[],c=[],u=[],g=[],f=[];r[0].ganttProperties.autoEndDate>r[0].ganttProperties.endDate&&!r[0].ganttProperties.isAutoSchedule&&(a=r[0].ganttProperties.autoEndDate),r[0].ganttProperties.taskId;for(var m=1;m<r.length;m++)r[m].ganttProperties.endDate>=a&&(a=r[m].ganttProperties.endDate,r[m].ganttProperties.taskId),r[m].ganttProperties.isAutoSchedule||r[m].ganttProperties.autoEndDate>=a&&(a=r[m].ganttProperties.autoEndDate,r[m].ganttProperties.taskId);this.maxEndDate=a;for(var y=0;y<i.length;y++)i[y].isCritical=!1,i[y].ganttProperties.isCritical=!1,n=this.parent.dataOperation.getDuration(i[y].ganttProperties.endDate,a,i[y].ganttProperties.durationUnit,i[y].ganttProperties.isAutoSchedule,i[y].ganttProperties.isMilestone),i[y].slack=n+" "+i[y].ganttProperties.durationUnit,i[y].ganttProperties.slack=n+" "+i[y].ganttProperties.durationUnit,i[y].ganttProperties.endDate>=a&&s.push(i[y].ganttProperties.taskId),i[y].ganttProperties.predecessor&&0!==i[y].ganttProperties.predecessor.length&&(o.push(i[y]),l.push(i[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=function(e){if(-1===l.indexOf(s[e])){if("ProjectView"===v.parent.viewType)d=t.indexOf(s[e].toString());else for(var r=v.parent.currentViewData.filter(function(t){return parseInt(t.ganttProperties.taskId)===s[e]}),a=0;a<r.length;a++)!r[a].hasChildRecords&&r[a].ganttProperties.endDate>=v.maxEndDate&&(d=r[a].index);i[d].ganttProperties.progress<100&&(i[d].isCritical=!0,i[d].ganttProperties.isCritical=!0),i[d].slack="0 "+i[d].ganttProperties.durationUnit,h.push(s[e])}else p.push(s[e])},v=this,w=0;w<s.length;w++)D(w);for(var k=o.length,T=[],b=0;b<k;b++){for(var P=-1,S=-1,C=-1,M=-1,R=b,O=o[b].ganttProperties.predecessor,x=o[b].ganttProperties.predecessor.length,I=o[b].ganttProperties.taskId,E=0;E<x;E++)(isNaN(Number(O[E].from))||"string"==typeof I?(isNaN(Number(O[E].from)),O[E].from):parseInt(O[E].from,10))===I&&(-1===P?O[E].offset?(P=O[E].to+":"+O[E].offset+O[E].offsetUnit,C=O[E].type):(P=O[E].to,C=O[E].type):O[E].offset?(P=P+","+O[E].to+":"+O[E].offset+O[E].offsetUnit,C=C+","+O[E].type):(P=P+","+O[E].to,C=C+","+O[E].type)),(isNaN(Number(O[E].to))||"string"==typeof I?(isNaN(Number(O[E].to)),O[E].to):parseInt(O[E].to,10))===I&&(-1===S?O[E].offset?(S=O[E].from+":"+O[E].offset+O[E].offsetUnit,M=O[E].type):(S=O[E].from,M=O[E].type):O[E].offset?(S=S+","+O[E].from+":"+O[E].offset+O[E].offsetUnit,M=M+","+O[E].type):(S=S+","+O[E].from,M=M+","+O[E].type));-1===S&&(S=null,M=null),-1===P&&(P=null,C=null),c.push({from:S,fromPredecessor:M,taskid:I,to:P,toPredecessor:C,currentIndex:R,slack:null,enddate:null}),u.push(I)}for(var N=c.length,F=0,U=void 0,V=0;V<N;V++)if(!c[V].to){U=c[V].taskid,F="ProjectView"===this.parent.viewType?t.indexOf(U.toString()):this.resourceCollectionIds.indexOf(U.toString());var L=i[F].ganttProperties;n=this.parent.dataOperation.getDuration(L.endDate,a,"minute",L.isAutoSchedule,L.isMilestone),c[V].slack=n,c[V].fs=-1,c[V].enddate=L.endDate,T.push({fromdata:c[V].from,todateID:c[V].taskid,fromDataPredecessor:c[V].fromPredecessor})}for(w=0;w<T.length;w++)g.push(T[w]),this.slackCalculation(g,c,u,a,i,t);f=this.finalCriticalPath(c,h,i,t,a),this.criticalPathCollection=f,this.detailPredecessorCollection=c,this.predecessorCollectionTaskIds=u}if(!1===e&&this.parent.flatData.length>0){var B=void 0;this.parent.enableCriticalPath=!1;for(V=0;V<this.criticalPathCollection.length;V++)B=t.indexOf(this.criticalPathCollection[V].toString()),i[B].isCritical=!1;this.criticalPathCollection=[],this.detailPredecessorCollection=[],this.predecessorCollectionTaskIds=[]}},e.prototype.slackCalculation=function(e,i,r,a,n,s){var o=e[0].fromdata.split(","),l=e[0].fromDataPredecessor.split(",");r=(r=r.toString()).split(",");for(var d,h,p,c,u,g,f,m,y=[],D=0;D<o.length;D++){y=o[D].split(":"),d=r.indexOf(y[0].toString()),c=r.indexOf(e[0].todateID.toString()),"ProjectView"===this.parent.viewType?(h=s.indexOf(y[0].toString()),p=s.indexOf(e[0].todateID.toString())):(h=this.resourceCollectionIds.indexOf(y[0].toString()),p=this.resourceCollectionIds.indexOf(e[0].todateID.toString()));var v=n[h].ganttProperties,w=n[p].ganttProperties;y.length>1&&(f=-1!==y[1].indexOf("hour")?60*parseFloat(y[1]):-1!==y[1].indexOf("day")?parseFloat(y[1])*(this.parent.secondsPerDay/3600)*60:parseFloat(y[1])),"FS"===l[D]&&(u=v.endDate>w.startDate?-this.parent.dataOperation.getDuration(w.startDate,v.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.parent.dataOperation.getDuration(v.endDate,w.startDate,"minute",v.isAutoSchedule,v.isMilestone),t.isNullOrUndefined(i[d].slack)?y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u):i[d].slack>u&&0!==i[d].slack&&y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u),y.length>1&&(i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate,v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),"SS"===l[D]&&(v.isAutoSchedule?(u=v.startDate>w.startDate?-this.parent.dataOperation.getDuration(w.endDate,v.startDate,"minute",v.isAutoSchedule,v.isMilestone):this.parent.dataOperation.getDuration(v.startDate,w.startDate,"minute",v.isAutoSchedule,v.isMilestone),t.isNullOrUndefined(i[d].slack)?y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u):i[d].slack>u&&0!==i[d].slack&&y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u),y.length>1&&(i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate):v.isAutoSchedule||(u=this.getSlackDuration(v.endDate,a,"minute",n[h]),t.isNullOrUndefined(i[d].slack)?i[d].slack=u:i[d].slack>u&&0!==i[d].slack&&(i[d].slack=u)),v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),"FF"===l[D]&&(1!==i[c].fs&&1!==i[c].ff&&-1!==i[c].fs||(1!==i[c].fs&&1!==i[c].ff||(g=w.endDate,m=i[c].slack),-1===i[c].fs&&(g=i[c].enddate,m=i[c].slack),u=g>v.endDate?-this.getSlackDuration(v.endDate,g,"minute",n[h]):this.getSlackDuration(g,v.endDate,"minute",n[h]),t.isNullOrUndefined(i[d].slack)?y.length<=1&&(i[d].slack=m-u<0?0:m-u):i[d].slack>u&&0!==i[d].slack&&y.length<=1&&(i[d].slack=m-u<0?0:m-u),y.length>1&&(i[d].slack=i[c].slack-u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].ff=1,i[d].enddate=g,i[d].fsslack=m),v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),"SF"===l[D]&&(v.isAutoSchedule?t.isNullOrUndefined(i[d].slack)?(y.length<=1?t.isNullOrUndefined(i[c].to)?(u=this.getSlackDuration(v.endDate,a,"minute",n[h]),i[d].slack=u):t.isNullOrUndefined(i[c].to)||(u=w.endDate>v.startDate?-this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(w.endDate,v.startDate,"minute",n[h]),i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u):y.length>1&&(u=w.endDate>=v.endDate?v.startDate>w.endDate?-this.getSlackDuration(w.endDate,v.startDate,"minute",n[h]):this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(v.endDate,a,"minute",n[h]),i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate):(y.length<=1?(t.isNullOrUndefined(i[c].to)?u=this.getSlackDuration(v.endDate,a,"minute",n[h]):t.isNullOrUndefined(i[c].to)||(u=w.endDate>v.startDate?-this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(w.endDate,v.startDate,"minute",n[h])),i[d].slack>u&&0!==i[d].slack&&(t.isNullOrUndefined(i[c].to)?i[d].slack=u:t.isNullOrUndefined(i[c].to)||(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u))):y.length>1&&(u=w.endDate>v.endDate?v.startDate>w.endDate?-this.getSlackDuration(w.endDate,v.startDate,"minute",n[h]):this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(v.endDate,a,"minute",n[h]),i[d].slack>u&&0!==i[d].slack&&(i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0))),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate):v.isAutoSchedule||(u=this.getSlackDuration(v.endDate,a,"minute",n[h]),t.isNullOrUndefined(i[d].slack)?i[d].slack=u:i[d].slack>u&&0!==i[d].slack&&(i[d].slack=u)),v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),i[d].from&&e.push({fromdata:i[d].from,todateID:i[d].taskid,fromDataPredecessor:i[d].fromPredecessor})}e&&(e.splice(0,1),e.length>0&&this.slackCalculation(e,i,r,a,n,s))},e.prototype.getSlackDuration=function(e,t,i,r){var a=this.parent.dateValidationModule.checkStartDate(new Date(e)),n=this.parent.dateValidationModule.checkEndDate(new Date(t));return this.parent.dataOperation.getTimeDifference(a,n,!0)<=0?0:this.parent.dataOperation.getDuration(a,n,i,r.ganttProperties.isAutoSchedule,!0)},e.prototype.finalCriticalPath=function(e,t,i,r,a){for(var n,s=[],o=e.length-1;o>=0;o--){for(var l=i[n="ProjectView"===this.parent.viewType?r.indexOf(e[o].taskid.toString()):this.resourceCollectionIds.indexOf(e[o].taskid.toString())].ganttProperties.predecessor,d="0 "+i[n].ganttProperties.durationUnit,h=0;h<l.length;h++){var p=void 0;p="ProjectView"===this.parent.viewType?this.parent.ids.indexOf(l[h].to):this.resourceCollectionIds.indexOf(l[h].to);var c=void 0,u=i[n].ganttProperties;"FS"===l[h].type?0===(c=this.parent.dataOperation.getDuration(u.endDate,i[p].ganttProperties.startDate,u.durationUnit,u.isAutoSchedule,u.isMilestone))&&n!==p&&i[n].slack!==d?(i[n].slack=i[p].slack,i[n].ganttProperties.slack=i[p].slack):0!==c&&n!==p&&i[p].isCritical&&(i[n].slack=c+" "+i[n].ganttProperties.durationUnit,i[n].ganttProperties.slack=c+" "+i[n].ganttProperties.durationUnit):c="SF"===l[h].type?this.parent.dataOperation.getDuration(u.startDate,i[p].ganttProperties.endDate,u.durationUnit,u.isAutoSchedule,u.isMilestone):"SS"===l[h].type?this.parent.dataOperation.getDuration(u.startDate,i[p].ganttProperties.startDate,u.durationUnit,u.isAutoSchedule,u.isMilestone):this.parent.dataOperation.getDuration(u.endDate,i[p].ganttProperties.endDate,u.durationUnit,u.isAutoSchedule,u.isMilestone),("number"==typeof i[n][this.parent.taskFields.id]?parseInt(l[h].from,10):l[h].from)===i[n][this.parent.taskFields.id]&&i[p].slack===d&&c<=0&&(i[n].slack=d,i[n].ganttProperties.slack=d)}i[n].slack===d&&i[n].ganttProperties.progress<100&&(i[n].isCritical=!0,i[n].ganttProperties.isCritical=!0,this.criticalTasks.push(i[n]),s.push(e[o].taskid))}if(t.length>0)for(h=0;h<t.length;h++)-1!==(n="ProjectView"===this.parent.viewType?r.indexOf(t[h].toString()):this.resourceCollectionIds.indexOf(t[h].toString()))&&i[n].ganttProperties.progress<100&&(this.criticalTasks.push(i[n]),s=s.concat(t[h]));return s},e.prototype.criticalConnectorLine=function(e,i,r,a){this.parent.ganttChartModule.chartElement;this.parent.removeCriticalPathStyles();for(var n=function(i){var r;if("ProjectView"===s.parent.viewType)r=s.parent.flatData[s.parent.ids.indexOf(e[i].toString())];else for(var a=s.parent.flatData.filter(function(t){return t.ganttProperties.taskId.toString()===e[i].toString()}),n=0;n<a.length;n++)(a[n].ganttProperties.isCritical||a[n].ganttProperties.endDate>=s.maxEndDate)&&(r=a[n]);var o=s.parent.currentViewData.indexOf(r),l=s.parent.getRowByIndex(o),d=void 0,h=s.parent.taskFields;if(r&&r.parentItem){var p=s.parent.currentViewData.filter(function(e){return r.parentItem.uniqueID===e.uniqueID}),c=s.parent.flatData.indexOf(p[0]),u=s.parent.getRowByIndex(c);if(u)for(var g=u.querySelectorAll(".e-taskbar-main-container"),f=0;f<g.length;f++)g[f].getAttribute("rowuniqueid")===r.rowUniqueID&&t.addClass(g[f].querySelectorAll(".e-gantt-child-taskbar-inner-div"),G)}d=s.parent.allowUnscheduledTasks&&!r[h.startDate]&&!r[h.endDate]&&r[h.duration]?"e-gantt-critical-unscheduled-taskbar":z,l&&("ProjectView"===s.parent.viewType||"ResourceView"===s.parent.viewType&&!r.hasChildRecords)&&(l.getElementsByClassName("e-gantt-milestone")[0]&&t.addClass(l.querySelectorAll(".e-gantt-milestone"),_),l.getElementsByClassName("e-gantt-child-taskbar-inner-div").length>0&&t.addClass(l.querySelectorAll(".e-gantt-child-taskbar-inner-div"),G),l.getElementsByClassName("e-gantt-child-progressbar-inner-div").length>0&&t.addClass(l.querySelectorAll(".e-gantt-child-progressbar-inner-div"),d))},s=this,o=0;o<e.length;o++)n(o);if(0!==i.length){var l=0,d=void 0,h=[],p=void 0,c=void 0;for(o=0;o<this.criticalPathCollection.length;o++)if(l=a.indexOf(this.criticalPathCollection[o]),d=i[l],-1!==l&&d.to){h=d.to.split(",");for(var u=0;u<h.length;u++)if(c=h[u].split("+"),h[u].indexOf("-")>=0&&(c=h[u].split("-")),p=c[0].replace(":",""),"number"==typeof e[u]&&(p=parseInt(c[0],10)),-1!==e.indexOf(p)){this.parent.element.querySelectorAll("#ConnectorLineparent"+d.taskid+"child"+p).length>0&&(t.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+d.taskid+"child"+p)[0].querySelectorAll(".e-connector-line"),be),t.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+d.taskid+"child"+p)[0].querySelectorAll(".e-connector-line-arrow"),Pe))}}}},e.prototype.getModuleName=function(){return"criticalPath"},e.prototype.destroy=function(){!this.parent.enableCriticalPath&&this.parent.criticalPathModule&&(this.parent.criticalPathModule=void 0)},e}(),vi=function(){function e(e){var i=this;this.segmentIndex=-1,this.headerContextMenuClick=function(e){var r=t.closest(e.event.target,".e-row"),a=t.closest(e.event.target,".e-chart-row");t.isNullOrUndefined(r)&&t.isNullOrUndefined(a)&&(e.type="Header",i.parent.trigger("contextMenuClick",e))},this.headerContextMenuOpen=function(e){var r=t.closest(e.event.target,".e-row"),a=t.closest(e.event.target,".e-chart-row");t.isNullOrUndefined(r)&&t.isNullOrUndefined(a)?(e.type="Header",i.parent.trigger("contextMenuOpen",e)):e.cancel=!0},this.parent=e,this.ganttID=e.element.id,n.TreeGrid.Inject(n.ContextMenu),this.parent.treeGrid.contextMenuClick=this.headerContextMenuClick.bind(this),this.parent.treeGrid.contextMenuOpen=this.headerContextMenuOpen.bind(this),this.addEventListener(),this.resetItems()}return e.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))},e.prototype.reRenderContextMenu=function(e){e.module===this.getModuleName()&&e.enable&&(this.contextMenu&&(this.contextMenu.destroy(),t.remove(this.element)),this.resetItems(),this.render())},e.prototype.render=function(){this.element=this.parent.createElement("ul",{id:this.ganttID+"_contextmenu",className:"e-grid"}),this.parent.element.appendChild(this.element);var e="#"+this.ganttID;this.contextMenu=new l.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},e.prototype.contextMenuItemClick=function(e){this.item=this.getKeyFromId(e.item.id);var i,r,a,n=t.getValue("parentObj",e.item),s=-1;switch(n&&!t.isNullOrUndefined(n.id)&&"DeleteDependency"===this.getKeyFromId(n.id)&&(s=n.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":isNaN(Number(this.rowData.ganttProperties.rowUniqueID))?this.parent.openEditDialog(this.rowData.ganttProperties.rowUniqueID):this.parent.openEditDialog(Number(this.rowData.ganttProperties.rowUniqueID));break;case"Above":case"Below":case"Child":if(i=this.item,r=t.extend({},{},this.rowData.taskData,!0),a=this.parent.taskFields,r[a.startDate]&&this.parent.setRecordValue(a.startDate,this.rowData.ganttProperties.startDate,r,!0),r[a.endDate]&&this.parent.setRecordValue(a.endDate,this.rowData.ganttProperties.endDate,r,!0),t.isNullOrUndefined(a.dependency)||(r[a.dependency]=null),!t.isNullOrUndefined(a.child)&&r[a.child]&&delete r[a.child],!t.isNullOrUndefined(a.parentID)&&r[a.parentID]&&(r[a.parentID]=null),this.rowData){var o=this.parent.updatedRecords.indexOf(this.rowData);this.parent.addRecord(r,i,o)}break;case"Milestone":case"ToMilestone":this.parent.convertToMilestone(this.rowData.ganttProperties.rowUniqueID);break;case"DeleteTask":this.parent.editModule.deleteRecord(this.rowData);break;case"ToTask":if(r=t.extend({},{},this.rowData.taskData,!0),a=this.parent.taskFields,t.isNullOrUndefined(a.duration)){r[a.startDate]=new Date(this.rowData.taskData[a.startDate]);var l=new Date(this.rowData.taskData[a.startDate]);l.setDate(l.getDate()+1),r[a.endDate]=l}else{var d=this.rowData.ganttProperties;r[a.duration]="1 "+d.durationUnit}t.isNullOrUndefined(r[a.milestone])||!0===r[a.milestone]&&(r[a.milestone]=!1),this.parent.updateRecordByID(r);break;case"Cancel":this.parent.cancelEdit();break;case"Save":this.parent.editModule.cellEditModule.isCellEdit=!1,this.parent.treeGrid.grid.saveCell();break;case"Dependency"+s:this.parent.connectorLineEditModule.removePredecessorByIndex(this.rowData,s);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)}e.type="Content",e.rowData=this.rowData,this.parent.trigger("contextMenuClick",e)},e.prototype.splitTaskCall=function(e){var i=this;this.isEdit=!0;var r=this.parent.taskFields,a=this.getClickedDate(e.element);t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)&&"Hour"!==this.parent.timelineSettings.bottomTier.unit&&a.setHours(0,0,0,0);var n={rowData:this.rowData,requestType:"splitTaskbar",splitDate:a,cancel:!1,target:this.targetElement};this.parent.trigger("actionBegin",n,function(e){t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),i.parent.chartRowsModule.splitTask(i.rowData[r.id],a)})},e.prototype.mergeCall=function(e){var i=this;this.isEdit=!0;var r=this.parent.taskFields,a=this.rowData.ganttProperties.segments,n=[{firstSegmentIndex:"Right"===e?this.segmentIndex:a[this.segmentIndex-1].segmentIndex,secondSegmentIndex:"Left"===e?this.segmentIndex:a[this.segmentIndex+1].segmentIndex}],s={rowData:this.rowData,mergeSegmentIndexes:n,requestType:"mergeSegment",cancel:!1,target:this.targetElement};this.parent.trigger("actionBegin",s,function(e){t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),!1===e.cancel&&i.parent.chartRowsModule.mergeTask(i.rowData[r.id],n)})},e.prototype.getClickedDate=function(e){var i;if(this.parent.enableRtl){var r=this.parent.element.getBoundingClientRect(),a=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.clientLeft||document.body.clientLeft||0;i=r.left+a-n}else i=this.parent.getOffsetRect(this.parent.element).left;var s,o;this.parent.enableRtl?(s=Math.abs(i+this.parent.ganttChartModule.chartElement.offsetWidth-this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft),o=Math.abs(this.clickedPosition-s)):(s=i+this.parent.ganttChartModule.chartElement.offsetLeft+this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft,o=this.clickedPosition-s);var l=Math.ceil(o/this.parent.perDayWidth),d=this.rowData.ganttProperties.startDate;t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||"Hour"!==this.parent.timelineSettings.bottomTier.unit||(l=Math.ceil(o/this.parent.timelineSettings.timelineUnitSize),l-=1);return this.parent.dataOperation.getEndDate(d,l,"None"!==this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.bottomTier.unit.toLocaleLowerCase():this.parent.timelineModule.customTimelineSettings.topTier.unit.toLocaleLowerCase(),this.rowData,!1)},e.prototype.contextMenuBeforeOpen=function(e){var i=this,r=e.event?e.event.target:this.parent.focusModule?this.parent.ganttChartModule.targetElement:this.parent.focusModule.getActiveElement();!t.isNullOrUndefined(this.parent.editModule)&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&r.parentElement.classList.contains("e-row")&&this.parent.treeGrid.closeEdit(),t.isNullOrUndefined(e.element)||e.element.id!==this.parent.element.id+"_contextmenu"||(this.clickedPosition=t.getValue("event",e).clientX);var n=t.closest(r,".e-gantt-child-taskbar");n&&(this.targetElement=e.target=n),e.gridRow=t.closest(r,".e-row"),e.chartRow=t.closest(r,".e-chart-row");var s=t.closest(r,".e-gantt");if(!t.closest(r,".e-gridform")&&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),(t.isNullOrUndefined(e.gridRow)&&t.isNullOrUndefined(e.chartRow)||0===this.contentMenuItems.length)&&(t.isNullOrUndefined(e.parentItem)||t.isNullOrUndefined(s)?e.cancel=!0:e.cancel=!1),!e.cancel){var o=-1;e.gridRow?o=parseInt(e.gridRow.getAttribute("data-rowindex"),0):e.chartRow&&(o=parseInt(e.chartRow.getAttribute("aria-rowindex"),0)),this.parent.selectionModule&&this.parent.allowSelection&&!e.parentItem&&!t.isNullOrUndefined(e.chartRow)&&this.parent.selectionModule.selectRow(o),e.parentItem||(this.rowData=this.parent.updatedRecords[parseInt(o.toString(),10)]);for(var l=0,d=e.items;l<d.length;l++){var h=d[l];h.separator||(!r.classList.contains("e-gantt-unscheduled-taskbar")||h.text!==this.getLocale("splitTask")&&h.text!==this.getLocale("mergeTask")?this.updateItemStatus(h,r,o):this.hideItems.push(h.text))}if(e.rowData=this.rowData,e.type="Content",e.disableItems=this.disableItems,e.hideItems=this.hideItems,e.hideChildItems=[],0===e.rowData.level&&"ResourceView"===this.parent.viewType)return void(e.cancel=!0);var p=new a.Deferred;return this.parent.trigger("contextMenuOpen",e,function(t){p.resolve(t),i.hideItems=t.hideItems,i.disableItems=t.disableItems,t.parentItem||t.hideItems.length!==t.items.length||(i.revertItemStatus(),t.cancel=!0),i.hideItems.length>0&&i.contextMenu.hideItems(i.hideItems),i.disableItems.length>0&&i.contextMenu.enableItems(i.disableItems,!1),e.hideChildItems.length>0&&i.contextMenu.hideItems(e.hideChildItems)}),p}},e.prototype.updateItemStatus=function(e,i,r){var a=this.getKeyFromId(e.id),n=t.closest(i,".e-gridform"),s=[],o=t.closest(i,".e-gantt-child-taskbar");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);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":this.rowData.hasChildRecords?this.hideItems.push(e.text):this.parent.editSettings.allowEditing&&this.parent.editModule?(this.rowData.ganttProperties.isMilestone?s.push(this.createItemModel(Ne,"ToTask",this.getLocale("toTask"))):s.push(this.createItemModel(Ne,"ToMilestone",this.getLocale("toMilestone"))),e.items=s):this.updateItemVisibility(e.text);break;case"DeleteDependency":var l=this.getPredecessorsItems();this.rowData.hasChildRecords?this.hideItems.push(e.text):this.parent.editSettings.allowDeleting&&0!==l.length&&this.parent.editModule?l.length>0&&(e.items=l):this.updateItemVisibility(e.text);break;case"DeleteTask":this.parent.editSettings.allowDeleting&&this.parent.editModule||this.updateItemVisibility(e.text);break;case"TaskMode":"Custom"!==this.parent.taskMode?this.updateItemVisibility(e.text):(this.rowData.ganttProperties.isAutoSchedule?s.push(this.createItemModel(Ne,"Manual",this.getLocale("manual"))):s.push(this.createItemModel(Ne,"Auto",this.getLocale("auto"))),e.items=s);break;case"Indent":if(this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings){var d=this.parent.selectedRowIndex,h=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),p=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1];this.parent.editSettings.allowEditing&&0!==d&&-1!==d&&h&&"ResourceView"!==this.parent.viewType&&this.parent.updatedRecords[parseInt(d.toString(),10)].level-p.level!=1||this.updateItemVisibility(e.text)}else this.hideItems.push(e.text);break;case"Outdent":if(this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings){var c=this.parent.selectionModule.getSelectedRowIndexes()[0],u=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length);this.parent.editSettings.allowEditing&&-1!==c&&0!==c&&u&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[parseInt(c.toString(),10)].level||this.updateItemVisibility(e.text)}else this.hideItems.push(e.text);break;case"SplitTask":var g=this.parent.taskFields;(this.parent.readOnly||!o||t.isNullOrUndefined(g.segments)||this.parent.currentViewData[parseInt(r.toString(),10)].hasChildRecords)&&this.updateItemVisibility(e.text);break;case"MergeTask":this.parent.readOnly||!o?this.updateItemVisibility(e.text):this.mergeItemVisiblity(i,e)}},e.prototype.mergeItemVisiblity=function(e,i){var r=[],a=this.parent.taskFields,n=this.getClickedDate(e);this.segmentIndex=this.parent.chartRowsModule.getSegmentIndex(n,this.rowData);var s=this.rowData.ganttProperties.segments;!t.isNullOrUndefined(s)&&s.length>0?t.isNullOrUndefined(a.segments)&&-1===this.segmentIndex?this.updateItemVisibility(i.text):(0===this.segmentIndex?r.push(this.createItemModel(Ne,"Right",this.getLocale("right"))):this.segmentIndex===s.length-1?r.push(this.createItemModel(Ne,"Left",this.getLocale("left"))):(r.push(this.createItemModel(Ne,"Right",this.getLocale("right"))),r.push(this.createItemModel(Ne,"Left",this.getLocale("left")))),i.items=r):this.hideItems.push(i.text)},e.prototype.updateItemVisibility=function(e){!!t.isNullOrUndefined(this.parent.contextMenuItems)?this.hideItems.push(e):this.disableItems.push(e)},e.prototype.contextMenuOpen=function(e){this.isOpen=!0;var i=e.element.querySelectorAll("li:not(.e-menu-hide):not(.e-disabled)")[0];t.isNullOrUndefined(i)||t.addClass([i],"e-focused")},e.prototype.getMenuItems=function(){for(var e=0,i=t.isNullOrUndefined(this.parent.contextMenuItems)?this.getDefaultItems():this.parent.contextMenuItems;e<i.length;e++){var r=i[e];"string"==typeof r&&-1!==this.getDefaultItems().indexOf(r)?this.buildDefaultItems(r):"string"!=typeof r&&(-1!==this.getDefaultItems().indexOf(r.text)?this.buildDefaultItems(r.text,r.iconCss):".e-gridheader"===r.target?this.headerMenuItems.push(r):this.contentMenuItems.push(r))}return this.contentMenuItems},e.prototype.createItemModel=function(e,t,i,r){return{text:i,id:this.generateID(t),target:e,iconCss:r?"e-icons "+r:null}},e.prototype.getLocale=function(e){return this.parent.localeObj.getConstant(e)},e.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(Ne,e,this.getLocale("taskInformation"),this.getIconCSS("e-edit",t));break;case"Indent":i=this.createItemModel(Ne,e,this.getLocale("indent"),this.getIconCSS("e-indent",t));break;case"Outdent":i=this.createItemModel(Ne,e,this.getLocale("outdent"),this.getIconCSS("e-outdent",t));break;case"Save":i=this.createItemModel("e-edit",e,this.getLocale("save"),this.getIconCSS("e-save",t));break;case"Cancel":i=this.createItemModel("e-edit",e,this.getLocale("cancel"),this.getIconCSS("e-cancel",t));break;case"Add":(i=this.createItemModel(Ne,e,this.getLocale("add"),this.getIconCSS("e-add",t))).items=[],i.items.push(this.createItemModel(Ne,"Above",this.getLocale("above"),this.getIconCSS("e-add-above",t))),i.items.push(this.createItemModel(Ne,"Below",this.getLocale("below"),this.getIconCSS("e-add-below",t))),"ResourceView"!==this.parent.viewType&&i.items.push(this.createItemModel(Ne,"Child",this.getLocale("child"))),i.items.push(this.createItemModel(Ne,"Milestone",this.getLocale("milestone")));break;case"DeleteTask":i=this.createItemModel(Ne,e,this.getLocale("deleteTask"),this.getIconCSS("e-delete",t));break;case"DeleteDependency":(i=this.createItemModel(Ne,e,this.getLocale("deleteDependency"))).items=[],i.items.push({});break;case"Convert":(i=this.createItemModel(Ne,e,this.getLocale("convert"))).items=[],i.items.push({});break;case"TaskMode":(i=this.createItemModel(Ne,e,this.getLocale("changeScheduleMode"))).items=[],i.items.push({});break;case"SplitTask":i=this.createItemModel(Ne,e,this.getLocale("splitTask"));break;case"MergeTask":(i=this.createItemModel(Ne,e,this.getLocale("mergeTask"))).items=[],i.items.push({})}i&&this.contentMenuItems.push(i)},e.prototype.getIconCSS=function(e,i){return t.isNullOrUndefined(i)?e:i},e.prototype.getPredecessorsItems=function(){this.predecessors=this.parent.predecessorModule.getValidPredecessor(this.rowData);for(var e,t=[],i=0,r=0,a=this.predecessors;r<a.length;r++){var n=a[r],s=this.parent.getRecordByID(n.from).ganttProperties,o=s.rowUniqueID+" - "+s.taskName,l="Dependency"+i++;e=this.createItemModel(Ne,l,o),t.push(e)}return t},e.prototype.getDefaultItems=function(){return["AutoFitAll","AutoFit","TaskInformation","DeleteTask","Save","Cancel","SortAscending","SortDescending","Add","DeleteDependency","Convert","TaskMode","Indent","Outdent","SplitTask","MergeTask"]},e.prototype.getModuleName=function(){return"contextMenu"},e.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))},e.prototype.contextMenuOnClose=function(e){e.items.length>0&&e.items[0].parentObj instanceof l.ContextMenu&&this.revertItemStatus()},e.prototype.revertItemStatus=function(){this.contextMenu.showItems(this.hideItems),this.contextMenu.enableItems(this.disableItems),this.hideItems=[],this.disableItems=[],this.isOpen=!1},e.prototype.resetItems=function(){this.hideItems=[],this.disableItems=[],this.headerMenuItems=[],this.contentMenuItems=[],this.item=null},e.prototype.generateID=function(e){return this.ganttID+"_contextMenu_"+e},e.prototype.getKeyFromId=function(e){var t=this.ganttID+"_contextMenu_";return e.indexOf(t)>-1?e.replace(t,""):"Custom"},e.prototype.destroy=function(){this.contextMenu.destroy(),t.remove(this.element),this.removeEventListener(),this.contextMenu=null,this.element=null},e}(),wi=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.ExcelExport),this.parent.treeGrid.allowExcelExport=this.parent.allowExcelExport,this.bindEvents()}return e.prototype.getModuleName=function(){return"excelExport"},e.prototype.destroy=function(){},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.beforeExcelExport=function(i){e.parent.trigger("beforeExcelExport",i),t.isNullOrUndefined(e.parent.loadingIndicator)||"Shimmer"!==e.parent.loadingIndicator.indicatorType?e.parent.showSpinner():e.parent.showMaskRow()},this.parent.treeGrid.excelQueryCellInfo=function(t){e.parent.trigger("excelQueryCellInfo",t)},this.parent.treeGrid.excelHeaderQueryCellInfo=function(t){e.parent.trigger("excelHeaderQueryCellInfo",t)},this.parent.treeGrid.excelExportComplete=function(i){e.parent.trigger("excelExportComplete",i),t.isNullOrUndefined(e.parent.loadingIndicator)||"Shimmer"!==e.parent.loadingIndicator.indicatorType?e.parent.hideSpinner():e.parent.hideMaskRow()}},e}(),ki=function(){function e(e){n.TreeGrid.Inject(n.ColumnMenu),this.parent=e}return e.prototype.getColumnMenu=function(){return this.parent.treeGrid.columnMenuModule.getColumnMenu()},e.prototype.destroy=function(){},e.prototype.getModuleName=function(){return"columnMenu"},e}(),Ti=function(){function e(e){this.isTest=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.isSharedTask=!1,this.canDrop=!0,this.parent=e,n.TreeGrid.Inject(n.RowDD),this.parent.treeGrid.allowRowDragAndDrop=this.parent.allowRowDragAndDrop,this.bindEvents()}return e.prototype.getModuleName=function(){return"rowDragAndDrop"},e.prototype.destroy=function(){},e.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)},e.prototype.rowDragStart=function(e){this.parent.trigger("rowDragStart",e),this.parent.element.style.position="relative"},e.prototype.addErrorElem=function(){var e=document.getElementsByClassName("e-ganttdrag")[0];if(!e.querySelectorAll(".e-errorelem").length){var i=document.createElement("div");t.classList(i,["e-errorcontainer"],[]),t.classList(i,["e-icons","e-errorelem"],[]);var r=e.querySelector(".errorValue"),a=e.querySelector(".e-rowcell").innerHTML;r&&(a=r.innerHTML,r.parentNode.removeChild(r)),e.querySelector(".e-rowcell").innerHTML="";var n=document.createElement("span");n.className="errorValue",n.style.paddingLeft="16px",n.innerHTML=a,e.querySelector(".e-rowcell").appendChild(i),e.querySelector(".e-rowcell").appendChild(n)}},e.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},e.prototype.rowDrag=function(e){var i=this.parent.element.querySelector(".e-cloneproperties");i.style.display="none";var r=i.cloneNode(!0);r.classList.add("e-ganttdrag"),r.style.display="",this.parent.element.querySelectorAll(".e-cloneproperties").length<=1?this.parent.element.appendChild(r):document.getElementsByClassName("e-cloneproperties")[0].querySelectorAll(".e-errorelem").length?this.addErrorElem():this.removeErrorElem(),"Both"===this.parent.gridLines&&t.addClass(this.parent.element.querySelectorAll(".e-ganttdrag .e-rowcell"),["e-bothganttlines"]);var a=this.parent.element.querySelector(".e-ganttdrag"),n=this.parent.element.getClientRects()[0].top,s=this.parent.element.getClientRects()[0].left,o=t.getValue("event",e.originalEvent).clientX-s,l=t.getValue("event",e.originalEvent).clientY-n;a.style.left=o+20+"px",a.style.top=l+20+"px",this.parent.trigger("rowDrag",e)},e.prototype.rowDragStartHelper=function(e){this.parent.trigger("rowDragStartHelper",e),this.parent.readOnly&&(e.cancel=!0),"ResourceView"===this.parent.viewType&&0===t.getValue("level",e.data[0])&&(e.cancel=!0)},e.prototype.rowDrop=function(e){var i=document.querySelector(".e-ganttdrag");i&&i.remove();var r=t.closest(e.target,".e-row"),a=r?parseInt(r.getAttribute("data-rowindex"),10):e.dropIndex;e.dropIndex=a,e.dropRecord=this.parent.updatedRecords[e.dropIndex],this.parent.trigger("rowDrop",e),"ResourceView"===this.parent.viewType&&("middleSegment"===e.dropPosition&&(1!==e.dropRecord.level&&e.dropRecord.uniqueID!==t.getValue("parentItem",e.data[0]).uniqueID||(e.cancel=!0)),"middleSegment"!==e.dropPosition&&(0!==e.dropRecord.level&&t.getValue("parentItem",e.data[0]).uniqueID!==e.dropRecord.parentItem.uniqueID||(e.cancel=!0))),e.cancel||(e.requestType="beforeDrop",this.parent.trigger("actionBegin",e),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),e.cancel||(this.dropRows(e,!0),e.cancel=!0))},e.prototype.dropRows=function(e,i){if(!this.parent.readOnly){if(this.dropPosition=e.dropPosition,"Invalid"!==e.dropPosition&&this.parent.editModule){var r=this.parent,a=void 0;this.droppedRecord=r.updatedRecords[e.dropIndex];var n=[],s=this.droppedRecord;e.data[0]?n=e.data:n.push(e.data);for(var o=0,l=n.length,d=function(e){if(h.parent.isOnEdit=!0,a=n[e],h.draggedRecord=a,"Invalid"!==h.dropPosition){if("ResourceView"===h.parent.viewType&&(h.checkisSharedTask(),h.previousParent=h.draggedRecord.parentItem.uniqueID),h.isSharedTask)return{value:void 0};i&&h.deleteDragRow();var l=h.treeGridData.indexOf(s);if("topSegment"===h.dropPosition&&h.dropAtTop(l),"bottomSegment"===h.dropPosition&&!h.isSharedTask){if(s.hasChildRecords){if(o=h.parent.editModule.getChildCount(s,0),h.parent.taskFields.parentID&&h.ganttData.length>0&&h.ganttData.splice(l+o+1,0,h.draggedRecord.taskData),h.treeGridData.splice(l+o+1,0,h.draggedRecord),h.parent.ids.splice(l+o+1,0,h.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===h.parent.viewType){var d=0===h.draggedRecord.level?"R"+h.draggedRecord.ganttProperties.taskId:"T"+h.draggedRecord.ganttProperties.taskId;h.parent.getTaskIds().splice(l+o+1,0,d)}}else if(h.parent.taskFields.parentID&&h.ganttData.length>0&&h.ganttData.splice(l+1,0,h.draggedRecord.taskData),h.treeGridData.splice(l+1,0,h.draggedRecord),h.parent.ids.splice(l+1,0,h.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===h.parent.viewType){var p=0===h.draggedRecord.level?"R"+h.draggedRecord.ganttProperties.taskId:"T"+h.draggedRecord.ganttProperties.taskId;h.parent.getTaskIds().splice(l+1,0,p)}if(h.parent.setRecordValue("parentItem",h.treeGridData[l].parentItem,a),h.parent.setRecordValue("parentUniqueID",h.treeGridData[l].parentUniqueID,a),h.parent.setRecordValue("level",h.treeGridData[l].level,a),a.hasChildRecords){h.updateChildRecordLevel(a,1),h.updateChildRecord(a,l+o+1)}if(s.parentItem){var c=h.parent.getParentTask(s.parentItem).childRecords,u=c.indexOf(s)+1;c.splice(u,0,a)}}if("middleSegment"===h.dropPosition&&(h.dropMiddle(l),s.childRecords.length>0&&(delete s.ganttProperties.segments,delete s.taskData[h.parent.taskFields.segments])),0!=h.treeGridData.length)for(var g=0;g<h.treeGridData.length;g++)if(h.treeGridData[parseInt(g.toString(),10)].index=g,!t.isNullOrUndefined(h.treeGridData[parseInt(g.toString(),10)].parentItem)){var f=t.getValue("uniqueIDCollection."+h.treeGridData[parseInt(g.toString(),10)].parentUniqueID,h.parent.treeGrid);h.treeGridData[parseInt(g.toString(),10)].parentItem.index=f.index}t.isNullOrUndefined(a.parentItem&&-1!==h.updateParentRecords.indexOf(a.parentItem))||h.updateParentRecords.push(a.parentItem)}if(!h.parent.enableVirtualization){var m=r.flatData,y=void 0,D=void 0,v=h.parent.dataSource,w=h.parent.taskFields.id;if(a.index<s.index){y=a.index;for(var k=function(e){var t=h.parent.currentViewData.filter(function(t){return t[w]===v[e][w]})[0];if(t&&t.index>s.index)return D=t.index,"break"},T=0;T<v.length;T++){if("break"===k(T))break}}else{y=s.index;for(var b=function(e){var t=h.parent.currentViewData.filter(function(t){return t[w]===v[e][w]})[0];if(t&&t.index>a.index)return D=t.index,"break"},P=0;P<v.length;P++){if("break"===b(P))break}}for(var S=function(e){if(!t.isNullOrUndefined(m[e])&&(m[e].index=e,!t.isNullOrUndefined(m[e].parentItem))){var i=m.filter(function(t){return t.uniqueID===m[e].parentUniqueID})[0];m[e].parentItem.index=i.index}},C=y;C<=D;C++)S(C)}r.rowDragAndDropModule.refreshDataSource()},h=this,p=0;p<l;p++){var c=d(p);if("object"==typeof c)return c.value}if("middleSegment"===this.dropPosition&&(s.ganttProperties.predecessor&&(this.parent.editModule.removePredecessorOnDelete(s),s.ganttProperties.predecessor=null,s.ganttProperties.predecessorsName=null,s[this.parent.taskFields.dependency]=null,s.taskData[this.parent.taskFields.dependency]=null),s.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,s.ganttProperties,!0),t.isNullOrUndefined(s.taskData[this.parent.taskFields.milestone])||!0===s.taskData[this.parent.taskFields.milestone]&&(s.taskData[this.parent.taskFields.milestone]=!1))),"ResourceView"===this.parent.viewType&&!this.isSharedTask){var u=void 0;u="middleSegment"===this.dropPosition?this.droppedRecord.uniqueID:this.droppedRecord.parentItem?this.droppedRecord.parentItem.uniqueID:this.droppedRecord.uniqueID;var g=this.parent.getTaskByUniqueID(u),f={};f[this.parent.taskFields.resourceInfo]=[],f[this.parent.taskFields.resourceInfo].push(g.ganttProperties.taskId),this.removeExistingResources();var m=this.parent.dataOperation.setResourceInfo(f),y=this.draggedRecord;t.isNullOrUndefined(y.ganttProperties.resourceInfo)&&(y.ganttProperties.resourceInfo=[]),"Unassigned Task"===g.ganttProperties.taskName?(y.ganttProperties.resourceInfo=[],y.ganttProperties.sharedTaskUniqueIds=[y.ganttProperties.rowUniqueID]):y.ganttProperties.resourceInfo.push(m[0]),this.updateCurrentTask(y),"Unassigned Task"===g.ganttProperties.taskName?this.deleteSharedResourceTask():this.updateSharedResourceTask()}if(this.parent.taskFields.dependency&&this.parent.allowParentDependency){var D,v=void 0;v=a.parentItem?this.parent.flatData[this.parent.ids.indexOf(a.parentItem.taskId)]:a;var w=void 0;if((D=s.parentItem?this.parent.flatData[this.parent.ids.indexOf(s.parentItem.taskId)]:s).uniqueID===v.uniqueID||v.parentItem&&D.uniqueID===this.parent.flatData[this.parent.ids.indexOf(v.parentItem.taskId)].uniqueID){w=this.parent.currentViewData.filter(function(e){if(e.ganttProperties.predecessor&&e.ganttProperties.predecessor.length>0)for(var t=0;t<e.ganttProperties.predecessor.length;t++)return parseInt(e.ganttProperties.predecessor[t].to)===parseInt(D.ganttProperties.taskId)||parseInt(e.ganttProperties.predecessor[t].from)===parseInt(D.ganttProperties.taskId);return null});var k=[];for(p=0;p<w.length;p++){if(k=[],w[p].ganttProperties.predecessor)for(var T=0;T<w[p].ganttProperties.predecessor.length;T++)parseInt(w[p].ganttProperties.taskId)!==parseInt(w[p].ganttProperties.predecessor[T].from)?k.push(w[p].ganttProperties.predecessor[T].from):k.push(w[p].ganttProperties.predecessor[T].to);for(var b=function(e){var t=k[e].replace(/\D/g,""),i=P.parent.currentViewData.filter(function(e){return parseInt(e.ganttProperties.taskId)==parseInt(t)});P.parent.connectorLineEditModule.validateParentPredecessor(w[p],i[0])||(P.parent.dataOperation.resetDependency(w[p]),P.parent.dataOperation.resetDependency(i[0]))},P=this,S=0;S<k.length;S++)b(S)}}}for(S=0;S<this.updateParentRecords.length;S++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[S]);this.updateParentRecords=[],this.parent.isOnEdit=!1}t.isNullOrUndefined(this.parent.editModule)||this.parent.editModule.refreshRecord(e,!0)}},e.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)},e.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.currentViewData[e].parentItem.uniqueID).ganttProperties.taskName&&this.removeRecords(this.parent.currentViewData[e]),t.isNullOrUndefined(this.parent.currentViewData[e].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.currentViewData[e].parentItem))||this.updateParentRecords.push(this.parent.currentViewData[e].parentItem))},e.prototype.removeExistingResources=function(){var e=this.parent.getTaskByUniqueID(this.previousParent);if(this.draggedRecord.ganttProperties.resourceInfo)for(var t=0;t<this.draggedRecord.ganttProperties.resourceInfo.length;t++)if(this.draggedRecord.ganttProperties.resourceInfo[t][this.parent.resourceFields.id]===e.ganttProperties.taskId){this.draggedRecord.ganttProperties.resourceInfo.splice(t,1);break}},e.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]),t.isNullOrUndefined(this.parent.flatData[e].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.currentViewData[e].parentItem))||this.updateParentRecords.push(this.parent.flatData[e].parentItem))},e.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},e.prototype.removeResourceInfo=function(e){var i=this.parent.getTaskByUniqueID(this.draggedRecord.parentItem.uniqueID);if(e.ganttProperties.resourceInfo&&e.ganttProperties.resourceInfo.length>1){var r=this._getExistingTaskWithID(e),a=void 0;if(null==r)return;for(var n=0;n<r.length;n++)for(var s=(a=r[n]).ganttProperties.resourceInfo,o=0;o<s.length;o++)if(s[o][this.parent.resourceFields.id]===i.ganttProperties.taskId){s.splice(o,1),this.parent.setRecordValue("resourceInfo",s,a.ganttProperties,!0),this.updateCurrentTask(a),t.isNullOrUndefined(a.parentItem&&-1!==this.updateParentRecords.indexOf(a.parentItem))||this.updateParentRecords.push(a.parentItem);break}}},e.prototype.refreshDataSource=function(){var e,i,r=this.draggedRecord,n=this.droppedRecord,s=this.parent,o=this.parent.taskFields;if((e=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!t.isNullOrUndefined(n)&&!n.parentItem){for(var l=0;l<Object.keys(e).length;l++)t.isNullOrUndefined(n.taskData[o.child])||e[l][o.child]!==n.taskData[o.child]?t.isNullOrUndefined(n.taskData[o.child])&&n.taskData[o.id]===e[l][o.id]&&(i=l):i=l;"topSegment"===this.dropPosition?this.parent.taskFields.parentID||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||e.splice(i+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!t.isNullOrUndefined(n)&&n.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var d="topSegment"===this.dropPosition?"Above":"Below";this.parent.editModule.addRowSelectedItem=n,this.parent.editModule.updateRealDataSource([r],d),delete this.parent.editModule.addRowSelectedItem}if(this.parent.taskFields.parentID)if(r.parentItem){var h="middleSegment"===this.dropPosition?this.parent.taskFields.id:this.parent.taskFields.parentID;r[this.parent.taskFields.parentID]=n[h],r.ganttProperties.parentId=n[h],("ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition||"ProjectView"===this.parent.viewType)&&(r.taskData[this.parent.taskFields.parentID]=n.taskData[h])}else r[this.parent.taskFields.parentID]=null,r.taskData[this.parent.taskFields.parentID]=null,r.ganttProperties.parentId=null},e.prototype.dropMiddle=function(e){var i=this.parent,r=this.parent.editModule.getChildCount(this.droppedRecord,0),a=t.isNullOrUndefined(r)||0===r?e+1:r+e+1;if("middleSegment"===this.dropPosition&&!this.isSharedTask){if(i.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(a,0,this.draggedRecord.taskData),this.treeGridData.splice(a,0,this.draggedRecord),this.parent.ids.splice(a,0,this.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var n=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId;this.parent.getTaskIds().splice(a,0,n)}this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,a,this.droppedRecord.expanded),this.recordLevel(),t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,r=this.droppedRecord,a=e.taskFields.child;if(r.hasChildRecords||(r.hasChildRecords=!0,r.childRecords.length||(r.childRecords=[],!e.taskFields.parentID&&t.isNullOrUndefined(r.taskData[a])&&(r.taskData[a]=[]))),"middleSegment"===this.dropPosition){var n=t.extend({},r);delete n.childRecords;var s={uniqueID:n.uniqueID,expanded:n.expanded,level:n.level,index:n.index,taskId:n.ganttProperties.rowUniqueID};if(this.parent.setRecordValue("parentItem",s,i),this.parent.setRecordValue("parentUniqueID",r.uniqueID,i),r.childRecords.splice(r.childRecords.length,0,i),t.isNullOrUndefined(i)||e.taskFields.parentID||t.isNullOrUndefined(r.taskData[a])||r.taskData[e.taskFields.child].splice(r.childRecords.length,0,i.taskData),i.hasChildRecords){i.level=r.level+1,this.parent.setRecordValue("level",this.draggedRecord.level,this.draggedRecord),this.updateChildRecordLevel(i,1)}else i.level=r.level+1;r.expanded=!0}},e.prototype.deleteDragRow=function(){this.treeGridData=y(this.parent)?t.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource,this.parent.dataSource instanceof a.DataManager?this.ganttData=t.getValue("dataOperation.dataArray",this.parent):this.ganttData=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource;var e=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(e)},e.prototype.checkisSharedTask=function(){this.isSharedTask=!1;for(var e=null,t=0===this.droppedRecord.level?this.droppedRecord.uniqueID:this.droppedRecord.parentItem.uniqueID,i=this.parent.getTaskByUniqueID(t).childRecords,r=0;r<i.length;r++)"T"+this.draggedRecord.ganttProperties.taskId=="T"+i[r].ganttProperties.taskId&&(this.isSharedTask=!0,e=i[r]);this.isSharedTask&&this.removeResourceInfo(e)},e.prototype.dropAtTop=function(e){var i=this.parent;if(!this.isSharedTask){if(i.taskFields.parentID&&this.ganttData.length>0&&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){var r=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId;this.parent.getTaskIds().splice(e,0,r)}if(this.draggedRecord.hasChildRecords){this.updateChildRecord(this.draggedRecord,e),this.updateChildRecordLevel(this.draggedRecord,1)}if(this.droppedRecord.parentItem){var a=this.parent.getParentTask(this.droppedRecord.parentItem).childRecords,n=a.indexOf(this.droppedRecord);a.splice(n,0,this.draggedRecord)}t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))||this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.updateChildRecordLevel=function(e,t){var i,r=0;if(t++,!e.hasChildRecords)return 0;r=e.childRecords.length;for(var a=0;a<r;a++){i=e.childRecords[a];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}i.level=e.parentItem?n.level+t:e.level+1,this.parent.setRecordValue("level",i.level,i),i.hasChildRecords&&(t--,t=this.updateChildRecordLevel(i,t))}return t},e.prototype.updateChildRecord=function(e,t,i){var r,a=this.parent,n=0;if(!e.hasChildRecords)return 0;n=e.childRecords.length;for(var s=0;s<n;s++)r=e.childRecords[s],t++,a.flatData.splice(t,0,r),this.parent.ids.splice(t,0,r.ganttProperties.rowUniqueID.toString()),a.taskFields.parentID&&a.dataSource.length>0&&this.ganttData.splice(t,0,r.taskData),r.hasChildRecords&&(t=this.updateChildRecord(r,t));return t},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=e,s=this.parent.getParentTask(n.parentItem);if(n){if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&("ResourceView"===this.parent.viewType&&1===o.length&&(this.parent.isOnDelete=!0,o[0].isDelete=!0,this.parent.dataOperation.updateParentItems(s),this.parent.isOnDelete=!1,o[0].isDelete=!1),l=o.indexOf(n),s.childRecords.splice(l,1),!this.parent.taskFields.parentID&&s.taskData[this.parent.taskFields.child]&&s.taskData[this.parent.taskFields.child].splice(l,1),this.updateParentRecords.push(s))}if(!this.parent.taskFields.parentID){var d=[];d.push(n.ganttProperties.taskId.toString()),("ProjectView"===this.parent.viewType||"ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition)&&this.parent.editModule.removeFromDataSource(d)}if(r.taskFields.parentID){n.hasChildRecords&&n.childRecords.length>0&&this.removeChildItem(n);for(var h=void 0,p=i.length>0&&"ResourceView"!==this.parent.viewType?i:this.parent.updatedRecords,c=0;c<p.length;c++)"ResourceView"===this.parent.viewType?p[c].ganttProperties.rowUniqueID===n.ganttProperties.rowUniqueID&&(h=c):p[c][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(h=c);if(-1!==h){i.length>0&&i.splice(h,1);var u=this.treeGridData.indexOf(n);this.treeGridData.splice(u,1),this.parent.ids.splice(u,1),-1!==this.parent.treeGrid.parentData.indexOf(n)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(n),1),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(h,1)}}var g=this.treeGridData.indexOf(n);if(!r.taskFields.parentID){var f=this.parent.editModule.getChildCount(n,0);this.treeGridData.splice(g,f+1),this.parent.ids.splice(g,f+1);var m=this.ganttData.indexOf(n.taskData);-1!==m&&(this.ganttData.splice(m,1),this.parent.treeGrid.parentData.splice(m,1)),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(g,f+1)}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(s.expanded=!1,s.hasChildRecords=!1)}},e.prototype.removeChildItem=function(e){for(var i,r,n=0;n<e.childRecords.length;n++){i=e.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(r=o);if(-1!==r){s.length>0&&s.splice(r,1);var l=this.treeGridData.indexOf(i);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(r,1)}i.hasChildRecords&&this.removeChildItem(i)}},e.prototype.reorderRows=function(e,t,i){if(!this.parent.readOnly){e[0],"above"===i&&(this.dropPosition="topSegment"),"below"===i&&(this.dropPosition="bottomSegment"),"child"===i&&(this.dropPosition="middleSegment");for(var r=[],a=0;a<e.length;a++)r[a]=this.parent.updatedRecords[e[a]];var n={data:r,dropIndex:t,dropPosition:this.dropPosition};this.dropRows(n,!0)}},e}(),bi=function(){function e(e){this.theme=e,this.ganttStyle={},this.setTheme(this.ganttStyle,this.theme)}return Object.defineProperty(e.prototype,"style",{get:function(){return this.ganttStyle?this.ganttStyle:(this.setTheme(this.ganttStyle,"Material"),this.ganttStyle)},enumerable:!0,configurable:!0}),e.prototype.setTheme=function(e,t){switch(this.initStyles(e),e.columnHeader.fontSize=9.5,e.columnHeader.fontColor=new g.PdfColor(0,0,0),e.columnHeader.fontColor.gray=.2,e.columnHeader.backgroundColor=new g.PdfColor(255,255,255),e.columnHeader.borderColor=new g.PdfColor(234,234,234),e.columnHeader.format.lineAlignment=1,e.columnHeader.format.alignment=0,e.fontFamily=g.PdfFontFamily.Helvetica,e.cell.fontSize=9.5,e.cell.backgroundColor=new g.PdfColor(255,255,255),e.cell.borderColor=new g.PdfColor(234,234,234),e.cell.fontColor=new g.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.timeline.fontSize=9.5,e.timeline.fontStyle=0,e.timeline.backgroundColor=new g.PdfColor(252,252,252),e.timeline.fontColor=new g.PdfColor(40,40,39),e.chartGridLineColor=new g.PdfColor(206,206,206),e.timeline.borderColor=new g.PdfColor(206,206,206),t){case"Bootstrap":e.taskbar.taskColor=new g.PdfColor(49,122,185),e.taskbar.progressColor=new g.PdfColor(33,82,125),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(119,119,119),e.taskbar.parentProgressColor=new g.PdfColor(85,85,85),e.taskbar.taskBorderColor=new g.PdfColor(33,82,125),e.taskbar.parentTaskBorderColor=new g.PdfColor(85,85,85),e.taskbar.milestoneColor=new g.PdfColor(85,85,85),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(33,82,125),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(0,0,0);break;case"Bootstrap 4":e.taskbar.taskColor=new g.PdfColor(0,123,255),e.taskbar.progressColor=new g.PdfColor(0,86,179),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(108,117,125),e.taskbar.parentProgressColor=new g.PdfColor(73,80,87),e.taskbar.taskBorderColor=new g.PdfColor(0,86,179),e.taskbar.parentTaskBorderColor=new g.PdfColor(73,80,87),e.taskbar.milestoneColor=new g.PdfColor(73,80,87),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(0,86,179),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(33,37,41);break;case"Fabric":e.columnHeader.fontColor=new g.PdfColor(102,102,102),e.cell.fontColor=new g.PdfColor(51,51,51),e.taskbar.taskColor=new g.PdfColor(0,120,214),e.taskbar.progressColor=new g.PdfColor(0,91,163),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(118,118,118),e.taskbar.parentProgressColor=new g.PdfColor(80,80,80),e.taskbar.taskBorderColor=new g.PdfColor(0,91,163),e.taskbar.parentTaskBorderColor=new g.PdfColor(80,80,80),e.taskbar.milestoneColor=new g.PdfColor(80,80,80),e.footer.fontColor=new g.PdfColor(51,51,51),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(0,69,122),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(51,51,51);break;default:e.taskbar.taskColor=new g.PdfColor(88,105,197),e.taskbar.progressColor=new g.PdfColor(63,81,181),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(132,132,132),e.taskbar.parentProgressColor=new g.PdfColor(97,97,97),e.taskbar.taskBorderColor=new g.PdfColor(63,81,181),e.taskbar.parentTaskBorderColor=new g.PdfColor(51,51,51),e.taskbar.milestoneColor=new g.PdfColor(97,97,97),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(63,81,181),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(51,51,51)}},e.prototype.initStyles=function(e){e.columnHeader={},e.columnHeader.format=new g.PdfStringFormat,e.cell={},e.cell.format=new g.PdfStringFormat,e.timeline={},e.footer={},e.footer.format=new g.PdfStringFormat,e.label={},e.taskbar={}},e}(),Pi=function(){function e(){this.mKeys=[],this.mValues=[]}return e.prototype.size=function(){return this.mKeys.length},e.prototype.add=function(e,t){if(void 0===e||null===e||void 0===t||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.")},e.prototype.keys=function(){return this.mKeys},e.prototype.values=function(){return this.mValues},e.prototype.getValue=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");var t=this.mKeys.indexOf(e);if(t<0)throw new RangeError("No item with the specified key has been added.");return this.mValues[t]},e.prototype.setValue=function(e,t){if(void 0===e||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},e.prototype.remove=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");var t=this.mKeys.indexOf(e);if(t<0)throw new RangeError("No item with the specified key has been added.");return this.mKeys.splice(t,1),this.mValues.splice(t,1),!0},e.prototype.containsKey=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");return!(this.mKeys.indexOf(e)<0)},e.prototype.clear=function(){this.mKeys=[],this.mValues=[]},e}(),Si=function(){function e(){var e=new g.PdfPen(new g.PdfColor(0,0,0));e.dashStyle=g.PdfDashStyle.Solid;var t=new g.PdfPen(new g.PdfColor(0,0,0));t.dashStyle=g.PdfDashStyle.Solid;var i=new g.PdfPen(new g.PdfColor(0,0,0));i.dashStyle=g.PdfDashStyle.Solid;var r=new g.PdfPen(new g.PdfColor(0,0,0));r.dashStyle=g.PdfDashStyle.Solid,this.leftPen=e,this.rightPen=t,this.topPen=i,this.bottomPen=r}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftPen},set:function(e){this.leftPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightPen},set:function(e){this.rightPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.topPen},set:function(e){this.topPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.bottomPen},set:function(e){this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"all",{set:function(e){this.leftPen=this.rightPen=this.topPen=this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAll",{get:function(){return this.leftPen===this.rightPen&&this.leftPen===this.topPen&&this.leftPen===this.bottomPen},enumerable:!0,configurable:!0}),Object.defineProperty(e,"default",{get:function(){return new e},enumerable:!0,configurable:!0}),e}(),Ci=function(){function e(e,t,i,r){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=r,this.hasLeftPad=!0,this.hasRightPad=!0,this.hasTopPad=!0,this.hasBottomPad=!0)}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftPad},set:function(e){this.leftPad=e,this.hasLeftPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightPad},set:function(e){this.rightPad=e,this.hasRightPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.topPad},set:function(e){this.topPad=e,this.hasTopPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.bottomPad},set:function(e){this.bottomPad=e,this.hasBottomPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.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}),e}(),Mi=function(){return function(){}}(),Ri=function(){return function(){this.cellSpacing=0,this.borderOverlapStyle=g.PdfBorderOverlapStyle.Overlap,this.allowHorizontalOverflow=!1,this.horizontalOverflowType=e.PdfHorizontalOverflowType.LastPage,this.cellPadding=new Ci}}(),Oi=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),xi=function(i){function r(e){var t=i.call(this,e)||this;return t.columnRanges=[],t.repeatRowIndex=-1,t.currentBounds=new g.RectangleF(0,0,0,0),t}return Oi(r,i),Object.defineProperty(r.prototype,"treegrid",{get:function(){return this.elements},enumerable:!0,configurable:!0}),r.prototype.layoutInternal=function(e){if(t.isNullOrUndefined(e))throw Error("Argument Null Expection");this.currentPage=e.page;var i=e.format;if(null!==this.currentPage&&(this.currentPageBounds=this.currentPage.getClientSize()),this.currentGraphics=this.currentPage.graphics,null!==i&&i.break===g.PdfLayoutBreakType.FitColumnsToPage?this.currentBounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),new g.SizeF(this.treegrid.columns.width,this.currentGraphics.clientSize.height)):this.currentBounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),this.currentGraphics.clientSize),0===this.treegrid.rows.count)throw Error("Please add row or header into grid");return this.currentBounds.width=e.bounds.width>0?e.bounds.width:this.currentBounds.width-this.treegrid.rows.getRow(0).cells.getCell(0).style.borders.left.width/2,this.startLocation=new g.PointF(e.bounds.x,e.bounds.y),e.bounds.height>0&&(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)},r.prototype.determineColumnDrawRanges=function(){for(var e=0,t=0,i=0,r=this.currentGraphics.clientSize.width-this.currentBounds.x,a=0;a<this.treegrid.columns.count;a++)if((i+=this.treegrid.columns.getColumn(a).width)>=r){for(var n=0,s=e;s<=a&&!((n+=this.treegrid.columns.getColumn(s).width)>r);s++)t=s;this.columnRanges.push([e,t]),e=t+1,i=t<=a?this.treegrid.columns.getColumn(a).width:0}this.columnRanges.push([e,this.treegrid.columns.count-1])},r.prototype.getFormat=function(e){return e},r.prototype.layoutOnPage=function(t){for(var i=this.getFormat(t.format),r=null,a=new Pi,n=t.page,s=0;s<this.columnRanges.length;s++){var o=this.columnRanges[s];this.cellStartIndex=o[0],this.cellEndIndex=o[1];for(var l=this.treegrid.rows.count,d=0,h=!1,p=0;p<l;p++){var c=this.treegrid.rows.getRow(p);d++;var u=this.currentBounds.y;null===this.currentPage||a.containsKey(this.currentPage)||a.add(this.currentPage,o);var f=this.drawRow(c);for(u===this.currentBounds.y?(h=!0,this.repeatRowIndex=this.treegrid.rows.rowCollection.indexOf(c)):(h=!1,this.repeatRowIndex=-1);!f.isFinish&&null!==n;)if(this.treegrid.allowRowBreakAcrossPages)this.currentPage=this.getNextPageFormat(i),this.treegrid.enableHeader&&this.drawHeader(),this.checkBounds(i),f=this.drawRow(c);else{if(!this.treegrid.allowRowBreakAcrossPages&&d<length){this.currentPage=this.getNextPageFormat(i),this.treegrid.enableHeader&&this.drawHeader();break}if(d>=length)break}!f.isFinish&&null!==n&&i.layout!==g.PdfLayoutType.OnePage&&h&&(this.startLocation.x=this.currentBounds.x,this.currentPage=this.getNextPageFormat(i),this.treegrid.enableHeader&&this.drawHeader(),this.startLocation.y=this.currentBounds.y,i.paginateBounds===new g.RectangleF(0,0,0,0)&&(this.currentBounds.x+=this.startLocation.x),this.currentBounds.x===Si.default.left.width/2&&(this.currentBounds.y+=this.startLocation.x),this.drawRow(c),null===this.currentPage||a.containsKey(this.currentPage)||a.add(this.currentPage,o))}this.columnRanges.indexOf(o)<this.columnRanges.length-1&&null!==n&&i.layout!==g.PdfLayoutType.OnePage&&(this.currentPage=this.getNextPageFormat(i),this.checkBounds(i))}return r=this.getLayoutResult(),this.treegrid.style.allowHorizontalOverflow&&this.treegrid.style.horizontalOverflowType===e.PdfHorizontalOverflowType.NextPage&&this.reArrangePages(a),r},r.prototype.checkBounds=function(e){var t=new g.PointF(Si.default.right.width/2,Si.default.top.width/2);e.paginateBounds===new g.RectangleF(0,0,0,0)&&this.startLocation===t&&(this.currentBounds.x+=this.startLocation.x,this.currentBounds.y+=this.startLocation.y)},r.prototype.drawHeader=function(){this.drawRow(this.treegrid.rows.getRow(0))},r.prototype.reArrangePages=function(e){for(var t=this.currentPage.document,i=[],r=e.keys(),a=0;a<r.length;a++){(o=r[a]).section=null,i.push(o),t.pages.remove(o)}for(a=0;a<e.size();a++)for(var n=e.size()/this.columnRanges.length,s=a;s<e.size();s+=n){var o=i[s];-1===t.pages.indexOf(o)&&t.pages.add(o)}},r.prototype.getNextPageFormat=function(e){var t=this.currentPage.section,i=null,r=t.indexOf(this.currentPage);return i=r===t.count-1?t.add():t.getPages()[r+1],this.currentGraphics=i.graphics,this.currentBounds=new g.RectangleF(new g.PointF(0,0),i.getClientSize()),i},r.prototype.getLayoutResult=function(){var e=new g.RectangleF(this.startLocation,new g.SizeF(this.currentBounds.width,this.currentBounds.y-this.startLocation.y));return new Ii(this.currentPage,e)},r.prototype.checkIfDefaultFormat=function(e){var t=new g.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},r.prototype.drawRow=function(e,i,r){if(t.isNullOrUndefined(i)){var a=new g.RowLayoutResult;return(r=e.rowBreakHeight>0?e.rowBreakHeight:e.height)>this.currentPageBounds.height?this.treegrid.allowRowBreakAcrossPages?(a.isFinish=!0,this.drawRowWithBreak(a,e,r)):(a.isFinish=!1,this.drawRow(e,a,r)):this.currentBounds.y+r>this.currentPageBounds.height||this.currentBounds.y+r>this.currentBounds.height?this.repeatRowIndex>-1&&this.repeatRowIndex===e.rowIndex?this.treegrid.allowRowBreakAcrossPages?(a.isFinish=!0,this.drawRowWithBreak(a,e,r)):(a.isFinish=!1,this.drawRow(e,a,r)):a.isFinish=!1:(a.isFinish=!0,this.drawRow(e,a,r)),a}var n=new g.PointF(this.currentBounds.x,this.currentBounds.y);i.bounds=new g.RectangleF(n,new g.SizeF(0,0));var s=0;r=this.reCalculateHeight(e,r);for(var o=this.cellStartIndex;o<=this.cellEndIndex;o++){var l=e.cells.getCell(o),d=this.treegrid.columns.getColumn(o);d.isTreeColumn&&(s=10*e.level);var h=o>this.cellEndIndex+1&&l.columnSpan>1;if(!h)for(var p=1;p<l.columnSpan;p++)e.cells.getCell(o+p).isCellMergeContinue=!0;var c=new g.SizeF(d.width,r);!this.checkIfDefaultFormat(d.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=d.format),l.draw(this.currentGraphics,new g.RectangleF(n,c),h,s),e.treegrid.style.allowHorizontalOverflow&&(l.columnSpan>this.cellEndIndex||o+l.columnSpan>this.cellEndIndex+1)&&this.cellEndIndex<e.cells.count-1&&(e.rowOverflowIndex=this.cellEndIndex),n.x+=d.width,s=0}return this.currentBounds.y+=r,i.bounds=new g.RectangleF(new g.PointF(i.bounds.x,i.bounds.y),new g.SizeF(n.x,n.y)),null},r.prototype.drawRowWithBreak=function(e,t,i){var r=new g.PointF(this.currentBounds.x,this.currentBounds.y);e.bounds=new g.RectangleF(r,new g.SizeF(0,0));var a=0;this.treegridHeight=this.currentBounds.height,t.rowBreakHeight=this.currentBounds.y+i-this.currentBounds.height;for(var n=0;n<t.cells.count;n++){(l=t.cells.getCell(n)).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&&(a=10*t.level);var l,d=(l=t.cells.getCell(s)).columnSpan+s>this.cellEndIndex+1&&l.columnSpan>1;if(!d)for(var h=1;h<l.columnSpan;h++)t.cells.getCell(s+h).isCellMergeContinue=!0;var p=this.treegridHeight>0?this.treegridHeight:this.currentBounds.height,c=new g.SizeF(o.width,p);!this.checkIfDefaultFormat(o.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=o.format),l.draw(this.currentGraphics,new g.RectangleF(r,c),d,a),e.isFinish=e.isFinish?l.finishedDrawingCell:e.isFinish,r.x+=o.width,a=0,this.currentBounds.y+=this.treegridHeight>0?this.treegridHeight:i,e.bounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),new g.SizeF(r.x,r.y))}},r.prototype.reCalculateHeight=function(e,i){for(var r=0,a=this.cellStartIndex;a<=this.cellEndIndex;a++)t.isNullOrUndefined(e.cells.getCell(a).remainingString)&&""!==e.cells.getCell(a).remainingString||(r=Math.max(r,e.cells.getCell(a).measureHeight()));return Math.max(i,r)},r}(g.ElementLayouter),Ii=function(e){function t(t,i){return e.call(this,t,i)||this}return Oi(t,e),t}(g.PdfLayoutResult),Ei=function(e){function t(t){return void 0===t?e.call(this)||this:e.call(this,t)||this}return Oi(t,e),t}(g.PdfLayoutFormat),Ni=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Fi=function(e){function t(){var t=e.call(this)||this;return t.treeGridSize=new g.SizeF(0,0),t.treeColumnIndex=0,t.allowRowBreakAcrossPages=!0,t.enableHeader=!0,t.isFitToWidth=!1,t.columns=new ji(t),t.rows=new Bi(t),t.headers=new Ai(t),t.style=new Ri,t.rowHeight=0,t}return Ni(t,e),Object.defineProperty(t.prototype,"raiseBeginCellDraw",{get:function(){return void 0!==this.beginCellDraw&&null!==typeof this.beginCellDraw},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"raiseEndCellDraw",{get:function(){return void 0!==this.endCellDraw&&null!==typeof this.endCellDraw},enumerable:!0,configurable:!0}),Object.defineProperty(t.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}),t.prototype.draw=function(e,t,i,r){if(t instanceof g.PointF&&void 0===t.width&&void 0===i)return this.drawHelper(e,t.x,t.y);if("number"==typeof t&&"number"==typeof i&&void 0===r)return this.drawHelper(e,t,i,null);if(t instanceof g.RectangleF&&void 0!==t.width&&void 0===i)return this.drawHelper(e,t,null);if(t instanceof g.PointF&&void 0===t.width&&i instanceof g.PdfLayoutFormat)return this.drawHelper(e,t.x,t.y,i);if("number"==typeof t&&"number"==typeof i&&(r instanceof g.PdfLayoutFormat||null==r)){var a=e.graphics.clientSize.width-t,n=new g.RectangleF(t,i,a,0);return this.drawHelper(e,n,r)}return t instanceof g.RectangleF&&void 0!==t.width&&"boolean"==typeof i?this.drawHelper(e,t,null):this.drawHelper(e,t,i)},t.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{t=[];var r=0,a=0,n=this.columns.count;for(i=0;i<n;i++){for(var s=this.rows.count,o=0;o<s;o++){var l=this.rows.getRow(o).cells.getCell(i).width,d=this.initialWidth>0?Math.min(this.initialWidth,l):l;r=Math.max(r,d),r=Math.max(this.columns.getColumn(i).width,r),this.columns.getColumn(i).isTreeColumn&&(a=Math.max(a,this.rows.getRow(o).level))}this.columns.getColumn(i).isTreeColumn?t.push(r+10*a):t.push(r),r=0}for(i=0;i<this.columns.count;i++)this.columns.getColumn(i).width<0&&(this.columns.getColumn(i).width=t[i])}},t.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 g.SizeF(t,e)},t.prototype.drawGrid=function(e,t,i,r){this.initialWidth=e.graphics.clientSize.width;var a=new g.RectangleF(0,0,e.getClientSize().height,0);return this.draw(e,a,r)},t.prototype.layout=function(e){if(0!==this.rows.count){var t=this.rows.getRow(0).cells.getCell(0).style;if(1!==t.borders.left.width){var i=t.borders.left.width/2,r=t.borders.top.width/2;if(e.bounds.x===Si.default.right.width/2&&e.bounds.y===Si.default.right.width/2){var a=new g.RectangleF(new g.PointF(i,r),new g.SizeF(this.size.width,this.size.height));e.bounds=a}}}this.setSpan(),this.layouter=new xi(this);return this.layouter.layoutInternal(e)},t.prototype.onBeginCellDraw=function(e){this.raiseBeginCellDraw&&this.beginCellDraw(this,e)},t.prototype.onEndCellDraw=function(e){this.raiseEndCellDraw&&this.endCellDraw(this,e)},t.prototype.setSpan=function(){for(var e=1,t=1,i=0,r=0,a=0,n=this.headers.count,s=0;s<n;s++){a=0;for(var o=(h=this.headers.getHeader(s)).cells.count,l=0;l<o;l++){var d=h.cells.getCell(l);if(a=Math.max(a,d.rowSpan),!d.isCellMergeContinue&&!d.isRowMergeContinue&&(d.columnSpan>1||d.rowSpan>1)){if(d.columnSpan+l>h.cells.count)throw new Error("Invalid span specified at row "+l.toString()+" column "+s.toString());if(d.rowSpan+s>this.headers.count)throw new Error("Invalid span specified at Header "+l.toString()+" column "+s.toString());if(d.columnSpan>1&&d.rowSpan>1){for(e=d.columnSpan,t=d.rowSpan,i=l,r=s,d.isCellMergeStart=!0,d.isRowMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,h.cells.getCell(i).isRowMergeContinue=!0,h.cells.getCell(i).rowSpan=t,e--;for(i=l,e=d.columnSpan;t>1;){for(r++,this.headers.getHeader(r).cells.getCell(l).isRowMergeContinue=!0,this.headers.getHeader(r).cells.getCell(i).isRowMergeContinue=!0,t--;e>1;)i++,this.headers.getHeader(r).cells.getCell(i).isCellMergeContinue=!0,this.headers.getHeader(r).cells.getCell(i).isRowMergeContinue=!0,e--;e=d.columnSpan,i=l}}else if(d.columnSpan>1&&1===d.rowSpan)for(e=d.columnSpan,i=l,d.isCellMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,e--;else if(1===d.columnSpan&&d.rowSpan>1)for(t=d.rowSpan,r=s;t>1;)r++,this.headers.getHeader(r).cells.getCell(l).isRowMergeContinue=!0,t--}}h.maximumRowSpan=a}e=t=1,i=r=0,n=this.rows.count;for(s=0;s<n;s++){var h,p=(h=this.rows.getRow(s)).cells.count;for(l=0;l<p;l++){if(!(d=h.cells.getCell(l)).isCellMergeContinue&&!d.isRowMergeContinue&&(d.columnSpan>1||d.rowSpan>1)){if(d.columnSpan+l>h.cells.count)throw new Error("Invalid span specified at row {0} column {1} "+l.toString());if(d.rowSpan+s>this.rows.count)throw new Error("Invalid span specified at row {0} column {1} "+l.toString());if(d.columnSpan>1&&d.rowSpan>1){for(e=d.columnSpan,t=d.rowSpan,i=l,r=s,d.isCellMergeStart=!0,d.isRowMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,e--;for(i=l,e=d.columnSpan;t>1;){for(r++,this.rows.getRow(r).cells.getCell(l).isRowMergeContinue=!0,t--;e>1;)i++,this.rows.getRow(r).cells.getCell(i).isCellMergeContinue=!0,e--;e=d.columnSpan,i=l}}else if(d.columnSpan>1&&1===d.rowSpan)for(e=d.columnSpan,i=l,d.isCellMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,e--;else if(1===d.columnSpan&&d.rowSpan>1)for(t=d.rowSpan,r=s;t>1;)r++,this.rows.getRow(r).cells.getCell(l).isRowMergeContinue=!0,t--}}}},t}(g.PdfLayoutElement),Ui=function(){function e(e){this.cellWidth=0,this.cellHeight=0,this.finishedDrawingCell=!0,t.isNullOrUndefined(e)?(this.rowSpan=1,this.columnSpan=1):this.row=e,this.style={}}return Object.defineProperty(e.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(e.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}),e.prototype.measureWidth=function(){var e=0,t=new g.PdfStringLayouter;if("string"==typeof this.value){var i=new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);this.row.treegrid.ganttStyle.font&&(i=this.row.treegrid.ganttStyle.font);e+=t.layout(this.value,i,this.style.format,new g.SizeF(Number.MAX_VALUE,Number.MAX_VALUE),!1,new g.SizeF(0,0)).actualSize.width,e+=2*(this.style.borders.left.width+this.style.borders.right.width)}return void 0!==this.row.treegrid.style.cellPadding.left&&this.row.treegrid.style.cellPadding.hasLeftPad&&(e+=this.row.treegrid.style.cellPadding.left),void 0!==this.row.treegrid.style.cellPadding.right&&this.row.treegrid.style.cellPadding.hasRightPad&&(e+=this.row.treegrid.style.cellPadding.right),e+=this.row.treegrid.style.cellSpacing},e.prototype.measureHeight=function(){var e=this.row.treegrid.rowHeight,i=0,r=this.calculateWidth();r-=this.row.treegrid.style.cellPadding.right+this.row.treegrid.style.cellPadding.left,r-=this.style.borders.left.width+this.style.borders.right.width;var a=new g.PdfStringLayouter;if("string"==typeof this.value||"string"==typeof this.remainingString){var n=this.value;this.finishedDrawingCell||(n=t.isNullOrUndefined(this.remainingString)||""===this.remainingString?this.value:this.remainingString);var s=new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);this.row.treegrid.ganttStyle.font&&(s=this.row.treegrid.ganttStyle.font);i+=a.layout(n,s,this.style.format,new g.SizeF(r,0),!1,new g.SizeF(0,0)).actualSize.height,i+=2*(this.style.borders.top.width+this.style.borders.bottom.width)}return i+=this.row.treegrid.style.cellPadding.top+this.row.treegrid.style.cellPadding.bottom,(i+=this.row.treegrid.style.cellSpacing)>e?i:e},e.prototype.calculateWidth=function(){for(var e=this.row.cells.indexOf(this),t=this.columnSpan,i=0,r=0;r<t;r++)i+=this.row.treegrid.columns.getColumn(e+r).width;return this.row.treegrid.columns.getColumn(e).isTreeColumn&&(i-=10*this.row.level),i},e.prototype.draw=function(e,t,i,r){var a=null;if(i){for(var n=this.row.cells.indexOf(this),s=n+1;s<=n+this.columnSpan;s++)this.row.cells.getCell(s).isCellMergeContinue=!1,this.row.cells.getCell(s).isRowMergeContinue=!1;this.columnSpan=1}if((this.isCellMergeContinue||this.isRowMergeContinue)&&this.isCellMergeContinue&&this.row.treegrid.style.allowHorizontalOverflow)return this.row.rowOverflowIndex>0&&this.row.cells.indexOf(this)!==this.row.rowOverflowIndex+1||0===this.row.rowOverflowIndex&&this.isCellMergeContinue,a;this.drawCellBackground(e,t);var o=new g.PdfSolidBrush(this.style.fontColor),l=null;l=this.row.isParentRow?new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,g.PdfFontStyle.Bold):new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),this.row.treegrid.ganttStyle.font&&(l=this.row.treegrid.ganttStyle.font);var d=t;if(this.isHeaderCell||(d.x=d.x,d.width=d.width),d.height>=e.clientSize.height&&(this.row.treegrid.allowRowBreakAcrossPages?(d.height-=d.y,t.height-=t.y):(d.height=e.clientSize.height,t.height=e.clientSize.height)),d=this.adjustContentLayoutArea(d),"string"==typeof this.value||"string"==typeof this.remainingString){var h=null;this.finishedDrawingCell?(h=""===this.remainingString?this.remainingString:this.value,e.drawString(h,l,null,o,d.x+r,d.y,d.width-r-10,d.height-10,this.style.format)):e.drawString(this.remainingString,l,null,o,d.x+r,d.y,this.style.format),a=e.stringLayoutResult}return null!=this.style.borders&&this.drawCellBorder(e,t),a},e.prototype.drawCellBackground=function(e,t){var i=new g.PdfSolidBrush(this.style.backgroundColor);null!=i&&(e.save(),e.drawRectangle(i,t.x,t.y,t.width,t.height),e.restore())},e.prototype.adjustContentLayoutArea=function(e){var t=new g.RectangleF(new g.PointF(e.x,e.y),new g.SizeF(e.width,e.height)),i=this.style.padding;if(this.value instanceof Fi){var r=this.value.size;this.style.format.alignment===g.PdfTextAlignment.Center?(t.x+=i.left+(t.width-r.width)/2,t.y+=i.top+(t.height-r.height)/2):this.style.format.alignment===g.PdfTextAlignment.Left?(t.x+=i.left,t.y+=i.top):this.style.format.alignment===g.PdfTextAlignment.Right&&(t.x+=i.left+(t.width-r.width),t.y+=i.top)}else t.x+=i.left,t.y+=i.top;return t},e.prototype.drawCellBorder=function(e,t){if(this.row.treegrid.style.borderOverlapStyle===g.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)return e.drawRectangle(this.style.borders.left,t.x,t.y,t.width,t.height),void e.restore();var i=new g.PointF(t.x,t.y+t.height),r=new g.PointF(t.x,t.y),a=this.style.borders.left;this.style.borders.left.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore(),i=new g.PointF(t.x+t.width,t.y),r=new g.PointF(t.x+t.width,t.y+t.height),a=this.style.borders.right,t.x+t.width>e.clientSize.width-a.width/2&&(i=new g.PointF(e.clientSize.width-a.width/2,t.y),r=new g.PointF(e.clientSize.width-a.width/2,t.y+t.height)),this.style.borders.right.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore(),i=new g.PointF(t.x,t.y),r=new g.PointF(t.x+t.width,t.y),a=this.style.borders.top,this.style.borders.top.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore(),i=new g.PointF(t.x+t.width,t.y+t.height),r=new g.PointF(t.x,t.y+t.height),a=this.style.borders.bottom,t.y+t.height>e.clientSize.height-a.width/2&&(i=new g.PointF(t.x+t.width,e.clientSize.height-a.width/2),r=new g.PointF(t.x,e.clientSize.height-a.width/2)),this.style.borders.bottom.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore()},e}(),Vi=function(){function e(e){this.treegridRow=e,this.cells=[]}return e.prototype.getCell=function(e){if(e<0||e>=this.count)throw new Error("IndexOutOfRangeException");return this.cells[e]},Object.defineProperty(e.prototype,"count",{get:function(){return this.cells.length},enumerable:!0,configurable:!0}),e.prototype.add=function(e){if(void 0===e){var t=new Ui;return this.add(t),e}e.row=this.treegridRow,this.cells.push(e)},e.prototype.indexOf=function(e){return this.cells.indexOf(e)},e}(),Li=function(){function e(e){this.treegridRowOverflowIndex=0,this.rowHeight=0,this.rowWidth=0,this._isParentRow=!1,this.intendLevel=0,this.pdfTreeGrid=e}return Object.defineProperty(e.prototype,"cells",{get:function(){return t.isNullOrUndefined(this.treegridCells)&&(this.treegridCells=new Vi(this)),this.treegridCells},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isParentRow",{get:function(){return this._isParentRow},set:function(e){this._isParentRow=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"treegrid",{get:function(){return this.pdfTreeGrid},set:function(e){this.pdfTreeGrid=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.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(e.prototype,"rowOverflowIndex",{get:function(){return this.treegridRowOverflowIndex},set:function(e){this.treegridRowOverflowIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this.intendLevel},set:function(e){this.intendLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.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(e.prototype,"width",{get:function(){return 0===this.rowWidth&&(this.rowWidth=this.measureWidth()),this.rowWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowIndex",{get:function(){return this.treegrid.rows.rowCollection.indexOf(this)},enumerable:!0,configurable:!0}),e.prototype.measureWidth=function(){for(var e=this.treegrid.columns.columns,t=0,i=0;i<e.length;i++){t+=e[i].width}return t},e.prototype.measureHeight=function(){for(var e=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},e}(),Bi=function(){function e(e){this.rows=[],this.treegrid=e}return Object.defineProperty(e.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowCollection",{get:function(){return this.rows},enumerable:!0,configurable:!0}),e.prototype.addRow=function(e){if(void 0===e){var t=new Li(this.treegrid);return this.addRow(t),t}if(0===e.cells.count)for(var i=0;i<this.treegrid.columns.count;i++)e.cells.add(new Ui);this.rows.push(e)},e.prototype.getRow=function(e){return this.rows[e]},e}(),Ai=function(){function e(e){this.rows=[],this.treegrid=e,this.rows=[]}return e.prototype.getHeader=function(e){return this.rows[e]},Object.defineProperty(e.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),e.prototype.add=function(e){this.rows.push(e)},e.prototype.indexOf=function(e){return this.rows.indexOf(e)},e}(),Hi=function(){function e(e){this.columnWidth=0,this.treeColumnIndex=!1,this._headerText="",this._field="",this.treegrid=e}return Object.defineProperty(e.prototype,"headerText",{get:function(){return this._headerText},set:function(e){this._headerText=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"field",{get:function(){return this._field},set:function(e){this._field=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.columnWidth},set:function(e){this.columnWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isTreeColumn",{get:function(){return this.treeColumnIndex},set:function(e){this.treeColumnIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return null==this.stringFormat&&(this.stringFormat=new g.PdfStringFormat),this.stringFormat},set:function(e){this.stringFormat=e},enumerable:!0,configurable:!0}),e}(),ji=function(){function e(e){this.internalColumns=[],this.columnWidth=0,this.treegrid=e,this.internalColumns=[]}return e.prototype.add=function(e){for(var t=0;t<e;t++){this.internalColumns.push(new Hi(this.treegrid));for(var i=0;i<this.treegrid.rows.count;i++){var r=this.treegrid.rows.getRow(i),a=new Ui;a.value="",r.cells.add(a)}}},Object.defineProperty(e.prototype,"count",{get:function(){return this.internalColumns.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 0===this.columnWidth&&(this.columnWidth=this.measureColumnsWidth()),this.columnWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this.internalColumns},enumerable:!0,configurable:!0}),e.prototype.getColumn=function(e){if(e>=0&&e<=this.columns.length)return this.columns[e];throw Error("can not get the column from the index: "+e)},e.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},e.prototype.getDefaultWidths=function(e){for(var t=[],i=this.count,r=0;r<this.count;r++)t[r]=this.internalColumns[r].width,this.internalColumns[r].width>0?(e-=this.internalColumns[r].width,i--):t[r]=0;for(r=0;r<this.count;r++){var a=e/i;t[r]<=0&&(t[r]=a)}return t},e}(),Wi=function(){function e(e){this.parent=e}return e.prototype.processGridExport=function(e,t,i){this.flatData=e,this.gantt=t,this.exportValueFormatter=new qi(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=P(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.processHeaderContent(),this.processGanttContent(),this.processTimeline(),this.processTaskbar(),this.processPredecessor()},e.prototype.processHeaderContent=function(){var e=this;this.rowIndex++,this.row=this.gantt.rows.addRow();var t=0;this.columns.forEach(function(i){e.isColumnVisible(i)&&(e.processColumnHeader(i,t),t++)})},e.prototype.processColumnHeader=function(e,t){this.gantt.columns.add(1);var i=this.gantt.columns.getColumn(t);this.parent.treeColumnIndex===t&&(i.isTreeColumn=!0);var r=parseInt(e.width,10);i.width=P(r),this.totalColumnWidth+=i.width,i.headerText=e.headerText,i.field=e.field;var a=this.row.cells.getCell(t);a.value=e.headerText,a.isHeaderCell=!0;var n=this.parent.timelineModule.isSingleTier?45:60;this.copyStyles(this.ganttStyle.columnHeader,a,!1),this.row.height=P(n),e.headerTextAlign&&(a.style.format.alignment=g.PdfTextAlignment[e.headerTextAlign]);var s={cell:a,style:a.style,value:a.value,column:e};this.parent.pdfColumnHeaderQueryCellInfo&&this.parent.trigger("pdfColumnHeaderQueryCellInfo",s),a.value=s.value},e.prototype.isColumnVisible=function(e){var i=e.visible||this.exportProps.includeHiddenColumn,r=!!t.isNullOrUndefined(e.template);return i&&r},e.prototype.processGanttContent=function(){var e=this;0===this.flatData.length?this.renderEmptyGantt():this.flatData.forEach(function(t){e.row=e.gantt.rows.addRow(),t.hasChildRecords?(e.gantt.rows.getRow(e.rowIndex).isParentRow=!0,e.processRecordRow(t)):e.processRecordRow(t),e.rowIndex++})},e.prototype.processTimeline=function(){var e=this.parent.timelineModule;this.gantt.chartHeader.topTierHeight=this.gantt.chartHeader.bottomTierHeight=this.parent.timelineModule.isSingleTier?45:30,this.gantt.chartHeader.topTierCellWidth=e.topTierCellWidth,this.gantt.chartHeader.bottomTierCellWidth=e.bottomTierCellWidth,this.gantt.chartHeader.topTier=t.extend([],[],e.topTierCollection,!0),this.gantt.chartHeader.bottomTier=t.extend([],[],e.bottomTierCollection,!0),this.gantt.chartHeader.width=e.totalTimelineWidth,this.gantt.chartHeader.height=this.gantt.rows.getRow(0).height,this.gantt.timelineStartDate=new Date(e.timelineStartDate.getTime())},e.prototype.processPredecessor=function(){var e=this;(t.isNullOrUndefined(this.exportProps.showPredecessorLines)||this.exportProps.showPredecessorLines)&&(this.parent.pdfExportModule.isPdfExport=!0,this.parent.predecessorModule.createConnectorLinesCollection(),this.parent.updatedConnectorLineCollection.forEach(function(t){var i=e.gantt.predecessor.add();i.parentLeft=t.parentLeft,i.childLeft=t.childLeft,i.parentWidth=t.parentWidth,i.childWidth=t.childWidth,i.parentIndex=t.parentIndex,i.childIndex=t.childIndex,i.rowHeight=t.rowHeight,i.type=t.type,i.milestoneParent=t.milestoneParent,i.milestoneChild=t.milestoneChild,i.parentEndPoint=t.parentEndPoint,i.lineWidth=e.parent.connectorLineWidth>5?P(5):P(e.parent.connectorLineWidth),t.isCritical?i.connectorLineColor=e.ganttStyle.criticalConnectorLineColor:i.connectorLineColor=e.ganttStyle.connectorLineColor,i.connectorLineColor=e.ganttStyle.connectorLineColor,e.gantt.predecessorCollection.push(i)}),this.parent.pdfExportModule.isPdfExport=!1)},e.prototype.processRecordRow=function(e){var t=this;this.colIndex=0,this.row.level=e.level,this.columns.forEach(function(i){t.isColumnVisible(i)&&(t.processRecordCell(e,i,t.row),t.colIndex++)})},e.prototype.processRecordCell=function(e,i,r){var a=r.cells.getCell(this.colIndex),n=this.parent.taskFields,s=e.ganttProperties;"datepickeredit"===i.editType||"datetimepickeredit"===i.editType?a.value=e[i.field]:i.field===n.duration?a.value=this.parent.getDurationString(s.duration,s.durationUnit):i.field===n.resourceInfo?a.value=s.resourceNames:i.field===n.work?a.value=this.parent.getWorkString(s.work,s.workUnit):a.value=t.isNullOrUndefined(e[i.field])?"":e[i.field].toString(),a.isHeaderCell=!1,a.style.padding=new Ci,this.copyStyles(this.ganttStyle.cell,a,r.isParentRow),this.colIndex!==this.parent.treeColumnIndex?a.style.format.alignment=g.PdfTextAlignment[i.textAlign]:a.style.format.paragraphIndent=10*a.row.level;var o={data:e,value:a.value,column:i,style:a.style,cell:a};o.value=this.exportValueFormatter.formatCellValue(o),this.parent.pdfQueryCellInfo&&this.parent.trigger("pdfQueryCellInfo",o),a.value=o.value},e.prototype.processTaskbar=function(){var e=this;this.flatData.forEach(function(i){var r=e.gantt.taskbar.add(),a=i.ganttProperties;r.left=a.left,r.width=a.width,r.left<0&&(r.width=r.width+r.left,r.left=0),r.progress=a.progress,r.isScheduledTask=m(a),m?t.isNullOrUndefined(a.endDate)&&t.isNullOrUndefined(a.duration)?r.unscheduledTaskBy="startDate":t.isNullOrUndefined(a.startDate)&&t.isNullOrUndefined(a.duration)?r.unscheduledTaskBy="endDate":(r.unscheduledTaskBy="duration",r.unscheduleStarteDate=e.parent.dateValidationModule.getValidStartDate(i.ganttProperties),r.unscheduleEndDate=e.parent.dateValidationModule.getValidEndDate(i.ganttProperties)):(r.unscheduleStarteDate=null,r.unscheduleEndDate=null),r.startDate=a.startDate,r.endDate=a.endDate,r.height=e.parent.chartRowsModule.taskBarHeight,r.isMilestone=a.isMilestone,r.milestoneColor=new g.PdfColor(e.ganttStyle.taskbar.milestoneColor),r.isParentTask=i.hasChildRecords,a.isMilestone&&(r.height=a.width),i[e.parent.labelSettings.leftLabel]&&(r.leftTaskLabel.value=i[e.parent.labelSettings.leftLabel].toString()),i[e.parent.labelSettings.rightLabel]&&(r.rightTaskLabel.value=i[e.parent.labelSettings.rightLabel].toString()),i[e.parent.labelSettings.taskLabel]&&(r.taskLabel=i[e.parent.labelSettings.taskLabel].toString());var n=a.isMilestone?Math.floor(e.parent.chartRowsModule.taskBarHeight/2)+33:33;r.rightTaskLabel.left=a.left+a.width+n,r.fontFamily=e.ganttStyle.fontFamily,r.progressWidth=a.progressWidth,r.labelColor=new g.PdfColor(e.ganttStyle.label.fontColor),r.progressFontColor=new g.PdfColor(e.ganttStyle.taskbar.progressFontColor),r.isParentTask?(r.taskColor=new g.PdfColor(e.ganttStyle.taskbar.parentTaskColor),r.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.parentTaskBorderColor),r.progressColor=new g.PdfColor(e.ganttStyle.taskbar.parentProgressColor)):i.isCritical?(r.taskColor=new g.PdfColor(e.ganttStyle.taskbar.criticalTaskColor),r.progressColor=new g.PdfColor(e.ganttStyle.taskbar.criticalProgressColor),r.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.criticalTaskBorderColor)):(r.taskColor=new g.PdfColor(e.ganttStyle.taskbar.taskColor),r.progressColor=new g.PdfColor(e.ganttStyle.taskbar.progressColor),r.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.taskBorderColor)),r.gridLineColor=new g.PdfColor(e.ganttStyle.chartGridLineColor),e.gantt.taskbarCollection.push(r);var s={};s.progressFontColor=r.progressFontColor,s.taskColor=r.taskColor,s.taskBorderColor=r.taskBorderColor,s.progressColor=r.progressColor,s.milestoneColor=r.milestoneColor;var o={taskbar:s,data:i};e.parent.pdfQueryTaskbarInfo&&(e.parent.trigger("pdfQueryTaskbarInfo",o),r.progressFontColor=o.taskbar.progressFontColor,r.taskColor=o.taskbar.taskColor,r.taskBorderColor=o.taskbar.taskBorderColor,r.progressColor=o.taskbar.progressColor,r.milestoneColor=o.taskbar.milestoneColor)})},e.prototype.getHorizontalAlignment=function(e,t){switch(void 0===t&&(t=new g.PdfStringFormat),e){case"Right":t.alignment=g.PdfTextAlignment.Right;break;case"Center":t.alignment=g.PdfTextAlignment.Center;break;case"Justify":t.alignment=g.PdfTextAlignment.Justify;break;case"Left":t.alignment=g.PdfTextAlignment.Left}return t},e.prototype.getVerticalAlignment=function(e,t,i){switch(void 0===t&&(t=new g.PdfStringFormat,t=this.getHorizontalAlignment(i,t)),e){case"Bottom":t.lineAlignment=g.PdfVerticalAlignment.Bottom;break;case"Middle":t.lineAlignment=g.PdfVerticalAlignment.Middle;break;case"Top":t.lineAlignment=g.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.getFont=function(e){if(e.font)return e.font;var i=t.isNullOrUndefined(e.style.fontSize)?9.75:.75*e.style.fontSize,r=t.isNullOrUndefined(e.style.fontFamily)?g.PdfFontFamily.TimesRoman:this.getFontFamily(e.style.fontFamily),a=g.PdfFontStyle.Regular;return!t.isNullOrUndefined(e.style.bold)&&e.style.bold&&(a|=g.PdfFontStyle.Bold),!t.isNullOrUndefined(e.style.italic)&&e.style.italic&&(a|=g.PdfFontStyle.Italic),!t.isNullOrUndefined(e.style.underline)&&e.style.underline&&(a|=g.PdfFontStyle.Underline),!t.isNullOrUndefined(e.style.strikeout)&&e.style.strikeout&&(a|=g.PdfFontStyle.Strikeout),new g.PdfStandardFont(r,i,a)},e.prototype.renderEmptyGantt=function(){var e=this.gantt.rows.addRow();e.cells.getCell(0).isHeaderCell=!1,e.height=P(this.parent.rowHeight),this.copyStyles(this.ganttStyle.columnHeader,e.cells.getCell(0),e.isParentRow);var t=this.columns.length;this.mergeCells(0,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 g.PdfColor(e.fontColor),t.style.backgroundColor=new g.PdfColor(e.backgroundColor),t.style.borderColor=new g.PdfColor(e.borderColor),t.style.fontSize=e.fontSize,t.style.fontStyle=e.fontStyle,t.style.format=Object.assign(new g.PdfStringFormat,e.format),t.style.borders=new Si,t.style.borders.all=new g.PdfPen(t.style.borderColor),t.style.padding=new Ci;var r=0;r=t.isHeaderCell?this.parent.timelineModule.isSingleTier?22.5:30:this.parent.rowHeight/2,t.style.padding.top=r-e.fontSize,t.style.padding.bottom=r-e.fontSize,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 i=[],r=this.pdfDoc.pageSettings.width-82;if(this.totalColumnWidth>this.pdfDoc.pageSettings.width-82?this.gantt.style.allowHorizontalOverflow=!0:r/this.columns.length<i[0]&&(this.gantt.columns.getColumn(0).width=i[0]),this.exportProps.enableFooter||t.isNullOrUndefined(this.exportProps.enableFooter)){var a=new g.RectangleF(0,0,e.pageSettings.width,35),n=new g.PdfPen(this.ganttStyle.chartGridLineColor),s=new g.PdfPageTemplateElement(a),o=new g.PdfSolidBrush(this.ganttStyle.footer.backgroundColor);s.graphics.drawRectangle(n,o,0,0,e.pageSettings.width,35);var l=new g.PdfStandardFont(this.ganttStyle.fontFamily,this.ganttStyle.footer.fontSize,this.ganttStyle.footer.fontStyle);this.ganttStyle.font&&(l=this.ganttStyle.font);var d=new g.PdfSolidBrush(this.ganttStyle.footer.fontColor),h=new g.PdfPageNumberField(l),p=new g.PdfPageCountField(l,d),c=new g.PdfCompositeField(l,d,"Page {0}",h,p);c.stringFormat=this.ganttStyle.footer.format,c.bounds=a,c.draw(s.graphics,new g.PointF(0,0)),e.template.bottom=s}},e}(),qi=function(){function e(e){this.valueFormatter=new r.ValueFormatter(e),this.internationalization=new t.Internationalization(e)}return e.prototype.returnFormattedValue=function(e,i){return!t.isNullOrUndefined(e.value)&&e.value?this.valueFormatter.getFormatFunction(i)(e.value):""},e.prototype.formatCellValue=function(e){if(e.isForeignKey&&(e.value=t.getValue(e.column.foreignKeyValue,r.getForeignData(e.column,{},e.value)[0])),"number"===e.column.type&&void 0!==e.column.format&&""!==e.column.format)return e.value?this.internationalization.getNumberFormat({format:e.column.format})(e.value):"";if("boolean"===e.column.type)return e.value?"true":"false";if("date"!==e.column.type&&"datetime"!==e.column.type&&"time"!==e.column.type||void 0===e.column.format)return(t.isNullOrUndefined(e.column.type)||t.isNullOrUndefined(e.value))&&t.isNullOrUndefined(e.value)?"":e.value.toString();if("string"==typeof e.value&&(e.value=new Date(e.value)),"string"==typeof e.column.format){var i=void 0;return 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)}if(e.column.format instanceof Object&&void 0===e.column.format.type)return e.value.toString();var a=void 0;return a="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,a)},e}(),Gi=function(){return(Gi=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},zi=function(){function e(e){this.leftTaskLabel={},this.rightTaskLabel={},this.startPage=-1,this.endPage=-1,this.parent=e}return e.prototype.add=function(){return new e(this.parent)},e.prototype.GetNextPage=function(e){var t=e.section,i=t.indexOf(e);return i===t.count-1?t.add():t.getPages()[i+1]},e.prototype.drawTaskbar=function(e,i,r,a,n,s){var o=e.graphics,l=!1,d=e.getClientSize();i.y+n>d.height&&(o=(e=this.GetNextPage(e)).graphics,i.y=0,this.parent.pdfExportModule.gantt.enableHeader&&(this.parent.pdfExportModule.gantt.chartHeader.drawPageTimeline(e,i,r),i.y=P(this.parent.timelineModule.isSingleTier?45:60)),l=!0),this.drawLeftLabel(e,i,r,a);var h=new g.PdfStandardFont(this.fontFamily,9,g.PdfFontStyle.Regular);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(h=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var p=new g.PdfSolidBrush(this.progressFontColor),c=new g.PdfStringFormat;c.lineAlignment=g.PdfVerticalAlignment.Middle,c.alignment=g.PdfTextAlignment.Right;var u,f=!1;/^[a-zA-Z]/.test(this.taskLabel)&&(f=!0,c.alignment=g.PdfTextAlignment.Left);var m=-1;if(s.isMilestone)this.drawMilestone(e,i,r,a);else{var y=new g.PdfPen(s.taskBorderColor),D=new g.PdfSolidBrush(s.taskColor),v=new g.PdfPen(s.progressColor),w=new g.PdfSolidBrush(s.progressColor),k=P((this.parent.rowHeight-this.height)/2);m=e.section.indexOf(e);var T=t.isNullOrUndefined(this.unscheduleStarteDate)?this.startDate:this.unscheduleStarteDate,b=t.isNullOrUndefined(this.unscheduleEndDate)?this.endDate:this.unscheduleEndDate;if(r.startDate<=T&&b<=r.endDate)this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0),this.isScheduledTask||"duration"===this.unscheduledTaskBy?(o.drawRectangle(y,D,i.x+P(this.left-a)+.5,i.y+k,P(s.width),P(s.height)),this.isScheduledTask&&(o.drawRectangle(v,w,i.x+P(this.left-a)+.5,i.y+k,P(s.progressWidth),P(s.height)),t.isNullOrUndefined(this.parent.labelSettings.taskLabel)||t.isNullOrUndefined(this.taskLabel)||(u=this.progressWidth,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left-a),i.y+k,P(u),P(this.height),c)))):this.drawUnscheduledTask(o,i,a,k),this.isCompleted=!0,this.startPage=m,this.endPage=m;else if(r.startDate<=T&&r.endDate>=T&&b>=r.endDate){this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0);var S=0;if(f||(this.width=this.width-(r.totalWidth-(this.left-a))),S=r.totalWidth-(this.left-a),this.isScheduledTask||"duration"===this.unscheduledTaskBy){if(o.drawRectangle(y,D,i.x+P(this.left-a)+.5,i.y+k,P(S),P(s.height)),s.width=s.width-S,this.isScheduledTask){var C=0;C=this.progressWidth<=S?this.progressWidth:S,o.drawRectangle(v,w,i.x+P(this.left-a)+.5,i.y+k,P(C),P(s.height)),this.progressWidth-=C,this.parent.labelSettings.taskLabel&&!t.isNullOrUndefined(this.taskLabel)&&(u=C,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left-a),i.y+k,P(u),P(this.height),c))}}else this.drawUnscheduledTask(o,i,a,k);this.left=0,this.isCompleted=!1,this.startPage=m}else if(b<=r.endDate&&r.startDate<=b&&!this.isCompleted)this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0),o.drawRectangle(y,D,i.x+P(s.left+.5),i.y+k,P(s.width),P(s.height)),this.isScheduledTask&&(o.drawRectangle(v,w,i.x+P(s.left+.5),i.y+k,P(s.progressWidth),P(s.height)),t.isNullOrUndefined(this.taskLabel)||(u=this.progressWidth,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left),i.y+k,P(u),P(this.height),c))),this.isCompleted=!0,this.endPage=m;else if(T<r.startDate&&b>r.endDate){if(this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0),o.drawRectangle(y,D,i.x+P(s.left)+.5,i.y+k,P(r.totalWidth),P(s.height)),this.isScheduledTask){C=0;C=this.progressWidth<=r.totalWidth?this.progressWidth:r.totalWidth,o.drawRectangle(v,w,i.x+P(s.left)+.5,i.y+k,P(C),P(s.height)),this.progressWidth-=C,t.isNullOrUndefined(this.taskLabel)||(u=C,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left),i.y+k,P(u),P(this.height),c))}this.isCompleted=!1,this.width-=r.totalWidth}}return this.drawRightLabel(e,i,r,a),l},e.prototype.drawRightLabel=function(e,i,r,a){var n,s=e.graphics,o=(n=this.rightTaskLabel.isLeftCalculated?this.rightTaskLabel.left:P(this.rightTaskLabel.left))-P(a)+i.x;if(r.startPoint<=n&&n<r.endPoint&&!t.isNullOrUndefined(this.rightTaskLabel.value)&&!this.rightTaskLabel.isCompleted){var l=this.getWidth(this.rightTaskLabel.value,r.endPoint-n,15),d=new g.PdfStandardFont(this.fontFamily,9);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(d=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var h=(P(this.parent.rowHeight)-l.actualSize.height)/2,p=new g.PointF(o,i.y+h),c=new g.SizeF(l.actualSize.width,l.actualSize.height),u=new g.RectangleF(p,c),f=new g.PdfStringFormat;if(f.alignment=g.PdfTextAlignment.Right,f.lineAlignment=g.PdfVerticalAlignment.Middle,l.actualSize.width>0){var m=new g.PdfSolidBrush(this.labelColor);s.drawString(l.lines[0].text,d,null,m,u.x,u.y,l.actualSize.width,l.actualSize.height,f),null!==l.remainder?(this.rightTaskLabel.value=l.remainder,this.rightTaskLabel.left=r.endPoint,this.rightTaskLabel.isLeftCalculated=!0):this.rightTaskLabel.isCompleted=!0}else this.rightTaskLabel.left=r.endPoint}},e.prototype.drawLeftLabel=function(e,i,r,a){var n,s=e.graphics;if(!t.isNullOrUndefined(this.leftTaskLabel.value)){var o=0;if(o=this.left,this.leftTaskLabel.isLeftCalculated)n=this.leftTaskLabel.left;else{var l=this.getWidth(this.leftTaskLabel.value,Number.MAX_VALUE,15);n=P(o-(this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33))-l.actualSize.width,this.leftTaskLabel.left=n,this.leftTaskLabel.isLeftCalculated=!0}var d=n-P(a)+i.x;if(r.startPoint<=n&&n<r.endPoint&&!t.isNullOrUndefined(this.leftTaskLabel.value)&&!this.leftTaskLabel.isCompleted){l=this.getWidth(this.leftTaskLabel.value,r.endPoint-n,15);var h=new g.PdfStandardFont(this.fontFamily,9);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(h=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var p=(P(this.parent.rowHeight)-l.actualSize.height)/2,c=new g.PointF(d,i.y+p),u=new g.SizeF(l.actualSize.width,l.actualSize.height),f=new g.RectangleF(c,u),m=new g.PdfStringFormat;if(m.alignment=g.PdfTextAlignment.Right,m.lineAlignment=g.PdfVerticalAlignment.Middle,l.actualSize.width>0){var y=new g.PdfSolidBrush(this.labelColor);s.drawString(l.lines[0].text,h,null,y,f.x,f.y,l.actualSize.width,l.actualSize.height,m),null!==l.remainder?(this.leftTaskLabel.value=l.remainder,this.leftTaskLabel.left=r.endPoint):this.leftTaskLabel.isCompleted=!0}else this.leftTaskLabel.left=r.endPoint}}},e.prototype.getWidth=function(e,i,r){var a=new g.PdfStandardFont(this.fontFamily,9);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(a=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var n=new g.PdfStringLayouter,s=new g.PdfStringFormat;s.alignment=g.PdfTextAlignment.Left,s.wordWrap=g.PdfWordWrapType.Character,s.lineAlignment=g.PdfVerticalAlignment.Middle;return n.layout(e,a,s,new g.SizeF(i,r),!1,new g.SizeF(i,r))},e.prototype.drawUnscheduledTask=function(e,t,i,r){var a=new g.PdfSolidBrush(this.taskColor);e.drawRectangle(a,t.x+P(this.left-i),t.y+r,P(3),P(this.height))},e.prototype.drawMilestone=function(e,t,i,r){if(i.startDate<=this.startDate&&this.startDate<=i.endDate){var a=e.graphics,n=e.section.indexOf(e);this.taskStartPoint=Gi({},t);var s=new g.PdfPen(this.milestoneColor),o=P((this.parent.rowHeight-this.height)/2),l=new g.PdfSolidBrush(this.milestoneColor);a.save();var d=Math.floor(.6*this.parent.chartRowsModule.taskBarHeight);a.translateTransform(t.x+P(this.left-r),t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2),a.rotateTransform(45),a.drawRectangle(s,l,0,0,P(d),P(d)),a.restore(),this.endPage=this.startPage=n}},e}(),_i=function(){function e(e){this.width=0,this.gantt=e,this.parent=e.parent,this.topTierPoint=new g.PointF,this.bottomTierPoint=new g.PointF,this.topTierIndex=0,this.bottomTierIndex=0,this.prevTopTierIndex=0,this.prevBottomTierIndex=0}return e.prototype.drawTimeline=function(e,t,i){var r=Math.floor(i.totalWidth),a=0;for(this.topTierPoint.x=t.x,this.topTierPoint.y=t.y,this.prevTopTierIndex=this.topTierIndex,this.prevBottomTierIndex=this.bottomTierIndex;r>0;){var n=this.topTier[this.topTierIndex];if(this.topTier.length>this.topTierIndex){var s=!1;this.topTier[this.topTierIndex].isFinished||(r>=n.width?(a=n.width,n.isFinished=!0,n.completedWidth=a,s=!0):(a=r,s=!1,n.isFinished=!1,n.width=n.width-r,n.completedWidth=a)),this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,a,n.value,!0),this.topTierPoint.x+=P(a),r-=a,s&&this.topTierIndex++}else r=0}r=Math.floor(i.totalWidth);var o=this.parent.timelineModule.isSingleTier?0:this.topTierHeight;for(this.bottomTierPoint=new g.PointF(t.x,P(t.y+o));r>0;){var l=this.bottomTier[this.bottomTierIndex];if(this.bottomTier.length>this.bottomTierIndex){s=!0;var d=l.width;r<d&&(d=r,s=!1,l.completedWidth=d),this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,d,l.value,!1),this.bottomTierPoint.x=this.bottomTierPoint.x+P(d),r-=d,l.completedWidth=d,s&&this.bottomTierIndex++}else r=0}},e.prototype.drawPageTimeline=function(e,i,r){this.topTierPoint=t.extend({},{},i,!0);for(var a=this.prevTopTierIndex;a<=this.topTierIndex;a++)if(this.topTier.length>a){var n=this.topTier[a];n.completedWidth>0&&(this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,n.completedWidth,n.value,!0),this.topTierPoint.x+=P(n.completedWidth))}this.bottomTierPoint.x=i.x,this.bottomTierPoint.y=P(i.y+this.topTierHeight);for(a=this.prevBottomTierIndex;a<=this.bottomTierIndex;a++)if(this.bottomTier.length>a){var s=this.bottomTier[a];s.completedWidth>0&&(this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,s.width,s.value,!1),this.bottomTierPoint.x=this.bottomTierPoint.x+P(s.width))}},e.prototype.triggerQueryTimelinecell=function(e,i,r,a,n,s,o){var l=e.graphics,d={},h=this.gantt.ganttStyle;d.borderColor=new g.PdfColor(h.timeline.borderColor),d.fontColor=new g.PdfColor(h.timeline.fontColor),d.fontSize=h.timeline.fontSize,d.fontStyle=h.timeline.fontStyle,d.backgroundColor=new g.PdfColor(h.timeline.backgroundColor),h.timeline.padding&&(d.padding=h.timeline.padding);var p=new g.PdfStringFormat;t.isNullOrUndefined(h.timeline.format)?o?(p.lineAlignment=g.PdfVerticalAlignment.Middle,p.alignment=g.PdfTextAlignment.Left):(p.lineAlignment=g.PdfVerticalAlignment.Middle,p.alignment=g.PdfTextAlignment.Center,p.wordWrap=g.PdfWordWrapType.Character):p=h.timeline.format,d.format=p;var c={timelineCell:d,value:s};this.parent.pdfQueryTimelineCellInfo&&this.parent.trigger("pdfQueryTimelineCellInfo",c);var u=c.timelineCell,f=new g.PdfPen(c.timelineCell.borderColor),m=new g.PdfSolidBrush(c.timelineCell.backgroundColor);l.drawRectangle(f,m,i,r,P(n),P(a));var y=new g.PdfStandardFont(h.fontFamily,u.fontSize,u.fontStyle);h.font&&(y=h.font);var D=new g.PdfSolidBrush(c.timelineCell.fontColor),v=h.timeline.padding?c.timelineCell.padding.left:0,w=h.timeline.padding?c.timelineCell.padding.top:0;l.drawString(c.value,y,null,D,i+v,r+w,P(n),P(a),u.format)},e}(),Xi=function(){return(Xi=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},Yi=function(){function e(e,t){this.parent=e,this.pdfGantt=t}return e.prototype.add=function(){return new e(this.parent)},e.prototype.findindex=function(e){var t;return this.parent.currentViewData.map(function(i,r){i.index==e&&(t=r)}),t},e.prototype.drawPredecessor=function(e){this.pdfGantt=e;var t,i,r=e.result.page.section.getPages(),a=e.taskbarCollection[this.findindex(this.parentIndex)],n=e.taskbarCollection[this.findindex(this.childIndex)],s=new g.PdfPage,o=new g.PdfPage,l="",d=0,h=0;switch(this.type){case"FS":if(!(n.startPage>-1&&a.endPage>-1))return;s=r[a.endPage],o=r[n.startPage],t=e.pdfPageDetail[a.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.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(!(n.endPage>-1&&a.startPage>-1))return;s=r[a.startPage],o=r[n.endPage],t=e.pdfPageDetail[a.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.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(!(n.endPage>-1&&a.endPage>-1))return;s=r[a.endPage],o=r[n.endPage],t=e.pdfPageDetail[a.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.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(!(n.startPage>-1&&a.startPage>-1))return;s=r[a.startPage],o=r[n.startPage],t=e.pdfPageDetail[a.startPage-e.chartPageIndex],i=e.pdfPageDetail[n.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft>=this.childLeft?"SSType1":"SSType2":this.parentLeft>=this.childLeft?"SSType3":"SSType4"}var p=Math.round((this.parent.rowHeight-1)/2);p=P(p);var c,u,f,m,y,D;c=u=f=m=y=D=new g.PointF;var v=Xi({},a.taskStartPoint),w=Xi({},n.taskStartPoint);d=v.y+t.startPoint.y,h=w.y+i.startPoint.y;var k=new g.PointF(P(this.parentLeft+this.parentWidth),d+p),T=new g.PointF(P(this.parentLeft)-1,d+p),b=new g.PointF(P(this.childLeft-20),h+p),S=new g.PointF(P(this.childLeft-6-this.lineWidth)-1,h+p),C=new g.PointF(P(this.childLeft+this.childWidth+6+this.lineWidth)+1,h+p);switch(l){case"FSType1":case"FSType3":c=k,u=new g.PointF(P(this.childLeft-20),d+p),f=b,m=S,this.connectLines(s,o,c,u,f,m,n,p);break;case"FSType2":c=k,u=new g.PointF(c.x+10,d+p),f=new g.PointF(c.x+10,h+2),m=new g.PointF(P(this.childLeft-20),h+2),y=b,D=S,this.connectLines(s,o,c,u,f,m,n,p,y,D);break;case"FSType4":c=k,u=new g.PointF(c.x+10,d+p),f=new g.PointF(c.x+10,d+2),m=new g.PointF(P(this.childLeft-20),d+2),y=b,D=S,this.connectLines(s,o,c,u,f,m,n,p,y,D);break;case"FFType1":case"FFType3":c=new g.PointF(P(this.parentLeft+this.parentWidth)+1,d+p),u=new g.PointF(P(this.childLeft+this.childWidth+20),d+p),f=new g.PointF(u.x,h+p),m=C,this.connectLines(s,o,c,u,f,m,n,p);break;case"FFType2":case"FFType4":c=new g.PointF(P(this.parentLeft+this.parentWidth)+1,d+p),u=new g.PointF(P(this.parentLeft+this.parentWidth+20),d+p),f=new g.PointF(u.x,h+p),m=C,this.connectLines(s,o,c,u,f,m,n,p);break;case"SSType1":case"SSType3":c=T,u=new g.PointF(P(this.childLeft-20),d+p),f=new g.PointF(u.x,h+p),m=S,this.connectLines(s,o,c,u,f,m,n,p);break;case"SSType2":case"SSType4":c=T,u=new g.PointF(P(this.parentLeft-20),d+p),f=new g.PointF(u.x,h+p),m=S,this.connectLines(s,o,c,u,f,m,n,p);break;case"SFType1":case"SFType3":c=T,u=new g.PointF(P(this.childLeft+this.childWidth+20),d+p),f=new g.PointF(u.x,h+p),m=C,this.connectLines(s,o,c,u,f,m,n,p);break;case"SFType2":c=T,u=new g.PointF(P(this.parentLeft-20),d+p),f=new g.PointF(u.x,h+2),m=new g.PointF(P(this.childLeft+this.childWidth+20),h+2),y=new g.PointF(m.x,h+p),D=C,this.connectLines(s,o,c,u,f,m,n,p,y,D);break;case"SFType4":c=T,u=new g.PointF(P(this.parentLeft-20),d+p),f=new g.PointF(u.x,d+2),m=new g.PointF(P(this.childLeft+this.childWidth+20),d+2),y=new g.PointF(m.x,h+p),D=C,this.connectLines(s,o,c,u,f,m,n,p,y,D)}},e.prototype.connectLines=function(e,i,r,a,n,s,o,l,d,h){this.drawLine(e,r,a),this.drawLine(e,a,n),this.drawLine(e,n,s),t.isNullOrUndefined(d)||t.isNullOrUndefined(h)||(this.drawLine(e,s,d),this.drawLine(e,d,h)),this.drawArrow(i,o,l)},e.prototype.contains=function(e,t,i){return e.x<=t&&t<e.x+e.width&&e.y<=i&&i<e.y+e.height},e.prototype.findPageIndex=function(e){for(var t=-1,i=0;i<this.pdfGantt.pdfPageDetail.length;i++){var r=this.pdfGantt.pdfPageDetail[i],a=new g.RectangleF(r.startPoint.x,r.startPoint.y,r.width,r.height);if(this.contains(a,e.x,e.y)){t=i;break}}return t},e.prototype.drawLine=function(e,t,i){var r=this.pdfGantt.result.page.section.getPages(),a=e.graphics,n=Xi({},i),s=Xi({},i),o=Xi({},i),l=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],d=new g.RectangleF(l.startPoint.x,l.startPoint.y,l.width,l.height),h=this.contains(d,t.x,t.y),p=this.contains(d,i.x,i.y),c=-1;if(t=new g.PointF(t.x,t.y),i=new g.PointF(i.x,i.y),!h&&!p||p&&!h)(c=this.findPageIndex(t))>-1&&(l=this.pdfGantt.pdfPageDetail[c],s=t,n=i,this.drawLine(r[c+this.pdfGantt.chartPageIndex],s,n));else if(!p&&h){var u=d.x,f=d.x+d.width,m=d.y+d.height,y=d.y;u>i.x?(o.x=i.x=u-1,s.x=u-1):f<i.x?(o.x=i.x=f,s.x=f,o.x+=1):m<i.y?(o.y=i.y=m,s.y=m,o.y+=1,this.pdfGantt.enableHeader&&(s.y+=this.parent.timelineModule.isSingleTier?P(45):P(62))):y>i.y&&(s.y=o.y=y-1,i.y=y,this.pdfGantt.enableHeader&&(o.y+=this.parent.timelineModule.isSingleTier?P(45):P(62),i.y+=this.parent.timelineModule.isSingleTier?P(45):P(62))),-1!==(c=this.findPageIndex(o))&&this.drawLine(r[c+this.pdfGantt.chartPageIndex],s,n)}if(h){t=new g.PointF(t.x,t.y),i=new g.PointF(i.x,i.y),t.x=t.x+l.pageStartX-l.startPoint.x,t.y=t.y-l.startPoint.y,i.x=i.x+l.pageStartX-l.startPoint.x,i.y=i.y-l.startPoint.y;var D=new g.PdfSolidBrush(this.connectorLineColor),v=new g.PdfPen(D,P(this.lineWidth));a.drawLine(v,t,i)}},e.prototype.drawArrow=function(e,t,i){var r,a=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],n=new g.RectangleF(new g.PointF(a.startPoint.x,a.startPoint.y),new g.SizeF(a.width,a.height)),s=new g.PointF,o=e.section.getPages(),l=6+this.lineWidth;s="FS"===this.type||"SS"===this.type?new g.PointF(P(this.childLeft)-1,t.taskStartPoint.y+a.startPoint.y):new g.PointF(P(this.childLeft+this.childWidth)+1,t.taskStartPoint.y+a.startPoint.y);if(!this.contains(n,s.x,s.y)){var d=this.findPageIndex(s);d>-1&&(a=this.pdfGantt.pdfPageDetail[d],e=o[d+this.pdfGantt.chartPageIndex])}var h=e.graphics;s.x=s.x-a.startPoint.x+a.pageStartX,s.y=s.y-a.startPoint.y;var p=new g.PointF(s.x,s.y+i);r="FS"===this.type||"SS"===this.type?new g.PointF(p.x-P(l),p.y-P(l)):new g.PointF(p.x+P(l),p.y-P(l));var c=new g.PointF(r.x,r.y+P(2*l)),u=new g.PdfSolidBrush(this.connectorLineColor),f=new g.PdfPen(u,P(this.lineWidth));h.drawLine(f,p,r),h.drawLine(f,r,c),h.drawLine(f,c,p)},e}(),Zi=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qi=function(){return(Qi=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},Ki=function(e){function i(t){var i=e.call(this)||this;return i.exportProps={},i.parent=t,i.chartHeader=new _i(i),i.predecessor=new Yi(t,i),i.headerDetails=[],i.pdfPageDetail=[],i.taskbarCollection=[],i.predecessorCollection=[],i}return Zi(i,e),Object.defineProperty(i.prototype,"taskbar",{get:function(){return t.isNullOrUndefined(this.taskbars)&&(this.taskbars=new zi(this.parent)),this.taskbars},enumerable:!0,configurable:!0}),i.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()},i.prototype.calculateRange=function(){for(var e=this.layouter.columnRanges[this.layouter.columnRanges.length-1],i=0,r=!0,a=0,n=0,s=0,o=P(this.chartHeader.width),l=this.parent.timelineModule,d=e[0];d<=e[1];d++)i+=this.layouter.treegrid.columns.getColumn(d).width;for((i+=.5)+100<this.result.page.getClientSize().width?(n=this.result.page.getClientSize().width-i,this.chartPageIndex=this.startPageIndex=this.totalPages-this.perColumnPages,r=!1,this.startPoint=new g.PointF(i,0)):(this.result.page.section.add(),this.chartPageIndex=this.startPageIndex=this.totalPages,r=!0,this.startPoint=new g.PointF(s,0));Math.round(s)<Math.round(o);){r?a=this.result.page.getClientSize().width:(a=n,r=!0);var h={},p=[],c=P(this.chartHeader.bottomTierCellWidth),u=0;0!==this.chartHeader.bottomTierCellWidth&&(u=Math.floor(a/c)*c),p[0]=s,o-s<=u?(p[1]=o,h.totalWidth=S(o-s)):(p[1]=s+u,h.totalWidth=S(u)),h.startPoint=p[0],h.endPoint=p[1],0===this.parent.cloneProjectStartDate.getHours()&&0===this.parent.cloneProjectStartDate.getMinutes()&&0===this.parent.cloneProjectStartDate.getSeconds()&&this.parent.cloneProjectStartDate.setHours(8);var f=this.parent.dataOperation.getDateFromFormat(this.parent.timelineModule.timelineStartDate),m=t.isNullOrUndefined(l.customTimelineSettings.bottomTier.count)?l.customTimelineSettings.topTier.count:l.customTimelineSettings.bottomTier.count;switch("None"===l.customTimelineSettings.bottomTier.unit?l.customTimelineSettings.topTier.unit:l.customTimelineSettings.bottomTier.unit){case"Minutes":h.startDate=new Date(f.getTime());var y=Math.floor(S(h.startPoint)/this.chartHeader.bottomTierCellWidth);h.startDate.setMinutes(h.startDate.getMinutes()+y*m),h.startDate.setSeconds(h.startDate.getSeconds()+1),h.endDate=new Date(h.startDate.getTime());var D=Math.floor(S(h.endPoint-h.startPoint)/this.chartHeader.bottomTierCellWidth);h.endDate.setMinutes(h.endDate.getMinutes()+D*m);break;case"Hour":h.startDate=new Date(f.getTime());var v=Math.floor(S(h.startPoint)/this.chartHeader.bottomTierCellWidth);h.startDate.setHours(h.startDate.getHours()+v*m),h.startDate.setMinutes(h.startDate.getMinutes()+1),h.endDate=new Date(h.startDate.getTime());var w=Math.floor(S(h.endPoint-h.startPoint)/this.chartHeader.bottomTierCellWidth);h.endDate.setHours(h.endDate.getHours()+w*m);break;case"Day":h.startDate=new Date(f.getTime());var k=Math.round(h.startPoint/P(this.chartHeader.bottomTierCellWidth));h.startDate.setDate(h.startDate.getDate()+k*m);var T=Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+T*m);break;case"Week":h.startDate=new Date(f.getTime());var b=h.startPoint/P(this.chartHeader.bottomTierCellWidth)*7;h.startDate.setDate(h.startDate.getDate()+b*m);var C=7*Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+C*m);break;case"Month":h.startDate=new Date(f.getTime());var M=h.startPoint/P(this.chartHeader.bottomTierCellWidth)*31;h.startDate.setDate(h.startDate.getDate()+M*m);var R=31*Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+R*m);break;case"Year":h.startDate=new Date(f.getTime());var O=h.startPoint/P(this.chartHeader.bottomTierCellWidth)*365;h.startDate.setDate(h.startDate.getDate()+O*m);var x=365*Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+x*m)}this.headerDetails.push(h),s+=u}},i.prototype.drawPageBorder=function(){for(var e=this.result.page.section.getPages(),t=0;t<e.length;t++){var i=e[t],r=i.graphics,a=i.getClientSize(),n=new g.PdfPen(new g.PdfColor(206,206,206));r.drawRectangle(n,0,0,a.width,a.height)}},i.prototype.drawGantttChart=function(){var e,t=this,i=this.startPoint,r=new g.PointF,a=0,n=0,s=0;this.headerDetails.forEach(function(o,l){var d=t.result.page.section.getPages()[t.startPageIndex];t.chartHeader.drawTimeline(d,t.startPoint,o),i.y=i.y+P(t.parent.timelineModule.isSingleTier?45:60),a=i.x,s=P(t.parent.timelineModule.isSingleTier?45:60),t.headerDetails[t.headerDetails.indexOf(o)].startIndex=t.startPageIndex,t.headerDetails[t.headerDetails.indexOf(o)].pageStartPoint=i;for(var h=0;h<t.taskbarCollection.length;h++){var p=t.taskbarCollection[h],c=t.rows.getRow(h+1).height,u=t.result.page.section.getPages()[t.startPageIndex];p.drawTaskbar(u,i,o,n,c,t.taskbarCollection[h])&&(t.enableHeader?i.y=P(t.parent.timelineModule.isSingleTier?45:60):i.y=0,t.startPageIndex++,(e={}).height=s,e.pageStartX=a,e.startPoint=Qi({},r),e.width=P(o.totalWidth),t.pdfPageDetail.push(e),r.y+=e.height,t.enableHeader?s=t.chartHeader.height:(i.y=0,s=0)),i.y+=c,s+=c}t.headerDetails[l].endIndex=t.startPageIndex,n+=o.totalWidth,(e={}).height=s,e.pageStartX=a,e.startPoint=Qi({},r),e.width=P(o.totalWidth),t.pdfPageDetail.push(e),r.x+=e.width,r.y=0,t.enableHeader?s=t.chartHeader.height:i.y=0,t.headerDetails.indexOf(o)!==t.headerDetails.length-1&&(t.result.page.section.add(),t.startPageIndex=t.result.page.section.count-1,i=t.startPoint=new g.PointF(0,0))});for(var o=0;o<this.predecessorCollection.length;o++){this.predecessorCollection[o].drawPredecessor(this)}},i}(Fi),Ji=function(){function e(e){this.isPdfExport=!1,this.parent=e,this.helper=new Wi(this.parent),this.pdfDocument=void 0}return e.prototype.getModuleName=function(){return"pdfExport"},e.prototype.destroy=function(){},e.prototype.initGantt=function(){this.pdfDocument=void 0,this.gantt=new Ki(this.parent)},e.prototype.export=function(e,i,r,a){var n=this;this.isBlob=a;var s={requestType:"beforePdfExport",ganttObject:this.parent,cancel:!1};return this.parent.trigger("beforePdfExport",s),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),t.getValue("cancel",s)?new Promise(function(e,t){return e()}):new Promise(function(t,a){n.exportWithData(r,t,e,i)})},e.prototype.exportWithData=function(e,i,r,a){var n=this,s=[];t.isNullOrUndefined(r)&&(r={}),s="CurrentViewData"===r.exportType?this.parent.currentViewData:this.parent.flatData,this.initGantt(),t.isNullOrUndefined(e)?this.pdfDocument=new g.PdfDocument:this.pdfDocument=e,this.processExport(s,r,a).then(function(){n.parent.trigger("pdfExportComplete",n.isBlob?{promise:n.blobPromise}:{}),t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.hideSpinner():n.parent.hideMaskRow(),i(n.pdfDocument)})},e.prototype.processExport=function(e,i,r){var a=this,n=this.pdfDocument.sections.add();this.processSectionExportProperties(n,i);var s=n.pages.add();return new Promise(function(t,r){a.helper.processGridExport(e,a.gantt,i),a.helper.initializePdf(a.pdfDocument),t()}).then(function(){var e=new Ei;e.break=g.PdfLayoutBreakType.FitElement;var n=a.gantt.drawGrid(s,0,0,e);return a.gantt.drawChart(n),r||(a.isBlob?a.blobPromise=a.pdfDocument.save():!t.isNullOrUndefined(i)&&i.fileName?a.pdfDocument.save(i.fileName):a.pdfDocument.save("Export.pdf"),a.pdfDocument.destroy()),a.pdfDocument})},e.prototype.processSectionExportProperties=function(e,i){if(t.isNullOrUndefined(i))this.gantt.ganttStyle=new bi(i.theme).style;else{var r=new g.PdfPageSettings;if(t.isNullOrUndefined(i.pageOrientation)||"Portrait"!==i.pageOrientation?r.orientation=g.PdfPageOrientation.Landscape:r.orientation=g.PdfPageOrientation.Portrait,t.isNullOrUndefined(i.pageSize)||(r.size=this.getPageSize(i.pageSize)),e.setPageSettings(r),t.isNullOrUndefined(i.ganttStyle))this.gantt.ganttStyle=new bi(i.theme).style;else{var a=new bi(i.theme).style;this.gantt.ganttStyle=t.extend({},a,i.ganttStyle,!0)}}},e.prototype.getPageSize=function(e){switch(e){case"Letter":return new g.SizeF(612,792);case"Note":return new g.SizeF(540,720);case"Legal":return new g.SizeF(612,1008);case"A0":return new g.SizeF(2380,3368);case"A1":return new g.SizeF(1684,2380);case"A2":return new g.SizeF(1190,1684);case"A3":return new g.SizeF(842,1190);case"A5":return new g.SizeF(421,595);case"A6":return new g.SizeF(297,421);case"A7":return new g.SizeF(210,297);case"A8":return new g.SizeF(148,210);case"A9":return new g.SizeF(105,148);case"B0":return new g.SizeF(2836,4008);case"B1":return new g.SizeF(2004,2836);case"B2":return new g.SizeF(1418,2004);case"B3":return new g.SizeF(1002,1418);case"B4":return new g.SizeF(709,1002);case"B5":return new g.SizeF(501,709);case"Archa":return new g.SizeF(648,864);case"Archb":return new g.SizeF(864,1296);case"Archc":return new g.SizeF(1296,1728);case"Archd":return new g.SizeF(1728,2592);case"Arche":return new g.SizeF(2592,3456);case"Flsa":return new g.SizeF(612,936);case"HalfLetter":return new g.SizeF(396,612);case"Letter11x17":return new g.SizeF(792,1224);case"Ledger":return new g.SizeF(1224,792);default:return new g.SizeF(595,842)}},e}(),$i=function(){function e(e){this.parent=e,this.bindTreeGridProperties()}return e.prototype.getModuleName=function(){return"virtualScroll"},e.prototype.bindTreeGridProperties=function(){this.parent.treeGrid.enableVirtualization=this.parent.enableVirtualization,n.TreeGrid.Inject(n.VirtualScroll)},e.prototype.getTopPosition=function(){var e,t=this.parent.ganttChartModule.scrollElement.querySelector(".e-virtualtable"),i=t.style.transform.split(",");if(i.length>1)e=i[1].trim().split(")")[0];else{var r=t.style.transform;e=r.substring(r.lastIndexOf("(")+1,r.lastIndexOf(")"))}return parseFloat(e)},e.prototype.destroy=function(){},e}();e.Gantt=ei,e.parentsUntil=f,e.isScheduledTask=m,e.isCountRequired=y,e.getSwapKey=D,e.isRemoteData=v,e.getTaskData=w,e.updateDates=k,e.formatString=T,e.getIndex=b,e.pixelToPoint=P,e.pointToPixel=S,e.getUid=C,e.load="load",e.rowDataBound="rowDataBound",e.queryCellInfo="queryCellInfo",e.toolbarClick="toolbarClick",e.keyPressed="key-pressed",e.Edit=li,e.Reorder=di,e.Resize=hi,e.Filter=pi,e.Sort=ci,e.Dependency=Xt,e.Selection=ui,e.Toolbar=gi,e.DayMarkers=yi,e.CriticalPath=Di,e.ContextMenu=vi,e.ExcelExport=wi,e.ColumnMenu=ki,e.RowDD=Ti,e.PdfExport=Ji,e.VirtualScroll=$i,e.Column=Ge,e.DayWorkingTime=Ye,e.AddDialogFieldSettings=Ke,e.EditDialogFieldSettings=et,e.EditSettings=rt,e.EventMarker=st,e.FilterSettings=dt,e.SearchSettings=ct,e.Holiday=ft,e.LabelSettings=Dt,e.SelectionSettings=kt,e.SplitterSettings=Pt,e.TaskFields=Mt,e.TimelineTierSettings=xt,e.TimelineSettings=It,e.TooltipSettings=Ft,e.SortDescriptor=Lt,e.SortSettings=Bt,e.ResourceFields=jt,e.LoadingIndicator=Gt,e.TemporaryDictionary=Pi,e.PdfBorders=Si,e.PdfPaddings=Ci,e.PdfTreeGridStyleBase=Mi,e.PdfTreeGridStyle=Ri,e.PdfGanttTheme=bi,e.PdfTreeGridLayouter=xi,e.PdfTreeGridLayoutResult=Ii,e.PdfTreeGridLayoutFormat=Ei,e.PdfTreeGridCell=Ui,e.PdfTreeGridCellCollection=Vi,e.PdfTreeGridRow=Li,e.PdfTreeGridRowCollection=Bi,e.PdfTreeGridHeaderCollection=Ai,e.PdfTreeGridColumn=Hi,e.PdfTreeGridColumnCollection=ji,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-grids"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-treegrid"),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-dropdowns"),require("@syncfusion/ej2-pdf-export")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-popups","@syncfusion/ej2-grids","@syncfusion/ej2-data","@syncfusion/ej2-treegrid","@syncfusion/ej2-svg-base","@syncfusion/ej2-layouts","@syncfusion/ej2-navigations","@syncfusion/ej2-richtexteditor","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-calendars","@syncfusion/ej2-dropdowns","@syncfusion/ej2-pdf-export"],t):t(e.ej={},e.ej2Base,e.ej2Popups,e.ej2Grids,e.ej2Data,e.ej2Treegrid,e.ej2SvgBase,e.ej2Layouts,e.ej2Navigations,e.ej2Richtexteditor,e.ej2Inputs,e.ej2Buttons,e.ej2Calendars,e.ej2Dropdowns,e.ej2PdfExport)}(this,function(e,t,i,r,a,n,s,o,l,d,h,p,c,u,g){"use strict";function f(e,t,i){for(var r=e;r&&(i?r.id!==t:!r.classList.contains(t));)r=r.parentElement;return r}function m(e){return t.isNullOrUndefined(e.startDate)&&t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.duration)?null:!(t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration))}function y(e){return!(!e.dataSource||e.dataSource instanceof a.DataManager||!("result"in e.dataSource))}function D(e){for(var t={},i=0,r=Object.keys(e);i<r.length;i++){var a=r[i];t[e[a]]=a}return t}function v(e){if(e instanceof a.DataManager){var t=e.adaptor;return t instanceof a.ODataAdaptor||t instanceof a.ODataV4Adaptor||t instanceof a.WebApiAdaptor||t instanceof a.WebMethodAdaptor||t instanceof a.CacheAdaptor||t instanceof a.RemoteSaveAdaptor||t instanceof a.UrlAdaptor}return!1}function w(e,i,r,a){if(r){for(var n=void 0,s=0;s<e.length;s++){var o=void 0;n=o=i?e[s].taskData:t.extend({},e[s].taskData,{},!0)}return n}for(n=[],s=0;s<e.length;s++){o=void 0;!t.isNullOrUndefined(a)&&a.timezone&&k(e[s],a),o=i?e[s].taskData:t.extend({},e[s].taskData,{},!0),n.push(o)}return n}function k(e,t){return 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 T(e,t){for(var i,r=0;r<t.length;r++)i=new RegExp("\\{"+r+"\\}","gm"),e=e.replace(i,t[r].toString());return e}function b(e,i,r,a){for(var n=-1,s=0;s<r.length;s++)if(t.getValue(i,r[s])===t.getValue(i,e)&&t.isNullOrUndefined(a)||!t.isNullOrUndefined(a)&&t.getValue(i,r[s])===t.getValue(i,e)&&t.getValue(a,r[s])===t.getValue(a,e)){n=s;break}return n}function P(e){return 76*e/92}function S(e){return 92*e/76}function C(){return M++}var M=0,R=function(){function e(e){this.parent=e}return e.prototype.isValidateNonWorkDays=function(e){return!t.isNullOrUndefined(e)&&e.isAutoSchedule&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)||t.isNullOrUndefined(e)&&(!this.parent.includeWeekend||this.parent.totalHolidayDates.length>0)},e.prototype.checkStartDate=function(e,i,r,a){if(t.isNullOrUndefined(e))return null;var n=new Date(e.getTime()),s=this.getSecondsInDecimal(n);if(r=t.isNullOrUndefined(r)?!t.isNullOrUndefined(i)&&i.isMilestone:r,s<this.parent.defaultStartTime&&(!r||a))this.setTime(this.parent.defaultStartTime,n);else if(s<this.parent.defaultStartTime&&r)this.setTime(this.parent.defaultStartTime,n);else if(s===this.parent.defaultEndTime&&(!i||!r)||s>this.parent.defaultEndTime)n.setDate(n.getDate()+1),this.setTime(this.parent.defaultStartTime,n);else if(s>this.parent.defaultStartTime&&s<this.parent.defaultEndTime)for(var o=0;o<this.parent.workingTimeRanges.length;o++){var l=this.parent.workingTimeRanges[o];if(s>=l.to&&this.parent.workingTimeRanges[o+1]&&s<this.parent.workingTimeRanges[o+1].from){(s!==l.to||i&&r)&&s===l.to||this.setTime(this.parent.workingTimeRanges[o+1].from,n);break}}var d;if(this.parent.autoCalculateDateScheduling){do{d=new Date(n.getTime());var h=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)){var p=!r||a?this.parent.defaultStartTime:this.parent.defaultEndTime;if(!this.parent.includeWeekend){var c=new Date(n.getTime());n=this.getNextWorkingDay(n),c.getTime()!==n.getTime()&&this.setTime(p,n)}for(var u=0;u<h;u++){var g=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[u])),f=new Date(g.getTime());g.setHours(0,0,0,0),f.setHours(23,59,59,59),n.getTime()>=g.getTime()&&n.getTime()<f.getTime()&&(n.setDate(n.getDate()+1),this.setTime(p,n))}}}while(d.getTime()!==n.getTime());return new Date(n.getTime())}return new Date(n.getTime())},e.prototype.checkEndDate=function(e,i,r){if(t.isNullOrUndefined(e))return null;var a=new Date(e.getTime()),n=this.getSecondsInDecimal(a);if(n>this.parent.defaultEndTime)this.setTime(this.parent.defaultEndTime,a);else if(n<=this.parent.defaultStartTime&&!r)a.setDate(a.getDate()-1),this.setTime(this.parent.defaultEndTime,a);else if(n>this.parent.defaultStartTime&&n<this.parent.defaultEndTime)for(var s=0;s<this.parent.workingTimeRanges.length;s++){if(n>this.parent.workingTimeRanges[s].to&&this.parent.workingTimeRanges[s+1]&&n<=this.parent.workingTimeRanges[s+1].from){this.setTime(this.parent.workingTimeRanges[s].to,a);break}}var o;if(this.parent.autoCalculateDateScheduling){do{o=new Date(a.getTime());var l=this.parent.totalHolidayDates.length;if(this.isValidateNonWorkDays(i)){if(!this.parent.includeWeekend){var d=new Date(a.getTime());a=this.getPreviousWorkingDay(a),d.getTime()!==a.getTime()&&this.setTime(this.parent.defaultEndTime,a)}for(var h=0;h<l;h++){var p=this.getDateFromFormat(new Date(this.parent.totalHolidayDates[h])),c=new Date(p.getTime()),u=new Date(a.getTime());u.setMinutes(a.getMilliseconds()-2),p.setHours(0,0,0,0),c.setHours(23,59,59,59),(a.getTime()>=p.getTime()&&a.getTime()<c.getTime()||u.getTime()>=p.getTime()&&u.getTime()<c.getTime())&&(a.setDate(a.getDate()-1),a.getTime()===p.getTime()&&86400===this.parent.defaultEndTime&&0===this.getSecondsInDecimal(a)||this.setTime(this.parent.defaultEndTime,a))}}}while(o.getTime()!==a.getTime());return new Date(a.getTime())}return t.isNullOrUndefined(a)||this.setTime(this.parent.defaultEndTime,a),new Date(a.getTime())},e.prototype.checkBaselineStartDate=function(e){if(t.isNullOrUndefined(e))return null;var i=new Date(e.getTime()),r=this.getSecondsInDecimal(i);if(r<this.parent.defaultStartTime)this.setTime(this.parent.defaultStartTime,i);else if(r>this.parent.defaultEndTime)i.setDate(i.getDate()+1),this.setTime(this.parent.defaultStartTime,i);else if(r>this.parent.defaultStartTime&&r<this.parent.defaultEndTime)for(var a=0;a<this.parent.workingTimeRanges.length;a++){if(r>this.parent.workingTimeRanges[a].to&&this.parent.workingTimeRanges[a+1]&&r<this.parent.workingTimeRanges[a+1].from){this.setTime(this.parent.workingTimeRanges[a+1].from,i);break}}return i},e.prototype.checkBaselineEndDate=function(e,i){if(t.isNullOrUndefined(e))return null;var r=new Date(e.getTime()),a=this.getSecondsInDecimal(r);if(a>this.parent.defaultEndTime)this.setTime(this.parent.defaultEndTime,r);else if(a<this.parent.defaultStartTime&&!t.isNullOrUndefined(i)&&!i.isMilestone)r.setDate(r.getDate()-1),this.setTime(this.parent.defaultEndTime,r);else if(a>this.parent.defaultStartTime&&a<this.parent.defaultEndTime)for(var n=0;n<this.parent.workingTimeRanges.length;n++){if(a>this.parent.workingTimeRanges[n].to&&this.parent.workingTimeRanges[n+1]&&a<=this.parent.workingTimeRanges[n+1].from){this.setTime(this.parent.workingTimeRanges[n].to,r);break}}return i&&i.baselineStartDate&&r&&i.baselineStartDate.getTime()>r.getTime()&&r.setDate(r.getDate()+1),r},e.prototype.calculateStartDate=function(e){var i=e.ganttProperties,r=null;t.isNullOrUndefined(i.endDate)||t.isNullOrUndefined(i.duration)||(r=this.getStartDate(i.endDate,i.duration,i.durationUnit,i)),this.parent.setRecordValue("startDate",r,i,!0),this.parent.taskFields.startDate&&this.parent.dataOperation.updateMappingData(e,"startDate")},e.prototype.calculateEndDate=function(e){var i=e.ganttProperties,r=null;if(t.isNullOrUndefined(i.startDate))r=e[this.parent.taskFields.endDate],t.isNullOrUndefined(r)||this.setTime(this.parent.defaultEndTime,r),this.parent.setRecordValue("endDate",r,i,!0);else{if(!t.isNullOrUndefined(i.endDate)&&t.isNullOrUndefined(i.duration)&&(1===this.compareDates(i.startDate,i.endDate)&&(this.parent.setRecordValue("startDate",new Date(i.endDate.getTime()),i,!0),this.setTime(this.parent.defaultStartTime,i.startDate)),this.calculateDuration(e)),!t.isNullOrUndefined(i.duration)){var a=!t.isNullOrUndefined(i.segments)&&i.segments.length>0?this.totalDuration(i.segments):i.duration;r=this.getEndDate(i.startDate,a,i.durationUnit,i,!1)}this.parent.setRecordValue("endDate",r,i,!0)}this.parent.taskFields.endDate&&this.parent.dataOperation.updateMappingData(e,"endDate")},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){var i,r=e.ganttProperties;i=!t.isNullOrUndefined(r.segments)&&r.segments.length>0&&!t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)?this.parent.editModule.taskbarEditModule.sumOfDuration(r.segments):t.isNullOrUndefined(this.parent.taskFields.milestone)||t.isNullOrUndefined(r.startDate)||t.isNullOrUndefined(r.endDate)||r.startDate.getTime()!==r.endDate.getTime()||t.isNullOrUndefined(e.taskData[this.parent.taskFields.milestone])?this.getDuration(r.startDate,r.endDate,r.durationUnit,r.isAutoSchedule,r.isMilestone):1,this.parent.setRecordValue("duration",i,r,!0);var a=this.parent.columnByField[this.parent.columnMapping.duration];if(!(t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.cellEditModule)||this.parent.editModule.cellEditModule.isCellEdit||t.isNullOrUndefined(a))){if(!t.isNullOrUndefined(a.edit)&&!t.isNullOrUndefined(a.edit.read)){var n=this.parent.editModule.dialogModule.dialog;if(!t.isNullOrUndefined(n)){var s=n.querySelector("#"+this.parent.element.id+"Duration").ej2_instances[0];t.isNullOrUndefined(s)||s.value===i.toString()||(s.value=i.toString(),s.dataBind())}}this.parent.taskFields.duration&&(this.parent.dataOperation.updateMappingData(e,"duration"),this.parent.taskFields.durationUnit&&this.parent.dataOperation.updateMappingData(e,"durationUnit"))}},e.prototype.getNonworkingTime=function(e,i,r,a){a=!!t.isNullOrUndefined(a)||a;var n=!this.parent.includeWeekend&&this.parent.autoCalculateDateScheduling&&r?this.getWeekendCount(e,i):0,s=this.getNumberOfSeconds(e,i,a),o=r&&this.parent.autoCalculateDateScheduling?this.getHolidaysCount(e,i):0,l=(s-86400*n-86400*o)/86400,d=this.getNonWorkingSecondsOnDate(e,i,r);return l*(86400-this.parent.secondsPerDay)+86400*n+86400*o+d},e.prototype.getDuration=function(e,i,r,a,n,s){if(t.isNullOrUndefined(e)||t.isNullOrUndefined(i))return null;s=!!t.isNullOrUndefined(s)||s;var o=0,l=this.getTimeDifference(e,i,s)/1e3-this.getNonworkingTime(e,i,a,s);return o=n&&this.parent.getFormatedDate(e)===this.parent.getFormatedDate(i)?0:r&&"day"!==r?"minute"===r?l/60:l/3600:l/this.parent.secondsPerDay,parseFloat(o.toString())},e.prototype.getDurationAsSeconds=function(e,t){return t&&"day"!==t.toLocaleLowerCase()?"hour"===t.toLocaleLowerCase()?3600*e:60*e:this.parent.secondsPerDay*e},e.prototype.getEndDate=function(e,t,i,r,a){for(var n=new Date(e.getTime()),s=new Date(e.getTime()),o=this.getDurationAsSeconds(t,i);o>0;)s.setSeconds(s.getSeconds()+o),(o-=o-this.getNonworkingTime(n,s,r.isAutoSchedule,!0))>0&&(s=this.checkStartDate(s,r,a)),n=new Date(s.getTime());return s},e.prototype.getStartDate=function(e,t,i,r,a){for(var n=new Date(e.getTime()),s=new Date(e.getTime()),o=this.getDurationAsSeconds(t,i);o>0;)s.setSeconds(s.getSeconds()-o),(o-=o-this.getNonworkingTime(s,n,r.isAutoSchedule,!0))>0&&(n=this.checkEndDate(s,r)),n=new Date(s.getTime());return a&&r.isMilestone&&(s.setDate(s.getDate()-1),this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,s),s=this.parent.dateValidationModule.checkStartDate(s,r,!0)),s},e.prototype.getProjectStartDate=function(e,i){if(!t.isNullOrUndefined(this.parent.cloneProjectStartDate)){"string"==typeof this.parent.cloneProjectStartDate&&(this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate));var r=this.checkStartDate(this.parent.cloneProjectStartDate);return this.parent.cloneProjectStartDate=r,new Date(r.getTime())}if(t.isNullOrUndefined(this.parent.projectStartDate)){if(t.isNullOrUndefined(i))return null;var a=this.parent.flatData,n=void 0;a.length>0?n=a[0].ganttProperties.startDate:(n=new Date).setHours(0,0,0,0);for(var s=1;s<a.length;s++){var o=a[s].ganttProperties.startDate;t.isNullOrUndefined(o)||-1!==this.compareDates(o,n)||(n=o)}this.parent.cloneProjectStartDate=this.checkStartDate(n,e)}else{r=this.getDateFromFormat(this.parent.projectStartDate);this.parent.cloneProjectStartDate=this.checkStartDate(r)}return new Date(this.parent.cloneProjectStartDate.getTime())},e.prototype.getValidStartDate=function(e,i){var r=null,a=i?e.autoStartDate:e.startDate,n=i?e.autoEndDate:e.endDate,s=!e.isAutoSchedule&&e.autoDuration?e.autoDuration:e.duration;return t.isNullOrUndefined(a)?t.isNullOrUndefined(n)?t.isNullOrUndefined(s)||(r=this.getProjectStartDate(e)):(r=new Date(n.getTime()),this.setTime(this.parent.defaultStartTime,r)):r=new Date(a.getTime()),r},e.prototype.getValidEndDate=function(e,i){var r=null,a=i?e.autoStartDate:e.startDate,n=i?e.autoEndDate:e.endDate,s=i?e.autoDuration:e.duration;if(t.isNullOrUndefined(n))if(t.isNullOrUndefined(a)){if(!t.isNullOrUndefined(s)){var o=this.getValidStartDate(e);o&&(r=this.getEndDate(o,s,e.durationUnit,e,!1))}}else e.isMilestone?r=this.checkStartDate(a):(r=new Date(a.getTime()),this.setTime(this.parent.defaultEndTime,r));else r=new Date(n.getTime());return r},e.prototype.getSecondsPerDay=function(){var e=this.parent.dayWorkingTime,i=e.length,r=0,a=new Date("10/11/2018");this.parent.nonWorkingHours=[];var n=this.parent.nonWorkingHours;this.parent.workingTimeRanges=[];var s=this.parent.workingTimeRanges;this.parent.nonWorkingTimeRanges=[];for(var o=this.parent.nonWorkingTimeRanges,l=0;l<i;l++){var d=e[l];if(!t.isNullOrUndefined(d.from)&&!t.isNullOrUndefined(d.to)){a.setHours(0,0,0,0);var h=new Date(a.getTime());a.setTime(a.getTime()+36e5*d.from);var p=new Date(a.getTime());h.setTime(h.getTime()+36e5*d.to);var c=new Date(h.getTime()),u=c.getTime()-p.getTime(),g=this.getSecondsInDecimal(p),f=this.getSecondsInDecimal(c);0===f&&(f=86400),r+=u/1e3,0===l&&(this.parent.defaultStartTime=g),l===i-1&&(this.parent.defaultEndTime=f),l>0?(n.push(n[n.length-1]+g-s[l-1].to),s[l-1].to<g&&o.push({from:s[l-1].to,to:g,isWorking:!1,interval:g-s[l-1].to})):(n.push(0),o.push({from:0,to:g,isWorking:!1,interval:g})),s.push({from:g,to:f}),o.push({from:g,to:f,isWorking:!0,interval:f-g})}}return this.parent.defaultEndTime/3600!=24&&o.push({from:this.parent.defaultEndTime,to:86400,isWorking:!1,interval:86400-this.parent.defaultEndTime}),r},e.prototype.getDurationValue=function(e,i){var r=null,a=null;if("string"==typeof e){var n=e.match(/(\d*\.*\d+|.+$)/g);if(n&&n.length<=2){a=parseFloat(n[0].toString().trim());var s=n[1]?n[1].toString().trim().toLowerCase():null;-1!==t.getValue("minute",this.parent.durationUnitEditText).indexOf(s)?r="minute":-1!==t.getValue("hour",this.parent.durationUnitEditText).indexOf(s)?r="hour":-1!==t.getValue("day",this.parent.durationUnitEditText).indexOf(s)&&(r="day")}}else a=e,r=null;return{duration:a,durationUnit:r}},e.prototype.getNextWorkingDay=function(e){var t=e.getDay();return-1!==this.parent.nonWorkingDayIndex.indexOf(t)?(e.setDate(e.getDate()+1),e=this.getNextWorkingDay(e)):e},e.prototype.getWeekendCount=function(e,t){var i=0,r=new Date(e.getTime()),a=new Date(t.getTime());for(r.setHours(0,0,0,0),r.setDate(r.getDate()+1),a.setHours(0,0,0,0);r.getTime()<a.getTime();)-1!==this.parent.nonWorkingDayIndex.indexOf(r.getDay())&&(i+=1),r.setDate(r.getDate()+1);return i},e.prototype.getNumberOfSeconds=function(e,t,i){var r=new Date(e.getTime()),a=new Date(t.getTime()),n=0;return r.setDate(r.getDate()+1),r.setHours(0,0,0,0),a.setHours(0,0,0,0),r.getTime()<a.getTime()&&(n=this.getTimeDifference(r,a,i)/1e3),n%86400!=0&&(n=n-n%86400+86400),n},e.prototype.getHolidaysCount=function(e,t){var i=0,r=this.parent.totalHolidayDates,a=new Date(e.getTime()),n=new Date(t.getTime());if(a.setDate(a.getDate()+1),a.setHours(0,0,0,0),n.setHours(0,0,0,0),a.getTime()<n.getTime())for(var s=0;s<r.length;s++){var o=this.getDateFromFormat(new Date(r[s]));a.getTime()<=o.getTime()&&n.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,i=[],r=0;r<e.length;r++){var a=this.getDateFromFormat(e[r].from),n=this.getDateFromFormat(e[r].to);if(!t.isNullOrUndefined(a)||!t.isNullOrUndefined(n))if(t.isNullOrUndefined(a)||t.isNullOrUndefined(n)){var s=a||n;s.setHours(0,0,0,0),-1===i.indexOf(s.getTime())&&i.push(s.getTime())}else for(;a<=n;)a.setHours(0,0,0,0),-1===i.indexOf(a.getTime())&&i.push(a.getTime()),a.setDate(a.getDate()+1)}return i},e.prototype.isOnHolidayOrWeekEnd=function(e,i){if(i=t.isNullOrUndefined(i)?this.parent.includeWeekend:i,this.parent.autoCalculateDateScheduling||(i=!0),!i&&-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay()))return!0;for(var r=this.parent.totalHolidayDates,a=0;a<r.length;a++){var n=this.getDateFromFormat(new Date(r[a])),s=new Date(n.getTime());if(n.setHours(0,0,0,0),s.setHours(23,59,59,59),e.getTime()>=n.getTime()&&e.getTime()<s.getTime())return!0}return!1},e.prototype.getNonWorkingSecondsOnDate=function(e,t,i){for(var r=this.getSecondsInDecimal(e),a=this.getSecondsInDecimal(t),n=-1,s=-1,o=0,l=!(!i||!this.parent.autoCalculateDateScheduling)&&this.isOnHolidayOrWeekEnd(e,null),d=!(!i||!this.parent.autoCalculateDateScheduling)&&this.isOnHolidayOrWeekEnd(t,null),h=0;h<this.parent.nonWorkingTimeRanges.length;h++){var p=this.parent.nonWorkingTimeRanges[h];r>=p.from&&r<=p.to&&(n=h),a>=p.from&&a<=p.to&&(s=h)}if(e.getDate()!==t.getDate()||e.getMonth()!==t.getMonth()||e.getFullYear()!==t.getFullYear()){if(l)o+=86400-r;else for(h=n;h<this.parent.nonWorkingTimeRanges.length;h++)this.parent.nonWorkingTimeRanges[h].isWorking||(o+=h===n?this.parent.nonWorkingTimeRanges[h].to-r:this.parent.nonWorkingTimeRanges[h].interval);if(d)o+=a;else for(h=0;h<=s;h++)this.parent.nonWorkingTimeRanges[h].isWorking||(o+=h===s?a-this.parent.nonWorkingTimeRanges[h].from:this.parent.nonWorkingTimeRanges[h].interval)}else if(n!==s)if(d)o+=a-r;else for(h=n;h<=s;h++)this.parent.nonWorkingTimeRanges[h].isWorking||(o+=h===n?this.parent.nonWorkingTimeRanges[h].to-r:h===s?a-this.parent.nonWorkingTimeRanges[h].from:this.parent.nonWorkingTimeRanges[h].interval);else if(d)o+=a-r;else{this.parent.nonWorkingTimeRanges[n].isWorking||(o=a-r)}return o},e.prototype.getPreviousWorkingDay=function(e){var t=e.getDay(),i=0===t?6:t-1;return-1!==this.parent.nonWorkingDayIndex.indexOf(t)||-1!==this.parent.nonWorkingDayIndex.indexOf(i)&&86400===this.parent.defaultEndTime&&0===this.getSecondsInDecimal(e)?(e.setDate(e.getDate()-1),-1!==this.parent.nonWorkingDayIndex.indexOf(e.getDay())&&(e=this.getPreviousWorkingDay(e)),e):e},e.prototype.getNonWorkingDayIndex=function(){var e=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],t=e.length;0===this.parent.workWeek.length&&(this.parent.workWeek=["Monday","Tuesday","Wednesday","Thursday","Friday"]);for(var i=this.parent.workWeek.slice(),r=i.length,a=0;a<r;a++)i[a]=i[a].toLowerCase();this.parent.nonWorkingDayIndex=[];for(a=0;a<t;a++)-1===i.indexOf(e[a])&&this.parent.nonWorkingDayIndex.push(a)},e.prototype.setTime=function(e,t){var i=e/3600,r=(e-3600*(i=parseInt(i,10)))/60,a=e-3600*i-60*(r=parseInt(r,10));t.setHours(i,r,a)},e.prototype.getTimeDifference=function(e,t,i){var r=new Date(e.getTime()),a=new Date(t.getTime());return i&&this.updateDateWithTimeZone(r,a),a.getTime()-r.getTime()},e.prototype.updateDateWithTimeZone=function(e,t){var i,r,a=e.getTimezoneOffset(),n=t.getTimezoneOffset();if(a!==n){var s=new Date((new Date).getFullYear(),0,1).getTimezoneOffset();if(s!==a?(r=e,i=a):s!==n&&(r=t,i=n),s<0){var o=s-i;r.setTime(r.getTime()+60*o*1e3)}else if(s>=0){o=i-s;r.setTime(r.getTime()-60*o*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 r=new Date(e.toLocaleString("en-US",{timeZone:t}));return isNaN(r.getTime())?0:(e.getTime()-r.getTime())/6e4+i}catch(e){return 0}},e.prototype.remove=function(e,i){return t.isNullOrUndefined(e)||(e=this.reverse(e,i,e.getTimezoneOffset())),e},e.prototype.reverse=function(e,t,i){"string"==typeof t&&(t=this.offset(e,t)),"string"==typeof i&&(i=this.offset(e,i));var r=e.getTimezoneOffset(),a=(e=new Date(e.getTime()+6e4*(t-i))).getTimezoneOffset();return new Date(e.getTime()+6e4*(a-r))},e.prototype.convert=function(e,t){var i=e.getTimezoneOffset(),r=this.offset(e,t),a=(e=new Date(e.getTime()+6e4*(i-r))).getTimezoneOffset();return new Date(e.getTime()+6e4*(a-i))},e.prototype.getDateFromFormat=function(e,i){var r;if(t.isNullOrUndefined(e))return null;if(e instanceof Date)r=new Date(e.getTime());else{var a=this.parent.globalize.parseDate(e,{format:this.parent.getDateFormat(),type:"dateTime"});r=t.isNullOrUndefined(a)&&!isNaN(new Date(e).getTime())?new Date(e):a}if(!t.isNullOrUndefined(this.parent.timezone)&&i){return this.convert(r,this.parent.timezone)}return r},e.prototype.compareDates=function(e,i){return t.isNullOrUndefined(e)||t.isNullOrUndefined(i)?!t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)?1:t.isNullOrUndefined(e)&&!t.isNullOrUndefined(i)?-1:null:e.getTime()>i.getTime()?1:e.getTime()<i.getTime()?-1:0},e.prototype.getDurationString=function(e,i){var r="";if(!t.isNullOrUndefined(e)&&(r+=parseFloat(e.toFixed(2))+" ",!t.isNullOrUndefined(i))){var a=1!==e;"day"===i?r+=a?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===i?r+=a?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===i&&(r+=a?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))}return r},e.prototype.getWorkString=function(e,i){var r="";if(!t.isNullOrUndefined(e)&&(r+=parseFloat(e).toFixed(2)+" ",!t.isNullOrUndefined(i))){var a=1!==e;"day"===i?r+=a?this.parent.localeObj.getConstant("days"):this.parent.localeObj.getConstant("day"):"hour"===i?r+=a?this.parent.localeObj.getConstant("hours"):this.parent.localeObj.getConstant("hour"):"minute"===i&&(r+=a?this.parent.localeObj.getConstant("minutes"):this.parent.localeObj.getConstant("minute"))}return r},e.prototype.calculateProjectDatesForValidatedTasks=function(e){var i=this,r="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,a="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,n=null,s=null,o=t.getValue("dataOperation.dataArray",this.parent);if(r&&a||!o||0!==o.length){if(o.length>0){var l=o.slice().sort(function(e,t){return new Date(e[i.parent.taskFields.startDate]).getTime()-new Date(t[i.parent.taskFields.startDate]).getTime()}),d=o.slice().sort(function(e,t){return new Date(t[i.parent.taskFields.endDate]).getTime()-new Date(e[i.parent.taskFields.endDate]).getTime()});n=l[0][this.parent.taskFields.startDate],s=d[d.length-1][this.parent.taskFields.endDate]}}else n=this.getDateFromFormat(new Date),s=this.getDateFromFormat(new Date(n.getTime()));this.parent.cloneProjectStartDate=r?new Date(r.getTime()):"string"==typeof n?new Date(n):n,this.parent.cloneProjectEndDate=a?new Date(a.getTime()):"string"==typeof s?new Date(s):s},e.prototype.calculateProjectDates=function(e){var i=this;if(this.parent.isLoad&&this.parent.enablePersistence&&this.parent.cloneProjectStartDate&&this.parent.cloneProjectEndDate)return this.parent.cloneProjectStartDate=this.getDateFromFormat(this.parent.cloneProjectStartDate),void(this.parent.cloneProjectEndDate=this.getDateFromFormat(this.parent.cloneProjectEndDate));var r="string"==typeof this.parent.projectStartDate?new Date(this.parent.projectStartDate):this.parent.projectStartDate,a="string"==typeof this.parent.projectEndDate?new Date(this.parent.projectEndDate):this.parent.projectEndDate,n=this.parent.timelineModule.isZooming&&this.parent.cloneProjectStartDate?this.getDateFromFormat(this.parent.cloneProjectStartDate):this.getDateFromFormat(r),s=this.parent.timelineModule.isZooming&&this.parent.cloneProjectEndDate?this.getDateFromFormat(this.parent.cloneProjectEndDate):this.getDateFromFormat(a),o=null,l=null,d=this.parent.flatData,h=this.parent.currentViewData,p=[],c=function(e){t.isNullOrUndefined(e)||p.push(e)},u=function(e){e.length>0&&(e.sort(function(e,t){return e.getTime()-t.getTime()}),o=new Date(e[0].getTime()),l=e.length>1?new Date(e[e.length-1].getTime()):null)};if((!n||!s)&&d.length>0||e||this.parent.timelineModule.isZoomToFit){if((h.length>0&&this.parent.timelineModule.isZoomToFit&&this.parent.treeGrid.filterModule&&this.parent.treeGrid.filterModule.filteredResult.length>0?h:d).forEach(function(e){p=[];var r,a,n=e.ganttProperties;t.isNullOrUndefined(n.startDate)&&t.isNullOrUndefined(n.endDate)?(r=null,a=null):(r=i.getValidStartDate(n),a=i.getValidEndDate(n)),c(o),c(l),c(r),c(a),i.parent.renderBaseline&&!i.parent.timelineModule.isZoomToFit&&(c(n.baselineStartDate),c(n.baselineEndDate)),n.indicators&&n.indicators.length>0&&!i.parent.timelineModule.isZoomToFit&&n.indicators.forEach(function(e){c(i.getDateFromFormat(e.date))}),u(p)}),p=[],c(o),c(l),this.parent.eventMarkers.length>0&&!this.parent.timelineModule.isZoomToFit){this.parent.eventMarkers.forEach(function(e,t){c(i.getDateFromFormat(e.day))})}if(this.parent.totalHolidayDates.length>0&&!this.parent.timelineModule.isZoomToFit){this.parent.totalHolidayDates.forEach(function(e,t){c(new Date(e))})}u(p),o&&l||(o?o=t.isNullOrUndefined(o)?this.getDateFromFormat(new Date):o:(o=t.isNullOrUndefined(o)?this.getDateFromFormat(new Date):o).setHours(0,0,0,0),(l=this.getDateFromFormat(new Date(o.getTime()))).setDate(l.getDate()+20))}else n&&s||0!==d.length||(o=this.getDateFromFormat(new Date),l=this.getDateFromFormat(new Date(o.getTime())));e?(t.setValue("minStartDate",o,e),t.setValue("maxEndDate",l,e)):(this.prevProjectStartDate=this.parent.cloneProjectStartDate,this.parent.cloneProjectStartDate=o||new Date(n.getTime()),this.parent.cloneProjectEndDate=l||new Date(s.getTime())),this.parent.isProjectDateUpdated=!0},e.prototype.splitTasksDuration=function(e){for(var t=0,i=0;i<e.length;i++){var r=e[i],a=r.startDate,n=r.endDate;"Hour"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(a,n)/36e5):"Minutes"===this.parent.timelineModule.bottomTier?t+=Math.ceil(this.getTimeDifference(a,n)/6e4):t+=Math.ceil(this.getTimeDifference(a,n)/864e5)}return t},e}(),O=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),x=function(e){function i(t){var i=e.call(this,t)||this;return i.recordIndex=0,i.taskIds=[],i.hierarchyData=[],i.addEventListener(),i}return O(i,e),i.prototype.addEventListener=function(){this.parent.on("beforeDataManipulate",this.checkDataBinding.bind(this))},i.prototype.checkDataBinding=function(e){if(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=[]),t.isNullOrUndefined(this.parent.dataSource))this.parent.dataSource=[],this.parent.processTimeline(),this.parent.renderGantt(e);else if(this.parent.dataSource instanceof a.DataManager)this.initDataSource(e);else{if(this.parent.dataSource instanceof Object&&y(this.parent)){var i=t.getValue("result",this.parent.dataSource);this.dataArray=i}else this.dataArray=this.parent.dataSource;this.processTimeline(),this.cloneDataSource(),this.parent.renderGantt(e)}},i.prototype.processTimeline=function(){this.parent.processTimeline(),this.parent.enableValidation||(this.parent.dataOperation.calculateProjectDatesForValidatedTasks(),this.parent.timelineModule.validateTimelineProp())},i.prototype.initDataSource=function(e){var t=this,i=this.parent.query instanceof a.Query?this.parent.query:new a.Query;i.requiresCount();this.parent.dataSource.executeQuery(i).then(function(i){t.dataArray=i.result,t.processTimeline(),t.cloneDataSource(),t.parent.renderGantt(e)}).catch(function(i){t.parent.processTimeline(),t.parent.renderGantt(e),t.parent.trigger("actionFailure",{error:i})})},i.prototype.constructDataSource=function(e){for(var i,r=new a.DataManager(e).executeLocal((new a.Query).group(this.parent.taskFields.parentID)),n=[],s=0;s<r.length;s++){var o=r[s];!t.isNullOrUndefined(o.key)&&(i=this.taskIds.indexOf(o.key.toString()))>-1&&!t.isNullOrUndefined(o.key)?e[i][this.parent.taskFields.child]=o.items:-1!==i&&n.push.apply(n,o.items)}this.hierarchyData=this.dataReorder(e,n)},i.prototype.cloneDataSource=function(){var e=this.parent.taskFields.id,i=this.parent.taskFields.parentID,r=[];if(t.isNullOrUndefined(e)||t.isNullOrUndefined(i))r=this.dataArray;else{for(var n=[],s=0;s<this.dataArray.length;s++){var o=this.dataArray[s];n.push(t.extend({},{},o,!0)),t.isNullOrUndefined(o[e])||this.taskIds.push(o[e].toString())}this.parent.taskFields.child||(this.parent.taskFields.child="Children"),this.constructDataSource(n),r=this.hierarchyData}if(this.parent.taskFields.segmentId&&(this.segmentCollection=new a.DataManager(this.parent.segmentData).executeLocal((new a.Query).group(this.parent.taskFields.segmentId)),this.parent.taskFields.segments||(this.parent.taskFields.segments="Segments")),"ProjectView"!==this.parent.viewType){var l=t.extend([],[],this.parent.resources,!0),d=[];if(this.constructResourceViewDataSource(l,r,d),d.length>0){var h={};h[this.parent.resourceFields.id]=0,h[this.parent.resourceFields.name]=this.parent.localeObj.getConstant("unassignedTask"),h[this.parent.taskFields.child]=d,l.push(h)}r=l}this.prepareDataSource(r)},i.prototype.constructResourceViewDataSource=function(e,t,i){for(var r=function(r){var n=t[r],s=null!=a.parent.taskFields.child?a.parent.taskFields.child:a.parent.taskFields.child="Children",o=n&&n[a.parent.taskFields.resourceInfo],l=a.parent.resourceFields.id;n[s]&&0!==n[s].length||!o||!o.length?(!n[s]||n[s]&&0===n[s].length)&&i.push(n):o.forEach(function(t){for(var i="object"==typeof t?t[l]:t,r=0;r<e.length;r++)if(e[r][l].toString()===i.toString()){e[r][s]?e[r][s].push(n):e[r][s]=[n];break}}),n[a.parent.taskFields.child]&&n[a.parent.taskFields.child].length&&a.constructResourceViewDataSource(e,n[a.parent.taskFields.child],i)},a=this,n=0;n<t.length;n++)r(n)},i.prototype.prepareDataSource=function(e){this.prepareRecordCollection(e,0),this.parent.initialLoadData=t.extend({},{},this.parent.flatData,!0),"ResourceView"===this.parent.viewType&&this.calculateSharedTaskUniqueIds(),this.parent.taskFields.dependency&&this.parent.predecessorModule&&this.parent.predecessorModule.ensurePredecessorCollection()},i.prototype.calculateSharedTaskUniqueIds=function(){for(var e=function(e){var i=[];if(i[0]=t.parent.getTaskIds()[e][0],i[1]=t.parent.getTaskIds()[e].slice(1),"R"!==i[0]){var r=[],a=[];t.parent.flatData.filter(function(e){e.ganttProperties.taskId.toString()===i[1]&&0!==e.level&&(a.push(e.ganttProperties.rowUniqueID),r.push(e))});for(var n=0;n<r.length;n++)r[n].ganttProperties.sharedTaskUniqueIds=a}},t=this,i=0;i<this.parent.getTaskIds().length;i++)e(i)},i.prototype.prepareRecordCollection=function(e,i,r){for(var a=this,n=e.length,s=function(n){var s=e[n];if(!t.isNullOrUndefined(o.parent.taskFields.segmentId)){var l=o.segmentCollection.filter(function(e){return e.key===s[a.parent.taskFields.id]});l.length>0&&(s[o.parent.taskFields.segments]=l[0].items)}var d=o.createRecord(s,i,r,!0);o.parent.enableValidation&&o.parent.autoCalculateDateScheduling||o.updateTaskLeftWidth(d),d.index=o.recordIndex++,o.parent.ids[d.index]=d.ganttProperties.rowUniqueID,o.parent.flatData.push(d),o.parent.setTaskIds(d);var h=s[o.parent.taskFields.child];if("ResourceView"===o.parent.viewType&&t.isNullOrUndefined(h)&&t.isNullOrUndefined(d.parentItem)&&0===d.level){var p=d.ganttProperties,c=d;o.parent.setRecordValue(p.isAutoSchedule?"startDate":"autoStartDate",null,c.ganttProperties,!0),o.parent.setRecordValue(p.isAutoSchedule?"endDate":"autoEndDate",null,c.ganttProperties,!0);var u=c.ganttProperties;o.parent.setRecordValue("isMilestone",!1,u,!0),u.isAutoSchedule&&o.calculateDuration(c),o.updateWorkWithDuration(c);var g=u.work;o.parent.setRecordValue("work",g,u,!0),o.parent.setRecordValue("taskType","FixedDuration",u,!0),t.isNullOrUndefined(o.parent.taskFields.type)||o.updateMappingData(c,"type"),o.parent.setRecordValue("progress",Math.floor(0),u,!0),o.parent.setRecordValue("totalProgress",0,u,!0),o.parent.setRecordValue("totalDuration",0,u,!0),u.isAutoSchedule||(o.parent.setRecordValue("autoDuration",o.calculateAutoDuration(u),u,!0),o.updateAutoWidthLeft(c)),o.parent.allowParentDependency||o.resetDependency(c),o.updateWidthLeft(c),o.updateTaskData(c)}!t.isNullOrUndefined(h)&&h.length>0&&o.prepareRecordCollection(h,d.level+1,d)},o=this,l=0;l<n;l++)s(l)},i.prototype.addCustomFieldValue=function(e,t){var i=this.parent.ganttColumns,r=i.length;if(r)for(var a=0;a<r;a++){void 0===t[i[a].field]&&this.parent.setRecordValue(i[a].field,e[i[a].field],t)}},i.prototype.createRecord=function(e,i,a,n){var s=this.parent.taskFields,o=this.parent.resourceFields,l=e[s.progress],d=null,h=null,p=e[s.notes];l=l&&parseFloat(l.toString())?parseFloat(l.toString()):0;var c=e[s.dependency],u=this.getDateFromFormat(e[s.baselineStartDate],!0),g=this.getDateFromFormat(e[s.baselineEndDate],!0),f={},m={},D="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[s.manual];this.parent.setRecordValue("ganttProperties",m,f),t.isNullOrUndefined(e[s.id])?t.isNullOrUndefined(e[o.id])||(d=e[o.id],h=e[o.name],this.addTaskData(f,e,!1)):(d=e[s.id],h=e[s.name],this.addTaskData(f,e,n)),this.parent.setRecordValue("taskId",d,m,!0),this.parent.setRecordValue("taskName",h,m,!0),s.parentID&&this.parent.setRecordValue("parentId",e[s.parentID],m,!0),this.addCustomFieldValue(e,f),this.parent.setRecordValue("isAutoSchedule",D,m,!0),this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),m,!0),this.parent.setRecordValue("isMilestone",!1,m,!0),this.parent.setRecordValue("indicators",e[s.indicators],m,!0),this.updateResourceName(f),this.calculateScheduledValues(f,e,n),this.parent.setRecordValue("baselineStartDate",this.checkBaselineStartDate(u),m,!0),g&&0===g.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,g),(m.baselineStartDate&&g&&m.baselineStartDate.getTime()>g.getTime()||!t.isNullOrUndefined(m.baselineStartDate)&&!t.isNullOrUndefined(m.startDate)&&m.baselineStartDate.getTime()===m.startDate.getTime()&&!t.isNullOrUndefined(g)&&!t.isNullOrUndefined(m.endDate)&&g.toLocaleDateString()===m.endDate.toLocaleDateString()&&m.isMilestone)&&(g=m.baselineStartDate),this.parent.setRecordValue("baselineEndDate",this.checkBaselineEndDate(g,m),m,!0),this.parent.setRecordValue("progress",l,m,!0),this.parent.setRecordValue("totalProgress",l,m,!0),this.parent.setRecordValue("predecessorsName",c,m,!0),this.parent.setRecordValue("notes",p,m,!0),this.parent.setRecordValue("cssClass",e[s.cssClass],m,!0),this.parent.setRecordValue("parentItem",this.getCloneParent(a),f);var v=f.parentItem?f.parentItem.uniqueID:null;if(this.parent.setRecordValue("parentUniqueID",v,f),"ResourceView"!==this.parent.viewType||t.isNullOrUndefined(s.parentID)||t.isNullOrUndefined(f.parentItem)||this.parent.setRecordValue("parentId",f.parentItem.taskId,m,!0),this.parent.setRecordValue("level",i,f),this.parent.setRecordValue("uniqueID",r.getUid(this.parent.element.id+"_data_"),f),this.parent.setRecordValue("uniqueID",f.uniqueID,m,!0),this.parent.setRecordValue("childRecords",[],f),this.parent.dataSource instanceof Object&&y(this.parent)&&!t.isNullOrUndefined(s.child)&&this.parent.setRecordValue(s.child,[],f),!t.isNullOrUndefined(e[s.child])&&e[s.child].length>0?(this.parent.setRecordValue("hasChildRecords",!0,f),this.parent.setRecordValue("isMilestone",!1,m,!0),this.parent.allowParentDependency||this.resetDependency(f)):this.parent.setRecordValue("hasChildRecords",!1,f),f.hasChildRecords&&(this.parent.setRecordValue("autoStartDate",f.ganttProperties.startDate,m),this.parent.setRecordValue("autoEndDate",f.ganttProperties.endDate,m),this.parent.setRecordValue("autoDuration",f.ganttProperties.duration,m)),this.parent.setRecordValue("expanded",!f.hasChildRecords||!this.parent.collapseAllParentTasks,f),this.updateExpandStateMappingValue(f,e),n||(this.parent.setRecordValue("width",this.calculateWidth(f),m,!0),this.parent.setRecordValue("left",this.calculateLeft(m),m,!0),this.parent.setRecordValue("progressWidth",this.getProgressWidth(m.width,l),m,!0),m.baselineEndDate&&m.baselineStartDate&&(this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(m),m,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(m),m,!0))),t.isNullOrUndefined(s.work)&&this.updateWorkWithDuration(f),t.isNullOrUndefined(s.manual)||this.parent.dataOperation.updateMappingData(f,"manual"),this.updateTaskData(f),c&&this.parent.predecessorsCollection.push(f),t.isNullOrUndefined(a)||(a.childRecords.push(f),this.parent.dataSource instanceof Object&&y(this.parent)&&!t.isNullOrUndefined(this.parent.taskFields.child)&&a[this.parent.taskFields.child].push(f.taskData)),"ProjectView"===this.parent.viewType)this.parent.setRecordValue("rowUniqueID",m.taskId.toString(),m,!0);else{var w=f.uniqueID.replace(this.parent.element.id+"_data_","");"ResourceView"===this.parent.viewType&&"string"==typeof f.ganttProperties.taskId&&(w=m.taskId.toString()),this.parent.setRecordValue("rowUniqueID",w,f),this.parent.setRecordValue("rowUniqueID",w,m,!0),this.parent.setRecordValue("sharedTaskUniqueIds",[],m,!0)}return this.parent.allowUnscheduledTasks&&f.ganttProperties.startDate&&(f.ganttProperties.endDate||f.ganttProperties.duration)&&(this.parent.setRecordValue("segments",this.setSegmentsInfo(f,!0),m,!0),this.parent.dataOperation.updateMappingData(f,"segments"),n||this.updateWidthLeft(f)),f},i.prototype.sortSegmentsData=function(e,t,i){var r=this;return t?e.sort(function(e,t){var i=r.parent.taskFields.startDate;return r.getDateFromFormat(e[i]).getTime()-r.getDateFromFormat(t[i]).getTime()}):e.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),e},i.prototype.setSegmentsInfo=function(e,i){var r,a=this.parent.taskFields,n=[],s=0,o=0,l=[];if(!t.isNullOrUndefined(this.parent.taskFields.segments)&&(r=i?e.taskData[this.parent.taskFields.segments]:e.ganttProperties.segments,!t.isNullOrUndefined(r)&&r.length>1)){this.sortSegmentsData(r,i,e.ganttProperties);for(var d=0;d<r.length;d++){var h=r[d],p=i?h[a.startDate]:h.startDate,c=i?h[a.endDate]:h.endDate,u=i?h[a.duration]:h.duration;if(p=this.getDateFromFormat(p),p=this.checkStartDate(p,e.ganttProperties,!1),t.isNullOrUndefined(u)){if((c=this.getDateFromFormat(c))&&(t.isNullOrUndefined(u)||""===String(u))&&0===c.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,c),c=this.checkEndDate(c,e.ganttProperties,!1),u=this.getDuration(p,c,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),a.duration){if((o=e.ganttProperties.duration-s-1)<=0)continue;u=d===r.length-1?o:o>0&&u>o?o:u,c=this.getEndDate(p,u,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!a.duration&&a.endDate&&(c=!t.isNullOrUndefined(e.ganttProperties.endDate)&&c.getTime()<e.ganttProperties.endDate.getTime()&&d!==r.length-1?c:e.ganttProperties.endDate,u=this.getDuration(p,c,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),n.length>0&&c.getTime()<p.getTime()&&c.getTime()<=e.ganttProperties.endDate.getTime())){n[d-1].duration=this.getDuration(n[d-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}}else if(c=this.getEndDate(p,u,e.ganttProperties.durationUnit,e.ganttProperties,!1),a.duration){if((o=e.ganttProperties.duration-s)<=0)continue;u=d===r.length-1?o:o>0&&u>o?o:u,c=this.getEndDate(p,u,e.ganttProperties.durationUnit,e.ganttProperties,!1)}else if(!a.duration&&a.endDate&&(c=!t.isNullOrUndefined(e.ganttProperties.endDate)&&c.getTime()>e.ganttProperties.endDate.getTime()&&d!==r.length-1?c:e.ganttProperties.endDate,u=this.getDuration(p,c,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone),n.length>0&&c.getTime()<p.getTime()&&c.getTime()<=e.ganttProperties.endDate.getTime())){n[d-1].duration=this.getDuration(n[d-1].startDate,e.ganttProperties.endDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);continue}if(h={},!(p&&c&&p&&u))break;if(s+=u,h.startDate=p,h.endDate=c,h.duration=u,h.width=0,h.left=0,h.segmentIndex=d,n.push(h),t.isNullOrUndefined(n[d-1]))h.offsetDuration=0;else{var g=this.getDuration(n[d-1].endDate,n[d].startDate,e.ganttProperties.durationUnit,e.ganttProperties.isAutoSchedule,e.ganttProperties.isMilestone);h.offsetDuration=g,g<1&&(h.startDate=this.getEndDate(n[d-1].endDate,1,e.ganttProperties.durationUnit,e.ganttProperties,!1),h.startDate=this.checkStartDate(h.startDate,e.ganttProperties,!1),h.endDate=this.getEndDate(h.startDate,h.duration,e.ganttProperties.durationUnit,e.ganttProperties,!1),h.endDate=!a.duration&&a.endDate&&h.endDate>e.ganttProperties.endDate?e.ganttProperties.endDate:h.endDate,h.offsetDuration=1)}l.push(this.setSegmentTaskData(h,r[d]))}this.parent.setRecordValue("duration",s,e.ganttProperties,!0),t.isNullOrUndefined(n[n.length-1])||this.parent.setRecordValue("endDate",n[n.length-1].endDate,e.ganttProperties,!0),t.isNullOrUndefined(a.endDate)||t.isNullOrUndefined(n[n.length-1])||this.parent.setRecordValue(this.parent.taskFields.endDate,n[n.length-1].endDate,e,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,l,e)}return n.length>1?this.parent.setRecordValue("segments",n,e.ganttProperties,!0):n=null,n},i.prototype.setSegmentTaskData=function(e,i){var r=this.parent.taskFields,a=t.extend({},{},i,!0);return t.isNullOrUndefined(r.startDate)||(a[this.parent.taskFields.startDate]=e.startDate),t.isNullOrUndefined(r.endDate)||(a[this.parent.taskFields.endDate]=e.endDate),t.isNullOrUndefined(r.duration)||(a[this.parent.taskFields.duration]=Number(e.duration)),a},i.prototype.updateWorkWithDuration=function(e){var i=e.ganttProperties.resourceInfo,r=0;if(!t.isNullOrUndefined(i)){var a=i.length,n=void 0,s=void 0,o=this.parent.secondsPerDay/3600,l=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit);for(n=0;n<a;n++)r+=((s=i[n][this.parent.resourceFields.unit])>0?o*s/100:o)*l;"minute"===e.ganttProperties.workUnit&&(r*=60),"day"===e.ganttProperties.workUnit&&(r/=o),r%1!=0&&(r=parseFloat(r.toFixed(2)))}if(e.childRecords.length>0&&this.parent.isOnEdit){for(var d=0,h=0;h<e.childRecords.length;h++)d+=e.childRecords[h].ganttProperties.work;r+=d}this.parent.setRecordValue("work",r,e.ganttProperties,!0),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(e,"work")},i.prototype.getCloneParent=function(e){if(t.isNullOrUndefined(e))return null;var i={};return i.uniqueID=e.uniqueID,i.expanded=e.expanded,i.level=e.level,i.index=e.index,i.taskId=e.ganttProperties.rowUniqueID,i},i.prototype.reUpdateResources=function(){if(this.parent.flatData.length>0)for(var e=void 0,t=void 0,i=void 0,r=0;r<this.parent.flatData.length;r++)e=this.parent.flatData[r].taskData,t=this.parent.flatData[r].ganttProperties,i=this.parent.flatData[r],this.parent.setRecordValue("resourceInfo",this.setResourceInfo(e),t,!0),this.updateResourceName(i)},i.prototype.addTaskData=function(e,i,r){var n=this,s=this.parent.taskFields,o=this.parent.dataSource;if(r)if(s.parentID||o instanceof a.DataManager&&o.dataSource.json&&o.dataSource.offline)if(s.parentID){var l=i[s.id],d=this.taskIds.indexOf(l.toString()),h=d>-1?this.dataArray[d]:{};if(!t.isNullOrUndefined(this.parent.taskFields.segmentId)){var p=this.segmentCollection.filter(function(e){return e.key===h[n.parent.taskFields.id]});p.length>0&&(h[this.parent.taskFields.segments]=p[0].items)}this.parent.setRecordValue("taskData",h,e)}else this.parent.setRecordValue("taskData",i,e);else this.parent.setRecordValue("taskData",i,e);else this.parent.setRecordValue("taskData",i,e)},i.prototype.updateExpandStateMappingValue=function(e,i){var r,a=this.parent.taskFields.expandState,n=i[a];a&&e.hasChildRecords&&(t.isNullOrUndefined(n)?t.isNullOrUndefined(n)&&!this.parent.collapseAllParentTasks?r=!0:t.isNullOrUndefined(n)&&this.parent.collapseAllParentTasks&&(r=!1):r="true"===n.toString(),this.parent.setRecordValue("taskData."+a,r,e),this.parent.setRecordValue(a,r,e),this.parent.setRecordValue("expanded",r,e))},i.prototype.setValidatedDates=function(e,i){var r=e.ganttProperties,a=this.parent.taskFields,n=i[a.duration],s=this.getDateFromFormat(i[a.startDate],!0),o=this.getDateFromFormat(i[a.endDate],!0);n=t.isNullOrUndefined(n)||""===n?null:n,this.parent.setRecordValue("startDate",new Date(s.getTime()),r,!0),t.isNullOrUndefined(n)||""===n?this.calculateDuration(e):this.updateDurationValue(n,r),this.parent.setRecordValue("endDate",new Date(o.getTime()),r,!0)},i.prototype.calculateScheduledValues=function(e,i,r){var a=this.parent.taskFields,n=e.ganttProperties,s=i[a.duration];s=t.isNullOrUndefined(s)||""===s?null:s;var o,l;n.startDate&&n.endDate?(o=this.getDateFromFormat(n.startDate,!0),l=this.getDateFromFormat(n.endDate,!0)):(o=this.getDateFromFormat(i[a.startDate],!0),l=this.getDateFromFormat(i[a.endDate],!0));var d=a.segments?i[a.segments]||e.taskData[a.segments]:null,h=!!a.milestone&&!!i[a.milestone],p=i[a.durationUnit]?i[a.durationUnit]:"";this.parent.setRecordValue("durationUnit",this.validateDurationUnitMapping(p),n,!0);var c=t.isNullOrUndefined(i[a.work])?0:parseFloat(i[a.work]);this.parent.setRecordValue("workUnit",this.validateWorkUnitMapping(this.parent.workUnit),n,!0);var u=i[a.type]?i[a.type]:"",g=this.validateTaskTypeMapping(u);if(this.parent.setRecordValue("taskType",g,n,!0),r&&!this.parent.enableValidation&&o&&l)this.setValidatedDates(e,i);else if(l||o||!t.isNullOrUndefined(s)&&""!==s)o?this.calculateDateFromStartDate(o,l,s,e,r):l?this.calculateDateFromEndDate(l,s,e):t.isNullOrUndefined(s)||""===s||(this.updateDurationValue(s,n),this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("startDate",null,n,!0),this.parent.setRecordValue("endDate",null,n,!0)):(this.parent.setRecordValue("startDate",this.getProjectStartDate(n,r),n,!0),this.calculateEndDate(e)));else{if(this.parent.allowUnscheduledTasks)return;this.parent.setRecordValue("duration",1,n,!0),this.parent.setRecordValue("startDate",this.getProjectStartDate(n,r),n,!0),this.calculateEndDate(e)}if(this.parent.autoCalculateDateScheduling||(t.isNullOrUndefined(e.ganttProperties.startDate)||(e[this.parent.taskFields.startDate]=e.ganttProperties.startDate,e.taskData[this.parent.taskFields.startDate]=e.ganttProperties.startDate),t.isNullOrUndefined(e.ganttProperties.endDate)||(e[this.parent.taskFields.endDate]=e.ganttProperties.endDate,e.taskData[this.parent.taskFields.endDate]=e.ganttProperties.endDate)),t.isNullOrUndefined(d)||this.parent.setRecordValue("segments",this.setSegmentsInfo(e,!0),n,!0),0===n.duration&&(this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)),!t.isNullOrUndefined(h)&&h&&(this.parent.setRecordValue("duration",0,n,!0),this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)),t.isNullOrUndefined(a.work))a.type&&n.taskType&&this.parent.dataOperation.updateMappingData(e,"type");else{if(this.parent.setRecordValue("durationUnit",this.parent.durationUnit,n,!0),isNaN(c)||t.isNullOrUndefined(c))this.parent.setRecordValue("work",0,n,!0),this.parent.setRecordValue("duration",0,n,!0),this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0);else{switch(this.parent.setRecordValue("work",c,n,!0),g){case"FixedDuration":case"FixedWork":this.updateUnitWithWork(e);break;case"FixedUnit":this.updateDurationWithWork(e)}t.isNullOrUndefined(a.type)||this.parent.dataOperation.updateMappingData(e,"type"),0===n.duration?(this.parent.setRecordValue("isMilestone",!0,n,!0),this.parent.setRecordValue("endDate",n.startDate,n,!0)):t.isNullOrUndefined(n.startDate)||t.isNullOrUndefined(n.duration)||(this.parent.setRecordValue("isMilestone",!1,n,!0),this.calculateEndDate(e))}this.parent.dataOperation.updateMappingData(e,"work")}},i.prototype.updateDurationWithWork=function(e){var i=e.ganttProperties,r=i.resourceInfo;if(!t.isNullOrUndefined(r)){var a=t.isNullOrUndefined(r)?0:r.length,n=0,s=this.parent.secondsPerDay/3600,o=0,l=void 0,d=void 0;for(d=0;d<a;d++)n+=(l=r[d][this.parent.resourceFields.unit])>0?s*l/100:s;var h=this.getWorkInHour(i.work,i.workUnit);a>0&&(o+=h/n),"minute"===i.durationUnit&&(o=o*s*60),"hour"===i.durationUnit&&(o*=s),o%1!=0&&(o=parseFloat(o.toFixed(2))),t.isNullOrUndefined(i.duration)||this.parent.setRecordValue("duration",o,i,!0),this.parent.dataOperation.updateMappingData(e,"duration")}},i.prototype.updateUnitWithWork=function(e){var i=e.ganttProperties,r=i.resourceInfo,a=t.isNullOrUndefined(r)?0:r.length,n=this.parent.secondsPerDay/3600;if(0!==a){var s=this.getDurationInDay(e.ganttProperties.duration,e.ganttProperties.durationUnit),o=this.getWorkInHour(i.work,i.workUnit),l=s>0?o/(s*n)*100:0,d=l>0?l/a:100;d%1!=0&&(d=parseFloat(d.toFixed(2)));for(var h=0;h<a;h++)r[h][this.parent.resourceFields.unit]=d;this.updateResourceName(e)}},i.prototype.calculateDateFromEndDate=function(e,i,r){var a=r.ganttProperties;0===e.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,e);var n=0===parseInt(i,10)||null;this.parent.setRecordValue("endDate",this.checkEndDate(e,r.ganttProperties,n),a,!0),t.isNullOrUndefined(i)||""===i?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)):t.isNullOrUndefined(i)||""===i||(this.updateDurationValue(i,a),this.parent.setRecordValue("startDate",this.getStartDate(a.endDate,a.duration,a.durationUnit,a),a,!0))},i.prototype.calculateDateFromStartDate=function(e,i,r,a,n){var s=a.ganttProperties,o=!!(0===parseInt(r,10)||e&&i&&new Date(e.getTime())===new Date(i.getTime()))||null;this.parent.setRecordValue("startDate",this.checkStartDate(e,s,o,n),s,!0),this.parent.isTreeGridRendered&&a&&this.updateTaskData(a),i||!t.isNullOrUndefined(r)&&""!==r?(t.isNullOrUndefined(r)||i)&&i&&(t.isNullOrUndefined(r)||""===r)?(0===i.getHours()&&86400!==this.parent.defaultEndTime&&this.setTime(this.parent.defaultEndTime,i),this.parent.setRecordValue("endDate",this.checkEndDate(i,a.ganttProperties),s,!0),1===this.compareDates(s.startDate,s.endDate)?(this.parent.setRecordValue("endDate",s.startDate,s,!0),this.parent.setRecordValue("isMilestone",!0,s,!0),this.parent.setRecordValue("duration",0,s,!0)):this.calculateDuration(a)):(this.updateDurationValue(r,s),this.calculateEndDate(a)):this.parent.allowUnscheduledTasks?(this.parent.setRecordValue("endDate",null,s,!0),this.parent.setRecordValue("duration",null,s,!0)):(this.parent.setRecordValue("duration",1,s,!0),this.calculateEndDate(a))},i.prototype.getProgressWidth=function(e,t){return e*t/100},i.prototype.calculateWidth=function(e,i){var r=e.ganttProperties,a=i?r.autoStartDate:r.startDate,n=i?r.autoEndDate:r.endDate;return t.isNullOrUndefined(a)&&t.isNullOrUndefined(n)&&(a=this.getValidStartDate(r,i),n=this.getValidEndDate(r,i)),t.isNullOrUndefined(a)||t.isNullOrUndefined(n)?3:!r.isMilestone||e.hasChildRecords&&!r.isAutoSchedule?this.getTaskWidth(a,n,r):0},i.prototype.getTaskbarHeight=function(){var e=this.parent.rowHeight,t=this.parent.taskbarHeight;return t<e?t:e},i.prototype.calculateLeft=function(e,i){var r=null,a=-300,n=i?e.autoStartDate:e.startDate,s=i?e.autoEndDate:e.endDate,o=(i?e.autoDuration:e.duration,e.isMilestone);return n?r=new Date(n.getTime()):s?(r=new Date(s.getTime()),o=!t.isNullOrUndefined(n)||!this.parent.allowUnscheduledTasks):r=this.getValidStartDate(e),t.isNullOrUndefined(r)||(a=this.getTaskLeft(r,o)),a},i.prototype.calculateAutoLeft=function(e){return this.getTaskLeft(e.autoStartDate,e.isMilestone)},i.prototype.calculateAutoDuration=function(e){return this.getDuration(e.autoStartDate,e.autoEndDate,e.durationUnit,!1,e.isMilestone)},i.prototype.calculateAutoWidth=function(e){return this.getTaskWidth(e.autoStartDate,e.autoEndDate)},i.prototype.calculateBaselineLeft=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i?this.getTaskLeft(t,e.isMilestone):0},i.prototype.calculateBaselineWidth=function(e){var t=this.getDateFromFormat(e.baselineStartDate),i=this.getDateFromFormat(e.baselineEndDate);return t&&i&&t.getTime()!==i.getTime()?this.getTaskWidth(t,i):0},i.prototype.getTaskWidth=function(e,t,i){var r=new Date(e.getTime()),a=new Date(t.getTime()),n="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,s=!1,o=new Date(e.getTime()),l=0;i&&"hour"==i.durationUnit&&(o=new Date(o.getTime()+60*i.duration*60*1e3)),i&&"minute"==i.durationUnit&&(o=new Date(o.getTime()+60*i.duration*1e3));for(var d=0;d<this.parent.dayWorkingTime.length;d++)l=l+this.parent.dayWorkingTime[d].to-this.parent.dayWorkingTime[d].from;var h=o.getTime()-r.getTime();return i&&"minute"==i.durationUnit&&i.duration<60*l?("Day"===n?((Math.floor(h/36e5%24)>=l||0===h)&&(s=!0),this.getSecondsInDecimal(r)===this.parent.defaultStartTime&&s&&r.setHours(0,0,0,0),this.getSecondsInDecimal(a)===this.parent.defaultEndTime&&a.setHours(24),this.getSecondsInDecimal(a)===this.parent.defaultStartTime&&a.setHours(0,0,0,0)):s=!0,r.getTime()===a.getTime()?this.parent.perDayWidth:s?this.getTimeDifference(r,a)/864e5*this.parent.perDayWidth:this.getTimeDifference(r,a)/(36e5*l)*this.parent.perDayWidth):("Day"===n&&(this.getSecondsInDecimal(r)===this.parent.defaultStartTime&&r.setHours(0,0,0,0),this.getSecondsInDecimal(a)===this.parent.defaultEndTime&&a.setHours(24),this.getSecondsInDecimal(a)===this.parent.defaultStartTime&&a.setHours(0,0,0,0)),r.getTime()===a.getTime()?this.parent.perDayWidth:this.getTimeDifference(r,a)/864e5*this.parent.perDayWidth)},i.prototype.getTaskLeft=function(e,t){var i=new Date(e.getTime());"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(this.getSecondsInDecimal(i)===this.parent.defaultStartTime?i.setHours(0,0,0,0):t&&this.getSecondsInDecimal(i)===this.parent.defaultEndTime?i.setHours(24):this.getSecondsInDecimal(i)===this.parent.defaultEndTime&&this.parent.allowUnscheduledTasks&&i.setHours(22));var r=this.parent.timelineModule.timelineStartDate;return r?(i.getTime()-r.getTime())/864e5*this.parent.perDayWidth:0},i.prototype.getSplitTaskWidth=function(e,t,i){var r=new Date(e.getTime()),a=new Date(this.getEndDate(r,t,i.ganttProperties.durationUnit,i.ganttProperties,!1).getTime());return"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(this.getSecondsInDecimal(r)===this.parent.defaultStartTime&&r.setHours(0,0,0,0),this.getSecondsInDecimal(a)===this.parent.defaultEndTime&&a.setHours(24),this.getSecondsInDecimal(a)===this.parent.defaultStartTime&&a.setHours(0,0,0,0)),this.getTimeDifference(r,a)/864e5*this.parent.perDayWidth},i.prototype.getSplitTaskLeft=function(e,t){var i=new Date(e.getTime());return"Day"===("None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier)&&(this.getSecondsInDecimal(i)===this.parent.defaultStartTime&&i.setHours(0,0,0,0),this.getSecondsInDecimal(t)===this.parent.defaultStartTime&&t.setHours(0,0,0,0)),t?(i.getTime()-t.getTime())/864e5*this.parent.perDayWidth:0},i.prototype.updateMappingData=function(e,i){var r=this.parent.columnMapping,a=e.ganttProperties;if(!t.isNullOrUndefined(r[i])||"taskType"===i||"segments"===i)if("predecessorName"===i);else if("resourceInfo"===i){var n=a.resourceInfo,s=this.parent.resourceFields,o=[],l=[];if(!t.isNullOrUndefined(n))for(var d=0;d<n.length;d++){o.push(n[d][s.id]);var h=n[d][s.name],p=n[d][s.unit];100!==p&&(h+="["+p+"%]"),l.push(h)}this.parent.setRecordValue("resourceNames",l.join(","),a,!0),this.updateTaskDataResource(e),this.parent.setRecordValue(r[i],l.join(","),e)}else"startDate"===i||"endDate"===i?this.setRecordDate(e,a[i],r[i]):"duration"===i?this.setRecordDuration(e,r[i]):"work"===i?(this.parent.setRecordValue("taskData."+r[i],this.getWorkString(a.work,a.workUnit),e),this.parent.setRecordValue(r[i],a[i],e)):"type"===i?(this.parent.setRecordValue("taskData."+r[i],a[i],e),this.parent.setRecordValue(r[i],a[i],e)):"manual"===i?(this.parent.setRecordValue("taskData."+r[i],!a.isAutoSchedule,e),this.parent.setRecordValue(r[i],!a.isAutoSchedule,e)):"segments"===i?this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,this.segmentTaskData(e),e):(this.parent.setRecordValue("taskData."+r[i],a[i],e),this.parent.setRecordValue(r[i],a[i],e))},i.prototype.segmentTaskData=function(e){var i=e.ganttProperties.segments,r=this.parent.taskFields;if(t.isNullOrUndefined(i))return null;for(var a=t.extend([],[],e.taskData[r.segments],!0),n=0;n<i.length;n++)(this.parent.isEdit||this.parent.editModule&&this.parent.editModule.dialogModule&&t.getValue("isEdit",this.parent.editModule.dialogModule)||this.parent.contextMenuModule&&t.getValue("isEdit",this.parent.contextMenuModule))&&(a[n]={}),t.isNullOrUndefined(r.startDate)||(a[n][this.parent.taskFields.startDate]=i[n].startDate),t.isNullOrUndefined(r.endDate)||(a[n][this.parent.taskFields.endDate]=i[n].endDate),t.isNullOrUndefined(r.duration)||(a[n][this.parent.taskFields.duration]=Number(i[n].duration));return a},i.prototype.updateTaskDataResource=function(e){var i=e.ganttProperties.resourceInfo,r=e.taskData[this.parent.taskFields.resourceInfo],a=this.parent.resourceFields;if(t.isNullOrUndefined(r))e.taskData[this.parent.taskFields.resourceInfo]=i;else if(i.length){for(var n=0;n<i.length;n++){for(var s=!1,o=0;o<r.length;o++)if("number"==typeof r[o]||"string"==typeof r[o]){if(parseInt(r[o],10)===parseInt(i[n][a.id],10)){r[o]=i[n],s=!0;break}}else if(r[o][a.id]===i[n][a.id]&&"number"!=typeof r[o]){r[o]=t.extend({},r[o],i[n],!0),s=!0;break}s||r.push(i[n])}for(var l=[],d=function(e){i.filter(function(t){t[a.id]===r[e][a.id]&&-1===l.indexOf(r[e])&&l.push(r[e])})},h=0;h<r.length;h++)d(h);this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,l,e)}else this.parent.setRecordValue("taskData."+this.parent.taskFields.resourceInfo,[],e)},i.prototype.setRecordDate=function(e,i,r){var a="string"==typeof i?new Date(i):i;t.isNullOrUndefined(i)||(i=new Date(a.getTime())),this.parent.setRecordValue(r,i,e),t.isNullOrUndefined(i)||(i=new Date(a.getTime())),this.parent.isLoad||this.parent.isDynamicData||this.parent.setRecordValue("taskData."+r,i,e),this.parent.isDynamicData=!1},i.prototype.getDurationInDay=function(e,t){return"day"===t?e:"hour"===t?e/(this.parent.secondsPerDay/3600):e/(this.parent.secondsPerDay/60)},i.prototype.setRecordDuration=function(e,i){var r=e.ganttProperties.duration,a=e.ganttProperties.durationUnit;if(t.isNullOrUndefined(r))this.parent.setRecordValue(i,r,e),this.parent.setRecordValue("taskData."+i,r,e);else{this.parent.setRecordValue(i,e.ganttProperties.duration,e);var n=t.getValue(i,e.taskData);isNaN(n)&&t.isNullOrUndefined(this.parent.taskFields.durationUnit)&&!t.isNullOrUndefined(n)?this.parent.setRecordValue("taskData."+i,this.getDurationString(r,a),e):"string"==typeof n?this.parent.setRecordValue("taskData."+i,r.toString(),e):this.parent.setRecordValue("taskData."+i,r,e)}this.parent.taskFields.durationUnit&&(e.taskData[this.parent.taskFields.durationUnit]=e.ganttProperties.durationUnit)},i.prototype.setDataSource=function(e){for(var i=[],r=e.length,a=0;a<r;a++){var n=e[a];i.push(n),t.isNullOrUndefined(e[a][this.parent.taskFields.child])||this.setDataSource(e[a][this.parent.taskFields.child])}return i},i.prototype.setStartDate=function(e){var i=this,r=[];r=t.isNullOrUndefined(this.parent.taskFields.parentID)||t.isNullOrUndefined(this.parent.taskFields.id)?this.parent.dataSource:this.setDataSource(this.parent.dataSource),this.parent.flatData.map(function(a){r.map(function(r){a.ganttProperties.taskId===r[i.parent.taskFields.id]&&(t.isNullOrUndefined(i.parent.taskFields.startDate)||(e[i.parent.taskFields.endDate]=r[i.parent.taskFields.endDate]),t.isNullOrUndefined(i.parent.taskFields.endDate)||(e[i.parent.taskFields.endDate]=r[i.parent.taskFields.endDate]))})})},i.prototype.getWorkInHour=function(e,t){return"day"===t?e*(this.parent.secondsPerDay/3600):"minute"===t?e/60:e},i.prototype.updateTaskData=function(e){var i=this.parent.taskFields,r=e.ganttProperties;if(!t.isNullOrUndefined(e.taskData)){var a=e.taskData;if(i.id&&(this.parent.setRecordValue("taskData."+i.id,r.taskId,e),this.parent.setRecordValue(i.id,r.taskId,e)),i.name&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.name,r.taskName,e),this.parent.setRecordValue(i.name,r.taskName,e)),i.startDate&&this.setRecordDate(e,r.startDate,i.startDate),i.endDate&&this.setRecordDate(e,r.endDate,i.endDate),i.duration&&this.setRecordDuration(e,i.duration),i.durationUnit&&(a[i.durationUnit]=r.durationUnit),i.progress&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.progress,r.progress,e),this.parent.setRecordValue(i.progress,r.progress,e)),i.baselineStartDate&&this.setRecordDate(e,r.baselineStartDate,i.baselineStartDate),i.baselineEndDate&&this.setRecordDate(e,r.baselineEndDate,i.baselineEndDate),i.notes&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.notes,r.notes,e),this.parent.setRecordValue(i.notes,r.notes,e)),i.cssClass&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.cssClass,r.cssClass,e),this.parent.setRecordValue(i.cssClass,r.cssClass,e)),i.indicators&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.indicators,r.indicators,e),this.parent.setRecordValue(i.indicators,r.indicators,e)),i.parentID){var n="ProjectView"===this.parent.viewType?r.parentId:a[i.parentID];this.parent.setRecordValue("taskData."+i.parentID,n,e),this.parent.setRecordValue(i.parentID,r.parentId,e)}i.work&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.work,this.getWorkString(r.work,r.workUnit),e),this.parent.setRecordValue(i.work,r.work,e)),i.type&&(this.parent.isLoad||this.parent.setRecordValue("taskData."+i.type,r.taskType,e),this.parent.setRecordValue(i.type,r.taskType,e))}},i.prototype.setResourceInfo=function(e){var i;if(t.isNullOrUndefined(e[this.parent.taskFields.resourceInfo]))return i;i=e[this.parent.taskFields.resourceInfo];var r;r=t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.dialogModule)||!this.parent.editModule.dialogModule.isAddNewResource?this.parent.resources:this.parent.editModule.dialogModule.ganttResources;for(var a=this.parent.resourceFields.id,n=this.parent.resourceFields.unit,s=this.parent.resourceFields.group,o=[],l=function(e){var l=r.filter(function(t){return"object"==typeof i[e]&&i[e][a]===t[a]||i[e]===t[a]}),d=t.extend({},l[0]);o.push(d),t.isNullOrUndefined(n)||t.isNullOrUndefined(i[e][n])||(d[n]=i[e][n]),t.isNullOrUndefined(s)||t.isNullOrUndefined(i[e][s])||(d[s]=i[e][s])},d=0;d<i.length;d++)l(d);return this.updateResourceUnit(o),o},i.prototype.updateResourceUnit=function(e){var i=this.parent.resourceFields.unit;if(!t.isNullOrUndefined(i)){var r=e.length,a=void 0;for(a=0;a<r;a++)t.isNullOrUndefined(e[a][i])&&(e[a][i]=100)}},i.prototype.updateResourceName=function(e){var i=e.ganttProperties.resourceInfo,r=[],a=this.parent.taskFields;if(i){var n=i.length,s=t.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=i[o],d=l[this.parent.resourceFields.name],h=l[this.parent.resourceFields.unit];if(100!==h&&(d+="["+h+"%]"),t.isNullOrUndefined(d)||r.push(d),e.taskData){var p=a.resourceInfo;s[o],e.taskData[p].push(s[o])}}this.parent.setRecordValue("resourceNames",r.join(","),e.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.resourceInfo,r.join(","),e,!0),this.updateTaskDataResource(e)}},i.prototype.dataReorder=function(e,t){for(var i=[];e.length>0&&t.length>0;){var r=t.indexOf(e[0]);-1===r?e.shift():(i.push(e.shift()),t.splice(r,1))}return i},i.prototype.validateDurationUnitMapping=function(e){var t=e;return t="minute"===t||"minutes"===t||"m"===t||"min"===t?"minute":"hour"===t||"hours"===t||"h"===t||"hr"===t?"hour":"day"===t||"days"===t||"d"===t?"day":this.parent.durationUnit.toLocaleLowerCase()},i.prototype.validateTaskTypeMapping=function(e){var t=e;return t="FixedDuration"===t?"FixedDuration":"FixedUnit"===t?"FixedUnit":"FixedWork"===t?"FixedWork":this.parent.taskType},i.prototype.validateWorkUnitMapping=function(e){var t=e;return t="minute"===t?"minute":"hour"===t?"hour":"day"===t?"day":this.parent.workUnit.toLocaleLowerCase()},i.prototype.updateDurationValue=function(e,i){var r=this.getDurationValue(e);isNaN(t.getValue("duration",r))||this.parent.setRecordValue("duration",t.getValue("duration",r),i,!0),t.isNullOrUndefined(t.getValue("durationUnit",r))||this.parent.setRecordValue("durationUnit",t.getValue("durationUnit",r),i,!0)},i.prototype.reUpdateGanttData=function(){if(this.parent.flatData.length>0){var e=void 0,i=void 0;this.parent.secondsPerDay=this.getSecondsPerDay();for(var r=0;r<this.parent.flatData.length;r++)e=this.parent.flatData[r].taskData,i=this.parent.flatData[r],t.isNullOrUndefined(this.parent.taskFields.duration)||this.setRecordDuration(i,this.parent.taskFields.duration),this.parent.isLoad&&this.setStartDate(i),this.calculateScheduledValues(i,e,!1);this.updateGanttData()}},i.prototype._isInStartDateRange=function(e,t,i){var r=!1;return e.getTime()>=t.getTime()&&e.getTime()<i.getTime()&&(r=!0),r},i.prototype._isInEndDateRange=function(e,t,i){var r=!1;return e.getTime()>t.getTime()&&e.getTime()<=i.getTime()&&(r=!0),r},i.prototype.updateOverlappingValues=function(e){var t,i=e.childRecords,r=[];if(i.length<=1)e.ganttProperties.workTimelineRanges=[];else{i=this.setSortedChildTasks(e),this.updateOverlappingIndex(i);for(var a=1;a<i.length;a++){t=i[a];for(var n=new Date(t.ganttProperties.startDate.getTime()),s=new Date(t.ganttProperties.endDate.getTime()),o=[],l=0;l<a;l++){var d=i[l].ganttProperties.startDate,h=i[l].ganttProperties.endDate,p={};(this._isInStartDateRange(n,d,h)||this._isInEndDateRange(s,d,h))&&(d.getTime()>n.getTime()&&d.getTime()<s.getTime()&&h.getTime()>n.getTime()&&h.getTime()>=s.getTime()||n.getTime()===d.getTime()&&s.getTime()<=h.getTime()?(p.from=d,p.to=s):n.getTime()===d.getTime()&&s.getTime()>h.getTime()?(p.from=d,p.to=h):n.getTime()>d.getTime()&&s.getTime()>=h.getTime()?(p.from=n,p.to=h):n.getTime()>d.getTime()&&s.getTime()<h.getTime()&&(p.from=n,p.to=s),o.push(p))}r.push.apply(r,this.mergeRangeCollections(o))}this.parent.setRecordValue("workTimelineRanges",this.mergeRangeCollections(r,!0),e.ganttProperties,!0),this.calculateRangeLeftWidth(e.ganttProperties.workTimelineRanges)}},i.prototype.updateOverlappingIndex=function(e){for(var t=0;t<e.length;t++)e[t].ganttProperties.eOverlapIndex=t},i.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)},i.prototype.mergeRangeCollections=function(e,t){for(var i,r,n,s,o=[],l={},d={},h=new a.DataManager(e).executeLocal((new a.Query).sortBy(this.parent.taskFields.startDate,"Ascending")),p=0;p<h.length;p++)0!==o.length||0!==p?(i=(l=o[o.length-1]).from,r=l.to,n=(d=h[p]).from,s=d.to,i.getTime()===n.getTime()&&r.getTime()>=s.getTime()||i.getTime()<n.getTime()&&r.getTime()>=s.getTime()||(i.getTime()<=n.getTime()&&r.getTime()>=n.getTime()&&r.getTime()<s.getTime()||r.getTime()<n.getTime()&&this.checkStartDate(r).getTime()===n.getTime()?l.to=s:r.getTime()<n.getTime()&&this.checkStartDate(r).getTime()!==n.getTime()&&o.push(h[p]))):o.push(h[p]);return t&&(o=this.splitRangeCollection(o)),o},i.prototype.setSortedChildTasks=function(e){return new a.DataManager(e.childRecords).executeLocal((new a.Query).sortBy(this.parent.taskFields.startDate,"Ascending"))},i.prototype.splitRangeCollection=function(e,t,i){var r;return r=this.parent.timelineModule.isSingleTier?"None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier,"Week"===r||"Month"===r||"Year"===r?e:"Day"===r?this.getRangeWithWeek(e,t,i):0===this.parent.workingTimeRanges[0].from&&86400===this.parent.workingTimeRanges[0].to?this.getRangeWithWeek(e,t,i):this.getRangeWithDay(e,t,i)},i.prototype.getRangeWithDay=function(e,t,i){for(var r=[],a=0;a<e.length;a++)r.push.apply(r,this.splitRangeForDayMode(e[a],t,i));return r},i.prototype.splitRangeForDayMode=function(e,i,r){var a=i||"from",n=r||"to",s=new Date(e[a]),o=new Date(e[n]),l=[],d={};if(s.getTime()<o.getTime())do{for(var h=new Date(s.getTime()),p=new Date(s.getTime()),c=0,u=this.parent.dataOperation.getSecondsInDecimal(s),g=-1,f=0;f<this.parent.workingTimeRanges.length;f++){var m=this.parent.workingTimeRanges[f];if(u>=m.from&&u<=m.to){g=f;break}}-1!==g&&(c=Math.round(this.parent.workingTimeRanges[g].to-u),p.setSeconds(p.getSeconds()+c));p.getTime()<o.getTime()?(d={},e.task&&(d.task=t.extend([],e.task)),d[a]=h,d[n]=p,d.isSplit=!0,l.push(d)):(d={},e.task&&(d.task=t.extend([],e.task)),d[a]=h,d[n]=o,d.isSplit=!0,l.push(d)),s=this.checkStartDate(p)}while(s.getTime()<o.getTime());else l.push(e);return l},i.prototype.getRangeWithWeek=function(e,t,i){for(var r=[],a=0;a<e.length;a++)r.push.apply(r,this.splitRangeForWeekMode(e[a],t,i));return r},i.prototype.splitRangeForWeekMode=function(e,i,r){var a=i||"from",n=r||"to",s=new Date(e[a]),o=new Date(e[a]),l=new Date(e[n]),d=!1,h=[],p={};if(o.setDate(o.getDate()+1),o.getTime()<l.getTime()){do{if(this.parent.dataOperation.isOnHolidayOrWeekEnd(o,null)){var c=new Date(o.getTime());c.setDate(o.getDate()-1),this.setTime(this.parent.defaultEndTime,c),(p={})[a]=s,p.isSplit=!0,p[n]=c,e.task&&(p.task=t.extend([],e.task,!0)),s.getTime()!==c.getTime()&&h.push(p),s=this.checkStartDate(c),o=new Date(s.getTime()),d=!0}else o.setDate(o.getDate()+1)}while(o.getTime()<l.getTime());d?s.getTime()!==l.getTime()&&(p={},e.task&&(p.task=t.extend([],e.task,!0)),p[a]=s,p[n]=l,p.isSplit=!0,h.push(p)):h.push(e)}else h.push(e);return h},i.prototype.updateGanttData=function(){for(var e=this.parent.flatData,t=e.length,i=0;i<t;i++){var r=e[i];this.updateTaskLeftWidth(r)}},i.prototype.updateTaskLeftWidth=function(e){var t=e.ganttProperties;e.hasChildRecords&&this.parent.autoCalculateDateScheduling||this.updateWidthLeft(e),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(t),t,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(t),t,!0);var i,r=[];e.parentItem&&(r=(i=this.parent.getParentTask(e.parentItem)).childRecords),i&&r.indexOf(e)===r.length-1&&!e.hasChildRecords&&this.parent.enableValidation?((this.parent.autoCalculateDateScheduling||"ResourceView"===this.parent.viewType)&&this.updateParentItems(i),this.parent.autoCalculateDateScheduling||this.updateWidthLeft(i)):i&&!this.parent.enableValidation&&this.updateWidthLeft(i)},i.prototype.reUpdateGanttDataPosition=function(){for(var e=this.parent.flatData,t=e.length,i=0;i<t;i++){var r=e[i],a=r.ganttProperties;this.updateWidthLeft(r),"Auto"!==this.parent.taskMode&&r.hasChildRecords&&this.updateAutoWidthLeft(r),this.parent.setRecordValue("baselineLeft",this.calculateBaselineLeft(a),a,!0),this.parent.setRecordValue("baselineWidth",this.calculateBaselineWidth(a),a,!0),this.parent.dataOperation.updateTaskData(r)}},i.prototype.updateWidthLeft=function(e){var i=e.ganttProperties;if(!t.isNullOrUndefined(i.segments)&&i.segments.length>0){for(var r=i.segments,a=!0,n=this.splitTasksDuration(r)*("Hour"===this.parent.timelineModule.bottomTier||"Minutes"===this.parent.timelineModule.bottomTier?this.parent.timelineSettings.timelineUnitSize:this.parent.perDayWidth),s=this.parent.dataOperation.getProgressWidth(n,i.progress),o=0;o<r.length;o++){var l=r[o];if(0===o&&!t.isNullOrUndefined(i.startDate)&&l.startDate.getTime()!==i.startDate.getTime()){l.startDate=i.startDate;var d=this.parent.dataOperation.getEndDate(l.startDate,l.duration,i.durationUnit,i,!1);l.endDate=this.parent.dataOperation.checkEndDate(d,i,!1),this.parent.chartRowsModule.incrementSegments(r,0,e)}if(l.width=this.getSplitTaskWidth(l.startDate,l.duration,e),l.showProgress=!1,l.progressWidth=-1,0!==o){var h=new Date(i.startDate.getTime());l.left=this.getSplitTaskLeft(l.startDate,h)}s>0&&s>l.width?(s-=l.width,l.progressWidth=l.width,l.showProgress=!1):a&&(l.progressWidth=s,l.showProgress=!0,s-=l.width,a=!1)}this.parent.setRecordValue("segments",i.segments,i,!0),this.parent.dataOperation.updateMappingData(e,"segments")}this.parent.setRecordValue("width",this.parent.dataOperation.calculateWidth(e),i,!0),this.parent.setRecordValue("left",this.parent.dataOperation.calculateLeft(i),i,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.isAutoSchedule||!e.hasChildRecords?i.width:i.autoWidth,i.progress),i,!0)},i.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,!0),t,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.isAutoSchedule||!e.hasChildRecords?t.width:t.autoWidth,t.progress),t,!0)},i.prototype.getParentProgress=function(e){var i=0,r={};switch(e.ganttProperties.durationUnit){case"hour":i=e.ganttProperties.duration/(this.parent.secondsPerDay/3600);break;case"minute":i=e.ganttProperties.duration/(this.parent.secondsPerDay/60);break;default:i=e.ganttProperties.duration}return e.hasChildRecords?(t.setValue("totalProgress",e.ganttProperties.totalProgress,r),t.setValue("totalDuration",e.ganttProperties.totalDuration?e.ganttProperties.totalDuration:0,r)):(t.setValue("totalProgress",e.ganttProperties.progress*i,r),t.setValue("totalDuration",i,r)),r},i.prototype.resetDependency=function(e){var i=this.parent.taskFields.dependency;if(!t.isNullOrUndefined(i)){var r=e.ganttProperties;this.parent.setRecordValue("predecessor",[],r,!0),this.parent.setRecordValue("predecessorsName",null,r,!0),this.parent.setRecordValue("taskData."+i,null,e),this.parent.setRecordValue(i,null,e)}},i.prototype.updateParentItems=function(e,i){var r=i?e:this.parent.getParentTask(e),a=!1,n=r.ganttProperties;if(this.parent.autoCalculateDateScheduling||"ResourceView"===this.parent.viewType){if(r.childRecords.length>0){for(var s=n.isAutoSchedule?n.startDate:n.autoStartDate,o=n.isAutoSchedule?n.endDate:n.autoEndDate,l=r.childRecords,d=l.length,h=0,p={},c=null,u=null,g=0,f=0,y=0,D=void 0,v=0;v<d;v++)if(D=l[v],this.parent.isOnDelete&&D.isDelete)1===d&&"ProjectView"===this.parent.viewType&&(a=!0);else{var w=this.getValidStartDate(D.ganttProperties);!r.hasChildRecords||n.isAutoSchedule||t.isNullOrUndefined(D.ganttProperties.autoStartDate)||(w=D.ganttProperties.autoStartDate);var k=this.getValidEndDate(D.ganttProperties);!r.hasChildRecords||n.isAutoSchedule||t.isNullOrUndefined(D.ganttProperties.autoEndDate)||(k=D.ganttProperties.autoEndDate),t.isNullOrUndefined(c)&&(c=this.getDateFromFormat(w)),t.isNullOrUndefined(u)&&(u=this.getDateFromFormat(k)),t.isNullOrUndefined(k)||1!==this.compareDates(k,u)||(u=this.getDateFromFormat(k)),t.isNullOrUndefined(w)||-1!==this.compareDates(w,c)||(c=this.getDateFromFormat(w)),!D.ganttProperties.isMilestone&&m(D.ganttProperties)?(p=this.getParentProgress(D),f+=t.getValue("totalProgress",p),D[this.parent.taskFields.duration]<1?(h+=t.getValue("totalDuration",p),h=Number(h.toFixed(4))):h+=t.getValue("totalDuration",p)):g++,y+=D.ganttProperties.work}if(!a){var T=void 0,b=(T=this.parent.isOnDelete&&D.isDelete?d-g-1:d-g)>0&&h>0?Number((f/h).toFixed(2)):0,P=r.ganttProperties,S=!(0!==T||!c||!u||c.getTime()!==u.getTime());0!==this.compareDates(s,c)&&(this.parent.setRecordValue(n.isAutoSchedule?"startDate":"autoStartDate",c,r.ganttProperties,!0),(t.isNullOrUndefined(n.autoDuration)?0===n.duration:0===n.autoDuration)&&r.isManual&&S&&r.hasChildRecords&&r.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("startDate",c,r.ganttProperties,!0)),0!==this.compareDates(o,u)&&(this.parent.setRecordValue(n.isAutoSchedule?"endDate":"autoEndDate",u,r.ganttProperties,!0),(t.isNullOrUndefined(n.autoDuration)?0===n.duration:0===n.autoDuration)&&r.isManual&&S&&r.hasChildRecords&&r.ganttProperties.isAutoSchedule&&"TaskbarEditing"!==this.parent.editModule.taskbarEditModule.taskbarEditedArgs.action&&this.parent.setRecordValue("endDate",u,r.ganttProperties,!0)),this.parent.setRecordValue("isMilestone",S,P,!0),t.isNullOrUndefined(this.parent.taskFields.milestone)||this.updateMappingData(r,"milestone"),P.isAutoSchedule&&this.calculateDuration(r),this.updateWorkWithDuration(r);var C=P.work;C=this.parent.isOnEdit?C:C+y,this.parent.setRecordValue("work",C,P,!0),this.parent.setRecordValue("taskType","FixedDuration",P,!0),t.isNullOrUndefined(this.parent.taskFields.type)||this.updateMappingData(r,"type"),this.parent.setRecordValue("progress",Math.floor(b),P,!0),this.parent.setRecordValue("totalProgress",f,P,!0),this.parent.setRecordValue("totalDuration",h,P,!0),P.isAutoSchedule||(this.parent.setRecordValue("autoDuration",this.calculateAutoDuration(P),P,!0),this.updateAutoWidthLeft(r)),this.parent.allowParentDependency||this.resetDependency(r),this.updateWidthLeft(r),this.updateTaskData(r)}}}else r.ganttProperties.endDate=r.taskData[this.parent.taskFields.endDate];a&&1===r.childRecords.length&&0===r.ganttProperties.duration&&(this.parent.setRecordValue("isMilestone",!0,r.ganttProperties,!0),this.updateWidthLeft(r),this.updateTaskData(r));var M=this.parent.getParentTask(r.parentItem);M&&(this.parent.autoCalculateDateScheduling||"ResourceView"===this.parent.viewType)&&this.updateParentItems(M),a=!1},i}(R),I="e-chart-root-container",E="e-chart-rows-container",N="e-timeline-header-container",F="e-timeline-header-table-container",U="e-timeline-single-header-outer-div",V="e-left-label-container",L="e-left-label-inner-div",B="e-right-label-container",A="e-right-label-inner-div",H="e-taskbar-main-container",j="e-task-label",W="e-gantt-child-taskbar-inner-div",q="e-gantt-child-progressbar-inner-div",G="e-gantt-child-critical-taskbar-inner-div",z="e-gantt-child-critical-progressbar-inner-div",_="e-critical-milestone",X="e-baseline-bar",Y="e-baseline-gantt-milestone-container",Z="e-chart-row-cell",Q="e-chart-row",K="e-taskbar-left-resizer",J="e-taskbar-right-resizer",$="e-child-progress-resizer",ee="e-progressbar-handler",te="e-progressbar-handler-element",ie="e-progressbar-handler-after",re="e-gantt-milestone",ae="e-gantt-child-taskbar",ne="e-gantt-child-progressbar",se="e-manualparent-main-container",oe="e-gantt-manualparenttaskbar",le="e-gantt-manualparent-milestone",de="e-gantt-child-manualtaskbar",he="e-gantt-manualparenttaskbar-right",pe="e-gantt-parent-taskbar",ce="e-gantt-parent-progressbar",ue="e-gantt-unscheduled-task",ge="e-left-resize-gripper",fe="e-right-resize-gripper",me="e-progress-resize-gripper",ye="e-label",De="e-gantt-unscheduled-taskbar-left",ve="e-gantt-unscheduled-taskbar-right",we="e-gantt-dependency-view-container",ke="e-connector-line-container",Te="e-connector-line",be="e-critical-line",Pe="e-critical-line-arrow",Se="e-connector-line-arrow",Ce="e-connector-line-z-index",Me="e-connectorpoint-left",Re="e-connectorpoint-right",Oe="e-connectorpoint-left-hover",xe="e-connectorpoint-right-hover",Ie="e-right-connectorpoint-outer-div",Ee="e-connectorpoint-allow-block",Ne=".e-content",Fe="e-active-parent-task",Ue="e-active-child-task",Ve="e-active-connected-task",Le="e-predecessor-touch-mode",Be="e-rangecontainer",Ae=function(){function e(e){this.previousScroll={top:0,left:0},this.parent=e,this.element=this.parent.ganttChartModule.scrollElement,this.addEventListeners()}return e.prototype.addEventListeners=function(){this.parent.on("grid-scroll",this.gridScrollHandler,this),t.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)},e.prototype.removeEventListeners=function(){t.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)},e.prototype.gridScrollHandler=function(e){this.element.scrollTop=t.getValue("top",e),this.isFromTreeGrid=!0},e.prototype.updateTopPosition=function(){var e,i=this.parent.treeGrid.element.querySelector(".e-content").scrollTop;if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){e=i-this.parent.virtualScrollModule.getTopPosition()}else e=i;if(!t.isNullOrUndefined(this.parent.dayMarkersModule)){var r=t.getValue("nonworkingDayRender.holidayContainer",this.parent.dayMarkersModule),a=t.getValue("nonworkingDayRender.weekendContainer",this.parent.dayMarkersModule),n=t.getValue("eventMarkerRender.eventMarkersContainer",this.parent.dayMarkersModule);r&&(r.style.top=t.formatUnit(e)),a&&(a.style.top=t.formatUnit(e)),n&&(n.style.top=t.formatUnit(e))}this.parent.chartVerticalLineContainer&&(this.parent.chartVerticalLineContainer.style.top=t.formatUnit(e))},e.prototype.removeShimmer=function(){var e=this.parent;setTimeout(function(){if(e.hideMaskRow(),"ResourceView"===e.viewType&&!e.allowTaskbarOverlap&&e.showOverAllocation){for(var t=0;t<e.currentViewData.length;t++){var i=e.chartRowsModule.ganttChartTableBody.childNodes[t];"none"!==i.style.display&&e.currentViewData[t].hasChildRecords&&!e.currentViewData[t].expanded&&(e.treeGrid.getRowByIndex(t).style.height=i.style.height)}e.contentHeight=e.enableRtl?e.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:e.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=e.contentHeight+"px"}},0)},e.prototype.updateShimmer=function(){var e=this.parent;setTimeout(function(){e.showMaskRow()},0)},e.prototype.updateSpinner=function(){var e=this.parent;this.parent.showSpinner(),window.clearTimeout(this.isScrolling),this.isScrolling=setTimeout(function(){e.hideSpinner()},200)},e.prototype.onScroll=function(){var e={};this.element.scrollTop!==this.previousScroll.top&&(this.isFromTreeGrid?this.isFromTreeGrid=!1:this.parent.notify("chartScroll",{top:this.element.scrollTop}),e.previousScrollTop=this.previousScroll.top,this.previousScroll.top=this.element.scrollTop,e.scrollTop=this.element.scrollTop,e.scrollDirection="Vertical",e.action="VerticalScroll",this.updateTopPosition()),this.element.scrollLeft!==this.previousScroll.left&&(this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,e.previousScrollLeft=this.previousScroll.left,this.previousScroll.left=this.element.scrollLeft,e.scrollLeft=this.element.scrollLeft,e.scrollDirection="Horizontal",e.action="HorizontalScroll"),"Horizontal"===e.scrollDirection||t.isNullOrUndefined(e.scrollDirection)||!0!==this.parent.enableVirtualization||!this.parent.isToolBarClick&&!t.isNullOrUndefined(this.parent.isToolBarClick)||(this.parent.isVirtualScroll=!0,(this.parent.showIndicator||t.isNullOrUndefined(this.parent.showIndicator))&&!this.parent.enableVirtualMaskRow&&this.parent.enableVirtualization&&"Spinner"===this.parent.loadingIndicator.indicatorType&&this.updateSpinner()),this.parent.isToolBarClick=!0,e.requestType="scroll",this.parent.trigger("actionComplete",e)},e.prototype.setHeight=function(e){this.element.style.height=t.formatUnit(e)},e.prototype.setWidth=function(e){this.element.style.width=t.formatUnit(e)},e.prototype.setScrollTop=function(e){this.element.scrollTop=e,this.parent.treeGrid.element.querySelector(".e-content").scrollTop=e},e.prototype.setScrollLeft=function(e,t){t&&(e=-1===t&&this.parent.enableRtl?-e:e),this.element.scrollLeft=e,this.parent.ganttChartModule.chartTimelineContainer.scrollLeft=this.element.scrollLeft,this.previousScroll.left=this.element.scrollLeft},e.prototype.destroy=function(){this.removeEventListeners()},e}(),He=function(){function e(e){this.parent=e}return e.prototype.renderWrapper=function(){this.wrapper=t.createElement("div",{className:"e-virtualtable",styles:"position: absolute; transform: translate(0px, 0px);"}),this.parent.ganttChartModule.scrollElement.appendChild(this.wrapper),this.virtualTrack=t.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)},e.prototype.appendChildElements=function(e){this.wrapper.appendChild(e)},e.prototype.adjustTable=function(){var e=this.parent.treeGrid.getContent().querySelector(".e-content").querySelector(".e-virtualtable");this.parent.ganttChartModule.virtualRender.wrapper.style.transform=e.style.transform},e}(),je=function(){function e(e){this.isExpandCollapseFromChart=!1,this.isExpandAll=!1,this.isGanttElement=!1,this.parent=e,this.chartTimelineContainer=null,this.rangeViewContainer=t.createElement("div",{className:Be}),this.rangeViewContainer.setAttribute("role","RangeContainer"),this.virtualRender=new He(this.parent),this.addEventListener()}return e.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)},e.prototype.renderChartContents=function(){this.parent.notify("refreshDayMarkers",{}),this.wireEvents()},e.prototype.renderChartContainer=function(){this.chartElement=t.createElement("div",{id:this.parent.element.id+"GanttChart",className:"e-gantt-chart"}),this.parent.chartPane.appendChild(this.chartElement),this.renderTimelineContainer(),this.renderBodyContainers()},e.prototype.renderInitialContents=function(){this.parent.timelineModule.createTimelineSeries()},e.prototype.renderOverAllocationContainer=function(){for(var e=0;e<this.parent.flatData.length;e++){var t=this.parent.flatData[e];t.childRecords.length>0&&this.parent.dataOperation.updateOverlappingValues(t)}var i=this.parent.element.querySelector("."+Be);i&&(i.innerHTML=""),0===this.parent.treeGrid.grid.filterSettings.columns.length&&this.renderRangeContainer(this.parent.currentViewData)},e.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=0;e<this.parent.chartRowsModule.ganttChartTableBody.children.length;e++)this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[4]?(this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[1].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[2].setAttribute("tabindex","-1"),this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[4].setAttribute("tabindex","-1")):"ProjectView"===this.parent.viewType?t.isNullOrUndefined(this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(e.toString(),10)].children[0].children[1].children[1])||this.parent.chartRowsModule.ganttChartTableBody.children[e].children[0].children[1].children[1].setAttribute("tabindex","-1"):this.parent.chartRowsModule.ganttChartTableBody.children[parseInt(e.toString(),10)].children[0].children[1].children[0]&&this.parent.chartRowsModule.ganttChartTableBody.children[e].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),"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&this.renderOverAllocationContainer()}this.updateWidthAndHeight(),this.parent.notify("selectRowByIndex",{})},e.prototype.renderRangeContainer=function(e){var t,i,r,a=e.length;if(0===this.parent.treeGrid.grid.filterSettings.columns.length)for(t=0;t<a;t++)(r=(i=e[t]).ganttProperties.workTimelineRanges)&&this.renderRange(r,i)},e.prototype.getTopValue=function(e){var t=this.parent.getExpandedRecords(this.parent.currentViewData).indexOf(e);return e.expanded?(t+1)*this.parent.rowHeight:t*this.parent.rowHeight},e.prototype.getRangeHeight=function(e){return!e.expanded&&e.hasChildRecords?this.parent.rowHeight-Math.floor(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight):e.childRecords.length*this.parent.rowHeight-Math.floor(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)},e.prototype.renderRange=function(e,i){var r=0,a=this.parent.currentViewData.indexOf(i);r=!this.parent.allowTaskbarOverlap&&this.parent.enableMultiTaskbar?i.expanded?this.parent.getRowByIndex(a).offsetTop+this.parent.rowHeight:this.parent.getRowByIndex(a).offsetTop:this.getTopValue(i);var n=this.rangeViewContainer.querySelector(".rangeContainer"+i.ganttProperties.rowUniqueID);n&&n.remove();var s=t.createElement("div",{className:"rangeContainer"+i.ganttProperties.rowUniqueID,styles:"top:"+r+"px; position: absolute;"});if(0!==i.level||i.expanded||!t.isNullOrUndefined(i.parentItem)||this.parent.enableMultiTaskbar){for(var o=0;o<e.length;o++){var l=void 0;l=this.parent.allowTaskbarOverlap||i.expanded||!this.parent.enableMultiTaskbar?this.getRangeHeight(i):parseInt(this.parent.chartRowsModule.ganttChartTableBody.childNodes[a].style.height)-(this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight);var d=t.createElement("div",{className:"e-rg-rangdiv e-leftarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[o].left+e[o].width-5:e[o].left)+"px;\n top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px;\n height: "+(l+1)+"px; border-right: 0px"}),h=t.createElement("div",{className:"e-rg-rangdiv e-rightarc",styles:(this.parent.enableRtl?"right:":"left:")+(this.parent.enableRtl?e[o].left:e[o].left+e[o].width-5)+"px;\n top: "+Math.floor((this.parent.rowHeight-this.parent.chartRowsModule.taskBarHeight)/2)+"px; height: "+(l+1)+"px;\n border-left: 0px"});s.appendChild(d),s.appendChild(h),this.rangeViewContainer.appendChild(s)}this.parent.ganttChartModule.chartBodyContent.appendChild(this.rangeViewContainer)}},e.prototype.renderTimelineContainer=function(){this.chartTimelineContainer=t.createElement("div",{className:N}),this.parent.enableRtl&&(this.chartTimelineContainer.style.borderLeftWidth="1px",this.chartTimelineContainer.style.borderRightWidth="0px"),this.chartTimelineContainer.setAttribute("role","presentation"),this.chartElement.appendChild(this.chartTimelineContainer)},e.prototype.renderBodyContainers=function(){this.chartBodyContainer=t.createElement("div",{className:I}),this.chartElement.appendChild(this.chartBodyContainer),this.scrollElement=t.createElement("div",{className:"e-chart-scroll-container e-content",styles:"position:relative;"}),this.chartBodyContainer.appendChild(this.scrollElement),this.chartBodyContent=t.createElement("div",{className:E,styles:"position:relative; overflow:hidden "}),this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.ganttChartModule.virtualRender.renderWrapper():this.scrollElement.appendChild(this.chartBodyContent),this.scrollObject=new Ae(this.parent);var e=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(e=this.parent.toolbarModule.element.offsetHeight),this.scrollObject.setHeight(this.parent.ganttHeight-this.chartTimelineContainer.offsetHeight-e)},e.prototype.updateWidthAndHeight=function(){var e=0===this.parent.contentHeight?this.parent.flatData.length>1?36:0:this.parent.contentHeight,i=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0];if(e>=i.offsetHeight||"auto"===this.parent.height)this.chartBodyContent.style.height=t.formatUnit(e);else{var r=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;i.offsetHeight>=r?this.chartBodyContent.style.height=i.offsetHeight-17+"px":this.chartBodyContent.style.height=i.offsetHeight+"px"}this.chartBodyContent.style.width=t.formatUnit(this.parent.timelineModule.totalTimelineWidth),this.setVirtualHeight(),this.parent.notify("updateHeight",{}),this.parent.updateGridLineContainerHeight(),this.updateLastRowBottomWidth()},e.prototype.setVirtualHeight=function(){if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){t.getValue("virtualTrack",this.parent.ganttChartModule.virtualRender).style.height=this.parent.treeGrid.element.getElementsByClassName("e-virtualtrack")[0].style.height;var e=t.getValue("wrapper",this.parent.ganttChartModule.virtualRender),i=this.parent.treeGrid.element.getElementsByClassName("e-virtualtable")[0].style.transform;e.style.transform=i}},e.prototype.updateLastRowBottomWidth=function(){if(this.parent.currentViewData.length>0&&"auto"!==this.parent.height){var e=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.getExpandedRecords(this.parent.currentViewData),i=e[e.length-1],r=this.parent.currentViewData.indexOf(i),a=this.parent.getRowByIndex(r),n=this.parent.chartRowsModule.ganttChartTableBody;if(n.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow")&&t.removeClass(n.querySelectorAll(".e-chart-row-cell.e-chart-row-border.e-lastrow"),"e-lastrow"),this.chartBodyContent.clientHeight<this.chartBodyContainer.clientHeight&&a){t.addClass(a.querySelectorAll("td"),"e-lastrow");var s=0===this.parent.contentHeight?this.parent.flatData.length>1?36:0:this.parent.contentHeight,o=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0];if(s>=o.offsetHeight)this.chartBodyContent.style.height=t.formatUnit(s);else{var l=this.parent.element.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;o.offsetHeight>=l?this.chartBodyContent.style.height=o.offsetHeight-17+"px":this.chartBodyContent.style.height=o.offsetHeight+"px"}}}},e.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))},e.prototype.ganttChartMouseDown=function(e){3!==e.which&&this.parent.editSettings.allowTaskbarEditing&&(this.parent.notify("chartMouseDown",e),this.parent.element.tabIndex=0),this.parent.editSettings.allowEditing&&this.parent.treeGrid.element.getElementsByClassName("e-editedbatchcell").length>0&&this.parent.treeGrid.endEdit()},e.prototype.ganttChartMouseClick=function(e){this.parent.autoFocusTasks&&this.scrollToTarget(e),this.parent.notify("chartMouseClick",e)},e.prototype.ganttChartMouseUp=function(e){this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseUp",e)},e.prototype.scrollToTarget=function(e){var i=t.closest(e.target,"tr");if(i&&this.parent.element.contains(i)&&(this.parent.element.querySelectorAll(".e-chart-rows-container")[0].contains(e.target)||this.parent.element.querySelectorAll(".e-gridcontent")[0].contains(e.target))&&this.parent.currentViewData.length>0){var r=t.getValue("rowIndex",t.closest(e.target,"tr")),a=this.parent.currentViewData[r].ganttProperties.startDate;if(!t.isNullOrUndefined(a)){var n=this.parent.dataOperation.getTaskLeft(a,!1);this.parent.autoFocusTasks&&this.updateScrollLeft(n)}}},e.prototype.updateScrollLeft=function(e){e=e>0?e:0,e=this.scrollElement.scrollWidth<=e?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)},e.prototype.mouseUp=function(e){if(t.isNullOrUndefined(this.parent.editModule)||t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)||this.parent.editModule.taskbarEditModule.removeFalseLine(!1),this.parent.allowRowDragAndDrop){var i=this.parent.element.querySelector(".e-ganttdrag");i&&i.remove()}this.isGanttElement||this.parent.notify("chartMouseUp",e),this.isGanttElement=!1},e.prototype.documentMouseUp=function(e){if(this.isGanttElement=!0,(e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse"))&&!0===t.getValue("isEditCollapse",this.parent.treeGrid)&&t.setValue("isEditCollapse",!1,this.parent.treeGrid),this.parent.allowRowDragAndDrop){var i=this.parent.element.querySelector(".e-ganttdrag");i&&i.remove()}if(!this.parent.isDestroyed&&3!==e.which){var r=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");t.isNullOrUndefined(r)||r.remove();var a=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar");if(!t.isNullOrUndefined(a)){a.parentElement.parentElement.remove()}var n=!1;if(this.parent.editSettings.allowTaskbarEditing&&t.getValue("editModule.taskbarEditModule.isMouseDragged",this.parent)&&t.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)&&(n=!0),this.parent.notify("chartMouseUp",e),this.parent.showActiveElement&&(this.parent.showIndicator=!0,t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.focusedElement&&!e.target.classList.contains("e-split-bar")&&(this.focusedElement.tabIndex=0===this.focusedElement.tabIndex?-1:this.focusedElement.tabIndex,t.removeClass([this.focusedElement],"e-active-container"))),!n){var s=e.target,o=e.target.classList.contains(H)||t.closest(e.target,"."+H);t.closest(s,".e-gantt-parent-taskbar")&&!this.parent.editSettings.allowEditing?this.chartExpandCollapseRequest(e):!o&&this.parent.autoFocusTasks&&this.scrollToTarget(e)}if(this.parent.editModule&&this.parent.editModule.taskbarEditModule&&this.parent.editModule.taskbarEditModule.removeFalseLine(!0),!t.isNullOrUndefined(this.parent.onTaskbarClick)&&!n){s=e.target;var l=t.closest(s,".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");l&&this.onTaskbarClick(e,s,l)}}},e.prototype.onTaskbarClick=function(e,i,r){var a=t.closest(i,"tr"),n=t.getValue("rowIndex",a),s={data:this.getRecordByTarget(e),taskbarElement:r,rowIndex:n,target:i};this.parent.trigger("onTaskbarClick",s)},e.prototype.ganttChartLeave=function(e){this.parent.editSettings.allowTaskbarEditing&&this.parent.notify("chartMouseLeave",e)},e.prototype.ganttChartMove=function(e){this.parent.editSettings.allowTaskbarEditing&&(this.parent.notify("chartMouseMove",e),!t.isNullOrUndefined(this.parent.taskFields.dependency)&&this.parent.connectorLineEditModule&&this.parent.connectorLineEditModule.updateConnectorLineEditElement(e))},e.prototype.contextClick=function(e){this.parent.allowFiltering&&this.parent.filterModule&&this.parent.filterModule.closeFilterOnContextClick(e.srcElement)},e.prototype.mouseMoveHandler=function(e){if(!t.isNullOrUndefined(this.parent.onMouseMove)&&(this.parent.flatData.length||e.target.classList.contains("e-header-cell-label")||e.target.classList.contains("e-headercell"))){var i=e.target,r={originalEvent:e},a=t.closest(i,".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=void 0,s=t.closest(i,".e-rowcell,.e-chart-row-cell"),o=t.closest(i,".e-rowcell,.e-headercell");if(s&&(n=this.parent.ganttChartModule.getRecordByTarget(e),r.data=n),o){var l=t.getValue("cellIndex",o);r.column=this.parent.treeGrid.columns[l]}if(t.closest(i,".e-indicator-span")){var d=0,h=n.ganttProperties.indicators;if(h.length>1)for(d=0;d<h.length&&h[d].name!==a.innerText.trim();d++);r.indicator=h[d]}if(t.closest(i,".e-connector-line-container")){(p={}).target=a,r.predecessor=this.parent.tooltipModule.getPredecessorTooltipData(p)}if(t.closest(i,".e-event-markers")){var p;(p={}).target=a,r.eventMarkers=this.parent.tooltipModule.getMarkerTooltipData(p)}i.classList.contains("e-header-cell-label")&&(r.date=new Date(i.dataset.content))}this.parent.trigger("onMouseMove",r)}},e.prototype.doubleClickHandler=function(e){this.parent.notify("chartDblClick",e);var i=e.target,r=t.closest(i,"tr"),a=t.getValue("rowIndex",r),n={row:r,rowData:this.parent.ganttChartModule.getRecordByTarget(e),rowIndex:a,target:i};this.recordDoubleClick(n)},e.prototype.recordDoubleClick=function(e){this.parent.trigger("recordDoubleClick",e)},e.prototype.getRecordByTarget=function(e){var i,r=t.closest(e.target,"div."+H);if(t.isNullOrUndefined(r)){if(r=t.closest(e.target,"tr")){var a=t.getValue("rowIndex",t.closest(e.target,"tr"));i=this.parent.currentViewData[a]}}else{var n=r.getAttribute("rowUniqueId");i=this.parent.getRecordByID(n)}return i},e.prototype.getChartRows=function(){return null!=document.getElementById(this.parent.element.id+"GanttTaskTableBody")?document.getElementById(this.parent.element.id+"GanttTaskTableBody").querySelectorAll(".e-chart-row"):null},e.prototype.chartExpandCollapseRequest=function(e){if(!this.parent.enableMultiTaskbar){var i=e.target,r=t.closest(i,".e-gantt-parent-taskbar"),a=this.getRecordByTarget(e),n=t.closest(i,"tr"),s=t.getValue("rowIndex",n),o={data:a,gridRow:this.parent.treeGrid.getRows()[s],chartRow:n,cancel:!1};this.isExpandCollapseFromChart=!0,r.classList.contains("e-row-expand")?this.collapseGanttRow(o):r.classList.contains("e-row-collapse")&&this.expandGanttRow(o)}},e.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)},e.prototype.collapseGanttRow=function(e,i){var r=this;i?this.collapsedGanttRow(e):this.parent.trigger("collapsing",e,function(e){r.isExpandCollapseFromChart&&!t.getValue("cancel",e)&&r.collapsedGanttRow(e),r.isExpandCollapseFromChart=!1})},e.prototype.collapsedGanttRow=function(e){if(!(t.isNullOrUndefined(e.gridRow)&&this.parent.enableVirtualization||t.isNullOrUndefined(e.chartRow))){var i=t.getValue("data",e);this.isExpandCollapseFromChart?(this.expandCollapseChartRows("collapse",t.getValue("chartRow",e),i,null),this.parent.treeGrid.collapseRow(t.getValue("gridRow",e),i),this.isExpandCollapseFromChart=!1):this.expandCollapseChartRows("collapse",t.getValue("chartRow",e),i,null),"ResourceView"===this.parent.viewType&&this.renderMultiTaskbar(i),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),t.getValue("chartRow",e).setAttribute("aria-expanded","false")}},e.prototype.expandGanttRow=function(e,i){var r=this;i?this.expandedGanttRow(e):this.parent.trigger("expanding",e,function(e){r.isExpandCollapseFromChart&&!t.getValue("cancel",e)&&r.expandedGanttRow(e),r.isExpandCollapseFromChart=!1})},e.prototype.expandedGanttRow=function(e){if(!(t.isNullOrUndefined(e.gridRow)&&this.parent.enableVirtualization||t.isNullOrUndefined(e.chartRow))){var i=t.getValue("data",e);this.isExpandCollapseFromChart?(this.expandCollapseChartRows("expand",t.getValue("chartRow",e),i,null),this.parent.treeGrid.expandRow(t.getValue("gridRow",e),i),this.isExpandCollapseFromChart=!1):(this.parent.isExpandCollapseLevelMethod||this.expandCollapseChartRows("expand",t.getValue("chartRow",e),i,null),this.parent.isExpandCollapseLevelMethod=!1),"ResourceView"===this.parent.viewType&&this.renderMultiTaskbar(i),this.parent.enableVirtualization||this.parent.updateContentHeight(),this.updateWidthAndHeight(),this.reRenderConnectorLines(),t.getValue("chartRow",e).setAttribute("aria-expanded","true")}},e.prototype.renderMultiTaskbar=function(e){this.parent.enableMultiTaskbar?this.parent.chartRowsModule.refreshRecords([e],!0):this.parent.showOverAllocation&&this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)},e.prototype.expandCollapseChartRows=function(e,i,r,a){var n;if("expand"===e){n="table-row",a||(r.expanded=!0);for(var s=i.querySelectorAll(".e-row-collapse"),o=0;o<s.length;o++)t.addClass([s[o]],"e-row-expand"),t.removeClass([s[o]],"e-row-collapse")}else if("collapse"===e){n="none",a||(r.expanded=!1);for(s=i.querySelectorAll(".e-row-expand"),o=0;o<s.length;o++)t.addClass([s[o]],"e-row-collapse"),t.removeClass([s[o]],"e-row-expand")}if(!this.parent.enableVirtualization){for(var l=r.childRecords,d=this.getChartRows(),h=[],p=0;p<d.length;p++)d[p].classList.contains("gridrowtaskId"+r.ganttProperties.rowUniqueID+"level"+(r.level+1))&&h.push(d[p]);for(p=0;p<h.length;p++)h[p].style.display=n,l[p].childRecords&&l[p].childRecords.length&&("collapse"===e||l[p].expanded||this.isExpandAll)&&this.expandCollapseChartRows(e,h[p],l[p],!0)}},e.prototype.expandCollapseAll=function(e){"expand"===e?(this.isExpandAll=!0,this.parent.treeGrid.expandAll()):this.parent.treeGrid.collapseAll(),this.isExpandAll=!1},e.prototype.expandAtLevel=function(e){this.parent.treeGrid.expandAtLevel(e)},e.prototype.collapseAtLevel=function(e){this.parent.enableVirtualization&&(this.parent.isExpandCollapseLevelMethod=!0),this.parent.treeGrid.collapseAtLevel(e)},e.prototype.wireEvents=function(){var e=t.Browser.isPointer,i=t.Browser.touchStartEvent,a=t.Browser.touchEndEvent,n=t.Browser.touchMoveEvent,s=e?"pointerleave":"mouseleave";t.EventHandler.add(this.parent.chartPane,i,this.ganttChartMouseDown,this),t.EventHandler.add(this.parent.chartPane,s,this.ganttChartLeave,this),t.EventHandler.add(this.parent.chartPane,n,this.ganttChartMove,this),this.parent.isAdaptive&&(t.EventHandler.add(this.parent.chartPane,r.click,this.ganttChartMouseClick,this),t.EventHandler.add(this.parent.chartPane,a,this.ganttChartMouseUp,this)),this.parent.isAdaptive||(t.EventHandler.add(this.parent.element,a,this.documentMouseUp,this),t.EventHandler.add(document,a,this.mouseUp,this)),t.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),t.EventHandler.add(document.body,"contextmenu",this.contextClick,this),t.EventHandler.add(document,"mouseup",this.contextClick,this),t.EventHandler.add(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler,this)},e.prototype.unWireEvents=function(){var e=t.Browser.isPointer,i=t.Browser.touchStartEvent,a=t.Browser.touchEndEvent,n=t.Browser.touchMoveEvent,s=e?"pointerleave":"mouseleave";t.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,i,this.ganttChartMouseDown),t.EventHandler.remove(this.parent.chartPane,s,this.ganttChartLeave),t.EventHandler.remove(this.parent.chartPane,n,this.ganttChartMove),this.parent.isAdaptive&&(t.EventHandler.remove(this.parent.chartPane,r.click,this.ganttChartMouseClick),t.EventHandler.remove(this.parent.chartPane,a,this.ganttChartMouseUp)),this.parent.isAdaptive||(t.EventHandler.remove(this.parent.element,a,this.documentMouseUp),t.EventHandler.remove(document,a,this.mouseUp)),t.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),t.EventHandler.remove(document.body,"contextmenu",this.contextClick),t.EventHandler.remove(document,"mouseup",this.contextClick),t.EventHandler.remove(this.parent.chartRowsModule.ganttChartTableBody,"dblclick",this.doubleClickHandler)},e.prototype.getRecordByTaskBar=function(e){return this.parent.enableVirtualization&&this.parent.enableMultiTaskbar?this.parent.flatData[this.getIndexByTaskBar(e)]:this.parent.currentViewData[this.getIndexByTaskBar(e)]},e.prototype.onTabAction=function(e){this.parent.treeGrid.grid.enableHeaderFocus=this.parent.enableHeaderFocus;var i=this.parent.editModule&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit;if(this.parent.showActiveElement||i){var r=i?e.target.closest(".e-rowcell"):e.target;(r.closest(".e-rowcell")||r.closest(".e-chart-row"))&&this.parent.focusModule.setActiveElement(r),this.focusedRowIndex=r.closest(".e-rowcell")?r.parentElement.rowIndex:r.closest(".e-chart-row")?r.closest(".e-chart-row").rowIndex:-1;var a="tab"===e.action,n=this.getNextElement(r,a,i);if(n&&r.classList.contains("e-headercell")){var s=parseInt(n.getAttribute("data-colindex"));if("shiftTab"===e.action){for(;-1!=s&&!this.parent.treeGrid.columns[s].visible;)s-=1;if(-1!=s)n=document.getElementsByClassName("e-columnheader")[0].childNodes[s];else for(var o=document.getElementsByClassName("e-toolbar-item").length-1;o>0;o--)if(!document.getElementsByClassName("e-toolbar-item")[o].classList.contains("e-hidden")){n=document.getElementsByClassName("e-toolbar-item")[o];break}}else{for(;!this.parent.treeGrid.columns[s].visible;)s+=1;n=document.getElementsByClassName("e-columnheader")[0].childNodes[s]}}if(!n&&"shiftTab"===e.action&&r.classList.contains("e-headercell"))for(o=document.getElementsByClassName("e-toolbar-item").length-1;o>0;o--)if(!document.getElementsByClassName("e-toolbar-item")[o].classList.contains("e-hidden")){n=document.getElementsByClassName("e-toolbar-item")[o];break}if(r.classList.contains("e-treegrid")&&!n)for(o=0;o<this.parent.treeGrid.columns.length;o++)if(this.parent.treeGrid.columns[o].visible){n=document.getElementsByClassName("e-columnheader")[0].childNodes[o];break}if(!n&&r.classList.contains("e-headercell")&&(n=document.getElementsByClassName("e-timeline-header-container")[0]),"shiftTab"!==e.action&&r.classList.contains("e-timeline-header-container"))for(o=0;o<this.parent.treeGrid.columns.length;o++)if(this.parent.treeGrid.columns[o].visible){n=document.getElementsByClassName("e-row")[0].childNodes[o];break}if("shiftTab"!==e.action||n||(n=document.getElementsByClassName("e-timeline-header-container")[0]),"shiftTab"===e.action&&r.classList.contains("e-timeline-header-container"))for(o=this.parent.treeGrid.columns.length-1;o>0;o--)if(this.parent.treeGrid.columns[o].visible){n=document.getElementsByClassName("e-columnheader")[0].childNodes[o];break}if(this.tempNextElement=n,t.isNullOrUndefined(n)||t.isNullOrUndefined(n.cellIndex)||(this.parent.allowRowDragAndDrop?(this.childrenIndex=n.cellIndex,this.nextElementIndex=n.cellIndex-1):(this.childrenIndex=n.cellIndex,this.nextElementIndex=n.cellIndex),this.parent.ganttColumns[this.nextElementIndex].allowEditing||this.parent.ganttColumns[this.nextElementIndex].field===this.parent.taskFields.id?this.isEditableElement=!1:this.isEditableElement=!0),"noNextRow"!==n){if("string"!=typeof n){if((r.classList.contains("e-rowcell")||r.closest(".e-chart-row-cell")||r.classList.contains("e-headercell")||r.closest(".e-segmented-taskbar")||r.classList.contains("e-timeline-header-container"))&&e.preventDefault(),a&&r.classList.contains("e-rowdragdrop"))return void this.parent.treeGrid.grid.notify("key-pressed",e);if(r.classList.contains("e-rowcell")&&n&&n.classList.contains("e-rowcell")||r.classList.contains("e-headercell"))if(a)if(this.parent.editSettings.allowNextRowEdit){var l=this.parent.currentViewData[this.focusedRowIndex],d=this.parent.ganttColumns[n.getAttribute("data-colindex")].field;l.hasChildRecords?d===this.parent.taskFields.endDate||d===this.parent.taskFields.duration||d===this.parent.taskFields.dependency||d===this.parent.taskFields.progress||d===this.parent.taskFields.work||"taskType"===d?(this.parent.treeGrid.grid.endEdit(),this.parent.treeGrid.grid.notify("key-pressed",e)):d===this.parent.taskFields.name||d===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,d)):this.parent.treeGrid.grid.notify("key-pressed",e)}else(!n||n&&!n.classList.contains("e-headercell"))&&(r.classList.contains("e-headercell")&&this.manageFocus(r,"remove",!1),n&&!r.classList.contains("e-editedbatchcell")||this.parent.treeGrid.grid.notify("key-pressed",e));else n.classList.contains("e-headercell")||n.classList.contains("e-rowcell")||n.classList.contains("e-toolbar-item")||this.parent.treeGrid.grid.notify("key-pressed",e);if((!this.parent.editModule||!this.parent.editModule.cellEditModule||t.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn))&&n){if(r.classList.contains("e-rowcell")?this.manageFocus(r,"remove",!1):this.manageFocus(r,"remove",!0),n.classList.contains("e-rowcell")&&r.nextElementSibling&&!r.classList.contains("e-timeline-header-container")||r.classList.contains("e-right-label-container")){if(!r.classList.contains("e-rowcell")){this.parent.treeGrid.grid.notify("key-pressed",e);var h=t.getValue("focusModule",this.parent.treeGrid.grid);h.currentInfo.element=n,h.currentInfo.elementToFocus=n,h.content.matrix.current=[n.parentElement.rowIndex,n.cellIndex]}this.manageFocus(n,"add",!1)}else n&&(n.classList.contains("e-toolbar-item")||n.classList.contains("e-headercell")||n.classList.contains("e-rowcell"))?(this.manageFocus(r,"remove",!1),this.manageFocus(n,"add",!1),r.classList.contains("e-treegrid")&&e.preventDefault()):this.manageFocus(n,"add",!0);this.parent.focusModule.setActiveElement(n)}}}else this.manageFocus(r,"remove",!0)}},e.prototype.getNextElement=function(e,i,r){for(var a=i?e.nextElementSibling:e.previousElementSibling;a&&a.parentElement.classList.contains("e-row");){if(!a.matches(".e-hide")&&!a.matches(".e-rowdragdrop"))return a;a=i?a.nextElementSibling:a.previousElementSibling}if(!t.isNullOrUndefined(a)&&(a.classList.contains("e-taskbar-main-container")||a.classList.contains("e-right-connectorpoint-outer-div"))){var n=this.parent.currentViewData[this.focusedRowIndex];!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length>0&&(a=a.classList.contains("e-right-connectorpoint-outer-div")?a.parentElement.nextElementSibling:a.getElementsByClassName("e-gantt-child-taskbar-inner-div")[0])}if(this.validateNextElement(a))return a;var s=-1,o=null;if(e.classList.contains("e-rowcell")&&r&&this.parent.editSettings.allowNextRowEdit)return s=e.parentElement.rowIndex,o=this.getNextRowElement(s,i,!0),this.getChildElement(o,i);if(e.classList.contains("e-rowcell"))if(s=e.parentElement.rowIndex,i){if(o=this.parent.getRowByIndex(s),this.validateNextElement(o,"e-left-label-container"))return o.getElementsByClassName("e-left-label-container")[0];if(this.validateNextElement(o,"e-taskbar-main-container"))return o.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(o,"e-right-label-container"))return o.getElementsByClassName("e-right-label-container")[0]}else{if(o=this.getNextRowElement(s,i,!1),this.validateNextElement(o,"e-right-label-container"))return o.getElementsByClassName("e-right-label-container")[0];if(this.validateNextElement(o,"e-taskbar-main-container"))return o.getElementsByClassName("e-taskbar-main-container")[0];if(this.validateNextElement(o,"e-left-label-container"))return o.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")){s=t.closest(e,".e-chart-row").rowIndex,o=i?this.getNextRowElement(s,i,!0):this.parent.treeGrid.grid.getRowByIndex(s);return this.getChildElement(o,i)}if((a=e)&&a.parentElement.classList.contains("e-toolbar-item")&&this.parent.toolbarModule)for(;a&&a.parentElement.classList.contains("e-toolbar-item")&&a.parentElement.nextElementSibling.classList.contains("e-toolbar-item");){if(!a.parentElement.nextElementSibling.classList.contains("e-hidden"))return a.parentElement.nextElementSibling;a=a.parentElement.nextElementSibling.childNodes[0]}return null},e.prototype.getNextRowElement=function(e,t,i){var r=this.parent.getExpandedRecords(this.parent.currentViewData),a=this.parent.currentViewData[e],n=r.indexOf(a),s=t?r[n+1]:r[n-1],o=this.parent.currentViewData.indexOf(s);return s?i?this.parent.treeGrid.grid.getRowByIndex(o):this.parent.getRowByIndex(o):null},e.prototype.validateNextElement=function(e,i){if(e&&e.classList.contains("e-rowcell"))return!0;if(e&&i){var r=e.getElementsByClassName(i)[0];return!(!r||!r.hasChildNodes())}return!!e&&!(t.isNullOrUndefined(e)||!e.hasChildNodes())},e.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},e.prototype.manageFocus=function(e,i,r){if(r){var a=null;if(e.classList.contains("e-left-label-container")||e.classList.contains("e-right-label-container"))a=e.getElementsByTagName("span")[0];else if(e.classList.contains("e-taskbar-main-container")||e.classList.contains("e-gantt-child-taskbar-inner-div")){var n=t.closest(e,".e-chart-row").rowIndex,s=this.parent.currentViewData[n],o=s.hasChildRecords?s.ganttProperties.isAutoSchedule?"e-gantt-parent-taskbar":"e-manualparent-main-container":s.ganttProperties.isMilestone?"e-gantt-milestone":!t.isNullOrUndefined(s.ganttProperties.segments)&&s.ganttProperties.segments.length>0?"e-segmented-taskbar":"e-gantt-child-taskbar";a=e.getElementsByClassName(o)[0],t.isNullOrUndefined(a)&&(a=e)}(e.classList.contains("e-right-label-temp-container")||e.classList.contains("e-left-label-temp-container")||e.classList.contains("e-indicator-span"))&&("add"===i?(e.setAttribute("tabIndex","0"),t.addClass([e],"e-active-container"),e.focus()):(t.removeClass([e],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur())),"add"!==i||t.isNullOrUndefined(a)?t.isNullOrUndefined(a)||(t.removeClass([a],"e-active-container"),e.setAttribute("tabIndex","-1"),e.blur()):(e.setAttribute("tabIndex","0"),t.addClass([a],"e-active-container"),e.focus(),this.focusedElement=a)}else"add"===i?(e.setAttribute("tabIndex","0"),t.addClass([e],["e-focused","e-focus"]),e.focus()):(e.setAttribute("tabIndex","-1"),t.removeClass([e],["e-focused","e-focus"]),e.blur())},e.prototype.getIndexByTaskBar=function(e){var i,r;if(i=e.classList.contains(H)?e:t.closest(e,"div."+H),t.isNullOrUndefined(i))i=t.closest(e,"tr."+Q),r=[].slice.call(this.parent.chartRowsModule.ganttChartTableBody.childNodes).indexOf(i);else{var a=i.getAttribute("rowUniqueId"),n=this.parent.getRecordByID(a);r=this.parent.enableVirtualization&&this.parent.enableMultiTaskbar?this.parent.flatData.indexOf(n):this.parent.currentViewData.indexOf(n)}return r},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.scrollObject.destroy(),this.scrollObject=null},e}(),We=function(){return(We=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},qe=function(){function e(e){this.isZoomIn=!1,this.isZooming=!1,this.isZoomToFit=!1,this.topTierCollection=[],this.bottomTierCollection=[],this.parent=e,this.initProperties()}return e.prototype.initProperties=function(){this.timelineStartDate=null,this.timelineEndDate=null,this.totalTimelineWidth=0,this.customTimelineSettings=null,this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!t.isNullOrUndefined(this.parent.projectStartDate),this.parent.enablePersistence&&this.parent.isLoad&&(this.parent.timelineSettings=this.parent.currentZoomingLevel)},e.prototype.validateTimelineProp=function(){this.roundOffDays(),this.processTimelineProperty(),this.timelineWidthCalculation()},e.prototype.refreshTimeline=function(){this.initProperties(),this.processTimelineUnit(),this.parent.dataOperation.calculateProjectDates(),this.parent.isFromOnPropertyChange||this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff)},e.prototype.refreshTimelineByTimeSpan=function(){this.validateTimelineProp(),this.parent.ganttChartModule.chartTimelineContainer.innerHTML="",this.createTimelineSeries()},e.prototype.updateChartByNewTimeline=function(){this.parent.chartRowsModule.refreshChartByTimeline(),this.parent.notify("refreshDayMarkers",{})},e.prototype.processZooming=function(e){this.isZoomToFit=!1,this.parent.isProjectDateUpdated||this.parent.dateValidationModule.calculateProjectDates(),t.isNullOrUndefined(this.parent.zoomingProjectStartDate)||(this.parent.cloneProjectStartDate=this.parent.cloneProjectStartDate.getTime()<this.parent.zoomingProjectStartDate.getTime()?this.parent.cloneProjectStartDate:this.parent.zoomingProjectStartDate,this.parent.cloneProjectEndDate=this.parent.cloneProjectEndDate.getTime()>this.parent.zoomingProjectEndDate.getTime()?this.parent.cloneProjectEndDate:this.parent.zoomingProjectEndDate),this.parent.zoomingProjectStartDate=null,this.parent.zoomingProjectEndDate=null;var i=this.checkCurrentZoomingLevel();this.isZoomIn=e,this.isZooming=!0;var r=e?i+1:i-1;this.parent.toolbarModule&&(e?r===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)):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!0):r===this.parent.zoomingLevels[0].level?(this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1),this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!0)):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!0)),r=this.parent.zoomingLevels.findIndex(function(e){return e.level===r});var a=this.parent.zoomingLevels[r],n={requestType:e?"beforeZoomIn":"beforeZoomOut",timeline:a,cancel:!1};this.parent.trigger("actionBegin",n),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),n.cancel||(a=n.timeline,this.changeTimelineSettings(a))},e.prototype.changeTimelineSettings=function(e){var i=this;this.isZoomToFit?this.isSingleTier="None"===this.customTimelineSettings.topTier.unit||"None"===this.customTimelineSettings.bottomTier.unit:this.isZoomIn||(this.isSingleTier="None"===e.topTier.unit||"None"===e.bottomTier.unit);var r=this.isSingleTier?"None"===this.customTimelineSettings.topTier.unit?"topTier":"bottomTier":null;Object.keys(this.customTimelineSettings).forEach(function(a){if(a!==r)i.customTimelineSettings[a]="object"!=typeof e[a]||t.isNullOrUndefined(e[a])?e[a]:We({},e[a]);else{var n="topTier"===a?"bottomTier":"topTier";"None"!=e.bottomTier.unit&&(i.customTimelineSettings[n]=We({},e.bottomTier))}}),this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!t.isNullOrUndefined(this.parent.projectStartDate),this.processTimelineUnit(),this.parent.updateProjectDates(this.parent.cloneProjectStartDate,this.parent.cloneProjectEndDate,this.parent.isTimelineRoundOff);var a=this.parent.criticalPathModule;if(this.parent.enableCriticalPath&&a&&a.criticalConnectorLine(a.criticalPathCollection,a.detailPredecessorCollection,!0,a.predecessorCollectionTaskIds),this.isZooming||this.isZoomToFit){var n={requestType:this.isZoomIn?"AfterZoomIn":this.isZoomToFit?"AfterZoomToProject":"AfterZoomOut",timeline:this.parent.currentZoomingLevel};this.parent.trigger("actionComplete",n),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()}},e.prototype.processZoomToFit=function(){this.isZoomToFit=!0,this.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)),this.parent.dataOperation.calculateProjectDates();var e,i,r,a=(this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5,n=this.parent.ganttChartModule.chartElement.offsetWidth,s=n/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(i=o[l],l===o.length-1){e=o[l];break}if(r=o[l+1],s>=i.perDayWidth){e=o[l];break}if(s<i.perDayWidth&&s>r.perDayWidth){e=o[l+1];break}}var d=t.extend({},{},e,!0);this.roundOffDateToZoom(this.parent.cloneProjectStartDate,!0,s,d.bottomTier.unit,e),this.roundOffDateToZoom(this.parent.cloneProjectEndDate,!1,s,d.bottomTier.unit,e);var h=this.calculateNumberOfTimelineCells(d),p=this.parent.ganttChartModule.scrollElement.offsetHeight-17,c=this.parent.ganttChartModule.chartBodyContent.offsetHeight<=p?0:17;d.timelineUnitSize=Math.abs(n-c)/h;var u={requestType:"beforeZoomToProject",timeline:d};this.parent.toolbarModule&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin",this.parent.controlId+"_zoomout"],!0),this.parent.trigger("actionBegin",u),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),this.changeTimelineSettings(d),this.isZoomToFit=!1,this.parent.isTimelineRoundOff=!this.isZoomToFit&&!!t.isNullOrUndefined(this.parent.projectStartDate)}},e.prototype.bottomTierCellWidthCalc=function(e,t,i){var r;switch(e){case"Minutes":r=6e4*t.bottomTier.count;break;case"Hour":r=36e5*t.bottomTier.count;break;case"Week":r=6048e5*t.bottomTier.count;break;case"Day":r=864e5*t.bottomTier.count;break;case"Month":var a=new Date(i.getFullYear(),i.getMonth()+1,0).getDate();r=t.bottomTier.count*(86400*a*1e3);break;case"Year":var n=i.getFullYear()%400==0||i.getFullYear()%100!=0&&i.getFullYear()%4==0?366:365;r=t.bottomTier.count*(86400*n*1e3)}return r},e.prototype.roundOffDateToZoom=function(e,t,i,r,a){var n=this.bottomTierCellWidthCalc(r,a,e);t?e.setTime(e.getTime()-n):e.setTime(e.getTime()+n)},e.prototype.calculateNumberOfTimelineCells=function(e){var t=Math.abs((this.parent.cloneProjectEndDate.getTime()-this.parent.cloneProjectStartDate.getTime())/864e5),i=e.bottomTier.count,r=e.bottomTier.unit;return"Day"===r?t/i:"Week"===r?t/i/7:"Month"===r?t/i/28:"Year"===r?t/i/336:"Hour"===r?t*(24/i):t*(1440/i)},e.prototype.processTimelineUnit=function(){var e=["Year","Month","Week","Day","Hour","Minutes"];this.customTimelineSettings=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},e.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=this.customTimelineSettings.weekStartDay>=0&&this.customTimelineSettings.weekStartDay<=6?this.customTimelineSettings.weekStartDay:0,this.checkCurrentZoomingLevel()},e.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}},e.prototype.checkCurrentZoomingLevel=function(){var e="None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier.count:this.customTimelineSettings.topTier.count,t="None"!==this.customTimelineSettings.bottomTier.unit?this.customTimelineSettings.bottomTier.unit:this.customTimelineSettings.topTier.unit,i="None"!==this.customTimelineSettings.bottomTier.unit?"bottomTier":"topTier",r=this.getCurrentZoomingLevel(t,e,i);return this.parent.toolbarModule&&(r===this.parent.zoomingLevels[this.parent.zoomingLevels.length-1].level?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):r===this.parent.zoomingLevels[0].level&&this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),this.parent.currentZoomingLevel=this.parent.zoomingLevels[r],r},e.prototype.getCurrentZoomingLevel=function(e,t,i){var r,a,n,s,o;this.parent.zoomingLevels.length||(this.parent.zoomingLevels=this.parent.getZoomingLevels());var l=this.parent.zoomingLevels.filter(function(t){return"bottomTier"===i?t.bottomTier.unit===e:t.topTier.unit===e});if(0===l.length){var d=this.getClosestUnit(e,"",!1);l=this.parent.zoomingLevels.filter(function(e){return"bottomTier"===i?e.bottomTier.unit===d:e.topTier.unit===d})}for(var h=l.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){r=h[p].level;break}if(s=h[p+1],t>=o[""+i].count){a=h[p],r=(n=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===a.bottomTier.count:e.topTier.count===a.topTier.count})).length>1?this.checkCollectionsWidth(n):n[0].level;break}if(t<o[""+i].count&&t>s[""+i].count){a=h[p+1],r=(n=h.filter(function(e){return"bottomTier"===i?e.bottomTier.count===a.bottomTier.count:e.topTier.count===a.topTier.count})).length>1?this.checkCollectionsWidth(n):n[0].level;break}}return r},e.prototype.getClosestUnit=function(e,t,i){var r=["Year","Month","Week","Day","Hour","Minutes"],a=r.indexOf(e);0===a&&(i=!0),e=this.isZoomIn||i?r[a+1]:r[a-1];return 0===this.parent.zoomingLevels.filter(function(t){return t.bottomTier.unit===e}).length?("Year"===e&&(i=!0),t=e,this.getClosestUnit(e,t,i)):e},e.prototype.checkCollectionsWidth=function(e){for(var t,i,r,a=e,n=this.customTimelineSettings.timelineUnitSize,s=a.sort(function(e,t){return e.timelineUnitSize<t.timelineUnitSize?1:-1}),o=0;o<s.length;o++){if(r=s[o],o===s.length-1){t=s[o].level;break}if(i=s[o+1],n>=r.timelineUnitSize){t=s[o].level;break}if(n<r.timelineUnitSize&&n>i.timelineUnitSize){t=s[o+1].level;break}}return t},e.prototype.updateTimelineHeaderHeight=function(){if(this.parent.timelineModule.isSingleTier?(t.addClass([this.parent.ganttChartModule.chartTimelineContainer],U),this.parent.treeGrid.element&&(t.addClass(this.parent.treeGrid.element.querySelectorAll(".e-headercell"),U),t.addClass(this.parent.treeGrid.element.querySelectorAll(".e-columnheader"),U))):(t.removeClass([this.parent.ganttChartModule.chartTimelineContainer],U),this.parent.treeGrid.element&&(t.removeClass(this.parent.treeGrid.element.querySelectorAll(".e-headercell"),U),t.removeClass(this.parent.treeGrid.element.querySelectorAll(".e-columnheader"),U))),this.previousIsSingleTier!==this.isSingleTier){var e=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.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}},e.prototype.createTimelineSeries=function(){var e,i,r,a,n,s=this.isSingleTier?1:2,o="None"===this.topTier?"bottomTier":"topTier";this.updateTimelineHeaderHeight(),this.topTierCollection=[],this.bottomTierCollection=[];for(var l=0;l<s;l++)a=t.createElement("table",{className:F,styles:"display: block;"}),n=t.createElement("thead",{className:"e-timeline-header-table-body",styles:"display:block; border-collapse:collapse"}),e=t.createElement("tr",{innerHTML:this.createTimelineTemplate(o)}),i=t.createElement("th"),r=t.createElement("div",{styles:"width: 20px"}),i.appendChild(r),e.appendChild(i),n.appendChild(e),a.appendChild(n),this.parent.ganttChartModule.chartTimelineContainer.appendChild(a),o="bottomTier",e=null},e.prototype.validateCount=function(e,i,r){var a,n=!t.isNullOrUndefined(i)&&parseInt(i.toString(),10)>0?parseInt(i.toString(),10):1,s=Math.abs(this.timelineRoundOffEndDate.getTime()-this.timelineStartDate.getTime());switch(e){case"Year":n=n<=(a=Math.round(s/864e5/336))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Month":n=n<=(a=Math.round(s/864e5/28))?n:a>0?a+1:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Week":n=n<=(a=Math.round(s/864e5/7))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Day":n=n<=(a=Math.round(s/864e5))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Hour":n=n<=(a=Math.round(s/36e5))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n));break;case"Minutes":n=n<=(a=Math.round(s/6e4))?n:a>0?a:1,"None"!==this.topTier&&"bottomTier"===r&&(n=this.validateBottomTierCount(e,n))}return i!==n&&this.isZooming&&this.parent.toolbarModule&&("bottomTier"===r||this.isSingleTier)&&(this.isZoomIn?this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomin"],!1):this.parent.toolbarModule.enableItems([this.parent.controlId+"_zoomout"],!1)),n},e.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},e.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},e.prototype.extendFunction=function(e,t,i){for(var r=this,a={},n=0;n<t.length;n++)a[t[n]]=e[t[n]];return i&&Object.keys(i).forEach(function(t){a[t]=r.extendFunction(e[t],i[t],null)}),a},e.prototype.formatDateHeader=function(e,t){var i,r=new Date(t.getTime());return""===e?(i=this.parent.globalize.formatDate(r,{format:"E"}),i="zh"===this.parent.locale?i.slice(1):i.slice(0,1)):i=this.parent.globalize.formatDate(r,{format:e}),i},e.prototype.customFormat=function(e,i,r,a,n){return(n="string"==typeof n?t.getValue(n,window):n)(e,i,r,a)},e.prototype.createTimelineTemplate=function(e){var t,i,r=!1,a=this.parent,n="",s="",o="topTier"===e?a.timelineModule.customTimelineSettings.topTier.unit:a.timelineModule.customTimelineSettings.bottomTier.unit,l="topTier"===e?a.timelineModule.customTimelineSettings.topTier.count:a.timelineModule.customTimelineSettings.bottomTier.count,d=new Date(this.parent.timelineModule.timelineStartDate.toString()),h=new Date(this.timelineRoundOffEndDate.toString()),p=[];do{var c={};c.startDate=new Date(d.getTime()),"Month"===o&&"bottomTier"===e&&1!=l&&0===p.length&&(r=!0),s=this.getHeaterTemplateString(new Date(d.toString()),o,e,!1,l,c,r),p.push(new Date(d.toString())),r?i=this.calculateQuarterEndDate(d,l).getTime():(t=this.getIncrement(d,l,o),i=d.getTime()+t),r=!1,d.setTime(i),5===d.getHours()&&2===l&&"bottomTier"===e&&"Hour"===this.parent.timelineSettings.bottomTier.unit&&d.setTime(d.getTime()-36e5),d>=h&&(s=this.getHeaterTemplateString(p[p.length-1],o,e,!0,l,c)),n+=s;var u="topTier"===e?this.topTierCollection:this.bottomTierCollection;c.endDate=new Date(d.getTime()),u.push(c)}while(d<h);return n},e.prototype.updateTimelineAfterZooming=function(e,i){var r,a,n,s=document.getElementsByClassName("e-chart-scroll-container e-content")[0];if(!t.isNullOrUndefined(s)){var o=s.offsetWidth,l=s.offsetHeight,d=document.getElementsByClassName("e-chart-rows-container")[0].offsetHeight;if(r=Math.abs(this.timelineStartDate.getTime()-e.getTime()),r/=864e5,a="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),n=l<d?a*r+17:a*r,o>=n){var h=o-n;h=Math.round(h/a),e.setDate(e.getDate()+h),this.parent.timelineModule.timelineEndDate=e,i&&this.parent.updateProjectDates(this.timelineStartDate,this.timelineEndDate,this.parent.isTimelineRoundOff)}}},e.prototype.getTimelineRoundOffEndDate=function(e){var i="None"===this.topTier?this.bottomTier:this.topTier,r=new Date(e.toString());return this.parent.isTimelineRoundOff&&("Hour"===i?r.setMinutes(60):"Minutes"===i?r.setSeconds(60):r.setHours(24,0,0,0)),t.isNullOrUndefined(this.parent.projectEndDate)&&this.updateTimelineAfterZooming(r,!1),r},e.prototype.getIncrement=function(e,t,i){var r,a=new Date(e.getTime()),n=new Date(e.getTime());switch(i){case"Year":a=e,r=(n=new Date(e.getFullYear()+(t-1),11,31)).getTime()-a.getTime()+864e5;break;case"Month":a=e,r=(n=new Date(e.getFullYear(),e.getMonth()+t,1)).getTime()-a.getTime();break;case"Week":var s=this.parent.timelineModule.customTimelineSettings.weekStartDay,o=e.getDay()<s?s-e.getDay():6-e.getDay()+s;t=o>0?t-1:0,n.setHours(24,0,0,0),o=e.getDay()<s&&o>0?o-1:o,n.setDate(n.getDate()+(o+7*t)),r=n.getTime()-a.getTime();break;case"Day":n.setHours(24,0,0,0),r=n.getTime()-a.getTime()+864e5*(t-1);break;case"Hour":n.setMinutes(60),n.setSeconds(0),r=n.getTime()-a.getTime()+36e5*(t-1),r=this.checkDate(a,n,r,t);break;case"Minutes":n.setSeconds(60),r=n.getTime()-a.getTime()+6e4*(t-1)}return r},e.prototype.checkDate=function(e,t,i,r){var a=new Date(e.getTime());if(a.setTime(a.getTime()+i),1!==r&&(a.getTime()-t.getTime())/36e5!=r&&e.getTimezoneOffset()!==a.getTimezoneOffset()){var n=r-(a.getTime()-t.getTime())/36e5;this.parent.isInDst(a)?this.parent.isInDst(a)&&2!==r&&(i-=36e5*n):i+=36e5*n}return i},e.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()))},e.prototype.calculateQuarterEndDate=function(e,t){var i=e.getMonth();return 3===t?i>=0&&i<=2?new Date(e.getFullYear(),3,1):i>=3&&i<=5?new Date(e.getFullYear(),6,1):i>=6&&i<=8?new Date(e.getFullYear(),9,1):new Date(e.getFullYear()+1,0,1):i>=0&&i<=5?new Date(e.getFullYear(),6,1):new Date(e.getFullYear()+1,0,1)},e.prototype.getHeaterTemplateString=function(e,i,r,a,n,s,o){var l,d="",h="",p="topTier"===r?this.parent.timelineModule.customTimelineSettings.topTier.format:this.parent.timelineModule.customTimelineSettings.bottomTier.format,c="topTier"===r?this.parent.timelineModule.customTimelineSettings.topTier.formatter:this.parent.timelineModule.customTimelineSettings.bottomTier.formatter,u=t.isNullOrUndefined(c)?this.parent.globalize.formatDate(e,{format:this.parent.getDateFormat()}):this.customFormat(e,p,r,i,c),g=l=this.getIncrement(e,n,i)/864e5*this.parent.perDayWidth;l=a||o?a?this.calculateWidthBetweenTwoDate(i,e,this.timelineRoundOffEndDate):this.calculateWidthBetweenTwoDate(i,e,this.calculateQuarterEndDate(e,n)):l;var f=this.isWeekendHeaderCell(i,r,e),m="topTier"===r?" e-gantt-top-cell-text":"",y=t.isNullOrUndefined(c)?this.formatDateHeader(p,e):this.customFormat(e,p,r,i,c);return h+=this.parent.timelineModule.isSingleTier?'<th class="e-timeline-single-header-cell ':'<th class="e-timeline-top-header-cell',h+=f?" e-weekend-header-cell":"",h+='" tabindex="-1" aria-label= "'+this.parent.localeObj.getConstant("timelineCell")+" "+u,h+='" style="width:'+l+"px;",h+=f&&this.customTimelineSettings.weekendBackground?"background-color:"+this.customTimelineSettings.weekendBackground+";":"",h+='"><div class="e-header-cell-label'+m+'" style="width:'+(l-1)+"px;"+(this.parent.timelineSettings.showTooltip?'"title="'+u:""),h+='">'+y+"</div>",d+=h,d+="</th>",!this.isSingleTier&&"topTier"!==r||a?(this.isSingleTier||"topTier"===r)&&a&&(this.totalTimelineWidth=this.totalTimelineWidth-g+l):this.totalTimelineWidth=this.totalTimelineWidth+l,s.value=y,s.isWeekend=f,s.width=g,d},e.prototype.calculateWidthBetweenTwoDate=function(e,t,i){return(i.getTime()-t.getTime())/864e5*this.parent.perDayWidth},e.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},e.prototype.getPerDayWidth=function(e,t,i){var r;switch(i){case"Year":r=e/t/336;break;case"Month":r=e/t/28;break;case"Week":r=e/t/7;break;case"Day":r=e/t;break;case"Hour":r=24/t*e;break;case"Minutes":r=1440/t*e}return r},e.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 r=this.parent.timelineModule.customTimelineSettings.weekStartDay,a=e.getDay()<r?e.getDate()-(7-r+e.getDay()):e.getDate()-e.getDay()+r;e.setDate(a);var n=t.getDate()-t.getDay()+6+r;t.setDate(n)}"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)},e.prototype.updateScheduleDatesByToolBar=function(e,t,i,r){if("Year"===e&&("prevTimeSpan"===t?i=0===i.getMonth()?new Date(i.getFullYear()-1,0,1):new Date(i.getFullYear(),0,1):r=11===r.getMonth()?new Date(r.getFullYear()+1,0,1):new Date(r.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):r=new Date(r.getFullYear(),r.getMonth()+1,1)),"Week"===e){var a=this.parent.timelineModule.customTimelineSettings.weekStartDay,n=void 0;"prevTimeSpan"===t?(n=i.getDay()<a?7-(a-i.getDay()):i.getDay()-a,i.setHours(0,0,0,0),0===n?i.setDate(i.getDate()-7):i.setDate(i.getDate()-n)):(n=r.getDay()<a?a-r.getDay():7-r.getDay()+a,r.setHours(0,0,0,0),0===n?r.setDate(r.getDate()+6):r.setDate(r.getDate()+n))}"Day"===e&&("prevTimeSpan"===t?0===i.getHours()?i.setTime(i.getTime()-864e5):i.setHours(0):0===r.getHours()?r.setTime(r.getTime()+864e5):r.setHours(24)),"Hour"===e&&("prevTimeSpan"===t?0===i.getMinutes()?i.setTime(i.getTime()-36e5):i.setMinutes(0):0===r.getMinutes()?r.setTime(r.getTime()+36e5):r.setMinutes(60)),"Minutes"===e&&("prevTimeSpan"===t?0===i.getSeconds()?i.setTime(i.getTime()-6e4):i.setSeconds(0):0===r.getSeconds()?r.setTime(r.getTime()+6e4):r.setSeconds(60)),this.parent.cloneProjectStartDate=i,this.parent.cloneProjectEndDate=r},e.prototype.updateTimeLineOnEditing=function(e,i){if(e[0].length>=1)for(var r=0;r<e.length;r++){var n=e[r],s=n.filter(function(e){return!t.isNullOrUndefined(e.ganttProperties.startDate)}),o=n.filter(function(e){return!t.isNullOrUndefined(e.ganttProperties.endDate)}),l=s.length>0?new Date(a.DataUtil.aggregates.min(s,"ganttProperties.startDate")):null,d=o.length>0?new Date(a.DataUtil.aggregates.max(o,"ganttProperties.endDate")):null,h=new Date(this.parent.dataOperation.checkStartDate(this.timelineStartDate).getTime()),p=new Date(this.parent.dataOperation.checkEndDate(this.timelineEndDate).getTime()),c=t.isNullOrUndefined(l)?null:this.parent.dataOperation.getTaskLeft(l,!1),u=t.isNullOrUndefined(d)?null:this.parent.dataOperation.getTaskLeft(d,!1),g=this.parent.dataOperation.getTaskLeft(h,!1),f=this.parent.dataOperation.getTaskLeft(p,!1),m=void 0,y=this.parent.editModule.taskbarEditModule;!t.isNullOrUndefined(c)&&(l<this.timelineStartDate||!t.isNullOrUndefined(y)&&!t.isNullOrUndefined(y.taskBarEditAction)&&"ProgressResizing"!==y.taskBarEditAction&&"RightResizing"!==y.taskBarEditAction)&&(c<this.bottomTierCellWidth||c<=g)?(m="prevTimeSpan",l=l>this.timelineStartDate?this.timelineStartDate:l):l=this.timelineStartDate,!t.isNullOrUndefined(u)&&(u>=this.totalTimelineWidth-this.bottomTierCellWidth||u>=f)?(m="prevTimeSpan"===m?"both":"nextTimeSpan",d=d<this.timelineEndDate?this.timelineEndDate:d):d=this.timelineEndDate,m?this.performTimeSpanAction(m,i,l,d):t.isNullOrUndefined(n[0].ganttProperties.segments)||this.parent.dataOperation.updateWidthLeft(n[0]);break}},e.prototype.performTimeSpanAction=function(e,i,r,a,n){n=t.isNullOrUndefined(n)?"None"===this.parent.timelineModule.topTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier:n;var s=new Date(this.parent.cloneProjectStartDate.getTime()),o=new Date(this.parent.cloneProjectEndDate.getTime());"publicMethod"!==i&&"both"===e?(this.updateScheduleDatesByToolBar(n,"prevTimeSpan",r,a),this.updateScheduleDatesByToolBar(n,"nextTimeSpan",new Date(this.parent.cloneProjectStartDate.getTime()),a)):this.updateScheduleDatesByToolBar(n,e,r,a);var l=this.timeSpanActionEvent("actionBegin",e,i);if(l.cancel)this.parent.cloneProjectStartDate=s,this.parent.cloneProjectEndDate=o;else{if(this.parent.updateProjectDates(l.projectStartDate,l.ProjectEndDate,l.isTimelineRoundOff,i),"prevTimeSpan"===e&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(0);else if("nextTimeSpan"===e&&"publicMethod"===i)this.parent.ganttChartModule.updateScrollLeft(this.parent.timelineModule.totalTimelineWidth);else if("nextTimeSpan"===e&&"TaskbarEditing"===i){var d=document.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollLeft;this.parent.element.querySelector(".e-timeline-header-container").scrollLeft=d}this.parent.timelineModule.timeSpanActionEvent("actionComplete",e,i)}},e.prototype.timeSpanActionEvent=function(e,t,i){var r={};return r.projectStartDate=new Date(this.parent.cloneProjectStartDate.getTime()),r.ProjectEndDate=new Date(this.parent.cloneProjectEndDate.getTime()),r.requestType="publicMethod"===i?t:"beforeAdd"===i?"TimelineRefreshOnAdd":"TaskbarEditing"===i?"TimelineRefreshOnEdit":t,"actionBegin"===e&&(r.isTimelineRoundOff=this.parent.isTimelineRoundOff,r.cancel=!1),r.action="TimescaleUpdate",this.parent.trigger(e,r),r},e}(),Ge=function(){return function(e){this.allowEditing=!0,this.allowReordering=!0,this.allowResizing=!0,this.allowSorting=!0,this.allowFiltering=!0,this.edit={},t.merge(this,e)}}(),ze=function(){function e(e){var i=this;this.previousScroll={top:0,left:0},this.queryCellInfo=function(e){i.parent.trigger("queryCellInfo",e)},this.headerCellInfo=function(e){i.parent.trigger("headerCellInfo",e)},this.rowDataBound=function(e){i.parent.trigger("rowDataBound",e)},this.columnMenuOpen=function(e){i.parent.notify("columnMenuOpen",e),i.parent.trigger("columnMenuOpen",e),document.querySelector(".e-colmenu").addEventListener("mousemove",function(e){var r=document.querySelector(".e-filter-popup"),a=document.querySelector(".e-filter-item");t.isNullOrUndefined(r)||a.classList.contains("e-focused")||t.remove(i.parent.filterModule.filterMenuElement)})},this.columnMenuClick=function(e){i.parent.trigger("columnMenuClick",e)},this.objectEqualityChecker=function(e,t){if(e){for(var r=Object.keys(e),a=!0,n=["Children","childRecords","taskData","uniqueID","parentItem","parentUniqueID","ganttProperties"],s=0;s<r.length;s++){if((e[r[s]]instanceof Date?new Date(e[r[s]]).getTime():e[r[s]])!==(t[r[s]]instanceof Date?new Date(t[r[s]]).getTime():t[r[s]])&&-1===n.indexOf(r[s])){i.parent.modifiedRecords.push(t),a=!1;break}}return a}return!1},this.parent=e,this.parent.treeGrid=new n.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=t.extend([],[],this.parent.columns,!0)),this.validateGanttColumns(),this.parent.isLocaleChanged&&(this.parent.isLocaleChanged=!1),this.addEventListener()}return e.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)},e.prototype.renderReactTemplate=function(e){this.parent.portals=e,this.parent.renderTemplates()},e.prototype.createContainer=function(){this.treeGridElement=t.createElement("div",{id:"treeGrid"+this.parent.element.id,className:"e-gantt-tree-grid"});var e=t.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")},e.prototype.renderTreeGrid=function(){this.composeProperties(),this.bindEvents();this.parent.treeGrid.root=this.parent.root?this.parent.root:this.parent,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()},e.prototype.composeProperties=function(){if(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=t.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&&y(this.parent)){this.parent.treeGrid.hasChildMapping="isParent";var e=t.getValue("count",this.parent.dataSource);this.parent.treeGrid.dataSource={result:this.parent.flatData,count:e}}else 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;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||this.parent.toolbarModule.element.offsetHeight,this.parent.treeGrid.height=this.parent.element.getElementsByClassName("e-chart-scroll-container e-content")[0].offsetHeight-19},e.prototype.getContentDiv=function(){return this.treeGridElement.querySelector(".e-content")},e.prototype.getHeaderDiv=function(){return this.treeGridElement.querySelector(".e-headercontent")},e.prototype.getScrollbarWidth=function(){var e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",e.style.msOverflowStyle="scrollbar";var t=document.createElement("div");e.appendChild(t),this.parent.element.appendChild(e);var i=e.offsetWidth-t.offsetWidth;return e.parentNode.removeChild(e),i},e.prototype.ensureScrollBar=function(){var e=this.getContentDiv(),t=this.getHeaderDiv(),i=this.getScrollbarWidth(),r=/Android|Mac|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);0!==i?e.style.cssText+="width: calc(100% + "+(i+1)+"px);":e.classList.add("e-gantt-scroll-padding"),0===i&&r&&(t.style.cssText+="width: calc(100% + 17px);")},e.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.queryCellInfo=this.queryCellInfo.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)},e.prototype.beforeDataBound=function(e){this.parent.updatedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?t.getValue("virtualScrollModule.visualData",this.parent.treeGrid):t.getValue("result",e),this.parent.virtualScrollModule&&this.parent.enableVirtualization&&this.parent.updateContentHeight(e),t.setValue("contentModule.objectEqualityChecker",this.objectEqualityChecker,this.parent.treeGrid.grid)},e.prototype.dataBound=function(e){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.isVirtualScroll=!1),this.prevCurrentView=t.extend([],[],this.parent.currentViewData,!0)},e.prototype.dataStateChange=function(e){e.action&&"refresh"===e.action.requestType&&(this.parent.treeGrid.dataSource={result:t.getValue("result",this.parent.treeGrid.dataSource),count:t.getValue("count",this.parent.treeGrid.dataSource)}),this.parent.trigger("dataStateChange",e)},e.prototype.collapsing=function(e){new a.Deferred;var i,r=t.getValue("data",e),n=r.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart)if(t.isNullOrUndefined(n))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.collapseGanttRow(i),t.setValue("cancel",t.getValue("cancel",i),e);else{for(var s=0;s<n;s++)i=this.createExpandCollapseArgs(e,r[s]),this.parent.ganttChartModule.collapseGanttRow(i);t.setValue("cancel",t.getValue("cancel",i),e)}},e.prototype.expanding=function(e){new a.Deferred;var i,r=t.getValue("data",e),n=r.length;if(!this.parent.ganttChartModule.isExpandCollapseFromChart)if(t.isNullOrUndefined(n))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.expandGanttRow(i),t.setValue("cancel",t.getValue("cancel",i),e);else{for(var s=0;s<n;s++)i=this.createExpandCollapseArgs(e,r[s]),this.parent.ganttChartModule.expandGanttRow(i);t.setValue("cancel",t.getValue("cancel",i),e)}},e.prototype.collapsed=function(e){if(!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var i=void 0,r=t.getValue("data",e),a=r.length;if(t.isNullOrUndefined(a))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.collapsedGanttRow(i);else for(var n=0;n<a;n++)i=this.createExpandCollapseArgs(e,r[n]),this.parent.ganttChartModule.collapsedGanttRow(i);"ResourceView"===this.parent.viewType&&!this.parent.allowTaskbarOverlap&&i.gridRow&&(i.gridRow.style.height=i.chartRow.style.height,this.parent.contentHeight=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.parent.trigger("collapsed",e)},e.prototype.expanded=function(e){if(!this.parent.ganttChartModule.isExpandCollapseFromChart&&!this.parent.isExpandCollapseLevelMethod){var i=void 0,r=t.getValue("data",e),a=r.length;if(t.isNullOrUndefined(a))i=this.createExpandCollapseArgs(e,null),this.parent.ganttChartModule.expandedGanttRow(i);else for(var n=0;n<a;n++)i=this.createExpandCollapseArgs(e,r[n]),this.parent.ganttChartModule.expandedGanttRow(i);"ResourceView"===this.parent.viewType&&!this.parent.allowTaskbarOverlap&&e.row&&(e.row.style.height=this.parent.rowHeight+"px",this.parent.contentHeight=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px")}t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.parent.trigger("expanded",e)},e.prototype.actionBegin=function(e){this.parent.notify("actionBegin",e);null!==t.getValue("doubleClickTarget",this.parent.treeGrid.editModule)&&t.setValue("doubleClickTarget",null,this.parent.treeGrid.editModule),this.parent.trigger("actionBegin",e),"virtualscroll"!=e.requestType&&"edit"!=e.type&&"beginEdit"!=e.requestType&&(t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow())},e.prototype.created=function(e){this.updateKeyConfigSettings()},e.prototype.actionFailure=function(e){this.parent.trigger("actionFailure",e)},e.prototype.createExpandCollapseArgs=function(e,i){var r=t.getValue("data",e).length;if(t.isNullOrUndefined(r)){var a=t.getValue("data",e);return{data:a,gridRow:t.getValue("row",e),chartRow:this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(a)],cancel:!1}}return{data:i,gridRow:t.getValue("row",e),chartRow:this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(i)],cancel:!1}},e.prototype.treeActionComplete=function(e){var i=t.extend({},e);if("sorting"===t.getValue("requestType",e))this.parent.notify("updateModel",{}),t.deleteObject(i,"isFrozen");else if("filtering"===t.getValue("requestType",e)){this.parent.notify("updateModel",{});this.parent.element.querySelector(".e-treegrid").focus()}else if("save"===t.getValue("type",e)&&this.parent.editModule&&this.parent.editModule.cellEditModule){var r=t.getValue("data",e);t.isNullOrUndefined(r)||t.isNullOrUndefined(this.parent.getTaskByUniqueID(r.uniqueID))||(this.parent.getTaskByUniqueID(r.uniqueID).taskData[this.parent.taskFields.duration]=r.taskData[this.parent.taskFields.duration],t.isNullOrUndefined(r.taskData[this.parent.taskFields.resourceInfo])||(this.parent.getTaskByUniqueID(r.uniqueID).taskData[this.parent.taskFields.resourceInfo]=r.taskData[this.parent.taskFields.resourceInfo])),this.parent.editModule.cellEditModule.initiateCellEdit(e,this.currentEditRow),this.currentEditRow={}}if("filterafteropen"===t.getValue("requestType",e)&&this.parent.notify("actionComplete",e),"searching"===t.getValue("requestType",e)&&this.parent.notify("actionComplete",e),t.isNullOrUndefined(t.getValue("batchChanges",e))||t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),this.parent.isCancelled&&(t.setValue("requestType","cancel",i),t.setValue("action","CellEditing",i),this.parent.isCancelled=!1),"refresh"===t.getValue("requestType",e)&&t.isNullOrUndefined(t.getValue("type",e))&&this.parent.addDeleteRecord&&(-1!=this.parent.selectedRowIndex?(this.parent.selectRow(this.parent.selectedRowIndex),this.parent.selectedRowIndex>this.parent.currentViewData.length-1&&(this.parent.selectedRowIndex=-1)):this.parent.selectRow(0),this.parent.addDeleteRecord=!1),this.parent.trigger("actionComplete",i),"ResourceView"===this.parent.viewType&&!this.parent.allowTaskbarOverlap&&this.parent.showOverAllocation){for(var a=0;a<this.parent.currentViewData.length;a++)this.parent.currentViewData[a].hasChildRecords&&!this.parent.currentViewData[a].expanded&&this.parent.chartRowsModule.updateDragDropRecords(this.parent.currentViewData[a]);this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData)}t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()},e.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},e.prototype.wireEvents=function(){var e=this.parent.treeGrid.element.querySelector(".e-content");e&&t.EventHandler.add(e,"scroll",this.scrollHandler,this),this.parent.isAdaptive&&t.EventHandler.add(this.parent.treeGridPane,"click",this.treeGridClickHandler,this)},e.prototype.unWireEvents=function(){var e=this.parent.treeGrid.element&&this.parent.treeGrid.element.querySelector(".e-content");e&&t.EventHandler.remove(e,"scroll",this.scrollHandler),this.parent.isAdaptive&&t.EventHandler.remove(this.parent.treeGridPane,"click",this.treeGridClickHandler)},e.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()},e.prototype.validateGanttColumns=function(){var e=this.parent,i=e.columns.length,r=this.parent.taskFields;this.parent.columnMapping={},this.parent.columnByField={},this.parent.customColumns=[];for(var a=["id","name","startDate","endDate","duration","dependency","progress","baselineStartDate","baselineEndDate","resourceInfo","notes","work","manual","type","milestone"],n=function(t){var i={};"string"==typeof e.columns[t]?i.field=e.columns[t]:i=e.columns[t];var n=[];if(a.length>0&&(n=a.filter(function(e){return i.field===r[e]})),0===n.length)return i.field===s.parent.resourceFields.group?"continue":(s.parent.customColumns.push(i.field),i.headerText=i.headerText?i.headerText:i.field,i.width=i.width?i.width:150,i.editType=i.editType?i.editType:"stringedit",i.type=i.type?i.type:"string",s.bindTreeGridColumnProperties(i,!0),"continue");var o=a.indexOf(n[0]);a.splice(o,1),s.createTreeGridColumn(i,!0),s.parent.columnMapping[n[0]]=i.field},s=this,o=0;o<i;o++)n(o);for(var l=0;l<a.length;l++){var d={};t.isNullOrUndefined(r[a[l]])||(d.field=r[a[l]],this.createTreeGridColumn(d,0===i),this.parent.columnMapping[a[l]]=d.field)}if("ProjectView"!==this.parent.viewType){d={};this.composeUniqueIDColumn(d),this.createTreeGridColumn(d,!0)}},e.prototype.createTreeGridColumn=function(e,i){var r=this.parent.taskFields,n=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];if(e.disableHtmlEncode=t.isNullOrUndefined(e.disableHtmlEncode)?this.parent.disableHtmlEncode:e.disableHtmlEncode,r.id!==e.field&&(e.clipMode=e.clipMode?e.clipMode:"EllipsisWithTooltip"),r.id===e.field)this.composeIDColumn(e);else if(r.name===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("name"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("name"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"stringedit",e.type=e.type?e.type:"string";else if(r.startDate===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("startDate"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("startDate"),e.editType=e.editType?e.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",e.format=e.format?e.format:{type:"date",format:this.parent.getDateFormat()},e.width=e.width?e.width:150,(!e.edit||e.edit&&!e.edit.create)&&(e.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}});else if(r.endDate===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("endDate"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("endDate"),e.format=e.format?e.format:{type:"date",format:this.parent.getDateFormat()},e.editType=e.editType?e.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit",e.width=e.width?e.width:150,(!e.edit||e.edit&&!e.edit.create)&&(e.edit={params:{renderDayCell:this.parent.renderWorkingDayCell.bind(this.parent)}});else if(r.duration===e.field)e.width=e.width?e.width:150,this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("duration"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("duration"),e.valueAccessor=e.valueAccessor?e.valueAccessor:t.isNullOrUndefined(e.edit)?this.durationValueAccessor.bind(this):null,e.editType=e.editType?e.editType:"stringedit",e.type=e.type?e.type:"string";else if(r.progress===e.field)this.composeProgressColumn(e);else if(r.dependency===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("dependency"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("dependency"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"stringedit",e.type="string",e.allowFiltering=!1!==e.allowFiltering;else if(r.resourceInfo===e.field)this.composeResourceColumn(e);else if(r.notes===e.field)this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("notes"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("notes"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"stringedit",this.parent.showInlineNotes||e.template||(e.template='<div class="e-ganttnotes-info"><span class="e-icons e-notes-info"></span></div>');else if(r.baselineStartDate===e.field||r.baselineEndDate===e.field){var s=r.baselineEndDate===e.field?"baselineEndDate":"baselineStartDate";e.width=e.width?e.width:150,this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant(s):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant(s),e.format=e.format?e.format:{type:"date",format:this.parent.getDateFormat()},e.editType=e.editType?e.editType:-1!==this.parent.getDateFormat().toLowerCase().indexOf("hh")?"datetimepickeredit":"datepickeredit"}else r.work===e.field?(this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("work"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("work"),e.width=e.width?e.width:150,e.valueAccessor=e.valueAccessor?e.valueAccessor:this.workValueAccessor.bind(this),e.editType=e.editType?e.editType:"numericedit"):r.type===e.field?(this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("taskType"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("taskType"),e.width=e.width?e.width:150,e.editType="dropdownedit",e.valueAccessor=e.valueAccessor?e.valueAccessor:this.taskTypeValueAccessor.bind(this)):r.manual===e.field&&"Custom"===this.parent.taskMode&&(this.parent.isLocaleChanged&&n?e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("taskMode"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("taskMode"),e.width=e.width?e.width:120,e.editType=e.editType?e.editType:"dropdownedit",e.valueAccessor=e.valueAccessor?e.valueAccessor:this.modeValueAccessor.bind(this),e.edit={params:{query:new a.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"}}});this.bindTreeGridColumnProperties(e,i)},e.prototype.composeResourceColumn=function(e){var t=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];this.parent.isLocaleChanged&&t?e.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("resourceName"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("resourceName"),e.width=e.width?e.width:150,e.type="string",e.valueAccessor=e.valueAccessor?e.valueAccessor:this.resourceValueAccessor.bind(this),e.allowFiltering=!1!==e.allowFiltering},e.prototype.getResourceIds=function(e){var i=t.getValue(this.parent.taskFields.resourceInfo,e.taskData),r=[];if(t.isNullOrUndefined(i))return i;for(var a=0;a<i.length;a++)r.push("object"==typeof i[a]?i[a][this.parent.resourceFields.id]:i[a]);return r},e.prototype.composeIDColumn=function(e){var i,r="ProjectView"===this.parent.viewType,a=this.parent.dataSource.length;if(e.isPrimaryKey=!!r,this.parent.isLocaleChanged){var n=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];n&&(e.headerText=n.headerText?n.headerText:this.parent.localeObj.getConstant("id"))}else e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("id");e.width=e.width?e.width:100;for(var s=0;s<a;s++)if(!t.isNullOrUndefined(this.parent.dataSource[s][this.parent.taskFields.id])){i=this.parent.dataSource[s][this.parent.taskFields.id];break}"string"==typeof i||t.isNullOrUndefined(i)?("ResourceView"===this.parent.viewType?e.allowEditing=!!e.allowEditing&&e.allowEditing:e.allowEditing=!e.allowEditing||e.allowEditing,e.editType=e.editType?e.editType:"stringedit"):(e.allowEditing=!!e.allowEditing&&e.allowEditing,e.editType=e.editType?e.editType:"numericedit"),e.valueAccessor=r?null:this.idValueAccessor.bind(this)},e.prototype.composeUniqueIDColumn=function(e){e.field="rowUniqueID",e.isPrimaryKey=!0,e.headerText="UniqueID",e.allowEditing=!1,e.visible=!1},e.prototype.composeProgressColumn=function(e){var t=this.parent.previousGanttColumns.filter(function(t){return e.field==t.field})[0];this.parent.isLocaleChanged&&t?e.headerText=t.headerText?t.headerText:this.parent.localeObj.getConstant("progress"):e.headerText=e.headerText?e.headerText:this.parent.localeObj.getConstant("progress"),e.width=e.width?e.width:150,e.editType=e.editType?e.editType:"numericedit"},e.prototype.bindTreeGridColumnProperties=function(e,t){for(var i={},r={},a=0,n=Object.keys(e);a<n.length;a++){var s=n[a];i[s]=r[s]=e[s]}this.parent.columnByField[r.field]=r,this.parent.ganttColumns.push(new Ge(r)),t&&this.treeGridColumns.push(i)},e.prototype.durationValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":this.parent.dataOperation.getDurationString(a.duration,a.durationUnit)},e.prototype.resourceValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":a.resourceNames},e.prototype.workValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":this.parent.dataOperation.getWorkString(a.work,a.workUnit)},e.prototype.taskTypeValueAccessor=function(e,i,r){var a=i.ganttProperties;return t.isNullOrUndefined(a)?"":a.taskType},e.prototype.modeValueAccessor=function(e,t,i){return t[e]?"Manual":"Auto"},e.prototype.idValueAccessor=function(e,t,i){return 0===t.level?"R-"+t.ganttProperties.taskId:"T-"+t.ganttProperties.taskId},e.prototype.updateScrollTop=function(e){var i;i=t.getValue("top",e)>this.parent.flatData.length*this.parent.rowHeight?t.getValue("top",e)-document.getElementsByClassName("e-chart-scroll-container e-content")[0].offsetHeight:t.getValue("top",e),this.treeGridElement.querySelector(".e-content").scrollTop=i,this.previousScroll.top=this.treeGridElement.querySelector(".e-content").scrollTop},e.prototype.treeGridClickHandler=function(e){this.parent.notify("treeGridClick",e)},e.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)},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents(),this.parent.treeGrid.element&&this.parent.treeGrid.destroy()},e}(),_e=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Xe=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ye=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return _e(i,e),Xe([t.Property(null)],i.prototype,"from",void 0),Xe([t.Property(null)],i.prototype,"to",void 0),i}(t.ChildProperty),Ze=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qe=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ke=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ze(i,e),Qe([t.Property(null)],i.prototype,"type",void 0),Qe([t.Property(null)],i.prototype,"headerText",void 0),Qe([t.Property([])],i.prototype,"fields",void 0),i}(t.ChildProperty),Je=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),$e=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},et=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Je(i,e),$e([t.Property(null)],i.prototype,"type",void 0),$e([t.Property(null)],i.prototype,"headerText",void 0),$e([t.Property([])],i.prototype,"fields",void 0),i}(t.ChildProperty),tt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),it=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},rt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return tt(i,e),it([t.Property(!1)],i.prototype,"allowEditing",void 0),it([t.Property(!1)],i.prototype,"allowAdding",void 0),it([t.Property(!1)],i.prototype,"allowDeleting",void 0),it([t.Property("Auto")],i.prototype,"mode",void 0),it([t.Property("Top")],i.prototype,"newRowPosition",void 0),it([t.Property(!1)],i.prototype,"showDeleteConfirmDialog",void 0),it([t.Property(!1)],i.prototype,"allowTaskbarEditing",void 0),it([t.Property(!1)],i.prototype,"allowNextRowEdit",void 0),i}(t.ChildProperty),at=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),nt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},st=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return at(i,e),nt([t.Property(null)],i.prototype,"day",void 0),nt([t.Property(null)],i.prototype,"label",void 0),nt([t.Property(null)],i.prototype,"cssClass",void 0),i}(t.ChildProperty),ot=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),lt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},dt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ot(i,e),lt([t.Collection([],r.Predicate)],i.prototype,"columns",void 0),lt([t.Property("Menu")],i.prototype,"type",void 0),lt([t.Property()],i.prototype,"operators",void 0),lt([t.Property(!1)],i.prototype,"ignoreAccent",void 0),lt([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),ht=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),pt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ct=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ht(i,e),pt([t.Property([])],i.prototype,"fields",void 0),pt([t.Property(!1)],i.prototype,"ignoreCase",void 0),pt([t.Property("contains")],i.prototype,"operator",void 0),pt([t.Property("")],i.prototype,"key",void 0),pt([t.Property("Parent")],i.prototype,"hierarchyMode",void 0),i}(t.ChildProperty),ut=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),gt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ft=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return ut(i,e),gt([t.Property(null)],i.prototype,"from",void 0),gt([t.Property(null)],i.prototype,"to",void 0),gt([t.Property(null)],i.prototype,"label",void 0),gt([t.Property(null)],i.prototype,"cssClass",void 0),i}(t.ChildProperty),mt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),yt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Dt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return mt(i,e),yt([t.Property(null)],i.prototype,"rightLabel",void 0),yt([t.Property(null)],i.prototype,"leftLabel",void 0),yt([t.Property(null)],i.prototype,"taskLabel",void 0),i}(t.ChildProperty),vt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),wt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},kt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return vt(i,e),wt([t.Property("Row")],i.prototype,"mode",void 0),wt([t.Property("Flow")],i.prototype,"cellSelectionMode",void 0),wt([t.Property("Single")],i.prototype,"type",void 0),wt([t.Property(!1)],i.prototype,"persistSelection",void 0),wt([t.Property(!1)],i.prototype,"enableToggle",void 0),i}(t.ChildProperty),Tt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),bt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Pt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Tt(i,e),bt([t.Property(null)],i.prototype,"position",void 0),bt([t.Property(-1)],i.prototype,"columnIndex",void 0),bt([t.Property(4)],i.prototype,"separatorSize",void 0),bt([t.Property(null)],i.prototype,"minimum",void 0),bt([t.Property("Default")],i.prototype,"view",void 0),i}(t.ChildProperty),St=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ct=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Mt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return St(i,e),Ct([t.Property(null)],i.prototype,"id",void 0),Ct([t.Property(null)],i.prototype,"name",void 0),Ct([t.Property(null)],i.prototype,"parentID",void 0),Ct([t.Property(null)],i.prototype,"startDate",void 0),Ct([t.Property(null)],i.prototype,"endDate",void 0),Ct([t.Property(null)],i.prototype,"dependency",void 0),Ct([t.Property(null)],i.prototype,"progress",void 0),Ct([t.Property(null)],i.prototype,"child",void 0),Ct([t.Property(null)],i.prototype,"milestone",void 0),Ct([t.Property(null)],i.prototype,"duration",void 0),Ct([t.Property(null)],i.prototype,"durationUnit",void 0),Ct([t.Property(null)],i.prototype,"cssClass",void 0),Ct([t.Property(null)],i.prototype,"baselineStartDate",void 0),Ct([t.Property(null)],i.prototype,"baselineEndDate",void 0),Ct([t.Property(null)],i.prototype,"resourceInfo",void 0),Ct([t.Property(null)],i.prototype,"expandState",void 0),Ct([t.Property(null)],i.prototype,"indicators",void 0),Ct([t.Property(null)],i.prototype,"notes",void 0),Ct([t.Property(null)],i.prototype,"work",void 0),Ct([t.Property(null)],i.prototype,"manual",void 0),Ct([t.Property(null)],i.prototype,"type",void 0),Ct([t.Property(null)],i.prototype,"segments",void 0),Ct([t.Property(null)],i.prototype,"segmentId",void 0),i}(t.ChildProperty),Rt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ot=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},xt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Rt(i,e),Ot([t.Property("")],i.prototype,"format",void 0),Ot([t.Property("None")],i.prototype,"unit",void 0),Ot([t.Property(1)],i.prototype,"count",void 0),Ot([t.Property(null)],i.prototype,"formatter",void 0),i}(t.ChildProperty),It=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Rt(i,e),Ot([t.Property("Week")],i.prototype,"timelineViewMode",void 0),Ot([t.Complex({},xt)],i.prototype,"topTier",void 0),Ot([t.Complex({},xt)],i.prototype,"bottomTier",void 0),Ot([t.Property(33)],i.prototype,"timelineUnitSize",void 0),Ot([t.Property(0)],i.prototype,"weekStartDay",void 0),Ot([t.Property(null)],i.prototype,"weekendBackground",void 0),Ot([t.Property(!0)],i.prototype,"showTooltip",void 0),Ot([t.Property(!0)],i.prototype,"updateTimescaleView",void 0),i}(t.ChildProperty),Et=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Nt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Ft=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Et(i,e),Nt([t.Property(!0)],i.prototype,"showTooltip",void 0),Nt([t.Property()],i.prototype,"taskbar",void 0),Nt([t.Property()],i.prototype,"baseline",void 0),Nt([t.Property()],i.prototype,"connectorLine",void 0),Nt([t.Property()],i.prototype,"editing",void 0),i}(t.ChildProperty),Ut=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Vt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Lt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ut(i,e),Vt([t.Property()],i.prototype,"field",void 0),Vt([t.Property()],i.prototype,"direction",void 0),i}(t.ChildProperty),Bt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Ut(i,e),Vt([t.Collection([],Lt)],i.prototype,"columns",void 0),Vt([t.Property(!0)],i.prototype,"allowUnsort",void 0),i}(t.ChildProperty),At=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Ht=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},jt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return At(i,e),Ht([t.Property(null)],i.prototype,"id",void 0),Ht([t.Property(null)],i.prototype,"name",void 0),Ht([t.Property(null)],i.prototype,"unit",void 0),Ht([t.Property(null)],i.prototype,"group",void 0),i}(t.ChildProperty),Wt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),qt=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},Gt=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Wt(i,e),qt([t.Property("Spinner")],i.prototype,"indicatorType",void 0),i}(t.ChildProperty),zt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),_t=function(e){function i(t){var i=e.call(this,t)||this;return i.taskBarHeight=0,i.milestoneHeight=0,i.milesStoneRadius=0,i.baselineTop=0,i.baselineHeight=8,i.touchLeftConnectorpoint="",i.touchRightConnectorpoint="",i.dropSplit=!1,i.refreshedTr=[],i.refreshedData=[],i.isUpdated=!0,i.parent=t,i.initPublicProp(),i.addEventListener(),i}return zt(i,e),i.prototype.initPublicProp=function(){this.ganttChartTableBody=null},i.prototype.addEventListener=function(){this.parent.on("renderPanels",this.createChartTable,this),this.parent.on("dataReady",this.initiateTemplates,this),this.parent.on("destroy",this.destroy,this)},i.prototype.refreshChartByTimeline=function(){this.taskTable.style.width=t.formatUnit(this.parent.timelineModule.totalTimelineWidth);var e=t.getValue("prevProjectStartDate",this.parent.dataOperation),i=!1;e&&(i=e.getTime()===this.parent.cloneProjectStartDate.getTime()),this.isUpdated=!!(this.parent.isFromOnPropertyChange&&i&&t.getValue("mutableData",this.parent.treeGrid.grid.contentModule)),this.refreshGanttRows(),this.isUpdated=!0},i.prototype.createChartTable=function(){this.taskTable=t.createElement("table",{className:"e-task-table e-zero-spacing",id:"GanttTaskTable"+this.parent.element.id,styles:"position: absolute;width:"+this.parent.timelineModule.totalTimelineWidth+"px;",attrs:{cellspacing:"0.25px"}});var e=t.createElement("colgroup"),i=t.createElement("col",{styles:"width:"+this.parent.timelineModule.totalTimelineWidth+"px;"});e.appendChild(i),this.taskTable.appendChild(e),this.ganttChartTableBody=t.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"}),this.taskTable.appendChild(this.ganttChartTableBody),this.parent.ganttChartModule.chartBodyContent.appendChild(this.taskTable)},i.prototype.initiateTemplates=function(){this.taskTable.style.width=t.formatUnit(this.parent.timelineModule.totalTimelineWidth),this.initChartHelperPrivateVariable(),this.initializeChartTemplate()},i.prototype.renderChartRows=function(){this.createTaskbarTemplate(),this.parent.isGanttChartRendered=!0},i.prototype.getIndicatorNode=function(e){var t='<label class="e-label e-indicator-span"style="line-height:'+this.parent.rowHeight+"px;"+(this.parent.enableRtl?"right:":"left:")+this.getIndicatorleft(e.date)+'px;"><i class="'+e.iconClass+'"></i> </label>';return this.createDivElement(t)},i.prototype.getIndicatorleft=function(e){e=this.parent.dateValidationModule.getDateFromFormat(e);return this.parent.dataOperation.getTaskLeft(e,!1)},i.prototype.getChildTaskbarNode=function(e,i){var r,a=null,n=this.templateData;if(r=this.parent.enableRtl?"right:":"left:",this.childTaskbarTemplateFunction)a=this.childTaskbarTemplateFunction(t.extend({index:e},n),this.parent,"TaskbarTemplate",this.getTemplateID("TaskbarTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var s="",o="",l=void 0,d=void 0;n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration&&(l=this.createDivElement('<div class="'+W+" "+ae+" "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="width:'+n.ganttProperties.width+"px;height:"+this.taskBarHeight+'px; margin-top :-1px"></div>'),d=this.createDivElement('<div class="'+q+" "+ne+" "+(n.ganttProperties.isAutoSchedule?"":"e-gantt-child-manualprogressbar")+'" style="border-style:'+(n.ganttProperties.progressWidth?"solid;":"none;")+"width:"+n.ganttProperties.progressWidth+"px;height:100%;border-top-right-radius:"+this.getBorderRadius(n.ganttProperties)+"px;border-bottom-right-radius:"+this.getBorderRadius(n.ganttProperties)+'px;"></div>'));var h=t.createElement("div");if(this.taskLabelTemplateFunction&&!t.isNullOrUndefined(d)&&d.length>0){var p=this.taskLabelTemplateFunction(t.extend({index:e},n),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&(t.append(p,h),s=h.innerHTML)}else{var c=this.parent.labelSettings.taskLabel;s="isCustomTemplate"===(s=this.getTaskLabel(c))?this.parent.labelSettings.taskLabel:s,this.parent.enableHtmlSanitizer&&"string"==typeof s&&(s=t.SanitizeHtmlHelper.sanitize(s))}-1===s.indexOf("null")&&("isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(s=""),o=isNaN(parseInt(s))?'<span class="'+j+'" style="line-height:'+(this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(n.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="'+j+'" 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?n.ganttProperties.width-10:"")+"px; height:"+this.taskBarHeight+'px;"></span>');var u=!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length>0?this.splitTaskbar(n,s):n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration?o:!n.ganttProperties.startDate||n.ganttProperties.endDate||n.ganttProperties.duration?!n.ganttProperties.endDate||n.ganttProperties.startDate||n.ganttProperties.duration?!n.ganttProperties.duration||n.ganttProperties.startDate||n.ganttProperties.endDate?"":'<div class="'+q+" "+ae+" e-gantt-unscheduled-taskbar "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="'+r+n.ganttProperties.left+"px; width:"+n.ganttProperties.width+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+q+" "+ae+" "+ve+" "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="'+r+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>':'<div class="'+q+" "+ae+" "+De+" "+(n.ganttProperties.isAutoSchedule?"":de)+'"style="'+r+n.ganttProperties.left+"px; height:"+this.taskBarHeight+'px;"></div>';if(n.ganttProperties.startDate&&n.ganttProperties.endDate&&n.ganttProperties.duration&&(t.isNullOrUndefined(n.ganttProperties.segments)||!t.isNullOrUndefined(n.ganttProperties.segments)&&0===n.ganttProperties.segments.length)){if(""!==u&&!t.isNullOrUndefined(d)&&d.length>0){var g=this.createDivElement(u)[0];this.parent.disableHtmlEncode?g.innerText=s:g.innerHTML=s;var f=this.parent.labelSettings.taskLabel;f&&f.elementRef&&g.appendChild(h),d[0].appendChild(g),""!==d[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(f)&&d[0].querySelectorAll(".e-task-label")[0].children[0]&&d[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===d[0].querySelectorAll(".e-task-label")[0].textContent&&f&&!f.elementRef&&""!==h.innerHTML&&(d[0].querySelectorAll(".e-task-label")[0].textContent=f)}!t.isNullOrUndefined(l)&&l.length>0&&l[0].appendChild([].slice.call(d)[0]),a=l}else a=this.createDivElement(u)}return this.parent.enableRtl&&a[0]&&a[0].querySelector(".e-task-label")&&(a[0].querySelector(".e-task-label").style.marginLeft="15px",a[0].querySelector(".e-task-label").style.marginRight="8px",a[0].querySelector(".e-gantt-child-progressbar")&&(a[0].querySelector(".e-gantt-child-progressbar").style.textAlign="left")),a},i.prototype.splitTaskbar=function(e,t){for(var i="",r=0;r<e.ganttProperties.segments.length;r++){var a=e.ganttProperties.segments[r],n=void 0;n=a.showProgress?"initial":"hidden";var s=0===r?"e-segment-first":r===e.ganttProperties.segments.length-1?"e-segment-last":"e-segment-inprogress";i+='<div class="'+W+" "+s+" "+ae+' e-segmented-taskbar"style="width:'+a.width+"px;position: absolute;"+(this.parent.enableRtl?"right:":"left:")+a.left+"px;height:"+this.taskBarHeight+"px; overflow:"+n+';" data-segment-index = "'+r+'" aria-label = "'+this.generateSpiltTaskAriaLabel(a,e.ganttProperties)+'"> '+this.getSplitTaskbarLeftResizerNode()+'<div class="'+q+" "+ne+' " style="border-style:'+(a.progressWidth?"solid;":"none;")+"display:"+(a.progressWidth>=0?"block;":"none;")+"width:"+a.progressWidth+"px;height:100%;text-align:"+(this.parent.enableRtl?"left;":"right;")+"border-top-right-radius:"+this.getSplitTaskBorderRadius(a)+"px;border-bottom-right-radius:"+this.getSplitTaskBorderRadius(a)+'px;"><span class="'+j+'" style="line-height:'+(this.taskBarHeight-1)+"px;display:"+(a.showProgress?"inline;":"none;")+"height:"+this.taskBarHeight+'px;">'+t+"</span></div>"+this.getSplitTaskbarRightResizerNode(a)+(a.showProgress?this.getSplitProgressResizerNode(a):"")+"</div></div>"}return i},i.prototype.getSplitTaskbarLeftResizerNode=function(){var e=-(this.parent.isAdaptive?12:2);return'<div class="'+K+' e-icon" style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;"></div>'},i.prototype.getSplitTaskbarRightResizerNode=function(e){var t=this.parent.isAdaptive?-2:-10;return'<div class="'+J+' e-icon" style="'+(this.parent.enableRtl?"right:":"left:")+(e.width+t)+"px;height:"+this.taskBarHeight+'px;"></div>'},i.prototype.getSplitProgressResizerNode=function(e){var t=this.parent.enableRtl?e.progressWidth+8:e.progressWidth-6;return'<div class="'+$+'" style="'+(this.parent.enableRtl?"right:":"left:")+t+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+ee+'"><div class="'+te+'"></div><div class="'+ie+'"></div></div>'},i.prototype.getSegmentIndex=function(e,i){var r=-1,a=i.ganttProperties,n=a.segments;if(!t.isNullOrUndefined(n)){n.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()});for(var s=n.length,o=0;o<s;o++){var l=n[o];if(e.getTime()===a.startDate.getTime())this.dropSplit=!0,r=0;else if(e.getTime()===l.startDate.getTime()){this.dropSplit=!0;var d=l.startDate;d.setDate(d.getDate()+1),d=l.startDate=this.parent.dataOperation.checkStartDate(d,a,!1),l.startDate=d;var h=l.endDate;h=this.parent.dataOperation.getEndDate(d,l.duration,a.durationUnit,a,!1),l.endDate=h,o===n.length-1&&this.parent.setRecordValue("endDate",h,a,!0),this.incrementSegments(n,o,i),r=l.segmentIndex}else l.endDate=this.parent.dataOperation.getEndDate(l.startDate,l.duration,a.durationUnit,a,!1),e.getTime()>=l.startDate.getTime()&&e.getTime()<=l.endDate.getTime()&&(r=l.segmentIndex);this.parent.setRecordValue("segments",a.segments,a,!0)}}return-1===r&&(this.dropSplit=!0),r},i.prototype.mergeTask=function(e,t){var i=t.length,r=this.parent.taskFields,a=this.parent.flatData.filter(function(t){return t[r.id]===e?t:null})[0],n=a.ganttProperties.segments;t=t.sort(function(e,t){return t.firstSegmentIndex-e.firstSegmentIndex});for(var s=0;s<i;s++){var o=n[t[s].firstSegmentIndex],l=n[t[s].secondSegmentIndex],d=o.duration+l.duration,h=this.parent.dataOperation.getEndDate(o.startDate,d,a.ganttProperties.durationUnit,a.ganttProperties,!1),p={startDate:o.startDate,endDate:h,duration:d},c=t[s].firstSegmentIndex;n.splice(c,2,p),this.parent.setRecordValue("segments",n,a.ganttProperties,!0),this.parent.dataOperation.updateMappingData(a,"segments"),1===n.length?(this.parent.setRecordValue("endDate",h,a.ganttProperties,!0),this.parent.setRecordValue("EndDate",h,a,!0),this.parent.setRecordValue("segments",null,a.ganttProperties,!0),this.parent.dataOperation.updateMappingData(a,"segments")):a.ganttProperties.endDate!==n[n.length-1].endDate&&this.parent.setRecordValue("endDate",n[n.length-1].endDate,a.ganttProperties,!0)}this.refreshChartAfterSegment(a,"mergeSegment")},i.prototype.refreshChartAfterSegment=function(e,i){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.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)):this.refreshRow(this.parent.currentViewData.indexOf(e));var r=this.ganttChartTableBody.querySelectorAll("tr")[this.parent.currentViewData.indexOf(e)],a={requestType:i,rowData:e};this.triggerQueryTaskbarInfoByIndex(r,e),this.parent.selectionModule.clearSelection();var n=a.rowData.taskData[this.parent.taskFields.segments];if(this.parent.timezone&&null!=n)for(var s=0;s<n.length;s++)n[s][this.parent.taskFields.startDate]=this.parent.dateValidationModule.remove(a.rowData.ganttProperties.segments[s].startDate,this.parent.timezone),this.parent.taskFields.endDate&&(n[s][this.parent.taskFields.endDate]=this.parent.dateValidationModule.remove(a.rowData.ganttProperties.segments[s].endDate,this.parent.timezone));this.parent.trigger("actionComplete",a),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),t.setValue("isEdit",!1,this.parent.contextMenuModule),t.setValue("isEdit",!1,this.parent)},i.prototype.splitTask=function(e,i){var r=this.parent.taskFields,a=i,n=this.parent.flatData.filter(function(t){return t[r.id]===e?t:null})[0],s=n.ganttProperties;this.dropSplit=!1;var o=-1,l=s.segments;if(t.isNullOrUndefined(i.length)||i.length<0){var d=this.parent.dataOperation.checkStartDate(a,s,!1);if(d.getTime()!==s.startDate.getTime()&&s.isAutoSchedule){if(!t.isNullOrUndefined(l)&&l.length>0&&(o=this.getSegmentIndex(d,n)),!1===this.dropSplit&&a.getTime()>s.startDate.getTime()&&a.getTime()<s.endDate.getTime()){l=-1!==o?l:[];var h=-1!==o?l[o].startDate:new Date(s.startDate.getTime()),p=-1!==o?l[o].endDate:new Date(s.endDate.getTime()),c=this.parent.dataOperation.getDuration(h,p,s.durationUnit,s.isAutoSchedule,s.isMilestone);this.parent.setRecordValue("segments",this.splitSegmentedTaskbar(h,p,a,o,l,n,c),s,!0),-1!==o&&this.incrementSegments(l,o+1,n),this.parent.setRecordValue("endDate",l[l.length-1].endDate,s,!0),this.parent.taskFields.endDate&&this.parent.dataOperation.updateMappingData(n,"endDate")}this.refreshChartAfterSegment(n,"splitTaskbar")}}else i.sort(function(e,t){return e.getTime()-t.getTime()}),this.parent.setRecordValue("segments",this.constructSegments(i,n.ganttProperties),n.ganttProperties,!0),this.refreshChartAfterSegment(n,"splitTask")},i.prototype.constructSegments=function(e,t){for(var i,r,a,n=[],s=new Date,o=0;o<e.length+1&&(s=0===o?t.startDate:s,s=this.parent.dataOperation.checkStartDate(s,t,!1),r=o!==e.length?new Date(e[o].getTime())>t.endDate?t.endDate:new Date(e[o].getTime()):t.endDate,r=this.parent.dataOperation.checkEndDate(r,t,!1),a=this.parent.dataOperation.getDuration(s,r,t.durationUnit,t.isAutoSchedule,t.isMilestone),r.getTime()>=s.getTime()&&(i={startDate:s,endDate:r,duration:a},n.push(i)),o!==e.length);o++)(s=new Date(e[o].getTime())).setDate(e[o].getDate()+1);return n},i.prototype.splitSegmentedTaskbar=function(e,t,i,r,a,n,s){var o=n.ganttProperties,l=this.parent.nonWorkingDayIndex.indexOf(i.getDay()),d=-1===l?0:0===l?1:2;e=this.parent.dataOperation.checkStartDate(e,o,!1);var h=new Date(i.getTime());h=this.parent.dataOperation.checkEndDate(h,o,!1);for(var p=0;p<2;p++){var c={startDate:e,endDate:h,duration:this.parent.dataOperation.getDuration(e,h,o.durationUnit,o.isAutoSchedule,o.isMilestone),offsetDuration:1},u=this.parent.nonWorkingDayIndex.indexOf(h.getDay());-1!==r&&(a.splice(r,1),r=-1),a.push(c);var g=this.parent.timelineModule.customTimelineSettings.bottomTier.unit;if("Hour"===g||"Minutes"===g){e=new Date(i.getTime()),e=this.parent.dataOperation.checkStartDate(e,o,!1);var f=this.parent.timelineModule.customTimelineSettings.bottomTier.count,m=this.parent.timelineModule.customTimelineSettings.bottomTier.unit,y=this.parent.timelineModule.getIncrement(e,f,m),D=e.getTime()+y;e.setTime(D+d),h=new Date(t.getTime()),y=this.parent.timelineModule.getIncrement(h,f,m),D=h.getTime()+y,h.setTime(D+d)}else(e=new Date(i.getTime())).setDate(e.getDate()+1+d),this.setTime(this.parent.defaultStartTime,e),e=this.parent.dataOperation.checkStartDate(e,o,!1),(h=new Date(t.getTime())).setDate(h.getDate()+1);if(-1!==u){var v=s-c.duration;h=this.parent.dataOperation.getEndDate(e,v,o.durationUnit,o,!1)}else h=this.parent.dataOperation.checkEndDate(h,o,!1)}return a.sort(function(e,t){return e.startDate.getTime()-t.startDate.getTime()}),a},i.prototype.incrementSegments=function(e,t,i){for(var r=i.ganttProperties,a=t+1;a<e.length;a++){var n=e[a],s=0!==a?new Date(e[a-1].endDate.getTime()):new Date(n.startDate.getTime());s=this.parent.dataOperation.getEndDate(s,n.offsetDuration,r.durationUnit,r,!1),s=this.parent.dataOperation.checkStartDate(s,r,!1),n.startDate=s;var o=n.endDate=this.parent.dataOperation.getEndDate(s,n.duration,r.durationUnit,r,!1);n.endDate=o,a===e.length-1&&(this.parent.setRecordValue("endDate",o,r,!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,r,!0),this.parent.dataOperation.updateMappingData(i,"segments")},i.prototype.getMilestoneNode=function(e,i){var r=null,a=this.templateData;if(this.milestoneTemplateFunction)r=this.milestoneTemplateFunction(t.extend({index:e},a),this.parent,"MilestoneTemplate",this.getTemplateID("MilestoneTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var n='<div class="'+re+'" 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:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';r=this.createDivElement(n)}return r},i.prototype.getTaskBaselineNode=function(){var e=this.templateData,t='<div class="'+X+' " 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(t)},i.prototype.getMilestoneBaselineNode=function(){var e=this.templateData,t=this.parent.renderBaseline?5:2,i='<div class="'+Y+'" style="width:'+(2+(this.parent.renderBaseline?this.taskBarHeight-5:this.taskBarHeight-10))+"px;height:"+(2+(this.parent.renderBaseline?this.taskBarHeight-5: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.left-this.milestoneHeight/2+2)+"px;"+(this.baselineColor?"background-color: "+this.baselineColor+";":"")+"margin-top:"+(-Math.floor(this.parent.rowHeight-this.milestoneMarginTop)+t+3)+'px"> </div>';return this.createDivElement(i)},i.prototype.getLeftLabelNode=function(e){var i=this.leftLabelContainer();""!==this.generateTaskLabelAriaLabel("left")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("left"));var r=null;if(this.leftTaskLabelTemplateFunction)r=this.leftTaskLabelTemplateFunction(t.extend({index:e},this.templateData),this.parent,"LeftLabelTemplate",this.getTemplateID("LeftLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var a=this.parent.labelSettings.leftLabel,n=this.getTaskLabel(a);n&&(n="isCustomTemplate"===n?a:n,r=this.getLableText(n,L),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=t.SanitizeHtmlHelper.sanitize(n))?a:n,r=this.getLableText(n,L)))}return r&&r.length>0&&("null"===r[0].data&&(r[0].data=""),t.append(r,i[0])),this.parent.enableRtl&&(i[0].style.paddingLeft="25px",i[0].style.paddingRight="0px"),i},i.prototype.getLableText=function(e,i){var r=this.parent.renderBaseline?(this.parent.rowHeight-this.taskBarHeight)/2:this.taskBarMarginTop,a=t.createElement("div",{className:i,styles:"height:"+this.taskBarHeight+"px;margin-top:"+r+"px;"}),n=t.createElement("span",{className:ye});n[this.parent.disableHtmlEncode?"textContent":"innerHTML"]=e,a.appendChild(n);var s=t.createElement("div");return s.appendChild(a),s.childNodes},i.prototype.getRightLabelNode=function(e){var i=this.rightLabelContainer();""!==this.generateTaskLabelAriaLabel("right")&&i[0].setAttribute("aria-label",this.generateTaskLabelAriaLabel("right"));var r=null;if(this.rightTaskLabelTemplateFunction)r=this.rightTaskLabelTemplateFunction(t.extend({index:e},this.templateData),this.parent,"RightLabelTemplate",this.getTemplateID("RightLabelTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var a=this.parent.labelSettings.rightLabel,n=this.getTaskLabel(a);n&&(n="isCustomTemplate"===n?a:n,r=this.getLableText(n,A),this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n="isCustomTemplate"===(n=t.SanitizeHtmlHelper.sanitize(n))?a:n,r=this.getLableText(n,A)))}return r&&r.length>0&&("null"===r[0].data&&(r[0].data=""),t.append(r,i[0])),this.parent.enableRtl&&(i[0].style.marginLeft="0px",i[0].style.paddingRight="25px"),i},i.prototype.getManualTaskbar=function(){var e=this.templateData,t=this.taskBarHeight/2-1,i=e.ganttProperties.startDate&&e.ganttProperties.endDate&&e.ganttProperties.duration?'<div class="'+oe+'" 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="'+oe+" "+(e.ganttProperties.startDate?De:ve)+'" 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="'+oe+' 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>',r='<div class="'+se+'"style='+(this.parent.enableRtl?"right:":"left:")+(e.ganttProperties.left-e.ganttProperties.autoLeft)+"px;width:"+e.ganttProperties.width+"px;height:"+t+"px;>"+i+(e.ganttProperties.startDate&&e.ganttProperties.endDate&&e.ganttProperties.duration||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>":""),a='<div class="'+le+'" 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:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';return this.createDivElement(0!==e.ganttProperties.duration?r:a)},i.prototype.getParentTaskbarNode=function(e,i){var r=null,a=this.templateData;if(this.parentTaskbarTemplateFunction)r=this.parentTaskbarTemplateFunction(t.extend({index:e},a),this.parent,"ParentTaskbarTemplate",this.getTemplateID("ParentTaskbarTemplate"),!1,void 0,i[0],this.parent.treeGrid.root);else{var n="",s=void 0,o=this.taskBarHeight/5,l=this.createDivElement('<div class="e-gantt-parent-taskbar-inner-div '+this.getExpandClass(a)+" "+pe+'" style="width:'+(a.ganttProperties.isAutoSchedule?a.ganttProperties.width:a.ganttProperties.autoWidth)+"px;height:"+(a.ganttProperties.isAutoSchedule?this.taskBarHeight:3*o)+"px;margin-top:"+(a.ganttProperties.isAutoSchedule?-1:2*o)+'px; "></div>'),d=this.createDivElement('<div class="e-gantt-parent-progressbar-inner-div '+this.getExpandClass(a)+" "+ce+'" style="border-style:'+(a.ganttProperties.progressWidth?"solid;":"none;")+"width:"+a.ganttProperties.progressWidth+"px;border-top-right-radius:"+this.getBorderRadius(a)+"px;border-bottom-right-radius:"+this.getBorderRadius(a)+'px;height:100%;"></div>'),h=t.createElement("div");if(this.taskLabelTemplateFunction){var p=this.taskLabelTemplateFunction(t.extend({index:e},a),this.parent,"TaskLabelTemplate",this.getTemplateID("TaskLabelTemplate"),!1,void 0,d[0]);p&&p.length>0&&(t.append(p,h),n=h.innerHTML)}else n="isCustomTemplate"===(n=this.getTaskLabel(this.parent.labelSettings.taskLabel))?this.parent.labelSettings.taskLabel:n,this.parent.enableHtmlSanitizer&&"string"==typeof n&&(n=t.SanitizeHtmlHelper.sanitize(n));if(-1===n.indexOf("null")){"isCustomTemplate"!==this.getTaskLabel(this.parent.labelSettings.taskLabel)||this.isTemplate(this.parent.labelSettings.taskLabel)||(n=""),s=isNaN(parseInt(n))?'<span class="'+j+'" style="line-height:'+(a.isManual&&a.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px; text-align:"+(this.parent.enableRtl?"right;":"left;")+"display:inline-block;width:"+(a.ganttProperties.width-10)+"px; height:"+this.taskBarHeight+'px;"></span>':'<span class="'+j+'" style="line-height:'+(a.isManual&&a.hasChildRecords?Math.floor(.6*this.taskBarHeight):this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display:inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(a.ganttProperties.width-10):"")+"px; height:"+(this.taskBarHeight-1)+"px;"+("ResourceView"===this.parent.viewType?"display: inline-flex;":"")+("ResourceView"===this.parent.viewType?"width:"+(a.ganttProperties.width-10):"")+"px; height:"+this.taskBarHeight+'px;"></span>';var c=this.createDivElement(s)[0];this.parent.disableHtmlEncode?c.innerText=n:c.innerHTML=n;var u=this.parent.labelSettings.taskLabel;u&&u.elementRef&&c.appendChild(h),d[0].appendChild(c),""!==d[0].querySelectorAll(".e-task-label")[0].textContent&&!this.isTemplate(u)&&d[0].querySelectorAll(".e-task-label")[0].children[0]&&d[0].querySelectorAll(".e-task-label")[0].children[0].remove(),""===d[0].querySelectorAll(".e-task-label")[0].textContent&&u&&!u.elementRef&&""!==h.innerHTML&&(d[0].querySelectorAll(".e-task-label")[0].textContent=u)}var g='<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:"+(this.parent.rowHeight>40?0:2)+"px;left:"+(this.parent.renderBaseline?2:1)+'px;"> </div>';l[0].appendChild([].slice.call(d)[0]),r=a.ganttProperties.isMilestone?this.createDivElement(a.ganttProperties.isAutoSchedule?g:""):l}return this.parent.enableRtl&&r[0]&&r[0].querySelector(".e-task-label")&&(r[0].querySelector(".e-task-label").style.marginLeft="15px",r[0].querySelector(".e-task-label").style.marginRight="8px",r[0].querySelector(".e-gantt-parent-progressbar")&&(r[0].querySelector(".e-gantt-parent-progressbar").style.textAlign="left")),r},i.prototype.getTableTrNode=function(e){var i,r=t.createElement("table"),a="Horizontal"===this.parent.gridLines||"Both"===this.parent.gridLines?"e-chart-row-border":"",n=this.parent.treeGrid.grid.contentModule.getRows()[e];return i=n&&n.isSelected?"e-active":"",r.innerHTML='<tr class="'+this.getRowClassName(this.templateData)+" "+Q+" "+i+'"style="display:'+this.getExpandDisplayProp(this.templateData)+";height:"+this.parent.rowHeight+'px;"><td class="'+Z+" "+a+'"style="width:'+this.parent.timelineModule.totalTimelineWidth+'px;"></td></tr>',r.childNodes},i.prototype.initializeChartTemplate=function(){t.isNullOrUndefined(this.parent.parentTaskbarTemplate)||(this.parentTaskbarTemplateFunction=this.templateCompiler(this.parent.parentTaskbarTemplate)),!t.isNullOrUndefined(this.parent.labelSettings.leftLabel)&&this.isTemplate(this.parent.labelSettings.leftLabel)&&(this.leftTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.leftLabel)),!t.isNullOrUndefined(this.parent.labelSettings.rightLabel)&&this.isTemplate(this.parent.labelSettings.rightLabel)&&(this.rightTaskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.rightLabel)),!t.isNullOrUndefined(this.parent.labelSettings.taskLabel)&&this.isTemplate(this.parent.labelSettings.taskLabel)&&(this.taskLabelTemplateFunction=this.templateCompiler(this.parent.labelSettings.taskLabel)),t.isNullOrUndefined(this.parent.taskbarTemplate)||(this.childTaskbarTemplateFunction=this.templateCompiler(this.parent.taskbarTemplate)),t.isNullOrUndefined(this.parent.milestoneTemplate)||(this.milestoneTemplateFunction=this.templateCompiler(this.parent.milestoneTemplate))},i.prototype.createDivElement=function(e){var i=t.createElement("div");return i.innerHTML=e,i.childNodes},i.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("#")||e.indexOf("<")>-1||e.indexOf("$")>-1||!t},i.prototype.getTemplateID=function(e){return this.parent.element.id+e},i.prototype.leftLabelContainer=function(){var e='<div class="'+(this.leftTaskLabelTemplateFunction?"e-left-label-container e-left-label-temp-container":V)+' " tabindex="-1" role="term" style="height:'+(this.parent.rowHeight-2)+"px;width:"+this.taskNameWidth(this.templateData)+'"></div>';return this.createDivElement(e)},i.prototype.taskbarContainer=function(){var e=this.templateData,t=!(!this.parent.editModule||!this.parent.editSettings.allowTaskbarEditing||"ParentResizing"!==this.parent.editModule.taskbarEditModule.taskBarEditAction),i='<div class="'+H+" "+this.parent.getUnscheduledTaskClass(e.ganttProperties)+" "+(e.ganttProperties.cssClass?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:"+(e.ganttProperties.isAutoSchedule?"move;":"auto;"):"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;")+'"></div>';return this.createDivElement(i)},i.prototype.rightLabelContainer=function(){var e='<div class="'+(this.rightTaskLabelTemplateFunction?"e-right-label-container e-right-label-temp-container":B)+'" 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)},i.prototype.childTaskbarLeftResizer=function(){var e=-(this.parent.isAdaptive?12:2),t='<div class="'+K+' e-icon"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;height:"+this.taskBarHeight+'px;"></div>';return this.createDivElement(t)},i.prototype.childTaskbarRightResizer=function(){var e=this.parent.isAdaptive?-2:-10,t='<div class="'+J+' e-icon"style="'+(this.parent.enableRtl?"right:":"left:")+(this.templateData.ganttProperties.width+e)+"px;height:"+this.taskBarHeight+'px;"></div>';return this.createDivElement(t)},i.prototype.childTaskbarProgressResizer=function(){var e=this.parent.enableRtl?this.templateData.ganttProperties.progressWidth+8:this.templateData.ganttProperties.progressWidth-6,t='<div class="'+$+'"style="'+(this.parent.enableRtl?"right:":"left:")+e+"px;margin-top:"+(this.taskBarHeight-4)+'px;"><div class="'+ee+'"><div class="'+te+'"></div><div class="'+ie+'"></div></div>';return this.createDivElement(t)},i.prototype.getLeftPointNode=function(){var e,t=this.templateData,i=-((this.parent.isAdaptive?14:2)+this.connectorPointWidth),r=-(this.connectorPointWidth+2),a=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2);e=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px";var n='<div class="e-left-connectorpoint-outer-div" style="'+(t.ganttProperties.isMilestone?"margin-top:"+a+"px;left:"+r+"px;":e+";left:"+i+"px;")+'"><div class="'+Me+" "+this.parent.getUnscheduledTaskClass(t.ganttProperties)+'" style="width: '+this.connectorPointWidth+"px;"+(this.parent.enableRtl?"margin-right:2px;":"")+"height: "+this.connectorPointWidth+'px;">'+this.touchLeftConnectorpoint+"</div></div>";return this.createDivElement(n)},i.prototype.getRightPointNode=function(){var e,t=this.templateData,i=this.parent.isAdaptive?10:-2,r=Math.floor(this.milesStoneRadius-this.connectorPointWidth/2);e=!this.templateData.ganttProperties.isAutoSchedule&&this.templateData.hasChildRecords&&this.parent.allowParentDependency?"":"margin-top:"+this.connectorPointMargin+"px";var a='<div class="'+Ie+'" style="'+(t.ganttProperties.isMilestone?"left:"+(this.milestoneHeight-2)+"px;margin-top:"+r+"px;":"left:"+(t.ganttProperties.width+i)+"px;"+e+";")+'"><div class="'+Re+" "+this.parent.getUnscheduledTaskClass(t.ganttProperties)+'" style="width:'+this.connectorPointWidth+"px;height:"+this.connectorPointWidth+'px;">'+this.touchRightConnectorpoint+"</div></div>";return this.createDivElement(a)},i.prototype.getTaskLabel=function(e){var i=this.parent.ganttColumns.length,r=null;if(t.isNullOrUndefined(e)||""===e)r="";else if(e===this.parent.taskFields.resourceInfo)r=this.getResourceName(this.templateData);else{for(var a=0;a<i;a++)if(e===this.parent.ganttColumns[a].field){r=this.getFieldValue(this.templateData[e]).toString();break}if(t.isNullOrUndefined(r))return"isCustomTemplate"}return r},i.prototype.getExpandDisplayProp=function(e){return e=this.templateData,this.parent.getExpandStatus(e)?"table-row":"none"},i.prototype.getRowClassName=function(e){var t="gridrowtaskId",i=(e=this.templateData).parentItem;return i&&(t+=i.taskId.toString()),t+="level",t+=e.level.toString()},i.prototype.getBorderRadius=function(e){var t=(e=this.templateData).ganttProperties.width-e.ganttProperties.progressWidth;return t<=4?4-t:0},i.prototype.getSplitTaskBorderRadius=function(e){var t=e.width-e.progressWidth;return t<=4?4-t:0},i.prototype.taskNameWidth=function(e){var t,i=(e=this.templateData).ganttProperties;return(t=e.ganttProperties.isMilestone?e.ganttProperties.left-this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!i.isAutoSchedule?this.parent.allowUnscheduledTasks?i.left<i.autoLeft?i.left:i.autoLeft:i.autoStartDate.getTime()<i.startDate.getTime()?i.autoLeft:i.left:e.ganttProperties.left)<0&&(t=0),t+"px"},i.prototype.getRightLabelLeft=function(e){var t,i,r=(e=this.templateData).ganttProperties;return e.ganttProperties.isMilestone?e.ganttProperties.left+this.parent.getTaskbarHeight()/2:e.hasChildRecords&&!r.isAutoSchedule?(this.parent.allowUnscheduledTasks?(t=r.left<r.autoLeft?r.left:r.autoLeft,i=r.autoWidth):(t=r.autoStartDate.getTime()<r.startDate.getTime()?r.autoLeft:r.left,i=(r.autoEndDate.getTime()<r.endDate.getTime()?this.parent.dataOperation.getTaskLeft(r.endDate,r.isMilestone):this.parent.dataOperation.getTaskLeft(r.autoEndDate,r.isMilestone))-t),t+i):e.ganttProperties.left+e.ganttProperties.width},i.prototype.getExpandClass=function(e){return(e=this.templateData).expanded?"e-row-expand":!e.expanded&&e.hasChildRecords?"e-row-collapse":""},i.prototype.getFieldValue=function(e){return t.isNullOrUndefined(e)?"":e},i.prototype.getResourceName=function(e){e=this.templateData;var i=null;if(!t.isNullOrUndefined(e.ganttProperties.resourceInfo)){var r=e.ganttProperties.resourceInfo.length;if(r>0){for(var a=0;a<r;a++){var n=e.ganttProperties.resourceInfo[a][this.parent.resourceFields.name],s=e.ganttProperties.resourceInfo[a][this.parent.resourceFields.unit];100!==s&&(n+="["+s+"%]"),t.isNullOrUndefined(i)?i=n:i+=" , "+n}return i}return""}return""},i.prototype.initChartHelperPrivateVariable=function(){var e=this.parent.renderBaseline?.45:.62,i=this.parent.renderBaseline?4:2,r=this.parent.renderBaseline?1.13:.82;if(this.baselineColor=t.isNullOrUndefined(this.parent.baselineColor)||""===this.parent.baselineColor?null:this.parent.baselineColor,this.taskBarHeight=t.isNullOrUndefined(this.parent.taskbarHeight)||this.parent.taskbarHeight>=this.parent.rowHeight?Math.floor(this.parent.rowHeight*e):this.parent.taskbarHeight,this.parent.renderBaseline){var a=void 0;a=this.taskBarHeight+this.baselineHeight<=this.parent.rowHeight?this.taskBarHeight:this.taskBarHeight-(this.baselineHeight+1),this.taskBarHeight=a}this.milestoneHeight=Math.floor(this.taskBarHeight*r),this.taskBarMarginTop=Math.floor((this.parent.rowHeight-this.taskBarHeight)/i),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):10,this.connectorPointMargin=Math.floor(this.taskBarHeight/2-this.connectorPointWidth/2)-1},i.prototype.refreshGanttRows=function(){if(this.parent.currentViewData=this.parent.treeGrid.getCurrentViewRecords().slice(),this.createTaskbarTemplate(),"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation){for(var e=0;e<this.parent.currentViewData.length;e++){var t=this.parent.currentViewData[e];t.childRecords.length>0&&(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()},i.prototype.createTaskbarTemplate=function(){var e,i=[].slice.call(this.ganttChartTableBody.querySelectorAll("tr"));this.ganttChartTableBody.innerHTML="";var r=[],a=this.parent.treeGridModule.prevCurrentView;if(this.refreshedTr=[],this.refreshedData=[],this.parent.enableImmutableMode&&a&&a.length>0&&this.isUpdated){for(var n={},s=[],o=this.parent.treeGrid.getPrimaryKeyFieldNames()[0],l=0;l<a.length;l++)s[l]=i[l],n[a[l][o]]=l;for(var d=0;d<this.parent.currentViewData.length;d++){var h=n[this.parent.currentViewData[d][o]],p=this.parent.modifiedRecords.indexOf(this.parent.currentViewData[d]);if(t.isNullOrUndefined(h)||-1!==p||this.parent.isFromRenderBaseline){var c=this.getGanttChartRow(d,this.parent.currentViewData[d]);this.ganttChartTableBody.appendChild(c),this.refreshedTr.push(this.ganttChartTableBody.querySelectorAll("tr")[d]),this.refreshedData.push(this.parent.currentViewData[d])}else this.ganttChartTableBody.appendChild(s[h]);this.ganttChartTableBody.querySelectorAll("tr")[d].setAttribute("aria-rowindex",d.toString())}}else{var u=void 0;u=t.createElement("tbody",{id:this.parent.element.id+"GanttTaskTableBody"});for(l=0;l<this.parent.currentViewData.length;l++){var g=this.parent.currentViewData[l];"ResourceView"===this.parent.viewType&&((this.parent.editModule&&this.parent.editModule.isResourceTaskDeleted||this.parent.isFromOnPropertyChange)&&(this.parent.editModule.isResourceTaskDeleted=!1),!g.expanded&&this.parent.enableMultiTaskbar&&r.push(g));c=this.getGanttChartRow(l,g);u.appendChild(c),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(c.getAttribute("aria-rowindex"),10))}(e=this.ganttChartTableBody).replaceChildren.apply(e,u.childNodes),this.parent.initialChartRowElements=this.parent.ganttChartModule.getChartRows()}if(this.parent.renderTemplates(),this.triggerQueryTaskbarInfo(),this.parent.modifiedRecords=[],"ResourceView"==this.parent.viewType&&this.parent.showOverAllocation&&this.updateOverlapped(),r.length)for(var f=0;f<r.length;f++)r[f].hasChildRecords&&(this.parent.isGanttChartRendered=!0,this.parent.chartRowsModule.refreshRecords([r[f]]));this.parent.renderTemplates()},i.prototype.getGanttChartRow=function(e,i){this.templateData=i;var r=null,a=this.getTableTrNode(e),n=this.getLeftLabelNode(e),s=this.taskbarContainer();s[0].setAttribute("aria-label",this.generateAriaLabel(this.templateData)),s[0].setAttribute("rowUniqueId",this.templateData.ganttProperties.rowUniqueID);var o;if(this.templateData.hasChildRecords||this.parent.allowParentDependency)this.parent.allowParentDependency&&(o=this.getLeftPointNode(),(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)&&s[0].appendChild([].slice.call(o)[0]));else{var l=this.getLeftPointNode();s[0].appendChild([].slice.call(l)[0])}if(this.templateData.hasChildRecords){var d=this.getParentTaskbarNode(e,s);if(!this.templateData.ganttProperties.isAutoSchedule){var h=this.getManualTaskbar();if(!t.isNullOrUndefined(h[0])){if(this.parent.allowParentDependency){h[0].appendChild([].slice.call(o)[0]);var p=this.getRightPointNode();h[0].appendChild([].slice.call(p)[0])}s[0].appendChild([].slice.call(h)[0])}}if(0!==this.templateData.ganttProperties.autoDuration&&!this.templateData.ganttProperties.isMilestone&&d&&d.length>0)t.append(d,s[0]);else if(0===this.templateData.ganttProperties.duration&&this.templateData.ganttProperties.isMilestone&&this.templateData.ganttProperties.isAutoSchedule){(c=this.getMilestoneNode(e,s))&&c.length>0&&t.append(c,s[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(r=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}else if(this.templateData.ganttProperties.isMilestone){var c;(c=this.getMilestoneNode(e,s))&&c.length>0&&t.append(c,s[0]),this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(r=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}else{var u=m(this.templateData.ganttProperties),g=null,f=null,y=null;if(!t.isNullOrUndefined(u)){(u||this.templateData.ganttProperties.duration)&&u&&(t.isNullOrUndefined(this.templateData.ganttProperties.segments)||this.templateData.ganttProperties.segments.length<=0)&&(g=this.childTaskbarProgressResizer(),y=this.childTaskbarLeftResizer(),f=this.childTaskbarRightResizer());var D=this.getChildTaskbarNode(e,s);if(y&&s[0].appendChild([].slice.call(y)[0]),D&&D.length>0)if(this.templateData.ganttProperties.segments&&this.templateData.ganttProperties.segments.length>0){var v=this.templateData.ganttProperties.segments.length,w=null;w=this.createDivElement('<div class="e-gantt-split-container-line"></div>'),s[0].appendChild([].slice.call(w)[0]);for(var k=0;k<v;k++)s[0].appendChild([].slice.call(D)[0])}else t.append(D,s[0]);g&&s[0].appendChild([].slice.call(g)[0]),f&&s[0].appendChild([].slice.call(f)[0])}this.parent.renderBaseline&&this.templateData.ganttProperties.baselineStartDate&&this.templateData.ganttProperties.baselineEndDate&&(r=this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.baselineEndDate.getTime()&&(t.isNullOrUndefined(this.templateData.ganttProperties.baselineStartDate)||t.isNullOrUndefined(this.templateData.ganttProperties.startDate)||this.templateData.ganttProperties.baselineStartDate.getTime()!==this.templateData.ganttProperties.startDate.getTime()||t.isNullOrUndefined(this.templateData.ganttProperties.baselineEndDate)||t.isNullOrUndefined(this.templateData.ganttProperties.endDate)||this.templateData.ganttProperties.baselineEndDate.getTime()!==this.templateData.ganttProperties.endDate.getTime()||!this.templateData.ganttProperties.isMilestone)?this.getTaskBaselineNode():this.getMilestoneBaselineNode())}var T;this.parent.allowParentDependency&&(this.templateData.ganttProperties.isAutoSchedule&&"ProjectView"===this.parent.viewType||!this.templateData.hasChildRecords)?(T=this.getRightPointNode(),s[0].appendChild([].slice.call(T)[0])):this.parent.allowParentDependency||(T=this.getRightPointNode(),s[0].appendChild([].slice.call(T)[0]));var b=this.getRightLabelNode(e);if(a[0].childNodes[0].childNodes[0].appendChild([].slice.call(n)[0]),a[0].childNodes[0].childNodes[0].appendChild([].slice.call(s)[0]),this.templateData.ganttProperties.indicators&&this.templateData.ganttProperties.indicators.length>0)for(var P=void 0,S=void 0,C=this.templateData.ganttProperties.indicators,M=0;M<C.length;M++){if((P=this.getIndicatorNode(C[M]))[0].setAttribute("aria-label",C[M].name),C[M].name.indexOf("$")>-1||C[M].name.indexOf("#")>-1)S=this.templateCompiler(C[M].name)(t.extend({index:e},this.templateData),this.parent,"indicatorLabelText");else{var R=t.createElement("Text");R.innerHTML=C[M].name,this.parent.enableHtmlSanitizer&&"string"==typeof C[M].name&&(C[M].name=t.SanitizeHtmlHelper.sanitize(C[M].name),R.innerText=C[M].name),S=R.childNodes}P[0].appendChild([].slice.call(S)[0]),P[0].title=t.isNullOrUndefined(C[M].tooltip)?"":C[M].tooltip,a[0].childNodes[0].childNodes[0].appendChild([].slice.call(P)[0])}b&&b.length>0&&a[0].childNodes[0].childNodes[0].appendChild([].slice.call(b)[0]),t.isNullOrUndefined(r)||a[0].childNodes[0].childNodes[0].appendChild([].slice.call(r)[0]);var O=a[0].childNodes[0];return this.setAriaRowIndex(i,O),O},i.prototype.setAriaRowIndex=function(e,i){var r=this.parent.treeGrid.getCurrentViewRecords(),a=(this.parent.virtualScrollModule&&this.parent.enableVirtualization?t.getValue("virtualScrollModule.visualData",this.parent.treeGrid):r).indexOf(e);i.setAttribute("aria-rowindex",a.toString())},i.prototype.triggerQueryTaskbarInfo=function(){if(this.parent.queryTaskbarInfo)for(var e,i,r=this.parent.enableImmutableMode?this.refreshedTr.length:this.ganttChartTableBody.querySelectorAll("tr").length,a=0;a<r;a++){e=this.parent.enableImmutableMode?this.refreshedTr[a]:this.ganttChartTableBody.querySelectorAll("tr")[a],i=this.refreshedData.length>0?this.refreshedData[a]:this.parent.currentViewData[a];var n=!t.isNullOrUndefined(i.ganttProperties.segments)&&i.ganttProperties.segments.length;if(n>0)for(var s=0;s<n;s++){var o=e.getElementsByClassName("e-segmented-taskbar")[s];this.triggerQueryTaskbarInfoByIndex(o,i)}else e&&this.triggerQueryTaskbarInfoByIndex(e,i)}},i.prototype.triggerQueryTaskbarInfoByIndex=function(e,i){var r,a=this,n=!t.isNullOrUndefined(i.ganttProperties.segments)&&i.ganttProperties.segments.length>0?e:e.querySelector("."+H);i.ganttProperties.segments&&i.ganttProperties.segments.length>0&&(r=e.parentElement.parentElement.parentElement);var s={data:i,rowElement:e,taskbarElement:n,taskbarType:i.hasChildRecords?"ParentTask":i.ganttProperties.isMilestone?"Milestone":"ChildTask"},o=this.getClassName(s);if("Milestone"===s.taskbarType)s.milestoneColor=n.querySelector(o[0])?getComputedStyle(n.querySelector(o[0])).backgroundColor:null,s.baselineColor=e.querySelector(o[1])?getComputedStyle(e.querySelector(o[1])).backgroundColor:e.querySelector("."+X)?getComputedStyle(e.querySelector("."+X)).backgroundColor:null;else if(n){var l=n.querySelector(o[0]),d=n.querySelector(o[1]);s.taskbarBgColor=t.isNullOrUndefined(l)?null:n.classList.contains(ae)?getComputedStyle(n).backgroundColor:getComputedStyle(n.querySelector(o[0])).backgroundColor,s.taskbarBorderColor=t.isNullOrUndefined(l)?null:n.classList.contains(ae)?getComputedStyle(n).backgroundColor:getComputedStyle(n.querySelector(o[0])).borderColor,s.progressBarBgColor=t.isNullOrUndefined(d)?null:n.classList.contains(ne)?getComputedStyle(n).backgroundColor:getComputedStyle(n.querySelector(o[1])).backgroundColor,s.baselineColor=r?r.querySelector("."+X)?getComputedStyle(r.querySelector("."+X)).backgroundColor:null:e.querySelector("."+X)?getComputedStyle(e.querySelector("."+X)).backgroundColor:null,s.taskLabelColor=n.querySelector("."+j)?getComputedStyle(n.querySelector("."+j)).color:null}r?(s.rightLabelColor=r.querySelector("."+B)&&r.querySelector("."+B).querySelector("."+ye)?getComputedStyle(r.querySelector("."+B).querySelector("."+ye)).color:null,s.leftLabelColor=r.querySelector("."+V)&&r.querySelector("."+V).querySelector("."+ye)?getComputedStyle(r.querySelector("."+V).querySelector("."+ye)).color:null):(s.rightLabelColor=e.querySelector("."+B)&&e.querySelector("."+B).querySelector("."+ye)?getComputedStyle(e.querySelector("."+B).querySelector("."+ye)).color:null,s.leftLabelColor=e.querySelector("."+V)&&e.querySelector("."+V).querySelector("."+ye)?getComputedStyle(e.querySelector("."+V).querySelector("."+ye)).color:null),this.parent.trigger("queryTaskbarInfo",s,function(e){a.updateQueryTaskbarInfoArgs(e,void 0,void 0)})},i.prototype.updateQueryTaskbarInfoArgs=function(e,t,i){var r,a=e.rowElement,n=e.taskbarElement,s=this.getClassName(e);e.data.ganttProperties.segments&&e.data.ganttProperties.segments.length>0&&(r=a.parentElement.parentElement.parentElement),"Milestone"===e.taskbarType?(n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).backgroundColor!==e.milestoneColor&&(n.querySelector(s[0]).style.backgroundColor=e.milestoneColor),a.querySelector(s[1])&&getComputedStyle(a.querySelector(s[1])).backgroundColor!==e.baselineColor&&(a.querySelector(s[1]).style.backgroundColor=e.baselineColor),a.querySelector("."+X)&&getComputedStyle(a.querySelector("."+X)).borderTopColor!==e.baselineColor&&(a.querySelector("."+X).style.backgroundColor=e.baselineColor)):n&&(n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).backgroundColor!==e.taskbarBgColor&&(n.querySelector(s[0]).style.backgroundColor=e.taskbarBgColor),n.querySelector(s[0])&&getComputedStyle(n.querySelector(s[0])).borderColor!==e.taskbarBorderColor&&(n.querySelector(s[0]).style.borderColor=e.taskbarBorderColor),n.querySelector(s[1])&&getComputedStyle(n.querySelector(s[1])).backgroundColor!==e.progressBarBgColor&&(n.querySelector(s[1]).style.backgroundColor=e.progressBarBgColor),n.classList.contains(ae)&&getComputedStyle(n).backgroundColor!==e.taskbarBgColor&&(n.style.backgroundColor=e.taskbarBgColor),n.classList.contains(ae)&&getComputedStyle(n).borderColor!==e.taskbarBorderColor&&(n.style.borderColor=e.taskbarBorderColor),n.classList.contains(ne)&&getComputedStyle(n).backgroundColor!==e.progressBarBgColor&&(n.style.backgroundColor=e.progressBarBgColor),n.querySelector("."+j)&&getComputedStyle(n.querySelector("."+j)).color!==e.taskLabelColor&&(n.querySelector("."+j).style.color=e.taskLabelColor),r?r.querySelector("."+X)&&getComputedStyle(r.querySelector("."+X)).backgroundColor!==e.baselineColor&&(r.querySelector("."+X).style.backgroundColor=e.baselineColor):a.querySelector("."+X)&&getComputedStyle(a.querySelector("."+X)).backgroundColor!==e.baselineColor&&(a.querySelector("."+X).style.backgroundColor=e.baselineColor)),r?(r.querySelector("."+V)&&r.querySelector("."+V).querySelector("."+ye)&&getComputedStyle(r.querySelector("."+V).querySelector("."+ye)).color!==e.leftLabelColor&&(r.querySelector("."+V).querySelector("."+ye).style.color=e.leftLabelColor),r.querySelector("."+B)&&r.querySelector("."+B).querySelector("."+ye)&&getComputedStyle(r.querySelector("."+B).querySelector("."+ye)).color!==e.rightLabelColor&&(r.querySelector("."+B).querySelector("."+ye).style.color=e.rightLabelColor)):(a.querySelector("."+V)&&a.querySelector("."+V).querySelector("."+ye)&&getComputedStyle(a.querySelector("."+V).querySelector("."+ye)).color!==e.leftLabelColor&&(a.querySelector("."+V).querySelector("."+ye).style.color=e.leftLabelColor),a.querySelector("."+B)&&a.querySelector("."+B).querySelector("."+ye)&&getComputedStyle(a.querySelector("."+B).querySelector("."+ye)).color!==e.rightLabelColor&&(a.querySelector("."+B).querySelector("."+ye).style.color=e.rightLabelColor))},i.prototype.getClassName=function(e){var t=[];return t.push("."+("ParentTask"===e.taskbarType?pe:"ChildTask"===e.taskbarType?ae:re)),t.push("."+("ParentTask"===e.taskbarType?ce:"ChildTask"===e.taskbarType?ne:Y)),t},i.prototype.templateCompiler=function(e){if(!t.isNullOrUndefined(e)&&""!==e)try{return"function"!=typeof e&&document.querySelectorAll(e).length?t.compile(document.querySelector(e).innerHTML.trim(),this.parent):t.compile(e,this.parent)}catch(i){return t.compile(e,this.parent)}return null},i.prototype.updateOverlapped=function(){for(var e=0;e<this.parent.treeGrid.parentData.length;e++)for(var i=this.parent.treeGrid.parentData[e].childRecords,r=0;r<i.length;r++){i[r+1]&&(i[r].ganttProperties.eOverlapped=void 0);for(var a=r+1;a<i.length;a++)i[a].ganttProperties.eOverlapped=void 0,i[r].ganttProperties.startDate.getTime()<i[a].ganttProperties.endDate.getTime()&&i[r].ganttProperties.endDate.getTime()>i[a].ganttProperties.startDate.getTime()?(i[a].ganttProperties.eOverlapped=!0,i[r].ganttProperties.eOverlapped=!0):(t.isNullOrUndefined(i[a].ganttProperties.eOverlapped)&&(i[a].ganttProperties.eOverlapped=!1),t.isNullOrUndefined(i[r].ganttProperties.eOverlapped)&&(i[r].ganttProperties.eOverlapped=!1))}},i.prototype.updateDragDropRecords=function(e,t){var i=e.childRecords,r=this.parent.currentViewData.indexOf(e),a=this.parent.enableRtl?this.parent.element.getElementsByClassName("e-content")[2].children[0].offsetHeight:this.parent.element.getElementsByClassName("e-content")[0].children[0].offsetHeight;t||(t=this.ganttChartTableBody.childNodes[r]),t.style.height=this.parent.treeGrid.getRowByIndex(r).style.height=this.parent.rowHeight+"px",this.parent.contentHeight=a;var 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++)i[o].ganttProperties.startDate.getTime()<i[l].ganttProperties.endDate.getTime()&&i[o].ganttProperties.endDate.getTime()>i[l].ganttProperties.startDate.getTime()?d[h].getAttribute("rowuniqueid")===i[l].rowUniqueID&&-1==n.indexOf(i[l].rowUniqueID)&&(n.push(i[l].rowUniqueID),s++,t.children[0].style.verticalAlign="baseline",t.getElementsByClassName("e-taskbar-main-container")[h].style.marginTop=s*this.parent.rowHeight+this.taskBarMarginTop+"px",t.style.height=this.parent.treeGrid.getRowByIndex(r).style.height=parseInt(t.style.height)+this.parent.rowHeight+"px"):d[h].getAttribute("rowuniqueid")===i[l].rowUniqueID&&-1==n.indexOf(i[l].rowUniqueID)&&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=a,document.getElementsByClassName("e-chart-rows-container")[0].style.height=this.parent.contentHeight+"px"}},i.prototype.refreshRow=function(e,i){var r=this.ganttChartTableBody.childNodes[e],a=this.parent.currentViewData[e];if(-1!==e&&a){var n=a;!this.parent.allowTaskbarOverlap&&"ResourceView"===this.parent.viewType&&n.expanded&&(r.style.height=this.parent.treeGrid.getRowByIndex(e).style.height=this.parent.rowHeight+"px"),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&!n.expanded&&this.parent.enableMultiTaskbar?r.replaceChild(this.getResourceParent(n).childNodes[0],r.childNodes[0]):"ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&!n.expanded?r.replaceWith(this.getGanttChartRow(e,n)):r.replaceChild(this.getGanttChartRow(e,n).childNodes[0],r.childNodes[0]),this.parent.renderTemplates(),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&this.parent.showOverAllocation&&this.parent.allowTaskbarOverlap&&(i?this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData):(this.parent.dataOperation.updateOverlappingValues(n),this.parent.ganttChartModule.renderRangeContainer([n])));var s=!t.isNullOrUndefined(n.ganttProperties.segments)&&n.ganttProperties.segments.length;if(s>0)for(var o=0;o<s;o++){var l=r.getElementsByClassName("e-segmented-taskbar")[o];this.triggerQueryTaskbarInfoByIndex(l,n)}else this.triggerQueryTaskbarInfoByIndex(r,n);var d="ProjectView"===this.parent.viewType?n.ganttProperties.taskId:n.ganttProperties.rowUniqueID;this.parent.treeGrid.grid.setRowData(d,n),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&!n.expanded&&this.parent.enableMultiTaskbar&&!this.parent.allowTaskbarOverlap&&this.updateDragDropRecords(a,r),"ResourceView"===this.parent.viewType&&n.hasChildRecords&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap&&this.parent.ganttChartModule.renderRangeContainer(this.parent.currentViewData);var h=this.parent.ganttChartModule.tempNextElement;this.parent.ganttChartModule.isEditableElement&&h&&(this.parent.treeGrid.grid.focusModule.focus(),t.addClass([this.parent.treeGrid.getRows()[r.ariaRowIndex].children[this.parent.ganttChartModule.childrenIndex]],"e-focused"),this.parent.ganttChartModule.tempNextElement=null);var p=this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[e].getAttribute("data-uid"));t.isNullOrUndefined(p)||(p.data=n)}},i.prototype.updateResourceTaskbarElement=function(e,i){var r=e.querySelector(".e-taskbar-main-container");t.addClass([r],"collpse-parent-border");var a=e.querySelector("."+H).getAttribute("rowUniqueId"),n=this.parent.getRecordByID(a),s="";n&&!t.isNullOrUndefined(n.ganttProperties.eOverlapIndex)&&(s=n.ganttProperties.eOverlapIndex.toString());var o=r.cloneNode(!0);o.style.zIndex=s,i[0].childNodes[0].childNodes[0].childNodes[0].appendChild(o)},i.prototype.getResourceParent=function(e){var i=this.parent.ganttChartModule.getChartRows();if(this.parent.initialChartRowElements&&!this.parent.allowTaskbarDragAndDrop&&this.parent.allowTaskbarOverlap)for(var r=0;r<this.parent.initialChartRowElements.length;r++)t.isNullOrUndefined(i[r])||t.isNullOrUndefined(i[r].childNodes[0].childNodes[1].childNodes[2])||t.isNullOrUndefined(this.parent.initialChartRowElements[r].childNodes[0].childNodes[1].childNodes[2])||(i[r].childNodes[0].childNodes[1].childNodes[2].innerHTML=this.parent.initialChartRowElements[r].childNodes[0].childNodes[1].childNodes[2].innerHTML);this.templateData=e;var a=this.getTableTrNode(),n=this.leftLabelContainer(),s=t.createElement("div",{className:"e-collapse-parent"});a[0].childNodes[0].childNodes[0].appendChild(s);var o=this.parent.dataOperation.setSortedChildTasks(e);this.parent.dataOperation.updateOverlappingIndex(o);var l;if(this.parent.enableVirtualization)for(var d=0;d<e.childRecords.length;d++)l=this.getGanttChartRow(e.childRecords[d].index,this.parent.flatData[e.childRecords[d].index]),this.updateResourceTaskbarElement(l,a);else for(d=0;d<i.length;d++)i[d].classList.contains("gridrowtaskId"+e.ganttProperties.rowUniqueID+"level"+(e.level+1))&&this.updateResourceTaskbarElement(i[d],a);return a[0].childNodes[0].childNodes[0].appendChild([].slice.call(n)[0]),a[0].childNodes[0]},i.prototype.refreshRecords=function(e,t){if(this.parent.isGanttChartRendered){if(this.parent.renderTemplates(),"ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar){e=new a.DataManager(e).executeLocal((new a.Query).sortBy("expanded","Descending"))}for(var i=0;i<e.length;i++){var r=this.parent.currentViewData.indexOf(e[i]);this.refreshRow(r,t)}this.parent.ganttChartModule.updateLastRowBottomWidth()}},i.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("renderPanels",this.createChartTable),this.parent.off("dataReady",this.initiateTemplates),this.parent.off("destroy",this.destroy))},i.prototype.destroy=function(){this.removeEventListener()},i.prototype.generateAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),r=this.parent.localeObj.getConstant("startDate"),a=this.parent.localeObj.getConstant("endDate"),n=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+" "+r+" "+this.parent.getFormatedDate(o):(s&&(t+=i+" "+s+" "),o&&(t+=r+" "+this.parent.getFormatedDate(o)+" "),l&&(t+=a+" "+this.parent.getFormatedDate(l)+" "),d&&(t+=n+" "+this.parent.getDurationString(d,e.ganttProperties.durationUnit))),t},i.prototype.generateBaselineAriaLabel=function(e){e=this.templateData;var t="",i=this.parent.localeObj.getConstant("name"),r=this.parent.localeObj.getConstant("startDate"),a=this.parent.localeObj.getConstant("endDate"),n=e.ganttProperties.taskName,s=e.ganttProperties.baselineStartDate,o=e.ganttProperties.baselineEndDate;return t+="Baseline ",t+=i+" "+n+" ",t+=r+" "+this.parent.getFormatedDate(s)+" ",t+=a+" "+this.parent.getFormatedDate(o)+" "},i.prototype.generateSpiltTaskAriaLabel=function(e,t){var i="",r=this.parent.localeObj.getConstant("startDate"),a=this.parent.localeObj.getConstant("endDate"),n=this.parent.localeObj.getConstant("duration"),s=e.startDate,o=e.endDate,l=e.duration;return s&&(i+=r+" "+this.parent.getFormatedDate(s)+" "),o&&(i+=a+" "+this.parent.getFormatedDate(o)+" "),l&&(i+=n+" "+this.parent.getDurationString(l,t.durationUnit)),i},i.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},i}(R),Xt=function(){function e(e){this.parentRecord=[],this.parentIds=[],this.parentPredecessors=[],this.parent=e,this.dateValidateModule=this.parent.dateValidationModule}return e.prototype.ensurePredecessorCollection=function(){for(var e=this.parent.predecessorsCollection,t=e.length-1;t>=0;t--){var i=e[t],r=i.ganttProperties;(!i.hasChildRecords&&!this.parent.allowParentDependency||this.parent.allowParentDependency)&&this.ensurePredecessorCollectionHelper(i,r)}},e.prototype.ensurePredecessorCollectionHelper=function(e,i){var r=i.predecessorsName;if(!r||"string"!=typeof r&&"number"!=typeof r){if(r&&"object"==typeof r&&r.length){for(var a=[],n=0;n<r.length;n++){var s=r[n],o={};o.from=t.getValue("from",s),o.to=t.getValue("to",s)?t.getValue("to",s):i.rowUniqueID,o.type=t.getValue("type",s)?t.getValue("type",s):"FS";var l=t.getValue("offset",s);if(t.isNullOrUndefined(l))o.offset=0,o.offsetUnit=this.parent.durationUnit.toLocaleLowerCase();else if("string"==typeof l){var d=this.getOffsetDurationUnit(t.getValue("offset",s));o.offset=d.duration,o.offsetUnit=d.durationUnit}else o.offset=parseFloat(l.toString()),o.offsetUnit=this.parent.durationUnit.toLocaleLowerCase();this.checkIsParent(o.from.toString())||a.push(o)}this.parent.setRecordValue("predecessor",a,i,!0)}}else this.parent.setRecordValue("predecessor",this.calculatePredecessor(r,e),i,!0);this.parent.setRecordValue("predecessorsName",this.getPredecessorStringValue(e),i,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,i.predecessorsName,e),this.parent.setRecordValue(this.parent.taskFields.dependency,i.predecessorsName,e)},e.prototype.updateUnscheduledDependency=function(e){for(var i=this.parent.taskFields,r=t.isNullOrUndefined(e[i.dependency])?[]:e[i.dependency].toString().split(","),a=0;a<r.length;a++){var n=parseInt(r[a],10);if(!isNaN(n)){var s=this.parent.getRecordByID(n.toString()),o=t.isNullOrUndefined(s)?null:t.extend({},{},s.taskData,!0);!t.isNullOrUndefined(o)&&t.isNullOrUndefined(o[i.startDate])&&t.isNullOrUndefined(o[i.duration])&&t.isNullOrUndefined(o[i.endDate])&&(o[i.duration]=1,o[i.startDate]=this.parent.projectStartDate,this.parent.updateRecordByID(o))}}},e.prototype.checkIsParent=function(e){var t=!1;return this.parent.connectorLineModule.getRecordByID(e).hasChildRecords&&(t=!0),t},e.prototype.calculatePredecessor=function(e,t){var i,r,a,n,s=this,o=[];return e.toString().split(",").forEach(function(e){r=e.split("+"),a="+",e.indexOf("-")>=0&&(r=e.split("-"),a="-"),i=[];var l="ResourceView"===s.parent.viewType?s.parent.getTaskIds():s.parent.ids;-1!==("ResourceView"===s.parent.viewType?l.indexOf("T"+r[0]):l.indexOf(r[0]))?i[0]=r[0]:-1===l.indexOf(r[0])?1===(i=r[0].split(" ")).length&&(-1!=i[0].indexOf(" ")?i=r[0].match(/(\d+|[A-z]+)/g):(i[0]=r[0].slice(0,-2),i[1]=r[0].slice(-2))):i[0]=r[0];var d="ResourceView"===s.parent.viewType?l.indexOf("T"+i[0]):l.indexOf(i[0]);if(i[0]&&-1!==d){if(i.length>1){var h=i[1].toUpperCase();n="FS"===h||"FF"===h||"SF"===h||"SS"===h?h:"FS"}else n="FS";var p=r.length>1?a+""+r[1]:"0",c=s.getOffsetDurationUnit(p),u={from:i[0],type:n,isDrawn:!1,to:"ResourceView"===s.parent.viewType?t.ganttProperties.taskId.toString():t.ganttProperties.rowUniqueID.toString(),offsetUnit:c.durationUnit,offset:c.duration},g=s.checkIsParent(i[0]);if(s.parent.allowParentDependency){var f=s.parent.connectorLineModule.getRecordByID(u.to),m=s.parent.connectorLineModule.getRecordByID(u.from);s.parent.connectorLineEditModule&&m&&f?s.parent.connectorLineEditModule.validateParentPredecessor(m,f)&&o.push(u):o.push(u),i.splice(0)}else g||o.push(u)}}),o},e.prototype.getPredecessorStringValue=function(e){var i,r,a=e.ganttProperties.predecessor,n=this.parent.durationUnitTexts,s="";if(r=[],a)for(var o=a.length,l=0;l<o;l++){var d=a[l],h="",p="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(d.from!==p.toString()){if(h=d.from+d.type,"string"==typeof e.ganttProperties.taskId?(r[0]=h.slice(0,-2),r[1]=h.slice(-2),i=r[0]+" "+r[1]):i=h,h=i,0!==d.offset){h+=d.offset>0?"+"+d.offset+" ":d.offset+" ";var c=1!==d.offset;"day"===d.offsetUnit?h+=c?t.getValue("days",n):t.getValue("day",n):"hour"===d.offsetUnit?h+=c?t.getValue("hours",n):t.getValue("hour",n):h+=c?t.getValue("minutes",n):t.getValue("minute",n)}s=s.length>0?s+","+h:h}}return s},e.prototype.getOffsetDurationUnit=function(e){var i=0,r=this.parent.durationUnit.toLocaleLowerCase(),a=this.parent.durationUnitEditText;if("string"==typeof e){for(var n=e.match(/[^0-9]+|[0-9]+/g),s=0;s<n.length;s++)n[s]=n[s].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]),r=n[1]?n[1].toLowerCase().trim():"",r=-1!==t.getValue("minute",a).indexOf(r)?"minute":-1!==t.getValue("hour",a).indexOf(r)?"hour":-1!==t.getValue("day",a).indexOf(r)?"day":this.parent.durationUnit.toLocaleLowerCase())}else i=e,r=this.parent.durationUnit.toLocaleLowerCase();return isNaN(i)&&(i=0,r=this.parent.durationUnit.toLocaleLowerCase()),{duration:i,durationUnit:r}},e.prototype.updatePredecessors=function(){for(var e,t=this.parent.predecessorsCollection,i=t.length,r=0;r<i;r++)(!(e=t[r]).hasChildRecords&&!this.parent.allowParentDependency||this.parent.allowParentDependency)&&(this.updatePredecessorHelper(e,t),e.ganttProperties.isAutoSchedule||this.parent.connectorLineEditModule.calculateOffset(e))},e.prototype.updatePredecessorHelper=function(e,i){var r,a=e.ganttProperties.predecessor,n=a.length;i=t.isNullOrUndefined(i)?[]:i;for(var s=0;s<n;s++){var o=a[s];r=this.parent.connectorLineModule.getRecordByID(o.from);var l="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(o.from!==l.toString()&&r){var d=void 0;r.ganttProperties.predecessor?((d=t.extend([],r.ganttProperties.predecessor,[],!0)).push(o),this.parent.setRecordValue("predecessor",d,r.ganttProperties,!0)):((d=[]).push(o),this.parent.setRecordValue("predecessor",d,r.ganttProperties,!0),i.push(r))}}},e.prototype.updatedRecordsDateByPredecessor=function(){if(this.parent.autoCalculateDateScheduling)for(var e=this.parent.flatData,t=this.parent.flatData.length,i=0;i<t;i++)if(e[i].ganttProperties.predecessorsName){this.validatePredecessorDates(e[i]);var r=e[i].ganttProperties.predecessor;if(r&&r.length>1)for(var a=0;a<r.length;a++){var n=this.parent.getRecordByID(r[a].to);n&&this.validatePredecessorDates(n)}e[i].hasChildRecords&&this.parent.editModule&&!this.parent.allowUnscheduledTasks&&this.parent.allowParentDependency&&this.parent.editModule.updateChildItems(e[i])}},e.prototype.updateParentPredecessor=function(){if(this.parent.enablePredecessorValidation)for(var e=this.parentPredecessors.length-1;e>=0;e--){var t=this.parentPredecessors[e];this.validatePredecessorDates(t),t.ganttProperties.startDate&&this.parent.editModule.updateChildItems(t)}},e.prototype.validatePredecessorDates=function(e){if(e.ganttProperties.predecessor){var t=e.ganttProperties.predecessor,i=void 0,r=void 0,a=null,n="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString(),s=t.filter(function(e){return e.to===n?e:null});for(i=0;i<s.length;i++){var o=s[i];r=this.parent.connectorLineModule.getRecordByID(o.from),a=this.parent.connectorLineModule.getRecordByID(o.to),this.parent.allowParentDependency&&this.parent.isLoad&&-1==this.parentPredecessors.indexOf(e)&&(e.hasChildRecords||a.hasChildRecords)&&this.parentPredecessors.push(e),(a.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)&&this.validateChildGanttRecord(r,a)}}},e.prototype.validateChildGanttRecord=function(e,i){if(this.parent.editedTaskBarItem!==i&&!t.isNullOrUndefined(m(e.ganttProperties))&&!t.isNullOrUndefined(m(i.ganttProperties))&&this.parent.isInPredecessorValidation&&(i.ganttProperties.isAutoSchedule||this.parent.validateManualTasksOnLinking)){var r=i.ganttProperties,a="ResourceView"===this.parent.viewType?r.taskId.toString():r.rowUniqueID.toString(),n=r.predecessor.filter(function(e){return e.to===a?e:null}),s=this.getPredecessorDate(i,n);this.parent.setRecordValue("startDate",s,r,!0),this.parent.dataOperation.updateMappingData(i,"startDate");var o=i.ganttProperties.segments;t.isNullOrUndefined(o)&&this.dateValidateModule.calculateEndDate(i),this.parent.dataOperation.updateWidthLeft(i),!this.parent.isLoad&&!this.parent.isFromOnPropertyChange&&i.parentItem&&this.parent.isInPredecessorValidation&&this.parent.getParentTask(i.parentItem).ganttProperties.isAutoSchedule&&-1===this.parentIds.indexOf(i.parentItem.uniqueID)&&(this.parentIds.push(i.parentItem.uniqueID),this.parentRecord.push(i.parentItem))}},e.prototype.getPredecessorDate=function(e,t){var i,r,a,n,s=this,o=t.filter(function(t){var i="ResourceView"===s.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;return t.to===i.toString()?t:null});if(o)for(var l=o.length,d=0;d<l;d++){var h=o[d];a=this.parent.connectorLineModule.getRecordByID(h.from),n=this.parent.connectorLineModule.getRecordByID(h.to),r=this.getValidatedStartDate(n.ganttProperties,a.ganttProperties,h),null!=i&&1!==this.dateValidateModule.compareDates(r,i)||(i=r)}return i},e.prototype.getValidatedStartDate=function(e,t,i){var r,a,n=i.type,s=i.offset;switch(n){case"FS":r=this.dateValidateModule.getValidEndDate(t),e.isMilestone&&0===s||(r=this.dateValidateModule.checkStartDate(r,e)),0!==s&&(r=this.updateDateByOffset(r,i,e)),a=e.isMilestone?r:this.dateValidateModule.checkStartDate(r,e);break;case"FF":case"SF":r="FF"===n?this.dateValidateModule.getValidEndDate(t):this.dateValidateModule.getValidStartDate(t),0!==s&&(r=this.updateDateByOffset(r,i,e)),e.isMilestone||(r=this.dateValidateModule.checkEndDate(r,e)),a=this.dateValidateModule.getStartDate(r,e.duration,e.durationUnit,e);break;case"SS":r=this.dateValidateModule.getValidStartDate(t),0!==s&&(r=this.updateDateByOffset(r,i,e)),a=e.isMilestone?r:this.dateValidateModule.checkStartDate(r,e)}return a},e.prototype.updateDateByOffset=function(e,t,i){var r,a=t.offset,n=t.offsetUnit;return a<0?r=this.dateValidateModule.getStartDate(this.dateValidateModule.checkEndDate(e,i),-1*a,n,i,!0):(r=this.dateValidateModule.getEndDate(e,a,n,i,!1),i.isMilestone||(r=this.dateValidateModule.checkStartDate(r,i))),r},e.prototype.createConnectorLinesCollection=function(e){var t,i,r=e||this.parent.currentViewData,a=r.length;for(this.parent.connectorLineModule.expandedRecords=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.updatedRecords:this.parent.getExpandedRecords(this.parent.updatedRecords),t=0;t<a;t++)(i=r[t].ganttProperties.predecessor)&&this.addPredecessorsCollection(i)},e.prototype.addPredecessorsCollection=function(e){var t,i,r,a,n;if(e)for(t=e.length,i=0;i<t;i++){r=e[i];a=this.parent.connectorLineModule.getRecordByID(r.from),n=this.parent.connectorLineModule.getRecordByID(r.to),this.parent.connectorLineModule.expandedRecords&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(a)&&-1!==this.parent.connectorLineModule.expandedRecords.indexOf(n)&&this.updateConnectorLineObject(a,n,r)}},e.prototype.updateConnectorLineObject=function(e,t,i){var r=this.parent.connectorLineModule.createConnectorLineObject(e,t,i);if(r){if(t.isCritical&&e.isCritical&&(r.isCritical=!0),this.parent.connectorLineIds.length>0&&-1===this.parent.connectorLineIds.indexOf(r.connectorLineId)||0===this.parent.connectorLineIds.length)this.parent.updatedConnectorLineCollection.push(r),this.parent.connectorLineIds.push(r.connectorLineId);else if(-1!==this.parent.connectorLineIds.indexOf(r.connectorLineId)){var a=this.parent.connectorLineIds.indexOf(r.connectorLineId);this.parent.updatedConnectorLineCollection[a]=r}i.isDrawn=!0}return r},e.prototype.validatePredecessor=function(e,t,i){if(this.parent.isInPredecessorValidation&&e.ganttProperties.predecessor){var r=this.parent.editModule.taskbarEditModule,a=void 0;r&&(a=r.taskBarEditRecord);for(var n=e.ganttProperties.predecessor,s=void 0,o=null,l=void 0,d=void 0,h="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString(),p=n.filter(function(e){return e.to===h?e:null}),c=n.filter(function(e){return e.from===h?e:null}),u=0;u<p.length;u++){l=p[u],s=this.parent.connectorLineModule.getRecordByID(l.from),o=this.parent.connectorLineModule.getRecordByID(l.to),this.parent.isInPredecessorValidation&&o.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1;var g="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;g.toString()!==l.to&&g.toString()!==l.from||i&&"predecessor"!==i||this.validateChildGanttRecord(s,o)}for(u=0;u<c.length;u++)d=c[u],s=this.parent.connectorLineModule.getRecordByID(d.from),o=this.parent.connectorLineModule.getRecordByID(d.to),this.parent.isInPredecessorValidation&&o.ganttProperties.isAutoSchedule?this.parent.isValidationEnabled=!0:this.parent.isValidationEnabled=!1,"predecessor"!==i&&this.parent.isValidationEnabled?this.validateChildGanttRecord(s,o):!o.ganttProperties.isAutoSchedule&&this.parent.UpdateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule.calculateOffset(o),!1!==s.expanded&&o.expanded,o&&this.validatePredecessor(o,void 0,"successor");if(o&&o.ganttProperties.taskId!==this.isValidatedParentTaskID&&a){var f=!1,m=a.ganttProperties.predecessorsName?a.ganttProperties.predecessorsName.split(",").length:a.ganttProperties.predecessorsName,y=a.ganttProperties.predecessor?a.ganttProperties.predecessor.length:a.ganttProperties.predecessor;y&&m!==y?f=!0:o.hasChildRecords&&o.ganttProperties.predecessor.length>0&&a.hasChildRecords&&!a.ganttProperties.predecessor&&(f=!0),"ParentDrag"!==r.taskBarEditAction&&"ChildDrag"!==r.taskBarEditAction?!a.hasChildRecords&&o.hasChildRecords&&(this.parent.editModule.updateChildItems(o),this.isValidatedParentTaskID=o.ganttProperties.taskId):(o.hasChildRecords&&"ChildDrag"==r.taskBarEditAction||f&&"ParentDrag"==r.taskBarEditAction)&&(this.parent.editModule.updateChildItems(o),this.isValidatedParentTaskID=o.ganttProperties.taskId),a.hasChildRecords||this.parent.dataOperation.updateParentItems(o,!0)}else o&&o.hasChildRecords&&!a&&this.parent.editModule.updateChildItems(o)}},e.prototype.getValidPredecessor=function(e){var i=this,r=[];if(!t.isNullOrUndefined(e)){var a=e.ganttProperties.predecessor;a&&a.length>0&&(r=a.filter(function(t){var r="ResourceView"===i.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;return t.from!==r.toString()}))}return r},e}(),Yt=function(){function e(e){this.transform="",this.connectorLinePath="",this.arrowPath="",this.expandedRecords=[],this.parent=e,this.dependencyViewContainer=t.createElement("div",{className:we}),Object.assign(this.dependencyViewContainer.style,{width:"100%",height:"100%",zIndex:2,position:"absolute",pointerEvents:"none"}),this.renderer=new s.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%")}return e.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},e.prototype.initPublicProp=function(){this.lineColor=this.parent.connectorLineBackground,this.lineStroke=this.parent.connectorLineWidth>4?4:this.parent.connectorLineWidth,this.createConnectorLineTooltipTable()},e.prototype.getTaskbarMidpoint=function(e){return Math.floor(e?this.parent.chartRowsModule.milestoneMarginTop+this.parent.chartRowsModule.milestoneHeight/2+1:this.parent.chartRowsModule.taskBarMarginTop+this.parent.chartRowsModule.taskBarHeight/2)+1},e.prototype.createConnectorLineObject=function(e,i,r){var a={},n=this.parent.pdfExportModule&&this.parent.pdfExportModule.isPdfExport?this.parent.flatData:this.expandedRecords,s=n.indexOf(e),o=n.indexOf(i),l=e.ganttProperties,d=i.ganttProperties,h=this.parent.virtualScrollModule&&this.parent.enableVirtualization?this.parent.currentViewData:this.parent.getExpandedRecords(this.parent.currentViewData);a.parentIndexInCurrentView=h.indexOf(e),a.childIndexInCurrentView=h.indexOf(i);if(!(this.parent.virtualScrollModule&&this.parent.enableVirtualization)&&(-1===a.parentIndexInCurrentView||-1===a.childIndexInCurrentView)||-1===a.parentIndexInCurrentView&&-1===a.childIndexInCurrentView)return null;a.parentLeft=l.isMilestone?l.left-this.parent.chartRowsModule.milestoneHeight/2:l.left,a.childLeft=d.isMilestone?d.left-this.parent.chartRowsModule.milestoneHeight/2:d.left,a.parentWidth=0===l.width||l.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):l.width,a.childWidth=0===d.width||d.isMilestone?Math.floor(this.parent.chartRowsModule.milestoneHeight):d.width,a.parentIndex=s,a.childIndex=o;var p=!t.isNullOrUndefined(this.parent.ganttChartModule.getChartRows())&&this.parent.ganttChartModule.getChartRows()[0]&&this.parent.ganttChartModule.getChartRows()[0].getBoundingClientRect().height;a.rowHeight=p&&!isNaN(p)?p:this.parent.rowHeight,a.type=r.type;var c="ResourceView"===this.parent.viewType?l.taskId:l.rowUniqueID,u="ResourceView"===this.parent.viewType?d.taskId:d.rowUniqueID;return a.connectorLineId="parent"+c+"child"+u,a.milestoneParent=!!l.isMilestone,a.milestoneChild=!!d.isMilestone,a.isManualParent=!this.parent.flatData[s].ganttProperties.isAutoSchedule&&this.parent.flatData[s].hasChildRecords,a.isManualChild=!this.parent.flatData[o].ganttProperties.isAutoSchedule&&this.parent.flatData[o].hasChildRecords,a.parentEndPoint=a.parentLeft+a.parentWidth,a.childEndPoint=a.childLeft+a.childWidth,t.isNullOrUndefined(m(l))||t.isNullOrUndefined(m(d))?null:a},e.prototype.renderConnectorLines=function(e){for(var t="",i=[],r=0;r<e.length;r++)t+=this.getConnectorLineTemplate(e[r]),i.push(e[r]);this.svgObject.innerHTML=t;for(var a=this.parent.connectorLineModule.svgObject.childNodes,n=0;n<a.length;n++)for(var s=a[n].childNodes,o=0;o<s.length;o++){var l="Connector Line "+this.parent.connectorLineModule.generateAriaLabel(i[n]);s[o].setAttribute("aria-label",l)}this.parent.ganttChartModule.chartBodyContent.insertBefore(this.dependencyViewContainer,this.parent.ganttChartModule.chartBodyContent.lastChild),this.dependencyViewContainer.appendChild(this.svgObject);for(n=0;n<this.svgObject.children.length;n++)this.svgObject.children[n].children[0].setAttribute("tabindex","-1")},e.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";if("FF"===e.type)return"FFType2"}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("FF"===e.type)return"FFType1"}else if(e.childLeft+e.childWidth>e.parentLeft+e.parentWidth&&"FF"===e.type)return"FFType2";if("FS"===e.type)return"FSType2";if("SS"===e.type)return"SSType2";if("FF"===e.type)return"FFType1";if("SF"===e.type)return"SFType1"}else if(e.parentLeft<e.childLeft){if("FS"===e.type)return"FSType2";if("FF"===e.type)return"FFType2";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 30>=e.childLeft-(e.milestoneParent?e.parentLeft+e.parentWidth+4:e.parentLeft+e.parentWidth)?"FSType3":"FSType4";if(e.parentLeft<e.childLeft||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.childLeft+e.childWidth>e.parentLeft+e.parentWidth&&"FF"===e.type)return"FFType4"}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},e.prototype.getHeightValue=function(e){return"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap?e.parentIndex*this.parent.rowHeight>e.childIndex*this.parent.rowHeight?e.parentIndex*this.parent.rowHeight-e.childIndex*this.parent.rowHeight:e.childIndex*this.parent.rowHeight-e.parentIndex*this.parent.rowHeight:e.parentIndex*e.rowHeight>e.childIndex*e.rowHeight?e.parentIndex*e.rowHeight-e.childIndex*e.rowHeight:e.childIndex*e.rowHeight-e.parentIndex*e.rowHeight},e.prototype.getInnerElementWidthSSType2=function(e){return e.parentLeft===e.childLeft?10:e.childLeft-e.parentLeft},e.prototype.getInnerElementLeftSSType2=function(e){return e.parentLeft===e.childLeft?e.parentLeft-20:e.parentLeft-10},e.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},e.prototype.getBorderStyles=function(e,i){return"border-"+e+"-width:"+i+"px;"+("border-"+e+"-style:solid;")+(t.isNullOrUndefined(this.lineColor)?"":"border-"+e+"-color:"+this.lineColor+";")},e.prototype.getConnectorLineTemplate=function(e){var t=this.getInnerChildWidthSSType2(e),i=this.getInnerElementWidthSSType2(e),r=this.getInnerElementLeftSSType2(e),a=this.getHeightValue(e),n=(e.milestoneParent,e.milestoneChild,this.parent.virtualScrollModule&&this.parent.enableVirtualization),s=this.getPosition(e,this.getParentPosition(e),a),o=this.getPosition(e,this.getParentPosition(e),a).top,l=0;this.parent.renderBaseline&&(l=e.milestoneParent&&e.milestoneChild?0:e.milestoneParent?-5:e.milestoneChild?5:0);var d=n?s.height:a+l,h=0,p=0,c=0;if("ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&!this.parent.allowTaskbarOverlap){for(var u=0;u<this.parent.currentViewData.length;u++)"none"!=this.parent.getRowByIndex(u).style.display&&c<e.parentIndex&&(c++,h+=this.parent.getRowByIndex(u).offsetHeight);c=0;for(var g=0;g<this.parent.currentViewData.length;g++)"none"!=this.parent.getRowByIndex(g).style.display&&c<e.childIndex&&(c++,p+=this.parent.getRowByIndex(g).offsetHeight);d=Math.abs(h-p)}if(this.parent.currentViewData[e.parentIndex]&&this.parent.currentViewData[e.childIndex]&&this.parent.allowParentDependency){var f=this.parent.currentViewData[e.parentIndex].hasChildRecords,m=this.parent.currentViewData[e.childIndex].hasChildRecords,y=this.parent.currentViewData[e.parentIndex].ganttProperties.isAutoSchedule,D=this.parent.currentViewData[e.childIndex].ganttProperties.isAutoSchedule,v=!0;(f&&y&&!m||m&&D&&!f||f&&y&&D&&m||!f&&!m)&&(v=!1),v&&(f&&!y&&m&&!D||f&&!y&&m&&!D||(e.childIndex,e.parentIndex),this.parent.currentViewData[e.parentIndex].ganttProperties.isMilestone?e.parentIndex>e.childIndex||"SS"===e.type||e.type:this.parent.currentViewData[e.childIndex].ganttProperties.isMilestone&&(e.parentIndex>e.childIndex||"SS"===e.type||e.type))}return this.getParentPosition(e)&&(this.transform=this.parent.enableRtl?"translate("+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:ke}),this.connectorPath=this.renderer.drawPath({class:Te,d:this.connectorLinePath,fill:"transparent","stroke-width":1}),this.arrowlinePath=this.renderer.drawPath({d:this.arrowPath,class:Se}),this.groupObject.appendChild(this.connectorPath),this.groupObject.appendChild(this.arrowlinePath),"FSType1"===this.getParentPosition(e)&&(this.taskLineValue=e.milestoneChild?1:0,this.x1=e.parentEndPoint+(e.milestoneParent?-1:e.milestoneChild?-1:0),this.x2=e.milestoneParent?e.childLeft-(e.parentEndPoint+10)+1-10+1:e.childLeft-(e.parentEndPoint+10)-10,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+this.y2)+" L "+(this.x1+this.x2+11)+" "+(this.y1+this.y2),this.arrowPath="M "+(this.x1+this.x2+18)+" "+(this.y1+this.y2+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1+this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1+this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FSType2"===this.getParentPosition(e)&&(this.taskLineValue=e.milestoneChild?1:0,this.x1=e.parentLeft+(e.milestoneChild?-1:0),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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d-this.getconnectorLineGap(e)+this.taskLineValue,this.y3=this.getconnectorLineGap(e),this.y4=this.y1+this.y2-(this.y1+this.y2)%e.rowHeight,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x3)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x3)+" "+this.y4+" L "+(this.x1+this.x4)+" "+this.y4+" L "+(this.x1+this.x4)+" "+(this.y1+this.y2+this.y3)+" L "+(this.x1+this.x4+11)+" "+(this.y1+this.y2+this.y3),this.arrowPath="M "+(this.x1+this.x4+18)+" "+(this.y1+this.y2+this.y3+this.manualChild)+" L "+(this.x1+this.x4+11)+" "+(this.y1+this.y2+this.y3-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x4+11)+" "+(this.y1+this.y2+this.y3+4+this.lineStroke+this.manualChild)+" Z"),"FSType3"===this.getParentPosition(e)&&(this.taskLineValue=e.milestoneChild?1:0,this.point1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),this.x1=e.childLeft+(e.milestoneChild?-1:0)+(e.milestoneParent?1:0)-20,this.x2=e.parentEndPoint-e.childLeft+30,this.y1=this.point1+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.point1+d-this.getconnectorLineGap(e)+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneChild?-10:0),this.y3=this.getconnectorLineGap(e)+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.y4=this.y2-this.y2%e.rowHeight,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+12)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" 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+18)+" "+(this.y1+this.manualChild)+" L "+(this.x1+11)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+11)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"FSType4"===this.getParentPosition(e)&&(this.point1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),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)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.point1+d+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2+11)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2)+" "+this.y2+" L "+this.x1+" "+this.y2,this.arrowPath="M "+(this.x1+this.x2+18)+" "+(this.y1+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x2+11)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SSType4"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=d+this.taskLineValue,this.point2=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),this.x1=e.parentLeft-8,this.x2=e.childLeft-e.parentLeft,this.y1=this.point2+(e.milestoneChild?1:0)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+10)+" "+this.y2,this.arrowPath="M "+(this.x1+this.x2+8)+" "+(this.y1+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x2)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SSType3"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue,this.x1=e.childLeft-20,this.y1=(e.milestoneChild?1:0)+(this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild))+(e.isManualParent&&e.isManualChild?-10:0),this.x2=e.parentLeft-e.childLeft+21,this.y2=this.y1+this.point1+(this.parent.renderBaseline?e.milestoneChild?-11:e.milestoneParent?10:0:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+12)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+this.x2)+" "+this.y2,this.arrowPath="M "+(this.x1+20)+" "+(this.y1+this.manualChild)+" L "+(this.x1+12)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+12)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SSType2"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue,this.x1=r,this.x2=t+1,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+i)+" "+this.y2,this.arrowPath="M "+(this.x1+i+8)+" "+(this.y2+this.manualChild)+" L "+(this.x1+i)+" "+(this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+i)+" "+(this.y2+4+this.lineStroke+this.manualChild)+" Z"),"SSType1"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d+this.taskLineValue,this.x1=e.childLeft-20,this.x2=e.parentLeft-e.childLeft+21,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+ +(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y2+" L "+(this.x1+12)+" "+this.y2,this.arrowPath="M "+(this.x1+20)+" "+(this.y2+this.manualChild)+" L "+(this.x1+12)+" "+(this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+12)+" "+(this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FFType1"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2)+" L "+(this.x1+this.x4)+" "+(this.y1+this.y2),this.arrowPath="M "+this.x1+" "+(this.y1+this.y2+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1+this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1+this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FFType2"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x2+" "+(this.y1+this.y2)+" L "+this.x3+" "+(this.y1+this.y2),this.arrowPath="M "+(this.x3-8)+" "+(this.y1+this.y2+this.manualChild)+" L "+this.x3+" "+(this.y1+this.y2-(4+this.lineStroke)+this.manualChild)+" L "+this.x3+" "+(this.y1+this.y2+4+this.lineStroke+this.manualChild)+" Z"),"FFType3"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x2+this.x3)+" "+(this.y1+this.y2)+" L "+this.x4+" "+(this.y1+this.y2),this.arrowPath="M "+this.x1+" "+(this.y1+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+8)+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"FFType4"===this.getParentPosition(e)&&(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=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=d+this.taskLineValue+ +(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.y2)+" L "+this.x1+" "+(this.y1+this.y2),this.arrowPath="M "+(this.x2-8)+" "+(this.y1+this.manualChild)+" L "+this.x2+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+this.x2+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SFType4"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?-1:0,this.point1=d-this.getconnectorLineGap(e)+this.taskLineValue,this.point2=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),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+(e.milestoneChild?1:0)+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+this.point1+(this.parent.renderBaseline&&e.milestoneChild?-11:0),this.y3=this.getconnectorLineGap(e)+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.y4=this.y2-this.y2%e.rowHeight,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+this.y4+" L "+this.x1+" "+this.y4+" L "+this.x1+" "+(this.y2+this.y3)+" L "+(this.x1+11)+" "+(this.y2+this.y3),this.arrowPath="M "+(this.x2-8)+" "+(this.y1+this.manualChild)+" L "+this.x2+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+this.x2+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SFType3"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.point1=e.parentLeft-(e.childEndPoint+(e.milestoneParent?25:20))+1+(this.parent.renderBaseline&&e.milestoneParent?5:0),this.point2=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.childIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneChild),this.x1=e.childEndPoint,this.x2=this.x1+(e.milestoneChild?9:8),this.x3=this.x2+(e.milestoneChild?17:11),this.y1=this.point2+(e.isManualParent&&e.isManualChild?-10:0),this.y2=this.y1+d+this.taskLineValue+(this.parent.renderBaseline&&e.milestoneParent?10:0),this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+this.x2+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x3+" "+this.y2+" L "+(this.x3+this.point1)+" "+this.y2,this.arrowPath="M "+(this.x2-8)+" "+(this.y1+this.manualChild)+" L "+this.x2+" "+(this.y1-(4+this.lineStroke)+this.manualChild)+" L "+this.x2+" "+(this.y1+4+this.lineStroke+this.manualChild)+" Z"),"SFType1"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:e.milestoneChild?1:0,this.point1=d-this.getconnectorLineGap(e)+this.taskLineValue,this.point2=this.getconnectorLineGap(e),this.x1=e.parentLeft-10,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+ +(e.isManualParent&&e.isManualChild?-10:0),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,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+11)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+(this.y1+this.manualParent+this.manualChild)+" L "+this.x1+" "+this.y3+" L "+(this.x1+this.x2)+" "+this.y3+" L "+(this.x1+this.x2)+" "+(this.y2+this.point2)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2),this.arrowPath="M "+(this.x1+this.x3-8)+" "+(this.y2+this.point2+this.manualChild)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+this.x3)+" "+(this.y2+this.point2+4+this.lineStroke+this.manualChild)+" Z"),"SFType2"===this.getParentPosition(e)&&(this.taskLineValue=this.parent.renderBaseline?this.taskLineValue:0,this.x1=e.childEndPoint,this.y1=this.parent.enableVirtualization?o:(this.parent.allowTaskbarOverlap?e.parentIndex*e.rowHeight:h)+this.getTaskbarMidpoint(e.milestoneParent)+ +(e.isManualParent&&e.isManualChild?-10:0),this.x2=e.parentLeft-e.childEndPoint,this.y2=this.y1+d+this.taskLineValue,this.manualParent=e.isManualParent&&!e.isManualChild?-10:0,this.manualChild=e.isManualChild&&!e.isManualParent?-10:0,this.connectorLinePath="M "+(this.x1+this.x2+1)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2-10)+" "+(this.y1+this.manualParent+this.manualChild)+" L "+(this.x1+this.x2-10)+" "+this.y2+" L "+(this.x1+8)+" "+this.y2,this.arrowPath="M "+this.x1+" "+(this.y2+this.manualChild)+" L "+(this.x1+8)+" "+(this.y2-(4+this.lineStroke)+this.manualChild)+" L "+(this.x1+8)+" "+(this.y2+4+this.lineStroke+this.manualChild)+" Z"),this.connectorPath.setAttribute("d",this.connectorLinePath),this.arrowlinePath.setAttribute("d",this.arrowPath)),this.groupObject.outerHTML},e.prototype.getPosition=function(e,t,i){var r=0,a=0;if(this.parent.virtualScrollModule&&this.parent.enableVirtualization){var n=!!e.milestoneParent,s=!!e.milestoneChild,o=this.getTaskbarMidpoint(n)-(this.lineStroke-1),l=this.getTaskbarMidpoint(s)-(this.lineStroke-1),d=-1!==e.parentIndexInCurrentView,h=-1!==e.childIndexInCurrentView,p=this.parent.currentViewData.length-1;"SSType1"===t||"SSType2"===t||"FFType1"===t||"FFType2"===t||"SFType2"===t?(r=d?e.parentIndexInCurrentView*e.rowHeight+o:0,a=d&&h?i:h?e.childIndexInCurrentView*e.rowHeight+o:p*e.rowHeight+o):"SSType3"===t||"SSType4"===t||"FSType4"===t||"FFType3"===t||"FFType4"===t||"SFType4"===t||"SFType3"===t?(r=h?e.childIndexInCurrentView*e.rowHeight+l:0,a=d&&h?i:d?e.parentIndexInCurrentView*e.rowHeight+l:p*e.rowHeight+l):"FSType3"===t?(r=h?e.childIndexInCurrentView*e.rowHeight+o:0,a=d&&h?i:d?e.parentIndexInCurrentView*e.rowHeight+l:p*e.rowHeight+o):"SFType1"!==t&&"FSType1"!==t&&"FSType2"!==t||(r=d?e.parentIndexInCurrentView*e.rowHeight+l:0,a=d&&h?i:h?e.childIndexInCurrentView*e.rowHeight+l:p*e.rowHeight+l)}return{top:r,height:a}},e.prototype.createConnectorLineTooltipTable=function(){this.tooltipTable=t.createElement("table",{className:".e-tooltiptable",styles:"margin-top:0px",attrs:{cellspacing:"2px",cellpadding:"2px"}});var e=t.createElement("tbody");e.innerHTML="",this.tooltipTable.appendChild(e)},e.prototype.getConnectorLineTooltipInnerTd=function(e,t,i,r){var a='<tr id="fromPredecessor"><td style="padding: 4px;">'+this.parent.localeObj.getConstant("from")+"</td><td> ";return a=a+e+' </td><td style="padding: 2px;"> '+this.parent.localeObj.getConstant(t)+" </td> </tr>",a=a+'<tr id="toPredecessor"><td style="padding: 4px;">'+this.parent.localeObj.getConstant("to")+"</td><td> "+i,a=a+' </td><td style="padding: 2px;"> '+this.parent.localeObj.getConstant(r)+" </td></tr></tbody><table>"},e.prototype.generateAriaLabel=function(e){var t=e.type,i=this.expandedRecords,r=i[e.parentIndex].ganttProperties.taskName,a=i[e.childIndex].ganttProperties.taskName,n=this.parent.localeObj.getConstant("start"),s=this.parent.localeObj.getConstant("finish");return"FS"===t?r+" "+s+" to "+a+" "+n:"FF"===t?r+" "+s+" to "+a+" "+s:"SS"===t?r+" "+n+" to "+a+" "+n:r+" "+n+" to "+a+" "+s},e.prototype.getRecordByID=function(e){return t.isNullOrUndefined(e)?null:"ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf("T"+e.toString())]:this.parent.flatData[this.parent.ids.indexOf(e.toString())]},e.prototype.removePreviousConnectorLines=function(e){for(var i,r=(i=!0===t.isObject(e))?Object.keys(e).length:e.length,a=Object.keys(e),n=0;n<r;n++){var s=void 0;if(i){s=e[a[n]]}else s=e[n];var o=s.ganttProperties&&s.ganttProperties.predecessor;if(o&&o.length>0)for(var l=0;l<o.length;l++){var d="parent"+o[l].from+"child"+o[l].to;this.removeConnectorLineById(d)}}},e.prototype.removeConnectorLineById=function(e){var i=this.parent.connectorLineModule.dependencyViewContainer.querySelector("#ConnectorLine"+e);t.isNullOrUndefined(i)||t.remove(i)},e}(),Zt=function(){function e(e){this.parent=e,this.parent.on("destroy",this.destroy,this)}return e.prototype.renderSplitter=function(){var e=this,i=this.calculateSplitterPosition(this.parent.splitterSettings);this.parent.splitterElement=t.createElement("div",{className:"e-gantt-splitter"}),this.parent.treeGridPane=t.createElement("div",{className:"e-gantt-tree-grid-pane"}),this.parent.chartPane=t.createElement("div",{className:"e-gantt-chart-pane"}),t.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 o.Splitter({height:null,width:this.parent.ganttWidth.toString(),enablePersistence:this.parent.enablePersistence,enableRtl:this.parent.enableRtl,separatorSize:this.parent.splitterSettings.separatorSize,paneSettings:[{resizable:!0,size:i,min:this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum)},{resizable:!0}],orientation:"Horizontal",resizeStart:function(t){e.parent.contextMenuModule&&e.parent.contextMenuModule.isOpen&&e.parent.contextMenuModule.contextMenu.close();var i=t.pane[0],r=t.pane[1];e.splitterPreviousPositionGrid=i.scrollWidth+1+"px",e.splitterPreviousPositionChart=r.scrollWidth+1+"px";var n=new a.Deferred;return e.parent.trigger("splitterResizeStart",t,function(e){n.resolve(e)}),n},resizing:function(t){e.parent.trigger("splitterResizing",t)},resizeStop:function(i){var r=i.pane[0];e.splitterPreviousPositionGrid=r.scrollWidth+1+"px",e.splitterObject.paneSettings[0].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionGrid);var n=new a.Deferred;return e.parent.trigger("splitterResized",i,function(i){!0===i.cancel&&(e.splitterObject.paneSettings[0].size=null,e.splitterObject.paneSettings[0].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionGrid),e.splitterObject.paneSettings[1].size=null,e.splitterObject.paneSettings[1].size=e.getSpliterPositionInPercentage(e.splitterPreviousPositionChart)),t.isNullOrUndefined(e.parent.projectEndDate)&&e.parent.timelineModule.updateTimelineAfterZooming(e.parent.timelineModule.timelineEndDate,!0),n.resolve(i)}),n}}),this.parent.element.appendChild(this.parent.splitterElement),this.splitterObject.appendTo(this.parent.splitterElement)},e.prototype.calculateSplitterPosition=function(e){return!t.isNullOrUndefined(this.splitterObject)&&this.parent.enablePersistence?this.splitterObject.paneSettings[0].size:"Grid"===e.view?"100%":"Chart"===e.view?"0%":t.isNullOrUndefined(e.position)||""===e.position?!t.isNullOrUndefined(e.columnIndex)&&e.columnIndex>=0?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"):this.getSpliterPositionInPercentage("250px"):this.getSpliterPositionInPercentage(e.position)},e.prototype.getSpliterPositionInPercentage=function(e){var i=t.isNullOrUndefined(e)||""===e?null:e;if(!t.isNullOrUndefined(i))if(-1!==e.indexOf("px")){var r=parseInt(e,10);i=r/this.parent.ganttWidth*100<=100?r/this.parent.ganttWidth*100+"%":"25%"}else i=-1===e.indexOf("%")?e+"%":e;return i},e.prototype.getTotalColumnWidthByIndex=function(e){var t=0,i=this.parent.ganttColumns;e=i.length>e?e:i.length;for(var r=0;r<e;r++)t+=parseInt(i[r].width);return t},e.prototype.updateSplitterPosition=function(){this.splitterObject.separatorSize=this.parent.splitterSettings.separatorSize>=4?this.parent.splitterSettings.separatorSize:4;var e=this.calculateSplitterPosition(this.parent.splitterSettings);this.splitterObject.paneSettings[0].min=this.getSpliterPositionInPercentage(this.parent.splitterSettings.minimum),this.splitterObject.dataBind(),this.splitterObject.paneSettings[0].size=e},e.prototype.triggerCustomResizedEvent=function(){var e=this.splitterObject.element.querySelectorAll(".e-pane")[0],t=this.splitterObject.element.querySelectorAll(".e-pane")[1],i={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",i),!0===i.cancel&&(this.splitterObject.paneSettings[0].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionGrid),this.splitterObject.paneSettings[1].size=this.getSpliterPositionInPercentage(this.splitterPreviousPositionChart))},e.prototype.destroy=function(){this.splitterObject.destroy(),this.parent.off("destroy",this.destroy)},e}(),Qt=function(){function e(e){this.parent=e,this.createTooltip(),this.parent.on("destroy",this.destroy,this)}return e.prototype.createTooltip=function(){this.toolTipObj=new i.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, .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="e-gantt-tooltip",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)},e.prototype.tooltipBeforeRender=function(e){var i=this.parent;if(i.isOnEdit)e.cancel=!0;else{var r,n=t.closest(e.target,"div."+H);r=t.isNullOrUndefined(n)?f(e.target,Z):e.target;var s,o={data:{},args:e,cancel:!1,content:""};if(e.target.classList.contains("e-header-cell-label"))i.timelineSettings.showTooltip?o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("timeline",s,i,e):e.cancel=!0;else if(i.tooltipSettings.showTooltip)if(r&&(o.data=i.ganttChartModule.getRecordByTaskBar(r),s=o.data),e.target.classList.contains("e-gantt-child-taskbar")||e.target.classList.contains("e-gantt-parent-taskbar")||e.target.classList.contains("e-gantt-milestone")||e.target.classList.contains("e-gantt-unscheduled-taskbar")||e.target.classList.contains("e-taskbar-left-resizer")||e.target.classList.contains("e-taskbar-right-resizer")||e.target.classList.contains("e-gantt-manualparenttaskbar")&&i.tooltipSettings.taskbar){var l=void 0;i.tooltipSettings.taskbar&&(l=i.tooltipModule.templateCompiler(i.tooltipSettings.taskbar,i,s,"TooltipTaskbarTemplate"));var d=document.createElement("div");l&&t.append(l,d),o.content=this.toolTipObj.content=l?d:i.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"taskbar",s,i,e)}else if(e.target.classList.contains("e-baseline-bar")||e.target.classList.contains("e-baseline-gantt-milestone")){var h=void 0;i.tooltipSettings.baseline&&(h=i.tooltipModule.templateCompiler(i.tooltipSettings.baseline,i,s,"TooltipBaselineTemplate"));var p=document.createElement("div");h&&t.append(h,p),o.content=this.toolTipObj.content=h?p:i.tooltipModule.getTooltipContent(s.ganttProperties.isMilestone?"milestone":"baseline",s,i,e)}else if(e.target.classList.contains("e-event-markers"))o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("marker",s,i,e);else if(e.target.classList.contains("e-connector-line-container")){var c=void 0;i.tooltipModule.predecessorTooltipData=i.tooltipModule.getPredecessorTooltipData(e),o.data=this.predecessorTooltipData,i.tooltipSettings.connectorLine&&(c=i.tooltipModule.templateCompiler(i.tooltipSettings.connectorLine,i,i.tooltipModule.predecessorTooltipData,"TooltipConnectorLineTemplate")),o.content=this.toolTipObj.content=c?c[0]:i.tooltipModule.getTooltipContent("connectorLine",s,i,e)}else if(e.target.classList.contains("e-indicator-span"))o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("indicator",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0);else if(e.target.classList.contains("e-notes-info")){var u=this.parent.ganttChartModule.getRecordByTarget(e.event);o.content=this.toolTipObj.content=u.ganttProperties.notes,t.isNullOrUndefined(o.content)&&(e.cancel=!0)}else e.target.classList.contains("e-gantt-manualparenttaskbar")?(o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("manualtaskbar",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0)):e.target.classList.contains("e-gantt-manualparent-milestone")&&(o.content=this.toolTipObj.content=i.tooltipModule.getTooltipContent("manualmilestone",s,i,e),t.isNullOrUndefined(o.content)&&(e.cancel=!0));else e.cancel=!0;if(!1===e.cancel){var g=new a.Deferred;return i.trigger("beforeTooltipRender",o,function(t){g.resolve(t),t.cancel&&(e.cancel=!0)}),this.toolTipObj.content=o.content,this.parent.isAdaptive||"mouseover"!==e.event.type||(this.currentTarget=e.target,t.EventHandler.add(this.currentTarget,"mousemove",this.mouseMoveHandler.bind(this))),this.parent.renderTemplates(),g}}},e.prototype.tooltipCloseHandler=function(e){this.tooltipMouseEvent=null,this.parent.isAdaptive||t.EventHandler.remove(this.currentTarget,"mousemove",this.mouseMoveHandler),this.currentTarget=null},e.prototype.mouseMoveHandler=function(e){this.tooltipMouseEvent=e},e.prototype.updateTooltipPosition=function(e){if(e.element.style.visibility="visible",!t.isNullOrUndefined(this.tooltipMouseEvent)&&!e.target.classList.contains("e-notes-info")){var i=this.getPointorPosition(this.tooltipMouseEvent),r=this.parent.getOffsetRect(this.parent.chartPane),a=r.top+this.parent.chartPane.offsetHeight,n=r.left+this.parent.chartPane.offsetWidth,s=i.x,o=i.y;if(n<s+e.element.offsetWidth+10)for(;n<s+e.element.offsetWidth+10;)s=n-e.element.offsetWidth-10,e.element.style.left=s+"px";else s+=10,e.element.style.left=s+"px";window.innerHeight<e.element.offsetHeight+o&&(o=o-e.element.offsetHeight-10),a<o+e.element.offsetHeight+20?o=o-e.element.offsetHeight-10:o+=10,e.element.style.top=o+"px"}},e.prototype.getPointorPosition=function(e){var i,r;return t.isNullOrUndefined(t.getValue("pageX",e))&&t.isNullOrUndefined(t.getValue("pageY",e))?t.isNullOrUndefined(t.getValue("clientX",e))&&t.isNullOrUndefined(t.getValue("clientY",e))||(i=t.getValue("clientX",e)+document.body.scrollLeft+document.documentElement.scrollLeft,r=t.getValue("clientY",e)+document.body.scrollTop+document.documentElement.scrollTop):(i=t.getValue("pageX",e),r=t.getValue("pageY",e)),{x:i,y:r}},e.prototype.getTooltipContent=function(e,i,r,a){var n,s,o;if(i){var l=(s=i.ganttProperties).taskName;this.parent.enableHtmlSanitizer&&"string"==typeof l&&(l=t.SanitizeHtmlHelper.sanitize(l)),o=t.isNullOrUndefined(l)?"":'<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">'+(this.parent.disableHtmlEncode?l.replace(/</g,"<").replace(/>/g,">"):l)+"</td></tr>"}switch(e){case"milestone":var d=void 0;a.target.className.includes("e-baseline-gantt-milestone")&&!t.isNullOrUndefined(s.baselineStartDate)?d=s.baselineStartDate:t.isNullOrUndefined(s.startDate)||(d=s.startDate);var h=this.parent.getFormatedDate(d,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&"string"==typeof h&&(h=t.SanitizeHtmlHelper.sanitize(h));var p=t.isNullOrUndefined(d)?"":'<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+h+"</td></tr>";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+p+"</tbody></table>"});break;case"taskbar":var c=!(i.hasChildRecords&&!s.isAutoSchedule),u=this.parent.getFormatedDate(c?s.startDate:s.autoStartDate,this.parent.getDateFormat()),g=this.parent.getFormatedDate(c?s.endDate:s.autoEndDate,this.parent.getDateFormat()),f=this.parent.getDurationString(c?s.duration:s.autoDuration,s.durationUnit),m=s.progress;this.parent.enableHtmlSanitizer&&(u="string"==typeof u?t.SanitizeHtmlHelper.sanitize(u):u,g="string"==typeof g?t.SanitizeHtmlHelper.sanitize(g):g,f="string"==typeof f?t.SanitizeHtmlHelper.sanitize(f):f,m="string"==typeof m?t.SanitizeHtmlHelper.sanitize(m):m);var y=s.startDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(c?"startDate":"subTasksStartDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value"> '+u+"</td></tr>":"",D=s.endDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant(c?"endDate":"subTasksEndDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+g+"</td></tr>":"",v=t.isNullOrUndefined(s.duration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value"> '+f+"</td></tr>",w=t.isNullOrUndefined(s.progress)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+'</td><td style="padding: 2px;">:</td><td>'+m+"</td></tr>";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+y+D+v+w+"</tbody></table>"});break;case"baseline":var k=this.parent.getFormatedDate(s.baselineStartDate,this.parent.getDateFormat()),T=this.parent.getFormatedDate(s.baselineEndDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(k="string"==typeof k?t.SanitizeHtmlHelper.sanitize(k):k,T="string"==typeof T?t.SanitizeHtmlHelper.sanitize(T):T);n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+k+'</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("baselineEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+T+"</td></tr></tbody></table>"},this);break;case"marker":var b=r.tooltipModule.getMarkerTooltipData(a),P=this.parent.getFormatedDate(this.parent.dateValidationModule.getDateFromFormat(b.day),this.parent.getDateFormat()),S=b.label?b.label:"";this.parent.enableHtmlSanitizer&&(S="string"==typeof S?t.SanitizeHtmlHelper.sanitize(S):S,P="string"==typeof P?t.SanitizeHtmlHelper.sanitize(P):P);n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr><td>'+P+"</td></tr><tr><td>"+(this.parent.disableHtmlEncode?S.replace(/</g,"<").replace(/>/g,">"):S)+"</td></tr></tbody></table>"},this);break;case"connectorLine":var C=r.tooltipModule.predecessorTooltipData.fromName,M=r.tooltipModule.predecessorTooltipData.fromId,R=r.tooltipModule.predecessorTooltipData.toName,O=r.tooltipModule.predecessorTooltipData.toId,x=r.tooltipModule.predecessorTooltipData.linkText,I=r.tooltipModule.predecessorTooltipData.offsetString;this.parent.enableHtmlSanitizer&&(C="string"==typeof C?t.SanitizeHtmlHelper.sanitize(C):C,M="string"==typeof M?t.SanitizeHtmlHelper.sanitize(M):M,R="string"==typeof R?t.SanitizeHtmlHelper.sanitize(R):R,O="string"==typeof O?t.SanitizeHtmlHelper.sanitize(O):O,x="string"==typeof x?t.SanitizeHtmlHelper.sanitize(x):x,I="string"==typeof I?t.SanitizeHtmlHelper.sanitize(I):I);n=t.initializeCSPTemplate(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?C.replace(/</g,"<").replace(/>/g,">"):C)+" ("+(this.parent.disableHtmlEncode&&"string"==typeof M?M.replace(/</g,"<").replace(/>/g,">"):M)+')</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,"<").replace(/>/g,">"):R)+" ("+O+')</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("taskLink")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+x+'</td></tr><tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("lag")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+I+"</td></tr></tbody></table>"},this);break;case"indicator":if(a.target.title.length){var E=a.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof E&&(E=t.SanitizeHtmlHelper.sanitize(E));n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+E+"</tr></tbody></table>"})}break;case"timeline":var N=a.target.title;this.parent.enableHtmlSanitizer&&"string"==typeof N&&(N=t.SanitizeHtmlHelper.sanitize(N));n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody><tr>'+N+"</tr></tbody></table>"});break;case"manualtaskbar":var F=this.parent.getFormatedDate(s.autoStartDate,this.parent.getDateFormat()),U=this.parent.getFormatedDate(s.autoEndDate,this.parent.getDateFormat()),V=this.parent.getDurationString(s.duration,s.durationUnit),L=this.parent.getFormatedDate(s.startDate,this.parent.getDateFormat()),B=this.parent.getFormatedDate(s.endDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(F="string"==typeof F?t.SanitizeHtmlHelper.sanitize(F):F,U="string"==typeof U?t.SanitizeHtmlHelper.sanitize(U):U,V="string"==typeof V?t.SanitizeHtmlHelper.sanitize(V):V,L="string"==typeof L?t.SanitizeHtmlHelper.sanitize(L):L,B="string"==typeof B?t.SanitizeHtmlHelper.sanitize(B):B);var A=s.autoStartDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+F+"</td></tr>":"",H=s.autoEndDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+U+"</td></tr>":"",j=t.isNullOrUndefined(s.duration)?"":'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+V+"</td></tr>",W=s.startDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+L+"</td></tr>":"",q=s.endDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+B+"</td></tr>":"";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+W+A+q+H+j+"</tbody></table>"});break;case"manualmilestone":var G=this.parent.getFormatedDate(s.autoStartDate,this.parent.getDateFormat()),z=this.parent.getFormatedDate(s.autoEndDate,this.parent.getDateFormat()),_=this.parent.getFormatedDate(s.startDate,this.parent.getDateFormat());this.parent.enableHtmlSanitizer&&(G="string"==typeof G?t.SanitizeHtmlHelper.sanitize(G):G,z="string"==typeof z?t.SanitizeHtmlHelper.sanitize(z):z,_="string"==typeof _?t.SanitizeHtmlHelper.sanitize(_):_);var X=s.autoStartDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksStartDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value"> '+G+"</td></tr>":"",Y=s.autoEndDate?'<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("subTasksEndDate")+'</td><td>:</td><td class = "e-gantt-tooltip-value">'+z+"</td></tr>":"",Z='<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td><td class = "e-gantt-tooltip-value">'+_+"</tr>";n=t.initializeCSPTemplate(function(){return'<table class = "e-gantt-tooltiptable"><tbody>'+o+Z+X+Y+"</tbody></table>"})}return n},e.prototype.getMarkerTooltipData=function(e){var t=e.target.id.match(/\d+/g);return this.parent.eventMarkers[Number(t)]},e.prototype.getPredecessorTooltipData=function(e){var i=e.target.id;this.parent.enableHtmlSanitizer&&"string"==typeof i&&(i=t.SanitizeHtmlHelper.sanitize(i));var r=i.match(/ConnectorLineparent(.*)child(.*)/);r.shift();var a,n;"ResourceView"===this.parent.viewType?(a=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r[0])],n=this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r[1])]):(a=this.parent.flatData[this.parent.ids.indexOf(r[0])],n=this.parent.flatData[this.parent.ids.indexOf(r[1])]);var s=a.ganttProperties.predecessor.filter(function(e){return e.to===r[1]});return{fromId:"ResourceView"===this.parent.viewType?a.ganttProperties.taskId:a.ganttProperties.rowUniqueID,toId:"ResourceView"===this.parent.viewType?n.ganttProperties.taskId:n.ganttProperties.rowUniqueID,fromName:a.ganttProperties.taskName,toName:n.ganttProperties.taskName,linkType:s[0].type,linkText:this.parent.getPredecessorTextValue(s[0].type),offset:s[0].offset,offsetUnit:s[0].offsetUnit,offsetString:this.parent.getDurationString(s[0].offset,s[0].offsetUnit)}},e.prototype.templateCompiler=function(e,i,r,a){var n=i.chartRowsModule.templateCompiler(e),s=i.chartRowsModule.getTemplateID(a);return n(t.extend({index:0},r),i,a,s,!0)},e.prototype.destroy=function(){this.toolTipObj.destroy()},e}(),Kt=function(){function e(e){this.parent=e,this.activeElement=null,this.previousActiveElement=null}return e.prototype.getActiveElement=function(e){return e?this.previousActiveElement:this.activeElement},e.prototype.setActiveElement=function(e){this.previousActiveElement=this.activeElement,this.activeElement=e},e.prototype.onKeyPress=function(e){var i=this.parent,r=i.getExpandedRecords(i.currentViewData);if(t.isNullOrUndefined(this.parent.focusModule.getActiveElement())&&("expandAll"===e.action||"collapseAll"===e.action)){this.parent.element.querySelector(".e-treegrid").focus()}var a=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||t.isNullOrUndefined(i.editModule)||t.isNullOrUndefined(i.editModule.cellEditModule)||!0!==i.editModule.cellEditModule.isCellEdit)switch(i.isAdaptive&&("addRowDialog"!==e.action&&"editRowDialog"!==e.action&&"delete"!==e.action&&"addRow"!==e.action||i.selectionModule&&"Multiple"===i.selectionSettings.type&&(i.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),e.action){case"home":if(i.selectionModule&&"Cell"!==i.selectionSettings.mode){if(0===i.selectedRowIndex)return;i.selectionModule.selectRow(0,!1,!0)}break;case"end":if(i.selectionModule&&"Cell"!==i.selectionSettings.mode){var n=r[r.length-1];if(i.selectedRowIndex===i.flatData.indexOf(n))return;i.selectionModule.selectRow(i.flatData.indexOf(n),!1,!0)}break;case"downArrow":case"upArrow":(f=i.element.querySelector("#"+i.element.id+"_searchbar"))&&f.parentElement.classList.contains("e-input-focus")&&i.selectionModule.clearSelection(),i.element.classList.contains("e-scroll-disabled")||(this.upDownKeyNavigate(e),t.isNullOrUndefined(a)||t.isNullOrUndefined(a.closest(".e-chart-row"))||i.ganttChartModule.manageFocus(this.getActiveElement(),"remove",!0));break;case"expandAll":i.ganttChartModule.expandCollapseAll("expand");break;case"collapseAll":i.ganttChartModule.expandCollapseAll("collapse");break;case"expandRow":case"collapseRow":this.expandCollapseKey(e);break;case"saveRequest":if(!t.isNullOrUndefined(i.editModule)&&!t.isNullOrUndefined(i.editModule.cellEditModule)&&i.editModule.cellEditModule.isCellEdit){var s=i.editModule.cellEditModule.editedColumn;if(s.field===i.columnMapping.duration&&!t.isNullOrUndefined(s.edit)&&!t.isNullOrUndefined(s.edit.read)){var o=e.target.ej2_instances[0],l=e.target.value,d=i.currentViewData[i.selectedRowIndex].ganttProperties;s.field===i.columnMapping.duration&&l!==(t.isNullOrUndefined(s.edit)||t.isNullOrUndefined(s.edit.read)?t.isNullOrUndefined(s.valueAccessor)?i.dataOperation.getDurationString(d.duration,d.durationUnit):s.valueAccessor(i.columnMapping.duration,i.editedRecords,s):s.edit.read()).toString()&&(o.value=l,o.dataBind())}if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.cellEditModule.isCellEdit=!1,i.treeGrid.grid.saveCell();i.element.querySelector(".e-treegrid").focus()}if(!t.isNullOrUndefined(this.parent.onTaskbarClick)&&!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(a.closest(".e-chart-row"))){var h=e.target,p=a.querySelector(".e-gantt-parent-taskbar,.e-gantt-child-taskbar,.e-gantt-milestone");p&&this.parent.ganttChartModule.onTaskbarClick(e,h,p)}break;case"cancelRequest":t.isNullOrUndefined(i.editModule)||t.isNullOrUndefined(i.editModule.cellEditModule)||(i.editModule.cellEditModule.isCellEdit=!1,t.isNullOrUndefined(i.toolbarModule)||i.toolbarModule.refreshToolbarItems());break;case"addRow":if(i.editModule&&i.editModule.cellEditModule&&i.editModule.cellEditModule.isCellEdit)e.stopPropagation();else if(t.isNullOrUndefined(document.getElementById(this.parent.element.id+"_dialog"))){e.preventDefault(),i.addRecord(void 0,this.parent.editSettings.newRowPosition);i.element.focus()}break;case"addRowDialog":if(e.preventDefault(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowAdding){if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.dialogModule.openAddDialog()}break;case"editRowDialog":e.preventDefault();if(i.element.querySelector(".e-treegrid").focus(),i.editModule&&i.editModule.dialogModule&&i.editSettings.allowEditing){if(i.editModule.dialogModule.dialogObj&&t.getValue("dialogOpen",i.editModule.dialogModule.dialogObj))return;i.editModule.dialogModule.openToolbarEditDialog()}break;case"delete":i.selectionModule&&i.editModule&&i.editModule.dialogModule&&(!i.editModule.dialogModule.dialogObj||i.editModule.dialogModule.dialogObj&&!i.editModule.dialogModule.dialogObj.visible)&&(!i.editSettings.allowTaskbarEditing||i.editSettings.allowTaskbarEditing&&!i.editModule.taskbarEditModule.touchEdit)&&("Cell"!==i.selectionSettings.mode&&i.selectionModule.selectedRowIndexes.length||"Cell"===i.selectionSettings.mode&&i.selectionModule.getSelectedRowCellIndexes().length)&&(t.isNullOrUndefined(e.target)?i.editModule.startDeleteAction():"INPUT"!==e.target.tagName&&i.editModule.startDeleteAction());break;case"focusTask":e.preventDefault();var c=void 0;if(i.selectionModule){var u=i.currentViewData;if("Cell"===i.selectionSettings.mode||t.isNullOrUndefined(u[i.selectedRowIndex])){if("Cell"===i.selectionSettings.mode&&i.selectionModule.getSelectedRowCellIndexes().length>0){var g=i.selectionModule.getSelectedRowCellIndexes();c=u[g[g.length-1].rowIndex].ganttProperties.rowUniqueID}}else c=i.currentViewData[i.selectedRowIndex].ganttProperties.rowUniqueID}c&&i.scrollToTask(c.toString());break;case"focusSearch":if(i.element.querySelector("#"+i.element.id+"_searchbar")){var f;(f=i.element.querySelector("#"+i.element.id+"_searchbar")).setAttribute("tabIndex","-1"),f.focus()}break;case"tab":case"shiftTab":i.element.classList.contains("e-scroll-disabled")||i.ganttChartModule.onTabAction(e);break;case"contextMenu":var m=document.getElementById(this.parent.element.id+"_contextmenu").ej2_instances[0],y=this.parent.getOffsetRect(e.target),D=y.top+y.height/2,v=y.left+y.width/2;this.setActiveElement(e.target),m.open(D,v),e.preventDefault();break;default:var w={requestType:"keyPressed",action:e.action,keyEvent:e};i.trigger("actionComplete",w)}},e.prototype.upDownKeyNavigate=function(e){e.preventDefault();var t=this.parent,i=t.getExpandedRecords(t.currentViewData);if(t.selectionModule){if("Cell"!==t.selectionSettings.mode&&-1!==t.selectedRowIndex){var r=t.currentViewData[t.selectedRowIndex],a=(this.parent.ganttChartModule.focusedRowIndex,i.indexOf(r)),n="downArrow"===e.action?i[a+1]:i[a-1];t.selectionModule.selectRow(t.currentViewData.indexOf(n),!1,!0)}else if("Cell"===t.selectionSettings.mode&&t.selectionModule.getSelectedRowCellIndexes().length>0){var s=t.selectionModule.getSelectedRowCellIndexes(),o=s[s.length-1],l=o.cellIndexes[o.cellIndexes.length-1],d=(r=t.currentViewData[o.rowIndex],a=i.indexOf(r),n="downArrow"===e.action?i[a+1]:i[a-1],{rowIndex:t.currentViewData.indexOf(n),cellIndex:l});t.selectionModule.selectCell(d)}this.parent.ganttChartModule.focusedRowIndex=this.parent.selectedRowIndex}},e.prototype.expandCollapseKey=function(e){var t=this.parent;if(t.selectionModule&&-1!==t.selectedRowIndex){var i=void 0;if("Cell"!==t.selectionSettings.mode)i=t.selectedRowIndex;else if("Cell"===t.selectionSettings.mode&&t.selectionModule.getSelectedRowCellIndexes().length>0){var r=t.selectionModule.getSelectedRowCellIndexes();i=r[r.length-1].rowIndex}"expandRow"===e.action?t.expandByIndex(i):t.collapseByIndex(i)}},e}(),Jt=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),$t=function(e,t,i,r){var a,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var o=e.length-1;o>=0;o--)(a=e[o])&&(s=(n<3?a(s):n>3?a(t,i,s):a(t,i))||s);return n>3&&s&&Object.defineProperty(t,i,s),s},ei=function(e){function a(i,r){var a=e.call(this,i,r)||this;return a.showIndicator=!0,a.singleTier=0,a.isLocaleChanged=!1,a.isCancelled=!1,a.previousRecords={},a.editedRecords=[],a.modifiedRecords=[],a.isOnEdit=!1,a.isOnDelete=!1,a.isExpandCollapseLevelMethod=!1,a.isDynamicData=!1,a.isConnectorLineUpdate=!1,a.staticSelectedRowIndex=-1,a.needsID=!0,a.showActiveElement=!0,a.addDeleteRecord=!1,a.enableHeaderFocus=!0,a.enableValidation=!0,a.isTreeGridRendered=!1,a.isFromOnPropertyChange=!1,a.isFromRenderBaseline=!1,a.isGanttChartRendered=!1,a.isEdit=!1,t.setValue("mergePersistData",a.mergePersistGanttData,a),a}return Jt(a,e),a.prototype.getModuleName=function(){return"gantt"},a.prototype.preRender=function(){this.initProperties()},a.prototype.initProperties=function(){this.globalize=new t.Internationalization(this.locale),this.isAdaptive=t.Browser.isDevice,this.flatData=[],this.currentViewData=[],this.updatedRecords=[],this.ids=[],this.ganttColumns=[],this.localeObj=new t.L10n(this.getModuleName(),this.getDefaultLocale(),this.locale),this.dataOperation=new x(this),this.nonWorkingHours=[],this.nonWorkingTimeRanges=[],this.workingTimeRanges=[],this.defaultEndTime=null,this.defaultStartTime=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.editedTaskBarItem=null,this.validationDialogElement=null,this.currentEditedArgs={},this.dialogValidateMode={respectLink:!1,removeLink:!1,preserveLinkWithEditing:!0},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 je(this),this.timelineModule=new qe(this),this.chartRowsModule=new _t(this),this.treeGridModule=new ze(this),this.dateValidationModule=new R(this),this.predecessorModule=new Xt(this),this.connectorLineModule=new Yt(this),this.splitterModule=new Zt(this),this.tooltipModule=new Qt(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",cancelRequest:"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"},this.focusModule=new Kt(this),0===this.zoomingLevels.length&&(this.zoomingLevels=this.getZoomingLevels()),this.resourceFieldsMapping(),t.isNullOrUndefined(this.resourceFields.unit)&&(this.resourceFields.unit="unit"),t.isNullOrUndefined(this.taskFields.work)||(this.taskType="FixedWork"),this.taskIds=[]},a.prototype.getDateFormat=function(){if(t.isNullOrUndefined(this.dateFormat)){return this.globalize.getDatePattern({skeleton:"yMd"})}return this.dateFormat},a.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())},a.prototype.isInDst=function(e){return e.getTimezoneOffset()<this.getDefaultTZOffset()},a.prototype.resourceFieldsMapping=function(){var e=this.resourceFields;e.id=t.isNullOrUndefined(e.id)?this.resourceIDMapping:e.id,e.name=t.isNullOrUndefined(e.name)?this.resourceNameMapping:e.name},a.prototype.validateDimentionValue=function(e){return t.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()},a.prototype.calculateDimensions=function(){var e=this.validateDimentionValue(this.height),i=this.validateDimentionValue(this.width);t.isNullOrUndefined(this.width)||"string"!=typeof this.width||-1===this.width.indexOf("%")||(i=this.width);var r=this.element.style.height,a=this.element.style.width;i&&(this.element.style.width=i),e&&(this.element.style.height=e),e||r||(this.element.style.height="auto"),i||a||(this.element.style.width="auto"),this.ganttHeight=this.element.offsetHeight,this.ganttWidth=this.element.offsetWidth},a.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),i.createSpinner({target:this.element},this.createElement),this.trigger("load",{}),this.element.classList.add("e-gantt"),this.isAdaptive?this.element.classList.add("e-device"):this.element.classList.remove("e-device"),this.calculateDimensions(),t.isNullOrUndefined(this.toolbarModule)||this.renderToolbar(),this.splitterModule.renderSplitter(),this.notify("renderPanels",null),t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.showSpinner():this.showMaskRow(),this.dataOperation.checkDataBinding()},a.prototype.hideMaskRow=function(){var e=this.element.querySelectorAll(".e-masked-table").length;if(!t.isNullOrUndefined(this.contentMaskTable)&&(0!=e||this.contentMaskTable)){var i=this.contentMaskTable;t.remove(i),this.contentMaskTable=null}if(e=this.element.querySelectorAll(".e-masked-table").length,!t.isNullOrUndefined(this.headerMaskTable)&&(0!=e||this.headerMaskTable)){i=this.headerMaskTable;t.remove(i),this.headerMaskTable=null}for(;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("."+F).length)for(var r=0;r<this.singleTier;r++)t.isNullOrUndefined(this.element.querySelectorAll("."+F)[parseInt(r.toString(),10)])||(this.element.querySelectorAll("."+F)[parseInt(r.toString(),10)].style.visibility="visible");t.isNullOrUndefined(this.element.querySelector("."+N))||(this.element.querySelector("."+N).style.position="relative"),t.isNullOrUndefined(this.element.getElementsByClassName(E)[0])||(this.element.getElementsByClassName(E)[0].style.visibility="visible")},a.prototype.showMaskRow=function(){var e=this.chartPane.childNodes[0].childNodes[0];this.scrollLeftValue=this.chartPane.childNodes[0].childNodes[0].scrollLeft;var t=this.chartPane.childNodes[0].childNodes[1];if(this.treeGrid.element&&this.ganttChartModule.setVirtualHeight(),!this.contentMaskTable){if(t){var i=t;if(this.renderBackGround(i),0!=this.element.querySelectorAll("."+F).length){this.singleTier=this.timelineModule.isSingleTier?1:2;for(var r=0;r<this.singleTier;r++)this.element.querySelectorAll("."+F)[parseInt(r.toString(),10)].style.visibility="hidden"}0===this.singleTier&&(this.singleTier=2),this.element.getElementsByClassName(E)[0].style.visibility="hidden",this.contentMaskTable=this.contentMaskTable=this.createMaskTable(i)}if(e){this.element.querySelector("."+N).style.position="static";i=e;this.renderHeaderBackground(i),this.headerMaskTable=this.headerMaskTable=this.createMaskTable(i)}}},a.prototype.renderHeaderBackground=function(e){var i=e,r=e.getBoundingClientRect().height;if(!!t.closest(i,"."+N)){for(var a=this.createElement("div",{className:"e-table-background"}),n=(this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+r+"px;"}}),0),s=Math.round(e.getBoundingClientRect().width),o=0;o<3;o++)this.enableRtl?a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(s-=160)+"px; top:0px;"}})):a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n+=160)+"px; top:0px;"}}));i.insertBefore(a,i.firstChild)}},a.prototype.renderBackGround=function(e){var i=e,r=e.getBoundingClientRect().height;if(!!t.closest(i,"."+I)){for(var a=this.createElement("div",{className:"e-table-background"}),n=(this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+r+"px;"}}),0),s=Math.round(e.getBoundingClientRect().width),o=0;o<3;o++)this.enableRtl?a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(s-=160)+"px;z-index:1;"}})):a.appendChild(this.createElement("div",{className:"e-div-background",attrs:{style:"left: "+(n+=160)+"px;z-index:1;"}}));i.insertBefore(a,i.firstChild)}},a.prototype.createMaskTable=function(e){var i,r=e,a=e.getBoundingClientRect().height,n=!!t.closest(r,"."+N);if(n?((i=this.createEmptyTimeLineTable(a)).style.position="sticky",i.style.left="0px",this.enableRtl&&i.style.removeProperty("left")):((i=this.createEmptyMaskTable(a)).style.position="absolute",i.style.zIndex=1),n){i.style.height=e.getBoundingClientRect().height+"px";var s=this.createElement("div",{className:"e-temp-timeline"});s.style.width="614px",s.style.position="sticky",this.enableRtl?s.style["margin-right"]=Math.abs(this.scrollLeftValue)+"px":s.style["margin-left"]=this.scrollLeftValue+"px",s.appendChild(i),r.insertBefore(s,r.firstChild)}else i.style.height=e.getBoundingClientRect().height+"px",r.insertBefore(i,r.firstChild);return i},a.prototype.createEmptyTimeLineTable=function(e){for(var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),r=[],a=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/2+"px;"}}),n=0;n<this.singleTier;n++)r.push(a.cloneNode(!0));this.topBottomHeader=0;for(n=0;n<r.length;n++)i.appendChild(this.applyTimelineMaskRow(r[parseInt(n.toString(),10)])),this.topBottomHeader=this.topBottomHeader+1;return t.appendChild(i),t.style.width="100%",t},a.prototype.applyTimelineMaskRow=function(e){var t=e;t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),t.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(var i=0;i<t.childNodes.length-1;i++)t.childNodes[parseInt(i.toString(),10)].style.width="166px";var r=[].slice.call(t.childNodes);for(i=0;i<r.length;i++){var a=r[parseInt(i.toString(),10)];switch(this.topBottomHeader){case 0:this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>',a.children[0].style.left="-20px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-timelineHeader"></span>';break;case 1:a.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),a.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"})),a.appendChild(this.createElement("td",{className:"e-timeline-masked-top-header-cell"}));for(var n=[].slice.call(a.childNodes),s=0;s<n.length;s++){var o=n[parseInt(s.toString(),10)];0===s?this.enableRtl?(o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>',o.children[0].style.left="-14px"):o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML"></span>':1===s?this.enableRtl?(o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>',o.children[0].style.left="-30px"):o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML1"></span>':this.enableRtl?(o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>',o.children[0].style.left="-60px"):o.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-innerHTML2"></span>'}}}return t},a.prototype.createEmptyMaskTable=function(e){var t=this.createElement("table",{className:"e-table e-masked-table"}),i=this.createElement("tbody",{className:"e-masked-tbody"}),r=[],a=this.createElement("tr",{className:"e-masked-row e-row",attrs:{style:"height: "+e/7+"px;"}});this.columnLoop=0;for(var n=0;n<6;n++)r.push(a.cloneNode(!0));for(var s=0;s<r.length;s++)this.columnLoop<4?this.columnLoop=this.columnLoop+1:4===this.columnLoop&&(this.columnLoop=1),i.appendChild(this.applyMaskRow(r[parseInt(s.toString(),10)]));t.appendChild(i),t.style.width="100%";var o=this.createElement("div",{className:"e-temp-container"});return o.style.width="calc(100% - 17px)",o.style.overflow="hidden",o.appendChild(t),o},a.prototype.applyMaskRow=function(e){var t=e;this.columnLoop<4?(t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"})),t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}))):t.appendChild(this.createElement("td",{className:"e-masked-cell e-rowcell"}));for(var i=[].slice.call(t.childNodes),r=0;r<i.length;r++){var a=i[parseInt(r.toString(),10)];switch(this.columnLoop){case 1:0===r?this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>',a.children[0].style.left="-14px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell01"></span>':a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell02"></span>';break;case 2:0===r?this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>',a.children[0].style.left="-14px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell03"></span>':a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell04"></span>';break;case 3:0===r?this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>',a.children[0].style.left="-64px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell05"></span>':this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>',a.children[0].style.left="-192px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell06"></span>';break;case 4:this.enableRtl?(a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>',a.children[0].style.left="-388px"):a.innerHTML='<span class="e-mask e-skeleton e-skeleton-text e-shimmer-wave e-maskcell07"></span>'}}return t},a.prototype.showSpinner=function(){i.showSpinner(this.element)},a.prototype.hideSpinner=function(){i.hideSpinner(this.element)},a.prototype.processTimeline=function(){this.timelineModule.processTimelineUnit(),this.timelineModule.calculateZoomingLevelsPerDayWidth()},a.prototype.renderGantt=function(e){if(e&&(this.isFromOnPropertyChange=e),this.predecessorModule&&this.taskFields.dependency&&(this.predecessorModule.parentIds=[],this.predecessorModule.parentRecord=[],this.predecessorModule.updatePredecessors(),this.isInPredecessorValidation&&this.enableValidation&&this.autoCalculateDateScheduling&&this.predecessorModule.updatedRecordsDateByPredecessor()),this.enableValidation&&(this.dataOperation.calculateProjectDates(),this.timelineModule.validateTimelineProp()),e)if(this.enableValidation&&this.dataOperation.updateGanttData(),this.allowParentDependency&&this.predecessorModule.updateParentPredecessor(),this.dataSource instanceof Object&&y(this)){var i=t.getValue("count",this.dataSource);this.treeGrid.dataSource={result:this.flatData,count:i}}else this.treeGrid.setProperties({dataSource:this.flatData},!1);else this.enableValidation&&this.dataOperation.updateGanttData(),this.allowParentDependency&&this.predecessorModule.updateParentPredecessor(),this.treeGridPane.classList.remove("e-temp-content"),t.remove(this.treeGridPane.querySelector(".e-gantt-temp-header")),this.notify("dataReady",{}),this.enableContextMenu&&this.notify("initiate-contextMenu",{}),this.renderTreeGrid(),this.wireEvents(),this.notify("initPredessorDialog",{});this.splitterModule.updateSplitterPosition()},a.prototype.removeCriticalPathStyles=function(){var e=this.ganttChartModule.chartElement;t.removeClass(e.querySelectorAll(".e-gantt-child-taskbar-inner-div"),G),t.removeClass(e.querySelectorAll(".e-gantt-child-progressbar-inner-div"),z),t.removeClass(e.querySelectorAll(".e-critical-milestone"),_),t.removeClass(this.element.querySelectorAll(".e-connector-line"),be),t.removeClass(this.element.querySelectorAll(".e-connector-line-arrow"),Pe)},a.prototype.wireEvents=function(){this.allowKeyboard&&(this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfig,eventName:"keydown"})),t.EventHandler.add(window,"resize",this.windowResize,this),t.EventHandler.add(document.body,"keydown",this.keyDownHandler,this)},a.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))},a.prototype.windowResize=function(){if(!t.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));var e=this.criticalPathModule;this.enableCriticalPath&&e&&e.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(e.criticalPathCollection,e.detailPredecessorCollection,!0,e.predecessorCollectionTaskIds)}},a.prototype.keyActionHandler=function(e){this.focusModule.onKeyPress(e)},a.prototype.updateRowHeightInConnectorLine=function(e){if(e&&e.length){var t=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}},a.prototype.renderToolbar=function(){t.isNullOrUndefined(this.toolbarModule)||(this.toolbarModule.renderToolbar(),this.toolbarModule.refreshToolbarItems())},a.prototype.renderTreeGrid=function(){this.treeGridModule.renderTreeGrid()},a.prototype.updateCurrentViewData=function(){this.currentViewData=this.treeGrid.getCurrentViewRecords().slice()},a.prototype.getRecordFromFlatdata=function(e){for(var t=[],i=0;i<e.length;i++)t.push(this.getTaskByUniqueID(e[i].uniqueID));return t},a.prototype.updateContentHeight=function(e){if(this.allowTaskbarOverlap||"ResourceView"!==this.viewType||this.isLoad)if(this.virtualScrollModule&&this.enableVirtualization&&!t.isNullOrUndefined(e)){var i=t.getValue("result.length",e);this.contentHeight=i*this.rowHeight}else{var r=this.virtualScrollModule&&this.enableVirtualization?this.currentViewData:this.getExpandedRecords(this.currentViewData),a=void 0,n=t.isNullOrUndefined(this.ganttChartModule.getChartRows())?null:this.ganttChartModule.getChartRows()[0];a=!t.isNullOrUndefined(n)&&n.getBoundingClientRect().height>0?n.getBoundingClientRect().height:this.rowHeight,this.contentHeight=r.length*a}},a.prototype.getExpandStatus=function(e){var i=this.getParentTask(e.parentItem);if(t.isNullOrUndefined(i))return!0;if(!1===i.expanded)return!1;if(i.parentItem){return!1!==this.getParentTask(i.parentItem).expanded&&this.getExpandStatus(this.getParentTask(i.parentItem))}return!0},a.prototype.getExpandedRecords=function(e){var i=this;if(t.isNullOrUndefined(e))return[];return e.filter(function(e){return!0===i.getExpandStatus(e)})},a.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}]},a.prototype.displayQuarterValue=function(e){var t=e.getMonth();return t>=0&&t<=2?"Q1":t>=3&&t<=5?"Q2":t>=6&&t<=8?"Q3":"Q4"},a.prototype.displayHalfValue=function(e){var t=e.getMonth();return t>=0&&t<=5?"H1":"H2"},a.prototype.getFormatedDate=function(e,i){return t.isNullOrUndefined(e)?null:(t.isNullOrUndefined(i)&&(i=this.getDateFormat()),this.globalize.formatDate(e,{format:i}))},a.prototype.getDurationString=function(e,t){return this.dateValidationModule.getDurationString(e,t)},a.prototype.getWorkString=function(e,t){return this.dateValidationModule.getWorkString(e,t)},a.prototype.updateTreeColumns=function(){var e,i=this.treeGrid.grid.getColumns();-1!==this.treeColumnIndex&&this.columns[this.treeColumnIndex]&&!t.isNullOrUndefined(this.columns[this.treeColumnIndex].template)&&(e=this.columns[this.treeColumnIndex].template,this.columns[this.treeColumnIndex].field);for(var r,a=0;a<i.length;a++){r={};for(var n=0;n<this.columns.length;n++)if(this.columns[n].field==i[a].field){for(var s=0,o=Object.keys(this.columns[n]);s<o.length;s++){var l=o[s];t.isUndefined(this.columns[n][l])||(r[l]=i[a][l]),r.visible=i[a].visible,r.width=i[a].width}this.columns[n]=r,"checkbox"===this.columns[n].type||t.isNullOrUndefined(e)||""===e||(this.columns[n].template=e)}}this.columns.length>0&&this.treeGrid.setProperties({columns:this.columns},!0)},a.prototype.treeDataBound=function(e){this.element.getElementsByClassName("e-chart-root-container")[0].style.height="100%";this.element.getElementsByClassName("e-gridcontent")[0].style.height;var i=this.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight;if("calc(100% - "+i+"px)",this.element.getElementsByClassName("e-chart-scroll-container e-content")[0].style.height="calc(100% - "+i+"px)",t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)?this.splitterElement.style.height="100%":this.splitterElement.style.height="calc(100% - "+this.toolbarModule.element.offsetHeight+"px)",this.isLoad){if(this.enablePersistence&&this.updateTreeColumns(),this.updateCurrentViewData(),this.enableVirtualization||this.updateContentHeight(),!this.isTreeGridRendered){this.isTreeGridRendered=!0;t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)||this.toolbarModule.element.offsetHeight,this.timelineModule.isSingleTier?(t.addClass(this.treeGrid.element.querySelectorAll(".e-headercell"),U),t.addClass(this.treeGrid.element.querySelectorAll(".e-columnheader"),U)):(t.removeClass(this.treeGrid.element.querySelectorAll(".e-headercell"),U),t.removeClass(this.treeGrid.element.querySelectorAll(".e-columnheader"),U)),this.treeGrid.height="100%",this.notify("tree-grid-created",{}),this.createGanttPopUpElement(),t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.hideSpinner():this.hideMaskRow(),t.setValue("isGanttCreated",!0,e),this.renderComplete()}}else this.getCurrentRecords(e);this.enableCriticalPath&&this.criticalPathModule&&this.criticalPathModule.showCriticalPath(this.enableCriticalPath),this.notify("recordsUpdated",{});for(var r=0;r<document.getElementsByClassName("e-timeline-header-table-container").length;r++)for(var a=0;a<document.getElementsByClassName("e-timeline-header-table-container")[r].children[0].children[0].children.length;a++)document.getElementsByClassName("e-timeline-header-table-container")[r].children[0].children[0].children[a].children[0].setAttribute("tabindex","-1");var n=this.criticalPathModule;this.enableCriticalPath&&n&&n.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(n.criticalPathCollection,n.detailPredecessorCollection,!0,n.predecessorCollectionTaskIds),this.initialChartRowElements=this.ganttChartModule.getChartRows(),this.isLoad=!1,this.trigger("dataBound",e)},a.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())},a.prototype.onPropertyChanged=function(e,i){for(var a=!1,n=0,s=Object.keys(e);n<s.length;n++){var o=s[n];switch(o){case"allowSelection":case"allowRowDragAndDrop":case"allowFiltering":case"showColumnMenu":case"allowResizing":case"allowReordering":case"enableImmutableMode":this.treeGrid[o]=this[o],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=r.getActualProperties(this.columnMenuItems);break;case"eventMarkers":case"highlightWeekends":this.notify("ui-update",{module:"day-markers",properties:e});break;case"sortSettings":this.treeGrid.sortSettings=r.getActualProperties(this.sortSettings),this.treeGrid.dataBind();break;case"timelineSettings":this.timelineModule.refreshTimeline();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":this.dataOperation.checkDataBinding(!0);break;case"enableCriticalPath":if(t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.hideSpinner():this.hideMaskRow(),this.enableCriticalPath&&this.criticalPathModule){this.criticalPathModule.showCriticalPath(this.enableCriticalPath);var l=this.criticalPathModule;l.criticalPathCollection&&this.criticalPathModule.criticalConnectorLine(l.criticalPathCollection,l.detailPredecessorCollection,!0,l.predecessorCollectionTaskIds)}else this.removeCriticalPathStyles();break;case"filterSettings":this.treeGrid.filterSettings=r.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=r.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=r.getActualProperties(this.searchSettings),this.treeGrid.grid.dataBind()),this.treeGrid.searchSettings=r.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"===o&&(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;break;case"dayWorkingTime":this.isLoad=!0,this.dataOperation.reUpdateGanttData(),this.treeGrid.refreshColumns(),this.chartRowsModule.initiateTemplates(),this.chartRowsModule.refreshGanttRows(),this.isLoad=!1;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.chartRowsModule.initiateTemplates(),this.timelineModule.updateChartByNewTimeline();break;case"width":case"height":this.reUpdateDimention();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,t.isNullOrUndefined(this.editModule)||this.editModule.reUpdateEditModules(),t.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.dataOperation.calculateProjectDates(),this.updateProjectDates(this.cloneProjectStartDate,this.cloneProjectEndDate,this.isTimelineRoundOff);break;case"selectedRowIndex":t.isNullOrUndefined(this.selectionModule)||this.selectionModule.selectRowByIndex();break;case"dataSource":if(this.closeGanttActions(),this.dataSource instanceof Object&&y(this)){this.treeGrid.hasChildMapping="isParent";var d=t.getValue("count",this.dataSource);this.treeGrid.dataSource={result:this.flatData,count:d}}else this.treeGrid.hasChildMapping=null;this.dataOperation.checkDataBinding(!0);break;case"enableContextMenu":case"contextMenuItems":this.enableContextMenu||"contextMenuItems"===o?this.notify("reRender-contextMenu",{module:"contextMenu",enable:this.contextMenuItems}):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":"locale"===o&&(this.isLocaleChanged=!0),a=!0;break;case"validateManualTasksOnLinking":this.validateManualTasksOnLinking=e.validateManualTasksOnLinking;break;case"showOverAllocation":this.updateOverAllocationCotainer()}}a&&(this.isLoad&&this.contentMaskTable&&(this.contentMaskTable=null),this.refresh())},a.prototype.updateOverAllocationCotainer=function(){if(this.showOverAllocation&&"ResourceView"===this.viewType)this.ganttChartModule.renderOverAllocationContainer();else{var e=this.element.querySelector("."+Be);e&&(e.innerHTML="")}},a.prototype.getPersistData=function(){for(var e=["sortSettings","filterSettings","columns","searchSettings","selectedRowIndex","treeColumnIndex","currentZoomingLevel","cloneProjectStartDate","cloneProjectEndDate"],i={filterSettings:["type","mode","showFilterBarStatus","immediateModeDelay","ignoreAccent","hierarchyMode"],searchSettings:["fields","operator","ignoreCase"],sortSettings:[],columns:[],selectedRowIndex:[]},r=0;r<e.length;r++)for(var a=this[e[r]],n=0,s=i[e[r]];!t.isNullOrUndefined(s)&&n<s.length;n++){delete a[s[n]]}return this.ignoreInArrays(["filter","edit","filterBarTemplate","headerTemplate","template","commandTemplate","commands","dataSource"],this.columns),this.addOnPersist(e)},a.prototype.ignoreInArrays=function(e,t){for(var i=0;i<t.length;i++)this.ignoreInColumn(e,t[i])},a.prototype.ignoreInColumn=function(e,t){for(var i=0;i<e.length;i++)delete t[e[i]],t.filter={}},a.prototype.destroy=function(){this.notify("destroy",{}),t.isNullOrUndefined(this.validationDialogElement)||this.validationDialogElement.isDestroyed||this.validationDialogElement.destroy();for(var i=["ganttChartModule","timelineModule","chartRowsModule","treeGridModule","ganttDataUpdatesModule","dateValidationModule","tooltipModule"],r=0;r<i.length;r++)this[i[r]]&&(this[i[r]]=null);this.keyboardModule&&this.keyboardModule.destroy(),this.editModule&&this.editModule.dialogModule&&this.editModule.dialogModule.destroy(),e.prototype.destroy.call(this),this.chartVerticalLineContainer=null,this.element.innerHTML="",t.removeClass([this.element],"e-gantt"),this.element.innerHTML="",this.isTreeGridRendered=!1,this.resetTemplates(),t.EventHandler.remove(window,"resize",this.windowResize)},a.prototype.getTaskbarHeight=function(){return this.chartRowsModule.taskBarHeight},a.prototype.requiredModules=function(){var e=[];return this.isDestroyed?e:(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.allowResizing&&e.push({member:"resize",args:[this]}),this.toolbar&&this.toolbar.length>0&&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&&this.holidays.length>0||this.eventMarkers&&this.eventMarkers.length>0)&&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)},a.prototype.sortColumn=function(e,t,i){this.sortModule&&this.allowSorting&&this.sortModule.sortColumn(e,t,i)},a.prototype.mergePersistGanttData=function(){this.treeGrid||(this.treeGrid=new n.TreeGrid);this.treeGrid.grid.mergePersistGridData.apply(this)},a.prototype.mergeColumns=function(e,t){this.treeGrid.grid.mergeColumns.apply(this,[e,t])},a.prototype.clearSorting=function(){this.sortModule.clearSorting()},a.prototype.renderChartGridLines=function(){var e="e-chart-row-border",i=this.chartVerticalLineContainer,r=document.getElementById(this.element.id+"GanttTaskTableBody").querySelectorAll("td");if("Vertical"===this.gridLines){if(t.isNullOrUndefined(i)?this.renderChartVerticalLines():"none"===i.style.display&&(i.style.display="block"),r[0].classList.contains(e))for(var a=0;a<r.length;a++)t.removeClass([r[a]],e)}else if("Horizontal"===this.gridLines){if(t.isNullOrUndefined(i)||(i.style.display="none"),!r[0].classList.contains(e))for(a=0;a<r.length;a++)t.addClass([r[a]],e)}else if("Both"===this.gridLines){if(t.isNullOrUndefined(i)?this.renderChartVerticalLines():"none"===i.style.display&&(i.style.display="block"),!r[0].classList.contains(e))for(a=0;a<r.length;a++)t.addClass([r[a]],e)}else if("None"===this.gridLines&&(t.isNullOrUndefined(i)||"none"===i.style.display||(i.style.display="none"),r[0].classList.contains(e)))for(a=0;a<r.length;a++)t.removeClass([r[a]],e)},a.prototype.updateGridLineContainerHeight=function(){this.chartVerticalLineContainer&&(this.chartVerticalLineContainer.style.height=t.formatUnit(this.getContentHeight()))},a.prototype.getContentHeight=function(){var e=this.ganttChartModule.scrollElement.offsetHeight-16,t=this.ganttChartModule.chartBodyContent.offsetHeight;return t<e?t:e},a.prototype.reUpdateDimention=function(){var e=0;if(this.calculateDimensions(),t.isNullOrUndefined(this.toolbarModule)||t.isNullOrUndefined(this.toolbarModule.element)||(this.toolbarModule.toolbar.refresh(),this.toolbarModule.refreshToolbarItems(),e=this.toolbarModule.element.offsetHeight),this.treeGrid.height=this.ganttHeight-e-this.treeGrid.grid.getHeaderContent().offsetHeight,this.splitterModule.splitterObject.height=(this.ganttHeight-e).toString(),t.isNullOrUndefined(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer.style.height=this.ganttHeight+"px"),!t.isNullOrUndefined(this.dayMarkersModule)){var i=t.getValue("nonworkingDayRender.holidayContainer",this.dayMarkersModule),r=t.getValue("nonworkingDayRender.weekendContainer",this.dayMarkersModule),a=t.getValue("eventMarkerRender.eventMarkersContainer",this.dayMarkersModule);i&&(i.style.height=this.ganttHeight+"px"),r&&(r.style.height=this.ganttHeight+"px"),a&&(a.style.height=this.ganttHeight+"px")}this.splitterModule.splitterObject.width=this.ganttWidth.toString(),this.ganttChartModule.scrollObject.setHeight(this.ganttHeight-this.ganttChartModule.chartTimelineContainer.offsetHeight-e)},a.prototype.renderChartVerticalLines=function(){this.element.contains(this.chartVerticalLineContainer)||(this.chartVerticalLineContainer=t.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="";var e=this.element.getElementsByClassName("e-timeline-header-table-container")[1];t.isNullOrUndefined(e)&&(e=this.element.getElementsByClassName("e-timeline-header-table-container")[0]);for(var i,r=e.getElementsByTagName("th"),a=r.length,n=0,s=t.createElement("div"),o=0;o<a;o++){n=0===o?-1:n+parseFloat(i),i=r[o].style.width;var l=t.createElement("div",{className:"e-line-container-cell",styles:(this.enableRtl?"right:"+(n+1):"left:"+n)+"px"});s.appendChild(l)}this.chartVerticalLineContainer.innerHTML=s.innerHTML},a.prototype.getDefaultLocale=function(){return{emptyRecord:"No records to display",id:"ID",name:"Name",startDate:"Start Date",endDate:"End Date",duration:"Duration",progress:"Progress",dependency:"Dependency",notes:"Notes",criticalPath:"Critical Path",baselineStartDate:"Baseline Start Date",baselineEndDate:"Baseline End Date",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",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"}},a.prototype.removeSortColumn=function(e){this.sortModule.removeSortColumn(e)},a.prototype.actionBeginTask=function(e){this.trigger("actionBegin",e),t.isNullOrUndefined(this.loadingIndicator)||"Shimmer"!==this.loadingIndicator.indicatorType?this.showSpinner():this.showMaskRow()},a.prototype.scrollToDate=function(e){var t=this.dateValidationModule.getDateFromFormat(e),i=this.dataOperation.getTaskLeft(t,!1);this.ganttChartModule.updateScrollLeft(i)},a.prototype.scrollToTask=function(e){if(-1!==this.ids.indexOf(e)){var t=this.flatData[this.ids.indexOf(e)].ganttProperties.left;this.ganttChartModule.updateScrollLeft(t)}},a.prototype.updateChartScrollOffset=function(e,i){t.isNullOrUndefined(e)||(e=this.ganttChartModule.scrollElement.scrollWidth<=e?this.ganttChartModule.scrollElement.scrollWidth:e,this.ganttChartModule.scrollObject.setScrollLeft(e,this.enableRtl?-1:0)),t.isNullOrUndefined(i)||(i=this.ganttChartModule.scrollElement.scrollHeight<=i?this.ganttChartModule.scrollElement.scrollHeight:i,this.ganttChartModule.scrollObject.setScrollTop(i))},a.prototype.getParentTask=function(e){if(t.isNullOrUndefined(e))return null;var i=this.flatData.filter(function(t){return e.uniqueID===t.uniqueID});return i.length>0?i[0]:null},a.prototype.getRootParent=function(e,t){return e.level===t?e:this.getRootParent(this.getParentTask(e.parentItem),t)},a.prototype.filterByColumn=function(e,t,i,r,a,n){this.treeGrid.filterByColumn(e,t,i,r,a,n)},a.prototype.excelExport=function(e,t,i,r){return this.excelExportModule?this.treeGrid.excelExport(e,t,i,r):null},a.prototype.csvExport=function(e,t,i,r){return this.excelExportModule?this.treeGrid.csvExport(e,t,i,r):null},a.prototype.pdfExport=function(e,t,i,r){return this.pdfExportModule?this.pdfExportModule.export(e,t,i,r):null},a.prototype.clearFiltering=function(e){this.treeGrid.grid.clearFiltering(e)},a.prototype.removeFilteredColsByField=function(e){this.treeGrid.removeFilteredColsByField(e,!1)},a.prototype.renderWorkingDayCell=function(e){var t="Auto"!==this.taskMode||!(!this.includeWeekend&&this.autoCalculateDateScheduling)?[]:this.nonWorkingDayIndex,i=this.totalHolidayDates;if(t.length>0&&-1!==t.indexOf(e.date.getDay()))e.isDisabled=!0;else if(i.length>0){var r=new Date(e.date.getTime());r.setHours(0,0,0),-1!==i.indexOf(r.getTime())&&(this.autoCalculateDateScheduling?e.isDisabled=!0:e.isDisabled=!1)}},a.prototype.previousTimeSpan=function(e){this.timelineModule.performTimeSpanAction("prevTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},a.prototype.nextTimeSpan=function(e){this.timelineModule.performTimeSpanAction("nextTimeSpan","publicMethod",new Date(this.timelineModule.timelineStartDate.getTime()),new Date(this.timelineModule.timelineEndDate.getTime()),e)},a.prototype.updateProjectDates=function(e,i,r,a){this.timelineModule.totalTimelineWidth=0,this.cloneProjectStartDate=e,this.cloneProjectEndDate=i,this.isTimelineRoundOff=r,this.timelineModule.refreshTimelineByTimeSpan(),this.dataOperation.reUpdateGanttDataPosition(),this.timelineModule.updateChartByNewTimeline(),this.ganttChartModule.chartBodyContent.style.width=t.formatUnit(this.timelineModule.totalTimelineWidth),this.ganttChartModule.updateLastRowBottomWidth(),this.taskFields.dependency&&this.ganttChartModule.reRenderConnectorLines(),"beforeAdd"!==a&&this.notify("selectRowByIndex",{})},a.prototype.splitTask=function(e,t){this.isEdit=!0,this.chartRowsModule.splitTask(e,t)},a.prototype.mergeTask=function(e,t){this.chartRowsModule.mergeTask(e,t)},a.prototype.reorderColumns=function(e,t){this.treeGrid.reorderColumns(e,t)},a.prototype.initiateEditAction=function(e){this.isOnEdit=e,this.previousRecords={},this.editedRecords=[]},a.prototype.setRecordValue=function(e,i,r,a){if(i=t.isUndefined(i)?null:i,this.isOnEdit||this.isOnDelete){this.makeCloneData(e,r,a);var n=a?r:r.ganttProperties,s=n.rowUniqueID,o=this.getRecordByID(s),l=!1;(t.isNullOrUndefined(i)||!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(r[""+e])&&(i instanceof Date?i.getTime()!==r[""+e].getTime():r[""+e]!==i))&&(l=!0),o&&(-1===this.editedRecords.indexOf(o)&&l||0===this.editedRecords.length)&&(this.editModule.draggedRecord&&this.editModule.draggedRecord.ganttProperties.taskId===n.taskId?this.editedRecords.splice(0,0,o):this.editedRecords.push(o),this.enableImmutableMode&&this.modifiedRecords.push(o))}t.setValue(e,i,r)},a.prototype.makeCloneData=function(e,i,r){var a,n,s,o=t.getValue(e,i);if(r&&(e="ganttProperties."+e),t.isNullOrUndefined(this.previousRecords[i.uniqueID])){this.previousRecords[i.uniqueID]={}}a=this.previousRecords[i.uniqueID],n=t.getValue(e,a),t.isUndefined(n)&&(s=o instanceof Date?new Date(o.getTime()):t.isObjectArray(o)?t.extend([],o,[],!0):t.isObject(o)?t.extend({},{},o,!0):o,t.isUndefined(s)?t.setValue(e,null,a):t.setValue(e,s,a))},a.prototype.closeGanttActions=function(){this.editModule&&(this.editModule.cellEditModule&&this.editModule.cellEditModule.isCellEdit?(this.treeGrid.closeEdit(),this.editModule.cellEditModule.isCellEdit=!1,t.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()))},a.prototype.getTaskByUniqueID=function(e){var t=this.flatData.filter(function(t){return t.uniqueID===e});return t.length>0?t[0]:null},a.prototype.getRecordByID=function(e){return t.isNullOrUndefined(e)?null:this.flatData[this.ids.indexOf(e.toString())]},a.prototype.setSplitterPosition=function(e,t){var i={};i[t]=e;var r=this.splitterModule.calculateSplitterPosition(i),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=r,this.splitterModule.triggerCustomResizedEvent()},a.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=0;i<e.length;i++)if("number"==typeof e[i]){var r=e[i];t=this.contructExpandCollapseArgs(null,r);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)}},a.prototype.expandByID=function(e){var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.expandGanttRow(t)},a.prototype.collapseByIndex=function(e){var t=this.contructExpandCollapseArgs(null,e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},a.prototype.collapseByID=function(e){var t=this.contructExpandCollapseArgs(e);this.ganttChartModule.isExpandCollapseFromChart=!0,this.ganttChartModule.collapseGanttRow(t)},a.prototype.addRecord=function(e,i,r){if(this.editModule&&this.editSettings.allowAdding)if("ResourceView"===this.viewType){this.editModule.addRowPosition=i,this.editModule.addRowIndex=r;var a=void 0;t.isNullOrUndefined(e)||(a=e[this.taskFields.resourceInfo]);var n=void 0,s=void 0;if(!t.isNullOrUndefined(a)&&a.length){for(var o=0;o<a.length&&(n="object"==typeof a[o]?a[o][this.resourceFields.id]:a[0],!(s=this.flatData[this.getTaskIds().indexOf("R"+n)]));o++);if(s&&s.childRecords.length||0===s.level){var l=s.childRecords[r];if(l){var d="Above"===i||"Below"===i?i:"Child";"Child"===d?this.editModule.addRecord(e,d,this.getTaskIds().indexOf("R"+n)):this.editModule.addRecord(e,d,this.flatData.indexOf(l))}else this.editModule.addRecord(e,"Child",this.getTaskIds().indexOf("R"+n))}else this.editModule.addRecord(e,"Bottom")}else this.editModule.addRecord(e,"Bottom");this.editModule.addRowPosition=null,this.editModule.addRowIndex=null}else this.editModule.addRecord(e,i,r)},a.prototype.updateRecordByID=function(e){this.editModule&&this.editSettings.allowEditing&&this.editModule.updateRecordByID(e)},a.prototype.updateTaskId=function(e,t){this.editModule&&this.editSettings.allowEditing&&this.editModule.updateTaskId(e,t)},a.prototype.expandAtLevel=function(e){this.enableVirtualization&&(this.isExpandCollapseLevelMethod=!0),this.ganttChartModule.expandAtLevel(e)},a.prototype.indent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.indent()},a.prototype.outdent=function(){this.editModule&&this.editSettings.allowEditing&&this.editModule.outdent()},a.prototype.showCriticalPath=function(e){if(this.criticalPathModule){this.criticalPathModule.showCriticalPath(e);var t=this.criticalPathModule;this.criticalPathModule.criticalConnectorLine(t.criticalPathCollection,t.detailPredecessorCollection,!0,t.predecessorCollectionTaskIds)}},a.prototype.getCriticalTasks=function(){return!t.isNullOrUndefined(this.criticalPathModule)&&this.enableCriticalPath?this.criticalPathModule.getCriticalTasks():null},a.prototype.zoomIn=function(){this.timelineModule.processZooming(!0)},a.prototype.zoomOut=function(){this.timelineModule.processZooming(!1)},a.prototype.fitToProject=function(){this.timelineModule.processZoomToFit(),this.ganttChartModule.updateScrollLeft(0)},a.prototype.reorderRows=function(e,t,i){this.rowDragAndDropModule.reorderRows(e,t,i)},a.prototype.updateRecordByIndex=function(e,i){if(this.editModule&&this.editSettings.allowEditing){var r=this.taskFields,a=this.updatedRecords.length>0?t.isNullOrUndefined(this.updatedRecords[e])?null:this.updatedRecords[e]:null;t.isNullOrUndefined(a)||(i[r.id]=a[r.id],this.editModule.updateRecordByID(i))}},a.prototype.addPredecessor=function(e,i){var r=this.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(r)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.addPredecessor(r,i)},a.prototype.removePredecessor=function(e){var i=this.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(i)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.removePredecessor(i)},a.prototype.updatePredecessor=function(e,i){var r=this.getRecordByID(e.toString());this.editModule&&!t.isNullOrUndefined(r)&&this.editSettings.allowTaskbarEditing&&this.connectorLineEditModule.updatePredecessor(r,i)},a.prototype.openAddDialog=function(){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowAdding&&this.editModule.dialogModule.openAddDialog()},a.prototype.openEditDialog=function(e){this.editModule&&this.editModule.dialogModule&&this.editSettings.allowEditing&&this.editModule.dialogModule.openEditDialog(e)},a.prototype.contructExpandCollapseArgs=function(e,i){var r,a,n;t.isNullOrUndefined(i)?(a=this.getRecordByID(e.toString()),r=this.getRowByID(e),t.isNullOrUndefined(r)||(n=t.getValue("rowIndex",r))):t.isNullOrUndefined(i)||(r=this.getRowByIndex(i),n=t.getValue("rowIndex",r),a=this.currentViewData[n]);return{data:a,gridRow:this.treeGrid.getRows()[n],chartRow:r,cancel:!1}},a.prototype.getRowByIndex=function(e){try{var i=this.element.querySelectorAll(".e-chart-row");return t.isNullOrUndefined(e)?null:i[e]}catch(e){return null}},a.prototype.getRowByID=function(e){var t=this.getRecordByID(e.toString()),i=this.updatedRecords.indexOf(t);return-1!==i?this.getRowByIndex(i):null},a.prototype.getUnscheduledTaskClass=function(e){return t.isNullOrUndefined(e.startDate)&&t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.duration)?" "+ue:t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration)?" "+ue:""},a.prototype.isUnscheduledTask=function(e){return!!(t.isNullOrUndefined(e.startDate)||t.isNullOrUndefined(e.endDate)||t.isNullOrUndefined(e.duration))},a.prototype.createGanttPopUpElement=function(){var e=this.createElement("div",{className:"e-ganttpopup",styles:"display:none;"}),i=this.createElement("div",{className:"e-content",attrs:{tabIndex:"-1"}});t.append([i,this.createElement("div",{className:"e-uptail e-tail"})],e),i.appendChild(this.createElement("span")),t.append([i,this.createElement("div",{className:"e-downtail e-tail"})],e),document.getElementById(this.element.id+"GanttChart").appendChild(e)},a.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},a.prototype.search=function(e){this.filterModule&&(this.searchSettings.key=e,this.dataBind())},a.prototype.getOffsetRect=function(e){var t=e.getBoundingClientRect(),i=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop,r=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,a=document.documentElement.clientTop||document.body.clientTop||0,n=document.documentElement.clientLeft||document.body.clientLeft||0,s=t.top+i-a,o=this.enableRtl?t.right+r-n:t.left+r-n;return{top:Math.round(s),left:Math.round(o),width:t.width,height:t.height}},a.prototype.expandAll=function(){this.ganttChartModule.expandCollapseAll("expand")},a.prototype.updateDataSource=function(e,i){if(this.isDynamicData=!0,!t.isNullOrUndefined(i))for(var r=0,a=Object.keys(i);r<a.length;r++){var n=a[r];switch(n){case"projectStartDate":this.setProperties({projectStartDate:i[n]},!0);break;case"projectEndDate":this.setProperties({projectEndDate:i[n]},!0)}}this.dataSource=e},a.prototype.collapseAll=function(){this.ganttChartModule.expandCollapseAll("collapse")},a.prototype.getGridColumns=function(){return this.treeGrid.getColumns()},a.prototype.getColumnByField=function(e,t){var i=t.filter(function(t){return t.field===e});return i.length>0?i[0]:null},a.prototype.getGanttColumns=function(){return this.ganttColumns},a.prototype.showColumn=function(e,t){this.treeGrid.showColumns(e,t),this.updateTreeColumns()},a.prototype.hideColumn=function(e,t){this.treeGrid.hideColumns(e,t),this.updateTreeColumns()},a.prototype.setScrollTop=function(e){this.ganttChartModule.scrollObject.setScrollTop(e)},a.prototype.cancelEdit=function(){this.isCancelled=!0,this.closeGanttActions()},a.prototype.selectCell=function(e,t){this.selectionModule&&this.selectionModule.selectCell(e,t)},a.prototype.selectCells=function(e){this.selectionModule&&this.selectionModule.selectCells(e)},a.prototype.selectRow=function(e,t){this.selectionModule&&this.selectionModule.selectRow(e,t)},a.prototype.selectRows=function(e){this.selectionModule&&this.selectionModule.selectRows(e)},a.prototype.deleteRecord=function(e){this.editModule&&this.editModule.deleteRecord(e)},a.prototype.enableItems=function(e,t){this.toolbarModule&&this.toolbarModule.enableItems(e,t)},a.prototype.clearSelection=function(){this.selectionModule&&this.selectionModule.clearSelection()},a.prototype.updateDataArgs=function(e){if(!Array.isArray(e.data)){var i=[];i.push(e.data),t.setValue("data",i,e)}return e},a.prototype.convertToMilestone=function(e){var i=this.getRecordByID(e);if(!t.isNullOrUndefined(i)){var r=t.extend({},{},i.taskData,!0),a=this.taskFields;if(r[a.startDate]&&this.setRecordValue(a.startDate,i.ganttProperties.startDate,r,!0),t.isNullOrUndefined(a.duration)?(r[a.startDate]=new Date(i.ganttProperties.startDate),r[a.endDate]=new Date(i.ganttProperties.endDate)):r[a.duration]=0,t.isNullOrUndefined(a.milestone)||!1===r[a.milestone]&&(r[a.milestone]=!0),t.isNullOrUndefined(a.progress)||(r[a.progress]=0),!t.isNullOrUndefined(a.child)&&r[a.child]&&(r[a.child]=[]),!t.isNullOrUndefined(a.parentID)&&r[a.parentID]&&(r[a.parentID]=null),t.isNullOrUndefined(a.segments)||(r[a.segments]=null),!t.isNullOrUndefined(this.contextMenuModule)&&this.contextMenuModule.isOpen&&"Milestone"===this.contextMenuModule.item){t.isNullOrUndefined(a.dependency)||(r[a.dependency]=null);this.addRecord(r,"Below")}else i.hasChildRecords||i.ganttProperties.isMilestone||this.updateRecordByID(r)}},a.prototype.changeTaskMode=function(e){var i=this.taskFields,r=this.getRecordByID(e[i.id]),a=r.ganttProperties;this.isOnEdit=!0,this.setRecordValue("isAutoSchedule",!a.isAutoSchedule,a,!0),t.isNullOrUndefined(this.taskFields.manual)||(this.setRecordValue("taskData."+i.manual,!a.isAutoSchedule,r),this.setRecordValue(i.manual,!a.isAutoSchedule,r)),this.editModule.updateTaskScheduleModes(r);var n={data:r};this.editModule.initiateUpdateAction(n)},a.prototype.getTaskIds=function(){return this.taskIds},a.prototype.setTaskIds=function(e){if("ProjectView"!==this.viewType){var t=e.ganttProperties.taskId;t=0===e.level?"R"+t:"T"+t,this.taskIds.push(t)}},a.prototype.renderTemplates=function(){this.isReact&&this.renderReactTemplates()},a.prototype.resetTemplates=function(){this.isReact&&this.clearTemplate()},$t([t.Property(!0)],a.prototype,"allowKeyboard",void 0),$t([t.Property(!1)],a.prototype,"enableImmutableMode",void 0),$t([t.Property(!0)],a.prototype,"allowParentDependency",void 0),$t([t.Property(!1)],a.prototype,"enableHtmlSanitizer",void 0),$t([t.Property(!0)],a.prototype,"disableHtmlEncode",void 0),$t([t.Complex({},Gt)],a.prototype,"loadingIndicator",void 0),$t([t.Property(!0)],a.prototype,"enableVirtualMaskRow",void 0),$t([t.Property(!0)],a.prototype,"UpdateOffsetOnTaskbarEdit",void 0),$t([t.Property(!0)],a.prototype,"autoCalculateDateScheduling",void 0),$t([t.Property(!0)],a.prototype,"autoFocusTasks",void 0),$t([t.Property(!0)],a.prototype,"allowSelection",void 0),$t([t.Property(!1)],a.prototype,"allowSorting",void 0),$t([t.Property(!0)],a.prototype,"enablePredecessorValidation",void 0),$t([t.Property(!1)],a.prototype,"showColumnMenu",void 0),$t([t.Property()],a.prototype,"columnMenuItems",void 0),$t([t.Property()],a.prototype,"timezone",void 0),$t([t.Property(!1)],a.prototype,"collapseAllParentTasks",void 0),$t([t.Property(!1)],a.prototype,"highlightWeekends",void 0),$t([t.Property(0)],a.prototype,"treeColumnIndex",void 0),$t([t.Property([])],a.prototype,"dataSource",void 0),$t([t.Property("day")],a.prototype,"durationUnit",void 0),$t([t.Property(null)],a.prototype,"query",void 0),$t([t.Property(null)],a.prototype,"dateFormat",void 0),$t([t.Property("auto")],a.prototype,"height",void 0),$t([t.Property(!1)],a.prototype,"renderBaseline",void 0),$t([t.Property(!1)],a.prototype,"allowTaskbarDragAndDrop",void 0),$t([t.Property(!0)],a.prototype,"allowTaskbarOverlap",void 0),$t([t.Property("Horizontal")],a.prototype,"gridLines",void 0),$t([t.Complex({},Dt)],a.prototype,"labelSettings",void 0),$t([t.Property(null)],a.prototype,"taskbarTemplate",void 0),$t([t.Property(null)],a.prototype,"parentTaskbarTemplate",void 0),$t([t.Property(null)],a.prototype,"milestoneTemplate",void 0),$t([t.Property()],a.prototype,"baselineColor",void 0),$t([t.Property("auto")],a.prototype,"width",void 0),$t([t.Property(!1)],a.prototype,"enableVirtualization",void 0),$t([t.Property()],a.prototype,"toolbar",void 0),$t([t.Property(["Monday","Tuesday","Wednesday","Thursday","Friday"])],a.prototype,"workWeek",void 0),$t([t.Property(!1)],a.prototype,"includeWeekend",void 0),$t([t.Property(!1)],a.prototype,"allowUnscheduledTasks",void 0),$t([t.Property(!1)],a.prototype,"showInlineNotes",void 0),$t([t.Property(36)],a.prototype,"rowHeight",void 0),$t([t.Property(null)],a.prototype,"taskbarHeight",void 0),$t([t.Property(null)],a.prototype,"projectStartDate",void 0),$t([t.Property(null)],a.prototype,"projectEndDate",void 0),$t([t.Property(null)],a.prototype,"resourceIDMapping",void 0),$t([t.Property(null)],a.prototype,"resourceNameMapping",void 0),$t([t.Property([])],a.prototype,"resources",void 0),$t([t.Property([])],a.prototype,"segmentData",void 0),$t([t.Property(null)],a.prototype,"connectorLineBackground",void 0),$t([t.Property(1)],a.prototype,"connectorLineWidth",void 0),$t([t.Property([])],a.prototype,"columns",void 0),$t([t.Property([])],a.prototype,"addDialogFields",void 0),$t([t.Property([])],a.prototype,"editDialogFields",void 0),$t([t.Property(-1)],a.prototype,"selectedRowIndex",void 0),$t([t.Property("hour")],a.prototype,"workUnit",void 0),$t([t.Property("FixedUnit")],a.prototype,"taskType",void 0),$t([t.Property("ProjectView")],a.prototype,"viewType",void 0),$t([t.Collection([{from:8,to:12},{from:13,to:17}],Ye)],a.prototype,"dayWorkingTime",void 0),$t([t.Collection([],ft)],a.prototype,"holidays",void 0),$t([t.Collection([],st)],a.prototype,"eventMarkers",void 0),$t([t.Complex({},Mt)],a.prototype,"taskFields",void 0),$t([t.Complex({},jt)],a.prototype,"resourceFields",void 0),$t([t.Complex({},It)],a.prototype,"timelineSettings",void 0),$t([t.Property([])],a.prototype,"zoomingLevels",void 0),$t([t.Complex({},Bt)],a.prototype,"sortSettings",void 0),$t([t.Complex({},rt)],a.prototype,"editSettings",void 0),$t([t.Complex({},Ft)],a.prototype,"tooltipSettings",void 0),$t([t.Complex({},kt)],a.prototype,"selectionSettings",void 0),$t([t.Property(!1)],a.prototype,"allowFiltering",void 0),$t([t.Property(!1)],a.prototype,"allowExcelExport",void 0),$t([t.Property(!1)],a.prototype,"allowRowDragAndDrop",void 0),$t([t.Property(!1)],a.prototype,"allowReordering",void 0),$t([t.Property(!1)],a.prototype,"readOnly",void 0),$t([t.Property(!1)],a.prototype,"allowResizing",void 0),$t([t.Property(!1)],a.prototype,"enableContextMenu",void 0),$t([t.Property(!1)],a.prototype,"enableCriticalPath",void 0),$t([t.Property()],a.prototype,"contextMenuItems",void 0),$t([t.Property(!1)],a.prototype,"allowPdfExport",void 0),$t([t.Property(!1)],a.prototype,"validateManualTasksOnLinking",void 0),$t([t.Property(!1)],a.prototype,"enableMultiTaskbar",void 0),$t([t.Property(!1)],a.prototype,"showOverAllocation",void 0),$t([t.Property("Auto")],a.prototype,"taskMode",void 0),$t([t.Complex({},dt)],a.prototype,"filterSettings",void 0),$t([t.Complex({},ct)],a.prototype,"searchSettings",void 0),$t([t.Complex({},Pt)],a.prototype,"splitterSettings",void 0),$t([t.Event()],a.prototype,"queryTaskbarInfo",void 0),$t([t.Event()],a.prototype,"beforeExcelExport",void 0),$t([t.Event()],a.prototype,"excelExportComplete",void 0),$t([t.Event()],a.prototype,"excelQueryCellInfo",void 0),$t([t.Event()],a.prototype,"excelHeaderQueryCellInfo",void 0),$t([t.Event()],a.prototype,"rowDrag",void 0),$t([t.Event()],a.prototype,"rowDragStart",void 0),$t([t.Event()],a.prototype,"rowDragStartHelper",void 0),$t([t.Event()],a.prototype,"rowDrop",void 0),$t([t.Event()],a.prototype,"collapsing",void 0),$t([t.Event()],a.prototype,"collapsed",void 0),$t([t.Event()],a.prototype,"expanding",void 0),$t([t.Event()],a.prototype,"expanded",void 0),$t([t.Event()],a.prototype,"actionBegin",void 0),$t([t.Event()],a.prototype,"actionComplete",void 0),$t([t.Event()],a.prototype,"actionFailure",void 0),$t([t.Event()],a.prototype,"dataStateChange",void 0),$t([t.Event()],a.prototype,"taskbarEdited",void 0),$t([t.Event()],a.prototype,"endEdit",void 0),$t([t.Event()],a.prototype,"cellEdit",void 0),$t([t.Event()],a.prototype,"load",void 0),$t([t.Event()],a.prototype,"created",void 0),$t([t.Event()],a.prototype,"destroyed",void 0),$t([t.Event()],a.prototype,"taskbarEditing",void 0),$t([t.Event()],a.prototype,"dataBound",void 0),$t([t.Event()],a.prototype,"resizeStart",void 0),$t([t.Event()],a.prototype,"resizing",void 0),$t([t.Event()],a.prototype,"resizeStop",void 0),$t([t.Event()],a.prototype,"splitterResizeStart",void 0),$t([t.Event()],a.prototype,"splitterResizing",void 0),$t([t.Event()],a.prototype,"splitterResized",void 0),$t([t.Event()],a.prototype,"columnDragStart",void 0),$t([t.Event()],a.prototype,"columnDrag",void 0),$t([t.Event()],a.prototype,"columnDrop",void 0),$t([t.Event()],a.prototype,"beforeTooltipRender",void 0),$t([t.Event()],a.prototype,"rowSelecting",void 0),$t([t.Event()],a.prototype,"rowSelected",void 0),$t([t.Event()],a.prototype,"rowDeselecting",void 0),$t([t.Event()],a.prototype,"rowDeselected",void 0),$t([t.Event()],a.prototype,"cellSelecting",void 0),$t([t.Event()],a.prototype,"cellSelected",void 0),$t([t.Event()],a.prototype,"cellDeselecting",void 0),$t([t.Event()],a.prototype,"cellDeselected",void 0),$t([t.Event()],a.prototype,"queryCellInfo",void 0),$t([t.Event()],a.prototype,"headerCellInfo",void 0),$t([t.Event()],a.prototype,"rowDataBound",void 0),$t([t.Event()],a.prototype,"columnMenuOpen",void 0),$t([t.Event()],a.prototype,"toolbarClick",void 0),$t([t.Event()],a.prototype,"columnMenuClick",void 0),$t([t.Event()],a.prototype,"contextMenuOpen",void 0),$t([t.Event()],a.prototype,"contextMenuClick",void 0),$t([t.Event()],a.prototype,"onTaskbarClick",void 0),$t([t.Event()],a.prototype,"recordDoubleClick",void 0),$t([t.Event()],a.prototype,"onMouseMove",void 0),$t([t.Event()],a.prototype,"beforePdfExport",void 0),$t([t.Event()],a.prototype,"pdfExportComplete",void 0),$t([t.Event()],a.prototype,"pdfQueryCellInfo",void 0),$t([t.Event()],a.prototype,"pdfQueryTaskbarInfo",void 0),$t([t.Event()],a.prototype,"pdfQueryTimelineCellInfo",void 0),$t([t.Event()],a.prototype,"pdfColumnHeaderQueryCellInfo",void 0),a=$t([t.NotifyPropertyChanges],a)}(t.Component);!function(e){e[e.NextPage=0]="NextPage",e[e.LastPage=1]="LastPage"}(e.PdfHorizontalOverflowType||(e.PdfHorizontalOverflowType={}));var ti=function(){function e(e){this.isCellEdit=!1,this.isResourceCellEdited=!1,this.parent=e,this.bindTreeGridProperties()}return e.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&&n.TreeGrid.Inject(n.Edit)},e.prototype.ensureEditCell=function(e){var i=this,r=e.rowData,n=e.columnName;this.editedColumn=this.parent.getColumnByField(n,this.parent.ganttColumns);var s=this.parent.taskFields;if(this.parent.readOnly)e.cancel=!0;else if("Dialog"!==this.parent.editSettings.mode){if(!r.hasChildRecords||(n!==s.endDate||(t.isNullOrUndefined(r.isManual)||!1!==r.isManual)&&"Auto"!==this.parent.taskMode)&&n!==s.duration&&n!==s.dependency&&n!==s.progress&&n!==s.work&&"taskType"!==n){var o=new a.Deferred;return this.parent.trigger("cellEdit",e,function(e){0===r.level&&"ResourceView"===i.parent.viewType&&(e.cancel=!0),o.resolve(e),e.cancel||(e.columnName===i.parent.taskFields.notes?i.openNotesEditor(e):(i.isCellEdit=!0,t.isNullOrUndefined(i.parent.toolbarModule)||i.parent.toolbarModule.refreshToolbarItems()))}),o}(n===s.dependency&&!this.parent.allowParentDependency||n!==s.dependency)&&(e.cancel=!0)}else e.cancel=!0},e.prototype.openNotesEditor=function(e){var t=this.parent.taskFields,i=e.rowData,r=e.columnName;if(r===t.notes&&!this.parent.showInlineNotes){e.cancel=!0;var a=this.parent.editModule.dialogModule.updatedEditFields.map(function(e){return e.type}).indexOf("Notes");if(-1!==a){this.parent.editModule.dialogModule.openEditDialog(i.ganttProperties.rowUniqueID);document.getElementById(this.parent.element.id+"_Tab").ej2_instances[0].selectedItem=a}}r===t.notes&&!0===this.parent.showInlineNotes&&(this.isCellEdit=!0)},e.prototype.isValueChange=function(e,i){var r=t.getValue("data",e),a=r[""+i],n=t.getValue("previousData",e);if(t.isNullOrUndefined(a)&&!t.isNullOrUndefined(n)||!t.isNullOrUndefined(a)&&t.isNullOrUndefined(n))return!0;if(!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(n)){if(a instanceof Date)return a.getTime()!==r.taskData[i].getTime();if(i===this.parent.taskFields.resourceInfo)return a!==n;if(a!==r.taskData[i])return!0}return!1},e.prototype.initiateCellEdit=function(e,i){var r=t.getValue("column",e),a=t.getValue("data",e),n={};n.action="CellEditing",n.data=this.parent.getTaskByUniqueID(a.uniqueID);var s=t.getValue("previousData",e),o=this.parent.allowUnscheduledTasks?a[r.field]:!t.isNullOrUndefined(a[r.field])&&""!==a[r.field]||this.parent.taskFields.duration!==r.field&&this.parent.taskFields.startDate!==r.field&&this.parent.taskFields.endDate!==r.field?a[r.field]:s;t.isNullOrUndefined(a)?this.parent.editModule.endEditAction(e):(a[r.field]=s,n.data[r.field]=s,this.parent.initiateEditAction(!0),this.parent.setRecordValue(r.field,o,n.data),r.field===this.parent.taskFields.name?this.taskNameEdited(n):r.field===this.parent.taskFields.startDate?this.startDateEdited(n):r.field===this.parent.taskFields.endDate?this.endDateEdited(n):r.field===this.parent.taskFields.duration?this.durationEdited(n):r.field===this.parent.taskFields.resourceInfo?this.resourceEdited(n,i,a):r.field===this.parent.taskFields.progress?this.progressEdited(n):r.field===this.parent.taskFields.baselineStartDate||r.field===this.parent.taskFields.baselineEndDate?this.baselineEdited(n):r.field===this.parent.taskFields.dependency?this.dependencyEdited(n,s):r.field===this.parent.taskFields.notes?this.notedEdited(n):r.field===this.parent.taskFields.work?this.workEdited(n):"taskType"!==r.field||t.isNullOrUndefined(this.parent.taskFields.work)?r.field===this.parent.taskFields.manual?this.taskmodeEdited(n):(this.parent.setRecordValue("taskData."+r.field,n.data[r.field],n.data),this.parent.editModule.initiateSaveAction(n)):this.typeEdited(n,i)),this.isCellEdit=!1,t.isNullOrUndefined(this.parent.editModule.cellEditModule.editedColumn)||(this.parent.editModule.cellEditModule.editedColumn=null),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.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)},e.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)},e.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)},e.prototype.startDateEdited=function(e){var i=e.data,r=e.data.ganttProperties,a=e.data[this.parent.taskFields.startDate];a=a?new Date(a.getTime()):null,a=this.parent.dateValidationModule.checkStartDate(a,i.ganttProperties,i.ganttProperties.isMilestone),t.isNullOrUndefined(a)?i.hasChildRecords||(this.parent.setRecordValue("startDate",null,r,!0),this.parent.setRecordValue("duration",null,r,!0),this.parent.setRecordValue("isMilestone",!1,r,!0),this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(this.parent.taskFields.endDate)&&this.parent.setRecordValue("endDate",null,r,!0)):r.endDate||!t.isNullOrUndefined(r.duration)?(this.parent.setRecordValue("startDate",new Date(a.getTime()),r,!0),this.parent.dateValidationModule.calculateEndDate(i)):t.isNullOrUndefined(r.endDate)&&t.isNullOrUndefined(r.duration)&&this.parent.setRecordValue("startDate",new Date(a.getTime()),r,!0),this.parent.setRecordValue("isMilestone",0===r.duration,r,!0),this.parent.dataOperation.updateWidthLeft(e.data),this.parent.dataOperation.updateMappingData(i,"startDate"),this.parent.dataOperation.updateMappingData(i,"endDate"),this.parent.dataOperation.updateMappingData(i,"duration"),this.updateEditedRecord(e)},e.prototype.validateEndDateWithSegments=function(e){for(var i=[],r=e.segments,a=0;a<r.length;a++){var n=r[parseInt(a.toString(),10)],s=n.endDate;s=!t.isNullOrUndefined(e.endDate)&&s.getTime()<e.endDate.getTime()&&a!==r.length-1?s:e.endDate,n.duration=this.parent.dataOperation.getDuration(n.startDate,s,e.durationUnit,e.isAutoSchedule,e.isMilestone),r.length>0&&s.getTime()<n.startDate.getTime()&&s.getTime()<=e.endDate.getTime()?r[a-1].duration=this.parent.dataOperation.getDuration(r[a-1].startDate,e.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone):i.push(n)}return i},e.prototype.endDateEdited=function(e){var i=e.data.ganttProperties,r=e.data[this.parent.taskFields.endDate];r=r?new Date(r.getTime()):null,t.isNullOrUndefined(r)?(this.parent.setRecordValue("endDate",r,i,!0),this.parent.setRecordValue("duration",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0)):(0===r.getHours()&&86400!==this.parent.defaultEndTime&&this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,r),r=this.parent.dateValidationModule.checkEndDate(r,i),this.parent.setRecordValue("endDate",r,i,!0),!t.isNullOrUndefined(i.startDate)&&t.isNullOrUndefined(i.duration)?-1===this.parent.dateValidationModule.compareDates(i.endDate,i.startDate)&&(this.parent.setRecordValue("endDate",new Date(i.startDate.getTime()),i,!0),this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,i.endDate)):!t.isNullOrUndefined(i.duration)&&t.isNullOrUndefined(i.startDate)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(i.endDate,i.duration,i.durationUnit,i),i,!0),t.isNullOrUndefined(i.segments)||(i.segments=this.validateEndDateWithSegments(i)),-1===this.compareDatesFromRecord(i)?this.parent.dateValidationModule.calculateDuration(e.data):this.parent.editModule.revertCellEdit(e),this.parent.setRecordValue("isMilestone",0===i.duration,i,!0),i.isMilestone&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i.startDate,i),i,!0)),!t.isNullOrUndefined(e.data.ganttProperties.segments)&&e.data.ganttProperties.segments.length>0&&(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)},e.prototype.durationEdited=function(e){var t=e.data.ganttProperties,i=e.data[this.parent.taskFields.duration];this.parent.dataOperation.updateDurationValue(i,t),this.updateDates(e),this.parent.editModule.updateResourceRelatedFields(e.data,"duration"),this.updateEditedRecord(e)},e.prototype.updateDates=function(e){var i=e.data.ganttProperties,r=this.parent.dateValidationModule.getDateFromFormat(i.endDate),a=this.parent.dateValidationModule.getDateFromFormat(i.startDate),n=i.duration;t.isNullOrUndefined(n)?(this.parent.setRecordValue("isMilestone",!1,i,!0),null!=e.data[this.parent.taskFields.duration]&&this.parent.setRecordValue("endDate",null,i,!0)):(t.isNullOrUndefined(a)&&!t.isNullOrUndefined(r)&&this.parent.setRecordValue("startDate",this.parent.dateValidationModule.getStartDate(r,n,i.durationUnit,i),i,!0),0!==n&&i.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,i,!0),this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(i.startDate,i),i,!0)),!t.isNullOrUndefined(i.segments)&&i.segments.length>0&&(this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(e.data,!1),i,!0),this.parent.dataOperation.updateMappingData(e.data,"segments")),this.parent.setRecordValue("isMilestone",0===i.duration,i,!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")},e.prototype.progressEdited=function(e){var i=e.data;if(this.parent.setRecordValue("progress",i[this.parent.taskFields.progress]>100?100:i[this.parent.taskFields.progress],i.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.progress,i[this.parent.taskFields.progress]>100?100:i[this.parent.taskFields.progress],e.data),i.ganttProperties.isAutoSchedule||this.parent.setRecordValue("autoWidth",this.parent.dataOperation.calculateWidth(i,!1),i.ganttProperties,!0),!t.isNullOrUndefined(e.data.ganttProperties.segments)&&e.data.ganttProperties.segments.length>0&&!t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&this.parent.editModule.taskbarEditModule.updateSegmentProgress(e.data.ganttProperties),!e.data.hasChildRecords){var r=i.ganttProperties.isAutoSchedule?i.ganttProperties.width:i.ganttProperties.autoWidth;this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(r,i.ganttProperties.progress),i.ganttProperties,!0)}this.updateEditedRecord(e)},e.prototype.baselineEdited=function(e){var t=e.data.ganttProperties,i=e.data[this.parent.taskFields.baselineStartDate],r=e.data[this.parent.taskFields.baselineEndDate];r&&0===r.getHours()&&86400!==this.parent.defaultEndTime&&this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,r),this.parent.setRecordValue("baselineStartDate",this.parent.dateValidationModule.checkBaselineStartDate(i),t,!0),this.parent.setRecordValue("baselineEndDate",this.parent.dateValidationModule.checkBaselineEndDate(r),t,!0),t.baselineStartDate&&t.baselineEndDate&&(this.parent.setRecordValue("baselineLeft",this.parent.dataOperation.calculateBaselineLeft(t),t,!0),this.parent.setRecordValue("baselineWidth",this.parent.dataOperation.calculateBaselineWidth(t),t,!0)),this.updateEditedRecord(e)},e.prototype.resourceEdited=function(e,i,r){var a=this.parent.resourceFields,n=i[this.parent.taskFields.resourceInfo];if(n){this.isResourceCellEdited=!0;for(var s=this.parent.dataOperation.setResourceInfo(i).length,o=r.ganttProperties.resourceInfo,l=void 0,d=[],h=this.parent.resources,p=void 0,c=function(e){if(o){var i=o.length;for(p=0;p<i;p++){if(o[p][a.id]===n[e]){l=p;break}l=-1}}if(t.isNullOrUndefined(l)||-1===l){var r=h.filter(function(t){return n[e]===t[a.id]}),s=t.extend({},r[0]);s[a.unit]=100,d.push(s)}else d.push(o[parseInt(l.toString(),10)])},u=0;u<s;u++)c(u);e.data.ganttProperties.resourceInfo=d,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=o),this.updateDates(e),this.updateEditedRecord(e)}},e.prototype.dependencyEdited=function(e,t){this.parent.predecessorModule.updateUnscheduledDependency(e.data),this.parent.connectorLineEditModule.updatePredecessor(e.data,e.data[this.parent.taskFields.dependency],e)||this.parent.editModule.revertCellEdit(t)},e.prototype.workEdited=function(e){var t=e.data.ganttProperties,i=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)},e.prototype.typeEdited=function(e,t){var i=e.data.ganttProperties,r=t.taskType;this.parent.setRecordValue("taskType",r,i,!0),this.updateEditedRecord(e)},e.prototype.compareDatesFromRecord=function(e){var t=this.parent.dateValidationModule.getValidStartDate(e),i=this.parent.dateValidationModule.getValidEndDate(e);return this.parent.dateValidationModule.compareDates(t,i)},e.prototype.updateEditedRecord=function(e){this.parent.editModule.initiateUpdateAction(e)},e.prototype.destroy=function(){this.parent.editModule.cellEditModule=void 0},e}(),ii=function(){function e(e,t){this.parent=e,this.taskbarEdit=t}return e.prototype.createTooltip=function(e,t,r){var a=this;this.toolTipObj=new i.Tooltip({opensOn:e,position:"TopRight",enableRtl:this.parent.enableRtl,mouseTrail:t,cssClass:"e-gantt-tooltip",target:r||null,animation:{open:{effect:"None"},close:{effect:"None"}}}),this.toolTipObj.beforeRender=function(e){var t={data:a.taskbarEdit.taskBarEditRecord,args:e,content:a.toolTipObj.content};a.parent.trigger("beforeTooltipRender",t)},this.toolTipObj.afterOpen=function(e){a.updateTooltipPosition(e)},this.toolTipObj.isStringTemplate=!0,this.toolTipObj.appendTo(this.parent.chartPane)},e.prototype.updateTooltipPosition=function(e){var t=this.parent.getOffsetRect(this.parent.chartPane).left+this.parent.chartPane.offsetWidth,i=e.element.offsetLeft;t<i+e.element.offsetWidth&&(i+=t-(i+e.element.offsetWidth)),e.element.style.left=i+"px",e.element.style.visibility="visible"},e.prototype.showHideTaskbarEditTooltip=function(e,i){e&&this.parent.tooltipSettings.showTooltip?(this.createTooltip("Custom",!1),this.parent.tooltipModule.toolTipObj.close(),this.updateTooltip(i),"ConnectorPointLeftDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+Me)):"ConnectorPointRightDrag"===this.taskbarEdit.connectorSecondAction?this.toolTipObj.open(this.taskbarEdit.connectorSecondElement.querySelector("."+Re)):this.toolTipObj.open(this.taskbarEdit.taskBarEditElement)):t.isNullOrUndefined(this.toolTipObj)||(this.toolTipObj.destroy(),this.toolTipObj=null)},e.prototype.updateTooltip=function(e){var i=this.taskbarEdit.taskBarEditRecord.ganttProperties,r=-1===e?i.width:i.segments[e].width,a=-1===e?i.progressWidth:i.segments[e].progressWidth,n=-1===e?i.left:i.left+i.segments[e].left;t.isNullOrUndefined(this.toolTipObj)||("ConnectorPointLeftDrag"===this.taskbarEdit.taskBarEditAction||"ConnectorPointRightDrag"===this.taskbarEdit.taskBarEditAction?(this.toolTipObj.content=this.getTooltipText(e),this.toolTipObj.offsetY=-3):(this.toolTipObj.content=this.getTooltipText(e),this.toolTipObj.refresh(this.taskbarEdit.taskBarEditElement),"LeftResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=0:this.toolTipObj.offsetX=-r:"RightResizing"===this.taskbarEdit.taskBarEditAction||"ParentResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-r:this.toolTipObj.offsetX=0:"ProgressResizing"===this.taskbarEdit.taskBarEditAction?this.parent.enableRtl?this.toolTipObj.offsetX=-a:this.toolTipObj.offsetX=-(r-a):"MilestoneDrag"===this.taskbarEdit.taskBarEditAction?this.toolTipObj.offsetX=-this.parent.chartRowsModule.milestoneHeight/2:r>5&&(this.toolTipObj.offsetX=-(r+n-this.taskbarEdit.tooltipPositionX))))},e.prototype.getTooltipText=function(e){var i="",r=this.parent.globalize,a=this.taskbarEdit.taskBarEditRecord.ganttProperties;if(!t.isNullOrUndefined(a.segments)&&a.segments.length>0&&-1!==e&&"ProgressResizing"!==this.taskbarEdit.taskBarEditAction&&(a=a.segments[e]),this.parent.tooltipSettings.editing){var n=this.parent.tooltipModule.templateCompiler(this.parent.tooltipSettings.editing,this.parent,this.taskbarEdit.taskBarEditRecord,"TooltipEditingTemplate");t.getValue("tooltipEle",this.toolTipObj)&&this.parent.renderTemplates(),i=n[0]}else{var s=void 0,o=void 0,l=void 0;switch(t.isNullOrUndefined(a.startDate)||(s='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("startDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+r.formatDate(a.startDate,{format:this.parent.getDateFormat()})+"</td></tr>"),t.isNullOrUndefined(a.endDate)||(o='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("endDate")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+r.formatDate(a.endDate,{format:this.parent.getDateFormat()})+"</td></tr>"),t.isNullOrUndefined(a.duration)||(l='<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("duration")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+this.parent.getDurationString(a.duration,a.durationUnit)+"</td></tr>"),this.taskbarEdit.taskBarEditAction){case"ProgressResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+('<tr><td class = "e-gantt-tooltip-label">'+this.parent.localeObj.getConstant("progress")+'</td><td style="padding: 2px;">:</td><td class = "e-gantt-tooltip-value">'+a.progress+"</td></tr>")+"</tbody></table>";break;case"LeftResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+s+l+"</tbody></table>";break;case"RightResizing":case"ParentResizing":i='<table class = "e-gantt-tooltiptable"><tbody>'+o+l+"</tbody></table>";break;case"ChildDrag":case"ParentDrag":case"MilestoneDrag":case"ManualParentDrag":var d="",h="";t.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.startDate)||(d=s),t.isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.endDate)||(h=o),i='<table class = "e-gantt-tooltiptable"><tbody>'+d+h+"</tbody></table>";break;case"ConnectorPointLeftDrag":case"ConnectorPointRightDrag":i=this.parent.connectorLineModule.tooltipTable,t.isNullOrUndefined(this.toolTipObj)&&(this.parent.connectorLineModule.tooltipTable.innerHTML=this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"",""))}}return i},e}(),ri=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),ai=function(){return(ai=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},ni=function(e){function i(t){var i=e.call(this,t)||this;return i.isMouseDragged=!1,i.dependencyCancel=!1,i.editElement=null,i.elementOffsetLeft=0,i.elementOffsetTop=0,i.elementOffsetWidth=0,i.elementOffsetHeight=0,i.segmentIndex=-1,i.currentItemTop=0,i.currentItemPrevTop=0,i.topValue=0,i.draggedRecordMarginTop=0,i.parent=t,i.initPublicProp(),i.wireEvents(),i.editTooltip=new ii(i.parent,i),i}return ri(i,e),i.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)},i.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},i.prototype.mouseDownHandler=function(e){if(this.parent.editSettings.allowTaskbarEditing&&!this.parent.readOnly)if(this.canDrag=!1,this.parent.isAdaptive&&this.taskBarEditElement){var t=this.getElementByPosition(e),i=f(t,H);!i||i.innerHTML!==this.taskBarEditElement.innerHTML||t.classList.contains(Me)||t.classList.contains(Re)||this.tapPointOnFocus||(this.updateTaskBarEditElement(e),this.canDrag=!0,e.preventDefault())}else this.parent.isAdaptive||this.updateTaskBarEditElement(e)},i.prototype.mouseClickHandler=function(e){if(this.parent.editSettings.allowTaskbarEditing){var t=this.getElementByPosition(e),i=f(t,H);this.parent.selectionModule&&this.parent.selectionModule.enableSelectMultiTouch?this.tapPointOnFocus&&this.updateTaskBarEditElement(e):this.tapPointOnFocus&&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(Oe)||t.classList.contains(xe)?(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))}},i.prototype.showHideActivePredecessors=function(e){var i=this.taskBarEditRecord.ganttProperties,r=i.predecessor,a="ResourceView"===this.parent.viewType?i.taskId:i.rowUniqueID;if(r)for(var n=0;n<r.length;n++){var s=r[n];a.toString()!==s.from&&a.toString()!==s.to||this.applyActiveColor(s.from,s.to,e)}var o=this.parent.ganttChartModule.chartBodyContainer;e?(t.addClass([this.taskBarEditElement],[Ue]),t.addClass([o],[Le])):(t.removeClass([this.taskBarEditElement],[Ue]),t.removeClass([o],[Le])),this.touchEdit=e,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},i.prototype.applyActiveColor=function(e,i,r){var a=("ProjectView"===this.parent.viewType?this.taskBarEditRecord.ganttProperties.taskId.toString():this.taskBarEditRecord.ganttProperties.rowUniqueID.toString())===e?this.parent.connectorLineModule.getRecordByID(i):this.parent.connectorLineModule.getRecordByID(e),n=this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(a)];if(!t.isNullOrUndefined(n)){var s=n.querySelector("."+H),o=this.parent.element.querySelector("#ConnectorLineparent"+e+"child"+i);r?(t.addClass([s],[Ve]),o&&t.addClass([o],[Ve])):(t.removeClass([s],[Ve]),o&&t.removeClass([o],[Ve]))}},i.prototype.validateConnectorPoint=function(){var e=this.taskBarEditRecord.ganttProperties,t=this.connectorSecondRecord.ganttProperties,i=!0,r="ResourceView"===this.parent.viewType?e.taskId:e.rowUniqueID,a="ResourceView"===this.parent.viewType?t.taskId:t.rowUniqueID;if(this.connectorSecondRecord.hasChildRecords)i=!1;else if(t.predecessor)for(var n=0;n<t.predecessor.length;n++){var s=t.predecessor[n];if(s.from===r.toString()&&s.to===a.toString()){this.parent.connectorLineEditModule.childRecord=this.connectorSecondRecord,this.parent.connectorLineEditModule.predecessorIndex=n,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}if(s.from===a.toString()&&s.to===r.toString()){this.parent.connectorLineEditModule.childRecord=this.taskBarEditRecord,this.parent.connectorLineEditModule.predecessorIndex=n,this.parent.connectorLineEditModule.renderPredecessorDeleteConfirmDialog(),i=!1;break}}return i},i.prototype.mouseLeaveHandler=function(e){this.dragMouseLeave=!0},i.prototype.updateTaskBarEditElement=function(e){var i,r=this.getElementByPosition(e);if(r.classList.contains(he)||r.classList.contains(se)||r.classList.contains(oe))i=f(r,se);else if(r.classList.contains(le))i=f(r,le);else if(i=f(r,H),!t.isNullOrUndefined(i)&&!r.classList.contains("e-connectorpoint-left")&&!r.classList.contains("e-connectorpoint-right")){var a=this.parent.ganttChartModule.getRecordByTaskBar(i);!t.isNullOrUndefined(a.ganttProperties.segments)&&a.ganttProperties.segments.length>0&&(i=f(r,W))}if(this.parent.editSettings.allowTaskbarEditing&&i){this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.editElement=i,this.realTaskbarElement=this.editElement;var n=this.editElement.getAttribute("data-segment-index");if(t.isNullOrUndefined(n)?this.segmentIndex=-1:this.segmentIndex=Number(n),this.taskBarEditRecord=this.parent.ganttChartModule.getRecordByTaskBar(this.editElement),"mousedown"===e.type||"touchstart"===e.type||"click"===e.type){this.taskBarEditAction=this.getTaskBarAction(e);var s=this.editElement.getAttribute("data-segment-index"),o=(a=this.parent.ganttChartModule.getRecordByTaskBar(i)).ganttProperties,l=this.editElement.parentElement.offsetLeft;this.currentData=a;var d=t.createElement("div",{styles:"height:100%;border-style:dashed;border-bottom:none;border-top:none;border-width:1px;position:absolute;z-index:10000"});t.addClass([d],"e-taskbar-resize-div"),d.style.setProperty("width",o.width+"px");var h=this.editElement.getAttribute("data-segment-index");d.style.setProperty("left",t.isNullOrUndefined(o.segments)?o.left+"px":l+o.segments[Number(h)].left+"px");var p=this.parent.createElement("table"),c=this.parent.createElement("tbody");c.appendChild(d),p.appendChild(c);var u=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-clone-taskbar"),g=null;if("ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(s)||t.isNullOrUndefined(s)||0!==Number(s))m=this.editElement.cloneNode(!0);else var m=this.editElement.parentElement.cloneNode(!0);if(!u){t.addClass([m],"e-clone-taskbar"),m.style.setProperty("position","absolute"),m.style.setProperty("top","0px"),g=this.parent.createElement("table");var y=this.parent.createElement("tbody");y.appendChild(m),g.appendChild(y)}if("ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(s)||t.isNullOrUndefined(s)||0!==Number(s))this.cloneTaskbarElement=m;else{var D=m.getElementsByClassName("e-segmented-taskbar");this.cloneTaskbarElement=D[Number(s)]}if(this.taskBarEditElement=this.cloneTaskbarElement,this.taskbarElement=g,this.taskbarResizer=p,this.currentIndex=s,this.roundOffDuration=!0,"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||!t.isNullOrUndefined(this.parent.taskFields.dependency)||(this.taskBarEditAction=null),this.updateMouseDownProperties(e),"ResourceView"===this.parent.viewType){if(0===this.taskBarEditRecord.level)return;if(this.parent.enableMultiTaskbar){var v=this.parent.getTaskByUniqueID(this.taskBarEditRecord.parentItem.uniqueID);t.isNullOrUndefined(v)||v.expanded||(this.prevZIndex=this.taskBarEditElement.style.zIndex,this.taskBarEditElement.style.zIndex="1000",this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")&&t.addClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"))}}}}else this.parent.isAdaptive?(this.taskBarEditElement&&this.showHideTaskBarEditingElements(i,this.taskBarEditElement),this.initPublicProp()):this.showHideTaskBarEditingElements(i,this.editElement)},i.prototype.showHideTaskBarEditingElements=function(e,i,r){i=i||this.editElement;var a=!!this.parent.taskFields.progress,n=!0;if(!this.parent.readOnly){if("ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar&&e){var s=this.parent.ganttChartModule.getRecordByTaskBar(e),o=this.parent.getParentTask(s.parentItem);t.isNullOrUndefined(o)||o.expanded||(a=!1,n=!1)}if(e){if(e.querySelector("."+K)){if(t.addClass([e.querySelector("."+K)],[ge]),t.addClass([e.querySelector("."+J)],[fe]),a){var l=e.querySelector("."+$);t.isNullOrUndefined(l)||(t.addClass([l],[me]),l.style.top="3px")}}else if(this.parent.isAdaptive&&a){(s=this.parent.ganttChartModule.getRecordByTaskBar(e)).hasChildRecords&&t.addClass([e],[Fe])}if(t.addClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+ke),[Ce]),!t.isNullOrUndefined(this.parent.taskFields.dependency)&&(e.querySelector("."+Me)||e.parentElement.querySelector("."+Me))&&n){var d=t.isNullOrUndefined(e.querySelector("."+Me))?e.parentElement:e;t.addClass([d.querySelector("."+Me)],[Oe]),t.addClass([d.querySelector("."+Re)],[xe])}}else r||t.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+ke),[Ce]);if(i&&e!==i){if(i.querySelector("."+K)&&(t.removeClass([i.querySelector("."+K)],[ge]),t.removeClass([i.querySelector("."+J)],[fe]),i.querySelector("."+$)&&t.removeClass([i.querySelector("."+$)],[me])),t.isNullOrUndefined(this.parent.taskFields.dependency)||!i.querySelector("."+Me)&&!i.parentElement.querySelector("."+Me)){if(this.parent.isAdaptive){(s=this.parent.ganttChartModule.getRecordByTaskBar(i))&&s.hasChildRecords&&t.removeClass([i],[Fe])}}else{d=t.isNullOrUndefined(i.querySelector("."+Me))?i.parentElement:i;t.removeClass([d.querySelector("."+Me)],[Oe]),t.removeClass([d.querySelector("."+Re)],[xe])}this.editElement=null}}},i.prototype.getTaskBarAction=function(e){var i=this.getElementByPosition(e),r=this.taskBarEditRecord,a="";return i.classList.contains(K)?a="LeftResizing":i.classList.contains(J)?a="RightResizing":(i.classList.contains($)||t.closest(i,"."+$))&&this.parent.taskFields.progress?a="ProgressResizing":i.classList.contains(Me)?a="ConnectorPointLeftDrag":i.classList.contains(Re)?a="ConnectorPointRightDrag":i.classList.contains(he)?a="ParentResizing":i.classList.contains(oe)||i.classList.contains(se)||i.classList.contains(le)?a="ManualParentDrag":r&&(a=r.hasChildRecords?"Auto"===this.parent.taskMode?"ParentDrag":"":r.ganttProperties.isMilestone?"MilestoneDrag":"ChildDrag"),a},i.prototype.updateMouseDownProperties=function(e){var i=this.getCoordinate(e);if(i.pageX||i.pageY){var r=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);this.parent.enableRtl?this.mouseDownX=Math.abs(i.pageX-(r.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseDownX=i.pageX-r.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseDownX,this.mouseDownY=this.dragMoveY=i.pageY-r.top+this.parent.ganttChartModule.scrollObject.previousScroll.top}if("ResourceView"==this.parent.viewType&&this.parent.allowTaskbarDragAndDrop){var a=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(a=this.parent.toolbarModule.element.offsetHeight),this.topValue=this.parent.getOffsetRect(e.target).top-this.parent.getOffsetRect(this.parent.element).top-parseInt(t.closest(e.target,".e-taskbar-main-container").style.marginTop)-this.parent.element.getElementsByClassName("e-timeline-header-container")[0].offsetHeight-a+document.getElementsByClassName("e-chart-scroll-container e-content")[0].scrollTop,this.currentItemPrevTop=this.currentItemTop=this.topValue}"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction||(this.fromPredecessorText="ConnectorPointLeftDrag"===this.taskBarEditAction?"start":"finish",this.parent.connectorLineModule.tooltipTable.innerHTML=this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.taskBarEditRecord.ganttProperties.taskName,this.fromPredecessorText,"",""))},i.prototype.isMouseDragCheck=function(){if(!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);var e=this.taskBarEditRecord.ganttProperties;this.previousItem=this.parent.timelineModule.extendFunction(e,this.previousItemProperty),"ConnectorPointLeftDrag"!==this.taskBarEditAction&&"ConnectorPointRightDrag"!==this.taskBarEditAction&&this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),this.taskBarEditElement.setAttribute("aria-grabbed","true")}},i.prototype.mouseMoveAction=function(e){var i=this;if(this.parent.isAdaptive){if(!this.canDrag)return;this.multipleSelectionEnabled()}var r=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),a=this.getCoordinate(e);if(this.parent.enableRtl?this.mouseMoveX=Math.abs(a.pageX-(r.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=a.pageX-r.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.mouseMoveY=a.pageY-r.top+this.parent.ganttChartModule.scrollObject.previousScroll.top,this.dragMouseLeave=!1,this.isMouseDragCheck(),this.isMouseDragged&&this.taskBarEditAction){if(!(t.isNullOrUndefined(this.taskbarElement)||t.isNullOrUndefined(this.editElement)||"ConnectorPointRightDrag"===this.taskBarEditAction||"ConnectorPointLeftDrag"===this.taskBarEditAction||"ResourceView"===this.parent.viewType&&this.currentData.hasChildRecords)){var n=this.editElement.parentElement;if(n.style.setProperty("position","absolute"),"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||t.isNullOrUndefined(this.currentIndex)||t.isNullOrUndefined(this.currentIndex)||0!==Number(this.currentIndex)?n.appendChild(this.taskbarElement):(this.taskbarElement.childNodes[0].childNodes[0].style.setProperty("top",n.parentElement.offsetTop+"px"),n.parentElement.appendChild(this.taskbarElement)),"ProgressResizing"!==this.taskBarEditAction){this.parent.ganttChartModule.chartBodyContainer.querySelectorAll(".e-chart-rows-container")[0].appendChild(this.taskbarResizer)}}var s={cancel:!1,requestType:"taskbarediting",taskBarEditAction:this.taskBarEditAction,data:this.taskBarEditRecord};-1!==this.segmentIndex&&(s.requestType="mergeSegment"),this.parent.trigger("actionBegin",s,function(r){"ConnectorPointRightDrag"!==s.taskBarEditAction&&"ConnectorPointLeftDrag"!==s.taskBarEditAction&&"LeftResizing"!==s.taskBarEditAction&&"RightResizing"!==s.taskBarEditAction&&"ProgressResizing"!==s.taskBarEditAction&&"ChildDrag"!==s.taskBarEditAction&&"ParentDrag"!==s.taskBarEditAction&&"MilestoneDrag"!==s.taskBarEditAction&&"ManualParentDrag"!==s.taskBarEditAction||(i.parent.showIndicator=!1),!t.isNullOrUndefined(i.parent.loadingIndicator)&&"Shimmer"===i.parent.loadingIndicator.indicatorType&&i.parent.showIndicator?i.parent.showMaskRow():i.parent.showIndicator&&i.parent.showSpinner(),!1===r.cancel&&i.taskBarEditingAction(e,!1)})}else this.parent.isAdaptive||this.taskBarEditAction||this.updateTaskBarEditElement(e)},i.prototype.taskBarEditingAction=function(e,i){var r=this,a={},n=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement);if(null!==this.taskBarEditRecord){if(a.editingFields=this.taskBarEditRecord.ganttProperties,a.data=this.taskBarEditRecord,"ResourceView"===this.parent.viewType&&0===a.data.level)return;if(a.recordIndex=n,a.taskBarEditAction=this.taskBarEditAction,a.roundOffDuration=this.roundOffDuration,a.cancel=!1,a.previousData=this.previousItem,a.segmentIndex=this.segmentIndex,this.roundOffDuration=a.roundOffDuration,this.targetElement=a.target=t.closest(e.target,".e-gantt-child-taskbar"),this.updateMouseMoveProperties(e),"ProgressResizing"===this.taskBarEditAction?this.performProgressResize(e):"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.parent.isAdaptive||this.drawFalseLine()),"ResourceView"==this.parent.viewType&&this.parent.allowTaskbarDragAndDrop){this.dragMoveY>this.mouseMoveY?(this.mouseMoveY=this.dragMoveY-this.mouseMoveY,this.currentItemTop=this.currentItemTop-this.mouseMoveY):(this.mouseMoveY-=this.dragMoveY,this.currentItemTop=this.currentItemTop+this.mouseMoveY);var s=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer);this.dragMoveY=e.pageY-s.top+this.parent.ganttChartModule.scrollObject.previousScroll.top,this.topValue=this.currentItemTop,this.currentItemPrevTop=0===this.currentItemPrevTop||this.topValue==this.currentItemTop?this.topValue:this.currentItemPrevTop}this.setItemPosition(),this.updateEditedItem(),this.editTooltip.updateTooltip(this.segmentIndex),i&&this.taskBarEditedAction(e),this.parent.trigger("taskbarEditing",a,function(e){e.cancel&&null!==r.taskBarEditRecord&&(r.tapPointOnFocus=!1,t.merge(r.taskBarEditRecord.ganttProperties,e.previousData))})}},i.prototype.updateMouseMoveProperties=function(e){var t=this.parent.getOffsetRect(this.parent.ganttChartModule.chartBodyContainer),i=this.getCoordinate(e);(i.pageX||i.pageY)&&(this.parent.enableRtl?this.mouseMoveX=Math.abs(i.pageX-(t.left+Math.abs(this.parent.ganttChartModule.scrollObject.previousScroll.left))):this.mouseMoveX=i.pageX-t.left+this.parent.ganttChartModule.scrollObject.previousScroll.left,this.tooltipPositionX=this.mouseMoveX,this.mouseMoveY=i.pageY-t.top+this.parent.ganttChartModule.scrollObject.previousScroll.top);var r="ConnectorPointLeftDrag"===this.taskBarEditAction||"ConnectorPointRightDrag"===this.taskBarEditAction;if(this.taskBarEditRecord.ganttProperties.width>3&&("ProgressResizing"!==this.taskBarEditAction||0!==this.taskBarEditRecord.ganttProperties.progress&&100!==this.taskBarEditRecord.ganttProperties.progress)||r){var a=0;a=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;var n=this.mouseMoveY-this.parent.ganttChartModule.scrollObject.previousScroll.top+t.top;a+20>t.left+this.parent.ganttChartModule.chartBodyContainer.offsetWidth?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("right")):a+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")):a-20<t.left?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.left,this.startScrollTimer("left")):n+80>t.top+this.parent.ganttChartModule.chartBodyContainer.offsetHeight?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("bottom")):n-20<t.top?(this.timerCount=this.parent.ganttChartModule.scrollObject.previousScroll.top,this.startScrollTimer("top")):this.stopScrollTimer()}else this.stopScrollTimer()},i.prototype.startScrollTimer=function(e){var t=this;this.stopScrollTimer();var i=0;this.scrollTimer=window.setInterval(function(){-1==Math.sign(t.timerCount)&&(i=-1,t.timerCount=Math.abs(t.timerCount)),t.timerCount="right"===e?t.timerCount+1>=t.parent.timelineModule.totalTimelineWidth?t.parent.timelineModule.totalTimelineWidth:t.timerCount+1:"bottom"===e?t.timerCount+1:t.timerCount-1<0?0:t.timerCount-1,"bottom"===e||"top"===e?t.parent.ganttChartModule.scrollObject.setScrollTop(t.timerCount):t.parent.ganttChartModule.scrollObject.setScrollLeft(t.timerCount,i),"ConnectorPointLeftDrag"!==t.taskBarEditAction&&"ConnectorPointRightDrag"!==t.taskBarEditAction||t.drawFalseLine()},0)},i.prototype.stopScrollTimer=function(){window.clearInterval(this.scrollTimer),this.scrollTimer=null},i.prototype.enableDragging=function(e){var i=this.taskBarEditRecord.ganttProperties,r=0;if(this.taskBarEditElement.classList.contains("e-segmented-taskbar")&&!this.taskBarEditElement.classList.contains("e-segment-first")){var a=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ai({},e)}),n=a[this.segmentIndex];this.mouseDownX>this.mouseMoveX?(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,n.left=n.left-r):(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,n.left=n.left+r);var s=a[this.segmentIndex-1],o=a[this.segmentIndex+1],l=void 0;l=this.taskBarEditElement.classList.contains("e-segment-inprogress")?n.left<s.left+s.width?s.left+s.width:n.width+n.left>o.left?o.left-n.width:n.left:n.left<s.left+s.width?s.left+s.width:i.left+n.width+n.left>=this.parent.timelineModule.totalTimelineWidth?this.parent.timelineModule.totalTimelineWidth-n.width:n.left,n.left=l,this.parent.setRecordValue("segments",a,i,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")}else{this.mouseDownX>this.mouseMoveX?(r=this.mouseDownX-this.mouseMoveX)>0&&this.parent.setRecordValue("left",this.previousItem.left-r,i,!0):(r=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("left",this.previousItem.left+r,i,!0));l=i.left<0?0:i.left+i.width>=this.parent.timelineModule.totalTimelineWidth?this.parent.timelineModule.totalTimelineWidth-i.width:i.left;this.parent.setRecordValue("left",l,i,!0)}},i.prototype.performProgressResize=function(e){var t=this.taskBarEditRecord.ganttProperties,i=0;this.mouseDownX>this.mouseMoveX?this.mouseMoveX>t.left&&this.mouseMoveX<t.left+t.width&&t.left>0?(i=this.mouseMoveX-t.left,this.parent.setRecordValue("progressWidth",i,t,!0)):this.mouseMoveX>=t.left+t.width?this.parent.setRecordValue("progressWidth",t.width,t,!0):this.parent.setRecordValue("progressWidth",0,t,!0):this.mouseMoveX>t.left&&this.mouseMoveX<t.left+t.width?(i=this.mouseMoveX-t.left,this.parent.setRecordValue("progressWidth",i,t,!0)):this.mouseMoveX<=t.left?this.parent.setRecordValue("progressWidth",0,t,!0):this.parent.setRecordValue("progressWidth",t.width,t,!0);var r=t.progressWidth>t.width?t.width:t.progressWidth;r=t.progressWidth<0?0:t.progressWidth,this.parent.setRecordValue("progressWidth",r,t,!0);var a=t.width-t.progressWidth;this.progressBorderRadius=a<=4?4-a:0},i.prototype.enableLeftResizing=function(e){var t=this.taskBarEditRecord.ganttProperties,i=0;this.taskBarEditElement.classList.contains("e-segmented-taskbar")?this.enableSplitTaskLeftResize(t):(this.mouseDownX>this.mouseMoveX?this.mouseMoveX<t.left+t.width?(i=this.mouseDownX-this.mouseMoveX,t.left>0&&(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)),this.updateEditPosition(e,t),this.parent.setRecordValue("left",this.previousItem.left+this.previousItem.width-t.width,t,!0))},i.prototype.enableSplitTaskLeftResize=function(e){var i=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ai({},e)}),r=i[this.segmentIndex],a=0;if(this.mouseDownX>this.mouseMoveX)if(this.mouseMoveX<e.left+r.width+r.left){if(a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,r.left>0){if(r.left=r.left-a,r.width=r.width+a,0!==this.segmentIndex){var n=i[this.segmentIndex-1];if(e.left+r.left<e.left+n.left+n.width){var s=e.left+n.left+n.width-(e.left+r.left);r.width-=s,r.left=r.left+s}}}else if(r.left<=0&&0===this.segmentIndex){this.parent.setRecordValue("left",e.left-a,e,!0),this.parent.setRecordValue("width",e.width+a,e,!0),r.width=r.width+a;for(var o=1;o<e.segments.length;o++){var l=i[o];l.left=l.left+a}}}else this.mouseMoveX>e.left+r.width+r.left&&(a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,r.left=r.left-a,r.width=this.parent.perDayWidth);else if(this.mouseMoveX<e.left+r.width+r.left-this.parent.perDayWidth)if(a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,0===this.segmentIndex&&r.left<=0){this.parent.setRecordValue("left",e.left+a,e,!0),this.parent.setRecordValue("width",e.width-a,e,!0),r.width=r.width-a;for(o=1;o<e.segments.length;o++){var d=i[o];d.left=d.left-a}}else r.left<r.left+r.width&&r.left+a<=r.left+r.width&&(r.left=r.left+a,r.width=r.width-a);else if(this.mouseMoveX<e.left+r.left+r.width&&r.width>this.parent.perDayWidth){a=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX;if(a-=r.width-a<this.parent.perDayWidth?this.parent.perDayWidth>r.width?this.parent.perDayWidth-r.width:r.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);for(o=1;o<e.segments.length;o++){var h=i[o];h.left=h.left-a}}else r.left=r.left+a,r.width=r.width-a}this.parent.setRecordValue("segments",i,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.updateEditPosition=function(e,t){this.updateIsMilestone(t),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(t.width,t.progress),t,!0)},i.prototype.updateIsMilestone=function(e){e.width<=3?(this.parent.setRecordValue("width",3,e,!0),this.parent.setRecordValue("isMilestone",!0,e,!0)):(this.parent.setRecordValue("width",e.width,e,!0),this.parent.setRecordValue("isMilestone",!1,e,!0))},i.prototype.enableRightResizing=function(e){var i=this.taskBarEditRecord.ganttProperties,r=0;if(this.taskBarEditElement.classList.contains("e-segmented-taskbar")){var a=this.taskBarEditRecord.ganttProperties.segments.map(function(e){return ai({},e)}),n=a[this.segmentIndex];this.mouseDownX>this.mouseMoveX?this.mouseMoveX>i.left+n.left&&this.mouseDownX-this.mouseMoveX>3?(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseDownX-this.mouseMoveX:this.previousMouseMove-this.mouseMoveX,this.previousMouseMove=this.mouseMoveX,n.width=n.width-r):this.mouseMoveX<i.left+n.left&&(n.width=this.parent.perDayWidth):this.mouseMoveX>n.left&&(r=t.isNullOrUndefined(this.previousMouseMove)?this.mouseMoveX-this.mouseDownX:this.mouseMoveX-this.previousMouseMove,this.previousMouseMove=this.mouseMoveX,n.width=n.width+r);var s=void 0,o=this.segmentIndex!==a.length-1?a[this.segmentIndex+1]:null;t.isNullOrUndefined(o)||(this.taskBarEditElement.classList.contains("e-segment-last")||(s=n.left+n.width>o.left?o.left-n.left:n.width),n.width=s),this.segmentIndex===i.segments.length-1&&0===this.segmentIndex&&this.parent.setRecordValue("width",n.width,i,!0),this.parent.setRecordValue("segments",a,i,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")}else this.mouseDownX>this.mouseMoveX?this.mouseMoveX>i.left&&this.mouseDownX-this.mouseMoveX>3?(r=this.mouseDownX-this.mouseMoveX,this.parent.setRecordValue("width",this.previousItem.width-r,i,!0)):this.mouseMoveX<i.left&&this.parent.setRecordValue("width",3,i,!0):this.mouseMoveX>i.left&&(r=this.mouseMoveX-this.mouseDownX,this.parent.setRecordValue("width",this.previousItem.width+r,i,!0)),this.updateEditPosition(e,i)},i.prototype.updateEditedItem=function(){var e,i,r,a,n=this.taskBarEditRecord.ganttProperties;switch(this.taskBarEditAction){case"ProgressResizing":this.parent.setRecordValue("progress",this.getProgressPercent(n.width,n.progressWidth),n,!0);break;case"LeftResizing":-1===this.segmentIndex?(e=this.getRoundOffStartLeft(n,this.roundOffDuration),i=this.getDateByLeft(e),t.isNullOrUndefined(n.endDate)&&(r=this.parent.dateValidationModule.getValidEndDate(n),this.parent.setRecordValue("endDate",r,n,!0)),a=this.parent.dateValidationModule.checkStartDate(i,n,null),this.parent.setRecordValue("startDate",new Date(a.getTime()),n,!0),0===this.parent.dateValidationModule.compareDates(n.startDate,n.endDate)&&t.isNullOrUndefined(n.isMilestone)&&!1===n.isMilestone&&0===n.duration&&this.parent.setRecordValue("duration",1,n,!0),n.isMilestone&&this.parent.setRecordValue("endDate",new Date(a.getTime()),n,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")):this.updateSplitLeftResize(n);break;case"RightResizing":case"ParentResizing":if(-1===this.segmentIndex){e=this.getRoundOffEndLeft(n,this.roundOffDuration);var s=this.getDateByLeft(e);t.isNullOrUndefined(n.startDate)&&(a=this.parent.dateValidationModule.getValidStartDate(n),this.parent.setRecordValue("startDate",a,n,!0));var o=t.isNullOrUndefined(n.startDate)?a:n.startDate;r=n.isMilestone?o:this.parent.dateValidationModule.checkEndDate(s,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",new Date(r.getTime()),n,!0),this.parent.dateValidationModule.calculateDuration(this.taskBarEditRecord),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration")}else this.updateSplitRightResizing(n);break;case"ParentDrag":case"ChildDrag":case"MilestoneDrag":case"ManualParentDrag":-1===this.segmentIndex||0===this.segmentIndex?this.updateChildDrag(n):this.setSplitTaskDrag(n)}},i.prototype.updateChildDrag=function(e){var i,r=this.getRoundOffStartLeft(e,this.roundOffDuration),a=this.getDateByLeft(r,e.isMilestone,e);0===this.segmentIndex?(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(a,e,null),e,!0),e.segments[0].startDate=a,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)):!t.isNullOrUndefined(e.endDate)&&t.isNullOrUndefined(e.startDate)?(i=this.parent.dateValidationModule.checkStartDate(a,e,null),i=this.parent.dateValidationModule.checkEndDate(i,this.taskBarEditRecord.ganttProperties),this.parent.setRecordValue("endDate",i,e,!0)):(this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(a,e,null),e,!0),t.isNullOrUndefined(e.duration)||this.parent.dateValidationModule.calculateEndDate(this.taskBarEditRecord))},i.prototype.updateSplitLeftResize=function(e){var i=e.segments[this.segmentIndex],r=0===this.segmentIndex?this.getRoundOffStartLeft(e,this.roundOffDuration):this.getRoundOffStartLeft(i,this.roundOffDuration),a=0===this.segmentIndex?this.getDateByLeft(r):this.getDateByLeft(e.left+r),n=this.parent.dataOperation.checkStartDate(a,e,!1),s=this.parent.dataOperation.getDuration(n,i.endDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);if(i.startDate=new Date(n.getTime()),i.duration=s,this.parent.setRecordValue("duration",this.sumOfDuration(e.segments),e,!0),0===this.segmentIndex&&this.parent.setRecordValue("startDate",i.startDate,e,!0),this.parent.editModule.updateResourceRelatedFields(this.taskBarEditRecord,"duration"),!t.isNullOrUndefined(e.segments[this.segmentIndex-1])){var o=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex-1].endDate,e.segments[this.segmentIndex].startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);i.offsetDuration=o}this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.updateSplitRightResizing=function(e){var i=e.segments[this.segmentIndex],r=this.getRoundOffEndLeft(e,this.roundOffDuration),a=this.getDateByLeft(r),n=this.parent.dataOperation.checkEndDate(a,e,!1),s=this.parent.dataOperation.getDuration(i.startDate,n,e.durationUnit,e.isAutoSchedule,e.isMilestone);if(i.endDate=new Date(n.getTime()),i.duration=s,!t.isNullOrUndefined(e.segments[this.segmentIndex+1])){var o=e.segments[this.segmentIndex+1],l=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,o.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);i.offsetDuration=l}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")},i.prototype.sumOfDuration=function(e){for(var t=0,i=0;i<e.length;i++){t+=e[i].duration}return t},i.prototype.setSplitTaskDrag=function(e){var i=e.segments[this.segmentIndex],r=this.getRoundOffStartLeft(i,this.roundOffDuration),a=this.getDateByLeft(e.left+r);if(a=this.parent.dateValidationModule.checkStartDate(a,e,null),i.startDate=a,i.endDate=this.parent.dataOperation.getEndDate(i.startDate,i.duration,e.durationUnit,e,!1),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),t.isNullOrUndefined(this.parent.taskFields.endDate)||this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"endDate"),!t.isNullOrUndefined(e.segments[this.segmentIndex-1])){var n=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!==n||this.parent.includeWeekend||(n=1),i.offsetDuration=n}if(!t.isNullOrUndefined(e.segments[this.segmentIndex+1])){var s=e.segments[this.segmentIndex+1];n=this.parent.dataOperation.getDuration(e.segments[this.segmentIndex].endDate,s.startDate,e.durationUnit,e.isAutoSchedule,e.isMilestone);1!==s.startDate.getDay()||0!==n||this.parent.includeWeekend||(n=1),s.offsetDuration=n}this.parent.setRecordValue("segments",e.segments,e,!0),this.parent.dataOperation.updateMappingData(this.taskBarEditRecord,"segments")},i.prototype.getRoundOffEndLeft=function(e,t){var i="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,r=e.width+e.left;if(-1!==this.segmentIndex){var a=e.segments[this.segmentIndex];r=r-e.width+a.width+a.left}var n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Day")/864e5),s=this.parent.perDayWidth-this.parent.perDayWidth/n,o=s/this.parent.perDayWidth;if(void 0===t&&(t=!1),t){if(t)if("Hour"===i){var l=this.parent.perDayWidth/24;n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Hour")/36e5),0!==(s=this.parent.perDayWidth/24-this.parent.perDayWidth/24/n)&&(r=r-s+l)}else if("Minutes"===i){var d=this.parent.perDayWidth/1440;n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Minutes")/6e4),0!==(s=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/n)&&(r=r-s+d)}else 0!==s&&(r=r-s+this.parent.perDayWidth)}else"Hour"!==i&&"Minutes"!==i&&(o>.5?r=r-s+this.parent.perDayWidth:o<.5&&(r=r-s+this.parent.perDayWidth/2));return r},i.prototype.getRoundOffStartLeft=function(e,i){var r=(t.isNullOrUndefined(e),e.left),a="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.bottomTier:this.parent.timelineModule.topTier,n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r,t.isNullOrUndefined(e)?e.isMilestone:null,e),1,"Day")/864e5),s=this.parent.perDayWidth-this.parent.perDayWidth/n,o=s/this.parent.perDayWidth;return void 0===i&&(i=!1),i?i&&("Hour"===a?(n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Hour")/36e5),r-=s=this.parent.perDayWidth/24-this.parent.perDayWidth/24/n):"Minutes"===a?(n=1/(this.parent.timelineModule.getIncrement(this.getDateByLeft(r),1,"Minutes")/6e4),r-=s=this.parent.perDayWidth/1440-this.parent.perDayWidth/1440/n):r-=s):"Hour"!==a&&"Minutes"!==a&&(o<=.5?r-=s:o>.5&&(r=r-s+this.parent.perDayWidth/2)),r},i.prototype.getDateByLeft=function(e,i,r){var a=new Date(this.parent.timelineModule.timelineStartDate.toString()),n=864e5/this.parent.perDayWidth;a.setTime(a.getTime()+e*n),i&&!t.isNullOrUndefined(r.predecessor)&&r.predecessor.length>0&&(a.setDate(a.getDate()-1),this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,a),a=this.parent.dateValidationModule.checkStartDate(a,r,!0));var s="None"!==this.parent.timelineModule.bottomTier?this.parent.timelineModule.topTier:this.parent.timelineModule.bottomTier;return"Hour"!==s&&"Minutes"!==s&&(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},i.prototype.setItemPosition=function(){if(!t.isNullOrUndefined(this.editElement)){var e=this.editElement.parentElement;"ResourceView"==this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&"ChildDrag"===this.taskBarEditAction?e.style.position=null:e.style.setProperty("position","absolute")}var i=this.taskBarEditRecord.ganttProperties,r=this.parent.enableRtl?"right":"left",a=t.isNullOrUndefined(i.segments)?null:i.segments[this.segmentIndex],n="MilestoneDrag"===this.taskBarEditAction||i.isMilestone?this.parent.chartRowsModule.milestoneHeight:i.width,s=this.parent.isAdaptive?n-2:n-10;t.isNullOrUndefined(a)||(s=this.parent.isAdaptive?a.width-2:a.width-10),this.taskBarEditElement.style.setProperty("opacity",".75");var o=this.taskBarEditElement.classList.contains(H)?this.taskBarEditElement:"ChildDrag"!==this.taskBarEditAction&&"LeftResizing"!==this.taskBarEditAction||0!==this.segmentIndex?t.closest(this.taskBarEditElement,"tr."+Q).querySelector("."+H):this.taskBarEditElement.parentElement,l=this.taskBarEditElement.classList.contains("e-segmented-taskbar"),d=this.taskBarEditElement.querySelector("."+ne),h=this.taskBarEditElement.querySelector("."+ae),p=this.taskBarEditElement.querySelector("."+$),c=this.taskBarEditElement.querySelector("."+J),u=this.taskBarEditElement.querySelector("."+pe),g=this.taskBarEditElement.querySelector("."+ce),f=this.taskBarEditElement.querySelector("."+Ie),m=this.taskBarEditElement,y=this.taskBarEditElement.querySelector("."+oe),D=this.taskBarEditElement.querySelector("."+he),v=this.taskBarEditElement.querySelector(".e-gantt-manualparenttaskbar-left"),w=this.parent.ganttChartModule.chartBodyContainer.querySelector(".e-taskbar-resize-div");if("ConnectorPointRightDrag"!==this.taskBarEditAction&&"ConnectorPointLeftDrag"!==this.taskBarEditAction){if("ParentResizing"!==this.taskBarEditAction&&"ManualParentDrag"!==this.taskBarEditAction){if(!l||t.isNullOrUndefined(i.segments)||"RightResizing"!==this.taskBarEditAction&&0===this.segmentIndex||(t.isNullOrUndefined(w)||(w.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",t.isNullOrUndefined(w)||(w.style.left=a.left+this.editElement.parentElement.offsetLeft+"px"))),o.style.setProperty(r,i.left+"px"),o.style.width=n+"px","ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&("ChildDrag"===this.taskBarEditAction||"MilestoneDrag"===this.taskBarEditAction)&&(o.style.setProperty("top",this.topValue+"px"),o.style.zIndex="4"),"LeftResizing"===this.taskBarEditAction&&0===this.segmentIndex){this.taskBarEditElement.style.setProperty("opacity",".75");for(var k=this.taskBarEditElement.parentElement.getElementsByClassName("e-segmented-taskbar"),T=0;T<i.segments.length;T++){var b=i.segments[T],P=k[T];P.style.width=b.width+"px",0===T&&(w.style.width=b.width+"px",w.style.left=b.left+i.left+"px"),this.parent.enableRtl?P.style.right=b.left+"px":P.style.left=b.left+"px"}}"ChildDrag"===this.taskBarEditAction&&0===this.segmentIndex&&(w.style.width=n+"px",w.style.left=i.left+"px",o.style.setProperty("opacity",".75"))}if(f&&(this.parent.enableRtl?f.style.left=(this.parent.isAdaptive?n+10:n-2)+"px":f.style.left=(this.parent.isAdaptive?n+10:n+2)+"px"),"MilestoneDrag"===this.taskBarEditAction||i.isMilestone)o.style.setProperty(r,i.left-n/2+"px"),w.style.left=i.left-n/2+"px",w.style.width=n+"px";else if("ProgressResizing"===this.taskBarEditAction)if(-1===this.segmentIndex){if(h.style.setProperty(r,i.left+i.progressWidth-10+"px"),!t.isNullOrUndefined(d)){d.style.width=i.progressWidth+"px",d.style.borderBottomRightRadius=this.progressBorderRadius+"px",d.style.borderTopRightRadius=this.progressBorderRadius+"px";var S=this.parent.enableRtl?i.progressWidth+8:i.progressWidth-8;p.style.setProperty(r,S+"px")}}else{this.updateSegmentProgress(this.taskBarEditRecord.ganttProperties),d.style.width=i.segments[this.segmentIndex].progressWidth+"px",d.style.borderBottomRightRadius=this.progressBorderRadius+"px",d.style.borderTopRightRadius=this.progressBorderRadius+"px";var C=this.parent.enableRtl?i.segments[this.segmentIndex].progressWidth+8:i.segments[this.segmentIndex].progressWidth-8;p.style.setProperty(r,C+"px")}else"RightResizing"!==this.taskBarEditAction||t.isNullOrUndefined(h)?"ParentDrag"===this.taskBarEditAction?(w.style.left=i.left+"px",w.style.width=n+"px",w.style.width=i.width+"px",t.isNullOrUndefined(u)||(u.style.width=n+"px",w.style.width=i.width+"px"),t.isNullOrUndefined(d)||(g.style.width=i.progressWidth+"px")):"ParentResizing"===this.taskBarEditAction?(w.style.width=i.width+"px",w.style.left=i.left+"px",m.style.width=y.style.width=i.width+"px",D.style.setProperty(r,i.width-v.offsetLeft+"px")):"ManualParentDrag"===this.taskBarEditAction?(w.style.width=i.width+"px",w.style.left=i.left+"px",m.style.setProperty(r,i.left-i.autoLeft+"px")):(t.isNullOrUndefined(h)||l||(h.style.width=i.width+"px",h.style.left=i.left+"px",this.taskBarEditElement.style.width=i.width+"px",this.taskBarEditElement.style.left=i.left+"px",w.style.left=i.left+"px",w.style.width=i.width+"px"),t.isNullOrUndefined(d)||(c.style.setProperty(r,s+"px"),d.style.width=i.progressWidth+"px",t.isNullOrUndefined(p)||p.style.setProperty(r,i.progressWidth-10+"px")),l&&(c.style.setProperty(r,s+"px"),d.style.width=a.progressWidth+"px",t.isNullOrUndefined(p)||p.style.setProperty(r,a.progressWidth-10+"px"))):(w.style.width=n+"px",h.style.width=n+"px",t.isNullOrUndefined(d)||(d.style.width=i.progressWidth+"px",c.style.setProperty(r,s+"px"),t.isNullOrUndefined(p)||p.style.setProperty(r,i.progressWidth-10+"px")))}},i.prototype.mouseUpHandler=function(e){var i=this.isMouseDragged;if(this.previousMouseMove=null,this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),this.taskBarEditAction&&this.isMouseDragged)if(!this.dragMouseLeave&&this.taskBarEditedAction||"ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop)this.taskBarEditedAction(e),this.isMouseDragged=!1;else if(this.parent.isOnEdit=!1,this.cancelTaskbarEditActionInMouseLeave(),this.parent.enableCriticalPath&&this.parent.criticalPathModule){var r=this.parent.criticalPathModule;r.criticalConnectorLine(r.criticalPathCollection,r.detailPredecessorCollection,!0,r.predecessorCollectionTaskIds)}"ResourceView"===this.parent.viewType&&this.parent.enableMultiTaskbar&&!t.isNullOrUndefined(this.taskBarEditElement)&&(t.isNullOrUndefined(this.taskBarEditElement.querySelector(".e-gantt-child-taskbar"))||this.taskBarEditElement.querySelector(".e-gantt-child-taskbar").classList.contains("e-collapsed-taskbar-drag")&&(t.removeClass([this.taskBarEditElement.querySelector(".e-gantt-child-taskbar")],"e-collapsed-taskbar-drag"),this.taskBarEditElement.style.zIndex=this.prevZIndex,this.prevZIndex="")),this.parent.isAdaptive&&!i||this.initPublicProp(),this.stopScrollTimer()},i.prototype.taskBarEditedAction=function(e){var t={},i=this.mouseDownX,r=this.mouseDownY,a=this.taskBarEditRecord,n=this.parent.ganttChartModule.getIndexByTaskBar(this.taskBarEditElement),s=this.mouseMoveX,o=this.getCoordinate(e).pageY-this.parent.ganttChartModule.chartBodyContainer.offsetTop;"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)?(this.parent.connectorLineEditModule.updatePredecessor(this.connectorSecondRecord,this.finalPredecessor),this.parent.UpdateOffsetOnTaskbarEdit&&this.parent.connectorLineEditModule.calculateOffset(this.connectorSecondRecord)):(i!==s||Math.abs(r-o)>=(this.parent.rowHeight-this.parent.taskbarHeight)/2)&&null!==a&&(t.editingFields=a.ganttProperties,t.data=a,t.recordIndex=n,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},i.prototype.cancelTaskbarEditActionInMouseLeave=function(){this.parent.editModule.reUpdatePreviousRecords(!0)},i.prototype.updateSegmentProgress=function(e){for(var t=e.segments,i=!0,r=this.splitTasksDuration(t)*this.parent.perDayWidth,a=this.parent.dataOperation.getProgressWidth(r,e.progress),n=0;n<t.length;n++){var s=t[n];delete s.progressWidth,a>0&&a>s.width?(a-=s.width,s.progressWidth=s.width,s.showProgress=!1):i&&(s.progressWidth=a,s.showProgress=!0,a-=s.width,i=!1)}},i.prototype.taskbarEdited=function(e){var i=t.extend({},e),r=i.data,a=r.ganttProperties,n=this.parent.currentViewData.indexOf(r);if(("MilestoneDrag"===i.taskBarEditAction||"ChildDrag"===i.taskBarEditAction)&&"ResourceView"===this.parent.viewType&&this.parent.allowTaskbarDragAndDrop&&this.dragMoveY>0){if(this.parent.rowDragAndDropModule){var s=this.parent.currentViewData;s[this.taskBarEditRecord.parentItem.index]&&-1===this.parent.editedRecords.indexOf(s[this.taskBarEditRecord.parentItem.index])&&this.parent.editedRecords.push(s[this.taskBarEditRecord.parentItem.index]);for(var o,l=0,d=0,h=void 0,p=this.parent.treeGrid.getRows().length,c=0;c<p;c++)l<this.dragMoveY&&"none"!==this.parent.getRowByIndex(c).style.display&&(d=c,l+=parseInt(this.parent.getRowByIndex(c).style.height),s[c].parentItem?this.parent.getRecordByID(s[c].parentItem.taskId):s[c]);for(var u=this.parent.getRowByIndex(n).getElementsByClassName("e-taskbar-main-container"),g=this.parent.getRowByIndex(d).getElementsByClassName("e-taskbar-main-container"),f=0;f<g.length;f++)g[f].offsetTop<this.dragMoveY&&u[0].getAttribute("rowuniqueid")!==g[f].getAttribute("rowuniqueid")&&(this.draggedRecordMarginTop=g[f].style.marginTop,o=g[f].getAttribute("rowuniqueid"));if(o&&(h=this.parent.currentViewData.filter(function(e){return e.rowUniqueID===o?e:null})),h){var m=this.parent.currentViewData.indexOf(h[0]),y=h[0].hasChildRecords||!h[0].parentItem&&0==h[0].childRecords.length?"child":"below";this.parent.rowDragAndDropModule&&this.parent.rowDragAndDropModule.reorderRows([n],m,y),this.dragMoveY=0}}"ResourceView"===this.parent.viewType&&this.parent.showOverAllocation&&this.parent.ganttChartModule.renderOverAllocationContainer()}if("ProgressResizing"===i.taskBarEditAction)i.previousData.progress!==a.progress&&(this.parent.setRecordValue("progress",this.getProgressPercent(a.width,a.progressWidth),a,!0),r.parentItem&&this.parent.editModule.updateParentProgress(r.parentItem),t.isNullOrUndefined(a.segments)||this.updateSegmentProgress(a));else{var D=i.data.ganttProperties.segments;if(!t.isNullOrUndefined(D)&&D.length>0&&("LeftResizing"===this.taskBarEditAction&&0!==this.segmentIndex||"ChildDrag"===this.taskBarEditAction&&0!==this.segmentIndex||"RightResizing"===this.taskBarEditAction)){var v=D[this.segmentIndex],w=this.taskBarEditRecord.ganttProperties,k=0===this.segmentIndex?null:D[this.segmentIndex-1],T=this.segmentIndex===D.length-1?null:D[this.segmentIndex+1],b=t.isNullOrUndefined(T)?this.parent.cloneProjectEndDate:new Date(T.startDate.getTime()),P=t.isNullOrUndefined(k)?this.parent.cloneProjectStartDate:new Date(k.endDate.getTime()),S=new Date(v.startDate.getTime()),C=new Date(v.endDate.getTime());if("Day"===this.parent.timelineModule.topTier&&"Hour"===this.parent.timelineModule.bottomTier?(S.setHours(S.getHours()-1),C.setHours(C.getHours()+1)):(b.setHours(0,0,0,0),P.setHours(0,0,0,0),S.setDate(S.getDate()-1),C.setDate(C.getDate()+1),S.setHours(0,0,0,0),C.setHours(0,0,0,0)),S.getTime()<=P.getTime()&&!t.isNullOrUndefined(k)&&!t.isNullOrUndefined(v)){var M=[{firstSegmentIndex:k.segmentIndex,secondSegmentIndex:v.segmentIndex}];this.parent.chartRowsModule.mergeTask(w.taskId,M)}else if(C.getTime()>=b.getTime()&&this.segmentIndex!==D.length-1){M=[{firstSegmentIndex:v.segmentIndex,secondSegmentIndex:T.segmentIndex}];this.parent.chartRowsModule.mergeTask(w.taskId,M)}else if(C.getTime()>=b.getTime()){v.endDate.setDate(this.parent.cloneProjectEndDate.getDate()-1),v.startDate=this.parent.dataOperation.getStartDate(v.endDate,v.duration,w.durationUnit,w);for(c=D.length-2;c>=0;c++){var R=D[c],O=R.endDate;O.setDate(O.getDate()-R.offsetDuration),R.endDate=O,R.startDate=this.parent.dataOperation.getStartDate(R.endDate,R.duration,w.durationUnit,w)}}}this.parent.dataOperation.updateWidthLeft(i.data)}this.parent.dataOperation.updateTaskData(r),this.parent.editModule.initiateUpdateAction(i)},i.prototype.getProgressPercent=function(e,t){return Math.ceil(t/e*100)},i.prototype.drawFalseLine=function(){var e,i=this.mouseDownX,r=this.mouseDownY,a=this.mouseMoveX,n=this.mouseMoveY,s=Math.sqrt((i-a)*(i-a)+(r-n)*(r-n)),o=180*Math.atan2(n-r,a-i)/Math.PI,l="rotate("+(this.parent.enableRtl?-o:o)+"deg)",d=0;t.isNullOrUndefined(document.querySelectorAll(".e-chart-row")[0])||(d=document.querySelectorAll(".e-chart-row")[0].offsetWidth),"ConnectorPointLeftDrag"===this.taskBarEditAction&&(e=this.parent.enableRtl?d-(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?d-(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));var h=this.elementOffsetTop+this.elementOffsetHeight/2+this.parent.ganttChartModule.chartBodyContainer.offsetTop-this.parent.ganttChartModule.scrollObject.previousScroll.top;this.removeFalseLine(!1),this.falseLine=t.createElement("div",{className:"e-gantt-false-line",id:"ganttfalseline"+this.parent.element.id,styles:"position: absolute;transform:"+l+";border-top-width: 1px;border-top-style: dashed;z-index: 5;width:"+(s-3)+"px;top:"+h+"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)},i.prototype.removeFalseLine=function(e){this.falseLine&&(t.remove(this.falseLine),this.falseLine=null,e&&(this.elementOffsetLeft=0,this.elementOffsetTop=0,this.elementOffsetWidth=0,this.elementOffsetHeight=0,t.removeClass(this.parent.ganttChartModule.scrollElement.querySelectorAll("."+ke),[Ce])))},i.prototype.updateConnectorLineSecondProperties=function(e){var i=this.getElementByPosition(e),r=f(i,H);this.connectorSecondAction=null;var a=0;if(f(i,Me)?(this.connectorSecondAction="ConnectorPointLeftDrag",this.toPredecessorText="Start"):f(i,Re)?(this.connectorSecondAction="ConnectorPointRightDrag",this.toPredecessorText="Finish"):(this.connectorSecondAction=null,this.toPredecessorText=null),this.taskBarEditElement!==r&&this.taskBarEditElement!==this.highlightedSecondElement){if(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,this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3-5+this.taskBarEditElement.children[0].offsetTop+a):(this.elementOffsetLeft=this.realTaskbarElement.offsetLeft,this.elementOffsetTop=this.realTaskbarElement.parentElement.offsetTop+this.realTaskbarElement.offsetHeight/3+a),this.elementOffsetWidth=this.realTaskbarElement.offsetWidth,this.elementOffsetHeight=this.realTaskbarElement.offsetHeight),this.showHideTaskBarEditingElements(r,this.highlightedSecondElement,!0)}t.isNullOrUndefined(this.connectorSecondAction)&&!t.isNullOrUndefined(this.connectorSecondElement)&&(!this.connectorSecondRecord.hasChildRecords||this.connectorSecondRecord.hasChildRecords&&this.parent.allowParentDependency)&&(this.editTooltip.showHideTaskbarEditTooltip(!1,this.segmentIndex),t.removeClass([this.connectorSecondElement.querySelector("."+Me)],[Ee]),t.removeClass([this.connectorSecondElement.querySelector("."+Re)],[Ee])),this.connectorSecondElement=this.connectorSecondAction?r:null,this.highlightedSecondElement=r,this.connectorSecondRecord=t.isNullOrUndefined(this.connectorSecondElement)?null:this.parent.ganttChartModule.getRecordByTaskBar(this.connectorSecondElement)},i.prototype.triggerDependencyEvent=function(e,i){var r,a,n=this.taskBarEditRecord.ganttProperties,s=this.connectorSecondRecord?this.connectorSecondRecord.ganttProperties:null,o=this.getElementByPosition(e),l=o,d="ResourceView"===this.parent.viewType?n.taskId:n.rowUniqueID;if("ConnectorPointLeftDrag"===this.taskBarEditAction?r=d+(this.parent.enableRtl?"F":"S"):"ConnectorPointRightDrag"===this.taskBarEditAction&&(r=d+(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")),t.isNullOrUndefined(s))this.drawPredecessor=!1;else{s.predecessorsName?this.finalPredecessor=s.predecessorsName+","+r:this.finalPredecessor=r;var h=this.parent.connectorLineEditModule.validatePredecessorRelation(this.connectorSecondRecord,this.finalPredecessor),p=this.parent.predecessorModule.calculatePredecessor(r,this.connectorSecondRecord),c={};if(c.fromItem=n,c.toItem=s,c.newPredecessorString=this.finalPredecessor,c.predecessor=p&&p[0],c.isValidLink=h,c.requestType="ValidateDependency",this.parent.trigger("actionBegin",c),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType||"ValidateDependency"==c.requestType?"ValidateDependency"!=c.requestType&&this.parent.showSpinner():this.parent.showMaskRow(),c.isValidLink=!(!h&&c.isValidLink)&&c.isValidLink,c.isValidLink){if(this.editTooltip.toolTipObj||this.parent.isAdaptive||this.editTooltip.showHideTaskbarEditTooltip(!0,this.segmentIndex),this.editTooltip.toolTipObj){this.parent.connectorLineModule.tooltipTable.innerHTML=this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,this.parent.editModule.taskbarEditModule.fromPredecessorText,"","");var u=this.parent.connectorLineModule.tooltipTable.querySelector("#toPredecessor").querySelectorAll("td");u[1].innerText=s.taskName,u[2].innerText=this.parent.localeObj.getConstant(a);var g=this.parent.connectorLineModule.tooltipTable.parentElement.parentElement;g.offsetTop+g.offsetHeight>e.pageY&&(g.style.top=e.pageY-g.offsetHeight-20+"px")}this.drawPredecessor=!0}else this.parent.isAdaptive?(o.classList.contains(Me)||o.classList.contains(Re))&&this.showHideActivePredecessors(!0):t.addClass([l],[Ee]),this.drawPredecessor=!1}},i.prototype.getCoordinate=function(e){var t={};if(this.parent.isAdaptive&&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)}else if(e){var i=e;t.pageX=i.pageX,t.pageY=i.pageY}return t},i.prototype.getElementByPosition=function(e){if(this.parent.isAdaptive){var t=this.getCoordinate(e);return document.elementFromPoint(t.pageX-window.pageXOffset,t.pageY-window.pageYOffset)}return e.target},i.prototype.multipleSelectionEnabled=function(){this.parent.selectionModule&&"Cell"!==this.parent.selectionSettings.mode&&"Multiple"===this.parent.selectionSettings.type&&this.parent.selectionModule.hidePopUp()},i.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))},i.prototype.destroy=function(){this.unWireEvents(),this.stopScrollTimer(),this.parent.editModule.taskbarEditModule=void 0},i}(R),si=function(){function e(e){this.updatedEditFields=null,this.updatedAddFields=null,this.addedRecord=null,this.dialogEditValidationFlag=!1,this.ganttResources=[],this.isValidData=!0,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:p.CheckBox,dropdownedit:u.DropDownList,datepickeredit:c.DatePicker,datetimepickeredit:c.DateTimePicker,maskededit:h.MaskedTextBox,numericedit:h.NumericTextBox,stringedit:h.TextBox,defaultedit:h.TextBox},this.processDialogFields(),this.wireEvents()}return e.prototype.wireEvents=function(){this.parent.on("chartDblClick",this.dblClickHandler,this)},e.prototype.dblClickHandler=function(e){var i=this.parent.ganttChartModule.getRecordByTarget(e);!t.isNullOrUndefined(i)&&this.parent.editModule&&this.parent.editSettings.allowEditing&&this.openEditDialog(i)},e.prototype.processDialogFields=function(){t.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),t.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)},e.prototype.validateDialogFields=function(e){for(var i=[],a=0,n=0;n<e.length;n++){var s=r.getActualProperties(e[n]);"General"!==s.type||!t.isNullOrUndefined(s.fields)&&0!==s.fields.length||(s.fields=this.getGeneralColumnFields()),"Dependency"===s.type&&t.isNullOrUndefined(this.parent.taskFields.dependency)||"Resources"===s.type&&t.isNullOrUndefined(this.parent.taskFields.resourceInfo)||"Notes"===s.type&&t.isNullOrUndefined(this.parent.taskFields.notes)||("Custom"!==s.type||!t.isNullOrUndefined(s.fields)&&0!==s.fields.length||(a+=1,s.fields=this.getCustomColumnFields()),a>1||i.push(s))}return i},e.prototype.getGeneralColumnFields=function(){for(var e=[],t=0,i=Object.keys(this.parent.columnMapping);t<i.length;t++){var r=i[t];"dependency"!==r&&"resourceInfo"!==r&&"notes"!==r&&e.push(this.parent.columnMapping[r])}return e},e.prototype.getCustomColumnFields=function(){for(var e=[],t=0;t<this.parent.customColumns.length;t++)e.push(this.parent.customColumns[t]);return e},e.prototype.getDefaultDialogFields=function(){var e=[],i={},r=this.parent.taskFields,a=this.parent.columnMapping;return 0!==Object.keys(a).length&&(i.type="General",e.push(i)),t.isNullOrUndefined(t.getValue("dependency",a))||(i={},!1!==this.parent.columnByField[a.dependency.valueOf()].visible&&(i.type="Dependency"),e.push(i)),t.isNullOrUndefined(t.getValue("resourceInfo",a))||(i={},!1!==this.parent.columnByField[a.resourceInfo.valueOf()].visible&&(i.type="Resources"),e.push(i)),t.isNullOrUndefined(t.getValue("notes",a))||(i={},!1!==this.parent.columnByField[a.notes.valueOf()].visible&&(i.type="Notes"),e.push(i)),t.isNullOrUndefined(t.getValue("segments",r))||((i={}).type="Segments",e.push(i)),this.parent.customColumns.length>0&&((i={}).type="Custom",e.push(i)),e},e.prototype.openAddDialog=function(){this.isEdit=!1,this.editedRecord=this.composeAddRecord(),this.createDialog()},e.prototype.getMinimumStartDate=function(){var e=a.DataUtil.aggregates.min(this.parent.flatData,"ganttProperties.startDate");return e=t.isNullOrUndefined(e)?new Date(this.parent.timelineModule.timelineStartDate.getTime()):new Date(e.getTime()),e=this.parent.dateValidationModule.checkStartDate(e),new Date(e.getTime())},e.prototype.composeAddRecord=function(){var e={};e.ganttProperties={};for(var i=this.parent.ganttColumns,r=this.parent.taskFields,a=this.parent.editModule.getNewTaskId(),n=0;n<i.length;n++){var s=i[n].field;s===r.id?(e[s]=a,e.ganttProperties.rowUniqueID=e[s]):i[n].field===r.startDate?(t.isNullOrUndefined(e[r.endDate])?e[s]=this.getMinimumStartDate():e[s]=new Date(e[r.endDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone)),e.ganttProperties.startDate=new Date(e[s])):i[n].field===r.endDate?(t.isNullOrUndefined(e[r.startDate])?e[s]=this.getMinimumStartDate():e[s]=new Date(e[r.startDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone)),e.ganttProperties.endDate=new Date(e[s])):i[n].field===r.duration?(e[s]=1,e.ganttProperties.duration=e[s],e.ganttProperties.durationUnit=this.parent.durationUnit.toLocaleLowerCase()):i[n].field===r.name?(e[s]=this.localeObj.getConstant("addDialogTitle")+" "+a,e.ganttProperties.taskName=e[s]):i[n].field===r.progress?(e[s]=0,e.ganttProperties.progress=e[s]):i[n].field===r.work?(e[s]=0,e.ganttProperties.work=e[s]):i[n].field===r.type?(e[s]=this.parent.taskType,e.ganttProperties.taskType=e[s]):e[this.parent.ganttColumns[n].field]=""}return e.ganttProperties.isAutoSchedule="Auto"===this.parent.taskMode||"Manual"!==this.parent.taskMode&&!0!==e[r.manual],e},e.prototype.openToolbarEditDialog=function(){var e=this.parent;if(e.editModule&&e.editSettings.allowEditing){this.parent.ganttChartModule.focusedRowIndex>-1&&e.selectionModule&&e.selectionModule.selectRow(this.parent.ganttChartModule.focusedRowIndex,!1,!1);var i=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;t.isNullOrUndefined(i)||this.openEditDialog(i)}},e.prototype.openEditDialog=function(e){var i=this.parent;t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.ganttProperties)||("string"==typeof e.ganttProperties.taskId?this.numericOrString="stringedit":this.numericOrString="numericedit"),t.isNullOrUndefined(e.ganttProperties)&&!t.isNullOrUndefined(e)&&(isNaN(Number(e))||"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?this.numericOrString="stringedit":this.numericOrString="numericedit")),"object"!=typeof e||t.isNullOrUndefined(e)?t.isNullOrUndefined(e)?i.selectedRowIndex>-1&&(this.rowData=i.currentViewData[i.selectedRowIndex],this.rowIndex=i.selectedRowIndex):(this.rowIndex=i.ids.indexOf(e.toString()),this.rowIndex>-1&&(this.rowData=i.flatData[this.rowIndex])):(this.rowIndex=this.parent.currentViewData.indexOf(e),this.rowIndex>-1&&(this.rowData=e)),this.isEdit=!0,"ResourceView"===this.parent.viewType&&0===this.rowData.level||0!==Object.keys(this.rowData).length&&(this.editedRecord=t.extend({},{},this.rowData,!0),this.createDialog())},e.prototype.createDialog=function(){var e=this,i=this.parent,r={};this.beforeOpenArgs.dialogModel=r,this.beforeOpenArgs.rowData=this.editedRecord,this.beforeOpenArgs.rowIndex=this.rowIndex;var a=this.parent.isAdaptive?"":"600px",n=this.parent.createElement("div",{id:i.element.id+"_dialog",styles:"max-width:"+a});n.classList.add("e-gantt-dialog"),i.element.appendChild(n),r.animationSettings={effect:"None"},r.header=this.localeObj.getConstant(this.isEdit?"editDialogTitle":"addDialogTitle"),r.isModal=!0,r.enableRtl=this.parent.enableRtl,r.allowDragging=!this.parent.isAdaptive,r.showCloseIcon=!0;var s=this.parent.isAdaptive?{X:"top",Y:"left"}:{X:"center",Y:"center"};r.position=s,r.height=this.parent.isAdaptive?"100%":"auto",r.target=document.body,r.close=this.dialogClose.bind(this),r.closeOnEscape=!0,r.beforeClose=function(e){"escape"===e.closedBy&&"key-pressed"===e.event.name&&"INPUT"===e.event.target.nodeName&&(e.cancel=!0)},r.open=function(i){var r=t.getValue("element",i),a=r.querySelector("#"+e.parent.element.id+"GeneralTabContainer");a&&a.scrollHeight>a.offsetHeight&&a.classList.add("e-scroll"),0===e.tabObj.selectedItem&&e.tabObj.select(0),e.parent.isAdaptive&&(r.style.maxHeight="none"),e.parent.focusModule&&e.parent.focusModule.setActiveElement(r)},r.locale=this.parent.locale,r.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(r,n)},e.prototype.buttonClick=function(e){var t=e.target;t.style.pointerEvents="none",this.localeObj.getConstant("cancel").toLowerCase()===e.target.innerText.trim().toLowerCase()?this.dialog&&!this.dialogObj.isDestroyed&&(this.dialogObj.hide(),this.dialogClose()):(this.initiateDialogSave(),t.style.pointerEvents="auto")},e.prototype.dialogClose=function(){this.dialog&&this.resetValues(),t.isNullOrUndefined(this.parent.focusModule)||t.isNullOrUndefined(this.parent.focusModule.getActiveElement(!0))||this.parent.focusModule.getActiveElement(!0).focus()},e.prototype.resetValues=function(){this.isEdit=!1,this.isAddNewResource=!1,this.editedRecord={},this.rowData={},this.rowIndex=-1,this.addedRecord=null,this.ganttResources=[],this.dialogEditValidationFlag=!1,this.dialog&&!this.dialogObj.isDestroyed&&(this.destroyDialogInnerElements(),this.dialogObj.destroy(),t.remove(this.dialog))},e.prototype.destroyDialogInnerElements=function(){for(var e=this.parent,i=this.beforeOpenArgs.tabModel.items,r=0;r<i.length;r++){var a=i[r].content,n=a.id;if(!t.isNullOrUndefined(n)||""!==n)if(n=n.replace(e.element.id,""),"General"===(n=n.replace("TabContainer","")))this.destroyCustomField(a);else if("Dependency"===n){a.ej2_instances[0].destroy()}else if("Notes"===n){a.ej2_instances[0].destroy()}else if("Resources"===n){a.ej2_instances[0].destroy()}else-1!==n.indexOf("Custom")&&this.destroyCustomField(a)}},e.prototype.destroyCustomField=function(e){for(var i=e.childNodes,a=this.parent,n=0;n<i.length;n++){var s=i[n],o=s.querySelector('input[id^="'+a.element.id+'"]');if(o){var l=o.id.replace(a.element.id,""),d=s.querySelector("#"+a.element.id+l).ej2_instances[0];if(!t.isNullOrUndefined(d)){var h=a.columnByField[l];if(!t.isNullOrUndefined(h.edit)&&t.isNullOrUndefined(h.edit.params)){var p=h.edit.destroy;"string"==typeof p?(p=r.getObject(p,window))():h.edit.destroy()}else d.destroy()}}}},e.prototype.destroy=function(){this.resetValues(),this.parent.isDestroyed||(this.parent.off("chartDblClick",this.dblClickHandler),this.parent.editModule.dialogModule=void 0)},e.prototype.getEditFields=function(){return this.isEdit?this.updatedEditFields:this.updatedAddFields},e.prototype.createTab=function(e,r){var a,n=this,s=this.parent,o={},d=[],h=this.getEditFields(),p=s.taskFields,c=h.length;o.items=d,o.locale=this.parent.locale,o.enableRtl=this.parent.enableRtl,this.beforeOpenArgs.tabModel=o;var u=0;if(c>0)for(var g=0;g<c;g++){var f=h[g],m={};if("General"===f.type){if(0===Object.keys(s.columnMapping).length)continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("generalTab")),m.content="General",this.beforeOpenArgs[m.content]=this.getFieldsModel(f.fields)}else if("Segments"===f.type){if(t.isNullOrUndefined(p.segments))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("segments")),m.content="Segments",this.beforeOpenArgs[m.content]=this.getSegmentsModel(f.fields)}else if("Dependency"===f.type){if(t.isNullOrUndefined(p.dependency))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("dependency")),m.content="Dependency",this.beforeOpenArgs[m.content]=this.getPredecessorModel(f.fields)}else if("Resources"===f.type){if(t.isNullOrUndefined(p.resourceInfo))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("resourceName")),m.content="Resources",this.beforeOpenArgs[m.content]=this.getResourcesModel(f.fields)}else if("Notes"===f.type){if(t.isNullOrUndefined(p.notes))continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("notes")),m.content="Notes",this.beforeOpenArgs[m.content]=this.getNotesModel(f.fields)}else{if(t.isNullOrUndefined(f.fields)||0===f.fields.length)continue;t.isNullOrUndefined(f.headerText)&&(f.headerText=this.localeObj.getConstant("customTab")),m.content="Custom"+u++,this.beforeOpenArgs[m.content]=this.getFieldsModel(f.fields)}m.header={text:f.headerText},d.push(m)}this.beforeOpenArgs.requestType=this.isEdit?"beforeOpenEditDialog":"beforeOpenAddDialog";this.beforeOpenArgs.rowData,this.beforeOpenArgs.name,this.beforeOpenArgs.requestType,this.beforeOpenArgs.cancel;this.parent.trigger("actionBegin",this.beforeOpenArgs,function(d){if(t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.showSpinner():n.parent.showMaskRow(),n.renderTabItems(),!d.cancel){o.selected=n.tabSelectedEvent.bind(n),o.height=n.parent.isAdaptive?"100%":"auto",o.overflowMode="Scrollable",n.tabObj=new l.Tab(o),n.tabObj.isStringTemplate=!0,a=n.parent.createElement("div",{id:s.element.id+"_Tab"}),n.tabObj.appendTo(a),e.content=a,n.dialog=r,n.dialogObj=new i.Dialog(e),n.dialogObj.isStringTemplate=!0,n.dialogObj.appendTo(n.dialog);var h={action:"OpenDialog",requestType:n.isEdit?"openEditDialog":"openAddDialog",data:n.beforeOpenArgs.rowData,element:n.dialog,cancel:!1};n.parent.trigger("actionComplete",h,function(e){t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.hideSpinner():n.parent.hideMaskRow(),e.cancel&&n.resetValues()})}})},e.prototype.tabSelectedEvent=function(e){var i=this.parent,r=e.selectedContent.childNodes[0].id;if(this.parent.isAdaptive&&this.responsiveTabContent(r,i),r===i.element.id+"ResourcesTabContainer")this.resourceSelection(r);else if(r===i.element.id+"NotesTabContainer"){document.getElementById(r).ej2_instances[0].refresh();document.querySelector("#"+this.parent.element.id+"NotesTabContainer").style.overflow="scroll"}else r===i.element.id+"SegmentsTabContainer"&&(t.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)?document.getElementById(r).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!1):document.getElementById(r).ej2_instances[0].enableToolbarItems([this.parent.element.id+"SegmentsTabContainer_add"],!0))},e.prototype.responsiveTabContent=function(e,t){var i=document.getElementById(t.element.id+"_dialog_dialog-content"),r=i.clientHeight;r-=i.querySelector(".e-tab-header").offsetHeight;var a=document.querySelector("#"+e);if(a.classList.contains("e-grid")){r-=a.ej2_instances[0].getHeaderContent().offsetHeight;var n=a.querySelector(".e-toolbar");n&&(r-=n.offsetHeight)}a.parentElement.style.height=r+"px"},e.prototype.getFieldsModel=function(e){for(var i={},r=this.parent.columnByField,a=0;a<e.length;a++)if(e[a]!==this.parent.taskFields.dependency&&e[a]!==this.parent.taskFields.resourceInfo&&e[a]!==this.parent.taskFields.notes&&!t.isNullOrUndefined(r[e[a]])){var n=e[a];this.createInputModel(r[n],i)}return i},e.prototype.createInputModel=function(e,i){var r=this,a=this.parent,n=this.parent.locale,s=this.parent.taskFields,o={placeholder:e.headerText,floatLabelType:"Auto"};switch(t.isNullOrUndefined(this.parent.taskFields.id)||t.isNullOrUndefined(this.parent.columnMapping.id)||t.isNullOrUndefined(this.numericOrString)||s.id===e.field&&(e.editType=this.numericOrString),e.editType){case"booleanedit":var l={label:e.headerText,locale:n,enableRtl:this.parent.enableRtl};i[e.field]=l;break;case"defaultedit":case"stringedit":var d=o;d.enableRtl=this.parent.enableRtl,e.field!==a.columnMapping.duration&&e.field!==a.columnMapping.id&&e.field!==a.columnMapping.startDate&&e.field!==a.columnMapping.endDate||(d.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=o;break;case"numericedit":var h=o;h.enableRtl=this.parent.enableRtl,s.progress===e.field&&(h.min=0,h.max=100),s.work===e.field&&(h.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=h;break;case"datepickeredit":var p=o;p.format=this.parent.getDateFormat(),p.enableRtl=this.parent.enableRtl,p.strictMode=!0,p.firstDayOfWeek=a.timelineModule.customTimelineSettings.weekStartDay,e.field!==a.columnMapping.startDate&&e.field!==a.columnMapping.endDate||(p.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent),p.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=p;break;case"datetimepickeredit":var c=o;c.format=this.parent.getDateFormat(),c.enableRtl=this.parent.enableRtl,c.strictMode=!0,c.firstDayOfWeek=a.timelineModule.customTimelineSettings.weekStartDay,e.field!==a.columnMapping.startDate&&e.field!==a.columnMapping.endDate||(c.renderDayCell=this.parent.renderWorkingDayCell.bind(this.parent),c.change=function(t){r.validateScheduleFields(t,e,a)}),i[e.field]=c;break;case"dropdownedit":if(e.field===a.columnMapping.type||e.field===a.columnMapping.manual){o.dataSource=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}],o.fields={value:"Value"};var u=o;u.enableRtl=this.parent.enableRtl,u.change=function(t){e.field===s.manual&&(r.editedRecord.ganttProperties.isAutoSchedule=!t.value),r.validateScheduleFields(t,e,a)}}i[e.field]=o;break;case"maskededit":i[e.field]=o}return t.isNullOrUndefined(e.edit)||t.isNullOrUndefined(e.edit.params)||t.extend(i[e.field],e.edit.params),i},e.prototype.validateScheduleFields=function(e,i,r){var a,n;t.isNullOrUndefined(r.editModule.dialogModule.dialog)||(n=r.editModule.dialogModule.dialog);var s,o=null,l=r.editModule.dialogModule.editedRecord,d=null,p=null,c="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,u=this.parent.viewType;if(t.isNullOrUndefined(e.element)?t.isNullOrUndefined(e.container)?t.isNullOrUndefined(e.event)||t.isNullOrUndefined(e.event.path)||t.isNullOrUndefined(e.event.path)[1]||(o=(s=e.event.path[1]).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):(o=(s=e.container).querySelector("input").getAttribute("id"),s=s.querySelector("#"+o)):o=(s=e.element).getAttribute("id"),t.isNullOrUndefined(s))d=e.value,p=i.field;else if(d=s.value,p=o.replace(r.element.id,""),"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType){var g={rules:(a={},a[this.parent.taskFields.id]={required:!0,minLength:[function(e){return"ResourceView"===u?-1===c.indexOf("T"+e.value)&&-1===c.indexOf("R"+e.value):-1===c.indexOf(e.value)},"ID is already present, please enter new value"]},a)};new h.FormValidator("#"+this.parent.element.id+"GeneralTabContainer",g)}if(0===p.search("Segments"))return p=p.replace("SegmentsTabContainer",""),this.validateSegmentFields(r,p,d,e),!0;this.validateScheduleValuesByCurrentField(p,d,this.editedRecord);var f=l.ganttProperties,m=r.taskFields;return t.isNullOrUndefined(m.startDate)||m.startDate===p||this.updateScheduleFields(n,f,"startDate"),m.endDate===p&&!t.isNullOrUndefined(f.startDate)&&!t.isNullOrUndefined(e.value)&&f.startDate.getTime()>e.value&&this.updateScheduleFields(n,f,"endDate"),t.isNullOrUndefined(m.endDate)||m.endDate===p||this.updateScheduleFields(n,f,"endDate"),t.isNullOrUndefined(m.duration)||m.duration===p||this.updateScheduleFields(n,f,"duration"),t.isNullOrUndefined(m.work)||m.work===p||this.updateScheduleFields(n,f,"work"),this.dialogEditValidationFlag=!1,!0},e.prototype.updateScheduleFields=function(e,i,r){var a,n=this.parent,s=n.element.id,o=t.getValue(r,n.columnMapping),l=n.columnByField[o],d=this.parent.taskFields;if("stringedit"===l.editType){var h=e.querySelector("#"+s+o).ej2_instances[0];a=t.isNullOrUndefined(l.edit)||t.isNullOrUndefined(l.edit.read)?t.isNullOrUndefined(l.valueAccessor)?this.parent.dataOperation.getDurationString(i.duration,i.durationUnit):l.valueAccessor(o,n.editModule.dialogModule.editedRecord,l):l.edit.read(),h.value!==a.toString()&&d.duration===o?(h.value=a,h.dataBind()):d.startDate!==o&&d.endDate!==o||(h.value=d.startDate===o?i.startDate.toString():i.endDate.toString(),h.dataBind())}else if("datepickeredit"===l.editType||"datetimepickeredit"===l.editType){var p=(l.editType,e.querySelector("#"+s+o).ej2_instances[0]);a=i[r],(t.isNullOrUndefined(p.value)&&!t.isNullOrUndefined(a)||t.isNullOrUndefined(a)&&!t.isNullOrUndefined(p.value)||p.value!==a&&!t.isNullOrUndefined(p.value)&&!t.isNullOrUndefined(a)&&p.value.toString()!==a.toString())&&(p.value=a,p.dataBind())}else if("numericedit"===l.editType){var c=e.querySelector("#"+s+o).ej2_instances[0];a=i[r],t.isNullOrUndefined(a)||c.value===a||(c.value=a,c.dataBind())}},e.prototype.validateDuration=function(e){var i=e.ganttProperties;if(!this.dialogEditValidationFlag){t.isNullOrUndefined(i.duration)?(this.parent.setRecordValue("endDate",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0)):m(i)||!t.isNullOrUndefined(i.startDate)?(e.ganttProperties.isMilestone&&0!==e.ganttProperties.duration&&this.parent.dateValidationModule.checkStartDate(i.startDate),this.parent.dateValidationModule.calculateEndDate(e)):m(i)||t.isNullOrUndefined(i.endDate)||this.parent.dateValidationModule.calculateStartDate(e);var r=0===i.duration;this.parent.setRecordValue("isMilestone",r,i,!0),this.dialogEditValidationFlag=!0}},e.prototype.validateStartDate=function(e){var i=e.ganttProperties,r=this.parent.taskFields;this.dialogEditValidationFlag||(t.isNullOrUndefined(i.startDate)?(this.parent.setRecordValue("duration",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0),this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(r.endDate)&&this.parent.setRecordValue("endDate",null,i,!0)):m(i)?t.isNullOrUndefined(r.duration)?this.parent.dateValidationModule.calculateDuration(e):(t.isNullOrUndefined(r.endDate),this.parent.dateValidationModule.calculateEndDate(e)):t.isNullOrUndefined(i.endDate)?t.isNullOrUndefined(i.duration)||this.parent.dateValidationModule.calculateEndDate(e):this.parent.dateValidationModule.calculateDuration(e),this.dialogEditValidationFlag=!0)},e.prototype.validateEndDate=function(e){var i=e.ganttProperties,r=this.parent.taskFields;this.dialogEditValidationFlag||(t.isNullOrUndefined(i.endDate)?(this.parent.setRecordValue("duration",null,i,!0),this.parent.setRecordValue("isMilestone",!1,i,!0)):m(i)?t.isNullOrUndefined(r.duration)?this.parent.dateValidationModule.calculateDuration(e):t.isNullOrUndefined(i.startDate)?this.parent.dateValidationModule.calculateStartDate(e):(!t.isNullOrUndefined(i.segments)&&i.segments.length>0&&(i.segments=this.parent.editModule.cellEditModule.validateEndDateWithSegments(i)),this.parent.dateValidationModule.calculateDuration(e)):t.isNullOrUndefined(i.duration)?t.isNullOrUndefined(i.startDate)||this.parent.dateValidationModule.calculateDuration(e):this.parent.dateValidationModule.calculateStartDate(e),this.dialogEditValidationFlag=!0)},e.prototype.validateScheduleValuesByCurrentField=function(e,i,r){var a=this.parent,n=r.ganttProperties,s=a.taskFields;if(s.duration===e&&(t.isNullOrUndefined(i)||""===i?a.allowUnscheduledTasks&&this.parent.setRecordValue("duration",null,n,!0):(a.dataOperation.updateDurationValue(i,n),this.parent.setRecordValue(s.duration,i,r),this.parent.setRecordValue("taskData."+s.duration,n.duration,r)),this.validateDuration(r),this.parent.editModule.updateResourceRelatedFields(r,"duration")),s.startDate===e){if(""!==i){var o=this.parent.dateValidationModule.getDateFromFormat(i);o=this.parent.dateValidationModule.checkStartDate(o,n),this.parent.setRecordValue("startDate",o,n,!0)}else a.allowUnscheduledTasks&&!r.hasChildRecords&&this.parent.setRecordValue("startDate",null,n,!0);this.validateStartDate(r)}if(s.endDate===e){if(""!==i){var l=this.parent.dateValidationModule.getDateFromFormat(i);t.isNullOrUndefined(n.startDate)&&t.isNullOrUndefined(l)&&n.startDate.getTime()>l.getTime()&&(l=n.endDate),0===l.getHours()&&86400!==a.defaultEndTime&&this.parent.dateValidationModule.setTime(a.defaultEndTime,l),l=this.parent.dateValidationModule.checkEndDate(l,n),(t.isNullOrUndefined(n.startDate)||l.getTime()>n.startDate.getTime())&&this.parent.setRecordValue("endDate",l,n,!0)}else a.allowUnscheduledTasks&&this.parent.setRecordValue("endDate",null,n,!0);this.validateEndDate(r)}return s.work===e&&(t.isNullOrUndefined(i)||""===i||(this.parent.setRecordValue("work",i,n,!0),this.parent.editModule.updateResourceRelatedFields(r,"work"),this.validateDuration(r))),e===s.type&&this.parent.setRecordValue("taskType",i,n,!0),s.manual===e&&this.parent.editModule.updateTaskScheduleModes(r),!0},e.prototype.getSegmentsModel=function(e){var i=this,r=this.parent.taskFields;(t.isNullOrUndefined(e)||0===e.length)&&(e=[],t.isNullOrUndefined(r.startDate)||e.push("startDate"),t.isNullOrUndefined(r.endDate)||e.push("endDate"),t.isNullOrUndefined(r.duration)||e.push("duration"));var a={};a.editSettings={allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal",newRowPosition:"Bottom"},a.locale=this.parent.locale,a.dataSource=[],a.rowHeight=this.parent.isAdaptive?48:null,a.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")}];for(var n=[],s=function(r){var a={};switch(e[r]){case"startDate":case"endDate":a={field:e[r],headerText:o.localeObj.getConstant(e[r]),editType:"stringedit",width:"200px",edit:{write:function(a){var n;if(t.isNullOrUndefined(i.beforeOpenArgs.General)){var s=i.getGeneralColumnFields();n=i.getFieldsModel(s)[i.parent.taskFields[e[r]]]}else n=i.beforeOpenArgs.General[i.parent.taskFields[e[r]]];var o=a.rowData[a.column.field];t.setValue("value",o,n);new i.inputs[i.parent.columnByField[i.parent.taskFields[e[r]]].editType](n).appendTo(a.element)},read:function(e){return e.ej2_instances[0].value}},format:o.parent.getDateFormat()},"startDate"===e[r]&&(a.validationRules={required:!0}),n.push(a);break;case"duration":a={field:e[r],headerText:o.localeObj.getConstant(e[r]),editType:"stringedit",width:"100px",edit:{write:function(a){var n;if(t.isNullOrUndefined(i.beforeOpenArgs.General)){var s=i.getGeneralColumnFields();n=i.getFieldsModel(s)[i.parent.taskFields[e[r]]]}else n=i.beforeOpenArgs.General[i.parent.taskFields[e[r]]];n.floatLabelType="Never";var o=a.rowData[a.column.field];t.isNullOrUndefined(o)?t.setValue("value",null,n):t.setValue("value",o,n),t.setValue("value",o,n);new h.TextBox(n).appendTo(a.element)},read:function(e){return e.ej2_instances[0].value.toString()}}},n.push(a)}},o=this,l=0;l<e.length;l++)s(l);return a.columns=n,a.height=this.parent.isAdaptive?"100%":"153px",a},e.prototype.getGridColumnByField=function(e,t){for(var i,r=0;r<t.length;r++)t[r].field===e&&(i=t[r]);return i},e.prototype.updateSegmentField=function(e,i,r){var a,n=this.parent.editModule.dialogModule.dialog,s=t.getValue("Segments",this.beforeOpenArgs),o=this.getGridColumnByField(e,s.columns),l=this.parent.element.id,d=r[e];"stringedit"===o.editType?a=n.querySelector("#"+l+"SegmentsTabContainer"+e).ej2_instances[0]:"datepickeredit"===o.editType&&(a=n.querySelector("#"+l+"SegmentsTabContainer"+e).ej2_instances[0]),t.isNullOrUndefined(a.value)||a.value.toString()===d.toString()||(a.value=d,a.dataBind())},e.prototype.validateSegmentFields=function(e,i,r,a){var n=this.parent.taskFields;if(!t.isNullOrUndefined(n.duration)&&n.duration.toLowerCase()===i.toLowerCase()&&!t.isNullOrUndefined(r)&&""!==r){this.selectedSegment.duration=Number(r);var s=e.dataOperation.getEndDate(this.selectedSegment.startDate,Number(r),this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1);s=e.dataOperation.checkEndDate(s,this.editedRecord.ganttProperties,!1),this.selectedSegment.endDate=s}if(!t.isNullOrUndefined(n.startDate)&&n.startDate.toLowerCase()===i.toLowerCase()&&""!==r){var o=this.parent.dateValidationModule.getDateFromFormat(r);o=this.parent.dateValidationModule.checkStartDate(o),this.selectedSegment.startDate=o,t.isNullOrUndefined(n.endDate)||(this.selectedSegment.endDate=this.parent.dataOperation.getEndDate(o,this.selectedSegment.duration,this.editedRecord.ganttProperties.durationUnit,this.editedRecord.ganttProperties,!1))}if(!t.isNullOrUndefined(n.endDate)&&n.endDate.toLowerCase()===i.toLowerCase()&&""!==r){0===(s=this.parent.dateValidationModule.getDateFromFormat(r)).getHours()&&86400!==e.defaultEndTime&&this.parent.dateValidationModule.setTime(e.defaultEndTime,s),s=this.parent.dateValidationModule.checkEndDate(s,this.editedRecord.ganttProperties),this.selectedSegment.endDate=s,this.selectedSegment.duration=this.parent.dataOperation.getDuration(this.selectedSegment.startDate,this.selectedSegment.endDate,this.editedRecord.ganttProperties.durationUnit,!0,!1,!0)}t.isNullOrUndefined(n.startDate)||this.updateSegmentField("startDate",a,this.selectedSegment),t.isNullOrUndefined(n.endDate)||this.updateSegmentField("endDate",a,this.selectedSegment),t.isNullOrUndefined(n.duration)||this.updateSegmentField("duration",a,this.selectedSegment)},e.prototype.getPredecessorModel=function(e){(t.isNullOrUndefined(e)||0===e.length)&&(e=["ID","Name","Type","Offset","UniqueId"]);var i={};i.editSettings={allowEditing:!0,allowAdding:!0,allowDeleting:!0,mode:"Normal"},i.locale=this.parent.locale,i.dataSource=[],i.rowHeight=this.parent.isAdaptive?48:null,i.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 r=[],a=0;a<e.length;a++){var n={};"id"===e[a].toLowerCase()?(n={field:"id",headerText:this.localeObj.getConstant("id"),allowEditing:!1,width:"70px"},r.push(n)):"name"===e[a].toLowerCase()?(n={field:"name",headerText:this.localeObj.getConstant("name"),editType:"stringedit",width:"250px",validationRules:{required:!0}},r.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"},r.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"},r.push(n)):"uniqueid"===e[a].toLowerCase()&&(n={field:"uniqueId",isPrimaryKey:!0,visible:!1,defaultValue:C().toString()},r.push(n))}return i.columns=r,i.height=this.parent.isAdaptive?"100%":"153px",i},e.prototype.getResourcesModel=function(e){var i=this.parent.resourceFields;(t.isNullOrUndefined(e)||0===e.length)&&(e=[i.id,i.name,i.unit,i.group]);for(var r={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 s={};e[n]===i.id?(s={field:i.id,headerText:this.localeObj.getConstant("id"),isPrimaryKey:!0,width:"100px",allowEditing:!1},a.push(s)):e[n]===i.name?(s={field:i.name,headerText:this.localeObj.getConstant("name"),allowEditing:!1},a.push(s)):e[n]===i.unit?(s={field:i.unit,headerText:this.localeObj.getConstant("unit"),editType:"numericedit",edit:{params:{min:0}}},a.push(s)):e[n]!==i.group||t.isNullOrUndefined(i.group)||(s={field:i.group,headerText:this.localeObj.getConstant("group"),allowEditing:!1},a.push(s))}return r.columns=a,r.height=this.parent.isAdaptive?"100%":"196px",r},e.prototype.getNotesModel=function(e){(t.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"]);return{placeholder:this.localeObj.getConstant("writeNotes"),toolbarSettings:{items:e},height:this.parent.isAdaptive?"100%":"auto",locale:this.parent.locale}},e.prototype.createDivElement=function(e,i){return t.createElement("div",{className:e,id:i})},e.prototype.createInputElement=function(e,i,r,a){return t.createElement(a||"input",{className:e,attrs:{type:"text",id:i,name:r,title:r}})},e.prototype.renderTabItems=function(){for(var e=this.beforeOpenArgs.tabModel.items,t=0,i=0;i<e.length;i++){var r=e[i];r.content instanceof HTMLElement||("General"===r.content?r.content=this.renderGeneralTab(r.content):"Dependency"===r.content?(this.editedRecord.hasChildRecords&&!this.parent.allowParentDependency&&(r.disabled=!0),r.content=this.renderPredecessorTab(r.content)):"Resources"===r.content?r.content=this.renderResourceTab(r.content):r.content==="Custom"+t?(r.content=this.renderCustomTab(r.content),t++):"Notes"===r.content?r.content=this.renderNotesTab(r.content):"Segments"===r.content&&(this.editedRecord.hasChildRecords&&(r.disabled=!0),r.content=this.renderSegmentsTab(r.content)))}},e.prototype.segmentGridActionBegin=function(e){var i=this.parent.taskFields,r=this.beforeOpenArgs.Segments;if("add"===e.requestType||"beginEdit"===e.requestType||"save"===e.requestType){var a=r.dataSource,n=t.getValue("rowData",e),s=this.beforeOpenArgs.rowData.ganttProperties.startDate;if(!t.isNullOrUndefined(s)&&"add"===e.requestType){var o={},l=t.getValue("startDate",n),d=t.getValue("endDate",n),h=(t.getValue("duration",n),!t.isNullOrUndefined(a)&&a.length>0?t.isNullOrUndefined(i.endDate)?new Date(t.getValue("startDate",a[0]).getTime()):new Date(t.getValue("endDate",a[0]).getTime()):!t.isNullOrUndefined(this.beforeOpenArgs.rowData.ganttProperties.startDate)&&new Date(this.beforeOpenArgs.rowData.ganttProperties.startDate.getTime()));h.setHours(0,0,0,0),!t.isNullOrUndefined(a)&&a.length>0&&h.setDate(h.getDate()+2),l=this.parent.dataOperation.checkStartDate(h),0===(d=this.parent.dateValidationModule.getDateFromFormat(l)).getHours()&&86400!==this.parent.defaultEndTime&&this.parent.dateValidationModule.setTime(this.parent.defaultEndTime,d),o={startDate:l,endDate:d=!t.isNullOrUndefined(i.endDate)&&!t.isNullOrUndefined(a)&&a.length<=0?this.beforeOpenArgs.rowData.ganttProperties.endDate:d,duration:!t.isNullOrUndefined(i.duration)&&!t.isNullOrUndefined(a)&&a.length<=0?this.beforeOpenArgs.rowData.ganttProperties.duration:1},e.rowData=o}this.selectedSegment=e.rowData}},e.prototype.renderSegmentsTab=function(e){var i=this.parent,a=this.beforeOpenArgs[e],n=this.beforeOpenArgs.rowData,s=[];this.isEdit&&(s=t.isNullOrUndefined(n.ganttProperties.segments)?[]:n.ganttProperties.segments),a.dataSource=s,a.actionBegin=this.segmentGridActionBegin.bind(this),r.Grid.Inject(r.Edit,r.Page,r.Toolbar,r.ForeignKey);var o=new r.Grid(a),l=this.createDivElement("",i.element.id+""+e+"TabContainer");return o.appendTo(l),l},e.prototype.renderGeneralTab=function(e){for(var t=this.parent,i=this.beforeOpenArgs[e],r=this.createDivElement("e-edit-form-row",t.element.id+""+e+"TabContainer"),a=0,n=Object.keys(i);a<n.length;a++){var s=n[a];if(!1!==this.parent.columnByField[s].visible){var o=this.parent.columnByField[s],l=i[s];r.appendChild(this.renderInputElements(l,o))}}return r},e.prototype.isCheckIsDisabled=function(e){var i,r=!1;if(!1===e.allowEditing||e.isPrimaryKey||this.parent.readOnly)if(-1!==this.parent.customColumns.indexOf(e.field))r=!0;else if(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||e.field===this.parent.taskFields.baselineStartDate||e.field===this.parent.taskFields.baselineEndDate||e.field===this.parent.taskFields.work||e.field===this.parent.taskFields.type){for(var a=0;a<this.parent.currentViewData.length;a++)if(!t.isNullOrUndefined(this.parent.currentViewData[a].ganttProperties.taskId)){i=this.parent.currentViewData[a].ganttProperties.taskId;break}r="string"!=typeof i}return this.isEdit&&(e.field===this.parent.taskFields.id&&(r=!0),this.editedRecord.hasChildRecords&&(e.field===this.parent.taskFields.endDate&&(!t.isNullOrUndefined(this.editedRecord.isManual)&&!1===this.editedRecord.isManual||"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)&&(r=!0)),r},e.prototype.isParentValid=function(e){if(e.length>0)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},e.prototype.renderPredecessorTab=function(e){var i=this,n=this.parent,s=this.beforeOpenArgs[e],o=this.parent.columnByField[this.parent.taskFields.dependency];(!1===o.allowEditing||o.isPrimaryKey||this.parent.readOnly)&&(s.editSettings.allowEditing=!1,s.editSettings.allowAdding=!1,s.editSettings.allowDeleting=!1);var l=this.beforeOpenArgs.rowData,d=[];this.taskNameCollection(),this.isEdit&&(d=this.predecessorEditCollection(l),this.updatePredecessorDropDownData(l)),s.dataSource=d,s.actionBegin=this.gridActionBegin.bind(this);s.columns[1].edit={write:function(e){"add"===t.getValue("requestType",e)&&t.setValue("rowData.uniqueId",C(),e);new u.ComboBox({dataSource:new a.DataManager(i.idCollection),popupHeight:"180px",allowCustom:!1,enableRtl:i.parent.enableRtl,fields:{value:"text"},value:e.rowData.name,change:function(e){var r=t.closest(e.element,"tr").querySelector("#"+i.parent.element.id+"DependencyTabContainerid");r&&(t.isNullOrUndefined(e.itemData)||t.isNullOrUndefined(e.item)?r.value="":r.value=e.itemData.id)},autofill:!0}).appendTo(e.element)},read:function(e){return e.ej2_instances[0].value}},r.Grid.Inject(r.Edit,r.Page,r.Toolbar,r.ForeignKey);var h=new r.Grid(s),p=this.createDivElement("e-dependent-div",n.element.id+""+e+"TabContainer");return h.appendTo(p),p},e.prototype.gridActionBegin=function(e){var i=this,r=this.beforeOpenArgs.Dependency;if("add"===e.requestType||"beginEdit"===e.requestType){var a="add"!==e.requestType;this.idCollection=t.extend([],[],this.preTableCollection,!0);for(var n=r.dataSource,s=function(r){o.idCollection.forEach(function(s,o){if(s.id===t.getValue("id",n[r])){var l=t.getValue("rowData",e);if(a&&t.getValue("id",l)===s.id)return;i.idCollection.splice(i.idCollection.indexOf(s),1)}})},o=this,l=0;l<=n.length;l++)s(l)}},e.prototype.updateResourceCollection=function(e,i){if(!t.isNullOrUndefined(e.data)&&Object.keys(e.data).length){this.parent;var r=document.querySelector("#"+i).ej2_instances[0];if(!t.isNullOrUndefined(r)&&r.getSelectedRecords().length>0){var a=r.getSelectedRecords(),n=void 0,s=[];for(n=0;n<a.length;n++)s.push(a[n].taskData);this.ganttResources=t.extend([],s)}else this.ganttResources=[]}else this.ganttResources=[]},e.prototype.renderResourceTab=function(e){var i=this,r=this.parent,a=r.resourceFields,s=this.beforeOpenArgs.rowData,o=s.ganttProperties.resourceInfo,l=this.beforeOpenArgs[e],d=r.element.id+""+e+"TabContainer",h=[];if("ResourceView"===this.parent.viewType)for(var p=0;p<r.currentViewData.length;p++)for(var c=0;c<r.resources.length;c++)r.currentViewData[p][r.taskFields.id]===r.resources[c][a.id]&&(r.currentViewData[p].hasChildRecords||t.isNullOrUndefined(r.currentViewData[p].parentItem))&&h.push(r.resources[c]);else h=t.extend([],[],r.resources,!0);if(this.parent.dataOperation.updateResourceUnit(h),!t.isNullOrUndefined(o)){var u=void 0,g=o.length,f=void 0,m=h.length;for(u=0;u<g;u++)for(f=0;f<m;f++)o[u][a.id]===h[f][a.id]&&(h[f][a.unit]=o[u][a.unit])}l.dataSource=h;var y=s.ganttProperties.resourceInfo;if(this.isEdit&&!t.isNullOrUndefined(y))for(p=0;p<y.length;p++)this.ganttResources.push(y[p]);l.rowSelected=function(e){i.updateResourceCollection(e,d)},l.rowDeselected=function(e){i.updateResourceCollection(e,d)};var D=this.createDivElement("e-resource-div",d);n.TreeGrid.Inject(n.Selection,n.Filter,n.Edit,n.VirtualScroll);var v=new n.TreeGrid(l),w=this.parent.columnByField[this.parent.taskFields.resourceInfo];return(!1===w.allowEditing||w.isPrimaryKey||this.parent.readOnly)&&(v.allowSelection=!1,v.allowFiltering=!1,v.editSettings.allowEditing=!1),v.dataBound=function(){if(i.parent.editDialogFields.length>=1&&"Resources"===i.parent.editDialogFields[0].type){var e=i.parent.element.id+"ResourcesTabContainer";i.resourceSelection(e)}},v.appendTo(D),D},e.prototype.resourceSelection=function(e){var i=this,r=document.querySelector("#"+e).ej2_instances[0],a=r.getCurrentViewRecords(),n=this.ganttResources;n&&n.length>0&&a.forEach(function(e,a){for(var s=0;s<n.length;s++)e.taskData[i.parent.resourceFields.id]!==n[s][i.parent.resourceFields.id]||t.isNullOrUndefined(r.selectionModule)||-1!==r.getSelectedRowIndexes().indexOf(a)||r.selectRow(a)})},e.prototype.renderCustomTab=function(e){return this.renderGeneralTab(e)},e.prototype.renderNotesTab=function(e){var t=this.parent,i=this.beforeOpenArgs[e];i.enableHtmlSanitizer=this.parent.enableHtmlSanitizer;var r=this.editedRecord.ganttProperties,a=this.createDivElement("",t.element.id+""+e+"TabContainer");d.RichTextEditor.Inject(d.Toolbar,d.Link,d.HtmlEditor,d.QuickToolbar,d.Count),i.value=r.notes;var n=this.parent.columnByField[this.parent.taskFields.notes];(!1===n.allowEditing||n.isPrimaryKey||this.parent.readOnly)&&(i.enabled=!1);return new d.RichTextEditor(i).appendTo(a),a},e.prototype.renderInputElements=function(e,i){var a,n=this,s=this.parent.element.id,o=this.editedRecord,l=this.createDivElement("e-edit-form-column"),d={column:i,data:o};if(!t.isNullOrUndefined(i.edit)&&t.isNullOrUndefined(i.edit.params)){var h=i.edit.create;(a="string"==typeof h?(h=r.getObject(h,window))(d):i.edit.create(d)).className="",a.setAttribute("type","text"),a.setAttribute("id",s+""+i.field),a.setAttribute("name",i.field),a.setAttribute("title",i.field),l.appendChild(a)}else a=this.createInputElement("",s+""+i.field,i.field),l.appendChild(a);if(e.enabled=t.isNullOrUndefined(e.enabled)?!this.isCheckIsDisabled(i):e.enabled,i.field===this.parent.taskFields.duration)if(t.isNullOrUndefined(i.valueAccessor)){if(t.isNullOrUndefined(i.edit)){var p=o.ganttProperties;e.value=this.parent.dataOperation.getDurationString(p.duration,p.durationUnit)}}else if("string"==typeof i.valueAccessor){var c=r.getObject(i.valueAccessor,window);e.value=c(i.field,o,i)}else e.value=i.valueAccessor(i.field,o,i);else"booleanedit"===i.editType?!0===o[i.field]?e.checked=!0:e.checked=!1:e.value=o[i.field];if(!t.isNullOrUndefined(i.edit)&&t.isNullOrUndefined(i.edit.params)){var u=i.edit.write,g=void 0;g="string"==typeof u?(u=r.getObject(u,window))({column:i,rowData:o,element:a}):i.edit.write({column:i,rowData:o,element:a}),i.field===this.parent.taskFields.duration&&(g.change=function(e){n.validateScheduleFields(e,i,n.parent)})}else{(g=new this.inputs[i.editType](e)).appendTo(a)}return l},e.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 r=i;if(i.parentUniqueID===this.beforeOpenArgs.rowData.uniqueID)this.isValidData=!1;else do{if(r.parentItem&&(r=this.parent.flatData[this.parent.ids.indexOf(r.parentItem.taskId)]).uniqueID===this.beforeOpenArgs.rowData.uniqueID){this.isValidData=!1;break}}while(r.parentItem);if(i.hasChildRecords&&this.isValidData&&(this.isValidData=this.isParentValid(i.childRecords)),!this.isValidData){this.isValidData=!0;continue}}else if(i.hasChildRecords)continue;var a="ResourceView"===this.parent.viewType?i.ganttProperties.taskId.toString():i.ganttProperties.rowUniqueID.toString(),n={id:a,text:a+"-"+i.ganttProperties.taskName,value:a};this.preTaskIds.push(n.id),this.preTableCollection.push(n)}},e.prototype.predecessorEditCollection=function(e){var i=[],r=e.ganttProperties;if(this.isEdit&&!t.isNullOrUndefined(this.parent.taskFields.dependency)&&!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(r.predecessor))for(var a=r.predecessor,n=this.preTableCollection,s=0;s<a.length;s++){var o=a[s].from.toString(),l={};if(("ResourceView"===this.parent.viewType?r.taskId:r.rowUniqueID).toString()!==o){l.id=o;for(var d=0;d<n.length;d++)if(n[d].value===o){l.name=n[d].text;break}l.type=a[s].type;var h=a[s].offset,p=a[s].offsetUnit;l.offset=this.parent.dataOperation.getDurationString(h,p),l.uniqueId=C(),i.push(l)}}return i},e.prototype.updatePredecessorDropDownData=function(e){var t=-1,i="ResourceView"===this.parent.viewType?e.ganttProperties.taskId.toString():e.ganttProperties.rowUniqueID.toString();t=this.preTaskIds.indexOf(i),this.preTableCollection.splice(t,1),this.preTaskIds.splice(t,1),this.validSuccessorTasks(e,this.preTaskIds,this.preTableCollection)},e.prototype.validSuccessorTasks=function(e,t,i){var r=this,a=e.ganttProperties;if(a.predecessor&&a.predecessor.length>0){var n=a.predecessor,s="ResourceView"===this.parent.viewType?a.taskId.toString():a.rowUniqueID.toString();n.forEach(function(e){if(e.from.toString()===s){var a=e.to,n=-1;(n=t.indexOf(a))>-1&&(t.splice(n,1),i.splice(n,1));var o=r.parent.connectorLineModule.getRecordByID(a);r.validSuccessorTasks(o,t,i)}})}},e.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]}]},e.prototype.initiateDialogSave=function(){this.isEdit?this.parent.initiateEditAction(!0):this.addedRecord={};for(var e=this.parent,i=this.beforeOpenArgs.tabModel.items,r=0;r<i.length;r++){var a=i[r].content,n=a.id;t.isNullOrUndefined(n)&&""===n||("General"===(n=(n=n.replace(e.element.id,"")).replace("TabContainer",""))?this.updateGeneralTab(a,!1):"Dependency"===n?this.updatePredecessorTab(a):"Notes"===n?this.updateNotesTab(a):"Resources"===n?this.updateResourceTab(a):-1!==n.indexOf("Custom")?this.updateCustomTab(a):"Segments"===n&&this.updateSegmentsData(a,this.beforeOpenArgs.rowData))}if(this.isEdit){this.parent.dataOperation.updateWidthLeft(this.rowData);var s={data:this.rowData,action:"DialogEditing"};this.parent.editModule.initiateUpdateAction(s)}else if("ResourceView"===this.parent.viewType){var o=t.extend({},this.addedRecord,!0);if(o[this.parent.taskFields.resourceInfo].length)for(r=0;r<o[this.parent.taskFields.resourceInfo].length;r++){n=o[this.parent.taskFields.resourceInfo][r].toString();var l=this.parent.getTaskIds().indexOf("R"+n.toString());if(-1!==l){this.parent.editModule.addRecord(this.addedRecord,"Child",l);break}}else this.parent.editModule.addRecord(this.addedRecord,"Bottom")}else this.parent.editModule.addRecord(this.addedRecord,this.parent.editSettings.newRowPosition);return!0},e.prototype.updateSegmentTaskData=function(e){for(var i=[],r=this.parent.taskFields,a=0;a<e.length;a++){var n={};t.isNullOrUndefined(r.startDate)||(n[this.parent.taskFields.startDate]=e[a].startDate),t.isNullOrUndefined(r.endDate)||(n[this.parent.taskFields.endDate]=e[a].endDate),t.isNullOrUndefined(r.duration)||(n[this.parent.taskFields.duration]=Number(e[a].duration),e[a].duration=n[this.parent.taskFields.duration]),i.push(n)}this.isEdit?(this.rowData.ganttProperties.segments=e,this.parent.setRecordValue("segments",this.parent.dataOperation.setSegmentsInfo(this.rowData,!1),this.rowData.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.segments,i,this.rowData),e.length<=0&&this.validateDuration(this.rowData)):this.addedRecord[r.segments]=i},e.prototype.updateSegmentsData=function(e,t){var i,r=e.ej2_instances[0],a=r.isEdit;r.isEdit&&r.endEdit(),i=a&&r.currentViewData.length!=r.dataSource.length?r.dataSource:r.currentViewData,this.updateSegmentTaskData(i)},e.prototype.updateGeneralTab=function(e,i){var a=this.parent,n=e.childNodes,s={};this.isEdit||(s=this.addedRecord);for(var o=0;o<n.length;o++){var l=n[o],d=l.querySelector('input[id^="'+a.element.id+'"]');if(d){var h=d.id.replace(a.element.id,""),p=l.querySelector("#"+a.element.id+h).ej2_instances[0];if("stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType&&h===this.parent.taskFields.id){var c=p.value.toString();p.value=c}var u=a.columnByField[h];if(!t.isNullOrUndefined(u.edit)&&t.isNullOrUndefined(u.edit.params)){var g=u.edit.read;"string"==typeof g?(g=r.getObject(g,window),s[h]=g(d,p.value)):s[h]=u.edit.read(d,p.value)}else i&&"booleanedit"===u.editType?!0===d.checked?s[h]=!0:s[h]=!1:(s[h]=p.value,this.parent.enableHtmlSanitizer&&"string"==typeof p.value&&(p.value=t.SanitizeHtmlHelper.sanitize(p.value),s[h]=p.value))}}this.isEdit&&(i||this.updateScheduleProperties(this.editedRecord,this.rowData),a.editModule.validateUpdateValues(s,this.rowData,!0))},e.prototype.updateScheduleProperties=function(e,i){this.parent.setRecordValue("startDate",e.ganttProperties.startDate,i.ganttProperties,!0),this.parent.setRecordValue("endDate",e.ganttProperties.endDate,i.ganttProperties,!0),this.parent.setRecordValue("duration",e.ganttProperties.duration,i.ganttProperties,!0),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,i.ganttProperties,!0),this.parent.setRecordValue("work",e.ganttProperties.work,i.ganttProperties,!0),this.parent.setRecordValue("type",e.ganttProperties.taskType,i.ganttProperties,!0),this.parent.setRecordValue("resourceNames",e.ganttProperties.resourceNames,i.ganttProperties,!0),this.parent.setRecordValue("resourceInfo",e.ganttProperties.resourceInfo,i.ganttProperties,!0),t.isNullOrUndefined(this.parent.taskFields.startDate)||this.parent.dataOperation.updateMappingData(i,this.parent.taskFields.startDate),t.isNullOrUndefined(this.parent.taskFields.endDate)||this.parent.dataOperation.updateMappingData(i,this.parent.taskFields.endDate),t.isNullOrUndefined(this.parent.taskFields.duration)||(this.parent.dataOperation.updateMappingData(i,this.parent.taskFields.duration),this.parent.setRecordValue("durationUnit",e.ganttProperties.durationUnit,this.rowData,!0),0===this.rowData.ganttProperties.duration?this.parent.setRecordValue("isMilestone",!0,i.ganttProperties,!0):this.parent.setRecordValue("isMilestone",!1,this.rowData.ganttProperties,!0)),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(this.rowData,this.parent.taskFields.work),t.isNullOrUndefined(this.parent.taskFields.manual)||this.parent.dataOperation.updateMappingData(this.rowData,this.parent.taskFields.manual),t.isNullOrUndefined(this.parent.taskFields.type)||this.parent.dataOperation.updateMappingData(this.rowData,"type"),t.isNullOrUndefined(this.parent.taskFields.resourceInfo)||this.parent.dataOperation.updateMappingData(this.rowData,"resourceInfo")},e.prototype.updatePredecessorTab=function(e){var t=e.ej2_instances[0];t.isEdit&&t.endEdit();for(var i=t.dataSource,r=[],a=[],n="",s=[],o=0;o<i.length;o++){var l=i[o];if(-1===s.indexOf(l.id)){var d=l.id+l.type;l.offset&&-1!==l.offset.indexOf("-")?d+=l.offset:d+="+"+l.offset,r.push(d),s.push(l.id)}}this.isEdit?(r.length>0?(a=this.parent.predecessorModule.calculatePredecessor(r.join(","),this.rowData),this.parent.setRecordValue("predecessor",a,this.rowData.ganttProperties,!0),n=this.parent.predecessorModule.getPredecessorStringValue(this.rowData)):(a=[],this.parent.setRecordValue("predecessor",a,this.rowData.ganttProperties,!0),n=""),this.parent.setRecordValue("predecessorsName",n,this.rowData.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,n,this.rowData),this.parent.setRecordValue(this.parent.taskFields.dependency,n,this.rowData),this.parent.predecessorModule.updateUnscheduledDependency(this.rowData)):this.addedRecord[this.parent.taskFields.dependency]=r.length>0?r.join(","):""},e.prototype.updateResourceTab=function(e){var i=e.ej2_instances[0];i&&i.grid.endEdit();var r=this.ganttResources;"ResourceView"!==this.parent.viewType||t.isNullOrUndefined(this.rowData.ganttProperties)||(JSON.stringify(this.ganttResources)!==JSON.stringify(this.rowData.ganttProperties.resourceInfo)?(this.isResourceUpdate=!0,this.previousResource=t.isNullOrUndefined(this.rowData.ganttProperties.resourceInfo)?[]:this.rowData.ganttProperties.resourceInfo.slice()):this.isResourceUpdate=!1);var a=[];if(this.isEdit)this.parent.setRecordValue("resourceInfo",r,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(var n=0;n<r.length;n++)a.push(r[n][this.parent.resourceFields.id]),this.isAddNewResource=!0;this.addedRecord[this.parent.taskFields.resourceInfo]=a}},e.prototype.updateNotesTab=function(e){var t=this.parent,i=e.ej2_instances[0];this.isEdit?(!1===t.columnByField[t.taskFields.notes].disableHtmlEncode?this.parent.setRecordValue("notes",i.getHtml(),this.rowData.ganttProperties,!0):this.parent.setRecordValue("notes",i.getText(),this.rowData.ganttProperties,!0),t.dataOperation.updateMappingData(this.rowData,"notes")):this.addedRecord[this.parent.taskFields.notes]=i.getHtml()},e.prototype.updateCustomTab=function(e){this.updateGeneralTab(e,!0)},e}(),oi=function(){function e(e){this.validationPredecessor=null,this.confirmPredecessorDialog=null,this.predecessorIndex=null,this.childRecord=null,this.parent=e,this.dateValidateModule=this.parent.dateValidationModule,this.parent.on("initPredessorDialog",this.initPredecessorValidationDialog,this)}return e.prototype.updateConnectorLineEditElement=function(e){var i=this.getConnectorLineHoverElement(e.target);t.getValue("editModule.taskbarEditModule.taskBarEditAction",this.parent)||this.highlightConnectorLineElements(i)},e.prototype.getConnectorLineHoverElement=function(e){var t=f(e,Te),i=f(e,Se),r=f(e,be),a=f(e,Pe);return t||i||r||a?f(e,ke):null},e.prototype.highlightConnectorLineElements=function(e){e?e!==this.connectorLineElement&&(this.removeHighlight(),this.addHighlight(e)):this.removeHighlight()},e.prototype.addHighlight=function(e){this.connectorLineElement=e;var t=e.querySelector("."+Te),i=e.querySelector("."+be);t?t.setAttribute("stroke-width","2"):i.setAttribute("stroke-width","2")},e.prototype.removeHighlight=function(){if(this.connectorLineElement){var e=this.connectorLineElement.querySelector("."+Te),t=this.connectorLineElement.querySelector("."+be);e?e.setAttribute("stroke-width","1"):t.setAttribute("stroke-width","1"),this.connectorLineElement=null}},e.prototype.getEditedConnectorLineString=function(e){for(var i,r,a,n,s,o,l=[],d=[],h="",p=0;p<e.length;p++)if(i=e[p],r=i.ganttProperties.predecessor){for(var c=0;c<r.length;c++){a=r[c];if(this.parent.connectorLineModule.removeConnectorLineById("parent"+a.from+"child"+a.to),n=this.parent.connectorLineModule.getRecordByID(a.from),s=this.parent.connectorLineModule.getRecordByID(a.to),(!this.parent.allowParentDependency&&n&&!0===n.expanded||s&&!0===s.expanded||this.parent.allowParentDependency&&(n||s))&&(o=this.parent.predecessorModule.updateConnectorLineObject(n,s,a),!t.isNullOrUndefined(o))){var u=l.indexOf(o.connectorLineId),g=this.parent.connectorLineModule.getConnectorLineTemplate(o);-1!==u?d[u]=g:(l.push(o.connectorLineId),d.push(g))}}h=d.join("")}return h},e.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);var t=this.getEditedConnectorLineString(e);this.parent.connectorLineModule.svgObject.innerHTML=this.parent.connectorLineModule.svgObject.innerHTML+t},e.prototype.idFromPredecessor=function(e){for(var i,r=e.split(","),a=[],n=[],s=0;s<r.length;s++){var o=[];if(i=r[s].split("+"),r[s].indexOf("-")>=0&&(i=r[s].split("-")),!t.isNullOrUndefined(i[0])){-1===("ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids).indexOf(i[0])?-1!==i[0].indexOf(" ")?(1===(n=i[0].split(" ")).length&&(n=i[0].match(/(\d+|[A-z]+)/g)),o.push(n[0])):1===i[0].length||2===i[0].length?o.push(i[0]):o.push(i[0].slice(0,-2)):o.push(i[0])}a.push(o.join(""))}return a},e.prototype.predecessorValidation=function(e,i){for(var r,a,n=i.rowUniqueID,s=0;s<e.length;s++){r=e[s];var o=[];e.slice(0).splice(s,1);for(var l=function(){var e=[];return-1!==o.indexOf(r)?"break":t.isNullOrUndefined(d.parent.connectorLineModule.getRecordByID(r))?{value:!1}:(a=d.parent.connectorLineModule.getRecordByID(r).ganttProperties,!t.isNullOrUndefined(a.predecessor)&&a.predecessor.length>0&&a.predecessor.forEach(function(t){a.rowUniqueID.toString()!==t.from&&e.push(t.from.toString())}),n.toString()===a.rowUniqueID.toString()||-1!==e.indexOf(n.toString())?{value:!1}:(o.push(r),!t.isNullOrUndefined(a.predecessor)&&a.predecessor.length>0?void(r=a.predecessor[0].from):"break"))},d=this;null!==r;){var h=l();if("object"==typeof h)return h.value;if("break"===h)break}}return!0},e.prototype.getRootParent=function(e){var t=e;return e.parentItem?((t=this.parent.flatData.filter(function(t){return t.uniqueID===e.parentUniqueID})[0]).parentItem&&(t=this.getRootParent(t)),t):t},e.prototype.validateParentPredecessor=function(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.parent.connectorLineEditModule.getRootParent(e).uniqueID===t.uniqueID)return!1}else if(t.parentItem&&!e.parentItem){if(this.parent.connectorLineEditModule.getRootParent(t).uniqueID===e.uniqueID)return!1}return!0},e.prototype.validatePredecessorRelation=function(e,i){var r,a,n=!0,s="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(!t.isNullOrUndefined(i)&&i.length>0){r=this.idFromPredecessor(i);for(var o=function(i){if(l.parent.allowParentDependency){if(parseInt(r[r.length-1])!==e[l.parent.taskFields.id]){var o=l.parent.ids.indexOf(r[r.length-1]),d=l.parent.currentViewData[o];d&&e&&(n=l.validateParentPredecessor(d,e))}}else{if(!l.checkParentRelation(e,r))return{value:!1}}var h=[],p=!0;if(r.slice(0).forEach(function(e){-1===h.indexOf(e)?h.push(e):p=!1}),!p)return{value:!1};a=r[i];var c=[];r.slice(0).splice(i,1);for(var u=function(){var i,r,n=[];if(-1!==c.indexOf(a))return"break";if(t.isNullOrUndefined(l.parent.connectorLineModule.getRecordByID(a.toString())))return{value:!1};if(r=l.parent.connectorLineModule.getRecordByID(a.toString()).ganttProperties,!t.isNullOrUndefined(r.predecessor)&&r.predecessor.length>0&&r.predecessor.forEach(function(e,t){r.rowUniqueID.toString()!==e.from&&(n.push(e.from.toString()),i=t)}),s.toString()===r.rowUniqueID.toString()||-1!==n.indexOf(s.toString()))return{value:!1};if(c.push(a),t.isNullOrUndefined(r.predecessor)||!(r.predecessor.length>0))return"break";var o=void 0;return n.length>1?o=l.predecessorValidation(n,e.ganttProperties):1===n.length&&(a=r.predecessor[i].from),!1===o?{value:!1}:void 0};null!==a;){var g=u();if("object"==typeof g)return g;if("break"===g)break}},l=this,d=0;d<r.length;d++){var h=o(d);if("object"==typeof h)return h.value}}return n},e.prototype.addPredecessor=function(e,i){var r=t.isNullOrUndefined(e.ganttProperties.predecessorsName)||""===e.ganttProperties.predecessorsName?i:e.ganttProperties.predecessorsName+","+i;this.updatePredecessorHelper(e,r)},e.prototype.removePredecessor=function(e){this.updatePredecessorHelper(e,null)},e.prototype.updatePredecessor=function(e,t,i){return this.updatePredecessorHelper(e,t,i)},e.prototype.updatePredecessorHelper=function(e,i,r){if(t.isUndefined(i)||this.validatePredecessorRelation(e,i)){this.parent.isOnEdit=!0;var a=[];t.isNullOrUndefined(i)||""===i||(a=this.parent.predecessorModule.calculatePredecessor(i,e)),this.parent.setRecordValue("predecessor",a,e.ganttProperties,!0);var n=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",n,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,n,e),this.parent.setRecordValue(this.parent.taskFields.dependency,n,e);var s={};return s.action=r&&r.action&&"CellEditing"===r.action?r.action:"DrawConnectorLine",s.data=e,this.parent.editModule.initiateUpdateAction(s),!0}return!1},e.prototype.checkParentRelation=function(e,t){var i=e;if(i&&i.parentItem&&-1!==t.indexOf(i.parentItem.taskId.toString()))return!1;for(var r=function(e){var i=a.parent.currentViewData.filter(function(i){return i&&i.ganttProperties.rowUniqueID.toString()===t[e].toString()});if(i[0]&&i[0].hasChildRecords)return{value:!1}},a=this,n=0;n<t.length;n++){var s=r(n);if("object"==typeof s)return s.value}return!0},e.prototype.initPredecessorValidationDialog=function(){if(this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation){var e=t.createElement("div",{id:this.parent.element.id+"_dialogValidationRule"});this.parent.element.appendChild(e),this.renderValidationDialog()}},e.prototype.renderValidationDialog=function(){var e=new i.Dialog({header:"Validate Editing",isModal:!0,enableRtl:this.parent.enableRtl,visible:!1,width:"50%",showCloseIcon:!0,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:this.parent.element,animationSettings:{effect:"None"}});document.getElementById(this.parent.element.id+"_dialogValidationRule").innerHTML="",e.isStringTemplate=!0,e.appendTo("#"+this.parent.element.id+"_dialogValidationRule"),this.parent.validationDialogElement=e},e.prototype.validationDialogOkButton=function(){var e=this.parent.currentEditedArgs;e.validateMode.preserveLinkWithEditing=document.getElementById(this.parent.element.id+"_ValidationAddlineOffset").checked,e.validateMode.removeLink=document.getElementById(this.parent.element.id+"_ValidationRemoveline").checked,e.validateMode.respectLink=document.getElementById(this.parent.element.id+"_ValidationCancel").checked,this.applyPredecessorOption(),this.parent.validationDialogElement.hide()},e.prototype.validationDialogCancelButton=function(){this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption(),this.parent.validationDialogElement.hide()},e.prototype.validationDialogClose=function(e){t.getValue("isInteraction",e)&&(this.parent.currentEditedArgs.validateMode.respectLink=!0,this.applyPredecessorOption())},e.prototype.applyPredecessorOption=function(){var e=this.parent.currentEditedArgs,t=e.data;e.validateMode.respectLink?(this.parent.editModule.reUpdatePreviousRecords(),this.parent.chartRowsModule.refreshRecords([e.data])):e.validateMode.removeLink?(this.checkChildRecords(t),this.parent.editModule.updateEditedTask(e.editEventArgs)):e.validateMode.preserveLinkWithEditing&&(this.parent.UpdateOffsetOnTaskbarEdit&&this.calculateOffset(t),this.parent.editModule.updateEditedTask(e.editEventArgs))},e.prototype.checkChildRecords=function(e){if(this.validationPredecessor=e.ganttProperties.predecessor,t.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(e,this.validationPredecessor),e.childRecords.length>0)for(var i=0;i<e.childRecords.length;i++){var r=e.childRecords[i];this.validationPredecessor=r.ganttProperties.predecessor,t.isNullOrUndefined(this.validationPredecessor)||this.removePredecessors(r,this.validationPredecessor),r.childRecords.length>0&&this.checkChildRecords(r)}else if(!t.isNullOrUndefined(e.parentItem)){var a=this.parent.getRecordByID(e.parentItem.taskId);this.validationPredecessor=a.ganttProperties.predecessor,this.removePredecessors(a,this.validationPredecessor)}},e.prototype.calculateOffset=function(e){for(var i=t.extend([],e.ganttProperties.predecessor,[],!0),r=this.parent.predecessorModule.getValidPredecessor(e),a=0;a<r.length;a++){var n=r[parseInt(a.toString(),10)],s=this.parent.connectorLineModule.getRecordByID(n.from),o=void 0;if(m(s.ganttProperties)&&m(e.ganttProperties)){var l=void 0,d=void 0,h=void 0,p=void 0;switch(n.type){case"FS":l=new Date(s.ganttProperties.endDate.getTime()),d=new Date(e.ganttProperties.startDate.getTime());break;case"SS":l=new Date(s.ganttProperties.startDate.getTime()),d=new Date(e.ganttProperties.startDate.getTime());break;case"SF":l=new Date(s.ganttProperties.startDate.getTime()),d=new Date(e.ganttProperties.endDate.getTime());break;case"FF":l=new Date(s.ganttProperties.endDate.getTime()),d=new Date(e.ganttProperties.endDate.getTime())}if(l.getTime()<d.getTime())l=this.dateValidateModule.checkStartDate(l),d=this.dateValidateModule.checkEndDate(d,null),p=!1;else{var c=new Date(l.getTime());l=this.dateValidateModule.checkStartDate(d),d=this.dateValidateModule.checkEndDate(c,null),p=!0}l.getTime()<d.getTime()?(h=this.dateValidateModule.getDuration(l,d,n.offsetUnit,!0,!1),o=p?-1*h:h):o=0}else o=0;i[b(n,"from",i,"to")].offset=o;var u=t.extend([],s.ganttProperties.predecessor,[],!0);u[b(n,"from",u,"to")].offset=o,this.parent.setRecordValue("predecessor",u,s.ganttProperties,!0)}this.parent.setRecordValue("predecessor",i,e.ganttProperties,!0);var g=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,g,e),this.parent.setRecordValue(this.parent.taskFields.dependency,g,e),this.parent.setRecordValue("predecessorsName",g,e.ganttProperties,!0)},e.prototype.removePredecessors=function(e,i){var r=t.extend([],[],e.ganttProperties.predecessor,!0);if(!t.isNullOrUndefined(i)){for(var a=i.length,n=0;n<a;n++){var s=this.parent.connectorLineModule.getRecordByID(i[n].from),o=t.extend([],[],s.ganttProperties.predecessor,!0),l=b(i[n],"from",r,"to");r.splice(l,1);var d=b(i[parseInt(n.toString(),10)],"from",o,"to");o.splice(d,1),this.parent.setRecordValue("predecessor",o,s.ganttProperties,!0)}if(r.length!==e.ganttProperties.predecessor.length){this.parent.setRecordValue("predecessor",r,e.ganttProperties,!0);var h=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",h,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,h,e),this.parent.setRecordValue(this.parent.taskFields.dependency,h,e)}}},e.prototype.openValidationDialog=function(e){var t=this.validationDialogTemplate(e);this.parent.validationDialogElement.setProperties({content:t}),this.parent.validationDialogElement.show()},e.prototype.validationDialogTemplate=function(e){var i,r=this.parent.element.id,a=t.createElement("div",{className:"e-ValidationContent"}),n=t.getValue("task",e),s=t.getValue("parentTask",e),o=t.getValue("violationType",e),l=n.ganttProperties.taskName,d=this.parent.getFormatedDate(n.ganttProperties.startDate,"MM/dd/yyyy"),h=[l,s.ganttProperties.taskName];"taskBeforePredecessor_FS"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_FS"):"taskAfterPredecessor_FS"===o?i=this.parent.localeObj.getConstant("taskAfterPredecessor_FS"):"taskBeforePredecessor_SS"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_SS"):"taskAfterPredecessor_SS"===o?i=this.parent.localeObj.getConstant("taskAfterPredecessor_SS"):"taskBeforePredecessor_FF"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_FF"):"taskAfterPredecessor_FF"===o?i=this.parent.localeObj.getConstant("taskAfterPredecessor_FF"):"taskBeforePredecessor_SF"===o?i=this.parent.localeObj.getConstant("taskBeforePredecessor_SF"):"taskAfterPredecessor_SF"===o&&(i=this.parent.localeObj.getConstant("taskAfterPredecessor_SF"));var p='<div id="'+r+'_ValidationText">'+(i=T(i,h))+"<div>",c='<table><tr><td><input type="radio" id="'+r+'_ValidationCancel" name="ValidationRule" checked/><label for="'+r+'_ValidationCancel" id= "'+r+'_cancelLink">Cancel, keep the existing link</label></td></tr><tr><td><input type="radio" id="'+r+'_ValidationRemoveline" name="ValidationRule"/><label for="'+r+'_ValidationRemoveline" id="'+r+'_removeLink">Remove the link and move <b>'+l+"</b> to start on <b>"+d+'</b>.</label></td></tr><tr><td><input type="radio" id="'+r+'_ValidationAddlineOffset" name="ValidationRule"/><label for="'+r+'_ValidationAddlineOffset" id="'+r+'_preserveLink">Move the <b>'+l+"</b> to start on <b>"+d+"</b> and keep the link.</label></td></tr></table>";return a.innerHTML=p+c,a},e.prototype.validateTypes=function(e,i){var r,a=this.parent.predecessorModule.getValidPredecessor(e);this.validationPredecessor=[];var n,s,o,l=this.parent.predecessorModule.getPredecessorDate(e,a);s=i?i.ganttProperties:e.ganttProperties;for(var d=this.parent.allowUnscheduledTasks&&t.isNullOrUndefined(l)?s.endDate:this.dateValidateModule.getEndDate(l,s.duration,s.durationUnit,s,!1),h=0;h<a.length;h++){r=this.parent.connectorLineModule.getRecordByID(a[h].from);var p=null;"FS"===a[h].type?s.startDate<l?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FS"):s.startDate>l&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FS"):"SS"===a[h].type?s.startDate<l?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SS"):s.startDate>l&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SS"):"FF"===a[h].type?d<=r.ganttProperties.endDate?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_FF"):d>r.ganttProperties.endDate&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_FF"):"SF"===a[h].type&&(d<r.ganttProperties.startDate?(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskBeforePredecessor_SF"):d>=r.ganttProperties.startDate&&(this.validationPredecessor.push(a[parseInt(h.toString(),10)]),p="taskAfterPredecessor_SF")),!t.isNullOrUndefined(p)&&t.isNullOrUndefined(o)&&(n=r,o=p)}return{parentTask:n,task:e,violationType:o}},e.prototype.addRemovePredecessor=function(e){var i=this.parent.previousRecords[e.uniqueID],r=e.ganttProperties.predecessor.slice();if(i&&i.ganttProperties&&i.ganttProperties.hasOwnProperty("predecessor")){var a=i.ganttProperties.predecessor;if(!t.isNullOrUndefined(a))for(var n=0;n<a.length;n++){if((d=this.parent.connectorLineModule.getRecordByID(a[parseInt(n.toString(),10)].from))===e)e.ganttProperties.predecessor.push(a[parseInt(n.toString(),10)]);else{var s=t.extend([],[],d.ganttProperties.predecessor,!0),o=b(a[parseInt(n.toString(),10)],"from",s,"to");-1!==o&&(s.splice(o,1),this.parent.setRecordValue("predecessor",s,d.ganttProperties,!0))}}if(!t.isNullOrUndefined(r))for(var l=0;l<r.length;l++){var d=this.parent.connectorLineModule.getRecordByID(r[parseInt(l.toString(),10)].from);(s=t.extend([],[],d.ganttProperties.predecessor,!0)).push(r[parseInt(l.toString(),10)]),this.parent.setRecordValue("predecessor",s,d.ganttProperties,!0)}}},e.prototype.removePredecessorByIndex=function(e,t){var i=e.ganttProperties.predecessor,r=i.splice(t,1),a=this.parent.connectorLineModule.getRecordByID(r[0].from).ganttProperties.predecessor,n=b(r[0],"from",a,"to");a.splice(n,1);var s=this.parent.predecessorModule.getPredecessorStringValue(e);i.push(r[0]),this.parent.connectorLineEditModule.updatePredecessor(e,s)},e.prototype.renderPredecessorDeleteConfirmDialog=function(){this.confirmPredecessorDialog=new i.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=t.createElement("div",{id:this.parent.element.id+"_deletePredecessorConfirmDialog"});this.parent.element.appendChild(e),this.confirmPredecessorDialog.isStringTemplate=!0,this.confirmPredecessorDialog.appendTo(e)},e.prototype.confirmCloseDialog=function(){this.confirmPredecessorDialog.destroy()},e.prototype.confirmOkDeleteButton=function(){this.removePredecessorByIndex(this.childRecord,this.predecessorIndex),this.confirmPredecessorDialog.destroy()},e}(),li=function(){function e(e){if(this.isFromDeleteMethod=!1,this.targetedRecords=[],this.isNewRecordAdded=!1,this.isValidatedEditedRecord=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.confirmDialog=null,this.taskbarMoved=!1,this.predecessorUpdated=!1,this.isBreakLoop=!1,this.isResourceTaskDeleted=!1,this.deletedTaskDetails=[],this.parent=e,this.validatedChildItems=[],this.parent.editSettings.allowEditing&&"Auto"===this.parent.editSettings.mode&&(this.cellEditModule=new ti(this.parent)),this.parent.taskFields.dependency&&(this.parent.connectorLineEditModule=new oi(this.parent)),(this.parent.editSettings.allowAdding||this.parent.editSettings.allowEditing&&("Dialog"===this.parent.editSettings.mode||"Auto"===this.parent.editSettings.mode))&&(this.dialogModule=new si(this.parent)),this.parent.editSettings.allowTaskbarEditing&&(this.taskbarEditModule=new ni(this.parent)),this.parent.editSettings.allowDeleting){var i=t.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"});this.parent.element.appendChild(i),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,this.updateDefaultColumnEditors()}return e.prototype.getModuleName=function(){return"edit"},e.prototype.updateDefaultColumnEditors=function(){for(var e=[this.parent.taskFields.id,this.parent.taskFields.progress,this.parent.taskFields.resourceInfo,"taskType"],i=0;i<e.length;i++)if(!t.isNullOrUndefined(e[i])&&e[i].length>0){var r=this.parent.getColumnByField(e[i],this.parent.treeGridModule.treeGridColumns);r&&(r.field===this.parent.taskFields.id?this.updateIDColumnEditParams(r):r.field===this.parent.taskFields.progress&&t.isNullOrUndefined(r.edit)?this.updateProgessColumnEditParams(r):r.field===this.parent.taskFields.resourceInfo?this.updateResourceColumnEditor(r):"taskType"===r.field&&this.updateTaskTypeColumnEditor(r))}},e.prototype.updateIDColumnEditParams=function(e){var t={min:0,decimals:0,enableRtl:this.parent.enableRtl,validateDecimalOnType:!0,format:"n0",showSpinButton:!1};this.updateEditParams(e,t)},e.prototype.updateProgessColumnEditParams=function(e){var t={min:0,enableRtl:this.parent.enableRtl,decimals:0,validateDecimalOnType:!0,max:100,format:"n0"};this.updateEditParams(e,t)},e.prototype.updateEditParams=function(e,i){t.isNullOrUndefined(e.edit)?(e.edit={},e.edit.params={}):t.isNullOrUndefined(e.edit.params)&&(e.edit.params={}),t.extend(i,e.edit.params),e.edit.params=i;this.parent.getColumnByField(e.field,this.parent.ganttColumns).edit=e.edit},e.prototype.updateResourceColumnEditor=function(e){if(this.parent.editSettings.allowEditing&&t.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode){e.editType="dropdownedit",e.edit=this.getResourceEditor();var i=this.parent.getColumnByField(e.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=e.edit}},e.prototype.getResourceEditor=function(){var e,i=this,r=this.parent.resourceFields,n={};return u.MultiSelect.Inject(u.CheckBoxSelection),n.write=function(t){i.parent.treeGridModule.currentEditRow={},(e=new u.MultiSelect({dataSource:new a.DataManager(i.parent.resources),fields:{text:r.name,value:r.id},enableRtl:i.parent.enableRtl,mode:"CheckBox",showDropDownIcon:!0,popupHeight:"350px",delimiterChar:",",value:i.parent.treeGridModule.getResourceIds(t.rowData)})).appendTo(t.element)},n.read=function(e){var a=e.ej2_instances[0].value,n=[];t.isNullOrUndefined(a)&&(a=[]);for(var s=0;s<a.length;s++)for(var o=0;o<i.parent.resources.length;o++)if(i.parent.resources[o][r.id]===a[s]){n.push(i.parent.resources[o][r.name]);break}return i.parent.treeGridModule.currentEditRow[i.parent.taskFields.resourceInfo]=a,n.join(",")},n.destroy=function(){e&&e.destroy()},n},e.prototype.updateTaskTypeColumnEditor=function(e){if(this.parent.editSettings.allowEditing&&t.isNullOrUndefined(e.edit)&&"Auto"===this.parent.editSettings.mode){e.editType="dropdownedit",e.edit=this.getTaskTypeEditor();var i=this.parent.getColumnByField(e.field,this.parent.ganttColumns);i.editType="dropdownedit",i.edit=e.edit}},e.prototype.getTaskTypeEditor=function(){var e,i=this,r={},n=[{ID:1,Value:"FixedUnit"},{ID:2,Value:"FixedWork"},{ID:3,Value:"FixedDuration"}];return r.write=function(r){i.parent.treeGridModule.currentEditRow={},(e=new u.DropDownList({dataSource:new a.DataManager(n),enableRtl:i.parent.enableRtl,fields:{value:"Value"},popupHeight:"350px",value:t.getValue("taskType",r.rowData.ganttProperties)})).appendTo(r.element)},r.read=function(e){var t=e.ej2_instances[0].value;return i.parent.treeGridModule.currentEditRow.taskType=t,t},r.destroy=function(){e&&e.destroy()},r},e.prototype.reUpdateEditModules=function(){var e=this.parent.editSettings;if(e.allowEditing?(this.parent.editModule.cellEditModule&&"Dialog"===e.mode?(this.cellEditModule.destroy(),this.parent.treeGrid.recordDoubleClick=this.recordDoubleClick.bind(this)):t.isNullOrUndefined(this.parent.editModule.cellEditModule)&&"Auto"===e.mode&&(this.cellEditModule=new ti(this.parent)),this.parent.editModule.dialogModule&&"Auto"===e.mode?this.parent.treeGrid.recordDoubleClick=void 0:t.isNullOrUndefined(this.parent.editModule.dialogModule)&&(this.dialogModule=new si(this.parent))):(this.cellEditModule&&this.cellEditModule.destroy(),this.dialogModule&&this.dialogModule.destroy()),e.allowDeleting&&e.showDeleteConfirmDialog){if(t.isNullOrUndefined(this.confirmDialog)){var i=t.createElement("div",{id:this.parent.element.id+"_deleteConfirmDialog"});this.parent.element.appendChild(i),this.renderDeleteConfirmDialog()}}else e.allowDeleting&&e.showDeleteConfirmDialog||this.confirmDialog&&!this.confirmDialog.isDestroyed&&this.confirmDialog.destroy();e.allowTaskbarEditing?t.isNullOrUndefined(this.parent.editModule.taskbarEditModule)&&(this.taskbarEditModule=new ni(this.parent)):this.taskbarEditModule&&this.taskbarEditModule.destroy()},e.prototype.recordDoubleClick=function(e){if(this.parent.editSettings.allowEditing&&"Dialog"===this.parent.editSettings.mode){var i=void 0;if(e.row){var r=t.getValue("rowIndex",e.row);i=this.parent.currentViewData[r]}t.isNullOrUndefined(i)||this.dialogModule.openEditDialog(i)}this.parent.ganttChartModule.recordDoubleClick(e)},e.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()},e.prototype.updateRecordByID=function(e){if(!this.parent.readOnly){var i=this.parent.taskFields;if(t.isNullOrUndefined(e)||t.isNullOrUndefined(e[i.id]))return;var r="ResourceView"===this.parent.viewType?this.parent.flatData[this.parent.getTaskIds().indexOf("T"+e[i.id])]:this.parent.getRecordByID(e[i.id]);if(!t.isNullOrUndefined(this.parent.editModule)&&r){this.parent.isOnEdit=!0,this.validateUpdateValues(e,r,!0),e[this.parent.taskFields.resourceInfo]&&(0===r.ganttProperties.duration&&this.parent.dataOperation.updateWorkWithDuration(r),this.updateResourceRelatedFields(r,"resource"),this.parent.dateValidationModule.calculateEndDate(r));var a=Object.keys(e);if(-1===a.indexOf(i.startDate)&&-1===a.indexOf(i.endDate)&&-1===a.indexOf(i.duration)||this.parent.dataOperation.calculateScheduledValues(r,r.taskData,!1),this.parent.dataOperation.updateWidthLeft(r),t.isUndefined(e[this.parent.taskFields.dependency])||e[this.parent.taskFields.dependency]===r.ganttProperties.predecessorsName){var n={};n.data=r,"ResourceView"===this.parent.viewType&&(n.action="methodUpdate"),this.parent.editModule.initiateUpdateAction(n)}else this.parent.connectorLineEditModule.updatePredecessor(r,e[this.parent.taskFields.dependency])}}},e.prototype.validateUpdateValues=function(e,i,r){for(var a=this.parent,n=a.taskFields,s=D(a.columnMapping),o=[],l=!1,d=0,h=Object.keys(e);d<h.length;d++){var p=h[d];if(-1!==[n.startDate,n.endDate,n.duration].indexOf(p)){if(t.isNullOrUndefined(e[""+p])&&!a.allowUnscheduledTasks)continue;if(r)if(n.duration===p)a.dataOperation.updateDurationValue(e[p],i.ganttProperties),i.ganttProperties.duration>0&&i.ganttProperties.isMilestone&&this.parent.setRecordValue("isMilestone",!1,i.ganttProperties,!0),a.dataOperation.updateMappingData(i,s[p]);else{var c="string"==typeof e[p]?new Date(e[p]):e[p];a.setRecordValue(s[p],c,i.ganttProperties,!0),a.dataOperation.updateMappingData(i,s[p])}else o.push(p),l=!0}else if(n.resourceInfo===p){var u=a.dataOperation.setResourceInfo(e);"ResourceView"===this.parent.viewType&&(JSON.stringify(u)!==JSON.stringify(i.ganttProperties.resourceInfo)?(this.parent.editModule.dialogModule.isResourceUpdate=!0,this.parent.editModule.dialogModule.previousResource=t.isNullOrUndefined(i.ganttProperties.resourceInfo)?[]:i.ganttProperties.resourceInfo.slice()):this.parent.editModule.dialogModule.isResourceUpdate=!1),i.ganttProperties.resourceInfo=u,a.dataOperation.updateMappingData(i,"resourceInfo")}else if(n.dependency===p);else if(-1!==[n.progress,n.notes,n.durationUnit,n.expandState,n.milestone,n.name,n.baselineStartDate,n.baselineEndDate,n.id,n.segments,n.cssClass].indexOf(p)){var g=a.columnByField[p],f=e[p];t.isNullOrUndefined(g)||"datepickeredit"!==g.editType&&"datetimepickeredit"!==g.editType||(f=a.dataOperation.getDateFromFormat(f));var m=s[p];if(p===n.id)m="taskId";else if(p===n.name)m="taskName";else if(p===n.cssClass)m="cssClass";else if(p===n.segments&&!t.isNullOrUndefined(i.ganttProperties.segments)&&(m="segments",e&&!t.isNullOrUndefined(e[this.parent.taskFields.segments])&&e[this.parent.taskFields.segments].length>0)){for(var y=0,v=0;v<i.ganttProperties.segments.length;v++)y+=i.ganttProperties.segments[v].duration;var w=i.ganttProperties.startDate,k=this.parent.dataOperation.getEndDate(w,y,i.ganttProperties.durationUnit,i.ganttProperties,!1);a.setRecordValue("endDate",a.dataOperation.getDateFromFormat(k),i.ganttProperties,!0)}t.isNullOrUndefined(m)||a.setRecordValue(m,f,i.ganttProperties,!0),(p===n.baselineStartDate||p===n.baselineEndDate)&&i.ganttProperties.baselineStartDate&&i.ganttProperties.baselineEndDate&&(a.setRecordValue("baselineStartDate",a.dataOperation.checkBaselineStartDate(i.ganttProperties.baselineStartDate),i.ganttProperties,!0),i.ganttProperties.baselineEndDate&&0===i.ganttProperties.baselineEndDate.getHours()&&86400!==this.parent.defaultEndTime&&a.dataOperation.setTime(this.parent.defaultEndTime,i.ganttProperties.baselineEndDate),a.setRecordValue("baselineEndDate",a.dataOperation.checkBaselineEndDate(i.ganttProperties.baselineEndDate),i.ganttProperties,!0),a.setRecordValue("baselineLeft",a.dataOperation.calculateBaselineLeft(i.ganttProperties),i.ganttProperties,!0),a.setRecordValue("baselineWidth",a.dataOperation.calculateBaselineWidth(i.ganttProperties),i.ganttProperties,!0)),a.setRecordValue("taskData."+p,f,i),p===n.segments&&e&&!t.isNullOrUndefined(e[this.parent.taskFields.segments])&&e[this.parent.taskFields.segments].length>0&&a.dataOperation.setSegmentsInfo(i,!0),a.setRecordValue(p,f,i)}else if(n.indicators===p){f=e[p];a.setRecordValue("indicators",f,i.ganttProperties,!0),a.setRecordValue("taskData."+p,f,i),a.setRecordValue(p,f,i)}else if(n.work===p)a.setRecordValue("work",e[p],i.ganttProperties,!0),this.parent.dataOperation.updateMappingData(i,"work"),this.parent.dataOperation.updateMappingData(i,"duration"),this.parent.dataOperation.updateMappingData(i,"endDate");else if(p===n.type)a.setRecordValue("taskType",e[p],i.ganttProperties,!0);else if(-1!==a.customColumns.indexOf(p)){g=a.columnByField[p],f=e[p];t.isNullOrUndefined(g.edit)&&("datepickeredit"!==g.editType&&"datetimepickeredit"!==g.editType||(f=a.dataOperation.getDateFromFormat(f))),a.setRecordValue("taskData."+p,f,i),a.setRecordValue(p,f,i)}else n.manual===p&&(a.setRecordValue("isAutoSchedule",!e[p],i.ganttProperties,!0),this.parent.setRecordValue(p,e[p],i),this.updateTaskScheduleModes(i))}l&&this.validateScheduleValues(o,i,e)},e.prototype.updateResourceRelatedFields=function(e,i){var r=e.ganttProperties,a=r.taskType,n=r.isAutoSchedule;if(!t.isNullOrUndefined(r.resourceInfo))if(r.work>0||"work"===i)switch(a){case"FixedUnit":if(0===r.resourceInfo.length)return;n&&r.resourceInfo.length&&("work"===i||"resource"===i)?this.parent.dataOperation.updateDurationWithWork(e):n||"work"!==i?this.parent.dataOperation.updateWorkWithDuration(e):this.parent.dataOperation.updateUnitWithWork(e);break;case"FixedWork":if(0===r.resourceInfo.length)return;n?"duration"===i||"endDate"===i?(this.parent.dataOperation.updateUnitWithWork(e),0===r.duration&&(this.parent.setRecordValue("work",0,r,!0),t.isNullOrUndefined(this.parent.taskFields.work)||this.parent.dataOperation.updateMappingData(e,"work"))):this.parent.dataOperation.updateDurationWithWork(e):"work"===i?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e);break;case"FixedDuration":r.resourceInfo.length&&"work"===i?this.parent.dataOperation.updateUnitWithWork(e):this.parent.dataOperation.updateWorkWithDuration(e)}else this.parent.dataOperation.updateWorkWithDuration(e)},e.prototype.validateScheduleValues=function(e,t,i){var r=this.parent;e.length>2?r.dataOperation.calculateScheduledValues(t,i,!1):e.length>1?this.validateScheduleByTwoValues(i,e,t):this.dialogModule.validateScheduleValuesByCurrentField(e[0],i[e[0]],t)},e.prototype.validateScheduleByTwoValues=function(e,t,i){var r,a,n,s=this.parent,o=s.taskFields,l=i.ganttProperties,d=s.allowUnscheduledTasks;-1!==t.indexOf(o.startDate)&&(r=e[o.startDate]),-1!==t.indexOf(o.endDate)&&(a=e[o.endDate]),-1!==t.indexOf(o.duration)&&(n=e[o.duration]),r&&a||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.endDate)?(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(r),l,!0),s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(a),l,!0),s.dataOperation.calculateDuration(i)):a&&n||d&&-1!==t.indexOf(o.endDate)&&-1!==t.indexOf(o.duration)?(s.setRecordValue("endDate",s.dataOperation.getDateFromFormat(a),l,!0),s.dataOperation.updateDurationValue(n,l)):(r&&n||d&&-1!==t.indexOf(o.startDate)&&-1!==t.indexOf(o.duration))&&(s.setRecordValue("startDate",s.dataOperation.getDateFromFormat(r),l,!0),s.dataOperation.updateDurationValue(n,l))},e.prototype.isTaskbarMoved=function(e){var i=!1,r=e.ganttProperties,a=this.parent.previousRecords&&this.parent.previousRecords[e.uniqueID];if(a&&a.ganttProperties){var n=t.getValue("ganttProperties.startDate",a),s=t.getValue("ganttProperties.endDate",a),o=t.getValue("ganttProperties.duration",a),l=t.getValue("ganttProperties.durationUnit",a),d=Object.keys(a.ganttProperties);-1===d.indexOf("startDate")&&-1===d.indexOf("endDate")&&-1===d.indexOf("duration")&&-1===d.indexOf("durationUnit")||(t.isNullOrUndefined(n)&&!t.isNullOrUndefined(r.startDate)||t.isNullOrUndefined(s)&&!t.isNullOrUndefined(r.endDate)||t.isNullOrUndefined(r.startDate)&&!t.isNullOrUndefined(n)||t.isNullOrUndefined(r.endDate)&&!t.isNullOrUndefined(s)||n&&n.getTime()!==r.startDate.getTime()||s&&s.getTime()!==r.endDate.getTime()||!t.isNullOrUndefined(o)&&o!==r.duration||!t.isNullOrUndefined(o)&&o===r.duration&&l!==r.durationUnit)&&(i=!0)}return i},e.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?t=!0:this.parent.setRecordValue("predecessor",i.ganttProperties.predecessor,e.ganttProperties,!0)),t},e.prototype.isCheckPredecessor=function(e){var t=!1;return this.parent.previousRecords[e.uniqueID]&&this.parent.taskFields.dependency&&this.parent.isInPredecessorValidation&&this.parent.predecessorModule.getValidPredecessor(e).length>0&&this.isTaskbarMoved(e)&&(t=!0),t},e.prototype.updateGanttProperties=function(e,t){var i=["taskId","uniqueID","rowUniqueID","parentId"];Object.keys(e.ganttProperties).forEach(function(r){-1===i.indexOf(r)&&(t.ganttProperties[r]=e.ganttProperties[r])})},e.prototype.initiateUpdateAction=function(e){var i,r,a=this.isCheckPredecessor(e.data);if(t.isNullOrUndefined(e.data.parentItem)||a){if(e.data.childRecords.length>0&&!a&&!(a=this.isCheckPredecessor(e.data))&&this.isTaskbarMoved(e.data))for(var n=0;n<e.data.childRecords.length;n++)this.parent.predecessorModule.getValidPredecessor(e.data.childRecords[n]).length>0&&(r=n,a=!0)}else i=this.parent.getRecordByID(e.data.parentItem.taskId),a=!!(this.isTaskbarMoved(e.data)&&this.parent.predecessorModule.getValidPredecessor(i).length>0&&this.parent.isInPredecessorValidation);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 s={};if(a)if(s=t.isNullOrUndefined(i)?t.isNullOrUndefined(r)?this.parent.connectorLineEditModule.validateTypes(e.data):this.parent.connectorLineEditModule.validateTypes(e.data.childRecords[r],e.data):this.parent.connectorLineEditModule.validateTypes(i,e.data),this.parent.isConnectorLineUpdate=!0,t.isNullOrUndefined(t.getValue("violationType",s)))this.updateEditedTask(e);else{var o=this.validateTaskEvent(e);!1===o.validateMode.preserveLinkWithEditing&&!1===o.validateMode.removeLink&&!1===o.validateMode.respectLink?this.parent.connectorLineEditModule.openValidationDialog(s):(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())}else this.taskbarMoved&&(this.parent.isConnectorLineUpdate=!0),this.updateEditedTask(e)},e.prototype.validateTaskEvent=function(e){var t={};return this.resetValidateArgs(),this.parent.currentEditedArgs=t,t.cancel=!1,t.data=e.data,t.requestType="validateLinkedTask",t.validateMode=this.parent.dialogValidateMode,t.editEventArgs=e,this.parent.actionBeginTask(t),t},e.prototype.resetValidateArgs=function(){this.parent.dialogValidateMode.preserveLinkWithEditing=!0,this.parent.dialogValidateMode.removeLink=!1,this.parent.dialogValidateMode.respectLink=!1},e.prototype.updateEditedTask=function(e){var t=e.data;if(this.parent.autoCalculateDateScheduling&&this.updateParentChildRecord(t),this.parent.isConnectorLineUpdate&&this.parent.autoCalculateDateScheduling){for(var i=0;i<this.validatedChildItems.length;i++){var r=this.validatedChildItems[i];r.ganttProperties.predecessor&&r.ganttProperties.predecessor.length>0&&(this.parent.editedTaskBarItem=r,this.parent.predecessorModule.validatePredecessor(r,[],""))}this.parent.predecessorModule.isValidatedParentTaskID="",t.ganttProperties.predecessor&&(this.parent.isMileStoneEdited=t.ganttProperties.isMilestone,this.taskbarMoved&&(this.parent.editedTaskBarItem=t),this.isValidatedEditedRecord||this.parent.predecessorModule.validatePredecessor(t,[],""),this.isValidatedEditedRecord=!1,this.parent.predecessorModule.isValidatedParentTaskID=""),(this.parent.allowParentDependency&&t.hasChildRecords&&this.parent.previousRecords[t.uniqueID].ganttProperties.startDate&&"DrawConnectorLine"===e.action||"DialogEditing"===e.action)&&this.updateChildItems(t),this.updateParentItemOnEditing()}if(t.parentItem){this.parent.autoCalculateDateScheduling&&this.parent.dataOperation.updateParentItems(t,!0);var a=this.parent.getRecordByID(t.parentItem.taskId);a.ganttProperties.predecessorsName||(this.parent.predecessorModule.validatePredecessor(a,[],""),this.updateParentItemOnEditing())}this.initiateSaveAction(e)},e.prototype.updateParentItemOnEditing=function(){for(var e=t.getValue("parentRecord",this.parent.predecessorModule),i=0;i<e.length;i++)this.parent.dataOperation.updateParentItems(e[i]);t.setValue("parentRecord",[],this.parent.predecessorModule),t.setValue("parentIds",[],this.parent.predecessorModule)},e.prototype.updateParentChildRecord=function(e){var i=e;i.hasChildRecords&&this.taskbarMoved&&"Auto"===this.parent.taskMode&&!t.isNullOrUndefined(this.parent.editModule.cellEditModule)&&!this.parent.editModule.cellEditModule.isResourceCellEdited&&this.updateChildItems(i),t.isNullOrUndefined(this.parent.editModule.cellEditModule)||(this.parent.editModule.cellEditModule.isResourceCellEdited=!1)},e.prototype.updateTaskScheduleModes=function(e){var t=e[this.parent.taskFields.startDate],i=e.ganttProperties;if(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,!0),i,!0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(i.width,i.progress),i,!0),this.parent.dataOperation.calculateDuration(e);else if(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);else{var r=this.parent.dateValidationModule.checkStartDate(t,e.ganttProperties);this.parent.setRecordValue("startDate",r,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)}},e.prototype.calculateDateByRoundOffDuration=function(e,i){var r=e,a=r.ganttProperties,n=new Date(i.getTime());if(!t.isNullOrUndefined(a.endDate)&&t.isNullOrUndefined(a.startDate)){var s=this.parent.dateValidationModule.checkStartDate(n,a,null);this.parent.setRecordValue("endDate",this.parent.dateValidationModule.checkEndDate(s,r.ganttProperties),a,!0)}else this.parent.setRecordValue("startDate",this.parent.dateValidationModule.checkStartDate(n,a,!1),a,!0),t.isNullOrUndefined(a.duration)||this.parent.dateValidationModule.calculateEndDate(r);this.parent.dataOperation.updateWidthLeft(e),this.parent.dataOperation.updateTaskData(r)},e.prototype.updateParentProgress=function(e){var i=0,r=this.parent.getParentTask(e),a=r.childRecords,n=a?a.length:0,s=0,o=0,l=0,d={};if(a){for(var h=0;h<n;h++)a[h].ganttProperties.isMilestone&&!a[h].hasChildRecords||!m(a[h].ganttProperties)?o+=1:(d=this.parent.dataOperation.getParentProgress(a[h]),s+=t.getValue("totalProgress",d),l+=t.getValue("totalDuration",d));i=n-o>0?Math.round(s/l):0,isNaN(i)&&(i=0),this.parent.setRecordValue("progressWidth",this.parent.dataOperation.getProgressWidth(r.ganttProperties.isAutoSchedule?r.ganttProperties.width:r.ganttProperties.autoWidth,i),r.ganttProperties,!0),this.parent.setRecordValue("progress",Math.floor(i),r.ganttProperties,!0),this.parent.setRecordValue("totalProgress",s,r.ganttProperties,!0),this.parent.setRecordValue("totalDuration",l,r.ganttProperties,!0)}this.parent.dataOperation.updateTaskData(r),r.parentItem&&this.updateParentProgress(r.parentItem)},e.prototype.revertCellEdit=function(e){this.parent.editModule.reUpdatePreviousRecords(!1,!0),this.resetEditProperties()},e.prototype.reUpdatePreviousRecords=function(e,t){for(var i=this.parent.previousRecords,r=Object.keys(i),a=0;a<r.length;a++){var n=r[a],s=i[n],o=this.parent.getTaskByUniqueID(n);this.copyTaskData(o.taskData,s.taskData),delete s.taskData,this.copyTaskData(o.ganttProperties,s.ganttProperties),delete s.ganttProperties,this.copyTaskData(o,s);var l=this.parent.currentViewData.indexOf(o);if(e&&this.parent.chartRowsModule.refreshRow(l),t){var d="ProjectView"===this.parent.viewType?o.ganttProperties.taskId:o.ganttProperties.rowUniqueID;this.parent.treeGrid.grid.setRowData(d,o);this.parent.treeGrid.grid.getRowObjectFromUID(this.parent.treeGrid.grid.getDataRows()[l].getAttribute("data-uid")).data=o}}},e.prototype.copyTaskData=function(e,i){t.isNullOrUndefined(i)||t.extend(e,i)},e.prototype.updateScheduleDatesOnEditing=function(e){},e.prototype.updateChildItems=function(e){var i,r=this.parent.previousRecords[e.uniqueID];t.isNullOrUndefined(r)||t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r.ganttProperties)?i=new Date(e.ganttProperties.startDate.getTime()):t.isNullOrUndefined(r.ganttProperties.startDate)||(i=new Date(r.ganttProperties.startDate.getTime()));var a,n,s,o,l,d=e.ganttProperties.startDate,h=[];if(this.getUpdatableChildRecords(e,h),0!==h.length){!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(d)&&i.getTime()>d.getTime()?(a=this.parent.dateValidationModule.checkStartDate(d),n=this.parent.dateValidationModule.checkEndDate(i,e.ganttProperties),o=!1):(a=this.parent.dateValidationModule.checkStartDate(i),n=this.parent.dateValidationModule.checkEndDate(d,e.ganttProperties),o=!0),l=!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(n)&&a.getTime()>=n.getTime()?0:this.parent.dateValidationModule.getDuration(a,n,"minute",!0,!1);for(var p=0;p<h.length;p++)if(h[p].ganttProperties.isAutoSchedule)if(l>0){var c=m(h[p].ganttProperties)?h[p].ganttProperties.startDate:h[p].ganttProperties.startDate?h[p].ganttProperties.startDate:h[p].ganttProperties.endDate?h[p].ganttProperties.endDate:new Date(i.toString());s=o?this.parent.dateValidationModule.getEndDate(this.parent.dateValidationModule.checkStartDate(c,h[p].ganttProperties,h[p].ganttProperties.isMilestone),l,"minute",h[p].ganttProperties,!1):this.parent.dateValidationModule.getStartDate(this.parent.dateValidationModule.checkEndDate(c,h[p].ganttProperties),l,"minute",h[p].ganttProperties),this.calculateDateByRoundOffDuration(h[p],s),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(h[p])&&this.validatedChildItems.push(h[p])}else if(t.isNullOrUndefined(r)){s=i;var u=this.parent.initialLoadData[h[p].index];this.parent.isLoad?this.calculateDateByRoundOffDuration(u,s):this.calculateDateByRoundOffDuration(h[p],s),this.parent.isOnEdit&&-1===this.validatedChildItems.indexOf(h[p])&&this.validatedChildItems.push(h[p])}h.length&&this.parent.dataOperation.updateParentItems(e,!0)}},e.prototype.getUpdatableChildRecords=function(e,t){for(var i=e.childRecords,r=0;r<i.length;r++)i[r].ganttProperties.isAutoSchedule&&(t.push(i[r]),i[r].hasChildRecords&&this.getUpdatableChildRecords(i[r],t))},e.prototype.initiateSaveAction=function(e){var i=this,r={};r.requestType="beforeSave",r.data=e.data,r.cancel=!1,r.modifiedRecords=this.parent.editedRecords,t.isNullOrUndefined(e.target)||(r.target=e.target),r.modifiedTaskData=w(this.parent.editedRecords,!0),e.action&&"DrawConnectorLine"===e.action&&(r.action="DrawConnectorLine"),this.parent.trigger("actionBegin",r,function(n){if(t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),n.cancel)i.reUpdatePreviousRecords(),i.parent.chartRowsModule.refreshRecords([e.data]),i.resetEditProperties(r);else if(n.modifiedTaskData=w(n.modifiedRecords,null,null,i.parent),v(i.parent.dataSource)){var s=i.parent.dataSource,o={changedRecords:n.modifiedTaskData},l=i.parent.query instanceof a.Query?i.parent.query:new a.Query,d=null,h=s.adaptor;if(h instanceof a.WebApiAdaptor&&h instanceof a.ODataAdaptor&&!s.dataSource.batchUrl){d=s.update(i.parent.taskFields.id,o.changedRecords,null,l)}else d=s.saveChanges(o,i.parent.taskFields.id,null,l);d.then(function(t){return i.dmSuccess(t,e)}).catch(function(t){return i.dmFailure(t,e)})}else i.saveSuccess(e)})},e.prototype.dmSuccess=function(e,t){var i,r;i=e.changedRecords?e.changedRecords.length:e.length;for(var a=0;a<i;a++){r=e.changedRecords?e.changedRecords[parseInt(a.toString(),10)]:e[parseInt(a.toString(),10)];for(var n=Object.keys(r).length,s=0,o=Object.keys(r);s<n;s++){var l=o[parseInt(s.toString(),10)];this.parent.editedRecords[parseInt(a.toString(),10)][""+l]=r[""+l],this.parent.editedRecords[parseInt(a.toString(),10)].taskData[""+l]=r[""+l]}null!==this.parent.taskFields.id&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.taskId=r[this.parent.taskFields.id]),null!==this.parent.taskFields.name&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.taskName=r[this.parent.taskFields.name]),null!==this.parent.taskFields.startDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.startDate=r[this.parent.taskFields.startDate]),null!==this.parent.taskFields.endDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.endDate=r[this.parent.taskFields.endDate]),null!==this.parent.taskFields.duration&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.duration=parseInt(r[this.parent.taskFields.duration])),null!==this.parent.taskFields.durationUnit&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.durationUnit=r[this.parent.taskFields.durationUnit]),null!==this.parent.taskFields.progress&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.progress=r[this.parent.taskFields.progress]),null!==this.parent.taskFields.dependency&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.dependency=r[this.parent.taskFields.dependency]),null!==this.parent.taskFields.parentID&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.parentID=r[this.parent.taskFields.parentID]),null!==this.parent.taskFields.baselineEndDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.baselineEndDate=r[this.parent.taskFields.baselineEndDate]),null!==this.parent.taskFields.baselineStartDate&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.baselineStartDate=r[this.parent.taskFields.baselineStartDate]),null!==this.parent.taskFields.resourceInfo&&(this.parent.editedRecords[parseInt(a.toString(),10)].ganttProperties.resources=r[this.parent.taskFields.resourceInfo])}this.saveSuccess(t)},e.prototype.dmFailure=function(e,t){if(this.deletedTaskDetails.length){for(var i=this.deletedTaskDetails,r=0;r<i.length;r++)i[r].isDelete=!1;this.deletedTaskDetails=[]}this.reUpdatePreviousRecords(!0,!0),this.resetEditProperties(),this.parent.trigger("actionFailure",{error:e})},e.prototype.updateSharedTask=function(e){for(var i=e.ganttProperties.sharedTaskUniqueIds,r=0;r<i.length;r++){var a=this.parent.flatData[this.parent.ids.indexOf(i[r].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),t.isNullOrUndefined(a.parentItem)||this.parent.dataOperation.updateParentItems(a.parentItem))}},e.prototype.saveSuccess=function(e){var i={};if(this.parent.timelineSettings.updateTimescaleView){var r=this.parent.editedRecords;this.parent.timelineModule.updateTimeLineOnEditing([r],e.action)}if("ResourceView"===this.parent.viewType){"TaskbarEditing"===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 a=0;a<this.updateParentRecords.length;a++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[a]);this.updateParentRecords=[],this.parent.editModule.dialogModule.isResourceUpdate=!1,this.parent.editModule.dialogModule.previousResource=[]}if(this.isTreeGridRefresh||(this.parent.chartRowsModule.refreshRecords(this.parent.editedRecords),"ResourceView"===this.parent.viewType&&!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&&!t.isNullOrUndefined(this.parent.connectorLineEditModule)&&(this.parent.connectorLineEditModule.refreshEditedRecordConnectorLine(this.parent.editedRecords),this.updateScheduleDatesOnEditing(e))),!this.parent.editSettings.allowTaskbarEditing||this.parent.editSettings.allowTaskbarEditing&&!this.taskbarEditModule.dependencyCancel){if(i.requestType="save",i.data=e.data,i.modifiedRecords=this.parent.editedRecords,i.modifiedTaskData=w(this.parent.editedRecords,null,null,this.parent),t.isNullOrUndefined(e.action)||t.setValue("action",e.action,i),"TaskbarEditing"===e.action&&(i.taskBarEditAction=e.taskBarEditAction),this.endEditAction(e),this.parent.enableCriticalPath){var n=this.parent.criticalPathModule;n.showCriticalPath(!0),n.criticalConnectorLine(n.criticalPathCollection,n.detailPredecessorCollection,!0,n.predecessorCollectionTaskIds)}this.parent.trigger("actionComplete",i),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()}else this.taskbarEditModule.dependencyCancel=!1,this.resetEditProperties();"ResourceView"===this.parent.viewType&&this.isTreeGridRefresh&&(this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh(),this.isTreeGridRefresh=!1)},e.prototype.updateResoures=function(e,t,i){var r=this.parent.flatData,a=t?t.length:0,n=e?e.length:0;if(0!==a||0!==n){for(var s=0;s<a;s++){var o=[];"NaN"===(g=parseInt(t[s][this.parent.resourceFields.id],10).toString())&&(g=t[s][this.parent.resourceFields.id]);for(var l=0;l<e.length;l++){var d=parseInt(e[l][this.parent.resourceFields.id],10).toString();if("NaN"===d&&(d=e[l][this.parent.resourceFields.id]),d===g){o.push(l);break}}if(0===o.length){var h=r[this.parent.getTaskIds().indexOf("R"+g)];h&&this.addNewRecord(i,h)}else{var p=parseInt(o[0].toString(),10);"NaN"===p.toString()&&(p=o[0].toString()),e.splice(p,1)}}var c=e?e.length:0;for(s=0;s<c;s++)for(var u=i.ganttProperties.taskId,g=e[s][this.parent.resourceFields.id],f=r[this.parent.getTaskIds().indexOf("R"+g)],m=0;m<f.childRecords.length;m++)f.childRecords[m].ganttProperties.taskId===u&&this.removeChildRecord(f.childRecords[m]);if(a>0){var y=this.parent.getParentTask(i.parentItem);y&&y.ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&this.removeChildRecord(i)}0===a&&this.checkWithUnassignedTask(i)}},e.prototype.checkWithUnassignedTask=function(e){for(var i=null,r=0;r<this.parent.flatData.length;r++)this.parent.flatData[r].ganttProperties.taskName===this.parent.localeObj.getConstant("unassignedTask")&&(i=this.parent.flatData[r]);if(t.isNullOrUndefined(i)){var a={};a[this.parent.taskFields.id]=0,a[this.parent.taskFields.name]=this.parent.localeObj.getConstant("unassignedTask");var n=this.parent.isOnEdit;this.parent.isOnEdit=!1;var s=this.parent.dataOperation.createRecord(a,0);this.parent.isOnEdit=n,this.addRecordAsBottom(s);var o=this.parent.flatData[this.parent.flatData.length-1];this.addNewRecord(e,o);this.parent.dataSource.push(e.taskData)}else this.addNewRecord(e,i);var l=this.parent.currentViewData.filter(function(t){return t.ganttProperties.taskId===e.ganttProperties.taskId&&t.hasChildRecords===e.hasChildRecords})[0];e.parentItem=l.parentItem,e.parentUniqueID=l.parentUniqueID},e.prototype.addRecordAsBottom=function(e){var t=this.parent.flatData.length;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());var i=0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId;this.parent.getTaskIds().splice(t+1,0,i),this.updateTreeGridUniqueID(e,"add")},e.prototype.addNewRecord=function(e,i){var a=null;a=t.extend({},{},e,!0),this.parent.setRecordValue("uniqueID",r.getUid(this.parent.element.id+"_data_"),a),this.parent.setRecordValue("uniqueID",a.uniqueID,a.ganttProperties,!0);var n=a.uniqueID.replace(this.parent.element.id+"_data_","");this.parent.setRecordValue("rowUniqueID",n,a),this.parent.setRecordValue("rowUniqueID",n,a.ganttProperties,!0),this.parent.setRecordValue("level",1,a),this.parent.taskFields.parentID&&this.parent.setRecordValue("parentId",i.ganttProperties.taskId,a.ganttProperties,!0),this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(i),a);var s=a.parentItem?a.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",s,a),e.ganttProperties.sharedTaskUniqueIds.push(n),a.ganttProperties.sharedTaskUniqueIds=e.ganttProperties.sharedTaskUniqueIds,this.addRecordAsChild(i,a)},e.prototype.removeChildRecord=function(e){var t=this.parent,i=[];i=this.parent.dataSource instanceof a.DataManager&&this.parent.dataSource.dataSource.json.length>0?this.parent.dataSource.dataSource.json:this.parent.currentViewData;var r=this.parent.dataSource,n=e,s=this.parent.getParentTask(n.parentItem);if(n){if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&(1===o.length&&(this.parent.isOnDelete=!0,o[0].isDelete=!0,this.parent.dataOperation.updateParentItems(s),this.parent.isOnDelete=!1,o[0].isDelete=!1),l=o.indexOf(n),s.childRecords.splice(l,1),this.updateParentRecords.push(s))}if(n.ganttProperties.sharedTaskUniqueIds.length){var d=n.ganttProperties.sharedTaskUniqueIds.indexOf(n.ganttProperties.rowUniqueID);n.ganttProperties.sharedTaskUniqueIds.splice(d,1)}if(this.updateTreeGridUniqueID(n,"delete"),!this.parent.taskFields.parentID){var h=[];h.push(n.ganttProperties.rowUniqueID.toString()),this.parent.editModule.removeFromDataSource(h)}var p=this.parent.flatData.indexOf(n);if(t.taskFields.parentID){for(var c=void 0,u=this.parent.currentViewData,g=0;g<u.length;g++)u[g].ganttProperties.rowUniqueID===n.ganttProperties.rowUniqueID&&(c=g);-1!==c&&(r.length>0&&r.splice(c,1),i.splice(c,1),this.parent.flatData.splice(p,1),this.parent.ids.splice(p,1),this.parent.getTaskIds().splice(p,1))}var f=i.indexOf(n);if(!t.taskFields.parentID){var m=this.parent.editModule.getChildCount(n,0);i.splice(f,m+1),this.parent.flatData.splice(p,m+1),this.parent.ids.splice(p,m+1),this.parent.getTaskIds().splice(p,m+1)}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(this.parent.setRecordValue("expanded",!1,s),this.parent.setRecordValue("hasChildRecords",!1,s))}},e.prototype.addRecordAsChild=function(e,i){var r,a=this.parent,n=this.parent.flatData.indexOf(e),s=this.parent.editModule.getChildCount(e,0);if(!t.isNullOrUndefined(this.addRowIndex)&&this.addRowPosition&&e.childRecords&&"Child"!==this.addRowPosition){var o=e.childRecords[this.addRowIndex],l="Above"===this.addRowPosition||"Below"===this.addRowPosition?this.addRowPosition:"Child";r=o?this.addRowIndex+n+1:s+n+1,r="Above"===l?r:r+1}else r=t.isNullOrUndefined(s)||0===s?n+1:s+n+1;this.parent.currentViewData.splice(r,0,i),this.parent.flatData.splice(r,0,i),this.parent.ids.splice(r,0,i.ganttProperties.rowUniqueID.toString()),this.updateTreeGridUniqueID(i,"add");var d=0===i.level?"R"+i.ganttProperties.taskId:"T"+i.ganttProperties.taskId;this.parent.getTaskIds().splice(r,0,d),e.hasChildRecords||(this.parent.setRecordValue("hasChildRecords",!0,e),this.parent.setRecordValue("expanded",!0,e),e.childRecords.length||(e.childRecords=[],!a.taskFields.parentID&&t.isNullOrUndefined(e.taskData[this.parent.taskFields.child])&&(e.taskData[this.parent.taskFields.child]=[]))),e.childRecords.splice(e.childRecords.length,0,i),t.isNullOrUndefined(i)||this.parent.taskFields.parentID||t.isNullOrUndefined(e.taskData[this.parent.taskFields.child])||e.taskData[this.parent.taskFields.child].splice(e.childRecords.length,0,i.taskData),t.isNullOrUndefined(i.parentItem)||this.updateParentRecords.push(e)},e.prototype.resetEditProperties=function(e){this.parent.currentEditedArgs={},this.resetValidateArgs(),this.parent.editedTaskBarItem=null,this.parent.isOnEdit=!1,this.validatedChildItems=[],this.parent.isConnectorLineUpdate=!1,this.parent.editedTaskBarItem=null,this.taskbarMoved=!1,this.predecessorUpdated=!1,t.isNullOrUndefined(this.dialogModule)||!t.isNullOrUndefined(e)&&(t.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)},e.prototype.endEditAction=function(e){this.resetEditProperties(),"TaskbarEditing"===e.action?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())},e.prototype.saveFailed=function(e){this.reUpdatePreviousRecords(),this.parent.hideSpinner()},e.prototype.renderDeleteConfirmDialog=function(){var e=new i.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},e.prototype.closeConfirmDialog=function(){this.confirmDialog.hide()},e.prototype.confirmDeleteOkButton=function(){this.deleteSelectedItems(),this.confirmDialog.hide();this.parent.element.querySelector(".e-treegrid").focus()},e.prototype.startDeleteAction=function(){if(this.parent.editSettings.allowDeleting&&!this.parent.readOnly)if(this.parent.editSettings.showDeleteConfirmDialog)this.confirmDialog.show();else{this.deleteSelectedItems();this.parent.element.querySelector(".e-treegrid").focus()}},e.prototype.deleteResourceRecords=function(e){for(var t=[],i=function(i){if(e[i].parentItem){if(1===e[i].ganttProperties.sharedTaskUniqueIds.length){for(var a=e[i],n=a.ganttProperties.sharedTaskUniqueIds,s=0;s<n.length;s++)-1!==r.parent.ids.indexOf(n[s].toString())&&t.push(r.parent.flatData[r.parent.ids.indexOf(n[s].toString())]);-1!==r.parent.ids.indexOf(a.ganttProperties.rowUniqueID)&&t.push(r.parent.flatData[r.parent.ids.indexOf(a.ganttProperties.rowUniqueID)])}}else{var o=r.parent.flatData.filter(function(t){return t.ganttProperties.taskId===e[i].ganttProperties.taskId&&t.hasChildRecords})[0];t.push(o)}},r=this,a=0;a<e.length;a++)i(a);this.deleteRow(t)},e.prototype.deleteSelectedItems=function(){if(this.isFromDeleteMethod)this.targetedRecords.length&&("ResourceView"===this.parent.viewType?this.deleteResourceRecords(this.targetedRecords):this.deleteRow(this.targetedRecords)),this.isFromDeleteMethod=!1;else{var 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)}},e.prototype.deleteRecord=function(e){this.isFromDeleteMethod=!0;var i=typeof e;switch(this.targetedRecords=[],i){case"number":case"string":var r=e.toString();"ResourceView"===this.parent.viewType?t.isNullOrUndefined(r)||-1===this.parent.getTaskIds().indexOf("T"+r)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r)]):t.isNullOrUndefined(r)||-1===this.parent.ids.indexOf(r)||this.targetedRecords.push(this.parent.getRecordByID(r));break;case"object":Array.isArray(e)?this.updateTargetedRecords(e):this.targetedRecords.push(e.valueOf())}this.startDeleteAction()},e.prototype.updateTargetedRecords=function(e){if(e.length){if("object"===typeof e[0])this.targetedRecords=e;else for(var i=0;i<e.length;i++){var r=e[i].toString();"ResourceView"===this.parent.viewType?t.isNullOrUndefined(r)||-1===this.parent.getTaskIds().indexOf("T"+r)||this.targetedRecords.push(this.parent.flatData[this.parent.getTaskIds().indexOf("T"+r)]):t.isNullOrUndefined(r)||-1===this.parent.ids.indexOf(r)||this.targetedRecords.push(this.parent.getRecordByID(r))}}},e.prototype.deleteRow=function(e){var i=e&&e.length?e:this.parent.selectionModule.getSelectedRecords();if(this.parent.addDeleteRecord=!0,i.length){this.parent.isOnDelete=!0,i.forEach(function(e){e.isDelete=!0}),"ResourceView"!==this.parent.viewType||e.length||(i=[]);for(var r=0;r<i.length;r++){var a=i[r];if(-1===this.deletedTaskDetails.indexOf(a)){var n=this.parent.getParentTask(a.parentItem);if(a.parentItem){var s=n.childRecords;(1===s.length?s:s.filter(function(e){return!e.isDelete})).length>0&&this.parent.dataOperation.updateParentItems(a.parentItem)}var o=a.ganttProperties.predecessor,l=!0;"ResourceView"===this.parent.viewType&&n&&n.ganttProperties.taskName!==this.parent.localeObj.getConstant("unassignedTask")&&(l=!1),o&&o.length&&l&&this.removePredecessorOnDelete(a),this.deletedTaskDetails.push(a),a.hasChildRecords&&this.deleteChildRecords(a)}}this.parent.selectionModule&&this.parent.allowSelection&&this.parent.selectionModule.clearSelection();var d={};d.deletedRecordCollection=this.deletedTaskDetails,d.updatedRecordCollection=this.parent.editedRecords,d.cancel=!1,d.action="delete",this.initiateDeleteAction(d),this.parent.isOnDelete=!1}t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.removePredecessorOnDelete=function(e){for(var i=e.ganttProperties.predecessor,r=0;r<i.length;r++){var a=i[r],n="ResourceView"===this.parent.viewType?e.ganttProperties.taskId:e.ganttProperties.rowUniqueID;if(a.from.toString()===n.toString()){var s=this.parent.connectorLineModule.getRecordByID(a.to.toString());if(!t.isNullOrUndefined(s)){for(var o=t.extend([],[],s.ganttProperties.predecessor,!0),l=void 0,d=0;d<o.length;d++){var h="ResourceView"===this.parent.viewType?s.ganttProperties.taskId:s.ganttProperties.rowUniqueID;if(o[d].to.toString()===h.toString()&&o[d].from.toString()===n.toString()){l=d;break}}o.splice(l,1),this.updatePredecessorValues(s,o)}}else if(a.to.toString()===n.toString()){var p=this.parent.connectorLineModule.getRecordByID(a.from.toString());if(!t.isNullOrUndefined(p)){var c=t.extend([],[],p.ganttProperties.predecessor,!0);for(l=void 0,d=0;d<c.length;d++){var u="ResourceView"===this.parent.viewType?p.ganttProperties.taskId:p.ganttProperties.rowUniqueID;if(c[d].from.toString()===u.toString()&&c[d].to.toString()===n.toString()){l=d;break}}c.splice(l,1),this.updatePredecessorValues(p,c)}}}},e.prototype.updatePredecessorValues=function(e,t){this.parent.setRecordValue("predecessor",t,e.ganttProperties,!0);var i=this.parent.predecessorModule.getPredecessorStringValue(e);this.parent.setRecordValue("predecessorsName",i,e.ganttProperties,!0),this.parent.setRecordValue("taskData."+this.parent.taskFields.dependency,i,e),this.parent.setRecordValue(this.parent.taskFields.dependency,i,e)},e.prototype.updateTaskId=function(e,i){if(!this.parent.readOnly){var r="number"==typeof e?e.toString():e,a="number"==typeof i?i.toString():i,n=this.parent.ids;if(!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(a)){var s=n.indexOf(r),o=n.indexOf(a);if(-1===s||o>-1)return;var l=this.parent.flatData[s];if(l.ganttProperties.taskId=l.ganttProperties.rowUniqueID=a,l.taskData[this.parent.taskFields.id]=a,l[this.parent.taskFields.id]=a,n[s]=a,l.hasChildRecords&&this.parent.taskFields.parentID)for(var d=l.childRecords,h=0;h<d.length;h++){var p=d[h];p[this.parent.taskFields.parentID]=i,this.parent.chartRowsModule.refreshRecords([p])}if(this.parent.taskFields.dependency&&!t.isNullOrUndefined(l.ganttProperties.predecessor))for(var c=l.ganttProperties.predecessor,u=void 0,g=0;g<c.length;g++){var f=c[g];f.to===r?u=this.parent.flatData[n.indexOf(f.from)]:f.from===r&&(u=this.parent.flatData[n.indexOf(f.to)]),this.updatePredecessorOnUpdateId(u,r,a)}this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh()}}},e.prototype.updatePredecessorOnUpdateId=function(e,t,i){if(this.parent.flatData.indexOf(e)>-1)for(var r=e.ganttProperties.predecessor,a=0;a<r.length;a++){var n=r[a];n.to===t?n.to=i:n.from===t&&(n.from=i)}this.updatePredecessorValues(e,e.ganttProperties.predecessor)},e.prototype.deleteChildRecords=function(e){for(var t=e.childRecords,i=0;i<t.length;i++){var r=t[i];if(-1===this.deletedTaskDetails.indexOf(r)){var a=r.ganttProperties.predecessor,n=!0,s=this.parent.getParentTask(r.parentItem);"ResourceView"===this.parent.viewType&&s&&s.ganttProperties.taskName!==this.parent.localeObj.getConstant("unassignedTask")&&(n=!1),a&&a.length&&n&&this.removePredecessorOnDelete(r),this.deletedTaskDetails.push(r),r.hasChildRecords&&this.deleteChildRecords(r)}}},e.prototype.removeFromDataSource=function(e){var t;t=this.parent.dataSource instanceof a.DataManager?this.parent.dataSource.dataSource.json:this.parent.dataSource,this.removeData(t,e),this.isBreakLoop=!1},e.prototype.removeData=function(e,i){for(var r=0;r<e.length&&!this.isBreakLoop;r++)if(-1!==i.indexOf(t.getValue(this.parent.taskFields.id,e[r]).toString())){if(e[r][this.parent.taskFields.child]){var a=e[r][this.parent.taskFields.child];this.removeData(a,i)}if(i.splice(i.indexOf(t.getValue(this.parent.taskFields.id,e[r]).toString()),1),e.splice(r,1),0===i.length){this.isBreakLoop=!0;break}}else if(e[r][this.parent.taskFields.child]){a=e[r][this.parent.taskFields.child];this.removeData(a,i)}},e.prototype.initiateDeleteAction=function(e){var i=this;this.parent.showSpinner();var r={};r.requestType="beforeDelete",r.data=e.deletedRecordCollection,r.modifiedRecords=e.updatedRecordCollection,r.modifiedTaskData=w(e.updatedRecordCollection,null,null,this.parent),this.parent.trigger("actionBegin",r,function(r){if(t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),r.cancel){for(var n=i.deletedTaskDetails,s=0;s<n.length;s++)n[s].isDelete=!1;i.deletedTaskDetails=[],i.reUpdatePreviousRecords(),i.parent.initiateEditAction(!1),i.parent.hideSpinner()}else if(v(i.parent.dataSource)){var o=i.parent.dataSource;i.parent.timezone&&k(r.modifiedTaskData,i.parent);var l={deletedRecords:w(r.data,null,null,i.parent),changedRecords:r.modifiedTaskData},d=o.adaptor,h=i.parent.query instanceof a.Query?i.parent.query:new a.Query;if(d instanceof a.WebApiAdaptor&&d instanceof a.ODataAdaptor&&!o.dataSource.batchUrl){for(var p=null,c=0;c<l.deletedRecords.length;c++)p=o.remove(i.parent.taskFields.id,l.deletedRecords[c],null,h);p.then(function(){o.update(i.parent.taskFields.id,l.changedRecords,null,h).then(function(){return i.deleteSuccess(e)}).catch(function(t){return i.dmFailure(t,e)})}).catch(function(t){return i.dmFailure(t,e)})}else{o.saveChanges(l,i.parent.taskFields.id,null,h).then(function(){return i.deleteSuccess(e)}).catch(function(t){return i.dmFailure(t,e)})}}else i.deleteSuccess(e)})},e.prototype.deleteSuccess=function(e){var i=this,r=this.parent.flatData,a=this.parent.currentViewData,n=this.parent.getRecordFromFlatdata(e.deletedRecordCollection),s=[];n.length>0&&(this.parent.selectedRowIndex=n[n.length-1].index);for(var o=0;o<n.length;o++){var l=n[o],d=a.indexOf(l),h=r.indexOf(l),p=this.parent.treeGrid.parentData.indexOf(l),c=t.getValue("dataOperation.dataArray",this.parent),u=c.indexOf(l.taskData),g=void 0;if(-1!==d&&a.splice(d,1),-1!==h&&r.splice(h,1),-1!==u&&c.splice(u,1),!t.isNullOrUndefined(l)){if(s.push(l.ganttProperties.taskId.toString()),-1!==h&&(this.parent.ids.splice(h,1),"ResourceView"===this.parent.viewType&&(this.parent.getTaskIds().splice(h,1),this.isResourceTaskDeleted=!0,l.hasChildRecords||(l.ganttProperties.resourceInfo=null,delete l.ganttProperties.resourceNames,l[this.parent.taskFields.resourceInfo]=null,l.ganttProperties.sharedTaskUniqueIds=[],delete l.taskData[this.parent.taskFields.resourceInfo]))),0===l.level&&-1!==p&&this.parent.treeGrid.parentData.splice(p,1),l.parentItem){var f=this.parent.getParentTask(l.parentItem);if(f){var m=f.childRecords;-1!==(g=m.indexOf(l))&&m.splice(g,1),m.length||this.parent.setRecordValue("hasChildRecords",!1,f)}}this.updateTreeGridUniqueID(l,"delete")}}s.length>0&&this.removeFromDataSource(s);var y={};if(this.parent.updatedConnectorLineCollection=[],this.parent.connectorLineIds=[],this.parent.predecessorModule.createConnectorLinesCollection(this.parent.flatData),this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&this.refreshRecordInImmutableMode(),y.requestType="delete",y.data=e.deletedRecordCollection,y.modifiedRecords=e.updatedRecordCollection,y.modifiedTaskData=w(e.updatedRecordCollection,null,null,this.parent),t.setValue("action",e.action,y),this.parent.isOnDelete=!1,"ResourceView"===this.parent.viewType){var D=y.data.filter(function(e){return!e.hasChildRecords}),v=function(e){var t=k.parent.flatData.filter(function(e){return e.ganttProperties.taskName===i.parent.localeObj.getConstant("unassignedTask")})[0],r=[];t&&(r=t.childRecords.filter(function(t){return t.ganttProperties.taskId===D[e].ganttProperties.taskId}));var a=k.parent.getParentTask(D[e].parentItem);a&&a.ganttProperties.taskName!==k.parent.localeObj.getConstant("unassignedTask")&&0===r.length?k.checkWithUnassignedTask(D[e]):a||r&&0!==r.length||k.checkWithUnassignedTask(D[e]),t=k.parent.flatData.filter(function(e){return e.ganttProperties.taskName===i.parent.localeObj.getConstant("unassignedTask")})[0];var n=k.parent.currentViewData.filter(function(i){return i.ganttProperties.taskId==D[e].ganttProperties.taskId&&!i.hasChildRecords&&i.parentItem&&t.uniqueID===i.parentItem.uniqueID?i:null});n[0]&&k.parent.dataOperation.updateParentItems(n[0])},k=this;for(o=0;o<D.length;o++)v(o)}this.parent.trigger("actionComplete",y),this.deletedTaskDetails=[],this.parent.initiateEditAction(!1),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow()},e.prototype.getNewTaskId=function(){var e="ResourceView"===this.parent.viewType?this.parent.getTaskIds():this.parent.ids,t=e.length+1;if("ResourceView"===this.parent.viewType){if((-1!==e.indexOf("T"+t)||-1!==e.indexOf("R"+t))&&(t+=1,-1!==e.indexOf("T"+t)||-1!==e.indexOf("R"+t)))do{t+=1}while(-1!==e.indexOf("T"+t)||-1!==e.indexOf("R"+t))}else if(-1!=e.indexOf(t.toString())&&(t+=1,-1!=e.indexOf(t.toString())))do{t+=1}while(-1!=e.indexOf(t.toString()));return"stringedit"===this.parent.columnByField[this.parent.taskFields.id].editType?t=t.toString():t},e.prototype.prepareNewlyAddedData=function(e,i){var r,a,n=this.parent.taskFields,s=this.parent.ids;if(e[n.id]&&(-1!==s.indexOf(e[n.id].toString())?e[n.id]=null:(a="string"==typeof e[n.id]?e[n.id]:parseInt(e[n.id],10),e[n.id]=t.isNullOrUndefined(a)?null:a)),e[n.id]||(r=this.getNewTaskId(),e[n.id]=r),this.parent.allowUnscheduledTasks||e[n.startDate]||(e[n.startDate]=this.parent.projectStartDate),!this.parent.allowUnscheduledTasks&&n.duration&&t.isNullOrUndefined(e[n.duration])&&(e[n.endDate]||(e[n.duration]="5")),n.progress&&(e[n.progress]=e[n.progress]?e[n.progress]>100?100:e[n.progress]:0),!this.parent.allowUnscheduledTasks&&!e[n.endDate]&&n.endDate&&!e[n.duration]){var o=this.parent.dataOperation.getDateFromFormat(this.parent.projectStartDate);o.setDate(o.getDate()+4),e[n.endDate]=this.parent.getFormatedDate(o,this.parent.getDateFormat())}},e.prototype.updateNewlyAddedDataBeforeAjax=function(e,i,r,a){var n=this.parent.dataOperation.createRecord(e,i);if(n.index=parseInt(n.ganttProperties.rowUniqueID.toString(),10)-1,!t.isNullOrUndefined(a)){this.parent.setRecordValue("parentItem",this.parent.dataOperation.getCloneParent(a),n);var s=n.parentItem?n.parentItem.index:null;this.parent.setRecordValue("parentIndex",s,n);var o=n.parentItem?n.parentItem.uniqueID:null;this.parent.setRecordValue("parentUniqueID",o,n),t.isNullOrUndefined(this.parent.taskFields.id)||t.isNullOrUndefined(this.parent.taskFields.parentID)||!n.parentItem||("ProjectView"===this.parent.viewType&&this.parent.setRecordValue(this.parent.taskFields.parentID,n.parentItem.taskId,n.taskData,!0),this.parent.setRecordValue("parentId",n.parentItem.taskId,n.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.parentID,n.parentItem.taskId,n,!0))}return this.parent.isOnEdit=!0,this.backUpAndPushNewlyAddedRecord(n,r,a),this.parent.taskFields.dependency&&n.ganttProperties.predecessorsName&&(this.parent.predecessorModule.ensurePredecessorCollectionHelper(n,n.ganttProperties),this.parent.predecessorModule.updatePredecessorHelper(n),this.parent.predecessorModule.validatePredecessorDates(n)),n.parentItem&&this.parent.getParentTask(n.parentItem).ganttProperties.isAutoSchedule&&this.parent.dataOperation.updateParentItems(n.parentItem),this.parent.isOnEdit=!1,n},e.prototype.getChildCount=function(e,t){var i;if(!e.hasChildRecords)return 0;for(var r=0;r<e.childRecords.length;r++)t++,(i=e.childRecords[r]).hasChildRecords&&(t=this.getChildCount(i,t));return t},e.prototype.getVisibleChildRecordCount=function(e,t,i){var r,a;if(e.hasChildRecords){a=(r=e.childRecords).length;for(var n=0;n<a;n++)-1!==i.indexOf(r[n])&&t++,r[n].hasChildRecords&&(t=this.getVisibleChildRecordCount(r[n],t,i))}else-1!==i.indexOf(e)&&t++;return t},e.prototype.updatePredecessorOnIndentOutdent=function(e){for(var i,r,a=e.ganttProperties.predecessor.length,n=e.ganttProperties,s=n.predecessor,o=0;o<a;o++)if(s[o].to===n.rowUniqueID.toString()){i=this.parent.getRecordByID(s[o].from),r=b(s[o],"from",i.ganttProperties.predecessor,"to");var l=t.extend([],i.ganttProperties.predecessor,[],!0);l.splice(r,1),this.parent.setRecordValue("predecessor",l,i.ganttProperties,!0)}else if(s[o].from===n.rowUniqueID.toString()){var d=(i=this.parent.getRecordByID(s[o].to)).ganttProperties.predecessorsName.toString().split(","),h=s[o].from+s[o].type,p=d.indexOf(h);d.splice(p,1),this.parent.setRecordValue("predecessorsName",d.join(","),i.ganttProperties,!0),this.parent.setRecordValue(this.parent.taskFields.dependency,d.join(","),i),r=b(s[o],"from",i.ganttProperties.predecessor,"to");var c=t.extend([],i.ganttProperties.predecessor,[],!0);c.splice(r,1),this.parent.setRecordValue("predecessor",c,i.ganttProperties,!0),this.parent.predecessorModule.validatePredecessorDates(i)}this.parent.setRecordValue("predecessor",[],e.ganttProperties,!0),this.parent.setRecordValue("predecessorsName","",e.ganttProperties,!0)},e.prototype.predecessorToString=function(e,t){for(var i=[],r=0,a=e.length;r<a;r++)if(t.ganttProperties.rowUniqueID.toString()!==e[r].from){var n=e[r].from+e[r].type;e[r].offset=isNaN(e[r].offset)?0:e[r].offset,0!==e[r].offset&&(e[r].offset<0?n+=e[r].offset.toString()+"d":e[r].offset>0&&(n+="+"+e[r].offset.toString()+"d")),i.push(n)}return i.join(",")},e.prototype.backUpAndPushNewlyAddedRecord=function(e,i,r){var a,n,s,o=this.parent.flatData,l=this.parent.currentViewData,d=this.parent.ids;switch(i){case"Top":o.splice(0,0,e),l.splice(0,0,e),d.splice(0,0,e.ganttProperties.rowUniqueID.toString());break;case"Bottom":if(o.push(e),l.push(e),d.push(e.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var h=0===e.level?"R"+e.ganttProperties.taskId:"T"+e.ganttProperties.taskId;this.parent.getTaskIds().push(h)}break;case"Above":n=o.indexOf(this.addRowSelectedItem),s=l.indexOf(this.addRowSelectedItem),this.recordCollectionUpdate(void 0,n,s,e,r,i);break;case"Below":if(a=o.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords){n=a+this.getChildCount(this.addRowSelectedItem,0)+1,s=l.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,l)+1}else n=a+1,s=l.indexOf(this.addRowSelectedItem)+1;this.recordCollectionUpdate(NaN,n,s,e,r,i);break;case"Child":if(a=o.indexOf(this.addRowSelectedItem),this.addRowSelectedItem.hasChildRecords){n=a+this.getChildCount(this.addRowSelectedItem,0)+1,this.addRowSelectedItem.expanded||this.parent.enableMultiTaskbar||this.parent.expandByID(this.addRowSelectedItem.ganttProperties.rowUniqueID),s=l.indexOf(this.addRowSelectedItem)+this.getVisibleChildRecordCount(this.addRowSelectedItem,0,l)+1}else 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),n=a+1,s=l.indexOf(this.addRowSelectedItem)+1,this.addRowSelectedItem.ganttProperties.predecessor&&this.updatePredecessorOnIndentOutdent(this.addRowSelectedItem),t.isNullOrUndefined(this.addRowSelectedItem.ganttProperties.segments)||(this.addRowSelectedItem.ganttProperties.segments=null);this.recordCollectionUpdate(NaN,n,s,e,r,i)}this.newlyAddedRecordBackup=e},e.prototype.recordCollectionUpdate=function(e,i,r,n,s,o){var l=this.parent.flatData,d=this.parent.currentViewData,h=this.parent.ids;if(l.splice(i,0,n),d.splice(r,0,n),"ResourceView"===this.parent.viewType&&"number"==typeof n.ganttProperties.taskId){var p=n.ganttProperties.taskId;h.push(p.toString())}if(h.splice(i,0,n.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var c=0===n.level?"R"+n.ganttProperties.taskId:"T"+n.ganttProperties.taskId;this.parent.getTaskIds().splice(i,0,c)}if(!t.isNullOrUndefined(s)&&(e="Above"==o?s.childRecords.indexOf(this.addRowSelectedItem):"Below"==o?s.childRecords.indexOf(this.addRowSelectedItem)+1:s.childRecords.length,s.childRecords.splice(e,0,n),this.parent.taskFields.child||(this.parent.taskFields.child="Children"),this.parent.dataSource instanceof a.DataManager&&t.isNullOrUndefined(s.taskData[this.parent.taskFields.parentID])||!t.isNullOrUndefined(this.parent.dataSource))){var u=this.parent.taskFields.child;s.taskData[u]&&s.taskData[u].length>0?"Above"===o||"Below"===o?s.taskData[u].splice(e,0,n.taskData):s.taskData[u].push(n.taskData):(s.taskData[u]=[],s.taskData[u].push(n.taskData)),this.isNewRecordAdded=!0}},e.prototype.constructTaskAddedEventArgs=function(e,t,i){var r={};if(r.action=r.requestType=i,e.length>1){r.data=[],r.newTaskData=[],r.recordIndex=[];for(var a=0;a<e.length;a++)r.data[a]=e[a],r.newTaskData[a]=w([e[a]],r.data[a],r,this.parent),r.recordIndex[a]=e[a].index}else if(1===e.length)for(a=0;a<e.length;a++)r.data=e[a],r.newTaskData=w([e[a]],r.data,r,this.parent),r.recordIndex=e[a].index;return r.modifiedRecords=t,r.modifiedTaskData=w(t,null,null,this.parent),r},e.prototype.addSuccess=function(e){this.parent.treeGrid.parentData=[],this.parent.addDeleteRecord=!0,this.parent.selectedRowIndex=0,this.parent.treeGrid.isAddedFromGantt=!0,this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&(this.parent.modifiedRecords=e.modifiedRecords,this.parent.modifiedRecords.push(e.data),this.refreshRecordInImmutableMode())},e.prototype.refreshRecordInImmutableMode=function(e,i){if(!i&&!t.isNullOrUndefined(e))for(var r=e[0].index+1;r<this.parent.currentViewData.length&&e[0].level<this.parent.currentViewData[r].level;r++)this.parent.modifiedRecords.push(this.parent.currentViewData[r]);var a=function(e){var t=n.parent.modifiedRecords[e],i=n.parent.allowRowDragAndDrop?1:0,r=n.parent.taskFields.id,a=n.parent.currentViewData.findIndex(function(e){return e[r]===t[r]});n.parent.treeGrid.getRows()[a]&&(n.parent.treeGrid.renderModule.cellRender({data:t,cell:n.parent.treeGrid.getRows()[a].cells[n.parent.treeColumnIndex+i],column:n.parent.treeGrid.grid.getColumns()[n.parent.treeColumnIndex],requestType:"rowDragAndDrop"}),n.parent.treeGrid.renderModule.RowModifier({data:t,row:n.parent.treeGrid.getRows()[a],rowHeight:n.parent.rowHeight}))},n=this;for(r=0;r<this.parent.modifiedRecords.length;r++)a(r)},e.prototype.updateRealDataSource=function(e,i){var r=this.parent.taskFields,n=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource;this.parent.dataSource instanceof a.DataManager&&(n=this.parent.dataSource.dataSource.json);for(var s=0;s<e.length;s++)(t.isNullOrUndefined(i)||t.isNullOrUndefined(this.addRowSelectedItem))&&(i="Bottom"===i?"Bottom":"Top"),"Top"===i?n.splice(0,0,e[s].taskData):"Bottom"===i?n.push(e[s].taskData):t.isNullOrUndefined(r.id)||t.isNullOrUndefined(r.parentID)?(this.isNewRecordAdded||this.addDataInRealDataSource(n,e[s].taskData,i),this.isNewRecordAdded=!1):n.push(e[s].taskData),this.isBreakLoop=!1},e.prototype.addDataInRealDataSource=function(e,i,r){for(var a=0;a<e.length;a++){var n=this.parent.taskFields.child;if(this.isBreakLoop)break;if(t.getValue(this.parent.taskFields.id,e[a]).toString()===this.addRowSelectedItem.ganttProperties.rowUniqueID.toString()){"Above"===r?e.splice(a,0,i):"Below"===r?e.splice(a+1,0,i):"Child"===r&&(e[a][n]&&e[a][n].length>0?e[a][n].push(i):(e[a][n]=[],e[a][n].push(i))),this.isBreakLoop=!0;break}if(e[a][n]){var s=e[a][n];this.addDataInRealDataSource(s,i,r)}}},e.prototype.addRecord=function(e,i,r){var n=this,s=this.parent.taskFields.id;if(this.parent.editModule&&this.parent.editSettings.allowAdding){this.parent.isDynamicData=!0;var o=[];if(t.isNullOrUndefined(e))this.validateTaskPosition(e,i,r,o);else if(e instanceof Array)for(var l=0;l<e.length;l++)this.validateTaskPosition(e[l],i,r,o);else{if("object"!=typeof e)return;this.validateTaskPosition(e,i,r,o)}var d={};d=this.constructTaskAddedEventArgs(o,this.parent.editedRecords,"beforeAdd"),this.parent.trigger("actionBegin",d,function(e){t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.showSpinner():n.parent.showMaskRow();var r=n.parent.taskFields,l="ResourceView"===n.parent.viewType?n.parent.flatData[n.parent.getTaskIds().indexOf("T"+e.data[r.id])]:n.parent.getRecordByID(e.data[r.id]);if(t.isNullOrUndefined(l)||n.validateUpdateValues(e.newTaskData,l,!0),t.isNullOrUndefined(e.data[""+s])||e.data[s]!=e.data.ganttProperties.taskId&&(e.data.ganttProperties.taskId=e.data[s],e.newTaskData[s]=e.data[s]),e.cancel)e=e,n.removeAddedRecord(),n.reUpdatePreviousRecords(),n._resetProperties();else if(v(n.parent.dataSource)){var d=n.parent.dataSource,h={addedRecords:[e.newTaskData],changedRecords:e.modifiedTaskData},p=e.data.ganttProperties.taskId.toString(),c=n.parent.query instanceof a.Query?n.parent.query:new a.Query,u=d.adaptor;if(u instanceof a.WebApiAdaptor&&u instanceof a.ODataAdaptor&&!d.dataSource.batchUrl){d.insert(h.addedRecords,null,c).then(function(i){t.isNullOrUndefined(i[0])?h.addedRecords[0]:i[0],n.updateNewRecord(o,e)}).catch(function(t){n.removeAddedRecord(),n.dmFailure(t,e),n._resetProperties()})}else{d.saveChanges(h,n.parent.taskFields.id,null,c).then(function(i){if(n.parent.taskFields.id&&!t.isNullOrUndefined(i.addedRecords[0][n.parent.taskFields.id])&&i.addedRecords[0][n.parent.taskFields.id].toString()==p){n.parent.setRecordValue("taskId",i.addedRecords[0][n.parent.taskFields.id],e.data.ganttProperties,!0),n.parent.setRecordValue("taskData",i.addedRecords[0],e.data),n.parent.setRecordValue(n.parent.taskFields.id,i.addedRecords[0][n.parent.taskFields.id],e.data),n.parent.setRecordValue("rowUniqueID",i.addedRecords[0][n.parent.taskFields.id].toString(),e.data.ganttProperties,!0);var r=n.parent.ids.indexOf(p);-1!==r&&(n.parent.ids[r]=i.addedRecords[0][n.parent.taskFields.id].toString())}n.updateNewRecord(o,e)}).catch(function(t){n.removeAddedRecord(),n.dmFailure(t,e),n._resetProperties()})}}else{if("ProjectView"===n.parent.viewType){if("Top"===i||"Bottom"===i||"Above"===i||"Below"===i||"Child"===i||t.isNullOrUndefined(i)&&!e.data.parentItem)if(e.data instanceof Array)n.updateRealDataSource(e.data,i);else{var g=[];g.push(e.data),n.updateRealDataSource(g,i)}}else{(y(n.parent)?t.getValue("result",n.parent.dataSource):n.parent.dataSource).push(e.data.taskData)}0===o.level&&n.parent.treeGrid.parentData.splice(0,0,o),n.updateTreeGridUniqueID(o,"add"),n.refreshNewlyAddedRecord(e,o),n._resetProperties()}})}},e.prototype.createNewRecord=function(){for(var e={},i=this.parent.ganttColumns,r=this.parent.taskFields,a=this.parent.editModule.getNewTaskId(),n=0;n<i.length;n++){var s=i[n].field;s===r.id?e[s]=a:i[n].field===r.startDate?(t.isNullOrUndefined(e[r.endDate])?e[s]=this.parent.editModule.dialogModule.getMinimumStartDate():e[s]=new Date(e[r.endDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone))):i[n].field===r.endDate?(t.isNullOrUndefined(e[r.startDate])?e[s]=this.parent.editModule.dialogModule.getMinimumStartDate():e[s]=new Date(e[r.startDate]),this.parent.timezone&&(e[s]=this.parent.dateValidationModule.remove(e[s],this.parent.timezone))):i[n].field===r.duration?e[s]=1:i[n].field===r.name?e[s]=this.parent.editModule.dialogModule.localeObj.getConstant("addDialogTitle")+" "+a:i[n].field===r.progress?e[s]=0:i[n].field===r.work?e[s]=0:"taskType"===i[n].field?e[s]=this.parent.taskType:e[this.parent.ganttColumns[n].field]=""}return e},e.prototype.validateTaskPosition=function(e,i,r,a){var n=t.isNullOrUndefined(r)||isNaN(parseInt(r.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:r;this.addRowSelectedItem=t.isNullOrUndefined(n)?null:this.parent.updatedRecords[n],i=t.isNullOrUndefined(i)?this.parent.editSettings.newRowPosition:i,e=t.isNullOrUndefined(e)?this.createNewRecord():e,((t.isNullOrUndefined(n)||n<0||t.isNullOrUndefined(this.addRowSelectedItem))&&("Above"===i||"Below"===i||"Child"===i)||!i||"Above"!==i&&"Below"!==i&&"Child"!==i&&"Top"!==i&&"Bottom"!==i)&&(i="Top");var s,o=0;switch(i){case"Top":case"Bottom":o="ResourceView"===this.parent.viewType?1:0;break;case"Above":case"Below":o=this.addRowSelectedItem.level,s=this.parent.getParentTask(this.addRowSelectedItem.parentItem);break;case"Child":o=this.addRowSelectedItem.level+1,s=this.addRowSelectedItem}this.prepareNewlyAddedData(e,i);var l=this.updateNewlyAddedDataBeforeAjax(e,o,i,s);a.push(l)},e.prototype.updateNewRecord=function(e,i){if(0===e.level){this.parent.treeGrid.parentData.splice(0,0,e);t.getValue("dataOperation.dataArray",this.parent).splice(0,0,e.taskData)}this.updateTreeGridUniqueID(e,"add"),this.refreshNewlyAddedRecord(i,e),this._resetProperties()},e.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)},e.prototype.updateTreeGridUniqueID=function(e,i){"add"===i?t.setValue("uniqueIDCollection."+e.uniqueID,e,this.parent.treeGrid):"delete"===i&&t.deleteObject(t.getValue("uniqueIDCollection",this.parent.treeGrid),e.uniqueID)},e.prototype.refreshNewlyAddedRecord=function(e,i){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){var r=[];e.modifiedRecords.length>0?(r=e.data.length>0?e.data:[e.data]).push.apply(r,e.modifiedRecords):r=e.data.length>0?e.data:[e.data],this.parent.timelineModule.updateTimeLineOnEditing([r],e.action)}if(this.addSuccess(e),e=this.constructTaskAddedEventArgs(i,e.modifiedRecords,"add"),this.dialogModule.isAddNewResource&&!this.parent.isEdit&&this.parent.taskFields.work&&this.parent.dataOperation.updateWorkWithDuration(i[0]),this.parent.trigger("actionComplete",e),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.dialogModule.dialog&&!this.dialogModule.dialogObj.isDestroyed&&this.dialogModule.dialogObj.hide(),this.dialogModule.dialogClose(),"ResourceView"===this.parent.viewType)if(i.length>1)for(var a=0;a<i.length;a++){if(e.data[a].ganttProperties.sharedTaskUniqueIds.push(e.data[a].ganttProperties.rowUniqueID),e.data[a].ganttProperties.resourceInfo){(s=t.extend([],[],e.data[a].ganttProperties.resourceInfo,!0)).splice(0,1),this.updateResoures([],s,e.data[a])}else this.removeChildRecord(e.data[a]),this.parent.editModule.checkWithUnassignedTask(e.data[a]);for(var n=0;n<this.updateParentRecords.length;n++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[n]);this.updateParentRecords=[]}else{if(e.data.ganttProperties.sharedTaskUniqueIds.push(e.data.ganttProperties.rowUniqueID),e.data.ganttProperties.resourceInfo&&e.data.ganttProperties.resourceInfo.length){if(e.data.ganttProperties.resourceInfo.length>1){var s;(s=t.extend([],[],e.data.ganttProperties.resourceInfo,!0)).splice(0,1),this.updateResoures([],s,e.data)}}else this.removeChildRecord(e.data),this.parent.editModule.checkWithUnassignedTask(e.data);for(n=0;n<this.updateParentRecords.length;n++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[n]);this.updateParentRecords=[]}},e.prototype.removeAddedRecord=function(){var e=this.parent.flatData,i=this.parent.currentViewData,r=this.parent.ids,a=e.indexOf(this.newlyAddedRecordBackup),n=i.indexOf(this.newlyAddedRecordBackup),s=r.indexOf(this.newlyAddedRecordBackup.ganttProperties.rowUniqueID.toString());if(t.deleteObject(this.parent.previousRecords,e[a].uniqueID),this.newlyAddedRecordBackup.parentItem){var o=this.parent.getParentTask(this.newlyAddedRecordBackup.parentItem),l=o.childRecords.indexOf(this.newlyAddedRecordBackup);o.childRecords.splice(l,1)}e.splice(a,1),i.splice(n,1),r.splice(s,1)},e.prototype.getPrevRecordIndex=function(){var e=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],t=this.parent.selectionModule.getSelectedRecords()[0],i=this.parent.getRootParent(e,t.level);return this.parent.updatedRecords.indexOf(i)},e.prototype.indent=function(){var e,t=this.parent.selectedRowIndex,i=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),r=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1],a=this.parent.selectionModule.getSelectedRecords()[0];this.parent.editSettings.allowEditing&&0!==t&&-1!==t&&i&&"ResourceView"!==this.parent.viewType&&this.parent.updatedRecords[t].level-r.level!=1&&(e=r.level-a.level==0?this.parent.selectionModule.getSelectedRowIndexes()[0]-1:this.getPrevRecordIndex(),this.indentOutdentRow([this.parent.selectionModule.getSelectedRowIndexes()[0]],e,"child"))},e.prototype.outdent=function(){var e,t=this.parent.selectionModule.getSelectedRowIndexes()[0],i=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length);if(this.parent.editSettings.allowEditing&&-1!==t&&0!==t&&i&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[t].level){var r=this.parent.getTaskByUniqueID(this.parent.selectionModule.getSelectedRecords()[0].parentItem.uniqueID);e=this.parent.updatedRecords.indexOf(r),this.indentOutdentRow([t],e,"below")}},e.prototype.indentOutdentRow=function(e,i,r){var a=this;e[0],"above"===r&&(this.dropPosition="topSegment"),"below"===r&&(this.dropPosition="bottomSegment"),"child"===r&&(this.dropPosition="middleSegment");for(var n=void 0,s=[],o=0;o<e.length;o++)s[o]=this.parent.updatedRecords[e[o]];var l={data:s,dropIndex:i,dropPosition:this.dropPosition};"middleSegment"===this.dropPosition?n="indenting":"bottomSegment"===this.dropPosition&&(n="outdenting");var d={action:n,data:s[0],cancel:!1};this.parent.trigger("actionBegin",d,function(e){t.isNullOrUndefined(a.parent.loadingIndicator)||"Shimmer"!==a.parent.loadingIndicator.indicatorType?a.parent.showSpinner():a.parent.showMaskRow(),e.cancel||a.reArrangeRows(l,!0)})},e.prototype.reArrangeRows=function(e,i){if(this.dropPosition=e.dropPosition,"Invalid"!==e.dropPosition&&this.parent.editModule){var r=this.parent,a=void 0;this.droppedRecord=r.updatedRecords[e.dropIndex];var n=[],s=this.droppedRecord;e.data[0]?n=e.data:n.push(e.data);for(var o=0,l=n.length,d=0;d<l;d++){if(this.parent.isOnEdit=!0,a=n[d],this.draggedRecord=a,"Invalid"!==this.dropPosition){i&&this.deleteDragRow();var h=this.treeGridData.indexOf(s);if("bottomSegment"===this.dropPosition){if(s.hasChildRecords){o=this.parent.editModule.getChildCount(s,0),this.parent.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(h+o+1,0,this.draggedRecord.taskData),this.treeGridData.splice(h+o+1,0,this.draggedRecord),this.parent.ids.splice(h+o+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString());var p=this.parent.ids.indexOf(this.draggedRecord[this.parent.taskFields.id].toString());p!==h+o+1&&(this.parent.ids.splice(p,1),this.parent.ids.splice(h+o+1,0,this.draggedRecord[this.parent.taskFields.id].toString()))}else this.parent.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(h+1,0,this.draggedRecord.taskData),this.treeGridData.splice(h+1,0,this.draggedRecord),this.parent.ids.splice(h+1,0,this.draggedRecord.ganttProperties.rowUniqueID.toString());if(this.parent.setRecordValue("parentItem",this.treeGridData[h].parentItem,a),this.parent.setRecordValue("parentUniqueID",this.treeGridData[h].parentUniqueID,a),this.parent.setRecordValue("level",this.treeGridData[h].level,a),a.hasChildRecords){this.updateChildRecordLevel(a,1),this.updateChildRecord(a,h+o+1)}if(s.parentItem){var c=this.parent.getParentTask(s.parentItem).childRecords,u=c.indexOf(s)+1;c.splice(u,0,a)}}"middleSegment"===this.dropPosition&&this.dropMiddle(h),t.isNullOrUndefined(a.parentItem&&-1!==this.updateParentRecords.indexOf(a.parentItem))||this.updateParentRecords.push(a.parentItem)}if(t.isNullOrUndefined(a.parentItem)){var g=this.parent.treeGrid.parentData,f=g.indexOf(this.droppedRecord);"bottomSegment"===this.dropPosition&&g.splice(f+1,0,a)}this.refreshDataSource()}"middleSegment"===this.dropPosition&&(s.ganttProperties.predecessor&&(this.parent.editModule.removePredecessorOnDelete(s),s.ganttProperties.predecessor=null,s.ganttProperties.predecessorsName=null,s[this.parent.taskFields.dependency]=null,s.taskData[this.parent.taskFields.dependency]=null),s.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,s.ganttProperties,!0),t.isNullOrUndefined(s.taskData[this.parent.taskFields.milestone])||!0===s.taskData[this.parent.taskFields.milestone]&&(s.taskData[this.parent.taskFields.milestone]=!1)));for(var m=0;m<this.updateParentRecords.length;m++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[m]);this.updateParentRecords=[],this.parent.isOnEdit=!1}this.refreshRecord(e)},e.prototype.refreshRecord=function(e,t){var i=this;if(v(this.parent.dataSource)){var r=this.parent.dataSource,n={changedRecords:w(this.parent.editedRecords,null,null,this.parent)},s=this.parent.query instanceof a.Query?this.parent.query:new a.Query,o=null,l=r.adaptor;if(l instanceof a.WebApiAdaptor&&l instanceof a.ODataAdaptor&&!r.dataSource.batchUrl){o=r.update(this.parent.taskFields.id,n.changedRecords,null,s)}else o=r.saveChanges(n,this.parent.taskFields.id,null,s);o.then(function(r){return i.indentSuccess(r,e,t)}).catch(function(e){return i.indentFailure(e)})}else this.indentOutdentSuccess(e,t)},e.prototype.indentSuccess=function(e,t,i){this.indentOutdentSuccess(t,i)},e.prototype.indentFailure=function(e){this.parent.trigger("actionFailure",{error:e})},e.prototype.indentOutdentSuccess=function(e,i){if(this.parent.treeGrid.parentData=[],this.parent.treeGrid.refresh(),this.parent.enableImmutableMode&&this.refreshRecordInImmutableMode(e.data,i),i?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 r=0;r<e.modifiedRecords.length;r++)k(e.modifiedRecords[r],this.parent);this.parent.trigger("actionComplete",e),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.hideSpinner():this.parent.hideMaskRow(),this.parent.editedRecords=[]},e.prototype.refreshDataSource=function(){var e,i,r=this.draggedRecord,n=this.droppedRecord,s=this.parent;if((e=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!t.isNullOrUndefined(n)&&!n.parentItem){for(var o=0;o<Object.keys(e).length;o++)e[o][this.parent.taskFields.child]===n.taskData[this.parent.taskFields.child]&&(i=o);"topSegment"===this.dropPosition?this.parent.taskFields.parentID||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||e.splice(i+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!t.isNullOrUndefined(n)&&n.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var l="topSegment"===this.dropPosition?"Above":"Below";this.parent.editModule.addRowSelectedItem=n;var d=[];Array.isArray(r)?d=r:d[0]=r,this.parent.editModule.updateRealDataSource(d,l),delete this.parent.editModule.addRowSelectedItem}this.parent.taskFields.parentID&&(r.parentItem?"topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition?(r[this.parent.taskFields.parentID]=n[this.parent.taskFields.parentID],r.taskData[this.parent.taskFields.parentID]=n[this.parent.taskFields.parentID],r.ganttProperties.parentId=n[this.parent.taskFields.parentID]):(r[this.parent.taskFields.parentID]=n[this.parent.taskFields.id],r.taskData[this.parent.taskFields.parentID]=n[this.parent.taskFields.id],r.ganttProperties.parentId=n[this.parent.taskFields.id]):(r[this.parent.taskFields.parentID]=null,r.taskData[this.parent.taskFields.parentID]=null,r.ganttProperties.parentId=null))},e.prototype.deleteDragRow=function(){this.parent.dataSource instanceof a.DataManager?this.ganttData=t.getValue("dataOperation.dataArray",this.parent):this.ganttData=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource,this.treeGridData=y(this.parent)?t.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource;var e=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(e)},e.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 r=0;r<e.length;r++)this.updateIndentedChildRecords(e[r])}},e.prototype.dropMiddle=function(e){var i=this.parent,r=this.parent.editModule.getChildCount(this.droppedRecord,0),a=t.isNullOrUndefined(r)||0===r?e+1:r+e+1;if("middleSegment"===this.dropPosition){if(i.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(a,0,this.draggedRecord.taskData),this.treeGridData.splice(a,0,this.draggedRecord),this.parent.ids.splice(a,0,this.draggedRecord[this.parent.taskFields.id].toString()),this.recordLevel(),this.draggedRecord.hasChildRecords&&(this.updateChildRecord(this.draggedRecord,a,this.droppedRecord.expanded),this.parent.enableImmutableMode)){var n=this.draggedRecord;this.updateIndentedChildRecords(n)}t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.updateChildRecordLevel=function(e,t){var i,r=0;if(t++,!e.hasChildRecords)return 0;r=e.childRecords.length;for(var a=0;a<r;a++){i=e.childRecords[a];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}i.level=e.parentItem?n.level+t:e.level+1,i.hasChildRecords&&(t--,t=this.updateChildRecordLevel(i,t))}return t},e.prototype.updateChildRecord=function(e,t,i){var r,a=this.parent,n=0;if(!e.hasChildRecords)return 0;n=e.childRecords.length;for(var s=0;s<n;s++)r=e.childRecords[s],t++,a.flatData.splice(t,0,r),this.parent.ids.splice(t,0,r.ganttProperties.rowUniqueID.toString()),a.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(t,0,r.taskData),r.hasChildRecords&&(t=this.updateChildRecord(r,t));return t},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=e,s=this.parent.getParentTask(n.parentItem);if(n){if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&(l=o.indexOf(n),s.childRecords.splice(l,1),this.parent.taskFields.parentID||s.taskData[this.parent.taskFields.child].splice(l,1),this.updateParentRecords.push(s))}if(r.taskFields.parentID){n.hasChildRecords&&n.childRecords.length>0&&this.removeChildItem(n);for(var d=void 0,h=i.length>0?i:this.parent.currentViewData,p=0;p<h.length;p++)h[p][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(d=p);if(-1!==d){i.length>0&&i.splice(d,1);var c=void 0;for(p=0;p<this.treeGridData.length;p++)this.treeGridData[p][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(c=p);this.treeGridData.splice(c,1),this.parent.ids.splice(c,1),-1!==this.parent.treeGrid.parentData.indexOf(n)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(n),1)}}var u=this.treeGridData.indexOf(n);if(!r.taskFields.parentID){var g=this.getChildCount(n,0);this.treeGridData.splice(u,g+1),this.parent.ids.splice(u,g+1);var f=this.ganttData.indexOf(n.taskData);-1!==f&&(this.ganttData.splice(f,1),this.parent.treeGrid.parentData.splice(f,1))}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(this.parent.setRecordValue("expanded",!1,s),this.parent.setRecordValue("hasChildRecords",!1,s))}},e.prototype.removeChildItem=function(e){for(var i,r,n=0;n<e.childRecords.length;n++){i=e.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(r=o);if(-1!==r){s.length>0&&s.splice(r,1);for(var l=void 0,d=0;d<this.treeGridData.length;d++)this.treeGridData[d][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(l=d);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1)}i.hasChildRecords&&this.removeChildItem(i)}},e.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,r=this.droppedRecord,a=e.taskFields.child;if(r.hasChildRecords||(r.hasChildRecords=!0,r.childRecords.length||(r.childRecords=[],!e.taskFields.parentID&&t.isNullOrUndefined(r.taskData[a])&&(r.taskData[a]=[]))),"middleSegment"===this.dropPosition){var n=t.extend({},r);delete n.childRecords;var s={uniqueID:n.uniqueID,expanded:n.expanded,level:n.level,index:n.index,taskId:n.ganttProperties.rowUniqueID};if(this.parent.setRecordValue("parentItem",s,i),this.parent.setRecordValue("parentUniqueID",r.uniqueID,i),r.childRecords.splice(r.childRecords.length,0,i),t.isNullOrUndefined(i)||e.taskFields.parentID||t.isNullOrUndefined(r.taskData[a])||r.taskData[e.taskFields.child].splice(r.childRecords.length,0,i.taskData),!t.isNullOrUndefined(r.ganttProperties.segments)&&r.ganttProperties.segments.length>0&&(r.ganttProperties.segments=null,r.taskData[e.taskFields.segments]=null),i.hasChildRecords){i.level=r.level+1,this.updateChildRecordLevel(i,1)}else i.level=r.level+1;r.expanded=!0}},e}(),di=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Reorder),this.parent.treeGrid.allowReordering=this.parent.allowReordering,this.bindEvents()}return e.prototype.getModuleName=function(){return"reorder"},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.columnDragStart=function(t){e.parent.trigger("columnDragStart",t)},this.parent.treeGrid.columnDrag=function(t){e.parent.trigger("columnDrag",t)},this.parent.treeGrid.columnDrop=function(t){e.parent.trigger("columnDrop",t)}},e.prototype.destroy=function(){},e}(),hi=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Resize),this.parent.treeGrid.allowResizing=this.parent.allowResizing,this.bindEvents()}return e.prototype.getModuleName=function(){return"resize"},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.resizeStart=function(t){e.parent.trigger("resizeStart",t)},this.parent.treeGrid.resizing=function(t){e.parent.trigger("resizing",t)},this.parent.treeGrid.resizeStop=function(t){e.parent.trigger("resizeStop",t)}},e.prototype.destroy=function(){},e}(),pi=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Filter),this.parent.treeGrid.allowFiltering=this.parent.allowFiltering,this.updateCustomFilters(),this.parent.treeGrid.filterSettings=r.getActualProperties(this.parent.filterSettings),this.addEventListener()}return e.prototype.getModuleName=function(){return"filter"},e.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])}},e.prototype.updateModel=function(){this.parent.filterSettings=this.parent.treeGrid.filterSettings},e.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)},e.prototype.wireEvents=function(e){t.EventHandler.add(document.getElementById(e),"click",this.mouseClickHandler,this)},e.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:{})},e.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},e.prototype.mouseClickHandler=function(e){t.closest(e.target,".e-excelfilter")&&this.parent.treeGrid.grid.notify("click",e)},e.prototype.unWireEvents=function(){t.EventHandler.remove(this.parent.element,"click",this.mouseClickHandler)},e.prototype.getDatePickerFilter=function(e){var i,a=this,n=this.parent,s=e===n.taskFields.startDate||e===n.taskFields.baselineStartDate?n.defaultStartTime:n.defaultEndTime;return{create:function(e){var n=r.getCustomDateFormat(e.column.format,e.column.type),s=t.createElement("input",{className:"flm-input"});e.target.appendChild(s),(i=new c.DatePicker({placeholder:a.parent.localeObj.getConstant("enterValue"),format:n})).enableRtl=a.parent.enableRtl,i.appendTo(s)},write:function(e){i.value=e.filteredValue},read:function(e){i.value&&i.value.setSeconds(s),e.fltrObj.filterByColumn(e.column.field,e.operator,i.value)}}},e.prototype.getDateTimePickerFilter=function(){var e,i=this;return{create:function(a){var n=r.getCustomDateFormat(a.column.format,a.column.type),s=t.createElement("input",{className:"flm-input"});a.target.appendChild(s),(e=new c.DateTimePicker({placeholder:i.parent.localeObj.getConstant("enterValue"),format:n})).enableRtl=i.parent.enableRtl,e.appendTo(s)},write:function(t){e.value=t.filteredValue},read:function(t){t.fltrObj.filterByColumn(t.column.field,t.operator,e.value)}}},e.prototype.getDurationFilter=function(){var e,i=this,r=this.parent,a="";return{create:function(r){var a=t.createElement("input",{className:"e-input"});a.setAttribute("placeholder",i.parent.localeObj.getConstant("enterValue")),r.target.appendChild(a),(e=new h.TextBox).enableRtl=i.parent.enableRtl,e.appendTo(a)},write:function(t){e.value=t.filteredValue?a:""},read:function(n){var s=i.parent.dataOperation.getDurationValue(e.value),o=t.getValue("duration",s),l=t.getValue("durationUnit",s);if(o>=0){var d=void 0;"minute"===l?d=60*o/r.secondsPerDay:"hour"===l?d=60*o*60/r.secondsPerDay:(d=o,l="day"),n.fltrObj.filterByColumn(n.column.field,n.operator,d),a=i.parent.dataOperation.getDurationString(o,l)}else n.fltrObj.filterByColumn(n.column.field,n.operator,null),a=null}}},e.prototype.columnMenuOpen=function(e){this.filterMenuElement&&document.body.contains(this.filterMenuElement)&&t.remove(this.filterMenuElement),this.filterMenuElement=null},e.prototype.actionBegin=function(e){},e.prototype.closeFilterOnContextClick=function(e){var i=document.querySelector("body > div.e-datepicker"),r=document.querySelector("body > div.e-datetimepicker");if(this.filterMenuElement&&document.body.contains(this.filterMenuElement)){var a=t.closest(e,"#"+this.parent.element.id)||e.querySelector("#"+this.parent.element.id);(!this.filterMenuElement.contains(e)&&!t.isNullOrUndefined(a)||!this.filterMenuElement.contains(e)&&t.isNullOrUndefined(i)&&t.isNullOrUndefined(r)&&("DIV"===e.nodeName||"HTML"===e.nodeName||"SPAN"===e.nodeName||"BUTTON"===e.nodeName))&&(t.remove(this.filterMenuElement),this.parent.treeGrid.grid.notify("filter-menu-close",{isOpen:!1}),this.filterMenuElement=null)}},e.prototype.actionComplete=function(e){if(t.isNullOrUndefined(e.filterModel)||t.isNullOrUndefined(e.filterModel.dialogObj)||t.isNullOrUndefined(e.filterModel.dialogObj.element)||"Excel"===this.parent.filterSettings.type&&this.wireEvents(e.filterModel.dialogObj.element.id),e.requestType===r.filterAfterOpen){"Menu"===this.parent.treeGrid.filterSettings.type?this.filterMenuElement=t.getValue("filterModel.dlgObj.element",e):this.filterMenuElement=t.getValue("filterModel.dialogObj.element",e),this.updateFilterMenuPosition(this.filterMenuElement,e);var i=this.parent.taskFields.id,a=this.parent.taskFields.dependency,n=this.parent.taskFields.resourceInfo,s=this.parent.treeGrid.grid.filterModule,o=t.getValue("values",s);if(e.columnName===a&&t.isNullOrUndefined(t.getValue(a,o))||e.columnName===n&&t.isNullOrUndefined(t.getValue(n,o))){var l=this.filterMenuElement.querySelector(".e-dropdownlist"),d=void 0;t.isNullOrUndefined(l)||((d=t.getValue("ej2_instances[0]",l)).index=2,d.dataBind())}else if(e.columnName===i&&t.isNullOrUndefined(t.getValue(i,o))&&"Menu"===this.parent.treeGrid.filterSettings.type){l=this.filterMenuElement.querySelector(".e-flmenu-input"),d=t.getValue("ej2_instances[0]",l);!t.isNullOrUndefined(d)&&t.isNullOrUndefined(this.parent.columnByField[e.columnName].format)&&(d.format="n")}}},e.prototype.setPosition=function(e,i){var r,a,n,s,o,l,d,h=this.parent.element.getBoundingClientRect(),p=h.top,c=h.left;if(!t.isNullOrUndefined(this.parent.element.parentNode)&&"BODY"!=this.parent.element.parentNode.tagName){for(a=(r=this.parent.element.parentNode).getBoundingClientRect().top,l=r.style.marginTop;;){if(Math.abs(p)>Math.abs(a)){s=p-a;break}t.isNullOrUndefined(this.parent.element.parentNode)||(l=(r=r.parentNode).parentNode.style.marginTop),a=r.getBoundingClientRect().top}for(n=r.getBoundingClientRect().left,d=r.style.marginLeft;;){if(Math.abs(c)>Math.abs(n)){o=c-n;break}t.isNullOrUndefined(this.parent.element.parentNode)||(d=(r=r.parentNode).style.marginLeft),n=r.getBoundingClientRect().left}}var u=e.getBoundingClientRect(),g=u.right+window.scrollX,f=u.top+window.scrollY;h.right<g+i.offsetWidth?u.left-i.offsetWidth>h.left?g=u.left-i.offsetWidth:g-=g+i.offsetWidth-h.right:t.isNullOrUndefined(s)||t.isNullOrUndefined(o)||(g=Math.abs(u.right-h.left),f=Math.abs(u.top-h.top)),t.isNullOrUndefined(s)||t.isNullOrUndefined(o)?(i.style.top=f+"px",i.style.left=g+"px"):(i.style.top="string"==typeof parseInt(l)?f+s+parseInt(l)+"px":f+s+"px",i.style.left="string"==typeof parseInt(d)?g+o+parseInt(d)+8+"px":g+o+"px")},e.prototype.updateFilterMenuPosition=function(e,i){t.addClass([e],"e-gantt"),document.querySelector("#"+this.parent.controlId).appendChild(e);var a;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,t.getValue("filterModel.dlgObj.element",i)):this.setPosition(a,t.getValue("filterModel.dialogObj.element",i))):(a=this.parent.treeGrid.grid.getColumnHeaderByField(i.columnName).querySelector(".e-filtermenudiv"),"Menu"===this.parent.treeGrid.filterSettings.type?r.getFilterMenuPostion(a,t.getValue("filterModel.dlgObj",i)):r.getFilterMenuPostion(a,t.getValue("filterModel.dialogObj",i))),"Menu"===this.parent.treeGrid.filterSettings.type&&e.querySelector(".e-valid-input").focus()},e.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))},e.prototype.destroy=function(){this.removeEventListener(),this.unWireEvents()},e}(),ci=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.Sort),this.parent.treeGrid.allowSorting=this.parent.allowSorting,this.parent.treeGrid.sortSettings=r.getActualProperties(this.parent.sortSettings),this.addEventListener()}return e.prototype.getModuleName=function(){return"sort"},e.prototype.addEventListener=function(){this.parent.on("updateModel",this.updateModel,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("updateModel",this.updateModel)},e.prototype.destroy=function(){this.removeEventListener()},e.prototype.sortColumn=function(e,t,i){this.parent.treeGrid.sortByColumn(e,t,i)},e.prototype.clearSorting=function(){this.parent.treeGrid.clearSorting()},e.prototype.updateModel=function(){this.parent.sortSettings=this.parent.treeGrid.sortSettings},e.prototype.removeSortColumn=function(e){this.parent.treeGrid.grid.removeSortColumn(e)},e}(),ui=function(){function e(e){this.isSelectionFromChart=!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=r.getActualProperties(this.parent.selectionSettings),this.wireEvents()}return e.prototype.getModuleName=function(){return"selection"},e.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)},e.prototype.selectRowByIndex=function(){-1===this.parent.selectedRowIndex&&-1===this.parent.staticSelectedRowIndex||!this.parent.isLoad||(this.selectRow(-1!==this.parent.staticSelectedRowIndex?this.parent.staticSelectedRowIndex:this.parent.selectedRowIndex),this.parent.staticSelectedRowIndex=-1)},e.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)},e.prototype.rowSelecting=function(e){this.parent.isGanttChartRendered?(e.isCtrlPressed=this.isMultiCtrlRequest,e.isShiftPressed=this.isMultiShiftRequest,e.target=this.actualTarget,t.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.parent.trigger("rowSelecting",e)):e.cancel=!0},e.prototype.rowSelected=function(e){var i="Multiple"!==this.parent.selectionSettings.type||t.isNullOrUndefined(e.rowIndexes)?[e.rowIndex]:e.rowIndexes;this.addRemoveClass(i),this.selectedRowIndexes=t.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:this.parent.treeGrid.grid.selectedRowIndex},!0),this.isMultiShiftRequest&&(this.selectedRowIndexes=i),this.parent.autoFocusTasks&&this.parent.ganttChartModule.updateScrollLeft(t.getValue("data.ganttProperties.left",e)),e.target=this.actualTarget,t.isNullOrUndefined(e.foreignKeyData)||0!==Object.keys(e.foreignKeyData).length||delete e.foreignKeyData,this.prevRowIndex=e.rowIndex,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(e),this.parent.trigger("rowSelected",e)},e.prototype.rowDeselecting=function(e){e.target=this.actualTarget,e.isInteracted=this.isInteracted,this.parent.trigger("rowDeselecting",e)},e.prototype.rowDeselected=function(e){var i,r;if(0!==this.multipleIndexes.length)i=this.multipleIndexes;else if(t.isNullOrUndefined(e.rowIndexes))i=[e.rowIndex];else{for(var a=0;a<e.rowIndexes.length;a++)e.rowIndexes[a]===e.rowIndex&&(r=!0);i=r?e.rowIndexes:[e.rowIndex]}this.addRemoveClass(i),this.selectedRowIndexes=t.extend([],this.getSelectedRowIndexes(),[],!0),this.parent.setProperties({selectedRowIndex:-1},!0),1===this.selectedRowIndexes.length&&this.parent.setProperties({selectedRowIndex:this.selectedRowIndexes[0]},!0),t.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=[]},e.prototype.cellSelecting=function(e){var t=new a.Deferred;return this.parent.trigger("cellSelecting",e,function(e){t.resolve(e)}),t},e.prototype.cellSelected=function(e){this.parent.trigger("cellSelected",e),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.cellDeselecting=function(e){this.parent.trigger("cellDeselecting",e)},e.prototype.cellDeselected=function(e){this.parent.trigger("cellDeselected",e),t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems()},e.prototype.selectCell=function(e,t){this.parent.treeGrid.selectCell(e,t)},e.prototype.selectCells=function(e){this.parent.treeGrid.grid.selectCells(e)},e.prototype.selectRow=function(e,i,r){var a,n=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children).filter(function(t){return parseInt(t.getAttribute("aria-rowindex"),0)===e})[0];-1===e||t.isNullOrUndefined(n)||"Cell"===this.parent.selectionSettings.mode||(this.parent.showActiveElement&&!r?this.parent.treeGrid.grid.selectionModule.preventFocus=!0:this.parent.treeGrid.grid.selectionModule.preventFocus=!1,t.isNullOrUndefined(this.selectedClass)||this.selectedClass!==n||i||(a=!0),!0!==a&&this.parent.treeGrid.selectRow(e,i),this.parent.treeGrid.grid.selectionModule.preventFocus=!0!==this.parent.treeGrid.grid.selectionModule.preventFocus&&this.parent.treeGrid.grid.selectionModule.preventFocus,this.prevRowIndex=e,this.selectedClass=n)},e.prototype.selectRows=function(e){!t.isNullOrUndefined(e)&&e.length>0&&this.parent.treeGrid.selectRows(e)},e.prototype.getSelectedRowIndexes=function(){return this.parent.treeGrid.getSelectedRowIndexes()},e.prototype.getSelectedRowCellIndexes=function(){return this.parent.treeGrid.getSelectedRowCellIndexes()},e.prototype.getSelectedRecords=function(){return this.parent.treeGrid.getSelectedRecords()},e.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},e.prototype.getSelectedRows=function(){return this.parent.treeGrid.getSelectedRows()},e.prototype.clearSelection=function(){this.addRemoveClass(this.selectedRowIndexes),this.parent.treeGrid.clearSelection(),this.parent.selectedRowIndex=-1,this.selectedRowIndexes=[],this.selectedClass=null,t.isNullOrUndefined(this.parent.toolbarModule)||this.parent.toolbarModule.refreshToolbarItems(),this.isInteracted=!1},e.prototype.highlightSelectedRows=function(e,i){if(this.isMultiCtrlRequest=e.ctrlKey||this.enableSelectMultiTouch,this.isMultiShiftRequest=e.shiftKey,this.actualTarget=e.target,this.isInteracted=!0,this.isSelectionFromChart=i,i){var r=t.closest(e.target,"tr.e-chart-row"),a=parseInt(r.getAttribute("aria-rowindex"),10),n=this.parent.selectionSettings.enableToggle;if("Single"===this.parent.selectionSettings.type||!this.isMultiCtrlRequest&&!this.isMultiShiftRequest)(!this.parent.allowTaskbarDragAndDrop||this.parent.allowTaskbarDragAndDrop&&this.parent.rowDragAndDropModule&&!this.parent.rowDragAndDropModule.draggedRecord)&&this.selectRow(a,n);else if(this.isMultiShiftRequest)this.selectRowsByRange(t.isNullOrUndefined(this.prevRowIndex)?a:this.prevRowIndex,a);else{t.setValue("isMultiCtrlRequest",!0,this.parent.treeGrid.grid.selectionModule),this.parent.treeGrid.grid.selectionModule.addRowsToSelection([a]);this.selectedRowIndexes.indexOf(a)>-1&&this.addRemoveClass([a])}}},e.prototype.getselectedrowsIndex=function(e,t){for(var i=[],r=e<t?{i:e,max:t}:{i:t,max:e},a=r.i,n=r.max;a<=n;a++)i.push(a);e>t&&i.reverse(),this.selectedRowIndexes=i},e.prototype.selectRowsByRange=function(e,t){this.isSelectionFromChart=!0,this.getselectedrowsIndex(e,t),this.selectRows(this.selectedRowIndexes)},e.prototype.addRemoveClass=function(e){"number"==typeof e&&(e=[e]);for(var i=[].slice.call(this.parent.ganttChartModule.chartBodyContent.querySelector("tbody").children),r=function(r){var n=i.filter(function(t){return parseInt(t.getAttribute("aria-rowindex"),0)===e[r]})[0];t.isNullOrUndefined(n)||(a.getSelectedRowIndexes().indexOf(e[r])>-1?a.addClass(n):a.removeClass(n))},a=this,n=0;n<e.length;n++)r(n)},e.prototype.addClass=function(e){t.addClass([e],"e-active"),e.setAttribute("aria-selected","true")},e.prototype.removeClass=function(e){t.removeClass([e],"e-active"),e.removeAttribute("aria-selected")},e.prototype.showPopup=function(e){this.isSelectionFromChart?(r.setCssInGridPopUp(this.parent.element.querySelector(".e-ganttpopup"),e,"e-rowselect e-icons e-icon-rowselect"+(this.enableSelectMultiTouch&&(this.getSelectedRecords().length>1||this.getSelectedRowCellIndexes().length>1)?" e-spanclicked":"")),document.getElementsByClassName("e-gridpopup")[0].style.display="none",this.openPopup=!0):0===this.selectedRowIndexes.length&&this.hidePopUp()},e.prototype.hidePopUp=function(){this.openPopup?(document.getElementsByClassName("e-ganttpopup")[0].style.display="none",this.openPopup=!1):document.getElementsByClassName("e-gridpopup")[0].style.display="none"},e.prototype.popUpClickHandler=function(e){var i=e.target,r=this.parent.treeGrid.grid,a=t.closest(i,".e-ganttpopup")?t.closest(i,".e-ganttpopup"):t.closest(i,".e-gridpopup");if(a){var n=a.querySelector(".e-rowselect");t.closest(i,".e-ganttpopup")&&!n.classList.contains("e-spanclicked")?(this.enableSelectMultiTouch=!0,n.classList.add("e-spanclicked")):t.closest(i,".e-gridpopup")&&n.classList.contains("e-spanclicked")?(this.openPopup=!0,this.enableSelectMultiTouch=!0):(this.hidePopUp(),this.enableSelectMultiTouch=!1,t.closest(i,".e-ganttpopup")&&n.classList.remove("e-spanclicked"))}else if("Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive){t.closest(i,".e-rowcell")&&0===this.selectedRowIndexes.length&&this.hidePopUp()}r&&t.setValue("enableSelectMultiTouch",this.enableSelectMultiTouch,r.selectionModule)},e.prototype.mouseUpHandler=function(e){var i=!1,a=document.querySelectorAll(".e-drag-item"),n=null;if(e.target.closest(".e-rowcell")?n=e.target:e.target.closest(".e-chart-row")&&(n=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(n),this.parent.editModule&&this.parent.editSettings.allowTaskbarEditing&&this.parent.editModule.taskbarEditModule){var s=this.parent.editModule.taskbarEditModule;(s.isMouseDragged||s.tapPointOnFocus)&&(i=!0)}if(!i&&this.parent.element.contains(e.target)&&1!==a.length){var o=r.parentsUntil(e.target,"e-chart-row"),l=e.target.classList.contains("e-rowcell")||e.target.classList.contains("e-row")||e.target.classList.contains("e-treegridexpand")||e.target.classList.contains("e-treegridcollapse")||!t.isNullOrUndefined(o);this.popUpClickHandler(e),"Cell"!==this.parent.selectionSettings.mode&&l?(t.closest(e.target,"tr.e-chart-row")?(this.parent.enableVirtualization&&(this.parent.treeGrid.grid.selectionModule.isInteracted=!0),this.highlightSelectedRows(e,!0)):this.highlightSelectedRows(e,!1),"Multiple"===this.parent.selectionSettings.type&&this.parent.isAdaptive&&(this.selectedRowIndexes.length>0?this.showPopup(e):this.hidePopUp())):this.isSelectionFromChart=!1}},e.prototype.maintainSelectedRecords=function(e){this.parent.selectionModule.getSelectedRowIndexes().indexOf(e)>-1&&this.addRemoveClass([e])},e.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))},e}(),gi=function(){function e(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)}return e.prototype.getModuleName=function(){return"toolbar"},e.prototype.renderToolbar=function(){if((this.parent.toolbar||[]).length>0){this.element=t.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,i=["Add","Edit","Update","Delete","Cancel","ExpandAll","CollapseAll","PrevTimeSpan","NextTimeSpan","ZoomIn","ZoomOut","ZoomToFit","ExcelExport","CsvExport","PdfExport","Indent","Outdent","CriticalPath"];e<i.length;e++){var r=i[e],a=void 0,n=void 0;"CriticalPath"===r?(a="critical-path",n="criticalPath"):(a=r.toLowerCase(),n=r[0].toLowerCase()+r.slice(1)),this.predefinedItems[r]={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"===r&&(this.predefinedItems[r].prefixIcon="e-nexttimespan"),"NextTimeSpan"===r&&(this.predefinedItems[r].prefixIcon="e-prevtimespan"))}var s=this.parent.localeObj.getConstant("search");this.parent.isAdaptive?this.predefinedItems.Search={id:this.id+"_searchbutton",prefixIcon:"e-search-icon",tooltipText:s,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= "'+s+'"/><span id="'+this.id+'_searchbutton" class="e-input-group-icon e-search-icon e-icons"tabindex="-1" title="'+s+'" aria-label= "search"></span></div>',tooltipText:s,align:"Right",cssClass:"e-search-wrapper"},this.createToolbar()}},e.prototype.addReactToolbarPortals=function(e){this.parent.isReact&&e&&(this.parent.portals=this.parent.portals.concat(e),this.parent.renderTemplates())},e.prototype.createToolbar=function(){var e=this.getItems();this.toolbar=new l.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);var i=this.element.querySelector("#"+this.parent.element.id+"_cancel"),r=this.element.querySelector("#"+this.parent.element.id+"_update");if(i&&t.addClass([i],"e-grid"),r&&t.addClass([r],"e-grid"),this.parent.isAdaptive){this.element.insertBefore(this.getSearchBarElement(),this.element.childNodes[0]),this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar");new h.TextBox({placeholder:this.parent.localeObj.getConstant("search"),enableRtl:this.parent.enableRtl,floatLabelType:"Never",showClearButton:!0}).appendTo(this.searchElement)}else this.searchElement=this.element.querySelector("#"+this.parent.element.id+"_searchbar");this.parent.filterModule&&(this.wireEvent(),this.parent.searchSettings&&this.updateSearchTextBox()),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)},e.prototype.getSearchBarElement=function(){var e=this,i=t.createElement("div",{className:"e-adaptive-searchbar",styles:"display: none"}),r=t.createElement("input",{attrs:{type:"text"},id:this.parent.element.id+"_searchbar"}),a=t.createElement("span",{className:"e-backarrowspan e-icons"});return a.onclick=function(){i.style.display="none",e.element.childNodes[1].style.display="block"},i.appendChild(a),i.appendChild(r),i},e.prototype.wireEvent=function(){this.searchElement&&(t.EventHandler.add(this.searchElement,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.searchElement,"focus",this.focusHandler,this),t.EventHandler.add(this.searchElement,"blur",this.blurHandler,this))},e.prototype.propertyChanged=function(e){t.getValue("module",e)===this.getModuleName()&&this.parent.toolbar&&(this.element&&this.element.parentNode&&t.remove(this.element),this.renderToolbar(),this.refreshToolbarItems())},e.prototype.unWireEvent=function(){this.searchElement&&(t.EventHandler.remove(this.searchElement,"keyup",this.keyUpHandler),t.EventHandler.remove(this.searchElement,"focus",this.focusHandler),t.EventHandler.remove(this.searchElement,"blur",this.blurHandler),this.searchElement=null),this.parent.off("ui-toolbarupdate",this.propertyChanged)},e.prototype.keyUpHandler=function(e){13===e.keyCode&&this.parent.searchSettings.key!==this.searchElement.value&&(this.parent.searchSettings.key=this.searchElement.value,this.parent.dataBind())},e.prototype.focusHandler=function(e){e.target.parentElement.classList.add("e-input-focus")},e.prototype.blurHandler=function(e){e.target.parentElement.classList.remove("e-input-focus")},e.prototype.updateSearchTextBox=function(){this.searchElement&&this.searchElement.value!==this.parent.searchSettings.key&&(this.searchElement.value=this.parent.searchSettings.key)},e.prototype.getItems=function(){var e=[],t=this.parent.toolbar,i=-1;if(t.forEach(function(e,t){("string"==typeof e&&"Search"===e||"object"==typeof e&&"Search"===e.text)&&(i=t)}),i>-1){var r=t.splice(i,1);t.push(r[0])}for(var a=0,n=t;a<n.length;a++){var s=n[a];"string"==typeof s?e.push(this.getItemObject(s)):e.push(this.getItem(s))}return e},e.prototype.getItem=function(e){var i=this.predefinedItems[e.text];return i?t.extend(i,i,e):e},e.prototype.getItemObject=function(e){return this.predefinedItems[e]||{text:e,id:this.id+"_"+e}},e.prototype.toolbarClickHandler=function(e){var i=this,r=this.parent,a=this.id;this.parent.isToolBarClick=!1,t.extend(e,{cancel:!1}),e.item.properties.id!==this.parent.element.id+"_pdfexport"&&e.item.properties.id!==this.parent.element.id+"_critical-path"||(t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow()),r.trigger("toolbarClick",e,function(e){if(!e.cancel)switch(!0===i.parent.isAdaptive&&(e.item.id!==a+"_edit"&&e.item.id!==a+"_add"&&e.item.id!==a+"_delete"&&e.item.id!==a+"_searchbutton"&&e.item.id!==a+"_expandall"&&e.item.id!==a+"_collapseall"||i.parent.selectionModule&&"Multiple"===i.parent.selectionSettings.type&&(i.parent.selectionModule.hidePopUp(),document.getElementsByClassName("e-gridpopup")[0].style.display="none")),!t.isNullOrUndefined(e.item)&&e.item.id){case a+"_edit":r.editModule&&r.editSettings.allowEditing&&r.editModule.dialogModule.openToolbarEditDialog();break;case a+"_indent":r.editModule&&r.selectionModule.getSelectedRecords().length&&r.indent();break;case a+"_critical-path":r.enableCriticalPath?r.enableCriticalPath=!1:r.enableCriticalPath=!0;break;case a+"_outdent":r.editModule&&r.selectionModule.getSelectedRecords().length&&r.outdent();break;case a+"_update":r.editModule.cellEditModule.isCellEdit=!1,r.treeGrid.grid.saveCell();break;case a+"_cancel":r.cancelEdit();break;case a+"_add":r.editModule&&r.editSettings.allowAdding&&r.editModule.dialogModule.openAddDialog();break;case a+"_delete":i.parent.selectionModule&&i.parent.editModule&&("Cell"!==i.parent.selectionSettings.mode&&i.parent.selectionModule.selectedRowIndexes.length||"Cell"===i.parent.selectionSettings.mode&&i.parent.selectionModule.getSelectedRowCellIndexes().length)&&i.parent.editModule.startDeleteAction();break;case a+"_search":if(t.getValue("originalEvent.target.id",e)===i.parent.element.id+"_searchbutton"&&i.parent.filterModule){var n=i.element.querySelector("#"+i.parent.element.id+"_searchbar").value;i.parent.searchSettings.key!==n&&(i.parent.searchSettings.key=n,i.parent.dataBind())}break;case a+"_searchbutton":var s=i.element.querySelector(".e-adaptive-searchbar");s.parentElement.childNodes[1].style.display="none",s.style.display="block";break;case a+"_expandall":i.parent.ganttChartModule.expandCollapseAll("expand");break;case a+"_collapseall":i.parent.ganttChartModule.expandCollapseAll("collapse");break;case a+"_prevtimespan":i.parent.previousTimeSpan();break;case a+"_nexttimespan":i.parent.nextTimeSpan();break;case a+"_zoomin":i.zoomIn();break;case a+"_zoomout":i.zoomOut();break;case a+"_zoomtofit":i.zoomToFit()}})},e.prototype.zoomIn=function(){this.parent.timelineModule.processZooming(!0)},e.prototype.zoomToFit=function(){this.parent.timelineModule.isZoomIn&&(this.parent.timelineModule.isZoomIn=!1),this.parent.timelineModule.processZoomToFit(),this.parent.ganttChartModule.updateScrollLeft(0)},e.prototype.zoomOut=function(){this.parent.timelineModule.processZooming(!1)},e.prototype.refreshToolbarItems=function(e){var i,r=this.parent,a=[],n=[],s=r.editSettings,o=this.id,l=r.selectedRowIndex,d=!!r.selectionModule&&(1===r.selectionModule.selectedRowIndexes.length||1===r.selectionModule.getSelectedRowCellIndexes().length),h=this.toolbar?this.toolbar.items:[],p=[o+"_add",o+"_edit",o+"_delete",o+"_update",o+"_cancel",o+"_indent",o+"_outdent"],c="ResourceView"===this.parent.viewType&&0!==t.getValue("data.level",e)||"ProjectView"===this.parent.viewType;if(t.isNullOrUndefined(this.parent.editModule))n.push(o+"_delete"),n.push(o+"_add"),n.push(o+"_edit"),n.push(o+"_update"),n.push(o+"_cancel"),n.push(o+"_indent"),n.push(o+"_outdent");else{var u=!!r.editModule.taskbarEditModule&&r.editModule.taskbarEditModule.touchEdit,g=r.flatData&&r.flatData.length;s.allowAdding&&!u?a.push(o+"_add"):n.push(o+"_add"),s.allowEditing&&c&&g&&d&&!u?a.push(o+"_edit"):n.push(o+"_edit"),s.allowEditing&&0!==l&&-1!==l&&g&&d&&"ResourceView"!==this.parent.viewType?0===r.updatedRecords[l].level&&g&&!u?(a.push(o+"_indent"),n.push(o+"_outdent")):(i=r.updatedRecords[l-1],r.updatedRecords[l].level-i.level==1&&-1!==l?(n.push(o+"_indent"),a.push(o+"_outdent")):-1!==l&&(a.push(o+"_indent"),a.push(o+"_outdent"))):(n.push(o+"_indent"),n.push(o+"_outdent"));var f=!!r.selectionModule&&(r.selectionModule.selectedRowIndexes.length>0||r.selectionModule.getSelectedRowCellIndexes().length>0);if(s.allowDeleting&&g&&f&&!u?a.push(o+"_delete"):n.push(o+"_delete"),"Auto"===r.editSettings.mode&&!t.isNullOrUndefined(r.editModule.cellEditModule)&&r.editModule.cellEditModule.isCellEdit){(a=[]).push(o+"_update",o+"_cancel"),n=[];for(var m=0;m<h.length;m++)h[m].id!==o+"_update"&&h[m].id!==o+"_cancel"&&-1!==p.indexOf(h[m].id)&&n.push(h[m].id)}else{n.push(o+"_update",o+"_cancel");for(m=0;m<h.length;m++)-1===a.indexOf(h[m].id)&&-1===n.indexOf(h[m].id)&&a.push(h[m].id)}}for(var y=0;y<a.length;y++){var D=void 0;for(m=0;m<h.length;m++)if(h[m].id===a[y]){D=m;break}h.length>0&&this.toolbar.hideItem(D,!1)}for(var v=0;v<n.length;v++){for(D=void 0,m=0;m<h.length;m++)if(h[m].id===n[v]){D=m;break}h.length>0&&this.toolbar.hideItem(D,!0)}},e.prototype.enableItems=function(e,t){for(var i=0,r=e;i<r.length;i++){var a=r[i],n=this.element.querySelector("#"+a);n&&this.toolbar.enableItems(n.parentElement,t)}},e.prototype.destroy=function(){this.parent.isDestroyed||(this.toolbar.off("render-react-toolbar-template",this.addReactToolbarPortals),this.toolbar.destroy(),this.parent.filterModule&&this.unWireEvent(),t.remove(this.element))},e}(),fi=function(){function e(e){this.weekendWidthUpdated=!1,this.parent=e,this.nonworkingContainer=null,this.holidayContainer=null,this.weekendContainer=null}return e.prototype.createNonworkingContainer=function(){this.parent.ganttChartModule.chartBodyContent.contains(this.nonworkingContainer)||(this.nonworkingContainer=t.createElement("div",{className:"e-nonworking-day-container"}),this.parent.ganttChartModule.chartBodyContent.insertBefore(this.nonworkingContainer,this.parent.ganttChartModule.chartBodyContent.lastChild))},e.prototype.renderHolidays=function(){this.parent.holidays&&this.parent.holidays.length>0?(this.createNonworkingContainer(),this.nonworkingContainer.contains(this.holidayContainer)||(this.holidayContainer=t.createElement("div",{className:"e-holiday-container"}),this.nonworkingContainer.appendChild(this.holidayContainer)),this.holidayContainer.innerHTML=this.getHolidaysElement().innerHTML):this.holidayContainer&&this.holidayContainer.parentNode&&(t.remove(this.holidayContainer),this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&t.remove(this.nonworkingContainer))},e.prototype.getHolidaysElement=function(){var e,i,r=t.createElement("div"),a=this.parent.contentHeight,n=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(n=this.parent.toolbarModule.element.offsetHeight);for(var s=this.parent.ganttHeight-n-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight,o=0;o<this.parent.holidays.length;o++){this.parent.holidays[o].from&&this.parent.holidays[o].to?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from),(i=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].to)).setDate(i.getDate()+1),e.setHours(0,0,0,0),i.setHours(0,0,0,0)):this.parent.holidays[o].from?(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].from)).setHours(0,0,0,0):this.parent.holidays[o].to&&(e=this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[o].to)).setHours(0,0,0,0);var l=this.parent.holidays[o].from&&this.parent.holidays[o].to?this.parent.dataOperation.getTaskWidth(e,i):this.parent.perDayWidth,d=this.parent.dataOperation.getTaskLeft(e,!1),h=this.parent.enableRtl?"right:"+d+"px;":"left:"+d+"px;",p=t.createElement("div",{className:"e-holiday",styles:h+" width:"+l+"px; height:100%;"}),c=s<a?s/2:a/2,u=t.createElement("span",{className:"e-span",styles:"top:"+c+"px;left:"+l/2+"px;"}),g=this.parent.disableHtmlEncode?"textContent":"innerHTML";u[g]=this.parent.holidays[o].label?this.parent.holidays[o].label:"",this.parent.enableHtmlSanitizer&&"string"==typeof u[g]&&(u[g]=t.SanitizeHtmlHelper.sanitize(u[g])),p.appendChild(u),this.parent.holidays[o].cssClass&&p.classList.add(this.parent.holidays[o].cssClass),r.appendChild(p)}return r},e.prototype.renderWeekends=function(){this.parent.highlightWeekends?(this.createNonworkingContainer(),this.nonworkingContainer.contains(this.weekendContainer)||(this.weekendContainer=t.createElement("div",{className:"e-weekend-container"}),this.nonworkingContainer.appendChild(this.weekendContainer)),this.weekendContainer.innerHTML=this.getWeekendElements().innerHTML):this.weekendContainer&&(t.remove(this.weekendContainer),this.nonworkingContainer&&0===this.nonworkingContainer.childNodes.length&&t.remove(this.nonworkingContainer))},e.prototype.getWeekendElements=function(){var e=t.createElement("div"),i=new Date(this.parent.timelineModule.timelineStartDate.getTime()),r=new Date(this.parent.timelineModule.timelineEndDate.getTime()),a=this.parent.nonWorkingDayIndex,n=!0;do{if(-1!==a.indexOf(i.getDay())){var s=this.parent.dataOperation.getTaskLeft(i,!1),o=this.parent.perDayWidth;if(n){var l=new Date(i.getTime()),d=new Date(l.getTime());d.setDate(d.getDate()+1),d.setHours(0,0,0,0),o=this.parent.dataOperation.getTaskWidth(l,d),n=!1}var h=new Date(i);h.setDate(h.getDate()+1),h.getTimezoneOffset()==this.parent.timelineModule.timelineStartDate.getTimezoneOffset()||this.weekendWidthUpdated||"Hour"==this.parent.timelineModule.bottomTier&&1===this.parent.timelineSettings.bottomTier.count&&(o-=this.parent.timelineSettings.timelineUnitSize,this.weekendWidthUpdated=!0);var p=this.parent.enableRtl?"right:"+s+"px;":"left:"+s+"px;",c=t.createElement("div",{className:"e-weekend",styles:p+" width:"+o+"px;height:100%;"});e.appendChild(c)}i.setDate(i.getDate()+1),i.setHours(0,0,0,0)}while(i<r);return e},e.prototype.updateHolidayLabelHeight=function(){var e=this.parent.getContentHeight(),i=document.getElementById("ganttContainer"),r=0;t.isNullOrUndefined(this.parent.toolbarModule)||t.isNullOrUndefined(this.parent.toolbarModule.element)||(r=this.parent.toolbarModule.element.offsetHeight);for(var a="auto"===this.parent.height?i.offsetHeight-r-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight:this.parent.ganttHeight-r-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight,n=a<e?a/2:e/2,s=this.holidayContainer.querySelectorAll(".e-span"),o=0;o<s.length;o++)s[o].style.top=t.formatUnit(n)},e.prototype.updateContainerHeight=function(){var e=this.parent.getContentHeight();this.holidayContainer&&(this.holidayContainer.style.height=t.formatUnit(e),this.updateHolidayLabelHeight()),this.weekendContainer&&(this.weekendContainer.style.height=t.formatUnit(e))},e.prototype.removeContainers=function(){this.holidayContainer&&t.remove(this.holidayContainer),this.weekendContainer&&t.remove(this.weekendContainer),this.nonworkingContainer&&t.remove(this.nonworkingContainer)},e}(),mi=function(){function e(e){this.parent=e,this.eventMarkersContainer=null}return e.prototype.renderEventMarkers=function(){this.parent.eventMarkers&&this.parent.eventMarkers.length>0?(this.parent.ganttChartModule.chartBodyContent.contains(this.eventMarkersContainer)||(this.eventMarkersContainer=t.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()},e.prototype.removeContainer=function(){this.eventMarkersContainer&&(t.remove(this.eventMarkersContainer),this.eventMarkersContainer=null)},e.prototype.getEventMarkersElements=function(e){for(var i,r,a,n,s=0;s<this.parent.eventMarkers.length;s++){i=this.parent.dataOperation.getTaskLeft(this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[s].day,!0),!1);var o=void 0;if(o=this.parent.enableRtl?"right:"+i+"px;":"left:"+i+"px;",r=t.createElement("div",{className:"e-event-markers",styles:o+" height:100%;",id:"stripline"+s}),this.parent.eventMarkers[s].label){a=t.createElement("div",{className:"e-span-label"});var l=this.parent.disableHtmlEncode?"textContent":"innerHTML";a[l]=this.parent.eventMarkers[s].label,this.parent.enableHtmlSanitizer&&"string"==typeof a[l]&&(a[l]=t.SanitizeHtmlHelper.sanitize(a[l])),this.parent.enableRtl?a.style.right="5px":a.style.left="5px",r.appendChild(a),n=t.createElement("div",{className:"e-gantt-right-arrow"}),r.appendChild(n)}this.parent.eventMarkers[s].cssClass&&r.classList.add(this.parent.eventMarkers[s].cssClass),r.setAttribute("tabindex","-1"),t.isNullOrUndefined(this.parent.eventMarkers[s].day)||r.setAttribute("aria-label",this.parent.localeObj.getConstant("eventMarkers")+" "+("string"==typeof this.parent.eventMarkers[s].day?this.parent.eventMarkers[s].day:this.parent.getFormatedDate(this.parent.eventMarkers[s].day))+" "+this.parent.eventMarkers[s].label),e.appendChild(r)}},e.prototype.updateContainerHeight=function(){this.eventMarkersContainer&&(this.eventMarkersContainer.style.height=t.formatUnit(this.parent.getContentHeight()))},e}(),yi=function(){function e(e){this.parent=e,this.nonworkingDayRender=new fi(this.parent),this.eventMarkerRender=new mi(this.parent),this.wireEvents()}return e.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)},e.prototype.propertyChanged=function(e){for(var i=Object.keys(t.getValue("properties",e)),r=0;r<i.length;r++){switch(i[r]){case"eventMarkers":this.eventMarkerRender.renderEventMarkers(),this.updateHeight();break;case"highlightWeekends":this.nonworkingDayRender.renderWeekends(),this.updateHeight();break;case"holidays":this.nonworkingDayRender.renderHolidays(),this.updateHeight()}}},e.prototype.refreshMarkers=function(){this.nonworkingDayRender.renderWeekends(),this.nonworkingDayRender.renderHolidays(),"Vertical"!==this.parent.gridLines&&"Both"!==this.parent.gridLines||this.parent.renderChartVerticalLines(),this.eventMarkerRender.renderEventMarkers()},e.prototype.updateHeight=function(){this.nonworkingDayRender.updateContainerHeight(),this.eventMarkerRender.updateContainerHeight()},e.prototype.getModuleName=function(){return"dayMarkers"},e.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))},e}(),Di=function(){function e(e){this.resourceCollectionIds=[],this.criticalTasks=[],this.parent=e}return e.prototype.getCriticalTasks=function(){return this.criticalTasks},e.prototype.showCriticalPath=function(e){var t=this.parent.ids,i=this.parent.flatData;if(e&&this.parent.flatData.length>0){this.parent.enableCriticalPath=!0;var r=this.parent.treeGrid.parentData,a=r[0].ganttProperties.endDate,n=0,s=[],o=[],l=[],d=0,h=[],p=[],c=[],u=[],g=[],f=[];r[0].ganttProperties.autoEndDate>r[0].ganttProperties.endDate&&!r[0].ganttProperties.isAutoSchedule&&(a=r[0].ganttProperties.autoEndDate),r[0].ganttProperties.taskId;for(var m=1;m<r.length;m++)r[m].ganttProperties.endDate>=a&&(a=r[m].ganttProperties.endDate,r[m].ganttProperties.taskId),r[m].ganttProperties.isAutoSchedule||r[m].ganttProperties.autoEndDate>=a&&(a=r[m].ganttProperties.autoEndDate,r[m].ganttProperties.taskId);this.maxEndDate=a;for(var y=0;y<i.length;y++)i[y].isCritical=!1,i[y].ganttProperties.isCritical=!1,n=this.parent.dataOperation.getDuration(i[y].ganttProperties.endDate,a,i[y].ganttProperties.durationUnit,i[y].ganttProperties.isAutoSchedule,i[y].ganttProperties.isMilestone),i[y].slack=n+" "+i[y].ganttProperties.durationUnit,i[y].ganttProperties.slack=n+" "+i[y].ganttProperties.durationUnit,i[y].ganttProperties.endDate>=a&&s.push(i[y].ganttProperties.taskId),i[y].ganttProperties.predecessor&&0!==i[y].ganttProperties.predecessor.length&&(o.push(i[y]),l.push(i[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=function(e){if(-1===l.indexOf(s[e])){if("ProjectView"===v.parent.viewType)d=t.indexOf(s[e].toString());else for(var r=v.parent.currentViewData.filter(function(t){return parseInt(t.ganttProperties.taskId)===s[e]}),a=0;a<r.length;a++)!r[a].hasChildRecords&&r[a].ganttProperties.endDate>=v.maxEndDate&&(d=r[a].index);i[d].ganttProperties.progress<100&&(i[d].isCritical=!0,i[d].ganttProperties.isCritical=!0),i[d].slack="0 "+i[d].ganttProperties.durationUnit,h.push(s[e])}else p.push(s[e])},v=this,w=0;w<s.length;w++)D(w);for(var k=o.length,T=[],b=0;b<k;b++){for(var P=-1,S=-1,C=-1,M=-1,R=b,O=o[b].ganttProperties.predecessor,x=o[b].ganttProperties.predecessor.length,I=o[b].ganttProperties.taskId,E=0;E<x;E++)(isNaN(Number(O[E].from))||"string"==typeof I?(isNaN(Number(O[E].from)),O[E].from):parseInt(O[E].from,10))===I&&(-1===P?O[E].offset?(P=O[E].to+":"+O[E].offset+O[E].offsetUnit,C=O[E].type):(P=O[E].to,C=O[E].type):O[E].offset?(P=P+","+O[E].to+":"+O[E].offset+O[E].offsetUnit,C=C+","+O[E].type):(P=P+","+O[E].to,C=C+","+O[E].type)),(isNaN(Number(O[E].to))||"string"==typeof I?(isNaN(Number(O[E].to)),O[E].to):parseInt(O[E].to,10))===I&&(-1===S?O[E].offset?(S=O[E].from+":"+O[E].offset+O[E].offsetUnit,M=O[E].type):(S=O[E].from,M=O[E].type):O[E].offset?(S=S+","+O[E].from+":"+O[E].offset+O[E].offsetUnit,M=M+","+O[E].type):(S=S+","+O[E].from,M=M+","+O[E].type));-1===S&&(S=null,M=null),-1===P&&(P=null,C=null),c.push({from:S,fromPredecessor:M,taskid:I,to:P,toPredecessor:C,currentIndex:R,slack:null,enddate:null}),u.push(I)}for(var N=c.length,F=0,U=void 0,V=0;V<N;V++)if(!c[V].to){U=c[V].taskid,F="ProjectView"===this.parent.viewType?t.indexOf(U.toString()):this.resourceCollectionIds.indexOf(U.toString());var L=i[F].ganttProperties;n=this.parent.dataOperation.getDuration(L.endDate,a,"minute",L.isAutoSchedule,L.isMilestone),c[V].slack=n,c[V].fs=-1,c[V].enddate=L.endDate,T.push({fromdata:c[V].from,todateID:c[V].taskid,fromDataPredecessor:c[V].fromPredecessor})}for(w=0;w<T.length;w++)g.push(T[w]),this.slackCalculation(g,c,u,a,i,t);f=this.finalCriticalPath(c,h,i,t,a),this.criticalPathCollection=f,this.detailPredecessorCollection=c,this.predecessorCollectionTaskIds=u}if(!1===e&&this.parent.flatData.length>0){var B=void 0;this.parent.enableCriticalPath=!1;for(V=0;V<this.criticalPathCollection.length;V++)B=t.indexOf(this.criticalPathCollection[V].toString()),i[B].isCritical=!1;this.criticalPathCollection=[],this.detailPredecessorCollection=[],this.predecessorCollectionTaskIds=[]}},e.prototype.slackCalculation=function(e,i,r,a,n,s){var o=e[0].fromdata.split(","),l=e[0].fromDataPredecessor.split(",");r=(r=r.toString()).split(",");for(var d,h,p,c,u,g,f,m,y=[],D=0;D<o.length;D++){y=o[D].split(":"),d=r.indexOf(y[0].toString()),c=r.indexOf(e[0].todateID.toString()),"ProjectView"===this.parent.viewType?(h=s.indexOf(y[0].toString()),p=s.indexOf(e[0].todateID.toString())):(h=this.resourceCollectionIds.indexOf(y[0].toString()),p=this.resourceCollectionIds.indexOf(e[0].todateID.toString()));var v=n[h].ganttProperties,w=n[p].ganttProperties;y.length>1&&(f=-1!==y[1].indexOf("hour")?60*parseFloat(y[1]):-1!==y[1].indexOf("day")?parseFloat(y[1])*(this.parent.secondsPerDay/3600)*60:parseFloat(y[1])),"FS"===l[D]&&(u=v.endDate>w.startDate?-this.parent.dataOperation.getDuration(w.startDate,v.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.parent.dataOperation.getDuration(v.endDate,w.startDate,"minute",v.isAutoSchedule,v.isMilestone),t.isNullOrUndefined(i[d].slack)?y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u):i[d].slack>u&&0!==i[d].slack&&y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u),y.length>1&&(i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate,v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),"SS"===l[D]&&(v.isAutoSchedule?(u=v.startDate>w.startDate?-this.parent.dataOperation.getDuration(w.endDate,v.startDate,"minute",v.isAutoSchedule,v.isMilestone):this.parent.dataOperation.getDuration(v.startDate,w.startDate,"minute",v.isAutoSchedule,v.isMilestone),t.isNullOrUndefined(i[d].slack)?y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u):i[d].slack>u&&0!==i[d].slack&&y.length<=1&&(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u),y.length>1&&(i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate):v.isAutoSchedule||(u=this.getSlackDuration(v.endDate,a,"minute",n[h]),t.isNullOrUndefined(i[d].slack)?i[d].slack=u:i[d].slack>u&&0!==i[d].slack&&(i[d].slack=u)),v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),"FF"===l[D]&&(1!==i[c].fs&&1!==i[c].ff&&-1!==i[c].fs||(1!==i[c].fs&&1!==i[c].ff||(g=w.endDate,m=i[c].slack),-1===i[c].fs&&(g=i[c].enddate,m=i[c].slack),u=g>v.endDate?-this.getSlackDuration(v.endDate,g,"minute",n[h]):this.getSlackDuration(g,v.endDate,"minute",n[h]),t.isNullOrUndefined(i[d].slack)?y.length<=1&&(i[d].slack=m-u<0?0:m-u):i[d].slack>u&&0!==i[d].slack&&y.length<=1&&(i[d].slack=m-u<0?0:m-u),y.length>1&&(i[d].slack=i[c].slack-u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].ff=1,i[d].enddate=g,i[d].fsslack=m),v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),"SF"===l[D]&&(v.isAutoSchedule?t.isNullOrUndefined(i[d].slack)?(y.length<=1?t.isNullOrUndefined(i[c].to)?(u=this.getSlackDuration(v.endDate,a,"minute",n[h]),i[d].slack=u):t.isNullOrUndefined(i[c].to)||(u=w.endDate>v.startDate?-this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(w.endDate,v.startDate,"minute",n[h]),i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u):y.length>1&&(u=w.endDate>=v.endDate?v.startDate>w.endDate?-this.getSlackDuration(w.endDate,v.startDate,"minute",n[h]):this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(v.endDate,a,"minute",n[h]),i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0)),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate):(y.length<=1?(t.isNullOrUndefined(i[c].to)?u=this.getSlackDuration(v.endDate,a,"minute",n[h]):t.isNullOrUndefined(i[c].to)||(u=w.endDate>v.startDate?-this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(w.endDate,v.startDate,"minute",n[h])),i[d].slack>u&&0!==i[d].slack&&(t.isNullOrUndefined(i[c].to)?i[d].slack=u:t.isNullOrUndefined(i[c].to)||(i[c].slack+u<0?i[d].slack=0:i[d].slack=i[c].slack+u))):y.length>1&&(u=w.endDate>v.endDate?v.startDate>w.endDate?-this.getSlackDuration(w.endDate,v.startDate,"minute",n[h]):this.parent.dataOperation.getDuration(v.startDate,w.endDate,"minute",v.isAutoSchedule,v.isMilestone):this.getSlackDuration(v.endDate,a,"minute",n[h]),i[d].slack>u&&0!==i[d].slack&&(i[d].slack=i[c].slack+u,i[d].slack=i[d].slack-f,i[d].slack<0&&(i[d].slack=0))),i[d].fs=1,i[d].fsslack=i[d].slack,i[d].enddate=v.startDate):v.isAutoSchedule||(u=this.getSlackDuration(v.endDate,a,"minute",n[h]),t.isNullOrUndefined(i[d].slack)?i[d].slack=u:i[d].slack>u&&0!==i[d].slack&&(i[d].slack=u)),v.endDate>=a&&v.endDate<=a&&(i[d].slack=0)),i[d].from&&e.push({fromdata:i[d].from,todateID:i[d].taskid,fromDataPredecessor:i[d].fromPredecessor})}e&&(e.splice(0,1),e.length>0&&this.slackCalculation(e,i,r,a,n,s))},e.prototype.getSlackDuration=function(e,t,i,r){var a=this.parent.dateValidationModule.checkStartDate(new Date(e)),n=this.parent.dateValidationModule.checkEndDate(new Date(t));return this.parent.dataOperation.getTimeDifference(a,n,!0)<=0?0:this.parent.dataOperation.getDuration(a,n,i,r.ganttProperties.isAutoSchedule,!0)},e.prototype.finalCriticalPath=function(e,t,i,r,a){for(var n,s=[],o=e.length-1;o>=0;o--){for(var l=i[n="ProjectView"===this.parent.viewType?r.indexOf(e[o].taskid.toString()):this.resourceCollectionIds.indexOf(e[o].taskid.toString())].ganttProperties.predecessor,d="0 "+i[n].ganttProperties.durationUnit,h=0;h<l.length;h++){var p=void 0;p="ProjectView"===this.parent.viewType?this.parent.ids.indexOf(l[h].to):this.resourceCollectionIds.indexOf(l[h].to);var c=void 0,u=i[n].ganttProperties;"FS"===l[h].type?0===(c=this.parent.dataOperation.getDuration(u.endDate,i[p].ganttProperties.startDate,u.durationUnit,u.isAutoSchedule,u.isMilestone))&&n!==p&&i[n].slack!==d?(i[n].slack=i[p].slack,i[n].ganttProperties.slack=i[p].slack):0!==c&&n!==p&&i[p].isCritical&&(i[n].slack=c+" "+i[n].ganttProperties.durationUnit,i[n].ganttProperties.slack=c+" "+i[n].ganttProperties.durationUnit):c="SF"===l[h].type?this.parent.dataOperation.getDuration(u.startDate,i[p].ganttProperties.endDate,u.durationUnit,u.isAutoSchedule,u.isMilestone):"SS"===l[h].type?this.parent.dataOperation.getDuration(u.startDate,i[p].ganttProperties.startDate,u.durationUnit,u.isAutoSchedule,u.isMilestone):this.parent.dataOperation.getDuration(u.endDate,i[p].ganttProperties.endDate,u.durationUnit,u.isAutoSchedule,u.isMilestone),("number"==typeof i[n][this.parent.taskFields.id]?parseInt(l[h].from,10):l[h].from)===i[n][this.parent.taskFields.id]&&i[p].slack===d&&c<=0&&(i[n].slack=d,i[n].ganttProperties.slack=d)}i[n].slack===d&&i[n].ganttProperties.progress<100&&(i[n].isCritical=!0,i[n].ganttProperties.isCritical=!0,this.criticalTasks.push(i[n]),s.push(e[o].taskid))}if(t.length>0)for(h=0;h<t.length;h++)-1!==(n="ProjectView"===this.parent.viewType?r.indexOf(t[h].toString()):this.resourceCollectionIds.indexOf(t[h].toString()))&&i[n].ganttProperties.progress<100&&(this.criticalTasks.push(i[n]),s=s.concat(t[h]));return s},e.prototype.criticalConnectorLine=function(e,i,r,a){this.parent.ganttChartModule.chartElement;this.parent.removeCriticalPathStyles();for(var n=function(i){var r;if("ProjectView"===s.parent.viewType)r=s.parent.flatData[s.parent.ids.indexOf(e[i].toString())];else for(var a=s.parent.flatData.filter(function(t){return t.ganttProperties.taskId.toString()===e[i].toString()}),n=0;n<a.length;n++)(a[n].ganttProperties.isCritical||a[n].ganttProperties.endDate>=s.maxEndDate)&&(r=a[n]);var o=s.parent.currentViewData.indexOf(r),l=s.parent.getRowByIndex(o),d=void 0,h=s.parent.taskFields;if(r&&r.parentItem){var p=s.parent.currentViewData.filter(function(e){return r.parentItem.uniqueID===e.uniqueID}),c=s.parent.flatData.indexOf(p[0]),u=s.parent.getRowByIndex(c);if(u)for(var g=u.querySelectorAll(".e-taskbar-main-container"),f=0;f<g.length;f++)g[f].getAttribute("rowuniqueid")===r.rowUniqueID&&t.addClass(g[f].querySelectorAll(".e-gantt-child-taskbar-inner-div"),G)}d=s.parent.allowUnscheduledTasks&&!r[h.startDate]&&!r[h.endDate]&&r[h.duration]?"e-gantt-critical-unscheduled-taskbar":z,l&&("ProjectView"===s.parent.viewType||"ResourceView"===s.parent.viewType&&!r.hasChildRecords)&&(l.getElementsByClassName("e-gantt-milestone")[0]&&t.addClass(l.querySelectorAll(".e-gantt-milestone"),_),l.getElementsByClassName("e-gantt-child-taskbar-inner-div").length>0&&t.addClass(l.querySelectorAll(".e-gantt-child-taskbar-inner-div"),G),l.getElementsByClassName("e-gantt-child-progressbar-inner-div").length>0&&t.addClass(l.querySelectorAll(".e-gantt-child-progressbar-inner-div"),d))},s=this,o=0;o<e.length;o++)n(o);if(0!==i.length){var l=0,d=void 0,h=[],p=void 0,c=void 0;for(o=0;o<this.criticalPathCollection.length;o++)if(l=a.indexOf(this.criticalPathCollection[o]),d=i[l],-1!==l&&d.to){h=d.to.split(",");for(var u=0;u<h.length;u++)if(c=h[u].split("+"),h[u].indexOf("-")>=0&&(c=h[u].split("-")),p=c[0].replace(":",""),"number"==typeof e[u]&&(p=parseInt(c[0],10)),-1!==e.indexOf(p)){this.parent.element.querySelectorAll("#ConnectorLineparent"+d.taskid+"child"+p).length>0&&(t.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+d.taskid+"child"+p)[0].querySelectorAll(".e-connector-line"),be),t.addClass(this.parent.element.querySelectorAll("#ConnectorLineparent"+d.taskid+"child"+p)[0].querySelectorAll(".e-connector-line-arrow"),Pe))}}}},e.prototype.getModuleName=function(){return"criticalPath"},e.prototype.destroy=function(){!this.parent.enableCriticalPath&&this.parent.criticalPathModule&&(this.parent.criticalPathModule=void 0)},e}(),vi=function(){function e(e){var i=this;this.segmentIndex=-1,this.headerContextMenuClick=function(e){var r=t.closest(e.event.target,".e-row"),a=t.closest(e.event.target,".e-chart-row");t.isNullOrUndefined(r)&&t.isNullOrUndefined(a)&&(e.type="Header",i.parent.trigger("contextMenuClick",e))},this.headerContextMenuOpen=function(e){var r=t.closest(e.event.target,".e-row"),a=t.closest(e.event.target,".e-chart-row");t.isNullOrUndefined(r)&&t.isNullOrUndefined(a)?(e.type="Header",i.parent.trigger("contextMenuOpen",e)):e.cancel=!0},this.parent=e,this.ganttID=e.element.id,n.TreeGrid.Inject(n.ContextMenu),this.parent.treeGrid.contextMenuClick=this.headerContextMenuClick.bind(this),this.parent.treeGrid.contextMenuOpen=this.headerContextMenuOpen.bind(this),this.addEventListener(),this.resetItems()}return e.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))},e.prototype.reRenderContextMenu=function(e){e.module===this.getModuleName()&&e.enable&&(this.contextMenu&&(this.contextMenu.destroy(),t.remove(this.element)),this.resetItems(),this.render())},e.prototype.render=function(){this.element=this.parent.createElement("ul",{id:this.ganttID+"_contextmenu",className:"e-grid"}),this.parent.element.appendChild(this.element);var e="#"+this.ganttID;this.contextMenu=new l.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},e.prototype.contextMenuItemClick=function(e){this.item=this.getKeyFromId(e.item.id);var i,r,a,n=t.getValue("parentObj",e.item),s=-1;switch(n&&!t.isNullOrUndefined(n.id)&&"DeleteDependency"===this.getKeyFromId(n.id)&&(s=n.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":t.isNullOrUndefined(this.rowData)||(isNaN(Number(this.rowData.ganttProperties.rowUniqueID))?this.parent.openEditDialog(this.rowData.ganttProperties.rowUniqueID):this.parent.openEditDialog(Number(this.rowData.ganttProperties.rowUniqueID)));break;case"Above":case"Below":case"Child":if(t.isNullOrUndefined(this.rowData))0===this.parent.flatData.length&&this.parent.addRecord();else if(i=this.item,r=t.extend({},{},this.rowData.taskData,!0),a=this.parent.taskFields,r[a.startDate]&&this.parent.setRecordValue(a.startDate,this.rowData.ganttProperties.startDate,r,!0),r[a.endDate]&&this.parent.setRecordValue(a.endDate,this.rowData.ganttProperties.endDate,r,!0),t.isNullOrUndefined(a.dependency)||(r[a.dependency]=null),!t.isNullOrUndefined(a.child)&&r[a.child]&&delete r[a.child],!t.isNullOrUndefined(a.parentID)&&r[a.parentID]&&(r[a.parentID]=null),this.rowData){var o=this.parent.updatedRecords.indexOf(this.rowData);this.parent.addRecord(r,i,o)}break;case"Milestone":case"ToMilestone":t.isNullOrUndefined(this.rowData)?0===this.parent.flatData.length&&this.parent.addRecord():this.parent.convertToMilestone(this.rowData.ganttProperties.rowUniqueID);break;case"DeleteTask":this.parent.editModule.deleteRecord(this.rowData);break;case"ToTask":if(!t.isNullOrUndefined(this.rowData)){if(r=t.extend({},{},this.rowData.taskData,!0),a=this.parent.taskFields,t.isNullOrUndefined(a.duration)){r[a.startDate]=new Date(this.rowData.taskData[a.startDate]);var l=new Date(this.rowData.taskData[a.startDate]);l.setDate(l.getDate()+1),r[a.endDate]=l}else{var d=this.rowData.ganttProperties;r[a.duration]="1 "+d.durationUnit}t.isNullOrUndefined(r[a.milestone])||!0===r[a.milestone]&&(r[a.milestone]=!1),this.parent.updateRecordByID(r)}break;case"Cancel":this.parent.cancelEdit();break;case"Save":this.parent.editModule.cellEditModule.isCellEdit=!1,this.parent.treeGrid.grid.saveCell();break;case"Dependency"+s:this.parent.connectorLineEditModule.removePredecessorByIndex(this.rowData,s);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)}e.type="Content",e.rowData=this.rowData,this.parent.trigger("contextMenuClick",e)},e.prototype.splitTaskCall=function(e){var i=this;this.isEdit=!0;var r=this.parent.taskFields,a=this.getClickedDate(e.element);t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)&&"Hour"!==this.parent.timelineSettings.bottomTier.unit&&a.setHours(0,0,0,0);var n={rowData:this.rowData,requestType:"splitTaskbar",splitDate:a,cancel:!1,target:this.targetElement};this.parent.trigger("actionBegin",n,function(e){t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),i.parent.chartRowsModule.splitTask(i.rowData[r.id],a)})},e.prototype.mergeCall=function(e){var i=this;this.isEdit=!0;var r=this.parent.taskFields,a=this.rowData.ganttProperties.segments,n=[{firstSegmentIndex:"Right"===e?this.segmentIndex:a[this.segmentIndex-1].segmentIndex,secondSegmentIndex:"Left"===e?this.segmentIndex:a[this.segmentIndex+1].segmentIndex}],s={rowData:this.rowData,mergeSegmentIndexes:n,requestType:"mergeSegment",cancel:!1,target:this.targetElement};this.parent.trigger("actionBegin",s,function(e){t.isNullOrUndefined(i.parent.loadingIndicator)||"Shimmer"!==i.parent.loadingIndicator.indicatorType?i.parent.showSpinner():i.parent.showMaskRow(),!1===e.cancel&&i.parent.chartRowsModule.mergeTask(i.rowData[r.id],n)})},e.prototype.getClickedDate=function(e){var i;if(this.parent.enableRtl){var r=this.parent.element.getBoundingClientRect(),a=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.clientLeft||document.body.clientLeft||0;i=r.left+a-n}else i=this.parent.getOffsetRect(this.parent.element).left;var s,o;this.parent.enableRtl?(s=Math.abs(i+this.parent.ganttChartModule.chartElement.offsetWidth-this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft),o=Math.abs(this.clickedPosition-s)):(s=i+this.parent.ganttChartModule.chartElement.offsetLeft+this.rowData.ganttProperties.left-this.parent.ganttChartModule.scrollElement.scrollLeft,o=this.clickedPosition-s);var l=Math.ceil(o/this.parent.perDayWidth),d=this.rowData.ganttProperties.startDate;t.isNullOrUndefined(this.parent.timelineSettings.bottomTier)||"Hour"!==this.parent.timelineSettings.bottomTier.unit||(l=Math.ceil(o/this.parent.timelineSettings.timelineUnitSize),l-=1);return this.parent.dataOperation.getEndDate(d,l,"None"!==this.parent.timelineModule.customTimelineSettings.bottomTier.unit?this.parent.timelineModule.customTimelineSettings.bottomTier.unit.toLocaleLowerCase():this.parent.timelineModule.customTimelineSettings.topTier.unit.toLocaleLowerCase(),this.rowData,!1)},e.prototype.contextMenuBeforeOpen=function(e){var i=this,r=e.event?e.event.target:this.parent.focusModule?this.parent.ganttChartModule.targetElement:this.parent.focusModule.getActiveElement();!t.isNullOrUndefined(this.parent.editModule)&&this.parent.editModule.cellEditModule&&this.parent.editModule.cellEditModule.isCellEdit&&r.parentElement.classList.contains("e-row")&&this.parent.treeGrid.closeEdit(),t.isNullOrUndefined(e.element)||e.element.id!==this.parent.element.id+"_contextmenu"||(this.clickedPosition=t.getValue("event",e).clientX);var n=t.closest(r,".e-gantt-child-taskbar");n&&(this.targetElement=e.target=n),e.gridRow=t.closest(r,".e-row"),e.chartRow=t.closest(r,".e-chart-row");var s=t.closest(r,".e-gantt");if(!t.closest(r,".e-gridform")&&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),(t.isNullOrUndefined(e.gridRow)&&t.isNullOrUndefined(e.chartRow)||0===this.contentMenuItems.length)&&((t.isNullOrUndefined(e.parentItem)||t.isNullOrUndefined(s))&&t.isNullOrUndefined(t.closest(r,".e-content"))?e.cancel=!0:e.cancel=!1),!e.cancel){var o=-1;e.gridRow?o=parseInt(e.gridRow.getAttribute("data-rowindex"),0):e.chartRow&&(o=parseInt(e.chartRow.getAttribute("aria-rowindex"),0)),this.parent.selectionModule&&this.parent.allowSelection&&!e.parentItem&&!t.isNullOrUndefined(e.chartRow)&&this.parent.selectionModule.selectRow(o),e.parentItem||(this.rowData=this.parent.updatedRecords[parseInt(o.toString(),10)]);for(var l=0,d=e.items;l<d.length;l++){var h=d[l];h.separator||(!r.classList.contains("e-gantt-unscheduled-taskbar")||h.text!==this.getLocale("splitTask")&&h.text!==this.getLocale("mergeTask")?this.updateItemStatus(h,r,o):this.hideItems.push(h.text))}if(e.rowData=this.rowData,e.type="Content",e.disableItems=this.disableItems,e.hideItems=this.hideItems,e.hideChildItems=[],!t.isNullOrUndefined(e.rowData)&&0===e.rowData.level&&"ResourceView"===this.parent.viewType)return void(e.cancel=!0);var p=new a.Deferred;return this.parent.trigger("contextMenuOpen",e,function(t){p.resolve(t),i.hideItems=t.hideItems,i.disableItems=t.disableItems,t.parentItem||t.hideItems.length!==t.items.length||(i.revertItemStatus(),t.cancel=!0),i.hideItems.length>0&&i.contextMenu.hideItems(i.hideItems),i.disableItems.length>0&&i.contextMenu.enableItems(i.disableItems,!1),e.hideChildItems.length>0&&i.contextMenu.hideItems(e.hideChildItems)}),p}},e.prototype.updateItemStatus=function(e,i,r){var a=this.getKeyFromId(e.id),n=t.closest(i,".e-gridform"),s=[],o=t.closest(i,".e-gantt-child-taskbar");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":!t.isNullOrUndefined(this.rowData)&&this.rowData.hasChildRecords?this.hideItems.push(e.text):this.parent.editSettings.allowEditing&&this.parent.editModule?(t.isNullOrUndefined(this.rowData)||this.rowData.ganttProperties.isMilestone?s.push(this.createItemModel(Ne,"ToTask",this.getLocale("toTask"))):s.push(this.createItemModel(Ne,"ToMilestone",this.getLocale("toMilestone"))),e.items=s):this.updateItemVisibility(e.text),0===this.parent.flatData.length&&this.hideItems.push(e.text);break;case"DeleteDependency":var l=this.getPredecessorsItems();!t.isNullOrUndefined(this.rowData)&&this.rowData.hasChildRecords?this.hideItems.push(e.text):this.parent.editSettings.allowDeleting&&0!==l.length&&this.parent.editModule?l.length>0&&(e.items=l):this.updateItemVisibility(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?s.push(this.createItemModel(Ne,"Manual",this.getLocale("manual"))):s.push(this.createItemModel(Ne,"Auto",this.getLocale("auto"))),e.items=s);break;case"Indent":if(this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings){var d=this.parent.selectedRowIndex,h=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length),p=this.parent.updatedRecords[this.parent.selectionModule.getSelectedRowIndexes()[0]-1];this.parent.editSettings.allowEditing&&0!==d&&-1!==d&&h&&"ResourceView"!==this.parent.viewType&&this.parent.updatedRecords[parseInt(d.toString(),10)].level-p.level!=1||this.updateItemVisibility(e.text)}else this.hideItems.push(e.text);break;case"Outdent":if(this.parent.allowSelection&&this.parent.editModule&&this.parent.editSettings){var c=this.parent.selectionModule.getSelectedRowIndexes()[0],u=!!this.parent.selectionModule&&(1===this.parent.selectionModule.selectedRowIndexes.length||1===this.parent.selectionModule.getSelectedRowCellIndexes().length);this.parent.editSettings.allowEditing&&-1!==c&&0!==c&&u&&"ResourceView"!==this.parent.viewType&&0!==this.parent.updatedRecords[parseInt(c.toString(),10)].level||this.updateItemVisibility(e.text)}else this.hideItems.push(e.text);break;case"SplitTask":var g=this.parent.taskFields;(this.parent.readOnly||!o||t.isNullOrUndefined(g.segments)||this.parent.currentViewData[parseInt(r.toString(),10)].hasChildRecords)&&this.updateItemVisibility(e.text);break;case"MergeTask":this.parent.readOnly||!o?this.updateItemVisibility(e.text):this.mergeItemVisiblity(i,e)}},e.prototype.mergeItemVisiblity=function(e,i){var r=[],a=this.parent.taskFields,n=this.getClickedDate(e);this.segmentIndex=this.parent.chartRowsModule.getSegmentIndex(n,this.rowData);var s=this.rowData.ganttProperties.segments;!t.isNullOrUndefined(s)&&s.length>0?t.isNullOrUndefined(a.segments)&&-1===this.segmentIndex?this.updateItemVisibility(i.text):(0===this.segmentIndex?r.push(this.createItemModel(Ne,"Right",this.getLocale("right"))):this.segmentIndex===s.length-1?r.push(this.createItemModel(Ne,"Left",this.getLocale("left"))):(r.push(this.createItemModel(Ne,"Right",this.getLocale("right"))),r.push(this.createItemModel(Ne,"Left",this.getLocale("left")))),i.items=r):this.hideItems.push(i.text)},e.prototype.updateItemVisibility=function(e){!!t.isNullOrUndefined(this.parent.contextMenuItems)?this.hideItems.push(e):this.disableItems.push(e)},e.prototype.contextMenuOpen=function(e){this.isOpen=!0;var i=e.element.querySelectorAll("li:not(.e-menu-hide):not(.e-disabled)")[0];t.isNullOrUndefined(i)||t.addClass([i],"e-focused")},e.prototype.getMenuItems=function(){for(var e=0,i=t.isNullOrUndefined(this.parent.contextMenuItems)?this.getDefaultItems():this.parent.contextMenuItems;e<i.length;e++){var r=i[e];"string"==typeof r&&-1!==this.getDefaultItems().indexOf(r)?this.buildDefaultItems(r):"string"!=typeof r&&(-1!==this.getDefaultItems().indexOf(r.text)?this.buildDefaultItems(r.text,r.iconCss):".e-gridheader"===r.target?this.headerMenuItems.push(r):this.contentMenuItems.push(r))}return this.contentMenuItems},e.prototype.createItemModel=function(e,t,i,r){return{text:i,id:this.generateID(t),target:e,iconCss:r?"e-icons "+r:null}},e.prototype.getLocale=function(e){return this.parent.localeObj.getConstant(e)},e.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(Ne,e,this.getLocale("taskInformation"),this.getIconCSS("e-edit",t));break;case"Indent":i=this.createItemModel(Ne,e,this.getLocale("indent"),this.getIconCSS("e-indent",t));break;case"Outdent":i=this.createItemModel(Ne,e,this.getLocale("outdent"),this.getIconCSS("e-outdent",t));break;case"Save":i=this.createItemModel("e-edit",e,this.getLocale("save"),this.getIconCSS("e-save",t));break;case"Cancel":i=this.createItemModel("e-edit",e,this.getLocale("cancel"),this.getIconCSS("e-cancel",t));break;case"Add":(i=this.createItemModel(Ne,e,this.getLocale("add"),this.getIconCSS("e-add",t))).items=[],i.items.push(this.createItemModel(Ne,"Above",this.getLocale("above"),this.getIconCSS("e-add-above",t))),i.items.push(this.createItemModel(Ne,"Below",this.getLocale("below"),this.getIconCSS("e-add-below",t))),"ResourceView"!==this.parent.viewType&&i.items.push(this.createItemModel(Ne,"Child",this.getLocale("child"))),i.items.push(this.createItemModel(Ne,"Milestone",this.getLocale("milestone")));break;case"DeleteTask":i=this.createItemModel(Ne,e,this.getLocale("deleteTask"),this.getIconCSS("e-delete",t));break;case"DeleteDependency":(i=this.createItemModel(Ne,e,this.getLocale("deleteDependency"))).items=[],i.items.push({});break;case"Convert":(i=this.createItemModel(Ne,e,this.getLocale("convert"))).items=[],i.items.push({});break;case"TaskMode":(i=this.createItemModel(Ne,e,this.getLocale("changeScheduleMode"))).items=[],i.items.push({});break;case"SplitTask":i=this.createItemModel(Ne,e,this.getLocale("splitTask"));break;case"MergeTask":(i=this.createItemModel(Ne,e,this.getLocale("mergeTask"))).items=[],i.items.push({})}i&&this.contentMenuItems.push(i)},e.prototype.getIconCSS=function(e,i){return t.isNullOrUndefined(i)?e:i},e.prototype.getPredecessorsItems=function(){this.predecessors=this.parent.predecessorModule.getValidPredecessor(this.rowData);for(var e,t=[],i=0,r=0,a=this.predecessors;r<a.length;r++){var n=a[r],s=this.parent.getRecordByID(n.from).ganttProperties,o=s.rowUniqueID+" - "+s.taskName,l="Dependency"+i++;e=this.createItemModel(Ne,l,o),t.push(e)}return t},e.prototype.getDefaultItems=function(){return["AutoFitAll","AutoFit","TaskInformation","DeleteTask","Save","Cancel","SortAscending","SortDescending","Add","DeleteDependency","Convert","TaskMode","Indent","Outdent","SplitTask","MergeTask"]},e.prototype.getModuleName=function(){return"contextMenu"},e.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))},e.prototype.contextMenuOnClose=function(e){e.items.length>0&&e.items[0].parentObj instanceof l.ContextMenu&&this.revertItemStatus()},e.prototype.revertItemStatus=function(){this.contextMenu.showItems(this.hideItems),this.contextMenu.enableItems(this.disableItems),this.hideItems=[],this.disableItems=[],this.isOpen=!1},e.prototype.resetItems=function(){this.hideItems=[],this.disableItems=[],this.headerMenuItems=[],this.contentMenuItems=[],this.item=null},e.prototype.generateID=function(e){return this.ganttID+"_contextMenu_"+e},e.prototype.getKeyFromId=function(e){var t=this.ganttID+"_contextMenu_";return e.indexOf(t)>-1?e.replace(t,""):"Custom"},e.prototype.destroy=function(){this.contextMenu.destroy(),t.remove(this.element),this.removeEventListener(),this.contextMenu=null,this.element=null},e}(),wi=function(){function e(e){this.parent=e,n.TreeGrid.Inject(n.ExcelExport),this.parent.treeGrid.allowExcelExport=this.parent.allowExcelExport,this.bindEvents()}return e.prototype.getModuleName=function(){return"excelExport"},e.prototype.destroy=function(){},e.prototype.bindEvents=function(){var e=this;this.parent.treeGrid.beforeExcelExport=function(i){e.parent.trigger("beforeExcelExport",i),t.isNullOrUndefined(e.parent.loadingIndicator)||"Shimmer"!==e.parent.loadingIndicator.indicatorType?e.parent.showSpinner():e.parent.showMaskRow()},this.parent.treeGrid.excelQueryCellInfo=function(t){e.parent.trigger("excelQueryCellInfo",t)},this.parent.treeGrid.excelHeaderQueryCellInfo=function(t){e.parent.trigger("excelHeaderQueryCellInfo",t)},this.parent.treeGrid.excelExportComplete=function(i){e.parent.trigger("excelExportComplete",i),t.isNullOrUndefined(e.parent.loadingIndicator)||"Shimmer"!==e.parent.loadingIndicator.indicatorType?e.parent.hideSpinner():e.parent.hideMaskRow()}},e}(),ki=function(){function e(e){n.TreeGrid.Inject(n.ColumnMenu),this.parent=e}return e.prototype.getColumnMenu=function(){return this.parent.treeGrid.columnMenuModule.getColumnMenu()},e.prototype.destroy=function(){},e.prototype.getModuleName=function(){return"columnMenu"},e}(),Ti=function(){function e(e){this.isTest=!1,this.updateParentRecords=[],this.isaddtoBottom=!1,this.isSharedTask=!1,this.canDrop=!0,this.parent=e,n.TreeGrid.Inject(n.RowDD),this.parent.treeGrid.allowRowDragAndDrop=this.parent.allowRowDragAndDrop,this.bindEvents()}return e.prototype.getModuleName=function(){return"rowDragAndDrop"},e.prototype.destroy=function(){},e.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)},e.prototype.rowDragStart=function(e){this.parent.trigger("rowDragStart",e),this.parent.element.style.position="relative"},e.prototype.addErrorElem=function(){var e=document.getElementsByClassName("e-ganttdrag")[0];if(!e.querySelectorAll(".e-errorelem").length){var i=document.createElement("div");t.classList(i,["e-errorcontainer"],[]),t.classList(i,["e-icons","e-errorelem"],[]);var r=e.querySelector(".errorValue"),a=e.querySelector(".e-rowcell").innerHTML;r&&(a=r.innerHTML,r.parentNode.removeChild(r)),e.querySelector(".e-rowcell").innerHTML="";var n=document.createElement("span");n.className="errorValue",n.style.paddingLeft="16px",n.innerHTML=a,e.querySelector(".e-rowcell").appendChild(i),e.querySelector(".e-rowcell").appendChild(n)}},e.prototype.removeErrorElem=function(){var e=document.querySelector(".e-errorelem");e&&e.remove()},e.prototype.rowDrag=function(e){var i=this.parent.element.querySelector(".e-cloneproperties");i.style.display="none";var r=i.cloneNode(!0);r.classList.add("e-ganttdrag"),r.style.display="",this.parent.element.querySelectorAll(".e-cloneproperties").length<=1?this.parent.element.appendChild(r):document.getElementsByClassName("e-cloneproperties")[0].querySelectorAll(".e-errorelem").length?this.addErrorElem():this.removeErrorElem(),"Both"===this.parent.gridLines&&t.addClass(this.parent.element.querySelectorAll(".e-ganttdrag .e-rowcell"),["e-bothganttlines"]);var a=this.parent.element.querySelector(".e-ganttdrag"),n=this.parent.element.getClientRects()[0].top,s=this.parent.element.getClientRects()[0].left,o=t.getValue("event",e.originalEvent).clientX-s,l=t.getValue("event",e.originalEvent).clientY-n;a.style.left=o+20+"px",a.style.top=l+20+"px",this.parent.trigger("rowDrag",e)},e.prototype.rowDragStartHelper=function(e){this.parent.trigger("rowDragStartHelper",e),this.parent.readOnly&&(e.cancel=!0),"ResourceView"===this.parent.viewType&&0===t.getValue("level",e.data[0])&&(e.cancel=!0)},e.prototype.rowDrop=function(e){var i=document.querySelector(".e-ganttdrag");i&&i.remove();var r=t.closest(e.target,".e-row"),a=r?parseInt(r.getAttribute("data-rowindex"),10):e.dropIndex;e.dropIndex=a,e.dropRecord=this.parent.updatedRecords[e.dropIndex],this.parent.trigger("rowDrop",e),"ResourceView"===this.parent.viewType&&("middleSegment"===e.dropPosition&&(1!==e.dropRecord.level&&e.dropRecord.uniqueID!==t.getValue("parentItem",e.data[0]).uniqueID||(e.cancel=!0)),"middleSegment"!==e.dropPosition&&(0!==e.dropRecord.level&&t.getValue("parentItem",e.data[0]).uniqueID!==e.dropRecord.parentItem.uniqueID||(e.cancel=!0))),e.cancel||(e.requestType="beforeDrop",this.parent.trigger("actionBegin",e),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),e.cancel||(this.dropRows(e,!0),e.cancel=!0))},e.prototype.dropRows=function(e,i){if(!this.parent.readOnly){if(this.dropPosition=e.dropPosition,"Invalid"!==e.dropPosition&&this.parent.editModule){var r=this.parent,a=void 0;this.droppedRecord=r.updatedRecords[e.dropIndex];var n=[],s=this.droppedRecord;e.data[0]?n=e.data:n.push(e.data);for(var o=0,l=n.length,d=function(e){if(h.parent.isOnEdit=!0,a=n[e],h.draggedRecord=a,"Invalid"!==h.dropPosition){if("ResourceView"===h.parent.viewType&&(h.checkisSharedTask(),h.previousParent=h.draggedRecord.parentItem.uniqueID),h.isSharedTask)return{value:void 0};i&&h.deleteDragRow();var l=h.treeGridData.indexOf(s);if("topSegment"===h.dropPosition&&h.dropAtTop(l),"bottomSegment"===h.dropPosition&&!h.isSharedTask){if(s.hasChildRecords){if(o=h.parent.editModule.getChildCount(s,0),h.parent.taskFields.parentID&&h.ganttData.length>0&&h.ganttData.splice(l+o+1,0,h.draggedRecord.taskData),h.treeGridData.splice(l+o+1,0,h.draggedRecord),h.parent.ids.splice(l+o+1,0,h.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===h.parent.viewType){var d=0===h.draggedRecord.level?"R"+h.draggedRecord.ganttProperties.taskId:"T"+h.draggedRecord.ganttProperties.taskId;h.parent.getTaskIds().splice(l+o+1,0,d)}}else if(h.parent.taskFields.parentID&&h.ganttData.length>0&&h.ganttData.splice(l+1,0,h.draggedRecord.taskData),h.treeGridData.splice(l+1,0,h.draggedRecord),h.parent.ids.splice(l+1,0,h.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===h.parent.viewType){var p=0===h.draggedRecord.level?"R"+h.draggedRecord.ganttProperties.taskId:"T"+h.draggedRecord.ganttProperties.taskId;h.parent.getTaskIds().splice(l+1,0,p)}if(h.parent.setRecordValue("parentItem",h.treeGridData[l].parentItem,a),h.parent.setRecordValue("parentUniqueID",h.treeGridData[l].parentUniqueID,a),h.parent.setRecordValue("level",h.treeGridData[l].level,a),a.hasChildRecords){h.updateChildRecordLevel(a,1),h.updateChildRecord(a,l+o+1)}if(s.parentItem){var c=h.parent.getParentTask(s.parentItem).childRecords,u=c.indexOf(s)+1;c.splice(u,0,a)}}if("middleSegment"===h.dropPosition&&(h.dropMiddle(l),s.childRecords.length>0&&(delete s.ganttProperties.segments,delete s.taskData[h.parent.taskFields.segments])),0!=h.treeGridData.length)for(var g=0;g<h.treeGridData.length;g++)if(h.treeGridData[parseInt(g.toString(),10)].index=g,!t.isNullOrUndefined(h.treeGridData[parseInt(g.toString(),10)].parentItem)){var f=t.getValue("uniqueIDCollection."+h.treeGridData[parseInt(g.toString(),10)].parentUniqueID,h.parent.treeGrid);h.treeGridData[parseInt(g.toString(),10)].parentItem.index=f.index}t.isNullOrUndefined(a.parentItem&&-1!==h.updateParentRecords.indexOf(a.parentItem))||h.updateParentRecords.push(a.parentItem)}if(!h.parent.enableVirtualization){var m=r.flatData,y=void 0,D=void 0,v=h.parent.dataSource,w=h.parent.taskFields.id;if(a.index<s.index){y=a.index;for(var k=function(e){var t=h.parent.currentViewData.filter(function(t){return t[w]===v[e][w]})[0];if(t&&t.index>s.index)return D=t.index,"break"},T=0;T<v.length;T++){if("break"===k(T))break}}else{y=s.index;for(var b=function(e){var t=h.parent.currentViewData.filter(function(t){return t[w]===v[e][w]})[0];if(t&&t.index>a.index)return D=t.index,"break"},P=0;P<v.length;P++){if("break"===b(P))break}}for(var S=function(e){if(!t.isNullOrUndefined(m[e])&&(m[e].index=e,!t.isNullOrUndefined(m[e].parentItem))){var i=m.filter(function(t){return t.uniqueID===m[e].parentUniqueID})[0];m[e].parentItem.index=i.index}},C=y;C<=D;C++)S(C)}r.rowDragAndDropModule.refreshDataSource()},h=this,p=0;p<l;p++){var c=d(p);if("object"==typeof c)return c.value}if("middleSegment"===this.dropPosition&&(s.ganttProperties.predecessor&&(this.parent.editModule.removePredecessorOnDelete(s),s.ganttProperties.predecessor=null,s.ganttProperties.predecessorsName=null,s[this.parent.taskFields.dependency]=null,s.taskData[this.parent.taskFields.dependency]=null),s.ganttProperties.isMilestone&&(this.parent.setRecordValue("isMilestone",!1,s.ganttProperties,!0),t.isNullOrUndefined(s.taskData[this.parent.taskFields.milestone])||!0===s.taskData[this.parent.taskFields.milestone]&&(s.taskData[this.parent.taskFields.milestone]=!1))),"ResourceView"===this.parent.viewType&&!this.isSharedTask){var u=void 0;u="middleSegment"===this.dropPosition?this.droppedRecord.uniqueID:this.droppedRecord.parentItem?this.droppedRecord.parentItem.uniqueID:this.droppedRecord.uniqueID;var g=this.parent.getTaskByUniqueID(u),f={};f[this.parent.taskFields.resourceInfo]=[],f[this.parent.taskFields.resourceInfo].push(g.ganttProperties.taskId),this.removeExistingResources();var m=this.parent.dataOperation.setResourceInfo(f),y=this.draggedRecord;t.isNullOrUndefined(y.ganttProperties.resourceInfo)&&(y.ganttProperties.resourceInfo=[]),"Unassigned Task"===g.ganttProperties.taskName?(y.ganttProperties.resourceInfo=[],y.ganttProperties.sharedTaskUniqueIds=[y.ganttProperties.rowUniqueID]):y.ganttProperties.resourceInfo.push(m[0]),this.updateCurrentTask(y),"Unassigned Task"===g.ganttProperties.taskName?this.deleteSharedResourceTask():this.updateSharedResourceTask()}if(this.parent.taskFields.dependency&&this.parent.allowParentDependency){var D,v=void 0;v=a.parentItem?this.parent.flatData[this.parent.ids.indexOf(a.parentItem.taskId)]:a;var w=void 0;if((D=s.parentItem?this.parent.flatData[this.parent.ids.indexOf(s.parentItem.taskId)]:s).uniqueID===v.uniqueID||v.parentItem&&D.uniqueID===this.parent.flatData[this.parent.ids.indexOf(v.parentItem.taskId)].uniqueID){w=this.parent.currentViewData.filter(function(e){if(e.ganttProperties.predecessor&&e.ganttProperties.predecessor.length>0)for(var t=0;t<e.ganttProperties.predecessor.length;t++)return parseInt(e.ganttProperties.predecessor[t].to)===parseInt(D.ganttProperties.taskId)||parseInt(e.ganttProperties.predecessor[t].from)===parseInt(D.ganttProperties.taskId);return null});var k=[];for(p=0;p<w.length;p++){if(k=[],w[p].ganttProperties.predecessor)for(var T=0;T<w[p].ganttProperties.predecessor.length;T++)parseInt(w[p].ganttProperties.taskId)!==parseInt(w[p].ganttProperties.predecessor[T].from)?k.push(w[p].ganttProperties.predecessor[T].from):k.push(w[p].ganttProperties.predecessor[T].to);for(var b=function(e){var t=k[e].replace(/\D/g,""),i=P.parent.currentViewData.filter(function(e){return parseInt(e.ganttProperties.taskId)==parseInt(t)});P.parent.connectorLineEditModule.validateParentPredecessor(w[p],i[0])||(P.parent.dataOperation.resetDependency(w[p]),P.parent.dataOperation.resetDependency(i[0]))},P=this,S=0;S<k.length;S++)b(S)}}}for(S=0;S<this.updateParentRecords.length;S++)this.parent.dataOperation.updateParentItems(this.updateParentRecords[S]);this.updateParentRecords=[],this.parent.isOnEdit=!1}t.isNullOrUndefined(this.parent.editModule)||this.parent.editModule.refreshRecord(e,!0)}},e.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)},e.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.currentViewData[e].parentItem.uniqueID).ganttProperties.taskName&&this.removeRecords(this.parent.currentViewData[e]),t.isNullOrUndefined(this.parent.currentViewData[e].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.currentViewData[e].parentItem))||this.updateParentRecords.push(this.parent.currentViewData[e].parentItem))},e.prototype.removeExistingResources=function(){var e=this.parent.getTaskByUniqueID(this.previousParent);if(this.draggedRecord.ganttProperties.resourceInfo)for(var t=0;t<this.draggedRecord.ganttProperties.resourceInfo.length;t++)if(this.draggedRecord.ganttProperties.resourceInfo[t][this.parent.resourceFields.id]===e.ganttProperties.taskId){this.draggedRecord.ganttProperties.resourceInfo.splice(t,1);break}},e.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]),t.isNullOrUndefined(this.parent.flatData[e].parentItem&&-1!==this.updateParentRecords.indexOf(this.parent.currentViewData[e].parentItem))||this.updateParentRecords.push(this.parent.flatData[e].parentItem))},e.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},e.prototype.removeResourceInfo=function(e){var i=this.parent.getTaskByUniqueID(this.draggedRecord.parentItem.uniqueID);if(e.ganttProperties.resourceInfo&&e.ganttProperties.resourceInfo.length>1){var r=this._getExistingTaskWithID(e),a=void 0;if(null==r)return;for(var n=0;n<r.length;n++)for(var s=(a=r[n]).ganttProperties.resourceInfo,o=0;o<s.length;o++)if(s[o][this.parent.resourceFields.id]===i.ganttProperties.taskId){s.splice(o,1),this.parent.setRecordValue("resourceInfo",s,a.ganttProperties,!0),this.updateCurrentTask(a),t.isNullOrUndefined(a.parentItem&&-1!==this.updateParentRecords.indexOf(a.parentItem))||this.updateParentRecords.push(a.parentItem);break}}},e.prototype.refreshDataSource=function(){var e,i,r=this.draggedRecord,n=this.droppedRecord,s=this.parent,o=this.parent.taskFields;if((e=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):s.dataSource).length>0&&!t.isNullOrUndefined(n)&&!n.parentItem){for(var l=0;l<Object.keys(e).length;l++)t.isNullOrUndefined(n.taskData[o.child])||e[l][o.child]!==n.taskData[o.child]?t.isNullOrUndefined(n.taskData[o.child])&&n.taskData[o.id]===e[l][o.id]&&(i=l):i=l;"topSegment"===this.dropPosition?this.parent.taskFields.parentID||e.splice(i,0,r.taskData):"bottomSegment"===this.dropPosition&&(this.parent.taskFields.parentID||e.splice(i+1,0,r.taskData))}else if(!this.parent.taskFields.parentID&&!t.isNullOrUndefined(n)&&n.parentItem&&("topSegment"===this.dropPosition||"bottomSegment"===this.dropPosition)){var d="topSegment"===this.dropPosition?"Above":"Below";this.parent.editModule.addRowSelectedItem=n,this.parent.editModule.updateRealDataSource([r],d),delete this.parent.editModule.addRowSelectedItem}if(this.parent.taskFields.parentID)if(r.parentItem){var h="middleSegment"===this.dropPosition?this.parent.taskFields.id:this.parent.taskFields.parentID;r[this.parent.taskFields.parentID]=n[h],r.ganttProperties.parentId=n[h],("ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition||"ProjectView"===this.parent.viewType)&&(r.taskData[this.parent.taskFields.parentID]=n.taskData[h])}else r[this.parent.taskFields.parentID]=null,r.taskData[this.parent.taskFields.parentID]=null,r.ganttProperties.parentId=null},e.prototype.dropMiddle=function(e){var i=this.parent,r=this.parent.editModule.getChildCount(this.droppedRecord,0),a=t.isNullOrUndefined(r)||0===r?e+1:r+e+1;if("middleSegment"===this.dropPosition&&!this.isSharedTask){if(i.taskFields.parentID&&this.ganttData.length>0&&this.ganttData.splice(a,0,this.draggedRecord.taskData),this.treeGridData.splice(a,0,this.draggedRecord),this.parent.ids.splice(a,0,this.draggedRecord.ganttProperties.rowUniqueID.toString()),"ResourceView"===this.parent.viewType){var n=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId;this.parent.getTaskIds().splice(a,0,n)}this.draggedRecord.hasChildRecords&&this.updateChildRecord(this.draggedRecord,a,this.droppedRecord.expanded),this.recordLevel(),t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))&&this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.recordLevel=function(){var e=this.parent,i=this.draggedRecord,r=this.droppedRecord,a=e.taskFields.child;if(r.hasChildRecords||(r.hasChildRecords=!0,r.childRecords.length||(r.childRecords=[],!e.taskFields.parentID&&t.isNullOrUndefined(r.taskData[a])&&(r.taskData[a]=[]))),"middleSegment"===this.dropPosition){var n=t.extend({},r);delete n.childRecords;var s={uniqueID:n.uniqueID,expanded:n.expanded,level:n.level,index:n.index,taskId:n.ganttProperties.rowUniqueID};if(this.parent.setRecordValue("parentItem",s,i),this.parent.setRecordValue("parentUniqueID",r.uniqueID,i),r.childRecords.splice(r.childRecords.length,0,i),t.isNullOrUndefined(i)||e.taskFields.parentID||t.isNullOrUndefined(r.taskData[a])||r.taskData[e.taskFields.child].splice(r.childRecords.length,0,i.taskData),i.hasChildRecords){i.level=r.level+1,this.parent.setRecordValue("level",this.draggedRecord.level,this.draggedRecord),this.updateChildRecordLevel(i,1)}else i.level=r.level+1;r.expanded=!0}},e.prototype.deleteDragRow=function(){this.treeGridData=y(this.parent)?t.getValue("result",this.parent.treeGrid.dataSource):this.parent.treeGrid.dataSource,this.parent.dataSource instanceof a.DataManager?this.ganttData=t.getValue("dataOperation.dataArray",this.parent):this.ganttData=y(this.parent)?t.getValue("result",this.parent.dataSource):this.parent.dataSource;var e=this.parent.getTaskByUniqueID(this.draggedRecord.uniqueID);this.removeRecords(e)},e.prototype.checkisSharedTask=function(){this.isSharedTask=!1;for(var e=null,t=0===this.droppedRecord.level?this.droppedRecord.uniqueID:this.droppedRecord.parentItem.uniqueID,i=this.parent.getTaskByUniqueID(t).childRecords,r=0;r<i.length;r++)"T"+this.draggedRecord.ganttProperties.taskId=="T"+i[r].ganttProperties.taskId&&(this.isSharedTask=!0,e=i[r]);this.isSharedTask&&this.removeResourceInfo(e)},e.prototype.dropAtTop=function(e){var i=this.parent;if(!this.isSharedTask){if(i.taskFields.parentID&&this.ganttData.length>0&&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){var r=0===this.draggedRecord.level?"R"+this.draggedRecord.ganttProperties.taskId:"T"+this.draggedRecord.ganttProperties.taskId;this.parent.getTaskIds().splice(e,0,r)}if(this.draggedRecord.hasChildRecords){this.updateChildRecord(this.draggedRecord,e),this.updateChildRecordLevel(this.draggedRecord,1)}if(this.droppedRecord.parentItem){var a=this.parent.getParentTask(this.droppedRecord.parentItem).childRecords,n=a.indexOf(this.droppedRecord);a.splice(n,0,this.draggedRecord)}t.isNullOrUndefined(this.draggedRecord.parentItem&&-1!==this.updateParentRecords.indexOf(this.draggedRecord.parentItem))||this.updateParentRecords.push(this.draggedRecord.parentItem)}},e.prototype.updateChildRecordLevel=function(e,t){var i,r=0;if(t++,!e.hasChildRecords)return 0;r=e.childRecords.length;for(var a=0;a<r;a++){i=e.childRecords[a];var n=void 0;if(e.parentItem){n=this.parent.treeGrid.uniqueIDCollection[e.parentItem.uniqueID]}i.level=e.parentItem?n.level+t:e.level+1,this.parent.setRecordValue("level",i.level,i),i.hasChildRecords&&(t--,t=this.updateChildRecordLevel(i,t))}return t},e.prototype.updateChildRecord=function(e,t,i){var r,a=this.parent,n=0;if(!e.hasChildRecords)return 0;n=e.childRecords.length;for(var s=0;s<n;s++)r=e.childRecords[s],t++,a.flatData.splice(t,0,r),this.parent.ids.splice(t,0,r.ganttProperties.rowUniqueID.toString()),a.taskFields.parentID&&a.dataSource.length>0&&this.ganttData.splice(t,0,r.taskData),r.hasChildRecords&&(t=this.updateChildRecord(r,t));return t},e.prototype.removeRecords=function(e){var i,r=this.parent;i=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;var n=e,s=this.parent.getParentTask(n.parentItem);if(n){if(n.parentItem){var o=s?s.childRecords:[],l=0;o&&o.length>0&&("ResourceView"===this.parent.viewType&&1===o.length&&(this.parent.isOnDelete=!0,o[0].isDelete=!0,this.parent.dataOperation.updateParentItems(s),this.parent.isOnDelete=!1,o[0].isDelete=!1),l=o.indexOf(n),s.childRecords.splice(l,1),!this.parent.taskFields.parentID&&s.taskData[this.parent.taskFields.child]&&s.taskData[this.parent.taskFields.child].splice(l,1),this.updateParentRecords.push(s))}if(!this.parent.taskFields.parentID){var d=[];d.push(n.ganttProperties.taskId.toString()),("ProjectView"===this.parent.viewType||"ResourceView"===this.parent.viewType&&"middleSegment"!==this.dropPosition)&&this.parent.editModule.removeFromDataSource(d)}if(r.taskFields.parentID){n.hasChildRecords&&n.childRecords.length>0&&this.removeChildItem(n);for(var h=void 0,p=i.length>0&&"ResourceView"!==this.parent.viewType?i:this.parent.updatedRecords,c=0;c<p.length;c++)"ResourceView"===this.parent.viewType?p[c].ganttProperties.rowUniqueID===n.ganttProperties.rowUniqueID&&(h=c):p[c][this.parent.taskFields.id]===n.taskData[this.parent.taskFields.id]&&(h=c);if(-1!==h){i.length>0&&i.splice(h,1);var u=this.treeGridData.indexOf(n);this.treeGridData.splice(u,1),this.parent.ids.splice(u,1),-1!==this.parent.treeGrid.parentData.indexOf(n)&&this.parent.treeGrid.parentData.splice(this.parent.treeGrid.parentData.indexOf(n),1),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(h,1)}}var g=this.treeGridData.indexOf(n);if(!r.taskFields.parentID){var f=this.parent.editModule.getChildCount(n,0);this.treeGridData.splice(g,f+1),this.parent.ids.splice(g,f+1);var m=this.ganttData.indexOf(n.taskData);-1!==m&&(this.ganttData.splice(m,1),this.parent.treeGrid.parentData.splice(m,1)),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(g,f+1)}n.parentItem&&s&&s.childRecords&&!s.childRecords.length&&(s.expanded=!1,s.hasChildRecords=!1)}},e.prototype.removeChildItem=function(e){for(var i,r,n=0;n<e.childRecords.length;n++){i=e.childRecords[n];var s=void 0;s=this.parent.dataSource instanceof a.DataManager?t.getValue("dataOperation.dataArray",this.parent):this.parent.dataSource;for(var o=0;o<s.length;o++)s[o][this.parent.taskFields.id]===i.taskData[this.parent.taskFields.id]&&(r=o);if(-1!==r){s.length>0&&s.splice(r,1);var l=this.treeGridData.indexOf(i);this.treeGridData.splice(l,1),this.parent.ids.splice(l,1),"ResourceView"===this.parent.viewType&&this.parent.getTaskIds().splice(r,1)}i.hasChildRecords&&this.removeChildItem(i)}},e.prototype.reorderRows=function(e,t,i){if(!this.parent.readOnly){e[0],"above"===i&&(this.dropPosition="topSegment"),"below"===i&&(this.dropPosition="bottomSegment"),"child"===i&&(this.dropPosition="middleSegment");for(var r=[],a=0;a<e.length;a++)r[a]=this.parent.updatedRecords[e[a]];var n={data:r,dropIndex:t,dropPosition:this.dropPosition};this.dropRows(n,!0)}},e}(),bi=function(){function e(e){this.theme=e,this.ganttStyle={},this.setTheme(this.ganttStyle,this.theme)}return Object.defineProperty(e.prototype,"style",{get:function(){return this.ganttStyle?this.ganttStyle:(this.setTheme(this.ganttStyle,"Material"),this.ganttStyle)},enumerable:!0,configurable:!0}),e.prototype.setTheme=function(e,t){switch(this.initStyles(e),e.columnHeader.fontSize=9.5,e.columnHeader.fontColor=new g.PdfColor(0,0,0),e.columnHeader.fontColor.gray=.2,e.columnHeader.backgroundColor=new g.PdfColor(255,255,255),e.columnHeader.borderColor=new g.PdfColor(234,234,234),e.columnHeader.format.lineAlignment=1,e.columnHeader.format.alignment=0,e.fontFamily=g.PdfFontFamily.Helvetica,e.cell.fontSize=9.5,e.cell.backgroundColor=new g.PdfColor(255,255,255),e.cell.borderColor=new g.PdfColor(234,234,234),e.cell.fontColor=new g.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.timeline.fontSize=9.5,e.timeline.fontStyle=0,e.timeline.backgroundColor=new g.PdfColor(252,252,252),e.timeline.fontColor=new g.PdfColor(40,40,39),e.chartGridLineColor=new g.PdfColor(206,206,206),e.timeline.borderColor=new g.PdfColor(206,206,206),t){case"Bootstrap":e.taskbar.taskColor=new g.PdfColor(49,122,185),e.taskbar.progressColor=new g.PdfColor(33,82,125),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(119,119,119),e.taskbar.parentProgressColor=new g.PdfColor(85,85,85),e.taskbar.taskBorderColor=new g.PdfColor(33,82,125),e.taskbar.parentTaskBorderColor=new g.PdfColor(85,85,85),e.taskbar.milestoneColor=new g.PdfColor(85,85,85),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(33,82,125),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(0,0,0);break;case"Bootstrap 4":e.taskbar.taskColor=new g.PdfColor(0,123,255),e.taskbar.progressColor=new g.PdfColor(0,86,179),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(108,117,125),e.taskbar.parentProgressColor=new g.PdfColor(73,80,87),e.taskbar.taskBorderColor=new g.PdfColor(0,86,179),e.taskbar.parentTaskBorderColor=new g.PdfColor(73,80,87),e.taskbar.milestoneColor=new g.PdfColor(73,80,87),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(0,86,179),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(33,37,41);break;case"Fabric":e.columnHeader.fontColor=new g.PdfColor(102,102,102),e.cell.fontColor=new g.PdfColor(51,51,51),e.taskbar.taskColor=new g.PdfColor(0,120,214),e.taskbar.progressColor=new g.PdfColor(0,91,163),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(118,118,118),e.taskbar.parentProgressColor=new g.PdfColor(80,80,80),e.taskbar.taskBorderColor=new g.PdfColor(0,91,163),e.taskbar.parentTaskBorderColor=new g.PdfColor(80,80,80),e.taskbar.milestoneColor=new g.PdfColor(80,80,80),e.footer.fontColor=new g.PdfColor(51,51,51),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(0,69,122),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(51,51,51);break;default:e.taskbar.taskColor=new g.PdfColor(88,105,197),e.taskbar.progressColor=new g.PdfColor(63,81,181),e.taskbar.criticalTaskColor=new g.PdfColor(255,139,139),e.taskbar.criticalProgressColor=new g.PdfColor(255,85,85),e.criticalConnectorLineColor=new g.PdfColor(255,85,85),e.taskbar.criticalTaskBorderColor=new g.PdfColor(255,85,85),e.taskbar.parentTaskColor=new g.PdfColor(132,132,132),e.taskbar.parentProgressColor=new g.PdfColor(97,97,97),e.taskbar.taskBorderColor=new g.PdfColor(63,81,181),e.taskbar.parentTaskBorderColor=new g.PdfColor(51,51,51),e.taskbar.milestoneColor=new g.PdfColor(97,97,97),e.footer.fontColor=new g.PdfColor(0,0,0),e.footer.fontColor.gray=.2,e.connectorLineColor=new g.PdfColor(63,81,181),e.footer.backgroundColor=new g.PdfColor(255,255,255),e.taskbar.progressFontColor=new g.PdfColor(255,255,255),e.label.fontColor=new g.PdfColor(51,51,51)}},e.prototype.initStyles=function(e){e.columnHeader={},e.columnHeader.format=new g.PdfStringFormat,e.cell={},e.cell.format=new g.PdfStringFormat,e.timeline={},e.footer={},e.footer.format=new g.PdfStringFormat,e.label={},e.taskbar={}},e}(),Pi=function(){function e(){this.mKeys=[],this.mValues=[]}return e.prototype.size=function(){return this.mKeys.length},e.prototype.add=function(e,t){if(void 0===e||null===e||void 0===t||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.")},e.prototype.keys=function(){return this.mKeys},e.prototype.values=function(){return this.mValues},e.prototype.getValue=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");var t=this.mKeys.indexOf(e);if(t<0)throw new RangeError("No item with the specified key has been added.");return this.mValues[t]},e.prototype.setValue=function(e,t){if(void 0===e||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},e.prototype.remove=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");var t=this.mKeys.indexOf(e);if(t<0)throw new RangeError("No item with the specified key has been added.");return this.mKeys.splice(t,1),this.mValues.splice(t,1),!0},e.prototype.containsKey=function(e){if(void 0===e||null===e)throw new ReferenceError("Provided key is not valid.");return!(this.mKeys.indexOf(e)<0)},e.prototype.clear=function(){this.mKeys=[],this.mValues=[]},e}(),Si=function(){function e(){var e=new g.PdfPen(new g.PdfColor(0,0,0));e.dashStyle=g.PdfDashStyle.Solid;var t=new g.PdfPen(new g.PdfColor(0,0,0));t.dashStyle=g.PdfDashStyle.Solid;var i=new g.PdfPen(new g.PdfColor(0,0,0));i.dashStyle=g.PdfDashStyle.Solid;var r=new g.PdfPen(new g.PdfColor(0,0,0));r.dashStyle=g.PdfDashStyle.Solid,this.leftPen=e,this.rightPen=t,this.topPen=i,this.bottomPen=r}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftPen},set:function(e){this.leftPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightPen},set:function(e){this.rightPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.topPen},set:function(e){this.topPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.bottomPen},set:function(e){this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"all",{set:function(e){this.leftPen=this.rightPen=this.topPen=this.bottomPen=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAll",{get:function(){return this.leftPen===this.rightPen&&this.leftPen===this.topPen&&this.leftPen===this.bottomPen},enumerable:!0,configurable:!0}),Object.defineProperty(e,"default",{get:function(){return new e},enumerable:!0,configurable:!0}),e}(),Ci=function(){function e(e,t,i,r){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=r,this.hasLeftPad=!0,this.hasRightPad=!0,this.hasTopPad=!0,this.hasBottomPad=!0)}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftPad},set:function(e){this.leftPad=e,this.hasLeftPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightPad},set:function(e){this.rightPad=e,this.hasRightPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.topPad},set:function(e){this.topPad=e,this.hasTopPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.bottomPad},set:function(e){this.bottomPad=e,this.hasBottomPad=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.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}),e}(),Mi=function(){return function(){}}(),Ri=function(){return function(){this.cellSpacing=0,this.borderOverlapStyle=g.PdfBorderOverlapStyle.Overlap,this.allowHorizontalOverflow=!1,this.horizontalOverflowType=e.PdfHorizontalOverflowType.LastPage,this.cellPadding=new Ci}}(),Oi=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),xi=function(i){function r(e){var t=i.call(this,e)||this;return t.columnRanges=[],t.repeatRowIndex=-1,t.currentBounds=new g.RectangleF(0,0,0,0),t}return Oi(r,i),Object.defineProperty(r.prototype,"treegrid",{get:function(){return this.elements},enumerable:!0,configurable:!0}),r.prototype.layoutInternal=function(e){if(t.isNullOrUndefined(e))throw Error("Argument Null Expection");this.currentPage=e.page;var i=e.format;if(null!==this.currentPage&&(this.currentPageBounds=this.currentPage.getClientSize()),this.currentGraphics=this.currentPage.graphics,null!==i&&i.break===g.PdfLayoutBreakType.FitColumnsToPage?this.currentBounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),new g.SizeF(this.treegrid.columns.width,this.currentGraphics.clientSize.height)):this.currentBounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),this.currentGraphics.clientSize),0===this.treegrid.rows.count)throw Error("Please add row or header into grid");return this.currentBounds.width=e.bounds.width>0?e.bounds.width:this.currentBounds.width-this.treegrid.rows.getRow(0).cells.getCell(0).style.borders.left.width/2,this.startLocation=new g.PointF(e.bounds.x,e.bounds.y),e.bounds.height>0&&(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)},r.prototype.determineColumnDrawRanges=function(){for(var e=0,t=0,i=0,r=this.currentGraphics.clientSize.width-this.currentBounds.x,a=0;a<this.treegrid.columns.count;a++)if((i+=this.treegrid.columns.getColumn(a).width)>=r){for(var n=0,s=e;s<=a&&!((n+=this.treegrid.columns.getColumn(s).width)>r);s++)t=s;this.columnRanges.push([e,t]),e=t+1,i=t<=a?this.treegrid.columns.getColumn(a).width:0}this.columnRanges.push([e,this.treegrid.columns.count-1])},r.prototype.getFormat=function(e){return e},r.prototype.layoutOnPage=function(t){for(var i=this.getFormat(t.format),r=null,a=new Pi,n=t.page,s=0;s<this.columnRanges.length;s++){var o=this.columnRanges[s];this.cellStartIndex=o[0],this.cellEndIndex=o[1];for(var l=this.treegrid.rows.count,d=0,h=!1,p=0;p<l;p++){var c=this.treegrid.rows.getRow(p);d++;var u=this.currentBounds.y;null===this.currentPage||a.containsKey(this.currentPage)||a.add(this.currentPage,o);var f=this.drawRow(c);for(u===this.currentBounds.y?(h=!0,this.repeatRowIndex=this.treegrid.rows.rowCollection.indexOf(c)):(h=!1,this.repeatRowIndex=-1);!f.isFinish&&null!==n;)if(this.treegrid.allowRowBreakAcrossPages)this.currentPage=this.getNextPageFormat(i),this.treegrid.enableHeader&&this.drawHeader(),this.checkBounds(i),f=this.drawRow(c);else{if(!this.treegrid.allowRowBreakAcrossPages&&d<length){this.currentPage=this.getNextPageFormat(i),this.treegrid.enableHeader&&this.drawHeader();break}if(d>=length)break}!f.isFinish&&null!==n&&i.layout!==g.PdfLayoutType.OnePage&&h&&(this.startLocation.x=this.currentBounds.x,this.currentPage=this.getNextPageFormat(i),this.treegrid.enableHeader&&this.drawHeader(),this.startLocation.y=this.currentBounds.y,i.paginateBounds===new g.RectangleF(0,0,0,0)&&(this.currentBounds.x+=this.startLocation.x),this.currentBounds.x===Si.default.left.width/2&&(this.currentBounds.y+=this.startLocation.x),this.drawRow(c),null===this.currentPage||a.containsKey(this.currentPage)||a.add(this.currentPage,o))}this.columnRanges.indexOf(o)<this.columnRanges.length-1&&null!==n&&i.layout!==g.PdfLayoutType.OnePage&&(this.currentPage=this.getNextPageFormat(i),this.checkBounds(i))}return r=this.getLayoutResult(),this.treegrid.style.allowHorizontalOverflow&&this.treegrid.style.horizontalOverflowType===e.PdfHorizontalOverflowType.NextPage&&this.reArrangePages(a),r},r.prototype.checkBounds=function(e){var t=new g.PointF(Si.default.right.width/2,Si.default.top.width/2);e.paginateBounds===new g.RectangleF(0,0,0,0)&&this.startLocation===t&&(this.currentBounds.x+=this.startLocation.x,this.currentBounds.y+=this.startLocation.y)},r.prototype.drawHeader=function(){this.drawRow(this.treegrid.rows.getRow(0))},r.prototype.reArrangePages=function(e){for(var t=this.currentPage.document,i=[],r=e.keys(),a=0;a<r.length;a++){(o=r[a]).section=null,i.push(o),t.pages.remove(o)}for(a=0;a<e.size();a++)for(var n=e.size()/this.columnRanges.length,s=a;s<e.size();s+=n){var o=i[s];-1===t.pages.indexOf(o)&&t.pages.add(o)}},r.prototype.getNextPageFormat=function(e){var t=this.currentPage.section,i=null,r=t.indexOf(this.currentPage);return i=r===t.count-1?t.add():t.getPages()[r+1],this.currentGraphics=i.graphics,this.currentBounds=new g.RectangleF(new g.PointF(0,0),i.getClientSize()),i},r.prototype.getLayoutResult=function(){var e=new g.RectangleF(this.startLocation,new g.SizeF(this.currentBounds.width,this.currentBounds.y-this.startLocation.y));return new Ii(this.currentPage,e)},r.prototype.checkIfDefaultFormat=function(e){var t=new g.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},r.prototype.drawRow=function(e,i,r){if(t.isNullOrUndefined(i)){var a=new g.RowLayoutResult;return(r=e.rowBreakHeight>0?e.rowBreakHeight:e.height)>this.currentPageBounds.height?this.treegrid.allowRowBreakAcrossPages?(a.isFinish=!0,this.drawRowWithBreak(a,e,r)):(a.isFinish=!1,this.drawRow(e,a,r)):this.currentBounds.y+r>this.currentPageBounds.height||this.currentBounds.y+r>this.currentBounds.height?this.repeatRowIndex>-1&&this.repeatRowIndex===e.rowIndex?this.treegrid.allowRowBreakAcrossPages?(a.isFinish=!0,this.drawRowWithBreak(a,e,r)):(a.isFinish=!1,this.drawRow(e,a,r)):a.isFinish=!1:(a.isFinish=!0,this.drawRow(e,a,r)),a}var n=new g.PointF(this.currentBounds.x,this.currentBounds.y);i.bounds=new g.RectangleF(n,new g.SizeF(0,0));var s=0;r=this.reCalculateHeight(e,r);for(var o=this.cellStartIndex;o<=this.cellEndIndex;o++){var l=e.cells.getCell(o),d=this.treegrid.columns.getColumn(o);d.isTreeColumn&&(s=10*e.level);var h=o>this.cellEndIndex+1&&l.columnSpan>1;if(!h)for(var p=1;p<l.columnSpan;p++)e.cells.getCell(o+p).isCellMergeContinue=!0;var c=new g.SizeF(d.width,r);!this.checkIfDefaultFormat(d.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=d.format),l.draw(this.currentGraphics,new g.RectangleF(n,c),h,s),e.treegrid.style.allowHorizontalOverflow&&(l.columnSpan>this.cellEndIndex||o+l.columnSpan>this.cellEndIndex+1)&&this.cellEndIndex<e.cells.count-1&&(e.rowOverflowIndex=this.cellEndIndex),n.x+=d.width,s=0}return this.currentBounds.y+=r,i.bounds=new g.RectangleF(new g.PointF(i.bounds.x,i.bounds.y),new g.SizeF(n.x,n.y)),null},r.prototype.drawRowWithBreak=function(e,t,i){var r=new g.PointF(this.currentBounds.x,this.currentBounds.y);e.bounds=new g.RectangleF(r,new g.SizeF(0,0));var a=0;this.treegridHeight=this.currentBounds.height,t.rowBreakHeight=this.currentBounds.y+i-this.currentBounds.height;for(var n=0;n<t.cells.count;n++){(l=t.cells.getCell(n)).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&&(a=10*t.level);var l,d=(l=t.cells.getCell(s)).columnSpan+s>this.cellEndIndex+1&&l.columnSpan>1;if(!d)for(var h=1;h<l.columnSpan;h++)t.cells.getCell(s+h).isCellMergeContinue=!0;var p=this.treegridHeight>0?this.treegridHeight:this.currentBounds.height,c=new g.SizeF(o.width,p);!this.checkIfDefaultFormat(o.format)&&this.checkIfDefaultFormat(l.style.format)&&(l.style.format=o.format),l.draw(this.currentGraphics,new g.RectangleF(r,c),d,a),e.isFinish=e.isFinish?l.finishedDrawingCell:e.isFinish,r.x+=o.width,a=0,this.currentBounds.y+=this.treegridHeight>0?this.treegridHeight:i,e.bounds=new g.RectangleF(new g.PointF(e.bounds.x,e.bounds.y),new g.SizeF(r.x,r.y))}},r.prototype.reCalculateHeight=function(e,i){for(var r=0,a=this.cellStartIndex;a<=this.cellEndIndex;a++)t.isNullOrUndefined(e.cells.getCell(a).remainingString)&&""!==e.cells.getCell(a).remainingString||(r=Math.max(r,e.cells.getCell(a).measureHeight()));return Math.max(i,r)},r}(g.ElementLayouter),Ii=function(e){function t(t,i){return e.call(this,t,i)||this}return Oi(t,e),t}(g.PdfLayoutResult),Ei=function(e){function t(t){return void 0===t?e.call(this)||this:e.call(this,t)||this}return Oi(t,e),t}(g.PdfLayoutFormat),Ni=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Fi=function(e){function t(){var t=e.call(this)||this;return t.treeGridSize=new g.SizeF(0,0),t.treeColumnIndex=0,t.allowRowBreakAcrossPages=!0,t.enableHeader=!0,t.isFitToWidth=!1,t.columns=new ji(t),t.rows=new Bi(t),t.headers=new Ai(t),t.style=new Ri,t.rowHeight=0,t}return Ni(t,e),Object.defineProperty(t.prototype,"raiseBeginCellDraw",{get:function(){return void 0!==this.beginCellDraw&&null!==typeof this.beginCellDraw},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"raiseEndCellDraw",{get:function(){return void 0!==this.endCellDraw&&null!==typeof this.endCellDraw},enumerable:!0,configurable:!0}),Object.defineProperty(t.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}),t.prototype.draw=function(e,t,i,r){if(t instanceof g.PointF&&void 0===t.width&&void 0===i)return this.drawHelper(e,t.x,t.y);if("number"==typeof t&&"number"==typeof i&&void 0===r)return this.drawHelper(e,t,i,null);if(t instanceof g.RectangleF&&void 0!==t.width&&void 0===i)return this.drawHelper(e,t,null);if(t instanceof g.PointF&&void 0===t.width&&i instanceof g.PdfLayoutFormat)return this.drawHelper(e,t.x,t.y,i);if("number"==typeof t&&"number"==typeof i&&(r instanceof g.PdfLayoutFormat||null==r)){var a=e.graphics.clientSize.width-t,n=new g.RectangleF(t,i,a,0);return this.drawHelper(e,n,r)}return t instanceof g.RectangleF&&void 0!==t.width&&"boolean"==typeof i?this.drawHelper(e,t,null):this.drawHelper(e,t,i)},t.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{t=[];var r=0,a=0,n=this.columns.count;for(i=0;i<n;i++){for(var s=this.rows.count,o=0;o<s;o++){var l=this.rows.getRow(o).cells.getCell(i).width,d=this.initialWidth>0?Math.min(this.initialWidth,l):l;r=Math.max(r,d),r=Math.max(this.columns.getColumn(i).width,r),this.columns.getColumn(i).isTreeColumn&&(a=Math.max(a,this.rows.getRow(o).level))}this.columns.getColumn(i).isTreeColumn?t.push(r+10*a):t.push(r),r=0}for(i=0;i<this.columns.count;i++)this.columns.getColumn(i).width<0&&(this.columns.getColumn(i).width=t[i])}},t.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 g.SizeF(t,e)},t.prototype.drawGrid=function(e,t,i,r){this.initialWidth=e.graphics.clientSize.width;var a=new g.RectangleF(0,0,e.getClientSize().height,0);return this.draw(e,a,r)},t.prototype.layout=function(e){if(0!==this.rows.count){var t=this.rows.getRow(0).cells.getCell(0).style;if(1!==t.borders.left.width){var i=t.borders.left.width/2,r=t.borders.top.width/2;if(e.bounds.x===Si.default.right.width/2&&e.bounds.y===Si.default.right.width/2){var a=new g.RectangleF(new g.PointF(i,r),new g.SizeF(this.size.width,this.size.height));e.bounds=a}}}this.setSpan(),this.layouter=new xi(this);return this.layouter.layoutInternal(e)},t.prototype.onBeginCellDraw=function(e){this.raiseBeginCellDraw&&this.beginCellDraw(this,e)},t.prototype.onEndCellDraw=function(e){this.raiseEndCellDraw&&this.endCellDraw(this,e)},t.prototype.setSpan=function(){for(var e=1,t=1,i=0,r=0,a=0,n=this.headers.count,s=0;s<n;s++){a=0;for(var o=(h=this.headers.getHeader(s)).cells.count,l=0;l<o;l++){var d=h.cells.getCell(l);if(a=Math.max(a,d.rowSpan),!d.isCellMergeContinue&&!d.isRowMergeContinue&&(d.columnSpan>1||d.rowSpan>1)){if(d.columnSpan+l>h.cells.count)throw new Error("Invalid span specified at row "+l.toString()+" column "+s.toString());if(d.rowSpan+s>this.headers.count)throw new Error("Invalid span specified at Header "+l.toString()+" column "+s.toString());if(d.columnSpan>1&&d.rowSpan>1){for(e=d.columnSpan,t=d.rowSpan,i=l,r=s,d.isCellMergeStart=!0,d.isRowMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,h.cells.getCell(i).isRowMergeContinue=!0,h.cells.getCell(i).rowSpan=t,e--;for(i=l,e=d.columnSpan;t>1;){for(r++,this.headers.getHeader(r).cells.getCell(l).isRowMergeContinue=!0,this.headers.getHeader(r).cells.getCell(i).isRowMergeContinue=!0,t--;e>1;)i++,this.headers.getHeader(r).cells.getCell(i).isCellMergeContinue=!0,this.headers.getHeader(r).cells.getCell(i).isRowMergeContinue=!0,e--;e=d.columnSpan,i=l}}else if(d.columnSpan>1&&1===d.rowSpan)for(e=d.columnSpan,i=l,d.isCellMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,e--;else if(1===d.columnSpan&&d.rowSpan>1)for(t=d.rowSpan,r=s;t>1;)r++,this.headers.getHeader(r).cells.getCell(l).isRowMergeContinue=!0,t--}}h.maximumRowSpan=a}e=t=1,i=r=0,n=this.rows.count;for(s=0;s<n;s++){var h,p=(h=this.rows.getRow(s)).cells.count;for(l=0;l<p;l++){if(!(d=h.cells.getCell(l)).isCellMergeContinue&&!d.isRowMergeContinue&&(d.columnSpan>1||d.rowSpan>1)){if(d.columnSpan+l>h.cells.count)throw new Error("Invalid span specified at row {0} column {1} "+l.toString());if(d.rowSpan+s>this.rows.count)throw new Error("Invalid span specified at row {0} column {1} "+l.toString());if(d.columnSpan>1&&d.rowSpan>1){for(e=d.columnSpan,t=d.rowSpan,i=l,r=s,d.isCellMergeStart=!0,d.isRowMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,e--;for(i=l,e=d.columnSpan;t>1;){for(r++,this.rows.getRow(r).cells.getCell(l).isRowMergeContinue=!0,t--;e>1;)i++,this.rows.getRow(r).cells.getCell(i).isCellMergeContinue=!0,e--;e=d.columnSpan,i=l}}else if(d.columnSpan>1&&1===d.rowSpan)for(e=d.columnSpan,i=l,d.isCellMergeStart=!0;e>1;)i++,h.cells.getCell(i).isCellMergeContinue=!0,e--;else if(1===d.columnSpan&&d.rowSpan>1)for(t=d.rowSpan,r=s;t>1;)r++,this.rows.getRow(r).cells.getCell(l).isRowMergeContinue=!0,t--}}}},t}(g.PdfLayoutElement),Ui=function(){function e(e){this.cellWidth=0,this.cellHeight=0,this.finishedDrawingCell=!0,t.isNullOrUndefined(e)?(this.rowSpan=1,this.columnSpan=1):this.row=e,this.style={}}return Object.defineProperty(e.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(e.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}),e.prototype.measureWidth=function(){var e=0,t=new g.PdfStringLayouter;if("string"==typeof this.value){var i=new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);this.row.treegrid.ganttStyle.font&&(i=this.row.treegrid.ganttStyle.font);e+=t.layout(this.value,i,this.style.format,new g.SizeF(Number.MAX_VALUE,Number.MAX_VALUE),!1,new g.SizeF(0,0)).actualSize.width,e+=2*(this.style.borders.left.width+this.style.borders.right.width)}return void 0!==this.row.treegrid.style.cellPadding.left&&this.row.treegrid.style.cellPadding.hasLeftPad&&(e+=this.row.treegrid.style.cellPadding.left),void 0!==this.row.treegrid.style.cellPadding.right&&this.row.treegrid.style.cellPadding.hasRightPad&&(e+=this.row.treegrid.style.cellPadding.right),e+=this.row.treegrid.style.cellSpacing},e.prototype.measureHeight=function(){var e=this.row.treegrid.rowHeight,i=0,r=this.calculateWidth();r-=this.row.treegrid.style.cellPadding.right+this.row.treegrid.style.cellPadding.left,r-=this.style.borders.left.width+this.style.borders.right.width;var a=new g.PdfStringLayouter;if("string"==typeof this.value||"string"==typeof this.remainingString){var n=this.value;this.finishedDrawingCell||(n=t.isNullOrUndefined(this.remainingString)||""===this.remainingString?this.value:this.remainingString);var s=new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle);this.row.treegrid.ganttStyle.font&&(s=this.row.treegrid.ganttStyle.font);i+=a.layout(n,s,this.style.format,new g.SizeF(r,0),!1,new g.SizeF(0,0)).actualSize.height,i+=2*(this.style.borders.top.width+this.style.borders.bottom.width)}return i+=this.row.treegrid.style.cellPadding.top+this.row.treegrid.style.cellPadding.bottom,(i+=this.row.treegrid.style.cellSpacing)>e?i:e},e.prototype.calculateWidth=function(){for(var e=this.row.cells.indexOf(this),t=this.columnSpan,i=0,r=0;r<t;r++)i+=this.row.treegrid.columns.getColumn(e+r).width;return this.row.treegrid.columns.getColumn(e).isTreeColumn&&(i-=10*this.row.level),i},e.prototype.draw=function(e,t,i,r){var a=null;if(i){for(var n=this.row.cells.indexOf(this),s=n+1;s<=n+this.columnSpan;s++)this.row.cells.getCell(s).isCellMergeContinue=!1,this.row.cells.getCell(s).isRowMergeContinue=!1;this.columnSpan=1}if((this.isCellMergeContinue||this.isRowMergeContinue)&&this.isCellMergeContinue&&this.row.treegrid.style.allowHorizontalOverflow)return this.row.rowOverflowIndex>0&&this.row.cells.indexOf(this)!==this.row.rowOverflowIndex+1||0===this.row.rowOverflowIndex&&this.isCellMergeContinue,a;this.drawCellBackground(e,t);var o=new g.PdfSolidBrush(this.style.fontColor),l=null;l=this.row.isParentRow?new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,g.PdfFontStyle.Bold):new g.PdfStandardFont(this.row.treegrid.ganttStyle.fontFamily,this.style.fontSize,this.style.fontStyle),this.row.treegrid.ganttStyle.font&&(l=this.row.treegrid.ganttStyle.font);var d=t;if(this.isHeaderCell||(d.x=d.x,d.width=d.width),d.height>=e.clientSize.height&&(this.row.treegrid.allowRowBreakAcrossPages?(d.height-=d.y,t.height-=t.y):(d.height=e.clientSize.height,t.height=e.clientSize.height)),d=this.adjustContentLayoutArea(d),"string"==typeof this.value||"string"==typeof this.remainingString){var h=null;this.finishedDrawingCell?(h=""===this.remainingString?this.remainingString:this.value,e.drawString(h,l,null,o,d.x+r,d.y,d.width-r-10,d.height-10,this.style.format)):e.drawString(this.remainingString,l,null,o,d.x+r,d.y,this.style.format),a=e.stringLayoutResult}return null!=this.style.borders&&this.drawCellBorder(e,t),a},e.prototype.drawCellBackground=function(e,t){var i=new g.PdfSolidBrush(this.style.backgroundColor);null!=i&&(e.save(),e.drawRectangle(i,t.x,t.y,t.width,t.height),e.restore())},e.prototype.adjustContentLayoutArea=function(e){var t=new g.RectangleF(new g.PointF(e.x,e.y),new g.SizeF(e.width,e.height)),i=this.style.padding;if(this.value instanceof Fi){var r=this.value.size;this.style.format.alignment===g.PdfTextAlignment.Center?(t.x+=i.left+(t.width-r.width)/2,t.y+=i.top+(t.height-r.height)/2):this.style.format.alignment===g.PdfTextAlignment.Left?(t.x+=i.left,t.y+=i.top):this.style.format.alignment===g.PdfTextAlignment.Right&&(t.x+=i.left+(t.width-r.width),t.y+=i.top)}else t.x+=i.left,t.y+=i.top;return t},e.prototype.drawCellBorder=function(e,t){if(this.row.treegrid.style.borderOverlapStyle===g.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)return e.drawRectangle(this.style.borders.left,t.x,t.y,t.width,t.height),void e.restore();var i=new g.PointF(t.x,t.y+t.height),r=new g.PointF(t.x,t.y),a=this.style.borders.left;this.style.borders.left.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore(),i=new g.PointF(t.x+t.width,t.y),r=new g.PointF(t.x+t.width,t.y+t.height),a=this.style.borders.right,t.x+t.width>e.clientSize.width-a.width/2&&(i=new g.PointF(e.clientSize.width-a.width/2,t.y),r=new g.PointF(e.clientSize.width-a.width/2,t.y+t.height)),this.style.borders.right.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore(),i=new g.PointF(t.x,t.y),r=new g.PointF(t.x+t.width,t.y),a=this.style.borders.top,this.style.borders.top.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore(),i=new g.PointF(t.x+t.width,t.y+t.height),r=new g.PointF(t.x,t.y+t.height),a=this.style.borders.bottom,t.y+t.height>e.clientSize.height-a.width/2&&(i=new g.PointF(t.x+t.width,e.clientSize.height-a.width/2),r=new g.PointF(t.x,e.clientSize.height-a.width/2)),this.style.borders.bottom.dashStyle===g.PdfDashStyle.Solid&&(a.lineCap=g.PdfLineCap.Square),e.drawLine(a,i,r),e.restore()},e}(),Vi=function(){function e(e){this.treegridRow=e,this.cells=[]}return e.prototype.getCell=function(e){if(e<0||e>=this.count)throw new Error("IndexOutOfRangeException");return this.cells[e]},Object.defineProperty(e.prototype,"count",{get:function(){return this.cells.length},enumerable:!0,configurable:!0}),e.prototype.add=function(e){if(void 0===e){var t=new Ui;return this.add(t),e}e.row=this.treegridRow,this.cells.push(e)},e.prototype.indexOf=function(e){return this.cells.indexOf(e)},e}(),Li=function(){function e(e){this.treegridRowOverflowIndex=0,this.rowHeight=0,this.rowWidth=0,this._isParentRow=!1,this.intendLevel=0,this.pdfTreeGrid=e}return Object.defineProperty(e.prototype,"cells",{get:function(){return t.isNullOrUndefined(this.treegridCells)&&(this.treegridCells=new Vi(this)),this.treegridCells},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isParentRow",{get:function(){return this._isParentRow},set:function(e){this._isParentRow=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"treegrid",{get:function(){return this.pdfTreeGrid},set:function(e){this.pdfTreeGrid=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.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(e.prototype,"rowOverflowIndex",{get:function(){return this.treegridRowOverflowIndex},set:function(e){this.treegridRowOverflowIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"level",{get:function(){return this.intendLevel},set:function(e){this.intendLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.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(e.prototype,"width",{get:function(){return 0===this.rowWidth&&(this.rowWidth=this.measureWidth()),this.rowWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowIndex",{get:function(){return this.treegrid.rows.rowCollection.indexOf(this)},enumerable:!0,configurable:!0}),e.prototype.measureWidth=function(){for(var e=this.treegrid.columns.columns,t=0,i=0;i<e.length;i++){t+=e[i].width}return t},e.prototype.measureHeight=function(){for(var e=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},e}(),Bi=function(){function e(e){this.rows=[],this.treegrid=e}return Object.defineProperty(e.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowCollection",{get:function(){return this.rows},enumerable:!0,configurable:!0}),e.prototype.addRow=function(e){if(void 0===e){var t=new Li(this.treegrid);return this.addRow(t),t}if(0===e.cells.count)for(var i=0;i<this.treegrid.columns.count;i++)e.cells.add(new Ui);this.rows.push(e)},e.prototype.getRow=function(e){return this.rows[e]},e}(),Ai=function(){function e(e){this.rows=[],this.treegrid=e,this.rows=[]}return e.prototype.getHeader=function(e){return this.rows[e]},Object.defineProperty(e.prototype,"count",{get:function(){return this.rows.length},enumerable:!0,configurable:!0}),e.prototype.add=function(e){this.rows.push(e)},e.prototype.indexOf=function(e){return this.rows.indexOf(e)},e}(),Hi=function(){function e(e){this.columnWidth=0,this.treeColumnIndex=!1,this._headerText="",this._field="",this.treegrid=e}return Object.defineProperty(e.prototype,"headerText",{get:function(){return this._headerText},set:function(e){this._headerText=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"field",{get:function(){return this._field},set:function(e){this._field=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.columnWidth},set:function(e){this.columnWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isTreeColumn",{get:function(){return this.treeColumnIndex},set:function(e){this.treeColumnIndex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return null==this.stringFormat&&(this.stringFormat=new g.PdfStringFormat),this.stringFormat},set:function(e){this.stringFormat=e},enumerable:!0,configurable:!0}),e}(),ji=function(){function e(e){this.internalColumns=[],this.columnWidth=0,this.treegrid=e,this.internalColumns=[]}return e.prototype.add=function(e){for(var t=0;t<e;t++){this.internalColumns.push(new Hi(this.treegrid));for(var i=0;i<this.treegrid.rows.count;i++){var r=this.treegrid.rows.getRow(i),a=new Ui;a.value="",r.cells.add(a)}}},Object.defineProperty(e.prototype,"count",{get:function(){return this.internalColumns.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 0===this.columnWidth&&(this.columnWidth=this.measureColumnsWidth()),this.columnWidth},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this.internalColumns},enumerable:!0,configurable:!0}),e.prototype.getColumn=function(e){if(e>=0&&e<=this.columns.length)return this.columns[e];throw Error("can not get the column from the index: "+e)},e.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},e.prototype.getDefaultWidths=function(e){for(var t=[],i=this.count,r=0;r<this.count;r++)t[r]=this.internalColumns[r].width,this.internalColumns[r].width>0?(e-=this.internalColumns[r].width,i--):t[r]=0;for(r=0;r<this.count;r++){var a=e/i;t[r]<=0&&(t[r]=a)}return t},e}(),Wi=function(){function e(e){this.parent=e}return e.prototype.processGridExport=function(e,t,i){this.flatData=e,this.gantt=t,this.exportValueFormatter=new qi(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=P(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.processHeaderContent(),this.processGanttContent(),this.processTimeline(),this.processTaskbar(),this.processPredecessor()},e.prototype.processHeaderContent=function(){var e=this;this.rowIndex++,this.row=this.gantt.rows.addRow();var t=0;this.columns.forEach(function(i){e.isColumnVisible(i)&&(e.processColumnHeader(i,t),t++)})},e.prototype.processColumnHeader=function(e,t){this.gantt.columns.add(1);var i=this.gantt.columns.getColumn(t);this.parent.treeColumnIndex===t&&(i.isTreeColumn=!0);var r=parseInt(e.width,10);i.width=P(r),this.totalColumnWidth+=i.width,i.headerText=e.headerText,i.field=e.field;var a=this.row.cells.getCell(t);a.value=e.headerText,a.isHeaderCell=!0;var n=this.parent.timelineModule.isSingleTier?45:60;this.copyStyles(this.ganttStyle.columnHeader,a,!1),this.row.height=P(n),e.headerTextAlign&&(a.style.format.alignment=g.PdfTextAlignment[e.headerTextAlign]);var s={cell:a,style:a.style,value:a.value,column:e};this.parent.pdfColumnHeaderQueryCellInfo&&this.parent.trigger("pdfColumnHeaderQueryCellInfo",s),a.value=s.value},e.prototype.isColumnVisible=function(e){var i=e.visible||this.exportProps.includeHiddenColumn,r=!!t.isNullOrUndefined(e.template);return i&&r},e.prototype.processGanttContent=function(){var e=this;0===this.flatData.length?this.renderEmptyGantt():this.flatData.forEach(function(t){e.row=e.gantt.rows.addRow(),t.hasChildRecords?(e.gantt.rows.getRow(e.rowIndex).isParentRow=!0,e.processRecordRow(t)):e.processRecordRow(t),e.rowIndex++})},e.prototype.processTimeline=function(){var e=this.parent.timelineModule;this.gantt.chartHeader.topTierHeight=this.gantt.chartHeader.bottomTierHeight=this.parent.timelineModule.isSingleTier?45:30,this.gantt.chartHeader.topTierCellWidth=e.topTierCellWidth,this.gantt.chartHeader.bottomTierCellWidth=e.bottomTierCellWidth,this.gantt.chartHeader.topTier=t.extend([],[],e.topTierCollection,!0),this.gantt.chartHeader.bottomTier=t.extend([],[],e.bottomTierCollection,!0),this.gantt.chartHeader.width=e.totalTimelineWidth,this.gantt.chartHeader.height=this.gantt.rows.getRow(0).height,this.gantt.timelineStartDate=new Date(e.timelineStartDate.getTime())},e.prototype.processPredecessor=function(){var e=this;(t.isNullOrUndefined(this.exportProps.showPredecessorLines)||this.exportProps.showPredecessorLines)&&(this.parent.pdfExportModule.isPdfExport=!0,this.parent.predecessorModule.createConnectorLinesCollection(),this.parent.updatedConnectorLineCollection.forEach(function(t){var i=e.gantt.predecessor.add();i.parentLeft=t.parentLeft,i.childLeft=t.childLeft,i.parentWidth=t.parentWidth,i.childWidth=t.childWidth,i.parentIndex=t.parentIndex,i.childIndex=t.childIndex,i.rowHeight=t.rowHeight,i.type=t.type,i.milestoneParent=t.milestoneParent,i.milestoneChild=t.milestoneChild,i.parentEndPoint=t.parentEndPoint,i.lineWidth=e.parent.connectorLineWidth>5?P(5):P(e.parent.connectorLineWidth),t.isCritical?i.connectorLineColor=e.ganttStyle.criticalConnectorLineColor:i.connectorLineColor=e.ganttStyle.connectorLineColor,i.connectorLineColor=e.ganttStyle.connectorLineColor,e.gantt.predecessorCollection.push(i)}),this.parent.pdfExportModule.isPdfExport=!1)},e.prototype.processRecordRow=function(e){var t=this;this.colIndex=0,this.row.level=e.level,this.columns.forEach(function(i){t.isColumnVisible(i)&&(t.processRecordCell(e,i,t.row),t.colIndex++)})},e.prototype.processRecordCell=function(e,i,r){var a=r.cells.getCell(this.colIndex),n=this.parent.taskFields,s=e.ganttProperties;"datepickeredit"===i.editType||"datetimepickeredit"===i.editType?a.value=e[i.field]:i.field===n.duration?a.value=this.parent.getDurationString(s.duration,s.durationUnit):i.field===n.resourceInfo?a.value=s.resourceNames:i.field===n.work?a.value=this.parent.getWorkString(s.work,s.workUnit):a.value=t.isNullOrUndefined(e[i.field])?"":e[i.field].toString(),a.isHeaderCell=!1,a.style.padding=new Ci,this.copyStyles(this.ganttStyle.cell,a,r.isParentRow),this.colIndex!==this.parent.treeColumnIndex?a.style.format.alignment=g.PdfTextAlignment[i.textAlign]:a.style.format.paragraphIndent=10*a.row.level;var o={data:e,value:a.value,column:i,style:a.style,cell:a};o.value=this.exportValueFormatter.formatCellValue(o),this.parent.pdfQueryCellInfo&&this.parent.trigger("pdfQueryCellInfo",o),a.value=o.value},e.prototype.processTaskbar=function(){var e=this;this.flatData.forEach(function(i){var r=e.gantt.taskbar.add(),a=i.ganttProperties;r.left=a.left,r.width=a.width,r.left<0&&(r.width=r.width+r.left,r.left=0),r.progress=a.progress,r.isScheduledTask=m(a),m?t.isNullOrUndefined(a.endDate)&&t.isNullOrUndefined(a.duration)?r.unscheduledTaskBy="startDate":t.isNullOrUndefined(a.startDate)&&t.isNullOrUndefined(a.duration)?r.unscheduledTaskBy="endDate":(r.unscheduledTaskBy="duration",r.unscheduleStarteDate=e.parent.dateValidationModule.getValidStartDate(i.ganttProperties),r.unscheduleEndDate=e.parent.dateValidationModule.getValidEndDate(i.ganttProperties)):(r.unscheduleStarteDate=null,r.unscheduleEndDate=null),r.startDate=a.startDate,r.endDate=a.endDate,r.height=e.parent.chartRowsModule.taskBarHeight,r.isMilestone=a.isMilestone,r.milestoneColor=new g.PdfColor(e.ganttStyle.taskbar.milestoneColor),r.isParentTask=i.hasChildRecords,a.isMilestone&&(r.height=a.width),i[e.parent.labelSettings.leftLabel]&&(r.leftTaskLabel.value=i[e.parent.labelSettings.leftLabel].toString()),i[e.parent.labelSettings.rightLabel]&&(r.rightTaskLabel.value=i[e.parent.labelSettings.rightLabel].toString()),i[e.parent.labelSettings.taskLabel]&&(r.taskLabel=i[e.parent.labelSettings.taskLabel].toString());var n=a.isMilestone?Math.floor(e.parent.chartRowsModule.taskBarHeight/2)+33:33;r.rightTaskLabel.left=a.left+a.width+n,r.fontFamily=e.ganttStyle.fontFamily,r.progressWidth=a.progressWidth,r.labelColor=new g.PdfColor(e.ganttStyle.label.fontColor),r.progressFontColor=new g.PdfColor(e.ganttStyle.taskbar.progressFontColor),r.isParentTask?(r.taskColor=new g.PdfColor(e.ganttStyle.taskbar.parentTaskColor),r.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.parentTaskBorderColor),r.progressColor=new g.PdfColor(e.ganttStyle.taskbar.parentProgressColor)):i.isCritical?(r.taskColor=new g.PdfColor(e.ganttStyle.taskbar.criticalTaskColor),r.progressColor=new g.PdfColor(e.ganttStyle.taskbar.criticalProgressColor),r.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.criticalTaskBorderColor)):(r.taskColor=new g.PdfColor(e.ganttStyle.taskbar.taskColor),r.progressColor=new g.PdfColor(e.ganttStyle.taskbar.progressColor),r.taskBorderColor=new g.PdfColor(e.ganttStyle.taskbar.taskBorderColor)),r.gridLineColor=new g.PdfColor(e.ganttStyle.chartGridLineColor),e.gantt.taskbarCollection.push(r);var s={};s.progressFontColor=r.progressFontColor,s.taskColor=r.taskColor,s.taskBorderColor=r.taskBorderColor,s.progressColor=r.progressColor,s.milestoneColor=r.milestoneColor;var o={taskbar:s,data:i};e.parent.pdfQueryTaskbarInfo&&(e.parent.trigger("pdfQueryTaskbarInfo",o),r.progressFontColor=o.taskbar.progressFontColor,r.taskColor=o.taskbar.taskColor,r.taskBorderColor=o.taskbar.taskBorderColor,r.progressColor=o.taskbar.progressColor,r.milestoneColor=o.taskbar.milestoneColor)})},e.prototype.getHorizontalAlignment=function(e,t){switch(void 0===t&&(t=new g.PdfStringFormat),e){case"Right":t.alignment=g.PdfTextAlignment.Right;break;case"Center":t.alignment=g.PdfTextAlignment.Center;break;case"Justify":t.alignment=g.PdfTextAlignment.Justify;break;case"Left":t.alignment=g.PdfTextAlignment.Left}return t},e.prototype.getVerticalAlignment=function(e,t,i){switch(void 0===t&&(t=new g.PdfStringFormat,t=this.getHorizontalAlignment(i,t)),e){case"Bottom":t.lineAlignment=g.PdfVerticalAlignment.Bottom;break;case"Middle":t.lineAlignment=g.PdfVerticalAlignment.Middle;break;case"Top":t.lineAlignment=g.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.getFont=function(e){if(e.font)return e.font;var i=t.isNullOrUndefined(e.style.fontSize)?9.75:.75*e.style.fontSize,r=t.isNullOrUndefined(e.style.fontFamily)?g.PdfFontFamily.TimesRoman:this.getFontFamily(e.style.fontFamily),a=g.PdfFontStyle.Regular;return!t.isNullOrUndefined(e.style.bold)&&e.style.bold&&(a|=g.PdfFontStyle.Bold),!t.isNullOrUndefined(e.style.italic)&&e.style.italic&&(a|=g.PdfFontStyle.Italic),!t.isNullOrUndefined(e.style.underline)&&e.style.underline&&(a|=g.PdfFontStyle.Underline),!t.isNullOrUndefined(e.style.strikeout)&&e.style.strikeout&&(a|=g.PdfFontStyle.Strikeout),new g.PdfStandardFont(r,i,a)},e.prototype.renderEmptyGantt=function(){var e=this.gantt.rows.addRow();e.cells.getCell(0).isHeaderCell=!1,e.height=P(this.parent.rowHeight),this.copyStyles(this.ganttStyle.columnHeader,e.cells.getCell(0),e.isParentRow);var t=this.columns.length;this.mergeCells(0,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 g.PdfColor(e.fontColor),t.style.backgroundColor=new g.PdfColor(e.backgroundColor),t.style.borderColor=new g.PdfColor(e.borderColor),t.style.fontSize=e.fontSize,t.style.fontStyle=e.fontStyle,t.style.format=Object.assign(new g.PdfStringFormat,e.format),t.style.borders=new Si,t.style.borders.all=new g.PdfPen(t.style.borderColor),t.style.padding=new Ci;var r=0;r=t.isHeaderCell?this.parent.timelineModule.isSingleTier?22.5:30:this.parent.rowHeight/2,t.style.padding.top=r-e.fontSize,t.style.padding.bottom=r-e.fontSize,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 i=[],r=this.pdfDoc.pageSettings.width-82;if(this.totalColumnWidth>this.pdfDoc.pageSettings.width-82?this.gantt.style.allowHorizontalOverflow=!0:r/this.columns.length<i[0]&&(this.gantt.columns.getColumn(0).width=i[0]),this.exportProps.enableFooter||t.isNullOrUndefined(this.exportProps.enableFooter)){var a=new g.RectangleF(0,0,e.pageSettings.width,35),n=new g.PdfPen(this.ganttStyle.chartGridLineColor),s=new g.PdfPageTemplateElement(a),o=new g.PdfSolidBrush(this.ganttStyle.footer.backgroundColor);s.graphics.drawRectangle(n,o,0,0,e.pageSettings.width,35);var l=new g.PdfStandardFont(this.ganttStyle.fontFamily,this.ganttStyle.footer.fontSize,this.ganttStyle.footer.fontStyle);this.ganttStyle.font&&(l=this.ganttStyle.font);var d=new g.PdfSolidBrush(this.ganttStyle.footer.fontColor),h=new g.PdfPageNumberField(l),p=new g.PdfPageCountField(l,d),c=new g.PdfCompositeField(l,d,"Page {0}",h,p);c.stringFormat=this.ganttStyle.footer.format,c.bounds=a,c.draw(s.graphics,new g.PointF(0,0)),e.template.bottom=s}},e}(),qi=function(){function e(e){this.valueFormatter=new r.ValueFormatter(e),this.internationalization=new t.Internationalization(e)}return e.prototype.returnFormattedValue=function(e,i){return!t.isNullOrUndefined(e.value)&&e.value?this.valueFormatter.getFormatFunction(i)(e.value):""},e.prototype.formatCellValue=function(e){if(e.isForeignKey&&(e.value=t.getValue(e.column.foreignKeyValue,r.getForeignData(e.column,{},e.value)[0])),"number"===e.column.type&&void 0!==e.column.format&&""!==e.column.format)return e.value?this.internationalization.getNumberFormat({format:e.column.format})(e.value):"";if("boolean"===e.column.type)return e.value?"true":"false";if("date"!==e.column.type&&"datetime"!==e.column.type&&"time"!==e.column.type||void 0===e.column.format)return(t.isNullOrUndefined(e.column.type)||t.isNullOrUndefined(e.value))&&t.isNullOrUndefined(e.value)?"":e.value.toString();if("string"==typeof e.value&&(e.value=new Date(e.value)),"string"==typeof e.column.format){var i=void 0;return 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)}if(e.column.format instanceof Object&&void 0===e.column.format.type)return e.value.toString();var a=void 0;return a="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,a)},e}(),Gi=function(){return(Gi=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},zi=function(){function e(e){this.leftTaskLabel={},this.rightTaskLabel={},this.startPage=-1,this.endPage=-1,this.parent=e}return e.prototype.add=function(){return new e(this.parent)},e.prototype.GetNextPage=function(e){var t=e.section,i=t.indexOf(e);return i===t.count-1?t.add():t.getPages()[i+1]},e.prototype.drawTaskbar=function(e,i,r,a,n,s){var o=e.graphics,l=!1,d=e.getClientSize();i.y+n>d.height&&(o=(e=this.GetNextPage(e)).graphics,i.y=0,this.parent.pdfExportModule.gantt.enableHeader&&(this.parent.pdfExportModule.gantt.chartHeader.drawPageTimeline(e,i,r),i.y=P(this.parent.timelineModule.isSingleTier?45:60)),l=!0),this.drawLeftLabel(e,i,r,a);var h=new g.PdfStandardFont(this.fontFamily,9,g.PdfFontStyle.Regular);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(h=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var p=new g.PdfSolidBrush(this.progressFontColor),c=new g.PdfStringFormat;c.lineAlignment=g.PdfVerticalAlignment.Middle,c.alignment=g.PdfTextAlignment.Right;var u,f=!1;/^[a-zA-Z]/.test(this.taskLabel)&&(f=!0,c.alignment=g.PdfTextAlignment.Left);var m=-1;if(s.isMilestone)this.drawMilestone(e,i,r,a);else{var y=new g.PdfPen(s.taskBorderColor),D=new g.PdfSolidBrush(s.taskColor),v=new g.PdfPen(s.progressColor),w=new g.PdfSolidBrush(s.progressColor),k=P((this.parent.rowHeight-this.height)/2);m=e.section.indexOf(e);var T=t.isNullOrUndefined(this.unscheduleStarteDate)?this.startDate:this.unscheduleStarteDate,b=t.isNullOrUndefined(this.unscheduleEndDate)?this.endDate:this.unscheduleEndDate;if(r.startDate<=T&&b<=r.endDate)this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0),this.isScheduledTask||"duration"===this.unscheduledTaskBy?(o.drawRectangle(y,D,i.x+P(this.left-a)+.5,i.y+k,P(s.width),P(s.height)),this.isScheduledTask&&(o.drawRectangle(v,w,i.x+P(this.left-a)+.5,i.y+k,P(s.progressWidth),P(s.height)),t.isNullOrUndefined(this.parent.labelSettings.taskLabel)||t.isNullOrUndefined(this.taskLabel)||(u=this.progressWidth,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left-a),i.y+k,P(u),P(this.height),c)))):this.drawUnscheduledTask(o,i,a,k),this.isCompleted=!0,this.startPage=m,this.endPage=m;else if(r.startDate<=T&&r.endDate>=T&&b>=r.endDate){this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0);var S=0;if(f||(this.width=this.width-(r.totalWidth-(this.left-a))),S=r.totalWidth-(this.left-a),this.isScheduledTask||"duration"===this.unscheduledTaskBy){if(o.drawRectangle(y,D,i.x+P(this.left-a)+.5,i.y+k,P(S),P(s.height)),s.width=s.width-S,this.isScheduledTask){var C=0;C=this.progressWidth<=S?this.progressWidth:S,o.drawRectangle(v,w,i.x+P(this.left-a)+.5,i.y+k,P(C),P(s.height)),this.progressWidth-=C,this.parent.labelSettings.taskLabel&&!t.isNullOrUndefined(this.taskLabel)&&(u=C,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left-a),i.y+k,P(u),P(this.height),c))}}else this.drawUnscheduledTask(o,i,a,k);this.left=0,this.isCompleted=!1,this.startPage=m}else if(b<=r.endDate&&r.startDate<=b&&!this.isCompleted)this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0),o.drawRectangle(y,D,i.x+P(s.left+.5),i.y+k,P(s.width),P(s.height)),this.isScheduledTask&&(o.drawRectangle(v,w,i.x+P(s.left+.5),i.y+k,P(s.progressWidth),P(s.height)),t.isNullOrUndefined(this.taskLabel)||(u=this.progressWidth,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left),i.y+k,P(u),P(this.height),c))),this.isCompleted=!0,this.endPage=m;else if(T<r.startDate&&b>r.endDate){if(this.isStartPoint||(this.taskStartPoint=Gi({},i),this.isStartPoint=!0),o.drawRectangle(y,D,i.x+P(s.left)+.5,i.y+k,P(r.totalWidth),P(s.height)),this.isScheduledTask){C=0;C=this.progressWidth<=r.totalWidth?this.progressWidth:r.totalWidth,o.drawRectangle(v,w,i.x+P(s.left)+.5,i.y+k,P(C),P(s.height)),this.progressWidth-=C,t.isNullOrUndefined(this.taskLabel)||(u=C,f&&(u=this.width),o.drawString(this.taskLabel.toString(),h,null,p,i.x+P(this.left),i.y+k,P(u),P(this.height),c))}this.isCompleted=!1,this.width-=r.totalWidth}}return this.drawRightLabel(e,i,r,a),l},e.prototype.drawRightLabel=function(e,i,r,a){var n,s=e.graphics,o=(n=this.rightTaskLabel.isLeftCalculated?this.rightTaskLabel.left:P(this.rightTaskLabel.left))-P(a)+i.x;if(r.startPoint<=n&&n<r.endPoint&&!t.isNullOrUndefined(this.rightTaskLabel.value)&&!this.rightTaskLabel.isCompleted){var l=this.getWidth(this.rightTaskLabel.value,r.endPoint-n,15),d=new g.PdfStandardFont(this.fontFamily,9);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(d=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var h=(P(this.parent.rowHeight)-l.actualSize.height)/2,p=new g.PointF(o,i.y+h),c=new g.SizeF(l.actualSize.width,l.actualSize.height),u=new g.RectangleF(p,c),f=new g.PdfStringFormat;if(f.alignment=g.PdfTextAlignment.Right,f.lineAlignment=g.PdfVerticalAlignment.Middle,l.actualSize.width>0){var m=new g.PdfSolidBrush(this.labelColor);s.drawString(l.lines[0].text,d,null,m,u.x,u.y,l.actualSize.width,l.actualSize.height,f),null!==l.remainder?(this.rightTaskLabel.value=l.remainder,this.rightTaskLabel.left=r.endPoint,this.rightTaskLabel.isLeftCalculated=!0):this.rightTaskLabel.isCompleted=!0}else this.rightTaskLabel.left=r.endPoint}},e.prototype.drawLeftLabel=function(e,i,r,a){var n,s=e.graphics;if(!t.isNullOrUndefined(this.leftTaskLabel.value)){var o=0;if(o=this.left,this.leftTaskLabel.isLeftCalculated)n=this.leftTaskLabel.left;else{var l=this.getWidth(this.leftTaskLabel.value,Number.MAX_VALUE,15);n=P(o-(this.isMilestone?Math.floor(this.parent.chartRowsModule.taskBarHeight/2)+33:33))-l.actualSize.width,this.leftTaskLabel.left=n,this.leftTaskLabel.isLeftCalculated=!0}var d=n-P(a)+i.x;if(r.startPoint<=n&&n<r.endPoint&&!t.isNullOrUndefined(this.leftTaskLabel.value)&&!this.leftTaskLabel.isCompleted){l=this.getWidth(this.leftTaskLabel.value,r.endPoint-n,15);var h=new g.PdfStandardFont(this.fontFamily,9);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(h=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var p=(P(this.parent.rowHeight)-l.actualSize.height)/2,c=new g.PointF(d,i.y+p),u=new g.SizeF(l.actualSize.width,l.actualSize.height),f=new g.RectangleF(c,u),m=new g.PdfStringFormat;if(m.alignment=g.PdfTextAlignment.Right,m.lineAlignment=g.PdfVerticalAlignment.Middle,l.actualSize.width>0){var y=new g.PdfSolidBrush(this.labelColor);s.drawString(l.lines[0].text,h,null,y,f.x,f.y,l.actualSize.width,l.actualSize.height,m),null!==l.remainder?(this.leftTaskLabel.value=l.remainder,this.leftTaskLabel.left=r.endPoint):this.leftTaskLabel.isCompleted=!0}else this.leftTaskLabel.left=r.endPoint}}},e.prototype.getWidth=function(e,i,r){var a=new g.PdfStandardFont(this.fontFamily,9);!t.isNullOrUndefined(this.parent.pdfExportModule.helper.exportProps.ganttStyle)&&this.parent.pdfExportModule.helper.exportProps.ganttStyle.font&&(a=this.parent.pdfExportModule.helper.exportProps.ganttStyle.font);var n=new g.PdfStringLayouter,s=new g.PdfStringFormat;s.alignment=g.PdfTextAlignment.Left,s.wordWrap=g.PdfWordWrapType.Character,s.lineAlignment=g.PdfVerticalAlignment.Middle;return n.layout(e,a,s,new g.SizeF(i,r),!1,new g.SizeF(i,r))},e.prototype.drawUnscheduledTask=function(e,t,i,r){var a=new g.PdfSolidBrush(this.taskColor);e.drawRectangle(a,t.x+P(this.left-i),t.y+r,P(3),P(this.height))},e.prototype.drawMilestone=function(e,t,i,r){if(i.startDate<=this.startDate&&this.startDate<=i.endDate){var a=e.graphics,n=e.section.indexOf(e);this.taskStartPoint=Gi({},t);var s=new g.PdfPen(this.milestoneColor),o=P((this.parent.rowHeight-this.height)/2),l=new g.PdfSolidBrush(this.milestoneColor);a.save();var d=Math.floor(.6*this.parent.chartRowsModule.taskBarHeight);a.translateTransform(t.x+P(this.left-r),t.y+o-.7*this.parent.chartRowsModule.taskBarHeight/2),a.rotateTransform(45),a.drawRectangle(s,l,0,0,P(d),P(d)),a.restore(),this.endPage=this.startPage=n}},e}(),_i=function(){function e(e){this.width=0,this.gantt=e,this.parent=e.parent,this.topTierPoint=new g.PointF,this.bottomTierPoint=new g.PointF,this.topTierIndex=0,this.bottomTierIndex=0,this.prevTopTierIndex=0,this.prevBottomTierIndex=0}return e.prototype.drawTimeline=function(e,t,i){var r=Math.floor(i.totalWidth),a=0;for(this.topTierPoint.x=t.x,this.topTierPoint.y=t.y,this.prevTopTierIndex=this.topTierIndex,this.prevBottomTierIndex=this.bottomTierIndex;r>0;){var n=this.topTier[this.topTierIndex];if(this.topTier.length>this.topTierIndex){var s=!1;this.topTier[this.topTierIndex].isFinished||(r>=n.width?(a=n.width,n.isFinished=!0,n.completedWidth=a,s=!0):(a=r,s=!1,n.isFinished=!1,n.width=n.width-r,n.completedWidth=a)),this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,a,n.value,!0),this.topTierPoint.x+=P(a),r-=a,s&&this.topTierIndex++}else r=0}r=Math.floor(i.totalWidth);var o=this.parent.timelineModule.isSingleTier?0:this.topTierHeight;for(this.bottomTierPoint=new g.PointF(t.x,P(t.y+o));r>0;){var l=this.bottomTier[this.bottomTierIndex];if(this.bottomTier.length>this.bottomTierIndex){s=!0;var d=l.width;r<d&&(d=r,s=!1,l.completedWidth=d),this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,d,l.value,!1),this.bottomTierPoint.x=this.bottomTierPoint.x+P(d),r-=d,l.completedWidth=d,s&&this.bottomTierIndex++}else r=0}},e.prototype.drawPageTimeline=function(e,i,r){this.topTierPoint=t.extend({},{},i,!0);for(var a=this.prevTopTierIndex;a<=this.topTierIndex;a++)if(this.topTier.length>a){var n=this.topTier[a];n.completedWidth>0&&(this.triggerQueryTimelinecell(e,this.topTierPoint.x,this.topTierPoint.y,this.topTierHeight,n.completedWidth,n.value,!0),this.topTierPoint.x+=P(n.completedWidth))}this.bottomTierPoint.x=i.x,this.bottomTierPoint.y=P(i.y+this.topTierHeight);for(a=this.prevBottomTierIndex;a<=this.bottomTierIndex;a++)if(this.bottomTier.length>a){var s=this.bottomTier[a];s.completedWidth>0&&(this.triggerQueryTimelinecell(e,this.bottomTierPoint.x,this.bottomTierPoint.y,this.bottomTierHeight,s.width,s.value,!1),this.bottomTierPoint.x=this.bottomTierPoint.x+P(s.width))}},e.prototype.triggerQueryTimelinecell=function(e,i,r,a,n,s,o){var l=e.graphics,d={},h=this.gantt.ganttStyle;d.borderColor=new g.PdfColor(h.timeline.borderColor),d.fontColor=new g.PdfColor(h.timeline.fontColor),d.fontSize=h.timeline.fontSize,d.fontStyle=h.timeline.fontStyle,d.backgroundColor=new g.PdfColor(h.timeline.backgroundColor),h.timeline.padding&&(d.padding=h.timeline.padding);var p=new g.PdfStringFormat;t.isNullOrUndefined(h.timeline.format)?o?(p.lineAlignment=g.PdfVerticalAlignment.Middle,p.alignment=g.PdfTextAlignment.Left):(p.lineAlignment=g.PdfVerticalAlignment.Middle,p.alignment=g.PdfTextAlignment.Center,p.wordWrap=g.PdfWordWrapType.Character):p=h.timeline.format,d.format=p;var c={timelineCell:d,value:s};this.parent.pdfQueryTimelineCellInfo&&this.parent.trigger("pdfQueryTimelineCellInfo",c);var u=c.timelineCell,f=new g.PdfPen(c.timelineCell.borderColor),m=new g.PdfSolidBrush(c.timelineCell.backgroundColor);l.drawRectangle(f,m,i,r,P(n),P(a));var y=new g.PdfStandardFont(h.fontFamily,u.fontSize,u.fontStyle);h.font&&(y=h.font);var D=new g.PdfSolidBrush(c.timelineCell.fontColor),v=h.timeline.padding?c.timelineCell.padding.left:0,w=h.timeline.padding?c.timelineCell.padding.top:0;l.drawString(c.value,y,null,D,i+v,r+w,P(n),P(a),u.format)},e}(),Xi=function(){return(Xi=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},Yi=function(){function e(e,t){this.parent=e,this.pdfGantt=t}return e.prototype.add=function(){return new e(this.parent)},e.prototype.findindex=function(e){var t;return this.parent.currentViewData.map(function(i,r){i.index==e&&(t=r)}),t},e.prototype.drawPredecessor=function(e){this.pdfGantt=e;var t,i,r=e.result.page.section.getPages(),a=e.taskbarCollection[this.findindex(this.parentIndex)],n=e.taskbarCollection[this.findindex(this.childIndex)],s=new g.PdfPage,o=new g.PdfPage,l="",d=0,h=0;switch(this.type){case"FS":if(!(n.startPage>-1&&a.endPage>-1))return;s=r[a.endPage],o=r[n.startPage],t=e.pdfPageDetail[a.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.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(!(n.endPage>-1&&a.startPage>-1))return;s=r[a.startPage],o=r[n.endPage],t=e.pdfPageDetail[a.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.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(!(n.endPage>-1&&a.endPage>-1))return;s=r[a.endPage],o=r[n.endPage],t=e.pdfPageDetail[a.endPage-e.chartPageIndex],i=e.pdfPageDetail[n.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(!(n.startPage>-1&&a.startPage>-1))return;s=r[a.startPage],o=r[n.startPage],t=e.pdfPageDetail[a.startPage-e.chartPageIndex],i=e.pdfPageDetail[n.startPage-e.chartPageIndex],l=this.parentIndex<this.childIndex?this.parentLeft>=this.childLeft?"SSType1":"SSType2":this.parentLeft>=this.childLeft?"SSType3":"SSType4"}var p=Math.round((this.parent.rowHeight-1)/2);p=P(p);var c,u,f,m,y,D;c=u=f=m=y=D=new g.PointF;var v=Xi({},a.taskStartPoint),w=Xi({},n.taskStartPoint);d=v.y+t.startPoint.y,h=w.y+i.startPoint.y;var k=new g.PointF(P(this.parentLeft+this.parentWidth),d+p),T=new g.PointF(P(this.parentLeft)-1,d+p),b=new g.PointF(P(this.childLeft-20),h+p),S=new g.PointF(P(this.childLeft-6-this.lineWidth)-1,h+p),C=new g.PointF(P(this.childLeft+this.childWidth+6+this.lineWidth)+1,h+p);switch(l){case"FSType1":case"FSType3":c=k,u=new g.PointF(P(this.childLeft-20),d+p),f=b,m=S,this.connectLines(s,o,c,u,f,m,n,p);break;case"FSType2":c=k,u=new g.PointF(c.x+10,d+p),f=new g.PointF(c.x+10,h+2),m=new g.PointF(P(this.childLeft-20),h+2),y=b,D=S,this.connectLines(s,o,c,u,f,m,n,p,y,D);break;case"FSType4":c=k,u=new g.PointF(c.x+10,d+p),f=new g.PointF(c.x+10,d+2),m=new g.PointF(P(this.childLeft-20),d+2),y=b,D=S,this.connectLines(s,o,c,u,f,m,n,p,y,D);break;case"FFType1":case"FFType3":c=new g.PointF(P(this.parentLeft+this.parentWidth)+1,d+p),u=new g.PointF(P(this.childLeft+this.childWidth+20),d+p),f=new g.PointF(u.x,h+p),m=C,this.connectLines(s,o,c,u,f,m,n,p);break;case"FFType2":case"FFType4":c=new g.PointF(P(this.parentLeft+this.parentWidth)+1,d+p),u=new g.PointF(P(this.parentLeft+this.parentWidth+20),d+p),f=new g.PointF(u.x,h+p),m=C,this.connectLines(s,o,c,u,f,m,n,p);break;case"SSType1":case"SSType3":c=T,u=new g.PointF(P(this.childLeft-20),d+p),f=new g.PointF(u.x,h+p),m=S,this.connectLines(s,o,c,u,f,m,n,p);break;case"SSType2":case"SSType4":c=T,u=new g.PointF(P(this.parentLeft-20),d+p),f=new g.PointF(u.x,h+p),m=S,this.connectLines(s,o,c,u,f,m,n,p);break;case"SFType1":case"SFType3":c=T,u=new g.PointF(P(this.childLeft+this.childWidth+20),d+p),f=new g.PointF(u.x,h+p),m=C,this.connectLines(s,o,c,u,f,m,n,p);break;case"SFType2":c=T,u=new g.PointF(P(this.parentLeft-20),d+p),f=new g.PointF(u.x,h+2),m=new g.PointF(P(this.childLeft+this.childWidth+20),h+2),y=new g.PointF(m.x,h+p),D=C,this.connectLines(s,o,c,u,f,m,n,p,y,D);break;case"SFType4":c=T,u=new g.PointF(P(this.parentLeft-20),d+p),f=new g.PointF(u.x,d+2),m=new g.PointF(P(this.childLeft+this.childWidth+20),d+2),y=new g.PointF(m.x,h+p),D=C,this.connectLines(s,o,c,u,f,m,n,p,y,D)}},e.prototype.connectLines=function(e,i,r,a,n,s,o,l,d,h){this.drawLine(e,r,a),this.drawLine(e,a,n),this.drawLine(e,n,s),t.isNullOrUndefined(d)||t.isNullOrUndefined(h)||(this.drawLine(e,s,d),this.drawLine(e,d,h)),this.drawArrow(i,o,l)},e.prototype.contains=function(e,t,i){return e.x<=t&&t<e.x+e.width&&e.y<=i&&i<e.y+e.height},e.prototype.findPageIndex=function(e){for(var t=-1,i=0;i<this.pdfGantt.pdfPageDetail.length;i++){var r=this.pdfGantt.pdfPageDetail[i],a=new g.RectangleF(r.startPoint.x,r.startPoint.y,r.width,r.height);if(this.contains(a,e.x,e.y)){t=i;break}}return t},e.prototype.drawLine=function(e,t,i){var r=this.pdfGantt.result.page.section.getPages(),a=e.graphics,n=Xi({},i),s=Xi({},i),o=Xi({},i),l=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],d=new g.RectangleF(l.startPoint.x,l.startPoint.y,l.width,l.height),h=this.contains(d,t.x,t.y),p=this.contains(d,i.x,i.y),c=-1;if(t=new g.PointF(t.x,t.y),i=new g.PointF(i.x,i.y),!h&&!p||p&&!h)(c=this.findPageIndex(t))>-1&&(l=this.pdfGantt.pdfPageDetail[c],s=t,n=i,this.drawLine(r[c+this.pdfGantt.chartPageIndex],s,n));else if(!p&&h){var u=d.x,f=d.x+d.width,m=d.y+d.height,y=d.y;u>i.x?(o.x=i.x=u-1,s.x=u-1):f<i.x?(o.x=i.x=f,s.x=f,o.x+=1):m<i.y?(o.y=i.y=m,s.y=m,o.y+=1,this.pdfGantt.enableHeader&&(s.y+=this.parent.timelineModule.isSingleTier?P(45):P(62))):y>i.y&&(s.y=o.y=y-1,i.y=y,this.pdfGantt.enableHeader&&(o.y+=this.parent.timelineModule.isSingleTier?P(45):P(62),i.y+=this.parent.timelineModule.isSingleTier?P(45):P(62))),-1!==(c=this.findPageIndex(o))&&this.drawLine(r[c+this.pdfGantt.chartPageIndex],s,n)}if(h){t=new g.PointF(t.x,t.y),i=new g.PointF(i.x,i.y),t.x=t.x+l.pageStartX-l.startPoint.x,t.y=t.y-l.startPoint.y,i.x=i.x+l.pageStartX-l.startPoint.x,i.y=i.y-l.startPoint.y;var D=new g.PdfSolidBrush(this.connectorLineColor),v=new g.PdfPen(D,P(this.lineWidth));a.drawLine(v,t,i)}},e.prototype.drawArrow=function(e,t,i){var r,a=this.pdfGantt.pdfPageDetail[e.section.indexOf(e)-this.pdfGantt.chartPageIndex],n=new g.RectangleF(new g.PointF(a.startPoint.x,a.startPoint.y),new g.SizeF(a.width,a.height)),s=new g.PointF,o=e.section.getPages(),l=6+this.lineWidth;s="FS"===this.type||"SS"===this.type?new g.PointF(P(this.childLeft)-1,t.taskStartPoint.y+a.startPoint.y):new g.PointF(P(this.childLeft+this.childWidth)+1,t.taskStartPoint.y+a.startPoint.y);if(!this.contains(n,s.x,s.y)){var d=this.findPageIndex(s);d>-1&&(a=this.pdfGantt.pdfPageDetail[d],e=o[d+this.pdfGantt.chartPageIndex])}var h=e.graphics;s.x=s.x-a.startPoint.x+a.pageStartX,s.y=s.y-a.startPoint.y;var p=new g.PointF(s.x,s.y+i);r="FS"===this.type||"SS"===this.type?new g.PointF(p.x-P(l),p.y-P(l)):new g.PointF(p.x+P(l),p.y-P(l));var c=new g.PointF(r.x,r.y+P(2*l)),u=new g.PdfSolidBrush(this.connectorLineColor),f=new g.PdfPen(u,P(this.lineWidth));h.drawLine(f,p,r),h.drawLine(f,r,c),h.drawLine(f,c,p)},e}(),Zi=function(){var e=function(t,i){return(e=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])})(t,i)};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),Qi=function(){return(Qi=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)},Ki=function(e){function i(t){var i=e.call(this)||this;return i.exportProps={},i.parent=t,i.chartHeader=new _i(i),i.predecessor=new Yi(t,i),i.headerDetails=[],i.pdfPageDetail=[],i.taskbarCollection=[],i.predecessorCollection=[],i}return Zi(i,e),Object.defineProperty(i.prototype,"taskbar",{get:function(){return t.isNullOrUndefined(this.taskbars)&&(this.taskbars=new zi(this.parent)),this.taskbars},enumerable:!0,configurable:!0}),i.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()},i.prototype.calculateRange=function(){for(var e=this.layouter.columnRanges[this.layouter.columnRanges.length-1],i=0,r=!0,a=0,n=0,s=0,o=P(this.chartHeader.width),l=this.parent.timelineModule,d=e[0];d<=e[1];d++)i+=this.layouter.treegrid.columns.getColumn(d).width;for((i+=.5)+100<this.result.page.getClientSize().width?(n=this.result.page.getClientSize().width-i,this.chartPageIndex=this.startPageIndex=this.totalPages-this.perColumnPages,r=!1,this.startPoint=new g.PointF(i,0)):(this.result.page.section.add(),this.chartPageIndex=this.startPageIndex=this.totalPages,r=!0,this.startPoint=new g.PointF(s,0));Math.round(s)<Math.round(o);){r?a=this.result.page.getClientSize().width:(a=n,r=!0);var h={},p=[],c=P(this.chartHeader.bottomTierCellWidth),u=0;0!==this.chartHeader.bottomTierCellWidth&&(u=Math.floor(a/c)*c),p[0]=s,o-s<=u?(p[1]=o,h.totalWidth=S(o-s)):(p[1]=s+u,h.totalWidth=S(u)),h.startPoint=p[0],h.endPoint=p[1],0===this.parent.cloneProjectStartDate.getHours()&&0===this.parent.cloneProjectStartDate.getMinutes()&&0===this.parent.cloneProjectStartDate.getSeconds()&&this.parent.cloneProjectStartDate.setHours(8);var f=this.parent.dataOperation.getDateFromFormat(this.parent.timelineModule.timelineStartDate),m=t.isNullOrUndefined(l.customTimelineSettings.bottomTier.count)?l.customTimelineSettings.topTier.count:l.customTimelineSettings.bottomTier.count;switch("None"===l.customTimelineSettings.bottomTier.unit?l.customTimelineSettings.topTier.unit:l.customTimelineSettings.bottomTier.unit){case"Minutes":h.startDate=new Date(f.getTime());var y=Math.floor(S(h.startPoint)/this.chartHeader.bottomTierCellWidth);h.startDate.setMinutes(h.startDate.getMinutes()+y*m),h.startDate.setSeconds(h.startDate.getSeconds()+1),h.endDate=new Date(h.startDate.getTime());var D=Math.floor(S(h.endPoint-h.startPoint)/this.chartHeader.bottomTierCellWidth);h.endDate.setMinutes(h.endDate.getMinutes()+D*m);break;case"Hour":h.startDate=new Date(f.getTime());var v=Math.floor(S(h.startPoint)/this.chartHeader.bottomTierCellWidth);h.startDate.setHours(h.startDate.getHours()+v*m),h.startDate.setMinutes(h.startDate.getMinutes()+1),h.endDate=new Date(h.startDate.getTime());var w=Math.floor(S(h.endPoint-h.startPoint)/this.chartHeader.bottomTierCellWidth);h.endDate.setHours(h.endDate.getHours()+w*m);break;case"Day":h.startDate=new Date(f.getTime());var k=Math.round(h.startPoint/P(this.chartHeader.bottomTierCellWidth));h.startDate.setDate(h.startDate.getDate()+k*m);var T=Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+T*m);break;case"Week":h.startDate=new Date(f.getTime());var b=h.startPoint/P(this.chartHeader.bottomTierCellWidth)*7;h.startDate.setDate(h.startDate.getDate()+b*m);var C=7*Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+C*m);break;case"Month":h.startDate=new Date(f.getTime());var M=h.startPoint/P(this.chartHeader.bottomTierCellWidth)*31;h.startDate.setDate(h.startDate.getDate()+M*m);var R=31*Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+R*m);break;case"Year":h.startDate=new Date(f.getTime());var O=h.startPoint/P(this.chartHeader.bottomTierCellWidth)*365;h.startDate.setDate(h.startDate.getDate()+O*m);var x=365*Math.round((h.endPoint-h.startPoint)/P(this.chartHeader.bottomTierCellWidth))-1;h.endDate=new Date(h.startDate.getTime()),h.endDate.setDate(h.startDate.getDate()+x*m)}this.headerDetails.push(h),s+=u}},i.prototype.drawPageBorder=function(){for(var e=this.result.page.section.getPages(),t=0;t<e.length;t++){var i=e[t],r=i.graphics,a=i.getClientSize(),n=new g.PdfPen(new g.PdfColor(206,206,206));r.drawRectangle(n,0,0,a.width,a.height)}},i.prototype.drawGantttChart=function(){var e,t=this,i=this.startPoint,r=new g.PointF,a=0,n=0,s=0;this.headerDetails.forEach(function(o,l){var d=t.result.page.section.getPages()[t.startPageIndex];t.chartHeader.drawTimeline(d,t.startPoint,o),i.y=i.y+P(t.parent.timelineModule.isSingleTier?45:60),a=i.x,s=P(t.parent.timelineModule.isSingleTier?45:60),t.headerDetails[t.headerDetails.indexOf(o)].startIndex=t.startPageIndex,t.headerDetails[t.headerDetails.indexOf(o)].pageStartPoint=i;for(var h=0;h<t.taskbarCollection.length;h++){var p=t.taskbarCollection[h],c=t.rows.getRow(h+1).height,u=t.result.page.section.getPages()[t.startPageIndex];p.drawTaskbar(u,i,o,n,c,t.taskbarCollection[h])&&(t.enableHeader?i.y=P(t.parent.timelineModule.isSingleTier?45:60):i.y=0,t.startPageIndex++,(e={}).height=s,e.pageStartX=a,e.startPoint=Qi({},r),e.width=P(o.totalWidth),t.pdfPageDetail.push(e),r.y+=e.height,t.enableHeader?s=t.chartHeader.height:(i.y=0,s=0)),i.y+=c,s+=c}t.headerDetails[l].endIndex=t.startPageIndex,n+=o.totalWidth,(e={}).height=s,e.pageStartX=a,e.startPoint=Qi({},r),e.width=P(o.totalWidth),t.pdfPageDetail.push(e),r.x+=e.width,r.y=0,t.enableHeader?s=t.chartHeader.height:i.y=0,t.headerDetails.indexOf(o)!==t.headerDetails.length-1&&(t.result.page.section.add(),t.startPageIndex=t.result.page.section.count-1,i=t.startPoint=new g.PointF(0,0))});for(var o=0;o<this.predecessorCollection.length;o++){this.predecessorCollection[o].drawPredecessor(this)}},i}(Fi),Ji=function(){function e(e){this.isPdfExport=!1,this.parent=e,this.helper=new Wi(this.parent),this.pdfDocument=void 0}return e.prototype.getModuleName=function(){return"pdfExport"},e.prototype.destroy=function(){},e.prototype.initGantt=function(){this.pdfDocument=void 0,this.gantt=new Ki(this.parent)},e.prototype.export=function(e,i,r,a){var n=this;this.isBlob=a;var s={requestType:"beforePdfExport",ganttObject:this.parent,cancel:!1};return this.parent.trigger("beforePdfExport",s),t.isNullOrUndefined(this.parent.loadingIndicator)||"Shimmer"!==this.parent.loadingIndicator.indicatorType?this.parent.showSpinner():this.parent.showMaskRow(),t.getValue("cancel",s)?new Promise(function(e,t){return e()}):new Promise(function(t,a){n.exportWithData(r,t,e,i)})},e.prototype.exportWithData=function(e,i,r,a){var n=this,s=[];t.isNullOrUndefined(r)&&(r={}),s="CurrentViewData"===r.exportType?this.parent.currentViewData:this.parent.flatData,this.initGantt(),t.isNullOrUndefined(e)?this.pdfDocument=new g.PdfDocument:this.pdfDocument=e,this.processExport(s,r,a).then(function(){n.parent.trigger("pdfExportComplete",n.isBlob?{promise:n.blobPromise}:{}),t.isNullOrUndefined(n.parent.loadingIndicator)||"Shimmer"!==n.parent.loadingIndicator.indicatorType?n.parent.hideSpinner():n.parent.hideMaskRow(),i(n.pdfDocument)})},e.prototype.processExport=function(e,i,r){var a=this,n=this.pdfDocument.sections.add();this.processSectionExportProperties(n,i);var s=n.pages.add();return new Promise(function(t,r){a.helper.processGridExport(e,a.gantt,i),a.helper.initializePdf(a.pdfDocument),t()}).then(function(){var e=new Ei;e.break=g.PdfLayoutBreakType.FitElement;var n=a.gantt.drawGrid(s,0,0,e);return a.gantt.drawChart(n),r||(a.isBlob?a.blobPromise=a.pdfDocument.save():!t.isNullOrUndefined(i)&&i.fileName?a.pdfDocument.save(i.fileName):a.pdfDocument.save("Export.pdf"),a.pdfDocument.destroy()),a.pdfDocument})},e.prototype.processSectionExportProperties=function(e,i){if(t.isNullOrUndefined(i))this.gantt.ganttStyle=new bi(i.theme).style;else{var r=new g.PdfPageSettings;if(t.isNullOrUndefined(i.pageOrientation)||"Portrait"!==i.pageOrientation?r.orientation=g.PdfPageOrientation.Landscape:r.orientation=g.PdfPageOrientation.Portrait,t.isNullOrUndefined(i.pageSize)||(r.size=this.getPageSize(i.pageSize)),e.setPageSettings(r),t.isNullOrUndefined(i.ganttStyle))this.gantt.ganttStyle=new bi(i.theme).style;else{var a=new bi(i.theme).style;this.gantt.ganttStyle=t.extend({},a,i.ganttStyle,!0)}}},e.prototype.getPageSize=function(e){switch(e){case"Letter":return new g.SizeF(612,792);case"Note":return new g.SizeF(540,720);case"Legal":return new g.SizeF(612,1008);case"A0":return new g.SizeF(2380,3368);case"A1":return new g.SizeF(1684,2380);case"A2":return new g.SizeF(1190,1684);case"A3":return new g.SizeF(842,1190);case"A5":return new g.SizeF(421,595);case"A6":return new g.SizeF(297,421);case"A7":return new g.SizeF(210,297);case"A8":return new g.SizeF(148,210);case"A9":return new g.SizeF(105,148);case"B0":return new g.SizeF(2836,4008);case"B1":return new g.SizeF(2004,2836);case"B2":return new g.SizeF(1418,2004);case"B3":return new g.SizeF(1002,1418);case"B4":return new g.SizeF(709,1002);case"B5":return new g.SizeF(501,709);case"Archa":return new g.SizeF(648,864);case"Archb":return new g.SizeF(864,1296);case"Archc":return new g.SizeF(1296,1728);case"Archd":return new g.SizeF(1728,2592);case"Arche":return new g.SizeF(2592,3456);case"Flsa":return new g.SizeF(612,936);case"HalfLetter":return new g.SizeF(396,612);case"Letter11x17":return new g.SizeF(792,1224);case"Ledger":return new g.SizeF(1224,792);default:return new g.SizeF(595,842)}},e}(),$i=function(){function e(e){this.parent=e,this.bindTreeGridProperties()}return e.prototype.getModuleName=function(){return"virtualScroll"},e.prototype.bindTreeGridProperties=function(){this.parent.treeGrid.enableVirtualization=this.parent.enableVirtualization,n.TreeGrid.Inject(n.VirtualScroll)},e.prototype.getTopPosition=function(){var e,t=this.parent.ganttChartModule.scrollElement.querySelector(".e-virtualtable"),i=t.style.transform.split(",");if(i.length>1)e=i[1].trim().split(")")[0];else{var r=t.style.transform;e=r.substring(r.lastIndexOf("(")+1,r.lastIndexOf(")"))}return parseFloat(e)},e.prototype.destroy=function(){},e}();e.Gantt=ei,e.parentsUntil=f,e.isScheduledTask=m,e.isCountRequired=y,e.getSwapKey=D,e.isRemoteData=v,e.getTaskData=w,e.updateDates=k,e.formatString=T,e.getIndex=b,e.pixelToPoint=P,e.pointToPixel=S,e.getUid=C,e.load="load",e.rowDataBound="rowDataBound",e.queryCellInfo="queryCellInfo",e.toolbarClick="toolbarClick",e.keyPressed="key-pressed",e.Edit=li,e.Reorder=di,e.Resize=hi,e.Filter=pi,e.Sort=ci,e.Dependency=Xt,e.Selection=ui,e.Toolbar=gi,e.DayMarkers=yi,e.CriticalPath=Di,e.ContextMenu=vi,e.ExcelExport=wi,e.ColumnMenu=ki,e.RowDD=Ti,e.PdfExport=Ji,e.VirtualScroll=$i,e.Column=Ge,e.DayWorkingTime=Ye,e.AddDialogFieldSettings=Ke,e.EditDialogFieldSettings=et,e.EditSettings=rt,e.EventMarker=st,e.FilterSettings=dt,e.SearchSettings=ct,e.Holiday=ft,e.LabelSettings=Dt,e.SelectionSettings=kt,e.SplitterSettings=Pt,e.TaskFields=Mt,e.TimelineTierSettings=xt,e.TimelineSettings=It,e.TooltipSettings=Ft,e.SortDescriptor=Lt,e.SortSettings=Bt,e.ResourceFields=jt,e.LoadingIndicator=Gt,e.TemporaryDictionary=Pi,e.PdfBorders=Si,e.PdfPaddings=Ci,e.PdfTreeGridStyleBase=Mi,e.PdfTreeGridStyle=Ri,e.PdfGanttTheme=bi,e.PdfTreeGridLayouter=xi,e.PdfTreeGridLayoutResult=Ii,e.PdfTreeGridLayoutFormat=Ei,e.PdfTreeGridCell=Ui,e.PdfTreeGridCellCollection=Vi,e.PdfTreeGridRow=Li,e.PdfTreeGridRowCollection=Bi,e.PdfTreeGridHeaderCollection=Ai,e.PdfTreeGridColumn=Hi,e.PdfTreeGridColumnCollection=ji,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
11
11
|
//# sourceMappingURL=ej2-gantt.umd.min.js.map
|