lightweight-charts-drawing 0.5.0 → 0.5.1

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.
@@ -441,13 +441,13 @@ function Kt(e) {
441
441
  const t = { ...Mn, ...He[e].defaults, ...Oo(e) };
442
442
  return t.levels && (t.levels = t.levels.map((n) => ({ ...n }))), t;
443
443
  }
444
- function Ua(e) {
444
+ function Xa(e) {
445
445
  const t = { ...Mn, ...He[e].defaults };
446
446
  return t.levels && (t.levels = t.levels.map((n) => ({ ...n }))), t;
447
447
  }
448
448
  let Oo = () => {
449
449
  };
450
- function Xa(e) {
450
+ function Ga(e) {
451
451
  Oo = e;
452
452
  }
453
453
  const et = 6, L = 6, Qn = 9;
@@ -927,12 +927,14 @@ function no(e, t) {
927
927
  return n;
928
928
  }
929
929
  function Fr(e, t) {
930
- const n = N(e.points[0].time);
931
- if (!t || n == null) return null;
932
- const o = t.bars();
933
- if (o.length === 0) return null;
934
- const i = Zo(e, o, n, e.style.vwapSource ?? "hlc3");
935
- return i.vwap.length > 0 ? i.vwap[i.vwap.length - 1] : null;
930
+ var n;
931
+ return t ? ((n = Or(e, t.bars())) == null ? void 0 : n.vwap) ?? null : null;
932
+ }
933
+ function Or(e, t) {
934
+ const n = e.points[0] ? N(e.points[0].time) : null;
935
+ if (n == null || t.length === 0) return null;
936
+ const o = Zo(e, t, n, e.style.vwapSource ?? "hlc3"), i = o.vwap.length - 1;
937
+ return i >= 0 ? { vwap: o.vwap[i], sd: o.sd[i] } : null;
936
938
  }
937
939
  function Ko(e, t) {
938
940
  const n = N(e.points[0].time), o = { line: [], bands: [] };
@@ -967,7 +969,7 @@ function Qo(e, t, n = 32) {
967
969
  }
968
970
  return c;
969
971
  }
970
- function Or(e, t) {
972
+ function Dr(e, t) {
971
973
  const n = e.points[1];
972
974
  if (!t || !n) return "waiting";
973
975
  const o = N(n.time);
@@ -1103,7 +1105,7 @@ function an(e, t, n, o) {
1103
1105
  const s = Math.max(1, 2 * (n + o) / l);
1104
1106
  return { x: e.x + i * s, y: e.y + r * s };
1105
1107
  }
1106
- const Dr = ["bars", "oc", "line", "line-open", "line-high", "line-low", "line-hl2"];
1108
+ const _r = ["bars", "oc", "line", "line-open", "line-high", "line-low", "line-hl2"];
1107
1109
  function ro(e, t) {
1108
1110
  const [n, o, i, r] = e;
1109
1111
  switch (t) {
@@ -1147,7 +1149,7 @@ function ii(e, t, n) {
1147
1149
  if (e.kind !== "bar-pattern" || !n) return null;
1148
1150
  const o = ((O = e.pattern) == null ? void 0 : O.bars) ?? [];
1149
1151
  if (o.length === 0 || t.length < 2) return null;
1150
- const i = e.style, [r, l] = t, s = Dr.includes(i.patternMode ?? "") ? i.patternMode : "bars";
1152
+ const i = e.style, [r, l] = t, s = _r.includes(i.patternMode ?? "") ? i.patternMode : "bars";
1151
1153
  let a = o;
1152
1154
  if (i.mirrored) {
1153
1155
  let T = 1 / 0, E = -1 / 0;
@@ -1172,7 +1174,7 @@ function ii(e, t, n) {
1172
1174
  };
1173
1175
  }
1174
1176
  let ue = null;
1175
- function _r(e, t) {
1177
+ function Hr(e, t) {
1176
1178
  return ue || (ue = document.createElement("canvas").getContext("2d")), ue ? (ue.font = t, ue.measureText(e).width) : e.length * 8;
1177
1179
  }
1178
1180
  function ri(e, t) {
@@ -1180,13 +1182,13 @@ function ri(e, t) {
1180
1182
  if (n === "" || e.kind !== "arrow-mark-up" && e.kind !== "arrow-mark-down") return null;
1181
1183
  const o = e.style, i = o.fontSize ?? 14, r = i / 3, l = Math.ceil(i), s = n.split(`
1182
1184
  `), a = `${o.italic ? "italic " : ""}${o.bold ? "bold " : ""}${i}px ${getComputedStyle(document.body).fontFamily}`;
1183
- let c = Math.round(Math.max(...s.map((u) => _r(u, a))) + 2 * r);
1185
+ let c = Math.round(Math.max(...s.map((u) => Hr(u, a))) + 2 * r);
1184
1186
  c % 2 && (c += 1);
1185
1187
  const f = s.length * l + 2 * r, h = e.kind === "arrow-mark-up" ? t.y + 20 : t.y - 20 - f;
1186
1188
  return { left: t.x - c / 2, top: h, width: c, height: f, lines: s, lineH: l, pad: r };
1187
1189
  }
1188
- const Ht = 8, ht = 1, Hr = 2, li = 120, si = 1.3, Nr = "#2962ff", Yr = "rgba(41, 98, 255, 0.2)", so = 3, Jt = 1024;
1189
- function Vr(e) {
1190
+ const Ht = 8, ht = 1, Nr = 2, li = 120, si = 1.3, Yr = "#2962ff", Vr = "rgba(41, 98, 255, 0.2)", so = 3, Jt = 1024;
1191
+ function Ur(e) {
1190
1192
  return Jt + (e.row == null ? 0 : e.row + 1) * Jt + (e.col == null ? 0 : e.col + 1);
1191
1193
  }
1192
1194
  function ci(e) {
@@ -1207,19 +1209,19 @@ function Pn(e) {
1207
1209
  return Array.from({ length: t }, (o, i) => n[i] ?? 0);
1208
1210
  }
1209
1211
  const ai = (e) => e.fontSize ?? 14, fi = (e) => zt("0", e, !1, !1);
1210
- function Ur(e) {
1212
+ function Xr(e) {
1211
1213
  return fi(e) + 2 * Ht + 2 * ht;
1212
1214
  }
1213
1215
  function hi(e) {
1214
1216
  return e + 2 * Ht + ht;
1215
1217
  }
1216
- function Xr(e, t) {
1218
+ function Gr(e, t) {
1217
1219
  return Math.max(e - 2 * Ht - 2 * ht, fi(t));
1218
1220
  }
1219
1221
  function ui(e, t, n) {
1220
- return e === "" ? [] : Ye(e, n, !1, !1, Xr(t, n));
1222
+ return e === "" ? [] : Ye(e, n, !1, !1, Gr(t, n));
1221
1223
  }
1222
- function Gr(e, t) {
1224
+ function jr(e, t) {
1223
1225
  return e * t + (e - 1) * t * (si - 1) + 2 * Ht + 2 * ht;
1224
1226
  }
1225
1227
  function xi(e, t = Wt(e), n = we(e)) {
@@ -1227,7 +1229,7 @@ function xi(e, t = Wt(e), n = we(e)) {
1227
1229
  return { heights: i.map((s, a) => {
1228
1230
  var f;
1229
1231
  let c = hi(o);
1230
- for (let h = 0; h < n.length; h++) c = Math.max(c, Gr(ui(((f = t[a]) == null ? void 0 : f[h]) ?? "", n[h], o).length, o));
1232
+ for (let h = 0; h < n.length; h++) c = Math.max(c, jr(ui(((f = t[a]) == null ? void 0 : f[h]) ?? "", n[h], o).length, o));
1231
1233
  return r.push(c), Math.max(s, c);
1232
1234
  }), mins: r };
1233
1235
  }
@@ -1251,7 +1253,7 @@ function di(e) {
1251
1253
  { x: e.right, y: e.bottom }
1252
1254
  ];
1253
1255
  }
1254
- function jr(e, t, n) {
1256
+ function qr(e, t, n) {
1255
1257
  if (n) {
1256
1258
  let o = null, i = null;
1257
1259
  if (t.x >= e.left && t.x <= e.right) {
@@ -1282,7 +1284,7 @@ function fn(e, t, n) {
1282
1284
  const l = r / i, s = e.map((a, c) => Math.max(t[c], a * l));
1283
1285
  return o(s) > r + 0.01 ? fn(s, t, n) : s;
1284
1286
  }
1285
- function qr(e, t, n) {
1287
+ function Zr(e, t, n) {
1286
1288
  var a;
1287
1289
  const o = Wt(e).map((c) => [...c]), i = we(e), r = Pn(e), [l, s] = n ?? [o.length - 1, (((a = o[0]) == null ? void 0 : a.length) ?? 1) - 1];
1288
1290
  if (t === "row") {
@@ -1295,12 +1297,12 @@ function qr(e, t, n) {
1295
1297
  }
1296
1298
  return { tableCells: o, tableColWidths: i, tableRowHeights: r };
1297
1299
  }
1298
- function Zr(e, t) {
1300
+ function Kr(e, t) {
1299
1301
  var o;
1300
1302
  const n = Wt(e);
1301
1303
  return t === "row" ? n.length > 1 : (((o = n[0]) == null ? void 0 : o.length) ?? 0) > 1;
1302
1304
  }
1303
- function Kr(e, t, n) {
1305
+ function Qr(e, t, n) {
1304
1306
  const o = Wt(e).map((c) => [...c]), i = we(e), r = Pn(e), [l, s] = n;
1305
1307
  if (t === "row")
1306
1308
  o.splice(l, 1), r.splice(l, 1);
@@ -1311,23 +1313,23 @@ function Kr(e, t, n) {
1311
1313
  const a = [Math.min(l, o.length - 1), Math.min(s, i.length - 1)];
1312
1314
  return { patch: { tableCells: o, tableColWidths: i, tableRowHeights: r }, cell: a };
1313
1315
  }
1314
- function Qr(e, t, n) {
1316
+ function Jr(e, t, n) {
1315
1317
  const o = Wt(e).map((i) => [...i]);
1316
1318
  return o[t[0]] && (o[t[0]][t[1]] = n), { tableCells: o };
1317
1319
  }
1318
- const Ga = 2e6, co = 2e3, ja = { "image/png": "png", "image/jpeg": "jpg", "image/webp": "webp" }, $t = /* @__PURE__ */ new Map();
1320
+ const ja = 2e6, co = 2e3, qa = { "image/png": "png", "image/jpeg": "jpg", "image/webp": "webp" }, $t = /* @__PURE__ */ new Map();
1319
1321
  let yi = () => Promise.reject(new Error("no image reader"));
1320
1322
  const hn = /* @__PURE__ */ new Set();
1321
- function qa(e) {
1323
+ function Za(e) {
1322
1324
  yi = e;
1323
1325
  }
1324
- function Jr(e) {
1326
+ function tl(e) {
1325
1327
  return hn.add(e), () => hn.delete(e);
1326
1328
  }
1327
1329
  function pi() {
1328
1330
  for (const e of hn) e();
1329
1331
  }
1330
- function tl(e) {
1332
+ function el(e) {
1331
1333
  return new Promise((t, n) => {
1332
1334
  const o = new Image();
1333
1335
  o.onload = () => t({ url: e, width: o.naturalWidth, height: o.naturalHeight }), o.onerror = () => n(new Error("image decode failed")), o.src = e;
@@ -1336,14 +1338,14 @@ function tl(e) {
1336
1338
  function zn(e) {
1337
1339
  if (!e) return null;
1338
1340
  const t = $t.get(e);
1339
- return t && t !== "loading" && t !== "error" ? t : (t || ($t.set(e, "loading"), yi(e).then((n) => tl(URL.createObjectURL(n))).then(
1341
+ return t && t !== "loading" && t !== "error" ? t : (t || ($t.set(e, "loading"), yi(e).then((n) => el(URL.createObjectURL(n))).then(
1340
1342
  (n) => $t.set(e, n),
1341
1343
  (n) => {
1342
1344
  $t.set(e, "error"), console.warn("[image] read failed:", n);
1343
1345
  }
1344
1346
  ).then(pi)), null);
1345
1347
  }
1346
- function el(e) {
1348
+ function nl(e) {
1347
1349
  return !!e && $t.get(e) === "error";
1348
1350
  }
1349
1351
  function bi(e, t) {
@@ -1360,15 +1362,15 @@ function mi(e) {
1360
1362
  { x: e.right - 1, y: e.bottom - 1 }
1361
1363
  ];
1362
1364
  }
1363
- const nl = [[-1, -1], [1, -1], [-1, 1], [1, 1]];
1364
- function ol(e, t, n, o) {
1365
+ const ol = [[-1, -1], [1, -1], [-1, 1], [1, 1]];
1366
+ function il(e, t, n, o) {
1365
1367
  const i = Math.min(Math.min(1, n / 4 / e), Math.min(1, o / 4 / t));
1366
1368
  return { cssWidth: Math.round(i * e), cssHeight: Math.round(i * t) };
1367
1369
  }
1368
- function Za(e, t) {
1370
+ function Ka(e, t) {
1369
1371
  (!$t.has(e) || $t.get(e) === "error") && $t.set(e, t), pi();
1370
1372
  }
1371
- const il = "Add text", rl = {
1373
+ const rl = "Add text", ll = {
1372
1374
  text: "Text",
1373
1375
  note: "Add text",
1374
1376
  pin: "Note",
@@ -1377,17 +1379,17 @@ const il = "Add text", rl = {
1377
1379
  signpost: "Signpost",
1378
1380
  callout: "Callout"
1379
1381
  };
1380
- function ll(e) {
1382
+ function sl(e) {
1381
1383
  const t = !!(e.text && e.text.length > 0);
1382
- return { txt: t ? e.text : rl[e.kind] ?? "Text", faint: !t };
1384
+ return { txt: t ? e.text : ll[e.kind] ?? "Text", faint: !t };
1383
1385
  }
1384
1386
  function gi(e, t, n, o) {
1385
- const { txt: i, faint: r } = ll(e), l = t.fontSize ?? 14, s = zt(i, l, !1, !1) + 16, a = l + 12, c = Math.round(180 * Math.atan2(o.y - n.y, o.x - n.x) / Math.PI);
1387
+ const { txt: i, faint: r } = sl(e), l = t.fontSize ?? 14, s = zt(i, l, !1, !1) + 16, a = l + 12, c = Math.round(180 * Math.atan2(o.y - n.y, o.x - n.x) / Math.PI);
1386
1388
  let f = o.x, h = o.y - a / 2;
1387
1389
  return c >= -135 && c <= -45 ? (f = o.x - s / 2, h = o.y - a) : c > -45 && c < 45 ? f = o.x : c >= 45 && c <= 135 ? (f = o.x - s / 2, h = o.y) : f = o.x - s, { txt: i, faint: r, fs: l, box: { left: f, top: h, width: s, height: a } };
1388
1390
  }
1389
1391
  function gt(e) {
1390
- return e.text ? { text: e.text, faint: !1 } : { text: il, faint: !0 };
1392
+ return e.text ? { text: e.text, faint: !1 } : { text: rl, faint: !0 };
1391
1393
  }
1392
1394
  function wi(e, t) {
1393
1395
  const n = e.style, o = n.fontSize ?? 14, i = o / 6;
@@ -1410,10 +1412,10 @@ function Mi(e, t) {
1410
1412
  const o = e.style.fontSize ?? 16, i = Math.round(o / 1.3), r = G({ x: t.x, y: t.y, text: gt(e).text, fs: o, vert: "bottom", horz: "left", padV: i, padH: 12 }), l = Math.min(r.box.width, o + 2 * i) / 2;
1411
1413
  return { l: r, r: l };
1412
1414
  }
1413
- function sl(e, t, n, o, [i, r, l, s]) {
1415
+ function cl(e, t, n, o, [i, r, l, s]) {
1414
1416
  return `M ${e + i} ${t} H ${e + n - r} A ${r} ${r} 0 0 1 ${e + n} ${t + r} V ${t + o - l} A ${l} ${l} 0 0 1 ${e + n - l} ${t + o} H ${e + s} A ${s} ${s} 0 0 1 ${e} ${t + o - s} V ${t + i} A ${i} ${i} 0 0 1 ${e + i} ${t} Z`;
1415
1417
  }
1416
- const cl = "m12 30 .88-.77C20.25 22.73 24 17.07 24 12.09 24 5.04 18.54 0 12 0S0 5.04 0 12.1c0 4.97 3.75 10.64 11.12 17.13L12 30Zm0-13a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z";
1418
+ const al = "m12 30 .88-.77C20.25 22.73 24 17.07 24 12.09 24 5.04 18.54 0 12 0S0 5.04 0 12.1c0 4.97 3.75 10.64 11.12 17.13L12 30Zm0-13a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z";
1417
1419
  function vi(e, t, n) {
1418
1420
  const o = e.style, i = o.fontSize ?? 14, r = Math.min(236, n), l = Ye(gt(e).text, i, !!o.bold, !!o.italic, r - 24);
1419
1421
  let s = l.length * i + 24;
@@ -1432,7 +1434,7 @@ function ki(e, t, n) {
1432
1434
  const o = zt(e, n, !0, !1) + 20, i = n + 10, r = t.x + 9, l = t.y - (i + 15);
1433
1435
  return { x: r, y: l, w: o, h: i, fs: n };
1434
1436
  }
1435
- function al(e) {
1437
+ function fl(e) {
1436
1438
  const { x: t, y: n, w: o, h: i } = e, r = 3;
1437
1439
  return `M ${t + 12} ${n + i} L ${t - 9} ${n + i + 15} L ${t + 5} ${n + i} L ${t + r} ${n + i} A ${r} ${r} 0 0 1 ${t} ${n + i - r} L ${t} ${n + r} A ${r} ${r} 0 0 1 ${t + r} ${n} L ${t + o - r} ${n} A ${r} ${r} 0 0 1 ${t + o} ${n + r} L ${t + o} ${n + i - r} A ${r} ${r} 0 0 1 ${t + o - r} ${n + i} Z`;
1438
1440
  }
@@ -1440,7 +1442,7 @@ function Li(e, t) {
1440
1442
  const n = e.style, o = n.fontSize ?? 14, i = n.wordWrap ? n.wordWrapWidth ?? 200 : void 0, r = Ye(gt(e).text, o, !!n.bold, !!n.italic, i), l = i ?? Math.max(0, ...r.map((u) => zt(u, o, !!n.bold, !!n.italic))), s = o * r.length, a = l + 20, c = s + 20, f = t.x - a / 2, h = t.y - c / 2;
1441
1443
  return { fs: o, lines: r, textW: l, textH: s, x: f, y: h, w: a, h: c, wrap: i };
1442
1444
  }
1443
- function fl(e, t, n) {
1445
+ function hl(e, t, n) {
1444
1446
  const { x: o, y: i, w: r, h: l, textW: s, textH: a } = e, c = t.x - o, f = t.y - i, h = n.x - o, u = n.y - i;
1445
1447
  let x = 0;
1446
1448
  t.x > o + r ? x = 20 : t.x > o && (x = 10), t.y > i + l ? x += 2 : t.y > i && (x += 1);
@@ -1461,7 +1463,7 @@ function Ci(e, t, n) {
1461
1463
  const s = r === 1 ? l : n - l, a = Math.min(n, Math.abs(i - l));
1462
1464
  return s > 0 ? Math.max(0, Math.min(100, 100 * a / s)) * r : 50 * r;
1463
1465
  }
1464
- function hl(e, t, n, o) {
1466
+ function ul(e, t, n, o) {
1465
1467
  const i = Math.min(t, Math.max(0, o === 1 ? n : t - n));
1466
1468
  return n - o * Math.abs(i * e / 100);
1467
1469
  }
@@ -1480,7 +1482,7 @@ function Wn(e, t, n, o) {
1480
1482
  wrapWidth: 134,
1481
1483
  lineSpacing: 3
1482
1484
  });
1483
- let d = hl(r, o, f, l), p = x(d);
1485
+ let d = ul(r, o, f, l), p = x(d);
1484
1486
  const y = p.box.height, b = l === 1 ? Math.min(h - y, d) : Math.max(h + y, d);
1485
1487
  b !== d && (d = b, p = x(d));
1486
1488
  const m = i.showImage ? 80 : 0, g = d + (y + m) * l, w = d + (y + 10 + 35) * l, M = i.showImage ? [d + y * l, d + y * l + 10 * l] : null;
@@ -1500,22 +1502,22 @@ function z(e, t) {
1500
1502
  return { hit: "handle", handleIndex: n };
1501
1503
  return null;
1502
1504
  }
1503
- function ul(e, t, n) {
1505
+ function xl(e, t, n) {
1504
1506
  const o = mt(e, t);
1505
1507
  for (let i = 0; i < 4; i++)
1506
1508
  if (Math.hypot(o[i].x - n.x, o[i].y - n.y) <= ot)
1507
1509
  return { hit: "handle", handleIndex: i };
1508
1510
  return null;
1509
1511
  }
1510
- function xl(e, t, n, o = L) {
1512
+ function dl(e, t, n, o = L) {
1511
1513
  const i = e[0];
1512
1514
  return Math.hypot(0.9 * n - t.x, i.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.abs(t.y - i.y) <= o ? { hit: "body" } : null;
1513
1515
  }
1514
- function dl(e, t, n, o = L) {
1516
+ function yl(e, t, n, o = L) {
1515
1517
  const i = e[0];
1516
1518
  return Math.hypot(i.x - t.x, 0.9 * n - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.abs(t.x - i.x) <= o ? { hit: "body" } : null;
1517
1519
  }
1518
- function yl(e, t, n = L) {
1520
+ function pl(e, t, n = L) {
1519
1521
  const o = e[0];
1520
1522
  return Math.hypot(o.x - t.x, o.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.abs(t.y - o.y) <= n || Math.abs(t.x - o.x) <= n ? { hit: "body" } : null;
1521
1523
  }
@@ -1523,13 +1525,13 @@ function Ti(e, t, n = L) {
1523
1525
  const o = e[0];
1524
1526
  return Math.hypot(o.x - t.x, o.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : t.x >= o.x - ot && Math.abs(t.y - o.y) <= n ? { hit: "body" } : null;
1525
1527
  }
1526
- function pl(e, t, n) {
1528
+ function bl(e, t, n) {
1527
1529
  const o = z(t, n);
1528
1530
  if (o) return o;
1529
1531
  const i = e.style, r = i.extendLeft ? -1 / 0 : Math.min(t[0].x, t[1].x), l = i.extendRight ? 1 / 0 : Math.max(t[0].x, t[1].x), s = Math.min(t[0].y, t[1].y), a = Math.max(t[0].y, t[1].y);
1530
1532
  return n.x >= r - L && n.x <= l + L && n.y >= s - L && n.y <= a + L ? { hit: "body" } : null;
1531
1533
  }
1532
- function bl(e, t, n, o, i) {
1534
+ function ml(e, t, n, o, i) {
1533
1535
  const r = z(t, n);
1534
1536
  if (r) return r;
1535
1537
  const l = e.style, s = l.extendLeft ?? e.kind === "extended-line", a = l.extendRight ?? (e.kind === "ray" || e.kind === "extended-line"), [c, f] = t;
@@ -1545,7 +1547,7 @@ function Ai(e, t, n = L) {
1545
1547
  const o = z(e, t);
1546
1548
  return o || (_(t.x, t.y, e[0], e[1]) <= n ? { hit: "body" } : null);
1547
1549
  }
1548
- function ml(e, t, n, o) {
1550
+ function gl(e, t, n, o) {
1549
1551
  if (!e.points[0] || !e.points[1]) return null;
1550
1552
  const i = In(e, t, o);
1551
1553
  if (!i) return null;
@@ -1567,7 +1569,7 @@ function Rn(e, t, n, o, i, r, l, s) {
1567
1569
  const h = e.x - t.x, u = e.y - t.y, x = (h * o.y - u * o.x) / f, d = (a * u - c * h) / f;
1568
1570
  return (l || x >= 0) && (s || x <= 1) && d >= Math.min(i, r) && d <= Math.max(i, r);
1569
1571
  }
1570
- function gl(e, t, n, o, i) {
1572
+ function wl(e, t, n, o, i) {
1571
1573
  const r = z(t, n);
1572
1574
  if (r) return r;
1573
1575
  const l = Vo(e.kind, t);
@@ -1589,13 +1591,13 @@ function gl(e, t, n, o, i) {
1589
1591
  }
1590
1592
  return null;
1591
1593
  }
1592
- function wl(e, t, n) {
1594
+ function Ml(e, t, n) {
1593
1595
  const o = z(t, n);
1594
1596
  if (o) return o;
1595
1597
  const i = e.style, r = i.extendLeft ? -1 / 0 : Math.min(t[1].x, t[2].x), l = i.extendRight ? 1 / 0 : Math.max(t[1].x, t[2].x), s = Math.min(t[0].y, t[1].y, t[2].y), a = Math.max(t[0].y, t[1].y, t[2].y);
1596
1598
  return n.x >= r - L && n.x <= l + L && n.y >= s - L && n.y <= a + L ? { hit: "body" } : null;
1597
1599
  }
1598
- function Ml(e, t, n, o, i) {
1600
+ function vl(e, t, n, o, i) {
1599
1601
  const r = z(t, n);
1600
1602
  if (r) return r;
1601
1603
  const [l, s] = t, a = (o + i) * 2, c = (e.style.levels ?? vn).filter((f) => f.visible);
@@ -1605,7 +1607,7 @@ function Ml(e, t, n, o, i) {
1605
1607
  }
1606
1608
  return null;
1607
1609
  }
1608
- function vl(e, t, n, o) {
1610
+ function kl(e, t, n, o) {
1609
1611
  const i = z(t, n);
1610
1612
  if (i) return i;
1611
1613
  const r = t[1].x - t[0].x, l = (e.style.levels ?? Cn).filter((s) => s.visible);
@@ -1614,7 +1616,7 @@ function vl(e, t, n, o) {
1614
1616
  return { hit: "body" };
1615
1617
  return _(n.x, n.y, t[0], t[1]) <= o ? { hit: "body" } : null;
1616
1618
  }
1617
- function kl(e, t, n) {
1619
+ function Ll(e, t, n) {
1618
1620
  const o = z(t, n);
1619
1621
  if (o) return o;
1620
1622
  if (e.fmt === 2) {
@@ -1626,7 +1628,7 @@ function kl(e, t, n) {
1626
1628
  const i = Math.hypot(t[1].x - t[0].x, t[1].y - t[0].y);
1627
1629
  return Math.hypot(n.x - t[0].x, n.y - t[0].y) <= i + L ? { hit: "body" } : null;
1628
1630
  }
1629
- function Ll(e, t, n, o, i, r) {
1631
+ function Sl(e, t, n, o, i, r) {
1630
1632
  const [l, s, a] = t, c = s.x - l.x === 0 ? 0 : (a.x - l.x) / (s.x - l.x), f = a.y - (l.y + (s.y - l.y) * c), h = { x: l.x, y: l.y + f }, u = { x: s.x, y: s.y + f }, x = { x: (l.x + s.x) / 2, y: (l.y + s.y) / 2 }, d = [l, s, h, u, { x: x.x, y: x.y + f }, x], p = z(d, n);
1631
1633
  if (p) return p;
1632
1634
  const y = e.style, b = (y.levels ?? _e).filter((g) => g.visible);
@@ -1638,7 +1640,7 @@ function Ll(e, t, n, o, i, r) {
1638
1640
  }
1639
1641
  return y.fillBackground !== !1 && Rn(n, l, s, { x: 0, y: f }, b[0].coeff, b[b.length - 1].coeff, !!y.extendLeft, !!y.extendRight) ? { hit: "body" } : null;
1640
1642
  }
1641
- function Sl(e, t, n, o, i, r) {
1643
+ function Cl(e, t, n, o, i, r) {
1642
1644
  const [l, s, a] = t, c = { x: s.x, y: a.y }, f = { x: l.x, y: a.y + (s.y - l.y) }, u = z([l, s, c, f], n);
1643
1645
  if (u) return u;
1644
1646
  const x = e.style, d = (i + r) * 2;
@@ -1648,7 +1650,7 @@ function Sl(e, t, n, o, i, r) {
1648
1650
  }
1649
1651
  return null;
1650
1652
  }
1651
- function Cl(e, t, n, o, i, r) {
1653
+ function Tl(e, t, n, o, i, r) {
1652
1654
  const l = z(t, n);
1653
1655
  if (l) return l;
1654
1656
  const [s, a, c] = t, f = e.style, h = (i + r) * 2;
@@ -1658,7 +1660,7 @@ function Cl(e, t, n, o, i, r) {
1658
1660
  }
1659
1661
  return null;
1660
1662
  }
1661
- function Tl(e, t, n, o, i, r) {
1663
+ function Al(e, t, n, o, i, r) {
1662
1664
  const l = z(t, n);
1663
1665
  if (l) return l;
1664
1666
  const [s, a, c] = t;
@@ -1672,7 +1674,7 @@ function Tl(e, t, n, o, i, r) {
1672
1674
  }
1673
1675
  return f.fillBackground === !1 ? null : Rn(n, s, a, h, Math.min(...u), Math.max(...u), !!f.extendLeft, !!f.extendRight) ? { hit: "body" } : null;
1674
1676
  }
1675
- function Al(e, t) {
1677
+ function $l(e, t) {
1676
1678
  const n = z(e, t);
1677
1679
  if (n) return n;
1678
1680
  const [o, i, r] = e;
@@ -1690,7 +1692,7 @@ function $i(e, t) {
1690
1692
  ];
1691
1693
  }
1692
1694
  function un(e, t, n = !1) {
1693
- const [o, i] = e, r = ul(o, i, t);
1695
+ const [o, i] = e, r = xl(o, i, t);
1694
1696
  if (r) return r;
1695
1697
  if (n) {
1696
1698
  const f = $i(o, i);
@@ -1701,13 +1703,13 @@ function un(e, t, n = !1) {
1701
1703
  const l = Math.min(o.x, i.x), s = Math.max(o.x, i.x), a = Math.min(o.y, i.y), c = Math.max(o.y, i.y);
1702
1704
  return t.x >= l - L && t.x <= s + L && t.y >= a - L && t.y <= c + L ? { hit: "body" } : null;
1703
1705
  }
1704
- function $l(e, t) {
1706
+ function Bl(e, t) {
1705
1707
  const n = z(e, t);
1706
1708
  if (n) return n;
1707
1709
  const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y);
1708
1710
  return Math.hypot(t.x - o.x, t.y - o.y) <= r + L ? { hit: "body" } : null;
1709
1711
  }
1710
- function Bl(e, t, n, o) {
1712
+ function Il(e, t, n, o) {
1711
1713
  const i = z(t, n);
1712
1714
  if (i) return i;
1713
1715
  const r = e.style.extendLeft ? 0 : Math.min(t[0].x, t[1].x), l = e.style.extendRight ? o : Math.max(t[0].x, t[1].x), s = Math.min(t[0].y, t[1].y), a = Math.max(t[0].y, t[1].y);
@@ -1719,11 +1721,11 @@ function ho(e, t) {
1719
1721
  const o = Math.min(e[0].x, e[1].x), i = Math.max(e[0].x, e[1].x), r = Math.min(e[0].y, e[1].y), l = Math.max(e[0].y, e[1].y);
1720
1722
  return t.x >= o - L && t.x <= i + L && t.y >= r - L && t.y <= l + L ? { hit: "body" } : null;
1721
1723
  }
1722
- function Il(e, t, n) {
1724
+ function Pl(e, t, n) {
1723
1725
  const o = e.fmt === 2, i = Do(t, o), r = o ? [t[0], t[1], ...i] : t, l = z(r, n);
1724
1726
  return l || (Qt(n.x, n.y, i) ? { hit: "body" } : null);
1725
1727
  }
1726
- function Pl(e, t) {
1728
+ function El(e, t) {
1727
1729
  const n = z(e, t);
1728
1730
  return n || (Qt(t.x, t.y, e) ? { hit: "body" } : null);
1729
1731
  }
@@ -1733,7 +1735,7 @@ function te(e, t, n = L) {
1733
1735
  return { hit: "body" };
1734
1736
  return null;
1735
1737
  }
1736
- function El(e, t, n, o, i = L) {
1738
+ function zl(e, t, n, o, i = L) {
1737
1739
  const r = z(t, n);
1738
1740
  if (r) return r;
1739
1741
  const l = ii(e, t, o);
@@ -1750,7 +1752,7 @@ function El(e, t, n, o, i = L) {
1750
1752
  if (Math.abs(n.x - s.x) <= 1 + i && n.y >= s.top - i && n.y <= s.bottom + i) return { hit: "body" };
1751
1753
  return null;
1752
1754
  }
1753
- function zl(e, t, n, o) {
1755
+ function Wl(e, t, n, o) {
1754
1756
  const i = z(t, n);
1755
1757
  if (i) return i;
1756
1758
  const r = t[0], l = o === "up" ? r.y : r.y - 22;
@@ -1758,7 +1760,7 @@ function zl(e, t, n, o) {
1758
1760
  const s = ri(e, r);
1759
1761
  return s && n.x >= s.left && n.x <= s.left + s.width && n.y >= s.top && n.y <= s.top + s.height ? { hit: "body" } : null;
1760
1762
  }
1761
- function Wl(e, t, n, o, i) {
1763
+ function Rl(e, t, n, o, i) {
1762
1764
  const r = z(t, n);
1763
1765
  if (r) return r;
1764
1766
  const [l, s] = t, a = oi(e, t, i, Pe), c = Math.max(o, Math.abs(s.y - l.y) + Math.max(l.y, s.y)), f = [...a.h.map((x) => ({ x: s.x, y: x.y })), ...a.v.map((x) => ({ x: x.x, y: s.y }))];
@@ -1771,7 +1773,7 @@ function Wl(e, t, n, o, i) {
1771
1773
  if (_(n.x, n.y, x, d) <= L) return { hit: "body" };
1772
1774
  return null;
1773
1775
  }
1774
- function Rl(e, t, n, o) {
1776
+ function Fl(e, t, n, o) {
1775
1777
  const i = z(t, n);
1776
1778
  if (i) return i;
1777
1779
  const [r, l, s] = t;
@@ -1785,7 +1787,7 @@ function Rl(e, t, n, o) {
1785
1787
  }
1786
1788
  return _(n.x, n.y, l, s) <= L ? { hit: "body" } : null;
1787
1789
  }
1788
- function Fl(e, t, n, o, i) {
1790
+ function Ol(e, t, n, o, i) {
1789
1791
  const r = z(t, n);
1790
1792
  if (r) return r;
1791
1793
  const [l, s, a] = t;
@@ -1796,7 +1798,7 @@ function Fl(e, t, n, o, i) {
1796
1798
  if (Math.abs(n.x - f.x) <= Math.max(o, (f.width ?? 1) / 2 + 2)) return { hit: "body" };
1797
1799
  return null;
1798
1800
  }
1799
- function Ol(e, t, n) {
1801
+ function Dl(e, t, n) {
1800
1802
  const o = z(t, n);
1801
1803
  if (o) return o;
1802
1804
  const i = Ho(e, t);
@@ -1804,7 +1806,7 @@ function Ol(e, t, n) {
1804
1806
  const r = No(i);
1805
1807
  return n.x >= r.left - L && n.x <= r.right + L && n.y >= r.top - L && n.y <= r.bottom + L ? { hit: "body" } : null;
1806
1808
  }
1807
- function Dl(e, t) {
1809
+ function _l(e, t) {
1808
1810
  const n = z(e, t);
1809
1811
  if (n) return n;
1810
1812
  const [o, i, r] = e;
@@ -1821,7 +1823,7 @@ function Dl(e, t) {
1821
1823
  for (; h < -Math.PI; ) h += 2 * Math.PI;
1822
1824
  return (c >= 0 ? h >= -0.05 && h <= c + 0.05 : h <= 0.05 && h >= c - 0.05) && f <= l + L ? { hit: "body" } : null;
1823
1825
  }
1824
- function _l(e, t, n) {
1826
+ function Hl(e, t, n) {
1825
1827
  const o = z(t, n);
1826
1828
  if (o) return o;
1827
1829
  const [i, r, l] = t;
@@ -1845,7 +1847,7 @@ function _l(e, t, n) {
1845
1847
  }
1846
1848
  return null;
1847
1849
  }
1848
- function Hl(e, t, n) {
1850
+ function Nl(e, t, n) {
1849
1851
  const o = z(t, n);
1850
1852
  if (o) return o;
1851
1853
  const [i, r] = t, l = Math.hypot(r.x - i.x, r.y - i.y);
@@ -1909,10 +1911,10 @@ function dn(e, t = !1, n = !1) {
1909
1911
  }
1910
1912
  return f;
1911
1913
  }
1912
- const Nl = /* @__PURE__ */ new Set([
1914
+ const Yl = /* @__PURE__ */ new Set([
1913
1915
  "triangle-pattern"
1914
1916
  ]);
1915
- function Yl(e, t, n) {
1917
+ function Vl(e, t, n) {
1916
1918
  const o = z(t, n);
1917
1919
  if (o) return o;
1918
1920
  const i = Ne(e.style);
@@ -1920,7 +1922,7 @@ function Yl(e, t, n) {
1920
1922
  if (_(n.x, n.y, t[r - 1], t[r]) <= i) return { hit: "body" };
1921
1923
  if (e.kind === "xabcd-pattern" || e.kind === "cypher-pattern")
1922
1924
  return t.length >= 3 && Qt(n.x, n.y, [t[0], t[1], t[2]]) ? { hit: "body" } : t.length >= 5 && Qt(n.x, n.y, [t[2], t[3], t[4]]) ? { hit: "body" } : null;
1923
- if (Nl.has(e.kind) && t.length >= 3 && Qt(n.x, n.y, t))
1925
+ if (Yl.has(e.kind) && t.length >= 3 && Qt(n.x, n.y, t))
1924
1926
  return { hit: "body" };
1925
1927
  if (e.kind === "polyline" && e.closed === !0 && e.style.fillBackground !== !1 && t.length >= 2) {
1926
1928
  if (_(n.x, n.y, t[t.length - 1], t[0]) <= i) return { hit: "body" };
@@ -1928,7 +1930,7 @@ function Yl(e, t, n) {
1928
1930
  }
1929
1931
  return null;
1930
1932
  }
1931
- function Vl(e, t, n = L) {
1933
+ function Ul(e, t, n = L) {
1932
1934
  if (e.length === 0) return null;
1933
1935
  const o = e.length - 1;
1934
1936
  return Math.hypot(e[0].x - t.x, e[0].y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : Math.hypot(e[o].x - t.x, e[o].y - t.y) <= ot ? { hit: "handle", handleIndex: o } : te(e, t, n);
@@ -1937,7 +1939,7 @@ function de(e, t, n, o = L) {
1937
1939
  const i = z(t, n);
1938
1940
  return i || te(e, n, o);
1939
1941
  }
1940
- function Ul(e, t, n, o) {
1942
+ function Xl(e, t, n, o) {
1941
1943
  const i = z(e, t);
1942
1944
  if (i) return i;
1943
1945
  const [r, l] = e, s = l.x - r.x;
@@ -1946,7 +1948,7 @@ function Ul(e, t, n, o) {
1946
1948
  if (Math.abs(t.x - a) <= o) return { hit: "body" };
1947
1949
  return _(t.x, t.y, r, l) <= o ? { hit: "body" } : null;
1948
1950
  }
1949
- function Xl(e, t, n, o) {
1951
+ function Gl(e, t, n, o) {
1950
1952
  const i = z(e, t);
1951
1953
  if (i) return i;
1952
1954
  const [r, l] = e, s = Math.abs(l.x - r.x);
@@ -1960,7 +1962,7 @@ function Xl(e, t, n, o) {
1960
1962
  }
1961
1963
  return null;
1962
1964
  }
1963
- function Gl(e, t, n, o) {
1965
+ function jl(e, t, n, o) {
1964
1966
  var s;
1965
1967
  const i = z(t, n);
1966
1968
  if (i) return i;
@@ -1968,7 +1970,7 @@ function Gl(e, t, n, o) {
1968
1970
  const r = (o == null ? void 0 : o.pipSize()) ?? 0.01, l = (s = Xo(e, t, Math.max(0, Math.min(8, Math.round(-Math.log10(r)))))) == null ? void 0 : s.box;
1969
1971
  return l && n.x >= l.left && n.x <= l.left + l.width && n.y >= l.top && n.y <= l.top + l.height ? { hit: "body" } : null;
1970
1972
  }
1971
- function jl(e, t, n, o, i) {
1973
+ function ql(e, t, n, o, i) {
1972
1974
  const r = jo(e, i, o), l = z(r ? r.anchors : t, n);
1973
1975
  if (l) return l;
1974
1976
  if (!r) return Ai(t, n);
@@ -1978,7 +1980,7 @@ function jl(e, t, n, o, i) {
1978
1980
  return { hit: "body" };
1979
1981
  return null;
1980
1982
  }
1981
- function ql(e, t, n, o) {
1983
+ function Zl(e, t, n, o) {
1982
1984
  if (Math.hypot(t[0].x - n.x, t[0].y - n.y) <= ot)
1983
1985
  return { hit: "handle", handleIndex: 0 };
1984
1986
  const i = Ko(e, o);
@@ -1991,15 +1993,15 @@ function ql(e, t, n, o) {
1991
1993
  }
1992
1994
  return null;
1993
1995
  }
1994
- function Zl(e, t, n = L) {
1996
+ function Kl(e, t, n = L) {
1995
1997
  const o = z(e, t);
1996
1998
  return o || te(Qo(e[0], e[1]), t, n);
1997
1999
  }
1998
- function Kl(e, t) {
2000
+ function Ql(e, t) {
1999
2001
  const n = e[0];
2000
2002
  return Math.hypot(n.x - t.x, n.y - t.y) <= ot ? { hit: "handle", handleIndex: 0 } : t.x >= n.x - L && t.x <= n.x + 17 + L && t.y >= n.y - 22 - L && t.y <= n.y + L ? { hit: "body" } : null;
2001
2003
  }
2002
- function Ql(e, t, n, o) {
2004
+ function Jl(e, t, n, o) {
2003
2005
  if (!e.ghost) return un(t, n);
2004
2006
  const i = z(t, n);
2005
2007
  if (i) return i;
@@ -2012,28 +2014,28 @@ function Ql(e, t, n, o) {
2012
2014
  if (_(n.x, n.y, t[l - 1], t[l]) <= r) return { hit: "body" };
2013
2015
  return null;
2014
2016
  }
2015
- function Jl(e, t, n, o, i, r, l = !1) {
2017
+ function ts(e, t, n, o, i, r, l = !1) {
2016
2018
  var a;
2017
2019
  const s = Ne(e.style);
2018
2020
  switch (e.kind) {
2019
2021
  case "horizontal-line":
2020
- return xl(t, n, o, s);
2022
+ return dl(t, n, o, s);
2021
2023
  case "horizontal-ray":
2022
2024
  return Ti(t, n, s);
2023
2025
  case "vertical-line":
2024
- return dl(t, n, i, s);
2026
+ return yl(t, n, i, s);
2025
2027
  case "cross-line":
2026
- return yl(t, n, s);
2028
+ return pl(t, n, s);
2027
2029
  case "arrow-mark-up":
2028
2030
  case "arrow-mark-down":
2029
- return zl(e, t, n, e.kind === "arrow-mark-up" ? "up" : "down");
2031
+ return Wl(e, t, n, e.kind === "arrow-mark-up" ? "up" : "down");
2030
2032
  case "font-icon":
2031
2033
  return Lr(t, n);
2032
2034
  case "table": {
2033
2035
  const c = En(e, t[0]), f = z(di(c), n);
2034
2036
  if (f) return f;
2035
- const h = jr(c, n, l);
2036
- return h ? "edge" in h ? { hit: "handle", handleIndex: Vr(h.edge) } : { hit: "body", cell: h.cell } : null;
2037
+ const h = qr(c, n, l);
2038
+ return h ? "edge" in h ? { hit: "handle", handleIndex: Ur(h.edge) } : { hit: "body", cell: h.cell } : null;
2037
2039
  }
2038
2040
  case "image": {
2039
2041
  const c = bi(e, t[0]);
@@ -2048,56 +2050,56 @@ function Jl(e, t, n, o, i, r, l = !1) {
2048
2050
  return Dt(n, { left: f.x, top: f.y, width: f.w, height: f.h }) ? { hit: "body" } : null;
2049
2051
  }
2050
2052
  case "flag-mark":
2051
- return Kl(t, n);
2053
+ return Ql(t, n);
2052
2054
  case "trend-line":
2053
2055
  case "ray":
2054
2056
  case "extended-line":
2055
2057
  case "info-line":
2056
2058
  case "arrow":
2057
2059
  case "trend-angle":
2058
- return bl(e, t, n, o, i);
2060
+ return ml(e, t, n, o, i);
2059
2061
  case "arrow-marker":
2060
2062
  return Ai(t, n, s);
2061
2063
  case "position-forecast":
2062
- return Zl(t, n, s);
2064
+ return Kl(t, n, s);
2063
2065
  case "long-position":
2064
2066
  case "short-position":
2065
- return ml(e, t, n, r);
2067
+ return gl(e, t, n, r);
2066
2068
  case "bar-pattern":
2067
- return El(e, t, n, r, s);
2069
+ return zl(e, t, n, r, s);
2068
2070
  case "ghost-feed":
2069
- return Ql(e, t, n, r);
2071
+ return Jl(e, t, n, r);
2070
2072
  case "gann-box":
2071
2073
  return un(t, n);
2072
2074
  case "gann-fan":
2073
- return Ml(e, t, n, o, i);
2075
+ return vl(e, t, n, o, i);
2074
2076
  case "fib-time-zone":
2075
- return vl(e, t, n, s);
2077
+ return kl(e, t, n, s);
2076
2078
  case "fib-circles":
2077
- return kl(e, t, n);
2079
+ return Ll(e, t, n);
2078
2080
  case "fib-speed-resistance-fan":
2079
- return Wl(e, t, n, o, r);
2081
+ return Rl(e, t, n, o, r);
2080
2082
  case "pitchfan":
2081
- return Rl(e, t, n, o);
2083
+ return Fl(e, t, n, o);
2082
2084
  case "fib-wedge":
2083
- return _l(e, t, n);
2085
+ return Hl(e, t, n);
2084
2086
  case "trend-based-fib-time":
2085
- return Fl(e, t, n, s, r);
2087
+ return Ol(e, t, n, s, r);
2086
2088
  case "gann-square-fixed":
2087
2089
  case "gann-square":
2088
- return Ol(e, t, n);
2090
+ return Dl(e, t, n);
2089
2091
  case "sector":
2090
- return Dl(t, n);
2092
+ return _l(t, n);
2091
2093
  case "fib-speed-resistance-arcs":
2092
- return Hl(e, t, n);
2094
+ return Nl(e, t, n);
2093
2095
  case "fib-spiral":
2094
2096
  return de(Bi(t[0], t[1], !!e.style.counterclockwise), t, n, s);
2095
2097
  case "sine-line":
2096
2098
  return de(Ii(t[0], t[1], o), t, n, s);
2097
2099
  case "time-cycles":
2098
- return Xl(t, n, o, s);
2100
+ return Gl(t, n, o, s);
2099
2101
  case "cyclic-lines":
2100
- return Ul(t, n, o, s);
2102
+ return Xl(t, n, o, s);
2101
2103
  case "curve":
2102
2104
  return de(
2103
2105
  xn(t, !!e.style.extendLeft, !!e.style.extendRight),
@@ -2147,13 +2149,13 @@ function Jl(e, t, n, o, i, r, l = !1) {
2147
2149
  return c || (t[1] && _(n.x, n.y, t[0], t[1]) <= L ? { hit: "body" } : t[1] && Dt(n, gi(e, e.style, t[0], t[1]).box) ? { hit: "body" } : null);
2148
2150
  }
2149
2151
  case "price-note":
2150
- return Gl(e, t, n, r);
2152
+ return jl(e, t, n, r);
2151
2153
  case "callout": {
2152
2154
  const c = Li(e, t[1]);
2153
2155
  return Math.hypot(t[0].x - n.x, t[0].y - n.y) <= ot ? { hit: "handle", handleIndex: 0 } : l && c.wrap != null && Math.hypot(t[1].x + c.wrap / 2 + 10 - n.x, t[1].y - n.y) <= ot ? { hit: "handle", handleIndex: 1 } : Dt(n, { left: c.x, top: c.y, width: c.w, height: c.h }) ? { hit: "body" } : null;
2154
2156
  }
2155
2157
  case "regression-trend":
2156
- return jl(e, t, n, o, r);
2158
+ return ql(e, t, n, o, r);
2157
2159
  case "fixed-range-volume-profile": {
2158
2160
  const c = z(t, n);
2159
2161
  if (c) return c;
@@ -2167,7 +2169,7 @@ function Jl(e, t, n, o, i, r, l = !1) {
2167
2169
  return f && n.x >= f.left && n.x <= f.right && n.y >= f.top && n.y <= f.bottom ? { hit: "body" } : null;
2168
2170
  }
2169
2171
  case "anchored-vwap":
2170
- return ql(e, t, n, r);
2172
+ return Zl(e, t, n, r);
2171
2173
  case "abcd-pattern":
2172
2174
  case "xabcd-pattern":
2173
2175
  case "cypher-pattern":
@@ -2181,29 +2183,29 @@ function Jl(e, t, n, o, i, r, l = !1) {
2181
2183
  case "elliott-triple-combo":
2182
2184
  case "polyline":
2183
2185
  case "path":
2184
- return Yl(e, t, n);
2186
+ return Vl(e, t, n);
2185
2187
  case "brush":
2186
2188
  case "highlighter":
2187
- return Vl(t, n, s);
2189
+ return Ul(t, n, s);
2188
2190
  case "parallel-channel":
2189
- return Ll(e, t, n, s, o, i);
2190
- case "disjoint-channel":
2191
2191
  return Sl(e, t, n, s, o, i);
2192
- case "flat-top-bottom":
2192
+ case "disjoint-channel":
2193
2193
  return Cl(e, t, n, s, o, i);
2194
+ case "flat-top-bottom":
2195
+ return Tl(e, t, n, s, o, i);
2194
2196
  case "pitchfork":
2195
2197
  case "schiff-pitchfork":
2196
2198
  case "modified-schiff-pitchfork":
2197
2199
  case "inside-pitchfork":
2198
- return gl(e, t, n, o, i);
2200
+ return wl(e, t, n, o, i);
2199
2201
  case "fib-channel":
2200
- return Tl(e, t, n, s, o, i);
2202
+ return Al(e, t, n, s, o, i);
2201
2203
  case "rotated-rectangle":
2202
- return Il(e, t, n);
2204
+ return Pl(e, t, n);
2203
2205
  case "trend-based-fib-extension":
2204
- return wl(e, t, n);
2206
+ return Ml(e, t, n);
2205
2207
  case "fib-retracement":
2206
- return pl(e, t, n);
2208
+ return bl(e, t, n);
2207
2209
  case "rectangle": {
2208
2210
  const c = (r == null ? void 0 : r.timeAxis().width) || o, f = un(t, n, !0);
2209
2211
  if (f) return f;
@@ -2215,20 +2217,20 @@ function Jl(e, t, n, o, i, r, l = !1) {
2215
2217
  return h && n.x >= h.left && n.x <= h.left + h.width && n.y >= h.top && n.y <= h.top + h.height ? { hit: "body" } : null;
2216
2218
  }
2217
2219
  case "circle":
2218
- return $l(t, n);
2220
+ return Bl(t, n);
2219
2221
  case "ellipse":
2220
- return Al(t, n);
2222
+ return $l(t, n);
2221
2223
  case "price-range":
2222
- return Bl(e, t, n, o);
2224
+ return Il(e, t, n, o);
2223
2225
  case "date-range":
2224
2226
  return ho(t, n);
2225
2227
  case "date-and-price-range":
2226
2228
  return ho(t, n);
2227
2229
  case "triangle":
2228
- return Pl(t, n);
2230
+ return El(t, n);
2229
2231
  }
2230
2232
  }
2231
- function ts(e) {
2233
+ function es(e) {
2232
2234
  const t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((o) => o + o).join("") : t;
2233
2235
  return [parseInt(n.slice(0, 2), 16), parseInt(n.slice(2, 4), 16), parseInt(n.slice(4, 6), 16)];
2234
2236
  }
@@ -2242,10 +2244,10 @@ function ct(e) {
2242
2244
  }
2243
2245
  function Lt(e, t) {
2244
2246
  if (t >= 100) return e;
2245
- const [n, o, i] = ts(e);
2247
+ const [n, o, i] = es(e);
2246
2248
  return `rgba(${n}, ${o}, ${i}, ${(t / 100).toFixed(2)})`;
2247
2249
  }
2248
- function es(e) {
2250
+ function ns(e) {
2249
2251
  let t = 0, n = 0, o = 0;
2250
2252
  const i = e.match(/^#([0-9a-f]{6})/i);
2251
2253
  if (i) {
@@ -2257,8 +2259,8 @@ function es(e) {
2257
2259
  }
2258
2260
  return 0.199 * t + 0.687 * n + 0.114 * o >= 150 ? "#000000" : "#ffffff";
2259
2261
  }
2260
- const Gt = (e, t) => ({ ...e, back: t, color: es(t) });
2261
- function ns(e, t, n) {
2262
+ const Gt = (e, t) => ({ ...e, back: t, color: ns(t) });
2263
+ function os(e, t, n) {
2262
2264
  const o = e.style, i = [], r = [];
2263
2265
  if ((e.kind === "vertical-line" || e.kind === "cross-line") && o.showTime && e.points[0] && r.push(Gt({ time: e.points[0].time }, ct(o.color).hex)), e.kind === "long-position" || e.kind === "short-position") {
2264
2266
  if (o.showPriceLabels !== !1) {
@@ -2289,7 +2291,7 @@ function st(e, t) {
2289
2291
  const n = Ei();
2290
2292
  return n ? (ze ?? (ze = getComputedStyle(document.body).fontFamily), n.font = `${t}px ${ze}`, n.measureText(e).width) : e.length * t * 0.6;
2291
2293
  }
2292
- function os(e, t) {
2294
+ function is(e, t) {
2293
2295
  const n = Ei();
2294
2296
  return n ? (ze ?? (ze = getComputedStyle(document.body).fontFamily), n.font = `bold ${t}px ${ze}`, n.measureText(e).width) : e.length * t * 0.65;
2295
2297
  }
@@ -2311,7 +2313,7 @@ function Fn(e) {
2311
2313
  const s = l.join(" ");
2312
2314
  return t ? `-${s}` : s;
2313
2315
  }
2314
- function is(e) {
2316
+ function rs(e) {
2315
2317
  const t = [[1e9, " B"], [1e6, " M"], [1e3, " K"]];
2316
2318
  for (const [n, o] of t) if (Math.abs(e) >= n) return `${Number((e / n).toFixed(2))}${o}`;
2317
2319
  return String(Math.round(e));
@@ -2391,7 +2393,7 @@ const Yt = {
2391
2393
  // close point, stop, target (line-tool-risk-reward)
2392
2394
  single: [0]
2393
2395
  // horizontal line, vertical line, signpost pole
2394
- }, rs = 50, ls = {
2396
+ }, ls = 50, ss = {
2395
2397
  price: "M3 2h11v1H3V2Zm5.5 1.8.35.35 2 2 .36.35-.71.7-.35-.35L9 5.71v6.58l1.15-1.14.35-.36.7.71-.35.35-2 2-.35.36-.35-.36-2-2-.36-.35.71-.7.35.35L8 12.29V5.71L6.85 6.85l-.35.36-.7-.71.35-.35 2-2 .35-.36ZM3.5 16H3v-1h11v1H3.5Z",
2396
2398
  bars: "M2 3v2H1v9h1v2h1v-2h1V5H3V3H2Zm6.2 4.5-.35.35L6.71 9h4.58l-1.14-1.15-.36-.35.71-.7.35.35 2 2 .36.35-.36.35-2 2-.35.36-.7-.71.35-.35L11.29 10H6.71l1.14 1.15.36.35-.71.7-.35-.35-2-2-.36-.35.36-.35 2-2 .35-.36.7.71ZM3 6H2v7h1V6Zm12-2.5V3h1v2h1v9h-1v2h-1v-2h-1V5h1V3.5ZM15 6h1v7h-1V6Z",
2397
2399
  angle: "M8.55 2.78 2.7 15H15v-1h-4.01a6.2 6.2 0 0 0-1.36-3.95 7.94 7.94 0 0 0-2.57-1.83l2.4-5-.91-.44ZM6.63 9.12 4.29 14H10a5.18 5.18 0 0 0-1.12-3.3 6.93 6.93 0 0 0-2.24-1.58Z"
@@ -2448,13 +2450,13 @@ function Oi(e, t, n, o, i, r) {
2448
2450
  };
2449
2451
  return f(-l, e.x - n) && f(l, n + i - e.x) && f(-s, e.y - o) && f(s, o + r - e.y) && a <= c;
2450
2452
  }
2451
- function ss(e, t, n, o) {
2453
+ function cs(e, t, n, o) {
2452
2454
  return e.x === t.x && e.y === t.y ? e.x >= 0 && e.x <= n && e.y >= 0 && e.y <= o : Oi(e, t, 0, 0, n, o);
2453
2455
  }
2454
2456
  function Di(e, t, n, o, i, r, l) {
2455
2457
  if (!i || n.length === 0) return [];
2456
2458
  const s = o === 3;
2457
- if (s && !ss(e, t, r, l)) return [];
2459
+ if (s && !cs(e, t, r, l)) return [];
2458
2460
  const a = 12, c = 18, f = 8, h = 12;
2459
2461
  let x = Math.max(...n.map((k) => st(k.text, a))) + h * 2 + c + h;
2460
2462
  Math.round(x) % 2 !== 0 && (x = Math.round(x) + 1);
@@ -2464,7 +2466,7 @@ function Di(e, t, n, o, i, r, l) {
2464
2466
  const w = Math.floor(m), M = Math.floor(g), v = [{ t: "rect", x: w, y: M, w: x, h: d, rx: 4, ry: 4, fill: "#464646", fillOpacity: 230 / 255 }];
2465
2467
  return n.forEach((k, S) => {
2466
2468
  const C = M + h + S * (c + f);
2467
- v.push({ t: "path", d: ls[k.icon], transform: `translate(${w + h}, ${C})`, fill: "#F9F9F9", fillRule: "evenodd" }), v.push({ t: "text", x: w + h + c + h, y: C + c / 2, text: k.text, size: a, fill: "#FFFFFF", baseline: "central" });
2469
+ v.push({ t: "path", d: ss[k.icon], transform: `translate(${w + h}, ${C})`, fill: "#F9F9F9", fillRule: "evenodd" }), v.push({ t: "text", x: w + h + c + h, y: C + c / 2, text: k.text, size: a, fill: "#FFFFFF", baseline: "central" });
2468
2470
  }), [{ t: "group", inert: !0, items: v }];
2469
2471
  }
2470
2472
  function Ge(e, t, n) {
@@ -2502,7 +2504,7 @@ function Dn(e, t, n, o, i, r, l, s, a) {
2502
2504
  }];
2503
2505
  return o.showMiddlePoint && s && u.push({ t: "anchors", pts: [{ x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 }] }), u.push(...Xe(t, n, t, n, _i(o), (o.fontSize ?? 14) / 3)), u.push(...Di(t, n, c, f, h, i, r)), u;
2504
2506
  }
2505
- function cs(e, t, n) {
2507
+ function as(e, t, n) {
2506
2508
  if (!n.text) return null;
2507
2509
  const o = n.horzLabelsAlign ?? "center";
2508
2510
  return G({
@@ -2517,7 +2519,7 @@ function cs(e, t, n) {
2517
2519
  offsetX: o === "right" ? 3 : 0
2518
2520
  });
2519
2521
  }
2520
- function as(e, t, n) {
2522
+ function fs(e, t, n) {
2521
2523
  if (!n.text) return null;
2522
2524
  const o = n.horzLabelsAlign ?? "center", i = { y: e.y, text: n.text, fs: n.fontSize ?? 12, bold: n.bold, italic: n.italic, vert: n.vertLabelsAlign ?? "top", horz: o };
2523
2525
  if (o === "right") {
@@ -2530,8 +2532,8 @@ function _n(e, t) {
2530
2532
  return e && t === "middle" && Me(e.lines) ? e.poly : null;
2531
2533
  }
2532
2534
  const St = (e, t) => ({ t: "hit", a: e, b: t, width: 12 }), Hi = (e) => (e.lineStyle ?? "solid") === "solid" ? "round" : "butt";
2533
- function fs(e, t, n, o) {
2534
- const i = e[0], r = cs(i.y, n, o), l = ie("cut", _n(r, o.vertLabelsAlign ?? "middle"));
2535
+ function hs(e, t, n, o) {
2536
+ const i = e[0], r = as(i.y, n, o), l = ie("cut", _n(r, o.vertLabelsAlign ?? "middle"));
2535
2537
  return [
2536
2538
  St({ x: 0, y: i.y }, { x: n, y: i.y }),
2537
2539
  ...l.items,
@@ -2541,7 +2543,7 @@ function fs(e, t, n, o) {
2541
2543
  ...t ? [{ t: "anchors", pts: [{ x: 0.9 * n, y: i.y }], squares: Yt.single }] : []
2542
2544
  ];
2543
2545
  }
2544
- function hs(e, t, n, o) {
2546
+ function us(e, t, n, o) {
2545
2547
  var h;
2546
2548
  const i = e[0], r = o.vertLabelsAlign ?? "middle", l = o.horzLabelsAlign ?? "center", s = o.textOrientation === "horizontal", a = r === "top" ? n : r === "middle" ? n / 2 : 0, c = o.text ? G(s ? {
2547
2549
  x: i.x,
@@ -2573,7 +2575,7 @@ function hs(e, t, n, o) {
2573
2575
  ...t ? [{ t: "anchors", pts: [{ x: i.x, y: 0.9 * n }], squares: Yt.single }] : []
2574
2576
  ];
2575
2577
  }
2576
- function us(e, t, n, o, i) {
2578
+ function xs(e, t, n, o, i) {
2577
2579
  const r = e[0], l = W(i);
2578
2580
  return [
2579
2581
  St({ x: 0, y: r.y }, { x: n, y: r.y }),
@@ -2603,8 +2605,8 @@ function Te(e, t, n, o, i, r, l, s, a, c) {
2603
2605
  ...n ? [{ t: "anchors", pts: t }] : []
2604
2606
  ];
2605
2607
  }
2606
- function xs(e, t, n, o) {
2607
- const i = e[0], r = as(i, n, o), l = ie("cut", _n(r, o.vertLabelsAlign ?? "top"));
2608
+ function ds(e, t, n, o) {
2609
+ const i = e[0], r = fs(i, n, o), l = ie("cut", _n(r, o.vertLabelsAlign ?? "top"));
2608
2610
  return [
2609
2611
  St(i, { x: n, y: i.y }),
2610
2612
  ...l.items,
@@ -2613,7 +2615,7 @@ function xs(e, t, n, o) {
2613
2615
  ...t ? [{ t: "anchors", pts: [i] }] : []
2614
2616
  ];
2615
2617
  }
2616
- function ds(e, t, n, o, i, r, l, s) {
2618
+ function ys(e, t, n, o, i, r, l, s) {
2617
2619
  if (e.kind !== "info-line") return [];
2618
2620
  const [a, c] = t, f = ie("cut", On(a, c, r)), h = Math.hypot(c.x - a.x, c.y - a.y) || 1, u = (o + i) * 2, x = (c.x - a.x) / h, d = (c.y - a.y) / h, p = r.extendLeft ? { x: a.x - x * u, y: a.y - d * u } : a, y = r.extendRight ? { x: c.x + x * u, y: c.y + d * u } : c;
2619
2621
  return [
@@ -2624,8 +2626,8 @@ function ds(e, t, n, o, i, r, l, s) {
2624
2626
  ...n ? [{ t: "anchors", pts: t }] : []
2625
2627
  ];
2626
2628
  }
2627
- function ys(e, t, n, o, i, r, l, s) {
2628
- const [a, c] = t, f = c.x - a.x, h = c.y - a.y, u = r.angle ?? Math.atan2(-h, f) * 180 / Math.PI, x = u * Math.PI / 180, d = rs, p = { x: a.x + d * Math.cos(x), y: a.y - d * Math.sin(x) }, y = `M ${a.x} ${a.y} L ${a.x + d} ${a.y} A ${d} ${d} 0 ${Math.abs(x) > Math.PI ? 1 : 0} ${x > 0 ? 0 : 1} ${p.x} ${p.y}`, b = r.fontSize ?? 12, m = Math.hypot(f, h) || 1, g = (o + i) * 2, w = r.extendLeft ? { x: a.x - f / m * g, y: a.y - h / m * g } : a, M = r.extendRight ? { x: c.x + f / m * g, y: c.y + h / m * g } : c;
2629
+ function ps(e, t, n, o, i, r, l, s) {
2630
+ const [a, c] = t, f = c.x - a.x, h = c.y - a.y, u = r.angle ?? Math.atan2(-h, f) * 180 / Math.PI, x = u * Math.PI / 180, d = ls, p = { x: a.x + d * Math.cos(x), y: a.y - d * Math.sin(x) }, y = `M ${a.x} ${a.y} L ${a.x + d} ${a.y} A ${d} ${d} 0 ${Math.abs(x) > Math.PI ? 1 : 0} ${x > 0 ? 0 : 1} ${p.x} ${p.y}`, b = r.fontSize ?? 12, m = Math.hypot(f, h) || 1, g = (o + i) * 2, w = r.extendLeft ? { x: a.x - f / m * g, y: a.y - h / m * g } : a, M = r.extendRight ? { x: c.x + f / m * g, y: c.y + h / m * g } : c;
2629
2631
  return [
2630
2632
  St(a, c),
2631
2633
  { t: "line", a: w, b: M, stroke: r.color, strokeWidth: r.width, dash: W(r), cap: Hi(r) },
@@ -2669,23 +2671,23 @@ function We(e, t, n, o, i) {
2669
2671
  r: o ? { x: t.x + r / s * i, y: t.y + l / s * i } : t
2670
2672
  };
2671
2673
  }
2672
- function ps(e) {
2674
+ function bs(e) {
2673
2675
  const [t, n, o] = e, i = n.x - t.x === 0 ? 0 : (o.x - t.x) / (n.x - t.x), r = o.y - (t.y + (n.y - t.y) * i), l = { x: (t.x + n.x) / 2, y: (t.y + n.y) / 2 };
2674
2676
  return {
2675
2677
  anchors: [t, n, { x: t.x, y: t.y + r }, { x: n.x, y: n.y + r }, { x: l.x, y: l.y + r }, l],
2676
2678
  dy: r
2677
2679
  };
2678
2680
  }
2679
- function bs(e) {
2681
+ function ms(e) {
2680
2682
  const [t, n, o] = e, i = { x: n.x, y: o.y }, r = { x: t.x, y: o.y + (n.y - t.y) };
2681
2683
  return { anchors: [t, n, i, r], P: i, A: r };
2682
2684
  }
2683
- function ms(e, t, n, o, i) {
2685
+ function gs(e, t, n, o, i) {
2684
2686
  const r = (i.vertLabelsAlign ?? "bottom") === "middle", l = r ? 0 : o.length > 0 ? o[0].coeff : 0, s = r ? 1 : o.length > 0 ? o[o.length - 1].coeff : 0;
2685
2687
  return { e: { x: e.x, y: e.y + n * l }, t: { x: t.x, y: t.y + n * l }, i: { x: e.x, y: e.y + n * s }, n: { x: t.x, y: t.y + n * s } };
2686
2688
  }
2687
- function gs(e, t, n, o, i) {
2688
- const [r, l] = e, { anchors: s, dy: a } = ps(e), c = (n.levels ?? _e).filter((m) => m.visible), f = (o + i) * 2, h = (m) => We({ x: r.x, y: r.y + a * m }, { x: l.x, y: l.y + a * m }, !!n.extendLeft, !!n.extendRight, f), u = Z(n), x = n.backgroundColor ?? n.color, d = ms(r, l, a, c, n), p = Ri(d.e, d.t, d.i, d.n, n, void 0, !0), y = p && p.length ? "cut" : void 0, b = [];
2689
+ function ws(e, t, n, o, i) {
2690
+ const [r, l] = e, { anchors: s, dy: a } = bs(e), c = (n.levels ?? _e).filter((m) => m.visible), f = (o + i) * 2, h = (m) => We({ x: r.x, y: r.y + a * m }, { x: l.x, y: l.y + a * m }, !!n.extendLeft, !!n.extendRight, f), u = Z(n), x = n.backgroundColor ?? n.color, d = gs(r, l, a, c, n), p = Ri(d.e, d.t, d.i, d.n, n, void 0, !0), y = p && p.length ? "cut" : void 0, b = [];
2689
2691
  y && b.push({ t: "clip", name: y, polys: [p] }), c.slice(1).forEach((m, g) => {
2690
2692
  const w = h(c[g].coeff), M = h(m.coeff);
2691
2693
  b.push({ t: "polygon", pts: [w.l, w.r, M.r, M.l], fill: x, fillOpacity: u, stroke: "transparent" });
@@ -2713,16 +2715,16 @@ function Ni(e, t, n, o, i, r, l, s, a, c, f) {
2713
2715
  { t: "line", a: x.l, b: x.r, stroke: s.color, strokeWidth: s.width, dash: d, cap: p }
2714
2716
  ), s.leftEnd === 1 && m.push(...Bt(n, t, s), ...Bt(i, o, s)), s.rightEnd === 1 && m.push(...Bt(t, n, s), ...Bt(o, i, s)), s.showPrices && (m.push(...xo(t, n, b(((g = e.points[0]) == null ? void 0 : g.price) ?? 0), b(((w = e.points[1]) == null ? void 0 : w.price) ?? 0), s)), m.push(...xo(i, o, b(r), b(l), s))), m;
2715
2717
  }
2716
- function ws(e, t, n, o, i, r, l) {
2718
+ function Ms(e, t, n, o, i, r, l) {
2717
2719
  var x, d;
2718
- const [s, a] = t, { anchors: c, P: f, A: h } = bs(t), u = ((x = e.points[2]) == null ? void 0 : x.price) ?? e.points[0].price;
2720
+ const [s, a] = t, { anchors: c, P: f, A: h } = ms(t), u = ((x = e.points[2]) == null ? void 0 : x.price) ?? e.points[0].price;
2719
2721
  return [
2720
2722
  ...Ni(e, s, a, h, f, u, u + ((((d = e.points[1]) == null ? void 0 : d.price) ?? 0) - e.points[0].price), o, i, r, l),
2721
2723
  ...Xe(s, a, h, f, o),
2722
2724
  ...n ? [{ t: "anchors", pts: c, squares: Yt.disjointChannel }] : []
2723
2725
  ];
2724
2726
  }
2725
- function Ms(e, t, n, o, i, r, l) {
2727
+ function vs(e, t, n, o, i, r, l) {
2726
2728
  var x;
2727
2729
  const [s, a, c] = t, f = { x: s.x, y: c.y }, h = { x: a.x, y: c.y }, u = ((x = e.points[2]) == null ? void 0 : x.price) ?? e.points[0].price;
2728
2730
  return [
@@ -2770,7 +2772,7 @@ function Vi(e, t, n, o, i) {
2770
2772
  return { t: "rect", x: n, y: Math.min(s, a), w: Math.max(1, o - n), h: Math.abs(a - s), fill: r.color, fillOpacity: i, stroke: "none", inert: !0 };
2771
2773
  }) : [];
2772
2774
  }
2773
- function Ka(e, t, n, o, i) {
2775
+ function Qa(e, t, n, o, i) {
2774
2776
  const r = e.style;
2775
2777
  let l = null, s = 0, a = 0;
2776
2778
  if (e.kind === "fib-retracement" && t.length >= 2) {
@@ -2802,7 +2804,7 @@ function Ka(e, t, n, o, i) {
2802
2804
  const { index: h, y: u } = f, x = r.horzTextAlign ?? "center", d = x === "left" ? s : x === "right" ? a : (s + a) / 2;
2803
2805
  return { index: h, y: u, left: s, right: a, textX: d };
2804
2806
  }
2805
- function vs(e, t, n, o, i, r) {
2807
+ function ks(e, t, n, o, i, r) {
2806
2808
  if (e.kind !== "fib-retracement") return [];
2807
2809
  const [l, s] = t, a = e.points[0].price, c = e.points[1].price, f = i.extendLeft ? 0 : Math.min(l.x, s.x), h = i.extendRight ? o : Math.max(l.x, s.x), u = Ct(i, Pt), x = !!i.fibLevelsBasedOnLogScale && !!(r != null && r.isLog()) && a > 0 && c > 0, d = (m) => {
2808
2810
  const g = i.reverse ? a : c, w = i.reverse ? c : a;
@@ -2816,7 +2818,7 @@ function vs(e, t, n, o, i, r) {
2816
2818
  ...lt(n, t)
2817
2819
  ];
2818
2820
  }
2819
- function ks(e, t, n, o, i, r) {
2821
+ function Ls(e, t, n, o, i, r) {
2820
2822
  if (e.kind !== "trend-based-fib-extension") return [];
2821
2823
  const [, l, s] = t, a = e.points[0].price, c = e.points[1].price, f = e.points[2].price, h = i.reverse ? a - c : c - a, u = i.reverse ? t[0].y - t[1].y : t[1].y - t[0].y, x = Ct(i, Pt), d = i.extendLeft ? 0 : Math.min(l.x, s.x), p = i.extendRight ? o : Math.max(l.x, s.x), y = !!i.fibLevelsBasedOnLogScale && !!(r != null && r.isLog()) && a > 0 && c > 0 && f > 0, b = (M) => {
2822
2824
  if (!y) return f + h * M;
@@ -2832,7 +2834,7 @@ function ks(e, t, n, o, i, r) {
2832
2834
  ...lt(n, t)
2833
2835
  ];
2834
2836
  }
2835
- function Ls(e, t, n, o, i, r, l) {
2837
+ function Ss(e, t, n, o, i, r, l) {
2836
2838
  if (e.kind !== "fib-channel") return [];
2837
2839
  const [s, a, c] = t, f = c.x - s.x, h = c.y - s.y, u = (r + l) * 2, x = (M) => ({ l: { x: s.x + f * M, y: s.y + h * M }, r: { x: a.x + f * M, y: a.y + h * M } }), d = (M) => {
2838
2840
  const v = x(M);
@@ -2862,7 +2864,7 @@ function Ui(e, t, n, o, i, r, l) {
2862
2864
  ...r ? [U(r, t.color)] : []
2863
2865
  ];
2864
2866
  }
2865
- function Ss(e, t, n, o, i, r) {
2867
+ function Cs(e, t, n, o, i, r) {
2866
2868
  const [l, s, a] = t, c = i.fibTrendLine ?? Sn, f = W({ ...i, lineStyle: c.style, width: c.width }), h = Uo(e, t, r, Ct(i, Ln)), u = Z(i), x = i.vertLabelsAlign ?? "bottom", d = i.horzLabelsAlign ?? "right", p = d === "left" ? "right" : d === "right" ? "left" : "center", y = (m, g) => i.showLabels === !1 ? null : G({ x: m, y: x === "top" ? 0 : x === "middle" ? 0.5 * o : o, text: String(g), fs: 12, vert: x, horz: p, offsetX: 2 }), b = [];
2867
2869
  return c.visible && (b.push({ t: "line", a: l, b: s, stroke: c.color, strokeWidth: c.width, dash: f }), a && b.push({ t: "line", a: s, b: a, stroke: c.color, strokeWidth: c.width, dash: f })), u > 0 && h.slice(1).forEach((m, g) => {
2868
2870
  const w = h[g].x;
@@ -2872,7 +2874,7 @@ function Ss(e, t, n, o, i, r) {
2872
2874
  b.push(...Ui(`l${g}`, m, m.x, o, i, w, w && d === "center" ? w.poly : null));
2873
2875
  }), b.push(...lt(n, t)), b;
2874
2876
  }
2875
- function Cs(e, t, n, o) {
2877
+ function Ts(e, t, n, o) {
2876
2878
  const [i, r] = e, l = o.vertLabelsAlign ?? "bottom", s = o.horzLabelsAlign ?? "right", a = s === "left" ? "right" : s === "right" ? "left" : "center", c = (d, p) => o.showLabels === !1 ? null : G({ x: d, y: l === "top" ? 0 : l === "middle" ? 0.5 * n : n, text: String(p), fs: 12, vert: l, horz: a, offsetX: 2 }), f = r.x - i.x, h = Ct(o, Cn), u = Z(o), x = [{ t: "line", a: i, b: r, stroke: "#808080", strokeWidth: 1, dash: "6 4" }];
2877
2879
  return u > 0 && h.slice(1).forEach((d, p) => {
2878
2880
  const y = i.x + f * h[p].coeff, b = i.x + f * d.coeff;
@@ -2882,13 +2884,13 @@ function Cs(e, t, n, o) {
2882
2884
  x.push(...Ui(`l${p}`, d, y, n, o, b, b && l === "middle" && Me(b.lines) ? b.poly : null));
2883
2885
  }), x.push(...lt(t, e)), x;
2884
2886
  }
2885
- const Ts = [0.236, 0.382, 0.5, 0.618, 1];
2886
- function As(e, t, n, o) {
2887
+ const As = [0.236, 0.382, 0.5, 0.618, 1];
2888
+ function $s(e, t, n, o) {
2887
2889
  const [i, r] = t;
2888
2890
  if (e.fmt !== 2) {
2889
2891
  const d = Math.hypot(r.x - i.x, r.y - i.y), p = W(o);
2890
2892
  return [
2891
- ...Ts.map((y) => ({ t: "circle", cx: i.x, cy: i.y, r: d * y, fill: "none", stroke: o.color, strokeWidth: o.width, dash: p, strokeOpacity: y === 1 ? 1 : 0.55 })),
2893
+ ...As.map((y) => ({ t: "circle", cx: i.x, cy: i.y, r: d * y, fill: "none", stroke: o.color, strokeWidth: o.width, dash: p, strokeOpacity: y === 1 ? 1 : 0.55 })),
2892
2894
  { t: "line", a: i, b: r, stroke: o.color, strokeWidth: 1, strokeOpacity: 0.4, dash: "2 3" },
2893
2895
  ...lt(n, t)
2894
2896
  ];
@@ -2901,7 +2903,7 @@ function As(e, t, n, o) {
2901
2903
  }
2902
2904
  return x.push(...Nt(i, r, o), ...lt(n, t)), x;
2903
2905
  }
2904
- function $s(e, t, n, o, i, r, l) {
2906
+ function Bs(e, t, n, o, i, r, l) {
2905
2907
  const [s, a] = t, c = oi(e, t, l, Pe), f = W(r), h = Z(r), u = c.h.map((k) => ({ color: k.color, far: an(s, { x: a.x, y: k.y }, o, i) })), x = c.v.map((k) => ({ color: k.color, far: an(s, { x: k.x, y: a.y }, o, i) })), d = (k) => k.slice(1).map((S, C) => ({ color: S.color, pts: [s, S.far, k[C].far] })), { left: p, top: y, right: b, bottom: m } = c.box, g = r.fanGrid ?? Ro, w = W({ ...r, lineStyle: g.style, width: g.width }), M = (k, S, C, I, A, F, O) => G({ x: k, y: S, text: It(C), fs: 12, vert: I, horz: A, offsetX: F, offsetY: O }), v = [];
2906
2908
  if (h > 0)
2907
2909
  for (const k of [...d(u), ...d(x)]) v.push({ t: "polygon", pts: k.pts, fill: k.color, fillOpacity: h, stroke: "none", inert: !0 });
@@ -2913,7 +2915,7 @@ function $s(e, t, n, o, i, r, l) {
2913
2915
  v.push({ t: "hit", a: s, b: k.far, width: L * 2 }), v.push({ t: "line", a: s, b: k.far, stroke: k.color, strokeWidth: r.width, dash: f, cap: "round" });
2914
2916
  return v.push(...lt(n, t)), v;
2915
2917
  }
2916
- function Bs(e, t, n) {
2918
+ function Is(e, t, n) {
2917
2919
  const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y), l = i.y >= o.y ? 1 : -1, s = W(n), a = Ct(n, An), c = Z(n), f = !!n.fullCircles, h = (x) => f ? `M ${o.x - x} ${o.y} A ${x} ${x} 0 1 0 ${o.x + x} ${o.y} A ${x} ${x} 0 1 0 ${o.x - x} ${o.y}` : `M ${o.x - x} ${o.y} A ${x} ${x} 0 0 ${l > 0 ? 0 : 1} ${o.x + x} ${o.y}`, u = [];
2918
2920
  if (r >= 1e-6) {
2919
2921
  c > 0 && a.slice(1).forEach((x, d) => {
@@ -2931,7 +2933,7 @@ function Bs(e, t, n) {
2931
2933
  }
2932
2934
  return u.push(...lt(t, e)), u;
2933
2935
  }
2934
- function Is(e, t, n, o, i) {
2936
+ function Ps(e, t, n, o, i) {
2935
2937
  const [r, l] = e, s = Bi(r, l, !!i.counterclockwise), a = W(i), c = l.x - r.x, f = l.y - r.y, h = Math.hypot(c, f) || 1, u = (n + o) * 2, x = { x: l.x + c / h * u, y: l.y + f / h * u };
2936
2938
  return [
2937
2939
  ...s.length >= 2 ? [
@@ -2941,7 +2943,7 @@ function Is(e, t, n, o, i) {
2941
2943
  ...lt(t, e)
2942
2944
  ];
2943
2945
  }
2944
- function Ps(e, t, n) {
2946
+ function Es(e, t, n) {
2945
2947
  const [o, i, r] = e, l = Math.hypot(i.x - o.x, i.y - o.y);
2946
2948
  if (l < 1e-6) return lt(t, e);
2947
2949
  const s = Math.atan2(i.y - o.y, i.x - o.x), a = Math.atan2(r.y - o.y, r.x - o.x), c = { x: o.x + Math.cos(a) * l, y: o.y + Math.sin(a) * l };
@@ -2969,7 +2971,7 @@ function Ps(e, t, n) {
2969
2971
  }
2970
2972
  return y.push(...lt(t, e)), y;
2971
2973
  }
2972
- function Es(e, t, n, o) {
2974
+ function zs(e, t, n, o) {
2973
2975
  const [i, r, l] = e, s = { x: (r.x + l.x) / 2, y: (r.y + l.y) / 2 }, a = { x: (l.x - r.x) / 2, y: (l.y - r.y) / 2 }, c = W(o), f = Ct(o, kt), h = Z(o), u = n * 4, x = (y) => {
2974
2976
  const b = y.x - i.x, m = y.y - i.y, g = Math.hypot(b, m) || 1;
2975
2977
  return { x: i.x + b / g * u, y: i.y + m / g * u };
@@ -2985,7 +2987,7 @@ function Es(e, t, n, o) {
2985
2987
  return p.push(...lt(t, e)), p;
2986
2988
  }
2987
2989
  const me = (e, t) => e ? [{ t: "anchors", pts: t }] : [];
2988
- function zs(e, t, n, o, i) {
2990
+ function Ws(e, t, n, o, i) {
2989
2991
  var m;
2990
2992
  const r = Ho(e, t);
2991
2993
  if (!r) return me(n, t);
@@ -3014,7 +3016,7 @@ function zs(e, t, n, o, i) {
3014
3016
  for (const g of u) y.push(U(g, x, o.bold, o.italic));
3015
3017
  return y.push(...me(n, t)), y;
3016
3018
  }
3017
- function Ws(e, t, n, o, i) {
3019
+ function Rs(e, t, n, o, i) {
3018
3020
  const [r, l] = e, s = (n + o) * 2, a = l.x - r.x, c = l.y - r.y, f = (i.levels ?? vn).map((b, m) => ({ ...b, index: m + 1 })).filter((b) => b.visible), h = Z(i), u = (b) => b > 1 ? { x: l.x, y: r.y + c / b } : { x: r.x + a * b, y: l.y }, x = (b) => {
3019
3021
  const m = Yo(r, l, b), g = Math.hypot(m.x, m.y) || 1;
3020
3022
  return { x: r.x + m.x / g * s, y: r.y + m.y / g * s };
@@ -3031,7 +3033,7 @@ function Ws(e, t, n, o, i) {
3031
3033
  }
3032
3034
  return y.push(...me(t, e)), y;
3033
3035
  }
3034
- function Rs(e, t, n, o, i) {
3036
+ function Fs(e, t, n, o, i) {
3035
3037
  const [r, l] = t, s = Math.min(r.x, l.x), a = Math.max(r.x, l.x), c = Math.min(r.y, l.y), f = Math.max(r.y, l.y), h = mt(r, l), u = o.levels ?? Ee, x = o.vLevels ?? Ee, d = W(o), [p, y] = e.points, b = !!o.reverse, m = (T) => {
3036
3038
  const E = b ? y.price : p.price, P = b ? p.price - y.price : y.price - p.price;
3037
3039
  return (i == null ? void 0 : i.priceToY(E + T * P)) ?? (b ? l.y + T * (r.y - l.y) : r.y + T * (l.y - r.y));
@@ -3060,7 +3062,7 @@ function Rs(e, t, n, o, i) {
3060
3062
  for (const [T, E] of A) O.push({ t: "line", a: T, b: E, stroke: I.color, strokeWidth: o.width, dash: d, inert: !0 });
3061
3063
  return O.push(...me(n, h)), O;
3062
3064
  }
3063
- function Fs(e, t, n, o, i) {
3065
+ function Os(e, t, n, o, i) {
3064
3066
  const r = Vo(e, t);
3065
3067
  if (!r) return [];
3066
3068
  const l = Zt(r.pivot, r.dir, o), s = Math.hypot(r.dir.x, r.dir.y) || 1, a = (b) => i.extendLines ? { x: b.x - r.dir.x / s * o * 4, y: b.y - r.dir.y / s * o * 4 } : b, c = W(i), f = Ct(i, kt), h = Z(i), u = (b, m) => ({ x: r.mid.x + r.half.x * b * m, y: r.mid.y + r.half.y * b * m }), x = [];
@@ -3082,10 +3084,10 @@ function Fs(e, t, n, o, i) {
3082
3084
  y.push({ t: "line", a: a(u(m.coeff, b)), b: Zt(u(m.coeff, b), r.dir, o), stroke: m.color, strokeWidth: wt(m, i), dash: Mt(m, i), cap: "round" });
3083
3085
  return y.push(...me(n, t)), y;
3084
3086
  }
3085
- const Os = 0.06;
3087
+ const Ds = 0.06;
3086
3088
  function je(e, t) {
3087
3089
  const n = ge(e);
3088
- return t && n.fillOpacity > 0 ? { fill: n.fill, fillOpacity: Math.min(1, n.fillOpacity + Os) } : n;
3090
+ return t && n.fillOpacity > 0 ? { fill: n.fill, fillOpacity: Math.min(1, n.fillOpacity + Ds) } : n;
3089
3091
  }
3090
3092
  function Xi(e, t, n, o) {
3091
3093
  return e.text ? [{
@@ -3102,13 +3104,13 @@ function Xi(e, t, n, o) {
3102
3104
  inert: !0
3103
3105
  }] : [];
3104
3106
  }
3105
- function Ds(e, t) {
3107
+ function _s(e, t) {
3106
3108
  if (e.length < 2) return [];
3107
3109
  const n = [];
3108
3110
  return t.leftEnd === 1 && n.push(...Bt(e[1], e[0], t)), t.rightEnd === 1 && n.push(...Bt(e[e.length - 2], e[e.length - 1], t)), n;
3109
3111
  }
3110
3112
  const yn = (e) => e.map((t, n) => `${n === 0 ? "M" : "L"} ${t.x} ${t.y}`).join(" "), at = (e, t, n) => e ? [n ? { t: "anchors", pts: t, squares: n } : { t: "anchors", pts: t }] : [];
3111
- function _s(e, t, n, o, i, r) {
3113
+ function Hs(e, t, n, o, i, r) {
3112
3114
  const [l, s] = t, a = i.extendLeft ? -i.width : Math.min(l.x, s.x), c = i.extendRight ? o + i.width : Math.max(l.x, s.x), f = Math.min(l.y, s.y), h = Math.max(l.y, s.y), u = je(i, r), x = Go(e, t, o), d = i.rectMiddleLine, p = [{
3113
3115
  t: "rect",
3114
3116
  x: a,
@@ -3139,14 +3141,14 @@ function _s(e, t, n, o, i, r) {
3139
3141
  }
3140
3142
  return x && p.push(U(x, i.textColor ?? i.color, i.bold, i.italic)), p.push(...at(n, [...mt(l, s), ...$i(l, s)], Yt.rectangle)), p;
3141
3143
  }
3142
- function Hs(e, t, n, o) {
3144
+ function Ns(e, t, n, o) {
3143
3145
  const i = e.fmt === 2, r = Do(t, i), l = ge(o), s = i ? [t[0], t[1], ...r] : t;
3144
3146
  return [
3145
3147
  { t: "polygon", pts: r, fill: l.fill, fillOpacity: l.fillOpacity, stroke: o.color, strokeWidth: o.width, dash: W(o), join: "round" },
3146
3148
  ...at(n, s)
3147
3149
  ];
3148
3150
  }
3149
- function Ns(e, t, n, o, i) {
3151
+ function Ys(e, t, n, o, i) {
3150
3152
  const [r, l] = t, s = Math.hypot(l.x - r.x, l.y - r.y), a = je(o, i);
3151
3153
  return [
3152
3154
  { t: "circle", cx: r.x, cy: r.y, r: Math.max(0, s), fill: a.fill, fillOpacity: a.fillOpacity, stroke: o.color, strokeWidth: o.width, dash: W(o) },
@@ -3154,7 +3156,7 @@ function Ns(e, t, n, o, i) {
3154
3156
  ...at(n, t)
3155
3157
  ];
3156
3158
  }
3157
- function Ys(e, t, n, o, i) {
3159
+ function Vs(e, t, n, o, i) {
3158
3160
  const [r, l, s] = t, a = (r.x + l.x) / 2, c = (r.y + l.y) / 2, f = Math.max(1, Math.hypot(l.x - r.x, l.y - r.y) / 2), h = Math.atan2(l.y - r.y, l.x - r.x), u = -Math.sin(h), x = Math.cos(h), d = Math.max(1, Math.abs((s.x - a) * u + (s.y - c) * x)), p = h * 180 / Math.PI, y = je(o, i);
3159
3161
  return [
3160
3162
  {
@@ -3169,14 +3171,14 @@ function Ys(e, t, n, o, i) {
3169
3171
  ...at(n, t)
3170
3172
  ];
3171
3173
  }
3172
- function Vs(e, t, n, o) {
3174
+ function Us(e, t, n, o) {
3173
3175
  const i = je(n, o);
3174
3176
  return [
3175
3177
  { t: "polygon", pts: e, fill: i.fill, fillOpacity: i.fillOpacity, stroke: n.color, strokeWidth: n.width, dash: W(n), join: "round" },
3176
3178
  ...at(t, e)
3177
3179
  ];
3178
3180
  }
3179
- function Us(e, t, n) {
3181
+ function Xs(e, t, n) {
3180
3182
  const [o, i] = e, r = W(n), l = e.length === 3 ? Pi(o, i, e[2]) : null;
3181
3183
  if (!l)
3182
3184
  return [{ t: "line", a: o, b: i, stroke: n.color, strokeWidth: n.width, dash: r, cap: "round" }, ...at(t, e)];
@@ -3194,17 +3196,17 @@ function Gi(e, t, n, o, i, r) {
3194
3196
  const s = ge(n);
3195
3197
  l.push({ t: "path", d: yn(i) + " Z", fill: s.fill, fillOpacity: s.fillOpacity, stroke: "none" });
3196
3198
  }
3197
- if (l.push({ t: "path", d: yn(o), fill: "none", stroke: n.color, strokeWidth: n.width, dash: W(n), cap: "round" }), l.push(...Ds(i, n)), t) {
3199
+ if (l.push({ t: "path", d: yn(o), fill: "none", stroke: n.color, strokeWidth: n.width, dash: W(n), cap: "round" }), l.push(..._s(i, n)), t) {
3198
3200
  for (const [s, a] of r) l.push({ t: "line", a: s, b: a, stroke: n.color, strokeOpacity: 0.3, dash: "3 3" });
3199
3201
  l.push({ t: "anchors", pts: e });
3200
3202
  }
3201
3203
  return l;
3202
3204
  }
3203
- function Xs(e, t, n) {
3205
+ function Gs(e, t, n) {
3204
3206
  const o = e.length >= 3 ? e : [e[0], { x: (e[0].x + e[1].x) / 2, y: (e[0].y + e[1].y) / 2 }, e[1]], [i, r, l] = o, s = xn(o, !!n.extendLeft, !!n.extendRight), a = n.extendLeft || n.extendRight ? xn(o) : s;
3205
3207
  return Gi(e, t, n, s, a, [[i, r], [l, r]]);
3206
3208
  }
3207
- function Gs(e, t, n) {
3209
+ function js(e, t, n) {
3208
3210
  const o = e.length >= 4 ? e : [
3209
3211
  e[0],
3210
3212
  { x: e[0].x + (e[1].x - e[0].x) / 3, y: e[0].y + (e[1].y - e[0].y) / 3 },
@@ -3213,7 +3215,7 @@ function Gs(e, t, n) {
3213
3215
  ], [i, r, l, s] = o, a = dn(o, !!n.extendLeft, !!n.extendRight), c = n.extendLeft || n.extendRight ? dn(o) : a;
3214
3216
  return Gi(e, t, n, a, c, [[i, r], [s, l]]);
3215
3217
  }
3216
- function js(e, t, n) {
3218
+ function qs(e, t, n) {
3217
3219
  const [o, i, r] = e, l = Math.hypot(i.x - o.x, i.y - o.y);
3218
3220
  if (!r || l < 1e-6)
3219
3221
  return [{ t: "line", a: o, b: i, stroke: n.color, strokeWidth: n.width }, ...at(t, e)];
@@ -3247,18 +3249,18 @@ function js(e, t, n) {
3247
3249
  ...at(t, e)
3248
3250
  ];
3249
3251
  }
3250
- function qs(e, t, n, o, i) {
3252
+ function Zs(e, t, n, o, i) {
3251
3253
  const [r, l] = e, s = l.x - r.x, a = W(i), c = [{ t: "line", a: r, b: l, stroke: "#808080", strokeWidth: 1, dash: "6 4" }];
3252
3254
  if (Math.abs(s) >= 2)
3253
3255
  for (let f = r.x; s > 0 ? f <= n + 2 : f >= -2; f += s)
3254
3256
  c.push({ t: "line", a: { x: f, y: 0 }, b: { x: f, y: o }, stroke: i.color, strokeWidth: i.width, dash: a });
3255
3257
  return c.push(...at(t, e)), c;
3256
3258
  }
3257
- function Zs(e, t, n, o) {
3259
+ function Ks(e, t, n, o) {
3258
3260
  const i = Ii(e[0], e[1], n), r = [];
3259
3261
  return i.length >= 2 && r.push({ t: "polyline", pts: i, fill: "none", stroke: o.color, strokeWidth: o.width, dash: W(o) }), r.push(...at(t, e)), r;
3260
3262
  }
3261
- function Ks(e, t, n, o) {
3263
+ function Qs(e, t, n, o) {
3262
3264
  const [i, r] = e, l = Math.abs(r.x - i.x), s = l / 2, a = W(o), c = ge(o), f = i.y, h = [];
3263
3265
  if (l >= 2) {
3264
3266
  const u = Math.min(i.x, r.x), x = Math.floor(-u / l) - 1, d = Math.ceil((n - u) / l) + 1;
@@ -3283,27 +3285,27 @@ const Vn = {
3283
3285
  "elliott-triangle": ["0", "A", "B", "C", "D", "E"],
3284
3286
  "elliott-double-combo": ["0", "W", "X", "Y"],
3285
3287
  "elliott-triple-combo": ["0", "W", "X", "Y", "X", "Z"]
3286
- }, Qs = /* @__PURE__ */ new Set([
3288
+ }, Js = /* @__PURE__ */ new Set([
3287
3289
  "polyline"
3288
- ]), Js = [
3290
+ ]), tc = [
3289
3291
  { font: 11, circle: 14, bold: !0 },
3290
3292
  { font: 16, circle: 22, bold: !1 },
3291
3293
  { font: 18, circle: 22, bold: !1 },
3292
3294
  { font: 20, circle: 28, bold: !1 },
3293
3295
  { font: 24, circle: 36, bold: !0 }
3294
- ], tc = {
3296
+ ], ec = {
3295
3297
  "elliott-impulse": ["0", "1", "2", "3", "4", "5"],
3296
3298
  "elliott-correction": ["0", "A", "B", "C"],
3297
3299
  "elliott-triangle": ["0", "A", "B", "C", "D", "E"],
3298
3300
  "elliott-double-combo": ["0", "W", "X", "Y"],
3299
3301
  "elliott-triple-combo": ["0", "W", "X", "Y", "X", "Z"]
3300
3302
  }, yo = ["0", "i", "ii", "iii", "iv", "v"];
3301
- function ec(e, t) {
3302
- const n = tc[e] ?? [];
3303
+ function nc(e, t) {
3304
+ const n = ec[e] ?? [];
3303
3305
  return e === "elliott-impulse" ? t === 1 ? yo : t === 3 ? yo.map((o) => o.toUpperCase()) : n : t % 2 === 1 ? n.map((o) => o.toLowerCase()) : n;
3304
3306
  }
3305
- function nc(e, t, n, o) {
3306
- const r = 14 - Math.max(0, Math.min(14, Math.round(o.elliottDegree ?? gr))), l = Math.floor(r / 3), s = ["", "brackets", "circle"][r % 3], a = Js[l], c = ec(e.kind, l), f = 10 + a.circle / 2, h = t.length > 2 ? Math.sign(t[2].y - t[1].y) : 1, u = (d) => d % 2 === 0 ? h : -h, x = [{ t: "polyline", pts: t, fill: "none", stroke: "transparent", strokeWidth: Math.max(L * 2, o.width) }];
3307
+ function oc(e, t, n, o) {
3308
+ const r = 14 - Math.max(0, Math.min(14, Math.round(o.elliottDegree ?? gr))), l = Math.floor(r / 3), s = ["", "brackets", "circle"][r % 3], a = tc[l], c = nc(e.kind, l), f = 10 + a.circle / 2, h = t.length > 2 ? Math.sign(t[2].y - t[1].y) : 1, u = (d) => d % 2 === 0 ? h : -h, x = [{ t: "polyline", pts: t, fill: "none", stroke: "transparent", strokeWidth: Math.max(L * 2, o.width) }];
3307
3309
  return o.showWave !== !1 && x.push({ t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: W(o), join: "round", cap: "round" }), t.forEach((d, p) => {
3308
3310
  if (p === 0 && !n) return;
3309
3311
  const y = d.y + (u(p) === 1 ? f : -f), b = c[p] ?? String(p);
@@ -3373,14 +3375,14 @@ function qi(e, t, n) {
3373
3375
  }), i;
3374
3376
  }
3375
3377
  const ve = (e) => ({ t: "polyline", pts: e, fill: "none", stroke: "transparent", strokeWidth: L * 2 });
3376
- function oc(e, t, n, o) {
3378
+ function ic(e, t, n, o) {
3377
3379
  const i = re(o), r = e.points.map((s) => s.price), l = [
3378
3380
  ve(t),
3379
3381
  { t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: W(o), join: "round" }
3380
3382
  ];
3381
3383
  return t.length >= 3 && l.push(...oe(t, 0, 2, o.width, pt(r[0], r[1], r[2], 3), i)), t.length >= 4 && l.push(...oe(t, 1, 3, o.width, pt(r[1], r[2], r[3], 3), i)), l.push(...qi(t, Vn[e.kind], o)), n && l.push({ t: "anchors", pts: t }), l;
3382
3384
  }
3383
- function ic(e, t, n, o) {
3385
+ function rc(e, t, n, o) {
3384
3386
  const i = e.kind === "cypher-pattern", r = re(o), l = o.backgroundColor ?? o.color, s = o.fillBackground === !1 ? 0 : Z(o), a = e.points.map((f) => f.price), c = [];
3385
3387
  if (s > 0 && t.length >= 3 && c.push({ t: "polygon", pts: [t[0], t[1], t[2]], fill: l, fillOpacity: s, stroke: "none" }), s > 0 && t.length >= 5 && c.push({ t: "polygon", pts: [t[2], t[3], t[4]], fill: l, fillOpacity: s, stroke: "none" }), c.push(ve(t), { t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: W(o), join: "round" }), t.length >= 3 && c.push(...oe(t, 0, 2, 1, pt(a[0], a[1], a[2], 3), r)), t.length >= 4 && c.push(...oe(t, 1, 3, 1, i ? pt(a[1], a[0], a[3], 3) : pt(a[1], a[2], a[3], 3), r)), t.length >= 5) {
3386
3388
  const f = i ? pt(a[0], a[2], a[4], 3) : pt(a[0], a[1], a[4], 3);
@@ -3393,7 +3395,7 @@ function ic(e, t, n, o) {
3393
3395
  }
3394
3396
  return c.push(...qi(t, Vn[e.kind], o)), n && c.push({ t: "anchors", pts: t }), c;
3395
3397
  }
3396
- function rc(e, t, n, o) {
3398
+ function lc(e, t, n, o) {
3397
3399
  const i = re(o), r = e.points.map((s) => s.price), l = [
3398
3400
  ve(t),
3399
3401
  { t: "polyline", pts: t, fill: "none", stroke: o.color, strokeWidth: o.width, dash: W(o), join: "round" }
@@ -3422,7 +3424,7 @@ function _t(e, t, n, o) {
3422
3424
  ]
3423
3425
  };
3424
3426
  }
3425
- function lc(e, t, n) {
3427
+ function sc(e, t, n) {
3426
3428
  const [o, i, r, l] = e, s = re(n);
3427
3429
  let a = null;
3428
3430
  if (Math.abs(r.x - o.x) >= 1 && Math.abs(l.x - i.x) >= 1) {
@@ -3457,7 +3459,7 @@ function po(e, t, n, o) {
3457
3459
  const s = ((n.x - e.x) * i.y - (n.y - e.y) * i.x) / l;
3458
3460
  return s < 0 || s > 1 ? null : { x: n.x + r.x * s, y: n.y + r.y * s };
3459
3461
  }
3460
- function sc(e, t, n) {
3462
+ function cc(e, t, n) {
3461
3463
  const o = Z({ ...n, transparency: n.transparency ?? 85 }), i = n.backgroundColor ?? n.color, [r, l, s, a, c, f, h] = e, u = po(s, c, r, l), x = po(s, c, f, h), d = (m, g) => ({ x: m.x + (g.x - m.x) * 10, y: m.y + (g.y - m.y) * 10 }), p = re(n), y = (m, g, w) => ({ t: "polygon", pts: [m, g, w], fill: i, fillOpacity: o, stroke: "none", inert: !0 }), b = [ve(e)];
3462
3464
  return n.fillBackground !== !1 && (b.push(y(s, a, c)), u && b.push(y(u, l, s)), x && b.push(y(c, f, x))), b.push(
3463
3465
  { t: "line", a: u ?? d(c, s), b: x ?? d(s, c), stroke: n.color, strokeWidth: n.width, dash: W({ ...n, lineStyle: "dotted" }), inert: !0 },
@@ -3467,7 +3469,7 @@ function sc(e, t, n) {
3467
3469
  _t(f, f.y < c.y, "Right Shoulder", p)
3468
3470
  ), t && b.push({ t: "anchors", pts: e }), b;
3469
3471
  }
3470
- function cc(e, t = 5) {
3472
+ function ac(e, t = 5) {
3471
3473
  if (e.length < 2) return e;
3472
3474
  const n = Math.max(1, t), o = [e[0]];
3473
3475
  for (let r = 1; r < e.length; r++) {
@@ -3486,14 +3488,14 @@ function cc(e, t = 5) {
3486
3488
  }
3487
3489
  return i.push(o[o.length - 1]), i;
3488
3490
  }
3489
- function ac(e, t, n, o) {
3490
- if (e.kind === "triangle-pattern" && t.length >= 4) return lc(t, n, o);
3491
- if (e.kind === "head-and-shoulders" && t.length >= 7) return sc(t, n, o);
3492
- if (e.kind === "abcd-pattern" && t.length >= 2) return oc(e, t, n, o);
3493
- if ((e.kind === "xabcd-pattern" || e.kind === "cypher-pattern") && t.length >= 2) return ic(e, t, n, o);
3494
- if (e.kind === "three-drives-pattern" && t.length >= 2) return rc(e, t, n, o);
3495
- if (e.kind.startsWith("elliott-")) return nc(e, t, n, o);
3496
- const i = Vn[e.kind], r = Qs.has(e.kind) && e.closed === !0, l = e.kind === "highlighter", s = e.kind === "brush" || l, a = o.width, c = s ? cc(t) : t, f = s ? void 0 : W(o), h = s && t.length > 1 ? [t[0], t[t.length - 1]] : t, u = [];
3491
+ function fc(e, t, n, o) {
3492
+ if (e.kind === "triangle-pattern" && t.length >= 4) return sc(t, n, o);
3493
+ if (e.kind === "head-and-shoulders" && t.length >= 7) return cc(t, n, o);
3494
+ if (e.kind === "abcd-pattern" && t.length >= 2) return ic(e, t, n, o);
3495
+ if ((e.kind === "xabcd-pattern" || e.kind === "cypher-pattern") && t.length >= 2) return rc(e, t, n, o);
3496
+ if (e.kind === "three-drives-pattern" && t.length >= 2) return lc(e, t, n, o);
3497
+ if (e.kind.startsWith("elliott-")) return oc(e, t, n, o);
3498
+ const i = Vn[e.kind], r = Js.has(e.kind) && e.closed === !0, l = e.kind === "highlighter", s = e.kind === "brush" || l, a = o.width, c = s ? ac(t) : t, f = s ? void 0 : W(o), h = s && t.length > 1 ? [t[0], t[t.length - 1]] : t, u = [];
3497
3499
  if (r) {
3498
3500
  const x = o.backgroundColor ?? o.color, d = o.fillBackground !== void 0 ? Z(o) : 0.08;
3499
3501
  u.push(
@@ -3515,10 +3517,10 @@ function ac(e, t, n, o) {
3515
3517
  u.push({ t: "text", x: x.x, y: x.y + ji(t, d), text: i[d] ?? String(d + 1), size: 11, fill: o.color, anchor: "middle" });
3516
3518
  }), n && u.push({ t: "anchors", pts: h }), u;
3517
3519
  }
3518
- function fc(e) {
3520
+ function hc(e) {
3519
3521
  return e < 92 ? 18 : Math.min(Math.max(e * 0.25, 18), 106, e * 0.9);
3520
3522
  }
3521
- function hc(e, t, n) {
3523
+ function uc(e, t, n) {
3522
3524
  const [o, i] = e, r = Math.hypot(i.x - o.x, i.y - o.y), l = n.fontSize ?? 16, s = (A, F, O) => n.text ? [{
3523
3525
  t: "text",
3524
3526
  x: A,
@@ -3540,7 +3542,7 @@ function hc(e, t, n) {
3540
3542
  const A = { x: (i.x - o.x) / r, y: (i.y - o.y) / r };
3541
3543
  a = { x: i.x - A.x * 22, y: i.y - A.y * 22 };
3542
3544
  }
3543
- const c = i.x - a.x, f = i.y - a.y, h = Math.hypot(c, f), u = c / h, x = f / h, d = -x, p = u, y = fc(h), b = h >= 35 ? 0.1 : 0, m = [
3545
+ const c = i.x - a.x, f = i.y - a.y, h = Math.hypot(c, f), u = c / h, x = f / h, d = -x, p = u, y = hc(h), b = h >= 35 ? 0.1 : 0, m = [
3544
3546
  { x: 0, y: 0 },
3545
3547
  { x: h - y + y * b, y: 1.22 * y / 4 },
3546
3548
  { x: h - y, y: 1.22 * y / 2 },
@@ -3558,12 +3560,12 @@ function hc(e, t, n) {
3558
3560
  ];
3559
3561
  return t && I.push({ t: "anchors", pts: e }), I;
3560
3562
  }
3561
- function uc(e, t) {
3563
+ function xc(e, t) {
3562
3564
  const n = t === "up" ? 1 : -1, o = n * 12, i = n * 10, r = 19.5 / 2, l = 5;
3563
3565
  return `M ${e.x} ${e.y} L ${e.x + r} ${e.y + o} L ${e.x + l} ${e.y + o} L ${e.x + l} ${e.y + o + i} L ${e.x - l} ${e.y + o + i} L ${e.x - l} ${e.y + o} L ${e.x - r} ${e.y + o} Z`;
3564
3566
  }
3565
3567
  function bo(e, t, n, o, i) {
3566
- const r = t[0], l = ri(e, r), s = o.fontSize ?? 14, a = [{ t: "path", d: uc(r, i), fill: o.color }];
3568
+ const r = t[0], l = ri(e, r), s = o.fontSize ?? 14, a = [{ t: "path", d: xc(r, i), fill: o.color }];
3567
3569
  return l && (a.push({ t: "rect", x: l.left, y: l.top, w: l.width, h: l.height, fill: "transparent" }), l.lines.forEach((c, f) => {
3568
3570
  a.push({
3569
3571
  t: "text",
@@ -3581,12 +3583,12 @@ function bo(e, t, n, o, i) {
3581
3583
  });
3582
3584
  })), n && a.push({ t: "anchors", pts: [r] }), a;
3583
3585
  }
3584
- const mo = 22, Ae = 17, Ke = 12, xc = 5;
3585
- function dc(e, t, n) {
3586
+ const mo = 22, Ae = 17, Ke = 12, dc = 5;
3587
+ function yc(e, t, n) {
3586
3588
  const o = e[0], i = o.y - mo, r = o.x, l = [
3587
3589
  { x: r, y: i },
3588
3590
  { x: r + Ae, y: i },
3589
- { x: r + Ae - xc, y: i + Ke / 2 },
3591
+ { x: r + Ae - dc, y: i + Ke / 2 },
3590
3592
  { x: r + Ae, y: i + Ke },
3591
3593
  { x: r, y: i + Ke }
3592
3594
  ], s = [
@@ -3597,24 +3599,24 @@ function dc(e, t, n) {
3597
3599
  ];
3598
3600
  return t && s.push({ t: "anchors", pts: [o] }), s;
3599
3601
  }
3600
- function yc(e, t, n, o, i) {
3602
+ function pc(e, t, n, o, i) {
3601
3603
  const r = t[0], l = (i == null ? void 0 : i.pipSize()) ?? 0.01, s = Math.max(0, Math.min(8, Math.round(-Math.log10(l)))), a = e.points[0].price.toFixed(s), c = o.fontSize ?? 14, f = ki(a, r, c), h = 100 - (o.transparency ?? 0), u = o.borderColor ?? o.color, x = [
3602
- { t: "path", d: al(f), fill: Lt(ct(o.backgroundColor ?? o.color).hex, h), stroke: u, strokeWidth: 2, join: "round" },
3604
+ { t: "path", d: fl(f), fill: Lt(ct(o.backgroundColor ?? o.color).hex, h), stroke: u, strokeWidth: 2, join: "round" },
3603
3605
  { t: "text", x: f.x + 10, y: f.y + f.h / 2 + Math.floor(0.35 * c), text: a, size: c, weight: "bold", fill: o.textColor ?? "#ffffff", pre: !0 },
3604
3606
  { t: "circle", cx: r.x, cy: r.y, r: 2.5, fill: Lt(ct(u).hex, h), stroke: "#0f0f0f", strokeWidth: 1 }
3605
3607
  ];
3606
3608
  return n && x.push({ t: "anchors", pts: [r] }), x;
3607
3609
  }
3608
- const pc = 28;
3609
- function bc(e, t, n) {
3610
- const [o] = t, i = e.style.fontSize ?? pc, r = i / 2, l = [];
3610
+ const bc = 28;
3611
+ function mc(e, t, n) {
3612
+ const [o] = t, i = e.style.fontSize ?? bc, r = i / 2, l = [];
3611
3613
  return n && l.push({ t: "rect", x: o.x - r - 2, y: o.y - r - 2, w: i + 4, h: i + 4, fill: "none", stroke: "#2962ff", strokeWidth: 1, dash: "3 3", rx: 3 }), l.push({ t: "glyph", x: o.x - r, y: o.y - r, size: i, glyph: e.glyph ?? "", color: e.style.color }), [{ t: "group", items: l }];
3612
3614
  }
3613
- const mc = "#089981", gc = "#f23645";
3614
- function wc(e, t) {
3615
+ const gc = "#089981", wc = "#f23645";
3616
+ function Mc(e, t) {
3615
3617
  const n = [];
3616
3618
  for (const o of e) {
3617
- const i = o.up ? mc : gc, r = Math.min(o.openY, o.closeY), l = Math.max(1, Math.abs(o.closeY - o.openY));
3619
+ const i = o.up ? gc : wc, r = Math.min(o.openY, o.closeY), l = Math.max(1, Math.abs(o.closeY - o.openY));
3618
3620
  n.push(
3619
3621
  { t: "line", a: { x: o.x, y: o.highY }, b: { x: o.x, y: o.lowY }, stroke: i, strokeWidth: 1 },
3620
3622
  { t: "rect", x: o.x - t / 2, y: r, w: t, h: l, fill: i }
@@ -3622,7 +3624,7 @@ function wc(e, t) {
3622
3624
  }
3623
3625
  return n;
3624
3626
  }
3625
- function Mc(e, t, n, o, i) {
3627
+ function vc(e, t, n, o, i) {
3626
3628
  if (e.kind !== "bar-pattern") return [];
3627
3629
  const [r, l] = t, s = ii(e, t, i), a = n ? [{ t: "anchors", pts: t }] : [];
3628
3630
  if (!s) {
@@ -3668,7 +3670,7 @@ function go(e) {
3668
3670
  };
3669
3671
  }
3670
3672
  const wo = 14;
3671
- function vc(e, t, n, o, i) {
3673
+ function kc(e, t, n, o, i) {
3672
3674
  if (e.kind !== "ghost-feed") return [];
3673
3675
  if (e.ghost && i && e.points.length >= 2) {
3674
3676
  const v = e.ghost.amplitude, k = Math.max(0, Math.min(1, (o.variance ?? 50) / 100)), S = [];
@@ -3728,15 +3730,15 @@ function vc(e, t, n, o, i) {
3728
3730
  { t: "rect", x: s, y: c, w: h, h: u, fill: o.color, fillOpacity: 0.04, stroke: o.color, strokeWidth: o.width, dash: "4 3" },
3729
3731
  // dotted guide line through the walk's midline (matches the icon)
3730
3732
  { t: "line", a: { x: s, y: c + u / 2 }, b: { x: a, y: c + u / 2 }, stroke: o.color, strokeWidth: 1, strokeOpacity: 0.4, dash: "2 3", inert: !0 },
3731
- { t: "group", inert: !0, items: wc(w, y) }
3733
+ { t: "group", inert: !0, items: Mc(w, y) }
3732
3734
  ];
3733
3735
  if (n)
3734
3736
  for (const v of mt(r, l))
3735
3737
  M.push({ t: "circle", cx: v.x, cy: v.y, r: et, fill: "#fff", stroke: o.color, strokeWidth: 1.5, cursor: "nwse-resize" });
3736
3738
  return M;
3737
3739
  }
3738
- const kc = "#2e2e2e", Lc = { dx: 0, dy: 1, blur: 4, color: "rgba(0,0,0,0.4)" };
3739
- function Sc(e, t, n, o) {
3740
+ const Lc = "#2e2e2e", Sc = { dx: 0, dy: 1, blur: 4, color: "rgba(0,0,0,0.4)" };
3741
+ function Cc(e, t, n, o) {
3740
3742
  const i = n / 2, r = 10 + i, l = Math.min(e.y, t.y), s = Math.max(e.y, t.y);
3741
3743
  let a;
3742
3744
  if (e.y > t.y) {
@@ -3777,15 +3779,15 @@ function Un(e, t, n, o, i) {
3777
3779
  let m = 0, g = !1;
3778
3780
  for (const w of b)
3779
3781
  w.volume != null && (m += w.volume, g = !0);
3780
- g && l.push(`Vol ${is(m)}`);
3782
+ g && l.push(`Vol ${rs(m)}`);
3781
3783
  }
3782
3784
  }
3783
3785
  return l;
3784
3786
  }
3785
- function Cc(e, t, n, o, i, r) {
3787
+ function Tc(e, t, n, o, i, r) {
3786
3788
  if (!i.length) return [];
3787
- const l = r.fontSize ?? 12, s = l * 0.4 + l / 3, a = l * 0.2 + l / 3, c = Math.max(...i.map((x) => st(x, l))) + s * 2, f = l * i.length + 8 * (i.length - 1) + a * 2, h = Sc(t, n, f, o), u = [];
3788
- return r.fillLabelBackground !== !1 && u.push({ t: "rect", x: e - c / 2, y: h - f / 2, w: c, h: f, rx: 4, fill: r.labelBackgroundColor ?? kc, shadow: Lc }), i.forEach((x, d) => {
3789
+ const l = r.fontSize ?? 12, s = l * 0.4 + l / 3, a = l * 0.2 + l / 3, c = Math.max(...i.map((x) => st(x, l))) + s * 2, f = l * i.length + 8 * (i.length - 1) + a * 2, h = Cc(t, n, f, o), u = [];
3790
+ return r.fillLabelBackground !== !1 && u.push({ t: "rect", x: e - c / 2, y: h - f / 2, w: c, h: f, rx: 4, fill: r.labelBackgroundColor ?? Lc, shadow: Sc }), i.forEach((x, d) => {
3789
3791
  u.push({ t: "text", x: e, y: h - f / 2 + a + d * (l + 8) + l / 2, text: x, size: l, fill: r.textColor ?? "#ffffff", anchor: "middle", baseline: "central" });
3790
3792
  }), [{ t: "group", inert: !0, items: u }];
3791
3793
  }
@@ -3796,13 +3798,13 @@ function Zi(e, t, n) {
3796
3798
  `), l = Math.ceil(i), s = Math.round((e.y + t.y) / 2);
3797
3799
  return { x: (e.x + t.x) / 2, cy: s, top: s - r.length * l / 2, lines: r, lineH: l, fs: i };
3798
3800
  }
3799
- function Tc(e, t, n) {
3801
+ function Ac(e, t, n) {
3800
3802
  const o = Zi(e, t, n);
3801
3803
  if (!o || !Me(o.lines)) return { items: [], clip: void 0 };
3802
3804
  const i = o.fs / 3, r = zi({ x: o.x, y: o.cy }, 0, o.lines, o.fs, o.lineH, i, i, "middle", "center", !!n.customTextBold, !!n.customTextItalic);
3803
3805
  return r.length ? { items: [{ t: "clip", name: "text", polys: [r] }], clip: "text" } : { items: [], clip: void 0 };
3804
3806
  }
3805
- function Ac(e, t, n) {
3807
+ function $c(e, t, n) {
3806
3808
  const o = Zi(e, t, n);
3807
3809
  return o ? o.lines.map((i, r) => ({
3808
3810
  t: "text",
@@ -3819,11 +3821,11 @@ function Ac(e, t, n) {
3819
3821
  pre: !0
3820
3822
  })) : [];
3821
3823
  }
3822
- function $c(e) {
3824
+ function Bc(e) {
3823
3825
  return e.fillBackground === !1 ? 0 : Math.max(0, Math.min(1, (100 - (e.transparency ?? 85)) / 100));
3824
3826
  }
3825
3827
  function Xn(e, t, n, o, i) {
3826
- const r = $c(i);
3828
+ const r = Bc(i);
3827
3829
  return { t: "rect", x: e, y: t, w: n, h: o, fill: r > 0 ? i.backgroundColor ?? i.color : "transparent", fillOpacity: r > 0 ? r : 1 };
3828
3830
  }
3829
3831
  const Et = (e, t, n) => ({ t: "line", a: e, b: t, stroke: n.color, strokeWidth: n.width, cap: "round" }), Oe = (e, t, n) => ({
@@ -3836,16 +3838,16 @@ const Et = (e, t, n) => ({ t: "line", a: e, b: t, stroke: n.color, strokeWidth:
3836
3838
  join: "round"
3837
3839
  });
3838
3840
  function Gn(e, t, n, o, i, r, l, s, a) {
3839
- const c = Tc(n, o, s), f = [
3841
+ const c = Ac(n, o, s), f = [
3840
3842
  ...c.items,
3841
3843
  ...e,
3842
3844
  { t: "group", clip: c.clip, items: t },
3843
- ...Cc((n.x + o.x) / 2, n, o, l, a, s),
3844
- ...Ac(i[0], i[1], s)
3845
+ ...Tc((n.x + o.x) / 2, n, o, l, a, s),
3846
+ ...$c(i[0], i[1], s)
3845
3847
  ];
3846
3848
  return r && f.push({ t: "anchors", pts: i }), f;
3847
3849
  }
3848
- function Bc(e, t, n, o, i, r, l) {
3850
+ function Ic(e, t, n, o, i, r, l) {
3849
3851
  if (e.kind !== "price-range") return [];
3850
3852
  const [s, a] = t, c = r.extendLeft ? 0 : Math.min(s.x, a.x), f = r.extendRight ? o : Math.max(s.x, a.x), h = Math.round((s.x + a.x) / 2), u = Un(e, r, l, !0, !1), x = [Et({ x: h, y: s.y }, { x: h, y: a.y }, r)];
3851
3853
  Math.abs(a.y - s.y) >= 15 * r.width && x.push(Oe({ x: h, y: s.y }, { x: h, y: a.y }, r));
@@ -3856,7 +3858,7 @@ function Bc(e, t, n, o, i, r, l) {
3856
3858
  ];
3857
3859
  return Gn(d, x, s, a, t, n, i, r, u);
3858
3860
  }
3859
- function Ic(e, t, n, o, i, r) {
3861
+ function Pc(e, t, n, o, i, r) {
3860
3862
  if (e.kind !== "date-range") return [];
3861
3863
  const [l, s] = t, a = i.extendTop ? 0 : Math.min(l.y, s.y), c = i.extendBottom ? o : Math.max(l.y, s.y), f = Math.round((l.y + s.y) / 2), h = Un(e, i, r, !1, !0), u = [Et({ x: l.x, y: f }, { x: s.x, y: f }, i)];
3862
3864
  Math.abs(s.x - l.x) >= 15 * i.width && u.push(Oe({ x: l.x, y: f }, { x: s.x, y: f }, i));
@@ -3867,7 +3869,7 @@ function Ic(e, t, n, o, i, r) {
3867
3869
  ];
3868
3870
  return Gn(x, u, l, s, t, n, o, i, h);
3869
3871
  }
3870
- function Pc(e, t, n, o, i, r) {
3872
+ function Ec(e, t, n, o, i, r) {
3871
3873
  if (e.kind !== "date-and-price-range") return [];
3872
3874
  const [l, s] = t, a = Math.round((l.y + s.y) / 2), c = Math.round((l.x + s.x) / 2), f = Un(e, i, r, !0, !0), h = i.drawBorder ? i.borderWidth ?? 1 : 0, u = h / 2, x = l.x + Math.sign(s.x - l.x) * u, d = s.x + Math.sign(l.x - s.x) * u, p = l.y + Math.sign(s.y - l.y) * u, y = s.y + Math.sign(l.y - s.y) * u, b = [Xn(Math.min(l.x, s.x), Math.min(l.y, s.y), Math.max(1, Math.abs(s.x - l.x)), Math.max(1, Math.abs(s.y - l.y)), i)];
3873
3875
  h > 0 && b.push({ t: "rect", x: Math.min(l.x, s.x), y: Math.min(l.y, s.y), w: Math.abs(s.x - l.x), h: Math.abs(s.y - l.y), fill: "none", stroke: i.borderColor ?? i.color, strokeWidth: h });
@@ -3877,7 +3879,7 @@ function Pc(e, t, n, o, i, r) {
3877
3879
  ];
3878
3880
  return Math.abs(s.x - l.x) >= 25 * i.width && m.push(Oe({ x, y: a }, { x: d, y: a }, i)), Math.abs(s.y - l.y) >= 25 * i.width && m.push(Oe({ x: c, y: p }, { x: c, y }, i)), Gn(b, m, l, s, t, n, o, i, f);
3879
3881
  }
3880
- function Ec(e, t, n, o, i, r) {
3882
+ function zc(e, t, n, o, i, r) {
3881
3883
  const l = i.regressionLines ?? Fo, s = jo(e, r, o);
3882
3884
  if (!s) {
3883
3885
  const u = [{ t: "line", a: t[0], b: t[1], stroke: l.base.color, strokeWidth: l.base.width, dash: W({ ...i, lineStyle: l.base.style }), cap: "round" }];
@@ -3900,7 +3902,7 @@ function Ec(e, t, n, o, i, r) {
3900
3902
  const h = s.lower;
3901
3903
  return i.showPearsons !== !1 && h && f.push({ t: "text", x: h[0].x, y: h[0].y + 4, text: String(s.pearsons), anchor: "middle", baseline: "hanging", size: 12, fill: l.down.color, inert: !0 }), n && f.push({ t: "anchors", pts: s.anchors }), f;
3902
3904
  }
3903
- function zc(e, t, n, o, i, r) {
3905
+ function Wc(e, t, n, o, i, r) {
3904
3906
  const l = W(i), s = Ko(e, r), a = [{ t: "circle", cx: t[0].x, cy: t[0].y, r: et + L, fill: "transparent" }];
3905
3907
  if (n && a.push({ t: "anchors", pts: t }), s.line.length < 2) {
3906
3908
  const h = { x: o, y: t[0].y };
@@ -3925,7 +3927,7 @@ function zc(e, t, n, o, i, r) {
3925
3927
  return c.push(...f(s.line, i.color, i.width, l), ...a), c;
3926
3928
  }
3927
3929
  const Mo = (e) => e === "dashed" ? "6 4" : e === "dotted" ? "2 3" : void 0;
3928
- function Wc(e) {
3930
+ function Rc(e) {
3929
3931
  const t = Math.abs(e), n = (o, i) => `${(e < 0 ? -o : o).toFixed(o >= 100 ? 0 : o >= 10 ? 1 : 2)}${i}`;
3930
3932
  return t >= 1e9 ? n(t / 1e9, "B") : t >= 1e6 ? n(t / 1e6, "M") : t >= 1e3 ? n(t / 1e3, "K") : String(Math.round(e));
3931
3933
  }
@@ -3949,7 +3951,7 @@ function Ki(e, t, n) {
3949
3951
  t: "text",
3950
3952
  x: h ? r - I - 4 : i + I + 4,
3951
3953
  y: g.y + g.h / 2,
3952
- text: Wc(A),
3954
+ text: Rc(A),
3953
3955
  size: y,
3954
3956
  fill: o.valuesColor,
3955
3957
  anchor: h ? "end" : "start",
@@ -3979,16 +3981,16 @@ function Ki(e, t, n) {
3979
3981
  { t: "group", inert: !0, items: x }
3980
3982
  ];
3981
3983
  }
3982
- function Rc(e, t, n, o) {
3984
+ function Fc(e, t, n, o) {
3983
3985
  const i = ni(e, t, o), r = i && o ? Ki(i, o, e) : [];
3984
3986
  return n && r.push({ t: "anchors", pts: t }), r;
3985
3987
  }
3986
- function Fc(e, t, n, o) {
3988
+ function Oc(e, t, n, o) {
3987
3989
  const i = ei(e, t, o), r = i && o ? Ki(i, o, e) : [];
3988
3990
  return n && r.push({ t: "anchors", pts: [t[0]] }), r;
3989
3991
  }
3990
3992
  const vo = /* @__PURE__ */ new Map();
3991
- function Oc(e, t) {
3993
+ function Dc(e, t) {
3992
3994
  let n = vo.get(t);
3993
3995
  n || (n = new Intl.DateTimeFormat("en-US", {
3994
3996
  timeZone: t,
@@ -4008,11 +4010,11 @@ function Oc(e, t) {
4008
4010
  return { y: Number(i("year")), m: Number(i("month")), d: Number(i("day")), wd: i("weekday"), hh: i("hour"), mi: i("minute"), ss: i("second") };
4009
4011
  }
4010
4012
  const Qe = (e, t) => String(e).padStart(t, "0");
4011
- function Dc(e, t) {
4012
- const n = Oc(e, t);
4013
+ function _c(e, t) {
4014
+ const n = Dc(e, t);
4013
4015
  return { date: `${Qe(n.y, 4)}-${Qe(n.m, 2)}-${Qe(n.d, 2)}`, time: `${n.hh}:${n.mi}` };
4014
4016
  }
4015
- const Be = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAAZ0lEQVR4Xl2OsQmAMBRErwgSsHAJV3GHgEVKl3ADixSClViKYPkHfEI+Wsg1j8dxnCQCiQ1jJRFcFIybHsNYCCJXvCSsJonzp/YXbiKzs7d8pavyEBP2yQEji5YV+1KIkmjI/ouRID31wXKLSuZPUAAAAABJRU5ErkJggg==", w: 9, h: 9 }, _c = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAQAAADI+WwIAAAAb0lEQVQIHWXAMQpBAQAG4L9eKQdQSr3JpFzC5CoOoJzBSUzK+iallNWkrG99pUymDxHw5Z+RdX4ZOpnmm57aXiuWunnScXAxTGLhqMyNth1muVNq1AYKK2wVeTBGo8JZP2/mgEk+KWxQ5ZfSUS8vV97kThm/FD/aAAAAAElFTkSuQmCC", w: 11, h: 10 }, Hc = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAARElEQVR4AWMgHvy/9//5f34gzQZiQYSeAyEPkOYE0iAhMJOTAc4ixXjR/13/r/7////h/zn/pSFCT/43/lcHS6X9fwgANMArS3ikrioAAAAASUVORK5CYII=", w: 9, h: 9 };
4017
+ const Be = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAAZ0lEQVR4Xl2OsQmAMBRErwgSsHAJV3GHgEVKl3ADixSClViKYPkHfEI+Wsg1j8dxnCQCiQ1jJRFcFIybHsNYCCJXvCSsJonzp/YXbiKzs7d8pavyEBP2yQEji5YV+1KIkmjI/ouRID31wXKLSuZPUAAAAABJRU5ErkJggg==", w: 9, h: 9 }, Hc = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAQAAADI+WwIAAAAb0lEQVQIHWXAMQpBAQAG4L9eKQdQSr3JpFzC5CoOoJzBSUzK+iallNWkrG99pUymDxHw5Z+RdX4ZOpnmm57aXiuWunnScXAxTGLhqMyNth1muVNq1AYKK2wVeTBGo8JZP2/mgEk+KWxQ5ZfSUS8vV97kThm/FD/aAAAAAElFTkSuQmCC", w: 11, h: 10 }, Nc = { href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAARElEQVR4AWMgHvy/9//5f34gzQZiQYSeAyEPkOYE0iAhMJOTAc4ixXjR/13/r/7////h/zn/pSFCT/43/lcHS6X9fwgANMArS3ikrioAAAAASUVORK5CYII=", w: 9, h: 9 };
4016
4018
  function Je(e, t, n, o, i, r, l, s) {
4017
4019
  const a = l.fontSize ?? 12, c = 4, f = a / 3, h = Math.max(...i.map((d) => st(d, a))) + c * 2, u = a * i.length + f * 2, x = n === "bottom" ? t - o - u : n === "top" ? t + o : t - u / 2 + o;
4018
4020
  return {
@@ -4062,11 +4064,11 @@ function ko(e, t, n, o, i, r) {
4062
4064
  { t: "line", a: { x: f, y: w }, b: { x: h, y: w }, stroke: g, strokeWidth: i.width }
4063
4065
  ), Le && (K && yt.push(Je(x, M, M < s.y ? "bottom" : "top", ae, [K], p, i)), vt.length > 0 && yt.push(Je(x, s.y, "middle", xr, vt, Ut, i, "#ffffff")), xt && yt.push(Je(x, w, w > s.y ? "top" : "bottom", ae, [xt], d, i))), n && yt.push({ t: "anchors", pts: l.anchors, squares: Yt.position }), yt;
4064
4066
  }
4065
- const Nc = "#202020", Lo = Be.w;
4067
+ const Yc = "#202020", Lo = Be.w;
4066
4068
  function So(e, t, n) {
4067
4069
  const o = N(e);
4068
4070
  if (o == null) return "";
4069
- const i = (n == null ? void 0 : n.timeInfo()) ?? { timeZone: "UTC", intraday: !0 }, { date: r, time: l } = Dc(o, i.timeZone);
4071
+ const i = (n == null ? void 0 : n.timeInfo()) ?? { timeZone: "UTC", intraday: !0 }, { date: r, time: l } = _c(o, i.timeZone);
4070
4072
  return i.intraday ? `${r}${t}${l}` : r;
4071
4073
  }
4072
4074
  function Co(e) {
@@ -4075,7 +4077,7 @@ function Co(e) {
4075
4077
  const f = [
4076
4078
  { t: "rect", x: r, y: l, w: n, h: o, rx: 3, fill: e.bg, fillOpacity: e.opacity, stroke: e.stroke, strokeOpacity: e.opacity, strokeWidth: 2 },
4077
4079
  { t: "path", d: `M ${e.cx - 5} ${s} L ${e.cx} ${a} L ${e.cx + 5} ${s} Z`, fill: e.bg, fillOpacity: e.opacity },
4078
- { t: "circle", cx: e.cx, cy: e.y, r: 3, fill: Nc }
4080
+ { t: "circle", cx: e.cx, cy: e.y, r: 3, fill: Yc }
4079
4081
  ];
4080
4082
  for (const u of e.rows) {
4081
4083
  const x = u.dy != null ? l + u.dy : c;
@@ -4089,7 +4091,7 @@ function Co(e) {
4089
4091
  }
4090
4092
  const h = e.banner;
4091
4093
  if (h) {
4092
- const x = h.above ? l - 18 - 2 : l + o + 2, d = os(h.text, 14), p = r + Math.round((n - d) / 2), y = h.icon, b = h.above ? x + Math.abs(18 - y.h) / 2 : x + 8 - Math.abs(18 - y.h) / 2;
4094
+ const x = h.above ? l - 18 - 2 : l + o + 2, d = is(h.text, 14), p = r + Math.round((n - d) / 2), y = h.icon, b = h.above ? x + Math.abs(18 - y.h) / 2 : x + 8 - Math.abs(18 - y.h) / 2;
4093
4095
  f.push(
4094
4096
  { t: "rect", x: r - 1, y: x, w: n + 2, h: 18, rx: 5, fill: h.bg, fillOpacity: e.opacity },
4095
4097
  { t: "text", x: p, y: x + 3, text: h.text, size: 14, weight: "bold", fill: h.fg, baseline: "hanging" },
@@ -4098,9 +4100,9 @@ function Co(e) {
4098
4100
  }
4099
4101
  return { t: "group", inert: !0, items: f };
4100
4102
  }
4101
- function Yc(e, t, n, o, i, r) {
4103
+ function Vc(e, t, n, o, i, r) {
4102
4104
  if (e.kind !== "position-forecast") return [];
4103
- const [l, s] = t, a = s.y <= l.y, c = Qo(l, s), f = c[c.length - 2] ?? l, h = Math.hypot(s.x - f.x, s.y - f.y) || 1, u = (s.x - f.x) / h, x = (s.y - f.y) / h, d = Math.max(8, 4 * i.width), p = s.x - u * d, y = s.y - x * d, b = [s, { x: p - x * (d / 2), y: y + u * (d / 2) }, { x: p + x * (d / 2), y: y - u * (d / 2) }], m = e.points[1].price - e.points[0].price, g = e.points[0].price !== 0 ? m / Math.abs(e.points[0].price) * 100 : 0, w = N(e.points[0].time), M = N(e.points[1].time), v = w != null && M != null ? Fn(M - w) : "", k = (r == null ? void 0 : r.pipSize()) ?? 0.01, S = Math.max(0, Math.min(8, Math.round(-Math.log10(k)))), C = Or(e, r), I = Math.max(0, Math.min(1, (100 - (i.transparency ?? 10)) / 100)), A = [
4105
+ const [l, s] = t, a = s.y <= l.y, c = Qo(l, s), f = c[c.length - 2] ?? l, h = Math.hypot(s.x - f.x, s.y - f.y) || 1, u = (s.x - f.x) / h, x = (s.y - f.y) / h, d = Math.max(8, 4 * i.width), p = s.x - u * d, y = s.y - x * d, b = [s, { x: p - x * (d / 2), y: y + u * (d / 2) }, { x: p + x * (d / 2), y: y - u * (d / 2) }], m = e.points[1].price - e.points[0].price, g = e.points[0].price !== 0 ? m / Math.abs(e.points[0].price) * 100 : 0, w = N(e.points[0].time), M = N(e.points[1].time), v = w != null && M != null ? Fn(M - w) : "", k = (r == null ? void 0 : r.pipSize()) ?? 0.01, S = Math.max(0, Math.min(8, Math.round(-Math.log10(k)))), C = Dr(e, r), I = Math.max(0, Math.min(1, (100 - (i.transparency ?? 10)) / 100)), A = [
4104
4106
  { t: "polyline", pts: c, fill: "none", stroke: "transparent", strokeWidth: 12 },
4105
4107
  { t: "polyline", pts: c, fill: "none", stroke: i.color, strokeWidth: i.width, join: "round" },
4106
4108
  { t: "polygon", pts: b, fill: i.color, stroke: i.color, strokeWidth: 1, join: "round" },
@@ -4136,7 +4138,7 @@ function Yc(e, t, n, o, i, r) {
4136
4138
  opacity: I,
4137
4139
  banner: C === "waiting" ? void 0 : {
4138
4140
  text: C === "success" ? "SUCCESS" : "FAILURE",
4139
- icon: C === "success" ? _c : Hc,
4141
+ icon: C === "success" ? Hc : Nc,
4140
4142
  bg: C === "success" ? i.successBackground ?? "#4caf50" : i.failureBackground ?? "#F23645",
4141
4143
  fg: C === "success" ? i.successTextColor ?? "#ffffff" : i.failureTextColor ?? "#ffffff",
4142
4144
  above: a
@@ -4145,8 +4147,8 @@ function Yc(e, t, n, o, i, r) {
4145
4147
  ];
4146
4148
  return n && A.push({ t: "anchors", pts: t }), A;
4147
4149
  }
4148
- const Qi = { dx: 0, dy: 2, blur: 4, color: "rgba(0,0,0,0.4)" }, Vc = { dx: 0, dy: 1, blur: 4, color: "rgba(0,0,0,0.4)" }, ke = (e) => Lt(ct(e).hex, 50);
4149
- function Uc(e, t, n, o) {
4150
+ const Qi = { dx: 0, dy: 2, blur: 4, color: "rgba(0,0,0,0.4)" }, Uc = { dx: 0, dy: 1, blur: 4, color: "rgba(0,0,0,0.4)" }, ke = (e) => Lt(ct(e).hex, 50);
4151
+ function Xc(e, t, n, o) {
4150
4152
  const i = e.style, r = wi(e, t), l = gt(e).faint, s = Math.max(1, Math.round(Math.max((i.fontSize ?? 14) / 12, 1))), a = n ? "#2962ff" : o ? "rgba(41, 98, 255, 0.4)" : null, c = r.box, f = [
4151
4153
  {
4152
4154
  t: "rect",
@@ -4169,8 +4171,8 @@ function Uc(e, t, n, o) {
4169
4171
  }
4170
4172
  return n && i.wordWrap && f.push({ t: "anchors", pts: [{ x: c.left + c.width, y: c.top + c.height / 2 }] }), f;
4171
4173
  }
4172
- function Xc(e, t, n, o) {
4173
- const i = e.style, r = [{ t: "path", d: cl, transform: `translate(${t.x - 12} ${t.y - 30})`, fill: i.color, fillRule: "evenodd" }];
4174
+ function Gc(e, t, n, o) {
4175
+ const i = e.style, r = [{ t: "path", d: al, transform: `translate(${t.x - 12} ${t.y - 30})`, fill: i.color, fillRule: "evenodd" }];
4174
4176
  if (!n) return r;
4175
4177
  const l = vi(e, t, o), s = gt(e).faint, a = i.textColor ?? "#dbdbdb", c = [];
4176
4178
  return i.fillBackground !== !1 && c.push({ t: "path", d: ao(l, t.x), fill: Lt(ct(i.backgroundColor ?? "#2e2e2e").hex, 100 - (i.transparency ?? 0)), shadow: Qi }), i.drawBorder && c.push({ t: "path", d: ao(l, t.x), fill: "none", stroke: i.borderColor ?? "#4a4a4a", strokeWidth: 1, inert: !0 }), l.lines.forEach((f, h) => {
@@ -4189,7 +4191,7 @@ function Xc(e, t, n, o) {
4189
4191
  });
4190
4192
  }), r.push({ t: "group", items: c }, { t: "anchors", pts: [t] }), r;
4191
4193
  }
4192
- function Gc(e, t, n, o) {
4194
+ function jc(e, t, n, o) {
4193
4195
  const [i, r] = t;
4194
4196
  if (!r) return [];
4195
4197
  const { txt: l, faint: s, fs: a, box: c } = gi(e, o, i, r), f = c.left, h = c.top, u = c.width, x = c.height, d = o.color ?? "#dbdbdb", p = [
@@ -4224,11 +4226,11 @@ function Gc(e, t, n, o) {
4224
4226
  ];
4225
4227
  return n && p.push({ t: "anchors", pts: t }), p;
4226
4228
  }
4227
- function jc(e, t, n, o) {
4229
+ function qc(e, t, n, o) {
4228
4230
  const [i] = t, { l: r, r: l } = Mi(e, i), s = gt(e).faint, a = o.textColor ?? "#ffffff", c = r.box, f = [
4229
4231
  {
4230
4232
  t: "path",
4231
- d: sl(c.left, c.top, c.width, c.height, [l, l, l, 2]),
4233
+ d: cl(c.left, c.top, c.width, c.height, [l, l, l, 2]),
4232
4234
  fill: Lt(ct(o.backgroundColor ?? o.color).hex, 100 - (o.transparency ?? 0)),
4233
4235
  stroke: o.borderColor ?? o.color,
4234
4236
  strokeWidth: 2
@@ -4237,12 +4239,12 @@ function jc(e, t, n, o) {
4237
4239
  ];
4238
4240
  return n && f.push({ t: "anchors", pts: t }), f;
4239
4241
  }
4240
- function qc(e, t, n, o, i) {
4242
+ function Zc(e, t, n, o, i) {
4241
4243
  const r = n ? Wn(e, t, n, o) : null;
4242
4244
  if (!r) return [];
4243
4245
  const l = [{ t: "line", a: { x: r.x, y: r.poleStart }, b: { x: r.x, y: r.poleEnd }, stroke: Ot.pole, strokeWidth: 1 }];
4244
4246
  r.gap && l.push({ t: "line", a: { x: r.x, y: r.gap[0] }, b: { x: r.x, y: r.gap[1] }, stroke: Ot.pole, strokeWidth: 1 }), e.style.showImage && l.push(
4245
- { t: "circle", cx: r.x, cy: r.plateY, r: 35, fill: e.style.plateColor ?? "#2962ff", stroke: Ot.plateBorder, strokeWidth: 1, shadow: Vc },
4247
+ { t: "circle", cx: r.x, cy: r.plateY, r: 35, fill: e.style.plateColor ?? "#2962ff", stroke: Ot.plateBorder, strokeWidth: 1, shadow: Uc },
4246
4248
  { t: "text", x: r.x, y: r.plateY, text: e.glyph || "🙂", anchor: "middle", baseline: "central", size: 32, inert: !0 }
4247
4249
  );
4248
4250
  const s = r.l.box;
@@ -4251,7 +4253,7 @@ function qc(e, t, n, o, i) {
4251
4253
  U(r.l, gt(e).faint ? ke(Ot.labelText) : Ot.labelText, e.style.bold, e.style.italic)
4252
4254
  ), i && l.push({ t: "anchors", pts: [r.anchor], squares: Yt.single }), l;
4253
4255
  }
4254
- function Zc(e, t, n, o, i) {
4256
+ function Kc(e, t, n, o, i) {
4255
4257
  const [r, l] = t, s = (i == null ? void 0 : i.pipSize()) ?? 0.01, a = Math.max(0, Math.min(8, Math.round(-Math.log10(s)))), c = Xo(e, t, a), f = (() => {
4256
4258
  if (!e.text) return null;
4257
4259
  const d = r.x < l.x ? r : l, p = d === r ? l : r, y = o.horzLabelsAlign ?? "center", b = y === "left" ? d : y === "right" ? p : { x: (r.x + l.x) / 2, y: (r.y + l.y) / 2 }, m = Math.atan((p.y - d.y) / (p.x - d.x));
@@ -4266,10 +4268,10 @@ function Zc(e, t, n, o, i) {
4266
4268
  }
4267
4269
  return x.push({ t: "circle", cx: r.x, cy: r.y, r: 2.5, fill: "none", stroke: "#0f0f0f", strokeWidth: 1, inert: !0 }), n && x.push({ t: "anchors", pts: t }), x;
4268
4270
  }
4269
- function Kc(e, t, n, o) {
4271
+ function Qc(e, t, n, o) {
4270
4272
  const [i, r] = t, l = Li(e, r), s = gt(e).faint, a = o.textColor ?? "#ffffff", c = [{
4271
4273
  t: "path",
4272
- d: fl(l, i, r),
4274
+ d: hl(l, i, r),
4273
4275
  fill: Lt(ct(o.backgroundColor ?? o.color).hex, 100 - (o.transparency ?? 50)),
4274
4276
  stroke: o.borderColor ?? o.color,
4275
4277
  strokeWidth: o.width,
@@ -4290,14 +4292,14 @@ function Kc(e, t, n, o) {
4290
4292
  });
4291
4293
  }), n && c.push({ t: "anchors", pts: l.wrap != null ? [i, { x: r.x + l.wrap / 2 + 10, y: r.y }] : [i] }), c;
4292
4294
  }
4293
- function Qc(e, t, n, o) {
4295
+ function Jc(e, t, n, o) {
4294
4296
  const i = En(e, t), r = e.style, l = i.right - i.left, s = i.bottom - i.top;
4295
4297
  let a = "";
4296
4298
  for (const d of i.ys) a += `M${i.left} ${d}h${l}v${ht}h${-l}Z`;
4297
4299
  for (const d of i.xs) a += `M${d} ${i.top}h${ht}v${s}h${-ht}Z`;
4298
4300
  let c = "";
4299
4301
  if (o != null && o.cell && o.cell[0] < i.ys.length - 1 && o.cell[1] < i.xs.length - 1) {
4300
- const [d, p] = o.cell, y = i.xs[p], b = i.xs[p + 1], m = i.ys[d], g = i.ys[d + 1], w = ht, M = Hr;
4302
+ const [d, p] = o.cell, y = i.xs[p], b = i.xs[p + 1], m = i.ys[d], g = i.ys[d + 1], w = ht, M = Nr;
4301
4303
  c = [
4302
4304
  [y + w, m + w, b - y - w, M],
4303
4305
  [y + w, g - M, b - y - w, M],
@@ -4333,9 +4335,9 @@ function Qc(e, t, n, o) {
4333
4335
  { t: "rect", x: i.left, y: i.top, w: l, h: s, fill: r.backgroundColor ?? "#0f0f0f" },
4334
4336
  { t: "path", d: a, fill: r.color, crisp: !0 }
4335
4337
  ];
4336
- return c && x.push({ t: "path", d: c, fill: Nr, crisp: !0 }), x.push({ t: "group", inert: !0, items: u }), f && x.push({ t: "path", d: f, fill: Yr, inert: !0 }), n && x.push({ t: "anchors", pts: di(i) }), x;
4338
+ return c && x.push({ t: "path", d: c, fill: Yr, crisp: !0 }), x.push({ t: "group", inert: !0, items: u }), f && x.push({ t: "path", d: f, fill: Vr, inert: !0 }), n && x.push({ t: "anchors", pts: di(i) }), x;
4337
4339
  }
4338
- function Jc(e, t, n) {
4340
+ function ta(e, t, n) {
4339
4341
  var r, l;
4340
4342
  const o = bi(e, t);
4341
4343
  if (!o) return [];
@@ -4355,23 +4357,23 @@ function tn(e, t, n) {
4355
4357
  const { w: o, h: i, coords: r, selected: l } = n, s = !!n.hovered, a = l || s, c = e.style;
4356
4358
  switch (e.kind) {
4357
4359
  case "horizontal-line":
4358
- return fs(t, l, o, c);
4360
+ return hs(t, l, o, c);
4359
4361
  case "vertical-line":
4360
- return hs(t, l, i, c);
4362
+ return us(t, l, i, c);
4361
4363
  case "cross-line":
4362
- return us(t, l, o, i, c);
4364
+ return xs(t, l, o, i, c);
4363
4365
  case "trend-line":
4364
4366
  return c.extendLeft || c.extendRight ? Te(e, t, l, o, i, c, !!c.extendLeft, !!c.extendRight, r, a) : uo(e, t, l, o, i, c, r, a);
4365
4367
  case "horizontal-ray":
4366
- return xs(t, l, o, c);
4368
+ return ds(t, l, o, c);
4367
4369
  case "ray":
4368
4370
  return Te(e, t, l, o, i, c, c.extendLeft ?? !1, c.extendRight ?? !0, r, a);
4369
4371
  case "extended-line":
4370
4372
  return Te(e, t, l, o, i, c, c.extendLeft ?? !0, c.extendRight ?? !0, r, a);
4371
4373
  case "info-line":
4372
- return ds(e, t, l, o, i, c, r, a);
4373
- case "trend-angle":
4374
4374
  return ys(e, t, l, o, i, c, r, a);
4375
+ case "trend-angle":
4376
+ return ps(e, t, l, o, i, c, r, a);
4375
4377
  case "arrow": {
4376
4378
  const f = { ...c, leftEnd: c.leftEnd ?? 0, rightEnd: c.rightEnd ?? 1 };
4377
4379
  return f.extendLeft || f.extendRight ? Te(e, t, l, o, i, f, !!f.extendLeft, !!f.extendRight, r, a) : uo(e, t, l, o, i, f, r, a);
@@ -4381,71 +4383,71 @@ function tn(e, t, n) {
4381
4383
  case "short-position":
4382
4384
  return ko(e, t, l, "short", c, r);
4383
4385
  case "position-forecast":
4384
- return Yc(e, t, l, o, c, r);
4386
+ return Vc(e, t, l, o, c, r);
4385
4387
  case "parallel-channel":
4386
- return gs(t, l, c, o, i);
4388
+ return ws(t, l, c, o, i);
4387
4389
  case "disjoint-channel":
4388
- return ws(e, t, l, c, o, i, r);
4389
- case "flat-top-bottom":
4390
4390
  return Ms(e, t, l, c, o, i, r);
4391
+ case "flat-top-bottom":
4392
+ return vs(e, t, l, c, o, i, r);
4391
4393
  case "fib-retracement":
4392
- return vs(e, t, l, o, c, r);
4393
- case "trend-based-fib-extension":
4394
4394
  return ks(e, t, l, o, c, r);
4395
+ case "trend-based-fib-extension":
4396
+ return Ls(e, t, l, o, c, r);
4395
4397
  case "fib-channel":
4396
- return Ls(e, t, l, c, r, o, i);
4398
+ return Ss(e, t, l, c, r, o, i);
4397
4399
  case "trend-based-fib-time":
4398
- return Ss(e, t, l, i, c, r);
4400
+ return Cs(e, t, l, i, c, r);
4399
4401
  case "fib-time-zone":
4400
- return Cs(t, l, i, c);
4402
+ return Ts(t, l, i, c);
4401
4403
  case "fib-circles":
4402
- return As(e, t, l, c);
4404
+ return $s(e, t, l, c);
4403
4405
  case "fib-speed-resistance-fan":
4404
- return $s(e, t, l, o, i, c, r);
4406
+ return Bs(e, t, l, o, i, c, r);
4405
4407
  case "fib-speed-resistance-arcs":
4406
- return Bs(t, l, c);
4408
+ return Is(t, l, c);
4407
4409
  case "fib-spiral":
4408
- return Is(t, l, o, i, c);
4410
+ return Ps(t, l, o, i, c);
4409
4411
  case "fib-wedge":
4410
- return Ps(t, l, c);
4412
+ return Es(t, l, c);
4411
4413
  case "pitchfan":
4412
- return Es(t, l, o, c);
4414
+ return zs(t, l, o, c);
4413
4415
  case "pitchfork":
4414
4416
  case "schiff-pitchfork":
4415
4417
  case "modified-schiff-pitchfork":
4416
4418
  case "inside-pitchfork":
4417
- return Fs(e.kind, t, l, o, c);
4419
+ return Os(e.kind, t, l, o, c);
4418
4420
  case "gann-fan":
4419
- return Ws(t, l, o, i, c);
4421
+ return Rs(t, l, o, i, c);
4420
4422
  case "gann-box":
4421
- return Rs(e, t, l, c, r);
4423
+ return Fs(e, t, l, c, r);
4422
4424
  case "gann-square-fixed":
4423
4425
  case "gann-square":
4424
- return zs(e, t, l, c, r);
4426
+ return Ws(e, t, l, c, r);
4425
4427
  case "rectangle":
4426
- return _s(e, t, l, o, c, s);
4428
+ return Hs(e, t, l, o, c, s);
4427
4429
  case "rotated-rectangle":
4428
- return Hs(e, t, l, c);
4430
+ return Ns(e, t, l, c);
4429
4431
  case "circle":
4430
- return Ns(e, t, l, c, s);
4431
- case "ellipse":
4432
4432
  return Ys(e, t, l, c, s);
4433
+ case "ellipse":
4434
+ return Vs(e, t, l, c, s);
4433
4435
  case "triangle":
4434
- return Vs(t, l, c, s);
4436
+ return Us(t, l, c, s);
4435
4437
  case "arc":
4436
- return Us(t, l, c);
4437
- case "curve":
4438
4438
  return Xs(t, l, c);
4439
- case "double-curve":
4439
+ case "curve":
4440
4440
  return Gs(t, l, c);
4441
- case "sector":
4441
+ case "double-curve":
4442
4442
  return js(t, l, c);
4443
+ case "sector":
4444
+ return qs(t, l, c);
4443
4445
  case "cyclic-lines":
4444
- return qs(t, l, o, i, c);
4446
+ return Zs(t, l, o, i, c);
4445
4447
  case "sine-line":
4446
- return Zs(t, l, o, c);
4447
- case "time-cycles":
4448
4448
  return Ks(t, l, o, c);
4449
+ case "time-cycles":
4450
+ return Qs(t, l, o, c);
4449
4451
  case "abcd-pattern":
4450
4452
  case "xabcd-pattern":
4451
4453
  case "cypher-pattern":
@@ -4461,59 +4463,59 @@ function tn(e, t, n) {
4461
4463
  case "path":
4462
4464
  case "brush":
4463
4465
  case "highlighter":
4464
- return ac(e, t, l, c);
4466
+ return fc(e, t, l, c);
4465
4467
  case "arrow-marker":
4466
- return hc(t, l, c);
4468
+ return uc(t, l, c);
4467
4469
  case "arrow-mark-up":
4468
4470
  return bo(e, t, l, c, "up");
4469
4471
  case "arrow-mark-down":
4470
4472
  return bo(e, t, l, c, "down");
4471
4473
  case "flag-mark":
4472
- return dc(t, l, c);
4474
+ return yc(t, l, c);
4473
4475
  case "price-label":
4474
- return yc(e, t, l, c, r);
4476
+ return pc(e, t, l, c, r);
4475
4477
  case "font-icon":
4476
- return bc(e, t, l);
4478
+ return mc(e, t, l);
4477
4479
  case "bar-pattern":
4478
- return Mc(e, t, l, c, r);
4479
- case "ghost-feed":
4480
4480
  return vc(e, t, l, c, r);
4481
+ case "ghost-feed":
4482
+ return kc(e, t, l, c, r);
4481
4483
  case "price-range":
4482
- return Bc(e, t, l, o, i, c, r);
4484
+ return Ic(e, t, l, o, i, c, r);
4483
4485
  case "date-range":
4484
- return Ic(e, t, l, i, c, r);
4485
- case "date-and-price-range":
4486
4486
  return Pc(e, t, l, i, c, r);
4487
+ case "date-and-price-range":
4488
+ return Ec(e, t, l, i, c, r);
4487
4489
  case "regression-trend":
4488
- return Ec(e, t, l, o, c, r);
4489
- case "anchored-vwap":
4490
4490
  return zc(e, t, l, o, c, r);
4491
+ case "anchored-vwap":
4492
+ return Wc(e, t, l, o, c, r);
4491
4493
  case "fixed-range-volume-profile":
4492
- return Rc(e, t, l, r);
4493
- case "anchored-volume-profile":
4494
4494
  return Fc(e, t, l, r);
4495
+ case "anchored-volume-profile":
4496
+ return Oc(e, t, l, r);
4495
4497
  case "text":
4496
- return Uc(e, t[0], n.textSelected ?? l, s);
4498
+ return Xc(e, t[0], n.textSelected ?? l, s);
4497
4499
  case "pin":
4498
- return Xc(e, t[0], l, o);
4500
+ return Gc(e, t[0], l, o);
4499
4501
  case "note":
4500
- return Gc(e, t, l, c);
4501
- case "comment":
4502
4502
  return jc(e, t, l, c);
4503
+ case "comment":
4504
+ return qc(e, t, l, c);
4503
4505
  case "price-note":
4504
- return Zc(e, t, l, c, r);
4506
+ return Kc(e, t, l, c, r);
4505
4507
  case "signpost":
4506
- return qc(e, t[0], r, i, l);
4508
+ return Zc(e, t[0], r, i, l);
4507
4509
  case "callout":
4508
- return Kc(e, t, l, c);
4510
+ return Qc(e, t, l, c);
4509
4511
  case "table":
4510
- return Qc(e, t[0], l, n.tableUi ?? null);
4512
+ return Jc(e, t[0], l, n.tableUi ?? null);
4511
4513
  case "image":
4512
- return Jc(e, t[0], l);
4514
+ return ta(e, t[0], l);
4513
4515
  }
4514
4516
  return [];
4515
4517
  }
4516
- function ta(e, t) {
4518
+ function ea(e, t) {
4517
4519
  return e.map((n) => ({
4518
4520
  t: "group",
4519
4521
  inert: !0,
@@ -4525,16 +4527,16 @@ function ta(e, t) {
4525
4527
  ]
4526
4528
  }));
4527
4529
  }
4528
- function ea(e) {
4530
+ function na(e) {
4529
4531
  if (!Array.isArray(e)) return [];
4530
4532
  const t = [];
4531
4533
  for (const n of e)
4532
4534
  !n || typeof n != "object" || typeof n.id != "string" || typeof n.kind != "string" || !Array.isArray(n.points) || n.points.length === 0 || !n.points.every(
4533
4535
  (i) => i != null && typeof i == "object" && "time" in i && "price" in i && typeof i.price == "number"
4534
- ) || ((!n.style || typeof n.style != "object") && (n.style = { ...Mn }), t.push(na(n)));
4536
+ ) || ((!n.style || typeof n.style != "object") && (n.style = { ...Mn }), t.push(oa(n)));
4535
4537
  return t;
4536
4538
  }
4537
- function na(e) {
4539
+ function oa(e) {
4538
4540
  const t = e.points, n = t.length, o = (i) => ({ ...i });
4539
4541
  switch (e.kind) {
4540
4542
  case "polyline":
@@ -4612,7 +4614,7 @@ function na(e) {
4612
4614
  return e;
4613
4615
  }
4614
4616
  }
4615
- const oa = 3, Ji = 5, ia = 2, ra = 50;
4617
+ const ia = 3, Ji = 5, ra = 2, la = 50;
4616
4618
  function ye(e, t, n) {
4617
4619
  return t.anchored ? [{ x: t.anchored.x * n.w, y: t.anchored.y * n.h }] : tr(e, t.points);
4618
4620
  }
@@ -4655,7 +4657,7 @@ function To(e, t, n, o, i = !0) {
4655
4657
  const h = t.priceToY(f), u = s != null && h != null ? Math.abs(h - s) : Math.abs(e.price - f);
4656
4658
  u < c && (c = u, a = f);
4657
4659
  }
4658
- return n === "weak" && s != null && c >= ra ? null : { time: e.time, price: a };
4660
+ return n === "weak" && s != null && c >= la ? null : { time: e.time, price: a };
4659
4661
  }
4660
4662
  function V(e, t) {
4661
4663
  switch (e.kind) {
@@ -4757,7 +4759,7 @@ function V(e, t) {
4757
4759
  function er(e, t) {
4758
4760
  return Math.atan2(-(t.y - e.y), t.x - e.x) * 180 / Math.PI;
4759
4761
  }
4760
- const la = /* @__PURE__ */ new Set([
4762
+ const sa = /* @__PURE__ */ new Set([
4761
4763
  "abcd-pattern",
4762
4764
  "xabcd-pattern",
4763
4765
  "cypher-pattern",
@@ -4888,7 +4890,7 @@ function mn(e, t) {
4888
4890
  }
4889
4891
  return null;
4890
4892
  }
4891
- function sa(e, t, n, o, i) {
4893
+ function ca(e, t, n, o, i) {
4892
4894
  const r = e.points[0], l = n.pipSize(), s = n.yToPrice(0), a = n.yToPrice(Math.max(1, i)), c = s != null && a != null ? Math.abs(s - a) : 0, f = Math.max(l, Math.round((c || l * 500) * 0.2 / l) * l), h = n.bars(), u = n.timeToBarIndex(r.time) ?? h.length, x = n.barIndexToTime(u), d = n.barIndexToTime(u + 1), p = x != null ? n.timeToX(x) : null, y = d != null ? n.timeToX(d) : null, b = p != null && y != null ? Math.abs(y - p) : 0, m = b > 0 ? Math.round(o / b) : 0, g = u + Math.max(3, Math.round(0.15 * m)), w = n.barIndexToTime(g) ?? r.time, M = { ...Kt(t), stopLevel: f, profitLevel: f };
4893
4895
  return {
4894
4896
  ...e,
@@ -4896,7 +4898,7 @@ function sa(e, t, n, o, i) {
4896
4898
  style: M
4897
4899
  };
4898
4900
  }
4899
- function ca(e, t, n) {
4901
+ function aa(e, t, n) {
4900
4902
  const o = e.points[1];
4901
4903
  if (!o) return e;
4902
4904
  const i = N(e.points[0].time), r = N(o.time);
@@ -4916,14 +4918,14 @@ function ca(e, t, n) {
4916
4918
  }
4917
4919
  };
4918
4920
  }
4919
- function aa(e, t) {
4921
+ function fa(e, t) {
4920
4922
  const n = t.bars(), o = t.pipSize(), i = n.length > 0 ? n.reduce((l, s) => l + (s.high - s.low), 0) / n.length : 0, r = i > 0 ? Math.max(1, Math.round(i / o)) * o : Math.abs(e.points[0].price) * 0.01 || 1;
4921
4923
  return {
4922
4924
  ...e,
4923
4925
  ghost: { seed: Math.floor(Math.random() * 2147483647), amplitude: r }
4924
4926
  };
4925
4927
  }
4926
- function fa(e, t) {
4928
+ function ha(e, t) {
4927
4929
  const n = e.points[0], o = e.points[e.points.length - 1];
4928
4930
  if (!n || !o) return e;
4929
4931
  const i = J(t, n), r = J(t, o);
@@ -4939,7 +4941,7 @@ function fa(e, t) {
4939
4941
  }
4940
4942
  return e;
4941
4943
  }
4942
- function ha(e, t) {
4944
+ function ua(e, t) {
4943
4945
  const n = J(t, e.points[0]), o = e.points[1] ? J(t, e.points[1]) : null;
4944
4946
  return !n || !o ? e : {
4945
4947
  ...e,
@@ -4958,7 +4960,7 @@ function nr(e, t) {
4958
4960
  }
4959
4961
  function Ao(e, t, n, o, i = {}) {
4960
4962
  let r = mn(e, t);
4961
- return r ? ((e === "long-position" || e === "short-position") && n && (r = sa(r, e, n, o.w, o.h)), (e === "curve" || e === "double-curve") && n && (r = fa(r, n)), e === "gann-square" && n && (r = nr(r, n)), e === "bar-pattern" && n && (r = ca(r, n, Math.max(1, o.h))), e === "trend-angle" && n && (r = ha(r, n)), e === "polyline" && i.closed !== void 0 && (r = { ...r, closed: i.closed }), e === "ghost-feed" && n && (r = aa(r, n)), e === "font-icon" && (r = { ...r, glyph: i.glyph }), r) : null;
4963
+ return r ? ((e === "long-position" || e === "short-position") && n && (r = ca(r, e, n, o.w, o.h)), (e === "curve" || e === "double-curve") && n && (r = ha(r, n)), e === "gann-square" && n && (r = nr(r, n)), e === "bar-pattern" && n && (r = aa(r, n, Math.max(1, o.h))), e === "trend-angle" && n && (r = ua(r, n)), e === "polyline" && i.closed !== void 0 && (r = { ...r, closed: i.closed }), e === "ghost-feed" && n && (r = fa(r, n)), e === "font-icon" && (r = { ...r, glyph: i.glyph }), r) : null;
4962
4964
  }
4963
4965
  const or = /* @__PURE__ */ new Set([
4964
4966
  "trend-line",
@@ -4974,7 +4976,7 @@ const or = /* @__PURE__ */ new Set([
4974
4976
  "price-note",
4975
4977
  "note",
4976
4978
  "rotated-rectangle"
4977
- ]), ua = /* @__PURE__ */ new Set(["parallel-channel", "flat-top-bottom", "disjoint-channel"]);
4979
+ ]), xa = /* @__PURE__ */ new Set(["parallel-channel", "flat-top-bottom", "disjoint-channel"]);
4978
4980
  function Ie(e, t) {
4979
4981
  const n = e.barIndexToTime(t), o = n == null ? null : e.timeToX(n);
4980
4982
  return n == null || o == null ? null : { i: t, time: n, x: o };
@@ -5045,7 +5047,7 @@ function $o(e, t, n, o) {
5045
5047
  const i = t.length;
5046
5048
  if (i === 0) return { point: n };
5047
5049
  if (or.has(e)) return { point: ee(o, n, t[i - 1]) };
5048
- if (ua.has(e)) return { point: i === 1 ? ee(o, n, t[0]) : n };
5050
+ if (xa.has(e)) return { point: i === 1 ? ee(o, n, t[0]) : n };
5049
5051
  if (e === "rectangle") return { point: i === 1 ? ir(o, n, t[0]) : n };
5050
5052
  if (e === "gann-box") return { point: rr(o, n, t[0]) };
5051
5053
  if (e === "ellipse" && i === 1) {
@@ -5061,7 +5063,7 @@ function jn(e, t) {
5061
5063
  function Bo(e, t, n) {
5062
5064
  return t && J(e, t) || n;
5063
5065
  }
5064
- function xa(e, t, n) {
5066
+ function da(e, t, n) {
5065
5067
  const o = e.start;
5066
5068
  if (e.mode.hit !== "handle") return { cursor: t };
5067
5069
  const i = e.mode.handleIndex, r = o.points, l = e.startScreen, s = (f) => D(n, f), a = (f, h = ee) => {
@@ -5103,7 +5105,7 @@ function xa(e, t, n) {
5103
5105
  const h = s(f[(i + 2) % 4]);
5104
5106
  return h ? a(h, ir) : { cursor: t };
5105
5107
  }
5106
- return { cursor: t, drawing: ya(e, t, n) };
5108
+ return { cursor: t, drawing: pa(e, t, n) };
5107
5109
  }
5108
5110
  case "gann-box": {
5109
5111
  if (l.length !== 2 || i >= 4) return { cursor: t };
@@ -5111,7 +5113,7 @@ function xa(e, t, n) {
5111
5113
  return f ? a(f, rr) : { cursor: t };
5112
5114
  }
5113
5115
  case "gann-square":
5114
- return { cursor: t, drawing: i <= 1 ? da(e, t, n) : void 0 };
5116
+ return { cursor: t, drawing: i <= 1 ? ya(e, t, n) : void 0 };
5115
5117
  }
5116
5118
  return or.has(o.kind) && i <= 1 && r.length >= 2 ? a(r[i === 0 ? 1 : 0]) : { cursor: t };
5117
5119
  }
@@ -5137,7 +5139,7 @@ function sr(e, t, n, o, i = (r) => r) {
5137
5139
  }
5138
5140
  return V(r, x);
5139
5141
  }
5140
- function da(e, t, n) {
5142
+ function ya(e, t, n) {
5141
5143
  const o = e.start;
5142
5144
  if (e.mode.hit !== "handle") return null;
5143
5145
  const i = e.mode.handleIndex, [r, l] = o.points, s = n.timeToBarIndex(r.time), a = n.timeToBarIndex(l.time), c = D(n, t);
@@ -5147,7 +5149,7 @@ function da(e, t, n) {
5147
5149
  const d = [...o.points];
5148
5150
  return d[i] = { time: c.time, price: h.price + (c.price - h.price > 0 ? 1 : -1) * Math.abs(u - x) * f }, V(o, d);
5149
5151
  }
5150
- function ya(e, t, n) {
5152
+ function pa(e, t, n) {
5151
5153
  const o = e.start;
5152
5154
  if (e.mode.hit !== "handle") return null;
5153
5155
  const [i, , r] = mt(e.startScreen[0], e.startScreen[1]);
@@ -5169,7 +5171,7 @@ function ya(e, t, n) {
5169
5171
  const h = D(n, { x: l, y: s }), u = D(n, { x: a, y: c });
5170
5172
  return !h || !u ? null : V(o, [h, u]);
5171
5173
  }
5172
- function pa(e, t, n, o) {
5174
+ function ba(e, t, n, o) {
5173
5175
  const i = e.start;
5174
5176
  if (i.kind !== "long-position" && i.kind !== "short-position" || e.mode.hit !== "handle") return null;
5175
5177
  const r = e.mode.handleIndex, [l, s] = i.points, a = n.pipSize(), c = i.kind === "long-position" ? 1 : -1, { stop: f, profit: h } = _o(i, a);
@@ -5195,7 +5197,7 @@ function pa(e, t, n, o) {
5195
5197
  }
5196
5198
  return null;
5197
5199
  }
5198
- function ba(e, t, n) {
5200
+ function ma(e, t, n) {
5199
5201
  const o = e.start;
5200
5202
  if (o.kind !== "parallel-channel" || e.mode.hit !== "handle") return null;
5201
5203
  const [i, r, l] = e.startScreen;
@@ -5219,7 +5221,7 @@ function ba(e, t, n) {
5219
5221
  }
5220
5222
  return null;
5221
5223
  }
5222
- function ma(e, t, n, o) {
5224
+ function ga(e, t, n, o) {
5223
5225
  const i = e.start;
5224
5226
  if (i.kind !== "disjoint-channel" || e.mode.hit !== "handle") return null;
5225
5227
  const r = e.mode.handleIndex, l = i.points;
@@ -5239,7 +5241,7 @@ function ma(e, t, n, o) {
5239
5241
  }
5240
5242
  return null;
5241
5243
  }
5242
- function ga(e, t, n, o) {
5244
+ function wa(e, t, n, o) {
5243
5245
  const i = e.start;
5244
5246
  if (i.kind !== "rotated-rectangle" || e.mode.hit !== "handle") return null;
5245
5247
  const r = e.mode.handleIndex, l = D(n, t);
@@ -5254,11 +5256,11 @@ function ga(e, t, n, o) {
5254
5256
  const m = Math.hypot(b.x - y.x, b.y - y.y) || 1, g = D(n, { x: y.x + (b.y - y.y) / m * d, y: y.y - (b.x - y.x) / m * d });
5255
5257
  return g ? (s[2] = g, V(i, s)) : null;
5256
5258
  }
5257
- function wa(e, t, n, o, i = !1) {
5259
+ function Ma(e, t, n, o, i = !1) {
5258
5260
  var f, h;
5259
5261
  const r = sn(e.start.kind);
5260
5262
  if (i && e.mode.hit === "handle") {
5261
- const u = xa(e, t, n);
5263
+ const u = da(e, t, n);
5262
5264
  if (u.drawing !== void 0) return u.drawing;
5263
5265
  t = u.cursor;
5264
5266
  }
@@ -5270,11 +5272,11 @@ function wa(e, t, n, o, i = !1) {
5270
5272
  switch (e.start.kind) {
5271
5273
  case "long-position":
5272
5274
  case "short-position":
5273
- return pa(e, t, n, o);
5275
+ return ba(e, t, n, o);
5274
5276
  case "parallel-channel":
5275
- return ba(e, t, n);
5277
+ return ma(e, t, n);
5276
5278
  case "table":
5277
- return Ma(e, t, n);
5279
+ return va(e, t, n);
5278
5280
  case "signpost": {
5279
5281
  const u = ((f = e.pane) == null ? void 0 : f.h) ?? 0, x = fo(e.start, n, u, t.y);
5280
5282
  return x == null ? null : { ...e.start, style: { ...e.start.style, signpostPosition: x } };
@@ -5293,7 +5295,7 @@ function wa(e, t, n, o, i = !1) {
5293
5295
  return y ? { ...V(e.start, [e.start.points[0], y]), style: { ...u, wordWrapWidth: p } } : null;
5294
5296
  }
5295
5297
  case "image":
5296
- return va(e, t, n);
5298
+ return ka(e, t, n);
5297
5299
  // Anchored pin (TV Anchor drawing): its one anchor moves the fixed pane
5298
5300
  // position like a body move (TV refuses point changes of a fixed
5299
5301
  // drawing; the pin has a single point).
@@ -5314,14 +5316,14 @@ function wa(e, t, n, o, i = !1) {
5314
5316
  break;
5315
5317
  }
5316
5318
  case "disjoint-channel":
5317
- return ma(e, t, n, o);
5319
+ return ga(e, t, n, o);
5318
5320
  // TV Ellipse.setPoint: moving an end rebuilds the minor-axis point at
5319
5321
  // the radius the ellipse had when the drag started (Shift: see ./shift).
5320
5322
  case "ellipse":
5321
5323
  if (e.mode.handleIndex <= 1) return sr(e, t, n, !1, o);
5322
5324
  break;
5323
5325
  case "rotated-rectangle":
5324
- if (e.start.fmt === 2) return ga(e, t, n, o);
5326
+ if (e.start.fmt === 2) return wa(e, t, n, o);
5325
5327
  break;
5326
5328
  // TV: the h-line anchor is a vertical resize (price only), the v-line
5327
5329
  // anchor a horizontal resize (time only).
@@ -5386,9 +5388,9 @@ function cr(e, t) {
5386
5388
  const i = e.timeToBarIndex(n);
5387
5389
  return i == null ? n : e.barIndexToTime(i - 1) ?? n;
5388
5390
  }
5389
- function Ma(e, t, n) {
5391
+ function va(e, t, n) {
5390
5392
  if (e.mode.hit !== "handle") return null;
5391
- const o = e.start, i = o.style, r = e.mode.handleIndex, l = e.startScreen[0], s = i.fontSize ?? 14, a = we(i), { heights: c, mins: f } = xi(i), h = Ur(s), u = a.map(() => h), x = (B) => B.reduce((R, Y) => R + Y, 0), d = x(a), p = x(c), y = ci(r);
5393
+ const o = e.start, i = o.style, r = e.mode.handleIndex, l = e.startScreen[0], s = i.fontSize ?? 14, a = we(i), { heights: c, mins: f } = xi(i), h = Xr(s), u = a.map(() => h), x = (B) => B.reduce((R, Y) => R + Y, 0), d = x(a), p = x(c), y = ci(r);
5392
5394
  if (y) {
5393
5395
  const B = {};
5394
5396
  if (y.col != null) {
@@ -5435,15 +5437,15 @@ function Ma(e, t, n) {
5435
5437
  style: { ...i, tableColWidths: T.map((B) => Math.max(B, h)), tableRowHeights: E.map((B) => Math.max(B, P)) }
5436
5438
  };
5437
5439
  }
5438
- function va(e, t, n) {
5440
+ function ka(e, t, n) {
5439
5441
  const o = e.start, i = o.image, r = zn(i == null ? void 0 : i.name);
5440
5442
  if (!i || !r || e.mode.hit !== "handle" || e.mode.handleIndex > 3) return null;
5441
- const [l, s] = nl[e.mode.handleIndex], a = { x: e.startScreen[0].x + (i.dx ?? 0), y: e.startScreen[0].y }, c = { x: a.x - l * i.cssWidth / 2, y: a.y - s * i.cssHeight / 2 }, f = Math.max(Math.abs(c.x - t.x) / r.width, Math.abs(c.y - t.y) / r.height), h = Math.round(r.width * f), u = Math.round(r.height * f), x = { x: c.x + l * h / 2, y: c.y + s * u / 2 }, d = D(n, x);
5443
+ const [l, s] = ol[e.mode.handleIndex], a = { x: e.startScreen[0].x + (i.dx ?? 0), y: e.startScreen[0].y }, c = { x: a.x - l * i.cssWidth / 2, y: a.y - s * i.cssHeight / 2 }, f = Math.max(Math.abs(c.x - t.x) / r.width, Math.abs(c.y - t.y) / r.height), h = Math.round(r.width * f), u = Math.round(r.height * f), x = { x: c.x + l * h / 2, y: c.y + s * u / 2 }, d = D(n, x);
5442
5444
  if (!d) return null;
5443
5445
  const p = n.timeToX(d.time);
5444
5446
  return { ...o, points: [d], image: { ...i, cssWidth: h, cssHeight: u, dx: p == null ? 0 : x.x - p } };
5445
5447
  }
5446
- function ka(e, t) {
5448
+ function La(e, t) {
5447
5449
  if (t.length < 2) return "grab";
5448
5450
  let n = 0, o = 0;
5449
5451
  for (const s of t)
@@ -5454,12 +5456,12 @@ function ka(e, t) {
5454
5456
  const l = (Math.atan2(r, i) * 180 / Math.PI + 360) % 180;
5455
5457
  return l < 22.5 || l >= 157.5 ? "ew-resize" : l < 67.5 ? "nwse-resize" : l < 112.5 ? "ns-resize" : "nesw-resize";
5456
5458
  }
5457
- const La = /* @__PURE__ */ new Set(["text", "pin", "table"]);
5458
- function Sa(e) {
5459
- return La.has(e);
5459
+ const Sa = /* @__PURE__ */ new Set(["text", "pin", "table"]);
5460
+ function Ca(e) {
5461
+ return Sa.has(e);
5460
5462
  }
5461
- function Ca(e, t, n) {
5462
- if (!Sa(e.kind) || n.w <= 0 || n.h <= 0) return null;
5463
+ function Ta(e, t, n) {
5464
+ if (!Ca(e.kind) || n.w <= 0 || n.h <= 0) return null;
5463
5465
  if (!e.anchored) {
5464
5466
  const c = J(t, e.points[0]);
5465
5467
  return c ? { ...e, anchored: { x: c.x / n.w, y: c.y / n.h } } : null;
@@ -5469,12 +5471,12 @@ function Ca(e, t, n) {
5469
5471
  const { anchored: s, ...a } = e;
5470
5472
  return V(a, [{ time: r, price: l }]);
5471
5473
  }
5472
- const Ta = 1;
5473
- function Aa(e, t, n, o = () => [], i = () => ({ timeZone: "UTC", intraday: !0 })) {
5474
+ const Aa = 1;
5475
+ function $a(e, t, n, o = () => [], i = () => ({ timeZone: "UTC", intraday: !0 })) {
5474
5476
  return {
5475
5477
  priceToY: (r) => t.priceToCoordinate(r),
5476
5478
  yToPrice: (r) => t.coordinateToPrice(r),
5477
- isLog: () => t.priceScale().options().mode === Ta,
5479
+ isLog: () => t.priceScale().options().mode === Aa,
5478
5480
  // timeToCoordinate / coordinateToTime only map within the loaded data range;
5479
5481
  // off-data x (the empty space to the RIGHT of the last bar — i.e. the
5480
5482
  // future, where drawings should be anchorable just like in TradingView)
@@ -5502,7 +5504,7 @@ function Aa(e, t, n, o = () => [], i = () => ({ timeZone: "UTC", intraday: !0 })
5502
5504
  const f = be(s);
5503
5505
  return f <= 0 ? null : Math.round(c + (a - (s.length - 1)) * f);
5504
5506
  },
5505
- barAt: (r) => $a(n(), r),
5507
+ barAt: (r) => Ba(n(), r),
5506
5508
  timeToBarIndex: (r) => {
5507
5509
  const l = n();
5508
5510
  if (l.length === 0) return null;
@@ -5616,12 +5618,12 @@ function fr(e, t) {
5616
5618
  const l = n.logicalToCoordinate(o + 1);
5617
5619
  return l == null ? i : i + r * (l - i);
5618
5620
  }
5619
- function Qa(e, t, n) {
5621
+ function Ja(e, t, n) {
5620
5622
  if (n.length === 0) return null;
5621
5623
  const o = ar(n, t);
5622
5624
  return o == null ? null : fr(e, o);
5623
5625
  }
5624
- function $a(e, t) {
5626
+ function Ba(e, t) {
5625
5627
  if (e.length === 0) return null;
5626
5628
  const n = Q(t);
5627
5629
  if (n == null) return e[0];
@@ -5635,7 +5637,7 @@ function $a(e, t) {
5635
5637
  return o;
5636
5638
  }
5637
5639
  const Io = "#1e53e5";
5638
- function Ba(e, t, n) {
5640
+ function Ia(e, t, n) {
5639
5641
  const o = { clips: /* @__PURE__ */ new Map(), grads: /* @__PURE__ */ new Map() };
5640
5642
  for (const i of t) gn(e, i, n, o);
5641
5643
  }
@@ -5674,7 +5676,7 @@ function gn(e, t, n, o) {
5674
5676
  case "hitPath":
5675
5677
  return;
5676
5678
  case "anchors":
5677
- Fa(e, t.pts, t.squares, n.anchors);
5679
+ Oa(e, t.pts, t.squares, n.anchors);
5678
5680
  return;
5679
5681
  }
5680
5682
  const i = "clip" in t && t.clip ? o.clips.get(t.clip) : void 0, r = !!i || t.t === "group" || "transform" in t && !!t.transform;
@@ -5713,17 +5715,17 @@ function gn(e, t, n, o) {
5713
5715
  break;
5714
5716
  }
5715
5717
  case "text":
5716
- Ea(e, t, n);
5718
+ za(e, t, n);
5717
5719
  break;
5718
5720
  case "image":
5719
- Wa(e, t, n);
5721
+ Ra(e, t, n);
5720
5722
  break;
5721
5723
  case "glyph":
5722
- Ra(e, t, n);
5724
+ Fa(e, t, n);
5723
5725
  break;
5724
5726
  case "group": {
5725
5727
  if (t.transform && nn(e, t.transform), t.opacity != null && t.opacity < 1) {
5726
- const l = Ia(e);
5728
+ const l = Pa(e);
5727
5729
  if (l) {
5728
5730
  for (const s of t.items) gn(l, s, n, o);
5729
5731
  e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha *= t.opacity, e.drawImage(l.canvas, 0, 0), e.restore();
@@ -5737,7 +5739,7 @@ function gn(e, t, n, o) {
5737
5739
  }
5738
5740
  r && e.restore();
5739
5741
  }
5740
- function Ia(e) {
5742
+ function Pa(e) {
5741
5743
  const t = e.canvas.width, n = e.canvas.height;
5742
5744
  if (!t || !n) return null;
5743
5745
  const o = document.createElement("canvas");
@@ -5750,13 +5752,13 @@ function jt(e, t, n, o, i) {
5750
5752
  if (r && r !== "none" && r !== "transparent" && (e.save(), s && Po(e, s), e.globalAlpha *= n.fillOpacity ?? 1, e.fillStyle = r, e.fill(t, n.fillRule === "evenodd" ? "evenodd" : "nonzero"), e.restore()), l && l !== "none" && l !== "transparent") {
5751
5753
  const a = n.strokeWidth ?? 1;
5752
5754
  if (a <= 0) return;
5753
- e.save(), s && (!r || r === "none" || r === "transparent") && Po(e, s), e.globalAlpha *= n.strokeOpacity ?? 1, e.strokeStyle = l, e.lineWidth = a, e.lineCap = n.cap ?? "butt", e.lineJoin = n.join ?? "miter", e.setLineDash(Pa(n.dash)), e.stroke(t), e.restore();
5755
+ e.save(), s && (!r || r === "none" || r === "transparent") && Po(e, s), e.globalAlpha *= n.strokeOpacity ?? 1, e.strokeStyle = l, e.lineWidth = a, e.lineCap = n.cap ?? "butt", e.lineJoin = n.join ?? "miter", e.setLineDash(Ea(n.dash)), e.stroke(t), e.restore();
5754
5756
  }
5755
5757
  }
5756
5758
  function Po(e, t) {
5757
5759
  e.shadowOffsetX = t.dx, e.shadowOffsetY = t.dy, e.shadowBlur = t.blur, e.shadowColor = t.color;
5758
5760
  }
5759
- function Pa(e) {
5761
+ function Ea(e) {
5760
5762
  if (!e || e === "none") return [];
5761
5763
  const t = e.split(/[\s,]+/).map(Number).filter((n) => Number.isFinite(n) && n >= 0);
5762
5764
  return !t.length || t.every((n) => n === 0) ? [] : t.length % 2 ? [...t, ...t] : t;
@@ -5787,17 +5789,17 @@ function nn(e, t) {
5787
5789
  }
5788
5790
  }
5789
5791
  }
5790
- function Ea(e, t, n) {
5792
+ function za(e, t, n) {
5791
5793
  const o = t.pre ? t.text : t.text.replace(/\s+/g, " ").trim();
5792
5794
  if (!o) return;
5793
5795
  e.save(), t.opacity != null && (e.globalAlpha *= t.opacity);
5794
5796
  const i = t.weight === "bold" ? 700 : t.weight ?? 400;
5795
5797
  e.font = `${t.fontStyle === "italic" ? "italic " : ""}${i} ${t.size}px ${t.family ?? n.fontFamily}`, e.textAlign = t.anchor === "middle" ? "center" : t.anchor === "end" ? "right" : "left";
5796
5798
  let r = t.y;
5797
- t.baseline === "central" ? (e.textBaseline = "alphabetic", r += za(e)) : e.textBaseline = t.baseline === "middle" ? "middle" : t.baseline === "hanging" ? "hanging" : "alphabetic", e.fillStyle = t.fill ?? "#000000", e.fillText(o, t.x, r), e.restore();
5799
+ t.baseline === "central" ? (e.textBaseline = "alphabetic", r += Wa(e)) : e.textBaseline = t.baseline === "middle" ? "middle" : t.baseline === "hanging" ? "hanging" : "alphabetic", e.fillStyle = t.fill ?? "#000000", e.fillText(o, t.x, r), e.restore();
5798
5800
  }
5799
5801
  const Eo = /* @__PURE__ */ new Map();
5800
- function za(e) {
5802
+ function Wa(e) {
5801
5803
  let t = Eo.get(e.font);
5802
5804
  if (t == null) {
5803
5805
  const n = e.measureText("H");
@@ -5813,7 +5815,7 @@ function hr(e, t) {
5813
5815
  return (o = t.onAsyncLoad) == null ? void 0 : o.call(t);
5814
5816
  }, n.src = e, zo.set(e, n)), n.complete && n.naturalWidth > 0 ? n : null;
5815
5817
  }
5816
- function Wa(e, t, n) {
5818
+ function Ra(e, t, n) {
5817
5819
  if (!t.href) return;
5818
5820
  const o = hr(t.href, n);
5819
5821
  if (o) {
@@ -5825,7 +5827,7 @@ function Wa(e, t, n) {
5825
5827
  e.restore();
5826
5828
  }
5827
5829
  }
5828
- function Ra(e, t, n) {
5830
+ function Fa(e, t, n) {
5829
5831
  const o = t.glyph.trim();
5830
5832
  if (o) {
5831
5833
  if (o.startsWith("<svg")) {
@@ -5838,7 +5840,7 @@ function Ra(e, t, n) {
5838
5840
  e.save(), e.font = `${t.size - 4}px ${n.fontFamily}`, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = t.color, e.fillText(o, t.x + t.size / 2, t.y + t.size / 2), e.restore();
5839
5841
  }
5840
5842
  }
5841
- function Fa(e, t, n, o) {
5843
+ function Oa(e, t, n, o) {
5842
5844
  const i = o.selected ? 2 : 1;
5843
5845
  t.forEach((r, l) => {
5844
5846
  const s = !!(n != null && n.includes(l));
@@ -5869,8 +5871,8 @@ function ur(e, t) {
5869
5871
  }
5870
5872
  return e;
5871
5873
  }
5872
- const Oa = () => `dw_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
5873
- class Ja {
5874
+ const Da = () => `dw_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`;
5875
+ class tf {
5874
5876
  constructor(t, n, o = {}) {
5875
5877
  H(this, "chart");
5876
5878
  H(this, "series");
@@ -5900,14 +5902,14 @@ class Ja {
5900
5902
  H(this, "savedScroll", null);
5901
5903
  H(this, "off", []);
5902
5904
  this.chart = t, this.series = n, this.opts = { magnet: "off", ...o };
5903
- const i = o.bars ?? (() => _a(n));
5904
- this.coords = Aa(t, n, i, () => [], o.timeInfo), this.primitive = new Na(this), n.attachPrimitive(this.primitive), this.el = t.chartElement(), this.listen(this.el, "pointerdown", (r) => this.onPointerDown(r), !0), this.listen(this.el, "pointermove", (r) => this.onHover(r)), this.listen(this.el, "pointerleave", () => {
5905
+ const i = o.bars ?? (() => Ha(n));
5906
+ this.coords = $a(t, n, i, () => [], o.timeInfo), this.primitive = new Ya(this), n.attachPrimitive(this.primitive), this.el = t.chartElement(), this.listen(this.el, "pointerdown", (r) => this.onPointerDown(r), !0), this.listen(this.el, "pointermove", (r) => this.onHover(r)), this.listen(this.el, "pointerleave", () => {
5905
5907
  this.hoverCursor = null, this.setHover(null);
5906
5908
  }), this.listen(this.el, "dblclick", (r) => this.onDoubleClick(r), !0), this.listen(window, "keydown", (r) => this.onKey(r)), this.listen(window, "keyup", (r) => this.onKey(r)), this.listen(window, "blur", () => {
5907
5909
  this.shift = !1, this.ctrl = !1;
5908
- }), this.off.push(Jr(() => {
5910
+ }), this.off.push(tl(() => {
5909
5911
  var r;
5910
- for (const l of this.list) l.kind === "image" && el((r = l.image) == null ? void 0 : r.name) && this.remove(l.id);
5912
+ for (const l of this.list) l.kind === "image" && nl((r = l.image) == null ? void 0 : r.name) && this.remove(l.id);
5911
5913
  this.redraw();
5912
5914
  }));
5913
5915
  }
@@ -5950,7 +5952,7 @@ class Ja {
5950
5952
  }
5951
5953
  /** Add a drawing (default style of its kind when none); returns its id. */
5952
5954
  add(t) {
5953
- const n = { id: Oa(), style: Kt(t.kind), ...t };
5955
+ const n = { id: Da(), style: Kt(t.kind), ...t };
5954
5956
  return this.list = [...this.list, n], this.emit("add", n), this.changed(), n.id;
5955
5957
  }
5956
5958
  update(t) {
@@ -5992,7 +5994,7 @@ class Ja {
5992
5994
  const r = Kt("image"), l = this.add({
5993
5995
  kind: "image",
5994
5996
  points: [i],
5995
- image: { name: t.name, ...ol(t.width, t.height, n, o) },
5997
+ image: { name: t.name, ...il(t.width, t.height, n, o) },
5996
5998
  style: { ...r, transparency: t.transparency ?? r.transparency }
5997
5999
  });
5998
6000
  return this.select([l]), l;
@@ -6003,7 +6005,7 @@ class Ja {
6003
6005
  toggleAnchored(t) {
6004
6006
  const n = this.get(t);
6005
6007
  if (!n) return !1;
6006
- const o = Ca(n, this.coords, this.paneSize());
6008
+ const o = Ta(n, this.coords, this.paneSize());
6007
6009
  return o ? (this.update(o), this.emit("gestureEnd"), !0) : !1;
6008
6010
  }
6009
6011
  /** The table UI state (active cell, editor open, hovered edge) or null. */
@@ -6012,7 +6014,7 @@ class Ja {
6012
6014
  }
6013
6015
  setTableCellText(t, n, o) {
6014
6016
  const i = this.get(t);
6015
- (i == null ? void 0 : i.kind) === "table" && this.update({ ...i, style: { ...i.style, ...Qr(i.style, n, o) } });
6017
+ (i == null ? void 0 : i.kind) === "table" && this.update({ ...i, style: { ...i.style, ...Jr(i.style, n, o) } });
6016
6018
  }
6017
6019
  /** The cell editor closed (the cell stays active). */
6018
6020
  endTableEdit() {
@@ -6026,11 +6028,11 @@ class Ja {
6026
6028
  if ((o == null ? void 0 : o.kind) !== "table") return;
6027
6029
  const i = ((r = this.tableUi) == null ? void 0 : r.id) === t ? this.tableUi.cell : null;
6028
6030
  if (n === "insert-column" || n === "insert-row")
6029
- this.update({ ...o, style: { ...o.style, ...qr(o.style, n === "insert-row" ? "row" : "column", i) } });
6031
+ this.update({ ...o, style: { ...o.style, ...Zr(o.style, n === "insert-row" ? "row" : "column", i) } });
6030
6032
  else {
6031
6033
  const s = n === "remove-row" ? "row" : "column";
6032
- if (!i || !Zr(o.style, s)) return;
6033
- const a = Kr(o.style, s, i);
6034
+ if (!i || !Kr(o.style, s)) return;
6035
+ const a = Qr(o.style, s, i);
6034
6036
  this.update({ ...o, style: { ...o.style, ...a.patch } }), this.tableUi = { id: t, cell: a.cell, editing: ((l = this.tableUi) == null ? void 0 : l.editing) ?? !1, edge: null };
6035
6037
  }
6036
6038
  this.emit("gestureEnd");
@@ -6043,7 +6045,7 @@ class Ja {
6043
6045
  * and migrated (core parseDrawings); returns how many were loaded. */
6044
6046
  importJSON(t) {
6045
6047
  const n = typeof t == "string" ? JSON.parse(t) : t;
6046
- return this.list = ea(n), this.select([]), this.changed(), this.list.length;
6048
+ return this.list = na(n), this.select([]), this.changed(), this.list.length;
6047
6049
  }
6048
6050
  /** Redraw on the next frame (the chart repaints the primitive). */
6049
6051
  redraw() {
@@ -6066,7 +6068,7 @@ class Ja {
6066
6068
  const f = ye(i, c, r);
6067
6069
  if (!f) continue;
6068
6070
  const h = this.selected.includes(c.id), u = ((s = this.hovered) == null ? void 0 : s.id) === c.id && !c.locked, x = h || u && !this.spec, d = c.kind === "table" && h && ((a = this.tableUi) == null ? void 0 : a.id) === c.id ? this.tableUi : null, p = tn(c, f, { w: t, h: n, coords: i, selected: x && !c.locked, hovered: u, textSelected: h, tableUi: d });
6069
- o.push({ scene: p, selected: h, hoveredAnchor: u ? this.hovered.anchor : -1 }), h && c.locked && o.push({ scene: ta(f, c.style.color), selected: h, hoveredAnchor: -1 });
6071
+ o.push({ scene: p, selected: h, hoveredAnchor: u ? this.hovered.anchor : -1 }), h && c.locked && o.push({ scene: ea(f, c.style.color), selected: h, hoveredAnchor: -1 });
6070
6072
  }
6071
6073
  const l = this.previewScene(t, n);
6072
6074
  return l && o.push({ scene: l, selected: !1, hoveredAnchor: -1 }), o;
@@ -6080,7 +6082,7 @@ class Ja {
6080
6082
  if (!this.shown(l)) continue;
6081
6083
  const s = ye(o, l, i);
6082
6084
  if (!s) continue;
6083
- const a = ns(l, s, o);
6085
+ const a = os(l, s, o);
6084
6086
  for (const c of a.price) {
6085
6087
  const f = o.priceToY(c.price);
6086
6088
  f != null && t.push(Wo(f, r.format(c.price), c.back, c.color));
@@ -6109,7 +6111,7 @@ class Ja {
6109
6111
  /** Chart background at a y (the anchor fill). */
6110
6112
  backgroundAt(t, n) {
6111
6113
  const o = this.chart.options().layout.background;
6112
- return o.type === "gradient" && o.topColor && o.bottomColor ? Ha(o.topColor, o.bottomColor, n > 0 ? Math.max(0, Math.min(1, t / n)) : 0) : o.color ?? "#ffffff";
6114
+ return o.type === "gradient" && o.topColor && o.bottomColor ? Na(o.topColor, o.bottomColor, n > 0 ? Math.max(0, Math.min(1, t / n)) : 0) : o.color ?? "#ffffff";
6113
6115
  }
6114
6116
  // ── internals ─────────────────────────────────────────────────────────────
6115
6117
  listen(t, n, o, i = !1) {
@@ -6177,7 +6179,7 @@ class Ja {
6177
6179
  if (!this.shown(r)) continue;
6178
6180
  const l = ye(this.coords, r, { w: n, h: o });
6179
6181
  if (!l) continue;
6180
- const s = Jl(r, l, t, n, o, this.coords, this.selected.includes(r.id));
6182
+ const s = ts(r, l, t, n, o, this.coords, this.selected.includes(r.id));
6181
6183
  if (s) return { drawing: r, mode: s, pts: l };
6182
6184
  }
6183
6185
  return null;
@@ -6229,7 +6231,7 @@ class Ja {
6229
6231
  const o = this.hitTopmost(n);
6230
6232
  this.setHover(o ? { id: o.drawing.id, anchor: o.mode.hit === "handle" ? o.mode.handleIndex : -1 } : null);
6231
6233
  const i = (o == null ? void 0 : o.drawing.kind) === "table" && o.mode.hit === "handle" ? ci(o.mode.handleIndex) : null, r = this.tableUi;
6232
- (o == null ? void 0 : o.drawing.kind) === "table" && this.selected.includes(o.drawing.id) ? ((((l = r == null ? void 0 : r.edge) == null ? void 0 : l.row) ?? -1) !== ((i == null ? void 0 : i.row) ?? -1) || (((s = r == null ? void 0 : r.edge) == null ? void 0 : s.col) ?? -1) !== ((i == null ? void 0 : i.col) ?? -1) || (r == null ? void 0 : r.id) !== o.drawing.id) && (this.tableUi = r && r.id === o.drawing.id ? { ...r, edge: i } : { id: o.drawing.id, cell: null, editing: !1, edge: i }, this.redraw()) : r != null && r.edge && (this.tableUi = { ...r, edge: null }, this.redraw()), this.hoverCursor = o ? o.drawing.locked ? "default" : i ? i.col != null && i.row != null ? "default" : i.col != null ? "ew-resize" : "ns-resize" : o.mode.hit === "handle" ? ka(o.pts[o.mode.handleIndex] ?? n, o.pts) : this.selected.includes(o.drawing.id) ? "move" : "pointer" : null;
6234
+ (o == null ? void 0 : o.drawing.kind) === "table" && this.selected.includes(o.drawing.id) ? ((((l = r == null ? void 0 : r.edge) == null ? void 0 : l.row) ?? -1) !== ((i == null ? void 0 : i.row) ?? -1) || (((s = r == null ? void 0 : r.edge) == null ? void 0 : s.col) ?? -1) !== ((i == null ? void 0 : i.col) ?? -1) || (r == null ? void 0 : r.id) !== o.drawing.id) && (this.tableUi = r && r.id === o.drawing.id ? { ...r, edge: i } : { id: o.drawing.id, cell: null, editing: !1, edge: i }, this.redraw()) : r != null && r.edge && (this.tableUi = { ...r, edge: null }, this.redraw()), this.hoverCursor = o ? o.drawing.locked ? "default" : i ? i.col != null && i.row != null ? "default" : i.col != null ? "ew-resize" : "ns-resize" : o.mode.hit === "handle" ? La(o.pts[o.mode.handleIndex] ?? n, o.pts) : this.selected.includes(o.drawing.id) ? "move" : "pointer" : null;
6233
6235
  }
6234
6236
  onPointerDown(t) {
6235
6237
  if (t.button !== 0) return;
@@ -6250,7 +6252,7 @@ class Ja {
6250
6252
  }
6251
6253
  if (this.spec) return;
6252
6254
  const n = this.hitTopmost(this.panePoint(t));
6253
- n && ((i = sn(n.drawing.kind)) != null && i.textEditable) && (t.stopPropagation(), this.emit("textEdit", n.drawing, Da(n.drawing, n.pts)));
6255
+ n && ((i = sn(n.drawing.kind)) != null && i.textEditable) && (t.stopPropagation(), this.emit("textEdit", n.drawing, _a(n.drawing, n.pts)));
6254
6256
  }
6255
6257
  placementClick(t) {
6256
6258
  const n = this.spec;
@@ -6307,7 +6309,7 @@ class Ja {
6307
6309
  let i = t;
6308
6310
  const r = (s) => {
6309
6311
  const a = this.panePoint(s);
6310
- if (this.cursor = a, Math.hypot(a.x - i.x, a.y - i.y) < ia) return;
6312
+ if (this.cursor = a, Math.hypot(a.x - i.x, a.y - i.y) < ra) return;
6311
6313
  const c = D(this.coords, a);
6312
6314
  c && (i = a, this.pending = [...this.pending, c], this.redraw());
6313
6315
  }, l = () => {
@@ -6364,7 +6366,7 @@ class Ja {
6364
6366
  const n = this.gesture;
6365
6367
  if (!n) return;
6366
6368
  if (!n.active) {
6367
- if (!n.canDrag || Math.hypot(t.x - n.startCursor.x, t.y - n.startCursor.y) < oa) return;
6369
+ if (!n.canDrag || Math.hypot(t.x - n.startCursor.x, t.y - n.startCursor.y) < ia) return;
6368
6370
  if (n.pendingToggle && n.mode.hit === "body" && !n.group) {
6369
6371
  const { id: i, ...r } = n.start;
6370
6372
  this.add(r), this.select([n.id]);
@@ -6379,7 +6381,7 @@ class Ja {
6379
6381
  }
6380
6382
  return;
6381
6383
  }
6382
- const o = wa(n, t, this.coords, this.snapFn(), this.shift);
6384
+ const o = Ma(n, t, this.coords, this.snapFn(), this.shift);
6383
6385
  o && this.update(o);
6384
6386
  }
6385
6387
  endGesture() {
@@ -6404,7 +6406,7 @@ class Ja {
6404
6406
  const l = this.coords, s = i.map((x) => J(l, x)).filter((x) => !!x);
6405
6407
  if (!s.length) return null;
6406
6408
  const a = Kt(o.kind), c = this.aimAt(r), f = s.map((x) => ({ t: "circle", cx: x.x, cy: x.y, r: 3, fill: a.color }));
6407
- if (!o.variableLength && !o.freehand && !la.has(o.kind) && s.length === i.length && s.length < o.pointCount) {
6409
+ if (!o.variableLength && !o.freehand && !sa.has(o.kind) && s.length === i.length && s.length < o.pointCount) {
6408
6410
  const x = this.dataAt(c), d = x && this.shift ? $o(o.kind, i, x, l) : null, p = d ? d.point : x;
6409
6411
  if (p) {
6410
6412
  const y = [...i, p];
@@ -6419,16 +6421,16 @@ class Ja {
6419
6421
  return s.length >= 2 && u.push({ t: "polyline", pts: s, fill: "none", stroke: a.color, strokeWidth: a.width, cap: "round" }), u.push({ t: "line", a: h, b: c, stroke: a.color, strokeWidth: a.width, cap: "round" }), [...u, ...f];
6420
6422
  }
6421
6423
  }
6422
- function Da(e, t) {
6424
+ function _a(e, t) {
6423
6425
  return (e.kind === "callout" || e.kind === "note") && t[1] ? t[1] : e.kind === "price-note" && t[1] ? { x: (t[0].x + t[1].x) / 2, y: (t[0].y + t[1].y) / 2 } : t[0];
6424
6426
  }
6425
- function _a(e) {
6427
+ function Ha(e) {
6426
6428
  return e.data().map((t) => {
6427
6429
  const n = t, o = n.value ?? n.close ?? 0;
6428
6430
  return { time: n.time, open: n.open ?? o, high: n.high ?? o, low: n.low ?? o, close: n.close ?? o, volume: n.volume };
6429
6431
  });
6430
6432
  }
6431
- function Ha(e, t, n) {
6433
+ function Na(e, t, n) {
6432
6434
  const o = /^#([0-9a-f]{6})$/i.exec(e), i = /^#([0-9a-f]{6})$/i.exec(t);
6433
6435
  if (!o || !i) return e;
6434
6436
  const r = parseInt(o[1], 16), l = parseInt(i[1], 16), s = (a) => Math.round((r >> a & 255) + ((l >> a & 255) - (r >> a & 255)) * n);
@@ -6437,7 +6439,7 @@ function Ha(e, t, n) {
6437
6439
  function Wo(e, t, n, o) {
6438
6440
  return { coordinate: () => e, text: () => t, backColor: () => n, textColor: () => o, visible: () => !0, tickVisible: () => !0 };
6439
6441
  }
6440
- class Na {
6442
+ class Ya {
6441
6443
  constructor(t) {
6442
6444
  H(this, "m");
6443
6445
  H(this, "request", null);
@@ -6481,47 +6483,47 @@ class Na {
6481
6483
  n.save(), n.beginPath(), n.rect(0, 0, i, r), n.clip();
6482
6484
  const l = this.m.fontFamily(), s = (c) => this.m.backgroundAt(c, r), a = () => this.requestUpdate();
6483
6485
  for (const c of this.m.scenes(i, r))
6484
- Ba(n, c.scene, { fontFamily: l, anchors: { fillAt: s, selected: c.selected, hovered: c.hoveredAnchor }, onAsyncLoad: a });
6486
+ Ia(n, c.scene, { fontFamily: l, anchors: { fillAt: s, selected: c.selected, hovered: c.hoveredAnchor }, onAsyncLoad: a });
6485
6487
  n.restore();
6486
6488
  });
6487
6489
  }
6488
6490
  }
6489
- const tf = "0.5.0";
6491
+ const ef = "0.5.1";
6490
6492
  export {
6491
- La as ANCHORABLE_KINDS,
6493
+ Sa as ANCHORABLE_KINDS,
6492
6494
  Mn as DEFAULT_STYLE,
6493
- Ja as DrawingManager,
6494
- Ga as IMAGE_MAX_BYTES,
6495
+ tf as DrawingManager,
6496
+ ja as IMAGE_MAX_BYTES,
6495
6497
  co as IMAGE_MAX_SIDE,
6496
- ja as IMAGE_TYPES,
6498
+ qa as IMAGE_TYPES,
6497
6499
  He as OVERLAY_SPECS,
6498
6500
  Io as TV_ANCHOR_COLOR,
6499
- tf as VERSION,
6500
- ka as anchorCursor,
6501
- wa as applyDrag,
6501
+ ef as VERSION,
6502
+ La as anchorCursor,
6503
+ Ma as applyDrag,
6502
6504
  mn as buildNewDrawing,
6503
- Za as cacheImage,
6504
- tl as decodeImage,
6505
+ Ka as cacheImage,
6506
+ el as decodeImage,
6505
6507
  Kt as defaultStyleFor,
6506
- Ba as drawScene,
6507
- ns as drawingAxisLabels,
6508
- Ua as factoryStyleFor,
6509
- Ka as fibLevelAt,
6508
+ Ia as drawScene,
6509
+ os as drawingAxisLabels,
6510
+ Xa as factoryStyleFor,
6511
+ Qa as fibLevelAt,
6510
6512
  sn as findOverlaySpec,
6511
6513
  Ao as finishPlacement,
6512
- Jl as hitTestKind,
6513
- Sa as isAnchorable,
6514
+ ts as hitTestKind,
6515
+ Ca as isAnchorable,
6514
6516
  pr as isVisibleOnInterval,
6515
- Aa as makeCoords,
6516
- na as migrateDrawing,
6517
- Jr as onImagesChanged,
6518
- ea as parseDrawings,
6519
- ta as sceneLockedAnchors,
6517
+ $a as makeCoords,
6518
+ oa as migrateDrawing,
6519
+ tl as onImagesChanged,
6520
+ na as parseDrawings,
6521
+ ea as sceneLockedAnchors,
6520
6522
  tn as sceneOf,
6521
- Xa as setDefaultStyleOverride,
6522
- qa as setImageReader,
6523
- Qa as timeToXFallback,
6524
- Ca as toggleAnchored,
6523
+ Ga as setDefaultStyleOverride,
6524
+ Za as setImageReader,
6525
+ Ja as timeToXFallback,
6526
+ Ta as toggleAnchored,
6525
6527
  Mr as volumeProfileDefaults,
6526
6528
  Bn as volumeProfileStyle
6527
6529
  };