@workiom/frappe-gantt 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second", H = "millisecond", c = {
1
+ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second", S = "millisecond", l = {
2
2
  parse_duration(r) {
3
3
  const e = /([0-9]+)(y|m|d|h|min|s|ms)/gm.exec(r);
4
4
  if (e !== null) {
@@ -22,27 +22,27 @@ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second"
22
22
  if (r instanceof Date)
23
23
  return r;
24
24
  if (typeof r == "string") {
25
- let i, s;
26
- const n = r.split(" ");
27
- i = n[0].split(t).map((a) => parseInt(a, 10)), s = n[1] && n[1].split(e), i[1] = i[1] ? i[1] - 1 : 0;
25
+ let i, n;
26
+ const s = r.split(" ");
27
+ i = s[0].split(t).map((a) => parseInt(a, 10)), n = s[1] && s[1].split(e), i[1] = i[1] ? i[1] - 1 : 0;
28
28
  let o = i;
29
- return s && s.length && (s.length === 4 && (s[3] = "0." + s[3], s[3] = parseFloat(s[3]) * 1e3), o = o.concat(s)), new Date(...o);
29
+ return n && n.length && (n.length === 4 && (n[3] = "0." + n[3], n[3] = parseFloat(n[3]) * 1e3), o = o.concat(n)), new Date(...o);
30
30
  }
31
31
  },
32
32
  to_string(r, t = !1) {
33
33
  if (!(r instanceof Date))
34
34
  throw new TypeError("Invalid argument type");
35
- const e = this.get_date_values(r).map((n, o) => (o === 1 && (n = n + 1), o === 6 ? v(n + "", 3, "0") : v(n + "", 2, "0"))), i = `${e[0]}-${e[1]}-${e[2]}`, s = `${e[3]}:${e[4]}:${e[5]}.${e[6]}`;
36
- return i + (t ? " " + s : "");
35
+ const e = this.get_date_values(r).map((s, o) => (o === 1 && (s = s + 1), o === 6 ? x(s + "", 3, "0") : x(s + "", 2, "0"))), i = `${e[0]}-${e[1]}-${e[2]}`, n = `${e[3]}:${e[4]}:${e[5]}.${e[6]}`;
36
+ return i + (t ? " " + n : "");
37
37
  },
38
38
  format(r, t = "YYYY-MM-DD HH:mm:ss.SSS", e = "en") {
39
39
  const i = new Intl.DateTimeFormat(e, {
40
40
  month: "long"
41
- }), s = new Intl.DateTimeFormat(e, {
41
+ }), n = new Intl.DateTimeFormat(e, {
42
42
  month: "short"
43
- }), n = i.format(r), o = n.charAt(0).toUpperCase() + n.slice(1), a = this.get_date_values(r).map((l) => v(l, 2, 0)), h = {
43
+ }), s = i.format(r), o = s.charAt(0).toUpperCase() + s.slice(1), a = this.get_date_values(r).map((c) => x(c, 2, 0)), h = {
44
44
  YYYY: a[0],
45
- MM: v(+a[1] + 1, 2, 0),
45
+ MM: x(+a[1] + 1, 2, 0),
46
46
  DD: a[2],
47
47
  HH: a[3],
48
48
  mm: a[4],
@@ -50,26 +50,26 @@ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second"
50
50
  SSS: a[6],
51
51
  D: a[2],
52
52
  MMMM: o,
53
- MMM: s.format(r)
53
+ MMM: n.format(r)
54
54
  };
55
55
  let d = t;
56
56
  const _ = [];
57
- return Object.keys(h).sort((l, p) => p.length - l.length).forEach((l) => {
58
- d.includes(l) && (d = d.replaceAll(l, `$${_.length}`), _.push(h[l]));
59
- }), _.forEach((l, p) => {
60
- d = d.replaceAll(`$${p}`, l);
57
+ return Object.keys(h).sort((c, g) => g.length - c.length).forEach((c) => {
58
+ d.includes(c) && (d = d.replaceAll(c, `$${_.length}`), _.push(h[c]));
59
+ }), _.forEach((c, g) => {
60
+ d = d.replaceAll(`$${g}`, c);
61
61
  }), d;
62
62
  },
63
63
  diff(r, t, e = "day") {
64
- let i, s, n, o, a, h, d;
65
- i = r - t + (t.getTimezoneOffset() - r.getTimezoneOffset()) * 6e4, s = i / 1e3, o = s / 60, n = o / 60, a = n / 24;
66
- let _ = r.getFullYear() - t.getFullYear(), l = r.getMonth() - t.getMonth();
67
- return l += a % 30 / 30, h = _ * 12 + l, r.getDate() < t.getDate() && h--, d = h / 12, e.endsWith("s") || (e += "s"), Math.round(
64
+ let i, n, s, o, a, h, d;
65
+ i = r - t + (t.getTimezoneOffset() - r.getTimezoneOffset()) * 6e4, n = i / 1e3, o = n / 60, s = o / 60, a = s / 24;
66
+ let _ = r.getFullYear() - t.getFullYear(), c = r.getMonth() - t.getMonth();
67
+ return c += a % 30 / 30, h = _ * 12 + c, r.getDate() < t.getDate() && h--, d = h / 12, e.endsWith("s") || (e += "s"), Math.round(
68
68
  {
69
69
  milliseconds: i,
70
- seconds: s,
70
+ seconds: n,
71
71
  minutes: o,
72
- hours: n,
72
+ hours: s,
73
73
  days: a,
74
74
  months: h,
75
75
  years: d
@@ -92,7 +92,7 @@ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second"
92
92
  r.getHours() + (e === T ? t : 0),
93
93
  r.getMinutes() + (e === Y ? t : 0),
94
94
  r.getSeconds() + (e === A ? t : 0),
95
- r.getMilliseconds() + (e === H ? t : 0)
95
+ r.getMilliseconds() + (e === S ? t : 0)
96
96
  ];
97
97
  return new Date(...i);
98
98
  },
@@ -104,13 +104,13 @@ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second"
104
104
  [T]: 3,
105
105
  [Y]: 2,
106
106
  [A]: 1,
107
- [H]: 0
107
+ [S]: 0
108
108
  };
109
- function i(n) {
109
+ function i(s) {
110
110
  const o = e[t];
111
- return e[n] <= o;
111
+ return e[s] <= o;
112
112
  }
113
- const s = [
113
+ const n = [
114
114
  r.getFullYear(),
115
115
  i(M) ? 0 : r.getMonth(),
116
116
  i(D) ? 1 : r.getDate(),
@@ -119,7 +119,7 @@ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second"
119
119
  i(Y) ? 0 : r.getSeconds(),
120
120
  i(A) ? 0 : r.getMilliseconds()
121
121
  ];
122
- return new Date(...s);
122
+ return new Date(...n);
123
123
  },
124
124
  clone(r) {
125
125
  return new Date(...this.get_date_values(r));
@@ -144,8 +144,8 @@ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second"
144
144
  day: 1,
145
145
  month: 30,
146
146
  year: 365
147
- }, { duration: i, scale: s } = this.parse_duration(r);
148
- return i * e[s] / e[t];
147
+ }, { duration: i, scale: n } = this.parse_duration(r);
148
+ return i * e[n] / e[t];
149
149
  },
150
150
  get_days_in_month(r) {
151
151
  const t = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], e = r.getMonth();
@@ -158,7 +158,7 @@ const M = "year", D = "month", L = "day", T = "hour", Y = "minute", A = "second"
158
158
  return r.getFullYear() % 4 ? 365 : 366;
159
159
  }
160
160
  };
