@workiom/frappe-gantt 1.0.25 → 1.0.27

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 S = "year", E = "month", A = "day", H = "hour", Y = "minute", X = "second", F = "millisecond", g = {
1
+ const E = "year", S = "month", A = "day", H = "hour", Y = "minute", X = "second", F = "millisecond", g = {
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) {
@@ -40,7 +40,7 @@ const S = "year", E = "month", A = "day", H = "hour", Y = "minute", X = "second"
40
40
  month: "long"
41
41
  }), s = new Intl.DateTimeFormat(e, {
42
42
  month: "short"
43
- }), n = i.format(r), a = n.charAt(0).toUpperCase() + n.slice(1), o = this.get_date_values(r).map((l) => L(l, 2, 0)), d = {
43
+ }), n = i.format(r), a = n.charAt(0).toUpperCase() + n.slice(1), o = this.get_date_values(r).map((l) => L(l, 2, 0)), h = {
44
44
  YYYY: o[0],
45
45
  MM: L(+o[1] + 1, 2, 0),
46
46
  DD: o[2],
@@ -52,27 +52,27 @@ const S = "year", E = "month", A = "day", H = "hour", Y = "minute", X = "second"
52
52
  MMMM: a,
53
53
  MMM: s.format(r)
54
54
  };
55
- let h = t;
55
+ let d = t;
56
56
  const _ = [];
57
- return Object.keys(d).sort((l, p) => p.length - l.length).forEach((l) => {
58
- h.includes(l) && (h = h.replaceAll(l, `$${_.length}`), _.push(d[l]));
59
- }), _.forEach((l, p) => {
60
- h = h.replaceAll(`$${p}`, l);
61
- }), h;
57
+ return Object.keys(h).sort((l, c) => c.length - l.length).forEach((l) => {
58
+ d.includes(l) && (d = d.replaceAll(l, `$${_.length}`), _.push(h[l]));
59
+ }), _.forEach((l, c) => {
60
+ d = d.replaceAll(`$${c}`, l);
61
+ }), d;
62
62
  },
