@equinor/esv-intersection 3.0.6 → 3.0.8

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.mjs CHANGED
@@ -5049,27 +5049,31 @@ class q0 extends Ct {
5049
5049
  }
5050
5050
  }
5051
5051
  function Or(e, t) {
5052
- let n = 0, i = e.length - 1;
5053
- const r = 20;
5054
- let s = e[n][0], o = e[i][0];
5055
- for (; i - n > r; ) {
5056
- const c = Math.floor((i + n) / 2), h = e[c][0];
5057
- if (t >= s && t < h)
5058
- i = c, o = e[i][0];
5059
- else if (t >= h && t <= o)
5060
- n = c, s = e[n][0];
5061
- else if (t <= s && t > h)
5062
- i = c, o = e[i][0];
5063
- else if (t <= h && t >= o)
5064
- n = c, s = e[n][0];
5052
+ var c, h, l, u, f, p, d, g, y;
5053
+ if (e.length < 2)
5054
+ return -1;
5055
+ const n = 20;
5056
+ let i = 0, r = e.length - 1, s = (c = e[i]) == null ? void 0 : c[0], o = (h = e[r]) == null ? void 0 : h[0];
5057
+ for (; r - i > n; ) {
5058
+ const _ = Math.floor((r + i) / 2), x = (l = e[_]) == null ? void 0 : l[0];
5059
+ if (s == null || o == null || x == null)
5060
+ return -1;
5061
+ if (t >= s && t < x)
5062
+ r = _, o = (u = e[r]) == null ? void 0 : u[0];
5063
+ else if (t >= x && t <= o)
5064
+ i = _, s = (f = e[i]) == null ? void 0 : f[0];
5065
+ else if (t <= s && t > x)
5066
+ r = _, o = (p = e[r]) == null ? void 0 : p[0];
5067
+ else if (t <= x && t >= o)
5068
+ i = _, s = (d = e[i]) == null ? void 0 : d[0];
5065
5069
  else
5066
5070
  return -1;
5067
5071
  }
5068
5072
  let a = -1;
5069
- for (let c = n; c < i; c++) {
5070
- const h = e[c][0], l = e[c + 1][0];
5071
- if (Math.min(h, l) <= t && t <= Math.max(h, l)) {
5072
- a = c;
5073
+ for (let _ = i; _ < r; _++) {
5074
+ const x = (g = e[_]) == null ? void 0 : g[0], v = (y = e[_ + 1]) == null ? void 0 : y[0];
5075
+ if (x != null && v != null && Math.min(x, v) <= t && t <= Math.max(x, v)) {
5076
+ a = _;
5073
5077
  break;
5074
5078
  }
5075
5079
  }
@@ -5259,7 +5263,7 @@ function Q0(e, t) {
5259
5263
  }
5260
5264
  };
5261
5265
  }
5262
- async function J0(e, t, n, i) {
5266
+ async function J0(e, t, n, i = { isLeftToRight: !0 }) {
5263
5267
  if (!(e && e.datapoints && e.datapoints.length > 0))
5264
5268
  return;
5265
5269
  const { datapoints: r } = e, s = (i == null ? void 0 : i.seismicMin) || (i == null ? void 0 : i.seismicRange) || r.reduce((m, M) => Math.min(...M, m), 0), o = (i == null ? void 0 : i.seismicMax) || (i == null ? void 0 : i.seismicRange) || r.reduce((m, M) => Math.max(...M, m), 0), a = Math.max(Math.abs(s), Math.abs(o)), c = -a, h = a, l = {
@@ -5269,7 +5273,7 @@ async function J0(e, t, n, i) {
5269
5273
  }, u = t[0][0] - t[t.length - 1][0], f = Math.abs(Math.floor(u / 5)), p = e.yAxisValues.length, d = 1e3, g = su(n, d), y = new Uint8ClampedArray(f * p * 4);
5270
5274
  let _ = 0;
5271
5275
  const x = (d - 1) / l.difference;
5272
- let v = i != null && i.isLeftToRight ? t[0][0] : t[t.length - 1][0];
5276
+ let v = (i == null ? void 0 : i.isLeftToRight) == null ? t[0][0] : t[t.length - 1][0];
5273
5277
  const A = u / f * (i != null && i.isLeftToRight ? -1 : 1);
5274
5278
  let b, S, T, F, L;
5275
5279
  const O = [0, 0, 0];