161
- function v(r, t, e) {
161
+ function x(r, t, e) {
162
162
  return r = r + "", t = t >> 0, e = String(typeof e < "u" ? e : " "), r.length > t ? String(r) : (t = t - r.length, t > e.length && (e += e.repeat(t / e.length)), e.slice(0, t) + String(r));
163
163
  }
164
164
  function u(r, t) {
@@ -171,29 +171,29 @@ function f(r, t) {
171
171
  return e;
172
172
  }
173
173
  function E(r, t, e, i) {
174
- const s = z(r, t, e, i);
175
- if (s === r) {
176
- const n = document.createEvent("HTMLEvents");
177
- n.initEvent("click", !0, !0), n.eventName = "click", s.dispatchEvent(n);
174
+ const n = z(r, t, e, i);
175
+ if (n === r) {
176
+ const s = document.createEvent("HTMLEvents");
177
+ s.initEvent("click", !0, !0), s.eventName = "click", n.dispatchEvent(s);
178
178
  }
179
179
  }
180
- function z(r, t, e, i, s = "0.4s", n = "0.1s") {
180
+ function z(r, t, e, i, n = "0.4s", s = "0.1s") {
181
181
  const o = r.querySelector("animate");
182
182
  if (o)
183
183
  return u.attr(o, {
184
184
  attributeName: t,
185
185
  from: e,
186
186
  to: i,
187
- dur: s,
188
- begin: "click + " + n
187
+ dur: n,
188
+ begin: "click + " + s
189
189
  // artificial click
190
190
  }), r;
191
191
  const a = f("animate", {
192
192
  attributeName: t,
193
193
  from: e,
194
194
  to: i,
195
- dur: s,
196
- begin: n,
195
+ dur: n,
196
+ begin: s,
197
197
  calcMode: "spline",
198
198
  values: e + ";" + i,
199
199
  keyTimes: "0; 1",
@@ -222,9 +222,9 @@ u.bind = (r, t, e) => {
222
222
  });
223
223
  };
224
224
  u.delegate = (r, t, e, i) => {
225
- r.addEventListener(t, function(s) {
226
- const n = s.target.closest(e);
227
- n && (s.delegatedTarget = n, i.call(this, s, n));
225
+ r.addEventListener(t, function(n) {
226
+ const s = n.target.closest(e);
227
+ s && (n.delegatedTarget = s, i.call(this, n, s));
228
228
  });
229
229
  };
230
230
  u.closest = (r, t) => t ? t.matches(r) ? t : u.closest(r, t.parentNode) : null;
@@ -240,18 +240,35 @@ u.attr = (r, t, e) => {
240
240
  };
241
241
  class C {
242
242
  constructor(t, e, i) {
243
- this.gantt = t, this.from_task = e, this.to_task = i, this.is_critical = this.check_critical_path(), this.calculate_path(), this.draw();
243
+ this.gantt = t, this.from_task = e, this.to_task = i, this.is_critical = this.check_critical_path(), this.is_invalid = this.check_invalid_dependency(), this.calculate_path(), this.draw();
244
244
  }
245
245
  check_critical_path() {
246
246
  return this.gantt.options.critical_path ? this.from_task.task._is_critical === !0 && this.to_task.task._is_critical === !0 : !1;
247
247
  }
248
+ check_invalid_dependency() {
249
+ const t = this.to_task.task.dependencies_type || this.gantt.options.dependencies_type;
250
+ if (t === "fixed")
251
+ return this.to_task.$bar.getX() < this.from_task.$bar.getX();
252
+ const e = this.from_task.task, i = this.to_task.task;
253
+ switch (t) {
254
+ case "finish-to-start":
255
+ return i._start < e._end;
256
+ case "start-to-start":
257
+ return i._start < e._start;
258
+ case "finish-to-finish":
259
+ return i._end < e._end;
260
+ case "start-to-finish":
261
+ return i._end < e._start;
262
+ }
263
+ return !1;
264
+ }
248
265
  calculate_path() {
249
266
  let t = this.from_task.$bar.getX() + this.from_task.$bar.getWidth() / 2;
250
267
  const e = () => this.to_task.$bar.getX() < t + this.gantt.options.padding && t > this.from_task.$bar.getX() + this.gantt.options.padding;
251
268
  for (; e(); )
252
269
  t -= 10;
253
270
  t -= 10;
254
- let i = this.gantt.config.header_height + this.gantt.options.bar_height + (this.gantt.options.padding + this.gantt.options.bar_height) * this.from_task.task._index + this.gantt.options.padding / 2, s = this.to_task.$bar.getX() - 13, n = this.gantt.config.header_height + this.gantt.options.bar_height / 2 + (this.gantt.options.padding + this.gantt.options.bar_height) * this.to_task.task._index + this.gantt.options.padding / 2;
271
+ let i = this.gantt.config.header_height + this.gantt.options.bar_height + (this.gantt.options.padding + this.gantt.options.bar_height) * this.from_task.task._index + this.gantt.options.padding / 2, n = this.to_task.$bar.getX() - 13, s = this.gantt.config.header_height + this.gantt.options.bar_height / 2 + (this.gantt.options.padding + this.gantt.options.bar_height) * this.to_task.task._index + this.gantt.options.padding / 2;
255
272
  const o = this.from_task.task._index > this.to_task.task._index;
256
273
  let a = this.gantt.options.arrow_curve;
257
274
  const h = o ? 1 : 0;
@@ -259,42 +276,45 @@ class C {
259
276
  if (this.to_task.$bar.getX() <= this.from_task.$bar.getX() + this.gantt.options.padding) {
260
277
  let _ = this.gantt.options.padding / 2 - a;
261
278
  _ < 0 && (_ = 0, a = this.gantt.options.padding / 2, d = o ? -a : a);
262
- const l = this.to_task.$bar.getY() + this.to_task.$bar.getHeight() / 2 - d, p = this.to_task.$bar.getX() - this.gantt.options.padding;
279
+ const c = this.to_task.$bar.getY() + this.to_task.$bar.getHeight() / 2 - d, g = this.to_task.$bar.getX() - this.gantt.options.padding;
263
280
  this.path = `
264
281
  M ${t} ${i}
265
282
  v ${_}
266
283
  a ${a} ${a} 0 0 1 ${-a} ${a}
267
- H ${p}
284
+ H ${g}
268
285
  a ${a} ${a} 0 0 ${h} ${-a} ${d}
269
- V ${l}
286
+ V ${c}
270
287
  a ${a} ${a} 0 0 ${h} ${a} ${d}
271
- L ${s} ${n}
288
+ L ${n} ${s}
272
289
  m -5 -5
273
290
  l 5 5
274
291
  l -5 5`;
275
292
  } else {
276
- s < t + a && (a = s - t);
277
- let _ = o ? n + a : n - a;
293
+ n < t + a && (a = n - t);
294
+ let _ = o ? s + a : s - a;
278
295
  this.path = `
279
296
  M ${t} ${i}
280
297
  V ${_}
281
298
  a ${a} ${a} 0 0 ${h} ${a} ${a}
282
- L ${s} ${n}
299
+ L ${n} ${s}
283
300
  m -5 -5
284
301
  l 5 5
285
302
  l -5 5`;
286
303
  }
287
304
  }
288
305
  draw() {
289
- this.element = f("path", {
306
+ let t = "";
307
+ this.is_invalid ? t = "arrow-invalid" : this.is_critical && (t = "arrow-critical"), this.element = f("path", {
290
308
  d: this.path,
291
309
  "data-from": this.from_task.task.id,
292
310
  "data-to": this.to_task.task.id,
293
- class: this.is_critical ? "arrow-critical" : ""
311
+ class: t
294
312
  });
295
313
  }
296
314
  update() {
297
- this.calculate_path(), this.element.setAttribute("d", this.path);
315
+ this.calculate_path(), this.element.setAttribute("d", this.path), this.is_invalid = this.check_invalid_dependency();
316
+ let t = "";
317
+ this.is_invalid ? t = "arrow-invalid" : this.is_critical && (t = "arrow-critical"), this.element.setAttribute("class", t);
298
318
  }
299
319
  }
300
320
  class q {
@@ -302,7 +322,7 @@ class q {
302
322
  this.set_defaults(t, e), this.prepare_wrappers(), this.prepare_helpers(), this.refresh();
303
323
  }
304
324
  refresh() {
305
- this.bar_group.innerHTML = "", this.handle_group.innerHTML = "", this.task.custom_class ? this.group.classList.add(this.task.custom_class) : this.group.classList = ["bar-wrapper"], this.prepare_values(), this.draw(), this.bind();
325
+ this.bar_group.innerHTML = "", this.handle_group.innerHTML = "", this.task.custom_class ? this.group.classList.add(this.task.custom_class) : this.group.classList = ["bar-wrapper"], this.unbind(), this.prepare_values(), this.draw(), this.bind();
306
326
  }
307
327
  set_defaults(t, e) {
308
328
  this.action_completed = !1, this.gantt = t, this.task = e, this.name = this.name || "", this.is_dragging = !1, this.is_hovering_bar = !1, this.is_hovering_icon = !1, this.add_icon_hide_timeout = null;
@@ -384,11 +404,12 @@ class q {
384
404
  class: "bar-progress",
385
405
  append_to: this.bar_group
386
406
  }), this.task.color_progress && (this.$bar_progress.style.fill = this.task.color_progress);
387
- const e = c.diff(
407
+ const e = l.diff(
388
408
  this.task._start,
389
409
  this.gantt.gantt_start,
390
410
  this.gantt.config.unit
391
411
  ) / this.gantt.config.step * this.gantt.config.column_width;
412
+ this.$date_highlight && this.$date_highlight.parentNode && this.$date_highlight.parentNode.removeChild(this.$date_highlight);
392
413
  let i = this.gantt.create_el({
393
414
  classes: `date-range-highlight hide highlight-${this.task.id}`,
394
415
  width: this.width,
@@ -398,17 +419,17 @@ class q {
398
419
  }
399
420
  calculate_progress_width() {
400
421
  const t = this.$bar.getWidth(), e = this.x + t, i = this.gantt.config.ignored_positions.reduce((h, d) => h + (d >= this.x && d < e), 0) * this.gantt.config.column_width;
401
- let s = (t - i) * this.task.progress / 100;
402
- const n = this.x + s, o = this.gantt.config.ignored_positions.reduce((h, d) => h + (d >= this.x && d < n), 0) * this.gantt.config.column_width;
403
- s += o;
422
+ let n = (t - i) * this.task.progress / 100;
423
+ const s = this.x + n, o = this.gantt.config.ignored_positions.reduce((h, d) => h + (d >= this.x && d < s), 0) * this.gantt.config.column_width;
424
+ n += o;
404
425
  let a = this.gantt.get_ignored_region(
405
- this.x + s
426
+ this.x + n
406
427
  );
407
428
  for (; a.length; )
408
- s += this.gantt.config.column_width, a = this.gantt.get_ignored_region(
409
- this.x + s
429
+ n += this.gantt.config.column_width, a = this.gantt.get_ignored_region(
430
+ this.x + n
410
431
  );
411
- return this.progress_width = s, s;
432
+ return this.progress_width = n, n;
412
433
  }
413
434
  draw_label() {
414
435
  let t = this.x + this.$bar.getWidth() / 2;
@@ -421,7 +442,7 @@ class q {
421
442
  }), this.task.color_text && (this.$bar_label.style.fill = this.task.color_text), requestAnimationFrame(() => this.update_label_position());
422
443
  }
423
444
  draw_thumbnail() {
424
- let t = 10, e = 2, i, s;
445
+ let t = 10, e = 2, i, n;
425
446
  i = f("defs", {
426
447
  append_to: this.bar_group
427
448
  }), f("rect", {
@@ -433,12 +454,12 @@ class q {
433
454
  rx: "15",
434
455
  class: "img_mask",
435
456
  append_to: i
436
- }), s = f("clipPath", {
457
+ }), n = f("clipPath", {
437
458
  id: "clip_" + this.task.id,
438
459
  append_to: i
439
460
  }), f("use", {
440
461
  href: "#rect_" + this.task.id,
441
- append_to: s
462
+ append_to: n
442
463
  }), f("image", {
443
464
  x: this.x + t,
444
465
  y: this.y + e,
@@ -459,51 +480,51 @@ class q {
459
480
  i = this.x + this.$bar.getWidth() + 5;
460
481
  else
461
482
  return;
462
- const s = this.y + (this.height - 20) / 2;
483
+ const n = this.y + (this.height - 20) / 2;
463
484
  this.$add_icon_group = f("g", {
464
485
  class: "add-task-icon hide",
465
486
  append_to: this.handle_group
466
487
  }), this.$add_icon_circle = f("circle", {
467
488
  cx: i + 20 / 2,
468
- cy: s + 20 / 2,
489
+ cy: n + 20 / 2,
469
490
  r: 20 / 2,
470
491
  class: "add-task-icon-bg",
471
492
  append_to: this.$add_icon_group
472
493
  }), this.$add_icon_vertical = f("line", {
473
494
  x1: i + 20 / 2,
474
- y1: s + 5,
495
+ y1: n + 5,
475
496
  x2: i + 20 / 2,
476
- y2: s + 20 - 5,
497
+ y2: n + 20 - 5,
477
498
  class: "add-task-icon-plus",
478
499
  append_to: this.$add_icon_group
479
500
  }), this.$add_icon_horizontal = f("line", {
480
501
  x1: i + 5,
481
- y1: s + 20 / 2,
502
+ y1: n + 20 / 2,
482
503
  x2: i + 20 - 5,
483
- y2: s + 20 / 2,
504
+ y2: n + 20 / 2,
484
505
  class: "add-task-icon-plus",
485
506
  append_to: this.$add_icon_group
486
- }), u.on(this.$add_icon_group, "mousedown", (n) => {
487
- n.stopPropagation();
488
- }), u.on(this.$add_icon_group, "mouseup", (n) => {
489
- n.stopPropagation();
490
- }), u.on(this.$add_icon_group, "click", (n) => {
491
- n.stopPropagation(), this.gantt.trigger_event("task_add", [this.task]);
492
- }), u.on(this.$add_icon_group, "mouseenter", (n) => {
493
- this.is_hovering_icon = !0, this.add_icon_hide_timeout && (clearTimeout(this.add_icon_hide_timeout), this.add_icon_hide_timeout = null), this.$add_icon_group.classList.add("active"), this.$add_icon_group.classList.remove("hide"), n.stopPropagation();
507
+ }), u.on(this.$add_icon_group, "mousedown", (s) => {
508
+ s.stopPropagation();
509
+ }), u.on(this.$add_icon_group, "mouseup", (s) => {
510
+ s.stopPropagation();
511
+ }), u.on(this.$add_icon_group, "click", (s) => {
512
+ s.stopPropagation(), this.gantt.trigger_event("task_add", [this.task]);
513
+ }), u.on(this.$add_icon_group, "mouseenter", (s) => {
514
+ this.is_hovering_icon = !0, this.add_icon_hide_timeout && (clearTimeout(this.add_icon_hide_timeout), this.add_icon_hide_timeout = null), this.$add_icon_group.classList.add("active"), this.$add_icon_group.classList.remove("hide"), s.stopPropagation();
494
515
  }), u.on(this.$add_icon_group, "mouseleave", () => {
495
516
  this.is_hovering_icon = !1, this.$add_icon_group.classList.remove("active"), this.is_hovering_bar || this.$add_icon_group.classList.add("hide");
496
517
  });
497
518
  }
498
519
  draw_resize_handles() {
499
520
  if (this.invalid || this.gantt.options.readonly) return;
500
- const t = this.$bar, e = 3;
521
+ const t = this.$bar, e = 8;
501
522
  if (this.handles = [], this.gantt.options.readonly_dates || (this.handles.push(
502
523
  f("rect", {
503
- x: t.getEndX() - e / 2,
504
- y: t.getY() + this.height / 4,
524
+ x: t.getEndX() - e,
525
+ y: t.getY() + (this.height - this.height * 0.8) / 2,
505
526
  width: e,
506
- height: this.height / 2,
527
+ height: this.height * 0.8,
507
528
  rx: 2,
508
529
  ry: 2,
509
530
  class: "handle right",
@@ -511,10 +532,10 @@ class q {
511
532
  })
512
533
  ), this.handles.push(
513
534
  f("rect", {
514
- x: t.getX() - e / 2,
515
- y: t.getY() + this.height / 4,
535
+ x: t.getX() - e,
536
+ y: t.getY() + (this.height - this.height * 0.8) / 2,
516
537
  width: e,
517
- height: this.height / 2,
538
+ height: this.height * 0.8,
518
539
  rx: 2,
519
540
  ry: 2,
520
541
  class: "handle left",
@@ -536,104 +557,121 @@ class q {
536
557
  bind() {
537
558
  this.invalid || this.setup_click_event();
538
559
  }
560
+ unbind() {
561
+ this.invalid || this.group && this.event_listeners && (this.event_listeners.forEach(({ event: t, handler: e }) => {
562
+ u.off(this.group, t, e);
563
+ }), this.event_listeners = []);
564
+ }
539
565
  setup_click_event() {
566
+ this.event_listeners = [];
540
567
  let t = this.task.id;
541
- u.on(this.group, "mouseover", (s) => {
568
+ const e = (g) => {
542
569
  this.gantt.trigger_event("hover", [
543
570
  this.task,
544
- s.screenX,
545
- s.screenY,
546
- s
571
+ g.screenX,
572
+ g.screenY,
573
+ g
547
574
  ]);
548
- }), this.gantt.options.popup_on === "click" && u.on(this.group, "mouseup", (s) => {
549
- const n = s.offsetX || s.layerX;
550
- if (this.$handle_progress) {
551
- const o = +this.$handle_progress.getAttribute("cx");
552
- if (o > n - 1 && o < n + 1 || this.gantt.bar_being_dragged) return;
553
- }
554
- this.gantt.show_popup({
555
- x: s.offsetX || s.layerX,
556
- y: s.offsetY || s.layerY,
557
- task: this.task,
558
- target: this.$bar
559
- });
560
- });
561
- let e;
562
- u.on(this.group, "mouseenter", (s) => {
563
- e = setTimeout(() => {
575
+ };
576
+ if (u.on(this.group, "mouseover", e), this.event_listeners.push({ event: "mouseover", handler: e }), this.gantt.options.popup_on === "click") {
577
+ const g = (p) => {
578
+ const w = p.offsetX || p.layerX;
579
+ if (this.$handle_progress) {
580
+ const m = +this.$handle_progress.getAttribute("cx");
581
+ if (m > w - 1 && m < w + 1 || this.gantt.bar_being_dragged) return;
582
+ }
583
+ this.gantt.show_popup({
584
+ x: p.offsetX || p.layerX,
585
+ y: p.offsetY || p.layerY,
586
+ task: this.task,
587
+ target: this.$bar
588
+ });
589
+ };
590
+ u.on(this.group, "click", g), this.event_listeners.push({ event: "click", handler: g });
591
+ }
592
+ let i;
593
+ const n = (g) => {
594
+ i = setTimeout(() => {
564
595
  this.gantt.options.popup_on === "hover" && this.gantt.show_popup({
565
- x: s.offsetX || s.layerX,
566
- y: s.offsetY || s.layerY,
596
+ x: g.offsetX || g.layerX,
597
+ y: g.offsetY || g.layerY,
567
598
  task: this.task,
568
599
  target: this.$bar
569
600
  }), this.gantt.$container.querySelector(`.highlight-${t}`).classList.remove("hide");
570
601
  }, 200), this.$add_icon_group && (this.is_hovering_bar = !0, this.add_icon_hide_timeout && (clearTimeout(this.add_icon_hide_timeout), this.add_icon_hide_timeout = null), this.is_dragging || this.$add_icon_group.classList.remove("hide"));
571
- }), u.on(this.group, "mouseleave", () => {
572
- var s, n;
573
- clearTimeout(e), this.gantt.options.popup_on === "hover" && ((n = (s = this.gantt.popup) == null ? void 0 : s.hide) == null || n.call(s)), this.gantt.$container.querySelector(`.highlight-${t}`).classList.add("hide"), this.$add_icon_group && (this.is_hovering_bar = !1, this.add_icon_hide_timeout && clearTimeout(this.add_icon_hide_timeout), this.add_icon_hide_timeout = setTimeout(() => {
602
+ };
603
+ u.on(this.group, "mouseenter", n), this.event_listeners.push({ event: "mouseenter", handler: n });
604
+ const s = () => {
605
+ var g, p;
606
+ clearTimeout(i), this.gantt.options.popup_on === "hover" && ((p = (g = this.gantt.popup) == null ? void 0 : g.hide) == null || p.call(g)), this.gantt.$container.querySelector(`.highlight-${t}`).classList.add("hide"), this.$add_icon_group && (this.is_hovering_bar = !1, this.add_icon_hide_timeout && clearTimeout(this.add_icon_hide_timeout), this.add_icon_hide_timeout = setTimeout(() => {
574
607
  this.is_hovering_icon || this.$add_icon_group.classList.add("hide");
575
608
  }, 200));
576
- }), u.on(this.group, "mousedown", () => {
609
+ };
610
+ u.on(this.group, "mouseleave", s), this.event_listeners.push({ event: "mouseleave", handler: s });
611
+ const o = () => {
577
612
  this.is_dragging = !0, this.hide_add_icon();
578
- }), u.on(this.group, "mouseup", () => {
613
+ };
614
+ u.on(this.group, "mousedown", o), this.event_listeners.push({ event: "mousedown", handler: o });
615
+ const a = () => {
579
616
  setTimeout(() => {
580
617
  this.gantt.bar_being_dragged !== !0 && (this.is_dragging = !1, this.$add_icon_group && this.is_hovering_bar && this.$add_icon_group.classList.remove("hide"));
581
618
  }, 0);
582
- }), u.on(this.group, "click", () => {
619
+ };
620
+ u.on(this.group, "mouseup", a), this.event_listeners.push({ event: "mouseup", handler: a });
621
+ const h = () => {
583
622
  this.action_completed || this.gantt.bar_being_dragged || this.gantt.trigger_event("click", [this.task]);
584
- }), u.on(this.group, "dblclick", (s) => {
623
+ };
624
+ u.on(this.group, "click", h), this.event_listeners.push({ event: "click", handler: h });
625
+ const d = () => {
585
626
  this.action_completed || (this.group.classList.remove("active"), this.gantt.popup && this.gantt.popup.parent.classList.remove("hide"), this.gantt.trigger_event("double_click", [this.task]));
586
- });
587
- let i = !1;
588
- u.on(this.group, "touchstart", (s) => {
589
- if (!i)
590
- return i = !0, setTimeout(function() {
591
- i = !1;
627
+ };
628
+ u.on(this.group, "dblclick", d), this.event_listeners.push({ event: "dblclick", handler: d });
629
+ let _ = !1;
630
+ const c = (g) => {
631
+ if (!_)
632
+ return _ = !0, setTimeout(function() {
633
+ _ = !1;
592
634
  }, 300), !1;
593
- s.preventDefault(), !this.action_completed && (this.group.classList.remove("active"), this.gantt.popup && this.gantt.popup.parent.classList.remove("hide"), this.gantt.trigger_event("double_click", [this.task]));
594
- });
635
+ g.preventDefault(), !this.action_completed && (this.group.classList.remove("active"), this.gantt.popup && this.gantt.popup.parent.classList.remove("hide"), this.gantt.trigger_event("double_click", [this.task]));
636
+ };
637
+ u.on(this.group, "touchstart", c), this.event_listeners.push({ event: "touchstart", handler: c });
595
638
  }
596
639
  update_bar_position({ x: t = null, width: e = null }) {
597
640
  const i = this.$bar;
598
- if (t) {
599
- if (!this.validate_dependency_constraints(t, e))
600
- return;
601
- this.update_attr(i, "x", t), this.x = t, this.$date_highlight.style.left = t + "px";
602
- }
603
- e > 0 && (this.update_attr(i, "width", e), this.$date_highlight.style.width = e + "px"), this.update_label_position(), this.update_handle_position(), this.update_add_icon_position(), this.date_changed(), this.compute_duration(), this.gantt.options.show_expected_progress && this.update_expected_progressbar_position(), this.update_progressbar_position(), this.update_arrow_position();
641
+ t && (this.update_attr(i, "x", t), this.x = t, this.$date_highlight.style.left = t + "px"), e > 0 && (this.update_attr(i, "width", e), this.$date_highlight.style.width = e + "px"), this.update_label_position(), this.update_handle_position(), this.update_add_icon_position(), this.date_changed(), this.compute_duration(), this.gantt.options.show_expected_progress && this.update_expected_progressbar_position(), this.update_progressbar_position(), this.update_arrow_position();
604
642
  }
605
643
  validate_dependency_constraints(t, e = null) {
606
644
  const i = this.task.dependencies_type || this.gantt.options.dependencies_type;
607
645
  if (i === "fixed")
608
- return this.task.dependencies.map((_) => this.gantt.get_bar(_).$bar.getX()).reduce((_, l) => _ && t >= l, !0);
609
- const s = t / this.gantt.config.column_width, n = c.add(
646
+ return this.task.dependencies.map((_) => this.gantt.get_bar(_).$bar.getX()).reduce((_, c) => _ && t >= c, !0);
647
+ const n = t / this.gantt.config.column_width, s = l.add(
610
648
  this.gantt.gantt_start,
611
- s * this.gantt.config.step,
649
+ n * this.gantt.config.step,
612
650
  this.gantt.config.unit
613
- ), a = (e || this.$bar.getWidth()) / this.gantt.config.column_width, h = c.add(
614
- n,
651
+ ), a = (e || this.$bar.getWidth()) / this.gantt.config.column_width, h = l.add(
652
+ s,
615
653
  a * this.gantt.config.step,
616
654
  this.gantt.config.unit
617
655
  );
618
656
  for (const d of this.task.dependencies) {
619
657
  const _ = this.gantt.get_bar(d);
620
658
  if (!_) continue;
621
- const l = _.task;
659
+ const c = _.task;
622
660
  switch (i) {
623
661
  case "finish-to-start":
624
- if (n < l._end)
662
+ if (s < c._end)
625
663
  return !1;
626
664
  break;
627
665
  case "start-to-start":
628
- if (n < l._start)
666
+ if (s < c._start)
629
667
  return !1;
630
668
  break;
631
669
  case "finish-to-finish":
632
- if (h < l._end)
670
+ if (h < c._end)
633
671
  return !1;
634
672
  break;
635
673
  case "start-to-finish":
636
- if (h < l._start)
674
+ if (h < c._start)
637
675
  return !1;
638
676
  break;
639
677
  }
@@ -641,9 +679,9 @@ class q {
641
679
  return !0;
642
680
  }
643
681
  update_label_position_on_horizontal_scroll({ x: t, sx: e }) {
644
- const i = this.gantt.$container, s = this.group.querySelector(".bar-label"), n = this.group.querySelector(".bar-img") || "", o = this.bar_group.querySelector(".img_mask") || "";
645
- let a = this.$bar.getX() + this.$bar.getWidth(), h = s.getX() + t, d = n && n.getX() + t || 0, _ = n && n.getBBox().width + 7 || 7, l = h + s.getBBox().width + 7, p = e + i.clientWidth / 2;
646
- s.classList.contains("big") || (l < a && t > 0 && l < p || h - _ > this.$bar.getX() && t < 0 && l > p) && (s.setAttribute("x", h), n && (n.setAttribute("x", d), o.setAttribute("x", d)));
682
+ const i = this.gantt.$container, n = this.group.querySelector(".bar-label"), s = this.group.querySelector(".bar-img") || "", o = this.bar_group.querySelector(".img_mask") || "";
683
+ let a = this.$bar.getX() + this.$bar.getWidth(), h = n.getX() + t, d = s && s.getX() + t || 0, _ = s && s.getBBox().width + 7 || 7, c = h + n.getBBox().width + 7, g = e + i.clientWidth / 2;
684
+ n.classList.contains("big") || (c < a && t > 0 && c < g || h - _ > this.$bar.getX() && t < 0 && c > g) && (n.setAttribute("x", h), s && (s.setAttribute("x", d), o.setAttribute("x", d)));
647
685
  }
648
686
  date_changed() {
649
687
  let t = !1;
@@ -651,7 +689,7 @@ class q {
651
689
  Number(this.task._start) !== Number(e) && (t = !0, this.task._start = e), Number(this.task._end) !== Number(i) && (t = !0, this.task._end = i), t && this.gantt.trigger_event("date_change", [
652
690
  this.task,
653
691
  e,
654
- c.add(i, -1, "second")
692
+ l.add(i, -1, "second")
655
693
  ]);
656
694
  }
657
695
  progress_changed() {
@@ -661,36 +699,36 @@ class q {
661
699
  ]);
662
700
  }
663
701
  set_action_completed() {
664
- this.action_completed = !0, setTimeout(() => this.action_completed = !1, 1e3), this.is_dragging = !1, this.$add_icon_group && this.is_hovering_bar && this.$add_icon_group.classList.remove("hide");
702
+ this.action_completed = !0, setTimeout(() => this.action_completed = !1, 10), this.is_dragging = !1, this.$add_icon_group && this.is_hovering_bar && this.$add_icon_group.classList.remove("hide");
665
703
  }
666
704
  compute_start_end_date() {
667
705
  const t = this.$bar, e = t.getX() / this.gantt.config.column_width;
668
- let i = c.add(
706
+ let i = l.add(
669
707
  this.gantt.gantt_start,
670
708
  e * this.gantt.config.step,
671
709
  this.gantt.config.unit
672
710
  );
673
- const s = t.getWidth() / this.gantt.config.column_width, n = c.add(
711
+ const n = t.getWidth() / this.gantt.config.column_width, s = l.add(
674
712
  i,
675
- s * this.gantt.config.step,
713
+ n * this.gantt.config.step,
676
714
  this.gantt.config.unit
677
715
  );
678
- return { new_start_date: i, new_end_date: n };
716
+ return { new_start_date: i, new_end_date: s };
679
717
  }
680
718
  compute_progress() {
681
719
  this.progress_width = this.$bar_progress.getWidth(), this.x = this.$bar_progress.getBBox().x;
682
- const t = this.x + this.progress_width, e = this.progress_width - this.gantt.config.ignored_positions.reduce((s, n) => s + (n >= this.x && n <= t), 0) * this.gantt.config.column_width;
720
+ const t = this.x + this.progress_width, e = this.progress_width - this.gantt.config.ignored_positions.reduce((n, s) => n + (s >= this.x && s <= t), 0) * this.gantt.config.column_width;
683
721
  if (e < 0) return 0;
684
722
  const i = this.$bar.getWidth() - this.ignored_duration_raw * this.gantt.config.column_width;
685
723
  return parseInt(e / i * 100, 10);
686
724
  }
687
725
  compute_expected_progress() {
688
- this.expected_progress = c.diff(c.today(), this.task._start, "hour") / this.gantt.config.step, this.expected_progress = (this.expected_progress < this.duration ? this.expected_progress : this.duration) * 100 / this.duration;
726
+ this.expected_progress = l.diff(l.today(), this.task._start, "hour") / this.gantt.config.step, this.expected_progress = (this.expected_progress < this.duration ? this.expected_progress : this.duration) * 100 / this.duration;
689
727
  }
690
728
  compute_x() {
691
729
  const { column_width: t } = this.gantt.config, e = this.task._start, i = this.gantt.gantt_start;
692
- let n = c.diff(e, i, this.gantt.config.unit) / this.gantt.config.step * t;
693
- this.x = n;
730
+ let s = l.diff(e, i, this.gantt.config.unit) / this.gantt.config.step * t;
731
+ this.x = s;
694
732
  }
695
733
  compute_y() {
696
734
  this.y = this.gantt.config.header_height + this.gantt.options.padding / 2 + this.task._index * (this.height + this.gantt.options.padding);
@@ -699,12 +737,12 @@ class q {
699
737
  let t = 0, e = 0;
700
738
  for (let i = new Date(this.task._start); i < this.task._end; i.setDate(i.getDate() + 1))
701
739
  e++, !this.gantt.config.ignored_dates.find(
702
- (s) => s.getTime() === i.getTime()
740
+ (n) => n.getTime() === i.getTime()
703
741
  ) && (!this.gantt.config.ignored_function || !this.gantt.config.ignored_function(i)) && t++;
704
- this.task.actual_duration = t, this.task.ignored_duration = e - t, this.duration = c.convert_scales(
742
+ this.task.actual_duration = t, this.task.ignored_duration = e - t, this.duration = l.convert_scales(
705
743
  e + "d",
706
744
  this.gantt.config.unit
707
- ) / this.gantt.config.step, this.actual_duration_raw = c.convert_scales(
745
+ ) / this.gantt.config.step, this.actual_duration_raw = l.convert_scales(
708
746
  t + "d",
709
747
  this.gantt.config.unit
710
748
  ) / this.gantt.config.step, this.ignored_duration_raw = this.duration - this.actual_duration_raw;
@@ -725,10 +763,10 @@ class q {
725
763
  ));
726
764
  }
727
765
  update_label_position() {
728
- const t = this.bar_group.querySelector(".img_mask") || "", e = this.$bar, i = this.group.querySelector(".bar-label"), s = this.group.querySelector(".bar-img");
729
- let n = 5, o = this.image_size + 10;
766
+ const t = this.bar_group.querySelector(".img_mask") || "", e = this.$bar, i = this.group.querySelector(".bar-label"), n = this.group.querySelector(".bar-img");
767
+ let s = 5, o = this.image_size + 10;
730
768
  const a = i.getBBox().width, h = e.getWidth();
731
- a > h ? (i.classList.add("big"), s ? (s.setAttribute("x", e.getEndX() + n), t.setAttribute("x", e.getEndX() + n), i.setAttribute("x", e.getEndX() + o)) : i.setAttribute("x", e.getEndX() + n)) : (i.classList.remove("big"), s ? (s.setAttribute("x", e.getX() + n), t.setAttribute("x", e.getX() + n), i.setAttribute(
769
+ a > h ? (i.classList.add("big"), n ? (n.setAttribute("x", e.getEndX() + s), t.setAttribute("x", e.getEndX() + s), i.setAttribute("x", e.getEndX() + o)) : i.setAttribute("x", e.getEndX() + s)) : (i.classList.remove("big"), n ? (n.setAttribute("x", e.getX() + s), t.setAttribute("x", e.getX() + s), i.setAttribute(
732
770
  "x",
733
771
  e.getX() + h / 2 + o
734
772
  )) : i.setAttribute(
@@ -753,8 +791,8 @@ class q {
753
791
  i = this.x + this.$bar.getWidth() + e;
754
792
  else
755
793
  return;
756
- const s = this.y + (this.height - t) / 2;
757
- this.$add_icon_circle.setAttribute("cx", i + t / 2), this.$add_icon_circle.setAttribute("cy", s + t / 2), this.$add_icon_vertical.setAttribute("x1", i + t / 2), this.$add_icon_vertical.setAttribute("y1", s + 5), this.$add_icon_vertical.setAttribute("x2", i + t / 2), this.$add_icon_vertical.setAttribute("y2", s + t - 5), this.$add_icon_horizontal.setAttribute("x1", i + 5), this.$add_icon_horizontal.setAttribute("y1", s + t / 2), this.$add_icon_horizontal.setAttribute("x2", i + t - 5), this.$add_icon_horizontal.setAttribute("y2", s + t / 2);
794
+ const n = this.y + (this.height - t) / 2;
795
+ this.$add_icon_circle.setAttribute("cx", i + t / 2), this.$add_icon_circle.setAttribute("cy", n + t / 2), this.$add_icon_vertical.setAttribute("x1", i + t / 2), this.$add_icon_vertical.setAttribute("y1", n + 5), this.$add_icon_vertical.setAttribute("x2", i + t / 2), this.$add_icon_vertical.setAttribute("y2", n + t - 5), this.$add_icon_horizontal.setAttribute("x1", i + 5), this.$add_icon_horizontal.setAttribute("y1", n + t / 2), this.$add_icon_horizontal.setAttribute("x2", i + t - 5), this.$add_icon_horizontal.setAttribute("y2", n + t / 2);
758
796
  }
759
797
  hide_add_icon() {
760
798
  this.$add_icon_group && this.$add_icon_group.classList.add("hide");
@@ -777,9 +815,9 @@ class F {
777
815
  <div class="actions"></div>
778
816
  `, this.hide(), this.title = this.parent.querySelector(".title"), this.subtitle = this.parent.querySelector(".subtitle"), this.details = this.parent.querySelector(".details"), this.actions = this.parent.querySelector(".actions");
779
817
  }
780
- show({ x: t, y: e, task: i, target: s }) {
818
+ show({ x: t, y: e, task: i, target: n }) {
781
819
  this.actions.innerHTML = "";
782
- let n = this.popup_func({
820
+ let s = this.popup_func({
783
821
  task: i,
784
822
  chart: this.gantt,
785
823
  get_title: () => this.title,
@@ -797,28 +835,28 @@ class F {
797
835
  typeof o == "function" && (o = o(i)), h.innerHTML = o, h.onclick = (d) => a(i, this.gantt, d);
798
836
  }
799
837
  });
800
- n !== !1 && (n && (this.parent.innerHTML = n), this.actions.innerHTML === "" ? this.actions.remove() : this.parent.appendChild(this.actions), this.parent.style.left = t + 10 + "px", this.parent.style.top = e - 10 + "px", this.parent.classList.remove("hide"));
838
+ s !== !1 && (s && (this.parent.innerHTML = s), this.actions.innerHTML === "" ? this.actions.remove() : this.parent.appendChild(this.actions), this.parent.style.left = t + 10 + "px", this.parent.style.top = e - 10 + "px", this.parent.classList.remove("hide"));
801
839
  }
802
840
  hide() {
803
841
  this.parent.classList.add("hide");
804
842
  }
805
843
  }
806
- function S(r) {
844
+ function H(r) {
807
845
  const t = r.getFullYear();
808
846
  return t - t % 10 + "";
809
847
  }
810
848
  function O(r, t, e) {
811
- let i = c.add(r, 6, "day"), s = i.getMonth() !== r.getMonth() ? "D MMM" : "D", n = !t || r.getMonth() !== t.getMonth() ? "D MMM" : "D";
812
- return `${c.format(r, n, e)} - ${c.format(i, s, e)}`;
849
+ let i = l.add(r, 6, "day"), n = i.getMonth() !== r.getMonth() ? "D MMM" : "D", s = !t || r.getMonth() !== t.getMonth() ? "D MMM" : "D";
850
+ return `${l.format(r, s, e)} - ${l.format(i, n, e)}`;
813
851
  }
814
- const y = [
852
+ const $ = [
815
853
  {
816
854
  name: "Hour",
817
855
  padding: "7d",
818
856
  step: "1h",
819
857
  date_format: "YYYY-MM-DD HH:",
820
858
  lower_text: "HH",
821
- upper_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? c.format(r, "D MMMM", e) : "",
859
+ upper_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? l.format(r, "D MMMM", e) : "",
822
860
  upper_text_frequency: 24
823
861
  },
824
862
  {
@@ -827,7 +865,7 @@ const y = [
827
865
  step: "6h",
828
866
  date_format: "YYYY-MM-DD HH:",
829
867
  lower_text: "HH",
830
- upper_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? c.format(r, "D MMM", e) : "",
868
+ upper_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? l.format(r, "D MMM", e) : "",
831
869
  upper_text_frequency: 4
832
870
  },
833
871
  {
@@ -836,7 +874,7 @@ const y = [
836
874
  step: "12h",
837
875
  date_format: "YYYY-MM-DD HH:",
838
876
  lower_text: "HH",
839
- upper_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? r.getMonth() !== r.getMonth() ? c.format(r, "D MMM", e) : c.format(r, "D", e) : "",
877
+ upper_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? r.getMonth() !== r.getMonth() ? l.format(r, "D MMM", e) : l.format(r, "D", e) : "",
840
878
  upper_text_frequency: 2
841
879
  },
842
880
  {
@@ -844,8 +882,8 @@ const y = [
844
882
  padding: "7d",
845
883
  date_format: "YYYY-MM-DD",
846
884
  step: "1d",
847
- lower_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? c.format(r, "D", e) : "",
848
- upper_text: (r, t, e) => !t || r.getMonth() !== t.getMonth() ? c.format(r, "MMMM", e) : "",
885
+ lower_text: (r, t, e) => !t || r.getDate() !== t.getDate() ? l.format(r, "D", e) : "",
886
+ upper_text: (r, t, e) => !t || r.getMonth() !== t.getMonth() ? l.format(r, "MMMM", e) : "",
849
887
  thick_line: (r) => r.getDay() === 1
850
888
  },
851
889
  {
@@ -855,7 +893,7 @@ const y = [
855
893
  date_format: "YYYY-MM-DD",
856
894
  column_width: 140,
857
895
  lower_text: O,
858
- upper_text: (r, t, e) => !t || r.getMonth() !== t.getMonth() ? c.format(r, "MMMM", e) : "",
896
+ upper_text: (r, t, e) => !t || r.getMonth() !== t.getMonth() ? l.format(r, "MMMM", e) : "",
859
897
  thick_line: (r) => r.getDate() >= 1 && r.getDate() <= 7,
860
898
  upper_text_frequency: 4
861
899
  },
@@ -866,7 +904,7 @@ const y = [
866
904
  column_width: 120,
867
905
  date_format: "YYYY-MM",
868
906
  lower_text: "MMMM",
869
- upper_text: (r, t, e) => !t || r.getFullYear() !== t.getFullYear() ? c.format(r, "YYYY", e) : "",
907
+ upper_text: (r, t, e) => !t || r.getFullYear() !== t.getFullYear() ? l.format(r, "YYYY", e) : "",
870
908
  thick_line: (r) => r.getMonth() % 3 === 0,
871
909
  snap_at: "7d"
872
910
  },
@@ -876,7 +914,7 @@ const y = [
876
914
  step: "1y",
877
915
  column_width: 120,
878
916
  date_format: "YYYY",
879
- upper_text: (r, t, e) => !t || S(r) !== S(t) ? S(r) : "",
917
+ upper_text: (r, t, e) => !t || H(r) !== H(t) ? H(r) : "",
880
918
  lower_text: "YYYY",
881
919
  snap_at: "30d"
882
920
  }
@@ -903,12 +941,12 @@ const y = [
903
941
  padding: 18,
904
942
  popup: (r) => {
905
943
  r.set_title(r.task.name), r.task.description ? r.set_subtitle(r.task.description) : r.set_subtitle("");
906
- const t = c.format(
944
+ const t = l.format(
907
945
  r.task._start,
908
946
  "MMM D",
909
947
  r.chart.options.language
910
- ), e = c.format(
911
- c.add(r.task._end, -1, "second"),
948
+ ), e = l.format(
949
+ l.add(r.task._end, -1, "second"),
912
950
  "MMM D",
913
951
  r.chart.options.language
914
952
  );
@@ -926,7 +964,7 @@ const y = [
926
964
  today_button: !0,
927
965
  view_mode: "Day",
928
966
  view_mode_select: !1,
929
- view_modes: y,
967
+ view_modes: $,
930
968
  is_weekend: (r) => r.getDay() === 0 || r.getDay() === 6
931
969
  };
932
970
  class j {
@@ -936,12 +974,12 @@ class j {
936
974
  setup_wrapper(t) {
937
975
  let e, i;
938
976
  if (typeof t == "string") {
939
- let s = document.querySelector(t);
940
- if (!s)
977
+ let n = document.querySelector(t);
978
+ if (!n)
941
979
  throw new ReferenceError(
942
980
  `CSS selector "${t}" could not be found in DOM`
943
981
  );
944
- t = s;
982
+ t = n;
945
983
  }
946
984
  if (t instanceof HTMLElement)
947
985
  i = t, e = t.querySelector("svg");
@@ -968,12 +1006,12 @@ class j {
968
1006
  setup_options(t) {
969
1007
  this.original_options = t, t != null && t.view_modes && (t.view_modes = t.view_modes.map((i) => {
970
1008
  if (typeof i == "string") {
971
- const s = y.find(
972
- (n) => n.name === i
1009
+ const n = $.find(
1010
+ (s) => s.name === i
973
1011
  );
974
- return s || console.error(
1012
+ return n || console.error(
975
1013
  `The view mode "${i}" is not predefined in Frappe Gantt. Please define the view mode object instead.`
976
- ), s;
1014
+ ), n;
977
1015
  }
978
1016
  return i;
979
1017
  }), t.view_mode = t.view_modes[0]), this.options = { ...I, ...t };
@@ -984,10 +1022,10 @@ class j {
984
1022
  "upper-header-height": "upper_header_height"
985
1023
  };
986
1024
  for (let i in e) {
987
- let s = this.options[e[i]];
988
- s !== "auto" && this.$container.style.setProperty(
1025
+ let n = this.options[e[i]];
1026
+ n !== "auto" && this.$container.style.setProperty(
989
1027
  "--gv-" + i,
990
- s + "px"
1028
+ n + "px"
991
1029
  );
992
1030
  }
993
1031
  if (this.config = {
@@ -1001,7 +1039,7 @@ class j {
1001
1039
  this.config.ignored_function = i;
1002
1040
  continue;
1003
1041
  }
1004
- typeof i == "string" && (i === "weekend" ? this.config.ignored_function = (s) => s.getDay() == 6 || s.getDay() == 0 : this.config.ignored_dates.push(/* @__PURE__ */ new Date(i + " ")));
1042
+ typeof i == "string" && (i === "weekend" ? this.config.ignored_function = (n) => n.getDay() == 6 || n.getDay() == 0 : this.config.ignored_dates.push(/* @__PURE__ */ new Date(i + " ")));
1005
1043
  }
1006
1044
  } else
1007
1045
  this.config.ignored_function = this.options.ignore;
@@ -1015,24 +1053,24 @@ class j {
1015
1053
  return console.error(
1016
1054
  `task "${e.id}" doesn't have a start date`
1017
1055
  ), !1;
1018
- if (e._start = c.parse(e.start), e.end === void 0 && e.duration !== void 0 && (e.end = e._start, e.duration.split(" ").forEach((a) => {
1019
- let { duration: h, scale: d } = c.parse_duration(a);
1020
- e.end = c.add(e.end, h, d);
1056
+ if (e._start = l.parse(e.start), e.end === void 0 && e.duration !== void 0 && (e.end = e._start, e.duration.split(" ").forEach((a) => {
1057
+ let { duration: h, scale: d } = l.parse_duration(a);
1058
+ e.end = l.add(e.end, h, d);
1021
1059
  })), !e.end)
1022
1060
  return console.error(`task "${e.id}" doesn't have an end date`), !1;
1023
- if (e._end = c.parse(e.end), c.diff(e._end, e._start, "year") < 0)
1061
+ if (e._end = l.parse(e.end), l.diff(e._end, e._start, "year") < 0)
1024
1062
  return console.error(
1025
1063
  `start of task can't be after end of task: in task "${e.id}"`
1026
1064
  ), !1;
1027
- if (c.diff(e._end, e._start, "year") > 10)
1065
+ if (l.diff(e._end, e._start, "year") > 10)
1028
1066
  return console.error(
1029
1067
  `the duration of task "${e.id}" is too long (above ten years)`
1030
1068
  ), !1;
1031
- if (e._index = i, c.get_date_values(e._end).slice(3).every((o) => o === 0) && (e._end = c.add(e._end, 24, "hour")), typeof e.dependencies == "string" || !e.dependencies) {
1069
+ if (e._index = i, l.get_date_values(e._end).slice(3).every((o) => o === 0) && (e._end = l.add(e._end, 24, "hour")), typeof e.dependencies == "string" || !e.dependencies) {
1032
1070
  let o = [];
1033
1071
  e.dependencies && (o = e.dependencies.split(",").map((a) => a.trim().replaceAll(" ", "_")).filter((a) => a)), e.dependencies = o;
1034
1072
  }
1035
- return e.id ? typeof e.id == "string" ? e.id = e.id.replaceAll(" ", "_") : e.id = `${e.id}` : e.id = B(e), e;
1073
+ return e.id ? typeof e.id == "string" ? e.id = e.id.replaceAll(" ", "_") : e.id = `${e.id}` : e.id = N(e), e;
1036
1074
  }).filter((e) => e), this.setup_dependencies();
1037
1075
  }
1038
1076
  setup_dependencies() {
@@ -1045,16 +1083,16 @@ class j {
1045
1083
  this.setup_tasks(t), this.change_view_mode();
1046
1084
  }
1047
1085
  update_task(t, e) {
1048
- let i = this.tasks.find((n) => n.id === t), s = this.bars[i._index];
1049
- Object.assign(i, e), s.refresh();
1086
+ let i = this.tasks.find((s) => s.id === t), n = this.bars[i._index];
1087
+ Object.assign(i, e), n.refresh();
1050
1088
  }
1051
1089
  change_view_mode(t = this.options.view_mode, e = !1) {
1052
- typeof t == "string" && (t = this.options.view_modes.find((n) => n.name === t));
1053
- let i, s;
1054
- e && (i = this.$container.scrollLeft, s = this.options.scroll_to, this.options.scroll_to = null), this.options.view_mode = t.name, this.config.view_mode = t, this.update_view_scale(t), this.setup_dates(e), this.render(), e && (this.$container.scrollLeft = i, this.options.scroll_to = s), this.trigger_event("view_change", [t]);
1090
+ typeof t == "string" && (t = this.options.view_modes.find((s) => s.name === t));
1091
+ let i, n;
1092
+ e && (i = this.$container.scrollLeft, n = this.options.scroll_to, this.options.scroll_to = null), this.options.view_mode = t.name, this.config.view_mode = t, this.update_view_scale(t), this.setup_dates(e), this.render(), e && (this.$container.scrollLeft = i, this.options.scroll_to = n), this.trigger_event("view_change", [t]);
1055
1093
  }
1056
1094
  update_view_scale(t) {
1057
- let { duration: e, scale: i } = c.parse_duration(t.step);
1095
+ let { duration: e, scale: i } = l.parse_duration(t.step);
1058
1096
  this.config.step = e, this.config.unit = i, this.config.column_width = this.options.column_width || t.column_width || 45, this.$container.style.setProperty(
1059
1097
  "--gv-column-width",
1060
1098
  this.config.column_width + "px"
@@ -1066,15 +1104,15 @@ class j {
1066
1104
  setup_gantt_dates(t) {
1067
1105
  let e, i;
1068
1106
  this.tasks.length || (e = /* @__PURE__ */ new Date(), i = /* @__PURE__ */ new Date());
1069
- for (let s of this.tasks)
1070
- (!e || s._start < e) && (e = s._start), (!i || s._end > i) && (i = s._end);
1071
- if (e = c.start_of(e, this.config.unit), i = c.start_of(i, this.config.unit), !t)
1107
+ for (let n of this.tasks)
1108
+ (!e || n._start < e) && (e = n._start), (!i || n._end > i) && (i = n._end);
1109
+ if (e = l.start_of(e, this.config.unit), i = l.start_of(i, this.config.unit), !t)
1072
1110
  if (this.options.infinite_padding)
1073
- this.gantt_start = c.add(
1111
+ this.gantt_start = l.add(
1074
1112
  e,
1075
1113
  -this.config.extend_by_units * 3,
1076
1114
  this.config.unit
1077
- ), this.gantt_end = c.add(
1115
+ ), this.gantt_end = l.add(
1078
1116
  i,
1079
1117
  this.config.extend_by_units * 3,
1080
1118
  this.config.unit
@@ -1084,17 +1122,17 @@ class j {
1084
1122
  this.config.view_mode.padding,
1085
1123
  this.config.view_mode.padding
1086
1124
  ]);
1087
- let [s, n] = this.config.view_mode.padding.map(
1088
- c.parse_duration
1125
+ let [n, s] = this.config.view_mode.padding.map(
1126
+ l.parse_duration
1089
1127
  );
1090
- this.gantt_start = c.add(
1128
+ this.gantt_start = l.add(
1091
1129
  e,
1092
- -s.duration,
1093
- s.scale
1094
- ), this.gantt_end = c.add(
1095
- i,
1096
- n.duration,
1130
+ -n.duration,
1097
1131
  n.scale
1132
+ ), this.gantt_end = l.add(
1133
+ i,
1134
+ s.duration,
1135
+ s.scale
1098
1136
  );
1099
1137
  }
1100
1138
  this.config.date_format = this.config.view_mode.date_format || this.options.date_format, this.gantt_start.setHours(0, 0, 0, 0);
@@ -1102,7 +1140,7 @@ class j {
1102
1140
  setup_date_values() {
1103
1141
  let t = this.gantt_start;
1104
1142
  for (this.dates = [t]; t < this.gantt_end; )
1105
- t = c.add(
1143
+ t = l.add(
1106
1144
  t,
1107
1145
  this.config.step,
1108
1146
  this.config.unit
@@ -1157,10 +1195,10 @@ class j {
1157
1195
  make_grid_rows() {
1158
1196
  const t = f("g", { append_to: this.layers.grid }), e = this.dates.length * this.config.column_width, i = this.options.bar_height + this.options.padding;
1159
1197
  this.config.header_height;
1160
- for (let s = this.config.header_height; s < this.grid_height; s += i)
1198
+ for (let n = this.config.header_height; n < this.grid_height; n += i)
1161
1199
  f("rect", {
1162
1200
  x: 0,
1163
- y: s,
1201
+ y: n,
1164
1202
  width: e,
1165
1203
  height: i,
1166
1204
  class: "grid-row",
@@ -1187,8 +1225,8 @@ class j {
1187
1225
  const e = document.createElement("option");
1188
1226
  e.selected = !0, e.disabled = !0, e.textContent = "Mode", t.appendChild(e);
1189
1227
  for (const i of this.options.view_modes) {
1190
- const s = document.createElement("option");
1191
- s.value = i.name, s.textContent = i.name, i.name === this.config.view_mode.name && (s.selected = !0), t.appendChild(s);
1228
+ const n = document.createElement("option");
1229
+ n.value = i.name, n.textContent = i.name, i.name === this.config.view_mode.name && (n.selected = !0), t.appendChild(n);
1192
1230
  }
1193
1231
  t.addEventListener(
1194
1232
  "change",
@@ -1204,21 +1242,21 @@ class j {
1204
1242
  }
1205
1243
  make_grid_ticks() {
1206
1244
  if (this.options.lines === "none") return;
1207
- let t = 0, e = this.config.header_height, i = this.grid_height - this.config.header_height, s = f("g", {
1245
+ let t = 0, e = this.config.header_height, i = this.grid_height - this.config.header_height, n = f("g", {
1208
1246
  class: "lines_layer",
1209
1247
  append_to: this.layers.grid
1210
- }), n = this.config.header_height;
1248
+ }), s = this.config.header_height;
1211
1249
  const o = this.dates.length * this.config.column_width, a = this.options.bar_height + this.options.padding;
1212
1250
  if (this.options.lines !== "vertical")
1213
1251
  for (let h = this.config.header_height; h < this.grid_height; h += a)
1214
1252
  f("line", {
1215
1253
  x1: 0,
1216
- y1: n + a,
1254
+ y1: s + a,
1217
1255
  x2: o,
1218
- y2: n + a,
1256
+ y2: s + a,
1219
1257
  class: "row-line",
1220
- append_to: s
1221
- }), n += a;
1258
+ append_to: n
1259
+ }), s += a;
1222
1260
  if (this.options.lines !== "horizontal")
1223
1261
  for (let h of this.dates) {
1224
1262
  let d = "tick";
@@ -1226,7 +1264,7 @@ class j {
1226
1264
  d: `M ${t} ${e} v ${i}`,
1227
1265
  class: d,
1228
1266
  append_to: this.layers.grid
1229
- }), this.view_is("month") ? t += c.get_days_in_month(h) * this.config.column_width / 30 : this.view_is("year") ? t += c.get_days_in_year(h) * this.config.column_width / 365 : t += this.config.column_width;
1267
+ }), this.view_is("month") ? t += l.get_days_in_month(h) * this.config.column_width / 30 : this.view_is("year") ? t += l.get_days_in_year(h) * this.config.column_width / 365 : t += this.config.column_width;
1230
1268
  }
1231
1269
  }
1232
1270
  highlight_holidays() {
@@ -1235,10 +1273,10 @@ class j {
1235
1273
  for (let e in this.options.holidays) {
1236
1274
  let i = this.options.holidays[e];
1237
1275
  i === "weekend" && (i = this.options.is_weekend);
1238
- let s;
1276
+ let n;
1239
1277
  if (typeof i == "object") {
1240
- let n = i.find((o) => typeof o == "function");
1241
- if (n && (s = n), this.options.holidays.name) {
1278
+ let s = i.find((o) => typeof o == "function");
1279
+ if (s && (n = s), this.options.holidays.name) {
1242
1280
  let o = /* @__PURE__ */ new Date(i.date + " ");
1243
1281
  i = (a) => o.getTime() === a.getTime(), t[o] = i.name;
1244
1282
  } else
@@ -1250,26 +1288,26 @@ class j {
1250
1288
  return (/* @__PURE__ */ new Date(a + " ")).getTime();
1251
1289
  }).includes(o.getTime());
1252
1290
  }
1253
- for (let n = new Date(this.gantt_start); n <= this.gantt_end; n.setDate(n.getDate() + 1))
1291
+ for (let s = new Date(this.gantt_start); s <= this.gantt_end; s.setDate(s.getDate() + 1))
1254
1292
  if (!(this.config.ignored_dates.find(
1255
- (o) => o.getTime() == n.getTime()
1256
- ) || this.config.ignored_function && this.config.ignored_function(n)) && (i(n) || s && s(n))) {
1257
- const o = c.diff(
1258
- n,
1293
+ (o) => o.getTime() == s.getTime()
1294
+ ) || this.config.ignored_function && this.config.ignored_function(s)) && (i(s) || n && n(s))) {
1295
+ const o = l.diff(
1296
+ s,
1259
1297
  this.gantt_start,
1260
1298
  this.config.unit
1261
- ) / this.config.step * this.config.column_width, a = this.grid_height - this.config.header_height, h = c.format(n, "YYYY-MM-DD", this.options.language).replace(" ", "_");
1262
- if (t[n]) {
1299
+ ) / this.config.step * this.config.column_width, a = this.grid_height - this.config.header_height, h = l.format(s, "YYYY-MM-DD", this.options.language).replace(" ", "_");
1300
+ if (t[s]) {
1263
1301
  let d = this.create_el({
1264
1302
  classes: "holiday-label label_" + h,
1265
1303
  append_to: this.$extras
1266
1304
  });
1267
- d.textContent = t[n];
1305
+ d.textContent = t[s];
1268
1306
  }
1269
1307
  f("rect", {
1270
1308
  x: Math.round(o),
1271
1309
  y: this.config.header_height,
1272
- width: this.config.column_width / c.convert_scales(
1310
+ width: this.config.column_width / l.convert_scales(
1273
1311
  this.config.view_mode.step,
1274
1312
  "day"
1275
1313
  ),
@@ -1291,20 +1329,20 @@ class j {
1291
1329
  if (!t) return;
1292
1330
  const [e, i] = t;
1293
1331
  i.classList.add("current-date-highlight");
1294
- const n = c.diff(
1332
+ const s = l.diff(
1295
1333
  /* @__PURE__ */ new Date(),
1296
1334
  this.gantt_start,
1297
1335
  this.config.unit
1298
1336
  ) / this.config.step * this.config.column_width;
1299
1337
  this.$current_highlight = this.create_el({
1300
1338
  top: this.config.header_height,
1301
- left: n,
1339
+ left: s,
1302
1340
  height: this.grid_height - this.config.header_height,
1303
1341
  classes: "current-highlight",
1304
1342
  append_to: this.$container
1305
1343
  }), this.$current_ball_highlight = this.create_el({
1306
1344
  top: this.config.header_height - 6,
1307
- left: n - 2.5,
1345
+ left: s - 2.5,
1308
1346
  width: 6,
1309
1347
  height: 6,
1310
1348
  classes: "current-ball-highlight",
@@ -1322,15 +1360,15 @@ class j {
1322
1360
  </pattern>`;
1323
1361
  for (let i = new Date(this.gantt_start); i <= this.gantt_end; i.setDate(i.getDate() + 1)) {
1324
1362
  if (!this.config.ignored_dates.find(
1325
- (n) => n.getTime() == i.getTime()
1363
+ (s) => s.getTime() == i.getTime()
1326
1364
  ) && (!this.config.ignored_function || !this.config.ignored_function(i)))
1327
1365
  continue;
1328
- let s = c.convert_scales(
1329
- c.diff(i, this.gantt_start) + "d",
1366
+ let n = l.convert_scales(
1367
+ l.diff(i, this.gantt_start) + "d",
1330
1368
  this.config.unit
1331
1369
  ) / this.config.step;
1332
- this.config.ignored_positions.push(s * this.config.column_width), f("rect", {
1333
- x: s * this.config.column_width,
1370
+ this.config.ignored_positions.push(n * this.config.column_width), f("rect", {
1371
+ x: n * this.config.column_width,
1334
1372
  y: this.config.header_height,
1335
1373
  width: this.config.column_width,
1336
1374
  height: t,
@@ -1343,10 +1381,10 @@ class j {
1343
1381
  this.config.view_mode
1344
1382
  );
1345
1383
  }
1346
- create_el({ left: t, top: e, width: i, height: s, id: n, classes: o, append_to: a, type: h }) {
1384
+ create_el({ left: t, top: e, width: i, height: n, id: s, classes: o, append_to: a, type: h }) {
1347
1385
  let d = document.createElement(h || "div");
1348
1386
  for (let _ of o.split(" ")) d.classList.add(_);
1349
- return d.style.top = e + "px", d.style.left = t + "px", n && (d.id = n), i && (d.style.width = i + "px"), s && (d.style.height = s + "px"), a && a.appendChild(d), d;
1387
+ return d.style.top = e + "px", d.style.left = t + "px", s && (d.id = s), i && (d.style.width = i + "px"), n && (d.style.height = n + "px"), a && a.appendChild(d), d;
1350
1388
  }
1351
1389
  make_dates() {
1352
1390
  this.get_dates_to_draw().forEach((t, e) => {
@@ -1374,27 +1412,27 @@ class j {
1374
1412
  }
1375
1413
  get_dates_to_draw() {
1376
1414
  let t = null;
1377
- return this.dates.map((i, s) => {
1378
- const n = this.get_date_info(i, t, s);
1379
- return t = n, n;
1415
+ return this.dates.map((i, n) => {
1416
+ const s = this.get_date_info(i, t, n);
1417
+ return t = s, s;
1380
1418
  });
1381
1419
  }
1382
1420
  get_date_info(t, e) {
1383
1421
  let i = e ? e.date : null;
1384
1422
  this.config.column_width;
1385
- const s = e ? e.x + e.column_width : 0;
1386
- let n = this.config.view_mode.upper_text, o = this.config.view_mode.lower_text;
1387
- return n ? typeof n == "string" && (this.config.view_mode.upper_text = (a) => c.format(a, n, this.options.language)) : this.config.view_mode.upper_text = () => "", o ? typeof o == "string" && (this.config.view_mode.lower_text = (a) => c.format(a, o, this.options.language)) : this.config.view_mode.lower_text = () => "", {
1423
+ const n = e ? e.x + e.column_width : 0;
1424
+ let s = this.config.view_mode.upper_text, o = this.config.view_mode.lower_text;
1425
+ return s ? typeof s == "string" && (this.config.view_mode.upper_text = (a) => l.format(a, s, this.options.language)) : this.config.view_mode.upper_text = () => "", o ? typeof o == "string" && (this.config.view_mode.lower_text = (a) => l.format(a, o, this.options.language)) : this.config.view_mode.lower_text = () => "", {
1388
1426
  date: t,
1389
1427
  formatted_date: k(
1390
- c.format(
1428
+ l.format(
1391
1429
  t,
1392
1430
  this.config.date_format,
1393
1431
  this.options.language
1394
1432
  )
1395
1433
  ),
1396
1434
  column_width: this.config.column_width,
1397
- x: s,
1435
+ x: n,
1398
1436
  upper_text: this.config.view_mode.upper_text(
1399
1437
  t,
1400
1438
  i,
@@ -1420,56 +1458,56 @@ class j {
1420
1458
  for (let t of this.tasks) {
1421
1459
  let e = [];
1422
1460
  e = t.dependencies.map((i) => {
1423
- const s = this.get_task(i);
1424
- if (!s) return;
1425
- const n = new C(
1461
+ const n = this.get_task(i);
1462
+ if (!n) return;
1463
+ const s = new C(
1426
1464
  this,
1427
- this.bars[s._index],
1465
+ this.bars[n._index],
1428
1466
  // from_task
1429
1467
  this.bars[t._index]
1430
1468
  // to_task
1431
1469
  );
1432
- return this.layers.arrow.appendChild(n.element), n;
1470
+ return this.layers.arrow.appendChild(s.element), s;
1433
1471
  }).filter(Boolean), this.arrows = this.arrows.concat(e);
1434
1472
  }
1435
1473
  }
1436
1474
  calculate_critical_path() {
1437
- this.tasks.forEach((n) => n._is_critical = !1);
1475
+ this.tasks.forEach((s) => s._is_critical = !1);
1438
1476
  const t = {};
1439
- this.tasks.forEach((n) => {
1440
- t[n.id] = { es: 0, ef: 0, ls: 0, lf: 0 };
1477
+ this.tasks.forEach((s) => {
1478
+ t[s.id] = { es: 0, ef: 0, ls: 0, lf: 0 };
1441
1479
  });
1442
- const e = (n) => {
1443
- if (t[n.id].ef > 0) return t[n.id];
1480
+ const e = (s) => {
1481
+ if (t[s.id].ef > 0) return t[s.id];
1444
1482
  let o = 0;
1445
- n.dependencies && n.dependencies.length > 0 && n.dependencies.forEach((h) => {
1483
+ s.dependencies && s.dependencies.length > 0 && s.dependencies.forEach((h) => {
1446
1484
  const d = this.get_task(h);
1447
1485
  if (d) {
1448
1486
  const _ = e(d);
1449
1487
  o = Math.max(o, _.ef);
1450
1488
  }
1451
- }), t[n.id].es = o;
1452
- const a = c.diff(n._end, n._start, "hour") / 24;
1453
- return t[n.id].ef = o + a, t[n.id];
1489
+ }), t[s.id].es = o;
1490
+ const a = l.diff(s._end, s._start, "hour") / 24;
1491
+ return t[s.id].ef = o + a, t[s.id];
1454
1492
  };
1455
- this.tasks.forEach((n) => e(n));
1456
- const i = Math.max(...Object.values(t).map((n) => n.ef)), s = (n) => {
1457
- if (t[n.id].ls > 0 || t[n.id].lf > 0)
1458
- return t[n.id];
1493
+ this.tasks.forEach((s) => e(s));
1494
+ const i = Math.max(...Object.values(t).map((s) => s.ef)), n = (s) => {
1495
+ if (t[s.id].ls > 0 || t[s.id].lf > 0)
1496
+ return t[s.id];
1459
1497
  const o = this.tasks.filter(
1460
- (d) => d.dependencies && d.dependencies.includes(n.id)
1498
+ (d) => d.dependencies && d.dependencies.includes(s.id)
1461
1499
  );
1462
1500
  let a = i;
1463
1501
  o.length > 0 && o.forEach((d) => {
1464
- const _ = s(d);
1502
+ const _ = n(d);
1465
1503
  a = Math.min(a, _.ls);
1466
1504
  });
1467
- const h = c.diff(n._end, n._start, "hour") / 24;
1468
- return t[n.id].lf = a, t[n.id].ls = a - h, t[n.id];
1505
+ const h = l.diff(s._end, s._start, "hour") / 24;
1506
+ return t[s.id].lf = a, t[s.id].ls = a - h, t[s.id];
1469
1507
  };
1470
- this.tasks.forEach((n) => s(n)), this.tasks.forEach((n) => {
1471
- const o = t[n.id], a = o.ls - o.es;
1472
- n._is_critical = Math.abs(a) < 0.01;
1508
+ this.tasks.forEach((s) => n(s)), this.tasks.forEach((s) => {
1509
+ const o = t[s.id], a = o.ls - o.es;
1510
+ s._is_critical = Math.abs(a) < 0.01;
1473
1511
  });
1474
1512
  }
1475
1513
  update_arrow_critical_path() {
@@ -1498,9 +1536,9 @@ class j {
1498
1536
  else {
1499
1537
  if (t === "today")
1500
1538
  return this.scroll_current();
1501
- typeof t == "string" && (t = c.parse(t));
1539
+ typeof t == "string" && (t = l.parse(t));
1502
1540
  }
1503
- const i = c.diff(
1541
+ const i = l.diff(
1504
1542
  t,
1505
1543
  this.gantt_start,
1506
1544
  this.config.unit
@@ -1508,27 +1546,27 @@ class j {
1508
1546
  this.$container.scrollTo({
1509
1547
  left: i - this.config.column_width / 6,
1510
1548
  behavior: "smooth"
1511
- }), this.$current && this.$current.classList.remove("current-upper"), this.current_date = c.add(
1549
+ }), this.$current && this.$current.classList.remove("current-upper"), this.current_date = l.add(
1512
1550
  this.gantt_start,
1513
1551
  this.$container.scrollLeft / this.config.column_width,
1514
1552
  this.config.unit
1515
1553
  );
1516
- let s = this.config.view_mode.upper_text(
1554
+ let n = this.config.view_mode.upper_text(
1517
1555
  this.current_date,
1518
1556
  null,
1519
1557
  this.options.language
1520
- ), n = this.upperTexts.find(
1521
- (o) => o.textContent === s
1558
+ ), s = this.upperTexts.find(
1559
+ (o) => o.textContent === n
1522
1560
  );
1523
- this.current_date = c.add(
1561
+ this.current_date = l.add(
1524
1562
  this.gantt_start,
1525
- (this.$container.scrollLeft + n.clientWidth) / this.config.column_width,
1563
+ (this.$container.scrollLeft + s.clientWidth) / this.config.column_width,
1526
1564
  this.config.unit
1527
- ), s = this.config.view_mode.upper_text(
1565
+ ), n = this.config.view_mode.upper_text(
1528
1566
  this.current_date,
1529
1567
  null,
1530
1568
  this.options.language
1531
- ), n = this.upperTexts.find((o) => o.textContent === s), n.classList.add("current-upper"), this.$current = n;
1569
+ ), s = this.upperTexts.find((o) => o.textContent === n), s.classList.add("current-upper"), this.$current = s;
1532
1570
  }
1533
1571
  scroll_current() {
1534
1572
  let t = this.get_closest_date();
@@ -1539,26 +1577,26 @@ class j {
1539
1577
  if (t < this.gantt_start || t > this.gantt_end) return null;
1540
1578
  let e = /* @__PURE__ */ new Date(), i = this.$container.querySelector(
1541
1579
  ".date_" + k(
1542
- c.format(
1580
+ l.format(
1543
1581
  e,
1544
1582
  this.config.date_format,
1545
1583
  this.options.language
1546
1584
  )
1547
1585
  )
1548
- ), s = 0;
1549
- for (; !i && s < this.config.step; )
1550
- e = c.add(e, -1, this.config.unit), i = this.$container.querySelector(
1586
+ ), n = 0;
1587
+ for (; !i && n < this.config.step; )
1588
+ e = l.add(e, -1, this.config.unit), i = this.$container.querySelector(
1551
1589
  ".date_" + k(
1552
- c.format(
1590
+ l.format(
1553
1591
  e,
1554
1592
  this.config.date_format,
1555
1593
  this.options.language
1556
1594
  )
1557
1595
  )
1558
- ), s++;
1596
+ ), n++;
1559
1597
  return [
1560
1598
  /* @__PURE__ */ new Date(
1561
- c.format(
1599
+ l.format(
1562
1600
  e,
1563
1601
  this.config.date_format,
1564
1602
  this.options.language
@@ -1584,157 +1622,151 @@ class j {
1584
1622
  ".label_" + e.classList[1]
1585
1623
  );
1586
1624
  if (!i) continue;
1587
- let s;
1588
- e.onmouseenter = (n) => {
1589
- s = setTimeout(() => {
1590
- i.classList.add("show"), i.style.left = (n.offsetX || n.layerX) + "px", i.style.top = (n.offsetY || n.layerY) + "px";
1625
+ let n;
1626
+ e.onmouseenter = (s) => {
1627
+ n = setTimeout(() => {
1628
+ i.classList.add("show"), i.style.left = (s.offsetX || s.layerX) + "px", i.style.top = (s.offsetY || s.layerY) + "px";
1591
1629
  }, 300);
1592
- }, e.onmouseleave = (n) => {
1593
- clearTimeout(s), i.classList.remove("show");
1630
+ }, e.onmouseleave = (s) => {
1631
+ clearTimeout(n), i.classList.remove("show");
1594
1632
  };
1595
1633
  }
1596
1634
  }
1597
1635
  get_start_end_positions() {
1598
1636
  if (!this.bars.length) return [0, 0, 0];
1599
- let { x: t, width: e } = this.bars[0].group.getBBox(), i = t, s = t, n = t + e;
1637
+ let { x: t, width: e } = this.bars[0].group.getBBox(), i = t, n = t, s = t + e;
1600
1638
  return Array.prototype.forEach.call(this.bars, function({ group: o }, a) {
1601
1639
  let { x: h, width: d } = o.getBBox();
1602
- h < i && (i = h), h > s && (s = h), h + d > n && (n = h + d);
1603
- }), [i, s, n];
1640
+ h < i && (i = h), h > n && (n = h), h + d > s && (s = h + d);
1641
+ }), [i, n, s];
1604
1642
  }
1605
1643
  bind_bar_events() {
1606
- let t = !1, e = 0, i = 0, s = !1, n = !1, o = null, a = [];
1644
+ let t = !1, e = 0, i = 0, n = !1, s = !1, o = null, a = [];
1607
1645
  this.bar_being_dragged = null;
1608
- const h = () => t || s || n;
1646
+ const h = () => t || n || s;
1609
1647
  this.$svg.onclick = (_) => {
1610
1648
  _.target.classList.contains("grid-row") && this.unselect_all();
1611
1649
  };
1612
1650
  let d = 0;
1613
1651
  if (u.on(this.$svg, "mousemove", ".bar-wrapper, .handle", (_) => {
1614
1652
  this.bar_being_dragged === !1 && Math.abs((_.offsetX || _.layerX) - d) > 10 && (this.bar_being_dragged = !0);
1615
- }), u.on(this.$svg, "mousedown", ".bar-wrapper, .handle", (_, l) => {
1616
- const p = u.closest(".bar-wrapper", l);
1617
- l.classList.contains("left") ? (s = !0, l.classList.add("visible")) : l.classList.contains("right") ? (n = !0, l.classList.add("visible")) : l.classList.contains("bar-wrapper") && (t = !0), this.popup && this.popup.hide(), e = _.offsetX || _.layerX, o = p.getAttribute("data-id");
1618
- const $ = this.get_bar(o).task.dependencies_type || this.options.dependencies_type;
1653
+ }), u.on(this.$svg, "mousedown", ".bar-wrapper, .handle", (_, c) => {
1654
+ const g = u.closest(".bar-wrapper", c);
1655
+ c.classList.contains("left") ? (n = !0, c.classList.add("visible")) : c.classList.contains("right") ? (s = !0, c.classList.add("visible")) : c.classList.contains("bar-wrapper") && (t = !0), this.popup && this.popup.hide(), e = _.offsetX || _.layerX, o = g.getAttribute("data-id");
1656
+ const w = this.get_bar(o).task.dependencies_type || this.options.dependencies_type;
1619
1657
  let m;
1620
- this.options.move_dependencies && $ === "fixed" ? m = [
1658
+ this.options.move_dependencies && w === "fixed" ? m = [
1621
1659
  o,
1622
1660
  ...this.get_all_dependent_tasks(o)
1623
- ] : m = [o], a = m.map((x) => this.get_bar(x)), this.bar_being_dragged = !1, d = e, a.forEach((x) => {
1624
- const w = x.$bar;
1625
- w.ox = w.getX(), w.oy = w.getY(), w.owidth = w.getWidth(), w.finaldx = 0;
1661
+ ] : m = [o], a = m.map((v) => this.get_bar(v)), this.bar_being_dragged = !1, d = e, a.forEach((v) => {
1662
+ const b = v.$bar;
1663
+ b.ox = b.getX(), b.oy = b.getY(), b.owidth = b.getWidth(), b.finaldx = 0;
1626
1664
  });
1627
1665
  }), this.options.infinite_padding) {
1628
1666
  let _ = !1;
1629
- u.on(this.$container, "mousewheel", (l) => {
1630
- let p = this.$container.scrollWidth / 2;
1631
- if (!_ && l.currentTarget.scrollLeft <= p) {
1632
- let g = l.currentTarget.scrollLeft;
1633
- _ = !0, this.gantt_start = c.add(
1667
+ u.on(this.$container, "mousewheel", (c) => {
1668
+ let g = this.$container.scrollWidth / 2;
1669
+ if (!_ && c.currentTarget.scrollLeft <= g) {
1670
+ let p = c.currentTarget.scrollLeft;
1671
+ _ = !0, this.gantt_start = l.add(
1634
1672
  this.gantt_start,
1635
1673
  -this.config.extend_by_units,
1636
1674
  this.config.unit
1637
- ), this.setup_date_values(), this.render(), l.currentTarget.scrollLeft = g + this.config.column_width * this.config.extend_by_units, setTimeout(() => _ = !1, 300);
1675
+ ), this.setup_date_values(), this.render(), c.currentTarget.scrollLeft = p + this.config.column_width * this.config.extend_by_units, setTimeout(() => _ = !1, 300);
1638
1676
  }
1639
- if (!_ && l.currentTarget.scrollWidth - (l.currentTarget.scrollLeft + l.currentTarget.clientWidth) <= p) {
1640
- let g = l.currentTarget.scrollLeft;
1641
- _ = !0, this.gantt_end = c.add(
1677
+ if (!_ && c.currentTarget.scrollWidth - (c.currentTarget.scrollLeft + c.currentTarget.clientWidth) <= g) {
1678
+ let p = c.currentTarget.scrollLeft;
1679
+ _ = !0, this.gantt_end = l.add(
1642
1680
  this.gantt_end,
1643
1681
  this.config.extend_by_units,
1644
1682
  this.config.unit
1645
- ), this.setup_date_values(), this.render(), l.currentTarget.scrollLeft = g, setTimeout(() => _ = !1, 300);
1683
+ ), this.setup_date_values(), this.render(), c.currentTarget.scrollLeft = p, setTimeout(() => _ = !1, 300);
1646
1684
  }
1647
1685
  });
1648
1686
  }
1649
1687
  u.on(this.$container, "scroll", (_) => {
1650
- let l = [];
1651
- const p = this.bars.map(
1652
- ({ group: b }) => b.getAttribute("data-id")
1688
+ let c = [];
1689
+ const g = this.bars.map(
1690
+ ({ group: y }) => y.getAttribute("data-id")
1653
1691
  );
1654
- let g;
1655
- i && (g = _.currentTarget.scrollLeft - i), this.current_date = c.add(
1692
+ let p;
1693
+ i && (p = _.currentTarget.scrollLeft - i), this.current_date = l.add(
1656
1694
  this.gantt_start,
1657
1695
  _.currentTarget.scrollLeft / this.config.column_width * this.config.step,
1658
1696
  this.config.unit
1659
1697
  );
1660
- let $ = this.config.view_mode.upper_text(
1698
+ let w = this.config.view_mode.upper_text(
1661
1699
  this.current_date,
1662
1700
  null,
1663
1701
  this.options.language
1664
1702
  ), m = this.upperTexts.find(
1665
- (b) => b.textContent === $
1703
+ (y) => y.textContent === w
1666
1704
  );
1667
- this.current_date = c.add(
1705
+ this.current_date = l.add(
1668
1706
  this.gantt_start,
1669
1707
  (_.currentTarget.scrollLeft + m.clientWidth) / this.config.column_width * this.config.step,
1670
1708
  this.config.unit
1671
- ), $ = this.config.view_mode.upper_text(
1709
+ ), w = this.config.view_mode.upper_text(
1672
1710
  this.current_date,
1673
1711
  null,
1674
1712
  this.options.language
1675
1713
  ), m = this.upperTexts.find(
1676
- (b) => b.textContent === $
1714
+ (y) => y.textContent === w
1677
1715
  ), m !== this.$current && (this.$current && this.$current.classList.remove("current-upper"), m.classList.add("current-upper"), this.$current = m), i = _.currentTarget.scrollLeft;
1678
- let [x, w, X] = this.get_start_end_positions();
1716
+ let [v, b, X] = this.get_start_end_positions();
1679
1717
  i > X + 100 ? (this.$adjust.innerHTML = "&larr;", this.$adjust.classList.remove("hide"), this.$adjust.onclick = () => {
1680
1718
  this.$container.scrollTo({
1681
- left: w,
1719
+ left: b,
1682
1720
  behavior: "smooth"
1683
1721
  });
1684
- }) : i + _.currentTarget.offsetWidth < x - 100 ? (this.$adjust.innerHTML = "&rarr;", this.$adjust.classList.remove("hide"), this.$adjust.onclick = () => {
1722
+ }) : i + _.currentTarget.offsetWidth < v - 100 ? (this.$adjust.innerHTML = "&rarr;", this.$adjust.classList.remove("hide"), this.$adjust.onclick = () => {
1685
1723
  this.$container.scrollTo({
1686
- left: x,
1724
+ left: v,
1687
1725
  behavior: "smooth"
1688
1726
  });
1689
- }) : this.$adjust.classList.add("hide"), g && (l = p.map((b) => this.get_bar(b)), this.options.auto_move_label && l.forEach((b) => {
1690
- b.update_label_position_on_horizontal_scroll({
1691
- x: g,
1727
+ }) : this.$adjust.classList.add("hide"), p && (c = g.map((y) => this.get_bar(y)), this.options.auto_move_label && c.forEach((y) => {
1728
+ y.update_label_position_on_horizontal_scroll({
1729
+ x: p,
1692
1730
  sx: _.currentTarget.scrollLeft
1693
1731
  });
1694
1732
  }));
1695
1733
  }), u.on(this.$svg, "mousemove", (_) => {
1696
1734
  if (!h()) return;
1697
- const l = (_.offsetX || _.layerX) - e;
1698
- a.forEach((p) => {
1699
- const g = p.$bar;
1700
- g.finaldx = this.get_snap_position(l, g.ox), this.hide_popup(), s ? o === p.task.id ? p.update_bar_position({
1701
- x: g.ox + g.finaldx,
1702
- width: g.owidth - g.finaldx
1703
- }) : p.update_bar_position({
1704
- x: g.ox + g.finaldx
1705
- }) : n ? o === p.task.id && p.update_bar_position({
1706
- width: g.owidth + g.finaldx
1707
- }) : t && !this.options.readonly && !this.options.readonly_dates && p.update_bar_position({ x: g.ox + g.finaldx });
1735
+ const c = (_.offsetX || _.layerX) - e;
1736
+ a.forEach((g) => {
1737
+ const p = g.$bar;
1738
+ p.finaldx = this.get_snap_position(c, p.ox), this.hide_popup(), n ? o === g.task.id ? g.update_bar_position({
1739
+ x: p.ox + p.finaldx,
1740
+ width: p.owidth - p.finaldx
1741
+ }) : g.update_bar_position({
1742
+ x: p.ox + p.finaldx
1743
+ }) : s ? o === g.task.id && g.update_bar_position({
1744
+ width: p.owidth + p.finaldx
1745
+ }) : t && !this.options.readonly && !this.options.readonly_dates && g.update_bar_position({ x: p.ox + p.finaldx });
1708
1746
  });
1709
1747
  }), document.addEventListener("mouseup", () => {
1710
- var _, l, p;
1711
- t = !1, s = !1, n = !1, (p = (l = (_ = this.$container.querySelector(".visible")) == null ? void 0 : _.classList) == null ? void 0 : l.remove) == null || p.call(l, "visible");
1748
+ var _, c, g;
1749
+ t = !1, n = !1, s = !1, (g = (c = (_ = this.$container.querySelector(".visible")) == null ? void 0 : _.classList) == null ? void 0 : c.remove) == null || g.call(c, "visible");
1712
1750
  }), u.on(this.$svg, "mouseup", (_) => {
1713
1751
  this.bar_being_dragged = null;
1714
- const l = [];
1752
+ const c = [];
1715
1753
  a.forEach((g) => {
1716
- g.$bar.finaldx && (g.date_changed(), g.compute_progress(), g.set_action_completed(), l.push({
1754
+ g.$bar.finaldx && (g.date_changed(), g.compute_progress(), g.set_action_completed(), c.push({
1717
1755
  task: g.task,
1718
1756
  start: g.task._start,
1719
- end: c.add(g.task._end, -1, "second")
1757
+ end: l.add(g.task._end, -1, "second")
1720
1758
  }));
1721
- });
1722
- const p = this.get_bar(o);
1723
- if (p && p.$bar.finaldx) {
1724
- const g = this.update_dependent_tasks_by_type(p);
1725
- l.push(...g);
1726
- }
1727
- this.options.critical_path && a.some((g) => g.$bar.finaldx) && (this.calculate_critical_path(), this.update_arrow_critical_path()), l.length > 0 && l.forEach(({ task: g, start: $, end: m }) => {
1728
- this.trigger_event("after_date_change", [g, $, m]);
1759
+ }), this.options.critical_path && a.some((g) => g.$bar.finaldx) && (this.calculate_critical_path(), this.update_arrow_critical_path()), c.length > 0 && c.forEach(({ task: g, start: p, end: w }) => {
1760
+ this.trigger_event("after_date_change", [g, p, w]);
1729
1761
  });
1730
1762
  }), this.bind_bar_progress();
1731
1763
  }
1732
1764
  bind_bar_progress() {
1733
- let t = 0, e = null, i = null, s = null, n = null;
1765
+ let t = 0, e = null, i = null, n = null, s = null;
1734
1766
  u.on(this.$svg, "mousedown", ".handle.progress", (a, h) => {
1735
1767
  e = !0, t = a.offsetX || a.layerX;
1736
1768
  const _ = u.closest(".bar-wrapper", h).getAttribute("data-id");
1737
- i = this.get_bar(_), s = i.$bar_progress, n = i.$bar, s.finaldx = 0, s.owidth = s.getWidth(), s.min_dx = -s.owidth, s.max_dx = n.getWidth() - s.getWidth();
1769
+ i = this.get_bar(_), n = i.$bar_progress, s = i.$bar, n.finaldx = 0, n.owidth = n.getWidth(), n.min_dx = -n.owidth, n.max_dx = s.getWidth() - n.getWidth();
1738
1770
  });
1739
1771
  const o = this.config.ignored_positions.map((a) => [
1740
1772
  a,
@@ -1744,87 +1776,87 @@ class j {
1744
1776
  if (!e) return;
1745
1777
  let h = a.offsetX || a.layerX;
1746
1778
  if (h > t) {
1747
- let l = o.find(
1748
- ([p, g]) => h >= p && h < g
1779
+ let c = o.find(
1780
+ ([g, p]) => h >= g && h < p
1749
1781
  );
1750
- for (; l; )
1751
- h = l[1], l = o.find(
1752
- ([p, g]) => h >= p && h < g
1782
+ for (; c; )
1783
+ h = c[1], c = o.find(
1784
+ ([g, p]) => h >= g && h < p
1753
1785
  );
1754
1786
  } else {
1755
- let l = o.find(
1756
- ([p, g]) => h > p && h <= g
1787
+ let c = o.find(
1788
+ ([g, p]) => h > g && h <= p
1757
1789
  );
1758
- for (; l; )
1759
- h = l[0], l = o.find(
1760
- ([p, g]) => h > p && h <= g
1790
+ for (; c; )
1791
+ h = c[0], c = o.find(
1792
+ ([g, p]) => h > g && h <= p
1761
1793
  );
1762
1794
  }
1763
1795
  let _ = h - t;
1764
- console.log(s), _ > s.max_dx && (_ = s.max_dx), _ < s.min_dx && (_ = s.min_dx), s.setAttribute("width", s.owidth + _), u.attr(i.$handle_progress, "cx", s.getEndX()), s.finaldx = _;
1796
+ console.log(n), _ > n.max_dx && (_ = n.max_dx), _ < n.min_dx && (_ = n.min_dx), n.setAttribute("width", n.owidth + _), u.attr(i.$handle_progress, "cx", n.getEndX()), n.finaldx = _;
1765
1797
  }), u.on(this.$svg, "mouseup", () => {
1766
- e = !1, s && s.finaldx && (s.finaldx = 0, i.progress_changed(), i.set_action_completed(), i = null, s = null, n = null);
1798
+ e = !1, n && n.finaldx && (n.finaldx = 0, i.progress_changed(), i.set_action_completed(), i = null, n = null, s = null);
1767
1799
  });
1768
1800
  }
1769
1801
  get_all_dependent_tasks(t) {
1770
1802
  let e = [], i = [t];
1771
1803
  for (; i.length; ) {
1772
- const s = i.reduce((n, o) => (n = n.concat(this.dependency_map[o]), n), []);
1773
- e = e.concat(s), i = s.filter((n) => !i.includes(n));
1804
+ const n = i.reduce((s, o) => (s = s.concat(this.dependency_map[o]), s), []);
1805
+ e = e.concat(n), i = n.filter((s) => !i.includes(s));
1774
1806
  }
1775
1807
  return e.filter(Boolean);
1776
1808
  }
1777
1809
  update_dependent_tasks_by_type(t) {
1778
1810
  const e = t.task.dependencies_type || this.options.dependencies_type, i = [];
1779
- return e === "fixed" || (this.dependency_map[t.task.id] || []).forEach((n) => {
1780
- const o = this.get_bar(n);
1811
+ return e === "fixed" || (this.dependency_map[t.task.id] || []).forEach((s) => {
1812
+ const o = this.get_bar(s);
1781
1813
  if (!o) return;
1782
1814
  const a = o.task, h = a.dependencies_type || this.options.dependencies_type;
1783
1815
  let d, _;
1784
- const l = c.diff(a._end, a._start, "hour");
1785
- let p = !1;
1816
+ const c = l.diff(a._end, a._start, "hour");
1817
+ let g = !1;
1786
1818
  switch (h) {
1787
1819
  case "finish-to-start":
1788
- t.task._end > a._start && (d = new Date(t.task._end), _ = c.add(d, l, "hour"), p = !0);
1820
+ t.task._end > a._start && (d = new Date(t.task._end), _ = l.add(d, c, "hour"), g = !0);
1789
1821
  break;
1790
1822
  case "start-to-start":
1791
- t.task._start > a._start && (d = new Date(t.task._start), _ = c.add(d, l, "hour"), p = !0);
1823
+ t.task._start > a._start && (d = new Date(t.task._start), _ = l.add(d, c, "hour"), g = !0);
1792
1824
  break;
1793
1825
  case "finish-to-finish":
1794
- t.task._end > a._end && (_ = new Date(t.task._end), d = c.add(_, -l, "hour"), p = !0);
1826
+ t.task._end > a._end && (_ = new Date(t.task._end), d = l.add(_, -c, "hour"), g = !0);
1795
1827
  break;
1796
1828
  case "start-to-finish":
1797
- t.task._start > a._end && (_ = new Date(t.task._start), d = c.add(_, -l, "hour"), p = !0);
1829
+ t.task._start > a._end && (_ = new Date(t.task._start), d = l.add(_, -c, "hour"), g = !0);
1798
1830
  break;
1799
1831
  default:
1800
1832
  return;
1801
1833
  }
1802
- if (!p) return;
1834
+ if (!g) return;
1803
1835
  a._start = d, a._end = _, o.compute_x(), o.compute_duration(), o.update_bar_position({
1804
1836
  x: o.x,
1805
1837
  width: o.width
1806
1838
  }), this.trigger_event("date_change", [
1807
1839
  a,
1808
1840
  d,
1809
- c.add(_, -1, "second")
1841
+ l.add(_, -1, "second")
1810
1842
  ]), i.push({
1811
1843
  task: a,
1812
1844
  start: d,
1813
- end: c.add(_, -1, "second")
1845
+ end: l.add(_, -1, "second")
1814
1846
  });
1815
- const g = this.update_dependent_tasks_by_type(o);
1816
- i.push(...g);
1847
+ const p = this.update_dependent_tasks_by_type(o);
1848
+ i.push(...p);
1817
1849
  }), i;
1818
1850
  }
1819
1851
  get_snap_position(t, e) {
1820
1852
  let i = 1;
1821
- const s = this.options.snap_at || this.config.view_mode.snap_at || "1d";
1822
- if (s !== "unit") {
1823
- const { duration: _, scale: l } = c.parse_duration(s);
1824
- i = c.convert_scales(this.config.view_mode.step, l) / _;
1853
+ const n = this.options.snap_at || this.config.view_mode.snap_at || "1d";
1854
+ if (n !== "unit") {
1855
+ const { duration: _, scale: c } = l.parse_duration(n);
1856
+ i = l.convert_scales(this.config.view_mode.step, c) / _;
1825
1857
  }
1826
- const n = t % (this.config.column_width / i);
1827
- let o = t - n + (n < this.config.column_width / i * 2 ? 0 : this.config.column_width / i), a = e + o;
1858
+ const s = t % (this.config.column_width / i);
1859
+ let o = t - s + (s < this.config.column_width / i * 2 ? 0 : this.config.column_width / i), a = e + o;
1828
1860
  const h = o > 0 ? 1 : -1;
1829
1861
  let d = this.get_ignored_region(a, h);
1830
1862
  for (; d.length; )
@@ -1878,20 +1910,20 @@ class j {
1878
1910
  * @memberof Gantt
1879
1911
  */
1880
1912
  clear() {
1881
- var t, e, i, s, n, o, a, h, d, _;
1882
- this.$svg.innerHTML = "", (e = (t = this.$header) == null ? void 0 : t.remove) == null || e.call(t), (s = (i = this.$side_header) == null ? void 0 : i.remove) == null || s.call(i), (o = (n = this.$current_highlight) == null ? void 0 : n.remove) == null || o.call(n), (h = (a = this.$extras) == null ? void 0 : a.remove) == null || h.call(a), (_ = (d = this.popup) == null ? void 0 : d.hide) == null || _.call(d);
1913
+ var t, e, i, n, s, o, a, h, d, _;
1914
+ this.$svg.innerHTML = "", (e = (t = this.$header) == null ? void 0 : t.remove) == null || e.call(t), (n = (i = this.$side_header) == null ? void 0 : i.remove) == null || n.call(i), (o = (s = this.$current_highlight) == null ? void 0 : s.remove) == null || o.call(s), (h = (a = this.$extras) == null ? void 0 : a.remove) == null || h.call(a), (_ = (d = this.popup) == null ? void 0 : d.hide) == null || _.call(d);
1883
1915
  }
1884
1916
  }
1885
1917
  j.VIEW_MODE = {
1886
- HOUR: y[0],
1887
- QUARTER_DAY: y[1],
1888
- HALF_DAY: y[2],
1889
- DAY: y[3],
1890
- WEEK: y[4],
1891
- MONTH: y[5],
1892
- YEAR: y[6]
1918
+ HOUR: $[0],
1919
+ QUARTER_DAY: $[1],
1920
+ HALF_DAY: $[2],
1921
+ DAY: $[3],
1922
+ WEEK: $[4],
1923
+ MONTH: $[5],
1924
+ YEAR: $[6]
1893
1925
  };
1894
- function B(r) {
1926
+ function N(r) {
1895
1927
  return r.name + "_" + Math.random().toString(36).slice(2, 12);
1896
1928
  }
1897
1929
  function k(r) {