63
63
  diff(r, t, e = "day") {
64
- let i, s, n, a, o, d, h;
64
+ let i, s, n, a, o, h, d;
65
65
  i = r - t + (t.getTimezoneOffset() - r.getTimezoneOffset()) * 6e4, s = i / 1e3, a = s / 60, n = a / 60, o = n / 24;
66
66
  let _ = r.getFullYear() - t.getFullYear(), l = r.getMonth() - t.getMonth();
67
- return l += o % 30 / 30, d = _ * 12 + l, r.getDate() < t.getDate() && d--, h = d / 12, e.endsWith("s") || (e += "s"), Math.round(
67
+ return l += o % 30 / 30, h = _ * 12 + l, r.getDate() < t.getDate() && h--, d = h / 12, e.endsWith("s") || (e += "s"), Math.round(
68
68
  {
69
69
  milliseconds: i,
70
70
  seconds: s,
71
71
  minutes: a,
72
72
  hours: n,
73
73
  days: o,
74
- months: d,
75
- years: h
74
+ months: h,
75
+ years: d
76
76
  }[e] * 100
77
77
  ) / 100;
78
78
  },
@@ -86,8 +86,8 @@ const S = "year", E = "month", A = "day", H = "hour", Y = "minute", X = "second"
86
86
  add(r, t, e) {
87
87
  t = parseInt(t, 10);
88
88
  const i = [
89
- r.getFullYear() + (e === S ? t : 0),
90
- r.getMonth() + (e === E ? t : 0),
89
+ r.getFullYear() + (e === E ? t : 0),
90
+ r.getMonth() + (e === S ? t : 0),
91
91
  r.getDate() + (e === A ? t : 0),
92
92
  r.getHours() + (e === H ? t : 0),
93
93
  r.getMinutes() + (e === Y ? t : 0),
@@ -98,8 +98,8 @@ const S = "year", E = "month", A = "day", H = "hour", Y = "minute", X = "second"
98
98
  },
99
99
  start_of(r, t) {
100
100
  const e = {
101
- [S]: 6,
102
- [E]: 5,
101
+ [E]: 6,
102
+ [S]: 5,
103
103
  [A]: 4,
104
104
  [H]: 3,
105
105
  [Y]: 2,
@@ -112,8 +112,8 @@ const S = "year", E = "month", A = "day", H = "hour", Y = "minute", X = "second"
112
112
  }
113
113
  const s = [
114
114
  r.getFullYear(),
115
- i(S) ? 0 : r.getMonth(),
116
- i(E) ? 1 : r.getDate(),
115
+ i(E) ? 0 : r.getMonth(),
116
+ i(S) ? 1 : r.getDate(),
117
117
  i(A) ? 0 : r.getHours(),
118
118
  i(H) ? 0 : r.getMinutes(),
119
119
  i(Y) ? 0 : r.getSeconds(),
@@ -161,7 +161,7 @@ const S = "year", E = "month", A = "day", H = "hour", Y = "minute", X = "second"
161
161
  function L(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
- function u(r, t) {
164
+ function m(r, t) {
165
165
  return typeof r == "string" ? (t || document).querySelector(r) : r || null;
166
166
  }
167
167
  function w(r, t) {
@@ -171,16 +171,16 @@ function w(r, t) {
171
171
  return e;
172
172
  }
173
173
  function C(r, t, e, i) {
174
- const s = R(r, t, e, i);
174
+ const s = j(r, t, e, i);
175
175
  if (s === r) {
176
176
  const n = document.createEvent("HTMLEvents");
177
177
  n.initEvent("click", !0, !0), n.eventName = "click", s.dispatchEvent(n);
178
178
  }
179
179
  }
180
- function R(r, t, e, i, s = "0.4s", n = "0.1s") {
180
+ function j(r, t, e, i, s = "0.4s", n = "0.1s") {
181
181
  const a = r.querySelector("animate");
182
182
  if (a)
183
- return u.attr(a, {
183
+ return m.attr(a, {
184
184
  attributeName: t,
185
185
  from: e,
186
186
  to: i,
@@ -210,30 +210,30 @@ function G(r) {
210
210
  "ease-in-out": ".42 0 .58 1"
211
211
  }[r];
212
212
  }
213
- u.on = (r, t, e, i) => {
214
- i ? u.delegate(r, t, e, i) : (i = e, u.bind(r, t, i));
213
+ m.on = (r, t, e, i) => {
214
+ i ? m.delegate(r, t, e, i) : (i = e, m.bind(r, t, i));
215
215
  };
216
- u.off = (r, t, e) => {
216
+ m.off = (r, t, e) => {
217
217
  r.removeEventListener(t, e);
218
218
  };
219
- u.bind = (r, t, e) => {
219
+ m.bind = (r, t, e) => {
220
220
  t.split(/\s+/).forEach(function(i) {
221
221
  r.addEventListener(i, e);
222
222
  });
223
223
  };
224
- u.delegate = (r, t, e, i) => {
224
+ m.delegate = (r, t, e, i) => {
225
225
  r.addEventListener(t, function(s) {
226
226
  const n = s.target.closest(e);
227
227
  n && (s.delegatedTarget = n, i.call(this, s, n));
228
228
  });
229
229
  };
230
- u.closest = (r, t) => t ? t.matches(r) ? t : u.closest(r, t.parentNode) : null;
231
- u.attr = (r, t, e) => {
230
+ m.closest = (r, t) => t ? t.matches(r) ? t : m.closest(r, t.parentNode) : null;
231
+ m.attr = (r, t, e) => {
232
232
  if (!e && typeof t == "string")
233
233
  return r.getAttribute(t);
234
234
  if (typeof t == "object") {
235
235
  for (let i in t)
236
- u.attr(r, i, t[i]);
236
+ m.attr(r, i, t[i]);
237
237
  return;
238
238
  }
239
239
  r.setAttribute(t, e);
@@ -242,84 +242,84 @@ function I(r, t, e, i, s = "downstream") {
242
242
  if (i === "none" || e === 0) return /* @__PURE__ */ new Map();
243
243
  ["upstream", "downstream", "both"].includes(s) || (console.warn(`[frappe-gantt] compute_dependency_shifts: unknown direction "${s}", falling back to "downstream"`), s = "downstream");
244
244
  const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
245
- for (const d of r)
246
- d._has_no_dates || (n.set(d.id, d), a.set(d.id, []), o.set(d.id, []));
247
- for (const d of r)
248
- if (!d._has_no_dates)
249
- for (const h of d.dependencies || []) {
250
- if (!n.has(h.id)) continue;
251
- const _ = h.type || "finish-to-start";
252
- a.get(d.id).push({ id: h.id, type: _ }), o.get(h.id).push({ id: d.id, type: _ });
245
+ for (const h of r)
246
+ h._has_no_dates || (n.set(h.id, h), a.set(h.id, []), o.set(h.id, []));
247
+ for (const h of r)
248
+ if (!h._has_no_dates)
249
+ for (const d of h.dependencies || []) {
250
+ if (!n.has(d.id)) continue;
251
+ const _ = d.type || "finish-to-start";
252
+ a.get(h.id).push({ id: d.id, type: _ }), o.get(d.id).push({ id: h.id, type: _ });
253
253
  }
254
254
  return i === "maintain_buffer_all" || i === "maintain_buffer_downstream" ? q(t, e, a, o, s === "both", s === "upstream") : i === "consume_buffer" ? U(t, e, n, a, o, s) : /* @__PURE__ */ new Map();
255
255
  }
256
256
  function q(r, t, e, i, s, n) {
257
- const a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([r]), d = [], h = (_) => {
257
+ const a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([r]), h = [], d = (_) => {
258
258
  for (const { id: l } of _)
259
- o.has(l) || (o.add(l), d.push(l));
259
+ o.has(l) || (o.add(l), h.push(l));
260
260
  };
261
- for (n && !s ? h(e.get(r) || []) : (h(i.get(r) || []), s && h(e.get(r) || [])); d.length > 0; ) {
262
- const _ = d.shift();
263
- a.set(_, t), n && !s ? h(e.get(_) || []) : (h(i.get(_) || []), s && h(e.get(_) || []));
261
+ for (n && !s ? d(e.get(r) || []) : (d(i.get(r) || []), s && d(e.get(r) || [])); h.length > 0; ) {
262
+ const _ = h.shift();
263
+ a.set(_, t), n && !s ? d(e.get(_) || []) : (d(i.get(_) || []), s && d(e.get(_) || []));
264
264
  }
265
265
  return a;
266
266
  }
267
267
  function U(r, t, e, i, s, n) {
268
268
  const a = /* @__PURE__ */ new Map();
269
- for (const [c] of e)
270
- a.set(c, (i.get(c) || []).length);
271
- const o = [], d = [];
272
- for (const [c, m] of a)
273
- m === 0 && d.push(c);
274
- for (; d.length > 0; ) {
275
- const c = d.shift();
276
- o.push(c);
277
- for (const { id: m } of s.get(c) || []) {
278
- const f = a.get(m) - 1;
279
- a.set(m, f), f === 0 && d.push(m);
269
+ for (const [p] of e)
270
+ a.set(p, (i.get(p) || []).length);
271
+ const o = [], h = [];
272
+ for (const [p, f] of a)
273
+ f === 0 && h.push(p);
274
+ for (; h.length > 0; ) {
275
+ const p = h.shift();
276
+ o.push(p);
277
+ for (const { id: f } of s.get(p) || []) {
278
+ const u = a.get(f) - 1;
279
+ a.set(f, u), u === 0 && h.push(f);
280
280
  }
281
281
  }
282
- const h = /* @__PURE__ */ new Map([[r, 0]]), _ = (c) => e.get(c)._start.getTime() + (h.get(c) || 0), l = (c) => e.get(c)._end.getTime() + (h.get(c) || 0);
282
+ const d = /* @__PURE__ */ new Map([[r, 0]]), _ = (p) => e.get(p)._start.getTime() + (d.get(p) || 0), l = (p) => e.get(p)._end.getTime() + (d.get(p) || 0);
283
283
  if (n === "downstream" || n === "both")
284
- for (const c of o) {
285
- if (c === r) continue;
286
- let m = 0;
287
- for (const { id: f, type: b } of i.get(c) || []) {
288
- const y = W(f, c, b, _, l);
289
- y > m && (m = y);
284
+ for (const p of o) {
285
+ if (p === r) continue;
286
+ let f = 0;
287
+ for (const { id: u, type: b } of i.get(p) || []) {
288
+ const $ = W(u, p, b, _, l);
289
+ $ > f && (f = $);
290
290
  }
291
- m > 0 && h.set(c, (h.get(c) || 0) + m);
291
+ f > 0 && d.set(p, (d.get(p) || 0) + f);
292
292
  }
293
293
  if (n === "upstream" || n === "both")
294
- for (let c = o.length - 1; c >= 0; c--) {
295
- const m = o[c];
296
- if (m === r) continue;
297
- let f = 0;
298
- for (const { id: b, type: y } of s.get(m) || []) {
299
- const k = W(m, b, y, _, l);
294
+ for (let p = o.length - 1; p >= 0; p--) {
295
+ const f = o[p];
296
+ if (f === r) continue;
297
+ let u = 0;
298
+ for (const { id: b, type: $ } of s.get(f) || []) {
299
+ const k = W(f, b, $, _, l);
300
300
  if (k > 0) {
301
- const $ = -k;
302
- $ < f && (f = $);
301
+ const y = -k;
302
+ y < u && (u = y);
303
303
  }
304
304
  }
305
- f < 0 && h.set(m, (h.get(m) || 0) + f);
305
+ u < 0 && d.set(f, (d.get(f) || 0) + u);
306
306
  }
307
- const p = /* @__PURE__ */ new Map();
308
- for (const [c, m] of h)
309
- c !== r && m !== 0 && p.set(c, m);
310
- return p;
307
+ const c = /* @__PURE__ */ new Map();
308
+ for (const [p, f] of d)
309
+ p !== r && f !== 0 && c.set(p, f);
310
+ return c;
311
311
  }
312
312
  function W(r, t, e, i, s) {
313
- const n = i(r), a = s(r), o = i(t), d = s(t);
313
+ const n = i(r), a = s(r), o = i(t), h = s(t);
314
314
  switch (e) {
315
315
  case "finish-to-start":
316
316
  return a > o ? a - o : 0;
317
317
  case "start-to-start":
318
318
  return n > o ? n - o : 0;
319
319
  case "finish-to-finish":
320
- return a > d ? a - d : 0;
320
+ return a > h ? a - h : 0;
321
321
  case "start-to-finish":
322
- return n > d ? n - d : 0;
322
+ return n > h ? n - h : 0;
323
323
  default:
324
324
  return a > o ? a - o : 0;
325
325
  }
@@ -346,30 +346,30 @@ class Q {
346
346
  return !1;
347
347
  }
348
348
  calculate_path() {
349
- const t = this.gantt.options, e = this.gantt.config, i = t.arrow_curve, s = t.padding, n = this.from_task.$bar.getX() + this.from_task.$bar.getWidth(), a = this.from_task.$bar.getX(), o = this.to_task.$bar.getX() + this.to_task.$bar.getWidth(), d = this.to_task.$bar.getX(), h = (c) => e.header_height + t.bar_height / 2 + (t.padding + t.bar_height) * c.task._index + t.padding / 2, _ = h(this.from_task), l = h(this.to_task), p = (_ + l) / 2;
349
+ const t = this.gantt.options, e = this.gantt.config, i = t.arrow_curve, s = t.padding, n = this.from_task.$bar.getX() + this.from_task.$bar.getWidth(), a = this.from_task.$bar.getX(), o = this.to_task.$bar.getX() + this.to_task.$bar.getWidth(), h = this.to_task.$bar.getX(), d = (p) => e.header_height + t.bar_height / 2 + (t.padding + t.bar_height) * p.task._index + t.padding / 2, _ = d(this.from_task), l = d(this.to_task), c = (_ + l) / 2;
350
350
  switch (this.dependency_type) {
351
351
  case "finish-to-start":
352
352
  this.path = this._path_finish_to_start(
353
353
  n,
354
354
  a,
355
355
  o,
356
- d,
356
+ h,
357
357
  _,
358
358
  l,
359
- p,
359
+ c,
360
360
  s,
361
361
  i
362
- ), this.label_pos = { x: d, y: l, side: "left" };
362
+ ), this.label_pos = { x: h, y: l, side: "left" };
363
363
  break;
364
364
  case "start-to-start":
365
365
  this.path = this._path_start_to_start(
366
366
  a,
367
- d,
367
+ h,
368
368
  _,
369
369
  l,
370
370
  s,
371
371
  i
372
- ), this.label_pos = { x: d, y: l, side: "left" };
372
+ ), this.label_pos = { x: h, y: l, side: "left" };
373
373
  break;
374
374
  case "finish-to-finish":
375
375
  this.path = this._path_finish_to_finish(
@@ -387,7 +387,7 @@ class Q {
387
387
  o,
388
388
  _,
389
389
  l,
390
- p,
390
+ c,
391
391
  s,
392
392
  i
393
393
  ), this.label_pos = { x: o, y: l, side: "right" };
@@ -397,55 +397,55 @@ class Q {
397
397
  n,
398
398
  a,
399
399
  o,
400
- d,
400
+ h,
401
401
  _,
402
402
  l,
403
- p,
403
+ c,
404
404
  s,
405
405
  i
406
- ), this.label_pos = { x: d, y: l, side: "left" };
406
+ ), this.label_pos = { x: h, y: l, side: "left" };
407
407
  }
408
408
  }
409
- _path_finish_to_start(t, e, i, s, n, a, o, d, h) {
410
- const _ = t + d, l = a < n;
409
+ _path_finish_to_start(t, e, i, s, n, a, o, h, d) {
410
+ const _ = t + h, l = a < n;
411
411
  if (_ < s)
412
412
  return l ? `
413
413
  M ${t} ${n}
414
- H ${_ - h}
415
- a ${h} ${h} 0 0 0 ${h} ${-h}
416
- V ${a + h}
417
- a ${h} ${h} 0 0 1 ${h} ${-h}
414
+ H ${_ - d}
415
+ a ${d} ${d} 0 0 0 ${d} ${-d}
416
+ V ${a + d}
417
+ a ${d} ${d} 0 0 1 ${d} ${-d}
418
418
  H ${s}
419
419
  m -5 -5 l 5 5 l -5 5` : `
420
420
  M ${t} ${n}
421
- H ${_ - h}
422
- a ${h} ${h} 0 0 1 ${h} ${h}
423
- V ${a - h}
424
- a ${h} ${h} 0 0 0 ${h} ${h}
421
+ H ${_ - d}
422
+ a ${d} ${d} 0 0 1 ${d} ${d}
423
+ V ${a - d}
424
+ a ${d} ${d} 0 0 0 ${d} ${d}
425
425
  H ${s}
426
426
  m -5 -5 l 5 5 l -5 5`;
427
- const p = s - d;
427
+ const c = s - h;
428
428
  return l ? `
429
429
  M ${t} ${n}
430
- H ${_ - h}
431
- a ${h} ${h} 0 0 0 ${h} ${-h}
432
- V ${o + h}
433
- a ${h} ${h} 0 0 0 ${-h} ${-h}
434
- H ${p + h}
435
- a ${h} ${h} 0 0 1 ${-h} ${-h}
436
- V ${a + h}
437
- a ${h} ${h} 0 0 1 ${h} ${-h}
430
+ H ${_ - d}
431
+ a ${d} ${d} 0 0 0 ${d} ${-d}
432
+ V ${o + d}
433
+ a ${d} ${d} 0 0 0 ${-d} ${-d}
434
+ H ${c + d}
435
+ a ${d} ${d} 0 0 1 ${-d} ${-d}
436
+ V ${a + d}
437
+ a ${d} ${d} 0 0 1 ${d} ${-d}
438
438
  H ${s}
439
439
  m -5 -5 l 5 5 l -5 5` : `
440
440
  M ${t} ${n}
441
- H ${_ - h}
442
- a ${h} ${h} 0 0 1 ${h} ${h}
443
- V ${o - h}
444
- a ${h} ${h} 0 0 1 ${-h} ${h}
445
- H ${p + h}
446
- a ${h} ${h} 0 0 0 ${-h} ${h}
447
- V ${a - h}
448
- a ${h} ${h} 0 0 0 ${h} ${h}
441
+ H ${_ - d}
442
+ a ${d} ${d} 0 0 1 ${d} ${d}
443
+ V ${o - d}
444
+ a ${d} ${d} 0 0 1 ${-d} ${d}
445
+ H ${c + d}
446
+ a ${d} ${d} 0 0 0 ${-d} ${d}
447
+ V ${a - d}
448
+ a ${d} ${d} 0 0 0 ${d} ${d}
449
449
  H ${s}
450
450
  m -5 -5 l 5 5 l -5 5`;
451
451
  }
@@ -486,39 +486,39 @@ class Q {
486
486
  m 5 -5 l -5 5 l 5 5`;
487
487
  }
488
488
  _path_start_to_finish(t, e, i, s, n, a, o) {
489
- const d = t - a, h = e + a, _ = s < i;
490
- return h < d + 2 * o ? _ ? `
489
+ const h = t - a, d = e + a, _ = s < i;
490
+ return d < h + 2 * o ? _ ? `
491
491
  M ${t} ${i}
492
- H ${d + o}
492
+ H ${h + o}
493
493
  a ${o} ${o} 0 0 1 ${-o} ${-o}
494
494
  V ${s + o}
495
495
  a ${o} ${o} 0 0 0 ${-o} ${-o}
496
496
  H ${e}
497
497
  m 5 -5 l -5 5 l 5 5` : `
498
498
  M ${t} ${i}
499
- H ${d + o}
499
+ H ${h + o}
500
500
  a ${o} ${o} 0 0 0 ${-o} ${o}
501
501
  V ${s - o}
502
502
  a ${o} ${o} 0 0 1 ${-o} ${o}
503
503
  H ${e}
504
504
  m 5 -5 l -5 5 l 5 5` : _ ? `
505
505
  M ${t} ${i}
506
- H ${d + o}
506
+ H ${h + o}
507
507
  a ${o} ${o} 0 0 1 ${-o} ${-o}
508
508
  V ${n + o}
509
509
  a ${o} ${o} 0 0 1 ${o} ${-o}
510
- H ${h - o}
510
+ H ${d - o}
511
511
  a ${o} ${o} 0 0 0 ${o} ${-o}
512
512
  V ${s + o}
513
513
  a ${o} ${o} 0 0 0 ${-o} ${-o}
514
514
  H ${e}
515
515
  m 5 -5 l -5 5 l 5 5` : `
516
516
  M ${t} ${i}
517
- H ${d + o}
517
+ H ${h + o}
518
518
  a ${o} ${o} 0 0 0 ${-o} ${o}
519
519
  V ${n - o}
520
520
  a ${o} ${o} 0 0 0 ${o} ${o}
521
- H ${h - o}
521
+ H ${d - o}
522
522
  a ${o} ${o} 0 0 1 ${o} ${o}
523
523
  V ${s - o}
524
524
  a ${o} ${o} 0 0 1 ${-o} ${o}
@@ -572,21 +572,21 @@ class Q {
572
572
  }
573
573
  _show_label() {
574
574
  if (this.label_element) return;
575
- const t = this._get_type_abbr(), e = 21, i = 20, { x: s, y: n, side: a } = this.label_pos, o = a === "left" ? s - 10 - e / 2 : s + 10 + e / 2, d = n;
575
+ const t = this._get_type_abbr(), e = 21, i = 20, { x: s, y: n, side: a } = this.label_pos, o = a === "left" ? s - 10 - e / 2 : s + 10 + e / 2, h = n;
576
576
  this.label_element = w("g", { class: "arrow-type-label" });
577
- const h = w("rect", {
577
+ const d = w("rect", {
578
578
  x: o - e / 2,
579
- y: d - i / 2,
579
+ y: h - i / 2,
580
580
  width: e,
581
581
  height: i,
582
582
  rx: 3
583
583
  }), _ = w("text", {
584
584
  x: o,
585
- y: d,
585
+ y: h,
586
586
  "dominant-baseline": "middle",
587
587
  "text-anchor": "middle"
588
588
  });
589
- _.textContent = t, this.label_element.appendChild(h), this.label_element.appendChild(_), this.label_element.addEventListener("mouseenter", () => {
589
+ _.textContent = t, this.label_element.appendChild(d), this.label_element.appendChild(_), this.label_element.addEventListener("mouseenter", () => {
590
590
  this.hit_element.dispatchEvent(new MouseEvent("mouseenter", { bubbles: !1 }));
591
591
  }), this.label_element.addEventListener("mouseleave", () => {
592
592
  this.hit_element.dispatchEvent(new MouseEvent("mouseleave", { bubbles: !1 }));
@@ -605,22 +605,22 @@ class Q {
605
605
  { abbr: "FF", label: "Finish to Finish", value: "finish-to-finish" },
606
606
  { abbr: "SF", label: "Start to Finish", value: "start-to-finish" }
607
607
  ];
608
- this.type_dropdown = document.createElement("div"), this.type_dropdown.className = "arrow-type-dropdown", this.type_dropdown.addEventListener("click", (a) => a.stopPropagation()), t.forEach(({ abbr: a, label: o, value: d }) => {
609
- const h = document.createElement("div");
610
- h.className = "arrow-type-option" + (d === this.dependency_type ? " active" : "");
608
+ this.type_dropdown = document.createElement("div"), this.type_dropdown.className = "arrow-type-dropdown", this.type_dropdown.addEventListener("click", (a) => a.stopPropagation()), t.forEach(({ abbr: a, label: o, value: h }) => {
609
+ const d = document.createElement("div");
610
+ d.className = "arrow-type-option" + (h === this.dependency_type ? " active" : "");
611
611
  const _ = document.createElement("strong");
612
612
  _.textContent = a;
613
613
  const l = document.createElement("span");
614
- l.textContent = o, h.appendChild(_), h.appendChild(l), h.addEventListener("click", (p) => {
615
- p.stopPropagation(), this.gantt.change_dependency_type(this, d);
616
- }), this.type_dropdown.appendChild(h);
614
+ l.textContent = o, d.appendChild(_), d.appendChild(l), d.addEventListener("click", (c) => {
615
+ c.stopPropagation(), this.gantt.change_dependency_type(this, h);
616
+ }), this.type_dropdown.appendChild(d);
617
617
  }), this.gantt.$container.appendChild(this.type_dropdown);
618
618
  const e = this.label_element.getBoundingClientRect(), i = this.gantt.$container.getBoundingClientRect();
619
619
  this.type_dropdown.style.top = e.bottom - i.top + this.gantt.$container.scrollTop + "px", this.type_dropdown.style.left = e.left - i.left + this.gantt.$container.scrollLeft + "px";
620
620
  const s = this.label_element.querySelector("text"), n = this.label_element.querySelector("rect");
621
621
  if (s && (s.textContent = this._get_type_abbr() + " ▾"), n) {
622
- const o = parseFloat(n.getAttribute("width")), d = parseFloat(n.getAttribute("x")) + o / 2;
623
- n.setAttribute("x", String(d - 34 / 2)), n.setAttribute("width", String(34));
622
+ const o = parseFloat(n.getAttribute("width")), h = parseFloat(n.getAttribute("x")) + o / 2;
623
+ n.setAttribute("x", String(h - 34 / 2)), n.setAttribute("width", String(34));
624
624
  }
625
625
  }
626
626
  _hide_type_dropdown() {
@@ -756,9 +756,9 @@ class B {
756
756
  this.$date_highlight = i, this.gantt.$lower_header.prepend(this.$date_highlight), C(this.$bar_progress, "width", 0, this.progress_width);
757
757
  }
758
758
  calculate_progress_width() {
759
- const t = this.$bar.getWidth(), e = this.x + t, i = this.gantt.config.ignored_positions.reduce((d, h) => d + (h >= this.x && h < e), 0) * this.gantt.config.column_width;
759
+ 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;
760
760
  let s = (t - i) * this.task.progress / 100;
761
- const n = this.x + s, a = this.gantt.config.ignored_positions.reduce((d, h) => d + (h >= this.x && h < n), 0) * this.gantt.config.column_width;
761
+ const n = this.x + s, a = this.gantt.config.ignored_positions.reduce((h, d) => h + (d >= this.x && d < n), 0) * this.gantt.config.column_width;
762
762
  s += a;
763
763
  let o = this.gantt.get_ignored_region(
764
764
  this.x + s
@@ -772,7 +772,7 @@ class B {
772
772
  draw_label() {
773
773
  let t = this.x + this.$bar.getWidth() / 2;
774
774
  this.task.thumbnail && (t = this.x + this.image_size + 5);
775
- const e = this.gantt.options.show_bar_label ? this.task.bar_label || this.task.name : "";
775
+ const e = this.gantt.options.show_bar_label ? this.task.bar_label ?? this.task.name : "";
776
776
  this.$bar_label = w("text", {
777
777
  x: t,
778
778
  y: this.y + this.height / 2,
@@ -844,15 +844,15 @@ class B {
844
844
  y2: s + 20 / 2,
845
845
  class: "add-task-icon-plus",
846
846
  append_to: this.$add_icon_group
847
- }), u.on(this.$add_icon_group, "mousedown", (n) => {
847
+ }), m.on(this.$add_icon_group, "mousedown", (n) => {
848
848
  n.stopPropagation();
849
- }), u.on(this.$add_icon_group, "mouseup", (n) => {
849
+ }), m.on(this.$add_icon_group, "mouseup", (n) => {
850
850
  n.stopPropagation();
851
- }), u.on(this.$add_icon_group, "click", (n) => {
851
+ }), m.on(this.$add_icon_group, "click", (n) => {
852
852
  n.stopPropagation(), this.gantt.trigger_event("task_add", [this.task]);
853
- }), u.on(this.$add_icon_group, "mouseenter", (n) => {
853
+ }), m.on(this.$add_icon_group, "mouseenter", (n) => {
854
854
  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();
855
- }), u.on(this.$add_icon_group, "mouseleave", () => {
855
+ }), m.on(this.$add_icon_group, "mouseleave", () => {
856
856
  this.is_hovering_icon = !1, this.$add_icon_group.classList.remove("active"), this.is_hovering_bar || this.$add_icon_group.classList.add("hide");
857
857
  });
858
858
  }
@@ -892,7 +892,7 @@ class B {
892
892
  }), this.handles.push(this.$handle_progress);
893
893
  }
894
894
  for (let i of this.handles)
895
- u.on(i, "mouseenter", () => i.classList.add("active")), u.on(i, "mouseleave", () => i.classList.remove("active"));
895
+ m.on(i, "mouseenter", () => i.classList.add("active")), m.on(i, "mouseleave", () => i.classList.remove("active"));
896
896
  }
897
897
  draw_connector_circles() {
898
898
  if (this.$connector_start = null, this.$connector_end = null, !this.gantt.options.allow_dependency_creation || this.gantt.options.readonly) return;
@@ -923,86 +923,86 @@ class B {
923
923
  }
924
924
  unbind() {
925
925
  this.invalid || this.group && this.event_listeners && (this.event_listeners.forEach(({ event: t, handler: e }) => {
926
- u.off(this.group, t, e);
926
+ m.off(this.group, t, e);
927
927
  }), this.event_listeners = []);
928
928
  }
929
929
  setup_click_event() {
930
930
  this.event_listeners = [];
931
931
  let t = this.task.id;
932
- const e = (p) => {
932
+ const e = (c) => {
933
933
  this.gantt.trigger_event("hover", [
934
934
  this.task,
935
- p.screenX,
936
- p.screenY,
937
- p
935
+ c.screenX,
936
+ c.screenY,
937
+ c
938
938
  ]);
939
939
  };
940
- if (u.on(this.group, "mouseover", e), this.event_listeners.push({ event: "mouseover", handler: e }), this.gantt.options.popup_on === "click") {
941
- const p = (c) => {
942
- const m = c.offsetX || c.layerX;
940
+ if (m.on(this.group, "mouseover", e), this.event_listeners.push({ event: "mouseover", handler: e }), this.gantt.options.popup_on === "click") {
941
+ const c = (p) => {
942
+ const f = p.offsetX || p.layerX;
943
943
  if (this.$handle_progress) {
944
- const f = +this.$handle_progress.getAttribute("cx");
945
- if (f > m - 1 && f < m + 1 || this.gantt.bar_being_dragged) return;
944
+ const u = +this.$handle_progress.getAttribute("cx");
945
+ if (u > f - 1 && u < f + 1 || this.gantt.bar_being_dragged) return;
946
946
  }
947
947
  this.gantt.show_popup({
948
- x: c.offsetX || c.layerX,
949
- y: c.offsetY || c.layerY,
948
+ x: p.offsetX || p.layerX,
949
+ y: p.offsetY || p.layerY,
950
950
  task: this.task,
951
951
  target: this.$bar
952
952
  });
953
953
  };
954
- u.on(this.group, "click", p), this.event_listeners.push({ event: "click", handler: p });
954
+ m.on(this.group, "click", c), this.event_listeners.push({ event: "click", handler: c });
955
955
  }
956
956
  let i;
957
- const s = (p) => {
957
+ const s = (c) => {
958
958
  i = setTimeout(() => {
959
959
  this.gantt.options.popup_on === "hover" && this.gantt.show_popup({
960
- x: p.offsetX || p.layerX,
961
- y: p.offsetY || p.layerY,
960
+ x: c.offsetX || c.layerX,
961
+ y: c.offsetY || c.layerY,
962
962
  task: this.task,
963
963
  target: this.$bar
964
964
  });
965
- const c = this.gantt.$container.querySelector(`.highlight-${CSS.escape(t)}`);
966
- c && c.classList.remove("hide");
965
+ const p = this.gantt.$container.querySelector(`.highlight-${CSS.escape(t)}`);
966
+ p && p.classList.remove("hide");
967
967
  }, 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"));
968
968
  };
969
- u.on(this.group, "mouseenter", s), this.event_listeners.push({ event: "mouseenter", handler: s });
969
+ m.on(this.group, "mouseenter", s), this.event_listeners.push({ event: "mouseenter", handler: s });
970
970
  const n = () => {
971
- var c, m;
972
- clearTimeout(i), this.gantt.options.popup_on === "hover" && ((m = (c = this.gantt.popup) == null ? void 0 : c.hide) == null || m.call(c));
973
- const p = this.gantt.$container.querySelector(`.highlight-${CSS.escape(t)}`);
974
- p && p.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(() => {
971
+ var p, f;
972
+ clearTimeout(i), this.gantt.options.popup_on === "hover" && ((f = (p = this.gantt.popup) == null ? void 0 : p.hide) == null || f.call(p));
973
+ const c = this.gantt.$container.querySelector(`.highlight-${CSS.escape(t)}`);
974
+ c && c.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(() => {
975
975
  this.is_hovering_icon || this.$add_icon_group.classList.add("hide");
976
976
  }, 200));
977
977
  };
978
- u.on(this.group, "mouseleave", n), this.event_listeners.push({ event: "mouseleave", handler: n });
978
+ m.on(this.group, "mouseleave", n), this.event_listeners.push({ event: "mouseleave", handler: n });
979
979
  const a = () => {
980
980
  this.is_dragging = !0, this.hide_add_icon();
981
981
  };
982
- u.on(this.group, "mousedown", a), this.event_listeners.push({ event: "mousedown", handler: a });
982
+ m.on(this.group, "mousedown", a), this.event_listeners.push({ event: "mousedown", handler: a });
983
983
  const o = () => {
984
984
  setTimeout(() => {
985
985
  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"));
986
986
  }, 0);
987
987
  };
988
- u.on(this.group, "mouseup", o), this.event_listeners.push({ event: "mouseup", handler: o });
989
- const d = () => {
988
+ m.on(this.group, "mouseup", o), this.event_listeners.push({ event: "mouseup", handler: o });
989
+ const h = () => {
990
990
  this.action_completed || this.gantt.bar_being_dragged || this.gantt.trigger_event("click", [this.task]);
991
991
  };
992
- u.on(this.group, "click", d), this.event_listeners.push({ event: "click", handler: d });
993
- const h = () => {
992
+ m.on(this.group, "click", h), this.event_listeners.push({ event: "click", handler: h });
993
+ const d = () => {
994
994
  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]));
995
995
  };
996
- u.on(this.group, "dblclick", h), this.event_listeners.push({ event: "dblclick", handler: h });
996
+ m.on(this.group, "dblclick", d), this.event_listeners.push({ event: "dblclick", handler: d });
997
997
  let _ = !1;
998
- const l = (p) => {
998
+ const l = (c) => {
999
999
  if (!_)
1000
1000
  return _ = !0, setTimeout(function() {
1001
1001
  _ = !1;
1002
1002
  }, 300), !1;
1003
- p.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]));
1003
+ c.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]));
1004
1004
  };
1005
- u.on(this.group, "touchstart", l), this.event_listeners.push({ event: "touchstart", handler: l });
1005
+ m.on(this.group, "touchstart", l), this.event_listeners.push({ event: "touchstart", handler: l });
1006
1006
  }
1007
1007
  update_bar_position({ x: t = null, width: e = null }) {
1008
1008
  const i = this.$bar;
@@ -1010,8 +1010,8 @@ class B {
1010
1010
  }
1011
1011
  update_label_position_on_horizontal_scroll({ x: t, sx: e }) {
1012
1012
  const i = this.gantt.$container, s = this.group.querySelector(".bar-label"), n = this.group.querySelector(".bar-img") || "", a = this.bar_group.querySelector(".img_mask") || "";
1013
- let o = this.$bar.getX() + this.$bar.getWidth(), d = s.getX() + t, h = n && n.getX() + t || 0, _ = n && n.getBBox().width + 7 || 7, l = d + s.getBBox().width + 7, p = e + i.clientWidth / 2;
1014
- s.classList.contains("big") || (l < o && t > 0 && l < p || d - _ > this.$bar.getX() && t < 0 && l > p) && (s.setAttribute("x", d), n && (n.setAttribute("x", h), a.setAttribute("x", h)));
1013
+ let o = 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, c = e + i.clientWidth / 2;
1014
+ s.classList.contains("big") || (l < o && t > 0 && l < c || h - _ > this.$bar.getX() && t < 0 && l > c) && (s.setAttribute("x", h), n && (n.setAttribute("x", d), a.setAttribute("x", d)));
1015
1015
  }
1016
1016
  date_changed() {
1017
1017
  let t = !1;
@@ -1095,13 +1095,13 @@ class B {
1095
1095
  update_label_position() {
1096
1096
  const t = this.bar_group.querySelector(".img_mask") || "", e = this.$bar, i = this.group.querySelector(".bar-label"), s = this.group.querySelector(".bar-img");
1097
1097
  let n = 5, a = this.image_size + 10;
1098
- const o = i.getBBox().width, d = e.getWidth();
1099
- o > d ? (i.classList.add("big"), s ? (s.setAttribute("x", e.getEndX() + n), t.setAttribute("x", e.getEndX() + n), i.setAttribute("x", e.getEndX() + a)) : 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(
1098
+ const o = i.getBBox().width, h = e.getWidth();
1099
+ o > h ? (i.classList.add("big"), s ? (s.setAttribute("x", e.getEndX() + n), t.setAttribute("x", e.getEndX() + n), i.setAttribute("x", e.getEndX() + a)) : 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(
1100
1100
  "x",
1101
- e.getX() + d / 2 + a
1101
+ e.getX() + h / 2 + a
1102
1102
  )) : i.setAttribute(
1103
1103
  "x",
1104
- e.getX() + d / 2 - o / 2
1104
+ e.getX() + h / 2 - o / 2
1105
1105
  ));
1106
1106
  }
1107
1107
  update_handle_position() {
@@ -1157,12 +1157,12 @@ class K {
1157
1157
  get_details: () => this.details,
1158
1158
  set_details: (a) => this.details.innerHTML = a,
1159
1159
  add_action: (a, o) => {
1160
- let d = this.gantt.create_el({
1160
+ let h = this.gantt.create_el({
1161
1161
  classes: "action-btn",
1162
1162
  type: "button",
1163
1163
  append_to: this.actions
1164
1164
  });
1165
- typeof a == "function" && (a = a(i)), d.innerHTML = a, d.onclick = (h) => o(i, this.gantt, h);
1165
+ typeof a == "function" && (a = a(i)), h.innerHTML = a, h.onclick = (d) => o(i, this.gantt, d);
1166
1166
  }
1167
1167
  });
1168
1168
  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"));
@@ -1418,9 +1418,9 @@ class tt {
1418
1418
  return console.error(`task "${e.id}" doesn't have an end date`), !1;
1419
1419
  }
1420
1420
  if (!e._has_no_dates) {
1421
- if (e._start = g.parse(e.start), e.end === void 0 && e.duration !== void 0 && (e.end = e._start, e.duration.split(" ").forEach((d) => {
1422
- let { duration: h, scale: _ } = g.parse_duration(d);
1423
- e.end = g.add(e.end, h, _);
1421
+ if (e._start = g.parse(e.start), e.end === void 0 && e.duration !== void 0 && (e.end = e._start, e.duration.split(" ").forEach((h) => {
1422
+ let { duration: d, scale: _ } = g.parse_duration(h);
1423
+ e.end = g.add(e.end, d, _);
1424
1424
  })), e._end = g.parse(e.end), g.diff(e._end, e._start, "year") < 0)
1425
1425
  return console.error(
1426
1426
  `start of task can't be after end of task: in task "${e.id}"`
@@ -1552,7 +1552,7 @@ class tt {
1552
1552
  height: e,
1553
1553
  class: "grid-background",
1554
1554
  append_to: this.$svg
1555
- }), u.attr(this.$svg, {
1555
+ }), m.attr(this.$svg, {
1556
1556
  height: e,
1557
1557
  width: "100%"
1558
1558
  }), this.grid_height = e, this.options.container_height === "auto" && (this.$container.style.height = e + "px");
@@ -1606,12 +1606,12 @@ class tt {
1606
1606
  }
1607
1607
  }
1608
1608
  make_task_column() {
1609
- var i, s, n, a, o, d, h, _, l, p;
1609
+ var i, s, n, a, o, h, d, _, l, c;
1610
1610
  if ((i = this.$task_column) == null || i.remove(), !((s = this.options.task_column) != null && s.enabled)) {
1611
1611
  (a = (n = this.$wrapper) == null ? void 0 : n.classList) == null || a.remove("has-task-column");
1612
1612
  return;
1613
1613
  }
1614
- (d = (o = this.$wrapper) == null ? void 0 : o.classList) == null || d.add("has-task-column"), this.$task_column = this.create_el({
1614
+ (h = (o = this.$wrapper) == null ? void 0 : o.classList) == null || h.add("has-task-column"), this.$task_column = this.create_el({
1615
1615
  classes: "task-column",
1616
1616
  append_to: this.$wrapper
1617
1617
  }), this.$wrapper.insertBefore(this.$task_column, this.$container), this.$task_column_header = this.create_el({
@@ -1631,21 +1631,21 @@ class tt {
1631
1631
  ), this.$container.style.setProperty(
1632
1632
  "--gv-task-column-content-height",
1633
1633
  e + "px"
1634
- ), this.tasks.forEach((c) => {
1635
- const m = this.options.bar_height + this.options.padding, f = this.create_el({
1634
+ ), this.tasks.forEach((p) => {
1635
+ const f = this.options.bar_height + this.options.padding, u = this.create_el({
1636
1636
  classes: "task-row",
1637
1637
  append_to: this.$task_column_content
1638
1638
  });
1639
- if (f.style.top = c._index * m - 1 + "px", f.style.height = m + "px", this.options.task_column.content && typeof this.options.task_column.content == "function") {
1640
- const b = this.options.task_column.content(c);
1641
- typeof b == "string" ? f.innerHTML = b : b instanceof HTMLElement && f.appendChild(b);
1639
+ if (u.style.top = p._index * f - 1 + "px", u.style.height = f + "px", this.options.task_column.content && typeof this.options.task_column.content == "function") {
1640
+ const b = this.options.task_column.content(p);
1641
+ typeof b == "string" ? u.innerHTML = b : b instanceof HTMLElement && u.appendChild(b);
1642
1642
  } else
1643
- f.textContent = c.name, f.title = c.name;
1644
- f.setAttribute("data-task-id", c.id);
1643
+ u.textContent = p.name, u.title = p.name;
1644
+ u.setAttribute("data-task-id", p.id);
1645
1645
  }), this.$task_column.style.width = this.options.task_column.width + "px", this.$task_column_resize_handle = this.create_el({
1646
1646
  classes: "task-column-resize-handle",
1647
1647
  append_to: this.$task_column
1648
- }), this.options.isRTL ? (_ = (h = this.$wrapper) == null ? void 0 : h.classList) == null || _.add("rtl") : (p = (l = this.$wrapper) == null ? void 0 : l.classList) == null || p.remove("rtl");
1648
+ }), this.options.isRTL ? (_ = (d = this.$wrapper) == null ? void 0 : d.classList) == null || _.add("rtl") : (c = (l = this.$wrapper) == null ? void 0 : l.classList) == null || c.remove("rtl");
1649
1649
  }
1650
1650
  make_grid_ticks() {
1651
1651
  if (this.options.lines === "none") return;
@@ -1655,7 +1655,7 @@ class tt {
1655
1655
  }), n = this.config.header_height;
1656
1656
  const a = this.dates.length * this.config.column_width, o = this.options.bar_height + this.options.padding;
1657
1657
  if (this.options.lines !== "vertical")
1658
- for (let d = this.config.header_height; d < this.grid_height; d += o)
1658
+ for (let h = this.config.header_height; h < this.grid_height; h += o)
1659
1659
  w("line", {
1660
1660
  x1: 0,
1661
1661
  y1: n + o,
@@ -1665,13 +1665,13 @@ class tt {
1665
1665
  append_to: s
1666
1666
  }), n += o;
1667
1667
  if (this.options.lines !== "horizontal")
1668
- for (let d of this.dates) {
1669
- let h = "tick";
1670
- this.config.view_mode.thick_line && this.config.view_mode.thick_line(d) && (h += " thick"), w("path", {
1668
+ for (let h of this.dates) {
1669
+ let d = "tick";
1670
+ this.config.view_mode.thick_line && this.config.view_mode.thick_line(h) && (d += " thick"), w("path", {
1671
1671
  d: `M ${t} ${e} v ${i}`,
1672
- class: h,
1672
+ class: d,
1673
1673
  append_to: this.layers.grid
1674
- }), this.view_is("month") ? t += g.get_days_in_month(d) * this.config.column_width / 30 : this.view_is("year") ? t += g.get_days_in_year(d) * this.config.column_width / 365 : t += this.config.column_width;
1674
+ }), this.view_is("month") ? t += g.get_days_in_month(h) * this.config.column_width / 30 : this.view_is("year") ? t += g.get_days_in_year(h) * this.config.column_width / 365 : t += this.config.column_width;
1675
1675
  }
1676
1676
  }
1677
1677
  highlight_holidays() {
@@ -1689,8 +1689,8 @@ class tt {
1689
1689
  } else
1690
1690
  i = (a) => this.options.holidays[e].filter((o) => typeof o != "function").map((o) => {
1691
1691
  if (o.name) {
1692
- let d = /* @__PURE__ */ new Date(o.date + " ");
1693
- return t[d] = o.name, d.getTime();
1692
+ let h = /* @__PURE__ */ new Date(o.date + " ");
1693
+ return t[h] = o.name, h.getTime();
1694
1694
  }
1695
1695
  return (/* @__PURE__ */ new Date(o + " ")).getTime();
1696
1696
  }).includes(a.getTime());
@@ -1703,13 +1703,13 @@ class tt {
1703
1703
  n,
1704
1704
  this.gantt_start,
1705
1705
  this.config.unit
1706
- ) / this.config.step * this.config.column_width, o = this.grid_height - this.config.header_height, d = g.format(n, "YYYY-MM-DD", this.options.language).replace(" ", "_");
1706
+ ) / this.config.step * this.config.column_width, o = this.grid_height - this.config.header_height, h = g.format(n, "YYYY-MM-DD", this.options.language).replace(" ", "_");
1707
1707
  if (t[n]) {
1708
- let h = this.create_el({
1709
- classes: "holiday-label label_" + d,
1708
+ let d = this.create_el({
1709
+ classes: "holiday-label label_" + h,
1710
1710
  append_to: this.$extras
1711
1711
  });
1712
- h.textContent = t[n];
1712
+ d.textContent = t[n];
1713
1713
  }
1714
1714
  w("rect", {
1715
1715
  x: Math.round(a),
@@ -1719,7 +1719,7 @@ class tt {
1719
1719
  "day"
1720
1720
  ),
1721
1721
  height: o,
1722
- class: "holiday-highlight " + d,
1722
+ class: "holiday-highlight " + h,
1723
1723
  style: `fill: ${e};`,
1724
1724
  append_to: this.layers.grid
1725
1725
  });
@@ -1788,10 +1788,10 @@ class tt {
1788
1788
  this.config.view_mode
1789
1789
  );
1790
1790
  }
1791
- create_el({ left: t, top: e, width: i, height: s, id: n, classes: a, append_to: o, type: d }) {
1792
- let h = document.createElement(d || "div");
1793
- for (let _ of a.split(" ")) h.classList.add(_);
1794
- return h.style.top = e + "px", h.style.left = t + "px", n && (h.id = n), i && (h.style.width = i + "px"), s && (h.style.height = s + "px"), o && o.appendChild(h), h;
1791
+ create_el({ left: t, top: e, width: i, height: s, id: n, classes: a, append_to: o, type: h }) {
1792
+ let d = document.createElement(h || "div");
1793
+ for (let _ of a.split(" ")) d.classList.add(_);
1794
+ 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"), o && o.appendChild(d), d;
1795
1795
  }
1796
1796
  make_dates() {
1797
1797
  this.get_dates_to_draw().forEach((t, e) => {
@@ -1871,53 +1871,77 @@ class tt {
1871
1871
  if (!s) return;
1872
1872
  const n = this.bars[s._index], a = this.bars[t._index];
1873
1873
  if (!n || !a) return;
1874
- const o = i.type || this.options.dependencies_type || "finish-to-start", d = new Q(
1874
+ const o = i.type || this.options.dependencies_type || "finish-to-start", h = new Q(
1875
1875
  this,
1876
1876
  n,
1877
1877
  a,
1878
1878
  o
1879
1879
  );
1880
- return this.layers.arrow.appendChild(d.element), this.layers.arrow.appendChild(d.hit_element), d;
1880
+ return this.layers.arrow.appendChild(h.element), this.layers.arrow.appendChild(h.hit_element), h;
1881
1881
  }).filter(Boolean), this.arrows = this.arrows.concat(e);
1882
1882
  }
1883
1883
  }
1884
1884
  calculate_critical_path() {
1885
- this.tasks.forEach((n) => n._is_critical = !1);
1886
- const t = {};
1887
- this.tasks.forEach((n) => {
1888
- t[n.id] = { es: 0, ef: 0, ls: 0, lf: 0 };
1885
+ if (this.tasks.forEach((_) => _._is_critical = !1), this.tasks.length === 0) return;
1886
+ const t = (_) => g.diff(_._end, _._start, "hour") / 24;
1887
+ let e = this.tasks[0]._start;
1888
+ this.tasks.forEach((_) => {
1889
+ _._start < e && (e = _._start);
1889
1890
  });
1890
- const e = (n) => {
1891
- if (t[n.id].ef > 0) return t[n.id];
1892
- let a = 0;
1893
- n.dependencies && n.dependencies.length > 0 && n.dependencies.forEach((d) => {
1894
- const h = this.get_task(d.id);
1895
- if (h) {
1896
- const _ = e(h);
1897
- a = Math.max(a, _.ef);
1898
- }
1899
- }), t[n.id].es = a;
1900
- const o = g.diff(n._end, n._start, "hour") / 24;
1901
- return t[n.id].ef = a + o, t[n.id];
1902
- };
1903
- this.tasks.forEach((n) => e(n));
1904
- const i = Math.max(...Object.values(t).map((n) => n.ef)), s = (n) => {
1905
- if (t[n.id].ls > 0 || t[n.id].lf > 0)
1906
- return t[n.id];
1907
- const a = this.tasks.filter(
1908
- (h) => h.dependencies && h.dependencies.some((_) => _.id === n.id)
1909
- );
1910
- let o = i;
1911
- a.length > 0 && a.forEach((h) => {
1912
- const _ = s(h);
1913
- o = Math.min(o, _.ls);
1891
+ const i = (_) => g.diff(_._start, e, "hour") / 24, s = (_) => _.type || this.options.dependencies_type || "finish-to-start", n = {};
1892
+ this.tasks.forEach((_) => {
1893
+ n[_.id] = {
1894
+ d: t(_),
1895
+ s: i(_),
1896
+ es: 0,
1897
+ ef: 0,
1898
+ ls: 0,
1899
+ lf: 0,
1900
+ f_done: !1,
1901
+ b_done: !1
1902
+ };
1903
+ });
1904
+ const a = {};
1905
+ this.tasks.forEach((_) => a[_.id] = []), this.tasks.forEach((_) => {
1906
+ (_.dependencies || []).forEach((l) => {
1907
+ n[l.id] && a[l.id].push({ id: _.id, type: s(l) });
1914
1908
  });
1915
- const d = g.diff(n._end, n._start, "hour") / 24;
1916
- return t[n.id].lf = o, t[n.id].ls = o - d, t[n.id];
1909
+ });
1910
+ const o = (_, l) => {
1911
+ const c = n[_.id];
1912
+ if (c.f_done || l.has(_.id)) return c;
1913
+ l.add(_.id);
1914
+ let p = c.s, f = !1;
1915
+ return (_.dependencies || []).forEach((u) => {
1916
+ const b = this.get_task(u.id);
1917
+ if (!b || !n[u.id]) return;
1918
+ const $ = o(b, l), k = s(u);
1919
+ let y;
1920
+ k === "start-to-start" ? y = $.es : k === "finish-to-finish" ? y = $.ef - c.d : k === "start-to-finish" ? y = $.es - c.d : y = $.ef, p = f ? Math.max(p, y) : y, f = !0;
1921
+ }), c.es = p, c.ef = p + c.d, c.f_done = !0, l.delete(_.id), c;
1922
+ };
1923
+ this.tasks.forEach((_) => o(_, /* @__PURE__ */ new Set()));
1924
+ const h = Math.max(...this.tasks.map((_) => n[_.id].ef)), d = (_, l) => {
1925
+ const c = n[_.id];
1926
+ if (c.b_done || l.has(_.id)) return c;
1927
+ l.add(_.id);
1928
+ const p = a[_.id];
1929
+ let f;
1930
+ if (p.length === 0)
1931
+ f = h;
1932
+ else {
1933
+ let u = !1;
1934
+ p.forEach((b) => {
1935
+ const $ = d(this.get_task(b.id), l);
1936
+ let k;
1937
+ b.type === "start-to-start" ? k = $.ls + c.d : b.type === "finish-to-finish" ? k = $.lf : b.type === "start-to-finish" ? k = $.lf + c.d : k = $.ls, f = u ? Math.min(f, k) : k, u = !0;
1938
+ });
1939
+ }
1940
+ return c.lf = f, c.ls = f - c.d, c.b_done = !0, l.delete(_.id), c;
1917
1941
  };
1918
- this.tasks.forEach((n) => s(n)), this.tasks.forEach((n) => {
1919
- const a = t[n.id], o = a.ls - a.es;
1920
- n._is_critical = Math.abs(o) < 0.01;
1942
+ this.tasks.forEach((_) => d(_, /* @__PURE__ */ new Set())), this.tasks.forEach((_) => {
1943
+ const l = n[_.id];
1944
+ _._is_critical = Math.abs(l.ls - l.es) < 0.01;
1921
1945
  });
1922
1946
  }
1923
1947
  update_arrow_critical_path() {
@@ -2016,7 +2040,7 @@ class tt {
2016
2040
  ];
2017
2041
  }
2018
2042
  bind_grid_click() {
2019
- u.on(
2043
+ m.on(
2020
2044
  this.$container,
2021
2045
  "click",
2022
2046
  ".grid-row, .grid-header, .ignored-bar, .holiday-highlight",
@@ -2024,9 +2048,9 @@ class tt {
2024
2048
  if (e && (e.classList.contains("grid-row") || e.classList.contains("ignored-bar") || e.classList.contains("holiday-highlight"))) {
2025
2049
  const i = this.$svg, s = i.createSVGPoint();
2026
2050
  s.x = t.clientX, s.y = t.clientY;
2027
- const n = s.matrixTransform(i.getScreenCTM().inverse()), a = this.options.bar_height + this.options.padding, o = Math.floor((n.y - this.config.header_height) / a), d = this.tasks[o];
2028
- if (d && d._has_no_dates) {
2029
- const h = n.x / this.config.column_width, _ = Math.floor(h * this.config.step), l = g.add(
2051
+ const n = s.matrixTransform(i.getScreenCTM().inverse()), a = this.options.bar_height + this.options.padding, o = Math.floor((n.y - this.config.header_height) / a), h = this.tasks[o];
2052
+ if (h && h._has_no_dates) {
2053
+ const d = n.x / this.config.column_width, _ = Math.floor(d * this.config.step), l = g.add(
2030
2054
  this.gantt_start,
2031
2055
  _,
2032
2056
  this.config.unit
@@ -2034,14 +2058,14 @@ class tt {
2034
2058
  if (this.config.ignored_function)
2035
2059
  for (; this.config.ignored_function(l); )
2036
2060
  l = g.add(l, 1, "day");
2037
- d._start = l, d._end = g.add(l, 1, "day"), d.start = l, d.end = d._end, delete d._has_no_dates, this.refresh(this.tasks, !0), this.trigger_event("date_change", [
2038
- d,
2039
- d._start,
2040
- d._end
2061
+ h._start = l, h._end = g.add(l, 1, "day"), h.start = l, h.end = h._end, delete h._has_no_dates, this.refresh(this.tasks, !0), this.trigger_event("date_change", [
2062
+ h,
2063
+ h._start,
2064
+ h._end
2041
2065
  ]), this.trigger_event("after_date_change", [
2042
- d,
2043
- d._start,
2044
- d._end
2066
+ h,
2067
+ h._start,
2068
+ h._end
2045
2069
  ]);
2046
2070
  return;
2047
2071
  }
@@ -2071,85 +2095,85 @@ class tt {
2071
2095
  if (!this.bars.length) return [0, 0, 0];
2072
2096
  let { x: t, width: e } = this.bars[0].group.getBBox(), i = t, s = t, n = t + e;
2073
2097
  return Array.prototype.forEach.call(this.bars, function({ group: a }, o) {
2074
- let { x: d, width: h } = a.getBBox();
2075
- d < i && (i = d), d > s && (s = d), d + h > n && (n = d + h);
2098
+ let { x: h, width: d } = a.getBBox();
2099
+ h < i && (i = h), h > s && (s = h), h + d > n && (n = h + d);
2076
2100
  }), [i, s, n];
2077
2101
  }
2078
2102
  bind_bar_events() {
2079
2103
  let t = !1, e = 0, i = 0, s = !1, n = !1, a = null, o = [];
2080
2104
  this.bar_being_dragged = null, this.active_arrow = null;
2081
- const d = () => t || s || n;
2105
+ const h = () => t || s || n;
2082
2106
  this.$svg.onclick = (_) => {
2083
2107
  _.target.classList.contains("grid-row") && this.unselect_all();
2084
2108
  }, this._document_click_handler || (this._document_click_handler = () => this.set_active_arrow(null), document.addEventListener("click", this._document_click_handler));
2085
- let h = 0;
2086
- if (u.on(this.$svg, "mousemove", ".bar-wrapper, .handle", (_) => {
2087
- this.bar_being_dragged === !1 && Math.abs((_.offsetX || _.layerX) - h) > 10 && (this.bar_being_dragged = !0);
2088
- }), u.on(this.$svg, "mousedown", ".bar-wrapper, .handle", (_, l) => {
2109
+ let d = 0;
2110
+ if (m.on(this.$svg, "mousemove", ".bar-wrapper, .handle", (_) => {
2111
+ this.bar_being_dragged === !1 && Math.abs((_.offsetX || _.layerX) - d) > 10 && (this.bar_being_dragged = !0);
2112
+ }), m.on(this.$svg, "mousedown", ".bar-wrapper, .handle", (_, l) => {
2089
2113
  if (_.target.classList.contains("connector-circle")) return;
2090
- const p = u.closest(".bar-wrapper", l);
2091
- 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, a = p.getAttribute("data-id"), o = [this.get_bar(a)], this.bar_being_dragged = !1, h = e, o.forEach((c) => {
2092
- const m = c.$bar;
2093
- m.ox = m.getX(), m.oy = m.getY(), m.owidth = m.getWidth(), m.finaldx = 0;
2114
+ const c = m.closest(".bar-wrapper", l);
2115
+ 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, a = c.getAttribute("data-id"), o = [this.get_bar(a)], this.bar_being_dragged = !1, d = e, o.forEach((p) => {
2116
+ const f = p.$bar;
2117
+ f.ox = f.getX(), f.oy = f.getY(), f.owidth = f.getWidth(), f.finaldx = 0;
2094
2118
  });
2095
2119
  }), this.options.infinite_padding) {
2096
2120
  let _ = !1;
2097
- u.on(this.$container, "mousewheel", (l) => {
2098
- let p = this.$container.scrollWidth / 2;
2099
- if (!_ && l.currentTarget.scrollLeft <= p) {
2100
- let c = l.currentTarget.scrollLeft;
2121
+ m.on(this.$container, "mousewheel", (l) => {
2122
+ let c = this.$container.scrollWidth / 2;
2123
+ if (!_ && l.currentTarget.scrollLeft <= c) {
2124
+ let p = l.currentTarget.scrollLeft;
2101
2125
  _ = !0, this.gantt_start = g.add(
2102
2126
  this.gantt_start,
2103
2127
  -this.config.extend_by_units,
2104
2128
  this.config.unit
2105
- ), this.setup_date_values(), this.render(), l.currentTarget.scrollLeft = c + this.config.column_width * this.config.extend_by_units, setTimeout(() => _ = !1, 300);
2129
+ ), this.setup_date_values(), this.render(), l.currentTarget.scrollLeft = p + this.config.column_width * this.config.extend_by_units, setTimeout(() => _ = !1, 300);
2106
2130
  }
2107
- if (!_ && l.currentTarget.scrollWidth - (l.currentTarget.scrollLeft + l.currentTarget.clientWidth) <= p) {
2108
- let c = l.currentTarget.scrollLeft;
2131
+ if (!_ && l.currentTarget.scrollWidth - (l.currentTarget.scrollLeft + l.currentTarget.clientWidth) <= c) {
2132
+ let p = l.currentTarget.scrollLeft;
2109
2133
  _ = !0, this.gantt_end = g.add(
2110
2134
  this.gantt_end,
2111
2135
  this.config.extend_by_units,
2112
2136
  this.config.unit
2113
- ), this.setup_date_values(), this.render(), l.currentTarget.scrollLeft = c, setTimeout(() => _ = !1, 300);
2137
+ ), this.setup_date_values(), this.render(), l.currentTarget.scrollLeft = p, setTimeout(() => _ = !1, 300);
2114
2138
  }
2115
2139
  });
2116
2140
  }
2117
- u.on(this.$container, "scroll", (_) => {
2141
+ m.on(this.$container, "scroll", (_) => {
2118
2142
  this.$task_column && !this._syncing_scroll && (this._syncing_scroll = !0, this.$task_column.scrollTop = _.currentTarget.scrollTop, requestAnimationFrame(() => {
2119
2143
  this._syncing_scroll = !1;
2120
2144
  }));
2121
2145
  let l = [];
2122
- const p = this.bars.map(
2123
- ({ group: $ }) => $.getAttribute("data-id")
2146
+ const c = this.bars.map(
2147
+ ({ group: y }) => y.getAttribute("data-id")
2124
2148
  );
2125
- let c;
2126
- i && (c = _.currentTarget.scrollLeft - i), this.current_date = g.add(
2149
+ let p;
2150
+ i && (p = _.currentTarget.scrollLeft - i), this.current_date = g.add(
2127
2151
  this.gantt_start,
2128
2152
  _.currentTarget.scrollLeft / this.config.column_width * this.config.step,
2129
2153
  this.config.unit
2130
2154
  );
2131
- let m = this.config.view_mode.upper_text(
2155
+ let f = this.config.view_mode.upper_text(
2132
2156
  this.current_date,
2133
2157
  null,
2134
2158
  this.options.language
2135
- ), f = this.upperTexts.find(
2136
- ($) => $.textContent === m
2159
+ ), u = this.upperTexts.find(
2160
+ (y) => y.textContent === f
2137
2161
  );
2138
2162
  this.current_date = g.add(
2139
2163
  this.gantt_start,
2140
- (_.currentTarget.scrollLeft + f.clientWidth) / this.config.column_width * this.config.step,
2164
+ (_.currentTarget.scrollLeft + u.clientWidth) / this.config.column_width * this.config.step,
2141
2165
  this.config.unit
2142
- ), m = this.config.view_mode.upper_text(
2166
+ ), f = this.config.view_mode.upper_text(
2143
2167
  this.current_date,
2144
2168
  null,
2145
2169
  this.options.language
2146
- ), f = this.upperTexts.find(
2147
- ($) => $.textContent === m
2148
- ), f !== this.$current && (this.$current && this.$current.classList.remove("current-upper"), f.classList.add("current-upper"), this.$current = f), i = _.currentTarget.scrollLeft;
2149
- let [b, y, k] = this.get_start_end_positions();
2170
+ ), u = this.upperTexts.find(
2171
+ (y) => y.textContent === f
2172
+ ), u !== this.$current && (this.$current && this.$current.classList.remove("current-upper"), u.classList.add("current-upper"), this.$current = u), i = _.currentTarget.scrollLeft;
2173
+ let [b, $, k] = this.get_start_end_positions();
2150
2174
  i > k + 100 ? (this.$adjust.innerHTML = "&larr;", this.$adjust.classList.remove("hide"), this.$adjust.onclick = () => {
2151
2175
  this.$container.scrollTo({
2152
- left: y,
2176
+ left: $,
2153
2177
  behavior: "smooth"
2154
2178
  });
2155
2179
  }) : i + _.currentTarget.offsetWidth < b - 100 ? (this.$adjust.innerHTML = "&rarr;", this.$adjust.classList.remove("hide"), this.$adjust.onclick = () => {
@@ -2157,60 +2181,60 @@ class tt {
2157
2181
  left: b,
2158
2182
  behavior: "smooth"
2159
2183
  });
2160
- }) : this.$adjust.classList.add("hide"), c && (l = p.map(($) => this.get_bar($)), this.options.auto_move_label && l.forEach(($) => {
2161
- $.update_label_position_on_horizontal_scroll({
2162
- x: c,
2184
+ }) : this.$adjust.classList.add("hide"), p && (l = c.map((y) => this.get_bar(y)), this.options.auto_move_label && l.forEach((y) => {
2185
+ y.update_label_position_on_horizontal_scroll({
2186
+ x: p,
2163
2187
  sx: _.currentTarget.scrollLeft
2164
2188
  });
2165
2189
  }));
2166
- }), u.on(this.$svg, "mousemove", (_) => {
2167
- if (!d()) return;
2190
+ }), m.on(this.$svg, "mousemove", (_) => {
2191
+ if (!h()) return;
2168
2192
  const l = (_.offsetX || _.layerX) - e;
2169
- o.forEach((p) => {
2170
- const c = p.$bar;
2171
- c.finaldx = this.get_snap_position(l, c.ox), this.hide_popup(), s ? a === p.task.id ? p.update_bar_position({
2172
- x: c.ox + c.finaldx,
2173
- width: c.owidth - c.finaldx
2174
- }) : p.update_bar_position({
2175
- x: c.ox + c.finaldx
2176
- }) : n ? a === p.task.id && p.update_bar_position({
2177
- width: c.owidth + c.finaldx
2178
- }) : t && !this.options.readonly && !this.options.readonly_dates && p.update_bar_position({ x: c.ox + c.finaldx });
2193
+ o.forEach((c) => {
2194
+ const p = c.$bar;
2195
+ p.finaldx = this.get_snap_position(l, p.ox), this.hide_popup(), s ? a === c.task.id ? c.update_bar_position({
2196
+ x: p.ox + p.finaldx,
2197
+ width: p.owidth - p.finaldx
2198
+ }) : c.update_bar_position({
2199
+ x: p.ox + p.finaldx
2200
+ }) : n ? a === c.task.id && c.update_bar_position({
2201
+ width: p.owidth + p.finaldx
2202
+ }) : t && !this.options.readonly && !this.options.readonly_dates && c.update_bar_position({ x: p.ox + p.finaldx });
2179
2203
  });
2180
2204
  }), document.addEventListener("mouseup", () => {
2181
- var p, c, m;
2205
+ var c, p, f;
2182
2206
  const _ = this.bar_being_dragged === !0;
2183
2207
  this.bar_being_dragged = null;
2184
2208
  const l = [];
2185
- if (o.forEach((f) => {
2186
- if (!f.$bar.finaldx) {
2187
- _ && f.set_action_completed();
2209
+ if (o.forEach((u) => {
2210
+ if (!u.$bar.finaldx) {
2211
+ _ && u.set_action_completed();
2188
2212
  return;
2189
2213
  }
2190
- f.date_changed(), f.compute_progress(), f.set_action_completed(), l.push({
2191
- task: f.task,
2192
- start: f.task._start,
2193
- end: g.add(f.task._end, -1, "second")
2214
+ u.date_changed(), u.compute_progress(), u.set_action_completed(), l.push({
2215
+ task: u.task,
2216
+ start: u.task._start,
2217
+ end: g.add(u.task._end, -1, "second")
2194
2218
  });
2195
- }), this.options.critical_path && o.some((f) => f.$bar.finaldx) && (this.calculate_critical_path(), this.update_arrow_critical_path()), l.length > 0 && this.options.dependency_shifting !== "none") {
2196
- const f = this.options.dependency_shifting;
2219
+ }), this.options.critical_path && o.some((u) => u.$bar.finaldx) && (this.calculate_critical_path(), this.update_arrow_critical_path()), l.length > 0 && this.options.dependency_shifting !== "none") {
2220
+ const u = this.options.dependency_shifting;
2197
2221
  let b;
2198
- s ? b = f === "maintain_buffer_downstream" ? "none" : "upstream" : n ? b = "downstream" : b = f === "maintain_buffer_downstream" ? "downstream" : "both", l.forEach(({ task: y }) => {
2222
+ s ? b = u === "maintain_buffer_downstream" ? "none" : "upstream" : n ? b = "downstream" : b = u === "maintain_buffer_downstream" ? "downstream" : "both", l.forEach(({ task: $ }) => {
2199
2223
  if (b === "none") return;
2200
- const k = o.find((T) => T.task.id === y.id);
2224
+ const k = o.find((T) => T.task.id === $.id);
2201
2225
  if (!k || !k.$bar.finaldx) return;
2202
- const $ = k.$bar.finaldx / this.config.column_width, P = this.config.unit === "hour" ? 36e5 : this.config.unit === "day" ? 864e5 : this.config.unit === "month" ? 30 * 864e5 : this.config.unit === "year" ? 365 * 864e5 : 864e5, V = $ * this.config.step * P;
2226
+ const y = k.$bar.finaldx / this.config.column_width, P = this.config.unit === "hour" ? 36e5 : this.config.unit === "day" ? 864e5 : this.config.unit === "month" ? 30 * 864e5 : this.config.unit === "year" ? 365 * 864e5 : 864e5, V = y * this.config.step * P;
2203
2227
  I(
2204
2228
  this.tasks,
2205
- y.id,
2229
+ $.id,
2206
2230
  V,
2207
2231
  this.options.dependency_shifting,
2208
2232
  b
2209
2233
  ).forEach((T, N) => {
2210
2234
  const v = this.get_bar(N);
2211
2235
  if (!v) return;
2212
- const M = v.task, O = new Date(M._start.getTime() + T), j = g.diff(O, this.gantt_start, this.config.unit) / this.config.step * this.config.column_width;
2213
- v.update_bar_position({ x: j }), v.update_arrow_position(), this.trigger_event("after_date_change", [
2236
+ const M = v.task, O = new Date(M._start.getTime() + T), R = g.diff(O, this.gantt_start, this.config.unit) / this.config.step * this.config.column_width;
2237
+ v.update_bar_position({ x: R }), v.update_arrow_position(), this.trigger_event("after_date_change", [
2214
2238
  M,
2215
2239
  M._start,
2216
2240
  g.add(M._end, -1, "second")
@@ -2218,37 +2242,37 @@ class tt {
2218
2242
  });
2219
2243
  });
2220
2244
  }
2221
- l.length > 0 && l.forEach(({ task: f, start: b, end: y }) => {
2222
- this.trigger_event("after_date_change", [f, b, y]);
2223
- }), o.forEach((f) => {
2224
- f.$bar.finaldx = 0;
2225
- }), t = !1, s = !1, n = !1, (m = (c = (p = this.$container.querySelector(".visible")) == null ? void 0 : p.classList) == null ? void 0 : c.remove) == null || m.call(c, "visible");
2245
+ l.length > 0 && l.forEach(({ task: u, start: b, end: $ }) => {
2246
+ this.trigger_event("after_date_change", [u, b, $]);
2247
+ }), o.forEach((u) => {
2248
+ u.$bar.finaldx = 0;
2249
+ }), t = !1, s = !1, n = !1, (f = (p = (c = this.$container.querySelector(".visible")) == null ? void 0 : c.classList) == null ? void 0 : p.remove) == null || f.call(p, "visible");
2226
2250
  }), this.bind_bar_progress();
2227
2251
  }
2228
2252
  bind_task_column_resize() {
2229
2253
  if (!this.$task_column_resize_handle) return;
2230
2254
  let t = !1, e = 0, i = 0;
2231
2255
  const s = 100, n = 600;
2232
- u.on(this.$task_column_resize_handle, "mousedown", (a) => {
2256
+ m.on(this.$task_column_resize_handle, "mousedown", (a) => {
2233
2257
  t = !0, e = a.clientX, i = this.options.task_column.width, this.$task_column.classList.add("resizing"), a.preventDefault();
2234
- }), u.on(document, "mousemove", (a) => {
2258
+ }), m.on(document, "mousemove", (a) => {
2235
2259
  if (!t) return;
2236
2260
  let o = a.clientX - e;
2237
2261
  this.options.isRTL && (o = -o);
2238
- let d = i + o;
2239
- d = Math.max(s, Math.min(n, d)), this.options.task_column.width = d, this.$task_column.style.width = d + "px", this.$wrapper.style.setProperty(
2262
+ let h = i + o;
2263
+ h = Math.max(s, Math.min(n, h)), this.options.task_column.width = h, this.$task_column.style.width = h + "px", this.$wrapper.style.setProperty(
2240
2264
  "--gv-task-column-width",
2241
- d + "px"
2265
+ h + "px"
2242
2266
  ), this.$container.style.setProperty(
2243
2267
  "--gv-task-column-width",
2244
- d + "px"
2245
- ), this.trigger_event("task_column_resize", [d]);
2246
- }), u.on(document, "mouseup", () => {
2268
+ h + "px"
2269
+ ), this.trigger_event("task_column_resize", [h]);
2270
+ }), m.on(document, "mouseup", () => {
2247
2271
  t && (t = !1, this.$task_column.classList.remove("resizing"), this.trigger_event("task_after_column_resize", [this.options.task_column.width]));
2248
2272
  });
2249
2273
  }
2250
2274
  bind_task_column_scroll() {
2251
- this.$task_column && u.on(this.$task_column, "scroll", (t) => {
2275
+ this.$task_column && m.on(this.$task_column, "scroll", (t) => {
2252
2276
  this._syncing_scroll || (this._syncing_scroll = !0, this.$container.scrollTop = t.currentTarget.scrollTop, requestAnimationFrame(() => {
2253
2277
  this._syncing_scroll = !1;
2254
2278
  }));
@@ -2256,44 +2280,44 @@ class tt {
2256
2280
  }
2257
2281
  bind_bar_progress() {
2258
2282
  let t = 0, e = null, i = null, s = null, n = null;
2259
- u.on(this.$svg, "mousedown", ".handle.progress", (o, d) => {
2283
+ m.on(this.$svg, "mousedown", ".handle.progress", (o, h) => {
2260
2284
  e = !0, t = o.offsetX || o.layerX;
2261
- const _ = u.closest(".bar-wrapper", d).getAttribute("data-id");
2285
+ const _ = m.closest(".bar-wrapper", h).getAttribute("data-id");
2262
2286
  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();
2263
2287
  });
2264
2288
  const a = this.config.ignored_positions.map((o) => [
2265
2289
  o,
2266
2290
  o + this.config.column_width
2267
2291
  ]);
2268
- u.on(this.$svg, "mousemove", (o) => {
2292
+ m.on(this.$svg, "mousemove", (o) => {
2269
2293
  if (!e) return;
2270
- let d = o.offsetX || o.layerX;
2271
- if (d > t) {
2294
+ let h = o.offsetX || o.layerX;
2295
+ if (h > t) {
2272
2296
  let l = a.find(
2273
- ([p, c]) => d >= p && d < c
2297
+ ([c, p]) => h >= c && h < p
2274
2298
  );
2275
2299
  for (; l; )
2276
- d = l[1], l = a.find(
2277
- ([p, c]) => d >= p && d < c
2300
+ h = l[1], l = a.find(
2301
+ ([c, p]) => h >= c && h < p
2278
2302
  );
2279
2303
  } else {
2280
2304
  let l = a.find(
2281
- ([p, c]) => d > p && d <= c
2305
+ ([c, p]) => h > c && h <= p
2282
2306
  );
2283
2307
  for (; l; )
2284
- d = l[0], l = a.find(
2285
- ([p, c]) => d > p && d <= c
2308
+ h = l[0], l = a.find(
2309
+ ([c, p]) => h > c && h <= p
2286
2310
  );
2287
2311
  }
2288
- let _ = d - t;
2289
- _ > 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 = _;
2290
- }), u.on(this.$svg, "mouseup", () => {
2312
+ let _ = h - t;
2313
+ _ > s.max_dx && (_ = s.max_dx), _ < s.min_dx && (_ = s.min_dx), s.setAttribute("width", s.owidth + _), m.attr(i.$handle_progress, "cx", s.getEndX()), s.finaldx = _;
2314
+ }), m.on(this.$svg, "mouseup", () => {
2291
2315
  e = !1, s && s.finaldx && (s.finaldx = 0, i.progress_changed(), i.set_action_completed(), i = null, s = null, n = null);
2292
2316
  });
2293
2317
  }
2294
2318
  bind_dependency_linking() {
2295
- this.is_linking = !1, this.linking_source_bar = null, this.linking_source_endpoint = null, this.linking_temp_line = null, this.linking_snap_badge = null, u.on(this.$svg, "mousedown", ".connector-circle", (t, e) => {
2296
- const i = u.closest(".bar-wrapper", e);
2319
+ this.is_linking = !1, this.linking_source_bar = null, this.linking_source_endpoint = null, this.linking_temp_line = null, this.linking_snap_badge = null, m.on(this.$svg, "mousedown", ".connector-circle", (t, e) => {
2320
+ const i = m.closest(".bar-wrapper", e);
2297
2321
  if (!i) return;
2298
2322
  const s = i.getAttribute("data-id"), n = this.get_bar(s);
2299
2323
  if (!n) return;
@@ -2307,32 +2331,32 @@ class tt {
2307
2331
  class: "linking-temp-line",
2308
2332
  append_to: this.layers.linking
2309
2333
  });
2310
- }), u.on(this.$svg, "mousemove", (t) => {
2334
+ }), m.on(this.$svg, "mousemove", (t) => {
2311
2335
  if (!this.is_linking || !this.linking_temp_line) return;
2312
2336
  const e = this.$svg.createSVGPoint();
2313
2337
  e.x = t.clientX, e.y = t.clientY;
2314
2338
  const i = e.matrixTransform(this.$svg.getScreenCTM().inverse());
2315
2339
  this.linking_temp_line.setAttribute("x2", i.x), this.linking_temp_line.setAttribute("y2", i.y);
2316
- }), u.on(this.$svg, "mouseover", ".connector-circle", (t, e) => {
2340
+ }), m.on(this.$svg, "mouseover", ".connector-circle", (t, e) => {
2317
2341
  if (!this.is_linking) return;
2318
- const i = u.closest(".bar-wrapper", e);
2342
+ const i = m.closest(".bar-wrapper", e);
2319
2343
  if (!(!i || i.getAttribute("data-id") === this.linking_source_bar.task.id) && (e.setAttribute("r", "9"), this.linking_temp_line && this.linking_temp_line.classList.add("snap"), !this.linking_snap_badge)) {
2320
2344
  const n = e.getAttribute("data-endpoint"), a = this._resolve_dependency_type(
2321
2345
  this.linking_source_endpoint,
2322
2346
  n
2323
- ), o = { "finish-to-start": "FS", "start-to-start": "SS", "finish-to-finish": "FF", "start-to-finish": "SF" }[a] || "FS", d = parseFloat(e.getAttribute("cx")), h = parseFloat(e.getAttribute("cy"));
2347
+ ), o = { "finish-to-start": "FS", "start-to-start": "SS", "finish-to-finish": "FF", "start-to-finish": "SF" }[a] || "FS", h = parseFloat(e.getAttribute("cx")), d = parseFloat(e.getAttribute("cy"));
2324
2348
  this.linking_snap_badge = w("text", {
2325
- x: d + 12,
2326
- y: h - 10,
2349
+ x: h + 12,
2350
+ y: d - 10,
2327
2351
  class: "linking-snap-badge",
2328
2352
  append_to: this.layers.linking
2329
2353
  }), this.linking_snap_badge.textContent = o;
2330
2354
  }
2331
- }), u.on(this.$svg, "mouseout", ".connector-circle", (t, e) => {
2355
+ }), m.on(this.$svg, "mouseout", ".connector-circle", (t, e) => {
2332
2356
  this.is_linking && (e.setAttribute("r", "4"), this.linking_temp_line && this.linking_temp_line.classList.remove("snap"), this.linking_snap_badge && (this.linking_snap_badge.remove(), this.linking_snap_badge = null));
2333
- }), u.on(this.$svg, "mouseup", ".connector-circle", (t, e) => {
2357
+ }), m.on(this.$svg, "mouseup", ".connector-circle", (t, e) => {
2334
2358
  if (!this.is_linking) return;
2335
- const i = u.closest(".bar-wrapper", e);
2359
+ const i = m.closest(".bar-wrapper", e);
2336
2360
  if (!i) return;
2337
2361
  const s = i.getAttribute("data-id");
2338
2362
  if (s !== this.linking_source_bar.task.id) {
@@ -2357,21 +2381,21 @@ class tt {
2357
2381
  const i = this.linking_source_bar.task, s = t.task, n = this._resolve_dependency_type(
2358
2382
  this.linking_source_endpoint,
2359
2383
  e
2360
- ), a = s.dependencies.find((p) => p.id === i.id), o = a ? a.type || this.options.dependencies_type || "finish-to-start" : null, d = s.dependencies.filter(
2361
- (p) => p.id !== i.id
2384
+ ), a = s.dependencies.find((c) => c.id === i.id), o = a ? a.type || this.options.dependencies_type || "finish-to-start" : null, h = s.dependencies.filter(
2385
+ (c) => c.id !== i.id
2362
2386
  );
2363
2387
  if (o === n) {
2364
- this.update_task(s.id, { dependencies: d }), this.options.on_dependency_delete && this.options.on_dependency_delete(i, s, n);
2388
+ this.update_task(s.id, { dependencies: h }), this.options.on_dependency_delete && this.options.on_dependency_delete(i, s, n);
2365
2389
  return;
2366
2390
  }
2367
- const h = (l = i.dependencies) == null ? void 0 : l.find((p) => p.id === s.id);
2368
- if (h) {
2369
- const p = h.type || this.options.dependencies_type || "finish-to-start";
2391
+ const d = (l = i.dependencies) == null ? void 0 : l.find((c) => c.id === s.id);
2392
+ if (d) {
2393
+ const c = d.type || this.options.dependencies_type || "finish-to-start";
2370
2394
  this.update_task(i.id, {
2371
- dependencies: i.dependencies.filter((c) => c.id !== s.id)
2372
- }), this.options.on_dependency_delete && this.options.on_dependency_delete(s, i, p);
2395
+ dependencies: i.dependencies.filter((p) => p.id !== s.id)
2396
+ }), this.options.on_dependency_delete && this.options.on_dependency_delete(s, i, c);
2373
2397
  }
2374
- const _ = [...d, { id: i.id, type: n }];
2398
+ const _ = [...h, { id: i.id, type: n }];
2375
2399
  this.update_task(s.id, { dependencies: _ }), a ? this.options.on_dependency_changed && this.options.on_dependency_changed(
2376
2400
  i,
2377
2401
  s,
@@ -2391,9 +2415,9 @@ class tt {
2391
2415
  }
2392
2416
  change_dependency_type(t, e) {
2393
2417
  const i = t.from_task.task, s = t.to_task.task, n = t.dependency_type;
2394
- if (t._hide_type_dropdown(), e === n || !s.dependencies.find((d) => d.id === i.id)) return;
2418
+ if (t._hide_type_dropdown(), e === n || !s.dependencies.find((h) => h.id === i.id)) return;
2395
2419
  const o = s.dependencies.map(
2396
- (d) => d.id === i.id ? { ...d, type: e } : d
2420
+ (h) => h.id === i.id ? { ...h, type: e } : h
2397
2421
  );
2398
2422
  this.set_active_arrow(null), this.update_task(s.id, { dependencies: o }), this.options.on_dependency_changed && this.options.on_dependency_changed(i, s, n, e);
2399
2423
  }
@@ -2414,10 +2438,10 @@ class tt {
2414
2438
  }
2415
2439
  const n = t % (this.config.column_width / i);
2416
2440
  let a = t - n + (n < this.config.column_width / i * 2 ? 0 : this.config.column_width / i), o = e + a;
2417
- const d = a > 0 ? 1 : -1;
2418
- let h = this.get_ignored_region(o, d);
2419
- for (; h.length; )
2420
- o += this.config.column_width * d, h = this.get_ignored_region(o, d), h.length || (o -= this.config.column_width * d);
2441
+ const h = a > 0 ? 1 : -1;
2442
+ let d = this.get_ignored_region(o, h);
2443
+ for (; d.length; )
2444
+ o += this.config.column_width * h, d = this.get_ignored_region(o, h), d.length || (o -= this.config.column_width * h);
2421
2445
  return o - e;
2422
2446
  }
2423
2447
  get_ignored_region(t, e = 1) {
@@ -2470,8 +2494,8 @@ class tt {
2470
2494
  * @memberof Gantt
2471
2495
  */
2472
2496
  clear() {
2473
- var t, e, i, s, n, a, o, d, h, _, l, p, c, m, f, b;
2474
- 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), (a = (n = this.$task_column) == null ? void 0 : n.remove) == null || a.call(n), (d = (o = this.$current_highlight) == null ? void 0 : o.remove) == null || d.call(o), (_ = (h = this.$extras) == null ? void 0 : h.remove) == null || _.call(h), (p = (l = this.popup) == null ? void 0 : l.hide) == null || p.call(l), (m = (c = this.$wrapper) == null ? void 0 : c.classList) == null || m.remove("has-task-column"), (b = (f = this.$wrapper) == null ? void 0 : f.classList) == null || b.remove("rtl");
2497
+ var t, e, i, s, n, a, o, h, d, _, l, c, p, f, u, b;
2498
+ 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), (a = (n = this.$task_column) == null ? void 0 : n.remove) == null || a.call(n), (h = (o = this.$current_highlight) == null ? void 0 : o.remove) == null || h.call(o), (_ = (d = this.$extras) == null ? void 0 : d.remove) == null || _.call(d), (c = (l = this.popup) == null ? void 0 : l.hide) == null || c.call(l), (f = (p = this.$wrapper) == null ? void 0 : p.classList) == null || f.remove("has-task-column"), (b = (u = this.$wrapper) == null ? void 0 : u.classList) == null || b.remove("rtl");
2475
2499
  }
2476
2500
  }
2477
2501
  tt.VIEW_MODE = {