@ai-matrx/content-ir 0.18.2 → 0.18.3

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.
package/dist/index.js CHANGED
@@ -5482,16 +5482,27 @@ var BacktickRuns = class {
5482
5482
  }
5483
5483
  };
5484
5484
  function codeSpans(text, from, to, out) {
5485
- const runs = new BacktickRuns(text, from, to);
5486
- for (let r = 0; r < runs.all.length; ) {
5487
- const [start, n] = runs.all[r];
5488
- const close = runs.next(n, start + n);
5485
+ let runs = null;
5486
+ for (let i = from; i < to; ) {
5487
+ const ch = text.charCodeAt(i);
5488
+ if (ch === 92) {
5489
+ i += 2;
5490
+ continue;
5491
+ }
5492
+ if (ch !== 96) {
5493
+ i++;
5494
+ continue;
5495
+ }
5496
+ const n = backtickRunLength(text, i);
5497
+ const len = Math.min(n, to - i);
5498
+ runs ??= new BacktickRuns(text, from, to);
5499
+ const close = runs.next(len, i + len);
5489
5500
  if (close === -1) {
5490
- r++;
5501
+ i += len;
5491
5502
  continue;
5492
5503
  }
5493
- out.push({ start, end: close + n, kind: "span" });
5494
- r = runs.index(close) + 1;
5504
+ out.push({ start: i, end: close + len, kind: "span" });
5505
+ i = close + len;
5495
5506
  }
5496
5507
  }
5497
5508
  function findCodeRanges(text) {