text: /*
  @license
  
  dhtmlxGantt v.4.0.0 dhtmlx.com
  This software can be used only as part of dhtmlx.com site.
  You are not allowed to use it on any other site
  
  (c) Dinamenta, UAB.
  */
  Gantt.plugin(function(t){t.config.auto_scheduling=!1,t.config.auto_scheduling_descendant_links=!1,t.config.auto_scheduling_initial=!0,t.config.auto_scheduling_strict=!1,function(){var e=t._default_task_date;t._default_task_date=function(a,n){var i=e.apply(t,arguments);if(a.$target&&a.$source){var r=t._getTaskMinimalStartDate(a).date;r&&t._firstSmaller(i,r)&&(i=t.getClosestWorkTime({date:r,dir:"future"}))}return i}}(),t._datesNotEqual=function(t,e){return t.valueOf()>e.valueOf()?this._hasDuration(e,t):this._hasDuration(t,e);
  },t._firstSmaller=function(t,e){return t.valueOf()<e.valueOf()&&this._hasDuration(t,e)?!0:!1},t._firstBigger=function(t,e){return this._firstSmaller(e,t)},t._notEqualTaskDates=function(e,a){return this._datesNotEqual(e.start_date,a.start_date)||(this._datesNotEqual(e.end_date,a.end_date)||e.duration!=a.duration)&&e.type!=t.config.types.milestone?!0:void 0},t._autoScheduleHandler=function(e,a,n){if(t.config.auto_scheduling&&!this._autoscheduling_in_progress){var i=this.getTask(e);t._notEqualTaskDates(n,i)&&t.autoSchedule(i.id);
  }return!0},t._linkChangeAutoScheduleHandler=function(e,a){t.config.auto_scheduling&&!this._autoscheduling_in_progress&&t.autoSchedule(a.source)},t._autoScheduleOnLoadHandler=function(){t.config.auto_scheduling&&t.config.auto_scheduling_initial&&t.autoSchedule()},t._checkCircularDependency=function(e,a,n){if(n[e.id])return!1;n[e.id]=!0;for(var i,r=0;r<e.$source.length;r++)if(e.$source[r]!=a.id){var s=this.getLink(e.$source[r]);if(i=this.getTask(s.target),!this._checkCircularDependency(i,a,n))return!1;
  }if(e.id==a.source&&(i=this.getTask(a.target),!this._checkCircularDependency(i,a,n)))return!1;if(!t.config.auto_scheduling_descendant_links)for(var u=t.getChildren(e.id),r=0;r<u.length;r++){var o=this.getTask(u[r]);if(!o.$target.length&&!this._checkCircularDependency(o,a,n))return!1}return!0},t._checkParents=function(e,a){if(a[e])return!1;if(e!=t.config.root_id){var n=t.getParent(e);if(n!=t.config.root_id)return t._checkParents(n,a)}return!0},t._linkValidationHandler=function(e,a){var n=(t.config.auto_scheduling_descendant_links||!(t.isChildOf(a.target,a.source)||t.isChildOf(a.source,a.target)))&&t._checkCircularDependency(t.getTask(a.source),a,{});
  return n||t.callEvent("onCircularLinkError",[a]),n},t._lightBoxChangesHandler=function(e,a){if(t.config.auto_scheduling&&!this._autoscheduling_in_progress){var n=this.getTask(e);t._notEqualTaskDates(a,n)&&(t._autoschedule_lightbox_id=e)}return!0},t._lightBoxSaveHandler=function(e,a){return t.config.auto_scheduling&&!this._autoscheduling_in_progress&&t._autoschedule_lightbox_id&&t._autoschedule_lightbox_id==e&&(t._autoschedule_lightbox_id=null,t.autoSchedule(a.id)),!0},t.attachEvent("onAfterLinkUpdate",t._linkChangeAutoScheduleHandler),
  t.attachEvent("onAfterLinkAdd",t._linkChangeAutoScheduleHandler),t.attachEvent("onParse",t._autoScheduleOnLoadHandler),t.attachEvent("onBeforeLinkAdd",t._linkValidationHandler),t.attachEvent("onBeforeLinkUpdate",t._linkValidationHandler),t.attachEvent("onBeforeTaskChanged",t._autoScheduleHandler),t.attachEvent("onLightboxSave",t._lightBoxChangesHandler),t.attachEvent("onAfterTaskUpdate",t._lightBoxSaveHandler),t.autoSchedule=function(e){if(t.callEvent("onBeforeAutoSchedule",[e])!==!1){var a,n={};if(e)a=this.getTask(e),
  n=t._autoScheduleByTask(a,n);else for(var i=t.getChildren(t.config.root_id),r=0;r<i.length;r++)a=this.getTask(i[r]),n=t._autoScheduleByTask(a,n);t._updateTasks(n);var s=[];for(var r in n)s.push(r);t.callEvent("onAfterAutoSchedule",[e,s])}},t._autoScheduleByTask=function(e,a){return t.config.auto_scheduling_strict?a=t._autoScheduleLinkedTasks(e,a,null,e.id):(a=t._autoScheduleLinkedTasks(e,a,null),e.parent&&e.parent!=t.config.root_id&&(a=t._autoScheduleParents(this.getTask(e.parent),a))),a},t._autoScheduleLinkedTasks=function(e,a,n,i){
  var r;if(void 0===e.auto_scheduling||e.auto_scheduling){var s=t._getTaskMinimalStartDate(e);if(e.parent&&e.parent!=t.config.root_id){var u=this.getTask(e.parent),o=t._getProjectMinimalStartDate(u);s.date&&o.date?this._firstSmaller(s.date,o.date)&&(s=o):s.date||(s=o)}var d=t._isTask(e)&&s.date&&(t.config.auto_scheduling_strict&&this._datesNotEqual(s.date,e.start_date)&&i!=e.id||this._firstBigger(s.date,e.start_date));if(d){if(t.callEvent("onBeforeTaskAutoSchedule",[e,s.date,s.link,s.source_task])===!1)return a;
  t._updateTaskPosition(e,s.date,e.duration),a[e.id]=!0}if(!t.config.auto_scheduling_descendant_links){var c=this.getChildren(e.id),l=i&&t.isChildOf(i,e.id);if(c.length&&(!t.config.auto_scheduling_strict||!l||l&&d))for(r=0;r<c.length;r++)t._autoScheduleLinkedTasks(this.getTask(c[r]),a,n,i)}d&&t.callEvent("onAfterTaskAutoSchedule",[e,s.date,s.link,s.source_task])}for(r=0;r<e.$source.length;r++){var _=this.getLink(e.$source[r]),h=this.getTask(_.target);t._autoScheduleLinkedTasks(h,a,n,i)}if(e.parent&&n&&e.parent!=t.config.root_id){
  var g=this.getTask(e.parent);t.config.auto_scheduling_strict?t._autoScheduleParents(g,a,i):t._autoScheduleParents(g,a)}return a},t._updateTaskPosition=function(t,e,a){t.start_date=this.getClosestWorkTime({date:e,dir:"future"}),t.end_date=this.calculateEndDate(e,a)},t._updateTasks=function(e){this._autoscheduling_in_progress=!0,t.batchUpdate(function(){for(var a in e)t.updateTask(a)}),this._autoscheduling_in_progress=!1},t._calculateMinDate=function(t,e,a){var n=t.start_date,i=this.config.links;switch(a.type){
  case i.finish_to_start:n=e.end_date;break;case i.start_to_start:n=e.start_date;break;case i.start_to_finish:n=this.calculateEndDate(e.start_date,-1*(t.duration||1));break;case i.finish_to_finish:n=this.calculateEndDate(e.end_date,-1*t.duration)}return a.lag&&1*a.lag==a.lag&&(n=this.calculateEndDate(n,1*a.lag)),n},t._getTaskMinimalStartDate=function(e){for(var a={},n=0;n<e.$target.length;n++){var i=this.getLink(e.$target[n]),r=this.getTask(i.source),s=e,u=r;t._isProject(e)&&(s=t.getSubtaskDates(e.id),
  s.duration=t.calculateDuration(s.start_date,s.end_date)),t._isProject(r)&&(u=t.getSubtaskDates(r.id),u.duration=t.calculateDuration(u.start_date,u.end_date));var o=t._calculateMinDate(s,u,i);a.date&&!this._firstSmaller(a.date,o)||t._isProject(r)&&t.isChildOf(e.id,r.id)||(a.date=new Date(o),a.link=i,a.source_task=r)}return a.date&&this._firstSmaller(e.start_date,a.date)&&(a._mustMove=!0),a},t._getProjectMinimalStartDate=function(e){if(!e)return{};var a;a=t._isProject(e)?t._getTaskMinimalStartDate(e):{};
  var n;e.parent&&e.parent!=t.config.root_id&&(n=this.getTask(e.parent));var i=t._getProjectMinimalStartDate(n);return(!a.date||i.date&&this._firstSmaller(a.date,i.date))&&(a=i),a},t._autoScheduleParents=function(e,a,n){if(!e||t.config.auto_scheduling_descendant_links)return a;if(e.parent&&e.parent!=t.config.root_id){var i=this.getTask(e.parent);t._autoScheduleParents(i,a,n)}return t._autoScheduleLinkedTasks(e,a,0,n),a},t._isStrictParent=function(t,e){if(!t)return!1;for(var a;this.getParent(a||t);)if(a=this.getParent(a||t),
  a==e)return!0;return!1}});
  //# sourceMappingURL=../sources/ext/dhtmlxgantt_auto_scheduling.js.map