@invinite-org/chartlang-host-worker 1.2.0 → 1.3.0

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.
@@ -94,6 +94,29 @@ var Float64RingBuffer = class {
94
94
  this.head = -1;
95
95
  this.filled = 0;
96
96
  }
97
+ /**
98
+ * Overwrite this ring's entire state with a copy of `other`'s. A single
99
+ * `Float64Array.prototype.set()` memcpy plus a head/filled copy — `O(capacity)`
100
+ * with a small constant, not an element loop. `state.array`'s two-ring tick
101
+ * discipline (`packages/runtime/src/state/arrayStateSlot.ts`) calls this every
102
+ * tick to roll the tentative ring back to committed (and on close to commit it),
103
+ * so the typed-array `set()` is load-bearing for the hot path. Both rings in a
104
+ * slot share `capacity`, so this never reshapes the backing array.
105
+ *
106
+ * @since 1.3
107
+ * @stable
108
+ * @example
109
+ * const a = new Float64RingBuffer(4);
110
+ * const b = new Float64RingBuffer(4);
111
+ * a.append(1);
112
+ * b.copyFrom(a);
113
+ * b.at(0); // 1
114
+ */
115
+ copyFrom(other) {
116
+ this.buf.set(other.buf);
117
+ this.head = other.head;
118
+ this.filled = other.filled;
119
+ }
97
120
  };
98
121
 
99
122
  // ../runtime/dist/seriesView.js
@@ -313,6 +336,20 @@ var input = Object.freeze({
313
336
  interval(defaultValue, opts) {
314
337
  return Object.freeze({ kind: "interval", defaultValue, ...opts });
315
338
  },
339
+ /**
340
+ * Build a session-window input descriptor (`"HH:MM-HH:MM"`). The value is
341
+ * a free string in v1 (the grammar is parsed at runtime by
342
+ * `session.isOpen`), mirroring `input.string`.
343
+ *
344
+ * @since 1.5
345
+ * @stable
346
+ * @example
347
+ * const sess = input.session("0930-1600", { title: "Session" });
348
+ * void sess;
349
+ */
350
+ session(defaultValue, opts) {
351
+ return Object.freeze({ kind: "session", defaultValue, ...opts });
352
+ },
316
353
  /**
317
354
  * Build an adapter-supplied external series input descriptor.
318
355
  *
@@ -406,6 +443,26 @@ var state = Object.freeze({
406
443
  series(_init) {
407
444
  return sentinel("state.series");
408
445
  },
446
+ /**
447
+ * Allocate or read a persistent **bounded collection** slot — a
448
+ * fixed-capacity FIFO ring you push values into across bars. `a.push(v)`
449
+ * appends (evicting the oldest once full); `a.get(n)` reads the `n`-th
450
+ * element from the newest; `a.last()` is the newest; `a.size` is the
451
+ * filled count; `a.capacity` is the bound; `a.clear()` empties it.
452
+ * `capacity` must be a compile-time numeric literal (the slot is bounded
453
+ * so it serializes). Unlike {@link state}.series (one value's bar-indexed
454
+ * history), this is a collection of many pushed values. v1 supports
455
+ * `number` element type.
456
+ *
457
+ * @since 1.3
458
+ * @stable
459
+ * @example
460
+ * const fn: typeof state.array = state.array;
461
+ * void fn;
462
+ */
463
+ array(_capacity) {
464
+ return sentinel("state.array");
465
+ },
409
466
  /**
410
467
  * Tick-persistent state slots, Pine `varip` semantics. Writes commit
411
468
  * immediately, even during a tick.
@@ -432,6 +489,154 @@ var state = Object.freeze({
432
489
  })
433
490
  });
434
491
 
492
+ // ../core/dist/time-accessors/sessionAccessors.js
493
+ var sentinel2 = (name) => {
494
+ throw new Error(`${name} called outside an active script step`);
495
+ };
496
+ var session = Object.freeze({
497
+ /**
498
+ * `true` when `t` falls inside the daily session window `spec`. `spec` is
499
+ * an `"HH:MM-HH:MM"` (or `"HHMM-HHMM"`) intraday window, e.g.
500
+ * `"0930-1600"`. The window is interpreted in `tz` (default
501
+ * `syminfo.timezone`, fallback `"UTC"`).
502
+ *
503
+ * v1 resolves UTC and fixed-offset zones only; a DST zone resolves to UTC
504
+ * plus a one-time diagnostic (see the determinism note in the docs).
505
+ *
506
+ * @since 1.5
507
+ * @stable
508
+ * @example
509
+ * const fn: typeof session.isOpen = session.isOpen;
510
+ * void fn;
511
+ */
512
+ isOpen(_t, _spec, _tz) {
513
+ return sentinel2("session.isOpen");
514
+ }
515
+ });
516
+
517
+ // ../core/dist/time-accessors/timeAccessors.js
518
+ var sentinel3 = (name) => {
519
+ throw new Error(`${name} called outside an active script step`);
520
+ };
521
+ var time = Object.freeze({
522
+ /**
523
+ * Calendar year of `t` (e.g. `2024`).
524
+ *
525
+ * @since 1.5
526
+ * @stable
527
+ * @example
528
+ * const fn: typeof time.year = time.year;
529
+ * void fn;
530
+ */
531
+ year(_t, _tz) {
532
+ return sentinel3("time.year");
533
+ },
534
+ /**
535
+ * Calendar month of `t`, `1..12`.
536
+ *
537
+ * @since 1.5
538
+ * @stable
539
+ * @example
540
+ * const fn: typeof time.month = time.month;
541
+ * void fn;
542
+ */
543
+ month(_t, _tz) {
544
+ return sentinel3("time.month");
545
+ },
546
+ /**
547
+ * Day of the month of `t`, `1..31`.
548
+ *
549
+ * @since 1.5
550
+ * @stable
551
+ * @example
552
+ * const fn: typeof time.dayofmonth = time.dayofmonth;
553
+ * void fn;
554
+ */
555
+ dayofmonth(_t, _tz) {
556
+ return sentinel3("time.dayofmonth");
557
+ },
558
+ /**
559
+ * Day of the week of `t`, following Pine's convention `1=Sunday .. 7=Saturday`
560
+ * (note: NOT the ISO `1=Monday` convention).
561
+ *
562
+ * @since 1.5
563
+ * @stable
564
+ * @example
565
+ * const fn: typeof time.dayofweek = time.dayofweek;
566
+ * void fn;
567
+ */
568
+ dayofweek(_t, _tz) {
569
+ return sentinel3("time.dayofweek");
570
+ },
571
+ /**
572
+ * Hour-of-day of `t`, `0..23`.
573
+ *
574
+ * @since 1.5
575
+ * @stable
576
+ * @example
577
+ * const fn: typeof time.hour = time.hour;
578
+ * void fn;
579
+ */
580
+ hour(_t, _tz) {
581
+ return sentinel3("time.hour");
582
+ },
583
+ /**
584
+ * Minute-of-hour of `t`, `0..59`.
585
+ *
586
+ * @since 1.5
587
+ * @stable
588
+ * @example
589
+ * const fn: typeof time.minute = time.minute;
590
+ * void fn;
591
+ */
592
+ minute(_t, _tz) {
593
+ return sentinel3("time.minute");
594
+ },
595
+ /**
596
+ * Second-of-minute of `t`, `0..59`.
597
+ *
598
+ * @since 1.5
599
+ * @stable
600
+ * @example
601
+ * const fn: typeof time.second = time.second;
602
+ * void fn;
603
+ */
604
+ second(_t, _tz) {
605
+ return sentinel3("time.second");
606
+ },
607
+ /**
608
+ * Build a `Time` (UTC ms epoch) from calendar fields. `month` is `1..12`
609
+ * and `day` is `1..31`; `hour`/`minute`/`second` default to `0`. The
610
+ * fields are interpreted in `tz` (default `syminfo.timezone`, fallback
611
+ * `"UTC"`).
612
+ *
613
+ * @since 1.5
614
+ * @stable
615
+ * @example
616
+ * const fn: typeof time.timestamp = time.timestamp;
617
+ * void fn;
618
+ */
619
+ timestamp(_year, _month, _day, _hour, _minute, _second, _tz) {
620
+ return sentinel3("time.timestamp");
621
+ },
622
+ /**
623
+ * Close timestamp of the bar that starts at `t` — Pine's no-arg
624
+ * `time_close()`. Equals `t + interval`, where the interval is the active
625
+ * bar's `timeframe.inSeconds` the runtime reads internally (so this mirrors
626
+ * Pine's "current bar's interval" without an explicit interval argument).
627
+ * `tz` is accepted for surface symmetry with the other `time.*` accessors.
628
+ *
629
+ * @since 1.5
630
+ * @stable
631
+ * @example
632
+ * const fn: typeof time.timeClose = time.timeClose;
633
+ * void fn;
634
+ */
635
+ timeClose(_t, _tz) {
636
+ return sentinel3("time.timeClose");
637
+ }
638
+ });
639
+
435
640
  // ../core/dist/views/barstate.js
