Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
1,805
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function dhtmlxEvent(t, e, n) {
  2.     t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent && t.attachEvent("on" + e, n)
  3. }
  4.  
  5. function dhtmlxDetachEvent(t, e, n) {
  6.     t.removeEventListener ? t.removeEventListener(e, n, !1) : t.detachEvent && t.detachEvent("on" + e, n)
  7. }
  8.  
  9. function dhtmlxDnD(t, e) {
  10.     e && (this._settings = e), dhtmlxEventable(this), dhtmlxEvent(t, "mousedown", dhtmlx.bind(function(n) {
  11.         e.original_target = {
  12.             target: n.target || n.srcElement
  13.         }, this.dragStart(t, n)
  14.     }, this))
  15. }
  16.  
  17. function dataProcessor(t) {
  18.     return this.serverProcessor = t, this.action_param = "!nativeeditor_status", this.object = null, this.updatedRows = [], this.autoUpdate = !0, this.updateMode = "cell", this._tMode = "GET", this._headers = null, this._payload = null, this.post_delim = "_", this._waitMode = 0, this._in_progress = {}, this._invalid = {}, this.mandatoryFields = [], this.messages = [], this.styles = {
  19.         updated: "font-weight:bold;",
  20.         inserted: "font-weight:bold;",
  21.         deleted: "text-decoration : line-through;",
  22.         invalid: "background-color:FFE0E0;",
  23.         invalid_cell: "border-bottom:2px solid red;",
  24.         error: "color:red;",
  25.         clear: "font-weight:normal;text-decoration:none;"
  26.     }, this.enableUTFencoding(!0), dhx4._eventable(this), this
  27. }
  28.  
  29. function createCSSClass(t, e) {
  30.     var n = document.createElement("style");
  31.     n.type = "text/css", document.getElementsByTagName("head")[0].appendChild(n), (n.sheet || {}).insertRule ? n.sheet.insertRule(t + "{" + e + "}", 0) : (n.styleSheet || n.sheet).addRule(t, e)
  32. }
  33.  
  34. function checkIfEventHandlingAllowed(t) {
  35.     if ("none" != gantt.getLightbox().style.display) return !1;
  36.     if (document.getElementsByClassName("dhtmlx_modal_box").length > 0) return !1;
  37.     for (var e = t.target || t.srcElement, n = 0; n < allowedElements.length; n++) {
  38.         var a = allowedElements[n];
  39.         if (e.localName == a) return !0
  40.     }
  41.     return !1
  42. }
  43.  
  44. function createCSSClass(t, e) {
  45.     var n = document.createElement("style");
  46.     n.type = "text/css", document.getElementsByTagName("head")[0].appendChild(n), (n.sheet || {}).insertRule ? n.sheet.insertRule(t + "{" + e + "}", 0) : (n.styleSheet || n.sheet).addRule(t, e)
  47. }
  48.  
  49. function selectLink(t) {
  50.     if (currentLinkId) {
  51.         if (currentLinkId == t) return !1;
  52.         prevLinkId = currentLinkId, currentLinkId = t, gantt.refreshLink(prevLinkId), gantt.refreshLink(currentLinkId)
  53.     } else currentLinkId = t, gantt.refreshLink(t)
  54. }
  55.  
  56. function unselectLink() {
  57.     currentLinkId && (prevLinkId = currentLinkId, currentLinkId = null, gantt.refreshLink(prevLinkId))
  58. }
  59.  
  60. function deleteLink(t) {
  61.     t && dhtmlx.confirm(linkDeleteConfirmation, function(e) {
  62.         e && gantt.deleteLink(t)
  63.     })
  64. }
  65.  
  66. function selectTask(t) {
  67.     gantt.selectTask(t)
  68. }
  69.  
  70. function unselectTask() {
  71.     gantt.unselectTask()
  72. }
  73.  
  74. function deleteTask(t) {
  75.     return gantt.callEvent("onBeforeTaskDelete", [t, gantt.getTask(t)]) ? void(t && dhtmlx.confirm(taskDeleteConfirmation, function(e) {
  76.         e && gantt.deleteTask(t)
  77.     })) : !1
  78. }
  79.  
  80. function getTaskFitValue(t) {
  81.     var e = gantt.posFromDate(t.start_date),
  82.         n = gantt.posFromDate(t.end_date),
  83.         a = n - e,
  84.         i = t.text ? t.text.length * gantt.config._letter_size_coefficient : 1;
  85.     if (i > a) {
  86.         var s = gantt.getState().max_date,
  87.             r = gantt.posFromDate(s);
  88.         return i > r - n ? "left" : "right"
  89.     }
  90.     return "center"
  91. }
  92.  
  93. function rightSideTextTemplate(t, e, n) {
  94.     return "right" === getTaskFitValue(n) ? n.text : ""
  95. }
  96.  
  97. function leftSideTextTemplate(t, e, n) {
  98.     return "left" === getTaskFitValue(n) ? n.text : ""
  99. }
  100.  
  101. function taskTextTemplate(t, e, n) {
  102.     return "center" === getTaskFitValue(n) ? n.text : ""
  103. }
  104. "undefined" == typeof window.dhx4 && (window.dhx4 = {
  105.     version: "4.1.3",
  106.     skin: null,
  107.     skinDetect: function(t) {
  108.         return {
  109.             10: "dhx_skyblue",
  110.             20: "dhx_web",
  111.             30: "dhx_terrace"
  112.         }[this.readFromCss(t + "_skin_detect")] || null
  113.     },
  114.     readFromCss: function(t, e) {
  115.         var n = document.createElement("DIV");
  116.         n.className = t, null != document.body.firstChild ? document.body.insertBefore(n, document.body.firstChild) : document.body.appendChild(n);
  117.         var a = n[e || "offsetWidth"];
  118.         return n.parentNode.removeChild(n), n = null, a
  119.     },
  120.     lastId: 1,
  121.     newId: function() {
  122.         return this.lastId++
  123.     },
  124.     zim: {
  125.         data: {},
  126.         step: 5,
  127.         first: function() {
  128.             return 100
  129.         },
  130.         last: function() {
  131.             var t = this.first();
  132.             for (var e in this.data) t = Math.max(t, this.data[e]);
  133.             return t
  134.         },
  135.         reserve: function(t) {
  136.             return this.data[t] = this.last() + this.step, this.data[t]
  137.         },
  138.         clear: function(t) {
  139.             null != this.data[t] && (this.data[t] = null, delete this.data[t])
  140.         }
  141.     },
  142.     s2b: function(t) {
  143.         return "string" == typeof t && (t = t.toLowerCase()), 1 == t || 1 == t || "true" == t || "1" == t || "yes" == t || "y" == t
  144.     },
  145.     s2j: function(s) {
  146.         var obj = null;
  147.         dhx4.temp = null;
  148.         try {
  149.             eval("dhx4.temp=" + s)
  150.         } catch (e) {
  151.             dhx4.temp = null
  152.         }
  153.         return obj = dhx4.temp, dhx4.temp = null, obj
  154.     },
  155.     absLeft: function(t) {
  156.         return "string" == typeof t && (t = document.getElementById(t)), this.getOffset(t).left
  157.     },
  158.     absTop: function(t) {
  159.         return "string" == typeof t && (t = document.getElementById(t)), this.getOffset(t).top
  160.     },
  161.     _aOfs: function(t) {
  162.         for (var e = 0, n = 0; t;) e += parseInt(t.offsetTop), n += parseInt(t.offsetLeft), t = t.offsetParent;
  163.         return {
  164.             top: e,
  165.             left: n
  166.         }
  167.     },
  168.     _aOfsRect: function(t) {
  169.         var e = t.getBoundingClientRect(),
  170.             n = document.body,
  171.             a = document.documentElement,
  172.             i = window.pageYOffset || a.scrollTop || n.scrollTop,
  173.             s = window.pageXOffset || a.scrollLeft || n.scrollLeft,
  174.             r = a.clientTop || n.clientTop || 0,
  175.             o = a.clientLeft || n.clientLeft || 0,
  176.             l = e.top + i - r,
  177.             d = e.left + s - o;
  178.         return {
  179.             top: Math.round(l),
  180.             left: Math.round(d)
  181.         }
  182.     },
  183.     getOffset: function(t) {
  184.         return t.getBoundingClientRect ? this._aOfsRect(t) : this._aOfs(t)
  185.     },
  186.     _isObj: function(t) {
  187.         return null != t && "object" == typeof t && "undefined" == typeof t.length
  188.     },
  189.     _copyObj: function(t) {
  190.         if (this._isObj(t)) {
  191.             var e = {};
  192.             for (var n in t) e[n] = "object" == typeof t[n] && null != t[n] ? this._copyObj(t[n]) : t[n]
  193.         } else
  194.             for (var e = [], n = 0; n < t.length; n++) e[n] = "object" == typeof t[n] && null != t[n] ? this._copyObj(t[n]) : t[n];
  195.         return e
  196.     },
  197.     screenDim: function() {
  198.         var t = navigator.userAgent.indexOf("MSIE") >= 0,
  199.             e = {};
  200.         return e.left = document.body.scrollLeft, e.right = e.left + (window.innerWidth || document.body.clientWidth), e.top = Math.max((t ? document.documentElement : document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop), e.bottom = e.top + (t ? Math.max(document.documentElement.clientHeight || 0, document.documentElement.offsetHeight || 0) : window.innerHeight), e
  201.     },
  202.     selectTextRange: function(t, e, n) {
  203.         t = "string" == typeof t ? document.getElementById(t) : t;
  204.         var a = t.value.length;
  205.         if (e = Math.max(Math.min(e, a), 0), n = Math.min(n, a), t.setSelectionRange) try {
  206.             t.setSelectionRange(e, n)
  207.         } catch (i) {} else if (t.createTextRange) {
  208.             var s = t.createTextRange();
  209.             s.moveStart("character", e), s.moveEnd("character", n - a);
  210.             try {
  211.                 s.select()
  212.             } catch (i) {}
  213.         }
  214.     },
  215.     transData: null,
  216.     transDetect: function() {
  217.         if (null == this.transData) {
  218.             this.transData = {
  219.                 transProp: !1,
  220.                 transEv: null
  221.             };
  222.             var t = {
  223.                 MozTransition: "transitionend",
  224.                 WebkitTransition: "webkitTransitionEnd",
  225.                 OTransition: "oTransitionEnd",
  226.                 msTransition: "transitionend",
  227.                 transition: "transitionend"
  228.             };
  229.             for (var e in t) 0 == this.transData.transProp && null != document.documentElement.style[e] && (this.transData.transProp = e, this.transData.transEv = t[e]);
  230.             t = null
  231.         }
  232.         return this.transData
  233.     },
  234.     _xmlNodeValue: function(t) {
  235.         for (var e = "", n = 0; n < t.childNodes.length; n++) e += null != t.childNodes[n].nodeValue ? t.childNodes[n].nodeValue.toString().replace(/^[\n\r\s]{0,}/, "").replace(/[\n\r\s]{0,}$/, "") : "";
  236.         return e
  237.     }
  238. }, window.dhx4.isIE = navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0, window.dhx4.isIE6 = null == window.XMLHttpRequest && navigator.userAgent.indexOf("MSIE") >= 0, window.dhx4.isIE7 = navigator.userAgent.indexOf("MSIE 7.0") >= 0 && navigator.userAgent.indexOf("Trident") < 0, window.dhx4.isIE8 = navigator.userAgent.indexOf("MSIE 8.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0, window.dhx4.isOpera = navigator.userAgent.indexOf("Opera") >= 0, window.dhx4.isChrome = navigator.userAgent.indexOf("Chrome") >= 0, window.dhx4.isKHTML = navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0, window.dhx4.isFF = navigator.userAgent.indexOf("Firefox") >= 0, window.dhx4.isIPad = navigator.userAgent.search(/iPad/gi) >= 0), "undefined" == typeof window.dhx4.ajax && (window.dhx4.ajax = {
  239.     cache: !1,
  240.     method: "get",
  241.     parse: function(t) {
  242.         if ("string" != typeof t) return t;
  243.         if (t = t.replace(/^[\s]+/, ""), window.DOMParser && !dhx4.isIE) var e = (new window.DOMParser).parseFromString(t, "text/xml");
  244.         else if (window.ActiveXObject !== window.undefined) {
  245.             var e = new window.ActiveXObject("Microsoft.XMLDOM");
  246.             e.async = "false", e.loadXML(t)
  247.         }
  248.         return e
  249.     },
  250.     xmltop: function(t, e, n) {
  251.         if ("undefined" == typeof e.status || e.status < 400) {
  252.             var a = e.responseXML ? e.responseXML || e : dhx4.ajax.parse(e.responseText || e);
  253.             if (a && null !== a.documentElement && !a.getElementsByTagName("parsererror").length) return a.getElementsByTagName(t)[0]
  254.         }
  255.         return -1 !== n && dhx4.callEvent("onLoadXMLError", ["Incorrect XML", arguments[1], n]), document.createElement("DIV")
  256.     },
  257.     xpath: function(t, e) {
  258.         if (e.nodeName || (e = e.responseXML || e), dhx4.isIE) return e.selectNodes(t) || [];
  259.         for (var n, a = [], i = (e.ownerDocument || e).evaluate(t, e, null, XPathResult.ANY_TYPE, null); n = i.iterateNext();) a.push(n);
  260.         return a
  261.     },
  262.     query: function(t) {
  263.         dhx4.ajax._call(t.method || "GET", t.url, t.data || "", t.async || !0, t.callback, null, t.headers)
  264.     },
  265.     get: function(t, e) {
  266.         this._call("GET", t, null, !0, e)
  267.     },
  268.     getSync: function(t) {
  269.         return this._call("GET", t, null, !1)
  270.     },
  271.     put: function(t, e, n) {
  272.         this._call("PUT", t, e, !0, n)
  273.     },
  274.     del: function(t, e, n) {
  275.         this._call("DELETE", t, e, !0, n)
  276.     },
  277.     post: function(t, e, n) {
  278.         1 == arguments.length ? e = "" : 2 != arguments.length || "function" != typeof e && "function" != typeof window[e] ? e = String(e) : (n = e, e = ""), this._call("POST", t, e, !0, n)
  279.     },
  280.     postSync: function(t, e) {
  281.         return e = null == e ? "" : String(e), this._call("POST", t, e, !1)
  282.     },
  283.     getLong: function(t, e) {
  284.         this._call("GET", t, null, !0, e, {
  285.             url: t
  286.         })
  287.     },
  288.     postLong: function(t, e, n) {
  289.         2 == arguments.length && (n = e, e = ""), this._call("POST", t, e, !0, n, {
  290.             url: t,
  291.             postData: e
  292.         })
  293.     },
  294.     _call: function(t, e, n, a, i, s, r) {
  295.         var o = window.XMLHttpRequest && !dhx4.isIE ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP"),
  296.             l = null != navigator.userAgent.match(/AppleWebKit/) && null != navigator.userAgent.match(/Qt/) && null != navigator.userAgent.match(/Safari/);
  297.         if (1 == a && (o.onreadystatechange = function() {
  298.             if (4 == o.readyState || 1 == l && 3 == o.readyState) {
  299.                 if ((200 != o.status || "" == o.responseText) && !dhx4.callEvent("onAjaxError", [o])) return;
  300.                 window.setTimeout(function() {
  301.                     "function" == typeof i && i.apply(window, [{
  302.                         xmlDoc: o
  303.                     }]), null != s && ("undefined" != typeof s.postData ? dhx4.ajax.postLong(s.url, s.postData, i) : dhx4.ajax.getLong(s.url, i)), i = null, o = null
  304.                 }, 1)
  305.             }
  306.         }), "GET" == t && 1 != this.cache && (e += (e.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + (new Date).getTime() + "=1"), o.open(t, e, a), r)
  307.             for (var d in r) o.setRequestHeader(d, r[d]);
  308.         else "POST" == t.toUpperCase() || "PUT" == t || "DELETE" == t ? o.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") : "GET" == t && (n = null);
  309.         return o.setRequestHeader("X-Requested-With", "XMLHttpRequest"), o.send(n), a ? void 0 : {
  310.             xmlDoc: o
  311.         }
  312.     }
  313. }), "undefined" == typeof window.dhx4._eventable && (window.dhx4._eventable = function(t, e) {
  314.     return "clear" == e ? (t.detachAllEvents(), t.dhxevs = null, t.attachEvent = null, t.detachEvent = null, t.checkEvent = null, t.callEvent = null, t.detachAllEvents = null, void(t = null)) : (t.dhxevs = {
  315.         data: {}
  316.     }, t.attachEvent = function(t, e) {
  317.         t = String(t).toLowerCase(), this.dhxevs.data[t] || (this.dhxevs.data[t] = {});
  318.         var n = window.dhx4.newId();
  319.         return this.dhxevs.data[t][n] = e, n
  320.     }, t.detachEvent = function(t) {
  321.         for (var e in this.dhxevs.data) {
  322.             var n = 0;
  323.             for (var a in this.dhxevs.data[e]) a == t ? (this.dhxevs.data[e][a] = null, delete this.dhxevs.data[e][a]) : n++;
  324.             0 == n && (this.dhxevs.data[e] = null, delete this.dhxevs.data[e])
  325.         }
  326.     }, t.checkEvent = function(t) {
  327.         return t = String(t).toLowerCase(), null != this.dhxevs.data[t]
  328.     }, t.callEvent = function(t, e) {
  329.         if (t = String(t).toLowerCase(), null == this.dhxevs.data[t]) return !0;
  330.         var n = !0;
  331.         for (var a in this.dhxevs.data[t]) n = this.dhxevs.data[t][a].apply(this, e) && n;
  332.         return n
  333.     }, t.detachAllEvents = function() {
  334.         for (var t in this.dhxevs.data) {
  335.             for (var e in this.dhxevs.data[t]) this.dhxevs.data[t][e] = null, delete this.dhxevs.data[t][e];
  336.             this.dhxevs.data[t] = null, delete this.dhxevs.data[t]
  337.         }
  338.     }, void(t = null))
  339. }, dhx4._eventable(dhx4)), "undefined" == typeof window.dhtmlx && (window.dhtmlx = {
  340.     extend: function(t, e) {
  341.         for (var n in e) t[n] || (t[n] = e[n]);
  342.         return t
  343.     },
  344.     extend_api: function(t, e, n) {
  345.         var a = window[t];
  346.         a && (window[t] = function(t) {
  347.             if (t && "object" == typeof t && !t.tagName) {
  348.                 var n = a.apply(this, e._init ? e._init(t) : arguments);
  349.                 for (var i in dhtmlx) e[i] && this[e[i]](dhtmlx[i]);
  350.                 for (var i in t) e[i] ? this[e[i]](t[i]) : 0 === i.indexOf("on") && this.attachEvent(i, t[i])
  351.             } else var n = a.apply(this, arguments);
  352.             return e._patch && e._patch(this), n || this
  353.         }, window[t].prototype = a.prototype, n && dhtmlx.extend(window[t].prototype, n))
  354.     },
  355.     url: function(t) {
  356.         return -1 != t.indexOf("?") ? "&" : "?"
  357.     }
  358. }), _isFF = !1, _isIE = !1, _isOpera = !1, _isKHTML = !1, _isMacOS = !1, _isChrome = !1, _FFrv = !1, _KHTMLrv = !1, _OperaRv = !1, -1 != navigator.userAgent.indexOf("Macintosh") && (_isMacOS = !0), navigator.userAgent.toLowerCase().indexOf("chrome") > -1 && (_isChrome = !0), -1 != navigator.userAgent.indexOf("Safari") || -1 != navigator.userAgent.indexOf("Konqueror") ? (_KHTMLrv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari") + 7, 5)), _KHTMLrv > 525 ? (_isFF = !0, _FFrv = 1.9) : _isKHTML = !0) : -1 != navigator.userAgent.indexOf("Opera") ? (_isOpera = !0, _OperaRv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera") + 6, 3))) : -1 != navigator.appName.indexOf("Microsoft") ? (_isIE = !0, (-1 != navigator.appVersion.indexOf("MSIE 8.0") || -1 != navigator.appVersion.indexOf("MSIE 9.0") || -1 != navigator.appVersion.indexOf("MSIE 10.0") || document.documentMode > 7) && "BackCompat" != document.compatMode && (_isIE = 8)) : "Netscape" == navigator.appName && -1 != navigator.userAgent.indexOf("Trident") ? _isIE = 8 : (_isFF = !0, _FFrv = parseFloat(navigator.userAgent.split("rv:")[1])), "undefined" == typeof window.dhtmlxEvent, null == dhtmlxEvent.touchDelay && (dhtmlxEvent.touchDelay = 2e3), "undefined" == typeof dhtmlxEvent.initTouch && (dhtmlxEvent.initTouch = function() {
  359.     function t() {
  360.         if (n) {
  361.             var t = document.createEvent("HTMLEvents");
  362.             t.initEvent("dblclick", !0, !0), n.dispatchEvent(t), e = n = null
  363.         }
  364.     }
  365.     var e, n, a, i;
  366.     dhtmlxEvent(document.body, "touchstart", function(s) {
  367.         n = s.touches[0].target, a = s.touches[0].clientX, i = s.touches[0].clientY, e = window.setTimeout(t, dhtmlxEvent.touchDelay)
  368.     }), dhtmlxEvent(document.body, "touchmove", function(t) {
  369.         e && (Math.abs(t.touches[0].clientX - a) > 50 || Math.abs(t.touches[0].clientY - i) > 50) && (window.clearTimeout(e), e = n = !1)
  370.     }), dhtmlxEvent(document.body, "touchend", function() {
  371.         e && (window.clearTimeout(e), e = n = !1)
  372.     }), dhtmlxEvent.initTouch = function() {}
  373. }), window.dhtmlx || (window.dhtmlx = {}),
  374. function() {
  375.     function t(t, e) {
  376.         var a = t.callback;
  377.         n(!1), t.box.parentNode.removeChild(t.box), g = t.box = null, a && a(e)
  378.     }
  379.  
  380.     function e(e) {
  381.         if (g) {
  382.             e = e || event;
  383.             var n = e.which || event.keyCode;
  384.             return dhtmlx.message.keyboard && ((13 == n || 32 == n) && t(g, !0), 27 == n && t(g, !1)), e.preventDefault && e.preventDefault(), !(e.cancelBubble = !0)
  385.         }
  386.     }
  387.  
  388.     function n(t) {
  389.         n.cover || (n.cover = document.createElement("DIV"), n.cover.onkeydown = e, n.cover.className = "dhx_modal_cover", document.body.appendChild(n.cover)), document.body.scrollHeight, n.cover.style.display = t ? "inline-block" : "none"
  390.     }
  391.  
  392.     function a(t, e) {
  393.         var n = "dhtmlx_" + t.toLowerCase().replace(/ /g, "_") + "_button";
  394.         return "<div class='dhtmlx_popup_button " + n + "' result='" + e + "' ><div>" + t + "</div></div>"
  395.     }
  396.  
  397.     function i(t) {
  398.         h.area || (h.area = document.createElement("DIV"), h.area.className = "dhtmlx_message_area", h.area.style[h.position] = "5px", document.body.appendChild(h.area)), h.hide(t.id);
  399.         var e = document.createElement("DIV");
  400.         return e.innerHTML = "<div>" + t.text + "</div>", e.className = "dhtmlx-info dhtmlx-" + t.type, e.onclick = function() {
  401.             h.hide(t.id), t = null
  402.         }, "bottom" == h.position && h.area.firstChild ? h.area.insertBefore(e, h.area.firstChild) : h.area.appendChild(e), t.expire > 0 && (h.timers[t.id] = window.setTimeout(function() {
  403.             h.hide(t.id)
  404.         }, t.expire)), h.pull[t.id] = e, e = null, t.id
  405.     }
  406.  
  407.     function s(e, n, i) {
  408.         var s = document.createElement("DIV");
  409.         s.className = " dhtmlx_modal_box dhtmlx-" + e.type, s.setAttribute("dhxbox", 1);
  410.         var r = "";
  411.         if (e.width && (s.style.width = e.width), e.height && (s.style.height = e.height), e.title && (r += '<div class="dhtmlx_popup_title">' + e.title + "</div>"), r += '<div class="dhtmlx_popup_text"><span>' + (e.content ? "" : e.text) + '</span></div><div  class="dhtmlx_popup_controls">', n && (r += a(e.ok || "OK", !0)), i && (r += a(e.cancel || "Cancel", !1)), e.buttons)
  412.             for (var o = 0; o < e.buttons.length; o++) r += a(e.buttons[o], o);
  413.         if (r += "</div>", s.innerHTML = r, e.content) {
  414.             var l = e.content;
  415.             "string" == typeof l && (l = document.getElementById(l)), "none" == l.style.display && (l.style.display = ""), s.childNodes[e.title ? 1 : 0].appendChild(l)
  416.         }
  417.         return s.onclick = function(n) {
  418.             n = n || event;
  419.             var a = n.target || n.srcElement;
  420.             if (a.className || (a = a.parentNode), "dhtmlx_popup_button" == a.className.split(" ")[0]) {
  421.                 var i = a.getAttribute("result");
  422.                 i = "true" == i || ("false" == i ? !1 : i), t(e, i)
  423.             }
  424.         }, e.box = s, (n || i) && (g = e), s
  425.     }
  426.  
  427.     function r(t, a, i) {
  428.         var r = t.tagName ? t : s(t, a, i);
  429.         t.hidden || n(!0), document.body.appendChild(r);
  430.         var o = Math.abs(Math.floor(((window.innerWidth || document.documentElement.offsetWidth) - r.offsetWidth) / 2)),
  431.             l = Math.abs(Math.floor(((window.innerHeight || document.documentElement.offsetHeight) - r.offsetHeight) / 2));
  432.         return r.style.top = "top" == t.position ? "-3px" : l + "px", r.style.left = o + "px", r.onkeydown = e, r.focus(), t.hidden && dhtmlx.modalbox.hide(r), r
  433.     }
  434.  
  435.     function o(t) {
  436.         return r(t, !0, !1)
  437.     }
  438.  
  439.     function l(t) {
  440.         return r(t, !0, !0)
  441.     }
  442.  
  443.     function d(t) {
  444.         return r(t)
  445.     }
  446.  
  447.     function _(t, e, n) {
  448.         return "object" != typeof t && ("function" == typeof e && (n = e, e = ""), t = {
  449.             text: t,
  450.             type: e,
  451.             callback: n
  452.         }), t
  453.     }
  454.  
  455.     function c(t, e, n, a) {
  456.         return "object" != typeof t && (t = {
  457.             text: t,
  458.             type: e,
  459.             expire: n,
  460.             id: a
  461.         }), t.id = t.id || h.uid(), t.expire = t.expire || h.expire, t
  462.     }
  463.     var g = null;
  464.     document.attachEvent ? document.attachEvent("onkeydown", e) : document.addEventListener("keydown", e, !0), dhtmlx.alert = function() {
  465.         var t = _.apply(this, arguments);
  466.         return t.type = t.type || "confirm", o(t)
  467.     }, dhtmlx.confirm = function() {
  468.         var t = _.apply(this, arguments);
  469.         return t.type = t.type || "alert", l(t)
  470.     }, dhtmlx.modalbox = function() {
  471.         var t = _.apply(this, arguments);
  472.         return t.type = t.type || "alert", d(t)
  473.     }, dhtmlx.modalbox.hide = function(t) {
  474.         for (; t && t.getAttribute && !t.getAttribute("dhxbox");) t = t.parentNode;
  475.         t && (t.parentNode.removeChild(t), n(!1))
  476.     };
  477.     var h = dhtmlx.message = function(t) {
  478.         t = c.apply(this, arguments), t.type = t.type || "info";
  479.         var e = t.type.split("-")[0];
  480.         switch (e) {
  481.             case "alert":
  482.                 return o(t);
  483.             case "confirm":
  484.                 return l(t);
  485.             case "modalbox":
  486.                 return d(t);
  487.             default:
  488.                 return i(t)
  489.         }
  490.     };
  491.     h.seed = (new Date).valueOf(), h.uid = function() {
  492.         return h.seed++
  493.     }, h.expire = 4e3, h.keyboard = !0, h.position = "top", h.pull = {}, h.timers = {}, h.hideAll = function() {
  494.         for (var t in h.pull) h.hide(t)
  495.     }, h.hide = function(t) {
  496.         var e = h.pull[t];
  497.         e && e.parentNode && (window.setTimeout(function() {
  498.             e.parentNode.removeChild(e), e = null
  499.         }, 2e3), e.className += " hidden", h.timers[t] && window.clearTimeout(h.timers[t]), delete h.pull[t])
  500.     }
  501. }(), gantt = {
  502.     version: "3.3.1"
  503. }, dhtmlxEventable = function(obj) {
  504.     obj._silent_mode = !1, obj._silentStart = function() {
  505.         this._silent_mode = !0
  506.     }, obj._silentEnd = function() {
  507.         this._silent_mode = !1
  508.     }, obj.attachEvent = function(t, e, n) {
  509.         return t = "ev_" + t.toLowerCase(), this[t] || (this[t] = new this._eventCatcher(n || this)), t + ":" + this[t].addEvent(e)
  510.     }, obj.callEvent = function(t, e) {
  511.         return this._silent_mode ? !0 : (t = "ev_" + t.toLowerCase(), this[t] ? this[t].apply(this, e) : !0)
  512.     }, obj.checkEvent = function(t) {
  513.         return !!this["ev_" + t.toLowerCase()]
  514.     }, obj._eventCatcher = function(obj) {
  515.         var dhx_catch = [],
  516.             z = function() {
  517.                 for (var t = !0, e = 0; e < dhx_catch.length; e++)
  518.                     if (dhx_catch[e]) {
  519.                         var n = dhx_catch[e].apply(obj, arguments);
  520.                         t = t && n
  521.                     }
  522.                 return t
  523.             };
  524.         return z.addEvent = function(ev) {
  525.             return "function" != typeof ev && (ev = eval(ev)), ev ? dhx_catch.push(ev) - 1 : !1
  526.         }, z.removeEvent = function(t) {
  527.             dhx_catch[t] = null
  528.         }, z
  529.     }, obj.detachEvent = function(t) {
  530.         if (t) {
  531.             var e = t.split(":");
  532.             this[e[0]].removeEvent(e[1])
  533.         }
  534.     }, obj.detachAllEvents = function() {
  535.         for (var t in this) 0 === t.indexOf("ev_") && delete this[t]
  536.     }, obj = null
  537. }, dhtmlx.copy = function(t) {
  538.     var e, n, a;
  539.     if (t && "object" == typeof t) {
  540.         for (a = {}, n = [Array, Date, Number, String, Boolean], e = 0; e < n.length; e++) t instanceof n[e] && (a = e ? new n[e](t) : new n[e]);
  541.         for (e in t) Object.prototype.hasOwnProperty.apply(t, [e]) && (a[e] = dhtmlx.copy(t[e]))
  542.     }
  543.     return a || t
  544. }, dhtmlx.mixin = function(t, e, n) {
  545.     for (var a in e)(!t[a] || n) && (t[a] = e[a]);
  546.     return t
  547. }, dhtmlx.defined = function(t) {
  548.     return "undefined" != typeof t
  549. }, dhtmlx.uid = function() {
  550.     return this._seed || (this._seed = (new Date).valueOf()), this._seed++, this._seed
  551. }, dhtmlx.bind = function(t, e) {
  552.     return t.bind ? t.bind(e) : function() {
  553.         return t.apply(e, arguments)
  554.     }
  555. }, gantt._get_position = function(t) {
  556.     var e = 0,
  557.         n = 0;
  558.     if (t.getBoundingClientRect) {
  559.         var a = t.getBoundingClientRect(),
  560.             i = document.body,
  561.             s = document.documentElement,
  562.             r = window.pageYOffset || s.scrollTop || i.scrollTop,
  563.             o = window.pageXOffset || s.scrollLeft || i.scrollLeft,
  564.             l = s.clientTop || i.clientTop || 0,
  565.             d = s.clientLeft || i.clientLeft || 0;
  566.         return e = a.top + r - l, n = a.left + o - d, {
  567.             y: Math.round(e),
  568.             x: Math.round(n),
  569.             width: t.offsetWidth,
  570.             height: t.offsetHeight
  571.         }
  572.     }
  573.     for (; t;) e += parseInt(t.offsetTop, 10), n += parseInt(t.offsetLeft, 10), t = t.offsetParent;
  574.     return {
  575.         y: e,
  576.         x: n,
  577.         width: t.offsetWidth,
  578.         height: t.offsetHeight
  579.     }
  580. }, gantt._detectScrollSize = function() {
  581.     var t = document.createElement("div");
  582.     t.style.cssText = "visibility:hidden;position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;height:110px;min-height:100px;overflow-y:scroll;", document.body.appendChild(t);
  583.     var e = t.offsetWidth - t.clientWidth;
  584.     return document.body.removeChild(t), e
  585. }, window.dhtmlx && (dhtmlx.attaches || (dhtmlx.attaches = {}), dhtmlx.attaches.attachGantt = function(t, e, n) {
  586.     var a = document.createElement("DIV");
  587.     a.id = "gantt_" + dhtmlx.uid(), a.style.width = "100%", a.style.height = "100%", a.cmp = "grid", n = n || window.gantt, document.body.appendChild(a), this.attachObject(a.id);
  588.     var i = this.vs[this.av];
  589.     i.grid = n, n.init(a.id, t, e), a.firstChild.style.border = "none", i.gridId = a.id, i.gridObj = a;
  590.     var s = "_viewRestore";
  591.     return this.vs[this[s]()].grid
  592. }), "undefined" != typeof window.dhtmlXCellObject && (dhtmlXCellObject.prototype.attachGantt = function(t, e, n) {
  593.     var a = document.createElement("DIV");
  594.     return a.id = "gantt_" + dhtmlx.uid(), a.style.width = "100%", a.style.height = "100%", a.cmp = "grid", document.body.appendChild(a), this.attachObject(a.id), n = n || window.gantt, n.init(a.id, t, e), a.firstChild.style.border = "none", a = null, this.callEvent("_onContentAttach", []), this.dataObj
  595. }), dhtmlxEventable(gantt), dhx4.ajax.cache = !0, gantt._click = {}, gantt._dbl_click = {}, gantt._context_menu = {}, gantt._on_click = function(t) {
  596.     t = t || window.event;
  597.     var e = t.target || t.srcElement,
  598.         n = gantt.locate(t),
  599.         a = !0;
  600.     if (null !== n ? a = !gantt.checkEvent("onTaskClick") || gantt.callEvent("onTaskClick", [n, t]) : gantt.callEvent("onEmptyClick", [t]), a) {
  601.         var i = gantt._find_ev_handler(t, e, gantt._click, n);
  602.         if (!i) return;
  603.         n && gantt.getTask(n) && gantt.config.select_task && gantt.selectTask(n)
  604.     }
  605. }, gantt._on_contextmenu = function(t) {
  606.     t = t || window.event;
  607.     var e = t.target || t.srcElement,
  608.         n = gantt.locate(e),
  609.         a = gantt.locate(e, gantt.config.link_attribute),
  610.         i = !gantt.checkEvent("onContextMenu") || gantt.callEvent("onContextMenu", [n, a, t]);
  611.     return i || (t.preventDefault ? t.preventDefault() : t.returnValue = !1), i
  612. }, gantt._find_ev_handler = function(t, e, n, a) {
  613.     for (var i = !0; e;) {
  614.         var s = gantt._getClassName(e);
  615.         if (s) {
  616.             s = s.split(" ");
  617.             for (var r = 0; r < s.length; r++)
  618.                 if (s[r] && n[s[r]]) {
  619.                     var o = n[s[r]].call(gantt, t, a, e);
  620.                     i = i && !("undefined" != typeof o && o !== !0)
  621.                 }
  622.         }
  623.         e = e.parentNode
  624.     }
  625.     return i
  626. }, gantt._on_dblclick = function(t) {
  627.     t = t || window.event;
  628.     var e = t.target || t.srcElement,
  629.         n = gantt.locate(t),
  630.         a = !gantt.checkEvent("onTaskDblClick") || gantt.callEvent("onTaskDblClick", [n, t]);
  631.     if (a) {
  632.         var i = gantt._find_ev_handler(t, e, gantt._dbl_click, n);
  633.         if (!i) return;
  634.         null !== n && gantt.getTask(n) && a && gantt.config.details_on_dblclick && gantt.showLightbox(n)
  635.     }
  636. }, gantt._on_mousemove = function(t) {
  637.     if (gantt.checkEvent("onMouseMove")) {
  638.         var e = gantt.locate(t);
  639.         gantt._last_move_event = t, gantt.callEvent("onMouseMove", [e, t])
  640.     }
  641. }, dhtmlxDnD.prototype = {
  642.     dragStart: function(t, e) {
  643.         this.config = {
  644.             obj: t,
  645.             marker: null,
  646.             started: !1,
  647.             pos: this.getPosition(e),
  648.             sensitivity: 4
  649.         }, this._settings && dhtmlx.mixin(this.config, this._settings, !0);
  650.         var n = dhtmlx.bind(function(e) {
  651.             return this.dragMove(t, e)
  652.         }, this),
  653.             a = (dhtmlx.bind(function(e) {
  654.                 return this.dragScroll(t, e)
  655.             }, this), dhtmlx.bind(function(t) {
  656.                 return dhtmlx.defined(this.config.updates_per_second) && !gantt._checkTimeout(this, this.config.updates_per_second) ? !0 : n(t)
  657.             }, this)),
  658.             i = dhtmlx.bind(function() {
  659.                 return dhtmlxDetachEvent(document.body, "mousemove", a), dhtmlxDetachEvent(document.body, "mouseup", i), this.dragEnd(t)
  660.             }, this);
  661.         dhtmlxEvent(document.body, "mousemove", a), dhtmlxEvent(document.body, "mouseup", i), document.body.className += " gantt_noselect"
  662.     },
  663.     dragMove: function(t, e) {
  664.         if (!this.config.marker && !this.config.started) {
  665.             var n = this.getPosition(e),
  666.                 a = n.x - this.config.pos.x,
  667.                 i = n.y - this.config.pos.y,
  668.                 s = Math.sqrt(Math.pow(Math.abs(a), 2) + Math.pow(Math.abs(i), 2));
  669.             if (s > this.config.sensitivity) {
  670.                 if (this.config.started = !0, this.config.ignore = !1, this.callEvent("onBeforeDragStart", [t, this.config.original_target]) === !1) return this.config.ignore = !0, !0;
  671.                 var r = this.config.marker = document.createElement("div");
  672.                 r.className = "gantt_drag_marker", r.innerHTML = "Dragging object", document.body.appendChild(r), this.callEvent("onAfterDragStart", [t, this.config.original_target])
  673.             } else this.config.ignore = !0
  674.         }
  675.         this.config.ignore || (e.pos = this.getPosition(e), this.config.marker.style.left = e.pos.x + "px", this.config.marker.style.top = e.pos.y + "px", this.callEvent("onDragMove", [t, e]))
  676.     },
  677.     dragEnd: function() {
  678.         this.config.marker && (this.config.marker.parentNode.removeChild(this.config.marker), this.config.marker = null, this.callEvent("onDragEnd", [])), document.body.className = document.body.className.replace(" gantt_noselect", "")
  679.     },
  680.     getPosition: function(t) {
  681.         var e = 0,
  682.             n = 0;
  683.         return t = t || window.event, t.pageX || t.pageY ? (e = t.pageX, n = t.pageY) : (t.clientX || t.clientY) && (e = t.clientX + document.body.scrollLeft + document.documentElement.scrollLeft, n = t.clientY + document.body.scrollTop + document.documentElement.scrollTop), {
  684.             x: e,
  685.             y: n
  686.         }
  687.     }
  688. }, gantt._init_grid = function() {
  689.     this._click.gantt_close = dhtmlx.bind(function(t, e) {
  690.         return this.close(e), !1
  691.     }, this), this._click.gantt_open = dhtmlx.bind(function(t, e) {
  692.         return this.open(e), !1
  693.     }, this), this._click.gantt_row = dhtmlx.bind(function(t, e, n) {
  694.         if (null !== e) {
  695.             var a = this.getTask(e);
  696.             this.config.scroll_on_click && this.showDate(a.start_date), this.callEvent("onTaskRowClick", [e, n])
  697.         }
  698.     }, this), this._click.gantt_grid_head_cell = dhtmlx.bind(function(t, e, n) {
  699.         var a = n.getAttribute("column_id");
  700.         if (this.callEvent("onGridHeaderClick", [a, t])) {
  701.             if ("add" == a) return void this._click.gantt_add(t, this.config.root_id);
  702.             if (this.config.sort) {
  703.                 for (var i, s = a, r = 0; this.config.columns.length; r++)
  704.                     if (this.config.columns[r].name == a) {
  705.                         i = this.config.columns[r];
  706.                         break
  707.                     }
  708.                 if (i && void 0 !== i.sort && i.sort !== !0 && (s = i.sort, !s)) return;
  709.                 var o = this._sort && this._sort.direction && this._sort.name == a ? this._sort.direction : "desc";
  710.                 o = "desc" == o ? "asc" : "desc", this._sort = {
  711.                     name: a,
  712.                     direction: o
  713.                 }, this.sort(s, "desc" == o)
  714.             }
  715.         }
  716.     }, this), !this.config.sort && this.config.order_branch && this._init_dnd(), this._click.gantt_add = dhtmlx.bind(function(t, e) {
  717.         if (!this.config.readonly) {
  718.             var n = {};
  719.             return this.createTask(n, e ? e : this.config.root_id), !1
  720.         }
  721.     }, this), this._init_resize && this._init_resize()
  722. }, gantt._render_grid = function() {
  723.     this._is_grid_visible() && (this._calc_grid_width(), this._render_grid_header())
  724. }, gantt._calc_grid_width = function() {
  725.     for (var t = this.getGridColumns(), e = 0, n = [], a = [], i = 0; i < t.length; i++) {
  726.         var s = parseInt(t[i].width, 10);
  727.         window.isNaN(s) && (s = 50, n.push(i)), a[i] = s, e += s
  728.     }
  729.     if (this.config.autofit || n.length) {
  730.         var r = this._get_grid_width() - e;
  731.         if (r / (n.length > 0 ? n.length : a.length > 0 ? a.length : 1), n.length > 0)
  732.             for (var o = r / (n.length ? n.length : 1), i = 0; i < n.length; i++) {
  733.                 var l = n[i];
  734.                 a[l] += o
  735.             } else
  736.                 for (var o = r / (a.length ? a.length : 1), i = 0; i < a.length; i++) a[i] += o;
  737.         for (var i = 0; i < a.length; i++) t[i].width = a[i]
  738.     } else this.config.grid_width = e
  739. }, gantt._render_grid_header = function() {
  740.     for (var t = this.getGridColumns(), e = [], n = 0, a = this.locale.labels, i = this.config.scale_height - 2, s = 0; s < t.length; s++) {
  741.         var r = s == t.length - 1,
  742.             o = t[s];
  743.         r && this._get_grid_width() > n + o.width && (o.width = this._get_grid_width() - n), n += o.width;
  744.         var l = this._sort && o.name == this._sort.name ? "<div class='gantt_sort gantt_" + this._sort.direction + "'></div>" : "",
  745.             d = ["gantt_grid_head_cell", "gantt_grid_head_" + o.name, r ? "gantt_last_cell" : "", this.templates.grid_header_class(o.name, o)].join(" "),
  746.             _ = "width:" + (o.width - (r ? 1 : 0)) + "px;",
  747.             c = o.label || a["column_" + o.name];
  748.         c = c || "";
  749.         var g = "<div class='" + d + "' style='" + _ + "' column_id='" + o.name + "'>" + c + l + "</div>";
  750.         e.push(g)
  751.     }
  752.     this.$grid_scale.style.height = this.config.scale_height - 1 + "px", this.$grid_scale.style.lineHeight = i + "px", this.$grid_scale.style.width = n - 1 + "px", this.$grid_scale.innerHTML = e.join("")
  753. }, gantt._render_grid_item = function(t) {
  754.     if (!gantt._is_grid_visible()) return null;
  755.     for (var e = this.getGridColumns(), n = [], a = 0; a < e.length; a++) {
  756.         var i, s, r = a == e.length - 1,
  757.             o = e[a];
  758.         "add" == o.name ? s = "<div class='gantt_add'></div>" : (s = o.template ? o.template(t) : t[o.name], s instanceof Date && (s = this.templates.date_grid(s, t)), s = "<div class='gantt_tree_content'>" + s + "</div>");
  759.         var l = "gantt_cell" + (r ? " gantt_last_cell" : ""),
  760.             d = "";
  761.         if (o.tree) {
  762.             for (var _ = 0; _ < t.$level; _++) d += this.templates.grid_indent(t);
  763.             var c = this._has_children(t.id);
  764.             c ? (d += this.templates.grid_open(t), d += this.templates.grid_folder(t)) : (d += this.templates.grid_blank(t), d += this.templates.grid_file(t))
  765.         }
  766.         var g = "width:" + (o.width - (r ? 1 : 0)) + "px;";
  767.         dhtmlx.defined(o.align) && (g += "text-align:" + o.align + ";"), i = "<div class='" + l + "' style='" + g + "'>" + d + s + "</div>", n.push(i)
  768.     }
  769.     var l = t.$index % 2 === 0 ? "" : " odd";
  770.     if (l += t.$transparent ? " gantt_transparent" : "", l += t.$dataprocessor_class ? " " + t.$dataprocessor_class : "", this.templates.grid_row_class) {
  771.         var h = this.templates.grid_row_class.call(this, t.start_date, t.end_date, t);
  772.         h && (l += " " + h)
  773.     }
  774.     this.getState().selected_task == t.id && (l += " gantt_selected");
  775.     var u = document.createElement("div");
  776.     return u.className = "gantt_row" + l, u.style.height = this.config.row_height + "px", u.style.lineHeight = gantt.config.row_height + "px", u.setAttribute(this.config.task_attribute, t.id), u.innerHTML = n.join(""), u
  777. }, gantt.open = function(t) {
  778.     gantt._set_item_state(t, !0), this.callEvent("onTaskOpened", [t])
  779. }, gantt.close = function(t) {
  780.     gantt._set_item_state(t, !1), this.callEvent("onTaskClosed", [t])
  781. }, gantt._set_item_state = function(t, e) {
  782.     t && this._pull[t] && (this._pull[t].$open = e, gantt._refresh_on_toggle_element(t))
  783. }, gantt._refresh_on_toggle_element = function() {
  784.     this.refreshData()
  785. }, gantt._is_grid_visible = function() {
  786.     return this.config.grid_width && this.config.show_grid
  787. }, gantt._get_grid_width = function() {
  788.     return this._is_grid_visible() ? this._is_chart_visible() ? this.config.grid_width : this._x : 0
  789. }, gantt.moveTask = function(t, e, n) {
  790.     var a = arguments[3];
  791.     if (a) {
  792.         if (a === t) return;
  793.         n = this.getParent(a), e = this.getTaskIndex(a)
  794.     }
  795.     if (t != n) {
  796.         n = n || this.config.root_id;
  797.         var i = this.getTask(t),
  798.             s = this.getParent(i.id),
  799.             r = (this.getChildren(this.getParent(i.id)), this.getChildren(n));
  800.         if (-1 == e && (e = r.length + 1), s == n) {
  801.             var o = this.getTaskIndex(t);
  802.             if (o == e) return
  803.         }
  804.         if (this.callEvent("onBeforeTaskMove", [t, n, e]) !== !1) {
  805.             this._replace_branch_child(s, t), r = this.getChildren(n);
  806.             var l = r[e];
  807.             l ? r = r.slice(0, e).concat([t]).concat(r.slice(e)) : r.push(t), this.setParent(i, n), this._branches[n] = r, i.$level = this.calculateTaskLevel(i), i.$drop_target = 1 * e > 0 ? a ? (this.getTaskIndex(t) > this.getTaskIndex(a) ? "next:" : "") + a : "next:" + gantt.getPrevSibling(t) : r[1 * e + 1] ? r[1 * e + 1] : n, this.callEvent("onAfterTaskMove", [t, n, e]) && this.refreshData()
  808.         }
  809.     }
  810. }, gantt._init_dnd = function() {
  811.     var t = new dhtmlxDnD(this.$grid_data, {
  812.         updates_per_second: 60
  813.     });
  814.     dhtmlx.defined(this.config.dnd_sensitivity) && (t.config.sensitivity = this.config.dnd_sensitivity), t.attachEvent("onBeforeDragStart", dhtmlx.bind(function(e, n) {
  815.         var a = this._locateHTML(n);
  816.         if (!a) return !1;
  817.         this.hideQuickInfo && this._hideQuickInfo();
  818.         var i = this.locate(n),
  819.             s = gantt.getTask(i);
  820.         return gantt._is_readonly(s) ? !1 : (t.config.initial_open_state = s.$open, this.callEvent("onRowDragStart", [i, n.target || n.srcElement, n]) ? void 0 : !1)
  821.     }, this)), t.attachEvent("onAfterDragStart", dhtmlx.bind(function(e, n) {
  822.         var a = this._locateHTML(n);
  823.         t.config.marker.innerHTML = a.outerHTML, t.config.id = this.locate(n);
  824.         var i = this.getTask(t.config.id);
  825.         t.config.index = this.getTaskIndex(t.config.id), t.config.parent = i.parent, i.$open = !1, i.$transparent = !0, this.refreshData()
  826.     }, this)), t.lastTaskOfLevel = function(t) {
  827.         for (var e = gantt._order, n = gantt._pull, a = null, i = 0, s = e.length; s > i; i++) n[e[i]].$level == t && (a = n[e[i]]);
  828.         return a ? a.id : null
  829.     }, t._getGridPos = dhtmlx.bind(function(t) {
  830.         var e = this._get_position(this.$grid_data),
  831.             n = e.x,
  832.             a = t.pos.y - 10;
  833.         return a < e.y && (a = e.y), a > e.y + this.$grid_data.offsetHeight - this.config.row_height && (a = e.y + this.$grid_data.offsetHeight - this.config.row_height), e.x = n, e.y = a, e
  834.     }, this), t.attachEvent("onDragMove", dhtmlx.bind(function(e, n) {
  835.         function a(t, e) {
  836.             return t.$level == e.$level || gantt.config.order_branch_free
  837.         }
  838.         var i = t.config,
  839.             s = t._getGridPos(n);
  840.         i.marker.style.left = s.x + 10 + "px", i.marker.style.top = s.y + "px", s = t._getGridPos(n);
  841.         var r = (s.x, s.y),
  842.             o = document.elementFromPoint(s.x - document.body.scrollLeft + 1, r - document.body.scrollTop),
  843.             l = this.locate(o),
  844.             d = this.getTask(t.config.id);
  845.         if (this.isTaskExists(l) || (l = t.lastTaskOfLevel(gantt.config.order_branch_free ? d.$level : 0), l == t.config.id && (l = null)), this.isTaskExists(l)) {
  846.             var _ = gantt._get_position(o),
  847.                 c = this.getTask(l);
  848.             if (_.y + o.offsetHeight / 2 < r) {
  849.                 var g = this.getGlobalTaskIndex(c.id),
  850.                     h = this._pull[this._order[g + 1]];
  851.                 if (h) {
  852.                     if (h.id == d.id) return;
  853.                     c = h
  854.                 } else if (h = this._pull[this._order[g]], a(h, d) && h.id != d.id) return void this.moveTask(d.id, -1, this.getParent(h.id))
  855.             }
  856.             for (var g = this.getGlobalTaskIndex(c.id), u = this._pull[this._order[g - 1]], f = 1;
  857.                 (!u || u.id == c.id) && g - f >= 0;) u = this._pull[this._order[g - f]],
  858.             f++;
  859.             if (d.id == c.id) return;
  860.             a(c, d) && d.id != c.id ? this.moveTask(d.id, 0, 0, c.id) : c.$level != d.$level - 1 || gantt.getChildren(c.id).length ? u && a(u, d) && d.id != u.id && this.moveTask(d.id, -1, this.getParent(u.id)) : this.moveTask(d.id, 0, c.id)
  861.         }
  862.         return !0
  863.     }, this)), t.attachEvent("onDragEnd", dhtmlx.bind(function() {
  864.         var e = this.getTask(t.config.id);
  865.         this.callEvent("onBeforeRowDragEnd", [t.config.id, t.config.parent, t.config.index]) === !1 ? (this.moveTask(t.config.id, t.config.index, t.config.parent), e.$drop_target = null) : this.callEvent("onRowDragEnd", [t.config.id, e.$drop_target]), e.$transparent = !1, e.$open = t.config.initial_open_state, this.refreshData()
  866.     }, this))
  867. }, gantt.getGridColumns = function() {
  868.     return this.config.columns
  869. }, gantt._has_children = function(t) {
  870.     return this.getChildren(t).length > 0
  871. }, gantt._render_grid_header_resize = function() {
  872.     for (var t = this.getGridColumns(), e = 0, n = this.config.scale_height, a = (this._get_position(this.$grid_scale), 0); a < t.length; a++) {
  873.         var i = (a == t.length - 1, t[a]);
  874.         if (e += i.width, i.resize) {
  875.             var s = document.createElement("div");
  876.             s.className = "gantt_grid_column_resize_wrap", s.style.top = "0px", s.style.height = n + "px", s.innerHTML = "<div class='gantt_grid_column_resize'></div>", s.setAttribute(this.config.grid_resizer_column_attribute, a), this.$grid_scale.appendChild(s), s.style.left = Math.max(0, e - 1 - s.offsetWidth / 2) + "px"
  877.         }
  878.     }
  879.     if (this.config.grid_resize) {
  880.         var r = document.createElement("div");
  881.         r.className = "gantt_grid_resize_wrap", r.style.top = "0px", r.style.height = this.$grid.offsetHeight + "px", r.innerHTML = "<div class='gantt_grid_resize'></div>", r.setAttribute(this.config.grid_resizer_attribute, !0), this.$grid_scale.appendChild(r), r.style.left = Math.max(0, this.config.grid_width - 1 - r.offsetWidth / 2) + "px"
  882.     }
  883. }, gantt._init_resize = function() {
  884.     var t = new dhtmlxDnD(this.$grid_scale, {
  885.         updates_per_second: 60
  886.     });
  887.     dhtmlx.defined(this.config.dnd_sensitivity) && (t.config.sensitivity = this.config.dnd_sensitivity), t.attachEvent("onBeforeDragStart", dhtmlx.bind(function(t, e) {
  888.         var n = this._locateHTML(e, this.config.grid_resizer_column_attribute);
  889.         if (!n) return !1;
  890.         var a = this.locate(e, this.config.grid_resizer_column_attribute),
  891.             i = this.getGridColumns()[a];
  892.         return gantt.callEvent("onColumnResizeStart", [a, i]) === !1 ? !1 : void 0
  893.     }, this)), t.attachEvent("onAfterDragStart", dhtmlx.bind(function(e, n) {
  894.         var a = this.locate(n, this.config.grid_resizer_column_attribute);
  895.         t.config.marker.innerHTML = "", t.config.marker.className += " gantt_grid_resize_area", t.config.marker.style.height = this.$grid.offsetHeight + "px", t.config.marker.style.top = "0px", t.config.drag_index = a
  896.     }, this)), t.attachEvent("onDragMove", dhtmlx.bind(function() {
  897.         var e = t.config,
  898.             n = this.getGridColumns(),
  899.             a = this._get_position(this.$grid_scale),
  900.             i = parseInt(e.marker.style.left, 10),
  901.             s = this.config.min_grid_column_width,
  902.             r = this.$grid_data.offsetWidth - this.config.min_grid_column_width * (n.length - e.drag_index - 2),
  903.             o = 0,
  904.             l = 0;
  905.         i -= a.x - 1;
  906.         for (var d = 0; d < e.drag_index; d++) s += n[d].width, o += n[d].width;
  907.         return s > i && (i = s), this.config.keep_grid_width && i > r && (i = r), l = i - o, e.marker.style.top = a.y + "px", e.marker.style.left = a.x - 1 + o + "px", e.marker.style.width = l + "px", e.left = i - 1, gantt.callEvent("onColumnResize", [e.drag_index, n[e.drag_index], l - 1]), !0
  908.     }, this)), t.attachEvent("onDragEnd", dhtmlx.bind(function() {
  909.         for (var e = this.getGridColumns(), n = 0, a = parseInt(t.config.drag_index, 10), i = e[a], s = 0; a > s; s++) n += e[s].width;
  910.         var r = i.min_width && t.config.left - n < i.min_width ? i.min_width : t.config.left - n;
  911.         if (gantt.callEvent("onColumnResizeEnd", [a, i, r]) !== !1 && i.width != r) {
  912.             if (i.width = r, this.config.keep_grid_width)
  913.                 for (var s = a + 1, o = e.length; o > s; s++) e[s].width = "add" == e[s].name ? 1 * e[s].width || 44 : null;
  914.             else {
  915.                 for (var s = a, o = e.length; o > s; s++) n += e[s].width;
  916.                 this.config.grid_width = n
  917.             }
  918.             this.render()
  919.         }
  920.     }, this));
  921.     var e = new dhtmlxDnD(this.$grid, {
  922.         updates_per_second: 60
  923.     });
  924.     dhtmlx.defined(this.config.dnd_sensitivity) && (e.config.sensitivity = this.config.dnd_sensitivity), e.attachEvent("onBeforeDragStart", dhtmlx.bind(function(t, e) {
  925.         var n = this._locateHTML(e, this.config.grid_resizer_attribute);
  926.         return n ? gantt.callEvent("onGridResizeStart", [gantt.config.grid_width]) === !1 ? !1 : void 0 : !1
  927.     }, this)), e.attachEvent("onAfterDragStart", dhtmlx.bind(function() {
  928.         e.config.marker.innerHTML = "", e.config.marker.className += " gantt_grid_resize_area", e.config.marker.style.height = this.$grid.offsetHeight + "px", e.config.marker.style.top = "0px"
  929.     }, this)), e.attachEvent("onDragMove", dhtmlx.bind(function() {
  930.         for (var t = e.config, n = this.config.columns, a = this._get_position(this.$grid), i = parseInt(t.marker.style.left, 10), s = 0, r = 0; r < n.length; r++) n[r].hide || (s += n[r].min_width ? n[r].min_width : this.config.min_grid_column_width);
  931.         return i -= a.x - 1, s > i && (i = s), t.marker.style.top = a.y + "px", t.marker.style.left = a.x - 1 + "px", t.marker.style.width = i + "px", t.left = i - 1, gantt.callEvent("onGridResize", [this.config.grid_width, i - 1]), !0
  932.     }, this)), e.attachEvent("onDragEnd", dhtmlx.bind(function() {
  933.         for (var t = this.config.columns, n = 0, a = e.config.left, i = 0, s = t.length; s > i; i++) t[i].hide || (n += t[i].width);
  934.         for (var r = t.length, o = a - n, i = 0; r > i; i++)
  935.             if (!t[i].hide) {
  936.                 var l = Math.floor(o * (t[i].width / n));
  937.                 n -= t[i].width;
  938.                 var d = t[i].width + l;
  939.                 (t[i].min_width && d >= t[i].min_width || !t[i].min_width || d > t[i].width) && (o -= l, t[i].width = d)
  940.             }
  941.         for (var _ = o > 0 ? 1 : -1; o > 0 && 1 === _ || 0 > o && -1 === _;) {
  942.             var c = o;
  943.             for (i = 0; r > i; i++) {
  944.                 var g = t[i].width + _;
  945.                 if ((t[i].min_width && g >= t[i].min_width || !t[i].min_width || d > t[i].width) && (o -= _, t[i].width = g, 0 == o)) break
  946.             }
  947.             if (c == o) break
  948.         }
  949.         gantt.callEvent("onGridResizeEnd", [this.config.grid_width, a]) !== !1 && (this.config.grid_width = a, this.render())
  950.     }, this))
  951. }, gantt.attachEvent("onGanttRender", function() {
  952.     gantt._render_grid_header_resize()
  953. }),
  954. function() {
  955.     var t = gantt._has_children;
  956.     gantt._has_children = function(e) {
  957.         return t.apply(this, arguments) ? !0 : this.isTaskExists(e) ? this.getTask(e).$has_child : !1
  958.     }
  959. }(), gantt._need_dynamic_loading = function(t) {
  960.     if (gantt.config.branch_loading && gantt._load_url) {
  961.         var e = gantt.getUserData(t, "was_rendered");
  962.         if (!e && gantt._has_children(t)) return !0
  963.     }
  964.     return !1
  965. }, gantt._refresh_on_toggle_element = function(t) {
  966.     gantt._need_dynamic_loading(t) || this.refreshData()
  967. }, gantt.attachEvent("onTaskOpened", function(t) {
  968.     if (gantt.config.branch_loading && gantt._load_url && gantt._need_dynamic_loading(t)) {
  969.         var e = gantt._load_url;
  970.         e = e.replace(/(\?|&)?parent_id=.+&?/, "");
  971.         var n = e.indexOf("?") >= 0 ? "&" : "?",
  972.             a = 0;
  973.         this._cached_scroll_pos && this._cached_scroll_pos.y && (a = Math.max(this._cached_scroll_pos.y, 0)), gantt.load(e + n + "parent_id=" + encodeURIComponent(t), this._load_type, function() {
  974.             a && gantt.scrollTo(null, a)
  975.         }), gantt.setUserData(t, "was_rendered", !0)
  976.     }
  977. }), gantt.getGridColumns = function() {
  978.     for (var t = gantt.config.columns, e = [], n = 0; n < t.length; n++) t[n].hide || e.push(t[n]);
  979.     return e
  980. }, gantt.getGridColumn = function(t) {
  981.     for (var e = gantt.config.columns, n = 0; n < e.length; n++)
  982.         if (e[n].name == t) return e[n];
  983.     return null
  984. }, gantt._scale_helpers = {
  985.     getSum: function(t, e, n) {
  986.         void 0 === n && (n = t.length - 1), void 0 === e && (e = 0);
  987.         for (var a = 0, i = e; n >= i; i++) a += t[i];
  988.         return a
  989.     },
  990.     setSumWidth: function(t, e, n, a) {
  991.         var i = e.width;
  992.         void 0 === a && (a = i.length - 1), void 0 === n && (n = 0);
  993.         var s = a - n + 1;
  994.         if (!(n > i.length - 1 || 0 >= s || a > i.length - 1)) {
  995.             var r = this.getSum(i, n, a),
  996.                 o = t - r;
  997.             this.adjustSize(o, i, n, a), this.adjustSize(-o, i, a + 1), e.full_width = this.getSum(i)
  998.         }
  999.     },
  1000.     splitSize: function(t, e) {
  1001.         for (var n = [], a = 0; e > a; a++) n[a] = 0;
  1002.         return this.adjustSize(t, n), n
  1003.     },
  1004.     adjustSize: function(t, e, n, a) {
  1005.         n || (n = 0), void 0 === a && (a = e.length - 1);
  1006.         for (var i = a - n + 1, s = this.getSum(e, n, a), r = 0, o = n; a >= o; o++) {
  1007.             var l = Math.floor(t * (s ? e[o] / s : 1 / i));
  1008.             s -= e[o], t -= l, i--, e[o] += l, r += l
  1009.         }
  1010.         e[e.length - 1] += t
  1011.     },
  1012.     sortScales: function(t) {
  1013.         function e(t, e) {
  1014.             var n = new Date(1970, 0, 1);
  1015.             return gantt.date.add(n, e, t) - n
  1016.         }
  1017.         t.sort(function(t, n) {
  1018.             return e(t.unit, t.step) < e(n.unit, n.step) ? 1 : e(t.unit, t.step) > e(n.unit, n.step) ? -1 : 0
  1019.         })
  1020.     },
  1021.     primaryScale: function() {
  1022.         return gantt._init_template("date_scale"), {
  1023.             unit: gantt.config.scale_unit,
  1024.             step: gantt.config.step,
  1025.             template: gantt.templates.date_scale,
  1026.             date: gantt.config.date_scale,
  1027.             css: gantt.templates.scale_cell_class
  1028.         }
  1029.     },
  1030.     prepareConfigs: function(t, e, n, a) {
  1031.         for (var i = this.splitSize(a, t.length), s = n, r = [], o = t.length - 1; o >= 0; o--) {
  1032.             var l = o == t.length - 1,
  1033.                 d = this.initScaleConfig(t[o]);
  1034.             l && this.processIgnores(d), this.initColSizes(d, e, s, i[o]), this.limitVisibleRange(d), l && (s = d.full_width), r.unshift(d)
  1035.         }
  1036.         for (var o = 0; o < r.length - 1; o++) this.alineScaleColumns(r[r.length - 1], r[o]);
  1037.         for (var o = 0; o < r.length; o++) this.setPosSettings(r[o]);
  1038.         return r
  1039.     },
  1040.     setPosSettings: function(t) {
  1041.         for (var e = 0, n = t.trace_x.length; n > e; e++) t.left.push((t.width[e - 1] || 0) + (t.left[e - 1] || 0))
  1042.     },
  1043.     _ignore_time_config: function(t) {
  1044.         return this.config.skip_off_time ? !this.isWorkTime(t) : !1
  1045.     },
  1046.     processIgnores: function(t) {
  1047.         t.ignore_x = {}, t.display_count = t.count
  1048.     },
  1049.     initColSizes: function(t, e, n, a) {
  1050.         var i = n;
  1051.         t.height = a;
  1052.         var s = void 0 === t.display_count ? t.count : t.display_count;
  1053.         s || (s = 1), t.col_width = Math.floor(i / s), e && t.col_width < e && (t.col_width = e, i = t.col_width * s), t.width = [];
  1054.         for (var r = t.ignore_x || {}, o = 0; o < t.trace_x.length; o++) t.width[o] = r[t.trace_x[o].valueOf()] || t.display_count == t.count ? 0 : 1;
  1055.         this.adjustSize(i - this.getSum(t.width), t.width), t.full_width = this.getSum(t.width)
  1056.     },
  1057.     initScaleConfig: function(t) {
  1058.         var e = dhtmlx.mixin({
  1059.             count: 0,
  1060.             col_width: 0,
  1061.             full_width: 0,
  1062.             height: 0,
  1063.             width: [],
  1064.             left: [],
  1065.             trace_x: []
  1066.         }, t);
  1067.         return this.eachColumn(t.unit, t.step, function(t) {
  1068.             e.count++, e.trace_x.push(new Date(t))
  1069.         }), e
  1070.     },
  1071.     iterateScales: function(t, e, n, a, i) {
  1072.         for (var s = e.trace_x, r = t.trace_x, o = n || 0, l = a || r.length - 1, d = 0, _ = 1; _ < s.length; _++)
  1073.             for (var c = o; l >= c; c++) + r[c] != +s[_] || (i && i.apply(this, [d, _, o, c]), o = c, d = _)
  1074.     },
  1075.     alineScaleColumns: function(t, e, n, a) {
  1076.         this.iterateScales(t, e, n, a, function(n, a, i, s) {
  1077.             var r = this.getSum(t.width, i, s - 1),
  1078.                 o = this.getSum(e.width, n, a - 1);
  1079.             o != r && this.setSumWidth(r, e, n, a - 1)
  1080.         })
  1081.     },
  1082.     eachColumn: function(t, e, n) {
  1083.         var a = new Date(gantt._min_date),
  1084.             i = new Date(gantt._max_date);
  1085.         gantt.date[t + "_start"] && (a = gantt.date[t + "_start"](a));
  1086.         var s = new Date(a);
  1087.         for (+s >= +i && (i = gantt.date.add(s, e, t)); + i > +s;) {
  1088.             n.call(this, new Date(s));
  1089.             var r = s.getTimezoneOffset();
  1090.             s = gantt.date.add(s, e, t), s = gantt._correct_dst_change(s, r, e, t), gantt.date[t + "_start"] && (s = gantt.date[t + "_start"](s))
  1091.         }
  1092.     },
  1093.     limitVisibleRange: function(t) {
  1094.         var e = t.trace_x,
  1095.             n = 0,
  1096.             a = t.width.length - 1,
  1097.             i = 0;
  1098.         if (+e[0] < +gantt._min_date && n != a) {
  1099.             var s = Math.floor(t.width[0] * ((e[1] - gantt._min_date) / (e[1] - e[0])));
  1100.             i += t.width[0] - s, t.width[0] = s, e[0] = new Date(gantt._min_date)
  1101.         }
  1102.         var r = e.length - 1,
  1103.             o = e[r],
  1104.             l = gantt.date.add(o, t.step, t.unit);
  1105.         if (+l > +gantt._max_date && r > 0) {
  1106.             var s = t.width[r] - Math.floor(t.width[r] * ((l - gantt._max_date) / (l - o)));
  1107.             i += t.width[r] - s, t.width[r] = s
  1108.         }
  1109.         if (i) {
  1110.             for (var d = this.getSum(t.width), _ = 0, c = 0; c < t.width.length; c++) {
  1111.                 var g = Math.floor(i * (t.width[c] / d));
  1112.                 t.width[c] += g, _ += g
  1113.             }
  1114.             this.adjustSize(i - _, t.width)
  1115.         }
  1116.     }
  1117. }, gantt._scale_helpers.processIgnores = function(t) {
  1118.     var e = t.count;
  1119.     if (t.ignore_x = {}, gantt.ignore_time || gantt.config.skip_off_time) {
  1120.         var n = gantt.ignore_time || function() {
  1121.                 return !1
  1122.             };
  1123.         e = 0;
  1124.         for (var a = 0; a < t.trace_x.length; a++) n.call(gantt, t.trace_x[a]) || this._ignore_time_config.call(gantt, t.trace_x[a]) ? (t.ignore_x[t.trace_x[a].valueOf()] = !0, t.ignored_colls = !0) : e++
  1125.     }
  1126.     t.display_count = e
  1127. }, gantt._tasks_dnd = {
  1128.     drag: null,
  1129.     _events: {
  1130.         before_start: {},
  1131.         before_finish: {},
  1132.         after_finish: {}
  1133.     },
  1134.     _handlers: {},
  1135.     init: function() {
  1136.         this.clear_drag_state();
  1137.         var t = gantt.config.drag_mode;
  1138.         this.set_actions();
  1139.         var e = {
  1140.             before_start: "onBeforeTaskDrag",
  1141.             before_finish: "onBeforeTaskChanged",
  1142.             after_finish: "onAfterTaskDrag"
  1143.         };
  1144.         for (var n in this._events)
  1145.             for (var a in t) this._events[n][a] = e[n];
  1146.         this._handlers[t.move] = this._move, this._handlers[t.resize] = this._resize, this._handlers[t.progress] = this._resize_progress
  1147.     },
  1148.     set_actions: function() {
  1149.         var t = gantt.$task_data;
  1150.         dhtmlxEvent(t, "mousemove", dhtmlx.bind(function(t) {
  1151.             this.on_mouse_move(t || event)
  1152.         }, this)), dhtmlxEvent(t, "mousedown", dhtmlx.bind(function(t) {
  1153.             this.on_mouse_down(t || event)
  1154.         }, this)), dhtmlxEvent(t, "mouseup", dhtmlx.bind(function(t) {
  1155.             this.on_mouse_up(t || event)
  1156.         }, this))
  1157.     },
  1158.     clear_drag_state: function() {
  1159.         this.drag = {
  1160.             id: null,
  1161.             mode: null,
  1162.             pos: null,
  1163.             start_x: null,
  1164.             start_y: null,
  1165.             obj: null,
  1166.             left: null
  1167.         }
  1168.     },
  1169.     _resize: function(t, e, n) {
  1170.         var a = gantt.config,
  1171.             i = this._drag_task_coords(t, n);
  1172.         n.left ? (t.start_date = gantt.dateFromPos(i.start + e), t.start_date || (t.start_date = new Date(gantt.getState().min_date))) : (t.end_date = gantt.dateFromPos(i.end + e), t.end_date || (t.end_date = new Date(gantt.getState().max_date))), t.end_date - t.start_date < a.min_duration && (n.left ? t.start_date = gantt.calculateEndDate(t.end_date, -1) : t.end_date = gantt.calculateEndDate(t.start_date, 1)), gantt._init_task_timing(t)
  1173.     },
  1174.     _resize_progress: function(t, e, n) {
  1175.         var a = this._drag_task_coords(t, n),
  1176.             i = Math.max(0, n.pos.x - a.start);
  1177.         t.progress = Math.min(1, i / (a.end - a.start))
  1178.     },
  1179.     _move: function(t, e, n) {
  1180.         var a = this._drag_task_coords(t, n),
  1181.             i = gantt.dateFromPos(a.start + e),
  1182.             s = gantt.dateFromPos(a.end + e);
  1183.         i ? s ? (t.start_date = i, t.end_date = s) : (t.end_date = new Date(gantt.getState().max_date), t.start_date = gantt.dateFromPos(gantt.posFromDate(t.end_date) - (a.end - a.start))) : (t.start_date = new Date(gantt.getState().min_date), t.end_date = gantt.dateFromPos(gantt.posFromDate(t.start_date) + (a.end - a.start)))
  1184.     },
  1185.     _drag_task_coords: function(t, e) {
  1186.         var n = e.obj_s_x = e.obj_s_x || gantt.posFromDate(t.start_date),
  1187.             a = e.obj_e_x = e.obj_e_x || gantt.posFromDate(t.end_date);
  1188.         return {
  1189.             start: n,
  1190.             end: a
  1191.         }
  1192.     },
  1193.     on_mouse_move: function(t) {
  1194.         this.drag.start_drag && this._start_dnd(t);
  1195.         var e = this.drag;
  1196.         if (e.mode) {
  1197.             if (!gantt._checkTimeout(this, 40)) return;
  1198.             this._update_on_move(t)
  1199.         }
  1200.     },
  1201.     _update_on_move: function(t) {
  1202.         var e = this.drag;
  1203.         if (e.mode) {
  1204.             var n = gantt._get_mouse_pos(t);
  1205.             if (e.pos && e.pos.x == n.x) return;
  1206.             e.pos = n;
  1207.             var a = gantt.dateFromPos(n.x);
  1208.             if (!a || isNaN(a.getTime())) return;
  1209.             var i = n.x - e.start_x,
  1210.                 s = gantt.getTask(e.id);
  1211.             if (this._handlers[e.mode]) {
  1212.                 var r = dhtmlx.mixin({}, s),
  1213.                     o = dhtmlx.mixin({}, s);
  1214.                 this._handlers[e.mode].apply(this, [o, i, e]), dhtmlx.mixin(s, o, !0), gantt._update_parents(e.id, !0), gantt.callEvent("onTaskDrag", [s.id, e.mode, o, r, t]), dhtmlx.mixin(s, o, !0), gantt._update_parents(e.id), gantt.refreshTask(e.id)
  1215.             }
  1216.         }
  1217.     },
  1218.     on_mouse_down: function(t, e) {
  1219.         if (2 != t.button) {
  1220.             var n = gantt.locate(t),
  1221.                 a = null;
  1222.             if (gantt.isTaskExists(n) && (a = gantt.getTask(n)), !gantt._is_readonly(a) && !this.drag.mode) {
  1223.                 this.clear_drag_state(), e = e || t.target || t.srcElement;
  1224.                 var i = gantt._getClassName(e);
  1225.                 if (!i || !this._get_drag_mode(i)) return e.parentNode ? this.on_mouse_down(t, e.parentNode) : void 0;
  1226.                 var s = this._get_drag_mode(i);
  1227.                 if (s)
  1228.                     if (s.mode && s.mode != gantt.config.drag_mode.ignore && gantt.config["drag_" + s.mode]) {
  1229.                         if (n = gantt.locate(e), a = dhtmlx.copy(gantt.getTask(n) || {}), gantt._is_readonly(a)) return this.clear_drag_state(), !1;
  1230.                         if (gantt._is_flex_task(a) && s.mode != gantt.config.drag_mode.progress) return void this.clear_drag_state();
  1231.                         s.id = n;
  1232.                         var r = gantt._get_mouse_pos(t);
  1233.                         s.start_x = r.x, s.start_y = r.y, s.obj = a, this.drag.start_drag = s
  1234.                     } else this.clear_drag_state();
  1235.                     else if (gantt.checkEvent("onMouseDown") && gantt.callEvent("onMouseDown", [i.split(" ")[0]]) && e.parentNode) return this.on_mouse_down(t, e.parentNode)
  1236.             }
  1237.         }
  1238.     },
  1239.     _fix_dnd_scale_time: function(t, e) {
  1240.         function n(t) {
  1241.             gantt.isWorkTime(t.start_date) || (t.start_date = gantt.calculateEndDate(t.start_date, -1, gantt.config.duration_unit))
  1242.         }
  1243.  
  1244.         function a(t) {
  1245.             gantt.isWorkTime(new Date(t.end_date - 1)) || (t.end_date = gantt.calculateEndDate(t.end_date, 1, gantt.config.duration_unit))
  1246.         }
  1247.         var i = gantt._tasks.unit,
  1248.             s = gantt._tasks.step;
  1249.         gantt.config.round_dnd_dates || (i = "minute", s = gantt.config.time_step), e.mode == gantt.config.drag_mode.resize ? e.left ? (t.start_date = gantt.roundDate({
  1250.             date: t.start_date,
  1251.             unit: i,
  1252.             step: s
  1253.         }), n(t)) : (t.end_date = gantt.roundDate({
  1254.             date: t.end_date,
  1255.             unit: i,
  1256.             step: s
  1257.         }), a(t)) : e.mode == gantt.config.drag_mode.move && (t.start_date = gantt.roundDate({
  1258.             date: t.start_date,
  1259.             unit: i,
  1260.             step: s
  1261.         }), n(t), t.end_date = gantt.calculateEndDate(t.start_date, t.duration, gantt.config.duration_unit))
  1262.     },
  1263.     _fix_working_times: function(t, e) {
  1264.         var e = e || {
  1265.             mode: gantt.config.drag_mode.move
  1266.         };
  1267.         gantt.config.work_time && gantt.config.correct_work_time && (e.mode == gantt.config.drag_mode.resize ? e.left ? t.start_date = gantt.getClosestWorkTime({
  1268.             date: t.start_date,
  1269.             dir: "future"
  1270.         }) : t.end_date = gantt.getClosestWorkTime({
  1271.             date: t.end_date,
  1272.             dir: "past"
  1273.         }) : e.mode == gantt.config.drag_mode.move && gantt.correctTaskWorkTime(t))
  1274.     },
  1275.     on_mouse_up: function(t) {
  1276.         var e = this.drag;
  1277.         if (e.mode && e.id) {
  1278.             var n = gantt.getTask(e.id);
  1279.             if (gantt.config.work_time && gantt.config.correct_work_time && this._fix_working_times(n, e), this._fix_dnd_scale_time(n, e), gantt._init_task_timing(n), this._fireEvent("before_finish", e.mode, [e.id, e.mode, dhtmlx.copy(e.obj), t])) {
  1280.                 var a = e.id;
  1281.                 gantt._init_task_timing(n), this._fireEvent("after_finish", e.mode, [a, e.mode, t]), this.clear_drag_state(), gantt.updateTask(n.id)
  1282.             } else e.obj._dhx_changed = !1, dhtmlx.mixin(n, e.obj, !0), gantt.updateTask(n.id)
  1283.         }
  1284.         this.clear_drag_state()
  1285.     },
  1286.     _get_drag_mode: function(t) {
  1287.         var e = gantt.config.drag_mode,
  1288.             n = (t || "").split(" "),
  1289.             a = n[0],
  1290.             i = {
  1291.                 mode: null,
  1292.                 left: null
  1293.             };
  1294.         switch (a) {
  1295.             case "gantt_task_line":
  1296.             case "gantt_task_content":
  1297.                 i.mode = e.move;
  1298.                 break;
  1299.             case "gantt_task_drag":
  1300.                 i.mode = e.resize, i.left = n[1] && -1 !== n[1].indexOf("left", n[1].length - "left".length) ? !0 : !1;
  1301.                 break;
  1302.             case "gantt_task_progress_drag":
  1303.                 i.mode = e.progress;
  1304.                 break;
  1305.             case "gantt_link_control":
  1306.             case "gantt_link_point":
  1307.                 i.mode = e.ignore;
  1308.                 break;
  1309.             default:
  1310.                 i = null
  1311.         }
  1312.         return i
  1313.     },
  1314.     _start_dnd: function(t) {
  1315.         var e = this.drag = this.drag.start_drag;
  1316.         delete e.start_drag;
  1317.         var n = gantt.config,
  1318.             a = e.id;
  1319.         n["drag_" + e.mode] && gantt.callEvent("onBeforeDrag", [a, e.mode, t]) && this._fireEvent("before_start", e.mode, [a, e.mode, t]) ? delete e.start_drag : this.clear_drag_state()
  1320.     },
  1321.     _fireEvent: function(t, e, n) {
  1322.         dhtmlx.assert(this._events[t], "Invalid stage:{" + t + "}");
  1323.         var a = this._events[t][e];
  1324.         return dhtmlx.assert(a, "Unknown after drop mode:{" + e + "}"), dhtmlx.assert(n, "Invalid event arguments"), gantt.checkEvent(a) ? gantt.callEvent(a, n) : !0
  1325.     }
  1326. }, gantt.roundTaskDates = function(t) {
  1327.     var e = gantt._tasks_dnd.drag;
  1328.     e || (e = {
  1329.         mode: gantt.config.drag_mode.move
  1330.     }), gantt._tasks_dnd._fix_dnd_scale_time(t, e)
  1331. }, gantt._render_link = function(t) {
  1332.     for (var e = this.getLink(t), n = gantt._get_link_renderers(), a = 0; a < n.length; a++) n[a].render_item(e)
  1333. }, gantt._get_link_type = function(t, e) {
  1334.     var n = null;
  1335.     return t && e ? n = gantt.config.links.start_to_start : !t && e ? n = gantt.config.links.finish_to_start : t || e ? t && !e && (n = gantt.config.links.start_to_finish) : n = gantt.config.links.finish_to_finish, n
  1336. }, gantt.isLinkAllowed = function(t, e, n, a) {
  1337.     var i = null;
  1338.     if (i = "object" == typeof t ? t : {
  1339.         source: t,
  1340.         target: e,
  1341.         type: this._get_link_type(n, a)
  1342.     }, !i) return !1;
  1343.     if (!(i.source && i.target && i.type)) return !1;
  1344.     if (i.source == i.target) return !1;
  1345.     var s = !0;
  1346.     return this.checkEvent("onLinkValidation") && (s = this.callEvent("onLinkValidation", [i])), s
  1347. }, gantt._render_link_element = function(t) {
  1348.     var e = this._path_builder.get_points(t),
  1349.         n = gantt._drawer,
  1350.         a = n.get_lines(e),
  1351.         i = document.createElement("div"),
  1352.         s = "gantt_task_link";
  1353.     t.color && (s += " gantt_link_inline_color");
  1354.     var r = this.templates.link_class ? this.templates.link_class(t) : "";
  1355.     r && (s += " " + r), this.config.highlight_critical_path && this.isCriticalLink && this.isCriticalLink(t) && (s += " gantt_critical_link"), i.className = s, i.setAttribute(gantt.config.link_attribute, t.id);
  1356.     for (var o = 0; o < a.length; o++) {
  1357.         o == a.length - 1 && (a[o].size -= gantt.config.link_arrow_size);
  1358.         var l = n.render_line(a[o], a[o + 1]);
  1359.         t.color && (l.firstChild.style.backgroundColor = t.color), i.appendChild(l)
  1360.     }
  1361.     var d = a[a.length - 1].direction,
  1362.         _ = gantt._render_link_arrow(e[e.length - 1], d);
  1363.     return t.color && (_.style.borderColor = t.color), i.appendChild(_), i
  1364. }, gantt._render_link_arrow = function(t, e) {
  1365.     var n = document.createElement("div"),
  1366.         a = gantt._drawer,
  1367.         i = t.y,
  1368.         s = t.x,
  1369.         r = gantt.config.link_arrow_size,
  1370.         o = gantt.config.row_height,
  1371.         l = "gantt_link_arrow gantt_link_arrow_" + e;
  1372.     switch (e) {
  1373.         case a.dirs.right:
  1374.             i -= (r - o) / 2, s -= r;
  1375.             break;
  1376.         case a.dirs.left:
  1377.             i -= (r - o) / 2;
  1378.             break;
  1379.         case a.dirs.up:
  1380.             s -= r;
  1381.             break;
  1382.         case a.dirs.down:
  1383.             i += 2 * r, s -= r
  1384.     }
  1385.     return n.style.cssText = ["top:" + i + "px", "left:" + s + "px"].join(";"), n.className = l, n
  1386. }, gantt._drawer = {
  1387.     current_pos: null,
  1388.     dirs: {
  1389.         left: "left",
  1390.         right: "right",
  1391.         up: "up",
  1392.         down: "down"
  1393.     },
  1394.     path: [],
  1395.     clear: function() {
  1396.         this.current_pos = null, this.path = []
  1397.     },
  1398.     point: function(t) {
  1399.         this.current_pos = dhtmlx.copy(t)
  1400.     },
  1401.     get_lines: function(t) {
  1402.         this.clear(), this.point(t[0]);
  1403.         for (var e = 1; e < t.length; e++) this.line_to(t[e]);
  1404.         return this.get_path()
  1405.     },
  1406.     line_to: function(t) {
  1407.         var e = dhtmlx.copy(t),
  1408.             n = this.current_pos,
  1409.             a = this._get_line(n, e);
  1410.         this.path.push(a), this.current_pos = e
  1411.     },
  1412.     get_path: function() {
  1413.         return this.path
  1414.     },
  1415.     get_wrapper_sizes: function(t) {
  1416.         var e, n = gantt.config.link_wrapper_width,
  1417.             a = (gantt.config.link_line_width, t.y + (gantt.config.row_height - n) / 2);
  1418.         switch (t.direction) {
  1419.             case this.dirs.left:
  1420.                 e = {
  1421.                     top: a,
  1422.                     height: n,
  1423.                     lineHeight: n,
  1424.                     left: t.x - t.size - n / 2,
  1425.                     width: t.size + n
  1426.                 };
  1427.                 break;
  1428.             case this.dirs.right:
  1429.                 e = {
  1430.                     top: a,
  1431.                     lineHeight: n,
  1432.                     height: n,
  1433.                     left: t.x - n / 2,
  1434.                     width: t.size + n
  1435.                 };
  1436.                 break;
  1437.             case this.dirs.up:
  1438.                 e = {
  1439.                     top: a - t.size,
  1440.                     lineHeight: t.size + n,
  1441.                     height: t.size + n,
  1442.                     left: t.x - n / 2,
  1443.                     width: n
  1444.                 };
  1445.                 break;
  1446.             case this.dirs.down:
  1447.                 e = {
  1448.                     top: a,
  1449.                     lineHeight: t.size + 2 * n,
  1450.                     height: t.size + 2 * n,
  1451.                     left: t.x - n / 2,
  1452.                     width: n
  1453.                 }
  1454.         }
  1455.         return e
  1456.     },
  1457.     get_line_sizes: function(t) {
  1458.         var e, n = gantt.config.link_line_width,
  1459.             a = gantt.config.link_wrapper_width,
  1460.             i = t.size + n;
  1461.         switch (t.direction) {
  1462.             case this.dirs.left:
  1463.             case this.dirs.right:
  1464.                 e = {
  1465.                     height: n,
  1466.                     width: i,
  1467.                     marginTop: (a - n) / 2,
  1468.                     marginLeft: (a - n) / 2
  1469.                 };
  1470.                 break;
  1471.             case this.dirs.up:
  1472.             case this.dirs.down:
  1473.                 e = {
  1474.                     height: i,
  1475.                     width: n,
  1476.                     marginTop: (a - n) / 2,
  1477.                     marginLeft: (a - n) / 2
  1478.                 }
  1479.         }
  1480.         return e
  1481.     },
  1482.     render_line: function(t) {
  1483.         var e = this.get_wrapper_sizes(t),
  1484.             n = document.createElement("div");
  1485.         n.style.cssText = ["top:" + e.top + "px", "left:" + e.left + "px", "height:" + e.height + "px", "width:" + e.width + "px"].join(";"), n.className = "gantt_line_wrapper";
  1486.         var a = this.get_line_sizes(t),
  1487.             i = document.createElement("div");
  1488.         return i.style.cssText = ["height:" + a.height + "px", "width:" + a.width + "px", "margin-top:" + a.marginTop + "px", "margin-left:" + a.marginLeft + "px"].join(";"), i.className = "gantt_link_line_" + t.direction, n.appendChild(i), n
  1489.     },
  1490.     _get_line: function(t, e) {
  1491.         var n = this.get_direction(t, e),
  1492.             a = {
  1493.                 x: t.x,
  1494.                 y: t.y,
  1495.                 direction: this.get_direction(t, e)
  1496.             };
  1497.         return a.size = Math.abs(n == this.dirs.left || n == this.dirs.right ? t.x - e.x : t.y - e.y), a
  1498.     },
  1499.     get_direction: function(t, e) {
  1500.         var n = 0;
  1501.         return n = e.x < t.x ? this.dirs.left : e.x > t.x ? this.dirs.right : e.y > t.y ? this.dirs.down : this.dirs.up
  1502.     }
  1503. }, gantt._y_from_ind = function(t) {
  1504.     return t * gantt.config.row_height
  1505. }, gantt._path_builder = {
  1506.     path: [],
  1507.     clear: function() {
  1508.         this.path = []
  1509.     },
  1510.     current: function() {
  1511.         return this.path[this.path.length - 1]
  1512.     },
  1513.     point: function(t) {
  1514.         return t ? (this.path.push(dhtmlx.copy(t)), t) : this.current()
  1515.     },
  1516.     point_to: function(t, e, n) {
  1517.         n = n ? {
  1518.             x: n.x,
  1519.             y: n.y
  1520.         } : dhtmlx.copy(this.point());
  1521.         var a = gantt._drawer.dirs;
  1522.         switch (t) {
  1523.             case a.left:
  1524.                 n.x -= e;
  1525.                 break;
  1526.             case a.right:
  1527.                 n.x += e;
  1528.                 break;
  1529.             case a.up:
  1530.                 n.y -= e;
  1531.                 break;
  1532.             case a.down:
  1533.                 n.y += e
  1534.         }
  1535.         return this.point(n)
  1536.     },
  1537.     get_points: function(t) {
  1538.         var e = this.get_endpoint(t),
  1539.             n = gantt.config,
  1540.             a = e.e_y - e.y,
  1541.             i = e.e_x - e.x,
  1542.             s = gantt._drawer.dirs;
  1543.         this.clear(), this.point({
  1544.             x: e.x,
  1545.             y: e.y
  1546.         });
  1547.         var r = 2 * n.link_arrow_size,
  1548.             o = e.e_x > e.x;
  1549.         if (t.type == gantt.config.links.start_to_start) this.point_to(s.left, r), o ? (this.point_to(s.down, a), this.point_to(s.right, i)) : (this.point_to(s.right, i), this.point_to(s.down, a)), this.point_to(s.right, r);
  1550.         else if (t.type == gantt.config.links.finish_to_start)
  1551.             if (o = e.e_x > e.x + 2 * r, this.point_to(s.right, r), o) i -= r, this.point_to(s.down, a), this.point_to(s.right, i);
  1552.             else {
  1553.                 i -= 2 * r;
  1554.                 var l = a > 0 ? 1 : -1;
  1555.                 this.point_to(s.down, l * (n.row_height / 2)), this.point_to(s.right, i), this.point_to(s.down, l * (Math.abs(a) - n.row_height / 2)), this.point_to(s.right, r)
  1556.             } else if (t.type == gantt.config.links.finish_to_finish) this.point_to(s.right, r), o ? (this.point_to(s.right, i), this.point_to(s.down, a)) : (this.point_to(s.down, a), this.point_to(s.right, i)), this.point_to(s.left, r);
  1557.         else if (t.type == gantt.config.links.start_to_finish)
  1558.             if (o = e.e_x > e.x - 2 * r, this.point_to(s.left, r), o) {
  1559.                 i += 2 * r;
  1560.                 var l = a > 0 ? 1 : -1;
  1561.                 this.point_to(s.down, l * (n.row_height / 2)), this.point_to(s.right, i), this.point_to(s.down, l * (Math.abs(a) - n.row_height / 2)), this.point_to(s.left, r)
  1562.             } else i += r, this.point_to(s.down, a), this.point_to(s.right, i);
  1563.         return this.path
  1564.     },
  1565.     get_endpoint: function(t) {
  1566.         var e = gantt.config.links,
  1567.             n = !1,
  1568.             a = !1;
  1569.         t.type == e.start_to_start ? n = a = !0 : t.type == e.finish_to_finish ? n = a = !1 : t.type == e.finish_to_start ? (n = !1, a = !0) : t.type == e.start_to_finish ? (n = !0, a = !1) : dhtmlx.assert(!1, "Invalid link type");
  1570.         var i = gantt._get_task_visible_pos(gantt._pull[t.source], n),
  1571.             s = gantt._get_task_visible_pos(gantt._pull[t.target], a);
  1572.         return {
  1573.             x: i.x,
  1574.             e_x: s.x,
  1575.             y: i.y,
  1576.             e_y: s.y
  1577.         }
  1578.     }
  1579. }, gantt._init_links_dnd = function() {
  1580.     function t(t, e, n) {
  1581.         var a = gantt._get_task_pos(t, !! e);
  1582.         return a.y += gantt._get_task_height() / 2, n = n || 0, a.x += (e ? -1 : 1) * n, a
  1583.     }
  1584.  
  1585.     function e(t) {
  1586.         var e = a(),
  1587.             n = ["gantt_link_tooltip"];
  1588.         e.from && e.to && n.push(gantt.isLinkAllowed(e.from, e.to, e.from_start, e.to_start) ? "gantt_allowed_link" : "gantt_invalid_link");
  1589.         var i = gantt.templates.drag_link_class(e.from, e.from_start, e.to, e.to_start);
  1590.         i && n.push(i);
  1591.         var s = "<div class='" + i + "'>" + gantt.templates.drag_link(e.from, e.from_start, e.to, e.to_start) + "</div>";
  1592.         t.innerHTML = s
  1593.     }
  1594.  
  1595.     function n(t, e) {
  1596.         t.style.left = e.x + 5 + "px", t.style.top = e.y + 5 + "px"
  1597.     }
  1598.  
  1599.     function a() {
  1600.         return {
  1601.             from: gantt._link_source_task,
  1602.             to: gantt._link_target_task,
  1603.             from_start: gantt._link_source_task_start,
  1604.             to_start: gantt._link_target_task_start
  1605.         }
  1606.     }
  1607.  
  1608.     function i() {
  1609.         gantt._link_source_task = gantt._link_source_task_start = gantt._link_target_task = null, gantt._link_target_task_start = !0
  1610.     }
  1611.  
  1612.     function s(t, e, n, i) {
  1613.         var s = l(),
  1614.             d = a(),
  1615.             _ = ["gantt_link_direction"];
  1616.         gantt.templates.link_direction_class && _.push(gantt.templates.link_direction_class(d.from, d.from_start, d.to, d.to_start));
  1617.         var c = Math.sqrt(Math.pow(n - t, 2) + Math.pow(i - e, 2));
  1618.         if (c = Math.max(0, c - 3)) {
  1619.             s.className = _.join(" ");
  1620.             var g = (i - e) / (n - t),
  1621.                 h = Math.atan(g);
  1622.             2 == o(t, n, e, i) ? h += Math.PI : 3 == o(t, n, e, i) && (h -= Math.PI);
  1623.             var u = Math.sin(h),
  1624.                 f = Math.cos(h),
  1625.                 p = Math.round(e),
  1626.                 v = Math.round(t),
  1627.                 m = ["-webkit-transform: rotate(" + h + "rad)", "-moz-transform: rotate(" + h + "rad)", "-ms-transform: rotate(" + h + "rad)", "-o-transform: rotate(" + h + "rad)", "transform: rotate(" + h + "rad)", "width:" + Math.round(c) + "px"];
  1628.             if (-1 != window.navigator.userAgent.indexOf("MSIE 8.0")) {
  1629.                 m.push('-ms-filter: "' + r(u, f) + '"');
  1630.                 var k = Math.abs(Math.round(t - n)),
  1631.                     x = Math.abs(Math.round(i - e));
  1632.                 switch (o(t, n, e, i)) {
  1633.                     case 1:
  1634.                         p -= x;
  1635.                         break;
  1636.                     case 2:
  1637.                         v -= k, p -= x;
  1638.                         break;
  1639.                     case 3:
  1640.                         v -= k
  1641.                 }
  1642.             }
  1643.             m.push("top:" + p + "px"), m.push("left:" + v + "px"), s.style.cssText = m.join(";")
  1644.         }
  1645.     }
  1646.  
  1647.     function r(t, e) {
  1648.         return "progid:DXImageTransform.Microsoft.Matrix(M11 = " + e + ",M12 = -" + t + ",M21 = " + t + ",M22 = " + e + ",SizingMethod = 'auto expand')"
  1649.     }
  1650.  
  1651.     function o(t, e, n, a) {
  1652.         return e >= t ? n >= a ? 1 : 4 : n >= a ? 2 : 3
  1653.     }
  1654.  
  1655.     function l() {
  1656.         return _._direction || (_._direction = document.createElement("div"), gantt.$task_links.appendChild(_._direction)), _._direction
  1657.     }
  1658.  
  1659.     function d() {
  1660.         _._direction && (_._direction.parentNode && _._direction.parentNode.removeChild(_._direction), _._direction = null)
  1661.     }
  1662.     var _ = new dhtmlxDnD(this.$task_bars, {
  1663.         sensitivity: 0,
  1664.         updates_per_second: 60
  1665.     }),
  1666.         c = "task_left",
  1667.         g = "task_right",
  1668.         h = "gantt_link_point",
  1669.         u = "gantt_link_control";
  1670.     _.attachEvent("onBeforeDragStart", dhtmlx.bind(function(e, n) {
  1671.         var a = n.target || n.srcElement;
  1672.         if (i(), gantt.getState().drag_id) return !1;
  1673.         if (gantt._locate_css(a, h)) {
  1674.             gantt._locate_css(a, c) && (gantt._link_source_task_start = !0);
  1675.             var s = gantt._link_source_task = this.locate(n),
  1676.                 r = gantt.getTask(s);
  1677.             if (gantt._is_readonly(r)) return i(), !1;
  1678.             var o = 0;
  1679.             return gantt._get_safe_type(r.type) == gantt.config.types.milestone && (o = (gantt._get_visible_milestone_width() - gantt._get_milestone_width()) / 2), this._dir_start = t(r, !! gantt._link_source_task_start, o), !0
  1680.         }
  1681.         return !1
  1682.     }, this)), _.attachEvent("onAfterDragStart", dhtmlx.bind(function() {
  1683.         e(_.config.marker)
  1684.     }, this)), _.attachEvent("onDragMove", dhtmlx.bind(function(a, i) {
  1685.         var r = _.config,
  1686.             o = _.getPosition(i);
  1687.         n(r.marker, o);
  1688.         var l = gantt._is_link_drop_area(i),
  1689.             d = gantt._link_target_task,
  1690.             c = gantt._link_landing,
  1691.             h = gantt._link_target_task_start,
  1692.             f = gantt.locate(i),
  1693.             p = !0;
  1694.         if (l && (p = !gantt._locate_css(i, g), l = !! f), gantt._link_target_task = f, gantt._link_landing = l, gantt._link_target_task_start = p, l) {
  1695.             var v = gantt.getTask(f),
  1696.                 m = gantt._locate_css(i, u),
  1697.                 k = 0;
  1698.             m && (k = Math.floor(m.offsetWidth / 2)), this._dir_end = t(v, !! gantt._link_target_task_start, k)
  1699.         } else this._dir_end = gantt._get_mouse_pos(i);
  1700.         var x = !(c == l && d == f && h == p);
  1701.         return x && (d && gantt.refreshTask(d, !1), f && gantt.refreshTask(f, !1)), x && e(r.marker), s(this._dir_start.x, this._dir_start.y, this._dir_end.x, this._dir_end.y), !0
  1702.     }, this)), _.attachEvent("onDragEnd", dhtmlx.bind(function() {
  1703.         var t = a();
  1704.         if (t.from && t.to && t.from != t.to) {
  1705.             var e = gantt._get_link_type(t.from_start, t.to_start),
  1706.                 n = {
  1707.                     source: t.from,
  1708.                     target: t.to,
  1709.                     type: e
  1710.                 };
  1711.             n.type && gantt.isLinkAllowed(n) && gantt.addLink(n)
  1712.         }
  1713.         i(), t.from && gantt.refreshTask(t.from, !1), t.to && gantt.refreshTask(t.to, !1), d()
  1714.     }, this)), gantt._is_link_drop_area = function(t) {
  1715.         return !!gantt._locate_css(t, u)
  1716.     }
  1717. }, gantt._get_link_state = function() {
  1718.     return {
  1719.         link_landing_area: this._link_landing,
  1720.         link_target_id: this._link_target_task,
  1721.         link_target_start: this._link_target_task_start,
  1722.         link_source_id: this._link_source_task,
  1723.         link_source_start: this._link_source_task_start
  1724.     }
  1725. }, gantt._init_tasks = function() {
  1726.     function t(t, e, n, a) {
  1727.         for (var i = 0; i < t.length; i++) t[i].change_id(e, n), t[i].render_item(a)
  1728.     }
  1729.     this._tasks = {
  1730.         col_width: this.config.columnWidth,
  1731.         width: [],
  1732.         full_width: 0,
  1733.         trace_x: [],
  1734.         rendered: {}
  1735.     }, this._click.gantt_task_link = dhtmlx.bind(function(t) {
  1736.         var e = this.locate(t, gantt.config.link_attribute);
  1737.         e && this.callEvent("onLinkClick", [e, t])
  1738.     }, this), this._click.gantt_scale_cell = dhtmlx.bind(function(t) {
  1739.         var e = gantt._get_mouse_pos(t),
  1740.             n = gantt.dateFromPos(e.x),
  1741.             a = Math.floor(gantt._day_index_by_date(n)),
  1742.             i = gantt._tasks.trace_x[a];
  1743.         gantt.callEvent("onScaleClick", [t, i])
  1744.     }, this), this._dbl_click.gantt_task_link = dhtmlx.bind(function(t, e) {
  1745.         var e = this.locate(t, gantt.config.link_attribute);
  1746.         this._delete_link_handler(e, t)
  1747.     }, this), this._dbl_click.gantt_link_point = dhtmlx.bind(function(t, e, n) {
  1748.         var e = this.locate(t),
  1749.             a = this.getTask(e),
  1750.             i = null;
  1751.         return n.parentNode && gantt._getClassName(n.parentNode) && (i = gantt._getClassName(n.parentNode).indexOf("_left") > -1 ? a.$target[0] : a.$source[0]), i && this._delete_link_handler(i, t), !1
  1752.     }, this), this._tasks_dnd.init(), this._init_links_dnd(), this._link_layers.clear();
  1753.     var e = this.addLinkLayer({
  1754.         renderer: this._render_link_element,
  1755.         container: this.$task_links,
  1756.         filter: gantt._create_filter(["_filter_link", "_is_chart_visible"])
  1757.     });
  1758.     this._linkRenderer = this._link_layers.getRenderer(e), this._task_layers.clear();
  1759.     var n = this.addTaskLayer({
  1760.         renderer: this._render_task_element,
  1761.         container: this.$task_bars,
  1762.         filter: gantt._create_filter(["_filter_task", "_is_chart_visible"])
  1763.     });
  1764.     this._taskRenderer = this._task_layers.getRenderer(n), this.addTaskLayer({
  1765.         renderer: this._render_grid_item,
  1766.         container: this.$grid_data,
  1767.         filter: gantt._create_filter(["_filter_task", "_is_grid_visible"])
  1768.     }), this.addTaskLayer({
  1769.         renderer: this._render_bg_line,
  1770.         container: this.$task_bg,
  1771.         filter: gantt._create_filter(["_filter_task", "_is_chart_visible", "_is_std_background"])
  1772.     }), this._onTaskIdChange && this.detachEvent(this._onTaskIdChange), this._onTaskIdChange = this.attachEvent("onTaskIdChange", function(e, n) {
  1773.         var a = this._get_task_renderers();
  1774.         t(a, e, n, this.getTask(n))
  1775.     }), this._onLinkIdChange && this.detachEvent(this._onLinkIdChange), this._onLinkIdChange = this.attachEvent("onLinkIdChange", function(e, n) {
  1776.         var a = this._get_link_renderers();
  1777.         t(a, e, n, this.getLink(n))
  1778.     })
  1779. }, gantt._create_filter = function(t) {
  1780.     return t instanceof Array || (t = Array.prototype.slice.call(arguments, 0)),
  1781.     function(e) {
  1782.         for (var n = !0, a = 0, i = t.length; i > a; a++) {
  1783.             var s = t[a];
  1784.             gantt[s] && (n = n && gantt[s].apply(gantt, [e.id, e]) !== !1)
  1785.         }
  1786.         return n
  1787.     }
  1788. }, gantt._is_chart_visible = function() {
  1789.     return !!this.config.show_chart
  1790. }, gantt._filter_task = function(t, e) {
  1791.     var n = null,
  1792.         a = null;
  1793.     return this.config.start_date && this.config.end_date && (n = this.config.start_date.valueOf(), a = this.config.end_date.valueOf(), +e.start_date > a || +e.end_date < +n) ? !1 : !0
  1794. }, gantt._filter_link = function(t, e) {
  1795.     return this.config.show_links ? !gantt.isTaskVisible(e.source) || !gantt.isTaskVisible(e.target) || gantt._isAllowedUnscheduledTask(gantt.getTask(e.source)) || gantt._isAllowedUnscheduledTask(gantt.getTask(e.target)) ? !1 : this.callEvent("onBeforeLinkDisplay", [t, e]) : !1
  1796. }, gantt._is_std_background = function() {
  1797.     return !this.config.static_background
  1798. }, gantt._delete_link_handler = function(t, e) {
  1799.     if (t && this.callEvent("onLinkDblClick", [t, e])) {
  1800.         var n = gantt.getLink(t);
  1801.         if (gantt._is_readonly(n)) return;
  1802.         var a = "",
  1803.             i = gantt.locale.labels.link + " " + this.templates.link_description(this.getLink(t)) + " " + gantt.locale.labels.confirm_link_deleting;
  1804.         window.setTimeout(function() {
  1805.             gantt._dhtmlx_confirm(i, a, function() {
  1806.                 gantt.deleteLink(t)
  1807.             })
  1808.         }, gantt.config.touch ? 300 : 1)
  1809.     }
  1810. }, gantt.getTaskNode = function(t) {
  1811.     return this._taskRenderer.rendered[t]
  1812. }, gantt.getLinkNode = function(t) {
  1813.     return this._linkRenderer.rendered[t]
  1814. }, gantt._get_tasks_data = function() {
  1815.     for (var t = [], e = 0; e < this._order.length; e++) {
  1816.         var n = this._pull[this._order[e]];
  1817.         n.$index = e, this.resetProjectDates(n), t.push(n)
  1818.     }
  1819.     return t
  1820. }, gantt._get_links_data = function() {
  1821.     var t = [];
  1822.     for (var e in this._lpull) t.push(this._lpull[e]);
  1823.     return t
  1824. }, gantt._render_data = function() {
  1825.     if (this.callEvent("onBeforeDataRender", []), this._is_render_active()) {
  1826.         this._sync_order(), this._update_layout_sizes(), this.config.static_background && this._render_bg_canvas();
  1827.         for (var t = this._get_tasks_data(), e = this._get_task_renderers(), n = 0; n < e.length; n++) e[n].render_items(t);
  1828.         var a = gantt._get_links_data();
  1829.         e = this._get_link_renderers();
  1830.         for (var n = 0; n < e.length; n++) e[n].render_items(a);
  1831.  
  1832.         this.callEvent("onDataRender", [])
  1833.     }
  1834. }, gantt._update_layout_sizes = function() {
  1835.     var t = this._tasks;
  1836.     t.bar_height = this._get_task_height(), this.$task_data.style.height = Math.max(this.$task.offsetHeight - this.config.scale_height, 0) + "px", this.$task_bg.style.height = "", this.$task_bg.style.backgroundImage = "";
  1837.     for (var e = this.$task_data.childNodes, n = 0, a = e.length; a > n; n++) {
  1838.         var i = e[n];
  1839.         this._is_layer(i) && i.style && (i.style.width = t.full_width + "px")
  1840.     }
  1841.     if (this._is_grid_visible()) {
  1842.         for (var s = this.getGridColumns(), r = 0, n = 0; n < s.length; n++) r += s[n].width;
  1843.         this.$grid_data.style.width = Math.max(r - 1, 0) + "px"
  1844.     }
  1845. }, gantt._scale_range_unit = function() {
  1846.     var t = this.config.scale_unit;
  1847.     if (this.config.scale_offset_minimal) {
  1848.         var e = this._get_scales();
  1849.         t = e[e.length - 1].unit
  1850.     }
  1851.     return t
  1852. }, gantt._init_tasks_range = function() {
  1853.     var t = this._scale_range_unit();
  1854.     if (this.config.start_date && this.config.end_date) return this._min_date = this.date[t + "_start"](new Date(this.config.start_date)), void(this._max_date = this.date[t + "_start"](new Date(this.config.end_date)));
  1855.     this._get_tasks_data();
  1856.     var e = this.getSubtaskDates();
  1857.     this._min_date = e.start_date, this._max_date = e.end_date, this._max_date && this._max_date || (this._min_date = new Date, this._max_date = new Date(this._min_date)), this._min_date = this.date[t + "_start"](this._min_date), this._min_date = this.calculateEndDate(this.date[t + "_start"](this._min_date), -1, t), this._max_date = this.date[t + "_start"](this._max_date), this._max_date = this.calculateEndDate(this._max_date, 2, t)
  1858. }, gantt._prepare_scale_html = function(t) {
  1859.     var e = [],
  1860.         n = null,
  1861.         a = null,
  1862.         i = null;
  1863.     (t.template || t.date) && (a = t.template || this.date.date_to_str(t.date)), i = t.css || function() {}, !t.css && this.config.inherit_scale_class && (i = gantt.templates.scale_cell_class);
  1864.     for (var s = 0; s < t.count; s++) {
  1865.         n = new Date(t.trace_x[s]);
  1866.         var r = a.call(this, n),
  1867.             o = t.width[s],
  1868.             l = "",
  1869.             d = "",
  1870.             _ = "";
  1871.         if (o) {
  1872.             l = "width:" + o + "px;", _ = "gantt_scale_cell" + (s == t.count - 1 ? " gantt_last_cell" : ""), d = i.call(this, n), d && (_ += " " + d);
  1873.             var c = "<div class='" + _ + "' style='" + l + "'>" + r + "</div>";
  1874.             e.push(c)
  1875.         }
  1876.     }
  1877.     return e.join("")
  1878. }, gantt._get_scales = function() {
  1879.     var t = this._scale_helpers,
  1880.         e = [t.primaryScale()].concat(this.config.subscales);
  1881.     return t.sortScales(e), e
  1882. }, gantt._render_tasks_scales = function() {
  1883.     this._init_tasks_range(), this._scroll_resize(), this._set_sizes();
  1884.     var t = "",
  1885.         e = 0,
  1886.         n = 0,
  1887.         a = 0;
  1888.     if (this._is_chart_visible()) {
  1889.         var i = this._scale_helpers,
  1890.             s = this._get_scales();
  1891.         a = this.config.scale_height - 1;
  1892.         for (var r = this._get_resize_options(), o = r.x ? Math.max(this.config.autosize_min_width, 0) : this.$task.offsetWidth, l = i.prepareConfigs(s, this.config.min_column_width, o, a), d = this._tasks = l[l.length - 1], _ = [], c = this.templates.scale_row_class, g = 0; g < l.length; g++) {
  1893.             var h = "gantt_scale_line",
  1894.                 u = c(l[g]);
  1895.             u && (h += " " + u), _.push('<div class="' + h + '" style="height:' + l[g].height + "px;line-height:" + l[g].height + 'px">' + this._prepare_scale_html(l[g]) + "</div>")
  1896.         }
  1897.         t = _.join(""), e = d.full_width + this.$scroll_ver.offsetWidth + "px", n = d.full_width + "px", a += "px"
  1898.     }
  1899.     this.$task.style.display = this._is_chart_visible() ? "" : "none", this.$task_scale.style.height = a, this.$task_data.style.width = this.$task_scale.style.width = e, this.$task_scale.innerHTML = t
  1900. }, gantt._render_bg_line = function(t) {
  1901.     var e = gantt._tasks,
  1902.         n = e.count,
  1903.         a = document.createElement("div");
  1904.     if (gantt.config.show_task_cells)
  1905.         for (var i = 0; n > i; i++) {
  1906.             var s = e.width[i],
  1907.                 r = "";
  1908.             if (s > 0) {
  1909.                 var o = document.createElement("div");
  1910.                 o.style.width = s + "px", r = "gantt_task_cell" + (i == n - 1 ? " gantt_last_cell" : ""), d = this.templates.task_cell_class(t, e.trace_x[i]), d && (r += " " + d), o.className = r, a.appendChild(o)
  1911.             }
  1912.         }
  1913.     var l = t.$index % 2 !== 0,
  1914.         d = gantt.templates.task_row_class(t.start_date, t.end_date, t),
  1915.         _ = "gantt_task_row" + (l ? " odd" : "") + (d ? " " + d : "");
  1916.     return this.getState().selected_task == t.id && (_ += " gantt_selected"), a.className = _, a.style.height = gantt.config.row_height + "px", a.setAttribute(this.config.task_attribute, t.id), a
  1917. }, gantt._render_bg_canvas = function() {}, gantt._adjust_scales = function() {
  1918.     if (this.config.fit_tasks) {
  1919.         var t = +this._min_date,
  1920.             e = +this._max_date;
  1921.         if (this._init_tasks_range(), +this._min_date != t || +this._max_date != e) return this.render(), this.callEvent("onScaleAdjusted", []), !0
  1922.     }
  1923.     return !1
  1924. }, gantt.refreshTask = function(t, e) {
  1925.     if (this._is_render_active()) {
  1926.         var n = this._get_task_renderers(),
  1927.             a = this.getTask(t);
  1928.         if (a && this.isTaskVisible(t)) {
  1929.             for (var i = 0; i < n.length; i++) n[i].render_item(a);
  1930.             if (void 0 !== e && !e) return;
  1931.             for (var i = 0; i < a.$source.length; i++) gantt.refreshLink(a.$source[i]);
  1932.             for (var i = 0; i < a.$target.length; i++) gantt.refreshLink(a.$target[i])
  1933.         } else this._render_data()
  1934.     }
  1935. }, gantt.refreshLink = function(t) {
  1936.     if (this._is_render_active())
  1937.         if (this.isLinkExists(t)) this._render_link(t);
  1938.         else
  1939.             for (var e = this._get_link_renderers(), n = 0; n < e.length; n++) e[n].remove_item(t)
  1940. }, gantt._combine_item_class = function(t, e, n) {
  1941.     var a = [t];
  1942.     e && a.push(e);
  1943.     var i = gantt.getState(),
  1944.         s = this.getTask(n);
  1945.     this._get_safe_type(s.type) == this.config.types.milestone && a.push("gantt_milestone"), this._get_safe_type(s.type) == this.config.types.project && a.push("gantt_project"), this._is_flex_task(s) && a.push("gantt_dependent_task"), this.config.select_task && n == i.selected_task && a.push("gantt_selected"), n == i.drag_id && (a.push("gantt_drag_" + i.drag_mode), i.touch_drag && a.push("gantt_touch_" + i.drag_mode));
  1946.     var r = gantt._get_link_state();
  1947.     if (r.link_source_id == n && a.push("gantt_link_source"), r.link_target_id == n && a.push("gantt_link_target"), this.config.highlight_critical_path && this.isCriticalTask && this.isCriticalTask(s) && a.push("gantt_critical_task"), r.link_landing_area && r.link_target_id && r.link_source_id && r.link_target_id != r.link_source_id) {
  1948.         var o = r.link_source_id,
  1949.             l = r.link_source_start,
  1950.             d = r.link_target_start,
  1951.             _ = gantt.isLinkAllowed(o, n, l, d),
  1952.             c = "";
  1953.         c = _ ? d ? "link_start_allow" : "link_finish_allow" : d ? "link_start_deny" : "link_finish_deny", a.push(c)
  1954.     }
  1955.     return a.join(" ")
  1956. }, gantt._render_pair = function(t, e, n, a) {
  1957.     var i = gantt.getState(); + n.end_date <= +i.max_date && t.appendChild(a(e + " task_right")), +n.start_date >= +i.min_date && t.appendChild(a(e + " task_left"))
  1958. }, gantt._get_task_height = function() {
  1959.     var t = this.config.task_height;
  1960.     return "full" == t && (t = this.config.row_height - 5), t = Math.min(t, this.config.row_height), Math.max(t, 0)
  1961. }, gantt._get_milestone_width = function() {
  1962.     return this._get_task_height()
  1963. }, gantt._get_visible_milestone_width = function() {
  1964.     var t = gantt._get_task_height();
  1965.     return Math.sqrt(2 * t * t)
  1966. }, gantt.getTaskPosition = function(t, e, n) {
  1967.     var a = this.posFromDate(e || t.start_date),
  1968.         i = this.posFromDate(n || t.end_date);
  1969.     i = Math.max(a, i);
  1970.     var s = this.getTaskTop(t.id),
  1971.         r = this.config.task_height;
  1972.     return {
  1973.         left: a,
  1974.         top: s,
  1975.         height: r,
  1976.         width: Math.max(i - a, 0)
  1977.     }
  1978. }, gantt._get_task_width = function(t) {
  1979.     return Math.round(this._get_task_pos(t, !1).x - this._get_task_pos(t, !0).x)
  1980. }, gantt._is_readonly = function(t) {
  1981.     return t && t[this.config.editable_property] ? !1 : t && t[this.config.readonly_property] || this.config.readonly
  1982. }, gantt._task_default_render = function(t) {
  1983.     if (!this._isAllowedUnscheduledTask(t)) {
  1984.         var e = this._get_task_pos(t),
  1985.             n = this.config,
  1986.             a = this._get_task_height(),
  1987.             i = Math.floor((this.config.row_height - a) / 2);
  1988.         this._get_safe_type(t.type) == n.types.milestone && n.link_line_width > 1 && (i += 1);
  1989.         var s = document.createElement("div"),
  1990.             r = gantt._get_task_width(t),
  1991.             o = this._get_safe_type(t.type);
  1992.         s.setAttribute(this.config.task_attribute, t.id), n.show_progress && o != this.config.types.milestone && this._render_task_progress(t, s, r);
  1993.         var l = gantt._render_task_content(t, r);
  1994.         t.textColor && (l.style.color = t.textColor), s.appendChild(l);
  1995.         var d = this._combine_item_class("gantt_task_line", this.templates.task_class(t.start_date, t.end_date, t), t.id);
  1996.         (t.color || t.progressColor || t.textColor) && (d += " gantt_task_inline_color"), s.className = d;
  1997.         var _ = ["left:" + e.x + "px", "top:" + (i + e.y) + "px", "height:" + a + "px", "line-height:" + a + "px", "width:" + r + "px"];
  1998.         t.color && _.push("background-color:" + t.color), t.textColor && _.push("color:" + t.textColor), s.style.cssText = _.join(";");
  1999.         var c = this._render_leftside_content(t);
  2000.         return c && s.appendChild(c), c = this._render_rightside_content(t), c && s.appendChild(c), this._is_readonly(t) || (n.drag_resize && !this._is_flex_task(t) && o != this.config.types.milestone && gantt._render_pair(s, "gantt_task_drag", t, function(t) {
  2001.             var e = document.createElement("div");
  2002.             return e.className = t, e
  2003.         }), n.drag_links && this.config.show_links && gantt._render_pair(s, "gantt_link_control", t, function(t) {
  2004.             var e = document.createElement("div");
  2005.             e.className = t, e.style.cssText = ["height:" + a + "px", "line-height:" + a + "px"].join(";");
  2006.             var n = document.createElement("div");
  2007.             return n.className = "gantt_link_point", e.appendChild(n), e
  2008.         })), s
  2009.     }
  2010. }, gantt._render_task_element = function(t) {
  2011.     var e = this.config.type_renderers,
  2012.         n = e[this._get_safe_type(t.type)],
  2013.         a = this._task_default_render;
  2014.     return n || (n = a), n.call(this, t, dhtmlx.bind(a, this))
  2015. }, gantt._render_side_content = function(t, e, n) {
  2016.     if (!e) return null;
  2017.     var a = e(t.start_date, t.end_date, t);
  2018.     if (!a) return null;
  2019.     var i = document.createElement("div");
  2020.     return i.className = "gantt_side_content " + n, i.innerHTML = a, i
  2021. }, gantt._render_leftside_content = function(t) {
  2022.     var e = "gantt_left " + gantt._get_link_crossing_css(!0, t);
  2023.     return gantt._render_side_content(t, this.templates.leftside_text, e)
  2024. }, gantt._render_rightside_content = function(t) {
  2025.     var e = "gantt_right " + gantt._get_link_crossing_css(!1, t);
  2026.     return gantt._render_side_content(t, this.templates.rightside_text, e)
  2027. }, gantt._get_conditions = function(t) {
  2028.     return t ? {
  2029.         $source: [gantt.config.links.start_to_start],
  2030.         $target: [gantt.config.links.start_to_start, gantt.config.links.finish_to_start]
  2031.     } : {
  2032.         $source: [gantt.config.links.finish_to_start, gantt.config.links.finish_to_finish],
  2033.         $target: [gantt.config.links.finish_to_finish]
  2034.     }
  2035. }, gantt._get_link_crossing_css = function(t, e) {
  2036.     var n = gantt._get_conditions(t);
  2037.     for (var a in n)
  2038.         for (var i = e[a], s = 0; s < i.length; s++)
  2039.             for (var r = gantt.getLink(i[s]), o = 0; o < n[a].length; o++)
  2040.                 if (r.type == n[a][o]) return "gantt_link_crossing";
  2041.     return ""
  2042. }, gantt._render_task_content = function(t) {
  2043.     var e = document.createElement("div");
  2044.     return this._get_safe_type(t.type) != this.config.types.milestone && (e.innerHTML = this.templates.task_text(t.start_date, t.end_date, t)), e.className = "gantt_task_content", e
  2045. }, gantt._render_task_progress = function(t, e, n) {
  2046.     var a = 1 * t.progress || 0;
  2047.     n = Math.max(n - 2, 0);
  2048.     var i = document.createElement("div"),
  2049.         s = Math.round(n * a);
  2050.     if (s = Math.min(n, s), t.progressColor && (i.style.backgroundColor = t.progressColor, i.style.opacity = 1), i.style.width = s + "px", i.className = "gantt_task_progress", i.innerHTML = this.templates.progress_text(t.start_date, t.end_date, t), e.appendChild(i), this.config.drag_progress && !gantt._is_readonly(t)) {
  2051.         var r = document.createElement("div");
  2052.         r.style.left = s + "px", r.className = "gantt_task_progress_drag", i.appendChild(r), e.appendChild(r)
  2053.     }
  2054. }, gantt._get_line = function(t) {
  2055.     var e = {
  2056.         second: 1,
  2057.         minute: 60,
  2058.         hour: 3600,
  2059.         day: 86400,
  2060.         week: 604800,
  2061.         month: 2592e3,
  2062.         year: 31536e3
  2063.     };
  2064.     return e[t] || 0
  2065. }, gantt.dateFromPos = function(t) {
  2066.     var e = this._tasks;
  2067.     if (0 > t || t > e.full_width || !e.full_width) return null;
  2068.     var n = this._findBinary(this._tasks.left, t),
  2069.         a = this._tasks.left[n],
  2070.         i = e.width[n] || e.col_width,
  2071.         s = 0;
  2072.     i && (s = (t - a) / i);
  2073.     var r = 0;
  2074.     s && (r = gantt._get_coll_duration(e, e.trace_x[n]));
  2075.     var o = new Date(e.trace_x[n].valueOf() + Math.round(s * r));
  2076.     return o
  2077. }, gantt.posFromDate = function(t) {
  2078.     var e = gantt._day_index_by_date(t);
  2079.     dhtmlx.assert(e >= 0, "Invalid day index");
  2080.     var n = Math.floor(e),
  2081.         a = e % 1,
  2082.         i = gantt._tasks.left[Math.min(n, gantt._tasks.width.length - 1)];
  2083.     return n == gantt._tasks.width.length && (i += gantt._tasks.width[gantt._tasks.width.length - 1]), a && (i += n < gantt._tasks.width.length ? gantt._tasks.width[n] * (a % 1) : 1), i
  2084. }, gantt._day_index_by_date = function(t) {
  2085.     var e = new Date(t).valueOf(),
  2086.         n = gantt._tasks.trace_x,
  2087.         a = gantt._tasks.ignore_x;
  2088.     if (e <= this._min_date) return 0;
  2089.     if (e >= this._max_date) return n.length;
  2090.     for (var i = gantt._findBinary(n, e), s = +gantt._tasks.trace_x[i]; a[s];) s = gantt._tasks.trace_x[++i];
  2091.     return s ? i + (t - n[i]) / gantt._get_coll_duration(gantt._tasks, n[i]) : 0
  2092. }, gantt._findBinary = function(t, e) {
  2093.     for (var n, a, i, s = 0, r = t.length - 1; r >= s;)
  2094.         if (n = Math.floor((s + r) / 2), a = +t[n], i = +t[n - 1], e > a) s = n + 1;
  2095.         else {
  2096.             if (!(a > e)) return n;
  2097.             if (!isNaN(i) && e > i) return n - 1;
  2098.             r = n - 1
  2099.         }
  2100.     return t.length - 1
  2101. }, gantt._get_coll_duration = function(t, e) {
  2102.     return gantt.date.add(e, t.step, t.unit) - e
  2103. }, gantt._get_x_pos = function(t, e) {
  2104.     e = e !== !1, gantt.posFromDate(e ? t.start_date : t.end_date)
  2105. }, gantt.getTaskTop = function(t) {
  2106.     return this._y_from_ind(this.getGlobalTaskIndex(t))
  2107. }, gantt._get_task_coord = function(t, e, n) {
  2108.     e = e !== !1, n = n || 0;
  2109.     var a = this._get_safe_type(t.type) == this.config.types.milestone,
  2110.         i = null;
  2111.     i = e || a ? t.start_date || this._default_task_date(t) : t.end_date || this.calculateEndDate(this._default_task_date(t));
  2112.     var s = this.posFromDate(i),
  2113.         r = this.getTaskTop(t.id);
  2114.     return a && (e ? s -= n : s += n), {
  2115.         x: s,
  2116.         y: r
  2117.     }
  2118. }, gantt._get_task_pos = function(t, e) {
  2119.     e = e !== !1;
  2120.     var n = gantt._get_milestone_width() / 2;
  2121.     return this._get_task_coord(t, e, n)
  2122. }, gantt._get_task_visible_pos = function(t, e) {
  2123.     e = e !== !1;
  2124.     var n = gantt._get_visible_milestone_width() / 2;
  2125.     return this._get_task_coord(t, e, n)
  2126. }, gantt._correct_shift = function(t, e) {
  2127.     return t -= 6e4 * (new Date(gantt._min_date).getTimezoneOffset() - new Date(t).getTimezoneOffset()) * (e ? -1 : 1)
  2128. }, gantt._get_mouse_pos = function(t) {
  2129.     if (t.pageX || t.pageY) var e = {
  2130.         x: t.pageX,
  2131.         y: t.pageY
  2132.     };
  2133.     var n = _isIE ? document.documentElement : document.body,
  2134.         e = {
  2135.             x: t.clientX + n.scrollLeft - n.clientLeft,
  2136.             y: t.clientY + n.scrollTop - n.clientTop
  2137.         }, a = gantt._get_position(gantt.$task_data);
  2138.     return e.x = e.x - a.x + gantt.$task_data.scrollLeft, e.y = e.y - a.y + gantt.$task_data.scrollTop, e
  2139. }, gantt._is_layer = function(t) {
  2140.     return t && t.hasAttribute && t.hasAttribute(this.config.layer_attribute)
  2141. }, gantt._task_renderer = function(t, e, n, a) {
  2142.     return this._task_area_pulls || (this._task_area_pulls = {}), this._task_area_renderers || (this._task_area_renderers = {}), this._task_area_renderers[t] ? this._task_area_renderers[t] : (e || dhtmlx.assert(!1, "Invalid renderer call"), n && n.setAttribute(this.config.layer_attribute, !0), this._task_area_renderers[t] = {
  2143.         render_item: function(i, s) {
  2144.             var r = gantt._task_area_pulls[t];
  2145.             if (s = s || n, a && !a(i)) return void this.remove_item(i.id);
  2146.             var o = e.call(gantt, i);
  2147.             o && (r[i.id] ? this.replace_item(i.id, o) : (r[i.id] = o, s.appendChild(o)))
  2148.         },
  2149.         clear: function(e) {
  2150.             this.rendered = gantt._task_area_pulls[t] = {}, e = e || n, e && (e.innerHTML = "")
  2151.         },
  2152.         render_items: function(t, e) {
  2153.             e = e || n, this.clear(e);
  2154.             for (var a = document.createDocumentFragment(), i = 0, s = t.length; s > i; i++) this.render_item(t[i], a);
  2155.             e.appendChild(a)
  2156.         },
  2157.         replace_item: function(t, e) {
  2158.             var n = this.rendered[t];
  2159.             n && n.parentNode && n.parentNode.replaceChild(e, n), this.rendered[t] = e
  2160.         },
  2161.         remove_item: function(t) {
  2162.             var e = this.rendered[t];
  2163.             e && e.parentNode && e.parentNode.removeChild(e), delete this.rendered[t]
  2164.         },
  2165.         change_id: function(t, e) {
  2166.             this.rendered[e] = this.rendered[t], delete this.rendered[t]
  2167.         },
  2168.         rendered: this._task_area_pulls[t],
  2169.         node: n,
  2170.         unload: function() {
  2171.             this.clear(), delete gantt._task_area_renderers[t], delete gantt._task_area_pulls[t]
  2172.         }
  2173.     }, this._task_area_renderers[t])
  2174. }, gantt._clear_renderers = function() {
  2175.     for (var t in this._task_area_renderers) this._task_renderer(t).unload()
  2176. }, gantt._render_bg_canvas = function() {
  2177.     var t = gantt._tasks,
  2178.         e = gantt.$task_bg,
  2179.         n = document.createElement("canvas"),
  2180.         a = gantt.config.row_height,
  2181.         i = t.col_width;
  2182.     if (n.getContext) {
  2183.         n.height = a, n.width = i;
  2184.         var s = document.createElement("div"),
  2185.             r = document.createElement("div");
  2186.         s.className = "gantt_task_row", r.className = "gantt_task_cell", s.style.display = r.style.display = "none", e.appendChild(s), s.appendChild(r);
  2187.         var o = n.getContext("2d");
  2188.         o.beginPath(), o.moveTo(0, a), o.lineTo(i, a), o.lineWidth = 1, o.strokeStyle = getComputedStyle(s).getPropertyValue("border-bottom-color") || "#ebebeb", o.stroke(), o.beginPath(), o.moveTo(i, a), o.lineTo(i, 0), o.lineWidth = 1, o.strokeStyle = getComputedStyle(r).getPropertyValue("border-right-color") || "#ebebeb", o.stroke(), t.fill_img = n.toDataURL(), e.style.height = a * gantt._order.length + "px", e.style.backgroundImage = "url(" + t.fill_img + ")", e.removeChild(s)
  2189.     }
  2190. }, gantt.attachEvent("onGanttReady", function() {
  2191.     gantt._task_layers.add(), gantt._link_layers.add()
  2192. }), gantt._layers = {
  2193.     prepareConfig: function(t) {
  2194.         return "function" == typeof t && (t = {
  2195.             renderer: t
  2196.         }), t.id = dhtmlx.uid(), t.container || (t.container = document.createElement("div")), t
  2197.     },
  2198.     create: function(t, e) {
  2199.         return {
  2200.             tempCollection: [],
  2201.             renderers: {},
  2202.             container: t,
  2203.             getRenderers: function() {
  2204.                 var t = [];
  2205.                 for (var e in this.renderers) t.push(this.renderers[e]);
  2206.                 return t
  2207.             },
  2208.             getRenderer: function(t) {
  2209.                 return this.renderers[t]
  2210.             },
  2211.             add: function(t) {
  2212.                 if (t && this.tempCollection.push(t), this.container())
  2213.                     for (var n = this.container(), a = this.tempCollection, i = 0; i < a.length; i++) {
  2214.                         var t = a[i],
  2215.                             s = t.container,
  2216.                             r = t.id,
  2217.                             o = t.topmost;
  2218.                         if (!s.parentNode)
  2219.                             if (o) n.appendChild(s);
  2220.                             else {
  2221.                                 var l = e ? e() : n.firstChild;
  2222.                                 l ? n.insertBefore(s, l) : n.appendChild(s)
  2223.                             }
  2224.                         this.renderers[r] = gantt._task_renderer(r, t.renderer, s, t.filter), this.tempCollection.splice(i, 1), i--
  2225.                     }
  2226.             },
  2227.             remove: function(t) {
  2228.                 this.renderers[t].unload(), delete this.renderers[t]
  2229.             },
  2230.             clear: function() {
  2231.                 for (var t in this.renderers) this.renderers[t].unload();
  2232.                 this.renderers = {}
  2233.             }
  2234.         }
  2235.     }
  2236. }, gantt._create_filter = function(t) {
  2237.     return t instanceof Array || (t = Array.prototype.slice.call(arguments, 0)),
  2238.     function(e) {
  2239.         for (var n = !0, a = 0, i = t.length; i > a; a++) {
  2240.             var s = t[a];
  2241.             gantt[s] && (n = n && gantt[s].call(gantt, e.id, e) !== !1)
  2242.         }
  2243.         return n
  2244.     }
  2245. }, gantt._add_generic_layer = function(t, e) {
  2246.     return function(n) {
  2247.         return void 0 === n.filter && (n.filter = gantt._create_filter(e)), n = gantt._layers.prepareConfig(n), t.add(n), n.id
  2248.     }
  2249. }, gantt._task_layers = gantt._layers.create(function() {
  2250.     return gantt.$task_data
  2251. }, function() {
  2252.     return gantt.$task_links
  2253. }), gantt._link_layers = gantt._layers.create(function() {
  2254.     return gantt.$task_data
  2255. }), gantt.addTaskLayer = gantt._add_generic_layer(gantt._task_layers, ["_filter_task", "_is_chart_visible"]), gantt.removeTaskLayer = function(t) {
  2256.     gantt._task_layers.remove(t)
  2257. }, gantt.addLinkLayer = gantt._add_generic_layer(gantt._link_layers, ["_filter_link", "_is_chart_visible"]), gantt.removeLinkLayer = function(t) {
  2258.     gantt._link_layers.remove(t)
  2259. }, gantt._get_task_renderers = function() {
  2260.     return this._task_layers.getRenderers()
  2261. }, gantt._get_link_renderers = function() {
  2262.     return this._link_layers.getRenderers()
  2263. }, gantt._pull = {}, gantt._branches = {}, gantt._order = [], gantt._lpull = {}, gantt._order_full = [], gantt.load = function(t, e, n) {
  2264.     this._load_url = t, dhtmlx.assert(arguments.length, "Invalid load arguments"), this.callEvent("onLoadStart", []);
  2265.     var a = "json",
  2266.         i = null;
  2267.     arguments.length >= 3 ? (a = e, i = n) : "string" == typeof arguments[1] ? a = arguments[1] : "function" == typeof arguments[1] && (i = arguments[1]), this._load_type = a, dhx4.ajax.get(t, dhtmlx.bind(function(t) {
  2268.         this.on_load(t, a), this.callEvent("onLoadEnd", []), "function" == typeof i && i.call(this)
  2269.     }, this))
  2270. }, gantt.parse = function(t, e) {
  2271.     this.on_load({
  2272.         xmlDoc: {
  2273.             responseText: t
  2274.         }
  2275.     }, e)
  2276. }, gantt.serialize = function(t) {
  2277.     return t = t || "json", this[t].serialize()
  2278. }, gantt.on_load = function(t, e) {
  2279.     this.callEvent("onBeforeParse", []), e || (e = "json"), dhtmlx.assert(this[e], "Invalid data type:'" + e + "'");
  2280.     var n = t.xmlDoc.responseText,
  2281.         a = this[e].parse(n, t);
  2282.     this._process_loading(a)
  2283. }, gantt._process_loading = function(t) {
  2284.     t.collections && this._load_collections(t.collections);
  2285.     for (var e, n = t.data, a = 0; a < n.length; a++) e = n[a], this._init_task(e), this.callEvent("onTaskLoading", [e]) && (this._order_full.push(e.id), this._pull[e.id] = e);
  2286.     for (var a in this._pull) e = this._pull[a], this.setParent(e, this.getParent(e) || this.config.root_id);
  2287.     for (var a = 0; a < this._order_full.length; a++) e = this._pull[this._order_full[a]], this._add_branch(e), e.$level = this.calculateTaskLevel(e);
  2288.     if (this._sync_order(), this._init_links(t.links || (t.collections ? t.collections.links : [])), this.callEvent("onParse", []), this.render(), this.config.initial_scroll) {
  2289.         var i = this._order[0] || this.config.root_id;
  2290.         i && this.showTask(i)
  2291.     }
  2292. }, gantt._init_links = function(t) {
  2293.     if (t)
  2294.         for (var e = 0; e < t.length; e++)
  2295.             if (t[e]) {
  2296.                 var n = this._init_link(t[e]);
  2297.                 this._lpull[n.id] = n
  2298.             }
  2299.     this._sync_links()
  2300. }, gantt._load_collections = function(t) {
  2301.     var e = !1;
  2302.     for (var n in t)
  2303.         if (t.hasOwnProperty(n)) {
  2304.             e = !0;
  2305.             var a = t[n],
  2306.                 i = this.serverList[n];
  2307.             if (!i) continue;
  2308.             i.splice(0, i.length);
  2309.             for (var s = 0; s < a.length; s++) {
  2310.                 var r = a[s],
  2311.                     o = dhtmlx.copy(r);
  2312.                 o.key = o.value;
  2313.                 for (var l in r)
  2314.                     if (r.hasOwnProperty(l)) {
  2315.                         if ("value" == l || "label" == l) continue;
  2316.                         o[l] = r[l]
  2317.                     }
  2318.                 i.push(o)
  2319.             }
  2320.         }
  2321.     e && this.callEvent("onOptionsLoad", [])
  2322. }, gantt._sync_order = function(t) {
  2323.     this._order = [], this._sync_order_item({
  2324.         parent: this.config.root_id,
  2325.         $open: !0,
  2326.         $ignore: !0,
  2327.         id: this.config.root_id
  2328.     }), t || (this._scroll_resize(), this._set_sizes())
  2329. }, gantt.attachEvent("onBeforeTaskDisplay", function(t, e) {
  2330.     return !e.$ignore
  2331. }), gantt._sync_order_item = function(t) {
  2332.     if (t.id && this._filter_task(t.id, t) && this.callEvent("onBeforeTaskDisplay", [t.id, t]) && this._order.push(t.id), t.$open) {
  2333.         var e = this.getChildren(t.id);
  2334.         if (e)
  2335.             for (var n = 0; n < e.length; n++) this._sync_order_item(this._pull[e[n]])
  2336.     }
  2337. }, gantt.getTaskCount = function() {
  2338.     return this._order_full.length
  2339. }, gantt.getVisibleTaskCount = function() {
  2340.     return this._order.length
  2341. }, gantt.getTaskIndex = function(t) {
  2342.     for (var e = this.getChildren(this.getParent(t)), n = 0; n < e.length; n++)
  2343.         if (e[n] == t) return n;
  2344.     return -1
  2345. }, gantt.getGlobalTaskIndex = function(t) {
  2346.     dhtmlx.assert(t, "Invalid argument");
  2347.     for (var e = this._order, n = 0, a = e.length; a > n; n++)
  2348.         if (e[n] == t) return n;
  2349.     return -1
  2350. }, gantt._get_visible_order = gantt.getGlobalTaskIndex, gantt.eachTask = function(t, e, n) {
  2351.     e = e || this.config.root_id, n = n || this;
  2352.     var a = this.getChildren(e);
  2353.     if (a)
  2354.         for (var i = 0; i < a.length; i++) {
  2355.             var s = this._pull[a[i]];
  2356.             t.call(n, s), this.hasChild(s.id) && this.eachTask(t, s.id, n)
  2357.         }
  2358. }, gantt.json = {
  2359.     parse: function(data) {
  2360.         return dhtmlx.assert(data, "Invalid data"), "string" == typeof data && (window.JSON ? data = JSON.parse(data) : (gantt._temp = eval("(" + data + ")"), data = gantt._temp || {}, gantt._temp = null)), data.dhx_security && (dhtmlx.security_key = data.dhx_security), data
  2361.     },
  2362.     _copyLink: function(t) {
  2363.         var e = {};
  2364.         for (var n in t) e[n] = t[n];
  2365.         return e
  2366.     },
  2367.     _copyObject: function(t) {
  2368.         var e = {};
  2369.         for (var n in t) "$" != n.charAt(0) && (e[n] = t[n], e[n] instanceof Date && (e[n] = gantt.templates.xml_format(e[n])));
  2370.         return e
  2371.     },
  2372.     serialize: function() {
  2373.         var t = [],
  2374.             e = [];
  2375.         gantt.eachTask(function(e) {
  2376.             gantt.resetProjectDates(e), t.push(this._copyObject(e))
  2377.         }, gantt.config.root_id, this);
  2378.         for (var n in gantt._lpull) e.push(this._copyLink(gantt._lpull[n]));
  2379.         return {
  2380.             data: t,
  2381.             links: e
  2382.         }
  2383.     }
  2384. }, gantt.xml = {
  2385.     _xmlNodeToJSON: function(t, e) {
  2386.         for (var n = {}, a = 0; a < t.attributes.length; a++) n[t.attributes[a].name] = t.attributes[a].value;
  2387.         if (!e) {
  2388.             for (var a = 0; a < t.childNodes.length; a++) {
  2389.                 var i = t.childNodes[a];
  2390.                 1 == i.nodeType && (n[i.tagName] = i.firstChild ? i.firstChild.nodeValue : "")
  2391.             }
  2392.             n.text || (n.text = t.firstChild ? t.firstChild.nodeValue : "")
  2393.         }
  2394.         return n
  2395.     },
  2396.     _getCollections: function(t) {
  2397.         for (var e = {}, n = dhx4.ajax.xpath("//coll_options", t), a = 0; a < n.length; a++)
  2398.             for (var i = n[a].getAttribute("for"), s = e[i] = [], r = dhx4.ajax.xpath(".//item", n[a]), o = 0; o < r.length; o++) {
  2399.                 for (var l = r[o], d = l.attributes, _ = {
  2400.                         key: r[o].getAttribute("value"),
  2401.                         label: r[o].getAttribute("label")
  2402.                     }, c = 0; c < d.length; c++) {
  2403.                     var g = d[c];
  2404.                     "value" != g.nodeName && "label" != g.nodeName && (_[g.nodeName] = g.nodeValue)
  2405.                 }
  2406.                 s.push(_)
  2407.             }
  2408.         return e
  2409.     },
  2410.     _getXML: function(t, e, n) {
  2411.         n = n || "data", e.getXMLTopNode || (e = dhx4.ajax.parse(e));
  2412.         var a = dhx4.ajax.xmltop(n, e.xmlDoc);
  2413.         if (a.tagName != n) throw "Invalid XML data";
  2414.         var i = a.getAttribute("dhx_security");
  2415.         return i && (dhtmlx.security_key = i), a
  2416.     },
  2417.     parse: function(t, e) {
  2418.         e = this._getXML(t, e);
  2419.         for (var n = {}, a = n.data = [], i = dhx4.ajax.xpath("//task", e), s = 0; s < i.length; s++) a[s] = this._xmlNodeToJSON(i[s]);
  2420.         return n.collections = this._getCollections(e), n
  2421.     },
  2422.     _copyLink: function(t) {
  2423.         return "<item id='" + t.id + "' source='" + t.source + "' target='" + t.target + "' type='" + t.type + "' />"
  2424.     },
  2425.     _copyObject: function(t) {
  2426.         return "<task id='" + t.id + "' parent='" + (t.parent || "") + "' start_date='" + t.start_date + "' duration='" + t.duration + "' open='" + !! t.open + "' progress='" + t.progress + "' end_date='" + t.end_date + "'><![CDATA[" + t.text + "]]></task>"
  2427.     },
  2428.     serialize: function() {
  2429.         for (var t = [], e = [], n = gantt.json.serialize(), a = 0, i = n.data.length; i > a; a++) t.push(this._copyObject(n.data[a]));
  2430.         for (var a = 0, i = n.links.length; i > a; a++) e.push(this._copyLink(n.links[a]));
  2431.         return "<data>" + t.join("") + "<coll_options for='links'>" + e.join("") + "</coll_options></data>"
  2432.     }
  2433. }, gantt.oldxml = {
  2434.     parse: function(t, e) {
  2435.         e = gantt.xml._getXML(t, e, "projects");
  2436.         for (var n = {
  2437.             collections: {
  2438.                 links: []
  2439.             }
  2440.         }, a = n.data = [], i = dhx4.ajax.xpath("//task", e), s = 0; s < i.length; s++) {
  2441.             a[s] = gantt.xml._xmlNodeToJSON(i[s]);
  2442.             var r = i[s].parentNode;
  2443.             a[s].parent = "project" == r.tagName ? "project-" + r.getAttribute("id") : r.parentNode.getAttribute("id")
  2444.         }
  2445.         i = dhx4.ajax.xpath("//project", e);
  2446.         for (var s = 0; s < i.length; s++) {
  2447.             var o = gantt.xml._xmlNodeToJSON(i[s], !0);
  2448.             o.id = "project-" + o.id, a.push(o)
  2449.         }
  2450.         for (var s = 0; s < a.length; s++) {
  2451.             var o = a[s];
  2452.             o.start_date = o.startdate || o.est, o.end_date = o.enddate, o.text = o.name, o.duration = o.duration / 8, o.open = 1, o.duration || o.end_date || (o.duration = 1), o.predecessortasks && n.collections.links.push({
  2453.                 target: o.id,
  2454.                 source: o.predecessortasks,
  2455.                 type: gantt.config.links.finish_to_start
  2456.             })
  2457.         }
  2458.         return n
  2459.     },
  2460.     serialize: function() {
  2461.         dhtmlx.message("Serialization to 'old XML' is not implemented")
  2462.     }
  2463. }, gantt.serverList = function(t, e) {
  2464.     return e ? this.serverList[t] = e.slice(0) : this.serverList[t] || (this.serverList[t] = []), this.serverList[t]
  2465. }, gantt._working_time_helper = {
  2466.     units: ["year", "month", "week", "day", "hour", "minute"],
  2467.     hours: [8, 17],
  2468.     dates: {
  2469.         0: !1,
  2470.         6: !1
  2471.     },
  2472.     _working_units_cache: {
  2473.         _cache: {},
  2474.         get: function(t, e) {
  2475.             if (!t || !e) return -1;
  2476.             var n = this._cache,
  2477.                 a = e.getTime(),
  2478.                 i = -1;
  2479.             return n && n[t] && void 0 !== n[t][a] && (i = n[t][a]), i
  2480.         },
  2481.         put: function(t, e, n) {
  2482.             if (!t || !e) return !1;
  2483.             var a = this._cache,
  2484.                 i = e.getTime();
  2485.             return n = !! n, a ? (a[t] || (a[t] = {}), a[t][i] = n, !0) : !1
  2486.         },
  2487.         clear: function() {
  2488.             this._cache = {}
  2489.         }
  2490.     },
  2491.     _get_unit_order: function(t) {
  2492.         for (var e = 0, n = this.units.length; n > e; e++)
  2493.             if (this.units[e] == t) return e;
  2494.         dhtmlx.assert(!1, "Incorrect duration unit")
  2495.     },
  2496.     _timestamp: function(t) {
  2497.         var e = null;
  2498.         return t.day || 0 === t.day ? e = t.day : t.date && (e = gantt.date.date_part(new Date(t.date)).valueOf()), e
  2499.     },
  2500.     set_time: function(t) {
  2501.         var e = void 0 !== t.hours ? t.hours : !0,
  2502.             n = this._timestamp(t);
  2503.         null !== n ? this.dates[n] = e : this.hours = e, this._working_units_cache.clear()
  2504.     },
  2505.     unset_time: function(t) {
  2506.         if (t) {
  2507.             var e = this._timestamp(t);
  2508.             null !== e && delete this.dates[e]
  2509.         } else this.hours = [];
  2510.         this._working_units_cache.clear()
  2511.     },
  2512.     is_working_unit: function(t, e, n) {
  2513.         if (!gantt.config.work_time) return !0;
  2514.         var a = this._working_units_cache.get(e, t);
  2515.         return -1 == a && (a = this._check_is_working_unit(t, e, n), this._working_units_cache.put(e, t, a)), a
  2516.     },
  2517.     _check_is_working_unit: function(t, e, n) {
  2518.         return void 0 === n && (n = this._get_unit_order(e)), void 0 === n ? !1 : n && !this.is_working_unit(t, this.units[n - 1], n - 1) ? !1 : this["is_work_" + e] ? this["is_work_" + e](t) : !0
  2519.     },
  2520.     is_work_day: function(t) {
  2521.         var e = this.get_working_hours(t);
  2522.         return e instanceof Array ? e.length > 0 : !1
  2523.     },
  2524.     is_work_hour: function(t) {
  2525.         for (var e = this.get_working_hours(t), n = t.getHours(), a = 0; a < e.length; a += 2) {
  2526.             if (void 0 === e[a + 1]) return e[a] == n;
  2527.             if (n >= e[a] && n < e[a + 1]) return !0
  2528.         }
  2529.         return !1
  2530.     },
  2531.     get_working_hours: function(t) {
  2532.         var e = this._timestamp({
  2533.             date: t
  2534.         }),
  2535.             n = !0;
  2536.         return void 0 !== this.dates[e] ? n = this.dates[e] : void 0 !== this.dates[t.getDay()] && (n = this.dates[t.getDay()]), n === !0 ? this.hours : n ? n : []
  2537.     },
  2538.     get_work_units_between: function(t, e, n, a) {
  2539.         if (!n) return !1;
  2540.         for (var i = new Date(t), s = new Date(e), a = a || 1, r = 0; i.valueOf() < s.valueOf();) this.is_working_unit(i, n) && r++, i = gantt.date.add(i, a, n);
  2541.         return r
  2542.     },
  2543.     is_work_units_between: function(t, e, n, a) {
  2544.         if (!n) return !1;
  2545.         for (var i = new Date(t), s = new Date(e), a = a || 1; i.valueOf() < s.valueOf();) {
  2546.             if (this.is_working_unit(i, n)) return !0;
  2547.             i = gantt.date.add(i, a, n)
  2548.         }
  2549.         return !1
  2550.     },
  2551.     add_worktime: function(t, e, n, a) {
  2552.         if (!n) return !1;
  2553.         var i = new Date(t),
  2554.             s = 0,
  2555.             a = a || 1,
  2556.             e = 1 * e;
  2557.         if (gantt.config.work_time) {
  2558.             for (; e > s;) {
  2559.                 var r = gantt.date.add(i, a, n);
  2560.                 this.is_working_unit(new Date(a > 0 ? r.valueOf() - 1 : r.valueOf() + 1), n) && s++, i = r
  2561.             }
  2562.             return i
  2563.         }
  2564.         return gantt.date.add(i, a * e, n)
  2565.     },
  2566.     get_closest_worktime: function(t) {
  2567.         if (this.is_working_unit(t.date, t.unit)) return t.date;
  2568.         var e = t.unit,
  2569.             n = gantt.date[e + "_start"](t.date),
  2570.             a = new Date(n),
  2571.             i = new Date(n),
  2572.             s = !0,
  2573.             r = 3e3,
  2574.             o = 0,
  2575.             l = "any" == t.dir || !t.dir,
  2576.             d = 1;
  2577.         for ("past" == t.dir && (d = -1); !this.is_working_unit(n, e);) {
  2578.             l && (n = s ? a : i, d = -1 * d);
  2579.             var _ = n.getTimezoneOffset();
  2580.             if (n = gantt.date.add(n, d, e), n = gantt._correct_dst_change(n, _, d, e), gantt.date[e + "_start"] && (n = gantt.date[e + "_start"](n)), l && (s ? a = n : i = n), s = !s, o++, o > r) return dhtmlx.assert(!1, "Invalid working time check"), !1
  2581.         }
  2582.         return (n == i || "past" == t.dir) && (n = gantt.date.add(n, 1, e)), n
  2583.     }
  2584. }, gantt.getTask = function(t) {
  2585.     return dhtmlx.assert(t, "Invalid argument for gantt.getTask"), dhtmlx.assert(this._pull[t], "Task not found id=" + t), this._pull[t]
  2586. }, gantt.getTaskByTime = function(t, e) {
  2587.     var n = this._pull,
  2588.         a = [];
  2589.     if (t || e) {
  2590.         t = +t || -(1 / 0), e = +e || 1 / 0;
  2591.         for (var i in n) {
  2592.             var s = n[i]; + s.start_date < e && +s.end_date > t && a.push(s)
  2593.         }
  2594.     } else
  2595.         for (var i in n) a.push(n[i]);
  2596.     return a
  2597. }, gantt.isTaskExists = function(t) {
  2598.     return dhtmlx.defined(this._pull[t])
  2599. }, gantt.isUnscheduledTask = function(t) {
  2600.     return !!t.unscheduled || !t.start_date
  2601. }, gantt._isAllowedUnscheduledTask = function(t) {
  2602.     return t.unscheduled && gantt.config.show_unscheduled
  2603. }, gantt.isTaskVisible = function(t) {
  2604.     if (!this._pull[t]) return !1;
  2605.     var e = this._pull[t];
  2606.     if (!(+e.start_date < +this._max_date && +e.end_date > +this._min_date || gantt._isAllowedUnscheduledTask(e))) return !1;
  2607.     for (var n = 0, a = this._order.length; a > n; n++)
  2608.         if (this._order[n] == t) return !0;
  2609.     return !1
  2610. }, gantt.updateTask = function(t, e) {
  2611.     return dhtmlx.defined(e) || (e = this.getTask(t)), this.callEvent("onBeforeTaskUpdate", [t, e]) === !1 ? !1 : (this._pull[e.id] = e, this._is_parent_sync(e) || this._resync_parent(e), this._isAllowedUnscheduledTask(e) && (this._init_task(e), this._sync_links()), this._update_parents(e.id), this.refreshTask(e.id), this.callEvent("onAfterTaskUpdate", [t, e]), this._sync_order(), void this._adjust_scales())
  2612. }, gantt._add_branch = function(t, e) {
  2613.     var n = this.getParent(t);
  2614.     this.hasChild(n) || (this._branches[n] = []);
  2615.     for (var a = this.getChildren(n), i = !1, s = 0, r = a.length; r > s; s++)
  2616.         if (a[s] == t.id) {
  2617.             i = !0;
  2618.             break
  2619.         }
  2620.     i || (1 * e == e ? a.splice(e, 0, t.id) : a.push(t.id)), this._sync_parent(t)
  2621. }, gantt._move_branch = function(t, e, n) {
  2622.     this.setParent(t, n), this._sync_parent(t), this._replace_branch_child(e, t.id), this.isTaskExists(n) || n == this.config.root_id ? this._add_branch(t) : delete this._branches[t.id], t.$level = this.calculateTaskLevel(t), this._sync_order()
  2623. }, gantt._resync_parent = function(t) {
  2624.     this._move_branch(t, t.$rendered_parent, this.getParent(t))
  2625. }, gantt._sync_parent = function(t) {
  2626.     t.$rendered_parent = this.getParent(t)
  2627. }, gantt._is_parent_sync = function(t) {
  2628.     return t.$rendered_parent == this.getParent(t)
  2629. }, gantt._replace_branch_child = function(t, e, n) {
  2630.     var a = this.getChildren(t);
  2631.     if (a) {
  2632.         for (var i = [], s = 0; s < a.length; s++) a[s] != e ? i.push(a[s]) : n && i.push(n);
  2633.         this._branches[t] = i
  2634.     }
  2635.     this._sync_order()
  2636. }, gantt.addTask = function(t, e, n) {
  2637.     return dhtmlx.defined(e) || (e = this.getParent(t) || 0), this.isTaskExists(e) || (e = 0), this.setParent(t, e), t = this._init_task(t), this.callEvent("onBeforeTaskAdd", [t.id, t]) === !1 ? !1 : (this._pull[t.id] = t, this._add_branch(t, n), this.refreshData(), this._adjust_scales(), this.callEvent("onAfterTaskAdd", [t.id, t]), t.id)
  2638. }, gantt._default_task_date = function(t, e) {
  2639.     var n = e && e != this.config.root_id ? this.getTask(e) : !1,
  2640.         a = "";
  2641.     if (n) a = n.start_date;
  2642.     else {
  2643.         var i = this._order[0];
  2644.         a = i ? this.getTask(i).start_date ? this.getTask(i).start_date : this.getTask(i).end_date ? this.calculateEndDate(this.getTask(i).end_date, -this.config.duration_step) : "" : this.config.start_date || this.getState().min_date
  2645.     }
  2646.     return dhtmlx.assert(a, "Invalid dates"), new Date(a)
  2647. }, gantt._set_default_task_timing = function(t) {
  2648.     t.start_date = t.start_date || gantt._default_task_date(t, this.getParent(t)), t.duration = t.duration || this.config.duration_step, t.end_date = t.end_date || this.calculateEndDate(t.start_date, t.duration)
  2649. }, gantt.createTask = function(t, e, n) {
  2650.     if (t = t || {}, t.id = dhtmlx.uid(), t.start_date || (t.start_date = gantt._default_task_date(t, e)), void 0 === t.text && (t.text = gantt.locale.labels.new_task), void 0 === t.duration && (t.duration = 1), e) {
  2651.         this.setParent(t, e);
  2652.         var a = this.getTask(e);
  2653.         a.$open = !0
  2654.     }
  2655.     return this.callEvent("onTaskCreated", [t]) ? (this.config.details_on_create ? (t.$new = !0, this._pull[t.id] = this._init_task(t), this._add_branch(t, n), t.$level = this.calculateTaskLevel(t), this.selectTask(t.id), this.refreshData(), this.showLightbox(t.id)) : this.addTask(t, e, n) && (this.showTask(t.id), this.selectTask(t.id)), t.id) : null
  2656. }, gantt.deleteTask = function(t) {
  2657.     return this._deleteTask(t)
  2658. }, gantt._getChildLinks = function(t) {
  2659.     var e = this.getTask(t);
  2660.     if (!e) return [];
  2661.     for (var n = e.$source.concat(e.$target), a = this.getChildren(e.id), i = 0; i < a.length; i++) n = n.concat(this._getChildLinks(a[i]));
  2662.     for (var s = {}, i = 0; i < n.length; i++) s[n[i]] = !0;
  2663.     n = [];
  2664.     for (var i in s) n.push(i);
  2665.     return n
  2666. }, gantt._getTaskTree = function(t) {
  2667.     var e = this.getTask(t);
  2668.     if (!e) return [];
  2669.     for (var n = [], a = this.getChildren(e.id), i = 0; i < a.length; i++) n.push(a[i]), n = n.concat(this._getTaskTree(a[i]));
  2670.     return n
  2671. }, gantt._deleteRelatedLinks = function(t, e) {
  2672.     var n = this._dp && !e,
  2673.         a = "",
  2674.         i = n ? "off" != this._dp.updateMode : !1;
  2675.     n && (a = this._dp.updateMode, this._dp.setUpdateMode("off"));
  2676.     for (var s = 0; s < t.length; s++) n && (this._dp.setGanttMode("links"), this._dp.setUpdated(t[s], !0, "deleted")), this._deleteLink(t[s], !0);
  2677.     n && (this._dp.setUpdateMode(a), i && this._dp.sendAllData())
  2678. }, gantt._deleteRelatedTasks = function(t, e) {
  2679.     var n = this._dp && !e,
  2680.         a = "";
  2681.     n && (a = this._dp.updateMode, this._dp.setGanttMode("tasks"), this._dp.setUpdateMode("off"));
  2682.     for (var i = this._getTaskTree(t), s = 0; s < i.length; s++) {
  2683.         var r = i[s];
  2684.         this._unset_task(r), n && this._dp.setUpdated(r, !0, "deleted")
  2685.     }
  2686.     n && this._dp.setUpdateMode(a)
  2687. }, gantt._unset_task = function(t) {
  2688.     var e = this.getTask(t);
  2689.     this._update_flags(t, null), delete this._pull[t], this._move_branch(e, this.getParent(e), null)
  2690. }, gantt._deleteTask = function(t, e) {
  2691.     var n = this.getTask(t);
  2692.     if (!e && this.callEvent("onBeforeTaskDelete", [t, n]) === !1) return !1;
  2693.     var a = gantt._getChildLinks(t);
  2694.     return this._deleteRelatedTasks(t, e), this._deleteRelatedLinks(a, e), this._unset_task(t), e || (this.callEvent("onAfterTaskDelete", [t, n]), this.refreshData()), !0
  2695. }, gantt.clearAll = function() {
  2696.     this._clear_data(), this.callEvent("onClear", []), this.refreshData()
  2697. }, gantt._clear_data = function() {
  2698.     this._pull = {}, this._branches = {}, this._order = [], this._order_full = [], this._lpull = {}, this._update_flags(), this.userdata = {}
  2699. }, gantt._update_flags = function(t, e) {
  2700.     void 0 === t ? (this._lightbox_id = this._selected_task = null, this._tasks_dnd.drag && (this._tasks_dnd.drag.id = null)) : (this._lightbox_id == t && (this._lightbox_id = e), this._selected_task == t && (this._selected_task = e), this._tasks_dnd.drag && this._tasks_dnd.drag.id == t && (this._tasks_dnd.drag.id = e))
  2701. }, gantt.changeTaskId = function(t, e) {
  2702.     var n = this._pull[e] = this._pull[t];
  2703.     this._pull[e].id = e, delete this._pull[t];
  2704.     for (var a in this._pull) {
  2705.         var i = this._pull[a];
  2706.         this.getParent(i) == t && this.setParent(i, e)
  2707.     }
  2708.     this._update_flags(t, e), this._replace_branch_child(this.getParent(n), t, e), this.callEvent("onTaskIdChange", [t, e])
  2709. }, gantt._get_duration_unit = function() {
  2710.     return 1e3 * gantt._get_line(this.config.duration_unit) || this.config.duration_unit
  2711. }, gantt._get_safe_type = function() {
  2712.     return "task"
  2713. }, gantt._get_type_name = function(t) {
  2714.     for (var e in this.config.types)
  2715.         if (this.config.types[e] == t) return e;
  2716.     return "task"
  2717. }, gantt.getWorkHours = function(t) {
  2718.     return this._working_time_helper.get_working_hours(t)
  2719. }, gantt.setWorkTime = function(t) {
  2720.     this._working_time_helper.set_time(t)
  2721. }, gantt.isWorkTime = function(t, e) {
  2722.     var n = this._working_time_helper;
  2723.     return n.is_working_unit(t, e || this.config.duration_unit)
  2724. }, gantt.correctTaskWorkTime = function(t) {
  2725.     gantt.config.work_time && gantt.config.correct_work_time && (gantt.isWorkTime(t.start_date) ? gantt.isWorkTime(new Date(+t.end_date - 1)) || (t.end_date = gantt.calculateEndDate(t.start_date, t.duration)) : (t.start_date = gantt.getClosestWorkTime({
  2726.         date: t.start_date,
  2727.         dir: "future"
  2728.     }), t.end_date = gantt.calculateEndDate(t.start_date, t.duration)))
  2729. }, gantt.getClosestWorkTime = function(t) {
  2730.     var e = this._working_time_helper;
  2731.     return t instanceof Date && (t = {
  2732.         date: t
  2733.     }), t.dir = t.dir || "any", t.unit = t.unit || this.config.duration_unit, e.get_closest_worktime(t)
  2734. }, gantt.calculateDuration = function(t, e) {
  2735.     var n = this._working_time_helper;
  2736.     return n.get_work_units_between(t, e, this.config.duration_unit, this.config.duration_step)
  2737. }, gantt._hasDuration = function(t, e) {
  2738.     var n = this._working_time_helper;
  2739.     return n.is_work_units_between(t, e, this.config.duration_unit, this.config.duration_step)
  2740. }, gantt.calculateEndDate = function(t, e, n) {
  2741.     var a = this._working_time_helper,
  2742.         i = e >= 0 ? 1 : -1;
  2743.     return a.add_worktime(t, Math.abs(e), n || this.config.duration_unit, i * this.config.duration_step)
  2744. }, gantt._init_task = function(t) {
  2745.     return dhtmlx.defined(t.id) || (t.id = dhtmlx.uid()), t.start_date && (t.start_date = gantt.date.parseDate(t.start_date, "xml_date")), t.end_date && (t.end_date = gantt.date.parseDate(t.end_date, "xml_date")), t.start_date ? !t.end_date && t.duration && (t.end_date = this.calculateEndDate(t.start_date, t.duration)) : t.end_date && void 0 !== t.duration && (t.start_date = this.calculateEndDate(t.end_date, -t.duration)), this._isAllowedUnscheduledTask(t) && this._set_default_task_timing(t), gantt._init_task_timing(t), t.start_date && t.end_date && gantt.correctTaskWorkTime(t), t.$source = [], t.$target = [], void 0 === t.parent && this.setParent(t, this.config.root_id), dhtmlx.defined(t.$open) || (t.$open = dhtmlx.defined(t.open) ? t.open : this.config.open_tree_initially), t.$level = this.calculateTaskLevel(t), t
  2746. }, gantt._init_task_timing = function(t) {
  2747.     var e = this._get_safe_type(t.type);
  2748.     void 0 === t.$rendered_type ? t.$rendered_type = e : t.$rendered_type != e && (delete t.$no_end, delete t.$no_start, t.$rendered_type = e), void 0 !== t.$no_end && void 0 !== t.$no_start || e == this.config.types.milestone || (e == this.config.types.project ? (t.$no_end = t.$no_start = !0, this._set_default_task_timing(t)) : (t.$no_end = !(t.end_date || t.duration), t.$no_start = !t.start_date, this._isAllowedUnscheduledTask(t) && (t.$no_end = t.$no_start = !1))), e == this.config.types.milestone && (t.end_date = t.start_date), t.start_date && t.end_date && (t.duration = this.calculateDuration(t.start_date, t.end_date)), t.duration = t.duration || 0
  2749. }, gantt._is_flex_task = function(t) {
  2750.     return !(!t.$no_end && !t.$no_start)
  2751. }, gantt.resetProjectDates = function(t) {
  2752.     if (t.$no_end || t.$no_start) {
  2753.         var e = this.getSubtaskDates(t.id);
  2754.         this._assign_project_dates(t, e.start_date, e.end_date)
  2755.     }
  2756. }, gantt.getSubtaskDates = function(t) {
  2757.     var e = null,
  2758.         n = null,
  2759.         a = void 0 !== t ? t : gantt.config.root_id;
  2760.     return this.eachTask(function(t) {
  2761.         this._get_safe_type(t.type) == gantt.config.types.project || this.isUnscheduledTask(t) || (t.start_date && !t.$no_start && (!e || e > t.start_date.valueOf()) && (e = t.start_date.valueOf()), t.end_date && !t.$no_end && (!n || n < t.end_date.valueOf()) && (n = t.end_date.valueOf()))
  2762.     }, a), {
  2763.         start_date: e ? new Date(e) : null,
  2764.         end_date: n ? new Date(n) : null
  2765.     }
  2766. }, gantt._assign_project_dates = function(t, e, n) {
  2767.     t.$no_start && (t.start_date = e && e != 1 / 0 ? new Date(e) : this._default_task_date(t, this.getParent(t))), t.$no_end && (t.end_date = n && n != -(1 / 0) ? new Date(n) : this.calculateEndDate(t.start_date, this.config.duration_step)), (t.$no_start || t.$no_end) && this._init_task_timing(t)
  2768. }, gantt._update_parents = function(t, e) {
  2769.     if (t) {
  2770.         for (var n = this.getTask(t), a = this.getParent(n); !n.$no_end && !n.$no_start && a && this.isTaskExists(a);) n = this.getTask(a), a = this.getParent(n);
  2771.         (n.$no_start || n.$no_end) && (gantt.resetProjectDates(n), e || this.refreshTask(n.id, !0)), a && this.isTaskExists(a) && this._update_parents(a, e)
  2772.     }
  2773. }, gantt.isChildOf = function(t, e) {
  2774.     if (!this.isTaskExists(t)) return !1;
  2775.     if (e === this.config.root_id) return this.isTaskExists(t);
  2776.     for (var n = this.getTask(t), a = this.getParent(t); n && this.isTaskExists(a);) {
  2777.         if (n = this.getTask(a), n && n.id == e) return !0;
  2778.         a = this.getParent(n)
  2779.     }
  2780.     return !1
  2781. }, gantt.roundDate = function(t) {
  2782.     t instanceof Date && (t = {
  2783.         date: t,
  2784.         unit: gantt._tasks.unit,
  2785.         step: gantt._tasks.step
  2786.     });
  2787.     var e, n, a = t.date,
  2788.         i = t.step,
  2789.         s = t.unit;
  2790.     if (s == gantt._tasks.unit && i == gantt._tasks.step && +a >= +gantt._min_date && +a <= +gantt._max_date) {
  2791.         var r = Math.floor(gantt._day_index_by_date(a));
  2792.         n = new Date(gantt._tasks.trace_x[r]), e = new Date(n), gantt._tasks.trace_x[r + 1] && (e = new Date(gantt._tasks.trace_x[r + 1]))
  2793.     } else {
  2794.         for (e = gantt.date[s + "_start"](new Date(this._min_date)); + a > +e;) {
  2795.             e = gantt.date[s + "_start"](gantt.date.add(e, i, s));
  2796.             var o = e.getTimezoneOffset();
  2797.             e = gantt.date.add(e, i, s), e = gantt._correct_dst_change(e, o, e, s), gantt.date[s + "_start"] && (e = gantt.date[s + "_start"](e))
  2798.         }
  2799.         n = gantt.date.add(e, -1 * i, s)
  2800.     }
  2801.     return t.dir && "future" == t.dir ? e : t.dir && "past" == t.dir ? n : Math.abs(a - n) < Math.abs(e - a) ? n : e
  2802. }, gantt.attachEvent("onBeforeTaskUpdate", function(t, e) {
  2803.     return gantt._init_task_timing(e), !0
  2804. }), gantt.attachEvent("onBeforeTaskAdd", function(t, e) {
  2805.     return gantt._init_task_timing(e), !0
  2806. }), gantt.calculateTaskLevel = function(t) {
  2807.     for (var e = 0; this.getParent(t) && this.isTaskExists(this.getParent(t));) t = this.getTask(this.getParent(t)), e++;
  2808.     return e
  2809. }, gantt.sort = function(t, e, n, a) {
  2810.     var i = !a;
  2811.     this.isTaskExists(n) || (n = this.config.root_id), t || (t = "order");
  2812.     var s = "string" == typeof t ? function(e, n) {
  2813.             if (e[t] == n[t]) return 0;
  2814.             var a = e[t] > n[t];
  2815.             return a ? 1 : -1
  2816.         } : t;
  2817.     if (e) {
  2818.         var r = s;
  2819.         s = function(t, e) {
  2820.             return r(e, t)
  2821.         }
  2822.     }
  2823.     var o = this.getChildren(n);
  2824.     if (o) {
  2825.         for (var l = [], d = o.length - 1; d >= 0; d--) l[d] = this._pull[o[d]];
  2826.         l.sort(s);
  2827.         for (var d = 0; d < l.length; d++) o[d] = l[d].id, this.sort(t, e, o[d], !0)
  2828.     }
  2829.     i && this.render()
  2830. }, gantt.getNext = function(t) {
  2831.     for (var e = 0; e < this._order.length - 1; e++)
  2832.         if (this._order[e] == t) return this._order[e + 1];
  2833.     return null
  2834. }, gantt.getPrev = function(t) {
  2835.     for (var e = 1; e < this._order.length; e++)
  2836.         if (this._order[e] == t) return this._order[e - 1];
  2837.     return null
  2838. }, gantt._get_parent_id = function(t) {
  2839.     var e = this.config.root_id;
  2840.     return t && (e = t.parent), e
  2841. }, gantt.getParent = function(t) {
  2842.     var e = null;
  2843.     return t.id ? e = t : this.isTaskExists(t) && (e = gantt.getTask(t)), this._get_parent_id(e)
  2844. }, gantt.setParent = function(t, e) {
  2845.     t.parent = e
  2846. }, gantt.getSiblings = function(t) {
  2847.     if (!this.isTaskExists(t)) return [];
  2848.     var e = this.getParent(t);
  2849.     return this.getChildren(e)
  2850. }, gantt.getNextSibling = function(t) {
  2851.     for (var e = this.getSiblings(t), n = 0, a = e.length; a > n; n++)
  2852.         if (e[n] == t) return e[n + 1] || null;
  2853.     return null
  2854. }, gantt.getPrevSibling = function(t) {
  2855.     for (var e = this.getSiblings(t), n = 0, a = e.length; a > n; n++)
  2856.         if (e[n] == t) return e[n - 1] || null;
  2857.     return null
  2858. }, gantt._dp_init = function(t) {
  2859.     t.setTransactionMode("POST", !0), t.serverProcessor += (-1 != t.serverProcessor.indexOf("?") ? "&" : "?") + "editing=true", t._serverProcessor = t.serverProcessor, t.styles = {
  2860.         updated: "gantt_updated",
  2861.         inserted: "gantt_inserted",
  2862.         deleted: "gantt_deleted",
  2863.         invalid: "gantt_invalid",
  2864.         error: "gantt_error",
  2865.         clear: ""
  2866.     }, t._methods = ["_row_style", "setCellTextStyle", "_change_id", "_delete_task"], t.setGanttMode = function(e) {
  2867.         var n = t.modes || {};
  2868.         t._ganttMode && (n[t._ganttMode] = {
  2869.             _in_progress: t._in_progress,
  2870.             _invalid: t._invalid,
  2871.             updatedRows: t.updatedRows
  2872.         });
  2873.         var a = n[e];
  2874.         a || (a = n[e] = {
  2875.             _in_progress: {},
  2876.             _invalid: {},
  2877.             updatedRows: []
  2878.         }), t._in_progress = a._in_progress, t._invalid = a._invalid, t.updatedRows = a.updatedRows, t.modes = n, t._ganttMode = e
  2879.     }, this._sendTaskOrder = function(e, n) {
  2880.         n.$drop_target && (t.setGanttMode("tasks"), this.getTask(e).target = n.$drop_target, t.setUpdated(e, !0, "order"), delete this.getTask(e).$drop_target)
  2881.     }, this.attachEvent("onAfterTaskAdd", function(e) {
  2882.         t.setGanttMode("tasks"), t.setUpdated(e, !0, "inserted")
  2883.     }), this.attachEvent("onAfterTaskUpdate", function(e, n) {
  2884.         t.setGanttMode("tasks"), t.setUpdated(e, !0), gantt._sendTaskOrder(e, n)
  2885.     }), this.attachEvent("onAfterTaskDelete", function(e) {
  2886.         t.setGanttMode("tasks"), t.setUpdated(e, !0, "deleted"), "off" == t.updateMode || t._tSend || t.sendAllData()
  2887.     }), this.attachEvent("onAfterLinkUpdate", function(e) {
  2888.         t.setGanttMode("links"), t.setUpdated(e, !0)
  2889.     }), this.attachEvent("onAfterLinkAdd", function(e) {
  2890.         t.setGanttMode("links"), t.setUpdated(e, !0, "inserted")
  2891.     }), this.attachEvent("onAfterLinkDelete", function(e) {
  2892.         t.setGanttMode("links"), t.setUpdated(e, !0, "deleted")
  2893.     }), this.attachEvent("onRowDragEnd", function(t) {
  2894.         gantt._sendTaskOrder(t, gantt.getTask(t))
  2895.     }), t.attachEvent("onBeforeDataSending", function() {
  2896.         var t = this._serverProcessor;
  2897.         if ("REST" == this._tMode) {
  2898.             var e = this._ganttMode.substr(0, this._ganttMode.length - 1);
  2899.             t = t.substring(0, t.indexOf("?") > -1 ? t.indexOf("?") : t.length), this.serverProcessor = t + ("/" == t.slice(-1) ? "" : "/") + e
  2900.         } else this.serverProcessor = t + window.dhtmlx.url(t) + "gantt_mode=" + this._ganttMode;
  2901.         return !0
  2902.     }), this._init_dp_live_update_hooks(t);
  2903.     var e = t.afterUpdate;
  2904.     t.afterUpdate = function() {
  2905.         var n;
  2906.         n = 3 == arguments.length ? arguments[1] : arguments[4];
  2907.         var a = t._ganttMode,
  2908.             i = n.filePath;
  2909.         a = "REST" != this._tMode ? -1 != i.indexOf("gantt_mode=links") ? "links" : "tasks" : i.indexOf("/link") > i.indexOf("/task") ? "links" : "tasks", t.setGanttMode(a);
  2910.         var s = e.apply(t, arguments);
  2911.         return t.setGanttMode(a), s
  2912.     }, t._getRowData = dhtmlx.bind(function(e) {
  2913.         var n;
  2914.         n = "tasks" == t._ganttMode ? this.isTaskExists(e) ? this.getTask(e) : {
  2915.             id: e
  2916.         } : this.isLinkExists(e) ? this.getLink(e) : {
  2917.             id: e
  2918.         }, n = dhtmlx.copy(n);
  2919.         var a = {};
  2920.         for (var i in n)
  2921.             if ("$" != i.substr(0, 1)) {
  2922.                 var s = n[i];
  2923.                 a[i] = s instanceof Date ? this.templates.xml_format(s) : null === s ? "" : s
  2924.             }
  2925.         return n.$no_start && (n.start_date = "", n.duration = ""), n.$no_end && (n.end_date = "", n.duration = ""), a[t.action_param] = this.getUserData(e, t.action_param), a
  2926.     }, this), this._change_id = dhtmlx.bind(function(e, n) {
  2927.         "tasks" != t._ganttMode ? this.changeLinkId(e, n) : this.changeTaskId(e, n)
  2928.     }, this), this._row_style = function(e, n) {
  2929.         if ("tasks" == t._ganttMode && gantt.isTaskExists(e)) {
  2930.             var a = gantt.getTask(e);
  2931.             a.$dataprocessor_class = n, gantt.refreshTask(e)
  2932.         }
  2933.     }, this._delete_task = function() {}, this._dp = t, gantt._patch_dhx4_ajax()
  2934. }, gantt._patch_dhx4_ajax = function() {
  2935.     var t = parseInt((dhx4.version || "").split(".").join(""), 10);
  2936.     413 >= t && (window.dhx4.ajax._call = function(t, e, n, a, i, s, r) {
  2937.         var o = window.XMLHttpRequest && !dhx4.isIE ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP"),
  2938.             l = null != navigator.userAgent.match(/AppleWebKit/) && null != navigator.userAgent.match(/Qt/) && null != navigator.userAgent.match(/Safari/);
  2939.         if (1 == a && (o.onreadystatechange = function() {
  2940.             if (4 == o.readyState || 1 == l && 3 == o.readyState) {
  2941.                 if ((200 != o.status || "" == o.responseText) && !dhx4.callEvent("onAjaxError", [o])) return;
  2942.                 window.setTimeout(function() {
  2943.                     "function" == typeof i && i.apply(window, [{
  2944.                         xmlDoc: o,
  2945.                         filePath: e
  2946.                     }]), null != s && ("undefined" != typeof s.postData ? dhx4.ajax.postLong(s.url, s.postData, i) : dhx4.ajax.getLong(s.url, i)), i = null, o = null
  2947.                 }, 1)
  2948.             }
  2949.         }), "GET" == t && 1 != this.cache && (e += (e.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + (new Date).getTime() + "=1"), o.open(t, e, a), r)
  2950.             for (var d in r) o.setRequestHeader(d, r[d]);
  2951.         else "POST" == t.toUpperCase() || "PUT" == t || "DELETE" == t ? o.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") : "GET" == t && (n = null);
  2952.         return o.setRequestHeader("X-Requested-With", "XMLHttpRequest"), o.send(n), a ? void 0 : {
  2953.             xmlDoc: o,
  2954.             filePath: e
  2955.         }
  2956.     }), gantt._patch_dhx4_ajax = function() {}
  2957. }, gantt.getUserData = function(t, e) {
  2958.     return this.userdata || (this.userdata = {}), this.userdata[t] && this.userdata[t][e] ? this.userdata[t][e] : ""
  2959. }, gantt.setUserData = function(t, e, n) {
  2960.     this.userdata || (this.userdata = {}), this.userdata[t] || (this.userdata[t] = {}), this.userdata[t][e] = n
  2961. }, gantt._init_link = function(t) {
  2962.     return dhtmlx.defined(t.id) || (t.id = dhtmlx.uid()), t
  2963. }, gantt._sync_links = function() {
  2964.     for (var t in this._pull) this._pull[t].$source = [], this._pull[t].$target = [];
  2965.     for (var t in this._lpull) {
  2966.         var e = this._lpull[t];
  2967.         this._pull[e.source] && this._pull[e.source].$source.push(t), this._pull[e.target] && this._pull[e.target].$target.push(t)
  2968.     }
  2969. }, gantt.getLink = function(t) {
  2970.     return dhtmlx.assert(this._lpull[t], "Link doesn't exist"), this._lpull[t]
  2971. }, gantt.getLinks = function() {
  2972.     var t = [];
  2973.     for (var e in gantt._lpull) t.push(gantt._lpull[e]);
  2974.     return t
  2975. }, gantt.isLinkExists = function(t) {
  2976.     return dhtmlx.defined(this._lpull[t])
  2977. }, gantt.addLink = function(t) {
  2978.     return t = this._init_link(t), this.callEvent("onBeforeLinkAdd", [t.id, t]) === !1 ? !1 : (this._lpull[t.id] = t, this._sync_links(), this._render_link(t.id), this.callEvent("onAfterLinkAdd", [t.id, t]), t.id)
  2979. }, gantt.updateLink = function(t, e) {
  2980.     return dhtmlx.defined(e) || (e = this.getLink(t)), this.callEvent("onBeforeLinkUpdate", [t, e]) === !1 ? !1 : (this._lpull[t] = e, this._sync_links(), this._render_link(t), this.callEvent("onAfterLinkUpdate", [t, e]), !0)
  2981. }, gantt.deleteLink = function(t) {
  2982.     return this._deleteLink(t)
  2983. }, gantt._deleteLink = function(t, e) {
  2984.     var n = this.getLink(t);
  2985.     return e || this.callEvent("onBeforeLinkDelete", [t, n]) !== !1 ? (delete this._lpull[t], this._sync_links(), this.refreshLink(t), e || this.callEvent("onAfterLinkDelete", [t, n]), !0) : !1
  2986. }, gantt.changeLinkId = function(t, e) {
  2987.     this._lpull[e] = this._lpull[t], this._lpull[e].id = e, delete this._lpull[t], this._sync_links(), this.callEvent("onLinkIdChange", [t, e])
  2988. }, gantt.getChildren = function(t) {
  2989.     return dhtmlx.defined(this._branches[t]) ? this._branches[t] : []
  2990. }, gantt.hasChild = function(t) {
  2991.     return dhtmlx.defined(this._branches[t]) && this._branches[t].length
  2992. }, gantt.refreshData = function() {
  2993.     this._render_data()
  2994. }, gantt._configure = function(t, e, n) {
  2995.     for (var a in e)("undefined" == typeof t[a] || n) && (t[a] = e[a])
  2996. }, gantt._init_skin = function() {
  2997.     gantt._get_skin(!1), gantt._init_skin = function() {}
  2998. }, gantt._get_skin = function(t) {
  2999.     if (!gantt.skin || t)
  3000.         for (var e = document.getElementsByTagName("link"), n = 0; n < e.length; n++) {
  3001.             var a = e[n].href.match("dhtmlxgantt_([a-z]+).css");
  3002.             if (a) {
  3003.                 gantt.skin = a[1];
  3004.                 break
  3005.             }
  3006.         }
  3007.     gantt.skin || (gantt.skin = "terrace");
  3008.     var i = gantt.skins[gantt.skin];
  3009.     this._configure(gantt.config, i.config, t);
  3010.     var s = gantt.getGridColumns();
  3011.     s[1] && "undefined" == typeof s[1].width && (s[1].width = i._second_column_width), s[2] && "undefined" == typeof s[2].width && (s[2].width = i._third_column_width), i._lightbox_template && (gantt._lightbox_template = i._lightbox_template), gantt.resetLightbox()
  3012. }, gantt.resetSkin = function() {
  3013.     this.skin = "", this._get_skin(!0)
  3014. }, gantt.skins = {}, gantt._lightbox_methods = {}, gantt._lightbox_template = "<div class='gantt_cal_ltitle'><span class='gantt_mark'>&nbsp;</span><span class='gantt_time'></span><span class='gantt_title'></span></div><div class='gantt_cal_larea'></div>", gantt.showLightbox = function(t) {
  3015.     if (t && !gantt._is_readonly(this.getTask(t)) && this.callEvent("onBeforeLightbox", [t])) {
  3016.         var e = this.getTask(t),
  3017.             n = this.getLightbox(this._get_safe_type(e.type));
  3018.         this._center_lightbox(n), this.showCover(), this._fill_lightbox(t, n), this.callEvent("onLightbox", [t])
  3019.     }
  3020. }, gantt._get_timepicker_step = function() {
  3021.     if (this.config.round_dnd_dates) {
  3022.         var t = gantt._tasks,
  3023.             e = this._get_line(t.unit) * t.step / 60;
  3024.         return (e >= 1440 || !this._is_chart_visible()) && (e = this.config.time_step), e
  3025.     }
  3026.     return this.config.time_step
  3027. }, gantt.getLabel = function(t, e) {
  3028.     for (var n = this._get_typed_lightbox_config(), a = 0; a < n.length; a++)
  3029.         if (n[a].map_to == t)
  3030.             for (var i = n[a].options, s = 0; s < i.length; s++)
  3031.                 if (i[s].key == e) return i[s].label;
  3032.     return ""
  3033. }, gantt.updateCollection = function(t, e) {
  3034.     e = e.slice(0);
  3035.     var n = gantt.serverList(t);
  3036.     return n ? (n.splice(0, n.length), n.push.apply(n, e || []), void gantt.resetLightbox()) : !1
  3037. }, gantt.getLightboxType = function() {
  3038.     return this._get_safe_type(this._lightbox_type)
  3039. }, gantt.getLightbox = function(t) {
  3040.     if (void 0 === t && (t = this.getLightboxType()), !this._lightbox || this.getLightboxType() != this._get_safe_type(t)) {
  3041.         this._lightbox_type = this._get_safe_type(t);
  3042.         var e = document.createElement("DIV");
  3043.         e.className = "gantt_cal_light";
  3044.         var n = this._is_lightbox_timepicker();
  3045.         (gantt.config.wide_form || n) && (e.className += " gantt_cal_light_wide"), n && (gantt.config.wide_form = !0, e.className += " gantt_cal_light_full"), e.style.visibility = "hidden";
  3046.         for (var a = this._lightbox_template, i = this.config.buttons_left, s = 0; s < i.length; s++) {
  3047.             var r = this.config._migrate_buttons[i[s]] ? this.config._migrate_buttons[i[s]] : i[s];
  3048.             a += "<div class='gantt_btn_set gantt_left_btn_set " + r + "_set'><div dhx_button='1' class='" + r + "'></div><div>" + this.locale.labels[r] + "</div></div>"
  3049.         }
  3050.         i = this.config.buttons_right;
  3051.         for (var s = 0; s < i.length; s++) {
  3052.             var r = this.config._migrate_buttons[i[s]] ? this.config._migrate_buttons[i[s]] : i[s];
  3053.             a += "<div class='gantt_btn_set gantt_right_btn_set " + r + "_set' style='float:right;'><div dhx_button='1' class='" + r + "'></div><div>" + this.locale.labels[r] + "</div></div>"
  3054.         }
  3055.         a += "</div>", e.innerHTML = a, gantt.config.drag_lightbox && (e.firstChild.onmousedown = gantt._ready_to_dnd, e.firstChild.onselectstart = function() {
  3056.             return !1
  3057.         }, e.firstChild.style.cursor = "pointer", gantt._init_dnd_events()), document.body.insertBefore(e, document.body.firstChild), this._lightbox = e;
  3058.         var o = this._get_typed_lightbox_config(t);
  3059.         a = this._render_sections(o);
  3060.         for (var l = e.getElementsByTagName("div"), s = 0; s < l.length; s++) {
  3061.             var d = l[s];
  3062.             if ("gantt_cal_larea" == d.className) {
  3063.                 d.innerHTML = a;
  3064.                 break
  3065.             }
  3066.         }
  3067.         this.resizeLightbox(), this._init_lightbox_events(this), e.style.display = "none", e.style.visibility = "visible"
  3068.     }
  3069.     return this._lightbox
  3070. }, gantt._render_sections = function(t) {
  3071.     for (var e = "", n = 0; n < t.length; n++) {
  3072.         var a = this.form_blocks[t[n].type];
  3073.         if (a) {
  3074.             t[n].id = "area_" + dhtmlx.uid();
  3075.             var i = t[n].hidden ? " style='display:none'" : "",
  3076.                 s = "";
  3077.             t[n].button && (s = "<div class='gantt_custom_button' index='" + n + "'><div class='gantt_custom_button_" + t[n].button + "'></div><div>" + this.locale.labels["button_" + t[n].button] + "</div></div>"), this.config.wide_form && (e += "<div class='gantt_wrap_section' " + i + ">"), e += "<div id='" + t[n].id + "' class='gantt_cal_lsection'>" + s + this.locale.labels["section_" + t[n].name] + "</div>" + a.render.call(this, t[n]), e += "</div>"
  3078.         }
  3079.     }
  3080.     return e
  3081. }, gantt.resizeLightbox = function() {
  3082.     var t = this._lightbox;
  3083.     if (t) {
  3084.         var e = t.childNodes[1];
  3085.         e.style.height = "0px", e.style.height = e.scrollHeight + "px", t.style.height = e.scrollHeight + this.config.lightbox_additional_height + "px", e.style.height = e.scrollHeight + "px"
  3086.     }
  3087. }, gantt._center_lightbox = function(t) {
  3088.     if (t) {
  3089.         t.style.display = "block";
  3090.         var e = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop,
  3091.             n = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft,
  3092.             a = window.innerHeight || document.documentElement.clientHeight;
  3093.         t.style.top = e ? Math.round(e + Math.max((a - t.offsetHeight) / 2, 0)) + "px" : Math.round(Math.max((a - t.offsetHeight) / 2, 0) + 9) + "px", t.style.left = document.documentElement.scrollWidth > document.body.offsetWidth ? Math.round(n + (document.body.offsetWidth - t.offsetWidth) / 2) + "px" : Math.round((document.body.offsetWidth - t.offsetWidth) / 2) + "px"
  3094.     }
  3095. }, gantt.showCover = function() {
  3096.     if (!this._cover) {
  3097.         this._cover = document.createElement("DIV"), this._cover.className = "gantt_cal_cover";
  3098.         var t = void 0 !== document.height ? document.height : document.body.offsetHeight,
  3099.             e = document.documentElement ? document.documentElement.scrollHeight : 0;
  3100.         this._cover.style.height = Math.max(t, e) + "px", document.body.appendChild(this._cover)
  3101.     }
  3102. }, gantt._init_lightbox_events = function() {
  3103.     gantt.lightbox_events = {}, gantt.lightbox_events.gantt_save_btn = function() {
  3104.         gantt._save_lightbox()
  3105.     }, gantt.lightbox_events.gantt_delete_btn = function() {
  3106.         gantt.callEvent("onLightboxDelete", [gantt._lightbox_id]) && (gantt.isTaskExists(gantt._lightbox_id) ? gantt.$click.buttons["delete"](gantt._lightbox_id) : gantt.hideLightbox())
  3107.     }, gantt.lightbox_events.gantt_cancel_btn = function() {
  3108.         gantt._cancel_lightbox()
  3109.     }, gantt.lightbox_events["default"] = function(t, e) {
  3110.         if (e.getAttribute("dhx_button")) gantt.callEvent("onLightboxButton", [e.className, e, t]);
  3111.         else {
  3112.             var n, a, i, s = gantt._getClassName(e); - 1 != s.indexOf("gantt_custom_button") && (-1 != s.indexOf("gantt_custom_button_") ? (n = e.parentNode.getAttribute("index"), i = e.parentNode.parentNode) : (n = e.getAttribute("index"), i = e.parentNode, e = e.firstChild));
  3113.             var r = gantt._get_typed_lightbox_config();
  3114.             n && (a = gantt.form_blocks[r[n].type], a.button_click(n, e, i, i.nextSibling))
  3115.         }
  3116.     }, dhtmlxEvent(gantt.getLightbox(), "click", function(t) {
  3117.         t = t || window.event;
  3118.         var e = t.target ? t.target : t.srcElement,
  3119.             n = gantt._getClassName(e);
  3120.         if (n || (e = e.previousSibling, n = gantt._getClassName(e)), e && n && 0 === n.indexOf("gantt_btn_set") && (e = e.firstChild, n = gantt._getClassName(e)), e && n) {
  3121.             var a = dhtmlx.defined(gantt.lightbox_events[e.className]) ? gantt.lightbox_events[e.className] : gantt.lightbox_events["default"];
  3122.             return a(t, e)
  3123.         }
  3124.         return !1
  3125.     }), gantt.getLightbox().onkeydown = function(t) {
  3126.         switch ((t || event).keyCode) {
  3127.             case gantt.keys.edit_save:
  3128.                 if ((t || event).shiftKey) return;
  3129.                 gantt._save_lightbox();
  3130.                 break;
  3131.             case gantt.keys.edit_cancel:
  3132.                 gantt._cancel_lightbox()
  3133.         }
  3134.     }
  3135. }, gantt._cancel_lightbox = function() {
  3136.     var t = this.getLightboxValues();
  3137.     this.callEvent("onLightboxCancel", [this._lightbox_id, t.$new]), gantt.isTaskExists(t.id) && t.$new && this._deleteTask(t.id, !0), this.refreshData(), this.hideLightbox()
  3138. }, gantt._save_lightbox = function() {
  3139.     var t = this.getLightboxValues();
  3140.     this.callEvent("onLightboxSave", [this._lightbox_id, t, !! t.$new]) && (t.$new ? (delete t.$new, this.addTask(t)) : this.isTaskExists(t.id) && (dhtmlx.mixin(this.getTask(t.id), t, !0), this.updateTask(t.id)), this.refreshData(), this.hideLightbox())
  3141. }, gantt._resolve_default_mapping = function(t) {
  3142.     var e = t.map_to,
  3143.         n = {
  3144.             time: !0,
  3145.             time_optional: !0,
  3146.             duration: !0,
  3147.             duration_optional: !0
  3148.         };
  3149.     return n[t.type] && ("auto" == t.map_to ? e = {
  3150.         start_date: "start_date",
  3151.         end_date: "end_date",
  3152.         duration: "duration"
  3153.     } : "string" == typeof t.map_to && (e = {
  3154.         start_date: t.map_to
  3155.     })), e
  3156. }, gantt.getLightboxValues = function() {
  3157.     var t = {};
  3158.     gantt.isTaskExists(this._lightbox_id) && (t = dhtmlx.mixin({}, this.getTask(this._lightbox_id)));
  3159.     for (var e = this._get_typed_lightbox_config(), n = 0; n < e.length; n++) {
  3160.         var a = document.getElementById(e[n].id);
  3161.         a = a ? a.nextSibling : a;
  3162.         var i = this.form_blocks[e[n].type];
  3163.         if (i) {
  3164.             var s = i.get_value.call(this, a, t, e[n]),
  3165.                 r = gantt._resolve_default_mapping(e[n]);
  3166.             if ("string" == typeof r && "auto" != r) t[r] = s;
  3167.             else if ("object" == typeof r)
  3168.                 for (var o in r) r[o] && (t[r[o]] = s[o])
  3169.         }
  3170.     }
  3171.     return t
  3172. }, gantt.hideLightbox = function() {
  3173.     var t = this.getLightbox();
  3174.     t && (t.style.display = "none"), this._lightbox_id = null, this.hideCover(), this.callEvent("onAfterLightbox", [])
  3175. }, gantt.hideCover = function() {
  3176.     this._cover && this._cover.parentNode.removeChild(this._cover), this._cover = null
  3177. }, gantt.resetLightbox = function() {
  3178.     gantt._lightbox && !gantt._custom_lightbox && gantt._lightbox.parentNode.removeChild(gantt._lightbox), gantt._lightbox = null
  3179. }, gantt._set_lightbox_values = function(t, e) {
  3180.     var n = t,
  3181.         a = e.getElementsByTagName("span");
  3182.     gantt.templates.lightbox_header ? (a[1].innerHTML = "", a[2].innerHTML = gantt.templates.lightbox_header(n.start_date, n.end_date, n)) : (a[1].innerHTML = this.templates.task_time(n.start_date, n.end_date, n), a[2].innerHTML = (this.templates.task_text(n.start_date, n.end_date, n) || "").substr(0, 70));
  3183.     for (var i = this._get_typed_lightbox_config(this.getLightboxType()), s = 0; s < i.length; s++) {
  3184.         var r = i[s];
  3185.         if (this.form_blocks[r.type]) {
  3186.             var o = document.getElementById(r.id).nextSibling,
  3187.                 l = this.form_blocks[r.type],
  3188.                 d = gantt._resolve_default_mapping(i[s]),
  3189.                 _ = dhtmlx.defined(n[d]) ? n[d] : r.default_value;
  3190.             l.set_value.call(gantt, o, _, n, r), r.focus && l.focus.call(gantt, o)
  3191.         }
  3192.     }
  3193.     t.id && (gantt._lightbox_id = t.id)
  3194. }, gantt._fill_lightbox = function(t, e) {
  3195.     var n = this.getTask(t);
  3196.     this._set_lightbox_values(n, e)
  3197. }, gantt.getLightboxSection = function(t) {
  3198.     var e = this._get_typed_lightbox_config(),
  3199.         n = 0;
  3200.     for (n; n < e.length && e[n].name != t; n++);
  3201.     var a = e[n];
  3202.     if (!a) return null;
  3203.     this._lightbox || this.getLightbox();
  3204.     var i = document.getElementById(a.id),
  3205.         s = i.nextSibling,
  3206.         r = {
  3207.             section: a,
  3208.             header: i,
  3209.             node: s,
  3210.             getValue: function(t) {
  3211.                 return gantt.form_blocks[a.type].get_value.call(gantt, s, t || {}, a)
  3212.             },
  3213.             setValue: function(t, e) {
  3214.                 return gantt.form_blocks[a.type].set_value.call(gantt, s, t, e || {}, a)
  3215.             }
  3216.         }, o = this._lightbox_methods["get_" + a.type + "_control"];
  3217.     return o ? o(r) : r
  3218. }, gantt._lightbox_methods.get_template_control = function(t) {
  3219.     return t.control = t.node, t
  3220. }, gantt._lightbox_methods.get_select_control = function(t) {
  3221.     return t.control = t.node.getElementsByTagName("select")[0], t
  3222. }, gantt._lightbox_methods.get_textarea_control = function(t) {
  3223.     return t.control = t.node.getElementsByTagName("textarea")[0], t
  3224. }, gantt._lightbox_methods.get_time_control = function(t) {
  3225.     return t.control = t.node.getElementsByTagName("select"), t
  3226. }, gantt._init_dnd_events = function() {
  3227.     dhtmlxEvent(document.body, "mousemove", gantt._move_while_dnd), dhtmlxEvent(document.body, "mouseup", gantt._finish_dnd), gantt._init_dnd_events = function() {}
  3228. }, gantt._move_while_dnd = function(t) {
  3229.     if (gantt._dnd_start_lb) {
  3230.         document.gantt_unselectable || (document.body.className += " gantt_unselectable", document.gantt_unselectable = !0);
  3231.         var e = gantt.getLightbox(),
  3232.             n = t && t.target ? [t.pageX, t.pageY] : [event.clientX, event.clientY];
  3233.         e.style.top = gantt._lb_start[1] + n[1] - gantt._dnd_start_lb[1] + "px", e.style.left = gantt._lb_start[0] + n[0] - gantt._dnd_start_lb[0] + "px"
  3234.     }
  3235. }, gantt._ready_to_dnd = function(t) {
  3236.     var e = gantt.getLightbox();
  3237.     gantt._lb_start = [parseInt(e.style.left, 10), parseInt(e.style.top, 10)], gantt._dnd_start_lb = t && t.target ? [t.pageX, t.pageY] : [event.clientX, event.clientY]
  3238. }, gantt._finish_dnd = function() {
  3239.     gantt._lb_start && (gantt._lb_start = gantt._dnd_start_lb = !1, document.body.className = document.body.className.replace(" gantt_unselectable", ""), document.gantt_unselectable = !1)
  3240. }, gantt._focus = function(t, e) {
  3241.     if (t && t.focus)
  3242.         if (gantt.config.touch);
  3243.         else try {
  3244.             e && t.select && t.select(), t.focus()
  3245.         } catch (n) {}
  3246. }, gantt.form_blocks = {
  3247.     getTimePicker: function(t, e) {
  3248.         var n = t.time_format;
  3249.         if (!n) {
  3250.             var n = ["%d", "%m", "%Y"];
  3251.             gantt._get_line(gantt._tasks.unit) < gantt._get_line("day") && n.push("%H:%i")
  3252.         }
  3253.         t._time_format_order = {
  3254.             size: 0
  3255.         };
  3256.         var a = this.config,
  3257.             i = this.date.date_part(new Date(gantt._min_date.valueOf())),
  3258.             s = 1440,
  3259.             r = 0;
  3260.         gantt.config.limit_time_select && (s = 60 * a.last_hour + 1, r = 60 * a.first_hour, i.setHours(a.first_hour));
  3261.         for (var o = "", l = 0; l < n.length; l++) {
  3262.             var d = n[l];
  3263.             l > 0 && (o += " ");
  3264.             var _ = "";
  3265.             switch (d) {
  3266.                 case "%Y":
  3267.                     t._time_format_order[2] = l, t._time_format_order.size++;
  3268.                     var c, g, h, u;
  3269.                     t.year_range && (isNaN(t.year_range) ? t.year_range.push && (h = t.year_range[0], u = t.year_range[1]) : c = t.year_range), c = c || 10, g = g || Math.floor(c / 2), h = h || i.getFullYear() - g, u = u || h + c;
  3270.                     for (var f = h; u > f; f++) _ += "<option value='" + f + "'>" + f + "</option>";
  3271.                     break;
  3272.                 case "%m":
  3273.                     t._time_format_order[1] = l, t._time_format_order.size++;
  3274.                     for (var f = 0; 12 > f; f++) _ += "<option value='" + f + "'>" + this.locale.date.month_full[f] + "</option>";
  3275.                     break;
  3276.                 case "%d":
  3277.                     t._time_format_order[0] = l, t._time_format_order.size++;
  3278.                     for (var f = 1; 32 > f; f++) _ += "<option value='" + f + "'>" + f + "</option>";
  3279.                     break;
  3280.                 case "%H:%i":
  3281.                     t._time_format_order[3] = l, t._time_format_order.size++;
  3282.                     var f = r,
  3283.                         p = i.getDate();
  3284.                     for (t._time_values = []; s > f;) {
  3285.                         var v = this.templates.time_picker(i);
  3286.                         _ += "<option value='" + f + "'>" + v + "</option>", t._time_values.push(f), i.setTime(i.valueOf() + 60 * this._get_timepicker_step() * 1e3);
  3287.                         var m = i.getDate() != p ? 1 : 0;
  3288.                         f = 24 * m * 60 + 60 * i.getHours() + i.getMinutes()
  3289.                     }
  3290.             }
  3291.             if (_) {
  3292.                 var k = t.readonly ? "disabled='disabled'" : "",
  3293.                     x = e ? " style='display:none'" : "";
  3294.                 o += "<select " + k + x + ">" + _ + "</select>"
  3295.             }
  3296.         }
  3297.         return o
  3298.     },
  3299.     _fill_lightbox_select: function(t, e, n, a) {
  3300.         if (t[e + a[0]].value = n.getDate(), t[e + a[1]].value = n.getMonth(), t[e + a[2]].value = n.getFullYear(), dhtmlx.defined(a[3])) {
  3301.             var i = 60 * n.getHours() + n.getMinutes();
  3302.             i = Math.round(i / gantt._get_timepicker_step()) * gantt._get_timepicker_step();
  3303.             var s = t[e + a[3]];
  3304.             s.value = i, s.setAttribute("data-value", i)
  3305.         }
  3306.     },
  3307.     template: {
  3308.         render: function(t) {
  3309.             var e = (t.height || "30") + "px";
  3310.             return "<div class='gantt_cal_ltext gantt_cal_template' style='height:" + e + ";'></div>"
  3311.         },
  3312.         set_value: function(t, e) {
  3313.             t.innerHTML = e || ""
  3314.         },
  3315.         get_value: function(t) {
  3316.             return t.innerHTML || ""
  3317.         },
  3318.         focus: function() {}
  3319.     },
  3320.     textarea: {
  3321.         render: function(t) {
  3322.             var e = (t.height || "130") + "px";
  3323.             return "<div class='gantt_cal_ltext' style='height:" + e + ";'><textarea></textarea></div>"
  3324.         },
  3325.         set_value: function(t, e) {
  3326.             t.firstChild.value = e || ""
  3327.         },
  3328.         get_value: function(t) {
  3329.             return t.firstChild.value
  3330.         },
  3331.         focus: function(t) {
  3332.             var e = t.firstChild;
  3333.             gantt._focus(e, !0)
  3334.         }
  3335.     },
  3336.     select: {
  3337.         render: function(t) {
  3338.             for (var e = (t.height || "23") + "px", n = "<div class='gantt_cal_ltext' style='height:" + e + ";'><select style='width:100%;'>", a = 0; a < t.options.length; a++) n += "<option value='" + t.options[a].key + "'>" + t.options[a].label + "</option>";
  3339.             return n += "</select></div>"
  3340.         },
  3341.         set_value: function(t, e, n, a) {
  3342.             var i = t.firstChild;
  3343.             !i._dhx_onchange && a.onchange && (i.onchange = a.onchange, i._dhx_onchange = !0), "undefined" == typeof e && (e = (i.options[0] || {}).value), i.value = e || ""
  3344.         },
  3345.         get_value: function(t) {
  3346.             return t.firstChild.value
  3347.         },
  3348.         focus: function(t) {
  3349.             var e = t.firstChild;
  3350.             gantt._focus(e, !0)
  3351.         }
  3352.     },
  3353.     time: {
  3354.         render: function(t) {
  3355.             var e = this.form_blocks.getTimePicker.call(this, t),
  3356.                 n = ["<div style='height:" + (t.height || 30) + "px;padding-top:0px;font-size:inherit;text-align:center;' class='gantt_section_time'>"];
  3357.             return n.push(e), t.single_date ? (e = this.form_blocks.getTimePicker.call(this, t, !0), n.push("<span></span>")) : n.push("<span style='font-weight:normal; font-size:10pt;'> &nbsp;&ndash;&nbsp; </span>"), n.push(e), n.push("</div>"), n.join("")
  3358.         },
  3359.         set_value: function(t, e, n, a) {
  3360.             var i = a,
  3361.                 s = t.getElementsByTagName("select"),
  3362.                 r = a._time_format_order;
  3363.             if (a._time_format_size, i.auto_end_date)
  3364.                 for (var o = function() {
  3365.                     _ = new Date(s[r[2]].value, s[r[1]].value, s[r[0]].value, 0, 0), c = gantt.calculateEndDate(_, 1), this.form_blocks._fill_lightbox_select(s, r.size, c, r, i)
  3366.                 }, l = 0; 4 > l; l++) s[l].onchange = o;
  3367.             var d = gantt._resolve_default_mapping(a);
  3368.             "string" == typeof d && (d = {
  3369.                 start_date: d
  3370.             });
  3371.             var _ = n[d.start_date] || new Date,
  3372.                 c = n[d.end_date] || gantt.calculateEndDate(_, 1);
  3373.             this.form_blocks._fill_lightbox_select(s, 0, _, r, i), this.form_blocks._fill_lightbox_select(s, r.size, c, r, i)
  3374.         },
  3375.         get_value: function(t, e, n) {
  3376.             var a = t.getElementsByTagName("select"),
  3377.                 i = n._time_format_order,
  3378.                 s = 0,
  3379.                 r = 0;
  3380.             if (dhtmlx.defined(i[3])) {
  3381.                 var o = parseInt(a[i[3]].value, 10);
  3382.                 s = Math.floor(o / 60), r = o % 60
  3383.             }
  3384.             var l = new Date(a[i[2]].value, a[i[1]].value, a[i[0]].value, s, r);
  3385.             if (s = r = 0, dhtmlx.defined(i[3])) {
  3386.                 var o = parseInt(a[i.size + i[3]].value, 10);
  3387.                 s = Math.floor(o / 60), r = o % 60
  3388.             }
  3389.             var d = new Date(a[i[2] + i.size].value, a[i[1] + i.size].value, a[i[0] + i.size].value, s, r);
  3390.             l >= d && (d = gantt.date.add(l, gantt._get_timepicker_step(), "minute"));
  3391.             var _ = gantt._resolve_default_mapping(n),
  3392.                 c = {
  3393.                     start_date: new Date(l),
  3394.                     end_date: new Date(d)
  3395.                 };
  3396.             return "string" == typeof _ ? c.start_date : c
  3397.         },
  3398.         focus: function(t) {
  3399.             gantt._focus(t.getElementsByTagName("select")[0])
  3400.         }
  3401.     },
  3402.     duration: {
  3403.         render: function(t) {
  3404.             var e = this.form_blocks.getTimePicker.call(this, t);
  3405.             e = "<div class='gantt_time_selects'>" + e + "</div>";
  3406.             var n = this.locale.labels[this.config.duration_unit + "s"],
  3407.                 a = t.single_date ? ' style="display:none"' : "",
  3408.                 i = t.readonly ? " disabled='disabled'" : "",
  3409.                 s = "<div class='gantt_duration' " + a + "><input type='button' class='gantt_duration_dec' value='-'" + i + "><input type='text' value='5' class='gantt_duration_value'" + i + "><input type='button' class='gantt_duration_inc' value='+'" + i + "> " + n + " <span></span></div>",
  3410.                 r = "<div style='height:" + (t.height || 30) + "px;padding-top:0px;font-size:inherit;' class='gantt_section_time'>" + e + " " + s + "</div>";
  3411.             return r
  3412.         },
  3413.         set_value: function(t, e, n, a) {
  3414.             function i() {
  3415.                 var e = gantt.form_blocks.duration._get_start_date.call(gantt, t, a),
  3416.                     n = gantt.form_blocks.duration._get_duration.call(gantt, t, a),
  3417.                     i = gantt.calculateEndDate(e, n);
  3418.                 c.innerHTML = gantt.templates.task_date(i)
  3419.             }
  3420.  
  3421.             function s(t) {
  3422.                 var e = d.value;
  3423.                 e = parseInt(e, 10),
  3424.                 window.isNaN(e) && (e = 0), e += t, 1 > e && (e = 1), d.value = e, i()
  3425.             }
  3426.             var r = a,
  3427.                 o = t.getElementsByTagName("select"),
  3428.                 l = t.getElementsByTagName("input"),
  3429.                 d = l[1],
  3430.                 _ = [l[0], l[2]],
  3431.                 c = t.getElementsByTagName("span")[0],
  3432.                 g = a._time_format_order;
  3433.             _[0].onclick = dhtmlx.bind(function() {
  3434.                 s(-1 * this.config.duration_step)
  3435.             }, this), _[1].onclick = dhtmlx.bind(function() {
  3436.                 s(1 * this.config.duration_step)
  3437.             }, this), o[0].onchange = i, o[1].onchange = i, o[2].onchange = i, o[3] && (o[3].onchange = i), d.onkeydown = dhtmlx.bind(function(t) {
  3438.                 t = t || window.event;
  3439.                 var e = t.charCode || t.keyCode || t.which;
  3440.                 return 40 == e ? (s(-1 * this.config.duration_step), !1) : 38 == e ? (s(1 * this.config.duration_step), !1) : void window.setTimeout(function() {
  3441.                     i()
  3442.                 }, 1)
  3443.             }, this), d.onchange = dhtmlx.bind(function() {
  3444.                 i()
  3445.             }, this);
  3446.             var h = gantt._resolve_default_mapping(a);
  3447.             "string" == typeof h && (h = {
  3448.                 start_date: h
  3449.             });
  3450.             var u = n[h.start_date] || new Date,
  3451.                 f = n[h.end_date] || gantt.calculateEndDate(u, 1),
  3452.                 p = Math.round(n[h.duration]) || gantt.calculateDuration(u, f);
  3453.             gantt.form_blocks._fill_lightbox_select(o, 0, u, g, r), d.value = p, i()
  3454.         },
  3455.         _get_start_date: function(t, e) {
  3456.             var n = t.getElementsByTagName("select"),
  3457.                 a = e._time_format_order,
  3458.                 i = 0,
  3459.                 s = 0;
  3460.             if (dhtmlx.defined(a[3])) {
  3461.                 var r = n[a[3]],
  3462.                     o = parseInt(r.value, 10);
  3463.                 isNaN(o) && r.hasAttribute("data-value") && (o = parseInt(r.getAttribute("data-value"), 10)), i = Math.floor(o / 60), s = o % 60
  3464.             }
  3465.             return new Date(n[a[2]].value, n[a[1]].value, n[a[0]].value, i, s)
  3466.         },
  3467.         _get_duration: function(t) {
  3468.             var e = t.getElementsByTagName("input")[1];
  3469.             return e = parseInt(e.value, 10), (!e || window.isNaN(e)) && (e = 1), 0 > e && (e *= -1), e
  3470.         },
  3471.         get_value: function(t, e, n) {
  3472.             var a = gantt.form_blocks.duration._get_start_date(t, n),
  3473.                 i = gantt.form_blocks.duration._get_duration(t, n),
  3474.                 s = gantt.calculateEndDate(a, i),
  3475.                 r = gantt._resolve_default_mapping(n),
  3476.                 o = {
  3477.                     start_date: new Date(a),
  3478.                     end_date: new Date(s),
  3479.                     duration: i
  3480.                 };
  3481.             return "string" == typeof r ? o.start_date : o
  3482.         },
  3483.         focus: function(t) {
  3484.             gantt._focus(t.getElementsByTagName("select")[0])
  3485.         }
  3486.     },
  3487.     parent: {
  3488.         _filter: function(t, e, n) {
  3489.             var a = e.filter || function() {
  3490.                     return !0
  3491.                 };
  3492.             t = t.slice(0);
  3493.             for (var i = 0; i < t.length; i++) {
  3494.                 var s = t[i];
  3495.                 (s.id == n || gantt.isChildOf(s.id, n) || a(s.id, s) === !1) && (t.splice(i, 1), i--)
  3496.             }
  3497.             return t
  3498.         },
  3499.         _display: function(t, e) {
  3500.             var n = [],
  3501.                 a = [];
  3502.             e && (n = gantt.getTaskByTime(), t.allow_root && n.unshift({
  3503.                 id: gantt.config.root_id,
  3504.                 text: t.root_label || ""
  3505.             }), n = this._filter(n, t, e), t.sort && n.sort(t.sort));
  3506.             for (var i = t.template || gantt.templates.task_text, s = 0; s < n.length; s++) {
  3507.                 var r = i.apply(gantt, [n[s].start_date, n[s].end_date, n[s]]);
  3508.                 void 0 === r && (r = ""), a.push({
  3509.                     key: n[s].id,
  3510.                     label: r
  3511.                 })
  3512.             }
  3513.             return t.options = a, t.map_to = t.map_to || "parent", gantt.form_blocks.select.render.apply(this, arguments)
  3514.         },
  3515.         render: function(t) {
  3516.             return gantt.form_blocks.parent._display(t, !1)
  3517.         },
  3518.         set_value: function(t, e, n, a) {
  3519.             var i = document.createElement("div");
  3520.             i.innerHTML = gantt.form_blocks.parent._display(a, n.id);
  3521.             var s = i.removeChild(i.firstChild);
  3522.             return t.onselect = null, t.parentNode.replaceChild(s, t), gantt.form_blocks.select.set_value.apply(gantt, [s, e, n, a])
  3523.         },
  3524.         get_value: function() {
  3525.             return gantt.form_blocks.select.get_value.apply(gantt, arguments)
  3526.         },
  3527.         focus: function() {
  3528.             return gantt.form_blocks.select.focus.apply(gantt, arguments)
  3529.         }
  3530.     }
  3531. }, gantt._is_lightbox_timepicker = function() {
  3532.     for (var t = this._get_typed_lightbox_config(), e = 0; e < t.length; e++)
  3533.         if ("time" == t[e].name && "time" == t[e].type) return !0;
  3534.     return !1
  3535. }, gantt._dhtmlx_confirm = function(t, e, n, a) {
  3536.     if (!t) return n();
  3537.     var i = {
  3538.         text: t
  3539.     };
  3540.     e && (i.title = e), a && (i.ok = a), n && (i.callback = function(t) {
  3541.         t && n()
  3542.     }), dhtmlx.confirm(i)
  3543. }, gantt._get_typed_lightbox_config = function(t) {
  3544.     void 0 === t && (t = this.getLightboxType());
  3545.     var e = this._get_type_name(t);
  3546.     return gantt.config.lightbox[e + "_sections"] ? gantt.config.lightbox[e + "_sections"] : gantt.config.lightbox.sections
  3547. }, gantt._silent_redraw_lightbox = function(t) {
  3548.     var e = this.getLightboxType();
  3549.     if (this.getState().lightbox) {
  3550.         var n = this.getState().lightbox,
  3551.             a = this.getLightboxValues(),
  3552.             i = dhtmlx.copy(this.getTask(n));
  3553.         this.resetLightbox();
  3554.         var s = dhtmlx.mixin(i, a, !0),
  3555.             r = this.getLightbox(t ? t : void 0);
  3556.         this._center_lightbox(this.getLightbox()), this._set_lightbox_values(s, r)
  3557.     } else this.resetLightbox(), this.getLightbox(t ? t : void 0);
  3558.     this.callEvent("onLightboxChange", [e, this.getLightboxType()])
  3559. }, gantt._extend_to_optional = function(t) {
  3560.     var e = t,
  3561.         n = {
  3562.             render: e.render,
  3563.             focus: e.focus,
  3564.             set_value: function(t, a, i, s) {
  3565.                 var r = gantt._resolve_default_mapping(s);
  3566.                 if (!i[r.start_date] || "start_date" == r.start_date && this._isAllowedUnscheduledTask(i)) {
  3567.                     n.disable(t, s);
  3568.                     var o = {};
  3569.                     for (var l in r) o[r[l]] = i[l];
  3570.                     return e.set_value.call(gantt, t, a, o, s)
  3571.                 }
  3572.                 return n.enable(t, s), e.set_value.call(gantt, t, a, i, s)
  3573.             },
  3574.             get_value: function(t, n, a) {
  3575.                 return a.disabled ? {
  3576.                     start_date: null
  3577.                 } : e.get_value.call(gantt, t, n, a)
  3578.             },
  3579.             update_block: function(t, e) {
  3580.                 if (gantt.callEvent("onSectionToggle", [gantt._lightbox_id, e]), t.style.display = e.disabled ? "none" : "block", e.button) {
  3581.                     var n = t.previousSibling.firstChild.firstChild,
  3582.                         a = gantt.locale.labels,
  3583.                         i = e.disabled ? a[e.name + "_enable_button"] : a[e.name + "_disable_button"];
  3584.                     n.nextSibling.innerHTML = i
  3585.                 }
  3586.                 gantt.resizeLightbox()
  3587.             },
  3588.             disable: function(t, e) {
  3589.                 e.disabled = !0, n.update_block(t, e)
  3590.             },
  3591.             enable: function(t, e) {
  3592.                 e.disabled = !1, n.update_block(t, e)
  3593.             },
  3594.             button_click: function(t, e, a, i) {
  3595.                 if (gantt.callEvent("onSectionButton", [gantt._lightbox_id, a]) !== !1) {
  3596.                     var s = gantt._get_typed_lightbox_config()[t];
  3597.                     s.disabled ? n.enable(i, s) : n.disable(i, s)
  3598.                 }
  3599.             }
  3600.         };
  3601.     return n
  3602. }, gantt.form_blocks.duration_optional = gantt._extend_to_optional(gantt.form_blocks.duration), gantt.form_blocks.time_optional = gantt._extend_to_optional(gantt.form_blocks.time), dataProcessor.prototype = {
  3603.     setTransactionMode: function(t, e) {
  3604.         "object" == typeof t ? (this._tMode = t.mode || this._tMode, this._headers = this._headers || t.headers, this._payload = this._payload || t.payload) : (this._tMode = t, this._tSend = e), "REST" == this._tMode && (this._tSend = !1, this._endnm = !0)
  3605.     },
  3606.     escape: function(t) {
  3607.         return this._utf ? encodeURIComponent(t) : escape(t)
  3608.     },
  3609.     enableUTFencoding: function(t) {
  3610.         this._utf = dhx4.s2b(t)
  3611.     },
  3612.     setDataColumns: function(t) {
  3613.         this._columns = "string" == typeof t ? t.split(",") : t
  3614.     },
  3615.     getSyncState: function() {
  3616.         return !this.updatedRows.length
  3617.     },
  3618.     enableDataNames: function(t) {
  3619.         this._endnm = dhx4.s2b(t)
  3620.     },
  3621.     enablePartialDataSend: function(t) {
  3622.         this._changed = dhx4.s2b(t)
  3623.     },
  3624.     setUpdateMode: function(t, e) {
  3625.         this.autoUpdate = "cell" == t, this.updateMode = t, this.dnd = e
  3626.     },
  3627.     ignore: function(t, e) {
  3628.         this._silent_mode = !0, t.call(e || window), this._silent_mode = !1
  3629.     },
  3630.     setUpdated: function(t, e, n) {
  3631.         if (!this._silent_mode) {
  3632.             var a = this.findRow(t);
  3633.             n = n || "updated";
  3634.             var i = this.obj.getUserData(t, this.action_param);
  3635.             i && "updated" == n && (n = i), e ? (this.set_invalid(t, !1), this.updatedRows[a] = t, this.obj.setUserData(t, this.action_param, n), this._in_progress[t] && (this._in_progress[t] = "wait")) : this.is_invalid(t) || (this.updatedRows.splice(a, 1), this.obj.setUserData(t, this.action_param, "")), e || this._clearUpdateFlag(t), this.markRow(t, e, n), e && this.autoUpdate && this.sendData(t)
  3636.         }
  3637.     },
  3638.     _clearUpdateFlag: function() {},
  3639.     markRow: function(t, e, n) {
  3640.         var a = "",
  3641.             i = this.is_invalid(t);
  3642.         if (i && (a = this.styles[i], e = !0), this.callEvent("onRowMark", [t, e, n, i]) && (a = this.styles[e ? n : "clear"] + a, this.obj[this._methods[0]](t, a), i && i.details)) {
  3643.             a += this.styles[i + "_cell"];
  3644.             for (var s = 0; s < i.details.length; s++) i.details[s] && this.obj[this._methods[1]](t, s, a)
  3645.         }
  3646.     },
  3647.     getState: function(t) {
  3648.         return this.obj.getUserData(t, this.action_param)
  3649.     },
  3650.     is_invalid: function(t) {
  3651.         return this._invalid[t]
  3652.     },
  3653.     set_invalid: function(t, e, n) {
  3654.         n && (e = {
  3655.             value: e,
  3656.             details: n,
  3657.             toString: function() {
  3658.                 return this.value.toString()
  3659.             }
  3660.         }), this._invalid[t] = e
  3661.     },
  3662.     checkBeforeUpdate: function() {
  3663.         return !0
  3664.     },
  3665.     sendData: function(t) {
  3666.         return !this._waitMode || "tree" != this.obj.mytype && !this.obj._h2 ? (this.obj.editStop && this.obj.editStop(), "undefined" == typeof t || this._tSend ? this.sendAllData() : this._in_progress[t] ? !1 : (this.messages = [], !this.checkBeforeUpdate(t) && this.callEvent("onValidationError", [t, this.messages]) ? !1 : void this._beforeSendData(this._getRowData(t), t))) : void 0
  3667.     },
  3668.     _beforeSendData: function(t, e) {
  3669.         return this.callEvent("onBeforeUpdate", [e, this.getState(e), t]) ? void this._sendData(t, e) : !1
  3670.     },
  3671.     serialize: function(t, e) {
  3672.         if ("string" == typeof t) return t;
  3673.         if ("undefined" != typeof e) return this.serialize_one(t, "");
  3674.         var n = [],
  3675.             a = [];
  3676.         for (var i in t) t.hasOwnProperty(i) && (n.push(this.serialize_one(t[i], i + this.post_delim)), a.push(i));
  3677.         return n.push("ids=" + this.escape(a.join(","))), dhtmlx.security_key && n.push("dhx_security=" + dhtmlx.security_key), n.join("&")
  3678.     },
  3679.     serialize_one: function(t, e) {
  3680.         if ("string" == typeof t) return t;
  3681.         var n = [];
  3682.         for (var a in t)
  3683.             if (t.hasOwnProperty(a)) {
  3684.                 if (("id" == a || a == this.action_param) && "REST" == this._tMode) continue;
  3685.                 n.push(this.escape((e || "") + a) + "=" + this.escape(t[a]))
  3686.             }
  3687.         return n.join("&")
  3688.     },
  3689.     _sendData: function(t, e) {
  3690.         if (t) {
  3691.             if (!this.callEvent("onBeforeDataSending", e ? [e, this.getState(e), t] : [null, null, t])) return !1;
  3692.             e && (this._in_progress[e] = (new Date).valueOf());
  3693.             var n = this,
  3694.                 a = function(a) {
  3695.                     var i = [];
  3696.                     if (e) i.push(e);
  3697.                     else if (t)
  3698.                         for (var s in t) i.push(s);
  3699.                     return n.afterUpdate(n, a, i)
  3700.                 }, i = this.serverProcessor + (this._user ? dhtmlx.url(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + this.obj.getUserData(0, "version")].join("&") : "");
  3701.             if ("GET" == this._tMode) dhx4.ajax.get(i + (-1 != i.indexOf("?") ? "&" : "?") + this.serialize(t, e), a);
  3702.             else if ("POST" == this._tMode) dhx4.ajax.post(i, this.serialize(t, e), a);
  3703.             else if ("REST" == this._tMode) {
  3704.                 var s = this.getState(e),
  3705.                     r = i.replace(/(\&|\?)editing\=true/, ""),
  3706.                     o = "",
  3707.                     l = "post";
  3708.                 if ("inserted" == s ? o = this.serialize(t, e) : "deleted" == s ? (l = "DELETE", r = r + ("/" == r.slice(-1) ? "" : "/") + e) : (l = "PUT", o = this.serialize(t, e), r = r + ("/" == r.slice(-1) ? "" : "/") + e), this._payload)
  3709.                     for (var d in this._payload) r = r + dhtmlx.url(r) + this.escape(d) + "=" + this.escape(this._payload[d]);
  3710.                 dhx4.ajax.query({
  3711.                     url: r,
  3712.                     method: l,
  3713.                     headers: this._headers,
  3714.                     data: o,
  3715.                     callback: a
  3716.                 })
  3717.             }
  3718.             this._waitMode++
  3719.         }
  3720.     },
  3721.     sendAllData: function() {
  3722.         if (this.updatedRows.length) {
  3723.             this.messages = [];
  3724.             for (var t = !0, e = 0; e < this.updatedRows.length; e++) t &= this.checkBeforeUpdate(this.updatedRows[e]);
  3725.             if (!t && !this.callEvent("onValidationError", ["", this.messages])) return !1;
  3726.             if (this._tSend) this._sendData(this._getAllData());
  3727.             else
  3728.                 for (var e = 0; e < this.updatedRows.length; e++)
  3729.                     if (!this._in_progress[this.updatedRows[e]]) {
  3730.                         if (this.is_invalid(this.updatedRows[e])) continue;
  3731.                         if (this._beforeSendData(this._getRowData(this.updatedRows[e]), this.updatedRows[e]), this._waitMode && ("tree" == this.obj.mytype || this.obj._h2)) return
  3732.                     }
  3733.         }
  3734.     },
  3735.     _getAllData: function() {
  3736.         for (var t = {}, e = !1, n = 0; n < this.updatedRows.length; n++) {
  3737.             var a = this.updatedRows[n];
  3738.             this._in_progress[a] || this.is_invalid(a) || this.callEvent("onBeforeUpdate", [a, this.getState(a), this._getRowData(a)]) && (t[a] = this._getRowData(a, a + this.post_delim), e = !0, this._in_progress[a] = (new Date).valueOf())
  3739.         }
  3740.         return e ? t : null
  3741.     },
  3742.     setVerificator: function(t, e) {
  3743.         this.mandatoryFields[t] = e || function(t) {
  3744.             return "" !== t
  3745.         }
  3746.     },
  3747.     clearVerificator: function(t) {
  3748.         this.mandatoryFields[t] = !1
  3749.     },
  3750.     findRow: function(t) {
  3751.         var e = 0;
  3752.         for (e = 0; e < this.updatedRows.length && t != this.updatedRows[e]; e++);
  3753.         return e
  3754.     },
  3755.     defineAction: function(t, e) {
  3756.         this._uActions || (this._uActions = []), this._uActions[t] = e
  3757.     },
  3758.     afterUpdateCallback: function(t, e, n, a) {
  3759.         var i = t,
  3760.             s = "error" != n && "invalid" != n;
  3761.         if (s || this.set_invalid(t, n), this._uActions && this._uActions[n] && !this._uActions[n](a)) return delete this._in_progress[i];
  3762.         "wait" != this._in_progress[i] && this.setUpdated(t, !1);
  3763.         var r = t;
  3764.         switch (n) {
  3765.             case "inserted":
  3766.             case "insert":
  3767.                 e != t && (this.obj[this._methods[2]](t, e), t = e);
  3768.                 break;
  3769.             case "delete":
  3770.             case "deleted":
  3771.                 return this.obj.setUserData(t, this.action_param, "true_deleted"), this.obj[this._methods[3]](t), delete this._in_progress[i], this.callEvent("onAfterUpdate", [t, n, e, a])
  3772.         }
  3773.         "wait" != this._in_progress[i] ? (s && this.obj.setUserData(t, this.action_param, ""), delete this._in_progress[i]) : (delete this._in_progress[i], this.setUpdated(e, !0, this.obj.getUserData(t, this.action_param))), this.callEvent("onAfterUpdate", [r, n, e, a])
  3774.     },
  3775.     afterUpdate: function(t, e, n) {
  3776.         if (window.JSON) try {
  3777.             var a = JSON.parse(e.xmlDoc.responseText),
  3778.                 i = a.action || this.getState(n) || "updated",
  3779.                 s = a.sid || n[0],
  3780.                 r = a.tid || n[0];
  3781.             return t.afterUpdateCallback(s, r, i, a), void t.finalizeUpdate()
  3782.         } catch (o) {}
  3783.         var l = dhx4.ajax.xmltop("data", e.xmlDoc);
  3784.         if (!l) return this.cleanUpdate(n);
  3785.         var d = dhx4.ajax.xpath("//data/action", l);
  3786.         if (!d.length) return this.cleanUpdate(n);
  3787.         for (var _ = 0; _ < d.length; _++) {
  3788.             var c = d[_],
  3789.                 i = c.getAttribute("type"),
  3790.                 s = c.getAttribute("sid"),
  3791.                 r = c.getAttribute("tid");
  3792.             t.afterUpdateCallback(s, r, i, c)
  3793.         }
  3794.         t.finalizeUpdate()
  3795.     },
  3796.     cleanUpdate: function(t) {
  3797.         if (t)
  3798.             for (var e = 0; e < t.length; e++) delete this._in_progress[t[e]]
  3799.     },
  3800.     finalizeUpdate: function() {
  3801.         this._waitMode && this._waitMode--, ("tree" == this.obj.mytype || this.obj._h2) && this.updatedRows.length && this.sendData(), this.callEvent("onAfterUpdateFinish", []), this.updatedRows.length || this.callEvent("onFullSync", [])
  3802.     },
  3803.     init: function(t) {
  3804.         this.obj = t, this.obj._dp_init && this.obj._dp_init(this)
  3805.     },
  3806.     setOnAfterUpdate: function(t) {
  3807.         this.attachEvent("onAfterUpdate", t)
  3808.     },
  3809.     enableDebug: function() {},
  3810.     setOnBeforeUpdateHandler: function(t) {
  3811.         this.attachEvent("onBeforeDataSending", t)
  3812.     },
  3813.     setAutoUpdate: function(t, e) {
  3814.         t = t || 2e3, this._user = e || (new Date).valueOf(), this._need_update = !1, this._loader = null, this._update_busy = !1, this.attachEvent("onAfterUpdate", function(t, e, n, a) {
  3815.             this.afterAutoUpdate(t, e, n, a)
  3816.         }), this.attachEvent("onFullSync", function() {
  3817.             this.fullSync()
  3818.         });
  3819.         var n = this;
  3820.         window.setInterval(function() {
  3821.             n.loadUpdate()
  3822.         }, t)
  3823.     },
  3824.     afterAutoUpdate: function(t, e) {
  3825.         return "collision" == e ? (this._need_update = !0, !1) : !0
  3826.     },
  3827.     fullSync: function() {
  3828.         return 1 == this._need_update && (this._need_update = !1, this.loadUpdate()), !0
  3829.     },
  3830.     getUpdates: function(t, e) {
  3831.         return this._update_busy ? !1 : (this._update_busy = !0, this._loader = this._loader || new dtmlXMLLoaderObject(!0), this._loader.async = !0, this._loader.waitCall = e, void this._loader.loadXML(t))
  3832.     },
  3833.     _v: function(t) {
  3834.         return t.firstChild ? t.firstChild.nodeValue : ""
  3835.     },
  3836.     _a: function(t) {
  3837.         for (var e = [], n = 0; n < t.length; n++) e[n] = this._v(t[n]);
  3838.         return e
  3839.     },
  3840.     loadUpdate: function() {
  3841.         var t = this,
  3842.             e = this.obj.getUserData(0, "version"),
  3843.             n = this.serverProcessor + dhtmlx.url(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + e].join("&");
  3844.         n = n.replace("editing=true&", ""), this.getUpdates(n, function() {
  3845.             var e = t._loader.doXPath("//userdata");
  3846.             t.obj.setUserData(0, "version", t._v(e[0]));
  3847.             var n = t._loader.doXPath("//update");
  3848.             if (n.length) {
  3849.                 t._silent_mode = !0;
  3850.                 for (var a = 0; a < n.length; a++) {
  3851.                     var i = n[a].getAttribute("status"),
  3852.                         s = n[a].getAttribute("id"),
  3853.                         r = n[a].getAttribute("parent");
  3854.                     switch (i) {
  3855.                         case "inserted":
  3856.                             t.callEvent("insertCallback", [n[a], s, r]);
  3857.                             break;
  3858.                         case "updated":
  3859.                             t.callEvent("updateCallback", [n[a], s, r]);
  3860.                             break;
  3861.                         case "deleted":
  3862.                             t.callEvent("deleteCallback", [n[a], s, r])
  3863.                     }
  3864.                 }
  3865.                 t._silent_mode = !1
  3866.             }
  3867.             t._update_busy = !1, t = null
  3868.         })
  3869.     }
  3870. }, gantt._init_dp_live_update_hooks = function(t) {
  3871.     t.attachEvent("insertCallback", gantt._insert_callback), t.attachEvent("updateCallback", gantt._update_callback), t.attachEvent("deleteCallback", gantt._delete_callback)
  3872. }, gantt._update_callback = function(t, e) {
  3873.     var n = t.data || gantt.xml._xmlNodeToJSON(t.firstChild);
  3874.     if (gantt.isTaskExists(e)) {
  3875.         var a = gantt.getTask(e);
  3876.         for (var i in n) {
  3877.             var s = n[i];
  3878.             switch (i) {
  3879.                 case "id":
  3880.                     continue;
  3881.                 case "start_date":
  3882.                 case "end_date":
  3883.                     s = gantt.templates.xml_date(s);
  3884.                     break;
  3885.                 case "duration":
  3886.                     a.end_date = gantt.calculateEndDate(a.start_date, s)
  3887.             }
  3888.             a[i] = s
  3889.         }
  3890.         gantt.updateTask(e), gantt.refreshData()
  3891.     }
  3892. }, gantt._insert_callback = function(t, e, n, a) {
  3893.     var i = t.data || gantt.xml._xmlNodeToJSON(t.firstChild),
  3894.         s = {
  3895.             add: gantt.addTask,
  3896.             isExist: gantt.isTaskExists
  3897.         };
  3898.     "links" == a && (s.add = gantt.addLink, s.isExist = gantt.isLinkExists), s.isExist.call(gantt, e) || (i.id = e, s.add.call(gantt, i))
  3899. }, gantt._delete_callback = function(t, e, n, a) {
  3900.     var i = {
  3901.         "delete": gantt.deleteTask,
  3902.         isExist: gantt.isTaskExists
  3903.     };
  3904.     "links" == a && (i["delete"] = gantt.deleteLink, i.isExist = gantt.isLinkExists), i.isExist.call(gantt, e) && i["delete"].call(gantt, e)
  3905. }, gantt._get_safe_type = function(t) {
  3906.     for (var e in this.config.types)
  3907.         if (this.config.types[e] == t) return t;
  3908.     return gantt.config.types.task
  3909. }, gantt.form_blocks.typeselect = {
  3910.     render: function(t) {
  3911.         var e = gantt.config.types,
  3912.             n = gantt.locale.labels,
  3913.             a = [],
  3914.             i = t.filter || function() {
  3915.                 return !0
  3916.             };
  3917.         for (var s in e) 0 == !i(s, e[s]) && a.push({
  3918.             key: e[s],
  3919.             label: n["type_" + s]
  3920.         });
  3921.         t.options = a;
  3922.         var r = t.onchange;
  3923.         return t.onchange = function() {
  3924.             gantt.getState().lightbox, gantt.changeLightboxType(this.value), "function" == typeof r && r.apply(this, arguments)
  3925.         }, gantt.form_blocks.select.render.apply(gantt, arguments)
  3926.     },
  3927.     set_value: function() {
  3928.         return gantt.form_blocks.select.set_value.apply(gantt, arguments)
  3929.     },
  3930.     get_value: function() {
  3931.         return gantt.form_blocks.select.get_value.apply(gantt, arguments)
  3932.     },
  3933.     focus: function() {
  3934.         return gantt.form_blocks.select.focus.apply(this, arguments)
  3935.     }
  3936. },
  3937. function() {
  3938.     function t() {
  3939.         return gantt._cached_functions.update_if_changed(gantt), gantt._cached_functions.active || gantt._cached_functions.activate(), !0
  3940.     }
  3941.     gantt._cached_functions = {
  3942.         cache: {},
  3943.         mode: !1,
  3944.         critical_path_mode: !1,
  3945.         wrap_methods: function(t, e) {
  3946.             if (e._prefetch_originals)
  3947.                 for (var n in e._prefetch_originals) e[n] = e._prefetch_originals[n];
  3948.             e._prefetch_originals = {};
  3949.             for (var n = 0; n < t.length; n++) this.prefetch(t[n], e)
  3950.         },
  3951.         prefetch: function(t, e) {
  3952.             var n = e[t];
  3953.             if (n) {
  3954.                 var a = this;
  3955.                 e._prefetch_originals[t] = n, e[t] = function() {
  3956.                     if (a.active) {
  3957.                         var e = a.get_arguments_hash(Array.prototype.slice.call(arguments));
  3958.                         a.cache[t] || (a.cache[t] = {});
  3959.                         var i = a.cache[t];
  3960.                         if (a.has_cached_value(i, e)) return a.get_cached_value(i, e);
  3961.                         var s = n.apply(this, arguments);
  3962.                         return a.cache_value(i, e, s), s
  3963.                     }
  3964.                     return n.apply(this, arguments)
  3965.                 }
  3966.             }
  3967.             return n
  3968.         },
  3969.         cache_value: function(t, e, n) {
  3970.             this.is_date(n) && (n = new Date(n)), t[e] = n
  3971.         },
  3972.         has_cached_value: function(t, e) {
  3973.             return t.hasOwnProperty(e)
  3974.         },
  3975.         get_cached_value: function(t, e) {
  3976.             var n = t[e];
  3977.             return this.is_date(n) && (n = new Date(n)), n
  3978.         },
  3979.         is_date: function(t) {
  3980.             return t && t.getUTCDate
  3981.         },
  3982.         get_arguments_hash: function(t) {
  3983.             for (var e = [], n = 0; n < t.length; n++) e.push(this.stringify_argument(t[n]));
  3984.             return "(" + e.join(";") + ")"
  3985.         },
  3986.         stringify_argument: function(t) {
  3987.             var e = "";
  3988.             return e = t.id ? t.id : this.is_date(t) ? t.valueOf() : t, e + ""
  3989.         },
  3990.         activate: function() {
  3991.             this.clear(), this.active = !0
  3992.         },
  3993.         deactivate: function() {
  3994.             this.clear(), this.active = !1
  3995.         },
  3996.         clear: function() {
  3997.             this.cache = {}
  3998.         },
  3999.         setup: function(t) {
  4000.             var e = [],
  4001.                 n = ["isCriticalTask", "isCriticalLink", "_isProjectEnd", "_getProjectEnd"];
  4002.             "auto" == this.mode ? t.config.highlight_critical_path && (e = n) : this.mode === !0 && (e = n), this.wrap_methods(e, t)
  4003.         },
  4004.         update_if_changed: function(t) {
  4005.             var e = this.critical_path_mode != t.config.highlight_critical_path || this.mode !== t.config.optimize_render;
  4006.             e && (this.critical_path_mode = t.config.highlight_critical_path, this.mode = t.config.optimize_render, this.setup(t))
  4007.         }
  4008.     }, gantt.attachEvent("onBeforeGanttRender", t), gantt.attachEvent("onBeforeDataRender", t), gantt.attachEvent("onBeforeParse", t), gantt.attachEvent("onDataRender", function() {
  4009.         gantt._cached_functions.deactivate()
  4010.     }), gantt.attachEvent("onBeforeGanttReady", function() {
  4011.         return gantt._cached_functions.update_if_changed(gantt), !0
  4012.     })
  4013. }(), dhtmlx.assert = function(t, e) {
  4014.     t || gantt.config.show_errors && gantt.callEvent("onError", [e]) !== !1 && dhtmlx.message({
  4015.         type: "error",
  4016.         text: e,
  4017.         expire: -1
  4018.     })
  4019. }, gantt.init = function(t, e, n) {
  4020.     this.callEvent("onBeforeGanttReady", []), e && n && (this.config.start_date = this._min_date = new Date(e), this.config.end_date = this._max_date = new Date(n)), this._init_skin(), this.date.init(), this.config.scroll_size || (this.config.scroll_size = this._detectScrollSize()), dhtmlxEvent(window, "resize", this._on_resize), this.init = function(t) {
  4021.         this.$container && this.$container.parentNode && (this.$container.parentNode.removeChild(this.$container), this.$container = null), this._reinit(t)
  4022.     }, this._reinit(t)
  4023. }, gantt._reinit = function(t) {
  4024.     this._init_html_area(t), this._set_sizes(), this._clear_renderers(), this.resetLightbox(), this._update_flags(), this._init_touch_events(), this._init_templates(), this._init_grid(), this._init_tasks(), this._set_scroll_events(), dhtmlxEvent(this.$container, "click", this._on_click), dhtmlxEvent(this.$container, "dblclick", this._on_dblclick), dhtmlxEvent(this.$container, "mousemove", this._on_mousemove), dhtmlxEvent(this.$container, "contextmenu", this._on_contextmenu), this.callEvent("onGanttReady", []), this.render()
  4025. }, gantt._init_html_area = function(t) {
  4026.     this._obj = "string" == typeof t ? document.getElementById(t) : t, dhtmlx.assert(this._obj, "Invalid html container: " + t);
  4027.     var e = "<div class='gantt_container'><div class='gantt_grid'></div><div class='gantt_task'></div>";
  4028.     e += "<div class='gantt_ver_scroll'><div></div></div><div class='gantt_hor_scroll'><div></div></div></div>", this._obj.innerHTML = e, this.$container = this._obj.firstChild;
  4029.     var n = this.$container.childNodes;
  4030.     this.$grid = n[0], this.$task = n[1], this.$scroll_ver = n[2], this.$scroll_hor = n[3], this.$grid.innerHTML = "<div class='gantt_grid_scale'></div><div class='gantt_grid_data'></div>", this.$grid_scale = this.$grid.childNodes[0], this.$grid_data = this.$grid.childNodes[1], this.$task.innerHTML = "<div class='gantt_task_scale'></div><div class='gantt_data_area'><div class='gantt_task_bg'></div><div class='gantt_links_area'></div><div class='gantt_bars_area'></div></div>", this.$task_scale = this.$task.childNodes[0], this.$task_data = this.$task.childNodes[1], this.$task_bg = this.$task_data.childNodes[0], this.$task_links = this.$task_data.childNodes[1], this.$task_bars = this.$task_data.childNodes[2]
  4031. }, gantt.$click = {
  4032.     buttons: {
  4033.         edit: function(t) {
  4034.             gantt.showLightbox(t)
  4035.         },
  4036.         "delete": function(t) {
  4037.             var e = gantt.locale.labels.confirm_deleting,
  4038.                 n = gantt.locale.labels.confirm_deleting_title;
  4039.             gantt._dhtmlx_confirm(e, n, function() {
  4040.                 var e = gantt.getTask(t);
  4041.                 e.$new ? (gantt._deleteTask(t, !0), gantt.refreshData()) : gantt.deleteTask(t), gantt.hideLightbox()
  4042.             })
  4043.         }
  4044.     }
  4045. }, gantt._calculate_content_height = function() {
  4046.     var t = this.config.scale_height,
  4047.         e = this._order.length * this.config.row_height,
  4048.         n = this._scroll_hor ? this.config.scroll_size + 1 : 0;
  4049.     return this._is_grid_visible() || this._is_chart_visible() ? t + e + 2 + n : 0
  4050. }, gantt._calculate_content_width = function() {
  4051.     var t = this._get_grid_width(),
  4052.         e = this._tasks ? this._tasks.full_width : 0;
  4053.     return this._scroll_ver ? this.config.scroll_size + 1 : 0, this._is_chart_visible() || (e = 0), this._is_grid_visible() || (t = 0), t + e + 1
  4054. }, gantt._get_resize_options = function() {
  4055.     var t = {
  4056.         x: !1,
  4057.         y: !1
  4058.     };
  4059.     return "xy" == this.config.autosize ? t.x = t.y = !0 : "y" == this.config.autosize || this.config.autosize === !0 ? t.y = !0 : "x" == this.config.autosize && (t.x = !0), t
  4060. }, gantt._clean_el_size = function(t) {
  4061.     return 1 * (t || "").toString().replace("px", "") || 0
  4062. }, gantt._get_box_styles = function() {
  4063.     var t = null;
  4064.     t = window.getComputedStyle ? window.getComputedStyle(this._obj, null) : {
  4065.         width: this._obj.clientWidth,
  4066.         height: this._obj.clientHeight
  4067.     };
  4068.     var e = ["width", "height", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth"],
  4069.         n = {
  4070.             boxSizing: "border-box" == t.boxSizing
  4071.         };
  4072.     t.MozBoxSizing && (n.boxSizing = "border-box" == t.MozBoxSizing);
  4073.     for (var a = 0; a < e.length; a++) n[e[a]] = t[e[a]] ? this._clean_el_size(t[e[a]]) : 0;
  4074.     var i = {
  4075.         horPaddings: n.paddingLeft + n.paddingRight + n.borderLeftWidth + n.borderRightWidth,
  4076.         vertPaddings: n.paddingTop + n.paddingBottom + n.borderTopWidth + n.borderBottomWidth,
  4077.         borderBox: n.boxSizing,
  4078.         innerWidth: n.width,
  4079.         innerHeight: n.height,
  4080.         outerWidth: n.width,
  4081.         outerHeight: n.height
  4082.     };
  4083.     return i.borderBox ? (i.innerWidth -= i.horPaddings, i.innerHeight -= i.vertPaddings) : (i.outerWidth += i.horPaddings, i.outerHeight += i.vertPaddings), i
  4084. }, gantt._do_autosize = function() {
  4085.     var t = this._get_resize_options(),
  4086.         e = this._get_box_styles();
  4087.     if (t.y) {
  4088.         var n = this._calculate_content_height();
  4089.         e.borderBox && (n += e.vertPaddings), this._obj.style.height = n + "px"
  4090.     }
  4091.     if (t.x) {
  4092.         var a = this._calculate_content_width();
  4093.         e.borderBox && (a += e.horPaddings), this._obj.style.width = a + "px"
  4094.     }
  4095. }, gantt._set_sizes = function() {
  4096.     this._do_autosize();
  4097.     var t = this._get_box_styles();
  4098.     if (this._y = t.innerHeight, !(this._y < 20)) {
  4099.         this.$grid.style.height = this.$task.style.height = Math.max(this._y - this.$scroll_hor.offsetHeight - 2, 0) + "px";
  4100.         var e = Math.max(this._y - (this.config.scale_height || 0) - this.$scroll_hor.offsetHeight - 2, 0);
  4101.         this.$grid_data.style.height = this.$task_data.style.height = e + "px";
  4102.         var n = Math.max(this._get_grid_width() - 1, 0);
  4103.         this.$grid.style.width = n + "px", this.$grid.style.display = 0 === n ? "none" : "", t = this._get_box_styles(), this._x = t.innerWidth, this._x < 20 || (this.$grid_data.style.width = Math.max(this._get_grid_width() - 1, 0) + "px", this.$task.style.width = Math.max(this._x - this._get_grid_width() - 2, 0) + "px")
  4104.     }
  4105. }, gantt.getScrollState = function() {
  4106.     return this.$task && this.$task_data ? {
  4107.         x: this.$task.scrollLeft,
  4108.         y: this.$task_data.scrollTop
  4109.     } : null
  4110. }, gantt._save_scroll_state = function(t, e) {
  4111.     var n = {};
  4112.     this._cached_scroll_pos = this._cached_scroll_pos || {}, void 0 !== t && (n.x = Math.max(t, 0)), void 0 !== e && (n.y = Math.max(e, 0)), dhtmlx.mixin(this._cached_scroll_pos, n, !0)
  4113. }, gantt._restore_scroll_state = function() {
  4114.     return this._cached_scroll_pos || null
  4115. }, gantt.scrollTo = function(t, e) {
  4116.     1 * t == t && (this.$task.scrollLeft = t, this._save_scroll_state(t, void 0)), 1 * e == e && (this.$task_data.scrollTop = e, this.$grid_data.scrollTop = e, this._save_scroll_state(void 0, e));
  4117.     var n = gantt._restore_scroll_state() || {
  4118.         x: 0,
  4119.         y: 0
  4120.     };
  4121.     this.callEvent("onGanttScroll", [n.x, n.y])
  4122. }, gantt.showDate = function(t) {
  4123.     var e = this.posFromDate(t),
  4124.         n = Math.max(e - this.config.task_scroll_offset, 0);
  4125.     this.scrollTo(n)
  4126. }, gantt.showTask = function(t) {
  4127.     var e = this.getTaskNode(t);
  4128.     if (e) {
  4129.         var n = Math.max(e.offsetLeft - this.config.task_scroll_offset, 0),
  4130.             a = e.offsetTop - (this.$task_data.offsetHeight - this.config.row_height) / 2;
  4131.         this.scrollTo(n, a)
  4132.     }
  4133. }, gantt._on_resize = gantt.setSizes = function() {
  4134.     gantt._set_sizes(), gantt._scroll_resize()
  4135. }, gantt.render = function() {
  4136.     if (this._is_render_active()) {
  4137.         this.callEvent("onBeforeGanttRender", []);
  4138.         var t = dhtmlx.copy(this._restore_scroll_state()),
  4139.             e = null;
  4140.         if (t && (e = gantt.dateFromPos(t.x + this.config.task_scroll_offset)), this._render_grid(), this._render_tasks_scales(), this._scroll_resize(), this._on_resize(), this._render_data(), this.config.preserve_scroll && t) {
  4141.             var n = gantt._restore_scroll_state(),
  4142.                 a = gantt.dateFromPos(n.x);
  4143.             (+e != +a || n.y != t.y) && (e && this.showDate(e), gantt.scrollTo(void 0, t.y))
  4144.         }
  4145.         this.callEvent("onGanttRender", [])
  4146.     }
  4147. }, gantt._set_scroll_events = function() {
  4148.     function t(t) {
  4149.         var n = gantt._get_resize_options();
  4150.         gantt._wheel_time = new Date;
  4151.         var a = e ? -20 * t.deltaX : 2 * t.wheelDeltaX,
  4152.             i = e ? -40 * t.deltaY : t.wheelDelta;
  4153.         if (a && Math.abs(a) > Math.abs(i)) {
  4154.             if (n.x) return !0;
  4155.             var s = a / -40,
  4156.                 r = gantt.$task.scrollLeft + 30 * s;
  4157.             gantt.scrollTo(r, null), gantt.$scroll_hor.scrollTop = o
  4158.         } else {
  4159.             if (n.y) return !0;
  4160.             var s = i / -40;
  4161.             "undefined" == typeof i && (s = t.detail);
  4162.             var o = gantt.$scroll_ver.scrollTop + 30 * s;
  4163.             if (!gantt.config.prevent_default_scroll && gantt._cached_scroll_pos && gantt._cached_scroll_pos.y == o) return !0;
  4164.             gantt.scrollTo(null, o), gantt.$scroll_ver.scrollTop = o
  4165.         }
  4166.         return t.preventDefault && t.preventDefault(), t.cancelBubble = !0, !1
  4167.     }
  4168.     dhtmlxEvent(this.$scroll_hor, "scroll", function() {
  4169.         if (new Date - (gantt._wheel_time || 0) < 100) return !0;
  4170.         if (!gantt._touch_scroll_active) {
  4171.             var t = gantt.$scroll_hor.scrollLeft;
  4172.             gantt.scrollTo(t)
  4173.         }
  4174.     }), dhtmlxEvent(this.$scroll_ver, "scroll", function() {
  4175.         if (!gantt._touch_scroll_active) {
  4176.             var t = gantt.$scroll_ver.scrollTop;
  4177.             gantt.$grid_data.scrollTop = t, gantt.scrollTo(null, t)
  4178.         }
  4179.     }), dhtmlxEvent(this.$task, "scroll", function() {
  4180.         var t = gantt.$task.scrollLeft,
  4181.             e = gantt.$scroll_hor.scrollLeft;
  4182.         e != t && (gantt.$scroll_hor.scrollLeft = t)
  4183.     }), dhtmlxEvent(this.$task_data, "scroll", function() {
  4184.         var t = gantt.$task_data.scrollTop,
  4185.             e = gantt.$scroll_ver.scrollTop;
  4186.         e != t && (gantt.$scroll_ver.scrollTop = t)
  4187.     });
  4188.     var e = _isFF && !window._KHTMLrv;
  4189.     e ? dhtmlxEvent(gantt.$container, "wheel", t) : dhtmlxEvent(gantt.$container, "mousewheel", t)
  4190. }, gantt._scroll_resize = function() {
  4191.     if (!(this._x < 20 || this._y < 20)) {
  4192.         var t = this._get_grid_width(),
  4193.             e = Math.max(this._x - t, 0),
  4194.             n = Math.max(this._y - this.config.scale_height, 0),
  4195.             a = this.config.scroll_size + 1,
  4196.             i = Math.max(this.$task_data.offsetWidth - a, 0),
  4197.             s = this.config.row_height * this._order.length,
  4198.             r = this._get_resize_options(),
  4199.             o = this._scroll_hor = r.x ? !1 : i > e,
  4200.             l = this._scroll_ver = r.y ? !1 : s > n;
  4201.         this.$scroll_hor.style.display = o ? "block" : "none", this.$scroll_hor.style.height = (o ? a : 0) + "px", this.$scroll_hor.style.width = Math.max(this._x - (l ? a : 2), 0) + "px", this.$scroll_hor.firstChild.style.width = i + t + a + 2 + "px", this.$scroll_ver.style.display = l ? "block" : "none", this.$scroll_ver.style.width = (l ? a : 0) + "px", this.$scroll_ver.style.height = Math.max(this._y - (o ? a : 0) - this.config.scale_height, 0) + "px", this.$scroll_ver.style.top = this.config.scale_height + "px", this.$scroll_ver.firstChild.style.height = this.config.scale_height + s + "px"
  4202.     }
  4203. }, gantt._getClassName = function(t) {
  4204.     if (!t) return "";
  4205.     var e = t.className || "";
  4206.     return e.baseVal && (e = e.baseVal), e.indexOf || (e = ""), gantt._trim(e)
  4207. }, gantt.locate = function(t) {
  4208.     var e = gantt._get_target_node(t),
  4209.         n = gantt._getClassName(e);
  4210.     if ((n || "").indexOf("gantt_task_cell") >= 0) return null;
  4211.     for (var a = arguments[1] || this.config.task_attribute; e;) {
  4212.         if (e.getAttribute) {
  4213.             var i = e.getAttribute(a);
  4214.             if (i) return i
  4215.         }
  4216.         e = e.parentNode
  4217.     }
  4218.     return null
  4219. }, gantt._get_target_node = function(t) {
  4220.     var e;
  4221.     return t.tagName ? e = t : (t = t || window.event, e = t.target || t.srcElement), e
  4222. }, gantt._trim = function(t) {
  4223.     var e = String.prototype.trim || function() {
  4224.             return this.replace(/^\s+|\s+$/g, "")
  4225.         };
  4226.     return e.apply(t)
  4227. }, gantt._locate_css = function(t, e, n) {
  4228.     void 0 === n && (n = !0);
  4229.     for (var a = gantt._get_target_node(t), i = ""; a;) {
  4230.         if (i = gantt._getClassName(a)) {
  4231.             var s = i.indexOf(e);
  4232.             if (s >= 0) {
  4233.                 if (!n) return a;
  4234.                 var r = 0 === s || !gantt._trim(i.charAt(s - 1)),
  4235.                     o = s + e.length >= i.length || !gantt._trim(i.charAt(s + e.length));
  4236.                 if (r && o) return a
  4237.             }
  4238.         }
  4239.         a = a.parentNode
  4240.     }
  4241.     return null
  4242. }, gantt._locateHTML = function(t, e) {
  4243.     var n = gantt._get_target_node(t);
  4244.     for (e = e || this.config.task_attribute; n;) {
  4245.         if (n.getAttribute) {
  4246.             var a = n.getAttribute(e);
  4247.             if (a) return n
  4248.         }
  4249.         n = n.parentNode
  4250.     }
  4251.     return null
  4252. }, gantt.getTaskRowNode = function(t) {
  4253.     for (var e = this.$grid_data.childNodes, n = this.config.task_attribute, a = 0; a < e.length; a++)
  4254.         if (e[a].getAttribute) {
  4255.             var i = e[a].getAttribute(n);
  4256.             if (i == t) return e[a]
  4257.         }
  4258.     return null
  4259. }, gantt.getState = function() {
  4260.     return {
  4261.         drag_id: this._tasks_dnd.drag.id,
  4262.         drag_mode: this._tasks_dnd.drag.mode,
  4263.         drag_from_start: this._tasks_dnd.drag.left,
  4264.         selected_task: this._selected_task,
  4265.         min_date: new Date(this._min_date),
  4266.         max_date: new Date(this._max_date),
  4267.         lightbox: this._lightbox_id,
  4268.         touch_drag: this._touch_drag
  4269.     }
  4270. }, gantt._checkTimeout = function(t, e) {
  4271.     if (!e) return !0;
  4272.     var n = 1e3 / e;
  4273.     return 1 > n ? !0 : t._on_timeout ? !1 : (setTimeout(function() {
  4274.         delete t._on_timeout
  4275.     }, n), t._on_timeout = !0, !0)
  4276. }, gantt.selectTask = function(t) {
  4277.     if (!this.config.select_task) return !1;
  4278.     if (t) {
  4279.         if (this._selected_task == t) return this._selected_task;
  4280.         if (!this.callEvent("onBeforeTaskSelected", [t])) return !1;
  4281.         this.unselectTask(), this._selected_task = t, this.refreshTask(t), this.callEvent("onTaskSelected", [t])
  4282.     }
  4283.     return this._selected_task
  4284. }, gantt.unselectTask = function(t) {
  4285.     var t = t || this._selected_task;
  4286.     t && (this._selected_task = null, this.refreshTask(t), this.callEvent("onTaskUnselected", [t]))
  4287. }, gantt.getSelectedId = function() {
  4288.     return dhtmlx.defined(this._selected_task) ? this._selected_task : null
  4289. }, gantt.changeLightboxType = function(t) {
  4290.     return this.getLightboxType() == t ? !0 : void gantt._silent_redraw_lightbox(t)
  4291. }, gantt._is_render_active = function() {
  4292.     return !this._skip_render
  4293. }, gantt._correct_dst_change = function(t, e, n, a) {
  4294.     var i = gantt._get_line(a) * n;
  4295.     if (i > 3600 && 86400 > i) {
  4296.         var s = t.getTimezoneOffset() - e;
  4297.         s && (t = gantt.date.add(t, s, "minute"))
  4298.     }
  4299.     return t
  4300. }, gantt.batchUpdate = function(t) {
  4301.     var e, n = this._dp && "off" != this._dp.updateMode;
  4302.     n && (e = this._dp.updateMode, this._dp.setUpdateMode("off")), this._skip_render = !0;
  4303.     try {
  4304.         t()
  4305.     } catch (a) {}
  4306.     this._skip_render = !1, this.render(), n && (this._dp.setUpdateMode(e), this._dp.sendData())
  4307. }, gantt.date = {
  4308.     init: function() {
  4309.         for (var t = gantt.locale.date.month_short, e = gantt.locale.date.month_short_hash = {}, n = 0; n < t.length; n++) e[t[n]] = n;
  4310.         for (var t = gantt.locale.date.month_full, e = gantt.locale.date.month_full_hash = {}, n = 0; n < t.length; n++) e[t[n]] = n
  4311.     },
  4312.     date_part: function(t) {
  4313.         var e = new Date(t);
  4314.         return t.setHours(0), this.hour_start(t), t.getHours() && (t.getDate() < e.getDate() || t.getMonth() < e.getMonth() || t.getFullYear() < e.getFullYear()) && t.setTime(t.getTime() + 36e5 * (24 - t.getHours())), t
  4315.     },
  4316.     time_part: function(t) {
  4317.         return (t.valueOf() / 1e3 - 60 * t.getTimezoneOffset()) % 86400
  4318.     },
  4319.     week_start: function(t) {
  4320.         var e = t.getDay();
  4321.         return gantt.config.start_on_monday && (0 === e ? e = 6 : e--), this.date_part(this.add(t, -1 * e, "day"))
  4322.     },
  4323.     month_start: function(t) {
  4324.         return t.setDate(1), this.date_part(t)
  4325.     },
  4326.     year_start: function(t) {
  4327.         return t.setMonth(0), this.month_start(t)
  4328.     },
  4329.     day_start: function(t) {
  4330.         return this.date_part(t)
  4331.     },
  4332.     hour_start: function(t) {
  4333.         return t.getMinutes() && t.setMinutes(0), this.minute_start(t), t
  4334.     },
  4335.     minute_start: function(t) {
  4336.         return t.getSeconds() && t.setSeconds(0), t.getMilliseconds() && t.setMilliseconds(0), t
  4337.     },
  4338.     _add_days: function(t, e) {
  4339.         var n = new Date(t.valueOf());
  4340.         return n.setDate(n.getDate() + e), e >= 0 && !t.getHours() && n.getHours() && (n.getDate() <= t.getDate() || n.getMonth() < t.getMonth() || n.getFullYear() < t.getFullYear()) && n.setTime(n.getTime() + 36e5 * (24 - n.getHours())), n
  4341.     },
  4342.     add: function(t, e, n) {
  4343.         var a = new Date(t.valueOf());
  4344.         switch (n) {
  4345.             case "day":
  4346.                 a = gantt.date._add_days(a, e);
  4347.                 break;
  4348.             case "week":
  4349.                 a = gantt.date._add_days(a, 7 * e);
  4350.                 break;
  4351.             case "month":
  4352.                 a.setMonth(a.getMonth() + e);
  4353.                 break;
  4354.             case "year":
  4355.                 a.setYear(a.getFullYear() + e);
  4356.                 break;
  4357.             case "hour":
  4358.                 a.setTime(a.getTime() + 60 * e * 60 * 1e3);
  4359.                 break;
  4360.             case "minute":
  4361.                 a.setTime(a.getTime() + 60 * e * 1e3);
  4362.                 break;
  4363.             default:
  4364.                 return gantt.date["add_" + n](t, e, n)
  4365.         }
  4366.         return a
  4367.     },
  4368.     to_fixed: function(t) {
  4369.         return 10 > t ? "0" + t : t
  4370.     },
  4371.     copy: function(t) {
  4372.         return new Date(t.valueOf())
  4373.     },
  4374.     date_to_str: function(t, e) {
  4375.         return t = t.replace(/%[a-zA-Z]/g, function(t) {
  4376.             switch (t) {
  4377.                 case "%d":
  4378.                     return '"+gantt.date.to_fixed(date.getDate())+"';
  4379.                 case "%m":
  4380.                     return '"+gantt.date.to_fixed((date.getMonth()+1))+"';
  4381.                 case "%j":
  4382.                     return '"+date.getDate()+"';
  4383.                 case "%n":
  4384.                     return '"+(date.getMonth()+1)+"';
  4385.                 case "%y":
  4386.                     return '"+gantt.date.to_fixed(date.getFullYear()%100)+"';
  4387.                 case "%Y":
  4388.                     return '"+date.getFullYear()+"';
  4389.                 case "%D":
  4390.                     return '"+gantt.locale.date.day_short[date.getDay()]+"';
  4391.                 case "%l":
  4392.                     return '"+gantt.locale.date.day_full[date.getDay()]+"';
  4393.                 case "%M":
  4394.                     return '"+gantt.locale.date.month_short[date.getMonth()]+"';
  4395.                 case "%F":
  4396.                     return '"+gantt.locale.date.month_full[date.getMonth()]+"';
  4397.                 case "%h":
  4398.                     return '"+gantt.date.to_fixed((date.getHours()+11)%12+1)+"';
  4399.                 case "%g":
  4400.                     return '"+((date.getHours()+11)%12+1)+"';
  4401.                 case "%G":
  4402.                     return '"+date.getHours()+"';
  4403.                 case "%H":
  4404.                     return '"+gantt.date.to_fixed(date.getHours())+"';
  4405.                 case "%i":
  4406.                     return '"+gantt.date.to_fixed(date.getMinutes())+"';
  4407.                 case "%a":
  4408.                     return '"+(date.getHours()>11?"pm":"am")+"';
  4409.                 case "%A":
  4410.                     return '"+(date.getHours()>11?"PM":"AM")+"';
  4411.                 case "%s":
  4412.                     return '"+gantt.date.to_fixed(date.getSeconds())+"';
  4413.                 case "%W":
  4414.                     return '"+gantt.date.to_fixed(gantt.date.getISOWeek(date))+"';
  4415.                 default:
  4416.                     return t
  4417.             }
  4418.         }), e && (t = t.replace(/date\.get/g, "date.getUTC")), new Function("date", 'return "' + t + '";')
  4419.     },
  4420.     str_to_date: function(t, e) {
  4421.         for (var n = "var temp=date.match(/[a-zA-Z]+|[0-9]+/g);", a = t.match(/%[a-zA-Z]/g), i = 0; i < a.length; i++) switch (a[i]) {
  4422.             case "%j":
  4423.             case "%d":
  4424.                 n += "set[2]=temp[" + i + "]||1;";
  4425.                 break;
  4426.             case "%n":
  4427.             case "%m":
  4428.                 n += "set[1]=(temp[" + i + "]||1)-1;";
  4429.                 break;
  4430.             case "%y":
  4431.                 n += "set[0]=temp[" + i + "]*1+(temp[" + i + "]>50?1900:2000);";
  4432.                 break;
  4433.             case "%g":
  4434.             case "%G":
  4435.             case "%h":
  4436.             case "%H":
  4437.                 n += "set[3]=temp[" + i + "]||0;";
  4438.                 break;
  4439.             case "%i":
  4440.                 n += "set[4]=temp[" + i + "]||0;";
  4441.                 break;
  4442.             case "%Y":
  4443.                 n += "set[0]=temp[" + i + "]||0;";
  4444.                 break;
  4445.             case "%a":
  4446.             case "%A":
  4447.                 n += "set[3]=set[3]%12+((temp[" + i + "]||'').toLowerCase()=='am'?0:12);";
  4448.                 break;
  4449.             case "%s":
  4450.                 n += "set[5]=temp[" + i + "]||0;";
  4451.                 break;
  4452.             case "%M":
  4453.                 n += "set[1]=gantt.locale.date.month_short_hash[temp[" + i + "]]||0;";
  4454.                 break;
  4455.             case "%F":
  4456.                 n += "set[1]=gantt.locale.date.month_full_hash[temp[" + i + "]]||0;"
  4457.         }
  4458.         var s = "set[0],set[1],set[2],set[3],set[4],set[5]";
  4459.         return e && (s = " Date.UTC(" + s + ")"), new Function("date", "var set=[0,0,1,0,0,0]; " + n + " return new Date(" + s + ");")
  4460.     },
  4461.     getISOWeek: function(t) {
  4462.         if (!t) return !1;
  4463.         var e = t.getDay();
  4464.         0 === e && (e = 7);
  4465.         var n = new Date(t.valueOf());
  4466.         n.setDate(t.getDate() + (4 - e));
  4467.         var a = n.getFullYear(),
  4468.             i = Math.round((n.getTime() - new Date(a, 0, 1).getTime()) / 864e5),
  4469.             s = 1 + Math.floor(i / 7);
  4470.         return s
  4471.     },
  4472.     getUTCISOWeek: function(t) {
  4473.         return this.getISOWeek(t)
  4474.     },
  4475.     convert_to_utc: function(t) {
  4476.         return new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds())
  4477.     },
  4478.     parseDate: function(t, e) {
  4479.         return "string" == typeof t && (dhtmlx.defined(e) && (e = "string" == typeof e ? dhtmlx.defined(gantt.templates[e]) ? gantt.templates[e] : gantt.date.str_to_date(e) : gantt.templates.xml_date), t = t ? e(t) : null), t
  4480.     }
  4481. }, gantt.date.quarter_start = function(t) {
  4482.     gantt.date.month_start(t);
  4483.     var e, n = t.getMonth();
  4484.     return e = n >= 9 ? 9 : n >= 6 ? 6 : n >= 3 ? 3 : 0, t.setMonth(e), t
  4485. }, gantt.date.add_quarter = function(t, e) {
  4486.     return gantt.date.add(t, 3 * e, "month")
  4487. }, gantt.config || (gantt.config = {}), gantt.config || (gantt.config = {}), gantt.templates || (gantt.templates = {}),
  4488. function() {
  4489.     dhtmlx.mixin(gantt.config, {
  4490.         links: {
  4491.             finish_to_start: "0",
  4492.             start_to_start: "1",
  4493.             finish_to_finish: "2",
  4494.             start_to_finish: "3"
  4495.         },
  4496.         types: {
  4497.             task: "task",
  4498.             project: "project",
  4499.             milestone: "milestone"
  4500.         },
  4501.         duration_unit: "day",
  4502.         work_time: !1,
  4503.         correct_work_time: !1,
  4504.         skip_off_time: !1,
  4505.         autosize: !1,
  4506.         autosize_min_width: 0,
  4507.         show_links: !0,
  4508.         show_task_cells: !0,
  4509.         static_background: !1,
  4510.         branch_loading: !1,
  4511.         show_loading: !1,
  4512.         show_chart: !0,
  4513.         show_grid: !0,
  4514.         min_duration: 36e5,
  4515.         xml_date: "%d-%m-%Y %H:%i",
  4516.         api_date: "%d-%m-%Y %H:%i",
  4517.         start_on_monday: !0,
  4518.         server_utc: !1,
  4519.         show_progress: !0,
  4520.         fit_tasks: !1,
  4521.         select_task: !0,
  4522.         scroll_on_click: !0,
  4523.         preserve_scroll: !0,
  4524.         readonly: !1,
  4525.         date_grid: "%Y-%m-%d",
  4526.         drag_links: !0,
  4527.         drag_progress: !0,
  4528.         drag_resize: !0,
  4529.         drag_move: !0,
  4530.         drag_mode: {
  4531.             resize: "resize",
  4532.             progress: "progress",
  4533.             move: "move",
  4534.             ignore: "ignore"
  4535.         },
  4536.         round_dnd_dates: !0,
  4537.         link_wrapper_width: 20,
  4538.         root_id: 0,
  4539.         autofit: !1,
  4540.         columns: [{
  4541.             name: "text",
  4542.             tree: !0,
  4543.             width: "*",
  4544.             resize: !0
  4545.         }, {
  4546.             name: "start_date",
  4547.             align: "center",
  4548.             resize: !0
  4549.         }, {
  4550.             name: "duration",
  4551.             align: "center"
  4552.         }, {
  4553.             name: "add",
  4554.             width: "44"
  4555.         }],
  4556.         step: 1,
  4557.         scale_unit: "day",
  4558.         scale_offset_minimal: !0,
  4559.         subscales: [],
  4560.         inherit_scale_class: !1,
  4561.         time_step: 60,
  4562.         duration_step: 1,
  4563.         date_scale: "%d %M",
  4564.         task_date: "%d %F %Y",
  4565.         time_picker: "%H:%i",
  4566.         task_attribute: "task_id",
  4567.         link_attribute: "link_id",
  4568.         layer_attribute: "data-layer",
  4569.         buttons_left: ["gantt_save_btn", "gantt_cancel_btn"],
  4570.         _migrate_buttons: {
  4571.             dhx_save_btn: "gantt_save_btn",
  4572.             dhx_cancel_btn: "gantt_cancel_btn",
  4573.             dhx_delete_btn: "gantt_delete_btn"
  4574.         },
  4575.         buttons_right: ["gantt_delete_btn"],
  4576.         lightbox: {
  4577.             sections: [{
  4578.                 name: "description",
  4579.                 height: 70,
  4580.                 map_to: "text",
  4581.                 type: "textarea",
  4582.                 focus: !0
  4583.             }, {
  4584.                 name: "time",
  4585.                 type: "duration",
  4586.                 map_to: "auto"
  4587.             }],
  4588.             project_sections: [{
  4589.                 name: "description",
  4590.                 height: 70,
  4591.                 map_to: "text",
  4592.                 type: "textarea",
  4593.                 focus: !0
  4594.             }, {
  4595.                 name: "type",
  4596.                 type: "typeselect",
  4597.                 map_to: "type"
  4598.             }, {
  4599.                 name: "time",
  4600.                 type: "duration",
  4601.                 readonly: !0,
  4602.                 map_to: "auto"
  4603.             }],
  4604.             milestone_sections: [{
  4605.                 name: "description",
  4606.                 height: 70,
  4607.                 map_to: "text",
  4608.                 type: "textarea",
  4609.                 focus: !0
  4610.             }, {
  4611.                 name: "type",
  4612.                 type: "typeselect",
  4613.                 map_to: "type"
  4614.             }, {
  4615.                 name: "time",
  4616.                 type: "duration",
  4617.                 single_date: !0,
  4618.                 map_to: "auto"
  4619.             }]
  4620.         },
  4621.         drag_lightbox: !0,
  4622.         sort: !1,
  4623.         details_on_create: !0,
  4624.         details_on_dblclick: !0,
  4625.         initial_scroll: !0,
  4626.         task_scroll_offset: 100,
  4627.         order_branch: !1,
  4628.         order_branch_free: !1,
  4629.         task_height: "full",
  4630.         min_column_width: 70,
  4631.         min_grid_column_width: 70,
  4632.         grid_resizer_column_attribute: "column_index",
  4633.         grid_resizer_attribute: "grid_resizer",
  4634.         keep_grid_width: !1,
  4635.         grid_resize: !1,
  4636.         show_unscheduled: !0,
  4637.         readonly_property: "readonly",
  4638.         editable_property: "editable",
  4639.         type_renderers: {},
  4640.         open_tree_initially: !1,
  4641.         optimize_render: "auto",
  4642.         prevent_default_scroll: !1,
  4643.         show_errors: !0
  4644.     }), gantt.keys = {
  4645.         edit_save: 13,
  4646.         edit_cancel: 27
  4647.     }, gantt._init_template = function(t, e, n) {
  4648.         var a = this._reg_templates || {};
  4649.         n = n || t, this.config[t] && a[n] != this.config[t] && (e && this.templates[n] || (this.templates[n] = this.date.date_to_str(this.config[t]), a[n] = this.config[t])), this._reg_templates = a
  4650.     }, gantt._init_templates = function() {
  4651.         var t = gantt.locale.labels;
  4652.         t.gantt_save_btn = t.icon_save, t.gantt_cancel_btn = t.icon_cancel, t.gantt_delete_btn = t.icon_delete;
  4653.         var e = this.date.date_to_str,
  4654.             n = this.config;
  4655.         gantt._init_template("date_scale", !0), gantt._init_template("date_grid", !0, "grid_date_format"), gantt._init_template("task_date", !0), dhtmlx.mixin(this.templates, {
  4656.             xml_date: this.date.str_to_date(n.xml_date, n.server_utc),
  4657.             xml_format: e(n.xml_date, n.server_utc),
  4658.             api_date: this.date.str_to_date(n.api_date),
  4659.             progress_text: function() {
  4660.                 return ""
  4661.             },
  4662.             grid_header_class: function() {
  4663.                 return ""
  4664.             },
  4665.             task_text: function(t, e, n) {
  4666.                 return n.text
  4667.             },
  4668.             task_class: function() {
  4669.                 return ""
  4670.             },
  4671.             grid_row_class: function() {
  4672.                 return ""
  4673.             },
  4674.             task_row_class: function() {
  4675.                 return ""
  4676.             },
  4677.             task_cell_class: function() {
  4678.                 return ""
  4679.             },
  4680.             scale_cell_class: function() {
  4681.                 return ""
  4682.             },
  4683.             scale_row_class: function() {
  4684.                 return ""
  4685.             },
  4686.             grid_indent: function() {
  4687.                 return "<div class='gantt_tree_indent'></div>"
  4688.             },
  4689.             grid_folder: function(t) {
  4690.                 return "<div class='gantt_tree_icon gantt_folder_" + (t.$open ? "open" : "closed") + "'></div>"
  4691.             },
  4692.             grid_file: function() {
  4693.                 return "<div class='gantt_tree_icon gantt_file'></div>"
  4694.             },
  4695.             grid_open: function(t) {
  4696.                 return "<div class='gantt_tree_icon gantt_" + (t.$open ? "close" : "open") + "'></div>"
  4697.             },
  4698.             grid_blank: function() {
  4699.                 return "<div class='gantt_tree_icon gantt_blank'></div>"
  4700.             },
  4701.             date_grid: function(t, e) {
  4702.                 return e && gantt.isUnscheduledTask(e) && gantt.config.show_unscheduled ? gantt.templates.task_unscheduled_time(e) : gantt.templates.grid_date_format(t)
  4703.             },
  4704.             task_time: function(t, e, n) {
  4705.                 return gantt.isUnscheduledTask(n) && gantt.config.show_unscheduled ? gantt.templates.task_unscheduled_time(n) : gantt.templates.task_date(t) + " - " + gantt.templates.task_date(e)
  4706.             },
  4707.             task_unscheduled_time: function() {
  4708.                 return ""
  4709.             },
  4710.             time_picker: e(n.time_picker),
  4711.             link_class: function() {
  4712.                 return ""
  4713.             },
  4714.             link_description: function(t) {
  4715.                 var e = gantt.getTask(t.source),
  4716.                     n = gantt.getTask(t.target);
  4717.                 return "<b>" + e.text + "</b> &ndash;  <b>" + n.text + "</b>"
  4718.             },
  4719.             drag_link: function(t, e, n, a) {
  4720.                 t = gantt.getTask(t);
  4721.                 var i = gantt.locale.labels,
  4722.                     s = "<b>" + t.text + "</b> " + (e ? i.link_start : i.link_end) + "<br/>";
  4723.                 return n && (n = gantt.getTask(n), s += "<b> " + n.text + "</b> " + (a ? i.link_start : i.link_end) + "<br/>"), s
  4724.             },
  4725.             drag_link_class: function(t, e, n, a) {
  4726.                 var i = "";
  4727.                 if (t && n) {
  4728.                     var s = gantt.isLinkAllowed(t, n, e, a);
  4729.                     i = " " + (s ? "gantt_link_allow" : "gantt_link_deny")
  4730.                 }
  4731.                 return "gantt_link_tooltip" + i
  4732.             }
  4733.         }), this.callEvent("onTemplatesReady", [])
  4734.     }
  4735. }(), window.jQuery && ! function(t) {
  4736.     var e = [];
  4737.     t.fn.dhx_gantt = function(n) {
  4738.         if (n = n || {}, "string" != typeof n) {
  4739.             var a = [];
  4740.             return this.each(function() {
  4741.                 if (this && this.getAttribute && !this.getAttribute("dhxgantt")) {
  4742.                     for (var t in n) "data" != t && (gantt.config[t] = n[t]);
  4743.                     gantt.init(this), n.data && gantt.parse(n.data), a.push(gantt)
  4744.                 }
  4745.             }), 1 === a.length ? a[0] : a
  4746.         }
  4747.         return e[n] ? e[n].apply(this, []) : void t.error("Method " + n + " does not exist on jQuery.dhx_gantt")
  4748.     }
  4749. }(jQuery), window.dhtmlx && (dhtmlx.attaches || (dhtmlx.attaches = {}), dhtmlx.attaches.attachGantt = function(t, e) {
  4750.     var n = document.createElement("DIV");
  4751.     n.id = "gantt_" + dhtmlx.uid(), n.style.width = "100%", n.style.height = "100%", n.cmp = "grid", document.body.appendChild(n), this.attachObject(n.id);
  4752.     var a = this.vs[this.av];
  4753.     a.grid = gantt, gantt.init(n.id, t, e), n.firstChild.style.border = "none", a.gridId = n.id, a.gridObj = n;
  4754.     var i = "_viewRestore";
  4755.     return this.vs[this[i]()].grid
  4756. }), gantt.locale = {
  4757.     date: {
  4758.         month_full: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  4759.         month_short: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  4760.         day_full: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  4761.         day_short: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
  4762.     },
  4763.     labels: {
  4764.         new_task: "New task",
  4765.         icon_save: "Save",
  4766.         icon_cancel: "Cancel",
  4767.         icon_details: "Details",
  4768.         icon_edit: "Edit",
  4769.         icon_delete: "Delete",
  4770.         confirm_closing: "",
  4771.         confirm_deleting: "Task will be deleted permanently, are you sure?",
  4772.         section_description: "Description",
  4773.         section_time: "Time period",
  4774.         section_type: "Type",
  4775.         column_text: "Task name",
  4776.         column_start_date: "Start time",
  4777.         column_duration: "Duration",
  4778.         column_add: "",
  4779.         link: "Link",
  4780.         confirm_link_deleting: "will be deleted",
  4781.         link_start: " (start)",
  4782.         link_end: " (end)",
  4783.         type_task: "Task",
  4784.         type_project: "Project",
  4785.         type_milestone: "Milestone",
  4786.         minutes: "Minutes",
  4787.         hours: "Hours",
  4788.         days: "Days",
  4789.         weeks: "Week",
  4790.         months: "Months",
  4791.         years: "Years"
  4792.     }
  4793. }, gantt.skins.skyblue = {
  4794.     config: {
  4795.         grid_width: 350,
  4796.         row_height: 27,
  4797.         scale_height: 27,
  4798.         link_line_width: 1,
  4799.         link_arrow_size: 8,
  4800.         lightbox_additional_height: 75
  4801.     },
  4802.     _second_column_width: 95,
  4803.     _third_column_width: 80
  4804. }, gantt.skins.meadow = {
  4805.     config: {
  4806.         grid_width: 350,
  4807.         row_height: 27,
  4808.         scale_height: 30,
  4809.         link_line_width: 2,
  4810.         link_arrow_size: 6,
  4811.         lightbox_additional_height: 72
  4812.     },
  4813.     _second_column_width: 95,
  4814.     _third_column_width: 80
  4815. }, gantt.skins.terrace = {
  4816.     config: {
  4817.         grid_width: 360,
  4818.         row_height: 35,
  4819.         scale_height: 35,
  4820.         link_line_width: 2,
  4821.         link_arrow_size: 6,
  4822.         lightbox_additional_height: 75
  4823.     },
  4824.     _second_column_width: 90,
  4825.     _third_column_width: 70
  4826. }, gantt.skins.broadway = {
  4827.     config: {
  4828.         grid_width: 360,
  4829.         row_height: 35,
  4830.         scale_height: 35,
  4831.         link_line_width: 1,
  4832.         link_arrow_size: 7,
  4833.         lightbox_additional_height: 86
  4834.     },
  4835.     _second_column_width: 90,
  4836.     _third_column_width: 80,
  4837.     _lightbox_template: "<div class='gantt_cal_ltitle'><span class='gantt_mark'>&nbsp;</span><span class='gantt_time'></span><span class='gantt_title'></span><div class='gantt_cancel_btn'></div></div><div class='gantt_cal_larea'></div>",
  4838.     _config_buttons_left: {},
  4839.     _config_buttons_right: {
  4840.         gantt_delete_btn: "icon_delete",
  4841.         gantt_save_btn: "icon_save"
  4842.     }
  4843. }, gantt.config.touch_drag = 500, gantt.config.touch = !0, gantt.config.touch_feedback = !0, gantt._touch_feedback = function() {
  4844.     gantt.config.touch_feedback && navigator.vibrate && navigator.vibrate(1)
  4845. }, gantt._init_touch_events = function() {
  4846.     "force" != this.config.touch && (this.config.touch = this.config.touch && (-1 != navigator.userAgent.indexOf("Mobile") || -1 != navigator.userAgent.indexOf("iPad") || -1 != navigator.userAgent.indexOf("Android") || -1 != navigator.userAgent.indexOf("Touch"))), this.config.touch && (window.navigator.msPointerEnabled ? this._touch_events(["MSPointerMove", "MSPointerDown", "MSPointerUp"], function(t) {
  4847.         return t.pointerType == t.MSPOINTER_TYPE_MOUSE ? null : t
  4848.     }, function(t) {
  4849.         return !t || t.pointerType == t.MSPOINTER_TYPE_MOUSE
  4850.     }) : this._touch_events(["touchmove", "touchstart", "touchend"], function(t) {
  4851.         return t.touches && t.touches.length > 1 ? null : t.touches[0] ? {
  4852.             target: t.target,
  4853.             pageX: t.touches[0].pageX,
  4854.             pageY: t.touches[0].pageY,
  4855.             clientX: t.touches[0].clientX,
  4856.             clientY: t.touches[0].clientY
  4857.         } : t
  4858.     }, function() {
  4859.         return !1
  4860.     }))
  4861. }, gantt._touch_events = function(t, e, n) {
  4862.     function a(t) {
  4863.         return t && t.preventDefault && t.preventDefault(), (t || event).cancelBubble = !0, !1
  4864.     }
  4865.  
  4866.     function i(t) {
  4867.         var e = gantt._task_area_pulls,
  4868.             n = gantt.getTask(t);
  4869.         if (n && gantt.isTaskVisible(t))
  4870.             for (var a in e)
  4871.                 if (n = e[a][t], n && n.getAttribute("task_id") && n.getAttribute("task_id") == t) {
  4872.                     var i = n.cloneNode(!0);
  4873.                     return c = n, e[a][t] = i, n.style.display = "none", i.className += " gantt_drag_move ", n.parentNode.appendChild(i), i
  4874.                 }
  4875.     }
  4876.     var s, r = 0,
  4877.         o = !1,
  4878.         l = !1,
  4879.         d = null,
  4880.         _ = null,
  4881.         c = null;
  4882.     this._gantt_touch_event_ready || (this._gantt_touch_event_ready = 1, dhtmlxEvent(gantt.$container, t[0], function(t) {
  4883.         if (!n(t) && o) {
  4884.             _ && clearTimeout(_);
  4885.             var i = e(t);
  4886.             if (gantt._tasks_dnd.drag.id || gantt._tasks_dnd.drag.start_drag) return gantt._tasks_dnd.on_mouse_move(i), t.preventDefault && t.preventDefault(), t.cancelBubble = !0, !1;
  4887.             if (i && d) {
  4888.                 var c = d.pageX - i.pageX,
  4889.                     g = d.pageY - i.pageY;
  4890.                 if (!l && (Math.abs(c) > 5 || Math.abs(g) > 5) && (gantt._touch_scroll_active = l = !0, r = 0, s = gantt.getScrollState()), l) {
  4891.                     gantt.scrollTo(s.x + c, s.y + g);
  4892.                     var h = gantt.getScrollState();
  4893.                     if (s.x != h.x && g > 2 * c || s.y != h.y && c > 2 * g) return a(t)
  4894.                 }
  4895.             }
  4896.             return a(t)
  4897.         }
  4898.     })), dhtmlxEvent(this.$container, "contextmenu", function(t) {
  4899.         return o ? a(t) : void 0
  4900.     }), dhtmlxEvent(this.$container, t[1], function(t) {
  4901.         if (!n(t)) {
  4902.             if (t.touches && t.touches.length > 1) return void(o = !1);
  4903.             if (o = !0, d = e(t), d && r) {
  4904.                 var s = new Date;
  4905.                 500 > s - r ? (gantt._on_dblclick(d), a(t)) : r = s
  4906.             } else r = new Date;
  4907.             _ = setTimeout(function() {
  4908.                 var t = gantt.locate(d);
  4909.                 !t || gantt._locate_css(d, "gantt_link_control") || gantt._locate_css(d, "gantt_grid_data") || (gantt._tasks_dnd.on_mouse_down(d), gantt._tasks_dnd.drag && gantt._tasks_dnd.drag.start_drag && (i(t), gantt._tasks_dnd._start_dnd(d), gantt._touch_drag = !0, gantt.refreshTask(t), gantt._touch_feedback())), _ = null
  4910.             }, gantt.config.touch_drag)
  4911.         }
  4912.     }), dhtmlxEvent(this.$container, t[2], function(t) {
  4913.         if (!n(t)) {
  4914.             _ && clearTimeout(_), gantt._touch_drag = !1, o = !1;
  4915.             var a = e(t);
  4916.             gantt._tasks_dnd.on_mouse_up(a), c && (gantt.refreshTask(gantt.locate(c)), c.parentNode && (c.parentNode.removeChild(c), gantt._touch_feedback())), gantt._touch_scroll_active = o = l = !1, c = null
  4917.         }
  4918.     })
  4919. }, gantt.config.auto_scheduling = !1, gantt.config.auto_scheduling_initial = !0, gantt.config.auto_scheduling_strict = !1, gantt._datesNotEqual = function(t, e) {
  4920.     return t.valueOf() > e.valueOf() ? this._hasDuration(e, t) : this._hasDuration(t, e)
  4921. }, gantt._firstSmaller = function(t, e) {
  4922.     return t.valueOf() < e.valueOf() && this._hasDuration(t, e) ? !0 : !1
  4923. }, gantt._firstBigger = function(t, e) {
  4924.     return this._firstSmaller(e, t)
  4925. }, gantt._notEqualTaskDates = function(t, e) {
  4926.     return this._datesNotEqual(t.start_date, e.start_date) || (this._datesNotEqual(t.end_date, e.end_date) || t.duration != e.duration) && t.type != gantt.config.types.milestone ? !0 : void 0
  4927. }, gantt._autoScheduleHandler = function(t, e, n) {
  4928.     if (gantt.config.auto_scheduling && !this._autoscheduling_in_progress) {
  4929.         var a = this.getTask(t);
  4930.         gantt._notEqualTaskDates(n, a) && gantt.autoSchedule(a.id)
  4931.     }
  4932.     return !0
  4933. }, gantt._linkChangeAutoScheduleHandler = function(t, e) {
  4934.     gantt.config.auto_scheduling && !this._autoscheduling_in_progress && gantt.autoSchedule(e.source)
  4935. }, gantt._autoScheduleOnLoadHandler = function() {
  4936.     gantt.config.auto_scheduling && gantt.config.auto_scheduling_initial && gantt.autoSchedule()
  4937. }, gantt._checkCircularDependency = function(t, e, n) {
  4938.     if (n[t.id]) return !1;
  4939.     n[t.id] = !0;
  4940.     for (var a, i = 0; i < t.$source.length; i++)
  4941.         if (t.$source[i] != e.id) {
  4942.             var s = this.getLink(t.$source[i]);
  4943.             if (a = this.getTask(s.target), !this._checkCircularDependency(a, e, n)) return !1
  4944.         }
  4945.     if (t.id == e.source && (a = this.getTask(e.target), !this._checkCircularDependency(a, e, n))) return !1;
  4946.     for (var r = gantt.getChildren(t.id), i = 0; i < r.length; i++) {
  4947.         var o = this.getTask(r[i]);
  4948.         if (0 == o.$target.length && !this._checkCircularDependency(o, e, n)) return !1
  4949.     }
  4950.     return !0
  4951. }, gantt._checkParents = function(t, e) {
  4952.     if (e[t]) return !1;
  4953.     if (t != gantt.config.root_id) {
  4954.         var n = gantt.getParent(t);
  4955.         if (n != gantt.config.root_id) return gantt._checkParents(n, e)
  4956.     }
  4957.     return !0
  4958. }, gantt._linkValidationHandler = function(t, e) {
  4959.     var n = !(gantt.isChildOf(e.target, e.source) || gantt.isChildOf(e.source, e.target)) && gantt._checkCircularDependency(gantt.getTask(e.source), e, {});
  4960.     return n || gantt.callEvent("onCircularLinkError", [e]), n
  4961. }, gantt._lightBoxChangesHandler = function(t, e) {
  4962.     if (gantt.config.auto_scheduling && !this._autoscheduling_in_progress) {
  4963.         var n = this.getTask(t);
  4964.         gantt._notEqualTaskDates(e, n) && (gantt._autoschedule_lightbox_id = t)
  4965.     }
  4966.     return !0
  4967. }, gantt._lightBoxSaveHandler = function(t, e) {
  4968.     return gantt.config.auto_scheduling && !this._autoscheduling_in_progress && gantt._autoschedule_lightbox_id && gantt._autoschedule_lightbox_id == t && (gantt._autoschedule_lightbox_id = null, gantt.autoSchedule(e.id)), !0
  4969. }, gantt.attachEvent("onAfterLinkUpdate", gantt._linkChangeAutoScheduleHandler), gantt.attachEvent("onAfterLinkAdd", gantt._linkChangeAutoScheduleHandler), gantt.attachEvent("onParse", gantt._autoScheduleOnLoadHandler), gantt.attachEvent("onBeforeLinkAdd", gantt._linkValidationHandler), gantt.attachEvent("onBeforeLinkUpdate", gantt._linkValidationHandler), gantt.attachEvent("onBeforeTaskChanged", gantt._autoScheduleHandler), gantt.attachEvent("onLightboxSave", gantt._lightBoxChangesHandler), gantt.attachEvent("onAfterTaskUpdate", gantt._lightBoxSaveHandler), gantt.autoSchedule = function(t) {
  4970.     if (gantt.callEvent("onBeforeAutoSchedule", [t]) !== !1) {
  4971.         var e, n = {};
  4972.         if (t) e = this.getTask(t), n = gantt._autoScheduleByTask(e, n);
  4973.         else
  4974.             for (var a = gantt.getChildren(gantt.config.root_id), i = 0; i < a.length; i++) e = this.getTask(a[i]), n = gantt._autoScheduleByTask(e, n);
  4975.         gantt._updateTasks(n);
  4976.         var s = [];
  4977.         for (var i in n) s.push(i);
  4978.         gantt.callEvent("onAfterAutoSchedule", [t, s])
  4979.     }
  4980. }, gantt._autoScheduleByTask = function(t, e) {
  4981.     return gantt.config.auto_scheduling_strict ? e = gantt._autoScheduleLinkedTasks(t, e, null, t.id) : (e = gantt._autoScheduleLinkedTasks(t, e, null), t.parent && t.parent != gantt.config.root_id && (e = gantt._autoScheduleParents(this.getTask(t.parent), e))), e
  4982. }, gantt._autoScheduleLinkedTasks = function(t, e, n, a) {
  4983.     var i;
  4984.     if (void 0 === t.auto_scheduling || t.auto_scheduling) {
  4985.         var s = gantt._getTaskMinimalStartDate(t);
  4986.         if (t.parent && t.parent != gantt.config.root_id) {
  4987.             var r = this.getTask(t.parent),
  4988.                 o = gantt._getProjectMinimalStartDate(r);
  4989.             s.date && o.date ? this._firstSmaller(s.date, o.date) && (s = o) : s.date || (s = o)
  4990.         }
  4991.         var l = gantt._isTask(t) && s.date && (gantt.config.auto_scheduling_strict && this._datesNotEqual(s.date, t.start_date) && a != t.id || this._firstBigger(s.date, t.start_date));
  4992.         if (l) {
  4993.             if (gantt.callEvent("onBeforeTaskAutoSchedule", [t, s.date, s.link, s.source_task]) === !1) return e;
  4994.             gantt._updateTaskPosition(t, s.date, t.duration), e[t.id] = !0
  4995.         }
  4996.         var d = this.getChildren(t.id),
  4997.             _ = a && gantt.isChildOf(a, t.id);
  4998.         if (d.length && (!gantt.config.auto_scheduling_strict || !_ || _ && l))
  4999.             for (i = 0; i < d.length; i++) gantt._autoScheduleLinkedTasks(this.getTask(d[i]), e, n, a);
  5000.         l && gantt.callEvent("onAfterTaskAutoSchedule", [t, s.date, s.link, s.source_task])
  5001.     }
  5002.     for (i = 0; i < t.$source.length; i++) {
  5003.         var c = this.getLink(t.$source[i]),
  5004.             g = this.getTask(c.target);
  5005.         gantt._autoScheduleLinkedTasks(g, e, n, a)
  5006.     }
  5007.     if (t.parent && n && t.parent != gantt.config.root_id) {
  5008.         var h = this.getTask(t.parent);
  5009.         gantt.config.auto_scheduling_strict ? gantt._autoScheduleParents(h, e, a) : gantt._autoScheduleParents(h, e)
  5010.     }
  5011.     return e
  5012. }, gantt._updateTaskPosition = function(t, e, n) {
  5013.     t.start_date = this.getClosestWorkTime({
  5014.         date: e,
  5015.         dir: "future"
  5016.     }), t.end_date = this.calculateEndDate(e, n)
  5017. }, gantt._updateTasks = function(t) {
  5018.     this._autoscheduling_in_progress = !0, gantt.batchUpdate(function() {
  5019.         for (var e in t) gantt.updateTask(e)
  5020.     }), this._autoscheduling_in_progress = !1
  5021. }, gantt._calculateMinDate = function(t, e, n) {
  5022.     var a = t.start_date,
  5023.         i = this.config.links;
  5024.     switch (n.type) {
  5025.         case i.finish_to_start:
  5026.             a = e.end_date;
  5027.             break;
  5028.         case i.start_to_start:
  5029.             a = e.start_date;
  5030.             break;
  5031.         case i.start_to_finish:
  5032.             a = this.calculateEndDate(e.start_date, -1 * (t.duration || 1));
  5033.             break;
  5034.         case i.finish_to_finish:
  5035.             a = this.calculateEndDate(e.end_date, -1 * t.duration)
  5036.     }
  5037.     return n.lag && 1 * n.lag == n.lag && (a = this.calculateEndDate(a, 1 * n.lag)), a
  5038. }, gantt._getTaskMinimalStartDate = function(t) {
  5039.     for (var e = {}, n = 0; n < t.$target.length; n++) {
  5040.         var a = this.getLink(t.$target[n]),
  5041.             i = this.getTask(a.source),
  5042.             s = t,
  5043.             r = i;
  5044.         gantt._isProject(t) && (s = gantt.getSubtaskDates(t.id), s.duration = gantt.calculateDuration(s.start_date, s.end_date)), gantt._isProject(i) && (r = gantt.getSubtaskDates(i.id), r.duration = gantt.calculateDuration(r.start_date, r.end_date));
  5045.         var o = gantt._calculateMinDate(s, r, a);
  5046.         e.date && !this._firstSmaller(e.date, o) || gantt._isProject(i) && gantt.isChildOf(t.id, i.id) || (e.date = new Date(o), e.link = a, e.source_task = i)
  5047.     }
  5048.     return e.date && this._firstSmaller(t.start_date, e.date) && (e._mustMove = !0), e
  5049. }, gantt._getProjectMinimalStartDate = function(t) {
  5050.     if (!t) return {};
  5051.     var e;
  5052.     e = gantt._isProject(t) ? gantt._getTaskMinimalStartDate(t) : {};
  5053.     var n;
  5054.     t.parent && t.parent != gantt.config.root_id && (n = this.getTask(t.parent));
  5055.     var a = gantt._getProjectMinimalStartDate(n);
  5056.     return (!e.date || a.date && this._firstSmaller(e.date, a.date)) && (e = a), e
  5057. }, gantt._autoScheduleParents = function(t, e, n) {
  5058.     if (!t) return e;
  5059.     if (t.parent && t.parent != gantt.config.root_id) {
  5060.         var a = this.getTask(t.parent);
  5061.         gantt._autoScheduleParents(a, e, n)
  5062.     }
  5063.     return gantt._autoScheduleLinkedTasks(t, e, 0, n), e
  5064. }, gantt._isStrictParent = function(t, e) {
  5065.     if (!t) return !1;
  5066.     for (var n; this.getParent(n || t);)
  5067.         if (n = this.getParent(n || t), n == e) return !0;
  5068.     return !1
  5069. }, gantt._isTask = function(t) {
  5070.     return !(t.type && t.type == gantt.config.types.project || t.$no_start || t.$no_end)
  5071. }, gantt._isProject = function(t) {
  5072.     return !this._isTask(t)
  5073. }, gantt.config.highlight_critical_path = !1, gantt._criticalPathHandler = function() {
  5074.     gantt.config.highlight_critical_path && gantt.render()
  5075. }, gantt.attachEvent("onAfterLinkAdd", gantt._criticalPathHandler), gantt.attachEvent("onAfterLinkUpdate", gantt._criticalPathHandler), gantt.attachEvent("onAfterLinkDelete", gantt._criticalPathHandler), gantt.attachEvent("onAfterTaskDrag", gantt._criticalPathHandler), gantt.attachEvent("onAfterTaskDelete", gantt._criticalPathHandler), gantt.isCriticalTask = function(t) {
  5076.     if (t) {
  5077.         var e = arguments[1] || {};
  5078.         if (this._isTask(t)) {
  5079.             if (this._isProjectEnd(t)) return !0;
  5080.             e[t.id] = !0;
  5081.             for (var n = this._getSuccessors(t), a = 0; a < n.length; a++) {
  5082.                 var i = this.getTask(n[a].task);
  5083.                 if (this._getSlack(t, i, n[a].link) <= 0 && !e[i.id] && this.isCriticalTask(i, e)) return !0
  5084.             }
  5085.         }
  5086.         return !1
  5087.     }
  5088. }, gantt.isCriticalLink = function(t) {
  5089.     return this.isCriticalTask(gantt.getTask(t.source))
  5090. }, gantt.getSlack = function(t, e) {
  5091.     for (var n = [], a = {}, i = 0; i < t.$source.length; i++) a[t.$source[i]] = !0;
  5092.     for (var i = 0; i < e.$target.length; i++) a[e.$target[i]] && n.push(e.$target[i]);
  5093.     for (var s = [], i = 0; i < n.length; i++) s.push(this._getSlack(t, e, this.getLink(n[i]).type));
  5094.     return Math.min.apply(Math, s)
  5095. }, gantt._getSlack = function(t, e, n) {
  5096.     if (null === n) return 0;
  5097.     var a = null,
  5098.         i = null,
  5099.         s = this.config.links,
  5100.         r = this.config.types;
  5101.     return a = n != s.finish_to_finish && n != s.finish_to_start || this._get_safe_type(t.type) == r.milestone ? t.start_date : t.end_date, i = n != s.finish_to_finish && n != s.start_to_finish || this._get_safe_type(e.type) == r.milestone ? e.start_date : e.end_date, this.calculateDuration(a, i)
  5102. }, gantt._getProjectEnd = function() {
  5103.     var t = gantt.getTaskByTime();
  5104.     return t = t.sort(function(t, e) {
  5105.         return +t.end_date > +e.end_date ? 1 : -1
  5106.     }), t.length ? t[t.length - 1].end_date : null
  5107. }, gantt._isProjectEnd = function(t) {
  5108.     return !this._hasDuration(t.end_date, this._getProjectEnd())
  5109. }, gantt._isTask = function(t) {
  5110.     return !(t.type && t.type == gantt.config.types.project || t.$no_start || t.$no_end)
  5111. }, gantt._isProject = function(t) {
  5112.     return !this._isTask(t)
  5113. }, gantt._formatSuccessors = function(t, e) {
  5114.     for (var n = [], a = 0; a < t.length; a++) n.push(this._formatSuccessor(t[a], e));
  5115.     return n
  5116. }, gantt._formatSuccessor = function(t, e) {
  5117.     return {
  5118.         task: t,
  5119.         link: e
  5120.     }
  5121. }, gantt._getSuccessors = function(t) {
  5122.     var e = [];
  5123.     if (gantt._isProject(t)) e = e.concat(gantt._formatSuccessors(this.getChildren(t.id), null));
  5124.     else
  5125.         for (var n = t.$source, a = 0; a < n.length; a++) {
  5126.             var i = this.getLink(n[a]);
  5127.             if (this.isTaskExists(i.target)) {
  5128.                 var s = this.getTask(i.target);
  5129.                 this._isTask(s) ? e.push(gantt._formatSuccessor(i.target, i.type)) : e = e.concat(gantt._formatSuccessors(this.getChildren(s.id), i.type))
  5130.             }
  5131.         }
  5132.     return e
  5133. }, gantt._reCalcDurationToMonth = function(t, e) {
  5134.     for (var n = new Date(t.getFullYear(), t.getMonth(), 0), a = 0, i = 0, s = 0, r = gantt._reCalcDurationToWeek(t, e); n < new Date(e);) i += new Date(n.getFullYear(), n.getMonth(), 0).getDate(), n.setMonth(n.getMonth() + 1), a++;
  5135.     return i || (i = n.getDate(), a = 1), s = parseFloat(r.duration / (i / a / 7)).toFixed(2), s = isNaN(s) ? "0.00" : s, {
  5136.         duration: s,
  5137.         calendarDays: r.calendarDays
  5138.     }
  5139. }, gantt._reCalcDurationToWeek = function(t, e) {
  5140.     for (var n = (gantt.calculateDuration(t, e), new Date(t)), a = 0, i = 0, s = gantt._reCalcDurationToDay(t, e);
  5141.         (n.getTime() - new Date(t).getTime()) / 6048e5 < 1;) gantt.getWorkHours(n).length && i++, n.setDate(n.getDate() + 1);
  5142.     return a = parseFloat(s.duration / i).toFixed(2), a = isNaN(a) ? "0.00" : a, {
  5143.         duration: a,
  5144.         calendarDays: s.calendarDays
  5145.     }
  5146. }, gantt._reCalcDurationToDay = function(t, e) {
  5147.     for (var n = gantt.calculateDuration(t, e), a = new Date(t), i = {
  5148.             hour: 1,
  5149.             minute: 60
  5150.         }, s = 0, r = [], o = 0, l = 0, d = 0; e >= a;) r = gantt.getWorkHours(a), r.length && (l += r[1] - r[0], d++), a.setDate(a.getDate() + 1);
  5151.     return o = parseFloat(n * gantt.config.duration_step / i[gantt.config.duration_unit] / (l / d)).toFixed(2), s = ((new Date(e).getTime() - new Date(t).getTime()) / 864e5).toFixed(2), o = isNaN(o) ? "0.00" : o, {
  5152.         duration: o,
  5153.         calendarDays: s || 0
  5154.     }
  5155. }, gantt._reCalcDurationToHour = function(t, e) {
  5156.     var n = gantt.calculateDuration(t, e),
  5157.         a = {
  5158.             hour: 1,
  5159.             minute: 60
  5160.         }, i = 0,
  5161.         s = 0;
  5162.     return s = parseFloat(n * gantt.config.duration_step / a[gantt.config.duration_unit]).toFixed(2), i = parseFloat((new Date(e).getTime() - new Date(t).getTime()) / 864e5).toFixed(2), s = isNaN(s) ? "0.00" : s, {
  5163.         duration: s || 0,
  5164.         calendarDays: i || 0
  5165.     }
  5166. }, gantt._reCalcHourToDuration = function(t, e) {
  5167.     var n = (new Date(t), {
  5168.         hour: 1,
  5169.         minute: 60
  5170.     }),
  5171.         a = parseFloat(parseFloat(e) * n[gantt.config.duration_unit] / gantt.config.duration_step),
  5172.         i = gantt.calculateEndDate(new Date(t), a * n.minute, "minute"),
  5173.         s = parseFloat((new Date(i).getTime() - new Date(t).getTime()) / 864e5).toFixed(2);
  5174.     return {
  5175.         endDate: i,
  5176.         calendarDays: s
  5177.     }
  5178. }, gantt._reCalcDaysToDuration = function(t, e) {
  5179.     for (var n = new Date(t), a = {
  5180.             hour: 1,
  5181.             minute: 60
  5182.         }, i = parseInt(e * a[gantt.config.duration_unit] / gantt.config.duration_step), s = [], r = 0, o = 0, l = e.toString().split("."), d = 0; r < l[0];) s = gantt.getWorkHours(n), s.length && (r++, o += (s[1] - s[0]) * a[gantt.config.duration_unit] / gantt.config.duration_step), n.setDate(n.getDate() + 1);
  5183.     if (s.length || (s = gantt.getWorkHours(gantt.getClosestWorkTime(n))), l[1]) {
  5184.         var _ = parseFloat(l[1] / Math.pow(10, l[1].length) * (s[1] - s[0])).toFixed(2).toString().split(".");
  5185.         o += parseInt(_[0]) * a[gantt.config.duration_unit] / gantt.config.duration_step, _[1] && (o += Math.ceil(_[1] * a[gantt.config.duration_unit] / (Math.pow(10, _[1].length) * gantt.config.duration_step)))
  5186.     }
  5187.     return i = gantt.calculateEndDate(new Date(t), o, gantt.config.duration_unit), d = ((i.getTime() - new Date(t).getTime()) / 864e5).toFixed(2), {
  5188.         endDate: i,
  5189.         calendarDays: d
  5190.     }
  5191. }, gantt._reCalcWeeksToDuration = function(t, e) {
  5192.     for (var n = new Date(t), a = e.toString().split("."), i = 0, s = 0;
  5193.         (n.getTime() - new Date(t).getTime()) / 6048e5 < 1;) gantt.getWorkHours(n).length && i++, n.setDate(n.getDate() + 1);
  5194.     return s = parseInt(i * a[0]), a[1] && (s += parseFloat(parseFloat(a[1] / Math.pow(10, a[1].length) * i).toFixed(2))), gantt._reCalcDaysToDuration(t, s.toString())
  5195. }, gantt._reCalcMonthToDuration = function(t, e) {
  5196.     for (var n = new Date(t.getFullYear(), t.getMonth(), 0), a = 0, i = e.toString().split("."), s = 0; s < i[0];) a += new Date(n.getFullYear(), n.getMonth(), 0).getDate(), n.setMonth(n.getMonth() + 1), s++;
  5197.     return i[1] && !a && (a = n.getDate(), s = 1), gantt._reCalcWeeksToDuration(t, parseFloat(a / s * e / 7).toFixed(2))
  5198. }, gantt.calculateDurationTo = function(t, e) {
  5199.     switch (gantt.config.duration_view) {
  5200.         case "month":
  5201.             return gantt._reCalcDurationToMonth(t, e);
  5202.         case "week":
  5203.             return gantt._reCalcDurationToWeek(t, e);
  5204.         case "day":
  5205.             return gantt._reCalcDurationToDay(t, e);
  5206.         case "hour":
  5207.             return gantt._reCalcDurationToHour(t, e)
  5208.     }
  5209.     return gantt._reCalcDurationToHour(t, e)
  5210. }, gantt.calculateToDuration = function(t, e) {
  5211.     switch (gantt.config.duration_view) {
  5212.         case "month":
  5213.             return gantt._reCalcMonthToDuration(t, e);
  5214.         case "week":
  5215.             return gantt._reCalcWeeksToDuration(t, e);
  5216.         case "day":
  5217.             return gantt._reCalcDaysToDuration(t, e);
  5218.         case "hour":
  5219.             return gantt._reCalcHourToDuration(t, e)
  5220.     }
  5221. };
  5222. var linkControlPoinerOffset = 19;
  5223. createCSSClass(".gantt_task_line .gantt_link_control.task_left ", "left:-" + linkControlPoinerOffset + "px"), createCSSClass(".gantt_task_line .gantt_link_control.task_right ", "right:-" + linkControlPoinerOffset + "px"), gantt._expand_button = {}, gantt._expand_button._class = "gantt_expand_button";
  5224. var leftButton = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="7" height="12" viewBox="0 0 7 12"><defs><style>.cls-2 {fill: #3498db;}</style></defs><path d="M5.890,12.000 C5.604,12.000 5.319,11.882 5.102,11.645 C5.102,11.645 -0.001,5.989 -0.001,5.989 C-0.001,5.989 5.102,0.333 5.102,0.333 C5.534,-0.138 6.237,-0.141 6.672,0.327 C7.107,0.795 7.109,1.556 6.677,2.027 C6.677,2.027 3.127,5.989 3.127,5.989 C3.127,5.989 6.677,9.951 6.677,9.951 C7.109,10.422 7.107,11.183 6.672,11.651 C6.455,11.884 6.172,12.000 5.890,12.000 Z" id="path-1" class="cls-2" fill-rule="evenodd"/></svg>',
  5225.     rightButton = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="7" height="12" viewBox="0 0 7 12"><defs><style>.cls-2 {fill: #3498db;}</style></defs><path d="M1.079,12.000 C1.364,12.000 1.649,11.882 1.866,11.645 C1.866,11.645 6.969,5.989 6.969,5.989 C6.969,5.989 1.866,0.333 1.866,0.333 C1.435,-0.138 0.732,-0.141 0.297,0.327 C-0.138,0.795 -0.140,1.556 0.292,2.027 C0.292,2.027 3.842,5.989 3.842,5.989 C3.842,5.989 0.292,9.951 0.292,9.951 C-0.140,10.422 -0.138,11.183 0.297,11.651 C0.513,11.884 0.796,12.000 1.079,12.000 Z" id="path-1" class="cls-2" fill-rule="evenodd"/></svg>';
  5226. gantt.templates.expand_button_content = function(t) {
  5227.     return t ? leftButton : rightButton
  5228. }, gantt.attachEvent("onGanttReady", function() {
  5229.     gantt.config.expand_button_y = 30, gantt.config.expand_button_x = 25, gantt.initExpandButton()
  5230. }), gantt.attachEvent("onGanttRender", function() {
  5231.     gantt._resize_expand_button()
  5232. }), gantt.initExpandButton = function() {
  5233.     var t = this._create_expand_button();
  5234.     gantt.$container.appendChild(t)
  5235. }, gantt._hide_expand_button = function() {
  5236.     this._expand_button._html && this._expand_button._html.parentNode && this._expand_button._html.parentNode.removeChild(this._expand_button._html)
  5237. }, gantt._create_expand_button = function() {
  5238.     return this._expand_button._html && this._hide_expand_button(), this._expand_button._html = document.createElement("div"), this._expand_button._html.className = gantt._expand_button._class + " gantt_" + gantt.skin, this._expand_button._html.style.height = gantt.config.expand_button_y + "px", this._expand_button._html.style.width = gantt.config.expand_button_x + "px", this._expand_button._html.style.top = gantt.$container.clientHeight - gantt.config.expand_button_y - 6 - (gantt._scroll_hor ? gantt.config.scroll_size : 0) + "px", this._expand_button._html.style.left = gantt.config.grid_width + "px", gantt._expand_button._html.innerHTML = gantt.templates.expand_button_content(gantt.config.show_grid), this._expand_button._html.addEventListener("click", this._click_expand_button), dhtmlxEvent(window, "resize", function(t) {
  5239.         gantt._resize_expand_button()
  5240.     }), this._expand_button._html
  5241. }, gantt._click_expand_button = function() {
  5242.     gantt.saveTaskEditors(!0), gantt.config.show_grid = !gantt.config.show_grid, gantt._expand_button._html.innerHTML = gantt.templates.expand_button_content(gantt.config.show_grid), gantt.render(), gantt._resize_expand_button()
  5243. }, gantt._resize_expand_button = function() {
  5244.     this._expand_button._html && (this._expand_button._html.style.top = gantt.$container.clientHeight - gantt.config.expand_button_y - 6 - (gantt._scroll_hor ? gantt.config.scroll_size : 0) + "px", this._expand_button._html.style.left = (this.config.show_grid ? this.config.grid_width : 0) + "px")
  5245. }, gantt.gridButtonsHeader = function(t) {
  5246.     return '<div class="gantt_grid_head_cell gantt_grid_head_add" onclick="gantt.clickGridHeadButton(this)"></div>'
  5247. }, gantt.gridButtonsCell = function(t) {
  5248.     var e = ['<div class="fa gantt_button_grid gantt_grid_add fa-plus" action="add_task" onclick="gantt.clickGridButton(this)"></div>', '<div class="fa gantt_button_grid gantt_grid_edit fa-pencil" action="edit_task" onclick="gantt.clickGridButton(this)"></div>', '<div class="fa gantt_button_grid gantt_grid_delete fa-times" action="delete_task" onclick="gantt.clickGridButton(this)"></div>'];
  5249.     return "button" === t.type ? "" : 0 === t.$level || t.$virtual ? "" : e.join("")
  5250. }, gantt.clickGridHeadButton = function(t) {
  5251.     var e = {};
  5252.     this.createTask(e, this.config.root_id)
  5253. }, gantt.clickGridButton = function(t) {
  5254.     var e = t.parentNode.parentNode.parentNode,
  5255.         n = e.getAttribute("task_id"),
  5256.         a = t.getAttribute("action"),
  5257.         i = gantt.locale.labels.confirm_deleting,
  5258.         s = gantt.locale.labels.confirm_deleting_title;
  5259.     switch (a) {
  5260.         case "edit_task":
  5261.             gantt.showLightbox(n);
  5262.             break;
  5263.         case "add_task":
  5264.             gantt.callEvent("onAddTaskIconClick", [n, t]);
  5265.             break;
  5266.         case "delete_task":
  5267.             gantt._dhtmlx_confirm(i, s, function() {
  5268.                 var t = gantt.getTask(n);
  5269.                 t.$new ? (gantt._deleteTask(n, !0), gantt.refreshData()) : gantt.deleteTask(n)
  5270.             })
  5271.     }
  5272. }, gantt._groups = {
  5273.     relation_property: null,
  5274.     relation_id_property: "$group_id",
  5275.     group_id: null,
  5276.     group_text: null,
  5277.     loading: !1,
  5278.     loaded: 0,
  5279.     init: function(t) {
  5280.         var e = this;
  5281.         t.attachEvent("onClear", function() {
  5282.             e.clear()
  5283.         }), e.clear();
  5284.         var n = t._get_parent_id;
  5285.         t._get_parent_id = function(a) {
  5286.             return e.is_active() ? e.get_parent(t, a) : n.apply(this, arguments)
  5287.         };
  5288.         var a = t.setParent;
  5289.         t.setParent = function(n, i) {
  5290.             if (!e.is_active()) return a.apply(this, arguments);
  5291.             if (t.isTaskExists(i)) {
  5292.                 var s = t.getTask(i);
  5293.                 n[e.relation_property] = s[e.relation_id_property]
  5294.             }
  5295.         }, t.attachEvent("onBeforeTaskDisplay", function(n, a) {
  5296.             return e.is_active() && a.type == t.config.types.project && !a.$virtual ? !1 : !0
  5297.         }), t.attachEvent("onBeforeParse", function() {
  5298.             e.loading = !0
  5299.         }), t.attachEvent("onTaskLoading", function() {
  5300.             return e.is_active() && (e.loaded--, e.loaded <= 0 && (e.loading = !1, t.eachTask(dhtmlx.bind(function(e) {
  5301.                 this.get_parent(t, e, tasks)
  5302.             }, e)), t._sync_order())), !0
  5303.         }), t.attachEvent("onParse", function() {
  5304.             e.loading = !1, e.loaded = 0
  5305.         })
  5306.     },
  5307.     get_parent: function(t, e, n) {
  5308.         var a = e[this.relation_property];
  5309.         if (void 0 !== this._groups_pull[a]) return this._groups_pull[a];
  5310.         var i = t.config.root_id;
  5311.         return this.loading || (i = this.find_parent(n || t.getTaskByTime(), a, this.relation_id_property, t.config.root_id), this._groups_pull[a] = i), i
  5312.     },
  5313.     find_parent: function(t, e, n, a) {
  5314.         for (var i = 0; i < t.length; i++) {
  5315.             var s = t[i];
  5316.             if (void 0 !== s[n] && s[n] == e) return s.id
  5317.         }
  5318.         return a
  5319.     },
  5320.     clear: function() {
  5321.         this._groups_pull = {}, this.relation_property = null, this.group_id = null, this.group_text = null
  5322.     },
  5323.     is_active: function() {
  5324.         return !!this.relation_property
  5325.     },
  5326.     generate_sections: function(t, e) {
  5327.         for (var n = [], a = 0; a < t.length; a++) {
  5328.             var i = dhtmlx.copy(t[a]);
  5329.             i.type = e, i.open = !0, i.$virtual = !0, i.readonly = !0, i[this.relation_id_property] = i[this.group_id], i.text = i[this.group_text], n.push(i)
  5330.         }
  5331.         return n
  5332.     },
  5333.     clear_temp_tasks: function(t) {
  5334.         for (var e = 0; e < t.length; e++) t[e].$virtual && (t.splice(e, 1), e--)
  5335.     },
  5336.     generate_data: function(t, e) {
  5337.         var n = t.getLinks(),
  5338.             a = t.getTaskByTime();
  5339.         this.clear_temp_tasks(a);
  5340.         var i = [];
  5341.         this.is_active() && e && e.length && (i = this.generate_sections(e, t.config.types.project));
  5342.         var s = {
  5343.             links: n
  5344.         };
  5345.         return s.data = i.concat(a), s
  5346.     },
  5347.     update_settings: function(t, e, n) {
  5348.         this.clear(), this.relation_property = t, this.group_id = e, this.group_text = n
  5349.     },
  5350.     group_tasks: function(t, e, n, a, i) {
  5351.         this.update_settings(n, a, i);
  5352.         var s = this.generate_data(t, e);
  5353.         this.loaded = s.data.length, t._clear_data(), t.parse(s)
  5354.     }
  5355. }, gantt._groups.init(gantt), gantt.groupBy = function(t) {
  5356.     t = t || {};
  5357.     var e = t.groups || null,
  5358.         n = t.relation_property || null,
  5359.         a = t.group_id || "key",
  5360.         i = t.group_text || "label";
  5361.     this._groups.group_tasks(this, e, n, a, i)
  5362. }, gantt.config.inline_editor_free_height = 4, gantt._inline_edit = {
  5363.     cellContentClass: "gantt_tree_content",
  5364.     _currentTask: null,
  5365.     _controllers: [],
  5366.     _InlineController: function(t) {
  5367.         this.config = t, this.config.container = null
  5368.     },
  5369.     getContentDivCaretPosition: function(t) {
  5370.         var e, n, a = null;
  5371.         return window.getSelection && (e = window.getSelection(), e.rangeCount && (n = e.getRangeAt(0), n.commonAncestorContainer.parentNode == t && (a = {}, a.start = n.startOffset, a.end = n.endOffset))), a
  5372.     },
  5373.     _onTaskClick: function(t, e) {
  5374.         var n = gantt.config.columns,
  5375.             a = e.target || e.srcElement;
  5376.         if (a.className.split(" ").indexOf("gantt_tree_icon") > -1) return !0;
  5377.         a.parentNode.className.split(" ").indexOf("gantt_cell") > -1 && (a = a.parentNode);
  5378.         var i = a.parentNode;
  5379.         if (-1 == i.parentNode.className.split(" ").indexOf("gantt_grid_data")) return !0;
  5380.         for (var s, r = 0; r < i.childNodes.length; r++)
  5381.             if (i.childNodes[r] == a) {
  5382.                 s = r;
  5383.                 break
  5384.             }
  5385.         if (void 0 !== s && "text" == n[s].control_type) var o = a.lastChild,
  5386.         l = gantt._inline_edit.getContentDivCaretPosition(o);
  5387.         if (gantt.showTaskEditors(t), void 0 !== s)
  5388.             for (var d = gantt._inline_edit._controllers, r = 0; r < d.length; r++)
  5389.                 if (d[r].config.colIndex == s) {
  5390.                     gantt._inline_edit._controllers[s].focus(l);
  5391.                     break
  5392.                 }
  5393.         return !1
  5394.     },
  5395.     _onEmptyClick: function(t) {
  5396.         var e = t.target || t.srcElement; - 1 == e.className.indexOf("add_task_button") && e.parentNode && -1 == e.parentNode.className.indexOf("add_task_button") && -1 == e.className.indexOf("gantt_grid_head_add") && gantt.saveTaskEditors(!0)
  5397.     },
  5398.     _onDataRender: function() {
  5399.         var t = gantt._inline_edit._controllers;
  5400.         if (gantt._inline_edit._currentTask) {
  5401.             if (gantt.isTaskExists(gantt._inline_edit._currentTask) && gantt.isTaskVisible(gantt._inline_edit._currentTask)) {
  5402.                 gantt.selectAndShowTask(gantt._inline_edit._currentTask, !0);
  5403.                 for (var e = gantt.getTask(gantt._inline_edit._currentTask), n = 0; n < t.length; n++) t[n].unload(), t[n].config.value != e[t[n].config.colName] && (t[n].config.value = -1 !== t[n].config.colName.indexOf("duration") ? gantt.calculateDurationTo(e.start_date, e.end_date).duration : e[t[n].config.colName]), t[n].render()
  5404.             }
  5405.         } else
  5406.             for (var n = 0; n < t.length; n++) t[n].unload(), t[n].render()
  5407.     },
  5408.     _onBeforeLightBox: function(t) {
  5409.         return t == gantt._inline_edit._currentTask ? gantt.saveTaskEditors() : gantt.saveTaskEditors(!0), !0
  5410.     },
  5411.     _onBeforeTaskDrag: function() {
  5412.         return gantt.saveTaskEditors(!0), !0
  5413.     },
  5414.     _onRowDragStart: function() {
  5415.         return gantt.saveTaskEditors(!0), !0
  5416.     },
  5417.     _onBeforeTaskDelete: function() {
  5418.         return gantt.saveTaskEditors(!0), !0
  5419.     },
  5420.     _createControl: function(t, e, n) {
  5421.         var a = {
  5422.             taskId: t,
  5423.             colIndex: e,
  5424.             colName: gantt.config.columns[e].name,
  5425.             control: this.editors[n]
  5426.         }, i = new this._InlineController(a);
  5427.         return this._controllers.push(i), i.render(), i
  5428.     },
  5429.     _isEditorsOpened: function() {
  5430.         return gantt._inline_edit._currentTask && 0 != gantt._inline_edit._controllers.length ? !0 : !1
  5431.     },
  5432.     editors: {
  5433.         text: {
  5434.             render: function(t, e) {
  5435.                 t.innerHTML = '<div contenteditable="true" style="line-height: ' + (t.offsetHeight + 1) + 'px"></div>'
  5436.             },
  5437.             setValue: function(t, e) {
  5438.                 t.childNodes[0].textContent = e
  5439.             },
  5440.             getValue: function(t) {
  5441.                 return t.childNodes[0].textContent
  5442.             },
  5443.             focus: function(t, e) {
  5444.                 var n = t.childNodes[0];
  5445.                 e = e ? e : {
  5446.                     start: 0,
  5447.                     end: n.textContent.length
  5448.                 };
  5449.                 var a = document.createRange(),
  5450.                     i = window.getSelection();
  5451.                 n.childNodes.length > 0 && (a.setStart(n.childNodes[0], e.start), a.setEnd(n.childNodes[0], e.end)), i.removeAllRanges(), i.addRange(a), n.focus()
  5452.             },
  5453.             unload: function(t, e) {},
  5454.             initEventListeners: function(t) {
  5455.                 dhtmlxEvent(t.config.container, "dblclick", function(t) {
  5456.                     t.cancelBubble = !0, t.stopPropagation && t.stopPropagation()
  5457.                 }), dhtmlxEvent(t.config.container.childNodes[0], "keypress", function(t) {
  5458.                     return 13 == t.which ? (t.preventDefault() && t.preventDefault(), !1) : void 0
  5459.                 }), dhtmlxEvent(t.config.container.childNodes[0], "blur", function(e) {
  5460.                     t.config.value = this.textContent
  5461.                 })
  5462.             }
  5463.         },
  5464.         datepicker: {
  5465.             render: function(t, e) {
  5466.                 t.innerHTML = "<div id='" + e + "'></div>", webix.ui({
  5467.                     view: "datepicker",
  5468.                     id: e,
  5469.                     container: e,
  5470.                     timepicker: !0,
  5471.                     height: t.offsetHeight,
  5472.                     width: t.offsetWidth,
  5473.                     format: gantt.config.date_grid
  5474.                 });
  5475.                 var n = t.querySelector(".webix_inp_static");
  5476.                 n && (n.style.lineHeight = t.offsetHeight + 1 + "px")
  5477.             },
  5478.             setValue: function(t, e, n) {
  5479.                 $$(n).setValue(e)
  5480.             },
  5481.             getValue: function(t, e) {
  5482.                 var n = $$(e).getValue();
  5483.                 return n
  5484.             },
  5485.             focus: function(t, e, n) {
  5486.                 $$(n).getInputNode().click()
  5487.             },
  5488.             unload: function(t, e) {
  5489.                 $$(e) && ($$(e).getPopup().hide(), $$(e).destructor())
  5490.             },
  5491.             initEventListeners: function(t) {
  5492.                 dhtmlxEvent(t.config.container, "dblclick", function(t) {
  5493.                     t.cancelBubble = !0, t.stopPropagation && t.stopPropagation()
  5494.                 }), $$(t.config.id).attachEvent("onChange", function(e, n) {
  5495.                     e != t.config.value && (t.setValue(e), gantt.saveTaskEditors(!1, !0))
  5496.                 })
  5497.             }
  5498.         },
  5499.         counter: {
  5500.             render: function(t, e) {
  5501.                 t.innerHTML = "<div id='" + e + "'></div>", webix.ui({
  5502.                     view: "counter",
  5503.                     id: e,
  5504.                     container: e,
  5505.                     min: 1,
  5506.                     step: 1,
  5507.                     height: t.offsetHeight
  5508.                 })
  5509.             },
  5510.             setValue: function(t, e, n) {
  5511.                 e || (e = 1), dev.log("Inner Set Value:", e), $$(n).setValue(e)
  5512.             },
  5513.             getValue: function(t, e) {
  5514.                 var n = $$(e).getValue();
  5515.                 return n
  5516.             },
  5517.             focus: function(t, e, n) {
  5518.                 $$(n).focus()
  5519.             },
  5520.             unload: function(t, e) {
  5521.                 $$(e) && $$(e).destructor()
  5522.             },
  5523.             initEventListeners: function(t) {
  5524.                 dhtmlxEvent(t.config.container, "dblclick", function(t) {
  5525.                     t.cancelBubble = !0, t.stopPropagation && t.stopPropagation()
  5526.                 }), $$(t.config.id).attachEvent("onChange", function(e, n) {
  5527.                     !isNaN(parseFloat(e)) && isFinite(e) ? e != t.config.value && (t.setValue(e), gantt.saveTaskEditors(!1)) : ($$(t.config.id).config.value = n, $$(t.config.id).refresh(), webix.message({
  5528.                         type: "error",
  5529.                         text: "Ahtung!! Теряем высоту!"
  5530.                     }))
  5531.                 })
  5532.             }
  5533.         },
  5534.         select: {
  5535.             render: function(t, e, n) {
  5536.                 var a = [{
  5537.                     key: 0,
  5538.                     value: ""
  5539.                 }],
  5540.                     i = gantt.config.columns[n];
  5541.                 i.control_options && (a = a.concat(i.control_options)), t.innerHTML = "<div id='" + e + "'></div>", webix.ui({
  5542.                     view: "richselect",
  5543.                     borderless: !0,
  5544.                     id: e,
  5545.                     container: e,
  5546.                     min: 1,
  5547.                     height: t.offsetHeight,
  5548.                     inputHeight: t.offsetHeight,
  5549.                     options: a,
  5550.                     popupWidth: 150
  5551.                 })
  5552.             },
  5553.             setValue: function(t, e, n) {
  5554.                 var a = $$(n),
  5555.                     i = a.getPopup();
  5556.                 a.$view.childNodes[0].childNodes[0].style.lineHeight = gantt.config.row_height - gantt.config.inline_editor_free_height + "px", -1 == a.getPopup().$view.className.indexOf("inline_select_popup") && (a.getPopup().$view.className += " inline_select_popup"), a.setValue(this._getValueByKey(a, e)), i.config.width = 200, i.attachEvent("onShow", function() {
  5557.                     i.config.width = a.config.popupWidth, i.resize()
  5558.                 })
  5559.             },
  5560.             getValue: function(t, e) {
  5561.                 var n = $$(e),
  5562.                     a = n.getValue();
  5563.                 return this._getKeyByValue(n, a)
  5564.             },
  5565.             focus: function(t, e, n) {
  5566.                 $$(n).getInputNode().click()
  5567.             },
  5568.             unload: function(t, e) {
  5569.                 $$(e) && ($$(e).getPopup().hide(), $$(e).destructor())
  5570.             },
  5571.             initEventListeners: function(t) {
  5572.                 var e = this;
  5573.                 dhtmlxEvent(t.config.container, "dblclick", function(t) {
  5574.                     t.cancelBubble = !0, t.stopPropagation && t.stopPropagation()
  5575.                 }), $$(t.config.id).attachEvent("onChange", function(n, a) {
  5576.                     var i = $$(t.config.id),
  5577.                         s = e._getKeyByValue(i, n);
  5578.                     s != t.config.value && t.setValue(s)
  5579.                 })
  5580.             },
  5581.             _getKeyByValue: function(t, e) {
  5582.                 for (var n = t.getPopup().getList().config.data, a = 0, i = 0; i < n.length; i++)
  5583.                     if (n[i].value == e) {
  5584.                         a = n[i].key;
  5585.                         break
  5586.                     }
  5587.                 return a
  5588.             },
  5589.             _getValueByKey: function(t, e) {
  5590.                 e = e ? e : 0;
  5591.                 for (var n = t.getPopup().getList().config.data, a = "", i = 0; i < n.length; i++)
  5592.                     if (n[i].key == e) {
  5593.                         a = n[i].value;
  5594.                         break
  5595.                     }
  5596.                 return a
  5597.             }
  5598.         }
  5599.     }
  5600. }, gantt._inline_edit._InlineController.prototype.render = function() {
  5601.     var t = gantt.getTaskRowNode(this.config.taskId),
  5602.         e = t.childNodes[this.config.colIndex],
  5603.         n = e.querySelector(".inline_editor");
  5604.     if (!n) {
  5605.         this.config.container && 0 != this.config.container.childNodes.length && this.config.control.unload(this.config.container, this.config.id), n = this.config.container = document.createElement("DIV"), n.className = "inline_editor";
  5606.         var a = this._getControllerRect(e);
  5607.         n.style.width = a.width + "px", n.style.height = a.height + "px", n.style.top = a.top + "px", n.style.left = a.left + "px", e.style.position = "relative", e.appendChild(n), this.config.id = this.config.colName + this.config.colIndex, this.config.control.render(n, this.config.id, this.config.colIndex), this.setValue(this.config.value), this.config.control.initEventListeners(this)
  5608.     }
  5609. }, gantt._inline_edit._InlineController.prototype.setValue = function(t) {
  5610.     if (this.config.value = t, -1 !== this.config.id.indexOf("duration") && !this.config.initDuration && t) {
  5611.         var e = gantt.getTask(this.config.taskId);
  5612.         t = gantt.calculateDurationTo(e.start_date, e.end_date).duration, this.config.initDuration = !0
  5613.     }
  5614.     this.config.control.setValue(this.config.container, t, this.config.id)
  5615. }, gantt._inline_edit._InlineController.prototype.saveValue = function(t) {
  5616.     var e = this.config.control.getValue(this.config.container, this.config.id),
  5617.         n = gantt.getTask(this.config.taskId),
  5618.         a = gantt.config.columns[this.config.colIndex].inline_validate;
  5619.     if (n[this.config.colName] != e) {
  5620.         if (a && !a(e)) return;
  5621.         n[this.config.colName] = e, "duration" == this.config.colName && (n[this.config.colName] = e, n.end_date = gantt.calculateToDuration(n.start_date, n[this.config.colName]).endDate, n.duration = gantt.calculateDuration(n.start_date, n.end_date), gantt.autoSchedule(n.id)), t || gantt.updateTask(n.id, n)
  5622.     }
  5623. }, gantt._inline_edit._InlineController.prototype.focus = function(t) {
  5624.     this.config.control.focus(this.config.container, t, this.config.id)
  5625. }, gantt._inline_edit._InlineController.prototype.unload = function() {
  5626.     this.config.container && (this.config.control.unload(this.config.container, this.config.id), this.config.container.parentNode && this.config.container.parentNode.removeChild(this.config.container))
  5627. }, gantt._inline_edit._InlineController.prototype._getControllerRect = function(t) {
  5628.     for (var e = t.childNodes, n = {}, a = 0, i = 0; i < e.length; i++) - 1 == e[i].className.indexOf(gantt._inline_edit.cellContentClass) && (a += e[i].offsetWidth);
  5629.     var s = window.getComputedStyle(t, null),
  5630.         r = parseInt(s.paddingRight),
  5631.         o = parseInt(s.paddingLeft);
  5632.     return n.width = t.offsetWidth - a - r, n.height = t.offsetHeight - gantt.config.inline_editor_free_height, n.top = gantt.config.inline_editor_free_height / 2, n.left = a + o, n
  5633. }, gantt.selectAndShowTask = function(t) {
  5634.     var e = "object" == typeof e ? e : gantt.getTask(t);
  5635.     if (e) {
  5636.         var n = gantt.getTaskNode(e.id);
  5637.         if (!n) return !1;
  5638.         var a = Math.max(n.offsetLeft - this.config.task_scroll_offset, 0);
  5639.         this.scrollTo(a), gantt.selectTask(e.id)
  5640.     }
  5641. }, gantt.showTaskEditors = function(t) {
  5642.     if (1 != gantt.config.readonly && (t = "object" == typeof t ? t : gantt.getTask(t), t && gantt._inline_edit._currentTask != t.id)) {
  5643.         if (gantt.saveTaskEditors(!0), gantt._inline_edit._currentTask = t.id, t.$virtual) return !0;
  5644.         gantt.selectAndShowTask(t.id);
  5645.         for (var e = gantt.config.columns, n = gantt._inline_edit.editors, a = 0; a < e.length; a++) {
  5646.             var i = e[a].control_type;
  5647.             if (i && n[i] && (!e[a].task_types || !t.type || -1 != e[a].task_types.indexOf(t.type))) {
  5648.                 var s = gantt._inline_edit._createControl(t.id, a, i);
  5649.                 s.setValue(t[e[a].name])
  5650.             }
  5651.         }
  5652.     }
  5653. }, gantt.saveTaskEditors = function(t, e) {
  5654.     var n = gantt._inline_edit._controllers,
  5655.         a = gantt.isTaskExists(gantt._inline_edit._currentTask) ? gantt.getTask(gantt._inline_edit._currentTask) : void 0,
  5656.         i = 0;
  5657.     if (gantt._inline_edit._currentTask) {
  5658.         for (var s = 0; s < n.length; s++) "duration" === n[s].config.colName ? i = s : n[s].saveValue(!0);
  5659.         a.end_date = gantt.calculateEndDate(a.start_date, a.duration), n[i].saveValue(!0), e && gantt.refreshTask(gantt._inline_edit._currentTask), t || gantt._inline_edit._onDataRender()
  5660.     }
  5661.     t && (a && gantt.updateTask(gantt._inline_edit._currentTask), gantt.unloadTaskEditors())
  5662. }, gantt.unloadTaskEditors = function() {
  5663.     for (var t = gantt._inline_edit._controllers, e = 0; e < t.length; e++) t[e].unload();
  5664.     gantt._inline_edit._currentTask = null, gantt._inline_edit._controllers = []
  5665. }, gantt._inline_edit.old_render_grid_item = gantt._render_grid_item, gantt._inline_edit._render_grid_item = function(t) {
  5666.     if (!gantt._is_grid_visible()) return null;
  5667.     for (var e = this.getGridColumns(), n = [], a = 0; a < e.length; a++) {
  5668.         var i, s, r = a == e.length - 1,
  5669.             o = e[a];
  5670.         if ("add" == o.name) s = "<div class='gantt_add'></div>";
  5671.         else {
  5672.             s = o.template ? o.template(t) : t[o.name], s instanceof Date && (s = this.templates.date_grid(s));
  5673.             var l = "",
  5674.                 d = "";
  5675.             "text" != o.control_type || o.task_types && t.type && -1 == o.task_types.indexOf(t.type) || (l = "contenteditable='true'"), s = "<div class='gantt_tree_content' " + l + ">" + s + "</div>"
  5676.         }
  5677.         var _ = "gantt_cell" + (r ? " gantt_last_cell" : ""),
  5678.             c = "";
  5679.         if (o.tree) {
  5680.             for (var g = 0; g < t.$level; g++) c += this.templates.grid_indent(t);
  5681.             var h = this._has_children(t.id);
  5682.             h ? (c += this.templates.grid_open(t), c += this.templates.grid_folder(t)) : (c += this.templates.grid_blank(t), c += this.templates.grid_file(t))
  5683.         }
  5684.         var d = "width:" + (o.width - (r ? 1 : 0)) + "px;";
  5685.         dhtmlx.defined(o.align) && (d += "text-align:" + o.align + ";"), i = "<div class='" + _ + "' style='" + d + "'>" + c + s + "</div>", n.push(i)
  5686.     }
  5687.     var _ = t.$index % 2 === 0 ? "" : " odd";
  5688.     if (_ += t.$transparent ? " gantt_transparent" : "", this.templates.grid_row_class) {
  5689.         var u = this.templates.grid_row_class.call(this, t.start_date, t.end_date, t);
  5690.         u && (_ += " " + u)
  5691.     }
  5692.     this.getState().selected_task == t.id && (_ += " gantt_selected");
  5693.     var f = document.createElement("div");
  5694.     return f.className = "gantt_row" + _, f.style.height = this.config.row_height + "px", f.style.lineHeight = gantt.config.row_height + "px", f.setAttribute(this.config.task_attribute, t.id), f.innerHTML = n.join(""), f
  5695. }, gantt._render_grid_item = gantt._inline_edit._render_grid_item, gantt.attachEvent("onTaskClick", gantt._inline_edit._onTaskClick), gantt.attachEvent("onEmptyClick", gantt._inline_edit._onEmptyClick), gantt.attachEvent("onDataRender", gantt._inline_edit._onDataRender), gantt.attachEvent("onBeforeLightbox", gantt._inline_edit._onBeforeLightBox), gantt.attachEvent("onBeforeTaskDrag", gantt._inline_edit._onBeforeTaskDrag), gantt.attachEvent("onRowDragStart", gantt._inline_edit._onRowDragStart), gantt.attachEvent("onBeforeTaskDelete", gantt._inline_edit._onBeforeTaskDelete);
  5696. var taskDeleteConfirmation = "Are you sure you want to delete this task?",
  5697.     linkDeleteConfirmation = "Are you sure you want to delete this link?",
  5698.     highlightedLinkColor = {
  5699.         broadway: "#FFA011",
  5700.         meadow: "#ffb96d",
  5701.         skyblue: "#4a8f43",
  5702.         terrace: "#FFA011"
  5703.     }, allowedElements = ["html", "body"],
  5704.     isEnterActionAllowed = !0;
  5705. gantt.attachEvent("onGanttRender", function() {
  5706.     var t = gantt.skin,
  5707.         e = highlightedLinkColor[t];
  5708.     createCSSClass(".gantt_task_link.selected_link .gantt_line_wrapper div", "box-shadow: 0 0 5px 0px " + e + ";")
  5709. });
  5710. var currentLinkId = null,
  5711.     objectClicked = null;
  5712. gantt.attachEvent("onAfterLightbox", function(t) {
  5713.     return isEnterActionAllowed = !1, !0
  5714. }), document.addEventListener("keyup", function(t) {
  5715.     if (!checkIfEventHandlingAllowed(t)) return !1;
  5716.     if (46 == t.keyCode) {
  5717.         if (1 == gantt.config.readonly) return !1;
  5718.         switch (objectClicked) {
  5719.             case "task":
  5720.                 var e = gantt.getSelectedId();
  5721.                 deleteTask(e);
  5722.                 break;
  5723.             case "link":
  5724.                 deleteLink(currentLinkId)
  5725.         }
  5726.     }
  5727.     if (40 == t.keyCode) switch (objectClicked) {
  5728.         case "task":
  5729.             var e = gantt.getSelectedId();
  5730.             nextTaskId = gantt.getNext(e) || gantt._order[0], selectTask(nextTaskId)
  5731.     }
  5732.     if (38 == t.keyCode) switch (objectClicked) {
  5733.         case "task":
  5734.             var e = gantt.getSelectedId();
  5735.             prevTaskId = gantt.getPrev(e) || gantt._order[gantt._order.length - 1], selectTask(prevTaskId)
  5736.     }
  5737.     if (39 == t.keyCode) switch (objectClicked) {
  5738.         case "task":
  5739.             var e = gantt.getSelectedId();
  5740.             if (nextSiblingTaskId = gantt.getNextSibling(e), !nextSiblingTaskId) {
  5741.                 var n = gantt.getSiblings(e);
  5742.                 nextSiblingTaskId = n[0]
  5743.             }
  5744.             selectTask(nextSiblingTaskId)
  5745.     }
  5746.     if (37 == t.keyCode) switch (objectClicked) {
  5747.         case "task":
  5748.             var e = gantt.getSelectedId();
  5749.             if (prevSiblingTaskId = gantt.getPrevSibling(e), !prevSiblingTaskId) {
  5750.                 var n = gantt.getSiblings(e);
  5751.                 prevSiblingTaskId = n[n.length - 1]
  5752.             }
  5753.             selectTask(prevSiblingTaskId)
  5754.     }
  5755.     if (13 == t.keyCode || 32 == t.keyCode)
  5756.         if (isEnterActionAllowed) {
  5757.             if ("task" == objectClicked) {
  5758.                 var e = gantt.getSelectedId();
  5759.                 return gantt.showLightbox(e), !1
  5760.             }
  5761.         } else isEnterActionAllowed = !0;
  5762.     if (45 == t.keyCode) {
  5763.         if (1 == gantt.config.readonly) return !1;
  5764.         gantt.createTask()
  5765.     }
  5766.     if (107 == t.keyCode) {
  5767.         if (1 == gantt.config.readonly) return !1;
  5768.         switch (objectClicked) {
  5769.             case "task":
  5770.                 var e = gantt.getSelectedId();
  5771.                 gantt.createTask(null, e);
  5772.                 break;
  5773.             default:
  5774.                 gantt.createTask()
  5775.         }
  5776.     }
  5777.     return !1
  5778. }), gantt.attachEvent("onEmptyClick", function(t) {
  5779.     var e = t.target || t.srcElement;
  5780.     e.parentNode && -1 == e.parentNode.className.split(" ").indexOf("gantt_task_link") && unselectLink(), objectClicked = null
  5781. }), gantt.attachEvent("onLinkClick", function(t, e) {
  5782.     objectClicked = "link", selectLink(t), unselectTask()
  5783. }), gantt.attachEvent("onTaskSelected", function(t, e) {
  5784.     objectClicked = "task", unselectLink()
  5785. }), gantt.templates.link_class = function(t) {
  5786.     return t.id == currentLinkId ? "selected_link" : ""
  5787. }, gantt._markers || (gantt._markers = {}), gantt.config.show_markers = !0, gantt.attachEvent("onClear", function() {
  5788.     gantt._markers = {}
  5789. }), gantt.attachEvent("onGanttReady", function() {
  5790.     function t(t) {
  5791.         if (!gantt.config.show_markers) return !1;
  5792.         if (!t.start_date) return !1;
  5793.         var e = gantt.getState();
  5794.         if (!(+t.start_date > +e.max_date || +t.end_date && +t.end_date < +e.min_date || +t.start_date < +e.min_date)) {
  5795.             var n = document.createElement("div");
  5796.             n.setAttribute("marker_id", t.id);
  5797.             var a = "gantt_marker";
  5798.             gantt.templates.marker_class && (a += " " + gantt.templates.marker_class(t)), t.css && (a += " " + t.css), t.title && (n.title = t.title), n.className = a;
  5799.             var i = gantt.posFromDate(t.start_date);
  5800.             if (n.style.left = i + "px", n.style.height = Math.max(gantt._y_from_ind(gantt._order.length), 0) + "px", t.end_date) {
  5801.                 var s = gantt.posFromDate(t.end_date);
  5802.                 n.style.width = Math.max(s - i, 0) + "px"
  5803.             }
  5804.             return t.text && (n.innerHTML = "<div class='gantt_marker_content' >" + t.text + "</div>"), n
  5805.         }
  5806.     }
  5807.     var e = document.createElement("div");
  5808.     e.className = "gantt_marker_area", gantt.$task_data.appendChild(e), gantt.$marker_area = e, gantt._markerRenderer = gantt._task_renderer("markers", t, gantt.$marker_area, null)
  5809. }), gantt.attachEvent("onDataRender", function() {
  5810.     gantt.renderMarkers()
  5811. }), gantt.getMarker = function(t) {
  5812.     return this._markers ? this._markers[t] : null
  5813. }, gantt.addMarker = function(t) {
  5814.     return t.id = t.id || dhtmlx.uid(), this._markers[t.id] = t, t.id
  5815. }, gantt.deleteMarker = function(t) {
  5816.     return this._markers && this._markers[t] ? (delete this._markers[t], !0) : !1
  5817. }, gantt.updateMarker = function(t) {
  5818.     this._markerRenderer && this._markerRenderer.render_item(t)
  5819. }, gantt.renderMarkers = function() {
  5820.     if (!this._markers) return !1;
  5821.     if (!this._markerRenderer) return !1;
  5822.     var t = [];
  5823.     for (var e in this._markers) t.push(this._markers[e]);
  5824.     return this._markerRenderer.render_items(t), !0
  5825. }, gantt.config.multiselect = !0, gantt.config.multiselect_one_level = !1, gantt._multiselect = {
  5826.     selected: {},
  5827.     one_level: !0,
  5828.     active: !0,
  5829.     isActive: function() {
  5830.         return this.update_state(), this.active
  5831.     },
  5832.     update_state: function() {
  5833.         this.one_level = gantt.config.multiselect_one_level;
  5834.         var t = this.active;
  5835.         this.active = gantt.config.multiselect, this.active != t && this.reset()
  5836.     },
  5837.     reset: function() {
  5838.         this.selected = {}
  5839.     },
  5840.     set_last_selected: function(t) {
  5841.         this.last_selected = t
  5842.     },
  5843.     getLastSelected: function() {
  5844.         var t = this.last_selected;
  5845.         return t && gantt.isTaskExists(t) ? t : null
  5846.     },
  5847.     select: function(t, e) {
  5848.         gantt.callEvent("onBeforeTaskMultiSelect", [t, !0, e]) && (this.selected[t] = !0, this.set_last_selected(t), gantt.callEvent("onTaskMultiSelect", [t, !0, e]))
  5849.     },
  5850.     toggle: function(t, e) {
  5851.         this.selected[t] ? this.unselect(t, e) : this.select(t, e)
  5852.     },
  5853.     unselect: function(t, e) {
  5854.         gantt.callEvent("onBeforeTaskMultiSelect", [t, !1, e]) && (this.selected[t] = !1, this.last_selected == t && (this.last_selected = null), gantt.callEvent("onTaskMultiSelect", [t, !0, e]))
  5855.     },
  5856.     isSelected: function(t) {
  5857.         return !(!gantt.isTaskExists(t) || !this.selected[t])
  5858.     },
  5859.     getSelected: function() {
  5860.         var t = [];
  5861.         for (var e in this.selected) this.selected[e] && gantt.isTaskExists(e) ? t.push(e) : this.selected[e] = !1;
  5862.         return t.sort(function(t, e) {
  5863.             return gantt.calculateTaskLevel(gantt.getTask(t)) > gantt.calculateTaskLevel(gantt.getTask(e)) ? 1 : -1
  5864.         }), t
  5865.     },
  5866.     forSelected: function(t) {
  5867.         for (var e = this.getSelected(), n = 0; n < e.length; n++) t(e[n])
  5868.     },
  5869.     is_same_level: function(t) {
  5870.         if (!this.one_level) return !0;
  5871.         var e = this.getLastSelected();
  5872.         return e && gantt.isTaskExists(e) && gantt.isTaskExists(t) ? !(gantt.calculateTaskLevel(gantt.getTask(e)) != gantt.calculateTaskLevel(gantt.getTask(t))) : !0
  5873.     },
  5874.     _after_select: function(t) {
  5875.         gantt.refreshTask(t)
  5876.     },
  5877.     _do_selection: function(t) {
  5878.         if (!this.isActive()) return !0;
  5879.         var e = gantt.locate(t),
  5880.             n = this.getSelected();
  5881.         if (!e) return !0;
  5882.         if (!gantt.callEvent("onBeforeMultiSelect", [t])) return !0;
  5883.         if (t.ctrlKey) e && (this.toggle(e, t), this._after_select(e));
  5884.         else if (t.shiftKey && n.length) {
  5885.             var a = this.getLastSelected();
  5886.             if (a || (a = n[n.length - 1]), e && a != e) {
  5887.                 for (var i = gantt.getGlobalTaskIndex(a), s = gantt.getGlobalTaskIndex(e), r = e; gantt.getGlobalTaskIndex(r) != i;) this.select(r), this._after_select(r), r = i > s ? gantt.getNext(r) : gantt.getPrev(r);
  5888.                 this.forSelected(dhtmlx.bind(function(t) {
  5889.                     var e = gantt.getGlobalTaskIndex(t);
  5890.                     (e > i && e > s || i > e && s > e) && (this.unselect(t), gantt.refreshTask(t))
  5891.                 }, this))
  5892.             }
  5893.         } else this.forSelected(dhtmlx.bind(function(t) {
  5894.             t != e && (this.unselect(t), gantt.refreshTask(t))
  5895.         }, this)), this.isSelected(e) || (this.select(e), this._after_select(e));
  5896.         return this.isSelected(e) ? !0 : !1
  5897.     }
  5898. },
  5899. function() {
  5900.     var t = gantt.selectTask;
  5901.     gantt.selectTask = function(e) {
  5902.         var n = t.call(this, e);
  5903.         return this.config.multiselect && this._multiselect.select(e), n
  5904.     };
  5905.     var e = gantt.unselectTask;
  5906.     gantt.unselectTask = function(t) {
  5907.         var n = e.call(this, t);
  5908.         return this.config.multiselect && this._multiselect.unselect(t), n
  5909.     }, gantt.toggleTaskSelection = function(t) {
  5910.         this.config.multiselect && this._multiselect.toggle(t)
  5911.     }, gantt.getSelectedTasks = function() {
  5912.         return this._multiselect.getSelected()
  5913.     }, gantt.eachSelectedTask = function(t) {
  5914.         return this._multiselect.forSelected(t)
  5915.     }, gantt.isSelectedTask = function(t) {
  5916.         return this._multiselect.isSelected(t)
  5917.     }, gantt.getLastSelectedTask = function() {
  5918.         return this._multiselect.getLastSelected()
  5919.     }
  5920. }(), gantt.attachEvent("onTaskIdChange", function(t, e) {
  5921.     var n = gantt._multiselect;
  5922.     return n.isActive() ? void(gantt.isSelectedTask(t) && (n.unselect(t, null), n.select(e, null), gantt.refreshTask(e))) : !0
  5923. }), gantt.attachEvent("onAfterTaskDelete", function(t, e) {
  5924.     var n = gantt._multiselect;
  5925.     return n.isActive() ? (n.selected[t] && n.unselect(t, null), void n.forSelected(function(t) {
  5926.         gantt.isTaskExists(t) || n.unselect(t, null)
  5927.     })) : !0
  5928. }), gantt.attachEvent("onBeforeTaskMultiSelect", function(t, e, n) {
  5929.     var a = gantt._multiselect;
  5930.     return e && a.isActive() ? a.is_same_level(t) : !0
  5931. }), gantt.attachEvent("onTaskClick", function(t, e) {
  5932.     var n = gantt._multiselect._do_selection(e);
  5933.     return gantt.callEvent("onMultiSelect", [e]), n
  5934. }), gantt.attachEvent("onEmptyClick", function(t) {
  5935.     return gantt._multiselect._do_selection(t), gantt.callEvent("onMultiSelect", [t]), !0
  5936. }), gantt.locale.labels.section_project_start = "Project Start", gantt._update_project_start = null, gantt.config.lightbox.project_sections = [{
  5937.     name: "project_start",
  5938.     type: "duration",
  5939.     single_date: !0,
  5940.     map_to: "auto"
  5941. }], gantt.attachEvent("onBeforeTaskUpdate", function(t, e) {
  5942.     return e.type == gantt.config.types.project && (gantt._update_project_start = e.start_date), !0
  5943. }), gantt.attachEvent("onAfterTaskUpdate", function(t, e) {
  5944.     null !== gantt._update_project_start && (gantt.moveProject(t, gantt._update_project_start), gantt._update_project_start = null)
  5945. }), gantt.attachEvent("onLightboxSave", function(t, e, n) {
  5946.     var a = gantt.getTask(t),
  5947.         i = gantt._get_safe_type(a.type);
  5948.     return n || i != gantt.config.types.project || +a.start_date == +e.start_date || gantt.moveProject(t, e.start_date), !0
  5949. }), gantt.moveProject = function(t, e) {
  5950.     if (!gantt._tasks_recalculating) {
  5951.         if (gantt._tasks_recalculating = !0, e) {
  5952.             var n, a = gantt.getTask(t);
  5953.             n = a.start_date.valueOf() < e.valueOf() ? gantt.calculateDuration(a.start_date, e) : -gantt.calculateDuration(e, a.start_date), gantt.batchUpdate(function() {
  5954.                 gantt._moveChildren(t, n)
  5955.             })
  5956.         }
  5957.         gantt._tasks_recalculating = !1
  5958.     }
  5959. }, gantt._moveChildren = function(t, e) {
  5960.     var n = gantt.getChildren(t);
  5961.     if (gantt.hasChild(t))
  5962.         for (var a = 0; a < n.length; a++) gantt._moveTasksDates(n[a], e)
  5963. }, gantt._moveTasksDates = function(t, e) {
  5964.     var n = !! e;
  5965.     if (t != gantt.config.root_id) {
  5966.         var a = gantt.getTask(t);
  5967.         a.type !== gantt.config.types.button && (a.start_date = gantt.calculateEndDate(a.start_date, e), a.start_date = gantt.getClosestWorkTime({
  5968.             date: a.start_date,
  5969.             dir: "future"
  5970.         }), a.end_date = gantt.calculateEndDate(a.end_date, e), n && gantt.updateTask(t))
  5971.     }
  5972.     gantt._moveChildren(t, e)
  5973. }, gantt.config._letter_size_coefficient = 5, gantt.templates.leftside_text = leftSideTextTemplate, gantt.templates.rightside_text = rightSideTextTemplate, gantt.templates.task_text = taskTextTemplate,
  5974. function() {
  5975.     function t(t, e) {
  5976.         for (var n in e) t[n] || (t[n] = e[n]);
  5977.         return t
  5978.     }
  5979.  
  5980.     function e(t) {
  5981.         var e = t.config.columns;
  5982.         if (e)
  5983.             for (var n = 0; n < e.length; n++) e[n].template && (e[n].$template = !0)
  5984.     }
  5985.  
  5986.     function n(n) {
  5987.         function i(t) {
  5988.             var e = {};
  5989.             for (var a in t) "$" != a.charAt(0) && (e[a] = t[a]);
  5990.             return e.start_date = n.templates.xml_format(e.start_date), e.end_date && (e.end_date = n.templates.xml_format(e.end_date)), e
  5991.         }
  5992.  
  5993.         function s(t) {
  5994.             var e = n.templates.task_text(t.start_date, t.end_date, t),
  5995.                 a = i(t);
  5996.             return a.text = e, a
  5997.         }
  5998.  
  5999.         function r(t) {
  6000.             var e = o(t, s(t));
  6001.             return e.start_date && (e.start_date = e.start_date.valueOf()), e.end_date && (e.end_date = e.end_date.valueOf()), e
  6002.         }
  6003.  
  6004.         function o(t, e) {
  6005.             for (var a = 0; a < n.config.columns.length; a++) {
  6006.                 var i = n.config.columns[a].template;
  6007.                 i && (e["_" + a] = i(t))
  6008.             }
  6009.             return e
  6010.         }
  6011.  
  6012.         function l(t) {
  6013.             for (var e = i(t), s = 0; s < a.length; s++) {
  6014.                 var r = n.templates[a[s]];
  6015.                 r && (e["$" + s] = r(t.start_date, t.end_date, t))
  6016.             }
  6017.             return o(t, e), e.open = t.$open, e
  6018.         }
  6019.  
  6020.         function d() {
  6021.             n.exportMode = !0;
  6022.             var t = n.serialize();
  6023.             return n.exportMode = !1, t
  6024.         }
  6025.         n.exportToPDF = function(e) {
  6026.             e = t(e || {}, {
  6027.                 name: "gantt.pdf",
  6028.                 data: this._serialize_all(),
  6029.                 config: this.config,
  6030.                 version: this.version
  6031.             }), this._send_to_export(e, "pdf")
  6032.         }, n.exportToPNG = function(e) {
  6033.             e = t(e || {}, {
  6034.                 name: "gantt.png",
  6035.                 data: this._serialize_all(),
  6036.                 config: this.config,
  6037.                 version: this.version
  6038.             }), this._send_to_export(e, "png")
  6039.         }, n.exportToICal = function(e) {
  6040.             e = t(e || {}, {
  6041.                 name: "gantt.ical",
  6042.                 data: this._serialize_plain().data,
  6043.                 version: this.version
  6044.             }), this._send_to_export(e, "ical")
  6045.         }, n.exportToExcel = function(e) {
  6046.             e = t(e || {}, {
  6047.                 name: "gantt.xlsx",
  6048.                 title: "Tasks",
  6049.                 data: this._serialize_table(!0).data,
  6050.                 columns: this._serialize_columns(),
  6051.                 version: this.version
  6052.             }), this._send_to_export(e, "excel")
  6053.         }, n.exportToMSProject = function(e) {
  6054.             e = t(e || {}, {
  6055.                 name: "gantt.xml",
  6056.                 data: this._msp_data(),
  6057.                 config: this.config,
  6058.                 columns: this._serialize_columns(),
  6059.                 version: this.version
  6060.             }), this._msp_config(e.config), this._send_to_export(e, "msproject")
  6061.         }, n.exportToJSON = function(e) {
  6062.             e = t(e || {}, {
  6063.                 name: "gantt.json",
  6064.                 data: this._serialize_all(),
  6065.                 config: this.config,
  6066.                 columns: this._serialize_columns(),
  6067.                 worktime: {
  6068.                     hours: this._working_time_helper.hours,
  6069.                     dates: this._working_time_helper.dates
  6070.                 },
  6071.                 version: this.version
  6072.             }), this._send_to_export(e, "json")
  6073.         }, n._msp_config = function(t) {
  6074.             if (t.project)
  6075.                 for (var e in t.project) t._custom_data || (t._custom_data = {}), t._custom_data[e] = t.project[e](this.config);
  6076.             if (t.tasks)
  6077.                 for (var a = 0; a < t.data.length; a++) {
  6078.                     var i = this.getTask(t.data[a].id);
  6079.                     i._custom_data || (i._custom_data = {});
  6080.                     for (var e in t.tasks) i._custom_data[e] = t.tasks[e](i, this.config)
  6081.                 }
  6082.             delete t.project, delete t.tasks, t.time = {
  6083.                 hours: n._working_time_helper.hours,
  6084.                 dates: n._working_time_helper.dates
  6085.             };
  6086.             var s = this.getSubtaskDates(),
  6087.                 r = this.date.date_to_str("%d-%m-%Y %H:%i:%s");
  6088.             t.start_end = {
  6089.                 start_date: r(s.start_date),
  6090.                 end_date: r(s.end_date)
  6091.             }
  6092.         }, n._msp_data = function() {
  6093.             var t = this.templates.xml_format;
  6094.             this.templates.xml_format = this.date.date_to_str("%d-%m-%Y %H:%i:%s");
  6095.             var e = this._serialize_all();
  6096.             return this.templates.xml_format = t, e
  6097.         }, n._ajax_to_export = function(t, e, n) {
  6098.             delete t.callback;
  6099.             var a = t.server || "https://export.dhtmlx.com/gantt";
  6100.             dhtmlxAjax.post(a, "type=" + e + "&store=1&data=" + encodeURIComponent(JSON.stringify(t)), function(t) {
  6101.                 var e = t.xmlDoc.status > 400,
  6102.                     a = null;
  6103.                 if (!e) try {
  6104.                     a = JSON.parse(t.xmlDoc.responseText)
  6105.                 } catch (i) {}
  6106.                 n(a)
  6107.             })
  6108.         }, n._send_to_export = function(t, a) {
  6109.             if (t.callback) return n._ajax_to_export(t, a, t.callback);
  6110.             t.config && e(t, a);
  6111.             var i = this._create_hidden_form();
  6112.             i.firstChild.action = t.server || "https://export.dhtmlx.com/gantt", i.firstChild.childNodes[0].value = JSON.stringify(t), i.firstChild.childNodes[1].value = a, i.firstChild.submit()
  6113.         }, n._create_hidden_form = function() {
  6114.             if (!this._hidden_export_form) {
  6115.                 var t = this._hidden_export_form = document.createElement("div");
  6116.                 t.style.display = "none", t.innerHTML = "<form method='POST' target='_blank'><input type='text' name='data'><input type='hidden' name='type' value=''></form>", document.body.appendChild(t)
  6117.             }
  6118.             return this._hidden_export_form
  6119.         };
  6120.         var _ = n.json._copyObject;
  6121.         n._serialize_all = function() {
  6122.             n.json._copyObject = l;
  6123.             var t = d();
  6124.             return n.json._copyObject = _, t
  6125.         }, n._serialize_plain = function() {
  6126.             var t = n.templates.xml_format;
  6127.             n.templates.xml_format = n.date.date_to_str("%Y%m%dT%H%i%s", !0), n.json._copyObject = s;
  6128.             var e = d();
  6129.             return n.templates.xml_format = t, n.json._copyObject = _, delete e.links, e
  6130.         }, n._serialize_table = function() {
  6131.             n.json._copyObject = r;
  6132.             var t = d();
  6133.             return n.json._copyObject = _, delete t.links, t
  6134.         }, n._serialize_columns = function() {
  6135.             n.exportMode = !0;
  6136.             for (var t = [], e = n.config.columns, a = 0; a < e.length; a++) "add" != e[a].name && (t[a] = {
  6137.                 id: e[a].template ? "_" + a : e[a].name,
  6138.                 header: e[a].label || n.locale.labels["column_" + e[a].name],
  6139.                 width: e[a].width ? Math.floor(e[a].width / 4) : ""
  6140.             }, "duration" == e[a].name && (t[a].type = "number"));
  6141.             return t.push({
  6142.                 id: "text",
  6143.                 header: ""
  6144.             }), n.exportMode = !1, t
  6145.         }
  6146.     }
  6147.     var a = ["leftside_text", "rightside_text", "task_text", "progress_text", "task_class"];
  6148.     n(gantt), window.Gantt && Gantt.plugin && Gantt.plugin(n)
  6149. }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement