# vendor/

`lightweight-charts-line-tools.js` — pre-built (minified) fork of TradingView's
lightweight-charts with drawing tools, loaded from `index.html` as a plain
`<script>` and used through `src/lib/lineToolsChart.ts`. There is no build step
for it: the file is edited in place, so local patches are listed here.

## Local patches

### 1. Crosshair crash on a chart with a single bar

`TimeScale.prototype.Ri` (index → time) reads the bar spacing as

```js
f = this.Sd[1].Nt.timestamp - this.Sd[0].Nt.timestamp
```

while every other access in the same function is `?.`-guarded. Its caller only
checks that the time scale is non-empty, so a chart holding **exactly one** bar
throws `TypeError: Cannot read properties of undefined (reading 'Nt')` as soon as
the crosshair time label is painted — three times per hover, and the chart stops
repainting. Seen on staging for thin symbols whose range yields a single candle
(STABLEUSDT, RAVEUSDT, DEXEUSDT).

Patched to fall back to zero spacing, which makes the single bar's own timestamp
the answer for every index instead of `NaN`/a throw:

```js
f = this.Sd.length > 1 ? this.Sd[1].Nt.timestamp - this.Sd[0].Nt.timestamp : 0
```

Re-apply after any vendor bundle update.