436
641
  var barstate = Object.freeze({
437
642
  isfirst: false,
@@ -466,17 +671,22 @@ var timeframe = Object.freeze({
466
671
  });
467
672
 
468
673
  // ../core/dist/request/request.js
469
- var sentinel2 = (name) => {
674
+ var sentinel4 = (name) => {
470
675
  throw new Error(`${name} called outside an active script step`);
471
676
  };
472
677
  function security(_opts, _expr) {
473
- return sentinel2("request.security");
678
+ return sentinel4("request.security");
474
679
  }
475
680
  function lowerTf(_opts) {
476
- return sentinel2("request.lowerTf");
681
+ return sentinel4("request.lowerTf");
477
682
  }
478
683
  var request = Object.freeze({ security, lowerTf });
479
684
 
685
+ // ../core/dist/request/feedKey.js
686
+ function feedKey(symbol, interval) {
687
+ return symbol === void 0 || symbol === "" ? interval : `${symbol}@${interval}`;
688
+ }
689
+
480
690
  // ../core/dist/runtime/runtime.js
481
691
  function _logInfo(_message, _meta) {
482
692
  throw new Error("runtime.log.info called outside compiled runtime");
@@ -816,6 +1026,11 @@ var STATEFUL_PRIMITIVE_ENTRIES = [
816
1026
  { name: "ta.nz", slot: false },
817
1027
  { name: "plot", slot: true },
818
1028
  { name: "hline", slot: true },
1029
+ // Pine-ergonomic aliases lowering to the `bg-color` / `bar-color` plot
1030
+ // styles. Slot-injected like `plot`/`hline` so each callsite gets a
1031
+ // stable slot id and is listed in `manifest.plots` with its kind.
1032
+ { name: "bgcolor", slot: true },
1033
+ { name: "barcolor", slot: true },
819
1034
  { name: "alert", slot: true },
820
1035
  // Phase 3 — draw.* namespace. One entry per kind in DRAWING_KINDS
821
1036
  // order. Names are camelCase (`draw.<kindCamelCase>`); the wire
@@ -892,12 +1107,27 @@ var STATEFUL_PRIMITIVE_ENTRIES = [
892
1107
  { name: "state.tick.int", slot: true },
893
1108
  { name: "state.tick.bool", slot: true },
894
1109
  { name: "state.tick.string", slot: true },
1110
+ { name: "state.array", slot: true },
895
1111
  // Both the data form `request.security({ interval })` and the expression
896
1112
  // form `request.security({ interval }, (bar) => …)` route through this one
897
1113
  // entry: `slot: true` injects the slot id as the first argument regardless
898
1114
  // of the optional second (callback) argument.
899
1115
  { name: "request.security", slot: true },
900
1116
  { name: "request.lowerTf", slot: true },
1117
+ // Calendar / session accessors — stateless (slot: false). Like `ta.nz`,
1118
+ // they ride the registry for the `stateful-call-inside-loop` diagnostic
1119
+ // (Pine-parity) but take NO injected slot id: the runtime function
1120
+ // receives the author's arguments directly.
1121
+ { name: "time.year", slot: false },
1122
+ { name: "time.month", slot: false },
1123
+ { name: "time.dayofmonth", slot: false },
1124
+ { name: "time.dayofweek", slot: false },
1125
+ { name: "time.hour", slot: false },
1126
+ { name: "time.minute", slot: false },
1127
+ { name: "time.second", slot: false },
1128
+ { name: "time.timestamp", slot: false },
1129
+ { name: "time.timeClose", slot: false },
1130
+ { name: "session.isOpen", slot: false },
901
1131
  { name: "defineAlertCondition.signal", slot: false },
902
1132
  { name: "runtime.log", slot: false },
903
1133
  { name: "runtime.error", slot: false }
@@ -1137,13 +1367,13 @@ function intervalSpacingMs(interval) {
1137
1367
  return Number.NaN;
1138
1368
  }
1139
1369
  }
1140
- function medianSpacingMs(time) {
1141
- const pairs = Math.min(time.length - 1, 100);
1370
+ function medianSpacingMs(time2) {
1371
+ const pairs = Math.min(time2.length - 1, 100);
1142
1372
  if (pairs < 1)
1143
1373
  return Number.NaN;
1144
1374
  const deltas = [];
1145
1375
  for (let i = 0; i < pairs; i += 1) {
1146
- const delta = time.at(i) - time.at(i + 1);
1376
+ const delta = time2.at(i) - time2.at(i + 1);
1147
1377
  if (Number.isFinite(delta))
1148
1378
  deltas.push(delta);
1149
1379
  }
@@ -1153,14 +1383,14 @@ function medianSpacingMs(time) {
1153
1383
  const mid = deltas.length >> 1;
1154
1384
  return deltas.length % 2 === 1 ? deltas[mid] : (deltas[mid - 1] + deltas[mid]) / 2;
1155
1385
  }
1156
- function resolveBarPoint(time, interval, currentTime, offset, price) {
1386
+ function resolveBarPoint(time2, interval, currentTime, offset, price) {
1157
1387
  const p = Number(price);
1158
1388
  if (offset === 0)
1159
1389
  return { time: currentTime, price: p };
1160
1390
  if (offset < 0)
1161
- return { time: time.at(-offset), price: p };
1391
+ return { time: time2.at(-offset), price: p };
1162
1392
  const spacing = (() => {
1163
- const median2 = medianSpacingMs(time);
1393
+ const median2 = medianSpacingMs(time2);
1164
1394
  return Number.isFinite(median2) ? median2 : intervalSpacingMs(interval);
1165
1395
  })();
1166
1396
  return { time: currentTime + offset * spacing, price: p };
@@ -1384,6 +1614,142 @@ function inMemoryStateStore() {
1384
1614
  };
1385
1615
  }
1386
1616
 
1617
+ // ../runtime/dist/bufferSnapshot.js
1618
+ function isRecord(value) {
1619
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1620
+ }
1621
+ function isInteger(value) {
1622
+ return typeof value === "number" && Number.isInteger(value);
1623
+ }
1624
+ function finiteOrNull(value) {
1625
+ return Number.isFinite(value) ? value : null;
1626
+ }
1627
+ function restoreNumber(value) {
1628
+ if (value === null)
1629
+ return Number.NaN;
1630
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
1631
+ }
1632
+ function isBufferSnapshot(value) {
1633
+ if (!isRecord(value))
1634
+ return false;
1635
+ if (!isInteger(value.headIndex) || !isInteger(value.filled))
1636
+ return false;
1637
+ return Array.isArray(value.values) && value.values.every((entry) => entry === null || typeof entry === "number" && Number.isFinite(entry));
1638
+ }
1639
+ function serialiseBuffer(buffer) {
1640
+ const snapshot6 = buffer.serialiseSnapshotBuffer();
1641
+ return {
1642
+ headIndex: snapshot6.headIndex,
1643
+ filled: snapshot6.filled,
1644
+ values: snapshot6.values
1645
+ };
1646
+ }
1647
+ function restoreBuffer(snapshot6, capacity) {
1648
+ const buffer = new Float64RingBuffer(capacity);
1649
+ try {
1650
+ buffer.restoreFromSnapshotBuffer(snapshot6);
1651
+ return buffer;
1652
+ } catch {
1653
+ return null;
1654
+ }
1655
+ }
1656
+
1657
+ // ../runtime/dist/state/arrayStateSlot.js
1658
+ var ArrayStateSlot = class {
1659
+ capacity;
1660
+ committedRing;
1661
+ tentativeRing;
1662
+ handle;
1663
+ constructor(capacity) {
1664
+ this.capacity = capacity;
1665
+ this.committedRing = new Float64RingBuffer(capacity);
1666
+ this.tentativeRing = new Float64RingBuffer(capacity);
1667
+ this.handle = buildArrayHandle(this);
1668
+ }
1669
+ /** Commit the tentative ring into the committed ring (bar close). */
1670
+ onBarClose() {
1671
+ this.committedRing.copyFrom(this.tentativeRing);
1672
+ }
1673
+ /** Roll the tentative ring back to the committed ring (head-replacing tick). */
1674
+ onBarTick() {
1675
+ this.tentativeRing.copyFrom(this.committedRing);
1676
+ }
1677
+ };
1678
+ function buildArrayHandle(slot) {
1679
+ return {
1680
+ push(value) {
1681
+ slot.tentativeRing.append(value);
1682
+ },
1683
+ get(n) {
1684
+ return slot.tentativeRing.at(n);
1685
+ },
1686
+ last() {
1687
+ return slot.tentativeRing.at(0);
1688
+ },
1689
+ clear() {
1690
+ slot.tentativeRing.reset();
1691
+ },
1692
+ get size() {
1693
+ return slot.tentativeRing.length;
1694
+ },
1695
+ get capacity() {
1696
+ return slot.capacity;
1697
+ }
1698
+ };
1699
+ }
1700
+ function createArrayStateSlot(capacity) {
1701
+ return new ArrayStateSlot(capacity);
1702
+ }
1703
+ function restoreArrayStateSlot(committedRing, tentativeRing) {
1704
+ const slot = new ArrayStateSlot(committedRing.capacity);
1705
+ slot.committedRing.copyFrom(committedRing);
1706
+ slot.tentativeRing.copyFrom(tentativeRing);
1707
+ return slot;
1708
+ }
1709
+
1710
+ // ../runtime/dist/state/arrayPersistence.js
1711
+ var ARRAY_SLOT_SUFFIX = ":array";
1712
+ function isArraySlotSnapshotKey(key) {
1713
+ return key.endsWith(ARRAY_SLOT_SUFFIX);
1714
+ }
1715
+ function serialiseArraySlots(ctx) {
1716
+ const out = {};
1717
+ for (const [key, slot] of ctx.arraySlots.entries()) {
1718
+ out[key] = {
1719
+ kind: "state.array",
1720
+ capacity: slot.capacity,
1721
+ committed: serialiseBuffer(slot.committedRing),
1722
+ tentative: serialiseBuffer(slot.tentativeRing)
1723
+ };
1724
+ }
1725
+ return Object.freeze(out);
1726
+ }
1727
+ function restoreArraySlotSnapshot(snapshot6) {
1728
+ if (!isRecord(snapshot6) || snapshot6.kind !== "state.array")
1729
+ return null;
1730
+ if (!isInteger(snapshot6.capacity) || snapshot6.capacity <= 0)
1731
+ return null;
1732
+ const { committed, tentative } = snapshot6;
1733
+ if (!isBufferSnapshot(committed) || !isBufferSnapshot(tentative))
1734
+ return null;
1735
+ const committedRing = restoreBuffer(committed, snapshot6.capacity);
1736
+ const tentativeRing = restoreBuffer(tentative, snapshot6.capacity);
1737
+ if (committedRing === null || tentativeRing === null)
1738
+ return null;
1739
+ return restoreArrayStateSlot(committedRing, tentativeRing);
1740
+ }
1741
+ function restoreArraySlots(ctx, slots) {
1742
+ ctx.arraySlots.clear();
1743
+ for (const [key, value] of Object.entries(slots)) {
1744
+ if (!isArraySlotSnapshotKey(key))
1745
+ continue;
1746
+ const slot = restoreArraySlotSnapshot(value);
1747
+ if (slot !== null) {
1748
+ ctx.arraySlots.set(key, slot);
1749
+ }
1750
+ }
1751
+ }
1752
+
1387
1753
  // ../runtime/dist/state/seriesSlot.js
1388
1754
  function makeSeriesSlotView(buffer) {
1389
1755
  const reads = makeSeriesView(buffer);
@@ -1484,44 +1850,14 @@ function resetSeriesHeads(ctx) {
1484
1850
  resetSeriesSlotHead(slot);
1485
1851
  }
1486
1852
  }
1487
-
1488
- // ../runtime/dist/bufferSnapshot.js
1489
- function isRecord(value) {
1490
- return typeof value === "object" && value !== null && !Array.isArray(value);
1491
- }
1492
- function isInteger(value) {
1493
- return typeof value === "number" && Number.isInteger(value);
1494
- }
1495
- function finiteOrNull(value) {
1496
- return Number.isFinite(value) ? value : null;
1497
- }
1498
- function restoreNumber(value) {
1499
- if (value === null)
1500
- return Number.NaN;
1501
- return typeof value === "number" && Number.isFinite(value) ? value : null;
1502
- }
1503
- function isBufferSnapshot(value) {
1504
- if (!isRecord(value))
1505
- return false;
1506
- if (!isInteger(value.headIndex) || !isInteger(value.filled))
1507
- return false;
1508
- return Array.isArray(value.values) && value.values.every((entry) => entry === null || typeof entry === "number" && Number.isFinite(entry));
1509
- }
1510
- function serialiseBuffer(buffer) {
1511
- const snapshot6 = buffer.serialiseSnapshotBuffer();
1512
- return {
1513
- headIndex: snapshot6.headIndex,
1514
- filled: snapshot6.filled,
1515
- values: snapshot6.values
1516
- };
1853
+ function resetTentativeArraySlots(ctx) {
1854
+ for (const slot of ctx.arraySlots.values()) {
1855
+ slot.onBarTick();
1856
+ }
1517
1857
  }
1518
- function restoreBuffer(snapshot6, capacity) {
1519
- const buffer = new Float64RingBuffer(capacity);
1520
- try {
1521
- buffer.restoreFromSnapshotBuffer(snapshot6);
1522
- return buffer;
1523
- } catch {
1524
- return null;
1858
+ function commitArraySlots(ctx) {
1859
+ for (const slot of ctx.arraySlots.values()) {
1860
+ slot.onBarClose();
1525
1861
  }
1526
1862
  }
1527
1863
 
@@ -1622,6 +1958,7 @@ function asMutableSlot(slot) {
1622
1958
  // ../runtime/dist/state/stateNamespace.js
1623
1959
  var stateKey = (ctx, slotId) => `${ctx.slotIdPrefix ?? ""}${slotId}:state`;
1624
1960
  var seriesKey = (ctx, slotId) => `${ctx.slotIdPrefix ?? ""}${slotId}:series`;
1961
+ var arrayKey = (ctx, slotId) => `${ctx.slotIdPrefix ?? ""}${slotId}:array`;
1625
1962
  function getCtx(name) {
1626
1963
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
1627
1964
  if (ctx === null) {
@@ -1655,6 +1992,17 @@ function getOrAllocateSeries(slotId, init) {
1655
1992
  ctx.seriesSlots.set(key, slot);
1656
1993
  return slot.view;
1657
1994
  }
1995
+ function getOrAllocateArray(slotId, capacity) {
1996
+ const ctx = getCtx("state.array");
1997
+ const key = arrayKey(ctx, slotId);
1998
+ const existing = ctx.arraySlots.get(key);
1999
+ if (existing !== void 0) {
2000
+ return existing.handle;
2001
+ }
2002
+ const slot = createArrayStateSlot(capacity);
2003
+ ctx.arraySlots.set(key, slot);
2004
+ return slot.handle;
2005
+ }
1658
2006
  function buildStateNamespace() {
1659
2007
  const ns = {
1660
2008
  float: (slotId, init) => getOrAllocate("state.float", slotId, init, false),
@@ -1662,6 +2010,7 @@ function buildStateNamespace() {
1662
2010
  bool: (slotId, init) => getOrAllocate("state.bool", slotId, init, false),
1663
2011
  string: (slotId, init) => getOrAllocate("state.string", slotId, init, false),
1664
2012
  series: (slotId, init) => getOrAllocateSeries(slotId, init),
2013
+ array: (slotId, capacity) => getOrAllocateArray(slotId, capacity),
1665
2014
  tick: {
1666
2015
  float: (slotId, init) => getOrAllocate("state.tick.float", slotId, init, true),
1667
2016
  int: (slotId, init) => getOrAllocate("state.tick.int", slotId, init, true),
@@ -1722,6 +2071,7 @@ function matchesDescriptor(descriptor, value) {
1722
2071
  case "color":
1723
2072
  case "symbol":
1724
2073
  case "interval":
2074
+ case "session":
1725
2075
  return typeof value === "string";
1726
2076
  case "enum":
1727
2077
  return typeof value === "string" && descriptor.options.includes(value);
@@ -2047,7 +2397,7 @@ function createRuntimeViews(opts = {}) {
2047
2397
  }
2048
2398
 
2049
2399
  // ../runtime/dist/request/securityExprRunner.js
2050
- function makeFoldBar(foldStream, interval) {
2400
+ function makeFoldBar(foldStream, symbol, interval) {
2051
2401
  const { seriesViews } = foldStream;
2052
2402
  return Object.freeze({
2053
2403
  time: seriesViews.time,
@@ -2060,7 +2410,7 @@ function makeFoldBar(foldStream, interval) {
2060
2410
  hlc3: seriesViews.hlc3,
2061
2411
  ohlc4: seriesViews.ohlc4,
2062
2412
  hlcc4: seriesViews.hlcc4,
2063
- symbol: makeConstantStringSeries(""),
2413
+ symbol: makeConstantStringSeries(symbol),
2064
2414
  interval: makeConstantStringSeries(interval)
2065
2415
  });
2066
2416
  }
@@ -2090,12 +2440,15 @@ function buildExprContext(parent, slotId, foldStream) {
2090
2440
  scriptMaxDrawings: null,
2091
2441
  stateSlots: /* @__PURE__ */ new Map(),
2092
2442
  seriesSlots: /* @__PURE__ */ new Map(),
2443
+ arraySlots: /* @__PURE__ */ new Map(),
2444
+ chartSymbol: parent.chartSymbol,
2093
2445
  secondaryStreams: parent.secondaryStreams,
2094
2446
  requestSecurityBars: /* @__PURE__ */ new Map(),
2095
2447
  requestSecurityAlignments: /* @__PURE__ */ new Map(),
2096
2448
  requestSecurityAscendingBars: /* @__PURE__ */ new Map(),
2097
2449
  requestLowerTfViews: /* @__PURE__ */ new Map(),
2098
2450
  diagnosedRequestKeys: /* @__PURE__ */ new Set(),
2451
+ diagnosedTzKeys: /* @__PURE__ */ new Set(),
2099
2452
  logBudget: 0,
2100
2453
  logBudgetExceededDiagnosed: false,
2101
2454
  resolvedInputs: parent.resolvedInputs,
@@ -2108,13 +2461,13 @@ function buildExprContext(parent, slotId, foldStream) {
2108
2461
  };
2109
2462
  }
2110
2463
  function createSecurityExprRunner(args) {
2111
- const { slotId, interval, capacity, parent } = args;
2112
- const foldStream = createStreamState({ interval, capacity, symbol: "" });
2464
+ const { slotId, symbol, interval, capacity, parent } = args;
2465
+ const foldStream = createStreamState({ interval, capacity, symbol });
2113
2466
  return {
2114
2467
  slotId,
2115
2468
  interval,
2116
2469
  foldStream,
2117
- foldBar: makeFoldBar(foldStream, interval),
2470
+ foldBar: makeFoldBar(foldStream, symbol, interval),
2118
2471
  ctx: buildExprContext(parent, slotId, foldStream),
2119
2472
  output: new Float64RingBuffer(capacity),
2120
2473
  processedHtfCount: 0
@@ -2122,23 +2475,26 @@ function createSecurityExprRunner(args) {
2122
2475
  }
2123
2476
  function buildSecurityExprRunners(manifest, parent, capacity) {
2124
2477
  const bySlot = /* @__PURE__ */ new Map();
2125
- const byInterval = /* @__PURE__ */ new Map();
2478
+ const byFeed = /* @__PURE__ */ new Map();
2126
2479
  for (const descriptor of manifest.securityExpressions ?? []) {
2480
+ const resolved = descriptor.symbol === void 0 || descriptor.symbol === parent.chartSymbol ? void 0 : descriptor.symbol;
2481
+ const key = feedKey(resolved, descriptor.interval);
2127
2482
  const runner = createSecurityExprRunner({
2128
2483
  slotId: descriptor.slotId,
2484
+ symbol: descriptor.symbol ?? parent.chartSymbol,
2129
2485
  interval: descriptor.interval,
2130
2486
  capacity,
2131
2487
  parent
2132
2488
  });
2133
2489
  bySlot.set(descriptor.slotId, runner);
2134
- const list = byInterval.get(descriptor.interval);
2490
+ const list = byFeed.get(key);
2135
2491
  if (list === void 0) {
2136
- byInterval.set(descriptor.interval, [runner]);
2492
+ byFeed.set(key, [runner]);
2137
2493
  } else {
2138
2494
  list.push(runner);
2139
2495
  }
2140
2496
  }
2141
- return { bySlot, byInterval };
2497
+ return { bySlot, byFeed };
2142
2498
  }
2143
2499
  function sampleOutput(result) {
2144
2500
  return typeof result === "number" ? result : result.current;
@@ -2173,8 +2529,8 @@ function foldTick(runner, bar) {
2173
2529
  replaceStreamHead(runner.foldStream, bar);
2174
2530
  runner.output.replaceHead(evaluate(runner, runner.callback, true));
2175
2531
  }
2176
- function driveSecurityExpressions(parent, interval, mode, bar) {
2177
- const runners = parent.securityExprRunnersByInterval?.get(interval);
2532
+ function driveSecurityExpressions(parent, streamKey, mode, bar) {
2533
+ const runners = parent.securityExprRunnersByFeed?.get(streamKey);
2178
2534
  if (runners === void 0)
2179
2535
  return;
2180
2536
  for (const runner of runners) {
@@ -2244,11 +2600,11 @@ function seriesAscending(stream, sourceKey) {
2244
2600
  }
2245
2601
  return values;
2246
2602
  }
2247
- function alignmentKey(slotId, interval, sourceKey) {
2248
- return `${slotId}|${interval}|${sourceKey}`;
2603
+ function alignmentKey(slotId, feed, sourceKey) {
2604
+ return `${slotId}|${feed}|${sourceKey}`;
2249
2605
  }
2250
- function alignedSeries(ctx, slotId, interval, sourceKey, secondary) {
2251
- const key = alignmentKey(slotId, interval, sourceKey);
2606
+ function alignedSeries(ctx, slotId, feed, sourceKey, secondary) {
2607
+ const key = alignmentKey(slotId, feed, sourceKey);
2252
2608
  const existing = ctx.requestSecurityAlignments.get(key);
2253
2609
  if (existing !== void 0)
2254
2610
  return existing;
@@ -2283,13 +2639,13 @@ function makeAlignedSeriesProxy(ctx, produce) {
2283
2639
  }
2284
2640
  });
2285
2641
  }
2286
- function makeAlignedNumberSeries(ctx, slotId, interval, sourceKey, secondary) {
2287
- return makeAlignedSeriesProxy(ctx, () => alignedSeries(ctx, slotId, interval, sourceKey, secondary));
2642
+ function makeAlignedNumberSeries(ctx, slotId, feed, sourceKey, secondary) {
2643
+ return makeAlignedSeriesProxy(ctx, () => alignedSeries(ctx, slotId, feed, sourceKey, secondary));
2288
2644
  }
2289
- function makeLiveSecurityBar(ctx, slotId, interval, secondary) {
2645
+ function makeLiveSecurityBar(ctx, slotId, feed, interval, secondary) {
2290
2646
  const numeric = /* @__PURE__ */ new Map();
2291
2647
  for (const key of NUMERIC_SOURCE_KEYS) {
2292
- numeric.set(key, makeAlignedNumberSeries(ctx, slotId, interval, key, secondary));
2648
+ numeric.set(key, makeAlignedNumberSeries(ctx, slotId, feed, key, secondary));
2293
2649
  }
2294
2650
  return Object.freeze({
2295
2651
  time: numeric.get("time") ?? makeSeries(Number.NaN),
@@ -2306,57 +2662,68 @@ function makeLiveSecurityBar(ctx, slotId, interval, secondary) {
2306
2662
  interval: makeConstantStringSeries(interval)
2307
2663
  });
2308
2664
  }
2309
- function fallbackNaN(ctx, cacheKey, slotId, interval, code, message) {
2310
- pushOnce(ctx, code, slotId, interval, "security", message);
2665
+ var MULTI_SYMBOL_MSG = "Adapter declares multiSymbol: false; request.security for a different symbol returns NaN";
2666
+ function fallbackNaN(ctx, cacheKey, slotId, feed, code, message) {
2667
+ pushOnce(ctx, code, slotId, feed, "security", message);
2311
2668
  const bar = makeNanSecurityBar();
2312
2669
  ctx.requestSecurityBars.set(cacheKey, bar);
2313
2670
  return bar;
2314
2671
  }
2315
- function makeSecurityBar(ctx, slotId, interval) {
2316
- const cacheKey = `${slotId}|${interval}`;
2672
+ function makeSecurityBar(ctx, slotId, symbol, interval) {
2673
+ const feed = feedKey(symbol, interval);
2674
+ const cacheKey = `${slotId}|${feed}`;
2317
2675
  const existing = ctx.requestSecurityBars.get(cacheKey);
2318
2676
  if (existing !== void 0)
2319
2677
  return existing;
2678
+ if (symbol !== void 0 && !ctx.capabilities.multiSymbol) {
2679
+ return fallbackNaN(ctx, cacheKey, slotId, feed, "multi-symbol-not-supported", MULTI_SYMBOL_MSG);
2680
+ }
2320
2681
  if (!ctx.capabilities.multiTimeframe) {
2321
- return fallbackNaN(ctx, cacheKey, slotId, interval, "multi-timeframe-not-supported", "Adapter declares multiTimeframe: false; request.security returns NaN");
2682
+ return fallbackNaN(ctx, cacheKey, slotId, feed, "multi-timeframe-not-supported", "Adapter declares multiTimeframe: false; request.security returns NaN");
2322
2683
  }
2323
2684
  const known = ctx.capabilities.intervals.some((descriptor) => descriptor.value === interval);
2324
2685
  if (!known) {
2325
- return fallbackNaN(ctx, cacheKey, slotId, interval, "unsupported-interval", `Requested interval "${interval}" is not in Capabilities.intervals`);
2686
+ return fallbackNaN(ctx, cacheKey, slotId, feed, "unsupported-interval", `Requested interval "${interval}" is not in Capabilities.intervals`);
2326
2687
  }
2327
- const secondary = ctx.secondaryStreams.get(interval);
2688
+ const secondary = ctx.secondaryStreams.get(feed);
2328
2689
  if (secondary === void 0) {
2329
- return fallbackNaN(ctx, cacheKey, slotId, interval, "unknown-secondary-stream", `Requested interval "${interval}" has no registered secondary stream`);
2690
+ return fallbackNaN(ctx, cacheKey, slotId, feed, "unknown-secondary-stream", `Requested interval "${interval}" has no registered secondary stream`);
2330
2691
  }
2331
- const bar = makeLiveSecurityBar(ctx, slotId, interval, secondary);
2692
+ const bar = makeLiveSecurityBar(ctx, slotId, feed, interval, secondary);
2332
2693
  ctx.requestSecurityBars.set(cacheKey, bar);
2333
2694
  return bar;
2334
2695
  }
2335
2696
  function makeNanNumberSeries() {
2336
2697
  return makeSeries(Number.NaN);
2337
2698
  }
2338
- function resolveSecondaryOrDiagnose(ctx, slotId, interval) {
2699
+ function resolveSecondaryOrDiagnose(ctx, slotId, feed, interval) {
2339
2700
  if (!ctx.capabilities.multiTimeframe) {
2340
- pushOnce(ctx, "multi-timeframe-not-supported", slotId, interval, "security", "Adapter declares multiTimeframe: false; request.security returns NaN");
2701
+ pushOnce(ctx, "multi-timeframe-not-supported", slotId, feed, "security", "Adapter declares multiTimeframe: false; request.security returns NaN");
2341
2702
  return void 0;
2342
2703
  }
2343
2704
  if (!ctx.capabilities.intervals.some((descriptor) => descriptor.value === interval)) {
2344
- pushOnce(ctx, "unsupported-interval", slotId, interval, "security", `Requested interval "${interval}" is not in Capabilities.intervals`);
2705
+ pushOnce(ctx, "unsupported-interval", slotId, feed, "security", `Requested interval "${interval}" is not in Capabilities.intervals`);
2345
2706
  return void 0;
2346
2707
  }
2347
- const secondary = ctx.secondaryStreams.get(interval);
2708
+ const secondary = ctx.secondaryStreams.get(feed);
2348
2709
  if (secondary === void 0) {
2349
- pushOnce(ctx, "unknown-secondary-stream", slotId, interval, "security", `Requested interval "${interval}" has no registered secondary stream`);
2710
+ pushOnce(ctx, "unknown-secondary-stream", slotId, feed, "security", `Requested interval "${interval}" has no registered secondary stream`);
2350
2711
  }
2351
2712
  return secondary;
2352
2713
  }
2353
- function makeSecurityExprSeries(ctx, runner, interval) {
2354
- const cacheKey = `${runner.slotId}|${interval}`;
2714
+ function makeSecurityExprSeries(ctx, runner, feed, isDifferentSymbol) {
2715
+ const cacheKey = `${runner.slotId}|${feed}`;
2355
2716
  const cache = ctx.requestSecurityExprSeries;
2356
2717
  const existing = cache?.get(cacheKey);
2357
2718
  if (existing !== void 0)
2358
2719
  return existing;
2359
- const secondary = resolveSecondaryOrDiagnose(ctx, runner.slotId, interval);
2720
+ if (isDifferentSymbol && !ctx.capabilities.multiSymbol) {
2721
+ pushOnce(ctx, "multi-symbol-not-supported", runner.slotId, feed, "security", MULTI_SYMBOL_MSG);
2722
+ const nan = makeNanNumberSeries();
2723
+ cache?.set(cacheKey, nan);
2724
+ return nan;
2725
+ }
2726
+ const secondary = resolveSecondaryOrDiagnose(ctx, runner.slotId, feed, runner.interval);
2360
2727
  const series = secondary === void 0 ? makeNanNumberSeries() : makeAlignedSeriesProxy(ctx, () => getOrAlign(ascendingBarsFor(ctx, secondary), ascendingValues(runner.output), ascendingBarsFor(ctx, ctx.stream)));
2361
2728
  cache?.set(cacheKey, series);
2362
2729
  return series;
@@ -2370,18 +2737,23 @@ function getCtx2(name) {
2370
2737
  }
2371
2738
  return ctx;
2372
2739
  }
2740
+ function resolveSymbol(ctx, symbol) {
2741
+ return symbol === void 0 || symbol === ctx.chartSymbol ? void 0 : symbol;
2742
+ }
2373
2743
  function security2(slotId, opts, expr) {
2374
2744
  const ctx = getCtx2("request.security");
2745
+ const symbol = resolveSymbol(ctx, opts.symbol);
2746
+ const feed = feedKey(symbol, opts.interval);
2375
2747
  const runner = ctx.securityExprRunners?.get(slotId);
2376
2748
  if (runner === void 0) {
2377
- return makeSecurityBar(ctx, slotId, opts.interval);
2749
+ return makeSecurityBar(ctx, slotId, symbol, opts.interval);
2378
2750
  }
2379
2751
  if (expr !== void 0) {
2380
- const secondary = ctx.secondaryStreams.get(opts.interval);
2752
+ const secondary = ctx.secondaryStreams.get(feed);
2381
2753
  if (secondary !== void 0)
2382
2754
  captureAndCatchUp(runner, expr, secondary);
2383
2755
  }
2384
- return makeSecurityExprSeries(ctx, runner, opts.interval);
2756
+ return makeSecurityExprSeries(ctx, runner, feed, symbol !== void 0);
2385
2757
  }
2386
2758
  function lowerTf2(slotId, opts) {
2387
2759
  const ctx = getCtx2("request.lowerTf");
@@ -2515,6 +2887,7 @@ var VALID_DIAGNOSTIC_CODES = /* @__PURE__ */ new Set([
2515
2887
  "unsupported-pane",
2516
2888
  "unsupported-interval",
2517
2889
  "multi-timeframe-not-supported",
2890
+ "multi-symbol-not-supported",
2518
2891
  "unknown-secondary-stream",
2519
2892
  "lookback-exceeded",
2520
2893
  "drawing-budget-exceeded",
@@ -2829,6 +3202,12 @@ function validatePlotEmission(e) {
2829
3202
  if (value !== null && !isFiniteNumber(value)) {
2830
3203
  return bad("plot.value: must be a finite number or null");
2831
3204
  }
3205
+ const colorValue = e.colorValue;
3206
+ if (colorValue !== void 0 && colorValue !== null) {
3207
+ const cv = validateColor(colorValue, "plot.colorValue");
3208
+ if (!cv.ok)
3209
+ return cv;
3210
+ }
2832
3211
  const color2 = e.color;
2833
3212
  if (color2 !== null && typeof color2 !== "string") {
2834
3213
  return bad("plot.color: must be a string or null");
@@ -3922,6 +4301,63 @@ function validateEmission(e) {
3922
4301
  }
3923
4302
  }
3924
4303
 
4304
+ // ../adapter-kit/dist/geometry/_lib/arrowhead.js
4305
+ var ARROWHEAD_HALF_ANGLE = Math.PI / 6;
4306
+
4307
+ // ../adapter-kit/dist/geometry/kinds/annotations.js
4308
+ var TWO_PI = Math.PI * 2;
4309
+
4310
+ // ../adapter-kit/dist/geometry/kinds/boxes.js
4311
+ var TWO_PI2 = Math.PI * 2;
4312
+
4313
+ // ../adapter-kit/dist/geometry/_lib/fibLevels.js
4314
+ var FIB_LEVELS = Object.freeze([
4315
+ 0,
4316
+ 0.236,
4317
+ 0.382,
4318
+ 0.5,
4319
+ 0.618,
4320
+ 0.786,
4321
+ 1,
4322
+ 1.272,
4323
+ // biome-ignore lint/suspicious/noApproximativeNumericConstant: canonical fib ratio, not √2.
4324
+ 1.414,
4325
+ 1.618,
4326
+ 2,
4327
+ 2.618,
4328
+ 4.236
4329
+ ]);
4330
+
4331
+ // ../adapter-kit/dist/geometry/kinds/fibonacci.js
4332
+ var TAU = Math.PI * 2;
4333
+ var PHI = (1 + Math.sqrt(5)) / 2;
4334
+ var SPIRAL_K = 4 * (Math.sqrt(2) - 1) / 3;
4335
+
4336
+ // ../adapter-kit/dist/geometry/_lib/gannLevels.js
4337
+ var GANN_LEVELS = Object.freeze([0, 0.25, 0.5, 0.75, 1]);
4338
+ var GANN_FAN_RATIOS = Object.freeze([
4339
+ 1,
4340
+ 2,
4341
+ 3,
4342
+ 0.5,
4343
+ 1 / 3,
4344
+ 4,
4345
+ 0.25,
4346
+ 8,
4347
+ 0.125
4348
+ ]);
4349
+ var GANN_FAN_LABELS = Object.freeze([
4350
+ "1x1",
4351
+ "1x2",
4352
+ "1x3",
4353
+ "2x1",
4354
+ "3x1",
4355
+ "1x4",
4356
+ "4x1",
4357
+ "1x8",
4358
+ "8x1"
4359
+ ]);
4360
+
3925
4361
  // ../runtime/dist/emit/emissionsQueue.js
3926
4362
  function pushPlot(queue, e) {
3927
4363
  const result = validateEmission(e);
@@ -4119,11 +4555,11 @@ function emit(slot) {
4119
4555
  return Number.NaN;
4120
4556
  return slot.sumRanges / slot.length;
4121
4557
  }
4122
- function closeStep(slot, high, low, time) {
4123
- if (!Number.isFinite(high) || !Number.isFinite(low) || !Number.isFinite(time)) {
4558
+ function closeStep(slot, high, low, time2) {
4559
+ if (!Number.isFinite(high) || !Number.isFinite(low) || !Number.isFinite(time2)) {
4124
4560
  return emit(slot);
4125
4561
  }
4126
- const dayKey = Math.floor(time / MS_PER_DAY);
4562
+ const dayKey = Math.floor(time2 / MS_PER_DAY);
4127
4563
  if (Number.isNaN(slot.currentDayKey)) {
4128
4564
  slot.currentDayKey = dayKey;
4129
4565
  slot.dailyHigh = high;
@@ -4151,11 +4587,11 @@ function adr(slotId, opts) {
4151
4587
  slot = initSlot2(length, ctx.stream.ohlcv.close.capacity);
4152
4588
  ctx.stream.taSlots.set(slotId, slot);
4153
4589
  }
4154
- const { high, low, time } = ctx.stream.bar;
4590
+ const { high, low, time: time2 } = ctx.stream.bar;
4155
4591
  if (ctx.isTick) {
4156
4592
  slot.outBuffer.replaceHead(emit(slot));
4157
4593
  } else {
4158
- slot.outBuffer.append(closeStep(slot, high, low, time));
4594
+ slot.outBuffer.append(closeStep(slot, high, low, time2));
4159
4595
  }
4160
4596
  return slot.series;
4161
4597
  }
@@ -5018,15 +5454,173 @@ function applyPlotOverride(emission, override) {
5018
5454
  return next;
5019
5455
  }
5020
5456
 
5021
- // ../runtime/dist/emit/draw/pushDrawing.js
5022
- function effectiveBudget(ctx, bucket) {
5023
- const adapterCap = ctx.capabilities.maxDrawingsPerScript[bucket];
5024
- const scriptCap = ctx.scriptMaxDrawings?.[bucket] ?? Number.POSITIVE_INFINITY;
5025
- return Math.min(adapterCap, scriptCap);
5457
+ // ../runtime/dist/emit/plot.js
5458
+ var OUTSIDE_CTX_MESSAGE2 = "plot called outside an active script step";
5459
+ function isSeriesNumber(v) {
5460
+ return typeof v === "object" && v !== null && "current" in v;
5026
5461
  }
5027
- function pushDrawing(ctx, e) {
5028
- if (!ctx.capabilities.drawings.has(e.drawingKind)) {
5029
- pushDiagnostic(ctx.emissions, {
5462
+ function isNumberOrSeries(v) {
5463
+ return typeof v === "number" || isSeriesNumber(v);
5464
+ }
5465
+ function resolveValue(value) {
5466
+ const resolved = typeof value === "number" ? value : value.current;
5467
+ return Number.isFinite(resolved) ? resolved : null;
5468
+ }
5469
+ function buildStyle(opts) {
5470
+ const style = opts.style;
5471
+ if (style === void 0) {
5472
+ return {
5473
+ kind: "line",
5474
+ lineWidth: opts.lineWidth ?? 1,
5475
+ lineStyle: opts.lineStyle ?? "solid"
5476
+ };
5477
+ }
5478
+ switch (style.kind) {
5479
+ case "histogram":
5480
+ return { kind: "histogram", baseline: style.baseline ?? 0 };
5481
+ case "marker":
5482
+ return { kind: "marker", shape: style.shape, size: style.size };
5483
+ case "shape":
5484
+ return {
5485
+ kind: "shape",
5486
+ shape: style.shape,
5487
+ size: style.size,
5488
+ ...style.location === void 0 ? {} : { location: style.location }
5489
+ };
5490
+ case "character":
5491
+ return {
5492
+ kind: "character",
5493
+ char: style.char,
5494
+ size: style.size,
5495
+ ...style.location === void 0 ? {} : { location: style.location }
5496
+ };
5497
+ case "arrow":
5498
+ return { kind: "arrow", direction: style.direction, size: style.size };
5499
+ case "candle-override":
5500
+ return {
5501
+ kind: "candle-override",
5502
+ bull: style.bull,
5503
+ bear: style.bear,
5504
+ ...style.doji === void 0 ? {} : { doji: style.doji }
5505
+ };
5506
+ case "bar-override":
5507
+ return { kind: "bar-override", color: style.color };
5508
+ case "bg-color":
5509
+ return {
5510
+ kind: "bg-color",
5511
+ color: style.color,
5512
+ ...style.transp === void 0 ? {} : { transp: style.transp }
5513
+ };
5514
+ case "bar-color":
5515
+ return { kind: "bar-color", color: style.color };
5516
+ case "horizontal-histogram":
5517
+ return { kind: "horizontal-histogram", buckets: style.buckets };
5518
+ case "line":
5519
+ case "step-line":
5520
+ case "horizontal-line":
5521
+ return {
5522
+ kind: style.kind,
5523
+ lineWidth: opts.lineWidth ?? 1,
5524
+ lineStyle: opts.lineStyle ?? "solid"
5525
+ };
5526
+ }
5527
+ }
5528
+ function plotImpl(ctx, slotId, value, opts, dynamicColor) {
5529
+ const style = buildStyle(opts);
5530
+ if (!ctx.capabilities.plots.has(style.kind)) {
5531
+ pushDiagnostic(ctx.emissions, {
5532
+ kind: "diagnostic",
5533
+ severity: "warning",
5534
+ code: "unsupported-plot-kind",
5535
+ message: `Adapter cannot render plot kind "${style.kind}".`,
5536
+ slotId,
5537
+ bar: ctx.barIndex()
5538
+ });
5539
+ return;
5540
+ }
5541
+ const pane = resolvePane(opts.pane, ctx, slotId);
5542
+ const xShift = typeof value === "number" ? 0 : seriesOffsetOf(value);
5543
+ const z = opts.z ?? 0;
5544
+ const colorValue = dynamicColor;
5545
+ const emission = {
5546
+ kind: "plot",
5547
+ slotId,
5548
+ title: opts.title ?? "",
5549
+ style,
5550
+ bar: ctx.barIndex(),
5551
+ time: ctx.stream.bar.time,
5552
+ value: resolveValue(value),
5553
+ color: opts.color ?? null,
5554
+ meta: {},
5555
+ pane,
5556
+ ...xShift === 0 ? {} : { xShift },
5557
+ ...z === 0 ? {} : { z },
5558
+ ...colorValue === void 0 ? {} : { colorValue }
5559
+ };
5560
+ pushPlot(ctx.emissions, applyPlotOverride(emission, ctx.plotOverrides[slotId]));
5561
+ }
5562
+ function plot2(arg1, arg2, arg3) {
5563
+ if (typeof arg1 !== "string") {
5564
+ throw new Error(OUTSIDE_CTX_MESSAGE2);
5565
+ }
5566
+ const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5567
+ if (!ctx)
5568
+ throw new Error(OUTSIDE_CTX_MESSAGE2);
5569
+ if (!isNumberOrSeries(arg2)) {
5570
+ throw new Error(OUTSIDE_CTX_MESSAGE2);
5571
+ }
5572
+ plotImpl(ctx, arg1, arg2, arg3 ?? {});
5573
+ }
5574
+
5575
+ // ../runtime/dist/emit/barcolor.js
5576
+ var OUTSIDE_CTX_MESSAGE3 = "barcolor called outside an active script step";
5577
+ function barColorOpts(color2, opts) {
5578
+ return {
5579
+ style: { kind: "bar-color", color: color2 },
5580
+ ...opts.title === void 0 ? {} : { title: opts.title }
5581
+ };
5582
+ }
5583
+ function barcolor2(arg1, arg2, arg3) {
5584
+ if (typeof arg1 !== "string" || typeof arg2 !== "string") {
5585
+ throw new Error(OUTSIDE_CTX_MESSAGE3);
5586
+ }
5587
+ const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5588
+ if (!ctx)
5589
+ throw new Error(OUTSIDE_CTX_MESSAGE3);
5590
+ plotImpl(ctx, arg1, Number.NaN, barColorOpts(arg2, arg3 ?? {}), arg2);
5591
+ }
5592
+
5593
+ // ../runtime/dist/emit/bgcolor.js
5594
+ var OUTSIDE_CTX_MESSAGE4 = "bgcolor called outside an active script step";
5595
+ function bgColorOpts(color2, opts) {
5596
+ return {
5597
+ style: {
5598
+ kind: "bg-color",
5599
+ color: color2,
5600
+ ...opts.transp === void 0 ? {} : { transp: opts.transp }
5601
+ },
5602
+ ...opts.title === void 0 ? {} : { title: opts.title }
5603
+ };
5604
+ }
5605
+ function bgcolor2(arg1, arg2, arg3) {
5606
+ if (typeof arg1 !== "string" || typeof arg2 !== "string") {
5607
+ throw new Error(OUTSIDE_CTX_MESSAGE4);
5608
+ }
5609
+ const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5610
+ if (!ctx)
5611
+ throw new Error(OUTSIDE_CTX_MESSAGE4);
5612
+ plotImpl(ctx, arg1, Number.NaN, bgColorOpts(arg2, arg3 ?? {}), arg2);
5613
+ }
5614
+
5615
+ // ../runtime/dist/emit/draw/pushDrawing.js
5616
+ function effectiveBudget(ctx, bucket) {
5617
+ const adapterCap = ctx.capabilities.maxDrawingsPerScript[bucket];
5618
+ const scriptCap = ctx.scriptMaxDrawings?.[bucket] ?? Number.POSITIVE_INFINITY;
5619
+ return Math.min(adapterCap, scriptCap);
5620
+ }
5621
+ function pushDrawing(ctx, e) {
5622
+ if (!ctx.capabilities.drawings.has(e.drawingKind)) {
5623
+ pushDiagnostic(ctx.emissions, {
5030
5624
  kind: "diagnostic",
5031
5625
  severity: "warning",
5032
5626
  code: "unsupported-drawing-kind",
@@ -5080,7 +5674,7 @@ function pushDrawing(ctx, e) {
5080
5674
  }
5081
5675
 
5082
5676
  // ../runtime/dist/emit/draw/handle.js
5083
- var OUTSIDE_CTX_MESSAGE2 = "draw called outside an active script step";
5677
+ var OUTSIDE_CTX_MESSAGE5 = "draw called outside an active script step";
5084
5678
  function mergeState(prev, patch) {
5085
5679
  return { ...prev, ...patch, kind: prev.kind };
5086
5680
  }
@@ -5113,7 +5707,7 @@ function emit2(ctx, handleId, kind, op, state2, z) {
5113
5707
  function createDrawingHandle(slotId, subId, kind, initialState) {
5114
5708
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5115
5709
  if (ctx === null)
5116
- throw new Error(OUTSIDE_CTX_MESSAGE2);
5710
+ throw new Error(OUTSIDE_CTX_MESSAGE5);
5117
5711
  const handleId = `${slotId}#${subId}`;
5118
5712
  const existing = ctx.drawingSlots.get(handleId);
5119
5713
  const initial = splitZ(initialState);
@@ -5172,96 +5766,96 @@ function resetSubIdCounters(ctx) {
5172
5766
  }
5173
5767
 
5174
5768
  // ../runtime/dist/emit/draw/annotations/arrow.js
5175
- var OUTSIDE_CTX_MESSAGE3 = "draw.arrow called outside an active script step";
5769
+ var OUTSIDE_CTX_MESSAGE6 = "draw.arrow called outside an active script step";
5176
5770
  function arrowImpl(slotId, a, b, opts) {
5177
5771
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5178
5772
  if (ctx === null)
5179
- throw new Error(OUTSIDE_CTX_MESSAGE3);
5773
+ throw new Error(OUTSIDE_CTX_MESSAGE6);
5180
5774
  const subId = nextSubId(ctx, slotId);
5181
5775
  const state2 = { kind: "arrow", anchors: [a, b], style: opts };
5182
5776
  return createDrawingHandle(slotId, subId, "arrow", state2);
5183
5777
  }
5184
5778
  function arrow(arg1, arg2, arg3, arg4) {
5185
5779
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5186
- throw new Error(OUTSIDE_CTX_MESSAGE3);
5780
+ throw new Error(OUTSIDE_CTX_MESSAGE6);
5187
5781
  }
5188
5782
  return arrowImpl(arg1, arg2, arg3, arg4 ?? {});
5189
5783
  }
5190
5784
 
5191
5785
  // ../runtime/dist/emit/draw/annotations/arrowMarkDown.js
5192
- var OUTSIDE_CTX_MESSAGE4 = "draw.arrowMarkDown called outside an active script step";
5786
+ var OUTSIDE_CTX_MESSAGE7 = "draw.arrowMarkDown called outside an active script step";
5193
5787
  function arrowMarkDownImpl(slotId, anchor, opts) {
5194
5788
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5195
5789
  if (ctx === null)
5196
- throw new Error(OUTSIDE_CTX_MESSAGE4);
5790
+ throw new Error(OUTSIDE_CTX_MESSAGE7);
5197
5791
  const subId = nextSubId(ctx, slotId);
5198
5792
  const state2 = { kind: "arrow-mark-down", anchor, style: opts };
5199
5793
  return createDrawingHandle(slotId, subId, "arrow-mark-down", state2);
5200
5794
  }
5201
5795
  function arrowMarkDown(arg1, arg2, arg3) {
5202
5796
  if (typeof arg1 !== "string" || arg2 === void 0) {
5203
- throw new Error(OUTSIDE_CTX_MESSAGE4);
5797
+ throw new Error(OUTSIDE_CTX_MESSAGE7);
5204
5798
  }
5205
5799
  return arrowMarkDownImpl(arg1, arg2, arg3 ?? {});
5206
5800
  }
5207
5801
 
5208
5802
  // ../runtime/dist/emit/draw/annotations/arrowMarkUp.js
5209
- var OUTSIDE_CTX_MESSAGE5 = "draw.arrowMarkUp called outside an active script step";
5803
+ var OUTSIDE_CTX_MESSAGE8 = "draw.arrowMarkUp called outside an active script step";
5210
5804
  function arrowMarkUpImpl(slotId, anchor, opts) {
5211
5805
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5212
5806
  if (ctx === null)
5213
- throw new Error(OUTSIDE_CTX_MESSAGE5);
5807
+ throw new Error(OUTSIDE_CTX_MESSAGE8);
5214
5808
  const subId = nextSubId(ctx, slotId);
5215
5809
  const state2 = { kind: "arrow-mark-up", anchor, style: opts };
5216
5810
  return createDrawingHandle(slotId, subId, "arrow-mark-up", state2);
5217
5811
  }
5218
5812
  function arrowMarkUp(arg1, arg2, arg3) {
5219
5813
  if (typeof arg1 !== "string" || arg2 === void 0) {
5220
- throw new Error(OUTSIDE_CTX_MESSAGE5);
5814
+ throw new Error(OUTSIDE_CTX_MESSAGE8);
5221
5815
  }
5222
5816
  return arrowMarkUpImpl(arg1, arg2, arg3 ?? {});
5223
5817
  }
5224
5818
 
5225
5819
  // ../runtime/dist/emit/draw/annotations/arrowMarker.js
5226
- var OUTSIDE_CTX_MESSAGE6 = "draw.arrowMarker called outside an active script step";
5820
+ var OUTSIDE_CTX_MESSAGE9 = "draw.arrowMarker called outside an active script step";
5227
5821
  function arrowMarkerImpl(slotId, anchor, opts) {
5228
5822
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5229
5823
  if (ctx === null)
5230
- throw new Error(OUTSIDE_CTX_MESSAGE6);
5824
+ throw new Error(OUTSIDE_CTX_MESSAGE9);
5231
5825
  const subId = nextSubId(ctx, slotId);
5232
5826
  const state2 = { kind: "arrow-marker", anchor, style: opts };
5233
5827
  return createDrawingHandle(slotId, subId, "arrow-marker", state2);
5234
5828
  }
5235
5829
  function arrowMarker(arg1, arg2, arg3) {
5236
5830
  if (typeof arg1 !== "string" || arg2 === void 0) {
5237
- throw new Error(OUTSIDE_CTX_MESSAGE6);
5831
+ throw new Error(OUTSIDE_CTX_MESSAGE9);
5238
5832
  }
5239
5833
  return arrowMarkerImpl(arg1, arg2, arg3 ?? {});
5240
5834
  }
5241
5835
 
5242
5836
  // ../runtime/dist/emit/draw/annotations/text.js
5243
- var OUTSIDE_CTX_MESSAGE7 = "draw.text called outside an active script step";
5837
+ var OUTSIDE_CTX_MESSAGE10 = "draw.text called outside an active script step";
5244
5838
  function textImpl(slotId, anchor, body, opts) {
5245
5839
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5246
5840
  if (ctx === null)
5247
- throw new Error(OUTSIDE_CTX_MESSAGE7);
5841
+ throw new Error(OUTSIDE_CTX_MESSAGE10);
5248
5842
  const subId = nextSubId(ctx, slotId);
5249
5843
  const state2 = { kind: "text", anchor, body, style: opts };
5250
5844
  return createDrawingHandle(slotId, subId, "text", state2);
5251
5845
  }
5252
5846
  function text(arg1, arg2, arg3, arg4) {
5253
5847
  if (typeof arg1 !== "string" || arg2 === void 0 || typeof arg2 === "string" || typeof arg3 !== "string") {
5254
- throw new Error(OUTSIDE_CTX_MESSAGE7);
5848
+ throw new Error(OUTSIDE_CTX_MESSAGE10);
5255
5849
  }
5256
5850
  return textImpl(arg1, arg2, arg3, arg4 ?? {});
5257
5851
  }
5258
5852
 
5259
5853
  // ../runtime/dist/emit/draw/boxes/circle.js
5260
- var OUTSIDE_CTX_MESSAGE8 = "draw.circle called outside an active script step";
5854
+ var OUTSIDE_CTX_MESSAGE11 = "draw.circle called outside an active script step";
5261
5855
  function circleImpl(slotId, centre, radiusAnchor, opts) {
5262
5856
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5263
5857
  if (ctx === null)
5264
- throw new Error(OUTSIDE_CTX_MESSAGE8);
5858
+ throw new Error(OUTSIDE_CTX_MESSAGE11);
5265
5859
  const subId = nextSubId(ctx, slotId);
5266
5860
  const state2 = {
5267
5861
  kind: "circle",
@@ -5272,51 +5866,51 @@ function circleImpl(slotId, centre, radiusAnchor, opts) {
5272
5866
  }
5273
5867
  function circle(arg1, arg2, arg3, arg4) {
5274
5868
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5275
- throw new Error(OUTSIDE_CTX_MESSAGE8);
5869
+ throw new Error(OUTSIDE_CTX_MESSAGE11);
5276
5870
  }
5277
5871
  return circleImpl(arg1, arg2, arg3, arg4 ?? {});
5278
5872
  }
5279
5873
 
5280
5874
  // ../runtime/dist/emit/draw/boxes/ellipse.js
5281
- var OUTSIDE_CTX_MESSAGE9 = "draw.ellipse called outside an active script step";
5875
+ var OUTSIDE_CTX_MESSAGE12 = "draw.ellipse called outside an active script step";
5282
5876
  function ellipseImpl(slotId, a, b, opts) {
5283
5877
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5284
5878
  if (ctx === null)
5285
- throw new Error(OUTSIDE_CTX_MESSAGE9);
5879
+ throw new Error(OUTSIDE_CTX_MESSAGE12);
5286
5880
  const subId = nextSubId(ctx, slotId);
5287
5881
  const state2 = { kind: "ellipse", anchors: [a, b], style: opts };
5288
5882
  return createDrawingHandle(slotId, subId, "ellipse", state2);
5289
5883
  }
5290
5884
  function ellipse(arg1, arg2, arg3, arg4) {
5291
5885
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5292
- throw new Error(OUTSIDE_CTX_MESSAGE9);
5886
+ throw new Error(OUTSIDE_CTX_MESSAGE12);
5293
5887
  }
5294
5888
  return ellipseImpl(arg1, arg2, arg3, arg4 ?? {});
5295
5889
  }
5296
5890
 
5297
5891
  // ../runtime/dist/emit/draw/boxes/fillBetween.js
5298
- var OUTSIDE_CTX_MESSAGE10 = "draw.fillBetween called outside an active script step";
5892
+ var OUTSIDE_CTX_MESSAGE13 = "draw.fillBetween called outside an active script step";
5299
5893
  function fillBetweenImpl(slotId, edgeA, edgeB, opts) {
5300
5894
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5301
5895
  if (ctx === null)
5302
- throw new Error(OUTSIDE_CTX_MESSAGE10);
5896
+ throw new Error(OUTSIDE_CTX_MESSAGE13);
5303
5897
  const subId = nextSubId(ctx, slotId);
5304
5898
  const state2 = { kind: "fill-between", edgeA, edgeB, style: opts };
5305
5899
  return createDrawingHandle(slotId, subId, "fill-between", state2);
5306
5900
  }
5307
5901
  function fillBetween(arg1, arg2, arg3, arg4) {
5308
5902
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2) || arg3 === void 0 || !Array.isArray(arg3)) {
5309
- throw new Error(OUTSIDE_CTX_MESSAGE10);
5903
+ throw new Error(OUTSIDE_CTX_MESSAGE13);
5310
5904
  }
5311
5905
  return fillBetweenImpl(arg1, arg2, arg3, arg4 ?? {});
5312
5906
  }
5313
5907
 
5314
5908
  // ../runtime/dist/emit/draw/boxes/marker.js
5315
- var OUTSIDE_CTX_MESSAGE11 = "draw.marker called outside an active script step";
5909
+ var OUTSIDE_CTX_MESSAGE14 = "draw.marker called outside an active script step";
5316
5910
  function markerImpl(slotId, anchor, opts) {
5317
5911
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5318
5912
  if (ctx === null)
5319
- throw new Error(OUTSIDE_CTX_MESSAGE11);
5913
+ throw new Error(OUTSIDE_CTX_MESSAGE14);
5320
5914
  const subId = nextSubId(ctx, slotId);
5321
5915
  const { text: text2, value, ...style } = opts;
5322
5916
  const state2 = {
@@ -5330,136 +5924,136 @@ function markerImpl(slotId, anchor, opts) {
5330
5924
  }
5331
5925
  function marker(arg1, arg2, arg3) {
5332
5926
  if (typeof arg1 !== "string" || arg2 === void 0) {
5333
- throw new Error(OUTSIDE_CTX_MESSAGE11);
5927
+ throw new Error(OUTSIDE_CTX_MESSAGE14);
5334
5928
  }
5335
5929
  return markerImpl(arg1, arg2, arg3 ?? {});
5336
5930
  }
5337
5931
 
5338
5932
  // ../runtime/dist/emit/draw/boxes/path.js
5339
- var OUTSIDE_CTX_MESSAGE12 = "draw.path called outside an active script step";
5933
+ var OUTSIDE_CTX_MESSAGE15 = "draw.path called outside an active script step";
5340
5934
  function pathImpl(slotId, anchors, opts) {
5341
5935
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5342
5936
  if (ctx === null)
5343
- throw new Error(OUTSIDE_CTX_MESSAGE12);
5937
+ throw new Error(OUTSIDE_CTX_MESSAGE15);
5344
5938
  const subId = nextSubId(ctx, slotId);
5345
5939
  const state2 = { kind: "path", anchors, style: opts };
5346
5940
  return createDrawingHandle(slotId, subId, "path", state2);
5347
5941
  }
5348
5942
  function path(arg1, arg2, arg3) {
5349
5943
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5350
- throw new Error(OUTSIDE_CTX_MESSAGE12);
5944
+ throw new Error(OUTSIDE_CTX_MESSAGE15);
5351
5945
  }
5352
5946
  return pathImpl(arg1, arg2, arg3 ?? {});
5353
5947
  }
5354
5948
 
5355
5949
  // ../runtime/dist/emit/draw/boxes/polyline.js
5356
- var OUTSIDE_CTX_MESSAGE13 = "draw.polyline called outside an active script step";
5950
+ var OUTSIDE_CTX_MESSAGE16 = "draw.polyline called outside an active script step";
5357
5951
  function polylineImpl(slotId, anchors, opts) {
5358
5952
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5359
5953
  if (ctx === null)
5360
- throw new Error(OUTSIDE_CTX_MESSAGE13);
5954
+ throw new Error(OUTSIDE_CTX_MESSAGE16);
5361
5955
  const subId = nextSubId(ctx, slotId);
5362
5956
  const state2 = { kind: "polyline", anchors, style: opts };
5363
5957
  return createDrawingHandle(slotId, subId, "polyline", state2);
5364
5958
  }
5365
5959
  function polyline(arg1, arg2, arg3) {
5366
5960
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5367
- throw new Error(OUTSIDE_CTX_MESSAGE13);
5961
+ throw new Error(OUTSIDE_CTX_MESSAGE16);
5368
5962
  }
5369
5963
  return polylineImpl(arg1, arg2, arg3 ?? {});
5370
5964
  }
5371
5965
 
5372
5966
  // ../runtime/dist/emit/draw/boxes/rectangle.js
5373
- var OUTSIDE_CTX_MESSAGE14 = "draw.rectangle called outside an active script step";
5967
+ var OUTSIDE_CTX_MESSAGE17 = "draw.rectangle called outside an active script step";
5374
5968
  function rectangleImpl(slotId, a, b, opts) {
5375
5969
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5376
5970
  if (ctx === null)
5377
- throw new Error(OUTSIDE_CTX_MESSAGE14);
5971
+ throw new Error(OUTSIDE_CTX_MESSAGE17);
5378
5972
  const subId = nextSubId(ctx, slotId);
5379
5973
  const state2 = { kind: "rectangle", anchors: [a, b], style: opts };
5380
5974
  return createDrawingHandle(slotId, subId, "rectangle", state2);
5381
5975
  }
5382
5976
  function rectangle(arg1, arg2, arg3, arg4) {
5383
5977
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5384
- throw new Error(OUTSIDE_CTX_MESSAGE14);
5978
+ throw new Error(OUTSIDE_CTX_MESSAGE17);
5385
5979
  }
5386
5980
  return rectangleImpl(arg1, arg2, arg3, arg4 ?? {});
5387
5981
  }
5388
5982
 
5389
5983
  // ../runtime/dist/emit/draw/boxes/rotatedRectangle.js
5390
- var OUTSIDE_CTX_MESSAGE15 = "draw.rotatedRectangle called outside an active script step";
5984
+ var OUTSIDE_CTX_MESSAGE18 = "draw.rotatedRectangle called outside an active script step";
5391
5985
  function rotatedRectangleImpl(slotId, anchors, opts) {
5392
5986
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5393
5987
  if (ctx === null)
5394
- throw new Error(OUTSIDE_CTX_MESSAGE15);
5988
+ throw new Error(OUTSIDE_CTX_MESSAGE18);
5395
5989
  const subId = nextSubId(ctx, slotId);
5396
5990
  const state2 = { kind: "rotated-rectangle", anchors, style: opts };
5397
5991
  return createDrawingHandle(slotId, subId, "rotated-rectangle", state2);
5398
5992
  }
5399
5993
  function rotatedRectangle(arg1, arg2, arg3) {
5400
5994
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5401
- throw new Error(OUTSIDE_CTX_MESSAGE15);
5995
+ throw new Error(OUTSIDE_CTX_MESSAGE18);
5402
5996
  }
5403
5997
  return rotatedRectangleImpl(arg1, arg2, arg3 ?? {});
5404
5998
  }
5405
5999
 
5406
6000
  // ../runtime/dist/emit/draw/boxes/triangle.js
5407
- var OUTSIDE_CTX_MESSAGE16 = "draw.triangle called outside an active script step";
6001
+ var OUTSIDE_CTX_MESSAGE19 = "draw.triangle called outside an active script step";
5408
6002
  function triangleImpl(slotId, anchors, opts) {
5409
6003
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5410
6004
  if (ctx === null)
5411
- throw new Error(OUTSIDE_CTX_MESSAGE16);
6005
+ throw new Error(OUTSIDE_CTX_MESSAGE19);
5412
6006
  const subId = nextSubId(ctx, slotId);
5413
6007
  const state2 = { kind: "triangle", anchors, style: opts };
5414
6008
  return createDrawingHandle(slotId, subId, "triangle", state2);
5415
6009
  }
5416
6010
  function triangle(arg1, arg2, arg3) {
5417
6011
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5418
- throw new Error(OUTSIDE_CTX_MESSAGE16);
6012
+ throw new Error(OUTSIDE_CTX_MESSAGE19);
5419
6013
  }
5420
6014
  return triangleImpl(arg1, arg2, arg3 ?? {});
5421
6015
  }
5422
6016
 
5423
6017
  // ../runtime/dist/emit/draw/channels/disjointChannel.js
5424
- var OUTSIDE_CTX_MESSAGE17 = "draw.disjointChannel called outside an active script step";
6018
+ var OUTSIDE_CTX_MESSAGE20 = "draw.disjointChannel called outside an active script step";
5425
6019
  function disjointChannelImpl(slotId, anchors, opts) {
5426
6020
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5427
6021
  if (ctx === null)
5428
- throw new Error(OUTSIDE_CTX_MESSAGE17);
6022
+ throw new Error(OUTSIDE_CTX_MESSAGE20);
5429
6023
  const subId = nextSubId(ctx, slotId);
5430
6024
  const state2 = { kind: "disjoint-channel", anchors, style: opts };
5431
6025
  return createDrawingHandle(slotId, subId, "disjoint-channel", state2);
5432
6026
  }
5433
6027
  function disjointChannel(arg1, arg2, arg3) {
5434
6028
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5435
- throw new Error(OUTSIDE_CTX_MESSAGE17);
6029
+ throw new Error(OUTSIDE_CTX_MESSAGE20);
5436
6030
  }
5437
6031
  return disjointChannelImpl(arg1, arg2, arg3 ?? {});
5438
6032
  }
5439
6033
 
5440
6034
  // ../runtime/dist/emit/draw/channels/flatTopBottom.js
5441
- var OUTSIDE_CTX_MESSAGE18 = "draw.flatTopBottom called outside an active script step";
6035
+ var OUTSIDE_CTX_MESSAGE21 = "draw.flatTopBottom called outside an active script step";
5442
6036
  function flatTopBottomImpl(slotId, anchors, opts) {
5443
6037
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5444
6038
  if (ctx === null)
5445
- throw new Error(OUTSIDE_CTX_MESSAGE18);
6039
+ throw new Error(OUTSIDE_CTX_MESSAGE21);
5446
6040
  const subId = nextSubId(ctx, slotId);
5447
6041
  const state2 = { kind: "flat-top-bottom", anchors, style: opts };
5448
6042
  return createDrawingHandle(slotId, subId, "flat-top-bottom", state2);
5449
6043
  }
5450
6044
  function flatTopBottom(arg1, arg2, arg3) {
5451
6045
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5452
- throw new Error(OUTSIDE_CTX_MESSAGE18);
6046
+ throw new Error(OUTSIDE_CTX_MESSAGE21);
5453
6047
  }
5454
6048
  return flatTopBottomImpl(arg1, arg2, arg3 ?? {});
5455
6049
  }
5456
6050
 
5457
6051
  // ../runtime/dist/emit/draw/channels/regressionTrend.js
5458
- var OUTSIDE_CTX_MESSAGE19 = "draw.regressionTrend called outside an active script step";
6052
+ var OUTSIDE_CTX_MESSAGE22 = "draw.regressionTrend called outside an active script step";
5459
6053
  function regressionTrendImpl(slotId, a, b, opts) {
5460
6054
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5461
6055
  if (ctx === null)
5462
- throw new Error(OUTSIDE_CTX_MESSAGE19);
6056
+ throw new Error(OUTSIDE_CTX_MESSAGE22);
5463
6057
  const subId = nextSubId(ctx, slotId);
5464
6058
  const state2 = {
5465
6059
  kind: "regression-trend",
@@ -5470,34 +6064,34 @@ function regressionTrendImpl(slotId, a, b, opts) {
5470
6064
  }
5471
6065
  function regressionTrend(arg1, arg2, arg3, arg4) {
5472
6066
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5473
- throw new Error(OUTSIDE_CTX_MESSAGE19);
6067
+ throw new Error(OUTSIDE_CTX_MESSAGE22);
5474
6068
  }
5475
6069
  return regressionTrendImpl(arg1, arg2, arg3, arg4 ?? {});
5476
6070
  }
5477
6071
 
5478
6072
  // ../runtime/dist/emit/draw/channels/trendChannel.js
5479
- var OUTSIDE_CTX_MESSAGE20 = "draw.trendChannel called outside an active script step";
6073
+ var OUTSIDE_CTX_MESSAGE23 = "draw.trendChannel called outside an active script step";
5480
6074
  function trendChannelImpl(slotId, anchors, opts) {
5481
6075
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5482
6076
  if (ctx === null)
5483
- throw new Error(OUTSIDE_CTX_MESSAGE20);
6077
+ throw new Error(OUTSIDE_CTX_MESSAGE23);
5484
6078
  const subId = nextSubId(ctx, slotId);
5485
6079
  const state2 = { kind: "trend-channel", anchors, style: opts };
5486
6080
  return createDrawingHandle(slotId, subId, "trend-channel", state2);
5487
6081
  }
5488
6082
  function trendChannel(arg1, arg2, arg3) {
5489
6083
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5490
- throw new Error(OUTSIDE_CTX_MESSAGE20);
6084
+ throw new Error(OUTSIDE_CTX_MESSAGE23);
5491
6085
  }
5492
6086
  return trendChannelImpl(arg1, arg2, arg3 ?? {});
5493
6087
  }
5494
6088
 
5495
6089
  // ../runtime/dist/emit/draw/containers/frame.js
5496
- var OUTSIDE_CTX_MESSAGE21 = "draw.frame called outside an active script step";
6090
+ var OUTSIDE_CTX_MESSAGE24 = "draw.frame called outside an active script step";
5497
6091
  function frameImpl(slotId, a, b, opts) {
5498
6092
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5499
6093
  if (ctx === null)
5500
- throw new Error(OUTSIDE_CTX_MESSAGE21);
6094
+ throw new Error(OUTSIDE_CTX_MESSAGE24);
5501
6095
  const subId = nextSubId(ctx, slotId);
5502
6096
  const state2 = {
5503
6097
  kind: "frame",
@@ -5509,17 +6103,17 @@ function frameImpl(slotId, a, b, opts) {
5509
6103
  }
5510
6104
  function frame(arg1, arg2, arg3, arg4) {
5511
6105
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5512
- throw new Error(OUTSIDE_CTX_MESSAGE21);
6106
+ throw new Error(OUTSIDE_CTX_MESSAGE24);
5513
6107
  }
5514
6108
  return frameImpl(arg1, arg2, arg3, arg4 ?? {});
5515
6109
  }
5516
6110
 
5517
6111
  // ../runtime/dist/emit/draw/containers/group.js
5518
- var OUTSIDE_CTX_MESSAGE22 = "draw.group called outside an active script step";
6112
+ var OUTSIDE_CTX_MESSAGE25 = "draw.group called outside an active script step";
5519
6113
  function groupImpl(slotId, childHandleIds) {
5520
6114
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5521
6115
  if (ctx === null)
5522
- throw new Error(OUTSIDE_CTX_MESSAGE22);
6116
+ throw new Error(OUTSIDE_CTX_MESSAGE25);
5523
6117
  const subId = nextSubId(ctx, slotId);
5524
6118
  const state2 = {
5525
6119
  kind: "group",
@@ -5529,119 +6123,119 @@ function groupImpl(slotId, childHandleIds) {
5529
6123
  }
5530
6124
  function group(arg1, arg2) {
5531
6125
  if (typeof arg1 !== "string" || arg2 === void 0) {
5532
- throw new Error(OUTSIDE_CTX_MESSAGE22);
6126
+ throw new Error(OUTSIDE_CTX_MESSAGE25);
5533
6127
  }
5534
6128
  return groupImpl(arg1, arg2);
5535
6129
  }
5536
6130
 
5537
6131
  // ../runtime/dist/emit/draw/curves/arc.js
5538
- var OUTSIDE_CTX_MESSAGE23 = "draw.arc called outside an active script step";
6132
+ var OUTSIDE_CTX_MESSAGE26 = "draw.arc called outside an active script step";
5539
6133
  function arcImpl(slotId, anchors, opts) {
5540
6134
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5541
6135
  if (ctx === null)
5542
- throw new Error(OUTSIDE_CTX_MESSAGE23);
6136
+ throw new Error(OUTSIDE_CTX_MESSAGE26);
5543
6137
  const subId = nextSubId(ctx, slotId);
5544
6138
  const state2 = { kind: "arc", anchors, style: opts };
5545
6139
  return createDrawingHandle(slotId, subId, "arc", state2);
5546
6140
  }
5547
6141
  function arc(arg1, arg2, arg3) {
5548
6142
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5549
- throw new Error(OUTSIDE_CTX_MESSAGE23);
6143
+ throw new Error(OUTSIDE_CTX_MESSAGE26);
5550
6144
  }
5551
6145
  return arcImpl(arg1, arg2, arg3 ?? {});
5552
6146
  }
5553
6147
 
5554
6148
  // ../runtime/dist/emit/draw/curves/brush.js
5555
- var OUTSIDE_CTX_MESSAGE24 = "draw.brush called outside an active script step";
6149
+ var OUTSIDE_CTX_MESSAGE27 = "draw.brush called outside an active script step";
5556
6150
  function brushImpl(slotId, anchors, opts) {
5557
6151
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5558
6152
  if (ctx === null)
5559
- throw new Error(OUTSIDE_CTX_MESSAGE24);
6153
+ throw new Error(OUTSIDE_CTX_MESSAGE27);
5560
6154
  const subId = nextSubId(ctx, slotId);
5561
6155
  const state2 = { kind: "brush", anchors, style: opts };
5562
6156
  return createDrawingHandle(slotId, subId, "brush", state2);
5563
6157
  }
5564
6158
  function brush(arg1, arg2, arg3) {
5565
6159
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2) || arg3 === void 0) {
5566
- throw new Error(OUTSIDE_CTX_MESSAGE24);
6160
+ throw new Error(OUTSIDE_CTX_MESSAGE27);
5567
6161
  }
5568
6162
  return brushImpl(arg1, arg2, arg3);
5569
6163
  }
5570
6164
 
5571
6165
  // ../runtime/dist/emit/draw/curves/curve.js
5572
- var OUTSIDE_CTX_MESSAGE25 = "draw.curve called outside an active script step";
6166
+ var OUTSIDE_CTX_MESSAGE28 = "draw.curve called outside an active script step";
5573
6167
  function curveImpl(slotId, anchors, opts) {
5574
6168
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5575
6169
  if (ctx === null)
5576
- throw new Error(OUTSIDE_CTX_MESSAGE25);
6170
+ throw new Error(OUTSIDE_CTX_MESSAGE28);
5577
6171
  const subId = nextSubId(ctx, slotId);
5578
6172
  const state2 = { kind: "curve", anchors, style: opts };
5579
6173
  return createDrawingHandle(slotId, subId, "curve", state2);
5580
6174
  }
5581
6175
  function curve(arg1, arg2, arg3) {
5582
6176
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5583
- throw new Error(OUTSIDE_CTX_MESSAGE25);
6177
+ throw new Error(OUTSIDE_CTX_MESSAGE28);
5584
6178
  }
5585
6179
  return curveImpl(arg1, arg2, arg3 ?? {});
5586
6180
  }
5587
6181
 
5588
6182
  // ../runtime/dist/emit/draw/curves/doubleCurve.js
5589
- var OUTSIDE_CTX_MESSAGE26 = "draw.doubleCurve called outside an active script step";
6183
+ var OUTSIDE_CTX_MESSAGE29 = "draw.doubleCurve called outside an active script step";
5590
6184
  function doubleCurveImpl(slotId, anchors, opts) {
5591
6185
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5592
6186
  if (ctx === null)
5593
- throw new Error(OUTSIDE_CTX_MESSAGE26);
6187
+ throw new Error(OUTSIDE_CTX_MESSAGE29);
5594
6188
  const subId = nextSubId(ctx, slotId);
5595
6189
  const state2 = { kind: "double-curve", anchors, style: opts };
5596
6190
  return createDrawingHandle(slotId, subId, "double-curve", state2);
5597
6191
  }
5598
6192
  function doubleCurve(arg1, arg2, arg3) {
5599
6193
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5600
- throw new Error(OUTSIDE_CTX_MESSAGE26);
6194
+ throw new Error(OUTSIDE_CTX_MESSAGE29);
5601
6195
  }
5602
6196
  return doubleCurveImpl(arg1, arg2, arg3 ?? {});
5603
6197
  }
5604
6198
 
5605
6199
  // ../runtime/dist/emit/draw/curves/highlighter.js
5606
- var OUTSIDE_CTX_MESSAGE27 = "draw.highlighter called outside an active script step";
6200
+ var OUTSIDE_CTX_MESSAGE30 = "draw.highlighter called outside an active script step";
5607
6201
  function highlighterImpl(slotId, anchors, opts) {
5608
6202
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5609
6203
  if (ctx === null)
5610
- throw new Error(OUTSIDE_CTX_MESSAGE27);
6204
+ throw new Error(OUTSIDE_CTX_MESSAGE30);
5611
6205
  const subId = nextSubId(ctx, slotId);
5612
6206
  const state2 = { kind: "highlighter", anchors, style: opts };
5613
6207
  return createDrawingHandle(slotId, subId, "highlighter", state2);
5614
6208
  }
5615
6209
  function highlighter(arg1, arg2, arg3) {
5616
6210
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2) || arg3 === void 0) {
5617
- throw new Error(OUTSIDE_CTX_MESSAGE27);
6211
+ throw new Error(OUTSIDE_CTX_MESSAGE30);
5618
6212
  }
5619
6213
  return highlighterImpl(arg1, arg2, arg3);
5620
6214
  }
5621
6215
 
5622
6216
  // ../runtime/dist/emit/draw/curves/pen.js
5623
- var OUTSIDE_CTX_MESSAGE28 = "draw.pen called outside an active script step";
6217
+ var OUTSIDE_CTX_MESSAGE31 = "draw.pen called outside an active script step";
5624
6218
  function penImpl(slotId, anchors, opts) {
5625
6219
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5626
6220
  if (ctx === null)
5627
- throw new Error(OUTSIDE_CTX_MESSAGE28);
6221
+ throw new Error(OUTSIDE_CTX_MESSAGE31);
5628
6222
  const subId = nextSubId(ctx, slotId);
5629
6223
  const state2 = { kind: "pen", anchors, style: opts };
5630
6224
  return createDrawingHandle(slotId, subId, "pen", state2);
5631
6225
  }
5632
6226
  function pen(arg1, arg2, arg3) {
5633
6227
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5634
- throw new Error(OUTSIDE_CTX_MESSAGE28);
6228
+ throw new Error(OUTSIDE_CTX_MESSAGE31);
5635
6229
  }
5636
6230
  return penImpl(arg1, arg2, arg3 ?? {});
5637
6231
  }
5638
6232
 
5639
6233
  // ../runtime/dist/emit/draw/cycles/cyclicLines.js
5640
- var OUTSIDE_CTX_MESSAGE29 = "draw.cyclicLines called outside an active script step";
6234
+ var OUTSIDE_CTX_MESSAGE32 = "draw.cyclicLines called outside an active script step";
5641
6235
  function cyclicLinesImpl(slotId, a, b, opts) {
5642
6236
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5643
6237
  if (ctx === null)
5644
- throw new Error(OUTSIDE_CTX_MESSAGE29);
6238
+ throw new Error(OUTSIDE_CTX_MESSAGE32);
5645
6239
  const subId = nextSubId(ctx, slotId);
5646
6240
  const state2 = {
5647
6241
  kind: "cyclic-lines",
@@ -5652,17 +6246,17 @@ function cyclicLinesImpl(slotId, a, b, opts) {
5652
6246
  }
5653
6247
  function cyclicLines(arg1, arg2, arg3, arg4) {
5654
6248
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5655
- throw new Error(OUTSIDE_CTX_MESSAGE29);
6249
+ throw new Error(OUTSIDE_CTX_MESSAGE32);
5656
6250
  }
5657
6251
  return cyclicLinesImpl(arg1, arg2, arg3, arg4 ?? {});
5658
6252
  }
5659
6253
 
5660
6254
  // ../runtime/dist/emit/draw/cycles/sineLine.js
5661
- var OUTSIDE_CTX_MESSAGE30 = "draw.sineLine called outside an active script step";
6255
+ var OUTSIDE_CTX_MESSAGE33 = "draw.sineLine called outside an active script step";
5662
6256
  function sineLineImpl(slotId, a, b, opts) {
5663
6257
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5664
6258
  if (ctx === null)
5665
- throw new Error(OUTSIDE_CTX_MESSAGE30);
6259
+ throw new Error(OUTSIDE_CTX_MESSAGE33);
5666
6260
  const subId = nextSubId(ctx, slotId);
5667
6261
  const state2 = {
5668
6262
  kind: "sine-line",
@@ -5673,17 +6267,17 @@ function sineLineImpl(slotId, a, b, opts) {
5673
6267
  }
5674
6268
  function sineLine(arg1, arg2, arg3, arg4) {
5675
6269
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5676
- throw new Error(OUTSIDE_CTX_MESSAGE30);
6270
+ throw new Error(OUTSIDE_CTX_MESSAGE33);
5677
6271
  }
5678
6272
  return sineLineImpl(arg1, arg2, arg3, arg4 ?? {});
5679
6273
  }
5680
6274
 
5681
6275
  // ../runtime/dist/emit/draw/cycles/timeCycles.js
5682
- var OUTSIDE_CTX_MESSAGE31 = "draw.timeCycles called outside an active script step";
6276
+ var OUTSIDE_CTX_MESSAGE34 = "draw.timeCycles called outside an active script step";
5683
6277
  function timeCyclesImpl(slotId, a, b, opts) {
5684
6278
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5685
6279
  if (ctx === null)
5686
- throw new Error(OUTSIDE_CTX_MESSAGE31);
6280
+ throw new Error(OUTSIDE_CTX_MESSAGE34);
5687
6281
  const subId = nextSubId(ctx, slotId);
5688
6282
  const state2 = {
5689
6283
  kind: "time-cycles",
@@ -5694,17 +6288,17 @@ function timeCyclesImpl(slotId, a, b, opts) {
5694
6288
  }
5695
6289
  function timeCycles(arg1, arg2, arg3, arg4) {
5696
6290
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5697
- throw new Error(OUTSIDE_CTX_MESSAGE31);
6291
+ throw new Error(OUTSIDE_CTX_MESSAGE34);
5698
6292
  }
5699
6293
  return timeCyclesImpl(arg1, arg2, arg3, arg4 ?? {});
5700
6294
  }
5701
6295
 
5702
6296
  // ../runtime/dist/emit/draw/elliott/elliottCorrectionWave.js
5703
- var OUTSIDE_CTX_MESSAGE32 = "draw.elliottCorrectionWave called outside an active script step";
6297
+ var OUTSIDE_CTX_MESSAGE35 = "draw.elliottCorrectionWave called outside an active script step";
5704
6298
  function elliottCorrectionWaveImpl(slotId, anchors, opts) {
5705
6299
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5706
6300
  if (ctx === null)
5707
- throw new Error(OUTSIDE_CTX_MESSAGE32);
6301
+ throw new Error(OUTSIDE_CTX_MESSAGE35);
5708
6302
  const subId = nextSubId(ctx, slotId);
5709
6303
  const { labels, ...style } = opts;
5710
6304
  const state2 = labels === void 0 ? { kind: "elliott-correction-wave", anchors, style } : { kind: "elliott-correction-wave", anchors, labels, style };
@@ -5712,17 +6306,17 @@ function elliottCorrectionWaveImpl(slotId, anchors, opts) {
5712
6306
  }
5713
6307
  function elliottCorrectionWave(arg1, arg2, arg3) {
5714
6308
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5715
- throw new Error(OUTSIDE_CTX_MESSAGE32);
6309
+ throw new Error(OUTSIDE_CTX_MESSAGE35);
5716
6310
  }
5717
6311
  return elliottCorrectionWaveImpl(arg1, arg2, arg3 ?? {});
5718
6312
  }
5719
6313
 
5720
6314
  // ../runtime/dist/emit/draw/elliott/elliottDoubleCombo.js
5721
- var OUTSIDE_CTX_MESSAGE33 = "draw.elliottDoubleCombo called outside an active script step";
6315
+ var OUTSIDE_CTX_MESSAGE36 = "draw.elliottDoubleCombo called outside an active script step";
5722
6316
  function elliottDoubleComboImpl(slotId, anchors, opts) {
5723
6317
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5724
6318
  if (ctx === null)
5725
- throw new Error(OUTSIDE_CTX_MESSAGE33);
6319
+ throw new Error(OUTSIDE_CTX_MESSAGE36);
5726
6320
  const subId = nextSubId(ctx, slotId);
5727
6321
  const { labels, ...style } = opts;
5728
6322
  const state2 = labels === void 0 ? { kind: "elliott-double-combo", anchors, style } : { kind: "elliott-double-combo", anchors, labels, style };
@@ -5730,17 +6324,17 @@ function elliottDoubleComboImpl(slotId, anchors, opts) {
5730
6324
  }
5731
6325
  function elliottDoubleCombo(arg1, arg2, arg3) {
5732
6326
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5733
- throw new Error(OUTSIDE_CTX_MESSAGE33);
6327
+ throw new Error(OUTSIDE_CTX_MESSAGE36);
5734
6328
  }
5735
6329
  return elliottDoubleComboImpl(arg1, arg2, arg3 ?? {});
5736
6330
  }
5737
6331
 
5738
6332
  // ../runtime/dist/emit/draw/elliott/elliottImpulseWave.js
5739
- var OUTSIDE_CTX_MESSAGE34 = "draw.elliottImpulseWave called outside an active script step";
6333
+ var OUTSIDE_CTX_MESSAGE37 = "draw.elliottImpulseWave called outside an active script step";
5740
6334
  function elliottImpulseWaveImpl(slotId, anchors, opts) {
5741
6335
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5742
6336
  if (ctx === null)
5743
- throw new Error(OUTSIDE_CTX_MESSAGE34);
6337
+ throw new Error(OUTSIDE_CTX_MESSAGE37);
5744
6338
  const subId = nextSubId(ctx, slotId);
5745
6339
  const { labels, ...style } = opts;
5746
6340
  const state2 = labels === void 0 ? { kind: "elliott-impulse-wave", anchors, style } : { kind: "elliott-impulse-wave", anchors, labels, style };
@@ -5748,17 +6342,17 @@ function elliottImpulseWaveImpl(slotId, anchors, opts) {
5748
6342
  }
5749
6343
  function elliottImpulseWave(arg1, arg2, arg3) {
5750
6344
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5751
- throw new Error(OUTSIDE_CTX_MESSAGE34);
6345
+ throw new Error(OUTSIDE_CTX_MESSAGE37);
5752
6346
  }
5753
6347
  return elliottImpulseWaveImpl(arg1, arg2, arg3 ?? {});
5754
6348
  }
5755
6349
 
5756
6350
  // ../runtime/dist/emit/draw/elliott/elliottTriangleWave.js
5757
- var OUTSIDE_CTX_MESSAGE35 = "draw.elliottTriangleWave called outside an active script step";
6351
+ var OUTSIDE_CTX_MESSAGE38 = "draw.elliottTriangleWave called outside an active script step";
5758
6352
  function elliottTriangleWaveImpl(slotId, anchors, opts) {
5759
6353
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5760
6354
  if (ctx === null)
5761
- throw new Error(OUTSIDE_CTX_MESSAGE35);
6355
+ throw new Error(OUTSIDE_CTX_MESSAGE38);
5762
6356
  const subId = nextSubId(ctx, slotId);
5763
6357
  const { labels, ...style } = opts;
5764
6358
  const state2 = labels === void 0 ? { kind: "elliott-triangle-wave", anchors, style } : { kind: "elliott-triangle-wave", anchors, labels, style };
@@ -5766,17 +6360,17 @@ function elliottTriangleWaveImpl(slotId, anchors, opts) {
5766
6360
  }
5767
6361
  function elliottTriangleWave(arg1, arg2, arg3) {
5768
6362
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5769
- throw new Error(OUTSIDE_CTX_MESSAGE35);
6363
+ throw new Error(OUTSIDE_CTX_MESSAGE38);
5770
6364
  }
5771
6365
  return elliottTriangleWaveImpl(arg1, arg2, arg3 ?? {});
5772
6366
  }
5773
6367
 
5774
6368
  // ../runtime/dist/emit/draw/elliott/elliottTripleCombo.js
5775
- var OUTSIDE_CTX_MESSAGE36 = "draw.elliottTripleCombo called outside an active script step";
6369
+ var OUTSIDE_CTX_MESSAGE39 = "draw.elliottTripleCombo called outside an active script step";
5776
6370
  function elliottTripleComboImpl(slotId, anchors, opts) {
5777
6371
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5778
6372
  if (ctx === null)
5779
- throw new Error(OUTSIDE_CTX_MESSAGE36);
6373
+ throw new Error(OUTSIDE_CTX_MESSAGE39);
5780
6374
  const subId = nextSubId(ctx, slotId);
5781
6375
  const { labels, ...style } = opts;
5782
6376
  const state2 = labels === void 0 ? { kind: "elliott-triple-combo", anchors, style } : { kind: "elliott-triple-combo", anchors, labels, style };
@@ -5784,34 +6378,34 @@ function elliottTripleComboImpl(slotId, anchors, opts) {
5784
6378
  }
5785
6379
  function elliottTripleCombo(arg1, arg2, arg3) {
5786
6380
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5787
- throw new Error(OUTSIDE_CTX_MESSAGE36);
6381
+ throw new Error(OUTSIDE_CTX_MESSAGE39);
5788
6382
  }
5789
6383
  return elliottTripleComboImpl(arg1, arg2, arg3 ?? {});
5790
6384
  }
5791
6385
 
5792
6386
  // ../runtime/dist/emit/draw/fibA/fibChannel.js
5793
- var OUTSIDE_CTX_MESSAGE37 = "draw.fibChannel called outside an active script step";
6387
+ var OUTSIDE_CTX_MESSAGE40 = "draw.fibChannel called outside an active script step";
5794
6388
  function fibChannelImpl(slotId, anchors, opts) {
5795
6389
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5796
6390
  if (ctx === null)
5797
- throw new Error(OUTSIDE_CTX_MESSAGE37);
6391
+ throw new Error(OUTSIDE_CTX_MESSAGE40);
5798
6392
  const subId = nextSubId(ctx, slotId);
5799
6393
  const state2 = { kind: "fib-channel", anchors, style: opts };
5800
6394
  return createDrawingHandle(slotId, subId, "fib-channel", state2);
5801
6395
  }
5802
6396
  function fibChannel(arg1, arg2, arg3) {
5803
6397
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5804
- throw new Error(OUTSIDE_CTX_MESSAGE37);
6398
+ throw new Error(OUTSIDE_CTX_MESSAGE40);
5805
6399
  }
5806
6400
  return fibChannelImpl(arg1, arg2, arg3 ?? {});
5807
6401
  }
5808
6402
 
5809
6403
  // ../runtime/dist/emit/draw/fibA/fibRetracement.js
5810
- var OUTSIDE_CTX_MESSAGE38 = "draw.fibRetracement called outside an active script step";
6404
+ var OUTSIDE_CTX_MESSAGE41 = "draw.fibRetracement called outside an active script step";
5811
6405
  function fibRetracementImpl(slotId, a, b, opts) {
5812
6406
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5813
6407
  if (ctx === null)
5814
- throw new Error(OUTSIDE_CTX_MESSAGE38);
6408
+ throw new Error(OUTSIDE_CTX_MESSAGE41);
5815
6409
  const subId = nextSubId(ctx, slotId);
5816
6410
  const state2 = {
5817
6411
  kind: "fib-retracement",
@@ -5822,17 +6416,17 @@ function fibRetracementImpl(slotId, a, b, opts) {
5822
6416
  }
5823
6417
  function fibRetracement(arg1, arg2, arg3, arg4) {
5824
6418
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5825
- throw new Error(OUTSIDE_CTX_MESSAGE38);
6419
+ throw new Error(OUTSIDE_CTX_MESSAGE41);
5826
6420
  }
5827
6421
  return fibRetracementImpl(arg1, arg2, arg3, arg4 ?? {});
5828
6422
  }
5829
6423
 
5830
6424
  // ../runtime/dist/emit/draw/fibA/fibTimeZone.js
5831
- var OUTSIDE_CTX_MESSAGE39 = "draw.fibTimeZone called outside an active script step";
6425
+ var OUTSIDE_CTX_MESSAGE42 = "draw.fibTimeZone called outside an active script step";
5832
6426
  function fibTimeZoneImpl(slotId, a, b, opts) {
5833
6427
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5834
6428
  if (ctx === null)
5835
- throw new Error(OUTSIDE_CTX_MESSAGE39);
6429
+ throw new Error(OUTSIDE_CTX_MESSAGE42);
5836
6430
  const subId = nextSubId(ctx, slotId);
5837
6431
  const state2 = {
5838
6432
  kind: "fib-time-zone",
@@ -5843,17 +6437,17 @@ function fibTimeZoneImpl(slotId, a, b, opts) {
5843
6437
  }
5844
6438
  function fibTimeZone(arg1, arg2, arg3, arg4) {
5845
6439
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5846
- throw new Error(OUTSIDE_CTX_MESSAGE39);
6440
+ throw new Error(OUTSIDE_CTX_MESSAGE42);
5847
6441
  }
5848
6442
  return fibTimeZoneImpl(arg1, arg2, arg3, arg4 ?? {});
5849
6443
  }
5850
6444
 
5851
6445
  // ../runtime/dist/emit/draw/fibA/fibTrendExtension.js
5852
- var OUTSIDE_CTX_MESSAGE40 = "draw.fibTrendExtension called outside an active script step";
6446
+ var OUTSIDE_CTX_MESSAGE43 = "draw.fibTrendExtension called outside an active script step";
5853
6447
  function fibTrendExtensionImpl(slotId, anchors, opts) {
5854
6448
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5855
6449
  if (ctx === null)
5856
- throw new Error(OUTSIDE_CTX_MESSAGE40);
6450
+ throw new Error(OUTSIDE_CTX_MESSAGE43);
5857
6451
  const subId = nextSubId(ctx, slotId);
5858
6452
  const state2 = {
5859
6453
  kind: "fib-trend-extension",
@@ -5864,34 +6458,34 @@ function fibTrendExtensionImpl(slotId, anchors, opts) {
5864
6458
  }
5865
6459
  function fibTrendExtension(arg1, arg2, arg3) {
5866
6460
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5867
- throw new Error(OUTSIDE_CTX_MESSAGE40);
6461
+ throw new Error(OUTSIDE_CTX_MESSAGE43);
5868
6462
  }
5869
6463
  return fibTrendExtensionImpl(arg1, arg2, arg3 ?? {});
5870
6464
  }
5871
6465
 
5872
6466
  // ../runtime/dist/emit/draw/fibA/fibWedge.js
5873
- var OUTSIDE_CTX_MESSAGE41 = "draw.fibWedge called outside an active script step";
6467
+ var OUTSIDE_CTX_MESSAGE44 = "draw.fibWedge called outside an active script step";
5874
6468
  function fibWedgeImpl(slotId, anchors, opts) {
5875
6469
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5876
6470
  if (ctx === null)
5877
- throw new Error(OUTSIDE_CTX_MESSAGE41);
6471
+ throw new Error(OUTSIDE_CTX_MESSAGE44);
5878
6472
  const subId = nextSubId(ctx, slotId);
5879
6473
  const state2 = { kind: "fib-wedge", anchors, style: opts };
5880
6474
  return createDrawingHandle(slotId, subId, "fib-wedge", state2);
5881
6475
  }
5882
6476
  function fibWedge(arg1, arg2, arg3) {
5883
6477
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5884
- throw new Error(OUTSIDE_CTX_MESSAGE41);
6478
+ throw new Error(OUTSIDE_CTX_MESSAGE44);
5885
6479
  }
5886
6480
  return fibWedgeImpl(arg1, arg2, arg3 ?? {});
5887
6481
  }
5888
6482
 
5889
6483
  // ../runtime/dist/emit/draw/fibB/fibCircles.js
5890
- var OUTSIDE_CTX_MESSAGE42 = "draw.fibCircles called outside an active script step";
6484
+ var OUTSIDE_CTX_MESSAGE45 = "draw.fibCircles called outside an active script step";
5891
6485
  function fibCirclesImpl(slotId, a, b, opts) {
5892
6486
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5893
6487
  if (ctx === null)
5894
- throw new Error(OUTSIDE_CTX_MESSAGE42);
6488
+ throw new Error(OUTSIDE_CTX_MESSAGE45);
5895
6489
  const subId = nextSubId(ctx, slotId);
5896
6490
  const state2 = {
5897
6491
  kind: "fib-circles",
@@ -5902,17 +6496,17 @@ function fibCirclesImpl(slotId, a, b, opts) {
5902
6496
  }
5903
6497
  function fibCircles(arg1, arg2, arg3, arg4) {
5904
6498
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5905
- throw new Error(OUTSIDE_CTX_MESSAGE42);
6499
+ throw new Error(OUTSIDE_CTX_MESSAGE45);
5906
6500
  }
5907
6501
  return fibCirclesImpl(arg1, arg2, arg3, arg4 ?? {});
5908
6502
  }
5909
6503
 
5910
6504
  // ../runtime/dist/emit/draw/fibB/fibSpeedArcs.js
5911
- var OUTSIDE_CTX_MESSAGE43 = "draw.fibSpeedArcs called outside an active script step";
6505
+ var OUTSIDE_CTX_MESSAGE46 = "draw.fibSpeedArcs called outside an active script step";
5912
6506
  function fibSpeedArcsImpl(slotId, a, b, opts) {
5913
6507
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5914
6508
  if (ctx === null)
5915
- throw new Error(OUTSIDE_CTX_MESSAGE43);
6509
+ throw new Error(OUTSIDE_CTX_MESSAGE46);
5916
6510
  const subId = nextSubId(ctx, slotId);
5917
6511
  const state2 = {
5918
6512
  kind: "fib-speed-arcs",
@@ -5923,17 +6517,17 @@ function fibSpeedArcsImpl(slotId, a, b, opts) {
5923
6517
  }
5924
6518
  function fibSpeedArcs(arg1, arg2, arg3, arg4) {
5925
6519
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5926
- throw new Error(OUTSIDE_CTX_MESSAGE43);
6520
+ throw new Error(OUTSIDE_CTX_MESSAGE46);
5927
6521
  }
5928
6522
  return fibSpeedArcsImpl(arg1, arg2, arg3, arg4 ?? {});
5929
6523
  }
5930
6524
 
5931
6525
  // ../runtime/dist/emit/draw/fibB/fibSpeedFan.js
5932
- var OUTSIDE_CTX_MESSAGE44 = "draw.fibSpeedFan called outside an active script step";
6526
+ var OUTSIDE_CTX_MESSAGE47 = "draw.fibSpeedFan called outside an active script step";
5933
6527
  function fibSpeedFanImpl(slotId, a, b, opts) {
5934
6528
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5935
6529
  if (ctx === null)
5936
- throw new Error(OUTSIDE_CTX_MESSAGE44);
6530
+ throw new Error(OUTSIDE_CTX_MESSAGE47);
5937
6531
  const subId = nextSubId(ctx, slotId);
5938
6532
  const state2 = {
5939
6533
  kind: "fib-speed-fan",
@@ -5944,17 +6538,17 @@ function fibSpeedFanImpl(slotId, a, b, opts) {
5944
6538
  }
5945
6539
  function fibSpeedFan(arg1, arg2, arg3, arg4) {
5946
6540
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5947
- throw new Error(OUTSIDE_CTX_MESSAGE44);
6541
+ throw new Error(OUTSIDE_CTX_MESSAGE47);
5948
6542
  }
5949
6543
  return fibSpeedFanImpl(arg1, arg2, arg3, arg4 ?? {});
5950
6544
  }
5951
6545
 
5952
6546
  // ../runtime/dist/emit/draw/fibB/fibSpiral.js
5953
- var OUTSIDE_CTX_MESSAGE45 = "draw.fibSpiral called outside an active script step";
6547
+ var OUTSIDE_CTX_MESSAGE48 = "draw.fibSpiral called outside an active script step";
5954
6548
  function fibSpiralImpl(slotId, a, b, opts) {
5955
6549
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5956
6550
  if (ctx === null)
5957
- throw new Error(OUTSIDE_CTX_MESSAGE45);
6551
+ throw new Error(OUTSIDE_CTX_MESSAGE48);
5958
6552
  const subId = nextSubId(ctx, slotId);
5959
6553
  const state2 = {
5960
6554
  kind: "fib-spiral",
@@ -5965,17 +6559,17 @@ function fibSpiralImpl(slotId, a, b, opts) {
5965
6559
  }
5966
6560
  function fibSpiral(arg1, arg2, arg3, arg4) {
5967
6561
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
5968
- throw new Error(OUTSIDE_CTX_MESSAGE45);
6562
+ throw new Error(OUTSIDE_CTX_MESSAGE48);
5969
6563
  }
5970
6564
  return fibSpiralImpl(arg1, arg2, arg3, arg4 ?? {});
5971
6565
  }
5972
6566
 
5973
6567
  // ../runtime/dist/emit/draw/fibB/fibTrendTime.js
5974
- var OUTSIDE_CTX_MESSAGE46 = "draw.fibTrendTime called outside an active script step";
6568
+ var OUTSIDE_CTX_MESSAGE49 = "draw.fibTrendTime called outside an active script step";
5975
6569
  function fibTrendTimeImpl(slotId, anchors, opts) {
5976
6570
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5977
6571
  if (ctx === null)
5978
- throw new Error(OUTSIDE_CTX_MESSAGE46);
6572
+ throw new Error(OUTSIDE_CTX_MESSAGE49);
5979
6573
  const subId = nextSubId(ctx, slotId);
5980
6574
  const state2 = {
5981
6575
  kind: "fib-trend-time",
@@ -5986,17 +6580,17 @@ function fibTrendTimeImpl(slotId, anchors, opts) {
5986
6580
  }
5987
6581
  function fibTrendTime(arg1, arg2, arg3) {
5988
6582
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
5989
- throw new Error(OUTSIDE_CTX_MESSAGE46);
6583
+ throw new Error(OUTSIDE_CTX_MESSAGE49);
5990
6584
  }
5991
6585
  return fibTrendTimeImpl(arg1, arg2, arg3 ?? {});
5992
6586
  }
5993
6587
 
5994
6588
  // ../runtime/dist/emit/draw/gann/gannBox.js
5995
- var OUTSIDE_CTX_MESSAGE47 = "draw.gannBox called outside an active script step";
6589
+ var OUTSIDE_CTX_MESSAGE50 = "draw.gannBox called outside an active script step";
5996
6590
  function gannBoxImpl(slotId, a, b, opts) {
5997
6591
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
5998
6592
  if (ctx === null)
5999
- throw new Error(OUTSIDE_CTX_MESSAGE47);
6593
+ throw new Error(OUTSIDE_CTX_MESSAGE50);
6000
6594
  const subId = nextSubId(ctx, slotId);
6001
6595
  const state2 = {
6002
6596
  kind: "gann-box",
@@ -6007,17 +6601,17 @@ function gannBoxImpl(slotId, a, b, opts) {
6007
6601
  }
6008
6602
  function gannBox(arg1, arg2, arg3, arg4) {
6009
6603
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
6010
- throw new Error(OUTSIDE_CTX_MESSAGE47);
6604
+ throw new Error(OUTSIDE_CTX_MESSAGE50);
6011
6605
  }
6012
6606
  return gannBoxImpl(arg1, arg2, arg3, arg4 ?? {});
6013
6607
  }
6014
6608
 
6015
6609
  // ../runtime/dist/emit/draw/gann/gannFan.js
6016
- var OUTSIDE_CTX_MESSAGE48 = "draw.gannFan called outside an active script step";
6610
+ var OUTSIDE_CTX_MESSAGE51 = "draw.gannFan called outside an active script step";
6017
6611
  function gannFanImpl(slotId, a, b, opts) {
6018
6612
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6019
6613
  if (ctx === null)
6020
- throw new Error(OUTSIDE_CTX_MESSAGE48);
6614
+ throw new Error(OUTSIDE_CTX_MESSAGE51);
6021
6615
  const subId = nextSubId(ctx, slotId);
6022
6616
  const state2 = {
6023
6617
  kind: "gann-fan",
@@ -6028,17 +6622,17 @@ function gannFanImpl(slotId, a, b, opts) {
6028
6622
  }
6029
6623
  function gannFan(arg1, arg2, arg3, arg4) {
6030
6624
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
6031
- throw new Error(OUTSIDE_CTX_MESSAGE48);
6625
+ throw new Error(OUTSIDE_CTX_MESSAGE51);
6032
6626
  }
6033
6627
  return gannFanImpl(arg1, arg2, arg3, arg4 ?? {});
6034
6628
  }
6035
6629
 
6036
6630
  // ../runtime/dist/emit/draw/gann/gannSquare.js
6037
- var OUTSIDE_CTX_MESSAGE49 = "draw.gannSquare called outside an active script step";
6631
+ var OUTSIDE_CTX_MESSAGE52 = "draw.gannSquare called outside an active script step";
6038
6632
  function gannSquareImpl(slotId, a, b, opts) {
6039
6633
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6040
6634
  if (ctx === null)
6041
- throw new Error(OUTSIDE_CTX_MESSAGE49);
6635
+ throw new Error(OUTSIDE_CTX_MESSAGE52);
6042
6636
  const subId = nextSubId(ctx, slotId);
6043
6637
  const state2 = {
6044
6638
  kind: "gann-square",
@@ -6049,17 +6643,17 @@ function gannSquareImpl(slotId, a, b, opts) {
6049
6643
  }
6050
6644
  function gannSquare(arg1, arg2, arg3, arg4) {
6051
6645
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
6052
- throw new Error(OUTSIDE_CTX_MESSAGE49);
6646
+ throw new Error(OUTSIDE_CTX_MESSAGE52);
6053
6647
  }
6054
6648
  return gannSquareImpl(arg1, arg2, arg3, arg4 ?? {});
6055
6649
  }
6056
6650
 
6057
6651
  // ../runtime/dist/emit/draw/gann/gannSquareFixed.js
6058
- var OUTSIDE_CTX_MESSAGE50 = "draw.gannSquareFixed called outside an active script step";
6652
+ var OUTSIDE_CTX_MESSAGE53 = "draw.gannSquareFixed called outside an active script step";
6059
6653
  function gannSquareFixedImpl(slotId, anchor, opts) {
6060
6654
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6061
6655
  if (ctx === null)
6062
- throw new Error(OUTSIDE_CTX_MESSAGE50);
6656
+ throw new Error(OUTSIDE_CTX_MESSAGE53);
6063
6657
  const subId = nextSubId(ctx, slotId);
6064
6658
  const state2 = {
6065
6659
  kind: "gann-square-fixed",
@@ -6070,153 +6664,153 @@ function gannSquareFixedImpl(slotId, anchor, opts) {
6070
6664
  }
6071
6665
  function gannSquareFixed(arg1, arg2, arg3) {
6072
6666
  if (typeof arg1 !== "string" || arg2 === void 0) {
6073
- throw new Error(OUTSIDE_CTX_MESSAGE50);
6667
+ throw new Error(OUTSIDE_CTX_MESSAGE53);
6074
6668
  }
6075
6669
  return gannSquareFixedImpl(arg1, arg2, arg3 ?? {});
6076
6670
  }
6077
6671
 
6078
6672
  // ../runtime/dist/emit/draw/lines/crossLine.js
6079
- var OUTSIDE_CTX_MESSAGE51 = "draw.crossLine called outside an active script step";
6673
+ var OUTSIDE_CTX_MESSAGE54 = "draw.crossLine called outside an active script step";
6080
6674
  function crossLineImpl(slotId, anchor, opts) {
6081
6675
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6082
6676
  if (ctx === null)
6083
- throw new Error(OUTSIDE_CTX_MESSAGE51);
6677
+ throw new Error(OUTSIDE_CTX_MESSAGE54);
6084
6678
  const subId = nextSubId(ctx, slotId);
6085
6679
  const state2 = { kind: "cross-line", anchor, style: opts };
6086
6680
  return createDrawingHandle(slotId, subId, "cross-line", state2);
6087
6681
  }
6088
6682
  function crossLine(arg1, arg2, arg3) {
6089
6683
  if (typeof arg1 !== "string" || arg2 === void 0 || typeof arg2 !== "object") {
6090
- throw new Error(OUTSIDE_CTX_MESSAGE51);
6684
+ throw new Error(OUTSIDE_CTX_MESSAGE54);
6091
6685
  }
6092
6686
  return crossLineImpl(arg1, arg2, arg3 ?? {});
6093
6687
  }
6094
6688
 
6095
6689
  // ../runtime/dist/emit/draw/lines/horizontalLine.js
6096
- var OUTSIDE_CTX_MESSAGE52 = "draw.horizontalLine called outside an active script step";
6690
+ var OUTSIDE_CTX_MESSAGE55 = "draw.horizontalLine called outside an active script step";
6097
6691
  function horizontalLineImpl(slotId, price, opts) {
6098
6692
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6099
6693
  if (ctx === null)
6100
- throw new Error(OUTSIDE_CTX_MESSAGE52);
6694
+ throw new Error(OUTSIDE_CTX_MESSAGE55);
6101
6695
  const subId = nextSubId(ctx, slotId);
6102
6696
  const state2 = { kind: "horizontal-line", price, style: opts };
6103
6697
  return createDrawingHandle(slotId, subId, "horizontal-line", state2);
6104
6698
  }
6105
6699
  function horizontalLine(arg1, arg2, arg3) {
6106
6700
  if (typeof arg1 !== "string" || typeof arg2 !== "number") {
6107
- throw new Error(OUTSIDE_CTX_MESSAGE52);
6701
+ throw new Error(OUTSIDE_CTX_MESSAGE55);
6108
6702
  }
6109
6703
  return horizontalLineImpl(arg1, arg2, arg3 ?? {});
6110
6704
  }
6111
6705
 
6112
6706
  // ../runtime/dist/emit/draw/lines/horizontalRay.js
6113
- var OUTSIDE_CTX_MESSAGE53 = "draw.horizontalRay called outside an active script step";
6707
+ var OUTSIDE_CTX_MESSAGE56 = "draw.horizontalRay called outside an active script step";
6114
6708
  function horizontalRayImpl(slotId, anchor, opts) {
6115
6709
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6116
6710
  if (ctx === null)
6117
- throw new Error(OUTSIDE_CTX_MESSAGE53);
6711
+ throw new Error(OUTSIDE_CTX_MESSAGE56);
6118
6712
  const subId = nextSubId(ctx, slotId);
6119
6713
  const state2 = { kind: "horizontal-ray", anchor, style: opts };
6120
6714
  return createDrawingHandle(slotId, subId, "horizontal-ray", state2);
6121
6715
  }
6122
6716
  function horizontalRay(arg1, arg2, arg3) {
6123
6717
  if (typeof arg1 !== "string" || arg2 === void 0 || typeof arg2 !== "object") {
6124
- throw new Error(OUTSIDE_CTX_MESSAGE53);
6718
+ throw new Error(OUTSIDE_CTX_MESSAGE56);
6125
6719
  }
6126
6720
  return horizontalRayImpl(arg1, arg2, arg3 ?? {});
6127
6721
  }
6128
6722
 
6129
6723
  // ../runtime/dist/emit/draw/lines/line.js
6130
- var OUTSIDE_CTX_MESSAGE54 = "draw.line called outside an active script step";
6724
+ var OUTSIDE_CTX_MESSAGE57 = "draw.line called outside an active script step";
6131
6725
  function lineImpl(slotId, a, b, opts) {
6132
6726
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6133
6727
  if (ctx === null)
6134
- throw new Error(OUTSIDE_CTX_MESSAGE54);
6728
+ throw new Error(OUTSIDE_CTX_MESSAGE57);
6135
6729
  const subId = nextSubId(ctx, slotId);
6136
6730
  const state2 = { kind: "line", anchors: [a, b], style: opts };
6137
6731
  return createDrawingHandle(slotId, subId, "line", state2);
6138
6732
  }
6139
6733
  function line(arg1, arg2, arg3, arg4) {
6140
6734
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
6141
- throw new Error(OUTSIDE_CTX_MESSAGE54);
6735
+ throw new Error(OUTSIDE_CTX_MESSAGE57);
6142
6736
  }
6143
6737
  return lineImpl(arg1, arg2, arg3, arg4 ?? {});
6144
6738
  }
6145
6739
 
6146
6740
  // ../runtime/dist/emit/draw/lines/trendAngle.js
6147
- var OUTSIDE_CTX_MESSAGE55 = "draw.trendAngle called outside an active script step";
6741
+ var OUTSIDE_CTX_MESSAGE58 = "draw.trendAngle called outside an active script step";
6148
6742
  function trendAngleImpl(slotId, a, b, opts) {
6149
6743
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6150
6744
  if (ctx === null)
6151
- throw new Error(OUTSIDE_CTX_MESSAGE55);
6745
+ throw new Error(OUTSIDE_CTX_MESSAGE58);
6152
6746
  const subId = nextSubId(ctx, slotId);
6153
6747
  const state2 = { kind: "trend-angle", anchors: [a, b], style: opts };
6154
6748
  return createDrawingHandle(slotId, subId, "trend-angle", state2);
6155
6749
  }
6156
6750
  function trendAngle(arg1, arg2, arg3, arg4) {
6157
6751
  if (typeof arg1 !== "string" || arg2 === void 0 || arg3 === void 0) {
6158
- throw new Error(OUTSIDE_CTX_MESSAGE55);
6752
+ throw new Error(OUTSIDE_CTX_MESSAGE58);
6159
6753
  }
6160
6754
  return trendAngleImpl(arg1, arg2, arg3, arg4 ?? {});
6161
6755
  }
6162
6756
 
6163
6757
  // ../runtime/dist/emit/draw/lines/verticalLine.js
6164
- var OUTSIDE_CTX_MESSAGE56 = "draw.verticalLine called outside an active script step";
6165
- function verticalLineImpl(slotId, time, opts) {
6758
+ var OUTSIDE_CTX_MESSAGE59 = "draw.verticalLine called outside an active script step";
6759
+ function verticalLineImpl(slotId, time2, opts) {
6166
6760
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6167
6761
  if (ctx === null)
6168
- throw new Error(OUTSIDE_CTX_MESSAGE56);
6762
+ throw new Error(OUTSIDE_CTX_MESSAGE59);
6169
6763
  const subId = nextSubId(ctx, slotId);
6170
- const state2 = { kind: "vertical-line", time, style: opts };
6764
+ const state2 = { kind: "vertical-line", time: time2, style: opts };
6171
6765
  return createDrawingHandle(slotId, subId, "vertical-line", state2);
6172
6766
  }
6173
6767
  function verticalLine(arg1, arg2, arg3) {
6174
6768
  if (typeof arg1 !== "string" || typeof arg2 !== "number") {
6175
- throw new Error(OUTSIDE_CTX_MESSAGE56);
6769
+ throw new Error(OUTSIDE_CTX_MESSAGE59);
6176
6770
  }
6177
6771
  return verticalLineImpl(arg1, arg2, arg3 ?? {});
6178
6772
  }
6179
6773
 
6180
6774
  // ../runtime/dist/emit/draw/patterns/abcdPattern.js
6181
- var OUTSIDE_CTX_MESSAGE57 = "draw.abcdPattern called outside an active script step";
6775
+ var OUTSIDE_CTX_MESSAGE60 = "draw.abcdPattern called outside an active script step";
6182
6776
  function abcdPatternImpl(slotId, anchors, opts) {
6183
6777
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6184
6778
  if (ctx === null)
6185
- throw new Error(OUTSIDE_CTX_MESSAGE57);
6779
+ throw new Error(OUTSIDE_CTX_MESSAGE60);
6186
6780
  const subId = nextSubId(ctx, slotId);
6187
6781
  const state2 = { kind: "abcd-pattern", anchors, style: opts };
6188
6782
  return createDrawingHandle(slotId, subId, "abcd-pattern", state2);
6189
6783
  }
6190
6784
  function abcdPattern(arg1, arg2, arg3) {
6191
6785
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6192
- throw new Error(OUTSIDE_CTX_MESSAGE57);
6786
+ throw new Error(OUTSIDE_CTX_MESSAGE60);
6193
6787
  }
6194
6788
  return abcdPatternImpl(arg1, arg2, arg3 ?? {});
6195
6789
  }
6196
6790
 
6197
6791
  // ../runtime/dist/emit/draw/patterns/cypherPattern.js
6198
- var OUTSIDE_CTX_MESSAGE58 = "draw.cypherPattern called outside an active script step";
6792
+ var OUTSIDE_CTX_MESSAGE61 = "draw.cypherPattern called outside an active script step";
6199
6793
  function cypherPatternImpl(slotId, anchors, opts) {
6200
6794
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6201
6795
  if (ctx === null)
6202
- throw new Error(OUTSIDE_CTX_MESSAGE58);
6796
+ throw new Error(OUTSIDE_CTX_MESSAGE61);
6203
6797
  const subId = nextSubId(ctx, slotId);
6204
6798
  const state2 = { kind: "cypher-pattern", anchors, style: opts };
6205
6799
  return createDrawingHandle(slotId, subId, "cypher-pattern", state2);
6206
6800
  }
6207
6801
  function cypherPattern(arg1, arg2, arg3) {
6208
6802
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6209
- throw new Error(OUTSIDE_CTX_MESSAGE58);
6803
+ throw new Error(OUTSIDE_CTX_MESSAGE61);
6210
6804
  }
6211
6805
  return cypherPatternImpl(arg1, arg2, arg3 ?? {});
6212
6806
  }
6213
6807
 
6214
6808
  // ../runtime/dist/emit/draw/patterns/headAndShoulders.js
6215
- var OUTSIDE_CTX_MESSAGE59 = "draw.headAndShoulders called outside an active script step";
6809
+ var OUTSIDE_CTX_MESSAGE62 = "draw.headAndShoulders called outside an active script step";
6216
6810
  function headAndShouldersImpl(slotId, anchors, opts) {
6217
6811
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6218
6812
  if (ctx === null)
6219
- throw new Error(OUTSIDE_CTX_MESSAGE59);
6813
+ throw new Error(OUTSIDE_CTX_MESSAGE62);
6220
6814
  const subId = nextSubId(ctx, slotId);
6221
6815
  const state2 = {
6222
6816
  kind: "head-and-shoulders",
@@ -6227,17 +6821,17 @@ function headAndShouldersImpl(slotId, anchors, opts) {
6227
6821
  }
6228
6822
  function headAndShoulders(arg1, arg2, arg3) {
6229
6823
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6230
- throw new Error(OUTSIDE_CTX_MESSAGE59);
6824
+ throw new Error(OUTSIDE_CTX_MESSAGE62);
6231
6825
  }
6232
6826
  return headAndShouldersImpl(arg1, arg2, arg3 ?? {});
6233
6827
  }
6234
6828
 
6235
6829
  // ../runtime/dist/emit/draw/patterns/threeDrivesPattern.js
6236
- var OUTSIDE_CTX_MESSAGE60 = "draw.threeDrivesPattern called outside an active script step";
6830
+ var OUTSIDE_CTX_MESSAGE63 = "draw.threeDrivesPattern called outside an active script step";
6237
6831
  function threeDrivesPatternImpl(slotId, anchors, opts) {
6238
6832
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6239
6833
  if (ctx === null)
6240
- throw new Error(OUTSIDE_CTX_MESSAGE60);
6834
+ throw new Error(OUTSIDE_CTX_MESSAGE63);
6241
6835
  const subId = nextSubId(ctx, slotId);
6242
6836
  const state2 = {
6243
6837
  kind: "three-drives-pattern",
@@ -6248,17 +6842,17 @@ function threeDrivesPatternImpl(slotId, anchors, opts) {
6248
6842
  }
6249
6843
  function threeDrivesPattern(arg1, arg2, arg3) {
6250
6844
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6251
- throw new Error(OUTSIDE_CTX_MESSAGE60);
6845
+ throw new Error(OUTSIDE_CTX_MESSAGE63);
6252
6846
  }
6253
6847
  return threeDrivesPatternImpl(arg1, arg2, arg3 ?? {});
6254
6848
  }
6255
6849
 
6256
6850
  // ../runtime/dist/emit/draw/patterns/trianglePattern.js
6257
- var OUTSIDE_CTX_MESSAGE61 = "draw.trianglePattern called outside an active script step";
6851
+ var OUTSIDE_CTX_MESSAGE64 = "draw.trianglePattern called outside an active script step";
6258
6852
  function trianglePatternImpl(slotId, anchors, opts) {
6259
6853
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6260
6854
  if (ctx === null)
6261
- throw new Error(OUTSIDE_CTX_MESSAGE61);
6855
+ throw new Error(OUTSIDE_CTX_MESSAGE64);
6262
6856
  const subId = nextSubId(ctx, slotId);
6263
6857
  const state2 = {
6264
6858
  kind: "triangle-pattern",
@@ -6269,51 +6863,51 @@ function trianglePatternImpl(slotId, anchors, opts) {
6269
6863
  }
6270
6864
  function trianglePattern(arg1, arg2, arg3) {
6271
6865
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6272
- throw new Error(OUTSIDE_CTX_MESSAGE61);
6866
+ throw new Error(OUTSIDE_CTX_MESSAGE64);
6273
6867
  }
6274
6868
  return trianglePatternImpl(arg1, arg2, arg3 ?? {});
6275
6869
  }
6276
6870
 
6277
6871
  // ../runtime/dist/emit/draw/patterns/xabcdPattern.js
6278
- var OUTSIDE_CTX_MESSAGE62 = "draw.xabcdPattern called outside an active script step";
6872
+ var OUTSIDE_CTX_MESSAGE65 = "draw.xabcdPattern called outside an active script step";
6279
6873
  function xabcdPatternImpl(slotId, anchors, opts) {
6280
6874
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6281
6875
  if (ctx === null)
6282
- throw new Error(OUTSIDE_CTX_MESSAGE62);
6876
+ throw new Error(OUTSIDE_CTX_MESSAGE65);
6283
6877
  const subId = nextSubId(ctx, slotId);
6284
6878
  const state2 = { kind: "xabcd-pattern", anchors, style: opts };
6285
6879
  return createDrawingHandle(slotId, subId, "xabcd-pattern", state2);
6286
6880
  }
6287
6881
  function xabcdPattern(arg1, arg2, arg3) {
6288
6882
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6289
- throw new Error(OUTSIDE_CTX_MESSAGE62);
6883
+ throw new Error(OUTSIDE_CTX_MESSAGE65);
6290
6884
  }
6291
6885
  return xabcdPatternImpl(arg1, arg2, arg3 ?? {});
6292
6886
  }
6293
6887
 
6294
6888
  // ../runtime/dist/emit/draw/pitchforks/pitchfan.js
6295
- var OUTSIDE_CTX_MESSAGE63 = "draw.pitchfan called outside an active script step";
6889
+ var OUTSIDE_CTX_MESSAGE66 = "draw.pitchfan called outside an active script step";
6296
6890
  function pitchfanImpl(slotId, anchors, opts) {
6297
6891
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6298
6892
  if (ctx === null)
6299
- throw new Error(OUTSIDE_CTX_MESSAGE63);
6893
+ throw new Error(OUTSIDE_CTX_MESSAGE66);
6300
6894
  const subId = nextSubId(ctx, slotId);
6301
6895
  const state2 = { kind: "pitchfan", anchors, style: opts };
6302
6896
  return createDrawingHandle(slotId, subId, "pitchfan", state2);
6303
6897
  }
6304
6898
  function pitchfan(arg1, arg2, arg3) {
6305
6899
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6306
- throw new Error(OUTSIDE_CTX_MESSAGE63);
6900
+ throw new Error(OUTSIDE_CTX_MESSAGE66);
6307
6901
  }
6308
6902
  return pitchfanImpl(arg1, arg2, arg3 ?? {});
6309
6903
  }
6310
6904
 
6311
6905
  // ../runtime/dist/emit/draw/pitchforks/pitchfork.js
6312
- var OUTSIDE_CTX_MESSAGE64 = "draw.pitchfork called outside an active script step";
6906
+ var OUTSIDE_CTX_MESSAGE67 = "draw.pitchfork called outside an active script step";
6313
6907
  function pitchforkImpl(slotId, anchors, opts) {
6314
6908
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6315
6909
  if (ctx === null)
6316
- throw new Error(OUTSIDE_CTX_MESSAGE64);
6910
+ throw new Error(OUTSIDE_CTX_MESSAGE67);
6317
6911
  const subId = nextSubId(ctx, slotId);
6318
6912
  const { variant: variantOpt, ...style } = opts;
6319
6913
  const state2 = {
@@ -6326,17 +6920,17 @@ function pitchforkImpl(slotId, anchors, opts) {
6326
6920
  }
6327
6921
  function pitchfork(arg1, arg2, arg3) {
6328
6922
  if (typeof arg1 !== "string" || arg2 === void 0 || !Array.isArray(arg2)) {
6329
- throw new Error(OUTSIDE_CTX_MESSAGE64);
6923
+ throw new Error(OUTSIDE_CTX_MESSAGE67);
6330
6924
  }
6331
6925
  return pitchforkImpl(arg1, arg2, arg3 ?? {});
6332
6926
  }
6333
6927
 
6334
6928
  // ../runtime/dist/emit/draw/table/table.js
6335
- var OUTSIDE_CTX_MESSAGE65 = "draw.table called outside an active script step";
6929
+ var OUTSIDE_CTX_MESSAGE68 = "draw.table called outside an active script step";
6336
6930
  function tableImpl(slotId, opts) {
6337
6931
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6338
6932
  if (ctx === null)
6339
- throw new Error(OUTSIDE_CTX_MESSAGE65);
6933
+ throw new Error(OUTSIDE_CTX_MESSAGE68);
6340
6934
  const subId = nextSubId(ctx, slotId);
6341
6935
  const state2 = {
6342
6936
  kind: "table",
@@ -6350,7 +6944,7 @@ function tableImpl(slotId, opts) {
6350
6944
  }
6351
6945
  function table2(arg1, arg2) {
6352
6946
  if (typeof arg1 !== "string" || arg2 === void 0) {
6353
- throw new Error(OUTSIDE_CTX_MESSAGE65);
6947
+ throw new Error(OUTSIDE_CTX_MESSAGE68);
6354
6948
  }
6355
6949
  return tableImpl(arg1, arg2);
6356
6950
  }
@@ -6449,7 +7043,7 @@ var DRAW_NAMESPACE = new Proxy(KIND_IMPLS, {
6449
7043
  });
6450
7044
 
6451
7045
  // ../runtime/dist/emit/hline.js
6452
- var OUTSIDE_CTX_MESSAGE66 = "hline called outside an active script step";
7046
+ var OUTSIDE_CTX_MESSAGE69 = "hline called outside an active script step";
6453
7047
  function hlineImpl(ctx, slotId, price, opts) {
6454
7048
  const style = {
6455
7049
  kind: "horizontal-line",
@@ -6484,13 +7078,13 @@ function hlineImpl(ctx, slotId, price, opts) {
6484
7078
  }
6485
7079
  function hline2(arg1, arg2, arg3) {
6486
7080
  if (typeof arg1 !== "string") {
6487
- throw new Error(OUTSIDE_CTX_MESSAGE66);
7081
+ throw new Error(OUTSIDE_CTX_MESSAGE69);
6488
7082
  }
6489
7083
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6490
7084
  if (!ctx)
6491
- throw new Error(OUTSIDE_CTX_MESSAGE66);
7085
+ throw new Error(OUTSIDE_CTX_MESSAGE69);
6492
7086
  if (typeof arg2 !== "number") {
6493
- throw new Error(OUTSIDE_CTX_MESSAGE66);
7087
+ throw new Error(OUTSIDE_CTX_MESSAGE69);
6494
7088
  }
6495
7089
  hlineImpl(ctx, arg1, arg2, arg3 ?? {});
6496
7090
  }
@@ -6607,122 +7201,6 @@ function buildRuntimeNamespace(ctx) {
6607
7201
  });
6608
7202
  }
6609
7203
 
6610
- // ../runtime/dist/emit/plot.js
6611
- var OUTSIDE_CTX_MESSAGE67 = "plot called outside an active script step";
6612
- function isSeriesNumber(v) {
6613
- return typeof v === "object" && v !== null && "current" in v;
6614
- }
6615
- function isNumberOrSeries(v) {
6616
- return typeof v === "number" || isSeriesNumber(v);
6617
- }
6618
- function resolveValue(value) {
6619
- const resolved = typeof value === "number" ? value : value.current;
6620
- return Number.isFinite(resolved) ? resolved : null;
6621
- }
6622
- function buildStyle(opts) {
6623
- const style = opts.style;
6624
- if (style === void 0) {
6625
- return {
6626
- kind: "line",
6627
- lineWidth: opts.lineWidth ?? 1,
6628
- lineStyle: opts.lineStyle ?? "solid"
6629
- };
6630
- }
6631
- switch (style.kind) {
6632
- case "histogram":
6633
- return { kind: "histogram", baseline: style.baseline ?? 0 };
6634
- case "marker":
6635
- return { kind: "marker", shape: style.shape, size: style.size };
6636
- case "shape":
6637
- return {
6638
- kind: "shape",
6639
- shape: style.shape,
6640
- size: style.size,
6641
- ...style.location === void 0 ? {} : { location: style.location }
6642
- };
6643
- case "character":
6644
- return {
6645
- kind: "character",
6646
- char: style.char,
6647
- size: style.size,
6648
- ...style.location === void 0 ? {} : { location: style.location }
6649
- };
6650
- case "arrow":
6651
- return { kind: "arrow", direction: style.direction, size: style.size };
6652
- case "candle-override":
6653
- return {
6654
- kind: "candle-override",
6655
- bull: style.bull,
6656
- bear: style.bear,
6657
- ...style.doji === void 0 ? {} : { doji: style.doji }
6658
- };
6659
- case "bar-override":
6660
- return { kind: "bar-override", color: style.color };
6661
- case "bg-color":
6662
- return {
6663
- kind: "bg-color",
6664
- color: style.color,
6665
- ...style.transp === void 0 ? {} : { transp: style.transp }
6666
- };
6667
- case "bar-color":
6668
- return { kind: "bar-color", color: style.color };
6669
- case "horizontal-histogram":
6670
- return { kind: "horizontal-histogram", buckets: style.buckets };
6671
- case "line":
6672
- case "step-line":
6673
- case "horizontal-line":
6674
- return {
6675
- kind: style.kind,
6676
- lineWidth: opts.lineWidth ?? 1,
6677
- lineStyle: opts.lineStyle ?? "solid"
6678
- };
6679
- }
6680
- }
6681
- function plotImpl(ctx, slotId, value, opts) {
6682
- const style = buildStyle(opts);
6683
- if (!ctx.capabilities.plots.has(style.kind)) {
6684
- pushDiagnostic(ctx.emissions, {
6685
- kind: "diagnostic",
6686
- severity: "warning",
6687
- code: "unsupported-plot-kind",
6688
- message: `Adapter cannot render plot kind "${style.kind}".`,
6689
- slotId,
6690
- bar: ctx.barIndex()
6691
- });
6692
- return;
6693
- }
6694
- const pane = resolvePane(opts.pane, ctx, slotId);
6695
- const xShift = typeof value === "number" ? 0 : seriesOffsetOf(value);
6696
- const z = opts.z ?? 0;
6697
- const emission = {
6698
- kind: "plot",
6699
- slotId,
6700
- title: opts.title ?? "",
6701
- style,
6702
- bar: ctx.barIndex(),
6703
- time: ctx.stream.bar.time,
6704
- value: resolveValue(value),
6705
- color: opts.color ?? null,
6706
- meta: {},
6707
- pane,
6708
- ...xShift === 0 ? {} : { xShift },
6709
- ...z === 0 ? {} : { z }
6710
- };
6711
- pushPlot(ctx.emissions, applyPlotOverride(emission, ctx.plotOverrides[slotId]));
6712
- }
6713
- function plot2(arg1, arg2, arg3) {
6714
- if (typeof arg1 !== "string") {
6715
- throw new Error(OUTSIDE_CTX_MESSAGE67);
6716
- }
6717
- const ctx = ACTIVE_RUNTIME_CONTEXT.current;
6718
- if (!ctx)
6719
- throw new Error(OUTSIDE_CTX_MESSAGE67);
6720
- if (!isNumberOrSeries(arg2)) {
6721
- throw new Error(OUTSIDE_CTX_MESSAGE67);
6722
- }
6723
- plotImpl(ctx, arg1, arg2, arg3 ?? {});
6724
- }
6725
-
6726
7204
  // ../runtime/dist/ta/lib/volume-profile/scaffold.js
6727
7205
  var DEFAULT_ROW_SIZE = 24;
6728
7206
  var DEFAULT_VALUE_AREA_PCT = 0.7;
@@ -6879,15 +7357,15 @@ function collectBars(ctx, anchor) {
6879
7357
  const { ohlcv } = ctx.stream;
6880
7358
  const bars = [];
6881
7359
  for (let lookback = ohlcv.close.length - 1; lookback >= 0; lookback -= 1) {
6882
- const time = ohlcv.time.at(lookback);
6883
- if (time < anchor)
7360
+ const time2 = ohlcv.time.at(lookback);
7361
+ if (time2 < anchor)
6884
7362
  continue;
6885
7363
  bars.push({
6886
7364
  close: ohlcv.close.at(lookback),
6887
7365
  high: ohlcv.high.at(lookback),
6888
7366
  low: ohlcv.low.at(lookback),
6889
7367
  open: ohlcv.open.at(lookback),
6890
- time,
7368
+ time: time2,
6891
7369
  volume: ohlcv.volume.at(lookback)
6892
7370
  });
6893
7371
  }
@@ -6947,8 +7425,8 @@ function readSource(ctx, source) {
6947
7425
  return ctx.stream.bar.hlcc4;
6948
7426
  }
6949
7427
  }
6950
- function fold(inCumPV, inCumV, inStarted, anchorTime, time, src, volume) {
6951
- if (time < anchorTime) {
7428
+ function fold(inCumPV, inCumV, inStarted, anchorTime, time2, src, volume) {
7429
+ if (time2 < anchorTime) {
6952
7430
  return { cumPV: inCumPV, cumV: inCumV, started: inStarted };
6953
7431
  }
6954
7432
  let cumPV = inCumPV;
@@ -6974,16 +7452,16 @@ function anchoredVwap(slotId, anchorTime, opts) {
6974
7452
  }
6975
7453
  const src = readSource(ctx, source);
6976
7454
  const volume = ctx.stream.bar.volume;
6977
- const time = ctx.stream.bar.time;
7455
+ const time2 = ctx.stream.bar.time;
6978
7456
  if (ctx.isTick) {
6979
- const next2 = fold(slot.prevClosedCumPV, slot.prevClosedCumV, slot.prevClosedStarted, slot.anchorTime, time, src, volume);
7457
+ const next2 = fold(slot.prevClosedCumPV, slot.prevClosedCumV, slot.prevClosedStarted, slot.anchorTime, time2, src, volume);
6980
7458
  slot.outBuffer.replaceHead(valueFromCum(next2.started, next2.cumPV, next2.cumV));
6981
7459
  return slot.series;
6982
7460
  }
6983
7461
  slot.prevClosedCumPV = slot.cumPV;
6984
7462
  slot.prevClosedCumV = slot.cumV;
6985
7463
  slot.prevClosedStarted = slot.started;
6986
- const next = fold(slot.cumPV, slot.cumV, slot.started, slot.anchorTime, time, src, volume);
7464
+ const next = fold(slot.cumPV, slot.cumV, slot.started, slot.anchorTime, time2, src, volume);
6987
7465
  slot.cumPV = next.cumPV;
6988
7466
  slot.cumV = next.cumV;
6989
7467
  slot.started = next.started;
@@ -9724,15 +10202,15 @@ function collectBars2(ctx, from, to) {
9724
10202
  const { ohlcv } = ctx.stream;
9725
10203
  const bars = [];
9726
10204
  for (let lookback = ohlcv.close.length - 1; lookback >= 0; lookback -= 1) {
9727
- const time = ohlcv.time.at(lookback);
9728
- if (time < from || time > to)
10205
+ const time2 = ohlcv.time.at(lookback);
10206
+ if (time2 < from || time2 > to)
9729
10207
  continue;
9730
10208
  bars.push({
9731
10209
  close: ohlcv.close.at(lookback),
9732
10210
  high: ohlcv.high.at(lookback),
9733
10211
  low: ohlcv.low.at(lookback),
9734
10212
  open: ohlcv.open.at(lookback),
9735
- time,
10213
+ time: time2,
9736
10214
  volume: ohlcv.volume.at(lookback)
9737
10215
  });
9738
10216
  }
@@ -11553,8 +12031,8 @@ function emitLevels(slot, levels, isTick) {
11553
12031
  slot.s3Buffer.append(levels.s3);
11554
12032
  }
11555
12033
  }
11556
- function closeStep3(slot, time, high, low, close) {
11557
- const dayKey = Math.floor(time / MS_PER_DAY2);
12034
+ function closeStep3(slot, time2, high, low, close) {
12035
+ const dayKey = Math.floor(time2 / MS_PER_DAY2);
11558
12036
  snapshot(slot);
11559
12037
  if (slot.barCount === 0) {
11560
12038
  slot.barCount = 1;
@@ -11581,11 +12059,11 @@ function closeStep3(slot, time, high, low, close) {
11581
12059
  slot.barCount += 1;
11582
12060
  return computeLevels(slot);
11583
12061
  }
11584
- function tickStep2(slot, time, _high, _low, _close) {
12062
+ function tickStep2(slot, time2, _high, _low, _close) {
11585
12063
  if (slot.prevClosedBarCount === 0) {
11586
12064
  return makeNaNLevels();
11587
12065
  }
11588
- const dayKey = Math.floor(time / MS_PER_DAY2);
12066
+ const dayKey = Math.floor(time2 / MS_PER_DAY2);
11589
12067
  const snapKey = slot.prevClosedCurrentDayKey;
11590
12068
  const snapPrevHigh = slot.prevClosedPrevDayHigh;
11591
12069
  const snapPrevLow = slot.prevClosedPrevDayLow;
@@ -12510,6 +12988,26 @@ function rvi(slotId, source, length, opts) {
12510
12988
  return viewForOffset21(slot, opts?.offset ?? 0);
12511
12989
  }
12512
12990
 
12991
+ // ../runtime/dist/time-accessors/sessionWindow.js
12992
+ var SESSION_WINDOW = /^(\d{1,2})(?::?(\d{2}))?\s*-\s*(\d{1,2})(?::?(\d{2}))?$/;
12993
+ function parseSessionWindowMinutes(spec) {
12994
+ const match = SESSION_WINDOW.exec(spec.trim());
12995
+ if (match === null)
12996
+ return null;
12997
+ const startHour = Number(match[1]);
12998
+ const startMinute = match[2] === void 0 ? 0 : Number(match[2]);
12999
+ const endHour = Number(match[3]);
13000
+ const endMinute = match[4] === void 0 ? 0 : Number(match[4]);
13001
+ if (startHour < 0 || startHour > 23 || startMinute < 0 || startMinute > 59)
13002
+ return null;
13003
+ if (endHour < 0 || endHour > 23 || endMinute < 0 || endMinute > 59)
13004
+ return null;
13005
+ return {
13006
+ startMinutes: startHour * 60 + startMinute,
13007
+ endMinutes: endHour * 60 + endMinute
13008
+ };
13009
+ }
13010
+
12513
13011
  // ../runtime/dist/ta/sessionVolumeProfile.js
12514
13012
  var DAY_MS = 864e5;
12515
13013
  function getCtx77() {
@@ -12552,33 +13050,16 @@ function resultForOffset10(slot, offset) {
12552
13050
  }
12553
13051
  return cached;
12554
13052
  }
12555
- function utcDayStart(time) {
12556
- return Math.floor(time / DAY_MS) * DAY_MS;
12557
- }
12558
- function parseSessionWindowMinutes(session) {
12559
- const match = /^(\d{1,2})(?::?(\d{2}))?\s*-\s*(\d{1,2})(?::?(\d{2}))?$/.exec(session.trim());
12560
- if (match === null)
12561
- return null;
12562
- const startHour = Number(match[1]);
12563
- const startMinute = match[2] === void 0 ? 0 : Number(match[2]);
12564
- const endHour = Number(match[3]);
12565
- const endMinute = match[4] === void 0 ? 0 : Number(match[4]);
12566
- if (startHour < 0 || startHour > 23 || startMinute < 0 || startMinute > 59)
12567
- return null;
12568
- if (endHour < 0 || endHour > 23 || endMinute < 0 || endMinute > 59)
12569
- return null;
12570
- return {
12571
- startMinutes: startHour * 60 + startMinute,
12572
- endMinutes: endHour * 60 + endMinute
12573
- };
13053
+ function utcDayStart(time2) {
13054
+ return Math.floor(time2 / DAY_MS) * DAY_MS;
12574
13055
  }
12575
- function sessionBoundaryFromDescriptor(time, session) {
12576
- const parsed = parseSessionWindowMinutes(session);
13056
+ function sessionBoundaryFromDescriptor(time2, session2) {
13057
+ const parsed = parseSessionWindowMinutes(session2);
12577
13058
  if (parsed === null)
12578
13059
  return null;
12579
- const dayStart = utcDayStart(time);
13060
+ const dayStart = utcDayStart(time2);
12580
13061
  const boundary = dayStart + parsed.startMinutes * 6e4;
12581
- return time >= boundary ? boundary : boundary - DAY_MS;
13062
+ return time2 >= boundary ? boundary : boundary - DAY_MS;
12582
13063
  }
12583
13064
  function diagnoseMissingSession(ctx, slotId) {
12584
13065
  const key = `session-info-missing|${slotId}`;
@@ -12597,12 +13078,12 @@ function diagnoseMissingSession(ctx, slotId) {
12597
13078
  function resolveSessionStart(ctx, slotId, opts) {
12598
13079
  if (opts?.sessionStart !== void 0)
12599
13080
  return opts.sessionStart;
12600
- const session = ctx.views.syminfo.session;
12601
- if (!ctx.capabilities.symInfoFields.has("session") || session === "") {
13081
+ const session2 = ctx.views.syminfo.session;
13082
+ if (!ctx.capabilities.symInfoFields.has("session") || session2 === "") {
12602
13083
  diagnoseMissingSession(ctx, slotId);
12603
13084
  return utcDayStart(ctx.stream.bar.time);
12604
13085
  }
12605
- const boundary = sessionBoundaryFromDescriptor(ctx.stream.bar.time, session);
13086
+ const boundary = sessionBoundaryFromDescriptor(ctx.stream.bar.time, session2);
12606
13087
  if (boundary === null) {
12607
13088
  diagnoseMissingSession(ctx, slotId);
12608
13089
  return utcDayStart(ctx.stream.bar.time);
@@ -12613,15 +13094,15 @@ function collectBars3(ctx, sessionStart) {
12613
13094
  const { ohlcv } = ctx.stream;
12614
13095
  const bars = [];
12615
13096
  for (let lookback = ohlcv.close.length - 1; lookback >= 0; lookback -= 1) {
12616
- const time = ohlcv.time.at(lookback);
12617
- if (time <= sessionStart)
13097
+ const time2 = ohlcv.time.at(lookback);
13098
+ if (time2 <= sessionStart)
12618
13099
  continue;
12619
13100
  bars.push({
12620
13101
  close: ohlcv.close.at(lookback),
12621
13102
  high: ohlcv.high.at(lookback),
12622
13103
  low: ohlcv.low.at(lookback),
12623
13104
  open: ohlcv.open.at(lookback),
12624
- time,
13105
+ time: time2,
12625
13106
  volume: ohlcv.volume.at(lookback)
12626
13107
  });
12627
13108
  }
@@ -13539,15 +14020,15 @@ function collectBars4(ctx) {
13539
14020
  const { fromTime, toTime } = ctx.stream.bar.viewport;
13540
14021
  const bars = [];
13541
14022
  for (let lookback = ohlcv.close.length - 1; lookback >= 0; lookback -= 1) {
13542
- const time = ohlcv.time.at(lookback);
13543
- if (time < fromTime || time > toTime)
14023
+ const time2 = ohlcv.time.at(lookback);
14024
+ if (time2 < fromTime || time2 > toTime)
13544
14025
  continue;
13545
14026
  bars.push({
13546
14027
  close: ohlcv.close.at(lookback),
13547
14028
  high: ohlcv.high.at(lookback),
13548
14029
  low: ohlcv.low.at(lookback),
13549
14030
  open: ohlcv.open.at(lookback),
13550
- time,
14031
+ time: time2,
13551
14032
  volume: ohlcv.volume.at(lookback)
13552
14033
  });
13553
14034
  }
@@ -13913,8 +14394,8 @@ function readSource2(ctx, source) {
13913
14394
  return ctx.stream.bar.hlcc4;
13914
14395
  }
13915
14396
  }
13916
- function dayKeyOf(time) {
13917
- return Math.floor(time / MS_PER_DAY3);
14397
+ function dayKeyOf(time2) {
14398
+ return Math.floor(time2 / MS_PER_DAY3);
13918
14399
  }
13919
14400
  function fold7(inCumPV, inCumV, inDayKey, dayKey, src, volume) {
13920
14401
  let cumPV = inCumPV;
@@ -14669,6 +15150,196 @@ var TA_REGISTRY_METADATA = Object.freeze({
14669
15150
  // ../runtime/dist/primitives.js
14670
15151
  var ta3 = TA_REGISTRY;
14671
15152
 
15153
+ // ../runtime/dist/time-accessors/civil.js
15154
+ var DAY_MS2 = 864e5;
15155
+ function floorDiv(a, b) {
15156
+ return Math.floor(a / b);
15157
+ }
15158
+ function mod(a, b) {
15159
+ return a - floorDiv(a, b) * b;
15160
+ }
15161
+ function civilFromDays(z) {
15162
+ const shifted = z + 719468;
15163
+ const era = floorDiv(shifted >= 0 ? shifted : shifted - 146096, 146097);
15164
+ const doe = shifted - era * 146097;
15165
+ const yoe = floorDiv(doe - floorDiv(doe, 1460) + floorDiv(doe, 36524) - floorDiv(doe, 146096), 365);
15166
+ const y = yoe + era * 400;
15167
+ const doy = doe - (365 * yoe + floorDiv(yoe, 4) - floorDiv(yoe, 100));
15168
+ const mp = floorDiv(5 * doy + 2, 153);
15169
+ const d = doy - floorDiv(153 * mp + 2, 5) + 1;
15170
+ const m = mp < 10 ? mp + 3 : mp - 9;
15171
+ return { y: m <= 2 ? y + 1 : y, m, d };
15172
+ }
15173
+ function daysFromCivil(y, m, d) {
15174
+ const yy = m <= 2 ? y - 1 : y;
15175
+ const era = floorDiv(yy >= 0 ? yy : yy - 399, 400);
15176
+ const yoe = yy - era * 400;
15177
+ const doy = floorDiv(153 * (m > 2 ? m - 3 : m + 9) + 2, 5) + d - 1;
15178
+ const doe = yoe * 365 + floorDiv(yoe, 4) - floorDiv(yoe, 100) + doy;
15179
+ return era * 146097 + doe - 719468;
15180
+ }
15181
+ function splitEpoch(ms, offsetMin) {
15182
+ const local = Math.floor(ms) + offsetMin * 6e4;
15183
+ const z = floorDiv(local, DAY_MS2);
15184
+ const secondsOfDay = floorDiv(mod(local, DAY_MS2), 1e3);
15185
+ const { y, m, d } = civilFromDays(z);
15186
+ return {
15187
+ y,
15188
+ m,
15189
+ d,
15190
+ hh: floorDiv(secondsOfDay, 3600),
15191
+ mm: floorDiv(mod(secondsOfDay, 3600), 60),
15192
+ ss: mod(secondsOfDay, 60),
15193
+ dow: mod(z + 4, 7)
15194
+ };
15195
+ }
15196
+
15197
+ // ../runtime/dist/time-accessors/tzDiagnostic.js
15198
+ function buildTzDstReporter(ctx) {
15199
+ return (tz) => {
15200
+ const key = `tz-dst-unsupported|${tz}`;
15201
+ if (ctx.diagnosedTzKeys.has(key))
15202
+ return;
15203
+ ctx.diagnosedTzKeys.add(key);
15204
+ pushDiagnostic(ctx.emissions, {
15205
+ kind: "diagnostic",
15206
+ severity: "warning",
15207
+ code: "tz-dst-unsupported",
15208
+ message: `Timezone \`${tz}\` needs DST data unavailable in this build; calendar fields used UTC.`,
15209
+ slotId: null,
15210
+ bar: ctx.barIndex()
15211
+ });
15212
+ };
15213
+ }
15214
+
15215
+ // ../runtime/dist/time-accessors/tzOffset.js
15216
+ var UTC_ALIASES = /* @__PURE__ */ new Set(["", "UTC", "ETC/UTC", "GMT", "Z"]);
15217
+ var UTC = { offsetMin: 0, dstUnsupported: false };
15218
+ var DST_UNSUPPORTED = { offsetMin: 0, dstUnsupported: true };
15219
+ var SIGNED_OFFSET = /^([+-])(\d{1,2})(?::?(\d{2}))?$/;
15220
+ var UTC_PREFIXED = /^(?:UTC|GMT)([+-]\d{1,2}(?::?\d{2})?)$/;
15221
+ var ETC_GMT = /^ETC\/GMT([+-])(\d{1,2})$/;
15222
+ function parseSignedOffset(value) {
15223
+ const match = SIGNED_OFFSET.exec(value);
15224
+ if (match === null)
15225
+ return null;
15226
+ const hours = Number(match[2]);
15227
+ const minutes = match[3] === void 0 ? 0 : Number(match[3]);
15228
+ if (hours > 23 || minutes > 59)
15229
+ return null;
15230
+ const magnitude = hours * 60 + minutes;
15231
+ return match[1] === "-" ? -magnitude : magnitude;
15232
+ }
15233
+ function resolveOffsetMinutes(tz) {
15234
+ const normalized = tz.trim().toUpperCase();
15235
+ if (UTC_ALIASES.has(normalized))
15236
+ return UTC;
15237
+ const signed = parseSignedOffset(normalized);
15238
+ if (signed !== null)
15239
+ return { offsetMin: signed, dstUnsupported: false };
15240
+ const utcPrefixed = UTC_PREFIXED.exec(normalized);
15241
+ if (utcPrefixed !== null) {
15242
+ const minutes = parseSignedOffset(utcPrefixed[1]);
15243
+ if (minutes !== null)
15244
+ return { offsetMin: minutes, dstUnsupported: false };
15245
+ }
15246
+ const etcGmt = ETC_GMT.exec(normalized);
15247
+ if (etcGmt !== null) {
15248
+ const hours = Number(etcGmt[2]);
15249
+ if (hours <= 23) {
15250
+ const magnitude = hours * 60;
15251
+ return { offsetMin: etcGmt[1] === "-" ? magnitude : -magnitude, dstUnsupported: false };
15252
+ }
15253
+ }
15254
+ return DST_UNSUPPORTED;
15255
+ }
15256
+
15257
+ // ../runtime/dist/time-accessors/timeAccessors.js
15258
+ function resolveTz(tz, getDefaultTz) {
15259
+ if (tz !== void 0 && tz !== "")
15260
+ return tz;
15261
+ const fallback2 = getDefaultTz();
15262
+ return fallback2 === "" ? "UTC" : fallback2;
15263
+ }
15264
+ function isInt(value) {
15265
+ return Number.isInteger(value);
15266
+ }
15267
+ function createTimeNamespace(getDefaultTz, getIntervalMs, onDstUnsupported) {
15268
+ function offsetFor(tz) {
15269
+ const resolved = resolveTz(tz, getDefaultTz);
15270
+ const { offsetMin, dstUnsupported } = resolveOffsetMinutes(resolved);
15271
+ if (dstUnsupported)
15272
+ onDstUnsupported(resolved);
15273
+ return offsetMin;
15274
+ }
15275
+ function field(t, tz, key) {
15276
+ const offsetMin = offsetFor(tz);
15277
+ if (!Number.isFinite(t))
15278
+ return Number.NaN;
15279
+ return splitEpoch(t, offsetMin)[key];
15280
+ }
15281
+ return Object.freeze({
15282
+ year: (t, tz) => field(t, tz, "y"),
15283
+ month: (t, tz) => field(t, tz, "m"),
15284
+ dayofmonth: (t, tz) => field(t, tz, "d"),
15285
+ hour: (t, tz) => field(t, tz, "hh"),
15286
+ minute: (t, tz) => field(t, tz, "mm"),
15287
+ second: (t, tz) => field(t, tz, "ss"),
15288
+ dayofweek: (t, tz) => {
15289
+ const offsetMin = offsetFor(tz);
15290
+ if (!Number.isFinite(t))
15291
+ return Number.NaN;
15292
+ return splitEpoch(t, offsetMin).dow + 1;
15293
+ },
15294
+ timestamp: (year, month, day, hour, minute, second, tz) => {
15295
+ const offsetMin = offsetFor(tz);
15296
+ const hh = hour ?? 0;
15297
+ const mm = minute ?? 0;
15298
+ const ss = second ?? 0;
15299
+ if (!isInt(year) || !isInt(month) || !isInt(day) || !isInt(hh) || !isInt(mm) || !isInt(ss) || month < 1 || month > 12 || day < 1 || day > 31 || hh < 0 || hh > 23 || mm < 0 || mm > 59 || ss < 0 || ss > 59) {
15300
+ return Number.NaN;
15301
+ }
15302
+ return daysFromCivil(year, month, day) * 864e5 + (hh * 3600 + mm * 60 + ss) * 1e3 - offsetMin * 6e4;
15303
+ },
15304
+ timeClose: (t, tz) => {
15305
+ offsetFor(tz);
15306
+ if (!Number.isFinite(t))
15307
+ return Number.NaN;
15308
+ return t + getIntervalMs();
15309
+ }
15310
+ });
15311
+ }
15312
+ function buildTimeNamespace(ctx) {
15313
+ return createTimeNamespace(() => ctx.views.syminfo.timezone, () => ctx.views.timeframe.inSeconds * 1e3, buildTzDstReporter(ctx));
15314
+ }
15315
+
15316
+ // ../runtime/dist/time-accessors/sessionAccessors.js
15317
+ function createSessionNamespace(getDefaultTz, onDstUnsupported) {
15318
+ return Object.freeze({
15319
+ isOpen(t, spec, tz) {
15320
+ if (!Number.isFinite(t))
15321
+ return false;
15322
+ const parsed = parseSessionWindowMinutes(spec);
15323
+ if (parsed === null)
15324
+ return false;
15325
+ const resolved = resolveTz(tz, getDefaultTz);
15326
+ const { offsetMin, dstUnsupported } = resolveOffsetMinutes(resolved);
15327
+ if (dstUnsupported)
15328
+ onDstUnsupported(resolved);
15329
+ const { hh, mm } = splitEpoch(t, offsetMin);
15330
+ const minuteOfDay = hh * 60 + mm;
15331
+ const { startMinutes, endMinutes } = parsed;
15332
+ if (endMinutes <= startMinutes) {
15333
+ return minuteOfDay >= startMinutes || minuteOfDay < endMinutes;
15334
+ }
15335
+ return minuteOfDay >= startMinutes && minuteOfDay < endMinutes;
15336
+ }
15337
+ });
15338
+ }
15339
+ function buildSessionNamespace(ctx) {
15340
+ return createSessionNamespace(() => ctx.views.syminfo.timezone, buildTzDstReporter(ctx));
15341
+ }
15342
+
14672
15343
  // ../runtime/dist/buildComputeContext.js
14673
15344
  function buildComputeContext(state2) {
14674
15345
  const base = {
@@ -14677,12 +15348,16 @@ function buildComputeContext(state2) {
14677
15348
  ta: ta3,
14678
15349
  plot: plot2,
14679
15350
  hline: hline2,
15351
+ bgcolor: bgcolor2,
15352
+ barcolor: barcolor2,
14680
15353
  alert: alert2,
14681
15354
  draw: DRAW_NAMESPACE,
14682
15355
  state: buildStateNamespace(),
14683
15356
  barstate: state2.runtimeContext.views.barstate,
14684
15357
  syminfo: state2.runtimeContext.views.syminfo,
14685
15358
  timeframe: state2.runtimeContext.views.timeframe,
15359
+ time: buildTimeNamespace(state2.runtimeContext),
15360
+ session: buildSessionNamespace(state2.runtimeContext),
14686
15361
  request: buildRequestNamespace(),
14687
15362
  runtime: buildRuntimeNamespace(state2.runtimeContext)
14688
15363
  };
@@ -14720,6 +15395,7 @@ async function runComputeBody(args) {
14720
15395
  if (isTick) {
14721
15396
  resetTentativeStateSlots(state2.runtimeContext);
14722
15397
  resetSeriesHeads(state2.runtimeContext);
15398
+ resetTentativeArraySlots(state2.runtimeContext);
14723
15399
  } else {
14724
15400
  advanceSeriesSlots(state2.runtimeContext);
14725
15401
  }
@@ -14730,6 +15406,7 @@ async function runComputeBody(args) {
14730
15406
  commitStateSlots(state2.runtimeContext);
14731
15407
  flushStateSlots(state2.runtimeContext);
14732
15408
  commitSeriesSlots(state2.runtimeContext);
15409
+ commitArraySlots(state2.runtimeContext);
14733
15410
  }
14734
15411
  } catch (err) {
14735
15412
  if (!isRuntimeErrorHalt(err))
@@ -14883,12 +15560,15 @@ function buildSubRunnerState(args, slotIdPrefix, isDep) {
14883
15560
  scriptMaxDrawings: args.compiled.manifest.maxDrawings ?? null,
14884
15561
  stateSlots: /* @__PURE__ */ new Map(),
14885
15562
  seriesSlots: /* @__PURE__ */ new Map(),
15563
+ arraySlots: /* @__PURE__ */ new Map(),
15564
+ chartSymbol: args.chartSymbol,
14886
15565
  secondaryStreams: args.secondaryStreams,
14887
15566
  requestSecurityBars: /* @__PURE__ */ new Map(),
14888
15567
  requestSecurityAlignments: /* @__PURE__ */ new Map(),
14889
15568
  requestSecurityAscendingBars: /* @__PURE__ */ new Map(),
14890
15569
  requestLowerTfViews: /* @__PURE__ */ new Map(),
14891
15570
  diagnosedRequestKeys: /* @__PURE__ */ new Set(),
15571
+ diagnosedTzKeys: /* @__PURE__ */ new Set(),
14892
15572
  alertConditions,
14893
15573
  diagnosedAlertConditionKeys: /* @__PURE__ */ new Set(),
14894
15574
  logBudget: 0,
@@ -15010,13 +15690,13 @@ async function runSiblingStep(sibling, parentState, rawBar, eventKind, isTick) {
15010
15690
 
15011
15691
  // ../runtime/dist/dep/depOutput.js
15012
15692
  var DEP_OUTPUT_GLOBAL_KEY = "__chartlang_depOutput";
15013
- var OUTSIDE_CTX_MESSAGE68 = "__chartlang_depOutput called outside an active script step";
15693
+ var OUTSIDE_CTX_MESSAGE70 = "__chartlang_depOutput called outside an active script step";
15014
15694
  var NO_STORE_MESSAGE = "__chartlang_depOutput called on a runner with no dep output store";
15015
15695
  var NAN_SERIES = makeSeriesView(new Float64RingBuffer(1));
15016
15696
  function __chartlang_depOutput(slotId, localId, title) {
15017
15697
  const ctx = ACTIVE_RUNTIME_CONTEXT.current;
15018
15698
  if (ctx === null) {
15019
- throw new Error(OUTSIDE_CTX_MESSAGE68);
15699
+ throw new Error(OUTSIDE_CTX_MESSAGE70);
15020
15700
  }
15021
15701
  const store = ctx.depOutputStore;
15022
15702
  if (store === void 0 || store === null) {
@@ -15092,6 +15772,7 @@ function dispose(state2) {
15092
15772
  state2.runtimeContext.drawingSubIdCounters.clear();
15093
15773
  state2.runtimeContext.stateSlots.clear();
15094
15774
  state2.runtimeContext.seriesSlots.clear();
15775
+ state2.runtimeContext.arraySlots.clear();
15095
15776
  state2.runtimeContext.secondaryStreams.clear();
15096
15777
  state2.runtimeContext.requestSecurityBars.clear();
15097
15778
  state2.runtimeContext.requestSecurityAlignments.clear();
@@ -15110,6 +15791,7 @@ function dispose(state2) {
15110
15791
  }
15111
15792
  state2.runtimeContext.requestLowerTfViews.clear();
15112
15793
  state2.runtimeContext.diagnosedRequestKeys.clear();
15794
+ state2.runtimeContext.diagnosedTzKeys.clear();
15113
15795
  state2.runtimeContext.diagnosedInputKeys.clear();
15114
15796
  const counters = state2.runtimeContext.drawingBucketCounters;
15115
15797
  counters.lines = 0;
@@ -15497,6 +16179,7 @@ function primarySectionSlots(state2) {
15497
16179
  return Object.freeze({
15498
16180
  ...serialiseStateSlots(state2.runtimeContext),
15499
16181
  ...serialiseSeriesSlots(state2.runtimeContext),
16182
+ ...serialiseArraySlots(state2.runtimeContext),
15500
16183
  ...serialiseTaSlots(state2.mainStream)
15501
16184
  });
15502
16185
  }
@@ -15504,7 +16187,8 @@ function runnerSection(ctx) {
15504
16187
  return Object.freeze({
15505
16188
  slots: Object.freeze({
15506
16189
  ...serialiseStateSlots(ctx),
15507
- ...serialiseSeriesSlots(ctx)
16190
+ ...serialiseSeriesSlots(ctx),
16191
+ ...serialiseArraySlots(ctx)
15508
16192
  })
15509
16193
  });
15510
16194
  }
@@ -15553,7 +16237,7 @@ function resolveMainStreamSnapshot(snapshot6, mainInterval) {
15553
16237
  function scalarStateSlots(slots) {
15554
16238
  const out = {};
15555
16239
  for (const [slotKey, value] of Object.entries(slots)) {
15556
- if (!isTaSlotSnapshotKey(slotKey) && !isSeriesSlotSnapshotKey(slotKey)) {
16240
+ if (!isTaSlotSnapshotKey(slotKey) && !isSeriesSlotSnapshotKey(slotKey) && !isArraySlotSnapshotKey(slotKey)) {
15557
16241
  out[slotKey] = value;
15558
16242
  }
15559
16243
  }
@@ -15562,6 +16246,7 @@ function scalarStateSlots(slots) {
15562
16246
  function restoreRunnerSlots(ctx, slots, capacity) {
15563
16247
  restoreStateSlots(ctx, scalarStateSlots(slots));
15564
16248
  restoreSeriesSlots(ctx, slots, capacity);
16249
+ restoreArraySlots(ctx, slots);
15565
16250
  }
15566
16251
  function pushMalformedSection(state2, message) {
15567
16252
  pushDiagnostic(state2.emissions, {
@@ -15672,12 +16357,19 @@ function resolveCapacity(manifest) {
15672
16357
  const fallback2 = manifest.maxLookback + 1;
15673
16358
  return Math.max(1, ohlcv ?? fallback2, dynamicFallback ?? 0);
15674
16359
  }
15675
- function createSecondaryStreams(manifest, capacity) {
16360
+ function legacyFeedsFromIntervals(manifest) {
16361
+ return manifest.requestedIntervals.map((interval) => ({ interval }));
16362
+ }
16363
+ function createSecondaryStreams(manifest, capacity, chartSymbol) {
15676
16364
  const streams = /* @__PURE__ */ new Map();
15677
- for (const interval of manifest.requestedIntervals) {
15678
- if (streams.has(interval))
16365
+ const feeds = manifest.requestedFeeds ?? legacyFeedsFromIntervals(manifest);
16366
+ for (const feed of feeds) {
16367
+ const resolved = feed.symbol === void 0 || feed.symbol === chartSymbol ? void 0 : feed.symbol;
16368
+ const key = feedKey(resolved, feed.interval);
16369
+ if (streams.has(key))
15679
16370
  continue;
15680
- streams.set(interval, createStreamState({ interval, capacity, symbol: "" }));
16371
+ const symbol = feed.symbol ?? chartSymbol;
16372
+ streams.set(key, createStreamState({ interval: feed.interval, capacity, symbol }));
15681
16373
  }
15682
16374
  return streams;
15683
16375
  }
@@ -15734,8 +16426,9 @@ function primaryOf(compiled) {
15734
16426
  }
15735
16427
  function buildPrimaryState(args, primary) {
15736
16428
  const capacity = resolveCapacity(primary.manifest);
16429
+ const chartSymbol = args.symInfo?.ticker ?? "";
15737
16430
  const mainStream = createStreamState({ interval: "", capacity, symbol: "" });
15738
- const secondaryStreams = createSecondaryStreams(primary.manifest, capacity);
16431
+ const secondaryStreams = createSecondaryStreams(primary.manifest, capacity, chartSymbol);
15739
16432
  const stateStore = args.stateStore ?? inMemoryStateStore();
15740
16433
  const now = args.now ?? Date.now;
15741
16434
  const views = createRuntimeViews({
@@ -15781,12 +16474,15 @@ function buildPrimaryState(args, primary) {
15781
16474
  scriptMaxDrawings: primary.manifest.maxDrawings ?? null,
15782
16475
  stateSlots: /* @__PURE__ */ new Map(),
15783
16476
  seriesSlots: /* @__PURE__ */ new Map(),
16477
+ arraySlots: /* @__PURE__ */ new Map(),
16478
+ chartSymbol,
15784
16479
  secondaryStreams,
15785
16480
  requestSecurityBars: /* @__PURE__ */ new Map(),
15786
16481
  requestSecurityAlignments: /* @__PURE__ */ new Map(),
15787
16482
  requestSecurityAscendingBars: /* @__PURE__ */ new Map(),
15788
16483
  requestLowerTfViews: /* @__PURE__ */ new Map(),
15789
16484
  diagnosedRequestKeys: /* @__PURE__ */ new Set(),
16485
+ diagnosedTzKeys: /* @__PURE__ */ new Set(),
15790
16486
  alertConditions,
15791
16487
  diagnosedAlertConditionKeys: /* @__PURE__ */ new Set(),
15792
16488
  logBudget: 0,
@@ -15810,7 +16506,7 @@ function buildPrimaryState(args, primary) {
15810
16506
  state2.runtimeContext.plotOverrides = args.plotOverrides ?? args.resolvePlotOverrides?.(primary.manifest.name) ?? Object.freeze({});
15811
16507
  const exprRunners = buildSecurityExprRunners(primary.manifest, state2.runtimeContext, capacity);
15812
16508
  state2.runtimeContext.securityExprRunners = exprRunners.bySlot;
15813
- state2.runtimeContext.securityExprRunnersByInterval = exprRunners.byInterval;
16509
+ state2.runtimeContext.securityExprRunnersByFeed = exprRunners.byFeed;
15814
16510
  state2.runtimeContext.requestSecurityExprSeries = /* @__PURE__ */ new Map();
15815
16511
  return state2;
15816
16512
  }
@@ -15832,10 +16528,12 @@ function attachBundle(primary, bundle, capabilities2, now) {
15832
16528
  }))
15833
16529
  ];
15834
16530
  const store = createDepOutputStore({ producers, capacity: storeCapacity });
16531
+ const { chartSymbol } = primary.runtimeContext;
15835
16532
  const depRunners = bundle.dependencies.map((entry) => createDepRunner({
15836
16533
  compiled: entry.compiled,
15837
16534
  localId: entry.localId,
15838
16535
  parentCapabilities: capabilities2,
16536
+ chartSymbol,
15839
16537
  mainStream: primary.mainStream,
15840
16538
  secondaryStreams: primary.runtimeContext.secondaryStreams,
15841
16539
  depOutputStore: store,
@@ -15846,6 +16544,7 @@ function attachBundle(primary, bundle, capabilities2, now) {
15846
16544
  compiled: entry.compiled,
15847
16545
  exportName: entry.exportName,
15848
16546
  parentCapabilities: capabilities2,
16547
+ chartSymbol,
15849
16548
  mainStream: primary.mainStream,
15850
16549
  secondaryStreams: primary.runtimeContext.secondaryStreams,
15851
16550
  depOutputStore: store,
@@ -16059,15 +16758,15 @@ function isCompiledScriptObject(v) {
16059
16758
  const o = v;
16060
16759
  return typeof o.compute === "function" && typeof o.manifest === "object" && o.manifest !== null;
16061
16760
  }
16062
- function buildBundleFromModule(mod) {
16063
- const manifest = mod.__manifest;
16064
- const dependencies = mod.__dependencies ?? [];
16761
+ function buildBundleFromModule(mod2) {
16762
+ const manifest = mod2.__manifest;
16763
+ const dependencies = mod2.__dependencies ?? [];
16065
16764
  const isBundle = Array.isArray(manifest) || dependencies.length > 0;
16066
16765
  if (!isBundle) {
16067
16766
  if (isSingleManifest(manifest)) {
16068
- return Object.freeze({ ...mod.default, manifest });
16767
+ return Object.freeze({ ...mod2.default, manifest });
16069
16768
  }
16070
- return mod.default;
16769
+ return mod2.default;
16071
16770
  }
16072
16771
  const siblings = [];
16073
16772
  if (Array.isArray(manifest)) {
@@ -16075,7 +16774,7 @@ function buildBundleFromModule(mod) {
16075
16774
  const entry = manifest[i];
16076
16775
  const exportName = entry.exportName;
16077
16776
  if (exportName === void 0 || exportName === "default") continue;
16078
- const compiled = mod[exportName];
16777
+ const compiled = mod2[exportName];
16079
16778
  if (!isCompiledScriptObject(compiled)) continue;
16080
16779
  siblings.push(Object.freeze({ exportName, compiled }));
16081
16780
  }
@@ -16088,7 +16787,7 @@ function buildBundleFromModule(mod) {
16088
16787
  })
16089
16788
  );
16090
16789
  return Object.freeze({
16091
- primary: mod.default,
16790
+ primary: mod2.default,
16092
16791
  siblings: Object.freeze(siblings),
16093
16792
  dependencies: Object.freeze(frozenDeps)
16094
16793
  });
@@ -16107,8 +16806,8 @@ function createWorkerBoot(scope) {
16107
16806
  }
16108
16807
  if (msg.kind === "load") {
16109
16808
  try {
16110
- const mod = await importCompiledModule(msg.compiled.moduleSource);
16111
- const compiled = buildBundleFromModule(mod);
16809
+ const mod2 = await importCompiledModule(msg.compiled.moduleSource);
16810
+ const compiled = buildBundleFromModule(mod2);
16112
16811
  runner = createScriptRunner({
16113
16812
  compiled,
16114
16813
  capabilities: msg.capabilities,